1 From 1a900b17b34ddca0336c739a2836bcb7f8aad5a8 Mon Sep 17 00:00:00 2001
2 From: Hauke Mehrtens <hauke@hauke-m.de>
3 Date: Fri, 25 Oct 2013 00:03:33 +0200
4 Subject: [PATCH 9/9] b44: add dummy phy device if we do not find any
7 drivers/net/ethernet/broadcom/b44.c | 25 +++++++++++++++++++++----
8 1 file changed, 21 insertions(+), 4 deletions(-)
10 --- a/drivers/net/ethernet/broadcom/b44.c
11 +++ b/drivers/net/ethernet/broadcom/b44.c
12 @@ -2222,6 +2222,8 @@ static int b44_register_phy_one(struct b
13 struct ssb_device *sdev = bp->sdev;
14 struct phy_device *phydev;
16 + bool dummy_phy = false;
17 + struct phy_c45_device_ids c45_ids = {0};
19 mii_bus = mdiobus_alloc();
21 @@ -2256,9 +2258,21 @@ static int b44_register_phy_one(struct b
23 phydev = bp->mii_bus->phy_map[bp->phy_addr];
25 - dev_err(sdev->dev, "could not find PHY at %i\n", bp->phy_addr);
27 - goto err_out_mdiobus_unregister;
29 + dev_info(sdev->dev, "could not find PHY at %i, create dummy one\n",
32 + phydev = phy_device_create(bp->mii_bus, bp->phy_addr, 0x0, false, &c45_ids);
33 + if (IS_ERR(phydev)) {
34 + err = PTR_ERR(phydev);
35 + dev_err(sdev->dev, "Can not create dummy PHY\n");
36 + goto err_out_mdiobus_unregister;
38 + err = phy_device_register(phydev);
40 + dev_err(sdev->dev, "failed to register MII bus\n");
41 + goto err_out_phy_free;
45 err = phy_connect_direct(bp->dev, phydev, &b44_adjust_link,
46 @@ -2266,7 +2280,7 @@ static int b44_register_phy_one(struct b
48 dev_err(sdev->dev, "could not attach PHY at %i\n",
50 - goto err_out_mdiobus_unregister;
51 + goto err_out_phy_free;
54 /* mask with MAC supported features */
55 @@ -2288,6 +2302,9 @@ static int b44_register_phy_one(struct b
60 + if (phydev && dummy_phy)
61 + phy_device_free(phydev);
62 err_out_mdiobus_unregister:
63 mdiobus_unregister(mii_bus);