aboutsummaryrefslogtreecommitdiff
path: root/arch/arm/mach-ux500/devices-common.h
diff options
context:
space:
mode:
authorAlessandro Rubini <rubini@gnudd.com>2012-06-11 22:56:38 +0200
committerWolfram Sang <w.sang@pengutronix.de>2012-07-09 11:40:46 +0200
commit235602146ec9c1882edf1ccc68389c1176be8198 (patch)
tree7b3afcf452f9b8aa65d8091ac700f3dad7f524e7 /arch/arm/mach-ux500/devices-common.h
parentaf97bace2cca58ee7c94bf4d31e820f29688d7a5 (diff)
i2c-nomadik: turn the platform driver to an amba driver
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. Signed-off-by: Alessandro Rubini <rubini@gnudd.com> Acked-by: Giancarlo Asnaghi <giancarlo.asnaghi@st.com> Tested-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Diffstat (limited to 'arch/arm/mach-ux500/devices-common.h')
-rw-r--r--arch/arm/mach-ux500/devices-common.h22
1 files changed, 5 insertions, 17 deletions
diff --git a/arch/arm/mach-ux500/devices-common.h b/arch/arm/mach-ux500/devices-common.h
index 23cf734b5384..ecdd8386cffb 100644
--- a/arch/arm/mach-ux500/devices-common.h
+++ b/arch/arm/mach-ux500/devices-common.h
@@ -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 *