[U-Boot-Users] [PATCH 1/1] Supplemental USB patch to previous 14 patches.

Bryan O'Donoghue bodonoghue at codehermit.ie
Tue May 30 00:47:54 CEST 2006


Greetings list.
This is a supplemental patch to the 14 patches sent on the 26/05/06. It
implements the various changes to the patch set that I had with Yuli Barcohen
yesterday.

Let me know if further changes are required.


Best Regards,
Bryan

	 Signed-off-by: Bryan O'Donoghue

        This patchset is a supplemental to the previous submitted USB patches.
        The notable change here is that as a default VendorID/ProductID
        topology U-Boot is pretending to be Linux, which should be fine, since
        in U-Boot gserial and cdc_acm are protocol compatible with Linux and
        ostensibly we should be booting to Linux anyway, as was discussed on the
	mailing list recently.

        modified: CHANGELOG
                Update to the CHANGELOG.

        modified: Makefile
                Add AdderUSB to the top-level Makefile

        modified: README
                Ammend README to fix a typo and to give updated description of
                the functioning of the USB console as it is implemented
                currently in U-Boot

        modified: drivers/usbdcore_mpc8xx.c
                Fix a funny in this file that I noticed after submission to the
                list 0xFF000000 should say CFG_IMMR.

        modified: drivers/usbtty.c
                Slight change to the preceeding patch to switch to the new way
                to define Vendor/Product ids from either BoardName.h or to hook
                the default Linux ids.

	modified: drivers/usbtty.h
		Defines for the standard Linux Vendor/Product ids have been
		added to this header. gserial and cdc_acm are protocol
		compatible with the Linux version of the same, so this change
		should be fine.

        modified: include/configs/Adder.h
                Rolls back patch 06/14 from May 26th submission, in favour of
                include/configs/AdderUSB.h

        new file: include/configs/AdderUSB.h
                Simple wrapper header to facilitate a super-set of the Adder87x
                port, switching on the USB console.

---

 CHANGELOG                  |    5 +++-
 Makefile                   |    5 +++-
 README                     |   41 ++++++++++++++++++++++-------------
 drivers/usbdcore_mpc8xx.c  |    8 +++----
 drivers/usbtty.c           |   14 +++++++++---
 drivers/usbtty.h           |   14 ++++++++++++
 include/configs/Adder.h    |   17 ---------------
 include/configs/AdderUSB.h |   51 ++++++++++++++++++++++++++++++++++++++++++++
 8 files changed, 112 insertions(+), 43 deletions(-)
 create mode 100644 include/configs/AdderUSB.h

41469d4a6ea4030c262f5d0f363d9515543c415e
diff --git a/CHANGELOG b/CHANGELOG
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -10,8 +10,9 @@ Changes since U-Boot 1.1.4:
   - Minor changes to usbdcore_omap1510.c usbdcore_omap1510.h
   - Update usbcore slightly to ease host enumeration.
   - Fix non-portable endian problems in usbdcore and usbdcore_ep0.
-  - Switch on USB device as default in Adder_config
-  Patch by Bryan O'Donoghue <bodonoghue at codehermit.ie>, 26 May 2006
+  - Add AdderUSB_config as a defconfig to enable usage of the USB console
+    by default with the Adder87x U-Boot port.
+  Patch by Bryan O'Donoghue <bodonoghue at codehermit.ie>, 29 May 2006
 
 * Update Intel IXP4xx support
   - Add IXP4xx NPE ethernet MAC support
diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -58,7 +58,7 @@ ifeq ($(HOSTARCH),ppc)
 CROSS_COMPILE =
 else
 ifeq ($(ARCH),ppc)
-CROSS_COMPILE = powerpc-linux-
+CROSS_COMPILE = ppc_8xx-
 endif
 ifeq ($(ARCH),arm)
 CROSS_COMPILE = arm-linux-
@@ -437,6 +437,9 @@ AdderII_config  \
 	@echo "#define CONFIG_MPC852T" > include/config.h)
 	@./mkconfig -a Adder ppc mpc8xx adder
 
+AdderUSB_config:	unconfig
+	@./mkconfig -a AdderUSB ppc mpc8xx adder
+
 ADS860_config     \
 FADS823_config    \
 FADS850SAR_config \
