diff mbox

[U-Boot] net: phy/cortina: Add four phy addresses support

Message ID 1398826470-22516-1-git-send-email-Chunhe.Lan@freescale.com
State Superseded
Delegated to: York Sun
Headers show

Commit Message

Chunhe Lan April 30, 2014, 2:54 a.m. UTC
Before CORTINA driver only supports two phy addresses.
This patch adds the four phy addresses support for
CORTINA PHY module.

Signed-off-by: Chunhe Lan <Chunhe.Lan@freescale.com>
---
 drivers/net/phy/cortina.c |   28 ++++++++++++++++++++++------
 1 files changed, 22 insertions(+), 6 deletions(-)

Comments

York Sun July 18, 2014, 9:12 p.m. UTC | #1
On 04/29/2014 07:54 PM, Chunhe Lan wrote:
> Before CORTINA driver only supports two phy addresses.
> This patch adds the four phy addresses support for
> CORTINA PHY module.
> 
> Signed-off-by: Chunhe Lan <Chunhe.Lan@freescale.com>
> ---
>  drivers/net/phy/cortina.c |   28 ++++++++++++++++++++++------
>  1 files changed, 22 insertions(+), 6 deletions(-)
> 

Chunhe,

Does this patch depend on other patches? I don't see cortina.c file.

York
York Sun July 18, 2014, 9:20 p.m. UTC | #2
On 07/18/2014 02:12 PM, York Sun wrote:
> On 04/29/2014 07:54 PM, Chunhe Lan wrote:
>> Before CORTINA driver only supports two phy addresses.
>> This patch adds the four phy addresses support for
>> CORTINA PHY module.
>>
>> Signed-off-by: Chunhe Lan <Chunhe.Lan@freescale.com>
>> ---
>>  drivers/net/phy/cortina.c |   28 ++++++++++++++++++++++------
>>  1 files changed, 22 insertions(+), 6 deletions(-)
>>
> 
> Chunhe,
> 
> Does this patch depend on other patches? I don't see cortina.c file.
> 

Looks like you have this patch consolidated into this one
http://patchwork.ozlabs.org/patch/350162/.

Please confirm so we can drop this.

York
diff mbox

Patch

diff --git a/drivers/net/phy/cortina.c b/drivers/net/phy/cortina.c
index 7e46679..1b9434f 100644
--- a/drivers/net/phy/cortina.c
+++ b/drivers/net/phy/cortina.c
@@ -289,25 +289,41 @@  int phy_cortina_init(void)
 int get_phy_id(struct mii_dev *bus, int addr, int devad, u32 *phy_id)
 {
 	int phy_reg;
+	bool cortina_phy = false;
+
+	switch (addr) {
+#ifdef CORTINA_PHY_ADDR1
+	case CORTINA_PHY_ADDR1:
+#endif
+#ifdef CORTINA_PHY_ADDR2
+	case CORTINA_PHY_ADDR2:
+#endif
+#ifdef CORTINA_PHY_ADDR3
+	case CORTINA_PHY_ADDR3:
+#endif
+#ifdef CORTINA_PHY_ADDR4
+	case CORTINA_PHY_ADDR4:
+#endif
+		cortina_phy = true;
+		break;
+	default:
+		break;
+	}
 
-#if defined(CORTINA_PHY_ADDR1) || defined(CORTINA_PHY_ADDR2)
 	/* Cortina PHY has non-standard offset of PHY ID registers */
-	if (addr == CORTINA_PHY_ADDR1 || addr == CORTINA_PHY_ADDR2)
+	if (cortina_phy)
 		phy_reg = bus->read(bus, addr, 0, VILLA_GLOBAL_CHIP_ID_LSB);
 	else
-#endif
 		phy_reg = bus->read(bus, addr, devad, MII_PHYSID1);
 
 	if (phy_reg < 0)
 		return -EIO;
 
 	*phy_id = (phy_reg & 0xffff) << 16;
-#if defined(CORTINA_PHY_ADDR1) || defined(CORTINA_PHY_ADDR2)
 	/* Cortina PHY has non-standard offset of PHY ID registers */
-	if (addr == CORTINA_PHY_ADDR1 || addr == CORTINA_PHY_ADDR2)
+	if (cortina_phy)
 		phy_reg = bus->read(bus, addr, 0, VILLA_GLOBAL_CHIP_ID_MSB);
 	else
-#endif
 		phy_reg = bus->read(bus, addr, devad, MII_PHYSID2);
 
 	if (phy_reg < 0)