From patchwork Fri Dec 14 02:21:26 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 206275 X-Patchwork-Delegate: joe.hershberger@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 421142C00A6 for ; Fri, 14 Dec 2012 13:21:57 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id EEB5A4A15C; Fri, 14 Dec 2012 03:21:55 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id JAPrmjK8VTg7; Fri, 14 Dec 2012 03:21:55 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A19234A140; Fri, 14 Dec 2012 03:21:52 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id DA9684A140 for ; Fri, 14 Dec 2012 03:21:50 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id yoMtpioTNLOW for ; Fri, 14 Dec 2012 03:21:50 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-lb0-f202.google.com (mail-lb0-f202.google.com [209.85.217.202]) by theia.denx.de (Postfix) with ESMTPS id 5932A4A144 for ; Fri, 14 Dec 2012 03:21:48 +0100 (CET) Received: by mail-lb0-f202.google.com with SMTP id s4so146783lbc.3 for ; Thu, 13 Dec 2012 18:21:47 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=MInEqrev2U0WLj6zqw6Qv2Ud+WfhlUR4AaZ0kC/2PIM=; b=izAy3+iI1K1bIQaeDRaa0O/s1PVUf7t9wqphLFLZKRQ7pycJrF0dKuMjd0hmRKNlF5 YBrKfxp3N8fcSn4mMsvn97TLRwzrNQqTfHvInjbILvwO2yKPdYlG1zOBbwy9GWfkFu81 7wBvUPuYi+OrnteCcw+H3JoN1UZ0yHKUoInyljtXm8ZSRnfVNQbp2TLyby1WFgtVu0jg bcKwG7pqt26WfJhp3KST1gVN5o66QG66Oaavt+NEt6ixreUJkdg7IAqTODKlvQ3m6Pry +QV5UJrlhqRaHUfyn33wLYmSheexn5wceWh9jdiIh5zVagCRN4P5gFioJE3+F5Zdq6fy XvHg== Received: by 10.14.208.198 with SMTP id q46mr4085133eeo.0.1355451707633; Thu, 13 Dec 2012 18:21:47 -0800 (PST) Received: from hpza10.eem.corp.google.com ([74.125.121.33]) by gmr-mx.google.com with ESMTPS id g9si852140eeo.1.2012.12.13.18.21.47 (version=TLSv1/SSLv3 cipher=AES128-SHA); Thu, 13 Dec 2012 18:21:47 -0800 (PST) Received: from kaka.mtv.corp.google.com (kaka.mtv.corp.google.com [172.22.73.79]) by hpza10.eem.corp.google.com (Postfix) with ESMTP id 3819F200059; Thu, 13 Dec 2012 18:21:47 -0800 (PST) Received: by kaka.mtv.corp.google.com (Postfix, from userid 121222) id 91A4916079A; Thu, 13 Dec 2012 18:21:46 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Date: Thu, 13 Dec 2012 18:21:26 -0800 Message-Id: <1355451692-28017-2-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 1.7.7.3 In-Reply-To: <1355451692-28017-1-git-send-email-sjg@chromium.org> References: <1355451692-28017-1-git-send-email-sjg@chromium.org> X-Gm-Message-State: ALoCoQno3g4xIdtnY+YTdGJRL23FIGcPU4Z2Olc9KdgZ3xirgXkOANxFUXcgf0XgLHhE6vizzOeDCCo5gvcxaPUREdFxx2qw0r95CjA5vyH/xmTeSlQVwAb9N1qxekBjSkSRwLYJtlETvNfAj1/P1/sew3ZUBE51GNMFpt2gMyc63LXBw2Az/f+znQzKMY9Xvo4mQQ/06cBs Subject: [U-Boot] [PATCH v2 1/7] usb: net: asix: Do a fast init if link already established X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de The Asix driver takes the link down during init() and then brings it back up. This commit changes this so that if a link has already been established successfully we simply check that the link is still good. Also fix up asix_halt() to actually halt RX on the interface. Previously this was not done, so the device would continue to operate evern when halted, violating a U-Boot requirement. This reduces the delay between successive network commands. Signed-off-by: Simon Glass Acked-by: Joe Hershberger --- Changes in v2: None drivers/usb/eth/asix.c | 40 ++++++++++++++++++++++++++++++++-------- include/usb_ether.h | 1 + 2 files changed, 33 insertions(+), 8 deletions(-) diff --git a/drivers/usb/eth/asix.c b/drivers/usb/eth/asix.c index 75ec8f7..a991fea 100644 --- a/drivers/usb/eth/asix.c +++ b/drivers/usb/eth/asix.c @@ -84,6 +84,7 @@ #define AX_DEFAULT_RX_CTL \ (AX_RX_CTL_SO | AX_RX_CTL_AB) +#define AX_DISABLE_RX_CTL AX_RX_CTL_AB /* GPIO 2 toggles */ #define AX_GPIO_GPO2EN 0x10 /* GPIO2 Output enable */ @@ -410,17 +411,16 @@ static int asix_basic_reset(struct ueth_data *dev) return 0; } -/* - * Asix callbacks - */ -static int asix_init(struct eth_device *eth, bd_t *bd) +static int full_init(struct eth_device *eth) { - struct ueth_data *dev = (struct ueth_data *)eth->priv; - int timeout = 0; -#define TIMEOUT_RESOLUTION 50 /* ms */ - int link_detected; + struct ueth_data *dev = (struct ueth_data *)eth->priv; debug("** %s()\n", __func__); + if (asix_basic_reset(dev)) + goto out_err; + + if (asix_write_rx_ctl(dev, AX_DEFAULT_RX_CTL) < 0) + goto out_err; dev->phy_id = asix_get_phy_addr(dev); if (dev->phy_id < 0) @@ -446,6 +446,25 @@ static int asix_init(struct eth_device *eth, bd_t *bd) debug("Write IPG,IPG1,IPG2 failed\n"); goto out_err; } + return 0; +out_err: + return -1; +} + +/* + * 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 (!dev->has_been_running && full_init(eth)) + return -1; if (asix_write_rx_ctl(dev, AX_DEFAULT_RX_CTL) < 0) goto out_err; @@ -467,6 +486,7 @@ static int asix_init(struct eth_device *eth, bd_t *bd) printf("unable to connect.\n"); goto out_err; } + dev->has_been_running = 1; return 0; out_err: @@ -571,7 +591,11 @@ static int asix_recv(struct eth_device *eth) static void asix_halt(struct eth_device *eth) { + struct ueth_data *dev = (struct ueth_data *)eth->priv; + + /* Disable packet reception */ debug("** %s()\n", __func__); + (void)asix_write_rx_ctl(dev, AX_DISABLE_RX_CTL); } /* diff --git a/include/usb_ether.h b/include/usb_ether.h index 7c7aecb..6145210 100644 --- a/include/usb_ether.h +++ b/include/usb_ether.h @@ -49,6 +49,7 @@ struct ueth_data { unsigned char subclass; /* as in overview */ unsigned char protocol; /* .............. */ unsigned char irqinterval; /* Intervall for IRQ Pipe */ + char has_been_running; /* PHY already inited */ /* driver private */ void *dev_priv;