smc91111: add fixup for qemu phy support
as today qemu does not support phy, it will return always 0x0 to any read on the mii bus. So the phy_id is 0 and the link is donw. To have the norwork running on versatilpb & other qenu board for the link up at 100Mbps. Only enable if qemu_fixup is set. Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
38b3be6f35
commit
7e6b99fd09
|
@ -66,6 +66,7 @@
|
||||||
#include <clock.h>
|
#include <clock.h>
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#include <linux/phy.h>
|
#include <linux/phy.h>
|
||||||
|
#include <net/smc91111.h>
|
||||||
|
|
||||||
/*---------------------------------------------------------------
|
/*---------------------------------------------------------------
|
||||||
.
|
.
|
||||||
|
@ -446,6 +447,7 @@ struct smc91c111_priv {
|
||||||
struct mii_bus miibus;
|
struct mii_bus miibus;
|
||||||
struct accessors a;
|
struct accessors a;
|
||||||
void __iomem *base;
|
void __iomem *base;
|
||||||
|
int qemu_fixup;
|
||||||
};
|
};
|
||||||
|
|
||||||
#if (SMC_DEBUG > 2 )
|
#if (SMC_DEBUG > 2 )
|
||||||
|
@ -882,6 +884,7 @@ static void smc91c111_enable(struct eth_device *edev)
|
||||||
static int smc91c111_eth_open(struct eth_device *edev)
|
static int smc91c111_eth_open(struct eth_device *edev)
|
||||||
{
|
{
|
||||||
struct smc91c111_priv *priv = (struct smc91c111_priv *)edev->priv;
|
struct smc91c111_priv *priv = (struct smc91c111_priv *)edev->priv;
|
||||||
|
int ret;
|
||||||
|
|
||||||
/* Configure the Receive/Phy Control register */
|
/* Configure the Receive/Phy Control register */
|
||||||
SMC_SELECT_BANK(priv, 0);
|
SMC_SELECT_BANK(priv, 0);
|
||||||
|
@ -889,8 +892,27 @@ static int smc91c111_eth_open(struct eth_device *edev)
|
||||||
|
|
||||||
smc91c111_enable(edev);
|
smc91c111_enable(edev);
|
||||||
|
|
||||||
return phy_device_connect(edev, &priv->miibus, 0, NULL,
|
ret = phy_device_connect(edev, &priv->miibus, 0, NULL,
|
||||||
0, PHY_INTERFACE_MODE_NA);
|
0, PHY_INTERFACE_MODE_NA);
|
||||||
|
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
if (priv->qemu_fixup && edev->phydev->phy_id == 0x00000000) {
|
||||||
|
struct phy_device *dev = edev->phydev;
|
||||||
|
|
||||||
|
dev->speed = SPEED_100;
|
||||||
|
dev->duplex = DUPLEX_FULL;
|
||||||
|
dev->autoneg = !AUTONEG_ENABLE;
|
||||||
|
dev->force = 1;
|
||||||
|
dev->link = 1;
|
||||||
|
|
||||||
|
dev_info(edev->parent, "phy with id 0x%08x detected this might be qemu\n",
|
||||||
|
dev->phy_id);
|
||||||
|
dev_info(edev->parent, "force link at 100Mpbs\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int smc91c111_eth_send(struct eth_device *edev, void *packet,
|
static int smc91c111_eth_send(struct eth_device *edev, void *packet,
|
||||||
|
@ -1286,6 +1308,12 @@ static int smc91c111_probe(struct device_d *dev)
|
||||||
|
|
||||||
priv = edev->priv;
|
priv = edev->priv;
|
||||||
|
|
||||||
|
if (dev->platform_data) {
|
||||||
|
struct smc91c111_pdata *pdata = dev->platform_data;
|
||||||
|
|
||||||
|
priv->qemu_fixup = pdata->qemu_fixup;
|
||||||
|
}
|
||||||
|
|
||||||
priv->a = access_via_32bit;
|
priv->a = access_via_32bit;
|
||||||
|
|
||||||
edev->init = smc91c111_init_dev;
|
edev->init = smc91c111_init_dev;
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2013 Jean-Christophe PLAGNIOL-VILLARD <plagnio@jcrosoft.com>
|
||||||
|
*
|
||||||
|
* Under GPLv2 only
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __SMC91111_H__
|
||||||
|
#define __SMC91111_H__
|
||||||
|
|
||||||
|
struct smc91c111_pdata {
|
||||||
|
int qemu_fixup;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* __SMC91111_H__ */
|
Loading…
Reference in New Issue