Groups
Groups

I2C linux-mainline iMX233-OLinuXino-MICRO

645 views
Skip to first unread message

Tim Michals

unread,
Oct 7, 2012, 9:49:03 PM10/7/12
to meta-f...@googlegroups.com
I'm trying to get this to work, I've updated changed the imx23.dtsi, imx23-olinuxino.dts several different ways, but nothing works.  I load 2.6.35, and it works fine.  I think it has something to do with the clock, I see the I2C_CLK change but it does not look right...  
Here is what I've tried
1. Validate wiring via 2.6.35 OE build, works fine.
2. Update the device tree files moving it around to several places but nothing.. :
      i2c0_pins_a: i2c0@0 {
              reg = <0>;
                     fsl,pinmux-ids = <
0x01e0 /* MX23_PAD_I2C_SCL__AUART1_TX */
0x01f0 /* MX23_PAD_I2C_SDA__AUART1_RX */
/* also tried */
/* 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>;
                               };
                       i2c0: i2c@80058000 {
                               #address-cells = <1>;
                               #size-cells = <0>;
                               compatible = "fsl,imx28-i2c";
                                reg = <0x80058000 0x2000>;
                               interrupts = <27 26>;
                               clock-frequency = <400000>;
                                status = "disabled";
                        };
imx32-olinuxino.dts
                      i2c0: i2c@80058000 {
                               pinctrl-names = "default";
                               pinctrl-0 = <&i2c0_pins_a>;
                               status = "okay";


                       };
3: changed the driver to validate the IO and Interrupt... via printk
[   0.430000] ..I2C IO  80058000 size 8192                                                                          
[    0.430000] ..I2C irq 27  

4. The device is present
Welcome to Buildroot                                                                                                 
micro login: root                                                                                                    
# i2cdetect -l                                                                                                       
i2c-0   i2c             MXS I2C adapter                         I2C adapter    
imx23.dtsi
imx23-olinuxino.dts

Fabio Estevam

unread,
Oct 7, 2012, 10:13:00 PM10/7/12
to meta-f...@googlegroups.com, Marek Vašut
Hi Tim,

On Sun, Oct 7, 2012 at 10:49 PM, Tim Michals <tcmi...@gmail.com> wrote:
> I'm trying to get this to work, I've updated changed the imx23.dtsi,
> imx23-olinuxino.dts several different ways, but nothing works. I load

I2C support has not been added to mx23 yet. It would be really nice to
add it though.

> 2.6.35, and it works fine. I think it has something to do with the clock, I
> see the I2C_CLK change but it does not look right...
> Here is what I've tried
> 1. Validate wiring via 2.6.35 OE build, works fine.
> 2. Update the device tree files moving it around to several places but
> nothing.. :
> i2c0_pins_a: i2c0@0 {
> reg = <0>;
> fsl,pinmux-ids = <
> 0x01e0 /* MX23_PAD_I2C_SCL__AUART1_TX */
> 0x01f0 /* MX23_PAD_I2C_SDA__AUART1_RX */
> /* also tried */
> /* 0x1171*/ /* MX23_PAD_LCD_ENABLE__LCD_ENABLE */
> /* 0x1181*/ /* MX23_PAD_LCD_HSYNC__LCD_HSYNC */

Which pads are you using to test I2C?

> >;
> fsl,drive-strength = <1>;
> fsl,voltage = <1>;
> fsl,pull-up = <1>;
> };
> i2c0: i2c@80058000 {
> #address-cells = <1>;
> #size-cells = <0>;
> compatible = "fsl,imx28-i2c";
> reg = <0x80058000 0x2000>;
> interrupts = <27 26>;
> clock-frequency = <400000>;
> status = "disabled";
> };
> imx32-olinuxino.dts
> i2c0: i2c@80058000 {
> pinctrl-names = "default";
> pinctrl-0 = <&i2c0_pins_a>;
> status = "okay";

You also need to put some I2C device. See how I added I2C EEPROM to
imx28-evk.dtb.

You also need to select the I2C device driver in .config. For example,
I2C EEPROM driver.

Also, for mx23 i2c to work you would need DMA:
https://patchwork.kernel.org/patch/1369781/

This has not been applied yet.

Also, if you continue to face issues, please start a thread in
linux-arm-kernel and linux-i2c mailing lists.

Regards,

Fabio Estevam

Tim Michals

unread,
Oct 7, 2012, 10:50:41 PM10/7/12
to meta-f...@googlegroups.com, Marek Vašut
Fabio,
 

I2C support has not been added to mx23 yet. It would be really nice to
add it though.

Yes, this is my goal... (Also doing USB, found some patches not applied on the kernel.org 3.6 another email) 
I'm using buildroot, to get all of the packages etc.  

Which pads are you using to test I2C?
I tried both pads, the default PIN 127/128 on the chip and PIN11/PIN15 on the chip. On the micro, it is PIN23, PIN24 on CON1.  Plus logic analyzer.. 
Also tried the default pins, AUART TX/RX and that did not work either

So, I went and recompiled OE/2.6.35 to validate my wiring etc.. and it worked fine. 

You also need to put some I2C device. See how I added I2C EEPROM to
imx28-evk.dtb.

Why do you need to add a device?  I'm just trying to do a bus scan via i2cdetect to find a sensor.  It works fine with 2.6.35. 
 
You also need to select the I2C device driver in .config. For example,
I2C EEPROM driver.

Yes, the device driver is loaded, I can access the driver via i2cdetect, but it does not produce a valid output.  
 
Also, for mx23 i2c to work you would need DMA:
https://patchwork.kernel.org/patch/1369781/

This has not been applied yet.

No, I don't have this patch applied, some on else tried but it did not work.  I will give this a try since this is required.
 
Also, if you continue to face issues, please start a thread in
linux-arm-kernel and linux-i2c mailing lists.

I tried to chase this issue, I thought it was already working on a imx288?  

Eric Bénard

unread,
Oct 8, 2012, 1:59:54 AM10/8/12
to meta-f...@googlegroups.com
Hi Tim,

Le Sun, 7 Oct 2012 19:50:41 -0700 (PDT),
Tim Michals <tcmi...@gmail.com> a écrit :
> I2C support has not been added to mx23 yet. It would be really nice to
> > add it though.
> >
> > Yes, this is my goal... (Also doing USB, found some patches not applied on
> the kernel.org 3.6 another email)
> I'm using buildroot, to get all of the packages etc.
>
so you are on the wrong list to get support as this list is about :
"OpenEmbedded/Yocto Freescale ARM BSP"

and you question is about a kernel problem and thus should be sent to :
linux-arm-kernel mailing list
linux-ar...@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
where you will have more chance to get in touch with kernel
developers.

Best regards,
Eric

Tim Michals

unread,
Oct 8, 2012, 9:46:06 AM10/8/12
to meta-f...@googlegroups.com
Agreed, one of the reasons I posted here is to get patches local to the linux-main line first and OE recipes, then back to the kernel. 

Fabio Estevam

unread,
Oct 8, 2012, 9:50:13 AM10/8/12
to meta-f...@googlegroups.com, Marek Vašut
Tim,

On Sun, Oct 7, 2012 at 11:50 PM, Tim Michals <tcmi...@gmail.com> wrote:
> Fabio,
>
>
>> I2C support has not been added to mx23 yet. It would be really nice to
>> add it though.
>>
> Yes, this is my goal... (Also doing USB, found some patches not applied on
> the kernel.org 3.6 another email)

USB on mx23-olinuxino will work out of the box on 3.7-rc1 that will be
released in the upcoming weeks.


> Why do you need to add a device? I'm just trying to do a bus scan via
> i2cdetect to find a sensor. It works fine with 2.6.35.

Ok, understood. If you need to actually control the sensor, then you
would need its driver.

> I tried to chase this issue, I thought it was already working on a imx288?

I2C does work on imx28, but not on mx23 yet.

Regards,

Fabio Estevam

Tim Michals

unread,
Oct 8, 2012, 9:56:45 AM10/8/12
to meta-f...@googlegroups.com, Marek Vašut
Fabio,


USB on mx23-olinuxino will work out of the box on 3.7-rc1 that will be
released in the upcoming weeks.

Is this the linux-next branch? I was working on that, but the dts tree was wrong, the clk's were not setup for USB. 

Fabio Estevam

unread,
Oct 8, 2012, 10:03:51 AM10/8/12
to meta-f...@googlegroups.com, Marek Vašut
In linux-next there is the following commit:

commit d6475317b569d531730c07bbc27b29257c348fd0
Author: Fabio Estevam <fabio....@freescale.com>
Date: Thu Sep 13 14:33:38 2012 -0300

ARM: dts: mx23: Add USB resources

Add USB resources for mx23.

Signed-off-by: Fabio Estevam <fabio....@freescale.com>
Signed-off-by: Shawn Guo <shaw...@linaro.org>

,which does provide the USB controller and USB PHY clocks for mx23.

Regards,

Fabio Estevam

Tim Michals

unread,
Oct 8, 2012, 10:34:50 AM10/8/12
to meta-f...@googlegroups.com, Marek Vašut
Fabio,

Fabio,

OK, wait until 3.7-rc1.  Thank you for your help...

Tim

Tim Michals

unread,
Oct 12, 2012, 11:25:17 PM10/12/12
to meta-f...@googlegroups.com, Marek Vašut
Posted (trying something about my email address it is awaiting approval)
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
                       };

