From patchwork Fri Nov 2 17:39:58 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vipin Kumar X-Patchwork-Id: 196712 X-Patchwork-Delegate: albert.aribaud@free.fr 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 E16172C00C1 for ; Sat, 3 Nov 2012 05:17:25 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 865B54AEC4; Fri, 2 Nov 2012 19:17:23 +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 2q0aKq9H2vW8; Fri, 2 Nov 2012 19:17:23 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 665184AED3; Fri, 2 Nov 2012 19:16:49 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id F2AFD4AEBC for ; Fri, 2 Nov 2012 19:16:45 +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 yfGmjWTpK27u for ; Fri, 2 Nov 2012 19:16:44 +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 eu1sys200aog115.obsmtp.com (eu1sys200aog115.obsmtp.com [207.126.144.139]) by theia.denx.de (Postfix) with ESMTPS id A47544AEBB for ; Fri, 2 Nov 2012 19:16:42 +0100 (CET) Received: from beta.dmz-ap.st.com ([138.198.100.35]) (using TLSv1) by eu1sys200aob115.postini.com ([207.126.147.11]) with SMTP ID DSNKUJQOCYtOm7ZfdUOtIeiIkGPMXKh8yO+c@postini.com; Fri, 02 Nov 2012 18:16:44 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 81808199; Fri, 2 Nov 2012 17:36:31 +0000 (GMT) Received: from Webmail-ap.st.com (eapex1hubcas2.st.com [10.80.176.10]) by zeta.dmz-ap.st.com (STMicroelectronics) with ESMTP id B505D107D; Fri, 2 Nov 2012 17:44:44 +0000 (GMT) Received: from localhost (10.251.136.62) by Webmail-ap.st.com (10.80.176.7) with Microsoft SMTP Server (TLS) id 8.3.245.1; Sat, 3 Nov 2012 01:44:44 +0800 From: Vipin Kumar To: Date: Fri, 2 Nov 2012 23:09:58 +0530 Message-ID: <1323a5c3ffd75d128e0e9ccddd32adb3a395d2a2.1351877124.git.vipin.kumar@st.com> X-Mailer: git-send-email 1.7.10.rc2.10.gb47606 In-Reply-To: <1c8cd3ce05a1064788a96bb4b49f9b82d9caf736.1351877124.git.vipin.kumar@st.com> References: <1c8cd3ce05a1064788a96bb4b49f9b82d9caf736.1351877124.git.vipin.kumar@st.com> MIME-Version: 1.0 Cc: Shiraz Hashim , sr@denx.de, spear-devel@list.st.com Subject: [U-Boot] [Drivers PATCH 13/19] 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 --- drivers/net/macb.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/net/macb.c b/drivers/net/macb.c index 0e1ced7..ac25b52 100644 --- a/drivers/net/macb.c +++ b/drivers/net/macb.c @@ -165,6 +165,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) @@ -175,6 +182,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; @@ -188,6 +196,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; @@ -379,6 +388,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)) {