[U-Boot] [PATCH v3 0/7] 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:
v3: Addressed comment to use KConfig for enable TI PHY driver and also netcp driver comment to use proper function as in cpsw driver. Rebased to latest on master branch. 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 ARM: dts: k2g-evm: remove unused phy-mode property from phy node k2g: config enable ti phy dp83867 for k2g 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 +++++++++++++------ configs/k2g_evm_defconfig | 1 + drivers/net/ti/keystone_net.c | 22 +++++++- 8 files changed, 116 insertions(+), 17 deletions(-)

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
Signed-off-by: Murali Karicheri m-karicheri2@ti.com Reviewed-by: Lokesh Vutla lokeshvutla@ti.com --- arch/arm/mach-keystone/include/mach/mux-k2g.h | 5 +++++ board/ti/ks2_evm/mux-k2g.h | 19 +++++++++++++++++++ 2 files changed, 24 insertions(+)
diff --git a/arch/arm/mach-keystone/include/mach/mux-k2g.h b/arch/arm/mach-keystone/include/mach/mux-k2g.h index 809b72d5bf..67d47f8172 100644 --- a/arch/arm/mach-keystone/include/mach/mux-k2g.h +++ b/arch/arm/mach-keystone/include/mach/mux-k2g.h @@ -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
diff --git a/board/ti/ks2_evm/mux-k2g.h b/board/ti/ks2_evm/mux-k2g.h index 706fb7e838..8c184a85ae 100644 --- a/board/ti/ks2_evm/mux-k2g.h +++ b/board/ti/ks2_evm/mux-k2g.h @@ -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, } };

On Thu, Feb 21, 2019 at 11:03 AM Murali Karicheri m-karicheri2@ti.com wrote:
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
Signed-off-by: Murali Karicheri m-karicheri2@ti.com Reviewed-by: Lokesh Vutla lokeshvutla@ti.com
arch/arm/mach-keystone/include/mach/mux-k2g.h | 5 +++++ board/ti/ks2_evm/mux-k2g.h | 19 +++++++++++++++++++ 2 files changed, 24 insertions(+)
diff --git a/arch/arm/mach-keystone/include/mach/mux-k2g.h b/arch/arm/mach-keystone/include/mach/mux-k2g.h index 809b72d5bf..67d47f8172 100644 --- a/arch/arm/mach-keystone/include/mach/mux-k2g.h +++ b/arch/arm/mach-keystone/include/mach/mux-k2g.h @@ -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
diff --git a/board/ti/ks2_evm/mux-k2g.h b/board/ti/ks2_evm/mux-k2g.h index 706fb7e838..8c184a85ae 100644 --- a/board/ti/ks2_evm/mux-k2g.h +++ b/board/ti/ks2_evm/mux-k2g.h @@ -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 */
Actually... please sort these by pin number.
Thanks, -Joe
/* MDIO */
{ 99, BUFFER_CLASS_B | PIN_PDIS | MODE(0) }, /* MDIO_CLK */
{ 98, BUFFER_CLASS_B | PIN_PDIS | MODE(0) }, /* MDIO_DATA */
{ MAX_PIN_N, }
};
-- 2.17.0
U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot

On Thu, Feb 21, 2019 at 11:03 AM Murali Karicheri m-karicheri2@ti.com wrote:
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
Signed-off-by: Murali Karicheri m-karicheri2@ti.com Reviewed-by: Lokesh Vutla lokeshvutla@ti.com
Acked-by: Joe Hershberger joe.hershberger@ni.com

On Thu, Feb 21, 2019 at 12:02:01PM -0500, Murali Karicheri wrote:
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
Signed-off-by: Murali Karicheri m-karicheri2@ti.com Reviewed-by: Lokesh Vutla lokeshvutla@ti.com Acked-by: Joe Hershberger joe.hershberger@ni.com
Applied to u-boot/master, thanks!

This 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
Signed-off-by: Murali Karicheri m-karicheri2@ti.com Reviewed-by: Lokesh Vutla lokeshvutla@ti.com --- board/ti/ks2_evm/mux-k2g.h | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-)
diff --git a/board/ti/ks2_evm/mux-k2g.h b/board/ti/ks2_evm/mux-k2g.h index 8c184a85ae..89c49f9e4f 100644 --- a/board/ti/ks2_evm/mux-k2g.h +++ b/board/ti/ks2_evm/mux-k2g.h @@ -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 */

