Commit 5002484b authored by Linus Walleij's avatar Linus Walleij Committed by Russell King

ARM: 7370/2: mxs: factor out dynamic amba device allocator

Replace the local amba device allocator with the core code from
the bus driver.
Acked-by: default avatarShawn Guo <shawn.guo@linaro.org>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 6026aa90
...@@ -11,10 +11,16 @@ ...@@ -11,10 +11,16 @@
#include <mach/mx23.h> #include <mach/mx23.h>
#include <mach/devices-common.h> #include <mach/devices-common.h>
#include <mach/mxsfb.h> #include <mach/mxsfb.h>
#include <linux/amba/bus.h>
extern const struct amba_device mx23_duart_device __initconst; static inline int mx23_add_duart(void)
#define mx23_add_duart() \ {
mxs_add_duart(&mx23_duart_device) struct amba_device *d;
d = amba_ahb_device_add(NULL, "duart", MX23_DUART_BASE_ADDR, SZ_8K,
MX23_INT_DUART, 0, 0, 0);
return IS_ERR(d) ? PTR_ERR(d) : 0;
}
extern const struct mxs_auart_data mx23_auart_data[] __initconst; extern const struct mxs_auart_data mx23_auart_data[] __initconst;
#define mx23_add_auart(id) mxs_add_auart(&mx23_auart_data[id]) #define mx23_add_auart(id) mxs_add_auart(&mx23_auart_data[id])
......
...@@ -11,10 +11,16 @@ ...@@ -11,10 +11,16 @@
#include <mach/mx28.h> #include <mach/mx28.h>
#include <mach/devices-common.h> #include <mach/devices-common.h>
#include <mach/mxsfb.h> #include <mach/mxsfb.h>
#include <linux/amba/bus.h>
extern const struct amba_device mx28_duart_device __initconst; static inline int mx28_add_duart(void)
#define mx28_add_duart() \ {
mxs_add_duart(&mx28_duart_device) struct amba_device *d;
d = amba_ahb_device_add(NULL, "duart", MX28_DUART_BASE_ADDR, SZ_8K,
MX28_INT_DUART, 0, 0, 0);
return IS_ERR(d) ? PTR_ERR(d) : 0;
}
extern const struct mxs_auart_data mx28_auart_data[] __initconst; extern const struct mxs_auart_data mx28_auart_data[] __initconst;
#define mx28_add_auart(id) mxs_add_auart(&mx28_auart_data[id]) #define mx28_add_auart(id) mxs_add_auart(&mx28_auart_data[id])
......
...@@ -75,22 +75,6 @@ struct platform_device *__init mxs_add_platform_device_dmamask( ...@@ -75,22 +75,6 @@ struct platform_device *__init mxs_add_platform_device_dmamask(
return pdev; return pdev;
} }
int __init mxs_add_amba_device(const struct amba_device *dev)
{
struct amba_device *adev = amba_device_alloc(dev->dev.init_name,
dev->res.start, resource_size(&dev->res));
if (!adev) {
pr_err("%s: failed to allocate memory", __func__);
return -ENOMEM;
}
adev->irq[0] = dev->irq[0];
adev->irq[1] = dev->irq[1];
return amba_device_add(adev, &iomem_resource);
}
struct device mxs_apbh_bus = { struct device mxs_apbh_bus = {
.init_name = "mxs_apbh", .init_name = "mxs_apbh",
.parent = &platform_bus, .parent = &platform_bus,
......
obj-$(CONFIG_MXS_HAVE_AMBA_DUART) += amba-duart.o
obj-$(CONFIG_MXS_HAVE_PLATFORM_AUART) += platform-auart.o obj-$(CONFIG_MXS_HAVE_PLATFORM_AUART) += platform-auart.o
obj-y += platform-dma.o obj-y += platform-dma.o
obj-$(CONFIG_MXS_HAVE_PLATFORM_FEC) += platform-fec.o obj-$(CONFIG_MXS_HAVE_PLATFORM_FEC) += platform-fec.o
......
/*
* Copyright (C) 2009-2010 Pengutronix
* Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
*
* Copyright 2010 Freescale Semiconductor, Inc. All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 2 as published by the
* Free Software Foundation.
*/
#include <asm/irq.h>
#include <mach/mx23.h>
#include <mach/mx28.h>
#include <mach/devices-common.h>
#define MXS_AMBA_DUART_DEVICE(name, soc) \
const struct amba_device name##_device __initconst = { \
.dev = { \
.init_name = "duart", \
}, \
.res = { \
.start = soc ## _DUART_BASE_ADDR, \
.end = (soc ## _DUART_BASE_ADDR) + SZ_8K - 1, \
.flags = IORESOURCE_MEM, \
}, \
.irq = {soc ## _INT_DUART}, \
}
#ifdef CONFIG_SOC_IMX23
MXS_AMBA_DUART_DEVICE(mx23_duart, MX23);
#endif
#ifdef CONFIG_SOC_IMX28
MXS_AMBA_DUART_DEVICE(mx28_duart, MX28);
#endif
int __init mxs_add_duart(const struct amba_device *dev)
{
return mxs_add_amba_device(dev);
}
...@@ -27,11 +27,6 @@ static inline struct platform_device *mxs_add_platform_device( ...@@ -27,11 +27,6 @@ static inline struct platform_device *mxs_add_platform_device(
name, id, res, num_resources, data, size_data, 0); name, id, res, num_resources, data, size_data, 0);
} }
int __init mxs_add_amba_device(const struct amba_device *dev);
/* duart */
int __init mxs_add_duart(const struct amba_device *dev);
/* auart */ /* auart */
struct mxs_auart_data { struct mxs_auart_data {
int id; int id;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment