Skip to contentSkip to conversation

i2c-nomadik changes

PATCH In review Alessandro Rubini 5 participants 12 messages Jun 11, 2012 – Jul 9, 2012

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v3 cover i2c-nomadik changes

V3:
- fixed according to Linusw feedback (merged the patch he posted)
- added Tested-by: Linusw on his permission

V2:
- use linux/platform_data/i2c-nomadik.h not linux/i2c-nomadik.h
- format patch with -M
- added lee jones to the Cc: list (for device tree support)
- minor rewording of the commit messages

Alessandro Rubini (3):
i2c-nomadik: move header to <linux/platform_data/i2c-nomadik.h>
i2c-nomadik: turn the platform driver to an amba driver
i2c-nomadik: depend on ARM_AMBA, not PLAT_NOMADIK

 arch/arm/mach-ux500/board-mop500.c                 |    2 +-
 arch/arm/mach-ux500/devices-common.h               |   24 +---
 drivers/i2c/busses/Kconfig                         |    5 +-
 drivers/i2c/busses/i2c-nomadik.c                   |  145 ++++++++++----------
 .../linux/platform_data/i2c-nomadik.h              |    6 +-
 5 files changed, 87 insertions(+), 95 deletions(-)
 rename arch/arm/plat-nomadik/include/plat/i2c.h => include/linux/platform_data/i2c-nomadik.h (91%)
Signature · 1 line
1.7.7.2
#1 lore raw

PATCH v3 1/3 i2c-nomadik: move header to <linux/platform_data/i2c-nomadik.h>

The header and driver are only used by arm/mach-u8500 (and potentially arm/mach-nomadik), but the STA2X11 I/O Hub exports on PCIe a number of devices, including i2c-nomadik. This patch allows compilation of the driver under x86.

---
 arch/arm/mach-ux500/board-mop500.c                 |    2 +-
 arch/arm/mach-ux500/devices-common.h               |    2 +-
 drivers/i2c/busses/i2c-nomadik.c                   |    3 +--
 .../linux/platform_data/i2c-nomadik.h              |    6 +++---
 4 files changed, 6 insertions(+), 7 deletions(-)
 rename arch/arm/plat-nomadik/include/plat/i2c.h => include/linux/platform_data/i2c-nomadik.h (91%)
arch/arm/mach-ux500/board-mop500.c +1 -1
index 9c74ac5..0bf24bb 100644
@@ -15,6 +15,7 @@
 #include <linux/platform_device.h>
 #include <linux/io.h>
 #include <linux/i2c.h>
+#include <linux/platform_data/i2c-nomadik.h>
 #include <linux/gpio.h>
 #include <linux/amba/bus.h>
 #include <linux/amba/pl022.h>
@@ -39,7 +40,6 @@
 #include <asm/mach/arch.h>
 #include <asm/hardware/gic.h>
 
-#include <plat/i2c.h>
 #include <plat/ste_dma40.h>
 #include <plat/gpio-nomadik.h>
 
arch/arm/mach-ux500/devices-common.h +1 -1
index 6e47065..23cf734 100644
@@ -12,7 +12,7 @@
 #include <linux/dma-mapping.h>
 #include <linux/sys_soc.h>
 #include <linux/amba/bus.h>
-#include <plat/i2c.h>
+#include <linux/platform_data/i2c-nomadik.h>
 #include <mach/crypto-ux500.h>
 
 struct spi_master_cntlr;
drivers/i2c/busses/i2c-nomadik.c +1 -2
index 5267ab9..752f1fd 100644
@@ -23,8 +23,7 @@
 #include <linux/io.h>
 #include <linux/regulator/consumer.h>
 #include <linux/pm_runtime.h>
-
-#include <plat/i2c.h>
+#include <linux/platform_data/i2c-nomadik.h>
 
 #define DRIVER_NAME "nmk-i2c"
 
include/linux/platform_data/i2c-nomadik.h renamed from arch/arm/plat-nomadik/include/plat/i2c.h +3 -3
similarity index 91%
rename from arch/arm/plat-nomadik/include/plat/i2c.h
rename to include/linux/platform_data/i2c-nomadik.h
index 8ba70ff..c2303c3 100644
@@ -5,8 +5,8 @@
  * it under the terms of the GNU General Public License version 2, as
  * published by the Free Software Foundation.
  */
