From cc660eb4c795c7cf7f627d932bb7e82203a076aa Mon Sep 17 00:00:00 2001 From: Sham Muthayyan Date: Mon, 3 Sep 2018 20:57:06 +0530 Subject: [PATCH] ipq807x: Enabled napa and aquantia phy in DB-hk02 Change-Id: Iadaffde34e3af45905535423cb20ea71d0081644 Signed-off-by: Sham Muthayyan --- arch/arm/dts/ipq807x-db-hk02.dts | 34 ++++++++++++++++- drivers/net/ipq807x/ipq807x_aquantia_phy.c | 7 +--- drivers/net/ipq807x/ipq807x_edma.c | 44 ++++++++++++++++------ drivers/net/ipq807x/ipq807x_ppe.c | 2 +- drivers/net/ipq_common/ipq_phy.h | 1 + 5 files changed, 68 insertions(+), 20 deletions(-) diff --git a/arch/arm/dts/ipq807x-db-hk02.dts b/arch/arm/dts/ipq807x-db-hk02.dts index b63a2fdbff..07edf1514e 100644 --- a/arch/arm/dts/ipq807x-db-hk02.dts +++ b/arch/arm/dts/ipq807x-db-hk02.dts @@ -29,8 +29,38 @@ ess-switch { switch_mac_mode = <0x0>; switch_mac_mode1 = <0x2>; - switch_mac_mode2 = <0x1>; - 8033_port = <5>; + switch_mac_mode2 = <0x6>; + napa_gpio = <26>; + napa_gpio_cnt = <1>; + aquantia_port = <4>; + aquantia_gpio = <44>; + port_phyinfo { + port@0 { + phy_address = <0>; + phy_type = <1>; + }; + port@1 { + phy_address = <1>; + phy_type = <1>; + }; + port@2 { + phy_address = <2>; + phy_type = <1>; + }; + port@3 { + phy_address = <3>; + phy_type = <1>; + }; + port@4 { + phy_address = <15>; + phy_type = <3>; + }; + port@5 { + phy_address = <28>; + phy_type = <2>; + }; + }; + }; }; diff --git a/drivers/net/ipq807x/ipq807x_aquantia_phy.c b/drivers/net/ipq807x/ipq807x_aquantia_phy.c index 9618e2cf59..5396c16c64 100644 --- a/drivers/net/ipq807x/ipq807x_aquantia_phy.c +++ b/drivers/net/ipq807x/ipq807x_aquantia_phy.c @@ -204,7 +204,7 @@ int ipq_qca_aquantia_phy_init(struct phy_ops **ops, u32 phy_id) static int do_load_fw(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { - unsigned int phy_addr=0x7; + unsigned int phy_addr = AQU_PHY_ADDR; int node, aquantia_port; if (argc > 2) @@ -213,11 +213,6 @@ static int do_load_fw(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) if (argc == 2) phy_addr = simple_strtoul(argv[1], NULL, 16); - if (phy_addr != AQU_PHY_ADDR) { - printf("Phy address is not correct: use 0x7\n"); - return 0; - } - node = fdt_path_offset(gd->fdt_blob, "/ess-switch"); if (node < 0) { printf("Error: ess-switch not specified in dts"); diff --git a/drivers/net/ipq807x/ipq807x_edma.c b/drivers/net/ipq807x/ipq807x_edma.c index d1614c8b33..dea4b3fbec 100644 --- a/drivers/net/ipq807x/ipq807x_edma.c +++ b/drivers/net/ipq807x/ipq807x_edma.c @@ -961,9 +961,12 @@ static int ipq807x_eth_init(struct eth_device *eth_dev, bd_t *this) break; case FAL_SPEED_100: mac_speed = 0x1; - if (i == aquantia_port) - speed_clock1 = 0x109; - else if (i == port_8033) + if (i == aquantia_port) { + if (i == 4) + speed_clock1 = 0x309; + else + speed_clock1 = 0x109; + } else if (i == port_8033) speed_clock1 = 0x309; else speed_clock1 = 0x101; @@ -981,9 +984,12 @@ static int ipq807x_eth_init(struct eth_device *eth_dev, bd_t *this) break; case FAL_SPEED_1000: mac_speed = 0x2; - if (i == aquantia_port) - speed_clock1 = 0x104; - else if (i == port_8033) + if (i == aquantia_port) { + if (i == 4) + speed_clock1 = 0x304; + else + speed_clock1 = 0x104; + } else if (i == port_8033) speed_clock1 = 0x301; else speed_clock1 = 0x101; @@ -1015,20 +1021,36 @@ static int ipq807x_eth_init(struct eth_device *eth_dev, bd_t *this) else if (i == 5) speed_clock1 = 0x101; set_sgmii_mode(i, 0); + speed_clock2 = 0x0; + } + if (phy_info[i]->phy_type == AQ_PHY_TYPE) { + mac_speed = 0x4; + if (i == 4) { + speed_clock1 = 0x301; + speed_clock2 = 0x3; + } else if (i == 5) { + speed_clock1 = 0x107; + speed_clock2 = 0x0; + } } } else { speed_clock1 = 0x107; mac_speed = 0x4; + speed_clock2 = 0x0; } - speed_clock2 = 0x0; printf ("eth%d PHY%d %s Speed :%d %s duplex\n", priv->mac_unit, i, lstatus[status], speed, dp[duplex]); break; case FAL_SPEED_5000: mac_speed = 0x5; - speed_clock1 = 0x103; - speed_clock2 = 0x0; + if (i == 4) { + speed_clock1 = 0x301; + speed_clock2 = 0x1; + } else { + speed_clock1 = 0x103; + speed_clock2 = 0x0; + } printf ("eth%d PHY%d %s Speed :%d %s duplex\n", priv->mac_unit, i, lstatus[status], speed, dp[duplex]); @@ -1814,8 +1836,8 @@ int ipq807x_edma_init(void *edma_board_cfg) phy_chip_id2 = ipq_mdio_read(phy_addr, QCA_PHY_ID2, NULL); phy_chip_id = (phy_chip_id1 << 16) | phy_chip_id2; if (phy_id == aquantia_port) { - phy_chip_id1 = ipq_mdio_read(0x7, (1<<30) |(1<<16) | QCA_PHY_ID1, NULL); - phy_chip_id2 = ipq_mdio_read(0x7, (1<<30) |(1<<16) | QCA_PHY_ID2, NULL); + phy_chip_id1 = ipq_mdio_read(phy_addr, (1<<30) |(1<<16) | QCA_PHY_ID1, NULL); + phy_chip_id2 = ipq_mdio_read(phy_addr, (1<<30) |(1<<16) | QCA_PHY_ID2, NULL); phy_chip_id = (phy_chip_id1 << 16) | phy_chip_id2; } switch(phy_chip_id) { diff --git a/drivers/net/ipq807x/ipq807x_ppe.c b/drivers/net/ipq807x/ipq807x_ppe.c index a2ee92204a..029136817c 100644 --- a/drivers/net/ipq807x/ipq807x_ppe.c +++ b/drivers/net/ipq807x/ipq807x_ppe.c @@ -297,7 +297,7 @@ void ipq807x_uxsgmii_speed_set(int port, int speed, int duplex, /* Setting the speed only for PORT5 and PORT6 */ if (port == (PORT5 - PPE_UNIPHY_INSTANCE1)) uniphy_index = PPE_UNIPHY_INSTANCE1; - if (port == (PORT6 - PPE_UNIPHY_INSTANCE1)) + else if (port == (PORT6 - PPE_UNIPHY_INSTANCE1)) uniphy_index = PPE_UNIPHY_INSTANCE2; else return; diff --git a/drivers/net/ipq_common/ipq_phy.h b/drivers/net/ipq_common/ipq_phy.h index 05c1df77c3..b3d55f71e1 100644 --- a/drivers/net/ipq_common/ipq_phy.h +++ b/drivers/net/ipq_common/ipq_phy.h @@ -97,6 +97,7 @@ enum port_wrapper_cfg { enum phy_mode { MALIBU_PHY_TYPE = 1, QCA8081_PHY_TYPE = 2, + AQ_PHY_TYPE = 3, }; typedef struct {