From: Marek Vasut <marek.vasut@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 6/6] net: asix: add AX88772B support
Date: Wed, 22 Aug 2012 20:26:54 +0200 [thread overview]
Message-ID: <201208222026.54503.marex@denx.de> (raw)
In-Reply-To: <1345630147-14465-7-git-send-email-dev@lynxeye.de>
Dear Lucas Stach,
> Add AX88772B ID together with two fixes needed to make this work.
>
> 1. The packet length check has to be adjusted, as all ASIX chips
> only use 11 bits to indicate the length. AX88772B uses the other
> bits to indicate unrelated things, which cause the check to fail.
> This fix is based on a fix for the Linux kernel by Marek Vasut.
> Linux upstream commit: bca0beb9363f8487ac902931a50eb00180a2d14a
>
> 2. AX88772B provides several bulk endpoints. Only the first
> IN/OUT endpoints work in the default configuration. So stop
> enumeration after we found them to avoid overwriting the
> endpoint config with a non-working one.
>
> Signed-off-by: Lucas Stach <dev@lynxeye.de>
Reviewed-by: Marek Vasut <marex@denx.de>
Acked-by: Marek Vasut <marex@denx.de>
> ---
> drivers/usb/eth/asix.c | 30 +++++++++++++++++++-----------
> 1 Datei ge?ndert, 19 Zeilen hinzugef?gt(+), 11 Zeilen entfernt(-)
>
> diff --git a/drivers/usb/eth/asix.c b/drivers/usb/eth/asix.c
> index 6ab3e82..79246d8 100644
> --- a/drivers/usb/eth/asix.c
> +++ b/drivers/usb/eth/asix.c
> @@ -543,13 +543,13 @@ static int asix_recv(struct eth_device *eth)
> }
> memcpy(&packet_len, buf_ptr, sizeof(packet_len));
> le32_to_cpus(&packet_len);
> - if (((packet_len >> 16) ^ 0xffff) != (packet_len & 0xffff)) {
> + if (((~packet_len >> 16) & 0x7ff) != (packet_len & 0x7ff)) {
> debug("Rx: malformed packet length: %#x (%#x:%#x)\n",
> - packet_len, (packet_len >> 16) ^ 0xffff,
> - packet_len & 0xffff);
> + packet_len, (~packet_len >> 16) & 0x7ff,
> + packet_len & 0x7ff);
> return -1;
> }
> - packet_len = packet_len & 0xffff;
> + packet_len = packet_len & 0x7ff;
> if (packet_len > actual_len - sizeof(packet_len)) {
> debug("Rx: too large packet: %d\n", packet_len);
> return -1;
> @@ -597,6 +597,7 @@ static const struct asix_dongle asix_dongles[] = {
> { 0x13b1, 0x0018, FLAG_TYPE_AX88172 }, /* Linksys 200M v2.1 */
> { 0x1557, 0x7720, FLAG_TYPE_AX88772 }, /* 0Q0 cable ethernet */
> { 0x2001, 0x3c05, FLAG_TYPE_AX88772 }, /* DLink DUB-E100 H/W Ver B1
> Alternate */ + { 0x0b95, 0x772b, FLAG_TYPE_AX88772B | FLAG_EEPROM_MAC
},
> /* ASIX 88772B */ { 0x0000, 0x0000, FLAG_NONE } /* END - Do not remove
*/
> };
>
> @@ -606,6 +607,7 @@ int asix_eth_probe(struct usb_device *dev, unsigned int
> ifnum, {
> struct usb_interface *iface;
> struct usb_interface_descriptor *iface_desc;
> + int ep_in_found = 0, ep_out_found = 0;
> int i;
>
> /* let's examine the device now */
> @@ -649,13 +651,19 @@ int asix_eth_probe(struct usb_device *dev, unsigned
> int ifnum, /* is it an BULK endpoint? */
> if ((iface->ep_desc[i].bmAttributes &
> USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_BULK) {
> - if (iface->ep_desc[i].bEndpointAddress & USB_DIR_IN)
> - ss->ep_in = iface->ep_desc[i].bEndpointAddress &
> - USB_ENDPOINT_NUMBER_MASK;
> - else
> - ss->ep_out =
> - iface->ep_desc[i].bEndpointAddress &
> - USB_ENDPOINT_NUMBER_MASK;
> + if (iface->ep_desc[i].bEndpointAddress & USB_DIR_IN) {
> + if (!ep_in_found) {
> + ss->ep_in = iface-
>ep_desc[i].bEndpointAddress &
> + USB_ENDPOINT_NUMBER_MASK;
> + ep_in_found = 1;
> + }
> + } else {
> + if (!ep_out_found) {
> + ss->ep_out = iface-
>ep_desc[i].bEndpointAddress &
> + USB_ENDPOINT_NUMBER_MASK;
> + ep_out_found = 1;
> + }
> + }
> }
>
> /* is it an interrupt endpoint? */
Best regards,
Marek Vasut
next prev parent reply other threads:[~2012-08-22 18:26 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-22 10:09 [U-Boot] [PATCH 0/6] net: ASIX AX88772B enablement Lucas Stach
2012-08-22 10:09 ` [U-Boot] [PATCH 1/6] net: introduce transparent driver private in ueth_data Lucas Stach
2012-08-22 18:21 ` Marek Vasut
2012-08-22 18:49 ` Joe Hershberger
2012-08-22 10:09 ` [U-Boot] [PATCH 2/6] net: usbeth: remove misleading warning Lucas Stach
2012-08-22 18:22 ` Marek Vasut
2012-08-22 18:32 ` Lucas Stach
2012-08-22 18:46 ` Joe Hershberger
2012-08-22 10:09 ` [U-Boot] [PATCH 3/6] net: asix: split out basic reset function Lucas Stach
2012-08-22 18:23 ` Marek Vasut
2012-08-22 18:52 ` Joe Hershberger
2012-08-23 3:01 ` Mike Frysinger
2012-08-23 8:37 ` Lucas Stach
2012-08-22 10:09 ` [U-Boot] [PATCH 4/6] net: asix: add write_hwaddr function Lucas Stach
2012-08-22 18:25 ` Marek Vasut
2012-08-22 19:04 ` Joe Hershberger
2012-08-22 10:09 ` [U-Boot] [PATCH 5/6] net: asix: add read_mac function Lucas Stach
2012-08-22 18:26 ` Marek Vasut
2012-08-22 18:59 ` Joe Hershberger
2012-08-22 10:09 ` [U-Boot] [PATCH 6/6] net: asix: add AX88772B support Lucas Stach
2012-08-22 18:26 ` Marek Vasut [this message]
2012-08-22 19:01 ` Joe Hershberger
2012-08-22 18:20 ` [U-Boot] [PATCH 0/6] net: ASIX AX88772B enablement Marek Vasut
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201208222026.54503.marex@denx.de \
--to=marek.vasut@gmail.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.