diff --git a/README b/README
--- a/README
+++ b/README
@@ -873,9 +873,10 @@ The following options need to be configu
 		Common Device Class Abstract Control Model serial device.
 		If you select usbtty = gserial you should be able to enumerate
 		a Linux host by
-		# modprobe gserial vendor=0xVendorID product=0xProductID
-		else if using cdc_acm you simply setting the environment
-		variable usbtty to be cdc_acm should suffice.
+		# modprobe usbserial vendor=0xVendorID product=0xProductID
+		else if using cdc_acm, simply setting the environment
+		variable usbtty to be cdc_acm should suffice. The following
+		might be defined in YourBoardName.h
 	
 			CONFIG_USB_DEVICE
 			Define this to build a UDC device
@@ -883,6 +884,26 @@ The following options need to be configu
 			CONFIG_USB_TTY
 			Define this to have a tty type of device available to
 			talk to the UDC device
+		
+			CFG_CONSOLE_IS_IN_ENV
+			Define this if you want stdin, stdout &/or stderr to
+			be set to usbtty.
+
+			mpc8xx:
+				CFG_USB_EXTC_CLK 0xBLAH
+				Derive USB clock from external clock "blah"
+				- CFG_USB_EXTC_CLK 0x02	
+				
+				CFG_USB_BRG_CLK 0xBLAH
+				Derive USB clock from brgclk
+				- CFG_USB_BRG_CLK 0x04
+
+		If you have a USB-IF assigned VendorID then you may wish to 
+		define your own vendor specific values either in BoardName.h
+		or directly in usbd_vendor_info.h. If you don't define 
+		CONFIG_USBD_MANUFACTURER, CONFIG_USBD_PRODUCT_NAME,
+		CONFIG_USBD_VENDORID and CONFIG_USBD_PRODUCTID, then U-Boot
+		should pretend to be a Linux device to it's target host.
 
 			CONFIG_USBD_MANUFACTURER
 			Define this string as the name of your company for
@@ -903,19 +924,7 @@ The following options need to be configu
 			for your device
 			- CONFIG_USBD_PRODUCTID 0xFFFF
 		
-			CFG_CONSOLE_IS_IN_ENV
-			Define this if you want stdin, stdout &/or stderr to
-			be set to usbtty automatically.
-
-			mpc8xx:
-				CFG_USB_EXTC_CLK 0xBLAH
-				Derive USB clock from external clock "blah"
-				- CFG_USB_EXTC_CLK 0x02	
-				
-				CFG_USB_BRG_CLK 0xBLAH
-				Derive USB clock from brgclk
-				- CFG_USB_BRG_CLK 0x04
-
+			
 - MMC Support:
 		The MMC controller on the Intel PXA is supported. To
 		enable this define CONFIG_MMC. The MMC can be
