0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #include <linux/init.h>
0012 #include <linux/kernel.h>
0013 #include <linux/platform_device.h>
0014 #include <linux/dma-mapping.h>
0015 #include <bcm63xx_cpu.h>
0016 #include <bcm63xx_dev_usb_usbd.h>
0017
0018 #define NUM_MMIO 2
0019 #define NUM_IRQ 7
0020
0021 static struct resource usbd_resources[NUM_MMIO + NUM_IRQ];
0022
0023 static u64 usbd_dmamask = DMA_BIT_MASK(32);
0024
0025 static struct platform_device bcm63xx_usbd_device = {
0026 .name = "bcm63xx_udc",
0027 .id = -1,
0028 .num_resources = ARRAY_SIZE(usbd_resources),
0029 .resource = usbd_resources,
0030 .dev = {
0031 .dma_mask = &usbd_dmamask,
0032 .coherent_dma_mask = DMA_BIT_MASK(32),
0033 },
0034 };
0035
0036 int __init bcm63xx_usbd_register(const struct bcm63xx_usbd_platform_data *pd)
0037 {
0038 const int irq_list[NUM_IRQ] = { IRQ_USBD,
0039 IRQ_USBD_RXDMA0, IRQ_USBD_TXDMA0,
0040 IRQ_USBD_RXDMA1, IRQ_USBD_TXDMA1,
0041 IRQ_USBD_RXDMA2, IRQ_USBD_TXDMA2 };
0042 int i;
0043
0044 if (!BCMCPU_IS_6328() && !BCMCPU_IS_6368())
0045 return 0;
0046
0047 usbd_resources[0].start = bcm63xx_regset_address(RSET_USBD);
0048 usbd_resources[0].end = usbd_resources[0].start + RSET_USBD_SIZE - 1;
0049 usbd_resources[0].flags = IORESOURCE_MEM;
0050
0051 usbd_resources[1].start = bcm63xx_regset_address(RSET_USBDMA);
0052 usbd_resources[1].end = usbd_resources[1].start + RSET_USBDMA_SIZE - 1;
0053 usbd_resources[1].flags = IORESOURCE_MEM;
0054
0055 for (i = 0; i < NUM_IRQ; i++) {
0056 struct resource *r = &usbd_resources[NUM_MMIO + i];
0057
0058 r->start = r->end = bcm63xx_get_irq_number(irq_list[i]);
0059 r->flags = IORESOURCE_IRQ;
0060 }
0061
0062 platform_device_add_data(&bcm63xx_usbd_device, pd, sizeof(*pd));
0063
0064 return platform_device_register(&bcm63xx_usbd_device);
0065 }