Welcome, Guest

Author Topic: Support i2c micro using 3.x kernel  (Read 26955 times)

tcmichals

  • Newbie
  • *
  • Posts: 33
  • Karma: +0/-0
Re: Support i2c micro using 3.x kernel
« Reply #30 on: October 04, 2012, 06:55:12 PM »
Oh, OK see why USB does not work, must have:
 .compatible = "fsl,imx27-usb"
defined in the device tree or the chipidea driver is not loaded.  Will fix that tonight..

Fadil Berisha

  • Full Member
  • ***
  • Posts: 124
  • Karma: +7/-0
Re: Support i2c micro using 3.x kernel
« Reply #31 on: October 04, 2012, 07:41:29 PM »
... But should the pins be:
i2c0_pins_a: i2c0@0 {
               reg = <0>;
               fsl,pinmux-ids = <
                  0x1171 /* MX23_PAD_LCD_ENABLE__I2C_SCL */
                  0x1181 /* MX23_PAD_LCD_HSYNC__I2C_SDA  */
               >;
               fsl,drive-strength = <1>;
               fsl,voltage = <1>;
               fsl,pull-up = <1>;
            };
Yes, pins are correct, please refer to attached schematic:
https://docs.google.com/open?id=0B5yGbFXTEhQpaTRWaE1zWU0ycVU (Mozilla: right click, View Image --> Zoom).
As you can see, pins are present on GPIO Connector, but you wish, you can switch I2C pins on UEXT connector.
Please note also that device tree pin nomenclature is in format:
<PIN_NAME__PIN_FUNCTION>.
Example: PIN_NAME -> LCD_ENABLE with function I2C_SCL became LCD_ENABLE__I2C_SCL.

Regards
Fadil Berisha

tcmichals

  • Newbie
  • *
  • Posts: 33
  • Karma: +0/-0
Re: Support i2c micro using 3.x kernel
« Reply #32 on: October 04, 2012, 08:47:06 PM »
Yes, I did that last night, still not working... Guess will reload an older kernel to validate everything is working..

tcmichals

  • Newbie
  • *
  • Posts: 33
  • Karma: +0/-0
Re: Support i2c micro using 3.x kernel
« Reply #33 on: October 06, 2012, 07:15:41 AM »
loaded OE, Linux imx233-olinuxino-micro 2.6.35.3-10.12.01+yocto+g0ea8cb9 #1 PREEMPT Fri Oct 5 21:07:30 CDT 2012 armv5tejl GNU/Linux.  Did not move any wiring and it all worked fine.  So, guess little lost on what is wrong.

Niii

  • Newbie
  • *
  • Posts: 40
  • Karma: +1/-0
