[U-Boot-Users] USB supplemental patch version 2.

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 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@codehermit.ie, 26 May 2006 + - Add AdderUSB_config, Adder87xUSB_config and AdderIIUSB_config as + defconfig values. + Patch by Bryan O'Donoghue bodonoghue@codehermit.ie, 31 May 2006
* Update Intel IXP4xx support - Add IXP4xx NPE ethernet MAC support diff --git a/Makefile b/Makefile --- a/Makefile +++ b/Makefile @@ -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 \ 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@ti.com, Texas Instruments * + * (C) Copyright 2006 + * Bryan O'Donoghue, bodonoghue@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"
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@codehermit.ie - * * 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 diff --git a/include/usbd_vendor.h b/include/usbd_vendor.h new file mode 100644 --- /dev/null +++ b/include/usbd_vendor.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2006 CodeHermit. + * Bryan O'Donoghue bodonoghue@codehermit.ie + * + * Define any vendor specific values for USB device operation here. + * + * 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 __USBD_VENDOR__ +#define __USBD_VENDOR__ + +#define CONFIG_USB_DEVICE /* Include UDC driver */ + +/* + * Include your own Vendor specific defines here if you have been allocated a + * Vendor ID from the USB Implementors Forum. www.usb.org else DO NOT POLLUTE + * THE USB NAMESPACE ! + * + * #undef CONFIG_USBD_MANUFACTURER + * #undef CONFIG_USBD_PRODUCT_NAME + * #undef CONFIG_USBD_VENDORID + * #undef CONFIG_USBD_PRODUCTID_GSERIAL + * #undef CONFIG_USBD_PRODUCTID_CDCACM + * + * #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 /* __USBD_VENDOR__ */
participants (1)
-
Bryan O'Donoghue