ARM: S3C24XX: Add plaform device definition for USB High-Speed gadget controller.
[pandora-kernel.git] / arch / arm / plat-s3c24xx / devs.c
index 268f3ed..7366799 100644 (file)
@@ -22,6 +22,7 @@
 #include <linux/io.h>
 #include <linux/slab.h>
 #include <linux/string.h>
+#include <linux/dma-mapping.h>
 
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
@@ -233,6 +234,46 @@ void __init s3c24xx_udc_set_platdata(struct s3c2410_udc_mach_info *pd)
        }
 }
 
+/* USB High Speed 2.0 Device (Gadget) */
+static struct resource s3c_hsudc_resource[] = {
+       [0] = {
+               .start  = S3C2416_PA_HSUDC,
+               .end    = S3C2416_PA_HSUDC + S3C2416_SZ_HSUDC - 1,
+               .flags  = IORESOURCE_MEM,
+       },
+       [1] = {
+               .start  = IRQ_USBD,
+               .end    = IRQ_USBD,
+               .flags  = IORESOURCE_IRQ,
+       }
+};
+
+static u64 s3c_hsudc_dmamask = DMA_BIT_MASK(32);
+
+struct platform_device s3c_device_usb_hsudc = {
+       .name           = "s3c-hsudc",
+       .id             = -1,
+       .num_resources  = ARRAY_SIZE(s3c_hsudc_resource),
+       .resource       = s3c_hsudc_resource,
+       .dev            = {
+               .dma_mask               = &s3c_hsudc_dmamask,
+               .coherent_dma_mask      = DMA_BIT_MASK(32),
+       },
+};
+
+void __init s3c24xx_hsudc_set_platdata(struct s3c24xx_hsudc_platdata *pd)
+{
+       struct s3c24xx_hsudc_platdata *npd;
+
+       npd = kmalloc(sizeof(*npd), GFP_KERNEL);
+       if (npd) {
+               memcpy(npd, pd, sizeof(*npd));
+               s3c_device_usb_hsudc.dev.platform_data = npd;
+       } else {
+               printk(KERN_ERR "no memory for udc platform data\n");
+       }
+}
+
 /* IIS */
 
 static struct resource s3c_iis_resource[] = {