From patchwork Wed Apr 3 18:57:41 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 233571 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 3887C2C00F0 for ; Thu, 4 Apr 2013 06:03:07 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 631C24A298; Wed, 3 Apr 2013 21:03:06 +0200 (CEST) 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 PB5RDdJAJ2sE; Wed, 3 Apr 2013 21:03:06 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id E6DE34A29E; Wed, 3 Apr 2013 21:03:04 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 186994A298 for ; Wed, 3 Apr 2013 21:03:03 +0200 (CEST) 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 aOblm1MZFITM for ; Wed, 3 Apr 2013 21:03:01 +0200 (CEST) X-Greylist: delayed 309 seconds by postgrey-1.27 at theia; Wed, 03 Apr 2013 21:02:56 CEST 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-ia0-f202.google.com (mail-ia0-f202.google.com [209.85.210.202]) by theia.denx.de (Postfix) with ESMTPS id E0F764A2C2 for ; Wed, 3 Apr 2013 21:02:56 +0200 (CEST) Received: by mail-ia0-f202.google.com with SMTP id p22so458239iad.3 for ; Wed, 03 Apr 2013 12:02:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer :x-gm-message-state; bh=zVhuakRHs0sNFoXUqIksREXFrWhJEKnXghoiCQuVXAg=; b=pTn0oD3m+0WMVGutKt8ZrjIkLCRM1q8bKZkeJbqNGA+YtZ6WTyP/9BecTbjtOCKm6J YGTEL41E7S1pXj2MyUDhe4yzdI+l/FOtsMoAUGt4X9vWBoLk+M8FlHA/VC80VwwC1Z/U U+oH2tm/5HGUsC4j2/djoWEfy3Jfb2lvxl2O+vFCe5VXcbjx4xlUFrqA10fJjZsswjgT do+w2pA2RHyR15rMoMjKpzfgC/KnQyGpfEbrjwDDH8fLmoOgIb97SxiSoZq1F+z0lBkT m+wMOesaJicafRzs+kXcud0SsjPeo29cudM8kxIsZ5Rd+s9p3mtUiLOTIYuuWZVsugtq UUlA== X-Received: by 10.50.8.73 with SMTP id p9mr2552815iga.5.1365015466513; Wed, 03 Apr 2013 11:57:46 -0700 (PDT) Received: from corp2gmr1-1.hot.corp.google.com (corp2gmr1-1.hot.corp.google.com [172.24.189.92]) by gmr-mx.google.com with ESMTPS id o6si1023861igh.2.2013.04.03.11.57.46 (version=TLSv1.1 cipher=AES128-SHA bits=128/128); Wed, 03 Apr 2013 11:57:46 -0700 (PDT) Received: from kaka.mtv.corp.google.com (kaka.mtv.corp.google.com [172.22.83.1]) by corp2gmr1-1.hot.corp.google.com (Postfix) with ESMTP id D14C531C22F; Wed, 3 Apr 2013 11:57:45 -0700 (PDT) Received: by kaka.mtv.corp.google.com (Postfix, from userid 121222) id 64EEB160920; Wed, 3 Apr 2013 11:57:45 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Wed, 3 Apr 2013 11:57:41 -0700 Message-Id: <1365015461-9925-1-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 1.8.1.3 X-Gm-Message-State: ALoCoQlBVW1ANVimGZA6Xg5rRjV8zHE/VTX6nl1j8b6yy7o5ysPMbtONVsEsL88XtnnAFWgnBXjiNwQ8lHyjukPWAIFPQEbvCCGDPdJwSi44oVvJgdWX5f88Z2zcmYQz6Qczeg0M55ZK6VGNw/he9LWP2Zbs6sNGOI88LSjrfKqVCVf3rvdcmVF+4CyxT9jhi9H/B7S4h/Pu Cc: Julius Werner , u-boot-review@google.com Subject: [U-Boot] [PATCH] usb: net: Move software resets to basic_init 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 From: Julius Werner 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. Signed-off-by: Julius Werner Signed-off-by: Simon Glass Reviewed-by: Vadim Bendebury --- 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;