From patchwork Thu Dec 13 01:55:21 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 205710 X-Patchwork-Delegate: marek.vasut@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 C6C3A2C0095 for ; Thu, 13 Dec 2012 12:59:02 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 662D04A230; Thu, 13 Dec 2012 02:58:44 +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 zme42Ty5QEZX; Thu, 13 Dec 2012 02:58:44 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B37214A20F; Thu, 13 Dec 2012 02:58:00 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 855234A1B2 for ; Thu, 13 Dec 2012 02:57: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 tqReNvLAkHNg for ; Thu, 13 Dec 2012 02:57:47 +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-qa0-f74.google.com (mail-qa0-f74.google.com [209.85.216.74]) by theia.denx.de (Postfix) with ESMTPS id A6B024A1BE for ; Thu, 13 Dec 2012 02:57:44 +0100 (CET) Received: by mail-qa0-f74.google.com with SMTP id r4so162561qaq.3 for ; Wed, 12 Dec 2012 17:57:42 -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=WoeLZGF8EWM9hd2m1Ris4c4gCJ+bjXbFOvwDtd2AusQ=; b=eCppfJnRgYLUl7Yzr9K4hB/sRIyDtk+OrHMs8PoIYG8LLb2b9D/iH9GEUE9XYSuaMo 71H591sR+lm18cGRfoHdgZuJc1Vvp8dWcKNbuHFCk0qhExYiaKeKPalzcCcOnb/FjJBp CqhkV+A4SdbqFfNEgjv7KRDWsYEkMiqLtvP+wfTV+9yqmIAnSnMr1usDlZToLDBm5Q0V T3OIlz5psYd73d/1+cqp/vpUzrRETQV8+Wb6aG2naVZOgZUP17HQDPmlXdCTOlZT4fcm pHcVyKxOuv8b7jSQtugUDN1WjuUIiwko7diqK7G2yniqppsnl9/mH+75zjk4/9u1nIHd 2qWw== Received: by 10.236.91.110 with SMTP id g74mr66385yhf.30.1355363862660; Wed, 12 Dec 2012 17:57:42 -0800 (PST) Received: from wpzn4.hot.corp.google.com (216-239-44-65.google.com [216.239.44.65]) by gmr-mx.google.com with ESMTPS id s78si6429yhh.3.2012.12.12.17.57.42 (version=TLSv1/SSLv3 cipher=AES128-SHA); Wed, 12 Dec 2012 17:57:42 -0800 (PST) Received: from kaka.mtv.corp.google.com (kaka.mtv.corp.google.com [172.22.73.79]) by wpzn4.hot.corp.google.com (Postfix) with ESMTP id 8315C82004A; Wed, 12 Dec 2012 17:57:42 -0800 (PST) Received: by kaka.mtv.corp.google.com (Postfix, from userid 121222) id 236CC1608B1; Wed, 12 Dec 2012 17:57:42 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Date: Wed, 12 Dec 2012 17:55:21 -0800 Message-Id: <1355363731-10103-2-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 1.7.7.3 In-Reply-To: <1355363731-10103-1-git-send-email-sjg@chromium.org> References: <1355363731-10103-1-git-send-email-sjg@chromium.org> X-Gm-Message-State: ALoCoQnIdwpWojrMe2icjoY5S2Jk+1aCPrdxdu8gwfba+EzawYmdcOq+P1joTs637FQLqxwAqMnRVbYvxpsLOJIilPRDc5ZtvVwicIZgusq3483Vi8YkOEqO1f8S7OlJNbq+FsfqMki9yqdZESKGWPnFY25uvF9FfCezRq1479K9oB4B5VRccCOors8/g7SOUps6F7fEOuYX Subject: [U-Boot] [PATCH 01/11] 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 --- 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;