Re: Support i2c micro using 3.x kernel
« Reply #34 on: October 07, 2012, 01:18:58 AM »
Just another test with debug output (on r3.2):
Code: [Select]
root@micro:~# dmesg | grep i2c
[    0.120000] i2c-core: driver [dummy] registered
[    0.430000] i2c i2c-0: adapter [MXS I2C adapter] registered
[    0.440000] i2c 0-000a: uevent
[    0.440000] i2c i2c-0: client [sgtl5000] registered with bus id 0-000a
[    0.440000] i2c 0-0051: uevent
[    0.440000] i2c i2c-0: client [24c32] registered with bus id 0-0051
[    1.030000] i2c /dev entries driver
[    1.030000] i2c-dev: adapter [MXS I2C adapter] registered as minor 0
[    1.120000] i2c-core: driver [sgtl5000] registered
[    4.200000] i2c 0-0051: uevent
[    5.020000] i2c 0-0051: uevent
[    5.560000] i2c 0-0051: uevent
root@micro:~# i2cdetect -l
i2c-0 i2c        MXS I2C adapter                  I2C adapter
root@micro:~# i2cdetect 0
Error: Can't use SMBus Quick Write command on this bus (ISA bus?)
root@micro:~# i2cdetect -r 0
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-0 using read byte commands.
I will probe address range 0x03-0x77.
Continue? [Y/n]
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- UU -- ^C
root@micro:~# dmesg | grep i2c
[    0.120000] i2c-core: driver [dummy] registered
[    0.430000] i2c i2c-0: adapter [MXS I2C adapter] registered
[    0.440000] i2c 0-000a: uevent
[    0.440000] i2c i2c-0: client [sgtl5000] registered with bus id 0-000a
[    0.440000] i2c 0-0051: uevent
[    0.440000] i2c i2c-0: client [24c32] registered with bus id 0-0051
[    1.030000] i2c /dev entries driver
[    1.030000] i2c-dev: adapter [MXS I2C adapter] registered as minor 0
[    1.120000] i2c-core: driver [sgtl5000] registered
[    4.200000] i2c 0-0051: uevent
[    5.020000] i2c 0-0051: uevent
[    5.560000] i2c 0-0051: uevent
[  172.280000] i2c i2c-0: ioctl, cmd=0x705, arg=0xbeae8bf0
[  174.600000] i2c i2c-0: ioctl, cmd=0x705, arg=0xbe8ecc98
[  178.520000] i2c i2c-0: ioctl, cmd=0x705, arg=0xbecabc98
[  179.770000] i2c i2c-0: ioctl, cmd=0x703, arg=0x03
[  179.770000] i2c i2c-0: ioctl, cmd=0x720, arg=0xbecabc8c
[  179.770000] i2c i2c-0: master_xfer[0] R, addr=0x03, len=1
[  179.770000] mxs-i2c 80058000.i2c: addr: 0x0003, len: 1, flags: 0x1, stop: 1
[  180.770000] mxs-i2c 80058000.i2c: Timeout!
[  180.770000] i2c i2c-0: ioctl, cmd=0x703, arg=0x04
[  180.770000] i2c i2c-0: ioctl, cmd=0x720, arg=0xbecabc8c
[  180.770000] i2c i2c-0: master_xfer[0] R, addr=0x04, len=1
[  180.770000] mxs-i2c 80058000.i2c: addr: 0x0004, len: 1, flags: 0x1, stop: 1
[  181.770000] mxs-i2c 80058000.i2c: Timeout!
[  181.770000] i2c i2c-0: ioctl, cmd=0x703, arg=0x05
[  181.770000] i2c i2c-0: ioctl, cmd=0x720, arg=0xbecabc8c
[  181.770000] i2c i2c-0: master_xfer[0] R, addr=0x05, len=1
[  181.770000] mxs-i2c 80058000.i2c: addr: 0x0005, len: 1, flags: 0x1, stop: 1
[  182.770000] mxs-i2c 80058000.i2c: Timeout!
[  182.770000] i2c i2c-0: ioctl, cmd=0x703, arg=0x06
[  182.770000] i2c i2c-0: ioctl, cmd=0x720, arg=0xbecabc8c
[  182.770000] i2c i2c-0: master_xfer[0] R, addr=0x06, len=1
[  182.770000] mxs-i2c 80058000.i2c: addr: 0x0006, len: 1, flags: 0x1, stop: 1
[  183.770000] mxs-i2c 80058000.i2c: Timeout!
[  183.770000] i2c i2c-0: ioctl, cmd=0x703, arg=0x07
[  183.770000] i2c i2c-0: ioctl, cmd=0x720, arg=0xbecabc8c
[  183.770000] i2c i2c-0: master_xfer[0] R, addr=0x07, len=1
[  183.770000] mxs-i2c 80058000.i2c: addr: 0x0007, len: 1, flags: 0x1, stop: 1
[  184.770000] mxs-i2c 80058000.i2c: Timeout!
[  184.770000] i2c i2c-0: ioctl, cmd=0x703, arg=0x08
[  184.770000] i2c i2c-0: ioctl, cmd=0x720, arg=0xbecabc8c
[  184.770000] i2c i2c-0: master_xfer[0] R, addr=0x08, len=1
[  184.770000] mxs-i2c 80058000.i2c: addr: 0x0008, len: 1, flags: 0x1, stop: 1
[  185.770000] mxs-i2c 80058000.i2c: Timeout!
[  185.770000] i2c i2c-0: ioctl, cmd=0x703, arg=0x09
[  185.770000] i2c i2c-0: ioctl, cmd=0x720, arg=0xbecabc8c
[  185.770000] i2c i2c-0: master_xfer[0] R, addr=0x09, len=1
[  185.770000] mxs-i2c 80058000.i2c: addr: 0x0009, len: 1, flags: 0x1, stop: 1
[  186.770000] mxs-i2c 80058000.i2c: Timeout!
[  186.770000] i2c i2c-0: ioctl, cmd=0x703, arg=0x0a
[  186.770000] i2c i2c-0: ioctl, cmd=0x703, arg=0x0b
[  186.770000] i2c i2c-0: ioctl, cmd=0x720, arg=0xbecabc8c
[  186.770000] i2c i2c-0: master_xfer[0] R, addr=0x0b, len=1
[  186.770000] mxs-i2c 80058000.i2c: addr: 0x000b, len: 1, flags: 0x1, stop: 1
[  187.770000] mxs-i2c 80058000.i2c: Timeout!
[  187.770000] i2c i2c-0: ioctl, cmd=0x703, arg=0x0c
[  187.770000] i2c i2c-0: ioctl, cmd=0x720, arg=0xbecabc8c
[  187.770000] i2c i2c-0: master_xfer[0] R, addr=0x0c, len=1
[  187.770000] mxs-i2c 80058000.i2c: addr: 0x000c, len: 1, flags: 0x1, stop: 1
[  188.770000] mxs-i2c 80058000.i2c: Timeout!