diff --git a/drivers/usbdcore_mpc8xx.c b/drivers/usbdcore_mpc8xx.c
--- a/drivers/usbdcore_mpc8xx.c
+++ b/drivers/usbdcore_mpc8xx.c
@@ -754,7 +754,7 @@ static void mpc8xx_udc_advance_rx(volati
 {
 	if((*rx_cbdp)->cbd_sc & RX_BD_W){
 		*rx_cbdp  = (volatile cbd_t*)
-			(endpoints[epid]->rbase +  0xFF000000);
+			(endpoints[epid]->rbase + CFG_IMMR);
 			
 	}else{
 		(*rx_cbdp)++;
@@ -782,7 +782,7 @@ static void mpc8xx_udc_flush_tx_fifo(int
 	usbp->uscom = 0x40 | 0;
 	
 	/* reset ring */
-	tx_cbdp = (cbd_t*)(endpoints[epid]->tbptr +  0xFF000000);
+	tx_cbdp = (cbd_t*)(endpoints[epid]->tbptr + CFG_IMMR);
 	tx_cbdp->cbd_sc = (TX_BD_I | TX_BD_W);
 
 		
@@ -887,7 +887,7 @@ static int mpc8xx_udc_ep_tx (struct usb_
 	}
 
 	ep = epi->endpoint_address & 0x03;
-	tx_cbdp = (cbd_t*)(endpoints[ep]->tbptr +  0xFF000000);
+	tx_cbdp = (cbd_t*)(endpoints[ep]->tbptr + CFG_IMMR);
 		
 	if(tx_cbdp->cbd_sc&TX_BD_R || usbp->usber&USB_E_TXB){
 		mpc8xx_udc_flush_tx_fifo(ep);
@@ -904,7 +904,7 @@ static int mpc8xx_udc_ep_tx (struct usb_
 			return -1;
 		}	
 
-		tx_cbdp = (cbd_t*)(endpoints[ep]->tbptr +  0xFF000000);
+		tx_cbdp = (cbd_t*)(endpoints[ep]->tbptr + CFG_IMMR);
 		while(tx_cbdp->cbd_sc&TX_BD_R){};
 		tx_cbdp->cbd_sc = (tx_cbdp->cbd_sc&TX_BD_W);
 	
diff --git a/drivers/usbtty.c b/drivers/usbtty.c
--- a/drivers/usbtty.c
+++ b/drivers/usbtty.c
@@ -30,15 +30,20 @@
 #include "usbtty.h"
 #include "usb_cdc_acm.h"
 #include "usbdescriptors.h"
+#include <config.h>		/* If defined, override Linux identifiers
with
+			   	 * vendor specific ones */	   
 
 #if 0
-#define TTYDBG(fmt,args...) serial_printf("[%s] %s %d: "fmt,
__FILE__,__FUNCTION__,__LINE__,##args) +#define TTYDBG(fmt,args...)\
+	serial_printf("[%s] %s %d: "fmt, __FILE__,__FUNCTION__,__LINE__,##args)
 #else
 #define TTYDBG(fmt,args...) do{}while(0)
 #endif
 
 #if 1
-#define TTYERR(fmt,args...) serial_printf("ERROR![%s] %s %d: "fmt,
__FILE__,__FUNCTION__,__LINE__,##args) +#define TTYERR(fmt,args...)\
+	serial_printf("ERROR![%s] %s %d: "fmt, __FILE__,__FUNCTION__,\
+	__LINE__,##args)
 #else
 #define TTYERR(fmt,args...) do{}while(0)
 #endif
@@ -123,7 +128,6 @@ static struct usb_device_descriptor devi
 	.bDeviceProtocol =	0x00,
 	.bMaxPacketSize0 =	EP0_MAX_PACKET_SIZE,
 	.idVendor =		cpu_to_le16(CONFIG_USBD_VENDORID),
-	.idProduct =		cpu_to_le16(CONFIG_USBD_PRODUCTID),
 	.bcdDevice =		cpu_to_le16(USBTTY_BCD_DEVICE),
 	.iManufacturer =	STR_MANUFACTURER,
 	.iProduct =		STR_PRODUCT,
@@ -742,6 +746,8 @@ static void usbtty_init_terminal_type(sh
 			/* Enumerate Device Descriptor */
 			device_descriptor.bDeviceClass = 
 				COMMUNICATIONS_DEVICE_CLASS;
+			device_descriptor.idProduct =
+				cpu_to_le16(CONFIG_USBD_PRODUCTID_CDCACM);
 
 			/* Assign endpoint indices */
 			tx_endpoint = ACM_TX_ENDPOINT;
@@ -769,6 +775,8 @@ static void usbtty_init_terminal_type(sh
 
 			/* Enumerate Device Descriptor */
 			device_descriptor.bDeviceClass = 0xFF;
+			device_descriptor.idProduct =
+				cpu_to_le16(CONFIG_USBD_PRODUCTID_GSERIAL);
 
 			/* Assign endpoint indices */
 			tx_endpoint = GSERIAL_TX_ENDPOINT;
diff --git a/drivers/usbtty.h b/drivers/usbtty.h
--- a/drivers/usbtty.h
+++ b/drivers/usbtty.h
@@ -2,6 +2,9 @@
  * (C) Copyright 2003
  * Gerry Hamel, geh at ti.com, Texas Instruments
  *
+ * (C) Copyright 2006
+ * Bryan O'Donoghue, bodonoghue at codehermit.ie, CodeHermit
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
@@ -28,6 +31,17 @@
 #include "usbdcore_omap1510.h"
 #endif
 
+#include <version_autogenerated.h>
+
+/* If no VendorID/ProductID is defined in config.h, pretend to be Linux 
+ * DO NOT Reuse this Vendor/Product setup with protocol incompatible devices */
+
+#define CONFIG_USBD_VENDORID 0x0525 	/* Linux/NetChip */
+#define CONFIG_USBD_PRODUCTID_GSERIAL 0xa4a6	/* gserial */
+#define CONFIG_USBD_PRODUCTID_CDCACM  0xa4a7	/* CDC ACM */
+#define CONFIG_USBD_MANUFACTURER "Das U-Boot"
+#define CONFIG_USBD_PRODUCT_NAME U_BOOT_VERSION
+
 
 #define CONFIG_USBD_CONFIGURATION_STR "TTY via USB"
 
diff --git a/include/configs/Adder.h b/include/configs/Adder.h
--- a/include/configs/Adder.h
+++ b/include/configs/Adder.h
@@ -5,9 +5,6 @@
  * Support for Analogue&Micro Adder boards family.
  * Tested on AdderII and Adder87x.
  *
- * Add USB console as default option.
- * Bryan O'Donoghue <bodonoghue at codehermit.ie>
- * 
  * See file CREDITS for list of people who contributed to this
  * project.
  *
@@ -41,20 +38,6 @@
 #define CONFIG_ETHER_ON_FEC1
 #define CONFIG_ETHER_ON_FEC2
 
-#if 1
-#define CONFIG_USB_DEVICE		/* Include UDC driver */
-#define CONFIG_USB_TTY			/* Bind the TTY driver to UDC */
-#define CONFIG_USBD_MANUFACTURER	"CodeHermit.ie"
-#define CONFIG_USBD_PRODUCT_NAME	"Das U-Boot"
-/* Never use the next two defines in any production system */
-#define CONFIG_USBD_VENDORID		0xFFFF /* Some mythical vendor */
-#define CONFIG_USBD_PRODUCTID		0xFFFF /* Some mythical device */
-
-#define CFG_USB_EXTC_CLK 0x02		/* Oscillator on EXTC_CLK 2 */
-#define CFG_USB_BRG_CLK	0x04		/* or use Baud rate
generator 0x04 */ -#define CFG_CONSOLE_IS_IN_ENV
-#endif
-
 #if defined(CONFIG_ETHER_ON_FEC1) || defined(CONFIG_ETHER_ON_FEC2)
 #define CFG_DISCOVER_PHY
 #define FEC_ENET
diff --git a/include/configs/AdderUSB.h b/include/configs/AdderUSB.h
new file mode 100644
--- /dev/null
+++ b/include/configs/AdderUSB.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2006 CodeHermit.
+ * Bryan O'Donoghue <bodonoghue at codehermit.ie>
+ *
+ * Provides support for USB console on the Analogue & Micro Adder87x
+ * 
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef __ADDERUSB__
+#define __ADDERUSB__
+
+/* Include the board port */
+#include "Adder.h"
+
+#define CONFIG_USB_DEVICE		/* Include UDC driver */
+#define CONFIG_USB_TTY			/* Bind the TTY driver to UDC */
+#define CFG_USB_EXTC_CLK 0x02		/* Oscillator on EXTC_CLK 2 */
+#define CFG_USB_BRG_CLK	0x04		/* or use Baud rate
generator 0x04 */ +#define CFG_CONSOLE_IS_IN_ENV		/* Console is
in env */ +
+/* If you have a USB-IF assigned VendorID then you may wish to define
+ * your own vendor specific values either in BoardName.h or directly in
+ * usbd_vendor_info.h 
+ */
+
+/* 
+#define CONFIG_USBD_MANUFACTURER	"CodeHermit.ie"
+#define CONFIG_USBD_PRODUCT_NAME	"Das U-Boot"
+#define CONFIG_USBD_VENDORID		0xFFFF 
+#define CONFIG_USBD_PRODUCTID_GSERIAL	0xFFFF
+#define CONFIG_USBD_PRODUCTID_CDCACM	0xFFFE
+*/
+
+#endif /* __ADDERUSB_H__ */





More information about the U-Boot mailing list