Skip to contentSkip to conversation

i2c: Add device tree support to i2c-pnx.c

PATCH Superseded Roland Stigge 2 participants 3 messages Apr 20, 2012

Subsystems (3)

v5 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH v5 1/1 i2c: Add device tree support to i2c-pnx.c

This patch adds device tree support to the pnx-i2c driver by using platform resources for memory region and irq and removing dependency on mach includes.

The following platforms are affected:

* PNX
* LPC31xx (WIP)
* LPC32xx

The patch is based on a patch by Jon Smirl, working on lpc31xx integration

---

Applies to v3.4-rc3 + already applied i2c-pnx.c patches from this series

NOTE: I separated out this patch from the first patch series of the LPC32xx device tree conversion because most of those patches are already applied to -next. This is the last patch of this first series, a precondition for the LPC32xx device tree switch.

Changes since v4:
* Removed OF timeout property (to be added later when there is consensus about how to call and handle it)
* Changed clock-frequency example to decimal

 Documentation/devicetree/bindings/i2c/pnx.txt |   38 +++++++++++++
 drivers/i2c/busses/i2c-pnx.c                  |   71 +++++++++++++++++++-------
 include/linux/i2c-pnx.h                       |    1 
 3 files changed, 93 insertions(+), 17 deletions(-)
Documentation/devicetree/bindings/i2c/pnx.txt new file +38 -0
@@ -0,0 +1,38 @@
+* NXP PNX I2C Controller
+
+Required properties:
+
+ - reg: Offset and length of the register set for the device
+ - compatible: should be "nxp,pnx-i2c"
+ - interrupts: configure one interrupt line
+ - #address-cells: always 1 (for i2c addresses)
+ - #size-cells: always 0
+ - interrupt-parent: the phandle for the interrupt controller that
+   services interrupts for this device.
+
+Optional properties:
+
+ - clock-frequency: desired I2C bus clock frequency in Hz, Default: 100000 Hz
+ - slave-addr: Address used by the controller, Hardware default: 0x6e
+
+Examples:
+
+	i2c1: i2c at 400a0000 {
+		compatible = "nxp,pnx-i2c";
+		reg = <0x400a0000 0x100>;
+		interrupt-parent = <&mic>;
+		interrupts = <51 0>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+	};
+
+	i2c2: i2c at 400a8000 {
+		compatible = "nxp,pnx-i2c";
+		reg = <0x400a8000 0x100>;
+		interrupt-parent = <&mic>;
+		interrupts = <50 0>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+		clock-frequency = <100000>;
+		slave-addr = <0x11>;
+	};
drivers/i2c/busses/i2c-pnx.c +54 -17

195 lines not on this page · raw message

include/linux/i2c-pnx.h +1 -0
@@ -32,6 +32,7 @@ struct i2c_pnx_algo_data {
 	struct i2c_adapter	adapter;
 	phys_addr_t		base;
 	int			irq;
+	u32			timeout;
 };
 
 #endif /* __I2C_PNX_H__ */
#1 lore raw
Quoted 9 lines · Roland Stigge

This patch adds device tree support to the pnx-i2c driver by using platform resources for memory region and irq and removing dependency on mach includes.

The following platforms are affected:

* PNX
* LPC31xx (WIP)
* LPC32xx

Quoted 5 lines

The patch is based on a patch by Jon Smirl, working on lpc31xx integration

NACK! I said the approach of dropping "timeout" is OK, but unless I say "you may add my ack after changing this and that", please do not automatically add my ack. Doesn't hurt here, since I have to pick it up anyway.

Quoted 4 lines

Changes since v4:
* Removed OF timeout property (to be added later when there is consensus about how to call and handle it)
* Changed clock-frequency example to decimal

Thanks, I just noticed. Please drop (more precise: remove) the "slave-addr" for the same reasons as "timeout". Doesn't make much sense anyhow, pnx doesn't have any slave support.

drivers/i2c/busses/i2c-pnx.c static int __devinit i2c_pnx_probe(struc · line 728

Quoted 3 lines
drivers/i2c/busses/i2c-pnx.c +1 -1
 	ret = request_irq(alg_data->irq, i2c_pnx_interrupt,
-			0, pdev->name, alg_data);
+			  0, pdev->name, alg_data);

I know that checkpatch complains about this, but I'd prefer to avoid such changes unless the code before was really unreadable.

Regards,

Wolfram

Signature · 9 lines
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/20120420/041b8d48/attachment.sig>
#2 lore raw

Hi,

Quoted 8 lines · Wolfram Sang
Quoted 3 lines

Bergmann <[email protected]> Acked-by: Wolfram Sang
<[email protected]>

NACK! I said the approach of dropping "timeout" is OK, but unless I say "you may add my ack after changing this and that", please do not automatically add my ack. Doesn't hurt here, since I have to pick it up anyway.

Sorry - my apologies! Removing for next re-post.

Quoted 6 lines
Quoted 3 lines

Changes since v4: * Removed OF timeout property (to be added later when there is consensus about how to call and handle it) * Changed clock-frequency example to decimal

Thanks, I just noticed. Please drop (more precise: remove) the "slave-addr" for the same reasons as "timeout".

OK, will do.

Quoted 5 lines
Quoted 2 lines

ret = request_irq(alg_data->irq, i2c_pnx_interrupt, - 0,
pdev->name, alg_data); + 0, pdev->name, alg_data);

I know that checkpatch complains about this, but I'd prefer to avoid such changes unless the code before was really unreadable.

OK!

Roland