From patchwork Mon Mar 24 14:17:29 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Kagstrom X-Patchwork-Id: 3882821 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id DE37C9F2E8 for ; Mon, 24 Mar 2014 14:18:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AEA4720256 for ; Mon, 24 Mar 2014 14:18:56 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2285D2020F for ; Mon, 24 Mar 2014 14:18:55 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WS5hp-00035W-EN; Mon, 24 Mar 2014 14:18:25 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WS5he-00018R-1C; Mon, 24 Mar 2014 14:18:14 +0000 Received: from ernst.netinsight.se ([194.16.221.21]) by merlin.infradead.org with smtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WS5hN-00015l-FQ for linux-arm-kernel@lists.infradead.org; Mon, 24 Mar 2014 14:17:59 +0000 Received: from marrow.netinsight.se (unverified [10.100.3.78]) by ernst.netinsight.se (EMWAC SMTPRS 0.83) with SMTP id ; Mon, 24 Mar 2014 15:17:29 +0100 Date: Mon, 24 Mar 2014 15:17:29 +0100 From: Simon =?UTF-8?B?S8OlZ3N0csO2bQ==?= To: "linux-arm-kernel@lists.infradead.org" , Arnd Bergmann , , Russell King - ARM Linux , khc@pm.waw.pl, , netdev@vger.kernel.org Subject: [PATCH RFC] ixp4xx_eth: Allow setting the MDIO bus name in platform data Message-ID: <20140324151729.1b8e3bb5@marrow.netinsight.se> X-Mailer: Claws Mail 3.9.3 (GTK+ 2.24.10; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140324_101757_851863_1CA82D5D X-CRM114-Status: GOOD ( 13.51 ) X-Spam-Score: -2.6 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Allows using e.g., a fixed MDIO bus with the ixp4xx_eth driver. Example: static struct eth_plat_info board_plat_eth_internal[] = { { .mdio_bus_id = "fixed-0", .phy = 31, .rxq = 4, .txreadyq = 21, .hwaddr = {0x02, 0x00, 0x00, 0x00, 0x00, 0x00}, } }; static struct platform_device board_eth_internal = { .name = "ixp4xx_eth", .id = IXP4XX_ETH_NPEC, .dev.platform_data = board_plat_eth_internal, }; Signed-off-by: Simon Kagstrom --- I'm unsure if this is the correct way of doing it for the legacy ixp4xx platform. It seems most boards which use the fixed PHYs are DT-based PPC ones. arch/arm/mach-ixp4xx/include/mach/platform.h | 1 + drivers/net/ethernet/xscale/ixp4xx_eth.c | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-ixp4xx/include/mach/platform.h b/arch/arm/mach-ixp4xx/include/mach/platform.h index 75c4c65..c6114b9 100644 --- a/arch/arm/mach-ixp4xx/include/mach/platform.h +++ b/arch/arm/mach-ixp4xx/include/mach/platform.h @@ -97,6 +97,7 @@ struct ixp4xx_pata_data { /* Information about built-in Ethernet MAC interfaces */ struct eth_plat_info { + const char *mdio_bus_id; /* MDIO bus name. NULL is the ixp4xx_eth bus */ u8 phy; /* MII PHY ID, 0 - 31 */ u8 rxq; /* configurable, currently 0 - 31 only */ u8 txreadyq; diff --git a/drivers/net/ethernet/xscale/ixp4xx_eth.c b/drivers/net/ethernet/xscale/ixp4xx_eth.c index e540e51..31fe055 100644 --- a/drivers/net/ethernet/xscale/ixp4xx_eth.c +++ b/drivers/net/ethernet/xscale/ixp4xx_eth.c @@ -1410,6 +1410,7 @@ static int eth_init_one(struct platform_device *pdev) struct net_device *dev; struct eth_plat_info *plat = dev_get_platdata(&pdev->dev); u32 regs_phys; + const char *mdio_bus_id; char phy_id[MII_BUS_ID_SIZE + 3]; int err; @@ -1477,8 +1478,12 @@ static int eth_init_one(struct platform_device *pdev) __raw_writel(DEFAULT_CORE_CNTRL, &port->regs->core_control); udelay(50); + mdio_bus_id = mdio_bus->id; + if (plat->mdio_bus_id) + mdio_bus_id = plat->mdio_bus_id; + snprintf(phy_id, MII_BUS_ID_SIZE + 3, PHY_ID_FMT, - mdio_bus->id, plat->phy); + mdio_bus_id, plat->phy); port->phydev = phy_connect(dev, phy_id, &ixp4xx_adjust_link, PHY_INTERFACE_MODE_MII); if (IS_ERR(port->phydev)) {