[miiphy] add feature to force link present
If a NIC's MII isn't connected to a PHY but directly to a switch port, the switch doesn't sent a link signal to the NIC. (Because strictly speaking, there isn't any ethernet link at all.) This patch adds a force link feature to the phy, to cope with this situation. Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
This commit is contained in:
parent
26a8987c46
commit
4a770377d1
|
@ -35,6 +35,10 @@ int miiphy_restart_aneg(struct miiphy_device *mdev)
|
|||
* Reset PHY, then delay 300ns
|
||||
*/
|
||||
mdev->write(mdev, mdev->address, MII_BMCR, BMCR_RESET);
|
||||
|
||||
if (mdev->flags & MIIPHY_FORCE_LINK)
|
||||
return 0;
|
||||
|
||||
udelay(1000);
|
||||
|
||||
if (mdev->flags & MIIPHY_FORCE_10) {
|
||||
|
@ -71,6 +75,9 @@ int miiphy_wait_aneg(struct miiphy_device *mdev)
|
|||
uint64_t start;
|
||||
uint16_t status;
|
||||
|
||||
if (mdev->flags & MIIPHY_FORCE_LINK)
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* Wait for AN completion
|
||||
*/
|
||||
|
@ -96,6 +103,11 @@ int miiphy_print_status(struct miiphy_device *mdev)
|
|||
char *duplex;
|
||||
int speed;
|
||||
|
||||
if (mdev->flags & MIIPHY_FORCE_LINK) {
|
||||
printf("Forcing link present...\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (mdev->read(mdev, mdev->address, MII_BMSR, &bmsr) != 0)
|
||||
goto err_out;
|
||||
if (mdev->read(mdev, mdev->address, MII_BMCR, &bmcr) != 0)
|
||||
|
|
|
@ -10,7 +10,8 @@
|
|||
|
||||
#include <driver.h>
|
||||
|
||||
#define MIIPHY_FORCE_10 1
|
||||
#define MIIPHY_FORCE_10 (1 << 0)
|
||||
#define MIIPHY_FORCE_LINK (1 << 1)
|
||||
|
||||
#define MII_BMCR 0x00 /* Basic mode control register */
|
||||
#define MII_BMSR 0x01 /* Basic mode status register */
|
||||
|
|
Loading…
Reference in New Issue