From 81aace4ad65d863c54707848bb3434e0bfcbd660 Mon Sep 17 00:00:00 2001 From: Murali Karicheri Date: Tue, 3 Sep 2019 11:08:36 -0400 Subject: [PATCH 1/4] Revert "arm64: dts: k3-am654-idk: add an overlay to support interposer card" This reverts commit 76be2dd8a254b446da0e56e1ab7fe04f7b131709. --- arch/arm64/boot/dts/ti/Makefile | 1 - .../boot/dts/ti/k3-am654-idk-interposer.dtso | 250 ------------------ 2 files changed, 251 deletions(-) delete mode 100644 arch/arm64/boot/dts/ti/k3-am654-idk-interposer.dtso diff --git a/arch/arm64/boot/dts/ti/Makefile b/arch/arm64/boot/dts/ti/Makefile index cf1f02544c5f85..ea9474ca5ff5b8 100644 --- a/arch/arm64/boot/dts/ti/Makefile +++ b/arch/arm64/boot/dts/ti/Makefile @@ -18,7 +18,6 @@ dtb-$(CONFIG_ARCH_K3_AM6_SOC) += k3-am654-base-board.dtb \ k3-am654-evm-csi2-ov490.dtbo \ k3-am654-evm-csi2-ov5640.dtbo \ k3-am654-idk.dtbo \ - k3-am654-idk-interposer.dtbo \ k3-am654-base-board-jailhouse.dtbo \ k3-am654-evm-prupwm.dtbo diff --git a/arch/arm64/boot/dts/ti/k3-am654-idk-interposer.dtso b/arch/arm64/boot/dts/ti/k3-am654-idk-interposer.dtso deleted file mode 100644 index 1345b0c75b2eff..00000000000000 --- a/arch/arm64/boot/dts/ti/k3-am654-idk-interposer.dtso +++ /dev/null @@ -1,250 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/** - * DT overlay for IDK application board with interposer card on AM654 EVM - * - * Copyright (C) 2018 Texas Instruments Incorporated - http://www.ti.com/ - */ - -/dts-v1/; -/plugin/; -#include -#include -#include -#include -#include - -/ { - fragment@101 { - target-path = "/"; - - __overlay__ { - aliases { - ethernet3 = "/pruss0_eth/ethernet-mii0"; - ethernet4 = "/pruss0_eth/ethernet-mii1"; - }; - - /* Dual Ethernet application node on PRU-ICSSG0 */ - pruss0_eth { - compatible = "ti,am654-dualicssg-prueth"; - pinctrl-names = "default"; - pinctrl-0 = <&icssg01_rgmii_pins_default>; - sram = <&msmc_ram>; - interrupt-parent = <&main_udmass_inta>; - - /* port-1, rx pru/rtu followed by port-2 tx pru/rtu, then port-1 rx and so forth */ - prus = <&pru0_0>, <&rtu0_0>, <&pru0_1>, <&rtu0_1>, <&pru1_0>, <&rtu1_0>, <&pru1_1>, <&rtu1_1>; - firmware-name = "ti-pruss/am65x-pru0-prueth-fw.elf", - "ti-pruss/am65x-rtu0-prueth-fw.elf", - "ti-pruss/am65x-pru1-prueth-fw.elf", - "ti-pruss/am65x-rtu1-prueth-fw.elf", - "ti-pruss/am65x-pru0-prueth-fw.elf", - "ti-pruss/am65x-rtu0-prueth-fw.elf", - "ti-pruss/am65x-pru1-prueth-fw.elf", - "ti-pruss/am65x-rtu1-prueth-fw.elf"; - mii-g-rt = <&icssg0_mii_g_rt>; - mii-g-rt-paired = <&icssg1_mii_g_rt>; - mii-rt = <&icssg0_mii_rt>; - mii-rt-paired = <&icssg1_mii_rt>; - - dma-coherent; - dmas = <&main_udmap &icssg0 4 UDMA_DIR_TX>, /* egress icssg0 slice 1 */ - <&main_udmap &icssg0 5 UDMA_DIR_TX>, /* egress icssg0 slice 1 */ - <&main_udmap &icssg0 6 UDMA_DIR_TX>, /* egress icssg0 slice 1 */ - <&main_udmap &icssg0 7 UDMA_DIR_TX>, /* mgmnt cmd icssg0 slice 1 */ - - <&main_udmap &icssg0 0 UDMA_DIR_RX>, /* ingress icssg0 slice 0 */ - <&main_udmap &icssg0 2 UDMA_DIR_RX>, /* ingress mgmnt rsp icssg0 slice 0 */ - - <&main_udmap &icssg1 4 UDMA_DIR_TX>, /* egress icssg1 slice 1 */ - <&main_udmap &icssg1 5 UDMA_DIR_TX>, /* egress icssg1 slice 1 */ - <&main_udmap &icssg1 6 UDMA_DIR_TX>, /* egress icssg1 slice 1 */ - <&main_udmap &icssg1 7 UDMA_DIR_TX>, /* mgmnt cmd icssg1 slice 1 */ - - <&main_udmap &icssg1 0 UDMA_DIR_RX>, /* ingress icssg1 slice 0 */ - <&main_udmap &icssg1 2 UDMA_DIR_RX>; /* mgmnt rsp icssg1 slice 0 */ - - /* 0-0 : icssg0, thread offset 0, 1-0, icssg1, thread offset 0 */ - dma-names = "tx0-0", "tx0-1", "tx0-2", "tx0-3", - "rx0", "rxmgm0", - "tx1-0", "tx1-1", "tx1-2", "tx1-3", - "rx1", "rxmgm1"; - - pruss0_emac0: ethernet-mii0 { - phy-handle = <&pruss0_eth0_phy>; - phy-mode = "rgmii-id"; - syscon-rgmii-delay = <&scm_conf 0x4114>; - /* Filled in by bootloader */ - local-mac-address = [00 00 00 00 00 00]; - }; - - pruss0_emac1: ethernet-mii1 { - phy-handle = <&pruss0_eth1_phy>; - phy-mode = "rgmii-id"; - syscon-rgmii-delay = <&scm_conf 0x4104>; - /* Filled in by bootloader */ - local-mac-address = [00 00 00 00 00 00]; - }; - }; - - gpio-decoder { - compatible = "gpio-decoder"; - gpios = <&pca9536 3 GPIO_ACTIVE_HIGH>, - <&pca9536 2 GPIO_ACTIVE_HIGH>, - <&pca9536 1 GPIO_ACTIVE_HIGH>, - <&pca9536 0 GPIO_ACTIVE_HIGH>; - linux,axis = <0>; /* ABS_X */ - decoder-max-value = <9>; - }; - }; - }; -}; - -&main_pmx0 { - icssg0_mdio_pins_default: icssg0_mdio_pins_default { - pinctrl-single,pins = < - AM65X_IOPAD(0x0294, PIN_INPUT, 0) /* (AE26) PRG0_MDIO0_MDIO */ - AM65X_IOPAD(0x0298, PIN_OUTPUT, 0) /* (AE28) PRG0_MDIO0_MDC */ - >; - }; - - icssg01_rgmii_pins_default: icssg01_rgmii_pins_default { - pinctrl-single,pins = < - AM65X_IOPAD(0x0244, PIN_INPUT, 2) /* (AB28) PRG0_PRU1_GPO0.PRG0_RGMII2_RD0 */ - AM65X_IOPAD(0x0248, PIN_INPUT, 2) /* (AC28) PRG0_PRU1_GPO1.PRG0_RGMII2_RD1 */ - AM65X_IOPAD(0x024c, PIN_INPUT, 2) /* (AC27) PRG0_PRU1_GPO2.PRG0_RGMII2_RD2 */ - AM65X_IOPAD(0x0250, PIN_INPUT, 2) /* (AB26) PRG0_PRU1_GPO3.PRG0_RGMII2_RD3 */ - AM65X_IOPAD(0x0274, PIN_OUTPUT, 2) /* (AC25) PRG0_PRU1_GPO12.PRG0_RGMII2_TD0 */ - AM65X_IOPAD(0x0278, PIN_OUTPUT, 2) /* (AD25) PRG0_PRU1_GPO13.PRG0_RGMII2_TD1 */ - AM65X_IOPAD(0x027c, PIN_OUTPUT, 2) /* (AD24) PRG0_PRU1_GPO14.PRG0_RGMII2_TD2 */ - AM65X_IOPAD(0x0280, PIN_OUTPUT, 2) /* (AE27) PRG0_PRU1_GPO15.PRG0_RGMII2_TD3 */ - AM65X_IOPAD(0x0284, PIN_INPUT, 2) /* (AC24) PRG0_PRU1_GPO16.PRG0_RGMII2_TXC */ - AM65X_IOPAD(0x0270, PIN_OUTPUT, 2) /* (AB24) PRG0_PRU1_GPO11.PRG0_RGMII2_TX_CTL */ - AM65X_IOPAD(0x025c, PIN_INPUT, 2) /* (AB27) PRG0_PRU1_GPO6.PRG0_RGMII2_RXC */ - AM65X_IOPAD(0x0254, PIN_INPUT, 2) /* (AA25) PRG0_PRU1_GPO4.PRG0_RGMII2_RX_CTL */ - - AM65X_IOPAD(0x01f4, PIN_INPUT, 2) /* (V24) PRG0_PRU0_GPO0.PRG0_RGMII1_RD0 */ - AM65X_IOPAD(0x01f8, PIN_INPUT, 2) /* (W25) PRG0_PRU0_GPO1.PRG0_RGMII1_RD1 */ - AM65X_IOPAD(0x01fc, PIN_INPUT, 2) /* (W24) PRG0_PRU0_GPO2.PRG0_RGMII1_RD2 */ - AM65X_IOPAD(0x0200, PIN_INPUT, 2) /* (AA27) PRG0_PRU0_GPO3.PRG0_RGMII1_RD3 */ - AM65X_IOPAD(0x0224, PIN_OUTPUT, 2) /* (AD27) PRG0_PRU0_GPO12.PRG0_RGMII1_TD0 */ - AM65X_IOPAD(0x0228, PIN_OUTPUT, 2) /* (AC26) PRG0_PRU0_GPO13.PRG0_RGMII1_TD1 */ - AM65X_IOPAD(0x022c, PIN_OUTPUT, 2) /* (AD26) PRG0_PRU0_GPO14.PRG0_RGMII1_TD2 */ - AM65X_IOPAD(0x0230, PIN_OUTPUT, 2) /* (AA24) PRG0_PRU0_GPO15.PRG0_RGMII1_TD3 */ - AM65X_IOPAD(0x0234, PIN_INPUT, 2) /* (AD28) PRG0_PRU0_GPO16.PRG0_RGMII1_TXC */ - AM65X_IOPAD(0x0220, PIN_OUTPUT, 2) /* (AB25) PRG0_PRU0_GPO11.PRG0_RGMII1_TX_CTL */ - AM65X_IOPAD(0x020c, PIN_INPUT, 2) /* (Y25) PRG0_PRU0_GPO6.PRG0_RGMII1_RXC */ - AM65X_IOPAD(0x0204, PIN_INPUT, 2) /* (Y24) PRG0_PRU0_GPO4.PRG0_RGMII1_RX_CTL */ - - AM65X_IOPAD(0x0130, PIN_INPUT, 2) /* (AH24) PRG1_PRU1_GPO0.PRG1_RGMII2_RD0 */ - AM65X_IOPAD(0x0134, PIN_INPUT, 2) /* (AH23) PRG1_PRU1_GPO1.PRG1_RGMII2_RD1 */ - AM65X_IOPAD(0x0138, PIN_INPUT, 2) /* (AG21) PRG1_PRU1_GPO2.PRG1_RGMII2_RD2 */ - AM65X_IOPAD(0x013c, PIN_INPUT, 2) /* (AH22) PRG1_PRU1_GPO3.PRG1_RGMII2_RD3 */ - AM65X_IOPAD(0x0160, PIN_OUTPUT, 2) /* (AE20) PRG1_PRU1_GPO12.PRG1_RGMII2_TD0 */ - AM65X_IOPAD(0x0164, PIN_OUTPUT, 2) /* (AF19) PRG1_PRU1_GPO13.PRG1_RGMII2_TD1 */ - AM65X_IOPAD(0x0168, PIN_OUTPUT, 2) /* (AH19) PRG1_PRU1_GPO14.PRG1_RGMII2_TD2 */ - AM65X_IOPAD(0x016c, PIN_OUTPUT, 2) /* (AG19) PRG1_PRU1_GPO15.PRG1_RGMII2_TD3 */ - AM65X_IOPAD(0x0170, PIN_INPUT, 2) /* (AE19) PRG1_PRU1_GPO16.PRG1_RGMII2_TXC */ - AM65X_IOPAD(0x015c, PIN_OUTPUT, 2) /* (AC20) PRG1_PRU1_GPO11.PRG1_RGMII2_TX_CTL */ - AM65X_IOPAD(0x0148, PIN_INPUT, 2) /* (AG22) PRG1_PRU1_GPO6.PRG1_RGMII2_RXC */ - AM65X_IOPAD(0x0140, PIN_INPUT, 2) /* (AE21) PRG1_PRU1_GPO4.PRG1_RGMII2_RX_CTL */ - - AM65X_IOPAD(0x00e0, PIN_INPUT, 2) /* (AE22) PRG1_PRU0_GPO0.PRG1_RGMII1_RD0 */ - AM65X_IOPAD(0x00e4, PIN_INPUT, 2) /* (AG24) PRG1_PRU0_GPO1.PRG1_RGMII1_RD1 */ - AM65X_IOPAD(0x00e8, PIN_INPUT, 2) /* (AF23) PRG1_PRU0_GPO2.PRG1_RGMII1_RD2 */ - AM65X_IOPAD(0x00ec, PIN_INPUT, 2) /* (AD21) PRG1_PRU0_GPO3.PRG1_RGMII1_RD3 */ - AM65X_IOPAD(0x0110, PIN_OUTPUT, 2) /* (AH20) PRG1_PRU0_GPO12.PRG1_RGMII1_TD0 */ - AM65X_IOPAD(0x0114, PIN_OUTPUT, 2) /* (AH21) PRG1_PRU0_GPO13.PRG1_RGMII1_TD1 */ - AM65X_IOPAD(0x0118, PIN_OUTPUT, 2) /* (AG20) PRG1_PRU0_GPO14.PRG1_RGMII1_TD2 */ - AM65X_IOPAD(0x011c, PIN_OUTPUT, 2) /* (AD19) PRG1_PRU0_GPO15.PRG1_RGMII1_TD3 */ - AM65X_IOPAD(0x0120, PIN_INPUT, 2) /* (AD20) PRG1_PRU0_GPO16.PRG1_RGMII1_TXC */ - AM65X_IOPAD(0x010c, PIN_OUTPUT, 2) /* (AF21) PRG1_PRU0_GPO11.PRG1_RGMII1_TX_CTL */ - AM65X_IOPAD(0x00f8, PIN_INPUT, 2) /* (AF22) PRG1_PRU0_GPO6.PRG1_RGMII1_RXC */ - AM65X_IOPAD(0x00f0, PIN_INPUT, 2) /* (AG23) PRG1_PRU0_GPO4.PRG1_RGMII1_RX_CTL */ - >; - }; - - mcan0_gpio_pins_default: mcan0_gpio_pins_default { - pinctrl-single,pins = < - AM65X_IOPAD(0x023c, PIN_INPUT, 7) /* (V25) PRG0_PRU0_GPIO18:GPIO1_47 */ - >; - }; - - mcan1_gpio_pins_default: mcan1_gpio_pins_default { - pinctrl-single,pins = < - AM65X_IOPAD(0x028c, PIN_INPUT, 7) /* (Y26) PRG0_PRU1_GPIO18.GPIO1_67 */ - >; - }; -}; - -&wkup_pmx0 { - - mcu_mcan0_pins_default: mcu_mcan0_pins_default { - pinctrl-single,pins = < - AM65X_WKUP_IOPAD(0x00ac, PIN_INPUT_PULLUP, 0) /* (W2) MCU_MCAN0_RX */ - AM65X_WKUP_IOPAD(0x00a8, PIN_OUTPUT_PULLUP, 0) /* (W1) MCU_MCAN0_TX */ - >; - }; - - mcu_mcan1_pins_default: mcu_mcan1_pins_default { - pinctrl-single,pins = < - AM65X_WKUP_IOPAD(0x00c4, PIN_INPUT_PULLUP, 1) /* (AD3) WKUP_GPIO0_5.MCU_MCAN1_RX */ - AM65X_WKUP_IOPAD(0x00c0, PIN_OUTPUT_PULLUP, 1) /* (AC3) WKUP_GPIO0_4.MCU_MCAN1_TX */ - >; - }; -}; - -&icssg0_mdio { - status = "okay"; - pinctrl-names = "default"; - pinctrl-0 = <&icssg0_mdio_pins_default>; - #address-cells = <1>; - #size-cells = <0>; - - pruss0_eth0_phy: ethernet-phy@0 { - reg = <0>; - ti,rx-internal-delay = ; - ti,tx-internal-delay = ; - ti,fifo-depth = ; - }; - - pruss0_eth1_phy: ethernet-phy@3 { - reg = <3>; - ti,rx-internal-delay = ; - ti,tx-internal-delay = ; - ti,fifo-depth = ; - }; -}; - -&m_can0 { - status = "okay"; - pinctrl-names = "default"; - pinctrl-0 = <&mcu_mcan0_pins_default &mcan0_gpio_pins_default>; - stb-gpios = <&main_gpio1 47 GPIO_ACTIVE_HIGH>; - can-transceiver { - max-bitrate = <5000000>; - }; -}; - -&m_can1 { - status = "okay"; - pinctrl-names = "default"; - pinctrl-0 = <&mcu_mcan1_pins_default &mcan1_gpio_pins_default>; - stb-gpios = <&main_gpio1 67 GPIO_ACTIVE_HIGH>; - can-transceiver { - max-bitrate = <5000000>; - }; -}; - -&main_i2c0 { - status = "okay"; - clock-frequency = <400000>; - #address-cells = <1>; - #size-cells = <0>; - - pca9536: gpio@41 { - compatible = "ti,pca9536"; - reg = <0x41>; - gpio-controller; - #gpio-cells = <2>; - }; -}; From cedcbfbfb435648cdc5d224a3cebd7d2b091dace Mon Sep 17 00:00:00 2001 From: Murali Karicheri Date: Tue, 3 Sep 2019 11:11:02 -0400 Subject: [PATCH 2/4] Revert "net: ti: icssg_prueth: Enhance the driver to support an icssg pair" This reverts commit d15598fa3dea5fa10b8ea483ea553cdc7308e4dc. Signed-off-by: Murali Karicheri --- drivers/net/ethernet/ti/icssg_ethtool.c | 44 +-- drivers/net/ethernet/ti/icssg_prueth.c | 488 +++++++----------------- drivers/net/ethernet/ti/icssg_prueth.h | 30 +- 3 files changed, 150 insertions(+), 412 deletions(-) diff --git a/drivers/net/ethernet/ti/icssg_ethtool.c b/drivers/net/ethernet/ti/icssg_ethtool.c index 0c00439110d7d1..7bc9385d6de5f7 100644 --- a/drivers/net/ethernet/ti/icssg_ethtool.c +++ b/drivers/net/ethernet/ti/icssg_ethtool.c @@ -265,37 +265,16 @@ static void emac_get_ethtool_stats(struct net_device *ndev, { struct prueth_emac *emac = netdev_priv(ndev); struct prueth *prueth = emac->prueth; - struct regmap *miig_rt; - int i, slice, icssg; - bool skip = false; - u32 base, val; - - icssg = emac->ingress_icssg; - miig_rt = prueth->miig_rt[icssg]; - slice = emac->ingress_slice; - base = stats_base[slice]; - if (!prueth->dual_icssg) { - for (i = 0; i < ARRAY_SIZE(icssg_ethtool_stats); i++) { - regmap_read(miig_rt, - base + icssg_ethtool_stats[i].offset, - &val); - data[i] = val; - } - } else { - for (i = 0; i < ARRAY_SIZE(icssg_ethtool_stats); i++) { - if (!skip && icssg_ethtool_stats[i].offset >= - offsetof(struct miig_stats_regs, tx_good_frames)) { - icssg = emac->egress_icssg; - slice = emac->egress_slice; - miig_rt = prueth->miig_rt[icssg]; - base = stats_base[slice]; - skip = true; - } - regmap_read(miig_rt, - base + icssg_ethtool_stats[i].offset, - &val); - data[i] = val; - } + int i; + int slice = prueth_emac_slice(emac); + u32 base = stats_base[slice]; + u32 val; + + for (i = 0; i < ARRAY_SIZE(icssg_ethtool_stats); i++) { + regmap_read(prueth->miig_rt, + base + icssg_ethtool_stats[i].offset, + &val); + data[i] = val; } } @@ -304,9 +283,6 @@ static int emac_get_ts_info(struct net_device *ndev, { struct prueth_emac *emac = netdev_priv(ndev); - if (emac->prueth->dual_icssg) - return -ENODEV; - info->so_timestamping = SOF_TIMESTAMPING_TX_HARDWARE | SOF_TIMESTAMPING_TX_SOFTWARE | diff --git a/drivers/net/ethernet/ti/icssg_prueth.c b/drivers/net/ethernet/ti/icssg_prueth.c index 0984daafa585a2..b9f72674b7fc0c 100644 --- a/drivers/net/ethernet/ti/icssg_prueth.c +++ b/drivers/net/ethernet/ti/icssg_prueth.c @@ -119,7 +119,6 @@ static void prueth_cleanup_tx_chns(struct prueth_emac *emac) static int prueth_init_tx_chns(struct prueth_emac *emac) { struct net_device *ndev = emac->ndev; - struct prueth *prueth = emac->prueth; struct device *dev = emac->prueth->dev; struct k3_nav_udmax_tx_channel_cfg tx_cfg; static const struct k3_ring_cfg ring_cfg = { @@ -129,10 +128,14 @@ static int prueth_init_tx_chns(struct prueth_emac *emac) .size = PRUETH_MAX_TX_DESC, }; u32 hdesc_size; - int ret; + int ret, slice; struct prueth_tx_chn *tx_chn = &emac->tx_chns; char tx_chn_name[16]; + slice = prueth_emac_slice(emac); + if (slice < 0) + return slice; + init_completion(&emac->tdown_complete); hdesc_size = cppi5_hdesc_calc_size(true, PRUETH_NAV_PS_DATA_SIZE, @@ -142,16 +145,8 @@ static int prueth_init_tx_chns(struct prueth_emac *emac) tx_cfg.tx_cfg = ring_cfg; tx_cfg.txcq_cfg = ring_cfg; - /* To differentiate channels. For Single ICSSG case, slice # - * is used and for Dual ICSSG case, icssg # used for naming - * the channel - */ - if (!prueth->dual_icssg) - snprintf(tx_chn_name, sizeof(tx_chn_name), "tx%d-0", - emac->egress_slice); - else - snprintf(tx_chn_name, sizeof(tx_chn_name), "tx%d-0", - emac->egress_icssg); + /* To differentiate channels for SLICE0 vs SLICE1 */ + snprintf(tx_chn_name, sizeof(tx_chn_name), "tx%d-0", slice); tx_chn->descs_num = PRUETH_MAX_TX_DESC; spin_lock_init(&tx_chn->lock); @@ -194,23 +189,18 @@ static int prueth_init_rx_chns(struct prueth_emac *emac, { struct net_device *ndev = emac->ndev; struct device *dev = emac->prueth->dev; - struct prueth *prueth = emac->prueth; struct k3_nav_udmax_rx_channel_cfg rx_cfg; u32 fdqring_id; u32 hdesc_size; - int i, ret = 0; + int i, ret = 0, slice; char rx_chn_name[16]; - /* To differentiate channels. For Single ICSSG case, slice # - * is used and for Dual ICSSG case, icssg # used for naming - * the channel - */ - if (!prueth->dual_icssg) - snprintf(rx_chn_name, sizeof(rx_chn_name), "%s%d", - name, emac->ingress_slice); - else - snprintf(rx_chn_name, sizeof(rx_chn_name), "%s%d", - name, emac->ingress_icssg); + slice = prueth_emac_slice(emac); + if (slice < 0) + return slice; + + /* To differentiate channels for SLICE0 vs SLICE1 */ + snprintf(rx_chn_name, sizeof(rx_chn_name), "%s%d", name, slice); hdesc_size = cppi5_hdesc_calc_size(true, PRUETH_NAV_PS_DATA_SIZE, PRUETH_NAV_SW_DATA_SIZE); @@ -864,37 +854,32 @@ static irqreturn_t prueth_tx_irq(int irq, void *dev_id) return IRQ_HANDLED; } -static void icssg_config_set(struct prueth *prueth, int icssg, int slice) +static void icssg_config_set(struct prueth *prueth, int slice) { void __iomem *va; - va = prueth->shram[icssg].va + slice * ICSSG_CONFIG_OFFSET_SLICE1; - memcpy_toio(va, &prueth->config[icssg][slice], - sizeof(prueth->config[slice])); + va = prueth->shram.va + slice * ICSSG_CONFIG_OFFSET_SLICE1; + memcpy_toio(va, &prueth->config[slice], sizeof(prueth->config[slice])); } -static int prueth_emac_start(struct prueth *prueth, - struct prueth_emac *emac, - bool ingress) +static int prueth_emac_start(struct prueth *prueth, struct prueth_emac *emac) { struct device *dev = prueth->dev; - int ret, icssg, slice; + int slice, ret; struct icssg_config *config; int i; - if (ingress) { - icssg = emac->ingress_icssg; - slice = emac->ingress_slice; - } else { - icssg = emac->egress_icssg; - slice = emac->egress_slice; + slice = prueth_emac_slice(emac); + if (slice < 0) { + netdev_err(emac->ndev, "invalid port\n"); + return -EINVAL; } /* Set Load time configuration */ - config = &prueth->config[icssg][slice]; + config = &prueth->config[slice]; memset(config, 0, sizeof(*config)); - config->addr_lo = cpu_to_le32(lower_32_bits(prueth->msmcram[icssg].pa)); - config->addr_hi = cpu_to_le32(upper_32_bits(prueth->msmcram[icssg].pa)); + config->addr_lo = cpu_to_le32(lower_32_bits(prueth->msmcram.pa)); + config->addr_hi = cpu_to_le32(upper_32_bits(prueth->msmcram.pa)); config->num_tx_threads = 0; config->rx_flow_id = emac->rx_flow_id_base; /* flow id for host port */ config->rx_mgr_flow_id = emac->rx_mgm_flow_id_base; /* for mgm ch */ @@ -904,50 +889,47 @@ static int prueth_emac_start(struct prueth *prueth, i < PRUETH_NUM_BUF_POOLS; i++) config->tx_buf_sz[i] = cpu_to_le32(PRUETH_EMAC_BUF_POOL_SIZE); - icssg_config_set(prueth, icssg, slice); + icssg_config_set(prueth, slice); - ret = rproc_boot(prueth->pru[icssg][slice]); + ret = rproc_boot(prueth->pru[slice]); if (ret) { - dev_err(dev, "failed to boot ICSSG %d PRU%d: %d\n", - icssg, slice, ret); + dev_err(dev, "failed to boot PRU%d: %d\n", slice, ret); return -EINVAL; } - ret = rproc_boot(prueth->rtu[icssg][slice]); + ret = rproc_boot(prueth->rtu[slice]); if (ret) { - dev_err(dev, "failed to boot ICSSG %d RTU%d: %d\n", - icssg, slice, ret); + dev_err(dev, "failed to boot RTU%d: %d\n", slice, ret); goto halt_pru; } return 0; halt_pru: - rproc_shutdown(prueth->pru[icssg][slice]); + rproc_shutdown(prueth->pru[slice]); return ret; } -static void prueth_emac_stop(struct prueth_emac *emac, bool ingress) +static void prueth_emac_stop(struct prueth_emac *emac) { struct prueth *prueth = emac->prueth; - int icssg, slice; + int slice; - if (!prueth->dual_icssg) { - icssg = emac->ingress_icssg; - slice = emac->ingress_slice; - } else { - if (ingress) { - icssg = emac->ingress_icssg; - slice = emac->ingress_slice; - } else { - icssg = emac->egress_icssg; - slice = emac->egress_slice; - } + switch (emac->port_id) { + case PRUETH_PORT_MII0: + slice = ICSS_SLICE0; + break; + case PRUETH_PORT_MII1: + slice = ICSS_SLICE1; + break; + default: + netdev_err(emac->ndev, "invalid port\n"); + return; } - rproc_shutdown(prueth->rtu[icssg][slice]); - rproc_shutdown(prueth->pru[icssg][slice]); + rproc_shutdown(prueth->rtu[slice]); + rproc_shutdown(prueth->pru[slice]); } /* called back by PHY layer if there is change in link state of hw port*/ @@ -956,24 +938,13 @@ static void emac_adjust_link(struct net_device *ndev) struct prueth_emac *emac = netdev_priv(ndev); struct phy_device *phydev = emac->phydev; bool gig_en = false, full_duplex = false; - struct regmap *miig_rt, *miig_rt_pair; struct prueth *prueth = emac->prueth; + int slice = prueth_emac_slice(emac); bool new_state = false; - struct regmap *mii_rt; unsigned long flags; spin_lock_irqsave(&emac->lock, flags); - if (!prueth->dual_icssg) { - miig_rt = prueth->miig_rt[emac->ingress_icssg]; - miig_rt_pair = NULL; - mii_rt = prueth->mii_rt[emac->egress_icssg]; - } else { - miig_rt = prueth->miig_rt[emac->ingress_icssg]; - miig_rt_pair = prueth->miig_rt[emac->egress_icssg]; - mii_rt = prueth->mii_rt[emac->egress_icssg]; - } - if (phydev->link) { /* check the mode of operation - full/half duplex */ if (phydev->duplex != emac->duplex) { @@ -1014,24 +985,16 @@ static void emac_adjust_link(struct net_device *ndev) full_duplex = true; /* Set the RGMII cfg for gig en and full duplex */ - icssg_update_rgmii_cfg(miig_rt, gig_en, - full_duplex, - emac->ingress_slice); - if (miig_rt_pair) - icssg_update_rgmii_cfg(miig_rt_pair, gig_en, - full_duplex, - emac->egress_slice); + icssg_update_rgmii_cfg(prueth->miig_rt, gig_en, + full_duplex, slice); /* update the Tx IPG based on 100M/1G speed */ - icssg_update_mii_rt_cfg(mii_rt, emac->speed, - emac->egress_slice); + icssg_update_mii_rt_cfg(prueth->mii_rt, emac->speed, + slice); } else { - icssg_update_rgmii_cfg(miig_rt, true, true, + icssg_update_rgmii_cfg(prueth->miig_rt, true, true, emac->port_id); - if (miig_rt_pair) - icssg_update_rgmii_cfg(miig_rt_pair, true, true, - emac->port_id); - icssg_update_mii_rt_cfg(mii_rt, emac->speed, - emac->egress_slice); + icssg_update_mii_rt_cfg(prueth->mii_rt, emac->speed, + slice); } } @@ -1109,29 +1072,17 @@ static int emac_ndo_open(struct net_device *ndev) struct device *dev = prueth->dev; int ret, i; struct sk_buff *skb; + int slice = prueth_emac_slice(emac); /* clear SMEM of this slice */ - /* clear the shram of correct icssg */ - if (!prueth->dual_icssg) { - memset_io(prueth->shram[emac->ingress_icssg].va + - emac->ingress_slice * ICSSG_CONFIG_OFFSET_SLICE1, - 0, ICSSG_CONFIG_OFFSET_SLICE1); - } else { - memset_io(prueth->shram[emac->ingress_icssg].va + - emac->ingress_slice * ICSSG_CONFIG_OFFSET_SLICE1, - 0, ICSSG_CONFIG_OFFSET_SLICE1); - memset_io(prueth->shram[emac->egress_icssg].va + - emac->egress_slice * ICSSG_CONFIG_OFFSET_SLICE1, - 0, ICSSG_CONFIG_OFFSET_SLICE1); - } - + memset_io(prueth->shram.va + slice * ICSSG_CONFIG_OFFSET_SLICE1, + 0, ICSSG_CONFIG_OFFSET_SLICE1); /* set h/w MAC as user might have re-configured */ ether_addr_copy(emac->mac_addr, ndev->dev_addr); - icssg_class_set_mac_addr(prueth->miig_rt[emac->ingress_icssg], - emac->ingress_slice, emac->mac_addr); - icssg_class_default(prueth->miig_rt[emac->ingress_icssg], - emac->ingress_slice); + icssg_class_set_mac_addr(prueth->miig_rt, slice, emac->mac_addr); + icssg_class_default(prueth->miig_rt, slice); + netif_carrier_off(ndev); ret = prueth_init_tx_chns(emac); @@ -1177,23 +1128,11 @@ static int emac_ndo_open(struct net_device *ndev) goto free_rx_irq; } - /* reset and start PRU firmware at egress. For Single ICSSG - * case, both egress and ingress icssg are the same. So just - * call it for egress. - */ - ret = prueth_emac_start(prueth, emac, false); + /* reset and start PRU firmware */ + ret = prueth_emac_start(prueth, emac); if (ret) goto free_rx_mgm_irq; - /* reset and start PRU firmware at ingress. For Dual ICSSG - * this reset and start the Ingress ICSSG. - */ - if (prueth->dual_icssg) { - ret = prueth_emac_start(prueth, emac, true); - if (ret) - goto error_egress; - } - /* start PHY */ phy_start(emac->phydev); @@ -1249,9 +1188,7 @@ static int emac_ndo_open(struct net_device *ndev) return 0; err: - prueth_emac_stop(emac, true); -error_egress: - prueth_emac_stop(emac, false); + prueth_emac_stop(emac); free_rx_mgm_irq: free_irq(emac->rx_mgm_chn.irq, emac); free_rx_irq: @@ -1286,8 +1223,7 @@ static int emac_ndo_stop(struct net_device *ndev) /* block packets from wire */ phy_stop(emac->phydev); - icssg_class_disable(prueth->miig_rt[emac->ingress_icssg], - emac->ingress_slice); + icssg_class_disable(prueth->miig_rt, prueth_emac_slice(emac)); /* tear down and disable UDMA channels */ reinit_completion(&emac->tdown_complete); @@ -1325,9 +1261,7 @@ static int emac_ndo_stop(struct net_device *ndev) napi_disable(&emac->napi_rx); /* stop PRUs */ - prueth_emac_stop(emac, false); - if (prueth->dual_icssg) - prueth_emac_stop(emac, true); + prueth_emac_stop(emac); free_irq(emac->rx_mgm_chn.irq, emac); free_irq(emac->rx_chns.irq, emac); @@ -1375,12 +1309,12 @@ static void emac_ndo_set_rx_mode(struct net_device *ndev) { struct prueth_emac *emac = netdev_priv(ndev); struct prueth *prueth = emac->prueth; - struct regmap *miig_rt = prueth->miig_rt[emac->ingress_icssg]; + int slice = prueth_emac_slice(emac); if (ndev->flags & IFF_PROMISC) { /* enable promiscuous */ if (!(emac->flags & IFF_PROMISC)) { - icssg_class_promiscuous(miig_rt, emac->ingress_slice); + icssg_class_promiscuous(prueth->miig_rt, slice); emac->flags |= IFF_PROMISC; } return; @@ -1389,7 +1323,7 @@ static void emac_ndo_set_rx_mode(struct net_device *ndev) } else { if (emac->flags & IFF_PROMISC) { /* local MAC + BC only */ - icssg_class_default(miig_rt, emac->ingress_slice); + icssg_class_default(prueth->miig_rt, slice); emac->flags &= ~IFF_PROMISC; } @@ -1435,9 +1369,6 @@ static int emac_set_ts_config(struct net_device *ndev, struct ifreq *ifr) struct hwtstamp_config config; int ret; - if (emac->prueth->dual_icssg) - return -ENODEV; - if (copy_from_user(&config, ifr->ifr_data, sizeof(config))) return -EFAULT; @@ -1458,9 +1389,6 @@ static int emac_get_ts_config(struct net_device *ndev, struct ifreq *ifr) struct prueth_emac *emac = netdev_priv(ndev); struct hwtstamp_config *config = &emac->tstamp_config; - if (emac->prueth->dual_icssg) - return -ENODEV; - return copy_to_user(ifr->ifr_data, config, sizeof(*config)) ? -EFAULT : 0; } @@ -1527,7 +1455,7 @@ static int prueth_netdev_init(struct prueth *prueth, const u8 *mac_addr; int ret; u32 refclk_freq; - struct regmap *iep_map = NULL; + struct regmap *iep_map; port = prueth_node_port(eth_node); if (port < 0) @@ -1542,14 +1470,12 @@ static int prueth_netdev_init(struct prueth *prueth, return -ENOMEM; emac = netdev_priv(ndev); - if (!prueth->dual_icssg) { - iep_map = syscon_regmap_lookup_by_phandle(eth_node, "iep"); - if (IS_ERR(iep_map)) { - ret = PTR_ERR(iep_map); - if (ret != -EPROBE_DEFER) - dev_err(prueth->dev, "couldn't get iep regmap\n"); - goto free; - } + iep_map = syscon_regmap_lookup_by_phandle(eth_node, "iep"); + if (IS_ERR(iep_map)) { + ret = PTR_ERR(iep_map); + if (ret != -EPROBE_DEFER) + dev_err(prueth->dev, "couldn't get iep regmap\n"); + goto free; } /* Firmware sets IEP clock to Vbus clk (250MHz) using internal mux. @@ -1562,23 +1488,6 @@ static int prueth_netdev_init(struct prueth *prueth, emac->prueth = prueth; emac->ndev = ndev; emac->port_id = port; - - if (!prueth->dual_icssg) { - emac->egress_icssg = ICSSG0; - emac->ingress_icssg = ICSSG0; - emac->egress_slice = (port == PRUETH_PORT_MII0) ? ICSS_SLICE0 : - ICSS_SLICE1; - emac->ingress_slice = emac->egress_slice; - } else { - /* Dual ICCSG. Mapping of ICSSG/SLICE to port */ - emac->egress_icssg = (port == PRUETH_PORT_MII0) ? - ICSSG1 : ICSSG0; - emac->egress_slice = ICSS_SLICE1; - emac->ingress_icssg = (port == PRUETH_PORT_MII0) ? - ICSSG0 : ICSSG1; - emac->ingress_slice = ICSS_SLICE0; - } - emac->msg_enable = netif_msg_init(debug_level, PRUETH_EMAC_DEBUG); spin_lock_init(&emac->lock); @@ -1633,12 +1542,9 @@ static int prueth_netdev_init(struct prueth *prueth, ndev->netdev_ops = &emac_netdev_ops; ndev->ethtool_ops = &icssg_ethtool_ops; - if (iep_map) { - ret = icssg_iep_init(&emac->iep, prueth->dev, iep_map, - refclk_freq); - if (ret) - goto free; - } + ret = icssg_iep_init(&emac->iep, prueth->dev, iep_map, refclk_freq); + if (ret) + goto free; netif_tx_napi_add(ndev, &emac->napi_tx, emac_napi_tx_poll, NAPI_POLL_WEIGHT); @@ -1675,8 +1581,7 @@ static void prueth_netdev_exit(struct prueth *prueth, netif_napi_del(&emac->napi_rx); netif_napi_del(&emac->napi_tx); - if (!prueth->dual_icssg) - icssg_iep_exit(&emac->iep); + icssg_iep_exit(&emac->iep); free_netdev(emac->ndev); prueth->emac[mac] = NULL; } @@ -1685,71 +1590,36 @@ static int prueth_get_cores(struct prueth *prueth, int slice) { struct device *dev = prueth->dev; struct device_node *np = dev->of_node; - int pru, rtu, paired_pru = -1, paired_rtu = -1, ret; + int pru, rtu, ret; switch (slice) { case ICSS_SLICE0: pru = 0; rtu = 1; - if (prueth->dual_icssg) { - paired_pru = 4; - paired_rtu = 5; - } break; case ICSS_SLICE1: pru = 2; rtu = 3; - if (prueth->dual_icssg) { - paired_pru = 6; - paired_rtu = 7; - } break; default: return -EINVAL; } - prueth->pru[ICSSG0][slice] = pru_rproc_get(np, pru); - if (IS_ERR(prueth->pru[ICSSG0][slice])) { - ret = PTR_ERR(prueth->pru[ICSSG0][slice]); - prueth->pru[ICSSG0][slice] = NULL; - if (ret != -EPROBE_DEFER) - dev_err(dev, "unable to get PRU%d slice %d: %d\n", - pru, slice, ret); - return ret; - } - - prueth->rtu[ICSSG0][slice] = pru_rproc_get(np, rtu); - if (IS_ERR(prueth->rtu[ICSSG0][slice])) { - ret = PTR_ERR(prueth->rtu[ICSSG0][slice]); - prueth->rtu[ICSSG0][slice] = NULL; - if (ret != -EPROBE_DEFER) - dev_err(dev, "unable to get RTU%d slice %d: %d\n", - rtu, slice, ret); - return ret; - } - - if (!prueth->dual_icssg) - return 0; - - prueth->pru[ICSSG1][slice] = pru_rproc_get(np, paired_pru); - if (IS_ERR(prueth->pru[ICSSG1][slice])) { - ret = PTR_ERR(prueth->pru[ICSSG1][slice]); - prueth->pru[ICSSG1][slice] = NULL; + prueth->pru[slice] = pru_rproc_get(np, pru); + if (IS_ERR(prueth->pru[slice])) { + ret = PTR_ERR(prueth->pru[slice]); + prueth->pru[slice] = NULL; if (ret != -EPROBE_DEFER) - dev_err(dev, - "unable to get Paired PRU%d slice %d: %d\n", - paired_pru, slice, ret); + dev_err(dev, "unable to get PRU%d: %d\n", slice, ret); return ret; } - prueth->rtu[ICSSG1][slice] = pru_rproc_get(np, paired_rtu); - if (IS_ERR(prueth->rtu[ICSSG1][slice])) { - ret = PTR_ERR(prueth->rtu[ICSSG1][slice]); - prueth->rtu[ICSSG1][slice] = NULL; + prueth->rtu[slice] = pru_rproc_get(np, rtu); + if (IS_ERR(prueth->rtu[slice])) { + ret = PTR_ERR(prueth->rtu[slice]); + prueth->rtu[slice] = NULL; if (ret != -EPROBE_DEFER) - dev_err(dev, - "unable to get Paired RTU%d slice %d: %d\n", - paired_rtu, slice, ret); + dev_err(dev, "unable to get RTU%d: %d\n", slice, ret); return ret; } @@ -1758,15 +1628,11 @@ static int prueth_get_cores(struct prueth *prueth, int slice) static void prueth_put_cores(struct prueth *prueth, int slice) { - if (prueth->rtu[ICSSG0][slice]) - pru_rproc_put(prueth->rtu[ICSSG0][slice]); - if (prueth->rtu[ICSSG1][slice]) - pru_rproc_put(prueth->rtu[ICSSG1][slice]); - - if (prueth->pru[ICSSG0][slice]) - pru_rproc_put(prueth->pru[ICSSG0][slice]); - if (prueth->pru[ICSSG1][slice]) - pru_rproc_put(prueth->pru[ICSSG1][slice]); + if (prueth->rtu[slice]) + pru_rproc_put(prueth->rtu[slice]); + + if (prueth->pru[slice]) + pru_rproc_put(prueth->pru[slice]); } static int prueth_config_rgmiidelay(struct prueth *prueth, @@ -1777,8 +1643,7 @@ static int prueth_config_rgmiidelay(struct prueth *prueth, u32 icssgctrl; struct device_node *np = dev->of_node; - if (!of_device_is_compatible(np, "ti,am654-icssg-prueth") && - !of_device_is_compatible(np, "ti,am654-dualicssg-prueth")) + if (!of_device_is_compatible(np, "ti,am654-icssg-prueth")) return 0; ctrl_mmr = syscon_regmap_lookup_by_phandle(eth_np, "syscon-rgmii-delay"); @@ -1807,8 +1672,8 @@ static int prueth_probe(struct platform_device *pdev) struct device_node *np = dev->of_node; struct device_node *eth0_node, *eth1_node; const struct of_device_id *match; - struct pruss *pruss[NUM_ICSSG]; - int i, ret, msmc_ram_size; + struct pruss *pruss; + int i, ret; if (!np) return -ENODEV; /* we don't support non DT */ @@ -1821,9 +1686,6 @@ static int prueth_probe(struct platform_device *pdev) if (!prueth) return -ENOMEM; - if (!strcmp(match->compatible, "ti,am654-dualicssg-prueth")) - prueth->dual_icssg = true; - platform_set_drvdata(pdev, prueth); prueth->dev = dev; @@ -1848,46 +1710,23 @@ static int prueth_probe(struct platform_device *pdev) prueth->eth_node[PRUETH_MAC0] = eth0_node; prueth->eth_node[PRUETH_MAC1] = eth1_node; - prueth->miig_rt[ICSSG0] = - syscon_regmap_lookup_by_phandle(np, "mii-g-rt"); - if (IS_ERR(prueth->miig_rt[ICSSG0])) { + prueth->miig_rt = syscon_regmap_lookup_by_phandle(np, "mii-g-rt"); + if (IS_ERR(prueth->miig_rt)) { dev_err(dev, "couldn't get mii-g-rt syscon regmap\n"); return -ENODEV; } - if (prueth->dual_icssg) { - prueth->miig_rt[ICSSG1] = - syscon_regmap_lookup_by_phandle(np, "mii-g-rt-paired"); - if (IS_ERR(prueth->miig_rt[ICSSG1])) { - dev_err(dev, "couldn't get mii-g-rt-paired syscon regmap\n"); - return -ENODEV; - } - } - - prueth->mii_rt[ICSSG0] = - syscon_regmap_lookup_by_phandle(np, "mii-rt"); - if (IS_ERR(prueth->mii_rt[ICSSG0])) { + prueth->mii_rt = syscon_regmap_lookup_by_phandle(np, "mii-rt"); + if (IS_ERR(prueth->mii_rt)) { dev_err(dev, "couldn't get mii-rt syscon regmap\n"); return -ENODEV; } - if (prueth->dual_icssg) { - prueth->mii_rt[ICSSG1] = - syscon_regmap_lookup_by_phandle(np, "mii-rt-paired"); - if (IS_ERR(prueth->mii_rt[ICSSG1])) { - dev_err(dev, "couldn't get mii-rt-paired syscon regmap\n"); - return -ENODEV; - } - } - if (eth0_node) { ret = prueth_config_rgmiidelay(prueth, eth0_node); if (ret) goto put_cores; - /* Get SLICE 0 cores. For Dual ICSG, it also gets SLICE0 - * of second ICSSG as well - */ ret = prueth_get_cores(prueth, ICSS_SLICE0); if (ret) goto put_cores; @@ -1898,56 +1737,29 @@ static int prueth_probe(struct platform_device *pdev) if (ret) goto put_cores; - /* Get SLICE 0 cores. For Dual ICSG, it also gets SLICE0 - * of second ICSSG as well - */ ret = prueth_get_cores(prueth, ICSS_SLICE1); if (ret) goto put_cores; } - /* prueth->pruss_id is a dummy id for now */ - pruss[ICSSG0] = pruss_get(eth0_node ? - prueth->pru[ICSSG0][ICSS_SLICE0] : - prueth->pru[ICSSG0][ICSS_SLICE1], - &prueth->pruss_id[ICSSG0]); - if (IS_ERR(pruss[ICSSG0])) { - ret = PTR_ERR(pruss[ICSSG0]); + pruss = pruss_get(eth0_node ? + prueth->pru[ICSS_SLICE0] : prueth->pru[ICSS_SLICE1], + &prueth->pruss_id); + if (IS_ERR(pruss)) { + ret = PTR_ERR(pruss); dev_err(dev, "unable to get pruss handle\n"); goto put_cores; } - prueth->pruss[ICSSG0] = pruss[ICSSG0]; + prueth->pruss = pruss; - ret = pruss_request_mem_region(pruss[ICSSG0], PRUSS_MEM_SHRD_RAM2, - &prueth->shram[ICSSG0]); + ret = pruss_request_mem_region(pruss, PRUSS_MEM_SHRD_RAM2, + &prueth->shram); if (ret) { dev_err(dev, "unable to get PRUSS SHRD RAM2: %d\n", ret); goto put_mem; } - if (prueth->dual_icssg) { - pruss[ICSSG1] = pruss_get(eth0_node ? - prueth->pru[ICSSG1][ICSS_SLICE0] : - prueth->pru[ICSSG1][ICSS_SLICE1], - &prueth->pruss_id[ICSSG1]); - if (IS_ERR(pruss[ICSSG1])) { - ret = PTR_ERR(pruss[ICSSG1]); - dev_err(dev, "unable to get pruss handle\n"); - goto put_cores; - } - - prueth->pruss[ICSSG1] = pruss[ICSSG1]; - ret = pruss_request_mem_region(pruss[ICSSG1], - PRUSS_MEM_SHRD_RAM2, - &prueth->shram[ICSSG1]); - if (ret) { - dev_err(dev, - "unable to get PRUSS SHRD RAM2: %d\n", ret); - goto put_mem; - } - } - prueth->sram_pool = of_gen_pool_get(np, "sram", 0); if (!prueth->sram_pool) { dev_err(dev, "unable to get SRAM pool\n"); @@ -1955,42 +1767,19 @@ static int prueth_probe(struct platform_device *pdev) goto put_mem; } - - msmc_ram_size = MSMC_RAM_SIZE; - if (prueth->dual_icssg) - msmc_ram_size *= 2; - - /* Get pool for both ICSSG and split it */ - prueth->msmcram[ICSSG0].va = - (void __iomem *)gen_pool_alloc(prueth->sram_pool, msmc_ram_size); - if (!prueth->msmcram[ICSSG0].va) { + prueth->msmcram.va = + (void __iomem *)gen_pool_alloc(prueth->sram_pool, + MSMC_RAM_SIZE); + if (!prueth->msmcram.va) { ret = -ENOMEM; dev_err(dev, "unable to allocate MSMC resource\n"); goto put_mem; } - prueth->msmcram[ICSSG0].pa = - gen_pool_virt_to_phys(prueth->sram_pool, - (unsigned long) - prueth->msmcram[ICSSG0].va); - - prueth->msmcram[ICSSG0].size = MSMC_RAM_SIZE; - if (prueth->dual_icssg) { - prueth->msmcram[ICSSG1].va = - prueth->msmcram[ICSSG0].va + MSMC_RAM_SIZE; - prueth->msmcram[ICSSG1].pa = - prueth->msmcram[ICSSG0].pa + MSMC_RAM_SIZE; - prueth->msmcram[ICSSG1].size = MSMC_RAM_SIZE; - } - - dev_dbg(dev, "sram: ICSSG0 pa %pa va %p size %zx\n", - &prueth->msmcram[ICSSG0].pa, - prueth->msmcram[ICSSG0].va, prueth->msmcram[ICSSG0].size); - if (prueth->dual_icssg) { - dev_dbg(dev, "sram: ICSSG0 pa %pa va %p size %zx\n", - &prueth->msmcram[ICSSG1].pa, - prueth->msmcram[ICSSG1].va, - prueth->msmcram[ICSSG1].size); - } + prueth->msmcram.pa = gen_pool_virt_to_phys(prueth->sram_pool, + (unsigned long)prueth->msmcram.va); + prueth->msmcram.size = MSMC_RAM_SIZE; + dev_dbg(dev, "sram: pa %llx va %p size %zx\n", prueth->msmcram.pa, + prueth->msmcram.va, prueth->msmcram.size); /* setup netdev interfaces */ if (eth0_node) { @@ -2036,10 +1825,8 @@ static int prueth_probe(struct platform_device *pdev) prueth->registered_netdevs[PRUETH_MAC1] = prueth->emac[PRUETH_MAC1]->ndev; } - dev_info(dev, - "TI PRU ethernet initialized: %s EMAC mode, dual_icssg %d\n", - (!eth0_node || !eth1_node) ? "single" : "dual", - prueth->dual_icssg); + dev_info(dev, "TI PRU ethernet driver initialized: %s EMAC mode\n", + (!eth0_node || !eth1_node) ? "single" : "dual"); if (eth1_node) of_node_put(eth1_node); @@ -2068,16 +1855,11 @@ static int prueth_probe(struct platform_device *pdev) free_pool: gen_pool_free(prueth->sram_pool, - (unsigned long)prueth->msmcram[0].va, msmc_ram_size); + (unsigned long)prueth->msmcram.va, MSMC_RAM_SIZE); put_mem: - pruss_release_mem_region(prueth->pruss[ICSSG0], &prueth->shram[ICSSG0]); - pruss_put(prueth->pruss[ICSSG0]); - if (prueth->pruss[ICSSG1]) { - pruss_release_mem_region(prueth->pruss[ICSSG1], - &prueth->shram[ICSSG1]); - pruss_put(prueth->pruss[ICSSG1]); - } + pruss_release_mem_region(prueth->pruss, &prueth->shram); + pruss_put(prueth->pruss); put_cores: if (eth1_node) { @@ -2113,22 +1895,13 @@ static int prueth_remove(struct platform_device *pdev) prueth_netdev_exit(prueth, eth_node); } - if (prueth->dual_icssg) - gen_pool_free(prueth->sram_pool, - (unsigned long)prueth->msmcram[ICSSG0].va, - MSMC_RAM_SIZE * 2); - else - gen_pool_free(prueth->sram_pool, - (unsigned long)prueth->msmcram[ICSSG0].va, - MSMC_RAM_SIZE); + gen_pool_free(prueth->sram_pool, + (unsigned long)prueth->msmcram.va, + MSMC_RAM_SIZE); - pruss_release_mem_region(prueth->pruss[ICSSG0], &prueth->shram[ICSSG0]); - pruss_put(prueth->pruss[ICSSG0]); - if (prueth->dual_icssg) { - pruss_release_mem_region(prueth->pruss[ICSSG1], - &prueth->shram[ICSSG1]); - pruss_put(prueth->pruss[ICSSG1]); - } + pruss_release_mem_region(prueth->pruss, &prueth->shram); + + pruss_put(prueth->pruss); if (prueth->eth_node[PRUETH_MAC1]) prueth_put_cores(prueth, ICSS_SLICE1); @@ -2197,7 +1970,6 @@ static const struct dev_pm_ops prueth_dev_pm_ops = { static const struct of_device_id prueth_dt_match[] = { { .compatible = "ti,am654-icssg-prueth", }, - { .compatible = "ti,am654-dualicssg-prueth", }, { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, prueth_dt_match); diff --git a/drivers/net/ethernet/ti/icssg_prueth.h b/drivers/net/ethernet/ti/icssg_prueth.h index 26c11733fc8664..fe32f22455251c 100644 --- a/drivers/net/ethernet/ti/icssg_prueth.h +++ b/drivers/net/ethernet/ti/icssg_prueth.h @@ -36,11 +36,6 @@ #define ICSS_SLICE0 0 #define ICSS_SLICE1 1 -/* below used to support 2 icssg per pru port */ -#define ICSSG0 0 -#define ICSSG1 1 -#define NUM_ICSSG 2 - #define ICSS_FW_PRU 0 #define ICSS_FW_RTU 1 @@ -116,10 +111,7 @@ struct prueth_emac { struct napi_struct napi_tx; struct napi_struct napi_rx; u32 msg_enable; - int egress_icssg; - int egress_slice; - int ingress_icssg; - int ingress_slice; + int link; int speed; int duplex; @@ -170,23 +162,21 @@ struct prueth_emac { */ struct prueth { struct device *dev; - struct pruss *pruss[NUM_ICSSG]; - struct rproc *pru[NUM_ICSSG][PRUSS_NUM_PRUS]; - struct rproc *rtu[NUM_ICSSG][PRUSS_NUM_PRUS]; - struct pruss_mem_region shram[NUM_ICSSG]; + struct pruss *pruss; + struct rproc *pru[PRUSS_NUM_PRUS]; + struct rproc *rtu[PRUSS_NUM_PRUS]; + struct pruss_mem_region shram; struct gen_pool *sram_pool; - struct pruss_mem_region msmcram[NUM_ICSSG]; + struct pruss_mem_region msmcram; struct device_node *eth_node[PRUETH_NUM_MACS]; struct prueth_emac *emac[PRUETH_NUM_MACS]; struct net_device *registered_netdevs[PRUETH_NUM_MACS]; const struct prueth_private_data *fw_data; - struct icssg_config config[NUM_ICSSG][PRUSS_NUM_PRUS]; - struct regmap *miig_rt[NUM_ICSSG]; - struct regmap *mii_rt[NUM_ICSSG]; - int pruss_id[NUM_ICSSG]; - /* For boards with dual icss per prueth port, this will be true */ - bool dual_icssg; + int pruss_id; + struct icssg_config config[PRUSS_NUM_PRUS]; + struct regmap *miig_rt; + struct regmap *mii_rt; }; struct emac_tx_ts_response { From f418de2d43319b551f0010d6d7d5e525f12fcbc2 Mon Sep 17 00:00:00 2001 From: Murali Karicheri Date: Fri, 25 Oct 2019 14:56:58 -0400 Subject: [PATCH 3/4] Revert "dt-bindings: net: ti,icssg-prueth: update to clarify dual icssg usage" This reverts commit 453a15776ebedc63fa1f46d02ef0eff503e27f29. --- .../bindings/net/ti,icssg-prueth.txt | 129 +++--------------- 1 file changed, 22 insertions(+), 107 deletions(-) diff --git a/Documentation/devicetree/bindings/net/ti,icssg-prueth.txt b/Documentation/devicetree/bindings/net/ti,icssg-prueth.txt index ba7df698f0aca7..d439e2d996808d 100644 --- a/Documentation/devicetree/bindings/net/ti,icssg-prueth.txt +++ b/Documentation/devicetree/bindings/net/ti,icssg-prueth.txt @@ -4,8 +4,7 @@ Texas Instruments ICSSG PRUSS Ethernet Required properties: - compatible : Should be "ti,am654-icssg-prueth" for AM65x Family SoCs Should be "ti,am654-dualicssg-prueth" for AM65x Family - SoCs when ICSSG0 and ICSSG1 are paired. See more details - below on pairing of ICSSGs. + SoCs when ICSSG0 and ICSSG1 are paired. - prus : list of pHandles to the PRU and RTU nodes - firmware-name : should contain the name of the firmware image file located in the firmware search path @@ -17,31 +16,11 @@ Required properties: "tx1-0", "tx1-1", "tx1-2", "tx1-3", "rx0", "rx1", "rxmgm0", "rxmgm1" - mii-g-rt : phandle to MII_G_RT module's syscon regmap. - +- mii-g-rt-paired : phandle to paired ICSSG's MII_G_RT module's syscon + regmap. - mii-rt : phandle to MII_RT module's syscon regmap. - -Below DT properties are used when an interposer card is connected between the -IDK application board and AM65x base board. In this configuration, ICSSG0 and -ICSSG1 are paired or combined to provide a pair of Ethernet interfaces -corresponding to the Eth0 and Eth1 ports of the IDK application board. -compatible will be set to "ti,am654-dualicssg-prueth" when this configuration -is used. Eth2 and Eth3 ports are not used in this configuration. Following -are the ICSSG Slice (A pair of PRU/RTU cores) allocation for Eth0 and Eth1 -ports. Each ICSSG has two slices, each handling one direction of the Ethernet -interface. - - Rx |------------------------------------| Tx - Eth0 --------->|---ICSSG0/Slice-0 ICSSG1/Slice-1-|----> Eth0 - Eth1 --------->|---ICSSG1/Slice-0 ICSSG0/Slice-1-|----> Eth1 - Rx |------------------------------------- Tx - -Eth0/Eth1/Eth2/Eth3 are the legends marked on the IDK application board near -the RJ45 connectors. - -- mii-rt-paired : phandle to ICSSG1 MII_RT module's syscon - regmap. mii-rt points to that of ICSSG0. -- mii-g-rt-paired : phandle to ICSSG1 MII_G_RT module's syscon - regmap. mii-g-rt points to that of ICSSG1. +- mii-rt-paired : phandle to paired ICSSG's MII_RT module's syscon + regmap. Must contain children, one for each of the MAC ports. Children must be named ethernet-mii0 and ethernet-mii1. @@ -62,10 +41,11 @@ Required properties for children: Optional properties for children: - local-mac-address : mac address for the port. -Example (k3-am654 base board, dual-emac on ICSSG2): -=================================================== +Example (k3-am654 base board, dual-emac): +======================================== - pruss2_eth { + /* Dual Ethernet application node on PRU-ICSSG2 */ + pruss2_eth: pruss2_eth { compatible = "ti,am654-icssg-prueth"; pinctrl-names = "default"; pinctrl-0 = <&icssg2_rgmii_pins_default>; @@ -78,21 +58,20 @@ Example (k3-am654 base board, dual-emac on ICSSG2): "ti-pruss/am65x-pru1-prueth-fw.elf", "ti-pruss/am65x-rtu1-prueth-fw.elf"; mii-g-rt = <&icssg2_mii_g_rt>; - mii-rt = <&icssg2_mii_rt>; dma-coherent; - dmas = <&main_udmap &icssg2 0 UDMA_DIR_TX>, /* egress slice 0 */ - <&main_udmap &icssg2 1 UDMA_DIR_TX>, /* egress slice 0 */ - <&main_udmap &icssg2 2 UDMA_DIR_TX>, /* egress slice 0 */ - <&main_udmap &icssg2 3 UDMA_DIR_TX>, /* egress slice 0 */ - <&main_udmap &icssg2 4 UDMA_DIR_TX>, /* egress slice 1 */ - <&main_udmap &icssg2 5 UDMA_DIR_TX>, /* egress slice 1 */ - <&main_udmap &icssg2 6 UDMA_DIR_TX>, /* egress slice 1 */ - <&main_udmap &icssg2 7 UDMA_DIR_TX>, /* egress slice 1 */ - - <&main_udmap &icssg2 0 UDMA_DIR_RX>, /* ingress slice 0 */ - <&main_udmap &icssg2 1 UDMA_DIR_RX>, /* ingress slice 1 */ - <&main_udmap &icssg2 2 UDMA_DIR_RX>, /* mgmnt rsp slice 0 */ - <&main_udmap &icssg2 3 UDMA_DIR_RX>; /* mgmnt rsp slice 1 */ + dmas = <&main_udmap &pruss2_eth 0 UDMA_DIR_TX>, /* egress slice 0 */ + <&main_udmap &pruss2_eth 1 UDMA_DIR_TX>, /* egress slice 0 */ + <&main_udmap &pruss2_eth 2 UDMA_DIR_TX>, /* egress slice 0 */ + <&main_udmap &pruss2_eth 3 UDMA_DIR_TX>, /* egress slice 0 */ + <&main_udmap &pruss2_eth 4 UDMA_DIR_TX>, /* egress slice 1 */ + <&main_udmap &pruss2_eth 5 UDMA_DIR_TX>, /* egress slice 1 */ + <&main_udmap &pruss2_eth 6 UDMA_DIR_TX>, /* egress slice 1 */ + <&main_udmap &pruss2_eth 7 UDMA_DIR_TX>, /* egress slice 1 */ + + <&main_udmap &pruss2_eth 0 UDMA_DIR_RX>, /* ingress slice 0 */ + <&main_udmap &pruss2_eth 1 UDMA_DIR_RX>, /* ingress slice 1 */ + <&main_udmap &pruss2_eth 2 UDMA_DIR_RX>, /* mgmnt rsp slice 0 */ + <&main_udmap &pruss2_eth 3 UDMA_DIR_RX>; /* mgmnt rsp slice 1 */ dma-names = "tx0-0", "tx0-1", "tx0-2", "tx0-3", "tx1-0", "tx1-1", "tx1-2", "tx1-3", "rx0", "rx1", @@ -116,67 +95,3 @@ Example (k3-am654 base board, dual-emac on ICSSG2): local-mac-address = [00 00 00 00 00 00]; }; }; - -Example (k3-am654 IDK board, dual-emac with interposer card): -============================================================= - - pruss0_eth { - compatible = "ti,am654-dualicssg-prueth"; - pinctrl-names = "default"; - pinctrl-0 = <&icssg01_rgmii_pins_default>; - sram = <&msmc_ram>; - interrupt-parent = <&main_udmass_inta>; - - /* port-1, rx pru/rtu followed by port-2 tx pru/rtu, then port-1 rx and so forth */ - prus = <&pru0_0>, <&rtu0_0>, <&pru0_1>, <&rtu0_1>, <&pru1_0>, <&rtu1_0>, <&pru1_1>, <&rtu1_1>; - firmware-name = "ti-pruss/am65x-pru0-prueth-fw.elf", - "ti-pruss/am65x-rtu0-prueth-fw.elf", - "ti-pruss/am65x-pru1-prueth-fw.elf", - "ti-pruss/am65x-rtu1-prueth-fw.elf", - "ti-pruss/am65x-pru0-prueth-fw.elf", - "ti-pruss/am65x-rtu0-prueth-fw.elf", - "ti-pruss/am65x-pru1-prueth-fw.elf", - "ti-pruss/am65x-rtu1-prueth-fw.elf"; - mii-g-rt = <&icssg0_mii_g_rt>; - mii-g-rt-paired = <&icssg1_mii_g_rt>; - mii-rt = <&icssg0_mii_rt>; - mii-rt-paired = <&icssg1_mii_rt>; - - dma-coherent; - dmas = <&main_udmap &icssg0 4 UDMA_DIR_TX>, /* egress icssg0 slice 1 */ - <&main_udmap &icssg0 5 UDMA_DIR_TX>, /* egress icssg0 slice 1 */ - <&main_udmap &icssg0 6 UDMA_DIR_TX>, /* egress icssg0 slice 1 */ - <&main_udmap &icssg0 7 UDMA_DIR_TX>, /* mgmnt cmd icssg0 slice 1 */ - - <&main_udmap &icssg0 0 UDMA_DIR_RX>, /* ingress icssg0 slice 0 */ - <&main_udmap &icssg0 2 UDMA_DIR_RX>, /* ingress mgmnt rsp icssg0 slice 0 */ - - <&main_udmap &icssg1 4 UDMA_DIR_TX>, /* egress icssg1 slice 1 */ - <&main_udmap &icssg1 5 UDMA_DIR_TX>, /* egress icssg1 slice 1 */ - <&main_udmap &icssg1 6 UDMA_DIR_TX>, /* egress icssg1 slice 1 */ - <&main_udmap &icssg1 7 UDMA_DIR_TX>, /* mgmnt cmd icssg1 slice 1 */ - - <&main_udmap &icssg1 0 UDMA_DIR_RX>, /* ingress icssg1 slice 0 */ - <&main_udmap &icssg1 2 UDMA_DIR_RX>; /* mgmnt rsp icssg1 slice 0 */ - - dma-names = "tx0-0", "tx0-1", "tx0-2", "tx0-3", - "rx0", "rxmgm0", - "tx1-0", "tx1-1", "tx1-2", "tx1-3", - "rx1", "rxmgm1"; - - pruss0_emac0: ethernet-mii0 { - phy-handle = <&pruss0_eth0_phy>; - phy-mode = "rgmii-id"; - syscon-rgmii-delay = <&scm_conf 0x4114>; - /* Filled in by bootloader */ - local-mac-address = [00 00 00 00 00 00]; - }; - - pruss0_emac1: ethernet-mii1 { - phy-handle = <&pruss0_eth1_phy>; - phy-mode = "rgmii-id"; - syscon-rgmii-delay = <&scm_conf 0x4104>; - /* Filled in by bootloader */ - local-mac-address = [00 00 00 00 00 00]; - }; - }; From 48a83f4a2412c8b23e1944170c5f44ab953e29b7 Mon Sep 17 00:00:00 2001 From: Murali Karicheri Date: Fri, 25 Oct 2019 14:57:09 -0400 Subject: [PATCH 4/4] Revert "dt-bindings: net: ti,icssg-prueth: update for using icssg pair" This reverts commit 4463e10409945438e14dbf5a00f9fbc1e75d18cf. --- Documentation/devicetree/bindings/net/ti,icssg-prueth.txt | 6 ------ 1 file changed, 6 deletions(-) diff --git a/Documentation/devicetree/bindings/net/ti,icssg-prueth.txt b/Documentation/devicetree/bindings/net/ti,icssg-prueth.txt index d439e2d996808d..b1db6b534928dd 100644 --- a/Documentation/devicetree/bindings/net/ti,icssg-prueth.txt +++ b/Documentation/devicetree/bindings/net/ti,icssg-prueth.txt @@ -3,8 +3,6 @@ Texas Instruments ICSSG PRUSS Ethernet Required properties: - compatible : Should be "ti,am654-icssg-prueth" for AM65x Family SoCs - Should be "ti,am654-dualicssg-prueth" for AM65x Family - SoCs when ICSSG0 and ICSSG1 are paired. - prus : list of pHandles to the PRU and RTU nodes - firmware-name : should contain the name of the firmware image file located in the firmware search path @@ -16,11 +14,7 @@ Required properties: "tx1-0", "tx1-1", "tx1-2", "tx1-3", "rx0", "rx1", "rxmgm0", "rxmgm1" - mii-g-rt : phandle to MII_G_RT module's syscon regmap. -- mii-g-rt-paired : phandle to paired ICSSG's MII_G_RT module's syscon - regmap. - mii-rt : phandle to MII_RT module's syscon regmap. -- mii-rt-paired : phandle to paired ICSSG's MII_RT module's syscon - regmap. Must contain children, one for each of the MAC ports. Children must be named ethernet-mii0 and ethernet-mii1.