* [PATCH 1/3] tg3: add support a phy at an address different than 01
@ 2013-09-28 21:15 Hauke Mehrtens
2013-09-28 21:15 ` [PATCH 2/3] ssb: provide phy address for Gigabit Ethernet driver Hauke Mehrtens
` (4 more replies)
0 siblings, 5 replies; 10+ messages in thread
From: Hauke Mehrtens @ 2013-09-28 21:15 UTC (permalink / raw)
To: davem; +Cc: nsujir, mchan, netdev, Hauke Mehrtens
When phylib was in use tg3 only searched at address 01 on the mdio
bus and did not work with any other address. On the BCM4705 SoCs the
switch is connected as a PHY behind the MAC driven by tg3 and it is at
PHY address 30 in most cases. This is a preparation patch to allow
support for such switches.
phy_addr is set to TG3_PHY_MII_ADDR for all devices, which are using
phylib, so this should not change any behavior.
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
drivers/net/ethernet/broadcom/tg3.c | 38 +++++++++++++++++------------------
1 file changed, 19 insertions(+), 19 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 221a181..853a05e 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -1375,7 +1375,7 @@ static int tg3_mdio_read(struct mii_bus *bp, int mii_id, int reg)
spin_lock_bh(&tp->lock);
- if (tg3_readphy(tp, reg, &val))
+ if (__tg3_readphy(tp, mii_id, reg, &val))
val = -EIO;
spin_unlock_bh(&tp->lock);
@@ -1390,7 +1390,7 @@ static int tg3_mdio_write(struct mii_bus *bp, int mii_id, int reg, u16 val)
spin_lock_bh(&tp->lock);
- if (tg3_writephy(tp, reg, val))
+ if (__tg3_writephy(tp, mii_id, reg, val))
ret = -EIO;
spin_unlock_bh(&tp->lock);
@@ -1408,7 +1408,7 @@ static void tg3_mdio_config_5785(struct tg3 *tp)
u32 val;
struct phy_device *phydev;
- phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR];
+ phydev = tp->mdio_bus->phy_map[tp->phy_addr];
switch (phydev->drv->phy_id & phydev->drv->phy_id_mask) {
case PHY_ID_BCM50610:
case PHY_ID_BCM50610M:
@@ -1533,7 +1533,7 @@ static int tg3_mdio_init(struct tg3 *tp)
tp->mdio_bus->read = &tg3_mdio_read;
tp->mdio_bus->write = &tg3_mdio_write;
tp->mdio_bus->reset = &tg3_mdio_reset;
- tp->mdio_bus->phy_mask = ~(1 << TG3_PHY_MII_ADDR);
+ tp->mdio_bus->phy_mask = ~(1 << tp->phy_addr);
tp->mdio_bus->irq = &tp->mdio_irq[0];
for (i = 0; i < PHY_MAX_ADDR; i++)
@@ -1554,7 +1554,7 @@ static int tg3_mdio_init(struct tg3 *tp)
return i;
}
- phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR];
+ phydev = tp->mdio_bus->phy_map[tp->phy_addr];
if (!phydev || !phydev->drv) {
dev_warn(&tp->pdev->dev, "No PHY devices\n");
@@ -1964,7 +1964,7 @@ static void tg3_setup_flow_control(struct tg3 *tp, u32 lcladv, u32 rmtadv)
u32 old_tx_mode = tp->tx_mode;
if (tg3_flag(tp, USE_PHYLIB))
- autoneg = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR]->autoneg;
+ autoneg = tp->mdio_bus->phy_map[tp->phy_addr]->autoneg;
else
autoneg = tp->link_config.autoneg;
@@ -2000,7 +2000,7 @@ static void tg3_adjust_link(struct net_device *dev)
u8 oldflowctrl, linkmesg = 0;
u32 mac_mode, lcl_adv, rmt_adv;
struct tg3 *tp = netdev_priv(dev);
- struct phy_device *phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR];
+ struct phy_device *phydev = tp->mdio_bus->phy_map[tp->phy_addr];
spin_lock_bh(&tp->lock);
@@ -2089,7 +2089,7 @@ static int tg3_phy_init(struct tg3 *tp)
/* Bring the PHY back to a known state. */
tg3_bmcr_reset(tp);
- phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR];
+ phydev = tp->mdio_bus->phy_map[tp->phy_addr];
/* Attach the MAC to the PHY. */
phydev = phy_connect(tp->dev, dev_name(&phydev->dev),
@@ -2116,7 +2116,7 @@ static int tg3_phy_init(struct tg3 *tp)
SUPPORTED_Asym_Pause);
break;
default:
- phy_disconnect(tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR]);
+ phy_disconnect(tp->mdio_bus->phy_map[tp->phy_addr]);
return -EINVAL;
}
@@ -2134,7 +2134,7 @@ static void tg3_phy_start(struct tg3 *tp)
if (!(tp->phy_flags & TG3_PHYFLG_IS_CONNECTED))
return;
- phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR];
+ phydev = tp->mdio_bus->phy_map[tp->phy_addr];
if (tp->phy_flags & TG3_PHYFLG_IS_LOW_POWER) {
tp->phy_flags &= ~TG3_PHYFLG_IS_LOW_POWER;
@@ -2154,13 +2154,13 @@ static void tg3_phy_stop(struct tg3 *tp)
if (!(tp->phy_flags & TG3_PHYFLG_IS_CONNECTED))
return;
- phy_stop(tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR]);
+ phy_stop(tp->mdio_bus->phy_map[tp->phy_addr]);
}
static void tg3_phy_fini(struct tg3 *tp)
{
if (tp->phy_flags & TG3_PHYFLG_IS_CONNECTED) {
- phy_disconnect(tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR]);
+ phy_disconnect(tp->mdio_bus->phy_map[tp->phy_addr]);
tp->phy_flags &= ~TG3_PHYFLG_IS_CONNECTED;
}
}
@@ -4034,7 +4034,7 @@ static int tg3_power_down_prepare(struct tg3 *tp)
struct phy_device *phydev;
u32 phyid, advertising;
- phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR];
+ phydev = tp->mdio_bus->phy_map[tp->phy_addr];
tp->phy_flags |= TG3_PHYFLG_IS_LOW_POWER;
@@ -11922,7 +11922,7 @@ static int tg3_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
struct phy_device *phydev;
if (!(tp->phy_flags & TG3_PHYFLG_IS_CONNECTED))
return -EAGAIN;
- phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR];
+ phydev = tp->mdio_bus->phy_map[tp->phy_addr];
return phy_ethtool_gset(phydev, cmd);
}
@@ -11989,7 +11989,7 @@ static int tg3_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
struct phy_device *phydev;
if (!(tp->phy_flags & TG3_PHYFLG_IS_CONNECTED))
return -EAGAIN;
- phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR];
+ phydev = tp->mdio_bus->phy_map[tp->phy_addr];
return phy_ethtool_sset(phydev, cmd);
}
@@ -12144,7 +12144,7 @@ static int tg3_nway_reset(struct net_device *dev)
if (tg3_flag(tp, USE_PHYLIB)) {
if (!(tp->phy_flags & TG3_PHYFLG_IS_CONNECTED))
return -EAGAIN;
- r = phy_start_aneg(tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR]);
+ r = phy_start_aneg(tp->mdio_bus->phy_map[tp->phy_addr]);
} else {
u32 bmcr;
@@ -12260,7 +12260,7 @@ static int tg3_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam
u32 newadv;
struct phy_device *phydev;
- phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR];
+ phydev = tp->mdio_bus->phy_map[tp->phy_addr];
if (!(phydev->supported & SUPPORTED_Pause) ||
(!(phydev->supported & SUPPORTED_Asym_Pause) &&
@@ -13696,7 +13696,7 @@ static int tg3_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
struct phy_device *phydev;
if (!(tp->phy_flags & TG3_PHYFLG_IS_CONNECTED))
return -EAGAIN;
- phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR];
+ phydev = tp->mdio_bus->phy_map[tp->phy_addr];
return phy_mii_ioctl(phydev, ifr, cmd);
}
@@ -17635,7 +17635,7 @@ static int tg3_init_one(struct pci_dev *pdev,
if (tp->phy_flags & TG3_PHYFLG_IS_CONNECTED) {
struct phy_device *phydev;
- phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR];
+ phydev = tp->mdio_bus->phy_map[tp->phy_addr];
netdev_info(dev,
"attached PHY driver [%s] (mii_bus:phy_addr=%s)\n",
phydev->drv->name, dev_name(&phydev->dev));
--
1.7.10.4
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 2/3] ssb: provide phy address for Gigabit Ethernet driver
2013-09-28 21:15 [PATCH 1/3] tg3: add support a phy at an address different than 01 Hauke Mehrtens
@ 2013-09-28 21:15 ` Hauke Mehrtens
2013-10-01 21:13 ` Nithin Nayak Sujir
2013-10-02 19:42 ` David Miller
2013-09-28 21:15 ` [PATCH 3/3] tg3: use phylib when robo switch is in use Hauke Mehrtens
` (3 subsequent siblings)
4 siblings, 2 replies; 10+ messages in thread
From: Hauke Mehrtens @ 2013-09-28 21:15 UTC (permalink / raw)
To: davem; +Cc: nsujir, mchan, netdev, Hauke Mehrtens
Add a function to provide the phy address which should be used to the
Gigabit Ethernet driver connected to ssb.
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
include/linux/ssb/ssb_driver_gige.h | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/include/linux/ssb/ssb_driver_gige.h b/include/linux/ssb/ssb_driver_gige.h
index 86a12b0..0688472 100644
--- a/include/linux/ssb/ssb_driver_gige.h
+++ b/include/linux/ssb/ssb_driver_gige.h
@@ -108,6 +108,16 @@ static inline int ssb_gige_get_macaddr(struct pci_dev *pdev, u8 *macaddr)
return 0;
}
+/* Get the device phy address */
+static inline int ssb_gige_get_phyaddr(struct pci_dev *pdev)
+{
+ struct ssb_gige *dev = pdev_to_ssb_gige(pdev);
+ if (!dev)
+ return -ENODEV;
+
+ return dev->dev->bus->sprom.et0phyaddr;
+}
+
extern int ssb_gige_pcibios_plat_dev_init(struct ssb_device *sdev,
struct pci_dev *pdev);
extern int ssb_gige_map_irq(struct ssb_device *sdev,
@@ -174,6 +184,10 @@ static inline int ssb_gige_get_macaddr(struct pci_dev *pdev, u8 *macaddr)
{
return -ENODEV;
}
+static inline int ssb_gige_get_phyaddr(struct pci_dev *pdev)
+{
+ return -ENODEV;
+}
#endif /* CONFIG_SSB_DRIVER_GIGE */
#endif /* LINUX_SSB_DRIVER_GIGE_H_ */
--
1.7.10.4
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH 2/3] ssb: provide phy address for Gigabit Ethernet driver
2013-09-28 21:15 ` [PATCH 2/3] ssb: provide phy address for Gigabit Ethernet driver Hauke Mehrtens
@ 2013-10-01 21:13 ` Nithin Nayak Sujir
2013-10-02 19:42 ` David Miller
1 sibling, 0 replies; 10+ messages in thread
From: Nithin Nayak Sujir @ 2013-10-01 21:13 UTC (permalink / raw)
To: Hauke Mehrtens; +Cc: davem, mchan, netdev
On 09/28/2013 02:15 PM, Hauke Mehrtens wrote:
> Add a function to provide the phy address which should be used to the
> Gigabit Ethernet driver connected to ssb.
>
> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
> ---
Reviewed-by: Nithin Nayak Sujir <nsujir@broadcom.com>
> include/linux/ssb/ssb_driver_gige.h | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/include/linux/ssb/ssb_driver_gige.h b/include/linux/ssb/ssb_driver_gige.h
> index 86a12b0..0688472 100644
> --- a/include/linux/ssb/ssb_driver_gige.h
> +++ b/include/linux/ssb/ssb_driver_gige.h
> @@ -108,6 +108,16 @@ static inline int ssb_gige_get_macaddr(struct pci_dev *pdev, u8 *macaddr)
> return 0;
> }
>
> +/* Get the device phy address */
> +static inline int ssb_gige_get_phyaddr(struct pci_dev *pdev)
> +{
> + struct ssb_gige *dev = pdev_to_ssb_gige(pdev);
> + if (!dev)
> + return -ENODEV;
> +
> + return dev->dev->bus->sprom.et0phyaddr;
> +}
> +
> extern int ssb_gige_pcibios_plat_dev_init(struct ssb_device *sdev,
> struct pci_dev *pdev);
> extern int ssb_gige_map_irq(struct ssb_device *sdev,
> @@ -174,6 +184,10 @@ static inline int ssb_gige_get_macaddr(struct pci_dev *pdev, u8 *macaddr)
> {
> return -ENODEV;
> }
> +static inline int ssb_gige_get_phyaddr(struct pci_dev *pdev)
> +{
> + return -ENODEV;
> +}
>
> #endif /* CONFIG_SSB_DRIVER_GIGE */
> #endif /* LINUX_SSB_DRIVER_GIGE_H_ */
>
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH 2/3] ssb: provide phy address for Gigabit Ethernet driver
2013-09-28 21:15 ` [PATCH 2/3] ssb: provide phy address for Gigabit Ethernet driver Hauke Mehrtens
2013-10-01 21:13 ` Nithin Nayak Sujir
@ 2013-10-02 19:42 ` David Miller
1 sibling, 0 replies; 10+ messages in thread
From: David Miller @ 2013-10-02 19:42 UTC (permalink / raw)
To: hauke; +Cc: nsujir, mchan, netdev
From: Hauke Mehrtens <hauke@hauke-m.de>
Date: Sat, 28 Sep 2013 23:15:27 +0200
> Add a function to provide the phy address which should be used to the
> Gigabit Ethernet driver connected to ssb.
>
> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Applied to net-next.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 3/3] tg3: use phylib when robo switch is in use
2013-09-28 21:15 [PATCH 1/3] tg3: add support a phy at an address different than 01 Hauke Mehrtens
2013-09-28 21:15 ` [PATCH 2/3] ssb: provide phy address for Gigabit Ethernet driver Hauke Mehrtens
@ 2013-09-28 21:15 ` Hauke Mehrtens
2013-10-01 21:12 ` Nithin Nayak Sujir
2013-10-02 19:42 ` David Miller
2013-10-01 20:12 ` [PATCH 1/3] tg3: add support a phy at an address different than 01 David Miller
` (2 subsequent siblings)
4 siblings, 2 replies; 10+ messages in thread
From: Hauke Mehrtens @ 2013-09-28 21:15 UTC (permalink / raw)
To: davem; +Cc: nsujir, mchan, netdev, Hauke Mehrtens
When a switch is connected as a PHY to the MAC driven by tg3, use
phylib and provide the phy address to tg3 from the sprom.
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
drivers/net/ethernet/broadcom/tg3.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 853a05e..a17a3c9 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -1513,6 +1513,13 @@ static int tg3_mdio_init(struct tg3 *tp)
TG3_CPMU_PHY_STRAP_IS_SERDES;
if (is_serdes)
tp->phy_addr += 7;
+ } else if (tg3_flag(tp, IS_SSB_CORE) && tg3_flag(tp, ROBOSWITCH)) {
+ int addr;
+
+ addr = ssb_gige_get_phyaddr(tp->pdev);
+ if (addr < 0)
+ return addr;
+ tp->phy_addr = addr;
} else
tp->phy_addr = TG3_PHY_MII_ADDR;
@@ -17366,8 +17373,10 @@ static int tg3_init_one(struct pci_dev *pdev,
tg3_flag_set(tp, FLUSH_POSTED_WRITES);
if (ssb_gige_one_dma_at_once(pdev))
tg3_flag_set(tp, ONE_DMA_AT_ONCE);
- if (ssb_gige_have_roboswitch(pdev))
+ if (ssb_gige_have_roboswitch(pdev)) {
+ tg3_flag_set(tp, USE_PHYLIB);
tg3_flag_set(tp, ROBOSWITCH);
+ }
if (ssb_gige_is_rgmii(pdev))
tg3_flag_set(tp, RGMII_MODE);
}
--
1.7.10.4
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH 3/3] tg3: use phylib when robo switch is in use
2013-09-28 21:15 ` [PATCH 3/3] tg3: use phylib when robo switch is in use Hauke Mehrtens
@ 2013-10-01 21:12 ` Nithin Nayak Sujir
2013-10-02 19:42 ` David Miller
1 sibling, 0 replies; 10+ messages in thread
From: Nithin Nayak Sujir @ 2013-10-01 21:12 UTC (permalink / raw)
To: Hauke Mehrtens; +Cc: davem, mchan, netdev
On 09/28/2013 02:15 PM, Hauke Mehrtens wrote:
> When a switch is connected as a PHY to the MAC driven by tg3, use
> phylib and provide the phy address to tg3 from the sprom.
>
> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
> ---
Acked-by: Nithin Nayak Sujir <nsujir@broadcom.com>
> drivers/net/ethernet/broadcom/tg3.c | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
> index 853a05e..a17a3c9 100644
> --- a/drivers/net/ethernet/broadcom/tg3.c
> +++ b/drivers/net/ethernet/broadcom/tg3.c
> @@ -1513,6 +1513,13 @@ static int tg3_mdio_init(struct tg3 *tp)
> TG3_CPMU_PHY_STRAP_IS_SERDES;
> if (is_serdes)
> tp->phy_addr += 7;
> + } else if (tg3_flag(tp, IS_SSB_CORE) && tg3_flag(tp, ROBOSWITCH)) {
> + int addr;
> +
> + addr = ssb_gige_get_phyaddr(tp->pdev);
> + if (addr < 0)
> + return addr;
> + tp->phy_addr = addr;
> } else
> tp->phy_addr = TG3_PHY_MII_ADDR;
>
> @@ -17366,8 +17373,10 @@ static int tg3_init_one(struct pci_dev *pdev,
> tg3_flag_set(tp, FLUSH_POSTED_WRITES);
> if (ssb_gige_one_dma_at_once(pdev))
> tg3_flag_set(tp, ONE_DMA_AT_ONCE);
> - if (ssb_gige_have_roboswitch(pdev))
> + if (ssb_gige_have_roboswitch(pdev)) {
> + tg3_flag_set(tp, USE_PHYLIB);
> tg3_flag_set(tp, ROBOSWITCH);
> + }
> if (ssb_gige_is_rgmii(pdev))
> tg3_flag_set(tp, RGMII_MODE);
> }
>
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH 3/3] tg3: use phylib when robo switch is in use
2013-09-28 21:15 ` [PATCH 3/3] tg3: use phylib when robo switch is in use Hauke Mehrtens
2013-10-01 21:12 ` Nithin Nayak Sujir
@ 2013-10-02 19:42 ` David Miller
1 sibling, 0 replies; 10+ messages in thread
From: David Miller @ 2013-10-02 19:42 UTC (permalink / raw)
To: hauke; +Cc: nsujir, mchan, netdev
From: Hauke Mehrtens <hauke@hauke-m.de>
Date: Sat, 28 Sep 2013 23:15:28 +0200
> When a switch is connected as a PHY to the MAC driven by tg3, use
> phylib and provide the phy address to tg3 from the sprom.
>
> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Applied to net-next.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/3] tg3: add support a phy at an address different than 01
2013-09-28 21:15 [PATCH 1/3] tg3: add support a phy at an address different than 01 Hauke Mehrtens
2013-09-28 21:15 ` [PATCH 2/3] ssb: provide phy address for Gigabit Ethernet driver Hauke Mehrtens
2013-09-28 21:15 ` [PATCH 3/3] tg3: use phylib when robo switch is in use Hauke Mehrtens
@ 2013-10-01 20:12 ` David Miller
2013-10-01 21:11 ` Nithin Nayak Sujir
2013-10-02 19:42 ` David Miller
4 siblings, 0 replies; 10+ messages in thread
From: David Miller @ 2013-10-01 20:12 UTC (permalink / raw)
To: hauke; +Cc: nsujir, mchan, netdev
Can I get a review from the Broadcom folks for this series please?
Thank you.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/3] tg3: add support a phy at an address different than 01
2013-09-28 21:15 [PATCH 1/3] tg3: add support a phy at an address different than 01 Hauke Mehrtens
` (2 preceding siblings ...)
2013-10-01 20:12 ` [PATCH 1/3] tg3: add support a phy at an address different than 01 David Miller
@ 2013-10-01 21:11 ` Nithin Nayak Sujir
2013-10-02 19:42 ` David Miller
4 siblings, 0 replies; 10+ messages in thread
From: Nithin Nayak Sujir @ 2013-10-01 21:11 UTC (permalink / raw)
To: Hauke Mehrtens; +Cc: davem, mchan, netdev
On 09/28/2013 02:15 PM, Hauke Mehrtens wrote:
> When phylib was in use tg3 only searched at address 01 on the mdio
> bus and did not work with any other address. On the BCM4705 SoCs the
> switch is connected as a PHY behind the MAC driven by tg3 and it is at
> PHY address 30 in most cases. This is a preparation patch to allow
> support for such switches.
>
> phy_addr is set to TG3_PHY_MII_ADDR for all devices, which are using
> phylib, so this should not change any behavior.
>
> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
> ---
Acked-by: Nithin Nayak Sujir <nsujir@broadcom.com>
> drivers/net/ethernet/broadcom/tg3.c | 38 +++++++++++++++++------------------
> 1 file changed, 19 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
> index 221a181..853a05e 100644
> --- a/drivers/net/ethernet/broadcom/tg3.c
> +++ b/drivers/net/ethernet/broadcom/tg3.c
> @@ -1375,7 +1375,7 @@ static int tg3_mdio_read(struct mii_bus *bp, int mii_id, int reg)
>
> spin_lock_bh(&tp->lock);
>
> - if (tg3_readphy(tp, reg, &val))
> + if (__tg3_readphy(tp, mii_id, reg, &val))
> val = -EIO;
>
> spin_unlock_bh(&tp->lock);
> @@ -1390,7 +1390,7 @@ static int tg3_mdio_write(struct mii_bus *bp, int mii_id, int reg, u16 val)
>
> spin_lock_bh(&tp->lock);
>
> - if (tg3_writephy(tp, reg, val))
> + if (__tg3_writephy(tp, mii_id, reg, val))
> ret = -EIO;
>
> spin_unlock_bh(&tp->lock);
> @@ -1408,7 +1408,7 @@ static void tg3_mdio_config_5785(struct tg3 *tp)
> u32 val;
> struct phy_device *phydev;
>
> - phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR];
> + phydev = tp->mdio_bus->phy_map[tp->phy_addr];
> switch (phydev->drv->phy_id & phydev->drv->phy_id_mask) {
> case PHY_ID_BCM50610:
> case PHY_ID_BCM50610M:
> @@ -1533,7 +1533,7 @@ static int tg3_mdio_init(struct tg3 *tp)
> tp->mdio_bus->read = &tg3_mdio_read;
> tp->mdio_bus->write = &tg3_mdio_write;
> tp->mdio_bus->reset = &tg3_mdio_reset;
> - tp->mdio_bus->phy_mask = ~(1 << TG3_PHY_MII_ADDR);
> + tp->mdio_bus->phy_mask = ~(1 << tp->phy_addr);
> tp->mdio_bus->irq = &tp->mdio_irq[0];
>
> for (i = 0; i < PHY_MAX_ADDR; i++)
> @@ -1554,7 +1554,7 @@ static int tg3_mdio_init(struct tg3 *tp)
> return i;
> }
>
> - phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR];
> + phydev = tp->mdio_bus->phy_map[tp->phy_addr];
>
> if (!phydev || !phydev->drv) {
> dev_warn(&tp->pdev->dev, "No PHY devices\n");
> @@ -1964,7 +1964,7 @@ static void tg3_setup_flow_control(struct tg3 *tp, u32 lcladv, u32 rmtadv)
> u32 old_tx_mode = tp->tx_mode;
>
> if (tg3_flag(tp, USE_PHYLIB))
> - autoneg = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR]->autoneg;
> + autoneg = tp->mdio_bus->phy_map[tp->phy_addr]->autoneg;
> else
> autoneg = tp->link_config.autoneg;
>
> @@ -2000,7 +2000,7 @@ static void tg3_adjust_link(struct net_device *dev)
> u8 oldflowctrl, linkmesg = 0;
> u32 mac_mode, lcl_adv, rmt_adv;
> struct tg3 *tp = netdev_priv(dev);
> - struct phy_device *phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR];
> + struct phy_device *phydev = tp->mdio_bus->phy_map[tp->phy_addr];
>
> spin_lock_bh(&tp->lock);
>
> @@ -2089,7 +2089,7 @@ static int tg3_phy_init(struct tg3 *tp)
> /* Bring the PHY back to a known state. */
> tg3_bmcr_reset(tp);
>
> - phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR];
> + phydev = tp->mdio_bus->phy_map[tp->phy_addr];
>
> /* Attach the MAC to the PHY. */
> phydev = phy_connect(tp->dev, dev_name(&phydev->dev),
> @@ -2116,7 +2116,7 @@ static int tg3_phy_init(struct tg3 *tp)
> SUPPORTED_Asym_Pause);
> break;
> default:
> - phy_disconnect(tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR]);
> + phy_disconnect(tp->mdio_bus->phy_map[tp->phy_addr]);
> return -EINVAL;
> }
>
> @@ -2134,7 +2134,7 @@ static void tg3_phy_start(struct tg3 *tp)
> if (!(tp->phy_flags & TG3_PHYFLG_IS_CONNECTED))
> return;
>
> - phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR];
> + phydev = tp->mdio_bus->phy_map[tp->phy_addr];
>
> if (tp->phy_flags & TG3_PHYFLG_IS_LOW_POWER) {
> tp->phy_flags &= ~TG3_PHYFLG_IS_LOW_POWER;
> @@ -2154,13 +2154,13 @@ static void tg3_phy_stop(struct tg3 *tp)
> if (!(tp->phy_flags & TG3_PHYFLG_IS_CONNECTED))
> return;
>
> - phy_stop(tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR]);
> + phy_stop(tp->mdio_bus->phy_map[tp->phy_addr]);
> }
>
> static void tg3_phy_fini(struct tg3 *tp)
> {
> if (tp->phy_flags & TG3_PHYFLG_IS_CONNECTED) {
> - phy_disconnect(tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR]);
> + phy_disconnect(tp->mdio_bus->phy_map[tp->phy_addr]);
> tp->phy_flags &= ~TG3_PHYFLG_IS_CONNECTED;
> }
> }
> @@ -4034,7 +4034,7 @@ static int tg3_power_down_prepare(struct tg3 *tp)
> struct phy_device *phydev;
> u32 phyid, advertising;
>
> - phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR];
> + phydev = tp->mdio_bus->phy_map[tp->phy_addr];
>
> tp->phy_flags |= TG3_PHYFLG_IS_LOW_POWER;
>
> @@ -11922,7 +11922,7 @@ static int tg3_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
> struct phy_device *phydev;
> if (!(tp->phy_flags & TG3_PHYFLG_IS_CONNECTED))
> return -EAGAIN;
> - phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR];
> + phydev = tp->mdio_bus->phy_map[tp->phy_addr];
> return phy_ethtool_gset(phydev, cmd);
> }
>
> @@ -11989,7 +11989,7 @@ static int tg3_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
> struct phy_device *phydev;
> if (!(tp->phy_flags & TG3_PHYFLG_IS_CONNECTED))
> return -EAGAIN;
> - phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR];
> + phydev = tp->mdio_bus->phy_map[tp->phy_addr];
> return phy_ethtool_sset(phydev, cmd);
> }
>
> @@ -12144,7 +12144,7 @@ static int tg3_nway_reset(struct net_device *dev)
> if (tg3_flag(tp, USE_PHYLIB)) {
> if (!(tp->phy_flags & TG3_PHYFLG_IS_CONNECTED))
> return -EAGAIN;
> - r = phy_start_aneg(tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR]);
> + r = phy_start_aneg(tp->mdio_bus->phy_map[tp->phy_addr]);
> } else {
> u32 bmcr;
>
> @@ -12260,7 +12260,7 @@ static int tg3_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam
> u32 newadv;
> struct phy_device *phydev;
>
> - phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR];
> + phydev = tp->mdio_bus->phy_map[tp->phy_addr];
>
> if (!(phydev->supported & SUPPORTED_Pause) ||
> (!(phydev->supported & SUPPORTED_Asym_Pause) &&
> @@ -13696,7 +13696,7 @@ static int tg3_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
> struct phy_device *phydev;
> if (!(tp->phy_flags & TG3_PHYFLG_IS_CONNECTED))
> return -EAGAIN;
> - phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR];
> + phydev = tp->mdio_bus->phy_map[tp->phy_addr];
> return phy_mii_ioctl(phydev, ifr, cmd);
> }
>
> @@ -17635,7 +17635,7 @@ static int tg3_init_one(struct pci_dev *pdev,
>
> if (tp->phy_flags & TG3_PHYFLG_IS_CONNECTED) {
> struct phy_device *phydev;
> - phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR];
> + phydev = tp->mdio_bus->phy_map[tp->phy_addr];
> netdev_info(dev,
> "attached PHY driver [%s] (mii_bus:phy_addr=%s)\n",
> phydev->drv->name, dev_name(&phydev->dev));
>
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH 1/3] tg3: add support a phy at an address different than 01
2013-09-28 21:15 [PATCH 1/3] tg3: add support a phy at an address different than 01 Hauke Mehrtens
` (3 preceding siblings ...)
2013-10-01 21:11 ` Nithin Nayak Sujir
@ 2013-10-02 19:42 ` David Miller
4 siblings, 0 replies; 10+ messages in thread
From: David Miller @ 2013-10-02 19:42 UTC (permalink / raw)
To: hauke; +Cc: nsujir, mchan, netdev
From: Hauke Mehrtens <hauke@hauke-m.de>
Date: Sat, 28 Sep 2013 23:15:26 +0200
> When phylib was in use tg3 only searched at address 01 on the mdio
> bus and did not work with any other address. On the BCM4705 SoCs the
> switch is connected as a PHY behind the MAC driven by tg3 and it is at
> PHY address 30 in most cases. This is a preparation patch to allow
> support for such switches.
>
> phy_addr is set to TG3_PHY_MII_ADDR for all devices, which are using
> phylib, so this should not change any behavior.
>
> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Applied to net-next.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2013-10-02 19:42 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-28 21:15 [PATCH 1/3] tg3: add support a phy at an address different than 01 Hauke Mehrtens
2013-09-28 21:15 ` [PATCH 2/3] ssb: provide phy address for Gigabit Ethernet driver Hauke Mehrtens
2013-10-01 21:13 ` Nithin Nayak Sujir
2013-10-02 19:42 ` David Miller
2013-09-28 21:15 ` [PATCH 3/3] tg3: use phylib when robo switch is in use Hauke Mehrtens
2013-10-01 21:12 ` Nithin Nayak Sujir
2013-10-02 19:42 ` David Miller
2013-10-01 20:12 ` [PATCH 1/3] tg3: add support a phy at an address different than 01 David Miller
2013-10-01 21:11 ` Nithin Nayak Sujir
2013-10-02 19:42 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.