tcmichals

  • Newbie
  • *
  • Posts: 33
  • Karma: +0/-0
Re: Support i2c micro using 3.x kernel
« Reply #35 on: October 07, 2012, 03:16:17 AM »
Oh, found an issue with the device tree, the interrupts are backwards..

                      i2c@80058000 {
+                       i2c0: i2c@80058000 {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               compatible = "fsl,imx23-i2c";
                                reg = <0x80058000 0x2000>;
+                               interrupts = <26 27>;  <-----  needs to be 27, 26  Error first, DMA second.. this is with 3.6 I have no idea about linux-next with DMA... the ERROR int 27 and DMA is 26...
+                               clock-frequency = <100000>;
                                status = "disabled";
                        };
 
Oh course that did not do anything, I'm tracing multiple issues..
1) USB, think it is a voltage/phy..
2) I2c, I was using linux-mainline.. and that is where I found the issue with the ISR... so.. moving to 3.6, because there are fixes about the data rate..

tcmichals

  • Newbie
  • *
  • Posts: 33
  • Karma: +0/-0
Re: Support i2c micro using 3.x kernel
« Reply #36 on: October 07, 2012, 04:40:25 AM »
OK found out the issue with usb on 3.6:
http://lists.infradead.org/pipermail/linux-arm-kernel/2012-June/105247.html
Need this patch... but now it will not enumerate.. does this over and over..
There must be another patch somewhere because the linux-mainline has this fixed.. so.. hope some one can point that out..

tcmichals

  • Newbie
  • *
  • Posts: 33
  • Karma: +0/-0
Re: Support i2c micro using 3.x kernel
« Reply #37 on: October 07, 2012, 07:12:30 AM »
Where is the latest driver i2c-mxs.c with DMA support?  the old 2.6.35 driver, I cannot find where the ABPX timings are set.  I see clocks.. but I think these are to slow.. need to figure out if this is the issue..

earny

  • Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
Re: Support i2c micro using 3.x kernel
« Reply #38 on: October 07, 2012, 12:27:50 PM »
[V4] MXS: Implement DMA support into mxs-i2c

