diff mbox

[OpenWrt-Devel] ar71xx: fix qca956x ethernet initialization

Message ID 1457193194-1272-1-git-send-email-hackpascal@gmail.com
State Superseded
Headers show

Commit Message

Weijie Gao March 5, 2016, 3:53 p.m. UTC
Signed-off-by: Weijie Gao <hackpascal@gmail.com>

fix ticket #21520

---
 target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

Comments

John Crispin March 5, 2016, 3:56 p.m. UTC | #1
On 05/03/2016 16:53, Weijie Gao wrote:
> Signed-off-by: Weijie Gao <hackpascal@gmail.com>
> 
> fix ticket #21520


please write 2-3 words on what the patch does and why it is needed

	John
> 
> ---
>  target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c | 21 ++++++++++++++++++---
>  1 file changed, 18 insertions(+), 3 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 12a376e..b43c80a 100644
> --- a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
> +++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
> @@ -271,6 +271,7 @@ void __init ath79_register_mdio(unsigned int id, u32 phy_mask)
>  	case ATH79_SOC_QCA956X:
>  		if (id == 1)
>  			mdio_data->builtin_switch = 1;
> +		mdio_data->is_ar934x = 1;
>  		break;
>  
>  	default:
> @@ -1123,16 +1124,25 @@ void __init ath79_register_eth(unsigned int id)
>  		if (id == 0) {
>  			pdata->reset_bit = QCA955X_RESET_GE0_MAC |
>  					   QCA955X_RESET_GE0_MDIO;
> +
>  			if (pdata->phy_if_mode == PHY_INTERFACE_MODE_SGMII)
>  				pdata->set_speed = qca956x_set_speed_sgmii;
>  			else
> -				/* FIXME */
> -				pdata->set_speed = ath79_set_speed_dummy;
> +				pdata->set_speed = ath79_set_speed_ge0;
>  		} else {
>  			pdata->reset_bit = QCA955X_RESET_GE1_MAC |
>  					   QCA955X_RESET_GE1_MDIO;
> -			/* FIXME */
> +
>  			pdata->set_speed = ath79_set_speed_dummy;
> +
> +			pdata->switch_data = &ath79_switch_data;
> +
> +			pdata->speed = SPEED_1000;
> +			pdata->duplex = DUPLEX_FULL;
> +
> +			/* reset the built-in switch */
> +			ath79_device_reset_set(AR934X_RESET_ETH_SWITCH);
> +			ath79_device_reset_clear(AR934X_RESET_ETH_SWITCH);
>  		}
>  
>  		pdata->ddr_flush = ath79_ddr_no_flush;
> @@ -1196,6 +1206,11 @@ void __init ath79_register_eth(unsigned int id)
>  			/* don't assign any MDIO device by default */
>  			break;
>  
> +		case ATH79_SOC_QCA956X:
> +			if (pdata->phy_if_mode != PHY_INTERFACE_MODE_SGMII)
> +				pdata->mii_bus_dev = &ath79_mdio1_device.dev;
> +			break;
> +
>  		default:
>  			pdata->mii_bus_dev = &ath79_mdio0_device.dev;
>  			break;
>
diff mbox

Patch

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 12a376e..b43c80a 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
@@ -271,6 +271,7 @@  void __init ath79_register_mdio(unsigned int id, u32 phy_mask)
 	case ATH79_SOC_QCA956X:
 		if (id == 1)
 			mdio_data->builtin_switch = 1;
+		mdio_data->is_ar934x = 1;
 		break;
 
 	default:
@@ -1123,16 +1124,25 @@  void __init ath79_register_eth(unsigned int id)
 		if (id == 0) {
 			pdata->reset_bit = QCA955X_RESET_GE0_MAC |
 					   QCA955X_RESET_GE0_MDIO;
+
 			if (pdata->phy_if_mode == PHY_INTERFACE_MODE_SGMII)
 				pdata->set_speed = qca956x_set_speed_sgmii;
 			else
-				/* FIXME */
-				pdata->set_speed = ath79_set_speed_dummy;
+				pdata->set_speed = ath79_set_speed_ge0;
 		} else {
 			pdata->reset_bit = QCA955X_RESET_GE1_MAC |
 					   QCA955X_RESET_GE1_MDIO;
-			/* FIXME */
+
 			pdata->set_speed = ath79_set_speed_dummy;
+
+			pdata->switch_data = &ath79_switch_data;
+
+			pdata->speed = SPEED_1000;
+			pdata->duplex = DUPLEX_FULL;
+
+			/* reset the built-in switch */
+			ath79_device_reset_set(AR934X_RESET_ETH_SWITCH);
+			ath79_device_reset_clear(AR934X_RESET_ETH_SWITCH);
 		}
 
 		pdata->ddr_flush = ath79_ddr_no_flush;
@@ -1196,6 +1206,11 @@  void __init ath79_register_eth(unsigned int id)
 			/* don't assign any MDIO device by default */
 			break;
 
+		case ATH79_SOC_QCA956X:
+			if (pdata->phy_if_mode != PHY_INTERFACE_MODE_SGMII)
+				pdata->mii_bus_dev = &ath79_mdio1_device.dev;
+			break;
+
 		default:
 			pdata->mii_bus_dev = &ath79_mdio0_device.dev;
 			break;