From patchwork Mon Nov 14 23:22:00 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grant Grundler X-Patchwork-Id: 125630 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 2B6DFB6F87 for ; Tue, 15 Nov 2011 10:23:57 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756672Ab1KNXXU (ORCPT ); Mon, 14 Nov 2011 18:23:20 -0500 Received: from mail-gx0-f174.google.com ([209.85.161.174]:39652 "EHLO mail-gx0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756607Ab1KNXXR (ORCPT ); Mon, 14 Nov 2011 18:23:17 -0500 Received: by mail-gx0-f174.google.com with SMTP id b2so6746124ggn.19 for ; Mon, 14 Nov 2011 15:23:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=WGRzrGC23s7I3/o09jeKxoxgaGXUDNqE7T1N99hLZvI=; b=TJYyyus6LDIBbxgJJgeW91YGuZBFbhILNZKuGZw98Y/EdSt/qNKUdUfknonPPzr9sd Yv0xdT3FLLgao0mUzgjENPv2oBxDuLFgwQub/0Ul0PGVfPXVgSVghNSbowfrY3hUQTJc 75PG33chdn/z8CwSFt1GckDGODF20lUs4ztlA= Received: by 10.68.38.5 with SMTP id c5mr15736815pbk.93.1321312996270; Mon, 14 Nov 2011 15:23:16 -0800 (PST) Received: from localhost.localdomain (grundler.mtv.corp.google.com [172.22.72.52]) by mx.google.com with ESMTPS id lt8sm60131511pbb.0.2011.11.14.15.23.15 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 14 Nov 2011 15:23:15 -0800 (PST) From: Grant Grundler To: davem@davemloft.net Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Allan Chou , Freddy Xin , Grant Grundler Subject: [PATCH 4/5] net-next:asix: more fixes for ax88178 phy init sequence Date: Mon, 14 Nov 2011 15:22:00 -0800 Message-Id: <1321312921-7748-4-git-send-email-grundler@chromium.org> X-Mailer: git-send-email 1.7.3.1 In-Reply-To: <1321312921-7748-1-git-send-email-grundler@chromium.org> References: <1321312921-7748-1-git-send-email-grundler@chromium.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Now works on Samsung Series 5 (chromebook) Two fixes here: o use 0x7F mask for phymode o read phyid *AFTER* phy is powered up (via GPIOs) Signed-off-by: Allan Chou Signed-off-by: Grant Grundler --- drivers/net/usb/asix.c | 22 +++++++++++++++------- 1 files changed, 15 insertions(+), 7 deletions(-) diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c index 8462be5..c07dd26 100644 --- a/drivers/net/usb/asix.c +++ b/drivers/net/usb/asix.c @@ -1248,6 +1248,7 @@ static int ax88178_reset(struct usbnet *dev) __le16 eeprom; u8 status; int gpio0 = 0; + u32 phyid; asix_read_cmd(dev, AX_CMD_READ_GPIOS, 0, 0, 1, &status); dbg("GPIO Status: 0x%04x", status); @@ -1263,12 +1264,13 @@ static int ax88178_reset(struct usbnet *dev) data->ledmode = 0; gpio0 = 1; } else { - data->phymode = le16_to_cpu(eeprom) & 7; + data->phymode = le16_to_cpu(eeprom) & 0x7F; data->ledmode = le16_to_cpu(eeprom) >> 8; gpio0 = (le16_to_cpu(eeprom) & 0x80) ? 0 : 1; } dbg("GPIO0: %d, PhyMode: %d", gpio0, data->phymode); + /* Power up external GigaPHY through AX88178 GPIO pin */ asix_write_gpio(dev, AX_GPIO_RSE | AX_GPIO_GPO_1 | AX_GPIO_GPO1EN, 40); if ((le16_to_cpu(eeprom) >> 8) != 1) { asix_write_gpio(dev, 0x003c, 30); @@ -1280,6 +1282,13 @@ static int ax88178_reset(struct usbnet *dev) asix_write_gpio(dev, AX_GPIO_GPO1EN | AX_GPIO_GPO_1, 30); } + /* Read PHYID register *AFTER* powering up PHY */ + phyid = asix_get_phyid(dev); + dbg("PHYID=0x%08x", phyid); + + /* Set AX88178 to enable MII/GMII/RGMII interface for external PHY */ + asix_write_cmd(dev, AX_CMD_SW_PHY_SELECT, 0, 0, 0, NULL); + asix_sw_reset(dev, 0); msleep(150); @@ -1424,7 +1433,6 @@ static int ax88178_bind(struct usbnet *dev, struct usb_interface *intf) { int ret; u8 buf[ETH_ALEN]; - u32 phyid; struct asix_data *data = (struct asix_data *)&dev->data; data->eeprom_len = AX88772_EEPROM_LEN; @@ -1451,12 +1459,12 @@ static int ax88178_bind(struct usbnet *dev, struct usb_interface *intf) dev->net->netdev_ops = &ax88178_netdev_ops; dev->net->ethtool_ops = &ax88178_ethtool_ops; - phyid = asix_get_phyid(dev); - dbg("PHYID=0x%08x", phyid); + /* Blink LEDS so users know driver saw dongle */ + ax88178_sw_reset(dev, 0); + msleep(150); - ret = ax88178_reset(dev); - if (ret < 0) - return ret; + asix_sw_reset(dev, AX_SWRESET_PRL | AX_SWRESET_IPPD); + msleep(150); /* Asix framing packs multiple eth frames into a 2K usb bulk transfer */ if (dev->driver_info->flags & FLAG_FRAMING_AX) {