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.
6 * This could 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 the runtime comparisons in typical one-choice cases.)
10 * NOTE: some of these controller drivers may not be available yet.
12 #ifdef CONFIG_USB_GADGET_NET2280
13 #define gadget_is_net2280(g) !strcmp("net2280", (g)->name)
15 #define gadget_is_net2280(g) 0
18 #ifdef CONFIG_USB_GADGET_DUMMY_HCD
19 #define gadget_is_dummy(g) !strcmp("dummy_udc", (g)->name)
21 #define gadget_is_dummy(g) 0
24 #ifdef CONFIG_USB_GADGET_PXA2XX
25 #define gadget_is_pxa(g) !strcmp("pxa2xx_udc", (g)->name)
27 #define gadget_is_pxa(g) 0
30 #ifdef CONFIG_USB_GADGET_GOKU
31 #define gadget_is_goku(g) !strcmp("goku_udc", (g)->name)
33 #define gadget_is_goku(g) 0
36 #ifdef CONFIG_USB_GADGET_SUPERH
37 #define gadget_is_sh(g) !strcmp("sh_udc", (g)->name)
39 #define gadget_is_sh(g) 0
42 #ifdef CONFIG_USB_GADGET_SA1100
43 #define gadget_is_sa1100(g) !strcmp("sa1100_udc", (g)->name)
45 #define gadget_is_sa1100(g) 0
48 #ifdef CONFIG_USB_GADGET_LH7A40X
49 #define gadget_is_lh7a40x(g) !strcmp("lh7a40x_udc", (g)->name)
51 #define gadget_is_lh7a40x(g) 0
54 #ifdef CONFIG_USB_GADGET_MQ11XX
55 #define gadget_is_mq11xx(g) !strcmp("mq11xx_udc", (g)->name)
57 #define gadget_is_mq11xx(g) 0
60 #ifdef CONFIG_USB_GADGET_OMAP
61 #define gadget_is_omap(g) !strcmp("omap_udc", (g)->name)
63 #define gadget_is_omap(g) 0
66 #ifdef CONFIG_USB_GADGET_N9604
67 #define gadget_is_n9604(g) !strcmp("n9604_udc", (g)->name)
69 #define gadget_is_n9604(g) 0
72 #ifdef CONFIG_USB_GADGET_PXA27X
73 #define gadget_is_pxa27x(g) !strcmp("pxa27x_udc", (g)->name)
75 #define gadget_is_pxa27x(g) 0
78 #ifdef CONFIG_USB_GADGET_S3C2410
79 #define gadget_is_s3c2410(g) !strcmp("s3c2410_udc", (g)->name)
81 #define gadget_is_s3c2410(g) 0
84 #ifdef CONFIG_USB_GADGET_AT91
85 #define gadget_is_at91(g) !strcmp("at91_udc", (g)->name)
87 #define gadget_is_at91(g) 0
90 #ifdef CONFIG_USB_GADGET_IMX
91 #define gadget_is_imx(g) !strcmp("imx_udc", (g)->name)
93 #define gadget_is_imx(g) 0
96 // CONFIG_USB_GADGET_SX2
97 // CONFIG_USB_GADGET_AU1X00
102 * usb_gadget_controller_number - support bcdDevice id convention
103 * @gadget: the controller being driven
105 * Return a 2-digit BCD value associated with the peripheral controller,
106 * suitable for use as part of a bcdDevice value, or a negative error code.
108 * NOTE: this convention is purely optional, and has no meaning in terms of
109 * any USB specification. If you want to use a different convention in your
110 * gadget driver firmware -- maybe a more formal revision ID -- feel free.
112 * Hosts see these bcdDevice numbers, and are allowed (but not encouraged!)
113 * to change their behavior accordingly. For example it might help avoiding
116 static inline int usb_gadget_controller_number(struct usb_gadget
*gadget
)
118 if (gadget_is_net2280(gadget
))
120 else if (gadget_is_dummy(gadget
))
122 else if (gadget_is_pxa(gadget
))
124 else if (gadget_is_sh(gadget
))
126 else if (gadget_is_sa1100(gadget
))
128 else if (gadget_is_goku(gadget
))
130 else if (gadget_is_mq11xx(gadget
))
132 else if (gadget_is_omap(gadget
))
134 else if (gadget_is_lh7a40x(gadget
))
136 else if (gadget_is_n9604(gadget
))
138 else if (gadget_is_pxa27x(gadget
))
140 else if (gadget_is_s3c2410(gadget
))
142 else if (gadget_is_at91(gadget
))
144 else if (gadget_is_imx(gadget
))