diff options
Diffstat (limited to 'drivers/amba')
-rw-r--r-- | drivers/amba/bus.c | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c index cc273226dbd0..9469d8722038 100644 --- a/drivers/amba/bus.c +++ b/drivers/amba/bus.c | |||
@@ -543,6 +543,55 @@ int amba_device_add(struct amba_device *dev, struct resource *parent) | |||
543 | } | 543 | } |
544 | EXPORT_SYMBOL_GPL(amba_device_add); | 544 | EXPORT_SYMBOL_GPL(amba_device_add); |
545 | 545 | ||
546 | static struct amba_device * | ||
547 | amba_aphb_device_add(struct device *parent, const char *name, | ||
548 | resource_size_t base, size_t size, int irq1, int irq2, | ||
549 | void *pdata, unsigned int periphid, u64 dma_mask) | ||
550 | { | ||
551 | struct amba_device *dev; | ||
552 | int ret; | ||
553 | |||
554 | dev = amba_device_alloc(name, base, size); | ||
555 | if (!dev) | ||
556 | return ERR_PTR(-ENOMEM); | ||
557 | |||
558 | dev->dma_mask = dma_mask; | ||
559 | dev->dev.coherent_dma_mask = dma_mask; | ||
560 | dev->irq[0] = irq1; | ||
561 | dev->irq[1] = irq2; | ||
562 | dev->periphid = periphid; | ||
563 | dev->dev.platform_data = pdata; | ||
564 | dev->dev.parent = parent; | ||
565 | |||
566 | ret = amba_device_add(dev, &iomem_resource); | ||
567 | if (ret) { | ||
568 | amba_device_put(dev); | ||
569 | return ERR_PTR(ret); | ||
570 | } | ||
571 | |||
572 | return dev; | ||
573 | } | ||
574 | |||
575 | struct amba_device * | ||
576 | amba_apb_device_add(struct device *parent, const char *name, | ||
577 | resource_size_t base, size_t size, int irq1, int irq2, | ||
578 | void *pdata, unsigned int periphid) | ||
579 | { | ||
580 | return amba_aphb_device_add(parent, name, base, size, irq1, irq2, pdata, | ||
581 | periphid, 0); | ||
582 | } | ||
583 | EXPORT_SYMBOL_GPL(amba_apb_device_add); | ||
584 | |||
585 | struct amba_device * | ||
586 | amba_ahb_device_add(struct device *parent, const char *name, | ||
587 | resource_size_t base, size_t size, int irq1, int irq2, | ||
588 | void *pdata, unsigned int periphid) | ||
589 | { | ||
590 | return amba_aphb_device_add(parent, name, base, size, irq1, irq2, pdata, | ||
591 | periphid, ~0ULL); | ||
592 | } | ||
593 | EXPORT_SYMBOL_GPL(amba_ahb_device_add); | ||
594 | |||
546 | static void amba_device_initialize(struct amba_device *dev, const char *name) | 595 | static void amba_device_initialize(struct amba_device *dev, const char *name) |
547 | { | 596 | { |
548 | device_initialize(&dev->dev); | 597 | device_initialize(&dev->dev); |