ChangeSet 1.1137, 2003/09/24 11:56:01-07:00, david-b@pacbell.net

[PATCH] USB: usb gadget support for 2.4 (5/5): kbuild/kconf

This last part just adds kbuild support for the three drivers
sent in the earlier patches.  (There's no "mid-layer".)


 Makefile                     |    1 
 drivers/Makefile             |    3 +
 drivers/usb/Config.in        |    3 +
 drivers/usb/gadget/Config.in |   69 +++++++++++++++++++++++++++++++++++++++++++
 drivers/usb/gadget/Makefile  |   31 +++++++++++++++++++
 5 files changed, 106 insertions(+), 1 deletion(-)


diff -Nru a/Makefile b/Makefile
--- a/Makefile	Thu Sep 25 16:04:08 2003
+++ b/Makefile	Thu Sep 25 16:04:08 2003
@@ -181,6 +181,7 @@
 DRIVERS-$(CONFIG_HAMRADIO) += drivers/net/hamradio/hamradio.o
 DRIVERS-$(CONFIG_TC) += drivers/tc/tc.a
 DRIVERS-$(CONFIG_USB) += drivers/usb/usbdrv.o
+DRIVERS-$(CONFIG_USB_GADGET) += drivers/usb/gadget/built-in.o
 DRIVERS-y +=drivers/media/media.o
 DRIVERS-$(CONFIG_INPUT) += drivers/input/inputdrv.o
 DRIVERS-$(CONFIG_HIL) += drivers/hil/hil.o
diff -Nru a/drivers/Makefile b/drivers/Makefile
--- a/drivers/Makefile	Thu Sep 25 16:04:08 2003
+++ b/drivers/Makefile	Thu Sep 25 16:04:08 2003
@@ -8,7 +8,7 @@
 
 mod-subdirs :=	dio hil mtd sbus video macintosh usb input telephony ide \
 		message/i2o message/fusion scsi md ieee1394 pnp isdn atm \
-		fc4 net/hamradio i2c acpi bluetooth
+		fc4 net/hamradio i2c acpi bluetooth usb/gadget
 
 subdir-y :=	parport char block net sound misc media cdrom hotplug
 subdir-m :=	$(subdir-y)
@@ -28,6 +28,7 @@
 subdir-$(CONFIG_MAC)		+= macintosh
 subdir-$(CONFIG_PPC32)		+= macintosh
 subdir-$(CONFIG_USB)		+= usb
+subdir-$(CONFIG_USB_GADGET)	+= usb/gadget
 subdir-$(CONFIG_INPUT)		+= input
 subdir-$(CONFIG_PHONE)		+= telephony
 subdir-$(CONFIG_IDE)		+= ide
diff -Nru a/drivers/usb/Config.in b/drivers/usb/Config.in
--- a/drivers/usb/Config.in	Thu Sep 25 16:04:08 2003
+++ b/drivers/usb/Config.in	Thu Sep 25 16:04:08 2003
@@ -110,4 +110,7 @@
       dep_tristate '  Alcatel Speedtouch USB support' CONFIG_USB_SPEEDTOUCH $CONFIG_ATM $CONFIG_USB
    fi
 fi
+
+source drivers/usb/gadget/Config.in
+
 endmenu
diff -Nru a/drivers/usb/gadget/Config.in b/drivers/usb/gadget/Config.in
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/drivers/usb/gadget/Config.in	Thu Sep 25 16:04:08 2003
@@ -0,0 +1,69 @@
+#
+# USB device-side configuration
+# for 2.4 kbuild, drivers/usb/gadget/Config.in
+#
+# Long term, this likely doesn't all belong in one directory
+# Plan to split it up eventually.
+#
+mainmenu_option next_comment
+comment 'Support for USB gadgets'
+
+bool 'Support for USB Gadgets' CONFIG_USB_GADGET
+if [ "$CONFIG_USB_GADGET" = "y" ]; 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)
+  if [ "$CONFIG_PCI" = "y" ] ; then
+    tristate '  NetChip 2280 support' CONFIG_USB_NET2280
+    define_tristate CONFIG_USB_GADGET_CONTROLLER $CONFIG_USB_NET2280
+  fi
+
+  if [ "$CONFIG_USB_GADGET_CONTROLLER" = "y" -o "$CONFIG_USB_GADGET_CONTROLLER" = "m" ] ; then
+
+  #
+  # no reason not to enable more than one gadget driver module, but
+  # for static linking that would make no sense since the usb model
+  # has exactly one of these upstream connections and only one
+  # lowest-level driver can control it.
+  #
+  # gadget drivers are compiled to work on specific hardware, since
+  #
+  # (a) gadget driver need hardware-specific configuration, like what
+  #     endpoint names and numbers to use, maxpacket sizes, etc
+  #
+  # (b) specific hardware features like iso endpoints may be required
+  #
+  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
+      fi
+      if [ "$CONFIG_USB_PXA2XX" = "y" -o "$CONFIG_USB_PXA2XX" = "m" ]; then
+  	define_bool CONFIG_USB_ZERO_PXA2XX y
+      fi
+      # ...
+  fi
+  
+  dep_tristate '  Ethernet Gadget (EXPERIMENTAL)' CONFIG_USB_ETH $CONFIG_USB_GADGET_CONTROLLER
+  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
+      fi
+      if [ "$CONFIG_USB_PXA2XX" = "y" -o "$CONFIG_USB_PXA2XX" = "m" ]; then
+  	define_bool CONFIG_USB_ETH_PXA2XX y
+      fi
+      # ...
+  fi
+  
+  # ... or other gadget drivers:  printer class, storage, hid, etc ...
+
+  fi
+fi
+endmenu
diff -Nru a/drivers/usb/gadget/Makefile b/drivers/usb/gadget/Makefile
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/drivers/usb/gadget/Makefile	Thu Sep 25 16:04:08 2003
@@ -0,0 +1,31 @@
+#
+# Makefile for USB peripheral controller and gadget drivers
+# for kbuild 2.4
+#
+
+# for static linking
+O_TARGET	:= built-in.o
+
+list-multi			:= g_zero.o g_ether.o
+
+obj-$(CONFIG_USB_NET2280)	+= net2280.o
+
+# only one of these may be statically linked ...
+controller-$(CONFIG_USB_NET2280)	+= net2280.o
+
+# ... and only one of these, too; kbuild/kconfig don't help though.
+g_zero-objs			:= zero.o usbstring.o
+obj-$(CONFIG_USB_ZERO)		+= g_zero.o
+
+g_ether-objs			:= ether.o usbstring.o
+obj-$(CONFIG_USB_ETH)		+= g_ether.o
+
+
+export-objs :=			$(controller-y) $(controller-m)
+
+include $(TOPDIR)/Rules.make
+
+g_zero.o: $(g_zero-objs)
+	$(LD) -r -o $@ $(g_zero-objs)
+g_ether.o: $(g_ether-objs)
+	$(LD) -r -o $@ $(g_ether-objs)
