usb.c 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*
  2. * Copyright 2012 Tilera Corporation. All Rights Reserved.
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * as published by the Free Software Foundation, version 2.
  7. *
  8. * This program is distributed in the hope that it will be useful, but
  9. * WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  11. * NON INFRINGEMENT. See the GNU General Public License for
  12. * more details.
  13. *
  14. * Register the Tile-Gx USB interfaces as platform devices.
  15. *
  16. * The actual USB driver is just some glue (in
  17. * drivers/usb/host/[eo]hci-tilegx.c) which makes the registers available
  18. * to the standard kernel EHCI and OHCI drivers.
  19. */
  20. #include <linux/dma-mapping.h>
  21. #include <linux/platform_device.h>
  22. #include <linux/usb/tilegx.h>
  23. #include <linux/init.h>
  24. #include <linux/module.h>
  25. #include <linux/types.h>
  26. static u64 ehci_dmamask = DMA_BIT_MASK(32);
  27. #define USB_HOST_DEF(unit, type, dmamask) \
  28. static struct \
  29. tilegx_usb_platform_data tilegx_usb_platform_data_ ## type ## \
  30. hci ## unit = { \
  31. .dev_index = unit, \
  32. }; \
  33. \
  34. static struct platform_device tilegx_usb_ ## type ## hci ## unit = { \
  35. .name = "tilegx-" #type "hci", \
  36. .id = unit, \
  37. .dev = { \
  38. .dma_mask = dmamask, \
  39. .coherent_dma_mask = DMA_BIT_MASK(32), \
  40. .platform_data = \
  41. &tilegx_usb_platform_data_ ## type ## hci ## \
  42. unit, \
  43. }, \
  44. };
  45. USB_HOST_DEF(0, e, &ehci_dmamask)
  46. USB_HOST_DEF(0, o, NULL)
  47. USB_HOST_DEF(1, e, &ehci_dmamask)
  48. USB_HOST_DEF(1, o, NULL)
  49. #undef USB_HOST_DEF
  50. static struct platform_device *tilegx_usb_devices[] __initdata = {
  51. &tilegx_usb_ehci0,
  52. &tilegx_usb_ehci1,
  53. &tilegx_usb_ohci0,
  54. &tilegx_usb_ohci1,
  55. };
  56. /** Add our set of possible USB devices. */
  57. static int __init tilegx_usb_init(void)
  58. {
  59. platform_add_devices(tilegx_usb_devices,
  60. ARRAY_SIZE(tilegx_usb_devices));
  61. return 0;
  62. }
  63. arch_initcall(tilegx_usb_init);