On Thu, Feb 21, 2019 at 11:00 AM Murali Karicheri m-karicheri2@ti.com wrote:
This 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
Signed-off-by: Murali Karicheri m-karicheri2@ti.com Reviewed-by: Lokesh Vutla lokeshvutla@ti.com
board/ti/ks2_evm/mux-k2g.h | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-)
diff --git a/board/ti/ks2_evm/mux-k2g.h b/board/ti/ks2_evm/mux-k2g.h index 8c184a85ae..89c49f9e4f 100644 --- a/board/ti/ks2_evm/mux-k2g.h +++ b/board/ti/ks2_evm/mux-k2g.h @@ -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 */
Please sort by pin number.
{ 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 */
-- 2.17.0
U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot

On Thu, Feb 21, 2019 at 12:02:02PM -0500, Murali Karicheri wrote:
This 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
Signed-off-by: Murali Karicheri m-karicheri2@ti.com Reviewed-by: Lokesh Vutla lokeshvutla@ti.com
Applied to u-boot/master, thanks!

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 m-karicheri2@ti.com --- drivers/net/ti/keystone_net.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ti/keystone_net.c b/drivers/net/ti/keystone_net.c index a3ba91cc3f..4baeeb83f1 100644 --- a/drivers/net/ti/keystone_net.c +++ b/drivers/net/ti/keystone_net.c @@ -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) + priv->phydev->node = offset_to_ofnode(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; }

On Thu, Feb 21, 2019 at 11:01 AM Murali Karicheri m-karicheri2@ti.com wrote:
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 m-karicheri2@ti.com
Acked-by: Joe Hershberger joe.hershberger@ni.com

On Thu, Feb 21, 2019 at 12:02:03PM -0500, Murali Karicheri wrote:
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 m-karicheri2@ti.com Acked-by: Joe Hershberger joe.hershberger@ni.com
Applied to u-boot/master, thanks!

This 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.
Signed-off-by: Murali Karicheri m-karicheri2@ti.com --- .../arm/mach-keystone/include/mach/hardware-k2g.h | 3 +++ board/ti/ks2_evm/board_k2g.c | 15 +++++++++++++++ 2 files changed, 18 insertions(+)
diff --git a/arch/arm/mach-keystone/include/mach/hardware-k2g.h b/arch/arm/mach-keystone/include/mach/hardware-k2g.h index 8b902641ec..971c081bb3 100644 --- a/arch/arm/mach-keystone/include/mach/hardware-k2g.h +++ b/arch/arm/mach-keystone/include/mach/hardware-k2g.h @@ -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) diff --git a/board/ti/ks2_evm/board_k2g.c b/board/ti/ks2_evm/board_k2g.c index 39a782e479..6d0fc21c67 100644 --- a/board/ti/ks2_evm/board_k2g.c +++ b/board/ti/ks2_evm/board_k2g.c @@ -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;

On Thu, Feb 21, 2019 at 11:02 AM Murali Karicheri m-karicheri2@ti.com wrote:
This 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.
Signed-off-by: Murali Karicheri m-karicheri2@ti.com
Acked-by: Joe Hershberger joe.hershberger@ni.com

On Thu, Feb 21, 2019 at 12:02:04PM -0500, Murali Karicheri wrote:
This 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.
Signed-off-by: Murali Karicheri m-karicheri2@ti.com Acked-by: Joe Hershberger joe.hershberger@ni.com
Applied to u-boot/master, thanks!

This 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.
Signed-off-by: Murali Karicheri m-karicheri2@ti.com --- arch/arm/dts/keystone-k2g-evm.dts | 1 - 1 file changed, 1 deletion(-)
diff --git a/arch/arm/dts/keystone-k2g-evm.dts b/arch/arm/dts/keystone-k2g-evm.dts index 6c9de25b94..4820c7e50d 100644 --- a/arch/arm/dts/keystone-k2g-evm.dts +++ b/arch/arm/dts/keystone-k2g-evm.dts @@ -29,7 +29,6 @@ status = "okay"; ethphy0: ethernet-phy@0 { reg = <0>; - phy-mode = "rgmii-id"; }; };

