usb: eth: introduce Moschip MCS7830 driver
cover usb: eth: introduce Moschip MCS7830 driver
this series
- adds a new USB ethernet driver for adapters that are based on the MCS7730/7830/7832 chips
- enables the driver for those boards which previously had support for "all other" USB ethernet adapters
- updates the README.usb documentation file to list all available drivers for USB ethernet adapters
development and tests were done on a taskit stamp9g20 with Delock and Logilink adapters, running TFTP transfers of a file as large as RAM is
there are several checkpatch warnings
- about CamelCase for NetReceive() and USB related structure members, which cannot get fixed as the names are in the established API
- about a multiple assignment for the "found" flags in the USB endpoint search, which I consider acceptable
hopefully I got the Cc: list right, Marek as the USB custodian, Simon for introducing the Asix driver in the past -- unfortunately I could not determine a "network" custodian nor one outstanding usb-eth committer
Gerhard Sittig (5):
usb: net: introduce support for Moschip USB ethernet
arm: config: alpha-sort USB ethernet items for Asix and SMSC
arm: config: enable Moschip USB ethernet support for several boards
arm: config: enable USB ethernet for taskit stamp9g20
usb: doc: update README.doc to list all USB ethernet options
doc/README.usb | 13 +- drivers/usb/eth/Makefile | 1 + drivers/usb/eth/mcs7830.c | 677 ++++++++++++++++++++++++++++++++++++++++ drivers/usb/eth/usb_ether.c | 7 + include/configs/harmony.h | 3 +- include/configs/m53evk.h | 1 + include/configs/mx53loco.h | 1 + include/configs/nitrogen6x.h | 1 + include/configs/omap3_beagle.h | 3 +- include/configs/stamp9g20.h | 5 +- include/usb_ether.h | 8 + 11 files changed, 715 insertions(+), 5 deletions(-) create mode 100644 drivers/usb/eth/mcs7830.c
Signature · 1 line
1.7.10.4
PATCH 1/5 usb: net: introduce support for Moschip USB ethernet
introduce an 'mcs7830' driver for Moschip based USB ethernet adapters, which was implemented based on the U-Boot Asix driver with additional information gathered from the Moschip Linux driver
---
the driver was tested with a Logilink and a Delock product each, both of which contain an MCS7830 chip rev C, by several times transferring a file of 50MB size via TFTP (on a board with a total of 64MB RAM)
--- drivers/usb/eth/Makefile | 1 + drivers/usb/eth/mcs7830.c | 677 +++++++++++++++++++++++++++++++++++++++++++ drivers/usb/eth/usb_ether.c | 7 + include/usb_ether.h | 8 + 4 files changed, 693 insertions(+) create mode 100644 drivers/usb/eth/mcs7830.c
drivers/usb/eth/Makefile +1 -0
@@ -8,4 +8,5 @@ obj-$(CONFIG_USB_HOST_ETHER) += usb_ether.o ifdef CONFIG_USB_ETHER_ASIX obj-y += asix.o endif +obj-$(CONFIG_USB_ETHER_MCS7830) += mcs7830.o obj-$(CONFIG_USB_ETHER_SMSC95XX) += smsc95xx.o
drivers/usb/eth/mcs7830.c new file +677 -0
677 lines not on this page · raw message
drivers/usb/eth/usb_ether.c +7 -0
@@ -30,6 +30,13 @@ static const struct usb_eth_prob_dev prob_dev[] = { .get_info = asix_eth_get_info, },#endif +#ifdef CONFIG_USB_ETHER_MCS7830 + { + .before_probe = mcs7830_eth_before_probe, + .probe = mcs7830_eth_probe, + .get_info = mcs7830_eth_get_info, + }, +#endif #ifdef CONFIG_USB_ETHER_SMSC95XX { .before_probe = smsc95xx_eth_before_probe,
include/usb_ether.h +8 -0
@@ -51,6 +51,14 @@ int asix_eth_get_info(struct usb_device *dev, struct ueth_data *ss, struct eth_device *eth);#endif +#ifdef CONFIG_USB_ETHER_MCS7830 +void mcs7830_eth_before_probe (void ); +int mcs7830_eth_probe (struct usb_device *dev,unsigned int ifnum, +struct ueth_data *ss); +int mcs7830_eth_get_info (struct usb_device *dev,struct ueth_data *ss, +struct eth_device *eth); +#endif +#ifdef CONFIG_USB_ETHER_SMSC95XX void smsc95xx_eth_before_probe (void ); int smsc95xx_eth_probe(struct usb_device *dev, unsigned int ifnum,
Signature · 1 line
1.7.10.4
PATCH 1/5 usb: net: introduce support for Moschip USB ethernet
Quoted 9 lines · Gerhard Sittig
introduce an 'mcs7830' driver for Moschip based USB ethernet adapters, which was implemented based on the U-Boot Asix driver with additional information gathered from the Moschip Linux driver
Signed-off-by Gerhard Sittig <[email protected]>---
the driver was tested with a Logilink and a Delock product each, both of which contain an MCS7830 chip rev C, by several times transferring a file of 50MB size via TFTP (on a board with a total of 64MB RAM)
Did you also try tftpput ? ;-)
[...]
drivers/usb/eth/mcs7830.c line 29
Quoted 5 lines
drivers/usb/eth/mcs7830.c new file +5
-0+#define USB_CTRL_SET_TIMEOUT 5000 +#define USB_CTRL_GET_TIMEOUT 5000 +#define USB_BULK_SEND_TIMEOUT 5000 +#define USB_BULK_RECV_TIMEOUT 5000 +#define PHY_CONNECT_TIMEOUT 5000/* link status, connect timeout */
Why don't we use just one TIMEOUT for all ?
Quoted 1 line
+#define
PHY_CONNECT_TIMEOUT_RES50 /* link status, resolution in
msec */
drivers/usb/eth/mcs7830.c line 36
Quoted 6 lines
drivers/usb/eth/mcs7830.c new file +6
-0+ +#define MCS7830_RX_URB_SIZE 2048 + +#ifndef BIT +#define BIT (n) (1 << (n)) +#endif
This should probably be in include/common.h or so.
Quoted 21 lines
drivers/usb/eth/mcs7830.c new file +21
-0+/* command opcodes */ +enum { +MCS7830_WR_BREQ =0x0d , +MCS7830_RD_BREQ =0x0e , +}; + +/* register offsets, field bitmasks and default values */ +enum { +REG_MULTICAST_HASH =0x00 , +REG_PHY_DATA =0x0a , +REG_PHY_CMD1 =0x0c , +PHY_CMD1_READ =BIT (6 ), +PHY_CMD1_WRITE =BIT (5 ), +PHY_CMD1_PHYADDR =BIT (0 ), +REG_PHY_CMD2 =0x0d , +PHY_CMD2_PEND_FLAG_BIT =BIT (7 ), +PHY_CMD2_READY_FLAG_BIT =BIT (6 ), +REG_CONFIG =0x0e , +CONFIG_CFG =BIT (7 ), +CONFIG_SPEED100 =BIT (6 ), +CONFIG_FDX_ENABLE =BIT (5 ),
drivers/usb/eth/mcs7830.c line 68
Quoted 10 lines
drivers/usb/eth/mcs7830.c new file +10
-0+CONFIG_RXENABLE =BIT (4 ), +CONFIG_TXENABLE =BIT (3 ), +CONFIG_SLEEPMODE =BIT (2 ), +CONFIG_ALLMULTICAST =BIT (1 ), +CONFIG_PROMISCUOUS =BIT (0 ), +REG_ETHER_ADDR =0x0f , +REG_FRAME_DROP_COUNTER =0x15 , +REG_PAUSE_THRESHOLD =0x16 , + PAUSE_THRESHOLD_DEFAULT = 0, +};
Why don't you just use structure with padding as the rest of the U-Boot does ? Like so:
struct regs {
u8 reg1;
u8 pad1[n];
u8 reg2;
...
};
drivers/usb/eth/mcs7830.c line 78
Quoted 10 lines
drivers/usb/eth/mcs7830.c new file +10
-0+ +/* trailing status byte after RX frame */ +enum { +STAT_RX_FRAME_CORRECT =BIT (5 ), +STAT_RX_LARGE_FRAME =BIT (4 ), +STAT_RX_CRC_ERROR =BIT (3 ), +STAT_RX_ALIGNMENT_ERROR =BIT (2 ), +STAT_RX_LENGTH_ERROR =BIT (1 ), +STAT_RX_SHORT_FRAME =BIT (0 ), +};
I am not quite fond of the enum for bits, but I don't care enough either .
Quoted 18 lines
drivers/usb/eth/mcs7830.c new file +18
-0+struct mcs7830_private { +uint8_t config; +uint8_t mchash[8 ]; +}; + +/* }}} global declarations */ +/* private helper routines {{{ */ + +static int mcs7830_read_reg (struct ueth_data *dev,uint8_t idx, +uint16_t size,void *data) +{ +int len; +ALLOC_CACHE_ALIGN_BUFFER (uint8_t, buf, size); + +debug ("%s() idx=0x%04X sz=%d\n" , __func__, idx, size); + + len = usb_control_msg(dev->pusb_dev, + usb_rcvctrlpipe(dev->pusb_dev, 0),
drivers/usb/eth/mcs7830.c line 107
Quoted 10 lines
drivers/usb/eth/mcs7830.c new file +10
-0+MCS7830_RD_BREQ , +USB_DIR_IN |USB_TYPE_VENDOR |USB_RECIP_DEVICE , +0 , idx, buf, size, + USB_CTRL_GET_TIMEOUT); +if (len == size) { +memcpy (data, buf, size); +return 0 ; + } +debug ("%s() len=%d != sz=%d\n" , __func__, len, size); +return -1 ;
Use errno.h defines for return codes please.
Quoted 10 lines
drivers/usb/eth/mcs7830.c new file +10
-0+} + +static int mcs7830_write_reg (struct ueth_data *dev,uint8_t idx, +uint16_t size,void *data) +{ +int len; +ALLOC_CACHE_ALIGN_BUFFER (uint8_t, buf, size); + +debug ("%s() idx=0x%04X sz=%d\n" , __func__, idx, size); +
drivers/usb/eth/mcs7830.c line 127
Quoted 10 lines
drivers/usb/eth/mcs7830.c new file +10
-0+memcpy (buf, data, size); + len =usb_control_msg (dev->pusb_dev, +usb_sndctrlpipe (dev->pusb_dev,0 ), +MCS7830_WR_BREQ , +USB_DIR_OUT |USB_TYPE_VENDOR |USB_RECIP_DEVICE , +0 , idx, buf, size, +USB_CTRL_SET_TIMEOUT ); +if (len != size) +debug ("%s() len=%d != sz=%d\n" , __func__, len, size); +return (len == size) ?0 :-1 ;
DTTO.
Quoted 14 lines
drivers/usb/eth/mcs7830.c new file +14
-0+} + +static int mcs7830_read_phy (struct ueth_data *dev,uint8_t index) +{ +int rc; +int retry; +uint8_t cmd[2 ]; +uint16_t val; + +/* send the PHY read request */ + cmd[0 ] =PHY_CMD1_READ |PHY_CMD1_PHYADDR ; + cmd[1 ] =PHY_CMD2_PEND_FLAG_BIT | (index &0x1f ); + rc =mcs7830_write_reg (dev,REG_PHY_CMD1 ,sizeof (cmd), cmd); +if (rc <0 )
drivers/usb/eth/mcs7830.c line 151
Quoted 10 lines
drivers/usb/eth/mcs7830.c new file +10
-0+return rc; + +/* wait for the response to become available (usually < 1ms) */ + retry =10 ; + do { + rc = mcs7830_read_reg(dev, REG_PHY_CMD1, sizeof(cmd), cmd); + if (rc < 0) + return rc; + if (cmd[1] & PHY_CMD2_READY_FLAG_BIT) + break;
Hm ... if retry==1 , then the following if (!retry) test will fail ...
drivers/usb/eth/mcs7830.c line 155
Quoted 4 lines
drivers/usb/eth/mcs7830.c new file +4
-0+if (!retry) +return -EIO ; +mdelay (1 ); + }while (--retry);
... and the loop will exit here. Yet, (cmd[1] & PHY_CMD2_READY_FLAG_BIT) might still not be set . Right ?
Quoted 8 lines
drivers/usb/eth/mcs7830.c new file +8
-0+/* fetch the response data */ + rc =mcs7830_read_reg (dev,REG_PHY_DATA ,sizeof (val), &val); +if (rc <0 ) +return rc; + rc =le16_to_cpu (val); +debug ("%s(%s, %d) => 0x%04X\n" , __func__, dev->eth_dev.name, index, rc); +return rc; +}
[...]
Quoted 17 lines
drivers/usb/eth/mcs7830.c new file +17
-0+static int mcs7830_init (struct eth_device *eth,bd_t *bd) +{ +struct ueth_data *dev; +int timeout; +int have_link; + +debug ("%s()\n" , __func__); + dev = eth->priv; + + timeout =0 ; + do { + have_link = mcs7830_read_phy(dev, MII_BMSR) & BMSR_LSTATUS; + if (!have_link) { + if (!timeout) + puts("Waiting for ethernet connection ... "); + udelay(PHY_CONNECT_TIMEOUT_RES * 1000); + timeout += PHY_CONNECT_TIMEOUT_RES;
drivers/usb/eth/mcs7830.c line 456
Quoted 10 lines
drivers/usb/eth/mcs7830.c new file +10
-0+ } + }while (!have_link && timeout <PHY_CONNECT_TIMEOUT ); +if (have_link) { +if (timeout) +puts ("done.\n" ); +return 0 ; + }else { +puts ("unable to connect.\n" ); +return -1 ; + }
Uh, this code is not quite clear to me ... can you not simplify this weird loop? [...]
PATCH 1/5 usb: net: introduce support for Moschip USB ethernet
Quoted 8 lines · Marek Vasut
Quoted 3 lines · Gerhard Sittig
introduce an 'mcs7830' driver for Moschip based USB ethernet adapters, which was implemented based on the U-Boot Asix driver with additional information gathered from the Moschip Linux driver
[...]
Quoted 7 lines
drivers/usb/eth/mcs7830.c line 29
Quoted 5 lines
drivers/usb/eth/mcs7830.c new file +5
-0+#define USB_CTRL_SET_TIMEOUT 5000 +#define USB_CTRL_GET_TIMEOUT 5000 +#define USB_BULK_SEND_TIMEOUT 5000 +#define USB_BULK_RECV_TIMEOUT 5000 +#define PHY_CONNECT_TIMEOUT 5000/* link status, connect timeout */ Why don't we use just one TIMEOUT for all ?
copied from asix, might as well unify them, or at least reduce them to USB ctrl and USB bulk and PHY connect (which translates to setup/control, ethernet frames, and ethernet link status)
Quoted 10 lines
Quoted 1 line
+#define
PHY_CONNECT_TIMEOUT_RES50 /* link status, resolution inmsec */
drivers/usb/eth/mcs7830.c line 36
Quoted 6 lines
drivers/usb/eth/mcs7830.c new file +6
-0+ +#define MCS7830_RX_URB_SIZE 2048 + +#ifndef BIT +#define BIT (n) (1 << (n)) +#endif This should probably be in
include/common.hor so.
when searching, I noticed that there were several local copies and no common decl; the ifdef makes it work in the presence or absence of a common decl
will look into introducing the common.h decl for BIT()
Quoted 35 lines
Quoted 21 lines
drivers/usb/eth/mcs7830.c new file +21
-0+/* command opcodes */ +enum { +MCS7830_WR_BREQ =0x0d , +MCS7830_RD_BREQ =0x0e , +}; + +/* register offsets, field bitmasks and default values */ +enum { +REG_MULTICAST_HASH =0x00 , +REG_PHY_DATA =0x0a , +REG_PHY_CMD1 =0x0c , +PHY_CMD1_READ =BIT (6 ), +PHY_CMD1_WRITE =BIT (5 ), +PHY_CMD1_PHYADDR =BIT (0 ), +REG_PHY_CMD2 =0x0d , +PHY_CMD2_PEND_FLAG_BIT =BIT (7 ), +PHY_CMD2_READY_FLAG_BIT =BIT (6 ), +REG_CONFIG =0x0e , +CONFIG_CFG =BIT (7 ), +CONFIG_SPEED100 =BIT (6 ), +CONFIG_FDX_ENABLE =BIT (5 ),drivers/usb/eth/mcs7830.c line 68
Quoted 10 lines
drivers/usb/eth/mcs7830.c new file +10
-0+CONFIG_RXENABLE =BIT (4 ), +CONFIG_TXENABLE =BIT (3 ), +CONFIG_SLEEPMODE =BIT (2 ), +CONFIG_ALLMULTICAST =BIT (1 ), +CONFIG_PROMISCUOUS =BIT (0 ), +REG_ETHER_ADDR =0x0f , +REG_FRAME_DROP_COUNTER =0x15 , +REG_PAUSE_THRESHOLD =0x16 , + PAUSE_THRESHOLD_DEFAULT = 0, +};Why don't you just use structure with padding as the rest of the U-Boot does ? Like so:
Quoted 6 lines
struct regs {
u8 reg1;
u8 pad1[n];
u8 reg2;
...
};
does not apply here -- these are "adapter registers behind USB", very much like "PHY registers behind MII communication"; the driver won't pass addresses to I/O accessors, but will pass register numbers as parameters to USB API calls
off list I learned that using CONFIG_* names here is a BadIdea(TM), will adjust this, and may think about not using BIT() depending on other feedback
Quoted 4 lines
Quoted 4 lines
drivers/usb/eth/mcs7830.c new file +4
-0+ +/* trailing status byte after RX frame */ +enum { +STAT_RX_FRAME_CORRECT =BIT (5 ),
Quoted 8 lines
drivers/usb/eth/mcs7830.c line 78
Quoted 6 lines
drivers/usb/eth/mcs7830.c new file +6
-0+STAT_RX_LARGE_FRAME =BIT (4 ), +STAT_RX_CRC_ERROR =BIT (3 ), +STAT_RX_ALIGNMENT_ERROR =BIT (2 ), +STAT_RX_LENGTH_ERROR =BIT (1 ), + STAT_RX_SHORT_FRAME = BIT(0), +};I am not quite fond of the enum for bits, but I don't care enough either .
OK, I will leave the call sites as they are (testing "val & MASK" when checking individual bits), and prepare the decls without BIT() but with 0x20 et al or their "1 << x" equivalent, and see whether this looks better or@least more in line with existing code
Quoted 3 lines
drivers/usb/eth/mcs7830.c line 89
Quoted 3 lines
drivers/usb/eth/mcs7830.c new file +3
-0+ +static int mcs7830_read_reg (struct ueth_data *dev,uint8_t idx, +uint16_t size,void *data)
BTW this is where "register index" numerical values are passed, and get fed to the usb_control_msg() call below, no addresses involved here
Quoted 12 lines
Quoted 12 lines
drivers/usb/eth/mcs7830.c new file +12
-0+{ +int len; +ALLOC_CACHE_ALIGN_BUFFER (uint8_t, buf, size); + +debug ("%s() idx=0x%04X sz=%d\n" , __func__, idx, size); + + len =usb_control_msg (dev->pusb_dev, +usb_rcvctrlpipe (dev->pusb_dev,0 ), +MCS7830_RD_BREQ , +USB_DIR_IN |USB_TYPE_VENDOR |USB_RECIP_DEVICE , +0 , idx, buf, size, +USB_CTRL_GET_TIMEOUT );
Quoted 8 lines
drivers/usb/eth/mcs7830.c line 107
Quoted 6 lines
drivers/usb/eth/mcs7830.c new file +6
-0+if (len == size) { +memcpy (data, buf, size); +return 0 ; + } +debug ("%s() len=%d != sz=%d\n" , __func__, len, size); +return -1 ;Use
errno.hdefines for return codes please.
this was copied from asix, will see which errno code is most appropriate (here and elsewhere)
Quoted 25 lines
Quoted 12 lines
drivers/usb/eth/mcs7830.c new file +12
-0+static int mcs7830_read_phy (struct ueth_data *dev,uint8_t index) +{ +int rc; +int retry; +uint8_t cmd[2 ]; +uint16_t val; + +/* send the PHY read request */ + cmd[0 ] =PHY_CMD1_READ |PHY_CMD1_PHYADDR ; + cmd[1 ] =PHY_CMD2_PEND_FLAG_BIT | (index &0x1f ); + rc =mcs7830_write_reg (dev,REG_PHY_CMD1 ,sizeof (cmd), cmd); +if (rc <0 )drivers/usb/eth/mcs7830.c line 151
Quoted 10 lines
drivers/usb/eth/mcs7830.c new file +10
-0+return rc; + +/* wait for the response to become available (usually < 1ms) */ + retry =10 ; + do { + rc = mcs7830_read_reg(dev, REG_PHY_CMD1, sizeof(cmd), cmd); + if (rc < 0) + return rc; + if (cmd[1] & PHY_CMD2_READY_FLAG_BIT) + break;Hm ... if retry==1 , then the following if (!retry) test will fail ...
Quoted 7 lines
drivers/usb/eth/mcs7830.c line 155
Quoted 4 lines
drivers/usb/eth/mcs7830.c new file +4
-0+if (!retry) +return -EIO ; +mdelay (1 ); + }while (--retry);... and the loop will exit here. Yet, (cmd[1] &
PHY_CMD2_READY_FLAG_BIT) might still not be set . Right ?
I knew I missed something :) The intent was to iterate 11 times, and thus to retry exactly 10 times after the initial attempt. "retry--" should fix this, and should result in 11 attempts with 10 delays between them. I.e. no early termination, and no useless delay in the last iteration.
Quoted 22 lines
Quoted 22 lines
drivers/usb/eth/mcs7830.c new file +22
-0+static int mcs7830_init (struct eth_device *eth,bd_t *bd) +{ +struct ueth_data *dev; +int timeout; +int have_link; + +debug ("%s()\n" , __func__); + dev = eth->priv; + + timeout =0 ; +do { + have_link =mcs7830_read_phy (dev,MII_BMSR ) &BMSR_LSTATUS ; +if (!have_link) { +if (!timeout) +puts ("Waiting for ethernet connection ... " ); +udelay (PHY_CONNECT_TIMEOUT_RES *1000 ); + timeout +=PHY_CONNECT_TIMEOUT_RES ; + } + }while (!have_link && timeout <PHY_CONNECT_TIMEOUT ); +if (have_link) { +if (timeout) +puts ("done.\n" );
Quoted 8 lines
drivers/usb/eth/mcs7830.c line 456
Quoted 5 lines
drivers/usb/eth/mcs7830.c new file +5
-0+return 0 ; + }else { +puts ("unable to connect.\n" ); +return -1 ; + }Uh, this code is not quite clear to me ... can you not simplify this weird loop? [...]
again, this was copied from asix; its core is checking for the ethernet link status, what makes it look so weird is the "nice" user presentation of whether the link already was established or needed to get established first -- will see how I can rephrase it
thank you for reviewing!
virtually yours
Gerhard Sittig
Signature · 3 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr. 5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
PATCH 1/5 usb: net: introduce support for Moschip USB ethernet
On Monday, February 17, 2014 at 10:40:41 AM, Gerhard Sittig wrote:
[...]
Quoted 9 lines
Quoted 9 lines
Why don't you just use structure with padding as the rest of the U-Boot does ? Like so:
struct regs {
u8 reg1;
u8 pad1[n];
u8 reg2;
Quoted 7 lines
Quoted 2 lines
...
};does not apply here -- these are "adapter registers behind USB", very much like "PHY registers behind MII communication"; the driver won't pass addresses to I/O accessors, but will pass register numbers as parameters to USB API calls
You'd be passing offset of the register in the structure, right ?
[...]
Quoted 9 lines
Quoted 2 lines
Uh, this code is not quite clear to me ... can you not simplify this weird loop? [...]
again, this was copied from asix; its core is checking for the ethernet link status, what makes it look so weird is the "nice" user presentation of whether the link already was established or needed to get established first -- will see how I can rephrase it
thank you for reviewing!
Thanks
Best regards,
Marek Vasut
PATCH 2/5 arm: config: alpha-sort USB ethernet items for Asix and SMSC
In reply to Gerhard Sittigadjust the harmony and omap3_beagle board configs to make their CONFIG_USB_ETHER_* items appear in alphabetical order
--- include/configs/harmony.h | 2 +- include/configs/omap3_beagle.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
include/configs/harmony.h +1 -1
@@ -61,8 +61,8 @@/* USB networking support */ #define CONFIG_USB_HOST_ETHER -#define CONFIG_USB_ETHER_SMSC95XX #define CONFIG_USB_ETHER_ASIX +#define CONFIG_USB_ETHER_SMSC95XX /* General networking support */ #define CONFIG_CMD_NET
include/configs/omap3_beagle.h +1 -1
@@ -120,8 +120,8 @@#define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS 3#define CONFIG_USB_HOST_ETHER -#define CONFIG_USB_ETHER_SMSC95XX #define CONFIG_USB_ETHER_ASIX +#define CONFIG_USB_ETHER_SMSC95XX /* GPIO banks */ #define CONFIG_OMAP3_GPIO_5 /* GPIO128..159 is in GPIO bank 5 */
Signature · 1 line
1.7.10.4
PATCH 2/5 arm: config: alpha-sort USB ethernet items for Asix and SMSC
Quoted 4 lines · Gerhard Sittig
adjust the harmony and
omap3_beagleboard configs to make their CONFIG_USB_ETHER_* items appear in alphabetical orderSigned-off-by Gerhard Sittig <[email protected]>
PATCH 3/5 arm: config: enable Moschip USB ethernet support for several boards
In reply to Gerhard Sittigenable support for the Moschip USB ethernet adapter for those boards which previously had support for "all other" USB ethernet adapters (that's Asix _and_ SMSC) enabled -- which applies to harmony, m53evk, mx53loco, nitrogen6x, omap3_beagle
--- include/configs/harmony.h | 1 + include/configs/m53evk.h | 1 + include/configs/mx53loco.h | 1 + include/configs/nitrogen6x.h | 1 + include/configs/omap3_beagle.h | 1 + 5 files changed, 5 insertions(+)
include/configs/harmony.h +1 -0
@@ -62,6 +62,7 @@/* USB networking support */ #define CONFIG_USB_HOST_ETHER #define CONFIG_USB_ETHER_ASIX +#define CONFIG_USB_ETHER_MCS7830 #define CONFIG_USB_ETHER_SMSC95XX /* General networking support */
include/configs/m53evk.h +1 -0
@@ -183,6 +183,7 @@#define CONFIG_USB_STORAGE #define CONFIG_USB_HOST_ETHER #define CONFIG_USB_ETHER_ASIX +#define CONFIG_USB_ETHER_MCS7830 #define CONFIG_USB_ETHER_SMSC95XX #define CONFIG_MXC_USB_PORT 1#define CONFIG_MXC_USB_PORTSC (PORT_PTS_UTMI | PORT_PTS_PTW)
include/configs/mx53loco.h +1 -0
@@ -65,6 +65,7 @@#define CONFIG_USB_STORAGE #define CONFIG_USB_HOST_ETHER #define CONFIG_USB_ETHER_ASIX +#define CONFIG_USB_ETHER_MCS7830 #define CONFIG_USB_ETHER_SMSC95XX #define CONFIG_MXC_USB_PORT 1#define CONFIG_MXC_USB_PORTSC (PORT_PTS_UTMI | PORT_PTS_PTW)
include/configs/nitrogen6x.h +1 -0
@@ -115,6 +115,7 @@#define CONFIG_USB_STORAGE #define CONFIG_USB_HOST_ETHER #define CONFIG_USB_ETHER_ASIX +#define CONFIG_USB_ETHER_MCS7830 #define CONFIG_USB_ETHER_SMSC95XX #define CONFIG_USB_MAX_CONTROLLER_COUNT 2#define CONFIG_EHCI_HCD_INIT_AFTER_RESET /* For OTG port */
include/configs/omap3_beagle.h +1 -0
@@ -121,6 +121,7 @@#define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS 3#define CONFIG_USB_HOST_ETHER #define CONFIG_USB_ETHER_ASIX +#define CONFIG_USB_ETHER_MCS7830 #define CONFIG_USB_ETHER_SMSC95XX /* GPIO banks */
Signature · 1 line
1.7.10.4
PATCH 4/5 arm: config: enable USB ethernet for taskit stamp9g20
In reply to Gerhard Sittigenabling CONFIG_MACB makes other locations in the stamp config file enable network related commands (actually prevents disabling them)
enable USB ethernet support by activating generic support as well as Asix and Moschip ethernet adapters
--- include/configs/stamp9g20.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
include/configs/stamp9g20.h +4 -1
@@ -140,7 +140,10 @@* can enable it here if your baseboard features ethernet. */ -/* #define CONFIG_MACB */ +#define CONFIG_MACB +#define CONFIG_USB_HOST_ETHER +#define CONFIG_USB_ETHER_ASIX +#define CONFIG_USB_ETHER_MCS7830 #ifdef CONFIG_MACB # define CONFIG_RMII /* use reduced MII inteface */
Signature · 1 line
1.7.10.4
PATCH 5/5 usb: doc: update README.doc to list all USB ethernet options
In reply to Gerhard Sittig- extend the discussion of USB network related config options such that all available adapter drivers are listed, and that the 'usb' command for the interactive prompt and scripting becomes available
- suggest to *not* put individual IP configuration parameters into the exectuable, but instead to put them into external environment or fetch them from network
--- doc/README.usb | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
doc/README.usb +11 -2
@@ -127,8 +127,14 @@ To enable USB Host Ethernet in U-Boot, your platform must of course support USB with CONFIG_CMD_USB enabled and working. You will need to add some config settings to your board header file: +#define CONFIG_CMD_USB /* the 'usb' interactive command */ #define CONFIG_USB_HOST_ETHER /* Enable USB Ethernet adapters */ -#define CONFIG_USB_ETHER_ASIX /* Asix, or whatever driver(s) you want */ + +and one or more of the following for individual adapter hardware: + +#define CONFIG_USB_ETHER_ASIX +#define CONFIG_USB_ETHER_MCS7830 +#define CONFIG_USB_ETHER_SMSC95XX As with built-in networking, you will also want to enable some network commands, for example:
@@ -148,7 +154,10 @@ settings should start you off: You can also set the default IP address of your board and the server as well as the default file to load when a 'bootp' command is issued. -All of these can be obtained from the bootp server if not set. +However note that encoding these individual network settings into a +common exectuable is discouraged, as it leads to potential conflicts, +and all the parameters can either get stored in the board's external +environment, or get obtained from the bootp server if not set. #define CONFIG_IPADDR 10.0.0.2 (replace with your value) #define CONFIG_SERVERIP 10.0.0.1 (replace with your value)
Signature · 1 line
1.7.10.4
PATCH 5/5 usb: doc: update README.doc to list all USB ethernet options
Quoted 8 lines · Gerhard Sittig
- extend the discussion of USB network related config options such that all available adapter drivers are listed, and that the 'usb' command for the interactive prompt and scripting becomes available
- suggest to *not* put individual IP configuration parameters into the exectuable, but instead to put them into external environment or fetch them from networkSigned-off-by Gerhard Sittig <[email protected]>
cover usb: eth: introduce Moschip MCS7830 driver
In reply to Gerhard SittigQuoted 17 lines · Gerhard Sittig
this series
- adds a new USB ethernet driver for adapters that are based on the MCS7730/7830/7832 chips
- enables the driver for those boards which previously had support for "all other" USB ethernet adapters
- updates the README.usb documentation file to list all available drivers for USB ethernet adaptersdevelopment and tests were done on a taskit stamp9g20 with Delock and Logilink adapters, running TFTP transfers of a file as large as RAM is
there are several checkpatch warnings
- about CamelCase forNetReceive()and USB related structure members, which cannot get fixed as the names are in the established API
- about a multiple assignment for the "found" flags in the USB endpoint search, which I consider acceptable
Quoted 3 lines
hopefully I got the Cc: list right, Marek as the USB custodian, Simon for introducing the Asix driver in the past -- unfortunately I could not determine a "network" custodian nor one outstanding usb-eth committer
CCing Joe, see [1] ;-)
[1] http://www.denx.de/wiki/U-Boot/Custodians
Best regards,
Marek Vasut
cover usb: eth: introduce Moschip MCS7830 driver
Quoted 11 lines · Marek Vasut
Quoted 5 lines · Gerhard Sittig
[ ... ]
hopefully I got the Cc: list right, Marek as the USB custodian, Simon for introducing the Asix driver in the past -- unfortunately I could not determine a "network" custodian nor one outstanding usb-eth committer
CCing Joe, see [1] ;-)
Thank you! I hope Joe took no offense here. :) And I will grab board maintainership info from boards.cfg in v2 for the config changes.
virtually yours
Gerhard Sittig
Signature · 3 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr. 5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de