From patchwork Thu Dec 6 07:10:16 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vipin Kumar X-Patchwork-Id: 204158 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 965282C0180 for ; Thu, 6 Dec 2012 18:10:40 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 600744A1F8; Thu, 6 Dec 2012 08:10:39 +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 H9ySdOL9gz-D; Thu, 6 Dec 2012 08:10:39 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 810F94A1FB; Thu, 6 Dec 2012 08:10:37 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 768AE4A1F2 for ; Thu, 6 Dec 2012 08:10:35 +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 cuScd7A6dp21 for ; Thu, 6 Dec 2012 08:10:34 +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 eu1sys200aog110.obsmtp.com (eu1sys200aog110.obsmtp.com [207.126.144.129]) by theia.denx.de (Postfix) with ESMTPS id 793554A1EC for ; Thu, 6 Dec 2012 08:10:26 +0100 (CET) Received: from beta.dmz-ap.st.com ([138.198.100.35]) (using TLSv1) by eu1sys200aob110.postini.com ([207.126.147.11]) with SMTP ID DSNKUMBE4HSGPTwUXJ8WW8lF7lWjjrlTKCU1@postini.com; Thu, 06 Dec 2012 07:10:28 UTC Received: from zeta.dmz-ap.st.com (ns6.st.com [138.198.234.13]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 50B32F1; Thu, 6 Dec 2012 07:02:10 +0000 (GMT) Received: from Webmail-ap.st.com (eapex1hubcas3.st.com [10.80.176.67]) by zeta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 649B2D5C; Thu, 6 Dec 2012 07:10:21 +0000 (GMT) Received: from localhost (10.199.82.27) by Webmail-ap.st.com (10.80.176.7) with Microsoft SMTP Server (TLS) id 8.3.245.1; Thu, 6 Dec 2012 15:10:20 +0800 From: Vipin Kumar To: , Date: Thu, 6 Dec 2012 12:40:16 +0530 Message-ID: <8ff845e533e9d174c6fe70cc8a6be5ec753bd071.1354777675.git.vipin.kumar@st.com> X-Mailer: git-send-email 1.8.0 In-Reply-To: <21ad31fb0501d0cd56f978467ae31f153a22ec4b.1354777675.git.vipin.kumar@st.com> References: <21ad31fb0501d0cd56f978467ae31f153a22ec4b.1354777675.git.vipin.kumar@st.com> MIME-Version: 1.0 Cc: Shiraz Hashim , spear-devel@list.st.com Subject: [U-Boot] [PATCH resend 2/2] net/macb: Add arch specific routine to get mdio control 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: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de From: Shiraz Hashim SPEAr310 and SPEAr320 Ethernet interfaces share same MDIO lines to control their respective phys. Currently their is a fixed configuration in which only a particular MAC can use the MDIO lines. Call an arch specific function to take control of specific mdio lines at runtime. Signed-off-by: Shiraz Hashim Signed-off-by: Vipin Kumar Acked-by: Stefan Roese --- drivers/net/macb.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/net/macb.c b/drivers/net/macb.c index 8bacbda..45fbbd7 100644 --- a/drivers/net/macb.c +++ b/drivers/net/macb.c @@ -163,6 +163,13 @@ static u16 macb_mdio_read(struct macb_device *macb, u8 reg) return MACB_BFEXT(DATA, frame); } +static void __def_arch_get_mdio_control(const char *name) +{ + return; +} +int arch_get_mdio_control(const char *name) + __attribute__((weak, alias("__def_arch_get_mdio_control"))); + #if defined(CONFIG_CMD_MII) int macb_miiphy_read(const char *devname, u8 phy_adr, u8 reg, u16 *value) @@ -173,6 +180,7 @@ int macb_miiphy_read(const char *devname, u8 phy_adr, u8 reg, u16 *value) if ( macb->phy_addr != phy_adr ) return -1; + arch_get_mdio_control(devname); *value = macb_mdio_read(macb, reg); return 0; @@ -186,6 +194,7 @@ int macb_miiphy_write(const char *devname, u8 phy_adr, u8 reg, u16 value) if ( macb->phy_addr != phy_adr ) return -1; + arch_get_mdio_control(devname); macb_mdio_write(macb, reg, value); return 0; @@ -377,6 +386,7 @@ static int macb_phy_init(struct macb_device *macb) int media, speed, duplex; int i; + arch_get_mdio_control(netdev->name); #ifdef CONFIG_MACB_SEARCH_PHY /* Auto-detect phy_addr */ if (!macb_phy_find(macb)) {