From c99b2a9e9e83ea78d6c984fb0b34006b7d0fcf38 Mon Sep 17 00:00:00 2001 From: Nathan Morrisson Date: Mon, 10 Jun 2024 15:33:40 +0200 Subject: [PATCH 01/13] arch: arm: dts: k3-am625-phyboard-lyra: Add fixed partitions Add a fixed partitions node to the AM62x device tree so that it can be used to fixup the Linux device tree. Signed-off-by: Nathan Morrisson Signed-off-by: Wadim Egorov Reviewed-by: Daniel Schultz --- .../k3-am625-phyboard-lyra-rdk-u-boot.dtsi | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/arch/arm/dts/k3-am625-phyboard-lyra-rdk-u-boot.dtsi b/arch/arm/dts/k3-am625-phyboard-lyra-rdk-u-boot.dtsi index 94162282068..7c76acc0d59 100644 --- a/arch/arm/dts/k3-am625-phyboard-lyra-rdk-u-boot.dtsi +++ b/arch/arm/dts/k3-am625-phyboard-lyra-rdk-u-boot.dtsi @@ -127,6 +127,32 @@ flash@0 { bootph-all; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "ospi.tiboot3"; + reg = <0x00000 0x80000>; + }; + partition@80000 { + label = "ospi.tispl"; + reg = <0x080000 0x200000>; + }; + partition@280000 { + label = "ospi.u-boot"; + reg = <0x280000 0x400000>; + }; + partition@680000 { + label = "ospi.env"; + reg = <0x680000 0x40000>; + }; + partition@6c0000 { + label = "ospi.env.backup"; + reg = <0x6c0000 0x40000>; + }; + }; }; }; From 43f078ca83fc8977cd1b8d753bbbcd78b03b6ee2 Mon Sep 17 00:00:00 2001 From: Nathan Morrisson Date: Mon, 10 Jun 2024 15:33:41 +0200 Subject: [PATCH 02/13] arch: arm: dts: k3-am642-phyboard-electra: Add fixed partitions Add a fixed partitions node to the AM64x device tree so that it can be used to fixup the Linux device tree. Signed-off-by: Nathan Morrisson Signed-off-by: Wadim Egorov Reviewed-by: Daniel Schultz --- .../k3-am642-phyboard-electra-rdk-u-boot.dtsi | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/arch/arm/dts/k3-am642-phyboard-electra-rdk-u-boot.dtsi b/arch/arm/dts/k3-am642-phyboard-electra-rdk-u-boot.dtsi index 4677c35e2d9..8f3c3a185ae 100644 --- a/arch/arm/dts/k3-am642-phyboard-electra-rdk-u-boot.dtsi +++ b/arch/arm/dts/k3-am642-phyboard-electra-rdk-u-boot.dtsi @@ -115,6 +115,32 @@ bootph-all; flash@0 { bootph-all; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "ospi.tiboot3"; + reg = <0x00000 0x80000>; + }; + partition@80000 { + label = "ospi.tispl"; + reg = <0x080000 0x200000>; + }; + partition@280000 { + label = "ospi.u-boot"; + reg = <0x280000 0x400000>; + }; + partition@680000 { + label = "ospi.env"; + reg = <0x680000 0x40000>; + }; + partition@6c0000 { + label = "ospi.env.backup"; + reg = <0x6c0000 0x40000>; + }; + }; }; }; From e9c4448f809e1f48701c25711ef926bbeb7addc5 Mon Sep 17 00:00:00 2001 From: Wadim Egorov Date: Mon, 10 Jun 2024 15:33:42 +0200 Subject: [PATCH 03/13] board: phytec: common: k3: Copy fixed partitions to OS device tree Copy fixed-partitions nodes from U-Boot device tree to OS device tree. Signed-off-by: Wadim Egorov Reviewed-by: Daniel Schultz --- board/phytec/common/k3/board.c | 10 ++++++++++ configs/phycore_am62x_a53_defconfig | 1 + 2 files changed, 11 insertions(+) diff --git a/board/phytec/common/k3/board.c b/board/phytec/common/k3/board.c index f21e154d4fe..3d7e090ccaa 100644 --- a/board/phytec/common/k3/board.c +++ b/board/phytec/common/k3/board.c @@ -5,6 +5,7 @@ */ #include +#include #include #include @@ -94,3 +95,12 @@ int board_late_init(void) return 0; } #endif + +#if IS_ENABLED(CONFIG_OF_LIBFDT) && IS_ENABLED(CONFIG_OF_BOARD_SETUP) +int ft_board_setup(void *blob, struct bd_info *bd) +{ + fdt_copy_fixed_partitions(blob); + + return 0; +} +#endif diff --git a/configs/phycore_am62x_a53_defconfig b/configs/phycore_am62x_a53_defconfig index 7545bf2ea73..44f6e77b626 100644 --- a/configs/phycore_am62x_a53_defconfig +++ b/configs/phycore_am62x_a53_defconfig @@ -36,6 +36,7 @@ CONFIG_SPL_LOAD_FIT=y CONFIG_SPL_LOAD_FIT_ADDRESS=0x81000000 CONFIG_BOOTSTD_FULL=y CONFIG_SYS_BOOTM_LEN=0x800000 +CONFIG_OF_BOARD_SETUP=y CONFIG_BOOTCOMMAND="run mmcboot; bootflow scan -lb" CONFIG_DEFAULT_FDT_FILE="oftree" CONFIG_BOARD_LATE_INIT=y From aca776e6dcc1adb2fa6715e8ffab5f259d7deda9 Mon Sep 17 00:00:00 2001 From: Wadim Egorov Date: Mon, 10 Jun 2024 15:33:43 +0200 Subject: [PATCH 04/13] board: phytec: phycore-am62x: Fix CONFIG_SPL_BOARD_INIT Make sure spl_board_init() gets compiled by enabling missing CONFIG_SPL_BOARD_INIT and including hardware.h. Fixes: 085cd6459dae ("board: phytec: am62x: Add PHYTEC phyCORE-AM62x SoM") Signed-off-by: Wadim Egorov Reviewed-by: Daniel Schultz --- board/phytec/phycore_am62x/phycore-am62x.c | 1 + configs/phycore_am62x_a53_defconfig | 1 + 2 files changed, 2 insertions(+) diff --git a/board/phytec/phycore_am62x/phycore-am62x.c b/board/phytec/phycore_am62x/phycore-am62x.c index 4a76f1343d7..35e1bb96b8d 100644 --- a/board/phytec/phycore_am62x/phycore-am62x.c +++ b/board/phytec/phycore_am62x/phycore-am62x.c @@ -4,6 +4,7 @@ * Author: Wadim Egorov */ +#include #include #include #include diff --git a/configs/phycore_am62x_a53_defconfig b/configs/phycore_am62x_a53_defconfig index 44f6e77b626..468c0f373b7 100644 --- a/configs/phycore_am62x_a53_defconfig +++ b/configs/phycore_am62x_a53_defconfig @@ -42,6 +42,7 @@ CONFIG_DEFAULT_FDT_FILE="oftree" CONFIG_BOARD_LATE_INIT=y CONFIG_SPL_MAX_SIZE=0x58000 CONFIG_SPL_SYS_REPORT_STACK_F_USAGE=y +CONFIG_SPL_BOARD_INIT=y CONFIG_SPL_SYS_MALLOC_SIMPLE=y CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1400 From 3f3f7bf84d3066d70d62aa5253feb1d72e57bf20 Mon Sep 17 00:00:00 2001 From: Wadim Egorov Date: Mon, 10 Jun 2024 15:33:44 +0200 Subject: [PATCH 05/13] configs: phycore_am62x: Update environment location Update environment location to align with OSPI fixed-partition definitions and provide a redundant environment at a 2nd location. Signed-off-by: Wadim Egorov Reviewed-by: Daniel Schultz --- configs/phycore_am62x_a53_defconfig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/configs/phycore_am62x_a53_defconfig b/configs/phycore_am62x_a53_defconfig index 468c0f373b7..7476bb4a175 100644 --- a/configs/phycore_am62x_a53_defconfig +++ b/configs/phycore_am62x_a53_defconfig @@ -11,7 +11,7 @@ CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x80b80000 CONFIG_SF_DEFAULT_SPEED=25000000 CONFIG_ENV_SIZE=0x2000 -CONFIG_ENV_OFFSET=0xFFFFD000 +CONFIG_ENV_OFFSET=0x680000 CONFIG_SPL_DM_SPI=y CONFIG_DEFAULT_DEVICE_TREE="ti/k3-am625-phyboard-lyra-rdk" CONFIG_SPL_TEXT_BASE=0x80080000 @@ -26,6 +26,7 @@ CONFIG_SPL_BSS_MAX_SIZE=0x80000 CONFIG_SPL_STACK_R=y CONFIG_SPL_SIZE_LIMIT=0x40000 CONFIG_SPL_SIZE_LIMIT_PROVIDE_STACK=0x800 +CONFIG_ENV_OFFSET_REDUND=0x6c0000 CONFIG_SPL_FS_FAT=y CONFIG_SPL_LIBDISK_SUPPORT=y CONFIG_SPL_SPI_FLASH_SUPPORT=y @@ -65,6 +66,7 @@ CONFIG_SPL_MULTI_DTB_FIT=y CONFIG_SPL_MULTI_DTB_FIT_NO_COMPRESSION=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_MMC=y +CONFIG_SYS_REDUNDAND_ENVIRONMENT=y CONFIG_SYS_MMC_ENV_DEV=1 CONFIG_NET_RANDOM_ETHADDR=y CONFIG_SPL_DM=y From 001550b498a157303988022a9bf95c148021c28f Mon Sep 17 00:00:00 2001 From: Wadim Egorov Date: Mon, 10 Jun 2024 15:33:45 +0200 Subject: [PATCH 06/13] configs: phycore_am64x: Update environment location Update environment location to align with OSPI fixed-partition definitions and provide a redundant environment at a 2nd location. Signed-off-by: Wadim Egorov Reviewed-by: Daniel Schultz --- configs/phycore_am64x_a53_defconfig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/configs/phycore_am64x_a53_defconfig b/configs/phycore_am64x_a53_defconfig index 76bb0e53e51..e94d829fd8f 100644 --- a/configs/phycore_am64x_a53_defconfig +++ b/configs/phycore_am64x_a53_defconfig @@ -13,7 +13,7 @@ CONFIG_TARGET_PHYCORE_AM64X_A53=y CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x80480000 CONFIG_ENV_SIZE=0x20000 -CONFIG_ENV_OFFSET=0xFFFFD000 +CONFIG_ENV_OFFSET=0x680000 CONFIG_DM_GPIO=y CONFIG_SPL_DM_SPI=y CONFIG_DEFAULT_DEVICE_TREE="ti/k3-am642-phyboard-electra-rdk" @@ -28,6 +28,7 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y CONFIG_SPL_BSS_START_ADDR=0x80a00000 CONFIG_SPL_BSS_MAX_SIZE=0x80000 CONFIG_SPL_STACK_R=y +CONFIG_ENV_OFFSET_REDUND=0x6c0000 CONFIG_SPL_FS_FAT=y CONFIG_SPL_LIBDISK_SUPPORT=y CONFIG_SPL_SPI_FLASH_SUPPORT=y @@ -76,6 +77,7 @@ CONFIG_MULTI_DTB_FIT=y CONFIG_SPL_MULTI_DTB_FIT=y CONFIG_SPL_MULTI_DTB_FIT_NO_COMPRESSION=y CONFIG_ENV_IS_IN_MMC=y +CONFIG_SYS_REDUNDAND_ENVIRONMENT=y CONFIG_SYS_MMC_ENV_DEV=1 CONFIG_NET_RANDOM_ETHADDR=y CONFIG_SPL_DM=y From 6ad83912a48f78aa4ab9995d2efc01c3a62dbb7a Mon Sep 17 00:00:00 2001 From: Wadim Egorov Date: Mon, 10 Jun 2024 15:33:46 +0200 Subject: [PATCH 07/13] arm: dts: k3-am625-phyboard-lyra-rdk: Enable usb port in u-boot Enable usb0 in all boot phases for use with DFU. Signed-off-by: Wadim Egorov Reviewed-by: Daniel Schultz --- arch/arm/dts/k3-am625-phyboard-lyra-rdk-u-boot.dtsi | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/arm/dts/k3-am625-phyboard-lyra-rdk-u-boot.dtsi b/arch/arm/dts/k3-am625-phyboard-lyra-rdk-u-boot.dtsi index 7c76acc0d59..2bc5acbec23 100644 --- a/arch/arm/dts/k3-am625-phyboard-lyra-rdk-u-boot.dtsi +++ b/arch/arm/dts/k3-am625-phyboard-lyra-rdk-u-boot.dtsi @@ -168,6 +168,15 @@ bootph-all; }; +&usbss0 { + bootph-all; +}; + +&usb0 { + dr_mode = "peripheral"; + bootph-all; +}; + &vcc_3v3_mmc { bootph-all; }; From 2bc8c110ec1135863d9a459c3d479e5e555fb8b7 Mon Sep 17 00:00:00 2001 From: Wadim Egorov Date: Mon, 10 Jun 2024 15:33:47 +0200 Subject: [PATCH 08/13] configs: phycore_am62x_a53_defconfig: Enable DFU boot Enable configs required for booting via DFU. Configs taken from the am62x_a53_usbdfu.config config fragment. Signed-off-by: Wadim Egorov Reviewed-by: Daniel Schultz --- configs/phycore_am62x_a53_defconfig | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/configs/phycore_am62x_a53_defconfig b/configs/phycore_am62x_a53_defconfig index 7476bb4a175..5fe2c9d4422 100644 --- a/configs/phycore_am62x_a53_defconfig +++ b/configs/phycore_am62x_a53_defconfig @@ -1,5 +1,6 @@ CONFIG_ARM=y CONFIG_ARCH_K3=y +CONFIG_SYS_MALLOC_LEN=0x2000000 CONFIG_SYS_MALLOC_F_LEN=0x8000 CONFIG_SPL_LIBCOMMON_SUPPORT=y CONFIG_SPL_LIBGENERIC_SUPPORT=y @@ -53,18 +54,23 @@ CONFIG_SPL_I2C=y CONFIG_SPL_DM_MAILBOX=y CONFIG_SPL_DM_SPI_FLASH=y CONFIG_SPL_POWER_DOMAIN=y +CONFIG_SPL_RAM_SUPPORT=y +CONFIG_SPL_RAM_DEVICE=y # CONFIG_SPL_SPI_FLASH_TINY is not set CONFIG_SPL_SPI_FLASH_SFDP_SUPPORT=y CONFIG_SPL_SPI_LOAD=y CONFIG_SYS_SPI_U_BOOT_OFFS=0x280000 CONFIG_SPL_YMODEM_SUPPORT=y +CONFIG_CMD_DFU=y CONFIG_CMD_MMC=y +CONFIG_CMD_USB=y CONFIG_OF_CONTROL=y CONFIG_SPL_OF_CONTROL=y CONFIG_MULTI_DTB_FIT=y CONFIG_SPL_MULTI_DTB_FIT=y CONFIG_SPL_MULTI_DTB_FIT_NO_COMPRESSION=y CONFIG_ENV_OVERWRITE=y +CONFIG_ENV_IS_NOWHERE=y CONFIG_ENV_IS_IN_MMC=y CONFIG_SYS_REDUNDAND_ENVIRONMENT=y CONFIG_SYS_MMC_ENV_DEV=1 @@ -73,10 +79,15 @@ CONFIG_SPL_DM=y CONFIG_SPL_DM_SEQ_ALIAS=y CONFIG_REGMAP=y CONFIG_SPL_REGMAP=y +CONFIG_SPL_SYSCON=y CONFIG_SPL_OF_TRANSLATE=y CONFIG_CLK=y CONFIG_SPL_CLK=y CONFIG_CLK_TI_SCI=y +CONFIG_DFU_MMC=y +CONFIG_DFU_RAM=y +CONFIG_SYS_DFU_DATA_BUF_SIZE=0x5000 +CONFIG_SYS_DFU_MAX_FILE_SIZE=0x800000 CONFIG_DMA_CHANNELS=y CONFIG_TI_K3_NAVSS_UDMA=y CONFIG_TI_SCI_PROTOCOL=y @@ -121,4 +132,21 @@ CONFIG_CADENCE_QSPI=y CONFIG_SYSRESET=y CONFIG_SPL_SYSRESET=y CONFIG_SYSRESET_TI_SCI=y +CONFIG_USB=y +CONFIG_DM_USB_GADGET=y +CONFIG_SPL_DM_USB_GADGET=y +CONFIG_USB_XHCI_HCD=y +CONFIG_USB_XHCI_DWC3=y +CONFIG_USB_DWC3=y +CONFIG_USB_DWC3_GENERIC=y +CONFIG_SPL_USB_DWC3_GENERIC=y +CONFIG_SPL_USB_DWC3_AM62=y +CONFIG_USB_DWC3_AM62=y +CONFIG_USB_GADGET=y +CONFIG_SPL_USB_GADGET=y +CONFIG_USB_GADGET_MANUFACTURER="Phytec" +CONFIG_USB_GADGET_VENDOR_NUM=0x0451 +CONFIG_USB_GADGET_PRODUCT_NUM=0x6165 +CONFIG_USB_GADGET_DOWNLOAD=y +CONFIG_SPL_DFU=y CONFIG_FS_FAT_MAX_CLUSTSIZE=16384 From 623c337c349d15488475bdf65f4ed4d72bf387e2 Mon Sep 17 00:00:00 2001 From: Wadim Egorov Date: Mon, 10 Jun 2024 15:33:48 +0200 Subject: [PATCH 09/13] board: phytec: phycore-am62x: Pull in k3_dfu.env Pull in ti/k3_dfu.env for dfu_alt_info_ram in SPL stage. Signed-off-by: Wadim Egorov Reviewed-by: Daniel Schultz --- board/phytec/phycore_am62x/phycore_am62x.env | 2 ++ 1 file changed, 2 insertions(+) diff --git a/board/phytec/phycore_am62x/phycore_am62x.env b/board/phytec/phycore_am62x/phycore_am62x.env index ada3a9233be..42db26a5990 100644 --- a/board/phytec/phycore_am62x/phycore_am62x.env +++ b/board/phytec/phycore_am62x/phycore_am62x.env @@ -1,3 +1,5 @@ +#include + fdtaddr=0x88000000 loadaddr=0x82000000 scriptaddr=0x80000000 From 9fa4865547c220f1511fb5d9d252ca6ee4a7fc64 Mon Sep 17 00:00:00 2001 From: Wadim Egorov Date: Mon, 10 Jun 2024 15:33:49 +0200 Subject: [PATCH 10/13] configs: phycore_am6xx: Update MTD & SPI configs Enable mtd command and remove SPI NOR flashes we do not populate on our SoMs. Signed-off-by: Wadim Egorov Reviewed-by: Daniel Schultz --- configs/phycore_am62x_a53_defconfig | 4 ++-- configs/phycore_am62x_r5_defconfig | 1 - configs/phycore_am64x_a53_defconfig | 4 ++-- configs/phycore_am64x_r5_defconfig | 1 - 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/configs/phycore_am62x_a53_defconfig b/configs/phycore_am62x_a53_defconfig index 5fe2c9d4422..95a48aa246b 100644 --- a/configs/phycore_am62x_a53_defconfig +++ b/configs/phycore_am62x_a53_defconfig @@ -63,6 +63,7 @@ CONFIG_SYS_SPI_U_BOOT_OFFS=0x280000 CONFIG_SPL_YMODEM_SUPPORT=y CONFIG_CMD_DFU=y CONFIG_CMD_MMC=y +CONFIG_CMD_MTD=y CONFIG_CMD_USB=y CONFIG_OF_CONTROL=y CONFIG_SPL_OF_CONTROL=y @@ -106,10 +107,9 @@ CONFIG_SPI_FLASH_SFDP_SUPPORT=y # CONFIG_SPI_FLASH_SMART_HWCAPS is not set CONFIG_SPI_FLASH_SOFT_RESET=y CONFIG_SPI_FLASH_SOFT_RESET_ON_BOOT=y -CONFIG_SPI_FLASH_SPANSION=y -CONFIG_SPI_FLASH_S28HX_T=y CONFIG_SPI_FLASH_STMICRO=y CONFIG_SPI_FLASH_MT35XU=y +CONFIG_SPI_FLASH_MTD=y CONFIG_PHY_TI_DP83867=y CONFIG_PHY_FIXED=y CONFIG_TI_AM65_CPSW_NUSS=y diff --git a/configs/phycore_am62x_r5_defconfig b/configs/phycore_am62x_r5_defconfig index 82636e8890c..c1664c4295f 100644 --- a/configs/phycore_am62x_r5_defconfig +++ b/configs/phycore_am62x_r5_defconfig @@ -105,7 +105,6 @@ CONFIG_SPI_FLASH_SFDP_SUPPORT=y # CONFIG_SPI_FLASH_SMART_HWCAPS is not set CONFIG_SPI_FLASH_SOFT_RESET=y CONFIG_SPI_FLASH_SOFT_RESET_ON_BOOT=y -CONFIG_SPI_FLASH_SPANSION=y CONFIG_SPI_FLASH_STMICRO=y CONFIG_SPI_FLASH_MT35XU=y CONFIG_PINCTRL=y diff --git a/configs/phycore_am64x_a53_defconfig b/configs/phycore_am64x_a53_defconfig index e94d829fd8f..cf04e145372 100644 --- a/configs/phycore_am64x_a53_defconfig +++ b/configs/phycore_am64x_a53_defconfig @@ -69,6 +69,7 @@ CONFIG_CMD_DFU=y CONFIG_CMD_GPT=y CONFIG_CMD_I2C=y CONFIG_CMD_MMC=y +CONFIG_CMD_MTD=y CONFIG_CMD_USB=y CONFIG_CMD_TIME=y CONFIG_OF_CONTROL=y @@ -120,10 +121,9 @@ CONFIG_SPI_FLASH_SFDP_SUPPORT=y # CONFIG_SPI_FLASH_SMART_HWCAPS is not set CONFIG_SPI_FLASH_SOFT_RESET=y CONFIG_SPI_FLASH_SOFT_RESET_ON_BOOT=y -CONFIG_SPI_FLASH_SPANSION=y -CONFIG_SPI_FLASH_S28HX_T=y CONFIG_SPI_FLASH_STMICRO=y CONFIG_SPI_FLASH_MT35XU=y +CONFIG_SPI_FLASH_MTD=y CONFIG_MULTIPLEXER=y CONFIG_MUX_MMIO=y CONFIG_PHY_TI_DP83867=y diff --git a/configs/phycore_am64x_r5_defconfig b/configs/phycore_am64x_r5_defconfig index 15a7e7089e7..a0d78241928 100644 --- a/configs/phycore_am64x_r5_defconfig +++ b/configs/phycore_am64x_r5_defconfig @@ -121,7 +121,6 @@ CONFIG_SPI_FLASH_SFDP_SUPPORT=y # CONFIG_SPI_FLASH_SMART_HWCAPS is not set CONFIG_SPI_FLASH_SOFT_RESET=y CONFIG_SPI_FLASH_SOFT_RESET_ON_BOOT=y -CONFIG_SPI_FLASH_SPANSION=y CONFIG_SPI_FLASH_STMICRO=y CONFIG_SPI_FLASH_MT35XU=y CONFIG_PHY_TI_DP83867=y From aa52bf1af7ddb036ef1318dc7a9024a746b7857f Mon Sep 17 00:00:00 2001 From: Wadim Egorov Date: Mon, 10 Jun 2024 15:33:50 +0200 Subject: [PATCH 11/13] doc: board: phytec: phycore-am62x: Add USB DFU switch config Provide boot switch config for USB DFU boot. Signed-off-by: Wadim Egorov Reviewed-by: Daniel Schultz --- doc/board/phytec/phycore-am62x.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/board/phytec/phycore-am62x.rst b/doc/board/phytec/phycore-am62x.rst index bc6d5246694..f8870657be0 100644 --- a/doc/board/phytec/phycore-am62x.rst +++ b/doc/board/phytec/phycore-am62x.rst @@ -151,6 +151,10 @@ Boot switches should be changed with power off. - 11011100 - 00000000 + * - USB DFU + - 11001010 + - 00100000 + Further Information ------------------- From 86c2af9c2e39227f44140a96b5c338d45243efc6 Mon Sep 17 00:00:00 2001 From: Wadim Egorov Date: Mon, 10 Jun 2024 15:33:51 +0200 Subject: [PATCH 12/13] doc: board: phytec: phycore-am6: Use mtd commands Update Flash to SPI NOR chapter for use with mtd commands. This is more convenient as we do not have to remember any offsets in the SPI. Signed-off-by: Wadim Egorov Reviewed-by: Daniel Schultz --- doc/board/phytec/phycore-am62x.rst | 8 ++++---- doc/board/phytec/phycore-am64x.rst | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/doc/board/phytec/phycore-am62x.rst b/doc/board/phytec/phycore-am62x.rst index f8870657be0..a615d01474e 100644 --- a/doc/board/phytec/phycore-am62x.rst +++ b/doc/board/phytec/phycore-am62x.rst @@ -110,13 +110,13 @@ tiboot3.bin, tispl.bin and u-boot.img are stored on the uSD card. .. code-block:: bash - sf probe + mtd list fatload mmc 1 ${loadaddr} tiboot3.bin - sf update $loadaddr 0x0 $filesize + mtd write ospi.tiboot3 ${loadaddr} 0 ${filesize} fatload mmc 1 ${loadaddr} tispl.bin - sf update $loadaddr 0x80000 $filesize + mtd write ospi.tispl ${loadaddr} 0 ${filesize} fatload mmc 1 ${loadaddr} u-boot.img - sf update $loadaddr 0x280000 $filesize + mtd write ospi.u-boot ${loadaddr} 0 ${filesize} Boot Modes diff --git a/doc/board/phytec/phycore-am64x.rst b/doc/board/phytec/phycore-am64x.rst index a27ad01027b..189da179534 100644 --- a/doc/board/phytec/phycore-am64x.rst +++ b/doc/board/phytec/phycore-am64x.rst @@ -111,13 +111,13 @@ tiboot3.bin, tispl.bin and u-boot.img are stored on the uSD card. .. code-block:: bash - sf probe + mtd list fatload mmc 1 ${loadaddr} tiboot3.bin - sf update $loadaddr 0x0 $filesize + mtd write ospi.tiboot3 ${loadaddr} 0 ${filesize} fatload mmc 1 ${loadaddr} tispl.bin - sf update $loadaddr 0x80000 $filesize + mtd write ospi.tispl ${loadaddr} 0 ${filesize} fatload mmc 1 ${loadaddr} u-boot.img - sf update $loadaddr 0x280000 $filesize + mtd write ospi.u-boot ${loadaddr} 0 ${filesize} Boot Modes From 680fcbcf55064c5cdf3ef653209da0e925adade6 Mon Sep 17 00:00:00 2001 From: Wadim Egorov Date: Mon, 10 Jun 2024 15:33:52 +0200 Subject: [PATCH 13/13] board: phytec: phycore-am62x: Use memory nodes in higher boot stages There is no need to reread the EEPROM multiple times in different stages to detect the RAM size. We can do this once at an early stage and let higher stages decode memory nodes using fdtdec. Make sure to pass fixup memory nodes before passing to u-boot stage. Signed-off-by: Wadim Egorov Reviewed-by: Daniel Schultz --- board/phytec/phycore_am62x/phycore-am62x.c | 30 +++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/board/phytec/phycore_am62x/phycore-am62x.c b/board/phytec/phycore_am62x/phycore-am62x.c index 35e1bb96b8d..9f6bc736cbb 100644 --- a/board/phytec/phycore_am62x/phycore-am62x.c +++ b/board/phytec/phycore_am62x/phycore-am62x.c @@ -47,7 +47,12 @@ static u8 phytec_get_am62_ddr_size_default(void) int dram_init(void) { - u8 ram_size = phytec_get_am62_ddr_size_default(); + u8 ram_size; + + if (!IS_ENABLED(CONFIG_CPU_V7R)) + return fdtdec_setup_mem_size_base(); + + ram_size = phytec_get_am62_ddr_size_default(); /* * HACK: ddrss driver support 2GB RAM by default @@ -92,6 +97,9 @@ int dram_init_banksize(void) { u8 ram_size; + if (!IS_ENABLED(CONFIG_CPU_V7R)) + return fdtdec_setup_memory_banksize(); + ram_size = phytec_get_am62_ddr_size_default(); switch (ram_size) { case EEPROM_RAM_SIZE_1GB: @@ -174,6 +182,26 @@ int do_board_detect(void) } #endif +#if IS_ENABLED(CONFIG_SPL_BUILD) +void spl_perform_fixups(struct spl_image_info *spl_image) +{ + u64 start[CONFIG_NR_DRAM_BANKS]; + u64 size[CONFIG_NR_DRAM_BANKS]; + int bank; + int ret; + + dram_init(); + dram_init_banksize(); + + for (bank = 0; bank < CONFIG_NR_DRAM_BANKS; bank++) { + start[bank] = gd->bd->bi_dram[bank].start; + size[bank] = gd->bd->bi_dram[bank].size; + } + + ret = fdt_fixup_memory_banks(spl_image->fdt_addr, start, size, CONFIG_NR_DRAM_BANKS); +} +#endif + #define CTRLMMR_USB0_PHY_CTRL 0x43004008 #define CTRLMMR_USB1_PHY_CTRL 0x43004018 #define CORE_VOLTAGE 0x80000000