Implement SC18IM700 i2c controller function on platform MSM8996 (kernel 3.18.20) ?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Implement SC18IM700 i2c controller function on platform MSM8996 (kernel 3.18.20) ?

2,048 Views
yuhang_zhang
Contributor I

pastedImage_1.png

Hi everyone:

I'm using the sc18im700 (uart to i2c master) function on the platform msm8996. Now i have some questions during the  implement process.

Q1:  I found an i2c algorith  support for nxp sc18im700(https://lkml.org/lkml/2014/6/9/571).  So i need an  i2c controller code, Did someone have some experience about using the sc18im700 chip on Linux kernel?

Q2:  when i modify the device tree files on kernel , the sc18im700 should be described as an i2c controller or an uart device? then  how to deal with the parameter( i2c address irq clock and so on )?

 eg: 

  i2c_uart12: uart-nxp-i2c@75b4000 {
  compatible = "nxp,uart-nxp-i2c";
  #address-cells = <1>;
  #size-cells = <0>;
  reg-names = "qup_phys_addr";
  reg = <0x75b4000 0x1000>;
  interrupt-names = "qup_irq";
  interrupts = <0 118 0>;
 
  clock-names = "iface_clk", "core_clk";
  clocks = <&clock_gcc clk_gcc_blsp2_ahb_clk>,
    <&clock_gcc clk_gcc_blsp2_qup6_i2c_apps_clk>;
  pinctrl-names = "i2c_uart12_active", "i2c_uart12_sleep";
  pinctrl-0 = <&i2c_uart12_active>;
  pinctrl-1 = <&i2c_uart12_sleep>;
 };

0 Kudos
Reply
2 Replies

1,660 Views
diegoadrian
NXP Employee
NXP Employee

Hello Kenio Zhang,

For your first question, you may find more helpful the following code, than the other one.  

http://lxr.free-electrons.com/source/drivers/i2c/algos/i2c-algo-bit.c#L57

For your second question, the sc18im700 needs to be described as a UART device. Because, the sc18im700 serves as an interface between the standard UART port and the serial I2C port.

I hope this information could be helpful for you.

Best regards,

Diego.

0 Kudos
Reply

1,660 Views
yuhang_zhang
Contributor I

Hello Diego,

  Thanks for you usefull advice, but i feel confused about the main chip communicate with the sc18im700.  

  I thought two methods to do it .

        Fristly,   uart driver + i2c controller driver + i2c algorithm

             set_data(){

              Ttyfd =   open(TtyName, O_RDWR | O_NDELAY, 0);

             write(Ttyfd,"****", length);

              close(Ttyfd);

              }

             get_data(){

               Ttyfd =   open(TtyName, O_RDWR | O_NDELAY, 0);

               read(Ttyfd, buffer, length);

               close(Ttyfd);

              }

    Secondly, serio driver + i2c controller driver + i2c algorithm ,  i haven't found the usefull serio information.

    So which method should i choose ?

Best regards

Kenio

0 Kudos
Reply