Fabio Estevam

unread,
Oct 12, 2012, 11:28:20 PM10/12/12
to meta-f...@googlegroups.com, Marek Vašut
Tim,

On Sat, Oct 13, 2012 at 12:25 AM, Tim Michals <tcmi...@gmail.com> wrote:

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

We should not use PIO for mx23. Have you applied Marek's mxs i2c dma
patch I pointed earlier?

Regards,

Fabio Estevam

Tim Michals

unread,
Oct 12, 2012, 11:43:14 PM10/12/12
to meta-f...@googlegroups.com, Marek Vašut
The driver is the new DMA implementation.

Tim Michals

unread,
Oct 12, 2012, 11:45:25 PM10/12/12
to meta-f...@googlegroups.com, Marek Vašut

static int mxs_i2c_dma_setup_xfer(struct i2c_adapter *adap,
struct i2c_msg *msg, uint32_t flags)
{
struct dma_async_tx_descriptor *desc;
struct mxs_i2c_dev *i2c = i2c_get_adapdata(adap);

if (msg->flags & I2C_M_RD) {
i2c->dma_read = 1;
i2c->addr_data = (msg->addr << 1) | I2C_SMBUS_READ;

/*
* SELECT command.
*/

/* Queue the PIO register write transfer. */
i2c->pio_data[0] = MXS_CMD_I2C_SELECT;
desc = dmaengine_prep_slave_sg(i2c->dmach,
(struct scatterlist *)&i2c->pio_data[0],
1, DMA_TRANS_NONE, 0);
if (!desc) {
dev_err(i2c->dev,
"Failed to get PIO reg. write descriptor.\n"); <--- the error.. 
goto select_init_pio_fail;
}

Tim Michals

unread,
Nov 5, 2012, 10:23:39 AM11/5/12
to meta-f...@googlegroups.com, Marek Vašut

Finally, got my message posted to the linux-arm email list... fyi, it is still occurring with 3.7-rc2..
Reply all
Reply to author
Forward
0 new messages
Search
Clear search
Close search
Google apps
Main menu