* [PATCH RFC] ixp4xx_eth: Allow setting the MDIO bus name in platform data
@ 2014-03-24 14:17 Simon Kågström
2014-03-24 20:34 ` Krzysztof Halasa
0 siblings, 1 reply; 4+ messages in thread
From: Simon Kågström @ 2014-03-24 14:17 UTC (permalink / raw)
To: linux-arm-kernel
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 <simon.kagstrom@netinsight.net>
---
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)) {
--
1.7.9.6
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH RFC] ixp4xx_eth: Allow setting the MDIO bus name in platform data
2014-03-24 14:17 [PATCH RFC] ixp4xx_eth: Allow setting the MDIO bus name in platform data Simon Kågström
@ 2014-03-24 20:34 ` Krzysztof Halasa
2014-03-24 20:42 ` Florian Fainelli
0 siblings, 1 reply; 4+ messages in thread
From: Krzysztof Halasa @ 2014-03-24 20:34 UTC (permalink / raw)
To: linux-arm-kernel
Simon K?gstr?m <simon.kagstrom@netinsight.net> writes:
> 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},
> }
> };
Why do we need it? I'm not sure I know what constitutes a "fixed MDIO
bus".
--
Krzysztof Halasa
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH RFC] ixp4xx_eth: Allow setting the MDIO bus name in platform data
2014-03-24 20:34 ` Krzysztof Halasa
@ 2014-03-24 20:42 ` Florian Fainelli
2014-03-25 11:37 ` Simon Kågström
0 siblings, 1 reply; 4+ messages in thread
From: Florian Fainelli @ 2014-03-24 20:42 UTC (permalink / raw)
To: linux-arm-kernel
2014-03-24 13:34 GMT-07:00 Krzysztof Halasa <khc@pm.waw.pl>:
> Simon K?gstr?m <simon.kagstrom@netinsight.net> writes:
>
>> 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},
>> }
>> };
>
> Why do we need it? I'm not sure I know what constitutes a "fixed MDIO
> bus".
This is a software emulation MDIO bus for when your Ethernet MAC is
connected to a PHY which does not appear on the MDIO bus. This is
typically used to provide the Ethernet driver with a link that is
always seen as UP, when you cannot directly query it via MDIO/MDC.
--
Florian
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH RFC] ixp4xx_eth: Allow setting the MDIO bus name in platform data
2014-03-24 20:42 ` Florian Fainelli
@ 2014-03-25 11:37 ` Simon Kågström
0 siblings, 0 replies; 4+ messages in thread
From: Simon Kågström @ 2014-03-25 11:37 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, 24 Mar 2014 13:42:29 -0700
Florian Fainelli <f.fainelli@gmail.com> wrote:
> 2014-03-24 13:34 GMT-07:00 Krzysztof Halasa <khc@pm.waw.pl>:
> > Simon K?gstr?m <simon.kagstrom@netinsight.net> writes:
> >
> >> Allows using e.g., a fixed MDIO bus with the ixp4xx_eth driver.
> >> Example:
> >
> >
> > Why do we need it? I'm not sure I know what constitutes a "fixed MDIO
> > bus".
>
> This is a software emulation MDIO bus for when your Ethernet MAC is
> connected to a PHY which does not appear on the MDIO bus. This is
> typically used to provide the Ethernet driver with a link that is
> always seen as UP, when you cannot directly query it via MDIO/MDC.
Yes, exactly. We have a board which uses two of the ipx4xx NPE:s, one
which uses a real PHY via the ixp4xx_eth MDIO bus and one which uses
the fixed PHY driver.
To support this, we need this patch as the driver would otherwise
always look for the PHY on the ixp4xx_eth MDIO bus.
// Simon
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-03-25 11:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-24 14:17 [PATCH RFC] ixp4xx_eth: Allow setting the MDIO bus name in platform data Simon Kågström
2014-03-24 20:34 ` Krzysztof Halasa
2014-03-24 20:42 ` Florian Fainelli
2014-03-25 11:37 ` Simon Kågström
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).