131-arm-gemini-add-usb-device.patch 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. --- a/arch/arm/mach-gemini/devices.c
  2. +++ b/arch/arm/mach-gemini/devices.c
  3. @@ -187,3 +187,64 @@ int platform_register_ethernet(struct ge
  4. return platform_device_register(&ethernet_device);
  5. }
  6. +
  7. +static struct resource usb0_resources[] = {
  8. + {
  9. + .start = GEMINI_USB0_BASE,
  10. + .end = GEMINI_USB0_BASE + 0xfff,
  11. + .flags = IORESOURCE_MEM,
  12. + },
  13. + {
  14. + .start = IRQ_USB0,
  15. + .end = IRQ_USB0,
  16. + .flags = IORESOURCE_IRQ,
  17. + },
  18. +};
  19. +
  20. +static struct resource usb1_resources[] = {
  21. + {
  22. + .start = GEMINI_USB1_BASE,
  23. + .end = GEMINI_USB1_BASE + 0xfff,
  24. + .flags = IORESOURCE_MEM,
  25. + },
  26. + {
  27. + .start = IRQ_USB1,
  28. + .end = IRQ_USB1,
  29. + .flags = IORESOURCE_IRQ,
  30. + },
  31. +};
  32. +
  33. +static u64 usb0_dmamask = 0xffffffffUL;
  34. +static u64 usb1_dmamask = 0xffffffffUL;
  35. +
  36. +static struct platform_device usb_device[] = {
  37. + {
  38. + .name = "ehci-fotg2",
  39. + .id = 0,
  40. + .dev = {
  41. + .dma_mask = &usb0_dmamask,
  42. + .coherent_dma_mask = 0xffffffff,
  43. + },
  44. + .num_resources = ARRAY_SIZE(usb0_resources),
  45. + .resource = usb0_resources,
  46. + },
  47. + {
  48. + .name = "ehci-fotg2",
  49. + .id = 1,
  50. + .dev = {
  51. + .dma_mask = &usb1_dmamask,
  52. + .coherent_dma_mask = 0xffffffff,
  53. + },
  54. + .num_resources = ARRAY_SIZE(usb1_resources),
  55. + .resource = usb1_resources,
  56. + },
  57. +};
  58. +
  59. +int __init platform_register_usb(unsigned int id)
  60. +{
  61. + if (id > 1)
  62. + return -EINVAL;
  63. +
  64. + return platform_device_register(&usb_device[id]);
  65. +}
  66. +
  67. --- a/arch/arm/mach-gemini/common.h
  68. +++ b/arch/arm/mach-gemini/common.h
  69. @@ -30,6 +30,7 @@ extern int platform_register_pflash(unsi
  70. unsigned int nr_parts);
  71. extern int platform_register_watchdog(void);
  72. extern int platform_register_ethernet(struct gemini_gmac_platform_data *pdata);
  73. +extern int platform_register_usb(unsigned int id);
  74. extern void gemini_restart(enum reboot_mode mode, const char *cmd);