aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/amba
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2012-11-30 10:30:43 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2012-12-03 06:15:35 -0500
commit3ad909bc8f2ea32fd7d24266c61cd4605feecec8 (patch)
tree045b87094068c021a71c98e1ea52a92a65eafffd /drivers/amba
parent4095ccc39ed91714d3b5172f16a9aebf30bbbea9 (diff)
ARM: 7588/1: amba: create a resource parent registrator
This creates amba_apb_device_add_res() and amba_ahb_device_add_res() respectively, to add devices with another parent than iomem_resource. This is needed to specify that a device is contained in a specific IO range. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/amba')
-rw-r--r--drivers/amba/bus.c32
1 files changed, 28 insertions, 4 deletions
diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c
index e8eb91bd0d28..a2fc56d2e681 100644
--- a/drivers/amba/bus.c
+++ b/drivers/amba/bus.c
@@ -546,7 +546,8 @@ EXPORT_SYMBOL_GPL(amba_device_add);
546static struct amba_device * 546static struct amba_device *
547amba_aphb_device_add(struct device *parent, const char *name, 547amba_aphb_device_add(struct device *parent, const char *name,
548 resource_size_t base, size_t size, int irq1, int irq2, 548 resource_size_t base, size_t size, int irq1, int irq2,
549 void *pdata, unsigned int periphid, u64 dma_mask) 549 void *pdata, unsigned int periphid, u64 dma_mask,
550 struct resource *resbase)
550{ 551{
551 struct amba_device *dev; 552 struct amba_device *dev;
552 int ret; 553 int ret;
@@ -563,7 +564,7 @@ amba_aphb_device_add(struct device *parent, const char *name,
563 dev->dev.platform_data = pdata; 564 dev->dev.platform_data = pdata;
564 dev->dev.parent = parent; 565 dev->dev.parent = parent;
565 566
566 ret = amba_device_add(dev, &iomem_resource); 567 ret = amba_device_add(dev, resbase);
567 if (ret) { 568 if (ret) {
568 amba_device_put(dev); 569 amba_device_put(dev);
569 return ERR_PTR(ret); 570 return ERR_PTR(ret);
@@ -578,7 +579,7 @@ amba_apb_device_add(struct device *parent, const char *name,
578 void *pdata, unsigned int periphid) 579 void *pdata, unsigned int periphid)
579{ 580{
580 return amba_aphb_device_add(parent, name, base, size, irq1, irq2, pdata, 581 return amba_aphb_device_add(parent, name, base, size, irq1, irq2, pdata,
581 periphid, 0); 582 periphid, 0, &iomem_resource);
582} 583}
583EXPORT_SYMBOL_GPL(amba_apb_device_add); 584EXPORT_SYMBOL_GPL(amba_apb_device_add);
584 585
@@ -588,10 +589,33 @@ amba_ahb_device_add(struct device *parent, const char *name,
588 void *pdata, unsigned int periphid) 589 void *pdata, unsigned int periphid)
589{ 590{
590 return amba_aphb_device_add(parent, name, base, size, irq1, irq2, pdata, 591 return amba_aphb_device_add(parent, name, base, size, irq1, irq2, pdata,
591 periphid, ~0ULL); 592 periphid, ~0ULL, &iomem_resource);
592} 593}
593EXPORT_SYMBOL_GPL(amba_ahb_device_add); 594EXPORT_SYMBOL_GPL(amba_ahb_device_add);
594 595
596struct amba_device *
597amba_apb_device_add_res(struct device *parent, const char *name,
598 resource_size_t base, size_t size, int irq1,
599 int irq2, void *pdata, unsigned int periphid,
600 struct resource *resbase)
601{
602 return amba_aphb_device_add(parent, name, base, size, irq1, irq2, pdata,
603 periphid, 0, resbase);
604}
605EXPORT_SYMBOL_GPL(amba_apb_device_add_res);
606
607struct amba_device *
608amba_ahb_device_add_res(struct device *parent, const char *name,
609 resource_size_t base, size_t size, int irq1,
610 int irq2, void *pdata, unsigned int periphid,
611 struct resource *resbase)
612{
613 return amba_aphb_device_add(parent, name, base, size, irq1, irq2, pdata,
614 periphid, ~0ULL, resbase);
615}
616EXPORT_SYMBOL_GPL(amba_ahb_device_add_res);
617
618
595static void amba_device_initialize(struct amba_device *dev, const char *name) 619static void amba_device_initialize(struct amba_device *dev, const char *name)
596{ 620{
597 device_initialize(&dev->dev); 621 device_initialize(&dev->dev);