Skip to content

Commit c25b23b

Browse files
rmileckidavem330
authored andcommitted
bgmac: register fixed PHY for ARM BCM470X / BCM5301X chipsets
On ARM SoCs with bgmac Ethernet hardware we don't have any normal PHY. There is always a switch attached but it's not even controlled over MDIO like in case of MIPS devices. We need a fixed PHY to be able to send/receive packets from the switch. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent df814d9 commit c25b23b

File tree

1 file changed

+34
-0
lines changed
  • drivers/net/ethernet/broadcom

1 file changed

+34
-0
lines changed

drivers/net/ethernet/broadcom/bgmac.c

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <linux/etherdevice.h>
1515
#include <linux/mii.h>
1616
#include <linux/phy.h>
17+
#include <linux/phy_fixed.h>
1718
#include <linux/interrupt.h>
1819
#include <linux/dma-mapping.h>
1920
#include <bcm47xx_nvram.h>
@@ -1330,13 +1331,46 @@ static void bgmac_adjust_link(struct net_device *net_dev)
13301331
}
13311332
}
13321333

1334+
static int bgmac_fixed_phy_register(struct bgmac *bgmac)
1335+
{
1336+
struct fixed_phy_status fphy_status = {
1337+
.link = 1,
1338+
.speed = SPEED_1000,
1339+
.duplex = DUPLEX_FULL,
1340+
};
1341+
struct phy_device *phy_dev;
1342+
int err;
1343+
1344+
phy_dev = fixed_phy_register(PHY_POLL, &fphy_status, NULL);
1345+
if (!phy_dev || IS_ERR(phy_dev)) {
1346+
bgmac_err(bgmac, "Failed to register fixed PHY device\n");
1347+
return -ENODEV;
1348+
}
1349+
1350+
err = phy_connect_direct(bgmac->net_dev, phy_dev, bgmac_adjust_link,
1351+
PHY_INTERFACE_MODE_MII);
1352+
if (err) {
1353+
bgmac_err(bgmac, "Connecting PHY failed\n");
1354+
return err;
1355+
}
1356+
1357+
bgmac->phy_dev = phy_dev;
1358+
1359+
return err;
1360+
}
1361+
13331362
static int bgmac_mii_register(struct bgmac *bgmac)
13341363
{
1364+
struct bcma_chipinfo *ci = &bgmac->core->bus->chipinfo;
13351365
struct mii_bus *mii_bus;
13361366
struct phy_device *phy_dev;
13371367
char bus_id[MII_BUS_ID_SIZE + 3];
13381368
int i, err = 0;
13391369

1370+
if (ci->id == BCMA_CHIP_ID_BCM4707 ||
1371+
ci->id == BCMA_CHIP_ID_BCM53018)
1372+
return bgmac_fixed_phy_register(bgmac);
1373+
13401374
mii_bus = mdiobus_alloc();
13411375
if (!mii_bus)
13421376
return -ENOMEM;

0 commit comments

Comments
 (0)