board: freescale: add T2080RDB rev D support
cover board: freescale: add T2080RDB rev D support
From: Camelia Groza <[email protected]>
The T2080RDB boards revision D and up have updated Aquantia PHYs on the two 10Gbps copper ports connected to MAC1 and MAC2 (from AQ1202 to AQR113C). The second PHY connected to MAC2 is located at a different address on the MDIO bus compared to revision C boards. Device tree fixups are required for both Linux and u-boot to set the correct PHY address for the new board revisions.
The first patch in the series implements a callback that detects the board revision based on the CPLD registers.
The second patch updates the PHY addresses in u-boot for the legacy, non-DM, driver implementation.
The third patch adds a fixup for Linux's device tree that is called from both DM and non-DM code paths.
The last patch corrects u-boot's device tree under DM based on a newly introduced CONFIG_T2080RDB_REV_D build option. We are unable to use the board_fix_fdt callback to update the device tree before relocation because the dts is stored in flash at that point and isn't writable. Instead, the config option is used until a more robust solution is implemented. Defconfig targets with the config option enabled by default are added for convenience.
Camelia Groza (4):
board: freescale: t208xrdb: detect the board revision letter
board: freescale: t208xrdb: add rev D support for the non-DM_ETH mode
board: freescale: t208xrdb: add Linux fdt fixups for rev D
board: freescale: t208xrdb: add a config option for rev D dts fixups
arch/powerpc/dts/t2080rdb.dts | 7 ++ board/freescale/t208xrdb/Kconfig | 4 + board/freescale/t208xrdb/eth_t208xrdb.c | 49 ++++++++++++- board/freescale/t208xrdb/t208xrdb.c | 20 ++++- board/freescale/t208xrdb/t208xrdb.h | 1 + configs/T2080RDB_revD_NAND_defconfig | 93 ++++++++++++++++++++++++ configs/T2080RDB_revD_SDCARD_defconfig | 90 +++++++++++++++++++++++ configs/T2080RDB_revD_SPIFLASH_defconfig | 92 +++++++++++++++++++++++ configs/T2080RDB_revD_defconfig | 77 ++++++++++++++++++++ include/configs/T208xRDB.h | 8 +- 10 files changed, 434 insertions(+), 7 deletions(-) create mode 100644 configs/T2080RDB_revD_NAND_defconfig create mode 100644 configs/T2080RDB_revD_SDCARD_defconfig create mode 100644 configs/T2080RDB_revD_SPIFLASH_defconfig create mode 100644 configs/T2080RDB_revD_defconfig
--
2.17.1
PATCH 1/4 board: freescale: t208xrdb: detect the board revision letter
From: Camelia Groza <[email protected]>
Detect and print the board revision letter based on the CPLD registers. Account for the upcoming D and E revisions.
--- board/freescale/t208xrdb/t208xrdb.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-)
board/freescale/t208xrdb/t208xrdb.c +17 -2
@@ -27,14 +27,29 @@DECLARE_GLOBAL_DATA_PTR ; +u8 get_hw_revision (void ) +{ +u8 ver =CPLD_READ (hw_ver); + +switch (ver) { +default : +case 0x1 : +return 'C' ; +case 0x0 : +return 'D' ; +case 0x2 : +return 'E' ; + } +} +int checkboard (void ) {struct cpu_type *cpu = gd->arch.cpu;static const char *freq[3 ] = {"100.00MHZ" ,"125.00MHz" ,"156.25MHZ" };printf ("Board: %sRDB, " , cpu->name); -printf ("Board rev: 0x%02x CPLD ver: 0x%02x, boot from " , -CPLD_READ (hw_ver),CPLD_READ (sw_ver)); +printf ("Board rev: %c CPLD ver: 0x%02x, boot from " , +get_hw_revision (),CPLD_READ (sw_ver));#ifdef CONFIG_SDCARD puts ("SD/MMC\n" );
Signature · 1 line
2.17.1
PATCH 2/4 board: freescale: t208xrdb: add rev D support for the non-DM_ETH mode
In reply to Camelia GrozaFrom: Camelia Groza <[email protected]>
The T2080RDB boards revisions D and up have updated 10G Aquantia PHYs connected to MAC1 and MAC2. The second Aquantia PHY is located at a different address on the MDIO bus compared to rev C.
Account for these changes when initializing the board in the legacy non-DM_ETH mode.
--- board/freescale/t208xrdb/eth_t208xrdb.c | 16 ++++++++++++++-- include/configs/T208xRDB.h | 8 +++++--- 2 files changed, 19 insertions(+), 5 deletions(-)
board/freescale/t208xrdb/eth_t208xrdb.c +14 -2
@@ -26,6 +26,8 @@#include <fsl_dtsec.h> #include <asm/fsl_serdes.h> +extern u8 get_hw_revision (void ); +int board_eth_init (struct bd_info *bis) {#if defined(CONFIG_FMAN_ENET )
@@ -34,6 +36,7 @@ int board_eth_init(struct bd_info *bis)struct memac_mdio_info tgec_mdio_info;struct mii_dev *dev;ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR); +int aq_phy_id_1, aq_phy_id_2;u32 srds_s1; srds_s1 = in_be32(&gur->rcwsr[4]) &
@@ -59,13 +62,22 @@ int board_eth_init(struct bd_info *bis)fm_info_set_phy_address (FM1_DTSEC3 ,RGMII_PHY1_ADDR );fm_info_set_phy_address (FM1_DTSEC4 ,RGMII_PHY2_ADDR ); +/* The AQR PHY addresses differ between board revisions */ +if (get_hw_revision () =='C' ) { + aq_phy_id_1 =FM1_10GEC3_PHY_ADDR ; + aq_phy_id_2 =FM1_10GEC4_PHY_ADDR ; + }else { + aq_phy_id_1 =AQR113C_PHY_ADDR1 ; + aq_phy_id_2 =AQR113C_PHY_ADDR2 ; + } +switch (srds_s1) {case 0x66 :case 0x6b :fm_info_set_phy_address (FM1_10GEC1 ,CORTINA_PHY_ADDR1 );fm_info_set_phy_address (FM1_10GEC2 ,CORTINA_PHY_ADDR2 ); -fm_info_set_phy_address (FM1_10GEC3 ,FM1_10GEC3_PHY_ADDR ); -fm_info_set_phy_address (FM1_10GEC4 ,FM1_10GEC4_PHY_ADDR ); +fm_info_set_phy_address (FM1_10GEC3 , aq_phy_id_1); +fm_info_set_phy_address (FM1_10GEC4 , aq_phy_id_2);break ;default : printf("SerDes1 protocol 0x%x is not supported on T208xRDB\n",
include/configs/T208xRDB.h +5 -3
@@ -1,7 +1,7 @@/* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright 2014 Freescale Semiconductor, Inc. -* Copyright 2020 NXP +* Copyright 2020-2021 NXP */ /*
@@ -537,8 +537,10 @@ unsigned long get_board_ddr_clk(void);#define RGMII_PHY2_ADDR 0x02#define CORTINA_PHY_ADDR1 0x0c/* Cortina CS4315 */ #define CORTINA_PHY_ADDR2 0x0d -#define FM1_10GEC3_PHY_ADDR 0x00/* Aquantia AQ1202 10G Base-T */ -#define FM1_10GEC4_PHY_ADDR 0x01 +#define FM1_10GEC3_PHY_ADDR 0x00/* Aquantia AQ1202 10G Base-T used */ +#define FM1_10GEC4_PHY_ADDR 0x01/* by board revision C */ +#define AQR113C_PHY_ADDR1 0x00/* Aquantia AQR113C 10G Base-T used */ +#define AQR113C_PHY_ADDR2 0x08/* by board revisions D and up. */ #endif #ifdef CONFIG_FMAN_ENET
Signature · 1 line
2.17.1
PATCH 3/4 board: freescale: t208xrdb: add Linux fdt fixups for rev D
In reply to Camelia GrozaFrom: Camelia Groza <[email protected]>
Edit Linux's device tree to update the PHY address for the second Aquantia PHY on boards revisions D and up. Also rename the PHY node to reflect the changes.
--- board/freescale/t208xrdb/eth_t208xrdb.c | 33 +++++++++++++++++++++++++ board/freescale/t208xrdb/t208xrdb.c | 1 + board/freescale/t208xrdb/t208xrdb.h | 1 + 3 files changed, 35 insertions(+)
board/freescale/t208xrdb/eth_t208xrdb.c +33 -0
@@ -151,6 +151,39 @@ void fdt_fixup_board_fman_ethernet(void *fdt) } } +/* Update the address of the second Aquantia PHY on boards revision D and up. +* Also rename the PHY node to align with the address change. +*/ +void fdt_fixup_board_phy (void *fdt) +{ +const char phy_path[] = +"/soc@ffe000000/fman@400000/mdio@fd000/ethernet-phy@1" ; +int ret, offset, new_addr =AQR113C_PHY_ADDR2 ; +char new_name[] ="ethernet-phy@00" ; + +if (get_hw_revision () =='C' ) +return ; + + offset =fdt_path_offset (fdt, phy_path); +if (offset <0 ) { +printf ("ethernet-phy@1 node not found in the dts\n" ); +return ; + } + + ret =fdt_setprop (fdt, offset,"reg" , &new_addr,sizeof (new_addr)); +if (ret <0 ) { +printf ("Unable to set 'reg' for node ethernet-phy@1: %s\n" , +fdt_strerror (ret)); +return ; + } + +sprintf (new_name,"ethernet-phy@%x" , new_addr); + ret =fdt_set_name (fdt, offset, new_name); +if (ret <0 ) +printf ("Unable to rename node ethernet-phy@1: %s\n" , +fdt_strerror (ret)); +} +void fdt_fixup_board_enet (void *fdt) {return ;
board/freescale/t208xrdb/t208xrdb.c +1 -0
@@ -157,6 +157,7 @@ int ft_board_setup(void *blob, struct bd_info *bd)fdt_fixup_board_fman_ethernet (blob);#endif fdt_fixup_board_enet (blob); +fdt_fixup_board_phy (blob);#endif return 0 ;
board/freescale/t208xrdb/t208xrdb.h +1 -0
@@ -10,5 +10,6 @@void fdt_fixup_board_enet (void *blob);void pci_of_setup (void *blob,struct bd_info *bd);void fdt_fixup_board_fman_ethernet (void *blob); +void fdt_fixup_board_phy (void *blob);#endif
Signature · 1 line
2.17.1
PATCH 4/4 board: freescale: t208xrdb: add a config option for rev D dts fixups
In reply to Camelia GrozaFrom: Camelia Groza <[email protected]>
Under DM, we rely on u-boot's device tree to provide the correct PHY addresses. The board_fix_fdt callback is intended to be used for device tree fixups before relocation. Unfortunately, this isn't an option when booting from flash since the device tree isn't writable before relocation.
This patch introduces the CONFIG_T2080RDB_REV_D option to signal that a board revision D or up is the target. The config option is used to set the correct Aquantia PHY address in the board's u-boot device tree.
Defconfig files with the option enable explicitly are added for convenience.
--- arch/powerpc/dts/t2080rdb.dts | 7 ++ board/freescale/t208xrdb/Kconfig | 4 + configs/T2080RDB_revD_NAND_defconfig | 93 ++++++++++++++++++++++++ configs/T2080RDB_revD_SDCARD_defconfig | 90 +++++++++++++++++++++++ configs/T2080RDB_revD_SPIFLASH_defconfig | 92 +++++++++++++++++++++++ configs/T2080RDB_revD_defconfig | 77 ++++++++++++++++++++ 6 files changed, 363 insertions(+) create mode 100644 configs/T2080RDB_revD_NAND_defconfig create mode 100644 configs/T2080RDB_revD_SDCARD_defconfig create mode 100644 configs/T2080RDB_revD_SPIFLASH_defconfig create mode 100644 configs/T2080RDB_revD_defconfig
arch/powerpc/dts/t2080rdb.dts +7 -0
@@ -77,10 +77,17 @@ reg = <0x0>; }; +#ifdef CONFIG_T2080RDB_REV_D + xg_aq1202_phy4: ethernet-phy@8 { + compatible = "ethernet-phy-ieee802.3-c45"; + reg = <0x8>; + }; +#else xg_aq1202_phy4: ethernet-phy@1 { compatible = "ethernet-phy-ieee802.3-c45"; reg = <0x1>; }; +#endif }; }; };
board/freescale/t208xrdb/Kconfig +4 -0
@@ -9,6 +9,10 @@ config SYS_VENDOR config SYS_CONFIG_NAME default "T208xRDB" +config T2080RDB_REV_D + bool "Support for T2080RDB revisions D and up" + default n + source "board/freescale/common/Kconfig" endif
configs/T2080RDB_revD_NAND_defconfig new file +93 -0
93 lines not on this page · raw message
configs/T2080RDB_revD_SDCARD_defconfig new file +90 -0
90 lines not on this page · raw message
configs/T2080RDB_revD_SPIFLASH_defconfig new file +92 -0
92 lines not on this page · raw message
configs/T2080RDB_revD_defconfig new file +77 -0
77 lines not on this page · raw message
Signature · 1 line
2.17.1
Quoted 9 lines · Camelia Groza
From: Camelia Groza <[email protected]>
The T2080RDB boards revision D and up have updated Aquantia PHYs on the two 10Gbps copper ports connected to MAC1 and MAC2 (from AQ1202 to AQR113C). The second PHY connected to MAC2 is located at a different address on the MDIO bus compared to revision C boards. Device tree fixups are required for both Linux and u-boot to set the correct PHY address for the new board revisions.
Quoted 5 lines
The first patch in the series implements a callback that detects the board revision based on the CPLD registers.
The second patch updates the PHY addresses in u-boot for the legacy, non-DM, driver implementation.
I'd much rather see DM_ETH migration completed and non-DM_ETH code removed while someone is actively here again. Thanks!
Signature · 1 line
Tom