https://patchwork.kernel.org/patch/1369781/

"On a mx28evk: Tested-by: Fabio Estevam <fabio.estevam@freescale.com>"
:-)

Niii

  • Newbie
  • *
  • Posts: 40
  • Karma: +1/-0
Re: Support i2c micro using 3.x kernel
« Reply #39 on: October 07, 2012, 01:08:57 PM »
Same result with DMA patch and interrupts backwards on 3.6-rc2.

tcmichals

  • Newbie
  • *
  • Posts: 33
  • Karma: +0/-0
Re: Support i2c micro using 3.x kernel
« Reply #40 on: October 08, 2012, 04:11:20 AM »
OK.. I move the I2C to the default pins, 127/128 and nothing... So to me it has to be the APBX clock.. A lot of the code is different so.. maybe that is it..

tcmichals

  • Newbie
  • *
  • Posts: 33
  • Karma: +0/-0
Re: Support i2c micro using 3.x kernel
« Reply #41 on: October 08, 2012, 05:15:37 PM »
The imx233 support is being added and should be complete in 3.7-rc1, in a couple of weeks. So, I'm going to wait until then or when i2c-mxs.c changes in the linux-next tree.

Here is a thread on google groups.
https://groups.google.com/forum/#!topic/meta-fsl-arm/rxoukULHqZQ

tcmichals

  • Newbie
  • *
  • Posts: 33
  • Karma: +0/-0
Re: Support i2c micro using 3.x kernel
« Reply #42 on: October 13, 2012, 05:53:42 AM »
Well Linux version 3.6.0-next-20121012 is a lot better then the 3.2, reboots, USB works out of the box. Can unplug/replug etc.  SPI driver, but i2c is still having issues:
-- [  100.630000] mxs-i2c 80058000.i2c: Failed to get PIO reg. write descriptor.

But, posted email back to the kernel people see what I did wrong...

tcmichals

  • Newbie
  • *
  • Posts: 33
  • Karma: +0/-0
Re: Support i2c micro using 3.x kernel
« Reply #43 on: November 05, 2012, 05:20:38 PM »
Finally my message got posted to the linux-arm group on why the following message appears using i2c...
Testing i2c in 3.6.0-next-20121012 for i.mx233
Even with the 3.7-rc2 I get the same message...

Using the 3.6.0-next-20121012  to test i2c DMA support on a imx233-Olinuxino-micro board.  When using the i2cdetect -r 0 to scan a devices on the i2c bus,  the following message is displayed on the console:

-- [  129.130000] mxs-i2c 80058000.i2c: Failed to get PIO reg. write descriptor.

imx23.dtsi support for i2c:
i2c0_pins_a: i2c0@0 {
reg = <0>;
fsl,pinmux-ids = <
0x1171 /* MX23_PAD_LCD_ENABLE__LCD_ENABLE */
0x1181 /* MX23_PAD_LCD_HSYNC__LCD_HSYNC */
>;
fsl,drive-strength = <1>;
fsl,voltage = <1>;
fsl,pull-up = <1>;
};
...
i2c@80058000 {
#address-cells = <1>;
                               #size-cells = <0>;
compatible = "fsl,imx28-i2c";
reg = <0x80058000 0x2000>;
interrupts = <27 26>;
clock-frequency = <400000>;
fsl,i2c-dma-channel = <3>;
status = "disabled";
};
imx23-olinuxino.dts
i2c0: i2c@80058000 {
     pinctrl-names = "default";
                               pinctrl-0 = <&i2c0_pins_a>;
                               status = "okay";
                       };

Niii

  • Newbie
  • *
  • Posts: 40
  • Karma: +1/-0
Re: Support i2c micro using 3.x kernel
« Reply #44 on: December 18, 2012, 08:06:14 PM »
Hi,

There are news about i2c on kernel 3.x on micro board ?
It's still not working ?