From 5e1391e5b731fee090e9fb77e91f5764832b28bc Mon Sep 17 00:00:00 2001 From: speriaka Date: Thu, 30 May 2019 21:38:32 +0530 Subject: [PATCH] drivers: net: Update ppe config for all RDPs This patch adds ppe configs to support all ipq6018 RDPs Change-Id: Ief77106f46c2023f0f29322588850c1d1018d30a Signed-off-by: speriaka --- arch/arm/dts/ipq6018-cp03-c1.dts | 1 + drivers/net/ipq6018/ipq6018_ppe.c | 18 +++++++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/arch/arm/dts/ipq6018-cp03-c1.dts b/arch/arm/dts/ipq6018-cp03-c1.dts index 3686ef78de..05e2de992b 100644 --- a/arch/arm/dts/ipq6018-cp03-c1.dts +++ b/arch/arm/dts/ipq6018-cp03-c1.dts @@ -29,6 +29,7 @@ malibu_gpio = <75>; malibu_gpio_cnt = <1>; mdc_mdio_gpio = <64 65>; + malibu2port_phy = <1>; port_phyinfo { port@0 { phy_address = <0>; diff --git a/drivers/net/ipq6018/ipq6018_ppe.c b/drivers/net/ipq6018/ipq6018_ppe.c index 3c58d338df..32efb19747 100644 --- a/drivers/net/ipq6018/ipq6018_ppe.c +++ b/drivers/net/ipq6018/ipq6018_ppe.c @@ -1104,6 +1104,9 @@ static void ipq6018_ppe_e_sp_cfg_tbl_drr_id_set(int id) static void ppe_port_mux_set(int port_id, int port_type, int mode) { union port_mux_ctrl_u port_mux_ctrl; + int nodeoff; + + nodeoff = fdt_path_offset(gd->fdt_blob, "/ess-switch"); ipq6018_ppe_reg_read(IPQ6018_PORT_MUX_CTRL, &(port_mux_ctrl.val)); @@ -1114,7 +1117,10 @@ static void ppe_port_mux_set(int port_id, int port_type, int mode) port_mux_ctrl.bf.port3_pcs_sel = CPPE_PORT3_PCS_SEL_PCS0_CHANNEL2; port_mux_ctrl.bf.port4_pcs_sel = CPPE_PORT4_PCS_SEL_PCS0_SGMIIPLUS; } else if (mode == PORT_WRAPPER_PSGMII) { - port_mux_ctrl.bf.port3_pcs_sel = CPPE_PORT3_PCS_SEL_PCS0_CHANNEL2; + if (fdtdec_get_int(gd->fdt_blob, nodeoff, "malibu2port_phy", 0)) + port_mux_ctrl.bf.port3_pcs_sel = CPPE_PORT3_PCS_SEL_PCS0_CHANNEL4; + else + port_mux_ctrl.bf.port3_pcs_sel = CPPE_PORT3_PCS_SEL_PCS0_CHANNEL2; port_mux_ctrl.bf.port4_pcs_sel = CPPE_PORT4_PCS_SEL_PCS0_CHANNEL3; } break; @@ -1138,6 +1144,9 @@ static void ppe_port_mux_mac_type_set(int port_id, int mode) switch(mode) { + case PORT_WRAPPER_PSGMII: + port_type = PORT_GMAC_TYPE; + break; case PORT_WRAPPER_SGMII0_RGMII4: port_type = PORT_GMAC_TYPE; break; @@ -1184,7 +1193,9 @@ void ipq6018_ppe_interface_mode_init(void) ppe_uniphy_mode_set(PPE_UNIPHY_INSTANCE0, mode0); ppe_uniphy_mode_set(PPE_UNIPHY_INSTANCE1, mode1); - ppe_port_mux_mac_type_set(PORT5, mode1); + ppe_port_mux_mac_type_set(3, mode0); + ppe_port_mux_mac_type_set(4, mode0); + ppe_port_mux_mac_type_set(5, mode1); } /* @@ -1195,9 +1206,6 @@ void ipq6018_ppe_provision_init(void) int i; uint32_t queue; - /* Port4 Port5 port mux configuration, all GMAC */ - writel(0x10, 0x3a000010); - /* tdm/sched configuration */ ipq6018_ppe_tdm_configuration(); ipq6018_ppe_sched_configuration();