From 9413635bfb71671a28076597431065b8fef12892 Mon Sep 17 00:00:00 2001 From: Aashvij Shenai Date: Tue, 30 Apr 2024 13:08:53 +0530 Subject: [PATCH] How-To Guide: Update Boot Optimization Guide - Cleanup unnecessary files. The am62xa_nor patch does not have to be given in the guide. The fastxspi files are not relevant for am62a since am62a does not support fastxspi. - Replace :literal: with :code: - Resolve spacing under image - Add table of measurements Signed-off-by: Aashvij Shenai --- source/files/am62ax_nor.patch | 165 ------------------ .../files/fastxspi_pattern_am62a_100MHz.bin | Bin 192 -> 0 bytes .../files/fastxspi_pattern_am62a_133MHz.bin | Bin 192 -> 0 bytes .../files/fastxspi_pattern_am62a_166MHz.bin | Bin 192 -> 0 bytes .../Target/How_to_boot_quickly.rst | 117 +++++++------ 5 files changed, 65 insertions(+), 217 deletions(-) delete mode 100644 source/files/am62ax_nor.patch delete mode 100644 source/files/fastxspi_pattern_am62a_100MHz.bin delete mode 100644 source/files/fastxspi_pattern_am62a_133MHz.bin delete mode 100644 source/files/fastxspi_pattern_am62a_166MHz.bin diff --git a/source/files/am62ax_nor.patch b/source/files/am62ax_nor.patch deleted file mode 100644 index 91ced8043..000000000 --- a/source/files/am62ax_nor.patch +++ /dev/null @@ -1,165 +0,0 @@ -From 46fc19268d993d410607c5a99b9d9a6f21dff812 Mon Sep 17 00:00:00 2001 -From: Aashvij Shenai -Date: Wed, 27 Mar 2024 16:01:57 +0530 -Subject: [PATCH] am62ax: Use NOR - -Signed-off-by: Aashvij Shenai ---- - arch/arm/dts/k3-am62a-main.dtsi | 3 +-- - arch/arm/dts/k3-am62a7-sk-u-boot.dtsi | 4 ++++ - arch/arm/dts/k3-am62a7-sk.dts | 10 +++++----- - configs/am62ax_evm_a53_defconfig | 11 +++++++++-- - configs/am62ax_evm_r5_defconfig | 19 +++++++++++++++++-- - 5 files changed, 36 insertions(+), 11 deletions(-) - -diff --git a/arch/arm/dts/k3-am62a-main.dtsi b/arch/arm/dts/k3-am62a-main.dtsi -index 41aec3a82e86..63f33a71101f 100644 ---- a/arch/arm/dts/k3-am62a-main.dtsi -+++ b/arch/arm/dts/k3-am62a-main.dtsi -@@ -553,7 +553,6 @@ - #address-cells = <2>; - #size-cells = <2>; - ranges; -- status = "disabled"; - - ospi0: spi@fc40000 { - compatible = "ti,am654-ospi", "cdns,qspi-nor"; -@@ -566,7 +565,7 @@ - clocks = <&k3_clks 75 7>; - assigned-clocks = <&k3_clks 75 7>; - assigned-clock-parents = <&k3_clks 75 8>; -- assigned-clock-rates = <166666666>; -+ assigned-clock-rates = <25000000>; - power-domains = <&k3_pds 75 TI_SCI_PD_EXCLUSIVE>; - #address-cells = <1>; - #size-cells = <0>; -diff --git a/arch/arm/dts/k3-am62a7-sk-u-boot.dtsi b/arch/arm/dts/k3-am62a7-sk-u-boot.dtsi -index 090520500570..8de960facff5 100644 ---- a/arch/arm/dts/k3-am62a7-sk-u-boot.dtsi -+++ b/arch/arm/dts/k3-am62a7-sk-u-boot.dtsi -@@ -215,6 +215,10 @@ - - partitions { - bootph-pre-ram; -+ -+ partition@3fc0000 { -+ u-boot,dm-spl; -+ }; - }; - }; - }; -diff --git a/arch/arm/dts/k3-am62a7-sk.dts b/arch/arm/dts/k3-am62a7-sk.dts -index f727b5f82580..6898b412e9d0 100644 ---- a/arch/arm/dts/k3-am62a7-sk.dts -+++ b/arch/arm/dts/k3-am62a7-sk.dts -@@ -409,7 +409,7 @@ - pinctrl-0 = <&ospi0_pins_default>; - - flash@0{ -- compatible = "spi-nand"; -+ compatible = "jedec,spi-nor"; - reg = <0x0>; - spi-tx-bus-width = <8>; - spi-rx-bus-width = <8>; -@@ -451,14 +451,14 @@ - reg = <0x6c0000 0x40000>; - }; - -- partition@2000000 { -+ partition@800000 { - label = "ospi_nand.rootfs"; -- reg = <0x2000000 0x5fc0000>; -+ reg = <0x800000 0x37c0000>; - }; - -- partition@7fc0000 { -+ partition@3fc0000 { - label = "ospi_nand.phypattern"; -- reg = <0x7fc0000 0x40000>; -+ reg = <0x3fc0000 0x40000>; - }; - }; - }; -diff --git a/configs/am62ax_evm_a53_defconfig b/configs/am62ax_evm_a53_defconfig -index 5442796a82e7..bbb1c01d71f4 100644 ---- a/configs/am62ax_evm_a53_defconfig -+++ b/configs/am62ax_evm_a53_defconfig -@@ -48,8 +48,9 @@ CONFIG_SPL_DM_MAILBOX=y - CONFIG_SPL_MTD_SUPPORT=y - CONFIG_SPL_MTD_LOAD=y - CONFIG_SYS_MTD_U_BOOT_OFFS=0x280000 --CONFIG_SPL_NAND_SPI_SUPPORT=y - CONFIG_SPL_DM_SPI_FLASH=y -+CONFIG_SPL_SPI_FLASH_SUPPORT=y -+CONFIG_SPL_SPI_SUPPORT=y - CONFIG_SPL_POWER_DOMAIN=y - CONFIG_SPL_RAM_SUPPORT=y - CONFIG_SPL_USB_GADGET=y -@@ -117,8 +118,14 @@ CONFIG_SPL_MMC_SDHCI_ADMA=y - CONFIG_MMC_SDHCI_AM654=y - CONFIG_MTD=y - CONFIG_DM_MTD=y --CONFIG_MTD_SPI_NAND=y - CONFIG_DM_SPI_FLASH=y -+CONFIG_SPI_FLASH_SFDP_SUPPORT=y -+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_PHY_TI_DP83867=y - CONFIG_TI_AM65_CPSW_NUSS=y - CONFIG_PINCTRL=y -diff --git a/configs/am62ax_evm_r5_defconfig b/configs/am62ax_evm_r5_defconfig -index 156d5a188096..7ee8724b672a 100644 ---- a/configs/am62ax_evm_r5_defconfig -+++ b/configs/am62ax_evm_r5_defconfig -@@ -12,6 +12,10 @@ CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x43c3a7f0 - CONFIG_ENV_SIZE=0x20000 - CONFIG_ENV_OFFSET=0x680000 - CONFIG_SPL_DM_SPI=y -+CONFIG_SPI=y -+CONFIG_DM_SPI=y -+CONFIG_CADENCE_QSPI=y -+CONFIG_CADENCE_QSPI_PHY=y - CONFIG_DEFAULT_DEVICE_TREE="k3-am62a7-r5-sk" - CONFIG_SPL_TEXT_BASE=0x43c00000 - CONFIG_DM_RESET=y -@@ -50,8 +54,12 @@ CONFIG_SPL_DMA=y - CONFIG_SPL_DM_MAILBOX=y - CONFIG_SPL_MTD_SUPPORT=y - CONFIG_SPL_MTD_LOAD=y --CONFIG_SPL_NAND_SPI_SUPPORT=y -+# CONFIG_SPL_NAND_SPI_SUPPORT=y - CONFIG_SPL_DM_SPI_FLASH=y -+CONFIG_SPL_SPI_FLASH_SUPPORT=y -+CONFIG_SPL_SPI_SUPPORT=y -+CONFIG_SPL_SPI_FLASH_SFDP_SUPPORT=y -+CONFIG_SPL_SPI_LOAD=y - CONFIG_SPL_DM_RESET=y - CONFIG_SPL_POWER_DOMAIN=y - CONFIG_SPL_RAM_SUPPORT=y -@@ -103,8 +111,15 @@ CONFIG_MMC_SDHCI_ADMA=y - CONFIG_MMC_SDHCI_AM654=y - CONFIG_MTD=y - CONFIG_DM_MTD=y --CONFIG_MTD_SPI_NAND=y - CONFIG_DM_SPI_FLASH=y -+CONFIG_SF_DEFAULT_MODE=0 -+CONFIG_SPI_FLASH_SFDP_SUPPORT=y -+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_PINCTRL=y - # CONFIG_PINCTRL_GENERIC is not set - CONFIG_SPL_PINCTRL=y - -base-commit: 7d050099177240f6cdf8992310f2cf4941e954af -prerequisite-patch-id: 26f3054c6516aae6a335c354a876ab1690a42de1 --- -2.34.1 - diff --git a/source/files/fastxspi_pattern_am62a_100MHz.bin b/source/files/fastxspi_pattern_am62a_100MHz.bin deleted file mode 100644 index e371e088a0ba6f143a6e16940310ddddcaf5a805..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 192 zcmezOpAiHY82/examples/drivers/boot/sbl_ospi_linux_multistage/sbl_ospi_linux_stage1///ti-arm-clang/` and running :literal:`make syscfg-gui`. Navigate to the `OSPI` section and enable **OSPI skip Tuning option**. Ensure that **Enable PHY** is checked as well. + Open the relevant example's syscfg by navigating into `/examples/drivers/boot/sbl_ospi_linux_multistage/sbl_ospi_linux_stage1///ti-arm-clang/` and running :code:`make syscfg-gui`. Navigate to the `OSPI` section and enable **OSPI skip Tuning option**. Ensure that **Enable PHY** is checked as well. .. Image:: /images/SBL_enable_ospi_phy_skip.png :align: center @@ -235,17 +235,7 @@ Secondary Boot Loader (SBL) This is a special OSPI-NOR boot mode where ROM tunes OSPI when provided with the right parameters. If successful, OSPI PHY tuning need not be done by the bootloader at SBL-stage1 otherwise it will switch to the regular OSPI-NOR mode where tuning has to be done by a subsequent stage. - Flash the relevant binary at :literal:`0x3fc0000`: - - .. ifconfig:: CONFIG_part_variant in ('AM62AX') - - - :download:`OSPI-NOR @100MHz ` - - - :download:`OSPI-NOR @133MHz ` - - - :download:`OSPI-NOR @166MHz ` - - .. ifconfig:: CONFIG_part_variant in ('AM62PX') + Flash the relevant binary at :code:`0x3fc0000`: - :download:`OSPI-NOR @100MHz ` @@ -264,14 +254,14 @@ Secondary Boot Loader (SBL) :download:`ddr_1600_singlerank_am62p.h ` .. Image:: /images/SBL_singlerank_ddr.png - :align: center + :align: center Reducing Linux kernel boot time ------------------------------- -- Adding :literal:`quiet` +- Adding :code:`quiet` - - To save 8+ seconds, add "quiet" argument in the Kernel "bootargs". It suppresses most messages during the Linux start-up sequence. To access the logs after login, you can run :code:`dmesg` for the logs to be printed. By default, quiet is at a loglevel of 4 and should be adequate to suppress the majority of logs but if finer control is required :litera:`quiet` can be replaced with :literal:`loglevel=x` where x can be 1-14. + - To save 8+ seconds, add "quiet" argument in the Kernel "bootargs". It suppresses most messages during the Linux start-up sequence. To access the logs after login, you can run :code:`dmesg` for the logs to be printed. By default, quiet is at a loglevel of 4 and should be adequate to suppress the majority of logs but if finer control is required :code:`quiet` can be replaced with :code:`loglevel=x` where x can be 1-14. - The kernel looks for bootargs in 3 places: U-Boot environment variable, the device tree and the kernel config. You can add the following in any of the 3 locations. @@ -286,10 +276,10 @@ Reducing Linux kernel boot time .. code-block:: dts chosen { - ... - bootargs = "console=ttyS2,115200n8 earlycon=ns16550a,mmio32,0x02800000 quiet"; - ... - }; + ... + bootargs = "console=ttyS2,115200n8 earlycon=ns16550a,mmio32,0x02800000 quiet"; + ... + }; Kernel config: @@ -314,7 +304,7 @@ Reducing Linux kernel boot time - Disabling nodes in DT - Unnecessary nodes can be disabled by adding :literal:`status = "disabled"` to the nodes. While this will not directly affect boot time, the minimal kernel will not throw probe errors during boot. + Unnecessary nodes can be disabled by adding :code:`status = "disabled"` to the nodes. While this will not directly affect boot time, the minimal kernel will not throw probe errors during boot. Reducing userspace boot time ---------------------------- @@ -340,7 +330,7 @@ In order to package the filesystem as initramfs into the kernel, follow these st CONFIG_INITRAMFS_SOURCE="/path/to/filesystem" - or using :literal:`menuconfig`: + or using :code:`menuconfig`: .. code-block:: kconfig @@ -388,6 +378,8 @@ Measurements The following section displays the time taken by each stage to start and end. Four profile points were used: + - PMIC time is taken from the datasheet + - MCU_PORz (White) - MCU Power-On-Reset - SBL_start (Brown) - GPIO is set to LOW as soon as SBL stage 1 is started (Before System_init) @@ -401,12 +393,6 @@ The following section displays the time taken by each stage to start and end. Fo .. Image:: /images/am62x_ospi_boot_analyser.png :align: center - ROM time : SBL_start - MCU_PORz = 33ms - - SBL time : SBL_end - SBL_start = 240ms - - TF-A + OPTEE + Kernel time: Kernel_end - SBL_end = 415ms - .. code-block:: console [2024-03-29 11:52:40.318] NOTICE: BL31: v2.10.0(release):v2.10.0-367-g00f1ec6b87-dirty @@ -414,19 +400,28 @@ The following section displays the time taken by each stage to start and end. Fo [2024-03-29 11:52:41.098] [2024-03-29 11:52:41.098] am62xx-evm login: - To calculate userspace, we use console logs to take timestamps from TF-A to login prompt and subtract kernel time = - + +-------------------+-----------+ + | Stage | Time (ms) | + +===================+===========+ + | PMIC (TPS6521904) | 30 | + +-------------------+-----------+ + | ROM | 33 | + +-------------------+-----------+ + | SBL | 240 | + +-------------------+-----------+ + | Linux Kernel | 415 | + +-------------------+-----------+ + | Tiny FS | 365 | + +-------------------+-----------+ + | Total | 1083 | + +-------------------+-----------+ .. ifconfig:: CONFIG_part_variant in ('AM62AX') .. Image:: /images/am62ax_ospi_boot_analyser.png :align: center - - ROM time : SBL_start - MCU_PORz = 48ms - - SBL time til Linux CPU is started: SBL_end - SBL_start = 624ms - - SBL C7X load + DriversClose + TF-A + OPTEE + Kernel time: Kernel_end - SBL_end = 679ms (~450ms for Kernel) + + *679ms includes SBL C7x image load .. code-block:: console @@ -435,19 +430,27 @@ The following section displays the time taken by each stage to start and end. Fo [2024-03-29 13:02:19.991] [2024-03-29 13:02:19.991] am62xx-evm login: - To calculate userspace, we use console logs to take timestamps from TF-A to login prompt and subtract kernel time = 345ms + +--------------------+-----------+ + | Stage | Time (ms) | + +====================+===========+ + | PMIC (TPS65931211) | 30 | + +--------------------+-----------+ + | ROM | 48 | + +--------------------+-----------+ + | SBL | 624 | + +--------------------+-----------+ + | Linux Kernel | 450 | + +--------------------+-----------+ + | Tiny FS | 345 | + +--------------------+-----------+ + | Total | 1497 | + +--------------------+-----------+ .. ifconfig:: CONFIG_part_variant in ('AM62PX') .. Image:: /images/am62px_ospi_boot_analyser.png :align: center - ROM time : SBL_start - MCU_PORz = 30.79ms - - SBL time : SBL_end - SBL_start = 186.42ms - - TF-A + OPTEE + Kernel time: Kernel_end - SBL_end = 497.67ms - .. code-block:: console [2024-03-29 14:31:25.265] NOTICE: BL31: v2.10.0(release):v2.10.0-367-g00f1ec6b87-dirty @@ -455,7 +458,21 @@ The following section displays the time taken by each stage to start and end. Fo [2024-03-29 14:31:26.117] [2024-03-29 14:31:26.117] am62xx-evm login: - To calculate userspace, we use console logs to take timestamps from TF-A to login prompt and subtract kernel time = 355ms + +-----------------+-----------+ + | Stage | Time (ms) | + +=================+===========+ + | PMIC (TPS65224) | 15 | + +-----------------+-----------+ + | ROM | 31 | + +-----------------+-----------+ + | SBL | 187 | + +-----------------+-----------+ + | Linux Kernel | 498 | + +-----------------+-----------+ + | Tiny FS | 355 | + +-----------------+-----------+ + | Total | 1086 | + +-----------------+-----------+ Additional notes ---------------- @@ -463,7 +480,7 @@ Additional notes .. ifconfig:: CONFIG_part_variant in ('AM62X', 'AM62PX') .. note:: - Ensure that you are not affecting your host computer when making the changes deailed below + Ensure that you are not affecting your host computer when making the changes detailed below - This statically compiled :download:`modetest ` can be added to the filesystem to test out display at boot on an OLDI panel. @@ -491,7 +508,7 @@ Additional notes exec /sbin/init.sysvinit $* - You can get the connector ID and CRTC ID of your OLDI panel by running :literal:`kmsprint` or :literal:`modetest -M tidss` + You can get the connector ID and CRTC ID of your OLDI panel by running :code:`kmsprint` or :code:`modetest -M tidss` - Make it executable @@ -502,11 +519,11 @@ Additional notes .. ifconfig:: CONFIG_part_variant in ('AM62AX') - - While AM62A ships with OSPI-NAND, it can be replaced with the OSPI-NOR flash with ease. It is not recommended to resolder used flashes onto a board. NAND flash support needs to be replaced with NOR flash support + - While AM62A ships with OSPI-NAND, it can be replaced with the OSPI-NOR flash with ease. NAND flash support needs to be replaced with NOR flash support - SPL: - Apply this :download:`patch ` and rebuild `U-Boot `_. + Rebuild `U-Boot `_ with OSPI NOR support. - SBL: @@ -530,8 +547,4 @@ Known issues .. ifconfig:: CONFIG_part_variant in ('AM62AX') - - Due to the implementation of OSPI-NAND software layer in MCU+ SDK, it has been observed that the read performance drops when tuning is skipped. This fix will be incoporated for 10.0 SDK release. - -.. ifconfig:: CONFIG_part_variant in ('AM62X') - - - OSPI stage 2 will not skip tuning by default on AM62X \ No newline at end of file + - Due to the implementation of OSPI-NAND software layer in MCU+ SDK, it has been observed that the read performance drops when tuning is skipped. This fix will be incoporated for 10.0 SDK release. \ No newline at end of file