Supplemental USB patch to previous 14 patches.
PATCH 1/1 Supplemental USB patch to previous 14 patches.
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
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
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 as a defconfig to enable usage of the USB console + by default with the Adder87x U-Boot port. + Patch by Bryan O'Donoghue <[email protected]>, 29 May 2006 * Update Intel IXP4xx support - Add IXP4xx NPE ethernet MAC support
Makefile +4 -1
@@ -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 \
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 +14 -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,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"
include/configs/Adder.h +0 -14
@@ -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. *
@@ -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
include/configs/AdderUSB.h new file +35 -0
@@ -0,0 +1,51 @@ +/* +* Copyright (C) 2006 CodeHermit. +* Bryan O'Donoghue <[email protected]> +* +* 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__ */
PATCH 1/1 Supplemental USB patch to previous 14 patches.
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Bryan O'Donoghue writes:
Bryan> Greetings list. This is a supplemental patch to the 14 Bryan> patches sent on the 26/05/06. It implements the various Bryan> changes to the patch set that I had with Yuli Barcohen Bryan> yesterday.
I'm afraid it's not exactly what we discussed. Please see below.
Bryan> Let me know if further changes are required.
Bryan> diff --git a/Makefile b/Makefile Bryan> --- a/Makefile
Bryan> +++ b/Makefile
Bryan> @@ -58,7 +58,7 @@ ifeq ($(HOSTARCH),ppc) Bryan> CROSS_COMPILE = else ifeq ($(ARCH),ppc) Bryan> -CROSS_COMPILE = powerpc-linux- Bryan> +CROSS_COMPILE = ppc_8xx-
I don't think changing default compiler for ALL PowerPC targets was your intention.
Bryan> endif ifeq ($(ARCH),arm) CROSS_COMPILE = arm-linux- Bryan> @@ -437,6 +437,9 @@ AdderII_config \
Bryan> @echo "#define CONFIG_MPC852T" > include/config.h)
Bryan> @./mkconfig -a Adder ppc mpc8xx adder
Bryan> +AdderUSB_config: unconfig
Bryan> + @./mkconfig -a AdderUSB ppc mpc8xx adder Bryan> +
I didn't mean to add entirely new board target. I think a new target should be added to the existing Adder targets which would add a #define for USB console just like "#define CONFIG_MPC852T" is added for AdderII. Conditional on this #define, BoardName.h can include usbd_vendor.h which we decided to create. In the current version of your patch, it's exactly opposite: usbd_vendor.h (AdderUSB.h in our case) includes BoardName.h (Adder.h). This means that for every board wishing to support USB console you have to create another BoardNameUSB.h (which is a clone of AdderUSB.h). What's about creating CodeHermit.h containing something like this:
#define CONFIG_USB_DEVICE /* Include UDC driver */
#define CFG_USB_EXTC_CLK 0x02 /* Oscillator on EXTC_CLK 2 */
#define CFG_USB_BRG_CLK 0x04
#define CFG_CONSOLE_IS_IN_ENV
#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
and adding to Adder.h
#ifdef CONFIG_USB_TTY
#include <CodeHermit.h>
#endif
"#define CONFIG_USB_TTY" would be added by the configuration target in the Makefile. Any other board can then include CodeHermit.h unchanged. To allow IDs overwriting, you can even use the following in CodeHermit.h:
#ifndef CONFIG_USBD_VENDORID
#define CONFIG_USBD_VENDORID 0xFFFF
#endif
and so on. Hopefully we can use Linux IDs (NetChip) instead of 0xFFFF as the defaults.
Signature · 4 lines
======================================================================== Yuli Barcohen | Phone +972-9-765-1788 | Software Project Leader yuli at arabellasw.com | Fax +972-9-765-7494 | Arabella Software, Israel ========================================================================
PATCH 1/1 Supplemental USB patch to previous 14 patches.
Quoted 3 lines · On Tue, 30 May 2006 21:09:11 +0300 Yuli Barcohen <[email protected]> wrote:
Bryan> -CROSS_COMPILE = powerpc-linux-
Bryan> +CROSS_COMPILE = ppc_8xx-
Blink. How the hell did that get in there ?
Quoted 4 lines
I didn't mean to add entirely new board target. I think a new target should be added to the existing Adder targets which would add a #define for USB console just like "#define
CONFIG_MPC852T" is added for AdderII.
Actually I think that makes more sense then adding AdderUSB as the supplemental patch does. I concur, this is definitely the more generic/portable way to do this. I'll generate another supplemental patch in lieu of the previous patch, which implements the above.
Quoted 24 lines
Conditional on this #define,
BoardName.hcan includeusbd_vendor.hwhich we decided to create. In the current version of your patch, it's exactly opposite:usbd_vendor.h(AdderUSB.hin our case) includesBoardName.h(Adder.h). This means that for every board wishing to support USB console you have to create anotherBoardNameUSB.h(which is a clone ofAdderUSB.h). What's about creatingCodeHermit.hcontaining something like this:#define
CONFIG_USB_DEVICE/* Include UDC driver */
#defineCFG_USB_EXTC_CLK0x02/* Oscillator onEXTC_CLK2 */
#defineCFG_USB_BRG_CLK0x04
#defineCFG_CONSOLE_IS_IN_ENV
#defineCONFIG_USBD_MANUFACTURER"CodeHermit.ie"
#defineCONFIG_USBD_PRODUCT_NAME"Das U-Boot"
#defineCONFIG_USBD_VENDORID0xFFFF
#defineCONFIG_USBD_PRODUCTID_GSERIAL0xFFFF
#defineCONFIG_USBD_PRODUCTID_CDCACM0xFFFEadding to
Adder.h#ifdef
CONFIG_USB_TTY
#include <CodeHermit.h>
#endif
Quoted 8 lines
"#define
CONFIG_USB_TTY" would be added by the configuration target in theMakefile. Any other board can then includeCodeHermit.hunchanged. To allow IDs overwriting, you can even use the following inCodeHermit.h:#ifndef
CONFIG_USBD_VENDORID
#defineCONFIG_USBD_VENDORID0xFFFF
#endif
Right. I have a suggestion, which if it is agreeable to you and everybody else I will generate a new full supplemental patchset based upon.
1: For Adder ports, the Makefile shall be amended to optionally add CONFIG_USB_TTY to config.h as CONFIG_MPC852T is added by make AdderII_config. This will provisionally imply an appendation of USB to the config name. Hence three new values should be added to Makefile AdderUSB_config, Adder87xUSB_config and AdderIIUSB_config. - Do all these boards have USB facility ?
2: include/usbd_vendor.h shall be created. This will look almost exactly like the following.
#define CONFIG_USB_DEVICE /* Include UDC driver */
#define CFG_CONSOLE_IS_IN_ENV
/*
* 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 !
*
* #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
*/
If at a later date for argument sake, we were to implement RNDIS then the appropiate thing to do would be to add an optional CONFIG_USBD_PRODUCTID_RNDIS entry to usbd_vendor.h, with defaults for RNDIS values residing in usbrndis.h, thus maintaining the structure established with usbtty, thus far.
3: Adder.h shall be ammended with the following text in a rational place.
#ifdef CONFIG_USB_TTY
#include <usbd_vendor.h>
#define CFG_USB_EXTC_CLK 0x02 /* Oscillator on EXTC_CLK 2 */
#define CFG_USB_BRG_CLK 0x04 /* Or optionally on brgc4 */
#endif
I think CFG_USB_*BLAH* above shoudln't be in usbd_vendor.h for the case where the USB console is being compiled for a non 8xx port, say the omap1510/SX1 port, hence the two CFG options above should probably be board specific.
4:usbtty.c shall stay pretty much the same.
usbtty.h - Shall be included in usbtty.c. CONFIG_USBD_VENDORID, CONFIG_USBD_PRODUCTID_GSERIAL will default to Linux values
config.h - Shall be included subsequent to usbtty.h, thus facilitating over-riding of default VENDORID/PRODUCTID values from Linux specific values to Vendor specific values.
I think that with this in place we pretty much do all that needs to be done. If everybody else is in agreement, I can have these changes made in <= 10 minutes.
Let me know what you think.
Best Regards,
Bryan
PATCH 1/1 Supplemental USB patch to previous 14 patches.
Quoted 7 lines · In message <[email protected]> you wrote:
1: For Adder ports, the
Makefileshall be amended to optionally addCONFIG_USB_TTYtoconfig.hasCONFIG_MPC852Tis added by makeAdderII_config. This will provisionally imply an appendation of USB to the config name. Hence three new values should be added toMakefileAdderUSB_config,Adder87xUSB_configandAdderIIUSB_config. - Do all these boards have USB facility ?
Please hold on for a minute. The Makefile's purpose is to define dependencies. It is actually not the place to put code and
configuration trickery there. Yes, I know, this is already in use with other boards, but I would like to ask you to use such features only when absolutely necessary.
If you just define a new make target name this is simple and readable (just a single word in the Makefile), and can be evaluated in the board config file instead.
Best regards,
Wolfgang Denk
Signature · 4 lines
Software Engineering: Embedded and Realtime Systems, Embedded Linux Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Behind every great man, there is a woman -- urging him on. -- Harry Mudd, "I, Mudd", stardate 4513.3
PATCH 1/1 Supplemental USB patch to previous 14 patches.
On Wed, 31 May 2006 01:59:51 +0200
Wolfgang Denk <[email protected]> wrote:
Hello Wolfgang.
Quoted 5 lines
Please hold on for a minute. The Makefile's purpose is to define dependencies. It is actually not the place to put code andconfiguration trickery there. Yes, I know, this is already in use with other boards, but I would like to ask you to use such features only when absolutely necessary.
OK I'll implement this whichever way is your preference.
I had made this addition to the Makefile as at last night's conversation
Adder_config \
Adder87x_config \
AdderII_config \
+AdderUSB_config \
+Adder87xUSB_config \
+AdderIIUSB_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
with the following in Adder.h
/* 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 /* Console is in env */
#endif
Quoted 3 lines
If you just define a new make target name this is simple and readable (just a single word in the
Makefile), and can be evaluated in the board config file instead.
Hmm, I don't really understand how this would work, i.e. if the conditional include CONFIG_USB_TTY or other *doesn't* go into config.h then how does Adder.h know whether or not to include the console code?
Bryan