From 59b8c91dcbdf1607a074219c98a90ebc7a4b7c31 Mon Sep 17 00:00:00 2001 From: Philippe Langlais Date: Wed, 18 Apr 2012 11:13:21 +0200 Subject: mach-ux500: device-common: Temporary re-add deleted functions in mainline Signed-off-by: Philippe Langlais --- arch/arm/mach-ux500/devices-common.c | 32 ++++++++++++++++++++++++++++++++ arch/arm/mach-ux500/devices-common.h | 5 +++++ 2 files changed, 37 insertions(+) diff --git a/arch/arm/mach-ux500/devices-common.c b/arch/arm/mach-ux500/devices-common.c index c139cacc2b7..04f27d7b9c9 100644 --- a/arch/arm/mach-ux500/devices-common.c +++ b/arch/arm/mach-ux500/devices-common.c @@ -55,6 +55,38 @@ dbx500_add_amba_device(struct device *parent, const char *name, return dev; } +static struct platform_device * +dbx500_add_platform_device(const char *name, int id, void *pdata, + struct resource *res, int resnum) +{ + struct platform_device *dev; + int ret; + + dev = platform_device_alloc(name, id); + if (!dev) + return ERR_PTR(-ENOMEM); + + dev->dev.coherent_dma_mask = DMA_BIT_MASK(32); + dev->dev.dma_mask = &dev->dev.coherent_dma_mask; + dev->dev.pm_domain = &ux500_dev_power_domain; + + ret = platform_device_add_resources(dev, res, resnum); + if (ret) + goto out_free; + + dev->dev.platform_data = pdata; + + ret = platform_device_add(dev); + if (ret) + goto out_free; + + return dev; + +out_free: + platform_device_put(dev); + return ERR_PTR(ret); +} + struct platform_device * dbx500_add_platform_device_4k1irq(const char *name, int id, resource_size_t base, diff --git a/arch/arm/mach-ux500/devices-common.h b/arch/arm/mach-ux500/devices-common.h index aa477ec8092..243c0215f34 100644 --- a/arch/arm/mach-ux500/devices-common.h +++ b/arch/arm/mach-ux500/devices-common.h @@ -19,6 +19,11 @@ dbx500_add_amba_device(struct device *parent, const char *name, resource_size_t base, int irq, void *pdata, unsigned int periphid); +extern struct platform_device * +dbx500_add_platform_device_4k1irq(const char *name, int id, + resource_size_t base, + int irq, void *pdata); + extern struct platform_device * dbx500_add_platform_device_noirq(const char *name, int id, resource_size_t base, void *pdata); -- cgit v1.2.3