-#ifndef __PLAT_I2C_H
-#define __PLAT_I2C_H
+#ifndef __PDATA_I2C_NOMADIK_H
+#define __PDATA_I2C_NOMADIK_H
 
 enum i2c_freq_mode {
 	I2C_FREQ_MODE_STANDARD,		/* up to 100 Kb/s */
@@ -36,4 +36,4 @@ struct nmk_i2c_controller {
 	enum i2c_freq_mode	sm;
 };
 
-#endif	/* __PLAT_I2C_H */
+#endif	/* __PDATA_I2C_NOMADIK_H */
Signature · 1 line
1.7.7.2
#2 lore raw

PATCH v3 2/3 i2c-nomadik: turn the platform driver to an amba driver

In reply to Alessandro Rubini

The i2c-nomadik gateware is really a PrimeCell APB device. By hosting the driver under the amba bus we can access it more easily, for example using the generic pci-amba driver. The patch also fixes the mach-ux500 users, so they register an amba device instead than a platform device.

---
 arch/arm/mach-ux500/devices-common.h |   22 +----
 drivers/i2c/busses/i2c-nomadik.c     |  142 +++++++++++++++++----------------
 2 files changed, 78 insertions(+), 86 deletions(-)
arch/arm/mach-ux500/devices-common.h +5 -17
index 23cf734..ecdd838 100644
@@ -56,27 +56,15 @@ dbx500_add_uart(struct device *parent, const char *name, resource_size_t base,
 
 struct nmk_i2c_controller;
 
-static inline struct platform_device *
+static inline struct amba_device *
 dbx500_add_i2c(struct device *parent, int id, resource_size_t base, int irq,
 	       struct nmk_i2c_controller *data)
 {
-	struct resource res[] = {
-		DEFINE_RES_MEM(base, SZ_4K),
-		DEFINE_RES_IRQ(irq),
-	};
+	/* Conjure a name similar to what the platform device used to have */
+	char name[16];
 
-	struct platform_device_info pdevinfo = {
-		.parent = parent,
-		.name = "nmk-i2c",
-		.id = id,
-		.res = res,
-		.num_res = ARRAY_SIZE(res),
-		.data = data,
-		.size_data = sizeof(*data),
-		.dma_mask = DMA_BIT_MASK(32),
-	};
-
-	return platform_device_register_full(&pdevinfo);
+	snprintf(name, sizeof(name), "nmk-i2c.%d", id);
+	return amba_apb_device_add(parent, name, base, SZ_4K, irq, 0, data, 0);
 }
 
 static inline struct amba_device *
drivers/i2c/busses/i2c-nomadik.c +73 -69

351 lines not on this page · raw message

Signature · 1 line
1.7.7.2
#3 lore raw

Re: [PATCH V3 2/3] i2c-nomadik: turn the platform driver to an amba driver

Quoted 6 lines · Alessandro Rubini

The i2c-nomadik gateware is really a PrimeCell APB device. By hosting the driver under the amba bus we can access it more easily, for example using the generic pci-amba driver. The patch also fixes the mach-ux500 users, so they register an amba device instead than a platform device.

Quoted 7 lines
---
 arch/arm/mach-ux500/devices-common.h |   22 +----
 drivers/i2c/busses/i2c-nomadik.c     |  142 +++++++++++++++++----------------
 2 files changed, 78 insertions(+), 86 deletions(-)

You change only one half of ux500 here: the part where the device gets defined statically, but not not the definition in the device-tree.

I think all you need to do is mark the device compatible with primecell and add an ID if necessary, but we should definitely make sure that that path still works, because the one you patch is going away.

Arnd

#4 lore raw

Re: [PATCH V3 2/3] i2c-nomadik: turn the platform driver to an amba driver

Quoted 3 lines

You change only one half of ux500 here: the part where the device gets defined statically, but not not the definition in the device-tree.

Yes, I'm aware. That's why I added Lee Jones as Cc:, on Linusw's suggestion. Lee told me to go ahead and he'll fix the DT stuff. Lee?

thanks
/alessandro

#5 lore raw

Re: [PATCH V3 2/3] i2c-nomadik: turn the platform driver to an amba driver

Quoted 6 lines · Alessandro Rubini
Quoted 3 lines

You change only one half of ux500 here: the part where the device gets defined statically, but not not the definition in the device-tree.

Yes, I'm aware. That's why I added Lee Jones as Cc:, on Linusw's suggestion. Lee told me to go ahead and he'll fix the DT stuff.

I did?

I have already DT:ed this driver. There are 3 patches on the MLs currently.

Quoted 3 lines

[PATCH 1/3] i2c: Add Device Tree support to the Nomadik I2C driver
[PATCH 2/3] ARM: ux500: Add i2c configurations to the Device Tree for DB8500 based devices [PATCH 3/3] Documentation: Device Tree binding information for i2c-nomadik driver

I'm more than happy for you to base your patches on these and make the necessary changes. Off hand, I think the only changes you'll need to make is the probing from DT itself.

So something like:

arch/arm/boot/dts/db8500.dtsi line 455

Quoted 11 lines
arch/arm/boot/dts/db8500.dtsi +1 -1
@@ -449,7 +449,7 @@
                };
 
                i2c at 80004000 {
-                       compatible = "stericsson,db8500-i2c", "st,nomadik-i2c";
+                       compatible = "st,nomadik-i2c", "arm,primecell";
                        reg = <0x80004000 0x1000>;
                        interrupts = <0 21 0x4>;
                        #address-cells = <1>;

... for each of the controllers.

Signature · 5 lines
Lee Jones
Linaro ST-Ericsson Landing Team Lead
M: +44 77 88 633 515
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#6 lore raw

Re: [PATCH V3 2/3] i2c-nomadik: turn the platform driver to an amba driver

Quoted 10 lines · Lee Jones
Quoted 7 lines · Alessandro Rubini
Quoted 4 lines

You change only one half of ux500 here: the part where the device gets defined statically, but not not the definition in the device-tree.

Yes, I'm aware. That's why I added Lee Jones as Cc:, on Linusw's suggestion. ?Lee told me to go ahead and he'll fix the DT stuff.

I did?

Yes :-)

Quoted 11 lines

I have already DT:ed this driver. There are 3 patches on the MLs currently.

Quoted 5 lines

[PATCH 1/3] i2c: Add Device Tree support to the Nomadik I2C driver [PATCH 2/3] ARM: ux500: Add i2c configurations to the Device Tree for DB8500 based devices
[PATCH 3/3] Documentation: Device Tree binding information for i2c-nomadik driver

I'm more than happy for you to base your patches on these and make the necessary changes. Off hand, I think the only changes you'll need to make is the probing from DT itself.

Depends on whether this patch or yours go in first I guess. Which is up to Wolfram. What I know is that Alessandros patches are ready to merge IMO.

Quoted 4 lines

So something like:

- compatible = "stericsson,db8500-i2c", "st,nomadik-i2c";
+ compatible = "st,nomadik-i2c", "arm,primecell";

Yep that should do it.

Which brings me to the fear of what happens the day we have deployed device trees out there and just cannot change things like this easily :-/

Yours,
Linus Walleij

#7 lore raw

PATCH v3 3/3 i2c-nomadik: depend on ARM_AMBA, not PLAT_NOMADIK

In reply to Alessandro Rubini

The gateware device has been used outside of the Nomadik world, using the pci-amba bridge driver, so loosen the dependencies.

---
 drivers/i2c/busses/Kconfig |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
drivers/i2c/busses/Kconfig +3 -2
index 7244c8b..e9f9c5d 100644
@@ -479,10 +479,11 @@ config I2C_MXS
 
 config I2C_NOMADIK
 	tristate "ST-Ericsson Nomadik/Ux500 I2C Controller"
-	depends on PLAT_NOMADIK
+	depends on ARM_AMBA
 	help
 	  If you say yes to this option, support will be included for the
-	  I2C interface from ST-Ericsson's Nomadik and Ux500 architectures.
+	  I2C interface from ST-Ericsson's Nomadik and Ux500 architectures,
+	  as well as the STA2X11 PCIe I/O HUB.
 
 config I2C_NUC900
 	tristate "NUC900 I2C Driver"
Signature · 1 line
1.7.7.2
#8 lore raw
In reply to Alessandro Rubini
Quoted 3 lines · Alessandro Rubini

V3:
? ? ? ?- fixed according to Linusw feedback (merged the patch he posted) ? ? ? ?- added Tested-by: Linusw on his permission

I'm happy with this version, Wolfram if it looks OK to you, can you please merge this into the I2C tree?

Yours,
Linus Walleij

#9 lore raw
Quoted 8 lines · Linus Walleij
Quoted 3 lines · Alessandro Rubini

V3:
? ? ? ?- fixed according to Linusw feedback (merged the patch he posted) ? ? ? ?- added Tested-by: Linusw on his permission

I'm happy with this version, Wolfram if it looks OK to you, can you please merge this into the I2C tree?

Done now, thanks.

Is the latest version of Lee's patches for DT sent on 20/06 suitable to go on top of that?

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/20120709/69dd6f32/attachment.sig>
#10 lore raw
Quoted 7 lines · Wolfram Sang
Quoted 6 lines · Linus Walleij
Quoted 3 lines · Alessandro Rubini

V3:
- fixed according to Linusw feedback (merged the patch he posted)
- added Tested-by: Linusw on his permission

Quoted 7 lines
Quoted 2 lines

I'm happy with this version, Wolfram if it looks OK to you, can you please merge this into the I2C tree?

Done now, thanks.

Is the latest version of Lee's patches for DT sent on 20/06 suitable to go on top of that?

No clue on that, Lee'd have to comment.

Yours,
Linus Walleij

#11 lore raw
Quoted 11 lines · Linus Walleij
Quoted 10 lines · Wolfram Sang
Quoted 8 lines · Linus Walleij
Quoted 3 lines · Alessandro Rubini

V3:
- fixed according to Linusw feedback (merged the patch he posted)
- added Tested-by: Linusw on his permission

I'm happy with this version, Wolfram if it looks OK to you, can you please merge this into the I2C tree?

Quoted 6 lines
Quoted 4 lines

Done now, thanks.

Is the latest version of Lee's patches for DT sent on 20/06 suitable to go on top of that?

No clue on that, Lee'd have to comment.

All my i2c stuff is in -next.

Feel free to pull it in and base on that.

Signature · 5 lines
Lee Jones
Linaro ST-Ericsson Landing Team Lead
M: +44 77 88 633 515
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog