From patchwork Tue Mar 6 05:42:00 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Giuseppe CAVALLARO X-Patchwork-Id: 144846 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 D8E03B6FA2 for ; Tue, 6 Mar 2012 16:42:41 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751542Ab2CFFmN (ORCPT ); Tue, 6 Mar 2012 00:42:13 -0500 Received: from eu1sys200aog117.obsmtp.com ([207.126.144.143]:38259 "EHLO eu1sys200aog117.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751151Ab2CFFmM (ORCPT ); Tue, 6 Mar 2012 00:42:12 -0500 Received: from beta.dmz-eu.st.com ([164.129.1.35]) (using TLSv1) by eu1sys200aob117.postini.com ([207.126.147.11]) with SMTP ID DSNKT1Wjs4LliQ5nKmVFk9qeXNBP/nCZ+5yH@postini.com; Tue, 06 Mar 2012 05:42:12 UTC Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id BB5BF1A1 for ; Tue, 6 Mar 2012 05:42:10 +0000 (GMT) Received: from mail7.sgp.st.com (mail7.sgp.st.com [164.129.223.81]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 528A814FF for ; Tue, 6 Mar 2012 05:42:10 +0000 (GMT) Received: from localhost (lxmcdt5.ctn.st.com [164.130.129.175]) by mail7.sgp.st.com (MOS 4.3.3-GA) with ESMTP id ALQ74180 (AUTH cavagiu); Tue, 6 Mar 2012 06:42:09 +0100 From: Giuseppe CAVALLARO To: netdev@vger.kernel.org Cc: Srinivas Kandagatla , Giuseppe Cavallaro Subject: [PATCH] stmmac: Allow stmmac to work with other PHY buses(v2). Date: Tue, 6 Mar 2012 06:42:00 +0100 Message-Id: <1331012520-19574-1-git-send-email-peppe.cavallaro@st.com> X-Mailer: git-send-email 1.7.4.4 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Srinivas Kandagatla After commit "db8857b stmmac: use an unique MDIO bus name" and "90b9a54 stmmac: fix phy naming inconsistency" stmmac cant work with other MDIO buses, because mdio_bus name is fixed in the dirver. This patch adds new variable phy_bus_name to plat_stmmacenet_data struct to let the BSP decide which phy bus to be used by stmmac driver. A typical use-case is to have generic MDIO buses like mdio-gpio on top of stmmac. Signed-off-by: Srinivas Kandagatla Signed-off-by: Giuseppe Cavallaro --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 8 +++++++- include/linux/stmmac.h | 1 + 2 files changed, 8 insertions(+), 1 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 6ee593a..da891ef9b 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -307,7 +307,13 @@ static int stmmac_init_phy(struct net_device *dev) priv->speed = 0; priv->oldduplex = -1; - snprintf(bus_id, MII_BUS_ID_SIZE, "stmmac-%x", priv->plat->bus_id); + if (priv->plat->phy_bus_name) + snprintf(bus_id, MII_BUS_ID_SIZE, "%s-%x", + priv->plat->phy_bus_name, priv->plat->bus_id); + else + snprintf(bus_id, MII_BUS_ID_SIZE, "stmmac-%x", + priv->plat->bus_id); + snprintf(phy_id, MII_BUS_ID_SIZE + 3, PHY_ID_FMT, bus_id, priv->plat->phy_addr); pr_debug("stmmac_init_phy: trying to attach to %s\n", phy_id); diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h index 0dddc9e..172b5e1 100644 --- a/include/linux/stmmac.h +++ b/include/linux/stmmac.h @@ -39,6 +39,7 @@ struct stmmac_mdio_bus_data { }; struct plat_stmmacenet_data { + char *phy_bus_name; int bus_id; int phy_addr; int interface;