Skip to contentSkip to conversation

USB supplemental patch version 2.

U-Boot-Users Bryan O'Donoghue 1 participant 1 message May 31, 2006 Kbuild

lore
Share & tools
lore
#0 lore raw

Greetings all.

Here is my latest supplemental patch to patches submitted on the 26/05/06. This patch should be used in place of the previous patch sent on 30/05/06.

Wolfgang, I'm unsure if this is exactly how you'd like this to be implemented, if you have anything that needs changing, let me know what that is and I'll be glad to make those changes for you.

This patchset is generally a re-implementation of the patch sent on 30/05/06, and implements AdderUSB as a Makefile target, it appends to config.h which may need changing. Additionally this patchset implements usbd_vendor.h the usage of which should be obvious by looking at Adder.h. By default usbtty.c looks at usbtty.h for Vendor/Product ids, however BoardName.h or usbd_vendor.h can over-ride these values.

Please consider this patch along with the patches sent on 26/05/06 for inclusion in the upcoming USB git branch.

Best Regards,
Bryan

Signed-off-by Bryan O'Donoghue

This is a second revision supplemental patchset to the previous submitted USB patches by me on 26/05/06.
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_config 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/usbd_vendor.h
Makes an include file which allows over-riding of Default USB Vendor/Product identity values, from the Linux values to a specific Vendor-X value

---

 CHANGELOG                 |    5 +++--
 Makefile                  |    3 +++
 README                    |   41 +++++++++++++++++++++++---------------
 drivers/usbdcore_mpc8xx.c |    8 ++++----
 drivers/usbtty.c          |   14 ++++++++++---
 drivers/usbtty.h          |   15 ++++++++++++++
 include/configs/Adder.h   |   23 ++++++++--------------
 include/usbd_vendor.h     |   48 +++++++++++++++++++++++++++++++++++++++++++++
 8 files changed, 117 insertions(+), 40 deletions(-)
 create mode 100644 include/usbd_vendor.h

2deb21cbad7f9c1677a6c6e909bdb0bbd3a8c64f

CHANGELOG +3 -2
@@ -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 <[email protected]>, 26 May 2006
+  - Add AdderUSB_config, Adder87xUSB_config and AdderIIUSB_config as 
+    defconfig values.
+  Patch by Bryan O'Donoghue <[email protected]>, 31 May 2006
 
 * Update Intel IXP4xx support
   - Add IXP4xx NPE ethernet MAC support
Makefile +3 -0
@@ -432,9 +432,12 @@ MiniFAP_config:	unconfig
 Adder_config    \
 Adder87x_config \
 AdderII_config  \
+AdderUSB_config \
 	:		unconfig
 	$(if $(findstring AdderII,$@), \
 	@echo "#define CONFIG_MPC852T" > include/config.h)
+	$(if $(findstring USB,$@),\
+	@echo "#define CONFIG_USB_TTY" >> include/config.h)
 	@./mkconfig -a Adder ppc mpc8xx adder
 
 ADS860_config     \
README +25 -16

59 lines not on this page · raw message

drivers/usbdcore_mpc8xx.c +4 -4
@@ -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);
 	
drivers/usbtty.c +1 -0
@@ -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;

drivers/usbtty.h +15 -0
@@ -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,18 @@
 #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 */
+
+#ifndef CONFIG_USBD_VENDORID
+#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
+#endif /* CONFIG_USBD_VENDORID */
 
 #define CONFIG_USBD_CONFIGURATION_STR "TTY via USB"
 
include/configs/Adder.h +0 -3
@@ -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 <[email protected]>
- * 
  * See file CREDITS for list of people who contributed to this
  * project.
  *
@@ -38,23 +35,19 @@
 #define	CONFIG_8xx_CONS_SMC1	1		/* Console is on

SMC1 */ #define CONFIG_BAUDRATE 38400

-#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 */
+/* USB TTY */
+#ifdef CONFIG_USB_TTY

+#include <usbd_vendor.h> /* Include optional Vendor info */
#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
+#define CFG_CONSOLE_IS_IN_ENV /* Console is in env */
+
#endif

+#define CONFIG_ETHER_ON_FEC1
+#define CONFIG_ETHER_ON_FEC2
+
#if defined(CONFIG_ETHER_ON_FEC1) || defined(CONFIG_ETHER_ON_FEC2) #define CFG_DISCOVER_PHY
#define FEC_ENET

include/usbd_vendor.h new file +48 -0

48 lines not on this page · raw message