gadget_chips.c 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /*
  2. * USB device controllers have lots of quirks. Use these macros in
  3. * gadget drivers or other code that needs to deal with them, and which
  4. * autoconfigures instead of using early binding to the hardware.
  5. *
  6. * This SHOULD eventually work like the ARM mach_is_*() stuff, driven by
  7. * some config file that gets updated as new hardware is supported.
  8. * (And avoiding all runtime comparisons in typical one-choice configs!)
  9. *
  10. * NOTE: some of these controller drivers may not be available yet.
  11. * Some are available on 2.4 kernels; several are available, but not
  12. * yet pushed in the 2.6 mainline tree.
  13. */
  14. #include <linux/usb/gadget.h>
  15. #include <linux/module.h>
  16. #include "gadget_chips.h"
  17. /**
  18. * usb_gadget_controller_number - support bcdDevice id convention
  19. * @gadget: the controller being driven
  20. *
  21. * Return a 2-digit BCD value associated with the peripheral controller,
  22. * suitable for use as part of a bcdDevice value, or a negative error code.
  23. *
  24. * NOTE: this convention is purely optional, and has no meaning in terms of
  25. * any USB specification. If you want to use a different convention in your
  26. * gadget driver firmware -- maybe a more formal revision ID -- feel free.
  27. *
  28. * Hosts see these bcdDevice numbers, and are allowed (but not encouraged!)
  29. * to change their behavior accordingly. For example it might help avoiding
  30. * some chip bug.
  31. */
  32. int usb_gadget_controller_number(struct usb_gadget *gadget)
  33. {
  34. if (gadget_is_net2280(gadget))
  35. return 0x01;
  36. else if (gadget_is_dummy(gadget))
  37. return 0x02;
  38. else if (gadget_is_pxa(gadget))
  39. return 0x03;
  40. else if (gadget_is_goku(gadget))
  41. return 0x06;
  42. else if (gadget_is_omap(gadget))
  43. return 0x08;
  44. else if (gadget_is_pxa27x(gadget))
  45. return 0x11;
  46. else if (gadget_is_s3c2410(gadget))
  47. return 0x12;
  48. else if (gadget_is_at91(gadget))
  49. return 0x13;
  50. else if (gadget_is_imx(gadget))
  51. return 0x14;
  52. else if (gadget_is_musbhdrc(gadget))
  53. return 0x16;
  54. else if (gadget_is_atmel_usba(gadget))
  55. return 0x18;
  56. else if (gadget_is_fsl_usb2(gadget))
  57. return 0x19;
  58. else if (gadget_is_amd5536udc(gadget))
  59. return 0x20;
  60. else if (gadget_is_m66592(gadget))
  61. return 0x21;
  62. else if (gadget_is_fsl_qe(gadget))
  63. return 0x22;
  64. else if (gadget_is_ci13xxx_pci(gadget))
  65. return 0x23;
  66. else if (gadget_is_langwell(gadget))
  67. return 0x24;
  68. else if (gadget_is_r8a66597(gadget))
  69. return 0x25;
  70. else if (gadget_is_s3c_hsotg(gadget))
  71. return 0x26;
  72. else if (gadget_is_pch(gadget))
  73. return 0x27;
  74. else if (gadget_is_ci13xxx_msm(gadget))
  75. return 0x28;
  76. else if (gadget_is_renesas_usbhs(gadget))
  77. return 0x29;
  78. else if (gadget_is_s3c_hsudc(gadget))
  79. return 0x30;
  80. else if (gadget_is_net2272(gadget))
  81. return 0x31;
  82. else if (gadget_is_dwc3(gadget))
  83. return 0x32;
  84. else if (gadget_is_lpc32xx(gadget))
  85. return 0x33;
  86. else if (gadget_is_bcm63xx(gadget))
  87. return 0x34;
  88. return -ENOENT;
  89. }
  90. EXPORT_SYMBOL_GPL(usb_gadget_controller_number);