* [U-Boot] [PATCH] usb: asix: Move software resets to basic_init
@ 2013-05-11 20:35 Simon Glass
2013-05-13 15:14 ` Marek Vasut
0 siblings, 1 reply; 4+ messages in thread
From: Simon Glass @ 2013-05-11 20:35 UTC (permalink / raw)
To: u-boot
From: Julius Werner <jwerner@chromium.org>
The ASIX driver calls a basic_init() function during get_info(), so that
not all initialization tasks need to be redone on every init().
Unfortunately, the most important one is still triggered too often: the
driver does a full port and MII reset on every asix_init(), requiring up
to several seconds to reestablish the link.
This patch confines that software reset into the asix_basic_init()
function so that it will only be executed once. This saves about a
second of boot time on systems using BOOTP.
Note: this patch was previously submitted many moons ago as:
usb: usbeth: asix: Do a fast init if link already established
That patch seens to have been lost or forgotten, so this is a rebased
version. It is tested on snow with a Asix USB dongle (Cisco).
Signed-off-by: Julius Werner <jwerner@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
---
drivers/usb/eth/asix.c | 40 +++++++++++++++++-----------------------
1 file changed, 17 insertions(+), 23 deletions(-)
diff --git a/drivers/usb/eth/asix.c b/drivers/usb/eth/asix.c
index 75ec8f7..76624b9 100644
--- a/drivers/usb/eth/asix.c
+++ b/drivers/usb/eth/asix.c
@@ -407,46 +407,40 @@ static int asix_basic_reset(struct ueth_data *dev)
rx_ctl = asix_read_rx_ctl(dev);
debug("RX_CTL is 0x%04x setting to 0x0000\n", rx_ctl);
- return 0;
-}
-
-/*
- * Asix callbacks
- */
-static int asix_init(struct eth_device *eth, bd_t *bd)
-{
- struct ueth_data *dev = (struct ueth_data *)eth->priv;
- int timeout = 0;
-#define TIMEOUT_RESOLUTION 50 /* ms */
- int link_detected;
-
- debug("** %s()\n", __func__);
-
dev->phy_id = asix_get_phy_addr(dev);
if (dev->phy_id < 0)
debug("Failed to read phy id\n");
- if (asix_sw_reset(dev, AX_SWRESET_PRL) < 0)
- goto out_err;
-
- if (asix_sw_reset(dev, AX_SWRESET_IPRL | AX_SWRESET_PRL) < 0)
- goto out_err;
-
asix_mdio_write(dev, dev->phy_id, MII_BMCR, BMCR_RESET);
asix_mdio_write(dev, dev->phy_id, MII_ADVERTISE,
ADVERTISE_ALL | ADVERTISE_CSMA);
mii_nway_restart(dev);
if (asix_write_medium_mode(dev, AX88772_MEDIUM_DEFAULT) < 0)
- goto out_err;
+ return -1;
if (asix_write_cmd(dev, AX_CMD_WRITE_IPG0,
AX88772_IPG0_DEFAULT | AX88772_IPG1_DEFAULT,
AX88772_IPG2_DEFAULT, 0, NULL) < 0) {
debug("Write IPG,IPG1,IPG2 failed\n");
- goto out_err;
+ return -1;
}
+ return 0;
+}
+
+/*
+ * Asix callbacks
+ */
+static int asix_init(struct eth_device *eth, bd_t *bd)
+{
+ struct ueth_data *dev = (struct ueth_data *)eth->priv;
+ int timeout = 0;
+#define TIMEOUT_RESOLUTION 50 /* ms */
+ int link_detected;
+
+ debug("** %s()\n", __func__);
+
if (asix_write_rx_ctl(dev, AX_DEFAULT_RX_CTL) < 0)
goto out_err;
--
1.8.2.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH] usb: asix: Move software resets to basic_init
2013-05-11 20:35 [U-Boot] [PATCH] usb: asix: Move software resets to basic_init Simon Glass
@ 2013-05-13 15:14 ` Marek Vasut
2013-05-13 21:30 ` Joe Hershberger
0 siblings, 1 reply; 4+ messages in thread
From: Marek Vasut @ 2013-05-13 15:14 UTC (permalink / raw)
To: u-boot
Dear Simon Glass,
> From: Julius Werner <jwerner@chromium.org>
>
> The ASIX driver calls a basic_init() function during get_info(), so that
> not all initialization tasks need to be redone on every init().
> Unfortunately, the most important one is still triggered too often: the
> driver does a full port and MII reset on every asix_init(), requiring up
> to several seconds to reestablish the link.
>
> This patch confines that software reset into the asix_basic_init()
> function so that it will only be executed once. This saves about a
> second of boot time on systems using BOOTP.
>
> Note: this patch was previously submitted many moons ago as:
>
> usb: usbeth: asix: Do a fast init if link already established
>
> That patch seens to have been lost or forgotten, so this is a rebased
> version. It is tested on snow with a Asix USB dongle (Cisco).
>
> Signed-off-by: Julius Werner <jwerner@chromium.org>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
I'll pick it, but I wonder why Joe didn't ...
Best regards,
Marek Vasut
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH] usb: asix: Move software resets to basic_init
2013-05-13 15:14 ` Marek Vasut
@ 2013-05-13 21:30 ` Joe Hershberger
2013-05-13 22:10 ` Marek Vasut
0 siblings, 1 reply; 4+ messages in thread
From: Joe Hershberger @ 2013-05-13 21:30 UTC (permalink / raw)
To: u-boot
On Mon, May 13, 2013 at 10:14 AM, Marek Vasut <marex@denx.de> wrote:
> Dear Simon Glass,
>
>> From: Julius Werner <jwerner@chromium.org>
>>
>> The ASIX driver calls a basic_init() function during get_info(), so that
>> not all initialization tasks need to be redone on every init().
>> Unfortunately, the most important one is still triggered too often: the
>> driver does a full port and MII reset on every asix_init(), requiring up
>> to several seconds to reestablish the link.
>>
>> This patch confines that software reset into the asix_basic_init()
>> function so that it will only be executed once. This saves about a
>> second of boot time on systems using BOOTP.
>>
>> Note: this patch was previously submitted many moons ago as:
>>
>> usb: usbeth: asix: Do a fast init if link already established
>>
>> That patch seens to have been lost or forgotten, so this is a rebased
>> version. It is tested on snow with a Asix USB dongle (Cisco).
>>
>> Signed-off-by: Julius Werner <jwerner@chromium.org>
>> Signed-off-by: Simon Glass <sjg@chromium.org>
>> Reviewed-by: Simon Glass <sjg@chromium.org>
>> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
>
> I'll pick it, but I wonder why Joe didn't ...
Sorry... just swamped for the moment.
-Joe
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH] usb: asix: Move software resets to basic_init
2013-05-13 21:30 ` Joe Hershberger
@ 2013-05-13 22:10 ` Marek Vasut
0 siblings, 0 replies; 4+ messages in thread
From: Marek Vasut @ 2013-05-13 22:10 UTC (permalink / raw)
To: u-boot
Dear Joe Hershberger,
> On Mon, May 13, 2013 at 10:14 AM, Marek Vasut <marex@denx.de> wrote:
> > Dear Simon Glass,
> >
> >> From: Julius Werner <jwerner@chromium.org>
> >>
> >> The ASIX driver calls a basic_init() function during get_info(), so that
> >> not all initialization tasks need to be redone on every init().
> >> Unfortunately, the most important one is still triggered too often: the
> >> driver does a full port and MII reset on every asix_init(), requiring up
> >> to several seconds to reestablish the link.
> >>
> >> This patch confines that software reset into the asix_basic_init()
> >> function so that it will only be executed once. This saves about a
> >> second of boot time on systems using BOOTP.
> >>
> >> Note: this patch was previously submitted many moons ago as:
> >> usb: usbeth: asix: Do a fast init if link already established
> >>
> >> That patch seens to have been lost or forgotten, so this is a rebased
> >> version. It is tested on snow with a Asix USB dongle (Cisco).
> >>
> >> Signed-off-by: Julius Werner <jwerner@chromium.org>
> >> Signed-off-by: Simon Glass <sjg@chromium.org>
> >> Reviewed-by: Simon Glass <sjg@chromium.org>
> >> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
> >
> > I'll pick it, but I wonder why Joe didn't ...
>
> Sorry... just swamped for the moment.
Same here :-/
Best regards,
Marek Vasut
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-05-13 22:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-11 20:35 [U-Boot] [PATCH] usb: asix: Move software resets to basic_init Simon Glass
2013-05-13 15:14 ` Marek Vasut
2013-05-13 21:30 ` Joe Hershberger
2013-05-13 22:10 ` Marek Vasut
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox