From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 2/8] net: asix: fix operation without eeprom
Date: Wed, 8 Jul 2015 14:46:11 +0200 [thread overview]
Message-ID: <201507081446.11196.marex@denx.de> (raw)
In-Reply-To: <c3bab48d45f6b64fd5cca0b2c585fe2116deda51.1436175196.git.marcel.ziswiler@toradex.com>
On Wednesday, July 08, 2015 at 01:58:47 PM, Marcel Ziswiler wrote:
> From: Marcel Ziswiler <marcel.ziswiler@toradex.com>
>
> This patch fixes operation of our on-board AX88772B chip without EEPROM
> but with a ethaddr coming from the regular U-Boot environment. This is
> a forward port of some remaining parts initially implemented by
> Antmicro.
>
> Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Hi!
> ---
> Changes in v2:
> - run it through checkpatch.pl as suggested by Marek and Joe
> - cleanup comments and use VID/PID defines as suggested by Marek
> - dug out an AX88772 (not B) dongle again and verified operation
> - AX88772 (not B) indeed does not work with B modifications
> (e.g. VID/PID based differentiation is indeed required)
> - dug out another AX88772B dongle as well and verified operation
>
> drivers/usb/eth/asix.c | 32 +++++++++++++++++++++++++++++---
> 1 file changed, 29 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/usb/eth/asix.c b/drivers/usb/eth/asix.c
> index c8697ae..1c2c2d0 100644
> --- a/drivers/usb/eth/asix.c
> +++ b/drivers/usb/eth/asix.c
> @@ -1,6 +1,8 @@
> /*
> * Copyright (c) 2011 The Chromium OS Authors.
> *
> + * Patched for AX88772B by Antmicro Ltd <www.antmicro.com>
> + *
> * SPDX-License-Identifier: GPL-2.0+
> */
>
> @@ -64,8 +66,11 @@
> AX_MEDIUM_AC | AX_MEDIUM_RE)
>
> /* AX88772 & AX88178 RX_CTL values */
> -#define AX_RX_CTL_SO 0x0080
> -#define AX_RX_CTL_AB 0x0008
> +#define AX_RX_CTL_RH2M 0x0200 /* 32-bit aligned RX IP header */
> +#define AX_RX_CTL_RH1M 0x0100 /* Enable RX header format type 1
*/
> +#define AX_RX_CTL_SO 0x0080
> +#define AX_RX_CTL_AB 0x0008
> +#define AX_RX_HEADER_DEFAULT (AX_RX_CTL_RH1M | AX_RX_CTL_RH2M)
>
> #define AX_DEFAULT_RX_CTL \
> (AX_RX_CTL_SO | AX_RX_CTL_AB)
> @@ -92,6 +97,9 @@
> #define FLAG_TYPE_AX88772B (1U << 2)
> #define FLAG_EEPROM_MAC (1U << 3) /* initial mac address in
eeprom */
>
> +#define ASIX_USB_VENDOR_ID 0x0b95
> +#define AX88772B_USB_PRODUCT_ID 0x772b
> +
> /* local vars */
> static int curr_eth_dev; /* index for name of next device detected */
>
> @@ -426,7 +434,16 @@ static int asix_init(struct eth_device *eth, bd_t *bd)
>
> debug("** %s()\n", __func__);
>
> - if (asix_write_rx_ctl(dev, AX_DEFAULT_RX_CTL) < 0)
> + if ((dev->pusb_dev->descriptor.idVendor == ASIX_USB_VENDOR_ID) &&
> + (dev->pusb_dev->descriptor.idProduct == AX88772B_USB_PRODUCT_ID)) {
I'd introduce a variable here, like ...
u32 ctl = AX_DEFAULT_RX_CTL;
if (<test the ID here>)
ctl |= AX_RX_HEADER_DEFAULT;
asix_write....();
That might be more readable, no ? :)
> + if (asix_write_rx_ctl(dev, AX_DEFAULT_RX_CTL |
> + AX_RX_HEADER_DEFAULT) < 0)
> + goto out_err;
> + } else if (asix_write_rx_ctl(dev, AX_DEFAULT_RX_CTL) < 0) {
> + goto out_err;
> + }
> +
> + if (asix_write_hwaddr(eth) < 0)
> goto out_err;
>
> do {
> @@ -447,6 +464,10 @@ static int asix_init(struct eth_device *eth, bd_t *bd)
> goto out_err;
> }
>
> + /* Wait some more to avoid timeout on first transfer
> + (e.g. EHCI timed out on TD - token=0x8008d80) */
Comment style :)
> + udelay(25000);
mdelay(25); :)
> return 0;
> out_err:
> return -1;
> @@ -533,6 +554,11 @@ static int asix_recv(struct eth_device *eth)
> return -1;
> }
>
> + if ((dev->pusb_dev->descriptor.idVendor == ASIX_USB_VENDOR_ID)
> + && (dev->pusb_dev->descriptor.idProduct ==
> + AX88772B_USB_PRODUCT_ID))
> + buf_ptr += 2;
> +
> /* Notify net stack */
> net_process_received_packet(buf_ptr + sizeof(packet_len),
> packet_len);
next prev parent reply other threads:[~2015-07-08 12:46 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-08 11:58 [U-Boot] [PATCH v2 0/8] assortment of fixes/enhancements Marcel Ziswiler
2015-07-08 11:58 ` [U-Boot] [PATCH v2 1/8] fs/fs.c: read up to EOF when len would read past EOF Marcel Ziswiler
2015-07-08 11:58 ` [U-Boot] [PATCH v2 2/8] net: asix: fix operation without eeprom Marcel Ziswiler
2015-07-08 12:46 ` Marek Vasut [this message]
2015-07-08 11:58 ` [U-Boot] [PATCH v2 3/8] generic-board: allow showing custom board info Marcel Ziswiler
2015-07-08 14:10 ` Simon Glass
2015-07-08 11:58 ` [U-Boot] [PATCH v2 4/8] logos: add Toradex logo Marcel Ziswiler
2015-07-08 11:58 ` [U-Boot] [PATCH v2 5/8] colibri_vf: remove spurious new line Marcel Ziswiler
2015-07-08 11:58 ` [U-Boot] [PATCH v2 6/8] image-fdt.c: store returned error value Marcel Ziswiler
2015-07-08 11:58 ` [U-Boot] [PATCH v2 7/8] mtd/nand/ubi: assortment of alignment fixes Marcel Ziswiler
2015-07-08 14:10 ` Simon Glass
2015-07-08 23:25 ` Scott Wood
2015-07-09 7:47 ` Marcel Ziswiler
2015-07-09 20:32 ` Scott Wood
2015-07-08 11:58 ` [U-Boot] [PATCH v2 8/8] tftp.c: fix CONFIG_TFTP_TSIZE for small files Marcel Ziswiler
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=201507081446.11196.marex@denx.de \
--to=marex@denx.de \
--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.