Patchwork [2/8] b44: rename B44_PHY_ADDR_NO_PHY to B44_PHY_ADDR_NO_LOCAL_PHY

login
register
mail settings
Submitter Hauke Mehrtens
Date Dec. 15, 2013, 6:41 p.m.
Message ID <1387132925-18651-3-git-send-email-hauke@hauke-m.de>
Download mbox | patch
Permalink /patch/301373/
State Changes Requested
Delegated to: David Miller
Headers show

Comments

Hauke Mehrtens - Dec. 15, 2013, 6:41 p.m.
The PHY address 30 means there is no local PHY, but there could be an
external PHY like a switch connected via MII. This is the case on most
embedded home routers where this driver is used.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 drivers/net/ethernet/broadcom/b44.c |    2 +-
 drivers/net/ethernet/broadcom/b44.h |    6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
Ben Hutchings - Dec. 16, 2013, 3:51 p.m.
On Sun, 2013-12-15 at 19:41 +0100, Hauke Mehrtens wrote:
> The PHY address 30 means there is no local PHY, but there could be an
> external PHY like a switch connected via MII. This is the case on most
> embedded home routers where this driver is used.
> 
> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
> ---
>  drivers/net/ethernet/broadcom/b44.c |    2 +-
>  drivers/net/ethernet/broadcom/b44.h |    6 +++---
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/ethernet/broadcom/b44.c b/drivers/net/ethernet/broadcom/b44.c
> index 3c7909e..fce36dd 100644
> --- a/drivers/net/ethernet/broadcom/b44.c
> +++ b/drivers/net/ethernet/broadcom/b44.c
> @@ -2237,7 +2237,7 @@ static int b44_init_one(struct ssb_device *sdev,
>  
>  	/* do a phy reset to test if there is an active phy */
>  	if (b44_phy_reset(bp) < 0)
> -		bp->phy_addr = B44_PHY_ADDR_NO_PHY;
> +		bp->phy_addr = B44_PHY_ADDR_NO_LOACL_PHY;

LOACL?

>  	netdev_info(dev, "%s %pM\n", DRV_DESCRIPTION, dev->dev_addr);
>  
> diff --git a/drivers/net/ethernet/broadcom/b44.h b/drivers/net/ethernet/broadcom/b44.h
> index 8ed7d6b..ade80d6 100644
> --- a/drivers/net/ethernet/broadcom/b44.h
> +++ b/drivers/net/ethernet/broadcom/b44.h
> @@ -280,9 +280,9 @@ struct ring_info {
>  	dma_addr_t	mapping;
>  };
>  
> -#define B44_MCAST_TABLE_SIZE	32
> -#define B44_PHY_ADDR_NO_PHY	30
> -#define B44_MDC_RATIO		5000000
> +#define B44_MCAST_TABLE_SIZE		32
> +#define B44_PHY_ADDR_NO_LOACL_PHY	30 /* no local phy regs */
> +#define B44_MDC_RATIO			5000000
>  
>  #define	B44_STAT_REG_DECLARE		\
>  	_B44(tx_good_octets)		\

At least it's spelt consistently wrongly. :-)

Ben.
Florian Fainelli - Dec. 16, 2013, 6:40 p.m.
2013/12/15 Hauke Mehrtens <hauke@hauke-m.de>:
> The PHY address 30 means there is no local PHY, but there could be an
> external PHY like a switch connected via MII. This is the case on most
> embedded home routers where this driver is used.

Looking at this some more, I do not think the b44 driver was always
clear that (at least in  Broadcom terminology):

- address 0 is a "special" broadcast MDIO address to make Roboswitch
devices act as standard PHYs such that you could read the MII_PHYSID1
and MII_PHYSID2 registers and determine if that is a switch or a PHY
- address 30 is the switch pseudo-PHY address through which all
switch-specifc settings must be routed from/to

So saying that address 30 means no "external PHY" is sort of correct,
although not quite. Hopefully the remaining patches try to remove that
ambiguity.

>
> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
> ---
>  drivers/net/ethernet/broadcom/b44.c |    2 +-
>  drivers/net/ethernet/broadcom/b44.h |    6 +++---
>  2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/ethernet/broadcom/b44.c b/drivers/net/ethernet/broadcom/b44.c
> index 3c7909e..fce36dd 100644
> --- a/drivers/net/ethernet/broadcom/b44.c
> +++ b/drivers/net/ethernet/broadcom/b44.c
> @@ -2237,7 +2237,7 @@ static int b44_init_one(struct ssb_device *sdev,
>
>         /* do a phy reset to test if there is an active phy */
>         if (b44_phy_reset(bp) < 0)
> -               bp->phy_addr = B44_PHY_ADDR_NO_PHY;
> +               bp->phy_addr = B44_PHY_ADDR_NO_LOACL_PHY;
>
>         netdev_info(dev, "%s %pM\n", DRV_DESCRIPTION, dev->dev_addr);
>
> diff --git a/drivers/net/ethernet/broadcom/b44.h b/drivers/net/ethernet/broadcom/b44.h
> index 8ed7d6b..ade80d6 100644
> --- a/drivers/net/ethernet/broadcom/b44.h
> +++ b/drivers/net/ethernet/broadcom/b44.h
> @@ -280,9 +280,9 @@ struct ring_info {
>         dma_addr_t      mapping;
>  };
>
> -#define B44_MCAST_TABLE_SIZE   32
> -#define B44_PHY_ADDR_NO_PHY    30
> -#define B44_MDC_RATIO          5000000
> +#define B44_MCAST_TABLE_SIZE           32
> +#define B44_PHY_ADDR_NO_LOACL_PHY      30 /* no local phy regs */
> +#define B44_MDC_RATIO                  5000000
>
>  #define        B44_STAT_REG_DECLARE            \
>         _B44(tx_good_octets)            \
> --
> 1.7.10.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
Hauke Mehrtens - Dec. 19, 2013, 1:21 a.m.
On 12/16/2013 07:40 PM, Florian Fainelli wrote:
> 2013/12/15 Hauke Mehrtens <hauke@hauke-m.de>:
>> The PHY address 30 means there is no local PHY, but there could be an
>> external PHY like a switch connected via MII. This is the case on most
>> embedded home routers where this driver is used.
> 
> Looking at this some more, I do not think the b44 driver was always
> clear that (at least in  Broadcom terminology):
> 
> - address 0 is a "special" broadcast MDIO address to make Roboswitch
> devices act as standard PHYs such that you could read the MII_PHYSID1
> and MII_PHYSID2 registers and determine if that is a switch or a PHY
> - address 30 is the switch pseudo-PHY address through which all
> switch-specifc settings must be routed from/to
> 
> So saying that address 30 means no "external PHY" is sort of correct,
> although not quite. Hopefully the remaining patches try to remove that
> ambiguity.

After all these patches B44_PHY_ADDR_NO_LOACL_PHY is not used any more
by b44.

The external interface was only activated when the register which will
not be used indicated that there is no internal phy.

>>
>> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
>> ---
>>  drivers/net/ethernet/broadcom/b44.c |    2 +-
>>  drivers/net/ethernet/broadcom/b44.h |    6 +++---
>>  2 files changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/broadcom/b44.c b/drivers/net/ethernet/broadcom/b44.c
>> index 3c7909e..fce36dd 100644
>> --- a/drivers/net/ethernet/broadcom/b44.c
>> +++ b/drivers/net/ethernet/broadcom/b44.c
>> @@ -2237,7 +2237,7 @@ static int b44_init_one(struct ssb_device *sdev,
>>
>>         /* do a phy reset to test if there is an active phy */
>>         if (b44_phy_reset(bp) < 0)
>> -               bp->phy_addr = B44_PHY_ADDR_NO_PHY;
>> +               bp->phy_addr = B44_PHY_ADDR_NO_LOACL_PHY;
>>
>>         netdev_info(dev, "%s %pM\n", DRV_DESCRIPTION, dev->dev_addr);
>>
>> diff --git a/drivers/net/ethernet/broadcom/b44.h b/drivers/net/ethernet/broadcom/b44.h
>> index 8ed7d6b..ade80d6 100644
>> --- a/drivers/net/ethernet/broadcom/b44.h
>> +++ b/drivers/net/ethernet/broadcom/b44.h
>> @@ -280,9 +280,9 @@ struct ring_info {
>>         dma_addr_t      mapping;
>>  };
>>
>> -#define B44_MCAST_TABLE_SIZE   32
>> -#define B44_PHY_ADDR_NO_PHY    30
>> -#define B44_MDC_RATIO          5000000
>> +#define B44_MCAST_TABLE_SIZE           32
>> +#define B44_PHY_ADDR_NO_LOACL_PHY      30 /* no local phy regs */
>> +#define B44_MDC_RATIO                  5000000
>>
>>  #define        B44_STAT_REG_DECLARE            \
>>         _B44(tx_good_octets)            \
>> --
>> 1.7.10.4
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe netdev" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 
> 

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/net/ethernet/broadcom/b44.c b/drivers/net/ethernet/broadcom/b44.c
index 3c7909e..fce36dd 100644
--- a/drivers/net/ethernet/broadcom/b44.c
+++ b/drivers/net/ethernet/broadcom/b44.c
@@ -2237,7 +2237,7 @@  static int b44_init_one(struct ssb_device *sdev,
 
 	/* do a phy reset to test if there is an active phy */
 	if (b44_phy_reset(bp) < 0)
-		bp->phy_addr = B44_PHY_ADDR_NO_PHY;
+		bp->phy_addr = B44_PHY_ADDR_NO_LOACL_PHY;
 
 	netdev_info(dev, "%s %pM\n", DRV_DESCRIPTION, dev->dev_addr);
 
diff --git a/drivers/net/ethernet/broadcom/b44.h b/drivers/net/ethernet/broadcom/b44.h
index 8ed7d6b..ade80d6 100644
--- a/drivers/net/ethernet/broadcom/b44.h
+++ b/drivers/net/ethernet/broadcom/b44.h
@@ -280,9 +280,9 @@  struct ring_info {
 	dma_addr_t	mapping;
 };
 
-#define B44_MCAST_TABLE_SIZE	32
-#define B44_PHY_ADDR_NO_PHY	30
-#define B44_MDC_RATIO		5000000
+#define B44_MCAST_TABLE_SIZE		32
+#define B44_PHY_ADDR_NO_LOACL_PHY	30 /* no local phy regs */
+#define B44_MDC_RATIO			5000000
 
 #define	B44_STAT_REG_DECLARE		\
 	_B44(tx_good_octets)		\