From: Grant Grundler <grundler@chromium.org>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Allan Chou <allan@asix.com.tw>, Freddy Xin <freddy@asix.com.tw>,
Grant Grundler <grundler@chromium.org>
Subject: [PATCH 3/5] net-next:asix: reduce AX88772 init time by about 2 seconds
Date: Mon, 14 Nov 2011 15:21:59 -0800 [thread overview]
Message-ID: <1321312921-7748-3-git-send-email-grundler@chromium.org> (raw)
In-Reply-To: <1321312921-7748-1-git-send-email-grundler@chromium.org>
ax88772_reset takes about 2 seconds and is called twice.
Once from ax88772_bind() directly and again indirectly from usbnet_open().
Reset the USB FW/Phy enough to blink the LEDs when inserted.
Signed-off-by: Allan Chou <allan@asix.com.tw>
Signed-off-by: Grant Grundler <grundler@chromium.org>
---
drivers/net/usb/asix.c | 30 +++++++++++++++++++++++++-----
1 files changed, 25 insertions(+), 5 deletions(-)
diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c
index b4675e8..8462be5 100644
--- a/drivers/net/usb/asix.c
+++ b/drivers/net/usb/asix.c
@@ -1083,7 +1083,7 @@ static const struct net_device_ops ax88772_netdev_ops = {
static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
{
- int ret;
+ int ret, embd_phy;
struct asix_data *data = (struct asix_data *)&dev->data;
u8 buf[ETH_ALEN];
u32 phyid;
@@ -1108,16 +1108,36 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
dev->mii.reg_num_mask = 0x1f;
dev->mii.phy_id = asix_get_phy_addr(dev);
- phyid = asix_get_phyid(dev);
- dbg("PHYID=0x%08x", phyid);
-
dev->net->netdev_ops = &ax88772_netdev_ops;
dev->net->ethtool_ops = &ax88772_ethtool_ops;
- ret = ax88772_reset(dev);
+ embd_phy = ((dev->mii.phy_id & 0x1f) == 0x10 ? 1 : 0);
+
+ /* Reset the PHY to normal operation mode */
+ ret = asix_write_cmd(dev, AX_CMD_SW_PHY_SELECT, embd_phy, 0, 0, NULL);
+ if (ret < 0) {
+ dbg("Select PHY #1 failed: %d", ret);
+ return ret;
+ }
+
+ ret = asix_sw_reset(dev, AX_SWRESET_IPPD | AX_SWRESET_PRL);
if (ret < 0)
return ret;
+ msleep(150);
+
+ ret = asix_sw_reset(dev, AX_SWRESET_CLEAR);
+ if (ret < 0)
+ return ret;
+
+ msleep(150);
+
+ ret = asix_sw_reset(dev, embd_phy ? AX_SWRESET_IPRL : AX_SWRESET_PRTE);
+
+ /* Read PHYID register *AFTER* the PHY was reset properly */
+ phyid = asix_get_phyid(dev);
+ dbg("PHYID=0x%08x", phyid);
+
/* Asix framing packs multiple eth frames into a 2K usb bulk transfer */
if (dev->driver_info->flags & FLAG_FRAMING_AX) {
/* hard_mtu is still the default - the device does not support
--
1.7.3.1
next prev parent reply other threads:[~2011-11-14 23:23 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-14 23:21 [PATCH 1/5] net-next:asix: PHY_MODE_RTL8211CL should be 0xC Grant Grundler
2011-11-14 23:21 ` [PATCH 2/5] net-next:asix: poll in asix_get_phyid in case phy not ready Grant Grundler
2011-11-14 23:21 ` Grant Grundler [this message]
2011-11-14 23:22 ` [PATCH 4/5] net-next:asix: more fixes for ax88178 phy init sequence Grant Grundler
2011-11-14 23:22 ` [PATCH 5/5] net-next:asix: update VERSION and white space changes Grant Grundler
2011-11-14 23:42 ` David Miller
2011-11-15 0:39 ` Grant Grundler
2011-11-15 0:54 ` Grant Grundler
2011-11-15 2:32 ` David Miller
2011-11-15 2:41 ` David Miller
2011-11-15 2:45 ` David Miller
2011-11-15 15:19 ` Mark Lord
2011-11-15 21:41 ` David Miller
2011-11-15 15:58 ` Grant Grundler
2011-11-15 17:12 [PATCH 1/5] net-next:asix:PHY_MODE_RTL8211CL should be 0xC Grant Grundler
2011-11-15 17:12 ` [PATCH 3/5] net-next:asix: reduce AX88772 init time by about 2 seconds Grant Grundler
2011-11-15 21:41 ` David Miller
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=1321312921-7748-3-git-send-email-grundler@chromium.org \
--to=grundler@chromium.org \
--cc=allan@asix.com.tw \
--cc=davem@davemloft.net \
--cc=freddy@asix.com.tw \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).