Andrew McDonnell
2013-05-14 12:30:28 UTC
This patch allows a board to enable the mdio bus on the second ethernet port
provided by the AR7242 (as used in the D-Link DIR-632-A1.) The AR7242 (at
least on the dir632) has two ethernet, eth0 at 0x19000000 and eth1 at
0x1a000000, and both have enumerable mdio busses.
It further defaults to connecting eth1 to ag71xx-mdio.1 when registering eth1
with ath79 platform data.
Please note this superseded prior email with missing subject(!)
Signed-off-by: Andrew McDonnell <***@andrewmcdonnell.net>
---
.../linux/ar71xx/files/arch/mips/ath79/dev-eth.c | 19 +++++++++++++------
1 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
index 47e1350..cbd782d 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
@@ -183,6 +183,7 @@ void __init ath79_register_mdio(unsigned int id, u32 phy_mask)
if (ath79_soc == ATH79_SOC_AR9341 ||
ath79_soc == ATH79_SOC_AR9342 ||
ath79_soc == ATH79_SOC_AR9344 ||
+ ath79_soc == ATH79_SOC_AR7242 ||
ath79_soc == ATH79_SOC_QCA9556 ||
ath79_soc == ATH79_SOC_QCA9558)
max_id = 1;
@@ -202,6 +203,13 @@ void __init ath79_register_mdio(unsigned int id, u32
phy_mask)
mdio_data = &ath79_mdio1_data;
break;
+ case ATH79_SOC_AR7242:
+ ath79_set_pll(AR71XX_PLL_REG_SEC_CONFIG,
+ AR7242_PLL_REG_ETH0_INT_CLOCK, 0x62000000,
+ AR71XX_ETH0_PLL_SHIFT);
+ /* The driver in DD-WRT always has a 100ms delay after setting
the PLL */
+ udelay(100*1000);
+ /* fall through - the AR7242 has two eth ports */
case ATH79_SOC_AR9341:
case ATH79_SOC_AR9342:
case ATH79_SOC_AR9344:
@@ -216,11 +224,6 @@ void __init ath79_register_mdio(unsigned int id, u32
phy_mask)
}
break;
- case ATH79_SOC_AR7242:
- ath79_set_pll(AR71XX_PLL_REG_SEC_CONFIG,
- AR7242_PLL_REG_ETH0_INT_CLOCK, 0x62000000,
- AR71XX_ETH0_PLL_SHIFT);
- /* fall through */
default:
mdio_dev = &ath79_mdio0_device;
mdio_data = &ath79_mdio0_data;
@@ -236,7 +239,11 @@ void __init ath79_register_mdio(unsigned int id, u32
phy_mask)
case ATH79_SOC_AR7241:
mdio_data->builtin_switch = 1;
break;
-
+ case ATH79_SOC_AR7242:
+ if (id == 1) {
+ mdio_data->builtin_switch = 1;
+ }
+ break;
case ATH79_SOC_AR9330:
mdio_data->is_ar9330 = 1;
/* fall through */
provided by the AR7242 (as used in the D-Link DIR-632-A1.) The AR7242 (at
least on the dir632) has two ethernet, eth0 at 0x19000000 and eth1 at
0x1a000000, and both have enumerable mdio busses.
It further defaults to connecting eth1 to ag71xx-mdio.1 when registering eth1
with ath79 platform data.
Please note this superseded prior email with missing subject(!)
Signed-off-by: Andrew McDonnell <***@andrewmcdonnell.net>
---
.../linux/ar71xx/files/arch/mips/ath79/dev-eth.c | 19 +++++++++++++------
1 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
index 47e1350..cbd782d 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
@@ -183,6 +183,7 @@ void __init ath79_register_mdio(unsigned int id, u32 phy_mask)
if (ath79_soc == ATH79_SOC_AR9341 ||
ath79_soc == ATH79_SOC_AR9342 ||
ath79_soc == ATH79_SOC_AR9344 ||
+ ath79_soc == ATH79_SOC_AR7242 ||
ath79_soc == ATH79_SOC_QCA9556 ||
ath79_soc == ATH79_SOC_QCA9558)
max_id = 1;
@@ -202,6 +203,13 @@ void __init ath79_register_mdio(unsigned int id, u32
phy_mask)
mdio_data = &ath79_mdio1_data;
break;
+ case ATH79_SOC_AR7242:
+ ath79_set_pll(AR71XX_PLL_REG_SEC_CONFIG,
+ AR7242_PLL_REG_ETH0_INT_CLOCK, 0x62000000,
+ AR71XX_ETH0_PLL_SHIFT);
+ /* The driver in DD-WRT always has a 100ms delay after setting
the PLL */
+ udelay(100*1000);
+ /* fall through - the AR7242 has two eth ports */
case ATH79_SOC_AR9341:
case ATH79_SOC_AR9342:
case ATH79_SOC_AR9344:
@@ -216,11 +224,6 @@ void __init ath79_register_mdio(unsigned int id, u32
phy_mask)
}
break;
- case ATH79_SOC_AR7242:
- ath79_set_pll(AR71XX_PLL_REG_SEC_CONFIG,
- AR7242_PLL_REG_ETH0_INT_CLOCK, 0x62000000,
- AR71XX_ETH0_PLL_SHIFT);
- /* fall through */
default:
mdio_dev = &ath79_mdio0_device;
mdio_data = &ath79_mdio0_data;
@@ -236,7 +239,11 @@ void __init ath79_register_mdio(unsigned int id, u32
phy_mask)
case ATH79_SOC_AR7241:
mdio_data->builtin_switch = 1;
break;
-
+ case ATH79_SOC_AR7242:
+ if (id == 1) {
+ mdio_data->builtin_switch = 1;
+ }
+ break;
case ATH79_SOC_AR9330:
mdio_data->is_ar9330 = 1;
/* fall through */