aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/amba/bus.c105
-rw-r--r--drivers/mmc/host/at91_mci.c1
-rw-r--r--drivers/mmc/host/mmci.c2
-rw-r--r--drivers/of/platform.c6
-rw-r--r--drivers/usb/gadget/Kconfig4
5 files changed, 85 insertions, 33 deletions
diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c
index 54eaf96ab217..01c2cf4efcdd 100644
--- a/drivers/amba/bus.c
+++ b/drivers/amba/bus.c
@@ -497,37 +497,22 @@ static void amba_device_release(struct device *dev)
497} 497}
498 498
499/** 499/**
500 * amba_device_register - register an AMBA device 500 * amba_device_add - add a previously allocated AMBA device structure
501 * @dev: AMBA device to register 501 * @dev: AMBA device allocated by amba_device_alloc
502 * @parent: parent memory resource 502 * @parent: resource parent for this devices resources
503 * 503 *
504 * Setup the AMBA device, reading the cell ID if present. 504 * Claim the resource, and read the device cell ID if not already
505 * Claim the resource, and register the AMBA device with 505 * initialized. Register the AMBA device with the Linux device
506 * the Linux device manager. 506 * manager.
507 */ 507 */
508int amba_device_register(struct amba_device *dev, struct resource *parent) 508int amba_device_add(struct amba_device *dev, struct resource *parent)
509{ 509{
510 u32 size; 510 u32 size;
511 void __iomem *tmp; 511 void __iomem *tmp;
512 int i, ret; 512 int i, ret;
513 513
514 device_initialize(&dev->dev); 514 WARN_ON(dev->irq[0] == (unsigned int)-1);
515 515 WARN_ON(dev->irq[1] == (unsigned int)-1);
516 /*
517 * Copy from device_add
518 */
519 if (dev->dev.init_name) {
520 dev_set_name(&dev->dev, "%s", dev->dev.init_name);
521 dev->dev.init_name = NULL;
522 }
523
524 dev->dev.release = amba_device_release;
525 dev->dev.bus = &amba_bustype;
526 dev->dev.dma_mask = &dev->dma_mask;
527 dev->res.name = dev_name(&dev->dev);
528
529 if (!dev->dev.coherent_dma_mask && dev->dma_mask)
530 dev_warn(&dev->dev, "coherent dma mask is unset\n");
531 516
532 ret = request_resource(parent, &dev->res); 517 ret = request_resource(parent, &dev->res);
533 if (ret) 518 if (ret)
@@ -582,9 +567,9 @@ int amba_device_register(struct amba_device *dev, struct resource *parent)
582 if (ret) 567 if (ret)
583 goto err_release; 568 goto err_release;
584 569
585 if (dev->irq[0] != NO_IRQ) 570 if (dev->irq[0] && dev->irq[0] != NO_IRQ)
586 ret = device_create_file(&dev->dev, &dev_attr_irq0); 571 ret = device_create_file(&dev->dev, &dev_attr_irq0);
587 if (ret == 0 && dev->irq[1] != NO_IRQ) 572 if (ret == 0 && dev->irq[1] && dev->irq[1] != NO_IRQ)
588 ret = device_create_file(&dev->dev, &dev_attr_irq1); 573 ret = device_create_file(&dev->dev, &dev_attr_irq1);
589 if (ret == 0) 574 if (ret == 0)
590 return ret; 575 return ret;
@@ -596,6 +581,74 @@ int amba_device_register(struct amba_device *dev, struct resource *parent)
596 err_out: 581 err_out:
597 return ret; 582 return ret;
598} 583}
584EXPORT_SYMBOL_GPL(amba_device_add);
585
586static void amba_device_initialize(struct amba_device *dev, const char *name)
587{
588 device_initialize(&dev->dev);
589 if (name)
590 dev_set_name(&dev->dev, "%s", name);
591 dev->dev.release = amba_device_release;
592 dev->dev.bus = &amba_bustype;
593 dev->dev.dma_mask = &dev->dma_mask;
594 dev->res.name = dev_name(&dev->dev);
595}
596
597/**
598 * amba_device_alloc - allocate an AMBA device
599 * @name: sysfs name of the AMBA device
600 * @base: base of AMBA device
601 * @size: size of AMBA device
602 *
603 * Allocate and initialize an AMBA device structure. Returns %NULL
604 * on failure.
605 */
606struct amba_device *amba_device_alloc(const char *name, resource_size_t base,
607 size_t size)
608{
609 struct amba_device *dev;
610
611 dev = kzalloc(sizeof(*dev), GFP_KERNEL);
612 if (dev) {
613 amba_device_initialize(dev, name);
614 dev->res.start = base;
615 dev->res.end = base + size - 1;
616 dev->res.flags = IORESOURCE_MEM;
617 }
618
619 return dev;
620}
621EXPORT_SYMBOL_GPL(amba_device_alloc);
622
623/**
624 * amba_device_register - register an AMBA device
625 * @dev: AMBA device to register
626 * @parent: parent memory resource
627 *
628 * Setup the AMBA device, reading the cell ID if present.
629 * Claim the resource, and register the AMBA device with
630 * the Linux device manager.
631 */
632int amba_device_register(struct amba_device *dev, struct resource *parent)
633{
634 amba_device_initialize(dev, dev->dev.init_name);
635 dev->dev.init_name = NULL;
636
637 if (!dev->dev.coherent_dma_mask && dev->dma_mask)
638 dev_warn(&dev->dev, "coherent dma mask is unset\n");
639
640 return amba_device_add(dev, parent);
641}
642
643/**
644 * amba_device_put - put an AMBA device
645 * @dev: AMBA device to put
646 */
647void amba_device_put(struct amba_device *dev)
648{
649 put_device(&dev->dev);
650}
651EXPORT_SYMBOL_GPL(amba_device_put);
599 652
600/** 653/**
601 * amba_device_unregister - unregister an AMBA device 654 * amba_device_unregister - unregister an AMBA device
diff --git a/drivers/mmc/host/at91_mci.c b/drivers/mmc/host/at91_mci.c
index 947faa5d2ce4..efdb81d21c44 100644
--- a/drivers/mmc/host/at91_mci.c
+++ b/drivers/mmc/host/at91_mci.c
@@ -86,7 +86,6 @@ static inline int at91mci_is_mci1rev2xx(void)
86{ 86{
87 return ( cpu_is_at91sam9260() 87 return ( cpu_is_at91sam9260()
88 || cpu_is_at91sam9263() 88 || cpu_is_at91sam9263()
89 || cpu_is_at91cap9()
90 || cpu_is_at91sam9rl() 89 || cpu_is_at91sam9rl()
91 || cpu_is_at91sam9g10() 90 || cpu_is_at91sam9g10()
92 || cpu_is_at91sam9g20() 91 || cpu_is_at91sam9g20()
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
index 0d955ffaf44e..304f2f98b680 100644
--- a/drivers/mmc/host/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -1325,7 +1325,7 @@ static int __devinit mmci_probe(struct amba_device *dev,
1325 if (ret) 1325 if (ret)
1326 goto unmap; 1326 goto unmap;
1327 1327
1328 if (dev->irq[1] == NO_IRQ) 1328 if (dev->irq[1] == NO_IRQ || !dev->irq[1])
1329 host->singleirq = true; 1329 host->singleirq = true;
1330 else { 1330 else {
1331 ret = request_irq(dev->irq[1], mmci_pio_irq, IRQF_SHARED, 1331 ret = request_irq(dev->irq[1], mmci_pio_irq, IRQF_SHARED,
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index 63b3ec48c203..cae9477a6ed3 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -253,7 +253,7 @@ static struct amba_device *of_amba_device_create(struct device_node *node,
253 if (!of_device_is_available(node)) 253 if (!of_device_is_available(node))
254 return NULL; 254 return NULL;
255 255
256 dev = kzalloc(sizeof(*dev), GFP_KERNEL); 256 dev = amba_device_alloc(NULL, 0, 0);
257 if (!dev) 257 if (!dev)
258 return NULL; 258 return NULL;
259 259
@@ -283,14 +283,14 @@ static struct amba_device *of_amba_device_create(struct device_node *node,
283 if (ret) 283 if (ret)
284 goto err_free; 284 goto err_free;
285 285
286 ret = amba_device_register(dev, &iomem_resource); 286 ret = amba_device_add(dev, &iomem_resource);
287 if (ret) 287 if (ret)
288 goto err_free; 288 goto err_free;
289 289
290 return dev; 290 return dev;
291 291
292err_free: 292err_free:
293 kfree(dev); 293 amba_device_put(dev);
294 return NULL; 294 return NULL;
295} 295}
296#else /* CONFIG_ARM_AMBA */ 296#else /* CONFIG_ARM_AMBA */
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
index 7ecb68a67411..85ae4b46bb68 100644
--- a/drivers/usb/gadget/Kconfig
+++ b/drivers/usb/gadget/Kconfig
@@ -137,7 +137,7 @@ choice
137 137
138config USB_AT91 138config USB_AT91
139 tristate "Atmel AT91 USB Device Port" 139 tristate "Atmel AT91 USB Device Port"
140 depends on ARCH_AT91 && !ARCH_AT91SAM9RL && !ARCH_AT91CAP9 && !ARCH_AT91SAM9G45 140 depends on ARCH_AT91 && !ARCH_AT91SAM9RL && !ARCH_AT91SAM9G45
141 help 141 help
142 Many Atmel AT91 processors (such as the AT91RM2000) have a 142 Many Atmel AT91 processors (such as the AT91RM2000) have a
143 full speed USB Device Port with support for five configurable 143 full speed USB Device Port with support for five configurable
@@ -150,7 +150,7 @@ config USB_AT91
150config USB_ATMEL_USBA 150config USB_ATMEL_USBA
151 tristate "Atmel USBA" 151 tristate "Atmel USBA"
152 select USB_GADGET_DUALSPEED 152 select USB_GADGET_DUALSPEED
153 depends on AVR32 || ARCH_AT91CAP9 || ARCH_AT91SAM9RL || ARCH_AT91SAM9G45 153 depends on AVR32 || ARCH_AT91SAM9RL || ARCH_AT91SAM9G45
154 help 154 help
155 USBA is the integrated high-speed USB Device controller on 155 USBA is the integrated high-speed USB Device controller on
156 the AT32AP700x, some AT91SAM9 and AT91CAP9 processors from Atmel. 156 the AT32AP700x, some AT91SAM9 and AT91CAP9 processors from Atmel.