linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] add hardware I2C support for ARM IMX23
@ 2012-11-28 14:24 sander van ginkel
  2012-11-28 15:08 ` Wolfram Sang
  0 siblings, 1 reply; 11+ messages in thread
From: sander van ginkel @ 2012-11-28 14:24 UTC (permalink / raw)
  To: linux-arm-kernel

The I2C hardware in the IMX233 is currently not supported,
however the i2c-mxs driver seems to be suitable.
To use the i2c-mxs driver it has to be added to the devicetree
for the IMX23.


Signed-off-by: Sander van Ginkel <sander@van-ginkel.eu>
---
diff -Naur linux-3.7-rc6/arch/arm/boot/dts/imx23-olinuxino.dts  
linux-3.7-rc6-i2c/arch/arm/boot/dts/imx23-olinuxino.dts
--- linux-3.7-rc6/arch/arm/boot/dts/imx23-olinuxino.dts	2012-11-17  
01:42:40.000000000 +0000
+++ linux-3.7-rc6-i2c/arch/arm/boot/dts/imx23-olinuxino.dts	2012-11-24  
22:40:51.000000000 +0000
@@ -50,6 +50,13 @@
		};

		apbx at 80040000 {
+
+			i2c0: i2c at 80058000 {
+				pinctrl-names = "default";
+				pinctrl-0 = <&i2c0_pins_a>;
+				status = "okay";
+			};
+
			duart: serial at 80070000 {
				pinctrl-names = "default";
				pinctrl-0 = <&duart_pins_a>;
diff -Naur linux-3.7-rc6/arch/arm/boot/dts/imx23.dtsi  
linux-3.7-rc6-i2c/arch/arm/boot/dts/imx23.dtsi
--- linux-3.7-rc6/arch/arm/boot/dts/imx23.dtsi	2012-11-17  
01:42:40.000000000 +0000
+++ linux-3.7-rc6-i2c/arch/arm/boot/dts/imx23.dtsi	2012-11-24  
22:40:51.000000000 +0000
@@ -144,6 +144,17 @@
					fsl,pull-up = <0>;
				};

+				i2c0_pins_a: i2c0 at 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>;
+				};
+
				auart0_2pins_a: auart0-2pins at 0 {
					reg = <0>;
					fsl,pinmux-ids = <
@@ -387,9 +398,15 @@
				status = "disabled";
			};

-			i2c at 80058000 {
+			i2c0: i2c@80058000 {
+				#address-cells = <2>;
+				#size-cells = <1>;
+				compatible = "fsl,imx28-i2c";
				reg = <0x80058000 0x2000>;
+				interrupts = <26 27>;
+				clock-frequency = <100000>;
				status = "disabled";
+				fsl,i2c-dma-channel = <3>;
			};

			rtc at 8005c000 {

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH] add hardware I2C support for ARM IMX23
  2012-11-28 14:24 [PATCH] add hardware I2C support for ARM IMX23 sander van ginkel
@ 2012-11-28 15:08 ` Wolfram Sang
  2012-11-28 16:10   ` sander van ginkel
  0 siblings, 1 reply; 11+ messages in thread
From: Wolfram Sang @ 2012-11-28 15:08 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Nov 28, 2012 at 03:24:03PM +0100, sander van ginkel wrote:
> The I2C hardware in the IMX233 is currently not supported,
> however the i2c-mxs driver seems to be suitable.
> To use the i2c-mxs driver it has to be added to the devicetree
> for the IMX23.

Have you tested it? There have been problems reported when using
i2cdetect...

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20121128/e64fb55d/attachment.sig>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH] add hardware I2C support for ARM IMX23
  2012-11-28 15:08 ` Wolfram Sang
@ 2012-11-28 16:10   ` sander van ginkel
  2012-11-28 16:24     ` Wolfram Sang
  0 siblings, 1 reply; 11+ messages in thread
From: sander van ginkel @ 2012-11-28 16:10 UTC (permalink / raw)
  To: linux-arm-kernel

Citeren "Wolfram Sang" <w.sang@pengutronix.de>:

> Have you tested it? There have been problems reported when using
> i2cdetect...
>
> --
> Pengutronix e.K.                           | Wolfram Sang
      |
> Industrial Linux Solutions                 |
http://www.pengutronix.de/  |
>

