ChangeSet 1.1276.1.10, 2004/01/27 10:45:07-08:00, david-b@pacbell.net [PATCH] USB gadget: gadget build/config updates [4/7] This lets the two new drivers (goku_udc hardware, file_storage gadget) be selected and built. It now enforces the "only one type of controller hardware" configuration rule. The way it does that helped clean up some of the mess that had been accumulating in this config logic. Result: adding either controller or gadget drivers should be a lot simpler from now on. (And those existing drivers need minor build tweaks.) drivers/usb/gadget/Config.in | 69 +++++++++++++++++++++---------------------- drivers/usb/gadget/Makefile | 8 ++++ 2 files changed, 42 insertions(+), 35 deletions(-) diff -Nru a/drivers/usb/gadget/Config.in b/drivers/usb/gadget/Config.in --- a/drivers/usb/gadget/Config.in Wed Jan 28 13:36:35 2004 +++ b/drivers/usb/gadget/Config.in Wed Jan 28 13:36:35 2004 @@ -5,28 +5,31 @@ # Long term, this likely doesn't all belong in one directory # Plan to split it up eventually. # -# CAREFUL! Some versions of "xconfig" don't execute this correctly. -# mainmenu_option next_comment comment 'Support for USB gadgets' -bool 'Support for USB Gadgets' CONFIG_USB_GADGET -if [ "$CONFIG_USB_GADGET" = "y" ]; then +tristate 'Support for USB Gadgets' CONFIG_USB_GADGET +if [ "$CONFIG_USB_GADGET" = "y" -o "$CONFIG_USB_GADGET" = "m" ]; then # # really want _exactly one_ device controller driver at a time, # since they control compile options for gadget drivers. # - comment 'USB Peripheral Controller Drivers' - - # assume all the dependencies may be undefined ("== true", yeech) + choice 'USB Peripheral Controller Driver' "\ + NetChip-2280 CONFIG_USB_GADGET_NET2280 \ + Toshiba-TC86C001(Goku-S) CONFIG_USB_GADGET_GOKU \ + " NetChip-2280 + define_tristate CONFIG_USB_GADGET_CONTROLLER n - if [ "$CONFIG_PCI" = "y" ] ; then - tristate ' NetChip 2280 support' CONFIG_USB_NET2280 + + if [ "$CONFIG_PCI" = "y" -a "$CONFIG_USB_GADGET_NET2280" = "y" ] ; then + define_tristate CONFIG_USB_NET2280 $CONFIG_USB_GADGET define_tristate CONFIG_USB_GADGET_CONTROLLER $CONFIG_USB_NET2280 fi - - # pxa2xx_udc, goku_udc, and others also work on 2.4 ... + if [ "$CONFIG_PCI" = "y" -a "$CONFIG_USB_GADGET_GOKU" = "y" ] ; then + define_tristate CONFIG_USB_GOKU $CONFIG_USB_GADGET + define_tristate CONFIG_USB_GADGET_CONTROLLER $CONFIG_USB_GOKU + fi if [ "$CONFIG_USB_GADGET_CONTROLLER" = "y" -o "$CONFIG_USB_GADGET_CONTROLLER" = "m" ] ; then @@ -46,32 +49,30 @@ comment 'USB Gadget Drivers' dep_tristate ' Gadget Zero (DEVELOPMENT)' CONFIG_USB_ZERO $CONFIG_USB_GADGET_CONTROLLER - if [ "$CONFIG_USB_ZERO" = "y" -o "$CONFIG_USB_ZERO" = "m" ]; then - if [ "$CONFIG_USB_NET2280" = "y" -o "$CONFIG_USB_NET2280" = "m" ]; then - define_bool CONFIG_USB_ZERO_NET2280 y - else if [ "$CONFIG_USB_PXA2XX" = "y" -o "$CONFIG_USB_PXA2XX" = "m" ]; then - define_bool CONFIG_USB_ZERO_PXA2XX y - else if [ "$CONFIG_USB_GOKU" = "y" -o "$CONFIG_USB_GOKU" = "m" ]; then - define_bool CONFIG_USB_ZERO_GOKU y - fi fi fi - # ... - fi - dep_tristate ' Ethernet Gadget (EXPERIMENTAL)' CONFIG_USB_ETH $CONFIG_USB_GADGET_CONTROLLER $CONFIG_NET - if [ "$CONFIG_USB_ETH" = "y" -o "$CONFIG_USB_ETH" = "m" ]; then - if [ "$CONFIG_USB_NET2280" = "y" -o "$CONFIG_USB_NET2280" = "m" ]; then - define_bool CONFIG_USB_ETH_NET2280 y - else if [ "$CONFIG_USB_PXA2XX" = "y" -o "$CONFIG_USB_PXA2XX" = "m" ]; then - define_bool CONFIG_USB_ETH_PXA2XX y - else if [ "$CONFIG_USB_GOKU" = "y" -o "$CONFIG_USB_GOKU" = "m" ]; then - define_bool CONFIG_USB_ETH_GOKU y - fi fi fi - # ... - fi + dep_tristate ' File-backed Storage Gadget (DEVELOPMENT)' CONFIG_USB_FILE_STORAGE $CONFIG_USB_GADGET_CONTROLLER + dep_mbool ' File-backed Storage Gadget test mode' CONFIG_USB_FILE_STORAGE_TEST $CONFIG_USB_FILE_STORAGE - - # ... or other gadget drivers: printer class, hid, etc ... + # enforce the "only one statically linked gadget driver" rule + + if [ "$CONFIG_USB_ZERO" = "y" ]; then + # zero = y + define_tristate CONFIG_USB_ETH n + define_tristate CONFIG_USB_FILE_STORAGE n + fi + + if [ "$CONFIG_USB_ETH" = "y" ]; then + define_tristate CONFIG_USB_ZERO n + # eth = y + define_tristate CONFIG_USB_FILE_STORAGE n + fi + + if [ "$CONFIG_USB_FILE_STORAGE" = "y" ]; then + define_tristate CONFIG_USB_ZERO n + define_tristate CONFIG_USB_ETH n + # file_storage = y + fi fi fi endmenu diff -Nru a/drivers/usb/gadget/Makefile b/drivers/usb/gadget/Makefile --- a/drivers/usb/gadget/Makefile Wed Jan 28 13:36:35 2004 +++ b/drivers/usb/gadget/Makefile Wed Jan 28 13:36:35 2004 @@ -6,12 +6,14 @@ # for static linking O_TARGET := built-in.o -list-multi := g_zero.o g_ether.o +list-multi := g_zero.o g_ether.o g_file_storage.o obj-$(CONFIG_USB_NET2280) += net2280.o +obj-$(CONFIG_USB_GOKU) += goku_udc.o # only one of these may be statically linked ... controller-$(CONFIG_USB_NET2280) += net2280.o +controller-$(CONFIG_USB_GOKU) += goku_udc.o # ... and only one of these, too; kbuild/kconfig don't help though. g_zero-objs := zero.o usbstring.o @@ -20,6 +22,8 @@ g_ether-objs := ether.o usbstring.o obj-$(CONFIG_USB_ETH) += g_ether.o +g_file_storage-objs := file_storage.o usbstring.o +obj-$(CONFIG_USB_FILE_STORAGE) += g_file_storage.o export-objs := $(controller-y) $(controller-m) @@ -29,3 +33,5 @@ $(LD) -r -o $@ $(g_zero-objs) g_ether.o: $(g_ether-objs) $(LD) -r -o $@ $(g_ether-objs) +g_file_storage.o: $(g_file_storage-objs) + $(LD) -r -o $@ $(g_file_storage-objs)