Skip to content

Commit

Permalink
i2c-nomadik: turn the platform driver to an amba driver
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Alessandro Rubini authored and Wolfram Sang committed Jul 9, 2012
1 parent af97bac commit 2356021
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 86 deletions.
22 changes: 5 additions & 17 deletions arch/arm/mach-ux500/devices-common.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 *
Expand Down
Loading

0 comments on commit 2356021

Please sign in to comment.