I've tested it with multiple configs.
i2cdetect -l gives me:
i2c-0   i2c             MXS I2C adapter                         I2C adapter

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH] add hardware I2C support for ARM IMX23
  2012-11-28 16:10   ` sander van ginkel
@ 2012-11-28 16:24     ` Wolfram Sang
  2012-11-28 16:44       ` Sander van Ginkel
  0 siblings, 1 reply; 11+ messages in thread
From: Wolfram Sang @ 2012-11-28 16:24 UTC (permalink / raw)
  To: linux-arm-kernel


> I've tested it with multiple configs.

Please specify a bit more what you tested and what configs mean. It is
especially important to talk to slaves since this is where DMA problems
occured.

> i2cdetect -l gives me:
> i2c-0   i2c             MXS I2C adapter                         I2C adapter

'i2cdetect -r ...' would be more interesting to see communication with
slaves happening :) Also, what kernel did you test?

Thanks,

   Wolfram

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20121128/dfe84d0f/attachment.sig>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH] add hardware I2C support for ARM IMX23
  2012-11-28 16:24     ` Wolfram Sang
@ 2012-11-28 16:44       ` Sander van Ginkel
  2012-11-28 17:09         ` Wolfram Sang
  2012-11-28 18:33         ` Tim Michals
  0 siblings, 2 replies; 11+ messages in thread
From: Sander van Ginkel @ 2012-11-28 16:44 UTC (permalink / raw)
  To: linux-arm-kernel

tested with:
CONFIG_I2C_MXS=m
CONFIG_I2C_MXS=y

in combination with CONFIG_GPIO_MXS enabled and disabled

used kernels: 3.6 and 3.7.0-rc6

My I2C slave is a PCF8575 i/o expander with some LEDs at the output.
These are controlled through sysfs.

Just tested with "i2cdetc -y -r 0" that crashes with  "BUG: soft lockup 
- CPU#0 stuck for 22s!"
according to the docs (IMX23RM.pdf) the interrupts for I2C are 26 and 27 
that why I assigned these two in the dts.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH] add hardware I2C support for ARM IMX23
  2012-11-28 16:44       ` Sander van Ginkel
@ 2012-11-28 17:09         ` Wolfram Sang
  2012-11-28 17:34           ` sander van ginkel
  2012-11-30 16:32           ` sander van ginkel
  2012-11-28 18:33         ` Tim Michals
  1 sibling, 2 replies; 11+ messages in thread
From: Wolfram Sang @ 2012-11-28 17:09 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

(adding the i2c list)

On Wed, Nov 28, 2012 at 05:44:49PM +0100, Sander van Ginkel wrote:
> tested with:
> CONFIG_I2C_MXS=m
> CONFIG_I2C_MXS=y
> 
> in combination with CONFIG_GPIO_MXS enabled and disabled
> 
> used kernels: 3.6 and 3.7.0-rc6
> 
> My I2C slave is a PCF8575 i/o expander with some LEDs at the output.
> These are controlled through sysfs.

Thanks, this is useful info.

> Just tested with "i2cdetc -y -r 0" that crashes with  "BUG: soft
> lockup - CPU#0 stuck for 22s!"
> according to the docs (IMX23RM.pdf) the interrupts for I2C are 26
> and 27 that why I assigned these two in the dts.

You might want to try my for-next branch or wait for 3.8-rc1, maybe the
DMA termination patch helps? Also enabling I2C debug messages is
probably worth it.

Regards,

   Wolfram

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20121128/8e813c29/attachment.sig>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH] add hardware I2C support for ARM IMX23
  2012-11-28 17:09         ` Wolfram Sang
@ 2012-11-28 17:34           ` sander van ginkel
  2012-11-30 16:32           ` sander van ginkel
  1 sibling, 0 replies; 11+ messages in thread
From: sander van ginkel @ 2012-11-28 17:34 UTC (permalink / raw)
  To: linux-arm-kernel

Citeren "Wolfram Sang" <w.sang@pengutronix.de>:

>
> You might want to try my for-next branch or wait for 3.8-rc1, maybe
the
> DMA termination patch helps? Also enabling I2C debug messages is
> probably worth it.
>
> Regards,
>
>    Wolfram
>
> --
> Pengutronix e.K.                           | Wolfram Sang
      |
> Industrial Linux Solutions                 |
http://www.pengutronix.de/  |
>

Ok I will dig into this, your for-next branch contains the DMA  
termination patch, I presume?

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH] add hardware I2C support for ARM IMX23
  2012-11-28 16:44       ` Sander van Ginkel
  2012-11-28 17:09         ` Wolfram Sang
@ 2012-11-28 18:33         ` Tim Michals
  2012-11-28 18:58           ` sander van ginkel
  1 sibling, 1 reply; 11+ messages in thread
From: Tim Michals @ 2012-11-28 18:33 UTC (permalink / raw)
  To: linux-arm-kernel

Sander,

Just tested with "i2cdetc -y -r 0" that crashes with  "BUG: soft lockup -
> CPU#0 stuck for 22s!"
> according to the docs (IMX23RM.pdf) the interrupts for I2C are 26 and 27
> that why I assigned these two in the dts.
>

In your dts, is it 26, 27? Order matters, it should be 27, 26.  Error ISR,
DMA.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20121128/0233d8ab/attachment-0001.html>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH] add hardware I2C support for ARM IMX23
  2012-11-28 18:33         ` Tim Michals
