2016年7月5日 星期二

MAX14830 i2c uart support devicetree

https://groups.google.com/forum/#!topic/acmesystems/xLCdHYX81HA


Hello,

This  for anyone still interested in getting more UARTs via I2C with MAX14830.

I have a partial solution for Kernel version 3.14 (the one I use). I noticed that kernels at least in the 4.xx range have different driver structure, so it will not work.

Attached is the file which should replace max310x.c, which exists under drivers>tty>serial> (please make a copy of your old file since this one does not provide SPI). Of course a better solution would be to modify the Kconfig files and to improve the code such that SPI and I2C versions coexist in the same file... probably not worth the hassle for this version.

This is a device tree snippet for Kernel 3.14 (the configuration I have tested).


i2c0: i2c@f8010000 {
                status = "okay";
                                                                    
                max14830: max14830@6c {
                    compatible = "maxim,max14830";
                    reg = <0x6C>; // Just address of UART0, others will be inferred        
                    maxim,clock-type = "xtal";
                    maxim,clock-frequency = <3686400>;
                       interrupts-extended = <&pioA 4 2>; //IRQ_TYPE_EDGE_FALLING
                       status = "okay";
                       maxim,minorstart = <209>; //209 name will be ttyMAX0
                   };
                   
                   max14830_1: max14830@61 {
                    compatible = "maxim,max14830";
                    reg = <0x61>; // Just address of UART0, others will be inferred        
                    maxim,clock-type = "xtal";
                    maxim,clock-frequency = <3686400>;
                       interrupts-extended = <&pioC 0 2>; //IRQ_TYPE_EDGE_FALLING
                       status = "okay";
                       maxim,minorstart = <215>; //any other ttyMAX1
                   };
            };