On Thu, Feb 21, 2019 at 11:01 AM Murali Karicheri m-karicheri2@ti.com wrote:
This 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.
Signed-off-by: Murali Karicheri m-karicheri2@ti.com
Acked-by: Joe Hershberger joe.hershberger@ni.com

On Thu, Feb 21, 2019 at 12:02:05PM -0500, Murali Karicheri wrote:
This 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.
Signed-off-by: Murali Karicheri m-karicheri2@ti.com Acked-by: Joe Hershberger joe.hershberger@ni.com
Applied to u-boot/master, thanks!

Enable ti phy dp83867 for k2g
Signed-off-by: Murali Karicheri m-karicheri2@ti.com --- configs/k2g_evm_defconfig | 1 + 1 file changed, 1 insertion(+)
diff --git a/configs/k2g_evm_defconfig b/configs/k2g_evm_defconfig index 838b6f14b6..4c5e344d3a 100644 --- a/configs/k2g_evm_defconfig +++ b/configs/k2g_evm_defconfig @@ -70,3 +70,4 @@ CONFIG_USB_DWC3_GENERIC=y CONFIG_USB_GADGET=y CONFIG_USB_GADGET_DOWNLOAD=y CONFIG_USB_FUNCTION_SDP=y +CONFIG_PHY_TI=y

On Thu, Feb 21, 2019 at 12:02:06PM -0500, Murali Karicheri wrote:
Enable ti phy dp83867 for k2g
Signed-off-by: Murali Karicheri m-karicheri2@ti.com
Reviewed-by: Tom Rini trini@konsulko.com

On Thu, Feb 21, 2019 at 11:03 AM Murali Karicheri m-karicheri2@ti.com wrote:
Enable ti phy dp83867 for k2g
Signed-off-by: Murali Karicheri m-karicheri2@ti.com
Acked-by: Joe Hershberger joe.hershberger@ni.com

On Thu, Feb 21, 2019 at 12:02:06PM -0500, Murali Karicheri wrote:
Enable ti phy dp83867 for k2g
Signed-off-by: Murali Karicheri m-karicheri2@ti.com Reviewed-by: Tom Rini trini@konsulko.com Acked-by: Joe Hershberger joe.hershberger@ni.com
Applied to u-boot/master, thanks!

This 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.
Signed-off-by: Murali Karicheri m-karicheri2@ti.com --- arch/arm/dts/keystone-k2g-ice.dts | 35 +++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+)
diff --git a/arch/arm/dts/keystone-k2g-ice.dts b/arch/arm/dts/keystone-k2g-ice.dts index 698338b93d..b67332fed5 100644 --- a/arch/arm/dts/keystone-k2g-ice.dts +++ b/arch/arm/dts/keystone-k2g-ice.dts @@ -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@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"; +};

On Thu, Feb 21, 2019 at 11:03 AM Murali Karicheri m-karicheri2@ti.com wrote:
This 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
- 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.
Signed-off-by: Murali Karicheri m-karicheri2@ti.com
Acked-by: Joe Hershberger joe.hershberger@ni.com

On Thu, Feb 21, 2019 at 12:02:07PM -0500, Murali Karicheri wrote:
This 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
- 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.
Signed-off-by: Murali Karicheri m-karicheri2@ti.com Acked-by: Joe Hershberger joe.hershberger@ni.com
Applied to u-boot/master, thanks!

Hello Maintainer,
On 02/21/2019 12:02 PM, Murali Karicheri wrote:
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:
v3: Addressed comment to use KConfig for enable TI PHY driver and also netcp driver comment to use proper function as in cpsw driver. Rebased to latest on master branch. 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 ARM: dts: k2g-evm: remove unused phy-mode property from phy node k2g: config enable ti phy dp83867 for k2g 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 +++++++++++++------ configs/k2g_evm_defconfig | 1 + drivers/net/ti/keystone_net.c | 22 +++++++- 8 files changed, 116 insertions(+), 17 deletions(-)
Could you please merge this to master at the earliest if there are no more comments?
Thanks
Murali
participants (3)
-
Joe Hershberger
-
Murali Karicheri
-
Tom Rini