@ 2012-11-28 18:58           ` sander van ginkel
  2012-11-28 19:15             ` Tim Michals
  0 siblings, 1 reply; 11+ messages in thread
From: sander van ginkel @ 2012-11-28 18:58 UTC (permalink / raw)
  To: linux-arm-kernel

> Sander,
>
> Just tested with "i2cdetc -y -r 0" that crashes with  "BUG: soft
lockup -
>> CPU#0 stuck for 22s!"
>> according to the docs (IMX23RM.pdf) the interrupts for I2C are 26
and 27
>> that why I assigned these two in the dts.
>>
>
> In your dts, is it 26, 27? Order matters, it should be 27, 26.
Error ISR,
> DMA.
>

Hi Tim,

Thanks for your suggestion. I swapped the numbers and it solved the crash.
However I still have to debug some more because it gives now :
  mxs-i2c 80058000.i2c: Failed to get PIO reg. write descriptor.

Thanks,

Sander

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH] add hardware I2C support for ARM IMX23
  2012-11-28 18:58           ` sander van ginkel
@ 2012-11-28 19:15             ` Tim Michals
  0 siblings, 0 replies; 11+ messages in thread
From: Tim Michals @ 2012-11-28 19:15 UTC (permalink / raw)
  To: linux-arm-kernel

Sander,




>  mxs-i2c 80058000.i2c: Failed to get PIO reg. write descriptor.
>
> Yes, this is the same issue I've encountered, DMA operation did not
terminate, as a quick fix added dmaengine_terminate_all(i2c->dmach);  to
the last line of
static void mxs_i2c_reset(struct mxs_i2c_dev *i2c)
{
...
dmaengine_terminate_all(i2c->dmach);
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20121128/4dc5bdb2/attachment-0001.html>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH] add hardware I2C support for ARM IMX23
  2012-11-28 17:09         ` Wolfram Sang
  2012-11-28 17:34           ` sander van ginkel
@ 2012-11-30 16:32           ` sander van ginkel
  1 sibling, 0 replies; 11+ messages in thread
From: sander van ginkel @ 2012-11-30 16:32 UTC (permalink / raw)
  To: linux-arm-kernel

> You might want to try my for-next branch or wait for 3.8-rc1, maybe
the
> DMA termination patch helps? Also enabling I2C debug messages is
> probably worth it.
>
> Regards,
>
>    Wolfram
>
> --
> Pengutronix e.K.                           | Wolfram Sang
      |
> Industrial Linux Solutions                 |
http://www.pengutronix.de/  |
>

I've tested your git tree, with the same config as I used for the  
3.7.0-rc6 release (IMX i2c build in)
It's not a 100% fix

If I do "i2cdetect -y -r 0" with 3.7.0-rc6, i2cdetect gets confused  
and the kernel keeps dumping "mxs-i2c 80058000.i2c: Failed to get PIO  
reg. write descriptor."
If I do the same with your git release I get the same result, but only  
when i2cdetect is running. When it's finished or I terminate, the  
kprint will also disappear.
So there is some improvement but not 100% yet.

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2012-11-30 16:32 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-28 14:24 [PATCH] add hardware I2C support for ARM IMX23 sander van ginkel
2012-11-28 15:08 ` Wolfram Sang
2012-11-28 16:10   ` sander van ginkel
2012-11-28 16:24     ` Wolfram Sang
2012-11-28 16:44       ` Sander van Ginkel
2012-11-28 17:09         ` Wolfram Sang
2012-11-28 17:34           ` sander van ginkel
2012-11-30 16:32           ` sander van ginkel
2012-11-28 18:33         ` Tim Michals
2012-11-28 18:58           ` sander van ginkel
2012-11-28 19:15             ` Tim Michals

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).