[U-Boot] [PATCH 5/5] usbether: Fixed bug when using with PXA25X chips

Łukasz Dałek luk0104 at gmail.com
Fri Jul 27 19:33:16 CEST 2012


PXA25X chips don't support alternate settings so code in ether.c
disables usage of CDC.
But only code defined between DEV_CONFIG_CDC signals that network is up.
This patch is fixing this bug by addding pxa_connect_gadget() which on
pxa25x chips signals that network is up and do nothing on any other
chips.

Signed-off-by: Łukasz Dałek <luk0104 at gmail.com>
---
 drivers/usb/gadget/ether.c |   21 ++++++++++++++++++++-
 1 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
index d975fb6..964fe2e 100644
--- a/drivers/usb/gadget/ether.c
+++ b/drivers/usb/gadget/ether.c
@@ -44,7 +44,12 @@ extern struct platform_data brd;
 
 unsigned packet_received, packet_sent;
 
-#define DEV_CONFIG_CDC	1
+#ifdef CONFIG_USB_GADGET_PXA2XX
+# undef DEV_CONFIG_CDC
+# define DEV_CONFIG_SUBSET 1
+#else
+# define DEV_CONFIG_CDC	1
+#endif
 #define GFP_ATOMIC ((gfp_t) 0)
 #define GFP_KERNEL ((gfp_t) 0)
 
@@ -864,7 +869,9 @@ static struct usb_gadget_strings	stringtab = {
 
 /*============================================================================*/
 static u8 control_req[USB_BUFSIZ];
+#if defined(DEV_CONFIG_CDC) || defined(CONFIG_USB_ETH_RNDIS)
 static u8 status_req[STATUS_BYTECOUNT] __attribute__ ((aligned(4)));
+#endif
 
 
 /**
@@ -1252,6 +1259,17 @@ static void rndis_command_complete(struct usb_ep *ep, struct usb_request *req)
 
 #endif	/* RNDIS */
 
+#ifdef CONFIG_USB_GADGET_PXA2XX
+static inline void pxa_connect_gadget(void)
+{
+	debug("PXA connecting gadget...\n");
+	l_ethdev.network_started = 1;
+	printf("USB network up!\n");
+}
+#else
+static inline void pxa_connect_gadget(void) { }
+#endif
+
 /*
  * The setup() callback implements all the ep0 functionality that's not
  * handled lower down.  CDC has a number of less-common features:
@@ -1352,6 +1370,7 @@ eth_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
 		if (gadget_is_pxa(gadget)) {
 			value = eth_set_config(dev, DEV_CONFIG_VALUE,
 						GFP_ATOMIC);
+			pxa_connect_gadget();
 			goto done_set_intf;
 		}
 
-- 
1.7.3.4



More information about the U-Boot mailing list