Add netcp networking support on K2G ICE EVM
Subsystems (4)
v2 cover Add netcp networking support on K2G ICE EVM
This patch series add networking capability to K2G ICE EVM based on netcp driver. Networking function has been tested using the latest master branch from u-boot repo. Following boot mode has been tested for networking.
Net boot (tftp images over ethernet interface and boot kernel)
log at https://pastebin.ubuntu.com/p/b3nyCXPhWc/
MMC boot: (load images from boot folder of rootfs and boot kernel)
log at https://pastebin.ubuntu.com/p/FWycmKd9KB/
Used Linux upstream linux kernel version 4.19.9 for the tests.
Please review and apply if this looks good.
Thanks
Revision history:
v2: Collected Reviewed-by for patch 1 and 2. Rebased to latest on master
Murali Karicheri (7):
ARM: k2g-ice: Add pinmux support for rgmii interface
ARM: k2g-gp-evm: update to rgmii pinmux configuration
net: netcp: add support for phy with rgmii ids
ARM: k2g: add a workaround to reset the phy
k2g: config enable ti phy dp83867 for k2g
ARM: dts: k2g-evm: remove unused phy-mode property from phy node
ARM: dts: k2g-ice: add dt node for netcp
arch/arm/dts/keystone-k2g-evm.dts | 1 - arch/arm/dts/keystone-k2g-ice.dts | 35 +++++++++++++ .../mach-keystone/include/mach/hardware-k2g.h | 3 ++ arch/arm/mach-keystone/include/mach/mux-k2g.h | 5 ++ board/ti/ks2_evm/board_k2g.c | 15 ++++++ board/ti/ks2_evm/mux-k2g.h | 51 +++++++++++++------ drivers/net/ti/keystone_net.c | 22 +++++++- include/configs/k2g_evm.h | 1 + 8 files changed, 116 insertions(+), 17 deletions(-)
Signature · 1 line
2.17.0
PATCH v2 1/7 ARM: k2g-ice: Add pinmux support for rgmii interface
This add pinmux configuration for rgmii interface so that network driver can be supported on K2G ICE boards. The pinmux configurations for this are generated using the pinmux tool at
https://dev.ti.com/pinmux/app.html#/default
As this required some BUFFER_CLASS definitions, same is re-used from the linux defnitions in include/dt-bindings/pinctrl/keystone.h
--- arch/arm/mach-keystone/include/mach/mux-k2g.h | 5 +++++ board/ti/ks2_evm/mux-k2g.h | 19 +++++++++++++++++++ 2 files changed, 24 insertions(+)
arch/arm/mach-keystone/include/mach/mux-k2g.h +5 -0
@@ -27,6 +27,11 @@#define PIN_PTU (1 << 17)/* pull up */ #define PIN_PTD (0 << 17)/* pull down */ +#define BUFFER_CLASS_B (0 << 19) +#define BUFFER_CLASS_C (1 << 19) +#define BUFFER_CLASS_D (2 << 19) +#define BUFFER_CLASS_E (3 << 19) +#define MODE (m) ((m) & 0x7)#define MAX_PIN_N 260
board/ti/ks2_evm/mux-k2g.h +19 -0
@@ -346,6 +346,25 @@ struct pin_cfg k2g_ice_evm_pin_cfg[] = { { 133, MODE(0) }, /* SOC_QSPI_D2 */ { 134, MODE(0) }, /* SOC_QSPI_D3 */ { 135, MODE(0) }, /* SOC_QSPI_CSN0 */ + +/* EMAC */ + { 79, BUFFER_CLASS_D | PIN_PDIS | MODE(1) }, /* RGMII_RXD1 */ + { 78, BUFFER_CLASS_D | PIN_PDIS | MODE(1) }, /* RGMII_RXD2 */ + { 77, BUFFER_CLASS_D | PIN_PDIS | MODE(1) }, /* RGMII_RXD3 */ + { 80, BUFFER_CLASS_D | PIN_PDIS | MODE(1) }, /* RGMII_RXD0 */ + { 94, BUFFER_CLASS_D | PIN_PDIS | MODE(1) }, /* RGMII_TXD0 */ + { 93, BUFFER_CLASS_D | PIN_PDIS | MODE(1) }, /* RGMII_TXD1 */ + { 92, BUFFER_CLASS_D | PIN_PDIS | MODE(1) }, /* RGMII_TXD2 */ + { 91, BUFFER_CLASS_D | PIN_PDIS | MODE(1) }, /* RGMII_TXD3 */ + { 85, BUFFER_CLASS_D | PIN_PDIS | MODE(1) }, /* RGMII_TXC */ + { 95, BUFFER_CLASS_D | PIN_PDIS | MODE(1) }, /* RGMII_TXCTL */ + { 72, BUFFER_CLASS_D | PIN_PDIS | MODE(1) }, /* RGMII_RXC */ + { 81, BUFFER_CLASS_D | PIN_PDIS | MODE(1) }, /* RGMII_RXCTL */ + +/* MDIO */ + { 99, BUFFER_CLASS_B | PIN_PDIS | MODE(0) }, /* MDIO_CLK */ + { 98, BUFFER_CLASS_B | PIN_PDIS | MODE(0) }, /* MDIO_DATA */ + { MAX_PIN_N, } };
Signature · 1 line
2.17.0
PATCH v2 2/7 ARM: k2g-gp-evm: update to rgmii pinmux configuration
In reply to Murali KaricheriThis patch updates pinmux configuration for K2G GP EVM based on data generated by the pinmux tool at
https://dev.ti.com/pinmux/app.html#/default
--- board/ti/ks2_evm/mux-k2g.h | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-)
board/ti/ks2_evm/mux-k2g.h +17 -15
@@ -125,21 +125,23 @@ struct pin_cfg k2g_evm_pin_cfg[] = { { 70, MODE(0) }, /* SOC_MMC1_SDWP */ { 71, MODE(0) }, /* MMC1POW TP124 */ -/* RGMII */ - { 72, MODE(1) | PIN_IEN }, /* SOC_RGMII_RXCLK */ - { 77, MODE(1) | PIN_IEN }, /* SOC_RGMII_RXD3 */ - { 78, MODE(1) | PIN_IEN }, /* SOC_RGMII_RXD2 */ - { 79, MODE(1) | PIN_IEN }, /* SOC_RGMII_RXD1 */ - { 80, MODE(1) | PIN_IEN }, /* SOC_RGMII_RXD0 */ - { 81, MODE(1) | PIN_IEN }, /* SOC_RGMII_RXCTL */ - { 85, MODE(1) }, /* SOC_RGMII_TXCLK */ - { 91, MODE(1) }, /* SOC_RGMII_TXD3 */ - { 92, MODE(1) }, /* SOC_RGMII_TXD2 */ - { 93, MODE(1) }, /* SOC_RGMII_TXD1 */ - { 94, MODE(1) }, /* SOC_RGMII_TXD0 */ - { 95, MODE(1) }, /* SOC_RGMII_TXCTL */ - { 98, MODE(0) }, /* SOC_MDIO_DATA */ - { 99, MODE(0) }, /* SOC_MDIO_CLK */ +/* EMAC */ + { 79, BUFFER_CLASS_D | PIN_PDIS | MODE(1) }, /* RGMII_RXD1 */ + { 78, BUFFER_CLASS_D | PIN_PDIS | MODE(1) }, /* RGMII_RXD2 */ + { 77, BUFFER_CLASS_D | PIN_PDIS | MODE(1) }, /* RGMII_RXD3 */ + { 80, BUFFER_CLASS_D | PIN_PDIS | MODE(1) }, /* RGMII_RXD0 */ + { 94, BUFFER_CLASS_D | PIN_PDIS | MODE(1) }, /* RGMII_TXD0 */ + { 93, BUFFER_CLASS_D | PIN_PDIS | MODE(1) }, /* RGMII_TXD1 */ + { 92, BUFFER_CLASS_D | PIN_PDIS | MODE(1) }, /* RGMII_TXD2 */ + { 91, BUFFER_CLASS_D | PIN_PDIS | MODE(1) }, /* RGMII_TXD3 */ + { 85, BUFFER_CLASS_D | PIN_PDIS | MODE(1) }, /* RGMII_TXC */ + { 95, BUFFER_CLASS_D | PIN_PDIS | MODE(1) }, /* RGMII_TXCTL */ + { 72, BUFFER_CLASS_D | PIN_PDIS | MODE(1) }, /* RGMII_RXC */ + { 81, BUFFER_CLASS_D | PIN_PDIS | MODE(1) }, /* RGMII_RXCTL */ + +/* MDIO */ + { 99, BUFFER_CLASS_B | PIN_PDIS | MODE(0) }, /* MDIO_CLK */ + { 98, BUFFER_CLASS_B | PIN_PDIS | MODE(0) }, /* MDIO_DATA *//* PWM */ { 73, MODE(4) }, /* SOC_EHRPWM3A */
Signature · 1 line
2.17.0
PATCH v2 3/7 net: netcp: add support for phy with rgmii ids
In reply to Murali KaricheriEnhance the netcp driver to support phys that can be configured for internal delay (rgmii-id, rgmii-rxid, rgmii-txid)
--- drivers/net/ti/keystone_net.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-)
drivers/net/ti/keystone_net.c +21 -1
@@ -88,6 +88,7 @@ struct ks2_eth_priv {struct mii_dev *mdio_bus;int phy_addr;phy_interface_t phy_if; +int phy_of_handle;int sgmii_link_type;void *mdio_base;struct rx_buff_desc net_rx_buffs;
@@ -588,6 +589,10 @@ static int ks2_eth_probe(struct udevice *dev)if (priv->has_mdio) { priv->phydev =phy_connect (priv->mdio_bus, priv->phy_addr, dev, priv->phy_if); +#ifdef CONFIG_DM_ETH +if (priv->phy_of_handle) +dev_set_of_offset (priv->phydev->dev, priv->phy_of_handle); +#endif phy_config (priv->phydev); }
@@ -679,6 +684,7 @@ static int ks2_eth_parse_slave_interface(int netcp, int slave,int phy;int dma_count;u32 dma_channel[8 ]; +const char *phy_mode; priv->slave_port =fdtdec_get_int (fdt, slave,"slave-port" ,-1 ); priv->net_rx_buffs.rx_flow = priv->slave_port *8 ;
@@ -700,7 +706,9 @@ static int ks2_eth_parse_slave_interface(int netcp, int slave, priv->link_type =fdtdec_get_int (fdt, slave,"link-interface" ,-1 ); phy =fdtdec_lookup_phandle (fdt, slave,"phy-handle" ); +if (phy >=0 ) { + priv->phy_of_handle = phy; priv->phy_addr =fdtdec_get_int (fdt, phy,"reg" ,-1 ); mdio =fdt_parent_offset (fdt, phy);
@@ -717,7 +725,19 @@ static int ks2_eth_parse_slave_interface(int netcp, int slave, priv->sgmii_link_type =SGMII_LINK_MAC_PHY ; priv->has_mdio = true; }else if (priv->link_type ==LINK_TYPE_RGMII_LINK_MAC_PHY ) { - priv->phy_if =PHY_INTERFACE_MODE_RGMII ; + phy_mode =fdt_getprop (fdt, slave,"phy-mode" ,NULL ); +if (phy_mode) { + priv->phy_if =phy_get_interface_by_name (phy_mode); +if (priv->phy_if !=PHY_INTERFACE_MODE_RGMII && + priv->phy_if !=PHY_INTERFACE_MODE_RGMII_ID && + priv->phy_if !=PHY_INTERFACE_MODE_RGMII_RXID && + priv->phy_if !=PHY_INTERFACE_MODE_RGMII_TXID ) { +pr_err ("invalid phy-mode\n" ); +return -EINVAL ; + } + }else { + priv->phy_if =PHY_INTERFACE_MODE_RGMII ; + } pdata->phy_interface = priv->phy_if; priv->has_mdio = true; }
Signature · 1 line
2.17.0
PATCH v2 3/7 net: netcp: add support for phy with rgmii ids
Quoted 21 lines · Murali Karicheri
Enhance the netcp driver to support phys that can be configured for internal delay (rgmii-id, rgmii-rxid, rgmii-txid)
Signed-off-by Murali Karicheri <[email protected]>--- drivers/net/ti/keystone_net.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-)drivers/net/ti/keystone_net.c +1
-0@@ -88,6 +88,7 @@ struct ks2_eth_priv {struct mii_dev *mdio_bus;int phy_addr;phy_interface_t phy_if; +int phy_of_handle;int sgmii_link_type;void *mdio_base;struct rx_buff_desc net_rx_buffs;
drivers/net/ti/keystone_net.c static int ks2_eth_probe(struct udevice *dev) · line 595
Quoted 7 lines
drivers/net/ti/keystone_net.c +4
-0@@ -588,6 +589,10 @@ static int ks2_eth_probe(struct udevice *dev)if (priv->has_mdio) { priv->phydev =phy_connect (priv->mdio_bus, priv->phy_addr, dev, priv->phy_if); +#ifdef CONFIG_DM_ETH +if (priv->phy_of_handle) +dev_set_of_offset (priv->phydev->dev, priv->phy_of_handle); +#endif
Above is not correct, it has to be smth. like
#ifdef CONFIG_DM_ETH if (priv->phy_of_handle) phydev->node = offset_to_ofnode(priv->phy_of_handle);
#endif
see commit d4bb98170006e "drivers: net: cpsw: fix phy dt node setting"
Quoted 3 lines
drivers/net/ti/keystone_net.c +0
-0phy_config (priv->phydev); }
Signature · 2 lines
Best regards, grygorii
PATCH v2 4/7 ARM: k2g: add a workaround to reset the phy
In reply to Murali KaricheriThis patch adds a workaround to reset the phy one time during boot using GPIO0 pin 10 to make sure, the Phy latches the configuration from the input pins correctly.
--- .../arm/mach-keystone/include/mach/hardware-k2g.h | 3 +++ board/ti/ks2_evm/board_k2g.c | 15 +++++++++++++++ 2 files changed, 18 insertions(+)
arch/arm/mach-keystone/include/mach/hardware-k2g.h +3 -0
@@ -69,9 +69,12 @@#define K2G_GPIO0_BASE 0X02603000#define K2G_GPIO1_BASE 0X0260a000 +#define K2G_GPIO0_BANK0_BASE K2G_GPIO0_BASE + 0x10#define K2G_GPIO1_BANK2_BASE K2G_GPIO1_BASE + 0x38#define K2G_GPIO_DIR_OFFSET 0x0 +#define K2G_GPIO_OUTDATA_OFFSET 0x4#define K2G_GPIO_SETDATA_OFFSET 0x8 +#define K2G_GPIO_CLRDATA_OFFSET 0xC/* BOOTCFG RESETMUX8 */ #define KS2_RSTMUX8 (KS2_DEVICE_STATE_CTRL_BASE + 0x328)
board/ti/ks2_evm/board_k2g.c +15 -0
@@ -315,6 +315,21 @@ int embedded_dtb_select(void) BIT(9));setbits_le32 (K2G_GPIO1_BANK2_BASE +K2G_GPIO_SETDATA_OFFSET ,BIT (9 )); + }else if (board_is_k2g_ice ()) { +/* GBE Phy workaround. For Phy to latch the input +* configuration, a GPIO reset is asserted at the +* Phy reset pin to latch configuration correctly after SoC +* reset. GPIO0 Pin 10 (Ball AA20) is used for this on ICE +* board. Just do a low to high transition. +*/ +clrbits_le32 (K2G_GPIO0_BANK0_BASE +K2G_GPIO_DIR_OFFSET , +BIT (10 )); +setbits_le32 (K2G_GPIO0_BANK0_BASE +K2G_GPIO_CLRDATA_OFFSET , +BIT (10 )); +/* Delay just to get a transition to high */ +udelay (100 ); +setbits_le32 (K2G_GPIO0_BANK0_BASE +K2G_GPIO_SETDATA_OFFSET , +BIT (10 )); }return 0 ;
Signature · 1 line
2.17.0
PATCH v2 5/7 k2g: config enable ti phy dp83867 for k2g
In reply to Murali KaricheriEnable ti phy driver dp83867 for k2g based boards.
--- include/configs/k2g_evm.h | 1 + 1 file changed, 1 insertion(+)
include/configs/k2g_evm.h +1 -0
@@ -98,4 +98,5 @@#include <configs/ti_armv7_keystone2.h> +#define CONFIG_PHY_TI #endif /* __CONFIG_K2G_EVM_H */
Signature · 1 line
2.17.0
PATCH v2 5/7 k2g: config enable ti phy dp83867 for k2g
Quoted 12 lines · Murali Karicheri
Enable ti phy driver dp83867 for k2g based boards.
Signed-off-by Murali Karicheri <[email protected]>--- include/configs/k2g_evm.h | 1 + 1 file changed, 1 insertion(+)include/configs/k2g_evm.h +0
-0
include/configs/k2g_evm.h line 102
Quoted 5 lines
include/configs/k2g_evm.h +1
-0@@ -98,4 +98,5 @@#include <configs/ti_armv7_keystone2.h> +#define CONFIG_PHY_TI #endif /* __CONFIG_K2G_EVM_H */
Lets migrate to Kconfig while were here please, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190218/c74f61de/attachment.sig>
PATCH v2 6/7 ARM: dts: k2g-evm: remove unused phy-mode property from phy node
In reply to Murali KaricheriThis patch removes the unused phy-mode property from the phy dt node. On K2G, currently link-interface determines if phy is used or not and is already set to use rgmii. So this is not needed. Besides phy-mode should be added to slave interface configuration of the cpsw driver, not in the phy node.
--- arch/arm/dts/keystone-k2g-evm.dts | 1 - 1 file changed, 1 deletion(-)
arch/arm/dts/keystone-k2g-evm.dts +0 -1
@@ -29,7 +29,6 @@ status = "okay"; ethphy0: ethernet-phy at 0 { reg = <0>; - phy-mode = "rgmii-id"; }; };
Signature · 1 line
2.17.0
PATCH v2 7/7 ARM: dts: k2g-ice: add dt node for netcp
In reply to Murali KaricheriThis patch adds dt node for DP83867 phy used on K2G ICE board and also enable netcp device nodes for the board.
EVM hardware spec recommends to add 0.25 nsec delay in the tx direction and 2.25 nsec delay in the rx direction for internal delay in the clock path to be on the safer side.
The board straps RX_DV/RX_CTRL pin of on board DP83867 phy in mode
1. Unfortunately, the phy data manual disallows this. Add ti,dp83867-rxctrl-strap-quirk in the phy node to allow software to enable workaround suggested for this incorrect strap setting. This ensures proper operation of this PHY.
The dts bindings are kept in sync with that from 4.14.y linux kernel. This required the pinmux device related bindings to be commented out to allow for compilation.
--- arch/arm/dts/keystone-k2g-ice.dts | 35 +++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+)
arch/arm/dts/keystone-k2g-ice.dts +35 -0
@@ -7,6 +7,7 @@ /dts-v1/; #include "keystone-k2g.dtsi" +#include <dt-bindings/net/ti-dp83867.h> / { compatible = "ti,k2g-ice", "ti,k2g", "ti,keystone";
@@ -81,3 +82,37 @@ }; }; }; + +&qmss { + status = "okay"; +}; + +&knav_dmas { + status = "okay"; +}; + +&netcp { + pinctrl-names = "default"; + //pinctrl-0 = <&emac_pins>; + status = "okay"; +}; + +&mdio { + pinctrl-names = "default"; + //pinctrl-0 = <&mdio_pins>; + status = "okay"; + ethphy0: ethernet-phy at 0 { + reg = <0>; + ti,rx-internal-delay = <DP83867_RGMIIDCTL_2_25_NS>; + ti,tx-internal-delay = <DP83867_RGMIIDCTL_250_PS>; + ti,fifo-depth = <DP83867_PHYCR_FIFO_DEPTH_8_B_NIB>; + ti,min-output-impedance; + ti,dp83867-rxctrl-strap-quirk; + }; +}; + +&gbe0 { + phy-handle = <ðphy0>; + phy-mode = "rgmii-id"; + status = "okay"; +};
Signature · 1 line
2.17.0