diff options
author | Tom Rini <trini@konsulko.com> | 2023-10-02 10:55:44 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-10-02 10:55:44 -0400 |
commit | ac897385bbfa30cfdfb62ccf24acfcd4b274b2ff (patch) | |
tree | ae567980737beb24ca24e2ee8cfeaf6eb9e26e3f | |
parent | 4459ed60cb1e0562bc5b40405e2b4b9bbf766d57 (diff) | |
parent | e29b932aa07fa0226d325b35d96cd4eea0370129 (diff) | |
download | u-boot-ac897385bbfa30cfdfb62ccf24acfcd4b274b2ff.zip u-boot-ac897385bbfa30cfdfb62ccf24acfcd4b274b2ff.tar.gz u-boot-ac897385bbfa30cfdfb62ccf24acfcd4b274b2ff.tar.bz2 |
Merge branch 'next'
Signed-off-by: Tom Rini <trini@konsulko.com>
1001 files changed, 20166 insertions, 5808 deletions
diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml index da701e4..7985ff5 100644 --- a/.azure-pipelines.yml +++ b/.azure-pipelines.yml @@ -2,7 +2,7 @@ variables: windows_vm: windows-2019 ubuntu_vm: ubuntu-22.04 macos_vm: macOS-12 - ci_runner_image: trini/u-boot-gitlab-ci-runner:jammy-20230624-20Jul2023 + ci_runner_image: trini/u-boot-gitlab-ci-runner:jammy-20230804-25Aug2023 # Add '-u 0' options for Azure pipelines, otherwise we get "permission # denied" error when it tries to "useradd -m -u 1001 vsts_azpcontainer", # since our $(ci_runner_image) user is not root. @@ -67,16 +67,6 @@ stages: :^doc/ :^arch/arm/dts/ :^scripts/kconfig/lkc.h :^include/linux/kconfig.h :^tools/ && exit 1 || exit 0 - - job: cppcheck - displayName: 'Static code analysis with cppcheck' - pool: - vmImage: $(ubuntu_vm) - container: - image: $(ci_runner_image) - options: $(container_option) - steps: - - script: cppcheck -j$(nproc) --force --quiet --inline-suppr . - - job: docs displayName: 'Build documentation' pool: @@ -92,28 +82,6 @@ stages: make htmldocs KDOC_WERROR=1 make infodocs - - job: todo - displayName: 'Search for TODO within source tree' - pool: - vmImage: $(ubuntu_vm) - container: - image: $(ci_runner_image) - options: $(container_option) - steps: - - script: grep -r TODO . - - script: grep -r FIXME . - - script: grep -r HACK . | grep -v HACKKIT - - - job: sloccount - displayName: 'Some statistics about the code base' - pool: - vmImage: $(ubuntu_vm) - container: - image: $(ci_runner_image) - options: $(container_option) - steps: - - script: sloccount . - - job: maintainers displayName: 'Ensure all configs have MAINTAINERS entries' pool: @@ -126,7 +94,7 @@ stages: ./tools/buildman/buildman --maintainer-check || exit 0 - job: tools_only - displayName: 'Ensure host tools build' + displayName: 'Ensure host tools and env tools build' pool: vmImage: $(ubuntu_vm) container: @@ -135,16 +103,7 @@ stages: steps: - script: | make tools-only_config tools-only -j$(nproc) - - - job: envtools - displayName: 'Ensure env tools build' - pool: - vmImage: $(ubuntu_vm) - container: - image: $(ci_runner_image) - options: $(container_option) - steps: - - script: | + make mrproper make tools-only_config envtools -j$(nproc) - job: utils @@ -163,10 +122,10 @@ stages: . /tmp/venv/bin/activate pip install -r test/py/requirements.txt pip install -r tools/buildman/requirements.txt - export UBOOT_TRAVIS_BUILD_DIR=/tmp/sandbox_spl + export UBOOT_TRAVIS_BUILD_DIR=/tmp/tools-only export PYTHONPATH=${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt export PATH=${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc:${PATH} - ./tools/buildman/buildman -T0 -o ${UBOOT_TRAVIS_BUILD_DIR} -w --board sandbox_spl + ./tools/buildman/buildman -T0 -o ${UBOOT_TRAVIS_BUILD_DIR} -w --board tools-only set -ex ./tools/binman/binman --toolpath ${UBOOT_TRAVIS_BUILD_DIR}/tools test ./tools/buildman/buildman -t @@ -196,8 +155,8 @@ stages: export PATH=${PATH}:~/.local/bin echo "[MASTER]" >> .pylintrc echo "load-plugins=pylint.extensions.docparams" >> .pylintrc - export UBOOT_TRAVIS_BUILD_DIR=/tmp/sandbox_spl - ./tools/buildman/buildman -T0 -o ${UBOOT_TRAVIS_BUILD_DIR} -w --board sandbox_spl + export UBOOT_TRAVIS_BUILD_DIR=/tmp/tools-only + ./tools/buildman/buildman -T0 -o ${UBOOT_TRAVIS_BUILD_DIR} -w --board tools-only set -ex pylint --version export PYTHONPATH=${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt @@ -225,19 +184,109 @@ stages: steps: - script: make pip -- stage: test_py + - job: create_test_py_wrapper_script + displayName: 'Create and stage a wrapper for test.py runs' + pool: + vmImage: $(ubuntu_vm) + steps: + - checkout: none + - script: | + cat << EOF > test.sh + #!/bin/bash + set -ex + # the below corresponds to .gitlab-ci.yml "before_script" + cd \${WORK_DIR} + git config --global --add safe.directory \${WORK_DIR} + git clone --depth=1 https://source.denx.de/u-boot/u-boot-test-hooks /tmp/uboot-test-hooks + ln -s travis-ci /tmp/uboot-test-hooks/bin/\`hostname\` + ln -s travis-ci /tmp/uboot-test-hooks/py/\`hostname\` + grub-mkimage --prefix=\"\" -o ~/grub_x86.efi -O i386-efi normal echo lsefimmap lsefi lsefisystab efinet tftp minicmd + grub-mkimage --prefix=\"\" -o ~/grub_x64.efi -O x86_64-efi normal echo lsefimmap lsefi lsefisystab efinet tftp minicmd + if [[ "\${TEST_PY_BD}" == "qemu-riscv32_spl" ]]; then + wget -O - https://github.com/riscv-software-src/opensbi/releases/download/v1.2/opensbi-1.2-rv-bin.tar.xz | tar -C /tmp -xJ; + export OPENSBI=/tmp/opensbi-1.2-rv-bin/share/opensbi/ilp32/generic/firmware/fw_dynamic.bin; + fi + if [[ "\${TEST_PY_BD}" == "qemu-riscv64_spl" ]] || [[ "\${TEST_PY_BD}" == "sifive_unleashed" ]]; then + wget -O - https://github.com/riscv-software-src/opensbi/releases/download/v1.2/opensbi-1.2-rv-bin.tar.xz | tar -C /tmp -xJ; + export OPENSBI=/tmp/opensbi-1.2-rv-bin/share/opensbi/lp64/generic/firmware/fw_dynamic.bin; + fi + # the below corresponds to .gitlab-ci.yml "script" + cd \${WORK_DIR} + export UBOOT_TRAVIS_BUILD_DIR=/tmp/\${TEST_PY_BD} + if [ -n "\${BUILD_ENV}" ]; then + export \${BUILD_ENV}; + fi + pip install -r tools/buildman/requirements.txt + tools/buildman/buildman -o \${UBOOT_TRAVIS_BUILD_DIR} -w -E -W -e --board \${TEST_PY_BD} \${OVERRIDE} + cp ~/grub_x86.efi \${UBOOT_TRAVIS_BUILD_DIR}/ + cp ~/grub_x64.efi \${UBOOT_TRAVIS_BUILD_DIR}/ + cp /opt/grub/grubriscv64.efi \${UBOOT_TRAVIS_BUILD_DIR}/grub_riscv64.efi + cp /opt/grub/grubaa64.efi \${UBOOT_TRAVIS_BUILD_DIR}/grub_arm64.efi + cp /opt/grub/grubarm.efi \${UBOOT_TRAVIS_BUILD_DIR}/grub_arm.efi + # create sdcard / spi-nor images for sifive unleashed using genimage + if [[ "\${TEST_PY_BD}" == "sifive_unleashed" ]]; then + mkdir -p root; + cp \${UBOOT_TRAVIS_BUILD_DIR}/spl/u-boot-spl.bin .; + cp \${UBOOT_TRAVIS_BUILD_DIR}/u-boot.itb .; + rm -rf tmp; + genimage --inputpath . --config board/sifive/unleashed/genimage_sdcard.cfg; + cp images/sdcard.img \${UBOOT_TRAVIS_BUILD_DIR}/; + rm -rf tmp; + genimage --inputpath . --config board/sifive/unleashed/genimage_spi-nor.cfg; + cp images/spi-nor.img \${UBOOT_TRAVIS_BUILD_DIR}/; + fi + if [[ "\${TEST_PY_BD}" == "coreboot" ]]; then + wget -O - "https://drive.google.com/uc?id=1uJ2VkUQ8czWFZmhJQ90Tp8V_zrJ6BrBH&export=download" |xz -dc >\${UBOOT_TRAVIS_BUILD_DIR}/coreboot.rom; + wget -O - "https://drive.google.com/uc?id=149Cz-5SZXHNKpi9xg6R_5XITWohu348y&export=download" >cbfstool; + chmod a+x cbfstool; + ./cbfstool \${UBOOT_TRAVIS_BUILD_DIR}/coreboot.rom add-flat-binary -f \${UBOOT_TRAVIS_BUILD_DIR}/u-boot.bin -n fallback/payload -c LZMA -l 0x1110000 -e 0x1110000; + fi + virtualenv -p /usr/bin/python3 /tmp/venv + . /tmp/venv/bin/activate + pip install -r test/py/requirements.txt + pip install pytest-azurepipelines + export PATH=/opt/qemu/bin:/tmp/uboot-test-hooks/bin:\${PATH} + export PYTHONPATH=/tmp/uboot-test-hooks/py/travis-ci + # "\${var:+"-k \$var"}" expands to "" if \$var is empty, "-k \$var" if not + ./test/py/test.py -ra -o cache_dir="\$UBOOT_TRAVIS_BUILD_DIR"/.pytest_cache --bd \${TEST_PY_BD} \${TEST_PY_ID} \${TEST_PY_TEST_SPEC:+"-k \${TEST_PY_TEST_SPEC}"} --build-dir "\$UBOOT_TRAVIS_BUILD_DIR" --report-dir "\$UBOOT_TRAVIS_BUILD_DIR" + # the below corresponds to .gitlab-ci.yml "after_script" + rm -rf /tmp/uboot-test-hooks /tmp/venv + EOF + - task: CopyFiles@2 + displayName: 'Copy test.sh for later usage' + inputs: + contents: 'test.sh' + targetFolder: '$(Build.ArtifactStagingDirectory)' + - publish: '$(Build.ArtifactStagingDirectory)/test.sh' + displayName: 'Publish test.sh' + artifact: testsh + +- stage: test_py_sandbox jobs: - - job: test_py - displayName: 'test.py' + - job: test_py_sandbox + displayName: 'test.py for sandbox' pool: vmImage: $(ubuntu_vm) strategy: matrix: sandbox: TEST_PY_BD: "sandbox" + sandbox_asan: + TEST_PY_BD: "sandbox" + OVERRIDE: "-a ASAN" + TEST_PY_TEST_SPEC: "version" sandbox_clang: TEST_PY_BD: "sandbox" OVERRIDE: "-O clang-16" + sandbox_clang_asan: + TEST_PY_BD: "sandbox" + OVERRIDE: "-O clang-16 -a ASAN" + TEST_PY_TEST_SPEC: "version" + sandbox64: + TEST_PY_BD: "sandbox64" + sandbox64_clang: + TEST_PY_BD: "sandbox64" + OVERRIDE: "-O clang-16" sandbox_nolto: TEST_PY_BD: "sandbox" BUILD_ENV: "NO_LTO=1" @@ -256,7 +305,48 @@ stages: TEST_PY_BD: "sandbox" BUILD_ENV: "FTRACE=1 NO_LTO=1" TEST_PY_TEST_SPEC: "trace" - OVERRIDE: "-a CONFIG_TRACE=y -a CONFIG_TRACE_EARLY=y -a CONFIG_TRACE_EARLY_SIZE=0x01000000" + OVERRIDE: "-a CONFIG_TRACE=y -a CONFIG_TRACE_EARLY=y -a CONFIG_TRACE_EARLY_SIZE=0x01000000 -a CONFIG_TRACE_BUFFER_SIZE=0x02000000" + steps: + - download: current + artifact: testsh + - script: | + # make current directory writeable to uboot user inside the container + # as sandbox testing need create files like spi flash images, etc. + # (TODO: clean up this in the future) + chmod 777 . + chmod 755 $(Pipeline.Workspace)/testsh/test.sh + # Filesystem tests need extra docker args to run + set -- + # mount -o loop needs the loop devices + if modprobe loop; then + for d in $(find /dev -maxdepth 1 -name 'loop*'); do + set -- "$@" --device $d:$d + done + fi + # Needed for mount syscall (for guestmount as well) + set -- "$@" --cap-add SYS_ADMIN + # Default apparmor profile denies mounts + set -- "$@" --security-opt apparmor=unconfined + # Some tests using libguestfs-tools need the fuse device to run + docker run "$@" --device /dev/fuse:/dev/fuse \ + -v $PWD:$(work_dir) \ + -v $(Pipeline.Workspace):$(Pipeline.Workspace) \ + -e WORK_DIR="${WORK_DIR}" \ + -e TEST_PY_BD="${TEST_PY_BD}" \ + -e TEST_PY_ID="${TEST_PY_ID}" \ + -e TEST_PY_TEST_SPEC="${TEST_PY_TEST_SPEC}" \ + -e OVERRIDE="${OVERRIDE}" \ + -e BUILD_ENV="${BUILD_ENV}" $(ci_runner_image) \ + $(Pipeline.Workspace)/testsh/test.sh + +- stage: test_py_qemu + jobs: + - job: test_py_qemu + displayName: 'test.py for QEMU platforms' + pool: + vmImage: $(ubuntu_vm) + strategy: + matrix: coreboot: TEST_PY_BD: "coreboot" TEST_PY_ID: "--id qemu" @@ -353,97 +443,25 @@ stages: TEST_PY_ID: "--id qemu" TEST_PY_TEST_SPEC: "not sleep" steps: + - download: current + artifact: testsh - script: | - cat << EOF > test.sh - set -ex - # make environment variables available as tests are running inside a container - export WORK_DIR="${WORK_DIR}" - export TEST_PY_BD="${TEST_PY_BD}" - export TEST_PY_ID="${TEST_PY_ID}" - export TEST_PY_TEST_SPEC="${TEST_PY_TEST_SPEC}" - export OVERRIDE="${OVERRIDE}" - export BUILD_ENV="${BUILD_ENV}" - EOF - cat << "EOF" >> test.sh - # the below corresponds to .gitlab-ci.yml "before_script" - cd ${WORK_DIR} - git config --global --add safe.directory ${WORK_DIR} - git clone --depth=1 https://source.denx.de/u-boot/u-boot-test-hooks /tmp/uboot-test-hooks - ln -s travis-ci /tmp/uboot-test-hooks/bin/`hostname` - ln -s travis-ci /tmp/uboot-test-hooks/py/`hostname` - grub-mkimage --prefix=\"\" -o ~/grub_x86.efi -O i386-efi normal echo lsefimmap lsefi lsefisystab efinet tftp minicmd - grub-mkimage --prefix=\"\" -o ~/grub_x64.efi -O x86_64-efi normal echo lsefimmap lsefi lsefisystab efinet tftp minicmd - if [[ "${TEST_PY_BD}" == "qemu-riscv32_spl" ]]; then - wget -O - https://github.com/riscv-software-src/opensbi/releases/download/v1.2/opensbi-1.2-rv-bin.tar.xz | tar -C /tmp -xJ; - export OPENSBI=/tmp/opensbi-1.2-rv-bin/share/opensbi/ilp32/generic/firmware/fw_dynamic.bin; - fi - if [[ "${TEST_PY_BD}" == "qemu-riscv64_spl" ]] || [[ "${TEST_PY_BD}" == "sifive_unleashed" ]]; then - wget -O - https://github.com/riscv-software-src/opensbi/releases/download/v1.2/opensbi-1.2-rv-bin.tar.xz | tar -C /tmp -xJ; - export OPENSBI=/tmp/opensbi-1.2-rv-bin/share/opensbi/lp64/generic/firmware/fw_dynamic.bin; - fi - # the below corresponds to .gitlab-ci.yml "script" - cd ${WORK_DIR} - export UBOOT_TRAVIS_BUILD_DIR=/tmp/${TEST_PY_BD}; - if [ -n "${BUILD_ENV}" ]; then - export ${BUILD_ENV}; - fi - pip install -r tools/buildman/requirements.txt - tools/buildman/buildman -o ${UBOOT_TRAVIS_BUILD_DIR} -w -E -W -e --board ${TEST_PY_BD} ${OVERRIDE} - cp ~/grub_x86.efi ${UBOOT_TRAVIS_BUILD_DIR}/ - cp ~/grub_x64.efi ${UBOOT_TRAVIS_BUILD_DIR}/ - cp /opt/grub/grubriscv64.efi ${UBOOT_TRAVIS_BUILD_DIR}/grub_riscv64.efi - cp /opt/grub/grubaa64.efi ${UBOOT_TRAVIS_BUILD_DIR}/grub_arm64.efi - cp /opt/grub/grubarm.efi ${UBOOT_TRAVIS_BUILD_DIR}/grub_arm.efi - # create sdcard / spi-nor images for sifive unleashed using genimage - if [[ "${TEST_PY_BD}" == "sifive_unleashed" ]]; then - mkdir -p root; - cp ${UBOOT_TRAVIS_BUILD_DIR}/spl/u-boot-spl.bin .; - cp ${UBOOT_TRAVIS_BUILD_DIR}/u-boot.itb .; - rm -rf tmp; - genimage --inputpath . --config board/sifive/unleashed/genimage_sdcard.cfg; - cp images/sdcard.img ${UBOOT_TRAVIS_BUILD_DIR}/; - rm -rf tmp; - genimage --inputpath . --config board/sifive/unleashed/genimage_spi-nor.cfg; - cp images/spi-nor.img ${UBOOT_TRAVIS_BUILD_DIR}/; - fi - if [[ "${TEST_PY_BD}" == "coreboot" ]]; then - wget -O - "https://drive.google.com/uc?id=1uJ2VkUQ8czWFZmhJQ90Tp8V_zrJ6BrBH&export=download" |xz -dc >${UBOOT_TRAVIS_BUILD_DIR}/coreboot.rom; - wget -O - "https://drive.google.com/uc?id=149Cz-5SZXHNKpi9xg6R_5XITWohu348y&export=download" >cbfstool; - chmod a+x cbfstool; - ./cbfstool ${UBOOT_TRAVIS_BUILD_DIR}/coreboot.rom add-flat-binary -f ${UBOOT_TRAVIS_BUILD_DIR}/u-boot.bin -n fallback/payload -c LZMA -l 0x1110000 -e 0x1110000; - fi - virtualenv -p /usr/bin/python3 /tmp/venv - . /tmp/venv/bin/activate - pip install -r test/py/requirements.txt - pip install pytest-azurepipelines - export PATH=/opt/qemu/bin:/tmp/uboot-test-hooks/bin:${PATH}; - export PYTHONPATH=/tmp/uboot-test-hooks/py/travis-ci; - # "${var:+"-k $var"}" expands to "" if $var is empty, "-k $var" if not - ./test/py/test.py -ra -o cache_dir="$UBOOT_TRAVIS_BUILD_DIR"/.pytest_cache --bd ${TEST_PY_BD} ${TEST_PY_ID} ${TEST_PY_TEST_SPEC:+"-k ${TEST_PY_TEST_SPEC}"} --build-dir "$UBOOT_TRAVIS_BUILD_DIR" --report-dir "$UBOOT_TRAVIS_BUILD_DIR"; - # the below corresponds to .gitlab-ci.yml "after_script" - rm -rf /tmp/uboot-test-hooks /tmp/venv - EOF - cat test.sh # make current directory writeable to uboot user inside the container # as sandbox testing need create files like spi flash images, etc. # (TODO: clean up this in the future) chmod 777 . - # Filesystem tests need extra docker args to run - set -- - if [[ "${TEST_PY_BD}" == "sandbox" ]]; then - # mount -o loop needs the loop devices - if modprobe loop; then - for d in $(find /dev -maxdepth 1 -name 'loop*'); do - set -- "$@" --device $d:$d - done - fi - # Needed for mount syscall (for guestmount as well) - set -- "$@" --cap-add SYS_ADMIN - # Default apparmor profile denies mounts - set -- "$@" --security-opt apparmor=unconfined - fi + chmod 755 $(Pipeline.Workspace)/testsh/test.sh # Some tests using libguestfs-tools need the fuse device to run - docker run "$@" --device /dev/fuse:/dev/fuse -v $PWD:$(work_dir) $(ci_runner_image) /bin/bash $(work_dir)/test.sh + docker run "$@" --device /dev/fuse:/dev/fuse \ + -v $PWD:$(work_dir) \ + -v $(Pipeline.Workspace):$(Pipeline.Workspace) \ + -e WORK_DIR="${WORK_DIR}" \ + -e TEST_PY_BD="${TEST_PY_BD}" \ + -e TEST_PY_ID="${TEST_PY_ID}" \ + -e TEST_PY_TEST_SPEC="${TEST_PY_TEST_SPEC}" \ + -e OVERRIDE="${OVERRIDE}" \ + -e BUILD_ENV="${BUILD_ENV}" $(ci_runner_image) \ + $(Pipeline.Workspace)/testsh/test.sh retryCountOnTaskFailure: 2 # QEMU may be too slow, etc. - stage: world_build @@ -457,84 +475,26 @@ stages: # Use almost the same target division in .travis.yml, only merged # 3 small build jobs (arc/microblaze/xtensa) into one. matrix: - arc_nios2_m68k_microblaze_xtensa: - BUILDMAN: "arc nios2 microblaze m68k xtensa" - amlogic: - BUILDMAN: "amlogic" - arm11_arm7_arm920t_arm946es: - BUILDMAN: "arm11 arm7 arm920t arm946es" - arm926ejs: - BUILDMAN: "arm926ejs -x freescale,siemens,at91,kirkwood,omap" - at91_non_armv7: - BUILDMAN: "at91 -x armv7" - at91_non_arm926ejs: - BUILDMAN: "at91 -x arm926ejs" - boundary_engicam_toradex: - BUILDMAN: "boundary engicam toradex" - arm_bcm: - BUILDMAN: "bcm -x mips" - nxp_arm32: - BUILDMAN: "freescale -x powerpc,m68k,aarch64,ls101,ls102,ls104,ls108,ls20,lx216" - nxp_ls101x_ls108x: - BUILDMAN: "freescale&ls101 freescale&ls108" - nxp_ls102x: - BUILDMAN: "freescale&ls102 -x keymile" - nxp_ls104x: - BUILDMAN: "freescale&ls104" - nxp_ls20xx_lx216x: - BUILDMAN: "freescale&ls20 freescale&lx216" - imx6: - BUILDMAN: "mx6 -x boundary,engicam,freescale,technexion,toradex" + am33xx_at91_kirkwood_mvebu_omap: + BUILDMAN: "am33xx at91_kirkwood mvebu omap -x siemens" + amlogic_bcm_boundary_engicam_siemens_technexion_oradex: + BUILDMAN: "amlogic bcm boundary engicam siemens technexion toradex -x mips" + arm_nxp_minus_imx: + BUILDMAN: "freescale -x powerpc,m68k,imx,mx" imx: - BUILDMAN: "mx -x mx6,imx8,freescale,technexion,toradex" - imx8_imx9: - BUILDMAN: "imx8 imx9 -x engicam,technexion,toradex" - keymiles_siemens_technexion: - BUILDMAN: "keymile siemens technexion" - keystone2_keystone3: - BUILDMAN: "k2 k3 -x siemens,toradex" - sandbox_asan: - BUILDMAN: "sandbox" - OVERRIDE: "-a ASAN" - sandbox_clang_asan: - BUILDMAN: "sandbox" - OVERRIDE: "-O clang-16 -a ASAN" - samsung_socfpga_renesas: - BUILDMAN: "samsung socfpga renesas" - sun4i_sun9i: - BUILDMAN: "sun4i sun9i" - sun5i_sun6i: - BUILDMAN: "sun5i sun6i" - sun7i: - BUILDMAN: "sun7i" - sun8i: - BUILDMAN: "sun8i" - sun50i: - BUILDMAN: "sun50i" - arm_catch_all: - BUILDMAN: "arm -x arm11,arm7,arm9,aarch64,at91,bcm,freescale,kirkwood,mvebu,renesas,siemens,tegra,uniphier,mx,samsung,sunxi,am33xx,omap,toradex,socfpga,k2,k3,zynq" - sandbox_x86: - BUILDMAN: "sandbox x86" - kirkwood_mvebu_uniphier: - BUILDMAN: "kirkwood mvebu uniphier" - mips: - BUILDMAN: "mips" + BUILDMAN: "mx imx -x boundary,engicam,technexion,toradex" + rk: + BUILDMAN: "rk" + sunxi: + BUILDMAN: "sunxi" powerpc: - BUILDMAN: "powerpc -x keymile" - tegra: - BUILDMAN: "tegra -x toradex" - am33xx_omap: - BUILDMAN: "am33xx omap -x siemens" + BUILDMAN: "powerpc" + arm_catch_all: + BUILDMAN: "arm -x aarch64,am33xx,at91,bcm,ls1,kirkwood,mvebu,omap,rk,siemens,mx,sunxi,technexion,toradex" aarch64_catch_all: - BUILDMAN: "aarch64 -x amlogic,bcm,imx8,imx9,k3,tegra,ls1,ls2,lx216,mvebu,uniphier,renesas,sunxi,samsung,socfpga,rk,versal,zynq" - rk_non_rockchip_64bit: - BUILDMAN: "rk&aarch64 -x rockchip" - rk_rockchip_64bit: - BUILDMAN: "rk&aarch64&rockchip" - zynq_zynqmp_versal: - BUILDMAN: "zynq&armv7 versal zynqmp&aarch64" - riscv: - BUILDMAN: "riscv" + BUILDMAN: "aarch64 -x amlogic,bcm,engicam,imx,ls1,ls2,lx216,mvebu,rk,siemens,sunxi,toradex" + everything_but_arm_and_powerpc: + BUILDMAN: "-x arm,powerpc" steps: - script: | cat << EOF > build.sh @@ -35,7 +35,7 @@ *.tab.[ch] # Build tree -/build-* +/build* # # Top-level generic files diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2ceeb94..129234b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -10,7 +10,7 @@ default: # Grab our configured image. The source for this is found # in the u-boot tree at tools/docker/Dockerfile -image: ${MIRROR_DOCKER}/trini/u-boot-gitlab-ci-runner:jammy-20230624-20Jul2023 +image: ${MIRROR_DOCKER}/trini/u-boot-gitlab-ci-runner:jammy-20230804-25Aug2023 # We run some tests in different order, to catch some failures quicker. stages: @@ -21,6 +21,8 @@ stages: .buildman_and_testpy_template: &buildman_and_testpy_dfn stage: test.py retry: 2 # QEMU may be too slow, etc. + rules: + - when: always before_script: # Clone uboot-test-hooks - git config --global --add safe.directory "${CI_PROJECT_DIR}" @@ -93,8 +95,13 @@ stages: - "*.css" expire_in: 1 week -build all 32bit ARM platforms: +.world_build: stage: world build + rules: + - when: always + +build all 32bit ARM platforms: + extends: .world_build script: - ret=0; git config --global --add safe.directory "${CI_PROJECT_DIR}"; @@ -106,7 +113,7 @@ build all 32bit ARM platforms: fi; build all 64bit ARM platforms: - stage: world build + extends: .world_build script: - virtualenv -p /usr/bin/python3 /tmp/venv - . /tmp/venv/bin/activate @@ -120,7 +127,7 @@ build all 64bit ARM platforms: fi; build all PowerPC platforms: - stage: world build + extends: .world_build script: - ret=0; git config --global --add safe.directory "${CI_PROJECT_DIR}"; @@ -131,7 +138,7 @@ build all PowerPC platforms: fi; build all other platforms: - stage: world build + extends: .world_build script: - ret=0; git config --global --add safe.directory "${CI_PROJECT_DIR}"; @@ -141,8 +148,13 @@ build all other platforms: exit $ret; fi; -check for new CONFIG symbols outside Kconfig: +.testsuites: stage: testsuites + rules: + - when: always + +check for new CONFIG symbols outside Kconfig: + extends: .testsuites script: - git config --global --add safe.directory "${CI_PROJECT_DIR}" # If grep succeeds and finds a match the test fails as we should @@ -151,25 +163,9 @@ check for new CONFIG symbols outside Kconfig: :^doc/ :^arch/arm/dts/ :^scripts/kconfig/lkc.h :^include/linux/kconfig.h :^tools/ && exit 1 || exit 0 -# QA jobs for code analytics -# static code analysis with cppcheck (we can add --enable=all later) -cppcheck: - stage: testsuites - script: - - cppcheck -j$(nproc) --force --quiet --inline-suppr . - -# search for TODO within source tree -grep TODO/FIXME/HACK: - stage: testsuites - script: - - grep -r TODO . - - grep -r FIXME . - # search for HACK within source tree and ignore HACKKIT board - - grep -r HACK . | grep -v HACKKIT - # build documentation docs: - stage: testsuites + extends: .testsuites script: - virtualenv -p /usr/bin/python3 /tmp/venvhtml - . /tmp/venvhtml/bin/activate @@ -177,32 +173,22 @@ docs: - make htmldocs KDOC_WERROR=1 - make infodocs -# some statistics about the code base -sloccount: - stage: testsuites - script: - - sloccount . - # ensure all configs have MAINTAINERS entries Check for configs without MAINTAINERS entry: - stage: testsuites + extends: .testsuites script: - ./tools/buildman/buildman --maintainer-check || exit 0 # Ensure host tools build -Build tools-only: - stage: testsuites +Build tools-only and envtools: + extends: .testsuites script: - - make tools-only_config tools-only -j$(nproc) - -# Ensure env tools build -Build envtools: - stage: testsuites - script: - - make tools-only_config envtools -j$(nproc) + - make tools-only_config tools-only -j$(nproc); + make mrproper; + make tools-only_config envtools -j$(nproc) Run binman, buildman, dtoc, Kconfig and patman testsuites: - stage: testsuites + extends: .testsuites script: - git config --global user.name "GitLab CI Runner"; git config --global user.email trini@konsulko.com; @@ -212,12 +198,12 @@ Run binman, buildman, dtoc, Kconfig and patman testsuites: . /tmp/venv/bin/activate; pip install -r test/py/requirements.txt; pip install -r tools/buildman/requirements.txt; - export UBOOT_TRAVIS_BUILD_DIR=/tmp/sandbox_spl; + export UBOOT_TRAVIS_BUILD_DIR=/tmp/tools-only; export PYTHONPATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt"; export PATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc:${PATH}"; set +e; ./tools/buildman/buildman -T0 -o ${UBOOT_TRAVIS_BUILD_DIR} -w - --board sandbox_spl; + --board tools-only; set -e; ./tools/binman/binman --toolpath ${UBOOT_TRAVIS_BUILD_DIR}/tools test; ./tools/buildman/buildman -t; @@ -227,7 +213,7 @@ Run binman, buildman, dtoc, Kconfig and patman testsuites: # Check for any pylint regressions Run pylint: - stage: testsuites + extends: .testsuites script: - git config --global --add safe.directory "${CI_PROJECT_DIR}" - pip install -r test/py/requirements.txt @@ -236,10 +222,10 @@ Run pylint: - export PATH=${PATH}:~/.local/bin - echo "[MASTER]" >> .pylintrc - echo "load-plugins=pylint.extensions.docparams" >> .pylintrc - - export UBOOT_TRAVIS_BUILD_DIR=/tmp/sandbox_spl + - export UBOOT_TRAVIS_BUILD_DIR=/tmp/tools-only - set +e - ./tools/buildman/buildman -T0 -o ${UBOOT_TRAVIS_BUILD_DIR} -w - --board sandbox_spl + --board tools-only - set -e - pylint --version - export PYTHONPATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt" @@ -247,7 +233,7 @@ Run pylint: # Check for pre-schema driver model tags Check for pre-schema tags: - stage: testsuites + extends: .testsuites script: - git config --global --add safe.directory "${CI_PROJECT_DIR}"; # If grep succeeds and finds a match the test fails as we should @@ -256,7 +242,7 @@ Check for pre-schema tags: # Check we can package the Python tools Check packing of Python tools: - stage: testsuites + extends: .testsuites script: - make pip @@ -278,6 +264,23 @@ sandbox without LTO test.py: BUILD_ENV: "NO_LTO=1" <<: *buildman_and_testpy_dfn +sandbox64 test.py: + variables: + TEST_PY_BD: "sandbox64" + <<: *buildman_and_testpy_dfn + +sandbox64 with clang test.py: + variables: + TEST_PY_BD: "sandbox64" + OVERRIDE: "-O clang-16" + <<: *buildman_and_testpy_dfn + +sandbox64 without LTO test.py: + variables: + TEST_PY_BD: "sandbox64" + BUILD_ENV: "NO_LTO=1" + <<: *buildman_and_testpy_dfn + sandbox_spl test.py: variables: TEST_PY_BD: "sandbox_spl" @@ -302,7 +305,7 @@ sandbox trace_test.py: TEST_PY_BD: "sandbox" BUILD_ENV: "FTRACE=1 NO_LTO=1" TEST_PY_TEST_SPEC: "trace" - OVERRIDE: "-a CONFIG_TRACE=y -a CONFIG_TRACE_EARLY=y -a CONFIG_TRACE_EARLY_SIZE=0x01000000" + OVERRIDE: "-a CONFIG_TRACE=y -a CONFIG_TRACE_EARLY=y -a CONFIG_TRACE_EARLY_SIZE=0x01000000 -a CONFIG_TRACE_BUFFER_SIZE=0x02000000" <<: *buildman_and_testpy_dfn evb-ast2500 test.py: @@ -596,10 +596,95 @@ config MP This provides an option to bringup different processors in multiprocessor cases. -endmenu # General setup +config HAVE_TEXT_BASE + bool + depends on !NIOS2 && !XTENSA + depends on !EFI_APP + default y + +config TEXT_BASE + depends on HAVE_TEXT_BASE + default 0x0 if POSITION_INDEPENDENT + default 0x80800000 if ARCH_OMAP2PLUS || ARCH_K3 + default 0x81700000 if MACH_SUNIV + default 0x2a000000 if MACH_SUN9I + default 0x4a000000 if SUNXI_MINIMUM_DRAM_MB >= 256 + default 0x42e00000 if SUNXI_MINIMUM_DRAM_MB >= 64 + hex "Text Base" + help + The address in memory that U-Boot will be copied and executed from + initially. + +config HAVE_SYS_UBOOT_START + bool "Use custom U-Boot Start" + depends on HAVE_TEXT_BASE + help + By default, the address in memory that U-Boot will be copied from + (TEXT_BASE) and the entry point are the same. Select this to start the + execution of U-Boot from a different address. + This may be required if a header or vector table needs to be copied + but not executed. + +config SYS_UBOOT_START + hex + depends on HAVE_TEXT_BASE + default TEXT_BASE + prompt "U-Boot entry" if HAVE_SYS_UBOOT_START + help + If TEXT_BASE differs from the start of execution, this sets the + address in memory that U-Boot will start execution from initially. + +config HAVE_SYS_MONITOR_BASE + bool + depends on ARC || MIPS || M68K || NIOS2 || PPC || XTENSA || X86 \ + || ENV_IS_IN_FLASH || MTD_NOR_FLASH + depends on !EFI_APP + default y + +config SYS_MONITOR_BASE + depends on HAVE_SYS_MONITOR_BASE + hex "Physical start address of boot monitor code" + default TEXT_BASE + help + The physical start address of boot monitor code (which is the same as + CONFIG_TEXT_BASE when linking) and the same as CFG_SYS_FLASH_BASE + when booting from flash. + +config SPL_SYS_MONITOR_BASE + depends on MPC85xx && SPL && HAVE_SYS_MONITOR_BASE + hex "Physical start address of SPL monitor code" + default SPL_TEXT_BASE + +config TPL_SYS_MONITOR_BASE + depends on MPC85xx && TPL && HAVE_SYS_MONITOR_BASE + hex "Physical start address of TPL monitor code" + +config DYNAMIC_SYS_CLK_FREQ + bool "Determine CPU clock frequency at run-time" + help + Implement a get_board_sys_clk function that will determine the CPU + clock frequency at run time, rather than define it statically. + +config SYS_CLK_FREQ + depends on !DYNAMIC_SYS_CLK_FREQ + int "CPU clock frequency" + default 125000000 if ARCH_LS1012A + default 100000000 if ARCH_P2020 || ARCH_T1024 || ARCH_T1042 || \ + ARCH_LS1021A || FSL_LSCH2 || FSL_LSCH3 + default 66666666 if ARCH_P1010 || ARCH_P1020 || ARCH_T4240 + default 66660000 if ARCH_T2080 + default 33333333 if RCAR_GEN3 + default 24000000 if ARCH_EXYNOS + default 20000000 if RCAR_GEN2 + default 0 + help + A static value for the CPU frequency. Note that if not required + for a given SoC, this can be left at 0. source "api/Kconfig" +endmenu # General setup + source "boot/Kconfig" source "common/Kconfig" diff --git a/MAINTAINERS b/MAINTAINERS index 1999191..4df7925 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -123,6 +123,7 @@ F: configs/apple_m1_defconfig F: drivers/iommu/apple_dart.c F: drivers/nvme/nvme_apple.c F: drivers/pci/pcie_apple.c +F: drivers/phy/phy-apple-atc.c F: drivers/pinctrl/pinctrl-apple.c F: drivers/watchdog/apple_wdt.c F: include/configs/apple.h @@ -485,6 +485,15 @@ export RCS_FIND_IGNORE := \( -name SCCS -o -name BitKeeper -o -name .svn -o \ export RCS_TAR_IGNORE := --exclude SCCS --exclude BitKeeper --exclude .svn \ --exclude CVS --exclude .pc --exclude .hg --exclude .git +export PYTHON_ENABLE + +# This is y if U-Boot should not build any Python tools or libraries. Typically +# you would need to set this if those tools/libraries (typically binman and +# pylibfdt) cannot be built by your environment and are provided separately. +ifeq ($(NO_PYTHON),) +PYTHON_ENABLE=y +endif + # =========================================================================== # Rules shared between *config targets and build targets @@ -1358,14 +1367,6 @@ OBJCOPYFLAGS_u-boot.ldr.srec := -I binary -O srec u-boot.ldr.hex u-boot.ldr.srec: u-boot.ldr FORCE $(call if_changed,objcopy) -# -# U-Boot entry point, needed for booting of full-blown U-Boot -# from the SPL U-Boot version. -# -ifndef CFG_SYS_UBOOT_START -CFG_SYS_UBOOT_START := $(CONFIG_TEXT_BASE) -endif - # Boards with more complex image requirements can provide an .its source file # or a generator script # NOTE: Please do not use this. We are migrating away from Makefile rules to use @@ -1385,7 +1386,7 @@ endif ifdef CONFIG_SPL_LOAD_FIT MKIMAGEFLAGS_u-boot.img = -f auto -A $(ARCH) -T firmware -C none -O u-boot \ - -a $(CONFIG_TEXT_BASE) -e $(CFG_SYS_UBOOT_START) \ + -a $(CONFIG_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \ -p $(CONFIG_FIT_EXTERNAL_OFFSET) \ -n "U-Boot $(UBOOTRELEASE) for $(BOARD) board" -E \ $(patsubst %,-b arch/$(ARCH)/dts/%.dtb,$(subst ",,$(DEVICE_TREE))) \ @@ -1393,10 +1394,10 @@ MKIMAGEFLAGS_u-boot.img = -f auto -A $(ARCH) -T firmware -C none -O u-boot \ $(patsubst %,-b arch/$(ARCH)/dts/%.dtbo,$(subst ",,$(CONFIG_OF_OVERLAY_LIST))) else MKIMAGEFLAGS_u-boot.img = -A $(ARCH) -T firmware -C none -O u-boot \ - -a $(CONFIG_TEXT_BASE) -e $(CFG_SYS_UBOOT_START) \ + -a $(CONFIG_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \ -n "U-Boot $(UBOOTRELEASE) for $(BOARD) board" MKIMAGEFLAGS_u-boot-ivt.img = -A $(ARCH) -T firmware_ivt -C none -O u-boot \ - -a $(CONFIG_TEXT_BASE) -e $(CFG_SYS_UBOOT_START) \ + -a $(CONFIG_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \ -n "U-Boot $(UBOOTRELEASE) for $(BOARD) board" u-boot-ivt.img: MKIMAGEOUTPUT = u-boot-ivt.img.log endif @@ -1427,7 +1428,7 @@ MKIMAGEFLAGS_u-boot.pbl = -n $(srctree)/$(CONFIG_SYS_FSL_PBL_RCW:"%"=%) \ UBOOT_BIN := u-boot.bin MKIMAGEFLAGS_u-boot-lzma.img = -A $(ARCH) -T standalone -C lzma -O u-boot \ - -a $(CONFIG_TEXT_BASE) -e $(CFG_SYS_UBOOT_START) \ + -a $(CONFIG_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \ -n "U-Boot $(UBOOTRELEASE) for $(BOARD) board" u-boot.bin.lzma: u-boot.bin FORCE diff --git a/arch/Kconfig b/arch/Kconfig index c9a3359..19f2891 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -68,7 +68,6 @@ config M68K bool "M68000 architecture" select HAVE_PRIVATE_LIBGCC select USE_PRIVATE_LIBGCC - select NEEDS_MANUAL_RELOC select SYS_BOOT_GET_CMDLINE select SYS_BOOT_GET_KBD select SYS_CACHE_SHIFT_4 @@ -252,6 +251,7 @@ config X86 imply DM_SPI imply DM_SPI_FLASH imply DM_USB + imply LAST_STAGE_INIT imply VIDEO imply SYSRESET imply SPL_SYSRESET diff --git a/arch/arc/include/asm/sections.h b/arch/arc/include/asm/sections.h index 1c9c9db..ffad4a6 100644 --- a/arch/arc/include/asm/sections.h +++ b/arch/arc/include/asm/sections.h @@ -8,7 +8,8 @@ #include <asm-generic/sections.h> -extern ulong __ivt_start; -extern ulong __ivt_end; +extern char __ivt_start[]; +extern char __ivt_end[]; +extern char __text_end[]; #endif /* __ASM_ARC_SECTIONS_H */ diff --git a/arch/arc/lib/relocate.c b/arch/arc/lib/relocate.c index 7f531c9..fd6f4fb 100644 --- a/arch/arc/lib/relocate.c +++ b/arch/arc/lib/relocate.c @@ -6,32 +6,27 @@ #include <common.h> #include <elf.h> #include <log.h> -#include <asm-generic/sections.h> +#include <asm/sections.h> #include <asm/global_data.h> -extern ulong __image_copy_start; -extern ulong __ivt_start; -extern ulong __ivt_end; -extern ulong __text_end; - DECLARE_GLOBAL_DATA_PTR; int copy_uboot_to_ram(void) { - size_t len = (size_t)&__image_copy_end - (size_t)&__image_copy_start; + size_t len = (size_t)__image_copy_end - (size_t)__image_copy_start; if (gd->flags & GD_FLG_SKIP_RELOC) return 0; - memcpy((void *)gd->relocaddr, (void *)&__image_copy_start, len); + memcpy((void *)gd->relocaddr, (void *)__image_copy_start, len); return 0; } int clear_bss(void) { - ulong dst_addr = (ulong)&__bss_start + gd->reloc_off; - size_t len = (size_t)&__bss_end - (size_t)&__bss_start; + ulong dst_addr = (ulong)__bss_start + gd->reloc_off; + size_t len = (size_t)__bss_end - (size_t)__bss_start; memset((void *)dst_addr, 0x00, len); @@ -43,8 +38,8 @@ int clear_bss(void) */ int do_elf_reloc_fixups(void) { - Elf32_Rela *re_src = (Elf32_Rela *)(&__rel_dyn_start); - Elf32_Rela *re_end = (Elf32_Rela *)(&__rel_dyn_end); + Elf32_Rela *re_src = (Elf32_Rela *)__rel_dyn_start; + Elf32_Rela *re_end = (Elf32_Rela *)__rel_dyn_end; if (gd->flags & GD_FLG_SKIP_RELOC) return 0; @@ -60,8 +55,8 @@ int do_elf_reloc_fixups(void) offset_ptr_rom = (Elf32_Addr *)re_src->r_offset; /* Check that the location of the relocation is in .text */ - if (offset_ptr_rom >= (Elf32_Addr *)&__image_copy_start && - offset_ptr_rom < (Elf32_Addr *)&__image_copy_end) { + if (offset_ptr_rom >= (Elf32_Addr *)__image_copy_start && + offset_ptr_rom < (Elf32_Addr *)__image_copy_end) { unsigned int val, do_swap = 0; /* Switch to the in-RAM version */ offset_ptr_ram = (Elf32_Addr *)((ulong)offset_ptr_rom + @@ -69,11 +64,11 @@ int do_elf_reloc_fixups(void) #ifdef __LITTLE_ENDIAN__ /* If location in ".text" section swap value */ - if (((u32)offset_ptr_rom >= (u32)&__text_start && - (u32)offset_ptr_rom <= (u32)&__text_end) + if (((u32)offset_ptr_rom >= (u32)__text_start && + (u32)offset_ptr_rom <= (u32)__text_end) #if defined(__ARC700__) || defined(__ARC600__) - || ((u32)offset_ptr_rom >= (u32)&__ivt_start && - (u32)offset_ptr_rom <= (u32)&__ivt_end) + || ((u32)offset_ptr_rom >= (u32)__ivt_start && + (u32)offset_ptr_rom <= (u32)__ivt_end) #endif ) do_swap = 1; @@ -96,8 +91,8 @@ int do_elf_reloc_fixups(void) val = (val << 16) | (val >> 16); /* Check that the target points into executable */ - if (val < (unsigned int)&__image_copy_start || - val > (unsigned int)&__image_copy_end) { + if (val < (unsigned int)__image_copy_start || + val > (unsigned int)__image_copy_end) { /* TODO: Use panic() instead of debug() * * For some reason GCC might generate @@ -106,7 +101,7 @@ int do_elf_reloc_fixups(void) * ----------------------->8-------------------- * static int setup_mon_len(void) * { - * gd->mon_len = (ulong)&__bss_end - CONFIG_SYS_MONITOR_BASE; + * gd->mon_len = (ulong)__bss_end - CONFIG_SYS_MONITOR_BASE; * return 0; * } * ----------------------->8-------------------- diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 328e2dd..7b09784 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -998,6 +998,7 @@ config ARCH_APPLE select OF_BOARD_SETUP select OF_CONTROL select PCI + select PHY select PINCTRL select POSITION_INDEPENDENT select POWER_DOMAIN @@ -1036,6 +1037,16 @@ config ARCH_QEMU imply DM_RTC imply RTC_PL031 imply OF_HAS_PRIOR_STAGE + imply VIDEO + imply VIDEO_BOCHS + imply SYS_WHITE_ON_BLACK + imply SYS_CONSOLE_IS_IN_ENV + imply PRE_CONSOLE_BUFFER + imply USB + imply USB_XHCI_HCD + imply USB_XHCI_PCI + imply USB_KEYBOARD + imply CMD_USB config ARCH_RMOBILE bool "Renesas ARM SoCs" diff --git a/arch/arm/cpu/arm926ejs/mxs/mxs.c b/arch/arm/cpu/arm926ejs/mxs/mxs.c index 4d21e3d..6d6166c 100644 --- a/arch/arm/cpu/arm926ejs/mxs/mxs.c +++ b/arch/arm/cpu/arm926ejs/mxs/mxs.c @@ -100,7 +100,7 @@ int arch_cpu_init(void) struct mxs_clkctrl_regs *clkctrl_regs = (struct mxs_clkctrl_regs *)MXS_CLKCTRL_BASE; - mx28_fixup_vt((uint32_t)&_start); + mx28_fixup_vt((uint32_t)_start); /* * Enable NAND clock diff --git a/arch/arm/cpu/arm926ejs/mxs/spl_boot.c b/arch/arm/cpu/arm926ejs/mxs/spl_boot.c index 5598c55..5e7bdb7 100644 --- a/arch/arm/cpu/arm926ejs/mxs/spl_boot.c +++ b/arch/arm/cpu/arm926ejs/mxs/spl_boot.c @@ -103,7 +103,7 @@ static void mxs_spl_fixup_vectors(void) */ /* cppcheck-suppress nullPointer */ - memcpy(0x0, &_start, 0x60); + memcpy(0x0, _start, 0x60); } static void mxs_spl_console_init(void) diff --git a/arch/arm/cpu/armv7/ls102xa/Kconfig b/arch/arm/cpu/armv7/ls102xa/Kconfig index 3e292bf..46ace7e 100644 --- a/arch/arm/cpu/armv7/ls102xa/Kconfig +++ b/arch/arm/cpu/armv7/ls102xa/Kconfig @@ -98,7 +98,6 @@ config SYS_FSL_ERRATUM_A008407 config SYS_FSL_QSPI_SKIP_CLKSEL bool "Skip setting QSPI clock during SoC init" - default 0 help To improve startup times when booting from QSPI flash, the QSPI frequency can be set very early in the boot process. If this option diff --git a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig index a8b493e..d46934c 100644 --- a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig +++ b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig @@ -739,7 +739,7 @@ config HAS_FSL_XHCI_USB config SYS_FSL_BOOTROM_BASE hex depends on FSL_LSCH2 - default 0 + default 0x0 config SYS_FSL_BOOTROM_SIZE hex diff --git a/arch/arm/cpu/armv8/fsl-layerscape/spl.c b/arch/arm/cpu/armv8/fsl-layerscape/spl.c index 61fced4..033f48d 100644 --- a/arch/arm/cpu/armv8/fsl-layerscape/spl.c +++ b/arch/arm/cpu/armv8/fsl-layerscape/spl.c @@ -78,6 +78,11 @@ void tzpc_init(void) #endif } +__weak int init_func_vid(void) +{ + return 0; +} + void board_init_f(ulong dummy) { int ret; diff --git a/arch/arm/cpu/armv8/start.S b/arch/arm/cpu/armv8/start.S index f3ea858..6cc1d26 100644 --- a/arch/arm/cpu/armv8/start.S +++ b/arch/arm/cpu/armv8/start.S @@ -58,7 +58,7 @@ reset: .globl save_boot_params_ret save_boot_params_ret: -#if CONFIG_POSITION_INDEPENDENT +#if CONFIG_POSITION_INDEPENDENT && !defined(CONFIG_SPL_BUILD) /* Verify that we're 4K aligned. */ adr x0, _start ands x0, x0, #0xfff diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index 85fd5b1..bde2176 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -1201,6 +1201,9 @@ dtb-$(CONFIG_TARGET_SAMA5D27_WLSOM1_EK) += \ dtb-$(CONFIG_TARGET_SAMA5D2_ICP) += \ at91-sama5d2_icp.dtb +dtb-$(CONFIG_TARGET_SAMA5D29_CURIOSITY) += \ + at91-sama5d29_curiosity.dtb + dtb-$(CONFIG_TARGET_SAMA5D3XEK) += \ sama5d31ek.dtb \ sama5d33ek.dtb \ @@ -1334,6 +1337,8 @@ dtb-$(CONFIG_SOC_K3_AM642) += k3-am642-evm.dtb \ dtb-$(CONFIG_SOC_K3_AM625) += k3-am625-sk.dtb \ k3-am625-r5-sk.dtb \ + k3-am625-beagleplay.dtb \ + k3-am625-r5-beagleplay.dtb \ k3-am625-verdin-wifi-dev.dtb \ k3-am625-verdin-r5.dtb diff --git a/arch/arm/dts/at91-sam9x60_curiosity-u-boot.dtsi b/arch/arm/dts/at91-sam9x60_curiosity-u-boot.dtsi index 0c3c040..dd46233 100644 --- a/arch/arm/dts/at91-sam9x60_curiosity-u-boot.dtsi +++ b/arch/arm/dts/at91-sam9x60_curiosity-u-boot.dtsi @@ -14,16 +14,30 @@ apb { bootph-all; - - pinctrl { - bootph-all; - }; }; }; chosen { bootph-all; }; + + config { + u-boot,boot-led = "blue"; + }; + + leds { + led-red { + default-state = "off"; + }; + + led-green { + default-state = "off"; + }; + + led-blue { + default-state = "off"; + }; + }; }; &clk32 { @@ -42,6 +56,10 @@ bootph-all; }; +&pinctrl { + bootph-all; +}; + &pinctrl_dbgu { bootph-all; }; diff --git a/arch/arm/dts/at91-sam9x60_curiosity.dts b/arch/arm/dts/at91-sam9x60_curiosity.dts index d6ae3d6..99867d2 100644 --- a/arch/arm/dts/at91-sam9x60_curiosity.dts +++ b/arch/arm/dts/at91-sam9x60_curiosity.dts @@ -7,64 +7,23 @@ * Author: Durai Manickam KR <durai.manickamkr@microchip.com> */ /dts-v1/; +#include <dt-bindings/input/input.h> #include <dt-bindings/mfd/atmel-flexcom.h> #include "sam9x60.dtsi" / { - model = "Microchip SAM9X60 CURIOSITY"; + model = "Microchip SAM9X60 Curiosity"; compatible = "microchip,sam9x60-curiosity", "microchip,sam9x60", "atmel,at91sam9"; - ahb { - apb { - flx0: flexcom@f801c600 { - atmel,flexcom-mode = <ATMEL_FLEXCOM_MODE_TWI>; - status = "okay"; - - i2c@600 { - compatible = "atmel,sama5d2-i2c"; - reg = <0x600 0x200>; - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_flx0>; - #address-cells = <1>; - #size-cells = <0>; - clocks = <&pmc PMC_TYPE_PERIPHERAL 5>; - status = "okay"; - - eeprom@53 { - compatible = "atmel,24c32"; - reg = <0x53>; - pagesize = <16>; - }; - }; - }; - - pinctrl { - pinctrl_flx0: flx0_default { - atmel,pins = - <AT91_PIOA 0 AT91_PERIPH_A AT91_PINCTRL_NONE - AT91_PIOA 1 AT91_PERIPH_A AT91_PINCTRL_NONE>; - }; - - pinctrl_onewire_tm_default: onewire_tm_default { - atmel,pins = - <AT91_PIOD 14 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP>; - }; - - usb1 { - pinctrl_usb_default: usb_default { - atmel,pins = <AT91_PIOD 15 AT91_PERIPH_GPIO AT91_PINCTRL_NONE - AT91_PIOD 18 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>; - }; - }; - }; - }; - }; - chosen { stdout-path = &dbgu; i2c0 = &flx0; }; + memory { + reg = <0x20000000 0x8000000>; + }; + clocks { slow_xtal: slow_xtal { clock-frequency = <32768>; @@ -75,8 +34,39 @@ }; }; - memory { - reg = <0x20000000 0x8000000>; + gpio-keys { + compatible = "gpio-keys"; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_key_gpio_default>; + + button-user { + label = "PB_USER"; + gpios = <&pioA 29 GPIO_ACTIVE_LOW>; + linux,code = <KEY_PROG1>; + wakeup-source; + }; + }; + + leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_gpio_leds>; + + led-red { + label = "red"; + gpios = <&pioD 17 GPIO_ACTIVE_HIGH>; + }; + + led-green { + label = "green"; + gpios = <&pioD 19 GPIO_ACTIVE_HIGH>; + }; + + led-blue { + label = "blue"; + gpios = <&pioD 21 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "heartbeat"; + }; }; onewire_tm: onewire { @@ -92,11 +82,172 @@ }; }; +&ebi { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_ebi_addr_nand &pinctrl_ebi_data_0_7>; + status = "okay"; + + nand_controller: nand-controller { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_nand_oe_we &pinctrl_nand_cs &pinctrl_nand_rb>; + status = "okay"; + + nand@3 { + reg = <0x3 0x0 0x800000>; + rb-gpios = <&pioD 5 GPIO_ACTIVE_HIGH>; + cs-gpios = <&pioD 4 GPIO_ACTIVE_HIGH>; + nand-bus-width = <8>; + nand-ecc-mode = "hw"; + nand-ecc-strength = <8>; + nand-ecc-step-size = <512>; + nand-on-flash-bbt; + label = "atmel_nand"; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + at91bootstrap@0 { + label = "at91bootstrap"; + reg = <0x0 0x40000>; + }; + + uboot@40000 { + label = "u-boot"; + reg = <0x40000 0xc0000>; + }; + + ubootenvred@100000 { + label = "U-Boot Env Redundant"; + reg = <0x100000 0x40000>; + }; + + ubootenv@140000 { + label = "U-Boot Env"; + reg = <0x140000 0x40000>; + }; + + dtb@180000 { + label = "device tree"; + reg = <0x180000 0x80000>; + }; + + kernel@200000 { + label = "kernel"; + reg = <0x200000 0x600000>; + }; + + rootfs@800000 { + label = "rootfs"; + reg = <0x800000 0x1f800000>; + }; + }; + }; + }; +}; + +&flx0 { + atmel,flexcom-mode = <ATMEL_FLEXCOM_MODE_TWI>; + status = "okay"; + + i2c@600 { + compatible = "microchip,sam9x60-i2c"; + reg = <0x600 0x200>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_flx0>; + #address-cells = <1>; + #size-cells = <0>; + clocks = <&pmc PMC_TYPE_PERIPHERAL 5>; + status = "okay"; + + eeprom@53 { + compatible = "atmel,24c02"; + reg = <0x53>; + pagesize = <16>; + }; + }; +}; + &macb0 { phy-mode = "rmii"; status = "okay"; }; +&pinctrl { + ebi { + pinctrl_ebi_data_0_7: ebi-data-lsb-0 { + atmel,pins = + <AT91_PIOD 6 AT91_PERIPH_A (AT91_PINCTRL_NONE | AT91_PINCTRL_SLEWRATE_DIS) + AT91_PIOD 7 AT91_PERIPH_A (AT91_PINCTRL_NONE | AT91_PINCTRL_SLEWRATE_DIS) + AT91_PIOD 8 AT91_PERIPH_A (AT91_PINCTRL_NONE | AT91_PINCTRL_SLEWRATE_DIS) + AT91_PIOD 9 AT91_PERIPH_A (AT91_PINCTRL_NONE | AT91_PINCTRL_SLEWRATE_DIS) + AT91_PIOD 10 AT91_PERIPH_A (AT91_PINCTRL_NONE | AT91_PINCTRL_SLEWRATE_DIS) + AT91_PIOD 11 AT91_PERIPH_A (AT91_PINCTRL_NONE | AT91_PINCTRL_SLEWRATE_DIS) + AT91_PIOD 12 AT91_PERIPH_A (AT91_PINCTRL_NONE | AT91_PINCTRL_SLEWRATE_DIS) + AT91_PIOD 13 AT91_PERIPH_A (AT91_PINCTRL_NONE | AT91_PINCTRL_SLEWRATE_DIS)>; + }; + + pinctrl_ebi_addr_nand: ebi-addr-0 { + atmel,pins = + <AT91_PIOD 2 AT91_PERIPH_A (AT91_PINCTRL_NONE | AT91_PINCTRL_SLEWRATE_DIS) + AT91_PIOD 3 AT91_PERIPH_A (AT91_PINCTRL_NONE | AT91_PINCTRL_SLEWRATE_DIS)>; + }; + }; + + flexcom { + pinctrl_flx0: flx0_default { + atmel,pins = + <AT91_PIOA 0 AT91_PERIPH_A AT91_PINCTRL_NONE + AT91_PIOA 1 AT91_PERIPH_A AT91_PINCTRL_NONE>; + }; + }; + + gpio-keys { + pinctrl_key_gpio_default: pinctrl-key-gpio { + atmel,pins = <AT91_PIOA 29 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>; + }; + }; + + leds { + pinctrl_gpio_leds: gpio-leds { + atmel,pins = <AT91_PIOD 17 AT91_PERIPH_GPIO AT91_PINCTRL_NONE + AT91_PIOD 19 AT91_PERIPH_GPIO AT91_PINCTRL_NONE + AT91_PIOD 21 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>; + }; + }; + + nand { + pinctrl_nand_oe_we: nand-oe-we-0 { + atmel,pins = + <AT91_PIOD 0 AT91_PERIPH_A (AT91_PINCTRL_NONE | AT91_PINCTRL_SLEWRATE_DIS) + AT91_PIOD 1 AT91_PERIPH_A (AT91_PINCTRL_NONE | AT91_PINCTRL_SLEWRATE_DIS)>; + }; + + pinctrl_nand_rb: nand-rb-0 { + atmel,pins = + <AT91_PIOD 5 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP>; + }; + + pinctrl_nand_cs: nand-cs-0 { + atmel,pins = + <AT91_PIOD 4 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP>; + }; + }; + + pinctrl_onewire_tm_default: onewire_tm_default { + atmel,pins = + <AT91_PIOD 14 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP>; + }; + + usb1 { + pinctrl_usb_default: usb_default { + atmel,pins = <AT91_PIOD 15 AT91_PERIPH_GPIO AT91_PINCTRL_NONE + AT91_PIOD 18 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>; + }; + }; +}; + &usb1 { num-ports = <3>; atmel,vbus-gpio = <0 diff --git a/arch/arm/dts/at91-sama5d29_curiosity-u-boot.dtsi b/arch/arm/dts/at91-sama5d29_curiosity-u-boot.dtsi new file mode 100644 index 0000000..798761c --- /dev/null +++ b/arch/arm/dts/at91-sama5d29_curiosity-u-boot.dtsi @@ -0,0 +1,55 @@ +// SPDX-License-Identifier: GPL-2.0+ OR MIT +/* + * at91-sama5d29_curiosity-u-boot.dtsi - Device Tree file for SAMA5D2 SoC u-boot properties. + * + * Copyright (c) 2023, Microchip Technology Inc. and its subsidiaries + * + * Author: Mihai Sain <mihai.sain@microchip.com> + * + */ + +/ { + chosen { + bootph-all; + }; +}; + +&pinctrl_qspi1_default { + bootph-all; +}; + +&pinctrl_sdmmc0_default { + bootph-all; +}; + +&pinctrl_sdmmc1_default { + bootph-all; +}; + +&hlcdc { + bootph-all; +}; + +&pioA { + bootph-all; +}; + +&qspi1 { + bootph-all; + + flash@0 { + bootph-all; + }; +}; + +&sdmmc0 { + bootph-all; +}; + +&sdmmc1 { + bootph-all; +}; + +&uart0 { + bootph-all; +}; diff --git a/arch/arm/dts/at91-sama5d29_curiosity.dts b/arch/arm/dts/at91-sama5d29_curiosity.dts new file mode 100644 index 0000000..eff0e91 --- /dev/null +++ b/arch/arm/dts/at91-sama5d29_curiosity.dts @@ -0,0 +1,219 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * at91-sama5d29_curiosity.dts - Device Tree file for SAMA5D29 CURIOSITY board + * + * Copyright (C) 2023 Microchip Technology Inc. and its subsidiaries + * + * Author: Mihai Sain <mihai.sain@microchip.com> + * + */ +/dts-v1/; +#include <dt-bindings/gpio/gpio.h> +#include <dt-bindings/pinctrl/at91.h> +#include "sama5d2.dtsi" +#include "sama5d2-pinfunc.h" + +/ { + model = "Microchip SAMA5D29-Curiosity"; + compatible = "atmel,sama5d29-curiosity", "atmel,sama5d2", "atmel,sama5"; + + chosen { + bootargs = "console=ttyS0,115200 root=/dev/mmcblk0p2 rw rootwait"; + stdout-path = &uart0; + }; + + memory { + reg = <0x20000000 0x20000000>; // 512 MiB LPDDR2-333 + }; + + clocks { + slow_xtal: slow_xtal { + clock-frequency = <32768>; + }; + + main_xtal: main_xtal { + clock-frequency = <24000000>; + }; + }; + + onewire_tm: onewire { + gpios = <&pioA PIN_PC9 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_onewire_tm_default>; + status = "okay"; + + w1_eeprom: w1_eeprom@0 { + compatible = "maxim,ds24b33"; + status = "okay"; + }; + }; + + ahb { + usb1: ohci@400000 { + num-ports = <3>; + atmel,vbus-gpio = <&pioA PIN_PB13 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_usb_default>; + status = "okay"; + }; + + usb2: ehci@500000 { + status = "okay"; + }; + + sdmmc0: sdio-host@a0000000 { + bus-width = <4>; + disable-wp; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_sdmmc0_default>; + status = "okay"; + }; + + sdmmc1: sdio-host@b0000000 { + bus-width = <4>; + disable-wp; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_sdmmc1_default>; + status = "okay"; + }; + + apb { + hlcdc: hlcdc@f0000000 { + atmel,vl-bpix = <4>; + atmel,output-mode = <24>; + atmel,guard-time = <1>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_lcd_base &pinctrl_lcd_pwm &pinctrl_lcd_rgb666>; + status = "okay"; + + display-timings { // PDA TM5000 + 800x480 { + clock-frequency = <33000000>; + xres = <800>; + yres = <480>; + hactive = <800>; + vactive = <480>; + hsync-len = <64>; + hfront-porch = <1>; + hback-porch = <64>; + vfront-porch = <1>; + vback-porch = <22>; + vsync-len = <23>; + }; + }; + }; + + qspi1: spi@f0024000 { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_qspi1_default>; + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <80000000>; + spi-rx-bus-width = <4>; + spi-tx-bus-width = <4>; + m25p,fast-read; + }; + }; + + uart0: serial@f801c000 { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_uart0_default>; + status = "okay"; + }; + + pioA: pinctrl@fc038000 { + pinctrl_lcd_base: lcd_base { + pinmux = <PIN_PC30__LCDVSYNC>, + <PIN_PC31__LCDHSYNC>, + <PIN_PD1__LCDDEN>, + <PIN_PD0__LCDPCK>; + bias-disable; + }; + + pinctrl_lcd_pwm: lcd_pwm { + pinmux = <PIN_PC28__LCDPWM>; + bias-disable; + }; + + pinctrl_lcd_rgb666: lcd_rgb666 { + pinmux = <PIN_PC10__LCDDAT2>, + <PIN_PC11__LCDDAT3>, + <PIN_PC12__LCDDAT4>, + <PIN_PC13__LCDDAT5>, + <PIN_PC14__LCDDAT6>, + <PIN_PC15__LCDDAT7>, + <PIN_PC16__LCDDAT10>, + <PIN_PC17__LCDDAT11>, + <PIN_PC18__LCDDAT12>, + <PIN_PC19__LCDDAT13>, + <PIN_PC20__LCDDAT14>, + <PIN_PC21__LCDDAT15>, + <PIN_PC22__LCDDAT18>, + <PIN_PC23__LCDDAT19>, + <PIN_PC24__LCDDAT20>, + <PIN_PC25__LCDDAT21>, + <PIN_PC26__LCDDAT22>, + <PIN_PC27__LCDDAT23>; + bias-disable; + }; + + pinctrl_qspi1_default: qspi1_default { + pinmux = <PIN_PB5__QSPI1_SCK>, + <PIN_PB6__QSPI1_CS>, + <PIN_PB7__QSPI1_IO0>, + <PIN_PB8__QSPI1_IO1>, + <PIN_PB9__QSPI1_IO2>, + <PIN_PB10__QSPI1_IO3>; + bias-pull-up; + }; + + pinctrl_sdmmc0_default: sdmmc0_default { + pinmux = <PIN_PA0__SDMMC0_CK>, + <PIN_PA1__SDMMC0_CMD>, + <PIN_PA2__SDMMC0_DAT0>, + <PIN_PA3__SDMMC0_DAT1>, + <PIN_PA4__SDMMC0_DAT2>, + <PIN_PA5__SDMMC0_DAT3>, + <PIN_PA11__SDMMC0_VDDSEL>, + <PIN_PA13__SDMMC0_CD>; + bias-disable; + }; + + pinctrl_sdmmc1_default: sdmmc1_default { + pinmux = <PIN_PA18__SDMMC1_DAT0>, + <PIN_PA19__SDMMC1_DAT1>, + <PIN_PA20__SDMMC1_DAT2>, + <PIN_PA21__SDMMC1_DAT3>, + <PIN_PA22__SDMMC1_CK>, + <PIN_PA28__SDMMC1_CMD>, + <PIN_PA30__SDMMC1_CD>; + bias-disable; + }; + + pinctrl_uart0_default: uart0_default { + pinmux = <PIN_PB26__URXD0>, + <PIN_PB27__UTXD0>; + bias-disable; + }; + + pinctrl_usb_default: usb_default { + pinmux = <PIN_PA6__GPIO>; + bias-disable; + }; + + pinctrl_usba_vbus: usba_vbus { + pinmux = <PIN_PB13__GPIO>; + bias-disable; + }; + + pinctrl_onewire_tm_default: onewire_tm_default { + pinmux = <PIN_PC9__GPIO>; + bias-pull-up; + }; + }; + }; + }; +}; diff --git a/arch/arm/dts/fsl-ls1028a-kontron-sl28-u-boot.dtsi b/arch/arm/dts/fsl-ls1028a-kontron-sl28-u-boot.dtsi index 83750ab..aacf181 100644 --- a/arch/arm/dts/fsl-ls1028a-kontron-sl28-u-boot.dtsi +++ b/arch/arm/dts/fsl-ls1028a-kontron-sl28-u-boot.dtsi @@ -64,7 +64,7 @@ &binman { u-boot-update { - filename = "u-boot.update"; + filename = "u-boot-update.bin"; fit { description = "FIT update image"; diff --git a/arch/arm/dts/k3-am62-main.dtsi b/arch/arm/dts/k3-am62-main.dtsi index 2488e3a..284b90c 100644 --- a/arch/arm/dts/k3-am62-main.dtsi +++ b/arch/arm/dts/k3-am62-main.dtsi @@ -55,11 +55,29 @@ #phy-cells = <1>; }; - epwm_tbclk: clock@4130 { - compatible = "ti,am62-epwm-tbclk", "syscon"; + epwm_tbclk: clock-controller@4130 { + compatible = "ti,am62-epwm-tbclk"; reg = <0x4130 0x4>; #clock-cells = <1>; }; + + audio_refclk0: clock-controller@82e0 { + compatible = "ti,am62-audio-refclk"; + reg = <0x82e0 0x4>; + clocks = <&k3_clks 157 0>; + assigned-clocks = <&k3_clks 157 0>; + assigned-clock-parents = <&k3_clks 157 8>; + #clock-cells = <0>; + }; + + audio_refclk1: clock-controller@82e4 { + compatible = "ti,am62-audio-refclk"; + reg = <0x82e4 0x4>; + clocks = <&k3_clks 157 10>; + assigned-clocks = <&k3_clks 157 10>; + assigned-clock-parents = <&k3_clks 157 18>; + #clock-cells = <0>; + }; }; dmss: bus@48000000 { @@ -174,7 +192,6 @@ crypto: crypto@40900000 { compatible = "ti,am62-sa3ul"; reg = <0x00 0x40900000 0x00 0x1200>; - power-domains = <&k3_pds 70 TI_SCI_PD_SHARED>; #address-cells = <2>; #size-cells = <2>; ranges = <0x00 0x40900000 0x00 0x40900000 0x00 0x30000>; @@ -590,7 +607,7 @@ usb0: usb@31000000 { compatible = "snps,dwc3"; - reg =<0x00 0x31000000 0x00 0x50000>; + reg = <0x00 0x31000000 0x00 0x50000>; interrupts = <GIC_SPI 188 IRQ_TYPE_LEVEL_HIGH>, /* irq.0 */ <GIC_SPI 188 IRQ_TYPE_LEVEL_HIGH>; /* irq.0 */ interrupt-names = "host", "peripheral"; @@ -613,7 +630,7 @@ usb1: usb@31100000 { compatible = "snps,dwc3"; - reg =<0x00 0x31100000 0x00 0x50000>; + reg = <0x00 0x31100000 0x00 0x50000>; interrupts = <GIC_SPI 226 IRQ_TYPE_LEVEL_HIGH>, /* irq.0 */ <GIC_SPI 226 IRQ_TYPE_LEVEL_HIGH>; /* irq.0 */ interrupt-names = "host", "peripheral"; @@ -718,6 +735,31 @@ }; }; + dss: dss@30200000 { + compatible = "ti,am625-dss"; + reg = <0x00 0x30200000 0x00 0x1000>, /* common */ + <0x00 0x30202000 0x00 0x1000>, /* vidl1 */ + <0x00 0x30206000 0x00 0x1000>, /* vid */ + <0x00 0x30207000 0x00 0x1000>, /* ovr1 */ + <0x00 0x30208000 0x00 0x1000>, /* ovr2 */ + <0x00 0x3020a000 0x00 0x1000>, /* vp1: Used for OLDI */ + <0x00 0x3020b000 0x00 0x1000>; /* vp2: Used as DPI Out */ + reg-names = "common", "vidl1", "vid", + "ovr1", "ovr2", "vp1", "vp2"; + power-domains = <&k3_pds 186 TI_SCI_PD_EXCLUSIVE>; + clocks = <&k3_clks 186 6>, + <&dss_vp1_clk>, + <&k3_clks 186 2>; + clock-names = "fck", "vp1", "vp2"; + interrupts = <GIC_SPI 84 IRQ_TYPE_LEVEL_HIGH>; + status = "disabled"; + + dss_ports: ports { + #address-cells = <1>; + #size-cells = <0>; + }; + }; + hwspinlock: spinlock@2a000000 { compatible = "ti,am64-hwspinlock"; reg = <0x00 0x2a000000 0x00 0x1000>; diff --git a/arch/arm/dts/k3-am62-mcu.dtsi b/arch/arm/dts/k3-am62-mcu.dtsi index 19fc381..80a3e1d 100644 --- a/arch/arm/dts/k3-am62-mcu.dtsi +++ b/arch/arm/dts/k3-am62-mcu.dtsi @@ -147,4 +147,28 @@ /* Tightly coupled to M4F */ status = "reserved"; }; + + mcu_mcan0: can@4e08000 { + compatible = "bosch,m_can"; + reg = <0x00 0x4e08000 0x00 0x200>, + <0x00 0x4e00000 0x00 0x8000>; + reg-names = "m_can", "message_ram"; + power-domains = <&k3_pds 188 TI_SCI_PD_EXCLUSIVE>; + clocks = <&k3_clks 188 6>, <&k3_clks 188 1>; + clock-names = "hclk", "cclk"; + bosch,mram-cfg = <0x0 128 64 64 64 64 32 32>; + status = "disabled"; + }; + + mcu_mcan1: can@4e18000 { + compatible = "bosch,m_can"; + reg = <0x00 0x4e18000 0x00 0x200>, + <0x00 0x4e10000 0x00 0x8000>; + reg-names = "m_can", "message_ram"; + power-domains = <&k3_pds 189 TI_SCI_PD_EXCLUSIVE>; + clocks = <&k3_clks 189 6>, <&k3_clks 189 1>; + clock-names = "hclk", "cclk"; + bosch,mram-cfg = <0x0 128 64 64 64 64 32 32>; + status = "disabled"; + }; }; diff --git a/arch/arm/dts/k3-am62-verdin-dev.dtsi b/arch/arm/dts/k3-am62-verdin-dev.dtsi index 846caee..6701cb8 100644 --- a/arch/arm/dts/k3-am62-verdin-dev.dtsi +++ b/arch/arm/dts/k3-am62-verdin-dev.dtsi @@ -8,6 +8,42 @@ * https://www.toradex.com/products/carrier-board/verdin-development-board-kit */ +/ { + sound { + compatible = "simple-audio-card"; + simple-audio-card,bitclock-master = <&codec_dai>; + simple-audio-card,format = "i2s"; + simple-audio-card,frame-master = <&codec_dai>; + simple-audio-card,name = "verdin-nau8822"; + simple-audio-card,routing = + "Headphones", "LHP", + "Headphones", "RHP", + "Speaker", "LSPK", + "Speaker", "RSPK", + "Line Out", "AUXOUT1", + "Line Out", "AUXOUT2", + "LAUX", "Line In", + "RAUX", "Line In", + "LMICP", "Mic In", + "RMICP", "Mic In"; + simple-audio-card,widgets = + "Headphones", "Headphones", + "Line Out", "Line Out", + "Speaker", "Speaker", + "Microphone", "Mic In", + "Line", "Line In"; + + codec_dai: simple-audio-card,codec { + clocks = <&audio_refclk1>; + sound-dai = <&nau8822_1a>; + }; + + simple-audio-card,cpu { + sound-dai = <&mcasp0>; + }; + }; +}; + /* Verdin ETHs */ &cpsw3g { pinctrl-names = "default"; @@ -65,6 +101,15 @@ &main_i2c1 { status = "okay"; + /* Audio Codec */ + nau8822_1a: audio-codec@1a { + compatible = "nuvoton,nau8822"; + reg = <0x1a>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_i2s1_mclk>; + #sound-dai-cells = <0>; + }; + /* IO Expander */ gpio_expander_21: gpio@21 { compatible = "nxp,pcal6416"; @@ -144,6 +189,11 @@ status = "okay"; }; +/* Verdin CAN_2 */ +&mcu_mcan0 { + status = "okay"; +}; + /* Verdin UART_4 */ &mcu_uart0 { status = "okay"; diff --git a/arch/arm/dts/k3-am62-verdin.dtsi b/arch/arm/dts/k3-am62-verdin.dtsi index 57dd061..40992e7 100644 --- a/arch/arm/dts/k3-am62-verdin.dtsi +++ b/arch/arm/dts/k3-am62-verdin.dtsi @@ -19,6 +19,8 @@ }; aliases { + can0 = &main_mcan0; + can1 = &mcu_mcan0; ethernet0 = &cpsw_port1; ethernet1 = &cpsw_port2; i2c0 = &main_i2c0; @@ -732,6 +734,14 @@ >; }; + /* Verdin CAN_2 */ + pinctrl_mcu_mcan0: mcu-mcan0-default-pins { + pinctrl-single,pins = < + AM62X_MCU_IOPAD(0x0038, PIN_INPUT, 0) /* (B3) MCU_MCAN0_RX */ /* SODIMM 26 */ + AM62X_MCU_IOPAD(0x0034, PIN_OUTPUT, 0) /* (D6) MCU_MCAN0_TX */ /* SODIMM 24 */ + >; + }; + /* Verdin UART_4 - Reserved to Cortex-M4 */ pinctrl_mcu_uart0: mcu-uart0-default-pins { pinctrl-single,pins = < @@ -758,6 +768,11 @@ }; }; +/* VERDIN I2S_1_MCLK */ +&audio_refclk1 { + assigned-clock-rates = <25000000>; +}; + &cpsw3g { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_rgmii1>; @@ -800,6 +815,26 @@ }; }; +&dss { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_parallel_rgb>; + status = "disabled"; +}; + +&dss_ports { + #address-cells = <1>; + #size-cells = <0>; + + /* VP2: DPI Output */ + port@1 { + reg = <1>; + + dpi_out: endpoint { + remote-endpoint = <&rgb_in>; + }; + }; +}; + /* Verdin PWM_1, PWM_2 */ &epwm0 { pinctrl-names = "default"; @@ -1036,6 +1071,7 @@ rgb_in: endpoint { data-lines = <18>; + remote-endpoint = <&dpi_out>; }; }; @@ -1238,8 +1274,6 @@ status = "disabled"; }; -/* Verdin CAN_2 - Reserved to Cortex-M4 */ - /* Verdin SPI_1 */ &main_spi1 { pinctrl-names = "default"; @@ -1333,6 +1367,13 @@ ""; }; +/* Verdin CAN_2 */ +&mcu_mcan0 { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_mcu_mcan0>; + status = "disabled"; +}; + /* Verdin UART_4 - Cortex-M4 UART */ &mcu_uart0 { pinctrl-names = "default"; diff --git a/arch/arm/dts/k3-am62.dtsi b/arch/arm/dts/k3-am62.dtsi index 5e72c44..11f14ee 100644 --- a/arch/arm/dts/k3-am62.dtsi +++ b/arch/arm/dts/k3-am62.dtsi @@ -102,6 +102,14 @@ }; }; + dss_vp1_clk: clock-divider-oldi { + compatible = "fixed-factor-clock"; + clocks = <&k3_clks 186 0>; + #clock-cells = <0>; + clock-div = <7>; + clock-mult = <1>; + }; + #include "k3-am62-thermal.dtsi" }; diff --git a/arch/arm/dts/k3-am625-beagleplay-ddr4-1600MTs.dtsi b/arch/arm/dts/k3-am625-beagleplay-ddr4-1600MTs.dtsi new file mode 100644 index 0000000..3d7a41c --- /dev/null +++ b/arch/arm/dts/k3-am625-beagleplay-ddr4-1600MTs.dtsi @@ -0,0 +1,2195 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * https://beagleboard.org/play + * + * Copyright (C) 2022-2023 Texas Instruments Incorporated - https://www.ti.com/ + * Copyright (C) 2022-2023 Robert Nelson, BeagleBoard.org Foundation + * + * This file was generated with the + * AM62x SysConfig DDR Subsystem Register Configuration Tool v0.09.06 + * Thu Feb 09 2023 11:57:18 GMT-0600 (Central Standard Time) + * DDR Part number: K4AAG165WA-BCWE K4A4G165WF-BCTD + * DDR Type: DDR4 + * Frequency = 800MHz (1600MTs) + * Density: 16Gb + * Number of Ranks: 1 + */ + +#define DDRSS_PLL_FHS_CNT 6 +#define DDRSS_PLL_FREQUENCY_1 400000000 +#define DDRSS_PLL_FREQUENCY_2 400000000 + +#define DDRSS_CTL_0_DATA 0x00000A00 +#define DDRSS_CTL_1_DATA 0x00000000 +#define DDRSS_CTL_2_DATA 0x00000000 +#define DDRSS_CTL_3_DATA 0x00000000 +#define DDRSS_CTL_4_DATA 0x00000000 +#define DDRSS_CTL_5_DATA 0x00000000 +#define DDRSS_CTL_6_DATA 0x00000000 +#define DDRSS_CTL_7_DATA 0x000890B8 +#define DDRSS_CTL_8_DATA 0x00000000 +#define DDRSS_CTL_9_DATA 0x00000000 +#define DDRSS_CTL_10_DATA 0x00000000 +#define DDRSS_CTL_11_DATA 0x000890B8 +#define DDRSS_CTL_12_DATA 0x00000000 +#define DDRSS_CTL_13_DATA 0x00000000 +#define DDRSS_CTL_14_DATA 0x00000000 +#define DDRSS_CTL_15_DATA 0x000890B8 +#define DDRSS_CTL_16_DATA 0x00000000 +#define DDRSS_CTL_17_DATA 0x00000000 +#define DDRSS_CTL_18_DATA 0x00000000 +#define DDRSS_CTL_19_DATA 0x01010100 +#define DDRSS_CTL_20_DATA 0x01000100 +#define DDRSS_CTL_21_DATA 0x01000110 +#define DDRSS_CTL_22_DATA 0x02010002 +#define DDRSS_CTL_23_DATA 0x00027100 +#define DDRSS_CTL_24_DATA 0x00061A80 +#define DDRSS_CTL_25_DATA 0x04000400 +#define DDRSS_CTL_26_DATA 0x00000400 +#define DDRSS_CTL_27_DATA 0x00000000 +#define DDRSS_CTL_28_DATA 0x00000000 +#define DDRSS_CTL_29_DATA 0x00000000 +#define DDRSS_CTL_30_DATA 0x00000000 +#define DDRSS_CTL_31_DATA 0x00000000 +#define DDRSS_CTL_32_DATA 0x00000000 +#define DDRSS_CTL_33_DATA 0x00000000 +#define DDRSS_CTL_34_DATA 0x00000000 +#define DDRSS_CTL_35_DATA 0x00000000 +#define DDRSS_CTL_36_DATA 0x00000000 +#define DDRSS_CTL_37_DATA 0x00000000 +#define DDRSS_CTL_38_DATA 0x0400091C +#define DDRSS_CTL_39_DATA 0x1C1C1C1C +#define DDRSS_CTL_40_DATA 0x0400091C +#define DDRSS_CTL_41_DATA 0x1C1C1C1C +#define DDRSS_CTL_42_DATA 0x0400091C +#define DDRSS_CTL_43_DATA 0x1C1C1C1C +#define DDRSS_CTL_44_DATA 0x05050404 +#define DDRSS_CTL_45_DATA 0x00002706 +#define DDRSS_CTL_46_DATA 0x0602001D +#define DDRSS_CTL_47_DATA 0x05001D0B +#define DDRSS_CTL_48_DATA 0x00270605 +#define DDRSS_CTL_49_DATA 0x0602001D +#define DDRSS_CTL_50_DATA 0x05001D0B +#define DDRSS_CTL_51_DATA 0x00270605 +#define DDRSS_CTL_52_DATA 0x0602001D +#define DDRSS_CTL_53_DATA 0x07001D0B +#define DDRSS_CTL_54_DATA 0x00180807 +#define DDRSS_CTL_55_DATA 0x0400DB60 +#define DDRSS_CTL_56_DATA 0x07070009 +#define DDRSS_CTL_57_DATA 0x00001808 +#define DDRSS_CTL_58_DATA 0x0400DB60 +#define DDRSS_CTL_59_DATA 0x07070009 +#define DDRSS_CTL_60_DATA 0x00001808 +#define DDRSS_CTL_61_DATA 0x0400DB60 +#define DDRSS_CTL_62_DATA 0x03000009 +#define DDRSS_CTL_63_DATA 0x0D0C0002 +#define DDRSS_CTL_64_DATA 0x0D0C0D0C +#define DDRSS_CTL_65_DATA 0x01010000 +#define DDRSS_CTL_66_DATA 0x03191919 +#define DDRSS_CTL_67_DATA 0x0B0B0B0B +#define DDRSS_CTL_68_DATA 0x00000B0B +#define DDRSS_CTL_69_DATA 0x00000101 +#define DDRSS_CTL_70_DATA 0x00000000 +#define DDRSS_CTL_71_DATA 0x01000000 +#define DDRSS_CTL_72_DATA 0x01180803 +#define DDRSS_CTL_73_DATA 0x00001860 +#define DDRSS_CTL_74_DATA 0x00000118 +#define DDRSS_CTL_75_DATA 0x00001860 +#define DDRSS_CTL_76_DATA 0x00000118 +#define DDRSS_CTL_77_DATA 0x00001860 +#define DDRSS_CTL_78_DATA 0x00000005 +#define DDRSS_CTL_79_DATA 0x00000000 +#define DDRSS_CTL_80_DATA 0x00000000 +#define DDRSS_CTL_81_DATA 0x00000000 +#define DDRSS_CTL_82_DATA 0x00000000 +#define DDRSS_CTL_83_DATA 0x00000000 +#define DDRSS_CTL_84_DATA 0x00000000 +#define DDRSS_CTL_85_DATA 0x00000000 +#define DDRSS_CTL_86_DATA 0x00000000 +#define DDRSS_CTL_87_DATA 0x00090009 +#define DDRSS_CTL_88_DATA 0x00000009 +#define DDRSS_CTL_89_DATA 0x00000000 +#define DDRSS_CTL_90_DATA 0x00000000 +#define DDRSS_CTL_91_DATA 0x00000000 +#define DDRSS_CTL_92_DATA 0x00000000 +#define DDRSS_CTL_93_DATA 0x00000000 +#define DDRSS_CTL_94_DATA 0x00010001 +#define DDRSS_CTL_95_DATA 0x00040001 +#define DDRSS_CTL_96_DATA 0x04000120 +#define DDRSS_CTL_97_DATA 0x04000120 +#define DDRSS_CTL_98_DATA 0x01200120 +#define DDRSS_CTL_99_DATA 0x01200120 +#define DDRSS_CTL_100_DATA 0x00000000 +#define DDRSS_CTL_101_DATA 0x00000000 +#define DDRSS_CTL_102_DATA 0x00000000 +#define DDRSS_CTL_103_DATA 0x00000000 +#define DDRSS_CTL_104_DATA 0x00000000 +#define DDRSS_CTL_105_DATA 0x00000000 +#define DDRSS_CTL_106_DATA 0x03010000 +#define DDRSS_CTL_107_DATA 0x00010000 +#define DDRSS_CTL_108_DATA 0x00000000 +#define DDRSS_CTL_109_DATA 0x01000000 +#define DDRSS_CTL_110_DATA 0x80104002 +#define DDRSS_CTL_111_DATA 0x00040003 +#define DDRSS_CTL_112_DATA 0x00040005 +#define DDRSS_CTL_113_DATA 0x00030000 +#define DDRSS_CTL_114_DATA 0x00050004 +#define DDRSS_CTL_115_DATA 0x00000004 +#define DDRSS_CTL_116_DATA 0x00040003 +#define DDRSS_CTL_117_DATA 0x00040005 +#define DDRSS_CTL_118_DATA 0x00000000 +#define DDRSS_CTL_119_DATA 0x00061800 +#define DDRSS_CTL_120_DATA 0x00061800 +#define DDRSS_CTL_121_DATA 0x00061800 +#define DDRSS_CTL_122_DATA 0x00061800 +#define DDRSS_CTL_123_DATA 0x00061800 +#define DDRSS_CTL_124_DATA 0x00000000 +#define DDRSS_CTL_125_DATA 0x0000AAA0 +#define DDRSS_CTL_126_DATA 0x00061800 +#define DDRSS_CTL_127_DATA 0x00061800 +#define DDRSS_CTL_128_DATA 0x00061800 +#define DDRSS_CTL_129_DATA 0x00061800 +#define DDRSS_CTL_130_DATA 0x00061800 +#define DDRSS_CTL_131_DATA 0x00000000 +#define DDRSS_CTL_132_DATA 0x0000AAA0 +#define DDRSS_CTL_133_DATA 0x00061800 +#define DDRSS_CTL_134_DATA 0x00061800 +#define DDRSS_CTL_135_DATA 0x00061800 +#define DDRSS_CTL_136_DATA 0x00061800 +#define DDRSS_CTL_137_DATA 0x00061800 +#define DDRSS_CTL_138_DATA 0x00000000 +#define DDRSS_CTL_139_DATA 0x0000AAA0 +#define DDRSS_CTL_140_DATA 0x00000000 +#define DDRSS_CTL_141_DATA 0x00000000 +#define DDRSS_CTL_142_DATA 0x00000000 +#define DDRSS_CTL_143_DATA 0x00000000 +#define DDRSS_CTL_144_DATA 0x00000000 +#define DDRSS_CTL_145_DATA 0x00000000 +#define DDRSS_CTL_146_DATA 0x00000000 +#define DDRSS_CTL_147_DATA 0x00000000 +#define DDRSS_CTL_148_DATA 0x00000000 +#define DDRSS_CTL_149_DATA 0x00000000 +#define DDRSS_CTL_150_DATA 0x00000000 +#define DDRSS_CTL_151_DATA 0x00000000 +#define DDRSS_CTL_152_DATA 0x00000000 +#define DDRSS_CTL_153_DATA 0x00000000 +#define DDRSS_CTL_154_DATA 0x00000000 +#define DDRSS_CTL_155_DATA 0x00000000 +#define DDRSS_CTL_156_DATA 0x080C0000 +#define DDRSS_CTL_157_DATA 0x080C080C +#define DDRSS_CTL_158_DATA 0x08000000 +#define DDRSS_CTL_159_DATA 0x00000808 +#define DDRSS_CTL_160_DATA 0x000E0000 +#define DDRSS_CTL_161_DATA 0x00080808 +#define DDRSS_CTL_162_DATA 0x0E000000 +#define DDRSS_CTL_163_DATA 0x08080800 +#define DDRSS_CTL_164_DATA 0x00000000 +#define DDRSS_CTL_165_DATA 0x0000080E +#define DDRSS_CTL_166_DATA 0x00040003 +#define DDRSS_CTL_167_DATA 0x00000007 +#define DDRSS_CTL_168_DATA 0x00000000 +#define DDRSS_CTL_169_DATA 0x00000000 +#define DDRSS_CTL_170_DATA 0x00000000 +#define DDRSS_CTL_171_DATA 0x00000000 +#define DDRSS_CTL_172_DATA 0x00000000 +#define DDRSS_CTL_173_DATA 0x00000000 +#define DDRSS_CTL_174_DATA 0x01000000 +#define DDRSS_CTL_175_DATA 0x00000000 +#define DDRSS_CTL_176_DATA 0x00001500 +#define DDRSS_CTL_177_DATA 0x0000100E +#define DDRSS_CTL_178_DATA 0x00000000 +#define DDRSS_CTL_179_DATA 0x00000000 +#define DDRSS_CTL_180_DATA 0x00000001 +#define DDRSS_CTL_181_DATA 0x00000002 +#define DDRSS_CTL_182_DATA 0x00000C00 +#define DDRSS_CTL_183_DATA 0x00001000 +#define DDRSS_CTL_184_DATA 0x00000C00 +#define DDRSS_CTL_185_DATA 0x00001000 +#define DDRSS_CTL_186_DATA 0x00000C00 +#define DDRSS_CTL_187_DATA 0x00001000 +#define DDRSS_CTL_188_DATA 0x00000000 +#define DDRSS_CTL_189_DATA 0x00000000 +#define DDRSS_CTL_190_DATA 0x00000000 +#define DDRSS_CTL_191_DATA 0x00000000 +#define DDRSS_CTL_192_DATA 0x00000000 +#define DDRSS_CTL_193_DATA 0x00000000 +#define DDRSS_CTL_194_DATA 0x00000000 +#define DDRSS_CTL_195_DATA 0x00000000 +#define DDRSS_CTL_196_DATA 0x00000000 +#define DDRSS_CTL_197_DATA 0x00000000 +#define DDRSS_CTL_198_DATA 0x00000000 +#define DDRSS_CTL_199_DATA 0x00000000 +#define DDRSS_CTL_200_DATA 0x00000000 +#define DDRSS_CTL_201_DATA 0x00000000 +#define DDRSS_CTL_202_DATA 0x00000000 +#define DDRSS_CTL_203_DATA 0x00000000 +#define DDRSS_CTL_204_DATA 0x00042400 +#define DDRSS_CTL_205_DATA 0x00000301 +#define DDRSS_CTL_206_DATA 0x00000000 +#define DDRSS_CTL_207_DATA 0x00000424 +#define DDRSS_CTL_208_DATA 0x00000301 +#define DDRSS_CTL_209_DATA 0x00000000 +#define DDRSS_CTL_210_DATA 0x00000424 +#define DDRSS_CTL_211_DATA 0x00000301 +#define DDRSS_CTL_212_DATA 0x00000000 +#define DDRSS_CTL_213_DATA 0x00000424 +#define DDRSS_CTL_214_DATA 0x00000301 +#define DDRSS_CTL_215_DATA 0x00000000 +#define DDRSS_CTL_216_DATA 0x00000424 +#define DDRSS_CTL_217_DATA 0x00000301 +#define DDRSS_CTL_218_DATA 0x00000000 +#define DDRSS_CTL_219_DATA 0x00000424 +#define DDRSS_CTL_220_DATA 0x00000301 +#define DDRSS_CTL_221_DATA 0x00000000 +#define DDRSS_CTL_222_DATA 0x00000000 +#define DDRSS_CTL_223_DATA 0x00000000 +#define DDRSS_CTL_224_DATA 0x00000000 +#define DDRSS_CTL_225_DATA 0x00000000 +#define DDRSS_CTL_226_DATA 0x00000000 +#define DDRSS_CTL_227_DATA 0x00000000 +#define DDRSS_CTL_228_DATA 0x00000000 +#define DDRSS_CTL_229_DATA 0x00000000 +#define DDRSS_CTL_230_DATA 0x00000000 +#define DDRSS_CTL_231_DATA 0x00000000 +#define DDRSS_CTL_232_DATA 0x00000000 +#define DDRSS_CTL_233_DATA 0x00000000 +#define DDRSS_CTL_234_DATA 0x00000000 +#define DDRSS_CTL_235_DATA 0x00000000 +#define DDRSS_CTL_236_DATA 0x00001401 +#define DDRSS_CTL_237_DATA 0x00001401 +#define DDRSS_CTL_238_DATA 0x00001401 +#define DDRSS_CTL_239_DATA 0x00001401 +#define DDRSS_CTL_240_DATA 0x00001401 +#define DDRSS_CTL_241_DATA 0x00001401 +#define DDRSS_CTL_242_DATA 0x00000493 +#define DDRSS_CTL_243_DATA 0x00000493 +#define DDRSS_CTL_244_DATA 0x00000493 +#define DDRSS_CTL_245_DATA 0x00000493 +#define DDRSS_CTL_246_DATA 0x00000493 +#define DDRSS_CTL_247_DATA 0x00000493 +#define DDRSS_CTL_248_DATA 0x00000000 +#define DDRSS_CTL_249_DATA 0x00000000 +#define DDRSS_CTL_250_DATA 0x00000000 +#define DDRSS_CTL_251_DATA 0x00000000 +#define DDRSS_CTL_252_DATA 0x00000000 +#define DDRSS_CTL_253_DATA 0x00000000 +#define DDRSS_CTL_254_DATA 0x00000000 +#define DDRSS_CTL_255_DATA 0x00000000 +#define DDRSS_CTL_256_DATA 0x00000000 +#define DDRSS_CTL_257_DATA 0x00000000 +#define DDRSS_CTL_258_DATA 0x00000000 +#define DDRSS_CTL_259_DATA 0x00000000 +#define DDRSS_CTL_260_DATA 0x00000000 +#define DDRSS_CTL_261_DATA 0x00000000 +#define DDRSS_CTL_262_DATA 0x00000000 +#define DDRSS_CTL_263_DATA 0x00000000 +#define DDRSS_CTL_264_DATA 0x00000000 +#define DDRSS_CTL_265_DATA 0x00000000 +#define DDRSS_CTL_266_DATA 0x00000000 +#define DDRSS_CTL_267_DATA 0x00000000 +#define DDRSS_CTL_268_DATA 0x00000000 +#define DDRSS_CTL_269_DATA 0x00000000 +#define DDRSS_CTL_270_DATA 0x00000000 +#define DDRSS_CTL_271_DATA 0x00000000 +#define DDRSS_CTL_272_DATA 0x00000000 +#define DDRSS_CTL_273_DATA 0x00000000 +#define DDRSS_CTL_274_DATA 0x00000000 +#define DDRSS_CTL_275_DATA 0x00000000 +#define DDRSS_CTL_276_DATA 0x00000000 +#define DDRSS_CTL_277_DATA 0x00010000 +#define DDRSS_CTL_278_DATA 0x00000000 +#define DDRSS_CTL_279_DATA 0x00000000 +#define DDRSS_CTL_280_DATA 0x00000000 +#define DDRSS_CTL_281_DATA 0x00000101 +#define DDRSS_CTL_282_DATA 0x00000000 +#define DDRSS_CTL_283_DATA 0x00000000 +#define DDRSS_CTL_284_DATA 0x00000000 +#define DDRSS_CTL_285_DATA 0x00000000 +#define DDRSS_CTL_286_DATA 0x00000000 +#define DDRSS_CTL_287_DATA 0x00000000 +#define DDRSS_CTL_288_DATA 0x00000000 +#define DDRSS_CTL_289_DATA 0x00000000 +#define DDRSS_CTL_290_DATA 0x0C181511 +#define DDRSS_CTL_291_DATA 0x00000304 +#define DDRSS_CTL_292_DATA 0x00000000 +#define DDRSS_CTL_293_DATA 0x00000000 +#define DDRSS_CTL_294_DATA 0x00000000 +#define DDRSS_CTL_295_DATA 0x00000000 +#define DDRSS_CTL_296_DATA 0x00000000 +#define DDRSS_CTL_297_DATA 0x00000000 +#define DDRSS_CTL_298_DATA 0x00000000 +#define DDRSS_CTL_299_DATA 0x00000000 +#define DDRSS_CTL_300_DATA 0x00000000 +#define DDRSS_CTL_301_DATA 0x00000000 +#define DDRSS_CTL_302_DATA 0x00000000 +#define DDRSS_CTL_303_DATA 0x00000000 +#define DDRSS_CTL_304_DATA 0x00000000 +#define DDRSS_CTL_305_DATA 0x00040000 +#define DDRSS_CTL_306_DATA 0x00800200 +#define DDRSS_CTL_307_DATA 0x00000000 +#define DDRSS_CTL_308_DATA 0x02000400 +#define DDRSS_CTL_309_DATA 0x00000080 +#define DDRSS_CTL_310_DATA 0x00040000 +#define DDRSS_CTL_311_DATA 0x00800200 +#define DDRSS_CTL_312_DATA 0x00000000 +#define DDRSS_CTL_313_DATA 0x00000000 +#define DDRSS_CTL_314_DATA 0x00000000 +#define DDRSS_CTL_315_DATA 0x00000100 +#define DDRSS_CTL_316_DATA 0x01010000 +#define DDRSS_CTL_317_DATA 0x00000000 +#define DDRSS_CTL_318_DATA 0x3FFF0000 +#define DDRSS_CTL_319_DATA 0x000FFF00 +#define DDRSS_CTL_320_DATA 0xFFFFFFFF +#define DDRSS_CTL_321_DATA 0x00FFFF00 +#define DDRSS_CTL_322_DATA 0x0A000000 +#define DDRSS_CTL_323_DATA 0x0001FFFF +#define DDRSS_CTL_324_DATA 0x01010101 +#define DDRSS_CTL_325_DATA 0x01010101 +#define DDRSS_CTL_326_DATA 0x00000118 +#define DDRSS_CTL_327_DATA 0x00000C01 +#define DDRSS_CTL_328_DATA 0x00000000 +#define DDRSS_CTL_329_DATA 0x00000000 +#define DDRSS_CTL_330_DATA 0x00000000 +#define DDRSS_CTL_331_DATA 0x01000000 +#define DDRSS_CTL_332_DATA 0x00000100 +#define DDRSS_CTL_333_DATA 0x00010000 +#define DDRSS_CTL_334_DATA 0x00000000 +#define DDRSS_CTL_335_DATA 0x00000000 +#define DDRSS_CTL_336_DATA 0x00000000 +#define DDRSS_CTL_337_DATA 0x00000000 +#define DDRSS_CTL_338_DATA 0x00000000 +#define DDRSS_CTL_339_DATA 0x00000000 +#define DDRSS_CTL_340_DATA 0x00000000 +#define DDRSS_CTL_341_DATA 0x00000000 +#define DDRSS_CTL_342_DATA 0x00000000 +#define DDRSS_CTL_343_DATA 0x00000000 +#define DDRSS_CTL_344_DATA 0x00000000 +#define DDRSS_CTL_345_DATA 0x00000000 +#define DDRSS_CTL_346_DATA 0x00000000 +#define DDRSS_CTL_347_DATA 0x00000000 +#define DDRSS_CTL_348_DATA 0x00000000 +#define DDRSS_CTL_349_DATA 0x00000000 +#define DDRSS_CTL_350_DATA 0x00000000 +#define DDRSS_CTL_351_DATA 0x00000000 +#define DDRSS_CTL_352_DATA 0x00000000 +#define DDRSS_CTL_353_DATA 0x00000000 +#define DDRSS_CTL_354_DATA 0x00000000 +#define DDRSS_CTL_355_DATA 0x00000000 +#define DDRSS_CTL_356_DATA 0x00000000 +#define DDRSS_CTL_357_DATA 0x00000000 +#define DDRSS_CTL_358_DATA 0x00000000 +#define DDRSS_CTL_359_DATA 0x00000000 +#define DDRSS_CTL_360_DATA 0x00000000 +#define DDRSS_CTL_361_DATA 0x00000000 +#define DDRSS_CTL_362_DATA 0x00000000 +#define DDRSS_CTL_363_DATA 0x00000000 +#define DDRSS_CTL_364_DATA 0x00000000 +#define DDRSS_CTL_365_DATA 0x00000000 +#define DDRSS_CTL_366_DATA 0x00000000 +#define DDRSS_CTL_367_DATA 0x00000000 +#define DDRSS_CTL_368_DATA 0x00000000 +#define DDRSS_CTL_369_DATA 0x00000000 +#define DDRSS_CTL_370_DATA 0x0C000000 +#define DDRSS_CTL_371_DATA 0x060C0606 +#define DDRSS_CTL_372_DATA 0x06060C06 +#define DDRSS_CTL_373_DATA 0x00010101 +#define DDRSS_CTL_374_DATA 0x02000000 +#define DDRSS_CTL_375_DATA 0x05020101 +#define DDRSS_CTL_376_DATA 0x00000505 +#define DDRSS_CTL_377_DATA 0x02020200 +#define DDRSS_CTL_378_DATA 0x02020202 +#define DDRSS_CTL_379_DATA 0x02020202 +#define DDRSS_CTL_380_DATA 0x02020202 +#define DDRSS_CTL_381_DATA 0x00000000 +#define DDRSS_CTL_382_DATA 0x00000000 +#define DDRSS_CTL_383_DATA 0x04000100 +#define DDRSS_CTL_384_DATA 0x1E000004 +#define DDRSS_CTL_385_DATA 0x000030C0 +#define DDRSS_CTL_386_DATA 0x00000200 +#define DDRSS_CTL_387_DATA 0x00000200 +#define DDRSS_CTL_388_DATA 0x00000200 +#define DDRSS_CTL_389_DATA 0x00000200 +#define DDRSS_CTL_390_DATA 0x0000DB60 +#define DDRSS_CTL_391_DATA 0x0001E780 +#define DDRSS_CTL_392_DATA 0x0C0D0302 +#define DDRSS_CTL_393_DATA 0x001E090A +#define DDRSS_CTL_394_DATA 0x000030C0 +#define DDRSS_CTL_395_DATA 0x00000200 +#define DDRSS_CTL_396_DATA 0x00000200 +#define DDRSS_CTL_397_DATA 0x00000200 +#define DDRSS_CTL_398_DATA 0x00000200 +#define DDRSS_CTL_399_DATA 0x0000DB60 +#define DDRSS_CTL_400_DATA 0x0001E780 +#define DDRSS_CTL_401_DATA 0x0C0D0302 +#define DDRSS_CTL_402_DATA 0x001E090A +#define DDRSS_CTL_403_DATA 0x000030C0 +#define DDRSS_CTL_404_DATA 0x00000200 +#define DDRSS_CTL_405_DATA 0x00000200 +#define DDRSS_CTL_406_DATA 0x00000200 +#define DDRSS_CTL_407_DATA 0x00000200 +#define DDRSS_CTL_408_DATA 0x0000DB60 +#define DDRSS_CTL_409_DATA 0x0001E780 +#define DDRSS_CTL_410_DATA 0x0C0D0302 +#define DDRSS_CTL_411_DATA 0x0000090A +#define DDRSS_CTL_412_DATA 0x00000000 +#define DDRSS_CTL_413_DATA 0x0302000A +#define DDRSS_CTL_414_DATA 0x01000500 +#define DDRSS_CTL_415_DATA 0x01010001 +#define DDRSS_CTL_416_DATA 0x00010001 +#define DDRSS_CTL_417_DATA 0x01010001 +#define DDRSS_CTL_418_DATA 0x02010000 +#define DDRSS_CTL_419_DATA 0x00000200 +#define DDRSS_CTL_420_DATA 0x02000201 +#define DDRSS_CTL_421_DATA 0x00000000 +#define DDRSS_CTL_422_DATA 0x00202020 +#define DDRSS_PI_0_DATA 0x00000A00 +#define DDRSS_PI_1_DATA 0x00000000 +#define DDRSS_PI_2_DATA 0x00000000 +#define DDRSS_PI_3_DATA 0x01000000 +#define DDRSS_PI_4_DATA 0x00000001 +#define DDRSS_PI_5_DATA 0x00010064 +#define DDRSS_PI_6_DATA 0x00000000 +#define DDRSS_PI_7_DATA 0x00000000 +#define DDRSS_PI_8_DATA 0x00000000 +#define DDRSS_PI_9_DATA 0x00000000 +#define DDRSS_PI_10_DATA 0x00000000 +#define DDRSS_PI_11_DATA 0x00000000 +#define DDRSS_PI_12_DATA 0x00000000 +#define DDRSS_PI_13_DATA 0x00010001 +#define DDRSS_PI_14_DATA 0x00000000 +#define DDRSS_PI_15_DATA 0x00010001 +#define DDRSS_PI_16_DATA 0x00000005 +#define DDRSS_PI_17_DATA 0x00000000 +#define DDRSS_PI_18_DATA 0x00000000 +#define DDRSS_PI_19_DATA 0x00000000 +#define DDRSS_PI_20_DATA 0x00000000 +#define DDRSS_PI_21_DATA 0x00000000 +#define DDRSS_PI_22_DATA 0x00000000 +#define DDRSS_PI_23_DATA 0x00000000 +#define DDRSS_PI_24_DATA 0x280D0001 +#define DDRSS_PI_25_DATA 0x00000000 +#define DDRSS_PI_26_DATA 0x00010000 +#define DDRSS_PI_27_DATA 0x00003200 +#define DDRSS_PI_28_DATA 0x00000000 +#define DDRSS_PI_29_DATA 0x00000000 +#define DDRSS_PI_30_DATA 0x00060602 +#define DDRSS_PI_31_DATA 0x00000000 +#define DDRSS_PI_32_DATA 0x00000000 +#define DDRSS_PI_33_DATA 0x00000000 +#define DDRSS_PI_34_DATA 0x00000001 +#define DDRSS_PI_35_DATA 0x00000055 +#define DDRSS_PI_36_DATA 0x000000AA +#define DDRSS_PI_37_DATA 0x000000AD +#define DDRSS_PI_38_DATA 0x00000052 +#define DDRSS_PI_39_DATA 0x0000006A +#define DDRSS_PI_40_DATA 0x00000095 +#define DDRSS_PI_41_DATA 0x00000095 +#define DDRSS_PI_42_DATA 0x000000AD +#define DDRSS_PI_43_DATA 0x00000000 +#define DDRSS_PI_44_DATA 0x00000000 +#define DDRSS_PI_45_DATA 0x00010100 +#define DDRSS_PI_46_DATA 0x00000014 +#define DDRSS_PI_47_DATA 0x000007D0 +#define DDRSS_PI_48_DATA 0x00000300 +#define DDRSS_PI_49_DATA 0x00000000 +#define DDRSS_PI_50_DATA 0x00000000 +#define DDRSS_PI_51_DATA 0x01000000 +#define DDRSS_PI_52_DATA 0x00010101 +#define DDRSS_PI_53_DATA 0x01000000 +#define DDRSS_PI_54_DATA 0x00000000 +#define DDRSS_PI_55_DATA 0x00010000 +#define DDRSS_PI_56_DATA 0x00000000 +#define DDRSS_PI_57_DATA 0x00000000 +#define DDRSS_PI_58_DATA 0x00000000 +#define DDRSS_PI_59_DATA 0x00000000 +#define DDRSS_PI_60_DATA 0x00001400 +#define DDRSS_PI_61_DATA 0x00000000 +#define DDRSS_PI_62_DATA 0x01000000 +#define DDRSS_PI_63_DATA 0x00000404 +#define DDRSS_PI_64_DATA 0x00000001 +#define DDRSS_PI_65_DATA 0x0001010E +#define DDRSS_PI_66_DATA 0x02040100 +#define DDRSS_PI_67_DATA 0x00010000 +#define DDRSS_PI_68_DATA 0x00000034 +#define DDRSS_PI_69_DATA 0x00000000 +#define DDRSS_PI_70_DATA 0x00000000 +#define DDRSS_PI_71_DATA 0x00000000 +#define DDRSS_PI_72_DATA 0x00000000 +#define DDRSS_PI_73_DATA 0x00000000 +#define DDRSS_PI_74_DATA 0x00000000 +#define DDRSS_PI_75_DATA 0x00000005 +#define DDRSS_PI_76_DATA 0x01000000 +#define DDRSS_PI_77_DATA 0x04000100 +#define DDRSS_PI_78_DATA 0x00020000 +#define DDRSS_PI_79_DATA 0x00010002 +#define DDRSS_PI_80_DATA 0x00000001 +#define DDRSS_PI_81_DATA 0x00020001 +#define DDRSS_PI_82_DATA 0x00020002 +#define DDRSS_PI_83_DATA 0x00000000 +#define DDRSS_PI_84_DATA 0x00000000 +#define DDRSS_PI_85_DATA 0x00000000 +#define DDRSS_PI_86_DATA 0x00000000 +#define DDRSS_PI_87_DATA 0x00000000 +#define DDRSS_PI_88_DATA 0x00000000 +#define DDRSS_PI_89_DATA 0x00000000 +#define DDRSS_PI_90_DATA 0x00000000 +#define DDRSS_PI_91_DATA 0x00000300 +#define DDRSS_PI_92_DATA 0x0A090B0C +#define DDRSS_PI_93_DATA 0x04060708 +#define DDRSS_PI_94_DATA 0x01000005 +#define DDRSS_PI_95_DATA 0x00000800 +#define DDRSS_PI_96_DATA 0x00000000 +#define DDRSS_PI_97_DATA 0x00010008 +#define DDRSS_PI_98_DATA 0x00000000 +#define DDRSS_PI_99_DATA 0x0000AA00 +#define DDRSS_PI_100_DATA 0x00000000 +#define DDRSS_PI_101_DATA 0x00010000 +#define DDRSS_PI_102_DATA 0x00000000 +#define DDRSS_PI_103_DATA 0x00000000 +#define DDRSS_PI_104_DATA 0x00000000 +#define DDRSS_PI_105_DATA 0x00000000 +#define DDRSS_PI_106_DATA 0x00000000 +#define DDRSS_PI_107_DATA 0x00000000 +#define DDRSS_PI_108_DATA 0x00000000 +#define DDRSS_PI_109_DATA 0x00000000 +#define DDRSS_PI_110_DATA 0x00000000 +#define DDRSS_PI_111_DATA 0x00000000 +#define DDRSS_PI_112_DATA 0x00000000 +#define DDRSS_PI_113_DATA 0x00000000 +#define DDRSS_PI_114_DATA 0x00000000 +#define DDRSS_PI_115_DATA 0x00000000 +#define DDRSS_PI_116_DATA 0x00000000 +#define DDRSS_PI_117_DATA 0x00000000 +#define DDRSS_PI_118_DATA 0x00000000 +#define DDRSS_PI_119_DATA 0x00000000 +#define DDRSS_PI_120_DATA 0x00000000 +#define DDRSS_PI_121_DATA 0x00000000 +#define DDRSS_PI_122_DATA 0x00000000 +#define DDRSS_PI_123_DATA 0x00000000 +#define DDRSS_PI_124_DATA 0x00000008 +#define DDRSS_PI_125_DATA 0x00000000 +#define DDRSS_PI_126_DATA 0x00000000 +#define DDRSS_PI_127_DATA 0x00000000 +#define DDRSS_PI_128_DATA 0x00000000 +#define DDRSS_PI_129_DATA 0x00000000 +#define DDRSS_PI_130_DATA 0x00000000 +#define DDRSS_PI_131_DATA 0x00000000 +#define DDRSS_PI_132_DATA 0x00000000 +#define DDRSS_PI_133_DATA 0x00010100 +#define DDRSS_PI_134_DATA 0x00000000 +#define DDRSS_PI_135_DATA 0x00000000 +#define DDRSS_PI_136_DATA 0x00027100 +#define DDRSS_PI_137_DATA 0x00061A80 +#define DDRSS_PI_138_DATA 0x00000100 +#define DDRSS_PI_139_DATA 0x00000000 +#define DDRSS_PI_140_DATA 0x00000000 +#define DDRSS_PI_141_DATA 0x00000000 +#define DDRSS_PI_142_DATA 0x00000000 +#define DDRSS_PI_143_DATA 0x00000000 +#define DDRSS_PI_144_DATA 0x01000000 +#define DDRSS_PI_145_DATA 0x00010003 +#define DDRSS_PI_146_DATA 0x02000101 +#define DDRSS_PI_147_DATA 0x01030001 +#define DDRSS_PI_148_DATA 0x00010400 +#define DDRSS_PI_149_DATA 0x06000105 +#define DDRSS_PI_150_DATA 0x01070001 +#define DDRSS_PI_151_DATA 0x00000000 +#define DDRSS_PI_152_DATA 0x00000000 +#define DDRSS_PI_153_DATA 0x00000000 +#define DDRSS_PI_154_DATA 0x00010000 +#define DDRSS_PI_155_DATA 0x00000000 +#define DDRSS_PI_156_DATA 0x00000000 +#define DDRSS_PI_157_DATA 0x00000000 +#define DDRSS_PI_158_DATA 0x00000000 +#define DDRSS_PI_159_DATA 0x00010000 +#define DDRSS_PI_160_DATA 0x00000004 +#define DDRSS_PI_161_DATA 0x00000000 +#define DDRSS_PI_162_DATA 0x00000000 +#define DDRSS_PI_163_DATA 0x00000000 +#define DDRSS_PI_164_DATA 0x00007800 +#define DDRSS_PI_165_DATA 0x00780078 +#define DDRSS_PI_166_DATA 0x00141414 +#define DDRSS_PI_167_DATA 0x0000003A +#define DDRSS_PI_168_DATA 0x0000003A +#define DDRSS_PI_169_DATA 0x0004003A +#define DDRSS_PI_170_DATA 0x04000400 +#define DDRSS_PI_171_DATA 0xC8040009 +#define DDRSS_PI_172_DATA 0x0400091C +#define DDRSS_PI_173_DATA 0x00091CC8 +#define DDRSS_PI_174_DATA 0x001CC804 +#define DDRSS_PI_175_DATA 0x00000118 +#define DDRSS_PI_176_DATA 0x00001860 +#define DDRSS_PI_177_DATA 0x00000118 +#define DDRSS_PI_178_DATA 0x00001860 +#define DDRSS_PI_179_DATA 0x00000118 +#define DDRSS_PI_180_DATA 0x04001860 +#define DDRSS_PI_181_DATA 0x01010404 +#define DDRSS_PI_182_DATA 0x00001901 +#define DDRSS_PI_183_DATA 0x00190019 +#define DDRSS_PI_184_DATA 0x010C010C +#define DDRSS_PI_185_DATA 0x0000010C +#define DDRSS_PI_186_DATA 0x00000000 +#define DDRSS_PI_187_DATA 0x05000000 +#define DDRSS_PI_188_DATA 0x01010505 +#define DDRSS_PI_189_DATA 0x01010101 +#define DDRSS_PI_190_DATA 0x00181818 +#define DDRSS_PI_191_DATA 0x00000000 +#define DDRSS_PI_192_DATA 0x00000000 +#define DDRSS_PI_193_DATA 0x0D000000 +#define DDRSS_PI_194_DATA 0x0A0A0D0D +#define DDRSS_PI_195_DATA 0x0303030A +#define DDRSS_PI_196_DATA 0x00000000 +#define DDRSS_PI_197_DATA 0x00000000 +#define DDRSS_PI_198_DATA 0x00000000 +#define DDRSS_PI_199_DATA 0x00000000 +#define DDRSS_PI_200_DATA 0x00000000 +#define DDRSS_PI_201_DATA 0x00000000 +#define DDRSS_PI_202_DATA 0x00000000 +#define DDRSS_PI_203_DATA 0x00000000 +#define DDRSS_PI_204_DATA 0x00000000 +#define DDRSS_PI_205_DATA 0x00000000 +#define DDRSS_PI_206_DATA 0x00000000 +#define DDRSS_PI_207_DATA 0x00000000 +#define DDRSS_PI_208_DATA 0x00000000 +#define DDRSS_PI_209_DATA 0x0D090000 +#define DDRSS_PI_210_DATA 0x0D09000D +#define DDRSS_PI_211_DATA 0x0D09000D +#define DDRSS_PI_212_DATA 0x0000000D +#define DDRSS_PI_213_DATA 0x00000000 +#define DDRSS_PI_214_DATA 0x00000000 +#define DDRSS_PI_215_DATA 0x00000000 +#define DDRSS_PI_216_DATA 0x00000000 +#define DDRSS_PI_217_DATA 0x16000000 +#define DDRSS_PI_218_DATA 0x001600C8 +#define DDRSS_PI_219_DATA 0x001600C8 +#define DDRSS_PI_220_DATA 0x010100C8 +#define DDRSS_PI_221_DATA 0x00001B01 +#define DDRSS_PI_222_DATA 0x1F0F0053 +#define DDRSS_PI_223_DATA 0x05000001 +#define DDRSS_PI_224_DATA 0x001B0A0D +#define DDRSS_PI_225_DATA 0x1F0F0053 +#define DDRSS_PI_226_DATA 0x05000001 +#define DDRSS_PI_227_DATA 0x001B0A0D +#define DDRSS_PI_228_DATA 0x1F0F0053 +#define DDRSS_PI_229_DATA 0x05000001 +#define DDRSS_PI_230_DATA 0x00010A0D +#define DDRSS_PI_231_DATA 0x0C0B0700 +#define DDRSS_PI_232_DATA 0x000D0605 +#define DDRSS_PI_233_DATA 0x0000C570 +#define DDRSS_PI_234_DATA 0x0000001D +#define DDRSS_PI_235_DATA 0x180A0800 +#define DDRSS_PI_236_DATA 0x0B071C1C +#define DDRSS_PI_237_DATA 0x0D06050C +#define DDRSS_PI_238_DATA 0x0000C570 +#define DDRSS_PI_239_DATA 0x0000001D +#define DDRSS_PI_240_DATA 0x180A0800 +#define DDRSS_PI_241_DATA 0x0B071C1C +#define DDRSS_PI_242_DATA 0x0D06050C +#define DDRSS_PI_243_DATA 0x0000C570 +#define DDRSS_PI_244_DATA 0x0000001D +#define DDRSS_PI_245_DATA 0x180A0800 +#define DDRSS_PI_246_DATA 0x00001C1C +#define DDRSS_PI_247_DATA 0x000030C0 +#define DDRSS_PI_248_DATA 0x0001E780 +#define DDRSS_PI_249_DATA 0x000030C0 +#define DDRSS_PI_250_DATA 0x0001E780 +#define DDRSS_PI_251_DATA 0x000030C0 +#define DDRSS_PI_252_DATA 0x0001E780 +#define DDRSS_PI_253_DATA 0x04000400 +#define DDRSS_PI_254_DATA 0x03030400 +#define DDRSS_PI_255_DATA 0x00040003 +#define DDRSS_PI_256_DATA 0x04000400 +#define DDRSS_PI_257_DATA 0x0C080C08 +#define DDRSS_PI_258_DATA 0x00000C08 +#define DDRSS_PI_259_DATA 0x000890B8 +#define DDRSS_PI_260_DATA 0x00000000 +#define DDRSS_PI_261_DATA 0x00000000 +#define DDRSS_PI_262_DATA 0x00000000 +#define DDRSS_PI_263_DATA 0x00000120 +#define DDRSS_PI_264_DATA 0x000890B8 +#define DDRSS_PI_265_DATA 0x00000000 +#define DDRSS_PI_266_DATA 0x00000000 +#define DDRSS_PI_267_DATA 0x00000000 +#define DDRSS_PI_268_DATA 0x00000120 +#define DDRSS_PI_269_DATA 0x000890B8 +#define DDRSS_PI_270_DATA 0x00000000 +#define DDRSS_PI_271_DATA 0x00000000 +#define DDRSS_PI_272_DATA 0x00000000 +#define DDRSS_PI_273_DATA 0x02000120 +#define DDRSS_PI_274_DATA 0x00000080 +#define DDRSS_PI_275_DATA 0x00020000 +#define DDRSS_PI_276_DATA 0x00000080 +#define DDRSS_PI_277_DATA 0x00020000 +#define DDRSS_PI_278_DATA 0x00000080 +#define DDRSS_PI_279_DATA 0x00000000 +#define DDRSS_PI_280_DATA 0x00000000 +#define DDRSS_PI_281_DATA 0x00040404 +#define DDRSS_PI_282_DATA 0x00000000 +#define DDRSS_PI_283_DATA 0x02010102 +#define DDRSS_PI_284_DATA 0x67676767 +#define DDRSS_PI_285_DATA 0x00000202 +#define DDRSS_PI_286_DATA 0x00000000 +#define DDRSS_PI_287_DATA 0x00000000 +#define DDRSS_PI_288_DATA 0x00000000 +#define DDRSS_PI_289_DATA 0x00000000 +#define DDRSS_PI_290_DATA 0x00000000 +#define DDRSS_PI_291_DATA 0x0D100F00 +#define DDRSS_PI_292_DATA 0x0003020E +#define DDRSS_PI_293_DATA 0x00000001 +#define DDRSS_PI_294_DATA 0x01000000 +#define DDRSS_PI_295_DATA 0x00020201 +#define DDRSS_PI_296_DATA 0x00000000 +#define DDRSS_PI_297_DATA 0x00000424 +#define DDRSS_PI_298_DATA 0x00000301 +#define DDRSS_PI_299_DATA 0x00000000 +#define DDRSS_PI_300_DATA 0x00000000 +#define DDRSS_PI_301_DATA 0x00000000 +#define DDRSS_PI_302_DATA 0x00001401 +#define DDRSS_PI_303_DATA 0x00000493 +#define DDRSS_PI_304_DATA 0x00000000 +#define DDRSS_PI_305_DATA 0x00000424 +#define DDRSS_PI_306_DATA 0x00000301 +#define DDRSS_PI_307_DATA 0x00000000 +#define DDRSS_PI_308_DATA 0x00000000 +#define DDRSS_PI_309_DATA 0x00000000 +#define DDRSS_PI_310_DATA 0x00001401 +#define DDRSS_PI_311_DATA 0x00000493 +#define DDRSS_PI_312_DATA 0x00000000 +#define DDRSS_PI_313_DATA 0x00000424 +#define DDRSS_PI_314_DATA 0x00000301 +#define DDRSS_PI_315_DATA 0x00000000 +#define DDRSS_PI_316_DATA 0x00000000 +#define DDRSS_PI_317_DATA 0x00000000 +#define DDRSS_PI_318_DATA 0x00001401 +#define DDRSS_PI_319_DATA 0x00000493 +#define DDRSS_PI_320_DATA 0x00000000 +#define DDRSS_PI_321_DATA 0x00000424 +#define DDRSS_PI_322_DATA 0x00000301 +#define DDRSS_PI_323_DATA 0x00000000 +#define DDRSS_PI_324_DATA 0x00000000 +#define DDRSS_PI_325_DATA 0x00000000 +#define DDRSS_PI_326_DATA 0x00001401 +#define DDRSS_PI_327_DATA 0x00000493 +#define DDRSS_PI_328_DATA 0x00000000 +#define DDRSS_PI_329_DATA 0x00000424 +#define DDRSS_PI_330_DATA 0x00000301 +#define DDRSS_PI_331_DATA 0x00000000 +#define DDRSS_PI_332_DATA 0x00000000 +#define DDRSS_PI_333_DATA 0x00000000 +#define DDRSS_PI_334_DATA 0x00001401 +#define DDRSS_PI_335_DATA 0x00000493 +#define DDRSS_PI_336_DATA 0x00000000 +#define DDRSS_PI_337_DATA 0x00000424 +#define DDRSS_PI_338_DATA 0x00000301 +#define DDRSS_PI_339_DATA 0x00000000 +#define DDRSS_PI_340_DATA 0x00000000 +#define DDRSS_PI_341_DATA 0x00000000 +#define DDRSS_PI_342_DATA 0x00001401 +#define DDRSS_PI_343_DATA 0x00000493 +#define DDRSS_PI_344_DATA 0x00000000 +#define DDRSS_PHY_0_DATA 0x04C00000 +#define DDRSS_PHY_1_DATA 0x00000000 +#define DDRSS_PHY_2_DATA 0x00000200 +#define DDRSS_PHY_3_DATA 0x00000000 +#define DDRSS_PHY_4_DATA 0x00000000 +#define DDRSS_PHY_5_DATA 0x00000000 +#define DDRSS_PHY_6_DATA 0x00000000 +#define DDRSS_PHY_7_DATA 0x00000000 +#define DDRSS_PHY_8_DATA 0x00000001 +#define DDRSS_PHY_9_DATA 0x00000000 +#define DDRSS_PHY_10_DATA 0x00000000 +#define DDRSS_PHY_11_DATA 0x010101FF +#define DDRSS_PHY_12_DATA 0x00010000 +#define DDRSS_PHY_13_DATA 0x00C00004 +#define DDRSS_PHY_14_DATA 0x00CC0008 +#define DDRSS_PHY_15_DATA 0x00660201 +#define DDRSS_PHY_16_DATA 0x00000000 +#define DDRSS_PHY_17_DATA 0x00000000 +#define DDRSS_PHY_18_DATA 0x00000000 +#define DDRSS_PHY_19_DATA 0x0000AAAA +#define DDRSS_PHY_20_DATA 0x00005555 +#define DDRSS_PHY_21_DATA 0x0000B5B5 +#define DDRSS_PHY_22_DATA 0x00004A4A +#define DDRSS_PHY_23_DATA 0x00005656 +#define DDRSS_PHY_24_DATA 0x0000A9A9 +#define DDRSS_PHY_25_DATA 0x0000B7B7 +#define DDRSS_PHY_26_DATA 0x00004848 +#define DDRSS_PHY_27_DATA 0x00000000 +#define DDRSS_PHY_28_DATA 0x00000000 +#define DDRSS_PHY_29_DATA 0x08000000 +#define DDRSS_PHY_30_DATA 0x0F000008 +#define DDRSS_PHY_31_DATA 0x00000F0F +#define DDRSS_PHY_32_DATA 0x00E4E400 +#define DDRSS_PHY_33_DATA 0x00070820 +#define DDRSS_PHY_34_DATA 0x000C0020 +#define DDRSS_PHY_35_DATA 0x00062000 +#define DDRSS_PHY_36_DATA 0x00000000 +#define DDRSS_PHY_37_DATA 0x55555555 +#define DDRSS_PHY_38_DATA 0xAAAAAAAA +#define DDRSS_PHY_39_DATA 0x55555555 +#define DDRSS_PHY_40_DATA 0xAAAAAAAA +#define DDRSS_PHY_41_DATA 0x00005555 +#define DDRSS_PHY_42_DATA 0x01000100 +#define DDRSS_PHY_43_DATA 0x00800180 +#define DDRSS_PHY_44_DATA 0x00000000 +#define DDRSS_PHY_45_DATA 0x00000000 +#define DDRSS_PHY_46_DATA 0x00000000 +#define DDRSS_PHY_47_DATA 0x00000000 +#define DDRSS_PHY_48_DATA 0x00000000 +#define DDRSS_PHY_49_DATA 0x00000000 +#define DDRSS_PHY_50_DATA 0x00000000 +#define DDRSS_PHY_51_DATA 0x00000000 +#define DDRSS_PHY_52_DATA 0x00000000 +#define DDRSS_PHY_53_DATA 0x00000000 +#define DDRSS_PHY_54_DATA 0x00000000 +#define DDRSS_PHY_55_DATA 0x00000000 +#define DDRSS_PHY_56_DATA 0x00000000 +#define DDRSS_PHY_57_DATA 0x00000000 +#define DDRSS_PHY_58_DATA 0x00000000 +#define DDRSS_PHY_59_DATA 0x00000000 +#define DDRSS_PHY_60_DATA 0x00000000 +#define DDRSS_PHY_61_DATA 0x00000000 +#define DDRSS_PHY_62_DATA 0x00000000 +#define DDRSS_PHY_63_DATA 0x00000000 +#define DDRSS_PHY_64_DATA 0x00000000 +#define DDRSS_PHY_65_DATA 0x00000004 +#define DDRSS_PHY_66_DATA 0x00000000 +#define DDRSS_PHY_67_DATA 0x00000000 +#define DDRSS_PHY_68_DATA 0x00000000 +#define DDRSS_PHY_69_DATA 0x00000000 +#define DDRSS_PHY_70_DATA 0x00000000 +#define DDRSS_PHY_71_DATA 0x00000000 +#define DDRSS_PHY_72_DATA 0x041F07FF +#define DDRSS_PHY_73_DATA 0x00000000 +#define DDRSS_PHY_74_DATA 0x01CCB001 +#define DDRSS_PHY_75_DATA 0x2000CCB0 +#define DDRSS_PHY_76_DATA 0x20000140 +#define DDRSS_PHY_77_DATA 0x07FF0200 +#define DDRSS_PHY_78_DATA 0x0000DD01 +#define DDRSS_PHY_79_DATA 0x10100303 +#define DDRSS_PHY_80_DATA 0x10101010 +#define DDRSS_PHY_81_DATA 0x10101010 +#define DDRSS_PHY_82_DATA 0x00021010 +#define DDRSS_PHY_83_DATA 0x00100010 +#define DDRSS_PHY_84_DATA 0x00100010 +#define DDRSS_PHY_85_DATA 0x00100010 +#define DDRSS_PHY_86_DATA 0x00100010 +#define DDRSS_PHY_87_DATA 0x02020010 +#define DDRSS_PHY_88_DATA 0x51515041 +#define DDRSS_PHY_89_DATA 0x31804000 +#define DDRSS_PHY_90_DATA 0x04BF0340 +#define DDRSS_PHY_91_DATA 0x01008080 +#define DDRSS_PHY_92_DATA 0x04050001 +#define DDRSS_PHY_93_DATA 0x00000504 +#define DDRSS_PHY_94_DATA 0x42100010 +#define DDRSS_PHY_95_DATA 0x010C053E +#define DDRSS_PHY_96_DATA 0x000F0C14 +#define DDRSS_PHY_97_DATA 0x01000140 +#define DDRSS_PHY_98_DATA 0x007A0120 +#define DDRSS_PHY_99_DATA 0x00000C00 +#define DDRSS_PHY_100_DATA 0x000001CC +#define DDRSS_PHY_101_DATA 0x20100200 +#define DDRSS_PHY_102_DATA 0x00000005 +#define DDRSS_PHY_103_DATA 0x76543210 +#define DDRSS_PHY_104_DATA 0x00000008 +#define DDRSS_PHY_105_DATA 0x02800280 +#define DDRSS_PHY_106_DATA 0x02800280 +#define DDRSS_PHY_107_DATA 0x02800280 +#define DDRSS_PHY_108_DATA 0x02800280 +#define DDRSS_PHY_109_DATA 0x00000280 +#define DDRSS_PHY_110_DATA 0x00008000 +#define DDRSS_PHY_111_DATA 0x00800080 +#define DDRSS_PHY_112_DATA 0x00800080 +#define DDRSS_PHY_113_DATA 0x00800080 +#define DDRSS_PHY_114_DATA 0x00800080 +#define DDRSS_PHY_115_DATA 0x00800080 +#define DDRSS_PHY_116_DATA 0x00800080 +#define DDRSS_PHY_117_DATA 0x00800080 +#define DDRSS_PHY_118_DATA 0x00800080 +#define DDRSS_PHY_119_DATA 0x01000080 +#define DDRSS_PHY_120_DATA 0x01000000 +#define DDRSS_PHY_121_DATA 0x00000000 +#define DDRSS_PHY_122_DATA 0x00000000 +#define DDRSS_PHY_123_DATA 0x00080200 +#define DDRSS_PHY_124_DATA 0x00000000 +#define DDRSS_PHY_125_DATA 0x00000000 +#define DDRSS_PHY_126_DATA 0x00000000 +#define DDRSS_PHY_127_DATA 0x00000000 +#define DDRSS_PHY_128_DATA 0x00000000 +#define DDRSS_PHY_129_DATA 0x00000000 +#define DDRSS_PHY_130_DATA 0x00000000 +#define DDRSS_PHY_131_DATA 0x00000000 +#define DDRSS_PHY_132_DATA 0x00000000 +#define DDRSS_PHY_133_DATA 0x00000000 +#define DDRSS_PHY_134_DATA 0x00000000 +#define DDRSS_PHY_135_DATA 0x00000000 +#define DDRSS_PHY_136_DATA 0x00000000 +#define DDRSS_PHY_137_DATA 0x00000000 +#define DDRSS_PHY_138_DATA 0x00000000 +#define DDRSS_PHY_139_DATA 0x00000000 +#define DDRSS_PHY_140_DATA 0x00000000 +#define DDRSS_PHY_141_DATA 0x00000000 +#define DDRSS_PHY_142_DATA 0x00000000 +#define DDRSS_PHY_143_DATA 0x00000000 +#define DDRSS_PHY_144_DATA 0x00000000 +#define DDRSS_PHY_145_DATA 0x00000000 +#define DDRSS_PHY_146_DATA 0x00000000 +#define DDRSS_PHY_147_DATA 0x00000000 +#define DDRSS_PHY_148_DATA 0x00000000 +#define DDRSS_PHY_149_DATA 0x00000000 +#define DDRSS_PHY_150_DATA 0x00000000 +#define DDRSS_PHY_151_DATA 0x00000000 +#define DDRSS_PHY_152_DATA 0x00000000 +#define DDRSS_PHY_153_DATA 0x00000000 +#define DDRSS_PHY_154_DATA 0x00000000 +#define DDRSS_PHY_155_DATA 0x00000000 +#define DDRSS_PHY_156_DATA 0x00000000 +#define DDRSS_PHY_157_DATA 0x00000000 +#define DDRSS_PHY_158_DATA 0x00000000 +#define DDRSS_PHY_159_DATA 0x00000000 +#define DDRSS_PHY_160_DATA 0x00000000 +#define DDRSS_PHY_161_DATA 0x00000000 +#define DDRSS_PHY_162_DATA 0x00000000 +#define DDRSS_PHY_163_DATA 0x00000000 +#define DDRSS_PHY_164_DATA 0x00000000 +#define DDRSS_PHY_165_DATA 0x00000000 +#define DDRSS_PHY_166_DATA 0x00000000 +#define DDRSS_PHY_167_DATA 0x00000000 +#define DDRSS_PHY_168_DATA 0x00000000 +#define DDRSS_PHY_169_DATA 0x00000000 +#define DDRSS_PHY_170_DATA 0x00000000 +#define DDRSS_PHY_171_DATA 0x00000000 +#define DDRSS_PHY_172_DATA 0x00000000 +#define DDRSS_PHY_173_DATA 0x00000000 +#define DDRSS_PHY_174_DATA 0x00000000 +#define DDRSS_PHY_175_DATA 0x00000000 +#define DDRSS_PHY_176_DATA 0x00000000 +#define DDRSS_PHY_177_DATA 0x00000000 +#define DDRSS_PHY_178_DATA 0x00000000 +#define DDRSS_PHY_179_DATA 0x00000000 +#define DDRSS_PHY_180_DATA 0x00000000 +#define DDRSS_PHY_181_DATA 0x00000000 +#define DDRSS_PHY_182_DATA 0x00000000 +#define DDRSS_PHY_183_DATA 0x00000000 +#define DDRSS_PHY_184_DATA 0x00000000 +#define DDRSS_PHY_185_DATA 0x00000000 +#define DDRSS_PHY_186_DATA 0x00000000 +#define DDRSS_PHY_187_DATA 0x00000000 +#define DDRSS_PHY_188_DATA 0x00000000 +#define DDRSS_PHY_189_DATA 0x00000000 +#define DDRSS_PHY_190_DATA 0x00000000 +#define DDRSS_PHY_191_DATA 0x00000000 +#define DDRSS_PHY_192_DATA 0x00000000 +#define DDRSS_PHY_193_DATA 0x00000000 +#define DDRSS_PHY_194_DATA 0x00000000 +#define DDRSS_PHY_195_DATA 0x00000000 +#define DDRSS_PHY_196_DATA 0x00000000 +#define DDRSS_PHY_197_DATA 0x00000000 +#define DDRSS_PHY_198_DATA 0x00000000 +#define DDRSS_PHY_199_DATA 0x00000000 +#define DDRSS_PHY_200_DATA 0x00000000 +#define DDRSS_PHY_201_DATA 0x00000000 +#define DDRSS_PHY_202_DATA 0x00000000 +#define DDRSS_PHY_203_DATA 0x00000000 +#define DDRSS_PHY_204_DATA 0x00000000 +#define DDRSS_PHY_205_DATA 0x00000000 +#define DDRSS_PHY_206_DATA 0x00000000 +#define DDRSS_PHY_207_DATA 0x00000000 +#define DDRSS_PHY_208_DATA 0x00000000 +#define DDRSS_PHY_209_DATA 0x00000000 +#define DDRSS_PHY_210_DATA 0x00000000 +#define DDRSS_PHY_211_DATA 0x00000000 +#define DDRSS_PHY_212_DATA 0x00000000 +#define DDRSS_PHY_213_DATA 0x00000000 +#define DDRSS_PHY_214_DATA 0x00000000 +#define DDRSS_PHY_215_DATA 0x00000000 +#define DDRSS_PHY_216_DATA 0x00000000 +#define DDRSS_PHY_217_DATA 0x00000000 +#define DDRSS_PHY_218_DATA 0x00000000 +#define DDRSS_PHY_219_DATA 0x00000000 +#define DDRSS_PHY_220_DATA 0x00000000 +#define DDRSS_PHY_221_DATA 0x00000000 +#define DDRSS_PHY_222_DATA 0x00000000 +#define DDRSS_PHY_223_DATA 0x00000000 +#define DDRSS_PHY_224_DATA 0x00000000 +#define DDRSS_PHY_225_DATA 0x00000000 +#define DDRSS_PHY_226_DATA 0x00000000 +#define DDRSS_PHY_227_DATA 0x00000000 +#define DDRSS_PHY_228_DATA 0x00000000 +#define DDRSS_PHY_229_DATA 0x00000000 +#define DDRSS_PHY_230_DATA 0x00000000 +#define DDRSS_PHY_231_DATA 0x00000000 +#define DDRSS_PHY_232_DATA 0x00000000 +#define DDRSS_PHY_233_DATA 0x00000000 +#define DDRSS_PHY_234_DATA 0x00000000 +#define DDRSS_PHY_235_DATA 0x00000000 +#define DDRSS_PHY_236_DATA 0x00000000 +#define DDRSS_PHY_237_DATA 0x00000000 +#define DDRSS_PHY_238_DATA 0x00000000 +#define DDRSS_PHY_239_DATA 0x00000000 +#define DDRSS_PHY_240_DATA 0x00000000 +#define DDRSS_PHY_241_DATA 0x00000000 +#define DDRSS_PHY_242_DATA 0x00000000 +#define DDRSS_PHY_243_DATA 0x00000000 +#define DDRSS_PHY_244_DATA 0x00000000 +#define DDRSS_PHY_245_DATA 0x00000000 +#define DDRSS_PHY_246_DATA 0x00000000 +#define DDRSS_PHY_247_DATA 0x00000000 +#define DDRSS_PHY_248_DATA 0x00000000 +#define DDRSS_PHY_249_DATA 0x00000000 +#define DDRSS_PHY_250_DATA 0x00000000 +#define DDRSS_PHY_251_DATA 0x00000000 +#define DDRSS_PHY_252_DATA 0x00000000 +#define DDRSS_PHY_253_DATA 0x00000000 +#define DDRSS_PHY_254_DATA 0x00000000 +#define DDRSS_PHY_255_DATA 0x00000000 +#define DDRSS_PHY_256_DATA 0x04C00000 +#define DDRSS_PHY_257_DATA 0x00000000 +#define DDRSS_PHY_258_DATA 0x00000200 +#define DDRSS_PHY_259_DATA 0x00000000 +#define DDRSS_PHY_260_DATA 0x00000000 +#define DDRSS_PHY_261_DATA 0x00000000 +#define DDRSS_PHY_262_DATA 0x00000000 +#define DDRSS_PHY_263_DATA 0x00000000 +#define DDRSS_PHY_264_DATA 0x00000001 +#define DDRSS_PHY_265_DATA 0x00000000 +#define DDRSS_PHY_266_DATA 0x00000000 +#define DDRSS_PHY_267_DATA 0x010101FF +#define DDRSS_PHY_268_DATA 0x00010000 +#define DDRSS_PHY_269_DATA 0x00C00004 +#define DDRSS_PHY_270_DATA 0x00CC0008 +#define DDRSS_PHY_271_DATA 0x00660201 +#define DDRSS_PHY_272_DATA 0x00000000 +#define DDRSS_PHY_273_DATA 0x00000000 +#define DDRSS_PHY_274_DATA 0x00000000 +#define DDRSS_PHY_275_DATA 0x0000AAAA +#define DDRSS_PHY_276_DATA 0x00005555 +#define DDRSS_PHY_277_DATA 0x0000B5B5 +#define DDRSS_PHY_278_DATA 0x00004A4A +#define DDRSS_PHY_279_DATA 0x00005656 +#define DDRSS_PHY_280_DATA 0x0000A9A9 +#define DDRSS_PHY_281_DATA 0x0000B7B7 +#define DDRSS_PHY_282_DATA 0x00004848 +#define DDRSS_PHY_283_DATA 0x00000000 +#define DDRSS_PHY_284_DATA 0x00000000 +#define DDRSS_PHY_285_DATA 0x08000000 +#define DDRSS_PHY_286_DATA 0x0F000008 +#define DDRSS_PHY_287_DATA 0x00000F0F +#define DDRSS_PHY_288_DATA 0x00E4E400 +#define DDRSS_PHY_289_DATA 0x00070820 +#define DDRSS_PHY_290_DATA 0x000C0020 +#define DDRSS_PHY_291_DATA 0x00062000 +#define DDRSS_PHY_292_DATA 0x00000000 +#define DDRSS_PHY_293_DATA 0x55555555 +#define DDRSS_PHY_294_DATA 0xAAAAAAAA +#define DDRSS_PHY_295_DATA 0x55555555 +#define DDRSS_PHY_296_DATA 0xAAAAAAAA +#define DDRSS_PHY_297_DATA 0x00005555 +#define DDRSS_PHY_298_DATA 0x01000100 +#define DDRSS_PHY_299_DATA 0x00800180 +#define DDRSS_PHY_300_DATA 0x00000000 +#define DDRSS_PHY_301_DATA 0x00000000 +#define DDRSS_PHY_302_DATA 0x00000000 +#define DDRSS_PHY_303_DATA 0x00000000 +#define DDRSS_PHY_304_DATA 0x00000000 +#define DDRSS_PHY_305_DATA 0x00000000 +#define DDRSS_PHY_306_DATA 0x00000000 +#define DDRSS_PHY_307_DATA 0x00000000 +#define DDRSS_PHY_308_DATA 0x00000000 +#define DDRSS_PHY_309_DATA 0x00000000 +#define DDRSS_PHY_310_DATA 0x00000000 +#define DDRSS_PHY_311_DATA 0x00000000 +#define DDRSS_PHY_312_DATA 0x00000000 +#define DDRSS_PHY_313_DATA 0x00000000 +#define DDRSS_PHY_314_DATA 0x00000000 +#define DDRSS_PHY_315_DATA 0x00000000 +#define DDRSS_PHY_316_DATA 0x00000000 +#define DDRSS_PHY_317_DATA 0x00000000 +#define DDRSS_PHY_318_DATA 0x00000000 +#define DDRSS_PHY_319_DATA 0x00000000 +#define DDRSS_PHY_320_DATA 0x00000000 +#define DDRSS_PHY_321_DATA 0x00000004 +#define DDRSS_PHY_322_DATA 0x00000000 +#define DDRSS_PHY_323_DATA 0x00000000 +#define DDRSS_PHY_324_DATA 0x00000000 +#define DDRSS_PHY_325_DATA 0x00000000 +#define DDRSS_PHY_326_DATA 0x00000000 +#define DDRSS_PHY_327_DATA 0x00000000 +#define DDRSS_PHY_328_DATA 0x041F07FF +#define DDRSS_PHY_329_DATA 0x00000000 +#define DDRSS_PHY_330_DATA 0x01CCB001 +#define DDRSS_PHY_331_DATA 0x2000CCB0 +#define DDRSS_PHY_332_DATA 0x20000140 +#define DDRSS_PHY_333_DATA 0x07FF0200 +#define DDRSS_PHY_334_DATA 0x0000DD01 +#define DDRSS_PHY_335_DATA 0x10100303 +#define DDRSS_PHY_336_DATA 0x10101010 +#define DDRSS_PHY_337_DATA 0x10101010 +#define DDRSS_PHY_338_DATA 0x00021010 +#define DDRSS_PHY_339_DATA 0x00100010 +#define DDRSS_PHY_340_DATA 0x00100010 +#define DDRSS_PHY_341_DATA 0x00100010 +#define DDRSS_PHY_342_DATA 0x00100010 +#define DDRSS_PHY_343_DATA 0x02020010 +#define DDRSS_PHY_344_DATA 0x51515041 +#define DDRSS_PHY_345_DATA 0x31804000 +#define DDRSS_PHY_346_DATA 0x04BF0340 +#define DDRSS_PHY_347_DATA 0x01008080 +#define DDRSS_PHY_348_DATA 0x04050001 +#define DDRSS_PHY_349_DATA 0x00000504 +#define DDRSS_PHY_350_DATA 0x42100010 +#define DDRSS_PHY_351_DATA 0x010C053E +#define DDRSS_PHY_352_DATA 0x000F0C14 +#define DDRSS_PHY_353_DATA 0x01000140 +#define DDRSS_PHY_354_DATA 0x007A0120 +#define DDRSS_PHY_355_DATA 0x00000C00 +#define DDRSS_PHY_356_DATA 0x000001CC +#define DDRSS_PHY_357_DATA 0x20100200 +#define DDRSS_PHY_358_DATA 0x00000005 +#define DDRSS_PHY_359_DATA 0x76543210 +#define DDRSS_PHY_360_DATA 0x00000008 +#define DDRSS_PHY_361_DATA 0x02800280 +#define DDRSS_PHY_362_DATA 0x02800280 +#define DDRSS_PHY_363_DATA 0x02800280 +#define DDRSS_PHY_364_DATA 0x02800280 +#define DDRSS_PHY_365_DATA 0x00000280 +#define DDRSS_PHY_366_DATA 0x00008000 +#define DDRSS_PHY_367_DATA 0x00800080 +#define DDRSS_PHY_368_DATA 0x00800080 +#define DDRSS_PHY_369_DATA 0x00800080 +#define DDRSS_PHY_370_DATA 0x00800080 +#define DDRSS_PHY_371_DATA 0x00800080 +#define DDRSS_PHY_372_DATA 0x00800080 +#define DDRSS_PHY_373_DATA 0x00800080 +#define DDRSS_PHY_374_DATA 0x00800080 +#define DDRSS_PHY_375_DATA 0x01000080 +#define DDRSS_PHY_376_DATA 0x01000000 +#define DDRSS_PHY_377_DATA 0x00000000 +#define DDRSS_PHY_378_DATA 0x00000000 +#define DDRSS_PHY_379_DATA 0x00080200 +#define DDRSS_PHY_380_DATA 0x00000000 +#define DDRSS_PHY_381_DATA 0x00000000 +#define DDRSS_PHY_382_DATA 0x00000000 +#define DDRSS_PHY_383_DATA 0x00000000 +#define DDRSS_PHY_384_DATA 0x00000000 +#define DDRSS_PHY_385_DATA 0x00000000 +#define DDRSS_PHY_386_DATA 0x00000000 +#define DDRSS_PHY_387_DATA 0x00000000 +#define DDRSS_PHY_388_DATA 0x00000000 +#define DDRSS_PHY_389_DATA 0x00000000 +#define DDRSS_PHY_390_DATA 0x00000000 +#define DDRSS_PHY_391_DATA 0x00000000 +#define DDRSS_PHY_392_DATA 0x00000000 +#define DDRSS_PHY_393_DATA 0x00000000 +#define DDRSS_PHY_394_DATA 0x00000000 +#define DDRSS_PHY_395_DATA 0x00000000 +#define DDRSS_PHY_396_DATA 0x00000000 +#define DDRSS_PHY_397_DATA 0x00000000 +#define DDRSS_PHY_398_DATA 0x00000000 +#define DDRSS_PHY_399_DATA 0x00000000 +#define DDRSS_PHY_400_DATA 0x00000000 +#define DDRSS_PHY_401_DATA 0x00000000 +#define DDRSS_PHY_402_DATA 0x00000000 +#define DDRSS_PHY_403_DATA 0x00000000 +#define DDRSS_PHY_404_DATA 0x00000000 +#define DDRSS_PHY_405_DATA 0x00000000 +#define DDRSS_PHY_406_DATA 0x00000000 +#define DDRSS_PHY_407_DATA 0x00000000 +#define DDRSS_PHY_408_DATA 0x00000000 +#define DDRSS_PHY_409_DATA 0x00000000 +#define DDRSS_PHY_410_DATA 0x00000000 +#define DDRSS_PHY_411_DATA 0x00000000 +#define DDRSS_PHY_412_DATA 0x00000000 +#define DDRSS_PHY_413_DATA 0x00000000 +#define DDRSS_PHY_414_DATA 0x00000000 +#define DDRSS_PHY_415_DATA 0x00000000 +#define DDRSS_PHY_416_DATA 0x00000000 +#define DDRSS_PHY_417_DATA 0x00000000 +#define DDRSS_PHY_418_DATA 0x00000000 +#define DDRSS_PHY_419_DATA 0x00000000 +#define DDRSS_PHY_420_DATA 0x00000000 +#define DDRSS_PHY_421_DATA 0x00000000 +#define DDRSS_PHY_422_DATA 0x00000000 +#define DDRSS_PHY_423_DATA 0x00000000 +#define DDRSS_PHY_424_DATA 0x00000000 +#define DDRSS_PHY_425_DATA 0x00000000 +#define DDRSS_PHY_426_DATA 0x00000000 +#define DDRSS_PHY_427_DATA 0x00000000 +#define DDRSS_PHY_428_DATA 0x00000000 +#define DDRSS_PHY_429_DATA 0x00000000 +#define DDRSS_PHY_430_DATA 0x00000000 +#define DDRSS_PHY_431_DATA 0x00000000 +#define DDRSS_PHY_432_DATA 0x00000000 +#define DDRSS_PHY_433_DATA 0x00000000 +#define DDRSS_PHY_434_DATA 0x00000000 +#define DDRSS_PHY_435_DATA 0x00000000 +#define DDRSS_PHY_436_DATA 0x00000000 +#define DDRSS_PHY_437_DATA 0x00000000 +#define DDRSS_PHY_438_DATA 0x00000000 +#define DDRSS_PHY_439_DATA 0x00000000 +#define DDRSS_PHY_440_DATA 0x00000000 +#define DDRSS_PHY_441_DATA 0x00000000 +#define DDRSS_PHY_442_DATA 0x00000000 +#define DDRSS_PHY_443_DATA 0x00000000 +#define DDRSS_PHY_444_DATA 0x00000000 +#define DDRSS_PHY_445_DATA 0x00000000 +#define DDRSS_PHY_446_DATA 0x00000000 +#define DDRSS_PHY_447_DATA 0x00000000 +#define DDRSS_PHY_448_DATA 0x00000000 +#define DDRSS_PHY_449_DATA 0x00000000 +#define DDRSS_PHY_450_DATA 0x00000000 +#define DDRSS_PHY_451_DATA 0x00000000 +#define DDRSS_PHY_452_DATA 0x00000000 +#define DDRSS_PHY_453_DATA 0x00000000 +#define DDRSS_PHY_454_DATA 0x00000000 +#define DDRSS_PHY_455_DATA 0x00000000 +#define DDRSS_PHY_456_DATA 0x00000000 +#define DDRSS_PHY_457_DATA 0x00000000 +#define DDRSS_PHY_458_DATA 0x00000000 +#define DDRSS_PHY_459_DATA 0x00000000 +#define DDRSS_PHY_460_DATA 0x00000000 +#define DDRSS_PHY_461_DATA 0x00000000 +#define DDRSS_PHY_462_DATA 0x00000000 +#define DDRSS_PHY_463_DATA 0x00000000 +#define DDRSS_PHY_464_DATA 0x00000000 +#define DDRSS_PHY_465_DATA 0x00000000 +#define DDRSS_PHY_466_DATA 0x00000000 +#define DDRSS_PHY_467_DATA 0x00000000 +#define DDRSS_PHY_468_DATA 0x00000000 +#define DDRSS_PHY_469_DATA 0x00000000 +#define DDRSS_PHY_470_DATA 0x00000000 +#define DDRSS_PHY_471_DATA 0x00000000 +#define DDRSS_PHY_472_DATA 0x00000000 +#define DDRSS_PHY_473_DATA 0x00000000 +#define DDRSS_PHY_474_DATA 0x00000000 +#define DDRSS_PHY_475_DATA 0x00000000 +#define DDRSS_PHY_476_DATA 0x00000000 +#define DDRSS_PHY_477_DATA 0x00000000 +#define DDRSS_PHY_478_DATA 0x00000000 +#define DDRSS_PHY_479_DATA 0x00000000 +#define DDRSS_PHY_480_DATA 0x00000000 +#define DDRSS_PHY_481_DATA 0x00000000 +#define DDRSS_PHY_482_DATA 0x00000000 +#define DDRSS_PHY_483_DATA 0x00000000 +#define DDRSS_PHY_484_DATA 0x00000000 +#define DDRSS_PHY_485_DATA 0x00000000 +#define DDRSS_PHY_486_DATA 0x00000000 +#define DDRSS_PHY_487_DATA 0x00000000 +#define DDRSS_PHY_488_DATA 0x00000000 +#define DDRSS_PHY_489_DATA 0x00000000 +#define DDRSS_PHY_490_DATA 0x00000000 +#define DDRSS_PHY_491_DATA 0x00000000 +#define DDRSS_PHY_492_DATA 0x00000000 +#define DDRSS_PHY_493_DATA 0x00000000 +#define DDRSS_PHY_494_DATA 0x00000000 +#define DDRSS_PHY_495_DATA 0x00000000 +#define DDRSS_PHY_496_DATA 0x00000000 +#define DDRSS_PHY_497_DATA 0x00000000 +#define DDRSS_PHY_498_DATA 0x00000000 +#define DDRSS_PHY_499_DATA 0x00000000 +#define DDRSS_PHY_500_DATA 0x00000000 +#define DDRSS_PHY_501_DATA 0x00000000 +#define DDRSS_PHY_502_DATA 0x00000000 +#define DDRSS_PHY_503_DATA 0x00000000 +#define DDRSS_PHY_504_DATA 0x00000000 +#define DDRSS_PHY_505_DATA 0x00000000 +#define DDRSS_PHY_506_DATA 0x00000000 +#define DDRSS_PHY_507_DATA 0x00000000 +#define DDRSS_PHY_508_DATA 0x00000000 +#define DDRSS_PHY_509_DATA 0x00000000 +#define DDRSS_PHY_510_DATA 0x00000000 +#define DDRSS_PHY_511_DATA 0x00000000 +#define DDRSS_PHY_512_DATA 0x00000100 +#define DDRSS_PHY_513_DATA 0x00000000 +#define DDRSS_PHY_514_DATA 0x00000000 +#define DDRSS_PHY_515_DATA 0x00000000 +#define DDRSS_PHY_516_DATA 0x00000000 +#define DDRSS_PHY_517_DATA 0x00000100 +#define DDRSS_PHY_518_DATA 0x00000000 +#define DDRSS_PHY_519_DATA 0x00000000 +#define DDRSS_PHY_520_DATA 0x00000000 +#define DDRSS_PHY_521_DATA 0x00000000 +#define DDRSS_PHY_522_DATA 0x00000000 +#define DDRSS_PHY_523_DATA 0x00000000 +#define DDRSS_PHY_524_DATA 0x00000000 +#define DDRSS_PHY_525_DATA 0x00DCBA98 +#define DDRSS_PHY_526_DATA 0x00000000 +#define DDRSS_PHY_527_DATA 0x00000000 +#define DDRSS_PHY_528_DATA 0x00000000 +#define DDRSS_PHY_529_DATA 0x00000000 +#define DDRSS_PHY_530_DATA 0x00000000 +#define DDRSS_PHY_531_DATA 0x00000000 +#define DDRSS_PHY_532_DATA 0x00000000 +#define DDRSS_PHY_533_DATA 0x00000000 +#define DDRSS_PHY_534_DATA 0x00000000 +#define DDRSS_PHY_535_DATA 0x00000000 +#define DDRSS_PHY_536_DATA 0x00000000 +#define DDRSS_PHY_537_DATA 0x00000000 +#define DDRSS_PHY_538_DATA 0x00000000 +#define DDRSS_PHY_539_DATA 0x00000000 +#define DDRSS_PHY_540_DATA 0x0A418820 +#define DDRSS_PHY_541_DATA 0x103F0000 +#define DDRSS_PHY_542_DATA 0x000F0100 +#define DDRSS_PHY_543_DATA 0x0000000F +#define DDRSS_PHY_544_DATA 0x020002CC +#define DDRSS_PHY_545_DATA 0x00030000 +#define DDRSS_PHY_546_DATA 0x00000300 +#define DDRSS_PHY_547_DATA 0x00000300 +#define DDRSS_PHY_548_DATA 0x00000300 +#define DDRSS_PHY_549_DATA 0x00000300 +#define DDRSS_PHY_550_DATA 0x00000300 +#define DDRSS_PHY_551_DATA 0x42080010 +#define DDRSS_PHY_552_DATA 0x0000003E +#define DDRSS_PHY_553_DATA 0x00000000 +#define DDRSS_PHY_554_DATA 0x00000000 +#define DDRSS_PHY_555_DATA 0x00000000 +#define DDRSS_PHY_556_DATA 0x00000000 +#define DDRSS_PHY_557_DATA 0x00000000 +#define DDRSS_PHY_558_DATA 0x00000000 +#define DDRSS_PHY_559_DATA 0x00000000 +#define DDRSS_PHY_560_DATA 0x00000000 +#define DDRSS_PHY_561_DATA 0x00000000 +#define DDRSS_PHY_562_DATA 0x00000000 +#define DDRSS_PHY_563_DATA 0x00000000 +#define DDRSS_PHY_564_DATA 0x00000000 +#define DDRSS_PHY_565_DATA 0x00000000 +#define DDRSS_PHY_566_DATA 0x00000000 +#define DDRSS_PHY_567_DATA 0x00000000 +#define DDRSS_PHY_568_DATA 0x00000000 +#define DDRSS_PHY_569_DATA 0x00000000 +#define DDRSS_PHY_570_DATA 0x00000000 +#define DDRSS_PHY_571_DATA 0x00000000 +#define DDRSS_PHY_572_DATA 0x00000000 +#define DDRSS_PHY_573_DATA 0x00000000 +#define DDRSS_PHY_574_DATA 0x00000000 +#define DDRSS_PHY_575_DATA 0x00000000 +#define DDRSS_PHY_576_DATA 0x00000000 +#define DDRSS_PHY_577_DATA 0x00000000 +#define DDRSS_PHY_578_DATA 0x00000000 +#define DDRSS_PHY_579_DATA 0x00000000 +#define DDRSS_PHY_580_DATA 0x00000000 +#define DDRSS_PHY_581_DATA 0x00000000 +#define DDRSS_PHY_582_DATA 0x00000000 +#define DDRSS_PHY_583_DATA 0x00000000 +#define DDRSS_PHY_584_DATA 0x00000000 +#define DDRSS_PHY_585_DATA 0x00000000 +#define DDRSS_PHY_586_DATA 0x00000000 +#define DDRSS_PHY_587_DATA 0x00000000 +#define DDRSS_PHY_588_DATA 0x00000000 +#define DDRSS_PHY_589_DATA 0x00000000 +#define DDRSS_PHY_590_DATA 0x00000000 +#define DDRSS_PHY_591_DATA 0x00000000 +#define DDRSS_PHY_592_DATA 0x00000000 +#define DDRSS_PHY_593_DATA 0x00000000 +#define DDRSS_PHY_594_DATA 0x00000000 +#define DDRSS_PHY_595_DATA 0x00000000 +#define DDRSS_PHY_596_DATA 0x00000000 +#define DDRSS_PHY_597_DATA 0x00000000 +#define DDRSS_PHY_598_DATA 0x00000000 +#define DDRSS_PHY_599_DATA 0x00000000 +#define DDRSS_PHY_600_DATA 0x00000000 +#define DDRSS_PHY_601_DATA 0x00000000 +#define DDRSS_PHY_602_DATA 0x00000000 +#define DDRSS_PHY_603_DATA 0x00000000 +#define DDRSS_PHY_604_DATA 0x00000000 +#define DDRSS_PHY_605_DATA 0x00000000 +#define DDRSS_PHY_606_DATA 0x00000000 +#define DDRSS_PHY_607_DATA 0x00000000 +#define DDRSS_PHY_608_DATA 0x00000000 +#define DDRSS_PHY_609_DATA 0x00000000 +#define DDRSS_PHY_610_DATA 0x00000000 +#define DDRSS_PHY_611_DATA 0x00000000 +#define DDRSS_PHY_612_DATA 0x00000000 +#define DDRSS_PHY_613_DATA 0x00000000 +#define DDRSS_PHY_614_DATA 0x00000000 +#define DDRSS_PHY_615_DATA 0x00000000 +#define DDRSS_PHY_616_DATA 0x00000000 +#define DDRSS_PHY_617_DATA 0x00000000 +#define DDRSS_PHY_618_DATA 0x00000000 +#define DDRSS_PHY_619_DATA 0x00000000 +#define DDRSS_PHY_620_DATA 0x00000000 +#define DDRSS_PHY_621_DATA 0x00000000 +#define DDRSS_PHY_622_DATA 0x00000000 +#define DDRSS_PHY_623_DATA 0x00000000 +#define DDRSS_PHY_624_DATA 0x00000000 +#define DDRSS_PHY_625_DATA 0x00000000 +#define DDRSS_PHY_626_DATA 0x00000000 +#define DDRSS_PHY_627_DATA 0x00000000 +#define DDRSS_PHY_628_DATA 0x00000000 +#define DDRSS_PHY_629_DATA 0x00000000 +#define DDRSS_PHY_630_DATA 0x00000000 +#define DDRSS_PHY_631_DATA 0x00000000 +#define DDRSS_PHY_632_DATA 0x00000000 +#define DDRSS_PHY_633_DATA 0x00000000 +#define DDRSS_PHY_634_DATA 0x00000000 +#define DDRSS_PHY_635_DATA 0x00000000 +#define DDRSS_PHY_636_DATA 0x00000000 +#define DDRSS_PHY_637_DATA 0x00000000 +#define DDRSS_PHY_638_DATA 0x00000000 +#define DDRSS_PHY_639_DATA 0x00000000 +#define DDRSS_PHY_640_DATA 0x00000000 +#define DDRSS_PHY_641_DATA 0x00000000 +#define DDRSS_PHY_642_DATA 0x00000000 +#define DDRSS_PHY_643_DATA 0x00000000 +#define DDRSS_PHY_644_DATA 0x00000000 +#define DDRSS_PHY_645_DATA 0x00000000 +#define DDRSS_PHY_646_DATA 0x00000000 +#define DDRSS_PHY_647_DATA 0x00000000 +#define DDRSS_PHY_648_DATA 0x00000000 +#define DDRSS_PHY_649_DATA 0x00000000 +#define DDRSS_PHY_650_DATA 0x00000000 +#define DDRSS_PHY_651_DATA 0x00000000 +#define DDRSS_PHY_652_DATA 0x00000000 +#define DDRSS_PHY_653_DATA 0x00000000 +#define DDRSS_PHY_654_DATA 0x00000000 +#define DDRSS_PHY_655_DATA 0x00000000 +#define DDRSS_PHY_656_DATA 0x00000000 +#define DDRSS_PHY_657_DATA 0x00000000 +#define DDRSS_PHY_658_DATA 0x00000000 +#define DDRSS_PHY_659_DATA 0x00000000 +#define DDRSS_PHY_660_DATA 0x00000000 +#define DDRSS_PHY_661_DATA 0x00000000 +#define DDRSS_PHY_662_DATA 0x00000000 +#define DDRSS_PHY_663_DATA 0x00000000 +#define DDRSS_PHY_664_DATA 0x00000000 +#define DDRSS_PHY_665_DATA 0x00000000 +#define DDRSS_PHY_666_DATA 0x00000000 +#define DDRSS_PHY_667_DATA 0x00000000 +#define DDRSS_PHY_668_DATA 0x00000000 +#define DDRSS_PHY_669_DATA 0x00000000 +#define DDRSS_PHY_670_DATA 0x00000000 +#define DDRSS_PHY_671_DATA 0x00000000 +#define DDRSS_PHY_672_DATA 0x00000000 +#define DDRSS_PHY_673_DATA 0x00000000 +#define DDRSS_PHY_674_DATA 0x00000000 +#define DDRSS_PHY_675_DATA 0x00000000 +#define DDRSS_PHY_676_DATA 0x00000000 +#define DDRSS_PHY_677_DATA 0x00000000 +#define DDRSS_PHY_678_DATA 0x00000000 +#define DDRSS_PHY_679_DATA 0x00000000 +#define DDRSS_PHY_680_DATA 0x00000000 +#define DDRSS_PHY_681_DATA 0x00000000 +#define DDRSS_PHY_682_DATA 0x00000000 +#define DDRSS_PHY_683_DATA 0x00000000 +#define DDRSS_PHY_684_DATA 0x00000000 +#define DDRSS_PHY_685_DATA 0x00000000 +#define DDRSS_PHY_686_DATA 0x00000000 +#define DDRSS_PHY_687_DATA 0x00000000 +#define DDRSS_PHY_688_DATA 0x00000000 +#define DDRSS_PHY_689_DATA 0x00000000 +#define DDRSS_PHY_690_DATA 0x00000000 +#define DDRSS_PHY_691_DATA 0x00000000 +#define DDRSS_PHY_692_DATA 0x00000000 +#define DDRSS_PHY_693_DATA 0x00000000 +#define DDRSS_PHY_694_DATA 0x00000000 +#define DDRSS_PHY_695_DATA 0x00000000 +#define DDRSS_PHY_696_DATA 0x00000000 +#define DDRSS_PHY_697_DATA 0x00000000 +#define DDRSS_PHY_698_DATA 0x00000000 +#define DDRSS_PHY_699_DATA 0x00000000 +#define DDRSS_PHY_700_DATA 0x00000000 +#define DDRSS_PHY_701_DATA 0x00000000 +#define DDRSS_PHY_702_DATA 0x00000000 +#define DDRSS_PHY_703_DATA 0x00000000 +#define DDRSS_PHY_704_DATA 0x00000000 +#define DDRSS_PHY_705_DATA 0x00000000 +#define DDRSS_PHY_706_DATA 0x00000000 +#define DDRSS_PHY_707_DATA 0x00000000 +#define DDRSS_PHY_708_DATA 0x00000000 +#define DDRSS_PHY_709_DATA 0x00000000 +#define DDRSS_PHY_710_DATA 0x00000000 +#define DDRSS_PHY_711_DATA 0x00000000 +#define DDRSS_PHY_712_DATA 0x00000000 +#define DDRSS_PHY_713_DATA 0x00000000 +#define DDRSS_PHY_714_DATA 0x00000000 +#define DDRSS_PHY_715_DATA 0x00000000 +#define DDRSS_PHY_716_DATA 0x00000000 +#define DDRSS_PHY_717_DATA 0x00000000 +#define DDRSS_PHY_718_DATA 0x00000000 +#define DDRSS_PHY_719_DATA 0x00000000 +#define DDRSS_PHY_720_DATA 0x00000000 +#define DDRSS_PHY_721_DATA 0x00000000 +#define DDRSS_PHY_722_DATA 0x00000000 +#define DDRSS_PHY_723_DATA 0x00000000 +#define DDRSS_PHY_724_DATA 0x00000000 +#define DDRSS_PHY_725_DATA 0x00000000 +#define DDRSS_PHY_726_DATA 0x00000000 +#define DDRSS_PHY_727_DATA 0x00000000 +#define DDRSS_PHY_728_DATA 0x00000000 +#define DDRSS_PHY_729_DATA 0x00000000 +#define DDRSS_PHY_730_DATA 0x00000000 +#define DDRSS_PHY_731_DATA 0x00000000 +#define DDRSS_PHY_732_DATA 0x00000000 +#define DDRSS_PHY_733_DATA 0x00000000 +#define DDRSS_PHY_734_DATA 0x00000000 +#define DDRSS_PHY_735_DATA 0x00000000 +#define DDRSS_PHY_736_DATA 0x00000000 +#define DDRSS_PHY_737_DATA 0x00000000 +#define DDRSS_PHY_738_DATA 0x00000000 +#define DDRSS_PHY_739_DATA 0x00000000 +#define DDRSS_PHY_740_DATA 0x00000000 +#define DDRSS_PHY_741_DATA 0x00000000 +#define DDRSS_PHY_742_DATA 0x00000000 +#define DDRSS_PHY_743_DATA 0x00000000 +#define DDRSS_PHY_744_DATA 0x00000000 +#define DDRSS_PHY_745_DATA 0x00000000 +#define DDRSS_PHY_746_DATA 0x00000000 +#define DDRSS_PHY_747_DATA 0x00000000 +#define DDRSS_PHY_748_DATA 0x00000000 +#define DDRSS_PHY_749_DATA 0x00000000 +#define DDRSS_PHY_750_DATA 0x00000000 +#define DDRSS_PHY_751_DATA 0x00000000 +#define DDRSS_PHY_752_DATA 0x00000000 +#define DDRSS_PHY_753_DATA 0x00000000 +#define DDRSS_PHY_754_DATA 0x00000000 +#define DDRSS_PHY_755_DATA 0x00000000 +#define DDRSS_PHY_756_DATA 0x00000000 +#define DDRSS_PHY_757_DATA 0x00000000 +#define DDRSS_PHY_758_DATA 0x00000000 +#define DDRSS_PHY_759_DATA 0x00000000 +#define DDRSS_PHY_760_DATA 0x00000000 +#define DDRSS_PHY_761_DATA 0x00000000 +#define DDRSS_PHY_762_DATA 0x00000000 +#define DDRSS_PHY_763_DATA 0x00000000 +#define DDRSS_PHY_764_DATA 0x00000000 +#define DDRSS_PHY_765_DATA 0x00000000 +#define DDRSS_PHY_766_DATA 0x00000000 +#define DDRSS_PHY_767_DATA 0x00000000 +#define DDRSS_PHY_768_DATA 0x00000100 +#define DDRSS_PHY_769_DATA 0x00000000 +#define DDRSS_PHY_770_DATA 0x00000000 +#define DDRSS_PHY_771_DATA 0x00000000 +#define DDRSS_PHY_772_DATA 0x00000000 +#define DDRSS_PHY_773_DATA 0x00000100 +#define DDRSS_PHY_774_DATA 0x00000000 +#define DDRSS_PHY_775_DATA 0x00000000 +#define DDRSS_PHY_776_DATA 0x00000000 +#define DDRSS_PHY_777_DATA 0x00000000 +#define DDRSS_PHY_778_DATA 0x00000000 +#define DDRSS_PHY_779_DATA 0x00000000 +#define DDRSS_PHY_780_DATA 0x00000000 +#define DDRSS_PHY_781_DATA 0x00DCBA98 +#define DDRSS_PHY_782_DATA 0x00000000 +#define DDRSS_PHY_783_DATA 0x00000000 +#define DDRSS_PHY_784_DATA 0x00000000 +#define DDRSS_PHY_785_DATA 0x00000000 +#define DDRSS_PHY_786_DATA 0x00000000 +#define DDRSS_PHY_787_DATA 0x00000000 +#define DDRSS_PHY_788_DATA 0x00000000 +#define DDRSS_PHY_789_DATA 0x00000000 +#define DDRSS_PHY_790_DATA 0x00000000 +#define DDRSS_PHY_791_DATA 0x00000000 +#define DDRSS_PHY_792_DATA 0x00000000 +#define DDRSS_PHY_793_DATA 0x00000000 +#define DDRSS_PHY_794_DATA 0x00000000 +#define DDRSS_PHY_795_DATA 0x00000000 +#define DDRSS_PHY_796_DATA 0x16A4A0E6 +#define DDRSS_PHY_797_DATA 0x103F0000 +#define DDRSS_PHY_798_DATA 0x000F0000 +#define DDRSS_PHY_799_DATA 0x0000000F +#define DDRSS_PHY_800_DATA 0x020002CC +#define DDRSS_PHY_801_DATA 0x00030000 +#define DDRSS_PHY_802_DATA 0x00000300 +#define DDRSS_PHY_803_DATA 0x00000300 +#define DDRSS_PHY_804_DATA 0x00000300 +#define DDRSS_PHY_805_DATA 0x00000300 +#define DDRSS_PHY_806_DATA 0x00000300 +#define DDRSS_PHY_807_DATA 0x42080010 +#define DDRSS_PHY_808_DATA 0x0000003E +#define DDRSS_PHY_809_DATA 0x00000000 +#define DDRSS_PHY_810_DATA 0x00000000 +#define DDRSS_PHY_811_DATA 0x00000000 +#define DDRSS_PHY_812_DATA 0x00000000 +#define DDRSS_PHY_813_DATA 0x00000000 +#define DDRSS_PHY_814_DATA 0x00000000 +#define DDRSS_PHY_815_DATA 0x00000000 +#define DDRSS_PHY_816_DATA 0x00000000 +#define DDRSS_PHY_817_DATA 0x00000000 +#define DDRSS_PHY_818_DATA 0x00000000 +#define DDRSS_PHY_819_DATA 0x00000000 +#define DDRSS_PHY_820_DATA 0x00000000 +#define DDRSS_PHY_821_DATA 0x00000000 +#define DDRSS_PHY_822_DATA 0x00000000 +#define DDRSS_PHY_823_DATA 0x00000000 +#define DDRSS_PHY_824_DATA 0x00000000 +#define DDRSS_PHY_825_DATA 0x00000000 +#define DDRSS_PHY_826_DATA 0x00000000 +#define DDRSS_PHY_827_DATA 0x00000000 +#define DDRSS_PHY_828_DATA 0x00000000 +#define DDRSS_PHY_829_DATA 0x00000000 +#define DDRSS_PHY_830_DATA 0x00000000 +#define DDRSS_PHY_831_DATA 0x00000000 +#define DDRSS_PHY_832_DATA 0x00000000 +#define DDRSS_PHY_833_DATA 0x00000000 +#define DDRSS_PHY_834_DATA 0x00000000 +#define DDRSS_PHY_835_DATA 0x00000000 +#define DDRSS_PHY_836_DATA 0x00000000 +#define DDRSS_PHY_837_DATA 0x00000000 +#define DDRSS_PHY_838_DATA 0x00000000 +#define DDRSS_PHY_839_DATA 0x00000000 +#define DDRSS_PHY_840_DATA 0x00000000 +#define DDRSS_PHY_841_DATA 0x00000000 +#define DDRSS_PHY_842_DATA 0x00000000 +#define DDRSS_PHY_843_DATA 0x00000000 +#define DDRSS_PHY_844_DATA 0x00000000 +#define DDRSS_PHY_845_DATA 0x00000000 +#define DDRSS_PHY_846_DATA 0x00000000 +#define DDRSS_PHY_847_DATA 0x00000000 +#define DDRSS_PHY_848_DATA 0x00000000 +#define DDRSS_PHY_849_DATA 0x00000000 +#define DDRSS_PHY_850_DATA 0x00000000 +#define DDRSS_PHY_851_DATA 0x00000000 +#define DDRSS_PHY_852_DATA 0x00000000 +#define DDRSS_PHY_853_DATA 0x00000000 +#define DDRSS_PHY_854_DATA 0x00000000 +#define DDRSS_PHY_855_DATA 0x00000000 +#define DDRSS_PHY_856_DATA 0x00000000 +#define DDRSS_PHY_857_DATA 0x00000000 +#define DDRSS_PHY_858_DATA 0x00000000 +#define DDRSS_PHY_859_DATA 0x00000000 +#define DDRSS_PHY_860_DATA 0x00000000 +#define DDRSS_PHY_861_DATA 0x00000000 +#define DDRSS_PHY_862_DATA 0x00000000 +#define DDRSS_PHY_863_DATA 0x00000000 +#define DDRSS_PHY_864_DATA 0x00000000 +#define DDRSS_PHY_865_DATA 0x00000000 +#define DDRSS_PHY_866_DATA 0x00000000 +#define DDRSS_PHY_867_DATA 0x00000000 +#define DDRSS_PHY_868_DATA 0x00000000 +#define DDRSS_PHY_869_DATA 0x00000000 +#define DDRSS_PHY_870_DATA 0x00000000 +#define DDRSS_PHY_871_DATA 0x00000000 +#define DDRSS_PHY_872_DATA 0x00000000 +#define DDRSS_PHY_873_DATA 0x00000000 +#define DDRSS_PHY_874_DATA 0x00000000 +#define DDRSS_PHY_875_DATA 0x00000000 +#define DDRSS_PHY_876_DATA 0x00000000 +#define DDRSS_PHY_877_DATA 0x00000000 +#define DDRSS_PHY_878_DATA 0x00000000 +#define DDRSS_PHY_879_DATA 0x00000000 +#define DDRSS_PHY_880_DATA 0x00000000 +#define DDRSS_PHY_881_DATA 0x00000000 +#define DDRSS_PHY_882_DATA 0x00000000 +#define DDRSS_PHY_883_DATA 0x00000000 +#define DDRSS_PHY_884_DATA 0x00000000 +#define DDRSS_PHY_885_DATA 0x00000000 +#define DDRSS_PHY_886_DATA 0x00000000 +#define DDRSS_PHY_887_DATA 0x00000000 +#define DDRSS_PHY_888_DATA 0x00000000 +#define DDRSS_PHY_889_DATA 0x00000000 +#define DDRSS_PHY_890_DATA 0x00000000 +#define DDRSS_PHY_891_DATA 0x00000000 +#define DDRSS_PHY_892_DATA 0x00000000 +#define DDRSS_PHY_893_DATA 0x00000000 +#define DDRSS_PHY_894_DATA 0x00000000 +#define DDRSS_PHY_895_DATA 0x00000000 +#define DDRSS_PHY_896_DATA 0x00000000 +#define DDRSS_PHY_897_DATA 0x00000000 +#define DDRSS_PHY_898_DATA 0x00000000 +#define DDRSS_PHY_899_DATA 0x00000000 +#define DDRSS_PHY_900_DATA 0x00000000 +#define DDRSS_PHY_901_DATA 0x00000000 +#define DDRSS_PHY_902_DATA 0x00000000 +#define DDRSS_PHY_903_DATA 0x00000000 +#define DDRSS_PHY_904_DATA 0x00000000 +#define DDRSS_PHY_905_DATA 0x00000000 +#define DDRSS_PHY_906_DATA 0x00000000 +#define DDRSS_PHY_907_DATA 0x00000000 +#define DDRSS_PHY_908_DATA 0x00000000 +#define DDRSS_PHY_909_DATA 0x00000000 +#define DDRSS_PHY_910_DATA 0x00000000 +#define DDRSS_PHY_911_DATA 0x00000000 +#define DDRSS_PHY_912_DATA 0x00000000 +#define DDRSS_PHY_913_DATA 0x00000000 +#define DDRSS_PHY_914_DATA 0x00000000 +#define DDRSS_PHY_915_DATA 0x00000000 +#define DDRSS_PHY_916_DATA 0x00000000 +#define DDRSS_PHY_917_DATA 0x00000000 +#define DDRSS_PHY_918_DATA 0x00000000 +#define DDRSS_PHY_919_DATA 0x00000000 +#define DDRSS_PHY_920_DATA 0x00000000 +#define DDRSS_PHY_921_DATA 0x00000000 +#define DDRSS_PHY_922_DATA 0x00000000 +#define DDRSS_PHY_923_DATA 0x00000000 +#define DDRSS_PHY_924_DATA 0x00000000 +#define DDRSS_PHY_925_DATA 0x00000000 +#define DDRSS_PHY_926_DATA 0x00000000 +#define DDRSS_PHY_927_DATA 0x00000000 +#define DDRSS_PHY_928_DATA 0x00000000 +#define DDRSS_PHY_929_DATA 0x00000000 +#define DDRSS_PHY_930_DATA 0x00000000 +#define DDRSS_PHY_931_DATA 0x00000000 +#define DDRSS_PHY_932_DATA 0x00000000 +#define DDRSS_PHY_933_DATA 0x00000000 +#define DDRSS_PHY_934_DATA 0x00000000 +#define DDRSS_PHY_935_DATA 0x00000000 +#define DDRSS_PHY_936_DATA 0x00000000 +#define DDRSS_PHY_937_DATA 0x00000000 +#define DDRSS_PHY_938_DATA 0x00000000 +#define DDRSS_PHY_939_DATA 0x00000000 +#define DDRSS_PHY_940_DATA 0x00000000 +#define DDRSS_PHY_941_DATA 0x00000000 +#define DDRSS_PHY_942_DATA 0x00000000 +#define DDRSS_PHY_943_DATA 0x00000000 +#define DDRSS_PHY_944_DATA 0x00000000 +#define DDRSS_PHY_945_DATA 0x00000000 +#define DDRSS_PHY_946_DATA 0x00000000 +#define DDRSS_PHY_947_DATA 0x00000000 +#define DDRSS_PHY_948_DATA 0x00000000 +#define DDRSS_PHY_949_DATA 0x00000000 +#define DDRSS_PHY_950_DATA 0x00000000 +#define DDRSS_PHY_951_DATA 0x00000000 +#define DDRSS_PHY_952_DATA 0x00000000 +#define DDRSS_PHY_953_DATA 0x00000000 +#define DDRSS_PHY_954_DATA 0x00000000 +#define DDRSS_PHY_955_DATA 0x00000000 +#define DDRSS_PHY_956_DATA 0x00000000 +#define DDRSS_PHY_957_DATA 0x00000000 +#define DDRSS_PHY_958_DATA 0x00000000 +#define DDRSS_PHY_959_DATA 0x00000000 +#define DDRSS_PHY_960_DATA 0x00000000 +#define DDRSS_PHY_961_DATA 0x00000000 +#define DDRSS_PHY_962_DATA 0x00000000 +#define DDRSS_PHY_963_DATA 0x00000000 +#define DDRSS_PHY_964_DATA 0x00000000 +#define DDRSS_PHY_965_DATA 0x00000000 +#define DDRSS_PHY_966_DATA 0x00000000 +#define DDRSS_PHY_967_DATA 0x00000000 +#define DDRSS_PHY_968_DATA 0x00000000 +#define DDRSS_PHY_969_DATA 0x00000000 +#define DDRSS_PHY_970_DATA 0x00000000 +#define DDRSS_PHY_971_DATA 0x00000000 +#define DDRSS_PHY_972_DATA 0x00000000 +#define DDRSS_PHY_973_DATA 0x00000000 +#define DDRSS_PHY_974_DATA 0x00000000 +#define DDRSS_PHY_975_DATA 0x00000000 +#define DDRSS_PHY_976_DATA 0x00000000 +#define DDRSS_PHY_977_DATA 0x00000000 +#define DDRSS_PHY_978_DATA 0x00000000 +#define DDRSS_PHY_979_DATA 0x00000000 +#define DDRSS_PHY_980_DATA 0x00000000 +#define DDRSS_PHY_981_DATA 0x00000000 +#define DDRSS_PHY_982_DATA 0x00000000 +#define DDRSS_PHY_983_DATA 0x00000000 +#define DDRSS_PHY_984_DATA 0x00000000 +#define DDRSS_PHY_985_DATA 0x00000000 +#define DDRSS_PHY_986_DATA 0x00000000 +#define DDRSS_PHY_987_DATA 0x00000000 +#define DDRSS_PHY_988_DATA 0x00000000 +#define DDRSS_PHY_989_DATA 0x00000000 +#define DDRSS_PHY_990_DATA 0x00000000 +#define DDRSS_PHY_991_DATA 0x00000000 +#define DDRSS_PHY_992_DATA 0x00000000 +#define DDRSS_PHY_993_DATA 0x00000000 +#define DDRSS_PHY_994_DATA 0x00000000 +#define DDRSS_PHY_995_DATA 0x00000000 +#define DDRSS_PHY_996_DATA 0x00000000 +#define DDRSS_PHY_997_DATA 0x00000000 +#define DDRSS_PHY_998_DATA 0x00000000 +#define DDRSS_PHY_999_DATA 0x00000000 +#define DDRSS_PHY_1000_DATA 0x00000000 +#define DDRSS_PHY_1001_DATA 0x00000000 +#define DDRSS_PHY_1002_DATA 0x00000000 +#define DDRSS_PHY_1003_DATA 0x00000000 +#define DDRSS_PHY_1004_DATA 0x00000000 +#define DDRSS_PHY_1005_DATA 0x00000000 +#define DDRSS_PHY_1006_DATA 0x00000000 +#define DDRSS_PHY_1007_DATA 0x00000000 +#define DDRSS_PHY_1008_DATA 0x00000000 +#define DDRSS_PHY_1009_DATA 0x00000000 +#define DDRSS_PHY_1010_DATA 0x00000000 +#define DDRSS_PHY_1011_DATA 0x00000000 +#define DDRSS_PHY_1012_DATA 0x00000000 +#define DDRSS_PHY_1013_DATA 0x00000000 +#define DDRSS_PHY_1014_DATA 0x00000000 +#define DDRSS_PHY_1015_DATA 0x00000000 +#define DDRSS_PHY_1016_DATA 0x00000000 +#define DDRSS_PHY_1017_DATA 0x00000000 +#define DDRSS_PHY_1018_DATA 0x00000000 +#define DDRSS_PHY_1019_DATA 0x00000000 +#define DDRSS_PHY_1020_DATA 0x00000000 +#define DDRSS_PHY_1021_DATA 0x00000000 +#define DDRSS_PHY_1022_DATA 0x00000000 +#define DDRSS_PHY_1023_DATA 0x00000000 +#define DDRSS_PHY_1024_DATA 0x00000100 +#define DDRSS_PHY_1025_DATA 0x00000000 +#define DDRSS_PHY_1026_DATA 0x00000000 +#define DDRSS_PHY_1027_DATA 0x00000000 +#define DDRSS_PHY_1028_DATA 0x00000000 +#define DDRSS_PHY_1029_DATA 0x00000100 +#define DDRSS_PHY_1030_DATA 0x00000000 +#define DDRSS_PHY_1031_DATA 0x00000000 +#define DDRSS_PHY_1032_DATA 0x00000000 +#define DDRSS_PHY_1033_DATA 0x00000000 +#define DDRSS_PHY_1034_DATA 0x00000000 +#define DDRSS_PHY_1035_DATA 0x00000000 +#define DDRSS_PHY_1036_DATA 0x00000000 +#define DDRSS_PHY_1037_DATA 0x00DCBA98 +#define DDRSS_PHY_1038_DATA 0x00000000 +#define DDRSS_PHY_1039_DATA 0x00000000 +#define DDRSS_PHY_1040_DATA 0x00000000 +#define DDRSS_PHY_1041_DATA 0x00000000 +#define DDRSS_PHY_1042_DATA 0x00000000 +#define DDRSS_PHY_1043_DATA 0x00000000 +#define DDRSS_PHY_1044_DATA 0x00000000 +#define DDRSS_PHY_1045_DATA 0x00000000 +#define DDRSS_PHY_1046_DATA 0x00000000 +#define DDRSS_PHY_1047_DATA 0x00000000 +#define DDRSS_PHY_1048_DATA 0x00000000 +#define DDRSS_PHY_1049_DATA 0x00000000 +#define DDRSS_PHY_1050_DATA 0x00000000 +#define DDRSS_PHY_1051_DATA 0x00000000 +#define DDRSS_PHY_1052_DATA 0x2307B9AC +#define DDRSS_PHY_1053_DATA 0x10030000 +#define DDRSS_PHY_1054_DATA 0x000F0000 +#define DDRSS_PHY_1055_DATA 0x0000000F +#define DDRSS_PHY_1056_DATA 0x020002CC +#define DDRSS_PHY_1057_DATA 0x00030000 +#define DDRSS_PHY_1058_DATA 0x00000300 +#define DDRSS_PHY_1059_DATA 0x00000300 +#define DDRSS_PHY_1060_DATA 0x00000300 +#define DDRSS_PHY_1061_DATA 0x00000300 +#define DDRSS_PHY_1062_DATA 0x00000300 +#define DDRSS_PHY_1063_DATA 0x42080010 +#define DDRSS_PHY_1064_DATA 0x0000003E +#define DDRSS_PHY_1065_DATA 0x00000000 +#define DDRSS_PHY_1066_DATA 0x00000000 +#define DDRSS_PHY_1067_DATA 0x00000000 +#define DDRSS_PHY_1068_DATA 0x00000000 +#define DDRSS_PHY_1069_DATA 0x00000000 +#define DDRSS_PHY_1070_DATA 0x00000000 +#define DDRSS_PHY_1071_DATA 0x00000000 +#define DDRSS_PHY_1072_DATA 0x00000000 +#define DDRSS_PHY_1073_DATA 0x00000000 +#define DDRSS_PHY_1074_DATA 0x00000000 +#define DDRSS_PHY_1075_DATA 0x00000000 +#define DDRSS_PHY_1076_DATA 0x00000000 +#define DDRSS_PHY_1077_DATA 0x00000000 +#define DDRSS_PHY_1078_DATA 0x00000000 +#define DDRSS_PHY_1079_DATA 0x00000000 +#define DDRSS_PHY_1080_DATA 0x00000000 +#define DDRSS_PHY_1081_DATA 0x00000000 +#define DDRSS_PHY_1082_DATA 0x00000000 +#define DDRSS_PHY_1083_DATA 0x00000000 +#define DDRSS_PHY_1084_DATA 0x00000000 +#define DDRSS_PHY_1085_DATA 0x00000000 +#define DDRSS_PHY_1086_DATA 0x00000000 +#define DDRSS_PHY_1087_DATA 0x00000000 +#define DDRSS_PHY_1088_DATA 0x00000000 +#define DDRSS_PHY_1089_DATA 0x00000000 +#define DDRSS_PHY_1090_DATA 0x00000000 +#define DDRSS_PHY_1091_DATA 0x00000000 +#define DDRSS_PHY_1092_DATA 0x00000000 +#define DDRSS_PHY_1093_DATA 0x00000000 +#define DDRSS_PHY_1094_DATA 0x00000000 +#define DDRSS_PHY_1095_DATA 0x00000000 +#define DDRSS_PHY_1096_DATA 0x00000000 +#define DDRSS_PHY_1097_DATA 0x00000000 +#define DDRSS_PHY_1098_DATA 0x00000000 +#define DDRSS_PHY_1099_DATA 0x00000000 +#define DDRSS_PHY_1100_DATA 0x00000000 +#define DDRSS_PHY_1101_DATA 0x00000000 +#define DDRSS_PHY_1102_DATA 0x00000000 +#define DDRSS_PHY_1103_DATA 0x00000000 +#define DDRSS_PHY_1104_DATA 0x00000000 +#define DDRSS_PHY_1105_DATA 0x00000000 +#define DDRSS_PHY_1106_DATA 0x00000000 +#define DDRSS_PHY_1107_DATA 0x00000000 +#define DDRSS_PHY_1108_DATA 0x00000000 +#define DDRSS_PHY_1109_DATA 0x00000000 +#define DDRSS_PHY_1110_DATA 0x00000000 +#define DDRSS_PHY_1111_DATA 0x00000000 +#define DDRSS_PHY_1112_DATA 0x00000000 +#define DDRSS_PHY_1113_DATA 0x00000000 +#define DDRSS_PHY_1114_DATA 0x00000000 +#define DDRSS_PHY_1115_DATA 0x00000000 +#define DDRSS_PHY_1116_DATA 0x00000000 +#define DDRSS_PHY_1117_DATA 0x00000000 +#define DDRSS_PHY_1118_DATA 0x00000000 +#define DDRSS_PHY_1119_DATA 0x00000000 +#define DDRSS_PHY_1120_DATA 0x00000000 +#define DDRSS_PHY_1121_DATA 0x00000000 +#define DDRSS_PHY_1122_DATA 0x00000000 +#define DDRSS_PHY_1123_DATA 0x00000000 +#define DDRSS_PHY_1124_DATA 0x00000000 +#define DDRSS_PHY_1125_DATA 0x00000000 +#define DDRSS_PHY_1126_DATA 0x00000000 +#define DDRSS_PHY_1127_DATA 0x00000000 +#define DDRSS_PHY_1128_DATA 0x00000000 +#define DDRSS_PHY_1129_DATA 0x00000000 +#define DDRSS_PHY_1130_DATA 0x00000000 +#define DDRSS_PHY_1131_DATA 0x00000000 +#define DDRSS_PHY_1132_DATA 0x00000000 +#define DDRSS_PHY_1133_DATA 0x00000000 +#define DDRSS_PHY_1134_DATA 0x00000000 +#define DDRSS_PHY_1135_DATA 0x00000000 +#define DDRSS_PHY_1136_DATA 0x00000000 +#define DDRSS_PHY_1137_DATA 0x00000000 +#define DDRSS_PHY_1138_DATA 0x00000000 +#define DDRSS_PHY_1139_DATA 0x00000000 +#define DDRSS_PHY_1140_DATA 0x00000000 +#define DDRSS_PHY_1141_DATA 0x00000000 +#define DDRSS_PHY_1142_DATA 0x00000000 +#define DDRSS_PHY_1143_DATA 0x00000000 +#define DDRSS_PHY_1144_DATA 0x00000000 +#define DDRSS_PHY_1145_DATA 0x00000000 +#define DDRSS_PHY_1146_DATA 0x00000000 +#define DDRSS_PHY_1147_DATA 0x00000000 +#define DDRSS_PHY_1148_DATA 0x00000000 +#define DDRSS_PHY_1149_DATA 0x00000000 +#define DDRSS_PHY_1150_DATA 0x00000000 +#define DDRSS_PHY_1151_DATA 0x00000000 +#define DDRSS_PHY_1152_DATA 0x00000000 +#define DDRSS_PHY_1153_DATA 0x00000000 +#define DDRSS_PHY_1154_DATA 0x00000000 +#define DDRSS_PHY_1155_DATA 0x00000000 +#define DDRSS_PHY_1156_DATA 0x00000000 +#define DDRSS_PHY_1157_DATA 0x00000000 +#define DDRSS_PHY_1158_DATA 0x00000000 +#define DDRSS_PHY_1159_DATA 0x00000000 +#define DDRSS_PHY_1160_DATA 0x00000000 +#define DDRSS_PHY_1161_DATA 0x00000000 +#define DDRSS_PHY_1162_DATA 0x00000000 +#define DDRSS_PHY_1163_DATA 0x00000000 +#define DDRSS_PHY_1164_DATA 0x00000000 +#define DDRSS_PHY_1165_DATA 0x00000000 +#define DDRSS_PHY_1166_DATA 0x00000000 +#define DDRSS_PHY_1167_DATA 0x00000000 +#define DDRSS_PHY_1168_DATA 0x00000000 +#define DDRSS_PHY_1169_DATA 0x00000000 +#define DDRSS_PHY_1170_DATA 0x00000000 +#define DDRSS_PHY_1171_DATA 0x00000000 +#define DDRSS_PHY_1172_DATA 0x00000000 +#define DDRSS_PHY_1173_DATA 0x00000000 +#define DDRSS_PHY_1174_DATA 0x00000000 +#define DDRSS_PHY_1175_DATA 0x00000000 +#define DDRSS_PHY_1176_DATA 0x00000000 +#define DDRSS_PHY_1177_DATA 0x00000000 +#define DDRSS_PHY_1178_DATA 0x00000000 +#define DDRSS_PHY_1179_DATA 0x00000000 +#define DDRSS_PHY_1180_DATA 0x00000000 +#define DDRSS_PHY_1181_DATA 0x00000000 +#define DDRSS_PHY_1182_DATA 0x00000000 +#define DDRSS_PHY_1183_DATA 0x00000000 +#define DDRSS_PHY_1184_DATA 0x00000000 +#define DDRSS_PHY_1185_DATA 0x00000000 +#define DDRSS_PHY_1186_DATA 0x00000000 +#define DDRSS_PHY_1187_DATA 0x00000000 +#define DDRSS_PHY_1188_DATA 0x00000000 +#define DDRSS_PHY_1189_DATA 0x00000000 +#define DDRSS_PHY_1190_DATA 0x00000000 +#define DDRSS_PHY_1191_DATA 0x00000000 +#define DDRSS_PHY_1192_DATA 0x00000000 +#define DDRSS_PHY_1193_DATA 0x00000000 +#define DDRSS_PHY_1194_DATA 0x00000000 +#define DDRSS_PHY_1195_DATA 0x00000000 +#define DDRSS_PHY_1196_DATA 0x00000000 +#define DDRSS_PHY_1197_DATA 0x00000000 +#define DDRSS_PHY_1198_DATA 0x00000000 +#define DDRSS_PHY_1199_DATA 0x00000000 +#define DDRSS_PHY_1200_DATA 0x00000000 +#define DDRSS_PHY_1201_DATA 0x00000000 +#define DDRSS_PHY_1202_DATA 0x00000000 +#define DDRSS_PHY_1203_DATA 0x00000000 +#define DDRSS_PHY_1204_DATA 0x00000000 +#define DDRSS_PHY_1205_DATA 0x00000000 +#define DDRSS_PHY_1206_DATA 0x00000000 +#define DDRSS_PHY_1207_DATA 0x00000000 +#define DDRSS_PHY_1208_DATA 0x00000000 +#define DDRSS_PHY_1209_DATA 0x00000000 +#define DDRSS_PHY_1210_DATA 0x00000000 +#define DDRSS_PHY_1211_DATA 0x00000000 +#define DDRSS_PHY_1212_DATA 0x00000000 +#define DDRSS_PHY_1213_DATA 0x00000000 +#define DDRSS_PHY_1214_DATA 0x00000000 +#define DDRSS_PHY_1215_DATA 0x00000000 +#define DDRSS_PHY_1216_DATA 0x00000000 +#define DDRSS_PHY_1217_DATA 0x00000000 +#define DDRSS_PHY_1218_DATA 0x00000000 +#define DDRSS_PHY_1219_DATA 0x00000000 +#define DDRSS_PHY_1220_DATA 0x00000000 +#define DDRSS_PHY_1221_DATA 0x00000000 +#define DDRSS_PHY_1222_DATA 0x00000000 +#define DDRSS_PHY_1223_DATA 0x00000000 +#define DDRSS_PHY_1224_DATA 0x00000000 +#define DDRSS_PHY_1225_DATA 0x00000000 +#define DDRSS_PHY_1226_DATA 0x00000000 +#define DDRSS_PHY_1227_DATA 0x00000000 +#define DDRSS_PHY_1228_DATA 0x00000000 +#define DDRSS_PHY_1229_DATA 0x00000000 +#define DDRSS_PHY_1230_DATA 0x00000000 +#define DDRSS_PHY_1231_DATA 0x00000000 +#define DDRSS_PHY_1232_DATA 0x00000000 +#define DDRSS_PHY_1233_DATA 0x00000000 +#define DDRSS_PHY_1234_DATA 0x00000000 +#define DDRSS_PHY_1235_DATA 0x00000000 +#define DDRSS_PHY_1236_DATA 0x00000000 +#define DDRSS_PHY_1237_DATA 0x00000000 +#define DDRSS_PHY_1238_DATA 0x00000000 +#define DDRSS_PHY_1239_DATA 0x00000000 +#define DDRSS_PHY_1240_DATA 0x00000000 +#define DDRSS_PHY_1241_DATA 0x00000000 +#define DDRSS_PHY_1242_DATA 0x00000000 +#define DDRSS_PHY_1243_DATA 0x00000000 +#define DDRSS_PHY_1244_DATA 0x00000000 +#define DDRSS_PHY_1245_DATA 0x00000000 +#define DDRSS_PHY_1246_DATA 0x00000000 +#define DDRSS_PHY_1247_DATA 0x00000000 +#define DDRSS_PHY_1248_DATA 0x00000000 +#define DDRSS_PHY_1249_DATA 0x00000000 +#define DDRSS_PHY_1250_DATA 0x00000000 +#define DDRSS_PHY_1251_DATA 0x00000000 +#define DDRSS_PHY_1252_DATA 0x00000000 +#define DDRSS_PHY_1253_DATA 0x00000000 +#define DDRSS_PHY_1254_DATA 0x00000000 +#define DDRSS_PHY_1255_DATA 0x00000000 +#define DDRSS_PHY_1256_DATA 0x00000000 +#define DDRSS_PHY_1257_DATA 0x00000000 +#define DDRSS_PHY_1258_DATA 0x00000000 +#define DDRSS_PHY_1259_DATA 0x00000000 +#define DDRSS_PHY_1260_DATA 0x00000000 +#define DDRSS_PHY_1261_DATA 0x00000000 +#define DDRSS_PHY_1262_DATA 0x00000000 +#define DDRSS_PHY_1263_DATA 0x00000000 +#define DDRSS_PHY_1264_DATA 0x00000000 +#define DDRSS_PHY_1265_DATA 0x00000000 +#define DDRSS_PHY_1266_DATA 0x00000000 +#define DDRSS_PHY_1267_DATA 0x00000000 +#define DDRSS_PHY_1268_DATA 0x00000000 +#define DDRSS_PHY_1269_DATA 0x00000000 +#define DDRSS_PHY_1270_DATA 0x00000000 +#define DDRSS_PHY_1271_DATA 0x00000000 +#define DDRSS_PHY_1272_DATA 0x00000000 +#define DDRSS_PHY_1273_DATA 0x00000000 +#define DDRSS_PHY_1274_DATA 0x00000000 +#define DDRSS_PHY_1275_DATA 0x00000000 +#define DDRSS_PHY_1276_DATA 0x00000000 +#define DDRSS_PHY_1277_DATA 0x00000000 +#define DDRSS_PHY_1278_DATA 0x00000000 +#define DDRSS_PHY_1279_DATA 0x00000000 +#define DDRSS_PHY_1280_DATA 0x00000000 +#define DDRSS_PHY_1281_DATA 0x00000100 +#define DDRSS_PHY_1282_DATA 0x00000000 +#define DDRSS_PHY_1283_DATA 0x00000000 +#define DDRSS_PHY_1284_DATA 0x00000000 +#define DDRSS_PHY_1285_DATA 0x00000000 +#define DDRSS_PHY_1286_DATA 0x00050000 +#define DDRSS_PHY_1287_DATA 0x04000100 +#define DDRSS_PHY_1288_DATA 0x00000055 +#define DDRSS_PHY_1289_DATA 0x00000000 +#define DDRSS_PHY_1290_DATA 0x00000000 +#define DDRSS_PHY_1291_DATA 0x00000000 +#define DDRSS_PHY_1292_DATA 0x00000000 +#define DDRSS_PHY_1293_DATA 0x01002000 +#define DDRSS_PHY_1294_DATA 0x00004001 +#define DDRSS_PHY_1295_DATA 0x00020028 +#define DDRSS_PHY_1296_DATA 0x00010100 +#define DDRSS_PHY_1297_DATA 0x00000001 +#define DDRSS_PHY_1298_DATA 0x00000000 +#define DDRSS_PHY_1299_DATA 0x0F0F0E06 +#define DDRSS_PHY_1300_DATA 0x00010101 +#define DDRSS_PHY_1301_DATA 0x010F0004 +#define DDRSS_PHY_1302_DATA 0x00000000 +#define DDRSS_PHY_1303_DATA 0x00000000 +#define DDRSS_PHY_1304_DATA 0x00000064 +#define DDRSS_PHY_1305_DATA 0x00000000 +#define DDRSS_PHY_1306_DATA 0x00000000 +#define DDRSS_PHY_1307_DATA 0x01020103 +#define DDRSS_PHY_1308_DATA 0x0F020102 +#define DDRSS_PHY_1309_DATA 0x03030303 +#define DDRSS_PHY_1310_DATA 0x03030303 +#define DDRSS_PHY_1311_DATA 0x00040000 +#define DDRSS_PHY_1312_DATA 0x00004201 +#define DDRSS_PHY_1313_DATA 0x00000000 +#define DDRSS_PHY_1314_DATA 0x00000000 +#define DDRSS_PHY_1315_DATA 0x00000000 +#define DDRSS_PHY_1316_DATA 0x00000000 +#define DDRSS_PHY_1317_DATA 0x00000000 +#define DDRSS_PHY_1318_DATA 0x00000000 +#define DDRSS_PHY_1319_DATA 0x07070001 +#define DDRSS_PHY_1320_DATA 0x00005400 +#define DDRSS_PHY_1321_DATA 0x000040A2 +#define DDRSS_PHY_1322_DATA 0x00024410 +#define DDRSS_PHY_1323_DATA 0x00004410 +#define DDRSS_PHY_1324_DATA 0x00004410 +#define DDRSS_PHY_1325_DATA 0x00004410 +#define DDRSS_PHY_1326_DATA 0x00004410 +#define DDRSS_PHY_1327_DATA 0x00004410 +#define DDRSS_PHY_1328_DATA 0x00004410 +#define DDRSS_PHY_1329_DATA 0x00004410 +#define DDRSS_PHY_1330_DATA 0x00004410 +#define DDRSS_PHY_1331_DATA 0x00004410 +#define DDRSS_PHY_1332_DATA 0x00000000 +#define DDRSS_PHY_1333_DATA 0x00000046 +#define DDRSS_PHY_1334_DATA 0x00000400 +#define DDRSS_PHY_1335_DATA 0x00000008 +#define DDRSS_PHY_1336_DATA 0x00000000 +#define DDRSS_PHY_1337_DATA 0x00000000 +#define DDRSS_PHY_1338_DATA 0x00000000 +#define DDRSS_PHY_1339_DATA 0x00000000 +#define DDRSS_PHY_1340_DATA 0x00000000 +#define DDRSS_PHY_1341_DATA 0x03000000 +#define DDRSS_PHY_1342_DATA 0x00000000 +#define DDRSS_PHY_1343_DATA 0x00000000 +#define DDRSS_PHY_1344_DATA 0x00000000 +#define DDRSS_PHY_1345_DATA 0x04102006 +#define DDRSS_PHY_1346_DATA 0x00041020 +#define DDRSS_PHY_1347_DATA 0x01C98C98 +#define DDRSS_PHY_1348_DATA 0x3F400000 +#define DDRSS_PHY_1349_DATA 0x3F3F1F3F +#define DDRSS_PHY_1350_DATA 0x0000001F +#define DDRSS_PHY_1351_DATA 0x00000000 +#define DDRSS_PHY_1352_DATA 0x00000000 +#define DDRSS_PHY_1353_DATA 0x00000000 +#define DDRSS_PHY_1354_DATA 0x00000001 +#define DDRSS_PHY_1355_DATA 0x00000000 +#define DDRSS_PHY_1356_DATA 0x00000000 +#define DDRSS_PHY_1357_DATA 0x00000000 +#define DDRSS_PHY_1358_DATA 0x00000000 +#define DDRSS_PHY_1359_DATA 0x76543210 +#define DDRSS_PHY_1360_DATA 0x00000098 +#define DDRSS_PHY_1361_DATA 0x00000000 +#define DDRSS_PHY_1362_DATA 0x00000000 +#define DDRSS_PHY_1363_DATA 0x00000000 +#define DDRSS_PHY_1364_DATA 0x00040700 +#define DDRSS_PHY_1365_DATA 0x00000000 +#define DDRSS_PHY_1366_DATA 0x00000000 +#define DDRSS_PHY_1367_DATA 0x00000000 +#define DDRSS_PHY_1368_DATA 0x00000002 +#define DDRSS_PHY_1369_DATA 0x00000100 +#define DDRSS_PHY_1370_DATA 0x00000000 +#define DDRSS_PHY_1371_DATA 0x00000FC3 +#define DDRSS_PHY_1372_DATA 0x00020002 +#define DDRSS_PHY_1373_DATA 0x00000000 +#define DDRSS_PHY_1374_DATA 0x00001142 +#define DDRSS_PHY_1375_DATA 0x03020400 +#define DDRSS_PHY_1376_DATA 0x00000080 +#define DDRSS_PHY_1377_DATA 0x03900390 +#define DDRSS_PHY_1378_DATA 0x03900390 +#define DDRSS_PHY_1379_DATA 0x03900390 +#define DDRSS_PHY_1380_DATA 0x03900390 +#define DDRSS_PHY_1381_DATA 0x03900390 +#define DDRSS_PHY_1382_DATA 0x03900390 +#define DDRSS_PHY_1383_DATA 0x00000300 +#define DDRSS_PHY_1384_DATA 0x00000300 +#define DDRSS_PHY_1385_DATA 0x00000300 +#define DDRSS_PHY_1386_DATA 0x00000300 +#define DDRSS_PHY_1387_DATA 0x31823FC7 +#define DDRSS_PHY_1388_DATA 0x00000000 +#define DDRSS_PHY_1389_DATA 0x0C000D3F +#define DDRSS_PHY_1390_DATA 0x30000D3F +#define DDRSS_PHY_1391_DATA 0x300D3F11 +#define DDRSS_PHY_1392_DATA 0x01990000 +#define DDRSS_PHY_1393_DATA 0x000D3FCC +#define DDRSS_PHY_1394_DATA 0x00000C11 +#define DDRSS_PHY_1395_DATA 0x300D3F11 +#define DDRSS_PHY_1396_DATA 0x01990000 +#define DDRSS_PHY_1397_DATA 0x300C3F11 +#define DDRSS_PHY_1398_DATA 0x01990000 +#define DDRSS_PHY_1399_DATA 0x300C3F11 +#define DDRSS_PHY_1400_DATA 0x01990000 +#define DDRSS_PHY_1401_DATA 0x300D3F11 +#define DDRSS_PHY_1402_DATA 0x01990000 +#define DDRSS_PHY_1403_DATA 0x300D3F11 +#define DDRSS_PHY_1404_DATA 0x01990000 +#define DDRSS_PHY_1405_DATA 0x20040004 diff --git a/arch/arm/dts/k3-am625-beagleplay-u-boot.dtsi b/arch/arm/dts/k3-am625-beagleplay-u-boot.dtsi new file mode 100644 index 0000000..f8c04e8 --- /dev/null +++ b/arch/arm/dts/k3-am625-beagleplay-u-boot.dtsi @@ -0,0 +1,195 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * https://beagleboard.org/play + * + * Copyright (C) 2022-2023 Texas Instruments Incorporated - https://www.ti.com/ + * Copyright (C) 2022-2023 Robert Nelson, BeagleBoard.org Foundation + */ + +#include "k3-am625-sk-binman.dtsi" + +/ { + chosen { + tick-timer = &main_timer0; + }; + + memory@80000000 { + bootph-pre-ram; + }; + + /* Keep the LEDs on by default to indicate life */ + leds { + bootph-pre-ram; + led-0 { + default-state = "on"; + bootph-pre-ram; + }; + + led-1 { + default-state = "on"; + bootph-pre-ram; + }; + + led-2 { + default-state = "on"; + bootph-pre-ram; + }; + + led-3 { + default-state = "on"; + bootph-pre-ram; + }; + + led-4 { + default-state = "on"; + bootph-pre-ram; + }; + }; +}; + +&cbass_main { + bootph-pre-ram; +}; + +&main_timer0 { + clock-frequency = <25000000>; + bootph-pre-ram; +}; + +&dmss { + bootph-pre-ram; +}; + +&secure_proxy_main { + bootph-pre-ram; +}; + +&dmsc { + bootph-pre-ram; +}; + +&k3_pds { + bootph-pre-ram; +}; + +&k3_clks { + bootph-pre-ram; +}; + +&k3_reset { + bootph-pre-ram; +}; + +&dmsc { + bootph-pre-ram; + k3_sysreset: sysreset-controller { + compatible = "ti,sci-sysreset"; + bootph-pre-ram; + }; +}; + +&wkup_conf { + bootph-pre-ram; +}; + +&chipid { + bootph-pre-ram; +}; + +&main_pmx0 { + bootph-pre-ram; +}; + +&main_uart0 { + bootph-pre-ram; +}; + +&console_pins_default { + bootph-pre-ram; +}; + +&cbass_mcu { + bootph-pre-ram; +}; + +&cbass_wakeup { + bootph-pre-ram; +}; + +&mcu_pmx0 { + bootph-pre-ram; +}; + +&main_i2c0 { + bootph-pre-ram; +}; + +&local_i2c_pins_default { + bootph-pre-ram; +}; + +&gpio0_pins_default { + bootph-pre-ram; +}; + +&main_gpio0 { + bootph-pre-ram; +}; + +&main_gpio1 { + bootph-pre-ram; +}; + +&sdhci0 { + /* EMMC */ + bootph-pre-ram; +}; + +&emmc_pins_default { + bootph-pre-ram; +}; + +&sd_pins_default { + bootph-pre-ram; + /* Force to use SDCD card detect pin */ + pinctrl-single,pins = < + AM62X_IOPAD(0x023c, PIN_INPUT, 0) /* (A21) MMC1_CMD */ + AM62X_IOPAD(0x0234, PIN_INPUT, 0) /* (B22) MMC1_CLK */ + AM62X_IOPAD(0x0230, PIN_INPUT, 0) /* (A22) MMC1_DAT0 */ + AM62X_IOPAD(0x022c, PIN_INPUT, 0) /* (B21) MMC1_DAT1 */ + AM62X_IOPAD(0x0228, PIN_INPUT, 0) /* (C21) MMC1_DAT2 */ + AM62X_IOPAD(0x0224, PIN_INPUT, 0) /* (D22) MMC1_DAT3 */ + AM62X_IOPAD(0x0240, PIN_INPUT, 0) /* (D17) MMC1_SDCD.MMC1_SDCD */ + >; +}; + +&tps65219 { + bootph-pre-ram; +}; + +&sdhci1 { + bootph-pre-ram; +}; + +#ifdef CONFIG_TARGET_AM625_A53_EVM + +#define SPL_AM625_BEAGLEPLAY_DTB "spl/dts/k3-am625-beagleplay.dtb" +#define AM625_BEAGLEPLAY_DTB "arch/arm/dts/k3-am625-beagleplay.dtb" + +&spl_am625_sk_dtb { + filename = SPL_AM625_BEAGLEPLAY_DTB; +}; + +&am625_sk_dtb { + filename = AM625_BEAGLEPLAY_DTB; +}; + +&spl_am625_sk_dtb_unsigned { + filename = SPL_AM625_BEAGLEPLAY_DTB; +}; + +&am625_sk_dtb_unsigned { + filename = AM625_BEAGLEPLAY_DTB; +}; + +#endif diff --git a/arch/arm/dts/k3-am625-beagleplay.dts b/arch/arm/dts/k3-am625-beagleplay.dts new file mode 100644 index 0000000..7cfdf56 --- /dev/null +++ b/arch/arm/dts/k3-am625-beagleplay.dts @@ -0,0 +1,908 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * https://beagleplay.org/ + * + * Copyright (C) 2022-2023 Texas Instruments Incorporated - https://www.ti.com/ + * Copyright (C) 2022-2023 Robert Nelson, BeagleBoard.org Foundation + */ + +/dts-v1/; + +#include <dt-bindings/leds/common.h> +#include <dt-bindings/gpio/gpio.h> +#include <dt-bindings/input/input.h> +#include "k3-am625.dtsi" + +/ { + compatible = "beagle,am625-beagleplay", "ti,am625"; + model = "BeagleBoard.org BeaglePlay"; + + aliases { + ethernet0 = &cpsw_port1; + ethernet1 = &cpsw_port2; + gpio0 = &main_gpio0; + gpio1 = &main_gpio1; + gpio2 = &mcu_gpio0; + i2c0 = &main_i2c0; + i2c1 = &main_i2c1; + i2c2 = &main_i2c2; + i2c3 = &main_i2c3; + i2c4 = &wkup_i2c0; + i2c5 = &mcu_i2c0; + mdio-gpio0 = &mdio0; + mmc0 = &sdhci0; + mmc1 = &sdhci1; + mmc2 = &sdhci2; + rtc0 = &rtc; + serial0 = &main_uart5; + serial1 = &main_uart6; + serial2 = &main_uart0; + usb0 = &usb0; + usb1 = &usb1; + }; + + chosen { + stdout-path = "serial2:115200n8"; + }; + + memory@80000000 { + device_type = "memory"; + /* 2G RAM */ + reg = <0x00000000 0x80000000 0x00000000 0x80000000>; + }; + + reserved-memory { + #address-cells = <2>; + #size-cells = <2>; + ranges; + + ramoops: ramoops@9ca00000 { + compatible = "ramoops"; + reg = <0x00 0x9c700000 0x00 0x00100000>; + record-size = <0x8000>; + console-size = <0x8000>; + ftrace-size = <0x00>; + pmsg-size = <0x8000>; + }; + + secure_tfa_ddr: tfa@9e780000 { + reg = <0x00 0x9e780000 0x00 0x80000>; + no-map; + }; + + secure_ddr: optee@9e800000 { + reg = <0x00 0x9e800000 0x00 0x01800000>; + no-map; + }; + + wkup_r5fss0_core0_dma_memory_region: r5f-dma-memory@9db00000 { + compatible = "shared-dma-pool"; + reg = <0x00 0x9db00000 0x00 0xc00000>; + no-map; + }; + }; + + vsys_5v0: regulator-1 { + compatible = "regulator-fixed"; + regulator-name = "vsys_5v0"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-always-on; + regulator-boot-on; + }; + + vdd_3v3: regulator-2 { + /* output of TLV62595DMQR-U12 */ + compatible = "regulator-fixed"; + regulator-name = "vdd_3v3"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + vin-supply = <&vsys_5v0>; + regulator-always-on; + regulator-boot-on; + }; + + wlan_en: regulator-3 { + /* OUTPUT of SN74AVC2T244DQMR */ + compatible = "regulator-fixed"; + regulator-name = "wlan_en"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + enable-active-high; + regulator-always-on; + vin-supply = <&vdd_3v3>; + gpio = <&main_gpio0 38 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&wifi_en_pins_default>; + }; + + vdd_3v3_sd: regulator-4 { + /* output of TPS22918DBVR-U21 */ + pinctrl-names = "default"; + pinctrl-0 = <&vdd_3v3_sd_pins_default>; + + compatible = "regulator-fixed"; + regulator-name = "vdd_3v3_sd"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + enable-active-high; + regulator-always-on; + vin-supply = <&vdd_3v3>; + gpio = <&main_gpio1 19 GPIO_ACTIVE_HIGH>; + }; + + vdd_sd_dv: regulator-5 { + compatible = "regulator-gpio"; + regulator-name = "sd_hs200_switch"; + pinctrl-names = "default"; + pinctrl-0 = <&vdd_sd_dv_pins_default>; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + regulator-boot-on; + vin-supply = <&ldo1_reg>; + gpios = <&main_gpio1 49 GPIO_ACTIVE_HIGH>; + states = <1800000 0x0>, + <3300000 0x1>; + }; + + leds { + compatible = "gpio-leds"; + + led-0 { + gpios = <&main_gpio0 3 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "heartbeat"; + function = LED_FUNCTION_HEARTBEAT; + default-state = "off"; + }; + + led-1 { + gpios = <&main_gpio0 4 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "disk-activity"; + function = LED_FUNCTION_DISK_ACTIVITY; + default-state = "keep"; + }; + + led-2 { + gpios = <&main_gpio0 5 GPIO_ACTIVE_HIGH>; + function = LED_FUNCTION_CPU; + }; + + led-3 { + gpios = <&main_gpio0 6 GPIO_ACTIVE_HIGH>; + function = LED_FUNCTION_LAN; + }; + + led-4 { + gpios = <&main_gpio0 9 GPIO_ACTIVE_HIGH>; + function = LED_FUNCTION_WLAN; + }; + }; + + gpio_keys: gpio-keys { + compatible = "gpio-keys"; + autorepeat; + pinctrl-names = "default"; + pinctrl-0 = <&usr_button_pins_default>; + + usr: button-usr { + label = "User Key"; + linux,code = <BTN_0>; + gpios = <&main_gpio0 18 GPIO_ACTIVE_LOW>; + }; + + }; + + hdmi0: connector-hdmi { + compatible = "hdmi-connector"; + label = "hdmi"; + type = "a"; + port { + hdmi_connector_in: endpoint { + remote-endpoint = <&it66121_out>; + }; + }; + }; + + sound { + compatible = "simple-audio-card"; + simple-audio-card,name = "it66121 HDMI"; + simple-audio-card,format = "i2s"; + simple-audio-card,bitclock-master = <&hdmi_dailink_master>; + simple-audio-card,frame-master = <&hdmi_dailink_master>; + + hdmi_dailink_master: simple-audio-card,cpu { + sound-dai = <&mcasp1>; + system-clock-direction-out; + }; + + simple-audio-card,codec { + sound-dai = <&it66121>; + }; + }; + + /* Workaround for errata i2329 - just use mdio bitbang */ + mdio0: mdio { + compatible = "virtual,mdio-gpio"; + pinctrl-names = "default"; + pinctrl-0 = <&mdio0_pins_default>; + gpios = <&main_gpio0 86 GPIO_ACTIVE_HIGH>, /* MDC */ + <&main_gpio0 85 GPIO_ACTIVE_HIGH>; /* MDIO */ + #address-cells = <1>; + #size-cells = <0>; + + cpsw3g_phy0: ethernet-phy@0 { + reg = <0>; + }; + + cpsw3g_phy1: ethernet-phy@1 { + reg = <1>; + reset-gpios = <&main_gpio1 5 GPIO_ACTIVE_LOW>; + reset-assert-us = <25>; + reset-deassert-us = <60000>; /* T2 */ + }; + }; +}; + +&main_pmx0 { + gpio0_pins_default: gpio0-default-pins { + pinctrl-single,pins = < + AM62X_IOPAD(0x0004, PIN_INPUT, 7) /* (G25) OSPI0_LBCLKO.GPIO0_1 */ + AM62X_IOPAD(0x0008, PIN_INPUT, 7) /* (J24) OSPI0_DQS.GPIO0_2 */ + AM62X_IOPAD(0x000c, PIN_INPUT, 7) /* (E25) OSPI0_D0.GPIO0_3 */ + AM62X_IOPAD(0x0010, PIN_INPUT, 7) /* (G24) OSPI0_D1.GPIO0_4 */ + AM62X_IOPAD(0x0014, PIN_INPUT, 7) /* (F25) OSPI0_D2.GPIO0_5 */ + AM62X_IOPAD(0x0018, PIN_INPUT, 7) /* (F24) OSPI0_D3.GPIO0_6 */ + AM62X_IOPAD(0x0024, PIN_INPUT, 7) /* (H25) OSPI0_D6.GPIO0_9 */ + AM62X_IOPAD(0x0028, PIN_INPUT, 7) /* (J22) OSPI0_D7.GPIO0_10 */ + AM62X_IOPAD(0x002c, PIN_INPUT, 7) /* (F23) OSPI0_CSn0.GPIO0_11 */ + AM62X_IOPAD(0x0030, PIN_INPUT, 7) /* (G21) OSPI0_CSn1.GPIO0_12 */ + AM62X_IOPAD(0x0034, PIN_INPUT, 7) /* (H21) OSPI0_CSn2.GPIO0_13 */ + AM62X_IOPAD(0x0038, PIN_INPUT, 7) /* (E24) OSPI0_CSn3.GPIO0_14 */ + AM62X_IOPAD(0x00a4, PIN_INPUT, 7) /* (M22) GPMC0_DIR.GPIO0_40 */ + AM62X_IOPAD(0x00ac, PIN_INPUT, 7) /* (L21) GPMC0_CSn1.GPIO0_42 */ + >; + }; + + vdd_sd_dv_pins_default: vdd-sd-default-pins { + pinctrl-single,pins = < + AM62X_IOPAD(0x0244, PIN_OUTPUT, 7) /* (C17) MMC1_SDWP.GPIO1_49 */ + >; + }; + + usr_button_pins_default: usr-button-default-pins { + pinctrl-single,pins = < + AM62X_IOPAD(0x0048, PIN_INPUT, 7) /* (N25) GPMC0_AD3.GPIO0_18 */ + >; + }; + + grove_pins_default: grove-default-pins { + pinctrl-single,pins = < + AM62X_IOPAD(0x01e8, PIN_INPUT_PULLUP, 0) /* (B17) I2C1_SCL */ + AM62X_IOPAD(0x01ec, PIN_INPUT_PULLUP, 0) /* (A17) I2C1_SDA */ + >; + }; + + local_i2c_pins_default: local-i2c-default-pins { + pinctrl-single,pins = < + AM62X_IOPAD(0x01e0, PIN_INPUT_PULLUP, 0) /* (B16) I2C0_SCL */ + AM62X_IOPAD(0x01e4, PIN_INPUT_PULLUP, 0) /* (A16) I2C0_SDA */ + >; + }; + + i2c2_1v8_pins_default: i2c2-default-pins { + pinctrl-single,pins = < + AM62X_IOPAD(0x00b0, PIN_INPUT_PULLUP, 1) /* (K22) GPMC0_CSn2.I2C2_SCL */ + AM62X_IOPAD(0x00b4, PIN_INPUT_PULLUP, 1) /* (K24) GPMC0_CSn3.I2C2_SDA */ + >; + }; + + mdio0_pins_default: mdio0-default-pins { + pinctrl-single,pins = < + AM62X_IOPAD(0x0160, PIN_OUTPUT, 7) /* (AD24) MDIO0_MDC.GPIO0_86 */ + AM62X_IOPAD(0x015c, PIN_INPUT, 7) /* (AB22) MDIO0_MDIO.GPIO0_85 */ + >; + }; + + rgmii1_pins_default: rgmii1-default-pins { + pinctrl-single,pins = < + AM62X_IOPAD(0x014c, PIN_INPUT, 0) /* (AB17) RGMII1_RD0 */ + AM62X_IOPAD(0x0150, PIN_INPUT, 0) /* (AC17) RGMII1_RD1 */ + AM62X_IOPAD(0x0154, PIN_INPUT, 0) /* (AB16) RGMII1_RD2 */ + AM62X_IOPAD(0x0158, PIN_INPUT, 0) /* (AA15) RGMII1_RD3 */ + AM62X_IOPAD(0x0148, PIN_INPUT, 0) /* (AD17) RGMII1_RXC */ + AM62X_IOPAD(0x0144, PIN_INPUT, 0) /* (AE17) RGMII1_RX_CTL */ + AM62X_IOPAD(0x0134, PIN_OUTPUT, 0) /* (AE20) RGMII1_TD0 */ + AM62X_IOPAD(0x0138, PIN_OUTPUT, 0) /* (AD20) RGMII1_TD1 */ + AM62X_IOPAD(0x013c, PIN_OUTPUT, 0) /* (AE18) RGMII1_TD2 */ + AM62X_IOPAD(0x0140, PIN_OUTPUT, 0) /* (AD18) RGMII1_TD3 */ + AM62X_IOPAD(0x0130, PIN_OUTPUT, 0) /* (AE19) RGMII1_TXC */ + AM62X_IOPAD(0x012c, PIN_OUTPUT, 0) /* (AD19) RGMII1_TX_CTL */ + >; + }; + + emmc_pins_default: emmc-default-pins { + pinctrl-single,pins = < + AM62X_IOPAD(0x0220, PIN_INPUT, 0) /* (Y3) MMC0_CMD */ + AM62X_IOPAD(0x0218, PIN_INPUT, 0) /* (AB1) MMC0_CLK */ + AM62X_IOPAD(0x0214, PIN_INPUT, 0) /* (AA2) MMC0_DAT0 */ + AM62X_IOPAD(0x0210, PIN_INPUT, 0) /* (AA1) MMC0_DAT1 */ + AM62X_IOPAD(0x020c, PIN_INPUT, 0) /* (AA3) MMC0_DAT2 */ + AM62X_IOPAD(0x0208, PIN_INPUT, 0) /* (Y4) MMC0_DAT3 */ + AM62X_IOPAD(0x0204, PIN_INPUT, 0) /* (AB2) MMC0_DAT4 */ + AM62X_IOPAD(0x0200, PIN_INPUT, 0) /* (AC1) MMC0_DAT5 */ + AM62X_IOPAD(0x01fc, PIN_INPUT, 0) /* (AD2) MMC0_DAT6 */ + AM62X_IOPAD(0x01f8, PIN_INPUT, 0) /* (AC2) MMC0_DAT7 */ + >; + }; + + vdd_3v3_sd_pins_default: vdd-3v3-sd-default-pins { + pinctrl-single,pins = < + AM62X_IOPAD(0x01c4, PIN_INPUT, 7) /* (B14) SPI0_D1_GPIO1_19 */ + >; + }; + + sd_pins_default: sd-default-pins { + pinctrl-single,pins = < + AM62X_IOPAD(0x023c, PIN_INPUT, 0) /* (A21) MMC1_CMD */ + AM62X_IOPAD(0x0234, PIN_INPUT, 0) /* (B22) MMC1_CLK */ + AM62X_IOPAD(0x0230, PIN_INPUT, 0) /* (A22) MMC1_DAT0 */ + AM62X_IOPAD(0x022c, PIN_INPUT, 0) /* (B21) MMC1_DAT1 */ + AM62X_IOPAD(0x0228, PIN_INPUT, 0) /* (C21) MMC1_DAT2 */ + AM62X_IOPAD(0x0224, PIN_INPUT, 0) /* (D22) MMC1_DAT3 */ + AM62X_IOPAD(0x0240, PIN_INPUT, 7) /* (D17) MMC1_SDCD.GPIO1_48 */ + >; + }; + + wifi_pins_default: wifi-default-pins { + pinctrl-single,pins = < + AM62X_IOPAD(0x0120, PIN_INPUT, 0) /* (C24) MMC2_CMD */ + AM62X_IOPAD(0x0118, PIN_INPUT, 0) /* (D25) MMC2_CLK */ + AM62X_IOPAD(0x0114, PIN_INPUT, 0) /* (B24) MMC2_DAT0 */ + AM62X_IOPAD(0x0110, PIN_INPUT, 0) /* (C25) MMC2_DAT1 */ + AM62X_IOPAD(0x010c, PIN_INPUT, 0) /* (E23) MMC2_DAT2 */ + AM62X_IOPAD(0x0108, PIN_INPUT, 0) /* (D24) MMC2_DAT3 */ + AM62X_IOPAD(0x0124, PIN_INPUT, 0) /* (A23) MMC2_SDCD */ + AM62X_IOPAD(0x11c, PIN_INPUT, 0) /* (#N/A) MMC2_CLKB */ + >; + }; + + wifi_en_pins_default: wifi-en-default-pins { + pinctrl-single,pins = < + AM62X_IOPAD(0x009c, PIN_OUTPUT, 7) /* (V25) GPMC0_WAIT1.GPIO0_38 */ + >; + }; + + wifi_wlirq_pins_default: wifi-wlirq-default-pins { + pinctrl-single,pins = < + AM62X_IOPAD(0x00a8, PIN_INPUT, 7) /* (M21) GPMC0_CSn0.GPIO0_41 */ + >; + }; + + spe_pins_default: spe-default-pins { + pinctrl-single,pins = < + AM62X_IOPAD(0x0168, PIN_INPUT, 1) /* (AE21) RGMII2_TXC.RMII2_CRS_DV */ + AM62X_IOPAD(0x0180, PIN_INPUT, 1) /* (AD23) RGMII2_RXC.RMII2_REF_CLK */ + AM62X_IOPAD(0x0184, PIN_INPUT, 1) /* (AE23) RGMII2_RD0.RMII2_RXD0 */ + AM62X_IOPAD(0x0188, PIN_INPUT, 1) /* (AB20) RGMII2_RD1.RMII2_RXD1 */ + AM62X_IOPAD(0x017c, PIN_INPUT, 1) /* (AD22) RGMII2_RX_CTL.RMII2_RX_ER */ + AM62X_IOPAD(0x016c, PIN_INPUT, 1) /* (Y18) RGMII2_TD0.RMII2_TXD0 */ + AM62X_IOPAD(0x0170, PIN_INPUT, 1) /* (AA18) RGMII2_TD1.RMII2_TXD1 */ + AM62X_IOPAD(0x0164, PIN_INPUT, 1) /* (AA19) RGMII2_TX_CTL.RMII2_TX_EN */ + AM62X_IOPAD(0x018c, PIN_OUTPUT, 7) /* (AC21) RGMII2_RD2.GPIO1_5 */ + AM62X_IOPAD(0x0190, PIN_INPUT, 7) /* (AE22) RGMII2_RD3.GPIO1_6 */ + AM62X_IOPAD(0x01f0, PIN_OUTPUT, 5) /* (A18) EXT_REFCLK1.CLKOUT0 */ + >; + }; + + mikrobus_i2c_pins_default: mikrobus-i2c-default-pins { + pinctrl-single,pins = < + AM62X_IOPAD(0x01d0, PIN_INPUT_PULLUP, 2) /* (A15) UART0_CTSn.I2C3_SCL */ + AM62X_IOPAD(0x01d4, PIN_INPUT_PULLUP, 2) /* (B15) UART0_RTSn.I2C3_SDA */ + >; + }; + + mikrobus_uart_pins_default: mikrobus-uart-default-pins { + pinctrl-single,pins = < + AM62X_IOPAD(0x01d8, PIN_INPUT, 1) /* (C15) MCAN0_TX.UART5_RXD */ + AM62X_IOPAD(0x01dc, PIN_OUTPUT, 1) /* (E15) MCAN0_RX.UART5_TXD */ + >; + }; + + mikrobus_spi_pins_default: mikrobus-spi-default-pins { + pinctrl-single,pins = < + AM62X_IOPAD(0x01b0, PIN_INPUT, 1) /* (A20) MCASP0_ACLKR.SPI2_CLK */ + AM62X_IOPAD(0x01ac, PIN_INPUT, 1) /* (E19) MCASP0_AFSR.SPI2_CS0 */ + AM62X_IOPAD(0x0194, PIN_INPUT, 1) /* (B19) MCASP0_AXR3.SPI2_D0 */ + AM62X_IOPAD(0x0198, PIN_INPUT, 1) /* (A19) MCASP0_AXR2.SPI2_D1 */ + >; + }; + + mikrobus_gpio_pins_default: mikrobus-gpio-default-pins { + pinctrl-single,pins = < + AM62X_IOPAD(0x019c, PIN_INPUT, 7) /* (B18) MCASP0_AXR1.GPIO1_9 */ + AM62X_IOPAD(0x01a0, PIN_INPUT, 7) /* (E18) MCASP0_AXR0.GPIO1_10 */ + AM62X_IOPAD(0x01a8, PIN_INPUT, 7) /* (D20) MCASP0_AFSX.GPIO1_12 */ + >; + }; + + console_pins_default: console-default-pins { + pinctrl-single,pins = < + AM62X_IOPAD(0x01c8, PIN_INPUT, 0) /* (D14) UART0_RXD */ + AM62X_IOPAD(0x01cc, PIN_OUTPUT, 0) /* (E14) UART0_TXD */ + >; + }; + + wifi_debug_uart_pins_default: wifi-debug-uart-default-pins { + pinctrl-single,pins = < + AM62X_IOPAD(0x001c, PIN_INPUT, 3) /* (J23) OSPI0_D4.UART6_RXD */ + AM62X_IOPAD(0x0020, PIN_OUTPUT, 3) /* (J25) OSPI0_D5.UART6_TXD */ + >; + }; + + usb1_pins_default: usb1-default-pins { + pinctrl-single,pins = < + AM62X_IOPAD(0x0258, PIN_INPUT, 0) /* (F18) USB1_DRVVBUS */ + >; + }; + + pmic_irq_pins_default: pmic-irq-default-pins { + pinctrl-single,pins = < + AM62X_IOPAD(0x01f4, PIN_INPUT_PULLUP, 0) /* (D16) EXTINTn */ + >; + }; + + hdmi_gpio_pins_default: hdmi-gpio-default-pins { + pinctrl-single,pins = < + AM62X_IOPAD(0x0094, PIN_INPUT_PULLUP | PIN_DEBOUNCE_CONF6, 7) /* (N20) GPMC0_BE1n.GPIO0_36 */ + AM62X_IOPAD(0x0054, PIN_OUTPUT_PULLUP, 7) /* (P21) GPMC0_AD6.GPIO0_21 */ + >; + }; + + mcasp_hdmi_pins_default: mcasp-hdmi-default-pins { + pinctrl-single,pins = < + AM62X_IOPAD(0x0090, PIN_INPUT, 2) /* (M24) GPMC0_BE0n_CLE.MCASP1_ACLKX */ + AM62X_IOPAD(0x0098, PIN_INPUT, 2) /* (U23) GPMC0_WAIT0.MCASP1_AFSX */ + AM62X_IOPAD(0x008c, PIN_OUTPUT, 2) /* (L25) GPMC0_WEn.MCASP1_AXR0 */ + AM62X_IOPAD(0x0088, PIN_INPUT, 2) /* (L24) GPMC0_OEn_REn.MCASP1_AXR1 */ + AM62X_IOPAD(0x0084, PIN_INPUT, 2) /* (L23) GPMC0_ADVn_ALE.MCASP1_AXR2 */ + AM62X_IOPAD(0x007c, PIN_INPUT, 2) /* (P25) GPMC0_CLK.MCASP1_AXR3 */ + >; + }; + + dss0_pins_default: dss0-default-pins { + pinctrl-single,pins = < + AM62X_IOPAD(0x0100, PIN_OUTPUT, 0) /* (AC25) VOUT0_VSYNC */ + AM62X_IOPAD(0x00f8, PIN_OUTPUT, 0) /* (AB24) VOUT0_HSYNC */ + AM62X_IOPAD(0x0104, PIN_OUTPUT, 0) /* (AC24) VOUT0_PCLK */ + AM62X_IOPAD(0x00fc, PIN_OUTPUT, 0) /* (Y20) VOUT0_DE */ + AM62X_IOPAD(0x00b8, PIN_OUTPUT, 0) /* (U22) VOUT0_DATA0 */ + AM62X_IOPAD(0x00bc, PIN_OUTPUT, 0) /* (V24) VOUT0_DATA1 */ + AM62X_IOPAD(0x00c0, PIN_OUTPUT, 0) /* (W25) VOUT0_DATA2 */ + AM62X_IOPAD(0x00c4, PIN_OUTPUT, 0) /* (W24) VOUT0_DATA3 */ + AM62X_IOPAD(0x00c8, PIN_OUTPUT, 0) /* (Y25) VOUT0_DATA4 */ + AM62X_IOPAD(0x00cc, PIN_OUTPUT, 0) /* (Y24) VOUT0_DATA5 */ + AM62X_IOPAD(0x00d0, PIN_OUTPUT, 0) /* (Y23) VOUT0_DATA6 */ + AM62X_IOPAD(0x00d4, PIN_OUTPUT, 0) /* (AA25) VOUT0_DATA7 */ + AM62X_IOPAD(0x00d8, PIN_OUTPUT, 0) /* (V21) VOUT0_DATA8 */ + AM62X_IOPAD(0x00dc, PIN_OUTPUT, 0) /* (W21) VOUT0_DATA9 */ + AM62X_IOPAD(0x00e0, PIN_OUTPUT, 0) /* (V20) VOUT0_DATA10 */ + AM62X_IOPAD(0x00e4, PIN_OUTPUT, 0) /* (AA23) VOUT0_DATA11 */ + AM62X_IOPAD(0x00e8, PIN_OUTPUT, 0) /* (AB25) VOUT0_DATA12 */ + AM62X_IOPAD(0x00ec, PIN_OUTPUT, 0) /* (AA24) VOUT0_DATA13 */ + AM62X_IOPAD(0x00f0, PIN_OUTPUT, 0) /* (Y22) VOUT0_DATA14 */ + AM62X_IOPAD(0x00f4, PIN_OUTPUT, 0) /* (AA21) VOUT0_DATA15 */ + AM62X_IOPAD(0x005c, PIN_OUTPUT, 1) /* (R24) GPMC0_AD8.VOUT0_DATA16 */ + AM62X_IOPAD(0x0060, PIN_OUTPUT, 1) /* (R25) GPMC0_AD9.VOUT0_DATA17 */ + AM62X_IOPAD(0x0064, PIN_OUTPUT, 1) /* (T25) GPMC0_AD10.VOUT0_DATA18 */ + AM62X_IOPAD(0x0068, PIN_OUTPUT, 1) /* (R21) GPMC0_AD11.VOUT0_DATA19 */ + AM62X_IOPAD(0x006c, PIN_OUTPUT, 1) /* (T22) GPMC0_AD12.VOUT0_DATA20 */ + AM62X_IOPAD(0x0070, PIN_OUTPUT, 1) /* (T24) GPMC0_AD13.VOUT0_DATA21 */ + AM62X_IOPAD(0x0074, PIN_OUTPUT, 1) /* (U25) GPMC0_AD14.VOUT0_DATA22 */ + AM62X_IOPAD(0x0078, PIN_OUTPUT, 1) /* (U24) GPMC0_AD15.VOUT0_DATA23 */ + >; + }; +}; + +&mcu_pmx0 { + i2c_qwiic_pins_default: i2c-qwiic-default-pins { + pinctrl-single,pins = < + AM62X_MCU_IOPAD(0x0044, PIN_INPUT, 0) /* (A8) MCU_I2C0_SCL */ + AM62X_MCU_IOPAD(0x0048, PIN_INPUT, 0) /* (D10) MCU_I2C0_SDA */ + >; + }; + + gbe_pmx_obsclk: gbe-pmx-obsclk-default-pins { + pinctrl-single,pins = < + AM62X_MCU_IOPAD(0x0004, PIN_OUTPUT, 1) /* (B8) MCU_SPI0_CS1.MCU_OBSCLK0 */ + >; + }; + + i2c_csi_pins_default: i2c-csi-default-pins { + pinctrl-single,pins = < + AM62X_MCU_IOPAD(0x004c, PIN_INPUT_PULLUP, 0) /* (B9) WKUP_I2C0_SCL */ + AM62X_MCU_IOPAD(0x0050, PIN_INPUT_PULLUP, 0) /* (A9) WKUP_I2C0_SDA */ + >; + }; + + wifi_32k_clk: mcu-clk-out-default-pins { + pinctrl-single,pins = < + AM62X_MCU_IOPAD(0x0084, PIN_OUTPUT, 0) /* (A12) WKUP_CLKOUT0 */ + >; + }; +}; + +&a53_opp_table { + /* Requires VDD_CORE to be at 0.85V */ + opp-1400000000 { + opp-hz = /bits/ 64 <1400000000>; + opp-supported-hw = <0x01 0x0004>; + }; +}; + +&wkup_i2c0 { + pinctrl-names = "default"; + pinctrl-0 = <&i2c_csi_pins_default>; + clock-frequency = <400000>; + /* Enable with overlay for camera sensor */ +}; + +&mcu_i2c0 { + pinctrl-names = "default"; + pinctrl-0 = <&i2c_qwiic_pins_default>; + clock-frequency = <100000>; + status = "okay"; +}; + +&usbss0 { + ti,vbus-divider; + status = "okay"; +}; + +&usb0 { + dr_mode = "peripheral"; +}; + +&usbss1 { + ti,vbus-divider; + status = "okay"; +}; + +&usb1 { + dr_mode = "host"; + pinctrl-names = "default"; + pinctrl-0 = <&usb1_pins_default>; +}; + +&cpsw3g { + pinctrl-names = "default"; + pinctrl-0 = <&rgmii1_pins_default>, <&spe_pins_default>, + <&gbe_pmx_obsclk>; + assigned-clocks = <&k3_clks 157 70>, <&k3_clks 157 20>; + assigned-clock-parents = <&k3_clks 157 72>, <&k3_clks 157 22>; +}; + +&cpsw_port1 { + phy-mode = "rgmii-rxid"; + phy-handle = <&cpsw3g_phy0>; +}; + +&cpsw_port2 { + phy-mode = "rmii"; + phy-handle = <&cpsw3g_phy1>; +}; + +&cpsw3g_mdio { + /* Workaround for errata i2329 - Use mdio bitbang */ + status = "disabled"; +}; + +&main_gpio0 { + pinctrl-names = "default"; + pinctrl-0 = <&gpio0_pins_default>; + gpio-line-names = "BL_EN_3V3", "SPE_PO_EN", "RTC_INT", /* 0-2 */ + "USR0", "USR1", "USR2", "USR3", "", "", "USR4", /* 3-9 */ + "EEPROM_WP", /* 10 */ + "CSI2_CAMERA_GPIO1", "CSI2_CAMERA_GPIO2", /* 11-12 */ + "CC1352P7_BOOT", "CC1352P7_RSTN", "", "", "", /* 13-17 */ + "USR_BUTTON", "", "", "", "", "", "", "", "", /* 18-26 */ + "", "", "", "", "", "", "", "", "", "HDMI_INT", /* 27-36 */ + "", "VDD_WLAN_EN", "", "", "WL_IRQ", "GBE_INTN",/* 37-42 */ + "", "", "", "", "", "", "", "", "", "", "", "", /* 43-54 */ + "", "", "", "", "", "", "", "", "", "", "", "", /* 55-66 */ + "", "", "", "", "", "", "", "", "", "", "", "", /* 67-78 */ + "", "", "", "", "", "", /* 79-84 */ + "BITBANG_MDIO_DATA", "BITBANG_MDIO_CLK", /* 85-86 */ + "", "", "", "", ""; /* 87-91 */ +}; + +&main_gpio1 { + pinctrl-names = "default"; + pinctrl-0 = <&mikrobus_gpio_pins_default>; + gpio-line-names = "", "", "", "", "", /* 0-4 */ + "SPE_RSTN", "SPE_INTN", "MIKROBUS_GPIO1_7", /* 5-7 */ + "MIKROBUS_GPIO1_8", "MIKROBUS_GPIO1_9", /* 8-9 */ + "MIKROBUS_GPIO1_10", "MIKROBUS_GPIO1_11", /* 10-11 */ + "MIKROBUS_GPIO1_12", "MIKROBUS_W1_GPIO0", /* 12-13 */ + "MIKROBUS_GPIO1_14", /* 14 */ + "", "", "", "", "VDD_3V3_SD", "", "", /* 15-21 */ + "MIKROBUS_GPIO1_22", "MIKROBUS_GPIO1_23", /* 22-23 */ + "MIKROBUS_GPIO1_24", "MIKROBUS_GPIO1_25", /* 24-25 */ + "", "", "", "", "", "", "", "", "", "", "", "", /* 26-37 */ + "", "", "", "", "", "", "", "", "", "", /* 38-47 */ + "SD_CD", "SD_VOLT_SEL", "", ""; /* 48-51 */ +}; + +&main_i2c0 { + pinctrl-names = "default"; + pinctrl-0 = <&local_i2c_pins_default>; + clock-frequency = <400000>; + status = "okay"; + + eeprom@50 { + compatible = "atmel,24c32"; + reg = <0x50>; + }; + + rtc: rtc@68 { + compatible = "ti,bq32000"; + reg = <0x68>; + interrupt-parent = <&main_gpio0>; + interrupts = <2 IRQ_TYPE_EDGE_FALLING>; + }; + + tps65219: pmic@30 { + compatible = "ti,tps65219"; + reg = <0x30>; + buck1-supply = <&vsys_5v0>; + buck2-supply = <&vsys_5v0>; + buck3-supply = <&vsys_5v0>; + ldo1-supply = <&vdd_3v3>; + ldo2-supply = <&buck2_reg>; + ldo3-supply = <&vdd_3v3>; + ldo4-supply = <&vdd_3v3>; + + pinctrl-names = "default"; + pinctrl-0 = <&pmic_irq_pins_default>; + interrupt-parent = <&gic500>; + interrupts = <GIC_SPI 224 IRQ_TYPE_LEVEL_HIGH>; + interrupt-controller; + #interrupt-cells = <1>; + + system-power-controller; + ti,power-button; + + regulators { + buck1_reg: buck1 { + regulator-name = "VDD_CORE"; + regulator-min-microvolt = <850000>; + regulator-max-microvolt = <850000>; + regulator-boot-on; + regulator-always-on; + }; + + buck2_reg: buck2 { + regulator-name = "VDD_1V8"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-boot-on; + regulator-always-on; + }; + + buck3_reg: buck3 { + regulator-name = "VDD_1V2"; + regulator-min-microvolt = <1200000>; + regulator-max-microvolt = <1200000>; + regulator-boot-on; + regulator-always-on; + }; + + ldo1_reg: ldo1 { + /* + * Regulator is left as is unused, vdd_sd + * is controlled via GPIO with bypass config + * as per the NVM configuration + */ + regulator-name = "VDD_SD_3V3"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-allow-bypass; + regulator-boot-on; + regulator-always-on; + }; + + ldo2_reg: ldo2 { + regulator-name = "VDDA_0V85"; + regulator-min-microvolt = <850000>; + regulator-max-microvolt = <850000>; + regulator-boot-on; + regulator-always-on; + }; + + ldo3_reg: ldo3 { + regulator-name = "VDDA_1V8"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-boot-on; + regulator-always-on; + }; + + ldo4_reg: ldo4 { + regulator-name = "VDD_2V5"; + regulator-min-microvolt = <2500000>; + regulator-max-microvolt = <2500000>; + regulator-boot-on; + regulator-always-on; + }; + }; + }; +}; + +&main_i2c1 { + pinctrl-names = "default"; + pinctrl-0 = <&grove_pins_default>; + clock-frequency = <100000>; + status = "okay"; +}; + +&main_i2c2 { + pinctrl-names = "default"; + pinctrl-0 = <&i2c2_1v8_pins_default>; + clock-frequency = <100000>; + status = "okay"; + + it66121: bridge-hdmi@4c { + compatible = "ite,it66121"; + reg = <0x4c>; + pinctrl-names = "default"; + pinctrl-0 = <&hdmi_gpio_pins_default>; + vcn33-supply = <&vdd_3v3>; + vcn18-supply = <&buck2_reg>; + vrf12-supply = <&buck3_reg>; + reset-gpios = <&main_gpio0 21 GPIO_ACTIVE_LOW>; + interrupt-parent = <&main_gpio0>; + interrupts = <36 IRQ_TYPE_EDGE_FALLING>; + #sound-dai-cells = <0>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + + it66121_in: endpoint { + bus-width = <24>; + remote-endpoint = <&dpi1_out>; + }; + }; + + port@1 { + reg = <1>; + + it66121_out: endpoint { + remote-endpoint = <&hdmi_connector_in>; + }; + }; + }; + }; +}; + +&main_i2c3 { + pinctrl-names = "default"; + pinctrl-0 = <&mikrobus_i2c_pins_default>; + clock-frequency = <400000>; + status = "okay"; +}; + +&main_spi2 { + pinctrl-names = "default"; + pinctrl-0 = <&mikrobus_spi_pins_default>; + status = "okay"; +}; + +&sdhci0 { + pinctrl-names = "default"; + pinctrl-0 = <&emmc_pins_default>; + ti,driver-strength-ohm = <50>; + disable-wp; + status = "okay"; +}; + +&sdhci1 { + /* SD/MMC */ + pinctrl-names = "default"; + pinctrl-0 = <&sd_pins_default>; + + vmmc-supply = <&vdd_3v3_sd>; + vqmmc-supply = <&vdd_sd_dv>; + ti,driver-strength-ohm = <50>; + disable-wp; + cd-gpios = <&main_gpio1 48 GPIO_ACTIVE_LOW>; + cd-debounce-delay-ms = <100>; + ti,fails-without-test-cd; + status = "okay"; +}; + +&sdhci2 { + vmmc-supply = <&wlan_en>; + pinctrl-names = "default"; + pinctrl-0 = <&wifi_pins_default>, <&wifi_32k_clk>; + bus-width = <4>; + non-removable; + ti,fails-without-test-cd; + cap-power-off-card; + keep-power-in-suspend; + ti,driver-strength-ohm = <50>; + assigned-clocks = <&k3_clks 157 158>; + assigned-clock-parents = <&k3_clks 157 160>; + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + + wlcore: wlcore@2 { + compatible = "ti,wl1807"; + reg = <2>; + pinctrl-names = "default"; + pinctrl-0 = <&wifi_wlirq_pins_default>; + interrupt-parent = <&main_gpio0>; + interrupts = <41 IRQ_TYPE_EDGE_FALLING>; + }; +}; + +&main_uart0 { + pinctrl-names = "default"; + pinctrl-0 = <&console_pins_default>; + status = "okay"; +}; + +&main_uart1 { + /* Main UART1 is used by TIFS firmware */ + status = "reserved"; +}; + +&main_uart5 { + pinctrl-names = "default"; + pinctrl-0 = <&mikrobus_uart_pins_default>; + status = "okay"; +}; + +&main_uart6 { + pinctrl-names = "default"; + pinctrl-0 = <&wifi_debug_uart_pins_default>; + status = "okay"; +}; + +&dss { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&dss0_pins_default>; +}; + +&dss_ports { + /* VP2: DPI Output */ + port@1 { + reg = <1>; + + dpi1_out: endpoint { + remote-endpoint = <&it66121_in>; + }; + }; +}; + +&mcasp1 { + status = "okay"; + #sound-dai-cells = <0>; + pinctrl-names = "default"; + pinctrl-0 = <&mcasp_hdmi_pins_default>; + auxclk-fs-ratio = <2177>; + op-mode = <0>; /* MCASP_IIS_MODE */ + tdm-slots = <2>; + serial-dir = < /* 0: INACTIVE, 1: TX, 2: RX */ + 1 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + >; + tx-num-evt = <32>; + rx-num-evt = <32>; +}; diff --git a/arch/arm/dts/k3-am625-r5-beagleplay.dts b/arch/arm/dts/k3-am625-r5-beagleplay.dts new file mode 100644 index 0000000..9c9d057 --- /dev/null +++ b/arch/arm/dts/k3-am625-r5-beagleplay.dts @@ -0,0 +1,86 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * https://beagleboard.org/play + * + * Copyright (C) 2022-2023 Texas Instruments Incorporated - https://www.ti.com/ + * Copyright (C) 2022-2023 Robert Nelson, BeagleBoard.org Foundation + */ + +#include "k3-am625-beagleplay.dts" +#include "k3-am625-beagleplay-ddr4-1600MTs.dtsi" +#include "k3-am62-ddr.dtsi" + +#include "k3-am625-beagleplay-u-boot.dtsi" + +/ { + aliases { + remoteproc0 = &sysctrler; + remoteproc1 = &a53_0; + }; + + a53_0: a53@0 { + compatible = "ti,am654-rproc"; + reg = <0x00 0x00a90000 0x00 0x10>; + power-domains = <&k3_pds 61 TI_SCI_PD_EXCLUSIVE>, + <&k3_pds 135 TI_SCI_PD_EXCLUSIVE>; + resets = <&k3_reset 135 0>; + clocks = <&k3_clks 61 0>; + assigned-clocks = <&k3_clks 61 0>, <&k3_clks 135 0>; + assigned-clock-parents = <&k3_clks 61 2>; + assigned-clock-rates = <200000000>, <1250000000>; + ti,sci = <&dmsc>; + ti,sci-proc-id = <32>; + ti,sci-host-id = <10>; + bootph-pre-ram; + }; + + dm_tifs: dm-tifs { + compatible = "ti,j721e-dm-sci"; + ti,host-id = <36>; + ti,secure-host; + mbox-names = "rx", "tx"; + mboxes= <&secure_proxy_main 22>, + <&secure_proxy_main 23>; + bootph-pre-ram; + }; +}; + +&dmsc { + mboxes= <&secure_proxy_main 0>, + <&secure_proxy_main 1>, + <&secure_proxy_main 0>; + mbox-names = "rx", "tx", "notify"; + ti,host-id = <35>; + ti,secure-host; +}; + +&mcu_esm { + bootph-pre-ram; +}; + +&secure_proxy_sa3 { + bootph-pre-ram; + /* We require this for boot handshake */ + status = "okay"; +}; + +&cbass_main { + sysctrler: sysctrler { + compatible = "ti,am654-system-controller"; + mboxes= <&secure_proxy_main 1>, <&secure_proxy_main 0>, <&secure_proxy_sa3 0>; + mbox-names = "tx", "rx", "boot_notify"; + bootph-pre-ram; + }; +}; + +&main_esm { + bootph-pre-ram; +}; + +&main_pktdma { + ti,sci = <&dm_tifs>; +}; + +&main_bcdma { + ti,sci = <&dm_tifs>; +}; diff --git a/arch/arm/dts/k3-am625-sk-binman.dtsi b/arch/arm/dts/k3-am625-sk-binman.dtsi index a35d641..41277bf 100644 --- a/arch/arm/dts/k3-am625-sk-binman.dtsi +++ b/arch/arm/dts/k3-am625-sk-binman.dtsi @@ -389,7 +389,7 @@ type = "flat_dt"; arch = "arm"; compression = "none"; - blob { + spl_am625_sk_dtb_unsigned: blob { filename = SPL_AM625_SK_DTB; }; }; @@ -438,7 +438,7 @@ type = "flat_dt"; arch = "arm"; compression = "none"; - blob { + am625_sk_dtb_unsigned: blob { filename = AM625_SK_DTB; }; hash { diff --git a/arch/arm/dts/k3-am625-sk.dts b/arch/arm/dts/k3-am625-sk.dts index 3f9ef40..7c98c1b 100644 --- a/arch/arm/dts/k3-am625-sk.dts +++ b/arch/arm/dts/k3-am625-sk.dts @@ -212,7 +212,7 @@ pinctrl-names = "default"; pinctrl-0 = <&ospi0_pins_default>; - flash@0{ + flash@0 { compatible = "jedec,spi-nor"; reg = <0x0>; spi-tx-bus-width = <8>; diff --git a/arch/arm/dts/k3-am64-main.dtsi b/arch/arm/dts/k3-am64-main.dtsi index 5e8036f..0df54a7 100644 --- a/arch/arm/dts/k3-am64-main.dtsi +++ b/arch/arm/dts/k3-am64-main.dtsi @@ -44,11 +44,28 @@ #size-cells = <1>; ranges = <0x0 0x0 0x43000000 0x20000>; + chipid@14 { + compatible = "ti,am654-chipid"; + reg = <0x00000014 0x4>; + }; + serdes_ln_ctrl: mux-controller { compatible = "mmio-mux"; #mux-control-cells = <1>; mux-reg-masks = <0x4080 0x3>; /* SERDES0 lane0 select */ }; + + phy_gmii_sel: phy@4044 { + compatible = "ti,am654-phy-gmii-sel"; + reg = <0x4044 0x8>; + #phy-cells = <1>; + }; + + epwm_tbclk: clock-controller@4140 { + compatible = "ti,am64-epwm-tbclk"; + reg = <0x4130 0x4>; + #clock-cells = <1>; + }; }; gic500: interrupt-controller@1800000 { @@ -203,29 +220,154 @@ pinctrl-single,function-mask = <0xffffffff>; }; - main_conf: syscon@43000000 { - compatible = "syscon", "simple-mfd"; - reg = <0x00 0x43000000 0x00 0x20000>; - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x00 0x00 0x43000000 0x20000>; + main_timer0: timer@2400000 { + compatible = "ti,am654-timer"; + reg = <0x00 0x2400000 0x00 0x400>; + interrupts = <GIC_SPI 120 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&k3_clks 36 1>; + clock-names = "fck"; + assigned-clocks = <&k3_clks 36 1>; + assigned-clock-parents = <&k3_clks 36 2>; + power-domains = <&k3_pds 36 TI_SCI_PD_EXCLUSIVE>; + ti,timer-pwm; + }; - chipid@14 { - compatible = "ti,am654-chipid"; - reg = <0x00000014 0x4>; - }; + main_timer1: timer@2410000 { + compatible = "ti,am654-timer"; + reg = <0x00 0x2410000 0x00 0x400>; + interrupts = <GIC_SPI 121 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&k3_clks 37 1>; + clock-names = "fck"; + assigned-clocks = <&k3_clks 37 1>; + assigned-clock-parents = <&k3_clks 37 2>; + power-domains = <&k3_pds 37 TI_SCI_PD_EXCLUSIVE>; + ti,timer-pwm; + }; - phy_gmii_sel: phy@4044 { - compatible = "ti,am654-phy-gmii-sel"; - reg = <0x4044 0x8>; - #phy-cells = <1>; - }; + main_timer2: timer@2420000 { + compatible = "ti,am654-timer"; + reg = <0x00 0x2420000 0x00 0x400>; + interrupts = <GIC_SPI 122 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&k3_clks 38 1>; + clock-names = "fck"; + assigned-clocks = <&k3_clks 38 1>; + assigned-clock-parents = <&k3_clks 38 2>; + power-domains = <&k3_pds 38 TI_SCI_PD_EXCLUSIVE>; + ti,timer-pwm; + }; - epwm_tbclk: clock@4140 { - compatible = "ti,am64-epwm-tbclk", "syscon"; - reg = <0x4130 0x4>; - #clock-cells = <1>; - }; + main_timer3: timer@2430000 { + compatible = "ti,am654-timer"; + reg = <0x00 0x2430000 0x00 0x400>; + interrupts = <GIC_SPI 123 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&k3_clks 39 1>; + clock-names = "fck"; + assigned-clocks = <&k3_clks 39 1>; + assigned-clock-parents = <&k3_clks 39 2>; + power-domains = <&k3_pds 39 TI_SCI_PD_EXCLUSIVE>; + ti,timer-pwm; + }; + + main_timer4: timer@2440000 { + compatible = "ti,am654-timer"; + reg = <0x00 0x2440000 0x00 0x400>; + interrupts = <GIC_SPI 124 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&k3_clks 40 1>; + clock-names = "fck"; + assigned-clocks = <&k3_clks 40 1>; + assigned-clock-parents = <&k3_clks 40 2>; + power-domains = <&k3_pds 40 TI_SCI_PD_EXCLUSIVE>; + ti,timer-pwm; + }; + + main_timer5: timer@2450000 { + compatible = "ti,am654-timer"; + reg = <0x00 0x2450000 0x00 0x400>; + interrupts = <GIC_SPI 125 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&k3_clks 41 1>; + clock-names = "fck"; + assigned-clocks = <&k3_clks 41 1>; + assigned-clock-parents = <&k3_clks 41 2>; + power-domains = <&k3_pds 41 TI_SCI_PD_EXCLUSIVE>; + ti,timer-pwm; + }; + + main_timer6: timer@2460000 { + compatible = "ti,am654-timer"; + reg = <0x00 0x2460000 0x00 0x400>; + interrupts = <GIC_SPI 126 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&k3_clks 42 1>; + clock-names = "fck"; + assigned-clocks = <&k3_clks 42 1>; + assigned-clock-parents = <&k3_clks 42 2>; + power-domains = <&k3_pds 42 TI_SCI_PD_EXCLUSIVE>; + ti,timer-pwm; + }; + + main_timer7: timer@2470000 { + compatible = "ti,am654-timer"; + reg = <0x00 0x2470000 0x00 0x400>; + interrupts = <GIC_SPI 127 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&k3_clks 43 1>; + clock-names = "fck"; + assigned-clocks = <&k3_clks 43 1>; + assigned-clock-parents = <&k3_clks 43 2>; + power-domains = <&k3_pds 43 TI_SCI_PD_EXCLUSIVE>; + ti,timer-pwm; + }; + + main_timer8: timer@2480000 { + compatible = "ti,am654-timer"; + reg = <0x00 0x2480000 0x00 0x400>; + interrupts = <GIC_SPI 128 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&k3_clks 44 1>; + clock-names = "fck"; + assigned-clocks = <&k3_clks 44 1>; + assigned-clock-parents = <&k3_clks 44 2>; + power-domains = <&k3_pds 44 TI_SCI_PD_EXCLUSIVE>; + ti,timer-pwm; + }; + + main_timer9: timer@2490000 { + compatible = "ti,am654-timer"; + reg = <0x00 0x2490000 0x00 0x400>; + interrupts = <GIC_SPI 129 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&k3_clks 45 1>; + clock-names = "fck"; + assigned-clocks = <&k3_clks 45 1>; + assigned-clock-parents = <&k3_clks 45 2>; + power-domains = <&k3_pds 45 TI_SCI_PD_EXCLUSIVE>; + ti,timer-pwm; + }; + + main_timer10: timer@24a0000 { + compatible = "ti,am654-timer"; + reg = <0x00 0x24a0000 0x00 0x400>; + interrupts = <GIC_SPI 130 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&k3_clks 46 1>; + clock-names = "fck"; + assigned-clocks = <&k3_clks 46 1>; + assigned-clock-parents = <&k3_clks 46 2>; + power-domains = <&k3_pds 46 TI_SCI_PD_EXCLUSIVE>; + ti,timer-pwm; + }; + + main_timer11: timer@24b0000 { + compatible = "ti,am654-timer"; + reg = <0x00 0x24b0000 0x00 0x400>; + interrupts = <GIC_SPI 131 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&k3_clks 47 1>; + clock-names = "fck"; + assigned-clocks = <&k3_clks 47 1>; + assigned-clock-parents = <&k3_clks 47 2>; + power-domains = <&k3_pds 47 TI_SCI_PD_EXCLUSIVE>; + ti,timer-pwm; + }; + + main_esm: esm@420000 { + compatible = "ti,j721e-esm"; + reg = <0x00 0x420000 0x00 0x1000>; + ti,esm-pins = <160>, <161>; }; main_uart0: serial@2800000 { @@ -233,7 +375,6 @@ reg = <0x00 0x02800000 0x00 0x100>; interrupts = <GIC_SPI 178 IRQ_TYPE_LEVEL_HIGH>; clock-frequency = <48000000>; - current-speed = <115200>; power-domains = <&k3_pds 146 TI_SCI_PD_EXCLUSIVE>; clocks = <&k3_clks 146 0>; clock-names = "fclk"; @@ -245,7 +386,6 @@ reg = <0x00 0x02810000 0x00 0x100>; interrupts = <GIC_SPI 179 IRQ_TYPE_LEVEL_HIGH>; clock-frequency = <48000000>; - current-speed = <115200>; power-domains = <&k3_pds 152 TI_SCI_PD_EXCLUSIVE>; clocks = <&k3_clks 152 0>; clock-names = "fclk"; @@ -257,7 +397,6 @@ reg = <0x00 0x02820000 0x00 0x100>; interrupts = <GIC_SPI 180 IRQ_TYPE_LEVEL_HIGH>; clock-frequency = <48000000>; - current-speed = <115200>; power-domains = <&k3_pds 153 TI_SCI_PD_EXCLUSIVE>; clocks = <&k3_clks 153 0>; clock-names = "fclk"; @@ -269,7 +408,6 @@ reg = <0x00 0x02830000 0x00 0x100>; interrupts = <GIC_SPI 181 IRQ_TYPE_LEVEL_HIGH>; clock-frequency = <48000000>; - current-speed = <115200>; power-domains = <&k3_pds 154 TI_SCI_PD_EXCLUSIVE>; clocks = <&k3_clks 154 0>; clock-names = "fclk"; @@ -281,7 +419,6 @@ reg = <0x00 0x02840000 0x00 0x100>; interrupts = <GIC_SPI 182 IRQ_TYPE_LEVEL_HIGH>; clock-frequency = <48000000>; - current-speed = <115200>; power-domains = <&k3_pds 155 TI_SCI_PD_EXCLUSIVE>; clocks = <&k3_clks 155 0>; clock-names = "fclk"; @@ -293,7 +430,6 @@ reg = <0x00 0x02850000 0x00 0x100>; interrupts = <GIC_SPI 183 IRQ_TYPE_LEVEL_HIGH>; clock-frequency = <48000000>; - current-speed = <115200>; power-domains = <&k3_pds 156 TI_SCI_PD_EXCLUSIVE>; clocks = <&k3_clks 156 0>; clock-names = "fclk"; @@ -305,7 +441,6 @@ reg = <0x00 0x02860000 0x00 0x100>; interrupts = <GIC_SPI 184 IRQ_TYPE_LEVEL_HIGH>; clock-frequency = <48000000>; - current-speed = <115200>; power-domains = <&k3_pds 158 TI_SCI_PD_EXCLUSIVE>; clocks = <&k3_clks 158 0>; clock-names = "fclk"; @@ -590,7 +725,7 @@ pinctrl-single,function-mask = <0x000107ff>; }; - usbss0: cdns-usb@f900000{ + usbss0: cdns-usb@f900000 { compatible = "ti,am64-usb"; reg = <0x00 0xf900000 0x00 0x100>; power-domains = <&k3_pds 161 TI_SCI_PD_EXCLUSIVE>; @@ -601,7 +736,7 @@ #address-cells = <2>; #size-cells = <2>; ranges; - usb0: usb@f400000{ + usb0: usb@f400000 { compatible = "cdns,usb3"; reg = <0x00 0xf400000 0x00 0x10000>, <0x00 0xf410000 0x00 0x10000>, @@ -630,6 +765,7 @@ assigned-clock-parents = <&k3_clks 0 3>; assigned-clock-rates = <60000000>; clock-names = "fck"; + status = "disabled"; adc { #io-channel-cells = <1>; @@ -659,6 +795,7 @@ assigned-clock-parents = <&k3_clks 75 7>; assigned-clock-rates = <166666666>; power-domains = <&k3_pds 75 TI_SCI_PD_EXCLUSIVE>; + status = "disabled"; }; }; @@ -676,6 +813,7 @@ #mbox-cells = <1>; ti,mbox-num-users = <4>; ti,mbox-num-fifos = <16>; + status = "disabled"; }; mailbox0_cluster3: mailbox@29030000 { @@ -686,6 +824,7 @@ #mbox-cells = <1>; ti,mbox-num-users = <4>; ti,mbox-num-fifos = <16>; + status = "disabled"; }; mailbox0_cluster4: mailbox@29040000 { @@ -696,6 +835,7 @@ #mbox-cells = <1>; ti,mbox-num-users = <4>; ti,mbox-num-fifos = <16>; + status = "disabled"; }; mailbox0_cluster5: mailbox@29050000 { @@ -706,6 +846,7 @@ #mbox-cells = <1>; ti,mbox-num-users = <4>; ti,mbox-num-fifos = <16>; + status = "disabled"; }; mailbox0_cluster6: mailbox@29060000 { @@ -715,6 +856,7 @@ #mbox-cells = <1>; ti,mbox-num-users = <4>; ti,mbox-num-fifos = <16>; + status = "disabled"; }; mailbox0_cluster7: mailbox@29070000 { @@ -724,6 +866,7 @@ #mbox-cells = <1>; ti,mbox-num-users = <4>; ti,mbox-num-fifos = <16>; + status = "disabled"; }; main_r5fss0: r5fss@78000000 { @@ -1392,4 +1535,12 @@ clock-names = "fck"; status = "disabled"; }; + + main_vtm0: temperature-sensor@b00000 { + compatible = "ti,j7200-vtm"; + reg = <0x00 0xb00000 0x00 0x400>, + <0x00 0xb01000 0x00 0x400>; + power-domains = <&k3_pds 95 TI_SCI_PD_EXCLUSIVE>; + #thermal-sensor-cells = <1>; + }; }; diff --git a/arch/arm/dts/k3-am64-mcu.dtsi b/arch/arm/dts/k3-am64-mcu.dtsi index 38ddf0b..686d497 100644 --- a/arch/arm/dts/k3-am64-mcu.dtsi +++ b/arch/arm/dts/k3-am64-mcu.dtsi @@ -6,11 +6,55 @@ */ &cbass_mcu { + /* + * The MCU domain timer interrupts are routed only to the ESM module, + * and not currently available for Linux. The MCU domain timers are + * of limited use without interrupts, and likely reserved by the ESM. + */ + mcu_timer0: timer@4800000 { + compatible = "ti,am654-timer"; + reg = <0x00 0x4800000 0x00 0x400>; + clocks = <&k3_clks 35 1>; + clock-names = "fck"; + power-domains = <&k3_pds 35 TI_SCI_PD_EXCLUSIVE>; + ti,timer-pwm; + status = "reserved"; + }; + + mcu_timer1: timer@4810000 { + compatible = "ti,am654-timer"; + reg = <0x00 0x4810000 0x00 0x400>; + clocks = <&k3_clks 48 1>; + clock-names = "fck"; + power-domains = <&k3_pds 48 TI_SCI_PD_EXCLUSIVE>; + ti,timer-pwm; + status = "reserved"; + }; + + mcu_timer2: timer@4820000 { + compatible = "ti,am654-timer"; + reg = <0x00 0x4820000 0x00 0x400>; + clocks = <&k3_clks 49 1>; + clock-names = "fck"; + power-domains = <&k3_pds 49 TI_SCI_PD_EXCLUSIVE>; + ti,timer-pwm; + status = "reserved"; + }; + + mcu_timer3: timer@4830000 { + compatible = "ti,am654-timer"; + reg = <0x00 0x4830000 0x00 0x400>; + clocks = <&k3_clks 50 1>; + clock-names = "fck"; + power-domains = <&k3_pds 50 TI_SCI_PD_EXCLUSIVE>; + ti,timer-pwm; + status = "reserved"; + }; + mcu_uart0: serial@4a00000 { compatible = "ti,am64-uart", "ti,am654-uart"; reg = <0x00 0x04a00000 0x00 0x100>; interrupts = <GIC_SPI 185 IRQ_TYPE_LEVEL_HIGH>; - current-speed = <115200>; power-domains = <&k3_pds 149 TI_SCI_PD_EXCLUSIVE>; clocks = <&k3_clks 149 0>; clock-names = "fclk"; @@ -21,7 +65,6 @@ compatible = "ti,am64-uart", "ti,am654-uart"; reg = <0x00 0x04a10000 0x00 0x100>; interrupts = <GIC_SPI 186 IRQ_TYPE_LEVEL_HIGH>; - current-speed = <115200>; power-domains = <&k3_pds 160 TI_SCI_PD_EXCLUSIVE>; clocks = <&k3_clks 160 0>; clock-names = "fclk"; @@ -109,4 +152,10 @@ pinctrl-single,register-width = <32>; pinctrl-single,function-mask = <0xffffffff>; }; + + mcu_esm: esm@4100000 { + compatible = "ti,j721e-esm"; + reg = <0x00 0x4100000 0x00 0x1000>; + ti,esm-pins = <0>, <1>; + }; }; diff --git a/arch/arm/dts/k3-am64-thermal.dtsi b/arch/arm/dts/k3-am64-thermal.dtsi new file mode 100644 index 0000000..036db56 --- /dev/null +++ b/arch/arm/dts/k3-am64-thermal.dtsi @@ -0,0 +1,33 @@ +// SPDX-License-Identifier: GPL-2.0 + +#include <dt-bindings/thermal/thermal.h> + +thermal_zones: thermal-zones { + main0_thermal: main0-thermal { + polling-delay-passive = <250>; /* milliSeconds */ + polling-delay = <500>; /* milliSeconds */ + thermal-sensors = <&main_vtm0 0>; + + trips { + main0_crit: main0-crit { + temperature = <105000>; /* milliCelsius */ + hysteresis = <2000>; /* milliCelsius */ + type = "critical"; + }; + }; + }; + + main1_thermal: main1-thermal { + polling-delay-passive = <250>; /* milliSeconds */ + polling-delay = <500>; /* milliSeconds */ + thermal-sensors = <&main_vtm0 1>; + + trips { + main1_crit: main1-crit { + temperature = <105000>; /* milliCelsius */ + hysteresis = <2000>; /* milliCelsius */ + type = "critical"; + }; + }; + }; +}; diff --git a/arch/arm/dts/k3-am64.dtsi b/arch/arm/dts/k3-am64.dtsi index c858725..8e9c2bc 100644 --- a/arch/arm/dts/k3-am64.dtsi +++ b/arch/arm/dts/k3-am64.dtsi @@ -8,9 +8,10 @@ #include <dt-bindings/gpio/gpio.h> #include <dt-bindings/interrupt-controller/irq.h> #include <dt-bindings/interrupt-controller/arm-gic.h> -#include <dt-bindings/pinctrl/k3.h> #include <dt-bindings/soc/ti,sci_pm_domain.h> +#include "k3-pinctrl.h" + / { model = "Texas Instruments K3 AM642 SoC"; compatible = "ti,am642"; @@ -18,22 +19,6 @@ #address-cells = <2>; #size-cells = <2>; - aliases { - serial0 = &mcu_uart0; - serial1 = &mcu_uart1; - serial2 = &main_uart0; - serial3 = &main_uart1; - serial4 = &main_uart2; - serial5 = &main_uart3; - serial6 = &main_uart4; - serial7 = &main_uart5; - serial8 = &main_uart6; - ethernet0 = &cpsw_port1; - ethernet1 = &cpsw_port2; - mmc0 = &sdhci0; - mmc1 = &sdhci1; - }; - chosen { }; firmware { @@ -69,6 +54,7 @@ <0x00 0x00420000 0x00 0x00420000 0x00 0x00001000>, /* ESM0 */ <0x00 0x00600000 0x00 0x00600000 0x00 0x00001100>, /* GPIO */ <0x00 0x00a40000 0x00 0x00a40000 0x00 0x00000800>, /* Timesync router */ + <0x00 0x00b00000 0x00 0x00b00000 0x00 0x00002400>, /* VTM */ <0x00 0x01000000 0x00 0x01000000 0x00 0x02330400>, /* First peripheral window */ <0x00 0x08000000 0x00 0x08000000 0x00 0x00200000>, /* Main CPSW */ <0x00 0x0d000000 0x00 0x0d000000 0x00 0x00800000>, /* PCIE_CORE */ @@ -105,6 +91,8 @@ ranges = <0x00 0x04000000 0x00 0x04000000 0x00 0x01ff1400>; /* Peripheral window */ }; }; + + #include "k3-am64-thermal.dtsi" }; /* Now include the peripherals for each bus segments */ diff --git a/arch/arm/dts/k3-am642-evm-u-boot.dtsi b/arch/arm/dts/k3-am642-evm-u-boot.dtsi index 73577e8..c85f57d 100644 --- a/arch/arm/dts/k3-am642-evm-u-boot.dtsi +++ b/arch/arm/dts/k3-am642-evm-u-boot.dtsi @@ -7,8 +7,7 @@ / { chosen { - stdout-path = "serial2:115200n8"; - tick-timer = &timer1; + tick-timer = &main_timer0; }; memory@80000000 { @@ -16,15 +15,21 @@ }; }; -&cbass_main{ +&vtt_supply { bootph-pre-ram; - timer1: timer@2400000 { - compatible = "ti,omap5430-timer"; - reg = <0x0 0x2400000 0x0 0x80>; - ti,timer-alwon; - clock-frequency = <200000000>; - bootph-pre-ram; - }; +}; + +&cbass_main { + bootph-pre-ram; +}; + +&cbass_mcu { + bootph-pre-ram; +}; + +&main_timer0 { + bootph-pre-ram; + clock-frequency = <200000000>; }; &main_conf { @@ -36,21 +41,18 @@ &main_pmx0 { bootph-pre-ram; - main_i2c0_pins_default: main-i2c0-pins-default { - bootph-pre-ram; - pinctrl-single,pins = < - AM64X_IOPAD(0x0260, PIN_INPUT_PULLUP, 0) /* (A18) I2C0_SCL */ - AM64X_IOPAD(0x0264, PIN_INPUT_PULLUP, 0) /* (B18) I2C0_SDA */ - >; - }; +}; + +&main_i2c0_pins_default { + bootph-pre-ram; }; &main_i2c0 { - status = "okay"; bootph-pre-ram; - pinctrl-names = "default"; - pinctrl-0 = <&main_i2c0_pins_default>; - clock-frequency = <400000>; +}; + +&main_uart0_pins_default { + bootph-pre-ram; }; &main_uart0 { @@ -111,18 +113,7 @@ }; &cpsw3g { - reg = <0x0 0x8000000 0x0 0x200000>, - <0x0 0x43000200 0x0 0x8>; - reg-names = "cpsw_nuss", "mac_efuse"; - /delete-property/ ranges; - pinctrl-0 = <&mdio1_pins_default /* HACK: as MDIO driver is not DM enabled */ - &rgmii1_pins_default - &rgmii2_pins_default>; - - cpsw-phy-sel@04044 { - compatible = "ti,am64-phy-gmii-sel"; - reg = <0x0 0x43004044 0x0 0x8>; - }; + bootph-pre-ram; }; &cpsw_port2 { diff --git a/arch/arm/dts/k3-am642-evm.dts b/arch/arm/dts/k3-am642-evm.dts index 39feea7..b4a1f73 100644 --- a/arch/arm/dts/k3-am642-evm.dts +++ b/arch/arm/dts/k3-am642-evm.dts @@ -6,26 +6,38 @@ /dts-v1/; #include <dt-bindings/phy/phy.h> -#include <dt-bindings/mux/ti-serdes.h> #include <dt-bindings/leds/common.h> #include <dt-bindings/gpio/gpio.h> #include <dt-bindings/net/ti-dp83867.h> #include "k3-am642.dtsi" +#include "k3-serdes.h" + / { compatible = "ti,am642-evm", "ti,am642"; model = "Texas Instruments AM642 EVM"; chosen { - stdout-path = "serial2:115200n8"; - bootargs = "console=ttyS2,115200n8 earlycon=ns16550a,mmio32,0x02800000"; + stdout-path = &main_uart0; + }; + + aliases { + serial0 = &mcu_uart0; + serial1 = &main_uart1; + serial2 = &main_uart0; + serial3 = &main_uart3; + i2c0 = &main_i2c0; + i2c1 = &main_i2c1; + mmc0 = &sdhci0; + mmc1 = &sdhci1; + ethernet0 = &cpsw_port1; + ethernet1 = &cpsw_port2; }; memory@80000000 { device_type = "memory"; /* 2G RAM */ reg = <0x00000000 0x80000000 0x00000000 0x80000000>; - }; reserved-memory { @@ -94,7 +106,7 @@ }; }; - evm_12v0: fixedregulator-evm12v0 { + evm_12v0: regulator-0 { /* main DC jack */ compatible = "regulator-fixed"; regulator-name = "evm_12v0"; @@ -104,7 +116,7 @@ regulator-boot-on; }; - vsys_5v0: fixedregulator-vsys5v0 { + vsys_5v0: regulator-1 { /* output of LM5140 */ compatible = "regulator-fixed"; regulator-name = "vsys_5v0"; @@ -115,7 +127,7 @@ regulator-boot-on; }; - vsys_3v3: fixedregulator-vsys3v3 { + vsys_3v3: regulator-2 { /* output of LM5140 */ compatible = "regulator-fixed"; regulator-name = "vsys_3v3"; @@ -126,7 +138,7 @@ regulator-boot-on; }; - vdd_mmc1: fixed-regulator-sd { + vdd_mmc1: regulator-3 { /* TPS2051BD */ compatible = "regulator-fixed"; regulator-name = "vdd_mmc1"; @@ -138,7 +150,7 @@ gpio = <&exp1 6 GPIO_ACTIVE_HIGH>; }; - vddb: fixedregulator-vddb { + vddb: regulator-4 { compatible = "regulator-fixed"; regulator-name = "vddb_3v3_display"; regulator-min-microvolt = <3300000>; @@ -148,6 +160,20 @@ regulator-boot-on; }; + vtt_supply: regulator-5 { + compatible = "regulator-fixed"; + regulator-name = "vtt"; + pinctrl-names = "default"; + pinctrl-0 = <&ddr_vtt_pins_default>; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + gpio = <&main_gpio0 12 GPIO_ACTIVE_HIGH>; + vin-supply = <&vsys_3v3>; + enable-active-high; + regulator-always-on; + regulator-boot-on; + }; + leds { compatible = "gpio-leds"; @@ -201,7 +227,7 @@ }; &main_pmx0 { - main_mmc1_pins_default: main-mmc1-pins-default { + main_mmc1_pins_default: main-mmc1-default-pins { pinctrl-single,pins = < AM64X_IOPAD(0x0294, PIN_INPUT_PULLUP, 0) /* (J19) MMC1_CMD */ AM64X_IOPAD(0x028c, PIN_INPUT_PULLDOWN, 0) /* (L20) MMC1_CLK */ @@ -215,7 +241,16 @@ >; }; - main_uart0_pins_default: main-uart0-pins-default { + main_uart1_pins_default: main-uart1-default-pins { + pinctrl-single,pins = < + AM64X_IOPAD(0x0248, PIN_INPUT, 0) /* (D16) UART1_CTSn */ + AM64X_IOPAD(0x024c, PIN_OUTPUT, 0) /* (E16) UART1_RTSn */ + AM64X_IOPAD(0x0240, PIN_INPUT, 0) /* (E15) UART1_RXD */ + AM64X_IOPAD(0x0244, PIN_OUTPUT, 0) /* (E14) UART1_TXD */ + >; + }; + + main_uart0_pins_default: main-uart0-default-pins { pinctrl-single,pins = < AM64X_IOPAD(0x0238, PIN_INPUT, 0) /* (B16) UART0_CTSn */ AM64X_IOPAD(0x023c, PIN_OUTPUT, 0) /* (A16) UART0_RTSn */ @@ -224,7 +259,7 @@ >; }; - main_spi0_pins_default: main-spi0-pins-default { + main_spi0_pins_default: main-spi0-default-pins { pinctrl-single,pins = < AM64X_IOPAD(0x0210, PIN_INPUT, 0) /* (D13) SPI0_CLK */ AM64X_IOPAD(0x0208, PIN_OUTPUT, 0) /* (D12) SPI0_CS0 */ @@ -233,21 +268,28 @@ >; }; - main_i2c1_pins_default: main-i2c1-pins-default { + main_i2c0_pins_default: main-i2c0-default-pins { + pinctrl-single,pins = < + AM64X_IOPAD(0x0260, PIN_INPUT_PULLUP, 0) /* (A18) I2C0_SCL */ + AM64X_IOPAD(0x0264, PIN_INPUT_PULLUP, 0) /* (B18) I2C0_SDA */ + >; + }; + + main_i2c1_pins_default: main-i2c1-default-pins { pinctrl-single,pins = < AM64X_IOPAD(0x0268, PIN_INPUT_PULLUP, 0) /* (C18) I2C1_SCL */ AM64X_IOPAD(0x026c, PIN_INPUT_PULLUP, 0) /* (B19) I2C1_SDA */ >; }; - mdio1_pins_default: mdio1-pins-default { + mdio1_pins_default: mdio1-default-pins { pinctrl-single,pins = < AM64X_IOPAD(0x01fc, PIN_OUTPUT, 4) /* (R2) PRG0_PRU1_GPO19.MDIO0_MDC */ AM64X_IOPAD(0x01f8, PIN_INPUT, 4) /* (P5) PRG0_PRU1_GPO18.MDIO0_MDIO */ >; }; - rgmii1_pins_default: rgmii1-pins-default { + rgmii1_pins_default: rgmii1-default-pins { pinctrl-single,pins = < AM64X_IOPAD(0x01cc, PIN_INPUT, 4) /* (W5) PRG0_PRU1_GPO7.RGMII1_RD0 */ AM64X_IOPAD(0x01d4, PIN_INPUT, 4) /* (Y5) PRG0_PRU1_GPO9.RGMII1_RD1 */ @@ -264,7 +306,7 @@ >; }; - rgmii2_pins_default: rgmii2-pins-default { + rgmii2_pins_default: rgmii2-default-pins { pinctrl-single,pins = < AM64X_IOPAD(0x0108, PIN_INPUT, 4) /* (W11) PRG1_PRU1_GPO0.RGMII2_RD0 */ AM64X_IOPAD(0x010c, PIN_INPUT, 4) /* (V11) PRG1_PRU1_GPO1.RGMII2_RD1 */ @@ -281,13 +323,13 @@ >; }; - main_usb0_pins_default: main-usb0-pins-default { + main_usb0_pins_default: main-usb0-default-pins { pinctrl-single,pins = < AM64X_IOPAD(0x02a8, PIN_OUTPUT, 0) /* (E19) USB0_DRVVBUS */ >; }; - ospi0_pins_default: ospi0-pins-default { + ospi0_pins_default: ospi0-default-pins { pinctrl-single,pins = < AM64X_IOPAD(0x0000, PIN_OUTPUT, 0) /* (N20) OSPI0_CLK */ AM64X_IOPAD(0x002c, PIN_OUTPUT, 0) /* (L19) OSPI0_CSn0 */ @@ -303,36 +345,58 @@ >; }; - main_ecap0_pins_default: main-ecap0-pins-default { + main_ecap0_pins_default: main-ecap0-default-pins { pinctrl-single,pins = < AM64X_IOPAD(0x0270, PIN_INPUT, 0) /* (D18) ECAP0_IN_APWM_OUT */ >; }; - main_mcan0_pins_default: main-mcan0-pins-default { + main_mcan0_pins_default: main-mcan0-default-pins { pinctrl-single,pins = < AM64X_IOPAD(0x0254, PIN_INPUT, 0) /* (B17) MCAN0_RX */ AM64X_IOPAD(0x0250, PIN_OUTPUT, 0) /* (A17) MCAN0_TX */ >; }; - main_mcan1_pins_default: main-mcan1-pins-default { + main_mcan1_pins_default: main-mcan1-default-pins { pinctrl-single,pins = < AM64X_IOPAD(0x025c, PIN_INPUT, 0) /* (D17) MCAN1_RX */ AM64X_IOPAD(0x0258, PIN_OUTPUT, 0) /* (C17) MCAN1_TX */ >; }; + + ddr_vtt_pins_default: ddr-vtt-default-pins { + pinctrl-single,pins = < + AM64X_IOPAD(0x0030, PIN_OUTPUT_PULLUP, 7) /* (L18) OSPI0_CSN1.GPIO0_12 */ + >; + }; }; &main_uart0 { status = "okay"; pinctrl-names = "default"; pinctrl-0 = <&main_uart0_pins_default>; + current-speed = <115200>; }; /* main_uart1 is reserved for firmware usage */ &main_uart1 { status = "reserved"; + pinctrl-names = "default"; + pinctrl-0 = <&main_uart1_pins_default>; +}; + +&main_i2c0 { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&main_i2c0_pins_default>; + clock-frequency = <400000>; + + eeprom@50 { + /* AT24CM01 */ + compatible = "atmel,24c1024"; + reg = <0x50>; + }; }; &main_i2c1 { @@ -425,8 +489,7 @@ &cpsw3g { pinctrl-names = "default"; - pinctrl-0 = <&rgmii1_pins_default - &rgmii2_pins_default>; + pinctrl-0 = <&rgmii1_pins_default>, <&rgmii2_pins_default>; }; &cpsw_port1 { @@ -457,6 +520,7 @@ }; &ospi0 { + status = "okay"; pinctrl-names = "default"; pinctrl-0 = <&ospi0_pins_default>; @@ -471,10 +535,53 @@ cdns,tchsh-ns = <60>; cdns,tslch-ns = <60>; cdns,read-delay = <4>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "ospi.tiboot3"; + reg = <0x0 0x100000>; + }; + + partition@100000 { + label = "ospi.tispl"; + reg = <0x100000 0x200000>; + }; + + partition@300000 { + label = "ospi.u-boot"; + reg = <0x300000 0x400000>; + }; + + partition@700000 { + label = "ospi.env"; + reg = <0x700000 0x40000>; + }; + + partition@740000 { + label = "ospi.env.backup"; + reg = <0x740000 0x40000>; + }; + + partition@800000 { + label = "ospi.rootfs"; + reg = <0x800000 0x37c0000>; + }; + + partition@3fc0000 { + label = "ospi.phypattern"; + reg = <0x3fc0000 0x40000>; + }; + }; }; }; &mailbox0_cluster2 { + status = "okay"; + mbox_main_r5fss0_core0: mbox-main-r5fss0-core0 { ti,mbox-rx = <0 0 2>; ti,mbox-tx = <1 0 2>; @@ -486,11 +593,9 @@ }; }; -&mailbox0_cluster3 { - status = "disabled"; -}; - &mailbox0_cluster4 { + status = "okay"; + mbox_main_r5fss1_core0: mbox-main-r5fss1-core0 { ti,mbox-rx = <0 0 2>; ti,mbox-tx = <1 0 2>; @@ -502,41 +607,35 @@ }; }; -&mailbox0_cluster5 { - status = "disabled"; -}; - &mailbox0_cluster6 { + status = "okay"; + mbox_m4_0: mbox-m4-0 { ti,mbox-rx = <0 0 2>; ti,mbox-tx = <1 0 2>; }; }; -&mailbox0_cluster7 { - status = "disabled"; -}; - &main_r5fss0_core0 { - mboxes = <&mailbox0_cluster2 &mbox_main_r5fss0_core0>; + mboxes = <&mailbox0_cluster2>, <&mbox_main_r5fss0_core0>; memory-region = <&main_r5fss0_core0_dma_memory_region>, <&main_r5fss0_core0_memory_region>; }; &main_r5fss0_core1 { - mboxes = <&mailbox0_cluster2 &mbox_main_r5fss0_core1>; + mboxes = <&mailbox0_cluster2>, <&mbox_main_r5fss0_core1>; memory-region = <&main_r5fss0_core1_dma_memory_region>, <&main_r5fss0_core1_memory_region>; }; &main_r5fss1_core0 { - mboxes = <&mailbox0_cluster4 &mbox_main_r5fss1_core0>; + mboxes = <&mailbox0_cluster4>, <&mbox_main_r5fss1_core0>; memory-region = <&main_r5fss1_core0_dma_memory_region>, <&main_r5fss1_core0_memory_region>; }; &main_r5fss1_core1 { - mboxes = <&mailbox0_cluster4 &mbox_main_r5fss1_core1>; + mboxes = <&mailbox0_cluster4>, <&mbox_main_r5fss1_core1>; memory-region = <&main_r5fss1_core1_dma_memory_region>, <&main_r5fss1_core1_memory_region>; }; diff --git a/arch/arm/dts/k3-am642-r5-evm.dts b/arch/arm/dts/k3-am642-r5-evm.dts index b490641..73461f8 100644 --- a/arch/arm/dts/k3-am642-r5-evm.dts +++ b/arch/arm/dts/k3-am642-r5-evm.dts @@ -1,34 +1,20 @@ // SPDX-License-Identifier: GPL-2.0 /* - * Copyright (C) 2020-2021 Texas Instruments Incorporated - https://www.ti.com/ + * Copyright (C) 2020-2023 Texas Instruments Incorporated - https://www.ti.com/ */ -/dts-v1/; - -#include "k3-am642.dtsi" +#include "k3-am642-evm.dts" #include "k3-am64-evm-ddr4-1600MTs.dtsi" #include "k3-am64-ddr.dtsi" -#include "k3-am64x-binman.dtsi" -/ { - chosen { - stdout-path = "serial2:115200n8"; - tick-timer = &timer1; - }; +#include "k3-am642-evm-u-boot.dtsi" +/ { aliases { remoteproc0 = &sysctrler; remoteproc1 = &a53_0; }; - memory@80000000 { - device_type = "memory"; - /* 2G RAM */ - reg = <0x00000000 0x80000000 0x00000000 0x80000000>; - - bootph-pre-ram; - }; - a53_0: a53@0 { compatible = "ti,am654-rproc"; reg = <0x00 0x00a90000 0x00 0x10>; @@ -46,34 +32,12 @@ bootph-pre-ram; }; - reserved-memory { - #address-cells = <2>; - #size-cells = <2>; - ranges; - - secure_ddr: optee@9e800000 { - reg = <0x00 0x9e800000 0x00 0x01800000>; /* for OP-TEE */ - alignment = <0x1000>; - no-map; - }; - }; - clk_200mhz: dummy-clock-200mhz { compatible = "fixed-clock"; #clock-cells = <0>; clock-frequency = <200000000>; bootph-pre-ram; }; - - vtt_supply: vtt-supply { - compatible = "regulator-gpio"; - regulator-name = "vtt"; - regulator-min-microvolt = <0>; - regulator-max-microvolt = <3300000>; - gpios = <&main_gpio0 12 GPIO_ACTIVE_HIGH>; - states = <0 0x0 3300000 0x1>; - bootph-pre-ram; - }; }; &cbass_main { @@ -85,131 +49,12 @@ }; }; -&cbass_main { - main_esm: esm@420000 { - compatible = "ti,j721e-esm"; - reg = <0x0 0x420000 0x0 0x1000>; - ti,esm-pins = <160>, <161>; - bootph-pre-ram; - }; -}; - -&cbass_mcu { +&main_esm { bootph-pre-ram; - mcu_esm: esm@4100000 { - compatible = "ti,j721e-esm"; - reg = <0x0 0x4100000 0x0 0x1000>; - ti,esm-pins = <0>, <1>; - bootph-pre-ram; - }; }; -&main_pmx0 { +&mcu_esm { bootph-pre-ram; - main_uart0_pins_default: main-uart0-pins-default { - bootph-pre-ram; - pinctrl-single,pins = < - AM64X_IOPAD(0x0238, PIN_INPUT, 0) /* (B16) UART0_CTSn */ - AM64X_IOPAD(0x023c, PIN_OUTPUT, 0) /* (A16) UART0_RTSn */ - AM64X_IOPAD(0x0230, PIN_INPUT, 0) /* (D15) UART0_RXD */ - AM64X_IOPAD(0x0234, PIN_OUTPUT, 0) /* (C16) UART0_TXD */ - >; - }; - - main_uart1_pins_default: main-uart1-pins-default { - bootph-pre-ram; - pinctrl-single,pins = < - AM64X_IOPAD(0x0248, PIN_INPUT, 0) /* (D16) UART1_CTSn */ - AM64X_IOPAD(0x024c, PIN_OUTPUT, 0) /* (E16) UART1_RTSn */ - AM64X_IOPAD(0x0240, PIN_INPUT, 0) /* (E15) UART1_RXD */ - AM64X_IOPAD(0x0244, PIN_OUTPUT, 0) /* (E14) UART1_TXD */ - >; - }; - - main_mmc0_pins_default: main-mmc0-pins-default { - bootph-pre-ram; - pinctrl-single,pins = < - AM64X_IOPAD(0x01a8, PIN_INPUT_PULLDOWN, 0) /* (B25) MMC0_CLK */ - AM64X_IOPAD(0x01aC, PIN_INPUT_PULLUP, 0) /* (B27) MMC0_CMD */ - AM64X_IOPAD(0x01a4, PIN_INPUT_PULLUP, 0) /* (A26) MMC0_DAT0 */ - AM64X_IOPAD(0x01a0, PIN_INPUT_PULLUP, 0) /* (E25) MMC0_DAT1 */ - AM64X_IOPAD(0x019c, PIN_INPUT_PULLUP, 0) /* (C26) MMC0_DAT2 */ - AM64X_IOPAD(0x0198, PIN_INPUT_PULLUP, 0) /* (A25) MMC0_DAT3 */ - AM64X_IOPAD(0x0194, PIN_INPUT_PULLUP, 0) /* (E24) MMC0_DAT4 */ - AM64X_IOPAD(0x0190, PIN_INPUT_PULLUP, 0) /* (A24) MMC0_DAT5 */ - AM64X_IOPAD(0x018c, PIN_INPUT_PULLUP, 0) /* (B26) MMC0_DAT6 */ - AM64X_IOPAD(0x0188, PIN_INPUT_PULLUP, 0) /* (D25) MMC0_DAT7 */ - AM64X_IOPAD(0x01b0, PIN_INPUT, 0) /* (C25) MMC0_DS */ - >; - }; - - main_mmc1_pins_default: main-mmc1-pins-default { - bootph-pre-ram; - pinctrl-single,pins = < - AM64X_IOPAD(0x0294, PIN_INPUT_PULLUP, 0) /* (J19) MMC1_CMD */ - AM64X_IOPAD(0x028c, PIN_INPUT_PULLDOWN, 0) /* (L20) MMC1_CLK */ - AM64X_IOPAD(0x0288, PIN_INPUT_PULLUP, 0) /* (K21) MMC1_DAT0 */ - AM64X_IOPAD(0x0284, PIN_INPUT_PULLUP, 0) /* (L21) MMC1_DAT1 */ - AM64X_IOPAD(0x0280, PIN_INPUT_PULLUP, 0) /* (K19) MMC1_DAT2 */ - AM64X_IOPAD(0x027c, PIN_INPUT_PULLUP, 0) /* (K18) MMC1_DAT3 */ - AM64X_IOPAD(0x0298, PIN_INPUT_PULLUP, 0) /* (D19) MMC1_SDCD */ - AM64X_IOPAD(0x029c, PIN_INPUT_PULLUP, 0) /* (C20) MMC1_SDWP */ - >; - }; - - ddr_vtt_pins_default: ddr-vtt-pins-default { - bootph-pre-ram; - pinctrl-single,pins = < - AM64X_IOPAD(0x0030, PIN_OUTPUT_PULLUP, 7) /* (L18) OSPI0_CSN1.GPIO0_12 */ - >; - }; - - main_usb0_pins_default: main-usb0-pins-default { - pinctrl-single,pins = < - AM64X_IOPAD(0x02a8, PIN_OUTPUT, 0) /* (E19) USB0_DRVVBUS */ - >; - }; - - mdio1_pins_default: mdio1-pins-default { - pinctrl-single,pins = < - AM64X_IOPAD(0x01fc, PIN_OUTPUT, 4) /* (R2) PRG0_PRU1_GPO19.MDIO0_MDC */ - AM64X_IOPAD(0x01f8, PIN_INPUT, 4) /* (P5) PRG0_PRU1_GPO18.MDIO0_MDIO */ - >; - }; - - rgmii1_pins_default: rgmii1-pins-default { - pinctrl-single,pins = < - AM64X_IOPAD(0x01cc, PIN_INPUT, 4) /* (W5) PRG0_PRU1_GPO7.RGMII1_RD0 */ - AM64X_IOPAD(0x01d4, PIN_INPUT, 4) /* (Y5) PRG0_PRU1_GPO9.RGMII1_RD1 */ - AM64X_IOPAD(0x01d8, PIN_INPUT, 4) /* (V6) PRG0_PRU1_GPO10.RGMII1_RD2 */ - AM64X_IOPAD(0x01f4, PIN_INPUT, 4) /* (V5) PRG0_PRU1_GPO17.RGMII1_RD3 */ - AM64X_IOPAD(0x0188, PIN_INPUT, 4) /* (AA5) PRG0_PRU0_GPO10.RGMII1_RXC */ - AM64X_IOPAD(0x0184, PIN_INPUT, 4) /* (W6) PRG0_PRU0_GPO9.RGMII1_RX_CTL */ - AM64X_IOPAD(0x0124, PIN_OUTPUT, 4) /* (V15) PRG1_PRU1_GPO7.RGMII1_TD0 */ - AM64X_IOPAD(0x012c, PIN_OUTPUT, 4) /* (V14) PRG1_PRU1_GPO9.RGMII1_TD1 */ - AM64X_IOPAD(0x0130, PIN_OUTPUT, 4) /* (W14) PRG1_PRU1_GPO10.RGMII1_TD2 */ - AM64X_IOPAD(0x014c, PIN_OUTPUT, 4) /* (AA14) PRG1_PRU1_GPO17.RGMII1_TD3 */ - AM64X_IOPAD(0x00e0, PIN_OUTPUT, 4) /* (U14) PRG1_PRU0_GPO10.RGMII1_TXC */ - AM64X_IOPAD(0x00dc, PIN_OUTPUT, 4) /* (U15) PRG1_PRU0_GPO9.RGMII1_TX_CTL */ - >; - }; - - rgmii2_pins_default: rgmii2-pins-default { - pinctrl-single,pins = < - AM64X_IOPAD(0x0108, PIN_INPUT, 4) /* (W11) PRG1_PRU1_GPO0.RGMII2_RD0 */ - AM64X_IOPAD(0x010c, PIN_INPUT, 4) /* (V11) PRG1_PRU1_GPO1.RGMII2_RD1 */ - AM64X_IOPAD(0x0110, PIN_INPUT, 4) /* (AA12) PRG1_PRU1_GPO2.RGMII2_RD2 */ - AM64X_IOPAD(0x0114, PIN_INPUT, 4) /* (Y12) PRG1_PRU1_GPO3.RGMII2_RD3 */ - AM64X_IOPAD(0x0120, PIN_INPUT, 4) /* (U11) PRG1_PRU1_GPO6.RGMII2_RXC */ - AM64X_IOPAD(0x0118, PIN_INPUT, 4) /* (W12) PRG1_PRU1_GPO4.RGMII2_RX_CTL */ - AM64X_IOPAD(0x0134, PIN_OUTPUT, 4) /* (AA10) PRG1_PRU1_GPO11.RGMII2_TD0 */ - AM64X_IOPAD(0x0138, PIN_OUTPUT, 4) /* (V10) PRG1_PRU1_GPO12.RGMII2_TD1 */ - AM64X_IOPAD(0x013c, PIN_OUTPUT, 4) /* (U10) PRG1_PRU1_GPO13.RGMII2_TD2 */ - AM64X_IOPAD(0x0140, PIN_OUTPUT, 4) /* (AA11) PRG1_PRU1_GPO14.RGMII2_TD3 */ - AM64X_IOPAD(0x0148, PIN_OUTPUT, 4) /* (Y10) PRG1_PRU1_GPO16.RGMII2_TXC */ - AM64X_IOPAD(0x0144, PIN_OUTPUT, 4) /* (Y11) PRG1_PRU1_GPO15.RGMII2_TX_CTL */ - >; - }; }; &dmsc { @@ -221,65 +66,41 @@ ti,secure-host; }; -&main_uart0 { - /delete-property/ power-domains; - /delete-property/ clocks; - /delete-property/ clock-names; - pinctrl-names = "default"; - pinctrl-0 = <&main_uart0_pins_default>; - status = "okay"; -}; - -&main_uart1 { - bootph-pre-ram; - pinctrl-names = "default"; - pinctrl-0 = <&main_uart1_pins_default>; -}; - -&memorycontroller { - vtt-supply = <&vtt_supply>; - pinctrl-names = "default"; - pinctrl-0 = <&ddr_vtt_pins_default>; -}; - &sdhci0 { - /delete-property/ power-domains; clocks = <&clk_200mhz>; clock-names = "clk_xin"; - ti,driver-strength-ohm = <50>; - disable-wp; - pinctrl-0 = <&main_mmc0_pins_default>; }; &sdhci1 { - /delete-property/ power-domains; clocks = <&clk_200mhz>; clock-names = "clk_xin"; - ti,driver-strength-ohm = <50>; - disable-wp; - pinctrl-0 = <&main_mmc1_pins_default>; }; &main_gpio0 { bootph-pre-ram; - /delete-property/ power-domains; }; -/* EEPROM might be read before SYSFW is available */ -&main_i2c0 { +/* UART is initialized before SYSFW is started + * so we can't do any power-domain/clock operations. + * Delete clock/power-domain properties to avoid + * UART init failure + */ +&main_uart0 { /delete-property/ power-domains; + /delete-property/ clocks; + /delete-property/ clock-names; }; -&usbss0 { - ti,vbus-divider; - ti,usb2-only; -}; - -&usb0 { - dr_mode = "otg"; - maximum-speed = "high-speed"; - pinctrl-names = "default"; - pinctrl-0 = <&main_usb0_pins_default>; +/* timer init is called as part of rproc_start() while + * starting System Firmware, so any clock/power-domain + * operations will fail as SYSFW is not yet up and running. + * Delete all clock/power-domain properties to avoid + * timer init failure. + * This is an always on timer at 20MHz. + */ +&main_timer0 { + /delete-property/ clocks; + /delete-property/ assigned-clocks; + /delete-property/ assigned-clock-parents; + /delete-property/ power-domains; }; - -#include "k3-am642-evm-u-boot.dtsi" diff --git a/arch/arm/dts/k3-am642-r5-sk.dts b/arch/arm/dts/k3-am642-r5-sk.dts index 32d4c31..def4622 100644 --- a/arch/arm/dts/k3-am642-r5-sk.dts +++ b/arch/arm/dts/k3-am642-r5-sk.dts @@ -3,33 +3,18 @@ * Copyright (C) 2021 Texas Instruments Incorporated - https://www.ti.com/ */ -/dts-v1/; - -#include <dt-bindings/mux/ti-serdes.h> -#include <dt-bindings/phy/phy.h> -#include <dt-bindings/net/ti-dp83867.h> -#include "k3-am642.dtsi" +#include "k3-am642-sk.dts" #include "k3-am64-sk-lp4-1600MTs.dtsi" #include "k3-am64-ddr.dtsi" -/ { - chosen { - stdout-path = "serial2:115200n8"; - tick-timer = &timer1; - }; +#include "k3-am642-sk-u-boot.dtsi" +/ { aliases { remoteproc0 = &sysctrler; remoteproc1 = &a53_0; }; - memory@80000000 { - device_type = "memory"; - /* 2G RAM */ - reg = <0x00000000 0x80000000 0x00000000 0x80000000>; - bootph-pre-ram; - }; - a53_0: a53@0 { compatible = "ti,am654-rproc"; reg = <0x00 0x00a90000 0x00 0x10>; @@ -47,18 +32,6 @@ bootph-pre-ram; }; - reserved-memory { - #address-cells = <2>; - #size-cells = <2>; - ranges; - - secure_ddr: optee@9e800000 { - reg = <0x00 0x9e800000 0x00 0x01800000>; /* for OP-TEE */ - alignment = <0x1000>; - no-map; - }; - }; - clk_200mhz: dummy-clock-200mhz { compatible = "fixed-clock"; #clock-cells = <0>; @@ -76,108 +49,12 @@ }; }; -&cbass_main { - main_esm: esm@420000 { - compatible = "ti,j721e-esm"; - reg = <0x0 0x420000 0x0 0x1000>; - ti,esm-pins = <160>, <161>; - bootph-pre-ram; - }; -}; - -&cbass_mcu { +&main_esm { bootph-pre-ram; - mcu_esm: esm@4100000 { - compatible = "ti,j721e-esm"; - reg = <0x0 0x4100000 0x0 0x1000>; - ti,esm-pins = <0>, <1>; - bootph-pre-ram; - }; }; -&main_pmx0 { +&mcu_esm { bootph-pre-ram; - main_uart0_pins_default: main-uart0-pins-default { - bootph-pre-ram; - pinctrl-single,pins = < - AM64X_IOPAD(0x0238, PIN_INPUT, 0) /* (B16) UART0_CTSn */ - AM64X_IOPAD(0x023c, PIN_OUTPUT, 0) /* (A16) UART0_RTSn */ - AM64X_IOPAD(0x0230, PIN_INPUT, 0) /* (D15) UART0_RXD */ - AM64X_IOPAD(0x0234, PIN_OUTPUT, 0) /* (C16) UART0_TXD */ - >; - }; - - main_uart1_pins_default: main-uart1-pins-default { - bootph-pre-ram; - pinctrl-single,pins = < - AM64X_IOPAD(0x0248, PIN_INPUT, 0) /* (D16) UART1_CTSn */ - AM64X_IOPAD(0x024c, PIN_OUTPUT, 0) /* (E16) UART1_RTSn */ - AM64X_IOPAD(0x0240, PIN_INPUT, 0) /* (E15) UART1_RXD */ - AM64X_IOPAD(0x0244, PIN_OUTPUT, 0) /* (E14) UART1_TXD */ - >; - }; - - main_mmc1_pins_default: main-mmc1-pins-default { - bootph-pre-ram; - pinctrl-single,pins = < - AM64X_IOPAD(0x0294, PIN_INPUT_PULLUP, 0) /* (J19) MMC1_CMD */ - AM64X_IOPAD(0x028c, PIN_INPUT_PULLDOWN, 0) /* (L20) MMC1_CLK */ - AM64X_IOPAD(0x0288, PIN_INPUT_PULLUP, 0) /* (K21) MMC1_DAT0 */ - AM64X_IOPAD(0x0284, PIN_INPUT_PULLUP, 0) /* (L21) MMC1_DAT1 */ - AM64X_IOPAD(0x0280, PIN_INPUT_PULLUP, 0) /* (K19) MMC1_DAT2 */ - AM64X_IOPAD(0x027c, PIN_INPUT_PULLUP, 0) /* (K18) MMC1_DAT3 */ - AM64X_IOPAD(0x0298, PIN_INPUT_PULLUP, 0) /* (D19) MMC1_SDCD */ - AM64X_IOPAD(0x029c, PIN_INPUT_PULLUP, 0) /* (C20) MMC1_SDWP */ - >; - }; - - main_usb0_pins_default: main-usb0-pins-default { - bootph-pre-ram; - pinctrl-single,pins = < - AM64X_IOPAD(0x02a8, PIN_OUTPUT, 0) /* (E19) USB0_DRVVBUS */ - >; - }; - - mdio1_pins_default: mdio1-pins-default { - pinctrl-single,pins = < - AM64X_IOPAD(0x01fc, PIN_OUTPUT, 4) /* (R2) PRG0_PRU1_GPO19.MDIO0_MDC */ - AM64X_IOPAD(0x01f8, PIN_INPUT, 4) /* (P5) PRG0_PRU1_GPO18.MDIO0_MDIO */ - >; - }; - - rgmii1_pins_default: rgmii1-pins-default { - pinctrl-single,pins = < - AM64X_IOPAD(0x011c, PIN_INPUT, 4) /* (AA13) PRG1_PRU1_GPO5.RGMII1_RD0 */ - AM64X_IOPAD(0x0128, PIN_INPUT, 4) /* (U12) PRG1_PRU1_GPO8.RGMII1_RD1 */ - AM64X_IOPAD(0x0150, PIN_INPUT, 4) /* (Y13) PRG1_PRU1_GPO18.RGMII1_RD2 */ - AM64X_IOPAD(0x0154, PIN_INPUT, 4) /* (V12) PRG1_PRU1_GPO19.RGMII1_RD3 */ - AM64X_IOPAD(0x00d8, PIN_INPUT, 4) /* (W13) PRG1_PRU0_GPO8.RGMII1_RXC */ - AM64X_IOPAD(0x00cc, PIN_INPUT, 4) /* (V13) PRG1_PRU0_GPO5.RGMII1_RX_CTL */ - AM64X_IOPAD(0x0124, PIN_OUTPUT, 4) /* (V15) PRG1_PRU1_GPO7.RGMII1_TD0 */ - AM64X_IOPAD(0x012c, PIN_OUTPUT, 4) /* (V14) PRG1_PRU1_GPO9.RGMII1_TD1 */ - AM64X_IOPAD(0x0130, PIN_OUTPUT, 4) /* (W14) PRG1_PRU1_GPO10.RGMII1_TD2 */ - AM64X_IOPAD(0x014c, PIN_OUTPUT, 4) /* (AA14) PRG1_PRU1_GPO17.RGMII1_TD3 */ - AM64X_IOPAD(0x00e0, PIN_OUTPUT, 4) /* (U14) PRG1_PRU0_GPO10.RGMII1_TXC */ - AM64X_IOPAD(0x00dc, PIN_OUTPUT, 4) /* (U15) PRG1_PRU0_GPO9.RGMII1_TX_CTL */ - >; - }; - - rgmii2_pins_default: rgmii2-pins-default { - pinctrl-single,pins = < - AM64X_IOPAD(0x0108, PIN_INPUT, 4) /* (W11) PRG1_PRU1_GPO0.RGMII2_RD0 */ - AM64X_IOPAD(0x010c, PIN_INPUT, 4) /* (V11) PRG1_PRU1_GPO1.RGMII2_RD1 */ - AM64X_IOPAD(0x0110, PIN_INPUT, 4) /* (AA12) PRG1_PRU1_GPO2.RGMII2_RD2 */ - AM64X_IOPAD(0x0114, PIN_INPUT, 4) /* (Y12) PRG1_PRU1_GPO3.RGMII2_RD3 */ - AM64X_IOPAD(0x0120, PIN_INPUT, 4) /* (U11) PRG1_PRU1_GPO6.RGMII2_RXC */ - AM64X_IOPAD(0x0118, PIN_INPUT, 4) /* (W12) PRG1_PRU1_GPO4.RGMII2_RX_CTL */ - AM64X_IOPAD(0x0134, PIN_OUTPUT, 4) /* (AA10) PRG1_PRU1_GPO11.RGMII2_TD0 */ - AM64X_IOPAD(0x0138, PIN_OUTPUT, 4) /* (V10) PRG1_PRU1_GPO12.RGMII2_TD1 */ - AM64X_IOPAD(0x013c, PIN_OUTPUT, 4) /* (U10) PRG1_PRU1_GPO13.RGMII2_TD2 */ - AM64X_IOPAD(0x0140, PIN_OUTPUT, 4) /* (AA11) PRG1_PRU1_GPO14.RGMII2_TD3 */ - AM64X_IOPAD(0x0148, PIN_OUTPUT, 4) /* (Y10) PRG1_PRU1_GPO16.RGMII2_TXC */ - AM64X_IOPAD(0x0144, PIN_OUTPUT, 4) /* (Y11) PRG1_PRU1_GPO15.RGMII2_TX_CTL */ - >; - }; }; &dmsc { @@ -189,79 +66,36 @@ ti,secure-host; }; -&main_uart0 { - /delete-property/ power-domains; - /delete-property/ clocks; - /delete-property/ clock-names; - pinctrl-names = "default"; - pinctrl-0 = <&main_uart0_pins_default>; - status = "okay"; -}; - -&main_uart1 { - bootph-pre-ram; - pinctrl-names = "default"; - pinctrl-0 = <&main_uart1_pins_default>; -}; - &sdhci1 { - /delete-property/ power-domains; clocks = <&clk_200mhz>; clock-names = "clk_xin"; - ti,driver-strength-ohm = <50>; - disable-wp; - pinctrl-0 = <&main_mmc1_pins_default>; -}; - -&serdes_ln_ctrl { - idle-states = <AM64_SERDES0_LANE0_USB>; }; &serdes_wiz0 { status = "okay"; }; -&serdes0 { - serdes0_usb_link: link@0 { - reg = <0>; - cdns,num-lanes = <1>; - #phy-cells = <0>; - cdns,phy-type = <PHY_TYPE_USB3>; - resets = <&serdes_wiz0 1>; - }; -}; - -&usbss0 { - ti,vbus-divider; -}; - -&usb0 { - dr_mode = "host"; - maximum-speed = "super-speed"; - pinctrl-names = "default"; - pinctrl-0 = <&main_usb0_pins_default>; - phys = <&serdes0_usb_link>; - phy-names = "cdns3,usb3-phy"; -}; - -&cpsw3g { - pinctrl-names = "default"; - pinctrl-0 = <&mdio1_pins_default - &rgmii1_pins_default - &rgmii2_pins_default>; -}; - -&cpsw_port2 { - phy-mode = "rgmii-rxid"; - phy-handle = <&cpsw3g_phy1>; +/* UART is initialized before SYSFW is started + * so we can't do any power-domain/clock operations. + * Delete clock/power-domain properties to avoid + * UART init failure + */ +&main_uart0 { + /delete-property/ power-domains; + /delete-property/ clocks; + /delete-property/ clock-names; }; -&cpsw3g_mdio { - cpsw3g_phy1: ethernet-phy@1 { - reg = <1>; - ti,rx-internal-delay = <DP83867_RGMIIDCTL_2_00_NS>; - ti,fifo-depth = <DP83867_PHYCR_FIFO_DEPTH_4_B_NIB>; - }; +/* timer init is called as part of rproc_start() while + * starting System Firmware, so any clock/power-domain + * operations will fail as SYSFW is not yet up and running. + * Delete all clock/power-domain properties to avoid + * timer init failure. + * This is an always on timer at 20MHz. + */ +&main_timer0 { + /delete-property/ clocks; + /delete-property/ assigned-clocks; + /delete-property/ assigned-clock-parents; + /delete-property/ power-domains; }; - -#include "k3-am642-sk-u-boot.dtsi" diff --git a/arch/arm/dts/k3-am642-sk-u-boot.dtsi b/arch/arm/dts/k3-am642-sk-u-boot.dtsi index 3d6be02..c277ef8 100644 --- a/arch/arm/dts/k3-am642-sk-u-boot.dtsi +++ b/arch/arm/dts/k3-am642-sk-u-boot.dtsi @@ -7,12 +7,7 @@ / { chosen { - stdout-path = "serial2:115200n8"; - tick-timer = &timer1; - }; - - aliases { - mmc1 = &sdhci1; + tick-timer = &main_timer0; }; memory@80000000 { @@ -22,13 +17,15 @@ &cbass_main{ bootph-pre-ram; - timer1: timer@2400000 { - compatible = "ti,omap5430-timer"; - reg = <0x0 0x2400000 0x0 0x80>; - ti,timer-alwon; - clock-frequency = <200000000>; - bootph-pre-ram; - }; +}; + +&cbass_mcu { + bootph-pre-ram; +}; + +&main_timer0 { + bootph-pre-ram; + clock-frequency = <200000000>; }; &main_conf { @@ -40,81 +37,18 @@ &main_pmx0 { bootph-pre-ram; - main_i2c0_pins_default: main-i2c0-pins-default { - bootph-pre-ram; - pinctrl-single,pins = < - AM64X_IOPAD(0x0260, PIN_INPUT_PULLUP, 0) /* (A18) I2C0_SCL */ - AM64X_IOPAD(0x0264, PIN_INPUT_PULLUP, 0) /* (B18) I2C0_SDA */ - >; - }; +}; + +&main_i2c0_pins_default { + bootph-pre-ram; }; &main_i2c0 { bootph-pre-ram; - pinctrl-names = "default"; - pinctrl-0 = <&main_i2c0_pins_default>; - clock-frequency = <400000>; - - tps65219: pmic@30 { - compatible = "ti,tps65219"; - reg = <0x30>; - - regulators { - buck1_reg: buck1 { - regulator-name = "VDD_CORE"; - regulator-min-microvolt = <750000>; - regulator-max-microvolt = <750000>; - regulator-boot-on; - regulator-always-on; - }; - - buck2_reg: buck2 { - regulator-name = "VCC1V8"; - regulator-min-microvolt = <1800000>; - regulator-max-microvolt = <1800000>; - regulator-boot-on; - regulator-always-on; - }; - - buck3_reg: buck3 { - regulator-name = "VDD_LPDDR4"; - regulator-min-microvolt = <1100000>; - regulator-max-microvolt = <1100000>; - regulator-boot-on; - regulator-always-on; - }; - - ldo1_reg: ldo1 { - regulator-name = "VDDSHV_SD_IO_PMIC"; - regulator-min-microvolt = <33000000>; - regulator-max-microvolt = <33000000>; - }; - - ldo2_reg: ldo2 { - regulator-name = "VDDAR_CORE"; - regulator-min-microvolt = <850000>; - regulator-max-microvolt = <850000>; - regulator-boot-on; - regulator-always-on; - }; - - ldo3_reg: ldo3 { - regulator-name = "VDDA_1V8"; - regulator-min-microvolt = <18000000>; - regulator-max-microvolt = <18000000>; - regulator-boot-on; - regulator-always-on; - }; - - ldo4_reg: ldo4 { - regulator-name = "VDD_PHY_2V5"; - regulator-min-microvolt = <25000000>; - regulator-max-microvolt = <25000000>; - regulator-boot-on; - regulator-always-on; - }; - }; - }; +}; + +&main_uart0_pins_default { + bootph-pre-ram; }; &main_uart0 { @@ -163,18 +97,8 @@ }; &cpsw3g { - reg = <0x0 0x8000000 0x0 0x200000>, - <0x0 0x43000200 0x0 0x8>; - reg-names = "cpsw_nuss", "mac_efuse"; - /delete-property/ ranges; bootph-pre-ram; - cpsw-phy-sel@04044 { - compatible = "ti,am64-phy-gmii-sel"; - reg = <0x0 0x43004044 0x0 0x8>; - bootph-pre-ram; - }; - ethernet-ports { bootph-pre-ram; }; @@ -221,7 +145,6 @@ }; &usb0 { - dr_mode = "host"; bootph-pre-ram; }; diff --git a/arch/arm/dts/k3-am642-sk.dts b/arch/arm/dts/k3-am642-sk.dts index 2e2d40d..722fd28 100644 --- a/arch/arm/dts/k3-am642-sk.dts +++ b/arch/arm/dts/k3-am642-sk.dts @@ -5,27 +5,38 @@ /dts-v1/; -#include <dt-bindings/mux/ti-serdes.h> #include <dt-bindings/phy/phy.h> #include <dt-bindings/gpio/gpio.h> #include <dt-bindings/net/ti-dp83867.h> #include <dt-bindings/leds/common.h> #include "k3-am642.dtsi" +#include "k3-serdes.h" + / { compatible = "ti,am642-sk", "ti,am642"; model = "Texas Instruments AM642 SK"; chosen { - stdout-path = "serial2:115200n8"; - bootargs = "console=ttyS2,115200n8 earlycon=ns16550a,mmio32,0x02800000"; + stdout-path = &main_uart0; + }; + + aliases { + serial0 = &mcu_uart0; + serial1 = &main_uart1; + serial2 = &main_uart0; + i2c0 = &main_i2c0; + i2c1 = &main_i2c1; + mmc0 = &sdhci0; + mmc1 = &sdhci1; + ethernet0 = &cpsw_port1; + ethernet1 = &cpsw_port2; }; memory@80000000 { device_type = "memory"; /* 2G RAM */ reg = <0x00000000 0x80000000 0x00000000 0x80000000>; - }; reserved-memory { @@ -94,7 +105,7 @@ }; }; - vusb_main: fixed-regulator-vusb-main5v0 { + vusb_main: regulator-0 { /* USB MAIN INPUT 5V DC */ compatible = "regulator-fixed"; regulator-name = "vusb_main5v0"; @@ -104,7 +115,7 @@ regulator-boot-on; }; - vcc_3v3_sys: fixedregulator-vcc-3v3-sys { + vcc_3v3_sys: regulator-1 { /* output of LP8733xx */ compatible = "regulator-fixed"; regulator-name = "vcc_3v3_sys"; @@ -115,7 +126,7 @@ regulator-boot-on; }; - vdd_mmc1: fixed-regulator-sd { + vdd_mmc1: regulator-2 { /* TPS2051BD */ compatible = "regulator-fixed"; regulator-name = "vdd_mmc1"; @@ -127,7 +138,7 @@ gpio = <&exp1 3 GPIO_ACTIVE_HIGH>; }; - com8_ls_en: regulator-1 { + com8_ls_en: regulator-3 { compatible = "regulator-fixed"; regulator-name = "com8_ls_en"; regulator-min-microvolt = <3300000>; @@ -139,7 +150,7 @@ gpio = <&main_gpio0 62 GPIO_ACTIVE_LOW>; }; - wlan_en: regulator-2 { + wlan_en: regulator-4 { /* output of SN74AVC4T245RSVR */ compatible = "regulator-fixed"; regulator-name = "wlan_en"; @@ -222,20 +233,21 @@ }; &main_pmx0 { - main_mmc1_pins_default: main-mmc1-pins-default { + main_mmc1_pins_default: main-mmc1-default-pins { pinctrl-single,pins = < - AM64X_IOPAD(0x0294, PIN_INPUT, 0) /* (J19) MMC1_CMD */ + AM64X_IOPAD(0x029c, PIN_INPUT_PULLUP, 0) /* (C20) MMC1_SDWP */ + AM64X_IOPAD(0x0298, PIN_INPUT_PULLUP, 0) /* (D19) MMC1_SDCD */ + AM64X_IOPAD(0x0294, PIN_INPUT_PULLUP, 0) /* (J19) MMC1_CMD */ AM64X_IOPAD(0x0290, PIN_INPUT, 0) /* (#N/A) MMC1_CLKLB */ - AM64X_IOPAD(0x028c, PIN_INPUT, 0) /* (L20) MMC1_CLK */ - AM64X_IOPAD(0x0288, PIN_INPUT, 0) /* (K21) MMC1_DAT0 */ - AM64X_IOPAD(0x0284, PIN_INPUT, 0) /* (L21) MMC1_DAT1 */ - AM64X_IOPAD(0x0280, PIN_INPUT, 0) /* (K19) MMC1_DAT2 */ - AM64X_IOPAD(0x027c, PIN_INPUT, 0) /* (K18) MMC1_DAT3 */ - AM64X_IOPAD(0x0298, PIN_INPUT, 0) /* (D19) MMC1_SDCD */ + AM64X_IOPAD(0x028c, PIN_INPUT_PULLDOWN, 0) /* (L20) MMC1_CLK */ + AM64X_IOPAD(0x0288, PIN_INPUT_PULLUP, 0) /* (K21) MMC1_DAT0 */ + AM64X_IOPAD(0x0284, PIN_INPUT_PULLUP, 0) /* (L21) MMC1_DAT1 */ + AM64X_IOPAD(0x0280, PIN_INPUT_PULLUP, 0) /* (K19) MMC1_DAT2 */ + AM64X_IOPAD(0x027c, PIN_INPUT_PULLUP, 0) /* (K18) MMC1_DAT3 */ >; }; - main_uart0_pins_default: main-uart0-pins-default { + main_uart0_pins_default: main-uart0-default-pins { pinctrl-single,pins = < AM64X_IOPAD(0x0238, PIN_INPUT, 0) /* (B16) UART0_CTSn */ AM64X_IOPAD(0x023c, PIN_OUTPUT, 0) /* (A16) UART0_RTSn */ @@ -244,27 +256,43 @@ >; }; - main_usb0_pins_default: main-usb0-pins-default { + main_uart1_pins_default: main-uart1-default-pins { + pinctrl-single,pins = < + AM64X_IOPAD(0x0248, PIN_INPUT, 0) /* (D16) UART1_CTSn */ + AM64X_IOPAD(0x024c, PIN_OUTPUT, 0) /* (E16) UART1_RTSn */ + AM64X_IOPAD(0x0240, PIN_INPUT, 0) /* (E15) UART1_RXD */ + AM64X_IOPAD(0x0244, PIN_OUTPUT, 0) /* (E14) UART1_TXD */ + >; + }; + + main_usb0_pins_default: main-usb0-default-pins { pinctrl-single,pins = < AM64X_IOPAD(0x02a8, PIN_OUTPUT, 0) /* (E19) USB0_DRVVBUS */ >; }; - main_i2c1_pins_default: main-i2c1-pins-default { + main_i2c0_pins_default: main-i2c0-default-pins { + pinctrl-single,pins = < + AM64X_IOPAD(0x0260, PIN_INPUT_PULLUP, 0) /* (A18) I2C0_SCL */ + AM64X_IOPAD(0x0264, PIN_INPUT_PULLUP, 0) /* (B18) I2C0_SDA */ + >; + }; + + main_i2c1_pins_default: main-i2c1-default-pins { pinctrl-single,pins = < AM64X_IOPAD(0x0268, PIN_INPUT_PULLUP, 0) /* (C18) I2C1_SCL */ AM64X_IOPAD(0x026c, PIN_INPUT_PULLUP, 0) /* (B19) I2C1_SDA */ >; }; - mdio1_pins_default: mdio1-pins-default { + mdio1_pins_default: mdio1-default-pins { pinctrl-single,pins = < AM64X_IOPAD(0x01fc, PIN_OUTPUT, 4) /* (R2) PRG0_PRU1_GPO19.MDIO0_MDC */ AM64X_IOPAD(0x01f8, PIN_INPUT, 4) /* (P5) PRG0_PRU1_GPO18.MDIO0_MDIO */ >; }; - rgmii1_pins_default: rgmii1-pins-default { + rgmii1_pins_default: rgmii1-default-pins { pinctrl-single,pins = < AM64X_IOPAD(0x011c, PIN_INPUT, 4) /* (AA13) PRG1_PRU1_GPO5.RGMII1_RD0 */ AM64X_IOPAD(0x0128, PIN_INPUT, 4) /* (U12) PRG1_PRU1_GPO8.RGMII1_RD1 */ @@ -281,7 +309,7 @@ >; }; - rgmii2_pins_default: rgmii2-pins-default { + rgmii2_pins_default: rgmii2-default-pins { pinctrl-single,pins = < AM64X_IOPAD(0x0108, PIN_INPUT, 4) /* (W11) PRG1_PRU1_GPO0.RGMII2_RD0 */ AM64X_IOPAD(0x010c, PIN_INPUT, 4) /* (V11) PRG1_PRU1_GPO1.RGMII2_RD1 */ @@ -298,7 +326,7 @@ >; }; - ospi0_pins_default: ospi0-pins-default { + ospi0_pins_default: ospi0-default-pins { pinctrl-single,pins = < AM64X_IOPAD(0x0000, PIN_OUTPUT, 0) /* (N20) OSPI0_CLK */ AM64X_IOPAD(0x002c, PIN_OUTPUT, 0) /* (L19) OSPI0_CSn0 */ @@ -314,24 +342,24 @@ >; }; - main_ecap0_pins_default: main-ecap0-pins-default { + main_ecap0_pins_default: main-ecap0-default-pins { pinctrl-single,pins = < AM64X_IOPAD(0x0270, PIN_INPUT, 0) /* (D18) ECAP0_IN_APWM_OUT */ >; }; - main_wlan_en_pins_default: main-wlan-en-pins-default { + main_wlan_en_pins_default: main-wlan-en-default-pins { pinctrl-single,pins = < AM64X_IOPAD(0x00c4, PIN_OUTPUT_PULLUP, 7) /* (V8) GPIO0_48 */ >; }; - main_com8_ls_en_pins_default: main-com8-ls-en-pins-default { + main_com8_ls_en_pins_default: main-com8-ls-en-default-pins { pinctrl-single,pins = < AM64X_IOPAD(0x00fc, PIN_OUTPUT, 7) /* (U7) PRG1_PRU0_GPO17.GPIO0_62 */ >; }; - main_wlan_pins_default: main-wlan-pins-default { + main_wlan_pins_default: main-wlan-default-pins { pinctrl-single,pins = < AM64X_IOPAD(0x00bc, PIN_INPUT, 7) /* (U8) GPIO0_46 */ >; @@ -342,11 +370,26 @@ status = "okay"; pinctrl-names = "default"; pinctrl-0 = <&main_uart0_pins_default>; + current-speed = <115200>; }; &main_uart1 { /* main_uart1 is reserved for firmware usage */ status = "reserved"; + pinctrl-names = "default"; + pinctrl-0 = <&main_uart1_pins_default>; +}; + +&main_i2c0 { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&main_i2c0_pins_default>; + clock-frequency = <400000>; + + eeprom@51 { + compatible = "atmel,24c512"; + reg = <0x51>; + }; }; &main_i2c1 { @@ -439,8 +482,7 @@ &cpsw3g { pinctrl-names = "default"; - pinctrl-0 = <&rgmii1_pins_default - &rgmii2_pins_default>; + pinctrl-0 = <&rgmii1_pins_default>, <&rgmii2_pins_default>; }; &cpsw_port1 { @@ -471,11 +513,8 @@ }; }; -&tscadc0 { - status = "disabled"; -}; - &ospi0 { + status = "okay"; pinctrl-names = "default"; pinctrl-0 = <&ospi0_pins_default>; @@ -490,10 +529,53 @@ cdns,tchsh-ns = <60>; cdns,tslch-ns = <60>; cdns,read-delay = <4>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "ospi.tiboot3"; + reg = <0x0 0x100000>; + }; + + partition@100000 { + label = "ospi.tispl"; + reg = <0x100000 0x200000>; + }; + + partition@300000 { + label = "ospi.u-boot"; + reg = <0x300000 0x400000>; + }; + + partition@700000 { + label = "ospi.env"; + reg = <0x700000 0x40000>; + }; + + partition@740000 { + label = "ospi.env.backup"; + reg = <0x740000 0x40000>; + }; + + partition@800000 { + label = "ospi.rootfs"; + reg = <0x800000 0x37c0000>; + }; + + partition@3fc0000 { + label = "ospi.phypattern"; + reg = <0x3fc0000 0x40000>; + }; + }; }; }; &mailbox0_cluster2 { + status = "okay"; + mbox_main_r5fss0_core0: mbox-main-r5fss0-core0 { ti,mbox-rx = <0 0 2>; ti,mbox-tx = <1 0 2>; @@ -505,11 +587,9 @@ }; }; -&mailbox0_cluster3 { - status = "disabled"; -}; - &mailbox0_cluster4 { + status = "okay"; + mbox_main_r5fss1_core0: mbox-main-r5fss1-core0 { ti,mbox-rx = <0 0 2>; ti,mbox-tx = <1 0 2>; @@ -521,41 +601,35 @@ }; }; -&mailbox0_cluster5 { - status = "disabled"; -}; - &mailbox0_cluster6 { + status = "okay"; + mbox_m4_0: mbox-m4-0 { ti,mbox-rx = <0 0 2>; ti,mbox-tx = <1 0 2>; }; }; -&mailbox0_cluster7 { - status = "disabled"; -}; - &main_r5fss0_core0 { - mboxes = <&mailbox0_cluster2 &mbox_main_r5fss0_core0>; + mboxes = <&mailbox0_cluster2>, <&mbox_main_r5fss0_core0>; memory-region = <&main_r5fss0_core0_dma_memory_region>, <&main_r5fss0_core0_memory_region>; }; &main_r5fss0_core1 { - mboxes = <&mailbox0_cluster2 &mbox_main_r5fss0_core1>; + mboxes = <&mailbox0_cluster2>, <&mbox_main_r5fss0_core1>; memory-region = <&main_r5fss0_core1_dma_memory_region>, <&main_r5fss0_core1_memory_region>; }; &main_r5fss1_core0 { - mboxes = <&mailbox0_cluster4 &mbox_main_r5fss1_core0>; + mboxes = <&mailbox0_cluster4>, <&mbox_main_r5fss1_core0>; memory-region = <&main_r5fss1_core0_dma_memory_region>, <&main_r5fss1_core0_memory_region>; }; &main_r5fss1_core1 { - mboxes = <&mailbox0_cluster4 &mbox_main_r5fss1_core1>; + mboxes = <&mailbox0_cluster4>, <&mbox_main_r5fss1_core1>; memory-region = <&main_r5fss1_core1_dma_memory_region>, <&main_r5fss1_core1_memory_region>; }; diff --git a/arch/arm/dts/k3-am642.dtsi b/arch/arm/dts/k3-am642.dtsi index 8a76f48..7a6eede 100644 --- a/arch/arm/dts/k3-am642.dtsi +++ b/arch/arm/dts/k3-am642.dtsi @@ -58,6 +58,7 @@ L2_0: l2-cache0 { compatible = "cache"; cache-level = <2>; + cache-unified; cache-size = <0x40000>; cache-line-size = <64>; cache-sets = <256>; diff --git a/arch/arm/dts/k3-am65-iot2050-common.dtsi b/arch/arm/dts/k3-am65-iot2050-common.dtsi index 65da226..b6135b8 100644 --- a/arch/arm/dts/k3-am65-iot2050-common.dtsi +++ b/arch/arm/dts/k3-am65-iot2050-common.dtsi @@ -64,6 +64,12 @@ alignment = <0x1000>; no-map; }; + + /* To reserve the power-on(PON) reason for watchdog reset */ + wdt_reset_memory_region: wdt-memory@a2200000 { + reg = <0x00 0xa2200000 0x00 0x00001000>; + no-map; + }; }; leds { @@ -720,6 +726,11 @@ mboxes = <&mailbox0_cluster1 &mbox_mcu_r5fss0_core1>; }; +&mcu_rti1 { + memory-region = <&wdt_reset_memory_region>; + +}; + &icssg0_mdio { status = "disabled"; }; diff --git a/arch/arm/dts/k3-j7200-common-proc-board.dts b/arch/arm/dts/k3-j7200-common-proc-board.dts index d14f3c1..ef5e807 100644 --- a/arch/arm/dts/k3-j7200-common-proc-board.dts +++ b/arch/arm/dts/k3-j7200-common-proc-board.dts @@ -8,8 +8,8 @@ #include "k3-j7200-som-p0.dtsi" #include <dt-bindings/gpio/gpio.h> #include <dt-bindings/net/ti-dp83867.h> -#include <dt-bindings/mux/ti-serdes.h> #include <dt-bindings/phy/phy.h> +#include "k3-serdes.h" / { chosen { diff --git a/arch/arm/dts/k3-j721e-ddr-evm-lp4-4266.dtsi b/arch/arm/dts/k3-j721e-ddr-evm-lp4-4266.dtsi index 5a6f9b1..a0285ce 100644 --- a/arch/arm/dts/k3-j721e-ddr-evm-lp4-4266.dtsi +++ b/arch/arm/dts/k3-j721e-ddr-evm-lp4-4266.dtsi @@ -1,9 +1,9 @@ // SPDX-License-Identifier: GPL-2.0+ /* - * Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ - * This file was generated by the Jacinto7_DDRSS_RegConfigTool, Revision: 0.9.1 - * This file was generated on 07/17/2022 -*/ + * Copyright (C) 2023 Texas Instruments Incorporated - https://www.ti.com/ + * This file was generated by the Jacinto7_DDRSS_RegConfigTool, Revision: 0.10.0 + * This file was generated on 04/12/2023 + */ #define DDRSS_PLL_FHS_CNT 10 #define DDRSS_PLL_FREQUENCY_0 27500000 @@ -54,11 +54,11 @@ #define DDRSS_CTL_41_DATA 0x1B60008B #define DDRSS_CTL_42_DATA 0x2000422B #define DDRSS_CTL_43_DATA 0x000A0A09 -#define DDRSS_CTL_44_DATA 0x0400078A +#define DDRSS_CTL_44_DATA 0x040003C5 #define DDRSS_CTL_45_DATA 0x1E161104 -#define DDRSS_CTL_46_DATA 0x10012458 +#define DDRSS_CTL_46_DATA 0x1000922C #define DDRSS_CTL_47_DATA 0x1E161110 -#define DDRSS_CTL_48_DATA 0x10012458 +#define DDRSS_CTL_48_DATA 0x1000922C #define DDRSS_CTL_49_DATA 0x02030410 #define DDRSS_CTL_50_DATA 0x2C040500 #define DDRSS_CTL_51_DATA 0x082D2C2D @@ -71,11 +71,11 @@ #define DDRSS_CTL_58_DATA 0x00010100 #define DDRSS_CTL_59_DATA 0x03010000 #define DDRSS_CTL_60_DATA 0x00001008 -#define DDRSS_CTL_61_DATA 0x000000CE +#define DDRSS_CTL_61_DATA 0x00000063 #define DDRSS_CTL_62_DATA 0x00000256 -#define DDRSS_CTL_63_DATA 0x00002073 +#define DDRSS_CTL_63_DATA 0x00001035 #define DDRSS_CTL_64_DATA 0x00000256 -#define DDRSS_CTL_65_DATA 0x00002073 +#define DDRSS_CTL_65_DATA 0x00001035 #define DDRSS_CTL_66_DATA 0x00000005 #define DDRSS_CTL_67_DATA 0x00040000 #define DDRSS_CTL_68_DATA 0x00950012 @@ -112,27 +112,27 @@ #define DDRSS_CTL_99_DATA 0x00000000 #define DDRSS_CTL_100_DATA 0x00040005 #define DDRSS_CTL_101_DATA 0x00000000 -#define DDRSS_CTL_102_DATA 0x00003380 -#define DDRSS_CTL_103_DATA 0x00003380 -#define DDRSS_CTL_104_DATA 0x00003380 -#define DDRSS_CTL_105_DATA 0x00003380 -#define DDRSS_CTL_106_DATA 0x00003380 +#define DDRSS_CTL_102_DATA 0x000018C0 +#define DDRSS_CTL_103_DATA 0x000018C0 +#define DDRSS_CTL_104_DATA 0x000018C0 +#define DDRSS_CTL_105_DATA 0x000018C0 +#define DDRSS_CTL_106_DATA 0x000018C0 #define DDRSS_CTL_107_DATA 0x00000000 -#define DDRSS_CTL_108_DATA 0x000005A2 -#define DDRSS_CTL_109_DATA 0x00081CC0 -#define DDRSS_CTL_110_DATA 0x00081CC0 -#define DDRSS_CTL_111_DATA 0x00081CC0 -#define DDRSS_CTL_112_DATA 0x00081CC0 -#define DDRSS_CTL_113_DATA 0x00081CC0 +#define DDRSS_CTL_108_DATA 0x000002B5 +#define DDRSS_CTL_109_DATA 0x00040D40 +#define DDRSS_CTL_110_DATA 0x00040D40 +#define DDRSS_CTL_111_DATA 0x00040D40 +#define DDRSS_CTL_112_DATA 0x00040D40 +#define DDRSS_CTL_113_DATA 0x00040D40 #define DDRSS_CTL_114_DATA 0x00000000 -#define DDRSS_CTL_115_DATA 0x0000E325 -#define DDRSS_CTL_116_DATA 0x00081CC0 -#define DDRSS_CTL_117_DATA 0x00081CC0 -#define DDRSS_CTL_118_DATA 0x00081CC0 -#define DDRSS_CTL_119_DATA 0x00081CC0 -#define DDRSS_CTL_120_DATA 0x00081CC0 +#define DDRSS_CTL_115_DATA 0x00007173 +#define DDRSS_CTL_116_DATA 0x00040D40 +#define DDRSS_CTL_117_DATA 0x00040D40 +#define DDRSS_CTL_118_DATA 0x00040D40 +#define DDRSS_CTL_119_DATA 0x00040D40 +#define DDRSS_CTL_120_DATA 0x00040D40 #define DDRSS_CTL_121_DATA 0x00000000 -#define DDRSS_CTL_122_DATA 0x0000E325 +#define DDRSS_CTL_122_DATA 0x00007173 #define DDRSS_CTL_123_DATA 0x00000000 #define DDRSS_CTL_124_DATA 0x00000000 #define DDRSS_CTL_125_DATA 0x00000000 @@ -399,29 +399,29 @@ #define DDRSS_CTL_386_DATA 0x00000000 #define DDRSS_CTL_387_DATA 0x3A3A1B00 #define DDRSS_CTL_388_DATA 0x000A0000 -#define DDRSS_CTL_389_DATA 0x0000019C +#define DDRSS_CTL_389_DATA 0x000000C6 #define DDRSS_CTL_390_DATA 0x00000200 #define DDRSS_CTL_391_DATA 0x00000200 #define DDRSS_CTL_392_DATA 0x00000200 #define DDRSS_CTL_393_DATA 0x00000200 -#define DDRSS_CTL_394_DATA 0x000004D4 -#define DDRSS_CTL_395_DATA 0x00001018 +#define DDRSS_CTL_394_DATA 0x00000252 +#define DDRSS_CTL_395_DATA 0x000007BC #define DDRSS_CTL_396_DATA 0x00000204 -#define DDRSS_CTL_397_DATA 0x000040E6 +#define DDRSS_CTL_397_DATA 0x0000206A #define DDRSS_CTL_398_DATA 0x00000200 #define DDRSS_CTL_399_DATA 0x00000200 #define DDRSS_CTL_400_DATA 0x00000200 #define DDRSS_CTL_401_DATA 0x00000200 -#define DDRSS_CTL_402_DATA 0x0000C2B2 -#define DDRSS_CTL_403_DATA 0x000288FC +#define DDRSS_CTL_402_DATA 0x0000613E +#define DDRSS_CTL_403_DATA 0x00014424 #define DDRSS_CTL_404_DATA 0x00000E15 -#define DDRSS_CTL_405_DATA 0x000040E6 +#define DDRSS_CTL_405_DATA 0x0000206A #define DDRSS_CTL_406_DATA 0x00000200 #define DDRSS_CTL_407_DATA 0x00000200 #define DDRSS_CTL_408_DATA 0x00000200 #define DDRSS_CTL_409_DATA 0x00000200 -#define DDRSS_CTL_410_DATA 0x0000C2B2 -#define DDRSS_CTL_411_DATA 0x000288FC +#define DDRSS_CTL_410_DATA 0x0000613E +#define DDRSS_CTL_411_DATA 0x00014424 #define DDRSS_CTL_412_DATA 0x02020E15 #define DDRSS_CTL_413_DATA 0x03030202 #define DDRSS_CTL_414_DATA 0x00000022 @@ -640,11 +640,11 @@ #define DDRSS_PI_167_DATA 0x02000200 #define DDRSS_PI_168_DATA 0x48120C04 #define DDRSS_PI_169_DATA 0x00104812 -#define DDRSS_PI_170_DATA 0x000000CE +#define DDRSS_PI_170_DATA 0x00000063 #define DDRSS_PI_171_DATA 0x00000256 -#define DDRSS_PI_172_DATA 0x00002073 +#define DDRSS_PI_172_DATA 0x00001035 #define DDRSS_PI_173_DATA 0x00000256 -#define DDRSS_PI_174_DATA 0x04002073 +#define DDRSS_PI_174_DATA 0x04001035 #define DDRSS_PI_175_DATA 0x01010404 #define DDRSS_PI_176_DATA 0x00001501 #define DDRSS_PI_177_DATA 0x00150015 @@ -689,22 +689,22 @@ #define DDRSS_PI_216_DATA 0x3212005B #define DDRSS_PI_217_DATA 0x09000301 #define DDRSS_PI_218_DATA 0x04010504 -#define DDRSS_PI_219_DATA 0x040006C9 +#define DDRSS_PI_219_DATA 0x04000364 #define DDRSS_PI_220_DATA 0x0A032001 #define DDRSS_PI_221_DATA 0x2C31110A #define DDRSS_PI_222_DATA 0x00002D1C -#define DDRSS_PI_223_DATA 0x6001071C +#define DDRSS_PI_223_DATA 0x6000838E #define DDRSS_PI_224_DATA 0x1E202008 #define DDRSS_PI_225_DATA 0x2C311116 #define DDRSS_PI_226_DATA 0x00002D1C -#define DDRSS_PI_227_DATA 0x6001071C +#define DDRSS_PI_227_DATA 0x6000838E #define DDRSS_PI_228_DATA 0x1E202008 -#define DDRSS_PI_229_DATA 0x00019C16 -#define DDRSS_PI_230_DATA 0x00001018 -#define DDRSS_PI_231_DATA 0x000040E6 -#define DDRSS_PI_232_DATA 0x000288FC -#define DDRSS_PI_233_DATA 0x000040E6 -#define DDRSS_PI_234_DATA 0x000288FC +#define DDRSS_PI_229_DATA 0x0000C616 +#define DDRSS_PI_230_DATA 0x000007BC +#define DDRSS_PI_231_DATA 0x0000206A +#define DDRSS_PI_232_DATA 0x00014424 +#define DDRSS_PI_233_DATA 0x0000206A +#define DDRSS_PI_234_DATA 0x00014424 #define DDRSS_PI_235_DATA 0x02660010 #define DDRSS_PI_236_DATA 0x03030266 #define DDRSS_PI_237_DATA 0x002AF803 diff --git a/arch/arm/dts/k3-j721e-main.dtsi b/arch/arm/dts/k3-j721e-main.dtsi index cf34823..d2edf5d 100644 --- a/arch/arm/dts/k3-j721e-main.dtsi +++ b/arch/arm/dts/k3-j721e-main.dtsi @@ -6,7 +6,7 @@ */ #include <dt-bindings/phy/phy.h> #include <dt-bindings/mux/mux.h> -#include <dt-bindings/mux/ti-serdes.h> +#include "k3-serdes.h" / { cmn_refclk: clock-cmnrefclk { diff --git a/arch/arm/dts/k3-j721s2-ddr-evm-lp4-4266.dtsi b/arch/arm/dts/k3-j721s2-ddr-evm-lp4-4266.dtsi index c91576b..45fa061 100644 --- a/arch/arm/dts/k3-j721s2-ddr-evm-lp4-4266.dtsi +++ b/arch/arm/dts/k3-j721s2-ddr-evm-lp4-4266.dtsi @@ -1,11 +1,11 @@ // SPDX-License-Identifier: GPL-2.0+ /* - * Copyright (C) 2021 Texas Instruments Incorporated - https://www.ti.com/ - * This file was generated by the Jacinto7_DDRSS_RegConfigTool, Revision: 0.7.0 - * This file was generated on 10/14/2021 + * Copyright (C) 2023 Texas Instruments Incorporated - https://www.ti.com/ + * This file was generated by the Jacinto7_DDRSS_RegConfigTool, Revision: 0.10.0 + * This file was generated on 04/12/2023 */ -#define DDRSS_PLL_FHS_CNT 10 +#define DDRSS_PLL_FHS_CNT 5 #define DDRSS_PLL_FREQUENCY_0 27500000 #define DDRSS_PLL_FREQUENCY_1 1066500000 #define DDRSS_PLL_FREQUENCY_2 1066500000 @@ -60,11 +60,11 @@ #define DDRSS0_CTL_41_DATA 0x1760008B #define DDRSS0_CTL_42_DATA 0x2000422B #define DDRSS0_CTL_43_DATA 0x000A0A09 -#define DDRSS0_CTL_44_DATA 0x0400078A +#define DDRSS0_CTL_44_DATA 0x040003C5 #define DDRSS0_CTL_45_DATA 0x1E161104 -#define DDRSS0_CTL_46_DATA 0x10012458 +#define DDRSS0_CTL_46_DATA 0x1000922C #define DDRSS0_CTL_47_DATA 0x1E161110 -#define DDRSS0_CTL_48_DATA 0x10012458 +#define DDRSS0_CTL_48_DATA 0x1000922C #define DDRSS0_CTL_49_DATA 0x02030410 #define DDRSS0_CTL_50_DATA 0x2C040500 #define DDRSS0_CTL_51_DATA 0x08292C29 @@ -77,11 +77,11 @@ #define DDRSS0_CTL_58_DATA 0x00010100 #define DDRSS0_CTL_59_DATA 0x03010000 #define DDRSS0_CTL_60_DATA 0x00001508 -#define DDRSS0_CTL_61_DATA 0x000000CE +#define DDRSS0_CTL_61_DATA 0x00000063 #define DDRSS0_CTL_62_DATA 0x0000032B -#define DDRSS0_CTL_63_DATA 0x00002073 +#define DDRSS0_CTL_63_DATA 0x00001035 #define DDRSS0_CTL_64_DATA 0x0000032B -#define DDRSS0_CTL_65_DATA 0x00002073 +#define DDRSS0_CTL_65_DATA 0x00001035 #define DDRSS0_CTL_66_DATA 0x00000005 #define DDRSS0_CTL_67_DATA 0x00050000 #define DDRSS0_CTL_68_DATA 0x00CB0012 @@ -118,27 +118,27 @@ #define DDRSS0_CTL_99_DATA 0x00000000 #define DDRSS0_CTL_100_DATA 0x00040005 #define DDRSS0_CTL_101_DATA 0x00000000 -#define DDRSS0_CTL_102_DATA 0x00003380 -#define DDRSS0_CTL_103_DATA 0x00003380 -#define DDRSS0_CTL_104_DATA 0x00003380 -#define DDRSS0_CTL_105_DATA 0x00003380 -#define DDRSS0_CTL_106_DATA 0x00003380 +#define DDRSS0_CTL_102_DATA 0x000018C0 +#define DDRSS0_CTL_103_DATA 0x000018C0 +#define DDRSS0_CTL_104_DATA 0x000018C0 +#define DDRSS0_CTL_105_DATA 0x000018C0 +#define DDRSS0_CTL_106_DATA 0x000018C0 #define DDRSS0_CTL_107_DATA 0x00000000 -#define DDRSS0_CTL_108_DATA 0x000005A2 -#define DDRSS0_CTL_109_DATA 0x00081CC0 -#define DDRSS0_CTL_110_DATA 0x00081CC0 -#define DDRSS0_CTL_111_DATA 0x00081CC0 -#define DDRSS0_CTL_112_DATA 0x00081CC0 -#define DDRSS0_CTL_113_DATA 0x00081CC0 +#define DDRSS0_CTL_108_DATA 0x000002B5 +#define DDRSS0_CTL_109_DATA 0x00040D40 +#define DDRSS0_CTL_110_DATA 0x00040D40 +#define DDRSS0_CTL_111_DATA 0x00040D40 +#define DDRSS0_CTL_112_DATA 0x00040D40 +#define DDRSS0_CTL_113_DATA 0x00040D40 #define DDRSS0_CTL_114_DATA 0x00000000 -#define DDRSS0_CTL_115_DATA 0x0000E325 -#define DDRSS0_CTL_116_DATA 0x00081CC0 -#define DDRSS0_CTL_117_DATA 0x00081CC0 -#define DDRSS0_CTL_118_DATA 0x00081CC0 -#define DDRSS0_CTL_119_DATA 0x00081CC0 -#define DDRSS0_CTL_120_DATA 0x00081CC0 +#define DDRSS0_CTL_115_DATA 0x00007173 +#define DDRSS0_CTL_116_DATA 0x00040D40 +#define DDRSS0_CTL_117_DATA 0x00040D40 +#define DDRSS0_CTL_118_DATA 0x00040D40 +#define DDRSS0_CTL_119_DATA 0x00040D40 +#define DDRSS0_CTL_120_DATA 0x00040D40 #define DDRSS0_CTL_121_DATA 0x00000000 -#define DDRSS0_CTL_122_DATA 0x0000E325 +#define DDRSS0_CTL_122_DATA 0x00007173 #define DDRSS0_CTL_123_DATA 0x00000000 #define DDRSS0_CTL_124_DATA 0x00000000 #define DDRSS0_CTL_125_DATA 0x00000000 @@ -192,17 +192,17 @@ #define DDRSS0_CTL_173_DATA 0x00000000 #define DDRSS0_CTL_174_DATA 0x00000000 #define DDRSS0_CTL_175_DATA 0x3FF40084 -#define DDRSS0_CTL_176_DATA 0x33003FF4 -#define DDRSS0_CTL_177_DATA 0x00003333 -#define DDRSS0_CTL_178_DATA 0x56000000 -#define DDRSS0_CTL_179_DATA 0x27270056 +#define DDRSS0_CTL_176_DATA 0xB3003FF4 +#define DDRSS0_CTL_177_DATA 0x0000B3B3 +#define DDRSS0_CTL_178_DATA 0x36000000 +#define DDRSS0_CTL_179_DATA 0x27270036 #define DDRSS0_CTL_180_DATA 0x0F0F0000 #define DDRSS0_CTL_181_DATA 0x16000000 #define DDRSS0_CTL_182_DATA 0x00841616 #define DDRSS0_CTL_183_DATA 0x3FF43FF4 -#define DDRSS0_CTL_184_DATA 0x33333300 +#define DDRSS0_CTL_184_DATA 0xB3B3B300 #define DDRSS0_CTL_185_DATA 0x00000000 -#define DDRSS0_CTL_186_DATA 0x00565600 +#define DDRSS0_CTL_186_DATA 0x00363600 #define DDRSS0_CTL_187_DATA 0x00002727 #define DDRSS0_CTL_188_DATA 0x00000F0F #define DDRSS0_CTL_189_DATA 0x16161600 @@ -245,17 +245,17 @@ #define DDRSS0_CTL_226_DATA 0x00000000 #define DDRSS0_CTL_227_DATA 0x15110000 #define DDRSS0_CTL_228_DATA 0x00040C18 -#define DDRSS0_CTL_229_DATA 0x00000000 -#define DDRSS0_CTL_230_DATA 0x00000000 +#define DDRSS0_CTL_229_DATA 0xF000C000 +#define DDRSS0_CTL_230_DATA 0x0000F000 #define DDRSS0_CTL_231_DATA 0x00000000 #define DDRSS0_CTL_232_DATA 0x00000000 -#define DDRSS0_CTL_233_DATA 0x00000000 -#define DDRSS0_CTL_234_DATA 0x00000000 +#define DDRSS0_CTL_233_DATA 0xC0000000 +#define DDRSS0_CTL_234_DATA 0xF000F000 #define DDRSS0_CTL_235_DATA 0x00000000 #define DDRSS0_CTL_236_DATA 0x00000000 #define DDRSS0_CTL_237_DATA 0x00000000 -#define DDRSS0_CTL_238_DATA 0x00000000 -#define DDRSS0_CTL_239_DATA 0x00000000 +#define DDRSS0_CTL_238_DATA 0xF000C000 +#define DDRSS0_CTL_239_DATA 0x0000F000 #define DDRSS0_CTL_240_DATA 0x00000000 #define DDRSS0_CTL_241_DATA 0x00000000 #define DDRSS0_CTL_242_DATA 0x00030000 @@ -283,7 +283,7 @@ #define DDRSS0_CTL_264_DATA 0x00000040 #define DDRSS0_CTL_265_DATA 0x006B0003 #define DDRSS0_CTL_266_DATA 0x0100006B -#define DDRSS0_CTL_267_DATA 0x00000000 +#define DDRSS0_CTL_267_DATA 0x03030303 #define DDRSS0_CTL_268_DATA 0x00000000 #define DDRSS0_CTL_269_DATA 0x00000202 #define DDRSS0_CTL_270_DATA 0x00001FFF @@ -307,7 +307,7 @@ #define DDRSS0_CTL_288_DATA 0x00000000 #define DDRSS0_CTL_289_DATA 0x00000000 #define DDRSS0_CTL_290_DATA 0x03030300 -#define DDRSS0_CTL_291_DATA 0x00000001 +#define DDRSS0_CTL_291_DATA 0x00000101 #define DDRSS0_CTL_292_DATA 0x00000000 #define DDRSS0_CTL_293_DATA 0x00000000 #define DDRSS0_CTL_294_DATA 0x00000000 @@ -405,29 +405,29 @@ #define DDRSS0_CTL_386_DATA 0x00000000 #define DDRSS0_CTL_387_DATA 0x3A3A1B00 #define DDRSS0_CTL_388_DATA 0x000A0000 -#define DDRSS0_CTL_389_DATA 0x0000019C +#define DDRSS0_CTL_389_DATA 0x000000C6 #define DDRSS0_CTL_390_DATA 0x00000200 #define DDRSS0_CTL_391_DATA 0x00000200 #define DDRSS0_CTL_392_DATA 0x00000200 #define DDRSS0_CTL_393_DATA 0x00000200 -#define DDRSS0_CTL_394_DATA 0x000004D4 -#define DDRSS0_CTL_395_DATA 0x00001018 +#define DDRSS0_CTL_394_DATA 0x00000252 +#define DDRSS0_CTL_395_DATA 0x000007BC #define DDRSS0_CTL_396_DATA 0x00000204 -#define DDRSS0_CTL_397_DATA 0x000040E6 +#define DDRSS0_CTL_397_DATA 0x0000206A #define DDRSS0_CTL_398_DATA 0x00000200 #define DDRSS0_CTL_399_DATA 0x00000200 #define DDRSS0_CTL_400_DATA 0x00000200 #define DDRSS0_CTL_401_DATA 0x00000200 -#define DDRSS0_CTL_402_DATA 0x0000C2B2 -#define DDRSS0_CTL_403_DATA 0x000288FC +#define DDRSS0_CTL_402_DATA 0x0000613E +#define DDRSS0_CTL_403_DATA 0x00014424 #define DDRSS0_CTL_404_DATA 0x00000E15 -#define DDRSS0_CTL_405_DATA 0x000040E6 +#define DDRSS0_CTL_405_DATA 0x0000206A #define DDRSS0_CTL_406_DATA 0x00000200 #define DDRSS0_CTL_407_DATA 0x00000200 #define DDRSS0_CTL_408_DATA 0x00000200 #define DDRSS0_CTL_409_DATA 0x00000200 -#define DDRSS0_CTL_410_DATA 0x0000C2B2 -#define DDRSS0_CTL_411_DATA 0x000288FC +#define DDRSS0_CTL_410_DATA 0x0000613E +#define DDRSS0_CTL_411_DATA 0x00014424 #define DDRSS0_CTL_412_DATA 0x02020E15 #define DDRSS0_CTL_413_DATA 0x03030202 #define DDRSS0_CTL_414_DATA 0x00000022 @@ -488,8 +488,8 @@ #define DDRSS0_PI_09_DATA 0x00000000 #define DDRSS0_PI_10_DATA 0x00000000 #define DDRSS0_PI_11_DATA 0x00000000 -#define DDRSS0_PI_12_DATA 0x00000007 -#define DDRSS0_PI_13_DATA 0x00010002 +#define DDRSS0_PI_12_DATA 0x00000003 +#define DDRSS0_PI_13_DATA 0x00010001 #define DDRSS0_PI_14_DATA 0x0800000F #define DDRSS0_PI_15_DATA 0x00000103 #define DDRSS0_PI_16_DATA 0x00000005 @@ -537,18 +537,18 @@ #define DDRSS0_PI_58_DATA 0x00000000 #define DDRSS0_PI_59_DATA 0x00000000 #define DDRSS0_PI_60_DATA 0x0A0A140A -#define DDRSS0_PI_61_DATA 0x10020101 +#define DDRSS0_PI_61_DATA 0x10020201 #define DDRSS0_PI_62_DATA 0x00020805 #define DDRSS0_PI_63_DATA 0x01000404 #define DDRSS0_PI_64_DATA 0x00000000 #define DDRSS0_PI_65_DATA 0x00000000 -#define DDRSS0_PI_66_DATA 0x00000100 -#define DDRSS0_PI_67_DATA 0x0001010F +#define DDRSS0_PI_66_DATA 0x01000100 +#define DDRSS0_PI_67_DATA 0x0102020F #define DDRSS0_PI_68_DATA 0x00340000 #define DDRSS0_PI_69_DATA 0x00000000 #define DDRSS0_PI_70_DATA 0x00000000 #define DDRSS0_PI_71_DATA 0x0000FFFF -#define DDRSS0_PI_72_DATA 0x00000000 +#define DDRSS0_PI_72_DATA 0x01000000 #define DDRSS0_PI_73_DATA 0x00080000 #define DDRSS0_PI_74_DATA 0x02000200 #define DDRSS0_PI_75_DATA 0x01000100 @@ -646,19 +646,19 @@ #define DDRSS0_PI_167_DATA 0x02000200 #define DDRSS0_PI_168_DATA 0x48120C04 #define DDRSS0_PI_169_DATA 0x00154812 -#define DDRSS0_PI_170_DATA 0x000000CE +#define DDRSS0_PI_170_DATA 0x00000063 #define DDRSS0_PI_171_DATA 0x0000032B -#define DDRSS0_PI_172_DATA 0x00002073 +#define DDRSS0_PI_172_DATA 0x00001035 #define DDRSS0_PI_173_DATA 0x0000032B -#define DDRSS0_PI_174_DATA 0x04002073 +#define DDRSS0_PI_174_DATA 0x04001035 #define DDRSS0_PI_175_DATA 0x01010404 -#define DDRSS0_PI_176_DATA 0x00001501 +#define DDRSS0_PI_176_DATA 0x00001500 #define DDRSS0_PI_177_DATA 0x00150015 #define DDRSS0_PI_178_DATA 0x01000100 #define DDRSS0_PI_179_DATA 0x00000100 #define DDRSS0_PI_180_DATA 0x00000000 #define DDRSS0_PI_181_DATA 0x01010101 -#define DDRSS0_PI_182_DATA 0x00000101 +#define DDRSS0_PI_182_DATA 0x00000000 #define DDRSS0_PI_183_DATA 0x00000000 #define DDRSS0_PI_184_DATA 0x00000000 #define DDRSS0_PI_185_DATA 0x15040000 @@ -667,7 +667,7 @@ #define DDRSS0_PI_188_DATA 0x000D0035 #define DDRSS0_PI_189_DATA 0x00218049 #define DDRSS0_PI_190_DATA 0x00218049 -#define DDRSS0_PI_191_DATA 0x01010101 +#define DDRSS0_PI_191_DATA 0x01000101 #define DDRSS0_PI_192_DATA 0x0004000E #define DDRSS0_PI_193_DATA 0x00040216 #define DDRSS0_PI_194_DATA 0x01000216 @@ -693,24 +693,24 @@ #define DDRSS0_PI_214_DATA 0x03013212 #define DDRSS0_PI_215_DATA 0x00003600 #define DDRSS0_PI_216_DATA 0x3212005B -#define DDRSS0_PI_217_DATA 0x09000301 +#define DDRSS0_PI_217_DATA 0x09000001 #define DDRSS0_PI_218_DATA 0x04010504 -#define DDRSS0_PI_219_DATA 0x040006C9 +#define DDRSS0_PI_219_DATA 0x04000364 #define DDRSS0_PI_220_DATA 0x0A032001 #define DDRSS0_PI_221_DATA 0x2C31110A #define DDRSS0_PI_222_DATA 0x00002918 -#define DDRSS0_PI_223_DATA 0x6001071C +#define DDRSS0_PI_223_DATA 0x6000838E #define DDRSS0_PI_224_DATA 0x1E202008 #define DDRSS0_PI_225_DATA 0x2C311116 #define DDRSS0_PI_226_DATA 0x00002918 -#define DDRSS0_PI_227_DATA 0x6001071C +#define DDRSS0_PI_227_DATA 0x6000838E #define DDRSS0_PI_228_DATA 0x1E202008 -#define DDRSS0_PI_229_DATA 0x00019C16 -#define DDRSS0_PI_230_DATA 0x00001018 -#define DDRSS0_PI_231_DATA 0x000040E6 -#define DDRSS0_PI_232_DATA 0x000288FC -#define DDRSS0_PI_233_DATA 0x000040E6 -#define DDRSS0_PI_234_DATA 0x000288FC +#define DDRSS0_PI_229_DATA 0x0000C616 +#define DDRSS0_PI_230_DATA 0x000007BC +#define DDRSS0_PI_231_DATA 0x0000206A +#define DDRSS0_PI_232_DATA 0x00014424 +#define DDRSS0_PI_233_DATA 0x0000206A +#define DDRSS0_PI_234_DATA 0x00014424 #define DDRSS0_PI_235_DATA 0x033B0016 #define DDRSS0_PI_236_DATA 0x0303033B #define DDRSS0_PI_237_DATA 0x002AF803 @@ -751,29 +751,29 @@ #define DDRSS0_PI_272_DATA 0x00080804 #define DDRSS0_PI_273_DATA 0x00000000 #define DDRSS0_PI_274_DATA 0x00000000 -#define DDRSS0_PI_275_DATA 0x00330084 +#define DDRSS0_PI_275_DATA 0x00B30084 #define DDRSS0_PI_276_DATA 0x00160000 -#define DDRSS0_PI_277_DATA 0x56333FF4 +#define DDRSS0_PI_277_DATA 0x36B33FF4 #define DDRSS0_PI_278_DATA 0x00160F27 -#define DDRSS0_PI_279_DATA 0x56333FF4 +#define DDRSS0_PI_279_DATA 0x36B33FF4 #define DDRSS0_PI_280_DATA 0x00160F27 -#define DDRSS0_PI_281_DATA 0x00330084 +#define DDRSS0_PI_281_DATA 0x00B30084 #define DDRSS0_PI_282_DATA 0x00160000 -#define DDRSS0_PI_283_DATA 0x56333FF4 +#define DDRSS0_PI_283_DATA 0x36B33FF4 #define DDRSS0_PI_284_DATA 0x00160F27 -#define DDRSS0_PI_285_DATA 0x56333FF4 +#define DDRSS0_PI_285_DATA 0x36B33FF4 #define DDRSS0_PI_286_DATA 0x00160F27 -#define DDRSS0_PI_287_DATA 0x00330084 +#define DDRSS0_PI_287_DATA 0x00B30084 #define DDRSS0_PI_288_DATA 0x00160000 -#define DDRSS0_PI_289_DATA 0x56333FF4 +#define DDRSS0_PI_289_DATA 0x36B33FF4 #define DDRSS0_PI_290_DATA 0x00160F27 -#define DDRSS0_PI_291_DATA 0x56333FF4 +#define DDRSS0_PI_291_DATA 0x36B33FF4 #define DDRSS0_PI_292_DATA 0x00160F27 -#define DDRSS0_PI_293_DATA 0x00330084 +#define DDRSS0_PI_293_DATA 0x00B30084 #define DDRSS0_PI_294_DATA 0x00160000 -#define DDRSS0_PI_295_DATA 0x56333FF4 +#define DDRSS0_PI_295_DATA 0x36B33FF4 #define DDRSS0_PI_296_DATA 0x00160F27 -#define DDRSS0_PI_297_DATA 0x56333FF4 +#define DDRSS0_PI_297_DATA 0x36B33FF4 #define DDRSS0_PI_298_DATA 0x00160F27 #define DDRSS0_PI_299_DATA 0x00000000 @@ -789,7 +789,7 @@ #define DDRSS0_PHY_09_DATA 0x00000000 #define DDRSS0_PHY_10_DATA 0x00000000 #define DDRSS0_PHY_11_DATA 0x01000001 -#define DDRSS0_PHY_12_DATA 0x00000100 +#define DDRSS0_PHY_12_DATA 0x00000200 #define DDRSS0_PHY_13_DATA 0x000800C0 #define DDRSS0_PHY_14_DATA 0x060100CC #define DDRSS0_PHY_15_DATA 0x00030066 @@ -808,9 +808,9 @@ #define DDRSS0_PHY_28_DATA 0x2A000000 #define DDRSS0_PHY_29_DATA 0x00000808 #define DDRSS0_PHY_30_DATA 0x0F000000 -#define DDRSS0_PHY_31_DATA 0x00000F0F -#define DDRSS0_PHY_32_DATA 0x10200000 -#define DDRSS0_PHY_33_DATA 0x0C002006 +#define DDRSS0_PHY_31_DATA 0x00000F08 +#define DDRSS0_PHY_32_DATA 0x10400000 +#define DDRSS0_PHY_33_DATA 0x0C002002 #define DDRSS0_PHY_34_DATA 0x00000000 #define DDRSS0_PHY_35_DATA 0x00000000 #define DDRSS0_PHY_36_DATA 0x55555555 @@ -877,7 +877,7 @@ #define DDRSS0_PHY_97_DATA 0x00050010 #define DDRSS0_PHY_98_DATA 0x51517041 #define DDRSS0_PHY_99_DATA 0x31C06001 -#define DDRSS0_PHY_100_DATA 0x07AB0340 +#define DDRSS0_PHY_100_DATA 0x07AB01AB #define DDRSS0_PHY_101_DATA 0x00C0C001 #define DDRSS0_PHY_102_DATA 0x0E0D0001 #define DDRSS0_PHY_103_DATA 0x10001000 @@ -913,7 +913,7 @@ #define DDRSS0_PHY_133_DATA 0x00000000 #define DDRSS0_PHY_134_DATA 0x00080200 #define DDRSS0_PHY_135_DATA 0x00000000 -#define DDRSS0_PHY_136_DATA 0x20202000 +#define DDRSS0_PHY_136_DATA 0x20202020 #define DDRSS0_PHY_137_DATA 0x20202020 #define DDRSS0_PHY_138_DATA 0xF0F02020 #define DDRSS0_PHY_139_DATA 0x00000000 @@ -1045,7 +1045,7 @@ #define DDRSS0_PHY_265_DATA 0x00000000 #define DDRSS0_PHY_266_DATA 0x00000000 #define DDRSS0_PHY_267_DATA 0x01000001 -#define DDRSS0_PHY_268_DATA 0x00000100 +#define DDRSS0_PHY_268_DATA 0x00000200 #define DDRSS0_PHY_269_DATA 0x000800C0 #define DDRSS0_PHY_270_DATA 0x060100CC #define DDRSS0_PHY_271_DATA 0x00030066 @@ -1064,9 +1064,9 @@ #define DDRSS0_PHY_284_DATA 0x2A000000 #define DDRSS0_PHY_285_DATA 0x00000808 #define DDRSS0_PHY_286_DATA 0x0F000000 -#define DDRSS0_PHY_287_DATA 0x00000F0F -#define DDRSS0_PHY_288_DATA 0x10200000 -#define DDRSS0_PHY_289_DATA 0x0C002006 +#define DDRSS0_PHY_287_DATA 0x00000F08 +#define DDRSS0_PHY_288_DATA 0x10400000 +#define DDRSS0_PHY_289_DATA 0x0C002002 #define DDRSS0_PHY_290_DATA 0x00000000 #define DDRSS0_PHY_291_DATA 0x00000000 #define DDRSS0_PHY_292_DATA 0x55555555 @@ -1133,7 +1133,7 @@ #define DDRSS0_PHY_353_DATA 0x00050010 #define DDRSS0_PHY_354_DATA 0x51517041 #define DDRSS0_PHY_355_DATA 0x31C06001 -#define DDRSS0_PHY_356_DATA 0x07AB0340 +#define DDRSS0_PHY_356_DATA 0x07AB01AB #define DDRSS0_PHY_357_DATA 0x00C0C001 #define DDRSS0_PHY_358_DATA 0x0E0D0001 #define DDRSS0_PHY_359_DATA 0x10001000 @@ -1169,7 +1169,7 @@ #define DDRSS0_PHY_389_DATA 0x00000000 #define DDRSS0_PHY_390_DATA 0x00080200 #define DDRSS0_PHY_391_DATA 0x00000000 -#define DDRSS0_PHY_392_DATA 0x20202000 +#define DDRSS0_PHY_392_DATA 0x20202020 #define DDRSS0_PHY_393_DATA 0x20202020 #define DDRSS0_PHY_394_DATA 0xF0F02020 #define DDRSS0_PHY_395_DATA 0x00000000 @@ -1301,7 +1301,7 @@ #define DDRSS0_PHY_521_DATA 0x00000000 #define DDRSS0_PHY_522_DATA 0x00000000 #define DDRSS0_PHY_523_DATA 0x01000001 -#define DDRSS0_PHY_524_DATA 0x00000100 +#define DDRSS0_PHY_524_DATA 0x00000200 #define DDRSS0_PHY_525_DATA 0x000800C0 #define DDRSS0_PHY_526_DATA 0x060100CC #define DDRSS0_PHY_527_DATA 0x00030066 @@ -1320,9 +1320,9 @@ #define DDRSS0_PHY_540_DATA 0x2A000000 #define DDRSS0_PHY_541_DATA 0x00000808 #define DDRSS0_PHY_542_DATA 0x0F000000 -#define DDRSS0_PHY_543_DATA 0x00000F0F -#define DDRSS0_PHY_544_DATA 0x10200000 -#define DDRSS0_PHY_545_DATA 0x0C002006 +#define DDRSS0_PHY_543_DATA 0x00000F08 +#define DDRSS0_PHY_544_DATA 0x10400000 +#define DDRSS0_PHY_545_DATA 0x0C002002 #define DDRSS0_PHY_546_DATA 0x00000000 #define DDRSS0_PHY_547_DATA 0x00000000 #define DDRSS0_PHY_548_DATA 0x55555555 @@ -1389,7 +1389,7 @@ #define DDRSS0_PHY_609_DATA 0x00050010 #define DDRSS0_PHY_610_DATA 0x51517041 #define DDRSS0_PHY_611_DATA 0x31C06001 -#define DDRSS0_PHY_612_DATA 0x07AB0340 +#define DDRSS0_PHY_612_DATA 0x07AB01AB #define DDRSS0_PHY_613_DATA 0x00C0C001 #define DDRSS0_PHY_614_DATA 0x0E0D0001 #define DDRSS0_PHY_615_DATA 0x10001000 @@ -1425,7 +1425,7 @@ #define DDRSS0_PHY_645_DATA 0x00000000 #define DDRSS0_PHY_646_DATA 0x00080200 #define DDRSS0_PHY_647_DATA 0x00000000 -#define DDRSS0_PHY_648_DATA 0x20202000 +#define DDRSS0_PHY_648_DATA 0x20202020 #define DDRSS0_PHY_649_DATA 0x20202020 #define DDRSS0_PHY_650_DATA 0xF0F02020 #define DDRSS0_PHY_651_DATA 0x00000000 @@ -1557,7 +1557,7 @@ #define DDRSS0_PHY_777_DATA 0x00000000 #define DDRSS0_PHY_778_DATA 0x00000000 #define DDRSS0_PHY_779_DATA 0x01000001 -#define DDRSS0_PHY_780_DATA 0x00000100 +#define DDRSS0_PHY_780_DATA 0x00000200 #define DDRSS0_PHY_781_DATA 0x000800C0 #define DDRSS0_PHY_782_DATA 0x060100CC #define DDRSS0_PHY_783_DATA 0x00030066 @@ -1576,9 +1576,9 @@ #define DDRSS0_PHY_796_DATA 0x2A000000 #define DDRSS0_PHY_797_DATA 0x00000808 #define DDRSS0_PHY_798_DATA 0x0F000000 -#define DDRSS0_PHY_799_DATA 0x00000F0F -#define DDRSS0_PHY_800_DATA 0x10200000 -#define DDRSS0_PHY_801_DATA 0x0C002006 +#define DDRSS0_PHY_799_DATA 0x00000F08 +#define DDRSS0_PHY_800_DATA 0x10400000 +#define DDRSS0_PHY_801_DATA 0x0C002002 #define DDRSS0_PHY_802_DATA 0x00000000 #define DDRSS0_PHY_803_DATA 0x00000000 #define DDRSS0_PHY_804_DATA 0x55555555 @@ -1645,7 +1645,7 @@ #define DDRSS0_PHY_865_DATA 0x00050010 #define DDRSS0_PHY_866_DATA 0x51517041 #define DDRSS0_PHY_867_DATA 0x31C06001 -#define DDRSS0_PHY_868_DATA 0x07AB0340 +#define DDRSS0_PHY_868_DATA 0x07AB01AB #define DDRSS0_PHY_869_DATA 0x00C0C001 #define DDRSS0_PHY_870_DATA 0x0E0D0001 #define DDRSS0_PHY_871_DATA 0x10001000 @@ -1681,7 +1681,7 @@ #define DDRSS0_PHY_901_DATA 0x00000000 #define DDRSS0_PHY_902_DATA 0x00080200 #define DDRSS0_PHY_903_DATA 0x00000000 -#define DDRSS0_PHY_904_DATA 0x20202000 +#define DDRSS0_PHY_904_DATA 0x20202020 #define DDRSS0_PHY_905_DATA 0x20202020 #define DDRSS0_PHY_906_DATA 0xF0F02020 #define DDRSS0_PHY_907_DATA 0x00000000 @@ -2080,14 +2080,14 @@ #define DDRSS0_PHY_1300_DATA 0x00040101 #define DDRSS0_PHY_1301_DATA 0x0000010F #define DDRSS0_PHY_1302_DATA 0x00000000 -#define DDRSS0_PHY_1303_DATA 0x0000FFFF +#define DDRSS0_PHY_1303_DATA 0x00000064 #define DDRSS0_PHY_1304_DATA 0x00000000 #define DDRSS0_PHY_1305_DATA 0x01010000 #define DDRSS0_PHY_1306_DATA 0x01080402 #define DDRSS0_PHY_1307_DATA 0x01200F02 #define DDRSS0_PHY_1308_DATA 0x00194280 #define DDRSS0_PHY_1309_DATA 0x00000004 -#define DDRSS0_PHY_1310_DATA 0x00052000 +#define DDRSS0_PHY_1310_DATA 0x00042000 #define DDRSS0_PHY_1311_DATA 0x00000000 #define DDRSS0_PHY_1312_DATA 0x00000000 #define DDRSS0_PHY_1313_DATA 0x00000000 @@ -2174,7 +2174,7 @@ #define DDRSS0_PHY_1394_DATA 0x00000003 #define DDRSS0_PHY_1395_DATA 0x00000000 #define DDRSS0_PHY_1396_DATA 0x00001142 -#define DDRSS0_PHY_1397_DATA 0x010207AB +#define DDRSS0_PHY_1397_DATA 0x040207AB #define DDRSS0_PHY_1398_DATA 0x01000080 #define DDRSS0_PHY_1399_DATA 0x03900390 #define DDRSS0_PHY_1400_DATA 0x03900390 @@ -2236,7 +2236,7 @@ #define DDRSS1_CTL_32_DATA 0x00000000 #define DDRSS1_CTL_33_DATA 0x00000000 #define DDRSS1_CTL_34_DATA 0x040C0000 -#define DDRSS1_CTL_35_DATA 0x12481248 +#define DDRSS1_CTL_35_DATA 0x12501250 #define DDRSS1_CTL_36_DATA 0x00050804 #define DDRSS1_CTL_37_DATA 0x09040008 #define DDRSS1_CTL_38_DATA 0x15000204 @@ -2245,11 +2245,11 @@ #define DDRSS1_CTL_41_DATA 0x1760008B #define DDRSS1_CTL_42_DATA 0x2000422B #define DDRSS1_CTL_43_DATA 0x000A0A09 -#define DDRSS1_CTL_44_DATA 0x0400078A +#define DDRSS1_CTL_44_DATA 0x040003C5 #define DDRSS1_CTL_45_DATA 0x1E161104 -#define DDRSS1_CTL_46_DATA 0x10012458 +#define DDRSS1_CTL_46_DATA 0x1000922C #define DDRSS1_CTL_47_DATA 0x1E161110 -#define DDRSS1_CTL_48_DATA 0x10012458 +#define DDRSS1_CTL_48_DATA 0x1000922C #define DDRSS1_CTL_49_DATA 0x02030410 #define DDRSS1_CTL_50_DATA 0x2C040500 #define DDRSS1_CTL_51_DATA 0x08292C29 @@ -2262,11 +2262,11 @@ #define DDRSS1_CTL_58_DATA 0x00010100 #define DDRSS1_CTL_59_DATA 0x03010000 #define DDRSS1_CTL_60_DATA 0x00001508 -#define DDRSS1_CTL_61_DATA 0x000000CE +#define DDRSS1_CTL_61_DATA 0x00000063 #define DDRSS1_CTL_62_DATA 0x0000032B -#define DDRSS1_CTL_63_DATA 0x00002073 +#define DDRSS1_CTL_63_DATA 0x00001035 #define DDRSS1_CTL_64_DATA 0x0000032B -#define DDRSS1_CTL_65_DATA 0x00002073 +#define DDRSS1_CTL_65_DATA 0x00001035 #define DDRSS1_CTL_66_DATA 0x00000005 #define DDRSS1_CTL_67_DATA 0x00050000 #define DDRSS1_CTL_68_DATA 0x00CB0012 @@ -2303,27 +2303,27 @@ #define DDRSS1_CTL_99_DATA 0x00000000 #define DDRSS1_CTL_100_DATA 0x00040005 #define DDRSS1_CTL_101_DATA 0x00000000 -#define DDRSS1_CTL_102_DATA 0x00003380 -#define DDRSS1_CTL_103_DATA 0x00003380 -#define DDRSS1_CTL_104_DATA 0x00003380 -#define DDRSS1_CTL_105_DATA 0x00003380 -#define DDRSS1_CTL_106_DATA 0x00003380 +#define DDRSS1_CTL_102_DATA 0x000018C0 +#define DDRSS1_CTL_103_DATA 0x000018C0 +#define DDRSS1_CTL_104_DATA 0x000018C0 +#define DDRSS1_CTL_105_DATA 0x000018C0 +#define DDRSS1_CTL_106_DATA 0x000018C0 #define DDRSS1_CTL_107_DATA 0x00000000 -#define DDRSS1_CTL_108_DATA 0x000005A2 -#define DDRSS1_CTL_109_DATA 0x00081CC0 -#define DDRSS1_CTL_110_DATA 0x00081CC0 -#define DDRSS1_CTL_111_DATA 0x00081CC0 -#define DDRSS1_CTL_112_DATA 0x00081CC0 -#define DDRSS1_CTL_113_DATA 0x00081CC0 +#define DDRSS1_CTL_108_DATA 0x000002B5 +#define DDRSS1_CTL_109_DATA 0x00040D40 +#define DDRSS1_CTL_110_DATA 0x00040D40 +#define DDRSS1_CTL_111_DATA 0x00040D40 +#define DDRSS1_CTL_112_DATA 0x00040D40 +#define DDRSS1_CTL_113_DATA 0x00040D40 #define DDRSS1_CTL_114_DATA 0x00000000 -#define DDRSS1_CTL_115_DATA 0x0000E325 -#define DDRSS1_CTL_116_DATA 0x00081CC0 -#define DDRSS1_CTL_117_DATA 0x00081CC0 -#define DDRSS1_CTL_118_DATA 0x00081CC0 -#define DDRSS1_CTL_119_DATA 0x00081CC0 -#define DDRSS1_CTL_120_DATA 0x00081CC0 +#define DDRSS1_CTL_115_DATA 0x00007173 +#define DDRSS1_CTL_116_DATA 0x00040D40 +#define DDRSS1_CTL_117_DATA 0x00040D40 +#define DDRSS1_CTL_118_DATA 0x00040D40 +#define DDRSS1_CTL_119_DATA 0x00040D40 +#define DDRSS1_CTL_120_DATA 0x00040D40 #define DDRSS1_CTL_121_DATA 0x00000000 -#define DDRSS1_CTL_122_DATA 0x0000E325 +#define DDRSS1_CTL_122_DATA 0x00007173 #define DDRSS1_CTL_123_DATA 0x00000000 #define DDRSS1_CTL_124_DATA 0x00000000 #define DDRSS1_CTL_125_DATA 0x00000000 @@ -2377,17 +2377,17 @@ #define DDRSS1_CTL_173_DATA 0x00000000 #define DDRSS1_CTL_174_DATA 0x00000000 #define DDRSS1_CTL_175_DATA 0x3FF40084 -#define DDRSS1_CTL_176_DATA 0x33003FF4 -#define DDRSS1_CTL_177_DATA 0x00003333 -#define DDRSS1_CTL_178_DATA 0x56000000 -#define DDRSS1_CTL_179_DATA 0x27270056 +#define DDRSS1_CTL_176_DATA 0xF3003FF4 +#define DDRSS1_CTL_177_DATA 0x0000F3F3 +#define DDRSS1_CTL_178_DATA 0x36000000 +#define DDRSS1_CTL_179_DATA 0x27270036 #define DDRSS1_CTL_180_DATA 0x0F0F0000 #define DDRSS1_CTL_181_DATA 0x16000000 #define DDRSS1_CTL_182_DATA 0x00841616 #define DDRSS1_CTL_183_DATA 0x3FF43FF4 -#define DDRSS1_CTL_184_DATA 0x33333300 +#define DDRSS1_CTL_184_DATA 0xF3F3F300 #define DDRSS1_CTL_185_DATA 0x00000000 -#define DDRSS1_CTL_186_DATA 0x00565600 +#define DDRSS1_CTL_186_DATA 0x00363600 #define DDRSS1_CTL_187_DATA 0x00002727 #define DDRSS1_CTL_188_DATA 0x00000F0F #define DDRSS1_CTL_189_DATA 0x16161600 @@ -2430,17 +2430,17 @@ #define DDRSS1_CTL_226_DATA 0x00000000 #define DDRSS1_CTL_227_DATA 0x15110000 #define DDRSS1_CTL_228_DATA 0x00040C18 -#define DDRSS1_CTL_229_DATA 0x00000000 -#define DDRSS1_CTL_230_DATA 0x00000000 +#define DDRSS1_CTL_229_DATA 0xF000C000 +#define DDRSS1_CTL_230_DATA 0x0000F000 #define DDRSS1_CTL_231_DATA 0x00000000 #define DDRSS1_CTL_232_DATA 0x00000000 -#define DDRSS1_CTL_233_DATA 0x00000000 -#define DDRSS1_CTL_234_DATA 0x00000000 +#define DDRSS1_CTL_233_DATA 0xC0000000 +#define DDRSS1_CTL_234_DATA 0xF000F000 #define DDRSS1_CTL_235_DATA 0x00000000 #define DDRSS1_CTL_236_DATA 0x00000000 #define DDRSS1_CTL_237_DATA 0x00000000 -#define DDRSS1_CTL_238_DATA 0x00000000 -#define DDRSS1_CTL_239_DATA 0x00000000 +#define DDRSS1_CTL_238_DATA 0xF000C000 +#define DDRSS1_CTL_239_DATA 0x0000F000 #define DDRSS1_CTL_240_DATA 0x00000000 #define DDRSS1_CTL_241_DATA 0x00000000 #define DDRSS1_CTL_242_DATA 0x00030000 @@ -2468,7 +2468,7 @@ #define DDRSS1_CTL_264_DATA 0x00000040 #define DDRSS1_CTL_265_DATA 0x006B0003 #define DDRSS1_CTL_266_DATA 0x0100006B -#define DDRSS1_CTL_267_DATA 0x00000000 +#define DDRSS1_CTL_267_DATA 0x03030303 #define DDRSS1_CTL_268_DATA 0x00000000 #define DDRSS1_CTL_269_DATA 0x00000202 #define DDRSS1_CTL_270_DATA 0x00001FFF @@ -2492,7 +2492,7 @@ #define DDRSS1_CTL_288_DATA 0x00000000 #define DDRSS1_CTL_289_DATA 0x00000000 #define DDRSS1_CTL_290_DATA 0x03030300 -#define DDRSS1_CTL_291_DATA 0x00000001 +#define DDRSS1_CTL_291_DATA 0x00010101 #define DDRSS1_CTL_292_DATA 0x00000000 #define DDRSS1_CTL_293_DATA 0x00000000 #define DDRSS1_CTL_294_DATA 0x00000000 @@ -2520,7 +2520,7 @@ #define DDRSS1_CTL_316_DATA 0x01010001 #define DDRSS1_CTL_317_DATA 0x00010101 #define DDRSS1_CTL_318_DATA 0x050A0A03 -#define DDRSS1_CTL_319_DATA 0x10081F1F +#define DDRSS1_CTL_319_DATA 0x10082323 #define DDRSS1_CTL_320_DATA 0x00090310 #define DDRSS1_CTL_321_DATA 0x0B0C030F #define DDRSS1_CTL_322_DATA 0x0B0C0306 @@ -2590,30 +2590,30 @@ #define DDRSS1_CTL_386_DATA 0x00000000 #define DDRSS1_CTL_387_DATA 0x3A3A1B00 #define DDRSS1_CTL_388_DATA 0x000A0000 -#define DDRSS1_CTL_389_DATA 0x0000019C +#define DDRSS1_CTL_389_DATA 0x000000C6 #define DDRSS1_CTL_390_DATA 0x00000200 #define DDRSS1_CTL_391_DATA 0x00000200 #define DDRSS1_CTL_392_DATA 0x00000200 #define DDRSS1_CTL_393_DATA 0x00000200 -#define DDRSS1_CTL_394_DATA 0x000004D4 -#define DDRSS1_CTL_395_DATA 0x00001018 +#define DDRSS1_CTL_394_DATA 0x00000252 +#define DDRSS1_CTL_395_DATA 0x000007BC #define DDRSS1_CTL_396_DATA 0x00000204 -#define DDRSS1_CTL_397_DATA 0x000040E6 +#define DDRSS1_CTL_397_DATA 0x0000206A #define DDRSS1_CTL_398_DATA 0x00000200 #define DDRSS1_CTL_399_DATA 0x00000200 #define DDRSS1_CTL_400_DATA 0x00000200 #define DDRSS1_CTL_401_DATA 0x00000200 -#define DDRSS1_CTL_402_DATA 0x0000C2B2 -#define DDRSS1_CTL_403_DATA 0x000288FC -#define DDRSS1_CTL_404_DATA 0x00000E15 -#define DDRSS1_CTL_405_DATA 0x000040E6 +#define DDRSS1_CTL_402_DATA 0x0000613E +#define DDRSS1_CTL_403_DATA 0x00014424 +#define DDRSS1_CTL_404_DATA 0x00000E19 +#define DDRSS1_CTL_405_DATA 0x0000206A #define DDRSS1_CTL_406_DATA 0x00000200 #define DDRSS1_CTL_407_DATA 0x00000200 #define DDRSS1_CTL_408_DATA 0x00000200 #define DDRSS1_CTL_409_DATA 0x00000200 -#define DDRSS1_CTL_410_DATA 0x0000C2B2 -#define DDRSS1_CTL_411_DATA 0x000288FC -#define DDRSS1_CTL_412_DATA 0x02020E15 +#define DDRSS1_CTL_410_DATA 0x0000613E +#define DDRSS1_CTL_411_DATA 0x00014424 +#define DDRSS1_CTL_412_DATA 0x02020E19 #define DDRSS1_CTL_413_DATA 0x03030202 #define DDRSS1_CTL_414_DATA 0x00000022 #define DDRSS1_CTL_415_DATA 0x00000000 @@ -2630,7 +2630,7 @@ #define DDRSS1_CTL_426_DATA 0x00000000 #define DDRSS1_CTL_427_DATA 0x02000000 #define DDRSS1_CTL_428_DATA 0x01000404 -#define DDRSS1_CTL_429_DATA 0x0B1E0B1E +#define DDRSS1_CTL_429_DATA 0x0B220B22 #define DDRSS1_CTL_430_DATA 0x00000105 #define DDRSS1_CTL_431_DATA 0x00010101 #define DDRSS1_CTL_432_DATA 0x00010101 @@ -2673,8 +2673,8 @@ #define DDRSS1_PI_09_DATA 0x00000000 #define DDRSS1_PI_10_DATA 0x00000000 #define DDRSS1_PI_11_DATA 0x00000000 -#define DDRSS1_PI_12_DATA 0x00000007 -#define DDRSS1_PI_13_DATA 0x00010002 +#define DDRSS1_PI_12_DATA 0x00000003 +#define DDRSS1_PI_13_DATA 0x00010001 #define DDRSS1_PI_14_DATA 0x0800000F #define DDRSS1_PI_15_DATA 0x00000103 #define DDRSS1_PI_16_DATA 0x00000005 @@ -2722,18 +2722,18 @@ #define DDRSS1_PI_58_DATA 0x00000000 #define DDRSS1_PI_59_DATA 0x00000000 #define DDRSS1_PI_60_DATA 0x0A0A140A -#define DDRSS1_PI_61_DATA 0x10020101 +#define DDRSS1_PI_61_DATA 0x10020201 #define DDRSS1_PI_62_DATA 0x00020805 #define DDRSS1_PI_63_DATA 0x01000404 #define DDRSS1_PI_64_DATA 0x00000000 #define DDRSS1_PI_65_DATA 0x00000000 #define DDRSS1_PI_66_DATA 0x00000100 -#define DDRSS1_PI_67_DATA 0x0001010F +#define DDRSS1_PI_67_DATA 0x0002020F #define DDRSS1_PI_68_DATA 0x00340000 #define DDRSS1_PI_69_DATA 0x00000000 #define DDRSS1_PI_70_DATA 0x00000000 #define DDRSS1_PI_71_DATA 0x0000FFFF -#define DDRSS1_PI_72_DATA 0x00000000 +#define DDRSS1_PI_72_DATA 0x01000000 #define DDRSS1_PI_73_DATA 0x00080000 #define DDRSS1_PI_74_DATA 0x02000200 #define DDRSS1_PI_75_DATA 0x01000100 @@ -2826,33 +2826,33 @@ #define DDRSS1_PI_162_DATA 0x00000000 #define DDRSS1_PI_163_DATA 0x2B2B0200 #define DDRSS1_PI_164_DATA 0x00000034 -#define DDRSS1_PI_165_DATA 0x00000064 -#define DDRSS1_PI_166_DATA 0x00020064 +#define DDRSS1_PI_165_DATA 0x00000068 +#define DDRSS1_PI_166_DATA 0x00020068 #define DDRSS1_PI_167_DATA 0x02000200 -#define DDRSS1_PI_168_DATA 0x48120C04 -#define DDRSS1_PI_169_DATA 0x00154812 -#define DDRSS1_PI_170_DATA 0x000000CE +#define DDRSS1_PI_168_DATA 0x50120C04 +#define DDRSS1_PI_169_DATA 0x00155012 +#define DDRSS1_PI_170_DATA 0x00000063 #define DDRSS1_PI_171_DATA 0x0000032B -#define DDRSS1_PI_172_DATA 0x00002073 +#define DDRSS1_PI_172_DATA 0x00001035 #define DDRSS1_PI_173_DATA 0x0000032B -#define DDRSS1_PI_174_DATA 0x04002073 +#define DDRSS1_PI_174_DATA 0x04001035 #define DDRSS1_PI_175_DATA 0x01010404 -#define DDRSS1_PI_176_DATA 0x00001501 +#define DDRSS1_PI_176_DATA 0x00001500 #define DDRSS1_PI_177_DATA 0x00150015 #define DDRSS1_PI_178_DATA 0x01000100 #define DDRSS1_PI_179_DATA 0x00000100 #define DDRSS1_PI_180_DATA 0x00000000 #define DDRSS1_PI_181_DATA 0x01010101 -#define DDRSS1_PI_182_DATA 0x00000101 +#define DDRSS1_PI_182_DATA 0x00000000 #define DDRSS1_PI_183_DATA 0x00000000 #define DDRSS1_PI_184_DATA 0x00000000 -#define DDRSS1_PI_185_DATA 0x15040000 -#define DDRSS1_PI_186_DATA 0x0E0E0215 +#define DDRSS1_PI_185_DATA 0x19040000 +#define DDRSS1_PI_186_DATA 0x0E0E0219 #define DDRSS1_PI_187_DATA 0x00040402 #define DDRSS1_PI_188_DATA 0x000D0035 #define DDRSS1_PI_189_DATA 0x00218049 #define DDRSS1_PI_190_DATA 0x00218049 -#define DDRSS1_PI_191_DATA 0x01010101 +#define DDRSS1_PI_191_DATA 0x01000101 #define DDRSS1_PI_192_DATA 0x0004000E #define DDRSS1_PI_193_DATA 0x00040216 #define DDRSS1_PI_194_DATA 0x01000216 @@ -2874,28 +2874,28 @@ #define DDRSS1_PI_210_DATA 0x00110216 #define DDRSS1_PI_211_DATA 0x32000056 #define DDRSS1_PI_212_DATA 0x00000301 -#define DDRSS1_PI_213_DATA 0x005B0036 +#define DDRSS1_PI_213_DATA 0x005F0036 #define DDRSS1_PI_214_DATA 0x03013212 #define DDRSS1_PI_215_DATA 0x00003600 -#define DDRSS1_PI_216_DATA 0x3212005B -#define DDRSS1_PI_217_DATA 0x09000301 +#define DDRSS1_PI_216_DATA 0x3212005F +#define DDRSS1_PI_217_DATA 0x09000001 #define DDRSS1_PI_218_DATA 0x04010504 -#define DDRSS1_PI_219_DATA 0x040006C9 +#define DDRSS1_PI_219_DATA 0x04000364 #define DDRSS1_PI_220_DATA 0x0A032001 #define DDRSS1_PI_221_DATA 0x2C31110A #define DDRSS1_PI_222_DATA 0x00002918 -#define DDRSS1_PI_223_DATA 0x6001071C +#define DDRSS1_PI_223_DATA 0x6000838E #define DDRSS1_PI_224_DATA 0x1E202008 #define DDRSS1_PI_225_DATA 0x2C311116 #define DDRSS1_PI_226_DATA 0x00002918 -#define DDRSS1_PI_227_DATA 0x6001071C +#define DDRSS1_PI_227_DATA 0x6000838E #define DDRSS1_PI_228_DATA 0x1E202008 -#define DDRSS1_PI_229_DATA 0x00019C16 -#define DDRSS1_PI_230_DATA 0x00001018 -#define DDRSS1_PI_231_DATA 0x000040E6 -#define DDRSS1_PI_232_DATA 0x000288FC -#define DDRSS1_PI_233_DATA 0x000040E6 -#define DDRSS1_PI_234_DATA 0x000288FC +#define DDRSS1_PI_229_DATA 0x0000C616 +#define DDRSS1_PI_230_DATA 0x000007BC +#define DDRSS1_PI_231_DATA 0x0000206A +#define DDRSS1_PI_232_DATA 0x00014424 +#define DDRSS1_PI_233_DATA 0x0000206A +#define DDRSS1_PI_234_DATA 0x00014424 #define DDRSS1_PI_235_DATA 0x033B0016 #define DDRSS1_PI_236_DATA 0x0303033B #define DDRSS1_PI_237_DATA 0x002AF803 @@ -2936,29 +2936,29 @@ #define DDRSS1_PI_272_DATA 0x00080804 #define DDRSS1_PI_273_DATA 0x00000000 #define DDRSS1_PI_274_DATA 0x00000000 -#define DDRSS1_PI_275_DATA 0x00330084 +#define DDRSS1_PI_275_DATA 0x00F30084 #define DDRSS1_PI_276_DATA 0x00160000 -#define DDRSS1_PI_277_DATA 0x56333FF4 +#define DDRSS1_PI_277_DATA 0x36F33FF4 #define DDRSS1_PI_278_DATA 0x00160F27 -#define DDRSS1_PI_279_DATA 0x56333FF4 +#define DDRSS1_PI_279_DATA 0x36F33FF4 #define DDRSS1_PI_280_DATA 0x00160F27 -#define DDRSS1_PI_281_DATA 0x00330084 +#define DDRSS1_PI_281_DATA 0x00F30084 #define DDRSS1_PI_282_DATA 0x00160000 -#define DDRSS1_PI_283_DATA 0x56333FF4 +#define DDRSS1_PI_283_DATA 0x36F33FF4 #define DDRSS1_PI_284_DATA 0x00160F27 -#define DDRSS1_PI_285_DATA 0x56333FF4 +#define DDRSS1_PI_285_DATA 0x36F33FF4 #define DDRSS1_PI_286_DATA 0x00160F27 -#define DDRSS1_PI_287_DATA 0x00330084 +#define DDRSS1_PI_287_DATA 0x00F30084 #define DDRSS1_PI_288_DATA 0x00160000 -#define DDRSS1_PI_289_DATA 0x56333FF4 +#define DDRSS1_PI_289_DATA 0x36F33FF4 #define DDRSS1_PI_290_DATA 0x00160F27 -#define DDRSS1_PI_291_DATA 0x56333FF4 +#define DDRSS1_PI_291_DATA 0x36F33FF4 #define DDRSS1_PI_292_DATA 0x00160F27 -#define DDRSS1_PI_293_DATA 0x00330084 +#define DDRSS1_PI_293_DATA 0x00F30084 #define DDRSS1_PI_294_DATA 0x00160000 -#define DDRSS1_PI_295_DATA 0x56333FF4 +#define DDRSS1_PI_295_DATA 0x36F33FF4 #define DDRSS1_PI_296_DATA 0x00160F27 -#define DDRSS1_PI_297_DATA 0x56333FF4 +#define DDRSS1_PI_297_DATA 0x36F33FF4 #define DDRSS1_PI_298_DATA 0x00160F27 #define DDRSS1_PI_299_DATA 0x00000000 @@ -2974,7 +2974,7 @@ #define DDRSS1_PHY_09_DATA 0x00000000 #define DDRSS1_PHY_10_DATA 0x00000000 #define DDRSS1_PHY_11_DATA 0x01000001 -#define DDRSS1_PHY_12_DATA 0x00000100 +#define DDRSS1_PHY_12_DATA 0x00000200 #define DDRSS1_PHY_13_DATA 0x000800C0 #define DDRSS1_PHY_14_DATA 0x060100CC #define DDRSS1_PHY_15_DATA 0x00030066 @@ -2993,8 +2993,8 @@ #define DDRSS1_PHY_28_DATA 0x2A000000 #define DDRSS1_PHY_29_DATA 0x00000808 #define DDRSS1_PHY_30_DATA 0x0F000000 -#define DDRSS1_PHY_31_DATA 0x00000F0F -#define DDRSS1_PHY_32_DATA 0x10200000 +#define DDRSS1_PHY_31_DATA 0x00000F08 +#define DDRSS1_PHY_32_DATA 0x10400000 #define DDRSS1_PHY_33_DATA 0x0C002006 #define DDRSS1_PHY_34_DATA 0x00000000 #define DDRSS1_PHY_35_DATA 0x00000000 @@ -3062,9 +3062,9 @@ #define DDRSS1_PHY_97_DATA 0x00050010 #define DDRSS1_PHY_98_DATA 0x51517041 #define DDRSS1_PHY_99_DATA 0x31C06001 -#define DDRSS1_PHY_100_DATA 0x07AB0340 +#define DDRSS1_PHY_100_DATA 0x07AB01AB #define DDRSS1_PHY_101_DATA 0x00C0C001 -#define DDRSS1_PHY_102_DATA 0x0E0D0001 +#define DDRSS1_PHY_102_DATA 0x0E0D0101 #define DDRSS1_PHY_103_DATA 0x10001000 #define DDRSS1_PHY_104_DATA 0x0C083E42 #define DDRSS1_PHY_105_DATA 0x0F0C3701 @@ -3098,7 +3098,7 @@ #define DDRSS1_PHY_133_DATA 0x00000000 #define DDRSS1_PHY_134_DATA 0x00080200 #define DDRSS1_PHY_135_DATA 0x00000000 -#define DDRSS1_PHY_136_DATA 0x20202000 +#define DDRSS1_PHY_136_DATA 0x20202020 #define DDRSS1_PHY_137_DATA 0x20202020 #define DDRSS1_PHY_138_DATA 0xF0F02020 #define DDRSS1_PHY_139_DATA 0x00000000 @@ -3230,7 +3230,7 @@ #define DDRSS1_PHY_265_DATA 0x00000000 #define DDRSS1_PHY_266_DATA 0x00000000 #define DDRSS1_PHY_267_DATA 0x01000001 -#define DDRSS1_PHY_268_DATA 0x00000100 +#define DDRSS1_PHY_268_DATA 0x00000200 #define DDRSS1_PHY_269_DATA 0x000800C0 #define DDRSS1_PHY_270_DATA 0x060100CC #define DDRSS1_PHY_271_DATA 0x00030066 @@ -3249,8 +3249,8 @@ #define DDRSS1_PHY_284_DATA 0x2A000000 #define DDRSS1_PHY_285_DATA 0x00000808 #define DDRSS1_PHY_286_DATA 0x0F000000 -#define DDRSS1_PHY_287_DATA 0x00000F0F -#define DDRSS1_PHY_288_DATA 0x10200000 +#define DDRSS1_PHY_287_DATA 0x00000F08 +#define DDRSS1_PHY_288_DATA 0x10400000 #define DDRSS1_PHY_289_DATA 0x0C002006 #define DDRSS1_PHY_290_DATA 0x00000000 #define DDRSS1_PHY_291_DATA 0x00000000 @@ -3318,9 +3318,9 @@ #define DDRSS1_PHY_353_DATA 0x00050010 #define DDRSS1_PHY_354_DATA 0x51517041 #define DDRSS1_PHY_355_DATA 0x31C06001 -#define DDRSS1_PHY_356_DATA 0x07AB0340 +#define DDRSS1_PHY_356_DATA 0x07AB01AB #define DDRSS1_PHY_357_DATA 0x00C0C001 -#define DDRSS1_PHY_358_DATA 0x0E0D0001 +#define DDRSS1_PHY_358_DATA 0x0E0D0101 #define DDRSS1_PHY_359_DATA 0x10001000 #define DDRSS1_PHY_360_DATA 0x0C083E42 #define DDRSS1_PHY_361_DATA 0x0F0C3701 @@ -3354,7 +3354,7 @@ #define DDRSS1_PHY_389_DATA 0x00000000 #define DDRSS1_PHY_390_DATA 0x00080200 #define DDRSS1_PHY_391_DATA 0x00000000 -#define DDRSS1_PHY_392_DATA 0x20202000 +#define DDRSS1_PHY_392_DATA 0x20202020 #define DDRSS1_PHY_393_DATA 0x20202020 #define DDRSS1_PHY_394_DATA 0xF0F02020 #define DDRSS1_PHY_395_DATA 0x00000000 @@ -3486,7 +3486,7 @@ #define DDRSS1_PHY_521_DATA 0x00000000 #define DDRSS1_PHY_522_DATA 0x00000000 #define DDRSS1_PHY_523_DATA 0x01000001 -#define DDRSS1_PHY_524_DATA 0x00000100 +#define DDRSS1_PHY_524_DATA 0x00000200 #define DDRSS1_PHY_525_DATA 0x000800C0 #define DDRSS1_PHY_526_DATA 0x060100CC #define DDRSS1_PHY_527_DATA 0x00030066 @@ -3505,8 +3505,8 @@ #define DDRSS1_PHY_540_DATA 0x2A000000 #define DDRSS1_PHY_541_DATA 0x00000808 #define DDRSS1_PHY_542_DATA 0x0F000000 -#define DDRSS1_PHY_543_DATA 0x00000F0F -#define DDRSS1_PHY_544_DATA 0x10200000 +#define DDRSS1_PHY_543_DATA 0x00000F08 +#define DDRSS1_PHY_544_DATA 0x10400000 #define DDRSS1_PHY_545_DATA 0x0C002006 #define DDRSS1_PHY_546_DATA 0x00000000 #define DDRSS1_PHY_547_DATA 0x00000000 @@ -3574,9 +3574,9 @@ #define DDRSS1_PHY_609_DATA 0x00050010 #define DDRSS1_PHY_610_DATA 0x51517041 #define DDRSS1_PHY_611_DATA 0x31C06001 -#define DDRSS1_PHY_612_DATA 0x07AB0340 +#define DDRSS1_PHY_612_DATA 0x07AB01AB #define DDRSS1_PHY_613_DATA 0x00C0C001 -#define DDRSS1_PHY_614_DATA 0x0E0D0001 +#define DDRSS1_PHY_614_DATA 0x0E0D0101 #define DDRSS1_PHY_615_DATA 0x10001000 #define DDRSS1_PHY_616_DATA 0x0C083E42 #define DDRSS1_PHY_617_DATA 0x0F0C3701 @@ -3610,7 +3610,7 @@ #define DDRSS1_PHY_645_DATA 0x00000000 #define DDRSS1_PHY_646_DATA 0x00080200 #define DDRSS1_PHY_647_DATA 0x00000000 -#define DDRSS1_PHY_648_DATA 0x20202000 +#define DDRSS1_PHY_648_DATA 0x20202020 #define DDRSS1_PHY_649_DATA 0x20202020 #define DDRSS1_PHY_650_DATA 0xF0F02020 #define DDRSS1_PHY_651_DATA 0x00000000 @@ -3742,7 +3742,7 @@ #define DDRSS1_PHY_777_DATA 0x00000000 #define DDRSS1_PHY_778_DATA 0x00000000 #define DDRSS1_PHY_779_DATA 0x01000001 -#define DDRSS1_PHY_780_DATA 0x00000100 +#define DDRSS1_PHY_780_DATA 0x00000200 #define DDRSS1_PHY_781_DATA 0x000800C0 #define DDRSS1_PHY_782_DATA 0x060100CC #define DDRSS1_PHY_783_DATA 0x00030066 @@ -3761,8 +3761,8 @@ #define DDRSS1_PHY_796_DATA 0x2A000000 #define DDRSS1_PHY_797_DATA 0x00000808 #define DDRSS1_PHY_798_DATA 0x0F000000 -#define DDRSS1_PHY_799_DATA 0x00000F0F -#define DDRSS1_PHY_800_DATA 0x10200000 +#define DDRSS1_PHY_799_DATA 0x00000F08 +#define DDRSS1_PHY_800_DATA 0x10400000 #define DDRSS1_PHY_801_DATA 0x0C002006 #define DDRSS1_PHY_802_DATA 0x00000000 #define DDRSS1_PHY_803_DATA 0x00000000 @@ -3830,9 +3830,9 @@ #define DDRSS1_PHY_865_DATA 0x00050010 #define DDRSS1_PHY_866_DATA 0x51517041 #define DDRSS1_PHY_867_DATA 0x31C06001 -#define DDRSS1_PHY_868_DATA 0x07AB0340 +#define DDRSS1_PHY_868_DATA 0x07AB01AB #define DDRSS1_PHY_869_DATA 0x00C0C001 -#define DDRSS1_PHY_870_DATA 0x0E0D0001 +#define DDRSS1_PHY_870_DATA 0x0E0D0101 #define DDRSS1_PHY_871_DATA 0x10001000 #define DDRSS1_PHY_872_DATA 0x0C083E42 #define DDRSS1_PHY_873_DATA 0x0F0C3701 @@ -3866,7 +3866,7 @@ #define DDRSS1_PHY_901_DATA 0x00000000 #define DDRSS1_PHY_902_DATA 0x00080200 #define DDRSS1_PHY_903_DATA 0x00000000 -#define DDRSS1_PHY_904_DATA 0x20202000 +#define DDRSS1_PHY_904_DATA 0x20202020 #define DDRSS1_PHY_905_DATA 0x20202020 #define DDRSS1_PHY_906_DATA 0xF0F02020 #define DDRSS1_PHY_907_DATA 0x00000000 @@ -4265,14 +4265,14 @@ #define DDRSS1_PHY_1300_DATA 0x00040101 #define DDRSS1_PHY_1301_DATA 0x0000010F #define DDRSS1_PHY_1302_DATA 0x00000000 -#define DDRSS1_PHY_1303_DATA 0x0000FFFF +#define DDRSS1_PHY_1303_DATA 0x00000064 #define DDRSS1_PHY_1304_DATA 0x00000000 #define DDRSS1_PHY_1305_DATA 0x01010000 #define DDRSS1_PHY_1306_DATA 0x01080402 #define DDRSS1_PHY_1307_DATA 0x01200F02 #define DDRSS1_PHY_1308_DATA 0x00194280 #define DDRSS1_PHY_1309_DATA 0x00000004 -#define DDRSS1_PHY_1310_DATA 0x00052000 +#define DDRSS1_PHY_1310_DATA 0x00042000 #define DDRSS1_PHY_1311_DATA 0x00000000 #define DDRSS1_PHY_1312_DATA 0x00000000 #define DDRSS1_PHY_1313_DATA 0x00000000 @@ -4359,7 +4359,7 @@ #define DDRSS1_PHY_1394_DATA 0x00000003 #define DDRSS1_PHY_1395_DATA 0x00000000 #define DDRSS1_PHY_1396_DATA 0x00001142 -#define DDRSS1_PHY_1397_DATA 0x010207AB +#define DDRSS1_PHY_1397_DATA 0x040207AB #define DDRSS1_PHY_1398_DATA 0x01000080 #define DDRSS1_PHY_1399_DATA 0x03900390 #define DDRSS1_PHY_1400_DATA 0x03900390 diff --git a/arch/arm/dts/k3-pinctrl.h b/arch/arm/dts/k3-pinctrl.h index c97548a..2a4e0e0 100644 --- a/arch/arm/dts/k3-pinctrl.h +++ b/arch/arm/dts/k3-pinctrl.h @@ -11,6 +11,7 @@ #define PULLUDEN_SHIFT (16) #define PULLTYPESEL_SHIFT (17) #define RXACTIVE_SHIFT (18) +#define DEBOUNCE_SHIFT (11) #define PULL_DISABLE (1 << PULLUDEN_SHIFT) #define PULL_ENABLE (0 << PULLUDEN_SHIFT) @@ -29,9 +30,20 @@ #define PIN_INPUT_PULLUP (INPUT_EN | PULL_UP) #define PIN_INPUT_PULLDOWN (INPUT_EN | PULL_DOWN) +#define PIN_DEBOUNCE_DISABLE (0 << DEBOUNCE_SHIFT) +#define PIN_DEBOUNCE_CONF1 (1 << DEBOUNCE_SHIFT) +#define PIN_DEBOUNCE_CONF2 (2 << DEBOUNCE_SHIFT) +#define PIN_DEBOUNCE_CONF3 (3 << DEBOUNCE_SHIFT) +#define PIN_DEBOUNCE_CONF4 (4 << DEBOUNCE_SHIFT) +#define PIN_DEBOUNCE_CONF5 (5 << DEBOUNCE_SHIFT) +#define PIN_DEBOUNCE_CONF6 (6 << DEBOUNCE_SHIFT) + #define AM62AX_IOPAD(pa, val, muxmode) (((pa) & 0x1fff)) ((val) | (muxmode)) #define AM62AX_MCU_IOPAD(pa, val, muxmode) (((pa) & 0x1fff)) ((val) | (muxmode)) +#define AM62PX_IOPAD(pa, val, muxmode) (((pa) & 0x1fff)) ((val) | (muxmode)) +#define AM62PX_MCU_IOPAD(pa, val, muxmode) (((pa) & 0x1fff)) ((val) | (muxmode)) + #define AM62X_IOPAD(pa, val, muxmode) (((pa) & 0x1fff)) ((val) | (muxmode)) #define AM62X_MCU_IOPAD(pa, val, muxmode) (((pa) & 0x1fff)) ((val) | (muxmode)) diff --git a/arch/arm/dts/k3-serdes.h b/arch/arm/dts/k3-serdes.h new file mode 100644 index 0000000..29167f8 --- /dev/null +++ b/arch/arm/dts/k3-serdes.h @@ -0,0 +1,204 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * This header provides constants for SERDES MUX for TI SoCs + * + * Copyright (C) 2023 Texas Instruments Incorporated - https://www.ti.com/ + */ + +#ifndef DTS_ARM64_TI_K3_SERDES_H +#define DTS_ARM64_TI_K3_SERDES_H + +/* J721E */ + +#define J721E_SERDES0_LANE0_QSGMII_LANE1 0x0 +#define J721E_SERDES0_LANE0_PCIE0_LANE0 0x1 +#define J721E_SERDES0_LANE0_USB3_0_SWAP 0x2 +#define J721E_SERDES0_LANE0_IP4_UNUSED 0x3 + +#define J721E_SERDES0_LANE1_QSGMII_LANE2 0x0 +#define J721E_SERDES0_LANE1_PCIE0_LANE1 0x1 +#define J721E_SERDES0_LANE1_USB3_0 0x2 +#define J721E_SERDES0_LANE1_IP4_UNUSED 0x3 + +#define J721E_SERDES1_LANE0_QSGMII_LANE3 0x0 +#define J721E_SERDES1_LANE0_PCIE1_LANE0 0x1 +#define J721E_SERDES1_LANE0_USB3_1_SWAP 0x2 +#define J721E_SERDES1_LANE0_SGMII_LANE0 0x3 + +#define J721E_SERDES1_LANE1_QSGMII_LANE4 0x0 +#define J721E_SERDES1_LANE1_PCIE1_LANE1 0x1 +#define J721E_SERDES1_LANE1_USB3_1 0x2 +#define J721E_SERDES1_LANE1_SGMII_LANE1 0x3 + +#define J721E_SERDES2_LANE0_IP1_UNUSED 0x0 +#define J721E_SERDES2_LANE0_PCIE2_LANE0 0x1 +#define J721E_SERDES2_LANE0_USB3_1_SWAP 0x2 +#define J721E_SERDES2_LANE0_SGMII_LANE0 0x3 + +#define J721E_SERDES2_LANE1_IP1_UNUSED 0x0 +#define J721E_SERDES2_LANE1_PCIE2_LANE1 0x1 +#define J721E_SERDES2_LANE1_USB3_1 0x2 +#define J721E_SERDES2_LANE1_SGMII_LANE1 0x3 + +#define J721E_SERDES3_LANE0_IP1_UNUSED 0x0 +#define J721E_SERDES3_LANE0_PCIE3_LANE0 0x1 +#define J721E_SERDES3_LANE0_USB3_0_SWAP 0x2 +#define J721E_SERDES3_LANE0_IP4_UNUSED 0x3 + +#define J721E_SERDES3_LANE1_IP1_UNUSED 0x0 +#define J721E_SERDES3_LANE1_PCIE3_LANE1 0x1 +#define J721E_SERDES3_LANE1_USB3_0 0x2 +#define J721E_SERDES3_LANE1_IP4_UNUSED 0x3 + +#define J721E_SERDES4_LANE0_EDP_LANE0 0x0 +#define J721E_SERDES4_LANE0_IP2_UNUSED 0x1 +#define J721E_SERDES4_LANE0_QSGMII_LANE5 0x2 +#define J721E_SERDES4_LANE0_IP4_UNUSED 0x3 + +#define J721E_SERDES4_LANE1_EDP_LANE1 0x0 +#define J721E_SERDES4_LANE1_IP2_UNUSED 0x1 +#define J721E_SERDES4_LANE1_QSGMII_LANE6 0x2 +#define J721E_SERDES4_LANE1_IP4_UNUSED 0x3 + +#define J721E_SERDES4_LANE2_EDP_LANE2 0x0 +#define J721E_SERDES4_LANE2_IP2_UNUSED 0x1 +#define J721E_SERDES4_LANE2_QSGMII_LANE7 0x2 +#define J721E_SERDES4_LANE2_IP4_UNUSED 0x3 + +#define J721E_SERDES4_LANE3_EDP_LANE3 0x0 +#define J721E_SERDES4_LANE3_IP2_UNUSED 0x1 +#define J721E_SERDES4_LANE3_QSGMII_LANE8 0x2 +#define J721E_SERDES4_LANE3_IP4_UNUSED 0x3 + +/* J7200 */ + +#define J7200_SERDES0_LANE0_QSGMII_LANE3 0x0 +#define J7200_SERDES0_LANE0_PCIE1_LANE0 0x1 +#define J7200_SERDES0_LANE0_IP3_UNUSED 0x2 +#define J7200_SERDES0_LANE0_IP4_UNUSED 0x3 + +#define J7200_SERDES0_LANE1_QSGMII_LANE4 0x0 +#define J7200_SERDES0_LANE1_PCIE1_LANE1 0x1 +#define J7200_SERDES0_LANE1_IP3_UNUSED 0x2 +#define J7200_SERDES0_LANE1_IP4_UNUSED 0x3 + +#define J7200_SERDES0_LANE2_QSGMII_LANE1 0x0 +#define J7200_SERDES0_LANE2_PCIE1_LANE2 0x1 +#define J7200_SERDES0_LANE2_IP3_UNUSED 0x2 +#define J7200_SERDES0_LANE2_IP4_UNUSED 0x3 + +#define J7200_SERDES0_LANE3_QSGMII_LANE2 0x0 +#define J7200_SERDES0_LANE3_PCIE1_LANE3 0x1 +#define J7200_SERDES0_LANE3_USB 0x2 +#define J7200_SERDES0_LANE3_IP4_UNUSED 0x3 + +/* AM64 */ + +#define AM64_SERDES0_LANE0_PCIE0 0x0 +#define AM64_SERDES0_LANE0_USB 0x1 + +/* J721S2 */ + +#define J721S2_SERDES0_LANE0_EDP_LANE0 0x0 +#define J721S2_SERDES0_LANE0_PCIE1_LANE0 0x1 +#define J721S2_SERDES0_LANE0_IP3_UNUSED 0x2 +#define J721S2_SERDES0_LANE0_IP4_UNUSED 0x3 + +#define J721S2_SERDES0_LANE1_EDP_LANE1 0x0 +#define J721S2_SERDES0_LANE1_PCIE1_LANE1 0x1 +#define J721S2_SERDES0_LANE1_USB 0x2 +#define J721S2_SERDES0_LANE1_IP4_UNUSED 0x3 + +#define J721S2_SERDES0_LANE2_EDP_LANE2 0x0 +#define J721S2_SERDES0_LANE2_PCIE1_LANE2 0x1 +#define J721S2_SERDES0_LANE2_IP3_UNUSED 0x2 +#define J721S2_SERDES0_LANE2_IP4_UNUSED 0x3 + +#define J721S2_SERDES0_LANE3_EDP_LANE3 0x0 +#define J721S2_SERDES0_LANE3_PCIE1_LANE3 0x1 +#define J721S2_SERDES0_LANE3_USB 0x2 +#define J721S2_SERDES0_LANE3_IP4_UNUSED 0x3 + +/* J784S4 */ + +#define J784S4_SERDES0_LANE0_IP1_UNUSED 0x0 +#define J784S4_SERDES0_LANE0_PCIE1_LANE0 0x1 +#define J784S4_SERDES0_LANE0_IP3_UNUSED 0x2 +#define J784S4_SERDES0_LANE0_IP4_UNUSED 0x3 + +#define J784S4_SERDES0_LANE1_IP1_UNUSED 0x0 +#define J784S4_SERDES0_LANE1_PCIE1_LANE1 0x1 +#define J784S4_SERDES0_LANE1_IP3_UNUSED 0x2 +#define J784S4_SERDES0_LANE1_IP4_UNUSED 0x3 + +#define J784S4_SERDES0_LANE2_PCIE3_LANE0 0x0 +#define J784S4_SERDES0_LANE2_PCIE1_LANE2 0x1 +#define J784S4_SERDES0_LANE2_IP3_UNUSED 0x2 +#define J784S4_SERDES0_LANE2_IP4_UNUSED 0x3 + +#define J784S4_SERDES0_LANE3_PCIE3_LANE1 0x0 +#define J784S4_SERDES0_LANE3_PCIE1_LANE3 0x1 +#define J784S4_SERDES0_LANE3_USB 0x2 +#define J784S4_SERDES0_LANE3_IP4_UNUSED 0x3 + +#define J784S4_SERDES1_LANE0_QSGMII_LANE3 0x0 +#define J784S4_SERDES1_LANE0_PCIE0_LANE0 0x1 +#define J784S4_SERDES1_LANE0_IP3_UNUSED 0x2 +#define J784S4_SERDES1_LANE0_IP4_UNUSED 0x3 + +#define J784S4_SERDES1_LANE1_QSGMII_LANE4 0x0 +#define J784S4_SERDES1_LANE1_PCIE0_LANE1 0x1 +#define J784S4_SERDES1_LANE1_IP3_UNUSED 0x2 +#define J784S4_SERDES1_LANE1_IP4_UNUSED 0x3 + +#define J784S4_SERDES1_LANE2_QSGMII_LANE1 0x0 +#define J784S4_SERDES1_LANE2_PCIE0_LANE2 0x1 +#define J784S4_SERDES1_LANE2_PCIE2_LANE0 0x2 +#define J784S4_SERDES1_LANE2_IP4_UNUSED 0x3 + +#define J784S4_SERDES1_LANE3_QSGMII_LANE2 0x0 +#define J784S4_SERDES1_LANE3_PCIE0_LANE3 0x1 +#define J784S4_SERDES1_LANE3_PCIE2_LANE1 0x2 +#define J784S4_SERDES1_LANE3_IP4_UNUSED 0x3 + +#define J784S4_SERDES2_LANE0_QSGMII_LANE5 0x0 +#define J784S4_SERDES2_LANE0_IP2_UNUSED 0x1 +#define J784S4_SERDES2_LANE0_IP3_UNUSED 0x2 +#define J784S4_SERDES2_LANE0_IP4_UNUSED 0x3 + +#define J784S4_SERDES2_LANE1_QSGMII_LANE6 0x0 +#define J784S4_SERDES2_LANE1_IP2_UNUSED 0x1 +#define J784S4_SERDES2_LANE1_IP3_UNUSED 0x2 +#define J784S4_SERDES2_LANE1_IP4_UNUSED 0x3 + +#define J784S4_SERDES2_LANE2_QSGMII_LANE7 0x0 +#define J784S4_SERDES2_LANE2_QSGMII_LANE1 0x1 +#define J784S4_SERDES2_LANE2_IP3_UNUSED 0x2 +#define J784S4_SERDES2_LANE2_IP4_UNUSED 0x3 + +#define J784S4_SERDES2_LANE3_QSGMII_LANE8 0x0 +#define J784S4_SERDES2_LANE3_QSGMII_LANE2 0x1 +#define J784S4_SERDES2_LANE3_IP3_UNUSED 0x2 +#define J784S4_SERDES2_LANE3_IP4_UNUSED 0x3 + +#define J784S4_SERDES4_LANE0_EDP_LANE0 0x0 +#define J784S4_SERDES4_LANE0_QSGMII_LANE5 0x1 +#define J784S4_SERDES4_LANE0_IP3_UNUSED 0x2 +#define J784S4_SERDES4_LANE0_IP4_UNUSED 0x3 + +#define J784S4_SERDES4_LANE1_EDP_LANE1 0x0 +#define J784S4_SERDES4_LANE1_QSGMII_LANE6 0x1 +#define J784S4_SERDES4_LANE1_IP3_UNUSED 0x2 +#define J784S4_SERDES4_LANE1_IP4_UNUSED 0x3 + +#define J784S4_SERDES4_LANE2_EDP_LANE2 0x0 +#define J784S4_SERDES4_LANE2_QSGMII_LANE7 0x1 +#define J784S4_SERDES4_LANE2_IP3_UNUSED 0x2 +#define J784S4_SERDES4_LANE2_IP4_UNUSED 0x3 + +#define J784S4_SERDES4_LANE3_EDP_LANE3 0x0 +#define J784S4_SERDES4_LANE3_QSGMII_LANE8 0x1 +#define J784S4_SERDES4_LANE3_USB 0x2 +#define J784S4_SERDES4_LANE3_IP4_UNUSED 0x3 + +#endif /* DTS_ARM64_TI_K3_SERDES_H */ diff --git a/arch/arm/dts/mt7988.dtsi b/arch/arm/dts/mt7988.dtsi index ddd629e..ac476d5 100644 --- a/arch/arm/dts/mt7988.dtsi +++ b/arch/arm/dts/mt7988.dtsi @@ -9,6 +9,7 @@ #include <dt-bindings/clock/mt7988-clk.h> #include <dt-bindings/reset/mt7988-reset.h> #include <dt-bindings/gpio/gpio.h> +#include <dt-bindings/phy/phy.h> / { compatible = "mediatek,mt7988-rfb"; @@ -161,6 +162,65 @@ #clock-cells = <1>; }; + dummy_clk: dummy12m { + compatible = "fixed-clock"; + clock-frequency = <12000000>; + #clock-cells = <0>; + /* must need this line, or uart uanable to get dummy_clk */ + bootph-all; + }; + + xhci1: xhci@11200000 { + compatible = "mediatek,mt7988-xhci", + "mediatek,mtk-xhci"; + reg = <0 0x11200000 0 0x2e00>, + <0 0x11203e00 0 0x0100>; + reg-names = "mac", "ippc"; + interrupts = <GIC_SPI 172 IRQ_TYPE_LEVEL_HIGH>; + phys = <&tphyu2port0 PHY_TYPE_USB2>, + <&tphyu3port0 PHY_TYPE_USB3>; + clocks = <&dummy_clk>, + <&dummy_clk>, + <&dummy_clk>, + <&dummy_clk>, + <&dummy_clk>; + clock-names = "sys_ck", + "xhci_ck", + "ref_ck", + "mcu_ck", + "dma_ck"; + #address-cells = <2>; + #size-cells = <2>; + status = "okay"; + }; + + usbtphy: usb-phy@11c50000 { + compatible = "mediatek,mt7988", + "mediatek,generic-tphy-v2"; + #address-cells = <2>; + #size-cells = <2>; + ranges; + status = "okay"; + + tphyu2port0: usb-phy@11c50000 { + reg = <0 0x11c50000 0 0x700>; + clocks = <&dummy_clk>; + clock-names = "ref"; + #phy-cells = <1>; + status = "okay"; + }; + + tphyu3port0: usb-phy@11c50700 { + reg = <0 0x11c50700 0 0x900>; + clocks = <&dummy_clk>; + clock-names = "ref"; + #phy-cells = <1>; + mediatek,usb3-pll-ssc-delta; + mediatek,usb3-pll-ssc-delta1; + status = "okay"; + }; + }; + xfi_pextp0: syscon@11f20000 { compatible = "mediatek,mt7988-xfi_pextp_0", "syscon"; reg = <0 0x11f20000 0 0x10000>; diff --git a/arch/arm/dts/nuvoton-npcm845-evb.dts b/arch/arm/dts/nuvoton-npcm845-evb.dts index 3cab780..a93666c 100644 --- a/arch/arm/dts/nuvoton-npcm845-evb.dts +++ b/arch/arm/dts/nuvoton-npcm845-evb.dts @@ -354,4 +354,4 @@ &r1en_pins &r1oen_pins >; -};
\ No newline at end of file +}; diff --git a/arch/arm/dts/sam9x60.dtsi b/arch/arm/dts/sam9x60.dtsi index 2b93d08..3b684fc 100644 --- a/arch/arm/dts/sam9x60.dtsi +++ b/arch/arm/dts/sam9x60.dtsi @@ -27,6 +27,18 @@ spi0 = &qspi; }; + cpus { + #address-cells = <1>; + #size-cells = <0>; + + ARM9260_0: cpu@0 { + device_type = "cpu"; + compatible = "arm,arm926ej-s"; + clocks = <&pmc PMC_TYPE_CORE 19>, <&pmc PMC_TYPE_CORE 11>, <&main_xtal>; + clock-names = "cpu", "master", "xtal"; + }; + }; + clocks { slow_rc_osc: slow_rc_osc { compatible = "fixed-clock"; @@ -51,18 +63,6 @@ }; }; - cpus { - #address-cells = <1>; - #size-cells = <0>; - - ARM9260_0: cpu@0 { - device_type = "cpu"; - compatible = "arm,arm926ej-s"; - clocks = <&pmc PMC_TYPE_CORE 19>, <&pmc PMC_TYPE_CORE 11>, <&main_xtal>; - clock-names = "cpu", "master", "xtal"; - }; - }; - ahb { compatible = "simple-bus"; #address-cells = <1>; @@ -149,13 +149,20 @@ compatible = "microchip,sam9x60-qspi"; reg = <0xf0014000 0x100>, <0x70000000 0x10000000>; reg-names = "qspi_base", "qspi_mmap"; - clocks = <&pmc PMC_TYPE_PERIPHERAL 35>, <&pmc PMC_TYPE_SYSTEM 18>; /* ID_QSPI */ + clocks = <&pmc PMC_TYPE_PERIPHERAL 35>, <&pmc PMC_TYPE_SYSTEM 18>; /* ID_QSPI */ clock-names = "pclk", "qspick"; #address-cells = <1>; #size-cells = <0>; status = "disabled"; }; + pit64b0: timer@f0028000 { + compatible = "microchip,sam9x60-pit64b"; + reg = <0xf0028000 0xec>; + clocks = <&pmc PMC_TYPE_PERIPHERAL 37>, <&pmc PMC_TYPE_GCK 37>; + clock-names = "pclk", "gclk"; + }; + flx0: flexcom@f801c600 { compatible = "atmel,sama5d2-flexcom"; reg = <0xf801c000 0x200>; @@ -181,6 +188,17 @@ reg = <0xf8050000 0x100>; }; + pmecc: ecc-engine@ffffe000 { + compatible = "microchip,sam9x60-pmecc", "atmel,at91sam9g45-pmecc"; + reg = <0xffffe000 0x300>, + <0xffffe600 0x100>; + }; + + smc: smc@ffffea00 { + compatible = "microchip,sam9x60-smc", "atmel,at91sam9260-smc", "syscon"; + reg = <0xffffea00 0x100>; + }; + dbgu: serial@fffff200 { compatible = "atmel,at91sam9260-dbgu", "atmel,at91sam9260-usart"; reg = <0xfffff200 0x200>; @@ -190,7 +208,7 @@ clock-names = "usart"; }; - pinctrl { + pinctrl: pinctrl@fffff400 { #address-cells = <1>; #size-cells = <1>; compatible = "microchip,sam9x60-pinctrl", "simple-bus"; @@ -205,7 +223,7 @@ pinctrl_dbgu: dbgu-0 { atmel,pins = <AT91_PIOA 9 AT91_PERIPH_A AT91_PINCTRL_PULL_UP - AT91_PIOA 10 AT91_PERIPH_A AT91_PINCTRL_NONE>; + AT91_PIOA 10 AT91_PERIPH_A AT91_PINCTRL_NONE>; }; }; @@ -256,17 +274,6 @@ }; }; - pmecc: ecc-engine@ffffe000 { - compatible = "microchip,sam9x60-pmecc", "atmel,at91sam9g45-pmecc"; - reg = <0xffffe000 0x300>, - <0xffffe600 0x100>; - }; - - smc: smc@ffffea00 { - compatible = "microchip,sam9x60-smc", "atmel,at91sam9260-smc", "syscon"; - reg = <0xffffea00 0x100>; - }; - pioA: gpio@fffff400 { compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio"; reg = <0xfffff400 0x200>; @@ -320,13 +327,6 @@ clocks = <&pmc PMC_TYPE_CORE 11>; /* ID_MCK. */ }; - pit64b0: timer@f0028000 { - compatible = "microchip,sam9x60-pit64b"; - reg = <0xf0028000 0xec>; - clocks = <&pmc PMC_TYPE_PERIPHERAL 37>, <&pmc PMC_TYPE_GCK 37>; - clock-names = "pclk", "gclk"; - }; - clk32: sckc@fffffe50 { compatible = "microchip,sam9x60-sckc"; reg = <0xfffffe50 0x4>; diff --git a/arch/arm/dts/sam9x60ek.dts b/arch/arm/dts/sam9x60ek.dts index 45e2f4c..74016f5 100644 --- a/arch/arm/dts/sam9x60ek.dts +++ b/arch/arm/dts/sam9x60ek.dts @@ -62,7 +62,7 @@ status = "okay"; i2c@600 { - compatible = "atmel,sama5d2-i2c"; + compatible = "microchip,sam9x60-i2c"; reg = <0x600 0x200>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_flx0>; diff --git a/arch/arm/dts/versal-mini-ospi.dtsi b/arch/arm/dts/versal-mini-ospi.dtsi index 19caea7..5683a23 100644 --- a/arch/arm/dts/versal-mini-ospi.dtsi +++ b/arch/arm/dts/versal-mini-ospi.dtsi @@ -57,6 +57,7 @@ spi-tx-bus-width = <8>; spi-rx-bus-width = <8>; spi-max-frequency = <20000000>; + no-wp; }; }; }; diff --git a/arch/arm/dts/versal-net-mini-ospi.dtsi b/arch/arm/dts/versal-net-mini-ospi.dtsi index ce8e215..5d188db 100644 --- a/arch/arm/dts/versal-net-mini-ospi.dtsi +++ b/arch/arm/dts/versal-net-mini-ospi.dtsi @@ -72,6 +72,7 @@ spi-tx-bus-width = <8>; spi-rx-bus-width = <8>; spi-max-frequency = <20000000>; + no-wp; }; }; }; diff --git a/arch/arm/dts/xilinx-versal-net-virt.dts b/arch/arm/dts/xilinx-versal-net-virt.dts index c99257c..f5eca84 100644 --- a/arch/arm/dts/xilinx-versal-net-virt.dts +++ b/arch/arm/dts/xilinx-versal-net-virt.dts @@ -8,4 +8,10 @@ /dts-v1/; / { + options { + u-boot { + compatible = "u-boot,config"; + bootscr-address = /bits/ 64 <0x20000000>; + }; + }; }; diff --git a/arch/arm/dts/xilinx-versal-virt.dts b/arch/arm/dts/xilinx-versal-virt.dts index 733e532..3ea3cb1 100644 --- a/arch/arm/dts/xilinx-versal-virt.dts +++ b/arch/arm/dts/xilinx-versal-virt.dts @@ -8,4 +8,10 @@ /dts-v1/; / { + options { + u-boot { + compatible = "u-boot,config"; + bootscr-address = /bits/ 64 <0x20000000>; + }; + }; }; diff --git a/arch/arm/dts/zynq-7000.dtsi b/arch/arm/dts/zynq-7000.dtsi index 8c6eafe..fb61fe9 100644 --- a/arch/arm/dts/zynq-7000.dtsi +++ b/arch/arm/dts/zynq-7000.dtsi @@ -11,6 +11,13 @@ #size-cells = <1>; compatible = "xlnx,zynq-7000"; + options { + u-boot { + compatible = "u-boot,config"; + bootscr-address = /bits/ 64 <0x3000000>; + }; + }; + cpus { #address-cells = <1>; #size-cells = <0>; diff --git a/arch/arm/dts/zynqmp-dlc21-revA.dts b/arch/arm/dts/zynqmp-dlc21-revA.dts index 1b247bf..016081e 100644 --- a/arch/arm/dts/zynqmp-dlc21-revA.dts +++ b/arch/arm/dts/zynqmp-dlc21-revA.dts @@ -61,14 +61,14 @@ non-removable; disable-wp; bus-width = <8>; - xlnx,mio_bank = <0>; + xlnx,mio-bank = <0>; }; &sdhci1 { /* sd1 MIO45-51 cd in place */ status = "okay"; no-1-8-v; disable-wp; - xlnx,mio_bank = <1>; + xlnx,mio-bank = <1>; }; &psgtr { diff --git a/arch/arm/dts/zynqmp-e-a2197-00-revA.dts b/arch/arm/dts/zynqmp-e-a2197-00-revA.dts index bf6ffb7..bf7569c 100644 --- a/arch/arm/dts/zynqmp-e-a2197-00-revA.dts +++ b/arch/arm/dts/zynqmp-e-a2197-00-revA.dts @@ -2,7 +2,8 @@ /* * dts file for Xilinx Versal a2197 RevA System Controller * - * (C) Copyright 2019 - 2021, Xilinx, Inc. + * (C) Copyright 2019 - 2022, Xilinx, Inc. + * (C) Copyright 2022 - 2023, Advanced Micro Devices, Inc. * * Michal Simek <michal.simek@amd.com> */ @@ -460,10 +461,10 @@ #address-cells = <1>; #size-cells = <0>; reg = <6>; - si570_user1: clock-generator@5d { /* u205 */ + si570_user1: clock-generator@5f { /* u205 */ #clock-cells = <0>; compatible = "silabs,si570"; - reg = <0x5d>; + reg = <0x5f>; temperature-stability = <50>; factory-fout = <100000000>; clock-frequency = <100000000>; diff --git a/arch/arm/dts/zynqmp-sck-kr-g-revA.dts b/arch/arm/dts/zynqmp-sck-kr-g-revA.dts index d318773..30a0230 100644 --- a/arch/arm/dts/zynqmp-sck-kr-g-revA.dts +++ b/arch/arm/dts/zynqmp-sck-kr-g-revA.dts @@ -250,6 +250,7 @@ conf-tx { pins = "MIO36"; bias-disable; + output-enable; }; mux { @@ -301,6 +302,7 @@ conf-bootstrap { pins = "MIO45", "MIO47", "MIO49"; bias-disable; + output-enable; low-power-disable; }; @@ -308,6 +310,7 @@ pins = "MIO38", "MIO39", "MIO40", "MIO41", "MIO42", "MIO43"; bias-disable; + output-enable; low-power-enable; }; @@ -316,6 +319,7 @@ slew-rate = <SLEW_RATE_SLOW>; power-source = <IO_STANDARD_LVCMOS18>; bias-disable; + output-enable; }; mux-mdio { @@ -346,6 +350,7 @@ pins = "MIO54", "MIO56", "MIO57", "MIO58", "MIO59", "MIO60", "MIO61", "MIO62", "MIO63"; bias-disable; + output-enable; drive-strength = <4>; slew-rate = <SLEW_RATE_SLOW>; }; @@ -373,6 +378,7 @@ pins = "MIO66", "MIO68", "MIO69", "MIO70", "MIO71", "MIO72", "MIO73", "MIO74", "MIO75"; bias-disable; + output-enable; drive-strength = <4>; slew-rate = <SLEW_RATE_SLOW>; }; diff --git a/arch/arm/dts/zynqmp-sck-kr-g-revB.dts b/arch/arm/dts/zynqmp-sck-kr-g-revB.dts index 69dba07..8f4c52d 100644 --- a/arch/arm/dts/zynqmp-sck-kr-g-revB.dts +++ b/arch/arm/dts/zynqmp-sck-kr-g-revB.dts @@ -250,6 +250,7 @@ conf-tx { pins = "MIO36"; bias-disable; + output-enable; }; mux { @@ -301,6 +302,7 @@ conf-bootstrap { pins = "MIO45", "MIO47", "MIO49"; bias-disable; + output-enable; low-power-disable; }; @@ -308,6 +310,7 @@ pins = "MIO38", "MIO39", "MIO40", "MIO41", "MIO42", "MIO43"; bias-disable; + output-enable; low-power-enable; }; @@ -316,6 +319,7 @@ slew-rate = <SLEW_RATE_SLOW>; power-source = <IO_STANDARD_LVCMOS18>; bias-disable; + output-enable; }; mux-mdio { @@ -346,6 +350,7 @@ pins = "MIO54", "MIO56", "MIO57", "MIO58", "MIO59", "MIO60", "MIO61", "MIO62", "MIO63"; bias-disable; + output-enable; drive-strength = <4>; slew-rate = <SLEW_RATE_SLOW>; }; @@ -373,6 +378,7 @@ pins = "MIO66", "MIO68", "MIO69", "MIO70", "MIO71", "MIO72", "MIO73", "MIO74", "MIO75"; bias-disable; + output-enable; drive-strength = <4>; slew-rate = <SLEW_RATE_SLOW>; }; diff --git a/arch/arm/dts/zynqmp-sck-kv-g-revA.dts b/arch/arm/dts/zynqmp-sck-kv-g-revA.dts index a81b3f6..55bef1d 100644 --- a/arch/arm/dts/zynqmp-sck-kv-g-revA.dts +++ b/arch/arm/dts/zynqmp-sck-kv-g-revA.dts @@ -205,6 +205,7 @@ conf-tx { pins = "MIO36"; bias-disable; + output-enable; }; mux { @@ -256,6 +257,7 @@ conf-bootstrap { pins = "MIO71", "MIO73", "MIO75"; bias-disable; + output-enable; low-power-disable; }; @@ -263,6 +265,7 @@ pins = "MIO64", "MIO65", "MIO66", "MIO67", "MIO68", "MIO69"; bias-disable; + output-enable; low-power-enable; }; @@ -271,6 +274,7 @@ slew-rate = <SLEW_RATE_SLOW>; power-source = <IO_STANDARD_LVCMOS18>; bias-disable; + output-enable; }; mux-mdio { @@ -301,6 +305,7 @@ pins = "MIO54", "MIO56", "MIO57", "MIO58", "MIO59", "MIO60", "MIO61", "MIO62", "MIO63"; bias-disable; + output-enable; drive-strength = <4>; slew-rate = <SLEW_RATE_SLOW>; }; diff --git a/arch/arm/dts/zynqmp-sck-kv-g-revB.dts b/arch/arm/dts/zynqmp-sck-kv-g-revB.dts index f935f25..1b1d9e7 100644 --- a/arch/arm/dts/zynqmp-sck-kv-g-revB.dts +++ b/arch/arm/dts/zynqmp-sck-kv-g-revB.dts @@ -193,6 +193,7 @@ conf-tx { pins = "MIO36"; bias-disable; + output-enable; }; mux { @@ -244,6 +245,7 @@ conf-bootstrap { pins = "MIO71", "MIO73", "MIO75"; bias-disable; + output-enable; low-power-disable; }; @@ -251,6 +253,7 @@ pins = "MIO64", "MIO65", "MIO66", "MIO67", "MIO68", "MIO69"; bias-disable; + output-enable; low-power-enable; }; @@ -259,6 +262,7 @@ slew-rate = <SLEW_RATE_SLOW>; power-source = <IO_STANDARD_LVCMOS18>; bias-disable; + output-enable; }; mux-mdio { @@ -289,6 +293,7 @@ pins = "MIO54", "MIO56", "MIO57", "MIO58", "MIO59", "MIO60", "MIO61", "MIO62", "MIO63"; bias-disable; + output-enable; drive-strength = <4>; slew-rate = <SLEW_RATE_SLOW>; }; diff --git a/arch/arm/dts/zynqmp-sm-k26-revA.dts b/arch/arm/dts/zynqmp-sm-k26-revA.dts index d718fec..80b9fac 100644 --- a/arch/arm/dts/zynqmp-sm-k26-revA.dts +++ b/arch/arm/dts/zynqmp-sm-k26-revA.dts @@ -1,8 +1,9 @@ // SPDX-License-Identifier: GPL-2.0 /* - * dts file for Xilinx ZynqMP SM-K26 rev1/B/A + * dts file for Xilinx ZynqMP SM-K26 rev2/1/B/A * * (C) Copyright 2020 - 2021, Xilinx, Inc. + * (C) Copyright 2023, Advanced Micro Devices, Inc. * * Michal Simek <michal.simek@amd.com> */ @@ -17,8 +18,9 @@ #include <dt-bindings/pinctrl/pinctrl-zynqmp.h> / { - model = "ZynqMP SM-K26 Rev1/B/A"; - compatible = "xlnx,zynqmp-sm-k26-rev1", "xlnx,zynqmp-sm-k26-revB", + model = "ZynqMP SM-K26 Rev2/1/B/A"; + compatible = "xlnx,zynqmp-sm-k26-rev2", + "xlnx,zynqmp-sm-k26-rev1", "xlnx,zynqmp-sm-k26-revB", "xlnx,zynqmp-sm-k26-revA", "xlnx,zynqmp-sm-k26", "xlnx,zynqmp"; diff --git a/arch/arm/dts/zynqmp-smk-k26-revA.dts b/arch/arm/dts/zynqmp-smk-k26-revA.dts index 85b0d16..719a4e4 100644 --- a/arch/arm/dts/zynqmp-smk-k26-revA.dts +++ b/arch/arm/dts/zynqmp-smk-k26-revA.dts @@ -1,8 +1,9 @@ // SPDX-License-Identifier: GPL-2.0 /* - * dts file for Xilinx ZynqMP SMK-K26 rev1/B/A + * dts file for Xilinx ZynqMP SMK-K26 rev2/1/B/A * * (C) Copyright 2020 - 2021, Xilinx, Inc. + * (C) Copyright 2023, Advanced Micro Devices, Inc. * * Michal Simek <michal.simek@amd.com> */ @@ -10,8 +11,9 @@ #include "zynqmp-sm-k26-revA.dts" / { - model = "ZynqMP SMK-K26 Rev1/B/A"; - compatible = "xlnx,zynqmp-smk-k26-rev1", "xlnx,zynqmp-smk-k26-revB", + model = "ZynqMP SMK-K26 Rev2/1/B/A"; + compatible = "xlnx,zynqmp-smk-k26-rev2", + "xlnx,zynqmp-smk-k26-rev1", "xlnx,zynqmp-smk-k26-revB", "xlnx,zynqmp-smk-k26-revA", "xlnx,zynqmp-smk-k26", "xlnx,zynqmp"; }; diff --git a/arch/arm/dts/zynqmp-zcu102-revA.dts b/arch/arm/dts/zynqmp-zcu102-revA.dts index 79d67c4..0f7230b 100644 --- a/arch/arm/dts/zynqmp-zcu102-revA.dts +++ b/arch/arm/dts/zynqmp-zcu102-revA.dts @@ -602,7 +602,7 @@ reg = <0x5d>; temperature-stability = <50>; /* copy from zc702 */ factory-fout = <156250000>; - clock-frequency = <148500000>; + clock-frequency = <156250000>; clock-output-names = "si570_mgt"; }; }; diff --git a/arch/arm/dts/zynqmp-zcu106-revA.dts b/arch/arm/dts/zynqmp-zcu106-revA.dts index 7a8094a..f8019c5 100644 --- a/arch/arm/dts/zynqmp-zcu106-revA.dts +++ b/arch/arm/dts/zynqmp-zcu106-revA.dts @@ -592,7 +592,7 @@ reg = <0x5d>; temperature-stability = <50>; /* copy from zc702 */ factory-fout = <156250000>; - clock-frequency = <148500000>; + clock-frequency = <156250000>; clock-output-names = "si570_mgt"; }; }; diff --git a/arch/arm/dts/zynqmp-zcu208-revA.dts b/arch/arm/dts/zynqmp-zcu208-revA.dts index 9b3ae67..0c1f509 100644 --- a/arch/arm/dts/zynqmp-zcu208-revA.dts +++ b/arch/arm/dts/zynqmp-zcu208-revA.dts @@ -489,7 +489,7 @@ reg = <0x5d>; temperature-stability = <50>; factory-fout = <156250000>; - clock-frequency = <148500000>; + clock-frequency = <156250000>; clock-output-names = "si570_mgt"; }; }; diff --git a/arch/arm/dts/zynqmp-zcu216-revA.dts b/arch/arm/dts/zynqmp-zcu216-revA.dts index 43eeaec..8ca01f0 100644 --- a/arch/arm/dts/zynqmp-zcu216-revA.dts +++ b/arch/arm/dts/zynqmp-zcu216-revA.dts @@ -499,7 +499,7 @@ reg = <0x5d>; temperature-stability = <50>; factory-fout = <156250000>; - clock-frequency = <148500000>; + clock-frequency = <156250000>; clock-output-names = "si570_mgt"; }; }; diff --git a/arch/arm/dts/zynqmp.dtsi b/arch/arm/dts/zynqmp.dtsi index 1632be8..79c5af2 100644 --- a/arch/arm/dts/zynqmp.dtsi +++ b/arch/arm/dts/zynqmp.dtsi @@ -22,6 +22,13 @@ #address-cells = <2>; #size-cells = <2>; + options { + u-boot { + compatible = "u-boot,config"; + bootscr-address = /bits/ 64 <0x20000000>; + }; + }; + cpus { #address-cells = <1>; #size-cells = <0>; @@ -255,6 +262,7 @@ interrupt-parent = <&gic>; tx-fifo-depth = <0x40>; rx-fifo-depth = <0x40>; + resets = <&zynqmp_reset ZYNQMP_RESET_CAN0>; power-domains = <&zynqmp_firmware PD_CAN_0>; }; @@ -267,6 +275,7 @@ interrupt-parent = <&gic>; tx-fifo-depth = <0x40>; rx-fifo-depth = <0x40>; + resets = <&zynqmp_reset ZYNQMP_RESET_CAN1>; power-domains = <&zynqmp_firmware PD_CAN_1>; }; @@ -669,7 +678,7 @@ msi-parent = <&pcie>; reg = <0x0 0xfd0e0000 0x0 0x1000>, <0x0 0xfd480000 0x0 0x1000>, - <0x80 0x00000000 0x0 0x1000000>; + <0x80 0x00000000 0x0 0x10000000>; reg-names = "breg", "pcireg", "cfg"; ranges = <0x02000000 0x00000000 0xe0000000 0x00000000 0xe0000000 0x00000000 0x10000000>,/* non-prefetchable memory */ <0x43000000 0x00000006 0x00000000 0x00000006 0x00000000 0x00000002 0x00000000>;/* prefetchable memory */ diff --git a/arch/arm/include/asm/bitops.h b/arch/arm/include/asm/bitops.h index fa85486..8e89783 100644 --- a/arch/arm/include/asm/bitops.h +++ b/arch/arm/include/asm/bitops.h @@ -15,9 +15,34 @@ #ifndef __ASM_ARM_BITOPS_H #define __ASM_ARM_BITOPS_H +#if __LINUX_ARM_ARCH__ < 5 + #include <asm-generic/bitops/__ffs.h> #include <asm-generic/bitops/__fls.h> #include <asm-generic/bitops/fls.h> + +#else + +#define PLATFORM_FFS +#define PLATFORM_FLS + +#if !IS_ENABLED(CONFIG_HAS_THUMB2) && CONFIG_IS_ENABLED(SYS_THUMB_BUILD) + +unsigned long __fls(unsigned long word); +unsigned long __ffs(unsigned long word); +int fls(unsigned int x); +int ffs(int x); + +#else + +#include <asm-generic/bitops/builtin-__fls.h> +#include <asm-generic/bitops/builtin-__ffs.h> +#include <asm-generic/bitops/builtin-fls.h> +#include <asm-generic/bitops/builtin-ffs.h> + +#endif +#endif + #include <asm-generic/bitops/fls64.h> #ifdef __KERNEL__ @@ -113,7 +138,7 @@ static inline int test_bit(int nr, const void * addr) static inline int __ilog2(unsigned int x) { - return generic_fls(x) - 1; + return fls(x) - 1; } #define ffz(x) __ffs(~(x)) diff --git a/arch/arm/include/asm/global_data.h b/arch/arm/include/asm/global_data.h index 2a222c5..b385bae 100644 --- a/arch/arm/include/asm/global_data.h +++ b/arch/arm/include/asm/global_data.h @@ -102,6 +102,9 @@ struct arch_global_data { #ifdef CONFIG_ARCH_IMX8ULP bool m33_handshake_done; #endif +#ifdef CONFIG_SMBIOS + ulong smbios_start; /* Start address of SMBIOS table */ +#endif }; #include <asm-generic/global_data.h> diff --git a/arch/arm/include/asm/spl.h b/arch/arm/include/asm/spl.h index 0ece4b0..ee79a19 100644 --- a/arch/arm/include/asm/spl.h +++ b/arch/arm/include/asm/spl.h @@ -34,9 +34,6 @@ enum { }; #endif -/* Linker symbols. */ -extern char __bss_start[], __bss_end[]; - #ifndef CONFIG_DM extern gd_t gdata; #endif diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile index 62cf80f..b1bcd37 100644 --- a/arch/arm/lib/Makefile +++ b/arch/arm/lib/Makefile @@ -113,6 +113,11 @@ AFLAGS_REMOVE_memset.o := -mthumb -mthumb-interwork AFLAGS_REMOVE_memcpy.o := -mthumb -mthumb-interwork AFLAGS_memset.o := -DMEMSET_NO_THUMB_BUILD AFLAGS_memcpy.o := -DMEMCPY_NO_THUMB_BUILD + +# This is only necessary to force ARM mode on THUMB1 targets. +ifneq ($(CONFIG_SYS_ARM_ARCH),4) +obj-y += bitops.o +endif endif endif diff --git a/arch/arm/lib/bitops.S b/arch/arm/lib/bitops.S new file mode 100644 index 0000000..29d1524 --- /dev/null +++ b/arch/arm/lib/bitops.S @@ -0,0 +1,45 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (C) 2023 Sean Anderson <sean.anderson@seco.com> + * + * ARM bitops to call when using THUMB1, which doesn't have these instructions. + */ +#include <linux/linkage.h> +#include <asm/assembler.h> + +.pushsection .text.__fls +ENTRY(__fls) + clz r0, r0 + rsb r0, r0, #31 + ret lr +ENDPROC(__fls) +.popsection + +.pushsection .text.__ffs +ENTRY(__ffs) + rsb r3, r0, #0 + and r0, r0, r3 + clz r0, r0 + rsb r0, r0, #31 + ret lr +ENDPROC(__ffs) +.popsection + +.pushsection .text.fls +ENTRY(fls) + cmp r0, #0 + clzne r0, r0 + rsbne r0, r0, #32 + ret lr +ENDPROC(fls) +.popsection + +.pushsection .text.ffs +ENTRY(ffs) + rsb r3, r0, #0 + and r0, r0, r3 + clz r0, r0 + rsb r0, r0, #32 + ret lr +ENDPROC(ffs) +.popsection diff --git a/arch/arm/lib/gic-v3-its.c b/arch/arm/lib/gic-v3-its.c index f6211a2..f4bbd21 100644 --- a/arch/arm/lib/gic-v3-its.c +++ b/arch/arm/lib/gic-v3-its.c @@ -9,6 +9,7 @@ #include <asm/gic-v3.h> #include <asm/io.h> #include <linux/bitops.h> +#include <linux/printk.h> #include <linux/sizes.h> static u32 lpi_id_bits; diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig index 7c2e4eb..4c65fc0 100644 --- a/arch/arm/mach-at91/Kconfig +++ b/arch/arm/mach-at91/Kconfig @@ -215,6 +215,17 @@ config TARGET_SAMA5D2_ICP a 64Mbit QSPI flash, 3xMikrobus connectors, 4xUSB , EtherCat and WILC3000 devices on board. +config TARGET_SAMA5D29_CURIOSITY + bool "SAMA5D29 CURIOSITY board" + select SAMA5D2 + select BOARD_EARLY_INIT_F + select BOARD_LATE_INIT + select CPU_V7A + help + The SAMA5D29 Curiosity embeds SAMA5D29 SoC with 4 Gbit LPDDR2-SDRAM, + a 64Mbit QSPI flash with Mac-address, MCP16502 PMIC, RGB LCD connector, + 2 x Mikrobus connectors, 2 x SD-Card connectors, 2 x USB + config TARGET_SAMA5D3_XPLAINED bool "SAMA5D3 Xplained board" select BOARD_EARLY_INIT_F @@ -346,6 +357,7 @@ source "board/atmel/sama5d2_xplained/Kconfig" source "board/atmel/sama5d27_som1_ek/Kconfig" source "board/atmel/sama5d27_wlsom1_ek/Kconfig" source "board/atmel/sama5d2_icp/Kconfig" +source "board/atmel/sama5d29_curiosity/Kconfig" source "board/atmel/sama5d3_xplained/Kconfig" source "board/atmel/sama5d3xek/Kconfig" source "board/atmel/sama5d4_xplained/Kconfig" diff --git a/arch/arm/mach-bcm283x/init.c b/arch/arm/mach-bcm283x/init.c index 183650a..7265faf 100644 --- a/arch/arm/mach-bcm283x/init.c +++ b/arch/arm/mach-bcm283x/init.c @@ -146,6 +146,14 @@ int mach_cpu_init(void) return 0; } +#if defined(CONFIG_DISPLAY_CPUINFO) +int print_cpuinfo(void) +{ + printf("CPU: BCM283x\n"); + return 0; +} +#endif + #ifdef CONFIG_ARMV7_LPAE #ifdef CONFIG_TARGET_RPI_4_32B #define BCM2711_RPI4_PCIE_XHCI_MMIO_VIRT 0xffc00000UL diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig index fda7624..266bb20 100644 --- a/arch/arm/mach-imx/Kconfig +++ b/arch/arm/mach-imx/Kconfig @@ -182,7 +182,7 @@ config IMX8_ROMAPI config SPL_IMX_ROMAPI_LOADADDR hex "Default load address to load image through ROM API" depends on IMX8_ROMAPI || SPL_BOOTROM_SUPPORT - default 0 + default 0x0 config IMX_DCD_ADDR hex "DCD Blocks location on the image" diff --git a/arch/arm/mach-imx/imx8/Kconfig b/arch/arm/mach-imx/imx8/Kconfig index 15f844f..59d11b3 100644 --- a/arch/arm/mach-imx/imx8/Kconfig +++ b/arch/arm/mach-imx/imx8/Kconfig @@ -34,11 +34,11 @@ config SYS_SOC config BOOTAUX_RESERVED_MEM_BASE hex "i.MX auxiliary core dram memory base" - default 0 + default 0x0 config BOOTAUX_RESERVED_MEM_SIZE hex "i.MX auxiliary core dram memory size" - default 0 + default 0x0 choice prompt "i.MX8 board select" diff --git a/arch/arm/mach-imx/imx8/cpu.c b/arch/arm/mach-imx/imx8/cpu.c index c623570..39ac0bc 100644 --- a/arch/arm/mach-imx/imx8/cpu.c +++ b/arch/arm/mach-imx/imx8/cpu.c @@ -69,7 +69,7 @@ int arch_cpu_init(void) return 0; } -static int imx8_init_mu(void *ctx, struct event *event) +static int imx8_init_mu(void) { struct udevice *devp; int node, ret; @@ -91,7 +91,7 @@ static int imx8_init_mu(void *ctx, struct event *event) return 0; } -EVENT_SPY(EVT_DM_POST_INIT_F, imx8_init_mu); +EVENT_SPY_SIMPLE(EVT_DM_POST_INIT_F, imx8_init_mu); #if defined(CONFIG_ARCH_MISC_INIT) int arch_misc_init(void) diff --git a/arch/arm/mach-imx/imx8/fdt.c b/arch/arm/mach-imx/imx8/fdt.c index 491c8bb..c2bed3e 100644 --- a/arch/arm/mach-imx/imx8/fdt.c +++ b/arch/arm/mach-imx/imx8/fdt.c @@ -11,6 +11,7 @@ #include <dm/ofnode.h> #include <fdt_support.h> #include <linux/libfdt.h> +#include <linux/printk.h> DECLARE_GLOBAL_DATA_PTR; diff --git a/arch/arm/mach-imx/imx8m/soc.c b/arch/arm/mach-imx/imx8m/soc.c index 0ae93bb..fc82958 100644 --- a/arch/arm/mach-imx/imx8m/soc.c +++ b/arch/arm/mach-imx/imx8m/soc.c @@ -533,7 +533,7 @@ static void imx_set_wdog_powerdown(bool enable) writew(enable, &wdog3->wmcr); } -static int imx8m_check_clock(void *ctx, struct event *event) +static int imx8m_check_clock(void) { struct udevice *dev; int ret; @@ -550,7 +550,7 @@ static int imx8m_check_clock(void *ctx, struct event *event) return 0; } -EVENT_SPY(EVT_DM_POST_INIT_F, imx8m_check_clock); +EVENT_SPY_SIMPLE(EVT_DM_POST_INIT_F, imx8m_check_clock); static void imx8m_setup_snvs(void) { diff --git a/arch/arm/mach-imx/imx8ulp/soc.c b/arch/arm/mach-imx/imx8ulp/soc.c index e23cf60..fd436dd 100644 --- a/arch/arm/mach-imx/imx8ulp/soc.c +++ b/arch/arm/mach-imx/imx8ulp/soc.c @@ -803,12 +803,7 @@ int imx8ulp_dm_post_init(void) return 0; } - -static int imx8ulp_evt_dm_post_init(void *ctx, struct event *event) -{ - return imx8ulp_dm_post_init(); -} -EVENT_SPY(EVT_DM_POST_INIT_F, imx8ulp_evt_dm_post_init); +EVENT_SPY_SIMPLE(EVT_DM_POST_INIT_F, imx8ulp_dm_post_init); #if defined(CONFIG_SPL_BUILD) __weak void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image) diff --git a/arch/arm/mach-imx/imx9/soc.c b/arch/arm/mach-imx/imx9/soc.c index 55c2801..86b45be 100644 --- a/arch/arm/mach-imx/imx9/soc.c +++ b/arch/arm/mach-imx/imx9/soc.c @@ -552,7 +552,7 @@ int arch_cpu_init(void) return 0; } -int imx9_probe_mu(void *ctx, struct event *event) +int imx9_probe_mu(void) { struct udevice *devp; int node, ret; @@ -576,7 +576,7 @@ int imx9_probe_mu(void *ctx, struct event *event) return 0; } -EVENT_SPY(EVT_DM_POST_INIT_F, imx9_probe_mu); +EVENT_SPY_SIMPLE(EVT_DM_POST_INIT_F, imx9_probe_mu); int timer_init(void) { diff --git a/arch/arm/mach-k3/am625_init.c b/arch/arm/mach-k3/am625_init.c index 0e5d442..8fa36f7 100644 --- a/arch/arm/mach-k3/am625_init.c +++ b/arch/arm/mach-k3/am625_init.c @@ -80,8 +80,6 @@ static __maybe_unused void enable_mcu_esm_reset(void) writel(stat, CTRLMMR_MCU_RST_CTRL); } -#if defined(CONFIG_CPU_V7R) - /* * RTC Erratum i2327 Workaround for Silicon Revision 1 * @@ -94,7 +92,7 @@ static __maybe_unused void enable_mcu_esm_reset(void) * * https://www.ti.com/lit/er/sprz487c/sprz487c.pdf */ -void rtc_erratumi2327_init(void) +static __maybe_unused void rtc_erratumi2327_init(void) { u32 counter; @@ -112,19 +110,17 @@ void rtc_erratumi2327_init(void) */ writel(K3RTC_KICK0_UNLOCK_VALUE, REG_K3RTC_KICK0); writel(K3RTC_KICK1_UNLOCK_VALUE, REG_K3RTC_KICK1); - return; } -#endif void board_init_f(ulong dummy) { struct udevice *dev; int ret; -#if defined(CONFIG_CPU_V7R) - setup_k3_mpu_regions(); - rtc_erratumi2327_init(); -#endif + if (IS_ENABLED(CONFIG_CPU_V7R)) { + setup_k3_mpu_regions(); + rtc_erratumi2327_init(); + } /* * Cannot delay this further as there is a chance that @@ -156,29 +152,28 @@ void board_init_f(ulong dummy) preloader_console_init(); -#ifdef CONFIG_K3_EARLY_CONS /* * Allow establishing an early console as required for example when * doing a UART-based boot. Note that this console may not "survive" * through a SYSFW PM-init step and will need a re-init in some way * due to changing module clock frequencies. */ - early_console_init(); -#endif + if (IS_ENABLED(CONFIG_K3_EARLY_CONS)) + early_console_init(); -#if defined(CONFIG_K3_LOAD_SYSFW) /* * Configure and start up system controller firmware. Provide * the U-Boot console init function to the SYSFW post-PM configuration * callback hook, effectively switching on (or over) the console * output. */ - ret = is_rom_loaded_sysfw(&bootdata); - if (!ret) - panic("ROM has not loaded TIFS firmware\n"); + if (IS_ENABLED(CONFIG_K3_LOAD_SYSFW)) { + ret = is_rom_loaded_sysfw(&bootdata); + if (!ret) + panic("ROM has not loaded TIFS firmware\n"); - k3_sysfw_loader(true, NULL, NULL); -#endif + k3_sysfw_loader(true, NULL, NULL); + } /* * Force probe of clk_k3 driver here to ensure basic default clock @@ -209,11 +204,11 @@ void board_init_f(ulong dummy) enable_mcu_esm_reset(); } -#if defined(CONFIG_K3_AM64_DDRSS) - ret = uclass_get_device(UCLASS_RAM, 0, &dev); - if (ret) - panic("DRAM init failed: %d\n", ret); -#endif + if (IS_ENABLED(CONFIG_K3_AM64_DDRSS)) { + ret = uclass_get_device(UCLASS_RAM, 0, &dev); + if (ret) + panic("DRAM init failed: %d\n", ret); + } spl_enable_dcache(); } @@ -225,9 +220,15 @@ u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device) u32 bootmode_cfg = (devstat & MAIN_DEVSTAT_PRIMARY_BOOTMODE_CFG_MASK) >> MAIN_DEVSTAT_PRIMARY_BOOTMODE_CFG_SHIFT; - switch (bootmode) { case BOOT_DEVICE_EMMC: + if (IS_ENABLED(CONFIG_SUPPORT_EMMC_BOOT)) { + if (spl_mmc_emmc_boot_partition(mmc)) + return MMCSD_MODE_EMMCBOOT; + return MMCSD_MODE_FS; + } + if (IS_ENABLED(CONFIG_SPL_FS_FAT) || IS_ENABLED(CONFIG_SPL_FS_EXT4)) + return MMCSD_MODE_FS; return MMCSD_MODE_EMMCBOOT; case BOOT_DEVICE_MMC: if (bootmode_cfg & MAIN_DEVSTAT_PRIMARY_MMC_FS_RAW_MASK) diff --git a/arch/arm/mach-k3/common.c b/arch/arm/mach-k3/common.c index a351104..cc755dd 100644 --- a/arch/arm/mach-k3/common.c +++ b/arch/arm/mach-k3/common.c @@ -13,6 +13,7 @@ #include <log.h> #include <spl.h> #include <asm/global_data.h> +#include <linux/printk.h> #include "common.h" #include <dm.h> #include <remoteproc.h> diff --git a/arch/arm/mach-k3/config_secure.mk b/arch/arm/mach-k3/config_secure.mk index 7bc8af8..9cc1f9e 100644 --- a/arch/arm/mach-k3/config_secure.mk +++ b/arch/arm/mach-k3/config_secure.mk @@ -30,7 +30,7 @@ tispl.bin_HS: $(obj)/u-boot-spl-nodtb.bin_HS $(patsubst %,$(obj)/dts/%.dtb_HS,$( $(call if_changed,mkfitimage) MKIMAGEFLAGS_u-boot.img_HS = -f auto -A $(ARCH) -T firmware -C none -O u-boot \ - -a $(CONFIG_TEXT_BASE) -e $(CFG_SYS_UBOOT_START) \ + -a $(CONFIG_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \ -n "U-Boot $(UBOOTRELEASE) for $(BOARD) board" -E \ $(patsubst %,-b arch/$(ARCH)/dts/%.dtb_HS,$(subst ",,$(CONFIG_OF_LIST))) diff --git a/arch/arm/mach-meson/board-gx.c b/arch/arm/mach-meson/board-gx.c index f28f84d..c3fbdff 100644 --- a/arch/arm/mach-meson/board-gx.c +++ b/arch/arm/mach-meson/board-gx.c @@ -15,6 +15,7 @@ #include <asm/global_data.h> #include <asm/io.h> #include <asm/armv8/mmu.h> +#include <linux/printk.h> #include <linux/sizes.h> DECLARE_GLOBAL_DATA_PTR; diff --git a/arch/arm/mach-omap2/am33xx/board.c b/arch/arm/mach-omap2/am33xx/board.c index ecc0a59..06b4129 100644 --- a/arch/arm/mach-omap2/am33xx/board.c +++ b/arch/arm/mach-omap2/am33xx/board.c @@ -42,6 +42,7 @@ #include <linux/delay.h> #include <linux/errno.h> #include <linux/compiler.h> +#include <linux/printk.h> #include <linux/usb/ch9.h> #include <linux/usb/gadget.h> #include <linux/usb/musb.h> @@ -270,11 +271,7 @@ int arch_misc_init(void) return ret; #if defined(CONFIG_DM_ETH) && defined(CONFIG_USB_ETHER) - ret = usb_ether_init(); - if (ret) { - pr_err("USB ether init failed\n"); - return ret; - } + usb_ether_init(); #endif return 0; @@ -527,7 +524,7 @@ void board_init_f(ulong dummy) #endif -static int am33xx_dm_post_init(void *ctx, struct event *event) +static int am33xx_dm_post_init(void) { hw_data_init(); #if !CONFIG_IS_ENABLED(SKIP_LOWLEVEL_INIT) @@ -535,4 +532,4 @@ static int am33xx_dm_post_init(void *ctx, struct event *event) #endif return 0; } -EVENT_SPY(EVT_DM_POST_INIT_F, am33xx_dm_post_init); +EVENT_SPY_SIMPLE(EVT_DM_POST_INIT_F, am33xx_dm_post_init); diff --git a/arch/arm/mach-omap2/config_secure.mk b/arch/arm/mach-omap2/config_secure.mk index 24ddcdb..f76262b 100644 --- a/arch/arm/mach-omap2/config_secure.mk +++ b/arch/arm/mach-omap2/config_secure.mk @@ -102,7 +102,7 @@ u-boot_HS_XIP_X-LOADER: $(obj)/u-boot.bin FORCE ifdef CONFIG_SPL_LOAD_FIT MKIMAGEFLAGS_u-boot_HS.img = -f auto -A $(ARCH) -T firmware -C none -O u-boot \ - -a $(CONFIG_TEXT_BASE) -e $(CFG_SYS_UBOOT_START) \ + -a $(CONFIG_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \ -n "U-Boot $(UBOOTRELEASE) for $(BOARD) board" -E \ $(patsubst %,-b arch/$(ARCH)/dts/%.dtb_HS,$(subst ",,$(CONFIG_OF_LIST))) diff --git a/arch/arm/mach-omap2/hwinit-common.c b/arch/arm/mach-omap2/hwinit-common.c index 7715333..0e4572c 100644 --- a/arch/arm/mach-omap2/hwinit-common.c +++ b/arch/arm/mach-omap2/hwinit-common.c @@ -174,7 +174,7 @@ void __weak init_package_revision(void) * done in each of these cases * This function is called with SRAM stack. */ -void early_system_init(void) +int early_system_init(void) { #if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_MULTI_DTB_FIT) int ret; @@ -225,6 +225,8 @@ void early_system_init(void) debug_uart_init(); #endif prcm_init(); + + return 0; } #ifdef CONFIG_SPL_BUILD @@ -240,13 +242,7 @@ void board_init_f(ulong dummy) } #endif -static int omap2_system_init(void *ctx, struct event *event) -{ - early_system_init(); - - return 0; -} -EVENT_SPY(EVT_DM_POST_INIT_F, omap2_system_init); +EVENT_SPY_SIMPLE(EVT_DM_POST_INIT_F, early_system_init); /* * Routine: wait_for_command_complete diff --git a/arch/arm/mach-omap2/utils.c b/arch/arm/mach-omap2/utils.c index 7d93872..0623281 100644 --- a/arch/arm/mach-omap2/utils.c +++ b/arch/arm/mach-omap2/utils.c @@ -9,6 +9,7 @@ #include <asm/setup.h> #include <asm/arch/sys_proto.h> #include <asm/omap_common.h> +#include <linux/printk.h> static void do_cancel_out(u32 *num, u32 *den, u32 factor) { diff --git a/arch/arm/mach-rmobile/cpu_info.c b/arch/arm/mach-rmobile/cpu_info.c index 7651e43..6804b1d 100644 --- a/arch/arm/mach-rmobile/cpu_info.c +++ b/arch/arm/mach-rmobile/cpu_info.c @@ -83,14 +83,15 @@ static const struct { static int rmobile_cpuinfo_idx(void) { - int i = 0; u32 cpu_type = rmobile_get_cpu_type(); + int i; - for (; i < ARRAY_SIZE(rmobile_cpuinfo) - 1; i++) + for (i = 0; i < ARRAY_SIZE(rmobile_cpuinfo) - 1; i++) if (rmobile_cpuinfo[i].cpu_type == cpu_type) - break; + return i; - return i; + /* Unknown "CPU" entry */ + return ARRAY_SIZE(rmobile_cpuinfo) - 1; } static const u8 *get_cpu_name(int idx) diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig index a279582..03c2b37 100644 --- a/arch/arm/mach-rockchip/Kconfig +++ b/arch/arm/mach-rockchip/Kconfig @@ -470,7 +470,7 @@ config ROCKCHIP_STIMER_BASE config ROCKCHIP_SPL_RESERVE_IRAM hex "Size of IRAM reserved in SPL" - default 0 + default 0x0 help SPL may need reserve memory for firmware loaded by SPL, whose load address is in IRAM and may overlay with SPL text area if not diff --git a/arch/arm/mach-rockchip/board.c b/arch/arm/mach-rockchip/board.c index 8d7b39b..57f08e0 100644 --- a/arch/arm/mach-rockchip/board.c +++ b/arch/arm/mach-rockchip/board.c @@ -299,9 +299,9 @@ static struct dwc3_device dwc3_device_data = { .hsphy_mode = USBPHY_INTERFACE_MODE_UTMIW, }; -int usb_gadget_handle_interrupts(int index) +int dm_usb_gadget_handle_interrupts(struct udevice *dev) { - dwc3_uboot_handle_interrupt(0); + dwc3_uboot_handle_interrupt(dev); return 0; } diff --git a/arch/arm/mach-rockchip/boot_mode.c b/arch/arm/mach-rockchip/boot_mode.c index 1a1a887..eb8f65a 100644 --- a/arch/arm/mach-rockchip/boot_mode.c +++ b/arch/arm/mach-rockchip/boot_mode.c @@ -12,6 +12,7 @@ #include <asm/arch-rockchip/boot_mode.h> #include <dm/device.h> #include <dm/uclass.h> +#include <linux/printk.h> #if (CONFIG_ROCKCHIP_BOOT_MODE_REG == 0) diff --git a/arch/arm/mach-rockchip/rk3188/rk3188.c b/arch/arm/mach-rockchip/rk3188/rk3188.c index df8fa15..c807221 100644 --- a/arch/arm/mach-rockchip/rk3188/rk3188.c +++ b/arch/arm/mach-rockchip/rk3188/rk3188.c @@ -17,6 +17,7 @@ #include <asm/arch-rockchip/hardware.h> #include <dm/ofnode.h> #include <linux/err.h> +#include <linux/printk.h> #define GRF_BASE 0x20008000 diff --git a/arch/arm/mach-rockchip/rk3399/rk3399.c b/arch/arm/mach-rockchip/rk3399/rk3399.c index cbd2ea0..14565d2 100644 --- a/arch/arm/mach-rockchip/rk3399/rk3399.c +++ b/arch/arm/mach-rockchip/rk3399/rk3399.c @@ -20,6 +20,7 @@ #include <asm/arch-rockchip/grf_rk3399.h> #include <asm/arch-rockchip/hardware.h> #include <linux/bitops.h> +#include <linux/printk.h> #include <power/regulator.h> DECLARE_GLOBAL_DATA_PTR; diff --git a/arch/arm/mach-socfpga/misc.c b/arch/arm/mach-socfpga/misc.c index 5b5a81a..80ad087 100644 --- a/arch/arm/mach-socfpga/misc.c +++ b/arch/arm/mach-socfpga/misc.c @@ -25,6 +25,7 @@ #include <asm/arch/nic301.h> #include <asm/arch/scu.h> #include <asm/pl310.h> +#include <linux/printk.h> DECLARE_GLOBAL_DATA_PTR; diff --git a/arch/arm/mach-stm32mp/boot_params.c b/arch/arm/mach-stm32mp/boot_params.c index 24d04dc..158bf40 100644 --- a/arch/arm/mach-stm32mp/boot_params.c +++ b/arch/arm/mach-stm32mp/boot_params.c @@ -29,7 +29,7 @@ void *board_fdt_blob_setup(int *err) return (void *)nt_fw_dtb; log_debug("%s: DTB not found.\n", __func__); } - log_debug("%s: fall back to builtin DTB, %p\n", __func__, &_end); + log_debug("%s: fall back to builtin DTB, %p\n", __func__, _end); - return (void *)&_end; + return (void *)_end; } diff --git a/arch/arm/mach-stm32mp/bsec.c b/arch/arm/mach-stm32mp/bsec.c index 0dc1e5c..599e63a 100644 --- a/arch/arm/mach-stm32mp/bsec.c +++ b/arch/arm/mach-stm32mp/bsec.c @@ -18,6 +18,7 @@ #include <dm/device_compat.h> #include <linux/arm-smccc.h> #include <linux/iopoll.h> +#include <linux/printk.h> #define BSEC_OTP_MAX_VALUE 95 #define BSEC_OTP_UPPER_START 32 diff --git a/arch/arm/mach-stm32mp/cmd_stm32key.c b/arch/arm/mach-stm32mp/cmd_stm32key.c index 85be8e2..e16fcf4 100644 --- a/arch/arm/mach-stm32mp/cmd_stm32key.c +++ b/arch/arm/mach-stm32mp/cmd_stm32key.c @@ -11,6 +11,7 @@ #include <asm/arch/bsec.h> #include <dm/device.h> #include <dm/uclass.h> +#include <linux/printk.h> /* * Closed device: OTP0 diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c b/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c index c695cc1..2411bcf 100644 --- a/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c +++ b/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c @@ -8,6 +8,7 @@ #include <dfu.h> #include <image.h> #include <asm/arch/stm32prog.h> +#include <linux/printk.h> #include "stm32prog.h" struct stm32prog_data *stm32prog_data; diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c index 9ba94be..393f9a1 100644 --- a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c +++ b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c @@ -20,6 +20,7 @@ #include <linux/list.h> #include <linux/list_sort.h> #include <linux/mtd/mtd.h> +#include <linux/printk.h> #include <linux/sizes.h> #include "stm32prog.h" diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.h b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.h index feba295..ae4bd88 100644 --- a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.h +++ b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.h @@ -6,6 +6,8 @@ #ifndef _STM32PROG_H_ #define _STM32PROG_H_ +#include <linux/printk.h> + /* - phase defines ------------------------------------------------*/ #define PHASE_FLASHLAYOUT 0x00 #define PHASE_FIRST_USER 0x10 diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_serial.c b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_serial.c index f1bed7d..35bed31 100644 --- a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_serial.c +++ b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_serial.c @@ -14,6 +14,7 @@ #include <dm/lists.h> #include <dm/device-internal.h> #include <linux/delay.h> +#include <linux/printk.h> #include <asm/global_data.h> #include "stm32prog.h" diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_usb.c b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_usb.c index be38ff2..d18455b 100644 --- a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_usb.c +++ b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_usb.c @@ -9,6 +9,7 @@ #include <usb.h> #include <asm/arch/stm32prog.h> #include <asm/arch/sys_proto.h> +#include <linux/printk.h> #include "stm32prog.h" static int stm32prog_set_phase(struct stm32prog_data *data, u8 phase, diff --git a/arch/arm/mach-stm32mp/cpu.c b/arch/arm/mach-stm32mp/cpu.c index e2f67fc..e07abbe 100644 --- a/arch/arm/mach-stm32mp/cpu.c +++ b/arch/arm/mach-stm32mp/cpu.c @@ -15,6 +15,7 @@ #include <lmb.h> #include <misc.h> #include <net.h> +#include <spl.h> #include <asm/io.h> #include <asm/arch/stm32.h> #include <asm/arch/sys_proto.h> @@ -22,7 +23,7 @@ #include <dm/device.h> #include <dm/uclass.h> #include <linux/bitops.h> -#include <spl.h> +#include <linux/printk.h> /* * early TLB into the .data section so that it not get cleared diff --git a/arch/arm/mach-stm32mp/include/mach/stm32mp1_smc.h b/arch/arm/mach-stm32mp/include/mach/stm32mp1_smc.h index 4ad14f9..1b2bba3 100644 --- a/arch/arm/mach-stm32mp/include/mach/stm32mp1_smc.h +++ b/arch/arm/mach-stm32mp/include/mach/stm32mp1_smc.h @@ -7,6 +7,7 @@ #define __STM32MP1_SMC_H__ #include <linux/arm-smccc.h> +#include <linux/printk.h> /* * SMC function IDs for STM32 Service queries diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig index e20c3a3..9d5df2c 100644 --- a/arch/arm/mach-sunxi/Kconfig +++ b/arch/arm/mach-sunxi/Kconfig @@ -568,7 +568,7 @@ config DRAM_EMR1 config DRAM_TPR3 hex "sunxi dram tpr3 value" - default 0 + default 0x0 ---help--- Set the dram controller tpr3 parameter. This parameter configures the delay on the command lane and also phase shifts, which are @@ -579,7 +579,7 @@ config DRAM_TPR3 config DRAM_DQS_GATING_DELAY hex "sunxi dram dqs_gating_delay value" - default 0 + default 0x0 ---help--- Set the dram controller dqs_gating_delay parmeter. Each byte encodes the DQS gating delay for each byte lane. The delay diff --git a/arch/arm/mach-tegra/cboot.c b/arch/arm/mach-tegra/cboot.c index 55eb819..8f5bb2f 100644 --- a/arch/arm/mach-tegra/cboot.c +++ b/arch/arm/mach-tegra/cboot.c @@ -15,6 +15,7 @@ #include <stdlib.h> #include <string.h> #include <asm/global_data.h> +#include <linux/printk.h> #include <linux/ctype.h> #include <linux/sizes.h> diff --git a/arch/arm/mach-tegra/ivc.c b/arch/arm/mach-tegra/ivc.c index b69a458..66c1276 100644 --- a/arch/arm/mach-tegra/ivc.c +++ b/arch/arm/mach-tegra/ivc.c @@ -8,6 +8,7 @@ #include <asm/io.h> #include <asm/arch-tegra/ivc.h> #include <linux/bug.h> +#include <linux/printk.h> #define TEGRA_IVC_ALIGN 64 diff --git a/arch/arm/mach-tegra/tegra124/xusb-padctl.c b/arch/arm/mach-tegra/tegra124/xusb-padctl.c index d3c7719..69736aa 100644 --- a/arch/arm/mach-tegra/tegra124/xusb-padctl.c +++ b/arch/arm/mach-tegra/tegra124/xusb-padctl.c @@ -11,6 +11,7 @@ #include <dm/of_access.h> #include <dm/ofnode.h> #include <linux/delay.h> +#include <linux/printk.h> #include <asm/global_data.h> #include "../xusb-padctl-common.h" diff --git a/arch/arm/mach-tegra/tegra20/clock.c b/arch/arm/mach-tegra/tegra20/clock.c index 067a9f1..abd6e39 100644 --- a/arch/arm/mach-tegra/tegra20/clock.c +++ b/arch/arm/mach-tegra/tegra20/clock.c @@ -19,6 +19,7 @@ #include <div64.h> #include <fdtdec.h> #include <linux/delay.h> +#include <linux/printk.h> #include <dt-bindings/clock/tegra20-car.h> diff --git a/arch/arm/mach-tegra/tegra210/xusb-padctl.c b/arch/arm/mach-tegra/tegra210/xusb-padctl.c index c414dfd..30d0395 100644 --- a/arch/arm/mach-tegra/tegra210/xusb-padctl.c +++ b/arch/arm/mach-tegra/tegra210/xusb-padctl.c @@ -12,6 +12,7 @@ #include <dm/of_access.h> #include <dm/ofnode.h> #include <linux/delay.h> +#include <linux/printk.h> #include "../xusb-padctl-common.h" diff --git a/arch/arm/mach-tegra/tegra30/clock.c b/arch/arm/mach-tegra/tegra30/clock.c index 1dc9d09..698c7ab 100644 --- a/arch/arm/mach-tegra/tegra30/clock.c +++ b/arch/arm/mach-tegra/tegra30/clock.c @@ -18,6 +18,7 @@ #include <div64.h> #include <fdtdec.h> #include <linux/delay.h> +#include <linux/printk.h> #include <dt-bindings/clock/tegra30-car.h> diff --git a/arch/arm/mach-tegra/xusb-padctl-common.c b/arch/arm/mach-tegra/xusb-padctl-common.c index 388ec49..28fdebe 100644 --- a/arch/arm/mach-tegra/xusb-padctl-common.c +++ b/arch/arm/mach-tegra/xusb-padctl-common.c @@ -8,6 +8,7 @@ #include <common.h> #include <errno.h> #include <log.h> +#include <linux/printk.h> #include "xusb-padctl-common.h" diff --git a/arch/arm/mach-uniphier/boot-device/boot-device.c b/arch/arm/mach-uniphier/boot-device/boot-device.c index 98ff34c..1e6bc84 100644 --- a/arch/arm/mach-uniphier/boot-device/boot-device.c +++ b/arch/arm/mach-uniphier/boot-device/boot-device.c @@ -12,6 +12,7 @@ #include <linux/errno.h> #include <linux/io.h> #include <linux/log2.h> +#include <linux/printk.h> #include "../init.h" #include "../sg-regs.h" diff --git a/arch/arm/mach-uniphier/clk/dpll-ld4.c b/arch/arm/mach-uniphier/clk/dpll-ld4.c index 3ccaf02..f24a0eb 100644 --- a/arch/arm/mach-uniphier/clk/dpll-ld4.c +++ b/arch/arm/mach-uniphier/clk/dpll-ld4.c @@ -7,6 +7,7 @@ #include <linux/delay.h> #include <linux/errno.h> #include <linux/io.h> +#include <linux/printk.h> #include "../init.h" #include "../sc-regs.h" diff --git a/arch/arm/mach-uniphier/clk/dpll-pro4.c b/arch/arm/mach-uniphier/clk/dpll-pro4.c index 44006ae..204aee1 100644 --- a/arch/arm/mach-uniphier/clk/dpll-pro4.c +++ b/arch/arm/mach-uniphier/clk/dpll-pro4.c @@ -7,6 +7,7 @@ #include <linux/delay.h> #include <linux/errno.h> #include <linux/io.h> +#include <linux/printk.h> #include "../init.h" #include "../sc-regs.h" diff --git a/arch/arm/mach-uniphier/dram/umc-ld4.c b/arch/arm/mach-uniphier/dram/umc-ld4.c index 96acca2..1eb15b6 100644 --- a/arch/arm/mach-uniphier/dram/umc-ld4.c +++ b/arch/arm/mach-uniphier/dram/umc-ld4.c @@ -7,6 +7,7 @@ #include <linux/errno.h> #include <linux/io.h> +#include <linux/printk.h> #include <linux/sizes.h> #include <asm/processor.h> diff --git a/arch/arm/mach-uniphier/dram/umc-pro4.c b/arch/arm/mach-uniphier/dram/umc-pro4.c index cde39b4..0114df7 100644 --- a/arch/arm/mach-uniphier/dram/umc-pro4.c +++ b/arch/arm/mach-uniphier/dram/umc-pro4.c @@ -7,6 +7,7 @@ #include <linux/errno.h> #include <linux/io.h> +#include <linux/printk.h> #include <linux/sizes.h> #include <asm/processor.h> diff --git a/arch/arm/mach-uniphier/dram/umc-sld8.c b/arch/arm/mach-uniphier/dram/umc-sld8.c index a115869..583a1ba 100644 --- a/arch/arm/mach-uniphier/dram/umc-sld8.c +++ b/arch/arm/mach-uniphier/dram/umc-sld8.c @@ -7,6 +7,7 @@ #include <linux/errno.h> #include <linux/io.h> +#include <linux/printk.h> #include <linux/sizes.h> #include <asm/processor.h> diff --git a/arch/arm/mach-uniphier/memconf.c b/arch/arm/mach-uniphier/memconf.c index 57192f0..ab0d187 100644 --- a/arch/arm/mach-uniphier/memconf.c +++ b/arch/arm/mach-uniphier/memconf.c @@ -7,6 +7,7 @@ #include <linux/errno.h> #include <linux/io.h> +#include <linux/printk.h> #include <linux/sizes.h> #include "sg-regs.h" diff --git a/arch/arm/mach-uniphier/spl_board_init.c b/arch/arm/mach-uniphier/spl_board_init.c index a93b8cd..0f2e350 100644 --- a/arch/arm/mach-uniphier/spl_board_init.c +++ b/arch/arm/mach-uniphier/spl_board_init.c @@ -7,6 +7,7 @@ #include <debug_uart.h> #include <hang.h> #include <spl.h> +#include <linux/printk.h> #include "init.h" #include "micro-support-card.h" diff --git a/arch/arm/mach-zynqmp/Kconfig b/arch/arm/mach-zynqmp/Kconfig index fd6f077..26b80b7 100644 --- a/arch/arm/mach-zynqmp/Kconfig +++ b/arch/arm/mach-zynqmp/Kconfig @@ -84,9 +84,6 @@ config ZYNQMP_SPL_PM_CFG_OBJ_FILE Leave this option empty if your PMU firmware has a hard-coded configuration object or you are loading it by any other means. -config ZYNQMP_USB - bool "Configure ZynqMP USB" - config ZYNQMP_NO_DDR bool "Disable DDR MMU mapping" help diff --git a/arch/arm/mach-zynqmp/Makefile b/arch/arm/mach-zynqmp/Makefile index 3f25554..8f897a3 100644 --- a/arch/arm/mach-zynqmp/Makefile +++ b/arch/arm/mach-zynqmp/Makefile @@ -3,8 +3,7 @@ # (C) Copyright 2014 - 2015 Xilinx, Inc. # Michal Simek <michal.simek@amd.com> -obj-y += clk.o -obj-y += cpu.o +obj-y += aes.o clk.o cpu.o obj-$(CONFIG_MP) += mp.o obj-$(CONFIG_SPL_BUILD) += spl.o handoff.o psu_spl_init.o obj-$(CONFIG_SPL_ZYNQMP_DRAM_ECC_INIT) += ecc_spl_init.o diff --git a/arch/arm/mach-zynqmp/aes.c b/arch/arm/mach-zynqmp/aes.c new file mode 100644 index 0000000..8a2b7fd --- /dev/null +++ b/arch/arm/mach-zynqmp/aes.c @@ -0,0 +1,59 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * (C) Copyright 2018 Xilinx, Inc. + * Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com> + * + * Copyright (C) 2023 Weidmueller Interface GmbH & Co. KG <oss@weidmueller.com> + * Christian Taedcke <christian.taedcke@weidmueller.com> + */ + +#include <common.h> +#include <mach/zynqmp_aes.h> + +#include <asm/arch/sys_proto.h> +#include <cpu_func.h> +#include <memalign.h> +#include <zynqmp_firmware.h> + +int zynqmp_aes_operation(struct zynqmp_aes *aes) +{ + u32 ret_payload[PAYLOAD_ARG_CNT]; + int ret; + + if (zynqmp_firmware_version() <= PMUFW_V1_0) + return -ENOENT; + + if (aes->srcaddr && aes->ivaddr && aes->dstaddr) { + flush_dcache_range(aes->srcaddr, + aes->srcaddr + + roundup(aes->len, ARCH_DMA_MINALIGN)); + flush_dcache_range(aes->ivaddr, + aes->ivaddr + + roundup(IV_SIZE, ARCH_DMA_MINALIGN)); + flush_dcache_range(aes->dstaddr, + aes->dstaddr + + roundup(aes->len, ARCH_DMA_MINALIGN)); + } + + if (aes->keysrc == 0) { + if (aes->keyaddr == 0) + return -EINVAL; + + flush_dcache_range(aes->keyaddr, + aes->keyaddr + + roundup(KEY_PTR_LEN, ARCH_DMA_MINALIGN)); + } + + flush_dcache_range((ulong)aes, (ulong)(aes) + + roundup(sizeof(struct zynqmp_aes), ARCH_DMA_MINALIGN)); + + ret = xilinx_pm_request(PM_SECURE_AES, upper_32_bits((ulong)aes), + lower_32_bits((ulong)aes), 0, 0, ret_payload); + if (ret || ret_payload[1]) { + printf("Failed: AES op status:0x%x, errcode:0x%x\n", + ret, ret_payload[1]); + return -EIO; + } + + return 0; +} diff --git a/arch/arm/mach-zynqmp/include/mach/hardware.h b/arch/arm/mach-zynqmp/include/mach/hardware.h index 634bf16..8cb6494 100644 --- a/arch/arm/mach-zynqmp/include/mach/hardware.h +++ b/arch/arm/mach-zynqmp/include/mach/hardware.h @@ -166,7 +166,7 @@ struct csu_regs { u32 jtag_dap_cfg; u32 idcode; u32 version; - u32 reserved2[3055]; + u32 reserved2[3054]; u32 pcap_prog; }; diff --git a/arch/arm/mach-zynqmp/include/mach/zynqmp_aes.h b/arch/arm/mach-zynqmp/include/mach/zynqmp_aes.h new file mode 100644 index 0000000..2a9cffb --- /dev/null +++ b/arch/arm/mach-zynqmp/include/mach/zynqmp_aes.h @@ -0,0 +1,32 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (C) 2023 Weidmueller Interface GmbH & Co. KG <oss@weidmueller.com> + * Christian Taedcke <christian.taedcke@weidmueller.com> + * + * Declaration of AES operation functionality for ZynqMP. + */ + +#ifndef ZYNQMP_AES_H +#define ZYNQMP_AES_H + +struct zynqmp_aes { + u64 srcaddr; + u64 ivaddr; + u64 keyaddr; + u64 dstaddr; + u64 len; + u64 op; + u64 keysrc; +}; + +/** + * zynqmp_aes_operation() - Performs an aes operation using the pmu firmware + * + * @aes: The aes operation buffer that must have been allocated using + * ALLOC_CACHE_ALIGN_BUFFER(struct zynqmp_aes, aes, 1) + * + * Return: 0 in case of success, in case of an error any other value + */ +int zynqmp_aes_operation(struct zynqmp_aes *aes); + +#endif /* ZYNQMP_AES_H */ diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig index 1911563..587edd5 100644 --- a/arch/m68k/Kconfig +++ b/arch/m68k/Kconfig @@ -4,8 +4,8 @@ menu "M68000 architecture" config SYS_ARCH default "m68k" -config NEEDS_MANUAL_RELOC - def_bool y +config STATIC_RELA + default y # processor family config MCF520x diff --git a/arch/m68k/config.mk b/arch/m68k/config.mk index 3ccbe49..643b7d1 100644 --- a/arch/m68k/config.mk +++ b/arch/m68k/config.mk @@ -3,8 +3,8 @@ # (C) Copyright 2000-2002 # Wolfgang Denk, DENX Software Engineering, wd@denx.de. -PLATFORM_CPPFLAGS += -D__M68K__ -KBUILD_LDFLAGS += -n +PLATFORM_CPPFLAGS += -D__M68K__ -fPIC +KBUILD_LDFLAGS += -n -pie PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections PLATFORM_RELFLAGS += -ffixed-d7 -msep-data -LDFLAGS_FINAL += --gc-sections +LDFLAGS_FINAL += --gc-sections -pie diff --git a/arch/m68k/cpu/mcf523x/start.S b/arch/m68k/cpu/mcf523x/start.S index d2a21c3..c609e82 100644 --- a/arch/m68k/cpu/mcf523x/start.S +++ b/arch/m68k/cpu/mcf523x/start.S @@ -177,6 +177,39 @@ relocate_code: cmp.l %a1,%a2 bgt.s 1b +#define R_68K_32 1 +#define R_68K_RELATIVE 22 + + move.l #(__rel_dyn_start), %a1 + move.l #(__rel_dyn_end), %a2 + +fixloop: + move.l (%a1)+, %d1 /* Elf32_Rela r_offset */ + move.l (%a1)+, %d2 /* Elf32_Rela r_info */ + move.l (%a1)+, %d3 /* Elf32_Rela r_addend */ + + andi.l #0xff, %d2 + cmp.l #R_68K_32, %d2 + beq.s fixup + cmp.l #R_68K_RELATIVE, %d2 + beq.s fixup + + bra fixnext + +fixup: + /* relative fix: store addend plus offset at dest location */ + move.l %a0, %a3 + add.l %d1, %a3 + sub.l #CONFIG_SYS_MONITOR_BASE, %a3 + move.l (%a3), %d4 + add.l %a0, %d4 + sub.l #CONFIG_SYS_MONITOR_BASE, %d4 + move.l %d4, (%a3) + +fixnext: + cmp.l %a1, %a2 + bge.s fixloop + /* * We are done. Do not return, instead branch to second part of board * initialization, now running from RAM. @@ -191,10 +224,8 @@ clear_bss: /* * Now clear BSS segment */ - move.l %a0, %a1 - add.l #(_sbss - CONFIG_SYS_MONITOR_BASE),%a1 - move.l %a0, %d1 - add.l #(_ebss - CONFIG_SYS_MONITOR_BASE),%d1 + move.l #(_sbss), %a1 + move.l #(_ebss), %d1 6: clr.l (%a1)+ cmp.l %a1,%d1 @@ -203,24 +234,10 @@ clear_bss: /* * fix got table in RAM */ - move.l %a0, %a1 - add.l #(__got_start - CONFIG_SYS_MONITOR_BASE),%a1 - move.l %a1,%a5 /* * fix got pointer register a5 */ - - move.l %a0, %a2 - add.l #(__got_end - CONFIG_SYS_MONITOR_BASE),%a2 - -7: - move.l (%a1),%d1 - sub.l #_start,%d1 - add.l %a0,%d1 - move.l %d1,(%a1)+ - cmp.l %a2, %a1 - bne 7b + move.l #(__got_start), %a5 /* fix got pointer register a5 */ /* calculate relative jump to board_init_r in ram */ - move.l %a0, %a1 - add.l #(board_init_r - CONFIG_SYS_MONITOR_BASE), %a1 + move.l #(board_init_r), %a1 /* set parameters for board_init_r */ move.l %a0,-(%sp) /* dest_addr */ diff --git a/arch/m68k/cpu/mcf52x2/start.S b/arch/m68k/cpu/mcf52x2/start.S index 51d2e23..3a27602 100644 --- a/arch/m68k/cpu/mcf52x2/start.S +++ b/arch/m68k/cpu/mcf52x2/start.S @@ -255,6 +255,39 @@ relocate_code: cmp.l %a1,%a2 bgt.s 1b +#define R_68K_32 1 +#define R_68K_RELATIVE 22 + + move.l #(__rel_dyn_start), %a1 + move.l #(__rel_dyn_end), %a2 + +fixloop: + move.l (%a1)+, %d1 /* Elf32_Rela r_offset */ + move.l (%a1)+, %d2 /* Elf32_Rela r_info */ + move.l (%a1)+, %d3 /* Elf32_Rela r_addend */ + + andi.l #0xff, %d2 + cmp.l #R_68K_32, %d2 + beq.s fixup + cmp.l #R_68K_RELATIVE, %d2 + beq.s fixup + + bra fixnext + +fixup: + /* relative fix: store addend plus offset at dest location */ + move.l %a0, %a3 + add.l %d1, %a3 + sub.l #CONFIG_SYS_MONITOR_BASE, %a3 + move.l (%a3), %d4 + add.l %a0, %d4 + sub.l #CONFIG_SYS_MONITOR_BASE, %d4 + move.l %d4, (%a3) + +fixnext: + cmp.l %a1, %a2 + bge.s fixloop + /* * We are done. Do not return, instead branch to second part of board * initialization, now running from RAM. @@ -269,10 +302,8 @@ clear_bss: /* * Now clear BSS segment */ - move.l %a0, %a1 - add.l #(_sbss - CONFIG_SYS_MONITOR_BASE),%a1 - move.l %a0, %d1 - add.l #(_ebss - CONFIG_SYS_MONITOR_BASE),%d1 + move.l #(_sbss), %a1 + move.l #(_ebss), %d1 6: clr.l (%a1)+ cmp.l %a1,%d1 @@ -281,24 +312,10 @@ clear_bss: /* * fix got table in RAM */ - move.l %a0, %a1 - add.l #(__got_start - CONFIG_SYS_MONITOR_BASE),%a1 - move.l %a1,%a5 /* fix got pointer register a5 */ - - move.l %a0, %a2 - add.l #(__got_end - CONFIG_SYS_MONITOR_BASE),%a2 - -7: - move.l (%a1),%d1 - sub.l #_start,%d1 - add.l %a0,%d1 - move.l %d1,(%a1)+ - cmp.l %a2, %a1 - bne 7b + move.l #(__got_start), %a5 /* fix got pointer register a5 */ /* calculate relative jump to board_init_r in ram */ - move.l %a0, %a1 - add.l #(board_init_r - CONFIG_SYS_MONITOR_BASE), %a1 + move.l #(board_init_r), %a1 /* set parameters for board_init_r */ move.l %a0,-(%sp) /* dest_addr */ diff --git a/arch/m68k/cpu/mcf530x/start.S b/arch/m68k/cpu/mcf530x/start.S index cef8d79..552e020 100644 --- a/arch/m68k/cpu/mcf530x/start.S +++ b/arch/m68k/cpu/mcf530x/start.S @@ -180,6 +180,39 @@ relocate_code: cmp.l %a1,%a2 bgt.s 1b +#define R_68K_32 1 +#define R_68K_RELATIVE 22 + + move.l #(__rel_dyn_start), %a1 + move.l #(__rel_dyn_end), %a2 + +fixloop: + move.l (%a1)+, %d1 /* Elf32_Rela r_offset */ + move.l (%a1)+, %d2 /* Elf32_Rela r_info */ + move.l (%a1)+, %d3 /* Elf32_Rela r_addend */ + + andi.l #0xff, %d2 + cmp.l #R_68K_32, %d2 + beq.s fixup + cmp.l #R_68K_RELATIVE, %d2 + beq.s fixup + + bra fixnext + +fixup: + /* relative fix: store addend plus offset at dest location */ + move.l %a0, %a3 + add.l %d1, %a3 + sub.l #CONFIG_SYS_MONITOR_BASE, %a3 + move.l (%a3), %d4 + add.l %a0, %d4 + sub.l #CONFIG_SYS_MONITOR_BASE, %d4 + move.l %d4, (%a3) + +fixnext: + cmp.l %a1, %a2 + bge.s fixloop + /* * We are done. Do not return, instead branch to second part of board * initialization, now running from RAM. @@ -194,10 +227,8 @@ clear_bss: /* * Now clear BSS segment */ - move.l %a0, %a1 - add.l #(_sbss - CONFIG_SYS_MONITOR_BASE), %a1 - move.l %a0, %d1 - add.l #(_ebss - CONFIG_SYS_MONITOR_BASE), %d1 + move.l #(_sbss), %a1 + move.l #(_ebss), %d1 6: clr.l (%a1)+ cmp.l %a1,%d1 @@ -206,26 +237,10 @@ clear_bss: /* * fix got table in RAM */ - move.l %a0, %a1 - add.l #(__got_start - CONFIG_SYS_MONITOR_BASE), %a1 - - /* fix got pointer register a5 */ - move.l %a1,%a5 - - move.l %a0, %a2 - add.l #(__got_end - CONFIG_SYS_MONITOR_BASE), %a2 - -7: - move.l (%a1),%d1 - sub.l #_start, %d1 - add.l %a0,%d1 - move.l %d1,(%a1)+ - cmp.l %a2, %a1 - bne 7b + move.l #(__got_start), %a5 /* fix got pointer register a5 */ /* calculate relative jump to board_init_r in ram */ - move.l %a0, %a1 - add.l #(board_init_r - CONFIG_SYS_MONITOR_BASE), %a1 + move.l #(board_init_r), %a1 /* set parameters for board_init_r */ move.l %a0,-(%sp) /* dest_addr */ diff --git a/arch/m68k/cpu/mcf532x/start.S b/arch/m68k/cpu/mcf532x/start.S index 72a2f99..c3eae73 100644 --- a/arch/m68k/cpu/mcf532x/start.S +++ b/arch/m68k/cpu/mcf532x/start.S @@ -192,6 +192,39 @@ relocate_code: cmp.l %a1,%a2 bgt.s 1b +#define R_68K_32 1 +#define R_68K_RELATIVE 22 + + move.l #(__rel_dyn_start), %a1 + move.l #(__rel_dyn_end), %a2 + +fixloop: + move.l (%a1)+, %d1 /* Elf32_Rela r_offset */ + move.l (%a1)+, %d2 /* Elf32_Rela r_info */ + move.l (%a1)+, %d3 /* Elf32_Rela r_addend */ + + andi.l #0xff, %d2 + cmp.l #R_68K_32, %d2 + beq.s fixup + cmp.l #R_68K_RELATIVE, %d2 + beq.s fixup + + bra fixnext + +fixup: + /* relative fix: store addend plus offset at dest location */ + move.l %a0, %a3 + add.l %d1, %a3 + sub.l #CONFIG_SYS_MONITOR_BASE, %a3 + move.l (%a3), %d4 + add.l %a0, %d4 + sub.l #CONFIG_SYS_MONITOR_BASE, %d4 + move.l %d4, (%a3) + +fixnext: + cmp.l %a1, %a2 + bge.s fixloop + /* * We are done. Do not return, instead branch to second part of board * initialization, now running from RAM. @@ -206,10 +239,8 @@ clear_bss: /* * Now clear BSS segment */ - move.l %a0, %a1 - add.l #(_sbss - CONFIG_SYS_MONITOR_BASE),%a1 - move.l %a0, %d1 - add.l #(_ebss - CONFIG_SYS_MONITOR_BASE),%d1 + move.l #(_sbss), %a1 + move.l #(_ebss), %d1 6: clr.l (%a1)+ cmp.l %a1,%d1 @@ -218,24 +249,10 @@ clear_bss: /* * fix got table in RAM */ - move.l %a0, %a1 - add.l #(__got_start - CONFIG_SYS_MONITOR_BASE),%a1 - move.l %a1,%a5 /* fix got pointer register a5 */ - - move.l %a0, %a2 - add.l #(__got_end - CONFIG_SYS_MONITOR_BASE),%a2 - -7: - move.l (%a1),%d1 - sub.l #_start,%d1 - add.l %a0,%d1 - move.l %d1,(%a1)+ - cmp.l %a2, %a1 - bne 7b + move.l #(__got_start), %a5 /* fix got pointer register a5 */ /* calculate relative jump to board_init_r in ram */ - move.l %a0, %a1 - add.l #(board_init_r - CONFIG_SYS_MONITOR_BASE), %a1 + move.l #(board_init_r), %a1 /* set parameters for board_init_r */ move.l %a0,-(%sp) /* dest_addr */ diff --git a/arch/m68k/cpu/mcf5445x/start.S b/arch/m68k/cpu/mcf5445x/start.S index a083c3d..5c3bfff 100644 --- a/arch/m68k/cpu/mcf5445x/start.S +++ b/arch/m68k/cpu/mcf5445x/start.S @@ -533,6 +533,39 @@ relocate_code: cmp.l %a1,%a2 bgt.s 1b +#define R_68K_32 1 +#define R_68K_RELATIVE 22 + + move.l #(__rel_dyn_start), %a1 + move.l #(__rel_dyn_end), %a2 + +fixloop: + move.l (%a1)+, %d1 /* Elf32_Rela r_offset */ + move.l (%a1)+, %d2 /* Elf32_Rela r_info */ + move.l (%a1)+, %d3 /* Elf32_Rela r_addend */ + + andi.l #0xff, %d2 + cmp.l #R_68K_32, %d2 + beq.s fixup + cmp.l #R_68K_RELATIVE, %d2 + beq.s fixup + + bra fixnext + +fixup: + /* relative fix: store addend plus offset at dest location */ + move.l %a0, %a3 + add.l %d1, %a3 + sub.l #CONFIG_SYS_MONITOR_BASE, %a3 + move.l (%a3), %d4 + add.l %a0, %d4 + sub.l #CONFIG_SYS_MONITOR_BASE, %d4 + move.l %d4, (%a3) + +fixnext: + cmp.l %a1, %a2 + bge.s fixloop + /* * We are done. Do not return, instead branch to second part of board * initialization, now running from RAM. @@ -547,10 +580,8 @@ clear_bss: /* * Now clear BSS segment */ - move.l %a0, %a1 - add.l #(_sbss - CONFIG_SYS_MONITOR_BASE),%a1 - move.l %a0, %d1 - add.l #(_ebss - CONFIG_SYS_MONITOR_BASE),%d1 + move.l #(_sbss), %a1 + move.l #(_ebss), %d1 6: clr.l (%a1)+ cmp.l %a1,%d1 @@ -559,24 +590,10 @@ clear_bss: /* * fix got table in RAM */ - move.l %a0, %a1 - add.l #(__got_start - CONFIG_SYS_MONITOR_BASE),%a1 - move.l %a1,%a5 /* fix got pointer register a5 */ - - move.l %a0, %a2 - add.l #(__got_end - CONFIG_SYS_MONITOR_BASE),%a2 - -7: - move.l (%a1),%d1 - sub.l #_start,%d1 - add.l %a0,%d1 - move.l %d1,(%a1)+ - cmp.l %a2, %a1 - bne 7b + move.l #(__got_start), %a5 /* fix got pointer register a5 */ /* calculate relative jump to board_init_r in ram */ - move.l %a0, %a1 - add.l #(board_init_r - CONFIG_SYS_MONITOR_BASE), %a1 + move.l #(board_init_r), %a1 /* set parameters for board_init_r */ move.l %a0,-(%sp) /* dest_addr */ diff --git a/arch/m68k/cpu/u-boot.lds b/arch/m68k/cpu/u-boot.lds index 133f791..03d427c 100644 --- a/arch/m68k/cpu/u-boot.lds +++ b/arch/m68k/cpu/u-boot.lds @@ -76,6 +76,20 @@ SECTIONS . = ALIGN(4); __init_end = .; + . = ALIGN(4); + __rel_dyn_start = .; + .rela.dyn : { + *(.rela.dyn) + } + __rel_dyn_end = .; + + . = ALIGN(4); + __dyn_sym_start = .; + .dynsym : { + *(.dynsym) + } + __dyn_sym_end = .; + _end = .; __bss_start = .; diff --git a/arch/microblaze/include/asm/processor.h b/arch/microblaze/include/asm/processor.h index 958018c..c0423ea 100644 --- a/arch/microblaze/include/asm/processor.h +++ b/arch/microblaze/include/asm/processor.h @@ -6,11 +6,6 @@ #ifndef __ASM_MICROBLAZE_PROCESSOR_H #define __ASM_MICROBLAZE_PROCESSOR_H -/* References to section boundaries */ - -extern char _end[]; -extern char __text_start[]; - /* Microblaze board initialization function */ void board_init(void); diff --git a/arch/mips/lib/reloc.c b/arch/mips/lib/reloc.c index 67c8af2..9cf6809 100644 --- a/arch/mips/lib/reloc.c +++ b/arch/mips/lib/reloc.c @@ -146,7 +146,7 @@ void relocate_code(ulong start_addr_sp, gd_t *new_gd, ulong relocaddr) /* Clear the .bss section */ bss_start = (uint8_t *)((unsigned long)__bss_start + off); - bss_len = (unsigned long)&__bss_end - (unsigned long)__bss_start; + bss_len = (unsigned long)__bss_end - (unsigned long)__bss_start; memset(bss_start, 0, bss_len); /* Jump to the relocated U-Boot */ diff --git a/arch/mips/mach-jz47xx/jz4780/jz4780.c b/arch/mips/mach-jz47xx/jz4780/jz4780.c index 676c305..56fdf04 100644 --- a/arch/mips/mach-jz47xx/jz4780/jz4780.c +++ b/arch/mips/mach-jz47xx/jz4780/jz4780.c @@ -42,7 +42,7 @@ void board_init_f(ulong dummy) enable_caches(); /* Clear the BSS */ - memset(__bss_start, 0, (char *)&__bss_end - __bss_start); + memset(__bss_start, 0, (size_t)__bss_end - (size_t)__bss_start); gd->flags |= GD_FLG_SPL_INIT; diff --git a/arch/mips/mach-mtmips/cpu.c b/arch/mips/mach-mtmips/cpu.c index f1e9022..e88dab1 100644 --- a/arch/mips/mach-mtmips/cpu.c +++ b/arch/mips/mach-mtmips/cpu.c @@ -4,6 +4,7 @@ */ #include <common.h> +#include <event.h> #include <init.h> #include <malloc.h> #include <asm/addrspace.h> @@ -21,7 +22,8 @@ int dram_init(void) return 0; } -int last_stage_init(void) +#ifndef CONFIG_SPL_BUILD +static int last_stage_init(void) { void *src, *dst; @@ -46,3 +48,5 @@ int last_stage_init(void) return 0; } +EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, last_stage_init); +#endif diff --git a/arch/mips/mach-mtmips/mt7621/spl/launch.c b/arch/mips/mach-mtmips/mt7621/spl/launch.c index 37c20a5..95dd659 100644 --- a/arch/mips/mach-mtmips/mt7621/spl/launch.c +++ b/arch/mips/mach-mtmips/mt7621/spl/launch.c @@ -70,7 +70,7 @@ void secondary_cpu_init(void) cpumask = 0x0f; /* Make BootROM/TPL redirect Core1's bootup flow to our entry point */ - writel((uintptr_t)&_start, sysc + BOOT_SRAM_BASE_REG); + writel((uintptr_t)_start, sysc + BOOT_SRAM_BASE_REG); bootup_secondary_core(); } diff --git a/arch/mips/mach-mtmips/mt7621/spl/spl.c b/arch/mips/mach-mtmips/mt7621/spl/spl.c index aa5b267..25b409e 100644 --- a/arch/mips/mach-mtmips/mt7621/spl/spl.c +++ b/arch/mips/mach-mtmips/mt7621/spl/spl.c @@ -86,7 +86,7 @@ unsigned long spl_nor_get_uboot_base(void) uint32_t spl_nand_get_uboot_raw_page(void) { - const struct stage_header *sh = (const struct stage_header *)&_start; + const struct stage_header *sh = (const struct stage_header *)_start; u32 addr; addr = image_get_header_size() + be32_to_cpu(sh->stage_size); diff --git a/arch/mips/mach-pic32/cpu.c b/arch/mips/mach-pic32/cpu.c index ec3c250..7ed306e 100644 --- a/arch/mips/mach-pic32/cpu.c +++ b/arch/mips/mach-pic32/cpu.c @@ -57,7 +57,7 @@ static ulong clk_get_cpu_rate(void) } /* initialize prefetch module related to cpu_clk */ -static void prefetch_init(void) +static int prefetch_init(void) { struct pic32_reg_atomic *regs; const void __iomem *base; @@ -93,16 +93,12 @@ static void prefetch_init(void) /* Enable prefetch for all */ writel(0x30, ®s->set); iounmap(regs); -} -/* arch specific CPU init after DM */ -static int pic32_flash_prefetch(void *ctx, struct event *event) -{ - /* flash prefetch */ - prefetch_init(); return 0; } -EVENT_SPY(EVT_DM_POST_INIT_F, pic32_flash_prefetch); + +/* arch-specific CPU init after DM: flash prefetch */ +EVENT_SPY_SIMPLE(EVT_DM_POST_INIT_F, prefetch_init); /* Un-gate DDR2 modules (gated by default) */ static void ddr2_pmd_ungate(void) diff --git a/arch/nios2/cpu/cpu.c b/arch/nios2/cpu/cpu.c index da167f4..79a54d1 100644 --- a/arch/nios2/cpu/cpu.c +++ b/arch/nios2/cpu/cpu.c @@ -64,7 +64,7 @@ static void copy_exception_trampoline(void) } #endif -static int nios_cpu_setup(void *ctx, struct event *event) +static int nios_cpu_setup(void) { struct udevice *dev; int ret; @@ -80,7 +80,7 @@ static int nios_cpu_setup(void *ctx, struct event *event) return 0; } -EVENT_SPY(EVT_DM_POST_INIT_F, nios_cpu_setup); +EVENT_SPY_SIMPLE(EVT_DM_POST_INIT_F, nios_cpu_setup); static int altera_nios2_get_desc(const struct udevice *dev, char *buf, int size) diff --git a/arch/powerpc/cpu/mpc8xx/Kconfig b/arch/powerpc/cpu/mpc8xx/Kconfig index bd2af8d..1731c96 100644 --- a/arch/powerpc/cpu/mpc8xx/Kconfig +++ b/arch/powerpc/cpu/mpc8xx/Kconfig @@ -94,7 +94,7 @@ config SYS_SIUMCR config SYS_SYPCR hex "SYPCR register" if !WDT_MPC8xxx - default 0 + default 0x0 help System Protection Control (11-9) diff --git a/arch/riscv/cpu/cpu.c b/arch/riscv/cpu/cpu.c index 0b4208e..c1a9638 100644 --- a/arch/riscv/cpu/cpu.c +++ b/arch/riscv/cpu/cpu.c @@ -66,7 +66,7 @@ static inline bool supports_extension(char ext) #endif /* CONFIG_CPU */ } -static int riscv_cpu_probe(void *ctx, struct event *event) +static int riscv_cpu_probe(void) { #ifdef CONFIG_CPU int ret; @@ -79,7 +79,7 @@ static int riscv_cpu_probe(void *ctx, struct event *event) return 0; } -EVENT_SPY(EVT_DM_POST_INIT_R, riscv_cpu_probe); +EVENT_SPY_SIMPLE(EVT_DM_POST_INIT_R, riscv_cpu_probe); /* * This is called on secondary harts just after the IPI is init'd. Currently @@ -92,13 +92,9 @@ static void dummy_pending_ipi_clear(ulong hart, ulong arg0, ulong arg1) } #endif -int riscv_cpu_setup(void *ctx, struct event *event) +int riscv_cpu_setup(void) { - int ret; - - ret = riscv_cpu_probe(ctx, event); - if (ret) - return ret; + int __maybe_unused ret; /* Enable FPU */ if (supports_extension('d') || supports_extension('f')) { @@ -146,7 +142,7 @@ int riscv_cpu_setup(void *ctx, struct event *event) return 0; } -EVENT_SPY(EVT_DM_POST_INIT_F, riscv_cpu_setup); +EVENT_SPY_SIMPLE(EVT_DM_POST_INIT_F, riscv_cpu_setup); int arch_early_init_r(void) { diff --git a/arch/riscv/dts/jh7110-starfive-visionfive-2-u-boot.dtsi b/arch/riscv/dts/jh7110-starfive-visionfive-2-u-boot.dtsi index 13f69da..5518531 100644 --- a/arch/riscv/dts/jh7110-starfive-visionfive-2-u-boot.dtsi +++ b/arch/riscv/dts/jh7110-starfive-visionfive-2-u-boot.dtsi @@ -103,4 +103,15 @@ }; }; }; + + spl-img { + filename = "spl/u-boot-spl.bin.normal.out"; + + mkimage { + args = "-T sfspl"; + + u-boot-spl { + }; + }; +}; }; diff --git a/arch/riscv/include/asm/global_data.h b/arch/riscv/include/asm/global_data.h index 9d97517..937fa4d 100644 --- a/arch/riscv/include/asm/global_data.h +++ b/arch/riscv/include/asm/global_data.h @@ -32,6 +32,9 @@ struct arch_global_data { ulong available_harts; #endif #endif +#ifdef CONFIG_SMBIOS + ulong smbios_start; /* Start address of SMBIOS table */ +#endif }; #include <asm-generic/global_data.h> diff --git a/arch/riscv/include/asm/system.h b/arch/riscv/include/asm/system.h index ffa7649..87a804b 100644 --- a/arch/riscv/include/asm/system.h +++ b/arch/riscv/include/asm/system.h @@ -26,6 +26,6 @@ struct event; } while (0) /* Hook to set up the CPU (called from SPL too) */ -int riscv_cpu_setup(void *ctx, struct event *event); +int riscv_cpu_setup(void); #endif /* __ASM_RISCV_SYSTEM_H */ diff --git a/arch/riscv/lib/smp.c b/arch/riscv/lib/smp.c index 4f073a0..f3cd8b9 100644 --- a/arch/riscv/lib/smp.c +++ b/arch/riscv/lib/smp.c @@ -10,6 +10,7 @@ #include <asm/barrier.h> #include <asm/global_data.h> #include <asm/smp.h> +#include <linux/printk.h> DECLARE_GLOBAL_DATA_PTR; diff --git a/arch/riscv/lib/spl.c b/arch/riscv/lib/spl.c index f4d3b67..9b242ed 100644 --- a/arch/riscv/lib/spl.c +++ b/arch/riscv/lib/spl.c @@ -28,7 +28,7 @@ __weak void board_init_f(ulong dummy) if (ret) panic("spl_early_init() failed: %d\n", ret); - riscv_cpu_setup(NULL, NULL); + riscv_cpu_setup(); preloader_console_init(); diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c index 9e93a0f..85d0d6a 100644 --- a/arch/sandbox/cpu/os.c +++ b/arch/sandbox/cpu/os.c @@ -258,6 +258,30 @@ int os_unmap(void *buf, int size) return 0; } +int os_persistent_file(char *buf, int maxsize, const char *fname) +{ + const char *dirname = getenv("U_BOOT_PERSISTENT_DATA_DIR"); + char *ptr; + int len; + + len = strlen(fname) + (dirname ? strlen(dirname) + 1 : 0) + 1; + if (len > maxsize) + return -ENOSPC; + + ptr = buf; + if (dirname) { + strcpy(ptr, dirname); + ptr += strlen(dirname); + *ptr++ = '/'; + } + strcpy(ptr, fname); + + if (access(buf, F_OK) == -1) + return -ENOENT; + + return 0; +} + /* Restore tty state when we exit */ static struct termios orig_term; static bool term_setup; diff --git a/arch/sandbox/cpu/start.c b/arch/sandbox/cpu/start.c index 2346528..1026898 100644 --- a/arch/sandbox/cpu/start.c +++ b/arch/sandbox/cpu/start.c @@ -119,12 +119,7 @@ int sandbox_early_getopt_check(void) os_exit(0); } - -static int sandbox_misc_init_f(void *ctx, struct event *event) -{ - return sandbox_early_getopt_check(); -} -EVENT_SPY(EVT_MISC_INIT_F, sandbox_misc_init_f); +EVENT_SPY_SIMPLE(EVT_MISC_INIT_F, sandbox_early_getopt_check); static int sandbox_cmdline_cb_help(struct sandbox_state *state, const char *arg) { diff --git a/arch/sandbox/dts/sandbox.dtsi b/arch/sandbox/dts/sandbox.dtsi index 8aaf911..ff7e558 100644 --- a/arch/sandbox/dts/sandbox.dtsi +++ b/arch/sandbox/dts/sandbox.dtsi @@ -16,12 +16,6 @@ stdout-path = "/serial"; }; - cedit-theme { - font-size = <30>; - menu-inset = <3>; - menuitem-gap-y = <1>; - }; - alarm_wdt: alarm-wdt { compatible = "sandbox,alarm-wdt"; timeout-sec = <5>; @@ -36,6 +30,12 @@ bootstd { compatible = "u-boot,boot-std"; filename-prefixes = "./"; + + cedit-theme { + font-size = <30>; + menu-inset = <3>; + menuitem-gap-y = <1>; + }; }; buttons { diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts index 057e1ca..962b9eb 100644 --- a/arch/sandbox/dts/test.dts +++ b/arch/sandbox/dts/test.dts @@ -39,6 +39,8 @@ mmc1 = "/mmc1"; mmc2 = "/mmc2"; mmc3 = "/mmc3"; + mmc4 = "/mmc4"; + mmc5 = "/mmc5"; pci0 = &pci0; pci1 = &pci1; pci2 = &pci2; @@ -79,6 +81,15 @@ }; }; + options { + u-boot { + compatible = "u-boot,config"; + bootscr-ram-offset = /bits/ 64 <0x12345678>; + bootscr-flash-offset = /bits/ 64 <0>; + bootscr-flash-size = /bits/ 64 <0x2000>; + }; + }; + bootstd { bootph-verify; compatible = "u-boot,boot-std"; @@ -100,6 +111,12 @@ menuitem-gap-y = <1>; }; + cedit-theme { + font-size = <30>; + menu-inset = <3>; + menuitem-gap-y = <1>; + }; + /* * This is used for the VBE OS-request tests. A FAT filesystem * created in a partition with the VBE information appearing @@ -144,12 +161,6 @@ cedit: cedit { }; - cedit-theme { - font-size = <30>; - menu-inset = <3>; - menuitem-gap-y = <1>; - }; - fuzzing-engine { compatible = "sandbox,fuzzing-engine"; }; @@ -299,6 +310,7 @@ uint-value = <(-1234)>; int64-value = /bits/ 64 <0x1111222233334444>; int-array = <5678 9123 4567>; + int64-array = /bits/ 64 <0x1111222233334444 0x4444333322221111>; str-value = "test string"; interrupts-extended = <&irq 3 0>; acpi,name = "GHIJ"; @@ -431,6 +443,11 @@ #phy-cells = <0>; }; + phy_provider3: gen_phy@3 { + compatible = "sandbox,phy"; + #phy-cells = <2>; + }; + gen_phy_user: gen_phy_user { compatible = "simple-bus"; phys = <&phy_provider0 0>, <&phy_provider0 1>, <&phy_provider1>; @@ -443,6 +460,12 @@ phy-names = "phy1", "phy2"; }; + gen_phy_user2: gen_phy_user2 { + compatible = "simple-bus"; + phys = <&phy_provider3 0 0>; + phy-names = "phy1"; + }; + some-bus { #address-cells = <1>; #size-cells = <0>; @@ -600,6 +623,22 @@ clock-names = "fixed", "i2c", "spi", "uart2", "uart1"; }; + clk-test2 { + compatible = "sandbox,clk-test"; + assigned-clock-rates = <321>; + }; + + clk-test3 { + compatible = "sandbox,clk-test"; + assigned-clocks = <&clk_sandbox 1>; + }; + + clk-test4 { + compatible = "sandbox,clk-test"; + assigned-clock-rates = <654>, <321>; + assigned-clocks = <&clk_sandbox 1>; + }; + ccf: clk-ccf { compatible = "sandbox,clk-ccf"; }; @@ -1055,6 +1094,13 @@ filename = "mmc4.img"; }; + /* This is used for ChromiumOS tests */ + mmc5 { + status = "disabled"; + compatible = "sandbox,mmc"; + filename = "mmc5.img"; + }; + pch { compatible = "sandbox,pch"; }; diff --git a/arch/sandbox/include/asm/global_data.h b/arch/sandbox/include/asm/global_data.h index f0ab3ba..c697773 100644 --- a/arch/sandbox/include/asm/global_data.h +++ b/arch/sandbox/include/asm/global_data.h @@ -17,6 +17,7 @@ struct arch_global_data { ulong table_end; /* End address of x86 tables */ ulong table_start_high; /* Start address of high x86 tables */ ulong table_end_high; /* End address of high x86 tables */ + ulong smbios_start; /* Start address of SMBIOS table */ }; #include <asm-generic/global_data.h> diff --git a/arch/x86/cpu/apollolake/acpi.c b/arch/x86/cpu/apollolake/acpi.c index fd21c0b..c610a7f 100644 --- a/arch/x86/cpu/apollolake/acpi.c +++ b/arch/x86/cpu/apollolake/acpi.c @@ -146,16 +146,21 @@ void fill_fadt(struct acpi_fadt *fadt) fadt->x_pm_tmr_blk.addrl = IOMAP_ACPI_BASE + PM1_TMR; } -void acpi_create_fadt(struct acpi_fadt *fadt, struct acpi_facs *facs, - void *dsdt) +static int apl_write_fadt(struct acpi_ctx *ctx, const struct acpi_writer *entry) { - struct acpi_table_header *header = &fadt->header; + struct acpi_table_header *header; + struct acpi_fadt *fadt; - acpi_fadt_common(fadt, facs, dsdt); + fadt = ctx->current; + acpi_fadt_common(fadt, ctx->facs, ctx->dsdt); intel_acpi_fill_fadt(fadt); fill_fadt(fadt); + header = &fadt->header; header->checksum = table_compute_checksum(fadt, header->length); + + return acpi_add_fadt(ctx, fadt); } +ACPI_WRITER(5fadt, "FADT", apl_write_fadt, 0); int apl_acpi_fill_dmar(struct acpi_ctx *ctx) { diff --git a/arch/x86/cpu/baytrail/acpi.c b/arch/x86/cpu/baytrail/acpi.c index 07757b8..4378846 100644 --- a/arch/x86/cpu/baytrail/acpi.c +++ b/arch/x86/cpu/baytrail/acpi.c @@ -15,20 +15,24 @@ #include <asm/arch/iomap.h> #include <dm/uclass-internal.h> -void acpi_create_fadt(struct acpi_fadt *fadt, struct acpi_facs *facs, - void *dsdt) +static int baytrail_write_fadt(struct acpi_ctx *ctx, + const struct acpi_writer *entry) { - struct acpi_table_header *header = &(fadt->header); + struct acpi_table_header *header; + struct acpi_fadt *fadt; + + fadt = ctx->current; + header = &fadt->header; u16 pmbase = ACPI_BASE_ADDRESS; - memset((void *)fadt, 0, sizeof(struct acpi_fadt)); + memset(fadt, '\0', sizeof(struct acpi_fadt)); acpi_fill_header(header, "FACP"); header->length = sizeof(struct acpi_fadt); header->revision = 4; - fadt->firmware_ctrl = (u32)facs; - fadt->dsdt = (u32)dsdt; + fadt->firmware_ctrl = (u32)ctx->facs; + fadt->dsdt = (u32)ctx->dsdt; fadt->preferred_pm_profile = ACPI_PM_MOBILE; fadt->sci_int = 9; fadt->smi_cmd = 0; @@ -75,9 +79,9 @@ void acpi_create_fadt(struct acpi_fadt *fadt, struct acpi_facs *facs, fadt->reset_reg.addrh = 0; fadt->reset_value = SYS_RST | RST_CPU | FULL_RST; - fadt->x_firmware_ctl_l = (u32)facs; + fadt->x_firmware_ctl_l = (u32)ctx->facs; fadt->x_firmware_ctl_h = 0; - fadt->x_dsdt_l = (u32)dsdt; + fadt->x_dsdt_l = (u32)ctx->dsdt; fadt->x_dsdt_h = 0; fadt->x_pm1a_evt_blk.space_id = ACPI_ADDRESS_SPACE_IO; @@ -137,7 +141,10 @@ void acpi_create_fadt(struct acpi_fadt *fadt, struct acpi_facs *facs, fadt->x_gpe1_blk.addrh = 0x0; header->checksum = table_compute_checksum(fadt, header->length); + + return acpi_add_fadt(ctx, fadt); } +ACPI_WRITER(5fadt, "FADT", baytrail_write_fadt, 0); int acpi_create_gnvs(struct acpi_global_nvs *gnvs) { diff --git a/arch/x86/cpu/baytrail/cpu.c b/arch/x86/cpu/baytrail/cpu.c index 4a7b4f6..c270426 100644 --- a/arch/x86/cpu/baytrail/cpu.c +++ b/arch/x86/cpu/baytrail/cpu.c @@ -45,7 +45,7 @@ static void hsuart_clock_set(void *base) * Configure the internal clock of both SIO HS-UARTs, if they are enabled * via FSP */ -static int baytrail_uart_init(void *ctx, struct event *event) +static int baytrail_uart_init(void) { struct udevice *dev; void *base; @@ -64,7 +64,7 @@ static int baytrail_uart_init(void *ctx, struct event *event) return 0; } -EVENT_SPY(EVT_DM_POST_INIT_F, baytrail_uart_init); +EVENT_SPY_SIMPLE(EVT_DM_POST_INIT_F, baytrail_uart_init); static void set_max_freq(void) { diff --git a/arch/x86/cpu/broadwell/cpu.c b/arch/x86/cpu/broadwell/cpu.c index f30aebf..cbd4a3b 100644 --- a/arch/x86/cpu/broadwell/cpu.c +++ b/arch/x86/cpu/broadwell/cpu.c @@ -11,6 +11,7 @@ #include <event.h> #include <init.h> #include <log.h> +#include <spl.h> #include <asm/cpu.h> #include <asm/cpu_x86.h> #include <asm/cpu_common.h> @@ -25,7 +26,7 @@ #include <asm/arch/pch.h> #include <asm/arch/rcb.h> -static int broadwell_init_cpu(void *ctx, struct event *event) +static int broadwell_init_cpu(void) { struct udevice *dev; int ret; @@ -40,7 +41,7 @@ static int broadwell_init_cpu(void *ctx, struct event *event) return 0; } -EVENT_SPY(EVT_DM_POST_INIT_F, broadwell_init_cpu); +EVENT_SPY_SIMPLE(EVT_DM_POST_INIT_F, broadwell_init_cpu); void set_max_freq(void) { @@ -67,12 +68,11 @@ int arch_cpu_init(void) { post_code(POST_CPU_INIT); -#ifdef CONFIG_TPL /* Do a mini-init if TPL has already done the full init */ - return x86_cpu_reinit_f(); -#else - return x86_cpu_init_f(); -#endif + if (IS_ENABLED(CONFIG_TPL) && spl_phase() != PHASE_TPL) + return x86_cpu_reinit_f(); + else + return x86_cpu_init_f(); } int checkcpu(void) diff --git a/arch/x86/cpu/broadwell/sdram.c b/arch/x86/cpu/broadwell/sdram.c index f477d51..d30ebee 100644 --- a/arch/x86/cpu/broadwell/sdram.c +++ b/arch/x86/cpu/broadwell/sdram.c @@ -5,6 +5,8 @@ * From coreboot src/soc/intel/broadwell/romstage/raminit.c */ +#define LOG_CATEGORY UCLASS_RAM + #include <common.h> #include <dm.h> #include <init.h> diff --git a/arch/x86/cpu/coreboot/Kconfig b/arch/x86/cpu/coreboot/Kconfig index b97c277..178f8ad 100644 --- a/arch/x86/cpu/coreboot/Kconfig +++ b/arch/x86/cpu/coreboot/Kconfig @@ -25,6 +25,7 @@ config SYS_COREBOOT imply FS_CBFS imply CBMEM_CONSOLE imply X86_TSC_READ_BASE + imply USE_PREBOOT select BINMAN if X86_64 endif diff --git a/arch/x86/cpu/coreboot/coreboot.c b/arch/x86/cpu/coreboot/coreboot.c index d7eedbd..82fe4c7 100644 --- a/arch/x86/cpu/coreboot/coreboot.c +++ b/arch/x86/cpu/coreboot/coreboot.c @@ -7,6 +7,7 @@ #include <common.h> #include <cpu_func.h> +#include <event.h> #include <fdtdec.h> #include <init.h> #include <usb.h> @@ -20,7 +21,14 @@ int arch_cpu_init(void) { - int ret = get_coreboot_info(&lib_sysinfo); + int ret; + + ret = IS_ENABLED(CONFIG_X86_RUN_64BIT) ? x86_cpu_reinit_f() : + x86_cpu_init_f(); + if (ret) + return ret; + + ret = get_coreboot_info(&lib_sysinfo); if (ret != 0) { printf("Failed to parse coreboot tables.\n"); return ret; @@ -28,8 +36,7 @@ int arch_cpu_init(void) timestamp_init(); - return IS_ENABLED(CONFIG_X86_RUN_64BIT) ? x86_cpu_reinit_f() : - x86_cpu_init_f(); + return 0; } int checkcpu(void) @@ -74,13 +81,13 @@ static void board_final_init(void) } } -int last_stage_init(void) +static int last_stage_init(void) { - /* start usb so that usb keyboard can be used as input device */ - if (IS_ENABLED(CONFIG_USB_KEYBOARD)) - usb_init(); + if (IS_ENABLED(CONFIG_SPL_BUILD)) + return 0; board_final_init(); return 0; } +EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, last_stage_init); diff --git a/arch/x86/cpu/cpu.c b/arch/x86/cpu/cpu.c index dddd281..ce55efc 100644 --- a/arch/x86/cpu/cpu.c +++ b/arch/x86/cpu/cpu.c @@ -26,6 +26,7 @@ #include <cpu_func.h> #include <dm.h> #include <errno.h> +#include <event.h> #include <init.h> #include <irq.h> #include <log.h> @@ -185,7 +186,8 @@ void show_boot_progress(int val) } #endif -#if !defined(CONFIG_SYS_COREBOOT) && !defined(CONFIG_EFI_STUB) +#if !defined(CONFIG_SYS_COREBOOT) && !defined(CONFIG_EFI_STUB) && \ + !defined(CONFIG_SPL_BUILD) /* * Implement a weak default function for boards that need to do some final init * before the system is ready. @@ -202,7 +204,7 @@ __weak void board_final_cleanup(void) { } -int last_stage_init(void) +static int last_stage_init(void) { struct acpi_fadt __maybe_unused *fadt; int ret; @@ -245,7 +247,9 @@ int last_stage_init(void) return 0; } -#endif +EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, last_stage_init); + +#endif /* !SYS_COREBOOT && !EFI_STUB && !SPL_BUILD */ static int x86_init_cpus(void) { diff --git a/arch/x86/cpu/efi/payload.c b/arch/x86/cpu/efi/payload.c index d8920ef..708bfbe 100644 --- a/arch/x86/cpu/efi/payload.c +++ b/arch/x86/cpu/efi/payload.c @@ -9,6 +9,7 @@ #include <efi.h> #include <efi_api.h> #include <errno.h> +#include <event.h> #include <init.h> #include <log.h> #include <usb.h> @@ -168,7 +169,7 @@ int reserve_arch(void) return 0; } -int last_stage_init(void) +static int last_stage_init(void) { /* start usb so that usb keyboard can be used as input device */ if (IS_ENABLED(CONFIG_USB_KEYBOARD)) @@ -176,6 +177,7 @@ int last_stage_init(void) return 0; } +EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, last_stage_init); unsigned int install_e820_map(unsigned int max_entries, struct e820_entry *entries) diff --git a/arch/x86/cpu/i386/cpu.c b/arch/x86/cpu/i386/cpu.c index 91cd5d7..8882532 100644 --- a/arch/x86/cpu/i386/cpu.c +++ b/arch/x86/cpu/i386/cpu.c @@ -415,7 +415,7 @@ int cpu_phys_address_size(void) /* Don't allow PCI region 3 to use memory in the 2-4GB memory hole */ static void setup_pci_ram_top(void) { - gd->pci_ram_top = 0x80000000U; + gd_set_pci_ram_top(0x80000000U); } static void setup_mtrr(void) diff --git a/arch/x86/cpu/intel_common/mrc.c b/arch/x86/cpu/intel_common/mrc.c index 56cc253..ff959d1 100644 --- a/arch/x86/cpu/intel_common/mrc.c +++ b/arch/x86/cpu/intel_common/mrc.c @@ -9,6 +9,7 @@ #include <dm.h> #include <init.h> #include <log.h> +#include <spl.h> #include <syscon.h> #include <asm/cpu.h> #include <asm/global_data.h> @@ -251,13 +252,28 @@ static int sdram_initialise(struct udevice *dev, struct udevice *me_dev, int mrc_common_init(struct udevice *dev, void *pei_data, bool use_asm_linkage) { struct udevice *me_dev; - int ret; + int ret, delay; ret = syscon_get_by_driver_data(X86_SYSCON_ME, &me_dev); if (ret) return ret; + delay = dev_read_u32_default(dev, "fspm,training-delay", 0); + if (spl_phase() == PHASE_SPL) { + if (delay) + printf("SDRAM training (%d seconds)...", delay); + else + log_debug("SDRAM init..."); + } else { + if (delay) + printf("(%d seconds)...", delay); + } + ret = sdram_initialise(dev, me_dev, pei_data, use_asm_linkage); + if (delay) + printf("done\n"); + else + log_debug("done\n"); if (ret) return ret; quick_ram_check(); diff --git a/arch/x86/cpu/ivybridge/cpu.c b/arch/x86/cpu/ivybridge/cpu.c index c988d7f..e71a10b 100644 --- a/arch/x86/cpu/ivybridge/cpu.c +++ b/arch/x86/cpu/ivybridge/cpu.c @@ -54,7 +54,7 @@ int arch_cpu_init(void) return x86_cpu_init_f(); } -static int ivybridge_cpu_init(void *ctx, struct event *ev) +static int ivybridge_cpu_init(void) { struct pci_controller *hose; struct udevice *bus, *dev; @@ -86,7 +86,7 @@ static int ivybridge_cpu_init(void *ctx, struct event *ev) return 0; } -EVENT_SPY(EVT_DM_POST_INIT_F, ivybridge_cpu_init); +EVENT_SPY_SIMPLE(EVT_DM_POST_INIT_F, ivybridge_cpu_init); #define PCH_EHCI0_TEMP_BAR0 0xe8000000 #define PCH_EHCI1_TEMP_BAR0 0xe8000400 diff --git a/arch/x86/cpu/quark/acpi.c b/arch/x86/cpu/quark/acpi.c index 82b776f..9a2d682 100644 --- a/arch/x86/cpu/quark/acpi.c +++ b/arch/x86/cpu/quark/acpi.c @@ -10,20 +10,24 @@ #include <asm/arch/global_nvs.h> #include <asm/arch/iomap.h> -void acpi_create_fadt(struct acpi_fadt *fadt, struct acpi_facs *facs, - void *dsdt) +static int quark_write_fadt(struct acpi_ctx *ctx, + const struct acpi_writer *entry) { - struct acpi_table_header *header = &(fadt->header); u16 pmbase = ACPI_PM1_BASE_ADDRESS; + struct acpi_table_header *header; + struct acpi_fadt *fadt; - memset((void *)fadt, 0, sizeof(struct acpi_fadt)); + fadt = ctx->current; + header = &fadt->header; + + memset(fadt, '\0', sizeof(struct acpi_fadt)); acpi_fill_header(header, "FACP"); header->length = sizeof(struct acpi_fadt); header->revision = 4; - fadt->firmware_ctrl = (u32)facs; - fadt->dsdt = (u32)dsdt; + fadt->firmware_ctrl = (u32)ctx->facs; + fadt->dsdt = (u32)ctx->dsdt; fadt->preferred_pm_profile = ACPI_PM_UNSPECIFIED; fadt->sci_int = 9; fadt->smi_cmd = 0; @@ -70,9 +74,9 @@ void acpi_create_fadt(struct acpi_fadt *fadt, struct acpi_facs *facs, fadt->reset_reg.addrh = 0; fadt->reset_value = SYS_RST | RST_CPU | FULL_RST; - fadt->x_firmware_ctl_l = (u32)facs; + fadt->x_firmware_ctl_l = (u32)ctx->facs; fadt->x_firmware_ctl_h = 0; - fadt->x_dsdt_l = (u32)dsdt; + fadt->x_dsdt_l = (u32)ctx->dsdt; fadt->x_dsdt_h = 0; fadt->x_pm1a_evt_blk.space_id = ACPI_ADDRESS_SPACE_IO; @@ -132,7 +136,10 @@ void acpi_create_fadt(struct acpi_fadt *fadt, struct acpi_facs *facs, fadt->x_gpe1_blk.addrh = 0x0; header->checksum = table_compute_checksum(fadt, header->length); + + return acpi_add_fadt(ctx, fadt); } +ACPI_WRITER(5fadt, "FADT", quark_write_fadt, 0); int acpi_create_gnvs(struct acpi_global_nvs *gnvs) { diff --git a/arch/x86/cpu/quark/quark.c b/arch/x86/cpu/quark/quark.c index 1be8e38..62b83c2 100644 --- a/arch/x86/cpu/quark/quark.c +++ b/arch/x86/cpu/quark/quark.c @@ -107,7 +107,7 @@ static void quark_setup_bars(void) CONFIG_PCIE_ECAM_BASE | MEM_BAR_EN); } -static void quark_pcie_early_init(void) +static int quark_pcie_early_init(void) { /* * Step1: Assert PCIe signal PERST# @@ -146,6 +146,8 @@ static void quark_pcie_early_init(void) /* Mixer Load Lane 1 */ msg_port_io_clrbits(MSG_PORT_PCIE_AFE, PCIE_RXPICTRL0_L1, (1 << 6) | (1 << 7)); + + return 0; } static void quark_usb_early_init(void) @@ -248,22 +250,16 @@ int arch_cpu_init(void) return 0; } -static int quark_init_pcie(void *ctx, struct event *event) -{ - /* - * Initialize PCIe controller - * - * Quark SoC holds the PCIe controller in reset following a power on. - * U-Boot needs to release the PCIe controller from reset. The PCIe - * controller (D23:F0/F1) will not be visible in PCI configuration - * space and any access to its PCI configuration registers will cause - * system hang while it is held in reset. - */ - quark_pcie_early_init(); - - return 0; -} -EVENT_SPY(EVT_DM_POST_INIT_F, quark_init_pcie); +/* + * Initialize PCIe controller + * + * Quark SoC holds the PCIe controller in reset following a power on. + * U-Boot needs to release the PCIe controller from reset. The PCIe + * controller (D23:F0/F1) will not be visible in PCI configuration + * space and any access to its PCI configuration registers will cause + * system hang while it is held in reset. + */ +EVENT_SPY_SIMPLE(EVT_DM_POST_INIT_F, quark_pcie_early_init); int checkcpu(void) { diff --git a/arch/x86/cpu/tangier/acpi.c b/arch/x86/cpu/tangier/acpi.c index 3ffba38..1c667c7 100644 --- a/arch/x86/cpu/tangier/acpi.c +++ b/arch/x86/cpu/tangier/acpi.c @@ -16,19 +16,23 @@ #include <asm/arch/iomap.h> #include <dm/uclass-internal.h> -void acpi_create_fadt(struct acpi_fadt *fadt, struct acpi_facs *facs, - void *dsdt) +static int tangier_write_fadt(struct acpi_ctx *ctx, + const struct acpi_writer *entry) { - struct acpi_table_header *header = &(fadt->header); + struct acpi_table_header *header; + struct acpi_fadt *fadt; - memset((void *)fadt, 0, sizeof(struct acpi_fadt)); + fadt = ctx->current; + header = &fadt->header; + + memset(fadt, '\0', sizeof(struct acpi_fadt)); acpi_fill_header(header, "FACP"); header->length = sizeof(struct acpi_fadt); header->revision = 6; - fadt->firmware_ctrl = (u32)facs; - fadt->dsdt = (u32)dsdt; + fadt->firmware_ctrl = (u32)ctx->facs; + fadt->dsdt = (u32)ctx->dsdt; fadt->preferred_pm_profile = ACPI_PM_UNSPECIFIED; fadt->iapc_boot_arch = ACPI_FADT_VGA_NOT_PRESENT | @@ -41,13 +45,16 @@ void acpi_create_fadt(struct acpi_fadt *fadt, struct acpi_facs *facs, fadt->minor_revision = 2; - fadt->x_firmware_ctl_l = (u32)facs; + fadt->x_firmware_ctl_l = (u32)ctx->facs; fadt->x_firmware_ctl_h = 0; - fadt->x_dsdt_l = (u32)dsdt; + fadt->x_dsdt_l = (u32)ctx->dsdt; fadt->x_dsdt_h = 0; header->checksum = table_compute_checksum(fadt, header->length); + + return acpi_add_fadt(ctx, fadt); } +ACPI_WRITER(5fadt, "FADT", tangier_write_fadt, 0); u32 acpi_fill_madt(u32 current) { diff --git a/arch/x86/cpu/tangier/pinmux.c b/arch/x86/cpu/tangier/pinmux.c index 7b2c35f..23bfa7c 100644 --- a/arch/x86/cpu/tangier/pinmux.c +++ b/arch/x86/cpu/tangier/pinmux.c @@ -13,6 +13,7 @@ #include <asm/cpu.h> #include <asm/scu.h> #include <linux/io.h> +#include <linux/printk.h> #define BUFCFG_OFFSET 0x100 diff --git a/arch/x86/cpu/tangier/sdram.c b/arch/x86/cpu/tangier/sdram.c index ee74a1f..374b262 100644 --- a/arch/x86/cpu/tangier/sdram.c +++ b/arch/x86/cpu/tangier/sdram.c @@ -9,6 +9,7 @@ #include <asm/e820.h> #include <asm/global_data.h> #include <asm/sfi.h> +#include <linux/printk.h> DECLARE_GLOBAL_DATA_PTR; diff --git a/arch/x86/cpu/x86_64/cpu.c b/arch/x86/cpu/x86_64/cpu.c index d1c3873..2647bff 100644 --- a/arch/x86/cpu/x86_64/cpu.c +++ b/arch/x86/cpu/x86_64/cpu.c @@ -8,8 +8,11 @@ #include <cpu_func.h> #include <debug_uart.h> #include <init.h> +#include <asm/cpu.h> #include <asm/global_data.h> +DECLARE_GLOBAL_DATA_PTR; + int cpu_has_64bit(void) { return true; @@ -38,6 +41,10 @@ int x86_mp_init(void) int x86_cpu_reinit_f(void) { + /* set the vendor to Intel so that native_calibrate_tsc() works */ + gd->arch.x86_vendor = X86_VENDOR_INTEL; + gd->arch.has_mtrr = true; + return 0; } diff --git a/arch/x86/dts/chromebook_samus.dts b/arch/x86/dts/chromebook_samus.dts index 96705ce..ddff277 100644 --- a/arch/x86/dts/chromebook_samus.dts +++ b/arch/x86/dts/chromebook_samus.dts @@ -266,6 +266,7 @@ board-id-gpios = <&gpio_c 5 0>, <&gpio_c 4 0>, <&gpio_c 3 0>, <&gpio_c 1 0>; bootph-all; + fspm,training-delay = <7>; spd { #address-cells = <1>; #size-cells = <0>; diff --git a/arch/x86/dts/coreboot.dts b/arch/x86/dts/coreboot.dts index f9ff534..0eb31ca 100644 --- a/arch/x86/dts/coreboot.dts +++ b/arch/x86/dts/coreboot.dts @@ -42,6 +42,7 @@ }; coreboot-fb { + bootph-some-ram; compatible = "coreboot-fb"; }; }; diff --git a/arch/x86/include/asm/acpi_table.h b/arch/x86/include/asm/acpi_table.h index 72e1873..226753b 100644 --- a/arch/x86/include/asm/acpi_table.h +++ b/arch/x86/include/asm/acpi_table.h @@ -24,8 +24,6 @@ struct acpi_table_header; /* These can be used by the target port */ -void acpi_create_fadt(struct acpi_fadt *fadt, struct acpi_facs *facs, - void *dsdt); int acpi_create_madt_lapics(u32 current); int acpi_create_madt_ioapic(struct acpi_madt_ioapic *ioapic, u8 id, u32 addr, u32 gsi_base); diff --git a/arch/x86/include/asm/coreboot_tables.h b/arch/x86/include/asm/coreboot_tables.h index 4de137f..0dfb64b 100644 --- a/arch/x86/include/asm/coreboot_tables.h +++ b/arch/x86/include/asm/coreboot_tables.h @@ -299,11 +299,24 @@ struct cb_vdat { #define CB_TAG_TIMESTAMPS 0x0016 #define CB_TAG_CBMEM_CONSOLE 0x0017 +#define CBMC_CURSOR_MASK ((1 << 28) - 1) +#define CBMC_OVERFLOW BIT(31) + +/* + * struct cbmem_console - In-memory console buffer for coreboot + * + * Structure describing console buffer. It is overlaid on a flat memory area, + * with body covering the extent of the memory. Once the buffer is full, + * output will wrap back around to the start of the buffer. The high bit of the + * cursor field gets set to indicate that this happened. If the underlying + * storage allows this, the buffer will persist across multiple boots and append + * to the previous log. + */ struct cbmem_console { u32 size; u32 cursor; - char body[0]; -} __packed; + u8 body[0]; +}; #define CB_TAG_MRC_CACHE 0x0018 diff --git a/arch/x86/include/asm/global_data.h b/arch/x86/include/asm/global_data.h index ea58259..6f4a713 100644 --- a/arch/x86/include/asm/global_data.h +++ b/arch/x86/include/asm/global_data.h @@ -127,6 +127,7 @@ struct arch_global_data { ulong table_end; /* End address of x86 tables */ ulong table_start_high; /* Start address of high x86 tables */ ulong table_end_high; /* End address of high x86 tables */ + ulong smbios_start; /* Start address of SMBIOS table */ }; #endif diff --git a/arch/x86/include/asm/sections.h b/arch/x86/include/asm/sections.h index a6be360..874a43d 100644 --- a/arch/x86/include/asm/sections.h +++ b/arch/x86/include/asm/sections.h @@ -8,4 +8,6 @@ #include <asm-generic/sections.h> +extern char __data_end[]; + #endif diff --git a/arch/x86/include/asm/zimage.h b/arch/x86/include/asm/zimage.h index 9ad74dc..655675b 100644 --- a/arch/x86/include/asm/zimage.h +++ b/arch/x86/include/asm/zimage.h @@ -62,41 +62,4 @@ struct boot_params *load_zimage(char *image, unsigned long kernel_size, int setup_zimage(struct boot_params *setup_base, char *cmd_line, int auto_boot, ulong initrd_addr, ulong initrd_size, ulong cmdline_force); -/** - * zimage_dump() - Dump the metadata of a zimage - * - * This shows all available information in a zimage that has been loaded. - * - * @base_ptr: Pointer to the boot parameters, typically at address - * DEFAULT_SETUP_BASE - */ -void zimage_dump(struct boot_params *base_ptr); - -/** - * zboot_start() - Boot a zimage - * - * Boot a zimage, given the component parts - * - * @addr: Address where the bzImage is moved before booting, either - * BZIMAGE_LOAD_ADDR or ZIMAGE_LOAD_ADDR - * @base: Pointer to the boot parameters, typically at address - * DEFAULT_SETUP_BASE - * @initrd: Address of the initial ramdisk, or 0 if none - * @initrd_size: Size of the initial ramdisk, or 0 if none - * @cmdline: Command line to use for booting - * Return: -EFAULT on error (normally it does not return) - */ -int zboot_start(ulong addr, ulong size, ulong initrd, ulong initrd_size, - ulong base, char *cmdline); - -/* - * zimage_get_kernel_version() - Get the version string from a kernel - * - * @params: boot_params pointer - * @kernel_base: base address of kernel - * Return: Kernel version as a NUL-terminated string - */ -const char *zimage_get_kernel_version(struct boot_params *params, - void *kernel_base); - #endif diff --git a/arch/x86/lib/acpi_table.c b/arch/x86/lib/acpi_table.c index e3b7e9a..c5b33dc 100644 --- a/arch/x86/lib/acpi_table.c +++ b/arch/x86/lib/acpi_table.c @@ -458,21 +458,6 @@ int acpi_write_gnvs(struct acpi_ctx *ctx, const struct acpi_writer *entry) } ACPI_WRITER(4gnvs, "GNVS", acpi_write_gnvs, 0); -static int acpi_write_fadt(struct acpi_ctx *ctx, - const struct acpi_writer *entry) -{ - struct acpi_fadt *fadt; - - fadt = ctx->current; - acpi_create_fadt(fadt, ctx->facs, ctx->dsdt); - acpi_add_table(ctx, fadt); - - acpi_inc(ctx, sizeof(struct acpi_fadt)); - - return 0; -} -ACPI_WRITER(5fact, "FADT", acpi_write_fadt, 0); - /** * acpi_write_hpet() - Write out a HPET table * diff --git a/arch/x86/lib/coreboot/cb_sysinfo.c b/arch/x86/lib/coreboot/cb_sysinfo.c index dfbc80c..f7fd9ea 100644 --- a/arch/x86/lib/coreboot/cb_sysinfo.c +++ b/arch/x86/lib/coreboot/cb_sysinfo.c @@ -471,6 +471,7 @@ int get_coreboot_info(struct sysinfo_t *info) return -ENOENT; gd->arch.coreboot_table = addr; gd_set_acpi_start(map_to_sysmem(info->rsdp)); + gd_set_smbios_start(info->smbios_start); gd->flags |= GD_FLG_SKIP_LL_INIT; return 0; diff --git a/arch/x86/lib/fsp1/fsp_common.c b/arch/x86/lib/fsp1/fsp_common.c index 2092617..df18f47 100644 --- a/arch/x86/lib/fsp1/fsp_common.c +++ b/arch/x86/lib/fsp1/fsp_common.c @@ -101,3 +101,4 @@ int arch_fsp_init(void) return 0; } +EVENT_SPY_SIMPLE(EVT_FSP_INIT_F, arch_fsp_init); diff --git a/arch/x86/lib/fsp2/fsp_common.c b/arch/x86/lib/fsp2/fsp_common.c index 20c3f64..d802a86 100644 --- a/arch/x86/lib/fsp2/fsp_common.c +++ b/arch/x86/lib/fsp2/fsp_common.c @@ -8,11 +8,6 @@ #include <init.h> #include <asm/fsp/fsp_support.h> -int arch_fsp_init(void) -{ - return 0; -} - void board_final_cleanup(void) { u32 status; diff --git a/arch/x86/lib/fsp2/fsp_init.c b/arch/x86/lib/fsp2/fsp_init.c index afec7d0..aadc08c 100644 --- a/arch/x86/lib/fsp2/fsp_init.c +++ b/arch/x86/lib/fsp2/fsp_init.c @@ -19,7 +19,7 @@ #include <dm/uclass-internal.h> #include <asm/fsp2/fsp_internal.h> -int fsp_setup_pinctrl(void *ctx, struct event *event) +int fsp_setup_pinctrl(void) { struct udevice *dev; ofnode node; @@ -42,7 +42,7 @@ int fsp_setup_pinctrl(void *ctx, struct event *event) return ret; } -EVENT_SPY(EVT_DM_POST_INIT_F, fsp_setup_pinctrl); +EVENT_SPY_SIMPLE(EVT_DM_POST_INIT_F, fsp_setup_pinctrl); #if !defined(CONFIG_TPL_BUILD) binman_sym_declare(ulong, intel_fsp_m, image_pos); diff --git a/arch/x86/lib/init_helpers.c b/arch/x86/lib/init_helpers.c index 60a2707..bf0c921 100644 --- a/arch/x86/lib/init_helpers.c +++ b/arch/x86/lib/init_helpers.c @@ -15,7 +15,8 @@ DECLARE_GLOBAL_DATA_PTR; int init_cache_f_r(void) { bool do_mtrr = CONFIG_IS_ENABLED(X86_32BIT_INIT) || - IS_ENABLED(CONFIG_FSP_VERSION2); + IS_ENABLED(CONFIG_FSP_VERSION2) || + (IS_ENABLED(CONFIG_TPL) && IS_ENABLED(CONFIG_HAVE_MRC)); int ret; /* @@ -23,11 +24,9 @@ int init_cache_f_r(void) * * booting from slimbootloader - MTRRs are already set up * booting with FSPv1 - MTRRs are already set up - * booting with FSPv2 - MTRRs must be set here + * booting with FSPv2 or MRC - MTRRs must be set here * booting from coreboot - in this case there is no SPL, so we set up * the MTRRs here - * Note: if there is an SPL, then it has already set up MTRRs so we - * don't need to do that here */ do_mtrr &= !IS_ENABLED(CONFIG_FSP_VERSION1) && !IS_ENABLED(CONFIG_SYS_SLIMBOOTLOADER); diff --git a/arch/x86/lib/relocate.c b/arch/x86/lib/relocate.c index 5b1b420..da819b9 100644 --- a/arch/x86/lib/relocate.c +++ b/arch/x86/lib/relocate.c @@ -26,11 +26,11 @@ DECLARE_GLOBAL_DATA_PTR; int copy_uboot_to_ram(void) { - size_t len = (uintptr_t)&__data_end - (uintptr_t)&__text_start; + size_t len = (uintptr_t)__data_end - (uintptr_t)__text_start; if (gd->flags & GD_FLG_SKIP_RELOC) return 0; - memcpy((void *)gd->relocaddr, (void *)&__text_start, len); + memcpy((void *)gd->relocaddr, (void *)__text_start, len); return 0; } @@ -38,8 +38,8 @@ int copy_uboot_to_ram(void) #ifndef CONFIG_EFI_APP int clear_bss(void) { - ulong dst_addr = (ulong)&__bss_start + gd->reloc_off; - size_t len = (uintptr_t)&__bss_end - (uintptr_t)&__bss_start; + ulong dst_addr = (ulong)__bss_start + gd->reloc_off; + size_t len = (uintptr_t)__bss_end - (uintptr_t)__bss_start; if (gd->flags & GD_FLG_SKIP_RELOC) return 0; @@ -150,12 +150,12 @@ static void do_elf_reloc_fixups32(unsigned int text_base, uintptr_t size, */ int do_elf_reloc_fixups(void) { - void *re_src = (void *)(&__rel_dyn_start); - void *re_end = (void *)(&__rel_dyn_end); + void *re_src = (void *)__rel_dyn_start; + void *re_end = (void *)__rel_dyn_end; uint text_base; /* The size of the region of u-boot that runs out of RAM. */ - uintptr_t size = (uintptr_t)&__bss_end - (uintptr_t)&__text_start; + uintptr_t size = (uintptr_t)__bss_end - (uintptr_t)__text_start; if (gd->flags & GD_FLG_SKIP_RELOC) return 0; diff --git a/arch/x86/lib/spl.c b/arch/x86/lib/spl.c index f99df08..c15f11f 100644 --- a/arch/x86/lib/spl.c +++ b/arch/x86/lib/spl.c @@ -138,9 +138,9 @@ static int x86_spl_init(void) } #ifndef CONFIG_SYS_COREBOOT - debug("BSS clear from %lx to %lx len %lx\n", (ulong)&__bss_start, - (ulong)&__bss_end, (ulong)&__bss_end - (ulong)&__bss_start); - memset(&__bss_start, 0, (ulong)&__bss_end - (ulong)&__bss_start); + debug("BSS clear from %lx to %lx len %lx\n", (ulong)__bss_start, + (ulong)__bss_end, (ulong)__bss_end - (ulong)__bss_start); + memset(__bss_start, 0, (ulong)__bss_end - (ulong)__bss_start); # ifndef CONFIG_TPL /* TODO(sjg@chromium.org): Consider calling cpu_init_r() here */ @@ -230,6 +230,9 @@ void board_init_f_r(void) mtrr_commit(false); init_cache(); gd->flags &= ~GD_FLG_SERIAL_READY; + + /* make sure driver model is not accessed from now on */ + gd->flags |= GD_FLG_DM_DEAD; debug("cache status %d\n", dcache_status()); board_init_r(gd, 0); } @@ -258,7 +261,7 @@ static int spl_board_load_image(struct spl_image_info *spl_image, spl_image->os = IH_OS_U_BOOT; spl_image->name = "U-Boot"; - if (!IS_ENABLED(CONFIG_SYS_COREBOOT)) { + if (spl_image->load_addr != spl_get_image_pos()) { /* Copy U-Boot from ROM */ memcpy((void *)spl_image->load_addr, (void *)spl_get_image_pos(), spl_get_image_size()); diff --git a/arch/x86/lib/tables.c b/arch/x86/lib/tables.c index 67bc0a7..5b5070f 100644 --- a/arch/x86/lib/tables.c +++ b/arch/x86/lib/tables.c @@ -97,6 +97,9 @@ int write_tables(void) int size = table->size ? : CONFIG_ROM_TABLE_SIZE; u32 rom_table_end; + if (!strcmp("smbios", table->name)) + gd->arch.smbios_start = rom_addr; + if (IS_ENABLED(CONFIG_BLOBLIST_TABLES) && table->tag) { if (!gd->arch.table_end) gd->arch.table_end = rom_addr; diff --git a/arch/x86/lib/tpl.c b/arch/x86/lib/tpl.c index 18b05b2..273e9c8 100644 --- a/arch/x86/lib/tpl.c +++ b/arch/x86/lib/tpl.c @@ -3,6 +3,8 @@ * Copyright (c) 2018 Google, Inc */ +#define LOG_CATEGORY LOGC_BOOT + #include <common.h> #include <debug_uart.h> #include <dm.h> diff --git a/arch/x86/lib/zimage.c b/arch/x86/lib/zimage.c index 062e3d3..a41e1cc 100644 --- a/arch/x86/lib/zimage.c +++ b/arch/x86/lib/zimage.c @@ -692,7 +692,7 @@ static void show_loader(struct setup_header *hdr) printf("\n"); } -void zimage_dump(struct boot_params *base_ptr) +void zimage_dump(struct boot_params *base_ptr, bool show_cmdline) { struct setup_header *hdr; const char *version; @@ -703,7 +703,7 @@ void zimage_dump(struct boot_params *base_ptr) printf("E820: %d entries\n", base_ptr->e820_entries); if (base_ptr->e820_entries) { - printf("%18s %16s %s\n", "Addr", "Size", "Type"); + printf("%12s %10s %s\n", "Addr", "Size", "Type"); for (i = 0; i < base_ptr->e820_entries; i++) { struct e820_entry *entry = &base_ptr->e820_map[i]; @@ -749,7 +749,7 @@ void zimage_dump(struct boot_params *base_ptr) print_num("Ext loader ver", hdr->ext_loader_ver); print_num("Ext loader type", hdr->ext_loader_type); print_num("Command line ptr", hdr->cmd_line_ptr); - if (hdr->cmd_line_ptr) { + if (show_cmdline && hdr->cmd_line_ptr) { printf(" "); /* Use puts() to avoid limits from CONFIG_SYS_PBSIZE */ puts((char *)(ulong)hdr->cmd_line_ptr); @@ -787,7 +787,7 @@ static int do_zboot_dump(struct cmd_tbl *cmdtp, int flag, int argc, printf("No zboot setup_base\n"); return CMD_RET_FAILURE; } - zimage_dump(base_ptr); + zimage_dump(base_ptr, true); return 0; } diff --git a/arch/xtensa/lib/relocate.c b/arch/xtensa/lib/relocate.c index 3dc8edc..a499590 100644 --- a/arch/xtensa/lib/relocate.c +++ b/arch/xtensa/lib/relocate.c @@ -9,8 +9,8 @@ int clear_bss(void) { - size_t len = (size_t)&__bss_end - (size_t)&__bss_start; + size_t len = (size_t)__bss_end - (size_t)__bss_start; - memset((void *)&__bss_start, 0x00, len); + memset((void *)__bss_start, 0x00, len); return 0; } diff --git a/board/CZ.NIC/turris_mox/turris_mox.c b/board/CZ.NIC/turris_mox/turris_mox.c index a52a032..370c266 100644 --- a/board/CZ.NIC/turris_mox/turris_mox.c +++ b/board/CZ.NIC/turris_mox/turris_mox.c @@ -15,6 +15,7 @@ #include <dm.h> #include <dm/of_extra.h> #include <env.h> +#include <event.h> #include <fdt_support.h> #include <init.h> #include <led.h> @@ -667,7 +668,7 @@ err: return NULL; } -int last_stage_init(void) +static int last_stage_init(void) { struct gpio_desc reset_gpio = {}; @@ -712,6 +713,7 @@ handle_reset_btn: return 0; } +EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, last_stage_init); #if defined(CONFIG_OF_BOARD_SETUP) diff --git a/board/Marvell/mvebu_armada-37xx/board.c b/board/Marvell/mvebu_armada-37xx/board.c index 3ab6e88..04124d8 100644 --- a/board/Marvell/mvebu_armada-37xx/board.c +++ b/board/Marvell/mvebu_armada-37xx/board.c @@ -8,6 +8,7 @@ #include <dm/device-internal.h> #include <env.h> #include <env_internal.h> +#include <event.h> #include <i2c.h> #include <init.h> #include <mmc.h> @@ -301,12 +302,13 @@ static int mii_multi_chip_mode_write(struct udevice *bus, int dev_smi_addr, } /* Bring-up board-specific network stuff */ -int last_stage_init(void) +static int last_stage_init(void) { struct udevice *bus; ofnode node; - if (!of_machine_is_compatible("globalscale,espressobin")) + if (!CONFIG_IS_ENABLED(DM_MDIO) || + !of_machine_is_compatible("globalscale,espressobin")) return 0; node = ofnode_by_compatible(ofnode_null(), "marvell,orion-mdio"); @@ -356,6 +358,8 @@ int last_stage_init(void) return 0; } +EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, last_stage_init); + #endif #ifdef CONFIG_OF_BOARD_SETUP diff --git a/board/Marvell/octeon_nic23/board.c b/board/Marvell/octeon_nic23/board.c index 08b1aa4..bc9332c 100644 --- a/board/Marvell/octeon_nic23/board.c +++ b/board/Marvell/octeon_nic23/board.c @@ -5,6 +5,7 @@ #include <cyclic.h> #include <dm.h> +#include <event.h> #include <ram.h> #include <time.h> #include <asm/gpio.h> @@ -364,7 +365,7 @@ int board_late_init(void) return 0; } -int last_stage_init(void) +static int last_stage_init(void) { struct gpio_desc gpio = {}; ofnode node; @@ -386,3 +387,4 @@ int last_stage_init(void) return 0; } +EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, last_stage_init); diff --git a/board/Marvell/octeontx2/board.c b/board/Marvell/octeontx2/board.c index e7899f4..974e9eb 100644 --- a/board/Marvell/octeontx2/board.c +++ b/board/Marvell/octeontx2/board.c @@ -12,6 +12,7 @@ #include <asm/global_data.h> #include <dm/uclass-internal.h> #include <env.h> +#include <event.h> #include <init.h> #include <malloc.h> #include <net.h> @@ -213,11 +214,12 @@ void board_acquire_flash_arb(bool acquire) } } -int last_stage_init(void) +static int last_stage_init(void) { (void)smc_flsf_fw_booted(); return 0; } +EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, last_stage_init); static int do_go_uboot(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) diff --git a/board/advantech/imx8qm_dmsse20_a1/spl.c b/board/advantech/imx8qm_dmsse20_a1/spl.c index f36caec..e8959ed 100644 --- a/board/advantech/imx8qm_dmsse20_a1/spl.c +++ b/board/advantech/imx8qm_dmsse20_a1/spl.c @@ -14,6 +14,7 @@ #include <firmware/imx/sci/sci.h> #include <asm/arch/imx8-pins.h> #include <asm/arch/iomux.h> +#include <asm/sections.h> #include <fsl_esdhc_imx.h> DECLARE_GLOBAL_DATA_PTR; diff --git a/board/advantech/imx8qm_rom7720_a1/spl.c b/board/advantech/imx8qm_rom7720_a1/spl.c index 922bb0b..d324001 100644 --- a/board/advantech/imx8qm_rom7720_a1/spl.c +++ b/board/advantech/imx8qm_rom7720_a1/spl.c @@ -17,6 +17,7 @@ #include <firmware/imx/sci/sci.h> #include <asm/arch/imx8-pins.h> #include <asm/arch/iomux.h> +#include <asm/sections.h> DECLARE_GLOBAL_DATA_PTR; diff --git a/board/amlogic/vim3/vim3.c b/board/amlogic/vim3/vim3.c index fcd60ab..8bdfb30 100644 --- a/board/amlogic/vim3/vim3.c +++ b/board/amlogic/vim3/vim3.c @@ -104,8 +104,8 @@ int meson_ft_board_setup(void *blob, struct bd_info *bd) } /* Update PHY names (mandatory to disable USB3.0) */ - len = strlcpy(data, "usb2-phy0", 32); - len += strlcpy(&data[len], "usb2-phy1", 32 - len); + len = strlcpy(data, "usb2-phy0", 32) + 1; + len += strlcpy(&data[len], "usb2-phy1", 32 - len) + 1; ret = fdt_setprop(blob, node, "phy-names", data, len); if (ret < 0) { printf("vim3: failed to update usb phy names property (%d)\n", ret); @@ -132,7 +132,7 @@ int meson_ft_board_setup(void *blob, struct bd_info *bd) } /* Enable PCIe */ - len = strlcpy(data, "okay", 32); + len = strlcpy(data, "okay", 32) + 1; ret = fdt_setprop(blob, node, "status", data, len); if (ret < 0) { printf("vim3: failed to enable pcie node (%d)\n", ret); diff --git a/board/aristainetos/aristainetos.c b/board/aristainetos/aristainetos.c index 4dcf3f3..17f37ba 100644 --- a/board/aristainetos/aristainetos.c +++ b/board/aristainetos/aristainetos.c @@ -27,6 +27,7 @@ #include <asm/arch/crm_regs.h> #include <asm/io.h> #include <asm/arch/sys_proto.h> +#include <asm/sections.h> #include <bmp_logo.h> #include <dm/root.h> #include <env.h> @@ -216,7 +217,6 @@ static void set_gpr_register(void) &iomuxc_regs->gpr[12]); } -extern char __bss_start[], __bss_end[]; int board_early_init_f(void) { select_ldb_di_clock_source(MXC_PLL5_CLK); diff --git a/board/atmel/sam9x60_curiosity/sam9x60_curiosity.c b/board/atmel/sam9x60_curiosity/sam9x60_curiosity.c index 0fe0de9..f53d359 100644 --- a/board/atmel/sam9x60_curiosity/sam9x60_curiosity.c +++ b/board/atmel/sam9x60_curiosity/sam9x60_curiosity.c @@ -9,6 +9,7 @@ #include <debug_uart.h> #include <fdtdec.h> #include <init.h> +#include <led.h> #include <asm/arch/at91_common.h> #include <asm/arch/at91_rstc.h> #include <asm/arch/at91_sfr.h> @@ -18,6 +19,7 @@ #include <asm/global_data.h> #include <asm/io.h> #include <asm/mach-types.h> +#include <dm/ofnode.h> extern void at91_pda_detect(void); @@ -27,9 +29,25 @@ void at91_prepare_cpu_var(void); static void board_leds_init(void) { +#if CONFIG_IS_ENABLED(LED) + const char *led_name; + struct udevice *dev; + int ret; + + led_name = ofnode_conf_read_str("u-boot,boot-led"); + if (!led_name) + return; + + ret = led_get_by_label(led_name, &dev); + if (ret) + return; + + led_set_state(dev, LEDST_ON); +#else at91_set_pio_output(AT91_PIO_PORTD, 17, 0); /* LED RED */ at91_set_pio_output(AT91_PIO_PORTD, 19, 0); /* LED GREEN */ at91_set_pio_output(AT91_PIO_PORTD, 21, 1); /* LED BLUE */ +#endif } int board_late_init(void) diff --git a/board/atmel/sama5d29_curiosity/Kconfig b/board/atmel/sama5d29_curiosity/Kconfig new file mode 100644 index 0000000..64ca237 --- /dev/null +++ b/board/atmel/sama5d29_curiosity/Kconfig @@ -0,0 +1,15 @@ +if TARGET_SAMA5D29_CURIOSITY + +config SYS_BOARD + default "sama5d29_curiosity" + +config SYS_VENDOR + default "atmel" + +config SYS_SOC + default "at91" + +config SYS_CONFIG_NAME + default "sama5d29_curiosity" + +endif diff --git a/board/atmel/sama5d29_curiosity/MAINTAINERS b/board/atmel/sama5d29_curiosity/MAINTAINERS new file mode 100644 index 0000000..54894d6 --- /dev/null +++ b/board/atmel/sama5d29_curiosity/MAINTAINERS @@ -0,0 +1,9 @@ +SAMA5D29 CURIOSITY BOARD +M: Mihai Sain <mihai.sain@microchip.com> +S: Maintained +F: board/atmel/sama5d29_curiosity.c +F: include/configs/sama5d29_curiosity.h +F: configs/sama5d29_curiosity_mmc_defconfig +F: configs/sama5d29_curiosity_mmc1_defconfig +F: configs/sama5d29_curiosity_qspiflash_defconfig +F: arch/arm/dts/at91-sama5d29_curiosity* diff --git a/board/atmel/sama5d29_curiosity/Makefile b/board/atmel/sama5d29_curiosity/Makefile new file mode 100644 index 0000000..848e1ce --- /dev/null +++ b/board/atmel/sama5d29_curiosity/Makefile @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# Copyright (C) 2023 Microchip Technology Inc. and its subsidiaries +# +# Author: Mihai Sain <mihai.sain@microchip.com> + +obj-y += sama5d29_curiosity.o diff --git a/board/atmel/sama5d29_curiosity/sama5d29_curiosity.c b/board/atmel/sama5d29_curiosity/sama5d29_curiosity.c new file mode 100644 index 0000000..d067931 --- /dev/null +++ b/board/atmel/sama5d29_curiosity/sama5d29_curiosity.c @@ -0,0 +1,86 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2023 Microchip Technology Inc. and its subsidiaries + * + * Author: Mihai Sain <mihai.sain@microchip.com> + * + */ + +#include <common.h> +#include <debug_uart.h> +#include <init.h> +#include <asm/global_data.h> +#include <asm/io.h> +#include <asm/arch/at91_common.h> +#include <asm/arch/atmel_pio4.h> +#include <asm/arch/atmel_sdhci.h> +#include <asm/arch/clk.h> +#include <asm/arch/gpio.h> +#include <asm/arch/sama5d2.h> + +extern void at91_pda_detect(void); + +DECLARE_GLOBAL_DATA_PTR; + +static void rgb_leds_init(void) +{ + atmel_pio4_set_pio_output(AT91_PIO_PORTA, 7, 0); /* LED RED */ + atmel_pio4_set_pio_output(AT91_PIO_PORTA, 8, 0); /* LED GREEN */ + atmel_pio4_set_pio_output(AT91_PIO_PORTA, 9, 1); /* LED BLUE */ +} + +static void board_usb_hw_init(void) +{ + atmel_pio4_set_pio_output(AT91_PIO_PORTA, 6, 1); +} + +int board_late_init(void) +{ + at91_video_show_board_info(); + + at91_pda_detect(); + + return 0; +} + +static void board_uart0_hw_init(void) +{ + atmel_pio4_set_c_periph(AT91_PIO_PORTB, 26, ATMEL_PIO_PUEN_MASK); /* URXD0 */ + atmel_pio4_set_c_periph(AT91_PIO_PORTB, 27, 0); /* UTXD0 */ + + at91_periph_clk_enable(ATMEL_ID_UART0); +} + +void board_debug_uart_init(void) +{ + board_uart0_hw_init(); +} + +int board_early_init_f(void) +{ + debug_uart_init(); + + return 0; +} + +int board_init(void) +{ + /* address of boot parameters */ + gd->bd->bi_boot_params = gd->bd->bi_dram[0].start + 0x100; + + rgb_leds_init(); + + board_usb_hw_init(); + + return 0; +} + +int dram_init_banksize(void) +{ + return fdtdec_setup_memory_banksize(); +} + +int dram_init(void) +{ + return fdtdec_setup_mem_size_base(); +} diff --git a/board/beacon/imx8mm/spl.c b/board/beacon/imx8mm/spl.c index b2830c5..1632238 100644 --- a/board/beacon/imx8mm/spl.c +++ b/board/beacon/imx8mm/spl.c @@ -14,6 +14,7 @@ #include <asm/arch/sys_proto.h> #include <asm/mach-imx/boot_mode.h> #include <asm/arch/ddr.h> +#include <asm/sections.h> #include <dm/uclass.h> #include <dm/device.h> diff --git a/board/beacon/imx8mn/spl.c b/board/beacon/imx8mn/spl.c index 9acd916..b4d46f1 100644 --- a/board/beacon/imx8mn/spl.c +++ b/board/beacon/imx8mn/spl.c @@ -20,6 +20,7 @@ #include <asm/mach-imx/iomux-v3.h> #include <asm/mach-imx/gpio.h> #include <asm/mach-imx/mxc_i2c.h> +#include <asm/sections.h> #include <fsl_esdhc_imx.h> #include <mmc.h> #include <linux/delay.h> diff --git a/board/bosch/acc/acc.c b/board/bosch/acc/acc.c index 7c49b20..34088ad 100644 --- a/board/bosch/acc/acc.c +++ b/board/bosch/acc/acc.c @@ -27,6 +27,7 @@ #include <asm/arch/mx6-pins.h> #include <asm/arch/sys_proto.h> #include <asm/mach-imx/iomux-v3.h> +#include <asm/sections.h> #include <usb.h> #include <usb/ehci-ci.h> #include <fuse.h> diff --git a/board/bsh/imx8mn_smm_s2/spl.c b/board/bsh/imx8mn_smm_s2/spl.c index ce0504a..5a77d28 100644 --- a/board/bsh/imx8mn_smm_s2/spl.c +++ b/board/bsh/imx8mn_smm_s2/spl.c @@ -13,6 +13,7 @@ #include <asm/arch/sys_proto.h> #include <asm/mach-imx/boot_mode.h> #include <asm/mach-imx/gpio.h> +#include <asm/sections.h> #include <dm/device.h> #include <dm/uclass.h> diff --git a/board/cloos/imx8mm_phg/spl.c b/board/cloos/imx8mm_phg/spl.c index e63904e..0c3a013 100644 --- a/board/cloos/imx8mm_phg/spl.c +++ b/board/cloos/imx8mm_phg/spl.c @@ -19,6 +19,7 @@ #include <asm/arch/sys_proto.h> #include <asm/mach-imx/boot_mode.h> #include <asm/arch/ddr.h> +#include <asm/sections.h> #include <dm/uclass.h> #include <dm/device.h> diff --git a/board/cobra5272/README b/board/cobra5272/README index 11abcfa..0b07148 100644 --- a/board/cobra5272/README +++ b/board/cobra5272/README @@ -1,6 +1,6 @@ File: README.COBRA5272 Author: Florian Schlote for Sentec elektronik (linux@sentec-elektronik.de) -Contents: This is the README of u-boot (Universal bootloader) for our +Contents: This is the README of U-Boot (Universal bootloader) for our COBRA5272 board. Version: v01.00 Date: Tue Mar 30 00:28:33 CEST 2004 @@ -31,7 +31,7 @@ Please refer to u-boot README (general info, u-boot-x-x-x/README), to u-boot-x-x-x/board/cobra5272/README and to the comments in u-boot-x-x-x/include/configs/cobra5272.h -Configuring u-boot is done by commenting/uncommenting preprocessor defines. +Configuring U-Boot is done by commenting/uncommenting preprocessor defines. Default configuration is @@ -48,10 +48,10 @@ Default configuration is #----------------------------------- -# u-boot FLASH version & RAM version +# U-Boot FLASH version & RAM version #----------------------------------- -The u-boot bootloader for Coldfire processors can be configured +The U-Boot bootloader for Coldfire processors can be configured 1. as a standalone bootloader residing in flash & relocating itself to RAM on startup automatically => "FLASH version" @@ -60,7 +60,7 @@ The u-boot bootloader for Coldfire processors can be configured prestage bootloader ("chainloading") & is running only from the RAM address it is linked to => "RAM version" - This version may be very helpful when installing u-boot for the first time + This version may be very helpful when installing U-Boot for the first time since it can be used to make available s. th. like a "bootstrap mechanism". @@ -71,7 +71,7 @@ How to build the different images: Flash version ------------------------------ -Compile u-boot +Compile U-Boot in dir ./u-boot-x-x-x/ @@ -81,14 +81,14 @@ please first check: CONFIG_MONITOR_IS_IN_RAM has to be not present in the file - => u-boot as single bootloader starting from flash + => U-Boot as single bootloader starting from flash in configs/cobra5272_defconfig CONFIG_TEXT_BASE should be CONFIG_TEXT_BASE=0xffe00000 - => linking address for u-boot as single bootloader stored in flash + => linking address for U-Boot as single bootloader stored in flash then: @@ -116,7 +116,7 @@ please modify the settings: CONFIG_MONITOR_IS_IN_RAM=y - => u-boot as RAM version, chainloaded by another bootloader or using bdm cable + => U-Boot as RAM version, chainloaded by another bootloader or using bdm cable in configs/cobra5272_defconfig CONFIG_TEXT_BASE should be diff --git a/board/compulab/cl-som-imx7/spl.c b/board/compulab/cl-som-imx7/spl.c index 5d4c4d3..98c3b83 100644 --- a/board/compulab/cl-som-imx7/spl.c +++ b/board/compulab/cl-som-imx7/spl.c @@ -16,6 +16,7 @@ #include <asm/arch-mx7/mx7-pins.h> #include <asm/arch-mx7/clock.h> #include <asm/arch-mx7/mx7-ddr.h> +#include <asm/sections.h> #include "common.h" #ifdef CONFIG_FSL_ESDHC_IMX diff --git a/board/compulab/imx8mm-cl-iot-gate/spl.c b/board/compulab/imx8mm-cl-iot-gate/spl.c index d2d2026..19c1acd 100644 --- a/board/compulab/imx8mm-cl-iot-gate/spl.c +++ b/board/compulab/imx8mm-cl-iot-gate/spl.c @@ -21,6 +21,7 @@ #include <asm/mach-imx/mxc_i2c.h> #include <asm/mach-imx/gpio.h> #include <asm/arch/ddr.h> +#include <asm/sections.h> #include <dm/uclass.h> #include <dm/device.h> diff --git a/board/congatec/cgtqmx8/spl.c b/board/congatec/cgtqmx8/spl.c index dea34e4..b432ce2 100644 --- a/board/congatec/cgtqmx8/spl.c +++ b/board/congatec/cgtqmx8/spl.c @@ -10,6 +10,7 @@ #include <init.h> #include <log.h> #include <spl.h> +#include <asm/sections.h> #include <dm/uclass.h> #include <dm/device.h> #include <dm/uclass-internal.h> diff --git a/board/coreboot/coreboot/coreboot.c b/board/coreboot/coreboot/coreboot.c index 3b90ae7..db855c1 100644 --- a/board/coreboot/coreboot/coreboot.c +++ b/board/coreboot/coreboot/coreboot.c @@ -10,6 +10,8 @@ #include <asm/cb_sysinfo.h> #include <asm/global_data.h> +DECLARE_GLOBAL_DATA_PTR; + int board_early_init_r(void) { /* @@ -54,14 +56,12 @@ int show_board_info(void) return 0; fallback: -#ifdef CONFIG_OF_CONTROL - DECLARE_GLOBAL_DATA_PTR; - - model = fdt_getprop(gd->fdt_blob, 0, "model", NULL); + if (IS_ENABLED(CONFIG_OF_CONTROL)) { + model = fdt_getprop(gd->fdt_blob, 0, "model", NULL); - if (model) - printf("Model: %s\n", model); -#endif + if (model) + printf("Model: %s\n", model); + } return checkboard(); } diff --git a/board/cortina/presidio-asic/presidio.c b/board/cortina/presidio-asic/presidio.c index aae0a5d..fdfa3af 100644 --- a/board/cortina/presidio-asic/presidio.c +++ b/board/cortina/presidio-asic/presidio.c @@ -4,6 +4,7 @@ * */ #include <common.h> +#include <event.h> #include <init.h> #include <malloc.h> #include <errno.h> @@ -121,7 +122,7 @@ void reset_cpu(void) } #ifdef CONFIG_LAST_STAGE_INIT -int last_stage_init(void) +static int last_stage_init(void) { u32 val; @@ -134,4 +135,5 @@ int last_stage_init(void) return 0; } +EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, last_stage_init); #endif diff --git a/board/dhelectronics/dh_imx6/dh_imx6_spl.c b/board/dhelectronics/dh_imx6/dh_imx6_spl.c index 20a330c..e6d5657 100644 --- a/board/dhelectronics/dh_imx6/dh_imx6_spl.c +++ b/board/dhelectronics/dh_imx6/dh_imx6_spl.c @@ -21,6 +21,7 @@ #include <asm/mach-imx/iomux-v3.h> #include <asm/mach-imx/mxc_i2c.h> #include <asm/io.h> +#include <asm/sections.h> #include <asm/system.h> #include <errno.h> #include <fuse.h> diff --git a/board/dhelectronics/dh_imx8mp/spl.c b/board/dhelectronics/dh_imx8mp/spl.c index e2aa874..a8fda13 100644 --- a/board/dhelectronics/dh_imx8mp/spl.c +++ b/board/dhelectronics/dh_imx8mp/spl.c @@ -15,6 +15,7 @@ #include <asm/arch/sys_proto.h> #include <asm/mach-imx/boot_mode.h> #include <asm/arch/ddr.h> +#include <asm/sections.h> #include <dm/uclass.h> #include <dm/device.h> diff --git a/board/dhelectronics/dh_stm32mp1/board.c b/board/dhelectronics/dh_stm32mp1/board.c index f9cfabe..341d095 100644 --- a/board/dhelectronics/dh_stm32mp1/board.c +++ b/board/dhelectronics/dh_stm32mp1/board.c @@ -34,6 +34,7 @@ #include <phy.h> #include <linux/bitops.h> #include <linux/delay.h> +#include <linux/printk.h> #include <power/regulator.h> #include <remoteproc.h> #include <reset.h> diff --git a/board/emulation/qemu-arm/Kconfig b/board/emulation/qemu-arm/Kconfig index ed99496..09c9541 100644 --- a/board/emulation/qemu-arm/Kconfig +++ b/board/emulation/qemu-arm/Kconfig @@ -12,6 +12,10 @@ config BOARD_SPECIFIC_OPTIONS # dummy imply VIRTIO_NET imply VIRTIO_BLK +config PRE_CON_BUF_ADDR + hex + default 0x40100000 + endif if TARGET_QEMU_ARM_64BIT && !TFABOOT diff --git a/board/emulation/qemu-arm/qemu-arm.c b/board/emulation/qemu-arm/qemu-arm.c index dfea0d9..942f1ff 100644 --- a/board/emulation/qemu-arm/qemu-arm.c +++ b/board/emulation/qemu-arm/qemu-arm.c @@ -11,6 +11,7 @@ #include <fdtdec.h> #include <init.h> #include <log.h> +#include <usb.h> #include <virtio_types.h> #include <virtio.h> @@ -114,6 +115,10 @@ int board_late_init(void) */ virtio_init(); + /* start usb so that usb keyboard can be used as input device */ + if (CONFIG_IS_ENABLED(USB_KEYBOARD)) + usb_init(); + return 0; } diff --git a/board/emulation/qemu-arm/qemu-arm.env b/board/emulation/qemu-arm/qemu-arm.env index e658d5e..fb4adef 100644 --- a/board/emulation/qemu-arm/qemu-arm.env +++ b/board/emulation/qemu-arm/qemu-arm.env @@ -2,6 +2,9 @@ /* environment for qemu-arm and qemu-arm64 */ +stdin=serial,usbkbd +stdout=serial,vidconsole +stderr=serial,vidconsole fdt_high=0xffffffff initrd_high=0xffffffff fdt_addr=0x40000000 diff --git a/board/emulation/qemu-ppce500/qemu-ppce500.c b/board/emulation/qemu-ppce500/qemu-ppce500.c index a39bcb4..2213616 100644 --- a/board/emulation/qemu-ppce500/qemu-ppce500.c +++ b/board/emulation/qemu-ppce500/qemu-ppce500.c @@ -9,6 +9,7 @@ #include <cpu_func.h> #include <dm.h> #include <env.h> +#include <event.h> #include <init.h> #include <log.h> #include <net.h> @@ -184,7 +185,7 @@ int misc_init_r(void) return 0; } -int last_stage_init(void) +static int last_stage_init(void) { void *fdt = get_fdt_virt(); int len = 0; @@ -204,6 +205,7 @@ int last_stage_init(void) return 0; } +EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, last_stage_init); static uint64_t get_linear_ram_size(void) { @@ -318,7 +320,7 @@ ulong get_bus_freq(ulong dummy) int cpu_numcores(void) { /* - * The QEMU u-boot target only needs to drive the first core, + * The QEMU U-Boot target only needs to drive the first core, * spinning and device tree nodes get driven by QEMU itself */ return 1; diff --git a/board/engicam/imx8mm/spl.c b/board/engicam/imx8mm/spl.c index 1846134..af9044a 100644 --- a/board/engicam/imx8mm/spl.c +++ b/board/engicam/imx8mm/spl.c @@ -16,6 +16,7 @@ #include <asm/arch/sys_proto.h> #include <asm/mach-imx/boot_mode.h> #include <asm/arch/ddr.h> +#include <asm/sections.h> DECLARE_GLOBAL_DATA_PTR; diff --git a/board/freescale/imx8mm_evk/spl.c b/board/freescale/imx8mm_evk/spl.c index 6e95138..3543781 100644 --- a/board/freescale/imx8mm_evk/spl.c +++ b/board/freescale/imx8mm_evk/spl.c @@ -19,6 +19,7 @@ #include <asm/arch/sys_proto.h> #include <asm/mach-imx/boot_mode.h> #include <asm/arch/ddr.h> +#include <asm/sections.h> #include <dm/uclass.h> #include <dm/device.h> diff --git a/board/freescale/imx8mn_evk/spl.c b/board/freescale/imx8mn_evk/spl.c index ec0378b..dd54fa9 100644 --- a/board/freescale/imx8mn_evk/spl.c +++ b/board/freescale/imx8mn_evk/spl.c @@ -20,6 +20,7 @@ #include <asm/arch/sys_proto.h> #include <asm/mach-imx/boot_mode.h> #include <asm/arch/ddr.h> +#include <asm/sections.h> #include <dm/uclass.h> #include <dm/device.h> diff --git a/board/freescale/imx8mq_evk/spl.c b/board/freescale/imx8mq_evk/spl.c index bea9ddc..818cdd6 100644 --- a/board/freescale/imx8mq_evk/spl.c +++ b/board/freescale/imx8mq_evk/spl.c @@ -20,6 +20,7 @@ #include <asm/mach-imx/iomux-v3.h> #include <asm/mach-imx/gpio.h> #include <asm/mach-imx/mxc_i2c.h> +#include <asm/sections.h> #include <fsl_esdhc_imx.h> #include <fsl_sec.h> #include <mmc.h> diff --git a/board/freescale/imx8qm_mek/spl.c b/board/freescale/imx8qm_mek/spl.c index 332a662..17fd437 100644 --- a/board/freescale/imx8qm_mek/spl.c +++ b/board/freescale/imx8qm_mek/spl.c @@ -17,6 +17,7 @@ #include <dm/device-internal.h> #include <dm/lists.h> #include <asm/arch/sys_proto.h> +#include <asm/sections.h> DECLARE_GLOBAL_DATA_PTR; diff --git a/board/freescale/imx8qxp_mek/spl.c b/board/freescale/imx8qxp_mek/spl.c index 75aab16..462c43c 100644 --- a/board/freescale/imx8qxp_mek/spl.c +++ b/board/freescale/imx8qxp_mek/spl.c @@ -22,6 +22,7 @@ #include <asm/arch/imx8-pins.h> #include <asm/arch/iomux.h> #include <asm/arch/sys_proto.h> +#include <asm/sections.h> DECLARE_GLOBAL_DATA_PTR; diff --git a/board/freescale/imx8ulp_evk/spl.c b/board/freescale/imx8ulp_evk/spl.c index 66d0f68..c49b5be 100644 --- a/board/freescale/imx8ulp_evk/spl.c +++ b/board/freescale/imx8ulp_evk/spl.c @@ -20,6 +20,7 @@ #include <asm/arch/rdc.h> #include <asm/arch/upower.h> #include <asm/mach-imx/ele_api.h> +#include <asm/sections.h> DECLARE_GLOBAL_DATA_PTR; diff --git a/board/freescale/imx93_evk/spl.c b/board/freescale/imx93_evk/spl.c index 63883b3..be9c24f 100644 --- a/board/freescale/imx93_evk/spl.c +++ b/board/freescale/imx93_evk/spl.c @@ -20,6 +20,7 @@ #include <asm/mach-imx/mxc_i2c.h> #include <asm/arch-mx7ulp/gpio.h> #include <asm/mach-imx/syscounter.h> +#include <asm/sections.h> #include <dm/uclass.h> #include <dm/device.h> #include <dm/uclass-internal.h> diff --git a/board/freescale/ls1021aiot/ls1021aiot.c b/board/freescale/ls1021aiot/ls1021aiot.c index 8605d06..d6f22bd 100644 --- a/board/freescale/ls1021aiot/ls1021aiot.c +++ b/board/freescale/ls1021aiot/ls1021aiot.c @@ -18,6 +18,7 @@ #include <asm/arch/ls102xa_devdis.h> #include <asm/arch/ls102xa_soc.h> +#include <asm/sections.h> #include <fsl_csu.h> #include <fsl_immap.h> #include <netdev.h> diff --git a/board/freescale/ls1021aqds/ls1021aqds.c b/board/freescale/ls1021aqds/ls1021aqds.c index d5cb731..a618ce1 100644 --- a/board/freescale/ls1021aqds/ls1021aqds.c +++ b/board/freescale/ls1021aqds/ls1021aqds.c @@ -16,6 +16,7 @@ #include <asm/arch/fsl_serdes.h> #include <asm/arch/ls102xa_soc.h> #include <asm/arch/ls102xa_devdis.h> +#include <asm/sections.h> #include <hwconfig.h> #include <mmc.h> #include <fsl_csu.h> diff --git a/board/freescale/ls1021atsn/ls1021atsn.c b/board/freescale/ls1021atsn/ls1021atsn.c index d144f25..d0e4e79 100644 --- a/board/freescale/ls1021atsn/ls1021atsn.c +++ b/board/freescale/ls1021atsn/ls1021atsn.c @@ -12,6 +12,7 @@ #include <asm/arch/ls102xa_soc.h> #include <asm/arch/fsl_serdes.h> #include <asm/global_data.h> +#include <asm/sections.h> #include <linux/delay.h> #include "../common/sleep.h" #include <fsl_validate.h> diff --git a/board/freescale/ls1021atwr/ls1021atwr.c b/board/freescale/ls1021atwr/ls1021atwr.c index 4f58343..27b9d79 100644 --- a/board/freescale/ls1021atwr/ls1021atwr.c +++ b/board/freescale/ls1021atwr/ls1021atwr.c @@ -18,6 +18,7 @@ #include <asm/arch/fsl_serdes.h> #include <asm/arch/ls102xa_devdis.h> #include <asm/arch/ls102xa_soc.h> +#include <asm/sections.h> #include <hwconfig.h> #include <mmc.h> #include <fsl_csu.h> diff --git a/board/freescale/ls1088a/ls1088a.c b/board/freescale/ls1088a/ls1088a.c index 7a1047a..f2b8bec 100644 --- a/board/freescale/ls1088a/ls1088a.c +++ b/board/freescale/ls1088a/ls1088a.c @@ -181,13 +181,14 @@ unsigned long long get_qixis_addr(void) #endif #if defined(CONFIG_VID) -int init_func_vid(void) +static int setup_core_voltage(void) { if (adjust_vdd(0) < 0) printf("core voltage not adjusted\n"); return 0; } +EVENT_SPY_SIMPLE(EVT_MISC_INIT_F, setup_core_voltage); u16 soc_get_fuse_vid(int vid_index) { diff --git a/board/freescale/lx2160a/lx2160a.c b/board/freescale/lx2160a/lx2160a.c index d631a11..2883848 100644 --- a/board/freescale/lx2160a/lx2160a.c +++ b/board/freescale/lx2160a/lx2160a.c @@ -13,6 +13,7 @@ #include <i2c.h> #include <malloc.h> #include <errno.h> +#include <event.h> #include <netdev.h> #include <fsl_ddr.h> #include <asm/io.h> @@ -242,6 +243,7 @@ int init_func_vid(void) return 0; } #endif +EVENT_SPY_SIMPLE(EVT_MISC_INIT_F, init_func_vid); int checkboard(void) { diff --git a/board/freescale/mx6sabreauto/mx6sabreauto.c b/board/freescale/mx6sabreauto/mx6sabreauto.c index 039deb5..77e9200 100644 --- a/board/freescale/mx6sabreauto/mx6sabreauto.c +++ b/board/freescale/mx6sabreauto/mx6sabreauto.c @@ -15,6 +15,7 @@ #include <asm/arch/imx-regs.h> #include <asm/arch/iomux.h> #include <asm/arch/mx6-pins.h> +#include <asm/sections.h> #include <env.h> #include <linux/errno.h> #include <asm/gpio.h> diff --git a/board/freescale/mx6sabresd/mx6sabresd.c b/board/freescale/mx6sabresd/mx6sabresd.c index 96a76b0..b558a59 100644 --- a/board/freescale/mx6sabresd/mx6sabresd.c +++ b/board/freescale/mx6sabresd/mx6sabresd.c @@ -14,6 +14,7 @@ #include <asm/arch/mx6-pins.h> #include <asm/global_data.h> #include <asm/mach-imx/spi.h> +#include <asm/sections.h> #include <env.h> #include <linux/errno.h> #include <asm/gpio.h> diff --git a/board/freescale/mx6slevk/mx6slevk.c b/board/freescale/mx6slevk/mx6slevk.c index 2c90a35..e9ac571 100644 --- a/board/freescale/mx6slevk/mx6slevk.c +++ b/board/freescale/mx6slevk/mx6slevk.c @@ -19,6 +19,7 @@ #include <asm/mach-imx/iomux-v3.h> #include <asm/mach-imx/mxc_i2c.h> #include <asm/io.h> +#include <asm/sections.h> #include <linux/sizes.h> #include <common.h> #include <fsl_esdhc_imx.h> diff --git a/board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c b/board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c index 570b501..534b16c 100644 --- a/board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c +++ b/board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c @@ -18,6 +18,7 @@ #include <asm/mach-imx/boot_mode.h> #include <asm/mach-imx/mxc_i2c.h> #include <asm/io.h> +#include <asm/sections.h> #include <common.h> #include <env.h> #include <fsl_esdhc_imx.h> diff --git a/board/gateworks/venice/spl.c b/board/gateworks/venice/spl.c index 5aa2095..774a990 100644 --- a/board/gateworks/venice/spl.c +++ b/board/gateworks/venice/spl.c @@ -19,6 +19,7 @@ #include <asm/mach-imx/mxc_i2c.h> #include <asm/arch/ddr.h> #include <asm-generic/gpio.h> +#include <asm/sections.h> #include <dm/uclass.h> #include <dm/device.h> #include <dm/pinctrl.h> diff --git a/board/gdsys/a38x/controlcenterdc.c b/board/gdsys/a38x/controlcenterdc.c index ccebba7..0f620c2 100644 --- a/board/gdsys/a38x/controlcenterdc.c +++ b/board/gdsys/a38x/controlcenterdc.c @@ -7,6 +7,7 @@ #include <common.h> #include <command.h> #include <dm.h> +#include <event.h> #include <init.h> #include <miiphy.h> #include <net.h> @@ -35,19 +36,6 @@ DECLARE_GLOBAL_DATA_PTR; #define DB_GP_88F68XX_GPP_POL_LOW 0x0 #define DB_GP_88F68XX_GPP_POL_MID 0x0 -static int get_tpm(struct udevice **devp) -{ - int rc; - - rc = uclass_first_device_err(UCLASS_TPM, devp); - if (rc) { - printf("Could not find TPM (ret=%d)\n", rc); - return CMD_RET_FAILURE; - } - - return 0; -} - /* * Define the DDR layout / topology here in the board file. This will * be used by the DDR3 init code in the SPL U-Boot version to configure @@ -284,15 +272,22 @@ int board_fix_fdt(void *rw_fdt_blob) return 0; } -int last_stage_init(void) +#ifndef CONFIG_SPL_BUILD +static int last_stage_init(void) { struct udevice *tpm; int ret; -#ifndef CONFIG_SPL_BUILD + if (IS_ENABLED(CONFIG_SPL_BUILD)) + return 0; ccdc_eth_init(); -#endif - ret = get_tpm(&tpm); + + ret = uclass_first_device_err(UCLASS_TPM, &tpm); + if (ret) { + printf("Could not find TPM (ret=%d)\n", ret); + return ret; + } + if (ret || tpm_init(tpm) || tpm1_startup(tpm, TPM_ST_CLEAR) || tpm1_continue_self_test(tpm)) { return 1; @@ -305,3 +300,5 @@ int last_stage_init(void) return 0; } +EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, last_stage_init); +#endif diff --git a/board/gdsys/mpc8308/gazerbeam.c b/board/gdsys/mpc8308/gazerbeam.c index ba88401..cc608c4 100644 --- a/board/gdsys/mpc8308/gazerbeam.c +++ b/board/gdsys/mpc8308/gazerbeam.c @@ -9,6 +9,7 @@ #include <command.h> #include <dm.h> #include <env.h> +#include <event.h> #include <fdt_support.h> #include <fsl_esdhc.h> #include <init.h> @@ -124,7 +125,7 @@ static void display_osd_info(struct udevice *osd, osd_info->width, osd_info->height); } -int last_stage_init(void) +static int last_stage_init(void) { int fpga_hw_rev = 0; int i; @@ -179,6 +180,7 @@ int last_stage_init(void) return 0; } +EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, last_stage_init); #if defined(CONFIG_OF_BOARD_SETUP) int ft_board_setup(void *blob, struct bd_info *bd) diff --git a/board/ge/bx50v3/bx50v3.c b/board/ge/bx50v3/bx50v3.c index 4e9d841..2d89519 100644 --- a/board/ge/bx50v3/bx50v3.c +++ b/board/ge/bx50v3/bx50v3.c @@ -5,6 +5,7 @@ * Copyright 2012 Freescale Semiconductor, Inc. */ +#include <event.h> #include <image.h> #include <init.h> #include <asm/arch/clock.h> @@ -531,7 +532,7 @@ static void remove_ethaddr_env_var(int index) env_set(env_var_name, NULL); } -int last_stage_init(void) +static int last_stage_init(void) { int i; @@ -544,6 +545,7 @@ int last_stage_init(void) return 0; } +EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, last_stage_init); int checkboard(void) { diff --git a/board/google/chromebook_coral/coral.c b/board/google/chromebook_coral/coral.c index 9e23f5c..9d9168d 100644 --- a/board/google/chromebook_coral/coral.c +++ b/board/google/chromebook_coral/coral.c @@ -33,7 +33,7 @@ struct cros_gpio_info { int flags; }; -static int coral_check_ll_boot(void *ctx, struct event *event) +static int coral_check_ll_boot(void) { if (!ll_boot_init()) { printf("Running as secondary loader"); @@ -57,7 +57,7 @@ static int coral_check_ll_boot(void *ctx, struct event *event) return 0; } -EVENT_SPY(EVT_MISC_INIT_F, coral_check_ll_boot); +EVENT_SPY_SIMPLE(EVT_MISC_INIT_F, coral_check_ll_boot); int arch_misc_init(void) { diff --git a/board/k+p/kp_imx6q_tpc/kp_imx6q_tpc_spl.c b/board/k+p/kp_imx6q_tpc/kp_imx6q_tpc_spl.c index 103c453..5490243 100644 --- a/board/k+p/kp_imx6q_tpc/kp_imx6q_tpc_spl.c +++ b/board/k+p/kp_imx6q_tpc/kp_imx6q_tpc_spl.c @@ -14,6 +14,7 @@ #include <asm/arch/mx6-ddr.h> #include <asm/arch/sys_proto.h> #include <asm/global_data.h> +#include <asm/sections.h> #include <asm/io.h> #include <errno.h> #include <spl.h> diff --git a/board/keymile/km83xx/km83xx.c b/board/keymile/km83xx/km83xx.c index 8f2d873..acd1310 100644 --- a/board/keymile/km83xx/km83xx.c +++ b/board/keymile/km83xx/km83xx.c @@ -15,6 +15,7 @@ #include <common.h> #include <env.h> +#include <event.h> #include <fdt_support.h> #include <init.h> #include <ioports.h> @@ -184,7 +185,7 @@ int misc_init_r(void) return 0; } -int last_stage_init(void) +static int last_stage_init(void) { #if defined(CONFIG_TARGET_KMCOGE5NE) /* @@ -202,6 +203,7 @@ int last_stage_init(void) set_km_env(); return 0; } +EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, last_stage_init); static int fixed_sdram(void) { diff --git a/board/keymile/kmcent2/kmcent2.c b/board/keymile/kmcent2/kmcent2.c index ed552c5..572cc7b 100644 --- a/board/keymile/kmcent2/kmcent2.c +++ b/board/keymile/kmcent2/kmcent2.c @@ -182,7 +182,7 @@ unsigned long get_serial_clock(unsigned long dummy) return (gd->bus_clk / 2); } -static int kmcent2_misc_init_f(void *ctx, struct event *event) +static int kmcent2_misc_init_f(void) { /* configure QRIO pis for i2c deblocking */ i2c_deblock_gpio_cfg(); @@ -210,7 +210,7 @@ static int kmcent2_misc_init_f(void *ctx, struct event *event) return 0; } -EVENT_SPY(EVT_MISC_INIT_F, kmcent2_misc_init_f); +EVENT_SPY_SIMPLE(EVT_MISC_INIT_F, kmcent2_misc_init_f); #define USED_SRDS_BANK 0 #define EXPECTED_SRDS_RFCK SRDS_PLLCR0_RFCK_SEL_100 @@ -261,7 +261,7 @@ int hush_init_var(void) return 0; } -int last_stage_init(void) +static int last_stage_init(void) { const char *kmem; /* DIP switch support on BFTIC */ @@ -287,6 +287,7 @@ int last_stage_init(void) return 0; } +EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, last_stage_init); void fdt_fixup_fman_mac_addresses(void *blob) { diff --git a/board/keymile/pg-wcom-ls102xa/pg-wcom-ls102xa.c b/board/keymile/pg-wcom-ls102xa/pg-wcom-ls102xa.c index 2f1731e..21c21aa 100644 --- a/board/keymile/pg-wcom-ls102xa/pg-wcom-ls102xa.c +++ b/board/keymile/pg-wcom-ls102xa/pg-wcom-ls102xa.c @@ -110,14 +110,14 @@ int board_early_init_f(void) return 0; } -static int pg_wcom_misc_init_f(void *ctx, struct event *event) +static int pg_wcom_misc_init_f(void) { if (IS_ENABLED(CONFIG_PG_WCOM_UBOOT_UPDATE_SUPPORTED)) check_for_uboot_update(); return 0; } -EVENT_SPY(EVT_MISC_INIT_F, pg_wcom_misc_init_f); +EVENT_SPY_SIMPLE(EVT_MISC_INIT_F, pg_wcom_misc_init_f); int board_init(void) { @@ -215,8 +215,4 @@ int hush_init_var(void) return 0; } -int last_stage_init(void) -{ - set_km_env(); - return 0; -} +EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, set_km_env); diff --git a/board/kontron/pitx_imx8m/spl.c b/board/kontron/pitx_imx8m/spl.c index f6fd170..a247803 100644 --- a/board/kontron/pitx_imx8m/spl.c +++ b/board/kontron/pitx_imx8m/spl.c @@ -16,6 +16,7 @@ #include <asm/mach-imx/iomux-v3.h> #include <asm/mach-imx/gpio.h> #include <asm/mach-imx/mxc_i2c.h> +#include <asm/sections.h> #include <linux/delay.h> #include <power/pmic.h> #include <power/pfuze100_pmic.h> diff --git a/board/kontron/sl-mx6ul/spl.c b/board/kontron/sl-mx6ul/spl.c index a9d370b..b175885 100644 --- a/board/kontron/sl-mx6ul/spl.c +++ b/board/kontron/sl-mx6ul/spl.c @@ -11,6 +11,7 @@ #include <asm/gpio.h> #include <asm/io.h> #include <asm/mach-imx/iomux-v3.h> +#include <asm/sections.h> #include <fsl_esdhc_imx.h> #include <init.h> #include <linux/delay.h> diff --git a/board/kontron/sl-mx8mm/spl.c b/board/kontron/sl-mx8mm/spl.c index b493734..54ee1e66 100644 --- a/board/kontron/sl-mx8mm/spl.c +++ b/board/kontron/sl-mx8mm/spl.c @@ -12,6 +12,7 @@ #include <asm/gpio.h> #include <asm/mach-imx/boot_mode.h> #include <asm/mach-imx/iomux-v3.h> +#include <asm/sections.h> #include <dm/uclass.h> #include <dm/device.h> #include <dm/uclass-internal.h> diff --git a/board/liebherr/display5/spl.c b/board/liebherr/display5/spl.c index 4219d00..97928e9 100644 --- a/board/liebherr/display5/spl.c +++ b/board/liebherr/display5/spl.c @@ -25,6 +25,7 @@ #include "asm/arch/iomux.h" #include <asm/mach-imx/iomux-v3.h> #include <asm/gpio.h> +#include <asm/sections.h> #include <fsl_esdhc_imx.h> #include <netdev.h> #include <bootcount.h> diff --git a/board/mediatek/mt8518/mt8518_ap1.c b/board/mediatek/mt8518/mt8518_ap1.c index 2490b15..e03da63 100644 --- a/board/mediatek/mt8518/mt8518_ap1.c +++ b/board/mediatek/mt8518/mt8518_ap1.c @@ -8,6 +8,7 @@ #include <init.h> #include <log.h> #include <asm/global_data.h> +#include <linux/printk.h> DECLARE_GLOBAL_DATA_PTR; diff --git a/board/mntre/imx8mq_reform2/spl.c b/board/mntre/imx8mq_reform2/spl.c index 21fad49..5120c62 100644 --- a/board/mntre/imx8mq_reform2/spl.c +++ b/board/mntre/imx8mq_reform2/spl.c @@ -21,6 +21,7 @@ #include <asm/mach-imx/iomux-v3.h> #include <asm/mach-imx/gpio.h> #include <asm/mach-imx/mxc_i2c.h> +#include <asm/sections.h> #include <fsl_esdhc_imx.h> #include <mmc.h> #include <linux/delay.h> diff --git a/board/mscc/ocelot/ocelot.c b/board/mscc/ocelot/ocelot.c index f261346..d69db04 100644 --- a/board/mscc/ocelot/ocelot.c +++ b/board/mscc/ocelot/ocelot.c @@ -16,6 +16,7 @@ #include <wait_bit.h> #include <miiphy.h> #include <linux/bitops.h> +#include <linux/printk.h> DECLARE_GLOBAL_DATA_PTR; diff --git a/board/nvidia/jetson-tk1/jetson-tk1.c b/board/nvidia/jetson-tk1/jetson-tk1.c index d349531..7f3cdd7 100644 --- a/board/nvidia/jetson-tk1/jetson-tk1.c +++ b/board/nvidia/jetson-tk1/jetson-tk1.c @@ -7,6 +7,7 @@ #include <common.h> #include <dm.h> #include <log.h> +#include <linux/printk.h> #include <power/as3722.h> #include <power/pmic.h> diff --git a/board/phytec/pcm058/pcm058.c b/board/phytec/pcm058/pcm058.c index 5e5b129..b37c6fe 100644 --- a/board/phytec/pcm058/pcm058.c +++ b/board/phytec/pcm058/pcm058.c @@ -17,6 +17,7 @@ #include <asm/global_data.h> #include <asm/mach-imx/boot_mode.h> #include <asm/arch/sys_proto.h> +#include <asm/sections.h> #include <dm.h> DECLARE_GLOBAL_DATA_PTR; diff --git a/board/phytec/phycore_imx8mm/spl.c b/board/phytec/phycore_imx8mm/spl.c index 1bae9b1..690a51f 100644 --- a/board/phytec/phycore_imx8mm/spl.c +++ b/board/phytec/phycore_imx8mm/spl.c @@ -12,6 +12,7 @@ #include <asm/global_data.h> #include <asm/mach-imx/boot_mode.h> #include <asm/mach-imx/iomux-v3.h> +#include <asm/sections.h> #include <hang.h> #include <init.h> #include <log.h> diff --git a/board/phytium/durian/durian.c b/board/phytium/durian/durian.c index ee48474..0a4048d 100644 --- a/board/phytium/durian/durian.c +++ b/board/phytium/durian/durian.c @@ -8,6 +8,7 @@ #include <common.h> #include <command.h> #include <cpu_func.h> +#include <event.h> #include <init.h> #include <log.h> #include <asm/armv8/mmu.h> @@ -99,7 +100,7 @@ int __asm_flush_l3_dcache(void) return 0; } -int last_stage_init(void) +static int last_stage_init(void) { int ret; @@ -113,3 +114,4 @@ int last_stage_init(void) } return ret; } +EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, last_stage_init); diff --git a/board/phytium/pomelo/pomelo.c b/board/phytium/pomelo/pomelo.c index 75d2636..960e491 100644 --- a/board/phytium/pomelo/pomelo.c +++ b/board/phytium/pomelo/pomelo.c @@ -7,6 +7,7 @@ #include <stdio.h> #include <command.h> +#include <event.h> #include <init.h> #include <asm/armv8/mmu.h> #include <asm/io.h> @@ -102,7 +103,7 @@ int __asm_flush_l3_dcache(void) return 0; } -int last_stage_init(void) +static int last_stage_init(void) { int ret; @@ -116,3 +117,4 @@ int last_stage_init(void) } return ret; } +EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, last_stage_init); diff --git a/board/pine64/pinebook-pro-rk3399/pinebook-pro-rk3399.c b/board/pine64/pinebook-pro-rk3399/pinebook-pro-rk3399.c index 516292a..4ad7807 100644 --- a/board/pine64/pinebook-pro-rk3399/pinebook-pro-rk3399.c +++ b/board/pine64/pinebook-pro-rk3399/pinebook-pro-rk3399.c @@ -12,6 +12,7 @@ #include <asm/arch-rockchip/grf_rk3399.h> #include <asm/arch-rockchip/hardware.h> #include <asm/arch-rockchip/misc.h> +#include <linux/printk.h> #include <power/regulator.h> #define GRF_IO_VSEL_BT565_SHIFT 0 diff --git a/board/purism/librem5/spl.c b/board/purism/librem5/spl.c index 90f1fcf..581f092 100644 --- a/board/purism/librem5/spl.c +++ b/board/purism/librem5/spl.c @@ -418,9 +418,9 @@ out: return rv; } -int usb_gadget_handle_interrupts(int index) +int dm_usb_gadget_handle_interrupts(struct udevice *dev) { - dwc3_uboot_handle_interrupt(0); + dwc3_uboot_handle_interrupt(dev); return 0; } diff --git a/board/ronetix/imx7-cm/spl.c b/board/ronetix/imx7-cm/spl.c index d36f734..b94cfd6 100644 --- a/board/ronetix/imx7-cm/spl.c +++ b/board/ronetix/imx7-cm/spl.c @@ -16,6 +16,7 @@ #include <asm/arch-mx7/mx7-ddr.h> #include <asm/mach-imx/iomux-v3.h> #include <asm/gpio.h> +#include <asm/sections.h> #include <fsl_esdhc_imx.h> #include <spl.h> diff --git a/board/ronetix/imx8mq-cm/spl.c b/board/ronetix/imx8mq-cm/spl.c index b9a6745..1c675bc 100644 --- a/board/ronetix/imx8mq-cm/spl.c +++ b/board/ronetix/imx8mq-cm/spl.c @@ -13,6 +13,7 @@ #include <asm/arch/clock.h> #include <asm/mach-imx/gpio.h> #include <asm/mach-imx/mxc_i2c.h> +#include <asm/sections.h> #include <fsl_esdhc_imx.h> #include <linux/delay.h> #include <spl.h> diff --git a/board/samsung/common/exynos5-dt.c b/board/samsung/common/exynos5-dt.c index cde77d7..1e88a82 100644 --- a/board/samsung/common/exynos5-dt.c +++ b/board/samsung/common/exynos5-dt.c @@ -26,6 +26,7 @@ #include <asm/arch/pinmux.h> #include <asm/arch/power.h> #include <asm/arch/sromc.h> +#include <linux/printk.h> #include <power/pmic.h> #include <power/max77686_pmic.h> #include <power/regulator.h> @@ -126,9 +127,9 @@ static struct dwc3_device dwc3_device_data = { .index = 0, }; -int usb_gadget_handle_interrupts(int index) +int dm_usb_gadget_handle_interrupts(struct udevice *dev) { - dwc3_uboot_handle_interrupt(0); + dwc3_uboot_handle_interrupt(dev); return 0; } diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c index 5ffa216..cc114aa 100644 --- a/board/samsung/common/misc.c +++ b/board/samsung/common/misc.c @@ -10,6 +10,7 @@ #include <libtizen.h> #include <asm/global_data.h> #include <linux/delay.h> +#include <linux/printk.h> #include <samsung/misc.h> #include <errno.h> #include <version.h> diff --git a/board/samsung/goni/goni.c b/board/samsung/goni/goni.c index 535f8e1..c8f5a15 100644 --- a/board/samsung/goni/goni.c +++ b/board/samsung/goni/goni.c @@ -13,6 +13,7 @@ #include <asm/arch/mmc.h> #include <dm.h> #include <linux/delay.h> +#include <linux/printk.h> #include <power/pmic.h> #include <usb/dwc2_udc.h> #include <asm/arch/cpu.h> diff --git a/board/samsung/odroid/odroid.c b/board/samsung/odroid/odroid.c index 39a60e4..d237828 100644 --- a/board/samsung/odroid/odroid.c +++ b/board/samsung/odroid/odroid.c @@ -15,6 +15,7 @@ #include <asm/arch/cpu.h> #include <dm.h> #include <env.h> +#include <linux/printk.h> #include <power/pmic.h> #include <power/regulator.h> #include <power/max77686_pmic.h> diff --git a/board/sandbox/capsule_priv_key_bad.key b/board/sandbox/capsule_priv_key_bad.key new file mode 100644 index 0000000..2324f69 --- /dev/null +++ b/board/sandbox/capsule_priv_key_bad.key @@ -0,0 +1,28 @@ +-----BEGIN PRIVATE KEY----- +MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCmPw1pGd2xNW0p +lesRXkkek3uwUB06Nt61tnZvpMkBKt4IokqGWz1tZls+Z2CqvwOfcsPZ27cPRYSu +xRnM3YdL4MG6SePV7i/YSNw3rq8CP8zLGtCbNIfsfsNfPQEtPBpw6+7pMJKhjqpV +2U2UQzZEiX4qlnhLpyv2JNJag27yf0feLdJi7HnJ9xdvcXpA1DSGm4y+DDhgYeI8 +DEteEu6s0TYQfnOZSQOeJi+1/Qz0S594uFJB37MyGh/mB15ILb8gva4nA3ayHOBK +0dd+HSiUCGYrLYO7aj+nfzQj9N1qTlzCnC1603bMczU5pkwcODg6xP0Sn11J6RYy +y0c0qzJLAgMBAAECggEABDY2MLoew3IkBltrParAWAUUcFLi95jw92q6BkOHEJg8 +2qia1yCitPUtPodMLmOKF5x4EdgXg5sv2O8MGbWP1VtUKXGh3QJcnRnNmsZ1hXJC +RBcrei2aVLsqf0V2Mg3+GuG8PW3vLWHyZ/Sd6afeuXEYm2Bzrw9J5rfd3dBVKm7f +HBvIyy1ATO/2cbUaEaCLOyhxLhssTI2TIK5SjlsjFLxiQXEi6RyGfBxUCriKZykS +krMdvYh7Tf0uYcv0STmQ5s5Rd+RhRIGCVAdsNBxxJjgBAgqqa/B+kWbcc6o2D41n +yWjErUaBBx3t0A7oT4K4DSTYwMNDVY3fhdd+szsocQKBgQDjnm8LG4UO6OQDm6iX +0vTQTItoAz5TU6GEjHTCfVEqiupD4LKfHhSXwp2hRyzxXO5oNTU9MQCzYd7Npes0 +oVk4Tjo3YDacNPgxqKjODu/Q+tkTH15ydzGr674+YXHfCA1uT5GKOiiF0H1FZgMa +Dk0s+3uWX34vbL4QCu97bUhBewKBgQC6+Z0J9sClgWvvjkglJN3XhRnAacp+WgX7 +bkpgSboXIIsqeqhd1WCLeV7L1pcZgifYBMPojf5LTBqBedL1q3RuqiqQWD/bSIYN +Oc9KCdTjksS8Zo+w+s5zDObDhW9y13H2mKwDqilYBrT4fiA62wPMf1SjEF+RSC6K +ZrQzHO1xcQKBgAILsXnLFIYOx8XUh05eAf9BQNt9c/jxvnjffkklMS6Nsw9LHK/b +aFn40MvbROcia64aFFFpeFUkYwk8HYIKlS+xXEqVHciHnVds6Z94eOVK69qFJKco +tRSTeNE8tPZJLz23j1pLrYOOXSHbidmZGU53MCQo1Yx9kLO6NW7Ji6WzAoGBALP4 +lEoE80Xbn3NEdvkZ1VcfzLvCmKCqMlvjuz+Xd8HPF2VaDznSq01VFAQMmAB7obJy +U8hC9OSxakn6Yy8JS9dBgBrUdxKxaibM4FQZxosOuMPHzMPDhniDkJPemnnmGtIL +/nbAkW8jdYpCjO9Z5PwwC92xYuvKmNGrLgSM8ZhhAoGAfgSZTpASXubM18E3ecfw +5z333wf9qEQgZj7i9MzByFZudyHUhv/FPW1ocUJf36Wu1dfofZg3noSL6oakrm2v +dFDo4PoyCStuF0w9SSzpIld01ZG0t7XqphY0DmshCXIXsqr7Vb4WrbBI7KX+b3Um +BzmROfaSud97NjQ/RA26OZk= +-----END PRIVATE KEY----- diff --git a/board/sandbox/capsule_priv_key_good.key b/board/sandbox/capsule_priv_key_good.key new file mode 100644 index 0000000..9a37f59 --- /dev/null +++ b/board/sandbox/capsule_priv_key_good.key @@ -0,0 +1,28 @@ +-----BEGIN PRIVATE KEY----- +MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCwBfaV0P1jRzS6 +13U1T+4VbuMVsxFXhwHJY5z5Fx6v+cWBf3K1ruK+7cEnW55ZHXvNE2JCkjMvISKm +hI/DLJWIPnAus8tFdU/R2u5oJbKI+b6GbuamO/CG9HsXZ58lOC6r2ckjixxovsA9 +SFshccdIv2YrwiVsWeyFpH+rB3/+cFbrgdWpaUc1367GkU/ZCnSRDBvVvzRRI1a4 +y2NogFqbZHXHENpzWNJ3TTXhf9dwM5HFGkmX7SA43Dtazae6CB4EaUKzLYWj3+ae +AQbdvBrupKZQz1PUKn7X6+BGaLujHthvibYppNegPvqbJ1xBbv59CQK+lRULwC05 +NYw5+sIxAgMBAAECggEAHn8h/knjpMAw/BAZP//VrYP1Nwy7u/Dpl9U43JUrXWzG +Uc3dd2nR4id6GBIRCLqJePnbQ9JlqMwyXyxHZhbC34SF1imTVbjh9+dY99VULdQr +NMphDrsCzLbt3pu24HFv8Jk+dniDFwi5cMSo+U3nq4xxrLIp3rBjwLHD5sNZYyEU +9xZnj7ziTn5X8da8iRxNpyzz2kQeVemJ0ahr/IkX718bkakSFMesGkln06vH7rAs +069SeqOPrFEbWYXI5iMktLugl3JZpzasRE48j0M42PuProgvT7jb8B35ZF7kn0jT +MqTIHglsJRWcSY0fAb2lHSAvd2vLLVunxr9PDWZvGQKBgQDVzVTuvo1CrVrQLy+B +tpy2k5mjR3qxAOcoWTnKcMErLe8imWWaxukODenP4XqQIX4Sl+X3BXxOqun0Klap +FEsI7TWSHf0eULFtFj0SCgqfRR+V/nblP05eO2nFXgr5YdNa1bWf/aMHplBo4q9e +bbAr4InUB7IGWL2cWjhOhWuJbQKBgQDSw81cBM+vGPUYH/wlxlTVgZCo2Dg2NHjt +LUBqvOZNr21j2F+w8t1vKmqwhkqpc5HIi3pHjEA5gZLTRtmf4GQyo973I6MGn4bS +eayOd6/+FkAi9DUD+WaF7yctJqeevav6KF2UCiz78OtCAU5Y9jFFJpuOANIztI7m +t7ZCUpMFVQKBgFnAsP7oj3SGQbFTnaXeeztKCx04TJExx9hwXIpXe0AdMF5d9wFa +r0tvG9Bg34rSBJLZoXhpnR2JMl2FyIuCMV219t84J6IqTdF1nH2OKZdi9TeKc28Z +fFSirGxmZkT6hDeFr5FScLYtY2QkhWomseY5hKK1+E4hwrd4SFruN46hAoGBAJgh +nzTBgEtqH1enlrCJhSiLmihV0dVGcNb559pjuXTvoG0GfKPT2gPowRPkCzZe5ia0 +jrHgSWd44MtCA8nEBW8MG9+VyJH6Si3Yh7ZaLB2iX+8bCL1yow8f/c44bZtGW0F5 +K3q1EZ1VW+rL2IqcQhog8P1CGHgb514f0x3yTo71AoGACGdb+Nb6lg8OSJPUcuuH +xsWk6RhkJl9bldTleS+QT3R9zO3FvbTwnCCYJboh5Cq/jVmiA7T+fcVAyEJNHSdm +hxbHdScuiJdNWL9+FczOkylnKH3VEdG3RS5lGdyi6r+miTMs3h8WfzGp4JINysjg +PUFskK36qGjASfkRUn0hizQ= +-----END PRIVATE KEY----- diff --git a/board/sandbox/capsule_pub_esl_good.esl b/board/sandbox/capsule_pub_esl_good.esl Binary files differnew file mode 100644 index 0000000..f8cc272 --- /dev/null +++ b/board/sandbox/capsule_pub_esl_good.esl diff --git a/board/sandbox/capsule_pub_key_bad.crt b/board/sandbox/capsule_pub_key_bad.crt new file mode 100644 index 0000000..2e8e5d5 --- /dev/null +++ b/board/sandbox/capsule_pub_key_bad.crt @@ -0,0 +1,19 @@ +-----BEGIN CERTIFICATE----- +MIIDDzCCAfegAwIBAgIUWw3vHYnrjoHUXytxSm2eYWzbYVAwDQYJKoZIhvcNAQEL +BQAwFjEUMBIGA1UEAwwLVEVTVF9TSUdORVIwIBcNMjMwODA0MTgwODEyWhgPMzAw +MzEwMDYxODA4MTJaMBYxFDASBgNVBAMMC1RFU1RfU0lHTkVSMIIBIjANBgkqhkiG +9w0BAQEFAAOCAQ8AMIIBCgKCAQEApj8NaRndsTVtKZXrEV5JHpN7sFAdOjbetbZ2 +b6TJASreCKJKhls9bWZbPmdgqr8Dn3LD2du3D0WErsUZzN2HS+DBuknj1e4v2Ejc +N66vAj/MyxrQmzSH7H7DXz0BLTwacOvu6TCSoY6qVdlNlEM2RIl+KpZ4S6cr9iTS +WoNu8n9H3i3SYux5yfcXb3F6QNQ0hpuMvgw4YGHiPAxLXhLurNE2EH5zmUkDniYv +tf0M9EufeLhSQd+zMhof5gdeSC2/IL2uJwN2shzgStHXfh0olAhmKy2Du2o/p380 +I/Tdak5cwpwtetN2zHM1OaZMHDg4OsT9Ep9dSekWMstHNKsySwIDAQABo1MwUTAd +BgNVHQ4EFgQUm9b8SnF811nweXSfGisfpzUHGwgwHwYDVR0jBBgwFoAUm9b8SnF8 +11nweXSfGisfpzUHGwgwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOC +AQEAaOZFOcQzF1MRekcBmIZMaHSWYxOUrVLzBNSNhFD8muYiUAAufrkyTUq0Mmat +w5hAnJ34VGpU1wxQlr/uwH7wpZZnGuj10rAp3tqES0g24AeH1bC9wmRs+rD6dcZR +YmZq6FxtV7Cv3pQX7lhDYbcBj2za3YT6I1+yczskAHR6KYYuJzKJ7XRVCL7ZlYRX +pUMZBQq2eAVWlW/c5iDT3KoGZUD9Of71F7qyUAqMMYafeDxguDz7gKstoXVCklQ+ +I4C7JKmRbrRvMgXx6O1clGhAsRZ0nNAtzi7XT5tD27qFwIPgwv48RWgsmPtzE03S +YGQ5WhYMdHOOjWmcV6MDkCpiSA== +-----END CERTIFICATE----- diff --git a/board/sandbox/capsule_pub_key_good.crt b/board/sandbox/capsule_pub_key_good.crt new file mode 100644 index 0000000..82d8576 --- /dev/null +++ b/board/sandbox/capsule_pub_key_good.crt @@ -0,0 +1,19 @@ +-----BEGIN CERTIFICATE----- +MIIDDzCCAfegAwIBAgIUUzrWhMi7oPFshQP6eFlccqf7exswDQYJKoZIhvcNAQEL +BQAwFjEUMBIGA1UEAwwLVEVTVF9TSUdORVIwIBcNMjMwODA0MTgwNzQyWhgPMzAw +MzEwMDYxODA3NDJaMBYxFDASBgNVBAMMC1RFU1RfU0lHTkVSMIIBIjANBgkqhkiG +9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsAX2ldD9Y0c0utd1NU/uFW7jFbMRV4cByWOc ++Rcer/nFgX9yta7ivu3BJ1ueWR17zRNiQpIzLyEipoSPwyyViD5wLrPLRXVP0dru +aCWyiPm+hm7mpjvwhvR7F2efJTguq9nJI4scaL7APUhbIXHHSL9mK8IlbFnshaR/ +qwd//nBW64HVqWlHNd+uxpFP2Qp0kQwb1b80USNWuMtjaIBam2R1xxDac1jSd001 +4X/XcDORxRpJl+0gONw7Ws2nuggeBGlCsy2Fo9/mngEG3bwa7qSmUM9T1Cp+1+vg +Rmi7ox7Yb4m2KaTXoD76mydcQW7+fQkCvpUVC8AtOTWMOfrCMQIDAQABo1MwUTAd +BgNVHQ4EFgQUHvG7Xchqzwdggky+oyzlpNem8UowHwYDVR0jBBgwFoAUHvG7Xchq +zwdggky+oyzlpNem8UowDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOC +AQEAUn1ncSqeXbQAHNrVOFldLwu70hNlMxf2z4EfH2M7vJgrpwkRuIFw7PXNITBh +CImd/ghm5NGFysrK7BwdHkFvUXZV3rE93BhcLC9leWfky33kW9olIzpE14i5FfBn +ABmaokPhOrzAneGzU35sZHNotlqOrzgpKVkpOWrykhYZ5Qjk8Sz0xvzuG8TJc20s +2og+W8Rm2u/xI9xPxtFbq9vUjvFS35o1pm+vkzpgNdo4YS1PG37BW/aopsooLSk7 +9Rxv5vzNXtQqeZ5qBdKbAVh3OsgqwigTmXVvOX3xpy9r9qiimhaISxCt83RZ7wQW +I19t9pXyxAi6u7MRhJZlAeH/3w== +-----END CERTIFICATE----- diff --git a/board/siemens/capricorn/spl.c b/board/siemens/capricorn/spl.c index 8e077d7..e160c61 100644 --- a/board/siemens/capricorn/spl.c +++ b/board/siemens/capricorn/spl.c @@ -10,6 +10,7 @@ #include <spl.h> #include <dm.h> #include <asm/global_data.h> +#include <asm/sections.h> #include <dm/uclass.h> #include <dm/device.h> #include <dm/uclass-internal.h> diff --git a/board/siemens/iot2050/iot2050.env b/board/siemens/iot2050/iot2050.env index caa9f80..8bbd7ab 100644 --- a/board/siemens/iot2050/iot2050.env +++ b/board/siemens/iot2050/iot2050.env @@ -6,7 +6,7 @@ * Jan Kiszka <jan.kiszka@siemens.com> */ -#include <env/ti/ti_armv7_common.env> +#include <env/ti/ti_common.env> usb_pgood_delay=900 diff --git a/board/sifive/unleashed/unleashed.c b/board/sifive/unleashed/unleashed.c index b6ab06a..3c5dd50 100644 --- a/board/sifive/unleashed/unleashed.c +++ b/board/sifive/unleashed/unleashed.c @@ -122,7 +122,7 @@ void *board_fdt_blob_setup(int *err) return (ulong *)(uintptr_t)gd->arch.firmware_fdt_addr; } - return (ulong *)&_end; + return (ulong *)_end; } int board_init(void) diff --git a/board/sifive/unmatched/unmatched.c b/board/sifive/unmatched/unmatched.c index 6295dee..6675548 100644 --- a/board/sifive/unmatched/unmatched.c +++ b/board/sifive/unmatched/unmatched.c @@ -19,7 +19,7 @@ void *board_fdt_blob_setup(int *err) return (ulong *)(uintptr_t)gd->arch.firmware_fdt_addr; } - return (ulong *)&_end; + return (ulong *)_end; } int board_init(void) diff --git a/board/softing/vining_2000/vining_2000.c b/board/softing/vining_2000/vining_2000.c index aaeeee3..4483bd7 100644 --- a/board/softing/vining_2000/vining_2000.c +++ b/board/softing/vining_2000/vining_2000.c @@ -19,6 +19,7 @@ #include <asm/mach-imx/iomux-v3.h> #include <asm/io.h> #include <asm/mach-imx/mxc_i2c.h> +#include <asm/sections.h> #include <env.h> #include <linux/bitops.h> #include <linux/delay.h> diff --git a/board/solidrun/mx6cuboxi/mx6cuboxi.c b/board/solidrun/mx6cuboxi/mx6cuboxi.c index 6fa5cf4..e119330 100644 --- a/board/solidrun/mx6cuboxi/mx6cuboxi.c +++ b/board/solidrun/mx6cuboxi/mx6cuboxi.c @@ -32,6 +32,7 @@ #include <asm/mach-imx/iomux-v3.h> #include <asm/mach-imx/sata.h> #include <asm/mach-imx/video.h> +#include <asm/sections.h> #include <mmc.h> #include <fsl_esdhc_imx.h> #include <malloc.h> diff --git a/board/st/common/stm32mp_dfu.c b/board/st/common/stm32mp_dfu.c index 1cf4a3d..faee953 100644 --- a/board/st/common/stm32mp_dfu.c +++ b/board/st/common/stm32mp_dfu.c @@ -14,6 +14,7 @@ #include <mtd.h> #include <mtd_node.h> #include <asm/arch/stm32prog.h> +#include <linux/printk.h> #define DFU_ALT_BUF_LEN SZ_1K diff --git a/board/st/stih410-b2260/board.c b/board/st/stih410-b2260/board.c index cd3a7dc..e21cbc2 100644 --- a/board/st/stih410-b2260/board.c +++ b/board/st/stih410-b2260/board.c @@ -50,9 +50,9 @@ static struct dwc3_device dwc3_device_data = { .index = 0, }; -int usb_gadget_handle_interrupts(int index) +int dm_usb_gadget_handle_interrupts(struct udevice *dev) { - dwc3_uboot_handle_interrupt(index); + dwc3_uboot_handle_interrupt(dev); return 0; } diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c index 3205a31..8f5719c 100644 --- a/board/st/stm32mp1/stm32mp1.c +++ b/board/st/stm32mp1/stm32mp1.c @@ -44,6 +44,7 @@ #include <linux/delay.h> #include <linux/err.h> #include <linux/iopoll.h> +#include <linux/printk.h> #include <power/regulator.h> #include <usb/dwc2_udc.h> diff --git a/board/starfive/visionfive2/spl.c b/board/starfive/visionfive2/spl.c index 7acd399..ad5f71a 100644 --- a/board/starfive/visionfive2/spl.c +++ b/board/starfive/visionfive2/spl.c @@ -218,7 +218,7 @@ void board_init_f(ulong dummy) if (ret) panic("spl_early_init() failed: %d\n", ret); - riscv_cpu_setup(NULL, NULL); + riscv_cpu_setup(); preloader_console_init(); /* Set the parent clock of cpu_root clock to pll0, diff --git a/board/starfive/visionfive2/starfive_visionfive2.c b/board/starfive/visionfive2/starfive_visionfive2.c index 19b7b44..78e118d 100644 --- a/board/starfive/visionfive2/starfive_visionfive2.c +++ b/board/starfive/visionfive2/starfive_visionfive2.c @@ -90,7 +90,7 @@ void *board_fdt_blob_setup(int *err) return (ulong *)(uintptr_t)gd->arch.firmware_fdt_addr; } - return (ulong *)&_end; + return (ulong *)_end; } int ft_board_setup(void *blob, struct bd_info *bd) diff --git a/board/sunxi/board.c b/board/sunxi/board.c index f321cd5..ebaa943 100644 --- a/board/sunxi/board.c +++ b/board/sunxi/board.c @@ -33,7 +33,7 @@ #include <asm/arch/sys_proto.h> #include <asm/global_data.h> #include <linux/delay.h> -#include <u-boot/crc.h> +#include <linux/printk.h> #ifndef CONFIG_ARM64 #include <asm/armv7.h> #endif diff --git a/board/synopsys/hsdk/clk-lib.c b/board/synopsys/hsdk/clk-lib.c index bd43179..be76d6c 100644 --- a/board/synopsys/hsdk/clk-lib.c +++ b/board/synopsys/hsdk/clk-lib.c @@ -8,6 +8,7 @@ #include <log.h> #include <malloc.h> #include <dm/device.h> +#include <linux/printk.h> #include "clk-lib.h" diff --git a/board/synopsys/hsdk/env-lib.c b/board/synopsys/hsdk/env-lib.c index fd54ac7..d85e816 100644 --- a/board/synopsys/hsdk/env-lib.c +++ b/board/synopsys/hsdk/env-lib.c @@ -7,6 +7,7 @@ #include "env-lib.h" #include <env.h> #include <log.h> +#include <linux/printk.h> #define MAX_CMD_LEN 25 diff --git a/board/technexion/pico-imx6ul/spl.c b/board/technexion/pico-imx6ul/spl.c index 251f5a1..ff56fd8 100644 --- a/board/technexion/pico-imx6ul/spl.c +++ b/board/technexion/pico-imx6ul/spl.c @@ -14,6 +14,7 @@ #include <asm/gpio.h> #include <asm/mach-imx/iomux-v3.h> #include <asm/mach-imx/boot_mode.h> +#include <asm/sections.h> #include <fsl_esdhc_imx.h> #include <linux/libfdt.h> #include <spl.h> diff --git a/board/technexion/pico-imx7d/spl.c b/board/technexion/pico-imx7d/spl.c index f86fee9..c6b21aa 100644 --- a/board/technexion/pico-imx7d/spl.c +++ b/board/technexion/pico-imx7d/spl.c @@ -16,6 +16,7 @@ #include <asm/arch-mx7/mx7-ddr.h> #include <asm/mach-imx/iomux-v3.h> #include <asm/gpio.h> +#include <asm/sections.h> #include <fsl_esdhc_imx.h> #include <spl.h> diff --git a/board/technexion/pico-imx8mq/spl.c b/board/technexion/pico-imx8mq/spl.c index 2afb4d3..1a9c799 100644 --- a/board/technexion/pico-imx8mq/spl.c +++ b/board/technexion/pico-imx8mq/spl.c @@ -16,6 +16,7 @@ #include <asm/mach-imx/gpio.h> #include <asm/mach-imx/iomux-v3.h> #include <asm/mach-imx/mxc_i2c.h> +#include <asm/sections.h> #include <linux/delay.h> #include <errno.h> #include <fsl_esdhc_imx.h> diff --git a/board/ti/am43xx/board.c b/board/ti/am43xx/board.c index 87e552a..58bfe7c 100644 --- a/board/ti/am43xx/board.c +++ b/board/ti/am43xx/board.c @@ -760,13 +760,13 @@ static struct ti_usb_phy_device usb_phy2_device = { .index = 1, }; -int usb_gadget_handle_interrupts(int index) +int dm_usb_gadget_handle_interrupts(struct udevice *dev) { u32 status; - status = dwc3_omap_uboot_interrupt_status(index); + status = dwc3_omap_uboot_interrupt_status(dev); if (status) - dwc3_uboot_handle_interrupt(index); + dwc3_uboot_handle_interrupt(dev); return 0; } diff --git a/board/ti/am62ax/am62ax.env b/board/ti/am62ax/am62ax.env index 3f7c333..bfed7f3 100644 --- a/board/ti/am62ax/am62ax.env +++ b/board/ti/am62ax/am62ax.env @@ -1,4 +1,4 @@ -#include <env/ti/ti_armv7_common.env> +#include <env/ti/ti_common.env> #include <env/ti/mmc.env> default_device_tree=ti/k3-am62a7-sk.dtb diff --git a/board/ti/am62x/MAINTAINERS b/board/ti/am62x/MAINTAINERS index 105e741..6ac4e65 100644 --- a/board/ti/am62x/MAINTAINERS +++ b/board/ti/am62x/MAINTAINERS @@ -6,3 +6,10 @@ F: board/ti/am62x/ F: include/configs/am62x_evm.h F: configs/am62x_evm_r5_defconfig F: configs/am62x_evm_a53_defconfig + +BEAGLEPLAY BOARD +M: Nishanth Menon <nm@ti.com> +M: Robert Nelson <robertcnelson@gmail.com> +M: Tom Rini <trini@konsulko.com> +S: Maintained +N: beagleplay diff --git a/board/ti/am62x/am62x.env b/board/ti/am62x/am62x.env index f2dc878..22a6c2c 100644 --- a/board/ti/am62x/am62x.env +++ b/board/ti/am62x/am62x.env @@ -1,23 +1,21 @@ -#include <env/ti/ti_armv7_common.env> +#include <env/ti/ti_common.env> +#include <env/ti/default_findfdt.env> #include <env/ti/mmc.env> -default_device_tree=ti/k3-am625-sk.dtb -findfdt= - setenv name_fdt ${default_device_tree}; - setenv fdtfile ${name_fdt} name_kern=Image console=ttyS2,115200n8 args_all=setenv optargs ${optargs} earlycon=ns16550a,mmio32,0x02800000 ${mtdparts} run_kern=booti ${loadaddr} ${rd_spec} ${fdtaddr} +boot_targets=ti_mmc mmc0 mmc1 usb pxe dhcp boot=mmc mmcdev=1 bootpart=1:2 bootdir=/boot rd_spec=- -splashfile=ti.gz +splashfile=ti_logo_414x97_32bpp.bmp.gz splashimage=0x80200000 splashpos=m,m splashsource=sf diff --git a/board/ti/am62x/beagleplay.env b/board/ti/am62x/beagleplay.env new file mode 100644 index 0000000..4f0a94a --- /dev/null +++ b/board/ti/am62x/beagleplay.env @@ -0,0 +1,19 @@ +#include <env/ti/ti_common.env> +#include <env/ti/default_findfdt.env> +#include <env/ti/mmc.env> + +name_kern=Image +console=ttyS2,115200n8 +args_all=setenv optargs ${optargs} earlycon=ns16550a,mmio32,0x02800000 +run_kern=booti ${loadaddr} ${rd_spec} ${fdtaddr} +set_led_state_fail_load= led led-0 off; led led-1 on; + led led-2 off; led led-3 on; led led-4 off +set_led_state_start_load=led led-0 on; led led-1 off; + led led-2 on; led led-3 off; led led-4 on +boot=mmc +mmcdev=1 +bootpart=1:1 +bootdir=/boot +boot_targets=mmc1 mmc0 usb pxe +bootmeths=script extlinux efi pxe +rd_spec=- diff --git a/board/ti/am62x/beagleplay_a53.config b/board/ti/am62x/beagleplay_a53.config new file mode 100644 index 0000000..f038041 --- /dev/null +++ b/board/ti/am62x/beagleplay_a53.config @@ -0,0 +1,55 @@ +# Defconfig fragment to apply on top of am62x_evm_a53_defconfig + +CONFIG_DEFAULT_DEVICE_TREE="k3-am625-beagleplay" +CONFIG_OF_LIST="k3-am625-beagleplay" +CONFIG_SPL_OF_LIST="k3-am625-beagleplay" +CONFIG_BOOTCOMMAND="run set_led_state_start_load;run findfdt; run envboot; bootflow scan -lb;run set_led_state_fail_load" +CONFIG_EXT4_WRITE=y +CONFIG_LZO=y +CONFIG_AUTOBOOT_KEYED=y +CONFIG_AUTOBOOT_PROMPT="Press SPACE to abort autoboot in %d seconds\n" +CONFIG_AUTOBOOT_DELAY_STR="d" +CONFIG_AUTOBOOT_STOP_STR=" " +# Use the Beagleplay env file +CONFIG_ENV_SOURCE_FILE="beagleplay" +# Do not use emmc boot - we will use FS only +CONFIG_SUPPORT_EMMC_BOOT=n +CONFIG_MMC_IO_VOLTAGE=y +# CONFIG_SPL_MMC_IO_VOLTAGE is not set +CONFIG_MMC_UHS_SUPPORT=y +# CONFIG_SPL_MMC_UHS_SUPPORT is not set +CONFIG_MMC_HS200_SUPPORT=y +# CONFIG_SPL_MMC_HS200_SUPPORT is not set +# Enable GPIO control +CONFIG_DM_GPIO=y +CONFIG_SPL_GPIO=y +CONFIG_DA8XX_GPIO=y +CONFIG_CMD_GPIO=y +CONFIG_CMD_GPIO_READ=y +# Enable LEDs +CONFIG_LED=y +CONFIG_LED_GPIO=y +CONFIG_SPL_LED=y +CONFIG_SPL_LED_GPIO=y +# Enable I2C bus +CONFIG_SPL_I2C=y +CONFIG_DM_I2C=y +CONFIG_SYS_I2C_OMAP24XX=y +CONFIG_CMD_I2C=y +# Regulator +CONFIG_DM_REGULATOR=y +CONFIG_DM_REGULATOR_FIXED=y +CONFIG_DM_REGULATOR_GPIO=y +CONFIG_CMD_REGULATOR=y +CONFIG_DM_REGULATOR_TPS65219=y +CONFIG_DM_PMIC=y +CONFIG_PMIC_TPS65219=y +CONFIG_CMD_PMIC=y +# Uses Realtek phy rather than TI phy +CONFIG_PHY_TI_DP83867=n +CONFIG_PHY_REALTEK=y +# No SPI flash on Beagleplay +CONFIG_SPI=n +CONFIG_SPI_FLASH=n +CONFIG_SPL_DM_SPI_FLASH=n +CONFIG_SPL_SPI_FLASH_SUPPORT=n diff --git a/board/ti/am62x/beagleplay_r5.config b/board/ti/am62x/beagleplay_r5.config new file mode 100644 index 0000000..4ee0375 --- /dev/null +++ b/board/ti/am62x/beagleplay_r5.config @@ -0,0 +1,15 @@ +# Defconfig fragment to apply on top of: +# am62x_evm_r5_defconfig +# +CONFIG_DEFAULT_DEVICE_TREE="k3-am625-r5-beagleplay" +CONFIG_OF_LIST="k3-am625-r5-beagleplay" +CONFIG_SPL_OF_LIST="k3-am625-r5-beagleplay" +# Do spl board init +CONFIG_SPL_BOARD_INIT=y +# Do not use emmc boot - we will use FS only +CONFIG_SUPPORT_EMMC_BOOT=n +# No SPI flash on Beagleplay +CONFIG_SPI=n +CONFIG_SPI_FLASH=n +CONFIG_SPL_DM_SPI_FLASH=n +CONFIG_SPL_SPI_FLASH_SUPPORT=n diff --git a/board/ti/am64x/am64x.env b/board/ti/am64x/am64x.env index 1567907..68e4222 100644 --- a/board/ti/am64x/am64x.env +++ b/board/ti/am64x/am64x.env @@ -1,4 +1,4 @@ -#include <env/ti/ti_armv7_common.env> +#include <env/ti/ti_common.env> #include <env/ti/mmc.env> #include <env/ti/k3_dfu.env> diff --git a/board/ti/am64x/evm.c b/board/ti/am64x/evm.c index 96f4e30..a080b2b 100644 --- a/board/ti/am64x/evm.c +++ b/board/ti/am64x/evm.c @@ -18,7 +18,8 @@ #include "../common/board_detect.h" -#define board_is_am64x_gpevm() board_ti_k3_is("AM64-GPEVM") +#define board_is_am64x_gpevm() (board_ti_k3_is("AM64-GPEVM") || \ + board_ti_k3_is("AM64-HSEVM")) #define board_is_am64x_skevm() (board_ti_k3_is("AM64-SKEVM") || \ board_ti_k3_is("AM64B-SKEVM")) diff --git a/board/ti/am65x/am65x.env b/board/ti/am65x/am65x.env index 755bff2..286b9c3 100644 --- a/board/ti/am65x/am65x.env +++ b/board/ti/am65x/am65x.env @@ -1,4 +1,4 @@ -#include <env/ti/ti_armv7_common.env> +#include <env/ti/ti_common.env> #include <env/ti/mmc.env> #include <env/ti/k3_dfu.env> #if CONFIG_CMD_REMOTEPROC diff --git a/board/ti/am65x/evm.c b/board/ti/am65x/evm.c index d52ac33..8bb13ef 100644 --- a/board/ti/am65x/evm.c +++ b/board/ti/am65x/evm.c @@ -20,6 +20,7 @@ #include <asm/omap_common.h> #include <env.h> #include <spl.h> +#include <linux/printk.h> #include "../common/board_detect.h" diff --git a/board/ti/common/board_detect.c b/board/ti/common/board_detect.c index 9a53884..ac39b25 100644 --- a/board/ti/common/board_detect.c +++ b/board/ti/common/board_detect.c @@ -19,6 +19,7 @@ #include <mmc.h> #include <errno.h> #include <malloc.h> +#include <linux/printk.h> #include "board_detect.h" diff --git a/board/ti/j721e/evm.c b/board/ti/j721e/evm.c index 38fe447..d4f7c1d 100644 --- a/board/ti/j721e/evm.c +++ b/board/ti/j721e/evm.c @@ -22,6 +22,7 @@ #include <spl.h> #include <dm.h> #include <dm/uclass-internal.h> +#include <linux/printk.h> #include "../common/board_detect.h" diff --git a/board/ti/j721e/j721e.env b/board/ti/j721e/j721e.env index 2f2fb05..8cc8232 100644 --- a/board/ti/j721e/j721e.env +++ b/board/ti/j721e/j721e.env @@ -1,4 +1,4 @@ -#include <env/ti/ti_armv7_common.env> +#include <env/ti/ti_common.env> #include <env/ti/mmc.env> #include <env/ti/ufs.env> #include <env/ti/k3_dfu.env> diff --git a/board/ti/j721s2/j721s2.env b/board/ti/j721s2/j721s2.env index 6825b14..64e3d9d 100644 --- a/board/ti/j721s2/j721s2.env +++ b/board/ti/j721s2/j721s2.env @@ -1,4 +1,4 @@ -#include <env/ti/ti_armv7_common.env> +#include <env/ti/ti_common.env> #include <env/ti/mmc.env> #include <env/ti/ufs.env> #include <env/ti/k3_dfu.env> diff --git a/board/ti/ks2_evm/k2e_evm.env b/board/ti/ks2_evm/k2e_evm.env index a145db5..3dbb793 100644 --- a/board/ti/ks2_evm/k2e_evm.env +++ b/board/ti/ks2_evm/k2e_evm.env @@ -1,4 +1,4 @@ -#include <env/ti/ti_armv7_common.env> +#include <env/ti/ti_common.env> #include <env/ti/ti_armv7_keystone2.env> findfdt=setenv fdtfile ${name_fdt} diff --git a/board/ti/ks2_evm/k2g_evm.env b/board/ti/ks2_evm/k2g_evm.env index 4f4941d..2b500fc 100644 --- a/board/ti/ks2_evm/k2g_evm.env +++ b/board/ti/ks2_evm/k2g_evm.env @@ -1,4 +1,4 @@ -#include <env/ti/ti_armv7_common.env> +#include <env/ti/ti_common.env> #include <env/ti/ti_armv7_keystone2.env> #include <env/ti/mmc.env> diff --git a/board/ti/ks2_evm/k2hk_evm.env b/board/ti/ks2_evm/k2hk_evm.env index 0714a51..9991b76 100644 --- a/board/ti/ks2_evm/k2hk_evm.env +++ b/board/ti/ks2_evm/k2hk_evm.env @@ -1,4 +1,4 @@ -#include <env/ti/ti_armv7_common.env> +#include <env/ti/ti_common.env> #include <env/ti/ti_armv7_keystone2.env> findfdt=setenv fdtfile ${name_fdt} diff --git a/board/ti/ks2_evm/k2l_evm.env b/board/ti/ks2_evm/k2l_evm.env index e8a803a..4e2debc 100644 --- a/board/ti/ks2_evm/k2l_evm.env +++ b/board/ti/ks2_evm/k2l_evm.env @@ -1,4 +1,4 @@ -#include <env/ti/ti_armv7_common.env> +#include <env/ti/ti_common.env> #include <env/ti/ti_armv7_keystone2.env> findfdt=setenv fdtfile ${name_fdt} diff --git a/board/toradex/apalis-tk1/apalis-tk1.c b/board/toradex/apalis-tk1/apalis-tk1.c index 86b1040..8513431 100644 --- a/board/toradex/apalis-tk1/apalis-tk1.c +++ b/board/toradex/apalis-tk1/apalis-tk1.c @@ -17,6 +17,7 @@ #include <fdt_support.h> #include <pci_tegra.h> #include <linux/delay.h> +#include <linux/printk.h> #include <power/as3722.h> #include <power/pmic.h> diff --git a/board/toradex/apalis_imx6/apalis_imx6.c b/board/toradex/apalis_imx6/apalis_imx6.c index 3c7cfa3..fa6b722 100644 --- a/board/toradex/apalis_imx6/apalis_imx6.c +++ b/board/toradex/apalis_imx6/apalis_imx6.c @@ -30,6 +30,7 @@ #include <asm/mach-imx/iomux-v3.h> #include <asm/mach-imx/sata.h> #include <asm/mach-imx/video.h> +#include <asm/sections.h> #include <dm/device-internal.h> #include <dm/platform_data/serial_mxc.h> #include <dwc_ahsata.h> diff --git a/board/toradex/colibri_imx6/colibri_imx6.c b/board/toradex/colibri_imx6/colibri_imx6.c index 677caa4..e6c9b10 100644 --- a/board/toradex/colibri_imx6/colibri_imx6.c +++ b/board/toradex/colibri_imx6/colibri_imx6.c @@ -29,6 +29,7 @@ #include <asm/mach-imx/iomux-v3.h> #include <asm/mach-imx/sata.h> #include <asm/mach-imx/video.h> +#include <asm/sections.h> #include <cpu.h> #include <dm/platform_data/serial_mxc.h> #include <fsl_esdhc_imx.h> diff --git a/board/toradex/verdin-am62/verdin-am62.c b/board/toradex/verdin-am62/verdin-am62.c index a3d1d07..d09dda5 100644 --- a/board/toradex/verdin-am62/verdin-am62.c +++ b/board/toradex/verdin-am62/verdin-am62.c @@ -28,8 +28,8 @@ int dram_init(void) { gd->ram_size = get_ram_size((long *)CFG_SYS_SDRAM_BASE, CFG_SYS_SDRAM_SIZE); - if (gd->ram_size < SZ_64M) - puts("## WARNING: Less than 64MB RAM detected\n"); + if (gd->ram_size < SZ_512M) + puts("## WARNING: Less than 512MB RAM detected\n"); return 0; } diff --git a/board/toradex/verdin-imx8mm/spl.c b/board/toradex/verdin-imx8mm/spl.c index 9d54d60..afa3686 100644 --- a/board/toradex/verdin-imx8mm/spl.c +++ b/board/toradex/verdin-imx8mm/spl.c @@ -16,6 +16,7 @@ #include <asm/io.h> #include <asm/mach-imx/boot_mode.h> #include <asm/mach-imx/iomux-v3.h> +#include <asm/sections.h> #include <cpu_func.h> #include <dm/device.h> #include <dm/device-internal.h> diff --git a/board/udoo/neo/neo.c b/board/udoo/neo/neo.c index 1287f71..730e266 100644 --- a/board/udoo/neo/neo.c +++ b/board/udoo/neo/neo.c @@ -17,6 +17,7 @@ #include <asm/global_data.h> #include <asm/gpio.h> #include <asm/mach-imx/iomux-v3.h> +#include <asm/sections.h> #include <dm.h> #include <env.h> #include <mmc.h> diff --git a/board/variscite/dart_6ul/spl.c b/board/variscite/dart_6ul/spl.c index 17b1ae7..1dff69c 100644 --- a/board/variscite/dart_6ul/spl.c +++ b/board/variscite/dart_6ul/spl.c @@ -12,6 +12,7 @@ #include <asm/arch/mx6-ddr.h> #include <asm/arch/mx6-pins.h> #include <asm/arch/crm_regs.h> +#include <asm/sections.h> #include <fsl_esdhc_imx.h> #define UART_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE | \ diff --git a/board/variscite/imx8mn_var_som/spl.c b/board/variscite/imx8mn_var_som/spl.c index 41e7050..01a63c6 100644 --- a/board/variscite/imx8mn_var_som/spl.c +++ b/board/variscite/imx8mn_var_som/spl.c @@ -13,6 +13,7 @@ #include <asm/arch/sys_proto.h> #include <asm/mach-imx/boot_mode.h> #include <asm/mach-imx/gpio.h> +#include <asm/sections.h> #include <dm/device.h> #include <dm/uclass.h> diff --git a/board/xilinx/common/board.c b/board/xilinx/common/board.c index 906d5e3..9309b07 100644 --- a/board/xilinx/common/board.c +++ b/board/xilinx/common/board.c @@ -374,12 +374,12 @@ void *board_fdt_blob_setup(int *err) * region */ if (IS_ENABLED(CONFIG_SPL_SEPARATE_BSS)) - fdt_blob = (ulong *)&_image_binary_end; + fdt_blob = (ulong *)_image_binary_end; else - fdt_blob = (ulong *)&__bss_end; + fdt_blob = (ulong *)__bss_end; } else { /* FDT is at end of image */ - fdt_blob = (ulong *)&_end; + fdt_blob = (ulong *)_end; } if (fdt_magic(fdt_blob) == FDT_MAGIC) @@ -411,19 +411,44 @@ int board_late_init_xilinx(void) int i, id, macid = 0; struct xilinx_board_description *desc; phys_size_t bootm_size = gd->ram_top - gd->ram_base; + u64 bootscr_flash_offset, bootscr_flash_size; if (!IS_ENABLED(CONFIG_MICROBLAZE)) { ulong scriptaddr; + u64 bootscr_address; + u64 bootscr_offset; + + /* Fetch bootscr_address/bootscr_offset from DT and update */ + if (!ofnode_read_bootscript_address(&bootscr_address, + &bootscr_offset)) { + if (bootscr_offset) + ret |= env_set_hex("scriptaddr", + gd->ram_base + + bootscr_offset); + else + ret |= env_set_hex("scriptaddr", + bootscr_address); + } else { + /* Update scriptaddr(bootscr offset) from env */ + scriptaddr = env_get_hex("scriptaddr", 0); + ret |= env_set_hex("scriptaddr", + gd->ram_base + scriptaddr); + } + } - scriptaddr = env_get_hex("scriptaddr", 0); - ret |= env_set_hex("scriptaddr", gd->ram_base + scriptaddr); + if (!ofnode_read_bootscript_flash(&bootscr_flash_offset, + &bootscr_flash_size)) { + ret |= env_set_hex("script_offset_f", bootscr_flash_offset); + ret |= env_set_hex("script_size_f", bootscr_flash_size); + } else { + debug("!!! Please define bootscr-flash-offset via DT !!!\n"); + ret |= env_set_hex("script_offset_f", + CONFIG_BOOT_SCRIPT_OFFSET); } if (IS_ENABLED(CONFIG_ARCH_ZYNQ) || IS_ENABLED(CONFIG_MICROBLAZE)) bootm_size = min(bootm_size, (phys_size_t)(SZ_512M + SZ_256M)); - ret |= env_set_hex("script_offset_f", CONFIG_BOOT_SCRIPT_OFFSET); - ret |= env_set_addr("bootm_low", (void *)gd->ram_base); ret |= env_set_addr("bootm_size", (void *)bootm_size); diff --git a/board/xilinx/versal-net/board.c b/board/xilinx/versal-net/board.c index f0d2224..c18be0c 100644 --- a/board/xilinx/versal-net/board.c +++ b/board/xilinx/versal-net/board.c @@ -194,25 +194,17 @@ static u8 versal_net_get_bootmode(void) return bootmode; } -int board_late_init(void) +static int boot_targets_setup(void) { u8 bootmode; struct udevice *dev; int bootseq = -1; int bootseq_len = 0; int env_targets_len = 0; - const char *mode; + const char *mode = NULL; char *new_targets; char *env_targets; - if (!(gd->flags & GD_FLG_ENV_DEFAULT)) { - debug("Saved variables - Skipping\n"); - return 0; - } - - if (!IS_ENABLED(CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG)) - return 0; - bootmode = versal_net_get_bootmode(); puts("Bootmode: "); @@ -229,8 +221,8 @@ int board_late_init(void) puts("QSPI_MODE_24\n"); if (uclass_get_device_by_name(UCLASS_SPI, "spi@f1030000", &dev)) { - puts("Boot from QSPI but without QSPI enabled!\n"); - return -1; + debug("QSPI driver for QSPI device is not present\n"); + break; } mode = "xspi"; bootseq = dev_seq(dev); @@ -239,8 +231,8 @@ int board_late_init(void) puts("QSPI_MODE_32\n"); if (uclass_get_device_by_name(UCLASS_SPI, "spi@f1030000", &dev)) { - puts("Boot from QSPI but without QSPI enabled!\n"); - return -1; + debug("QSPI driver for QSPI device is not present\n"); + break; } mode = "xspi"; bootseq = dev_seq(dev); @@ -249,8 +241,8 @@ int board_late_init(void) puts("OSPI_MODE\n"); if (uclass_get_device_by_name(UCLASS_SPI, "spi@f1010000", &dev)) { - puts("Boot from OSPI but without OSPI enabled!\n"); - return -1; + debug("OSPI driver for OSPI device is not present\n"); + break; } mode = "xspi"; bootseq = dev_seq(dev); @@ -264,8 +256,8 @@ int board_late_init(void) puts("SD_MODE\n"); if (uclass_get_device_by_name(UCLASS_MMC, "mmc@f1040000", &dev)) { - puts("Boot from SD0 but without SD0 enabled!\n"); - return -1; + debug("SD0 driver for SD0 device is not present\n"); + break; } debug("mmc0 device found at %p, seq %d\n", dev, dev_seq(dev)); @@ -279,8 +271,8 @@ int board_late_init(void) puts("SD_MODE1\n"); if (uclass_get_device_by_name(UCLASS_MMC, "mmc@f1050000", &dev)) { - puts("Boot from SD1 but without SD1 enabled!\n"); - return -1; + debug("SD1 driver for SD1 device is not present\n"); + break; } debug("mmc1 device found at %p, seq %d\n", dev, dev_seq(dev)); @@ -288,37 +280,59 @@ int board_late_init(void) bootseq = dev_seq(dev); break; default: - mode = ""; printf("Invalid Boot Mode:0x%x\n", bootmode); break; } - if (bootseq >= 0) { - bootseq_len = snprintf(NULL, 0, "%i", bootseq); - debug("Bootseq len: %x\n", bootseq_len); + if (mode) { + if (bootseq >= 0) { + bootseq_len = snprintf(NULL, 0, "%i", bootseq); + debug("Bootseq len: %x\n", bootseq_len); + } + + /* + * One terminating char + one byte for space between mode + * and default boot_targets + */ + env_targets = env_get("boot_targets"); + if (env_targets) + env_targets_len = strlen(env_targets); + + new_targets = calloc(1, strlen(mode) + env_targets_len + 2 + + bootseq_len); + if (!new_targets) + return -ENOMEM; + + if (bootseq >= 0) + sprintf(new_targets, "%s%x %s", mode, bootseq, + env_targets ? env_targets : ""); + else + sprintf(new_targets, "%s %s", mode, + env_targets ? env_targets : ""); + + env_set("boot_targets", new_targets); } - /* - * One terminating char + one byte for space between mode - * and default boot_targets - */ - env_targets = env_get("boot_targets"); - if (env_targets) - env_targets_len = strlen(env_targets); - - new_targets = calloc(1, strlen(mode) + env_targets_len + 2 + - bootseq_len); - if (!new_targets) - return -ENOMEM; - - if (bootseq >= 0) - sprintf(new_targets, "%s%x %s", mode, bootseq, - env_targets ? env_targets : ""); - else - sprintf(new_targets, "%s %s", mode, - env_targets ? env_targets : ""); + return 0; +} + +int board_late_init(void) +{ + int ret; + + if (!(gd->flags & GD_FLG_ENV_DEFAULT)) { + debug("Saved variables - Skipping\n"); + return 0; + } - env_set("boot_targets", new_targets); + if (!IS_ENABLED(CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG)) + return 0; + + if (IS_ENABLED(CONFIG_DISTRO_DEFAULTS)) { + ret = boot_targets_setup(); + if (ret) + return ret; + } return board_late_init_xilinx(); } diff --git a/board/xilinx/versal/board.c b/board/xilinx/versal/board.c index 60bf37d..e4bdd5d 100644 --- a/board/xilinx/versal/board.c +++ b/board/xilinx/versal/board.c @@ -126,25 +126,17 @@ static u8 versal_get_bootmode(void) return bootmode; } -int board_late_init(void) +static int boot_targets_setup(void) { u8 bootmode; struct udevice *dev; int bootseq = -1; int bootseq_len = 0; int env_targets_len = 0; - const char *mode; + const char *mode = NULL; char *new_targets; char *env_targets; - if (!(gd->flags & GD_FLG_ENV_DEFAULT)) { - debug("Saved variables - Skipping\n"); - return 0; - } - - if (!IS_ENABLED(CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG)) - return 0; - bootmode = versal_get_bootmode(); puts("Bootmode: "); @@ -175,8 +167,8 @@ int board_late_init(void) "mmc@f1050000", &dev) && uclass_get_device_by_name(UCLASS_MMC, "sdhci@f1050000", &dev)) { - puts("Boot from EMMC but without SD1 enabled!\n"); - return -1; + debug("SD1 driver for SD1 device is not present\n"); + break; } debug("mmc1 device found at %p, seq %d\n", dev, dev_seq(dev)); mode = "mmc"; @@ -188,8 +180,8 @@ int board_late_init(void) "mmc@f1040000", &dev) && uclass_get_device_by_name(UCLASS_MMC, "sdhci@f1040000", &dev)) { - puts("Boot from SD0 but without SD0 enabled!\n"); - return -1; + debug("SD0 driver for SD0 device is not present\n"); + break; } debug("mmc0 device found at %p, seq %d\n", dev, dev_seq(dev)); @@ -205,8 +197,8 @@ int board_late_init(void) "mmc@f1050000", &dev) && uclass_get_device_by_name(UCLASS_MMC, "sdhci@f1050000", &dev)) { - puts("Boot from SD1 but without SD1 enabled!\n"); - return -1; + debug("SD1 driver for SD1 device is not present\n"); + break; } debug("mmc1 device found at %p, seq %d\n", dev, dev_seq(dev)); @@ -214,37 +206,59 @@ int board_late_init(void) bootseq = dev_seq(dev); break; default: - mode = ""; printf("Invalid Boot Mode:0x%x\n", bootmode); break; } - if (bootseq >= 0) { - bootseq_len = snprintf(NULL, 0, "%i", bootseq); - debug("Bootseq len: %x\n", bootseq_len); + if (mode) { + if (bootseq >= 0) { + bootseq_len = snprintf(NULL, 0, "%i", bootseq); + debug("Bootseq len: %x\n", bootseq_len); + } + + /* + * One terminating char + one byte for space between mode + * and default boot_targets + */ + env_targets = env_get("boot_targets"); + if (env_targets) + env_targets_len = strlen(env_targets); + + new_targets = calloc(1, strlen(mode) + env_targets_len + 2 + + bootseq_len); + if (!new_targets) + return -ENOMEM; + + if (bootseq >= 0) + sprintf(new_targets, "%s%x %s", mode, bootseq, + env_targets ? env_targets : ""); + else + sprintf(new_targets, "%s %s", mode, + env_targets ? env_targets : ""); + + env_set("boot_targets", new_targets); } - /* - * One terminating char + one byte for space between mode - * and default boot_targets - */ - env_targets = env_get("boot_targets"); - if (env_targets) - env_targets_len = strlen(env_targets); - - new_targets = calloc(1, strlen(mode) + env_targets_len + 2 + - bootseq_len); - if (!new_targets) - return -ENOMEM; - - if (bootseq >= 0) - sprintf(new_targets, "%s%x %s", mode, bootseq, - env_targets ? env_targets : ""); - else - sprintf(new_targets, "%s %s", mode, - env_targets ? env_targets : ""); - - env_set("boot_targets", new_targets); + return 0; +} + +int board_late_init(void) +{ + int ret; + + if (!(gd->flags & GD_FLG_ENV_DEFAULT)) { + debug("Saved variables - Skipping\n"); + return 0; + } + + if (!IS_ENABLED(CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG)) + return 0; + + if (IS_ENABLED(CONFIG_DISTRO_DEFAULTS)) { + ret = boot_targets_setup(); + if (ret) + return ret; + } return board_late_init_xilinx(); } diff --git a/board/xilinx/zynqmp/cmds.c b/board/xilinx/zynqmp/cmds.c index ea404d5..fadb0ed 100644 --- a/board/xilinx/zynqmp/cmds.c +++ b/board/xilinx/zynqmp/cmds.c @@ -14,16 +14,7 @@ #include <asm/arch/hardware.h> #include <asm/arch/sys_proto.h> #include <asm/io.h> - -struct aes { - u64 srcaddr; - u64 ivaddr; - u64 keyaddr; - u64 dstaddr; - u64 len; - u64 op; - u64 keysrc; -}; +#include <mach/zynqmp_aes.h> static int do_zynqmp_verify_secure(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) @@ -121,9 +112,7 @@ static int do_zynqmp_mmio_write(struct cmd_tbl *cmdtp, int flag, int argc, static int do_zynqmp_aes(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[]) { - ALLOC_CACHE_ALIGN_BUFFER(struct aes, aes, 1); - int ret; - u32 ret_payload[PAYLOAD_ARG_CNT]; + ALLOC_CACHE_ALIGN_BUFFER(struct zynqmp_aes, aes, 1); if (zynqmp_firmware_version() <= PMUFW_V1_0) { puts("ERR: PMUFW v1.0 or less is detected\n"); @@ -142,40 +131,14 @@ static int do_zynqmp_aes(struct cmd_tbl *cmdtp, int flag, int argc, aes->keysrc = hextoul(argv[6], NULL); aes->dstaddr = hextoul(argv[7], NULL); - if (aes->srcaddr && aes->ivaddr && aes->dstaddr) { - flush_dcache_range(aes->srcaddr, - (aes->srcaddr + - roundup(aes->len, ARCH_DMA_MINALIGN))); - flush_dcache_range(aes->ivaddr, - (aes->ivaddr + - roundup(IV_SIZE, ARCH_DMA_MINALIGN))); - flush_dcache_range(aes->dstaddr, - (aes->dstaddr + - roundup(aes->len, ARCH_DMA_MINALIGN))); - } - if (aes->keysrc == 0) { if (argc < cmdtp->maxargs) return CMD_RET_USAGE; aes->keyaddr = hextoul(argv[8], NULL); - if (aes->keyaddr) - flush_dcache_range(aes->keyaddr, - (aes->keyaddr + - roundup(KEY_PTR_LEN, - ARCH_DMA_MINALIGN))); } - flush_dcache_range((ulong)aes, (ulong)(aes) + - roundup(sizeof(struct aes), ARCH_DMA_MINALIGN)); - - ret = xilinx_pm_request(PM_SECURE_AES, upper_32_bits((ulong)aes), - lower_32_bits((ulong)aes), 0, 0, ret_payload); - if (ret || ret_payload[1]) - printf("Failed: AES op status:0x%x, errcode:0x%x\n", - ret, ret_payload[1]); - - return ret; + return zynqmp_aes_operation(aes); } #ifdef CONFIG_DEFINE_TCM_OCM_MMAP diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c index 309f24a..f162803 100644 --- a/board/xilinx/zynqmp/zynqmp.c +++ b/board/xilinx/zynqmp/zynqmp.c @@ -384,37 +384,16 @@ static int set_fdtfile(void) return 0; } -int board_late_init(void) +static int boot_targets_setup(void) { u8 bootmode; struct udevice *dev; int bootseq = -1; int bootseq_len = 0; int env_targets_len = 0; - const char *mode; + const char *mode = NULL; char *new_targets; char *env_targets; - int ret, multiboot; - -#if defined(CONFIG_USB_ETHER) && !defined(CONFIG_USB_GADGET_DOWNLOAD) - usb_ether_init(); -#endif - - if (!(gd->flags & GD_FLG_ENV_DEFAULT)) { - debug("Saved variables - Skipping\n"); - return 0; - } - - if (!IS_ENABLED(CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG)) - return 0; - - ret = set_fdtfile(); - if (ret) - return ret; - - multiboot = multi_boot(); - if (multiboot >= 0) - env_set_hex("multiboot", multiboot); bootmode = zynqmp_get_bootmode(); @@ -442,8 +421,8 @@ int board_late_init(void) "mmc@ff160000", &dev) && uclass_get_device_by_name(UCLASS_MMC, "sdhci@ff160000", &dev)) { - puts("Boot from EMMC but without SD0 enabled!\n"); - return -1; + debug("SD0 driver for SD0 device is not present\n"); + break; } debug("mmc0 device found at %p, seq %d\n", dev, dev_seq(dev)); @@ -457,8 +436,8 @@ int board_late_init(void) "mmc@ff160000", &dev) && uclass_get_device_by_name(UCLASS_MMC, "sdhci@ff160000", &dev)) { - puts("Boot from SD0 but without SD0 enabled!\n"); - return -1; + debug("SD0 driver for SD0 device is not present\n"); + break; } debug("mmc0 device found at %p, seq %d\n", dev, dev_seq(dev)); @@ -475,8 +454,8 @@ int board_late_init(void) "mmc@ff170000", &dev) && uclass_get_device_by_name(UCLASS_MMC, "sdhci@ff170000", &dev)) { - puts("Boot from SD1 but without SD1 enabled!\n"); - return -1; + debug("SD1 driver for SD1 device is not present\n"); + break; } debug("mmc1 device found at %p, seq %d\n", dev, dev_seq(dev)); @@ -490,39 +469,73 @@ int board_late_init(void) env_set("modeboot", "nandboot"); break; default: - mode = ""; printf("Invalid Boot Mode:0x%x\n", bootmode); break; } - if (bootseq >= 0) { - bootseq_len = snprintf(NULL, 0, "%i", bootseq); - debug("Bootseq len: %x\n", bootseq_len); - env_set_hex("bootseq", bootseq); + if (mode) { + if (bootseq >= 0) { + bootseq_len = snprintf(NULL, 0, "%i", bootseq); + debug("Bootseq len: %x\n", bootseq_len); + env_set_hex("bootseq", bootseq); + } + + /* + * One terminating char + one byte for space between mode + * and default boot_targets + */ + env_targets = env_get("boot_targets"); + if (env_targets) + env_targets_len = strlen(env_targets); + + new_targets = calloc(1, strlen(mode) + env_targets_len + 2 + + bootseq_len); + if (!new_targets) + return -ENOMEM; + + if (bootseq >= 0) + sprintf(new_targets, "%s%x %s", mode, bootseq, + env_targets ? env_targets : ""); + else + sprintf(new_targets, "%s %s", mode, + env_targets ? env_targets : ""); + + env_set("boot_targets", new_targets); + free(new_targets); } - /* - * One terminating char + one byte for space between mode - * and default boot_targets - */ - env_targets = env_get("boot_targets"); - if (env_targets) - env_targets_len = strlen(env_targets); - - new_targets = calloc(1, strlen(mode) + env_targets_len + 2 + - bootseq_len); - if (!new_targets) - return -ENOMEM; - - if (bootseq >= 0) - sprintf(new_targets, "%s%x %s", mode, bootseq, - env_targets ? env_targets : ""); - else - sprintf(new_targets, "%s %s", mode, - env_targets ? env_targets : ""); - - env_set("boot_targets", new_targets); - free(new_targets); + return 0; +} + +int board_late_init(void) +{ + int ret, multiboot; + +#if defined(CONFIG_USB_ETHER) && !defined(CONFIG_USB_GADGET_DOWNLOAD) + usb_ether_init(); +#endif + + if (!(gd->flags & GD_FLG_ENV_DEFAULT)) { + debug("Saved variables - Skipping\n"); + return 0; + } + + if (!IS_ENABLED(CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG)) + return 0; + + ret = set_fdtfile(); + if (ret) + return ret; + + multiboot = multi_boot(); + if (multiboot >= 0) + env_set_hex("multiboot", multiboot); + + if (IS_ENABLED(CONFIG_DISTRO_DEFAULTS)) { + ret = boot_targets_setup(); + if (ret) + return ret; + } reset_reason(); diff --git a/boot/Kconfig b/boot/Kconfig index 86c2787..a01e6cb 100644 --- a/boot/Kconfig +++ b/boot/Kconfig @@ -3,14 +3,25 @@ menu "Boot options" menu "Boot images" config ANDROID_BOOT_IMAGE - bool "Enable support for Android Boot Images" + bool "Android Boot Images" default y if FASTBOOT help This enables support for booting images which use the Android image format header. -config FIT - bool "Support Flattened Image Tree" +config TIMESTAMP + bool "Show image date and time when displaying image information" + default y if CMD_DATE + help + When CONFIG_TIMESTAMP is selected, the timestamp (date and time) of + an image is printed by image commands like bootm or iminfo. This + is shown as 'Timestamp: xxx' and 'Created: xxx'. If this option is + enabled, then U-Boot requires FITs to have a timestamp. If a FIT is + loaded that does not, the message 'Wrong FIT format: no timestamp' + is shown. + +menuconfig FIT + bool "Flattened Image Tree (FIT)" select HASH select MD5 select SHA1 @@ -25,20 +36,10 @@ config FIT multiple configurations, verification through hashing and also verified boot (secure boot using RSA). -config TIMESTAMP - bool "Show image date and time when displaying image information" - default y if CMD_DATE - help - When CONFIG_TIMESTAMP is selected, the timestamp (date and time) of - an image is printed by image commands like bootm or iminfo. This - is shown as 'Timestamp: xxx' and 'Created: xxx'. If this option is - enabled, then U-Boot requires FITs to have a timestamp. If a FIT is - loaded that does not, the message 'Wrong FIT format: no timestamp' - is shown. +if FIT config FIT_EXTERNAL_OFFSET hex "FIT external data offset" - depends on FIT default 0x0 help This specifies a data offset in fit image. @@ -49,7 +50,6 @@ config FIT_EXTERNAL_OFFSET config FIT_FULL_CHECK bool "Do a full check of the FIT before using it" - depends on FIT default y help Enable this do a full check of the FIT to make sure it is valid. This @@ -59,7 +59,7 @@ config FIT_FULL_CHECK config FIT_SIGNATURE bool "Enable signature verification of FIT uImages" - depends on DM && FIT + depends on DM select HASH imply RSA imply RSA_VERIFY @@ -97,7 +97,7 @@ config FIT_RSASSA_PSS config FIT_CIPHER bool "Enable ciphering data in a FIT uImages" - depends on DM && FIT + depends on DM select AES help Enable the feature of data ciphering/unciphering in the tool mkimage @@ -105,7 +105,6 @@ config FIT_CIPHER config FIT_VERBOSE bool "Show verbose messages when FIT images fail" - depends on FIT help Generally a system will have valid FIT images so debug messages are a waste of code space. If you are debugging your images then @@ -114,7 +113,6 @@ config FIT_VERBOSE config FIT_BEST_MATCH bool "Select the best match for the kernel device tree" - depends on FIT help When no configuration is explicitly selected, default to the one whose fdt's compatibility field best matches that of @@ -124,7 +122,6 @@ config FIT_BEST_MATCH config FIT_IMAGE_POST_PROCESS bool "Enable post-processing of FIT artifacts after loading by U-Boot" - depends on FIT depends on SOCFPGA_SECURE_VAB_AUTH help Allows doing any sort of manipulation to blobs after they got extracted @@ -139,14 +136,13 @@ config FIT_IMAGE_POST_PROCESS config FIT_PRINT bool "Support FIT printing" - depends on FIT default y help Support printing the content of the fitImage in a verbose manner. config SPL_FIT bool "Support Flattened Image Tree within SPL" - depends on SPL && FIT + depends on SPL select SPL_HASH select SPL_OF_LIBFDT @@ -197,7 +193,7 @@ config SPL_FIT_RSASSA_PSS config SPL_LOAD_FIT bool "Enable SPL loading U-Boot as a FIT (basic fitImage features)" - depends on SPL && FIT + depends on SPL select SPL_FIT help Normally with the SPL framework a legacy image is generated as part @@ -219,7 +215,7 @@ config SPL_LOAD_FIT config SPL_LOAD_FIT_ADDRESS hex "load address of fit image" - depends on SPL_LOAD_FIT || SPL_RAM_SUPPORT || TPL_RAM_SUPPORT + depends on SPL_LOAD_FIT default 0x0 help Specify the load address of the fit image that will be loaded @@ -245,7 +241,6 @@ config SPL_LOAD_FIT_APPLY_OVERLAY_BUF_SZ config SPL_LOAD_FIT_FULL bool "Enable SPL loading U-Boot as a FIT (full fitImage features)" - depends on FIT select SPL_FIT help Normally with the SPL framework a legacy image is generated as part @@ -343,6 +338,8 @@ config VPL_FIT_SIGNATURE_MAX_SIZE endif # VPL +endif # FIT + config PXE_UTILS bool select MENU @@ -375,8 +372,8 @@ config BOOT_DEFAULTS of U-Boot to boot various images. Currently much functionality is tied to enabling the command that exercises it. -config BOOTSTD - bool "Standard boot support" +menuconfig BOOTSTD + bool "Standard boot" default y depends on DM && OF_CONTROL && BLK help @@ -396,6 +393,8 @@ config BOOTSTD U-Boot) - bootflow - a description of how to boot (owned by the distro) +if BOOTSTD + config SPL_BOOTSTD bool "Standard boot support in SPL" depends on SPL && SPL_DM && SPL_OF_CONTROL && SPL_BLK @@ -416,8 +415,6 @@ config VPL_BOOTSTD boot. It is enabled by default since the main purpose of VPL is to handle the firmware part of VBE. -if BOOTSTD - config BOOTSTD_FULL bool "Enhanced features for standard boot" default y if SANDBOX @@ -464,8 +461,11 @@ config BOOTMETH_GLOBAL config BOOTMETH_CROS bool "Bootdev support for Chromium OS" - depends on X86 || SANDBOX - default y + depends on X86 || ARM || SANDBOX + default y if !ARM + select EFI_PARTITION + select PARTITION_TYPE_GUID + select PARTITION_UUIDS help Enables support for booting Chromium OS using bootdevs. This uses the kernel A slot and obtains the kernel command line from the parameters @@ -673,7 +673,7 @@ config BOOTMETH_SCRIPT This provides a way to try out standard boot on an existing boot flow. It is not enabled by default to save space. -endif +endif # BOOTSTD config LEGACY_IMAGE_FORMAT bool "Enable support for the legacy image format" @@ -693,108 +693,6 @@ config SUPPORT_RAW_INITRD address of the initrd must be augmented by it's size, in the following format: "<initrd address>:<initrd size>". -config OF_BOARD_SETUP - bool "Set up board-specific details in device tree before boot" - depends on OF_LIBFDT - help - This causes U-Boot to call ft_board_setup() before booting into - the Operating System. This function can set up various - board-specific information in the device tree for use by the OS. - The device tree is then passed to the OS. - -config OF_SYSTEM_SETUP - bool "Set up system-specific details in device tree before boot" - depends on OF_LIBFDT - help - This causes U-Boot to call ft_system_setup() before booting into - the Operating System. This function can set up various - system-specific information in the device tree for use by the OS. - The device tree is then passed to the OS. - -config OF_STDOUT_VIA_ALIAS - bool "Update the device-tree stdout alias from U-Boot" - depends on OF_LIBFDT - help - This uses U-Boot's serial alias from the aliases node to update - the device tree passed to the OS. The "linux,stdout-path" property - in the chosen node is set to point to the correct serial node. - This option currently references CONFIG_CONS_INDEX, which is - incorrect when used with device tree as this option does not - exist / should not be used. - -config HAVE_TEXT_BASE - bool - depends on !NIOS2 && !XTENSA - depends on !EFI_APP - default y - -config TEXT_BASE - depends on HAVE_TEXT_BASE - default 0x0 if POSITION_INDEPENDENT - default 0x80800000 if ARCH_OMAP2PLUS || ARCH_K3 - default 0x81700000 if MACH_SUNIV - default 0x2a000000 if MACH_SUN9I - default 0x4a000000 if SUNXI_MINIMUM_DRAM_MB >= 256 - default 0x42e00000 if SUNXI_MINIMUM_DRAM_MB >= 64 - hex "Text Base" - help - The address in memory that U-Boot will be running from, initially. - -config HAVE_SYS_MONITOR_BASE - bool - depends on ARC || MIPS || M68K || NIOS2 || PPC || XTENSA || X86 \ - || ENV_IS_IN_FLASH || MTD_NOR_FLASH - depends on !EFI_APP - default y - -config SYS_MONITOR_BASE - depends on HAVE_SYS_MONITOR_BASE - hex "Physical start address of boot monitor code" - default TEXT_BASE - help - The physical start address of boot monitor code (which is the same as - CONFIG_TEXT_BASE when linking) and the same as CFG_SYS_FLASH_BASE - when booting from flash. - -config SPL_SYS_MONITOR_BASE - depends on MPC85xx && SPL && HAVE_SYS_MONITOR_BASE - hex "Physical start address of SPL monitor code" - default SPL_TEXT_BASE - -config TPL_SYS_MONITOR_BASE - depends on MPC85xx && TPL && HAVE_SYS_MONITOR_BASE - hex "Physical start address of TPL monitor code" - -config DYNAMIC_SYS_CLK_FREQ - bool "Determine CPU clock frequency at run-time" - help - Implement a get_board_sys_clk function that will determine the CPU - clock frequency at run time, rather than define it statically. - -config SYS_CLK_FREQ - depends on !DYNAMIC_SYS_CLK_FREQ - int "CPU clock frequency" - default 125000000 if ARCH_LS1012A - default 100000000 if ARCH_P2020 || ARCH_T1024 || ARCH_T1042 || \ - ARCH_LS1021A || FSL_LSCH2 || FSL_LSCH3 - default 66666666 if ARCH_P1010 || ARCH_P1020 || ARCH_T4240 - default 66660000 if ARCH_T2080 - default 33333333 if RCAR_GEN3 - default 24000000 if ARCH_EXYNOS - default 20000000 if RCAR_GEN2 - default 0 - help - A static value for the CPU frequency. Note that if not required - for a given SoC, this can be left at 0. - -config ARCH_FIXUP_FDT_MEMORY - bool "Enable arch_fixup_memory_banks() call" - default y - help - Enable FDT memory map syncup before OS boot. This feature can be - used for booting OS with different memory setup where the part of - the memory location should be used for different purpose. - config CHROMEOS bool "Support booting Chrome OS" help @@ -878,7 +776,7 @@ config SYS_BOOT_RAMDISK_HIGH endmenu # Boot images config DISTRO_DEFAULTS - bool "Select defaults suitable for booting general purpose Linux distributions" + bool "(deprecated) Script-based booting of Linux distributions" select BOOT_DEFAULTS select AUTO_COMPLETE select CMDLINE_EDITING @@ -886,6 +784,10 @@ config DISTRO_DEFAULTS select HUSH_PARSER select SYS_LONGHELP help + Note: These scripts have been replaced by Standard Boot. Do not use + them on new boards. See 'Migrating from distro_boot' at + doc/develop/bootstd.rst + Select this to enable various options and commands which are suitable for building u-boot for booting general purpose Linux distributions. @@ -1007,7 +909,7 @@ config BOOTSTAGE_STASH config BOOTSTAGE_STASH_ADDR hex "Address to stash boot timing information" - default 0 + default 0x0 help Provide an address which will not be overwritten by the OS when it starts, so that it can read this information when ready. @@ -1535,6 +1437,63 @@ config SPL_IMAGE_PRE_LOAD_SIG endmenu +if OF_LIBFDT + +menu "Devicetree fixup" + +config OF_BOARD_SETUP + bool "Set up board-specific details in device tree before boot" + help + This causes U-Boot to call ft_board_setup() before booting into + the Operating System. This function can set up various + board-specific information in the device tree for use by the OS. + The device tree is then passed to the OS. + +config OF_SYSTEM_SETUP + bool "Set up system-specific details in device tree before boot" + help + This causes U-Boot to call ft_system_setup() before booting into + the Operating System. This function can set up various + system-specific information in the device tree for use by the OS. + The device tree is then passed to the OS. + +config OF_STDOUT_VIA_ALIAS + bool "Update the device-tree stdout alias from U-Boot" + help + This uses U-Boot's serial alias from the aliases node to update + the device tree passed to the OS. The "linux,stdout-path" property + in the chosen node is set to point to the correct serial node. + This option currently references CONFIG_CONS_INDEX, which is + incorrect when used with device tree as this option does not + exist / should not be used. + +config FDT_FIXUP_PARTITIONS + bool "Overwrite MTD partitions in DTS through defined in 'mtdparts'" + help + Allow overwriting defined partitions in the device tree blob + using partition info defined in the 'mtdparts' environment + variable. + +config FDT_SIMPLEFB + bool "FDT tools for simplefb support" + help + Enable the fdt tools to manage the simple fb nodes in device tree. + These functions can be used by board to indicate to the OS + the presence of the simple frame buffer with associated reserved + memory + +config ARCH_FIXUP_FDT_MEMORY + bool "Enable arch_fixup_memory_banks() call" + default y + help + Enable FDT memory map syncup before OS boot. This feature can be + used for booting OS with different memory setup where the part of + the memory location should be used for different purpose. + +endmenu + +endif # OF_LIBFDT + config USE_BOOTARGS bool "Enable boot arguments" help diff --git a/boot/Makefile b/boot/Makefile index 10f0157..6ce983b 100644 --- a/boot/Makefile +++ b/boot/Makefile @@ -16,6 +16,7 @@ obj-$(CONFIG_QFW) += bootmeth_qfw.o endif obj-y += image.o image-board.o + obj-$(CONFIG_ANDROID_AB) += android_ab.o obj-$(CONFIG_ANDROID_BOOT_IMAGE) += image-android.o image-android-dt.o @@ -37,6 +38,9 @@ obj-$(CONFIG_$(SPL_TPL_)BOOTSTD) += bootflow_menu.o obj-$(CONFIG_$(SPL_TPL_)CEDIT) += cedit.o endif +obj-$(CONFIG_$(SPL_TPL_)OF_LIBFDT) += fdt_support.o +obj-$(CONFIG_$(SPL_TPL_)FDT_SIMPLEFB) += fdt_simplefb.o + obj-$(CONFIG_$(SPL_TPL_)OF_LIBFDT) += image-fdt.o obj-$(CONFIG_$(SPL_TPL_)FIT_SIGNATURE) += fdt_region.o obj-$(CONFIG_$(SPL_TPL_)FIT) += image-fit.o diff --git a/boot/android_ab.c b/boot/android_ab.c index 73b55c1..0f20a34 100644 --- a/boot/android_ab.c +++ b/boot/android_ab.c @@ -12,7 +12,6 @@ #include <memalign.h> #include <linux/err.h> #include <u-boot/crc.h> -#include <u-boot/crc.h> /** * Compute the CRC-32 of the bootloader control struct. diff --git a/boot/bootdev-uclass.c b/boot/bootdev-uclass.c index fa52bc3..974ddee 100644 --- a/boot/bootdev-uclass.c +++ b/boot/bootdev-uclass.c @@ -111,6 +111,8 @@ int bootdev_bind(struct udevice *parent, const char *drv_name, const char *name, int bootdev_find_in_blk(struct udevice *dev, struct udevice *blk, struct bootflow_iter *iter, struct bootflow *bflow) { + struct bootmeth_uc_plat *plat = dev_get_uclass_plat(bflow->method); + bool allow_any_part = plat->flags & BOOTMETHF_ANY_PART; struct blk_desc *desc = dev_get_uclass_plat(blk); struct disk_partition info; char partstr[20]; @@ -142,6 +144,7 @@ int bootdev_find_in_blk(struct udevice *dev, struct udevice *blk, * us whether there is valid media there */ ret = part_get_info(desc, iter->part, &info); + log_debug("part_get_info() returned %d\n", ret); if (!iter->part && ret == -ENOENT) ret = 0; @@ -154,7 +157,7 @@ int bootdev_find_in_blk(struct udevice *dev, struct udevice *blk, ret = -ESHUTDOWN; else bflow->state = BOOTFLOWST_MEDIA; - if (ret) { + if (ret && !allow_any_part) { /* allow partition 1 to be missing */ if (iter->part == 1) { iter->max_part = 3; @@ -174,9 +177,15 @@ int bootdev_find_in_blk(struct udevice *dev, struct udevice *blk, if (!iter->part) { iter->first_bootable = part_get_bootable(desc); log_debug("checking bootable=%d\n", iter->first_bootable); + } else if (allow_any_part) { + /* + * allow any partition to be scanned, by skipping any checks + * for filesystems or partition contents on this disk + */ /* if there are bootable partitions, scan only those */ - } else if (iter->first_bootable ? !info.bootable : iter->part != 1) { + } else if (iter->first_bootable >= 0 && + (iter->first_bootable ? !info.bootable : iter->part != 1)) { return log_msg_ret("boot", -EINVAL); } else { ret = fs_set_blk_dev_with_part(desc, bflow->part); @@ -184,16 +193,16 @@ int bootdev_find_in_blk(struct udevice *dev, struct udevice *blk, if (ret) return log_msg_ret("fs", ret); - /* Use an #ifdef due to info.sys_ind */ -#ifdef CONFIG_DOS_PARTITION log_debug("%s: Found partition %x type %x fstype %d\n", - blk->name, bflow->part, info.sys_ind, + blk->name, bflow->part, + IS_ENABLED(CONFIG_DOS_PARTITION) ? + disk_partition_sys_ind(&info) : 0, ret ? -1 : fs_get_type()); -#endif bflow->blk = blk; bflow->state = BOOTFLOWST_FS; } + log_debug("method %s\n", bflow->method->name); ret = bootmeth_read_bootflow(bflow->method, bflow); if (ret) return log_msg_ret("method", ret); @@ -560,7 +569,8 @@ int bootdev_get_bootflow(struct udevice *dev, struct bootflow_iter *iter, { const struct bootdev_ops *ops = bootdev_get_ops(dev); - log_debug("->get_bootflow %s=%p\n", dev->name, ops->get_bootflow); + log_debug("->get_bootflow %s,%x=%p\n", dev->name, iter->part, + ops->get_bootflow); bootflow_init(bflow, dev, iter->method); if (!ops->get_bootflow) return default_get_bootflow(dev, iter, bflow); @@ -820,6 +830,33 @@ int bootdev_hunt(const char *spec, bool show) return result; } +int bootdev_unhunt(enum uclass_id id) +{ + struct bootdev_hunter *start; + int n_ent, i; + + start = ll_entry_start(struct bootdev_hunter, bootdev_hunter); + n_ent = ll_entry_count(struct bootdev_hunter, bootdev_hunter); + for (i = 0; i < n_ent; i++) { + struct bootdev_hunter *info = start + i; + + if (info->uclass == id) { + struct bootstd_priv *std; + int ret; + + ret = bootstd_get_priv(&std); + if (ret) + return log_msg_ret("std", ret); + if (!(std->hunters_used & BIT(i))) + return -EALREADY; + std->hunters_used &= ~BIT(i); + return 0; + } + } + + return -ENOENT; +} + int bootdev_hunt_prio(enum bootdev_prio_t prio, bool show) { struct bootdev_hunter *start; diff --git a/boot/bootflow.c b/boot/bootflow.c index 81b5829..6ef62e1 100644 --- a/boot/bootflow.c +++ b/boot/bootflow.c @@ -432,6 +432,7 @@ void bootflow_free(struct bootflow *bflow) free(bflow->buf); free(bflow->os_name); free(bflow->fdt_fname); + free(bflow->bootmeth_priv); } void bootflow_remove(struct bootflow *bflow) @@ -444,6 +445,22 @@ void bootflow_remove(struct bootflow *bflow) free(bflow); } +#if CONFIG_IS_ENABLED(BOOTSTD_FULL) +int bootflow_read_all(struct bootflow *bflow) +{ + int ret; + + if (bflow->state != BOOTFLOWST_READY) + return log_msg_ret("rd", -EPROTO); + + ret = bootmeth_read_all(bflow->method, bflow); + if (ret) + return log_msg_ret("rd2", ret); + + return 0; +} +#endif /* BOOTSTD_FULL */ + int bootflow_boot(struct bootflow *bflow) { int ret; diff --git a/boot/bootm.c b/boot/bootm.c index 75f0b4a..b1c3afe 100644 --- a/boot/bootm.c +++ b/boot/bootm.c @@ -823,6 +823,43 @@ err: return ret; } +int bootm_boot_start(ulong addr, const char *cmdline) +{ + static struct cmd_tbl cmd = {"bootm"}; + char addr_str[30]; + char *argv[] = {addr_str, NULL}; + int states; + int ret; + + /* + * TODO(sjg@chromium.org): This uses the command-line interface, but + * should not. To clean this up, the various bootm states need to be + * passed an info structure instead of cmdline flags. Then this can + * set up the required info and move through the states without needing + * the command line. + */ + states = BOOTM_STATE_START | BOOTM_STATE_FINDOS | BOOTM_STATE_PRE_LOAD | + BOOTM_STATE_FINDOTHER | BOOTM_STATE_LOADOS | + BOOTM_STATE_OS_PREP | BOOTM_STATE_OS_FAKE_GO | + BOOTM_STATE_OS_GO; + if (IS_ENABLED(CONFIG_SYS_BOOT_RAMDISK_HIGH)) + states |= BOOTM_STATE_RAMDISK; + if (IS_ENABLED(CONFIG_PPC) || IS_ENABLED(CONFIG_MIPS)) + states |= BOOTM_STATE_OS_CMDLINE; + images.state |= states; + + snprintf(addr_str, sizeof(addr_str), "%lx", addr); + + ret = env_set("bootargs", cmdline); + if (ret) { + printf("Failed to set cmdline\n"); + return ret; + } + ret = do_bootm_states(&cmd, 0, 1, argv, states, &images, 1); + + return ret; +} + #if CONFIG_IS_ENABLED(LEGACY_IMAGE_FORMAT) /** * image_get_kernel - verify legacy format kernel image diff --git a/boot/bootm_os.c b/boot/bootm_os.c index 99ff0e6..9c035b5 100644 --- a/boot/bootm_os.c +++ b/boot/bootm_os.c @@ -609,19 +609,5 @@ int boot_selected_os(int argc, char *const argv[], int state, boot_os_fn *bootm_os_get_boot_func(int os) { -#ifdef CONFIG_NEEDS_MANUAL_RELOC - static bool relocated; - - if (!relocated) { - int i; - - /* relocate boot function table */ - for (i = 0; i < ARRAY_SIZE(boot_os); i++) - if (boot_os[i] != NULL) - boot_os[i] += gd->reloc_off; - - relocated = true; - } -#endif return boot_os[os]; } diff --git a/boot/bootmeth-uclass.c b/boot/bootmeth-uclass.c index 175eb1d..1d157d5 100644 --- a/boot/bootmeth-uclass.c +++ b/boot/bootmeth-uclass.c @@ -61,6 +61,18 @@ int bootmeth_set_bootflow(struct udevice *dev, struct bootflow *bflow, return ops->set_bootflow(dev, bflow, buf, size); } +#if CONFIG_IS_ENABLED(BOOTSTD_FULL) +int bootmeth_read_all(struct udevice *dev, struct bootflow *bflow) +{ + const struct bootmeth_ops *ops = bootmeth_get_ops(dev); + + if (!ops->read_all) + return -ENOSYS; + + return ops->read_all(dev, bflow); +} +#endif /* BOOTSTD_FULL */ + int bootmeth_boot(struct udevice *dev, struct bootflow *bflow) { const struct bootmeth_ops *ops = bootmeth_get_ops(dev); diff --git a/boot/bootmeth_cros.c b/boot/bootmeth_cros.c index aa19ae0..20e0b1e 100644 --- a/boot/bootmeth_cros.c +++ b/boot/bootmeth_cros.c @@ -12,24 +12,79 @@ #include <blk.h> #include <bootdev.h> #include <bootflow.h> +#include <bootm.h> #include <bootmeth.h> +#include <display_options.h> #include <dm.h> +#include <efi.h> #include <malloc.h> #include <mapmem.h> #include <part.h> -#ifdef CONFIG_X86 -#include <asm/zimage.h> -#endif #include <linux/sizes.h> +#include "bootmeth_cros.h" + +static const efi_guid_t cros_kern_type = PARTITION_CROS_KERNEL; + +/* + * Layout of the ChromeOS kernel + * + * Partitions 2 and 4 contain kernels with type GUID_CROS_KERNEL + * + * Contents are: + * + * Offset Contents + * 0 struct vb2_keyblock + * m struct vb2_kernel_preamble + * m + n kernel buffer + * + * m is keyblock->keyblock_size + * n is preamble->preamble_size + * + * The kernel buffer itself consists of various parts: + * + * Offset Contents + * m + n kernel image (Flat vmlinux binary or FIT) + * b - 8KB Command line text + * b - 4KB X86 setup block (struct boot_params, extends for about 16KB) + * b X86 bootloader (continuation of setup block) + * b + 16KB X86 setup block (copy, used for hold data pointed to) + * + * b is m + n + preamble->bootloader_address - preamble->body_load_address + * + * Useful metadata extends from b - 8KB through to b + 32 KB + */ enum { - /* Offsets in the kernel-partition header */ - KERN_START = 0x4f0, - KERN_SIZE = 0x518, + PROBE_SIZE = SZ_4K, /* initial bytes read from partition */ - SETUP_OFFSET = 0x1000, /* bytes before base */ - CMDLINE_OFFSET = 0x2000, /* bytes before base */ - OFFSET_BASE = 0x100000, /* assumed kernel load-address */ + X86_SETUP_OFFSET = -0x1000, /* setup offset relative to base */ + CMDLINE_OFFSET = -0x2000, /* cmdline offset relative to base */ + X86_KERNEL_OFFSET = 0x4000, /* kernel offset relative to base */ +}; + +/** + * struct cros_priv - Private data + * + * This is read from the disk and recorded for use when the full kernel must + * be loaded and booted + * + * @body_offset: Offset of kernel body from start of partition (in bytes) + * @body_size: Size of kernel body in bytes + * @part_start: Block offset of selected partition from the start of the disk + * @body_load_address: Nominal load address for kernel body + * @bootloader_address: Address of bootloader, after body is loaded at + * body_load_address + * @bootloader_size: Size of bootloader in bytes + * @info_buf: Buffer containing ChromiumOS info + */ +struct cros_priv { + ulong body_offset; + ulong body_size; + lbaint_t part_start; + ulong body_load_address; + ulong bootloader_address; + ulong bootloader_size; + void *info_buf; }; static int cros_check(struct udevice *dev, struct bootflow_iter *iter) @@ -77,61 +132,96 @@ static int copy_cmdline(const char *from, const char *uuid, char **bufp) return 0; } -static int cros_read_bootflow(struct udevice *dev, struct bootflow *bflow) +/** + * scan_part() - Scan a kernel partition to see if has a ChromeOS header + * + * This reads the first PROBE_SIZE of a partition, loookng for + * VB2_KEYBLOCK_MAGIC + * + * @blk: Block device to scan + * @partnum: Partition number to scan + * @info: Please to put partition info + * @hdrp: Return allocated keyblock header on success + */ +static int scan_part(struct udevice *blk, int partnum, + struct disk_partition *info, struct vb2_keyblock **hdrp) { - struct blk_desc *desc = dev_get_uclass_plat(bflow->blk); - ulong base, start, size, setup, cmdline, num_blks, kern_base; - struct disk_partition info; - const char *uuid = NULL; - void *buf, *hdr; + struct blk_desc *desc = dev_get_uclass_plat(blk); + struct vb2_keyblock *hdr; + struct uuid type; + ulong num_blks; int ret; - log_debug("starting, part=%d\n", bflow->part); + if (!partnum) + return log_msg_ret("efi", -ENOENT); - /* We consider the whole disk, not any one partition */ - if (bflow->part) - return log_msg_ret("max", -ENOENT); - - /* Check partition 2 */ - ret = part_get_info(desc, 2, &info); + ret = part_get_info(desc, partnum, info); if (ret) return log_msg_ret("part", ret); + /* Check for kernel partition type */ + log_debug("part %x: type=%s\n", partnum, info->type_guid); + if (uuid_str_to_bin(info->type_guid, (u8 *)&type, UUID_STR_FORMAT_GUID)) + return log_msg_ret("typ", -EINVAL); + + if (memcmp(&cros_kern_type, &type, sizeof(type))) + return log_msg_ret("typ", -ENOEXEC); + /* Make a buffer for the header information */ - num_blks = SZ_4K >> desc->log2blksz; + num_blks = PROBE_SIZE >> desc->log2blksz; log_debug("Reading header, blk=%s, start=%lx, blocks=%lx\n", - bflow->blk->name, (ulong)info.start, num_blks); - hdr = memalign(SZ_1K, SZ_4K); + blk->name, (ulong)info->start, num_blks); + hdr = memalign(SZ_1K, PROBE_SIZE); if (!hdr) return log_msg_ret("hdr", -ENOMEM); - ret = blk_read(bflow->blk, info.start, num_blks, hdr); - if (ret != num_blks) - return log_msg_ret("inf", ret); + ret = blk_read(blk, info->start, num_blks, hdr); + if (ret != num_blks) { + free(hdr); + return log_msg_ret("inf", -EIO); + } - if (memcmp("CHROMEOS", hdr, 8)) + if (memcmp(VB2_KEYBLOCK_MAGIC, hdr->magic, VB2_KEYBLOCK_MAGIC_SIZE)) { + free(hdr); + log_debug("no magic\n"); return -ENOENT; + } - log_info("Header at %lx\n", (ulong)map_to_sysmem(hdr)); - start = *(u32 *)(hdr + KERN_START); - size = ALIGN(*(u32 *)(hdr + KERN_SIZE), desc->blksz); - log_debug("Reading start %lx size %lx\n", start, size); - bflow->size = size; + *hdrp = hdr; + + return 0; +} + +/** + * cros_read_buf() - Read information into a buf and parse it + * + * @bflow: Bootflow to update + * @buf: Buffer to use + * @size: Size of buffer and number of bytes to read thereinto + * @start: Start offset to read from on disk + * @before_base: Number of bytes to read before the bootloader base + * @uuid: UUID string if supported, else NULL + * Return: 0 if OK, -ENOMEM if out of memory, -EIO on read failure + */ +static int cros_read_buf(struct bootflow *bflow, void *buf, ulong size, + loff_t start, ulong before_base, const char *uuid) +{ + struct blk_desc *desc = dev_get_uclass_plat(bflow->blk); + ulong base, setup, cmdline, kern_base; + ulong num_blks; + int ret; - buf = memalign(SZ_1K, size); - if (!buf) - return log_msg_ret("buf", -ENOMEM); num_blks = size >> desc->log2blksz; - log_debug("Reading data, blk=%s, start=%lx, blocks=%lx\n", - bflow->blk->name, (ulong)info.start, num_blks); - ret = blk_read(bflow->blk, (ulong)info.start + 0x80, num_blks, buf); + log_debug("Reading info to %lx, blk=%s, size=%lx, blocks=%lx\n", + (ulong)map_to_sysmem(buf), bflow->blk->name, size, num_blks); + ret = blk_read(bflow->blk, start, num_blks, buf); if (ret != num_blks) - return log_msg_ret("inf", ret); - base = map_to_sysmem(buf); + return log_msg_ret("inf", -EIO); + base = map_to_sysmem(buf) + before_base; - setup = base + start - OFFSET_BASE - SETUP_OFFSET; - cmdline = base + start - OFFSET_BASE - CMDLINE_OFFSET; - kern_base = base + start - OFFSET_BASE + SZ_16K; - log_debug("base %lx setup %lx, cmdline %lx, kern_base %lx\n", base, + setup = base + X86_SETUP_OFFSET; + cmdline = base + CMDLINE_OFFSET; + kern_base = base + X86_KERNEL_OFFSET; + log_debug("base %lx setup %lx cmdline %lx kern_base %lx\n", base, setup, cmdline, kern_base); #ifdef CONFIG_X86 @@ -151,35 +241,206 @@ static int cros_read_bootflow(struct udevice *dev, struct bootflow *bflow) if (!bflow->os_name) return log_msg_ret("os", -ENOMEM); -#if CONFIG_IS_ENABLED(PARTITION_UUIDS) - uuid = info.uuid; -#endif ret = copy_cmdline(map_sysmem(cmdline, 0), uuid, &bflow->cmdline); if (ret) return log_msg_ret("cmd", ret); + bflow->x86_setup = map_sysmem(setup, 0); + + return 0; +} + +/** + * cros_read_info() - Read information and fill out the bootflow + * + * @bflow: Bootflow to update + * @uuid: UUID string if supported, else NULL + * @preamble: Kernel preamble information + * Return: 0 if OK, -ENOMEM if out of memory, -EIO on read failure + */ +static int cros_read_info(struct bootflow *bflow, const char *uuid, + const struct vb2_kernel_preamble *preamble) +{ + struct cros_priv *priv = bflow->bootmeth_priv; + struct udevice *blk = bflow->blk; + struct blk_desc *desc = dev_get_uclass_plat(blk); + ulong offset, size, before_base; + void *buf; + int ret; + + log_debug("Kernel preamble at %lx, version major %x, minor %x\n", + (ulong)map_to_sysmem(preamble), + preamble->header_version_major, + preamble->header_version_minor); + + log_debug(" - load_address %lx, bl_addr %lx, bl_size %lx\n", + (ulong)preamble->body_load_address, + (ulong)preamble->bootloader_address, + (ulong)preamble->bootloader_size); + + priv->body_size = preamble->body_signature.data_size; + priv->body_load_address = preamble->body_load_address; + priv->bootloader_address = preamble->bootloader_address; + priv->bootloader_size = preamble->bootloader_size; + log_debug("Kernel body at %lx size %lx\n", priv->body_offset, + priv->body_size); + + /* Work out how many bytes to read before the bootloader base */ + before_base = -CMDLINE_OFFSET; + + /* Read the cmdline through to the end of the bootloader */ + size = priv->bootloader_size + before_base; + offset = priv->body_offset + + (priv->bootloader_address - priv->body_load_address) + + CMDLINE_OFFSET; + buf = malloc(size); + if (!buf) + return log_msg_ret("buf", -ENOMEM); + + ret = cros_read_buf(bflow, buf, size, + priv->part_start + (offset >> desc->log2blksz), + before_base, uuid); + if (ret) { + /* Clear this since the buffer is invalid */ + bflow->x86_setup = NULL; + free(buf); + return log_msg_ret("pro", ret); + } + priv->info_buf = buf; + + return 0; +} + +static int cros_read_kernel(struct bootflow *bflow) +{ + struct blk_desc *desc = dev_get_uclass_plat(bflow->blk); + struct cros_priv *priv = bflow->bootmeth_priv; + ulong base, setup; + ulong num_blks; + void *buf; + int ret; + + bflow->size = priv->body_size; + + buf = memalign(SZ_1K, priv->body_size); + if (!buf) + return log_msg_ret("buf", -ENOMEM); + + /* Check that the header is not smaller than permitted */ + if (priv->body_offset < PROBE_SIZE) + return log_msg_ret("san", EFAULT); + + /* Read kernel body */ + num_blks = priv->body_size >> desc->log2blksz; + log_debug("Reading body to %lx, blk=%s, size=%lx, blocks=%lx\n", + (ulong)map_to_sysmem(buf), bflow->blk->name, priv->body_size, + num_blks); + ret = blk_read(bflow->blk, + priv->part_start + (priv->body_offset >> desc->log2blksz), + num_blks, buf); + if (ret != num_blks) + return log_msg_ret("inf", -EIO); + base = map_to_sysmem(buf) + priv->bootloader_address - + priv->body_load_address; + setup = base + X86_SETUP_OFFSET; - bflow->state = BOOTFLOWST_READY; bflow->buf = buf; bflow->x86_setup = map_sysmem(setup, 0); return 0; } +static int cros_read_bootflow(struct udevice *dev, struct bootflow *bflow) +{ + const struct vb2_kernel_preamble *preamble; + struct disk_partition info; + struct vb2_keyblock *hdr; + const char *uuid = NULL; + struct cros_priv *priv; + int ret; + + log_debug("starting, part=%x\n", bflow->part); + + /* Check for kernel partitions */ + ret = scan_part(bflow->blk, bflow->part, &info, &hdr); + if (ret) { + log_debug("- scan failed: err=%d\n", ret); + return log_msg_ret("scan", ret); + } + + priv = malloc(sizeof(struct cros_priv)); + if (!priv) { + free(hdr); + return log_msg_ret("buf", -ENOMEM); + } + bflow->bootmeth_priv = priv; + + log_debug("Selected partition %d, header at %lx\n", bflow->part, + (ulong)map_to_sysmem(hdr)); + + /* Grab a few things from the preamble */ + preamble = (void *)hdr + hdr->keyblock_size; + priv->body_offset = hdr->keyblock_size + preamble->preamble_size; + priv->part_start = info.start; + + /* Now read everything we can learn about kernel */ +#if CONFIG_IS_ENABLED(PARTITION_UUIDS) + uuid = info.uuid; +#endif + ret = cros_read_info(bflow, uuid, preamble); + preamble = NULL; + free(hdr); + if (ret) { + free(priv->info_buf); + free(priv); + return log_msg_ret("inf", ret); + } + bflow->size = priv->body_size; + bflow->state = BOOTFLOWST_READY; + + return 0; +} + static int cros_read_file(struct udevice *dev, struct bootflow *bflow, const char *file_path, ulong addr, ulong *sizep) { return -ENOSYS; } +#if CONFIG_IS_ENABLED(BOOSTD_FULL) +static int cros_read_all(struct udevice *dev, struct bootflow *bflow) +{ + int ret; + + if (bflow->buf) + return log_msg_ret("ld", -EALREADY); + ret = cros_read_kernel(bflow); + if (ret) + return log_msg_ret("rd", ret); + + return 0; +} +#endif /* BOOSTD_FULL */ + static int cros_boot(struct udevice *dev, struct bootflow *bflow) { -#ifdef CONFIG_X86 - zboot_start(map_to_sysmem(bflow->buf), bflow->size, 0, 0, - map_to_sysmem(bflow->x86_setup), - bflow->cmdline); -#endif + int ret; + + if (!bflow->buf) { + ret = cros_read_kernel(bflow); + if (ret) + return log_msg_ret("rd", ret); + } + + if (IS_ENABLED(CONFIG_X86)) { + ret = zboot_start(map_to_sysmem(bflow->buf), bflow->size, 0, 0, + map_to_sysmem(bflow->x86_setup), + bflow->cmdline); + } else { + ret = bootm_boot_start(map_to_sysmem(bflow->buf), + bflow->cmdline); + } - return log_msg_ret("go", -EFAULT); + return log_msg_ret("go", ret); } static int cros_bootmeth_bind(struct udevice *dev) @@ -187,6 +448,7 @@ static int cros_bootmeth_bind(struct udevice *dev) struct bootmeth_uc_plat *plat = dev_get_uclass_plat(dev); plat->desc = "ChromiumOS boot"; + plat->flags = BOOTMETHF_ANY_PART; return 0; } @@ -196,6 +458,9 @@ static struct bootmeth_ops cros_bootmeth_ops = { .read_bootflow = cros_read_bootflow, .read_file = cros_read_file, .boot = cros_boot, +#if CONFIG_IS_ENABLED(BOOSTD_FULL) + .read_all = cros_read_all, +#endif /* BOOSTD_FULL */ }; static const struct udevice_id cros_bootmeth_ids[] = { diff --git a/boot/bootmeth_cros.h b/boot/bootmeth_cros.h new file mode 100644 index 0000000..8e30385 --- /dev/null +++ b/boot/bootmeth_cros.h @@ -0,0 +1,197 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Structures used by the ChromiumOS bootmeth + * + * See docs at: + * https://www.chromium.org/chromium-os/chromiumos-design-docs/verified-boot-data-structures/ + * + * Original code at: + * https://chromium.googlesource.com/chromiumos/platform/vboot_reference/+/refs/heads/main/firmware/2lib/include/2struct.h + * + * Code taken from vboot_reference commit 5b8596ce file 2struct.h + * + * Copyright 2023 Google LLC + * Written by Simon Glass <sjg@chromium.org> + */ + +#ifndef __BOOTMETH_CROS_H +#define __BOOTMETH_CROS_H + +/* Signature data (a secure hash, possibly signed) */ +struct vb2_signature { + /* Offset of signature data from start of this struct */ + uint32_t sig_offset; + uint32_t reserved0; + + /* Size of signature data in bytes */ + uint32_t sig_size; + uint32_t reserved1; + + /* Size of the data block which was signed in bytes */ + uint32_t data_size; + uint32_t reserved2; +} __attribute__((packed)); + +#define EXPECTED_VB2_SIGNATURE_SIZE 24 + +/* Packed public key data */ +struct vb2_packed_key { + /* Offset of key data from start of this struct */ + uint32_t key_offset; + uint32_t reserved0; + + /* Size of key data in bytes (NOT strength of key in bits) */ + uint32_t key_size; + uint32_t reserved1; + + /* Signature algorithm used by the key (enum vb2_crypto_algorithm) */ + uint32_t algorithm; + uint32_t reserved2; + + /* Key version */ + uint32_t key_version; + uint32_t reserved3; + + /* TODO: when redoing this struct, add a text description of the key */ +} __attribute__((packed)); + +#define EXPECTED_VB2_PACKED_KEY_SIZE 32 + +#define VB2_KEYBLOCK_MAGIC "CHROMEOS" +#define VB2_KEYBLOCK_MAGIC_SIZE 8 + +/* + * Keyblock, containing the public key used to sign some other chunk of data. + * + * This should be followed by: + * 1) The data_key key data, pointed to by data_key.key_offset. + * 2) The checksum data for (vb2_keyblock + data_key data), pointed to + * by keyblock_checksum.sig_offset. + * 3) The signature data for (vb2_keyblock + data_key data), pointed to + * by keyblock_signature.sig_offset. + */ +struct vb2_keyblock { + /* Magic number */ + uint8_t magic[VB2_KEYBLOCK_MAGIC_SIZE]; + + /* Version of this header format */ + uint32_t header_version_major; + uint32_t header_version_minor; + + /* + * Length of this entire keyblock, including keys, signatures, and + * padding, in bytes + */ + uint32_t keyblock_size; + uint32_t reserved0; + + /* + * Signature for this keyblock (header + data pointed to by data_key) + * For use with signed data keys + */ + struct vb2_signature keyblock_signature; + + /* + * SHA-512 hash for this keyblock (header + data pointed to by + * data_key) For use with unsigned data keys. + * + * Only supported for kernel keyblocks, not firmware keyblocks. + */ + struct vb2_signature keyblock_hash; + + /* Flags for key (VB2_KEYBLOCK_FLAG_*) */ + uint32_t keyblock_flags; + uint32_t reserved1; + + /* Key to verify the chunk of data */ + struct vb2_packed_key data_key; +} __attribute__((packed)); + +#define EXPECTED_VB2_KEYBLOCK_SIZE 112 + +/* + * Preamble block for kernel, version 2.2 + * + * This should be followed by: + * 1) The signature data for the kernel body, pointed to by + * body_signature.sig_offset. + * 2) The signature data for (vb2_kernel_preamble + body signature data), + * pointed to by preamble_signature.sig_offset. + * 3) The 16-bit vmlinuz header, which is used for reconstruction of + * vmlinuz image. + */ +struct vb2_kernel_preamble { + /* + * Size of this preamble, including keys, signatures, vmlinuz header, + * and padding, in bytes + */ + uint32_t preamble_size; + uint32_t reserved0; + + /* Signature for this preamble (header + body signature) */ + struct vb2_signature preamble_signature; + + /* Version of this header format */ + uint32_t header_version_major; + uint32_t header_version_minor; + + /* Kernel version */ + uint32_t kernel_version; + uint32_t reserved1; + + /* Load address for kernel body */ + uint64_t body_load_address; + /* TODO (vboot 2.1): we never used that */ + + /* Address of bootloader, after body is loaded at body_load_address */ + uint64_t bootloader_address; + /* TODO (vboot 2.1): should be a 32-bit offset */ + + /* Size of bootloader in bytes */ + uint32_t bootloader_size; + uint32_t reserved2; + + /* Signature for the kernel body */ + struct vb2_signature body_signature; + + /* + * TODO (vboot 2.1): fields for kernel offset and size. Right now the + * size is implicitly the same as the size of data signed by the body + * signature, and the offset is implicitly at the end of the preamble. + * But that forces us to pad the preamble to 64KB rather than just + * having a tiny preamble and an offset field. + */ + + /* + * Fields added in header version 2.1. You must verify the header + * version before reading these fields! + */ + + /* + * Address of 16-bit header for vmlinuz reassembly. Readers should + * return 0 for header version < 2.1. + */ + uint64_t vmlinuz_header_address; + + /* Size of 16-bit header for vmlinuz in bytes. Readers should return 0 + for header version < 2.1 */ + uint32_t vmlinuz_header_size; + uint32_t reserved3; + + /* + * Fields added in header version 2.2. You must verify the header + * version before reading these fields! + */ + + /* + * Flags; see VB2_KERNEL_PREAMBLE_*. Readers should return 0 for + * header version < 2.2. Flags field is currently defined as: + * [31:2] - Reserved (for future use) + * [1:0] - Kernel image type (0b00 - CrOS, + * 0b01 - bootimg, + * 0b10 - multiboot) + */ + uint32_t flags; +} __attribute__((packed)); + +#endif /* __BOOTMETH_CROS_H */ diff --git a/boot/cedit.c b/boot/cedit.c index ee24658..73645f7 100644 --- a/boot/cedit.c +++ b/boot/cedit.c @@ -6,15 +6,50 @@ * Written by Simon Glass <sjg@chromium.org> */ +#define LOG_CATEGORY LOGC_EXPO + #include <common.h> +#include <abuf.h> +#include <cedit.h> #include <cli.h> #include <dm.h> +#include <env.h> #include <expo.h> +#include <malloc.h> #include <menu.h> +#include <rtc.h> #include <video.h> #include <linux/delay.h> #include "scene_internal.h" +enum { + CMOS_MAX_BITS = 2048, + CMOS_MAX_BYTES = CMOS_MAX_BITS / 8, +}; + +#define CMOS_BYTE(bit) ((bit) / 8) +#define CMOS_BIT(bit) ((bit) % 8) + +/** + * struct cedit_iter_priv - private data for cedit operations + * + * @buf: Buffer to use when writing settings to the devicetree + * @node: Node to read from when reading settings from devicetree + * @verbose: true to show writing to environment variables + * @mask: Mask bits for the CMOS RAM. If a bit is set the byte containing it + * will be written + * @value: Value bits for CMOS RAM. This is the actual value written + * @dev: RTC device to write to + */ +struct cedit_iter_priv { + struct abuf *buf; + ofnode node; + bool verbose; + u8 *mask; + u8 *value; + struct udevice *dev; +}; + int cedit_arange(struct expo *exp, struct video_priv *vpriv, uint scene_id) { struct scene_obj_txt *txt; @@ -46,18 +81,15 @@ int cedit_arange(struct expo *exp, struct video_priv *vpriv, uint scene_id) return 0; } -int cedit_run(struct expo *exp) +int cedit_prepare(struct expo *exp, struct video_priv **vid_privp, + struct scene **scnp) { - struct cli_ch_state s_cch, *cch = &s_cch; struct video_priv *vid_priv; - uint scene_id; struct udevice *dev; struct scene *scn; - bool done; + uint scene_id; int ret; - cli_ch_init(cch); - /* For now we only support a video console */ ret = uclass_first_device_err(UCLASS_VIDEO, &dev); if (ret) @@ -92,6 +124,27 @@ int cedit_run(struct expo *exp) if (ret) return log_msg_ret("dim", ret); + *vid_privp = vid_priv; + *scnp = scn; + + return scene_id; +} + +int cedit_run(struct expo *exp) +{ + struct cli_ch_state s_cch, *cch = &s_cch; + struct video_priv *vid_priv; + uint scene_id; + struct scene *scn; + bool done; + int ret; + + cli_ch_init(cch); + ret = cedit_prepare(exp, &vid_priv, &scn); + if (ret < 0) + return log_msg_ret("prep", ret); + scene_id = ret; + done = false; do { struct expo_action act; @@ -161,3 +214,507 @@ int cedit_run(struct expo *exp) return 0; } + +static int check_space(int ret, struct abuf *buf) +{ + if (ret == -FDT_ERR_NOSPACE) { + if (!abuf_realloc_inc(buf, CEDIT_SIZE_INC)) + return log_msg_ret("spc", -ENOMEM); + ret = fdt_resize(abuf_data(buf), abuf_data(buf), + abuf_size(buf)); + if (ret) + return log_msg_ret("res", -EFAULT); + } + + return 0; +} + +static int get_cur_menuitem_text(const struct scene_obj_menu *menu, + const char **strp) +{ + struct scene *scn = menu->obj.scene; + const struct scene_menitem *mi; + const struct scene_obj_txt *txt; + const char *str; + + mi = scene_menuitem_find(menu, menu->cur_item_id); + if (!mi) + return log_msg_ret("mi", -ENOENT); + + txt = scene_obj_find(scn, mi->label_id, SCENEOBJT_TEXT); + if (!txt) + return log_msg_ret("txt", -ENOENT); + + str = expo_get_str(scn->expo, txt->str_id); + if (!str) + return log_msg_ret("str", -ENOENT); + *strp = str; + + return 0; +} + +static int h_write_settings(struct scene_obj *obj, void *vpriv) +{ + struct cedit_iter_priv *priv = vpriv; + struct abuf *buf = priv->buf; + + switch (obj->type) { + case SCENEOBJT_NONE: + case SCENEOBJT_IMAGE: + case SCENEOBJT_TEXT: + break; + case SCENEOBJT_MENU: { + const struct scene_obj_menu *menu; + const char *str; + char name[80]; + int ret, i; + + menu = (struct scene_obj_menu *)obj; + ret = -EAGAIN; + for (i = 0; ret && i < 2; i++) { + ret = fdt_property_u32(abuf_data(buf), obj->name, + menu->cur_item_id); + if (!i) { + ret = check_space(ret, buf); + if (ret) + return log_msg_ret("res", -ENOMEM); + } + } + /* this should not happen */ + if (ret) + return log_msg_ret("wrt", -EFAULT); + + ret = get_cur_menuitem_text(menu, &str); + if (ret) + return log_msg_ret("mis", ret); + + snprintf(name, sizeof(name), "%s-str", obj->name); + ret = -EAGAIN; + for (i = 0; ret && i < 2; i++) { + ret = fdt_property_string(abuf_data(buf), name, str); + if (!i) { + ret = check_space(ret, buf); + if (ret) + return log_msg_ret("rs2", -ENOMEM); + } + } + + /* this should not happen */ + if (ret) + return log_msg_ret("wr2", -EFAULT); + + break; + } + } + + return 0; +} + +int cedit_write_settings(struct expo *exp, struct abuf *buf) +{ + struct cedit_iter_priv priv; + void *fdt; + int ret; + + abuf_init(buf); + if (!abuf_realloc(buf, CEDIT_SIZE_INC)) + return log_msg_ret("buf", -ENOMEM); + + fdt = abuf_data(buf); + ret = fdt_create(fdt, abuf_size(buf)); + if (!ret) + ret = fdt_finish_reservemap(fdt); + if (!ret) + ret = fdt_begin_node(fdt, ""); + if (!ret) + ret = fdt_begin_node(fdt, CEDIT_NODE_NAME); + if (ret) { + log_debug("Failed to start FDT (err=%d)\n", ret); + return log_msg_ret("sta", -EINVAL); + } + + /* write out the items */ + priv.buf = buf; + ret = expo_iter_scene_objs(exp, h_write_settings, &priv); + if (ret) { + log_debug("Failed to write settings (err=%d)\n", ret); + return log_msg_ret("set", ret); + } + + ret = fdt_end_node(fdt); + if (!ret) + ret = fdt_end_node(fdt); + if (!ret) + ret = fdt_finish(fdt); + if (ret) { + log_debug("Failed to finish FDT (err=%d)\n", ret); + return log_msg_ret("fin", -EINVAL); + } + + return 0; +} + +static int h_read_settings(struct scene_obj *obj, void *vpriv) +{ + struct cedit_iter_priv *priv = vpriv; + ofnode node = priv->node; + + switch (obj->type) { + case SCENEOBJT_NONE: + case SCENEOBJT_IMAGE: + case SCENEOBJT_TEXT: + break; + case SCENEOBJT_MENU: { + struct scene_obj_menu *menu; + uint val; + + if (ofnode_read_u32(node, obj->name, &val)) + return log_msg_ret("rd", -ENOENT); + menu = (struct scene_obj_menu *)obj; + menu->cur_item_id = val; + + break; + } + } + + return 0; +} + +int cedit_read_settings(struct expo *exp, oftree tree) +{ + struct cedit_iter_priv priv; + ofnode root, node; + int ret; + + root = oftree_root(tree); + if (!ofnode_valid(root)) + return log_msg_ret("roo", -ENOENT); + node = ofnode_find_subnode(root, CEDIT_NODE_NAME); + if (!ofnode_valid(node)) + return log_msg_ret("pat", -ENOENT); + + /* read in the items */ + priv.node = node; + ret = expo_iter_scene_objs(exp, h_read_settings, &priv); + if (ret) { + log_debug("Failed to read settings (err=%d)\n", ret); + return log_msg_ret("set", ret); + } + + return 0; +} + +static int h_write_settings_env(struct scene_obj *obj, void *vpriv) +{ + const struct scene_obj_menu *menu; + struct cedit_iter_priv *priv = vpriv; + char name[80], var[60]; + const char *str; + int val, ret; + + if (obj->type != SCENEOBJT_MENU) + return 0; + + menu = (struct scene_obj_menu *)obj; + val = menu->cur_item_id; + snprintf(var, sizeof(var), "c.%s", obj->name); + + if (priv->verbose) + printf("%s=%d\n", var, val); + + ret = env_set_ulong(var, val); + if (ret) + return log_msg_ret("set", ret); + + ret = get_cur_menuitem_text(menu, &str); + if (ret) + return log_msg_ret("mis", ret); + + snprintf(name, sizeof(name), "c.%s-str", obj->name); + if (priv->verbose) + printf("%s=%s\n", name, str); + + ret = env_set(name, str); + if (ret) + return log_msg_ret("st2", ret); + + return 0; +} + +int cedit_write_settings_env(struct expo *exp, bool verbose) +{ + struct cedit_iter_priv priv; + int ret; + + /* write out the items */ + priv.verbose = verbose; + ret = expo_iter_scene_objs(exp, h_write_settings_env, &priv); + if (ret) { + log_debug("Failed to write settings to env (err=%d)\n", ret); + return log_msg_ret("set", ret); + } + + return 0; +} + +static int h_read_settings_env(struct scene_obj *obj, void *vpriv) +{ + struct cedit_iter_priv *priv = vpriv; + struct scene_obj_menu *menu; + char var[60]; + int val; + + if (obj->type != SCENEOBJT_MENU) + return 0; + + menu = (struct scene_obj_menu *)obj; + val = menu->cur_item_id; + snprintf(var, sizeof(var), "c.%s", obj->name); + + val = env_get_ulong(var, 10, 0); + if (priv->verbose) + printf("%s=%d\n", var, val); + if (!val) + return log_msg_ret("get", -ENOENT); + + /* + * note that no validation is done here, to make sure the ID is valid + * and actually points to a menu item + */ + menu->cur_item_id = val; + + return 0; +} + +int cedit_read_settings_env(struct expo *exp, bool verbose) +{ + struct cedit_iter_priv priv; + int ret; + + /* write out the items */ + priv.verbose = verbose; + ret = expo_iter_scene_objs(exp, h_read_settings_env, &priv); + if (ret) { + log_debug("Failed to read settings from env (err=%d)\n", ret); + return log_msg_ret("set", ret); + } + + return 0; +} + +/** + * get_cur_menuitem_seq() - Get the sequence number of a menu's current item + * + * Enumerates the items of a menu (0, 1, 2) and returns the sequence number of + * the currently selected item. If the first item is selected, this returns 0; + * if the second, 1; etc. + * + * @menu: Menu to check + * Return: Sequence number on success, else -ve error value + */ +static int get_cur_menuitem_seq(const struct scene_obj_menu *menu) +{ + const struct scene_menitem *mi; + int seq, found; + + seq = 0; + found = -1; + list_for_each_entry(mi, &menu->item_head, sibling) { + if (mi->id == menu->cur_item_id) { + found = seq; + break; + } + seq++; + } + + if (found == -1) + return log_msg_ret("nf", -ENOENT); + + return found; +} + +static int h_write_settings_cmos(struct scene_obj *obj, void *vpriv) +{ + const struct scene_obj_menu *menu; + struct cedit_iter_priv *priv = vpriv; + int val, ret; + uint i, seq; + + if (obj->type != SCENEOBJT_MENU) + return 0; + + menu = (struct scene_obj_menu *)obj; + val = menu->cur_item_id; + + ret = get_cur_menuitem_seq(menu); + if (ret < 0) + return log_msg_ret("cur", ret); + seq = ret; + log_debug("%s: seq=%d\n", menu->obj.name, seq); + + /* figure out where to place this item */ + if (!obj->bit_length) + return log_msg_ret("len", -EINVAL); + if (obj->start_bit + obj->bit_length > CMOS_MAX_BITS) + return log_msg_ret("bit", -E2BIG); + + for (i = 0; i < obj->bit_length; i++, seq >>= 1) { + uint bitnum = obj->start_bit + i; + + priv->mask[CMOS_BYTE(bitnum)] |= 1 << CMOS_BIT(bitnum); + if (seq & 1) + priv->value[CMOS_BYTE(bitnum)] |= BIT(CMOS_BIT(bitnum)); + log_debug("bit %x %x %x\n", bitnum, + priv->mask[CMOS_BYTE(bitnum)], + priv->value[CMOS_BYTE(bitnum)]); + } + + return 0; +} + +int cedit_write_settings_cmos(struct expo *exp, struct udevice *dev, + bool verbose) +{ + struct cedit_iter_priv priv; + int ret, i, count, first, last; + + /* write out the items */ + priv.mask = calloc(1, CMOS_MAX_BYTES); + if (!priv.mask) + return log_msg_ret("mas", -ENOMEM); + priv.value = calloc(1, CMOS_MAX_BYTES); + if (!priv.value) { + free(priv.mask); + return log_msg_ret("val", -ENOMEM); + } + + ret = expo_iter_scene_objs(exp, h_write_settings_cmos, &priv); + if (ret) { + log_debug("Failed to write CMOS (err=%d)\n", ret); + ret = log_msg_ret("set", ret); + goto done; + } + + /* write the data to the RTC */ + first = CMOS_MAX_BYTES; + last = -1; + for (i = 0, count = 0; i < CMOS_MAX_BYTES; i++) { + if (priv.mask[i]) { + log_debug("Write byte %x: %x\n", i, priv.value[i]); + ret = rtc_write8(dev, i, priv.value[i]); + if (ret) { + ret = log_msg_ret("wri", ret); + goto done; + } + count++; + first = min(first, i); + last = max(last, i); + } + } + if (verbose) { + printf("Write %d bytes from offset %x to %x\n", count, first, + last); + } + +done: + free(priv.mask); + free(priv.value); + return ret; +} + +static int h_read_settings_cmos(struct scene_obj *obj, void *vpriv) +{ + struct cedit_iter_priv *priv = vpriv; + const struct scene_menitem *mi; + struct scene_obj_menu *menu; + int val, ret; + uint i; + + if (obj->type != SCENEOBJT_MENU) + return 0; + + menu = (struct scene_obj_menu *)obj; + + /* figure out where to place this item */ + if (!obj->bit_length) + return log_msg_ret("len", -EINVAL); + if (obj->start_bit + obj->bit_length > CMOS_MAX_BITS) + return log_msg_ret("bit", -E2BIG); + + val = 0; + for (i = 0; i < obj->bit_length; i++) { + uint bitnum = obj->start_bit + i; + uint offset = CMOS_BYTE(bitnum); + + /* read the byte if not already read */ + if (!priv->mask[offset]) { + ret = rtc_read8(priv->dev, offset); + if (ret < 0) + return log_msg_ret("rea", ret); + priv->value[offset] = ret; + + /* mark it as read */ + priv->mask[offset] = 0xff; + } + + if (priv->value[offset] & BIT(CMOS_BIT(bitnum))) + val |= BIT(i); + log_debug("bit %x %x\n", bitnum, val); + } + + /* update the current item */ + mi = scene_menuitem_find_seq(menu, val); + if (!mi) + return log_msg_ret("seq", -ENOENT); + + menu->cur_item_id = mi->id; + log_debug("Update menu %d cur_item_id %d\n", menu->obj.id, mi->id); + + return 0; +} + +int cedit_read_settings_cmos(struct expo *exp, struct udevice *dev, + bool verbose) +{ + struct cedit_iter_priv priv; + int ret, i, count, first, last; + + /* read in the items */ + priv.mask = calloc(1, CMOS_MAX_BYTES); + if (!priv.mask) + return log_msg_ret("mas", -ENOMEM); + priv.value = calloc(1, CMOS_MAX_BYTES); + if (!priv.value) { + free(priv.mask); + return log_msg_ret("val", -ENOMEM); + } + priv.dev = dev; + + ret = expo_iter_scene_objs(exp, h_read_settings_cmos, &priv); + if (ret) { + log_debug("Failed to read CMOS (err=%d)\n", ret); + ret = log_msg_ret("set", ret); + goto done; + } + + /* read the data to the RTC */ + first = CMOS_MAX_BYTES; + last = -1; + for (i = 0, count = 0; i < CMOS_MAX_BYTES; i++) { + if (priv.mask[i]) { + log_debug("Read byte %x: %x\n", i, priv.value[i]); + count++; + first = min(first, i); + last = max(last, i); + } + } + if (verbose) { + printf("Read %d bytes from offset %x to %x\n", count, first, + last); + } + +done: + free(priv.mask); + free(priv.value); + return ret; +} diff --git a/boot/expo.c b/boot/expo.c index db837f7..139d684 100644 --- a/boot/expo.c +++ b/boot/expo.c @@ -266,3 +266,18 @@ int expo_apply_theme(struct expo *exp, ofnode node) return 0; } + +int expo_iter_scene_objs(struct expo *exp, expo_scene_obj_iterator iter, + void *priv) +{ + struct scene *scn; + int ret; + + list_for_each_entry(scn, &exp->scene_head, sibling) { + ret = scene_iter_objs(scn, iter, priv); + if (ret) + return log_msg_ret("wr", ret); + } + + return 0; +} diff --git a/boot/expo_build.c b/boot/expo_build.c index 702bf49..910f1b4 100644 --- a/boot/expo_build.c +++ b/boot/expo_build.c @@ -214,22 +214,21 @@ static void list_strings(struct build_info *info) * @info: Build information * @node: Node containing the menu description * @scn: Scene to add the menu to + * @id: ID for the menu + * @objp: Returns the object pointer * Returns: 0 if OK, -ENOMEM if out of memory, -EINVAL if there is a format * error, -ENOENT if there is a references to a non-existent string */ -static int menu_build(struct build_info *info, ofnode node, struct scene *scn) +static int menu_build(struct build_info *info, ofnode node, struct scene *scn, + uint id, struct scene_obj **objp) { struct scene_obj_menu *menu; uint title_id, menu_id; const u32 *item_ids; int ret, size, i; const char *name; - u32 id; name = ofnode_get_name(node); - ret = ofnode_read_u32(node, "id", &id); - if (ret) - return log_msg_ret("id", -EINVAL); ret = scene_menu(scn, name, id, &menu); if (ret < 0) @@ -275,12 +274,13 @@ static int menu_build(struct build_info *info, ofnode node, struct scene *scn) if (ret < 0) return log_msg_ret("mi", ret); } + *objp = &menu->obj; return 0; } /** - * menu_build() - Build an expo object and add it to a scene + * obj_build() - Build an expo object and add it to a scene * * See doc/develop/expo.rst for a description of the format * @@ -292,8 +292,9 @@ static int menu_build(struct build_info *info, ofnode node, struct scene *scn) */ static int obj_build(struct build_info *info, ofnode node, struct scene *scn) { + struct scene_obj *obj; const char *type; - u32 id; + u32 id, val; int ret; log_debug("- object %s\n", ofnode_get_name(node)); @@ -306,12 +307,17 @@ static int obj_build(struct build_info *info, ofnode node, struct scene *scn) return log_msg_ret("typ", -EINVAL); if (!strcmp("menu", type)) - ret = menu_build(info, node, scn); + ret = menu_build(info, node, scn, id, &obj); else ret = -EINVAL; if (ret) return log_msg_ret("bld", ret); + if (!ofnode_read_u32(node, "start-bit", &val)) + obj->start_bit = val; + if (!ofnode_read_u32(node, "bit-length", &val)) + obj->bit_length = val; + return 0; } diff --git a/common/fdt_simplefb.c b/boot/fdt_simplefb.c index 069ced7..069ced7 100644 --- a/common/fdt_simplefb.c +++ b/boot/fdt_simplefb.c diff --git a/common/fdt_support.c b/boot/fdt_support.c index 5e49078..5e49078 100644 --- a/common/fdt_support.c +++ b/boot/fdt_support.c diff --git a/boot/image-sig.c b/boot/image-sig.c index 1aa0b58..b5692d5 100644 --- a/boot/image-sig.c +++ b/boot/image-sig.c @@ -57,20 +57,6 @@ struct checksum_algo *image_get_checksum_algo(const char *full_name) int i; const char *name; - if (IS_ENABLED(CONFIG_NEEDS_MANUAL_RELOC)) { - static bool done; - - if (!done) { - done = true; - for (i = 0; i < ARRAY_SIZE(checksum_algos); i++) { - struct checksum_algo *algo = &checksum_algos[i]; - - MANUAL_RELOC(algo->name); - MANUAL_RELOC(algo->calculate); - } - } - } - for (i = 0; i < ARRAY_SIZE(checksum_algos); i++) { name = checksum_algos[i].name; /* Make sure names match and next char is a comma */ @@ -87,20 +73,6 @@ struct crypto_algo *image_get_crypto_algo(const char *full_name) struct crypto_algo *crypto, *end; const char *name; - if (IS_ENABLED(CONFIG_NEEDS_MANUAL_RELOC)) { - static bool done; - - if (!done) { - done = true; - crypto = ll_entry_start(struct crypto_algo, cryptos); - end = ll_entry_end(struct crypto_algo, cryptos); - for (; crypto < end; crypto++) { - MANUAL_RELOC(crypto->name); - MANUAL_RELOC(crypto->verify); - } - } - } - /* Move name to after the comma */ name = strchr(full_name, ','); if (!name) diff --git a/boot/image.c b/boot/image.c index 5c4f9b8..88b67bc 100644 --- a/boot/image.c +++ b/boot/image.c @@ -182,6 +182,7 @@ static const table_entry_t uimage_type[] = { { IH_TYPE_SUNXI_TOC0, "sunxi_toc0", "Allwinner TOC0 Boot Image" }, { IH_TYPE_FDT_LEGACY, "fdt_legacy", "legacy Image with Flat Device Tree ", }, { IH_TYPE_RENESAS_SPKG, "spkgimage", "Renesas SPKG Image" }, + { IH_TYPE_STARFIVE_SPL, "sfspl", "StarFive SPL Image" }, { -1, "", "", }, }; @@ -571,7 +572,7 @@ const char *genimg_get_cat_name(enum ih_category category, uint id) entry = get_table_entry(table_info[category].table, id); if (!entry) return unknown_msg(category); - return manual_reloc(entry->lname); + return entry->lname; } /** @@ -591,7 +592,7 @@ const char *genimg_get_cat_short_name(enum ih_category category, uint id) entry = get_table_entry(table_info[category].table, id); if (!entry) return unknown_msg(category); - return manual_reloc(entry->sname); + return entry->sname; } int genimg_get_cat_count(enum ih_category category) @@ -641,7 +642,7 @@ char *get_table_entry_name(const table_entry_t *table, char *msg, int id) table = get_table_entry(table, id); if (!table) return msg; - return manual_reloc(table->lname); + return table->lname; } const char *genimg_get_os_name(uint8_t os) @@ -676,7 +677,7 @@ static const char *genimg_get_short_name(const table_entry_t *table, int val) table = get_table_entry(table, val); if (!table) return "unknown"; - return manual_reloc(table->sname); + return table->sname; } const char *genimg_get_type_short_name(uint8_t type) @@ -719,7 +720,7 @@ int get_table_entry_id(const table_entry_t *table, const table_entry_t *t; for (t = table; t->id >= 0; ++t) { - if (t->sname && !strcasecmp(manual_reloc(t->sname), name)) + if (t->sname && !strcasecmp(t->sname, name)) return t->id; } debug("Invalid %s Type: %s\n", table_name, name); diff --git a/boot/pxe_utils.c b/boot/pxe_utils.c index d13c47d..a92bb89 100644 --- a/boot/pxe_utils.c +++ b/boot/pxe_utils.c @@ -554,7 +554,7 @@ static int label_boot(struct pxe_context *ctx, struct pxe_label *label) label->name); goto cleanup; } - + strcpy(initrd_filesize, simple_xtoa(size)); initrd_addr_str = env_get("ramdisk_addr_r"); size = snprintf(initrd_str, sizeof(initrd_str), "%s:%lx", initrd_addr_str, size); @@ -702,8 +702,8 @@ static int label_boot(struct pxe_context *ctx, struct pxe_label *label) } } - if (label->kaslrseed) - label_boot_kaslrseed(); + if (label->kaslrseed) + label_boot_kaslrseed(); #ifdef CONFIG_OF_LIBFDT_OVERLAY if (label->fdtoverlays) diff --git a/boot/scene.c b/boot/scene.c index e523333..6c52948 100644 --- a/boot/scene.c +++ b/boot/scene.c @@ -79,7 +79,7 @@ int scene_obj_count(struct scene *scn) return count; } -void *scene_obj_find(struct scene *scn, uint id, enum scene_obj_t type) +void *scene_obj_find(const struct scene *scn, uint id, enum scene_obj_t type) { struct scene_obj *obj; @@ -681,3 +681,19 @@ int scene_set_open(struct scene *scn, uint id, bool open) return 0; } + +int scene_iter_objs(struct scene *scn, expo_scene_obj_iterator iter, + void *priv) +{ + struct scene_obj *obj; + + list_for_each_entry(obj, &scn->obj_head, sibling) { + int ret; + + ret = iter(obj, priv); + if (ret) + return log_msg_ret("itr", ret); + } + + return 0; +} diff --git a/boot/scene_internal.h b/boot/scene_internal.h index fb1ea55..695a907 100644 --- a/boot/scene_internal.h +++ b/boot/scene_internal.h @@ -9,6 +9,8 @@ #ifndef __SCENE_INTERNAL_H #define __SCENE_INTERNAL_H +typedef int (*expo_scene_obj_iterator)(struct scene_obj *obj, void *priv); + /** * expo_lookup_scene_id() - Look up a scene ID * @@ -38,7 +40,7 @@ uint resolve_id(struct expo *exp, uint id); * @type: Type of the object, or SCENEOBJT_NONE to match any type * Returns: Object found, or NULL if not found */ -void *scene_obj_find(struct scene *scn, uint id, enum scene_obj_t type); +void *scene_obj_find(const struct scene *scn, uint id, enum scene_obj_t type); /** * scene_obj_find_by_name() - Find an object in a scene by name @@ -198,4 +200,50 @@ int scene_menu_render_deps(struct scene *scn, struct scene_obj_menu *menu); */ int scene_menu_calc_dims(struct scene_obj_menu *menu); +/** + * scene_iter_objs() - Iterate through all scene objects + * + * @scn: Scene to process + * @iter: Iterator to call on each object + * @priv: Private data to pass to the iterator, in addition to the object + * Return: 0 if OK, -ve on error + */ +int scene_iter_objs(struct scene *scn, expo_scene_obj_iterator iter, + void *priv); + +/** + * expo_iter_scene_objects() - Iterate through all scene objects + * + * @exp: Expo to process + * @iter: Iterator to call on each object + * @priv: Private data to pass to the iterator, in addition to the object + * Return: 0 if OK, -ve on error + */ +int expo_iter_scene_objs(struct expo *exp, expo_scene_obj_iterator iter, + void *priv); + +/** + * scene_menuitem_find() - Find the menu item for an ID + * + * Looks up the menu to find the item with the given ID + * + * @menu: Menu to check + * @id: ID to look for + * Return: Menu item, or NULL if not found + */ +struct scene_menitem *scene_menuitem_find(const struct scene_obj_menu *menu, + int id); + +/** + * scene_menuitem_find_seq() - Find the menu item at a sequential position + * + * This numbers the items from 0 and returns the seq'th one + * + * @menu: Menu to check + * @seq: Sequence number to look for + * Return: menu item if found, else NULL + */ +struct scene_menitem *scene_menuitem_find_seq(const struct scene_obj_menu *menu, + uint seq); + #endif /* __SCENE_INTERNAL_H */ diff --git a/boot/scene_menu.c b/boot/scene_menu.c index 8a355f8..e0dcd0a 100644 --- a/boot/scene_menu.c +++ b/boot/scene_menu.c @@ -33,8 +33,8 @@ void scene_menu_destroy(struct scene_obj_menu *menu) scene_menuitem_destroy(item); } -static struct scene_menitem *scene_menuitem_find(struct scene_obj_menu *menu, - int id) +struct scene_menitem *scene_menuitem_find(const struct scene_obj_menu *menu, + int id) { struct scene_menitem *item; @@ -46,6 +46,22 @@ static struct scene_menitem *scene_menuitem_find(struct scene_obj_menu *menu, return NULL; } +struct scene_menitem *scene_menuitem_find_seq(const struct scene_obj_menu *menu, + uint seq) +{ + struct scene_menitem *item; + uint i; + + i = 0; + list_for_each_entry(item, &menu->item_head, sibling) { + if (i == seq) + return item; + i++; + } + + return NULL; +} + /** * update_pointers() - Update the pointer object and handle highlights * @@ -416,7 +432,7 @@ int scene_menuitem(struct scene *scn, uint menu_id, const char *name, uint id, if (!scene_obj_find(scn, label_id, SCENEOBJT_TEXT)) return log_msg_ret("txt", -EINVAL); - item = calloc(1, sizeof(struct scene_obj_menu)); + item = calloc(1, sizeof(struct scene_menitem)); if (!item) return log_msg_ret("item", -ENOMEM); item->name = strdup(name); diff --git a/boot/vbe_request.c b/boot/vbe_request.c index 312edfa..2f218d4 100644 --- a/boot/vbe_request.c +++ b/boot/vbe_request.c @@ -230,4 +230,4 @@ static int bootmeth_vbe_ft_fixup(void *ctx, struct event *event) return 0; } -EVENT_SPY(EVT_FT_FIXUP, bootmeth_vbe_ft_fixup); +EVENT_SPY_FULL(EVT_FT_FIXUP, bootmeth_vbe_ft_fixup); diff --git a/boot/vbe_simple_os.c b/boot/vbe_simple_os.c index 8c641ec..3285e43 100644 --- a/boot/vbe_simple_os.c +++ b/boot/vbe_simple_os.c @@ -109,4 +109,4 @@ static int bootmeth_vbe_simple_ft_fixup(void *ctx, struct event *event) return 0; } -EVENT_SPY(EVT_FT_FIXUP, bootmeth_vbe_simple_ft_fixup); +EVENT_SPY_FULL(EVT_FT_FIXUP, bootmeth_vbe_simple_ft_fixup); diff --git a/cmd/Kconfig b/cmd/Kconfig index 43ca10f..6470b13 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -500,11 +500,6 @@ config CMD_XIMG help Extract a part of a multi-image. -config CMD_XXD - bool "xxd" - help - Print file as hexdump to standard output - config CMD_SPL bool "spl export - Export boot information for Falcon boot" depends on SPL @@ -517,7 +512,7 @@ config CMD_SPL config CMD_SPL_NAND_OFS hex "Offset of OS args or dtb for Falcon-mode NAND boot" depends on CMD_SPL && (TPL_NAND_SUPPORT || SPL_NAND_SUPPORT) - default 0 + default 0x0 help This provides the offset of the command line arguments for Linux when booting from NAND in Falcon mode. See doc/README.falcon @@ -527,7 +522,7 @@ config CMD_SPL_NAND_OFS config CMD_SPL_NOR_OFS hex "Offset of OS args or dtb for Falcon-mode NOR boot" depends on CMD_SPL && SPL_NOR_SUPPORT - default 0 + default 0x0 help This provides the offset of the command line arguments or dtb for Linux when booting from NOR in Falcon mode. @@ -544,6 +539,8 @@ config CMD_SPL_WRITE_SIZE config CMD_THOR_DOWNLOAD bool "thor - TIZEN 'thor' download" select DFU + select USB_FUNCTION_THOR + depends on USB_GADGET_DOWNLOAD help Implements the 'thor' download protocol. This is a way of downloading a software update over USB from an attached host. @@ -1524,7 +1521,7 @@ config DEFAULT_SPI_BUS config DEFAULT_SPI_MODE hex "default spi mode used by sspi command (see include/spi.h)" depends on CMD_SPI - default 0 + default 0x0 config CMD_TEMPERATURE bool "temperature - display the temperature from thermal sensors" @@ -1666,6 +1663,11 @@ config CMD_SETEXPR_FMT Evaluate format string expression and store result in an environment variable. +config CMD_XXD + bool "xxd" + help + Print file as hexdump to standard output + endmenu menu "Android support commands" @@ -1815,7 +1817,7 @@ config BOOTP_PXE_CLIENTARCH depends on BOOTP_PXE default 0x16 if ARM64 default 0x15 if ARM - default 0 if X86 + default 0x0 if X86 config BOOTP_VCI_STRING string @@ -7,6 +7,7 @@ #include <command.h> #include <dm.h> #include <adc.h> +#include <linux/printk.h> static int do_adc_list(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) diff --git a/cmd/blkcache.c b/cmd/blkcache.c index 47ea1ec..1456654 100644 --- a/cmd/blkcache.c +++ b/cmd/blkcache.c @@ -46,24 +46,11 @@ static struct cmd_tbl cmd_blkc_sub[] = { U_BOOT_CMD_MKENT(configure, 3, 0, blkc_configure, "", ""), }; -static __maybe_unused void blkc_reloc(void) -{ - static int relocated; - - if (!relocated) { - fixup_cmdtable(cmd_blkc_sub, ARRAY_SIZE(cmd_blkc_sub)); - relocated = 1; - }; -} - static int do_blkcache(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { struct cmd_tbl *c; -#ifdef CONFIG_NEEDS_MANUAL_RELOC - blkc_reloc(); -#endif if (argc < 2) return CMD_RET_USAGE; diff --git a/cmd/bootflow.c b/cmd/bootflow.c index c0aa4f8..300ad3a 100644 --- a/cmd/bootflow.c +++ b/cmd/bootflow.c @@ -9,6 +9,7 @@ #include <common.h> #include <bootdev.h> #include <bootflow.h> +#include <bootm.h> #include <bootstd.h> #include <command.h> #include <console.h> @@ -70,7 +71,7 @@ static void show_bootflow(int index, struct bootflow *bflow, bool errors) printf("%3x %-11s %-6s %-9.9s %4x %-25.25s %s\n", index, bflow->method->name, bootflow_state_get_name(bflow->state), bflow->dev ? dev_get_uclass_name(dev_get_parent(bflow->dev)) : - "(none)", bflow->part, bflow->name, bflow->fname); + "(none)", bflow->part, bflow->name, bflow->fname ?: ""); if (errors) report_bootflow_err(bflow, bflow->err); } @@ -303,11 +304,14 @@ static int do_bootflow_info(struct cmd_tbl *cmdtp, int flag, int argc, { struct bootstd_priv *std; struct bootflow *bflow; + bool x86_setup = false; bool dump = false; int ret; - if (argc > 1 && *argv[1] == '-') + if (argc > 1 && *argv[1] == '-') { dump = strchr(argv[1], 'd'); + x86_setup = strchr(argv[1], 's'); + } ret = bootstd_get_priv(&std); if (ret) @@ -319,6 +323,12 @@ static int do_bootflow_info(struct cmd_tbl *cmdtp, int flag, int argc, } bflow = std->cur_bootflow; + if (IS_ENABLED(CONFIG_X86) && x86_setup) { + zimage_dump(bflow->x86_setup, false); + + return 0; + } + printf("Name: %s\n", bflow->name); printf("Device: %s\n", bflow->dev->name); printf("Block dev: %s\n", bflow->blk ? bflow->blk->name : "(none)"); @@ -369,6 +379,35 @@ static int do_bootflow_info(struct cmd_tbl *cmdtp, int flag, int argc, return 0; } +static int do_bootflow_read(struct cmd_tbl *cmdtp, int flag, int argc, + char *const argv[]) +{ + struct bootstd_priv *std; + struct bootflow *bflow; + int ret; + + ret = bootstd_get_priv(&std); + if (ret) + return CMD_RET_FAILURE; + + /* + * Require a current bootflow. Users can use 'bootflow scan -b' to + * automatically scan and boot, if needed. + */ + if (!std->cur_bootflow) { + printf("No bootflow selected\n"); + return CMD_RET_FAILURE; + } + bflow = std->cur_bootflow; + ret = bootflow_read_all(bflow); + if (ret) { + printf("Failed: err=%dE\n", ret); + return CMD_RET_FAILURE; + } + + return 0; +} + static int do_bootflow_boot(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { @@ -508,8 +547,9 @@ static char bootflow_help_text[] = "scan [-abeGl] [bdev] - scan for valid bootflows (-l list, -a all, -e errors, -b boot, -G no global)\n" "bootflow list [-e] - list scanned bootflows (-e errors)\n" "bootflow select [<num>|<name>] - select a bootflow\n" - "bootflow info [-d] - show info on current bootflow (-d dump bootflow)\n" - "bootflow boot - boot current bootflow (or first available if none selected)\n" + "bootflow info [-ds] - show info on current bootflow (-d dump bootflow)\n" + "bootflow read - read all current-bootflow files\n" + "bootflow boot - boot current bootflow\n" "bootflow menu [-t] - show a menu of available bootflows\n" "bootflow cmdline [set|get|clear|delete|auto] <param> [<value>] - update cmdline"; #else @@ -523,6 +563,7 @@ U_BOOT_CMD_WITH_SUBCMDS(bootflow, "Boot flows", bootflow_help_text, U_BOOT_SUBCMD_MKENT(list, 2, 1, do_bootflow_list), U_BOOT_SUBCMD_MKENT(select, 2, 1, do_bootflow_select), U_BOOT_SUBCMD_MKENT(info, 2, 1, do_bootflow_info), + U_BOOT_SUBCMD_MKENT(read, 1, 1, do_bootflow_read), U_BOOT_SUBCMD_MKENT(boot, 1, 1, do_bootflow_boot), U_BOOT_SUBCMD_MKENT(menu, 2, 1, do_bootflow_menu), U_BOOT_SUBCMD_MKENT(cmdline, 4, 1, do_bootflow_cmdline), diff --git a/cmd/bootm.c b/cmd/bootm.c index 37c2af9..7968415 100644 --- a/cmd/bootm.c +++ b/cmd/bootm.c @@ -123,20 +123,6 @@ int do_bootm(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) int states; int ret; -#ifdef CONFIG_NEEDS_MANUAL_RELOC - static int relocated = 0; - - if (!relocated) { - int i; - - /* relocate names of sub-command table */ - for (i = 0; i < ARRAY_SIZE(cmd_bootm_sub); i++) - cmd_bootm_sub[i].name += gd->reloc_off; - - relocated = 1; - } -#endif - /* determine if we have a sub command */ argc--; argv++; if (argc > 0) { diff --git a/cmd/cedit.c b/cmd/cedit.c index 0cae304..2ff284f 100644 --- a/cmd/cedit.c +++ b/cmd/cedit.c @@ -7,14 +7,29 @@ */ #include <common.h> +#include <abuf.h> +#include <cedit.h> #include <command.h> +#include <dm.h> #include <expo.h> #include <fs.h> +#include <malloc.h> +#include <mapmem.h> #include <dm/ofnode.h> #include <linux/sizes.h> struct expo *cur_exp; +static int check_cur_expo(void) +{ + if (!cur_exp) { + printf("No expo loaded\n"); + return -ENOENT; + } + + return 0; +} + static int do_cedit_load(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { @@ -53,18 +68,192 @@ static int do_cedit_load(struct cmd_tbl *cmdtp, int flag, int argc, return 0; } +static int do_cedit_write_fdt(struct cmd_tbl *cmdtp, int flag, int argc, + char *const argv[]) +{ + const char *fname; + struct abuf buf; + loff_t bytes; + int ret; + + if (argc < 4) + return CMD_RET_USAGE; + fname = argv[3]; + + if (check_cur_expo()) + return CMD_RET_FAILURE; + + ret = cedit_write_settings(cur_exp, &buf); + if (ret) { + printf("Failed to write settings: %dE\n", ret); + return CMD_RET_FAILURE; + } + + if (fs_set_blk_dev(argv[1], argv[2], FS_TYPE_ANY)) + return CMD_RET_FAILURE; + + ret = fs_write(fname, map_to_sysmem(abuf_data(&buf)), 0, + abuf_size(&buf), &bytes); + if (ret) + return CMD_RET_FAILURE; + + return 0; +} + +static int do_cedit_read_fdt(struct cmd_tbl *cmdtp, int flag, int argc, + char *const argv[]) +{ + const char *fname; + void *buf; + oftree tree; + ulong size; + int ret; + + if (argc < 4) + return CMD_RET_USAGE; + fname = argv[3]; + + ret = fs_load_alloc(argv[1], argv[2], argv[3], SZ_1M, 0, &buf, &size); + if (ret) { + printf("File not found\n"); + return CMD_RET_FAILURE; + } + + tree = oftree_from_fdt(buf); + if (!oftree_valid(tree)) { + free(buf); + printf("Cannot create oftree\n"); + return CMD_RET_FAILURE; + } + + ret = cedit_read_settings(cur_exp, tree); + oftree_dispose(tree); + free(buf); + if (ret) { + printf("Failed to read settings: %dE\n", ret); + return CMD_RET_FAILURE; + } + + return 0; +} + +static int do_cedit_write_env(struct cmd_tbl *cmdtp, int flag, int argc, + char *const argv[]) +{ + bool verbose; + int ret; + + if (check_cur_expo()) + return CMD_RET_FAILURE; + + verbose = argc > 1 && !strcmp(argv[1], "-v"); + + ret = cedit_write_settings_env(cur_exp, verbose); + if (ret) { + printf("Failed to write settings to environment: %dE\n", ret); + return CMD_RET_FAILURE; + } + + return 0; +} + +static int do_cedit_read_env(struct cmd_tbl *cmdtp, int flag, int argc, + char *const argv[]) +{ + bool verbose; + int ret; + + if (check_cur_expo()) + return CMD_RET_FAILURE; + + verbose = argc > 1 && !strcmp(argv[1], "-v"); + + ret = cedit_read_settings_env(cur_exp, verbose); + if (ret) { + printf("Failed to read settings from environment: %dE\n", ret); + return CMD_RET_FAILURE; + } + + return 0; +} + +static int do_cedit_write_cmos(struct cmd_tbl *cmdtp, int flag, int argc, + char *const argv[]) +{ + struct udevice *dev; + bool verbose = false; + int ret; + + if (check_cur_expo()) + return CMD_RET_FAILURE; + + if (argc > 1 && !strcmp(argv[1], "-v")) { + verbose = true; + argc--; + argv++; + } + + if (argc > 1) + ret = uclass_get_device_by_name(UCLASS_RTC, argv[1], &dev); + else + ret = uclass_first_device_err(UCLASS_RTC, &dev); + if (ret) { + printf("Failed to get RTC device: %dE\n", ret); + return CMD_RET_FAILURE; + } + + if (cedit_write_settings_cmos(cur_exp, dev, verbose)) { + printf("Failed to write settings to CMOS\n"); + return CMD_RET_FAILURE; + } + + return 0; +} + +static int do_cedit_read_cmos(struct cmd_tbl *cmdtp, int flag, int argc, + char *const argv[]) +{ + struct udevice *dev; + bool verbose = false; + int ret; + + if (check_cur_expo()) + return CMD_RET_FAILURE; + + if (argc > 1 && !strcmp(argv[1], "-v")) { + verbose = true; + argc--; + argv++; + } + + if (argc > 1) + ret = uclass_get_device_by_name(UCLASS_RTC, argv[1], &dev); + else + ret = uclass_first_device_err(UCLASS_RTC, &dev); + if (ret) { + printf("Failed to get RTC device: %dE\n", ret); + return CMD_RET_FAILURE; + } + + ret = cedit_read_settings_cmos(cur_exp, dev, verbose); + if (ret) { + printf("Failed to read settings from CMOS: %dE\n", ret); + return CMD_RET_FAILURE; + } + + return 0; +} + static int do_cedit_run(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { ofnode node; int ret; - if (!cur_exp) { - printf("No expo loaded\n"); + if (check_cur_expo()) return CMD_RET_FAILURE; - } - node = ofnode_path("/cedit-theme"); + node = ofnode_path("/bootstd/cedit-theme"); if (ofnode_valid(node)) { ret = expo_apply_theme(cur_exp, node); if (ret) @@ -84,10 +273,22 @@ static int do_cedit_run(struct cmd_tbl *cmdtp, int flag, int argc, #ifdef CONFIG_SYS_LONGHELP static char cedit_help_text[] = "load <interface> <dev[:part]> <filename> - load config editor\n" + "cedit read_fdt <i/f> <dev[:part]> <filename> - read settings\n" + "cedit write_fdt <i/f> <dev[:part]> <filename> - write settings\n" + "cedit read_env [-v] - read settings from env vars\n" + "cedit write_env [-v] - write settings to env vars\n" + "cedit read_cmos [-v] [dev] - read settings from CMOS RAM\n" + "cedit write_cmos [-v] [dev] - write settings to CMOS RAM\n" "cedit run - run config editor"; #endif /* CONFIG_SYS_LONGHELP */ U_BOOT_CMD_WITH_SUBCMDS(cedit, "Configuration editor", cedit_help_text, U_BOOT_SUBCMD_MKENT(load, 5, 1, do_cedit_load), + U_BOOT_SUBCMD_MKENT(read_fdt, 5, 1, do_cedit_read_fdt), + U_BOOT_SUBCMD_MKENT(write_fdt, 5, 1, do_cedit_write_fdt), + U_BOOT_SUBCMD_MKENT(read_env, 2, 1, do_cedit_read_env), + U_BOOT_SUBCMD_MKENT(write_env, 2, 1, do_cedit_write_env), + U_BOOT_SUBCMD_MKENT(read_cmos, 2, 1, do_cedit_read_cmos), + U_BOOT_SUBCMD_MKENT(write_cmos, 2, 1, do_cedit_write_cmos), U_BOOT_SUBCMD_MKENT(run, 1, 1, do_cedit_run), ); @@ -20,12 +20,6 @@ static const char * const weekdays[] = { "Sun", "Mon", "Tues", "Wednes", "Thurs", "Fri", "Satur", }; -#ifdef CONFIG_NEEDS_MANUAL_RELOC -#define RELOC(a) ((typeof(a))((unsigned long)(a) + gd->reloc_off)) -#else -#define RELOC(a) a -#endif - int mk_date (const char *, struct rtc_time *); static struct rtc_time default_tm = { 0, 0, 0, 1, 1, 2000, 6, 0, 0 }; @@ -113,7 +107,7 @@ static int do_date(struct cmd_tbl *cmdtp, int flag, int argc, printf ("Date: %4d-%02d-%02d (%sday) Time: %2d:%02d:%02d\n", tm.tm_year, tm.tm_mon, tm.tm_mday, (tm.tm_wday<0 || tm.tm_wday>6) ? - "unknown " : RELOC(weekdays[tm.tm_wday]), + "unknown " : weekdays[tm.tm_wday], tm.tm_hour, tm.tm_min, tm.tm_sec); break; @@ -59,11 +59,26 @@ static int do_dm_dump_static_driver_info(struct cmd_tbl *cmdtp, int flag, static int do_dm_dump_tree(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { - bool sort; - - sort = argc > 1 && !strcmp(argv[1], "-s"); - - dm_dump_tree(sort); + bool extended = false, sort = false; + char *device = NULL; + + for (; argc > 1; argc--, argv++) { + if (argv[1][0] != '-') + break; + + if (!strcmp(argv[1], "-e")) { + extended = true; + } else if (!strcmp(argv[1], "-s")) { + sort = true; + } else { + printf("Unknown parameter: %s\n", argv[1]); + return 0; + } + } + if (argc > 1) + device = argv[1]; + + dm_dump_tree(device, extended, sort); return 0; } @@ -71,7 +86,20 @@ static int do_dm_dump_tree(struct cmd_tbl *cmdtp, int flag, int argc, static int do_dm_dump_uclass(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { - dm_dump_uclass(); + bool extended = false; + char *uclass = NULL; + + if (argc > 1) { + if (!strcmp(argv[1], "-e")) { + extended = true; + argc--; + argv++; + } + if (argc > 1) + uclass = argv[1]; + } + + dm_dump_uclass(uclass, extended); return 0; } @@ -91,8 +119,8 @@ static char dm_help_text[] = "dm drivers Dump list of drivers with uclass and instances\n" DM_MEM_HELP "dm static Dump list of drivers with static platform data\n" - "dm tree [-s] Dump tree of driver model devices (-s=sort)\n" - "dm uclass Dump list of instances for each uclass" + "dm tree [-s][-e][name] Dump tree of driver model devices (-s=sort)\n" + "dm uclass [-e][name] Dump list of instances for each uclass" ; #endif @@ -102,5 +130,5 @@ U_BOOT_CMD_WITH_SUBCMDS(dm, "Driver model low level access", dm_help_text, U_BOOT_SUBCMD_MKENT(drivers, 1, 1, do_dm_dump_drivers), DM_MEM U_BOOT_SUBCMD_MKENT(static, 1, 1, do_dm_dump_static_driver_info), - U_BOOT_SUBCMD_MKENT(tree, 2, 1, do_dm_dump_tree), - U_BOOT_SUBCMD_MKENT(uclass, 1, 1, do_dm_dump_uclass)); + U_BOOT_SUBCMD_MKENT(tree, 4, 1, do_dm_dump_tree), + U_BOOT_SUBCMD_MKENT(uclass, 3, 1, do_dm_dump_uclass)); diff --git a/cmd/fastboot.c b/cmd/fastboot.c index 3d5ff95..c3c1923 100644 --- a/cmd/fastboot.c +++ b/cmd/fastboot.c @@ -14,6 +14,7 @@ #include <net.h> #include <usb.h> #include <watchdog.h> +#include <linux/printk.h> #include <linux/stringify.h> static int do_fastboot_udp(int argc, char *const argv[], @@ -61,6 +62,7 @@ static int do_fastboot_usb(int argc, char *const argv[], { int controller_index; char *usb_controller; + struct udevice *udc; char *endp; int ret; @@ -79,7 +81,7 @@ static int do_fastboot_usb(int argc, char *const argv[], return CMD_RET_FAILURE; } - ret = usb_gadget_initialize(controller_index); + ret = udc_device_get_by_index(controller_index, &udc); if (ret) { pr_err("USB init failed: %d\n", ret); return CMD_RET_FAILURE; @@ -103,13 +105,13 @@ static int do_fastboot_usb(int argc, char *const argv[], if (ctrlc()) break; schedule(); - usb_gadget_handle_interrupts(controller_index); + dm_usb_gadget_handle_interrupts(udc); } ret = CMD_RET_SUCCESS; exit: - usb_gadget_release(controller_index); + udc_device_put(udc); g_dnl_unregister(); g_dnl_clear_detach(); @@ -162,22 +162,31 @@ static bool found_key(const char *str, const char *key) return result; } +/** + * calc_parts_list_len() - get size of partition table description + * + * @numparts: number of partitions + * Return: string size including terminating NUL + */ static int calc_parts_list_len(int numparts) { - int partlistlen = UUID_STR_LEN + 1 + strlen("uuid_disk="); - /* for the comma */ - partlistlen++; - - /* per-partition additions; numparts starts at 1, so this should be correct */ - partlistlen += numparts * (strlen("name=,") + PART_NAME_LEN + 1); + /* number of hexadecimal digits of the lbaint_t representation */ + const int lbaint_size = 2 * sizeof(lbaint_t); + int partlistlen; + + /* media description including terminating NUL */ + partlistlen = strlen("uuid_disk=;") + UUID_STR_LEN + 1; + /* per-partition descriptions; numparts */ + partlistlen += numparts * (strlen("name=,") + PART_NAME_LEN); /* see part.h for definition of struct disk_partition */ - partlistlen += numparts * (strlen("start=MiB,") + sizeof(lbaint_t) + 1); - partlistlen += numparts * (strlen("size=MiB,") + sizeof(lbaint_t) + 1); - partlistlen += numparts * (strlen("uuid=;") + UUID_STR_LEN + 1); - /* for the terminating null */ - partlistlen++; - debug("Length of partitions_list is %d for %d partitions\n", partlistlen, - numparts); + partlistlen += numparts * (strlen("start=0x,") + lbaint_size); + partlistlen += numparts * (strlen("size=0x,") + lbaint_size); + if (IS_ENABLED(CONFIG_PARTITION_UUIDS)) + partlistlen += numparts * (strlen("uuid=,") + UUID_STR_LEN); + if (IS_ENABLED(CONFIG_PARTITION_TYPE_GUID)) + partlistlen += numparts * (strlen("type=;") + UUID_STR_LEN); + debug("Length of partitions_list is %d for %d partitions\n", + partlistlen, numparts); return partlistlen; } @@ -211,12 +220,12 @@ static struct disk_part *allocate_disk_part(struct disk_partition *info, PART_TYPE_LEN); newpart->gpt_part_info.type[PART_TYPE_LEN - 1] = '\0'; newpart->gpt_part_info.bootable = info->bootable; -#ifdef CONFIG_PARTITION_UUIDS - strncpy(newpart->gpt_part_info.uuid, (const char *)info->uuid, - UUID_STR_LEN); - /* UUID_STR_LEN is correct, as uuid[]'s length is UUID_STR_LEN+1 chars */ - newpart->gpt_part_info.uuid[UUID_STR_LEN] = '\0'; -#endif + if (IS_ENABLED(CONFIG_PARTITION_UUIDS)) + disk_partition_set_uuid(&newpart->gpt_part_info, + disk_partition_uuid(info)); + if (IS_ENABLED(CONFIG_PARTITION_TYPE_GUID)) + disk_partition_set_type_guid(&newpart->gpt_part_info, + disk_partition_type_guid(info)); newpart->partnum = partnum; return newpart; @@ -252,9 +261,12 @@ static void print_gpt_info(void) curr->gpt_part_info.name); printf("Type %s, bootable %d\n", curr->gpt_part_info.type, curr->gpt_part_info.bootable & PART_BOOTABLE); -#ifdef CONFIG_PARTITION_UUIDS - printf("UUID %s\n", curr->gpt_part_info.uuid); -#endif + if (CONFIG_IS_ENABLED(PARTITION_UUIDS)) + printf("UUID %s\n", + disk_partition_uuid(&curr->gpt_part_info)); + if (IS_ENABLED(CONFIG_PARTITION_TYPE_GUID)) + printf("Type GUID %s\n", + disk_partition_type_guid(&curr->gpt_part_info)); printf("\n"); } } @@ -299,9 +311,20 @@ static int create_gpt_partitions_list(int numparts, const char *guid, curr->gpt_part_info.blksz); strncat(partitions_list, partstr, PART_NAME_LEN + 1); - strcat(partitions_list, ",uuid="); - strncat(partitions_list, curr->gpt_part_info.uuid, - UUID_STR_LEN + 1); + if (IS_ENABLED(CONFIG_PARTITION_TYPE_GUID)) { + strcat(partitions_list, ",type="); + strncat(partitions_list, + disk_partition_type_guid(&curr->gpt_part_info), + UUID_STR_LEN + 1); + } + if (CONFIG_IS_ENABLED(PARTITION_UUIDS)) { + strcat(partitions_list, ",uuid="); + strncat(partitions_list, + disk_partition_uuid(&curr->gpt_part_info), + UUID_STR_LEN + 1); + } + if (curr->gpt_part_info.bootable & PART_BOOTABLE) + strcat(partitions_list, ",bootable"); strcat(partitions_list, ";"); } return 0; @@ -725,7 +748,7 @@ static int gpt_enumerate(struct blk_desc *desc) * gpt_setenv_part_variables() - setup partition environmental variables * * Setup the gpt_partition_name, gpt_partition_entry, gpt_partition_addr - * and gpt_partition_size environment variables. + * and gpt_partition_size, gpt_partition_bootable environment variables. * * @pinfo: pointer to disk partition * @i: partition entry @@ -752,6 +775,10 @@ static int gpt_setenv_part_variables(struct disk_partition *pinfo, int i) if (ret) goto fail; + ret = env_set_ulong("gpt_partition_bootable", !!(pinfo->bootable & PART_BOOTABLE)); + if (ret) + goto fail; + return 0; fail: @@ -835,8 +862,9 @@ static int do_rename_gpt_parts(struct blk_desc *dev_desc, char *subcomm, u8 part_count = 0; int partlistlen, ret, numparts = 0, partnum, i = 1, ctr1 = 0, ctr2 = 0; - if ((subcomm == NULL) || (name1 == NULL) || (name2 == NULL) || - (strcmp(subcomm, "swap") && (strcmp(subcomm, "rename")))) + if (!subcomm || !name1 || !name2 || + (strcmp(subcomm, "swap") && strcmp(subcomm, "rename") && + strcmp(subcomm, "transpose"))) return -EINVAL; ret = get_disk_guid(dev_desc, disk_guid); @@ -897,6 +925,41 @@ static int do_rename_gpt_parts(struct blk_desc *dev_desc, char *subcomm, ret = -EINVAL; goto out; } + } else if (!strcmp(subcomm, "transpose")) { + int idx1, idx2; + struct disk_partition* first = NULL; + struct disk_partition* second= NULL; + struct disk_partition tmp_part; + + idx1 = simple_strtoul(name1, NULL, 10); + idx2 = simple_strtoul(name2, NULL, 10); + if (idx1 == idx2) { + printf("Cannot swap partition with itself\n"); + ret = -EINVAL; + goto out; + } + + list_for_each(pos, &disk_partitions) { + curr = list_entry(pos, struct disk_part, list); + if (curr->partnum == idx1) + first = &curr->gpt_part_info; + else if (curr->partnum == idx2) + second = &curr->gpt_part_info; + } + if (!first) { + printf("Illegal partition number %s\n", name1); + ret = -EINVAL; + goto out; + } + if (!second) { + printf("Illegal partition number %s\n", name2); + ret = -EINVAL; + goto out; + } + + tmp_part = *first; + *first = *second; + *second = tmp_part; } else { /* rename */ if (strlen(name2) > PART_NAME_LEN) { printf("Names longer than %d characters are truncated.\n", PART_NAME_LEN); @@ -968,6 +1031,81 @@ static int do_rename_gpt_parts(struct blk_desc *dev_desc, char *subcomm, free(partitions_list); return ret; } + +/** + * gpt_set_bootable() - Set bootable flags for partitions + * + * Sets the bootable flag for any partition names in the comma separated list of + * partition names. Any partitions not in the list have their bootable flag + * cleared + * + * @desc: block device descriptor + * @name: Comma separated list of partition names + * + * @Return: '0' on success and -ve error on failure + */ +static int gpt_set_bootable(struct blk_desc *blk_dev_desc, char *const part_list) +{ + char *name; + char disk_guid[UUID_STR_LEN + 1]; + struct list_head *pos; + struct disk_part *curr; + struct disk_partition *partitions = NULL; + int part_count = 0; + int ret = get_disk_guid(blk_dev_desc, disk_guid); + + if (ret < 0) + return ret; + + ret = get_gpt_info(blk_dev_desc); + if (ret <= 0) + goto out; + + part_count = ret; + partitions = malloc(sizeof(*partitions) * part_count); + if (!partitions) { + ret = -ENOMEM; + goto out; + } + + /* Copy partitions and clear bootable flag */ + part_count = 0; + list_for_each(pos, &disk_partitions) { + curr = list_entry(pos, struct disk_part, list); + partitions[part_count] = curr->gpt_part_info; + partitions[part_count].bootable &= ~PART_BOOTABLE; + part_count++; + } + + name = strtok(part_list, ","); + while (name) { + bool found = false; + + for (int i = 0; i < part_count; i++) { + if (strcmp((char *)partitions[i].name, name) == 0) { + partitions[i].bootable |= PART_BOOTABLE; + found = true; + } + } + + if (!found) { + printf("Warning: No partition matching '%s' found\n", + name); + } + + name = strtok(NULL, ","); + } + + ret = gpt_restore(blk_dev_desc, disk_guid, partitions, part_count); + +out: + del_gpt_info(); + + if (partitions) + free(partitions); + + return ret; +} #endif /** @@ -1025,8 +1163,11 @@ static int do_gpt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) } else if (strcmp(argv[1], "read") == 0) { ret = do_get_gpt_info(blk_dev_desc, (argc == 5) ? argv[4] : NULL); } else if ((strcmp(argv[1], "swap") == 0) || - (strcmp(argv[1], "rename") == 0)) { + (strcmp(argv[1], "rename") == 0) || + (strcmp(argv[1], "transpose") == 0)) { ret = do_rename_gpt_parts(blk_dev_desc, argv[1], argv[4], argv[5]); + } else if ((strcmp(argv[1], "set-bootable") == 0)) { + ret = gpt_set_bootable(blk_dev_desc, argv[4]); #endif } else { return CMD_RET_USAGE; @@ -1057,7 +1198,8 @@ U_BOOT_CMD(gpt, CONFIG_SYS_MAXARGS, 1, do_gpt, " gpt setenv mmc 0 $name\n" " - setup environment variables for partition $name:\n" " gpt_partition_addr, gpt_partition_size,\n" - " gpt_partition_name, gpt_partition_entry\n" + " gpt_partition_name, gpt_partition_entry,\n" + " gpt_partition_bootable\n" " gpt enumerate mmc 0\n" " - store list of partitions to gpt_partition_list environment variable\n" " gpt guid <interface> <dev>\n" @@ -1075,10 +1217,16 @@ U_BOOT_CMD(gpt, CONFIG_SYS_MAXARGS, 1, do_gpt, " gpt swap <interface> <dev> <name1> <name2>\n" " - change all partitions named name1 to name2\n" " and vice-versa\n" + " gpt transpose <interface> <dev> <part1> <part2>\n" + " - Swap the order of the entries for part1 and part2 in the partition table\n" " gpt rename <interface> <dev> <part> <name>\n" " - rename the specified partition\n" + " gpt set-bootable <interface> <dev> <list>\n" + " - make partition names in list bootable\n" " Example usage:\n" " gpt swap mmc 0 foo bar\n" " gpt rename mmc 0 3 foo\n" + " gpt set-bootable mmc 0 boot_a,boot_b\n" + " gpt transpose mmc 0 1 2\n" #endif ); @@ -1939,16 +1939,6 @@ static struct cmd_tbl cmd_i2c_sub[] = { U_BOOT_CMD_MKENT(speed, 1, 1, do_i2c_bus_speed, "", ""), }; -static __maybe_unused void i2c_reloc(void) -{ - static int relocated; - - if (!relocated) { - fixup_cmdtable(cmd_i2c_sub, ARRAY_SIZE(cmd_i2c_sub)); - relocated = 1; - }; -} - /** * do_i2c() - Handle the "i2c" command-line command * @cmdtp: Command data struct pointer @@ -1963,10 +1953,6 @@ static int do_i2c(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { struct cmd_tbl *c; -#ifdef CONFIG_NEEDS_MANUAL_RELOC - i2c_reloc(); -#endif - if (argc < 2) return CMD_RET_USAGE; @@ -49,7 +49,7 @@ static struct mux_control *cmd_mux_find(char *const argv[]) chip = dev_get_uclass_priv(dev); if (!chip) - return ERR_PTR(ret); + return ERR_PTR(-EINVAL); if (id >= chip->controllers) return ERR_PTR(-EINVAL); diff --git a/cmd/nvedit.c b/cmd/nvedit.c index 9e4ee4b..eaa000b 100644 --- a/cmd/nvedit.c +++ b/cmd/nvedit.c @@ -36,6 +36,7 @@ #include <mapmem.h> #include <asm/global_data.h> #include <linux/bitops.h> +#include <linux/printk.h> #include <u-boot/crc.h> #include <linux/stddef.h> #include <asm/byteorder.h> @@ -407,11 +408,7 @@ static int print_active_callback(struct env_entry *entry) for (i = 0, clbkp = ll_entry_start(struct env_clbk_tbl, env_clbk); i < num_callbacks; i++, clbkp++) { -#if defined(CONFIG_NEEDS_MANUAL_RELOC) - if (entry->callback == clbkp->callback + gd->reloc_off) -#else if (entry->callback == clbkp->callback) -#endif break; } @@ -1222,13 +1219,6 @@ static struct cmd_tbl cmd_env_sub[] = { #endif }; -#if defined(CONFIG_NEEDS_MANUAL_RELOC) -void env_reloc(void) -{ - fixup_cmdtable(cmd_env_sub, ARRAY_SIZE(cmd_env_sub)); -} -#endif - static int do_env(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { struct cmd_tbl *cp; diff --git a/cmd/nvedit_efi.c b/cmd/nvedit_efi.c index 24944ab..7a30b5c 100644 --- a/cmd/nvedit_efi.c +++ b/cmd/nvedit_efi.c @@ -262,7 +262,7 @@ static int append_value(char **bufp, size_t *sizep, char *data) char *tmp_buf = NULL, *new_buf = NULL, *value; unsigned long len = 0; - if (!strncmp(data, "=0x", 2)) { /* hexadecimal number */ + if (!strncmp(data, "=0x", 3)) { /* hexadecimal number */ union { u8 u8; u16 u16; diff --git a/cmd/onenand.c b/cmd/onenand.c index d633f19..fad7815 100644 --- a/cmd/onenand.c +++ b/cmd/onenand.c @@ -12,6 +12,7 @@ #include <common.h> #include <command.h> #include <malloc.h> +#include <linux/printk.h> #include <linux/compat.h> #include <linux/mtd/mtd.h> @@ -560,12 +561,6 @@ static struct cmd_tbl cmd_onenand_sub[] = { U_BOOT_CMD_MKENT(markbad, CONFIG_SYS_MAXARGS, 0, do_onenand_markbad, "", ""), }; -#ifdef CONFIG_NEEDS_MANUAL_RELOC -void onenand_reloc(void) { - fixup_cmdtable(cmd_onenand_sub, ARRAY_SIZE(cmd_onenand_sub)); -} -#endif - static int do_onenand(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { @@ -299,24 +299,10 @@ static struct cmd_tbl cmd_pxe_sub[] = { U_BOOT_CMD_MKENT(boot, 3, 1, do_pxe_boot, "", "") }; -static void __maybe_unused pxe_reloc(void) -{ - static int relocated_pxe; - - if (!relocated_pxe) { - fixup_cmdtable(cmd_pxe_sub, ARRAY_SIZE(cmd_pxe_sub)); - relocated_pxe = 1; - } -} - static int do_pxe(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { struct cmd_tbl *cp; -#if defined(CONFIG_NEEDS_MANUAL_RELOC) - pxe_reloc(); -#endif - if (argc < 2) return CMD_RET_USAGE; @@ -333,8 +319,7 @@ static int do_pxe(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) } U_BOOT_CMD(pxe, 4, 1, do_pxe, - "commands to get and boot from pxe files\n" - "To use IPv6 add -ipv6 parameter", + "get and boot from pxe files", "get [" USE_IP6_CMD_PARAM "] - try to retrieve a pxe file using tftp\n" "pxe boot [pxefile_addr_r] [-ipv6] - boot from the pxe file at pxefile_addr_r\n" ); diff --git a/cmd/regulator.c b/cmd/regulator.c index 8988c90..635a9ad 100644 --- a/cmd/regulator.c +++ b/cmd/regulator.c @@ -8,6 +8,7 @@ #include <errno.h> #include <dm.h> #include <dm/uclass-internal.h> +#include <linux/printk.h> #include <power/regulator.h> #define LIMIT_DEVNAME 20 diff --git a/cmd/rockusb.c b/cmd/rockusb.c index f181ec6..0708856 100644 --- a/cmd/rockusb.c +++ b/cmd/rockusb.c @@ -15,6 +15,7 @@ static int do_rockusb(struct cmd_tbl *cmdtp, int flag, int argc, { int controller_index, dev_index; char *usb_controller; + struct udevice *udc; char *devtype; char *devnum; int ret; @@ -34,7 +35,7 @@ static int do_rockusb(struct cmd_tbl *cmdtp, int flag, int argc, dev_index = simple_strtoul(devnum, NULL, 0); rockusb_dev_init(devtype, dev_index); - ret = usb_gadget_initialize(controller_index); + ret = udc_device_get_by_index(controller_index, &udc); if (ret) { printf("USB init failed: %d\n", ret); return CMD_RET_FAILURE; @@ -56,14 +57,14 @@ static int do_rockusb(struct cmd_tbl *cmdtp, int flag, int argc, break; if (ctrlc()) break; - usb_gadget_handle_interrupts(controller_index); + dm_usb_gadget_handle_interrupts(udc); } ret = CMD_RET_SUCCESS; exit: g_dnl_unregister(); g_dnl_clear_detach(); - usb_gadget_release(controller_index); + udc_device_put(udc); return ret; } diff --git a/cmd/setexpr.c b/cmd/setexpr.c index 4d671e7..233471f 100644 --- a/cmd/setexpr.c +++ b/cmd/setexpr.c @@ -215,7 +215,7 @@ int setexpr_regex_sub(char *data, uint data_size, char *nbuf, uint nbuf_size, if (res == 0) { if (loop == 0) { - printf("%s: No match\n", data); + debug("%s: No match\n", data); return 1; } else { break; @@ -359,7 +359,7 @@ static int regex_sub_var(const char *name, const char *r, const char *s, if (ret) return 1; - printf("%s=%s\n", name, data); + debug("%s=%s\n", name, data); return env_set(name, data); } @@ -366,7 +366,7 @@ static int do_spi_flash_erase(int argc, char *const argv[]) } if (flash->flash_is_unlocked && - !flash->flash_is_unlocked(flash, offset, len)) { + !flash->flash_is_unlocked(flash, offset, size)) { printf("ERROR: flash area is locked\n"); return CMD_RET_FAILURE; } diff --git a/cmd/thordown.c b/cmd/thordown.c index 838764c..48e22b3 100644 --- a/cmd/thordown.c +++ b/cmd/thordown.c @@ -12,26 +12,29 @@ #include <dfu.h> #include <g_dnl.h> #include <usb.h> +#include <linux/printk.h> int do_thor_down(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { + char *interface, *devstring; + int controller_index; + struct udevice *udc; + int ret; + if (argc < 4) return CMD_RET_USAGE; - char *usb_controller = argv[1]; - char *interface = argv[2]; - char *devstring = argv[3]; - - int ret; - puts("TIZEN \"THOR\" Downloader\n"); + interface = argv[2]; + devstring = argv[3]; + ret = dfu_init_env_entities(interface, devstring); if (ret) goto done; - int controller_index = simple_strtoul(usb_controller, NULL, 0); - ret = usb_gadget_initialize(controller_index); + controller_index = simple_strtoul(argv[1], NULL, 0); + ret = udc_device_get_by_index(controller_index, &udc); if (ret) { pr_err("USB init failed: %d\n", ret); ret = CMD_RET_FAILURE; @@ -45,7 +48,7 @@ int do_thor_down(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) goto exit; } - ret = thor_init(); + ret = thor_init(udc); if (ret) { pr_err("THOR DOWNLOAD failed: %d\n", ret); ret = CMD_RET_FAILURE; @@ -53,7 +56,7 @@ int do_thor_down(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) } do { - ret = thor_handle(); + ret = thor_handle(udc); if (ret == THOR_DFU_REINIT_NEEDED) { dfu_free_entities(); ret = dfu_init_env_entities(interface, devstring); @@ -66,7 +69,7 @@ int do_thor_down(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) } while (ret == 0); exit: g_dnl_unregister(); - usb_gadget_release(controller_index); + udc_device_put(udc); done: dfu_free_entities(); diff --git a/cmd/tpm_test.c b/cmd/tpm_test.c index c4ed8e5..c7fa6e7 100644 --- a/cmd/tpm_test.c +++ b/cmd/tpm_test.c @@ -8,6 +8,7 @@ #include <cpu_func.h> #include <log.h> #include <tpm-v1.h> +#include <linux/printk.h> #include "tpm-user-utils.h" #include <tpm_api.h> @@ -294,8 +295,8 @@ static int test_readonly(struct udevice *dev) */ index_0 += 1; if (tpm_nv_write_value(dev, INDEX0, (uint8_t *)&index_0, - sizeof(index_0) != - TPM_SUCCESS)) { + sizeof(index_0)) != + TPM_SUCCESS) { pr_err("\tcould not write index 0\n"); } tpm_nv_write_value_lock(dev, INDEX0); diff --git a/cmd/usb_gadget_sdp.c b/cmd/usb_gadget_sdp.c index 1af82e1..cbdda73 100644 --- a/cmd/usb_gadget_sdp.c +++ b/cmd/usb_gadget_sdp.c @@ -11,17 +11,21 @@ #include <g_dnl.h> #include <sdp.h> #include <usb.h> +#include <linux/printk.h> static int do_sdp(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { + int controller_index; + struct udevice *udc; int ret; if (argc < 2) return CMD_RET_USAGE; - char *usb_controller = argv[1]; - int controller_index = simple_strtoul(usb_controller, NULL, 0); - usb_gadget_initialize(controller_index); + controller_index = simple_strtoul(argv[1], NULL, 0); + ret = udc_device_get_by_index(controller_index, &udc); + if (ret) + return ret; g_dnl_clear_detach(); ret = g_dnl_register("usb_dnl_sdp"); @@ -30,20 +34,20 @@ static int do_sdp(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) goto exit_register; } - ret = sdp_init(controller_index); + ret = sdp_init(udc); if (ret) { pr_err("SDP init failed: %d\n", ret); goto exit; } /* This command typically does not return but jumps to an image */ - sdp_handle(controller_index); + sdp_handle(udc); pr_err("SDP ended\n"); exit: g_dnl_unregister(); exit_register: - usb_gadget_release(controller_index); + udc_device_put(udc); return CMD_RET_FAILURE; } diff --git a/cmd/usb_mass_storage.c b/cmd/usb_mass_storage.c index c3cc197..a8ddeb4 100644 --- a/cmd/usb_mass_storage.c +++ b/cmd/usb_mass_storage.c @@ -18,6 +18,7 @@ #include <usb_mass_storage.h> #include <watchdog.h> #include <linux/delay.h> +#include <linux/printk.h> static int ums_read_sector(struct ums *ums_dev, ulong start, lbaint_t blkcnt, void *buf) @@ -143,6 +144,7 @@ static int do_usb_mass_storage(struct cmd_tbl *cmdtp, int flag, const char *devtype; const char *devnum; unsigned int controller_index; + struct udevice *udc; int rc; int cable_ready_timeout __maybe_unused; @@ -164,13 +166,14 @@ static int do_usb_mass_storage(struct cmd_tbl *cmdtp, int flag, controller_index = (unsigned int)(simple_strtoul( usb_controller, NULL, 0)); - if (usb_gadget_initialize(controller_index)) { + rc = udc_device_get_by_index(controller_index, &udc); + if (rc) { pr_err("Couldn't init USB controller.\n"); rc = CMD_RET_FAILURE; goto cleanup_ums_init; } - rc = fsg_init(ums, ums_count, controller_index); + rc = fsg_init(ums, ums_count, udc); if (rc) { pr_err("fsg_init failed\n"); rc = CMD_RET_FAILURE; @@ -215,7 +218,7 @@ static int do_usb_mass_storage(struct cmd_tbl *cmdtp, int flag, } while (1) { - usb_gadget_handle_interrupts(controller_index); + dm_usb_gadget_handle_interrupts(udc); rc = fsg_main_thread(NULL); if (rc) { @@ -247,7 +250,7 @@ static int do_usb_mass_storage(struct cmd_tbl *cmdtp, int flag, cleanup_register: g_dnl_unregister(); cleanup_board: - usb_gadget_release(controller_index); + udc_device_put(udc); cleanup_ums_init: ums_fini(); diff --git a/common/Kconfig b/common/Kconfig index cdb77a6..21eaa5e 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -720,6 +720,7 @@ config SYS_FSL_CLK config LAST_STAGE_INIT bool "Call board-specific as last setup step" + select EVENT help Some boards need to perform initialisation immediately before control is passed to the command-line interpreter (e.g. for initializations @@ -1031,7 +1032,7 @@ config BLOBLIST_SIZE config BLOBLIST_SIZE_RELOC hex "Size of bloblist after relocation" default BLOBLIST_SIZE if BLOBLIST_FIXED || BLOBLIST_ALLOC - default 0 if BLOBLIST_PASSAGE + default 0x0 if BLOBLIST_PASSAGE help Sets the size of the bloblist in bytes after relocation. Since U-Boot has a lot more memory available then, it is possible to use a larger @@ -1156,25 +1157,5 @@ config VPL_IMAGE_SIGN_INFO endif -config FDT_SIMPLEFB - bool "FDT tools for simplefb support" - depends on OF_LIBFDT - help - Enable the fdt tools to manage the simple fb nodes in device tree. - These functions can be used by board to indicate to the OS - the presence of the simple frame buffer with associated reserved - memory - config IO_TRACE bool - -config BMP - bool "Enable bmp image display" - help - Enable bmp functions to display bmp image and get bmp info. - -config SPL_BMP - bool "Enable bmp image display at SPL" - depends on SPL_VIDEO - help - Enable bmp functions to display bmp image and get bmp info at SPL. diff --git a/common/Makefile b/common/Makefile index f5c3d90..5c16172 100644 --- a/common/Makefile +++ b/common/Makefile @@ -17,8 +17,6 @@ obj-y += board_r.o obj-$(CONFIG_DISPLAY_BOARDINFO) += board_info.o obj-$(CONFIG_DISPLAY_BOARDINFO_LATE) += board_info.o -obj-$(CONFIG_FDT_SIMPLEFB) += fdt_simplefb.o -obj-$(CONFIG_$(SPL_TPL_)OF_LIBFDT) += fdt_support.o obj-$(CONFIG_MII) += miiphyutil.o obj-$(CONFIG_CMD_MII) += miiphyutil.o obj-$(CONFIG_PHYLIB) += miiphyutil.o @@ -45,14 +43,12 @@ endif # !CONFIG_SPL_BUILD obj-$(CONFIG_$(SPL_TPL_)BOOTSTAGE) += bootstage.o obj-$(CONFIG_$(SPL_TPL_)BLOBLIST) += bloblist.o -obj-$(CONFIG_$(SPL_)BMP) += bmp.o ifdef CONFIG_SPL_BUILD ifdef CONFIG_SPL_DFU obj-$(CONFIG_DFU_OVER_USB) += dfu.o endif obj-$(CONFIG_SPL_NET) += miiphyutil.o -obj-$(CONFIG_$(SPL_TPL_)OF_LIBFDT) += fdt_support.o obj-$(CONFIG_SPL_USB_HOST) += usb.o usb_hub.o obj-$(CONFIG_SPL_USB_STORAGE) += usb_storage.o diff --git a/common/board_f.c b/common/board_f.c index e9f4edb..aef395b 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -124,8 +124,8 @@ static int display_text_info(void) #if !defined(CONFIG_SANDBOX) && !defined(CONFIG_EFI_APP) ulong bss_start, bss_end, text_base; - bss_start = (ulong)&__bss_start; - bss_end = (ulong)&__bss_end; + bss_start = (ulong)__bss_start; + bss_end = (ulong)__bss_end; #ifdef CONFIG_TEXT_BASE text_base = CONFIG_TEXT_BASE; @@ -148,11 +148,12 @@ static int print_resetinfo(void) bool status_printed = false; int ret; - /* Not all boards have sysreset drivers available during early + /* + * Not all boards have sysreset drivers available during early * boot, so don't fail if one can't be found. */ for (ret = uclass_first_device_check(UCLASS_SYSRESET, &dev); dev; - ret = uclass_next_device_check(&dev)) { + ret = uclass_next_device_check(&dev)) { if (ret) { debug("%s: %s sysreset device (error: %d)\n", __func__, dev->name, ret); @@ -279,31 +280,24 @@ static int init_func_i2c(void) } #endif -#if defined(CONFIG_VID) -__weak int init_func_vid(void) -{ - return 0; -} -#endif - static int setup_mon_len(void) { #if defined(__ARM__) || defined(__MICROBLAZE__) - gd->mon_len = (ulong)&__bss_end - (ulong)_start; + gd->mon_len = (ulong)__bss_end - (ulong)_start; #elif defined(CONFIG_SANDBOX) && !defined(__riscv) - gd->mon_len = (ulong)&_end - (ulong)_init; + gd->mon_len = (ulong)_end - (ulong)_init; #elif defined(CONFIG_SANDBOX) /* gcc does not provide _init in crti.o on RISC-V */ gd->mon_len = 0; #elif defined(CONFIG_EFI_APP) - gd->mon_len = (ulong)&_end - (ulong)_init; + gd->mon_len = (ulong)_end - (ulong)_init; #elif defined(CONFIG_NIOS2) || defined(CONFIG_XTENSA) gd->mon_len = CONFIG_SYS_MONITOR_LEN; #elif defined(CONFIG_SH) || defined(CONFIG_RISCV) - gd->mon_len = (ulong)(&__bss_end) - (ulong)(&_start); + gd->mon_len = (ulong)(__bss_end) - (ulong)(_start); #elif defined(CONFIG_SYS_MONITOR_BASE) - /* TODO: use (ulong)&__bss_end - (ulong)&__text_start; ? */ - gd->mon_len = (ulong)&__bss_end - CONFIG_SYS_MONITOR_BASE; + /* TODO: use (ulong)__bss_end - (ulong)__text_start; ? */ + gd->mon_len = (ulong)__bss_end - CONFIG_SYS_MONITOR_BASE; #endif return 0; } @@ -835,11 +829,6 @@ __weak int clear_bss(void) return 0; } -static int misc_init_f(void) -{ - return event_notify_null(EVT_MISC_INIT_F); -} - static const init_fnc_t init_sequence_f[] = { setup_mon_len, #ifdef CONFIG_OF_CONTROL @@ -859,9 +848,7 @@ static const init_fnc_t init_sequence_f[] = { #if defined(CONFIG_CONSOLE_RECORD_INIT_F) console_record_init, #endif -#if defined(CONFIG_HAVE_FSP) - arch_fsp_init, -#endif + INITCALL_EVENT(EVT_FSP_INIT_F), arch_cpu_init, /* basic arch cpu dependent setup */ mach_cpu_init, /* SoC/machine dependent CPU setup */ initf_dm, @@ -898,14 +885,11 @@ static const init_fnc_t init_sequence_f[] = { show_board_info, #endif INIT_FUNC_WATCHDOG_INIT - misc_init_f, + INITCALL_EVENT(EVT_MISC_INIT_F), INIT_FUNC_WATCHDOG_RESET #if CONFIG_IS_ENABLED(SYS_I2C_LEGACY) init_func_i2c, #endif -#if defined(CONFIG_VID) && !defined(CONFIG_SPL) - init_func_vid, -#endif announce_dram_init, dram_init, /* configure available RAM banks */ #ifdef CONFIG_POST diff --git a/common/board_r.c b/common/board_r.c index 4aaa894..e309633 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -126,9 +126,9 @@ static int initr_reloc_global_data(void) #ifdef __ARM__ monitor_flash_len = _end - __image_copy_start; #elif defined(CONFIG_RISCV) - monitor_flash_len = (ulong)&_end - (ulong)&_start; + monitor_flash_len = (ulong)_end - (ulong)_start; #elif !defined(CONFIG_SANDBOX) && !defined(CONFIG_NIOS2) - monitor_flash_len = (ulong)&__init_end - gd->relocaddr; + monitor_flash_len = (ulong)__init_end - gd->relocaddr; #endif #if defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx) /* @@ -151,13 +151,6 @@ static int initr_reloc_global_data(void) */ gd->env_addr += gd->reloc_off; #endif - /* - * The fdt_blob needs to be moved to new relocation address - * incase of FDT blob is embedded with in image - */ - if (IS_ENABLED(CONFIG_OF_EMBED) && IS_ENABLED(CONFIG_NEEDS_MANUAL_RELOC)) - gd->fdt_blob += gd->reloc_off; - #ifdef CONFIG_EFI_LOADER /* * On the ARM architecture gd is mapped to a fixed register (r9 or x18). @@ -295,15 +288,6 @@ static int initr_announce(void) return 0; } -#ifdef CONFIG_NEEDS_MANUAL_RELOC -static int initr_manual_reloc_cmdtable(void) -{ - fixup_cmdtable(ll_entry_start(struct cmd_tbl, cmd), - ll_entry_count(struct cmd_tbl, cmd)); - return 0; -} -#endif - static int initr_binman(void) { int ret; @@ -583,7 +567,10 @@ static int run_main_loop(void) } /* - * We hope to remove most of the driver-related init and do it if/when + * Over time we hope to remove these functions with code fragments and + * stub functions, and instead call the relevant function directly. + * + * We also hope to remove most of the driver-related init and do it if/when * the driver is later used. * * TODO: perhaps reset the watchdog in the initcall function after each call? @@ -603,9 +590,6 @@ static init_fnc_t init_sequence_r[] = { */ #endif initr_reloc_global_data, -#if IS_ENABLED(CONFIG_NEEDS_MANUAL_RELOC) && CONFIG_IS_ENABLED(EVENT) - event_manual_reloc, -#endif #if defined(CONFIG_SYS_INIT_RAM_LOCK) && defined(CONFIG_E500) initr_unlock_ram_in_cache, #endif @@ -654,12 +638,6 @@ static init_fnc_t init_sequence_r[] = { initr_watchdog, #endif INIT_FUNC_WATCHDOG_RESET -#if defined(CONFIG_NEEDS_MANUAL_RELOC) && defined(CONFIG_BLOCK_CACHE) - blkcache_init, -#endif -#ifdef CONFIG_NEEDS_MANUAL_RELOC - initr_manual_reloc_cmdtable, -#endif arch_initr_trap, #if defined(CONFIG_BOARD_EARLY_INIT_R) board_early_init_r, @@ -770,15 +748,8 @@ static init_fnc_t init_sequence_r[] = { #ifdef CONFIG_POST initr_post, #endif -#ifdef CONFIG_LAST_STAGE_INIT INIT_FUNC_WATCHDOG_RESET - /* - * Some parts can be only initialized if all others (like - * Interrupts) are up and running (i.e. the PC-style ISA - * keyboard). - */ - last_stage_init, -#endif + INITCALL_EVENT(EVT_LAST_STAGE_INIT), #if defined(CFG_PRAM) initr_mem, #endif @@ -810,11 +781,6 @@ void board_init_r(gd_t *new_gd, ulong dest_addr) #endif gd->flags &= ~GD_FLG_LOG_READY; - if (IS_ENABLED(CONFIG_NEEDS_MANUAL_RELOC)) { - for (int i = 0; i < ARRAY_SIZE(init_sequence_r); i++) - MANUAL_RELOC(init_sequence_r[i]); - } - if (initcall_run_list(init_sequence_r)) hang(); diff --git a/common/bouncebuf.c b/common/bouncebuf.c index 93a3566..934b83f 100644 --- a/common/bouncebuf.c +++ b/common/bouncebuf.c @@ -79,7 +79,7 @@ int bounce_buffer_stop(struct bounce_buffer *state) { if (state->flags & GEN_BB_WRITE) { /* Invalidate cache so that CPU can see any newly DMA'd data */ - dma_unmap_single((dma_addr_t)state->bounce_buffer, + dma_unmap_single((dma_addr_t)(uintptr_t)state->bounce_buffer, state->len_aligned, DMA_BIDIRECTIONAL); } diff --git a/common/cli_hush.c b/common/cli_hush.c index cee8724..9cda97f 100644 --- a/common/cli_hush.c +++ b/common/cli_hush.c @@ -3305,19 +3305,6 @@ int parse_file_outer(void) } #ifdef __U_BOOT__ -#ifdef CONFIG_NEEDS_MANUAL_RELOC -static void u_boot_hush_reloc(void) -{ - unsigned long addr; - struct reserved_combo *r; - - for (r=reserved_list; r<reserved_list+NRES; r++) { - addr = (ulong) (r->literal) + gd->reloc_off; - r->literal = (char *)addr; - } -} -#endif - int u_boot_hush_start(void) { if (top_vars == NULL) { @@ -3327,9 +3314,6 @@ int u_boot_hush_start(void) top_vars->next = NULL; top_vars->flg_export = 0; top_vars->flg_read_only = 1; -#ifdef CONFIG_NEEDS_MANUAL_RELOC - u_boot_hush_reloc(); -#endif } return 0; } diff --git a/common/dfu.c b/common/dfu.c index 9619088..0d154e8 100644 --- a/common/dfu.c +++ b/common/dfu.c @@ -19,22 +19,25 @@ #include <g_dnl.h> #include <usb.h> #include <net.h> +#include <linux/printk.h> int run_usb_dnl_gadget(int usbctrl_index, char *usb_dnl_gadget) { bool dfu_reset = false; + struct udevice *udc; int ret, i = 0; - ret = usb_gadget_initialize(usbctrl_index); + ret = udc_device_get_by_index(usbctrl_index, &udc); if (ret) { - pr_err("usb_gadget_initialize failed\n"); + pr_err("udc_device_get_by_index failed\n"); return CMD_RET_FAILURE; } g_dnl_clear_detach(); ret = g_dnl_register(usb_dnl_gadget); if (ret) { pr_err("g_dnl_register failed"); - return CMD_RET_FAILURE; + ret = CMD_RET_FAILURE; + goto err_detach; } #ifdef CONFIG_DFU_TIMEOUT @@ -54,7 +57,7 @@ int run_usb_dnl_gadget(int usbctrl_index, char *usb_dnl_gadget) } /* - * This extra number of usb_gadget_handle_interrupts() + * This extra number of dm_usb_gadget_handle_interrupts() * calls is necessary to assure correct transmission * completion with dfu-util */ @@ -67,7 +70,7 @@ int run_usb_dnl_gadget(int usbctrl_index, char *usb_dnl_gadget) if (dfu_get_defer_flush()) { /* - * Call to usb_gadget_handle_interrupts() is necessary + * Call to dm_usb_gadget_handle_interrupts() is necessary * to act on ZLP OUT transaction from HOST PC after * transmitting the whole file. * @@ -76,7 +79,7 @@ int run_usb_dnl_gadget(int usbctrl_index, char *usb_dnl_gadget) * 5 seconds). In such situation the dfu-util program * exits with error message. */ - usb_gadget_handle_interrupts(usbctrl_index); + dm_usb_gadget_handle_interrupts(udc); ret = dfu_flush(dfu_get_defer_flush(), NULL, 0, 0); dfu_set_defer_flush(NULL); if (ret) { @@ -102,11 +105,12 @@ int run_usb_dnl_gadget(int usbctrl_index, char *usb_dnl_gadget) goto exit; schedule(); - usb_gadget_handle_interrupts(usbctrl_index); + dm_usb_gadget_handle_interrupts(udc); } exit: g_dnl_unregister(); - usb_gadget_release(usbctrl_index); +err_detach: + udc_device_put(udc); if (dfu_reset) do_reset(NULL, 0, 0, NULL); diff --git a/common/dlmalloc.c b/common/dlmalloc.c index dcecdb8..aa933bd 100644 --- a/common/dlmalloc.c +++ b/common/dlmalloc.c @@ -575,19 +575,6 @@ static mbinptr av_[NAV * 2 + 2] = { IAV(120), IAV(121), IAV(122), IAV(123), IAV(124), IAV(125), IAV(126), IAV(127) }; -#ifdef CONFIG_NEEDS_MANUAL_RELOC -static void malloc_bin_reloc(void) -{ - mbinptr *p = &av_[2]; - size_t i; - - for (i = 2; i < ARRAY_SIZE(av_); ++i, ++p) - *p = (mbinptr)((ulong)*p + gd->reloc_off); -} -#else -static inline void malloc_bin_reloc(void) {} -#endif - #ifdef CONFIG_SYS_MALLOC_DEFAULT_TO_INIT static void malloc_init(void); #endif @@ -634,7 +621,6 @@ void mem_malloc_init(ulong start, ulong size) #if CONFIG_IS_ENABLED(SYS_MALLOC_CLEAR_ON_INIT) memset((void *)mem_malloc_start, 0x0, size); #endif - malloc_bin_reloc(); } /* field-extraction macros */ diff --git a/common/event.c b/common/event.c index 6653300..3080d9e 100644 --- a/common/event.c +++ b/common/event.c @@ -36,6 +36,8 @@ const char *const type_name[] = { /* init hooks */ "misc_init_f", + "fsp_init_r", + "last_stage_init", /* Fpga load hook */ "fpga_load", @@ -50,7 +52,7 @@ const char *const type_name[] = { _Static_assert(ARRAY_SIZE(type_name) == EVT_COUNT, "event type_name size"); #endif -static const char *event_type_name(enum event_t type) +const char *event_type_name(enum event_t type) { #if CONFIG_IS_ENABLED(EVENT_DEBUG) return type_name[type]; @@ -72,7 +74,14 @@ static int notify_static(struct event *ev) log_debug("Sending event %x/%s to spy '%s'\n", ev->type, event_type_name(ev->type), event_spy_id(spy)); - ret = spy->func(NULL, ev); + if (spy->flags & EVSPYF_SIMPLE) { + const struct evspy_info_simple *simple; + + simple = (struct evspy_info_simple *)spy; + ret = simple->func(); + } else { + ret = spy->func(NULL, ev); + } /* * TODO: Handle various return codes to @@ -159,20 +168,6 @@ void event_show_spy_list(void) } } -#if IS_ENABLED(CONFIG_NEEDS_MANUAL_RELOC) -int event_manual_reloc(void) -{ - struct evspy_info *spy, *end; - - spy = ll_entry_start(struct evspy_info, evspy_info); - end = ll_entry_end(struct evspy_info, evspy_info); - for (; spy < end; spy++) - MANUAL_RELOC(spy->func); - - return 0; -} -#endif - #if CONFIG_IS_ENABLED(EVENT_DYNAMIC) static void spy_free(struct event_spy *spy) { diff --git a/common/hash.c b/common/hash.c index cbffdfd..e837c56 100644 --- a/common/hash.c +++ b/common/hash.c @@ -21,7 +21,6 @@ #include <asm/global_data.h> #include <asm/io.h> #include <linux/errno.h> -#include <u-boot/crc.h> #else #include "mkimage.h" #include <linux/compiler_attributes.h> @@ -37,12 +36,6 @@ #include <u-boot/sha512.h> #include <u-boot/md5.h> -#if !defined(USE_HOSTCC) && defined(CONFIG_NEEDS_MANUAL_RELOC) -DECLARE_GLOBAL_DATA_PTR; -#endif - -static void reloc_update(void); - static int __maybe_unused hash_init_sha1(struct hash_algo *algo, void **ctxp) { sha1_context *ctx = malloc(sizeof(sha1_context)); @@ -334,31 +327,10 @@ static struct hash_algo hash_algo[] = { #define multi_hash() 0 #endif -static void reloc_update(void) -{ -#if !defined(USE_HOSTCC) && defined(CONFIG_NEEDS_MANUAL_RELOC) - int i; - static bool done; - - if (!done) { - done = true; - for (i = 0; i < ARRAY_SIZE(hash_algo); i++) { - hash_algo[i].name += gd->reloc_off; - hash_algo[i].hash_func_ws += gd->reloc_off; - hash_algo[i].hash_init += gd->reloc_off; - hash_algo[i].hash_update += gd->reloc_off; - hash_algo[i].hash_finish += gd->reloc_off; - } - } -#endif -} - int hash_lookup_algo(const char *algo_name, struct hash_algo **algop) { int i; - reloc_update(); - for (i = 0; i < ARRAY_SIZE(hash_algo); i++) { if (!strcmp(algo_name, hash_algo[i].name)) { *algop = &hash_algo[i]; @@ -375,8 +347,6 @@ int hash_progressive_lookup_algo(const char *algo_name, { int i; - reloc_update(); - for (i = 0; i < ARRAY_SIZE(hash_algo); i++) { if (!strcmp(algo_name, hash_algo[i].name)) { if (hash_algo[i].hash_init) { diff --git a/common/spl/Kconfig b/common/spl/Kconfig index c5dd476..1c2fe78 100644 --- a/common/spl/Kconfig +++ b/common/spl/Kconfig @@ -67,7 +67,7 @@ config SPL_SIZE_LIMIT_SUBTRACT_MALLOC config SPL_SIZE_LIMIT_PROVIDE_STACK hex "SPL image size check: provide stack space before relocation" depends on SPL_SIZE_LIMIT > 0 - default 0 + default 0x0 help If set, this size is reserved in SPL_SIZE_LIMIT check to ensure such an image does not overflow SRAM if SPL_SIZE_LIMIT describes the size diff --git a/common/spl/Kconfig.tpl b/common/spl/Kconfig.tpl index 3d6cf1e..cc71578 100644 --- a/common/spl/Kconfig.tpl +++ b/common/spl/Kconfig.tpl @@ -126,7 +126,7 @@ config TPL_POWER config TPL_TEXT_BASE hex "Base address for the .text section of the TPL stage" - default 0 + default 0x0 help The base address for the .text section of the TPL stage. diff --git a/common/spl/spl.c b/common/spl/spl.c index 0062f3f..cd294e8 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -45,10 +45,6 @@ DECLARE_GLOBAL_DATA_PTR; DECLARE_BINMAN_MAGIC_SYM; -#ifndef CFG_SYS_UBOOT_START -#define CFG_SYS_UBOOT_START CONFIG_TEXT_BASE -#endif - u32 *boot_params_ptr = NULL; #if CONFIG_IS_ENABLED(BINMAN_UBOOT_SYMBOLS) @@ -252,7 +248,7 @@ void spl_set_header_raw_uboot(struct spl_image_info *spl_image) spl_image->entry_point = u_boot_pos; spl_image->load_addr = u_boot_pos; } else { - spl_image->entry_point = CFG_SYS_UBOOT_START; + spl_image->entry_point = CONFIG_SYS_UBOOT_START; spl_image->load_addr = CONFIG_TEXT_BASE; } spl_image->os = IH_OS_U_BOOT; @@ -800,7 +796,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2) IS_ENABLED(CONFIG_SPL_ATF)) dram_init_banksize(); - if (CONFIG_IS_ENABLED(PCI)) { + if (CONFIG_IS_ENABLED(PCI) && !(gd->flags & GD_FLG_DM_DEAD)) { ret = pci_init(); if (ret) puts(SPL_TPL_PROMPT "Cannot initialize PCI\n"); diff --git a/common/spl/spl_dfu.c b/common/spl/spl_dfu.c index 5728d43..8a779da 100644 --- a/common/spl/spl_dfu.c +++ b/common/spl/spl_dfu.c @@ -15,6 +15,7 @@ #include <g_dnl.h> #include <usb.h> #include <dfu.h> +#include <linux/printk.h> static int run_dfu(int usb_index, char *interface, char *devstring) { diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c index 730639f..b1668c0 100644 --- a/common/spl/spl_fit.c +++ b/common/spl/spl_fit.c @@ -17,6 +17,7 @@ #include <asm/cache.h> #include <asm/global_data.h> #include <linux/libfdt.h> +#include <linux/printk.h> DECLARE_GLOBAL_DATA_PTR; @@ -816,7 +817,7 @@ int spl_load_simple_fit(struct spl_image_info *spl_image, } /* - * If a platform does not provide CFG_SYS_UBOOT_START, U-Boot's + * If a platform does not provide CONFIG_SYS_UBOOT_START, U-Boot's * Makefile will set it to 0 and it will end up as the entry point * here. What it actually means is: use the load address. */ diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c index a665091..20f687e 100644 --- a/common/spl/spl_mmc.c +++ b/common/spl/spl_mmc.c @@ -229,7 +229,7 @@ static int mmc_load_image_raw_os(struct spl_image_info *spl_image, { int ret; -#if CONFIG_VAL(SYS_MMCSD_RAW_MODE_ARGS_SECTOR) +#if defined(CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR) unsigned long count; count = blk_dread(mmc_get_blk_desc(mmc), diff --git a/common/spl/spl_opensbi.c b/common/spl/spl_opensbi.c index e2aaa46..0df6116 100644 --- a/common/spl/spl_opensbi.c +++ b/common/spl/spl_opensbi.c @@ -15,6 +15,7 @@ #include <asm/smp.h> #include <opensbi.h> #include <linux/libfdt.h> +#include <linux/printk.h> DECLARE_GLOBAL_DATA_PTR; diff --git a/common/spl/spl_ram.c b/common/spl/spl_ram.c index 93cf420..4158ed1 100644 --- a/common/spl/spl_ram.c +++ b/common/spl/spl_ram.c @@ -20,12 +20,16 @@ static ulong spl_ram_load_read(struct spl_load_info *load, ulong sector, ulong count, void *buf) { - ulong addr; + ulong addr = 0; debug("%s: sector %lx, count %lx, buf %lx\n", __func__, sector, count, (ulong)buf); - addr = (ulong)CONFIG_SPL_LOAD_FIT_ADDRESS + sector; + if (IS_ENABLED(CONFIG_SPL_LOAD_FIT)) { + addr = IF_ENABLED_INT(CONFIG_SPL_LOAD_FIT, + CONFIG_SPL_LOAD_FIT_ADDRESS); + } + addr += sector; if (CONFIG_IS_ENABLED(IMAGE_PRE_LOAD)) addr += image_load_offset; @@ -38,20 +42,23 @@ static int spl_ram_load_image(struct spl_image_info *spl_image, struct spl_boot_device *bootdev) { struct legacy_img_hdr *header; + ulong addr = 0; int ret; - header = (struct legacy_img_hdr *)CONFIG_SPL_LOAD_FIT_ADDRESS; + if (IS_ENABLED(CONFIG_SPL_LOAD_FIT)) { + addr = IF_ENABLED_INT(CONFIG_SPL_LOAD_FIT, + CONFIG_SPL_LOAD_FIT_ADDRESS); + } if (CONFIG_IS_ENABLED(IMAGE_PRE_LOAD)) { - unsigned long addr = (unsigned long)header; ret = image_pre_load(addr); if (ret) return ret; addr += image_load_offset; - header = (struct legacy_img_hdr *)addr; } + header = map_sysmem(addr, 0); #if CONFIG_IS_ENABLED(DFU) if (bootdev->boot_device == BOOT_DEVICE_DFU) @@ -84,7 +91,7 @@ static int spl_ram_load_image(struct spl_image_info *spl_image, u_boot_pos = (ulong)spl_get_load_buffer(-sizeof(*header), sizeof(*header)); } - header = (struct legacy_img_hdr *)map_sysmem(u_boot_pos, 0); + header = map_sysmem(u_boot_pos, 0); ret = spl_parse_image_header(spl_image, bootdev, header); } diff --git a/common/spl/spl_sdp.c b/common/spl/spl_sdp.c index cc4fb4f..9143c27 100644 --- a/common/spl/spl_sdp.c +++ b/common/spl/spl_sdp.c @@ -10,14 +10,18 @@ #include <usb.h> #include <g_dnl.h> #include <sdp.h> +#include <linux/printk.h> static int spl_sdp_load_image(struct spl_image_info *spl_image, struct spl_boot_device *bootdev) { - int ret; const int controller_index = CONFIG_SPL_SDP_USB_DEV; + struct udevice *udc; + int ret; - usb_gadget_initialize(controller_index); + ret = udc_device_get_by_index(controller_index, &udc); + if (ret) + return ret; board_usb_init(controller_index, USB_INIT_DEVICE); @@ -25,13 +29,13 @@ static int spl_sdp_load_image(struct spl_image_info *spl_image, ret = g_dnl_register("usb_dnl_sdp"); if (ret) { pr_err("SDP dnl register failed: %d\n", ret); - return ret; + goto err_detach; } - ret = sdp_init(controller_index); + ret = sdp_init(udc); if (ret) { pr_err("SDP init failed: %d\n", ret); - return -ENODEV; + goto err_unregister; } /* @@ -39,10 +43,13 @@ static int spl_sdp_load_image(struct spl_image_info *spl_image, * or it loads a FIT image and returns it to be handled by the SPL * code. */ - ret = spl_sdp_handle(controller_index, spl_image, bootdev); + ret = spl_sdp_handle(udc, spl_image, bootdev); debug("SDP ended\n"); - usb_gadget_release(controller_index); +err_unregister: + g_dnl_unregister(); +err_detach: + udc_device_put(udc); return ret; } SPL_LOAD_IMAGE_METHOD("USB SDP", 0, BOOT_DEVICE_BOARD, spl_sdp_load_image); diff --git a/common/spl/spl_semihosting.c b/common/spl/spl_semihosting.c index 5b5e842..f7dd289 100644 --- a/common/spl/spl_semihosting.c +++ b/common/spl/spl_semihosting.c @@ -21,6 +21,23 @@ static int smh_read_full(long fd, void *memp, size_t len) return 0; } +static ulong smh_fit_read(struct spl_load_info *load, ulong file_offset, + ulong size, void *buf) +{ + long fd; + ulong ret; + + fd = smh_open(load->filename, MODE_READ | MODE_BINARY); + if (fd < 0) { + log_debug("could not open %s: %ld\n", load->filename, fd); + return 0; + } + ret = smh_read(fd, buf, size); + smh_close(fd); + + return ret; +} + static int spl_smh_load_image(struct spl_image_info *spl_image, struct spl_boot_device *bootdev) { @@ -49,6 +66,20 @@ static int spl_smh_load_image(struct spl_image_info *spl_image, goto out; } + if (IS_ENABLED(CONFIG_SPL_LOAD_FIT) && + image_get_magic(header) == FDT_MAGIC) { + struct spl_load_info load; + + debug("Found FIT\n"); + load.read = smh_fit_read; + load.bl_len = 1; + load.filename = filename; + load.priv = NULL; + smh_close(fd); + + return spl_load_simple_fit(spl_image, &load, 0, header); + } + ret = spl_parse_image_header(spl_image, bootdev, header); if (ret) { log_debug("failed to parse image header: %d\n", ret); diff --git a/common/stdio.c b/common/stdio.c index 894cbd3..010bf57 100644 --- a/common/stdio.c +++ b/common/stdio.c @@ -293,18 +293,6 @@ int stdio_deregister_dev(struct stdio_dev *dev, int force) int stdio_init_tables(void) { -#if defined(CONFIG_NEEDS_MANUAL_RELOC) - /* already relocated for current ARM implementation */ - ulong relocation_offset = gd->reloc_off; - int i; - - /* relocate device name pointers */ - for (i = 0; i < (sizeof (stdio_names) / sizeof (char *)); ++i) { - stdio_names[i] = (char *) (((ulong) stdio_names[i]) + - relocation_offset); - } -#endif /* CONFIG_NEEDS_MANUAL_RELOC */ - /* Initialize the list */ INIT_LIST_HEAD(&devs.list); diff --git a/common/update.c b/common/update.c index 3502713..ec302ca 100644 --- a/common/update.c +++ b/common/update.c @@ -9,6 +9,7 @@ #include <common.h> #include <cpu_func.h> #include <image.h> +#include <linux/printk.h> #include <command.h> #include <env.h> diff --git a/configs/am335x_guardian_defconfig b/configs/am335x_guardian_defconfig index a485cc6..7c4085d 100644 --- a/configs/am335x_guardian_defconfig +++ b/configs/am335x_guardian_defconfig @@ -17,7 +17,6 @@ CONFIG_SPL_SERIAL=y CONFIG_SPL_DRIVERS_MISC=y CONFIG_BOOTCOUNT_BOOTLIMIT=3 CONFIG_SPL=y -CONFIG_BOOTSTAGE_STASH_ADDR=0x0 CONFIG_ENV_OFFSET_REDUND=0x540000 CONFIG_SPL_LIBDISK_SUPPORT=y CONFIG_SYS_MEMTEST_START=0x80000000 diff --git a/configs/am62x_evm_a53_defconfig b/configs/am62x_evm_a53_defconfig index d55caab..a2729c1 100644 --- a/configs/am62x_evm_a53_defconfig +++ b/configs/am62x_evm_a53_defconfig @@ -25,11 +25,13 @@ CONFIG_SPL_FS_FAT=y CONFIG_SPL_LIBDISK_SUPPORT=y CONFIG_SPL_SPI_FLASH_SUPPORT=y CONFIG_SPL_SPI=y +# CONFIG_PSCI_RESET is not set # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set CONFIG_SPL_LOAD_FIT=y CONFIG_SPL_LOAD_FIT_ADDRESS=0x81000000 -CONFIG_DISTRO_DEFAULTS=y -CONFIG_BOOTCOMMAND="run envboot; run distro_bootcmd;" +CONFIG_BOOTSTD_FULL=y +CONFIG_BOOTSTD_DEFAULTS=y +CONFIG_BOOTCOMMAND="run envboot; bootflow scan -lb" CONFIG_SPL_MAX_SIZE=0x58000 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y CONFIG_SPL_BSS_START_ADDR=0x80c80000 @@ -69,6 +71,7 @@ CONFIG_TI_K3_NAVSS_UDMA=y CONFIG_TI_SCI_PROTOCOL=y CONFIG_DM_MAILBOX=y CONFIG_K3_SEC_PROXY=y +CONFIG_SUPPORT_EMMC_BOOT=y CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_ADMA=y CONFIG_SPL_MMC_SDHCI_ADMA=y diff --git a/configs/am62x_evm_r5_defconfig b/configs/am62x_evm_r5_defconfig index 3c5f367..489ee94 100644 --- a/configs/am62x_evm_r5_defconfig +++ b/configs/am62x_evm_r5_defconfig @@ -92,6 +92,7 @@ CONFIG_DM_MAILBOX=y CONFIG_K3_SEC_PROXY=y CONFIG_SPL_MISC=y CONFIG_ESM_K3=y +CONFIG_SUPPORT_EMMC_BOOT=y CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_ADMA=y CONFIG_SPL_MMC_SDHCI_ADMA=y diff --git a/configs/apple_m1_defconfig b/configs/apple_m1_defconfig index 7555609..d58a903 100644 --- a/configs/apple_m1_defconfig +++ b/configs/apple_m1_defconfig @@ -16,6 +16,7 @@ CONFIG_NVME_APPLE=y CONFIG_USB_XHCI_HCD=y CONFIG_USB_XHCI_DWC3=y CONFIG_USB_XHCI_PCI=y +CONFIG_USB_DWC3=y CONFIG_USB_KEYBOARD=y CONFIG_SYS_WHITE_ON_BLACK=y CONFIG_NO_FB_CLEAR=y diff --git a/configs/bayleybay_defconfig b/configs/bayleybay_defconfig index a44c9b7..573f1b4 100644 --- a/configs/bayleybay_defconfig +++ b/configs/bayleybay_defconfig @@ -25,7 +25,6 @@ CONFIG_USE_BOOTCOMMAND=y CONFIG_BOOTCOMMAND="ext2load scsi 0:3 01000000 /boot/vmlinuz; zboot 01000000" CONFIG_SYS_CONSOLE_INFO_QUIET=y CONFIG_DISPLAY_BOARDINFO_LATE=y -CONFIG_LAST_STAGE_INIT=y CONFIG_HUSH_PARSER=y CONFIG_SYS_PBSIZE=532 CONFIG_CMD_CPU=y diff --git a/configs/cherryhill_defconfig b/configs/cherryhill_defconfig index 0079971..59c3986 100644 --- a/configs/cherryhill_defconfig +++ b/configs/cherryhill_defconfig @@ -18,7 +18,6 @@ CONFIG_USE_BOOTCOMMAND=y CONFIG_BOOTCOMMAND="ext2load scsi 0:3 01000000 /boot/vmlinuz; zboot 01000000" CONFIG_SYS_CONSOLE_INFO_QUIET=y CONFIG_DISPLAY_BOARDINFO_LATE=y -CONFIG_LAST_STAGE_INIT=y CONFIG_HUSH_PARSER=y CONFIG_SYS_PBSIZE=532 CONFIG_CMD_CPU=y diff --git a/configs/chromebook_coral_defconfig b/configs/chromebook_coral_defconfig index 152f297..5394396 100644 --- a/configs/chromebook_coral_defconfig +++ b/configs/chromebook_coral_defconfig @@ -40,7 +40,6 @@ CONFIG_SYS_CONSOLE_INFO_QUIET=y CONFIG_LOG=y CONFIG_LOGF_FUNC=y CONFIG_DISPLAY_BOARDINFO_LATE=y -CONFIG_LAST_STAGE_INIT=y CONFIG_BLOBLIST=y # CONFIG_TPL_BLOBLIST is not set CONFIG_BLOBLIST_ADDR=0x100000 diff --git a/configs/chromebook_link64_defconfig b/configs/chromebook_link64_defconfig index 558609e..eb8923c 100644 --- a/configs/chromebook_link64_defconfig +++ b/configs/chromebook_link64_defconfig @@ -29,7 +29,6 @@ CONFIG_USE_BOOTCOMMAND=y CONFIG_BOOTCOMMAND="ext2load scsi 0:3 01000000 /boot/vmlinuz; zboot 01000000" CONFIG_SYS_CONSOLE_INFO_QUIET=y CONFIG_DISPLAY_BOARDINFO_LATE=y -CONFIG_LAST_STAGE_INIT=y CONFIG_MISC_INIT_R=y CONFIG_SPL_NO_BSS_LIMIT=y CONFIG_SPL_SYS_MALLOC_SIMPLE=y diff --git a/configs/chromebook_link_defconfig b/configs/chromebook_link_defconfig index 96c26f1..4347cad 100644 --- a/configs/chromebook_link_defconfig +++ b/configs/chromebook_link_defconfig @@ -25,7 +25,6 @@ CONFIG_USE_BOOTCOMMAND=y CONFIG_BOOTCOMMAND="ext2load scsi 0:3 01000000 /boot/vmlinuz; zboot 01000000" CONFIG_SYS_CONSOLE_INFO_QUIET=y CONFIG_DISPLAY_BOARDINFO_LATE=y -CONFIG_LAST_STAGE_INIT=y CONFIG_MISC_INIT_R=y CONFIG_HUSH_PARSER=y CONFIG_SYS_PBSIZE=532 diff --git a/configs/chromebook_samus_defconfig b/configs/chromebook_samus_defconfig index 4019c16..3b6a173 100644 --- a/configs/chromebook_samus_defconfig +++ b/configs/chromebook_samus_defconfig @@ -25,7 +25,6 @@ CONFIG_USE_BOOTCOMMAND=y CONFIG_BOOTCOMMAND="ext2load scsi 0:3 01000000 /boot/vmlinuz; zboot 01000000" CONFIG_SYS_CONSOLE_INFO_QUIET=y CONFIG_DISPLAY_BOARDINFO_LATE=y -CONFIG_LAST_STAGE_INIT=y CONFIG_MISC_INIT_R=y CONFIG_HUSH_PARSER=y CONFIG_SYS_PBSIZE=532 diff --git a/configs/chromebook_samus_tpl_defconfig b/configs/chromebook_samus_tpl_defconfig index 4cfaf4b..9dd2940 100644 --- a/configs/chromebook_samus_tpl_defconfig +++ b/configs/chromebook_samus_tpl_defconfig @@ -1,6 +1,8 @@ CONFIG_X86=y CONFIG_TEXT_BASE=0xffed0000 CONFIG_SYS_MALLOC_F_LEN=0x2000 +CONFIG_TPL_SYS_MALLOC_F_LEN=0x2000 +CONFIG_SPL_SYS_MALLOC_F_LEN=0x3000 CONFIG_NR_DRAM_BANKS=8 CONFIG_ENV_SIZE=0x1000 CONFIG_ENV_OFFSET=0x3F8000 @@ -19,7 +21,7 @@ CONFIG_HAVE_MRC=y CONFIG_HAVE_REFCODE=y CONFIG_SMP=y CONFIG_HAVE_VGA_BIOS=y -CONFIG_X86_OFFSET_U_BOOT=0xffee0000 +CONFIG_X86_OFFSET_U_BOOT=0xffed0000 CONFIG_SYS_MONITOR_BASE=0xFFED0000 CONFIG_BOOTSTAGE=y CONFIG_BOOTSTAGE_REPORT=y @@ -30,7 +32,6 @@ CONFIG_USE_BOOTCOMMAND=y CONFIG_BOOTCOMMAND="ext2load scsi 0:3 01000000 /boot/vmlinuz; zboot 01000000" CONFIG_SYS_CONSOLE_INFO_QUIET=y CONFIG_DISPLAY_BOARDINFO_LATE=y -CONFIG_LAST_STAGE_INIT=y CONFIG_MISC_INIT_R=y CONFIG_BLOBLIST=y CONFIG_BLOBLIST_ADDR=0xff7c0000 diff --git a/configs/chromebox_panther_defconfig b/configs/chromebox_panther_defconfig index f050d06..4351a81 100644 --- a/configs/chromebox_panther_defconfig +++ b/configs/chromebox_panther_defconfig @@ -21,7 +21,6 @@ CONFIG_USE_BOOTCOMMAND=y CONFIG_BOOTCOMMAND="ext2load scsi 0:3 01000000 /boot/vmlinuz; zboot 01000000" CONFIG_SYS_CONSOLE_INFO_QUIET=y CONFIG_DISPLAY_BOARDINFO_LATE=y -CONFIG_LAST_STAGE_INIT=y CONFIG_MISC_INIT_R=y CONFIG_HUSH_PARSER=y CONFIG_SYS_PBSIZE=532 diff --git a/configs/conga-qeval20-qa3-e3845-internal-uart_defconfig b/configs/conga-qeval20-qa3-e3845-internal-uart_defconfig index 656d575..1515246 100644 --- a/configs/conga-qeval20-qa3-e3845-internal-uart_defconfig +++ b/configs/conga-qeval20-qa3-e3845-internal-uart_defconfig @@ -31,7 +31,6 @@ CONFIG_BOOTCOMMAND="load scsi 0:2 03000000 /boot/vmlinuz-${kernel-ver}-generic;l CONFIG_USE_PREBOOT=y CONFIG_SYS_CONSOLE_INFO_QUIET=y CONFIG_DISPLAY_BOARDINFO_LATE=y -CONFIG_LAST_STAGE_INIT=y CONFIG_HUSH_PARSER=y CONFIG_SYS_PBSIZE=532 CONFIG_CMD_CPU=y diff --git a/configs/conga-qeval20-qa3-e3845_defconfig b/configs/conga-qeval20-qa3-e3845_defconfig index 54dc59e..d62fb99 100644 --- a/configs/conga-qeval20-qa3-e3845_defconfig +++ b/configs/conga-qeval20-qa3-e3845_defconfig @@ -27,7 +27,6 @@ CONFIG_BOOTCOMMAND="load scsi 0:2 03000000 /boot/vmlinuz-${kernel-ver}-generic;l CONFIG_USE_PREBOOT=y CONFIG_SYS_CONSOLE_INFO_QUIET=y CONFIG_DISPLAY_BOARDINFO_LATE=y -CONFIG_LAST_STAGE_INIT=y CONFIG_HUSH_PARSER=y CONFIG_SYS_PBSIZE=532 CONFIG_CMD_CPU=y diff --git a/configs/coreboot64_defconfig b/configs/coreboot64_defconfig index 8aadaa6..555d281 100644 --- a/configs/coreboot64_defconfig +++ b/configs/coreboot64_defconfig @@ -1,5 +1,6 @@ CONFIG_X86=y CONFIG_TEXT_BASE=0x1120000 +CONFIG_SYS_MALLOC_LEN=0x2000000 CONFIG_NR_DRAM_BANKS=8 CONFIG_ENV_SIZE=0x1000 CONFIG_DEFAULT_DEVICE_TREE="coreboot" @@ -10,39 +11,32 @@ CONFIG_VENDOR_COREBOOT=y CONFIG_TARGET_COREBOOT=y CONFIG_FIT=y CONFIG_FIT_SIGNATURE=y +CONFIG_BOOTSTD_FULL=y +CONFIG_BOOTSTD_DEFAULTS=y CONFIG_SYS_MONITOR_BASE=0x01120000 CONFIG_SHOW_BOOT_PROGRESS=y CONFIG_USE_BOOTARGS=y CONFIG_BOOTARGS="root=/dev/sdb3 init=/sbin/init rootwait ro" -CONFIG_USE_BOOTCOMMAND=y -CONFIG_BOOTCOMMAND="ext2load scsi 0:3 01000000 /boot/vmlinuz; zboot 01000000" CONFIG_PRE_CONSOLE_BUFFER=y CONFIG_SYS_CONSOLE_INFO_QUIET=y +CONFIG_LOG=y +CONFIG_LOGF_LINE=y +CONFIG_LOGF_FUNC=y CONFIG_DISPLAY_BOARDINFO_LATE=y -CONFIG_LAST_STAGE_INIT=y CONFIG_SPL_NO_BSS_LIMIT=y -CONFIG_HUSH_PARSER=y CONFIG_SYS_PBSIZE=532 CONFIG_CMD_IDE=y CONFIG_CMD_MMC=y -CONFIG_CMD_PART=y +CONFIG_CMD_SATA=y CONFIG_CMD_USB=y # CONFIG_CMD_SETEXPR is not set -CONFIG_CMD_DHCP=y CONFIG_BOOTP_BOOTFILESIZE=y -CONFIG_CMD_PING=y CONFIG_CMD_TIME=y CONFIG_CMD_SOUND=y -CONFIG_CMD_EXT2=y -CONFIG_CMD_EXT4=y CONFIG_CMD_EXT4_WRITE=y -CONFIG_CMD_FAT=y -CONFIG_CMD_FS_GENERIC=y CONFIG_MAC_PARTITION=y # CONFIG_SPL_MAC_PARTITION is not set # CONFIG_SPL_DOS_PARTITION is not set -CONFIG_ISO_PARTITION=y -CONFIG_EFI_PARTITION=y # CONFIG_SPL_EFI_PARTITION is not set CONFIG_ENV_OVERWRITE=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y @@ -60,8 +54,14 @@ CONFIG_SYS_ATA_ALT_OFFSET=0 CONFIG_ATAPI=y CONFIG_LBA48=y CONFIG_SYS_64BIT_LBA=y +CONFIG_NVME_PCI=y # CONFIG_PCI_PNP is not set +CONFIG_SYS_NS16550_MEM32=y CONFIG_SOUND=y CONFIG_SOUND_I8254=y +CONFIG_VIDEO_COPY=y CONFIG_CONSOLE_SCROLL_LINES=5 +CONFIG_SPL_ACPI=y +CONFIG_CMD_DHRYSTONE=y # CONFIG_GZIP is not set +CONFIG_SMBIOS_PARSER=y diff --git a/configs/coreboot_defconfig b/configs/coreboot_defconfig index 8e11de6..edc38f1 100644 --- a/configs/coreboot_defconfig +++ b/configs/coreboot_defconfig @@ -10,6 +10,7 @@ CONFIG_TARGET_COREBOOT=y CONFIG_FIT=y CONFIG_FIT_SIGNATURE=y CONFIG_BOOTSTD_FULL=y +CONFIG_BOOTSTD_DEFAULTS=y CONFIG_SYS_MONITOR_BASE=0x01110000 CONFIG_SHOW_BOOT_PROGRESS=y CONFIG_USE_BOOTARGS=y @@ -20,25 +21,17 @@ CONFIG_LOG=y CONFIG_LOGF_LINE=y CONFIG_LOGF_FUNC=y CONFIG_DISPLAY_BOARDINFO_LATE=y -CONFIG_LAST_STAGE_INIT=y CONFIG_PCI_INIT_R=y +CONFIG_CMD_IDE=y CONFIG_CMD_MMC=y -CONFIG_CMD_PART=y +CONFIG_CMD_SATA=y CONFIG_CMD_USB=y # CONFIG_CMD_SETEXPR is not set -CONFIG_CMD_DHCP=y CONFIG_BOOTP_BOOTFILESIZE=y -CONFIG_CMD_PING=y CONFIG_CMD_TIME=y CONFIG_CMD_SOUND=y -CONFIG_CMD_EXT2=y -CONFIG_CMD_EXT4=y CONFIG_CMD_EXT4_WRITE=y -CONFIG_CMD_FAT=y -CONFIG_CMD_FS_GENERIC=y CONFIG_MAC_PARTITION=y -CONFIG_ISO_PARTITION=y -CONFIG_EFI_PARTITION=y CONFIG_ENV_OVERWRITE=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_USE_BOOTFILE=y @@ -48,10 +41,19 @@ CONFIG_USE_ROOTPATH=y CONFIG_REGMAP=y CONFIG_SYSCON=y # CONFIG_ACPIGEN is not set +CONFIG_SYS_IDE_MAXDEVICE=4 +CONFIG_SYS_ATA_DATA_OFFSET=0 +CONFIG_SYS_ATA_REG_OFFSET=0 +CONFIG_SYS_ATA_ALT_OFFSET=0 +CONFIG_ATAPI=y +CONFIG_LBA48=y +CONFIG_SYS_64BIT_LBA=y CONFIG_NVME_PCI=y # CONFIG_PCI_PNP is not set +CONFIG_SYS_NS16550_MEM32=y CONFIG_SOUND=y CONFIG_SOUND_I8254=y +CONFIG_VIDEO_COPY=y CONFIG_CONSOLE_SCROLL_LINES=5 CONFIG_CMD_DHRYSTONE=y # CONFIG_GZIP is not set diff --git a/configs/cougarcanyon2_defconfig b/configs/cougarcanyon2_defconfig index da5ff55..71c79f5 100644 --- a/configs/cougarcanyon2_defconfig +++ b/configs/cougarcanyon2_defconfig @@ -20,7 +20,6 @@ CONFIG_USE_BOOTCOMMAND=y CONFIG_BOOTCOMMAND="ext2load scsi 0:3 01000000 /boot/vmlinuz; zboot 01000000" CONFIG_SYS_CONSOLE_INFO_QUIET=y CONFIG_DISPLAY_BOARDINFO_LATE=y -CONFIG_LAST_STAGE_INIT=y CONFIG_HUSH_PARSER=y CONFIG_SYS_PBSIZE=532 CONFIG_CMD_CPU=y diff --git a/configs/crownbay_defconfig b/configs/crownbay_defconfig index 70e1a50..e734c75 100644 --- a/configs/crownbay_defconfig +++ b/configs/crownbay_defconfig @@ -21,7 +21,6 @@ CONFIG_USE_BOOTCOMMAND=y CONFIG_BOOTCOMMAND="ext2load scsi 0:3 01000000 /boot/vmlinuz; zboot 01000000" CONFIG_SYS_CONSOLE_INFO_QUIET=y CONFIG_DISPLAY_BOARDINFO_LATE=y -CONFIG_LAST_STAGE_INIT=y CONFIG_HUSH_PARSER=y CONFIG_SYS_PBSIZE=532 CONFIG_CMD_CPU=y diff --git a/configs/dfi-bt700-q7x-151_defconfig b/configs/dfi-bt700-q7x-151_defconfig index 9313e7f..79f5d74 100644 --- a/configs/dfi-bt700-q7x-151_defconfig +++ b/configs/dfi-bt700-q7x-151_defconfig @@ -26,7 +26,6 @@ CONFIG_BOOTCOMMAND="load scsi 0:1 03000000 /boot/vmlinuz-${kernel-ver}-generic;l CONFIG_USE_PREBOOT=y CONFIG_SYS_CONSOLE_INFO_QUIET=y CONFIG_DISPLAY_BOARDINFO_LATE=y -CONFIG_LAST_STAGE_INIT=y CONFIG_HUSH_PARSER=y CONFIG_SYS_PBSIZE=532 CONFIG_CMD_CPU=y diff --git a/configs/edison_defconfig b/configs/edison_defconfig index 8692a8a..f134680 100644 --- a/configs/edison_defconfig +++ b/configs/edison_defconfig @@ -13,7 +13,6 @@ CONFIG_TARGET_EDISON=y CONFIG_SMP=y CONFIG_SYS_MONITOR_BASE=0x01101000 CONFIG_BOARD_EARLY_INIT_R=y -CONFIG_LAST_STAGE_INIT=y CONFIG_HUSH_PARSER=y CONFIG_SYS_MAXARGS=128 CONFIG_SYS_CBSIZE=2048 diff --git a/configs/efi-x86_app32_defconfig b/configs/efi-x86_app32_defconfig index 50975db..dfc3157 100644 --- a/configs/efi-x86_app32_defconfig +++ b/configs/efi-x86_app32_defconfig @@ -2,7 +2,7 @@ CONFIG_X86=y CONFIG_NR_DRAM_BANKS=8 CONFIG_ENV_SIZE=0x1000 CONFIG_DEFAULT_DEVICE_TREE="efi-x86_app" -CONFIG_DEBUG_UART_BASE=0 +CONFIG_DEBUG_UART_BASE=0x0 CONFIG_DEBUG_UART_CLOCK=0 CONFIG_VENDOR_EFI=y CONFIG_TARGET_EFI_APP32=y @@ -16,7 +16,6 @@ CONFIG_USE_BOOTCOMMAND=y CONFIG_BOOTCOMMAND="ext2load scsi 0:3 01000000 /boot/vmlinuz; zboot 01000000" CONFIG_SYS_CONSOLE_INFO_QUIET=y CONFIG_DISPLAY_BOARDINFO_LATE=y -CONFIG_LAST_STAGE_INIT=y CONFIG_HUSH_PARSER=y CONFIG_SYS_PBSIZE=532 CONFIG_CMD_BOOTZ=y diff --git a/configs/efi-x86_app64_defconfig b/configs/efi-x86_app64_defconfig index 0fc358d..e0cfe3e 100644 --- a/configs/efi-x86_app64_defconfig +++ b/configs/efi-x86_app64_defconfig @@ -2,7 +2,7 @@ CONFIG_X86=y CONFIG_NR_DRAM_BANKS=8 CONFIG_ENV_SIZE=0x1000 CONFIG_DEFAULT_DEVICE_TREE="efi-x86_app" -CONFIG_DEBUG_UART_BASE=0 +CONFIG_DEBUG_UART_BASE=0x0 CONFIG_DEBUG_UART_CLOCK=0 CONFIG_X86_RUN_64BIT=y CONFIG_VENDOR_EFI=y @@ -17,7 +17,6 @@ CONFIG_USE_BOOTCOMMAND=y CONFIG_BOOTCOMMAND="ext2load scsi 0:3 01000000 /boot/vmlinuz; zboot 01000000" CONFIG_SYS_CONSOLE_INFO_QUIET=y CONFIG_DISPLAY_BOARDINFO_LATE=y -CONFIG_LAST_STAGE_INIT=y CONFIG_HUSH_PARSER=y CONFIG_SYS_PBSIZE=532 CONFIG_CMD_BOOTZ=y diff --git a/configs/efi-x86_payload32_defconfig b/configs/efi-x86_payload32_defconfig index 4149eea..1532367 100644 --- a/configs/efi-x86_payload32_defconfig +++ b/configs/efi-x86_payload32_defconfig @@ -15,7 +15,6 @@ CONFIG_BOOTCOMMAND="ext2load scsi 0:3 01000000 /boot/vmlinuz; zboot 01000000" CONFIG_PRE_CONSOLE_BUFFER=y CONFIG_SYS_CONSOLE_INFO_QUIET=y CONFIG_DISPLAY_BOARDINFO_LATE=y -CONFIG_LAST_STAGE_INIT=y CONFIG_HUSH_PARSER=y CONFIG_SYS_PBSIZE=532 CONFIG_CMD_IDE=y diff --git a/configs/efi-x86_payload64_defconfig b/configs/efi-x86_payload64_defconfig index d41f73c..6c6f705 100644 --- a/configs/efi-x86_payload64_defconfig +++ b/configs/efi-x86_payload64_defconfig @@ -7,15 +7,15 @@ CONFIG_VENDOR_EFI=y CONFIG_TARGET_EFI_PAYLOAD=y CONFIG_FIT=y CONFIG_FIT_SIGNATURE=y +CONFIG_BOOTSTD_FULL=y +CONFIG_LEGACY_IMAGE_FORMAT=y CONFIG_SHOW_BOOT_PROGRESS=y CONFIG_USE_BOOTARGS=y CONFIG_BOOTARGS="root=/dev/sdb3 init=/sbin/init rootwait ro" CONFIG_USE_BOOTCOMMAND=y -CONFIG_BOOTCOMMAND="ext2load scsi 0:3 01000000 /boot/vmlinuz; zboot 01000000" CONFIG_PRE_CONSOLE_BUFFER=y CONFIG_SYS_CONSOLE_INFO_QUIET=y CONFIG_DISPLAY_BOARDINFO_LATE=y -CONFIG_LAST_STAGE_INIT=y CONFIG_HUSH_PARSER=y CONFIG_SYS_PBSIZE=532 CONFIG_CMD_IDE=y @@ -36,6 +36,9 @@ CONFIG_MAC_PARTITION=y CONFIG_ISO_PARTITION=y CONFIG_EFI_PARTITION=y CONFIG_ENV_OVERWRITE=y +CONFIG_ENV_IS_IN_FAT=y +CONFIG_ENV_FAT_INTERFACE="scsi" +CONFIG_ENV_FAT_DEVICE_AND_PART="0:1" CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_USE_BOOTFILE=y CONFIG_BOOTFILE="bzImage" diff --git a/configs/evb-rk3229_defconfig b/configs/evb-rk3229_defconfig index c1e7f39..7469f3f 100644 --- a/configs/evb-rk3229_defconfig +++ b/configs/evb-rk3229_defconfig @@ -12,7 +12,6 @@ CONFIG_ENV_OFFSET=0x3F8000 CONFIG_DEFAULT_DEVICE_TREE="rk3229-evb" CONFIG_SPL_TEXT_BASE=0x60000000 CONFIG_ROCKCHIP_RK322X=y -CONFIG_ROCKCHIP_SPL_RESERVE_IRAM=0x0 CONFIG_TARGET_EVB_RK3229=y CONFIG_SPL_STACK_R_ADDR=0x60600000 CONFIG_DEBUG_UART_BASE=0x11030000 diff --git a/configs/evb-rk3308_defconfig b/configs/evb-rk3308_defconfig index a13a809..d1e7858 100644 --- a/configs/evb-rk3308_defconfig +++ b/configs/evb-rk3308_defconfig @@ -11,7 +11,6 @@ CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x800000 CONFIG_DEFAULT_DEVICE_TREE="rk3308-evb" CONFIG_DM_RESET=y CONFIG_ROCKCHIP_RK3308=y -CONFIG_ROCKCHIP_SPL_RESERVE_IRAM=0x0 CONFIG_SPL_DRIVERS_MISC=y CONFIG_TARGET_EVB_RK3308=y CONFIG_SPL_STACK_R_ADDR=0xc00000 diff --git a/configs/galileo_defconfig b/configs/galileo_defconfig index c6d989e..c226ae1 100644 --- a/configs/galileo_defconfig +++ b/configs/galileo_defconfig @@ -17,7 +17,6 @@ CONFIG_USE_BOOTCOMMAND=y CONFIG_BOOTCOMMAND="ext2load scsi 0:3 01000000 /boot/vmlinuz; zboot 01000000" CONFIG_SYS_CONSOLE_INFO_QUIET=y CONFIG_DISPLAY_BOARDINFO_LATE=y -CONFIG_LAST_STAGE_INIT=y CONFIG_HUSH_PARSER=y CONFIG_SYS_PBSIZE=532 CONFIG_CMD_CPU=y diff --git a/configs/imx6q_logic_defconfig b/configs/imx6q_logic_defconfig index cbacb96..0c07b98 100644 --- a/configs/imx6q_logic_defconfig +++ b/configs/imx6q_logic_defconfig @@ -86,7 +86,6 @@ CONFIG_LED=y CONFIG_LED_GPIO=y CONFIG_MISC=y CONFIG_I2C_EEPROM=y -CONFIG_SYS_I2C_EEPROM_ADDR=0x0 CONFIG_FSL_USDHC=y CONFIG_MTD=y CONFIG_DM_MTD=y diff --git a/configs/imx8mm_data_modul_edm_sbc_defconfig b/configs/imx8mm_data_modul_edm_sbc_defconfig index 1814795..ee673e4 100644 --- a/configs/imx8mm_data_modul_edm_sbc_defconfig +++ b/configs/imx8mm_data_modul_edm_sbc_defconfig @@ -232,6 +232,5 @@ CONFIG_USB_GADGET_MANUFACTURER="Data Modul" CONFIG_USB_GADGET_VENDOR_NUM=0x0525 CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 CONFIG_CI_UDC=y -CONFIG_SDP_LOADADDR=0x0 CONFIG_USB_FUNCTION_ACM=y CONFIG_IMX_WATCHDOG=y diff --git a/configs/imx8mn_beacon_2g_defconfig b/configs/imx8mn_beacon_2g_defconfig index c88c685..67dca88 100644 --- a/configs/imx8mn_beacon_2g_defconfig +++ b/configs/imx8mn_beacon_2g_defconfig @@ -142,4 +142,3 @@ CONFIG_USB_GADGET_MANUFACTURER="FSL" CONFIG_USB_GADGET_VENDOR_NUM=0x0525 CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 CONFIG_CI_UDC=y -CONFIG_SDP_LOADADDR=0x0 diff --git a/configs/imx8mn_beacon_defconfig b/configs/imx8mn_beacon_defconfig index 0f3b1eb..7426bbb 100644 --- a/configs/imx8mn_beacon_defconfig +++ b/configs/imx8mn_beacon_defconfig @@ -149,5 +149,4 @@ CONFIG_USB_GADGET_MANUFACTURER="FSL" CONFIG_USB_GADGET_VENDOR_NUM=0x0525 CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 CONFIG_CI_UDC=y -CONFIG_SDP_LOADADDR=0x0 CONFIG_IMX_WATCHDOG=y diff --git a/configs/imx8mn_beacon_fspi_defconfig b/configs/imx8mn_beacon_fspi_defconfig index 3ea98fd..021968d 100644 --- a/configs/imx8mn_beacon_fspi_defconfig +++ b/configs/imx8mn_beacon_fspi_defconfig @@ -149,7 +149,6 @@ CONFIG_USB_GADGET_MANUFACTURER="FSL" CONFIG_USB_GADGET_VENDOR_NUM=0x0525 CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 CONFIG_CI_UDC=y -CONFIG_SDP_LOADADDR=0x0 CONFIG_IMX_WATCHDOG=y CONFIG_FSPI_CONF_HEADER=y CONFIG_FSPI_CONF_FILE="fspi_header.bin" diff --git a/configs/imx8mp_beacon_defconfig b/configs/imx8mp_beacon_defconfig index 70cdabc..5b8e287 100644 --- a/configs/imx8mp_beacon_defconfig +++ b/configs/imx8mp_beacon_defconfig @@ -172,7 +172,6 @@ CONFIG_USB_GADGET=y CONFIG_USB_GADGET_MANUFACTURER="FSL" CONFIG_USB_GADGET_VENDOR_NUM=0x1fc9 CONFIG_USB_GADGET_PRODUCT_NUM=0x0152 -CONFIG_SDP_LOADADDR=0x0 CONFIG_USB_FUNCTION_ACM=y CONFIG_USB_ETHER=y CONFIG_USB_ETH_CDC=y diff --git a/configs/imx8mp_data_modul_edm_sbc_defconfig b/configs/imx8mp_data_modul_edm_sbc_defconfig index bec4e40..ed2d4fe 100644 --- a/configs/imx8mp_data_modul_edm_sbc_defconfig +++ b/configs/imx8mp_data_modul_edm_sbc_defconfig @@ -256,7 +256,6 @@ CONFIG_USB_GADGET=y CONFIG_USB_GADGET_MANUFACTURER="Data Modul" CONFIG_USB_GADGET_VENDOR_NUM=0x0525 CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 -CONFIG_SDP_LOADADDR=0x0 CONFIG_USB_FUNCTION_ACM=y CONFIG_USB_ETHER=y CONFIG_USB_ETH_CDC=y diff --git a/configs/imx8mp_dhcom_pdk2_defconfig b/configs/imx8mp_dhcom_pdk2_defconfig index a891141..148d80a 100644 --- a/configs/imx8mp_dhcom_pdk2_defconfig +++ b/configs/imx8mp_dhcom_pdk2_defconfig @@ -254,7 +254,6 @@ CONFIG_USB_GADGET=y CONFIG_USB_GADGET_MANUFACTURER="DH electronics" CONFIG_USB_GADGET_VENDOR_NUM=0x0525 CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 -CONFIG_SDP_LOADADDR=0x0 CONFIG_USB_FUNCTION_ACM=y CONFIG_USB_ETHER=y CONFIG_USB_ETH_CDC=y diff --git a/configs/imx8mp_dhcom_pdk3_defconfig b/configs/imx8mp_dhcom_pdk3_defconfig index 6f00acf..6b213c4 100644 --- a/configs/imx8mp_dhcom_pdk3_defconfig +++ b/configs/imx8mp_dhcom_pdk3_defconfig @@ -257,7 +257,6 @@ CONFIG_USB_GADGET=y CONFIG_USB_GADGET_MANUFACTURER="DH electronics" CONFIG_USB_GADGET_VENDOR_NUM=0x0525 CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 -CONFIG_SDP_LOADADDR=0x0 CONFIG_USB_FUNCTION_ACM=y CONFIG_USB_ETHER=y CONFIG_USB_ETH_CDC=y diff --git a/configs/imxrt1020-evk_defconfig b/configs/imxrt1020-evk_defconfig index 40210a5..6b63b80 100644 --- a/configs/imxrt1020-evk_defconfig +++ b/configs/imxrt1020-evk_defconfig @@ -19,6 +19,8 @@ CONFIG_SPL_SERIAL=y CONFIG_SPL_SIZE_LIMIT=0x20000 CONFIG_SPL=y CONFIG_SYS_LOAD_ADDR=0x20209000 +CONFIG_HAVE_SYS_UBOOT_START=y +CONFIG_SYS_UBOOT_START=0x800023FD CONFIG_DISTRO_DEFAULTS=y CONFIG_SD_BOOT=y # CONFIG_USE_BOOTCOMMAND is not set diff --git a/configs/imxrt1050-evk_defconfig b/configs/imxrt1050-evk_defconfig index 8f7a36f..cbf9469 100644 --- a/configs/imxrt1050-evk_defconfig +++ b/configs/imxrt1050-evk_defconfig @@ -21,6 +21,8 @@ CONFIG_SPL_SERIAL=y CONFIG_SPL_SIZE_LIMIT=0x20000 CONFIG_SPL=y CONFIG_SYS_LOAD_ADDR=0x20209000 +CONFIG_HAVE_SYS_UBOOT_START=y +CONFIG_SYS_UBOOT_START=0x800023FD CONFIG_DISTRO_DEFAULTS=y CONFIG_SD_BOOT=y # CONFIG_USE_BOOTCOMMAND is not set diff --git a/configs/imxrt1170-evk_defconfig b/configs/imxrt1170-evk_defconfig index 8320c09..83825da 100644 --- a/configs/imxrt1170-evk_defconfig +++ b/configs/imxrt1170-evk_defconfig @@ -21,6 +21,8 @@ CONFIG_SPL_SERIAL=y CONFIG_SPL_SIZE_LIMIT=0x20000 CONFIG_SPL=y CONFIG_SYS_LOAD_ADDR=0x202C0000 +CONFIG_HAVE_SYS_UBOOT_START=y +CONFIG_SYS_UBOOT_START=0x202403FD CONFIG_DISTRO_DEFAULTS=y CONFIG_SD_BOOT=y # CONFIG_USE_BOOTCOMMAND is not set diff --git a/configs/j7200_evm_a72_defconfig b/configs/j7200_evm_a72_defconfig index ad8492a..ba5914d 100644 --- a/configs/j7200_evm_a72_defconfig +++ b/configs/j7200_evm_a72_defconfig @@ -114,6 +114,7 @@ CONFIG_FASTBOOT_FLASH=y CONFIG_FASTBOOT_FLASH_MMC_DEV=0 CONFIG_FASTBOOT_CMD_OEM_FORMAT=y CONFIG_TI_SCI_PROTOCOL=y +CONFIG_GPIO_HOG=y CONFIG_DA8XX_GPIO=y CONFIG_DM_PCA953X=y CONFIG_DM_I2C=y @@ -146,6 +147,7 @@ CONFIG_SPI_FLASH_STMICRO=y CONFIG_SPI_FLASH_MTD=y CONFIG_MULTIPLEXER=y CONFIG_MUX_MMIO=y +CONFIG_PHY_TI_DP83869=y CONFIG_PHY_FIXED=y CONFIG_TI_AM65_CPSW_NUSS=y CONFIG_PHY=y diff --git a/configs/kontron_sl28_defconfig b/configs/kontron_sl28_defconfig index 8fe2798..21a3979 100644 --- a/configs/kontron_sl28_defconfig +++ b/configs/kontron_sl28_defconfig @@ -20,7 +20,6 @@ CONFIG_SPL_MMC=y CONFIG_SPL_SERIAL=y CONFIG_SPL_STACK=0x18009ff0 CONFIG_SPL_SIZE_LIMIT=0x20000 -CONFIG_SPL_SIZE_LIMIT_PROVIDE_STACK=0x0 CONFIG_SPL=y CONFIG_ENV_OFFSET_REDUND=0x3f0000 CONFIG_SPL_SPI_FLASH_SUPPORT=y @@ -130,7 +129,6 @@ CONFIG_USB_GADGET_DOWNLOAD=y CONFIG_WDT=y CONFIG_WDT_SL28CPLD=y CONFIG_WDT_SP805=y -CONFIG_OF_LIBFDT_ASSUME_MASK=0x0 CONFIG_EFI_SET_TIME=y CONFIG_EFI_RUNTIME_UPDATE_CAPSULE=y CONFIG_EFI_CAPSULE_FIRMWARE_FIT=y diff --git a/configs/lion-rk3368_defconfig b/configs/lion-rk3368_defconfig index 7c55b3b..9c29eb6 100644 --- a/configs/lion-rk3368_defconfig +++ b/configs/lion-rk3368_defconfig @@ -10,7 +10,6 @@ CONFIG_ENV_OFFSET=0x3F8000 CONFIG_DEFAULT_DEVICE_TREE="rk3368-lion-haikou" CONFIG_SPL_TEXT_BASE=0x00000000 CONFIG_ROCKCHIP_RK3368=y -CONFIG_ROCKCHIP_SPL_RESERVE_IRAM=0x0 CONFIG_TPL_LIBCOMMON_SUPPORT=y CONFIG_TPL_LIBGENERIC_SUPPORT=y CONFIG_SPL_DRIVERS_MISC=y diff --git a/configs/minnowmax_defconfig b/configs/minnowmax_defconfig index 8347a9d..80e6a4c 100644 --- a/configs/minnowmax_defconfig +++ b/configs/minnowmax_defconfig @@ -30,7 +30,6 @@ CONFIG_USE_BOOTCOMMAND=y CONFIG_BOOTCOMMAND="ext2load scsi 0:3 01000000 /boot/vmlinuz; zboot 01000000" CONFIG_SYS_CONSOLE_INFO_QUIET=y CONFIG_DISPLAY_BOARDINFO_LATE=y -CONFIG_LAST_STAGE_INIT=y CONFIG_MISC_INIT_R=y CONFIG_HUSH_PARSER=y CONFIG_SYS_PBSIZE=532 diff --git a/configs/qemu-x86_64_defconfig b/configs/qemu-x86_64_defconfig index f6359ca..165f0b5 100644 --- a/configs/qemu-x86_64_defconfig +++ b/configs/qemu-x86_64_defconfig @@ -33,7 +33,6 @@ CONFIG_LOG=y CONFIG_LOGF_FUNC=y CONFIG_SPL_LOG=y CONFIG_DISPLAY_BOARDINFO_LATE=y -CONFIG_LAST_STAGE_INIT=y CONFIG_PCI_INIT_R=y CONFIG_BLOBLIST=y CONFIG_BLOBLIST_ADDR=0x10000 diff --git a/configs/qemu-x86_defconfig b/configs/qemu-x86_defconfig index 24682a5..4b2787d 100644 --- a/configs/qemu-x86_defconfig +++ b/configs/qemu-x86_defconfig @@ -23,7 +23,6 @@ CONFIG_SYS_CONSOLE_INFO_QUIET=y CONFIG_LOG=y CONFIG_LOGF_FUNC=y CONFIG_DISPLAY_BOARDINFO_LATE=y -CONFIG_LAST_STAGE_INIT=y CONFIG_PCI_INIT_R=y CONFIG_SYS_PBSIZE=532 CONFIG_CMD_CPU=y diff --git a/configs/qemu_arm64_defconfig b/configs/qemu_arm64_defconfig index 94bd966..5fdf496 100644 --- a/configs/qemu_arm64_defconfig +++ b/configs/qemu_arm64_defconfig @@ -35,7 +35,6 @@ CONFIG_CMD_NVEDIT_EFI=y CONFIG_CMD_DFU=y CONFIG_CMD_MTD=y CONFIG_CMD_PCI=y -CONFIG_CMD_USB=y CONFIG_CMD_TPM=y CONFIG_CMD_MTDPARTS=y CONFIG_ENV_IS_IN_FLASH=y @@ -68,7 +67,7 @@ CONFIG_SYSRESET=y CONFIG_SYSRESET_CMD_POWEROFF=y CONFIG_SYSRESET_PSCI=y CONFIG_TPM2_MMIO=y -CONFIG_USB=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_EHCI_PCI=y +CONFIG_SEMIHOSTING=y CONFIG_TPM=y diff --git a/configs/qemu_arm_defconfig b/configs/qemu_arm_defconfig index 7cb1e9f..1347b86 100644 --- a/configs/qemu_arm_defconfig +++ b/configs/qemu_arm_defconfig @@ -36,7 +36,6 @@ CONFIG_CMD_NVEDIT_EFI=y CONFIG_CMD_DFU=y CONFIG_CMD_MTD=y CONFIG_CMD_PCI=y -CONFIG_CMD_USB=y CONFIG_CMD_TPM=y CONFIG_CMD_MTDPARTS=y CONFIG_ENV_IS_IN_FLASH=y @@ -69,7 +68,6 @@ CONFIG_SYSRESET=y CONFIG_SYSRESET_CMD_POWEROFF=y CONFIG_SYSRESET_PSCI=y CONFIG_TPM2_MMIO=y -CONFIG_USB=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_EHCI_PCI=y CONFIG_TPM=y diff --git a/configs/r8a779f0_spider_defconfig b/configs/r8a779f0_spider_defconfig index 0edacc4..f250d1a 100644 --- a/configs/r8a779f0_spider_defconfig +++ b/configs/r8a779f0_spider_defconfig @@ -31,7 +31,9 @@ CONFIG_CMD_BOOTZ=y CONFIG_CMD_GPIO=y CONFIG_CMD_I2C=y CONFIG_CMD_MMC=y +CONFIG_CMD_PART=y CONFIG_CMD_SPI=y +CONFIG_CMD_UFS=y CONFIG_CMD_DHCP=y CONFIG_CMD_MII=y CONFIG_CMD_PING=y @@ -46,9 +48,13 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_VERSION_VARIABLE=y CONFIG_REGMAP=y CONFIG_SYSCON=y +CONFIG_LBA48=y +CONFIG_SYS_64BIT_LBA=y CONFIG_CLK=y +CONFIG_CLK_GPIO=y CONFIG_CLK_RENESAS=y CONFIG_RCAR_GPIO=y +CONFIG_DM_PCA953X=y CONFIG_DM_I2C=y CONFIG_SYS_I2C_RCAR_I2C=y CONFIG_MMC_IO_VOLTAGE=y @@ -67,8 +73,13 @@ CONFIG_PHY_R8A779F0_ETHERNET_SERDES=y CONFIG_DM_REGULATOR=y CONFIG_DM_REGULATOR_FIXED=y CONFIG_DM_REGULATOR_GPIO=y +CONFIG_SCSI=y +CONFIG_DM_SCSI=y CONFIG_BAUDRATE=1843200 CONFIG_SCIF_CONSOLE=y CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_RENESAS_RPC_SPI=y +CONFIG_UFS=y +CONFIG_UFS_RENESAS=y +CONFIG_FS_FAT_MAX_CLUSTSIZE=131072 diff --git a/configs/roc-cc-rk3308_defconfig b/configs/roc-cc-rk3308_defconfig index 9a789b2..3f3c223 100644 --- a/configs/roc-cc-rk3308_defconfig +++ b/configs/roc-cc-rk3308_defconfig @@ -11,7 +11,6 @@ CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x800000 CONFIG_DEFAULT_DEVICE_TREE="rk3308-roc-cc" CONFIG_DM_RESET=y CONFIG_ROCKCHIP_RK3308=y -CONFIG_ROCKCHIP_SPL_RESERVE_IRAM=0x0 CONFIG_SPL_DRIVERS_MISC=y CONFIG_TARGET_ROC_RK3308_CC=y CONFIG_SPL_STACK_R_ADDR=0xc00000 diff --git a/configs/rock-pi-s-rk3308_defconfig b/configs/rock-pi-s-rk3308_defconfig index cc3274a..8c13f7f 100644 --- a/configs/rock-pi-s-rk3308_defconfig +++ b/configs/rock-pi-s-rk3308_defconfig @@ -11,7 +11,6 @@ CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x800000 CONFIG_DEFAULT_DEVICE_TREE="rk3308-rock-pi-s" CONFIG_DM_RESET=y CONFIG_ROCKCHIP_RK3308=y -CONFIG_ROCKCHIP_SPL_RESERVE_IRAM=0x0 CONFIG_SPL_DRIVERS_MISC=y CONFIG_TARGET_EVB_RK3308=y CONFIG_SPL_STACK_R_ADDR=0xc00000 diff --git a/configs/sam9x60_curiosity_mmc1_defconfig b/configs/sam9x60_curiosity_mmc1_defconfig index 8f2f6d9..a2453701 100644 --- a/configs/sam9x60_curiosity_mmc1_defconfig +++ b/configs/sam9x60_curiosity_mmc1_defconfig @@ -13,6 +13,7 @@ CONFIG_ENV_SIZE=0x4000 CONFIG_DM_GPIO=y CONFIG_DEFAULT_DEVICE_TREE="at91-sam9x60_curiosity" CONFIG_OF_LIBFDT_OVERLAY=y +CONFIG_DM_RESET=y CONFIG_DEBUG_UART_BASE=0xfffff200 CONFIG_DEBUG_UART_CLOCK=200000000 CONFIG_DEBUG_UART_BOARD_INIT=y @@ -79,6 +80,7 @@ CONFIG_PHY_MICREL=y CONFIG_MACB=y CONFIG_PINCTRL=y CONFIG_PINCTRL_AT91=y +CONFIG_RESET_AT91=y CONFIG_DM_SERIAL=y CONFIG_DEBUG_UART_ANNOUNCE=y CONFIG_ATMEL_USART=y diff --git a/configs/sam9x60_curiosity_mmc_defconfig b/configs/sam9x60_curiosity_mmc_defconfig index 5999b5d..38ec241 100644 --- a/configs/sam9x60_curiosity_mmc_defconfig +++ b/configs/sam9x60_curiosity_mmc_defconfig @@ -13,6 +13,7 @@ CONFIG_ENV_SIZE=0x4000 CONFIG_DM_GPIO=y CONFIG_DEFAULT_DEVICE_TREE="at91-sam9x60_curiosity" CONFIG_OF_LIBFDT_OVERLAY=y +CONFIG_DM_RESET=y CONFIG_DEBUG_UART_BASE=0xfffff200 CONFIG_DEBUG_UART_CLOCK=200000000 CONFIG_DEBUG_UART_BOARD_INIT=y @@ -22,7 +23,7 @@ CONFIG_FIT=y CONFIG_SD_BOOT=y CONFIG_BOOTDELAY=3 CONFIG_USE_BOOTARGS=y -CONFIG_BOOTARGS="mem=128M console=ttyS0,115200 root=/dev/mmcblk0p2 rw rootfstype=ext4 rootwait" +CONFIG_BOOTARGS="console=ttyS0,115200 root=/dev/mmcblk0p2 rw rootwait" CONFIG_USE_BOOTCOMMAND=y CONFIG_BOOTCOMMAND="fatload mmc 0:1 0x21000000 at91-sam9x60_curiosity.dtb; fatload mmc 0:1 0x22000000 zImage; bootz 0x22000000 - 0x21000000" CONFIG_SYS_CONSOLE_IS_IN_ENV=y @@ -38,6 +39,8 @@ CONFIG_CMD_DM=y CONFIG_CMD_GPIO=y CONFIG_CMD_I2C=y CONFIG_CMD_MMC=y +CONFIG_CMD_NAND=y +CONFIG_CMD_NAND_TRIMFFS=y # CONFIG_CMD_SETEXPR is not set CONFIG_CMD_DHCP=y CONFIG_BOOTP_BOOTFILESIZE=y @@ -50,6 +53,8 @@ CONFIG_OF_CONTROL=y CONFIG_ENV_IS_IN_FAT=y CONFIG_ENV_FAT_DEVICE_AND_PART="0:1" CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_REGMAP=y +CONFIG_SYSCON=y CONFIG_CLK=y CONFIG_CLK_CCF=y CONFIG_CLK_AT91=y @@ -60,17 +65,27 @@ CONFIG_CPU=y CONFIG_AT91_GPIO=y CONFIG_DM_I2C=y CONFIG_SYS_I2C_AT91=y +CONFIG_ATMEL_EBI=y +CONFIG_MFD_ATMEL_SMC=y CONFIG_I2C_EEPROM=y CONFIG_MICROCHIP_FLEXCOM=y CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_ATMEL=y +CONFIG_MTD=y +CONFIG_DM_MTD=y +CONFIG_MTD_RAW_NAND=y +CONFIG_DM_NAND_ATMEL=y +CONFIG_SYS_NAND_ONFI_DETECTION=y CONFIG_PHY_MICREL=y CONFIG_MACB=y CONFIG_PINCTRL=y CONFIG_PINCTRL_AT91=y +CONFIG_RESET_AT91=y CONFIG_DM_SERIAL=y CONFIG_DEBUG_UART_ANNOUNCE=y CONFIG_ATMEL_USART=y +CONFIG_SYSRESET=y +CONFIG_SYSRESET_AT91=y CONFIG_TIMER=y CONFIG_MCHP_PIT64B_TIMER=y CONFIG_W1=y diff --git a/configs/sam9x60ek_mmc_defconfig b/configs/sam9x60ek_mmc_defconfig index 06680ac..7cb4ab1 100644 --- a/configs/sam9x60ek_mmc_defconfig +++ b/configs/sam9x60ek_mmc_defconfig @@ -14,6 +14,7 @@ CONFIG_ENV_SIZE=0x4000 CONFIG_DM_GPIO=y CONFIG_DEFAULT_DEVICE_TREE="sam9x60ek" CONFIG_OF_LIBFDT_OVERLAY=y +CONFIG_DM_RESET=y CONFIG_DEBUG_UART_BASE=0xfffff200 CONFIG_DEBUG_UART_CLOCK=200000000 CONFIG_DEBUG_UART_BOARD_INIT=y @@ -87,6 +88,7 @@ CONFIG_PHY_MICREL=y CONFIG_MACB=y CONFIG_PINCTRL=y CONFIG_PINCTRL_AT91=y +CONFIG_RESET_AT91=y CONFIG_DM_SERIAL=y CONFIG_DEBUG_UART_ANNOUNCE=y CONFIG_ATMEL_USART=y diff --git a/configs/sam9x60ek_nandflash_defconfig b/configs/sam9x60ek_nandflash_defconfig index fea200d..4bfd0e8 100644 --- a/configs/sam9x60ek_nandflash_defconfig +++ b/configs/sam9x60ek_nandflash_defconfig @@ -13,6 +13,7 @@ CONFIG_SF_DEFAULT_SPEED=50000000 CONFIG_DM_GPIO=y CONFIG_DEFAULT_DEVICE_TREE="sam9x60ek" CONFIG_OF_LIBFDT_OVERLAY=y +CONFIG_DM_RESET=y CONFIG_DEBUG_UART_BASE=0xfffff200 CONFIG_DEBUG_UART_CLOCK=200000000 CONFIG_DEBUG_UART_BOARD_INIT=y @@ -89,6 +90,7 @@ CONFIG_PHY_MICREL=y CONFIG_MACB=y CONFIG_PINCTRL=y CONFIG_PINCTRL_AT91=y +CONFIG_RESET_AT91=y CONFIG_DM_SERIAL=y CONFIG_DEBUG_UART_ANNOUNCE=y CONFIG_ATMEL_USART=y diff --git a/configs/sam9x60ek_qspiflash_defconfig b/configs/sam9x60ek_qspiflash_defconfig index a1f8c9f..c7224da 100644 --- a/configs/sam9x60ek_qspiflash_defconfig +++ b/configs/sam9x60ek_qspiflash_defconfig @@ -13,6 +13,7 @@ CONFIG_ENV_SECT_SIZE=0x1000 CONFIG_DM_GPIO=y CONFIG_DEFAULT_DEVICE_TREE="sam9x60ek" CONFIG_OF_LIBFDT_OVERLAY=y +CONFIG_DM_RESET=y CONFIG_DEBUG_UART_BASE=0xfffff200 CONFIG_DEBUG_UART_CLOCK=200000000 CONFIG_DEBUG_UART_BOARD_INIT=y @@ -88,6 +89,7 @@ CONFIG_PHY_MICREL=y CONFIG_MACB=y CONFIG_PINCTRL=y CONFIG_PINCTRL_AT91=y +CONFIG_RESET_AT91=y CONFIG_DM_SERIAL=y CONFIG_DEBUG_UART_ANNOUNCE=y CONFIG_ATMEL_USART=y diff --git a/configs/sama5d29_curiosity_mmc1_defconfig b/configs/sama5d29_curiosity_mmc1_defconfig new file mode 100644 index 0000000..c4ea11e --- /dev/null +++ b/configs/sama5d29_curiosity_mmc1_defconfig @@ -0,0 +1,120 @@ +CONFIG_ARM=y +CONFIG_SKIP_LOWLEVEL_INIT=y +CONFIG_ARCH_CPU_INIT=y +CONFIG_ARCH_AT91=y +CONFIG_TEXT_BASE=0x26f00000 +CONFIG_SYS_MALLOC_LEN=0x1000000 +CONFIG_SYS_MALLOC_F_LEN=0x40000 +CONFIG_TARGET_SAMA5D29_CURIOSITY=y +CONFIG_NR_DRAM_BANKS=1 +CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y +CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x20044000 +CONFIG_SF_DEFAULT_SPEED=50000000 +CONFIG_ENV_SIZE=0x4000 +CONFIG_DM_GPIO=y +CONFIG_DEFAULT_DEVICE_TREE="at91-sama5d29_curiosity" +CONFIG_OF_LIBFDT_OVERLAY=y +CONFIG_DM_RESET=y +CONFIG_DEBUG_UART_BASE=0xf801c000 +CONFIG_DEBUG_UART_CLOCK=82000000 +CONFIG_DEBUG_UART_BOARD_INIT=y +CONFIG_SYS_LOAD_ADDR=0x22000000 +CONFIG_DEBUG_UART=y +CONFIG_SYS_MEMTEST_START=0x20000000 +CONFIG_SYS_MEMTEST_END=0x30000000 +CONFIG_ENV_VARS_UBOOT_CONFIG=y +CONFIG_FIT=y +# CONFIG_BOOTSTD is not set +CONFIG_QSPI_BOOT=y +CONFIG_SD_BOOT=y +CONFIG_BOOTDELAY=3 +CONFIG_USE_BOOTARGS=y +CONFIG_BOOTARGS="console=ttyS0,115200 root=/dev/mmcblk1p2 rw rootwait" +CONFIG_USE_BOOTCOMMAND=y +CONFIG_BOOTCOMMAND="fatload mmc 1:1 0x21000000 at91-sama5d29_curiosity.dtb; fatload mmc 1:1 0x22000000 zImage; bootz 0x22000000 - 0x21000000" +CONFIG_BOARD_TYPES=y +CONFIG_DISPLAY_BOARDINFO_LATE=y +CONFIG_HUSH_PARSER=y +CONFIG_CMD_BOOTZ=y +CONFIG_SYS_BOOTM_LEN=0x2000000 +CONFIG_CMD_XXD=y +CONFIG_CMD_MEMINFO=y +CONFIG_CMD_MEM_SEARCH=y +CONFIG_CMD_MX_CYCLIC=y +CONFIG_CMD_MEMTEST=y +CONFIG_CMD_STRINGS=y +CONFIG_CMD_DM=y +# CONFIG_CMD_FLASH is not set +CONFIG_CMD_GPIO=y +CONFIG_CMD_LSBLK=y +CONFIG_CMD_MMC=y +CONFIG_CMD_MTD=y +CONFIG_CMD_SF_TEST=y +CONFIG_CMD_USB=y +CONFIG_CMD_CAT=y +CONFIG_CMD_RTC=y +CONFIG_CMD_TIME=y +CONFIG_CMD_TIMER=y +CONFIG_CMD_EXT4=y +CONFIG_CMD_EXT4_WRITE=y +CONFIG_CMD_FAT=y +CONFIG_CMD_FS_GENERIC=y +CONFIG_CMD_MTDPARTS=y +CONFIG_CMD_MTDPARTS_SPREAD=y +CONFIG_CMD_MTDPARTS_SHOW_NET_SIZES=y +CONFIG_MTDIDS_DEFAULT="nor0=nor0" +CONFIG_MTDPARTS_DEFAULT="mtdparts=nor0:256k(bootstrap)ro,1M(u-boot)ro,256k(env)ro,512k(dtb)ro,6M(kernel)ro" +CONFIG_OF_CONTROL=y +# CONFIG_OF_TAG_MIGRATE is not set +CONFIG_ENV_IS_IN_FAT=y +CONFIG_ENV_FAT_DEVICE_AND_PART="1:1" +CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_USE_HOSTNAME=y +CONFIG_HOSTNAME="SAMA5D29" +CONFIG_VERSION_VARIABLE=y +# CONFIG_NET is not set +CONFIG_CLK=y +CONFIG_CLK_AT91=y +CONFIG_AT91_UTMI=y +CONFIG_AT91_H32MX=y +CONFIG_AT91_GENERIC_CLK=y +CONFIG_ATMEL_PIO4=y +CONFIG_MMC_SDHCI=y +CONFIG_MMC_SDHCI_ATMEL=y +CONFIG_MTD=y +CONFIG_DM_MTD=y +CONFIG_DM_SPI_FLASH=y +CONFIG_SF_DEFAULT_BUS=2 +CONFIG_SPI_FLASH_SFDP_SUPPORT=y +CONFIG_SPI_FLASH_SST=y +# CONFIG_SPI_FLASH_USE_4K_SECTORS is not set +CONFIG_SPI_FLASH_MTD=y +CONFIG_PINCTRL=y +CONFIG_PINCTRL_AT91PIO4=y +CONFIG_RESET_AT91=y +CONFIG_DM_RTC=y +CONFIG_RTC_EMULATION=y +CONFIG_DM_SERIAL=y +CONFIG_DEBUG_UART_ANNOUNCE=y +CONFIG_ATMEL_USART=y +CONFIG_SPI=y +CONFIG_DM_SPI=y +CONFIG_ATMEL_QSPI=y +CONFIG_SYSRESET=y +CONFIG_SYSRESET_AT91=y +CONFIG_TIMER=y +CONFIG_ATMEL_TCB_TIMER=y +CONFIG_USB=y +CONFIG_USB_EHCI_HCD=y +CONFIG_USB_STORAGE=y +CONFIG_USB_GADGET=y +CONFIG_USB_GADGET_ATMEL_USBA=y +CONFIG_VIDEO=y +CONFIG_ATMEL_HLCD=y +CONFIG_W1=y +CONFIG_W1_GPIO=y +CONFIG_W1_EEPROM=y +CONFIG_W1_EEPROM_DS24XXX=y +CONFIG_FAT_WRITE=y +CONFIG_CMD_DHRYSTONE=y +# CONFIG_EFI_LOADER is not set diff --git a/configs/sama5d29_curiosity_mmc_defconfig b/configs/sama5d29_curiosity_mmc_defconfig new file mode 100644 index 0000000..23c9ef7 --- /dev/null +++ b/configs/sama5d29_curiosity_mmc_defconfig @@ -0,0 +1,119 @@ +CONFIG_ARM=y +CONFIG_SKIP_LOWLEVEL_INIT=y +CONFIG_ARCH_CPU_INIT=y +CONFIG_ARCH_AT91=y +CONFIG_TEXT_BASE=0x26f00000 +CONFIG_SYS_MALLOC_LEN=0x1000000 +CONFIG_SYS_MALLOC_F_LEN=0x40000 +CONFIG_TARGET_SAMA5D29_CURIOSITY=y +CONFIG_NR_DRAM_BANKS=1 +CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y +CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x20044000 +CONFIG_SF_DEFAULT_SPEED=50000000 +CONFIG_ENV_SIZE=0x4000 +CONFIG_DM_GPIO=y +CONFIG_DEFAULT_DEVICE_TREE="at91-sama5d29_curiosity" +CONFIG_OF_LIBFDT_OVERLAY=y +CONFIG_DM_RESET=y +CONFIG_DEBUG_UART_BASE=0xf801c000 +CONFIG_DEBUG_UART_CLOCK=82000000 +CONFIG_DEBUG_UART_BOARD_INIT=y +CONFIG_SYS_LOAD_ADDR=0x22000000 +CONFIG_DEBUG_UART=y +CONFIG_SYS_MEMTEST_START=0x20000000 +CONFIG_SYS_MEMTEST_END=0x30000000 +CONFIG_ENV_VARS_UBOOT_CONFIG=y +CONFIG_FIT=y +# CONFIG_BOOTSTD is not set +CONFIG_QSPI_BOOT=y +CONFIG_SD_BOOT=y +CONFIG_BOOTDELAY=3 +CONFIG_USE_BOOTARGS=y +CONFIG_BOOTARGS="console=ttyS0,115200 root=/dev/mmcblk0p2 rw rootwait" +CONFIG_USE_BOOTCOMMAND=y +CONFIG_BOOTCOMMAND="fatload mmc 0:1 0x21000000 at91-sama5d29_curiosity.dtb; fatload mmc 0:1 0x22000000 zImage; bootz 0x22000000 - 0x21000000" +CONFIG_BOARD_TYPES=y +CONFIG_DISPLAY_BOARDINFO_LATE=y +CONFIG_HUSH_PARSER=y +CONFIG_CMD_BOOTZ=y +CONFIG_SYS_BOOTM_LEN=0x2000000 +CONFIG_CMD_XXD=y +CONFIG_CMD_MEMINFO=y +CONFIG_CMD_MEM_SEARCH=y +CONFIG_CMD_MX_CYCLIC=y +CONFIG_CMD_MEMTEST=y +CONFIG_CMD_STRINGS=y +CONFIG_CMD_DM=y +# CONFIG_CMD_FLASH is not set +CONFIG_CMD_GPIO=y +CONFIG_CMD_LSBLK=y +CONFIG_CMD_MMC=y +CONFIG_CMD_MTD=y +CONFIG_CMD_SF_TEST=y +CONFIG_CMD_USB=y +CONFIG_CMD_CAT=y +CONFIG_CMD_RTC=y +CONFIG_CMD_TIME=y +CONFIG_CMD_TIMER=y +CONFIG_CMD_EXT4=y +CONFIG_CMD_EXT4_WRITE=y +CONFIG_CMD_FAT=y +CONFIG_CMD_FS_GENERIC=y +CONFIG_CMD_MTDPARTS=y +CONFIG_CMD_MTDPARTS_SPREAD=y +CONFIG_CMD_MTDPARTS_SHOW_NET_SIZES=y +CONFIG_MTDIDS_DEFAULT="nor0=nor0" +CONFIG_MTDPARTS_DEFAULT="mtdparts=nor0:256k(bootstrap)ro,1M(u-boot)ro,256k(env)ro,512k(dtb)ro,6M(kernel)ro" +CONFIG_OF_CONTROL=y +# CONFIG_OF_TAG_MIGRATE is not set +CONFIG_ENV_IS_IN_FAT=y +CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_USE_HOSTNAME=y +CONFIG_HOSTNAME="SAMA5D29" +CONFIG_VERSION_VARIABLE=y +# CONFIG_NET is not set +CONFIG_CLK=y +CONFIG_CLK_AT91=y +CONFIG_AT91_UTMI=y +CONFIG_AT91_H32MX=y +CONFIG_AT91_GENERIC_CLK=y +CONFIG_ATMEL_PIO4=y +CONFIG_MMC_SDHCI=y +CONFIG_MMC_SDHCI_ATMEL=y +CONFIG_MTD=y +CONFIG_DM_MTD=y +CONFIG_DM_SPI_FLASH=y +CONFIG_SF_DEFAULT_BUS=2 +CONFIG_SPI_FLASH_SFDP_SUPPORT=y +CONFIG_SPI_FLASH_SST=y +# CONFIG_SPI_FLASH_USE_4K_SECTORS is not set +CONFIG_SPI_FLASH_MTD=y +CONFIG_PINCTRL=y +CONFIG_PINCTRL_AT91PIO4=y +CONFIG_RESET_AT91=y +CONFIG_DM_RTC=y +CONFIG_RTC_EMULATION=y +CONFIG_DM_SERIAL=y +CONFIG_DEBUG_UART_ANNOUNCE=y +CONFIG_ATMEL_USART=y +CONFIG_SPI=y +CONFIG_DM_SPI=y +CONFIG_ATMEL_QSPI=y +CONFIG_SYSRESET=y +CONFIG_SYSRESET_AT91=y +CONFIG_TIMER=y +CONFIG_ATMEL_TCB_TIMER=y +CONFIG_USB=y +CONFIG_USB_EHCI_HCD=y +CONFIG_USB_STORAGE=y +CONFIG_USB_GADGET=y +CONFIG_USB_GADGET_ATMEL_USBA=y +CONFIG_VIDEO=y +CONFIG_ATMEL_HLCD=y +CONFIG_W1=y +CONFIG_W1_GPIO=y +CONFIG_W1_EEPROM=y +CONFIG_W1_EEPROM_DS24XXX=y +CONFIG_FAT_WRITE=y +CONFIG_CMD_DHRYSTONE=y +# CONFIG_EFI_LOADER is not set diff --git a/configs/sama5d29_curiosity_qspiflash_defconfig b/configs/sama5d29_curiosity_qspiflash_defconfig new file mode 100644 index 0000000..7b8baf1 --- /dev/null +++ b/configs/sama5d29_curiosity_qspiflash_defconfig @@ -0,0 +1,119 @@ +CONFIG_ARM=y +CONFIG_SKIP_LOWLEVEL_INIT=y +CONFIG_ARCH_CPU_INIT=y +CONFIG_ARCH_AT91=y +CONFIG_TEXT_BASE=0x26f00000 +CONFIG_SYS_MALLOC_LEN=0x1000000 +CONFIG_SYS_MALLOC_F_LEN=0x40000 +CONFIG_TARGET_SAMA5D29_CURIOSITY=y +CONFIG_NR_DRAM_BANKS=1 +CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y +CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x20044000 +CONFIG_SF_DEFAULT_SPEED=50000000 +CONFIG_ENV_SIZE=0x4000 +CONFIG_DM_GPIO=y +CONFIG_DEFAULT_DEVICE_TREE="at91-sama5d29_curiosity" +CONFIG_OF_LIBFDT_OVERLAY=y +CONFIG_DM_RESET=y +CONFIG_DEBUG_UART_BASE=0xf801c000 +CONFIG_DEBUG_UART_CLOCK=82000000 +CONFIG_DEBUG_UART_BOARD_INIT=y +CONFIG_SYS_LOAD_ADDR=0x22000000 +CONFIG_DEBUG_UART=y +CONFIG_SYS_MEMTEST_START=0x20000000 +CONFIG_SYS_MEMTEST_END=0x30000000 +CONFIG_ENV_VARS_UBOOT_CONFIG=y +CONFIG_FIT=y +# CONFIG_BOOTSTD is not set +CONFIG_QSPI_BOOT=y +CONFIG_SD_BOOT=y +CONFIG_BOOTDELAY=3 +CONFIG_USE_BOOTARGS=y +CONFIG_BOOTARGS="console=ttyS0,115200 root=/dev/mmcblk0p2 rw rootwait" +CONFIG_USE_BOOTCOMMAND=y +CONFIG_BOOTCOMMAND="sf probe 0; sf read 0x21000000 0x180000 0x80000; sf read 0x22000000 0x200000 0x600000; bootz 0x22000000 - 0x21000000" +CONFIG_BOARD_TYPES=y +CONFIG_DISPLAY_BOARDINFO_LATE=y +CONFIG_HUSH_PARSER=y +CONFIG_CMD_BOOTZ=y +CONFIG_SYS_BOOTM_LEN=0x2000000 +CONFIG_CMD_XXD=y +CONFIG_CMD_MEMINFO=y +CONFIG_CMD_MEM_SEARCH=y +CONFIG_CMD_MX_CYCLIC=y +CONFIG_CMD_MEMTEST=y +CONFIG_CMD_STRINGS=y +CONFIG_CMD_DM=y +# CONFIG_CMD_FLASH is not set +CONFIG_CMD_GPIO=y +CONFIG_CMD_LSBLK=y +CONFIG_CMD_MMC=y +CONFIG_CMD_MTD=y +CONFIG_CMD_SF_TEST=y +CONFIG_CMD_USB=y +CONFIG_CMD_CAT=y +CONFIG_CMD_RTC=y +CONFIG_CMD_TIME=y +CONFIG_CMD_TIMER=y +CONFIG_CMD_EXT4=y +CONFIG_CMD_EXT4_WRITE=y +CONFIG_CMD_FAT=y +CONFIG_CMD_FS_GENERIC=y +CONFIG_CMD_MTDPARTS=y +CONFIG_CMD_MTDPARTS_SPREAD=y +CONFIG_CMD_MTDPARTS_SHOW_NET_SIZES=y +CONFIG_MTDIDS_DEFAULT="nor0=nor0" +CONFIG_MTDPARTS_DEFAULT="mtdparts=nor0:256k(bootstrap)ro,1M(u-boot)ro,256k(env)ro,512k(dtb)ro,6M(kernel)ro" +CONFIG_OF_CONTROL=y +# CONFIG_OF_TAG_MIGRATE is not set +CONFIG_ENV_IS_IN_SPI_FLASH=y +CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_USE_HOSTNAME=y +CONFIG_HOSTNAME="SAMA5D29" +CONFIG_VERSION_VARIABLE=y +# CONFIG_NET is not set +CONFIG_CLK=y +CONFIG_CLK_AT91=y +CONFIG_AT91_UTMI=y +CONFIG_AT91_H32MX=y +CONFIG_AT91_GENERIC_CLK=y +CONFIG_ATMEL_PIO4=y +CONFIG_MMC_SDHCI=y +CONFIG_MMC_SDHCI_ATMEL=y +CONFIG_MTD=y +CONFIG_DM_MTD=y +CONFIG_DM_SPI_FLASH=y +CONFIG_SF_DEFAULT_BUS=2 +CONFIG_SPI_FLASH_SFDP_SUPPORT=y +CONFIG_SPI_FLASH_SST=y +# CONFIG_SPI_FLASH_USE_4K_SECTORS is not set +CONFIG_SPI_FLASH_MTD=y +CONFIG_PINCTRL=y +CONFIG_PINCTRL_AT91PIO4=y +CONFIG_RESET_AT91=y +CONFIG_DM_RTC=y +CONFIG_RTC_EMULATION=y +CONFIG_DM_SERIAL=y +CONFIG_DEBUG_UART_ANNOUNCE=y +CONFIG_ATMEL_USART=y +CONFIG_SPI=y +CONFIG_DM_SPI=y +CONFIG_ATMEL_QSPI=y +CONFIG_SYSRESET=y +CONFIG_SYSRESET_AT91=y +CONFIG_TIMER=y +CONFIG_ATMEL_TCB_TIMER=y +CONFIG_USB=y +CONFIG_USB_EHCI_HCD=y +CONFIG_USB_STORAGE=y +CONFIG_USB_GADGET=y +CONFIG_USB_GADGET_ATMEL_USBA=y +CONFIG_VIDEO=y +CONFIG_ATMEL_HLCD=y +CONFIG_W1=y +CONFIG_W1_GPIO=y +CONFIG_W1_EEPROM=y +CONFIG_W1_EEPROM_DS24XXX=y +CONFIG_FAT_WRITE=y +CONFIG_CMD_DHRYSTONE=y +# CONFIG_EFI_LOADER is not set diff --git a/configs/sandbox64_defconfig b/configs/sandbox64_defconfig index 138a99b..5e199da 100644 --- a/configs/sandbox64_defconfig +++ b/configs/sandbox64_defconfig @@ -4,7 +4,6 @@ CONFIG_ENV_SIZE=0x2000 CONFIG_DEFAULT_DEVICE_TREE="sandbox64" CONFIG_DM_RESET=y CONFIG_PRE_CON_BUF_ADDR=0x100000 -CONFIG_BOOTSTAGE_STASH_ADDR=0x0 CONFIG_SYS_LOAD_ADDR=0x0 CONFIG_PCI=y CONFIG_SANDBOX64=y @@ -14,6 +13,7 @@ CONFIG_SYS_MEMTEST_END=0x00101000 CONFIG_FIT=y CONFIG_FIT_SIGNATURE=y CONFIG_FIT_VERBOSE=y +CONFIG_LEGACY_IMAGE_FORMAT=y CONFIG_DISTRO_DEFAULTS=y CONFIG_BOOTSTAGE=y CONFIG_BOOTSTAGE_REPORT=y @@ -237,6 +237,7 @@ CONFIG_TIMER=y CONFIG_TIMER_EARLY=y CONFIG_SANDBOX_TIMER=y CONFIG_USB=y +CONFIG_DM_USB_GADGET=y CONFIG_USB_EMUL=y CONFIG_USB_KEYBOARD=y CONFIG_VIDEO=y diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig index 62bc182..6144787 100644 --- a/configs/sandbox_defconfig +++ b/configs/sandbox_defconfig @@ -4,7 +4,6 @@ CONFIG_ENV_SIZE=0x2000 CONFIG_DEFAULT_DEVICE_TREE="sandbox" CONFIG_DM_RESET=y CONFIG_PRE_CON_BUF_ADDR=0xf0000 -CONFIG_BOOTSTAGE_STASH_ADDR=0x0 CONFIG_SYS_LOAD_ADDR=0x0 CONFIG_PCI=y CONFIG_DEBUG_UART=y @@ -227,11 +226,13 @@ CONFIG_SPI_FLASH_SPANSION=y CONFIG_SPI_FLASH_STMICRO=y CONFIG_SPI_FLASH_SST=y CONFIG_SPI_FLASH_WINBOND=y +CONFIG_NVMXIP_QSPI=y CONFIG_MULTIPLEXER=y CONFIG_MUX_MMIO=y CONFIG_NVME_PCI=y CONFIG_PCI_REGION_MULTI_ENTRY=y CONFIG_PCI_SANDBOX=y +CONFIG_PCI_FTPCI100=y CONFIG_PHY=y CONFIG_PHY_SANDBOX=y CONFIG_PINCTRL=y @@ -298,6 +299,7 @@ CONFIG_TIMER=y CONFIG_TIMER_EARLY=y CONFIG_SANDBOX_TIMER=y CONFIG_USB=y +CONFIG_DM_USB_GADGET=y CONFIG_USB_EMUL=y CONFIG_USB_KEYBOARD=y CONFIG_USB_GADGET=y @@ -340,6 +342,7 @@ CONFIG_EFI_RUNTIME_UPDATE_CAPSULE=y CONFIG_EFI_CAPSULE_ON_DISK=y CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y CONFIG_EFI_CAPSULE_AUTHENTICATE=y +CONFIG_EFI_CAPSULE_ESL_FILE="board/sandbox/capsule_pub_esl_good.esl" CONFIG_EFI_SECURE_BOOT=y CONFIG_TEST_FDTDEC=y CONFIG_UNIT_TEST=y diff --git a/configs/sandbox_flattree_defconfig b/configs/sandbox_flattree_defconfig index 8aa2956..29ae453 100644 --- a/configs/sandbox_flattree_defconfig +++ b/configs/sandbox_flattree_defconfig @@ -3,7 +3,6 @@ CONFIG_NR_DRAM_BANKS=1 CONFIG_ENV_SIZE=0x2000 CONFIG_DEFAULT_DEVICE_TREE="sandbox" CONFIG_DM_RESET=y -CONFIG_BOOTSTAGE_STASH_ADDR=0x0 CONFIG_SYS_LOAD_ADDR=0x0 CONFIG_PCI=y CONFIG_DEBUG_UART=y @@ -204,6 +203,7 @@ CONFIG_TIMER=y CONFIG_TIMER_EARLY=y CONFIG_SANDBOX_TIMER=y CONFIG_USB=y +CONFIG_DM_USB_GADGET=y CONFIG_USB_EMUL=y CONFIG_USB_KEYBOARD=y CONFIG_VIDEO=y @@ -227,6 +227,7 @@ CONFIG_EFI_RUNTIME_UPDATE_CAPSULE=y CONFIG_EFI_CAPSULE_ON_DISK=y CONFIG_EFI_CAPSULE_FIRMWARE_FIT=y CONFIG_EFI_CAPSULE_AUTHENTICATE=y +CONFIG_EFI_CAPSULE_ESL_FILE="board/sandbox/capsule_pub_esl_good.esl" CONFIG_UNIT_TEST=y CONFIG_UT_TIME=y CONFIG_UT_DM=y diff --git a/configs/sandbox_noinst_defconfig b/configs/sandbox_noinst_defconfig index 2c6aab6..d39e54f 100644 --- a/configs/sandbox_noinst_defconfig +++ b/configs/sandbox_noinst_defconfig @@ -10,7 +10,6 @@ CONFIG_SPL_SERIAL=y CONFIG_SPL_DRIVERS_MISC=y CONFIG_SPL_SYS_MALLOC_F_LEN=0x8000 CONFIG_SPL=y -CONFIG_BOOTSTAGE_STASH_ADDR=0x0 CONFIG_SYS_LOAD_ADDR=0x0 CONFIG_PCI=y CONFIG_SANDBOX_SPL=y @@ -218,6 +217,7 @@ CONFIG_TIMER=y CONFIG_TIMER_EARLY=y CONFIG_SANDBOX_TIMER=y CONFIG_USB=y +CONFIG_DM_USB_GADGET=y CONFIG_USB_EMUL=y CONFIG_USB_KEYBOARD=y CONFIG_VIDEO=y @@ -237,6 +237,8 @@ CONFIG_TPM=y CONFIG_LZ4=y CONFIG_ZSTD=y CONFIG_ERRNO_STR=y +CONFIG_EFI_CAPSULE_ON_DISK=y +CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y CONFIG_UNIT_TEST=y CONFIG_SPL_UNIT_TEST=y CONFIG_UT_TIME=y diff --git a/configs/sandbox_spl_defconfig b/configs/sandbox_spl_defconfig index 8d50162..4a67af2 100644 --- a/configs/sandbox_spl_defconfig +++ b/configs/sandbox_spl_defconfig @@ -10,7 +10,6 @@ CONFIG_SPL_SERIAL=y CONFIG_SPL_DRIVERS_MISC=y CONFIG_SPL_SYS_MALLOC_F_LEN=0x8000 CONFIG_SPL=y -CONFIG_BOOTSTAGE_STASH_ADDR=0x0 CONFIG_SYS_LOAD_ADDR=0x0 CONFIG_PCI=y CONFIG_SANDBOX_SPL=y @@ -224,6 +223,7 @@ CONFIG_TIMER=y CONFIG_TIMER_EARLY=y CONFIG_SANDBOX_TIMER=y CONFIG_USB=y +CONFIG_DM_USB_GADGET=y CONFIG_USB_EMUL=y CONFIG_USB_KEYBOARD=y CONFIG_VIDEO=y @@ -245,6 +245,8 @@ CONFIG_LZ4=y CONFIG_ZSTD=y CONFIG_ERRNO_STR=y CONFIG_SPL_HEXDUMP=y +CONFIG_EFI_CAPSULE_ON_DISK=y +CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y CONFIG_UNIT_TEST=y CONFIG_SPL_UNIT_TEST=y CONFIG_UT_TIME=y diff --git a/configs/sandbox_vpl_defconfig b/configs/sandbox_vpl_defconfig index f3a0fd1..8d76f19 100644 --- a/configs/sandbox_vpl_defconfig +++ b/configs/sandbox_vpl_defconfig @@ -15,7 +15,6 @@ CONFIG_TPL_SERIAL=y CONFIG_SPL_DRIVERS_MISC=y CONFIG_SPL_SYS_MALLOC_F_LEN=0x8000 CONFIG_SPL=y -CONFIG_BOOTSTAGE_STASH_ADDR=0x0 CONFIG_SYS_LOAD_ADDR=0x0 CONFIG_PCI=y CONFIG_SANDBOX_SPL=y @@ -237,6 +236,7 @@ CONFIG_VPL_TIMER=y CONFIG_TIMER_EARLY=y CONFIG_SANDBOX_TIMER=y CONFIG_USB=y +CONFIG_DM_USB_GADGET=y CONFIG_USB_EMUL=y CONFIG_USB_KEYBOARD=y CONFIG_VIDEO=y @@ -256,6 +256,8 @@ CONFIG_LZ4=y CONFIG_ZSTD=y # CONFIG_VPL_LZMA is not set CONFIG_ERRNO_STR=y +CONFIG_EFI_CAPSULE_ON_DISK=y +CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y CONFIG_UNIT_TEST=y CONFIG_SPL_UNIT_TEST=y CONFIG_UT_TIME=y diff --git a/configs/snow_defconfig b/configs/snow_defconfig index 3c43000..32195cf 100644 --- a/configs/snow_defconfig +++ b/configs/snow_defconfig @@ -28,6 +28,7 @@ CONFIG_DEBUG_UART=y CONFIG_FIT=y CONFIG_FIT_BEST_MATCH=y CONFIG_BOOTSTD_FULL=y +CONFIG_BOOTMETH_CROS=y CONFIG_DISTRO_DEFAULTS=y CONFIG_SILENT_CONSOLE=y CONFIG_BLOBLIST=y diff --git a/configs/som-db5800-som-6867_defconfig b/configs/som-db5800-som-6867_defconfig index 4a14913..44db482 100644 --- a/configs/som-db5800-som-6867_defconfig +++ b/configs/som-db5800-som-6867_defconfig @@ -27,7 +27,6 @@ CONFIG_USE_BOOTCOMMAND=y CONFIG_BOOTCOMMAND="ext2load scsi 0:3 01000000 /boot/vmlinuz; zboot 01000000" CONFIG_SYS_CONSOLE_INFO_QUIET=y CONFIG_DISPLAY_BOARDINFO_LATE=y -CONFIG_LAST_STAGE_INIT=y CONFIG_HUSH_PARSER=y CONFIG_SYS_PBSIZE=532 CONFIG_CMD_CPU=y diff --git a/configs/theadorable-x86-conga-qa3-e3845-pcie-x4_defconfig b/configs/theadorable-x86-conga-qa3-e3845-pcie-x4_defconfig index 69499e1..c5bd0d9 100644 --- a/configs/theadorable-x86-conga-qa3-e3845-pcie-x4_defconfig +++ b/configs/theadorable-x86-conga-qa3-e3845-pcie-x4_defconfig @@ -26,7 +26,6 @@ CONFIG_SHOW_BOOT_PROGRESS=y CONFIG_USE_PREBOOT=y CONFIG_SYS_CONSOLE_INFO_QUIET=y CONFIG_DISPLAY_BOARDINFO_LATE=y -CONFIG_LAST_STAGE_INIT=y CONFIG_HUSH_PARSER=y CONFIG_SYS_PBSIZE=532 CONFIG_CMD_CPU=y diff --git a/configs/theadorable-x86-conga-qa3-e3845_defconfig b/configs/theadorable-x86-conga-qa3-e3845_defconfig index e2e64b7..b3afaf3 100644 --- a/configs/theadorable-x86-conga-qa3-e3845_defconfig +++ b/configs/theadorable-x86-conga-qa3-e3845_defconfig @@ -25,7 +25,6 @@ CONFIG_SHOW_BOOT_PROGRESS=y CONFIG_USE_PREBOOT=y CONFIG_SYS_CONSOLE_INFO_QUIET=y CONFIG_DISPLAY_BOARDINFO_LATE=y -CONFIG_LAST_STAGE_INIT=y CONFIG_HUSH_PARSER=y CONFIG_SYS_PBSIZE=532 CONFIG_CMD_CPU=y diff --git a/configs/theadorable-x86-dfi-bt700_defconfig b/configs/theadorable-x86-dfi-bt700_defconfig index 751ae34..8222697 100644 --- a/configs/theadorable-x86-dfi-bt700_defconfig +++ b/configs/theadorable-x86-dfi-bt700_defconfig @@ -24,7 +24,6 @@ CONFIG_SHOW_BOOT_PROGRESS=y CONFIG_USE_PREBOOT=y CONFIG_SYS_CONSOLE_INFO_QUIET=y CONFIG_DISPLAY_BOARDINFO_LATE=y -CONFIG_LAST_STAGE_INIT=y CONFIG_HUSH_PARSER=y CONFIG_SYS_PBSIZE=532 CONFIG_CMD_CPU=y diff --git a/configs/xilinx_versal_mini_defconfig b/configs/xilinx_versal_mini_defconfig index fdb77b1..d6d6dc1 100644 --- a/configs/xilinx_versal_mini_defconfig +++ b/configs/xilinx_versal_mini_defconfig @@ -20,8 +20,6 @@ CONFIG_SYS_MEMTEST_END=0x00001000 CONFIG_REMAKE_ELF=y # CONFIG_LEGACY_IMAGE_FORMAT is not set # CONFIG_AUTOBOOT is not set -CONFIG_USE_BOOTCOMMAND=y -CONFIG_BOOTCOMMAND="run distro_bootcmd" CONFIG_SYS_CONSOLE_INFO_QUIET=y # CONFIG_DISPLAY_CPUINFO is not set CONFIG_BOARD_EARLY_INIT_R=y diff --git a/configs/xilinx_versal_mini_emmc0_defconfig b/configs/xilinx_versal_mini_emmc0_defconfig index ed1d3a5..858bb35 100644 --- a/configs/xilinx_versal_mini_emmc0_defconfig +++ b/configs/xilinx_versal_mini_emmc0_defconfig @@ -16,8 +16,6 @@ CONFIG_SYS_LOAD_ADDR=0x8000000 # CONFIG_EXPERT is not set CONFIG_REMAKE_ELF=y # CONFIG_AUTOBOOT is not set -CONFIG_USE_BOOTCOMMAND=y -CONFIG_BOOTCOMMAND="run distro_bootcmd" CONFIG_SYS_CONSOLE_INFO_QUIET=y # CONFIG_DISPLAY_CPUINFO is not set CONFIG_BOARD_EARLY_INIT_R=y diff --git a/configs/xilinx_versal_mini_emmc1_defconfig b/configs/xilinx_versal_mini_emmc1_defconfig index bdfa8dc..2488ede 100644 --- a/configs/xilinx_versal_mini_emmc1_defconfig +++ b/configs/xilinx_versal_mini_emmc1_defconfig @@ -16,8 +16,6 @@ CONFIG_SYS_LOAD_ADDR=0x8000000 # CONFIG_EXPERT is not set CONFIG_REMAKE_ELF=y # CONFIG_AUTOBOOT is not set -CONFIG_USE_BOOTCOMMAND=y -CONFIG_BOOTCOMMAND="run distro_bootcmd" CONFIG_SYS_CONSOLE_INFO_QUIET=y # CONFIG_DISPLAY_CPUINFO is not set CONFIG_BOARD_EARLY_INIT_R=y diff --git a/configs/xilinx_versal_net_virt_defconfig b/configs/xilinx_versal_net_virt_defconfig index 77137db..fc0bb2c 100644 --- a/configs/xilinx_versal_net_virt_defconfig +++ b/configs/xilinx_versal_net_virt_defconfig @@ -32,6 +32,7 @@ CONFIG_CMD_GREPENV=y CONFIG_CMD_NVEDIT_EFI=y CONFIG_CMD_MEMTEST=y CONFIG_SYS_ALT_MEMTEST=y +CONFIG_CMD_SHA1SUM=y CONFIG_CMD_CLK=y CONFIG_CMD_DFU=y CONFIG_CMD_DM=y @@ -49,8 +50,10 @@ CONFIG_CMD_CACHE=y CONFIG_CMD_EFIDEBUG=y CONFIG_CMD_TIME=y CONFIG_CMD_RNG=y +CONFIG_CMD_KASLRSEED=y CONFIG_CMD_TIMER=y CONFIG_CMD_SMC=y +CONFIG_CMD_TPM=y CONFIG_CMD_EXT4_WRITE=y CONFIG_CMD_SQUASHFS=y CONFIG_CMD_MTDPARTS=y @@ -77,7 +80,6 @@ CONFIG_DM_MAILBOX=y CONFIG_ZYNQMP_IPI=y CONFIG_MISC=y CONFIG_I2C_EEPROM=y -CONFIG_SYS_I2C_EEPROM_ADDR=0x0 CONFIG_SUPPORT_EMMC_BOOT=y CONFIG_MMC_IO_VOLTAGE=y CONFIG_MMC_UHS_SUPPORT=y @@ -110,7 +112,6 @@ CONFIG_ZYNQ_GEM=y CONFIG_POWER_DOMAIN=y CONFIG_ZYNQMP_POWER_DOMAIN=y CONFIG_RESET_ZYNQMP=y -CONFIG_DM_RNG=y CONFIG_ARM_DCC=y CONFIG_PL01X_SERIAL=y CONFIG_XILINX_UARTLITE=y @@ -122,6 +123,7 @@ CONFIG_CADENCE_QSPI=y CONFIG_CADENCE_OSPI_VERSAL=y CONFIG_ZYNQ_SPI=y CONFIG_ZYNQMP_GQSPI=y +CONFIG_TPM2_TIS_SPI=y CONFIG_USB=y CONFIG_DM_USB_GADGET=y CONFIG_USB_XHCI_HCD=y @@ -139,3 +141,4 @@ CONFIG_USB_FUNCTION_THOR=y CONFIG_VIRTIO_MMIO=y CONFIG_VIRTIO_NET=y CONFIG_VIRTIO_BLK=y +CONFIG_TPM=y diff --git a/configs/xilinx_versal_virt_defconfig b/configs/xilinx_versal_virt_defconfig index b13bead..388471d 100644 --- a/configs/xilinx_versal_virt_defconfig +++ b/configs/xilinx_versal_virt_defconfig @@ -5,6 +5,7 @@ CONFIG_SYS_INIT_SP_BSS_OFFSET=1572864 CONFIG_ARCH_VERSAL=y CONFIG_TEXT_BASE=0x8000000 CONFIG_SYS_MALLOC_F_LEN=0x100000 +CONFIG_NR_DRAM_BANKS=36 CONFIG_DEFAULT_DEVICE_TREE="xilinx-versal-virt" CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_DM_RESET=y @@ -32,6 +33,7 @@ CONFIG_CMD_GREPENV=y CONFIG_CMD_NVEDIT_EFI=y CONFIG_CMD_MEMTEST=y CONFIG_SYS_ALT_MEMTEST=y +CONFIG_CMD_SHA1SUM=y CONFIG_CMD_CLK=y CONFIG_CMD_DFU=y CONFIG_CMD_DM=y @@ -49,8 +51,10 @@ CONFIG_CMD_CACHE=y CONFIG_CMD_EFIDEBUG=y CONFIG_CMD_TIME=y CONFIG_CMD_RNG=y +CONFIG_CMD_KASLRSEED=y CONFIG_CMD_TIMER=y CONFIG_CMD_SMC=y +CONFIG_CMD_TPM=y CONFIG_CMD_EXT4_WRITE=y CONFIG_CMD_SQUASHFS=y CONFIG_CMD_MTDPARTS=y @@ -114,7 +118,6 @@ CONFIG_ZYNQ_GEM=y CONFIG_POWER_DOMAIN=y CONFIG_ZYNQMP_POWER_DOMAIN=y CONFIG_RESET_ZYNQMP=y -CONFIG_DM_RNG=y CONFIG_ARM_DCC=y CONFIG_PL01X_SERIAL=y CONFIG_XILINX_UARTLITE=y @@ -127,6 +130,7 @@ CONFIG_CQSPI_REF_CLK=200000000 CONFIG_CADENCE_OSPI_VERSAL=y CONFIG_ZYNQ_SPI=y CONFIG_ZYNQMP_GQSPI=y +CONFIG_TPM2_TIS_SPI=y CONFIG_USB=y CONFIG_DM_USB_GADGET=y CONFIG_USB_XHCI_HCD=y @@ -144,3 +148,4 @@ CONFIG_USB_FUNCTION_THOR=y CONFIG_VIRTIO_MMIO=y CONFIG_VIRTIO_NET=y CONFIG_VIRTIO_BLK=y +CONFIG_TPM=y diff --git a/configs/xilinx_zynqmp_virt_defconfig b/configs/xilinx_zynqmp_virt_defconfig index acab38f..30e4209 100644 --- a/configs/xilinx_zynqmp_virt_defconfig +++ b/configs/xilinx_zynqmp_virt_defconfig @@ -11,13 +11,11 @@ CONFIG_DM_RESET=y CONFIG_SPL_STACK_R_ADDR=0x18000000 CONFIG_SPL_STACK=0xfffffffc CONFIG_SPL_SIZE_LIMIT=0x2a000 -CONFIG_SPL_SIZE_LIMIT_PROVIDE_STACK=0x0 CONFIG_SPL=y CONFIG_ENV_OFFSET_REDUND=0x1E80000 CONFIG_SPL_SPI_FLASH_SUPPORT=y CONFIG_SPL_SPI=y CONFIG_CMD_FRU=y -CONFIG_ZYNQMP_USB=y CONFIG_SYS_LOAD_ADDR=0x8000000 CONFIG_AHCI=y CONFIG_SYS_MEMTEST_START=0x00000000 @@ -91,6 +89,7 @@ CONFIG_CMD_RTC=y CONFIG_CMD_TIME=y CONFIG_CMD_GETTIME=y CONFIG_CMD_RNG=y +CONFIG_CMD_KASLRSEED=y CONFIG_CMD_TIMER=y CONFIG_CMD_REGULATOR=y CONFIG_CMD_SMC=y diff --git a/disk/disk-uclass.c b/disk/disk-uclass.c index d32747e..efe4bf1 100644 --- a/disk/disk-uclass.c +++ b/disk/disk-uclass.c @@ -17,227 +17,110 @@ #include <dm/device-internal.h> #include <dm/lists.h> -int part_create_block_devices(struct udevice *blk_dev) -{ - int part, count; - struct blk_desc *desc = dev_get_uclass_plat(blk_dev); - struct disk_partition info; - struct disk_part *part_data; - char devname[32]; - struct udevice *dev; - int ret; - - if (!CONFIG_IS_ENABLED(PARTITIONS) || !blk_enabled()) - return 0; - - if (device_get_uclass_id(blk_dev) != UCLASS_BLK) - return 0; - - /* Add devices for each partition */ - for (count = 0, part = 1; part <= MAX_SEARCH_PARTITIONS; part++) { - if (part_get_info(desc, part, &info)) - continue; - snprintf(devname, sizeof(devname), "%s:%d", blk_dev->name, - part); - - ret = device_bind_driver(blk_dev, "blk_partition", - strdup(devname), &dev); - if (ret) - return ret; - - part_data = dev_get_uclass_plat(dev); - part_data->partnum = part; - part_data->gpt_part_info = info; - count++; - - ret = device_probe(dev); - if (ret) { - debug("Can't probe\n"); - count--; - device_unbind(dev); - - continue; - } - } - debug("%s: %d partitions found in %s\n", __func__, count, - blk_dev->name); - - return 0; -} - -static ulong part_blk_read(struct udevice *dev, lbaint_t start, - lbaint_t blkcnt, void *buffer) -{ - struct udevice *parent; - struct disk_part *part; - const struct blk_ops *ops; - - parent = dev_get_parent(dev); - ops = blk_get_ops(parent); - if (!ops->read) - return -ENOSYS; - - part = dev_get_uclass_plat(dev); - if (start >= part->gpt_part_info.size) - return 0; - - if ((start + blkcnt) > part->gpt_part_info.size) - blkcnt = part->gpt_part_info.size - start; - start += part->gpt_part_info.start; - - return ops->read(parent, start, blkcnt, buffer); -} - -static ulong part_blk_write(struct udevice *dev, lbaint_t start, - lbaint_t blkcnt, const void *buffer) +/** + * disk_blk_part_validate() - Check whether access to partition is within limits + * + * @dev: Device (partition udevice) + * @start: Start block for the access(from start of partition) + * @blkcnt: Number of blocks to access (within the partition) + * @return 0 on valid block range, or -ve on error. + */ +static int disk_blk_part_validate(struct udevice *dev, lbaint_t start, lbaint_t blkcnt) { - struct udevice *parent; - struct disk_part *part; - const struct blk_ops *ops; + struct disk_part *part = dev_get_uclass_plat(dev); - parent = dev_get_parent(dev); - ops = blk_get_ops(parent); - if (!ops->write) + if (device_get_uclass_id(dev) != UCLASS_PARTITION) return -ENOSYS; - part = dev_get_uclass_plat(dev); if (start >= part->gpt_part_info.size) - return 0; + return -E2BIG; if ((start + blkcnt) > part->gpt_part_info.size) - blkcnt = part->gpt_part_info.size - start; - start += part->gpt_part_info.start; + return -ERANGE; - return ops->write(parent, start, blkcnt, buffer); + return 0; } -static ulong part_blk_erase(struct udevice *dev, lbaint_t start, - lbaint_t blkcnt) +/** + * disk_blk_part_offset() - Compute offset from start of block device + * + * @dev: Device (partition udevice) + * @start: Start block for the access (from start of partition) + * @return Start block for the access (from start of block device) + */ +static lbaint_t disk_blk_part_offset(struct udevice *dev, lbaint_t start) { - struct udevice *parent; - struct disk_part *part; - const struct blk_ops *ops; - - parent = dev_get_parent(dev); - ops = blk_get_ops(parent); - if (!ops->erase) - return -ENOSYS; - - part = dev_get_uclass_plat(dev); - if (start >= part->gpt_part_info.size) - return 0; + struct disk_part *part = dev_get_uclass_plat(dev); - if ((start + blkcnt) > part->gpt_part_info.size) - blkcnt = part->gpt_part_info.size - start; - start += part->gpt_part_info.start; - - return ops->erase(parent, start, blkcnt); + return start + part->gpt_part_info.start; } -static const struct blk_ops blk_part_ops = { - .read = part_blk_read, - .write = part_blk_write, - .erase = part_blk_erase, -}; - -U_BOOT_DRIVER(blk_partition) = { - .name = "blk_partition", - .id = UCLASS_PARTITION, - .ops = &blk_part_ops, -}; - /* * BLOCK IO APIs */ -static struct blk_desc *dev_get_blk(struct udevice *dev) -{ - struct blk_desc *desc; - - switch (device_get_uclass_id(dev)) { - /* - * We won't support UCLASS_BLK with dev_* interfaces. - */ - case UCLASS_PARTITION: - desc = dev_get_uclass_plat(dev_get_parent(dev)); - break; - default: - desc = NULL; - break; - } - - return desc; -} - +/** + * disk_blk_read() - Read from a block device partition + * + * @dev: Device to read from (partition udevice) + * @start: Start block for the read (from start of partition) + * @blkcnt: Number of blocks to read (within the partition) + * @buffer: Place to put the data + * @return number of blocks read (which may be less than @blkcnt), + * or -ve on error. This never returns 0 unless @blkcnt is 0 + */ unsigned long disk_blk_read(struct udevice *dev, lbaint_t start, lbaint_t blkcnt, void *buffer) { - struct blk_desc *desc; - const struct blk_ops *ops; - struct disk_part *part; - lbaint_t start_in_disk; - ulong blks_read; - - desc = dev_get_blk(dev); - if (!desc) - return -ENOSYS; + int ret = disk_blk_part_validate(dev, start, blkcnt); - ops = blk_get_ops(dev); - if (!ops->read) - return -ENOSYS; + if (ret) + return ret; - start_in_disk = start; - if (device_get_uclass_id(dev) == UCLASS_PARTITION) { - part = dev_get_uclass_plat(dev); - start_in_disk += part->gpt_part_info.start; - } - - if (blkcache_read(desc->uclass_id, desc->devnum, start_in_disk, blkcnt, - desc->blksz, buffer)) - return blkcnt; - blks_read = ops->read(dev, start, blkcnt, buffer); - if (blks_read == blkcnt) - blkcache_fill(desc->uclass_id, desc->devnum, start_in_disk, - blkcnt, desc->blksz, buffer); - - return blks_read; + return blk_read(dev_get_parent(dev), disk_blk_part_offset(dev, start), + blkcnt, buffer); } +/** + * disk_blk_write() - Write to a block device + * + * @dev: Device to write to (partition udevice) + * @start: Start block for the write (from start of partition) + * @blkcnt: Number of blocks to write (within the partition) + * @buffer: Data to write + * @return number of blocks written (which may be less than @blkcnt), + * or -ve on error. This never returns 0 unless @blkcnt is 0 + */ unsigned long disk_blk_write(struct udevice *dev, lbaint_t start, lbaint_t blkcnt, const void *buffer) { - struct blk_desc *desc; - const struct blk_ops *ops; - - desc = dev_get_blk(dev); - if (!desc) - return -ENOSYS; - - ops = blk_get_ops(dev); - if (!ops->write) - return -ENOSYS; + int ret = disk_blk_part_validate(dev, start, blkcnt); - blkcache_invalidate(desc->uclass_id, desc->devnum); + if (ret) + return ret; - return ops->write(dev, start, blkcnt, buffer); + return blk_write(dev_get_parent(dev), disk_blk_part_offset(dev, start), + blkcnt, buffer); } +/** + * disk_blk_erase() - Erase part of a block device + * + * @dev: Device to erase (partition udevice) + * @start: Start block for the erase (from start of partition) + * @blkcnt: Number of blocks to erase (within the partition) + * @return number of blocks erased (which may be less than @blkcnt), + * or -ve on error. This never returns 0 unless @blkcnt is 0 + */ unsigned long disk_blk_erase(struct udevice *dev, lbaint_t start, lbaint_t blkcnt) { - struct blk_desc *desc; - const struct blk_ops *ops; - - desc = dev_get_blk(dev); - if (!desc) - return -ENOSYS; + int ret = disk_blk_part_validate(dev, start, blkcnt); - ops = blk_get_ops(dev); - if (!ops->erase) - return -ENOSYS; - - blkcache_invalidate(desc->uclass_id, desc->devnum); + if (ret) + return ret; - return ops->erase(dev, start, blkcnt); + return blk_erase(dev_get_parent(dev), disk_blk_part_offset(dev, start), + blkcnt); } UCLASS_DRIVER(partition) = { @@ -245,3 +128,15 @@ UCLASS_DRIVER(partition) = { .per_device_plat_auto = sizeof(struct disk_part), .name = "partition", }; + +static const struct blk_ops blk_part_ops = { + .read = disk_blk_read, + .write = disk_blk_write, + .erase = disk_blk_erase, +}; + +U_BOOT_DRIVER(blk_partition) = { + .name = "blk_partition", + .id = UCLASS_PARTITION, + .ops = &blk_part_ops, +}; diff --git a/disk/part.c b/disk/part.c index eec02f5..72241b7 100644 --- a/disk/part.c +++ b/disk/part.c @@ -26,6 +26,12 @@ /* Check all partition types */ #define PART_TYPE_ALL -1 +/** + * part_driver_get_type() - Get a driver given its type + * + * @part_type: Partition type to find the driver for + * Return: Driver for that type, or NULL if none + */ static struct part_driver *part_driver_get_type(int part_type) { struct part_driver *drv = @@ -42,25 +48,41 @@ static struct part_driver *part_driver_get_type(int part_type) return NULL; } -static struct part_driver *part_driver_lookup_type(struct blk_desc *dev_desc) +/** + * part_driver_lookup_type() - Look up the partition driver for a blk device + * + * If @desc->part_type is PART_TYPE_UNKNOWN, this checks each parition driver + * against the blk device to see if there is a valid partition table acceptable + * to that driver. + * + * If @desc->part_type is already set, it just returns the driver for that + * type, without testing if the driver can find a valid partition on the + * descriptor. + * + * On success it updates @desc->part_type if set to PART_TYPE_UNKNOWN on entry + * + * @dev_desc: Device descriptor + * Return: Driver found, or NULL if none + */ +static struct part_driver *part_driver_lookup_type(struct blk_desc *desc) { struct part_driver *drv = ll_entry_start(struct part_driver, part_driver); const int n_ents = ll_entry_count(struct part_driver, part_driver); struct part_driver *entry; - if (dev_desc->part_type == PART_TYPE_UNKNOWN) { + if (desc->part_type == PART_TYPE_UNKNOWN) { for (entry = drv; entry != drv + n_ents; entry++) { int ret; - ret = entry->test(dev_desc); + ret = entry->test(desc); if (!ret) { - dev_desc->part_type = entry->part_type; + desc->part_type = entry->part_type; return entry; } } } else { - return part_driver_get_type(dev_desc->part_type); + return part_driver_get_type(desc->part_type); } /* Not found */ @@ -83,27 +105,37 @@ int part_get_type_by_name(const char *name) return PART_TYPE_UNKNOWN; } +/** + * get_dev_hwpart() - Get the descriptor for a device with hardware partitions + * + * @ifname: Interface name (e.g. "ide", "scsi") + * @dev: Device number (0 for first device on that interface, 1 for + * second, etc. + * @hwpart: Hardware partition, or 0 if none (used for MMC) + * Return: pointer to the block device, or NULL if not available, or an + * error occurred. + */ static struct blk_desc *get_dev_hwpart(const char *ifname, int dev, int hwpart) { - struct blk_desc *dev_desc; + struct blk_desc *desc; int ret; if (!blk_enabled()) return NULL; - dev_desc = blk_get_devnum_by_uclass_idname(ifname, dev); - if (!dev_desc) { + desc = blk_get_devnum_by_uclass_idname(ifname, dev); + if (!desc) { debug("%s: No device for iface '%s', dev %d\n", __func__, ifname, dev); return NULL; } - ret = blk_dselect_hwpart(dev_desc, hwpart); + ret = blk_dselect_hwpart(desc, hwpart); if (ret) { debug("%s: Failed to select h/w partition: err-%d\n", __func__, ret); return NULL; } - return dev_desc; + return desc; } struct blk_desc *blk_get_dev(const char *ifname, int dev) @@ -140,29 +172,24 @@ static lba512_t lba512_muldiv(lba512_t block_count, lba512_t mul_by, return bc_quot * mul_by + ((bc_rem * mul_by) >> right_shift); } -void dev_print(struct blk_desc *dev_desc) +void dev_print(struct blk_desc *desc) { lba512_t lba512; /* number of blocks if 512bytes block size */ - if (dev_desc->type == DEV_TYPE_UNKNOWN) { + if (desc->type == DEV_TYPE_UNKNOWN) { puts ("not available\n"); return; } - switch (dev_desc->uclass_id) { + switch (desc->uclass_id) { case UCLASS_SCSI: - printf ("(%d:%d) Vendor: %s Prod.: %s Rev: %s\n", - dev_desc->target,dev_desc->lun, - dev_desc->vendor, - dev_desc->product, - dev_desc->revision); + printf("(%d:%d) Vendor: %s Prod.: %s Rev: %s\n", desc->target, + desc->lun, desc->vendor, desc->product, desc->revision); break; case UCLASS_IDE: case UCLASS_AHCI: - printf ("Model: %s Firm: %s Ser#: %s\n", - dev_desc->vendor, - dev_desc->revision, - dev_desc->product); + printf("Model: %s Firm: %s Ser#: %s\n", desc->vendor, + desc->revision, desc->product); break; case UCLASS_MMC: case UCLASS_USB: @@ -171,27 +198,27 @@ void dev_print(struct blk_desc *dev_desc) case UCLASS_HOST: case UCLASS_BLKMAP: printf ("Vendor: %s Rev: %s Prod: %s\n", - dev_desc->vendor, - dev_desc->revision, - dev_desc->product); + desc->vendor, + desc->revision, + desc->product); break; case UCLASS_VIRTIO: - printf("%s VirtIO Block Device\n", dev_desc->vendor); + printf("%s VirtIO Block Device\n", desc->vendor); break; case UCLASS_EFI_MEDIA: - printf("EFI media Block Device %d\n", dev_desc->devnum); + printf("EFI media Block Device %d\n", desc->devnum); break; case UCLASS_INVALID: puts("device type unknown\n"); return; default: - printf("Unhandled device type: %i\n", dev_desc->uclass_id); + printf("Unhandled device type: %i\n", desc->uclass_id); return; } puts (" Type: "); - if (dev_desc->removable) + if (desc->removable) puts ("Removable "); - switch (dev_desc->type & 0x1F) { + switch (desc->type & 0x1F) { case DEV_TYPE_HARDDISK: puts ("Hard Disk"); break; @@ -205,17 +232,17 @@ void dev_print(struct blk_desc *dev_desc) puts ("Tape"); break; default: - printf ("# %02X #", dev_desc->type & 0x1F); + printf("# %02X #", desc->type & 0x1F); break; } puts ("\n"); - if (dev_desc->lba > 0L && dev_desc->blksz > 0L) { + if (desc->lba > 0L && desc->blksz > 0L) { ulong mb, mb_quot, mb_rem, gb, gb_quot, gb_rem; lbaint_t lba; - lba = dev_desc->lba; + lba = desc->lba; - lba512 = (lba * (dev_desc->blksz/512)); + lba512 = lba * (desc->blksz / 512); /* round to 1 digit */ /* 2048 = (1024 * 1024) / 512 MB */ mb = lba512_muldiv(lba512, 10, 11); @@ -227,7 +254,7 @@ void dev_print(struct blk_desc *dev_desc) gb_quot = gb / 10; gb_rem = gb - (10 * gb_quot); #ifdef CONFIG_LBA48 - if (dev_desc->lba48) + if (desc->lba48) printf (" Supports 48-bit addressing\n"); #endif #if defined(CONFIG_SYS_64BIT_LBA) @@ -235,42 +262,42 @@ void dev_print(struct blk_desc *dev_desc) mb_quot, mb_rem, gb_quot, gb_rem, lba, - dev_desc->blksz); + desc->blksz); #else printf (" Capacity: %lu.%lu MB = %lu.%lu GB (%lu x %lu)\n", mb_quot, mb_rem, gb_quot, gb_rem, (ulong)lba, - dev_desc->blksz); + desc->blksz); #endif } else { puts (" Capacity: not available\n"); } } -void part_init(struct blk_desc *dev_desc) +void part_init(struct blk_desc *desc) { struct part_driver *drv = ll_entry_start(struct part_driver, part_driver); const int n_ents = ll_entry_count(struct part_driver, part_driver); struct part_driver *entry; - blkcache_invalidate(dev_desc->uclass_id, dev_desc->devnum); + blkcache_invalidate(desc->uclass_id, desc->devnum); - dev_desc->part_type = PART_TYPE_UNKNOWN; + desc->part_type = PART_TYPE_UNKNOWN; for (entry = drv; entry != drv + n_ents; entry++) { int ret; - ret = entry->test(dev_desc); + ret = entry->test(desc); debug("%s: try '%s': ret=%d\n", __func__, entry->name, ret); if (!ret) { - dev_desc->part_type = entry->part_type; + desc->part_type = entry->part_type; break; } } } -static void print_part_header(const char *type, struct blk_desc *dev_desc) +static void print_part_header(const char *type, struct blk_desc *desc) { #if CONFIG_IS_ENABLED(MAC_PARTITION) || \ CONFIG_IS_ENABLED(DOS_PARTITION) || \ @@ -278,7 +305,7 @@ static void print_part_header(const char *type, struct blk_desc *dev_desc) CONFIG_IS_ENABLED(AMIGA_PARTITION) || \ CONFIG_IS_ENABLED(EFI_PARTITION) puts ("\nPartition Map for "); - switch (dev_desc->uclass_id) { + switch (desc->uclass_id) { case UCLASS_IDE: puts ("IDE"); break; @@ -314,50 +341,46 @@ static void print_part_header(const char *type, struct blk_desc *dev_desc) break; } printf (" device %d -- Partition Type: %s\n\n", - dev_desc->devnum, type); + desc->devnum, type); #endif /* any CONFIG_..._PARTITION */ } -void part_print(struct blk_desc *dev_desc) +void part_print(struct blk_desc *desc) { struct part_driver *drv; - drv = part_driver_lookup_type(dev_desc); + drv = part_driver_lookup_type(desc); if (!drv) { printf("## Unknown partition table type %x\n", - dev_desc->part_type); + desc->part_type); return; } PRINTF("## Testing for valid %s partition ##\n", drv->name); - print_part_header(drv->name, dev_desc); + print_part_header(drv->name, desc); if (drv->print) - drv->print(dev_desc); + drv->print(desc); } -int part_get_info_by_type(struct blk_desc *dev_desc, int part, int part_type, +int part_get_info_by_type(struct blk_desc *desc, int part, int part_type, struct disk_partition *info) { struct part_driver *drv; if (blk_enabled()) { -#if CONFIG_IS_ENABLED(PARTITION_UUIDS) /* The common case is no UUID support */ - info->uuid[0] = 0; -#endif -#ifdef CONFIG_PARTITION_TYPE_GUID - info->type_guid[0] = 0; -#endif + disk_partition_clr_uuid(info); + disk_partition_clr_type_guid(info); if (part_type == PART_TYPE_UNKNOWN) { - drv = part_driver_lookup_type(dev_desc); + drv = part_driver_lookup_type(desc); } else { drv = part_driver_get_type(part_type); } if (!drv) { debug("## Unknown partition table type %x\n", - dev_desc->part_type); + desc->part_type); return -EPROTONOSUPPORT; } if (!drv->get_info) { @@ -365,7 +388,7 @@ int part_get_info_by_type(struct blk_desc *dev_desc, int part, int part_type, drv->name); return -ENOSYS; } - if (drv->get_info(dev_desc, part, info) == 0) { + if (drv->get_info(desc, part, info) == 0) { PRINTF("## Valid %s partition found ##\n", drv->name); return 0; } @@ -374,33 +397,29 @@ int part_get_info_by_type(struct blk_desc *dev_desc, int part, int part_type, return -ENOENT; } -int part_get_info(struct blk_desc *dev_desc, int part, +int part_get_info(struct blk_desc *desc, int part, struct disk_partition *info) { - return part_get_info_by_type(dev_desc, part, PART_TYPE_UNKNOWN, info); + return part_get_info_by_type(desc, part, PART_TYPE_UNKNOWN, info); } -int part_get_info_whole_disk(struct blk_desc *dev_desc, +int part_get_info_whole_disk(struct blk_desc *desc, struct disk_partition *info) { info->start = 0; - info->size = dev_desc->lba; - info->blksz = dev_desc->blksz; + info->size = desc->lba; + info->blksz = desc->blksz; info->bootable = 0; strcpy((char *)info->type, BOOT_PART_TYPE); strcpy((char *)info->name, "Whole Disk"); -#if CONFIG_IS_ENABLED(PARTITION_UUIDS) - info->uuid[0] = 0; -#endif -#ifdef CONFIG_PARTITION_TYPE_GUID - info->type_guid[0] = 0; -#endif + disk_partition_clr_uuid(info); + disk_partition_clr_type_guid(info); return 0; } int blk_get_device_by_str(const char *ifname, const char *dev_hwpart_str, - struct blk_desc **dev_desc) + struct blk_desc **desc) { char *ep; char *dup_str = NULL; @@ -436,8 +455,8 @@ int blk_get_device_by_str(const char *ifname, const char *dev_hwpart_str, } } - *dev_desc = get_dev_hwpart(ifname, dev, hwpart); - if (!(*dev_desc) || ((*dev_desc)->type == DEV_TYPE_UNKNOWN)) { + *desc = get_dev_hwpart(ifname, dev, hwpart); + if (!(*desc) || ((*desc)->type == DEV_TYPE_UNKNOWN)) { debug("** Bad device %s %s **\n", ifname, dev_hwpart_str); dev = -ENODEV; goto cleanup; @@ -449,8 +468,8 @@ int blk_get_device_by_str(const char *ifname, const char *dev_hwpart_str, * Always should be done, otherwise hw partition 0 will return * stale data after displaying a non-zero hw partition. */ - if ((*dev_desc)->uclass_id == UCLASS_MMC) - part_init(*dev_desc); + if ((*desc)->uclass_id == UCLASS_MMC) + part_init(*desc); } cleanup: @@ -461,7 +480,7 @@ cleanup: #define PART_UNSPECIFIED -2 #define PART_AUTO -1 int blk_get_device_part_str(const char *ifname, const char *dev_part_str, - struct blk_desc **dev_desc, + struct blk_desc **desc, struct disk_partition *info, int allow_whole_dev) { int ret; @@ -474,7 +493,7 @@ int blk_get_device_part_str(const char *ifname, const char *dev_part_str, int part; struct disk_partition tmpinfo; - *dev_desc = NULL; + *desc = NULL; memset(info, 0, sizeof(*info)); #if IS_ENABLED(CONFIG_SANDBOX) || IS_ENABLED(CONFIG_SEMIHOSTING) @@ -533,7 +552,7 @@ int blk_get_device_part_str(const char *ifname, const char *dev_part_str, } /* Look up the device */ - dev = blk_get_device_by_str(ifname, dev_str, dev_desc); + dev = blk_get_device_by_str(ifname, dev_str, desc); if (dev < 0) { printf("** Bad device specification %s %s **\n", ifname, dev_str); @@ -565,9 +584,8 @@ int blk_get_device_part_str(const char *ifname, const char *dev_part_str, * No partition table on device, * or user requested partition 0 (entire device). */ - if (((*dev_desc)->part_type == PART_TYPE_UNKNOWN) || - (part == 0)) { - if (!(*dev_desc)->lba) { + if (((*desc)->part_type == PART_TYPE_UNKNOWN) || !part) { + if (!(*desc)->lba) { printf("** Bad device size - %s %s **\n", ifname, dev_str); ret = -EINVAL; @@ -586,9 +604,9 @@ int blk_get_device_part_str(const char *ifname, const char *dev_part_str, goto cleanup; } - (*dev_desc)->log2blksz = LOG2((*dev_desc)->blksz); + (*desc)->log2blksz = LOG2((*desc)->blksz); - part_get_info_whole_disk(*dev_desc, info); + part_get_info_whole_disk(*desc, info); ret = 0; goto cleanup; @@ -606,7 +624,7 @@ int blk_get_device_part_str(const char *ifname, const char *dev_part_str, * other than "auto", use that partition number directly. */ if (part != PART_AUTO) { - ret = part_get_info(*dev_desc, part, info); + ret = part_get_info(*desc, part, info); if (ret) { printf("** Invalid partition %d **\n", part); goto cleanup; @@ -618,7 +636,7 @@ int blk_get_device_part_str(const char *ifname, const char *dev_part_str, */ part = 0; for (p = 1; p <= MAX_SEARCH_PARTITIONS; p++) { - ret = part_get_info(*dev_desc, p, info); + ret = part_get_info(*desc, p, info); if (ret) continue; @@ -662,7 +680,7 @@ int blk_get_device_part_str(const char *ifname, const char *dev_part_str, goto cleanup; } - (*dev_desc)->log2blksz = LOG2((*dev_desc)->blksz); + (*desc)->log2blksz = LOG2((*desc)->blksz); ret = part; goto cleanup; @@ -672,14 +690,14 @@ cleanup: return ret; } -int part_get_info_by_name(struct blk_desc *dev_desc, const char *name, +int part_get_info_by_name(struct blk_desc *desc, const char *name, struct disk_partition *info) { struct part_driver *part_drv; int ret; int i; - part_drv = part_driver_lookup_type(dev_desc); + part_drv = part_driver_lookup_type(desc); if (!part_drv) return -1; @@ -690,7 +708,7 @@ int part_get_info_by_name(struct blk_desc *dev_desc, const char *name, } for (i = 1; i < part_drv->max_entries; i++) { - ret = part_drv->get_info(dev_desc, i, info); + ret = part_drv->get_info(desc, i, info); if (ret != 0) { /* no more entries in table */ break; @@ -710,18 +728,18 @@ int part_get_info_by_name(struct blk_desc *dev_desc, const char *name, * Parse a device number and partition name string in the form of * "devicenum.hwpartnum#partition_name", for example "0.1#misc". devicenum and * hwpartnum are both optional, defaulting to 0. If the partition is found, - * sets dev_desc and part_info accordingly with the information of the + * sets desc and part_info accordingly with the information of the * partition with the given partition_name. * * @param[in] dev_iface Device interface * @param[in] dev_part_str Input string argument, like "0.1#misc" - * @param[out] dev_desc Place to store the device description pointer + * @param[out] desc Place to store the device description pointer * @param[out] part_info Place to store the partition information * Return: 0 on success, or a negative on error */ static int part_get_info_by_dev_and_name(const char *dev_iface, const char *dev_part_str, - struct blk_desc **dev_desc, + struct blk_desc **desc, struct disk_partition *part_info) { char *dup_str = NULL; @@ -743,11 +761,11 @@ static int part_get_info_by_dev_and_name(const char *dev_iface, return -EINVAL; } - ret = blk_get_device_by_str(dev_iface, dev_str, dev_desc); + ret = blk_get_device_by_str(dev_iface, dev_str, desc); if (ret < 0) goto cleanup; - ret = part_get_info_by_name(*dev_desc, part_str, part_info); + ret = part_get_info_by_name(*desc, part_str, part_info); if (ret < 0) printf("Could not find \"%s\" partition\n", part_str); @@ -758,35 +776,35 @@ cleanup: int part_get_info_by_dev_and_name_or_num(const char *dev_iface, const char *dev_part_str, - struct blk_desc **dev_desc, + struct blk_desc **desc, struct disk_partition *part_info, int allow_whole_dev) { int ret; /* Split the part_name if passed as "$dev_num#part_name". */ - ret = part_get_info_by_dev_and_name(dev_iface, dev_part_str, - dev_desc, part_info); + ret = part_get_info_by_dev_and_name(dev_iface, dev_part_str, desc, + part_info); if (ret >= 0) return ret; /* * Couldn't lookup by name, try looking up the partition description * directly. */ - ret = blk_get_device_part_str(dev_iface, dev_part_str, - dev_desc, part_info, allow_whole_dev); + ret = blk_get_device_part_str(dev_iface, dev_part_str, desc, part_info, + allow_whole_dev); if (ret < 0) printf("Couldn't find partition %s %s\n", dev_iface, dev_part_str); return ret; } -void part_set_generic_name(const struct blk_desc *dev_desc, - int part_num, char *name) +void part_set_generic_name(const struct blk_desc *desc, int part_num, + char *name) { char *devtype; - switch (dev_desc->uclass_id) { + switch (desc->uclass_id) { case UCLASS_IDE: case UCLASS_AHCI: devtype = "hd"; @@ -805,7 +823,7 @@ void part_set_generic_name(const struct blk_desc *dev_desc, break; } - sprintf(name, "%s%c%d", devtype, 'a' + dev_desc->devnum, part_num); + sprintf(name, "%s%c%d", devtype, 'a' + desc->devnum, part_num); } int part_get_bootable(struct blk_desc *desc) diff --git a/disk/part_amiga.c b/disk/part_amiga.c index 45d3a70..65e30fe 100644 --- a/disk/part_amiga.c +++ b/disk/part_amiga.c @@ -125,7 +125,7 @@ static void print_part_info(struct partition_block *p) * the ID AMIGA_ID_RDISK ('RDSK') and needs to have a valid * sum-to-zero checksum */ -struct rigid_disk_block *get_rdisk(struct blk_desc *dev_desc) +struct rigid_disk_block *get_rdisk(struct blk_desc *desc) { int i; int limit; @@ -139,7 +139,7 @@ struct rigid_disk_block *get_rdisk(struct blk_desc *dev_desc) for (i=0; i<limit; i++) { - ulong res = blk_dread(dev_desc, i, 1, (ulong *)block_buffer); + ulong res = blk_dread(desc, i, 1, (ulong *)block_buffer); if (res == 1) { struct rigid_disk_block *trdb = (struct rigid_disk_block *)block_buffer; @@ -165,7 +165,7 @@ struct rigid_disk_block *get_rdisk(struct blk_desc *dev_desc) * Ridgid disk block */ -struct bootcode_block *get_bootcode(struct blk_desc *dev_desc) +struct bootcode_block *get_bootcode(struct blk_desc *desc) { int i; int limit; @@ -181,7 +181,7 @@ struct bootcode_block *get_bootcode(struct blk_desc *dev_desc) for (i = 0; i < limit; i++) { - ulong res = blk_dread(dev_desc, i, 1, (ulong *)block_buffer); + ulong res = blk_dread(desc, i, 1, (ulong *)block_buffer); if (res == 1) { struct bootcode_block *boot = (struct bootcode_block *)block_buffer; @@ -206,17 +206,17 @@ struct bootcode_block *get_bootcode(struct blk_desc *dev_desc) * Test if the given partition has an Amiga partition table/Rigid * Disk block */ -static int part_test_amiga(struct blk_desc *dev_desc) +static int part_test_amiga(struct blk_desc *desc) { struct rigid_disk_block *rdb; struct bootcode_block *bootcode; PRINTF("part_test_amiga: Testing for an Amiga RDB partition\n"); - rdb = get_rdisk(dev_desc); + rdb = get_rdisk(desc); if (rdb) { - bootcode = get_bootcode(dev_desc); + bootcode = get_bootcode(desc); if (bootcode) PRINTF("part_test_amiga: bootable Amiga disk\n"); else @@ -235,7 +235,7 @@ static int part_test_amiga(struct blk_desc *dev_desc) /* * Find partition number partnum on the given drive. */ -static struct partition_block *find_partition(struct blk_desc *dev_desc, +static struct partition_block *find_partition(struct blk_desc *desc, int partnum) { struct rigid_disk_block *rdb; @@ -243,7 +243,7 @@ static struct partition_block *find_partition(struct blk_desc *dev_desc, u32 block; PRINTF("Trying to find partition block %d\n", partnum); - rdb = get_rdisk(dev_desc); + rdb = get_rdisk(desc); if (!rdb) { PRINTF("find_partition: no rdb found\n"); @@ -257,7 +257,7 @@ static struct partition_block *find_partition(struct blk_desc *dev_desc, while (block != 0xFFFFFFFF) { - ulong res = blk_dread(dev_desc, block, 1, (ulong *)block_buffer); + ulong res = blk_dread(desc, block, 1, (ulong *)block_buffer); if (res == 1) { p = (struct partition_block *)block_buffer; @@ -289,10 +289,10 @@ static struct partition_block *find_partition(struct blk_desc *dev_desc, /* * Get info about a partition */ -static int part_get_info_amiga(struct blk_desc *dev_desc, int part, - struct disk_partition *info) +static int part_get_info_amiga(struct blk_desc *desc, int part, + struct disk_partition *info) { - struct partition_block *p = find_partition(dev_desc, part-1); + struct partition_block *p = find_partition(desc, part - 1); struct amiga_part_geometry *g; u32 disk_type; @@ -317,7 +317,7 @@ static int part_get_info_amiga(struct blk_desc *dev_desc, int part, return 0; } -static void part_print_amiga(struct blk_desc *dev_desc) +static void part_print_amiga(struct blk_desc *desc) { struct rigid_disk_block *rdb; struct bootcode_block *boot; @@ -325,7 +325,7 @@ static void part_print_amiga(struct blk_desc *dev_desc) u32 block; int i = 1; - rdb = get_rdisk(dev_desc); + rdb = get_rdisk(desc); if (!rdb) { PRINTF("part_print_amiga: no rdb found\n"); @@ -353,7 +353,7 @@ static void part_print_amiga(struct blk_desc *dev_desc) PRINTF("Trying to load block #0x%X\n", block); - res = blk_dread(dev_desc, block, 1, (ulong *)block_buffer); + res = blk_dread(desc, block, 1, (ulong *)block_buffer); if (res == 1) { p = (struct partition_block *)block_buffer; @@ -370,7 +370,7 @@ static void part_print_amiga(struct blk_desc *dev_desc) } else block = 0xFFFFFFFF; } - boot = get_bootcode(dev_desc); + boot = get_bootcode(desc); if (boot) { printf("Disk is bootable\n"); diff --git a/disk/part_dos.c b/disk/part_dos.c index 56e6188..3337438 100644 --- a/disk/part_dos.c +++ b/disk/part_dos.c @@ -98,27 +98,26 @@ static int test_block_type(unsigned char *buffer) return -1; } -static int part_test_dos(struct blk_desc *dev_desc) +static int part_test_dos(struct blk_desc *desc) { #ifndef CONFIG_SPL_BUILD ALLOC_CACHE_ALIGN_BUFFER(legacy_mbr, mbr, - DIV_ROUND_UP(dev_desc->blksz, sizeof(legacy_mbr))); + DIV_ROUND_UP(desc->blksz, sizeof(legacy_mbr))); - if (blk_dread(dev_desc, 0, 1, (ulong *)mbr) != 1) + if (blk_dread(desc, 0, 1, (ulong *)mbr) != 1) return -1; if (test_block_type((unsigned char *)mbr) != DOS_MBR) return -1; - if (dev_desc->sig_type == SIG_TYPE_NONE && - mbr->unique_mbr_signature != 0) { - dev_desc->sig_type = SIG_TYPE_MBR; - dev_desc->mbr_sig = mbr->unique_mbr_signature; + if (desc->sig_type == SIG_TYPE_NONE && mbr->unique_mbr_signature) { + desc->sig_type = SIG_TYPE_MBR; + desc->mbr_sig = mbr->unique_mbr_signature; } #else - ALLOC_CACHE_ALIGN_BUFFER(unsigned char, buffer, dev_desc->blksz); + ALLOC_CACHE_ALIGN_BUFFER(unsigned char, buffer, desc->blksz); - if (blk_dread(dev_desc, 0, 1, (ulong *)buffer) != 1) + if (blk_dread(desc, 0, 1, (ulong *)buffer) != 1) return -1; if (test_block_type(buffer) != DOS_MBR) @@ -130,12 +129,12 @@ static int part_test_dos(struct blk_desc *dev_desc) /* Print a partition that is relative to its Extended partition table */ -static void print_partition_extended(struct blk_desc *dev_desc, +static void print_partition_extended(struct blk_desc *desc, lbaint_t ext_part_sector, lbaint_t relative, int part_num, unsigned int disksig) { - ALLOC_CACHE_ALIGN_BUFFER(unsigned char, buffer, dev_desc->blksz); + ALLOC_CACHE_ALIGN_BUFFER(unsigned char, buffer, desc->blksz); dos_partition_t *pt; int i; @@ -146,9 +145,9 @@ static void print_partition_extended(struct blk_desc *dev_desc, return; } - if (blk_dread(dev_desc, ext_part_sector, 1, (ulong *)buffer) != 1) { + if (blk_dread(desc, ext_part_sector, 1, (ulong *)buffer) != 1) { printf ("** Can't read partition table on %d:" LBAFU " **\n", - dev_desc->devnum, ext_part_sector); + desc->devnum, ext_part_sector); return; } i=test_block_type(buffer); @@ -189,9 +188,9 @@ static void print_partition_extended(struct blk_desc *dev_desc, lbaint_t lba_start = get_unaligned_le32 (pt->start4) + relative; - print_partition_extended(dev_desc, lba_start, - ext_part_sector == 0 ? lba_start : relative, - part_num, disksig); + print_partition_extended(desc, lba_start, + !ext_part_sector ? lba_start : + relative, part_num, disksig); } } @@ -201,14 +200,15 @@ static void print_partition_extended(struct blk_desc *dev_desc, /* Print a partition that is relative to its Extended partition table */ -static int part_get_info_extended(struct blk_desc *dev_desc, +static int part_get_info_extended(struct blk_desc *desc, lbaint_t ext_part_sector, lbaint_t relative, int part_num, int which_part, struct disk_partition *info, uint disksig) { - ALLOC_CACHE_ALIGN_BUFFER(unsigned char, buffer, dev_desc->blksz); + ALLOC_CACHE_ALIGN_BUFFER(unsigned char, buffer, desc->blksz); + struct disk_partition wdinfo = { 0 }; dos_partition_t *pt; - int i; + int i, ret; int dos_type; /* set a maximum recursion level */ @@ -218,9 +218,9 @@ static int part_get_info_extended(struct blk_desc *dev_desc, return -1; } - if (blk_dread(dev_desc, ext_part_sector, 1, (ulong *)buffer) != 1) { + if (blk_dread(desc, ext_part_sector, 1, (ulong *)buffer) != 1) { printf ("** Can't read partition table on %d:" LBAFU " **\n", - dev_desc->devnum, ext_part_sector); + desc->devnum, ext_part_sector); return -1; } if (buffer[DOS_PART_MAGIC_OFFSET] != 0x55 || @@ -231,10 +231,12 @@ static int part_get_info_extended(struct blk_desc *dev_desc, return -1; } -#if CONFIG_IS_ENABLED(PARTITION_UUIDS) - if (!ext_part_sector) + if (CONFIG_IS_ENABLED(PARTITION_UUIDS) && !ext_part_sector) disksig = get_unaligned_le32(&buffer[DOS_PART_DISKSIG_OFFSET]); -#endif + + ret = part_get_info_whole_disk(desc, &wdinfo); + if (ret) + return ret; /* Print all primary/logical partitions */ pt = (dos_partition_t *) (buffer + DOS_PART_TBL_OFFSET); @@ -247,18 +249,24 @@ static int part_get_info_extended(struct blk_desc *dev_desc, (pt->sys_ind != 0) && (part_num == which_part) && (ext_part_sector == 0 || is_extended(pt->sys_ind) == 0)) { - info->blksz = DOS_PART_DEFAULT_SECTOR; + if (wdinfo.blksz > DOS_PART_DEFAULT_SECTOR) + info->blksz = wdinfo.blksz; + else + info->blksz = DOS_PART_DEFAULT_SECTOR; info->start = (lbaint_t)(ext_part_sector + get_unaligned_le32(pt->start4)); info->size = (lbaint_t)get_unaligned_le32(pt->size4); - part_set_generic_name(dev_desc, part_num, + part_set_generic_name(desc, part_num, (char *)info->name); /* sprintf(info->type, "%d, pt->sys_ind); */ strcpy((char *)info->type, "U-Boot"); info->bootable = get_bootable(pt); -#if CONFIG_IS_ENABLED(PARTITION_UUIDS) - sprintf(info->uuid, "%08x-%02x", disksig, part_num); -#endif + if (CONFIG_IS_ENABLED(PARTITION_UUIDS)) { + char str[12]; + + sprintf(str, "%08x-%02x", disksig, part_num); + disk_partition_set_uuid(info, str); + } info->sys_ind = pt->sys_ind; return 0; } @@ -277,7 +285,7 @@ static int part_get_info_extended(struct blk_desc *dev_desc, lbaint_t lba_start = get_unaligned_le32 (pt->start4) + relative; - return part_get_info_extended(dev_desc, lba_start, + return part_get_info_extended(desc, lba_start, ext_part_sector == 0 ? lba_start : relative, part_num, which_part, info, disksig); } @@ -288,29 +296,30 @@ static int part_get_info_extended(struct blk_desc *dev_desc, if (dos_type == DOS_PBR) { info->start = 0; - info->size = dev_desc->lba; - info->blksz = DOS_PART_DEFAULT_SECTOR; + info->size = desc->lba; + if (wdinfo.blksz > DOS_PART_DEFAULT_SECTOR) + info->blksz = wdinfo.blksz; + else + info->blksz = DOS_PART_DEFAULT_SECTOR; info->bootable = 0; strcpy((char *)info->type, "U-Boot"); -#if CONFIG_IS_ENABLED(PARTITION_UUIDS) - info->uuid[0] = 0; -#endif + disk_partition_clr_uuid(info); return 0; } return -1; } -static void __maybe_unused part_print_dos(struct blk_desc *dev_desc) +static void __maybe_unused part_print_dos(struct blk_desc *desc) { printf("Part\tStart Sector\tNum Sectors\tUUID\t\tType\n"); - print_partition_extended(dev_desc, 0, 0, 1, 0); + print_partition_extended(desc, 0, 0, 1, 0); } -static int __maybe_unused part_get_info_dos(struct blk_desc *dev_desc, int part, - struct disk_partition *info) +static int __maybe_unused part_get_info_dos(struct blk_desc *desc, int part, + struct disk_partition *info) { - return part_get_info_extended(dev_desc, 0, 0, 1, part, info, 0); + return part_get_info_extended(desc, 0, 0, 1, part, info, 0); } int is_valid_dos_buf(void *buf) @@ -490,20 +499,20 @@ int layout_mbr_partitions(struct disk_partition *p, int count, } #endif -int write_mbr_sector(struct blk_desc *dev_desc, void *buf) +int write_mbr_sector(struct blk_desc *desc, void *buf) { if (is_valid_dos_buf(buf)) return -1; /* write MBR */ - if (blk_dwrite(dev_desc, 0, 1, buf) != 1) { + if (blk_dwrite(desc, 0, 1, buf) != 1) { printf("%s: failed writing '%s' (1 blks at 0x0)\n", __func__, "MBR"); return 1; } /* Update the partition table entries*/ - part_init(dev_desc); + part_init(desc); return 0; } diff --git a/disk/part_efi.c b/disk/part_efi.c index 80a44dc..4ce9243 100644 --- a/disk/part_efi.c +++ b/disk/part_efi.c @@ -9,6 +9,9 @@ * when CONFIG_SYS_64BIT_LBA is not defined, lbaint_t is 32 bits; this * limits the maximum size of addressable storage to < 2 tebibytes */ + +#define LOG_CATEGORY LOGC_FS + #include <common.h> #include <blk.h> #include <log.h> @@ -26,6 +29,7 @@ #include <dm/ofnode.h> #include <linux/compiler.h> #include <linux/ctype.h> +#include <linux/printk.h> #include <u-boot/crc.h> /* GUID for basic data partitons */ @@ -51,12 +55,12 @@ static inline u32 efi_crc32(const void *buf, u32 len) static int pmbr_part_valid(struct partition *part); static int is_pmbr_valid(legacy_mbr * mbr); -static int is_gpt_valid(struct blk_desc *dev_desc, u64 lba, - gpt_header *pgpt_head, gpt_entry **pgpt_pte); -static gpt_entry *alloc_read_gpt_entries(struct blk_desc *dev_desc, +static int is_gpt_valid(struct blk_desc *desc, u64 lba, gpt_header *pgpt_head, + gpt_entry **pgpt_pte); +static gpt_entry *alloc_read_gpt_entries(struct blk_desc *desc, gpt_header *pgpt_head); static int is_pte_valid(gpt_entry * pte); -static int find_valid_gpt(struct blk_desc *dev_desc, gpt_header *gpt_head, +static int find_valid_gpt(struct blk_desc *desc, gpt_header *gpt_head, gpt_entry **pgpt_pte); static char *print_efiname(gpt_entry *pte) @@ -195,14 +199,14 @@ static void prepare_backup_gpt_header(gpt_header *gpt_h) * UUID is displayed as 32 hexadecimal digits, in 5 groups, * separated by hyphens, in the form 8-4-4-4-12 for a total of 36 characters */ -int get_disk_guid(struct blk_desc * dev_desc, char *guid) +int get_disk_guid(struct blk_desc *desc, char *guid) { - ALLOC_CACHE_ALIGN_BUFFER_PAD(gpt_header, gpt_head, 1, dev_desc->blksz); + ALLOC_CACHE_ALIGN_BUFFER_PAD(gpt_header, gpt_head, 1, desc->blksz); gpt_entry *gpt_pte = NULL; unsigned char *guid_bin; /* This function validates AND fills in the GPT header and PTE */ - if (find_valid_gpt(dev_desc, gpt_head, &gpt_pte) != 1) + if (find_valid_gpt(desc, gpt_head, &gpt_pte) != 1) return -EINVAL; guid_bin = gpt_head->disk_guid.b; @@ -213,15 +217,15 @@ int get_disk_guid(struct blk_desc * dev_desc, char *guid) return 0; } -void part_print_efi(struct blk_desc *dev_desc) +void part_print_efi(struct blk_desc *desc) { - ALLOC_CACHE_ALIGN_BUFFER_PAD(gpt_header, gpt_head, 1, dev_desc->blksz); + ALLOC_CACHE_ALIGN_BUFFER_PAD(gpt_header, gpt_head, 1, desc->blksz); gpt_entry *gpt_pte = NULL; int i = 0; unsigned char *uuid; /* This function validates AND fills in the GPT header and PTE */ - if (find_valid_gpt(dev_desc, gpt_head, &gpt_pte) != 1) + if (find_valid_gpt(desc, gpt_head, &gpt_pte) != 1) return; debug("%s: gpt-entry at %p\n", __func__, gpt_pte); @@ -255,10 +259,10 @@ void part_print_efi(struct blk_desc *dev_desc) return; } -int part_get_info_efi(struct blk_desc *dev_desc, int part, +int part_get_info_efi(struct blk_desc *desc, int part, struct disk_partition *info) { - ALLOC_CACHE_ALIGN_BUFFER_PAD(gpt_header, gpt_head, 1, dev_desc->blksz); + ALLOC_CACHE_ALIGN_BUFFER_PAD(gpt_header, gpt_head, 1, desc->blksz); gpt_entry *gpt_pte = NULL; /* "part" argument must be at least 1 */ @@ -268,7 +272,7 @@ int part_get_info_efi(struct blk_desc *dev_desc, int part, } /* This function validates AND fills in the GPT header and PTE */ - if (find_valid_gpt(dev_desc, gpt_head, &gpt_pte) != 1) + if (find_valid_gpt(desc, gpt_head, &gpt_pte) != 1) return -EINVAL; if (part > le32_to_cpu(gpt_head->num_partition_entries) || @@ -283,20 +287,22 @@ int part_get_info_efi(struct blk_desc *dev_desc, int part, /* The ending LBA is inclusive, to calculate size, add 1 to it */ info->size = (lbaint_t)le64_to_cpu(gpt_pte[part - 1].ending_lba) + 1 - info->start; - info->blksz = dev_desc->blksz; + info->blksz = desc->blksz; snprintf((char *)info->name, sizeof(info->name), "%s", print_efiname(&gpt_pte[part - 1])); strcpy((char *)info->type, "U-Boot"); info->bootable = get_bootable(&gpt_pte[part - 1]); -#if CONFIG_IS_ENABLED(PARTITION_UUIDS) - uuid_bin_to_str(gpt_pte[part - 1].unique_partition_guid.b, info->uuid, - UUID_STR_FORMAT_GUID); -#endif -#ifdef CONFIG_PARTITION_TYPE_GUID - uuid_bin_to_str(gpt_pte[part - 1].partition_type_guid.b, - info->type_guid, UUID_STR_FORMAT_GUID); -#endif + if (CONFIG_IS_ENABLED(PARTITION_UUIDS)) { + uuid_bin_to_str(gpt_pte[part - 1].unique_partition_guid.b, + (char *)disk_partition_uuid(info), + UUID_STR_FORMAT_GUID); + } + if (IS_ENABLED(CONFIG_PARTITION_TYPE_GUID)) { + uuid_bin_to_str(gpt_pte[part - 1].partition_type_guid.b, + (char *)disk_partition_type_guid(info), + UUID_STR_FORMAT_GUID); + } log_debug("start 0x" LBAF ", size 0x" LBAF ", name %s\n", info->start, info->size, info->name); @@ -306,12 +312,12 @@ int part_get_info_efi(struct blk_desc *dev_desc, int part, return 0; } -static int part_test_efi(struct blk_desc *dev_desc) +static int part_test_efi(struct blk_desc *desc) { - ALLOC_CACHE_ALIGN_BUFFER_PAD(legacy_mbr, legacymbr, 1, dev_desc->blksz); + ALLOC_CACHE_ALIGN_BUFFER_PAD(legacy_mbr, legacymbr, 1, desc->blksz); /* Read legacy MBR from block 0 and validate it */ - if ((blk_dread(dev_desc, 0, 1, (ulong *)legacymbr) != 1) + if ((blk_dread(desc, 0, 1, (ulong *)legacymbr) != 1) || (is_pmbr_valid(legacymbr) != 1)) { return -1; } @@ -320,23 +326,23 @@ static int part_test_efi(struct blk_desc *dev_desc) /** * set_protective_mbr(): Set the EFI protective MBR - * @param dev_desc - block device descriptor + * @param desc - block device descriptor * * Return: - zero on success, otherwise error */ -static int set_protective_mbr(struct blk_desc *dev_desc) +static int set_protective_mbr(struct blk_desc *desc) { /* Setup the Protective MBR */ - ALLOC_CACHE_ALIGN_BUFFER_PAD(legacy_mbr, p_mbr, 1, dev_desc->blksz); + ALLOC_CACHE_ALIGN_BUFFER_PAD(legacy_mbr, p_mbr, 1, desc->blksz); if (p_mbr == NULL) { log_debug("calloc failed!\n"); return -ENOMEM; } /* Read MBR to backup boot code if it exists */ - if (blk_dread(dev_desc, 0, 1, p_mbr) != 1) { + if (blk_dread(desc, 0, 1, p_mbr) != 1) { log_debug("** Can't read from device %d **\n", - dev_desc->devnum); + desc->devnum); return -EIO; } @@ -348,27 +354,26 @@ static int set_protective_mbr(struct blk_desc *dev_desc) p_mbr->signature = MSDOS_MBR_SIGNATURE; p_mbr->partition_record[0].sys_ind = EFI_PMBR_OSTYPE_EFI_GPT; p_mbr->partition_record[0].start_sect = 1; - p_mbr->partition_record[0].nr_sects = (u32) dev_desc->lba - 1; + p_mbr->partition_record[0].nr_sects = (u32)desc->lba - 1; /* Write MBR sector to the MMC device */ - if (blk_dwrite(dev_desc, 0, 1, p_mbr) != 1) { - log_debug("** Can't write to device %d **\n", dev_desc->devnum); + if (blk_dwrite(desc, 0, 1, p_mbr) != 1) { + log_debug("** Can't write to device %d **\n", desc->devnum); return -EIO; } return 0; } -int write_gpt_table(struct blk_desc *dev_desc, - gpt_header *gpt_h, gpt_entry *gpt_e) +int write_gpt_table(struct blk_desc *desc, gpt_header *gpt_h, gpt_entry *gpt_e) { const int pte_blk_cnt = BLOCK_CNT((gpt_h->num_partition_entries - * sizeof(gpt_entry)), dev_desc); + * sizeof(gpt_entry)), desc); u32 calc_crc32; - debug("max lba: %x\n", (u32) dev_desc->lba); + debug("max lba: %x\n", (u32)desc->lba); /* Setup the Protective MBR */ - if (set_protective_mbr(dev_desc) < 0) + if (set_protective_mbr(desc) < 0) goto err; /* Generate CRC for the Primary GPT Header */ @@ -382,20 +387,20 @@ int write_gpt_table(struct blk_desc *dev_desc, gpt_h->header_crc32 = cpu_to_le32(calc_crc32); /* Write the First GPT to the block right after the Legacy MBR */ - if (blk_dwrite(dev_desc, 1, 1, gpt_h) != 1) + if (blk_dwrite(desc, 1, 1, gpt_h) != 1) goto err; - if (blk_dwrite(dev_desc, le64_to_cpu(gpt_h->partition_entry_lba), + if (blk_dwrite(desc, le64_to_cpu(gpt_h->partition_entry_lba), pte_blk_cnt, gpt_e) != pte_blk_cnt) goto err; prepare_backup_gpt_header(gpt_h); - if (blk_dwrite(dev_desc, (lbaint_t)le64_to_cpu(gpt_h->last_usable_lba) + if (blk_dwrite(desc, (lbaint_t)le64_to_cpu(gpt_h->last_usable_lba) + 1, pte_blk_cnt, gpt_e) != pte_blk_cnt) goto err; - if (blk_dwrite(dev_desc, (lbaint_t)le64_to_cpu(gpt_h->my_lba), 1, + if (blk_dwrite(desc, (lbaint_t)le64_to_cpu(gpt_h->my_lba), 1, gpt_h) != 1) goto err; @@ -403,11 +408,11 @@ int write_gpt_table(struct blk_desc *dev_desc, return 0; err: - log_debug("** Can't write to device %d **\n", dev_desc->devnum); + log_debug("** Can't write to device %d **\n", desc->devnum); return -EIO; } -int gpt_fill_pte(struct blk_desc *dev_desc, +int gpt_fill_pte(struct blk_desc *desc, gpt_header *gpt_h, gpt_entry *gpt_e, struct disk_partition *partitions, int parts) { @@ -416,10 +421,7 @@ int gpt_fill_pte(struct blk_desc *dev_desc, le64_to_cpu(gpt_h->last_usable_lba); int i, k; size_t efiname_len, dosname_len; -#if CONFIG_IS_ENABLED(PARTITION_UUIDS) - char *str_uuid; unsigned char *bin_uuid; -#endif #ifdef CONFIG_PARTITION_TYPE_GUID char *str_type_guid; unsigned char *bin_type_guid; @@ -430,7 +432,7 @@ int gpt_fill_pte(struct blk_desc *dev_desc, size_t pte_start = gpt_h->partition_entry_lba; size_t pte_end = pte_start + gpt_h->num_partition_entries * gpt_h->sizeof_partition_entry / - dev_desc->blksz; + desc->blksz; for (i = 0; i < parts; i++) { /* partition starting lba */ @@ -488,16 +490,19 @@ int gpt_fill_pte(struct blk_desc *dev_desc, &partition_basic_data_guid, 16); #endif -#if CONFIG_IS_ENABLED(PARTITION_UUIDS) - str_uuid = partitions[i].uuid; - bin_uuid = gpt_e[i].unique_partition_guid.b; + if (CONFIG_IS_ENABLED(PARTITION_UUIDS)) { + const char *str_uuid; - if (uuid_str_to_bin(str_uuid, bin_uuid, UUID_STR_FORMAT_GUID)) { - log_debug("Partition no. %d: invalid guid: %s\n", - i, str_uuid); - return -EINVAL; + str_uuid = disk_partition_uuid(&partitions[i]); + bin_uuid = gpt_e[i].unique_partition_guid.b; + + if (uuid_str_to_bin(str_uuid, bin_uuid, + UUID_STR_FORMAT_GUID)) { + log_debug("Partition no. %d: invalid guid: %s\n", + i, str_uuid); + return -EINVAL; + } } -#endif /* partition attributes */ memset(&gpt_e[i].attributes, 0, @@ -527,7 +532,7 @@ int gpt_fill_pte(struct blk_desc *dev_desc, return 0; } -static uint32_t partition_entries_offset(struct blk_desc *dev_desc) +static uint32_t partition_entries_offset(struct blk_desc *desc) { uint32_t offset_blks = 2; uint32_t __maybe_unused offset_bytes; @@ -543,8 +548,8 @@ static uint32_t partition_entries_offset(struct blk_desc *dev_desc) * CONFIG_EFI_PARTITION_ENTRIES_OFF. */ offset_bytes = - PAD_TO_BLOCKSIZE(CONFIG_EFI_PARTITION_ENTRIES_OFF, dev_desc); - offset_blks = offset_bytes / dev_desc->blksz; + PAD_TO_BLOCKSIZE(CONFIG_EFI_PARTITION_ENTRIES_OFF, desc); + offset_blks = offset_bytes / desc->blksz; #endif #if defined(CONFIG_OF_CONTROL) @@ -556,8 +561,8 @@ static uint32_t partition_entries_offset(struct blk_desc *dev_desc) config_offset = ofnode_conf_read_int( "u-boot,efi-partition-entries-offset", -EINVAL); if (config_offset != -EINVAL) { - offset_bytes = PAD_TO_BLOCKSIZE(config_offset, dev_desc); - offset_blks = offset_bytes / dev_desc->blksz; + offset_bytes = PAD_TO_BLOCKSIZE(config_offset, desc); + offset_blks = offset_bytes / desc->blksz; } #endif @@ -573,17 +578,17 @@ static uint32_t partition_entries_offset(struct blk_desc *dev_desc) return offset_blks; } -int gpt_fill_header(struct blk_desc *dev_desc, gpt_header *gpt_h, - char *str_guid, int parts_count) +int gpt_fill_header(struct blk_desc *desc, gpt_header *gpt_h, char *str_guid, + int parts_count) { gpt_h->signature = cpu_to_le64(GPT_HEADER_SIGNATURE_UBOOT); gpt_h->revision = cpu_to_le32(GPT_HEADER_REVISION_V1); gpt_h->header_size = cpu_to_le32(sizeof(gpt_header)); gpt_h->my_lba = cpu_to_le64(1); - gpt_h->alternate_lba = cpu_to_le64(dev_desc->lba - 1); - gpt_h->last_usable_lba = cpu_to_le64(dev_desc->lba - 34); + gpt_h->alternate_lba = cpu_to_le64(desc->lba - 1); + gpt_h->last_usable_lba = cpu_to_le64(desc->lba - 34); gpt_h->partition_entry_lba = - cpu_to_le64(partition_entries_offset(dev_desc)); + cpu_to_le64(partition_entries_offset(desc)); gpt_h->first_usable_lba = cpu_to_le64(le64_to_cpu(gpt_h->partition_entry_lba) + 32); gpt_h->num_partition_entries = cpu_to_le32(GPT_ENTRY_NUMBERS); @@ -597,14 +602,14 @@ int gpt_fill_header(struct blk_desc *dev_desc, gpt_header *gpt_h, return 0; } -int gpt_restore(struct blk_desc *dev_desc, char *str_disk_guid, +int gpt_restore(struct blk_desc *desc, char *str_disk_guid, struct disk_partition *partitions, int parts_count) { gpt_header *gpt_h; gpt_entry *gpt_e; int ret, size; - size = PAD_TO_BLOCKSIZE(sizeof(gpt_header), dev_desc); + size = PAD_TO_BLOCKSIZE(sizeof(gpt_header), desc); gpt_h = malloc_cache_aligned(size); if (gpt_h == NULL) { log_debug("calloc failed!\n"); @@ -613,7 +618,7 @@ int gpt_restore(struct blk_desc *dev_desc, char *str_disk_guid, memset(gpt_h, 0, size); size = PAD_TO_BLOCKSIZE(GPT_ENTRY_NUMBERS * sizeof(gpt_entry), - dev_desc); + desc); gpt_e = malloc_cache_aligned(size); if (gpt_e == NULL) { log_debug("calloc failed!\n"); @@ -623,17 +628,17 @@ int gpt_restore(struct blk_desc *dev_desc, char *str_disk_guid, memset(gpt_e, 0, size); /* Generate Primary GPT header (LBA1) */ - ret = gpt_fill_header(dev_desc, gpt_h, str_disk_guid, parts_count); + ret = gpt_fill_header(desc, gpt_h, str_disk_guid, parts_count); if (ret) goto err; /* Generate partition entries */ - ret = gpt_fill_pte(dev_desc, gpt_h, gpt_e, partitions, parts_count); + ret = gpt_fill_pte(desc, gpt_h, gpt_e, partitions, parts_count); if (ret) goto err; /* Write GPT partition table */ - ret = write_gpt_table(dev_desc, gpt_h, gpt_e); + ret = write_gpt_table(desc, gpt_h, gpt_e); err: free(gpt_e); @@ -664,14 +669,14 @@ static void gpt_convert_efi_name_to_char(char *s, void *es, int n) } } -int gpt_verify_headers(struct blk_desc *dev_desc, gpt_header *gpt_head, +int gpt_verify_headers(struct blk_desc *desc, gpt_header *gpt_head, gpt_entry **gpt_pte) { /* * This function validates AND * fills in the GPT header and PTE */ - if (is_gpt_valid(dev_desc, + if (is_gpt_valid(desc, GPT_PRIMARY_PARTITION_TABLE_LBA, gpt_head, gpt_pte) != 1) { log_debug("Invalid GPT\n"); @@ -684,12 +689,12 @@ int gpt_verify_headers(struct blk_desc *dev_desc, gpt_header *gpt_head, /* * Check that the alternate_lba entry points to the last LBA */ - if (le64_to_cpu(gpt_head->alternate_lba) != (dev_desc->lba - 1)) { + if (le64_to_cpu(gpt_head->alternate_lba) != (desc->lba - 1)) { log_debug("Misplaced Backup GPT\n"); return -1; } - if (is_gpt_valid(dev_desc, (dev_desc->lba - 1), + if (is_gpt_valid(desc, (desc->lba - 1), gpt_head, gpt_pte) != 1) { log_debug("Invalid Backup GPT\n"); return -1; @@ -698,7 +703,7 @@ int gpt_verify_headers(struct blk_desc *dev_desc, gpt_header *gpt_head, return 0; } -static void restore_primary_gpt_header(gpt_header *gpt_h, struct blk_desc *dev_desc) +static void restore_primary_gpt_header(gpt_header *gpt_h, struct blk_desc *desc) { u32 calc_crc32; u64 val; @@ -707,7 +712,7 @@ static void restore_primary_gpt_header(gpt_header *gpt_h, struct blk_desc *dev_d val = le64_to_cpu(gpt_h->my_lba); gpt_h->my_lba = gpt_h->alternate_lba; gpt_h->alternate_lba = cpu_to_le64(val); - gpt_h->partition_entry_lba = cpu_to_le64(partition_entries_offset(dev_desc)); + gpt_h->partition_entry_lba = cpu_to_le64(partition_entries_offset(desc)); gpt_h->header_crc32 = 0; @@ -716,22 +721,22 @@ static void restore_primary_gpt_header(gpt_header *gpt_h, struct blk_desc *dev_d gpt_h->header_crc32 = cpu_to_le32(calc_crc32); } -static int write_one_gpt_table(struct blk_desc *dev_desc, - gpt_header *gpt_h, gpt_entry *gpt_e) +static int write_one_gpt_table(struct blk_desc *desc, gpt_header *gpt_h, + gpt_entry *gpt_e) { const int pte_blk_cnt = BLOCK_CNT((gpt_h->num_partition_entries - * sizeof(gpt_entry)), dev_desc); + * sizeof(gpt_entry)), desc); lbaint_t start; int ret = 0; start = le64_to_cpu(gpt_h->my_lba); - if (blk_dwrite(dev_desc, start, 1, gpt_h) != 1) { + if (blk_dwrite(desc, start, 1, gpt_h) != 1) { ret = -1; goto out; } start = le64_to_cpu(gpt_h->partition_entry_lba); - if (blk_dwrite(dev_desc, start, pte_blk_cnt, gpt_e) != pte_blk_cnt) { + if (blk_dwrite(desc, start, pte_blk_cnt, gpt_e) != pte_blk_cnt) { ret = -1; goto out; } @@ -740,17 +745,17 @@ static int write_one_gpt_table(struct blk_desc *dev_desc, return ret; } -int gpt_repair_headers(struct blk_desc *dev_desc) +int gpt_repair_headers(struct blk_desc *desc) { - ALLOC_CACHE_ALIGN_BUFFER_PAD(gpt_header, gpt_h1, 1, dev_desc->blksz); - ALLOC_CACHE_ALIGN_BUFFER_PAD(gpt_header, gpt_h2, 1, dev_desc->blksz); + ALLOC_CACHE_ALIGN_BUFFER_PAD(gpt_header, gpt_h1, 1, desc->blksz); + ALLOC_CACHE_ALIGN_BUFFER_PAD(gpt_header, gpt_h2, 1, desc->blksz); gpt_entry *gpt_e1 = NULL, *gpt_e2 = NULL; int is_gpt1_valid, is_gpt2_valid; int ret = -1; - is_gpt1_valid = is_gpt_valid(dev_desc, GPT_PRIMARY_PARTITION_TABLE_LBA, + is_gpt1_valid = is_gpt_valid(desc, GPT_PRIMARY_PARTITION_TABLE_LBA, gpt_h1, &gpt_e1); - is_gpt2_valid = is_gpt_valid(dev_desc, dev_desc->lba - 1, + is_gpt2_valid = is_gpt_valid(desc, desc->lba - 1, gpt_h2, &gpt_e2); if (is_gpt1_valid && is_gpt2_valid) { @@ -760,13 +765,13 @@ int gpt_repair_headers(struct blk_desc *dev_desc) if (is_gpt1_valid && !is_gpt2_valid) { prepare_backup_gpt_header(gpt_h1); - ret = write_one_gpt_table(dev_desc, gpt_h1, gpt_e1); + ret = write_one_gpt_table(desc, gpt_h1, gpt_e1); goto out; } if (!is_gpt1_valid && is_gpt2_valid) { - restore_primary_gpt_header(gpt_h2, dev_desc); - ret = write_one_gpt_table(dev_desc, gpt_h2, gpt_e2); + restore_primary_gpt_header(gpt_h2, desc); + ret = write_one_gpt_table(desc, gpt_h2, gpt_e2); goto out; } @@ -784,7 +789,7 @@ int gpt_repair_headers(struct blk_desc *dev_desc) return ret; } -int gpt_verify_partitions(struct blk_desc *dev_desc, +int gpt_verify_partitions(struct blk_desc *desc, struct disk_partition *partitions, int parts, gpt_header *gpt_head, gpt_entry **gpt_pte) { @@ -793,7 +798,7 @@ int gpt_verify_partitions(struct blk_desc *dev_desc, gpt_entry *gpt_e; int ret, i; - ret = gpt_verify_headers(dev_desc, gpt_head, gpt_pte); + ret = gpt_verify_headers(desc, gpt_head, gpt_pte); if (ret) return ret; @@ -862,28 +867,27 @@ int gpt_verify_partitions(struct blk_desc *dev_desc, return 0; } -int is_valid_gpt_buf(struct blk_desc *dev_desc, void *buf) +int is_valid_gpt_buf(struct blk_desc *desc, void *buf) { gpt_header *gpt_h; gpt_entry *gpt_e; /* determine start of GPT Header in the buffer */ - gpt_h = buf + (GPT_PRIMARY_PARTITION_TABLE_LBA * - dev_desc->blksz); + gpt_h = buf + (GPT_PRIMARY_PARTITION_TABLE_LBA * desc->blksz); if (validate_gpt_header(gpt_h, GPT_PRIMARY_PARTITION_TABLE_LBA, - dev_desc->lba)) + desc->lba)) return -1; /* determine start of GPT Entries in the buffer */ gpt_e = buf + (le64_to_cpu(gpt_h->partition_entry_lba) * - dev_desc->blksz); + desc->blksz); if (validate_gpt_entries(gpt_h, gpt_e)) return -1; return 0; } -int write_mbr_and_gpt_partitions(struct blk_desc *dev_desc, void *buf) +int write_mbr_and_gpt_partitions(struct blk_desc *desc, void *buf) { gpt_header *gpt_h; gpt_entry *gpt_e; @@ -891,24 +895,22 @@ int write_mbr_and_gpt_partitions(struct blk_desc *dev_desc, void *buf) lbaint_t lba; int cnt; - if (is_valid_gpt_buf(dev_desc, buf)) + if (is_valid_gpt_buf(desc, buf)) return -1; /* determine start of GPT Header in the buffer */ - gpt_h = buf + (GPT_PRIMARY_PARTITION_TABLE_LBA * - dev_desc->blksz); + gpt_h = buf + (GPT_PRIMARY_PARTITION_TABLE_LBA * desc->blksz); /* determine start of GPT Entries in the buffer */ - gpt_e = buf + (le64_to_cpu(gpt_h->partition_entry_lba) * - dev_desc->blksz); + gpt_e = buf + (le64_to_cpu(gpt_h->partition_entry_lba) * desc->blksz); gpt_e_blk_cnt = BLOCK_CNT((le32_to_cpu(gpt_h->num_partition_entries) * le32_to_cpu(gpt_h->sizeof_partition_entry)), - dev_desc); + desc); /* write MBR */ lba = 0; /* MBR is always at 0 */ cnt = 1; /* MBR (1 block) */ - if (blk_dwrite(dev_desc, lba, cnt, buf) != cnt) { + if (blk_dwrite(desc, lba, cnt, buf) != cnt) { log_debug("failed writing '%s' (%d blks at 0x" LBAF ")\n", "MBR", cnt, lba); return 1; @@ -917,7 +919,7 @@ int write_mbr_and_gpt_partitions(struct blk_desc *dev_desc, void *buf) /* write Primary GPT */ lba = GPT_PRIMARY_PARTITION_TABLE_LBA; cnt = 1; /* GPT Header (1 block) */ - if (blk_dwrite(dev_desc, lba, cnt, gpt_h) != cnt) { + if (blk_dwrite(desc, lba, cnt, gpt_h) != cnt) { log_debug("failed writing '%s' (%d blks at 0x" LBAF ")\n", "Primary GPT Header", cnt, lba); return 1; @@ -925,7 +927,7 @@ int write_mbr_and_gpt_partitions(struct blk_desc *dev_desc, void *buf) lba = le64_to_cpu(gpt_h->partition_entry_lba); cnt = gpt_e_blk_cnt; - if (blk_dwrite(dev_desc, lba, cnt, gpt_e) != cnt) { + if (blk_dwrite(desc, lba, cnt, gpt_e) != cnt) { log_debug("failed writing '%s' (%d blks at 0x" LBAF ")\n", "Primary GPT Entries", cnt, lba); return 1; @@ -936,7 +938,7 @@ int write_mbr_and_gpt_partitions(struct blk_desc *dev_desc, void *buf) /* write Backup GPT */ lba = le64_to_cpu(gpt_h->partition_entry_lba); cnt = gpt_e_blk_cnt; - if (blk_dwrite(dev_desc, lba, cnt, gpt_e) != cnt) { + if (blk_dwrite(desc, lba, cnt, gpt_e) != cnt) { log_debug("failed writing '%s' (%d blks at 0x" LBAF ")\n", "Backup GPT Entries", cnt, lba); return 1; @@ -944,14 +946,14 @@ int write_mbr_and_gpt_partitions(struct blk_desc *dev_desc, void *buf) lba = le64_to_cpu(gpt_h->my_lba); cnt = 1; /* GPT Header (1 block) */ - if (blk_dwrite(dev_desc, lba, cnt, gpt_h) != cnt) { + if (blk_dwrite(desc, lba, cnt, gpt_h) != cnt) { log_debug("failed writing '%s' (%d blks at 0x" LBAF ")\n", "Backup GPT Header", cnt, lba); return 1; } /* Update the partition table entries*/ - part_init(dev_desc); + part_init(desc); return 0; } @@ -978,17 +980,23 @@ static int pmbr_part_valid(struct partition *part) /* * is_pmbr_valid(): test Protective MBR for validity * + * @mbr: Pointer to Master Boot-Record data + * * Returns: 1 if PMBR is valid, 0 otherwise. * Validity depends on two things: * 1) MSDOS signature is in the last two bytes of the MBR * 2) One partition of type 0xEE is found, checked by pmbr_part_valid() */ -static int is_pmbr_valid(legacy_mbr * mbr) +static int is_pmbr_valid(legacy_mbr *mbr) { + uint sig = le16_to_cpu(mbr->signature); int i = 0; - if (!mbr || le16_to_cpu(mbr->signature) != MSDOS_MBR_SIGNATURE) + if (sig != MSDOS_MBR_SIGNATURE) { + log_debug("Invalid signature %x\n", sig); return 0; + } + log_debug("Signature %x valid\n", sig); for (i = 0; i < 4; i++) { if (pmbr_part_valid(&mbr->partition_record[i])) { @@ -1008,25 +1016,25 @@ static int is_pmbr_valid(legacy_mbr * mbr) * Description: returns 1 if valid, 0 on error, 2 if ignored header * If valid, returns pointers to PTEs. */ -static int is_gpt_valid(struct blk_desc *dev_desc, u64 lba, - gpt_header *pgpt_head, gpt_entry **pgpt_pte) +static int is_gpt_valid(struct blk_desc *desc, u64 lba, gpt_header *pgpt_head, + gpt_entry **pgpt_pte) { /* Confirm valid arguments prior to allocation. */ - if (!dev_desc || !pgpt_head) { + if (!desc || !pgpt_head) { log_debug("Invalid Argument(s)\n"); return 0; } - ALLOC_CACHE_ALIGN_BUFFER_PAD(legacy_mbr, mbr, 1, dev_desc->blksz); + ALLOC_CACHE_ALIGN_BUFFER_PAD(legacy_mbr, mbr, 1, desc->blksz); /* Read MBR Header from device */ - if (blk_dread(dev_desc, 0, 1, (ulong *)mbr) != 1) { + if (blk_dread(desc, 0, 1, (ulong *)mbr) != 1) { log_debug("Can't read MBR header\n"); return 0; } /* Read GPT Header from device */ - if (blk_dread(dev_desc, (lbaint_t)lba, 1, pgpt_head) != 1) { + if (blk_dread(desc, (lbaint_t)lba, 1, pgpt_head) != 1) { log_debug("Can't read GPT header\n"); return 0; } @@ -1037,23 +1045,23 @@ static int is_gpt_valid(struct blk_desc *dev_desc, u64 lba, return 2; } - if (validate_gpt_header(pgpt_head, (lbaint_t)lba, dev_desc->lba)) + if (validate_gpt_header(pgpt_head, (lbaint_t)lba, desc->lba)) return 0; - if (dev_desc->sig_type == SIG_TYPE_NONE) { + if (desc->sig_type == SIG_TYPE_NONE) { efi_guid_t empty = {}; if (memcmp(&pgpt_head->disk_guid, &empty, sizeof(empty))) { - dev_desc->sig_type = SIG_TYPE_GUID; - memcpy(&dev_desc->guid_sig, &pgpt_head->disk_guid, - sizeof(empty)); + desc->sig_type = SIG_TYPE_GUID; + memcpy(&desc->guid_sig, &pgpt_head->disk_guid, + sizeof(empty)); } else if (mbr->unique_mbr_signature != 0) { - dev_desc->sig_type = SIG_TYPE_MBR; - dev_desc->mbr_sig = mbr->unique_mbr_signature; + desc->sig_type = SIG_TYPE_MBR; + desc->mbr_sig = mbr->unique_mbr_signature; } } /* Read and allocate Partition Table Entries */ - *pgpt_pte = alloc_read_gpt_entries(dev_desc, pgpt_head); + *pgpt_pte = alloc_read_gpt_entries(desc, pgpt_head); if (!*pgpt_pte) return 0; @@ -1075,20 +1083,20 @@ static int is_gpt_valid(struct blk_desc *dev_desc, u64 lba, * Description: returns 1 if found a valid gpt, 0 on error. * If valid, returns pointers to PTEs. */ -static int find_valid_gpt(struct blk_desc *dev_desc, gpt_header *gpt_head, +static int find_valid_gpt(struct blk_desc *desc, gpt_header *gpt_head, gpt_entry **pgpt_pte) { int r; - r = is_gpt_valid(dev_desc, GPT_PRIMARY_PARTITION_TABLE_LBA, gpt_head, + r = is_gpt_valid(desc, GPT_PRIMARY_PARTITION_TABLE_LBA, gpt_head, pgpt_pte); if (r != 1) { if (r != 2) log_debug("Invalid GPT\n"); - if (is_gpt_valid(dev_desc, (dev_desc->lba - 1), gpt_head, - pgpt_pte) != 1) { + if (is_gpt_valid(desc, desc->lba - 1, gpt_head, pgpt_pte) + != 1) { log_debug("Invalid Backup GPT\n"); return 0; } @@ -1100,21 +1108,21 @@ static int find_valid_gpt(struct blk_desc *dev_desc, gpt_header *gpt_head, /** * alloc_read_gpt_entries(): reads partition entries from disk - * @dev_desc + * @desc * @gpt - GPT header * * Description: Returns ptes on success, NULL on error. * Allocates space for PTEs based on information found in @gpt. * Notes: remember to free pte when you're done! */ -static gpt_entry *alloc_read_gpt_entries(struct blk_desc *dev_desc, +static gpt_entry *alloc_read_gpt_entries(struct blk_desc *desc, gpt_header *pgpt_head) { size_t count = 0, blk_cnt; lbaint_t blk; gpt_entry *pte = NULL; - if (!dev_desc || !pgpt_head) { + if (!desc || !pgpt_head) { log_debug("Invalid Argument(s)\n"); return NULL; } @@ -1130,7 +1138,7 @@ static gpt_entry *alloc_read_gpt_entries(struct blk_desc *dev_desc, /* Allocate memory for PTE, remember to FREE */ if (count != 0) { pte = memalign(ARCH_DMA_MINALIGN, - PAD_TO_BLOCKSIZE(count, dev_desc)); + PAD_TO_BLOCKSIZE(count, desc)); } if (count == 0 || pte == NULL) { @@ -1141,8 +1149,8 @@ static gpt_entry *alloc_read_gpt_entries(struct blk_desc *dev_desc, /* Read GPT Entries from device */ blk = le64_to_cpu(pgpt_head->partition_entry_lba); - blk_cnt = BLOCK_CNT(count, dev_desc); - if (blk_dread(dev_desc, blk, (lbaint_t)blk_cnt, pte) != blk_cnt) { + blk_cnt = BLOCK_CNT(count, desc); + if (blk_dread(desc, blk, (lbaint_t)blk_cnt, pte) != blk_cnt) { log_debug("Can't read GPT Entries\n"); free(pte); return NULL; diff --git a/disk/part_iso.c b/disk/part_iso.c index 4cd619b..6ac6d95 100644 --- a/disk/part_iso.c +++ b/disk/part_iso.c @@ -46,7 +46,7 @@ unsigned long iso_dread(struct blk_desc *block_dev, lbaint_t start, } /* only boot records will be listed as valid partitions */ -int part_get_info_iso_verb(struct blk_desc *dev_desc, int part_num, +int part_get_info_iso_verb(struct blk_desc *desc, int part_num, struct disk_partition *info, int verb) { int i,offset,entry_num; @@ -58,23 +58,23 @@ int part_get_info_iso_verb(struct blk_desc *dev_desc, int part_num, iso_val_entry_t *pve = (iso_val_entry_t *)tmpbuf; iso_init_def_entry_t *pide; - if ((dev_desc->blksz != CD_SECTSIZE) && (dev_desc->blksz != 512)) + if (desc->blksz != CD_SECTSIZE && desc->blksz != 512) return -1; /* the first sector (sector 0x10) must be a primary volume desc */ blkaddr=PVD_OFFSET; - if (iso_dread(dev_desc, PVD_OFFSET, 1, (ulong *)tmpbuf) != 1) + if (iso_dread(desc, PVD_OFFSET, 1, (ulong *)tmpbuf) != 1) return -1; if(ppr->desctype!=0x01) { if(verb) printf ("** First descriptor is NOT a primary desc on %d:%d **\n", - dev_desc->devnum, part_num); + desc->devnum, part_num); return (-1); } if(strncmp((char *)ppr->stand_ident,"CD001",5)!=0) { if(verb) printf ("** Wrong ISO Ident: %s on %d:%d **\n", - ppr->stand_ident, dev_desc->devnum, part_num); + ppr->stand_ident, desc->devnum, part_num); return (-1); } lastsect = le32_to_cpu(ppr->firstsek_LEpathtab1_LE); @@ -83,14 +83,14 @@ int part_get_info_iso_verb(struct blk_desc *dev_desc, int part_num, PRINTF(" Lastsect:%08lx\n",lastsect); for(i=blkaddr;i<lastsect;i++) { PRINTF("Reading block %d\n", i); - if (iso_dread(dev_desc, i, 1, (ulong *)tmpbuf) != 1) + if (iso_dread(desc, i, 1, (ulong *)tmpbuf) != 1) return -1; if(ppr->desctype==0x00) break; /* boot entry found */ if(ppr->desctype==0xff) { if(verb) printf ("** No valid boot catalog found on %d:%d **\n", - dev_desc->devnum, part_num); + desc->devnum, part_num); return (-1); } } @@ -98,15 +98,15 @@ int part_get_info_iso_verb(struct blk_desc *dev_desc, int part_num, if(strncmp(pbr->ident_str,"EL TORITO SPECIFICATION",23)!=0) { if(verb) printf ("** Wrong El Torito ident: %s on %d:%d **\n", - pbr->ident_str, dev_desc->devnum, part_num); + pbr->ident_str, desc->devnum, part_num); return (-1); } bootaddr = get_unaligned_le32(pbr->pointer); PRINTF(" Boot Entry at: %08lX\n",bootaddr); - if (iso_dread(dev_desc, bootaddr, 1, (ulong *)tmpbuf) != 1) { + if (iso_dread(desc, bootaddr, 1, (ulong *)tmpbuf) != 1) { if(verb) printf ("** Can't read Boot Entry at %lX on %d:%d **\n", - bootaddr, dev_desc->devnum, part_num); + bootaddr, desc->devnum, part_num); return (-1); } chksum=0; @@ -116,20 +116,20 @@ int part_get_info_iso_verb(struct blk_desc *dev_desc, int part_num, if(chksum!=0) { if(verb) printf("** Checksum Error in booting catalog validation entry on %d:%d **\n", - dev_desc->devnum, part_num); + desc->devnum, part_num); return (-1); } if((pve->key[0]!=0x55)||(pve->key[1]!=0xAA)) { if(verb) printf ("** Key 0x55 0xAA error on %d:%d **\n", - dev_desc->devnum, part_num); + desc->devnum, part_num); return(-1); } #ifdef CHECK_FOR_POWERPC_PLATTFORM if(pve->platform!=0x01) { if(verb) printf ("** No PowerPC platform CD on %d:%d **\n", - dev_desc->devnum, part_num); + desc->devnum, part_num); return(-1); } #endif @@ -137,7 +137,7 @@ int part_get_info_iso_verb(struct blk_desc *dev_desc, int part_num, entry_num=1; offset=0x20; strcpy((char *)info->type, "U-Boot"); - part_set_generic_name(dev_desc, part_num, (char *)info->name); + part_set_generic_name(desc, part_num, (char *)info->name); /* the bootcatalog (including validation Entry) is limited to 2048Bytes * (63 boot entries + validation entry) */ while(offset<2048) { @@ -159,7 +159,7 @@ int part_get_info_iso_verb(struct blk_desc *dev_desc, int part_num, else { if(verb) printf ("** Partition %d not found on device %d **\n", - part_num, dev_desc->devnum); + part_num, desc->devnum); return(-1); } } @@ -167,13 +167,13 @@ int part_get_info_iso_verb(struct blk_desc *dev_desc, int part_num, * searched w/o succsess */ if(verb) printf ("** Partition %d not found on device %d **\n", - part_num, dev_desc->devnum); + part_num, desc->devnum); return(-1); found: if(pide->boot_ind!=0x88) { if(verb) printf("** Partition %d is not bootable on device %d **\n", - part_num, dev_desc->devnum); + part_num, desc->devnum); return (-1); } switch(pide->boot_media) { @@ -189,7 +189,7 @@ found: newblkaddr = get_unaligned_le32(pide->rel_block_addr); info->start=newblkaddr; - if (dev_desc->blksz == 512) { + if (desc->blksz == 512) { info->size *= 4; info->start *= 4; info->blksz = 512; @@ -199,20 +199,20 @@ found: return 0; } -static int part_get_info_iso(struct blk_desc *dev_desc, int part_num, +static int part_get_info_iso(struct blk_desc *desc, int part_num, struct disk_partition *info) { - return part_get_info_iso_verb(dev_desc, part_num, info, 0); + return part_get_info_iso_verb(desc, part_num, info, 0); } -static void part_print_iso(struct blk_desc *dev_desc) +static void part_print_iso(struct blk_desc *desc) { struct disk_partition info; int i; - if (part_get_info_iso_verb(dev_desc, 1, &info, 0) == -1) { + if (part_get_info_iso_verb(desc, 1, &info, 0) == -1) { printf("** No boot partition found on device %d **\n", - dev_desc->devnum); + desc->devnum); return; } printf("Part Start Sect x Size Type\n"); @@ -221,14 +221,14 @@ static void part_print_iso(struct blk_desc *dev_desc) printf(" %2d %8" LBAFlength "u %8" LBAFlength "u %6ld %.32s\n", i, info.start, info.size, info.blksz, info.type); i++; - } while (part_get_info_iso_verb(dev_desc, i, &info, 0) != -1); + } while (part_get_info_iso_verb(desc, i, &info, 0) != -1); } -static int part_test_iso(struct blk_desc *dev_desc) +static int part_test_iso(struct blk_desc *desc) { struct disk_partition info; - return part_get_info_iso_verb(dev_desc, 1, &info, 0); + return part_get_info_iso_verb(desc, 1, &info, 0); } U_BOOT_PART_TYPE(iso) = { diff --git a/disk/part_mac.c b/disk/part_mac.c index ae8263f..db5e203 100644 --- a/disk/part_mac.c +++ b/disk/part_mac.c @@ -31,21 +31,20 @@ extern ldiv_t ldiv (long int __numer, long int __denom); #endif -static int part_mac_read_ddb(struct blk_desc *dev_desc, - mac_driver_desc_t *ddb_p); -static int part_mac_read_pdb(struct blk_desc *dev_desc, int part, +static int part_mac_read_ddb(struct blk_desc *desc, mac_driver_desc_t *ddb_p); +static int part_mac_read_pdb(struct blk_desc *desc, int part, mac_partition_t *pdb_p); /* * Test for a valid MAC partition */ -static int part_test_mac(struct blk_desc *dev_desc) +static int part_test_mac(struct blk_desc *desc) { ALLOC_CACHE_ALIGN_BUFFER(mac_driver_desc_t, ddesc, 1); ALLOC_CACHE_ALIGN_BUFFER(mac_partition_t, mpart, 1); ulong i, n; - if (part_mac_read_ddb (dev_desc, ddesc)) { + if (part_mac_read_ddb(desc, ddesc)) { /* * error reading Driver Descriptor Block, * or no valid Signature @@ -55,8 +54,8 @@ static int part_test_mac(struct blk_desc *dev_desc) n = 1; /* assuming at least one partition */ for (i=1; i<=n; ++i) { - if ((blk_dread(dev_desc, i, 1, (ulong *)mpart) != 1) || - (mpart->signature != MAC_PARTITION_MAGIC) ) { + if ((blk_dread(desc, i, 1, (ulong *)mpart) != 1) || + mpart->signature != MAC_PARTITION_MAGIC) { return (-1); } /* update partition count */ @@ -65,14 +64,14 @@ static int part_test_mac(struct blk_desc *dev_desc) return (0); } -static void part_print_mac(struct blk_desc *dev_desc) +static void part_print_mac(struct blk_desc *desc) { ulong i, n; ALLOC_CACHE_ALIGN_BUFFER(mac_driver_desc_t, ddesc, 1); ALLOC_CACHE_ALIGN_BUFFER(mac_partition_t, mpart, 1); ldiv_t mb, gb; - if (part_mac_read_ddb (dev_desc, ddesc)) { + if (part_mac_read_ddb(desc, ddesc)) { /* * error reading Driver Descriptor Block, * or no valid Signature @@ -110,15 +109,15 @@ static void part_print_mac(struct blk_desc *dev_desc) char c; printf ("%4ld: ", i); - if (blk_dread(dev_desc, i, 1, (ulong *)mpart) != 1) { + if (blk_dread(desc, i, 1, (ulong *)mpart) != 1) { printf ("** Can't read Partition Map on %d:%ld **\n", - dev_desc->devnum, i); + desc->devnum, i); return; } if (mpart->signature != MAC_PARTITION_MAGIC) { printf("** Bad Signature on %d:%ld - expected 0x%04x, got 0x%04x\n", - dev_desc->devnum, i, MAC_PARTITION_MAGIC, + desc->devnum, i, MAC_PARTITION_MAGIC, mpart->signature); return; } @@ -154,10 +153,9 @@ static void part_print_mac(struct blk_desc *dev_desc) /* * Read Device Descriptor Block */ -static int part_mac_read_ddb(struct blk_desc *dev_desc, - mac_driver_desc_t *ddb_p) +static int part_mac_read_ddb(struct blk_desc *desc, mac_driver_desc_t *ddb_p) { - if (blk_dread(dev_desc, 0, 1, (ulong *)ddb_p) != 1) { + if (blk_dread(desc, 0, 1, (ulong *)ddb_p) != 1) { debug("** Can't read Driver Descriptor Block **\n"); return (-1); } @@ -171,7 +169,7 @@ static int part_mac_read_ddb(struct blk_desc *dev_desc, /* * Read Partition Descriptor Block */ -static int part_mac_read_pdb(struct blk_desc *dev_desc, int part, +static int part_mac_read_pdb(struct blk_desc *desc, int part, mac_partition_t *pdb_p) { int n = 1; @@ -182,15 +180,15 @@ static int part_mac_read_pdb(struct blk_desc *dev_desc, int part, * partition 1 first since this is the only way to * know how many partitions we have. */ - if (blk_dread(dev_desc, n, 1, (ulong *)pdb_p) != 1) { - printf ("** Can't read Partition Map on %d:%d **\n", - dev_desc->devnum, n); + if (blk_dread(desc, n, 1, (ulong *)pdb_p) != 1) { + printf("** Can't read Partition Map on %d:%d **\n", + desc->devnum, n); return (-1); } if (pdb_p->signature != MAC_PARTITION_MAGIC) { printf("** Bad Signature on %d:%d: expected 0x%04x, got 0x%04x\n", - dev_desc->devnum, n, MAC_PARTITION_MAGIC, + desc->devnum, n, MAC_PARTITION_MAGIC, pdb_p->signature); return (-1); } @@ -199,10 +197,9 @@ static int part_mac_read_pdb(struct blk_desc *dev_desc, int part, return (0); if ((part < 1) || (part > pdb_p->map_count)) { - printf ("** Invalid partition %d:%d [%d:1...%d:%d only]\n", - dev_desc->devnum, part, - dev_desc->devnum, - dev_desc->devnum, pdb_p->map_count); + printf("** Invalid partition %d:%d [%d:1...%d:%d only]\n", + desc->devnum, part, desc->devnum, desc->devnum, + pdb_p->map_count); return (-1); } @@ -213,21 +210,19 @@ static int part_mac_read_pdb(struct blk_desc *dev_desc, int part, /* NOTREACHED */ } -static int part_get_info_mac(struct blk_desc *dev_desc, int part, - struct disk_partition *info) +static int part_get_info_mac(struct blk_desc *desc, int part, + struct disk_partition *info) { ALLOC_CACHE_ALIGN_BUFFER(mac_driver_desc_t, ddesc, 1); ALLOC_CACHE_ALIGN_BUFFER(mac_partition_t, mpart, 1); - if (part_mac_read_ddb (dev_desc, ddesc)) { - return (-1); - } + if (part_mac_read_ddb(desc, ddesc)) + return -1; info->blksz = ddesc->blk_size; - if (part_mac_read_pdb (dev_desc, part, mpart)) { - return (-1); - } + if (part_mac_read_pdb(desc, part, mpart)) + return -1; info->start = mpart->start_block; info->size = mpart->block_count; diff --git a/doc/README.POST b/doc/README.POST index 1366f95..c614ea4 100644 --- a/doc/README.POST +++ b/doc/README.POST @@ -138,11 +138,6 @@ The POST layer will export the following interface routines: mode the test is executed in (power-on, normal, power-fail, manual). - o) void post_reloc(ulong offset); - - This routine will be called from board_init_r() and will - relocate the POST test table. - o) int post_info(char *name); This routine will print the list of all POST tests that can be diff --git a/doc/arch/index.rst b/doc/arch/index.rst index 2f916f4..60c93b3 100644 --- a/doc/arch/index.rst +++ b/doc/arch/index.rst @@ -15,5 +15,5 @@ Architecture-specific doc riscv sandbox/index sh - x86 + x86/index xtensa diff --git a/doc/arch/x86/index.rst b/doc/arch/x86/index.rst new file mode 100644 index 0000000..69db0a5 --- /dev/null +++ b/doc/arch/x86/index.rst @@ -0,0 +1,12 @@ +.. SPDX-License-Identifier: GPL-2.0+ */ +.. Copyright 2023 Google LLC +.. sectionauthor:: Simon Glass <sjg@chromium.org> + +x86 +=== + +.. toctree:: + :maxdepth: 2 + + x86 + manual_boot diff --git a/doc/arch/x86/manual_boot.rst b/doc/arch/x86/manual_boot.rst new file mode 100644 index 0000000..ec069f2 --- /dev/null +++ b/doc/arch/x86/manual_boot.rst @@ -0,0 +1,276 @@ +Booting Ubuntu Manually +----------------------- + +This shows a manual approach to booting Ubuntu without standard boot or the EFI +interface. + +As an example of how to set up your boot flow with U-Boot, here are +instructions for starting Ubuntu from U-Boot. These instructions have been +tested on Minnowboard MAX with a SATA drive but are equally applicable on +other platforms and other media. There are really only four steps and it's a +very simple script, but a more detailed explanation is provided here for +completeness. + +Note: It is possible to set up U-Boot to boot automatically using syslinux. +It could also use the grub.cfg file (/efi/ubuntu/grub.cfg) to obtain the +GUID. If you figure these out, please post patches to this README. + +Firstly, you will need Ubuntu installed on an available disk. It should be +possible to make U-Boot start a USB start-up disk but for now let's assume +that you used another boot loader to install Ubuntu. + +Use the U-Boot command line to find the UUID of the partition you want to +boot. For example our disk is SCSI device 0:: + + => part list scsi 0 + + Partition Map for SCSI device 0 -- Partition Type: EFI + + Part Start LBA End LBA Name + Attributes + Type GUID + Partition GUID + 1 0x00000800 0x001007ff "" + attrs: 0x0000000000000000 + type: c12a7328-f81f-11d2-ba4b-00a0c93ec93b + guid: 9d02e8e4-4d59-408f-a9b0-fd497bc9291c + 2 0x00100800 0x037d8fff "" + attrs: 0x0000000000000000 + type: 0fc63daf-8483-4772-8e79-3d69d8477de4 + guid: 965c59ee-1822-4326-90d2-b02446050059 + 3 0x037d9000 0x03ba27ff "" + attrs: 0x0000000000000000 + type: 0657fd6d-a4ab-43c4-84e5-0933c84b4f4f + guid: 2c4282bd-1e82-4bcf-a5ff-51dedbf39f17 + => + +This shows that your SCSI disk has three partitions. The really long hex +strings are called Globally Unique Identifiers (GUIDs). You can look up the +'type' ones `here`_. On this disk the first partition is for EFI and is in +VFAT format (DOS/Windows):: + + => fatls scsi 0:1 + efi/ + + 0 file(s), 1 dir(s) + + +Partition 2 is 'Linux filesystem data' so that will be our root disk. It is +in ext2 format:: + + => ext2ls scsi 0:2 + <DIR> 4096 . + <DIR> 4096 .. + <DIR> 16384 lost+found + <DIR> 4096 boot + <DIR> 12288 etc + <DIR> 4096 media + <DIR> 4096 bin + <DIR> 4096 dev + <DIR> 4096 home + <DIR> 4096 lib + <DIR> 4096 lib64 + <DIR> 4096 mnt + <DIR> 4096 opt + <DIR> 4096 proc + <DIR> 4096 root + <DIR> 4096 run + <DIR> 12288 sbin + <DIR> 4096 srv + <DIR> 4096 sys + <DIR> 4096 tmp + <DIR> 4096 usr + <DIR> 4096 var + <SYM> 33 initrd.img + <SYM> 30 vmlinuz + <DIR> 4096 cdrom + <SYM> 33 initrd.img.old + => + +and if you look in the /boot directory you will see the kernel:: + + => ext2ls scsi 0:2 /boot + <DIR> 4096 . + <DIR> 4096 .. + <DIR> 4096 efi + <DIR> 4096 grub + 3381262 System.map-3.13.0-32-generic + 1162712 abi-3.13.0-32-generic + 165611 config-3.13.0-32-generic + 176500 memtest86+.bin + 178176 memtest86+.elf + 178680 memtest86+_multiboot.bin + 5798112 vmlinuz-3.13.0-32-generic + 165762 config-3.13.0-58-generic + 1165129 abi-3.13.0-58-generic + 5823136 vmlinuz-3.13.0-58-generic + 19215259 initrd.img-3.13.0-58-generic + 3391763 System.map-3.13.0-58-generic + 5825048 vmlinuz-3.13.0-58-generic.efi.signed + 28304443 initrd.img-3.13.0-32-generic + => + +The 'vmlinuz' files contain a packaged Linux kernel. The format is a kind of +self-extracting compressed file mixed with some 'setup' configuration data. +Despite its size (uncompressed it is >10MB) this only includes a basic set of +device drivers, enough to boot on most hardware types. + +The 'initrd' files contain a RAM disk. This is something that can be loaded +into RAM and will appear to Linux like a disk. Ubuntu uses this to hold lots +of drivers for whatever hardware you might have. It is loaded before the +real root disk is accessed. + +The numbers after the end of each file are the version. Here it is Linux +version 3.13. You can find the source code for this in the Linux tree with +the tag v3.13. The '.0' allows for additional Linux releases to fix problems, +but normally this is not needed. The '-58' is used by Ubuntu. Each time they +release a new kernel they increment this number. New Ubuntu versions might +include kernel patches to fix reported bugs. Stable kernels can exist for +some years so this number can get quite high. + +The '.efi.signed' kernel is signed for EFI's secure boot. U-Boot has its own +secure boot mechanism - see `this`_ & `that`_. It cannot read .efi files +at present. + +To boot Ubuntu from U-Boot the steps are as follows: + +1. Set up the boot arguments. Use the GUID for the partition you want to boot:: + + => setenv bootargs root=/dev/disk/by-partuuid/965c59ee-1822-4326-90d2-b02446050059 ro + +Here root= tells Linux the location of its root disk. The disk is specified +by its GUID, using '/dev/disk/by-partuuid/', a Linux path to a 'directory' +containing all the GUIDs Linux has found. When it starts up, there will be a +file in that directory with this name in it. It is also possible to use a +device name here, see later. + +2. Load the kernel. Since it is an ext2/4 filesystem we can do:: + + => ext2load scsi 0:2 03000000 /boot/vmlinuz-3.13.0-58-generic + +The address 30000000 is arbitrary, but there seem to be problems with using +small addresses (sometimes Linux cannot find the ramdisk). This is 48MB into +the start of RAM (which is at 0 on x86). + +3. Load the ramdisk (to 64MB):: + + => ext2load scsi 0:2 04000000 /boot/initrd.img-3.13.0-58-generic + +4. Start up the kernel. We need to know the size of the ramdisk, but can use + a variable for that. U-Boot sets 'filesize' to the size of the last file it + loaded:: + + => zboot 03000000 0 04000000 ${filesize} + +Type 'help zboot' if you want to see what the arguments are. U-Boot on x86 is +quite verbose when it boots a kernel. You should see these messages from +U-Boot:: + + Valid Boot Flag + Setup Size = 0x00004400 + Magic signature found + Using boot protocol version 2.0c + Linux kernel version 3.13.0-58-generic (buildd@allspice) #97-Ubuntu SMP Wed Jul 8 02:56:15 UTC 2015 + Building boot_params at 0x00090000 + Loading bzImage at address 100000 (5805728 bytes) + Magic signature found + Initial RAM disk at linear address 0x04000000, size 19215259 bytes + Kernel command line: "root=/dev/disk/by-partuuid/965c59ee-1822-4326-90d2-b02446050059 ro" + + Starting kernel ... + +U-Boot prints out some bootstage timing. This is more useful if you put the +above commands into a script since then it will be faster:: + + Timer summary in microseconds: + Mark Elapsed Stage + 0 0 reset + 241,535 241,535 board_init_r + 2,421,611 2,180,076 id=64 + 2,421,790 179 id=65 + 2,428,215 6,425 main_loop + 48,860,584 46,432,369 start_kernel + + Accumulated time: + 240,329 ahci + 1,422,704 vesa display + +Now the kernel actually starts (if you want to examine kernel boot up message on +the serial console, append "console=ttyS0,115200" to the kernel command line):: + + [ 0.000000] Initializing cgroup subsys cpuset + [ 0.000000] Initializing cgroup subsys cpu + [ 0.000000] Initializing cgroup subsys cpuacct + [ 0.000000] Linux version 3.13.0-58-generic (buildd@allspice) (gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1) ) #97-Ubuntu SMP Wed Jul 8 02:56:15 UTC 2015 (Ubuntu 3.13.0-58.97-generic 3.13.11-ckt22) + [ 0.000000] Command line: root=/dev/disk/by-partuuid/965c59ee-1822-4326-90d2-b02446050059 ro console=ttyS0,115200 + +It continues for a long time. Along the way you will see it pick up your +ramdisk:: + + [ 0.000000] RAMDISK: [mem 0x04000000-0x05253fff] + ... + [ 0.788540] Trying to unpack rootfs image as initramfs... + [ 1.540111] Freeing initrd memory: 18768K (ffff880004000000 - ffff880005254000) + ... + +Later it actually starts using it:: + + Begin: Running /scripts/local-premount ... done. + +You should also see your boot disk turn up:: + + [ 4.357243] scsi 1:0:0:0: Direct-Access ATA ADATA SP310 5.2 PQ: 0 ANSI: 5 + [ 4.366860] sd 1:0:0:0: [sda] 62533296 512-byte logical blocks: (32.0 GB/29.8 GiB) + [ 4.375677] sd 1:0:0:0: Attached scsi generic sg0 type 0 + [ 4.381859] sd 1:0:0:0: [sda] Write Protect is off + [ 4.387452] sd 1:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA + [ 4.399535] sda: sda1 sda2 sda3 + +Linux has found the three partitions (sda1-3). Mercifully it doesn't print out +the GUIDs. In step 1 above we could have used:: + + setenv bootargs root=/dev/sda2 ro + +instead of the GUID. However if you add another drive to your board the +numbering may change whereas the GUIDs will not. So if your boot partition +becomes sdb2, it will still boot. For embedded systems where you just want to +boot the first disk, you have that option. + +The last thing you will see on the console is mention of plymouth (which +displays the Ubuntu start-up screen) and a lot of 'Starting' messages:: + + * Starting Mount filesystems on boot [ OK ] + +After a pause you should see a login screen on your display and you are done. + +If you want to put this in a script you can use something like this:: + + setenv bootargs root=UUID=b2aaf743-0418-4d90-94cc-3e6108d7d968 ro + setenv boot zboot 03000000 0 04000000 \${filesize} + setenv bootcmd "ext2load scsi 0:2 03000000 /boot/vmlinuz-3.13.0-58-generic; ext2load scsi 0:2 04000000 /boot/initrd.img-3.13.0-58-generic; run boot" + saveenv + +The \ is to tell the shell not to evaluate ${filesize} as part of the setenv +command. + +You can also bake this behaviour into your build by hard-coding the +environment variables if you add this to minnowmax.h: + +.. code-block:: c + + #undef CONFIG_BOOTCOMMAND + #define CONFIG_BOOTCOMMAND \ + "ext2load scsi 0:2 03000000 /boot/vmlinuz-3.13.0-58-generic; " \ + "ext2load scsi 0:2 04000000 /boot/initrd.img-3.13.0-58-generic; " \ + "run boot" + + #undef CFG_EXTRA_ENV_SETTINGS + #define CFG_EXTRA_ENV_SETTINGS "boot=zboot 03000000 0 04000000 ${filesize}" + +and change CONFIG_BOOTARGS value in configs/minnowmax_defconfig to:: + + CONFIG_BOOTARGS="root=/dev/sda2 ro" + +.. _here: https://en.wikipedia.org/wiki/GUID_Partition_Table +.. _this: http://events.linuxfoundation.org/sites/events/files/slides/chromeos_and_diy_vboot_0.pdf +.. _that: http://events.linuxfoundation.org/sites/events/files/slides/elce-2014.pdf diff --git a/doc/arch/x86.rst b/doc/arch/x86/x86.rst index 725a1ae..f67216d 100644 --- a/doc/arch/x86.rst +++ b/doc/arch/x86/x86.rst @@ -11,9 +11,9 @@ including supported boards, build instructions, todo list, etc. Status ------ U-Boot supports running as a `coreboot`_ payload on x86. So far only Link -(Chromebook Pixel) and `QEMU`_ x86 targets have been tested, but it should -work with minimal adjustments on other x86 boards since coreboot deals with -most of the low-level details. +(Chromebook Pixel), Brya (Alder Lake Chromebook) and `QEMU`_ x86 targets have +been tested, but it should work with minimal adjustments on other x86 boards +since coreboot deals with most of the low-level details. U-Boot is a main bootloader on Intel Edison board. @@ -25,18 +25,21 @@ are supported: - Bayley Bay CRB - Cherry Hill CRB - Congatec QEVAL 2.0 & conga-QA3/E3845 + - Coral (Apollo Lake - Chromebook 2017) - Cougar Canyon 2 CRB - Crown Bay CRB - Galileo - - Link (Chromebook Pixel) + - Link (Ivy Bridge - Chromebook Pixel) - Minnowboard MAX - - Samus (Chromebook Pixel 2015) + - Samus (Broadwell - Chromebook Pixel 2015) + - Coral (Apollo Lake Chromebooks circa 2017) - QEMU x86 (32-bit & 64-bit) As for loading an OS, U-Boot supports directly booting a 32-bit or 64-bit Linux kernel as part of a FIT image. It also supports a compressed zImage. U-Boot supports loading an x86 VxWorks kernel. Please check README.vxworks -for more details. +for more details. Finally, U-Boot can boot Linux distributions with a UEFI +interface. Build Instructions for U-Boot as BIOS replacement (bare mode) ------------------------------------------------------------- @@ -95,272 +98,9 @@ mtrr Booting Ubuntu -------------- -As an example of how to set up your boot flow with U-Boot, here are -instructions for starting Ubuntu from U-Boot. These instructions have been -tested on Minnowboard MAX with a SATA drive but are equally applicable on -other platforms and other media. There are really only four steps and it's a -very simple script, but a more detailed explanation is provided here for -completeness. - -Note: It is possible to set up U-Boot to boot automatically using syslinux. -It could also use the grub.cfg file (/efi/ubuntu/grub.cfg) to obtain the -GUID. If you figure these out, please post patches to this README. - -Firstly, you will need Ubuntu installed on an available disk. It should be -possible to make U-Boot start a USB start-up disk but for now let's assume -that you used another boot loader to install Ubuntu. - -Use the U-Boot command line to find the UUID of the partition you want to -boot. For example our disk is SCSI device 0:: - - => part list scsi 0 - - Partition Map for SCSI device 0 -- Partition Type: EFI - - Part Start LBA End LBA Name - Attributes - Type GUID - Partition GUID - 1 0x00000800 0x001007ff "" - attrs: 0x0000000000000000 - type: c12a7328-f81f-11d2-ba4b-00a0c93ec93b - guid: 9d02e8e4-4d59-408f-a9b0-fd497bc9291c - 2 0x00100800 0x037d8fff "" - attrs: 0x0000000000000000 - type: 0fc63daf-8483-4772-8e79-3d69d8477de4 - guid: 965c59ee-1822-4326-90d2-b02446050059 - 3 0x037d9000 0x03ba27ff "" - attrs: 0x0000000000000000 - type: 0657fd6d-a4ab-43c4-84e5-0933c84b4f4f - guid: 2c4282bd-1e82-4bcf-a5ff-51dedbf39f17 - => - -This shows that your SCSI disk has three partitions. The really long hex -strings are called Globally Unique Identifiers (GUIDs). You can look up the -'type' ones `here`_. On this disk the first partition is for EFI and is in -VFAT format (DOS/Windows):: - - => fatls scsi 0:1 - efi/ - - 0 file(s), 1 dir(s) - - -Partition 2 is 'Linux filesystem data' so that will be our root disk. It is -in ext2 format:: - - => ext2ls scsi 0:2 - <DIR> 4096 . - <DIR> 4096 .. - <DIR> 16384 lost+found - <DIR> 4096 boot - <DIR> 12288 etc - <DIR> 4096 media - <DIR> 4096 bin - <DIR> 4096 dev - <DIR> 4096 home - <DIR> 4096 lib - <DIR> 4096 lib64 - <DIR> 4096 mnt - <DIR> 4096 opt - <DIR> 4096 proc - <DIR> 4096 root - <DIR> 4096 run - <DIR> 12288 sbin - <DIR> 4096 srv - <DIR> 4096 sys - <DIR> 4096 tmp - <DIR> 4096 usr - <DIR> 4096 var - <SYM> 33 initrd.img - <SYM> 30 vmlinuz - <DIR> 4096 cdrom - <SYM> 33 initrd.img.old - => - -and if you look in the /boot directory you will see the kernel:: - - => ext2ls scsi 0:2 /boot - <DIR> 4096 . - <DIR> 4096 .. - <DIR> 4096 efi - <DIR> 4096 grub - 3381262 System.map-3.13.0-32-generic - 1162712 abi-3.13.0-32-generic - 165611 config-3.13.0-32-generic - 176500 memtest86+.bin - 178176 memtest86+.elf - 178680 memtest86+_multiboot.bin - 5798112 vmlinuz-3.13.0-32-generic - 165762 config-3.13.0-58-generic - 1165129 abi-3.13.0-58-generic - 5823136 vmlinuz-3.13.0-58-generic - 19215259 initrd.img-3.13.0-58-generic - 3391763 System.map-3.13.0-58-generic - 5825048 vmlinuz-3.13.0-58-generic.efi.signed - 28304443 initrd.img-3.13.0-32-generic - => - -The 'vmlinuz' files contain a packaged Linux kernel. The format is a kind of -self-extracting compressed file mixed with some 'setup' configuration data. -Despite its size (uncompressed it is >10MB) this only includes a basic set of -device drivers, enough to boot on most hardware types. - -The 'initrd' files contain a RAM disk. This is something that can be loaded -into RAM and will appear to Linux like a disk. Ubuntu uses this to hold lots -of drivers for whatever hardware you might have. It is loaded before the -real root disk is accessed. - -The numbers after the end of each file are the version. Here it is Linux -version 3.13. You can find the source code for this in the Linux tree with -the tag v3.13. The '.0' allows for additional Linux releases to fix problems, -but normally this is not needed. The '-58' is used by Ubuntu. Each time they -release a new kernel they increment this number. New Ubuntu versions might -include kernel patches to fix reported bugs. Stable kernels can exist for -some years so this number can get quite high. - -The '.efi.signed' kernel is signed for EFI's secure boot. U-Boot has its own -secure boot mechanism - see `this`_ & `that`_. It cannot read .efi files -at present. - -To boot Ubuntu from U-Boot the steps are as follows: - -1. Set up the boot arguments. Use the GUID for the partition you want to boot:: - - => setenv bootargs root=/dev/disk/by-partuuid/965c59ee-1822-4326-90d2-b02446050059 ro - -Here root= tells Linux the location of its root disk. The disk is specified -by its GUID, using '/dev/disk/by-partuuid/', a Linux path to a 'directory' -containing all the GUIDs Linux has found. When it starts up, there will be a -file in that directory with this name in it. It is also possible to use a -device name here, see later. - -2. Load the kernel. Since it is an ext2/4 filesystem we can do:: - - => ext2load scsi 0:2 03000000 /boot/vmlinuz-3.13.0-58-generic - -The address 30000000 is arbitrary, but there seem to be problems with using -small addresses (sometimes Linux cannot find the ramdisk). This is 48MB into -the start of RAM (which is at 0 on x86). - -3. Load the ramdisk (to 64MB):: - - => ext2load scsi 0:2 04000000 /boot/initrd.img-3.13.0-58-generic - -4. Start up the kernel. We need to know the size of the ramdisk, but can use - a variable for that. U-Boot sets 'filesize' to the size of the last file it - loaded:: - - => zboot 03000000 0 04000000 ${filesize} - -Type 'help zboot' if you want to see what the arguments are. U-Boot on x86 is -quite verbose when it boots a kernel. You should see these messages from -U-Boot:: - - Valid Boot Flag - Setup Size = 0x00004400 - Magic signature found - Using boot protocol version 2.0c - Linux kernel version 3.13.0-58-generic (buildd@allspice) #97-Ubuntu SMP Wed Jul 8 02:56:15 UTC 2015 - Building boot_params at 0x00090000 - Loading bzImage at address 100000 (5805728 bytes) - Magic signature found - Initial RAM disk at linear address 0x04000000, size 19215259 bytes - Kernel command line: "root=/dev/disk/by-partuuid/965c59ee-1822-4326-90d2-b02446050059 ro" - - Starting kernel ... - -U-Boot prints out some bootstage timing. This is more useful if you put the -above commands into a script since then it will be faster:: - - Timer summary in microseconds: - Mark Elapsed Stage - 0 0 reset - 241,535 241,535 board_init_r - 2,421,611 2,180,076 id=64 - 2,421,790 179 id=65 - 2,428,215 6,425 main_loop - 48,860,584 46,432,369 start_kernel - - Accumulated time: - 240,329 ahci - 1,422,704 vesa display - -Now the kernel actually starts (if you want to examine kernel boot up message on -the serial console, append "console=ttyS0,115200" to the kernel command line):: - - [ 0.000000] Initializing cgroup subsys cpuset - [ 0.000000] Initializing cgroup subsys cpu - [ 0.000000] Initializing cgroup subsys cpuacct - [ 0.000000] Linux version 3.13.0-58-generic (buildd@allspice) (gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1) ) #97-Ubuntu SMP Wed Jul 8 02:56:15 UTC 2015 (Ubuntu 3.13.0-58.97-generic 3.13.11-ckt22) - [ 0.000000] Command line: root=/dev/disk/by-partuuid/965c59ee-1822-4326-90d2-b02446050059 ro console=ttyS0,115200 - -It continues for a long time. Along the way you will see it pick up your -ramdisk:: - - [ 0.000000] RAMDISK: [mem 0x04000000-0x05253fff] - ... - [ 0.788540] Trying to unpack rootfs image as initramfs... - [ 1.540111] Freeing initrd memory: 18768K (ffff880004000000 - ffff880005254000) - ... - -Later it actually starts using it:: - - Begin: Running /scripts/local-premount ... done. - -You should also see your boot disk turn up:: - - [ 4.357243] scsi 1:0:0:0: Direct-Access ATA ADATA SP310 5.2 PQ: 0 ANSI: 5 - [ 4.366860] sd 1:0:0:0: [sda] 62533296 512-byte logical blocks: (32.0 GB/29.8 GiB) - [ 4.375677] sd 1:0:0:0: Attached scsi generic sg0 type 0 - [ 4.381859] sd 1:0:0:0: [sda] Write Protect is off - [ 4.387452] sd 1:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA - [ 4.399535] sda: sda1 sda2 sda3 - -Linux has found the three partitions (sda1-3). Mercifully it doesn't print out -the GUIDs. In step 1 above we could have used:: - - setenv bootargs root=/dev/sda2 ro - -instead of the GUID. However if you add another drive to your board the -numbering may change whereas the GUIDs will not. So if your boot partition -becomes sdb2, it will still boot. For embedded systems where you just want to -boot the first disk, you have that option. - -The last thing you will see on the console is mention of plymouth (which -displays the Ubuntu start-up screen) and a lot of 'Starting' messages:: - - * Starting Mount filesystems on boot [ OK ] - -After a pause you should see a login screen on your display and you are done. - -If you want to put this in a script you can use something like this:: - - setenv bootargs root=UUID=b2aaf743-0418-4d90-94cc-3e6108d7d968 ro - setenv boot zboot 03000000 0 04000000 \${filesize} - setenv bootcmd "ext2load scsi 0:2 03000000 /boot/vmlinuz-3.13.0-58-generic; ext2load scsi 0:2 04000000 /boot/initrd.img-3.13.0-58-generic; run boot" - saveenv - -The \ is to tell the shell not to evaluate ${filesize} as part of the setenv -command. - -You can also bake this behaviour into your build by hard-coding the -environment variables if you add this to minnowmax.h: - -.. code-block:: c - - #undef CONFIG_BOOTCOMMAND - #define CONFIG_BOOTCOMMAND \ - "ext2load scsi 0:2 03000000 /boot/vmlinuz-3.13.0-58-generic; " \ - "ext2load scsi 0:2 04000000 /boot/initrd.img-3.13.0-58-generic; " \ - "run boot" - - #undef CFG_EXTRA_ENV_SETTINGS - #define CFG_EXTRA_ENV_SETTINGS "boot=zboot 03000000 0 04000000 ${filesize}" - -and change CONFIG_BOOTARGS value in configs/minnowmax_defconfig to:: - - CONFIG_BOOTARGS="root=/dev/sda2 ro" +Typically U-Boot boots distributions automatically so long an `CONFIG_BOOTSTD`, +`CONFIG_BOOTSTD_DEFAULTS` and `CONFIG_EFI_LOADER` are enabled. See +:doc:`manual_boot` for how to do this manually. Test with SeaBIOS ----------------- @@ -695,14 +435,15 @@ to load a 'u-boot-payload.efi', see below test logs on QEMU. No controllers found Hit any key to stop autoboot: 0 -See :doc:`../develop/uefi/u-boot_on_efi` and :doc:`../develop/uefi/uefi` for -details of EFI support in U-Boot. +See :doc:`../../develop/uefi/u-boot_on_efi` and :doc:`../../develop/uefi/uefi` +for details of EFI support in U-Boot. Chain-loading ------------- -U-Boot can be chain-loaded from another bootloader, such as coreboot or -Slim Bootloader. Typically this is done by building for targets 'coreboot' or -'slimbootloader'. +U-Boot can be chain-loaded from another bootloader, such as +:doc:`../../board/coreboot/index` coreboot or +:doc:`../../board/intel/slimbootloader`. Typically this is done by building for +targets 'coreboot' or 'slimbootloader'. For example, at present we have a 'coreboot' target but this runs very different code from the bare-metal targets, such as coral. There is very little @@ -732,7 +473,7 @@ SMBIOS tables To generate SMBIOS tables in U-Boot, for use by the OS, enable the CONFIG_GENERATE_SMBIOS_TABLE option. The easiest way to provide the values to use is via the device tree. For details see -:download:`smbios.txt <../device-tree-bindings/sysinfo/smbios.txt>`. +:download:`smbios.txt <../../device-tree-bindings/sysinfo/smbios.txt>`. TODO List --------- @@ -744,8 +485,5 @@ TODO List .. _microcode: http://en.wikipedia.org/wiki/Microcode .. _SFI: http://simplefirmware.org .. _MP: http://www.intel.com/design/archives/processors/pro/docs/242016.htm -.. _here: https://en.wikipedia.org/wiki/GUID_Partition_Table -.. _this: http://events.linuxfoundation.org/sites/events/files/slides/chromeos_and_diy_vboot_0.pdf -.. _that: http://events.linuxfoundation.org/sites/events/files/slides/elce-2014.pdf .. _SeaBIOS: http://www.seabios.org/SeaBIOS .. _ACPI: http://www.acpi.info diff --git a/doc/board/coreboot/coreboot.rst b/doc/board/coreboot/coreboot.rst index d660a22..10a251c 100644 --- a/doc/board/coreboot/coreboot.rst +++ b/doc/board/coreboot/coreboot.rst @@ -41,15 +41,56 @@ At present it seems that for Minnowboard Max, coreboot does not pass through the video information correctly (it always says the resolution is 0x0). This works correctly for link though. +You can run via QEMU using:: + + qemu-system-x86_64 -bios build/coreboot.rom -serial mon:stdio + +The `-serial mon:stdio` part shows both output in the display and on the +console. It is optional. You can add `nographic` as well to *only* get console +output. + +To run with a SATA drive called `$DISK`:: + + qemu-system-x86_64 -bios build/coreboot.rom -serial mon:stdio \ + -drive id=disk,file=$DISK,if=none \ + -device ahci,id=ahci \ + -device ide-hd,drive=disk,bus=ahci.0 + +Then you can scan it with `scsi scan` and access it normally. + +To use 4GB of memory, typically necessary for booting Linux distros, add +`-m 4GB`. + 64-bit U-Boot ------------- In addition to the 32-bit 'coreboot' build there is a 'coreboot64' build. This produces an image which can be booted from coreboot (32-bit). Internally it works by using a 32-bit SPL binary to switch to 64-bit for running U-Boot. It -can be useful for running UEFI applications, for example. +can be useful for running UEFI applications, for example with the coreboot +build in `$CBDIR`:: + + DISK=ubuntu-23.04-desktop-amd64.iso + CBDIR=~/coreboot/build + + cp $CBDIR/coreboot.rom.in coreboot.rom + cbfstool coreboot.rom add-flat-binary -f u-boot-x86-with-spl.bin \ + -n fallback/payload -c lzma -l 0x1110000 -e 0x1110000 + + qemu-system-x86_64 -m 2G -smp 4 -bios coreboot.rom \ + -drive id=disk,file=$DISK,if=none \ + -device ahci,id=ahci \ + -device ide-hd,drive=disk,bus=ahci.0 \ + +This allows booting and installing various distros, many of which are +64-bit-only, so cannot work with the 32-bit 'coreboot' build. + +USB keyboard +------------ -This has only been lightly tested. +The `CONFIG_USE_PREBOOT` option is enabled by default, meaning that USB starts +up just before the command-line starts. This allows user interaction on +non-laptop devices which use a USB keyboard. CBFS access ----------- diff --git a/doc/board/emulation/qemu-arm.rst b/doc/board/emulation/qemu-arm.rst index 7291fa4..1c91c7f 100644 --- a/doc/board/emulation/qemu-arm.rst +++ b/doc/board/emulation/qemu-arm.rst @@ -67,6 +67,10 @@ Additional persistent U-Boot environment support can be added as follows: Additional peripherals that have been tested to work in both U-Boot and Linux can be enabled with the following command line parameters: +- To add a video console, remove "-nographic" and add e.g.:: + + -serial stdio -device VGA + - To add a Serial ATA disk via an Intel ICH9 AHCI controller, pass e.g.:: -drive if=none,file=disk.img,format=raw,id=mydisk \ @@ -80,6 +84,10 @@ can be enabled with the following command line parameters: -device usb-ehci,id=ehci +- To add a USB keyboard attached to an emulated xHCI controller, pass e.g.:: + + -device qemu-xhci,id=xhci -device usb-kbd,bus=xhci.0 + - To add an NVMe disk, pass e.g.:: -drive if=none,file=disk.img,id=mydisk -device nvme,drive=mydisk,serial=foo @@ -90,6 +98,74 @@ can be enabled with the following command line parameters: These have been tested in QEMU 2.9.0 but should work in at least 2.5.0 as well. +Booting distros +--------------- + +It is possible to install and boot a standard Linux distribution using +qemu_arm64 by setting up a root disk:: + + qemu-img create root.img 20G + +then using the installer to install. For example, with Debian 12:: + + qemu-system-aarch64 \ + -machine virt -cpu cortex-a53 -m 4G -smp 4 \ + -bios u-boot.bin \ + -serial stdio -device VGA \ + -nic user,model=virtio-net-pci \ + -device virtio-rng-pci \ + -device qemu-xhci,id=xhci \ + -device usb-kbd -device usb-tablet \ + -drive if=virtio,file=debian-12.0.0-arm64-netinst.iso,format=raw,readonly=on,media=cdrom \ + -drive if=virtio,file=root.img,format=raw,media=disk + +The output will be something like this:: + + U-Boot 2023.10-rc2-00075-gbe8fbe718e35 (Aug 11 2023 - 08:38:49 +0000) + + DRAM: 4 GiB + Core: 51 devices, 14 uclasses, devicetree: board + Flash: 64 MiB + Loading Environment from Flash... *** Warning - bad CRC, using default environment + + In: serial,usbkbd + Out: serial,vidconsole + Err: serial,vidconsole + Bus xhci_pci: Register 8001040 NbrPorts 8 + Starting the controller + USB XHCI 1.00 + scanning bus xhci_pci for devices... 3 USB Device(s) found + Net: eth0: virtio-net#32 + Hit any key to stop autoboot: 0 + Scanning for bootflows in all bootdevs + Seq Method State Uclass Part Name Filename + --- ----------- ------ -------- ---- ------------------------ ---------------- + Scanning global bootmeth 'efi_mgr': + Scanning bootdev 'fw-cfg@9020000.bootdev': + fatal: no kernel available + scanning bus for devices... + Scanning bootdev 'virtio-blk#34.bootdev': + 0 efi ready virtio 2 virtio-blk#34.bootdev.par efi/boot/bootaa64.efi + ** Booting bootflow 'virtio-blk#34.bootdev.part_2' with efi + Using prior-stage device tree + Failed to load EFI variables + Error: writing contents + ** Unable to write file ubootefi.var ** + Failed to persist EFI variables + Missing TPMv2 device for EFI_TCG_PROTOCOL + Booting /efi\boot\bootaa64.efi + Error: writing contents + ** Unable to write file ubootefi.var ** + Failed to persist EFI variables + Welcome to GRUB! + +Standard boot looks through various available devices and finds the virtio +disks, then boots from the first one. After a second or so the grub menu appears +and you can work through the installer flow normally. + +After the installation, you can boot into the installed system by running QEMU +again without the drive argument corresponding to the installer CD image. + Enabling TPMv2 support ---------------------- diff --git a/doc/board/emulation/qemu-x86.rst b/doc/board/emulation/qemu-x86.rst index 15f56b6..c604e42 100644 --- a/doc/board/emulation/qemu-x86.rst +++ b/doc/board/emulation/qemu-x86.rst @@ -193,6 +193,9 @@ Linux is selected from grub, e.g. with `debian-12.1.0-i386-netinst.iso`:: The bochs video driver also seems to cause problems before the OS is able to show a display. +The QEMU `-cdrom` option is intended to work with the original ISO-format +images, not the recently invented ISOHybrid image. + Finally, the use of `-M accel=kvm` is intended to use the native CPU's virtual-machine features to accelerate operation, but this causes U-Boot to hang when jumping 64-bit mode, at least on AMD machines. This may be a bug in U-Boot diff --git a/doc/board/kontron/sl28.rst b/doc/board/kontron/sl28.rst index 44435d9..2cb8ec6 100644 --- a/doc/board/kontron/sl28.rst +++ b/doc/board/kontron/sl28.rst @@ -39,12 +39,12 @@ Update image ------------ After the build finished, there will be an update image called -u-boot.update. This can either be used in the DFU mode (which isn't +u-boot-update.bin. This can either be used in the DFU mode (which isn't supported yet) or encapsulated in an EFI UpdateCapsule. To build the capsule use the following command - $ tools/mkeficapsule -f u-boot.update -i 1 UpdateUboot + $ tools/mkeficapsule -f u-boot-update.bin -i 1 UpdateUboot Afterward you can copy this file to your ESP into the /EFI/UpdateCapsule/ folder. On the next EFI boot this will automatically update your diff --git a/doc/board/starfive/visionfive2.rst b/doc/board/starfive/visionfive2.rst index 460f23a..9ee758e 100644 --- a/doc/board/starfive/visionfive2.rst +++ b/doc/board/starfive/visionfive2.rst @@ -67,18 +67,8 @@ Now build the U-Boot SPL and U-Boot proper make starfive_visionfive2_defconfig make OPENSBI=$(opensbi_dir)/opensbi/build/platform/generic/firmware/fw_dynamic.bin -This will generate spl/u-boot-spl.bin and FIT image (u-boot.itb) - -u-boot-spl.bin cannot be used directly on StarFive VisionFive2,we need -to convert the u-boot-spl.bin to u-boot-spl.bin.normal.out with -the below command: - - ./spl_tool -c -f $(Uboot_PATH)/spl/u-boot-spl.bin - -More detailed description of spl_tool,please refer spl_tool documenation. -(Note: spl_tool git repo is at https://github.com/starfive-tech/Tools/tree/master/spl_tool) - -This will generate u-boot-spl.bin.normal.out file. +This will generate the U-Boot SPL image (spl/u-boot-spl.bin.normal.out) as well +as the FIT image (u-boot.itb) with OpenSBI and U-Boot. Flashing ~~~~~~~~ diff --git a/doc/board/ti/am62x_beagleplay.rst b/doc/board/ti/am62x_beagleplay.rst new file mode 100644 index 0000000..39913b2 --- /dev/null +++ b/doc/board/ti/am62x_beagleplay.rst @@ -0,0 +1,322 @@ +.. SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause +.. sectionauthor:: Nishanth Menon <nm@ti.com> + +AM62x Beagleboard.org Beagleplay +================================ + +Introduction: +------------- + +BeagleBoard.org BeaglePlay is an easy to use, affordable open source +hardware single board computer based on the Texas Instruments AM625 +SoC that allows you to create connected devices that work even at long +distances using IEEE 802.15.4g LR-WPAN and IEEE 802.3cg 10Base-T1L. +Expansion is provided over open standards based mikroBUS, Grove and +QWIIC headers among other interfaces. + +Further information can be found at: + +* Product Page: https://beagleplay.org/ +* Hardware documentation: https://git.beagleboard.org/beagleplay/beagleplay + +Boot Flow: +---------- +Below is the pictorial representation of boot flow: + +.. image:: img/boot_diagram_k3_current.svg + :alt: Boot flow diagram + +- On this platform, 'TI Foundational Security' (TIFS) functions as the + security enclave master while 'Device Manager' (DM), also known as the + 'TISCI server' in "TI terminology", offers all the essential services. + The A53 or M4F (Aux core) sends requests to TIFS/DM to accomplish these + services, as illustrated in the diagram above. + +Sources: +-------- +.. include:: k3.rst + :start-after: .. k3_rst_include_start_boot_sources + :end-before: .. k3_rst_include_end_boot_sources + +Build procedure: +---------------- +0. Setup the environment variables: + +.. include:: k3.rst + :start-after: .. k3_rst_include_start_common_env_vars_desc + :end-before: .. k3_rst_include_end_common_env_vars_desc + +.. include:: k3.rst + :start-after: .. k3_rst_include_start_board_env_vars_desc + :end-before: .. k3_rst_include_end_board_env_vars_desc + +Set the variables corresponding to this platform: + +.. include:: k3.rst + :start-after: .. k3_rst_include_start_common_env_vars_defn + :end-before: .. k3_rst_include_end_common_env_vars_defn +.. code-block:: bash + + $ export UBOOT_CFG_CORTEXR="am62x_evm_r5_defconfig beagleplay_r5.config" + $ export UBOOT_CFG_CORTEXA="am62x_evm_a53_defconfig beagleplay_a53.config" + $ export TFA_BOARD=lite + $ # we dont use any extra TFA parameters + $ unset TFA_EXTRA_ARGS + $ export OPTEE_PLATFORM=k3-am62x + $ export OPTEE_EXTRA_ARGS="CFG_WITH_SOFTWARE_PRNG=y" + +.. include:: am62x_sk.rst + :start-after: .. am62x_evm_rst_include_start_build_steps + :end-before: .. am62x_evm_rst_include_end_build_steps + +Target Images +-------------- +Copy the below images to an SD card and boot: + +* tiboot3-am62x-gp-evm.bin from R5 build as tiboot3.bin +* tispl.bin_unsigned from Cortex-A build as tispl.bin +* u-boot.img_unsigned from Cortex-A build as u-boot.img + +Image formats +------------- + +- tiboot3.bin + +.. image:: img/multi_cert_tiboot3.bin.svg + :alt: tiboot3.bin image format + +- tispl.bin + +.. image:: img/dm_tispl.bin.svg + :alt: tispl.bin image format + +Additional hardware for U-Boot development +------------------------------------------ + +* Serial Console is critical for U-Boot development on BeaglePlay. See + `BeaglePlay serial console documentation + <https://docs.beagleboard.org/latest/boards/beagleplay/demos-and-tutorials/using-serial-console.html>`_. +* uSD is preferred option over eMMC, and a SD/MMC reader will be needed. +* (optionally) JTAG is useful when working with very early stages of boot. + +Default storage options +----------------------- + +There are multiple storage media options on BeaglePlay, but primarily: + +* Onboard eMMC (default) - reliable, fast and meant for deployment use. +* SD/MMC card interface (hold 'USR' switch and power on) - Entirely + depends on the SD card quality. + +Flash to uSD card or how to deal with "bricked" Board +-------------------------------------------------------- + +When deploying or working on Linux, it's common to use the onboard +eMMC. However, avoiding the eMMC and using the uSD card is safer when +working with U-Boot. + +If you choose to hand format your own bootable uSD card, be +aware that it can be difficult. The following information +may be helpful, but remember that it is only sometimes +reliable, and partition options can cause issues. These +can potentially help: + +* https://git.ti.com/cgit/arago-project/tisdk-setup-scripts/tree/create-sdcard.sh +* https://elinux.org/Beagleboard:Expanding_File_System_Partition_On_A_microSD + +The simplest option is to start with a standard distribution +image like those in `BeagleBoard.org Distros Page +<https://www.beagleboard.org/distros>`_ and download a disk image for +BeaglePlay. Pick a 16GB+ uSD card to be on the safer side. + +With an SD/MMC Card reader and `Balena Etcher +<https://etcher.balena.io/>`_, having a functional setup in minutes is +a trivial matter, and it works on almost all Host Operating Systems. +Yes Windows users, Windows Subsystem for Linux(WSL) based development +with U-Boot and update uSD card is practical. + +Updating U-Boot is a matter of copying the tiboot3.bin, tispl.bin and +u-boot.img to the "BOOT" partition of the uSD card. Remember to sync +and unmount (or Eject - depending on the Operating System) the uSD +card prior to physically removing from SD card reader. + +Also see following section on switch setting used for booting using +uSD card. + +.. note:: + Great news! If the board has not been damaged physically, there's no + need to worry about it being "bricked" on this platform. You only have + to flash an uSD card, plug it in, and reinstall the image on eMMC. This + means that even if you make a mistake, you can quickly fix it and rest + easy. + + If you are frequently working with uSD cards, you might find the + following useful: + + * `USB-SD-Mux <https://www.linux-automation.com/en/products/usb-sd-mux.html>`_ + * `SD-Wire <https://wiki.tizen.org/SDWire>`_ + +Flash to eMMC +------------- + +The eMMC layout selected is user-friendly for developers. The +boot hardware partition of the eMMC only contains the fixed-size +tiboot3.bin image. This is because the contents of the boot partitions +need to run from the SoC's internal SRAM, which remains a fixed size +constant. The other components of the boot sequence, such as tispl.bin +and u-boot.img, are located in the /BOOT partition in the User Defined +Area (UDA) hardware partition of the eMMC. These components can vary +significantly in size. The choice of keeping tiboot3.bin in boot0 or +boot1 partition depends on A/B update requirements. + +.. image:: img/beagleplay_emmc.svg + :alt: eMMC partitions and boot file organization for BeaglePlay + +The following are the steps from Linux shell to program eMMC: + +.. code-block:: bash + + # # Enable Boot0 boot + # mmc bootpart enable 1 2 /dev/mmcblk0 + # mmc bootbus set single_backward x1 x8 /dev/mmcblk0 + # mmc hwreset enable /dev/mmcblk0 + + # # Clear eMMC boot0 + # echo '0' >> /sys/class/block/mmcblk0boot0/force_ro + # dd if=/dev/zero of=/dev/mmcblk0boot0 count=32 bs=128k + # # Write tiboot3.bin + # dd if=tiboot3.bin of=/dev/mmcblk0boot0 bs=128k + + # # Copy the rest of the boot binaries + # mount /dev/mmcblk0p1 /boot/firmware + # cp tispl.bin /boot/firmware + # cp u-boot.img /boot/firmware + # sync + +.. warning :: + + U-Boot is configured to prioritize booting from an SD card if it + detects a valid boot partition and boot files on it, even if the + system initially booted from eMMC. The boot order is set as follows: + + * SD/MMC + * eMMC + * USB + * PXE + +LED patterns during boot +------------------------ + +.. list-table:: USR LED status indication + :widths: 16 16 + :header-rows: 1 + + * - USR LEDs (012345) + - Indicates + + * - 00000 + - Boot failure or R5 image not started up + + * - 11111 + - A53 SPL/U-boot has started up + + * - 10101 + - OS boot process has been initiated + + * - 01010 + - OS boot process failed and drops to U-Boot shell + +.. note :: + + In the table above, 0 indicates LED switched off and 1 indicates LED + switched ON. + +.. warning :: + + If the "red" power LED is not glowing, the system power supply is not + functional. Please refer to `BeaglePlay documentation + <https://beagleplay.org/>`_ for further information. + +A53 SPL DDR Memory Layout +------------------------- + +.. include:: am62x_sk.rst + :start-after: .. am62x_evm_rst_include_start_ddr_mem_layout + :end-before: .. am62x_evm_rst_include_end_ddr_mem_layout + +Switch Setting for Boot Mode +---------------------------- + +The boot time option is configured via "USR" button on the board. +See `Beagleplay Schematics <https://git.beagleboard.org/beagleplay/beagleplay/-/blob/main/BeaglePlay_sch.pdf>`_ +for details. + +.. list-table:: Boot Modes + :widths: 16 16 16 + :header-rows: 1 + + * - USR Switch Position + - Primary Boot + - Secondary Boot + + * - Not Pressed + - eMMC + - UART + + * - Pressed + - SD/MMC File System (FS) mode + - USB Device Firmware Upgrade (DFU) mode + +To switch to SD card boot mode, hold the USR button while powering on +with Type-C power supply, then release when power LED lights up. + +Debugging U-Boot +---------------- + +See :ref:`Common Debugging environment - OpenOCD<k3_rst_refer_openocd>`: for +detailed setup and debugging information. + +.. warning:: + + **OpenOCD support since**: v0.12.0 + + If the default package version of OpenOCD in your development + environment's distribution needs to be updated, it might be necessary to + build OpenOCD from the source. + +.. include:: k3.rst + :start-after: .. k3_rst_include_start_openocd_connect_tag_connect + :end-before: .. k3_rst_include_end_openocd_connect_tag_connect + +.. include:: k3.rst + :start-after: .. k3_rst_include_start_openocd_cfg_external_intro + :end-before: .. k3_rst_include_end_openocd_cfg_external_intro + +For example, with BeaglePlay (AM62X platform), the openocd_connect.cfg: + +.. code-block:: tcl + + # TUMPA example: + # http://www.tiaowiki.com/w/TIAO_USB_Multi_Protocol_Adapter_User's_Manual + source [find interface/ftdi/tumpa.cfg] + + transport select jtag + + # default JTAG configuration has only SRST and no TRST + reset_config srst_only srst_push_pull + + # delay after SRST goes inactive + adapter srst delay 20 + + if { ![info exists SOC] } { + # Set the SoC of interest + set SOC am625 + } + + source [find target/ti_k3.cfg] + + ftdi tdo_sample_edge falling + + # Speeds for FT2232H are in multiples of 2, and 32MHz is tops + # max speed we seem to achieve is ~20MHz.. so we pick 16MHz + adapter speed 16000 diff --git a/doc/board/ti/am64x_evm.rst b/doc/board/ti/am64x_evm.rst new file mode 100644 index 0000000..db27461 --- /dev/null +++ b/doc/board/ti/am64x_evm.rst @@ -0,0 +1,200 @@ +.. SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause +.. sectionauthor:: Nishanth Menon <nm@ti.com> + +AM64 Platforms +============== + +Introduction: +------------- +The AM642 SoC belongs to the K3 Multicore SoC architecture platform, +providing advanced system integration to enable applications such as +Motor Drives, PLC, Remote IO and IoT Gateways. + +Some highlights of this SoC are: + +* Dual Cortex-A53s in a single cluster, two clusters of dual Cortex-R5F + MCUs, and a single Cortex-M4F. +* Two Gigabit Industrial Communication Subsystems (ICSSG). +* Integrated Ethernet switch supporting up to a total of two external + ports. +* PCIe-GEN2x1L, USB3/USB2, 2xCAN-FD, eMMC and SD, UFS, OSPI memory + controller, QSPI, I2C, eCAP/eQEP, ePWM, ADC, among other + peripherals. +* Centralized System Controller for Security, Power, and Resource + Management (DMSC). + +More details can be found in the Technical Reference Manual: + https://www.ti.com/lit/pdf/spruim2 + +Platform information: + +* AM64-EVM: https://www.ti.com/tool/TMDS64EVM +* AM64-SK: https://www.ti.com/tool/SK-AM64B + +Boot Flow: +---------- +Below is the pictorial representation of boot flow: + +.. image:: img/boot_diagram_am64.svg + :alt: Boot flow diagram + +- Here TIFS acts as master and provides all the critical services. R5/A53 + requests TIFS to get these services done as shown in the above diagram. + +Sources: +-------- + +.. include:: k3.rst + :start-after: .. k3_rst_include_start_boot_sources + :end-before: .. k3_rst_include_end_boot_sources + +Build procedure: +---------------- +0. Setup the environment variables: + +.. include:: k3.rst + :start-after: .. k3_rst_include_start_common_env_vars_desc + :end-before: .. k3_rst_include_end_common_env_vars_desc + +.. include:: k3.rst + :start-after: .. k3_rst_include_start_board_env_vars_desc + :end-before: .. k3_rst_include_end_board_env_vars_desc + +Set the variables corresponding to this platform: + +.. include:: k3.rst + :start-after: .. k3_rst_include_start_common_env_vars_defn + :end-before: .. k3_rst_include_end_common_env_vars_defn +.. code-block:: bash + + $ export UBOOT_CFG_CORTEXR=am64x_evm_r5_defconfig + $ export UBOOT_CFG_CORTEXA=am64x_evm_a53_defconfig + $ export TFA_BOARD=lite + $ # we dont use any extra TFA parameters + $ unset TFA_EXTRA_ARGS + $ export OPTEE_PLATFORM=k3-am64x + $ # we dont use any extra TFA parameters + $ unset OPTEE_EXTRA_ARGS + +.. am64x_evm_rst_include_start_build_steps + +1. Trusted Firmware-A: + +.. include:: k3.rst + :start-after: .. k3_rst_include_start_build_steps_tfa + :end-before: .. k3_rst_include_end_build_steps_tfa + + +2. OP-TEE: + +.. include:: k3.rst + :start-after: .. k3_rst_include_start_build_steps_optee + :end-before: .. k3_rst_include_end_build_steps_optee + +3. U-Boot: + +* 3.1 R5: + +.. include:: k3.rst + :start-after: .. k3_rst_include_start_build_steps_spl_r5 + :end-before: .. k3_rst_include_end_build_steps_spl_r5 + +* 3.2 A53: + +.. include:: k3.rst + :start-after: .. k3_rst_include_start_build_steps_uboot + :end-before: .. k3_rst_include_end_build_steps_uboot +.. am64x_evm_rst_include_end_build_steps + +Target Images +-------------- +In order to boot we need tiboot3.bin, tispl.bin and u-boot.img. Each SoC +variant (GP, HS-FS, HS-SE) requires a different source for these files. + + - GP + + * tiboot3-am64x-gp-evm.bin from step 3.1 + * tispl.bin_unsigned, u-boot.img_unsigned from step 3.2 + + - HS-FS + + * tiboot3-am64x-hs-fs-evm.bin from step 3.1 + * tispl.bin, u-boot.img from step 3.2 + + - HS-SE + + * tiboot3-am64x-hs-evm.bin from step 3.1 + * tispl.bin, u-boot.img from step 3.2 + +Image formats: +-------------- + +- tiboot3.bin + +.. image:: img/multi_cert_tiboot3.bin.svg + :alt: tiboot3.bin image format + +- tispl.bin + +.. image:: img/nodm_tispl.bin.svg + :alt: tispl.bin image format + +Switch Setting for Boot Mode +---------------------------- + +Boot Mode pins provide means to select the boot mode and options before the +device is powered up. After every POR, they are the main source to populate +the Boot Parameter Tables. + +The following table shows some common boot modes used on AM64 platform. More +details can be found in the Technical Reference Manual: +https://www.ti.com/lit/pdf/spruim2 under the `Boot Mode Pins` section. + +.. list-table:: Boot Modes for AM64x-EVM + :widths: 16 16 16 + :header-rows: 1 + + * - Switch Label + - SW2: 12345678 + - SW3: 12345678 + + * - SD/MMC + - 11000010 + - 01000000 + + * - xSPI/SFDP (OSPI) + - 11001110 + - 01000000 + + * - UART + - 11011100 + - 00000000 + +.. note :: + + For SW2 and SW3, the switch state in the "ON" position = 1. + +.. list-table:: Boot Modes for AM64x-SK + :widths: 16 16 16 + :header-rows: 1 + + * - Switch Label + - SW2: 12345678 + - SW3: 12345678 + + * - SD/MMC + - 00000010 + - 01000011 + + * - xSPI/SFDP (OSPI) + - 00000010 + - 01110011 + + * - UART + - 00000000 + - 00111011 + +.. note :: + + For SW2 and SW3, the switch state in the "ON" position = 1. + Boot bits on SK is reversed bits to the bootmode signals diff --git a/doc/board/ti/img/beagleplay_emmc.svg b/doc/board/ti/img/beagleplay_emmc.svg new file mode 100644 index 0000000..c6ff19b --- /dev/null +++ b/doc/board/ti/img/beagleplay_emmc.svg @@ -0,0 +1,697 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!--SPDX-License-Identifier: GPL-2.0-or-later OR BSD-3-Clause--> + +<!--Copyright (C) 2023 Texas Instruments Incorporated - https://www.ti.com/--> + +<svg + version="1.1" + width="771px" + height="351px" + viewBox="-0.5 -0.5 771 351" + id="svg142" + sodipodi:docname="beagleplay_emmc.svg" + inkscape:version="1.1.2 (0a00cf5339, 2022-02-04)" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns="http://www.w3.org/2000/svg" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns:xhtml="http://www.w3.org/1999/xhtml"> + <sodipodi:namedview + id="namedview144" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageshadow="2" + inkscape:pageopacity="0.0" + inkscape:pagecheckerboard="0" + showgrid="false" + inkscape:zoom="1.460441" + inkscape:cx="380.0222" + inkscape:cy="175.28952" + inkscape:window-width="3440" + inkscape:window-height="1416" + inkscape:window-x="0" + inkscape:window-y="0" + inkscape:window-maximized="1" + inkscape:current-layer="g18" /> + <defs + id="defs2" /> + <g + id="g132"> + <rect + x="90" + y="0" + width="120" + height="60" + fill="rgb(255, 255, 255)" + stroke="rgb(0, 0, 0)" + pointer-events="all" + id="rect4" /> + <rect + x="210" + y="0" + width="120" + height="60" + fill="rgb(255, 255, 255)" + stroke="rgb(0, 0, 0)" + pointer-events="all" + id="rect6" /> + <rect + x="330" + y="0" + width="120" + height="60" + fill="rgb(255, 255, 255)" + stroke="rgb(0, 0, 0)" + pointer-events="all" + id="rect8" /> + <rect + x="450" + y="0" + width="320" + height="60" + fill="rgb(255, 255, 255)" + stroke="rgb(0, 0, 0)" + pointer-events="all" + id="rect10" /> + <rect + x="120" + y="15" + width="60" + height="30" + fill="none" + stroke="none" + pointer-events="all" + id="rect12" /> + <g + transform="translate(-0.5 -0.5)" + id="g18"> + <switch + id="switch16"> + <foreignObject + pointer-events="none" + width="100%" + height="100%" + requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" + style="overflow: visible; text-align: left;"> + <xhtml:div + style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 58px; height: 1px; padding-top: 30px; margin-left: 121px;"> + <xhtml:div + data-drawio-colors="color: rgb(0, 0, 0); " + style="box-sizing: border-box; font-size: 0px; text-align: center;"> + <xhtml:div + style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">Boot0</xhtml:div> + </xhtml:div> + </xhtml:div> + </foreignObject> + <text + x="150" + y="34" + fill="#000000" + font-family="Helvetica" + font-size="12px" + text-anchor="middle" + id="text14">Boot0</text> + </switch> + </g> + <rect + x="240" + y="15" + width="60" + height="30" + fill="none" + stroke="none" + pointer-events="all" + id="rect20" /> + <g + transform="translate(-0.5 -0.5)" + id="g26"> + <switch + id="switch24"> + <foreignObject + pointer-events="none" + width="100%" + height="100%" + requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" + style="overflow: visible; text-align: left;"> + <xhtml:div + style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 58px; height: 1px; padding-top: 30px; margin-left: 241px;"> + <xhtml:div + data-drawio-colors="color: rgb(0, 0, 0); " + style="box-sizing: border-box; font-size: 0px; text-align: center;"> + <xhtml:div + style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">Boot1</xhtml:div> + </xhtml:div> + </xhtml:div> + </foreignObject> + <text + x="270" + y="34" + fill="rgb(0, 0, 0)" + font-family="Helvetica" + font-size="12px" + text-anchor="middle" + id="text22">Boot1</text> + </switch> + </g> + <rect + x="360" + y="15" + width="60" + height="30" + fill="none" + stroke="none" + pointer-events="all" + id="rect28" /> + <g + transform="translate(-0.5 -0.5)" + id="g34"> + <switch + id="switch32"> + <foreignObject + pointer-events="none" + width="100%" + height="100%" + requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" + style="overflow: visible; text-align: left;"> + <xhtml:div + style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 58px; height: 1px; padding-top: 30px; margin-left: 361px;"> + <xhtml:div + data-drawio-colors="color: rgb(0, 0, 0); " + style="box-sizing: border-box; font-size: 0px; text-align: center;"> + <xhtml:div + style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">RPMB</xhtml:div> + </xhtml:div> + </xhtml:div> + </foreignObject> + <text + x="390" + y="34" + fill="rgb(0, 0, 0)" + font-family="Helvetica" + font-size="12px" + text-anchor="middle" + id="text30">RPMB</text> + </switch> + </g> + <rect + x="480" + y="15" + width="280" + height="30" + fill="none" + stroke="none" + pointer-events="all" + id="rect36" /> + <g + transform="translate(-0.5 -0.5)" + id="g42"> + <switch + id="switch40"> + <foreignObject + pointer-events="none" + width="100%" + height="100%" + requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" + style="overflow: visible; text-align: left;"> + <xhtml:div + style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 278px; height: 1px; padding-top: 30px; margin-left: 481px;"> + <xhtml:div + data-drawio-colors="color: rgb(0, 0, 0); " + style="box-sizing: border-box; font-size: 0px; text-align: center;"> + <xhtml:div + style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">User Defined Area (UDA)</xhtml:div> + </xhtml:div> + </xhtml:div> + </foreignObject> + <text + x="620" + y="34" + fill="rgb(0, 0, 0)" + font-family="Helvetica" + font-size="12px" + text-anchor="middle" + id="text38">User Defined Area (UDA)</text> + </switch> + </g> + <rect + x="450" + y="60" + width="70" + height="60" + rx="9" + ry="9" + fill="rgb(255, 255, 255)" + stroke="rgb(0, 0, 0)" + pointer-events="all" + id="rect44" /> + <g + transform="translate(-0.5 -0.5)" + id="g50"> + <switch + id="switch48"> + <foreignObject + pointer-events="none" + width="100%" + height="100%" + requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" + style="overflow: visible; text-align: left;"> + <xhtml:div + style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 68px; height: 1px; padding-top: 90px; margin-left: 451px;"> + <xhtml:div + data-drawio-colors="color: rgb(0, 0, 0); " + style="box-sizing: border-box; font-size: 0px; text-align: center;"> + <xhtml:div + style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">BOOT</xhtml:div> + </xhtml:div> + </xhtml:div> + </foreignObject> + <text + x="485" + y="94" + fill="rgb(0, 0, 0)" + font-family="Helvetica" + font-size="12px" + text-anchor="middle" + id="text46">BOOT</text> + </switch> + </g> + <rect + x="520" + y="60" + width="120" + height="60" + rx="9" + ry="9" + fill="rgb(255, 255, 255)" + stroke="rgb(0, 0, 0)" + pointer-events="all" + id="rect52" /> + <g + transform="translate(-0.5 -0.5)" + id="g58"> + <switch + id="switch56"> + <foreignObject + pointer-events="none" + width="100%" + height="100%" + requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" + style="overflow: visible; text-align: left;"> + <xhtml:div + style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 118px; height: 1px; padding-top: 90px; margin-left: 521px;"> + <xhtml:div + data-drawio-colors="color: rgb(0, 0, 0); " + style="box-sizing: border-box; font-size: 0px; text-align: center;"> + <xhtml:div + style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">rootfs</xhtml:div> + </xhtml:div> + </xhtml:div> + </foreignObject> + <text + x="580" + y="94" + fill="rgb(0, 0, 0)" + font-family="Helvetica" + font-size="12px" + text-anchor="middle" + id="text54">rootfs</text> + </switch> + </g> + <rect + x="700" + y="60" + width="70" + height="60" + rx="9" + ry="9" + fill="rgb(255, 255, 255)" + stroke="rgb(0, 0, 0)" + pointer-events="all" + id="rect60" /> + <g + transform="translate(-0.5 -0.5)" + id="g66"> + <switch + id="switch64"> + <foreignObject + pointer-events="none" + width="100%" + height="100%" + requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" + style="overflow: visible; text-align: left;"> + <xhtml:div + style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 68px; height: 1px; padding-top: 90px; margin-left: 701px;"> + <xhtml:div + data-drawio-colors="color: rgb(0, 0, 0); " + style="box-sizing: border-box; font-size: 0px; text-align: center;"> + <xhtml:div + style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">swap</xhtml:div> + </xhtml:div> + </xhtml:div> + </foreignObject> + <text + x="735" + y="94" + fill="rgb(0, 0, 0)" + font-family="Helvetica" + font-size="12px" + text-anchor="middle" + id="text62">swap</text> + </switch> + </g> + <rect + x="640" + y="60" + width="60" + height="60" + rx="9" + ry="9" + fill="rgb(255, 255, 255)" + stroke="rgb(0, 0, 0)" + pointer-events="all" + id="rect68" /> + <g + transform="translate(-0.5 -0.5)" + id="g74"> + <switch + id="switch72"> + <foreignObject + pointer-events="none" + width="100%" + height="100%" + requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" + style="overflow: visible; text-align: left;"> + <xhtml:div + style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 58px; height: 1px; padding-top: 90px; margin-left: 641px;"> + <xhtml:div + data-drawio-colors="color: rgb(0, 0, 0); " + style="box-sizing: border-box; font-size: 0px; text-align: center;"> + <xhtml:div + style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">...</xhtml:div> + </xhtml:div> + </xhtml:div> + </foreignObject> + <text + x="670" + y="94" + fill="rgb(0, 0, 0)" + font-family="Helvetica" + font-size="12px" + text-anchor="middle" + id="text70">...</text> + </switch> + </g> + <path + d="M 130 130 L 180 130 L 180 180 L 100 180 L 100 160 Z" + fill="#ffe6cc" + stroke="#d79b00" + stroke-miterlimit="10" + pointer-events="all" + id="path76" /> + <g + transform="translate(-0.5 -0.5)" + id="g82"> + <switch + id="switch80"> + <foreignObject + pointer-events="none" + width="100%" + height="100%" + requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" + style="overflow: visible; text-align: left;"> + <xhtml:div + style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 78px; height: 1px; padding-top: 155px; margin-left: 101px;"> + <xhtml:div + data-drawio-colors="color: rgb(0, 0, 0); " + style="box-sizing: border-box; font-size: 0px; text-align: center;"> + <xhtml:div + style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">tiboot3.bin</xhtml:div> + </xhtml:div> + </xhtml:div> + </foreignObject> + <text + x="140" + y="159" + fill="rgb(0, 0, 0)" + font-family="Helvetica" + font-size="12px" + text-anchor="middle" + id="text78">tiboot3.bin</text> + </switch> + </g> + <path + d="M 470 130 L 520 130 L 520 180 L 440 180 L 440 160 Z" + fill="#d5e8d4" + stroke="#82b366" + stroke-miterlimit="10" + pointer-events="all" + id="path84" /> + <g + transform="translate(-0.5 -0.5)" + id="g90"> + <switch + id="switch88"> + <foreignObject + pointer-events="none" + width="100%" + height="100%" + requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" + style="overflow: visible; text-align: left;"> + <xhtml:div + style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 78px; height: 1px; padding-top: 155px; margin-left: 441px;"> + <xhtml:div + data-drawio-colors="color: rgb(0, 0, 0); " + style="box-sizing: border-box; font-size: 0px; text-align: center;"> + <xhtml:div + style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">tispl.bin</xhtml:div> + </xhtml:div> + </xhtml:div> + </foreignObject> + <text + x="480" + y="159" + fill="rgb(0, 0, 0)" + font-family="Helvetica" + font-size="12px" + text-anchor="middle" + id="text86">tispl.bin</text> + </switch> + </g> + <path + d="M 470 180 L 520 180 L 520 230 L 440 230 L 440 210 Z" + fill="#d5e8d4" + stroke="#82b366" + stroke-miterlimit="10" + pointer-events="all" + id="path92" /> + <g + transform="translate(-0.5 -0.5)" + id="g98"> + <switch + id="switch96"> + <foreignObject + pointer-events="none" + width="100%" + height="100%" + requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" + style="overflow: visible; text-align: left;"> + <xhtml:div + style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 78px; height: 1px; padding-top: 205px; margin-left: 441px;"> + <xhtml:div + data-drawio-colors="color: rgb(0, 0, 0); " + style="box-sizing: border-box; font-size: 0px; text-align: center;"> + <xhtml:div + style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">u-boot.img</xhtml:div> + </xhtml:div> + </xhtml:div> + </foreignObject> + <text + x="480" + y="209" + fill="rgb(0, 0, 0)" + font-family="Helvetica" + font-size="12px" + text-anchor="middle" + id="text94">u-boot.img</text> + </switch> + </g> + <path + d="M 420 300 L 520 300 L 520 350 L 390 350 L 390 330 Z" + fill="#e1d5e7" + stroke="#9673a6" + stroke-miterlimit="10" + pointer-events="all" + id="path100" /> + <g + transform="translate(-0.5 -0.5)" + id="g106"> + <switch + id="switch104"> + <foreignObject + pointer-events="none" + width="100%" + height="100%" + requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" + style="overflow: visible; text-align: left;"> + <xhtml:div + style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 128px; height: 1px; padding-top: 325px; margin-left: 391px;"> + <xhtml:div + data-drawio-colors="color: rgb(0, 0, 0); " + style="box-sizing: border-box; font-size: 0px; text-align: center;"> + <xhtml:div + style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">extlinux/extlinux.conf</xhtml:div> + </xhtml:div> + </xhtml:div> + </foreignObject> + <text + x="455" + y="329" + fill="rgb(0, 0, 0)" + font-family="Helvetica" + font-size="12px" + text-anchor="middle" + id="text102">extlinux/extlinux.conf</text> + </switch> + </g> + <path + d="M 420 240 L 520 240 L 520 290 L 390 290 L 390 270 Z" + fill="#dae8fc" + stroke="#6c8ebf" + stroke-miterlimit="10" + pointer-events="all" + id="path108" /> + <g + transform="translate(-0.5 -0.5)" + id="g114"> + <switch + id="switch112"> + <foreignObject + pointer-events="none" + width="100%" + height="100%" + requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" + style="overflow: visible; text-align: left;"> + <xhtml:div + style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 128px; height: 1px; padding-top: 265px; margin-left: 391px;"> + <xhtml:div + data-drawio-colors="color: rgb(0, 0, 0); " + style="box-sizing: border-box; font-size: 0px; text-align: center;"> + <xhtml:div + style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">uEnv.txt / boot.scr<xhtml:br /> +(optional)</xhtml:div> + </xhtml:div> + </xhtml:div> + </foreignObject> + <text + x="455" + y="269" + fill="rgb(0, 0, 0)" + font-family="Helvetica" + font-size="12px" + text-anchor="middle" + id="text110">uEnv.txt / boot.scr...</text> + </switch> + </g> + <rect + x="0" + y="15" + width="60" + height="30" + fill="none" + stroke="none" + pointer-events="all" + id="rect116" /> + <g + transform="translate(-0.5 -0.5)" + id="g122"> + <switch + id="switch120"> + <foreignObject + pointer-events="none" + width="100%" + height="100%" + requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" + style="overflow: visible; text-align: left;"> + <xhtml:div + style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 58px; height: 1px; padding-top: 30px; margin-left: 1px;"> + <xhtml:div + data-drawio-colors="color: rgb(0, 0, 0); " + style="box-sizing: border-box; font-size: 0px; text-align: center;"> + <xhtml:div + style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">eMMC<xhtml:br /> +hardware partitions</xhtml:div> + </xhtml:div> + </xhtml:div> + </foreignObject> + <text + x="30" + y="34" + fill="rgb(0, 0, 0)" + font-family="Helvetica" + font-size="12px" + text-anchor="middle" + id="text118">eMMC...</text> + </switch> + </g> + <rect + x="365" + y="75" + width="60" + height="30" + fill="none" + stroke="none" + pointer-events="all" + id="rect124" /> + <g + transform="translate(-0.5 -0.5)" + id="g130"> + <switch + id="switch128"> + <foreignObject + pointer-events="none" + width="100%" + height="100%" + requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" + style="overflow: visible; text-align: left;"> + <xhtml:div + style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 58px; height: 1px; padding-top: 90px; margin-left: 366px;"> + <xhtml:div + data-drawio-colors="color: rgb(0, 0, 0); " + style="box-sizing: border-box; font-size: 0px; text-align: center;"> + <xhtml:div + style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">UDA partitions</xhtml:div> + </xhtml:div> + </xhtml:div> + </foreignObject> + <text + x="395" + y="94" + fill="rgb(0, 0, 0)" + font-family="Helvetica" + font-size="12px" + text-anchor="middle" + id="text126">UDA partit...</text> + </switch> + </g> + </g> + <switch + id="switch140"> + <g + requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" + id="g134" /> + <a + transform="translate(0,-5)" + xlink:href="https://www.diagrams.net/doc/faq/svg-export-text-problems" + target="_blank" + id="a138"> + <text + text-anchor="middle" + font-size="10px" + x="50%" + y="100%" + id="text136">Text is not SVG - cannot display</text> + </a> + </switch> +</svg> diff --git a/doc/board/ti/img/boot_diagram_am64.svg b/doc/board/ti/img/boot_diagram_am64.svg new file mode 100644 index 0000000..9c922a5 --- /dev/null +++ b/doc/board/ti/img/boot_diagram_am64.svg @@ -0,0 +1,1702 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!--SPDX-License-Identifier: GPL-2.0-or-later OR BSD-3-Clause--> + +<!--Copyright (C) 2023 Texas Instruments Incorporated - https://www.ti.com/--> + +<svg + version="1.1" + width="706px" + height="951px" + viewBox="-0.5 -0.5 706 951" + id="svg356" + sodipodi:docname="boot_diagram_am64.svg" + inkscape:version="1.1.2 (0a00cf5339, 2022-02-04)" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns="http://www.w3.org/2000/svg" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns:xhtml="http://www.w3.org/1999/xhtml"> + <sodipodi:namedview + id="namedview358" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageshadow="2" + inkscape:pageopacity="0.0" + inkscape:pagecheckerboard="0" + showgrid="false" + inkscape:zoom="1.0141889" + inkscape:cx="23.664231" + inkscape:cy="412.15202" + inkscape:window-width="3440" + inkscape:window-height="1416" + inkscape:window-x="0" + inkscape:window-y="0" + inkscape:window-maximized="1" + inkscape:current-layer="g346" /> + <defs + id="defs2" /> + <g + id="g346"> + <rect + x="235.5" + y="50" + width="137.5" + height="40" + rx="6" + ry="6" + fill="rgb(255, 255, 255)" + stroke="rgb(0, 0, 0)" + pointer-events="all" + id="rect4" /> + <path + d="M 304.25 90 L 304.25 940" + fill="none" + stroke="rgb(0, 0, 0)" + stroke-miterlimit="10" + stroke-dasharray="3 3" + pointer-events="all" + id="path6" /> + <g + transform="translate(-0.5 -0.5)" + id="g12"> + <switch + id="switch10"> + <foreignObject + style="overflow: visible; text-align: left;" + pointer-events="none" + width="100%" + height="100%" + requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"> + <xhtml:div + style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 136px; height: 1px; padding-top: 70px; margin-left: 237px;"> + <xhtml:div + style="box-sizing: border-box; font-size: 0px; text-align: center;" + data-drawio-colors="color: rgb(0, 0, 0); "> + <xhtml:div + style="display: inline-block; font-size: 12px; font-family: Verdana; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">Cortex-R</xhtml:div> + </xhtml:div> + </xhtml:div> + </foreignObject> + <text + x="304" + y="74" + fill="rgb(0, 0, 0)" + font-family="Verdana" + font-size="12px" + text-anchor="middle" + id="text8">Cortex-R</text> + </switch> + </g> + <rect + x="298.75" + y="160" + width="10" + height="130" + fill="rgb(255, 255, 255)" + stroke="rgb(0, 0, 0)" + pointer-events="all" + id="rect14" /> + <rect + x="301" + y="161" + width="71.5" + height="30" + fill="#ffe6cc" + stroke="#d79b00" + pointer-events="all" + id="rect16" /> + <g + transform="translate(-0.5 -0.5)" + id="g22"> + <switch + id="switch20"> + <foreignObject + style="overflow: visible; text-align: left;" + pointer-events="none" + width="100%" + height="100%" + requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"> + <xhtml:div + style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 70px; height: 1px; padding-top: 176px; margin-left: 302px;"> + <xhtml:div + style="box-sizing: border-box; font-size: 0px; text-align: center;" + data-drawio-colors="color: rgb(0, 0, 0); "> + <xhtml:div + style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">ROM</xhtml:div> + </xhtml:div> + </xhtml:div> + </foreignObject> + <text + x="337" + y="180" + fill="rgb(0, 0, 0)" + font-family="Helvetica" + font-size="12px" + text-anchor="middle" + id="text18">ROM</text> + </switch> + </g> + <rect + x="299.75" + y="305" + width="10" + height="205" + fill="rgb(255, 255, 255)" + stroke="rgb(0, 0, 0)" + pointer-events="all" + id="rect24" /> + <rect + x="302" + y="306" + width="105.5" + height="30" + fill="#d5e8d4" + stroke="#82b366" + pointer-events="all" + id="rect26" /> + <g + transform="translate(-0.5 -0.5)" + id="g32"> + <switch + id="switch30"> + <foreignObject + style="overflow: visible; text-align: left;" + pointer-events="none" + width="100%" + height="100%" + requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"> + <xhtml:div + style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 104px; height: 1px; padding-top: 321px; margin-left: 303px;"> + <xhtml:div + style="box-sizing: border-box; font-size: 0px; text-align: center;" + data-drawio-colors="color: rgb(0, 0, 0); "> + <xhtml:div + style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">Cortex-R SPL</xhtml:div> + </xhtml:div> + </xhtml:div> + </foreignObject> + <text + x="355" + y="325" + fill="rgb(0, 0, 0)" + font-family="Helvetica" + font-size="12px" + text-anchor="middle" + id="text28">Cortex-R SPL</text> + </switch> + </g> + <rect + x="308.75" + y="190" + width="90" + height="40" + rx="6" + ry="6" + fill="none" + stroke="rgb(0, 0, 0)" + pointer-events="all" + id="rect34" /> + <g + transform="translate(-0.5 -0.5)" + id="g40"> + <switch + id="switch38"> + <foreignObject + style="overflow: visible; text-align: left;" + pointer-events="none" + width="100%" + height="100%" + requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"> + <xhtml:div + style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 88px; height: 1px; padding-top: 210px; margin-left: 310px;"> + <xhtml:div + style="box-sizing: border-box; font-size: 0px; text-align: center;" + data-drawio-colors="color: rgb(0, 0, 0); "> + <xhtml:div + style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">Load and auth tiboot3.bin</xhtml:div> + </xhtml:div> + </xhtml:div> + </foreignObject> + <text + x="354" + y="214" + fill="rgb(0, 0, 0)" + font-family="Helvetica" + font-size="12px" + text-anchor="middle" + id="text36">Load and auth t...</text> + </switch> + </g> + <rect + x="309" + y="262" + width="90" + height="32" + rx="4.8" + ry="4.8" + fill="none" + stroke="rgb(0, 0, 0)" + pointer-events="all" + id="rect42" /> + <g + transform="translate(-0.5 -0.5)" + id="g48"> + <switch + id="switch46"> + <foreignObject + style="overflow: visible; text-align: left;" + pointer-events="none" + width="100%" + height="100%" + requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"> + <xhtml:div + style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 88px; height: 1px; padding-top: 278px; margin-left: 310px;"> + <xhtml:div + style="box-sizing: border-box; font-size: 0px; text-align: center;" + data-drawio-colors="color: rgb(0, 0, 0); "> + <xhtml:div + style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">Load system<xhtml:br /> + +config data</xhtml:div> + </xhtml:div> + </xhtml:div> + </foreignObject> + <text + x="354" + y="282" + fill="rgb(0, 0, 0)" + font-family="Helvetica" + font-size="12px" + text-anchor="middle" + id="text44">Load system...</text> + </switch> + </g> + <rect + x="310" + y="336" + width="90" + height="32" + rx="4.8" + ry="4.8" + fill="none" + stroke="rgb(0, 0, 0)" + pointer-events="all" + id="rect50" /> + <g + transform="translate(-0.5 -0.5)" + id="g56"> + <switch + id="switch54"> + <foreignObject + style="overflow: visible; text-align: left;" + pointer-events="none" + width="100%" + height="100%" + requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"> + <xhtml:div + style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 88px; height: 1px; padding-top: 352px; margin-left: 311px;"> + <xhtml:div + style="box-sizing: border-box; font-size: 0px; text-align: center;" + data-drawio-colors="color: rgb(0, 0, 0); "> + <xhtml:div + style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">DDR Config</xhtml:div> + </xhtml:div> + </xhtml:div> + </foreignObject> + <text + x="355" + y="356" + fill="rgb(0, 0, 0)" + font-family="Helvetica" + font-size="12px" + text-anchor="middle" + id="text52">DDR Config</text> + </switch> + </g> + <rect + x="310" + y="368" + width="90" + height="32" + rx="4.8" + ry="4.8" + fill="none" + stroke="rgb(0, 0, 0)" + pointer-events="all" + id="rect58" /> + <g + transform="translate(-0.5 -0.5)" + id="g64"> + <switch + id="switch62"> + <foreignObject + style="overflow: visible; text-align: left;" + pointer-events="none" + width="100%" + height="100%" + requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"> + <xhtml:div + style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 88px; height: 1px; padding-top: 384px; margin-left: 311px;"> + <xhtml:div + style="box-sizing: border-box; font-size: 0px; text-align: center;" + data-drawio-colors="color: rgb(0, 0, 0); "> + <xhtml:div + style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">Load tispl.bin</xhtml:div> + </xhtml:div> + </xhtml:div> + </foreignObject> + <text + x="355" + y="388" + fill="rgb(0, 0, 0)" + font-family="Helvetica" + font-size="12px" + text-anchor="middle" + id="text60">Load tispl.bin</text> + </switch> + </g> + <rect + x="310" + y="440" + width="90" + height="32" + rx="4.8" + ry="4.8" + fill="none" + stroke="rgb(0, 0, 0)" + pointer-events="all" + id="rect66" /> + <g + transform="translate(-0.5 -0.5)" + id="g72"> + <switch + id="switch70"> + <foreignObject + style="overflow: visible; text-align: left;" + pointer-events="none" + width="100%" + height="100%" + requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"> + <xhtml:div + style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 88px; height: 1px; padding-top: 456px; margin-left: 311px;"> + <xhtml:div + style="box-sizing: border-box; font-size: 0px; text-align: center;" + data-drawio-colors="color: rgb(0, 0, 0); "> + <xhtml:div + style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">Start Cortex-A</xhtml:div> + </xhtml:div> + </xhtml:div> + </foreignObject> + <text + x="355" + y="460" + fill="rgb(0, 0, 0)" + font-family="Helvetica" + font-size="12px" + text-anchor="middle" + id="text68">Start Cortex-A</text> + </switch> + </g> + <path + d="M 299 456 L 139.37 456" + fill="none" + stroke="rgb(0, 0, 0)" + stroke-miterlimit="10" + pointer-events="stroke" + id="path74" /> + <path + d="M 134.12 456 L 141.12 452.5 L 139.37 456 L 141.12 459.5 Z" + fill="rgb(0, 0, 0)" + stroke="rgb(0, 0, 0)" + stroke-miterlimit="10" + pointer-events="all" + id="path76" /> + <g + transform="translate(-0.5 -0.5)" + id="g82"> + <switch + id="switch80"> + <foreignObject + style="overflow: visible; text-align: left;" + pointer-events="none" + width="100%" + height="100%" + requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"> + <xhtml:div + style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 1px; height: 1px; padding-top: 440px; margin-left: 257px;"> + <xhtml:div + style="box-sizing: border-box; font-size: 0px; text-align: center;" + data-drawio-colors="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); "> + <xhtml:div + style="display: inline-block; font-size: 11px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; background-color: rgb(255, 255, 255); white-space: nowrap;">Start Cortex-A</xhtml:div> + </xhtml:div> + </xhtml:div> + </foreignObject> + <text + x="257" + y="443" + fill="rgb(0, 0, 0)" + font-family="Helvetica" + font-size="11px" + text-anchor="middle" + id="text78">Start Cort...</text> + </switch> + </g> + <path + d="M 481 601 L 139.37 601" + fill="none" + stroke="rgb(0, 0, 0)" + stroke-miterlimit="10" + pointer-events="stroke" + id="path84" /> + <path + d="M 134.12 601 L 141.12 597.5 L 139.37 601 L 141.12 604.5 Z" + fill="rgb(0, 0, 0)" + stroke="rgb(0, 0, 0)" + stroke-miterlimit="10" + pointer-events="all" + id="path86" /> + <path + d="M 481 711 L 139.37 711" + fill="none" + stroke="rgb(0, 0, 0)" + stroke-miterlimit="10" + pointer-events="stroke" + id="path88" /> + <path + d="M 134.12 711 L 141.12 707.5 L 139.37 711 L 141.12 714.5 Z" + fill="rgb(0, 0, 0)" + stroke="rgb(0, 0, 0)" + stroke-miterlimit="10" + pointer-events="all" + id="path90" /> + <path + d="M 481 791 L 139.37 791" + fill="none" + stroke="rgb(0, 0, 0)" + stroke-miterlimit="10" + pointer-events="stroke" + id="path92" /> + <path + d="M 134.12 791 L 141.12 787.5 L 139.37 791 L 141.12 794.5 Z" + fill="rgb(0, 0, 0)" + stroke="rgb(0, 0, 0)" + stroke-miterlimit="10" + pointer-events="all" + id="path94" /> + <path + d="M 481 879 L 139.37 881.95" + fill="none" + stroke="rgb(0, 0, 0)" + stroke-miterlimit="10" + pointer-events="stroke" + id="path96" /> + <path + d="M 134.12 881.99 L 141.09 878.43 L 139.37 881.95 L 141.15 885.43 Z" + fill="rgb(0, 0, 0)" + stroke="rgb(0, 0, 0)" + stroke-miterlimit="10" + pointer-events="all" + id="path98" /> + <rect + x="437" + y="50" + width="100" + height="40" + rx="6" + ry="6" + fill="rgb(255, 255, 255)" + stroke="rgb(0, 0, 0)" + pointer-events="all" + id="rect100" /> + <path + d="M 487 90 L 487 820" + fill="none" + stroke="rgb(0, 0, 0)" + stroke-miterlimit="10" + stroke-dasharray="3 3" + pointer-events="all" + id="path102" /> + <g + transform="translate(-0.5 -0.5)" + id="g108"> + <switch + id="switch106"> + <foreignObject + style="overflow: visible; text-align: left;" + pointer-events="none" + width="100%" + height="100%" + requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"> + <xhtml:div + style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 98px; height: 1px; padding-top: 70px; margin-left: 438px;"> + <xhtml:div + style="box-sizing: border-box; font-size: 0px; text-align: center;" + data-drawio-colors="color: rgb(0, 0, 0); "> + <xhtml:div + style="display: inline-block; font-size: 12px; font-family: Verdana; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">Cortex-A</xhtml:div> + </xhtml:div> + </xhtml:div> + </foreignObject> + <text + x="487" + y="74" + fill="rgb(0, 0, 0)" + font-family="Verdana" + font-size="12px" + text-anchor="middle" + id="text104">Cortex-A</text> + </switch> + </g> + <rect + x="482" + y="510" + width="10" + height="70" + fill="rgb(255, 255, 255)" + stroke="rgb(0, 0, 0)" + pointer-events="all" + id="rect110" /> + <path + d="M 482 565 L 139.37 565" + fill="none" + stroke="rgb(0, 0, 0)" + stroke-miterlimit="10" + pointer-events="stroke" + id="path112" /> + <path + d="M 134.12 565 L 141.12 561.5 L 139.37 565 L 141.12 568.5 Z" + fill="rgb(0, 0, 0)" + stroke="rgb(0, 0, 0)" + stroke-miterlimit="10" + pointer-events="all" + id="path114" /> + <rect + x="577" + y="50" + width="116.5" + height="40" + rx="6" + ry="6" + fill="rgb(255, 255, 255)" + stroke="rgb(0, 0, 0)" + pointer-events="all" + id="rect116" /> + <path + d="M 635.25 90 L 635.25 950" + fill="none" + stroke="rgb(0, 0, 0)" + stroke-miterlimit="10" + stroke-dasharray="3 3" + pointer-events="all" + id="path118" /> + <g + transform="translate(-0.5 -0.5)" + id="g124"> + <switch + id="switch122"> + <foreignObject + style="overflow: visible; text-align: left;" + pointer-events="none" + width="100%" + height="100%" + requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"> + <xhtml:div + style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 115px; height: 1px; padding-top: 70px; margin-left: 578px;"> + <xhtml:div + style="box-sizing: border-box; font-size: 0px; text-align: center;" + data-drawio-colors="color: rgb(0, 0, 0); "> + <xhtml:div + style="display: inline-block; font-size: 12px; font-family: Verdana; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">Cortex-R/M<xhtml:br /> + +C6x/C7x</xhtml:div> + </xhtml:div> + </xhtml:div> + </foreignObject> + <text + x="635" + y="74" + fill="rgb(0, 0, 0)" + font-family="Verdana" + font-size="12px" + text-anchor="middle" + id="text120">Cortex-R/M...</text> + </switch> + </g> + <rect + x="631" + y="910" + width="10" + height="38" + fill="rgb(255, 255, 255)" + stroke="rgb(0, 0, 0)" + pointer-events="all" + id="rect126" /> + <rect + x="633" + y="912" + width="71.5" + height="30" + fill="#e1d5e7" + stroke="#9673a6" + pointer-events="all" + id="rect128" /> + <g + transform="translate(-0.5 -0.5)" + id="g134"> + <switch + id="switch132"> + <foreignObject + style="overflow: visible; text-align: left;" + pointer-events="none" + width="100%" + height="100%" + requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"> + <xhtml:div + style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 70px; height: 1px; padding-top: 927px; margin-left: 634px;"> + <xhtml:div + style="box-sizing: border-box; font-size: 0px; text-align: center;" + data-drawio-colors="color: rgb(0, 0, 0); "> + <xhtml:div + style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">Aux f/w</xhtml:div> + </xhtml:div> + </xhtml:div> + </foreignObject> + <text + x="669" + y="931" + fill="rgb(0, 0, 0)" + font-family="Helvetica" + font-size="12px" + text-anchor="middle" + id="text130">Aux f/w</text> + </switch> + </g> + <rect + x="77" + y="50" + width="100" + height="40" + rx="6" + ry="6" + fill="rgb(255, 255, 255)" + stroke="rgb(0, 0, 0)" + pointer-events="all" + id="rect136" /> + <path + d="M 127 90 L 127 940" + fill="none" + stroke="rgb(0, 0, 0)" + stroke-miterlimit="10" + stroke-dasharray="3 3" + pointer-events="all" + id="path138" /> + <g + transform="translate(-0.5 -0.5)" + id="g144"> + <switch + id="switch142"> + <foreignObject + style="overflow: visible; text-align: left;" + pointer-events="none" + width="100%" + height="100%" + requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"> + <xhtml:div + style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 98px; height: 1px; padding-top: 70px; margin-left: 78px;"> + <xhtml:div + style="box-sizing: border-box; font-size: 0px; text-align: center;" + data-drawio-colors="color: rgb(0, 0, 0); "> + <xhtml:div + style="display: inline-block; font-size: 12px; font-family: Verdana; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">TIFS/DMSC</xhtml:div> + </xhtml:div> + </xhtml:div> + </foreignObject> + <text + x="127" + y="74" + fill="rgb(0, 0, 0)" + font-family="Verdana" + font-size="12px" + text-anchor="middle" + id="text140">TIFS/DMSC</text> + </switch> + </g> + <rect + x="122" + y="130" + width="10" + height="110" + fill="rgb(255, 255, 255)" + stroke="rgb(0, 0, 0)" + pointer-events="all" + id="rect146" /> + <rect + x="79" + y="132" + width="50" + height="30" + fill="#ffe6cc" + stroke="#d79b00" + pointer-events="all" + id="rect148" /> + <g + transform="translate(-0.5 -0.5)" + id="g154"> + <switch + id="switch152"> + <foreignObject + style="overflow: visible; text-align: left;" + pointer-events="none" + width="100%" + height="100%" + requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"> + <xhtml:div + style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 48px; height: 1px; padding-top: 147px; margin-left: 80px;"> + <xhtml:div + style="box-sizing: border-box; font-size: 0px; text-align: center;" + data-drawio-colors="color: rgb(0, 0, 0); "> + <xhtml:div + style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">ROM</xhtml:div> + </xhtml:div> + </xhtml:div> + </foreignObject> + <text + x="104" + y="151" + fill="rgb(0, 0, 0)" + font-family="Helvetica" + font-size="12px" + text-anchor="middle" + id="text150">ROM</text> + </switch> + </g> + <rect + x="122" + y="253" + width="10" + height="687" + fill="rgb(255, 255, 255)" + stroke="rgb(0, 0, 0)" + pointer-events="all" + id="rect156" /> + <path + d="M 297 238 L 138.37 238" + fill="none" + stroke="rgb(0, 0, 0)" + stroke-miterlimit="10" + pointer-events="stroke" + id="path158" /> + <path + d="M 133.12 238 L 140.12 234.5 L 138.37 238 L 140.12 241.5 Z" + fill="rgb(0, 0, 0)" + stroke="rgb(0, 0, 0)" + stroke-miterlimit="10" + pointer-events="all" + id="path160" /> + <g + transform="translate(-0.5 -0.5)" + id="g166"> + <switch + id="switch164"> + <foreignObject + style="overflow: visible; text-align: left;" + pointer-events="none" + width="100%" + height="100%" + requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"> + <xhtml:div + style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 1px; height: 1px; padding-top: 230px; margin-left: 267px;"> + <xhtml:div + style="box-sizing: border-box; font-size: 0px; text-align: center;" + data-drawio-colors="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); "> + <xhtml:div + style="display: inline-block; font-size: 11px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; background-color: rgb(255, 255, 255); white-space: nowrap;">Start SYSFW</xhtml:div> + </xhtml:div> + </xhtml:div> + </foreignObject> + <text + x="267" + y="233" + fill="rgb(0, 0, 0)" + font-family="Helvetica" + font-size="11px" + text-anchor="middle" + id="text162">Start SYSFW</text> + </switch> + </g> + <rect + x="80" + y="255" + width="50" + height="30" + fill="#f8cecc" + stroke="#b85450" + pointer-events="all" + id="rect168" /> + <g + transform="translate(-0.5 -0.5)" + id="g174"> + <switch + id="switch172"> + <foreignObject + style="overflow: visible; text-align: left;" + pointer-events="none" + width="100%" + height="100%" + requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"> + <xhtml:div + style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 48px; height: 1px; padding-top: 270px; margin-left: 81px;"> + <xhtml:div + style="box-sizing: border-box; font-size: 0px; text-align: center;" + data-drawio-colors="color: rgb(0, 0, 0); "> + <xhtml:div + style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">SYSFW</xhtml:div> + </xhtml:div> + </xhtml:div> + </foreignObject> + <text + x="105" + y="274" + fill="rgb(0, 0, 0)" + font-family="Helvetica" + font-size="12px" + text-anchor="middle" + id="text170">SYSFW</text> + </switch> + </g> + <path + d="M 62 0 L 178 0 L 192 14 L 192 35 L 62 35 L 62 0 Z" + fill="rgb(255, 255, 255)" + stroke="rgb(0, 0, 0)" + stroke-miterlimit="10" + pointer-events="all" + id="path176" /> + <path + d="M 178 0 L 178 14 L 192 14" + fill="none" + stroke="rgb(0, 0, 0)" + stroke-miterlimit="10" + pointer-events="all" + id="path178" /> + <g + transform="translate(-0.5 -0.5)" + id="g184"> + <switch + id="switch182"> + <foreignObject + style="overflow: visible; text-align: left;" + pointer-events="none" + width="100%" + height="100%" + requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"> + <xhtml:div + style="display: flex; align-items: unsafe flex-start; justify-content: unsafe center; width: 128px; height: 1px; padding-top: 1px; margin-left: 63px;"> + <xhtml:div + style="box-sizing: border-box; font-size: 0px; text-align: center;" + data-drawio-colors="color: rgb(0, 0, 0); "> + <xhtml:div + style="display: inline-block; font-size: 12px; font-family: Verdana; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">Security Enclave Boot Processor</xhtml:div> + </xhtml:div> + </xhtml:div> + </foreignObject> + <text + x="127" + y="13" + fill="#000000" + font-family="Verdana" + font-size="12px" + text-anchor="middle" + id="text180">Security Enclave Boot...</text> + </switch> + </g> + <path + d="M 241 0 L 361 0 L 375 14 L 375 35 L 241 35 L 241 0 Z" + fill="rgb(255, 255, 255)" + stroke="rgb(0, 0, 0)" + stroke-miterlimit="10" + pointer-events="all" + id="path186" /> + <path + d="M 361 0 L 361 14 L 375 14" + fill="none" + stroke="rgb(0, 0, 0)" + stroke-miterlimit="10" + pointer-events="all" + id="path188" /> + <g + transform="translate(-0.5 -0.5)" + id="g194"> + <switch + id="switch192"> + <foreignObject + style="overflow: visible; text-align: left;" + pointer-events="none" + width="100%" + height="100%" + requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"> + <xhtml:div + style="display: flex; align-items: unsafe flex-start; justify-content: unsafe center; width: 132px; height: 1px; padding-top: 1px; margin-left: 242px;"> + <xhtml:div + style="box-sizing: border-box; font-size: 0px; text-align: center;" + data-drawio-colors="color: rgb(0, 0, 0); "> + <xhtml:div + style="display: inline-block; font-size: 12px; font-family: Verdana; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">Boot Loader <xhtml:br /> + +Processor</xhtml:div> + </xhtml:div> + </xhtml:div> + </foreignObject> + <text + x="308" + y="13" + fill="rgb(0, 0, 0)" + font-family="Verdana" + font-size="12px" + text-anchor="middle" + id="text190">Boot Loader...</text> + </switch> + </g> + <path + d="M 437 0 L 523 0 L 537 14 L 537 35 L 437 35 L 437 0 Z" + fill="rgb(255, 255, 255)" + stroke="rgb(0, 0, 0)" + stroke-miterlimit="10" + pointer-events="all" + id="path196" /> + <path + d="M 523 0 L 523 14 L 537 14" + fill="none" + stroke="rgb(0, 0, 0)" + stroke-miterlimit="10" + pointer-events="all" + id="path198" /> + <g + transform="translate(-0.5 -0.5)" + id="g204"> + <switch + id="switch202"> + <foreignObject + style="overflow: visible; text-align: left;" + pointer-events="none" + width="100%" + height="100%" + requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"> + <xhtml:div + style="display: flex; align-items: unsafe flex-start; justify-content: unsafe center; width: 98px; height: 1px; padding-top: 1px; margin-left: 438px;"> + <xhtml:div + style="box-sizing: border-box; font-size: 0px; text-align: center;" + data-drawio-colors="color: rgb(0, 0, 0); "> + <xhtml:div + style="display: inline-block; font-size: 12px; font-family: Verdana; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">Main CPU</xhtml:div> + </xhtml:div> + </xhtml:div> + </foreignObject> + <text + x="487" + y="13" + fill="rgb(0, 0, 0)" + font-family="Verdana" + font-size="12px" + text-anchor="middle" + id="text200">Main CPU</text> + </switch> + </g> + <path + d="M 577 0 L 663 0 L 677 14 L 677 35 L 577 35 L 577 0 Z" + fill="rgb(255, 255, 255)" + stroke="rgb(0, 0, 0)" + stroke-miterlimit="10" + pointer-events="all" + id="path206" /> + <path + d="M 663 0 L 663 14 L 677 14" + fill="none" + stroke="rgb(0, 0, 0)" + stroke-miterlimit="10" + pointer-events="all" + id="path208" /> + <g + transform="translate(-0.5 -0.5)" + id="g214"> + <switch + id="switch212"> + <foreignObject + style="overflow: visible; text-align: left;" + pointer-events="none" + width="100%" + height="100%" + requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"> + <xhtml:div + style="display: flex; align-items: unsafe flex-start; justify-content: unsafe center; width: 98px; height: 1px; padding-top: 1px; margin-left: 578px;"> + <xhtml:div + style="box-sizing: border-box; font-size: 0px; text-align: center;" + data-drawio-colors="color: rgb(0, 0, 0); "> + <xhtml:div + style="display: inline-block; font-size: 12px; font-family: Verdana; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">Auxiliary<xhtml:br /> + +Processor</xhtml:div> + </xhtml:div> + </xhtml:div> + </foreignObject> + <text + x="627" + y="13" + fill="rgb(0, 0, 0)" + font-family="Verdana" + font-size="12px" + text-anchor="middle" + id="text210">Auxiliary...</text> + </switch> + </g> + <path + d="M 7 120 L 120.63 120" + fill="none" + stroke="rgb(0, 0, 0)" + stroke-miterlimit="10" + stroke-dasharray="12 12" + pointer-events="stroke" + id="path216" /> + <path + d="M 125.88 120 L 118.88 123.5 L 120.63 120 L 118.88 116.5 Z" + fill="rgb(0, 0, 0)" + stroke="rgb(0, 0, 0)" + stroke-miterlimit="10" + pointer-events="all" + id="path218" /> + <g + transform="translate(-0.5 -0.5)" + id="g224"> + <switch + id="switch222"> + <foreignObject + style="overflow: visible; text-align: left;" + pointer-events="none" + width="100%" + height="100%" + requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"> + <xhtml:div + style="display: flex; align-items: unsafe flex-end; justify-content: unsafe flex-start; width: 1px; height: 1px; padding-top: 118px; margin-left: 9px;"> + <xhtml:div + style="box-sizing: border-box; font-size: 0px; text-align: left;" + data-drawio-colors="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); "> + <xhtml:div + style="display: inline-block; font-size: 11px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; background-color: rgb(255, 255, 255); white-space: nowrap;">H/w Seq: Reset rls</xhtml:div> + </xhtml:div> + </xhtml:div> + </foreignObject> + <text + x="9" + y="118" + fill="#000000" + font-family="Helvetica" + font-size="11px" + id="text220">H/w Seq: Reset rls</text> + </switch> + </g> + <path + d="M 298 200 L 138.37 199.98" + fill="none" + stroke="rgb(0, 0, 0)" + stroke-miterlimit="10" + pointer-events="stroke" + id="path226" /> + <path + d="M 133.12 199.98 L 140.12 196.48 L 138.37 199.98 L 140.12 203.48 Z" + fill="rgb(0, 0, 0)" + stroke="rgb(0, 0, 0)" + stroke-miterlimit="10" + pointer-events="all" + id="path228" /> + <g + transform="translate(-0.5 -0.5)" + id="g234"> + <switch + id="switch232"> + <foreignObject + style="overflow: visible; text-align: left;" + pointer-events="none" + width="100%" + height="100%" + requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"> + <xhtml:div + style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 1px; height: 1px; padding-top: 190px; margin-left: 257px;"> + <xhtml:div + style="box-sizing: border-box; font-size: 0px; text-align: center;" + data-drawio-colors="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); "> + <xhtml:div + style="display: inline-block; font-size: 11px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; background-color: rgb(255, 255, 255); white-space: nowrap;">Auth tiboot3.bin</xhtml:div> + </xhtml:div> + </xhtml:div> + </foreignObject> + <text + x="257" + y="193" + fill="rgb(0, 0, 0)" + font-family="Helvetica" + font-size="11px" + text-anchor="middle" + id="text230">Auth tiboo...</text> + </switch> + </g> + <path + d="M 133 159 L 297.38 159" + fill="none" + stroke="rgb(0, 0, 0)" + stroke-miterlimit="10" + pointer-events="stroke" + id="path236" /> + <path + d="M 302.63 159 L 295.63 162.5 L 297.38 159 L 295.63 155.5 Z" + fill="rgb(0, 0, 0)" + stroke="rgb(0, 0, 0)" + stroke-miterlimit="10" + pointer-events="all" + id="path238" /> + <g + transform="translate(-0.5 -0.5)" + id="g244"> + <switch + id="switch242"> + <foreignObject + style="overflow: visible; text-align: left;" + pointer-events="none" + width="100%" + height="100%" + requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"> + <xhtml:div + style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 1px; height: 1px; padding-top: 150px; margin-left: 177px;"> + <xhtml:div + style="box-sizing: border-box; font-size: 0px; text-align: center;" + data-drawio-colors="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); "> + <xhtml:div + style="display: inline-block; font-size: 11px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; background-color: rgb(255, 255, 255); white-space: nowrap;">Release Reset</xhtml:div> + </xhtml:div> + </xhtml:div> + </foreignObject> + <text + x="177" + y="153" + fill="rgb(0, 0, 0)" + font-family="Helvetica" + font-size="11px" + text-anchor="middle" + id="text240">Release Re...</text> + </switch> + </g> + <path + d="M 299 281.94 L 139.37 281.04" + fill="none" + stroke="rgb(0, 0, 0)" + stroke-miterlimit="10" + pointer-events="stroke" + id="path246" /> + <path + d="M 134.12 281.01 L 141.14 277.55 L 139.37 281.04 L 141.1 284.55 Z" + fill="rgb(0, 0, 0)" + stroke="rgb(0, 0, 0)" + stroke-miterlimit="10" + pointer-events="all" + id="path248" /> + <g + transform="translate(-0.5 -0.5)" + id="g254"> + <switch + id="switch252"> + <foreignObject + style="overflow: visible; text-align: left;" + pointer-events="none" + width="100%" + height="100%" + requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"> + <xhtml:div + style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 1px; height: 1px; padding-top: 270px; margin-left: 237px;"> + <xhtml:div + style="box-sizing: border-box; font-size: 0px; text-align: center;" + data-drawio-colors="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); "> + <xhtml:div + style="display: inline-block; font-size: 11px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; background-color: rgb(255, 255, 255); white-space: nowrap;">Load system config data</xhtml:div> + </xhtml:div> + </xhtml:div> + </foreignObject> + <text + x="237" + y="273" + fill="rgb(0, 0, 0)" + font-family="Helvetica" + font-size="11px" + text-anchor="middle" + id="text250">Load syste...</text> + </switch> + </g> + <rect + x="308.75" + y="230" + width="90" + height="32" + rx="4.8" + ry="4.8" + fill="none" + stroke="rgb(0, 0, 0)" + pointer-events="all" + id="rect256" /> + <g + transform="translate(-0.5 -0.5)" + id="g262"> + <switch + id="switch260"> + <foreignObject + style="overflow: visible; text-align: left;" + pointer-events="none" + width="100%" + height="100%" + requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"> + <xhtml:div + style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 88px; height: 1px; padding-top: 246px; margin-left: 310px;"> + <xhtml:div + style="box-sizing: border-box; font-size: 0px; text-align: center;" + data-drawio-colors="color: rgb(0, 0, 0); "> + <xhtml:div + style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">Start SYSFW</xhtml:div> + </xhtml:div> + </xhtml:div> + </foreignObject> + <text + x="354" + y="250" + fill="rgb(0, 0, 0)" + font-family="Helvetica" + font-size="12px" + text-anchor="middle" + id="text258">Start SYSFW</text> + </switch> + </g> + <path + d="M 133 511 L 137 511 L 476.63 511" + fill="none" + stroke="rgb(0, 0, 0)" + stroke-miterlimit="10" + pointer-events="stroke" + id="path264" /> + <path + d="M 481.88 511 L 474.88 514.5 L 476.63 511 L 474.88 507.5 Z" + fill="rgb(0, 0, 0)" + stroke="rgb(0, 0, 0)" + stroke-miterlimit="10" + pointer-events="all" + id="path266" /> + <g + transform="translate(-0.5 -0.5)" + id="g272"> + <switch + id="switch270"> + <foreignObject + style="overflow: visible; text-align: left;" + pointer-events="none" + width="100%" + height="100%" + requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"> + <xhtml:div + style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 1px; height: 1px; padding-top: 500px; margin-left: 177px;"> + <xhtml:div + style="box-sizing: border-box; font-size: 0px; text-align: center;" + data-drawio-colors="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); "> + <xhtml:div + style="display: inline-block; font-size: 11px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; background-color: rgb(255, 255, 255); white-space: nowrap;">Release Reset</xhtml:div> + </xhtml:div> + </xhtml:div> + </foreignObject> + <text + x="177" + y="503" + fill="rgb(0, 0, 0)" + font-family="Helvetica" + font-size="11px" + text-anchor="middle" + id="text268">Release Re...</text> + </switch> + </g> + <rect + x="484" + y="513" + width="71.5" + height="30" + fill="#d5e8d4" + stroke="#82b366" + pointer-events="all" + id="rect274" /> + <g + transform="translate(-0.5 -0.5)" + id="g280"> + <switch + id="switch278"> + <foreignObject + style="overflow: visible; text-align: left;" + pointer-events="none" + width="100%" + height="100%" + requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"> + <xhtml:div + style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 70px; height: 1px; padding-top: 528px; margin-left: 485px;"> + <xhtml:div + style="box-sizing: border-box; font-size: 0px; text-align: center;" + data-drawio-colors="color: rgb(0, 0, 0); "> + <xhtml:div + style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">TF-A</xhtml:div> + </xhtml:div> + </xhtml:div> + </foreignObject> + <text + x="520" + y="532" + fill="rgb(0, 0, 0)" + font-family="Helvetica" + font-size="12px" + text-anchor="middle" + id="text276">TF-A</text> + </switch> + </g> + <rect + x="482" + y="581" + width="10" + height="70" + fill="rgb(255, 255, 255)" + stroke="rgb(0, 0, 0)" + pointer-events="all" + id="rect282" /> + <rect + x="484" + y="584" + width="71.5" + height="30" + fill="#d5e8d4" + stroke="#82b366" + pointer-events="all" + id="rect284" /> + <g + transform="translate(-0.5 -0.5)" + id="g290"> + <switch + id="switch288"> + <foreignObject + style="overflow: visible; text-align: left;" + pointer-events="none" + width="100%" + height="100%" + requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"> + <xhtml:div + style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 70px; height: 1px; padding-top: 599px; margin-left: 485px;"> + <xhtml:div + style="box-sizing: border-box; font-size: 0px; text-align: center;" + data-drawio-colors="color: rgb(0, 0, 0); "> + <xhtml:div + style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">OP-TEE</xhtml:div> + </xhtml:div> + </xhtml:div> + </foreignObject> + <text + x="520" + y="603" + fill="rgb(0, 0, 0)" + font-family="Helvetica" + font-size="12px" + text-anchor="middle" + id="text286">OP-TEE</text> + </switch> + </g> + <rect + x="482" + y="662" + width="10" + height="78" + fill="rgb(255, 255, 255)" + stroke="rgb(0, 0, 0)" + pointer-events="all" + id="rect292" /> + <rect + x="484" + y="665" + width="83" + height="30" + fill="#d5e8d4" + stroke="#82b366" + pointer-events="all" + id="rect294" /> + <g + transform="translate(-0.5 -0.5)" + id="g300"> + <switch + id="switch298"> + <foreignObject + style="overflow: visible; text-align: left;" + pointer-events="none" + width="100%" + height="100%" + requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"> + <xhtml:div + style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 81px; height: 1px; padding-top: 680px; margin-left: 485px;"> + <xhtml:div + style="box-sizing: border-box; font-size: 0px; text-align: center;" + data-drawio-colors="color: rgb(0, 0, 0); "> + <xhtml:div + style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">Cortex A SPL</xhtml:div> + </xhtml:div> + </xhtml:div> + </foreignObject> + <text + x="526" + y="684" + fill="rgb(0, 0, 0)" + font-family="Helvetica" + font-size="12px" + text-anchor="middle" + id="text296">Cortex A SPL</text> + </switch> + </g> + <rect + x="482" + y="748" + width="10" + height="192" + fill="rgb(255, 255, 255)" + stroke="rgb(0, 0, 0)" + pointer-events="all" + id="rect302" /> + <rect + x="484" + y="751" + width="83" + height="30" + fill="#d5e8d4" + stroke="#82b366" + pointer-events="all" + id="rect304" /> + <g + transform="translate(-0.5 -0.5)" + id="g310"> + <switch + id="switch308"> + <foreignObject + style="overflow: visible; text-align: left;" + pointer-events="none" + width="100%" + height="100%" + requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"> + <xhtml:div + style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 81px; height: 1px; padding-top: 766px; margin-left: 485px;"> + <xhtml:div + style="box-sizing: border-box; font-size: 0px; text-align: center;" + data-drawio-colors="color: rgb(0, 0, 0); "> + <xhtml:div + style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">U-Boot</xhtml:div> + </xhtml:div> + </xhtml:div> + </foreignObject> + <text + x="526" + y="770" + fill="rgb(0, 0, 0)" + font-family="Helvetica" + font-size="12px" + text-anchor="middle" + id="text306">U-Boot</text> + </switch> + </g> + <rect + x="492" + y="700" + width="103" + height="32" + rx="4.8" + ry="4.8" + fill="none" + stroke="rgb(0, 0, 0)" + pointer-events="all" + id="rect312" /> + <g + transform="translate(-0.5 -0.5)" + id="g318"> + <switch + id="switch316"> + <foreignObject + style="overflow: visible; text-align: left;" + pointer-events="none" + width="100%" + height="100%" + requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"> + <xhtml:div + style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 101px; height: 1px; padding-top: 716px; margin-left: 493px;"> + <xhtml:div + style="box-sizing: border-box; font-size: 0px; text-align: center;" + data-drawio-colors="color: rgb(0, 0, 0); "> + <xhtml:div + style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">Load u-boot.img</xhtml:div> + </xhtml:div> + </xhtml:div> + </foreignObject> + <text + x="544" + y="720" + fill="rgb(0, 0, 0)" + font-family="Helvetica" + font-size="12px" + text-anchor="middle" + id="text314">Load u-boot.img</text> + </switch> + </g> + <rect + x="492" + y="820" + width="103" + height="32" + rx="4.8" + ry="4.8" + fill="none" + stroke="rgb(0, 0, 0)" + pointer-events="all" + id="rect320" /> + <g + transform="translate(-0.5 -0.5)" + id="g326"> + <switch + id="switch324"> + <foreignObject + style="overflow: visible; text-align: left;" + pointer-events="none" + width="100%" + height="100%" + requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"> + <xhtml:div + style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 101px; height: 1px; padding-top: 836px; margin-left: 493px;"> + <xhtml:div + style="box-sizing: border-box; font-size: 0px; text-align: center;" + data-drawio-colors="color: rgb(0, 0, 0); "> + <xhtml:div + style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">Load Aux core f/w<xhtml:br /> + +(optional)</xhtml:div> + </xhtml:div> + </xhtml:div> + </foreignObject> + <text + x="544" + y="840" + fill="rgb(0, 0, 0)" + font-family="Helvetica" + font-size="12px" + text-anchor="middle" + id="text322">Load Aux core f/w...</text> + </switch> + </g> + <rect + x="492" + y="860" + width="103" + height="32" + rx="4.8" + ry="4.8" + fill="none" + stroke="rgb(0, 0, 0)" + pointer-events="all" + id="rect328" /> + <g + transform="translate(-0.5 -0.5)" + id="g334"> + <switch + id="switch332"> + <foreignObject + style="overflow: visible; text-align: left;" + pointer-events="none" + width="100%" + height="100%" + requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"> + <xhtml:div + style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 101px; height: 1px; padding-top: 876px; margin-left: 493px;"> + <xhtml:div + style="box-sizing: border-box; font-size: 0px; text-align: center;" + data-drawio-colors="color: rgb(0, 0, 0); "> + <xhtml:div + style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">Start Aux core<xhtml:br /> + +(optional)</xhtml:div> + </xhtml:div> + </xhtml:div> + </foreignObject> + <text + x="544" + y="880" + fill="rgb(0, 0, 0)" + font-family="Helvetica" + font-size="12px" + text-anchor="middle" + id="text330">Start Aux core...</text> + </switch> + </g> + <path + d="M 132 909 L 628.38 909" + fill="none" + stroke="rgb(0, 0, 0)" + stroke-miterlimit="10" + pointer-events="stroke" + id="path336" /> + <path + d="M 633.63 909 L 626.63 912.5 L 628.38 909 L 626.63 905.5 Z" + fill="rgb(0, 0, 0)" + stroke="rgb(0, 0, 0)" + stroke-miterlimit="10" + pointer-events="all" + id="path338" /> + <g + transform="translate(-0.5 -0.5)" + id="g344"> + <switch + id="switch342"> + <foreignObject + style="overflow: visible; text-align: left;" + pointer-events="none" + width="100%" + height="100%" + requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"> + <xhtml:div + style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 1px; height: 1px; padding-top: 900px; margin-left: 203px;"> + <xhtml:div + style="box-sizing: border-box; font-size: 0px; text-align: center;" + data-drawio-colors="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); "> + <xhtml:div + style="display: inline-block; font-size: 11px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; background-color: rgb(255, 255, 255); white-space: nowrap;">Release Reset</xhtml:div> + </xhtml:div> + </xhtml:div> + </foreignObject> + <text + x="203" + y="903" + fill="rgb(0, 0, 0)" + font-family="Helvetica" + font-size="11px" + text-anchor="middle" + id="text340">Release Re...</text> + </switch> + </g> + </g> + <switch + id="switch354"> + <g + requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" + id="g348" /> + <a + transform="translate(0,-5)" + xlink:href="https://www.drawio.com/doc/faq/svg-export-text-problems" + target="_blank" + id="a352"> + <text + text-anchor="middle" + font-size="10px" + x="50%" + y="100%" + id="text350">Text is not SVG - cannot display</text> + </a> + </switch> +</svg> diff --git a/doc/board/ti/k3.rst b/doc/board/ti/k3.rst index ec44735..8b5c1a8 100644 --- a/doc/board/ti/k3.rst +++ b/doc/board/ti/k3.rst @@ -30,8 +30,10 @@ K3 Based SoCs .. toctree:: :maxdepth: 1 + am62x_beagleplay am62x_sk ../toradex/verdin-am62 + am64x_evm am65x_evm j7200_evm j721e_evm diff --git a/doc/board/xilinx/zynq.rst b/doc/board/xilinx/zynq.rst index 438912f..76d67bd 100644 --- a/doc/board/xilinx/zynq.rst +++ b/doc/board/xilinx/zynq.rst @@ -83,7 +83,7 @@ Mainline status --------------- - Added basic board configurations support. -- Added zynq u-boot bsp code - arch/arm/mach-zynq +- Added zynq U-Boot bsp code - arch/arm/mach-zynq - Added zynq boards named - zc70x, zed, microzed, zc770_xm010/xm011/xm012/xm013 - Added zynq drivers: diff --git a/doc/board/xilinx/zynqmp-r5.rst b/doc/board/xilinx/zynqmp-r5.rst index 2cd368b..266d07d 100644 --- a/doc/board/xilinx/zynqmp-r5.rst +++ b/doc/board/xilinx/zynqmp-r5.rst @@ -26,7 +26,7 @@ configure and build armv7 toolchain:: Notes ^^^^^ -Output fragment is u-boot. +Output fragment is U-Boot. Loading ------- @@ -38,7 +38,7 @@ Bootgen ^^^^^^^ The first way is to use Xilinx FSBL (First stage -bootloader) to load u-boot and start it. The following bif can be used for boot +bootloader) to load U-Boot and start it. The following bif can be used for boot image generation via Xilinx bootgen utility:: diff --git a/doc/build/tools.rst b/doc/build/tools.rst index ec017229..5bfa05b 100644 --- a/doc/build/tools.rst +++ b/doc/build/tools.rst @@ -45,3 +45,12 @@ Launch the MSYS2 shell of the MSYS2 environment, and do the following:: $ make tools-only_defconfig $ make tools-only + + +Building without Python +----------------------- + +The tools-only builds bytes pylibfdt by default. To disable this, use the +NO_PYTHON variable:: + + NO_PYTHON=1 make tools-only_defconfig tools-only diff --git a/doc/develop/bootstd.rst b/doc/develop/bootstd.rst index c47de27..6172dc9 100644 --- a/doc/develop/bootstd.rst +++ b/doc/develop/bootstd.rst @@ -464,6 +464,28 @@ ready File was loaded and is ready for use. In this state the bootflow is ======= ======================================================================= +Migrating from distro_boot +-------------------------- + +To migrate from distro_boot: + +#. Update your board header files to remove the BOOTENV and BOOT_TARGET_xxx + defines. Standard boot finds available boot devices automatically. + +#. Remove the "boot_targets" variable unless you need it. Standard boot uses a + default order from fastest to slowest, which generally matches the order used + by boards. + +#. Make sure that CONFIG_BOOTSTD_DEFAULTS is enabled by your board, so it can + boot common Linux distributions. + +An example patch is at migrate_patch_. + +If you are using custom boot scripts for your board, consider creating your +own bootmeth to hold the logic. There are various examples at +`boot/bootmeth_...`. + + Theory of operation ------------------- @@ -683,11 +705,12 @@ Assuming the bootmeth is happy, or at least indicates that it is willing to try partition. If that works it tries to detect a file system. If that works then it calls the bootmeth device once more, this time to read the bootflow. -Note: At present a filesystem is needed for the bootmeth to be called on block -devices, simply because we don't have any examples where this is not the case. -This feature can be added as needed. Note that sandbox is a special case, since -in that case the host filesystem can be accessed even though the block device -is NULL. +Note: Normally a filesystem is needed for the bootmeth to be called on block +devices, but bootmeths which don't need that can set the BOOTMETHF_ANY_PART +flag to indicate that they can scan any partition. An example is the ChromiumOS +bootmeth which can store a kernel in a raw partition. Note also that sandbox is +a special case, since in that case the host filesystem can be accessed even +though the block device is NULL. If we take the example of the `bootmeth_extlinux` driver, this call ends up at `extlinux_read_bootflow()`. It has the filesystem ready, so tries various @@ -774,3 +797,4 @@ Other ideas: .. _BootLoaderSpec: http://www.freedesktop.org/wiki/Specifications/BootLoaderSpec/ .. _distro_boot: https://github.com/u-boot/u-boot/blob/master/boot/distro.c .. _bootflow_h: https://github.com/u-boot/u-boot/blob/master/include/bootflow.h +.. _migrate_patch: https://patchwork.ozlabs.org/project/uboot/patch/20230727215433.578830-2-sjg@chromium.org/ diff --git a/doc/develop/cedit.rst b/doc/develop/cedit.rst new file mode 100644 index 0000000..63dff9d --- /dev/null +++ b/doc/develop/cedit.rst @@ -0,0 +1,169 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +Configuration Editor +==================== + +Introduction +------------ + +U-Boot provides a configuration editor which allows settings to be changed in +a GUI or text environment. + + +This feature is still in development and has a number of limitations. For +example, cedit only supports menu items (there is no numeric or text entry), +provides no support for colour text and does not support scrolling. Still it is +possible to use it for simple applications. + + +Overview +-------- + +The configuration editor makes use of :doc:`expo` to build a description of the +configuration screens and allow user to interact with it. + +To create a single-scene cedit for your application: + +#. Design the scene, i.e. the objects that need to be present and what their + possible values are + +#. Enter this in .dts format + +#. Create a header file containing the IDs + +#. Run the 'expo.py' tool to generate a .dtb file containing the layout, which + can be used by U-Boot + +#. Use the :doc:`../usage/cmd/cedit` to create the cedit, read the settings, + present the cedit to the user and save the settings afterwards. + +Each of these is described in a separate section. See :ref:`expo_example` for +an example file. + + +Design a scene +-------------- + +Using a piece of paper or a drawing tool, lay out the objects you want in your +scene. Typically you will use the default layout engine, which simply puts items +one after the other from top to bottom. So use a single column and show the +prompt and value for each object. + +For menu items, show one of the values, but keep in mind what else you need. + + +Create an expo-format file +-------------------------- + +The description is in the form of a devicetree file, as documented at +:ref:`expo_format`. Since everything in an expo has an ID number (an integer +greater than 1) the description is written terms of these IDs. They each have +an enum value. which is typically taken care of by the `expo.py` tool. + +The expo should have a `scenes` node with a named scene as a subnode. Within the +scene, add properties for the scene, then a subnode for each object in the +scene. + +All object nodes require an `id` value and a `type` property. Other properties +depend on the type. For example, a menu has a `title` and an `item-label` list +proving the text for the menu items, as well as an `item-id` list providing the +ID of each menu item, so it can be selected. + +Text properties may have two variants. For example `title` specifies the title +of a menu, but you can instead use `title-id` to specify the string ID to use as +the title. String are defined in a separate area, common to the whole expo, +which contains a subnode for each string. Within that subnode are the ID and the +`value` (i.e. the text). For now only English is supported, but in future it may +be possible to append a language identifier to provide other values (e.g. +'value-es' for Spanish). + + +Create an ID header-file +------------------------ + +Expo needs to know the integer value to use for every ID referenced in your +expo-format file. For example, if you have defined a `cpu-speed` node with an +id of `ID_CPU_SPEED`, then Expo needs to know the value of `ID_CPU_SPEED`. + +When you write C code to use the expo, you may need to know the IDs. For +example, to find which value the user selected in `cpu-speed` menu, you must +use the `ID_CPU_SPEED` ID. The ID is the only way to refer to anything in Expo. + +Since we need a shared set of IDs, it is best to have a header file containing +them. Expo supports doing this with an enum, where every ID is listed in the +enum:: + + enum { + ZERO, + + ID_PROMPT, + + ID_SCENE1, + ID_SCENE1_TITLE, + ... + }; + +The C compiler can parse this directly. The `expo.py` tool parses it for expo. + +Create a header file containing every ID mentioned in your expo. Try to group +related things together. + + +Build the expo layout +--------------------- + +Use the `expo.py` tool to build a .dtb for your expo:: + + ./tools/expo.py -e expo_ids.h -l expo_layout.dts -o expo.dtb + +This uses the enum in the provided header file to get the ID numbers, grabs +the `.dts` file, inserts the ID numbers and then uses the devicetree compiler to +build a `.dtb` file. + +If you get an error:: + + Devicetree compiler error: + Error: <stdin>:9.19-20 syntax error + FATAL ERROR: Unable to parse input tree + +that means that something is wrong with your syntax, or perhaps you have an ID +in the `.dts` file that is not mentioned in your enum. Check both files and try +again. + + +Use the command interface +------------------------- + +See the :doc:`../usage/cmd/cedit` command for information on available commands. +Typically you will use `cedit load` to load the `.dtb` file and `cedit run` to +let the user interact with it. + + +Multiple scenes +--------------- + +Expo supports multiple scenes but has no pre-determined way of moving between +them. You could use selection of a menu item as a signal to change the scene, +but this is not currently implemented in the cedit code (see `cedit_run()`). + + +Themes +------ + +The configuration editor uses simple expo themes. The theme is read from +`/bootstd/cedit-theme` in the devicetree. + + +Reading and writing settings +---------------------------- + +Cedit provides several options for persistent settings: + +- Writing an FDT file to a filesystem +- Writing to U-Boot's environment variables, which are then typically stored in + a persistent manner +- Writing to CMOS RAM registers (common on x86 machines) + +For now, reading and writing settings is not automatic. See the +:doc:`../usage/cmd/cedit` for how to do this on the command line or in a +script. diff --git a/doc/develop/event.rst b/doc/develop/event.rst index cb09e9c..d5043ec 100644 --- a/doc/develop/event.rst +++ b/doc/develop/event.rst @@ -21,16 +21,31 @@ Declaring a spy To declare a spy, use something like this:: - static int snow_setup_cpus(void *ctx, struct event *event) + static int snow_check_temperature(void) { /* do something */ return 0; } - EVENT_SPY(EVT_DM_POST_INIT_F, snow_setup_cpus); + EVENT_SPY_SIMPLE(EVT_DM_POST_INIT_F, snow_check_temperature); This function is called when EVT_DM_POST_INIT_F is emitted, i.e. after the driver model is initialized (in U-Boot proper before and after relocation). +If you need access to the event data, use `EVENT_SPY_FULL`, like this:: + + static int snow_setup_cpus(void *ctx, struct event *event) + { + /* do something that uses event->data*/ + return 0; + } + EVENT_SPY_FULL(EVT_DM_POST_INIT_F, snow_setup_cpus); + +Note that the context is always NULL for a static spy. See below for information +about how to use a dynamic spy. + +The return value is handled by the event emitter. If non-zero, then the error +is returned to the function which emitted the event, i.e. the one that called +`event_notify()`. Debugging --------- @@ -80,6 +95,10 @@ to be notified when a particular device is probed or removed. This can be handled by enabling `CONFIG_EVENT_DYNAMIC`. It is then possible to call `event_register()` to register a new handler for a particular event. +If some context is need for the spy, you can pass a pointer to +`event_register()` to provide that. Note that the context is only passed to +a spy registered with `EVENT_SPY_FULL`. + Dynamic event handlers are called after all the static event spy handlers have been processed. Of course, since dynamic event handlers are created at runtime it is not possible to use the `event_dump.py` to see them. diff --git a/doc/develop/expo.rst b/doc/develop/expo.rst index 2ac4af2..f137619 100644 --- a/doc/develop/expo.rst +++ b/doc/develop/expo.rst @@ -317,6 +317,18 @@ id Specifies the ID of the object. This is used when referring to the object. +Where CMOS RAM is used for reading and writing settings, the following +additional properties are required: + +start-bit + Specifies the first bit in the CMOS RAM to use for this setting. For a RAM + with 0x100 bytes, there are 0x800 bit locations. For example, register 0x80 + holds bits 0x400 to 0x407. + +bit-length + Specifies the number of CMOS RAM bits to use for this setting. The bits + extend from `start-bit` to `start-bit + bit-length - 1`. Note that the bits + must be contiguous. Menu nodes have the following additional properties: @@ -358,6 +370,9 @@ The `expo_arrange()` function can be called to arrange the expo objects in a suitable manner. For each scene it puts the title at the top, the prompt at the bottom and the objects in order from top to bottom. + +.. _expo_example: + Expo format example ~~~~~~~~~~~~~~~~~~~ @@ -367,22 +382,27 @@ strings are provided inline in the nodes where they are used. :: - #define ID_PROMPT 1 - #define ID_SCENE1 2 - #define ID_SCENE1_TITLE 3 + /* this comment is parsed by the expo.py tool to insert the values below + + enum { + ZERO, + ID_PROMPT, + ID_SCENE1, + ID_SCENE1_TITLE, - #define ID_CPU_SPEED 4 - #define ID_CPU_SPEED_TITLE 5 - #define ID_CPU_SPEED_1 6 - #define ID_CPU_SPEED_2 7 - #define ID_CPU_SPEED_3 8 + ID_CPU_SPEED, + ID_CPU_SPEED_TITLE, + ID_CPU_SPEED_1, + ID_CPU_SPEED_2, + ID_CPU_SPEED_3, - #define ID_POWER_LOSS 9 - #define ID_AC_OFF 10 - #define ID_AC_ON 11 - #define ID_AC_MEMORY 12 + ID_POWER_LOSS, + ID_AC_OFF, + ID_AC_ON, + ID_AC_MEMORY, - #define ID_DYNAMIC_START 13 + ID_DYNAMIC_START, + */ &cedit { dynamic-start = <ID_DYNAMIC_START>; @@ -465,7 +485,7 @@ Some ideas for future work: - Support unicode - Support curses for proper serial-terminal menus - Add support for large menus which need to scroll -- Add support for reading and writing configuration settings with cedit +- Update expo.py tool to check for overlapping names and CMOS locations .. Simon Glass <sjg@chromium.org> .. 7-Oct-22 diff --git a/doc/develop/index.rst b/doc/develop/index.rst index 5b230d0..0d12484 100644 --- a/doc/develop/index.rst +++ b/doc/develop/index.rst @@ -38,6 +38,7 @@ Implementation driver-model/index environment expo + cedit event global_data logging diff --git a/doc/develop/uefi/uefi.rst b/doc/develop/uefi/uefi.rst index a7a41f2..68f9b33 100644 --- a/doc/develop/uefi/uefi.rst +++ b/doc/develop/uefi/uefi.rst @@ -318,6 +318,9 @@ Run the following command --guid <image GUID> \ <capsule_file_name> +Capsule with firmware version +***************************** + The UEFI specification does not define the firmware versioning mechanism. EDK II reference implementation inserts the FMP Payload Header right before the payload. It coutains the fw_version and lowest supported version, @@ -345,6 +348,43 @@ add --fw-version option in mkeficapsule tool. If the --fw-version option is not set, FMP Payload Header is not inserted and fw_version is set as 0. +Capsule Generation through binman +********************************* + +Support has also been added to generate capsules during U-Boot build +through binman. This requires the platform's DTB to be populated with +the capsule entry nodes for binman. The capsules then can be generated +by specifying the capsule parameters as properties in the capsule +entry node. + +Check the test/py/tests/test_efi_capsule/capsule_gen_binman.dts file +as reference for how a typical binman node for capsule generation +looks like. For generating capsules as part of the platform's build, a +capsule node would then have to be included into the platform's +devicetree. + +A typical binman node for generating a capsule would look like:: + + capsule { + filename = "u-boot.capsule"; + efi-capsule { + image-index = <0x1>; + image-guid = "09d7cf52-0720-4710-91d1-08469b7fe9c8"; + + u-boot { + }; + }; + }; + +In the above example, a capsule file named u-boot.capsule will be +generated with u-boot.bin as it's input payload. The capsule +generation parameters like image-index and image-guid are being +specified as properties. Similarly, other properties like the private +and public key certificate can be specified for generating signed +capsules. Refer :ref:`etype_efi_capsule` for documentation about the +efi-capsule binman entry type, which describes all the properties that +can be specified. + Performing the update ********************* @@ -522,20 +562,11 @@ and used by the steps highlighted below. ... } -You can do step-4 manually with - -.. code-block:: console - - $ dtc -@ -I dts -O dtb -o signature.dtbo signature.dts - $ fdtoverlay -i orig.dtb -o new.dtb -v signature.dtbo - -where signature.dts looks like:: - - &{/} { - signature { - capsule-key = /incbin/("CRT.esl"); - }; - }; +You can perform step-4 through the Kconfig symbol +CONFIG_EFI_CAPSULE_ESL_FILE. This symbol points to the esl file +generated in step-2. Once the symbol has been populated with the path +to the esl file, it will automatically get embedded into the +platform's dtb as part of U-Boot build. Anti-rollback Protection ************************ diff --git a/doc/imx/mkimage/imximage.txt b/doc/imx/mkimage/imximage.txt index f2cf23c..fa4e486 100644 --- a/doc/imx/mkimage/imximage.txt +++ b/doc/imx/mkimage/imximage.txt @@ -213,7 +213,7 @@ Disk identifier: 0xb712a870 Device Boot Start End Blocks Id System /dev/mmcblk0p1 3 16 112455 83 Linux -I have set 100MB, leaving the first 2 sectors free. I will copy u-boot +I have set 100MB, leaving the first 2 sectors free. I will copy U-Boot there. 8. Write the partition table and exit. diff --git a/doc/usage/cmd/bootflow.rst b/doc/usage/cmd/bootflow.rst index 65e3777..9c5ea9c 100644 --- a/doc/usage/cmd/bootflow.rst +++ b/doc/usage/cmd/bootflow.rst @@ -11,7 +11,8 @@ Synopis bootflow scan [-abelGH] [bootdev] bootflow list [-e] bootflow select [<num|name>] - bootflow info [-d] + bootflow info [-ds] + bootflow read bootflow boot bootflow cmdline [set|get|clear|delete|auto] <param> [<value>] @@ -191,11 +192,29 @@ Error Use the `-d` flag to dump out the contents of the bootfile file. +The `-s` flag shows any x86 setup block, instead of the above. + + +bootflow read +~~~~~~~~~~~~~ + +This reads any files related to the bootflow. Some bootflows with large files +avoid doing this when the bootflow is scanned, since it uses a lot of memory +and takes extra time. The files are then automatically read when `bootflow boot` +is used. + +This command reads these files immediately. Typically this fills in the bootflow +`buf` property, which can be used to examine the bootflow. + +Note that reading the files does not result in any extra parsing, nor loading of +images in the files. This is purely used to read in the data ready for +booting, or examination. + bootflow boot ~~~~~~~~~~~~~ -This boots the current bootflow. +This boots the current bootflow, reading any required files first. bootflow cmdline @@ -522,6 +541,122 @@ the cmdline is word-wrapped here and some parts of the command line are elided:: [ 0.000000] Command line: loglevel=7 ... usb-storage.quirks=13fe:6500:u earlycon=uart8250,mmio32,0xfe03e000,115200n8 [ 0.000000] x86/split lock detection: warning about user-space split_locks +This shows looking at x86 setup information:: + + => bootfl sel 0 + => bootfl i -s + Setup located at 77b56010: + + ACPI RSDP addr : 0 + E820: 2 entries + Addr Size Type + 0 1000 RAM + fffff000 1000 Reserved + Setup sectors : 1e + Root flags : 1 + Sys size : 63420 + RAM size : 0 + Video mode : ffff + Root dev : 0 + Boot flag : 0 + Jump : 66eb + Header : 53726448 + Kernel V2 + Version : 20d + Real mode switch : 0 + Start sys seg : 1000 + Kernel version : 38cc + @00003acc: + Type of loader : ff + unknown + Load flags : 1 + : loaded-high + Setup move size : 8000 + Code32 start : 100000 + Ramdisk image : 0 + Ramdisk size : 0 + Bootsect kludge : 0 + Heap end ptr : 5160 + Ext loader ver : 0 + Ext loader type : 0 + Command line ptr : 735000 + Initrd addr max : 7fffffff + Kernel alignment : 200000 + Relocatable kernel : 1 + Min alignment : 15 + : 200000 + Xload flags : 3 + : 64-bit-entry can-load-above-4gb + Cmdline size : 7ff + Hardware subarch : 0 + HW subarch data : 0 + Payload offset : 26e + Payload length : 612045 + Setup data : 0 + Pref address : 1000000 + Init size : 1383000 + Handover offset : 0 + +This shows reading a bootflow to examine the kernel:: + + => bootfl i 0 + Name: + Device: emmc@1c,0.bootdev + Block dev: emmc@1c,0.blk + Method: cros + State: ready + Partition: 2 + Subdir: (none) + Filename: <NULL> + Buffer: 0 + Size: 63ee00 (6548992 bytes) + OS: ChromeOS + Cmdline: console= loglevel=7 init=/sbin/init cros_secure oops=panic panic=-1 root=PARTUUID=35c775e7-3735-d745-93e5-d9e0238f7ed0/PARTNROFF=1 rootwait rw dm_verity.error_behavior=3 dm_verity.max_bios=-1 dm_verity.dev_wait=0 dm="1 vroot none rw 1,0 3788800 verity payload=ROOT_DEV hashtree=HASH_DEV hashstart=3788800 alg=sha1 root_hexdigest=55052b629d3ac889f25a9583ea12cdcd3ea15ff8 salt=a2d4d9e574069f4fed5e3961b99054b7a4905414b60a25d89974a7334021165c" noinitrd vt.global_cursor_default=0 kern_guid=35c775e7-3735-d745-93e5-d9e0238f7ed0 add_efi_memmap boot=local noresume noswap i915.modeset=1 tpm_tis.force=1 tpm_tis.interrupts=0 nmi_watchdog=panic,lapic disablevmx=off + X86 setup: 77b56010 + Logo: (none) + FDT: <NULL> + Error: 0 + +Note that `Buffer` is 0 so it has not be read yet. Using `bootflow read`:: + + => bootfl read + => bootfl info + Name: + Device: emmc@1c,0.bootdev + Block dev: emmc@1c,0.blk + Method: cros + State: ready + Partition: 2 + Subdir: (none) + Filename: <NULL> + Buffer: 77b7e400 + Size: 63ee00 (6548992 bytes) + OS: ChromeOS + Cmdline: console= loglevel=7 init=/sbin/init cros_secure oops=panic panic=-1 root=PARTUUID=35c775e7-3735-d745-93e5-d9e0238f7ed0/PARTNROFF=1 rootwait rw dm_verity.error_behavior=3 dm_verity.max_bios=-1 dm_verity.dev_wait=0 dm="1 vroot none rw 1,0 3788800 verity payload=ROOT_DEV hashtree=HASH_DEV hashstart=3788800 alg=sha1 root_hexdigest=55052b629d3ac889f25a9583ea12cdcd3ea15ff8 salt=a2d4d9e574069f4fed5e3961b99054b7a4905414b60a25d89974a7334021165c" noinitrd vt.global_cursor_default=0 kern_guid=35c775e7-3735-d745-93e5-d9e0238f7ed0 add_efi_memmap boot=local noresume noswap i915.modeset=1 tpm_tis.force=1 tpm_tis.interrupts=0 nmi_watchdog=panic,lapic disablevmx=off + X86 setup: 781b4400 + Logo: (none) + FDT: <NULL> + Error: 0 + +Now the buffer can be accessed:: + + => md 77b7e400 + 77b7e400: 1186f6fc 40000002 b8fa0c75 00000018 .......@u....... + 77b7e410: c08ed88e a68dd08e 000001e8 000000e8 ................ + 77b7e420: ed815d00 00000021 62c280b8 89e80100 .]..!......b.... + 77b7e430: 22f7e8c4 c0850061 22ec850f eb890061 ..."a......"a... + 77b7e440: 0230868b 01480000 21d0f7c3 00fb81c3 ..0...H....!.... + 77b7e450: 7d010000 0000bb05 c3810100 00d4f000 ...}............ + 77b7e460: 8130858d 85890061 00618132 3095010f ..0.a...2.a....0 + 77b7e470: 0f006181 c883e020 e0220f20 e000bb8d .a.. ... ."..... + 77b7e480: c0310062 001800b9 8dabf300 62e000bb b.1............b + 77b7e490: 07878d00 89000010 00bb8d07 8d0062f0 .............b.. + 77b7e4a0: 00100787 0004b900 07890000 00100005 ................ + 77b7e4b0: 08c78300 8df37549 630000bb 0183b800 ....Iu.....c.... + 77b7e4c0: 00b90000 89000008 00000507 c7830020 ............ ... + 77b7e4d0: f3754908 e000838d 220f0062 0080b9d8 .Iu.....b..".... + 77b7e4e0: 320fc000 08e8ba0f c031300f b8d0000f ...2.....01..... + 77b7e4f0: 00000020 6ad8000f 00858d10 50000002 ......j.......P Return value diff --git a/doc/usage/cmd/cedit.rst b/doc/usage/cmd/cedit.rst index 8e1110c..f415b48 100644 --- a/doc/usage/cmd/cedit.rst +++ b/doc/usage/cmd/cedit.rst @@ -10,6 +10,11 @@ Synopis cedit load <interface> <dev[:part]> <filename> cedit run + cedit write_fdt <dev[:part]> <filename> + cedit read_fdt <dev[:part]> <filename> + cedit write_env [-v] + cedit read_env [-v] + cedit write_cmos [-v] [dev] Description ----------- @@ -22,6 +27,69 @@ It makes use of the expo subsystem. The description is in the form of a devicetree file, as documented at :ref:`expo_format`. +See :doc:`../../develop/cedit` for information about the configuration editor. + +cedit load +~~~~~~~~~~ + +Loads a configuration-editor description from a file. It creates a new cedit +structure ready for use. Initially no settings are read, so default values are +used for each object. + +cedit run +~~~~~~~~~ + +Runs the default configuration-editor event loop. This is very simple, just +accepting character input and moving through the objects under user control. +The implementation is at `cedit_run()`. + +cedit write_fdt +~~~~~~~~~~~~~~~ + +Writes the current user settings to a devicetree file. For each menu item the +selected ID and its text string are written. + +cedit read_fdt +~~~~~~~~~~~~~~ + +Reads the user settings from a devicetree file and updates the cedit with those +settings. + +cedit read_env +~~~~~~~~~~~~~~ + +Reads the settings from the environment variables. For each menu item `<name>`, +cedit looks for a variable called `c.<name>` with the ID of the selected menu +item. + +The `-v` flag enables verbose mode, where each variable is printed after it is +read. + +cedit write_env +~~~~~~~~~~~~~~~ + +Writes the settings to environment variables. For each menu item the selected +ID and its text string are written, similar to: + + setenv c.<name> <selected_id> + setenv c.<name>-str <selected_id's text string> + +The `-v` flag enables verbose mode, where each variable is printed before it is +set. + +cedit write_cmos +~~~~~~~~~~~~~~~~ + +Writes the settings to locations in the CMOS RAM. The locations used are +specified by the schema. See `expo_format_`. + +The `-v` flag enables verbose mode, which shows which CMOS locations were +updated. + +Normally the first RTC device is used to hold the data. You can specify a +different device by name using the `dev` parameter. + + Example ------- @@ -29,3 +97,52 @@ Example => cedit load hostfs - fred.dtb => cedit run + => cedit write_fdt hostfs - settings.dtb + +That results in:: + + / { + cedit-values { + cpu-speed = <0x00000006>; + cpu-speed-str = "2 GHz"; + power-loss = <0x0000000a>; + power-loss-str = "Always Off"; + }; + } + + => cedit read_fdt hostfs - settings.dtb + +This shows settings being stored in the environment:: + + => cedit write_env -v + c.cpu-speed=7 + c.cpu-speed-str=2.5 GHz + c.power-loss=12 + c.power-loss-str=Memory + => print + ... + c.cpu-speed=6 + c.cpu-speed-str=2 GHz + c.power-loss=10 + c.power-loss-str=Always Off + ... + + => cedit read_env -v + c.cpu-speed=7 + c.power-loss=12 + +This shows writing to CMOS RAM. Notice that the bytes at 80 and 84 change:: + + => rtc read 80 8 + 00000080: 00 00 00 00 00 2f 2a 08 ...../*. + => cedit write_cmos -v + Write 2 bytes from offset 80 to 84 + => rtc read 80 8 + 00000080: 01 00 00 00 08 2f 2a 08 ...../*. + => cedit read_cmos -v + Read 2 bytes from offset 80 to 84 + +Here is an example with the device specified:: + + => cedit write_cmos rtc@43 + => diff --git a/doc/usage/cmd/dm.rst b/doc/usage/cmd/dm.rst index 74c6b01..12b7ede 100644 --- a/doc/usage/cmd/dm.rst +++ b/doc/usage/cmd/dm.rst @@ -12,8 +12,8 @@ Synopis dm devres dm drivers dm static - dm tree [-s] - dm uclass + dm tree [-s][-e] [uclass name] + dm uclass [-e] [udevice name] Description ----------- @@ -127,6 +127,12 @@ If -s is given, the top-level devices (those which are children of the root device) are shown sorted in order of uclass ID, so it is easier to find a particular device type. +If -e is given, forward-matching against existing devices is +made and only the matched devices are shown. + +If a device name is given, forward-matching against existing devices is +made and only the matched devices are shown. + dm uclass ~~~~~~~~~ @@ -140,6 +146,11 @@ For each device, the format is:: where `n` is the index within the uclass, `a` is the address of the device in memory and `s` is the sequence number of the device. +If -e is given, forward-matching against existing uclasses is +made and only the matched uclasses are shown. + +If no uclass name is given, all the uclasses are shown. + Examples -------- @@ -409,6 +420,15 @@ This example shows the abridged sandbox output:: nop 8 [ ] scmi_voltage_domain `-- regulators regulator 5 [ ] scmi_regulator |-- reg@0 regulator 6 [ ] scmi_regulator `-- reg@1 + => dm tree pinc + pinctrl 0 [ + ] sandbox_pinctrl_gpio pinctrl-gpio + gpio 1 [ + ] sandbox_gpio |-- base-gpios + nop 0 [ + ] gpio_hog | |-- hog_input_active_low + nop 1 [ + ] gpio_hog | |-- hog_input_active_high + nop 2 [ + ] gpio_hog | |-- hog_output_low + nop 3 [ + ] gpio_hog | `-- hog_output_high + gpio 2 [ ] sandbox_gpio |-- extra-gpios + gpio 3 [ ] sandbox_gpio `-- pinmux-gpios => @@ -487,4 +507,10 @@ This example shows the abridged sandbox output:: 0 * gpio-wdt @ 0301c070, seq 0 1 * wdt@0 @ 03021710, seq 1 + => dm uclass blk + uclass 22: blk + 0 mmc2.blk @ 0301ca00, seq 0 + 1 mmc1.blk @ 0301cee0, seq 1 + 2 mmc0.blk @ 0301d380, seq 2 + => diff --git a/doc/usage/cmd/gpt.rst b/doc/usage/cmd/gpt.rst index 6387c81..f6115ec 100644 --- a/doc/usage/cmd/gpt.rst +++ b/doc/usage/cmd/gpt.rst @@ -13,8 +13,10 @@ Synopsis gpt read <interface> <dev> [<varname>] gpt rename <interface> <dev> <part> <name> gpt repair <interface> <dev> + gpt set-bootable <interface> <dev> <partition list> gpt setenv <interface> <dev> <partition name> gpt swap <interface> <dev> <name1> <name2> + gpt transpose <interface> <dev> <part1> <part2> gpt verify <interface> <dev> [<partition string>] gpt write <interface> <dev> <partition string> @@ -90,6 +92,13 @@ gpt repair Repairs the GPT partition tables if it they become corrupted. +gpt set-bootable +~~~~~~~~~~~~~~~~ + +Sets the bootable flag for all partitions in the table. If the partition name +is in 'partition list' (separated by ','), the bootable flag is set, otherwise +it is cleared. CONFIG_CMD_GPT_RENAME=y is required. + gpt setenv ~~~~~~~~~~ @@ -108,6 +117,9 @@ gpt_partition_name gpt_partition_entry the partition number in the table, e.g. 1, 2, 3, etc. +gpt_partition_bootable + 1 if the partition is marked as bootable, 0 if not + gpt swap ~~~~~~~~ @@ -115,6 +127,13 @@ Changes the names of all partitions that are named 'name1' to be 'name2', and all partitions named 'name2' to be 'name1'. CONFIG_CMD_GPT_RENAME=y is required. +gpt transpose +~~~~~~~~~~~~~ + +Swaps the order of two partition table entries with indexes 'part1' and 'part2' +in the partition table, but otherwise leaves the actual partition data +untouched. + gpt verify ~~~~~~~~~~ @@ -167,6 +186,8 @@ Get the information about the partition named 'rootfs':: rootfs => echo ${gpt_partition_entry} 2 + => echo ${gpt_partition_bootable} + 0 Get the list of partition names on the disk:: @@ -182,3 +203,24 @@ Get the GUID for a disk:: => gpt guid mmc gpt_disk_uuid => echo ${gpt_disk_uuid} bec9fc2a-86c1-483d-8a0e-0109732277d7 + +Set the bootable flag for the 'boot' partition and clear it for all others:: + + => gpt set-bootable mmc 0 boot + +Swap the order of the 'boot' and 'rootfs' partition table entries:: + => gpt setenv mmc 0 rootfs + => echo ${gpt_partition_entry} + 2 + => gpt setenv mmc 0 boot + => echo ${gpt_partition_entry} + 1 + + => gpt transpose mmc 0 1 2 + + => gpt setenv mmc 0 rootfs + => echo ${gpt_partition_entry} + 1 + => gpt setenv mmc 0 boot + => echo ${gpt_partition_entry} + 2 diff --git a/doc/usage/environment.rst b/doc/usage/environment.rst index c6439dd..c57b717 100644 --- a/doc/usage/environment.rst +++ b/doc/usage/environment.rst @@ -216,7 +216,7 @@ fdt_high 0xffffffffffffffff (64-bit machines) then the fdt will not be copied at all on boot. For this to work it must reside in writable memory, have - sufficient padding on the end of it for u-boot to + sufficient padding on the end of it for U-Boot to add the information it needs into it, and the memory must be accessible by the kernel. This usage is strongly discouraged however as it also stops U-Boot from ensuring the device tree starting diff --git a/doc/usage/semihosting.rst b/doc/usage/semihosting.rst index 6a280b4..9303a63 100644 --- a/doc/usage/semihosting.rst +++ b/doc/usage/semihosting.rst @@ -23,7 +23,7 @@ eMMC or other NV media are available. There are two main ARM virtual Fixed Virtual Platform (FVP) models, `Versatile Express (VE) FVP and BASE FVP <http://www.arm.com/products/tools/models/fast-models/foundation-model.php>`_. -The initial vexpress64 u-boot board created here runs on the VE virtual +The initial vexpress64 U-Boot board created here runs on the VE virtual platform using the license-free Foundation_v8 simulator. Fortunately, the Foundation_v8 simulator also supports the BASE_FVP model which companies can purchase licenses for and contain much more functionality. diff --git a/drivers/adc/adc-uclass.c b/drivers/adc/adc-uclass.c index 9646e4d..1b35bf2 100644 --- a/drivers/adc/adc-uclass.c +++ b/drivers/adc/adc-uclass.c @@ -15,6 +15,7 @@ #include <dm/uclass-internal.h> #include <adc.h> #include <linux/delay.h> +#include <linux/printk.h> #include <power/regulator.h> #define ADC_UCLASS_PLATDATA_SIZE sizeof(struct adc_uclass_plat) @@ -51,23 +52,21 @@ static int check_channel(struct udevice *dev, int value, bool number_or_mask, static int adc_supply_enable(struct udevice *dev) { struct adc_uclass_plat *uc_pdata = dev_get_uclass_plat(dev); - const char *supply_type; - int ret = 0; + int ret; - if (uc_pdata->vdd_supply) { - supply_type = "vdd"; - ret = regulator_set_enable(uc_pdata->vdd_supply, true); + ret = regulator_set_enable_if_allowed(uc_pdata->vdd_supply, true); + if (ret && ret != -ENOSYS) { + pr_err("%s: can't enable vdd-supply!", dev->name); + return ret; } - if (!ret && uc_pdata->vss_supply) { - supply_type = "vss"; - ret = regulator_set_enable(uc_pdata->vss_supply, true); + ret = regulator_set_enable_if_allowed(uc_pdata->vss_supply, true); + if (ret && ret != -ENOSYS) { + pr_err("%s: can't enable vss-supply!", dev->name); + return ret; } - if (ret) - pr_err("%s: can't enable %s-supply!", dev->name, supply_type); - - return ret; + return 0; } int adc_data_mask(struct udevice *dev, unsigned int *data_mask) diff --git a/drivers/adc/exynos-adc.c b/drivers/adc/exynos-adc.c index 6589817..2bda733 100644 --- a/drivers/adc/exynos-adc.c +++ b/drivers/adc/exynos-adc.c @@ -8,6 +8,7 @@ #include <dm.h> #include <adc.h> #include <asm/arch/adc.h> +#include <linux/printk.h> struct exynos_adc_priv { int active_channel; diff --git a/drivers/adc/meson-saradc.c b/drivers/adc/meson-saradc.c index 3702351..c15c7fe 100644 --- a/drivers/adc/meson-saradc.c +++ b/drivers/adc/meson-saradc.c @@ -18,6 +18,7 @@ #include <linux/delay.h> #include <linux/math64.h> #include <linux/bitfield.h> +#include <linux/printk.h> #include <power/regulator.h> #define MESON_SAR_ADC_REG0 0x00 diff --git a/drivers/adc/rockchip-saradc.c b/drivers/adc/rockchip-saradc.c index 809486e..03caca7 100644 --- a/drivers/adc/rockchip-saradc.c +++ b/drivers/adc/rockchip-saradc.c @@ -13,6 +13,7 @@ #include <asm/io.h> #include <linux/bitops.h> #include <linux/err.h> +#include <linux/printk.h> #include <power/regulator.h> #define SARADC_CTRL_CHN_MASK GENMASK(2, 0) diff --git a/drivers/adc/sandbox.c b/drivers/adc/sandbox.c index 6e43546..43cad34 100644 --- a/drivers/adc/sandbox.c +++ b/drivers/adc/sandbox.c @@ -8,6 +8,7 @@ #include <dm.h> #include <adc.h> #include <sandbox-adc.h> +#include <linux/printk.h> /** * struct sandbox_adc_priv - sandbox ADC device's operation status and data diff --git a/drivers/ata/dwc_ahci.c b/drivers/ata/dwc_ahci.c index 1dc91e7..15fd3e3 100644 --- a/drivers/ata/dwc_ahci.c +++ b/drivers/ata/dwc_ahci.c @@ -18,6 +18,7 @@ #endif #include <asm/io.h> #include <generic-phy.h> +#include <linux/printk.h> struct dwc_ahci_priv { void *base; diff --git a/drivers/ata/sata_ceva.c b/drivers/ata/sata_ceva.c index 4736643..7769d4f 100644 --- a/drivers/ata/sata_ceva.c +++ b/drivers/ata/sata_ceva.c @@ -217,7 +217,7 @@ static int sata_ceva_probe(struct udevice *dev) } } - if (phy.dev) { + if (generic_phy_valid(&phy)) { dev_dbg(dev, "Perform PHY power on\n"); ret = generic_phy_power_on(&phy); if (ret) { diff --git a/drivers/bios_emulator/include/x86emu/debug.h b/drivers/bios_emulator/include/x86emu/debug.h index 4962a2a..859b54d 100644 --- a/drivers/bios_emulator/include/x86emu/debug.h +++ b/drivers/bios_emulator/include/x86emu/debug.h @@ -43,6 +43,7 @@ /* checks to be enabled for "runtime" */ +#include <linux/printk.h> #define CHECK_IP_FETCH_F 0x1 #define CHECK_SP_ACCESS_F 0x2 #define CHECK_MEM_ACCESS_F 0x4 /*using regular linear pointer */ diff --git a/drivers/bios_emulator/include/x86emu/regs.h b/drivers/bios_emulator/include/x86emu/regs.h index 2934129..4b4c590 100644 --- a/drivers/bios_emulator/include/x86emu/regs.h +++ b/drivers/bios_emulator/include/x86emu/regs.h @@ -41,6 +41,7 @@ /*---------------------- Macros and type definitions ----------------------*/ +#include <linux/printk.h> #pragma pack(1) /* diff --git a/drivers/bios_emulator/x86emu/debug.c b/drivers/bios_emulator/x86emu/debug.c index 27e90e4..95f3cc0 100644 --- a/drivers/bios_emulator/x86emu/debug.c +++ b/drivers/bios_emulator/x86emu/debug.c @@ -40,6 +40,7 @@ #include <stdarg.h> #include <common.h> #include <linux/ctype.h> +#include <linux/printk.h> #include "x86emu/x86emui.h" /*----------------------------- Implementation ----------------------------*/ diff --git a/drivers/bios_emulator/x86emu/decode.c b/drivers/bios_emulator/x86emu/decode.c index a9a01b5..e2028ea 100644 --- a/drivers/bios_emulator/x86emu/decode.c +++ b/drivers/bios_emulator/x86emu/decode.c @@ -37,6 +37,7 @@ * ****************************************************************************/ #include <common.h> +#include <linux/printk.h> #include "x86emu/x86emui.h" /*----------------------------- Implementation ----------------------------*/ diff --git a/drivers/bios_emulator/x86emu/ops.c b/drivers/bios_emulator/x86emu/ops.c index ba18135..8c1a146 100644 --- a/drivers/bios_emulator/x86emu/ops.c +++ b/drivers/bios_emulator/x86emu/ops.c @@ -73,6 +73,7 @@ ****************************************************************************/ #include <common.h> +#include <linux/printk.h> #include "x86emu/x86emui.h" /*----------------------------- Implementation ----------------------------*/ diff --git a/drivers/bios_emulator/x86emu/ops2.c b/drivers/bios_emulator/x86emu/ops2.c index be4ef36..6cd1ac3 100644 --- a/drivers/bios_emulator/x86emu/ops2.c +++ b/drivers/bios_emulator/x86emu/ops2.c @@ -43,6 +43,7 @@ #include <common.h> #include <linux/compiler.h> +#include <linux/printk.h> #include "x86emu/x86emui.h" /*----------------------------- Implementation ----------------------------*/ diff --git a/drivers/bios_emulator/x86emu/sys.c b/drivers/bios_emulator/x86emu/sys.c index 882a8a3..f966524 100644 --- a/drivers/bios_emulator/x86emu/sys.c +++ b/drivers/bios_emulator/x86emu/sys.c @@ -40,6 +40,7 @@ ****************************************************************************/ #include <common.h> +#include <linux/printk.h> #include "x86emu/x86emui.h" /*------------------------- Global Variables ------------------------------*/ diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig index 6baaa6f..1abea3f 100644 --- a/drivers/block/Kconfig +++ b/drivers/block/Kconfig @@ -167,7 +167,7 @@ config SYS_IDE_MAXDEVICE config SYS_ATA_BASE_ADDR hex "Base address of IDE controller" - default 0 + default 0x0 help This is the address of the IDE controller, from which other addresses are calculated. Each bus is at a fixed offset from this address, diff --git a/drivers/block/blk-uclass.c b/drivers/block/blk-uclass.c index 614b975..8855138 100644 --- a/drivers/block/blk-uclass.c +++ b/drivers/block/blk-uclass.c @@ -17,6 +17,8 @@ #include <dm/uclass-internal.h> #include <linux/err.h> +#define blk_get_ops(dev) ((struct blk_ops *)(dev)->driver->ops) + static struct { enum uclass_id id; const char *name; @@ -444,6 +446,26 @@ int blk_get_device(int uclass_id, int devnum, struct udevice **devp) return device_probe(*devp); } +struct blk_bounce_buffer { + struct udevice *dev; + struct bounce_buffer state; +}; + +static int blk_buffer_aligned(struct bounce_buffer *state) +{ +#if IS_ENABLED(CONFIG_BOUNCE_BUFFER) + struct blk_bounce_buffer *bbstate = + container_of(state, struct blk_bounce_buffer, state); + struct udevice *dev = bbstate->dev; + const struct blk_ops *ops = blk_get_ops(dev); + + if (ops->buffer_aligned) + return ops->buffer_aligned(dev, state); +#endif /* CONFIG_BOUNCE_BUFFER */ + + return 1; /* Default, any buffer is OK */ +} + long blk_read(struct udevice *dev, lbaint_t start, lbaint_t blkcnt, void *buf) { struct blk_desc *desc = dev_get_uclass_plat(dev); @@ -456,7 +478,25 @@ long blk_read(struct udevice *dev, lbaint_t start, lbaint_t blkcnt, void *buf) if (blkcache_read(desc->uclass_id, desc->devnum, start, blkcnt, desc->blksz, buf)) return blkcnt; - blks_read = ops->read(dev, start, blkcnt, buf); + + if (IS_ENABLED(CONFIG_BOUNCE_BUFFER)) { + struct blk_bounce_buffer bbstate = { .dev = dev }; + int ret; + + ret = bounce_buffer_start_extalign(&bbstate.state, buf, + blkcnt * desc->blksz, + GEN_BB_WRITE, desc->blksz, + blk_buffer_aligned); + if (ret) + return ret; + + blks_read = ops->read(dev, start, blkcnt, bbstate.state.bounce_buffer); + + bounce_buffer_stop(&bbstate.state); + } else { + blks_read = ops->read(dev, start, blkcnt, buf); + } + if (blks_read == blkcnt) blkcache_fill(desc->uclass_id, desc->devnum, start, blkcnt, desc->blksz, buf); @@ -469,13 +509,33 @@ long blk_write(struct udevice *dev, lbaint_t start, lbaint_t blkcnt, { struct blk_desc *desc = dev_get_uclass_plat(dev); const struct blk_ops *ops = blk_get_ops(dev); + long blks_written; if (!ops->write) return -ENOSYS; blkcache_invalidate(desc->uclass_id, desc->devnum); - return ops->write(dev, start, blkcnt, buf); + if (IS_ENABLED(CONFIG_BOUNCE_BUFFER)) { + struct blk_bounce_buffer bbstate = { .dev = dev }; + int ret; + + ret = bounce_buffer_start_extalign(&bbstate.state, (void *)buf, + blkcnt * desc->blksz, + GEN_BB_READ, desc->blksz, + blk_buffer_aligned); + if (ret) + return ret; + + blks_written = ops->write(dev, start, blkcnt, + bbstate.state.bounce_buffer); + + bounce_buffer_stop(&bbstate.state); + } else { + blks_written = ops->write(dev, start, blkcnt, buf); + } + + return blks_written; } long blk_erase(struct udevice *dev, lbaint_t start, lbaint_t blkcnt) @@ -766,6 +826,54 @@ int blk_unbind_all(int uclass_id) return 0; } +static int part_create_block_devices(struct udevice *blk_dev) +{ + int part, count; + struct blk_desc *desc = dev_get_uclass_plat(blk_dev); + struct disk_partition info; + struct disk_part *part_data; + char devname[32]; + struct udevice *dev; + int ret; + + if (!CONFIG_IS_ENABLED(PARTITIONS) || !blk_enabled()) + return 0; + + if (device_get_uclass_id(blk_dev) != UCLASS_BLK) + return 0; + + /* Add devices for each partition */ + for (count = 0, part = 1; part <= MAX_SEARCH_PARTITIONS; part++) { + if (part_get_info(desc, part, &info)) + continue; + snprintf(devname, sizeof(devname), "%s:%d", blk_dev->name, + part); + + ret = device_bind_driver(blk_dev, "blk_partition", + strdup(devname), &dev); + if (ret) + return ret; + + part_data = dev_get_uclass_plat(dev); + part_data->partnum = part; + part_data->gpt_part_info = info; + count++; + + ret = device_probe(dev); + if (ret) { + debug("Can't probe\n"); + count--; + device_unbind(dev); + + continue; + } + } + debug("%s: %d partitions found in %s\n", __func__, count, + blk_dev->name); + + return 0; +} + static int blk_post_probe(struct udevice *dev) { if (CONFIG_IS_ENABLED(PARTITIONS) && blk_enabled()) { diff --git a/drivers/block/blkcache.c b/drivers/block/blkcache.c index f99465a..26bcbea 100644 --- a/drivers/block/blkcache.c +++ b/drivers/block/blkcache.c @@ -13,10 +13,6 @@ #include <linux/ctype.h> #include <linux/list.h> -#ifdef CONFIG_NEEDS_MANUAL_RELOC -DECLARE_GLOBAL_DATA_PTR; -#endif - struct block_cache_node { struct list_head lh; int iftype; @@ -34,18 +30,6 @@ static struct block_cache_stats _stats = { .max_entries = 32 }; -#ifdef CONFIG_NEEDS_MANUAL_RELOC -int blkcache_init(void) -{ - struct list_head *head = &block_cache; - - head->next = (uintptr_t)head->next + gd->reloc_off; - head->prev = (uintptr_t)head->prev + gd->reloc_off; - - return 0; -} -#endif - static struct block_cache_node *cache_find(int iftype, int devnum, lbaint_t start, lbaint_t blkcnt, unsigned long blksz) diff --git a/drivers/bootcount/bootcount-uclass.c b/drivers/bootcount/bootcount-uclass.c index c747c9a..5a369c8 100644 --- a/drivers/bootcount/bootcount-uclass.c +++ b/drivers/bootcount/bootcount-uclass.c @@ -10,6 +10,7 @@ #include <errno.h> #include <bootcount.h> #include <log.h> +#include <linux/printk.h> int dm_bootcount_get(struct udevice *dev, u32 *bootcount) { diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig index 29859cd..bfd23a9 100644 --- a/drivers/clk/Kconfig +++ b/drivers/clk/Kconfig @@ -83,6 +83,19 @@ config CLK_COMPOSITE_CCF Enable this option if you want to (re-)use the Linux kernel's Common Clock Framework [CCF] composite code in U-Boot's clock driver. +config CLK_GPIO + bool "GPIO-controlled clock gate driver" + depends on CLK + help + Enable this option to add GPIO-controlled clock gate driver. + +config SPL_CLK_GPIO + bool "GPIO-controlled clock gate driver in SPL" + depends on SPL_CLK + help + Enable this option to add GPIO-controlled clock gate driver + in U-Boot SPL. + config CLK_BCM6345 bool "Clock controller driver for BCM6345" depends on CLK && ARCH_BMIPS diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile index e22c8cf..26bf429 100644 --- a/drivers/clk/Makefile +++ b/drivers/clk/Makefile @@ -10,6 +10,7 @@ obj-$(CONFIG_$(SPL_TPL_)CLK) += clk_fixed_factor.o obj-$(CONFIG_$(SPL_TPL_)CLK_CCF) += clk.o clk-divider.o clk-mux.o clk-gate.o obj-$(CONFIG_$(SPL_TPL_)CLK_CCF) += clk-fixed-factor.o obj-$(CONFIG_$(SPL_TPL_)CLK_COMPOSITE_CCF) += clk-composite.o +obj-$(CONFIG_$(SPL_TPL_)CLK_GPIO) += clk-gpio.o obj-y += analogbits/ obj-y += imx/ diff --git a/drivers/clk/analogbits/wrpll-cln28hpc.c b/drivers/clk/analogbits/wrpll-cln28hpc.c index 776ead3..a3cb109 100644 --- a/drivers/clk/analogbits/wrpll-cln28hpc.c +++ b/drivers/clk/analogbits/wrpll-cln28hpc.c @@ -26,6 +26,7 @@ #include <linux/log2.h> #include <linux/math64.h> #include <linux/clk/analogbits-wrpll-cln28hpc.h> +#include <linux/printk.h> /* MIN_INPUT_FREQ: minimum input clock frequency, in Hz (Fref_min) */ #define MIN_INPUT_FREQ 7000000 diff --git a/drivers/clk/clk-divider.c b/drivers/clk/clk-divider.c index 6ab137a..2ad682b 100644 --- a/drivers/clk/clk-divider.c +++ b/drivers/clk/clk-divider.c @@ -28,6 +28,7 @@ #include <linux/log2.h> #include <div64.h> #include <clk.h> +#include <linux/printk.h> #include "clk.h" #define UBOOT_DM_CLK_CCF_DIVIDER "ccf_clk_divider" diff --git a/drivers/clk/clk-gate.c b/drivers/clk/clk-gate.c index a8775c7..cfd90b7 100644 --- a/drivers/clk/clk-gate.c +++ b/drivers/clk/clk-gate.c @@ -21,6 +21,7 @@ #include <linux/bitops.h> #include <linux/clk-provider.h> #include <linux/err.h> +#include <linux/printk.h> #include "clk.h" diff --git a/drivers/clk/clk-gpio.c b/drivers/clk/clk-gpio.c new file mode 100644 index 0000000..26d795b --- /dev/null +++ b/drivers/clk/clk-gpio.c @@ -0,0 +1,66 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2023 Marek Vasut <marek.vasut+renesas@mailbox.org> + */ + +#include <asm/gpio.h> +#include <common.h> +#include <clk-uclass.h> +#include <dm.h> + +struct clk_gpio_priv { + struct gpio_desc enable; +}; + +static int clk_gpio_enable(struct clk *clk) +{ + struct clk_gpio_priv *priv = dev_get_priv(clk->dev); + + dm_gpio_set_value(&priv->enable, 1); + + return 0; +} + +static int clk_gpio_disable(struct clk *clk) +{ + struct clk_gpio_priv *priv = dev_get_priv(clk->dev); + + dm_gpio_set_value(&priv->enable, 0); + + return 0; +} + +const struct clk_ops clk_gpio_ops = { + .enable = clk_gpio_enable, + .disable = clk_gpio_disable, +}; + +static int clk_gpio_probe(struct udevice *dev) +{ + struct clk_gpio_priv *priv = dev_get_priv(dev); + + return gpio_request_by_name(dev, "enable-gpios", 0, + &priv->enable, GPIOD_IS_OUT); +} + +/* + * When implementing clk-mux-clock, use gpio_request_list_by_name + * and implement get_rate/set_rate/set_parent ops. This should be + * in a separate driver and with separate Kconfig option to enable + * that driver, since unlike Linux implementation, the U-Boot DM + * integration would be orthogonal to this driver. + */ +static const struct udevice_id clk_gpio_match[] = { + { .compatible = "gpio-gate-clock" }, + { /* sentinel */ } +}; + +U_BOOT_DRIVER(gpio_gate_clock) = { + .name = "gpio_clock", + .id = UCLASS_CLK, + .of_match = clk_gpio_match, + .probe = clk_gpio_probe, + .priv_auto = sizeof(struct clk_gpio_priv), + .ops = &clk_gpio_ops, + .flags = DM_FLAG_PRE_RELOC, +}; diff --git a/drivers/clk/clk-hsdk-cgu.c b/drivers/clk/clk-hsdk-cgu.c index e28543e..85074f1 100644 --- a/drivers/clk/clk-hsdk-cgu.c +++ b/drivers/clk/clk-hsdk-cgu.c @@ -19,6 +19,7 @@ #include <linux/delay.h> #include <linux/io.h> #include <asm/arcregs.h> +#include <linux/printk.h> #include <dt-bindings/clock/snps,hsdk-cgu.h> diff --git a/drivers/clk/clk-mux.c b/drivers/clk/clk-mux.c index 017f25f..f410518 100644 --- a/drivers/clk/clk-mux.c +++ b/drivers/clk/clk-mux.c @@ -36,6 +36,7 @@ #include <linux/bitops.h> #include <linux/clk-provider.h> #include <linux/err.h> +#include <linux/printk.h> #include "clk.h" diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c index dc3e9d6..f186fcb 100644 --- a/drivers/clk/clk-uclass.c +++ b/drivers/clk/clk-uclass.c @@ -329,7 +329,13 @@ static int clk_set_default_rates(struct udevice *dev, dev_dbg(dev, "could not get assigned clock %d (err = %d)\n", index, ret); - continue; + /* Skip if it is empty */ + if (ret == -ENOENT) { + ret = 0; + continue; + } + + return ret; } /* This is clk provider device trying to program itself diff --git a/drivers/clk/clk_boston.c b/drivers/clk/clk_boston.c index 2e81777..4bcf911 100644 --- a/drivers/clk/clk_boston.c +++ b/drivers/clk/clk_boston.c @@ -10,6 +10,7 @@ #include <regmap.h> #include <syscon.h> #include <linux/bitops.h> +#include <linux/printk.h> struct clk_boston { struct regmap *regmap; diff --git a/drivers/clk/clk_versal.c b/drivers/clk/clk_versal.c index b3b3333..2e004be 100644 --- a/drivers/clk/clk_versal.c +++ b/drivers/clk/clk_versal.c @@ -68,6 +68,13 @@ #define CLOCK_NODE_TYPE_DIV 4 #define CLOCK_NODE_TYPE_GATE 6 +#define PM_CLK_REF_CLK (0x830c06aU) +#define PM_CLK_PL_ALT_REF_CLK (0x830c06bU) +#define PM_CLK_MUXED_IRO (0x830c06cU) +#define PM_CLK_EMIO (0x830c071U) + +#define TOPOLOGY_TYPE_FIXEDFACTOR 0x3 + enum clk_type { CLK_TYPE_OUTPUT, CLK_TYPE_EXTERNAL, @@ -365,48 +372,37 @@ static u32 versal_clock_set_div(u32 clk_id, u32 div) return div; } -static u64 versal_clock_ref(u32 clk_id) +static u64 versal_clock_get_ref_rate(u32 clk_id) { - u32 ret_payload[PAYLOAD_ARG_CNT]; - int ref; - - xilinx_pm_request(PM_CLOCK_GETPARENT, clk_id, 0, 0, 0, ret_payload); - ref = ret_payload[0]; - if (!(ref & 1)) + if (clk_id == PM_CLK_REF_CLK || clk_id == PM_CLK_MUXED_IRO || clk_id == PM_CLK_EMIO) return ref_clk; - if (ref & 2) + else if (clk_id == PM_CLK_PL_ALT_REF_CLK) return pl_alt_ref_clk; - return 0; + else + return 0; } -static u64 versal_clock_get_pll_rate(u32 clk_id) +static int versal_clock_get_fixed_factor_rate(u32 clock_id, u32 parent_id) { + struct versal_pm_query_data qdata = {0}; u32 ret_payload[PAYLOAD_ARG_CNT]; - u32 fbdiv; - u32 res; - u32 frac; - u64 freq; - u32 parent_rate, parent_id; - u32 id = clk_id & 0xFFF; + u32 mult, div; + u32 parent_rate; + int ret; - xilinx_pm_request(PM_CLOCK_GETSTATE, clk_id, 0, 0, 0, ret_payload); - res = ret_payload[1]; - if (!res) { - printf("0%x PLL not enabled\n", clk_id); - return 0; - } + qdata.qid = PM_QID_CLOCK_GET_FIXEDFACTOR_PARAMS; + qdata.arg1 = clock_id; - parent_id = clock[clock[id].parent[0].id].clk_id; - parent_rate = versal_clock_ref(parent_id); + ret = versal_pm_query(qdata, ret_payload); + if (ret) + return ret; - xilinx_pm_request(PM_CLOCK_GETDIVIDER, clk_id, 0, 0, 0, ret_payload); - fbdiv = ret_payload[1]; - xilinx_pm_request(PM_CLOCK_PLL_GETPARAM, clk_id, 2, 0, 0, ret_payload); - frac = ret_payload[1]; + mult = ret_payload[1]; + div = ret_payload[2]; - freq = (fbdiv * parent_rate) >> (1 << frac); + parent_rate = versal_clock_get_ref_rate(parent_id); + return parent_rate * mult / div; - return freq; } static u32 versal_clock_mux(u32 clk_id) @@ -437,6 +433,37 @@ static u32 versal_clock_get_parentid(u32 clk_id) return clock[clock[id].parent[parent_id].id].clk_id; } +static u64 versal_clock_get_pll_rate(u32 clk_id) +{ + u32 ret_payload[PAYLOAD_ARG_CNT]; + u32 fbdiv; + u32 res; + u32 frac; + u64 freq; + u32 parent_rate, parent_id, parent_ref_clk_id; + u32 id = clk_id & 0xFFF; + + xilinx_pm_request(PM_CLOCK_GETSTATE, clk_id, 0, 0, 0, ret_payload); + res = ret_payload[1]; + if (!res) { + printf("0%x PLL not enabled\n", clk_id); + return 0; + } + + parent_id = clock[clock[id].parent[0].id].clk_id; + parent_ref_clk_id = versal_clock_get_parentid(parent_id); + parent_rate = versal_clock_get_ref_rate(parent_ref_clk_id); + + xilinx_pm_request(PM_CLOCK_GETDIVIDER, clk_id, 0, 0, 0, ret_payload); + fbdiv = ret_payload[1]; + xilinx_pm_request(PM_CLOCK_PLL_GETPARAM, clk_id, 2, 0, 0, ret_payload); + frac = ret_payload[1]; + + freq = (fbdiv * parent_rate) >> (1 << frac); + + return freq; +} + static u32 versal_clock_gate(u32 clk_id) { u32 id = clk_id & 0xFFF; @@ -479,14 +506,19 @@ static u64 versal_clock_calc(u32 clk_id) u32 parent_id; u64 clk_rate; u32 div; + struct clock_topology topology; if (versal_clock_pll(clk_id, &clk_rate)) return clk_rate; parent_id = versal_clock_get_parentid(clk_id); if (((parent_id >> NODE_SUBCLASS_SHIFT) & - NODE_CLASS_MASK) == NODE_SUBCLASS_CLOCK_REF) - return versal_clock_ref(clk_id); + NODE_CLASS_MASK) == NODE_SUBCLASS_CLOCK_REF) { + topology = clock[clk_id & 0x3FF].node[0]; + if (topology.type == TOPOLOGY_TYPE_FIXEDFACTOR) + return versal_clock_get_fixed_factor_rate(clk_id, parent_id); + return versal_clock_get_ref_rate(parent_id); + } if (!parent_id) return 0; @@ -505,7 +537,7 @@ static int versal_clock_get_rate(u32 clk_id, u64 *clk_rate) { if (((clk_id >> NODE_SUBCLASS_SHIFT) & NODE_CLASS_MASK) == NODE_SUBCLASS_CLOCK_REF) - *clk_rate = versal_clock_ref(clk_id); + *clk_rate = versal_clock_get_ref_rate(clk_id); if (versal_clock_pll(clk_id, clk_rate)) return 0; diff --git a/drivers/clk/imx/clk-pll14xx.c b/drivers/clk/imx/clk-pll14xx.c index b93c0bc..1cb685e 100644 --- a/drivers/clk/imx/clk-pll14xx.c +++ b/drivers/clk/imx/clk-pll14xx.c @@ -18,6 +18,7 @@ #include <linux/iopoll.h> #include <clk.h> #include <div64.h> +#include <linux/printk.h> #include "clk.h" diff --git a/drivers/clk/rockchip/clk_rk3368.c b/drivers/clk/rockchip/clk_rk3368.c index a47c431..3406ff5 100644 --- a/drivers/clk/rockchip/clk_rk3368.c +++ b/drivers/clk/rockchip/clk_rk3368.c @@ -23,6 +23,7 @@ #include <dm/lists.h> #include <dt-bindings/clock/rk3368-cru.h> #include <linux/delay.h> +#include <linux/printk.h> #include <linux/stringify.h> #if CONFIG_IS_ENABLED(OF_PLATDATA) diff --git a/drivers/clk/rockchip/clk_rk3399.c b/drivers/clk/rockchip/clk_rk3399.c index f748fb5..c37e8a5 100644 --- a/drivers/clk/rockchip/clk_rk3399.c +++ b/drivers/clk/rockchip/clk_rk3399.c @@ -24,6 +24,7 @@ #include <dt-bindings/clock/rk3399-cru.h> #include <linux/bitops.h> #include <linux/delay.h> +#include <linux/printk.h> DECLARE_GLOBAL_DATA_PTR; diff --git a/drivers/core/device.c b/drivers/core/device.c index 6e26b64..bf7f261 100644 --- a/drivers/core/device.c +++ b/drivers/core/device.c @@ -33,6 +33,7 @@ #include <linux/err.h> #include <linux/list.h> #include <power-domain.h> +#include <linux/printk.h> DECLARE_GLOBAL_DATA_PTR; @@ -598,9 +599,10 @@ int device_probe(struct udevice *dev) ret = device_notify(dev, EVT_DM_POST_PROBE); if (ret) - return ret; + goto fail_event; return 0; +fail_event: fail_uclass: if (device_remove(dev, DM_REMOVE_NORMAL)) { dm_warn("%s: Device '%s' failed to remove on error path\n", diff --git a/drivers/core/dump.c b/drivers/core/dump.c index 3e77832..4023b39 100644 --- a/drivers/core/dump.c +++ b/drivers/core/dump.c @@ -85,29 +85,65 @@ static void show_devices(struct udevice *dev, int depth, int last_flag, } } -void dm_dump_tree(bool sort) +static void dm_dump_tree_single(struct udevice *dev, bool sort) { - struct udevice *root; + int dev_count, uclasses; + struct udevice **devs = NULL; - root = dm_root(); - if (root) { - int dev_count, uclasses; - struct udevice **devs = NULL; - - dm_get_stats(&dev_count, &uclasses); - - printf(" Class Index Probed Driver Name\n"); - printf("-----------------------------------------------------------\n"); - if (sort) { - devs = calloc(dev_count, sizeof(struct udevice *)); - if (!devs) { - printf("(out of memory)\n"); - return; + dm_get_stats(&dev_count, &uclasses); + + if (sort) { + devs = calloc(dev_count, sizeof(struct udevice *)); + if (!devs) { + printf("(out of memory)\n"); + return; + } + } + show_devices(dev, -1, 0, devs); + free(devs); +} + +static void dm_dump_tree_recursive(struct udevice *dev, char *dev_name, + bool extended, bool sort) +{ + struct udevice *child; + size_t len; + + len = strlen(dev_name); + + device_foreach_child(child, dev) { + if (extended) { + if (!strncmp(child->name, dev_name, len)) { + dm_dump_tree_single(child, sort); + continue; + } + } else { + if (!strcmp(child->name, dev_name)) { + dm_dump_tree_single(child, sort); + continue; } } - show_devices(root, -1, 0, devs); - free(devs); + dm_dump_tree_recursive(child, dev_name, extended, sort); + } +} + +void dm_dump_tree(char *dev_name, bool extended, bool sort) +{ + struct udevice *root; + + printf(" Class Index Probed Driver Name\n"); + printf("-----------------------------------------------------------\n"); + + root = dm_root(); + if (!root) + return; + + if (!dev_name || !strcmp(dev_name, "root")) { + dm_dump_tree_single(root, sort); + return; } + + dm_dump_tree_recursive(root, dev_name, extended, sort); } /** @@ -127,26 +163,50 @@ static void dm_display_line(struct udevice *dev, int index) puts("\n"); } -void dm_dump_uclass(void) +static void dm_dump_uclass_single(enum uclass_id id) { struct uclass *uc; + struct udevice *dev; + int i = 0, ret; + + ret = uclass_get(id, &uc); + if (ret) + return; + + printf("uclass %d: %s\n", id, uc->uc_drv->name); + uclass_foreach_dev(dev, uc) { + dm_display_line(dev, i); + i++; + } + puts("\n"); +} + +void dm_dump_uclass(char *uclass, bool extended) +{ + struct uclass *uc; + enum uclass_id id; + bool matching; int ret; - int id; - for (id = 0; id < UCLASS_COUNT; id++) { - struct udevice *dev; - int i = 0; + matching = !!(uclass && strcmp(uclass, "root")); + for (id = 0; id < UCLASS_COUNT; id++) { ret = uclass_get(id, &uc); if (ret) continue; - printf("uclass %d: %s\n", id, uc->uc_drv->name); - uclass_foreach_dev(dev, uc) { - dm_display_line(dev, i); - i++; + if (matching) { + if (extended) { + if (!strncmp(uc->uc_drv->name, uclass, + strlen(uclass))) + dm_dump_uclass_single(id); + } else { + if (!strcmp(uc->uc_drv->name, uclass)) + dm_dump_uclass_single(id); + } + } else { + dm_dump_uclass_single(id); } - puts("\n"); } } diff --git a/drivers/core/of_access.c b/drivers/core/of_access.c index 57f1044..1bb4d8e 100644 --- a/drivers/core/of_access.c +++ b/drivers/core/of_access.c @@ -570,26 +570,34 @@ int of_read_u32_index(const struct device_node *np, const char *propname, return 0; } -int of_read_u64(const struct device_node *np, const char *propname, u64 *outp) +int of_read_u64_index(const struct device_node *np, const char *propname, + int index, u64 *outp) { const __be64 *val; debug("%s: %s: ", __func__, propname); if (!np) return -EINVAL; - val = of_find_property_value_of_size(np, propname, sizeof(*outp)); + + val = of_find_property_value_of_size(np, propname, + sizeof(*outp) * (index + 1)); if (IS_ERR(val)) { debug("(not found)\n"); return PTR_ERR(val); } - *outp = be64_to_cpup(val); + *outp = be64_to_cpup(val + index); debug("%#llx (%lld)\n", (unsigned long long)*outp, - (unsigned long long)*outp); + (unsigned long long)*outp); return 0; } +int of_read_u64(const struct device_node *np, const char *propname, u64 *outp) +{ + return of_read_u64_index(np, propname, 0, outp); +} + int of_property_match_string(const struct device_node *np, const char *propname, const char *string) { diff --git a/drivers/core/of_addr.c b/drivers/core/of_addr.c index 431dd4e..b3b3d7c 100644 --- a/drivers/core/of_addr.c +++ b/drivers/core/of_addr.c @@ -14,6 +14,7 @@ #include <dm/of_addr.h> #include <linux/err.h> #include <linux/ioport.h> +#include <linux/printk.h> /* Max address size we deal with */ #define OF_MAX_ADDR_CELLS 4 diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c index 8df16e5..2cafa7b 100644 --- a/drivers/core/ofnode.c +++ b/drivers/core/ofnode.c @@ -103,7 +103,7 @@ void *ofnode_lookup_fdt(ofnode node) if (gd->flags & GD_FLG_RELOC) { uint i = OFTREE_TREE_ID(node.of_offset); - if (i > oftree_count) { + if (i >= oftree_count) { log_debug("Invalid tree ID %x\n", i); return NULL; } @@ -344,6 +344,36 @@ int ofnode_read_u32_index(ofnode node, const char *propname, int index, return 0; } +int ofnode_read_u64_index(ofnode node, const char *propname, int index, + u64 *outp) +{ + const fdt64_t *cell; + int len; + + assert(ofnode_valid(node)); + + if (ofnode_is_np(node)) + return of_read_u64_index(ofnode_to_np(node), propname, index, + outp); + + cell = fdt_getprop(ofnode_to_fdt(node), ofnode_to_offset(node), + propname, &len); + if (!cell) { + debug("(not found)\n"); + return -EINVAL; + } + + if (len < (sizeof(u64) * (index + 1))) { + debug("(not large enough)\n"); + return -EOVERFLOW; + } + + *outp = fdt64_to_cpu(cell[index]); + debug("%#llx (%lld)\n", *outp, *outp); + + return 0; +} + u32 ofnode_read_u32_index_default(ofnode node, const char *propname, int index, u32 def) { @@ -1353,7 +1383,7 @@ bool ofnode_pre_reloc(ofnode node) */ if (ofnode_read_bool(node, "bootph-pre-ram") || ofnode_read_bool(node, "bootph-pre-sram")) - return true; + return gd->flags & GD_FLG_RELOC; if (IS_ENABLED(CONFIG_OF_TAG_MIGRATE)) { /* detect and handle old tags */ @@ -1563,6 +1593,65 @@ const char *ofnode_conf_read_str(const char *prop_name) return ofnode_read_string(node, prop_name); } +int ofnode_read_bootscript_address(u64 *bootscr_address, u64 *bootscr_offset) +{ + int ret; + ofnode uboot; + + *bootscr_address = 0; + *bootscr_offset = 0; + + uboot = ofnode_path("/options/u-boot"); + if (!ofnode_valid(uboot)) { + debug("%s: Missing /u-boot node\n", __func__); + return -EINVAL; + } + + ret = ofnode_read_u64(uboot, "bootscr-address", bootscr_address); + if (ret) { + ret = ofnode_read_u64(uboot, "bootscr-ram-offset", + bootscr_offset); + if (ret) + return -EINVAL; + } + + return 0; +} + +int ofnode_read_bootscript_flash(u64 *bootscr_flash_offset, + u64 *bootscr_flash_size) +{ + int ret; + ofnode uboot; + + *bootscr_flash_offset = 0; + *bootscr_flash_size = 0; + + uboot = ofnode_path("/options/u-boot"); + if (!ofnode_valid(uboot)) { + debug("%s: Missing /u-boot node\n", __func__); + return -EINVAL; + } + + ret = ofnode_read_u64(uboot, "bootscr-flash-offset", + bootscr_flash_offset); + if (ret) + return -EINVAL; + + ret = ofnode_read_u64(uboot, "bootscr-flash-size", + bootscr_flash_size); + if (ret) + return -EINVAL; + + if (!bootscr_flash_size) { + debug("bootscr-flash-size is zero. Ignoring properties!\n"); + *bootscr_flash_offset = 0; + return -EINVAL; + } + + return 0; +} + ofnode ofnode_get_phy_node(ofnode node) { /* DT node properties that reference a PHY node */ diff --git a/drivers/core/root.c b/drivers/core/root.c index 79d871a..126b314 100644 --- a/drivers/core/root.c +++ b/drivers/core/root.c @@ -29,6 +29,7 @@ #include <dm/uclass-internal.h> #include <dm/util.h> #include <linux/list.h> +#include <linux/printk.h> DECLARE_GLOBAL_DATA_PTR; @@ -55,81 +56,6 @@ void dm_fixup_for_gd_move(struct global_data *new_gd) } } -void fix_drivers(void) -{ - struct driver *drv = - ll_entry_start(struct driver, driver); - const int n_ents = ll_entry_count(struct driver, driver); - struct driver *entry; - - for (entry = drv; entry != drv + n_ents; entry++) { - if (entry->of_match) - entry->of_match = (const struct udevice_id *) - ((ulong)entry->of_match + gd->reloc_off); - if (entry->bind) - entry->bind += gd->reloc_off; - if (entry->probe) - entry->probe += gd->reloc_off; - if (entry->remove) - entry->remove += gd->reloc_off; - if (entry->unbind) - entry->unbind += gd->reloc_off; - if (entry->of_to_plat) - entry->of_to_plat += gd->reloc_off; - if (entry->child_post_bind) - entry->child_post_bind += gd->reloc_off; - if (entry->child_pre_probe) - entry->child_pre_probe += gd->reloc_off; - if (entry->child_post_remove) - entry->child_post_remove += gd->reloc_off; - /* OPS are fixed in every uclass post_probe function */ - if (entry->ops) - entry->ops += gd->reloc_off; - } -} - -void fix_uclass(void) -{ - struct uclass_driver *uclass = - ll_entry_start(struct uclass_driver, uclass_driver); - const int n_ents = ll_entry_count(struct uclass_driver, uclass_driver); - struct uclass_driver *entry; - - for (entry = uclass; entry != uclass + n_ents; entry++) { - if (entry->post_bind) - entry->post_bind += gd->reloc_off; - if (entry->pre_unbind) - entry->pre_unbind += gd->reloc_off; - if (entry->pre_probe) - entry->pre_probe += gd->reloc_off; - if (entry->post_probe) - entry->post_probe += gd->reloc_off; - if (entry->pre_remove) - entry->pre_remove += gd->reloc_off; - if (entry->child_post_bind) - entry->child_post_bind += gd->reloc_off; - if (entry->child_pre_probe) - entry->child_pre_probe += gd->reloc_off; - if (entry->init) - entry->init += gd->reloc_off; - if (entry->destroy) - entry->destroy += gd->reloc_off; - } -} - -void fix_devices(void) -{ - struct driver_info *dev = - ll_entry_start(struct driver_info, driver_info); - const int n_ents = ll_entry_count(struct driver_info, driver_info); - struct driver_info *entry; - - for (entry = dev; entry != dev + n_ents; entry++) { - if (entry->plat) - entry->plat += gd->reloc_off; - } -} - static int dm_setup_inst(void) { DM_ROOT_NON_CONST = DM_DEVICE_GET(root); @@ -181,12 +107,6 @@ int dm_init(bool of_live) INIT_LIST_HEAD(DM_UCLASS_ROOT_NON_CONST); } - if (IS_ENABLED(CONFIG_NEEDS_MANUAL_RELOC)) { - fix_drivers(); - fix_uclass(); - fix_devices(); - } - if (CONFIG_IS_ENABLED(OF_PLATDATA_INST)) { ret = dm_setup_inst(); if (ret) { diff --git a/drivers/cpu/cpu-uclass.c b/drivers/cpu/cpu-uclass.c index a754832..9772578 100644 --- a/drivers/cpu/cpu-uclass.c +++ b/drivers/cpu/cpu-uclass.c @@ -127,36 +127,9 @@ static int uclass_cpu_init(struct uclass *uc) return ret; } -static int uclass_cpu_post_bind(struct udevice *dev) -{ - if (IS_ENABLED(CONFIG_NEEDS_MANUAL_RELOC) && - (gd->flags & GD_FLG_RELOC)) { - struct cpu_ops *ops = cpu_get_ops(dev); - static int reloc_done; - - if (!reloc_done) { - if (ops->get_desc) - MANUAL_RELOC(ops->get_desc); - if (ops->get_info) - MANUAL_RELOC(ops->get_info); - if (ops->get_count) - MANUAL_RELOC(ops->get_count); - if (ops->get_vendor) - MANUAL_RELOC(ops->get_vendor); - if (ops->is_current) - MANUAL_RELOC(ops->is_current); - - reloc_done++; - } - } - - return 0; -} - UCLASS_DRIVER(cpu) = { .id = UCLASS_CPU, .name = "cpu", .flags = DM_UC_FLAG_SEQ_ALIAS, .init = uclass_cpu_init, - .post_bind = uclass_cpu_post_bind, }; diff --git a/drivers/cpu/microblaze_cpu.c b/drivers/cpu/microblaze_cpu.c index c97a89f..a229f69 100644 --- a/drivers/cpu/microblaze_cpu.c +++ b/drivers/cpu/microblaze_cpu.c @@ -19,7 +19,7 @@ DECLARE_GLOBAL_DATA_PTR; ci = tmp; \ } -static int microblaze_cpu_probe_all(void *ctx, struct event *event) +static int microblaze_cpu_probe_all(void) { int ret; @@ -29,7 +29,7 @@ static int microblaze_cpu_probe_all(void *ctx, struct event *event) return 0; } -EVENT_SPY(EVT_DM_POST_INIT_F, microblaze_cpu_probe_all); +EVENT_SPY_SIMPLE(EVT_DM_POST_INIT_F, microblaze_cpu_probe_all); static void microblaze_set_cpuinfo_pvr(struct microblaze_cpuinfo *ci) { diff --git a/drivers/crypto/rsa_mod_exp/mod_exp_uclass.c b/drivers/crypto/rsa_mod_exp/mod_exp_uclass.c index 6a4d235..057cc74 100644 --- a/drivers/crypto/rsa_mod_exp/mod_exp_uclass.c +++ b/drivers/crypto/rsa_mod_exp/mod_exp_uclass.c @@ -16,24 +16,11 @@ #include <asm/io.h> #include <linux/list.h> -#if !defined(USE_HOSTCC) && defined(CONFIG_NEEDS_MANUAL_RELOC) -DECLARE_GLOBAL_DATA_PTR; -#endif - int rsa_mod_exp(struct udevice *dev, const uint8_t *sig, uint32_t sig_len, struct key_prop *node, uint8_t *out) { struct mod_exp_ops *ops = (struct mod_exp_ops *)device_get_ops(dev); -#if !defined(USE_HOSTCC) && defined(CONFIG_NEEDS_MANUAL_RELOC) - static bool done; - - if (!done) { - done = true; - ops->mod_exp += gd->reloc_off; - } -#endif - if (!ops->mod_exp) return -ENOSYS; diff --git a/drivers/ddr/imx/phy/helper.c b/drivers/ddr/imx/phy/helper.c index 8cd4387..855a874 100644 --- a/drivers/ddr/imx/phy/helper.c +++ b/drivers/ddr/imx/phy/helper.c @@ -46,13 +46,13 @@ void ddr_load_train_firmware(enum fw_type type) u32 error = 0; unsigned long pr_to32, pr_from32; uint32_t fw_offset = type ? IMEM_2D_OFFSET : 0; - unsigned long imem_start = (unsigned long)&_end + fw_offset; + unsigned long imem_start = (unsigned long)_end + fw_offset; unsigned long dmem_start; unsigned long imem_len = IMEM_LEN, dmem_len = DMEM_LEN; #ifdef CONFIG_SPL_OF_CONTROL if (gd->fdt_blob && !fdt_check_header(gd->fdt_blob)) { - imem_start = roundup((unsigned long)&_end + + imem_start = roundup((unsigned long)_end + fdt_totalsize(gd->fdt_blob), 4) + fw_offset; } diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c index b2ee5f1..2adf26e 100644 --- a/drivers/dfu/dfu.c +++ b/drivers/dfu/dfu.c @@ -17,6 +17,7 @@ #include <hash.h> #include <linux/list.h> #include <linux/compiler.h> +#include <linux/printk.h> LIST_HEAD(dfu_list); static int dfu_alt_num; diff --git a/drivers/dfu/dfu_mmc.c b/drivers/dfu/dfu_mmc.c index f583208..cdb3c18 100644 --- a/drivers/dfu/dfu_mmc.c +++ b/drivers/dfu/dfu_mmc.c @@ -17,6 +17,7 @@ #include <mmc.h> #include <part.h> #include <command.h> +#include <linux/printk.h> static unsigned char *dfu_file_buf; static u64 dfu_file_buf_len; diff --git a/drivers/dfu/dfu_ram.c b/drivers/dfu/dfu_ram.c index 9d10303..c4f4bd2 100644 --- a/drivers/dfu/dfu_ram.c +++ b/drivers/dfu/dfu_ram.c @@ -13,6 +13,7 @@ #include <mapmem.h> #include <errno.h> #include <dfu.h> +#include <linux/printk.h> static int dfu_transfer_medium_ram(enum dfu_op op, struct dfu_entity *dfu, u64 offset, void *buf, long *len) diff --git a/drivers/dma/bcm6348-iudma.c b/drivers/dma/bcm6348-iudma.c index 4fc6502..d4cfe0c 100644 --- a/drivers/dma/bcm6348-iudma.c +++ b/drivers/dma/bcm6348-iudma.c @@ -28,6 +28,7 @@ #include <asm/io.h> #include <linux/bitops.h> #include <linux/delay.h> +#include <linux/printk.h> #define DMA_RX_DESC 6 #define DMA_TX_DESC 1 diff --git a/drivers/dma/dma-uclass.c b/drivers/dma/dma-uclass.c index 34f72fa..0c1d88e 100644 --- a/drivers/dma/dma-uclass.c +++ b/drivers/dma/dma-uclass.c @@ -22,6 +22,7 @@ #include <linux/dma-mapping.h> #include <dt-structs.h> #include <errno.h> +#include <linux/printk.h> #ifdef CONFIG_DMA_CHANNELS static inline struct dma_ops *dma_dev_ops(struct udevice *dev) diff --git a/drivers/dma/lpc32xx_dma.c b/drivers/dma/lpc32xx_dma.c index ab58e97..0efdfd0 100644 --- a/drivers/dma/lpc32xx_dma.c +++ b/drivers/dma/lpc32xx_dma.c @@ -17,6 +17,7 @@ #include <asm/io.h> #include <linux/bitops.h> #include <linux/delay.h> +#include <linux/printk.h> /* DMA controller channel register structure */ struct dmac_chan_reg { diff --git a/drivers/dma/sandbox-dma-test.c b/drivers/dma/sandbox-dma-test.c index 2b8259a..a19e5e3 100644 --- a/drivers/dma/sandbox-dma-test.c +++ b/drivers/dma/sandbox-dma-test.c @@ -15,6 +15,7 @@ #include <dma-uclass.h> #include <dt-structs.h> #include <errno.h> +#include <linux/printk.h> #define SANDBOX_DMA_CH_CNT 3 #define SANDBOX_DMA_BUF_SIZE 1024 diff --git a/drivers/dma/ti-edma3.c b/drivers/dma/ti-edma3.c index 1ad3b92..31ffff0 100644 --- a/drivers/dma/ti-edma3.c +++ b/drivers/dma/ti-edma3.c @@ -16,6 +16,7 @@ #include <linux/dma-mapping.h> #include <asm/omap_common.h> #include <asm/ti-common/ti-edma3.h> +#include <linux/printk.h> #define EDMA3_SL_BASE(slot) (0x4000 + ((slot) << 5)) #define EDMA3_SL_MAX_NUM 512 diff --git a/drivers/dma/ti/k3-psil-j721e.c b/drivers/dma/ti/k3-psil-j721e.c index 105ffd9..8e57e86 100644 --- a/drivers/dma/ti/k3-psil-j721e.c +++ b/drivers/dma/ti/k3-psil-j721e.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 /* - * Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com + * Copyright (C) 2019-2023 Texas Instruments Incorporated - https://www.ti.com * Author: Peter Ujfalusi <peter.ujfalusi@ti.com> */ @@ -21,13 +21,15 @@ /* PSI-L source thread IDs, used for RX (DMA_DEV_TO_MEM) */ static struct psil_ep j721e_src_ep_map[] = { - /* CPSW0 */ + /* MCU_CPSW0 */ PSIL_ETHERNET(0x7000), + /* MAIN_CPSW0 */ + PSIL_ETHERNET(0x4a00), }; /* PSI-L destination thread IDs, used for TX (DMA_MEM_TO_DEV) */ static struct psil_ep j721e_dst_ep_map[] = { - /* CPSW0 */ + /* MCU_CPSW0 */ PSIL_ETHERNET(0xf000), PSIL_ETHERNET(0xf001), PSIL_ETHERNET(0xf002), @@ -36,6 +38,15 @@ static struct psil_ep j721e_dst_ep_map[] = { PSIL_ETHERNET(0xf005), PSIL_ETHERNET(0xf006), PSIL_ETHERNET(0xf007), + /* MAIN_CPSW0 */ + PSIL_ETHERNET(0xca00), + PSIL_ETHERNET(0xca01), + PSIL_ETHERNET(0xca02), + PSIL_ETHERNET(0xca03), + PSIL_ETHERNET(0xca04), + PSIL_ETHERNET(0xca05), + PSIL_ETHERNET(0xca06), + PSIL_ETHERNET(0xca07), }; struct psil_ep_map j721e_ep_map = { diff --git a/drivers/dma/ti/k3-udma.c b/drivers/dma/ti/k3-udma.c index 05c3a43..4f2effd 100644 --- a/drivers/dma/ti/k3-udma.c +++ b/drivers/dma/ti/k3-udma.c @@ -25,6 +25,7 @@ #include <linux/delay.h> #include <linux/bitmap.h> #include <linux/err.h> +#include <linux/printk.h> #include <linux/soc/ti/k3-navss-ringacc.h> #include <linux/soc/ti/cppi5.h> #include <linux/soc/ti/ti-udma.h> diff --git a/drivers/fastboot/Kconfig b/drivers/fastboot/Kconfig index a3df9aa..837c6f1 100644 --- a/drivers/fastboot/Kconfig +++ b/drivers/fastboot/Kconfig @@ -56,7 +56,7 @@ config FASTBOOT_BUF_ADDR ROCKCHIP_RK3399 default 0x280000 if ROCKCHIP_RK3368 default 0x100000 if ARCH_ZYNQMP - default 0 if SANDBOX + default 0x0 if SANDBOX help The fastboot protocol requires a large memory buffer for downloads. Define this to the starting RAM address to use for diff --git a/drivers/fastboot/fb_command.c b/drivers/fastboot/fb_command.c index 71cfaec..5fcadcd 100644 --- a/drivers/fastboot/fb_command.c +++ b/drivers/fastboot/fb_command.c @@ -12,6 +12,7 @@ #include <fb_nand.h> #include <part.h> #include <stdlib.h> +#include <linux/printk.h> /** * image_size - final fastboot image size diff --git a/drivers/fastboot/fb_getvar.c b/drivers/fastboot/fb_getvar.c index dd3475e..8cb8ffa 100644 --- a/drivers/fastboot/fb_getvar.c +++ b/drivers/fastboot/fb_getvar.c @@ -12,6 +12,7 @@ #include <fs.h> #include <part.h> #include <version.h> +#include <linux/printk.h> static void getvar_version(char *var_parameter, char *response); static void getvar_version_bootloader(char *var_parameter, char *response); @@ -183,7 +184,7 @@ static void __maybe_unused getvar_has_slot(char *part_name, char *response) /* part_name_wslot = part_name + "_a" */ len = strlcpy(part_name_wslot, part_name, PART_NAME_LEN - 3); - if (len > PART_NAME_LEN - 3) + if (len >= PART_NAME_LEN - 3) goto fail; strcat(part_name_wslot, "_a"); diff --git a/drivers/fastboot/fb_nand.c b/drivers/fastboot/fb_nand.c index 6d3a900..bbe26dd 100644 --- a/drivers/fastboot/fb_nand.c +++ b/drivers/fastboot/fb_nand.c @@ -11,6 +11,7 @@ #include <fastboot.h> #include <image-sparse.h> +#include <linux/printk.h> #include <linux/mtd/mtd.h> #include <jffs2/jffs2.h> #include <nand.h> diff --git a/drivers/firmware/firmware-zynqmp.c b/drivers/firmware/firmware-zynqmp.c index ab4c4f1..43fb7fa 100644 --- a/drivers/firmware/firmware-zynqmp.c +++ b/drivers/firmware/firmware-zynqmp.c @@ -195,6 +195,19 @@ int zynqmp_pm_set_sd_config(u32 node, enum pm_sd_config_type config, u32 value) return ret; } +int zynqmp_pm_feature(const u32 api_id) +{ + int ret; + u32 ret_payload[PAYLOAD_ARG_CNT]; + + /* Check feature check API version */ + ret = xilinx_pm_request(PM_FEATURE_CHECK, api_id, 0, 0, 0, + ret_payload); + + /* Return feature check version */ + return ret_payload[1] & FIRMWARE_VERSION_MASK; +} + int zynqmp_pm_is_function_supported(const u32 api_id, const u32 id) { int ret; diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c index 31027f3..7aece85 100644 --- a/drivers/gpio/gpio-uclass.c +++ b/drivers/gpio/gpio-uclass.c @@ -28,6 +28,8 @@ DECLARE_GLOBAL_DATA_PTR; +#define GPIO_ALLOC_BITS 32 + /** * gpio_desc_init() - Initialize the GPIO descriptor * @@ -75,6 +77,46 @@ static int gpio_to_device(unsigned int gpio, struct gpio_desc *desc) return -ENOENT; } +/** + * gpio_is_claimed() - Test whether GPIO is claimed by consumer + * + * Test whether GPIO is claimed by consumer already. + * + * @uc_priv: gpio_dev_priv pointer. + * @offset: gpio offset within the device + * @return: true if claimed, false if not claimed + */ +static bool gpio_is_claimed(struct gpio_dev_priv *uc_priv, unsigned int offset) +{ + return !!(uc_priv->claimed[offset / GPIO_ALLOC_BITS] & BIT(offset % GPIO_ALLOC_BITS)); +} + +/** + * gpio_set_claim() - Set GPIO claimed by consumer + * + * Set a bit which indicate the GPIO is claimed by consumer + * + * @uc_priv: gpio_dev_priv pointer. + * @offset: gpio offset within the device + */ +static void gpio_set_claim(struct gpio_dev_priv *uc_priv, unsigned int offset) +{ + uc_priv->claimed[offset / GPIO_ALLOC_BITS] |= BIT(offset % GPIO_ALLOC_BITS); +} + +/** + * gpio_clear_claim() - Clear GPIO claimed by consumer + * + * Clear a bit which indicate the GPIO is claimed by consumer + * + * @uc_priv: gpio_dev_priv pointer. + * @offset: gpio offset within the device + */ +static void gpio_clear_claim(struct gpio_dev_priv *uc_priv, unsigned int offset) +{ + uc_priv->claimed[offset / GPIO_ALLOC_BITS] &= ~BIT(offset % GPIO_ALLOC_BITS); +} + #if CONFIG_IS_ENABLED(DM_GPIO_LOOKUP_LABEL) /** * dm_gpio_lookup_label() - look for name in gpio device @@ -94,7 +136,7 @@ static int dm_gpio_lookup_label(const char *name, *offset = -1; for (i = 0; i < uc_priv->gpio_count; i++) { - if (!uc_priv->name[i]) + if (!gpio_is_claimed(uc_priv, i)) continue; if (!strcmp(name, uc_priv->name[i])) { *offset = i; @@ -350,7 +392,7 @@ int dm_gpio_request(struct gpio_desc *desc, const char *label) int ret; uc_priv = dev_get_uclass_priv(dev); - if (uc_priv->name[desc->offset]) + if (gpio_is_claimed(uc_priv, desc->offset)) return -EBUSY; str = strdup(label); if (!str) @@ -362,6 +404,8 @@ int dm_gpio_request(struct gpio_desc *desc, const char *label) return ret; } } + + gpio_set_claim(uc_priv, desc->offset); uc_priv->name[desc->offset] = str; return 0; @@ -438,7 +482,7 @@ int _dm_gpio_free(struct udevice *dev, uint offset) int ret; uc_priv = dev_get_uclass_priv(dev); - if (!uc_priv->name[offset]) + if (!gpio_is_claimed(uc_priv, offset)) return -ENXIO; if (ops->rfree) { ret = ops->rfree(dev, offset); @@ -446,6 +490,7 @@ int _dm_gpio_free(struct udevice *dev, uint offset) return ret; } + gpio_clear_claim(uc_priv, offset); free(uc_priv->name[offset]); uc_priv->name[offset] = NULL; @@ -480,7 +525,7 @@ static int check_reserved(const struct gpio_desc *desc, const char *func) return -ENOENT; uc_priv = dev_get_uclass_priv(desc->dev); - if (!uc_priv->name[desc->offset]) { + if (!gpio_is_claimed(uc_priv, desc->offset)) { printf("%s: %s: error: gpio %s%d not reserved\n", desc->dev->name, func, uc_priv->bank_name ? uc_priv->bank_name : "", @@ -826,7 +871,7 @@ static int get_function(struct udevice *dev, int offset, bool skip_unused, return -EINVAL; if (namep) *namep = uc_priv->name[offset]; - if (skip_unused && !uc_priv->name[offset]) + if (skip_unused && !gpio_is_claimed(uc_priv, offset)) return GPIOF_UNUSED; if (ops->get_function) { int ret; @@ -1341,6 +1386,14 @@ static int gpio_post_probe(struct udevice *dev) if (!uc_priv->name) return -ENOMEM; + uc_priv->claimed = calloc(DIV_ROUND_UP(uc_priv->gpio_count, + GPIO_ALLOC_BITS), + GPIO_ALLOC_BITS / 8); + if (!uc_priv->claimed) { + free(uc_priv->name); + return -ENOMEM; + } + return gpio_renumber(NULL); } @@ -1353,6 +1406,7 @@ static int gpio_pre_remove(struct udevice *dev) if (uc_priv->name[i]) free(uc_priv->name[i]); } + free(uc_priv->claimed); free(uc_priv->name); return gpio_renumber(dev); @@ -1444,36 +1498,6 @@ void devm_gpiod_put(struct udevice *dev, struct gpio_desc *desc) static int gpio_post_bind(struct udevice *dev) { -#if defined(CONFIG_NEEDS_MANUAL_RELOC) - struct dm_gpio_ops *ops = (struct dm_gpio_ops *)device_get_ops(dev); - static int reloc_done; - - if (!reloc_done) { - if (ops->request) - ops->request += gd->reloc_off; - if (ops->rfree) - ops->rfree += gd->reloc_off; - if (ops->direction_input) - ops->direction_input += gd->reloc_off; - if (ops->direction_output) - ops->direction_output += gd->reloc_off; - if (ops->get_value) - ops->get_value += gd->reloc_off; - if (ops->set_value) - ops->set_value += gd->reloc_off; - if (ops->get_function) - ops->get_function += gd->reloc_off; - if (ops->xlate) - ops->xlate += gd->reloc_off; - if (ops->set_flags) - ops->set_flags += gd->reloc_off; - if (ops->get_flags) - ops->get_flags += gd->reloc_off; - - reloc_done++; - } -#endif - if (CONFIG_IS_ENABLED(GPIO_HOG) && dev_has_ofnode(dev)) { struct udevice *child; ofnode node; diff --git a/drivers/gpio/pca953x_gpio.c b/drivers/gpio/pca953x_gpio.c index 4654f9e..b0c66d1 100644 --- a/drivers/gpio/pca953x_gpio.c +++ b/drivers/gpio/pca953x_gpio.c @@ -407,6 +407,7 @@ static const struct udevice_id pca953x_ids[] = { { .compatible = "ti,tca6416", .data = OF_953X(16, PCA_INT), }, { .compatible = "ti,tca6424", .data = OF_953X(24, PCA_INT), }, { .compatible = "ti,tca9539", .data = OF_953X(16, PCA_INT), }, + { .compatible = "ti,tca9554", .data = OF_953X(8, PCA_INT), }, { .compatible = "onsemi,pca9654", .data = OF_953X(8, PCA_INT), }, diff --git a/drivers/hwspinlock/hwspinlock-uclass.c b/drivers/hwspinlock/hwspinlock-uclass.c index e012d5a..e9a4d7f 100644 --- a/drivers/hwspinlock/hwspinlock-uclass.c +++ b/drivers/hwspinlock/hwspinlock-uclass.c @@ -123,28 +123,7 @@ int hwspinlock_unlock(struct hwspinlock *hws) return ops->unlock(hws->dev, hws->id); } -static int hwspinlock_post_bind(struct udevice *dev) -{ -#if defined(CONFIG_NEEDS_MANUAL_RELOC) - struct hwspinlock_ops *ops = device_get_ops(dev); - static int reloc_done; - - if (!reloc_done) { - if (ops->lock) - ops->lock += gd->reloc_off; - if (ops->unlock) - ops->unlock += gd->reloc_off; - if (ops->relax) - ops->relax += gd->reloc_off; - - reloc_done++; - } -#endif - return 0; -} - UCLASS_DRIVER(hwspinlock) = { .id = UCLASS_HWSPINLOCK, .name = "hwspinlock", - .post_bind = hwspinlock_post_bind, }; diff --git a/drivers/i2c/Kconfig b/drivers/i2c/Kconfig index 4c76fd7..4f42200 100644 --- a/drivers/i2c/Kconfig +++ b/drivers/i2c/Kconfig @@ -372,7 +372,7 @@ config SYS_MXC_I2C1_SPEED config SYS_MXC_I2C1_SLAVE hex "I2C1 Slave" - default 0 + default 0x0 help MXC I2C1 Slave endif @@ -387,7 +387,7 @@ config SYS_MXC_I2C2_SPEED config SYS_MXC_I2C2_SLAVE hex "I2C2 Slave" - default 0 + default 0x0 help MXC I2C2 Slave endif @@ -401,7 +401,7 @@ config SYS_MXC_I2C3_SPEED config SYS_MXC_I2C3_SLAVE hex "I2C3 Slave" - default 0 + default 0x0 help MXC I2C3 Slave endif @@ -415,7 +415,7 @@ config SYS_MXC_I2C4_SPEED config SYS_MXC_I2C4_SLAVE hex "I2C4 Slave" - default 0 + default 0x0 help MXC I2C4 Slave endif @@ -429,7 +429,7 @@ config SYS_MXC_I2C5_SPEED config SYS_MXC_I2C5_SLAVE hex "I2C5 Slave" - default 0 + default 0x0 help MXC I2C5 Slave endif @@ -443,7 +443,7 @@ config SYS_MXC_I2C6_SPEED config SYS_MXC_I2C6_SLAVE hex "I2C6 Slave" - default 0 + default 0x0 help MXC I2C6 Slave endif @@ -457,7 +457,7 @@ config SYS_MXC_I2C7_SPEED config SYS_MXC_I2C7_SLAVE hex "I2C7 Slave" - default 0 + default 0x0 help MXC I2C7 Slave endif @@ -471,7 +471,7 @@ config SYS_MXC_I2C8_SPEED config SYS_MXC_I2C8_SLAVE hex "I2C8 Slave" - default 0 + default 0x0 help MXC I2C8 Slave endif diff --git a/drivers/i2c/i2c-gpio.c b/drivers/i2c/i2c-gpio.c index c1fc290..5fc3cfe 100644 --- a/drivers/i2c/i2c-gpio.c +++ b/drivers/i2c/i2c-gpio.c @@ -12,6 +12,7 @@ #include <log.h> #include <asm/gpio.h> #include <linux/delay.h> +#include <linux/printk.h> #define DEFAULT_UDELAY 5 #define RETRIES 0 diff --git a/drivers/i2c/iproc_i2c.c b/drivers/i2c/iproc_i2c.c index d975e78..39af49c 100644 --- a/drivers/i2c/iproc_i2c.c +++ b/drivers/i2c/iproc_i2c.c @@ -9,6 +9,7 @@ #include <common.h> #include <config.h> #include <dm.h> +#include <linux/printk.h> #include "errno.h" #include <i2c.h> #include "iproc_i2c.h" diff --git a/drivers/i2c/omap24xx_i2c.c b/drivers/i2c/omap24xx_i2c.c index c656cf8..6fc9d1e 100644 --- a/drivers/i2c/omap24xx_i2c.c +++ b/drivers/i2c/omap24xx_i2c.c @@ -43,6 +43,7 @@ #include <i2c.h> #include <log.h> #include <linux/delay.h> +#include <linux/printk.h> #include <asm/io.h> #include <asm/omap_i2c.h> diff --git a/drivers/i2c/stm32f7_i2c.c b/drivers/i2c/stm32f7_i2c.c index 836148e..b6c7178 100644 --- a/drivers/i2c/stm32f7_i2c.c +++ b/drivers/i2c/stm32f7_i2c.c @@ -19,6 +19,7 @@ #include <linux/delay.h> #include <linux/err.h> #include <linux/io.h> +#include <linux/printk.h> /* STM32 I2C registers */ struct stm32_i2c_regs { diff --git a/drivers/i2c/tegra_i2c.c b/drivers/i2c/tegra_i2c.c index 5864a1a..57d77d5 100644 --- a/drivers/i2c/tegra_i2c.c +++ b/drivers/i2c/tegra_i2c.c @@ -21,6 +21,7 @@ #include <asm/arch-tegra/tegra_i2c.h> #include <linux/delay.h> #include <linux/err.h> +#include <linux/printk.h> enum i2c_type { TYPE_114, diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index b9f5c7a..c930e4a 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig @@ -122,6 +122,14 @@ config VEXPRESS_CONFIG configuration bus on the Arm Versatile Express boards via a sysreg driver. +config CBMEM_CONSOLE + bool "Write console output to coreboot cbmem" + depends on X86 + help + Enables console output to the cbmem console, which is a memory + region set up by coreboot to hold a record of all console output. + Enable this only if booting from coreboot. + config CMD_CROS_EC bool "Enable crosec command" depends on CROS_EC @@ -555,7 +563,7 @@ config SPL_I2C_EEPROM config SYS_I2C_EEPROM_ADDR hex "Chip address of the EEPROM device" depends on ID_EEPROM || I2C_EEPROM || SPL_I2C_EEPROM || CMD_EEPROM || ENV_IS_IN_EEPROM - default 0 + default 0x0 if I2C_EEPROM diff --git a/drivers/misc/cbmem_console.c b/drivers/misc/cbmem_console.c index 8bbe33d..ba3a599 100644 --- a/drivers/misc/cbmem_console.c +++ b/drivers/misc/cbmem_console.c @@ -5,27 +5,37 @@ #include <common.h> #include <console.h> -#ifndef CONFIG_SYS_COREBOOT -#error This driver requires coreboot -#endif - #include <asm/cb_sysinfo.h> -struct cbmem_console { - u32 buffer_size; - u32 buffer_cursor; - u8 buffer_body[0]; -} __attribute__ ((__packed__)); - -static struct cbmem_console *cbmem_console_p; - void cbmemc_putc(struct stdio_dev *dev, char data) { - int cursor; + const struct sysinfo_t *sysinfo = cb_get_sysinfo(); + struct cbmem_console *cons; + uint pos, flags; + + if (!sysinfo) + return; + cons = sysinfo->cbmem_cons; + if (!cons) + return; + + pos = cons->cursor & CBMC_CURSOR_MASK; + + /* preserve the overflow flag if present */ + flags = cons->cursor & ~CBMC_CURSOR_MASK; + + cons->body[pos++] = data; + + /* + * Deal with overflow - the flag may be cleared by another program which + * reads the buffer out later, e.g. Linux + */ + if (pos >= cons->size) { + pos = 0; + flags |= CBMC_OVERFLOW; + } - cursor = cbmem_console_p->buffer_cursor++; - if (cursor < cbmem_console_p->buffer_size) - cbmem_console_p->buffer_body[cursor] = data; + cons->cursor = flags | pos; } void cbmemc_puts(struct stdio_dev *dev, const char *str) @@ -40,7 +50,6 @@ int cbmemc_init(void) { int rc; struct stdio_dev cons_dev; - cbmem_console_p = lib_sysinfo.cbmem_cons; memset(&cons_dev, 0, sizeof(cons_dev)); diff --git a/drivers/misc/cros_ec.c b/drivers/misc/cros_ec.c index 621d175..9c1e6a5 100644 --- a/drivers/misc/cros_ec.c +++ b/drivers/misc/cros_ec.c @@ -1100,8 +1100,11 @@ int cros_ec_get_sku_id(struct udevice *dev) ret = ec_command_inptr(dev, EC_CMD_GET_SKU_ID, 0, NULL, 0, (uint8_t **)&r, sizeof(*r)); - if (ret != sizeof(*r)) - return -ret; + if (ret != sizeof(*r)) { + if (ret >= 0) + ret = -EIO; + return ret; + } return r->sku_id; } diff --git a/drivers/misc/k3_avs.c b/drivers/misc/k3_avs.c index 840148d..acfc731 100644 --- a/drivers/misc/k3_avs.c +++ b/drivers/misc/k3_avs.c @@ -382,6 +382,8 @@ static struct vd_config am654_vd_config = { static const struct udevice_id k3_avs_ids[] = { { .compatible = "ti,am654-avs", .data = (ulong)&am654_vd_config }, { .compatible = "ti,j721e-avs", .data = (ulong)&j721e_vd_config }, + { .compatible = "ti,j721e-vtm", .data = (ulong)&j721e_vd_config }, + { .compatible = "ti,j7200-vtm", .data = (ulong)&j721e_vd_config }, {} }; diff --git a/drivers/misc/sifive-otp.c b/drivers/misc/sifive-otp.c index 3e658b3..a624a35 100644 --- a/drivers/misc/sifive-otp.c +++ b/drivers/misc/sifive-otp.c @@ -24,6 +24,7 @@ #include <linux/delay.h> #include <linux/io.h> #include <misc.h> +#include <linux/printk.h> #define BYTES_PER_FUSE 4 diff --git a/drivers/misc/tegra186_bpmp.c b/drivers/misc/tegra186_bpmp.c index dbee7f7..fecac9c 100644 --- a/drivers/misc/tegra186_bpmp.c +++ b/drivers/misc/tegra186_bpmp.c @@ -17,6 +17,7 @@ #include <asm/arch-tegra/ivc.h> #include <linux/bitops.h> #include <linux/err.h> +#include <linux/printk.h> #define BPMP_IVC_FRAME_COUNT 1 #define BPMP_IVC_FRAME_SIZE 128 diff --git a/drivers/mmc/dw_mmc.c b/drivers/mmc/dw_mmc.c index 5085a3b..400066f 100644 --- a/drivers/mmc/dw_mmc.c +++ b/drivers/mmc/dw_mmc.c @@ -509,6 +509,10 @@ static int dwmci_set_ios(struct mmc *mmc) if (mmc->vqmmc_supply) { int ret; + ret = regulator_set_enable_if_allowed(mmc->vqmmc_supply, false); + if (ret) + return ret; + if (mmc->signal_voltage == MMC_SIGNAL_VOLTAGE_180) regulator_set_value(mmc->vqmmc_supply, 1800000); else diff --git a/drivers/mmc/exynos_dw_mmc.c b/drivers/mmc/exynos_dw_mmc.c index 544798b..2f849c4 100644 --- a/drivers/mmc/exynos_dw_mmc.c +++ b/drivers/mmc/exynos_dw_mmc.c @@ -16,6 +16,7 @@ #include <asm/arch/pinmux.h> #include <asm/arch/power.h> #include <asm/gpio.h> +#include <linux/printk.h> #define DWMMC_MAX_CH_NUM 4 #define DWMMC_MAX_FREQ 52000000 diff --git a/drivers/mmc/fsl_esdhc_imx.c b/drivers/mmc/fsl_esdhc_imx.c index 66caf68..7c39c86 100644 --- a/drivers/mmc/fsl_esdhc_imx.c +++ b/drivers/mmc/fsl_esdhc_imx.c @@ -26,6 +26,7 @@ #include <linux/bitops.h> #include <linux/delay.h> #include <linux/err.h> +#include <linux/printk.h> #include <power/regulator.h> #include <malloc.h> #include <fsl_esdhc_imx.h> diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 31cfda2..d96db7a 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -19,6 +19,7 @@ #include <part.h> #include <linux/bitops.h> #include <linux/delay.h> +#include <linux/printk.h> #include <power/regulator.h> #include <malloc.h> #include <memalign.h> @@ -2775,9 +2776,10 @@ static int mmc_power_on(struct mmc *mmc) { #if CONFIG_IS_ENABLED(DM_MMC) && CONFIG_IS_ENABLED(DM_REGULATOR) if (mmc->vmmc_supply) { - int ret = regulator_set_enable(mmc->vmmc_supply, true); + int ret = regulator_set_enable_if_allowed(mmc->vmmc_supply, + true); - if (ret && ret != -EACCES) { + if (ret && ret != -ENOSYS) { printf("Error enabling VMMC supply : %d\n", ret); return ret; } @@ -2791,9 +2793,10 @@ static int mmc_power_off(struct mmc *mmc) mmc_set_clock(mmc, 0, MMC_CLK_DISABLE); #if CONFIG_IS_ENABLED(DM_MMC) && CONFIG_IS_ENABLED(DM_REGULATOR) if (mmc->vmmc_supply) { - int ret = regulator_set_enable(mmc->vmmc_supply, false); + int ret = regulator_set_enable_if_allowed(mmc->vmmc_supply, + false); - if (ret && ret != -EACCES) { + if (ret && ret != -ENOSYS) { pr_debug("Error disabling VMMC supply : %d\n", ret); return ret; } diff --git a/drivers/mmc/mtk-sd.c b/drivers/mmc/mtk-sd.c index b206b0a..d21a30c 100644 --- a/drivers/mmc/mtk-sd.c +++ b/drivers/mmc/mtk-sd.c @@ -20,6 +20,7 @@ #include <linux/bitops.h> #include <linux/io.h> #include <linux/iopoll.h> +#include <linux/printk.h> /* MSDC_CFG */ #define MSDC_CFG_HS400_CK_MODE_EXT BIT(22) diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c index 9cbe126..fc9c6c3 100644 --- a/drivers/mmc/sdhci.c +++ b/drivers/mmc/sdhci.c @@ -19,6 +19,7 @@ #include <linux/bitops.h> #include <linux/delay.h> #include <linux/dma-mapping.h> +#include <linux/printk.h> #include <phys2bus.h> #include <power/regulator.h> diff --git a/drivers/mmc/sti_sdhci.c b/drivers/mmc/sti_sdhci.c index 6194768..23a1dd4 100644 --- a/drivers/mmc/sti_sdhci.c +++ b/drivers/mmc/sti_sdhci.c @@ -12,6 +12,7 @@ #include <sdhci.h> #include <asm/arch/sdhci.h> #include <asm/global_data.h> +#include <linux/printk.h> DECLARE_GLOBAL_DATA_PTR; diff --git a/drivers/mmc/stm32_sdmmc2.c b/drivers/mmc/stm32_sdmmc2.c index b68594d..5ff5e1a 100644 --- a/drivers/mmc/stm32_sdmmc2.c +++ b/drivers/mmc/stm32_sdmmc2.c @@ -27,6 +27,7 @@ #include <linux/iopoll.h> #include <power/regulator.h> #include <watchdog.h> +#include <linux/printk.h> struct stm32_sdmmc2_plat { struct mmc_config cfg; diff --git a/drivers/mmc/xenon_sdhci.c b/drivers/mmc/xenon_sdhci.c index 16ac84a..27dbe04 100644 --- a/drivers/mmc/xenon_sdhci.c +++ b/drivers/mmc/xenon_sdhci.c @@ -23,6 +23,7 @@ #include <linux/libfdt.h> #include <malloc.h> #include <sdhci.h> +#include <linux/printk.h> #include <power/regulator.h> DECLARE_GLOBAL_DATA_PTR; diff --git a/drivers/mtd/mtdconcat.c b/drivers/mtd/mtdconcat.c index af3c476..5123258 100644 --- a/drivers/mtd/mtdconcat.c +++ b/drivers/mtd/mtdconcat.c @@ -23,6 +23,7 @@ #include <div64.h> #include <linux/bug.h> #include <linux/compat.h> +#include <linux/printk.h> #endif #include <linux/mtd/mtd.h> diff --git a/drivers/mtd/nand/bbt.c b/drivers/mtd/nand/bbt.c index 294daee..972aec6 100644 --- a/drivers/mtd/nand/bbt.c +++ b/drivers/mtd/nand/bbt.c @@ -16,6 +16,7 @@ #ifndef __UBOOT__ #include <linux/slab.h> #endif +#include <linux/printk.h> /** * nanddev_bbt_init() - Initialize the BBT (Bad Block Table) diff --git a/drivers/mtd/nand/core.c b/drivers/mtd/nand/core.c index 4b9dd6a..f6d9c58 100644 --- a/drivers/mtd/nand/core.c +++ b/drivers/mtd/nand/core.c @@ -17,6 +17,7 @@ #endif #include <linux/bitops.h> #include <linux/mtd/nand.h> +#include <linux/printk.h> /** * nanddev_isbad() - Check if a block is bad diff --git a/drivers/mtd/nand/raw/arasan_nfc.c b/drivers/mtd/nand/raw/arasan_nfc.c index 5879412..1476640 100644 --- a/drivers/mtd/nand/raw/arasan_nfc.c +++ b/drivers/mtd/nand/raw/arasan_nfc.c @@ -18,6 +18,7 @@ #include <asm/arch/sys_proto.h> #include <dm.h> #include <nand.h> +#include <linux/printk.h> struct nand_config { u32 page; diff --git a/drivers/mtd/nand/raw/atmel/nand-controller.c b/drivers/mtd/nand/raw/atmel/nand-controller.c index 950e626..fa962ba 100644 --- a/drivers/mtd/nand/raw/atmel/nand-controller.c +++ b/drivers/mtd/nand/raw/atmel/nand-controller.c @@ -1474,7 +1474,6 @@ static void atmel_nand_init(struct atmel_nand_controller *nc, mtd->dev->parent = nc->dev; nand->controller = &nc->base; - nand->controller = &nc->base; chip->cmd_ctrl = atmel_nand_cmd_ctrl; chip->read_byte = atmel_nand_read_byte; diff --git a/drivers/mtd/nand/raw/atmel_nand.c b/drivers/mtd/nand/raw/atmel_nand.c index b7e473c..6b17e74 100644 --- a/drivers/mtd/nand/raw/atmel_nand.c +++ b/drivers/mtd/nand/raw/atmel_nand.c @@ -19,6 +19,7 @@ #include <linux/bitops.h> #include <linux/bug.h> #include <linux/delay.h> +#include <linux/printk.h> #include <malloc.h> #include <nand.h> diff --git a/drivers/mtd/nand/raw/brcmnand/bcm63158_nand.c b/drivers/mtd/nand/raw/brcmnand/bcm63158_nand.c index aa095c4..4e6d99f 100644 --- a/drivers/mtd/nand/raw/brcmnand/bcm63158_nand.c +++ b/drivers/mtd/nand/raw/brcmnand/bcm63158_nand.c @@ -10,6 +10,7 @@ #include <linux/io.h> #include <linux/ioport.h> #include <dm.h> +#include <linux/printk.h> #include "brcmnand.h" diff --git a/drivers/mtd/nand/raw/brcmnand/bcm6368_nand.c b/drivers/mtd/nand/raw/brcmnand/bcm6368_nand.c index e4bf193..6164989 100644 --- a/drivers/mtd/nand/raw/brcmnand/bcm6368_nand.c +++ b/drivers/mtd/nand/raw/brcmnand/bcm6368_nand.c @@ -9,6 +9,7 @@ #include <linux/io.h> #include <linux/ioport.h> #include <dm.h> +#include <linux/printk.h> #include "brcmnand.h" diff --git a/drivers/mtd/nand/raw/brcmnand/bcm68360_nand.c b/drivers/mtd/nand/raw/brcmnand/bcm68360_nand.c index 586ea3d..dbd85af 100644 --- a/drivers/mtd/nand/raw/brcmnand/bcm68360_nand.c +++ b/drivers/mtd/nand/raw/brcmnand/bcm68360_nand.c @@ -9,6 +9,7 @@ #include <linux/io.h> #include <linux/ioport.h> #include <dm.h> +#include <linux/printk.h> #include "brcmnand.h" diff --git a/drivers/mtd/nand/raw/brcmnand/bcm6838_nand.c b/drivers/mtd/nand/raw/brcmnand/bcm6838_nand.c index 85f318b..ef36496 100644 --- a/drivers/mtd/nand/raw/brcmnand/bcm6838_nand.c +++ b/drivers/mtd/nand/raw/brcmnand/bcm6838_nand.c @@ -10,6 +10,7 @@ #include <linux/io.h> #include <linux/ioport.h> #include <dm.h> +#include <linux/printk.h> #include "brcmnand.h" diff --git a/drivers/mtd/nand/raw/brcmnand/bcm6858_nand.c b/drivers/mtd/nand/raw/brcmnand/bcm6858_nand.c index a5e159a..027fdd3 100644 --- a/drivers/mtd/nand/raw/brcmnand/bcm6858_nand.c +++ b/drivers/mtd/nand/raw/brcmnand/bcm6858_nand.c @@ -10,6 +10,7 @@ #include <linux/io.h> #include <linux/ioport.h> #include <dm.h> +#include <linux/printk.h> #include "brcmnand.h" diff --git a/drivers/mtd/nand/raw/davinci_nand.c b/drivers/mtd/nand/raw/davinci_nand.c index e4e144b..71bbb82 100644 --- a/drivers/mtd/nand/raw/davinci_nand.c +++ b/drivers/mtd/nand/raw/davinci_nand.c @@ -35,6 +35,7 @@ #include <nand.h> #include <dm/uclass.h> #include <asm/ti-common/davinci_nand.h> +#include <linux/printk.h> /* Definitions for 4-bit hardware ECC */ #define NAND_TIMEOUT 10240 diff --git a/drivers/mtd/nand/raw/lpc32xx_nand_mlc.c b/drivers/mtd/nand/raw/lpc32xx_nand_mlc.c index 2854117..ac2e669 100644 --- a/drivers/mtd/nand/raw/lpc32xx_nand_mlc.c +++ b/drivers/mtd/nand/raw/lpc32xx_nand_mlc.c @@ -28,6 +28,7 @@ #include <nand.h> #include <asm/arch/clk.h> #include <asm/arch/sys_proto.h> +#include <linux/printk.h> /* * MLC NAND controller registers. diff --git a/drivers/mtd/nand/raw/lpc32xx_nand_slc.c b/drivers/mtd/nand/raw/lpc32xx_nand_slc.c index 356f8d9..b21a0b9 100644 --- a/drivers/mtd/nand/raw/lpc32xx_nand_slc.c +++ b/drivers/mtd/nand/raw/lpc32xx_nand_slc.c @@ -23,6 +23,7 @@ #include <asm/arch/sys_proto.h> #include <asm/arch/dma.h> #include <asm/arch/cpu.h> +#include <linux/printk.h> struct lpc32xx_nand_slc_regs { u32 data; diff --git a/drivers/mtd/nand/raw/mxc_nand.c b/drivers/mtd/nand/raw/mxc_nand.c index 051ded6..dbdc5b0 100644 --- a/drivers/mtd/nand/raw/mxc_nand.c +++ b/drivers/mtd/nand/raw/mxc_nand.c @@ -15,6 +15,7 @@ #if defined(CONFIG_MX51) || defined(CONFIG_MX53) #include <asm/arch/imx-regs.h> #endif +#include <linux/printk.h> #include "mxc_nand.h" #define DRIVER_NAME "mxc_nand" diff --git a/drivers/mtd/nand/raw/nand_bch.c b/drivers/mtd/nand/raw/nand_bch.c index 734d1c6..bb48ebb 100644 --- a/drivers/mtd/nand/raw/nand_bch.c +++ b/drivers/mtd/nand/raw/nand_bch.c @@ -10,6 +10,7 @@ #include <common.h> #include <log.h> #include <dm/devres.h> +#include <linux/printk.h> /*#include <asm/io.h>*/ #include <linux/types.h> diff --git a/drivers/mtd/nand/raw/pxa3xx_nand.c b/drivers/mtd/nand/raw/pxa3xx_nand.c index d502e96..1d9a6d1 100644 --- a/drivers/mtd/nand/raw/pxa3xx_nand.c +++ b/drivers/mtd/nand/raw/pxa3xx_nand.c @@ -22,6 +22,7 @@ #include <asm/arch/cpu.h> #include <linux/mtd/mtd.h> #include <linux/mtd/rawnand.h> +#include <linux/printk.h> #include <linux/types.h> #include <syscon.h> #include <regmap.h> diff --git a/drivers/mtd/nand/raw/stm32_fmc2_nand.c b/drivers/mtd/nand/raw/stm32_fmc2_nand.c index 69dbb62..64be648 100644 --- a/drivers/mtd/nand/raw/stm32_fmc2_nand.c +++ b/drivers/mtd/nand/raw/stm32_fmc2_nand.c @@ -21,6 +21,7 @@ #include <linux/iopoll.h> #include <linux/ioport.h> #include <linux/mtd/rawnand.h> +#include <linux/printk.h> /* Bad block marker length */ #define FMC2_BBM_LEN 2 diff --git a/drivers/mtd/nand/raw/sunxi_nand.c b/drivers/mtd/nand/raw/sunxi_nand.c index c0fa1e3..0b5b74d 100644 --- a/drivers/mtd/nand/raw/sunxi_nand.c +++ b/drivers/mtd/nand/raw/sunxi_nand.c @@ -36,6 +36,7 @@ #include <linux/bitops.h> #include <linux/delay.h> #include <linux/err.h> +#include <linux/printk.h> #include <linux/kernel.h> #include <linux/mtd/mtd.h> diff --git a/drivers/mtd/nand/raw/tegra_nand.c b/drivers/mtd/nand/raw/tegra_nand.c index 139d978..6086ecd 100644 --- a/drivers/mtd/nand/raw/tegra_nand.c +++ b/drivers/mtd/nand/raw/tegra_nand.c @@ -24,6 +24,7 @@ #include <fdtdec.h> #include <bouncebuf.h> #include <dm.h> +#include <linux/printk.h> #include "tegra_nand.h" DECLARE_GLOBAL_DATA_PTR; diff --git a/drivers/mtd/nand/raw/vf610_nfc.c b/drivers/mtd/nand/raw/vf610_nfc.c index d4b40e8..d2363a0 100644 --- a/drivers/mtd/nand/raw/vf610_nfc.c +++ b/drivers/mtd/nand/raw/vf610_nfc.c @@ -24,6 +24,7 @@ #include <common.h> #include <malloc.h> #include <dm/device_compat.h> +#include <linux/printk.h> #include <linux/mtd/mtd.h> #include <linux/mtd/rawnand.h> diff --git a/drivers/mtd/nand/raw/zynq_nand.c b/drivers/mtd/nand/raw/zynq_nand.c index 545fdd7..bacaf13 100644 --- a/drivers/mtd/nand/raw/zynq_nand.c +++ b/drivers/mtd/nand/raw/zynq_nand.c @@ -21,6 +21,7 @@ #include <asm/arch/hardware.h> #include <asm/arch/sys_proto.h> #include <dm.h> +#include <linux/printk.h> /* The NAND flash driver defines */ #define ZYNQ_NAND_CMD_PHASE 1 diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c index 70d8ae5..4ee11e8 100644 --- a/drivers/mtd/nand/spi/core.c +++ b/drivers/mtd/nand/spi/core.c @@ -30,6 +30,7 @@ #include <linux/bitops.h> #include <linux/bug.h> #include <linux/mtd/spinand.h> +#include <linux/printk.h> #endif /* SPI NAND index visible in MTD names */ diff --git a/drivers/mtd/nvmxip/nvmxip-uclass.c b/drivers/mtd/nvmxip/nvmxip-uclass.c index 6d8eb17..9a316d1 100644 --- a/drivers/mtd/nvmxip/nvmxip-uclass.c +++ b/drivers/mtd/nvmxip/nvmxip-uclass.c @@ -22,27 +22,13 @@ #define DEFAULT_LBA_SZ BIT(DEFAULT_LBA_SHIFT) -/** - * nvmxip_post_bind() - post binding treatments - * @dev: the NVMXIP device - * - * Create and probe a child block device. - * - * Return: - * - * 0 on success. Otherwise, failure - */ -static int nvmxip_post_bind(struct udevice *udev) +int nvmxip_probe(struct udevice *udev) { int ret; struct udevice *bdev = NULL; char bdev_name[NVMXIP_BLKDEV_NAME_SZ + 1]; int devnum; -#if CONFIG_IS_ENABLED(SANDBOX64) - sandbox_set_enable_memio(true); -#endif - devnum = uclass_id_count(UCLASS_NVMXIP); snprintf(bdev_name, NVMXIP_BLKDEV_NAME_SZ, "blk#%d", devnum); @@ -67,6 +53,12 @@ static int nvmxip_post_bind(struct udevice *udev) return 0; } +static int nvmxip_post_bind(struct udevice *udev) +{ + dev_or_flags(udev, DM_FLAG_PROBE_AFTER_BIND); + return 0; +} + UCLASS_DRIVER(nvmxip) = { .name = "nvmxip", .id = UCLASS_NVMXIP, diff --git a/drivers/mtd/nvmxip/nvmxip.c b/drivers/mtd/nvmxip/nvmxip.c index a359e3b..0bd98d6 100644 --- a/drivers/mtd/nvmxip/nvmxip.c +++ b/drivers/mtd/nvmxip/nvmxip.c @@ -16,23 +16,6 @@ #include "nvmxip.h" /** - * nvmxip_mmio_rawread() - read from the XIP flash - * @address: address of the data - * @value: pointer to where storing the value read - * - * Read raw data from the XIP flash. - * - * Return: - * - * Always return 0. - */ -static int nvmxip_mmio_rawread(const phys_addr_t address, u64 *value) -{ - *value = readq(address); - return 0; -} - -/** * nvmxip_blk_read() - block device read operation * @dev: the block device * @blknr: first block number to read from @@ -49,15 +32,14 @@ static ulong nvmxip_blk_read(struct udevice *dev, lbaint_t blknr, lbaint_t blkcn { struct nvmxip_plat *plat = dev_get_plat(dev->parent); struct blk_desc *desc = dev_get_uclass_plat(dev); - /* number of the u64 words to read */ - u32 qwords = (blkcnt * desc->blksz) / sizeof(u64); + /* number of bytes to read */ + u32 size = blkcnt * desc->blksz; /* physical address of the first block to read */ phys_addr_t blkaddr = plat->phys_base + blknr * desc->blksz; - u64 *virt_blkaddr; - u64 *pdst = buffer; + void *virt_blkaddr; uint qdata_idx; - if (!pdst) + if (!buffer) return -EINVAL; log_debug("[%s]: reading from blknr: %lu , blkcnt: %lu\n", dev->name, blknr, blkcnt); @@ -66,12 +48,16 @@ static ulong nvmxip_blk_read(struct udevice *dev, lbaint_t blknr, lbaint_t blkcn /* assumption: the data is virtually contiguous */ - for (qdata_idx = 0 ; qdata_idx < qwords ; qdata_idx++) - nvmxip_mmio_rawread((phys_addr_t)(virt_blkaddr + qdata_idx), pdst++); - +#if IS_ENABLED(CONFIG_PHYS_64BIT) + for (qdata_idx = 0 ; qdata_idx < size; qdata_idx += sizeof(u64)) + *(u64 *)(buffer + qdata_idx) = readq(virt_blkaddr + qdata_idx); +#else + for (qdata_idx = 0 ; qdata_idx < size; qdata_idx += sizeof(u32)) + *(u32 *)(buffer + qdata_idx) = readl(virt_blkaddr + qdata_idx); +#endif log_debug("[%s]: src[0]: 0x%llx , dst[0]: 0x%llx , src[-1]: 0x%llx , dst[-1]: 0x%llx\n", dev->name, - *virt_blkaddr, + *(u64 *)virt_blkaddr, *(u64 *)buffer, *(u64 *)((u8 *)virt_blkaddr + desc->blksz * blkcnt - sizeof(u64)), *(u64 *)((u8 *)buffer + desc->blksz * blkcnt - sizeof(u64))); diff --git a/drivers/mtd/nvmxip/nvmxip_qspi.c b/drivers/mtd/nvmxip/nvmxip_qspi.c index 7221fd1..4d74711 100644 --- a/drivers/mtd/nvmxip/nvmxip_qspi.c +++ b/drivers/mtd/nvmxip/nvmxip_qspi.c @@ -50,8 +50,8 @@ static int nvmxip_qspi_of_to_plat(struct udevice *dev) return -EINVAL; } - log_debug("[%s]: XIP device base addr: 0x%llx , lba_shift: %d , lbas: %lu\n", - dev->name, plat->phys_base, plat->lba_shift, plat->lba); + log_debug("[%s]: XIP device base addr: 0x%p , lba_shift: %d , lbas: %lu\n", + dev->name, (void *)(uintptr_t)plat->phys_base, plat->lba_shift, plat->lba); return 0; } @@ -66,5 +66,6 @@ U_BOOT_DRIVER(nvmxip_qspi) = { .id = UCLASS_NVMXIP, .of_match = nvmxip_qspi_ids, .of_to_plat = nvmxip_qspi_of_to_plat, + .probe = nvmxip_probe, .plat_auto = sizeof(struct nvmxip_plat), }; diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c index 08fe7d4..762b01c 100644 --- a/drivers/mtd/onenand/onenand_base.c +++ b/drivers/mtd/onenand/onenand_base.c @@ -26,6 +26,7 @@ #include <linux/bitops.h> #include <linux/compat.h> #include <linux/mtd/mtd.h> +#include <linux/printk.h> #include "linux/mtd/flashchip.h" #include <linux/mtd/onenand.h> diff --git a/drivers/mtd/onenand/onenand_bbt.c b/drivers/mtd/onenand/onenand_bbt.c index eca9edf..cc1e449 100644 --- a/drivers/mtd/onenand/onenand_bbt.c +++ b/drivers/mtd/onenand/onenand_bbt.c @@ -20,6 +20,7 @@ #include <linux/mtd/mtd.h> #include <linux/mtd/onenand.h> #include <malloc.h> +#include <linux/printk.h> #include <linux/errno.h> diff --git a/drivers/mtd/onenand/samsung.c b/drivers/mtd/onenand/samsung.c index 657abaa..c415e51 100644 --- a/drivers/mtd/onenand/samsung.c +++ b/drivers/mtd/onenand/samsung.c @@ -16,6 +16,7 @@ #include <linux/mtd/onenand.h> #include <linux/mtd/flashchip.h> #include <linux/mtd/samsung_onenand.h> +#include <linux/printk.h> #include <asm/io.h> #include <linux/errno.h> diff --git a/drivers/mtd/spi/sf-uclass.c b/drivers/mtd/spi/sf-uclass.c index df1f753..2da0cf0 100644 --- a/drivers/mtd/spi/sf-uclass.c +++ b/drivers/mtd/spi/sf-uclass.c @@ -96,22 +96,6 @@ static int spi_flash_post_bind(struct udevice *dev) return log_msg_ret("bd", ret); } -#if defined(CONFIG_NEEDS_MANUAL_RELOC) - struct dm_spi_flash_ops *ops = sf_get_ops(dev); - static int reloc_done; - - if (!reloc_done) { - if (ops->read) - ops->read += gd->reloc_off; - if (ops->write) - ops->write += gd->reloc_off; - if (ops->erase) - ops->erase += gd->reloc_off; - - reloc_done++; - } -#endif - return 0; } diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c index 6093277..db20feb 100644 --- a/drivers/mtd/spi/spi-nor-core.c +++ b/drivers/mtd/spi/spi-nor-core.c @@ -21,6 +21,7 @@ #include <linux/errno.h> #include <linux/log2.h> #include <linux/math64.h> +#include <linux/printk.h> #include <linux/sizes.h> #include <linux/bitfield.h> #include <linux/delay.h> diff --git a/drivers/mtd/spi/spi-nor-ids.c b/drivers/mtd/spi/spi-nor-ids.c index 4587215..b03dd1c 100644 --- a/drivers/mtd/spi/spi-nor-ids.c +++ b/drivers/mtd/spi/spi-nor-ids.c @@ -249,6 +249,7 @@ const struct flash_info spi_nor_ids[] = { { INFO("mx25u6435f", 0xc22537, 0, 64 * 1024, 128, SECT_4K) }, { INFO("mx25l12805d", 0xc22018, 0, 64 * 1024, 256, SECT_4K) }, { INFO("mx25u12835f", 0xc22538, 0, 64 * 1024, 256, SECT_4K) }, + { INFO("mx25u25635f", 0xc22539, 0, 64 * 1024, 512, SECT_4K) }, { INFO("mx25u51245g", 0xc2253a, 0, 64 * 1024, 1024, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) }, { INFO("mx25l12855e", 0xc22618, 0, 64 * 1024, 256, 0) }, diff --git a/drivers/mtd/spi/spi-nor-tiny.c b/drivers/mtd/spi/spi-nor-tiny.c index 7aa24e1..0719fe8 100644 --- a/drivers/mtd/spi/spi-nor-tiny.c +++ b/drivers/mtd/spi/spi-nor-tiny.c @@ -16,6 +16,7 @@ #include <linux/errno.h> #include <linux/log2.h> #include <linux/math64.h> +#include <linux/printk.h> #include <linux/sizes.h> #include <linux/mtd/mtd.h> diff --git a/drivers/mtd/ubi/attach.c b/drivers/mtd/ubi/attach.c index e488caa..2ef8fde 100644 --- a/drivers/mtd/ubi/attach.c +++ b/drivers/mtd/ubi/attach.c @@ -81,6 +81,7 @@ #include <div64.h> #include <linux/bug.h> #include <linux/err.h> +#include <linux/printk.h> #endif #include <linux/math64.h> diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c index 3ac0b19..a1941b8 100644 --- a/drivers/mtd/ubi/build.c +++ b/drivers/mtd/ubi/build.c @@ -33,6 +33,7 @@ #else #include <linux/bug.h> #include <linux/log2.h> +#include <linux/printk.h> #endif #include <linux/err.h> #include <ubi_uboot.h> diff --git a/drivers/mtd/ubi/debug.c b/drivers/mtd/ubi/debug.c index d2b7ca5..b119cb6 100644 --- a/drivers/mtd/ubi/debug.c +++ b/drivers/mtd/ubi/debug.c @@ -8,6 +8,7 @@ #include <hexdump.h> #include <malloc.h> #include <ubi_uboot.h> +#include <linux/printk.h> #include "ubi.h" #ifndef __UBOOT__ #include <linux/debugfs.h> diff --git a/drivers/mtd/ubi/debug.h b/drivers/mtd/ubi/debug.h index 9c8ce51..2e13ebb 100644 --- a/drivers/mtd/ubi/debug.h +++ b/drivers/mtd/ubi/debug.h @@ -17,6 +17,7 @@ void ubi_dump_vid_hdr(const struct ubi_vid_hdr *vid_hdr); #endif #include <hexdump.h> +#include <linux/printk.h> #ifndef __UBOOT__ #define ubi_assert(expr) do { \ diff --git a/drivers/mtd/ubi/ubi.h b/drivers/mtd/ubi/ubi.h index f449601..1759888 100644 --- a/drivers/mtd/ubi/ubi.h +++ b/drivers/mtd/ubi/ubi.h @@ -28,6 +28,7 @@ #include <asm/pgtable.h> #else #include <ubi_uboot.h> +#include <linux/printk.h> #endif #include <linux/mtd/mtd.h> #include <linux/mtd/ubi.h> diff --git a/drivers/net/bcm-sf2-eth-gmac.c b/drivers/net/bcm-sf2-eth-gmac.c index 3caf0f3..cbe1e85 100644 --- a/drivers/net/bcm-sf2-eth-gmac.c +++ b/drivers/net/bcm-sf2-eth-gmac.c @@ -6,6 +6,7 @@ #ifdef BCM_GMAC_DEBUG #ifndef DEBUG #define DEBUG +#include <linux/printk.h> #endif #endif diff --git a/drivers/net/bcm-sf2-eth.c b/drivers/net/bcm-sf2-eth.c index 88dc3ab..1524f5c 100644 --- a/drivers/net/bcm-sf2-eth.c +++ b/drivers/net/bcm-sf2-eth.c @@ -9,6 +9,7 @@ #include <net.h> #include <config.h> #include <linux/delay.h> +#include <linux/printk.h> #include <phy.h> #include <miiphy.h> diff --git a/drivers/net/bcm6348-eth.c b/drivers/net/bcm6348-eth.c index 5317173..72dcd07 100644 --- a/drivers/net/bcm6348-eth.c +++ b/drivers/net/bcm6348-eth.c @@ -18,6 +18,7 @@ #include <reset.h> #include <wait_bit.h> #include <asm/io.h> +#include <linux/printk.h> #define ETH_RX_DESC PKTBUFSRX #define ETH_MAX_MTU_SIZE 1518 diff --git a/drivers/net/bcm6368-eth.c b/drivers/net/bcm6368-eth.c index c2a8b9f..fdd938c 100644 --- a/drivers/net/bcm6368-eth.c +++ b/drivers/net/bcm6368-eth.c @@ -19,6 +19,7 @@ #include <asm/io.h> #include <dm/device_compat.h> #include <linux/delay.h> +#include <linux/printk.h> #define ETH_PORT_STR "brcm,enetsw-port" diff --git a/drivers/net/designware.c b/drivers/net/designware.c index e09ca33..20b86e7 100644 --- a/drivers/net/designware.c +++ b/drivers/net/designware.c @@ -29,6 +29,7 @@ #include <linux/err.h> #include <linux/kernel.h> #include <asm/io.h> +#include <linux/printk.h> #include <power/regulator.h> #include "designware.h" diff --git a/drivers/net/dwc_eth_qos.c b/drivers/net/dwc_eth_qos.c index 1e92bd9..9b1a9e6 100644 --- a/drivers/net/dwc_eth_qos.c +++ b/drivers/net/dwc_eth_qos.c @@ -52,6 +52,7 @@ #include <asm/mach-imx/sys_proto.h> #endif #include <linux/delay.h> +#include <linux/printk.h> #include "dwc_eth_qos.h" diff --git a/drivers/net/fsl-mc/dpio/qbman_sys.h b/drivers/net/fsl-mc/dpio/qbman_sys.h index ff998d4..1c6e489 100644 --- a/drivers/net/fsl-mc/dpio/qbman_sys.h +++ b/drivers/net/fsl-mc/dpio/qbman_sys.h @@ -21,6 +21,7 @@ /* Trace the 3 different classes of read/write access to QBMan. #undef as * required. */ #include <linux/bug.h> +#include <linux/printk.h> #undef QBMAN_CCSR_TRACE #undef QBMAN_CINH_TRACE #undef QBMAN_CENA_TRACE diff --git a/drivers/net/ftgmac100.c b/drivers/net/ftgmac100.c index a50cde3..587d365 100644 --- a/drivers/net/ftgmac100.c +++ b/drivers/net/ftgmac100.c @@ -25,6 +25,7 @@ #include <linux/bitops.h> #include <linux/io.h> #include <linux/iopoll.h> +#include <linux/printk.h> #include "ftgmac100.h" diff --git a/drivers/net/mscc_eswitch/jr2_switch.c b/drivers/net/mscc_eswitch/jr2_switch.c index 1462b8f..7157428 100644 --- a/drivers/net/mscc_eswitch/jr2_switch.c +++ b/drivers/net/mscc_eswitch/jr2_switch.c @@ -17,6 +17,7 @@ #include <miiphy.h> #include <net.h> #include <wait_bit.h> +#include <linux/printk.h> #include <dt-bindings/mscc/jr2_data.h> #include "mscc_xfer.h" diff --git a/drivers/net/mscc_eswitch/ocelot_switch.c b/drivers/net/mscc_eswitch/ocelot_switch.c index 1bf6c42..7ea1f55 100644 --- a/drivers/net/mscc_eswitch/ocelot_switch.c +++ b/drivers/net/mscc_eswitch/ocelot_switch.c @@ -17,6 +17,7 @@ #include <miiphy.h> #include <net.h> #include <wait_bit.h> +#include <linux/printk.h> #include "mscc_xfer.h" #include "mscc_mac_table.h" diff --git a/drivers/net/mscc_eswitch/serval_switch.c b/drivers/net/mscc_eswitch/serval_switch.c index 38ddba1..be06e48 100644 --- a/drivers/net/mscc_eswitch/serval_switch.c +++ b/drivers/net/mscc_eswitch/serval_switch.c @@ -17,6 +17,7 @@ #include <miiphy.h> #include <net.h> #include <wait_bit.h> +#include <linux/printk.h> #include "mscc_xfer.h" #include "mscc_mac_table.h" diff --git a/drivers/net/mscc_eswitch/servalt_switch.c b/drivers/net/mscc_eswitch/servalt_switch.c index db863c2..2d2329c 100644 --- a/drivers/net/mscc_eswitch/servalt_switch.c +++ b/drivers/net/mscc_eswitch/servalt_switch.c @@ -16,6 +16,7 @@ #include <miiphy.h> #include <net.h> #include <wait_bit.h> +#include <linux/printk.h> #include "mscc_xfer.h" #include "mscc_miim.h" diff --git a/drivers/net/mt7628-eth.c b/drivers/net/mt7628-eth.c index 0a9bdb3..b95de47 100644 --- a/drivers/net/mt7628-eth.c +++ b/drivers/net/mt7628-eth.c @@ -28,6 +28,7 @@ #include <linux/bitops.h> #include <linux/delay.h> #include <linux/err.h> +#include <linux/printk.h> /* Ethernet frame engine register */ #define PDMA_RELATED 0x0800 diff --git a/drivers/net/mtk_eth.c b/drivers/net/mtk_eth.c index d4111e7..3cfce05 100644 --- a/drivers/net/mtk_eth.c +++ b/drivers/net/mtk_eth.c @@ -26,6 +26,7 @@ #include <linux/ioport.h> #include <linux/mdio.h> #include <linux/mii.h> +#include <linux/printk.h> #include "mtk_eth.h" diff --git a/drivers/net/mvmdio.c b/drivers/net/mvmdio.c index c0ebcdb..5ebcfe1 100644 --- a/drivers/net/mvmdio.c +++ b/drivers/net/mvmdio.c @@ -13,6 +13,7 @@ #include <asm/io.h> #include <wait_bit.h> #include <linux/bitops.h> +#include <linux/printk.h> #define MVMDIO_SMI_DATA_SHIFT 0 #define MVMDIO_SMI_PHY_ADDR_SHIFT 16 diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig index 0c3c39a..3d96938 100644 --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig @@ -224,7 +224,7 @@ config PHY_MOTORCOMM tristate "Motorcomm PHYs" help Enables support for Motorcomm network PHYs. - Currently supports the YT8531 Gigabit Ethernet PHYs. + Currently supports the YT8511 and YT8531 Gigabit Ethernet PHYs. config PHY_MSCC bool "Microsemi Corp Ethernet PHYs support" diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c index 36c70da..82e3bbe 100644 --- a/drivers/net/phy/broadcom.c +++ b/drivers/net/phy/broadcom.c @@ -30,10 +30,87 @@ #define MIIM_BCM54XX_EXP_SEL_ER 0x0f00 /* Expansion register select */ #define MIIM_BCM_AUXCNTL_SHDWSEL_MISC 0x0007 -#define MIIM_BCM_AUXCNTL_ACTL_SMDSP_EN 0x0800 +#define MIIM_BCM_AUXCNTL_SHDWSEL_MISC_WIRESPEED_EN 0x0010 +#define MIIM_BCM_AUXCNTL_SHDWSEL_MISC_RGMII_EN 0x0080 +#define MIIM_BCM_AUXCNTL_SHDWSEL_MISC_RGMII_SKEW_EN 0x0100 +#define MIIM_BCM_AUXCNTL_MISC_FORCE_AMDIX 0x0200 +#define MIIM_BCM_AUXCNTL_ACTL_SMDSP_EN 0x0800 +#define MIIM_BCM_AUXCNTL_MISC_WREN 0x8000 #define MIIM_BCM_CHANNEL_WIDTH 0x2000 +#define BCM54810_SHD_CLK_CTL 0x3 +#define BCM54810_SHD_CLK_CTL_GTXCLK_EN BIT(9) + +static int bcm54xx_auxctl_read(struct phy_device *phydev, u16 regnum) +{ + /* The register must be written to both the Shadow Register Select and + * the Shadow Read Register Selector + */ + phy_write(phydev, MDIO_DEVAD_NONE, MIIM_BCM54xx_AUXCNTL, + MIIM_BCM54xx_AUXCNTL_ENCODE(regnum)); + return phy_read(phydev, MDIO_DEVAD_NONE, MIIM_BCM54xx_AUXCNTL); +} + +static int bcm54xx_auxctl_write(struct phy_device *phydev, u16 regnum, u16 val) +{ + return phy_write(phydev, MDIO_DEVAD_NONE, MIIM_BCM54xx_AUXCNTL, regnum | val); +} + +static int bcm_phy_read_shadow(struct phy_device *phydev, u16 shadow) +{ + phy_write(phydev, MDIO_DEVAD_NONE, MIIM_BCM54XX_SHD, + MIIM_BCM54XX_SHD_VAL(shadow)); + return MIIM_BCM54XX_SHD_DATA(phy_read(phydev, MDIO_DEVAD_NONE, + MIIM_BCM54XX_SHD)); +} + +static int bcm_phy_write_shadow(struct phy_device *phydev, u16 shadow, u16 val) +{ + return phy_write(phydev, MDIO_DEVAD_NONE, MIIM_BCM54XX_SHD, + MIIM_BCM54XX_SHD_WR_ENCODE(shadow, val)); +} + +static int bcm54xx_config_clock_delay(struct phy_device *phydev) +{ + int rc, val; + + /* handling PHY's internal RX clock delay */ + val = bcm54xx_auxctl_read(phydev, MIIM_BCM_AUXCNTL_SHDWSEL_MISC); + val |= MIIM_BCM_AUXCNTL_MISC_WREN; + if (phydev->interface == PHY_INTERFACE_MODE_RGMII || + phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID) { + /* Disable RGMII RXC-RXD skew */ + val &= ~MIIM_BCM_AUXCNTL_SHDWSEL_MISC_RGMII_SKEW_EN; + } + if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID || + phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) { + /* Enable RGMII RXC-RXD skew */ + val |= MIIM_BCM_AUXCNTL_SHDWSEL_MISC_RGMII_SKEW_EN; + } + rc = bcm54xx_auxctl_write(phydev, MIIM_BCM_AUXCNTL_SHDWSEL_MISC, val); + if (rc < 0) + return rc; + + /* handling PHY's internal TX clock delay */ + val = bcm_phy_read_shadow(phydev, BCM54810_SHD_CLK_CTL); + if (phydev->interface == PHY_INTERFACE_MODE_RGMII || + phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) { + /* Disable internal TX clock delay */ + val &= ~BCM54810_SHD_CLK_CTL_GTXCLK_EN; + } + if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID || + phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID) { + /* Enable internal TX clock delay */ + val |= BCM54810_SHD_CLK_CTL_GTXCLK_EN; + } + rc = bcm_phy_write_shadow(phydev, BCM54810_SHD_CLK_CTL, val); + if (rc < 0) + return rc; + + return 0; +} + static void bcm_phy_write_misc(struct phy_device *phydev, u16 reg, u16 chl, u16 value) { @@ -62,6 +139,18 @@ static int bcm5461_config(struct phy_device *phydev) return 0; } +/* Broadcom BCM54210E */ +static int bcm54210e_config(struct phy_device *phydev) +{ + int ret; + + ret = bcm54xx_config_clock_delay(phydev); + if (ret < 0) + return ret; + + return bcm5461_config(phydev); +} + static int bcm54xx_parse_status(struct phy_device *phydev) { unsigned int mii_reg; @@ -311,6 +400,16 @@ static int bcm5482_startup(struct phy_device *phydev) return bcm54xx_parse_status(phydev); } +U_BOOT_PHY_DRIVER(bcm54210e) = { + .name = "Broadcom BCM54210E", + .uid = 0x600d84a0, + .mask = 0xfffffff0, + .features = PHY_GBIT_FEATURES, + .config = &bcm54210e_config, + .startup = &bcm54xx_startup, + .shutdown = &genphy_shutdown, +}; + U_BOOT_PHY_DRIVER(bcm5461s) = { .name = "Broadcom BCM5461S", .uid = 0x2060c0, diff --git a/drivers/net/phy/dp83867.c b/drivers/net/phy/dp83867.c index 7111e36..b672603 100644 --- a/drivers/net/phy/dp83867.c +++ b/drivers/net/phy/dp83867.c @@ -10,6 +10,7 @@ #include <linux/bitops.h> #include <linux/compat.h> #include <malloc.h> +#include <linux/printk.h> #include <dm.h> #include <dt-bindings/net/ti-dp83867.h> diff --git a/drivers/net/phy/miiphybb.c b/drivers/net/phy/miiphybb.c index 24d6175..cf71f7d 100644 --- a/drivers/net/phy/miiphybb.c +++ b/drivers/net/phy/miiphybb.c @@ -18,10 +18,6 @@ #include <miiphy.h> #include <asm/global_data.h> -#define BB_MII_RELOCATE(v,off) (v += (v?off:0)) - -DECLARE_GLOBAL_DATA_PTR; - #ifndef CONFIG_BITBANGMII_MULTI /* @@ -110,21 +106,9 @@ int bb_miiphy_init(void) { int i; - for (i = 0; i < bb_miiphy_buses_num; i++) { -#if defined(CONFIG_NEEDS_MANUAL_RELOC) - /* Relocate the hook pointers*/ - BB_MII_RELOCATE(bb_miiphy_buses[i].init, gd->reloc_off); - BB_MII_RELOCATE(bb_miiphy_buses[i].mdio_active, gd->reloc_off); - BB_MII_RELOCATE(bb_miiphy_buses[i].mdio_tristate, gd->reloc_off); - BB_MII_RELOCATE(bb_miiphy_buses[i].set_mdio, gd->reloc_off); - BB_MII_RELOCATE(bb_miiphy_buses[i].get_mdio, gd->reloc_off); - BB_MII_RELOCATE(bb_miiphy_buses[i].set_mdc, gd->reloc_off); - BB_MII_RELOCATE(bb_miiphy_buses[i].delay, gd->reloc_off); -#endif - if (bb_miiphy_buses[i].init != NULL) { + for (i = 0; i < bb_miiphy_buses_num; i++) + if (bb_miiphy_buses[i].init != NULL) bb_miiphy_buses[i].init(&bb_miiphy_buses[i]); - } - } return 0; } diff --git a/drivers/net/phy/motorcomm.c b/drivers/net/phy/motorcomm.c index e822fd7..8635a96 100644 --- a/drivers/net/phy/motorcomm.c +++ b/drivers/net/phy/motorcomm.c @@ -11,6 +11,7 @@ #include <phy.h> #include <linux/bitfield.h> +#define PHY_ID_YT8511 0x0000010a #define PHY_ID_YT8531 0x4f51e91b #define PHY_ID_MASK GENMASK(31, 0) @@ -26,6 +27,31 @@ #define YTPHY_DTS_OUTPUT_CLK_25M 25000000 #define YTPHY_DTS_OUTPUT_CLK_125M 125000000 +#define YT8511_EXT_CLK_GATE 0x0c +#define YT8511_EXT_DELAY_DRIVE 0x0d +#define YT8511_EXT_SLEEP_CTRL 0x27 + +/* 2b00 25m from pll + * 2b01 25m from xtl *default* + * 2b10 62.m from pll + * 2b11 125m from pll + */ +#define YT8511_CLK_125M (BIT(2) | BIT(1)) +#define YT8511_PLLON_SLP BIT(14) + +/* RX Delay enabled = 1.8ns 1000T, 8ns 10/100T */ +#define YT8511_DELAY_RX BIT(0) + +/* TX Gig-E Delay is bits 7:4, default 0x5 + * TX Fast-E Delay is bits 15:12, default 0xf + * Delay = 150ps * N - 250ps + * On = 2000ps, off = 50ps + */ +#define YT8511_DELAY_GE_TX_EN (0xf << 4) +#define YT8511_DELAY_GE_TX_DIS (0x2 << 4) +#define YT8511_DELAY_FE_TX_EN (0xf << 12) +#define YT8511_DELAY_FE_TX_DIS (0x2 << 12) + #define YT8531_SCR_SYNCE_ENABLE BIT(6) /* 1b0 output 25m clock *default* * 1b1 output 125m clock @@ -347,6 +373,58 @@ static void ytphy_dt_parse(struct phy_device *phydev) priv->flag |= TX_CLK_1000_INVERTED; } +static int yt8511_config(struct phy_device *phydev) +{ + u32 ge, fe; + int ret; + + ret = genphy_config_aneg(phydev); + if (ret < 0) + return ret; + + switch (phydev->interface) { + case PHY_INTERFACE_MODE_RGMII: + ge = YT8511_DELAY_GE_TX_DIS; + fe = YT8511_DELAY_FE_TX_DIS; + break; + case PHY_INTERFACE_MODE_RGMII_RXID: + ge = YT8511_DELAY_RX | YT8511_DELAY_GE_TX_DIS; + fe = YT8511_DELAY_FE_TX_DIS; + break; + case PHY_INTERFACE_MODE_RGMII_TXID: + ge = YT8511_DELAY_GE_TX_EN; + fe = YT8511_DELAY_FE_TX_EN; + break; + case PHY_INTERFACE_MODE_RGMII_ID: + ge = YT8511_DELAY_RX | YT8511_DELAY_GE_TX_EN; + fe = YT8511_DELAY_FE_TX_EN; + break; + default: /* do not support other modes */ + return -EOPNOTSUPP; + } + + ret = ytphy_modify_ext(phydev, YT8511_EXT_CLK_GATE, + (YT8511_DELAY_RX | YT8511_DELAY_GE_TX_EN), ge); + if (ret < 0) + return ret; + /* set clock mode to 125m */ + ret = ytphy_modify_ext(phydev, YT8511_EXT_CLK_GATE, + YT8511_CLK_125M, YT8511_CLK_125M); + if (ret < 0) + return ret; + ret = ytphy_modify_ext(phydev, YT8511_EXT_DELAY_DRIVE, + YT8511_DELAY_FE_TX_EN, fe); + if (ret < 0) + return ret; + /* sleep control, disable PLL in sleep for now */ + ret = ytphy_modify_ext(phydev, YT8511_EXT_SLEEP_CTRL, YT8511_PLLON_SLP, + 0); + if (ret < 0) + return ret; + + return 0; +} + static int yt8531_config(struct phy_device *phydev) { struct ytphy_plat_priv *priv = phydev->priv; @@ -425,6 +503,16 @@ static int yt8531_probe(struct phy_device *phydev) return 0; } +U_BOOT_PHY_DRIVER(motorcomm8511) = { + .name = "YT8511 Gigabit Ethernet", + .uid = PHY_ID_YT8511, + .mask = PHY_ID_MASK, + .features = PHY_GBIT_FEATURES, + .config = &yt8511_config, + .startup = &genphy_startup, + .shutdown = &genphy_shutdown, +}; + U_BOOT_PHY_DRIVER(motorcomm8531) = { .name = "YT8531 Gigabit Ethernet", .uid = PHY_ID_YT8531, diff --git a/drivers/net/phy/mscc.c b/drivers/net/phy/mscc.c index ef1761a..bd9cd95 100644 --- a/drivers/net/phy/mscc.c +++ b/drivers/net/phy/mscc.c @@ -15,6 +15,7 @@ #include <time.h> #include <linux/bitops.h> #include <linux/delay.h> +#include <linux/printk.h> /* Microsemi PHY ID's */ #define PHY_ID_VSC8530 0x00070560 diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index ae21acb..63b3e46 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -463,37 +463,6 @@ U_BOOT_PHY_DRIVER(genphy) = { .shutdown = genphy_shutdown, }; -#ifdef CONFIG_NEEDS_MANUAL_RELOC -int phy_init(void) -{ - const int ll_n_ents = ll_entry_count(struct phy_driver, phy_driver); - struct phy_driver *drv, *ll_entry; - - /* Perform manual relocation on linker list based PHY drivers */ - ll_entry = ll_entry_start(struct phy_driver, phy_driver); - for (drv = ll_entry; drv != ll_entry + ll_n_ents; drv++) { - if (drv->probe) - drv->probe += gd->reloc_off; - if (drv->config) - drv->config += gd->reloc_off; - if (drv->startup) - drv->startup += gd->reloc_off; - if (drv->shutdown) - drv->shutdown += gd->reloc_off; - if (drv->readext) - drv->readext += gd->reloc_off; - if (drv->writeext) - drv->writeext += gd->reloc_off; - if (drv->read_mmd) - drv->read_mmd += gd->reloc_off; - if (drv->write_mmd) - drv->write_mmd += gd->reloc_off; - } - - return 0; -} -#endif - int phy_set_supported(struct phy_device *phydev, u32 max_speed) { /* The default values for phydev->supported are provided by the PHY @@ -838,7 +807,10 @@ static struct phy_device *phy_connect_gmii2rgmii(struct mii_dev *bus, ofnode_for_each_subnode(node, dev_ofnode(dev)) { node = ofnode_by_compatible(node, "xlnx,gmii-to-rgmii-1.0"); if (ofnode_valid(node)) { - phydev = phy_device_create(bus, 0, + int gmiirgmii_phyaddr; + + gmiirgmii_phyaddr = ofnode_read_u32_default(node, "reg", 0); + phydev = phy_device_create(bus, gmiirgmii_phyaddr, PHY_GMII2RGMII_ID, false); if (phydev) phydev->node = node; diff --git a/drivers/net/rtl8169.c b/drivers/net/rtl8169.c index 9637027..93e83661 100644 --- a/drivers/net/rtl8169.c +++ b/drivers/net/rtl8169.c @@ -51,6 +51,7 @@ #include <asm/io.h> #include <pci.h> #include <linux/delay.h> +#include <linux/printk.h> #undef DEBUG_RTL8169 #undef DEBUG_RTL8169_TX diff --git a/drivers/net/sni_ave.c b/drivers/net/sni_ave.c index f5a0d80..8eeecbc 100644 --- a/drivers/net/sni_ave.c +++ b/drivers/net/sni_ave.c @@ -23,6 +23,7 @@ #include <linux/err.h> #include <linux/io.h> #include <linux/iopoll.h> +#include <linux/printk.h> #define AVE_GRST_DELAY_MSEC 40 #define AVE_MIN_XMITSIZE 60 diff --git a/drivers/net/ti/am65-cpsw-nuss.c b/drivers/net/ti/am65-cpsw-nuss.c index 51a8167..18a33c4 100644 --- a/drivers/net/ti/am65-cpsw-nuss.c +++ b/drivers/net/ti/am65-cpsw-nuss.c @@ -9,6 +9,7 @@ #include <common.h> #include <malloc.h> #include <asm/cache.h> +#include <asm/gpio.h> #include <asm/io.h> #include <asm/processor.h> #include <clk.h> @@ -26,6 +27,8 @@ #include <soc.h> #include <syscon.h> #include <linux/bitops.h> +#include <linux/delay.h> +#include <linux/printk.h> #include <linux/soc/ti/ti-udma.h> #include "cpsw_mdio.h" @@ -57,6 +60,12 @@ #define AM65_CPSW_PN_REG_SA_L 0x308 #define AM65_CPSW_PN_REG_SA_H 0x30c +#define AM65_CPSW_SGMII_CONTROL_REG 0x010 +#define AM65_CPSW_SGMII_MR_ADV_ABILITY_REG 0x018 +#define AM65_CPSW_SGMII_CONTROL_MR_AN_ENABLE BIT(0) + +#define ADVERTISE_SGMII 0x1 + #define AM65_CPSW_ALE_CTL_REG 0x8 #define AM65_CPSW_ALE_CTL_REG_ENABLE BIT(31) #define AM65_CPSW_ALE_CTL_REG_RESET_TBL BIT(30) @@ -90,8 +99,11 @@ #define AM65_CPSW_CPPI_PKT_TYPE 0x7 +#define DEFAULT_GPIO_RESET_DELAY 10 + struct am65_cpsw_port { fdt_addr_t port_base; + fdt_addr_t port_sgmii_base; fdt_addr_t macsl_base; bool disabled; u32 mac_control; @@ -113,6 +125,10 @@ struct am65_cpsw_common { struct mii_dev *bus; u32 bus_freq; + struct gpio_desc mdio_gpio_reset; + u32 reset_delay_us; + u32 reset_post_delay_us; + struct dma dma_tx; struct dma dma_rx; u32 rx_next; @@ -204,6 +220,8 @@ static int am65_cpsw_update_link(struct am65_cpsw_priv *priv) mac_control |= AM65_CPSW_MACSL_CTL_REG_FULL_DUPLEX; if (phy->speed == 100) mac_control |= AM65_CPSW_MACSL_CTL_REG_IFCTL_A; + if (phy->interface == PHY_INTERFACE_MODE_SGMII) + mac_control |= AM65_CPSW_MACSL_CTL_EXT_EN; } if (mac_control == port->mac_control) @@ -229,6 +247,7 @@ out: #define AM65_GMII_SEL_MODE_MII 0 #define AM65_GMII_SEL_MODE_RMII 1 #define AM65_GMII_SEL_MODE_RGMII 2 +#define AM65_GMII_SEL_MODE_SGMII 3 #define AM65_GMII_SEL_RGMII_IDMODE BIT(4) @@ -280,6 +299,10 @@ static int am65_cpsw_gmii_sel_k3(struct am65_cpsw_priv *priv, rgmii_id = true; break; + case PHY_INTERFACE_MODE_SGMII: + mode = AM65_GMII_SEL_MODE_SGMII; + break; + default: dev_warn(dev, "Unsupported PHY mode: %u. Defaulting to MII.\n", @@ -420,6 +443,13 @@ static int am65_cpsw_start(struct udevice *dev) goto err_dis_rx; } + if (priv->phydev->interface == PHY_INTERFACE_MODE_SGMII) { + writel(ADVERTISE_SGMII, + port->port_sgmii_base + AM65_CPSW_SGMII_MR_ADV_ABILITY_REG); + writel(AM65_CPSW_SGMII_CONTROL_MR_AN_ENABLE, + port->port_sgmii_base + AM65_CPSW_SGMII_CONTROL_REG); + } + ret = phy_startup(priv->phydev); if (ret) { dev_err(dev, "phy_startup failed\n"); @@ -658,6 +688,16 @@ static int am65_cpsw_mdio_init(struct udevice *dev) if (!priv->has_phy || cpsw_common->bus) return 0; + if (IS_ENABLED(CONFIG_DM_GPIO)) { + if (dm_gpio_is_valid(&cpsw_common->mdio_gpio_reset)) { + dm_gpio_set_value(&cpsw_common->mdio_gpio_reset, 1); + udelay(cpsw_common->reset_delay_us); + dm_gpio_set_value(&cpsw_common->mdio_gpio_reset, 0); + if (cpsw_common->reset_post_delay_us > 0) + udelay(cpsw_common->reset_post_delay_us); + } + } + ret = am65_cpsw_mdio_setup(dev); if (ret) return ret; @@ -797,7 +837,7 @@ out: static int am65_cpsw_probe_nuss(struct udevice *dev) { struct am65_cpsw_common *cpsw_common = dev_get_priv(dev); - ofnode ports_np, node; + ofnode ports_np, node, mdio_np; int ret, i; struct udevice *port_dev; @@ -824,6 +864,24 @@ static int am65_cpsw_probe_nuss(struct udevice *dev) AM65_CPSW_CPSW_NU_ALE_BASE; cpsw_common->mdio_base = cpsw_common->ss_base + AM65_CPSW_MDIO_BASE; + if (IS_ENABLED(CONFIG_DM_GPIO)) { + /* get bus level PHY reset GPIO details */ + mdio_np = dev_read_subnode(dev, "mdio"); + if (!ofnode_valid(mdio_np)) { + ret = -ENOENT; + goto out; + } + + cpsw_common->reset_delay_us = ofnode_read_u32_default(mdio_np, "reset-delay-us", + DEFAULT_GPIO_RESET_DELAY); + cpsw_common->reset_post_delay_us = ofnode_read_u32_default(mdio_np, + "reset-post-delay-us", + 0); + ret = gpio_request_by_name_nodev(mdio_np, "reset-gpios", 0, + &cpsw_common->mdio_gpio_reset, + GPIOD_IS_OUT | GPIOD_IS_OUT_ACTIVE); + } + ports_np = dev_read_subnode(dev, "ethernet-ports"); if (!ofnode_valid(ports_np)) { ret = -ENOENT; @@ -872,6 +930,8 @@ static int am65_cpsw_probe_nuss(struct udevice *dev) port->port_base = cpsw_common->cpsw_base + AM65_CPSW_CPSW_NU_PORTS_OFFSET + (i * AM65_CPSW_CPSW_NU_PORTS_OFFSET); + port->port_sgmii_base = cpsw_common->ss_base + + (i * AM65_CPSW_SGMII_BASE); port->macsl_base = port->port_base + AM65_CPSW_CPSW_NU_PORT_MACSL_OFFSET; } diff --git a/drivers/net/ti/cpsw-common.c b/drivers/net/ti/cpsw-common.c index 3140f25..d542827 100644 --- a/drivers/net/ti/cpsw-common.c +++ b/drivers/net/ti/cpsw-common.c @@ -12,6 +12,7 @@ #include <asm/io.h> #include <cpsw.h> #include <dm/device_compat.h> +#include <linux/printk.h> DECLARE_GLOBAL_DATA_PTR; diff --git a/drivers/net/ti/cpsw.c b/drivers/net/ti/cpsw.c index 3a8cc9c..877be7f 100644 --- a/drivers/net/ti/cpsw.c +++ b/drivers/net/ti/cpsw.c @@ -24,6 +24,7 @@ #include <phy.h> #include <asm/arch/cpu.h> #include <dm.h> +#include <linux/printk.h> #include "cpsw_mdio.h" diff --git a/drivers/net/ti/keystone_net.c b/drivers/net/ti/keystone_net.c index 89b04b6..43dbf3f 100644 --- a/drivers/net/ti/keystone_net.c +++ b/drivers/net/ti/keystone_net.c @@ -10,6 +10,7 @@ #include <console.h> #include <asm/global_data.h> #include <linux/delay.h> +#include <linux/printk.h> #include <dm.h> #include <dm/lists.h> diff --git a/drivers/net/xilinx_axi_emac.c b/drivers/net/xilinx_axi_emac.c index 39cb3cc..54f2232 100644 --- a/drivers/net/xilinx_axi_emac.c +++ b/drivers/net/xilinx_axi_emac.c @@ -112,7 +112,7 @@ struct axidma_plat { int pcsaddr; int phyaddr; u8 eth_hasnobuf; - int phy_of_handle; + ofnode phynode; enum emac_variant mactype; }; @@ -127,7 +127,7 @@ struct axidma_priv { struct phy_device *phydev; struct mii_dev *bus; u8 eth_hasnobuf; - int phy_of_handle; + ofnode phynode; enum emac_variant mactype; }; @@ -335,8 +335,8 @@ static int axiemac_phy_init(struct udevice *dev) phydev->supported &= supported; phydev->advertising = phydev->supported; priv->phydev = phydev; - if (priv->phy_of_handle) - priv->phydev->node = offset_to_ofnode(priv->phy_of_handle); + if (ofnode_valid(priv->phynode)) + priv->phydev->node = priv->phynode; phy_config(phydev); return 0; @@ -839,7 +839,7 @@ static int axi_emac_probe(struct udevice *dev) priv->eth_hasnobuf = plat->eth_hasnobuf; priv->pcsaddr = plat->pcsaddr; priv->phyaddr = plat->phyaddr; - priv->phy_of_handle = plat->phy_of_handle; + priv->phynode = plat->phynode; priv->interface = pdata->phy_interface; if (IS_ENABLED(CONFIG_DM_ETH_PHY)) @@ -894,20 +894,21 @@ static int axi_emac_of_to_plat(struct udevice *dev) { struct axidma_plat *plat = dev_get_plat(dev); struct eth_pdata *pdata = &plat->eth_pdata; - int node = dev_of_offset(dev); - int offset = 0; + struct ofnode_phandle_args pcs_node, axistream_node; + ofnode phynode; + int ret; pdata->iobase = dev_read_addr(dev); plat->mactype = dev_get_driver_data(dev); - offset = fdtdec_lookup_phandle(gd->fdt_blob, node, - "axistream-connected"); - if (offset <= 0) { + ret = dev_read_phandle_with_args(dev, "axistream-connected", NULL, 0, 0, + &axistream_node); + if (ret) { printf("%s: axistream is not found\n", __func__); return -EINVAL; } - plat->dmatx = (struct axidma_reg *)fdtdec_get_addr_size_auto_parent - (gd->fdt_blob, 0, offset, "reg", 0, NULL, false); + + plat->dmatx = (struct axidma_reg *)ofnode_get_addr(axistream_node.node); if (!plat->dmatx) { printf("%s: axi_dma register space not found\n", __func__); return -EINVAL; @@ -918,30 +919,27 @@ static int axi_emac_of_to_plat(struct udevice *dev) /* PHYAD 0 always redirects to the PCS/PMA PHY */ plat->pcsaddr = 0; - offset = fdtdec_lookup_phandle(gd->fdt_blob, node, - "phy-handle"); - if (offset > 0) { + phynode = dev_get_phy_node(dev); + if (ofnode_valid(phynode)) { if (!(IS_ENABLED(CONFIG_DM_ETH_PHY))) - plat->phyaddr = fdtdec_get_int(gd->fdt_blob, - offset, - "reg", -1); - plat->phy_of_handle = offset; + plat->phyaddr = ofnode_read_u32_default(phynode, + "reg", -1); + plat->phynode = phynode; } pdata->phy_interface = dev_read_phy_mode(dev); if (pdata->phy_interface == PHY_INTERFACE_MODE_NA) return -EINVAL; - plat->eth_hasnobuf = fdtdec_get_bool(gd->fdt_blob, node, - "xlnx,eth-hasnobuf"); + plat->eth_hasnobuf = dev_read_bool(dev, "xlnx,eth-hasnobuf"); if (pdata->phy_interface == PHY_INTERFACE_MODE_SGMII || pdata->phy_interface == PHY_INTERFACE_MODE_1000BASEX) { - offset = fdtdec_lookup_phandle(gd->fdt_blob, node, - "pcs-handle"); - if (offset > 0) { - plat->pcsaddr = fdtdec_get_int(gd->fdt_blob, - offset, "reg", -1); + ret = dev_read_phandle_with_args(dev, "pcs-handle", NULL, 0, 0, + &pcs_node); + if (!ret) { + plat->pcsaddr = ofnode_read_u32_default(pcs_node.node, + "reg", -1); } } } diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c index f3cdfb0..3377e66 100644 --- a/drivers/net/zynq_gem.c +++ b/drivers/net/zynq_gem.c @@ -890,7 +890,8 @@ static int zynq_gem_probe(struct udevice *dev) if (ret) goto err3; - if (priv->interface == PHY_INTERFACE_MODE_SGMII && phy.dev) { + if (priv->interface == PHY_INTERFACE_MODE_SGMII && + generic_phy_valid(&phy)) { if (IS_ENABLED(CONFIG_DM_ETH_PHY)) { if (device_is_compatible(dev, "cdns,zynqmp-gem") || device_is_compatible(dev, "xlnx,zynqmp-gem")) { diff --git a/drivers/pci/Kconfig b/drivers/pci/Kconfig index a0bf44d..463ec47 100644 --- a/drivers/pci/Kconfig +++ b/drivers/pci/Kconfig @@ -121,11 +121,18 @@ config PCIE_APPLE bool "Enable Apple PCIe driver" depends on ARCH_APPLE imply PCI_INIT_R + select SYS_PCI_64BIT default y help Say Y here if you want to enable PCIe controller support on Apple SoCs. +config PCI_FTPCI100 + bool "Enable Faraday FTPCI100 PCI Bridge Controller driver" + help + Say Y here if you want to enable Faraday FTPCI100 PCI. + FTPCI100 IP is used in SoC chip designs. + config PCI_GT64120 bool "GT64120 PCI support" depends on MIPS diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile index a712a31..72ef8b4 100644 --- a/drivers/pci/Makefile +++ b/drivers/pci/Makefile @@ -14,6 +14,7 @@ obj-$(CONFIG_PCI) += pci_auto_common.o pci_common.o obj-$(CONFIG_PCIE_ECAM_GENERIC) += pcie_ecam_generic.o obj-$(CONFIG_PCIE_ECAM_SYNQUACER) += pcie_ecam_synquacer.o obj-$(CONFIG_PCIE_APPLE) += pcie_apple.o +obj-$(CONFIG_PCI_FTPCI100) += pci_ftpci100.o obj-$(CONFIG_PCI_GT64120) += pci_gt64120.o obj-$(CONFIG_PCI_MPC85XX) += pci_mpc85xx.o obj-$(CONFIG_PCI_MSC01) += pci_msc01.o diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c index 632c1a6..ae7350a 100644 --- a/drivers/pci/pci-uclass.c +++ b/drivers/pci/pci-uclass.c @@ -24,6 +24,7 @@ #endif #include <dt-bindings/pci/pci.h> #include <linux/delay.h> +#include <linux/printk.h> #include "pci_internal.h" DECLARE_GLOBAL_DATA_PTR; @@ -541,14 +542,13 @@ int pci_auto_config_devices(struct udevice *bus) struct pci_child_plat *pplat; unsigned int sub_bus; struct udevice *dev; - int ret; sub_bus = dev_seq(bus); debug("%s: start\n", __func__); pciauto_config_init(hose); - for (ret = device_find_first_child(bus, &dev); - !ret && dev; - ret = device_find_next_child(&dev)) { + for (device_find_first_child(bus, &dev); + dev; + device_find_next_child(&dev)) { unsigned int max_bus; int ret; @@ -1446,7 +1446,7 @@ phys_addr_t dm_pci_bus_to_phys(struct udevice *dev, pci_addr_t bus_addr, return res->phys_start + offset; } - puts("pci_hose_bus_to_phys: invalid physical address\n"); + puts("dm_pci_bus_to_phys: invalid physical address\n"); return 0; } @@ -1486,7 +1486,7 @@ pci_addr_t dm_pci_phys_to_bus(struct udevice *dev, phys_addr_t phys_addr, return res->bus_start + offset; } - puts("pci_hose_phys_to_bus: invalid physical address\n"); + puts("dm_pci_phys_to_bus: invalid physical address\n"); return 0; } diff --git a/drivers/pci/pci_ftpci100.c b/drivers/pci/pci_ftpci100.c new file mode 100644 index 0000000..a177544 --- /dev/null +++ b/drivers/pci/pci_ftpci100.c @@ -0,0 +1,95 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#include <common.h> +#include <pci.h> +#include <dm.h> +#include <asm/io.h> + +struct ftpci100_data { + void *reg_base; +}; + +/* AHB Control Registers */ +struct ftpci100_ahbc { + u32 iosize; /* 0x00 - I/O Space Size Signal */ + u32 prot; /* 0x04 - AHB Protection */ + u32 rsved[8]; /* 0x08-0x24 - Reserved */ + u32 conf; /* 0x28 - PCI Configuration */ + u32 data; /* 0x2c - PCI Configuration DATA */ +}; + +static int ftpci100_read_config(const struct udevice *dev, pci_dev_t bdf, + uint offset, ulong *valuep, + enum pci_size_t size) +{ + struct ftpci100_data *priv = dev_get_priv(dev); + struct ftpci100_ahbc *regs = priv->reg_base; + u32 data; + + out_le32(®s->conf, PCI_CONF1_ADDRESS(PCI_BUS(bdf), PCI_DEV(bdf), PCI_FUNC(bdf), offset)); + data = in_le32(®s->data); + *valuep = pci_conv_32_to_size(data, offset, size); + + return 0; +} + +static int ftpci100_write_config(struct udevice *dev, pci_dev_t bdf, + uint offset, ulong value, + enum pci_size_t size) +{ + struct ftpci100_data *priv = dev_get_priv(dev); + struct ftpci100_ahbc *regs = priv->reg_base; + u32 data; + + out_le32(®s->conf, PCI_CONF1_ADDRESS(PCI_BUS(bdf), PCI_DEV(bdf), PCI_FUNC(bdf), offset)); + + if (size == PCI_SIZE_32) { + data = value; + } else { + u32 old = in_le32(®s->data); + + data = pci_conv_size_to_32(old, value, offset, size); + } + + out_le32(®s->data, data); + + return 0; +} + +static int ftpci100_probe(struct udevice *dev) +{ + struct ftpci100_data *priv = dev_get_priv(dev); + struct pci_region *io, *mem; + int count; + + count = pci_get_regions(dev, &io, &mem, NULL); + if (count != 2) { + printf("%s: wrong count of regions: %d != 2\n", dev->name, count); + return -EINVAL; + } + + priv->reg_base = phys_to_virt(io->phys_start); + if (!priv->reg_base) + return -EINVAL; + + return 0; +} + +static const struct dm_pci_ops ftpci100_ops = { + .read_config = ftpci100_read_config, + .write_config = ftpci100_write_config, +}; + +static const struct udevice_id ftpci100_ids[] = { + { .compatible = "faraday,ftpci100" }, + { } +}; + +U_BOOT_DRIVER(ftpci100_pci) = { + .name = "ftpci100_pci", + .id = UCLASS_PCI, + .of_match = ftpci100_ids, + .ops = &ftpci100_ops, + .probe = ftpci100_probe, + .priv_auto = sizeof(struct ftpci100_data), +}; diff --git a/drivers/pci/pci_mvebu.c b/drivers/pci/pci_mvebu.c index 93a7508..3697cd8 100644 --- a/drivers/pci/pci_mvebu.c +++ b/drivers/pci/pci_mvebu.c @@ -28,6 +28,7 @@ #include <linux/errno.h> #include <linux/ioport.h> #include <linux/mbus.h> +#include <linux/printk.h> #include <linux/sizes.h> /* PCIe unit register offsets */ diff --git a/drivers/pci/pci_tegra.c b/drivers/pci/pci_tegra.c index 29d5411..131c21b 100644 --- a/drivers/pci/pci_tegra.c +++ b/drivers/pci/pci_tegra.c @@ -22,6 +22,7 @@ #include <power-domain.h> #include <reset.h> #include <linux/delay.h> +#include <linux/printk.h> #include <asm/io.h> #include <asm/gpio.h> diff --git a/drivers/pci/pcie_brcmstb.c b/drivers/pci/pcie_brcmstb.c index 1de2802..cd45f0b 100644 --- a/drivers/pci/pcie_brcmstb.c +++ b/drivers/pci/pcie_brcmstb.c @@ -33,6 +33,9 @@ #define PCIE_RC_CFG_PRIV1_ID_VAL3 0x043c #define CFG_PRIV1_ID_VAL3_CLASS_CODE_MASK 0xffffff +#define PCIE_RC_CFG_PRIV1_LINK_CAPABILITY 0x04dc +#define PCIE_RC_CFG_PRIV1_LINK_CAPABILITY_ASPM_SUPPORT_MASK 0xc00 + #define PCIE_RC_DL_MDIO_ADDR 0x1100 #define PCIE_RC_DL_MDIO_WR_DATA 0x1104 #define PCIE_RC_DL_MDIO_RD_DATA 0x1108 @@ -88,7 +91,6 @@ PCIE_MISC_CPU_2_PCIE_MEM_WIN0_LIMIT_HI + ((win) * 8) #define PCIE_MISC_HARD_PCIE_HARD_DEBUG 0x4204 -#define PCIE_HARD_DEBUG_CLKREQ_DEBUG_ENABLE_MASK 0x2 #define PCIE_HARD_DEBUG_SERDES_IDDQ_MASK 0x08000000 #define PCIE_MSI_INTR2_CLR 0x4508 @@ -223,6 +225,10 @@ static int brcm_pcie_config_address(const struct udevice *dev, pci_dev_t bdf, return 0; } + /* An access to our HW w/o link-up will cause a CPU Abort */ + if (!brcm_pcie_link_up(pcie)) + return -EINVAL; + /* For devices, write to the config space index register */ idx = PCIE_ECAM_OFFSET(pci_bus, pci_dev, pci_func, 0); @@ -505,6 +511,12 @@ static int brcm_pcie_probe(struct udevice *dev) clrbits_le32(pcie->base + PCIE_RGR1_SW_INIT_1, RGR1_SW_INIT_1_PERST_MASK); + /* + * Wait for 100ms after PERST# deassertion; see PCIe CEM specification + * sections 2.2, PCIe r5.0, 6.6.1. + */ + mdelay(100); + /* Give the RC/EP time to wake up, before trying to configure RC. * Intermittently check status for link-up, up to a total of 100ms. */ @@ -562,12 +574,18 @@ static int brcm_pcie_probe(struct udevice *dev) clrsetbits_le32(base + PCIE_RC_CFG_VENDOR_SPECIFIC_REG1, VENDOR_SPECIFIC_REG1_ENDIAN_MODE_BAR2_MASK, VENDOR_SPECIFIC_REG1_LITTLE_ENDIAN); + /* - * Refclk from RC should be gated with CLKREQ# input when ASPM L0s,L1 - * is enabled => setting the CLKREQ_DEBUG_ENABLE field to 1. + * We used to enable the CLKREQ# input here, but a few PCIe cards don't + * attach anything to the CLKREQ# line, so we shouldn't assume that + * it's connected and working. The controller does allow detecting + * whether the port on the other side of our link is/was driving this + * signal, so we could check before we assume. But because this signal + * is for power management, which doesn't make sense in a bootloader, + * let's instead just unadvertise ASPM support. */ - setbits_le32(base + PCIE_MISC_HARD_PCIE_HARD_DEBUG, - PCIE_HARD_DEBUG_CLKREQ_DEBUG_ENABLE_MASK); + clrbits_le32(base + PCIE_RC_CFG_PRIV1_LINK_CAPABILITY, + PCIE_RC_CFG_PRIV1_LINK_CAPABILITY_ASPM_SUPPORT_MASK); return 0; } diff --git a/drivers/pci/pcie_ecam_generic.c b/drivers/pci/pcie_ecam_generic.c index 1a9f9ae..2e089b0 100644 --- a/drivers/pci/pcie_ecam_generic.c +++ b/drivers/pci/pcie_ecam_generic.c @@ -11,6 +11,7 @@ #include <dm.h> #include <pci.h> #include <asm/global_data.h> +#include <linux/printk.h> #include <asm/io.h> diff --git a/drivers/pci/pcie_fsl.c b/drivers/pci/pcie_fsl.c index 8d89a1e..ec917ee 100644 --- a/drivers/pci/pcie_fsl.c +++ b/drivers/pci/pcie_fsl.c @@ -16,6 +16,7 @@ #include <asm/global_data.h> #include <asm/io.h> #include <linux/delay.h> +#include <linux/printk.h> #include "pcie_fsl.h" #include <dm/device_compat.h> diff --git a/drivers/pci/pcie_mediatek.c b/drivers/pci/pcie_mediatek.c index c6e30e2..ed25a10 100644 --- a/drivers/pci/pcie_mediatek.c +++ b/drivers/pci/pcie_mediatek.c @@ -20,6 +20,7 @@ #include <linux/bitops.h> #include <linux/iopoll.h> #include <linux/list.h> +#include <linux/printk.h> #include "pci_internal.h" /* PCIe shared registers */ diff --git a/drivers/pci/pcie_phytium.c b/drivers/pci/pcie_phytium.c index a807276..3bd1f5c 100644 --- a/drivers/pci/pcie_phytium.c +++ b/drivers/pci/pcie_phytium.c @@ -12,6 +12,7 @@ #include <pci.h> #include <asm/global_data.h> #include <asm/io.h> +#include <linux/printk.h> /** * struct phytium_pcie - phytium PCIe controller state diff --git a/drivers/pci/pcie_xilinx.c b/drivers/pci/pcie_xilinx.c index eb9ec97..53fd121 100644 --- a/drivers/pci/pcie_xilinx.c +++ b/drivers/pci/pcie_xilinx.c @@ -10,6 +10,7 @@ #include <pci.h> #include <asm/global_data.h> #include <linux/bitops.h> +#include <linux/printk.h> #include <asm/io.h> diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index 7a2d54f..8ac5769 100644 --- a/drivers/phy/Kconfig +++ b/drivers/phy/Kconfig @@ -70,6 +70,16 @@ config AB8500_USB_PHY help Support for the USB OTG PHY in ST-Ericsson AB8500. +config APPLE_ATCPHY + bool "Apple Type-C PHY Driver" + depends on PHY && ARCH_APPLE + default y + help + Support for the Apple Type-C PHY. + + This is a dummy driver since the PHY is initialized + sufficiently by previous stage firmware. + config BCM6318_USBH_PHY bool "BCM6318 USBH PHY support" depends on PHY && ARCH_BMIPS diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile index aca365d..5d4de86 100644 --- a/drivers/phy/Makefile +++ b/drivers/phy/Makefile @@ -12,6 +12,7 @@ obj-$(CONFIG_$(SPL_)PHY) += phy-uclass.o obj-$(CONFIG_$(SPL_)NOP_PHY) += nop-phy.o obj-$(CONFIG_MIPI_DPHY_HELPERS) += phy-core-mipi-dphy.o obj-$(CONFIG_AB8500_USB_PHY) += phy-ab8500-usb.o +obj-$(CONFIG_APPLE_ATCPHY) += phy-apple-atc.o obj-$(CONFIG_BCM6318_USBH_PHY) += bcm6318-usbh-phy.o obj-$(CONFIG_BCM6348_USBH_PHY) += bcm6348-usbh-phy.o obj-$(CONFIG_BCM6358_USBH_PHY) += bcm6358-usbh-phy.o diff --git a/drivers/phy/keystone-usb-phy.c b/drivers/phy/keystone-usb-phy.c index 12f8a26..6799e23 100644 --- a/drivers/phy/keystone-usb-phy.c +++ b/drivers/phy/keystone-usb-phy.c @@ -13,6 +13,7 @@ #include <asm/arch/psc_defs.h> #include <linux/bitops.h> #include <linux/delay.h> +#include <linux/printk.h> /* USB PHY control register offsets */ #define USB_PHY_CTL_UTMI 0x0000 diff --git a/drivers/phy/marvell/comphy_cp110.c b/drivers/phy/marvell/comphy_cp110.c index a7e0099..bb15fba 100644 --- a/drivers/phy/marvell/comphy_cp110.c +++ b/drivers/phy/marvell/comphy_cp110.c @@ -12,6 +12,7 @@ #include <asm/arch/cpu.h> #include <asm/arch/soc.h> #include <linux/delay.h> +#include <linux/printk.h> #include "comphy_core.h" #include "sata.h" diff --git a/drivers/phy/meson-g12a-usb2.c b/drivers/phy/meson-g12a-usb2.c index 650b88b..8b24322 100644 --- a/drivers/phy/meson-g12a-usb2.c +++ b/drivers/phy/meson-g12a-usb2.c @@ -17,6 +17,7 @@ #include <generic-phy.h> #include <regmap.h> #include <linux/delay.h> +#include <linux/printk.h> #include <power/regulator.h> #include <reset.h> #include <clk.h> diff --git a/drivers/phy/meson-g12a-usb3-pcie.c b/drivers/phy/meson-g12a-usb3-pcie.c index 8f72b5a..40a5da9 100644 --- a/drivers/phy/meson-g12a-usb3-pcie.c +++ b/drivers/phy/meson-g12a-usb3-pcie.c @@ -18,6 +18,7 @@ #include <bitfield.h> #include <generic-phy.h> #include <linux/delay.h> +#include <linux/printk.h> #include <linux/bitops.h> #include <linux/compat.h> diff --git a/drivers/phy/meson-gxbb-usb2.c b/drivers/phy/meson-gxbb-usb2.c index 70a80b8..725b056 100644 --- a/drivers/phy/meson-gxbb-usb2.c +++ b/drivers/phy/meson-gxbb-usb2.c @@ -15,6 +15,7 @@ #include <regmap.h> #include <reset.h> #include <linux/bitops.h> +#include <linux/printk.h> #define REG_CONFIG 0x00 #define REG_CONFIG_CLK_EN BIT(0) diff --git a/drivers/phy/meson-gxl-usb2.c b/drivers/phy/meson-gxl-usb2.c index 4c63131..8f5e4a4 100644 --- a/drivers/phy/meson-gxl-usb2.c +++ b/drivers/phy/meson-gxl-usb2.c @@ -11,12 +11,13 @@ #include <malloc.h> #include <asm/io.h> #include <bitfield.h> +#include <clk.h> #include <dm.h> #include <errno.h> #include <generic-phy.h> #include <regmap.h> #include <linux/delay.h> -#include <clk.h> +#include <linux/printk.h> #include <linux/usb/otg.h> #include <asm/arch/usb-gx.h> diff --git a/drivers/phy/phy-apple-atc.c b/drivers/phy/phy-apple-atc.c new file mode 100644 index 0000000..15c5b8a --- /dev/null +++ b/drivers/phy/phy-apple-atc.c @@ -0,0 +1,56 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2022 Mark Kettenis <kettenis@openbsd.org> + */ + +#include <common.h> +#include <dm.h> +#include <dm/device-internal.h> +#include <generic-phy.h> +#include <reset-uclass.h> + +static const struct phy_ops apple_atcphy_ops = { +}; + +static struct driver apple_atcphy_driver = { + .name = "apple-atcphy", + .id = UCLASS_PHY, + .ops = &apple_atcphy_ops, +}; + +static int apple_atcphy_reset_of_xlate(struct reset_ctl *reset_ctl, + struct ofnode_phandle_args *args) +{ + if (args->args_count != 0) + return -EINVAL; + + return 0; +} + +static const struct reset_ops apple_atcphy_reset_ops = { + .of_xlate = apple_atcphy_reset_of_xlate, +}; + +static int apple_atcphy_reset_probe(struct udevice *dev) +{ + struct udevice *child; + + device_bind(dev, &apple_atcphy_driver, "apple-atcphy", NULL, + dev_ofnode(dev), &child); + + return 0; +} + +static const struct udevice_id apple_atcphy_ids[] = { + { .compatible = "apple,t6000-atcphy" }, + { .compatible = "apple,t8103-atcphy" }, + { } +}; + +U_BOOT_DRIVER(apple_atcphy_reset) = { + .name = "apple-atcphy-reset", + .id = UCLASS_RESET, + .of_match = apple_atcphy_ids, + .ops = &apple_atcphy_reset_ops, + .probe = apple_atcphy_reset_probe, +}; diff --git a/drivers/phy/phy-rcar-gen3.c b/drivers/phy/phy-rcar-gen3.c index 8c59631..7159e7e 100644 --- a/drivers/phy/phy-rcar-gen3.c +++ b/drivers/phy/phy-rcar-gen3.c @@ -17,6 +17,7 @@ #include <usb.h> #include <asm/io.h> #include <linux/bitops.h> +#include <linux/printk.h> #include <power/regulator.h> /* USB2.0 Host registers (original offset is +0x200) */ diff --git a/drivers/phy/phy-stm32-usbphyc.c b/drivers/phy/phy-stm32-usbphyc.c index 15bd60c..000e495 100644 --- a/drivers/phy/phy-stm32-usbphyc.c +++ b/drivers/phy/phy-stm32-usbphyc.c @@ -23,6 +23,7 @@ #include <linux/bitfield.h> #include <linux/bitops.h> #include <linux/delay.h> +#include <linux/printk.h> #include <power/regulator.h> /* USBPHYC registers */ diff --git a/drivers/phy/phy-uclass.c b/drivers/phy/phy-uclass.c index 629ef3a..22f2fe9 100644 --- a/drivers/phy/phy-uclass.c +++ b/drivers/phy/phy-uclass.c @@ -12,6 +12,7 @@ #include <dm/devres.h> #include <generic-phy.h> #include <linux/list.h> +#include <linux/printk.h> #include <power/regulator.h> /** @@ -195,6 +196,7 @@ int generic_phy_get_by_index_nodev(ofnode node, int index, struct phy *phy) return 0; err: + phy->dev = NULL; return ret; } @@ -211,6 +213,9 @@ int generic_phy_get_by_name(struct udevice *dev, const char *phy_name, debug("%s(dev=%p, name=%s, phy=%p)\n", __func__, dev, phy_name, phy); + assert(phy); + phy->dev = NULL; + index = dev_read_stringlist_search(dev, "phy-names", phy_name); if (index < 0) { debug("dev_read_stringlist_search() failed: %d\n", index); @@ -506,44 +511,35 @@ int generic_phy_power_off_bulk(struct phy_bulk *bulk) int generic_setup_phy(struct udevice *dev, struct phy *phy, int index) { - int ret = 0; - - if (!phy) - return 0; + int ret; ret = generic_phy_get_by_index(dev, index, phy); - if (ret) { - if (ret != -ENOENT) - return ret; - } else { - ret = generic_phy_init(phy); - if (ret) - return ret; + if (ret) + return ret == -ENOENT ? 0 : ret; - ret = generic_phy_power_on(phy); - if (ret) - ret = generic_phy_exit(phy); - } + ret = generic_phy_init(phy); + if (ret) + return ret; + + ret = generic_phy_power_on(phy); + if (ret) + generic_phy_exit(phy); return ret; } int generic_shutdown_phy(struct phy *phy) { - int ret = 0; + int ret; - if (!phy) + if (!generic_phy_valid(phy)) return 0; - if (generic_phy_valid(phy)) { - ret = generic_phy_power_off(phy); - if (ret) - return ret; - - ret = generic_phy_exit(phy); - } + ret = generic_phy_power_off(phy); + if (ret) + return ret; - return ret; + return generic_phy_exit(phy); } UCLASS_DRIVER(phy) = { diff --git a/drivers/phy/sti_usb_phy.c b/drivers/phy/sti_usb_phy.c index ce4caaf..9e5ac9b 100644 --- a/drivers/phy/sti_usb_phy.c +++ b/drivers/phy/sti_usb_phy.c @@ -18,6 +18,7 @@ #include <reset-uclass.h> #include <syscon.h> #include <wait_bit.h> +#include <linux/printk.h> #include <linux/bitops.h> #include <linux/compat.h> diff --git a/drivers/phy/ti-pipe3-phy.c b/drivers/phy/ti-pipe3-phy.c index b5b3c3f..3137358 100644 --- a/drivers/phy/ti-pipe3-phy.c +++ b/drivers/phy/ti-pipe3-phy.c @@ -16,6 +16,7 @@ #include <linux/bitops.h> #include <linux/delay.h> #include <linux/err.h> +#include <linux/printk.h> /* PLLCTRL Registers */ #define PLL_STATUS 0x00000004 diff --git a/drivers/phy/ti/phy-j721e-wiz.c b/drivers/phy/ti/phy-j721e-wiz.c index 34314d0..7261339 100644 --- a/drivers/phy/ti/phy-j721e-wiz.c +++ b/drivers/phy/ti/phy-j721e-wiz.c @@ -585,12 +585,20 @@ static int wiz_reset_assert(struct reset_ctl *reset_ctl) static int wiz_phy_fullrt_div(struct wiz *wiz, int lane) { - if (wiz->type != AM64_WIZ_10G) - return 0; - - if (wiz->lane_phy_type[lane] == PHY_TYPE_PCIE) - return regmap_field_write(wiz->p0_fullrt_div[lane], 0x1); + switch (wiz->type) { + case AM64_WIZ_10G: + if (wiz->lane_phy_type[lane] == PHY_TYPE_PCIE) + return regmap_field_write(wiz->p0_fullrt_div[lane], 0x1); + break; + case J721E_WIZ_16G: + case J721E_WIZ_10G: + if (wiz->lane_phy_type[lane] == PHY_TYPE_SGMII) + return regmap_field_write(wiz->p0_fullrt_div[lane], 0x2); + break; + default: + return 0; + } return 0; } @@ -706,7 +714,8 @@ static int wiz_p_mac_div_sel(struct wiz *wiz) int i; for (i = 0; i < num_lanes; i++) { - if (wiz->lane_phy_type[i] == PHY_TYPE_QSGMII) { + if (wiz->lane_phy_type[i] == PHY_TYPE_SGMII || + wiz->lane_phy_type[i] == PHY_TYPE_QSGMII) { ret = regmap_field_write(wiz->p_mac_div_sel0[i], 1); if (ret) return ret; diff --git a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c index 1be6252..e834ddd 100644 --- a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c +++ b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c @@ -35,6 +35,7 @@ #include <asm/io.h> #include <linux/bitops.h> #include <linux/libfdt.h> +#include <linux/printk.h> DECLARE_GLOBAL_DATA_PTR; diff --git a/drivers/pinctrl/pinctrl-sti.c b/drivers/pinctrl/pinctrl-sti.c index 20cdbb0..1ff7ea0 100644 --- a/drivers/pinctrl/pinctrl-sti.c +++ b/drivers/pinctrl/pinctrl-sti.c @@ -17,6 +17,7 @@ #include <dm/pinctrl.h> #include <linux/bug.h> #include <linux/libfdt.h> +#include <linux/printk.h> DECLARE_GLOBAL_DATA_PTR; diff --git a/drivers/pinctrl/pinctrl-zynqmp.c b/drivers/pinctrl/pinctrl-zynqmp.c index 02626a7..5170359 100644 --- a/drivers/pinctrl/pinctrl-zynqmp.c +++ b/drivers/pinctrl/pinctrl-zynqmp.c @@ -158,6 +158,12 @@ static int zynqmp_pm_pinctrl_set_config(const u32 pin, const u32 param, u32 valu { int ret; + if (param == PM_PINCTRL_CONFIG_TRI_STATE) { + ret = zynqmp_pm_feature(PM_PINCTRL_CONFIG_PARAM_SET); + if (ret < PM_PINCTRL_PARAM_SET_VERSION) + return -EOPNOTSUPP; + } + /* Request the pin first */ ret = xilinx_pm_request(PM_PINCTRL_REQUEST, pin, 0, 0, 0, NULL); if (ret) { @@ -467,6 +473,10 @@ static int zynqmp_pinconf_set(struct udevice *dev, unsigned int pin, pin); break; case PIN_CONFIG_BIAS_HIGH_IMPEDANCE: + param = PM_PINCTRL_CONFIG_TRI_STATE; + arg = PM_PINCTRL_TRI_STATE_ENABLE; + ret = zynqmp_pm_pinctrl_set_config(pin, param, arg); + break; case PIN_CONFIG_LOW_POWER_MODE: /* * This cases are mentioned in dts but configurable @@ -475,6 +485,11 @@ static int zynqmp_pinconf_set(struct udevice *dev, unsigned int pin, */ ret = 0; break; + case PIN_CONFIG_OUTPUT_ENABLE: + param = PM_PINCTRL_CONFIG_TRI_STATE; + arg = PM_PINCTRL_TRI_STATE_DISABLE; + ret = zynqmp_pm_pinctrl_set_config(pin, param, arg); + break; default: dev_warn(dev, "unsupported configuration parameter '%u'\n", param); diff --git a/drivers/pinctrl/pinctrl_stm32.c b/drivers/pinctrl/pinctrl_stm32.c index b06da50..8bb7588 100644 --- a/drivers/pinctrl/pinctrl_stm32.c +++ b/drivers/pinctrl/pinctrl_stm32.c @@ -18,6 +18,7 @@ #include <linux/bitops.h> #include <linux/err.h> #include <linux/libfdt.h> +#include <linux/printk.h> #include "../gpio/stm32_gpio_priv.h" diff --git a/drivers/power/palmas.c b/drivers/power/palmas.c index 0959445..3ac9712 100644 --- a/drivers/power/palmas.c +++ b/drivers/power/palmas.c @@ -5,6 +5,7 @@ */ #include <config.h> #include <palmas.h> +#include <linux/printk.h> void palmas_init_settings(void) { diff --git a/drivers/power/pmic/as3722.c b/drivers/power/pmic/as3722.c index 3aa3cce..c7dd970 100644 --- a/drivers/power/pmic/as3722.c +++ b/drivers/power/pmic/as3722.c @@ -12,6 +12,7 @@ #include <i2c.h> #include <log.h> #include <dm/lists.h> +#include <linux/printk.h> #include <power/as3722.h> #include <power/pmic.h> diff --git a/drivers/power/pmic/as3722_gpio.c b/drivers/power/pmic/as3722_gpio.c index 96943bc..987fbdf 100644 --- a/drivers/power/pmic/as3722_gpio.c +++ b/drivers/power/pmic/as3722_gpio.c @@ -6,6 +6,7 @@ #include <common.h> #include <dm.h> #include <asm/gpio.h> +#include <linux/printk.h> #include <power/as3722.h> #include <power/pmic.h> diff --git a/drivers/power/pmic/bd71837.c b/drivers/power/pmic/bd71837.c index fdbbd6f..ee6ae78 100644 --- a/drivers/power/pmic/bd71837.c +++ b/drivers/power/pmic/bd71837.c @@ -9,6 +9,7 @@ #include <i2c.h> #include <log.h> #include <asm/global_data.h> +#include <linux/printk.h> #include <power/pmic.h> #include <power/regulator.h> #include <power/bd71837.h> diff --git a/drivers/power/pmic/da9063.c b/drivers/power/pmic/da9063.c index 25101d1..ca95b82 100644 --- a/drivers/power/pmic/da9063.c +++ b/drivers/power/pmic/da9063.c @@ -10,6 +10,7 @@ #include <dm.h> #include <i2c.h> #include <log.h> +#include <linux/printk.h> #include <power/pmic.h> #include <power/regulator.h> #include <power/da9063_pmic.h> diff --git a/drivers/power/pmic/fan53555.c b/drivers/power/pmic/fan53555.c index 0d91628..d556b9a 100644 --- a/drivers/power/pmic/fan53555.c +++ b/drivers/power/pmic/fan53555.c @@ -10,6 +10,7 @@ #include <dm/device_compat.h> #include <dm/lists.h> #include <i2c.h> +#include <linux/printk.h> #include <power/fan53555.h> #include <power/pmic.h> #include <power/regulator.h> diff --git a/drivers/power/pmic/i2c_pmic_emul.c b/drivers/power/pmic/i2c_pmic_emul.c index abe3a10..f0a0374 100644 --- a/drivers/power/pmic/i2c_pmic_emul.c +++ b/drivers/power/pmic/i2c_pmic_emul.c @@ -10,6 +10,7 @@ #include <i2c.h> #include <log.h> #include <malloc.h> +#include <linux/printk.h> #include <power/pmic.h> #include <power/sandbox_pmic.h> diff --git a/drivers/power/pmic/lp873x.c b/drivers/power/pmic/lp873x.c index 2b1260e..fda5bc1 100644 --- a/drivers/power/pmic/lp873x.c +++ b/drivers/power/pmic/lp873x.c @@ -10,6 +10,7 @@ #include <dm.h> #include <i2c.h> #include <log.h> +#include <linux/printk.h> #include <power/pmic.h> #include <power/regulator.h> #include <power/lp873x.h> diff --git a/drivers/power/pmic/lp87565.c b/drivers/power/pmic/lp87565.c index f4a4bd0..904e02c 100644 --- a/drivers/power/pmic/lp87565.c +++ b/drivers/power/pmic/lp87565.c @@ -10,6 +10,7 @@ #include <dm.h> #include <i2c.h> #include <log.h> +#include <linux/printk.h> #include <power/pmic.h> #include <power/regulator.h> #include <power/lp87565.h> diff --git a/drivers/power/pmic/max77686.c b/drivers/power/pmic/max77686.c index 9f02c0b..7e6f7d1 100644 --- a/drivers/power/pmic/max77686.c +++ b/drivers/power/pmic/max77686.c @@ -10,6 +10,7 @@ #include <dm.h> #include <i2c.h> #include <log.h> +#include <linux/printk.h> #include <power/pmic.h> #include <power/regulator.h> #include <power/max77686_pmic.h> diff --git a/drivers/power/pmic/max8997.c b/drivers/power/pmic/max8997.c index dbae155..504a63b 100644 --- a/drivers/power/pmic/max8997.c +++ b/drivers/power/pmic/max8997.c @@ -7,6 +7,7 @@ #include <common.h> #include <dm.h> #include <i2c.h> +#include <linux/printk.h> #include <power/pmic.h> #include <power/max8997_pmic.h> #include <errno.h> diff --git a/drivers/power/pmic/max8998.c b/drivers/power/pmic/max8998.c index f58d9f2..d155474 100644 --- a/drivers/power/pmic/max8998.c +++ b/drivers/power/pmic/max8998.c @@ -8,6 +8,7 @@ #include <dm.h> #include <errno.h> #include <i2c.h> +#include <linux/printk.h> #include <power/pmic.h> #include <power/max8998_pmic.h> diff --git a/drivers/power/pmic/palmas.c b/drivers/power/pmic/palmas.c index 6080cbf..eb83c88 100644 --- a/drivers/power/pmic/palmas.c +++ b/drivers/power/pmic/palmas.c @@ -10,6 +10,7 @@ #include <dm.h> #include <i2c.h> #include <log.h> +#include <linux/printk.h> #include <power/pmic.h> #include <power/regulator.h> #include <power/palmas.h> diff --git a/drivers/power/pmic/pca9450.c b/drivers/power/pmic/pca9450.c index e99ece8..0bbe98c 100644 --- a/drivers/power/pmic/pca9450.c +++ b/drivers/power/pmic/pca9450.c @@ -13,6 +13,7 @@ #include <log.h> #include <asm/global_data.h> #include <asm-generic/gpio.h> +#include <linux/printk.h> #include <power/pmic.h> #include <power/regulator.h> #include <power/pca9450.h> diff --git a/drivers/power/pmic/pfuze100.c b/drivers/power/pmic/pfuze100.c index 65c4456..15420ac 100644 --- a/drivers/power/pmic/pfuze100.c +++ b/drivers/power/pmic/pfuze100.c @@ -10,6 +10,7 @@ #include <dm.h> #include <i2c.h> #include <log.h> +#include <linux/printk.h> #include <power/pmic.h> #include <power/regulator.h> #include <power/pfuze100_pmic.h> diff --git a/drivers/power/pmic/pmic_tps65910_dm.c b/drivers/power/pmic/pmic_tps65910_dm.c index e03ddc9..8ead1db 100644 --- a/drivers/power/pmic/pmic_tps65910_dm.c +++ b/drivers/power/pmic/pmic_tps65910_dm.c @@ -7,6 +7,7 @@ #include <dm.h> #include <i2c.h> #include <log.h> +#include <linux/printk.h> #include <power/pmic.h> #include <power/regulator.h> #include <power/tps65910_pmic.h> diff --git a/drivers/power/pmic/s2mps11.c b/drivers/power/pmic/s2mps11.c index 1ba1640..5ff4f20 100644 --- a/drivers/power/pmic/s2mps11.c +++ b/drivers/power/pmic/s2mps11.c @@ -10,6 +10,7 @@ #include <dm.h> #include <i2c.h> #include <log.h> +#include <linux/printk.h> #include <power/pmic.h> #include <power/s2mps11.h> diff --git a/drivers/power/pmic/s5m8767.c b/drivers/power/pmic/s5m8767.c index db6d035..eea072a 100644 --- a/drivers/power/pmic/s5m8767.c +++ b/drivers/power/pmic/s5m8767.c @@ -9,6 +9,7 @@ #include <dm.h> #include <i2c.h> #include <log.h> +#include <linux/printk.h> #include <power/pmic.h> #include <power/regulator.h> #include <power/s5m8767.h> diff --git a/drivers/power/pmic/sandbox.c b/drivers/power/pmic/sandbox.c index acfeae2..14b8245 100644 --- a/drivers/power/pmic/sandbox.c +++ b/drivers/power/pmic/sandbox.c @@ -12,6 +12,7 @@ #include <dm.h> #include <i2c.h> #include <log.h> +#include <linux/printk.h> #include <power/pmic.h> #include <power/regulator.h> #include <power/sandbox_pmic.h> diff --git a/drivers/power/pmic/tps65090.c b/drivers/power/pmic/tps65090.c index b81df0d..2a04d59 100644 --- a/drivers/power/pmic/tps65090.c +++ b/drivers/power/pmic/tps65090.c @@ -10,6 +10,7 @@ #include <fdtdec.h> #include <i2c.h> #include <log.h> +#include <linux/printk.h> #include <power/pmic.h> #include <power/tps65090.h> diff --git a/drivers/power/pmic/tps65941.c b/drivers/power/pmic/tps65941.c index 83d0f83..727b427 100644 --- a/drivers/power/pmic/tps65941.c +++ b/drivers/power/pmic/tps65941.c @@ -10,6 +10,7 @@ #include <dm.h> #include <i2c.h> #include <log.h> +#include <linux/printk.h> #include <power/pmic.h> #include <power/regulator.h> #include <power/tps65941.h> diff --git a/drivers/power/regulator/bd71837.c b/drivers/power/regulator/bd71837.c index d4f8da8..913ed88 100644 --- a/drivers/power/regulator/bd71837.c +++ b/drivers/power/regulator/bd71837.c @@ -9,6 +9,7 @@ #include <dm.h> #include <log.h> #include <linux/bitops.h> +#include <linux/printk.h> #include <power/bd71837.h> #include <power/pmic.h> #include <power/regulator.h> diff --git a/drivers/power/regulator/fan53555.c b/drivers/power/regulator/fan53555.c index 815f96b..fa8d88f 100644 --- a/drivers/power/regulator/fan53555.c +++ b/drivers/power/regulator/fan53555.c @@ -11,6 +11,7 @@ #include <log.h> #include <asm/gpio.h> #include <linux/bitops.h> +#include <linux/printk.h> #include <power/fan53555.h> #include <power/pmic.h> #include <power/regulator.h> diff --git a/drivers/power/regulator/fixed.c b/drivers/power/regulator/fixed.c index f7ddba8..590c288 100644 --- a/drivers/power/regulator/fixed.c +++ b/drivers/power/regulator/fixed.c @@ -11,8 +11,10 @@ #include <dm.h> #include <linux/delay.h> #include <log.h> +#include <asm/gpio.h> #include <power/pmic.h> #include <power/regulator.h> +#include "regulator_common.h" #include "regulator_common.h" diff --git a/drivers/power/regulator/gpio-regulator.c b/drivers/power/regulator/gpio-regulator.c index ded7be0..74137b7 100644 --- a/drivers/power/regulator/gpio-regulator.c +++ b/drivers/power/regulator/gpio-regulator.c @@ -10,8 +10,10 @@ #include <dm.h> #include <log.h> #include <asm/gpio.h> +#include <linux/printk.h> #include <power/pmic.h> #include <power/regulator.h> +#include "regulator_common.h" #include "regulator_common.h" diff --git a/drivers/power/regulator/max77686.c b/drivers/power/regulator/max77686.c index cef20e1..3a20803 100644 --- a/drivers/power/regulator/max77686.c +++ b/drivers/power/regulator/max77686.c @@ -10,6 +10,7 @@ #include <fdtdec.h> #include <errno.h> #include <dm.h> +#include <linux/printk.h> #include <power/pmic.h> #include <power/regulator.h> #include <power/max77686_pmic.h> diff --git a/drivers/power/regulator/pbias_regulator.c b/drivers/power/regulator/pbias_regulator.c index 5bf186e..cf4e285 100644 --- a/drivers/power/regulator/pbias_regulator.c +++ b/drivers/power/regulator/pbias_regulator.c @@ -10,6 +10,7 @@ #include <log.h> #include <linux/delay.h> #include <linux/err.h> +#include <linux/printk.h> #include <power/pmic.h> #include <power/regulator.h> #include <regmap.h> diff --git a/drivers/power/regulator/regulator_common.c b/drivers/power/regulator/regulator_common.c index e26f5eb..0116fa0 100644 --- a/drivers/power/regulator/regulator_common.c +++ b/drivers/power/regulator/regulator_common.c @@ -7,8 +7,10 @@ #include <common.h> #include <dm.h> #include <log.h> +#include <asm/gpio.h> #include <linux/delay.h> #include <power/regulator.h> +#include "regulator_common.h" #include "regulator_common.h" diff --git a/drivers/power/regulator/s2mps11_regulator.c b/drivers/power/regulator/s2mps11_regulator.c index 93fb580..987a1f9 100644 --- a/drivers/power/regulator/s2mps11_regulator.c +++ b/drivers/power/regulator/s2mps11_regulator.c @@ -9,6 +9,7 @@ #include <errno.h> #include <dm.h> #include <linux/delay.h> +#include <linux/printk.h> #include <power/pmic.h> #include <power/regulator.h> #include <power/s2mps11.h> diff --git a/drivers/power/regulator/sandbox.c b/drivers/power/regulator/sandbox.c index e8b66bf..71ef0c5 100644 --- a/drivers/power/regulator/sandbox.c +++ b/drivers/power/regulator/sandbox.c @@ -8,6 +8,7 @@ #include <fdtdec.h> #include <errno.h> #include <dm.h> +#include <linux/printk.h> #include <power/pmic.h> #include <power/regulator.h> #include <power/sandbox_pmic.h> diff --git a/drivers/power/regulator/tps65910_regulator.c b/drivers/power/regulator/tps65910_regulator.c index 0ed4952..a4b9d44 100644 --- a/drivers/power/regulator/tps65910_regulator.c +++ b/drivers/power/regulator/tps65910_regulator.c @@ -6,6 +6,7 @@ #include <common.h> #include <dm.h> #include <log.h> +#include <linux/printk.h> #include <power/pmic.h> #include <power/regulator.h> #include <power/tps65910_pmic.h> diff --git a/drivers/power/twl4030.c b/drivers/power/twl4030.c index d3e8949..0c7c396 100644 --- a/drivers/power/twl4030.c +++ b/drivers/power/twl4030.c @@ -25,6 +25,7 @@ #include <command.h> #include <twl4030.h> #include <linux/delay.h> +#include <linux/printk.h> /* * Power Reset diff --git a/drivers/power/twl6030.c b/drivers/power/twl6030.c index 2b50a56..39c05f9 100644 --- a/drivers/power/twl6030.c +++ b/drivers/power/twl6030.c @@ -5,6 +5,7 @@ */ #include <config.h> #include <linux/delay.h> +#include <linux/printk.h> #include <twl6030.h> diff --git a/drivers/ram/imxrt_sdram.c b/drivers/ram/imxrt_sdram.c index d0a8884..6a15242 100644 --- a/drivers/ram/imxrt_sdram.c +++ b/drivers/ram/imxrt_sdram.c @@ -15,6 +15,7 @@ #include <linux/bitops.h> #include <linux/delay.h> #include <linux/err.h> +#include <linux/printk.h> /* SDRAM Command Code */ #define SD_CC_ARD 0x0 /* Master Bus (AXI) command - Read */ diff --git a/drivers/ram/rockchip/dmc-rk3368.c b/drivers/ram/rockchip/dmc-rk3368.c index dd5b191..f36be94 100644 --- a/drivers/ram/rockchip/dmc-rk3368.c +++ b/drivers/ram/rockchip/dmc-rk3368.c @@ -23,6 +23,7 @@ #include <linux/bitops.h> #include <linux/delay.h> #include <linux/err.h> +#include <linux/printk.h> struct dram_info { struct ram_info info; diff --git a/drivers/ram/stm32_sdram.c b/drivers/ram/stm32_sdram.c index 47a930e..891f413 100644 --- a/drivers/ram/stm32_sdram.c +++ b/drivers/ram/stm32_sdram.c @@ -16,6 +16,7 @@ #include <dm/device_compat.h> #include <linux/bitops.h> #include <linux/delay.h> +#include <linux/printk.h> #define MEM_MODE_MASK GENMASK(2, 0) #define SWP_FMC_OFFSET 10 diff --git a/drivers/ram/stm32mp1/stm32mp1_ddr.c b/drivers/ram/stm32mp1/stm32mp1_ddr.c index ab913a6..8ee4e24 100644 --- a/drivers/ram/stm32mp1/stm32mp1_ddr.c +++ b/drivers/ram/stm32mp1/stm32mp1_ddr.c @@ -16,6 +16,7 @@ #include <linux/bitops.h> #include <linux/delay.h> #include <linux/iopoll.h> +#include <linux/printk.h> #include "stm32mp1_ddr.h" #include "stm32mp1_ddr_regs.h" diff --git a/drivers/ram/stm32mp1/stm32mp1_ram.c b/drivers/ram/stm32mp1/stm32mp1_ram.c index a6c19af..61bc002 100644 --- a/drivers/ram/stm32mp1/stm32mp1_ram.c +++ b/drivers/ram/stm32mp1/stm32mp1_ram.c @@ -15,6 +15,7 @@ #include <syscon.h> #include <asm/io.h> #include <dm/device_compat.h> +#include <linux/printk.h> #include "stm32mp1_ddr.h" #include "stm32mp1_ddr_regs.h" diff --git a/drivers/remoteproc/rproc-elf-loader.c b/drivers/remoteproc/rproc-elf-loader.c index b185a6c..5e070e5 100644 --- a/drivers/remoteproc/rproc-elf-loader.c +++ b/drivers/remoteproc/rproc-elf-loader.c @@ -11,6 +11,7 @@ #include <asm/cache.h> #include <dm/device_compat.h> #include <linux/compat.h> +#include <linux/printk.h> /** * struct resource_table - firmware resource table header diff --git a/drivers/remoteproc/rproc-uclass.c b/drivers/remoteproc/rproc-uclass.c index 50bcc90..ece534c 100644 --- a/drivers/remoteproc/rproc-uclass.c +++ b/drivers/remoteproc/rproc-uclass.c @@ -20,6 +20,7 @@ #include <dm/uclass.h> #include <dm/uclass-internal.h> #include <linux/compat.h> +#include <linux/printk.h> DECLARE_GLOBAL_DATA_PTR; @@ -689,7 +690,7 @@ static int alloc_vring(struct udevice *dev, struct fw_rsc_vdev *rsc, int i) debug("alloc_mem(%#x, %d): %p\n", size, order, pa); vring->da = (uintptr_t)pa; - return !pa; + return 0; } static int handle_vdev(struct udevice *dev, struct fw_rsc_vdev *rsc, diff --git a/drivers/remoteproc/sandbox_testproc.c b/drivers/remoteproc/sandbox_testproc.c index 78b1081..d360cf3 100644 --- a/drivers/remoteproc/sandbox_testproc.c +++ b/drivers/remoteproc/sandbox_testproc.c @@ -10,6 +10,7 @@ #include <log.h> #include <remoteproc.h> #include <asm/io.h> +#include <linux/printk.h> /** * enum sandbox_state - different device states diff --git a/drivers/remoteproc/stm32_copro.c b/drivers/remoteproc/stm32_copro.c index 5271f83..3e322c4 100644 --- a/drivers/remoteproc/stm32_copro.c +++ b/drivers/remoteproc/stm32_copro.c @@ -14,6 +14,7 @@ #include <asm/io.h> #include <dm/device_compat.h> #include <linux/err.h> +#include <linux/printk.h> /** * struct stm32_copro_privdata - power processor private data diff --git a/drivers/remoteproc/ti_power_proc.c b/drivers/remoteproc/ti_power_proc.c index 86d544c..6887a3c 100644 --- a/drivers/remoteproc/ti_power_proc.c +++ b/drivers/remoteproc/ti_power_proc.c @@ -11,6 +11,7 @@ #include <log.h> #include <remoteproc.h> #include <asm/global_data.h> +#include <linux/printk.h> #include <mach/psc_defs.h> DECLARE_GLOBAL_DATA_PTR; diff --git a/drivers/remoteproc/ti_sci_proc.h b/drivers/remoteproc/ti_sci_proc.h index f8299d1..36351da 100644 --- a/drivers/remoteproc/ti_sci_proc.h +++ b/drivers/remoteproc/ti_sci_proc.h @@ -10,6 +10,7 @@ #ifndef REMOTEPROC_TI_SCI_PROC_H #define REMOTEPROC_TI_SCI_PROC_H +#include <linux/printk.h> #define TISCI_INVALID_HOST 0xff /** diff --git a/drivers/reset/sti-reset.c b/drivers/reset/sti-reset.c index ea449bb..5305270 100644 --- a/drivers/reset/sti-reset.c +++ b/drivers/reset/sti-reset.c @@ -16,6 +16,7 @@ #include <asm/global_data.h> #include <dt-bindings/reset/stih407-resets.h> #include <linux/bitops.h> +#include <linux/printk.h> DECLARE_GLOBAL_DATA_PTR; diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index 0a3420b..7411660 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c @@ -14,6 +14,7 @@ #include <env.h> #include <libata.h> #include <log.h> +#include <memalign.h> #include <part.h> #include <pci.h> #include <scsi.h> @@ -42,7 +43,7 @@ const struct pci_device_id scsi_device_list[] = { SCSI_DEV_LIST }; #endif static struct scsi_cmd tempccb; /* temporary scsi command buffer */ -static unsigned char tempbuff[512]; /* temporary data buffer */ +DEFINE_CACHE_ALIGN_BUFFER(u8, tempbuff, 512); /* temporary data buffer */ #if !defined(CONFIG_DM_SCSI) static int scsi_max_devs; /* number of highest available scsi device */ @@ -273,6 +274,18 @@ static ulong scsi_write(struct udevice *dev, lbaint_t blknr, lbaint_t blkcnt, __func__, start, smallblks, buf_addr); return blkcnt; } + +#if IS_ENABLED(CONFIG_BOUNCE_BUFFER) +static int scsi_buffer_aligned(struct udevice *dev, struct bounce_buffer *state) +{ + struct scsi_ops *ops = scsi_get_ops(dev->parent); + + if (ops->buffer_aligned) + return ops->buffer_aligned(dev->parent, state); + + return 1; +} +#endif /* CONFIG_BOUNCE_BUFFER */ #endif #if defined(CONFIG_PCI) && !defined(CONFIG_SCSI_AHCI_PLAT) && \ @@ -490,7 +503,7 @@ static int scsi_detect_dev(struct udevice *dev, int target, int lun, pccb->target = target; pccb->lun = lun; - pccb->pdata = (unsigned char *)&tempbuff; + pccb->pdata = tempbuff; pccb->datalen = 512; pccb->dma_dir = DMA_FROM_DEVICE; scsi_setup_inquiry(pccb); @@ -719,6 +732,9 @@ int scsi_scan(bool verbose) static const struct blk_ops scsi_blk_ops = { .read = scsi_read, .write = scsi_write, +#if IS_ENABLED(CONFIG_BOUNCE_BUFFER) + .buffer_aligned = scsi_buffer_aligned, +#endif /* CONFIG_BOUNCE_BUFFER */ }; U_BOOT_DRIVER(scsi_blk) = { diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index 8c54bc9..6cb6598 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig @@ -485,8 +485,8 @@ endchoice config DEBUG_UART_BASE hex "Base address of UART" depends on DEBUG_UART - default 0 if DEBUG_SBI_CONSOLE - default 0 if DEBUG_UART_SANDBOX + default 0x0 if DEBUG_SBI_CONSOLE + default 0x0 if DEBUG_UART_SANDBOX default 0xff000000 if DEBUG_UART_ZYNQ && ARCH_ZYNQMP default 0xe0000000 if DEBUG_UART_ZYNQ && ARCH_ZYNQ help @@ -675,7 +675,7 @@ config COREBOOT_SERIAL config COREBOOT_SERIAL_FROM_DBG2 bool "Obtain UART from ACPI tables" depends on COREBOOT_SERIAL - default y if !SPL + default y help Select this to try to find a DBG2 record in the ACPI tables, in the event that coreboot does not provide information about the UART in the @@ -1142,6 +1142,6 @@ config SYS_SDSR config SYS_SDMR hex "SDMR Value" depends on MPC8XX_CONS - default 0 + default 0x0 endif diff --git a/drivers/serial/serial-uclass.c b/drivers/serial/serial-uclass.c index 067fae2..5e2e7df 100644 --- a/drivers/serial/serial-uclass.c +++ b/drivers/serial/serial-uclass.c @@ -151,6 +151,7 @@ static void serial_find_console_or_panic(void) #ifdef CONFIG_REQUIRE_SERIAL_CONSOLE panic_str("No serial driver found"); #endif + gd->cur_serial_dev = NULL; } #endif /* CONFIG_SERIAL_PRESENT */ @@ -507,28 +508,6 @@ static int serial_post_probe(struct udevice *dev) #endif int ret; -#if defined(CONFIG_NEEDS_MANUAL_RELOC) - if (ops->setbrg) - ops->setbrg += gd->reloc_off; - if (ops->getc) - ops->getc += gd->reloc_off; - if (ops->putc) - ops->putc += gd->reloc_off; - if (ops->pending) - ops->pending += gd->reloc_off; - if (ops->clear) - ops->clear += gd->reloc_off; - if (ops->getconfig) - ops->getconfig += gd->reloc_off; - if (ops->setconfig) - ops->setconfig += gd->reloc_off; -#if CFG_POST & CFG_SYS_POST_UART - if (ops->loop) - ops->loop += gd->reloc_off; -#endif - if (ops->getinfo) - ops->getinfo += gd->reloc_off; -#endif /* Set the baud rate */ if (ops->setbrg) { ret = ops->setbrg(dev, gd->baudrate); diff --git a/drivers/serial/serial.c b/drivers/serial/serial.c index 9a380d7..787edd5 100644 --- a/drivers/serial/serial.c +++ b/drivers/serial/serial.c @@ -142,23 +142,6 @@ serial_initfunc(mtk_serial_initialize); */ void serial_register(struct serial_device *dev) { -#ifdef CONFIG_NEEDS_MANUAL_RELOC - if (dev->start) - dev->start += gd->reloc_off; - if (dev->stop) - dev->stop += gd->reloc_off; - if (dev->setbrg) - dev->setbrg += gd->reloc_off; - if (dev->getc) - dev->getc += gd->reloc_off; - if (dev->tstc) - dev->tstc += gd->reloc_off; - if (dev->putc) - dev->putc += gd->reloc_off; - if (dev->puts) - dev->puts += gd->reloc_off; -#endif - dev->next = serial_devices; serial_devices = dev; } diff --git a/drivers/serial/serial_mtk.c b/drivers/serial/serial_mtk.c index 2dffa14..f146f2b 100644 --- a/drivers/serial/serial_mtk.c +++ b/drivers/serial/serial_mtk.c @@ -19,6 +19,7 @@ #include <asm/io.h> #include <asm/types.h> #include <linux/err.h> +#include <linux/printk.h> struct mtk_serial_regs { u32 rbr; diff --git a/drivers/soc/ti/k3-navss-ringacc.c b/drivers/soc/ti/k3-navss-ringacc.c index f110d78..9881bff 100644 --- a/drivers/soc/ti/k3-navss-ringacc.c +++ b/drivers/soc/ti/k3-navss-ringacc.c @@ -21,6 +21,7 @@ #include <linux/compat.h> #include <linux/dma-mapping.h> #include <linux/err.h> +#include <linux/printk.h> #include <linux/soc/ti/k3-navss-ringacc.h> #include <linux/soc/ti/ti_sci_protocol.h> #include <linux/soc/ti/cppi5.h> diff --git a/drivers/spi/atmel_spi.c b/drivers/spi/atmel_spi.c index 702e225..aec6f4e 100644 --- a/drivers/spi/atmel_spi.c +++ b/drivers/spi/atmel_spi.c @@ -17,6 +17,7 @@ #include <asm/gpio.h> #endif #include <linux/bitops.h> +#include <linux/printk.h> /* * Register definitions for the Atmel AT32/AT91 SPI Controller diff --git a/drivers/spi/fsl_dspi.c b/drivers/spi/fsl_dspi.c index 8e5cc55..f8ec268 100644 --- a/drivers/spi/fsl_dspi.c +++ b/drivers/spi/fsl_dspi.c @@ -26,6 +26,7 @@ #include <fsl_dspi.h> #include <linux/bitops.h> #include <linux/delay.h> +#include <linux/printk.h> /* linux/include/time.h */ #define NSEC_PER_SEC 1000000000L diff --git a/drivers/spi/mt7621_spi.c b/drivers/spi/mt7621_spi.c index eb09317..3d00809 100644 --- a/drivers/spi/mt7621_spi.c +++ b/drivers/spi/mt7621_spi.c @@ -16,6 +16,7 @@ #include <wait_bit.h> #include <linux/bitops.h> #include <linux/io.h> +#include <linux/printk.h> #define MT7621_RX_FIFO_LEN 32 #define MT7621_TX_FIFO_LEN 36 diff --git a/drivers/spi/mxc_spi.c b/drivers/spi/mxc_spi.c index 840660f..33360a1 100644 --- a/drivers/spi/mxc_spi.c +++ b/drivers/spi/mxc_spi.c @@ -19,6 +19,7 @@ #include <asm/arch/imx-regs.h> #include <asm/arch/clock.h> #include <asm/mach-imx/spi.h> +#include <linux/printk.h> DECLARE_GLOBAL_DATA_PTR; diff --git a/drivers/spi/pl022_spi.c b/drivers/spi/pl022_spi.c index fc7388b..e2b49eb 100644 --- a/drivers/spi/pl022_spi.c +++ b/drivers/spi/pl022_spi.c @@ -18,6 +18,7 @@ #include <asm/global_data.h> #include <asm/gpio.h> #include <spi.h> +#include <linux/printk.h> #define SSP_CR0 0x000 #define SSP_CR1 0x004 diff --git a/drivers/spi/spi-uclass.c b/drivers/spi/spi-uclass.c index c929e7c..f4795e6 100644 --- a/drivers/spi/spi-uclass.c +++ b/drivers/spi/spi-uclass.c @@ -196,38 +196,6 @@ static int spi_post_probe(struct udevice *bus) spi->max_hz = dev_read_u32_default(bus, "spi-max-frequency", 0); } -#if defined(CONFIG_NEEDS_MANUAL_RELOC) - struct dm_spi_ops *ops = spi_get_ops(bus); - static int reloc_done; - - if (!reloc_done) { - if (ops->claim_bus) - ops->claim_bus += gd->reloc_off; - if (ops->release_bus) - ops->release_bus += gd->reloc_off; - if (ops->set_wordlen) - ops->set_wordlen += gd->reloc_off; - if (ops->xfer) - ops->xfer += gd->reloc_off; - if (ops->set_speed) - ops->set_speed += gd->reloc_off; - if (ops->set_mode) - ops->set_mode += gd->reloc_off; - if (ops->cs_info) - ops->cs_info += gd->reloc_off; - if (ops->mem_ops) { - struct spi_controller_mem_ops *mem_ops = - (struct spi_controller_mem_ops *)ops->mem_ops; - if (mem_ops->adjust_op_size) - mem_ops->adjust_op_size += gd->reloc_off; - if (mem_ops->supports_op) - mem_ops->supports_op += gd->reloc_off; - if (mem_ops->exec_op) - mem_ops->exec_op += gd->reloc_off; - } - reloc_done++; - } -#endif return 0; } diff --git a/drivers/spi/stm32_qspi.c b/drivers/spi/stm32_qspi.c index eb52ff7..2ffa201 100644 --- a/drivers/spi/stm32_qspi.c +++ b/drivers/spi/stm32_qspi.c @@ -22,6 +22,7 @@ #include <linux/delay.h> #include <linux/iopoll.h> #include <linux/ioport.h> +#include <linux/printk.h> #include <linux/sizes.h> struct stm32_qspi_regs { diff --git a/drivers/spi/stm32_spi.c b/drivers/spi/stm32_spi.c index fe5419e..82f6ed7 100644 --- a/drivers/spi/stm32_spi.c +++ b/drivers/spi/stm32_spi.c @@ -18,6 +18,7 @@ #include <dm/device_compat.h> #include <linux/bitops.h> #include <linux/delay.h> +#include <linux/printk.h> #include <asm/io.h> #include <asm/gpio.h> diff --git a/drivers/spi/uniphier_spi.c b/drivers/spi/uniphier_spi.c index fcc1bfe..6402acb 100644 --- a/drivers/spi/uniphier_spi.c +++ b/drivers/spi/uniphier_spi.c @@ -17,6 +17,7 @@ #include <linux/io.h> #include <spi.h> #include <wait_bit.h> +#include <linux/printk.h> DECLARE_GLOBAL_DATA_PTR; diff --git a/drivers/spi/zynqmp_gqspi.c b/drivers/spi/zynqmp_gqspi.c index c4aee27..ec59ef58 100644 --- a/drivers/spi/zynqmp_gqspi.c +++ b/drivers/spi/zynqmp_gqspi.c @@ -690,7 +690,7 @@ static int zynqmp_qspi_start_dma(struct zynqmp_qspi_priv *priv, writel(GQSPI_DMA_DST_I_STS_MASK, &dma_regs->dmaier); addr = (unsigned long)buf; size = roundup(priv->len, GQSPI_DMA_ALIGN); - flush_dcache_range(addr, addr + size); + invalidate_dcache_range(addr, addr + size); while (priv->len) { zynqmp_qspi_calc_exp(priv, &gen_fifo_cmd); @@ -707,6 +707,8 @@ static int zynqmp_qspi_start_dma(struct zynqmp_qspi_priv *priv, return -ETIMEDOUT; } + invalidate_dcache_range(addr, addr + size); + writel(GQSPI_DMA_DST_I_STS_DONE, &dma_regs->dmaisr); debug("buf:0x%lx, rxbuf:0x%lx, *buf:0x%x len: 0x%x\n", diff --git a/drivers/sysreset/sysreset-uclass.c b/drivers/sysreset/sysreset-uclass.c index 279b087..6151b5f 100644 --- a/drivers/sysreset/sysreset-uclass.c +++ b/drivers/sysreset/sysreset-uclass.c @@ -158,23 +158,7 @@ int do_poweroff(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) } #endif -static int sysreset_post_bind(struct udevice *dev) -{ -#if defined(CONFIG_NEEDS_MANUAL_RELOC) - struct sysreset_ops *ops = sysreset_get_ops(dev); - static int reloc_done; - - if (!reloc_done) { - if (ops->request) - ops->request += gd->reloc_off; - reloc_done++; - } -#endif - return 0; -} - UCLASS_DRIVER(sysreset) = { .id = UCLASS_SYSRESET, .name = "sysreset", - .post_bind = sysreset_post_bind, }; diff --git a/drivers/sysreset/sysreset_sti.c b/drivers/sysreset/sysreset_sti.c index f0f445f..edd90aa 100644 --- a/drivers/sysreset/sysreset_sti.c +++ b/drivers/sysreset/sysreset_sti.c @@ -12,6 +12,7 @@ #include <asm/global_data.h> #include <asm/io.h> #include <linux/bitops.h> +#include <linux/printk.h> DECLARE_GLOBAL_DATA_PTR; diff --git a/drivers/sysreset/sysreset_syscon.c b/drivers/sysreset/sysreset_syscon.c index 525faf2..e468dac 100644 --- a/drivers/sysreset/sysreset_syscon.c +++ b/drivers/sysreset/sysreset_syscon.c @@ -14,6 +14,7 @@ #include <sysreset.h> #include <syscon.h> #include <linux/err.h> +#include <linux/printk.h> struct syscon_reboot_priv { struct regmap *regmap; diff --git a/drivers/sysreset/sysreset_watchdog.c b/drivers/sysreset/sysreset_watchdog.c index 8a659ee..ceada2e 100644 --- a/drivers/sysreset/sysreset_watchdog.c +++ b/drivers/sysreset/sysreset_watchdog.c @@ -10,6 +10,7 @@ #include <malloc.h> #include <sysreset.h> #include <wdt.h> +#include <linux/printk.h> struct wdt_reboot_plat { struct udevice *wdt; diff --git a/drivers/timer/timer-uclass.c b/drivers/timer/timer-uclass.c index f4b871a..0c2018b 100644 --- a/drivers/timer/timer-uclass.c +++ b/drivers/timer/timer-uclass.c @@ -51,19 +51,6 @@ unsigned long notrace timer_get_rate(struct udevice *dev) static int timer_pre_probe(struct udevice *dev) { - if (IS_ENABLED(CONFIG_NEEDS_MANUAL_RELOC) && - (gd->flags & GD_FLG_RELOC)) { - struct timer_ops *ops = timer_get_ops(dev); - static int reloc_done; - - if (!reloc_done) { - if (ops->get_count) - MANUAL_RELOC(ops->get_count); - - reloc_done++; - } - } - if (CONFIG_IS_ENABLED(OF_REAL)) { struct timer_dev_priv *uc_priv = dev_get_uclass_priv(dev); struct clk timer_clk; diff --git a/drivers/tpm/tpm_tis_infineon.c b/drivers/tpm/tpm_tis_infineon.c index 525ad72..16f4af0 100644 --- a/drivers/tpm/tpm_tis_infineon.c +++ b/drivers/tpm/tpm_tis_infineon.c @@ -28,6 +28,7 @@ #include <linux/delay.h> #include <linux/errno.h> #include <linux/compiler.h> +#include <linux/printk.h> #include <linux/types.h> #include <linux/unaligned/be_byteshift.h> diff --git a/drivers/ufs/Kconfig b/drivers/ufs/Kconfig index 69ea18e..0e0cc58 100644 --- a/drivers/ufs/Kconfig +++ b/drivers/ufs/Kconfig @@ -21,4 +21,13 @@ config TI_J721E_UFS This selects the glue layer driver for Cadence controller present on TI's J721E devices. +config UFS_RENESAS + bool "Renesas specific hooks to UFS controller platform driver" + depends on UFS + select BOUNCE_BUFFER + help + This selects the Renesas specific additions to UFSHCD platform driver. + UFS host on Renesas needs some vendor specific configuration before + accessing the hardware. + endmenu diff --git a/drivers/ufs/Makefile b/drivers/ufs/Makefile index 62ed016..4f3344f 100644 --- a/drivers/ufs/Makefile +++ b/drivers/ufs/Makefile @@ -6,3 +6,4 @@ obj-$(CONFIG_UFS) += ufs.o ufs-uclass.o obj-$(CONFIG_CADENCE_UFS) += cdns-platform.o obj-$(CONFIG_TI_J721E_UFS) += ti-j721e-ufs.o +obj-$(CONFIG_UFS_RENESAS) += ufs-renesas.o diff --git a/drivers/ufs/cdns-platform.c b/drivers/ufs/cdns-platform.c index bad1bf7..1e62e25 100644 --- a/drivers/ufs/cdns-platform.c +++ b/drivers/ufs/cdns-platform.c @@ -119,7 +119,7 @@ static const struct udevice_id cdns_ufs_pltfm_ids[] = { U_BOOT_DRIVER(cdns_ufs_pltfm) = { .name = "cdns-ufs-pltfm", - .id = UCLASS_UFS, + .id = UCLASS_UFS, .of_match = cdns_ufs_pltfm_ids, .probe = cdns_ufs_pltfm_probe, .bind = cdns_ufs_pltfm_bind, diff --git a/drivers/ufs/ufs-renesas.c b/drivers/ufs/ufs-renesas.c new file mode 100644 index 0000000..ae05bdc --- /dev/null +++ b/drivers/ufs/ufs-renesas.c @@ -0,0 +1,412 @@ +// SPDX-License-Identifier: GPL-2.0 OR MIT +/* + * Renesas UFS host controller driver + * + * Copyright (C) 2022 Renesas Electronics Corporation + */ + +#include <clk.h> +#include <dm.h> +#include <ufs.h> +#include <asm/io.h> +#include <dm/device_compat.h> +#include <linux/bitops.h> +#include <linux/delay.h> +#include <linux/err.h> +#include <linux/bug.h> +#include <linux/iopoll.h> + +#include "ufs.h" + +struct ufs_renesas_priv { + struct clk_bulk clks; + bool initialized; /* The hardware needs initialization once */ +}; + +enum { + SET_PHY_INDEX_LO = 0, + SET_PHY_INDEX_HI, + TIMER_INDEX, + MAX_INDEX +}; + +enum ufs_renesas_init_param_mode { + MODE_RESTORE, + MODE_SET, + MODE_SAVE, + MODE_POLL, + MODE_WAIT, + MODE_WRITE, +}; + +#define PARAM_RESTORE(_reg, _index) \ + { .mode = MODE_RESTORE, .reg = _reg, .index = _index } +#define PARAM_SET(_index, _set) \ + { .mode = MODE_SET, .index = _index, .u.set = _set } +#define PARAM_SAVE(_reg, _mask, _index) \ + { .mode = MODE_SAVE, .reg = _reg, .mask = (u32)(_mask), \ + .index = _index } +#define PARAM_POLL(_reg, _expected, _mask) \ + { .mode = MODE_POLL, .reg = _reg, .u.expected = _expected, \ + .mask = (u32)(_mask) } +#define PARAM_WAIT(_delay_us) \ + { .mode = MODE_WAIT, .u.delay_us = _delay_us } + +#define PARAM_WRITE(_reg, _val) \ + { .mode = MODE_WRITE, .reg = _reg, .u.val = _val } + +#define PARAM_WRITE_D0_D4(_d0, _d4) \ + PARAM_WRITE(0xd0, _d0), PARAM_WRITE(0xd4, _d4) + +#define PARAM_WRITE_800_80C_POLL(_addr, _data_800) \ + PARAM_WRITE_D0_D4(0x0000080c, 0x00000100), \ + PARAM_WRITE_D0_D4(0x00000800, ((_data_800) << 16) | BIT(8) | (_addr)), \ + PARAM_WRITE(0xd0, 0x0000080c), \ + PARAM_POLL(0xd4, BIT(8), BIT(8)) + +#define PARAM_RESTORE_800_80C_POLL(_index) \ + PARAM_WRITE_D0_D4(0x0000080c, 0x00000100), \ + PARAM_WRITE(0xd0, 0x00000800), \ + PARAM_RESTORE(0xd4, (_index)), \ + PARAM_WRITE(0xd0, 0x0000080c), \ + PARAM_POLL(0xd4, BIT(8), BIT(8)) + +#define PARAM_WRITE_804_80C_POLL(_addr, _data_804) \ + PARAM_WRITE_D0_D4(0x0000080c, 0x00000100), \ + PARAM_WRITE_D0_D4(0x00000804, ((_data_804) << 16) | BIT(8) | (_addr)), \ + PARAM_WRITE(0xd0, 0x0000080c), \ + PARAM_POLL(0xd4, BIT(8), BIT(8)) + +#define PARAM_WRITE_828_82C_POLL(_data_828) \ + PARAM_WRITE_D0_D4(0x0000082c, 0x0f000000), \ + PARAM_WRITE_D0_D4(0x00000828, _data_828), \ + PARAM_WRITE(0xd0, 0x0000082c), \ + PARAM_POLL(0xd4, _data_828, _data_828) + +#define PARAM_WRITE_PHY(_addr16, _data16) \ + PARAM_WRITE(0xf0, 1), \ + PARAM_WRITE_800_80C_POLL(0x16, (_addr16) & 0xff), \ + PARAM_WRITE_800_80C_POLL(0x17, ((_addr16) >> 8) & 0xff), \ + PARAM_WRITE_800_80C_POLL(0x18, (_data16) & 0xff), \ + PARAM_WRITE_800_80C_POLL(0x19, ((_data16) >> 8) & 0xff), \ + PARAM_WRITE_800_80C_POLL(0x1c, 0x01), \ + PARAM_WRITE_828_82C_POLL(0x0f000000), \ + PARAM_WRITE(0xf0, 0) + +#define PARAM_SET_PHY(_addr16, _data16) \ + PARAM_WRITE(0xf0, 1), \ + PARAM_WRITE_800_80C_POLL(0x16, (_addr16) & 0xff), \ + PARAM_WRITE_800_80C_POLL(0x17, ((_addr16) >> 8) & 0xff), \ + PARAM_WRITE_800_80C_POLL(0x1c, 0x01), \ + PARAM_WRITE_828_82C_POLL(0x0f000000), \ + PARAM_WRITE_804_80C_POLL(0x1a, 0), \ + PARAM_WRITE(0xd0, 0x00000808), \ + PARAM_SAVE(0xd4, 0xff, SET_PHY_INDEX_LO), \ + PARAM_WRITE_804_80C_POLL(0x1b, 0), \ + PARAM_WRITE(0xd0, 0x00000808), \ + PARAM_SAVE(0xd4, 0xff, SET_PHY_INDEX_HI), \ + PARAM_WRITE_828_82C_POLL(0x0f000000), \ + PARAM_WRITE(0xf0, 0), \ + PARAM_WRITE(0xf0, 1), \ + PARAM_WRITE_800_80C_POLL(0x16, (_addr16) & 0xff), \ + PARAM_WRITE_800_80C_POLL(0x17, ((_addr16) >> 8) & 0xff), \ + PARAM_SET(SET_PHY_INDEX_LO, (((_data16) & 0xff) << 16) | BIT(8) | 0x18), \ + PARAM_RESTORE_800_80C_POLL(SET_PHY_INDEX_LO), \ + PARAM_SET(SET_PHY_INDEX_HI, ((((_data16) >> 8) & 0xff) << 16) | BIT(8) | 0x19), \ + PARAM_RESTORE_800_80C_POLL(SET_PHY_INDEX_HI), \ + PARAM_WRITE_800_80C_POLL(0x1c, 0x01), \ + PARAM_WRITE_828_82C_POLL(0x0f000000), \ + PARAM_WRITE(0xf0, 0) + +#define PARAM_INDIRECT_WRITE(_gpio, _addr, _data_800) \ + PARAM_WRITE(0xf0, _gpio), \ + PARAM_WRITE_800_80C_POLL((_addr), _data_800), \ + PARAM_WRITE_828_82C_POLL(0x0f000000), \ + PARAM_WRITE(0xf0, 0) + +#define PARAM_INDIRECT_POLL(_gpio, _addr, _expected, _mask) \ + PARAM_WRITE(0xf0, _gpio), \ + PARAM_WRITE_800_80C_POLL((_addr), 0), \ + PARAM_WRITE(0xd0, 0x00000808), \ + PARAM_POLL(0xd4, (_expected), (_mask)), \ + PARAM_WRITE(0xf0, 0) + +struct ufs_renesas_init_param { + enum ufs_renesas_init_param_mode mode; + u32 reg; + union { + u32 expected; + u32 delay_us; + u32 set; + u32 val; + } u; + u32 mask; + u32 index; +}; + +/* This setting is for SERIES B */ +static const struct ufs_renesas_init_param ufs_param[] = { + PARAM_WRITE(0xc0, 0x49425308), + PARAM_WRITE_D0_D4(0x00000104, 0x00000002), + PARAM_WAIT(1), + PARAM_WRITE_D0_D4(0x00000828, 0x00000200), + PARAM_WAIT(1), + PARAM_WRITE_D0_D4(0x00000828, 0x00000000), + PARAM_WRITE_D0_D4(0x00000104, 0x00000001), + PARAM_WRITE_D0_D4(0x00000940, 0x00000001), + PARAM_WAIT(1), + PARAM_WRITE_D0_D4(0x00000940, 0x00000000), + + PARAM_WRITE(0xc0, 0x49425308), + PARAM_WRITE(0xc0, 0x41584901), + + PARAM_WRITE_D0_D4(0x0000080c, 0x00000100), + PARAM_WRITE_D0_D4(0x00000804, 0x00000000), + PARAM_WRITE(0xd0, 0x0000080c), + PARAM_POLL(0xd4, BIT(8), BIT(8)), + + PARAM_WRITE(REG_CONTROLLER_ENABLE, 0x00000001), + + PARAM_WRITE(0xd0, 0x00000804), + PARAM_POLL(0xd4, BIT(8) | BIT(6) | BIT(0), BIT(8) | BIT(6) | BIT(0)), + + PARAM_WRITE(0xd0, 0x00000d00), + PARAM_SAVE(0xd4, 0x0000ffff, TIMER_INDEX), + PARAM_WRITE(0xd4, 0x00000000), + PARAM_WRITE_D0_D4(0x0000082c, 0x0f000000), + PARAM_WRITE_D0_D4(0x00000828, 0x08000000), + PARAM_WRITE(0xd0, 0x0000082c), + PARAM_POLL(0xd4, BIT(27), BIT(27)), + PARAM_WRITE(0xd0, 0x00000d2c), + PARAM_POLL(0xd4, BIT(0), BIT(0)), + + /* phy setup */ + PARAM_INDIRECT_WRITE(1, 0x01, 0x001f), + PARAM_INDIRECT_WRITE(7, 0x5d, 0x0014), + PARAM_INDIRECT_WRITE(7, 0x5e, 0x0014), + PARAM_INDIRECT_WRITE(7, 0x0d, 0x0003), + PARAM_INDIRECT_WRITE(7, 0x0e, 0x0007), + PARAM_INDIRECT_WRITE(7, 0x5f, 0x0003), + PARAM_INDIRECT_WRITE(7, 0x60, 0x0003), + PARAM_INDIRECT_WRITE(7, 0x5b, 0x00a6), + PARAM_INDIRECT_WRITE(7, 0x5c, 0x0003), + + PARAM_INDIRECT_POLL(7, 0x3c, 0, BIT(7)), + PARAM_INDIRECT_POLL(7, 0x4c, 0, BIT(4)), + + PARAM_INDIRECT_WRITE(1, 0x32, 0x0080), + PARAM_INDIRECT_WRITE(1, 0x1f, 0x0001), + PARAM_INDIRECT_WRITE(0, 0x2c, 0x0001), + PARAM_INDIRECT_WRITE(0, 0x32, 0x0087), + + PARAM_INDIRECT_WRITE(1, 0x4d, 0x0061), + PARAM_INDIRECT_WRITE(4, 0x9b, 0x0009), + PARAM_INDIRECT_WRITE(4, 0xa6, 0x0005), + PARAM_INDIRECT_WRITE(4, 0xa5, 0x0058), + PARAM_INDIRECT_WRITE(1, 0x39, 0x0027), + PARAM_INDIRECT_WRITE(1, 0x47, 0x004c), + + PARAM_INDIRECT_WRITE(7, 0x0d, 0x0002), + PARAM_INDIRECT_WRITE(7, 0x0e, 0x0007), + + PARAM_WRITE_PHY(0x0028, 0x0061), + PARAM_WRITE_PHY(0x4014, 0x0061), + PARAM_SET_PHY(0x401c, BIT(2)), + PARAM_WRITE_PHY(0x4000, 0x0000), + PARAM_WRITE_PHY(0x4001, 0x0000), + + PARAM_WRITE_PHY(0x10ae, 0x0001), + PARAM_WRITE_PHY(0x10ad, 0x0000), + PARAM_WRITE_PHY(0x10af, 0x0001), + PARAM_WRITE_PHY(0x10b6, 0x0001), + PARAM_WRITE_PHY(0x10ae, 0x0000), + + PARAM_WRITE_PHY(0x10ae, 0x0001), + PARAM_WRITE_PHY(0x10ad, 0x0000), + PARAM_WRITE_PHY(0x10af, 0x0002), + PARAM_WRITE_PHY(0x10b6, 0x0001), + PARAM_WRITE_PHY(0x10ae, 0x0000), + + PARAM_WRITE_PHY(0x10ae, 0x0001), + PARAM_WRITE_PHY(0x10ad, 0x0080), + PARAM_WRITE_PHY(0x10af, 0x0000), + PARAM_WRITE_PHY(0x10b6, 0x0001), + PARAM_WRITE_PHY(0x10ae, 0x0000), + + PARAM_WRITE_PHY(0x10ae, 0x0001), + PARAM_WRITE_PHY(0x10ad, 0x0080), + PARAM_WRITE_PHY(0x10af, 0x001a), + PARAM_WRITE_PHY(0x10b6, 0x0001), + PARAM_WRITE_PHY(0x10ae, 0x0000), + + PARAM_INDIRECT_WRITE(7, 0x70, 0x0016), + PARAM_INDIRECT_WRITE(7, 0x71, 0x0016), + PARAM_INDIRECT_WRITE(7, 0x72, 0x0014), + PARAM_INDIRECT_WRITE(7, 0x73, 0x0014), + PARAM_INDIRECT_WRITE(7, 0x74, 0x0000), + PARAM_INDIRECT_WRITE(7, 0x75, 0x0000), + PARAM_INDIRECT_WRITE(7, 0x76, 0x0010), + PARAM_INDIRECT_WRITE(7, 0x77, 0x0010), + PARAM_INDIRECT_WRITE(7, 0x78, 0x00ff), + PARAM_INDIRECT_WRITE(7, 0x79, 0x0000), + + PARAM_INDIRECT_WRITE(7, 0x19, 0x0007), + + PARAM_INDIRECT_WRITE(7, 0x1a, 0x0007), + + PARAM_INDIRECT_WRITE(7, 0x24, 0x000c), + + PARAM_INDIRECT_WRITE(7, 0x25, 0x000c), + + PARAM_INDIRECT_WRITE(7, 0x62, 0x0000), + PARAM_INDIRECT_WRITE(7, 0x63, 0x0000), + PARAM_INDIRECT_WRITE(7, 0x5d, 0x0014), + PARAM_INDIRECT_WRITE(7, 0x5e, 0x0017), + PARAM_INDIRECT_WRITE(7, 0x5d, 0x0004), + PARAM_INDIRECT_WRITE(7, 0x5e, 0x0017), + PARAM_INDIRECT_POLL(7, 0x55, 0, BIT(6)), + PARAM_INDIRECT_POLL(7, 0x41, 0, BIT(7)), + /* end of phy setup */ + + PARAM_WRITE(0xf0, 0), + PARAM_WRITE(0xd0, 0x00000d00), + PARAM_RESTORE(0xd4, TIMER_INDEX), +}; + +static void ufs_renesas_reg_control(struct ufs_hba *hba, + const struct ufs_renesas_init_param *p) +{ + static u32 save[MAX_INDEX]; + int ret; + u32 val; + + WARN_ON(p->index >= MAX_INDEX); + + switch (p->mode) { + case MODE_RESTORE: + ufshcd_writel(hba, save[p->index], p->reg); + break; + case MODE_SET: + save[p->index] |= p->u.set; + break; + case MODE_SAVE: + save[p->index] = ufshcd_readl(hba, p->reg) & p->mask; + break; + case MODE_POLL: + ret = readl_poll_timeout(hba->mmio_base + p->reg, val, + (val & p->mask) == p->u.expected, + 10000); + if (ret) + dev_err(hba->dev, "%s: poll failed %d (%08x, %08x, %08x)\n", + __func__, ret, val, p->mask, p->u.expected); + break; + case MODE_WAIT: + if (p->u.delay_us > 1000) + mdelay(DIV_ROUND_UP(p->u.delay_us, 1000)); + else + udelay(p->u.delay_us); + break; + case MODE_WRITE: + ufshcd_writel(hba, p->u.val, p->reg); + break; + default: + break; + } +} + +static void ufs_renesas_pre_init(struct ufs_hba *hba) +{ + const struct ufs_renesas_init_param *p = ufs_param; + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(ufs_param); i++) + ufs_renesas_reg_control(hba, &p[i]); +} + +static int ufs_renesas_hce_enable_notify(struct ufs_hba *hba, + enum ufs_notify_change_status status) +{ + struct ufs_renesas_priv *priv = dev_get_priv(hba->dev); + + if (priv->initialized) + return 0; + + if (status == PRE_CHANGE) + ufs_renesas_pre_init(hba); + + priv->initialized = true; + + return 0; +} + +static int ufs_renesas_init(struct ufs_hba *hba) +{ + hba->quirks |= UFSHCD_QUIRK_BROKEN_64BIT_ADDRESS | UFSHCD_QUIRK_HIBERN_FASTAUTO; + + return 0; +} + +static struct ufs_hba_ops ufs_renesas_vops = { + .init = ufs_renesas_init, + .hce_enable_notify = ufs_renesas_hce_enable_notify, +}; + +static int ufs_renesas_pltfm_bind(struct udevice *dev) +{ + struct udevice *scsi_dev; + + return ufs_scsi_bind(dev, &scsi_dev); +} + +static int ufs_renesas_pltfm_probe(struct udevice *dev) +{ + struct ufs_renesas_priv *priv = dev_get_priv(dev); + int err; + + err = clk_get_bulk(dev, &priv->clks); + if (err < 0) + return err; + + err = clk_enable_bulk(&priv->clks); + if (err) + goto err_clk_enable; + + err = ufshcd_probe(dev, &ufs_renesas_vops); + if (err) { + dev_err(dev, "ufshcd_probe() failed %d\n", err); + goto err_ufshcd_probe; + } + + return 0; + +err_ufshcd_probe: + clk_disable_bulk(&priv->clks); +err_clk_enable: + clk_release_bulk(&priv->clks); + return err; +} + +static int ufs_renesas_pltfm_remove(struct udevice *dev) +{ + struct ufs_renesas_priv *priv = dev_get_priv(dev); + + clk_disable_bulk(&priv->clks); + clk_release_bulk(&priv->clks); + + return 0; +} + +static const struct udevice_id ufs_renesas_pltfm_ids[] = { + { .compatible = "renesas,r8a779f0-ufs" }, + { /* sentinel */ } +}; + +U_BOOT_DRIVER(ufs_renesas) = { + .name = "ufs-renesas", + .id = UCLASS_UFS, + .of_match = ufs_renesas_pltfm_ids, + .bind = ufs_renesas_pltfm_bind, + .probe = ufs_renesas_pltfm_probe, + .remove = ufs_renesas_pltfm_remove, + .priv_auto = sizeof(struct ufs_renesas_priv), +}; diff --git a/drivers/ufs/ufs.c b/drivers/ufs/ufs.c index 3bf1a95..7c48d57 100644 --- a/drivers/ufs/ufs.c +++ b/drivers/ufs/ufs.c @@ -8,6 +8,7 @@ * Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com */ +#include <bouncebuf.h> #include <charset.h> #include <common.h> #include <dm.h> @@ -692,13 +693,29 @@ static inline u8 ufshcd_get_upmcrs(struct ufs_hba *hba) } /** + * ufshcd_cache_flush_and_invalidate - Flush and invalidate cache + * + * Flush and invalidate cache in aligned address..address+size range. + * The invalidation is in place to avoid stale data in cache. + */ +static void ufshcd_cache_flush_and_invalidate(void *addr, unsigned long size) +{ + uintptr_t aaddr = (uintptr_t)addr & ~(ARCH_DMA_MINALIGN - 1); + unsigned long asize = ALIGN(size, ARCH_DMA_MINALIGN); + + flush_dcache_range(aaddr, aaddr + asize); + invalidate_dcache_range(aaddr, aaddr + asize); +} + +/** * ufshcd_prepare_req_desc_hdr() - Fills the requests header * descriptor according to request */ -static void ufshcd_prepare_req_desc_hdr(struct utp_transfer_req_desc *req_desc, +static void ufshcd_prepare_req_desc_hdr(struct ufs_hba *hba, u32 *upiu_flags, enum dma_data_direction cmd_dir) { + struct utp_transfer_req_desc *req_desc = hba->utrdl; u32 data_direction; u32 dword_0; @@ -733,6 +750,8 @@ static void ufshcd_prepare_req_desc_hdr(struct utp_transfer_req_desc *req_desc, req_desc->header.dword_3 = 0; req_desc->prd_table_length = 0; + + ufshcd_cache_flush_and_invalidate(req_desc, sizeof(*req_desc)); } static void ufshcd_prepare_utp_query_req_upiu(struct ufs_hba *hba, @@ -761,10 +780,15 @@ static void ufshcd_prepare_utp_query_req_upiu(struct ufs_hba *hba, memcpy(&ucd_req_ptr->qr, &query->request.upiu_req, QUERY_OSF_SIZE); /* Copy the Descriptor */ - if (query->request.upiu_req.opcode == UPIU_QUERY_OPCODE_WRITE_DESC) + if (query->request.upiu_req.opcode == UPIU_QUERY_OPCODE_WRITE_DESC) { memcpy(ucd_req_ptr + 1, query->descriptor, len); + ufshcd_cache_flush_and_invalidate(ucd_req_ptr, 2 * sizeof(*ucd_req_ptr)); + } else { + ufshcd_cache_flush_and_invalidate(ucd_req_ptr, sizeof(*ucd_req_ptr)); + } memset(hba->ucd_rsp_ptr, 0, sizeof(struct utp_upiu_rsp)); + ufshcd_cache_flush_and_invalidate(hba->ucd_rsp_ptr, sizeof(*hba->ucd_rsp_ptr)); } static inline void ufshcd_prepare_utp_nop_upiu(struct ufs_hba *hba) @@ -781,6 +805,9 @@ static inline void ufshcd_prepare_utp_nop_upiu(struct ufs_hba *hba) ucd_req_ptr->header.dword_2 = 0; memset(hba->ucd_rsp_ptr, 0, sizeof(struct utp_upiu_rsp)); + + ufshcd_cache_flush_and_invalidate(ucd_req_ptr, sizeof(*ucd_req_ptr)); + ufshcd_cache_flush_and_invalidate(hba->ucd_rsp_ptr, sizeof(*hba->ucd_rsp_ptr)); } /** @@ -792,11 +819,10 @@ static int ufshcd_comp_devman_upiu(struct ufs_hba *hba, { u32 upiu_flags; int ret = 0; - struct utp_transfer_req_desc *req_desc = hba->utrdl; hba->dev_cmd.type = cmd_type; - ufshcd_prepare_req_desc_hdr(req_desc, &upiu_flags, DMA_NONE); + ufshcd_prepare_req_desc_hdr(hba, &upiu_flags, DMA_NONE); switch (cmd_type) { case DEV_CMD_TYPE_QUERY: ufshcd_prepare_utp_query_req_upiu(hba, upiu_flags); @@ -857,7 +883,9 @@ static inline int ufshcd_get_req_rsp(struct utp_upiu_rsp *ucd_rsp_ptr) */ static inline int ufshcd_get_tr_ocs(struct ufs_hba *hba) { - return le32_to_cpu(hba->utrdl->header.dword_2) & MASK_OCS; + struct utp_transfer_req_desc *req_desc = hba->utrdl; + + return le32_to_cpu(req_desc->header.dword_2) & MASK_OCS; } static inline int ufshcd_get_rsp_upiu_result(struct utp_upiu_rsp *ucd_rsp_ptr) @@ -1406,6 +1434,8 @@ void ufshcd_prepare_utp_scsi_cmd_upiu(struct ufs_hba *hba, memcpy(ucd_req_ptr->sc.cdb, pccb->cmd, cdb_len); memset(hba->ucd_rsp_ptr, 0, sizeof(struct utp_upiu_rsp)); + ufshcd_cache_flush_and_invalidate(ucd_req_ptr, sizeof(*ucd_req_ptr)); + ufshcd_cache_flush_and_invalidate(hba->ucd_rsp_ptr, sizeof(*hba->ucd_rsp_ptr)); } static inline void prepare_prdt_desc(struct ufshcd_sg_entry *entry, @@ -1420,6 +1450,7 @@ static void prepare_prdt_table(struct ufs_hba *hba, struct scsi_cmd *pccb) { struct utp_transfer_req_desc *req_desc = hba->utrdl; struct ufshcd_sg_entry *prd_table = hba->ucd_prdt_ptr; + uintptr_t aaddr = (uintptr_t)(pccb->pdata) & ~(ARCH_DMA_MINALIGN - 1); ulong datalen = pccb->datalen; int table_length; u8 *buf; @@ -1427,9 +1458,19 @@ static void prepare_prdt_table(struct ufs_hba *hba, struct scsi_cmd *pccb) if (!datalen) { req_desc->prd_table_length = 0; + ufshcd_cache_flush_and_invalidate(req_desc, sizeof(*req_desc)); return; } + if (pccb->dma_dir == DMA_TO_DEVICE) { /* Write to device */ + flush_dcache_range(aaddr, aaddr + + ALIGN(datalen, ARCH_DMA_MINALIGN)); + } + + /* In any case, invalidate cache to avoid stale data in it. */ + invalidate_dcache_range(aaddr, aaddr + + ALIGN(datalen, ARCH_DMA_MINALIGN)); + table_length = DIV_ROUND_UP(pccb->datalen, MAX_PRDT_ENTRY); buf = pccb->pdata; i = table_length; @@ -1443,17 +1484,18 @@ static void prepare_prdt_table(struct ufs_hba *hba, struct scsi_cmd *pccb) prepare_prdt_desc(&prd_table[table_length - i - 1], buf, datalen - 1); req_desc->prd_table_length = table_length; + ufshcd_cache_flush_and_invalidate(prd_table, sizeof(*prd_table) * table_length); + ufshcd_cache_flush_and_invalidate(req_desc, sizeof(*req_desc)); } static int ufs_scsi_exec(struct udevice *scsi_dev, struct scsi_cmd *pccb) { struct ufs_hba *hba = dev_get_uclass_priv(scsi_dev->parent); - struct utp_transfer_req_desc *req_desc = hba->utrdl; u32 upiu_flags; int ocs, result = 0; u8 scsi_status; - ufshcd_prepare_req_desc_hdr(req_desc, &upiu_flags, pccb->dma_dir); + ufshcd_prepare_req_desc_hdr(hba, &upiu_flags, pccb->dma_dir); ufshcd_prepare_utp_scsi_cmd_upiu(hba, pccb, upiu_flags); prepare_prdt_table(hba, pccb); @@ -1630,8 +1672,13 @@ static int ufshcd_get_max_pwr_mode(struct ufs_hba *hba) if (hba->max_pwr_info.is_valid) return 0; - pwr_info->pwr_tx = FAST_MODE; - pwr_info->pwr_rx = FAST_MODE; + if (hba->quirks & UFSHCD_QUIRK_HIBERN_FASTAUTO) { + pwr_info->pwr_tx = FASTAUTO_MODE; + pwr_info->pwr_rx = FASTAUTO_MODE; + } else { + pwr_info->pwr_tx = FAST_MODE; + pwr_info->pwr_rx = FAST_MODE; + } pwr_info->hs_rate = PA_HS_MODE_B; /* Get the connected lane count */ @@ -1889,13 +1936,16 @@ int ufshcd_probe(struct udevice *ufs_dev, struct ufs_hba_ops *hba_ops) /* Read capabilties registers */ hba->capabilities = ufshcd_readl(hba, REG_CONTROLLER_CAPABILITIES); + if (hba->quirks & UFSHCD_QUIRK_BROKEN_64BIT_ADDRESS) + hba->capabilities &= ~MASK_64_ADDRESSING_SUPPORT; /* Get UFS version supported by the controller */ hba->version = ufshcd_get_ufs_version(hba); if (hba->version != UFSHCI_VERSION_10 && hba->version != UFSHCI_VERSION_11 && hba->version != UFSHCI_VERSION_20 && - hba->version != UFSHCI_VERSION_21) + hba->version != UFSHCI_VERSION_21 && + hba->version != UFSHCI_VERSION_30) dev_err(hba->dev, "invalid UFS version 0x%x\n", hba->version); @@ -1942,8 +1992,31 @@ int ufs_scsi_bind(struct udevice *ufs_dev, struct udevice **scsi_devp) return ret; } +#if IS_ENABLED(CONFIG_BOUNCE_BUFFER) +static int ufs_scsi_buffer_aligned(struct udevice *scsi_dev, struct bounce_buffer *state) +{ +#ifdef CONFIG_PHYS_64BIT + struct ufs_hba *hba = dev_get_uclass_priv(scsi_dev->parent); + uintptr_t ubuf = (uintptr_t)state->user_buffer; + size_t len = state->len_aligned; + + /* Check if below 32bit boundary */ + if ((hba->quirks & UFSHCD_QUIRK_BROKEN_64BIT_ADDRESS) && + ((ubuf >> 32) || (ubuf + len) >> 32)) { + dev_dbg(scsi_dev, "Buffer above 32bit boundary %lx-%lx\n", + ubuf, ubuf + len); + return 0; + } +#endif + return 1; +} +#endif /* CONFIG_BOUNCE_BUFFER */ + static struct scsi_ops ufs_ops = { .exec = ufs_scsi_exec, +#if IS_ENABLED(CONFIG_BOUNCE_BUFFER) + .buffer_aligned = ufs_scsi_buffer_aligned, +#endif /* CONFIG_BOUNCE_BUFFER */ }; int ufs_probe_dev(int index) diff --git a/drivers/ufs/ufs.h b/drivers/ufs/ufs.h index 8a38832..9daaf03 100644 --- a/drivers/ufs/ufs.h +++ b/drivers/ufs/ufs.h @@ -717,7 +717,19 @@ struct ufs_hba { * the LCC transmission on UFS device (by clearing TX_LCC_ENABLE * attribute of device to 0). */ -#define UFSHCD_QUIRK_BROKEN_LCC 0x1 +#define UFSHCD_QUIRK_BROKEN_LCC BIT(0) + +/* + * This quirk needs to be enabled if the host controller has + * 64-bit addressing supported capability but it doesn't work. + */ +#define UFSHCD_QUIRK_BROKEN_64BIT_ADDRESS BIT(1) + +/* + * This quirk needs to be enabled if the host controller has + * auto-hibernate capability but it's FASTAUTO only. + */ +#define UFSHCD_QUIRK_HIBERN_FASTAUTO BIT(2) /* Virtual memory reference */ struct utp_transfer_cmd_desc *ucdl; @@ -769,6 +781,7 @@ enum { UFSHCI_VERSION_11 = 0x00010100, /* 1.1 */ UFSHCI_VERSION_20 = 0x00000200, /* 2.0 */ UFSHCI_VERSION_21 = 0x00000210, /* 2.1 */ + UFSHCI_VERSION_30 = 0x00000300, /* 3.0 */ }; /* Interrupt disable masks */ diff --git a/drivers/usb/cdns3/gadget.c b/drivers/usb/cdns3/gadget.c index cae570c..7aa0c6b 100644 --- a/drivers/usb/cdns3/gadget.c +++ b/drivers/usb/cdns3/gadget.c @@ -62,6 +62,7 @@ #include <linux/bitops.h> #include <linux/delay.h> #include <linux/err.h> +#include <linux/printk.h> #include <linux/usb/gadget.h> #include <linux/compat.h> #include <linux/iopoll.h> diff --git a/drivers/usb/common/common.c b/drivers/usb/common/common.c index cff86a5..7137a56 100644 --- a/drivers/usb/common/common.c +++ b/drivers/usb/common/common.c @@ -9,6 +9,7 @@ #include <common.h> #include <dm.h> #include <asm/global_data.h> +#include <linux/printk.h> #include <linux/usb/otg.h> #include <linux/usb/ch9.h> #include <linux/usb/phy.h> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 49f6a19..7ca9d09 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -986,18 +986,18 @@ void dwc3_uboot_exit(int index) /** * dwc3_uboot_handle_interrupt - handle dwc3 core interrupt - * @index: index of this controller + * @dev: device of this controller * * Invokes dwc3 gadget interrupts. * * Generally called from board file. */ -void dwc3_uboot_handle_interrupt(int index) +void dwc3_uboot_handle_interrupt(struct udevice *dev) { struct dwc3 *dwc = NULL; list_for_each_entry(dwc, &dwc3_list, list) { - if (dwc->index != index) + if (dwc->dev != dev) continue; dwc3_gadget_uboot_handle_interrupt(dwc); diff --git a/drivers/usb/dwc3/dwc3-generic.c b/drivers/usb/dwc3/dwc3-generic.c index 7f0af05..744fde8 100644 --- a/drivers/usb/dwc3/dwc3-generic.c +++ b/drivers/usb/dwc3/dwc3-generic.c @@ -17,6 +17,7 @@ #include <generic-phy.h> #include <linux/bitops.h> #include <linux/delay.h> +#include <linux/printk.h> #include <linux/usb/ch9.h> #include <linux/usb/gadget.h> #include <malloc.h> @@ -541,8 +542,6 @@ int dwc3_glue_probe(struct udevice *dev) } else if (ret != -ENOENT && ret != -ENODATA) { debug("could not get phy (err %d)\n", ret); return ret; - } else { - phy.dev = NULL; } glue->regs = dev_read_addr_size_index(dev, 0, &glue->size); @@ -555,7 +554,7 @@ int dwc3_glue_probe(struct udevice *dev) if (ret) return ret; - if (phy.dev) { + if (generic_phy_valid(&phy)) { ret = generic_phy_power_on(&phy); if (ret) return ret; diff --git a/drivers/usb/dwc3/dwc3-meson-g12a.c b/drivers/usb/dwc3/dwc3-meson-g12a.c index c62e42d..dc5a976 100644 --- a/drivers/usb/dwc3/dwc3-meson-g12a.c +++ b/drivers/usb/dwc3/dwc3-meson-g12a.c @@ -15,6 +15,7 @@ #include <dwc3-uboot.h> #include <generic-phy.h> #include <linux/delay.h> +#include <linux/printk.h> #include <linux/usb/ch9.h> #include <linux/usb/gadget.h> #include <malloc.h> diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c index 9596bf1..ff4ebfb 100644 --- a/drivers/usb/dwc3/dwc3-omap.c +++ b/drivers/usb/dwc3/dwc3-omap.c @@ -119,7 +119,7 @@ #define USBOTGSS_UTMI_OTG_STATUS_VBUSVALID (1 << 1) struct dwc3_omap { - struct device *dev; + struct udevice *dev; void __iomem *base; @@ -429,19 +429,19 @@ void dwc3_omap_uboot_exit(int index) /** * dwc3_omap_uboot_interrupt_status - check the status of interrupt - * @index: index of this controller + * @dev: device of this controller * * Checks the status of interrupts and returns true if an interrupt * is detected or false otherwise. * * Generally called from board file. */ -int dwc3_omap_uboot_interrupt_status(int index) +int dwc3_omap_uboot_interrupt_status(struct udevice *dev) { struct dwc3_omap *omap = NULL; list_for_each_entry(omap, &dwc3_omap_list, list) - if (omap->index == index) + if (omap->dev == dev) return dwc3_omap_interrupt(-1, omap); return 0; diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index eb416b8..68cf32c 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -24,6 +24,7 @@ #include <linux/delay.h> #include <linux/dma-mapping.h> #include <linux/list.h> +#include <linux/printk.h> #include <linux/usb/ch9.h> #include <linux/usb/gadget.h> diff --git a/drivers/usb/eth/mcs7830.c b/drivers/usb/eth/mcs7830.c index 8a256b3..d94204f 100644 --- a/drivers/usb/eth/mcs7830.c +++ b/drivers/usb/eth/mcs7830.c @@ -19,6 +19,7 @@ #include <malloc.h> #include <memalign.h> #include <usb.h> +#include <linux/printk.h> #include "usb_ether.h" diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index 1cfe602..4eccc5e 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig @@ -160,7 +160,7 @@ config USB_GADGET_VBUS_DRAW config SDP_LOADADDR hex "Default load address at SDP_WRITE and SDP_JUMP" - default 0 + default 0x0 # Selected by UDC drivers that support high-speed operation. config USB_GADGET_DUALSPEED diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c index 1feed41..e573a03 100644 --- a/drivers/usb/gadget/at91_udc.c +++ b/drivers/usb/gadget/at91_udc.c @@ -21,6 +21,7 @@ #include <asm/io.h> #include <asm/gpio.h> #include <asm/hardware.h> +#include <linux/printk.h> #include <mach/at91_matrix.h> #include <linux/list.h> #include <linux/usb/ch9.h> @@ -1429,7 +1430,7 @@ static const struct at91_udc_caps at91sam9261_udc_caps = { }; #endif -int usb_gadget_handle_interrupts(int index) +int dm_usb_gadget_handle_interrupts(struct udevice *dev) { struct at91_udc *udc = controller; diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c index 7d51821..f16731c 100644 --- a/drivers/usb/gadget/atmel_usba_udc.c +++ b/drivers/usb/gadget/atmel_usba_udc.c @@ -13,6 +13,7 @@ #include <asm/gpio.h> #include <asm/hardware.h> #include <linux/list.h> +#include <linux/printk.h> #include <linux/usb/ch9.h> #include <linux/usb/gadget.h> #include <linux/usb/atmel_usba_udc.h> @@ -1198,14 +1199,13 @@ static struct usba_udc controller = { }, }; -int usb_gadget_handle_interrupts(int index) +int dm_usb_gadget_handle_interrupts(struct udevice *dev) { struct usba_udc *udc = &controller; return usba_udc_irq(udc); } - int usb_gadget_register_driver(struct usb_gadget_driver *driver) { struct usba_udc *udc = &controller; diff --git a/drivers/usb/gadget/ci_udc.c b/drivers/usb/gadget/ci_udc.c index b9258d7..2bfacfe 100644 --- a/drivers/usb/gadget/ci_udc.c +++ b/drivers/usb/gadget/ci_udc.c @@ -869,10 +869,10 @@ void udc_irq(void) } } -int usb_gadget_handle_interrupts(int index) +int dm_usb_gadget_handle_interrupts(struct udevice *dev) { - u32 value; struct ci_udc *udc = (struct ci_udc *)controller.ctrl->hcor; + u32 value; value = readl(&udc->usbsts); if (value) diff --git a/drivers/usb/gadget/dwc2_udc_otg.c b/drivers/usb/gadget/dwc2_udc_otg.c index 2bf7ed8..27082f5 100644 --- a/drivers/usb/gadget/dwc2_udc_otg.c +++ b/drivers/usb/gadget/dwc2_udc_otg.c @@ -28,6 +28,7 @@ #include <dm/devres.h> #include <linux/bug.h> #include <linux/delay.h> +#include <linux/printk.h> #include <linux/errno.h> #include <linux/list.h> @@ -941,15 +942,12 @@ int dwc2_udc_handle_interrupt(void) return 0; } -#if !CONFIG_IS_ENABLED(DM_USB_GADGET) - -int usb_gadget_handle_interrupts(int index) +int dm_usb_gadget_handle_interrupts(struct udevice *dev) { return dwc2_udc_handle_interrupt(); } -#else /* CONFIG_IS_ENABLED(DM_USB_GADGET) */ - +#if CONFIG_IS_ENABLED(DM_USB_GADGET) struct dwc2_priv_data { struct clk_bulk clks; struct reset_ctl_bulk resets; @@ -957,11 +955,6 @@ struct dwc2_priv_data { struct udevice *usb33d_supply; }; -int dm_usb_gadget_handle_interrupts(struct udevice *dev) -{ - return dwc2_udc_handle_interrupt(); -} - static int dwc2_phy_setup(struct udevice *dev, struct phy_bulk *phys) { int ret; diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c index 5ff06d3..36618f0 100644 --- a/drivers/usb/gadget/ether.c +++ b/drivers/usb/gadget/ether.c @@ -14,6 +14,7 @@ #include <part.h> #include <linux/errno.h> #include <linux/netdevice.h> +#include <linux/printk.h> #include <linux/usb/ch9.h> #include <linux/usb/cdc.h> #include <linux/usb/gadget.h> @@ -1880,8 +1881,10 @@ static void eth_start(struct eth_dev *dev, gfp_t gfp_flags) } } -static int eth_stop(struct eth_dev *dev) +static int eth_stop(struct udevice *udev) { + struct ether_priv *priv = dev_get_priv(udev); + struct eth_dev *dev = &priv->ethdev; #ifdef RNDIS_COMPLETE_SIGNAL_DISCONNECT unsigned long ts; unsigned long timeout = CONFIG_SYS_HZ; /* 1 sec to stop RNDIS */ @@ -1895,7 +1898,7 @@ static int eth_stop(struct eth_dev *dev) /* Wait until host receives OID_GEN_MEDIA_CONNECT_STATUS */ ts = get_timer(0); while (get_timer(ts) < timeout) - usb_gadget_handle_interrupts(0); + dm_usb_gadget_handle_interrupts(udev->parent); #endif rndis_uninit(dev->rndis_config); @@ -2300,7 +2303,7 @@ static int usb_eth_start(struct udevice *udev) pr_err("The remote end did not respond in time."); goto fail; } - usb_gadget_handle_interrupts(0); + dm_usb_gadget_handle_interrupts(udev->parent); } packet_received = 0; @@ -2370,7 +2373,7 @@ static int usb_eth_send(struct udevice *udev, void *packet, int length) printf("timeout sending packets to usb ethernet\n"); return -1; } - usb_gadget_handle_interrupts(0); + dm_usb_gadget_handle_interrupts(udev->parent); } free(rndis_pkt); @@ -2400,13 +2403,13 @@ static void usb_eth_stop(struct udevice *udev) * 2) 'pullup' callback in your UDC driver can be improved to perform * this deinitialization. */ - eth_stop(dev); + eth_stop(udev); usb_gadget_disconnect(dev->gadget); /* Clear pending interrupt */ if (dev->network_started) { - usb_gadget_handle_interrupts(0); + dm_usb_gadget_handle_interrupts(udev->parent); dev->network_started = 0; } } @@ -2416,7 +2419,7 @@ static int usb_eth_recv(struct udevice *dev, int flags, uchar **packetp) struct ether_priv *priv = dev_get_priv(dev); struct eth_dev *ethdev = &priv->ethdev; - usb_gadget_handle_interrupts(0); + dm_usb_gadget_handle_interrupts(dev->parent); if (packet_received) { if (ethdev->rx_req) { @@ -2467,7 +2470,7 @@ int usb_ether_init(void) return ret; } - return usb_gadget_initialize(0); + return 0; } static int usb_eth_probe(struct udevice *dev) @@ -2528,7 +2531,7 @@ static int usb_eth_remove(struct udevice *dev) static int usb_eth_unbind(struct udevice *dev) { - usb_gadget_release(0); + udc_device_put(dev->parent); return 0; } diff --git a/drivers/usb/gadget/f_acm.c b/drivers/usb/gadget/f_acm.c index b2ddd1a..de42e01 100644 --- a/drivers/usb/gadget/f_acm.c +++ b/drivers/usb/gadget/f_acm.c @@ -51,7 +51,7 @@ struct f_acm { #define ACM_CTRL_RTS BIT(1) /* unused with full duplex */ #define ACM_CTRL_DTR BIT(0) /* host is ready for data r/w */ - int controller_index; + struct udevice *udc; }; static struct f_acm *default_acm_function; @@ -489,7 +489,7 @@ static void __acm_tx(struct f_acm *f_acm) int len, ret; do { - usb_gadget_handle_interrupts(f_acm->controller_index); + dm_usb_gadget_handle_interrupts(f_acm->udc); if (!(f_acm->handshake_bits & ACM_CTRL_DTR)) break; @@ -520,7 +520,7 @@ static bool acm_connected(struct stdio_dev *dev) struct f_acm *f_acm = stdio_to_acm(dev); /* give a chance to process udc irq */ - usb_gadget_handle_interrupts(f_acm->controller_index); + dm_usb_gadget_handle_interrupts(f_acm->udc); return f_acm->connected; } @@ -543,7 +543,10 @@ static int acm_add(struct usb_configuration *c) f_acm->usb_function.descriptors = acm_fs_function; f_acm->usb_function.hs_descriptors = acm_hs_function; f_acm->usb_function.setup = acm_setup; - f_acm->controller_index = 0; + + status = udc_device_get_by_index(0, &f_acm->udc); + if (status) + return status; status = usb_add_function(c, &f_acm->usb_function); if (status) { @@ -567,7 +570,7 @@ static int acm_stdio_tstc(struct stdio_dev *dev) { struct f_acm *f_acm = stdio_to_acm(dev); - usb_gadget_handle_interrupts(f_acm->controller_index); + dm_usb_gadget_handle_interrupts(f_acm->udc); return (f_acm->rx_buf.size > 0); } diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c index 6d97b4b..741775a 100644 --- a/drivers/usb/gadget/f_fastboot.c +++ b/drivers/usb/gadget/f_fastboot.c @@ -17,6 +17,7 @@ #include <fastboot.h> #include <log.h> #include <malloc.h> +#include <linux/printk.h> #include <linux/usb/ch9.h> #include <linux/usb/gadget.h> #include <linux/usb/composite.h> diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c index f46829e..1d17331 100644 --- a/drivers/usb/gadget/f_mass_storage.c +++ b/drivers/usb/gadget/f_mass_storage.c @@ -435,7 +435,7 @@ static void set_bulk_out_req_length(struct fsg_common *common, static struct ums *ums; static int ums_count; static struct fsg_common *the_fsg_common; -static unsigned int controller_index; +static struct udevice *udcdev; static int fsg_set_halt(struct fsg_dev *fsg, struct usb_ep *ep) { @@ -680,7 +680,7 @@ static int sleep_thread(struct fsg_common *common) k = 0; } - usb_gadget_handle_interrupts(controller_index); + dm_usb_gadget_handle_interrupts(udcdev); } common->thread_wakeup_needed = 0; return rc; @@ -2764,11 +2764,11 @@ int fsg_add(struct usb_configuration *c) return fsg_bind_config(c->cdev, c, fsg_common); } -int fsg_init(struct ums *ums_devs, int count, unsigned int controller_idx) +int fsg_init(struct ums *ums_devs, int count, struct udevice *udc) { ums = ums_devs; ums_count = count; - controller_index = controller_idx; + udcdev = udc; return 0; } diff --git a/drivers/usb/gadget/f_sdp.c b/drivers/usb/gadget/f_sdp.c index 4da5a16..2b3a9c5 100644 --- a/drivers/usb/gadget/f_sdp.c +++ b/drivers/usb/gadget/f_sdp.c @@ -22,6 +22,7 @@ #include <env.h> #include <log.h> #include <malloc.h> +#include <linux/printk.h> #include <linux/usb/ch9.h> #include <linux/usb/gadget.h> @@ -702,7 +703,7 @@ static int sdp_bind_config(struct usb_configuration *c) return status; } -int sdp_init(int controller_index) +int sdp_init(struct udevice *udc) { printf("SDP: initialize...\n"); while (!sdp_func->configuration_done) { @@ -712,7 +713,7 @@ int sdp_init(int controller_index) } schedule(); - usb_gadget_handle_interrupts(controller_index); + dm_usb_gadget_handle_interrupts(udc); } return 0; @@ -911,9 +912,9 @@ static void sdp_handle_out_ep(void) } #ifndef CONFIG_SPL_BUILD -int sdp_handle(int controller_index) +int sdp_handle(struct udevice *udc) #else -int spl_sdp_handle(int controller_index, struct spl_image_info *spl_image, +int spl_sdp_handle(struct udevice *udc, struct spl_image_info *spl_image, struct spl_boot_device *bootdev) #endif { @@ -929,7 +930,7 @@ int spl_sdp_handle(int controller_index, struct spl_image_info *spl_image, return 0; schedule(); - usb_gadget_handle_interrupts(controller_index); + dm_usb_gadget_handle_interrupts(udc); #ifdef CONFIG_SPL_BUILD flag = sdp_handle_in_ep(spl_image, bootdev); diff --git a/drivers/usb/gadget/f_thor.c b/drivers/usb/gadget/f_thor.c index 47ef55b..0e7529d 100644 --- a/drivers/usb/gadget/f_thor.c +++ b/drivers/usb/gadget/f_thor.c @@ -15,15 +15,17 @@ */ #include <command.h> -#include <errno.h> #include <common.h> #include <console.h> +#include <dm.h> +#include <errno.h> #include <init.h> #include <log.h> #include <malloc.h> #include <memalign.h> #include <version.h> #include <linux/delay.h> +#include <linux/printk.h> #include <linux/usb/ch9.h> #include <linux/usb/gadget.h> #include <linux/usb/composite.h> @@ -34,9 +36,9 @@ #include "f_thor.h" -static void thor_tx_data(unsigned char *data, int len); +static void thor_tx_data(struct udevice *udc, unsigned char *data, int len); static void thor_set_dma(void *addr, int len); -static int thor_rx_data(void); +static int thor_rx_data(struct udevice *udc); static struct f_thor *thor_func; static inline struct f_thor *func_to_thor(struct usb_function *f) @@ -56,15 +58,15 @@ DEFINE_CACHE_ALIGN_BUFFER(char, f_name, F_NAME_BUF_SIZE + 1); static unsigned long long int thor_file_size; static int alt_setting_num; -static void send_rsp(const struct rsp_box *rsp) +static void send_rsp(struct udevice *udc, const struct rsp_box *rsp) { memcpy(thor_tx_data_buf, rsp, sizeof(struct rsp_box)); - thor_tx_data(thor_tx_data_buf, sizeof(struct rsp_box)); + thor_tx_data(udc, thor_tx_data_buf, sizeof(struct rsp_box)); debug("-RSP: %d, %d\n", rsp->rsp, rsp->rsp_data); } -static void send_data_rsp(s32 ack, s32 count) +static void send_data_rsp(struct udevice *udc, s32 ack, s32 count) { ALLOC_CACHE_ALIGN_BUFFER(struct data_rsp_box, rsp, sizeof(struct data_rsp_box)); @@ -73,12 +75,12 @@ static void send_data_rsp(s32 ack, s32 count) rsp->count = count; memcpy(thor_tx_data_buf, rsp, sizeof(struct data_rsp_box)); - thor_tx_data(thor_tx_data_buf, sizeof(struct data_rsp_box)); + thor_tx_data(udc, thor_tx_data_buf, sizeof(struct data_rsp_box)); debug("-DATA RSP: %d, %d\n", ack, count); } -static int process_rqt_info(const struct rqt_box *rqt) +static int process_rqt_info(struct udevice *udc, const struct rqt_box *rqt) { ALLOC_CACHE_ALIGN_BUFFER(struct rsp_box, rsp, sizeof(struct rsp_box)); memset(rsp, 0, sizeof(struct rsp_box)); @@ -111,11 +113,11 @@ static int process_rqt_info(const struct rqt_box *rqt) return -EINVAL; } - send_rsp(rsp); + send_rsp(udc, rsp); return true; } -static int process_rqt_cmd(const struct rqt_box *rqt) +static int process_rqt_cmd(struct udevice *udc, const struct rqt_box *rqt) { ALLOC_CACHE_ALIGN_BUFFER(struct rsp_box, rsp, sizeof(struct rsp_box)); memset(rsp, 0, sizeof(struct rsp_box)); @@ -126,7 +128,7 @@ static int process_rqt_cmd(const struct rqt_box *rqt) switch (rqt->rqt_data) { case RQT_CMD_REBOOT: debug("TARGET RESET\n"); - send_rsp(rsp); + send_rsp(udc, rsp); g_dnl_unregister(); dfu_free_entities(); #ifdef CONFIG_THOR_RESET_OFF @@ -136,7 +138,7 @@ static int process_rqt_cmd(const struct rqt_box *rqt) break; case RQT_CMD_POWEROFF: case RQT_CMD_EFSCLEAR: - send_rsp(rsp); + send_rsp(udc, rsp); default: printf("Command not supported -> cmd: %d\n", rqt->rqt_data); return -EINVAL; @@ -145,7 +147,8 @@ static int process_rqt_cmd(const struct rqt_box *rqt) return true; } -static long long int download_head(unsigned long long total, +static long long int download_head(struct udevice *udc, + unsigned long long total, unsigned int packet_size, long long int *left, int *cnt) @@ -166,7 +169,7 @@ static long long int download_head(unsigned long long total, while (total - rcv_cnt >= packet_size) { thor_set_dma(buf, packet_size); buf += packet_size; - ret_rcv = thor_rx_data(); + ret_rcv = thor_rx_data(udc); if (ret_rcv < 0) return ret_rcv; rcv_cnt += ret_rcv; @@ -184,7 +187,7 @@ static long long int download_head(unsigned long long total, } buf = transfer_buffer; } - send_data_rsp(0, ++usb_pkt_cnt); + send_data_rsp(udc, 0, ++usb_pkt_cnt); } /* Calculate the amount of data to arrive from PC (in bytes) */ @@ -200,11 +203,11 @@ static long long int download_head(unsigned long long total, if (left_to_rcv) { thor_set_dma(buf, packet_size); - ret_rcv = thor_rx_data(); + ret_rcv = thor_rx_data(udc); if (ret_rcv < 0) return ret_rcv; rcv_cnt += ret_rcv; - send_data_rsp(0, ++usb_pkt_cnt); + send_data_rsp(udc, 0, ++usb_pkt_cnt); } debug("%s: %llu total: %llu cnt: %d\n", __func__, rcv_cnt, total, *cnt); @@ -254,7 +257,7 @@ static int download_tail(long long int left, int cnt) return ret; } -static long long int process_rqt_download(const struct rqt_box *rqt) +static long long int process_rqt_download(struct udevice *udc, const struct rqt_box *rqt) { ALLOC_CACHE_ALIGN_BUFFER(struct rsp_box, rsp, sizeof(struct rsp_box)); static long long int left, ret_head; @@ -301,8 +304,8 @@ static long long int process_rqt_download(const struct rqt_box *rqt) } break; case RQT_DL_FILE_START: - send_rsp(rsp); - ret_head = download_head(thor_file_size, THOR_PACKET_SIZE, + send_rsp(udc, rsp); + ret_head = download_head(udc, thor_file_size, THOR_PACKET_SIZE, &left, &cnt); if (ret_head < 0) { left = 0; @@ -324,11 +327,11 @@ static long long int process_rqt_download(const struct rqt_box *rqt) ret = -ENOTSUPP; } - send_rsp(rsp); + send_rsp(udc, rsp); return ret; } -static int process_data(void) +static int process_data(struct udevice *udc) { ALLOC_CACHE_ALIGN_BUFFER(struct rqt_box, rqt, sizeof(struct rqt_box)); int ret = -EINVAL; @@ -339,13 +342,13 @@ static int process_data(void) switch (rqt->rqt) { case RQT_INFO: - ret = process_rqt_info(rqt); + ret = process_rqt_info(udc, rqt); break; case RQT_CMD: - ret = process_rqt_cmd(rqt); + ret = process_rqt_cmd(udc, rqt); break; case RQT_DL: - ret = (int) process_rqt_download(rqt); + ret = (int) process_rqt_download(udc, rqt); break; case RQT_UL: puts("RQT: UPLOAD not supported!\n"); @@ -536,7 +539,7 @@ static struct usb_request *alloc_ep_req(struct usb_ep *ep, unsigned length) return req; } -static int thor_rx_data(void) +static int thor_rx_data(struct udevice *udc) { struct thor_dev *dev = thor_func->dev; int data_to_rx, tmp, status; @@ -557,7 +560,7 @@ static int thor_rx_data(void) } while (!dev->rxdata) { - usb_gadget_handle_interrupts(0); + dm_usb_gadget_handle_interrupts(udc); if (ctrlc()) return -1; } @@ -568,7 +571,7 @@ static int thor_rx_data(void) return tmp; } -static void thor_tx_data(unsigned char *data, int len) +static void thor_tx_data(struct udevice *udc, unsigned char *data, int len) { struct thor_dev *dev = thor_func->dev; unsigned char *ptr = dev->in_req->buf; @@ -591,7 +594,7 @@ static void thor_tx_data(unsigned char *data, int len) /* Wait until tx interrupt received */ while (!dev->txdata) - usb_gadget_handle_interrupts(0); + dm_usb_gadget_handle_interrupts(udc); dev->txdata = 0; } @@ -685,18 +688,18 @@ static void thor_set_dma(void *addr, int len) dev->out_req->length = len; } -int thor_init(void) +int thor_init(struct udevice *udc) { struct thor_dev *dev = thor_func->dev; /* Wait for a device enumeration and configuration settings */ debug("THOR enumeration/configuration setting....\n"); while (!dev->configuration_done) - usb_gadget_handle_interrupts(0); + dm_usb_gadget_handle_interrupts(udc); thor_set_dma(thor_rx_data_buf, strlen("THOR")); /* detect the download request from Host PC */ - if (thor_rx_data() < 0) { + if (thor_rx_data(udc) < 0) { printf("%s: Data not received!\n", __func__); return -1; } @@ -706,7 +709,7 @@ int thor_init(void) udelay(30 * 1000); /* 30 ms */ strcpy((char *)thor_tx_data_buf, "ROHT"); - thor_tx_data(thor_tx_data_buf, strlen("ROHT")); + thor_tx_data(udc, thor_tx_data_buf, strlen("ROHT")); } else { puts("Wrong reply information\n"); return -1; @@ -715,17 +718,17 @@ int thor_init(void) return 0; } -int thor_handle(void) +int thor_handle(struct udevice *udc) { int ret; /* receive the data from Host PC */ while (1) { thor_set_dma(thor_rx_data_buf, sizeof(struct rqt_box)); - ret = thor_rx_data(); + ret = thor_rx_data(udc); if (ret > 0) { - ret = process_data(); + ret = process_data(udc); #ifdef CONFIG_THOR_RESET_OFF if (ret == RESET_DONE) break; diff --git a/drivers/usb/gadget/udc/Makefile b/drivers/usb/gadget/udc/Makefile index 95dbf0c..467c566 100644 --- a/drivers/usb/gadget/udc/Makefile +++ b/drivers/usb/gadget/udc/Makefile @@ -7,4 +7,4 @@ obj-$(CONFIG_USB_DWC3_GADGET) += udc-core.o endif obj-$(CONFIG_$(SPL_)DM_USB_GADGET) += udc-core.o -obj-$(CONFIG_$(SPL_)DM) += udc-uclass.o +obj-y += udc-uclass.o diff --git a/drivers/usb/gadget/udc/udc-uclass.c b/drivers/usb/gadget/udc/udc-uclass.c index de88618..3e43312 100644 --- a/drivers/usb/gadget/udc/udc-uclass.c +++ b/drivers/usb/gadget/udc/udc-uclass.c @@ -9,58 +9,58 @@ #include <common.h> #include <dm.h> #include <dm/device-internal.h> +#include <linux/printk.h> #include <linux/usb/gadget.h> #if CONFIG_IS_ENABLED(DM_USB_GADGET) -#define MAX_UDC_DEVICES 4 -static struct udevice *dev_array[MAX_UDC_DEVICES]; -int usb_gadget_initialize(int index) +int udc_device_get_by_index(int index, struct udevice **udev) { - int ret; struct udevice *dev = NULL; + int ret; - if (index < 0 || index >= ARRAY_SIZE(dev_array)) - return -EINVAL; - if (dev_array[index]) - return 0; ret = uclass_get_device_by_seq(UCLASS_USB_GADGET_GENERIC, index, &dev); - if (!dev || ret) { - ret = uclass_get_device(UCLASS_USB_GADGET_GENERIC, index, &dev); - if (!dev || ret) { - pr_err("No USB device found\n"); - return -ENODEV; - } + if (!ret && dev) { + *udev = dev; + return 0; + } + + ret = uclass_get_device(UCLASS_USB_GADGET_GENERIC, index, &dev); + if (!ret && dev) { + *udev = dev; + return 0; } - dev_array[index] = dev; - return 0; + + pr_err("No USB device found\n"); + return -ENODEV; } -int usb_gadget_release(int index) +int udc_device_put(struct udevice *udev) { #if CONFIG_IS_ENABLED(DM_DEVICE_REMOVE) - int ret; - if (index < 0 || index >= ARRAY_SIZE(dev_array)) - return -EINVAL; - - ret = device_remove(dev_array[index], DM_REMOVE_NORMAL); - if (!ret) - dev_array[index] = NULL; - return ret; + return device_remove(udev, DM_REMOVE_NORMAL); #else return -ENOSYS; #endif } +#else +/* Backwards hardware compatibility -- switch to DM_USB_GADGET */ +static int legacy_index; +int udc_device_get_by_index(int index, struct udevice **udev) +{ + legacy_index = index; + return board_usb_init(index, USB_INIT_DEVICE); +} -int usb_gadget_handle_interrupts(int index) +int udc_device_put(struct udevice *udev) { - if (index < 0 || index >= ARRAY_SIZE(dev_array)) - return -EINVAL; - return dm_usb_gadget_handle_interrupts(dev_array[index]); + return board_usb_cleanup(legacy_index, USB_INIT_DEVICE); } #endif +#if CONFIG_IS_ENABLED(DM) UCLASS_DRIVER(usb_gadget_generic) = { .id = UCLASS_USB_GADGET_GENERIC, .name = "usb", .flags = DM_UC_FLAG_SEQ_ALIAS, }; +#endif diff --git a/drivers/usb/host/dwc2.c b/drivers/usb/host/dwc2.c index 9818f9b..637eb2d 100644 --- a/drivers/usb/host/dwc2.c +++ b/drivers/usb/host/dwc2.c @@ -194,8 +194,8 @@ static int dwc_vbus_supply_init(struct udevice *dev) return 0; } - ret = regulator_set_enable(priv->vbus_supply, true); - if (ret) { + ret = regulator_set_enable_if_allowed(priv->vbus_supply, true); + if (ret && ret != -ENOSYS) { dev_err(dev, "Error enabling vbus supply\n"); return ret; } @@ -208,12 +208,10 @@ static int dwc_vbus_supply_exit(struct udevice *dev) struct dwc2_priv *priv = dev_get_priv(dev); int ret; - if (priv->vbus_supply) { - ret = regulator_set_enable(priv->vbus_supply, false); - if (ret) { - dev_err(dev, "Error disabling vbus supply\n"); - return ret; - } + ret = regulator_set_enable_if_allowed(priv->vbus_supply, false); + if (ret && ret != -ENOSYS) { + dev_err(dev, "Error disabling vbus supply\n"); + return ret; } return 0; diff --git a/drivers/usb/host/dwc3-sti-glue.c b/drivers/usb/host/dwc3-sti-glue.c index 239b671..4a3ab61 100644 --- a/drivers/usb/host/dwc3-sti-glue.c +++ b/drivers/usb/host/dwc3-sti-glue.c @@ -17,6 +17,7 @@ #include <reset-uclass.h> #include <syscon.h> #include <usb.h> +#include <linux/printk.h> #include <linux/usb/dwc3.h> #include <linux/usb/otg.h> diff --git a/drivers/usb/host/ehci-generic.c b/drivers/usb/host/ehci-generic.c index a765a30..936e304 100644 --- a/drivers/usb/host/ehci-generic.c +++ b/drivers/usb/host/ehci-generic.c @@ -39,14 +39,10 @@ static int ehci_enable_vbus_supply(struct udevice *dev) if (ret && ret != -ENOENT) return ret; - if (priv->vbus_supply) { - ret = regulator_set_enable(priv->vbus_supply, true); - if (ret) { - dev_err(dev, "Error enabling VBUS supply (ret=%d)\n", ret); - return ret; - } - } else { - dev_dbg(dev, "No vbus supply\n"); + ret = regulator_set_enable_if_allowed(priv->vbus_supply, true); + if (ret && ret != -ENOSYS) { + dev_err(dev, "Error enabling VBUS supply (ret=%d)\n", ret); + return ret; } return 0; @@ -54,10 +50,13 @@ static int ehci_enable_vbus_supply(struct udevice *dev) static int ehci_disable_vbus_supply(struct generic_ehci *priv) { - if (priv->vbus_supply) - return regulator_set_enable(priv->vbus_supply, false); - else - return 0; + int ret; + + ret = regulator_set_enable_if_allowed(priv->vbus_supply, false); + if (ret && ret != -ENOSYS) + return ret; + + return 0; } static int ehci_usb_probe(struct udevice *dev) diff --git a/drivers/usb/host/ohci-generic.c b/drivers/usb/host/ohci-generic.c index 2d8d38c..ceed191 100644 --- a/drivers/usb/host/ohci-generic.c +++ b/drivers/usb/host/ohci-generic.c @@ -16,75 +16,41 @@ struct generic_ohci { ohci_t ohci; - struct clk *clocks; /* clock list */ - struct reset_ctl *resets; /* reset list */ + struct clk_bulk clocks; /* clock list */ + struct reset_ctl_bulk resets; /* reset list */ struct phy phy; - int clock_count; /* number of clock in clock list */ - int reset_count; /* number of reset in reset list */ }; static int ohci_usb_probe(struct udevice *dev) { struct ohci_regs *regs = dev_read_addr_ptr(dev); struct generic_ohci *priv = dev_get_priv(dev); - int i, err, ret, clock_nb, reset_nb; - - err = 0; - priv->clock_count = 0; - clock_nb = dev_count_phandle_with_args(dev, "clocks", "#clock-cells", - 0); - if (clock_nb > 0) { - priv->clocks = devm_kcalloc(dev, clock_nb, sizeof(struct clk), - GFP_KERNEL); - if (!priv->clocks) - return -ENOMEM; - - for (i = 0; i < clock_nb; i++) { - err = clk_get_by_index(dev, i, &priv->clocks[i]); - if (err < 0) - break; - - err = clk_enable(&priv->clocks[i]); - if (err && err != -ENOSYS) { - dev_err(dev, "failed to enable clock %d\n", i); - clk_free(&priv->clocks[i]); - goto clk_err; - } - priv->clock_count++; - } - } else if (clock_nb != -ENOENT) { - dev_err(dev, "failed to get clock phandle(%d)\n", clock_nb); - return clock_nb; + int err, ret; + + ret = clk_get_bulk(dev, &priv->clocks); + if (ret && ret != -ENOENT) { + dev_err(dev, "Failed to get clocks (ret=%d)\n", ret); + return ret; + } + + err = clk_enable_bulk(&priv->clocks); + if (err) { + dev_err(dev, "Failed to enable clocks (err=%d)\n", err); + goto clk_err; } - priv->reset_count = 0; - reset_nb = dev_count_phandle_with_args(dev, "resets", "#reset-cells", - 0); - if (reset_nb > 0) { - priv->resets = devm_kcalloc(dev, reset_nb, - sizeof(struct reset_ctl), - GFP_KERNEL); - if (!priv->resets) - return -ENOMEM; - - for (i = 0; i < reset_nb; i++) { - err = reset_get_by_index(dev, i, &priv->resets[i]); - if (err < 0) - break; - - err = reset_deassert(&priv->resets[i]); - if (err) { - dev_err(dev, "failed to deassert reset %d\n", i); - reset_free(&priv->resets[i]); - goto reset_err; - } - priv->reset_count++; - } - } else if (reset_nb != -ENOENT) { - dev_err(dev, "failed to get reset phandle(%d)\n", reset_nb); + err = reset_get_bulk(dev, &priv->resets); + if (err && err != -ENOENT) { + dev_err(dev, "failed to get resets (err=%d)\n", err); goto clk_err; } + err = reset_deassert_bulk(&priv->resets); + if (err) { + dev_err(dev, "failed to deassert resets (err=%d)\n", err); + goto reset_err; + } + err = generic_setup_phy(dev, &priv->phy, 0); if (err) goto reset_err; @@ -101,13 +67,13 @@ phy_err: dev_err(dev, "failed to shutdown usb phy\n"); reset_err: - ret = reset_release_all(priv->resets, priv->reset_count); + ret = reset_release_bulk(&priv->resets); if (ret) - dev_err(dev, "failed to assert all resets\n"); + dev_err(dev, "failed to release resets (ret=%d)\n", ret); clk_err: - ret = clk_release_all(priv->clocks, priv->clock_count); + ret = clk_release_bulk(&priv->clocks); if (ret) - dev_err(dev, "failed to disable all clocks\n"); + dev_err(dev, "failed to release clocks (ret=%d)\n", ret); return err; } @@ -125,11 +91,11 @@ static int ohci_usb_remove(struct udevice *dev) if (ret) return ret; - ret = reset_release_all(priv->resets, priv->reset_count); + ret = reset_release_bulk(&priv->resets); if (ret) return ret; - return clk_release_all(priv->clocks, priv->clock_count); + return clk_release_bulk(&priv->clocks); } static const struct udevice_id ohci_usb_ids[] = { diff --git a/drivers/usb/host/usb-sandbox.c b/drivers/usb/host/usb-sandbox.c index d1103dc..3d4f8d6 100644 --- a/drivers/usb/host/usb-sandbox.c +++ b/drivers/usb/host/usb-sandbox.c @@ -124,11 +124,12 @@ static int sandbox_submit_int(struct udevice *bus, struct usb_device *udev, return ret; } -int usb_gadget_handle_interrupts(int index) +#if CONFIG_IS_ENABLED(DM_USB_GADGET) +int dm_usb_gadget_handle_interrupts(struct udevice *dev) { return 0; } - +#else int usb_gadget_register_driver(struct usb_gadget_driver *driver) { struct sandbox_udc *dev = this_controller; @@ -144,6 +145,7 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) return 0; } +#endif static int sandbox_alloc_device(struct udevice *dev, struct usb_device *udev) { diff --git a/drivers/usb/host/usb-uclass.c b/drivers/usb/host/usb-uclass.c index 7a03435..a1cd0ad 100644 --- a/drivers/usb/host/usb-uclass.c +++ b/drivers/usb/host/usb-uclass.c @@ -9,6 +9,7 @@ #define LOG_CATEGORY UCLASS_USB #include <common.h> +#include <bootdev.h> #include <dm.h> #include <errno.h> #include <log.h> @@ -208,6 +209,13 @@ int usb_stop(void) #ifdef CONFIG_USB_STORAGE usb_stor_reset(); #endif + if (CONFIG_IS_ENABLED(BOOTSTD)) { + int ret; + + ret = bootdev_unhunt(UCLASS_USB); + if (IS_ENABLED(CONFIG_BOOTSTD_FULL) && ret && ret != -EALREADY) + printf("failed to unhunt USB (err=%dE)\n", ret); + } uc_priv->companion_device_count = 0; usb_started = 0; @@ -249,6 +257,37 @@ static void remove_inactive_children(struct uclass *uc, struct udevice *bus) } } +static int usb_probe_companion(struct udevice *bus) +{ + struct udevice *companion_dev; + int ret; + + /* + * Enforce optional companion controller is marked as such in order to + * 1st scan the primary controller, before the companion controller + * (ownership is given to companion when low or full speed devices + * have been detected). + */ + ret = uclass_get_device_by_phandle(UCLASS_USB, bus, "companion", &companion_dev); + if (!ret) { + struct usb_bus_priv *companion_bus_priv; + + debug("%s is the companion of %s\n", companion_dev->name, bus->name); + companion_bus_priv = dev_get_uclass_priv(companion_dev); + companion_bus_priv->companion = true; + } else if (ret && ret != -ENOENT && ret != -ENODEV) { + /* + * Treat everything else than no companion or disabled + * companion as an error. (It may not be enabled on boards + * that have a High-Speed HUB to handle FS and LS traffic). + */ + printf("Failed to get companion (ret=%d)\n", ret); + return ret; + } + + return 0; +} + int usb_init(void) { int controllers_initialized = 0; @@ -299,6 +338,11 @@ int usb_init(void) printf("probe failed, error %d\n", ret); continue; } + + ret = usb_probe_companion(bus); + if (ret) + continue; + controllers_initialized++; usb_started = true; } diff --git a/drivers/usb/musb-new/mt85xx.c b/drivers/usb/musb-new/mt85xx.c index 730045c..1e632dc 100644 --- a/drivers/usb/musb-new/mt85xx.c +++ b/drivers/usb/musb-new/mt85xx.c @@ -16,6 +16,7 @@ #include <dm/lists.h> #include <dm/root.h> #include <linux/delay.h> +#include <linux/printk.h> #include <linux/usb/musb.h> #include <usb.h> #include "linux-compat.h" diff --git a/drivers/usb/musb-new/musb_core.c b/drivers/usb/musb-new/musb_core.c index a42d98e..00da554 100644 --- a/drivers/usb/musb-new/musb_core.c +++ b/drivers/usb/musb-new/musb_core.c @@ -86,6 +86,7 @@ #include <linux/bitops.h> #include <linux/bug.h> #include <linux/errno.h> +#include <linux/printk.h> #include <linux/usb/ch9.h> #include <linux/usb/gadget.h> #include <linux/usb/musb.h> diff --git a/drivers/usb/musb-new/musb_debug.h b/drivers/usb/musb-new/musb_debug.h index c468bda..94375b7 100644 --- a/drivers/usb/musb-new/musb_debug.h +++ b/drivers/usb/musb-new/musb_debug.h @@ -10,6 +10,7 @@ #ifndef __MUSB_LINUX_DEBUG_H__ #define __MUSB_LINUX_DEBUG_H__ +#include <linux/printk.h> #define yprintk(facility, format, args...) \ do { printk(facility "%s %d: " format , \ __func__, __LINE__ , ## args); } while (0) diff --git a/drivers/usb/musb-new/musb_dsps.c b/drivers/usb/musb-new/musb_dsps.c index d55a920..a8ff743 100644 --- a/drivers/usb/musb-new/musb_dsps.c +++ b/drivers/usb/musb-new/musb_dsps.c @@ -35,6 +35,7 @@ #include <dm.h> #include <dm/device_compat.h> #include <asm/omap_musb.h> +#include <linux/printk.h> #include "linux-compat.h" #endif diff --git a/drivers/usb/musb-new/musb_gadget.c b/drivers/usb/musb-new/musb_gadget.c index 05bd948..c608396 100644 --- a/drivers/usb/musb-new/musb_gadget.c +++ b/drivers/usb/musb-new/musb_gadget.c @@ -26,6 +26,7 @@ #include <dm.h> #include <dm/device_compat.h> #include <linux/bug.h> +#include <linux/printk.h> #include <linux/usb/ch9.h> #include "linux-compat.h" #endif diff --git a/drivers/usb/musb-new/musb_gadget_ep0.c b/drivers/usb/musb-new/musb_gadget_ep0.c index 7fdd240..55ce8de 100644 --- a/drivers/usb/musb-new/musb_gadget_ep0.c +++ b/drivers/usb/musb-new/musb_gadget_ep0.c @@ -21,6 +21,7 @@ #include <common.h> #include <dm.h> #include <dm/device_compat.h> +#include <linux/printk.h> #include <asm/processor.h> #include "linux-compat.h" #endif diff --git a/drivers/usb/musb-new/musb_uboot.c b/drivers/usb/musb-new/musb_uboot.c index 62c5e8e..7cea9a2 100644 --- a/drivers/usb/musb-new/musb_uboot.c +++ b/drivers/usb/musb-new/musb_uboot.c @@ -376,7 +376,7 @@ struct dm_usb_ops musb_usb_ops = { #if defined(CONFIG_USB_MUSB_GADGET) && !CONFIG_IS_ENABLED(DM_USB_GADGET) static struct musb *gadget; -int usb_gadget_handle_interrupts(int index) +int dm_usb_gadget_handle_interrupts(struct udevice *dev) { schedule(); if (!gadget || !gadget->isr) diff --git a/drivers/usb/musb-new/omap2430.c b/drivers/usb/musb-new/omap2430.c index 482dfdc..308eff8 100644 --- a/drivers/usb/musb-new/omap2430.c +++ b/drivers/usb/musb-new/omap2430.c @@ -16,6 +16,7 @@ #include <dm/device_compat.h> #include <dm/lists.h> #include <linux/err.h> +#include <linux/printk.h> #include <linux/usb/otg.h> #include <asm/global_data.h> #include <asm/omap_common.h> diff --git a/drivers/usb/musb-new/sunxi.c b/drivers/usb/musb-new/sunxi.c index 485b9dc..91f082f 100644 --- a/drivers/usb/musb-new/sunxi.c +++ b/drivers/usb/musb-new/sunxi.c @@ -30,6 +30,7 @@ #include <dm/root.h> #include <linux/bitops.h> #include <linux/delay.h> +#include <linux/printk.h> #include <linux/usb/musb.h> #include "linux-compat.h" #include "musb_core.h" diff --git a/drivers/usb/musb-new/ti-musb.c b/drivers/usb/musb-new/ti-musb.c index 3be3f93..ed5e519 100644 --- a/drivers/usb/musb-new/ti-musb.c +++ b/drivers/usb/musb-new/ti-musb.c @@ -12,6 +12,7 @@ #include <log.h> #include <malloc.h> #include <asm/global_data.h> +#include <linux/printk.h> #include <linux/usb/otg.h> #include <dm/device-internal.h> #include <dm/lists.h> diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index 69f4809..ab92764 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig @@ -66,7 +66,7 @@ config VIDEO_PCI_DEFAULT_FB_SIZE hex "Default framebuffer size to use if no drivers request it" default 0x1000000 if X86 default 0x800000 if !X86 && VIDEO_BOCHS - default 0 if !X86 && !VIDEO_BOCHS + default 0x0 if !X86 && !VIDEO_BOCHS help Generally, video drivers request the amount of memory they need for the frame buffer when they are bound, by setting the size field in @@ -959,6 +959,14 @@ config SPLASH_SOURCE endif # SPLASH_SCREEN +config BMP + bool "Enable bmp image display" + help + Enable bmp functions to display bmp image and get bmp info. + + BMP is a simple graphics-image file format designed to store bitmap + images. It is primarily used on Windows devices. + config VIDEO_BMP_GZIP bool "Gzip compressed BMP image support" depends on BMP || SPLASH_SCREEN @@ -1049,7 +1057,7 @@ config SPL_VIDEO_PCI_DEFAULT_FB_SIZE hex "Default framebuffer size to use if no drivers request it at SPL" default 0x1000000 if X86 default 0x800000 if !X86 && VIDEO_BOCHS - default 0 if !X86 && !VIDEO_BOCHS + default 0x0 if !X86 && !VIDEO_BOCHS help Generally, video drivers request the amount of memory they need for the frame buffer when they are bound, by setting the size field in @@ -1162,6 +1170,14 @@ config SPL_SPLASH_SOURCE endif # SPL_SPLASH_SCREEN +config SPL_BMP + bool "Enable bmp image display at SPL" + help + Enable bmp functions to display bmp image and get bmp info in SPL. + + BMP is a simple graphics-image file format designed to store bitmap + images. It is primarily used on Windows devices. + config SPL_VIDEO_BMP_GZIP bool "Gzip compressed BMP image support at SPL" depends on SPL_SPLASH_SCREEN || SPL_BMP diff --git a/drivers/video/Makefile b/drivers/video/Makefile index d13af9f..fdc2937 100644 --- a/drivers/video/Makefile +++ b/drivers/video/Makefile @@ -25,6 +25,7 @@ obj-$(CONFIG_PANEL_HX8238D) += hx8238d.o obj-$(CONFIG_$(SPL_TPL_)SIMPLE_PANEL) += simple_panel.o obj-$(CONFIG_VIDEO_LOGO) += u_boot_logo.o +obj-$(CONFIG_$(SPL_TPL_)BMP) += bmp.o endif diff --git a/common/bmp.c b/drivers/video/bmp.c index 57764f3..bab6fa7 100644 --- a/common/bmp.c +++ b/drivers/video/bmp.c @@ -81,13 +81,6 @@ struct bmp_image *gunzip_bmp(unsigned long addr, unsigned long *lenp, return bmp; } -#ifdef CONFIG_NEEDS_MANUAL_RELOC -void bmp_reloc(void) -{ - fixup_cmdtable(cmd_bmp_sub, ARRAY_SIZE(cmd_bmp_sub)); -} -#endif - int bmp_info(ulong addr) { struct bmp_image *bmp = (struct bmp_image *)map_sysmem(addr, 0); diff --git a/drivers/video/coreboot.c b/drivers/video/coreboot.c index c586475..5b718ae 100644 --- a/drivers/video/coreboot.c +++ b/drivers/video/coreboot.c @@ -73,6 +73,17 @@ err: return ret; } +static int coreboot_video_bind(struct udevice *dev) +{ + struct video_uc_plat *uc_plat = dev_get_uclass_plat(dev); + + /* Set the maximum supported resolution */ + uc_plat->size = 4096 * 2160 * 4; + log_debug("%s: Frame buffer size %x\n", __func__, uc_plat->size); + + return 0; +} + static const struct udevice_id coreboot_video_ids[] = { { .compatible = "coreboot-fb" }, { } @@ -82,5 +93,6 @@ U_BOOT_DRIVER(coreboot_video) = { .name = "coreboot_video", .id = UCLASS_VIDEO, .of_match = coreboot_video_ids, + .bind = coreboot_video_bind, .probe = coreboot_video_probe, }; diff --git a/drivers/video/meson/meson_dw_hdmi.c b/drivers/video/meson/meson_dw_hdmi.c index e5f2813..5db0190 100644 --- a/drivers/video/meson/meson_dw_hdmi.c +++ b/drivers/video/meson/meson_dw_hdmi.c @@ -14,6 +14,7 @@ #include <dm/device-internal.h> #include <dm/uclass-internal.h> #include <linux/bitops.h> +#include <linux/printk.h> #include <power/regulator.h> #include <clk.h> #include <linux/delay.h> diff --git a/drivers/video/meson/meson_vclk.c b/drivers/video/meson/meson_vclk.c index cd1e690..e718a00 100644 --- a/drivers/video/meson/meson_vclk.c +++ b/drivers/video/meson/meson_vclk.c @@ -10,6 +10,7 @@ #include <dm.h> #include <edid.h> #include <linux/bitops.h> +#include <linux/printk.h> #include "meson_vpu.h" #include <log.h> #include <linux/iopoll.h> diff --git a/drivers/video/rockchip/dw_mipi_dsi_rockchip.c b/drivers/video/rockchip/dw_mipi_dsi_rockchip.c index 0852b53..1a5ab78 100644 --- a/drivers/video/rockchip/dw_mipi_dsi_rockchip.c +++ b/drivers/video/rockchip/dw_mipi_dsi_rockchip.c @@ -377,7 +377,7 @@ static int dsi_phy_init(void *priv_data) struct dw_rockchip_dsi_priv *dsi = dev_get_priv(dev); int ret, i, vco; - if (dsi->phy.dev) { + if (generic_phy_valid(&dsi->phy)) { ret = generic_phy_configure(&dsi->phy, &dsi->phy_opts); if (ret) { dev_err(dsi->dsi_host, @@ -559,7 +559,7 @@ dw_mipi_dsi_get_lane_mbps(void *priv_data, struct display_timing *timings, } /* for external phy only the mipi_dphy_config is necessary */ - if (dsi->phy.dev) { + if (generic_phy_valid(&dsi->phy)) { phy_mipi_dphy_get_default_config(timings->pixelclock.typ * 10 / 8, bpp, lanes, &dsi->phy_opts); @@ -859,7 +859,7 @@ static int dw_mipi_dsi_rockchip_probe(struct udevice *dev) } /* Get a ref clock only if not using an external phy. */ - if (priv->phy.dev) { + if (generic_phy_valid(&priv->phy)) { dev_dbg(dev, "setting priv->ref to NULL\n"); priv->ref = NULL; diff --git a/drivers/video/stm32/stm32_dsi.c b/drivers/video/stm32/stm32_dsi.c index a7420fb..a18c1e0 100644 --- a/drivers/video/stm32/stm32_dsi.c +++ b/drivers/video/stm32/stm32_dsi.c @@ -26,6 +26,7 @@ #include <dm/lists.h> #include <linux/bitops.h> #include <linux/iopoll.h> +#include <linux/printk.h> #include <power/regulator.h> #define HWVER_130 0x31333000 /* IP version 1.30 */ diff --git a/drivers/video/stm32/stm32_ltdc.c b/drivers/video/stm32/stm32_ltdc.c index f48badc..6fd90e3 100644 --- a/drivers/video/stm32/stm32_ltdc.c +++ b/drivers/video/stm32/stm32_ltdc.c @@ -20,6 +20,7 @@ #include <dm/device-internal.h> #include <dm/device_compat.h> #include <linux/bitops.h> +#include <linux/printk.h> struct stm32_ltdc_priv { void __iomem *regs; diff --git a/drivers/video/tegra124/sor.c b/drivers/video/tegra124/sor.c index f291db3..2586851 100644 --- a/drivers/video/tegra124/sor.c +++ b/drivers/video/tegra124/sor.c @@ -15,6 +15,7 @@ #include <asm/arch/clock.h> #include <asm/arch-tegra/dc.h> #include <linux/delay.h> +#include <linux/printk.h> #include "displayport.h" #include "sor.h" #include <linux/err.h> diff --git a/drivers/watchdog/stm32mp_wdt.c b/drivers/watchdog/stm32mp_wdt.c index 4be616c..7ebcd25 100644 --- a/drivers/watchdog/stm32mp_wdt.c +++ b/drivers/watchdog/stm32mp_wdt.c @@ -15,6 +15,7 @@ #include <dm/device_compat.h> #include <linux/bitops.h> #include <linux/iopoll.h> +#include <linux/printk.h> /* IWDG registers */ #define IWDG_KR 0x00 /* Key register */ diff --git a/drivers/watchdog/wdt-uclass.c b/drivers/watchdog/wdt-uclass.c index 509896a..ed32928 100644 --- a/drivers/watchdog/wdt-uclass.c +++ b/drivers/watchdog/wdt-uclass.c @@ -236,28 +236,6 @@ void watchdog_reset(void) } #endif -static int wdt_post_bind(struct udevice *dev) -{ -#if defined(CONFIG_NEEDS_MANUAL_RELOC) - struct wdt_ops *ops = (struct wdt_ops *)device_get_ops(dev); - static int reloc_done; - - if (!reloc_done) { - if (ops->start) - ops->start += gd->reloc_off; - if (ops->stop) - ops->stop += gd->reloc_off; - if (ops->reset) - ops->reset += gd->reloc_off; - if (ops->expire_now) - ops->expire_now += gd->reloc_off; - - reloc_done++; - } -#endif - return 0; -} - static int wdt_pre_probe(struct udevice *dev) { u32 timeout = WATCHDOG_TIMEOUT_SECS; @@ -295,7 +273,6 @@ UCLASS_DRIVER(wdt) = { .id = UCLASS_WDT, .name = "watchdog", .flags = DM_UC_FLAG_SEQ_ALIAS, - .post_bind = wdt_post_bind, .pre_probe = wdt_pre_probe, .per_device_auto = sizeof(struct wdt_priv), }; diff --git a/env/Kconfig b/env/Kconfig index 13e3210..54203fa 100644 --- a/env/Kconfig +++ b/env/Kconfig @@ -571,7 +571,7 @@ config ENV_OFFSET default 0xE0000 if ARCH_ZYNQ default 0x1E00000 if ARCH_ZYNQMP default 0x7F40000 if ARCH_VERSAL || ARCH_VERSAL_NET - default 0 if ARC + default 0x0 if ARC default 0x140000 if ARCH_AT91 default 0x260000 if ARCH_OMAP2PLUS default 0x1080000 if MICROBLAZE && ENV_IS_IN_SPI_FLASH @@ -583,7 +583,7 @@ config ENV_OFFSET_REDUND depends on (ENV_IS_IN_EEPROM || ENV_IS_IN_MMC || ENV_IS_IN_NAND || \ ENV_IS_IN_SPI_FLASH) && SYS_REDUNDAND_ENVIRONMENT default 0x10C0000 if MICROBLAZE - default 0 + default 0x0 help Offset from the start of the device (or partition) of the redundant environment location. diff --git a/env/callback.c b/env/callback.c index 638a02b..98ddba0 100644 --- a/env/callback.c +++ b/env/callback.c @@ -9,10 +9,6 @@ #include <env_internal.h> #include <asm/global_data.h> -#if defined(CONFIG_NEEDS_MANUAL_RELOC) -DECLARE_GLOBAL_DATA_PTR; -#endif - /* * Look up a callback function pointer by name */ @@ -71,11 +67,7 @@ void env_callback_init(struct env_entry *var_entry) if (!ret && strlen(callback_name)) { clbkp = find_env_callback(callback_name); if (clbkp != NULL) -#if defined(CONFIG_NEEDS_MANUAL_RELOC) - var_entry->callback = clbkp->callback + gd->reloc_off; -#else var_entry->callback = clbkp->callback; -#endif } } @@ -112,11 +104,7 @@ static int set_callback(const char *name, const char *value, void *priv) /* assign the requested callback */ clbkp = find_env_callback(value); if (clbkp != NULL) -#if defined(CONFIG_NEEDS_MANUAL_RELOC) - ep->callback = clbkp->callback + gd->reloc_off; -#else ep->callback = clbkp->callback; -#endif } } diff --git a/env/common.c b/env/common.c index 0ecdb24..eb1a913 100644 --- a/env/common.c +++ b/env/common.c @@ -15,6 +15,7 @@ #include <log.h> #include <sort.h> #include <asm/global_data.h> +#include <linux/printk.h> #include <linux/stddef.h> #include <search.h> #include <errno.h> @@ -428,11 +429,6 @@ int env_export(env_t *env_out) void env_relocate(void) { -#if defined(CONFIG_NEEDS_MANUAL_RELOC) - env_reloc(); - env_fix_drivers(); - env_htab.change_ok += gd->reloc_off; -#endif if (gd->env_valid == ENV_INVALID) { #if defined(CONFIG_ENV_IS_NOWHERE) || defined(CONFIG_SPL_BUILD) /* Environment not changable */ @@ -14,29 +14,6 @@ DECLARE_GLOBAL_DATA_PTR; -#if defined(CONFIG_NEEDS_MANUAL_RELOC) -void env_fix_drivers(void) -{ - struct env_driver *drv; - const int n_ents = ll_entry_count(struct env_driver, env_driver); - struct env_driver *entry; - - drv = ll_entry_start(struct env_driver, env_driver); - for (entry = drv; entry != drv + n_ents; entry++) { - if (entry->name) - entry->name += gd->reloc_off; - if (entry->load) - entry->load += gd->reloc_off; - if (entry->save) - entry->save += gd->reloc_off; - if (entry->erase) - entry->erase += gd->reloc_off; - if (entry->init) - entry->init += gd->reloc_off; - } -} -#endif - static struct env_driver *_env_driver_lookup(enum env_location loc) { struct env_driver *drv; diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 38e285b..4691612 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -390,7 +390,7 @@ int btrfs_read_extent_inline(struct btrfs_path *path, csize); ret = btrfs_decompress(btrfs_file_extent_compression(leaf, fi), cbuf, csize, dbuf, dsize); - if (ret == (u32)-1) { + if (ret < 0) { ret = -EIO; goto out; } @@ -500,7 +500,7 @@ int btrfs_read_extent_reg(struct btrfs_path *path, ret = btrfs_decompress(btrfs_file_extent_compression(leaf, fi), cbuf, csize, dbuf, dsize); - if (ret == (u32)-1) { + if (ret < 0) { ret = -EIO; goto out; } diff --git a/fs/btrfs/subvolume.c b/fs/btrfs/subvolume.c index d446e7a..68ca7e4 100644 --- a/fs/btrfs/subvolume.c +++ b/fs/btrfs/subvolume.c @@ -199,6 +199,7 @@ static int list_subvolums(struct btrfs_fs_info *fs_info) ret = PTR_ERR(root); if (ret == -ENOENT) goto next; + goto out; } ret = list_one_subvol(root, result); if (ret < 0) diff --git a/fs/cramfs/cramfs.c b/fs/cramfs/cramfs.c index 6c017ce..abb2de3 100644 --- a/fs/cramfs/cramfs.c +++ b/fs/cramfs/cramfs.c @@ -166,8 +166,7 @@ static unsigned long cramfs_resolve (unsigned long begin, unsigned long offset, unsigned long ret; char *link; if (p && strlen(p)) { - printf ("unsupported symlink to \ - non-terminal path\n"); + printf ("unsupported symlink to non-terminal path\n"); return 0; } link = cramfs_uncompress_link (begin, @@ -177,8 +176,7 @@ static unsigned long cramfs_resolve (unsigned long begin, unsigned long offset, namelen, namelen, name); return 0; } else if (link[0] == '/') { - printf ("unsupported symlink to \ - absolute path\n"); + printf ("unsupported symlink to absolute path\n"); free (link); return 0; } diff --git a/fs/fat/fat.c b/fs/fat/fat.c index d1476aa..8ff1fd0 100644 --- a/fs/fat/fat.c +++ b/fs/fat/fat.c @@ -110,9 +110,7 @@ int fat_register_device(struct blk_desc *dev_desc, int part_no) info.name[0] = 0; info.type[0] = 0; info.bootable = 0; -#if CONFIG_IS_ENABLED(PARTITION_UUIDS) - info.uuid[0] = 0; -#endif + disk_partition_clr_uuid(&info); } return fat_set_blk_dev(dev_desc, &info); diff --git a/fs/fat/fat_write.c b/fs/fat/fat_write.c index a629441..8b5d669 100644 --- a/fs/fat/fat_write.c +++ b/fs/fat/fat_write.c @@ -690,8 +690,8 @@ get_set_cluster(fsdata *mydata, __u32 clustnum, loff_t pos, __u8 *buffer, static u8 *tmpbuf_cluster; unsigned int bytesperclust = mydata->clust_size * mydata->sect_size; __u32 startsect; - loff_t wsize; - int clustcount, i, ret; + loff_t clustcount, wsize; + int i, ret; *gotsize = 0; if (!size) @@ -422,22 +422,6 @@ int fs_set_blk_dev(const char *ifname, const char *dev_part_str, int fstype) { struct fstype_info *info; int part, i; -#ifdef CONFIG_NEEDS_MANUAL_RELOC - static int relocated; - - if (!relocated) { - for (i = 0, info = fstypes; i < ARRAY_SIZE(fstypes); - i++, info++) { - info->name += gd->reloc_off; - info->probe += gd->reloc_off; - info->close += gd->reloc_off; - info->ls += gd->reloc_off; - info->read += gd->reloc_off; - info->write += gd->reloc_off; - } - relocated = 1; - } -#endif part = part_get_info_by_dev_and_name_or_num(ifname, dev_part_str, &fs_dev_desc, &fs_partition, 1); diff --git a/fs/ubifs/debug.c b/fs/ubifs/debug.c index bede7d0..ff2a571 100644 --- a/fs/ubifs/debug.c +++ b/fs/ubifs/debug.c @@ -18,6 +18,7 @@ #include <hexdump.h> #include <log.h> #include <dm/devres.h> +#include <linux/printk.h> #ifndef __UBOOT__ #include <linux/module.h> diff --git a/fs/ubifs/debug.h b/fs/ubifs/debug.h index 0ecc2e0..d8324ae 100644 --- a/fs/ubifs/debug.h +++ b/fs/ubifs/debug.h @@ -12,6 +12,7 @@ #define __UBIFS_DEBUG_H__ /* Checking helper functions */ +#include <linux/printk.h> typedef int (*dbg_leaf_callback)(struct ubifs_info *c, struct ubifs_zbranch *zbr, void *priv); typedef int (*dbg_znode_callback)(struct ubifs_info *c, diff --git a/fs/ubifs/lpt_commit.c b/fs/ubifs/lpt_commit.c index ba0b19a..2e50c08 100644 --- a/fs/ubifs/lpt_commit.c +++ b/fs/ubifs/lpt_commit.c @@ -24,6 +24,7 @@ #include <linux/compat.h> #include <linux/err.h> #include <linux/crc16.h> +#include <linux/printk.h> #endif #include "ubifs.h" diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index 034c41a..3e71603 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c @@ -35,6 +35,7 @@ #include <linux/bitops.h> #include <linux/bug.h> #include <linux/log2.h> +#include <linux/printk.h> #include <linux/stat.h> #include <linux/err.h> #include "ubifs.h" diff --git a/fs/ubifs/ubifs.c b/fs/ubifs/ubifs.c index 609bdbf..a509584 100644 --- a/fs/ubifs/ubifs.c +++ b/fs/ubifs/ubifs.c @@ -201,12 +201,6 @@ static int __init compr_init(struct ubifs_compressor *compr) { ubifs_compressors[compr->compr_type] = compr; -#ifdef CONFIG_NEEDS_MANUAL_RELOC - ubifs_compressors[compr->compr_type]->name += gd->reloc_off; - ubifs_compressors[compr->compr_type]->capi_name += gd->reloc_off; - ubifs_compressors[compr->compr_type]->decompress += gd->reloc_off; -#endif - if (compr->capi_name) { compr->cc = crypto_alloc_comp(compr->capi_name, 0, 0); if (IS_ERR(compr->cc)) { diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h index 46dfbd0..67b13c8 100644 --- a/fs/ubifs/ubifs.h +++ b/fs/ubifs/ubifs.h @@ -35,6 +35,7 @@ #include <asm-generic/atomic-long.h> #include <ubi_uboot.h> #include <ubifs_uboot.h> +#include <linux/printk.h> #include <linux/ctype.h> #include <linux/time.h> diff --git a/fs/yaffs2/yaffs_uboot_glue.c b/fs/yaffs2/yaffs_uboot_glue.c index ec8d028..0a92056 100644 --- a/fs/yaffs2/yaffs_uboot_glue.c +++ b/fs/yaffs2/yaffs_uboot_glue.c @@ -22,6 +22,7 @@ #include <common.h> #include <div64.h> #include <malloc.h> +#include <linux/printk.h> #include <config.h> #include "nand.h" diff --git a/include/abuf.h b/include/abuf.h index 9badda6..be98ec7 100644 --- a/include/abuf.h +++ b/include/abuf.h @@ -91,6 +91,15 @@ void abuf_map_sysmem(struct abuf *abuf, ulong addr, size_t size); bool abuf_realloc(struct abuf *abuf, size_t new_size); /** + * abuf_realloc_inc() - Increment abuf size by a given amount + * + * @abuf: abuf to adjust + * @inc: Size incrmement to use (the buffer size will be increased by this much) + * Return: true if OK, false if out of memory + */ +bool abuf_realloc_inc(struct abuf *abuf, size_t inc); + +/** * abuf_uninit_move() - Return the allocated contents and uninit the abuf * * This returns the abuf data to the caller, allocating it if necessary, so that diff --git a/include/acpi/acpi_table.h b/include/acpi/acpi_table.h index 7ed0443..1f85de0 100644 --- a/include/acpi/acpi_table.h +++ b/include/acpi/acpi_table.h @@ -883,6 +883,13 @@ void acpi_inc_align(struct acpi_ctx *ctx, uint amount); */ int acpi_add_table(struct acpi_ctx *ctx, void *table); +static inline int acpi_add_fadt(struct acpi_ctx *ctx, struct acpi_fadt *fadt) +{ + acpi_add_table(ctx, fadt); + acpi_inc(ctx, sizeof(struct acpi_fadt)); + return 0; +} + /** * acpi_write_rsdp() - Write out an RSDP indicating where the ACPI tables are * diff --git a/include/asm-generic/bitops/builtin-__ffs.h b/include/asm-generic/bitops/builtin-__ffs.h new file mode 100644 index 0000000..87024da --- /dev/null +++ b/include/asm-generic/bitops/builtin-__ffs.h @@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _ASM_GENERIC_BITOPS_BUILTIN___FFS_H_ +#define _ASM_GENERIC_BITOPS_BUILTIN___FFS_H_ + +/** + * __ffs - find first bit in word. + * @word: The word to search + * + * Undefined if no bit exists, so code should check against 0 first. + */ +static __always_inline unsigned long __ffs(unsigned long word) +{ + return __builtin_ctzl(word); +} + +#endif diff --git a/include/asm-generic/bitops/builtin-__fls.h b/include/asm-generic/bitops/builtin-__fls.h new file mode 100644 index 0000000..43a5aa9 --- /dev/null +++ b/include/asm-generic/bitops/builtin-__fls.h @@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _ASM_GENERIC_BITOPS_BUILTIN___FLS_H_ +#define _ASM_GENERIC_BITOPS_BUILTIN___FLS_H_ + +/** + * __fls - find last (most-significant) set bit in a long word + * @word: the word to search + * + * Undefined if no set bit exists, so code should check against 0 first. + */ +static __always_inline unsigned long __fls(unsigned long word) +{ + return (sizeof(word) * 8) - 1 - __builtin_clzl(word); +} + +#endif diff --git a/include/asm-generic/bitops/builtin-ffs.h b/include/asm-generic/bitops/builtin-ffs.h new file mode 100644 index 0000000..7b12932 --- /dev/null +++ b/include/asm-generic/bitops/builtin-ffs.h @@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _ASM_GENERIC_BITOPS_BUILTIN_FFS_H_ +#define _ASM_GENERIC_BITOPS_BUILTIN_FFS_H_ + +/** + * ffs - find first bit set + * @x: the word to search + * + * This is defined the same way as + * the libc and compiler builtin ffs routines, therefore + * differs in spirit from ffz (man ffs). + */ +#define ffs(x) __builtin_ffs(x) + +#endif diff --git a/include/asm-generic/bitops/builtin-fls.h b/include/asm-generic/bitops/builtin-fls.h new file mode 100644 index 0000000..c8455cc --- /dev/null +++ b/include/asm-generic/bitops/builtin-fls.h @@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _ASM_GENERIC_BITOPS_BUILTIN_FLS_H_ +#define _ASM_GENERIC_BITOPS_BUILTIN_FLS_H_ + +/** + * fls - find last (most-significant) bit set + * @x: the word to search + * + * This is defined the same way as ffs. + * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32. + */ +static __always_inline int fls(unsigned int x) +{ + return x ? sizeof(x) * 8 - __builtin_clz(x) : 0; +} + +#endif diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h index 8fc205d..c6d63b3 100644 --- a/include/asm-generic/global_data.h +++ b/include/asm-generic/global_data.h @@ -552,6 +552,14 @@ static_assert(sizeof(struct global_data) == GD_SIZE); #define gd_set_acpi_start(addr) #endif +#ifdef CONFIG_SMBIOS +#define gd_smbios_start() gd->smbios_start +#define gd_set_smbios_start(addr) gd->arch.smbios_start = addr +#else +#define gd_smbios_start() 0UL +#define gd_set_smbios_start(addr) +#endif + #if CONFIG_IS_ENABLED(MULTI_DTB_FIT) #define gd_multi_dtb_fit() gd->multi_dtb_fit #define gd_set_multi_dtb_fit(_dtb) gd->multi_dtb_fit = _dtb @@ -573,6 +581,13 @@ static_assert(sizeof(struct global_data) == GD_SIZE); #define gd_malloc_start() 0 #define gd_set_malloc_start(val) #endif + +#if CONFIG_IS_ENABLED(PCI) +#define gd_set_pci_ram_top(val) gd->pci_ram_top = val +#else +#define gd_set_pci_ram_top(val) +#endif + /** * enum gd_flags - global data flags * @@ -667,6 +682,11 @@ enum gd_flags { * @GD_FLG_OF_TAG_MIGRATE: Device tree has old u-boot,dm- tags */ GD_FLG_OF_TAG_MIGRATE = 0x200000, + /** + * @GD_FLG_DM_DEAD: Driver model is not accessible. This can be set when + * the memory used to holds its tables has been mapped out. + */ + GD_FLG_DM_DEAD = 0x400000, }; #endif /* __ASSEMBLY__ */ diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h index c4a7fd2..a21c606 100644 --- a/include/asm-generic/gpio.h +++ b/include/asm-generic/gpio.h @@ -414,6 +414,7 @@ struct dm_gpio_ops { * @gpio_base: Base GPIO number for this device. For the first active device * this will be 0; the numbering for others will follow sequentially so that * @gpio_base for device 1 will equal the number of GPIOs in device 0. + * @claimed: Array of bits indicating which GPIOs in the bank are claimed. * @name: Array of pointers to the name for each GPIO in this bank. The * value of the pointer will be NULL if the GPIO has not been claimed. */ @@ -421,6 +422,7 @@ struct gpio_dev_priv { const char *bank_name; unsigned gpio_count; unsigned gpio_base; + u32 *claimed; char **name; }; diff --git a/include/asm-generic/sections.h b/include/asm-generic/sections.h index 267f1db..1e1657a 100644 --- a/include/asm-generic/sections.h +++ b/include/asm-generic/sections.h @@ -61,8 +61,12 @@ static inline int arch_is_kernel_data(unsigned long addr) /* Start of U-Boot text region */ extern char __text_start[]; -/* This marks the end of the text region which must be relocated */ -extern char __image_copy_end[]; +/* This marks the text region which must be relocated */ +extern char __image_copy_start[], __image_copy_end[]; + +extern char __bss_end[]; +extern char __rel_dyn_start[], __rel_dyn_end[]; +extern char _image_binary_end[]; /* * This is the U-Boot entry point - prior to relocation it should be same @@ -70,30 +74,4 @@ extern char __image_copy_end[]; */ extern void _start(void); -/* - * ARM defines its symbols as char[]. Other arches define them as ulongs. - */ -#ifdef CONFIG_ARM - -extern char __bss_start[]; -extern char __bss_end[]; -extern char __image_copy_start[]; -extern char __image_copy_end[]; -extern char _image_binary_end[]; -extern char __rel_dyn_start[]; -extern char __rel_dyn_end[]; - -#else /* don't use offsets: */ - -/* Exports from the Linker Script */ -extern ulong __data_end; -extern ulong __rel_dyn_start; -extern ulong __rel_dyn_end; -extern ulong __bss_end; -extern ulong _image_binary_end; - -extern ulong _TEXT_BASE; /* code start */ - -#endif - #endif /* _ASM_GENERIC_SECTIONS_H_ */ diff --git a/include/blk.h b/include/blk.h index 2c9c798..95e86e2 100644 --- a/include/blk.h +++ b/include/blk.h @@ -7,6 +7,7 @@ #ifndef BLK_H #define BLK_H +#include <bouncebuf.h> #include <dm/uclass-id.h> #include <efi.h> @@ -104,12 +105,6 @@ struct blk_desc { (PAD_SIZE(size, blk_desc->blksz)) #if CONFIG_IS_ENABLED(BLOCK_CACHE) - -/** - * blkcache_init() - initialize the block cache list pointers - */ -int blkcache_init(void); - /** * blkcache_read() - attempt to read a set of blocks from cache * @@ -260,9 +255,25 @@ struct blk_ops { * @return 0 if OK, -ve on error */ int (*select_hwpart)(struct udevice *dev, int hwpart); -}; -#define blk_get_ops(dev) ((struct blk_ops *)(dev)->driver->ops) +#if IS_ENABLED(CONFIG_BOUNCE_BUFFER) + /** + * buffer_aligned() - test memory alignment of block operation buffer + * + * Some devices have limited DMA capabilities and require that the + * buffers passed to them fit specific properties. This optional + * callback can be used to indicate whether a buffer alignment is + * suitable for the device DMA or not, and trigger use of generic + * bounce buffer implementation to help use of unsuitable buffers + * at the expense of performance degradation. + * + * @dev: Block device associated with the request + * @state: Bounce buffer state + * @return 1 if OK, 0 if unaligned + */ + int (*buffer_aligned)(struct udevice *dev, struct bounce_buffer *state); +#endif /* CONFIG_BOUNCE_BUFFER */ +}; /* * These functions should take struct udevice instead of struct blk_desc, diff --git a/include/bootdev.h b/include/bootdev.h index 8482331..b079a91 100644 --- a/include/bootdev.h +++ b/include/bootdev.h @@ -321,6 +321,15 @@ int bootdev_hunt(const char *spec, bool show); int bootdev_hunt_prio(enum bootdev_prio_t prio, bool show); /** + * bootdev_unhunt() - Mark a device as needing to be hunted again + * + * @id: uclass ID to update + * Return: 0 if done, -EALREADY if already in this state, -ENOENT if no hunter + * found for that uclass + */ +int bootdev_unhunt(enum uclass_id id); + +/** * bootdev_hunt_and_find_by_label() - Hunt for bootdevs by label * * Runs the hunter for the label, then tries to find the bootdev, possible diff --git a/include/bootflow.h b/include/bootflow.h index 4152577..44d3741 100644 --- a/include/bootflow.h +++ b/include/bootflow.h @@ -83,6 +83,7 @@ enum bootflow_flags_t { * @flags: Flags for the bootflow (see enum bootflow_flags_t) * @cmdline: OS command line, or NULL if not known (allocated) * @x86_setup: Pointer to x86 setup block inside @buf, NULL if not present + * @bootmeth_priv: Private data for the bootmeth */ struct bootflow { struct list_head bm_node; @@ -107,7 +108,8 @@ struct bootflow { ulong fdt_addr; int flags; char *cmdline; - char *x86_setup; + void *x86_setup; + void *bootmeth_priv; }; /** @@ -351,6 +353,17 @@ void bootflow_free(struct bootflow *bflow); int bootflow_boot(struct bootflow *bflow); /** + * bootflow_read_all() - Read all bootflow files + * + * Some bootmeths delay reading of large files until booting is requested. This + * causes those files to be read. + * + * @bflow: Bootflow to read + * Return: result of trying to read + */ +int bootflow_read_all(struct bootflow *bflow); + +/** * bootflow_run_boot() - Try to boot a bootflow * * @iter: Current iteration (or NULL if none). Used to disable a bootmeth if the diff --git a/include/bootm.h b/include/bootm.h index 044a479..c3c7336 100644 --- a/include/bootm.h +++ b/include/bootm.h @@ -9,6 +9,7 @@ #include <image.h> +struct boot_params; struct cmd_tbl; #define BOOTM_ERR_RESET (-1) @@ -124,4 +125,50 @@ int bootm_process_cmdline(char *buf, int maxlen, int flags); */ int bootm_process_cmdline_env(int flags); +/** + * zboot_start() - Boot a zimage + * + * Boot a zimage, given the component parts + * + * @addr: Address where the bzImage is moved before booting, either + * BZIMAGE_LOAD_ADDR or ZIMAGE_LOAD_ADDR + * @base: Pointer to the boot parameters, typically at address + * DEFAULT_SETUP_BASE + * @initrd: Address of the initial ramdisk, or 0 if none + * @initrd_size: Size of the initial ramdisk, or 0 if none + * @cmdline: Command line to use for booting + * Return: -EFAULT on error (normally it does not return) + */ +int zboot_start(ulong addr, ulong size, ulong initrd, ulong initrd_size, + ulong base, char *cmdline); + +/* + * zimage_get_kernel_version() - Get the version string from a kernel + * + * @params: boot_params pointer + * @kernel_base: base address of kernel + * Return: Kernel version as a NUL-terminated string + */ +const char *zimage_get_kernel_version(struct boot_params *params, + void *kernel_base); + +/** + * zimage_dump() - Dump the metadata of a zimage + * + * This shows all available information in a zimage that has been loaded. + * + * @base_ptr: Pointer to the boot parameters, typically at address + * DEFAULT_SETUP_BASE + * @show_cmdline: true to show the full command line + */ +void zimage_dump(struct boot_params *base_ptr, bool show_cmdline); + +/* + * bootm_boot_start() - Boot an image at the given address + * + * @addr: Image address + * @cmdline: Command line to set + */ +int bootm_boot_start(ulong addr, const char *cmdline); + #endif diff --git a/include/bootmeth.h b/include/bootmeth.h index 7cb7da3..0fc3610 100644 --- a/include/bootmeth.h +++ b/include/bootmeth.h @@ -16,9 +16,12 @@ struct udevice; * enum bootmeth_flags - Flags for bootmeths * * @BOOTMETHF_GLOBAL: bootmeth handles bootdev selection automatically + * @BOOTMETHF_ANY_PART: bootmeth is willing to check any partition, even if it + * has no filesystem */ enum bootmeth_flags { BOOTMETHF_GLOBAL = BIT(0), + BOOTMETHF_ANY_PART = BIT(1), }; /** @@ -119,7 +122,16 @@ struct bootmeth_ops { */ int (*read_file)(struct udevice *dev, struct bootflow *bflow, const char *file_path, ulong addr, ulong *sizep); - +#if CONFIG_IS_ENABLED(BOOTSTD_FULL) + /** + * readall() - read all files for a bootflow + * + * @dev: Bootmethod device to boot + * @bflow: Bootflow to read + * Return: 0 if OK, -EIO on I/O error, other -ve on other error + */ + int (*read_all)(struct udevice *dev, struct bootflow *bflow); +#endif /* BOOTSTD_FULL */ /** * boot() - boot a bootflow * @@ -224,6 +236,20 @@ int bootmeth_read_file(struct udevice *dev, struct bootflow *bflow, const char *file_path, ulong addr, ulong *sizep); /** + * bootmeth_read_all() - read all bootflow files + * + * Some bootmeths delay reading of large files until booting is requested. This + * causes those files to be read. + * + * @dev: Bootmethod device to use + * @bflow: Bootflow to read + * Return: does not return on success, since it should boot the + * Operating Systemn. Returns -EFAULT if that fails, other -ve on + * other error + */ +int bootmeth_read_all(struct udevice *dev, struct bootflow *bflow); + +/** * bootmeth_boot() - boot a bootflow * * @dev: Bootmethod device to boot diff --git a/include/cedit.h b/include/cedit.h new file mode 100644 index 0000000..f43cafa --- /dev/null +++ b/include/cedit.h @@ -0,0 +1,125 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright 2023 Google LLC + * Written by Simon Glass <sjg@chromium.org> + */ + +#ifndef __CEDIT_H +#define __CEDIT_H + +#include <dm/ofnode_decl.h> + +struct abuf; +struct expo; +struct scene; +struct video_priv; + +enum { + /* size increment for writing FDT */ + CEDIT_SIZE_INC = 1024, +}; + +/* Name of the cedit node in the devicetree */ +#define CEDIT_NODE_NAME "cedit-values" + +extern struct expo *cur_exp; + +/** + * cedit_arange() - Arrange objects in a configuration-editor scene + * + * @exp: Expo to update + * @vid_priv: Private info of the video device + * @scene_id: scene ID to arrange + * Returns: 0 if OK, -ve on error + */ +int cedit_arange(struct expo *exp, struct video_priv *vid_priv, uint scene_id); + +/** + * cedit_run() - Run a configuration editor + * + * This accepts input until the user quits with Escape + * + * @exp: Expo to use + * Returns: 0 if OK, -ve on error + */ +int cedit_run(struct expo *exp); + +/** + * cedit_prepare() - Prepare to run a cedit + * + * Set up the video device, select the first scene and highlight the first item. + * This ensures that all menus have a selected item. + * + * @exp: Expo to use + * @vid_privp: Set to private data for the video device + * @scnp: Set to the first scene + * Return: scene ID of first scene if OK, -ve on error + */ +int cedit_prepare(struct expo *exp, struct video_priv **vid_privp, + struct scene **scnp); + +/** + * cedit_write_settings() - Write settings in FDT format + * + * Sets up an FDT with the settings + * + * @exp: Expo to write settings from + * @buf: Returns abuf containing the settings FDT (inited by this function) + * Return: 0 if OK, -ve on error + */ +int cedit_write_settings(struct expo *exp, struct abuf *buf); + +/** + * cedit_read_settings() - Read settings in FDT format + * + * Read an FDT with the settings + * + * @exp: Expo to read settings into + * @tree: Tree to read from + * Return: 0 if OK, -ve on error + */ +int cedit_read_settings(struct expo *exp, oftree tree); + +/** + * cedit_write_settings_env() - Write settings to envrionment variables + * + * @exp: Expo to write settings from + * @verbose: true to print each var as it is set + * Return: 0 if OK, -ve on error + */ +int cedit_write_settings_env(struct expo *exp, bool verbose); + +/* + * cedit_read_settings_env() - Read settings from the environment + * + * @exp: Expo to read settings into + * @verbose: true to print each var before it is read + */ +int cedit_read_settings_env(struct expo *exp, bool verbose); + +/** + * cedit_write_settings_cmos() - Write settings to CMOS RAM + * + * Write settings to the defined places in CMOS RAM + * + * @exp: Expo to write settings from + * @dev: UCLASS_RTC device containing space for this information + * Returns 0 if OK, -ve on error + * @verbose: true to print a summary at the end + */ +int cedit_write_settings_cmos(struct expo *exp, struct udevice *dev, + bool verbose); + +/** + * cedit_read_settings_cmos() - Read settings from CMOS RAM + * + * Read settings from the defined places in CMO RAM + * + * @exp: Expo to read settings into + * @dev: RTC device to read settings from + * @verbose: true to print a summary at the end + */ +int cedit_read_settings_cmos(struct expo *exp, struct udevice *dev, + bool verbose); + +#endif /* __CEDIT_H */ diff --git a/include/command.h b/include/command.h index c4e3170..ae7bb4a 100644 --- a/include/command.h +++ b/include/command.h @@ -318,24 +318,6 @@ int cmd_source_script(ulong addr, const char *fit_uname, const char *confname); # define _CMD_HELP(x) #endif -#ifdef CONFIG_NEEDS_MANUAL_RELOC -#define U_BOOT_SUBCMDS_RELOC(_cmdname) \ - static void _cmdname##_subcmds_reloc(void) \ - { \ - static int relocated; \ - \ - if (relocated) \ - return; \ - \ - fixup_cmdtable(_cmdname##_subcmds, \ - ARRAY_SIZE(_cmdname##_subcmds)); \ - relocated = 1; \ - } -#else -#define U_BOOT_SUBCMDS_RELOC(_cmdname) \ - static void _cmdname##_subcmds_reloc(void) { } -#endif - #define U_BOOT_SUBCMDS_DO_CMD(_cmdname) \ static int do_##_cmdname(struct cmd_tbl *cmdtp, int flag, \ int argc, char *const argv[], \ @@ -343,8 +325,6 @@ int cmd_source_script(ulong addr, const char *fit_uname, const char *confname); { \ struct cmd_tbl *subcmd; \ \ - _cmdname##_subcmds_reloc(); \ - \ /* We need at least the cmd and subcmd names. */ \ if (argc < 2 || argc > CONFIG_SYS_MAXARGS) \ return CMD_RET_USAGE; \ @@ -379,7 +359,6 @@ int cmd_source_script(ulong addr, const char *fit_uname, const char *confname); #define U_BOOT_SUBCMDS(_cmdname, ...) \ static struct cmd_tbl _cmdname##_subcmds[] = { __VA_ARGS__ }; \ - U_BOOT_SUBCMDS_RELOC(_cmdname) \ U_BOOT_SUBCMDS_DO_CMD(_cmdname) \ U_BOOT_SUBCMDS_COMPLETE(_cmdname) diff --git a/include/common.h b/include/common.h index 25c317f..a79c2bb 100644 --- a/include/common.h +++ b/include/common.h @@ -17,7 +17,6 @@ #include <errno.h> #include <time.h> #include <linux/types.h> -#include <linux/printk.h> #include <linux/string.h> #include <stdarg.h> #include <stdio.h> diff --git a/include/configs/am62x_evm.h b/include/configs/am62x_evm.h index 44180dc..c8fe59b 100644 --- a/include/configs/am62x_evm.h +++ b/include/configs/am62x_evm.h @@ -9,12 +9,6 @@ #ifndef __CONFIG_AM625_EVM_H #define __CONFIG_AM625_EVM_H -#include <config_distro_bootcmd.h> -#include <env/ti/mmc.h> - -/* DDR Configuration */ -#define CFG_SYS_SDRAM_BASE1 0x880000000 - /* Now for the remaining common defines */ #include <configs/ti_armv7_common.h> diff --git a/include/configs/gardena-smart-gateway-mt7688.h b/include/configs/gardena-smart-gateway-mt7688.h index 0ba4efe..1b97ae2 100644 --- a/include/configs/gardena-smart-gateway-mt7688.h +++ b/include/configs/gardena-smart-gateway-mt7688.h @@ -11,10 +11,6 @@ #define CFG_SYS_INIT_SP_OFFSET 0x400000 -/* SPL */ - -#define CFG_SYS_UBOOT_START CONFIG_TEXT_BASE - /* Dummy value */ #define CFG_SYS_UBOOT_BASE 0 diff --git a/include/configs/imxrt1020-evk.h b/include/configs/imxrt1020-evk.h index e180387..cd6af93 100644 --- a/include/configs/imxrt1020-evk.h +++ b/include/configs/imxrt1020-evk.h @@ -18,10 +18,4 @@ #define DMAMEM_BASE (PHYS_SDRAM + PHYS_SDRAM_SIZE - \ DMAMEM_SZ_ALL) -/* - * Configuration of the external SDRAM memory - */ - -#define CFG_SYS_UBOOT_START 0x800023FD - #endif /* __IMXRT1020_EVK_H */ diff --git a/include/configs/imxrt1050-evk.h b/include/configs/imxrt1050-evk.h index 7688464..2af2dde 100644 --- a/include/configs/imxrt1050-evk.h +++ b/include/configs/imxrt1050-evk.h @@ -25,10 +25,4 @@ "stderr=serial,vidconsole\0" #endif -/* - * Configuration of the external SDRAM memory - */ - -#define CFG_SYS_UBOOT_START 0x800023FD - #endif /* __IMXRT1050_EVK_H */ diff --git a/include/configs/imxrt1170-evk.h b/include/configs/imxrt1170-evk.h index f834290..1ccaa15 100644 --- a/include/configs/imxrt1170-evk.h +++ b/include/configs/imxrt1170-evk.h @@ -22,8 +22,5 @@ #define DMAMEM_SZ_ALL (1 * 1024 * 1024) #define DMAMEM_BASE (PHYS_SDRAM + PHYS_SDRAM_SIZE - \ DMAMEM_SZ_ALL) -/* For SPL */ -#define CFG_SYS_UBOOT_START 0x202403FD -/* For SPL ends */ #endif /* __IMXRT1170_EVK_H */ diff --git a/include/configs/linkit-smart-7688.h b/include/configs/linkit-smart-7688.h index f16c7e9..e8f7a59 100644 --- a/include/configs/linkit-smart-7688.h +++ b/include/configs/linkit-smart-7688.h @@ -11,10 +11,6 @@ #define CFG_SYS_INIT_SP_OFFSET 0x400000 -/* SPL */ - -#define CFG_SYS_UBOOT_START CONFIG_TEXT_BASE - /* Dummy value */ #define CFG_SYS_UBOOT_BASE 0 diff --git a/include/configs/mt7620.h b/include/configs/mt7620.h index d69d35f..3bc0c18 100644 --- a/include/configs/mt7620.h +++ b/include/configs/mt7620.h @@ -12,9 +12,6 @@ #define CFG_SYS_INIT_SP_OFFSET 0x400000 -/* SPL */ -#define CFG_SYS_UBOOT_START CONFIG_TEXT_BASE - /* Dummy value */ #define CFG_SYS_UBOOT_BASE 0 diff --git a/include/configs/mt7628.h b/include/configs/mt7628.h index 0ac376d..1df0681 100644 --- a/include/configs/mt7628.h +++ b/include/configs/mt7628.h @@ -22,9 +22,6 @@ #define CFG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200, \ 230400, 460800, 921600 } -/* SPL */ -#define CFG_SYS_UBOOT_START CONFIG_TEXT_BASE - /* Dummy value */ #define CFG_SYS_UBOOT_BASE 0 diff --git a/include/configs/mt8512.h b/include/configs/mt8512.h index c0fc868..4e70291 100644 --- a/include/configs/mt8512.h +++ b/include/configs/mt8512.h @@ -10,8 +10,6 @@ #define __MT8512_H /* Uboot definition */ -#define CFG_SYS_UBOOT_START CONFIG_TEXT_BASE - #define ENV_BOOT_READ_IMAGE \ "boot_rd_img=mmc dev 0" \ ";mmc read ${loadaddr} 0x27000 0x8000" \ diff --git a/include/configs/sama5d29_curiosity.h b/include/configs/sama5d29_curiosity.h new file mode 100644 index 0000000..ef09b8b --- /dev/null +++ b/include/configs/sama5d29_curiosity.h @@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Configuration file for the SAMA5D29 CURIOSITY board. + * + * Copyright (C) 2023 Microchip Technology Inc. and its subsidiaries + * + * Author: Mihai Sain <mihai.sain@microchip.com> + * + */ + +#ifndef __CONFIG_H +#define __CONFIG_H + +#define CFG_SYS_AT91_SLOW_CLOCK 32768 +#define CFG_SYS_AT91_MAIN_CLOCK 24000000 + +#endif diff --git a/include/configs/starfive-visionfive2.h b/include/configs/starfive-visionfive2.h index 4ee02b8..ff43113 100644 --- a/include/configs/starfive-visionfive2.h +++ b/include/configs/starfive-visionfive2.h @@ -18,6 +18,9 @@ /* Environment options */ #define BOOT_TARGET_DEVICES(func) \ + func(NVME, nvme, 0) \ + func(USB, usb, 0) \ + func(MMC, mmc, 0) \ func(MMC, mmc, 1) \ func(DHCP, dhcp, na) diff --git a/include/configs/ti_armv7_common.h b/include/configs/ti_armv7_common.h index dbbeff3..4e30d0d 100644 --- a/include/configs/ti_armv7_common.h +++ b/include/configs/ti_armv7_common.h @@ -200,7 +200,7 @@ #define CFG_EXTRA_ENV_SETTINGS \ BOOTENV -#endif +#endif /* CONFIG_DISTRO_DEFAULTS */ #endif /* CONFIG_ARM64 */ diff --git a/include/configs/verdin-am62.h b/include/configs/verdin-am62.h index 7990ea8..9d2e37f 100644 --- a/include/configs/verdin-am62.h +++ b/include/configs/verdin-am62.h @@ -13,8 +13,7 @@ /* DDR Configuration */ #define CFG_SYS_SDRAM_BASE 0x80000000 -#define CFG_SYS_SDRAM_BASE1 0x880000000 -#define CFG_SYS_SDRAM_SIZE SZ_2G /* Maximum supported size */ +#define CFG_SYS_SDRAM_SIZE SZ_2G /* Maximum supported size, auto-detection is used */ #define MEM_LAYOUT_ENV_SETTINGS \ "fdt_addr_r=0x90200000\0" \ @@ -46,10 +45,20 @@ "fdt_board=dev\0" \ "setup=setenv setupargs console=tty1 console=${console},${baudrate} " \ "consoleblank=0 earlycon=ns16550a,mmio32,0x02800000\0" \ - "update_uboot=askenv confirm Did you load flash.bin (y/N)?; " \ + "update_tiboot3=askenv confirm Did you load tiboot3.bin (y/N)?; " \ "if test \"$confirm\" = \"y\"; then " \ "setexpr blkcnt ${filesize} + 0x1ff && setexpr blkcnt " \ "${blkcnt} / 0x200; mmc dev 0 1; mmc write ${loadaddr} 0x0 " \ + "${blkcnt}; fi\0" \ + "update_tispl=askenv confirm Did you load tispl.bin (y/N)?; " \ + "if test \"$confirm\" = \"y\"; then " \ + "setexpr blkcnt ${filesize} + 0x1ff && setexpr blkcnt " \ + "${blkcnt} / 0x200; mmc dev 0 1; mmc write ${loadaddr} 0x400 " \ + "${blkcnt}; fi\0" \ + "update_uboot=askenv confirm Did you load u-boot.img (y/N)?; " \ + "if test \"$confirm\" = \"y\"; then " \ + "setexpr blkcnt ${filesize} + 0x1ff && setexpr blkcnt " \ + "${blkcnt} / 0x200; mmc dev 0 1; mmc write ${loadaddr} 0x1400 " \ "${blkcnt}; fi\0" #endif /* __VERDIN_AM62_H */ diff --git a/include/configs/vocore2.h b/include/configs/vocore2.h index 43050d6..eb87633 100644 --- a/include/configs/vocore2.h +++ b/include/configs/vocore2.h @@ -11,10 +11,6 @@ #define CFG_SYS_INIT_SP_OFFSET 0x400000 -/* SPL */ - -#define CFG_SYS_UBOOT_START CONFIG_TEXT_BASE - /* Dummy value */ #define CFG_SYS_UBOOT_BASE 0 diff --git a/include/configs/xilinx_versal.h b/include/configs/xilinx_versal.h index a403999..b634bb1 100644 --- a/include/configs/xilinx_versal.h +++ b/include/configs/xilinx_versal.h @@ -40,10 +40,11 @@ "kernel_size_r=0x10000000\0" \ "kernel_comp_addr_r=0x30000000\0" \ "kernel_comp_size=0x3C00000\0" \ - "scriptaddr=0x20000000\0" \ "ramdisk_addr_r=0x02100000\0" \ "script_size_f=0x80000\0" +#if defined(CONFIG_DISTRO_DEFAULTS) + #if defined(CONFIG_MMC_SDHCI_ZYNQ) # define BOOT_TARGET_DEVICES_MMC(func) func(MMC, mmc, 0) func(MMC, mmc, 1) #else @@ -125,6 +126,10 @@ #include <config_distro_bootcmd.h> +#else /* CONFIG_DISTRO_DEFAULTS */ +# define BOOTENV +#endif /* CONFIG_DISTRO_DEFAULTS */ + /* Initial environment variables */ #ifndef CFG_EXTRA_ENV_SETTINGS #define CFG_EXTRA_ENV_SETTINGS \ diff --git a/include/configs/xilinx_versal_net.h b/include/configs/xilinx_versal_net.h index 613cce4..2b441da 100644 --- a/include/configs/xilinx_versal_net.h +++ b/include/configs/xilinx_versal_net.h @@ -54,10 +54,11 @@ "kernel_size_r=0x10000000\0" \ "kernel_comp_addr_r=0x30000000\0" \ "kernel_comp_size=0x3C00000\0" \ - "scriptaddr=0x20000000\0" \ "ramdisk_addr_r=0x02100000\0" \ "script_size_f=0x80000\0" +#if defined(CONFIG_DISTRO_DEFAULTS) + #if defined(CONFIG_MMC_SDHCI_ZYNQ) # define BOOT_TARGET_DEVICES_MMC(func) func(MMC, mmc, 0) func(MMC, mmc, 1) #else @@ -126,6 +127,10 @@ #include <config_distro_bootcmd.h> +#else /* CONFIG_DISTRO_DEFAULTS */ +# define BOOTENV +#endif /* CONFIG_DISTRO_DEFAULTS */ + /* Initial environment variables */ #ifndef CFG_EXTRA_ENV_SETTINGS #define CFG_EXTRA_ENV_SETTINGS \ diff --git a/include/configs/xilinx_zynqmp.h b/include/configs/xilinx_zynqmp.h index 74264b7..5bc117e 100644 --- a/include/configs/xilinx_zynqmp.h +++ b/include/configs/xilinx_zynqmp.h @@ -29,7 +29,7 @@ /* Miscellaneous configurable options */ -#if defined(CONFIG_ZYNQMP_USB) +#if defined(CONFIG_USB_STORAGE) #define DFU_DEFAULT_POLL_TIMEOUT 300 # define PARTS_DEFAULT \ @@ -57,13 +57,14 @@ "kernel_size_r=0x10000000\0" \ "kernel_comp_addr_r=0x30000000\0" \ "kernel_comp_size=0x3C00000\0" \ - "scriptaddr=0x20000000\0" \ "ramdisk_addr_r=0x02100000\0" \ "script_size_f=0x80000\0" \ "stdin=serial\0" \ "stdout=serial,vidconsole\0" \ "stderr=serial,vidconsole\0" \ +#if defined(CONFIG_DISTRO_DEFAULTS) + #if defined(CONFIG_MMC_SDHCI_ZYNQ) # define BOOT_TARGET_DEVICES_MMC(func) func(MMC, mmc, 0) func(MMC, mmc, 1) #else @@ -76,7 +77,7 @@ # define BOOT_TARGET_DEVICES_SCSI(func) #endif -#if defined(CONFIG_ZYNQMP_USB) +#if defined(CONFIG_USB_STORAGE) # define BOOT_TARGET_DEVICES_USB(func) func(USB, usb, 0) func(USB, usb, 1) #else # define BOOT_TARGET_DEVICES_USB(func) @@ -175,6 +176,10 @@ #include <config_distro_bootcmd.h> +#else /* CONFIG_DISTRO_DEFAULTS */ +# define BOOTENV +#endif /* CONFIG_DISTRO_DEFAULTS */ + /* Initial environment variables */ #ifndef CFG_EXTRA_ENV_SETTINGS #define CFG_EXTRA_ENV_SETTINGS \ diff --git a/include/configs/zynq-common.h b/include/configs/zynq-common.h index e372e90..553bb1b 100644 --- a/include/configs/zynq-common.h +++ b/include/configs/zynq-common.h @@ -172,12 +172,10 @@ /* Default environment */ #ifndef CFG_EXTRA_ENV_SETTINGS #define CFG_EXTRA_ENV_SETTINGS \ - "scriptaddr=0x20000\0" \ "script_size_f=0x40000\0" \ "fdt_addr_r=0x1f00000\0" \ "pxefile_addr_r=0x2000000\0" \ "kernel_addr_r=0x2000000\0" \ - "scriptaddr=0x3000000\0" \ "ramdisk_addr_r=0x3100000\0" \ BOOTENV #endif diff --git a/include/crypto/pkcs7_parser.h b/include/crypto/pkcs7_parser.h index 906033a..2c45cce 100644 --- a/include/crypto/pkcs7_parser.h +++ b/include/crypto/pkcs7_parser.h @@ -11,6 +11,7 @@ #include <linux/oid_registry.h> #include <crypto/pkcs7.h> #include <crypto/x509_parser.h> +#include <linux/printk.h> #define kenter(FMT, ...) \ pr_devel("==> %s("FMT")\n", __func__, ##__VA_ARGS__) diff --git a/include/dm/device_compat.h b/include/dm/device_compat.h index 82d7a7d..aa9a6fb 100644 --- a/include/dm/device_compat.h +++ b/include/dm/device_compat.h @@ -14,6 +14,7 @@ #include <log.h> #include <linux/build_bug.h> #include <linux/compat.h> +#include <linux/printk.h> /* * Define a new identifier which can be tested on by C code. A similar diff --git a/include/dm/of_access.h b/include/dm/of_access.h index c556a18..9361d0a 100644 --- a/include/dm/of_access.h +++ b/include/dm/of_access.h @@ -334,6 +334,25 @@ int of_read_u32_index(const struct device_node *np, const char *propname, int index, u32 *outp); /** + * of_read_u64_index() - Find and read a 64-bit value from a multi-value + * property + * + * @np: device node from which the property value is to be read. + * @propname: name of the property to be searched. + * @index: index of the u32 in the list of values + * @outp: pointer to return value, modified only if return value is 0. + * + * Search for a property in a device node and read a 64-bit value from + * it. + * + * Return: + * 0 on success, -EINVAL if the property does not exist, or -EOVERFLOW if the + * property data isn't large enough. + */ +int of_read_u64_index(const struct device_node *np, const char *propname, + int index, u64 *outp); + +/** * of_read_u64() - Find and read a 64-bit integer from a property * * Search for a property in a device node and read a 64-bit value from diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h index 0f38b3e..06c969c 100644 --- a/include/dm/ofnode.h +++ b/include/dm/ofnode.h @@ -20,6 +20,7 @@ struct resource; #include <dm/ofnode_decl.h> +#include <linux/errno.h> struct ofnode_phandle_args { ofnode node; @@ -435,6 +436,18 @@ int ofnode_read_u32_index(ofnode node, const char *propname, int index, u32 *outp); /** + * ofnode_read_u64_index() - Read a 64-bit integer from a multi-value property + * + * @node: valid node reference to read property from + * @propname: name of the property to read from + * @index: index of the integer to return + * @outp: place to put value (if found) + * Return: 0 if OK, -ve on error + */ +int ofnode_read_u64_index(ofnode node, const char *propname, int index, + u64 *outp); + +/** * ofnode_read_s32() - Read a 32-bit integer from a property * * @node: valid node reference to read property from @@ -1198,15 +1211,15 @@ int ofnode_read_simple_size_cells(ofnode node); * determine if a node was bound in one of SPL/TPL stages. * * There are 4 settings currently in use - * - bootph-some-ram: U-Boot proper pre-relocation only + * - bootph-some-ram: U-Boot proper pre-relocation phase * - bootph-all: all phases * Existing platforms only use it to indicate nodes needed in * SPL. Should probably be replaced by bootph-pre-ram for new platforms. - * - bootph-pre-ram: SPL and U-Boot pre-relocation - * - bootph-pre-sram: TPL and U-Boot pre-relocation + * - bootph-pre-ram: SPL phase + * - bootph-pre-sram: TPL phase * * @node: node to check - * Return: true if node is needed in SPL/TL, false otherwise + * Return: true if node should be or was bound, false otherwise */ bool ofnode_pre_reloc(ofnode node); @@ -1500,6 +1513,47 @@ int ofnode_conf_read_int(const char *prop_name, int default_val); */ const char *ofnode_conf_read_str(const char *prop_name); +/** + * ofnode_read_bootscript_address() - Read bootscr-address or bootscr-ram-offset + * + * @bootscr_address: pointer to 64bit address where bootscr-address property value + * is stored + * @bootscr_offset: pointer to 64bit offset address where bootscr-ram-offset + * property value is stored + * + * This reads a bootscr-address or bootscr-ram-offset property from + * the /options/u-boot/ node of the devicetree. bootscr-address holds the full + * address of the boot script file. bootscr-ram-offset holds the boot script + * file offset from the start of the ram base address. When bootscr-address is + * defined, bootscr-ram-offset property is ignored. + * + * This only works with the control FDT. + * + * Return: 0 if OK, -EINVAL if property is not found. + */ +int ofnode_read_bootscript_address(u64 *bootscr_address, u64 *bootscr_offset); + +/** + * ofnode_read_bootscript_flash() - Read bootscr-flash-offset/size + * + * @bootscr_flash_offset: pointer to 64bit offset where bootscr-flash-offset + * property value is stored + * @bootscr_flash_size: pointer to 64bit size where bootscr-flash-size property + * value is stored + * + * This reads a bootscr-flash-offset and bootscr-flash-size properties from + * the /options/u-boot/ node of the devicetree. bootscr-flash-offset holds + * the offset of the boot script file from start of flash. bootscr-flash-size + * holds the boot script size in flash. When bootscr-flash-size is not defined, + * bootscr-flash-offset property is cleaned. + * + * This only works with the control FDT. + * + * Return: 0 if OK, -EINVAL if property is not found or incorrect. + */ +int ofnode_read_bootscript_flash(u64 *bootscr_flash_offset, + u64 *bootscr_flash_size); + #else /* CONFIG_DM */ static inline bool ofnode_conf_read_bool(const char *prop_name) { @@ -1516,6 +1570,17 @@ static inline const char *ofnode_conf_read_str(const char *prop_name) return NULL; } +static inline int ofnode_read_bootscript_address(u64 *bootscr_address, u64 *bootscr_offset) +{ + return -EINVAL; +} + +static inline int ofnode_read_bootscript_flash(u64 *bootscr_flash_offset, + u64 *bootscr_flash_size) +{ + return -EINVAL; +} + #endif /* CONFIG_DM */ /** diff --git a/include/dm/util.h b/include/dm/util.h index 4bb49e9..89206cc 100644 --- a/include/dm/util.h +++ b/include/dm/util.h @@ -27,14 +27,21 @@ struct list_head; int list_count_items(struct list_head *head); /** - * Dump out a tree of all devices + * Dump out a tree of all devices starting @uclass * + * @dev_name: udevice name + * @extended: true if forword-matching expected * @sort: Sort by uclass name */ -void dm_dump_tree(bool sort); +void dm_dump_tree(char *dev_name, bool extended, bool sort); -/* Dump out a list of uclasses and their devices */ -void dm_dump_uclass(void); +/* + * Dump out a list of uclasses and their devices + * + * @uclass: uclass name + * @extended: true if forword-matching expected + */ +void dm_dump_uclass(char *uclass, bool extended); #ifdef CONFIG_DEBUG_DEVRES /* Dump out a list of device resources */ diff --git a/include/dt-bindings/mux/ti-serdes.h b/include/dt-bindings/mux/ti-serdes.h index d3116c5..b0b1091 100644 --- a/include/dt-bindings/mux/ti-serdes.h +++ b/include/dt-bindings/mux/ti-serdes.h @@ -6,6 +6,14 @@ #ifndef _DT_BINDINGS_MUX_TI_SERDES #define _DT_BINDINGS_MUX_TI_SERDES +/* + * These bindings are deprecated, because they do not match the actual + * concept of bindings but rather contain pure constants values used only + * in DTS board files. + * Instead include the header in the DTS source directory. + */ +#warning "These bindings are deprecated. Instead, use the header in the DTS source directory." + /* J721E */ #define J721E_SERDES0_LANE0_QSGMII_LANE1 0x0 @@ -117,4 +125,66 @@ #define J721S2_SERDES0_LANE3_USB 0x2 #define J721S2_SERDES0_LANE3_IP4_UNUSED 0x3 +/* J784S4 */ + +#define J784S4_SERDES0_LANE0_IP1_UNUSED 0x0 +#define J784S4_SERDES0_LANE0_PCIE1_LANE0 0x1 +#define J784S4_SERDES0_LANE0_IP3_UNUSED 0x2 +#define J784S4_SERDES0_LANE0_IP4_UNUSED 0x3 + +#define J784S4_SERDES0_LANE1_IP1_UNUSED 0x0 +#define J784S4_SERDES0_LANE1_PCIE1_LANE1 0x1 +#define J784S4_SERDES0_LANE1_IP3_UNUSED 0x2 +#define J784S4_SERDES0_LANE1_IP4_UNUSED 0x3 + +#define J784S4_SERDES0_LANE2_PCIE3_LANE0 0x0 +#define J784S4_SERDES0_LANE2_PCIE1_LANE2 0x1 +#define J784S4_SERDES0_LANE2_IP3_UNUSED 0x2 +#define J784S4_SERDES0_LANE2_IP4_UNUSED 0x3 + +#define J784S4_SERDES0_LANE3_PCIE3_LANE1 0x0 +#define J784S4_SERDES0_LANE3_PCIE1_LANE3 0x1 +#define J784S4_SERDES0_LANE3_USB 0x2 +#define J784S4_SERDES0_LANE3_IP4_UNUSED 0x3 + +#define J784S4_SERDES1_LANE0_QSGMII_LANE3 0x0 +#define J784S4_SERDES1_LANE0_PCIE0_LANE0 0x1 +#define J784S4_SERDES1_LANE0_IP3_UNUSED 0x2 +#define J784S4_SERDES1_LANE0_IP4_UNUSED 0x3 + +#define J784S4_SERDES1_LANE1_QSGMII_LANE4 0x0 +#define J784S4_SERDES1_LANE1_PCIE0_LANE1 0x1 +#define J784S4_SERDES1_LANE1_IP3_UNUSED 0x2 +#define J784S4_SERDES1_LANE1_IP4_UNUSED 0x3 + +#define J784S4_SERDES1_LANE2_QSGMII_LANE1 0x0 +#define J784S4_SERDES1_LANE2_PCIE0_LANE2 0x1 +#define J784S4_SERDES1_LANE2_PCIE2_LANE0 0x2 +#define J784S4_SERDES1_LANE2_IP4_UNUSED 0x3 + +#define J784S4_SERDES1_LANE3_QSGMII_LANE2 0x0 +#define J784S4_SERDES1_LANE3_PCIE0_LANE3 0x1 +#define J784S4_SERDES1_LANE3_PCIE2_LANE1 0x2 +#define J784S4_SERDES1_LANE3_IP4_UNUSED 0x3 + +#define J784S4_SERDES2_LANE0_QSGMII_LANE5 0x0 +#define J784S4_SERDES2_LANE0_IP2_UNUSED 0x1 +#define J784S4_SERDES2_LANE0_IP3_UNUSED 0x2 +#define J784S4_SERDES2_LANE0_IP4_UNUSED 0x3 + +#define J784S4_SERDES2_LANE1_QSGMII_LANE6 0x0 +#define J784S4_SERDES2_LANE1_IP2_UNUSED 0x1 +#define J784S4_SERDES2_LANE1_IP3_UNUSED 0x2 +#define J784S4_SERDES2_LANE1_IP4_UNUSED 0x3 + +#define J784S4_SERDES2_LANE2_QSGMII_LANE7 0x0 +#define J784S4_SERDES2_LANE2_QSGMII_LANE1 0x1 +#define J784S4_SERDES2_LANE2_IP3_UNUSED 0x2 +#define J784S4_SERDES2_LANE2_IP4_UNUSED 0x3 + +#define J784S4_SERDES2_LANE3_QSGMII_LANE8 0x0 +#define J784S4_SERDES2_LANE3_QSGMII_LANE2 0x1 +#define J784S4_SERDES2_LANE3_IP3_UNUSED 0x2 +#define J784S4_SERDES2_LANE3_IP4_UNUSED 0x3 + #endif /* _DT_BINDINGS_MUX_TI_SERDES */ diff --git a/include/dwc3-omap-uboot.h b/include/dwc3-omap-uboot.h index 7c982e3..9e0e717 100644 --- a/include/dwc3-omap-uboot.h +++ b/include/dwc3-omap-uboot.h @@ -27,5 +27,5 @@ struct dwc3_omap_device { int dwc3_omap_uboot_init(struct dwc3_omap_device *dev); void dwc3_omap_uboot_exit(int index); -int dwc3_omap_uboot_interrupt_status(int index); +int dwc3_omap_uboot_interrupt_status(struct udevice *dev); #endif /* __DWC3_OMAP_UBOOT_H_ */ diff --git a/include/dwc3-uboot.h b/include/dwc3-uboot.h index e08530e..bb0436c 100644 --- a/include/dwc3-uboot.h +++ b/include/dwc3-uboot.h @@ -44,7 +44,7 @@ struct dwc3_device { int dwc3_uboot_init(struct dwc3_device *dev); void dwc3_uboot_exit(int index); -void dwc3_uboot_handle_interrupt(int index); +void dwc3_uboot_handle_interrupt(struct udevice *dev); struct phy; #if CONFIG_IS_ENABLED(PHY) && CONFIG_IS_ENABLED(DM_USB) diff --git a/include/env.h b/include/env.h index 1480efa..430c4fa 100644 --- a/include/env.h +++ b/include/env.h @@ -240,11 +240,6 @@ int eth_env_get_enetaddr(const char *name, uint8_t *enetaddr); int eth_env_set_enetaddr(const char *name, const uint8_t *enetaddr); /** - * env_fix_drivers() - Updates envdriver as per relocation - */ -void env_fix_drivers(void); - -/** * env_set_default_vars() - reset variables to their default value * * This resets individual variables to their value in the default environment @@ -357,14 +352,6 @@ char *env_get_default(const char *name); void env_set_default(const char *s, int flags); /** - * env_reloc() - Relocate the 'env' sub-commands - * - * This is used for those unfortunate archs with crappy toolchains - */ -void env_reloc(void); - - -/** * env_import_fdt() - Import environment values from device tree blob * * This uses the value of the environment variable "env_fdt_path" as a diff --git a/include/env/ti/default_findfdt.env b/include/env/ti/default_findfdt.env new file mode 100644 index 0000000..a2b51dd --- /dev/null +++ b/include/env/ti/default_findfdt.env @@ -0,0 +1,12 @@ +default_device_tree=CONFIG_DEFAULT_DEVICE_TREE +default_device_tree_arch=ti +#ifdef CONFIG_ARM64 +findfdt= + setenv name_fdt ${default_device_tree_arch}/${default_device_tree}.dtb; + setenv fdtfile ${name_fdt} +#else +default_device_tree_subarch=omap +findfdt= + setenv name_fdt ${default_device_tree_arch}/${default_device_tree_subarch}/${default_device_tree}.dtb; + setenv fdtfile ${name_fdt} +#endif diff --git a/include/env/ti/mmc.env b/include/env/ti/mmc.env index 6fb47fb..0256a2d 100644 --- a/include/env/ti/mmc.env +++ b/include/env/ti/mmc.env @@ -5,7 +5,9 @@ args_mmc=run finduuid;setenv bootargs console=${console} ${optargs} root=PARTUUID=${uuid} rw rootfstype=${mmcrootfstype} +#ifndef CONFIG_BOOTSTD loadbootscript=load mmc ${mmcdev} ${loadaddr} boot.scr +#endif bootscript=echo Running bootscript from mmc${mmcdev} ...; source ${loadaddr} bootenvfile=uEnv.txt @@ -15,10 +17,10 @@ loadbootenv=fatload mmc ${mmcdev} ${loadaddr} ${bootenvfile} loadimage=load ${devtype} ${bootpart} ${loadaddr} ${bootdir}/${bootfile} loadfdt=load ${devtype} ${bootpart} ${fdtaddr} ${bootdir}/dtb/${fdtfile} get_fdt_mmc=load mmc ${bootpart} ${fdtaddr} ${bootdir}/dtb/${name_fdt} -envboot=mmc dev ${mmcdev}; +envboot=if mmc dev ${mmcdev}; then if mmc rescan; then echo SD/MMC found on device ${mmcdev}; - if run loadbootscript; then + if test -n "${loadbootscript}" && run loadbootscript; then run bootscript; else if run loadbootenv; then @@ -31,6 +33,7 @@ envboot=mmc dev ${mmcdev}; fi; fi; fi; + fi; mmcloados= if test ${boot_fdt} = yes || test ${boot_fdt} = try; then if run get_fdt_mmc; then @@ -45,7 +48,7 @@ mmcloados= else bootz; fi; -mmcboot=mmc dev ${mmcdev}; +mmcboot=if mmc dev ${mmcdev}; then devnum=${mmcdev}; devtype=mmc; if mmc rescan; then @@ -58,7 +61,8 @@ mmcboot=mmc dev ${mmcdev}; run mmcloados; fi; fi; -fi; + fi; + fi; init_mmc=run args_all args_mmc get_overlay_mmc= diff --git a/include/env/ti/ti_armv7_common.env b/include/env/ti/ti_common.env index f5d8421..f5d8421 100644 --- a/include/env/ti/ti_armv7_common.env +++ b/include/env/ti/ti_common.env diff --git a/include/event.h b/include/event.h index f5c5d30..be4cefd 100644 --- a/include/event.h +++ b/include/event.h @@ -95,6 +95,28 @@ enum event_t { EVT_MISC_INIT_F, /** + * @EVT_FSP_INIT_F: + * This event is triggered before relocation to set up Firmware Support + * Package. + * Where U-Boot relies on binary blobs to handle part of the system + * init, this event can be used to set up the blobs. This is used on + * some Intel platforms + */ + EVT_FSP_INIT_F, + + /** + * @EVT_LAST_STAGE_INIT: + * This event is triggered just before jumping to the main loop. + * Some boards need to perform initialisation immediately before control + * is passed to the command-line interpreter (e.g. for init that depend + * on later phases in the init sequence). + * + * Some parts can be only initialized if all others (like Interrupts) + * are up and running (e.g. the PC-style ISA keyboard). + */ + EVT_LAST_STAGE_INIT, + + /** * @EVT_FPGA_LOAD: * The FPGA load hook is called after loading an FPGA with a new binary. * Its parameter is of type struct event_fpga_load and contains @@ -185,19 +207,48 @@ struct event { union event_data data; }; +/* Flags for event spy */ +enum evspy_flags { + EVSPYF_SIMPLE = 1 << 0, +}; + /** Function type for event handlers */ typedef int (*event_handler_t)(void *ctx, struct event *event); +/** Function type for simple event handlers */ +typedef int (*event_handler_simple_t)(void); + /** * struct evspy_info - information about an event spy * * @func: Function to call when the event is activated (must be first) * @type: Event type + * @flags: Flags for this spy * @id: Event id string */ struct evspy_info { event_handler_t func; - enum event_t type; + u8 type; + u8 flags; +#if CONFIG_IS_ENABLED(EVENT_DEBUG) + const char *id; +#endif +}; + +/** + * struct evspy_info_simple - information about an event spy + * + * THis is the 'simple' record, the only difference being the handler function + * + * @func: Function to call when the event is activated (must be first) + * @type: Event type + * @flags: Flags for this spy + * @id: Event id string + */ +struct evspy_info_simple { + event_handler_simple_t func; + u8 type; + u8 flags; #if CONFIG_IS_ENABLED(EVENT_DEBUG) const char *id; #endif @@ -205,9 +256,11 @@ struct evspy_info { /* Declare a new event spy */ #if CONFIG_IS_ENABLED(EVENT_DEBUG) -#define _ESPY_REC(_type, _func) { _func, _type, #_func, } +#define _ESPY_REC(_type, _func) { _func, _type, 0, #_func, } +#define _ESPY_REC_SIMPLE(_type, _func) { _func, _type, EVSPYF_SIMPLE, #_func, } #else #define _ESPY_REC(_type, _func) { _func, _type, } +#define _ESPY_REC_SIMPLE(_type, _func) { _func, _type, EVSPYF_SIMPLE } #endif static inline const char *event_spy_id(struct evspy_info *spy) @@ -250,10 +303,16 @@ static inline const char *event_spy_id(struct evspy_info *spy) * away the linker-list entry sometimes, e.g. with the EVT_FT_FIXUP entry in * vbe_simple.c - so for now, make it global. */ -#define EVENT_SPY(_type, _func) \ +#define EVENT_SPY_FULL(_type, _func) \ __used ll_entry_declare(struct evspy_info, _type ## _3_ ## _func, \ evspy_info) = _ESPY_REC(_type, _func) +/* Simple spy with no function arguemnts */ +#define EVENT_SPY_SIMPLE(_type, _func) \ + __used ll_entry_declare(struct evspy_info_simple, \ + _type ## _3_ ## _func, \ + evspy_info) = _ESPY_REC_SIMPLE(_type, _func) + /** * event_register - register a new spy * @@ -270,14 +329,12 @@ int event_register(const char *id, enum event_t type, event_handler_t func, void event_show_spy_list(void); /** - * event_manual_reloc() - Relocate event handler pointers - * - * Relocate event handler pointers for all static event spies. It is called - * during the generic board init sequence, after relocation. + * event_type_name() - Get the name of an event type * - * Return: 0 if OK + * @type: Type to check + * Return: Name of event, or "(unknown)" if not known */ -int event_manual_reloc(void); +const char *event_type_name(enum event_t type); /** * event_notify() - notify spies about an event diff --git a/include/expo.h b/include/expo.h index e8f7d7d..9d2e817 100644 --- a/include/expo.h +++ b/include/expo.h @@ -4,14 +4,13 @@ * Written by Simon Glass <sjg@chromium.org> */ -#ifndef __SCENE_H -#define __SCENE_H +#ifndef __EXPO_H +#define __EXPO_H #include <dm/ofnode_decl.h> #include <linux/list.h> struct udevice; -struct video_priv; /** * enum expoact_type - types of actions reported by the expo @@ -188,6 +187,8 @@ enum scene_obj_flags_t { * @type: Type of this object * @dim: Dimensions for this object * @flags: Flags for this object + * @bit_length: Number of bits used for this object in CMOS RAM + * @start_bit: Start bit to use for this object in CMOS RAM * @sibling: Node to link this object to its siblings */ struct scene_obj { @@ -196,7 +197,9 @@ struct scene_obj { uint id; enum scene_obj_t type; struct scene_dim dim; - int flags; + u8 flags; + u8 bit_length; + u16 start_bit; struct list_head sibling; }; @@ -676,24 +679,4 @@ int expo_apply_theme(struct expo *exp, ofnode node); */ int expo_build(ofnode root, struct expo **expp); -/** - * cedit_arange() - Arrange objects in a configuration-editor scene - * - * @exp: Expo to update - * @vid_priv: Private info of the video device - * @scene_id: scene ID to arrange - * Returns: 0 if OK, -ve on error - */ -int cedit_arange(struct expo *exp, struct video_priv *vid_priv, uint scene_id); - -/** - * cedit_run() - Run a configuration editor - * - * This accepts input until the user quits with Escape - * - * @exp: Expo to use - * Returns: 0 if OK, -ve on error - */ -int cedit_run(struct expo *exp); - -#endif /*__SCENE_H */ +#endif /*__EXPO_H */ diff --git a/include/fpga.h b/include/fpga.h index ed688cc..44f2755 100644 --- a/include/fpga.h +++ b/include/fpga.h @@ -60,8 +60,16 @@ int fpga_add(fpga_type devtype, void *desc); int fpga_count(void); const fpga_desc *const fpga_get_desc(int devnum); int fpga_is_partial_data(int devnum, size_t img_len); +#if CONFIG_IS_ENABLED(FPGA) int fpga_load(int devnum, const void *buf, size_t bsize, bitstream_type bstype, int flags); +#else +static inline int fpga_load(int devnum, const void *buf, size_t bsize, + bitstream_type bstype, int flags) +{ + return FPGA_FAIL; +} +#endif int fpga_fsload(int devnum, const void *buf, size_t size, fpga_fs_info *fpga_fsinfo); int fpga_loads(int devnum, const void *buf, size_t size, diff --git a/include/image.h b/include/image.h index 01a6787..5f85bf8 100644 --- a/include/image.h +++ b/include/image.h @@ -231,6 +231,7 @@ enum image_type_t { IH_TYPE_SUNXI_TOC0, /* Allwinner TOC0 Boot Image */ IH_TYPE_FDT_LEGACY, /* Binary Flat Device Tree Blob in a Legacy Image */ IH_TYPE_RENESAS_SPKG, /* Renesas SPKG image */ + IH_TYPE_STARFIVE_SPL, /* StarFive SPL image */ IH_TYPE_COUNT, /* Number of image types */ }; diff --git a/include/init.h b/include/init.h index 3bf3047..4e7fe26 100644 --- a/include/init.h +++ b/include/init.h @@ -58,17 +58,6 @@ int arch_cpu_init(void); int mach_cpu_init(void); /** - * arch_fsp_init() - perform firmware support package init - * - * Where U-Boot relies on binary blobs to handle part of the system init, this - * function can be used to set up the blobs. This is used on some Intel - * platforms. - * - * Return: 0 - */ -int arch_fsp_init(void); - -/** * arch_fsp_init() - perform post-relocation firmware support package init * * Where U-Boot relies on binary blobs to handle part of the system init, this @@ -281,15 +270,11 @@ void board_init_r(struct global_data *id, ulong dest_addr) __attribute__ ((noreturn)); int cpu_init_r(void); -int last_stage_init(void); int mac_read_from_eeprom(void); int set_cpu_clk_info(void); int update_flash_size(int flash_size); int arch_early_init_r(void); int misc_init_r(void); -#if defined(CONFIG_VID) -int init_func_vid(void); -#endif /* common/board_info.c */ int checkboard(void); diff --git a/include/initcall.h b/include/initcall.h index 69ce268..62d3bb6 100644 --- a/include/initcall.h +++ b/include/initcall.h @@ -6,52 +6,33 @@ #ifndef __INITCALL_H #define __INITCALL_H +#include <asm/types.h> +#include <event.h> + +_Static_assert(EVT_COUNT < 256, "Can only support 256 event types with 8 bits"); + +/** + * init_fnc_t - Init function + * + * Return: 0 if OK -ve on error + */ typedef int (*init_fnc_t)(void); -#include <log.h> -#ifdef CONFIG_EFI_APP -#include <efi.h> -#endif -#include <asm/global_data.h> +/* Top bit indicates that the initcall is an event */ +#define INITCALL_IS_EVENT GENMASK(BITS_PER_LONG - 1, 8) +#define INITCALL_EVENT_TYPE GENMASK(7, 0) -/* - * To enable debugging. add #define DEBUG at the top of the including file. +#define INITCALL_EVENT(_type) (void *)((_type) | INITCALL_IS_EVENT) + +/** + * initcall_run_list() - Run through a list of function calls * - * To find a symbol, use grep on u-boot.map + * This calls functions one after the other, stopping at the first error, or + * when NULL is obtained. + * + * @init_sequence: NULL-terminated init sequence to run + * Return: 0 if OK, or -ve error code from the first failure */ -static inline int initcall_run_list(const init_fnc_t init_sequence[]) -{ - const init_fnc_t *init_fnc_ptr; - - for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) { - unsigned long reloc_ofs = 0; - int ret; - - /* - * Sandbox is relocated by the OS, so symbols always appear at - * the relocated address. - */ - if (IS_ENABLED(CONFIG_SANDBOX) || (gd->flags & GD_FLG_RELOC)) - reloc_ofs = gd->reloc_off; -#ifdef CONFIG_EFI_APP - reloc_ofs = (unsigned long)image_base; -#endif - if (reloc_ofs) - debug("initcall: %p (relocated to %p)\n", - (char *)*init_fnc_ptr - reloc_ofs, - (char *)*init_fnc_ptr); - else - debug("initcall: %p\n", (char *)*init_fnc_ptr - reloc_ofs); - - ret = (*init_fnc_ptr)(); - if (ret) { - printf("initcall sequence %p failed at call %p (err=%d)\n", - init_sequence, - (char *)*init_fnc_ptr - reloc_ofs, ret); - return -1; - } - } - return 0; -} +int initcall_run_list(const init_fnc_t init_sequence[]); #endif diff --git a/include/linux/soc/ti/cppi5.h b/include/linux/soc/ti/cppi5.h index cfdf7ea..3a55c3e 100644 --- a/include/linux/soc/ti/cppi5.h +++ b/include/linux/soc/ti/cppi5.h @@ -11,6 +11,7 @@ #include <hexdump.h> #include <linux/bitops.h> #include <linux/bug.h> +#include <linux/printk.h> /** * Descriptor header, present in all types of descriptors diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index b3f4b8d..36572be 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb/gadget.h @@ -968,23 +968,23 @@ extern struct usb_ep *usb_ep_autoconfig(struct usb_gadget *, extern void usb_ep_autoconfig_reset(struct usb_gadget *); -extern int usb_gadget_handle_interrupts(int index); +extern int dm_usb_gadget_handle_interrupts(struct udevice *); -#if CONFIG_IS_ENABLED(DM_USB_GADGET) -int usb_gadget_initialize(int index); -int usb_gadget_release(int index); -int dm_usb_gadget_handle_interrupts(struct udevice *dev); -#else -#include <usb.h> -static inline int usb_gadget_initialize(int index) -{ - return board_usb_init(index, USB_INIT_DEVICE); -} +/** + * udc_device_get_by_index() - Get UDC udevice by index + * @index: UDC device index + * @udev: UDC udevice matching the index (if found) + * + * Return: 0 if Ok, -ve on error + */ +int udc_device_get_by_index(int index, struct udevice **udev); -static inline int usb_gadget_release(int index) -{ - return board_usb_cleanup(index, USB_INIT_DEVICE); -} -#endif +/** + * udc_device_put() - Put UDC udevice + * @udev: UDC udevice + * + * Return: 0 if Ok, -ve on error + */ +int udc_device_put(struct udevice *udev); #endif /* __LINUX_USB_GADGET_H */ diff --git a/include/nvmxip.h b/include/nvmxip.h index f4ef377..726fffe 100644 --- a/include/nvmxip.h +++ b/include/nvmxip.h @@ -29,4 +29,16 @@ struct nvmxip_plat { lbaint_t lba; }; +/** + * nvmxip_bind() - post binding treatments + * @dev: the NVMXIP device + * + * Create and probe a child block device. + * + * Return: + * + * 0 on success. Otherwise, failure + */ +int nvmxip_probe(struct udevice *udev); + #endif /* __DRIVER_NVMXIP_H__ */ diff --git a/include/os.h b/include/os.h index 968412b..fc8a1b1 100644 --- a/include/os.h +++ b/include/os.h @@ -98,6 +98,16 @@ int os_close(int fd); */ int os_unlink(const char *pathname); +/** os_persistent_fname() - Find the path to a test file + * + * @buf: Buffer to hold path + * @maxsize: Maximum size of buffer + * @fname: Leaf filename to find + * Returns: 0 on success, -ENOENT if file is not found, -ENOSPC if the buffer is + * too small + */ +int os_persistent_file(char *buf, int maxsize, const char *fname); + /** * os_exit() - access to the OS exit() system call * diff --git a/include/part.h b/include/part.h index 8e451bb..db34bc6 100644 --- a/include/part.h +++ b/include/part.h @@ -80,6 +80,93 @@ struct disk_partition { #endif }; +/* Accessors for struct disk_partition field ->uuid */ +extern char *__invalid_use_of_disk_partition_uuid; + +static inline const char *disk_partition_uuid(const struct disk_partition *info) +{ +#if CONFIG_IS_ENABLED(PARTITION_UUIDS) + return info->uuid; +#else + return __invalid_use_of_disk_partition_uuid; +#endif +} + +static inline void disk_partition_set_uuid(struct disk_partition *info, + const char *val) +{ +#if CONFIG_IS_ENABLED(PARTITION_UUIDS) + strlcpy(info->uuid, val, UUID_STR_LEN + 1); +#endif +} + +static inline void disk_partition_clr_uuid(struct disk_partition *info) +{ +#if CONFIG_IS_ENABLED(PARTITION_UUIDS) + *info->uuid = '\0'; +#endif +} + +/* Accessors for struct disk_partition field ->type_guid */ +extern char *__invalid_use_of_disk_partition_type_guid; + +/** + * disk_partition_type_guid() - get partition type GUID + * + * By using this function to get the partition type GUID we can use + * 'if (IS_ENABLED(CONFIG_PARTITION_TYPE_GUID))' instead of + * '#ifdef CONFIG_PARTITION_TYPE_GUID'. + * + * @info: partition information + * Return: partition type GUID + */ +static inline const +char *disk_partition_type_guid(const struct disk_partition *info) +{ +#ifdef CONFIG_PARTITION_TYPE_GUID + return info->type_guid; +#else + return __invalid_use_of_disk_partition_type_guid; +#endif +} + +/** + * disk_partition_set_type_guid() - set partition type GUID + * + * By using this function to set the partition type GUID we can use + * 'if (IS_ENABLED(CONFIG_PARTITION_TYPE_GUID))' instead of + * '#ifdef CONFIG_PARTITION_TYPE_GUID'. + * + * @info: partition information + * @val: partition type GUID as string + */ +static inline void disk_partition_set_type_guid(struct disk_partition *info, + const char *val) +{ +#ifdef CONFIG_PARTITION_TYPE_GUID + strlcpy(info->type_guid, val, UUID_STR_LEN + 1); +#endif +} + +static inline void disk_partition_clr_type_guid(struct disk_partition *info) +{ +#ifdef CONFIG_PARTITION_TYPE_GUID + *info->type_guid = '\0'; +#endif +} + +/* Accessors for struct disk_partition field ->sys_ind */ +extern int __invalid_use_of_disk_partition_sys_ind; + +static inline uint disk_partition_sys_ind(const struct disk_partition *info) +{ +#ifdef CONFIG_DOS_PARTITION + return info->sys_ind; +#else + return __invalid_use_of_disk_partition_sys_ind; +#endif +} + struct disk_part { int partnum; struct disk_partition gpt_part_info; @@ -113,7 +200,7 @@ struct blk_desc *mg_disk_get_dev(int dev); * contained with the interface's data structure. There is no global * numbering for block devices, so the interface name must be provided. * - * @dev_desc: Block device descriptor + * @desc: Block device descriptor * @part: Partition number to read * @part_type: Partition driver to use, or PART_TYPE_UNKNOWN to automatically * choose a driver @@ -121,24 +208,24 @@ struct blk_desc *mg_disk_get_dev(int dev); * * Return: 0 on success, negative errno on failure */ -int part_get_info_by_type(struct blk_desc *dev_desc, int part, int part_type, +int part_get_info_by_type(struct blk_desc *desc, int part, int part_type, struct disk_partition *info); -int part_get_info(struct blk_desc *dev_desc, int part, +int part_get_info(struct blk_desc *desc, int part, struct disk_partition *info); /** * part_get_info_whole_disk() - get partition info for the special case of * a partition occupying the entire disk. * - * @dev_desc: block device descriptor + * @desc: block device descriptor * @info: returned partition information * Return: 0 on success */ -int part_get_info_whole_disk(struct blk_desc *dev_desc, +int part_get_info_whole_disk(struct blk_desc *desc, struct disk_partition *info); -void part_print(struct blk_desc *dev_desc); -void part_init(struct blk_desc *dev_desc); -void dev_print(struct blk_desc *dev_desc); +void part_print(struct blk_desc *desc); +void part_init(struct blk_desc *desc); +void dev_print(struct blk_desc *desc); /** * blk_get_device_by_str() - Get a block device given its interface/hw partition @@ -162,11 +249,11 @@ void dev_print(struct blk_desc *dev_desc); * containing the device number (e.g. "2") or the device number * and hardware partition number (e.g. "2.4") for devices that * support it (currently only MMC). - * @dev_desc: Returns a pointer to the block device on success + * @desc: Returns a pointer to the block device on success * Return: block device number (local to the interface), or -1 on error */ int blk_get_device_by_str(const char *ifname, const char *dev_str, - struct blk_desc **dev_desc); + struct blk_desc **desc); /** * blk_get_device_part_str() - Get a block device and partition @@ -196,7 +283,7 @@ int blk_get_device_by_str(const char *ifname, const char *dev_str, * * @ifname: Interface name (e.g. "ide", "scsi") * @dev_part_str: Device and partition string - * @dev_desc: Returns a pointer to the block device on success + * @desc: Returns a pointer to the block device on success * @info: Returns partition information * @allow_whole_dev: true to allow the user to select partition 0 * (which means the whole device), false to require a valid @@ -205,22 +292,22 @@ int blk_get_device_by_str(const char *ifname, const char *dev_str, * */ int blk_get_device_part_str(const char *ifname, const char *dev_part_str, - struct blk_desc **dev_desc, + struct blk_desc **desc, struct disk_partition *info, int allow_whole_dev); /** * part_get_info_by_name() - Search for a partition by name * among all available registered partitions * - * @dev_desc: block device descriptor + * @desc: block device descriptor * @name: the specified table entry name * @info: returns the disk partition info * * Return: the partition number on match (starting on 1), -1 on no match, * otherwise error */ -int part_get_info_by_name(struct blk_desc *dev_desc, - const char *name, struct disk_partition *info); +int part_get_info_by_name(struct blk_desc *desc, const char *name, + struct disk_partition *info); /** * part_get_info_by_dev_and_name_or_num() - Get partition info from dev number @@ -232,11 +319,11 @@ int part_get_info_by_name(struct blk_desc *dev_desc, * (like "device_num#partition_name") or a device number plus a partition number * separated by a ":". For example both "0#misc" and "0:1" can be valid * partition descriptions for a given interface. If the partition is found, sets - * dev_desc and part_info accordingly with the information of the partition. + * desc and part_info accordingly with the information of the partition. * * @dev_iface: Device interface * @dev_part_str: Input partition description, like "0#misc" or "0:1" - * @dev_desc: Place to store the device description pointer + * @desc: Place to store the device description pointer * @part_info: Place to store the partition information * @allow_whole_dev: true to allow the user to select partition 0 * (which means the whole device), false to require a valid @@ -245,7 +332,7 @@ int part_get_info_by_name(struct blk_desc *dev_desc, */ int part_get_info_by_dev_and_name_or_num(const char *dev_iface, const char *dev_part_str, - struct blk_desc **dev_desc, + struct blk_desc **desc, struct disk_partition *part_info, int allow_whole_dev); @@ -256,12 +343,12 @@ int part_get_info_by_dev_and_name_or_num(const char *dev_iface, * (DOS, ISO). Generates partition name out of the device type and partition * number. * - * @dev_desc: pointer to the block device + * @desc: pointer to the block device * @part_num: partition number for which the name is generated * @name: buffer where the name is written */ -void part_set_generic_name(const struct blk_desc *dev_desc, - int part_num, char *name); +void part_set_generic_name(const struct blk_desc *desc, int part_num, + char *name); extern const struct block_drvr block_drvr[]; #else @@ -269,26 +356,25 @@ static inline struct blk_desc *blk_get_dev(const char *ifname, int dev) { return NULL; } static inline struct blk_desc *mg_disk_get_dev(int dev) { return NULL; } -static inline int part_get_info(struct blk_desc *dev_desc, int part, +static inline int part_get_info(struct blk_desc *desc, int part, struct disk_partition *info) { return -1; } -static inline int part_get_info_whole_disk(struct blk_desc *dev_desc, +static inline int part_get_info_whole_disk(struct blk_desc *desc, struct disk_partition *info) { return -1; } -static inline void part_print(struct blk_desc *dev_desc) {} -static inline void part_init(struct blk_desc *dev_desc) {} -static inline void dev_print(struct blk_desc *dev_desc) {} +static inline void part_print(struct blk_desc *desc) {} +static inline void part_init(struct blk_desc *desc) {} +static inline void dev_print(struct blk_desc *desc) {} static inline int blk_get_device_by_str(const char *ifname, const char *dev_str, - struct blk_desc **dev_desc) + struct blk_desc **desc) { return -1; } static inline int blk_get_device_part_str(const char *ifname, const char *dev_part_str, - struct blk_desc **dev_desc, + struct blk_desc **desc, struct disk_partition *info, int allow_whole_dev) -{ *dev_desc = NULL; return -1; } +{ *desc = NULL; return -1; } -static inline int part_get_info_by_name(struct blk_desc *dev_desc, - const char *name, +static inline int part_get_info_by_name(struct blk_desc *desc, const char *name, struct disk_partition *info) { return -ENOENT; @@ -297,34 +383,17 @@ static inline int part_get_info_by_name(struct blk_desc *dev_desc, static inline int part_get_info_by_dev_and_name_or_num(const char *dev_iface, const char *dev_part_str, - struct blk_desc **dev_desc, + struct blk_desc **desc, struct disk_partition *part_info, int allow_whole_dev) { - *dev_desc = NULL; + *desc = NULL; return -ENOSYS; } #endif -/** - * part_get_bootable() - Find the first bootable partition - * - * @desc: Block-device descriptor - * @return first bootable partition, or 0 if there is none - */ -int part_get_bootable(struct blk_desc *desc); - struct udevice; /** - * part_create_block_devices - Create block devices for disk partitions - * - * Create UCLASS_PARTITION udevices for each of disk partitions in @parent - * - * @blk_dev: Whole disk device - */ -int part_create_block_devices(struct udevice *blk_dev); - -/** * disk_blk_read() - read blocks from a disk partition * * @dev: Device to read from (UCLASS_PARTITION) @@ -391,29 +460,29 @@ struct part_driver { /** * @get_info: Get information about a partition * - * @get_info.dev_desc: Block device descriptor + * @get_info.desc: Block device descriptor * @get_info.part: Partition number (1 = first) * @get_info.info: Returns partition information */ - int (*get_info)(struct blk_desc *dev_desc, int part, + int (*get_info)(struct blk_desc *desc, int part, struct disk_partition *info); /** * @print: Print partition information * - * @print.dev_desc: Block device descriptor + * @print.desc: Block device descriptor */ - void (*print)(struct blk_desc *dev_desc); + void (*print)(struct blk_desc *desc); /** * @test: Test if a device contains this partition type * - * @test.dev_desc: Block device descriptor + * @test.desc: Block device descriptor * @test.Return: * 0 if the block device appears to contain this partition type, * -ve if not */ - int (*test)(struct blk_desc *dev_desc); + int (*test)(struct blk_desc *desc); }; /* Declare a new U-Boot partition 'driver' */ @@ -427,19 +496,18 @@ struct part_driver { /** * write_gpt_table() - Write the GUID Partition Table to disk * - * @dev_desc: block device descriptor + * @desc: block device descriptor * @gpt_h: pointer to GPT header representation * @gpt_e: pointer to GPT partition table entries * * Return: zero on success, otherwise error */ -int write_gpt_table(struct blk_desc *dev_desc, - gpt_header *gpt_h, gpt_entry *gpt_e); +int write_gpt_table(struct blk_desc *desc, gpt_header *gpt_h, gpt_entry *gpt_e); /** * gpt_fill_pte() - Fill the GPT partition table entry * - * @dev_desc: block device descriptor + * @desc: block device descriptor * @gpt_h: GPT header representation * @gpt_e: GPT partition table entries * @partitions: list of partitions @@ -447,55 +515,54 @@ int write_gpt_table(struct blk_desc *dev_desc, * * Return: zero on success */ -int gpt_fill_pte(struct blk_desc *dev_desc, - gpt_header *gpt_h, gpt_entry *gpt_e, +int gpt_fill_pte(struct blk_desc *desc, gpt_header *gpt_h, gpt_entry *gpt_e, struct disk_partition *partitions, int parts); /** * gpt_fill_header() - Fill the GPT header * - * @dev_desc: block device descriptor + * @desc: block device descriptor * @gpt_h: GPT header representation * @str_guid: disk guid string representation * @parts_count: number of partitions * * Return: error on str_guid conversion error */ -int gpt_fill_header(struct blk_desc *dev_desc, gpt_header *gpt_h, - char *str_guid, int parts_count); +int gpt_fill_header(struct blk_desc *desc, gpt_header *gpt_h, char *str_guid, + int parts_count); /** * gpt_restore() - Restore GPT partition table * - * @dev_desc: block device descriptor + * @desc: block device descriptor * @str_disk_guid: disk GUID * @partitions: list of partitions * @parts_count: number of partitions * * Return: 0 on success */ -int gpt_restore(struct blk_desc *dev_desc, char *str_disk_guid, +int gpt_restore(struct blk_desc *desc, char *str_disk_guid, struct disk_partition *partitions, const int parts_count); /** * is_valid_gpt_buf() - Ensure that the Primary GPT information is valid * - * @dev_desc: block device descriptor + * @desc: block device descriptor * @buf: buffer which contains the MBR and Primary GPT info * * Return: 0 on success, otherwise error */ -int is_valid_gpt_buf(struct blk_desc *dev_desc, void *buf); +int is_valid_gpt_buf(struct blk_desc *desc, void *buf); /** * write_mbr_and_gpt_partitions() - write MBR, Primary GPT and Backup GPT * - * @dev_desc: block device descriptor + * @desc: block device descriptor * @buf: buffer which contains the MBR and Primary GPT info * * Return: 0 on success, otherwise error */ -int write_mbr_and_gpt_partitions(struct blk_desc *dev_desc, void *buf); +int write_mbr_and_gpt_partitions(struct blk_desc *desc, void *buf); /** * gpt_verify_headers() - Read and check CRC32 of the GPT's header @@ -503,24 +570,24 @@ int write_mbr_and_gpt_partitions(struct blk_desc *dev_desc, void *buf); * * As a side effect if sets gpt_head and gpt_pte so they point to GPT data. * - * @dev_desc: block device descriptor + * @desc: block device descriptor * @gpt_head: pointer to GPT header data read from medium * @gpt_pte: pointer to GPT partition table enties read from medium * * Return: 0 on success, otherwise error */ -int gpt_verify_headers(struct blk_desc *dev_desc, gpt_header *gpt_head, +int gpt_verify_headers(struct blk_desc *desc, gpt_header *gpt_head, gpt_entry **gpt_pte); /** * gpt_repair_headers() - Function to repair the GPT's header * and partition table entries (PTE) * - * @dev_desc: block device descriptor + * @desc: block device descriptor * * Return: 0 on success, otherwise error */ -int gpt_repair_headers(struct blk_desc *dev_desc); +int gpt_repair_headers(struct blk_desc *desc); /** * gpt_verify_partitions() - Function to check if partitions' name, start and @@ -530,7 +597,7 @@ int gpt_repair_headers(struct blk_desc *dev_desc); * provided in '$partitions' environment variable. Specificially, name, start * and size of the partition is checked. * - * @dev_desc: block device descriptor + * @desc: block device descriptor * @partitions: partition data read from '$partitions' env variable * @parts: number of partitions read from '$partitions' env variable * @gpt_head: pointer to GPT header data read from medium @@ -538,7 +605,7 @@ int gpt_repair_headers(struct blk_desc *dev_desc); * * Return: 0 on success, otherwise error */ -int gpt_verify_partitions(struct blk_desc *dev_desc, +int gpt_verify_partitions(struct blk_desc *desc, struct disk_partition *partitions, int parts, gpt_header *gpt_head, gpt_entry **gpt_pte); @@ -549,12 +616,12 @@ int gpt_verify_partitions(struct blk_desc *dev_desc, * This function reads the GUID string from a block device whose descriptor * is provided. * - * @dev_desc: block device descriptor + * @desc: block device descriptor * @guid: pre-allocated string in which to return the GUID * * Return: 0 on success, otherwise error */ -int get_disk_guid(struct blk_desc *dev_desc, char *guid); +int get_disk_guid(struct blk_desc *desc, char *guid); #endif @@ -571,12 +638,12 @@ int is_valid_dos_buf(void *buf); /** * write_mbr_sector() - write DOS MBR * - * @dev_desc: block device descriptor + * @desc: block device descriptor * @buf: buffer which contains the MBR * * Return: 0 on success, otherwise error */ -int write_mbr_sector(struct blk_desc *dev_desc, void *buf); +int write_mbr_sector(struct blk_desc *desc, void *buf); int write_mbr_partitions(struct blk_desc *dev, struct disk_partition *p, int count, unsigned int disksig); @@ -615,12 +682,24 @@ static inline struct part_driver *part_driver_get_first(void) */ int part_get_type_by_name(const char *name); +/** + * part_get_bootable() - Find the first bootable partition + * + * @desc: Block-device descriptor + * @return first bootable partition, or 0 if there is none + */ +int part_get_bootable(struct blk_desc *desc); + #else static inline int part_driver_get_count(void) { return 0; } static inline struct part_driver *part_driver_get_first(void) { return NULL; } + +static inline bool part_get_bootable(struct blk_desc *desc) +{ return false; } + #endif /* CONFIG_PARTITIONS */ #endif /* _PART_H */ diff --git a/include/part_efi.h b/include/part_efi.h index c68529b..59b7895 100644 --- a/include/part_efi.h +++ b/include/part_efi.h @@ -60,6 +60,20 @@ EFI_GUID( 0x3de21764, 0x95bd, 0x54bd, \ 0xa5, 0xc3, 0x4a, 0xbe, 0x78, 0x6f, 0x38, 0xa8) +/* Special ChromiumOS things */ +#define PARTITION_CROS_KERNEL \ + EFI_GUID(0xfe3a2a5d, 0x4f32, 0x41a7, \ + 0xb7, 0x25, 0xac, 0xcc, 0x32, 0x85, 0xa3, 0x09) +#define PARTITION_CROS_ROOT \ + EFI_GUID(0x3cb8e202, 0x3b7e, 0x47dd, \ + 0x8a, 0x3c, 0x7f, 0xf2, 0xa1, 0x3c, 0xfc, 0xec) +#define PARTITION_CROS_FIRMWARE \ + EFI_GUID(0xcab6e88e, 0xabf3, 0x4102, \ + 0xa0, 0x7a, 0xd4, 0xbb, 0x9b, 0xe3, 0xc1, 0xd3) +#define PARTITION_CROS_RESERVED \ + EFI_GUID(0x2e0a753d, 0x9e48, 0x43b0, \ + 0x83, 0x37, 0xb1, 0x51, 0x92, 0xcb, 0x1b, 0x5e) + /* linux/include/efi.h */ typedef u16 efi_char16_t; diff --git a/include/phy.h b/include/phy.h index f023a3c..27effdb 100644 --- a/include/phy.h +++ b/include/phy.h @@ -172,14 +172,6 @@ struct fixed_link { }; /** - * phy_init() - Initializes the PHY drivers - * This function registers all available PHY drivers - * - * @return: 0 if OK, -ve on error - */ -int phy_init(void); - -/** * phy_reset() - Resets the specified PHY * Issues a reset of the PHY and waits for it to complete * diff --git a/include/post.h b/include/post.h index 4112069..6e88d55 100644 --- a/include/post.h +++ b/include/post.h @@ -105,9 +105,6 @@ void post_bootmode_clear (void); int post_run (char *name, int flags); int post_info (char *name); int post_log (char *format, ...); -#ifdef CONFIG_NEEDS_MANUAL_RELOC -void post_reloc (void); -#endif unsigned long post_time_ms (unsigned long base); /** diff --git a/include/relocate.h b/include/relocate.h index 2dbfd90..8ca25e1 100644 --- a/include/relocate.h +++ b/include/relocate.h @@ -39,28 +39,4 @@ int clear_bss(void); */ int do_elf_reloc_fixups(void); -/** - * manual_reloc() - Manually relocate a pointer if needed - * - * This is a nop in almost all cases, except for the systems with a broken gcc - * which need to manually relocate some things. - * - * @ptr: Pointer to relocate - * Return: new pointer value - */ -static inline void *manual_reloc(void *ptr) -{ -#ifndef USE_HOSTCC - if (IS_ENABLED(CONFIG_NEEDS_MANUAL_RELOC)) - return ptr + gd->reloc_off; -#endif - return ptr; -} - -#if !defined(USE_HOSTCC) && defined(CONFIG_NEEDS_MANUAL_RELOC) -#define MANUAL_RELOC(ptr) (ptr) = manual_reloc(ptr) -#else -#define MANUAL_RELOC(ptr) (void)(ptr) -#endif - #endif /* _RELOCATE_H_ */ diff --git a/include/sandbox_efi_capsule.h b/include/sandbox_efi_capsule.h new file mode 100644 index 0000000..3e288e8 --- /dev/null +++ b/include/sandbox_efi_capsule.h @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (c) 2023, Linaro Limited + */ + +#if !defined(_SANDBOX_EFI_CAPSULE_H_) +#define _SANDBOX_EFI_CAPSULE_H_ + +#define SANDBOX_UBOOT_IMAGE_GUID "09d7cf52-0720-4710-91d1-08469b7fe9c8" +#define SANDBOX_UBOOT_ENV_IMAGE_GUID "5a7021f5-fef2-48b4-aaba-832e777418c0" +#define SANDBOX_FIT_IMAGE_GUID "3673b45d-6a7c-46f3-9e60-adabb03f7937" +#define SANDBOX_INCORRECT_GUID "058b7d83-50d5-4c47-a195-60d86ad341c4" + +#define UBOOT_FIT_IMAGE "u-boot_bin_env.itb" + +#define CAPSULE_PRIV_KEY "capsule_priv_key_good.key" +#define CAPSULE_PUB_KEY "capsule_pub_key_good.crt" +#define CAPSULE_INVAL_KEY "capsule_priv_key_bad.key" +#define CAPSULE_INVAL_PUB_KEY "capsule_pub_key_bad.crt" + +#endif /* _SANDBOX_EFI_CAPSULE_H_ */ diff --git a/include/scsi.h b/include/scsi.h index 9efefea..ee9d622 100644 --- a/include/scsi.h +++ b/include/scsi.h @@ -7,6 +7,7 @@ #define _SCSI_H #include <asm/cache.h> +#include <bouncebuf.h> #include <linux/dma-direction.h> /* Fix this to the maximum */ @@ -298,6 +299,24 @@ struct scsi_ops { * @return 0 if OK, -ve on error */ int (*bus_reset)(struct udevice *dev); + +#if IS_ENABLED(CONFIG_BOUNCE_BUFFER) + /** + * buffer_aligned() - test memory alignment of block operation buffer + * + * Some devices have limited DMA capabilities and require that the + * buffers passed to them fit specific properties. This optional + * callback can be used to indicate whether a buffer alignment is + * suitable for the device DMA or not, and trigger use of generic + * bounce buffer implementation to help use of unsuitable buffers + * at the expense of performance degradation. + * + * @dev: Block device associated with the request + * @state: Bounce buffer state + * @return 1 if OK, 0 if unaligned + */ + int (*buffer_aligned)(struct udevice *dev, struct bounce_buffer *state); +#endif /* CONFIG_BOUNCE_BUFFER */ }; #define scsi_get_ops(dev) ((struct scsi_ops *)(dev)->driver->ops) diff --git a/include/sdp.h b/include/sdp.h index 6d89baa..5492f9c 100644 --- a/include/sdp.h +++ b/include/sdp.h @@ -9,15 +9,15 @@ #ifndef __SDP_H_ #define __SDP_H_ -int sdp_init(int controller_index); +int sdp_init(struct udevice *udc); #ifdef CONFIG_SPL_BUILD #include <spl.h> -int spl_sdp_handle(int controller_index, struct spl_image_info *spl_image, +int spl_sdp_handle(struct udevice *udc, struct spl_image_info *spl_image, struct spl_boot_device *bootdev); #else -int sdp_handle(int controller_index); +int sdp_handle(struct udevice *udc); #endif #endif /* __SDP_H_ */ diff --git a/include/spl.h b/include/spl.h index 93e9064..0fedddd 100644 --- a/include/spl.h +++ b/include/spl.h @@ -484,7 +484,7 @@ unsigned long spl_mmc_get_uboot_raw_sector(struct mmc *mmc, * spl_set_header_raw_uboot() - Set up a standard SPL image structure * * This sets up the given spl_image which the standard values obtained from - * config options: CONFIG_SYS_MONITOR_LEN, CFG_SYS_UBOOT_START, + * config options: CONFIG_SYS_MONITOR_LEN, CONFIG_SYS_UBOOT_START, * CONFIG_TEXT_BASE. * * @spl_image: Image description to set up diff --git a/include/thor.h b/include/thor.h index ee67ab0..3cb56b6 100644 --- a/include/thor.h +++ b/include/thor.h @@ -14,7 +14,7 @@ #define THOR_DFU_REINIT_NEEDED 0xFFFFFFFE -int thor_handle(void); -int thor_init(void); +int thor_handle(struct udevice *udc); +int thor_init(struct udevice *udc); int thor_add(struct usb_configuration *c); #endif /* __THOR_H_ */ diff --git a/include/usb_mass_storage.h b/include/usb_mass_storage.h index 08ccc97..83ab93b 100644 --- a/include/usb_mass_storage.h +++ b/include/usb_mass_storage.h @@ -25,7 +25,7 @@ struct ums { struct blk_desc block_dev; }; -int fsg_init(struct ums *ums_devs, int count, unsigned int controller_idx); +int fsg_init(struct ums *ums_devs, int count, struct udevice *udc); void fsg_cleanup(void); int fsg_main_thread(void *); int fsg_add(struct usb_configuration *c); diff --git a/include/uuid.h b/include/uuid.h index 89b93e6..f5a9412 100644 --- a/include/uuid.h +++ b/include/uuid.h @@ -12,6 +12,51 @@ #include <linux/bitops.h> +/* + * UUID - Universally Unique IDentifier - 128 bits unique number. + * There are 5 versions and one variant of UUID defined by RFC4122 + * specification. A UUID contains a set of fields. The set varies + * depending on the version of the UUID, as shown below: + * - time, MAC address(v1), + * - user ID(v2), + * - MD5 of name or URL(v3), + * - random data(v4), + * - SHA-1 of name or URL(v5), + * + * Layout of UUID: + * timestamp - 60-bit: time_low, time_mid, time_hi_and_version + * version - 4 bit (bit 4 through 7 of the time_hi_and_version) + * clock seq - 14 bit: clock_seq_hi_and_reserved, clock_seq_low + * variant: - bit 6 and 7 of clock_seq_hi_and_reserved + * node - 48 bit + * + * source: https://www.ietf.org/rfc/rfc4122.txt + * + * UUID binary format (16 bytes): + * + * 4B-2B-2B-2B-6B (big endian - network byte order) + * + * UUID string is 36 length of characters (36 bytes): + * + * 0 9 14 19 24 + * xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx + * be be be be be + * + * where x is a hexadecimal character. Fields are separated by '-'s. + * When converting to a binary UUID, le means the field should be converted + * to little endian and be means it should be converted to big endian. + * + * UUID is also used as GUID (Globally Unique Identifier) with the same binary + * format but it differs in string format like below. + * + * GUID: + * 0 9 14 19 24 + * xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx + * le le le be be + * + * GUID is used e.g. in GPT (GUID Partition Table) as a partiions unique id. + */ + /* This is structure is in big-endian */ struct uuid { unsigned int time_low; @@ -40,20 +85,78 @@ struct uuid { #define UUID_VARIANT 0x1 int uuid_str_valid(const char *uuid); + +/* + * uuid_str_to_bin() - convert string UUID or GUID to big endian binary data. + * + * @param uuid_str - pointer to UUID or GUID string [37B] or GUID shorcut + * @param uuid_bin - pointer to allocated array for big endian output [16B] + * @str_format - UUID string format: 0 - UUID; 1 - GUID + * Return: 0 if OK, -EINVAL if the string is not a valid UUID + */ int uuid_str_to_bin(const char *uuid_str, unsigned char *uuid_bin, int str_format); + +/* + * uuid_bin_to_str() - convert big endian binary data to string UUID or GUID. + * + * @param uuid_bin: pointer to binary data of UUID (big endian) [16B] + * @param uuid_str: pointer to allocated array for output string [37B] + * @str_format: bit 0: 0 - UUID; 1 - GUID + * bit 1: 0 - lower case; 2 - upper case + */ void uuid_bin_to_str(const unsigned char *uuid_bin, char *uuid_str, int str_format); + +/* + * uuid_guid_get_bin() - this function get GUID bin for string + * + * @param guid_str - pointer to partition type string + * @param guid_bin - pointer to allocated array for big endian output [16B] + */ int uuid_guid_get_bin(const char *guid_str, unsigned char *guid_bin); + +/* + * uuid_guid_get_str() - this function get string for GUID. + * + * @param guid_bin - pointer to string with partition type guid [16B] + * + * Returns NULL if the type GUID is not known. + */ const char *uuid_guid_get_str(const unsigned char *guid_bin); + +/* + * gen_rand_uuid() - this function generates a random binary UUID version 4. + * In this version all fields beside 4 bits of version and + * 2 bits of variant are randomly generated. + * + * @param uuid_bin - pointer to allocated array [16B]. Output is in big endian. + */ void gen_rand_uuid(unsigned char *uuid_bin); + +/* + * gen_rand_uuid_str() - this function generates UUID v4 (random) in two string + * formats UUID or GUID. + * + * @param uuid_str - pointer to allocated array [37B]. + * @param - uuid output type: UUID - 0, GUID - 1 + */ void gen_rand_uuid_str(char *uuid_str, int str_format); /** * uuid_str_to_le_bin() - Convert string UUID to little endian binary data. * @uuid_str: pointer to UUID string * @uuid_bin: pointer to allocated array for little endian output [16B] + * + * UUID string is 36 characters (36 bytes): + * + * xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx + * + * where x is a hexadecimal character. Fields are separated by '-'s. + * When converting to a little endian binary UUID, the string fields are reversed. + * * Return: + * * uuid_bin filled with little endian UUID data * On success 0 is returned. Otherwise, failure code. */ diff --git a/include/video.h b/include/video.h index 16f7a83..5048116 100644 --- a/include/video.h +++ b/include/video.h @@ -58,7 +58,7 @@ enum video_log2_bpp { * Convert enum video_log2_bpp to bytes and bits. Note we omit the outer * brackets to allow multiplication by fractional pixels. */ -#define VNBYTES(bpix) (1 << (bpix)) / 8 +#define VNBYTES(bpix) ((1 << (bpix)) / 8) #define VNBITS(bpix) (1 << (bpix)) diff --git a/include/zynqmp_firmware.h b/include/zynqmp_firmware.h index 18a87d2..73198a6 100644 --- a/include/zynqmp_firmware.h +++ b/include/zynqmp_firmware.h @@ -456,6 +456,7 @@ int zynqmp_pm_set_gem_config(u32 node, enum pm_gem_config_type config, int zynqmp_pm_is_function_supported(const u32 api_id, const u32 id); int zynqmp_mmio_read(const u32 address, u32 *value); int zynqmp_mmio_write(const u32 address, const u32 mask, const u32 value); +int zynqmp_pm_feature(const u32 api_id); /* Type of Config Object */ #define PM_CONFIG_OBJECT_TYPE_BASE 0x1U @@ -492,6 +493,8 @@ enum zynqmp_pm_request_ack { /* PM API versions */ #define PM_API_VERSION_2 2 +#define PM_PINCTRL_PARAM_SET_VERSION 2 + struct zynqmp_ipi_msg { size_t len; u32 *buf; diff --git a/lib/Kconfig b/lib/Kconfig index 07e61de..79cf9ef 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -289,6 +289,14 @@ config ACPI not necessarily include generation of tables (see GENERATE_ACPI_TABLE), but allows for tables to be located. +config SPL_ACPI + bool "Enable support for ACPI libraries in SPL" + depends on SPL && SUPPORT_ACPI + help + Provides library functions for dealing with ACPI tables in SPL. This + does not necessarily include generation of tables + (see GENERATE_ACPI_TABLE), but allows for tables to be located. + config GENERATE_ACPI_TABLE bool "Generate an ACPI (Advanced Configuration and Power Interface) table" depends on ACPI @@ -862,7 +870,7 @@ config OF_LIBFDT config OF_LIBFDT_ASSUME_MASK hex "Mask of conditions to assume for libfdt" depends on OF_LIBFDT || FIT - default 0 + default 0x0 help Use this to change the assumptions made by libfdt about the device tree it is working with. A value of 0 means that no assumptions @@ -953,15 +961,6 @@ config VPL_OF_LIBFDT_ASSUME_MASK 0xff means all assumptions are made and any invalid data may cause unsafe execution. See FDT_ASSUME_PERFECT, etc. in libfdt_internal.h -config FDT_FIXUP_PARTITIONS - bool "overwrite MTD partitions in DTS through defined in 'mtdparts'" - depends on OF_LIBFDT - depends on CMD_MTDPARTS - help - Allow overwriting defined partitions in the device tree blob - using partition info defined in the 'mtdparts' environment - variable. - menu "System tables" depends on (!EFI && !SYS_COREBOOT) || (ARM && EFI_LOADER) @@ -976,8 +975,8 @@ config BLOBLIST_TABLES config GENERATE_SMBIOS_TABLE bool "Generate an SMBIOS (System Management BIOS) table" + depends on SMBIOS default y - depends on X86 || EFI_LOADER help The System Management BIOS (SMBIOS) specification addresses how motherboard and system vendors present management information about @@ -989,6 +988,8 @@ config GENERATE_SMBIOS_TABLE See also SMBIOS_SYSINFO which allows SMBIOS values to be provided in the devicetree. +endmenu + config LIB_RATIONAL bool "enable continued fraction calculation routines" @@ -996,8 +997,6 @@ config SPL_LIB_RATIONAL bool "enable continued fraction calculation routines for SPL" depends on SPL -endmenu - config ASN1_COMPILER bool help @@ -1046,6 +1045,20 @@ config SPL_OID_REGISTRY unambiguous persistent name (https://en.wikipedia.org/wiki/Object_identifier). Enable fast lookup object identifier registry in the SPL. +config SMBIOS + bool "SMBIOS support" + depends on X86 || EFI_LOADER + default y + select LAST_STAGE_INIT + help + Indicates that this platform can support System Management BIOS + (SMBIOS) tables. These provide various pieces of information about + the board, such as the manufacturer and the model name. + + See GENERATE_SMBIOS_TABLE which controls whether U-Boot actually + creates these tables, rather than them coming from a previous firmware + stage. + config SMBIOS_PARSER bool "SMBIOS parser" help @@ -1118,8 +1131,4 @@ config PHANDLE_CHECK_SEQ endmenu -menu "FWU Multi Bank Updates" - source lib/fwu_updates/Kconfig - -endmenu diff --git a/lib/Makefile b/lib/Makefile index 9fa5735..1c31ad9 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -44,6 +44,7 @@ obj-$(CONFIG_GZIP_COMPRESSED) += gzip.o obj-$(CONFIG_GENERATE_SMBIOS_TABLE) += smbios.o obj-$(CONFIG_SMBIOS_PARSER) += smbios-parser.o obj-$(CONFIG_IMAGE_SPARSE) += image-sparse.o +obj-y += initcall.o obj-y += ldiv.o obj-$(CONFIG_XXHASH) += xxhash.o obj-y += net_utils.o @@ -82,6 +82,11 @@ bool abuf_realloc(struct abuf *abuf, size_t new_size) } } +bool abuf_realloc_inc(struct abuf *abuf, size_t inc) +{ + return abuf_realloc(abuf, abuf->size + inc); +} + void *abuf_uninit_move(struct abuf *abuf, size_t *sizep) { void *ptr; diff --git a/lib/asn1_decoder.c b/lib/asn1_decoder.c index bcb0390..1191fc3 100644 --- a/lib/asn1_decoder.c +++ b/lib/asn1_decoder.c @@ -8,6 +8,7 @@ #ifdef __UBOOT__ #include <log.h> #include <linux/compat.h> +#include <linux/printk.h> #else #include <linux/export.h> #endif @@ -61,6 +61,7 @@ #include <dm/devres.h> #include <linux/bitops.h> +#include <linux/printk.h> #else #include <errno.h> #if defined(__FreeBSD__) diff --git a/lib/charset.c b/lib/charset.c index b184275..5e4c4f9 100644 --- a/lib/charset.c +++ b/lib/charset.c @@ -444,14 +444,14 @@ u16 *u16_strdup(const void *src) size_t u16_strlcat(u16 *dest, const u16 *src, size_t count) { - size_t destlen = u16_strlen(dest); + size_t destlen = u16_strnlen(dest, count); size_t srclen = u16_strlen(src); - size_t ret = destlen + srclen + 1; + size_t ret = destlen + srclen; if (destlen >= count) return ret; - if (ret > count) - srclen -= ret - count; + if (ret >= count) + srclen -= (ret - count + 1); memcpy(&dest[destlen], src, 2 * srclen); dest[destlen + srclen] = 0x0000; diff --git a/lib/crc32.c b/lib/crc32.c index aa94d70..f6fad8c 100644 --- a/lib/crc32.c +++ b/lib/crc32.c @@ -10,7 +10,6 @@ #ifdef USE_HOSTCC #include <arpa/inet.h> -#include <u-boot/crc.h> #else #include <common.h> #include <efi_loader.h> diff --git a/lib/crypto/asymmetric_type.c b/lib/crypto/asymmetric_type.c index 1d0532d..24c2d15 100644 --- a/lib/crypto/asymmetric_type.c +++ b/lib/crypto/asymmetric_type.c @@ -18,6 +18,7 @@ #include <linux/compat.h> #include <linux/ctype.h> #include <linux/err.h> +#include <linux/printk.h> #include <linux/string.h> #else #include <linux/seq_file.h> diff --git a/lib/crypto/pkcs7_parser.c b/lib/crypto/pkcs7_parser.c index 0b85fe8..d5efa82 100644 --- a/lib/crypto/pkcs7_parser.c +++ b/lib/crypto/pkcs7_parser.c @@ -11,6 +11,7 @@ #include <dm/devres.h> #include <linux/bitops.h> #include <linux/compat.h> +#include <linux/printk.h> #endif #include <linux/kernel.h> #ifndef __UBOOT__ diff --git a/lib/crypto/pkcs7_verify.c b/lib/crypto/pkcs7_verify.c index b832f01..9d7b9f6 100644 --- a/lib/crypto/pkcs7_verify.c +++ b/lib/crypto/pkcs7_verify.c @@ -15,6 +15,7 @@ #include <linux/bitops.h> #include <linux/compat.h> #include <linux/asn1.h> +#include <linux/printk.h> #include <u-boot/hash-checksum.h> #include <crypto/public_key.h> #include <crypto/pkcs7_parser.h> diff --git a/lib/crypto/public_key.c b/lib/crypto/public_key.c index 3671ed1..6efe951 100644 --- a/lib/crypto/public_key.c +++ b/lib/crypto/public_key.c @@ -13,6 +13,7 @@ #include <linux/bug.h> #include <linux/compat.h> #include <linux/err.h> +#include <linux/printk.h> #else #include <linux/module.h> #include <linux/export.h> diff --git a/lib/crypto/rsa_helper.c b/lib/crypto/rsa_helper.c index cc0c0d6..c941d40 100644 --- a/lib/crypto/rsa_helper.c +++ b/lib/crypto/rsa_helper.c @@ -15,6 +15,7 @@ #include <linux/fips.h> #endif #include <crypto/internal/rsa.h> +#include <linux/printk.h> #include "rsapubkey.asn1.h" #ifndef __UBOOT__ #include "rsaprivkey.asn1.h" diff --git a/lib/crypto/x509_cert_parser.c b/lib/crypto/x509_cert_parser.c index eb24349..a0f0689 100644 --- a/lib/crypto/x509_cert_parser.c +++ b/lib/crypto/x509_cert_parser.c @@ -16,6 +16,7 @@ #include <linux/err.h> #include <linux/oid_registry.h> #ifdef __UBOOT__ +#include <linux/printk.h> #include <linux/string.h> #endif #include <crypto/public_key.h> diff --git a/lib/crypto/x509_public_key.c b/lib/crypto/x509_public_key.c index 5c0e2b6..3007123 100644 --- a/lib/crypto/x509_public_key.c +++ b/lib/crypto/x509_public_key.c @@ -13,6 +13,7 @@ #include <linux/compat.h> #include <linux/err.h> #include <linux/errno.h> +#include <linux/printk.h> #else #include <linux/module.h> #endif diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig index 9989e3f..d20aaab 100644 --- a/lib/efi_loader/Kconfig +++ b/lib/efi_loader/Kconfig @@ -272,6 +272,14 @@ config EFI_CAPSULE_MAX Select the max capsule index value used for capsule report variables. This value is used to create CapsuleMax variable. +config EFI_CAPSULE_ESL_FILE + string "Path to the EFI Signature List File" + depends on EFI_CAPSULE_AUTHENTICATE + help + Provides the path to the EFI Signature List file which will + be embedded in the platform's device tree and used for + capsule authentication at the time of capsule update. + config EFI_DEVICE_PATH_TO_TEXT bool "Device path to text protocol" default y diff --git a/lib/efi_loader/Makefile b/lib/efi_loader/Makefile index 1a8c8d7..8d31fc6 100644 --- a/lib/efi_loader/Makefile +++ b/lib/efi_loader/Makefile @@ -78,8 +78,8 @@ obj-$(CONFIG_EFI_ESRT) += efi_esrt.o obj-$(CONFIG_VIDEO) += efi_gop.o obj-$(CONFIG_BLK) += efi_disk.o obj-$(CONFIG_NETDEVICES) += efi_net.o -obj-$(CONFIG_GENERATE_ACPI_TABLE) += efi_acpi.o -obj-$(CONFIG_GENERATE_SMBIOS_TABLE) += efi_smbios.o +obj-$(CONFIG_ACPI) += efi_acpi.o +obj-$(CONFIG_SMBIOS) += efi_smbios.o obj-$(CONFIG_EFI_RNG_PROTOCOL) += efi_rng.o obj-$(CONFIG_EFI_TCG2_PROTOCOL) += efi_tcg2.o obj-$(CONFIG_EFI_RISCV_BOOT_PROTOCOL) += efi_riscv.o diff --git a/lib/efi_loader/capsule_esl.dtsi.in b/lib/efi_loader/capsule_esl.dtsi.in new file mode 100644 index 0000000..61a9f2b --- /dev/null +++ b/lib/efi_loader/capsule_esl.dtsi.in @@ -0,0 +1,11 @@ +// SPDX-License-Identifier: GPL-2.0+ +/** + * Devicetree file with the public key EFI Signature List(ESL) + * node. This file is used to generate the dtsi file to be + * included into the DTB. +*/ +/ { + signature { + capsule-key = /incbin/("ESL_BIN_FILE"); + }; +}; diff --git a/lib/efi_loader/efi_setup.c b/lib/efi_loader/efi_setup.c index 58d4e13..e6de685 100644 --- a/lib/efi_loader/efi_setup.c +++ b/lib/efi_loader/efi_setup.c @@ -321,16 +321,16 @@ efi_status_t efi_init_obj_list(void) if (ret != EFI_SUCCESS) goto out; #endif -#ifdef CONFIG_GENERATE_ACPI_TABLE - ret = efi_acpi_register(); - if (ret != EFI_SUCCESS) - goto out; -#endif -#ifdef CONFIG_GENERATE_SMBIOS_TABLE - ret = efi_smbios_register(); - if (ret != EFI_SUCCESS) - goto out; -#endif + if (IS_ENABLED(CONFIG_ACPI)) { + ret = efi_acpi_register(); + if (ret != EFI_SUCCESS) + goto out; + } + if (IS_ENABLED(CONFIG_SMBIOS)) { + ret = efi_smbios_register(); + if (ret != EFI_SUCCESS) + goto out; + } ret = efi_watchdog_register(); if (ret != EFI_SUCCESS) goto out; diff --git a/lib/efi_loader/efi_smbios.c b/lib/efi_loader/efi_smbios.c index 306c0bc..48446f6 100644 --- a/lib/efi_loader/efi_smbios.c +++ b/lib/efi_loader/efi_smbios.c @@ -10,8 +10,14 @@ #include <common.h> #include <efi_loader.h> #include <log.h> +#include <malloc.h> #include <mapmem.h> #include <smbios.h> +#include <linux/sizes.h> + +enum { + TABLE_SIZE = SZ_4K, +}; /* * Install the SMBIOS table as a configuration table. @@ -20,36 +26,50 @@ */ efi_status_t efi_smbios_register(void) { - /* Map within the low 32 bits, to allow for 32bit SMBIOS tables */ - u64 dmi_addr = U32_MAX; + ulong addr; efi_status_t ret; - void *dmi; - /* Reserve 4kiB page for SMBIOS */ - ret = efi_allocate_pages(EFI_ALLOCATE_MAX_ADDRESS, - EFI_RUNTIME_SERVICES_DATA, 1, &dmi_addr); + addr = gd->arch.smbios_start; + if (!addr) { + log_err("No SMBIOS tables to install\n"); + return EFI_NOT_FOUND; + } + + /* Mark space used for tables */ + ret = efi_add_memory_map(addr, TABLE_SIZE, EFI_RUNTIME_SERVICES_DATA); + if (ret) + return ret; + + log_debug("EFI using SMBIOS tables at %lx\n", addr); + + /* Install SMBIOS information as configuration table */ + return efi_install_configuration_table(&smbios_guid, + map_sysmem(addr, 0)); +} + +static int install_smbios_table(void) +{ + ulong addr; + void *buf; - if (ret != EFI_SUCCESS) { - /* Could not find space in lowmem, use highmem instead */ - ret = efi_allocate_pages(EFI_ALLOCATE_ANY_PAGES, - EFI_RUNTIME_SERVICES_DATA, 1, - &dmi_addr); + if (!IS_ENABLED(CONFIG_GENERATE_SMBIOS_TABLE) || IS_ENABLED(CONFIG_X86)) + return 0; - if (ret != EFI_SUCCESS) - return ret; + /* Align the table to a 4KB boundary to keep EFI happy */ + buf = memalign(SZ_4K, TABLE_SIZE); + if (!buf) + return log_msg_ret("mem", -ENOMEM); + + addr = map_to_sysmem(buf); + if (!write_smbios_table(addr)) { + log_err("Failed to write SMBIOS table\n"); + return log_msg_ret("smbios", -EINVAL); } - /* - * Generate SMBIOS tables - we know that efi_allocate_pages() returns - * a 4k-aligned address, so it is safe to assume that - * write_smbios_table() will write the table at that address. - */ - assert(!(dmi_addr & 0xf)); - dmi = (void *)(uintptr_t)dmi_addr; - if (write_smbios_table(map_to_sysmem(dmi))) - /* Install SMBIOS information as configuration table */ - return efi_install_configuration_table(&smbios_guid, dmi); - efi_free_pages(dmi_addr, 1); - log_err("Cannot create SMBIOS table\n"); - return EFI_SUCCESS; + /* Make a note of where we put it */ + log_debug("SMBIOS tables written to %lx\n", addr); + gd->arch.smbios_start = addr; + + return 0; } +EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, install_smbios_table); diff --git a/lib/fdtdec.c b/lib/fdtdec.c index c60972d..7a69167 100644 --- a/lib/fdtdec.c +++ b/lib/fdtdec.c @@ -1230,12 +1230,12 @@ static void *fdt_find_separate(void) #ifdef CONFIG_SPL_BUILD /* FDT is at end of BSS unless it is in a different memory region */ if (IS_ENABLED(CONFIG_SPL_SEPARATE_BSS)) - fdt_blob = (ulong *)&_image_binary_end; + fdt_blob = (ulong *)_image_binary_end; else - fdt_blob = (ulong *)&__bss_end; + fdt_blob = (ulong *)__bss_end; #else /* FDT is at end of image */ - fdt_blob = (ulong *)&_end; + fdt_blob = (ulong *)_end; if (_DEBUG && !fdtdec_prepare_fdt(fdt_blob)) { int stack_ptr; diff --git a/lib/fwu_updates/Kconfig b/lib/fwu_updates/Kconfig index 71f3479..d35247d 100644 --- a/lib/fwu_updates/Kconfig +++ b/lib/fwu_updates/Kconfig @@ -1,4 +1,4 @@ -config FWU_MULTI_BANK_UPDATE +menuconfig FWU_MULTI_BANK_UPDATE bool "Enable FWU Multi Bank Update Feature" depends on EFI_CAPSULE_ON_DISK select PARTITION_TYPE_GUID @@ -10,24 +10,25 @@ config FWU_MULTI_BANK_UPDATE multiple banks(copies) of the firmware images. One of the bank is selected for updating all the firmware components +if FWU_MULTI_BANK_UPDATE + config FWU_NUM_BANKS int "Number of Banks defined by the platform" - depends on FWU_MULTI_BANK_UPDATE help Define the number of banks of firmware images on a platform config FWU_NUM_IMAGES_PER_BANK int "Number of firmware images per bank" - depends on FWU_MULTI_BANK_UPDATE help Define the number of firmware images per bank. This value should be the same for all the banks. config FWU_TRIAL_STATE_CNT int "Number of times system boots in Trial State" - depends on FWU_MULTI_BANK_UPDATE default 3 help With FWU Multi Bank Update feature enabled, number of times the platform is allowed to boot in Trial State after an update. + +endif diff --git a/lib/fwu_updates/fwu.c b/lib/fwu_updates/fwu.c index 4d0c8b8..b580574 100644 --- a/lib/fwu_updates/fwu.c +++ b/lib/fwu_updates/fwu.c @@ -618,23 +618,23 @@ int fwu_trial_state_ctr_start(void) return ret; } -static int fwu_boottime_checks(void *ctx, struct event *event) +static int fwu_boottime_checks(void) { int ret; u32 boot_idx, active_idx; - /* Don't have boot time checks on sandbox */ - if (IS_ENABLED(CONFIG_SANDBOX)) { - boottime_check = 1; - return 0; - } - ret = uclass_first_device_err(UCLASS_FWU_MDATA, &g_dev); if (ret) { log_debug("Cannot find fwu device\n"); return ret; } + /* Don't have boot time checks on sandbox */ + if (IS_ENABLED(CONFIG_SANDBOX)) { + boottime_check = 1; + return 0; + } + ret = fwu_get_mdata(NULL); if (ret) { log_debug("Unable to read meta-data\n"); @@ -682,4 +682,4 @@ static int fwu_boottime_checks(void *ctx, struct event *event) return 0; } -EVENT_SPY(EVT_MAIN_LOOP, fwu_boottime_checks); +EVENT_SPY_SIMPLE(EVT_MAIN_LOOP, fwu_boottime_checks); diff --git a/lib/initcall.c b/lib/initcall.c new file mode 100644 index 0000000..33b7d76 --- /dev/null +++ b/lib/initcall.c @@ -0,0 +1,99 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (c) 2013 The Chromium OS Authors. + */ + +#include <common.h> +#include <efi.h> +#include <initcall.h> +#include <log.h> +#include <relocate.h> +#include <asm/global_data.h> + +DECLARE_GLOBAL_DATA_PTR; + +static ulong calc_reloc_ofs(void) +{ +#ifdef CONFIG_EFI_APP + return (ulong)image_base; +#endif + /* + * Sandbox is relocated by the OS, so symbols always appear at + * the relocated address. + */ + if (IS_ENABLED(CONFIG_SANDBOX) || (gd->flags & GD_FLG_RELOC)) + return gd->reloc_off; + + return 0; +} + +/** + * initcall_is_event() - Get the event number for an initcall + * + * func: Function pointer to check + * Return: Event number, if this is an event, else 0 + */ +static int initcall_is_event(init_fnc_t func) +{ + ulong val = (ulong)func; + + if ((val & INITCALL_IS_EVENT) == INITCALL_IS_EVENT) + return val & INITCALL_EVENT_TYPE; + + return 0; +} + +/* + * To enable debugging. add #define DEBUG at the top of the including file. + * + * To find a symbol, use grep on u-boot.map + */ +int initcall_run_list(const init_fnc_t init_sequence[]) +{ + ulong reloc_ofs = calc_reloc_ofs(); + const init_fnc_t *ptr; + enum event_t type; + init_fnc_t func; + int ret = 0; + + for (ptr = init_sequence; func = *ptr, !ret && func; ptr++) { + type = initcall_is_event(func); + + if (type) { + if (!CONFIG_IS_ENABLED(EVENT)) + continue; + debug("initcall: event %d/%s\n", type, + event_type_name(type)); + } else if (reloc_ofs) { + debug("initcall: %p (relocated to %p)\n", + (char *)func - reloc_ofs, (char *)func); + } else { + debug("initcall: %p\n", (char *)func - reloc_ofs); + } + + ret = type ? event_notify_null(type) : func(); + } + + if (ret) { + if (CONFIG_IS_ENABLED(EVENT)) { + char buf[60]; + + /* don't worry about buf size as we are dying here */ + if (type) { + sprintf(buf, "event %d/%s", type, + event_type_name(type)); + } else { + sprintf(buf, "call %p", func); + } + + printf("initcall failed at %s (err=%dE)\n", buf, ret); + } else { + printf("initcall failed at call %p (err=%d)\n", + (char *)func - reloc_ofs, ret); + } + + return ret; + } + + return 0; +} diff --git a/lib/list_sort.c b/lib/list_sort.c index 58e1e16..1c9e061 100644 --- a/lib/list_sort.c +++ b/lib/list_sort.c @@ -8,6 +8,7 @@ #include <linux/compat.h> #include <common.h> #include <malloc.h> +#include <linux/printk.h> #endif #include <linux/list.h> #include <linux/list_sort.h> diff --git a/lib/string.c b/lib/string.c index ecea755..f2c6147 100644 --- a/lib/string.c +++ b/lib/string.c @@ -116,20 +116,18 @@ char * strncpy(char * dest,const char *src,size_t count) * of course, the buffer size is zero). It does not pad * out the result like strncpy() does. * - * Return: the number of bytes copied + * Return: strlen(src) */ size_t strlcpy(char *dest, const char *src, size_t size) { - if (size) { - size_t srclen = strlen(src); - size_t len = (srclen >= size) ? size - 1 : srclen; + size_t ret = strlen(src); + if (size) { + size_t len = (ret >= size) ? size - 1 : ret; memcpy(dest, src, len); dest[len] = '\0'; - return len + 1; } - - return 0; + return ret; } #endif @@ -191,6 +189,8 @@ char * strncat(char *dest, const char *src, size_t count) * Compatible with *BSD: the result is always a valid NUL-terminated string that * fits in the buffer (unless, of course, the buffer size is zero). It does not * write past @size like strncat() does. + * + * Return: min(strlen(dest), size) + strlen(src) */ size_t strlcat(char *dest, const char *src, size_t size) { diff --git a/lib/trace.c b/lib/trace.c index 1091a57..4874bef 100644 --- a/lib/trace.c +++ b/lib/trace.c @@ -51,7 +51,7 @@ static inline uintptr_t __attribute__((no_instrument_function)) uintptr_t offset = (uintptr_t)func_ptr; #ifdef CONFIG_SANDBOX - offset -= (uintptr_t)&_init; + offset -= (uintptr_t)_init; #else if (gd->flags & GD_FLG_RELOC) offset -= gd->relocaddr; @@ -7,6 +7,8 @@ * Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com> */ +#define LOG_CATEGOT LOGC_CORE + #include <common.h> #include <command.h> #include <efi_api.h> @@ -23,50 +25,6 @@ #include <dm/uclass.h> #include <rng.h> -/* - * UUID - Universally Unique IDentifier - 128 bits unique number. - * There are 5 versions and one variant of UUID defined by RFC4122 - * specification. A UUID contains a set of fields. The set varies - * depending on the version of the UUID, as shown below: - * - time, MAC address(v1), - * - user ID(v2), - * - MD5 of name or URL(v3), - * - random data(v4), - * - SHA-1 of name or URL(v5), - * - * Layout of UUID: - * timestamp - 60-bit: time_low, time_mid, time_hi_and_version - * version - 4 bit (bit 4 through 7 of the time_hi_and_version) - * clock seq - 14 bit: clock_seq_hi_and_reserved, clock_seq_low - * variant: - bit 6 and 7 of clock_seq_hi_and_reserved - * node - 48 bit - * - * source: https://www.ietf.org/rfc/rfc4122.txt - * - * UUID binary format (16 bytes): - * - * 4B-2B-2B-2B-6B (big endian - network byte order) - * - * UUID string is 36 length of characters (36 bytes): - * - * 0 9 14 19 24 - * xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx - * be be be be be - * - * where x is a hexadecimal character. Fields are separated by '-'s. - * When converting to a binary UUID, le means the field should be converted - * to little endian and be means it should be converted to big endian. - * - * UUID is also used as GUID (Globally Unique Identifier) with the same binary - * format but it differs in string format like below. - * - * GUID: - * 0 9 14 19 24 - * xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx - * le le le be be - * - * GUID is used e.g. in GPT (GUID Partition Table) as a partiions unique id. - */ int uuid_str_valid(const char *uuid) { int i, valid; @@ -105,6 +63,10 @@ static const struct { {"swap", PARTITION_LINUX_SWAP_GUID}, {"lvm", PARTITION_LINUX_LVM_GUID}, {"u-boot-env", PARTITION_U_BOOT_ENVIRONMENT}, + {"cros-kern", PARTITION_CROS_KERNEL}, + {"cros-root", PARTITION_CROS_ROOT}, + {"cros-fw", PARTITION_CROS_FIRMWARE}, + {"cros-rsrv", PARTITION_CROS_RESERVED}, #endif #if defined(CONFIG_CMD_EFIDEBUG) || defined(CONFIG_EFI) { @@ -269,12 +231,6 @@ static const struct { #endif }; -/* - * uuid_guid_get_bin() - this function get GUID bin for string - * - * @param guid_str - pointer to partition type string - * @param guid_bin - pointer to allocated array for big endian output [16B] - */ int uuid_guid_get_bin(const char *guid_str, unsigned char *guid_bin) { int i; @@ -288,13 +244,6 @@ int uuid_guid_get_bin(const char *guid_str, unsigned char *guid_bin) return -ENODEV; } -/* - * uuid_guid_get_str() - this function get string for GUID. - * - * @param guid_bin - pointer to string with partition type guid [16B] - * - * Returns NULL if the type GUID is not known. - */ const char *uuid_guid_get_str(const unsigned char *guid_bin) { int i; @@ -307,13 +256,6 @@ const char *uuid_guid_get_str(const unsigned char *guid_bin) return NULL; } -/* - * uuid_str_to_bin() - convert string UUID or GUID to big endian binary data. - * - * @param uuid_str - pointer to UUID or GUID string [37B] or GUID shorcut - * @param uuid_bin - pointer to allocated array for big endian output [16B] - * @str_format - UUID string format: 0 - UUID; 1 - GUID - */ int uuid_str_to_bin(const char *uuid_str, unsigned char *uuid_bin, int str_format) { @@ -322,6 +264,7 @@ int uuid_str_to_bin(const char *uuid_str, unsigned char *uuid_bin, uint64_t tmp64; if (!uuid_str_valid(uuid_str)) { + log_debug("not valid\n"); #ifdef CONFIG_PARTITION_TYPE_GUID if (!uuid_guid_get_bin(uuid_str, uuid_bin)) return 0; @@ -358,23 +301,6 @@ int uuid_str_to_bin(const char *uuid_str, unsigned char *uuid_bin, return 0; } -/** - * uuid_str_to_le_bin() - Convert string UUID to little endian binary data. - * @uuid_str: pointer to UUID string - * @uuid_bin: pointer to allocated array for little endian output [16B] - * - * UUID string is 36 characters (36 bytes): - * - * xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx - * - * where x is a hexadecimal character. Fields are separated by '-'s. - * When converting to a little endian binary UUID, the string fields are reversed. - * - * Return: - * - * uuid_bin filled with little endian UUID data - * On success 0 is returned. Otherwise, failure code. - */ int uuid_str_to_le_bin(const char *uuid_str, unsigned char *uuid_bin) { u16 tmp16; @@ -402,14 +328,6 @@ int uuid_str_to_le_bin(const char *uuid_str, unsigned char *uuid_bin) return 0; } -/* - * uuid_bin_to_str() - convert big endian binary data to string UUID or GUID. - * - * @param uuid_bin: pointer to binary data of UUID (big endian) [16B] - * @param uuid_str: pointer to allocated array for output string [37B] - * @str_format: bit 0: 0 - UUID; 1 - GUID - * bit 1: 0 - lower case; 2 - upper case - */ void uuid_bin_to_str(const unsigned char *uuid_bin, char *uuid_str, int str_format) { @@ -449,13 +367,6 @@ void uuid_bin_to_str(const unsigned char *uuid_bin, char *uuid_str, } } -/* - * gen_rand_uuid() - this function generates a random binary UUID version 4. - * In this version all fields beside 4 bits of version and - * 2 bits of variant are randomly generated. - * - * @param uuid_bin - pointer to allocated array [16B]. Output is in big endian. -*/ #if defined(CONFIG_RANDOM_UUID) || defined(CONFIG_CMD_UUID) void gen_rand_uuid(unsigned char *uuid_bin) { @@ -493,13 +404,6 @@ void gen_rand_uuid(unsigned char *uuid_bin) memcpy(uuid_bin, uuid, 16); } -/* - * gen_rand_uuid_str() - this function generates UUID v4 (random) in two string - * formats UUID or GUID. - * - * @param uuid_str - pointer to allocated array [37B]. - * @param - uuid output type: UUID - 0, GUID - 1 - */ void gen_rand_uuid_str(char *uuid_str, int str_format) { unsigned char uuid_bin[UUID_BIN_LEN]; diff --git a/net/eth-uclass.c b/net/eth-uclass.c index c393600..4311f3f 100644 --- a/net/eth-uclass.c +++ b/net/eth-uclass.c @@ -556,32 +556,6 @@ static int eth_post_probe(struct udevice *dev) unsigned char env_enetaddr[ARP_HLEN]; char *source = "DT"; -#if defined(CONFIG_NEEDS_MANUAL_RELOC) - struct eth_ops *ops = eth_get_ops(dev); - static int reloc_done; - - if (!reloc_done) { - if (ops->start) - ops->start += gd->reloc_off; - if (ops->send) - ops->send += gd->reloc_off; - if (ops->recv) - ops->recv += gd->reloc_off; - if (ops->free_pkt) - ops->free_pkt += gd->reloc_off; - if (ops->stop) - ops->stop += gd->reloc_off; - if (ops->mcast) - ops->mcast += gd->reloc_off; - if (ops->write_hwaddr) - ops->write_hwaddr += gd->reloc_off; - if (ops->read_rom_hwaddr) - ops->read_rom_hwaddr += gd->reloc_off; - - reloc_done++; - } -#endif - priv->state = ETH_STATE_INIT; priv->running = false; diff --git a/net/eth_common.c b/net/eth_common.c index c94a7ba..14d4c07 100644 --- a/net/eth_common.c +++ b/net/eth_common.c @@ -36,10 +36,6 @@ void eth_common_init(void) #if defined(CONFIG_MII) || defined(CONFIG_CMD_MII) || defined(CONFIG_PHYLIB) miiphy_init(); #endif - -#if defined(CONFIG_NEEDS_MANUAL_RELOC) && defined(CONFIG_PHYLIB) - phy_init(); -#endif #endif } diff --git a/net/fastboot_udp.c b/net/fastboot_udp.c index d706928..d690787 100644 --- a/net/fastboot_udp.c +++ b/net/fastboot_udp.c @@ -8,6 +8,7 @@ #include <fastboot.h> #include <net.h> #include <net/fastboot_udp.h> +#include <linux/printk.h> enum { FASTBOOT_ERROR = 0, @@ -716,7 +716,7 @@ restart: case NETLOOP_SUCCESS: net_cleanup_loop(); if (net_boot_file_size > 0) { - printf("Bytes transferred = %d (%x hex)\n", + printf("Bytes transferred = %u (%x hex)\n", net_boot_file_size, net_boot_file_size); env_set_hex("filesize", net_boot_file_size); env_set_hex("fileaddr", image_load_addr); diff --git a/post/post.c b/post/post.c index 4db862c..946d909 100644 --- a/post/post.c +++ b/post/post.c @@ -416,54 +416,6 @@ int post_log(char *format, ...) return 0; } -#ifdef CONFIG_NEEDS_MANUAL_RELOC -void post_reloc(void) -{ - unsigned int i; - - /* - * We have to relocate the test table manually - */ - for (i = 0; i < post_list_size; i++) { - ulong addr; - struct post_test *test = post_list + i; - - if (test->name) { - addr = (ulong)(test->name) + gd->reloc_off; - test->name = (char *)addr; - } - - if (test->cmd) { - addr = (ulong)(test->cmd) + gd->reloc_off; - test->cmd = (char *)addr; - } - - if (test->desc) { - addr = (ulong)(test->desc) + gd->reloc_off; - test->desc = (char *)addr; - } - - if (test->test) { - addr = (ulong)(test->test) + gd->reloc_off; - test->test = (int (*)(int flags)) addr; - } - - if (test->init_f) { - addr = (ulong)(test->init_f) + gd->reloc_off; - test->init_f = (int (*)(void)) addr; - } - - if (test->reloc) { - addr = (ulong)(test->reloc) + gd->reloc_off; - test->reloc = (void (*)(void)) addr; - - test->reloc(); - } - } -} -#endif - - /* * Some tests (e.g. SYSMON) need the time when post_init_f started, * but we cannot use get_timer() at this point. diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index f5ab7af..8dc6ec8 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -179,10 +179,13 @@ ifdef DEVICE_TREE_DEBUG u_boot_dtsi_options_debug = $(warning $(u_boot_dtsi_options_raw)) endif -# We use the first match -u_boot_dtsi = $(strip $(u_boot_dtsi_options_debug) \ +# We use the first match to be included +dtsi_include_list = $(strip $(u_boot_dtsi_options_debug) \ $(notdir $(firstword $(u_boot_dtsi_options)))) +# The CONFIG_DEVICE_TREE_INCLUDES also need to be included +dtsi_include_list += $(CONFIG_DEVICE_TREE_INCLUDES) + # Modified for U-Boot dtc_cpp_flags = -Wp,-MD,$(depfile).pre.tmp -nostdinc \ $(UBOOTINCLUDE) \ @@ -320,8 +323,8 @@ quiet_cmd_dtc = DTC $@ # Bring in any U-Boot-specific include at the end of the file # And finally any custom .dtsi fragments specified with CONFIG_DEVICE_TREE_INCLUDES cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \ - (cat $<; $(if $(u_boot_dtsi),echo '$(pound)include "$(u_boot_dtsi)"')) > $(pre-tmp); \ - $(foreach f,$(subst $(quote),,$(CONFIG_DEVICE_TREE_INCLUDES)), \ + (cat $< > $(pre-tmp)); \ + $(foreach f,$(subst $(quote),,$(dtsi_include_list)), \ echo '$(pound)include "$(f)"' >> $(pre-tmp);) \ $(HOSTCC) -E $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $(pre-tmp) ; \ $(DTC) -O dtb -o $@ -b 0 \ @@ -331,7 +334,24 @@ cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \ ; \ sed "s:$(pre-tmp):$(<):" $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile) -$(obj)/%.dtb: $(src)/%.dts $(DTC) FORCE +quiet_cmd_capsule_esl_gen = CAPSULE_ESL_GEN $@ +cmd_capsule_esl_gen = \ + $(shell sed "s:ESL_BIN_FILE:$(capsule_esl_path):" $(capsule_esl_input_file) > $@) + +$(obj)/.capsule_esl.dtsi: FORCE + $(call cmd_capsule_esl_gen) + +capsule_esl_input_file=$(srctree)/lib/efi_loader/capsule_esl.dtsi.in +capsule_esl_dtsi = .capsule_esl.dtsi +capsule_esl_path=$(abspath $(srctree)/$(subst $(quote),,$(CONFIG_EFI_CAPSULE_ESL_FILE))) + +ifdef CONFIG_EFI_CAPSULE_AUTHENTICATE +dtsi_include_list += $(capsule_esl_dtsi) +endif + +dtsi_include_list_deps = $(addprefix $(obj)/,$(subst $(quote),,$(dtsi_include_list))) + +$(obj)/%.dtb: $(src)/%.dts $(DTC) $(dtsi_include_list_deps) FORCE $(call if_changed_dep,dtc) pre-tmp = $(subst $(comma),_,$(dot-target).pre.tmp) diff --git a/scripts/dtc/Makefile b/scripts/dtc/Makefile index 58d879d..faa72d9 100644 --- a/scripts/dtc/Makefile +++ b/scripts/dtc/Makefile @@ -19,4 +19,6 @@ HOSTCFLAGS_dtc-parser.tab.o := -I$(src) $(obj)/dtc-lexer.lex.o: $(obj)/dtc-parser.tab.h # Added for U-Boot +ifeq ($(PYTHON_ENABLE),y) subdir-$(CONFIG_PYLIBFDT) += pylibfdt +endif diff --git a/scripts/event_dump.py b/scripts/event_dump.py index 0117457..24dfe2b 100755 --- a/scripts/event_dump.py +++ b/scripts/event_dump.py @@ -19,8 +19,10 @@ from u_boot_pylib import tools # A typical symbol looks like this: # _u_boot_list_2_evspy_info_2_EVT_MISC_INIT_F_3_sandbox_misc_init_f -PREFIX = '_u_boot_list_2_evspy_info_2_' -RE_EVTYPE = re.compile('%s(.*)_3_.*' % PREFIX) +PREFIX_FULL = '_u_boot_list_2_evspy_info_2_' +PREFIX_SIMPLE = '_u_boot_list_2_evspy_info_simple_2_' +RE_EVTYPE_FULL = re.compile('%s(.*)_3_.*' % PREFIX_FULL) +RE_EVTYPE_SIMPLE = re.compile('%s(.*)_3_.*' % PREFIX_SIMPLE) def show_sym(fname, data, endian, evtype, sym): """Show information about an evspy entry @@ -88,12 +90,14 @@ def show_event_spy_list(fname, endian): fname (str): Filename of ELF file endian (str): Endianness to use ('little', 'big', 'auto') """ - syms = elf.GetSymbolFileOffset(fname, [PREFIX]) + syms = elf.GetSymbolFileOffset(fname, [PREFIX_FULL, PREFIX_SIMPLE]) data = tools.read_file(fname) print('%-20s %-30s %s' % ('Event type', 'Id', 'Source location')) print('%-20s %-30s %s' % ('-' * 20, '-' * 30, '-' * 30)) for name, sym in syms.items(): - m_evtype = RE_EVTYPE.search(name) + m_evtype = RE_EVTYPE_FULL.search(name) + if not m_evtype: + m_evtype = RE_EVTYPE_SIMPLE.search(name) evtype = m_evtype .group(1) show_sym(fname, data, endian, evtype, sym) diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index 12e525e..2d97aab 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile @@ -99,7 +99,9 @@ endif %_config: %_defconfig @: -configfiles=$(wildcard $(srctree)/kernel/configs/$@ $(srctree)/arch/$(SRCARCH)/configs/$@) +configfiles=$(wildcard $(srctree)/kernel/configs/$@ \ + $(srctree)/arch/$(SRCARCH)/configs/$@ \ + $(shell find $(srctree)/board -name "$@")) %.config: $(obj)/conf $(if $(call configfiles),, $(error No configuration exists for this target on this architecture)) diff --git a/test/Kconfig b/test/Kconfig index 6e859fb..830245b 100644 --- a/test/Kconfig +++ b/test/Kconfig @@ -1,9 +1,4 @@ -config POST - bool "Power On Self Test support" - help - See doc/README.POST for more details - -menu "Unit tests" +menu "Testing" config UNIT_TEST bool "Unit tests" @@ -110,4 +105,9 @@ source "test/lib/Kconfig" source "test/optee/Kconfig" source "test/overlay/Kconfig" +config POST + bool "Power On Self Test support" + help + See doc/README.POST for more details + endmenu diff --git a/test/boot/Makefile b/test/boot/Makefile index 22ed61c..5294758 100644 --- a/test/boot/Makefile +++ b/test/boot/Makefile @@ -6,6 +6,7 @@ obj-$(CONFIG_BOOTSTD) += bootdev.o bootstd_common.o bootflow.o bootmeth.o obj-$(CONFIG_FIT) += image.o obj-$(CONFIG_EXPO) += expo.o +obj-$(CONFIG_CEDIT) += cedit.o ifdef CONFIG_OF_LIVE obj-$(CONFIG_BOOTMETH_VBE_SIMPLE) += vbe_simple.o diff --git a/test/boot/bootflow.c b/test/boot/bootflow.c index 1c91a94..f5b2059 100644 --- a/test/boot/bootflow.c +++ b/test/boot/bootflow.c @@ -27,6 +27,7 @@ DECLARE_GLOBAL_DATA_PTR; +extern U_BOOT_DRIVER(bootmeth_cros); extern U_BOOT_DRIVER(bootmeth_2script); static int inject_response(struct unit_test_state *uts) @@ -167,21 +168,22 @@ static int bootflow_cmd_scan_e(struct unit_test_state *uts) ut_assert_nextline("Seq Method State Uclass Part Name Filename"); ut_assert_nextlinen("---"); ut_assert_nextline("Scanning bootdev 'mmc2.bootdev':"); - ut_assert_nextline(" 0 extlinux media mmc 0 mmc2.bootdev.whole <NULL>"); + ut_assert_nextline(" 0 extlinux media mmc 0 mmc2.bootdev.whole "); ut_assert_nextline(" ** No partition found, err=-93: Protocol not supported"); - ut_assert_nextline(" 1 efi media mmc 0 mmc2.bootdev.whole <NULL>"); + ut_assert_nextline(" 1 efi media mmc 0 mmc2.bootdev.whole "); ut_assert_nextline(" ** No partition found, err=-93: Protocol not supported"); ut_assert_nextline("Scanning bootdev 'mmc1.bootdev':"); - ut_assert_nextline(" 2 extlinux media mmc 0 mmc1.bootdev.whole <NULL>"); + ut_assert_nextline(" 2 extlinux media mmc 0 mmc1.bootdev.whole "); ut_assert_nextline(" ** No partition found, err=-2: No such file or directory"); - ut_assert_nextline(" 3 efi media mmc 0 mmc1.bootdev.whole <NULL>"); + ut_assert_nextline(" 3 efi media mmc 0 mmc1.bootdev.whole "); ut_assert_nextline(" ** No partition found, err=-2: No such file or directory"); ut_assert_nextline(" 4 extlinux ready mmc 1 mmc1.bootdev.part_1 /extlinux/extlinux.conf"); ut_assert_nextline(" 5 efi fs mmc 1 mmc1.bootdev.part_1 efi/boot/bootsbox.efi"); ut_assert_skip_to_line("Scanning bootdev 'mmc0.bootdev':"); - ut_assert_skip_to_line(" 3f efi media mmc 0 mmc0.bootdev.whole <NULL>"); + ut_assert_skip_to_line( + " 3f efi media mmc 0 mmc0.bootdev.whole "); ut_assert_nextline(" ** No partition found, err=-93: Protocol not supported"); ut_assert_nextline("No more bootdevs"); ut_assert_nextlinen("---"); @@ -192,10 +194,11 @@ static int bootflow_cmd_scan_e(struct unit_test_state *uts) ut_assert_nextline("Showing all bootflows"); ut_assert_nextline("Seq Method State Uclass Part Name Filename"); ut_assert_nextlinen("---"); - ut_assert_nextline(" 0 extlinux media mmc 0 mmc2.bootdev.whole <NULL>"); - ut_assert_nextline(" 1 efi media mmc 0 mmc2.bootdev.whole <NULL>"); - ut_assert_skip_to_line(" 4 extlinux ready mmc 1 mmc1.bootdev.part_1 /extlinux/extlinux.conf"); - ut_assert_skip_to_line(" 3f efi media mmc 0 mmc0.bootdev.whole <NULL>"); + ut_assert_nextline(" 0 extlinux media mmc 0 mmc2.bootdev.whole "); + ut_assert_nextline(" 1 efi media mmc 0 mmc2.bootdev.whole "); + ut_assert_skip_to_line( + " 4 extlinux ready mmc 1 mmc1.bootdev.part_1 /extlinux/extlinux.conf"); + ut_assert_skip_to_line(" 3f efi media mmc 0 mmc0.bootdev.whole "); ut_assert_nextlinen("---"); ut_assert_nextline("(64 bootflows, 1 valid)"); ut_assert_console_end(); @@ -384,7 +387,7 @@ static int bootflow_system(struct unit_test_state *uts) console_record_reset_enable(); ut_assertok(run_command("bootflow scan -lH", 0)); ut_assert_skip_to_line( - " 0 efi_mgr ready (none) 0 <NULL> <NULL>"); + " 0 efi_mgr ready (none) 0 <NULL> "); ut_assert_skip_to_line("No more bootdevs"); ut_assert_skip_to_line("(2 bootflows, 2 valid)"); ut_assert_console_end(); @@ -506,21 +509,25 @@ static int bootflow_cmd_boot(struct unit_test_state *uts) BOOTSTD_TEST(bootflow_cmd_boot, UT_TESTF_DM | UT_TESTF_SCAN_FDT); /** - * prep_mmc4_bootdev() - Set up the mmc4 bootdev so we can access a fake Armbian + * prep_mmc_bootdev() - Set up an mmc bootdev so we can access other distros * * @uts: Unit test state + * @mmc_dev: MMC device to use, e.g. "mmc4" * Returns 0 on success, -ve on failure */ -static int prep_mmc4_bootdev(struct unit_test_state *uts) +static int prep_mmc_bootdev(struct unit_test_state *uts, const char *mmc_dev, + bool bind_cros) { - static const char *order[] = {"mmc2", "mmc1", "mmc4", NULL}; + const char *order[] = {"mmc2", "mmc1", mmc_dev, NULL}; struct udevice *dev, *bootstd; struct bootstd_priv *std; const char **old_order; - ofnode node; + ofnode root, node; /* Enable the mmc4 node since we need a second bootflow */ - node = ofnode_path("/mmc4"); + root = oftree_root(oftree_default()); + node = ofnode_find_subnode(root, mmc_dev); + ut_assert(ofnode_valid(node)); ut_assertok(lists_bind_fdt(gd->dm_root, node, &dev, NULL, false)); /* Enable the script bootmeth too */ @@ -528,7 +535,14 @@ static int prep_mmc4_bootdev(struct unit_test_state *uts) ut_assertok(device_bind(bootstd, DM_DRIVER_REF(bootmeth_2script), "bootmeth_script", 0, ofnode_null(), &dev)); - /* Change the order to include mmc4 */ + /* Enable the cros bootmeth if needed */ + if (bind_cros) { + ut_assertok(uclass_first_device_err(UCLASS_BOOTSTD, &bootstd)); + ut_assertok(device_bind(bootstd, DM_DRIVER_REF(bootmeth_cros), + "cros", 0, ofnode_null(), &dev)); + } + + /* Change the order to include the device */ std = dev_get_priv(bootstd); old_order = std->bootdev_order; std->bootdev_order = order; @@ -543,6 +557,19 @@ static int prep_mmc4_bootdev(struct unit_test_state *uts) return 0; } +/** + * prep_mmc4_bootdev() - Set up the mmc4 bootdev so we can access a fake Armbian + * + * @uts: Unit test state + * Returns 0 on success, -ve on failure + */ +static int prep_mmc4_bootdev(struct unit_test_state *uts) +{ + ut_assertok(prep_mmc_bootdev(uts, "mmc4", false)); + + return 0; +} + /* Check 'bootflow menu' to select a bootflow */ static int bootflow_cmd_menu(struct unit_test_state *uts) { @@ -945,3 +972,24 @@ static int bootflow_cmdline(struct unit_test_state *uts) return 0; } BOOTSTD_TEST(bootflow_cmdline, 0); + +/* Test ChromiumOS bootmeth */ +static int bootflow_cros(struct unit_test_state *uts) +{ + ut_assertok(prep_mmc_bootdev(uts, "mmc5", true)); + ut_assertok(run_command("bootflow list", 0)); + + ut_assert_nextlinen("Showing all"); + ut_assert_nextlinen("Seq"); + ut_assert_nextlinen("---"); + ut_assert_nextlinen(" 0 extlinux"); + ut_assert_nextlinen(" 1 cros ready mmc 2 mmc5.bootdev.part_2 "); + ut_assert_nextlinen(" 2 cros ready mmc 4 mmc5.bootdev.part_4 "); + ut_assert_nextlinen("---"); + ut_assert_skip_to_line("(3 bootflows, 3 valid)"); + + ut_assert_console_end(); + + return 0; +} +BOOTSTD_TEST(bootflow_cros, 0); diff --git a/test/boot/cedit.c b/test/boot/cedit.c new file mode 100644 index 0000000..ab2b8a1 --- /dev/null +++ b/test/boot/cedit.c @@ -0,0 +1,198 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright 2023 Google LLC + * Written by Simon Glass <sjg@chromium.org> + */ + +#include <common.h> +#include <cedit.h> +#include <env.h> +#include <expo.h> +#include <mapmem.h> +#include <dm/ofnode.h> +#include <test/ut.h> +#include "bootstd_common.h" +#include <test/cedit-test.h> +#include "../../boot/scene_internal.h" + +/* Check the cedit command */ +static int cedit_base(struct unit_test_state *uts) +{ + extern struct expo *cur_exp; + struct scene_obj_menu *menu; + struct scene_obj_txt *txt; + struct expo *exp; + struct scene *scn; + + ut_assertok(run_command("cedit load hostfs - cedit.dtb", 0)); + + console_record_reset_enable(); + + /* + * ^N Move down to second menu + * ^M Open menu + * ^N Move down to second item + * ^M Select item + * \e Quit + */ + console_in_puts("\x0e\x0d\x0e\x0d\e"); + ut_assertok(run_command("cedit run", 0)); + + exp = cur_exp; + scn = expo_lookup_scene_id(exp, exp->scene_id); + ut_assertnonnull(scn); + + menu = scene_obj_find(scn, scn->highlight_id, SCENEOBJT_NONE); + ut_assertnonnull(menu); + + txt = scene_obj_find(scn, menu->title_id, SCENEOBJT_NONE); + ut_assertnonnull(txt); + ut_asserteq_str("AC Power", expo_get_str(exp, txt->str_id)); + + ut_asserteq(ID_AC_ON, menu->cur_item_id); + + return 0; +} +BOOTSTD_TEST(cedit_base, 0); + +/* Check the cedit write_fdt and read_fdt commands */ +static int cedit_fdt(struct unit_test_state *uts) +{ + struct video_priv *vid_priv; + extern struct expo *cur_exp; + struct scene_obj_menu *menu; + ulong addr = 0x1000; + struct ofprop prop; + struct scene *scn; + oftree tree; + ofnode node; + void *fdt; + int i; + + console_record_reset_enable(); + ut_assertok(run_command("cedit load hostfs - cedit.dtb", 0)); + + ut_asserteq(ID_SCENE1, cedit_prepare(cur_exp, &vid_priv, &scn)); + + /* get a menu to fiddle with */ + menu = scene_obj_find(scn, ID_CPU_SPEED, SCENEOBJT_MENU); + ut_assertnonnull(menu); + menu->cur_item_id = ID_CPU_SPEED_2; + + ut_assertok(run_command("cedit write_fdt hostfs - settings.dtb", 0)); + ut_assertok(run_commandf("load hostfs - %lx settings.dtb", addr)); + ut_assert_nextlinen("1024 bytes read"); + + fdt = map_sysmem(addr, 1024); + tree = oftree_from_fdt(fdt); + node = ofnode_find_subnode(oftree_root(tree), CEDIT_NODE_NAME); + + ut_asserteq(ID_CPU_SPEED_2, + ofnode_read_u32_default(node, "cpu-speed", 0)); + ut_asserteq_str("2.5 GHz", ofnode_read_string(node, "cpu-speed-str")); + ut_assert(ofnode_valid(node)); + + /* There should only be 4 properties */ + for (i = 0, ofnode_first_property(node, &prop); ofprop_valid(&prop); + i++, ofnode_next_property(&prop)) + ; + ut_asserteq(4, i); + + ut_assert_console_end(); + + /* reset the expo */ + menu->cur_item_id = ID_CPU_SPEED_1; + + /* load in the settings and make sure they update */ + ut_assertok(run_command("cedit read_fdt hostfs - settings.dtb", 0)); + ut_asserteq(ID_CPU_SPEED_2, menu->cur_item_id); + + ut_assertnonnull(menu); + ut_assert_console_end(); + + return 0; +} +BOOTSTD_TEST(cedit_fdt, 0); + +/* Check the cedit write_env and read_env commands */ +static int cedit_env(struct unit_test_state *uts) +{ + struct video_priv *vid_priv; + extern struct expo *cur_exp; + struct scene_obj_menu *menu; + struct scene *scn; + + console_record_reset_enable(); + ut_assertok(run_command("cedit load hostfs - cedit.dtb", 0)); + + ut_asserteq(ID_SCENE1, cedit_prepare(cur_exp, &vid_priv, &scn)); + + /* get a menu to fiddle with */ + menu = scene_obj_find(scn, ID_CPU_SPEED, SCENEOBJT_MENU); + ut_assertnonnull(menu); + menu->cur_item_id = ID_CPU_SPEED_2; + + ut_assertok(run_command("cedit write_env -v", 0)); + ut_assert_nextlinen("c.cpu-speed=7"); + ut_assert_nextlinen("c.cpu-speed-str=2.5 GHz"); + ut_assert_nextlinen("c.power-loss=10"); + ut_assert_nextlinen("c.power-loss-str=Always Off"); + ut_assert_console_end(); + + ut_asserteq(7, env_get_ulong("c.cpu-speed", 10, 0)); + ut_asserteq_str("2.5 GHz", env_get("c.cpu-speed-str")); + + /* reset the expo */ + menu->cur_item_id = ID_CPU_SPEED_1; + + ut_assertok(run_command("cedit read_env -v", 0)); + ut_assert_nextlinen("c.cpu-speed=7"); + ut_assert_nextlinen("c.power-loss=10"); + ut_assert_console_end(); + + ut_asserteq(ID_CPU_SPEED_2, menu->cur_item_id); + + return 0; +} +BOOTSTD_TEST(cedit_env, 0); + +/* Check the cedit write_cmos and read_cmos commands */ +static int cedit_cmos(struct unit_test_state *uts) +{ + struct scene_obj_menu *menu, *menu2; + struct video_priv *vid_priv; + extern struct expo *cur_exp; + struct scene *scn; + + console_record_reset_enable(); + ut_assertok(run_command("cedit load hostfs - cedit.dtb", 0)); + + ut_asserteq(ID_SCENE1, cedit_prepare(cur_exp, &vid_priv, &scn)); + + /* get the menus to fiddle with */ + menu = scene_obj_find(scn, ID_CPU_SPEED, SCENEOBJT_MENU); + ut_assertnonnull(menu); + menu->cur_item_id = ID_CPU_SPEED_2; + + menu2 = scene_obj_find(scn, ID_POWER_LOSS, SCENEOBJT_MENU); + ut_assertnonnull(menu2); + menu2->cur_item_id = ID_AC_MEMORY; + + ut_assertok(run_command("cedit write_cmos -v", 0)); + ut_assert_nextlinen("Write 2 bytes from offset 80 to 84"); + ut_assert_console_end(); + + /* reset the expo */ + menu->cur_item_id = ID_CPU_SPEED_1; + menu2->cur_item_id = ID_AC_OFF; + + ut_assertok(run_command("cedit read_cmos -v", 0)); + ut_assert_nextlinen("Read 2 bytes from offset 80 to 84"); + ut_assert_console_end(); + + ut_asserteq(ID_CPU_SPEED_2, menu->cur_item_id); + ut_asserteq(ID_AC_MEMORY, menu2->cur_item_id); + + return 0; +} +BOOTSTD_TEST(cedit_cmos, 0); diff --git a/test/boot/expo.c b/test/boot/expo.c index 3898f85..9002740 100644 --- a/test/boot/expo.c +++ b/test/boot/expo.c @@ -289,6 +289,33 @@ static int expo_object_attr(struct unit_test_state *uts) } BOOTSTD_TEST(expo_object_attr, UT_TESTF_DM | UT_TESTF_SCAN_FDT); +/** + * struct test_iter_priv - private data for expo-iterator test + * + * @count: number of scene objects + * @menu_count: number of menus + * @fail_at: item ID at which to return an error + */ +struct test_iter_priv { + int count; + int menu_count; + int fail_at; +}; + +int h_test_iter(struct scene_obj *obj, void *vpriv) +{ + struct test_iter_priv *priv = vpriv; + + if (priv->fail_at == obj->id) + return -EINVAL; + + priv->count++; + if (obj->type == SCENEOBJT_MENU) + priv->menu_count++; + + return 0; +} + /* Check creating a scene with a menu */ static int expo_object_menu(struct unit_test_state *uts) { @@ -296,6 +323,7 @@ static int expo_object_menu(struct unit_test_state *uts) struct scene_menitem *item; int id, label_id, desc_id, key_id, pointer_id, preview_id; struct scene_obj_txt *ptr, *name1, *desc1, *key1, *tit, *prev1; + struct test_iter_priv priv; struct scene *scn; struct expo *exp; ulong start_mem; @@ -382,6 +410,23 @@ static int expo_object_menu(struct unit_test_state *uts) ut_asserteq(menu->obj.dim.y + 32, prev1->obj.dim.y); ut_asserteq(true, prev1->obj.flags & SCENEOF_HIDE); + /* check iterating through scene items */ + memset(&priv, '\0', sizeof(priv)); + ut_assertok(expo_iter_scene_objs(exp, h_test_iter, &priv)); + ut_asserteq(7, priv.count); + ut_asserteq(1, priv.menu_count); + + /* check the iterator failing part way through iteration */ + memset(&priv, '\0', sizeof(priv)); + priv.fail_at = key_id; + ut_asserteq(-EINVAL, expo_iter_scene_objs(exp, h_test_iter, &priv)); + + /* 2 items (preview_id and the menuitem) are after key_id, 7 - 2 = 5 */ + ut_asserteq(5, priv.count); + + /* menu is first, so is still processed */ + ut_asserteq(1, priv.menu_count); + expo_destroy(exp); ut_assertok(ut_check_delta(start_mem)); @@ -669,46 +714,3 @@ static int expo_test_build(struct unit_test_state *uts) return 0; } BOOTSTD_TEST(expo_test_build, UT_TESTF_DM); - -/* Check the cedit command */ -static int expo_cedit(struct unit_test_state *uts) -{ - extern struct expo *cur_exp; - struct scene_obj_menu *menu; - struct scene_obj_txt *txt; - struct expo *exp; - struct scene *scn; - - if (!IS_ENABLED(CONFIG_CMD_CEDIT)) - return -EAGAIN; - - ut_assertok(run_command("cedit load hostfs - cedit.dtb", 0)); - - console_record_reset_enable(); - - /* - * ^N Move down to second menu - * ^M Open menu - * ^N Move down to second item - * ^M Select item - * \e Quit - */ - console_in_puts("\x0e\x0d\x0e\x0d\e"); - ut_assertok(run_command("cedit run", 0)); - - exp = cur_exp; - scn = expo_lookup_scene_id(exp, exp->scene_id); - ut_assertnonnull(scn); - - menu = scene_obj_find(scn, scn->highlight_id, SCENEOBJT_NONE); - ut_assertnonnull(menu); - - txt = scene_obj_find(scn, menu->title_id, SCENEOBJT_NONE); - ut_assertnonnull(txt); - ut_asserteq_str("AC Power", expo_get_str(exp, txt->str_id)); - - ut_asserteq(ID_AC_ON, menu->cur_item_id); - - return 0; -} -BOOTSTD_TEST(expo_cedit, UT_TESTF_DM | UT_TESTF_SCAN_FDT); diff --git a/test/boot/files/expo_ids.h b/test/boot/files/expo_ids.h new file mode 100644 index 0000000..027d44b --- /dev/null +++ b/test/boot/files/expo_ids.h @@ -0,0 +1,25 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Sample expo screen layout (ID numbers) + */ + +enum { + ZERO, + ID_PROMPT, + + ID_SCENE1, + ID_SCENE1_TITLE, + + ID_CPU_SPEED, + ID_CPU_SPEED_TITLE, + ID_CPU_SPEED_1, + ID_CPU_SPEED_2, + ID_CPU_SPEED_3, + + ID_POWER_LOSS, + ID_AC_OFF, + ID_AC_ON, + ID_AC_MEMORY, + + ID_DYNAMIC_START, +}; diff --git a/test/boot/files/expo_layout.dts b/test/boot/files/expo_layout.dts index 55d5c91..cb2a674 100644 --- a/test/boot/files/expo_layout.dts +++ b/test/boot/files/expo_layout.dts @@ -5,28 +5,7 @@ /dts-v1/; -/* -enum { - ZERO, - ID_PROMPT, - - ID_SCENE1, - ID_SCENE1_TITLE, - - ID_CPU_SPEED, - ID_CPU_SPEED_TITLE, - ID_CPU_SPEED_1, - ID_CPU_SPEED_2, - ID_CPU_SPEED_3, - - ID_POWER_LOSS, - ID_AC_OFF, - ID_AC_ON, - ID_AC_MEMORY, - - ID_DYNAMIC_START, -}; -*/ +/* see expo_ids.h for the IDs */ / { dynamic-start = <ID_DYNAMIC_START>; @@ -59,6 +38,9 @@ enum { /* IDs for the menu items */ item-id = <ID_CPU_SPEED_1 ID_CPU_SPEED_2 ID_CPU_SPEED_3>; + + start-bit = <0x400>; + bit-length = <2>; }; power-loss { @@ -70,6 +52,8 @@ enum { "Memory"; item-id = <ID_AC_OFF ID_AC_ON ID_AC_MEMORY>; + start-bit = <0x422>; + bit-length = <2>; }; }; }; diff --git a/test/cmd_ut.c b/test/cmd_ut.c index 0cb5144..0f56409 100644 --- a/test/cmd_ut.c +++ b/test/cmd_ut.c @@ -201,7 +201,7 @@ static char ut_help_text[] = "\nfdt - fdt command" #endif #ifdef CONFIG_CONSOLE_TRUETYPE - "\nut font - font command" + "\nfont - font command" #endif #ifdef CONFIG_CMD_LOADM "\nloadm - loadm command parameters and loading memory blob" diff --git a/test/common/event.c b/test/common/event.c index 6037ae2..c0912a3 100644 --- a/test/common/event.c +++ b/test/common/event.c @@ -18,6 +18,8 @@ struct test_state { int val; }; +static bool called; + static int h_adder(void *ctx, struct event *event) { struct event_data_test *data = &event->data.test; @@ -28,6 +30,14 @@ static int h_adder(void *ctx, struct event *event) return 0; } +static int h_adder_simple(void) +{ + called = true; + + return 0; +} +EVENT_SPY_SIMPLE(EVT_TEST, h_adder_simple); + static int test_event_base(struct unit_test_state *uts) { struct test_state state; @@ -46,6 +56,18 @@ static int test_event_base(struct unit_test_state *uts) } COMMON_TEST(test_event_base, 0); +static int test_event_simple(struct unit_test_state *uts) +{ + called = false; + + /* Check that the handler is called */ + ut_assertok(event_notify_null(EVT_TEST)); + ut_assert(called); + + return 0; +} +COMMON_TEST(test_event_simple, 0); + static int h_probe(void *ctx, struct event *event) { struct test_state *test_state = ctx; diff --git a/test/dm/acpi.c b/test/dm/acpi.c index 77eb524..5997bda 100644 --- a/test/dm/acpi.c +++ b/test/dm/acpi.c @@ -221,7 +221,8 @@ static int dm_test_acpi_create_dmar(struct unit_test_state *uts) ut_assertnonnull(cpu); ut_assertok(acpi_create_dmar(&dmar, DMAR_INTR_REMAP)); ut_asserteq(DMAR_INTR_REMAP, dmar.flags); - ut_asserteq(32 - 1, dmar.host_address_width); + ut_asserteq((IS_ENABLED(CONFIG_PHYS_64BIT) ? 64 : 32) - 1, + dmar.host_address_width); return 0; } @@ -277,13 +278,16 @@ static int dm_test_acpi_write_tables(struct unit_test_state *uts) */ ut_asserteq_ptr(dmar + 3, ctx.current); ut_asserteq(DMAR_INTR_REMAP, dmar->flags); - ut_asserteq(32 - 1, dmar->host_address_width); + ut_asserteq((IS_ENABLED(CONFIG_PHYS_64BIT) ? 64 : 32) - 1, + dmar->host_address_width); ut_asserteq(DMAR_INTR_REMAP, dmar[1].flags); - ut_asserteq(32 - 1, dmar[1].host_address_width); + ut_asserteq((IS_ENABLED(CONFIG_PHYS_64BIT) ? 64 : 32) - 1, + dmar[1].host_address_width); ut_asserteq(DMAR_INTR_REMAP, dmar[2].flags); - ut_asserteq(32 - 1, dmar[2].host_address_width); + ut_asserteq((IS_ENABLED(CONFIG_PHYS_64BIT) ? 64 : 32) - 1, + dmar[2].host_address_width); /* Check that the pointers were added correctly */ for (i = 0; i < 3; i++) { diff --git a/test/dm/clk.c b/test/dm/clk.c index f48de05..01417fb 100644 --- a/test/dm/clk.c +++ b/test/dm/clk.c @@ -36,6 +36,15 @@ static int dm_test_clk_base(struct unit_test_state *uts) ut_asserteq(clk_is_match(&clk_method1, &clk_method2), true); ut_asserteq(clk_method1.id, clk_method2.id); + ut_assertok(uclass_get_device_by_name(UCLASS_MISC, "clk-test2", &dev)); + ut_assertok(clk_set_defaults(dev, CLK_DEFAULTS_PRE)); + + ut_assertok(uclass_get_device_by_name(UCLASS_MISC, "clk-test3", &dev)); + ut_assertok(clk_set_defaults(dev, CLK_DEFAULTS_PRE)); + + ut_assertok(uclass_get_device_by_name(UCLASS_MISC, "clk-test4", &dev)); + ut_assertok(clk_set_defaults(dev, CLK_DEFAULTS_PRE)); + return 0; } diff --git a/test/dm/fwu_mdata.c b/test/dm/fwu_mdata.c index 8b5c83e..52018f6 100644 --- a/test/dm/fwu_mdata.c +++ b/test/dm/fwu_mdata.c @@ -93,6 +93,12 @@ static int dm_test_fwu_mdata_read(struct unit_test_state *uts) struct udevice *dev; struct fwu_mdata mdata = { 0 }; + /* + * Trigger lib/fwu_updates/fwu.c fwu_boottime_checks() + * to populate g_dev global pointer in that library. + */ + event_notify_null(EVT_MAIN_LOOP); + ut_assertok(uclass_first_device_err(UCLASS_FWU_MDATA, &dev)); ut_assertok(setup_blk_device(uts)); ut_assertok(populate_mmc_disk_image(uts)); @@ -112,6 +118,12 @@ static int dm_test_fwu_mdata_write(struct unit_test_state *uts) struct udevice *dev; struct fwu_mdata mdata = { 0 }; + /* + * Trigger lib/fwu_updates/fwu.c fwu_boottime_checks() + * to populate g_dev global pointer in that library. + */ + event_notify_null(EVT_MAIN_LOOP); + ut_assertok(setup_blk_device(uts)); ut_assertok(populate_mmc_disk_image(uts)); ut_assertok(write_mmc_blk_device(uts)); diff --git a/test/dm/host.c b/test/dm/host.c index 355ba77..85f21f9 100644 --- a/test/dm/host.c +++ b/test/dm/host.c @@ -8,6 +8,7 @@ #include <blk.h> #include <dm.h> #include <fs.h> +#include <os.h> #include <sandbox_host.h> #include <asm/test.h> #include <dm/device-internal.h> @@ -15,9 +16,6 @@ #include <test/test.h> #include <test/ut.h> -static const char filename[] = "2MB.ext2.img"; -static const char filename2[] = "1MB.fat32.img"; - /* Basic test of host interface */ static int dm_test_host(struct unit_test_state *uts) { @@ -25,6 +23,7 @@ static int dm_test_host(struct unit_test_state *uts) struct udevice *dev, *part, *chk, *blk; struct host_sb_plat *plat; struct blk_desc *desc; + char fname[256]; ulong mem_start; loff_t actwrite; @@ -40,13 +39,15 @@ static int dm_test_host(struct unit_test_state *uts) ut_assert(label != plat->label); ut_asserteq(0, plat->fd); - /* Attach a file created in test_host.py */ - ut_assertok(host_attach_file(dev, filename)); + /* Attach a file created in test_ut_dm_init */ + ut_assertok(os_persistent_file(fname, sizeof(fname), "2MB.ext2.img")); + + ut_assertok(host_attach_file(dev, fname)); ut_assertok(uclass_first_device_err(UCLASS_HOST, &chk)); ut_asserteq_ptr(chk, dev); - ut_asserteq_str(filename, plat->filename); - ut_assert(filename != plat->filename); + ut_asserteq_str(fname, plat->filename); + ut_assert(fname != plat->filename); ut_assert(plat->fd != 0); /* Get the block device */ @@ -79,12 +80,14 @@ static int dm_test_host_dup(struct unit_test_state *uts) { static char label[] = "test"; struct udevice *dev, *chk; + char fname[256]; ut_asserteq(0, uclass_id_count(UCLASS_HOST)); ut_assertok(host_create_device(label, true, &dev)); - /* Attach a file created in test_host.py */ - ut_assertok(host_attach_file(dev, filename)); + /* Attach a file created in test_ut_dm_init */ + ut_assertok(os_persistent_file(fname, sizeof(fname), "2MB.ext2.img")); + ut_assertok(host_attach_file(dev, fname)); ut_assertok(uclass_first_device_err(UCLASS_HOST, &chk)); ut_asserteq_ptr(chk, dev); ut_asserteq(1, uclass_id_count(UCLASS_HOST)); @@ -92,8 +95,10 @@ static int dm_test_host_dup(struct unit_test_state *uts) /* Create another device with the same label (should remove old one) */ ut_assertok(host_create_device(label, true, &dev)); - /* Attach a different file created in test_host.py */ - ut_assertok(host_attach_file(dev, filename2)); + /* Attach a different file created in test_ut_dm_init */ + ut_assertok(os_persistent_file(fname, sizeof(fname), "1MB.fat32.img")); + ut_assertok(host_attach_file(dev, fname)); + ut_assertok(uclass_first_device_err(UCLASS_HOST, &chk)); ut_asserteq_ptr(chk, dev); @@ -109,6 +114,7 @@ static int dm_test_cmd_host(struct unit_test_state *uts) { struct udevice *dev, *blk; struct blk_desc *desc; + char fname[256]; console_record_reset(); @@ -117,7 +123,8 @@ static int dm_test_cmd_host(struct unit_test_state *uts) ut_assert_nextline("dev blocks label path"); ut_assert_console_end(); - ut_assertok(run_commandf("host bind -r test2 %s", filename)); + ut_assertok(os_persistent_file(fname, sizeof(fname), "2MB.ext2.img")); + ut_assertok(run_commandf("host bind -r test2 %s", fname)); /* Check the -r flag worked */ ut_assertok(uclass_first_device_err(UCLASS_HOST, &dev)); @@ -127,10 +134,11 @@ static int dm_test_cmd_host(struct unit_test_state *uts) ut_assertok(run_command("host info", 0)); ut_assert_nextline("dev blocks label path"); - ut_assert_nextline(" 0 4096 test2 2MB.ext2.img"); + ut_assert_nextlinen(" 0 4096 test2"); ut_assert_console_end(); - ut_assertok(run_commandf("host bind fat %s", filename2)); + ut_assertok(os_persistent_file(fname, sizeof(fname), "1MB.fat32.img")); + ut_assertok(run_commandf("host bind fat %s", fname)); /* Check it is not removable (no '-r') */ ut_assertok(uclass_next_device_err(&dev)); @@ -140,8 +148,8 @@ static int dm_test_cmd_host(struct unit_test_state *uts) ut_assertok(run_command("host info", 0)); ut_assert_nextline("dev blocks label path"); - ut_assert_nextline(" 0 4096 test2 2MB.ext2.img"); - ut_assert_nextline(" 1 2048 fat 1MB.fat32.img"); + ut_assert_nextlinen(" 0 4096 test2"); + ut_assert_nextlinen(" 1 2048 fat"); ut_assert_console_end(); ut_asserteq(1, run_command("host info test", 0)); @@ -150,7 +158,7 @@ static int dm_test_cmd_host(struct unit_test_state *uts) ut_assertok(run_command("host info fat", 0)); ut_assert_nextline("dev blocks label path"); - ut_assert_nextline(" 1 2048 fat 1MB.fat32.img"); + ut_assert_nextlinen(" 1 2048 fat"); ut_assert_console_end(); /* check 'host dev' */ @@ -187,7 +195,7 @@ static int dm_test_cmd_host(struct unit_test_state *uts) ut_assertok(run_command("host info", 0)); ut_assert_nextline("dev blocks label path"); - ut_assert_nextline(" 1 2048 fat 1MB.fat32.img"); + ut_assert_nextlinen(" 1 2048 fat"); ut_assert_console_end(); return 0; diff --git a/test/dm/nvmxip.c b/test/dm/nvmxip.c index 89bf481..f0ad47d 100644 --- a/test/dm/nvmxip.c +++ b/test/dm/nvmxip.c @@ -103,6 +103,8 @@ static int dm_test_nvmxip(struct unit_test_state *uts) void *buffer = NULL; unsigned long flashsz; + sandbox_set_enable_memio(true); + /* set the flash content first for both devices */ dm_nvmxip_flash_sanity(uts, 0, NULL); dm_nvmxip_flash_sanity(uts, 1, NULL); diff --git a/test/dm/ofnode.c b/test/dm/ofnode.c index 6fbebc7..d71faac 100644 --- a/test/dm/ofnode.c +++ b/test/dm/ofnode.c @@ -583,6 +583,25 @@ static int dm_test_ofnode_conf(struct unit_test_state *uts) } DM_TEST(dm_test_ofnode_conf, 0); +static int dm_test_ofnode_options(struct unit_test_state *uts) +{ + u64 bootscr_address, bootscr_offset; + u64 bootscr_flash_offset, bootscr_flash_size; + + ut_assertok(ofnode_read_bootscript_address(&bootscr_address, + &bootscr_offset)); + ut_asserteq_64(0, bootscr_address); + ut_asserteq_64(0x12345678, bootscr_offset); + + ut_assertok(ofnode_read_bootscript_flash(&bootscr_flash_offset, + &bootscr_flash_size)); + ut_asserteq_64(0, bootscr_flash_offset); + ut_asserteq_64(0x2000, bootscr_flash_size); + + return 0; +} +DM_TEST(dm_test_ofnode_options, 0); + static int dm_test_ofnode_for_each_compatible_node(struct unit_test_state *uts) { const char compatible[] = "denx,u-boot-fdt-test"; @@ -967,6 +986,14 @@ static int dm_test_ofnode_u64(struct unit_test_state *uts) ut_asserteq_64(0x1111222233334444, val); ut_asserteq(-EINVAL, ofnode_read_u64(node, "missing", &val)); + ut_assertok(ofnode_read_u64_index(node, "int64-array", 0, &val)); + ut_asserteq_64(0x1111222233334444, val); + ut_assertok(ofnode_read_u64_index(node, "int64-array", 1, &val)); + ut_asserteq_64(0x4444333322221111, val); + ut_asserteq(-EOVERFLOW, + ofnode_read_u64_index(node, "int64-array", 2, &val)); + ut_asserteq(-EINVAL, ofnode_read_u64_index(node, "missing", 0, &val)); + return 0; } DM_TEST(dm_test_ofnode_u64, UT_TESTF_SCAN_FDT); diff --git a/test/dm/phy.c b/test/dm/phy.c index 4d4a083..4f91abc 100644 --- a/test/dm/phy.c +++ b/test/dm/phy.c @@ -29,7 +29,9 @@ static int dm_test_phy_base(struct unit_test_state *uts) * Get the same phy port in 2 different ways and compare. */ ut_assertok(generic_phy_get_by_name(parent, "phy1", &phy1_method1)); + ut_assert(generic_phy_valid(&phy1_method1)); ut_assertok(generic_phy_get_by_index(parent, 0, &phy1_method2)); + ut_assert(generic_phy_valid(&phy1_method2)); ut_asserteq(phy1_method1.id, phy1_method2.id); /* @@ -47,9 +49,23 @@ static int dm_test_phy_base(struct unit_test_state *uts) ut_assert(phy2.dev != phy3.dev); /* Try to get a non-existing phy */ - ut_asserteq(-ENODEV, uclass_get_device(UCLASS_PHY, 4, &dev)); + ut_asserteq(-ENODEV, uclass_get_device(UCLASS_PHY, 5, &dev)); ut_asserteq(-ENODATA, generic_phy_get_by_name(parent, "phy_not_existing", &phy1_method1)); + ut_assert(!generic_phy_valid(&phy1_method1)); + ut_asserteq(-ENOENT, generic_phy_get_by_index(parent, 3, + &phy1_method2)); + ut_assert(!generic_phy_valid(&phy1_method2)); + + /* Try to get a phy where of_xlate fail */ + ut_assertok(uclass_get_device_by_name(UCLASS_SIMPLE_BUS, + "gen_phy_user2", &parent)); + ut_asserteq(-EINVAL, generic_phy_get_by_name(parent, "phy1", + &phy1_method1)); + ut_assert(!generic_phy_valid(&phy1_method1)); + ut_asserteq(-EINVAL, generic_phy_get_by_index(parent, 0, + &phy1_method2)); + ut_assert(!generic_phy_valid(&phy1_method2)); return 0; } @@ -218,3 +234,32 @@ static int dm_test_phy_multi_exit(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_phy_multi_exit, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); + +static int dm_test_phy_setup(struct unit_test_state *uts) +{ + struct phy phy; + struct udevice *parent; + + ut_assertok(uclass_get_device_by_name(UCLASS_SIMPLE_BUS, + "gen_phy_user", &parent)); + + /* normal */ + ut_assertok(generic_setup_phy(parent, &phy, 0)); + ut_assertok(generic_shutdown_phy(&phy)); + + /* power_off fail with -EIO */ + ut_assertok(generic_setup_phy(parent, &phy, 1)); + ut_asserteq(-EIO, generic_shutdown_phy(&phy)); + + /* power_on fail with -EIO */ + ut_asserteq(-EIO, generic_setup_phy(parent, &phy, 2)); + ut_assertok(generic_shutdown_phy(&phy)); + + /* generic_phy_get_by_index fail with -ENOENT */ + ut_asserteq(-ENOENT, generic_phy_get_by_index(parent, 3, &phy)); + ut_assertok(generic_setup_phy(parent, &phy, 3)); + ut_assertok(generic_shutdown_phy(&phy)); + + return 0; +} +DM_TEST(dm_test_phy_setup, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); diff --git a/test/dm/test-fdt.c b/test/dm/test-fdt.c index eeecd1d..72d0eb5 100644 --- a/test/dm/test-fdt.c +++ b/test/dm/test-fdt.c @@ -135,8 +135,8 @@ int dm_check_devices(struct unit_test_state *uts, int num_devices) * want to test the code that sets that up * (testfdt_drv_probe()). */ - base = fdtdec_get_addr(gd->fdt_blob, dev_of_offset(dev), - "ping-expect"); + base = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev), + "ping-expect", -1); debug("dev=%d, base=%d: %s\n", i, base, fdt_get_name(gd->fdt_blob, dev_of_offset(dev), NULL)); diff --git a/test/dm/tpm.c b/test/dm/tpm.c index 3defb3c..cde933a 100644 --- a/test/dm/tpm.c +++ b/test/dm/tpm.c @@ -98,10 +98,11 @@ static int test_tpm_autostart(struct unit_test_state *uts, if (reinit) ut_assertok(tpm_init(dev)); - /* - * tpm_auto_start will rerun tpm_init() if reinit, but handles the - * -EBUSY return code internally. - */ + + /* + * tpm_auto_start will rerun tpm_init() if reinit, but handles the + * -EBUSY return code internally. + */ ut_assertok(tpm_auto_start(dev)); return 0; diff --git a/test/lib/abuf.c b/test/lib/abuf.c index 42ee4c1..42803b2 100644 --- a/test/lib/abuf.c +++ b/test/lib/abuf.c @@ -155,6 +155,31 @@ static int lib_test_abuf_realloc_size(struct unit_test_state *uts) } LIB_TEST(lib_test_abuf_realloc_size, 0); +/* Test abuf_realloc_inc() */ +static int lib_test_abuf_realloc_inc(struct unit_test_state *uts) +{ + struct abuf buf; + ulong start; + + start = ut_check_free(); + + abuf_init(&buf); + ut_asserteq(0, buf.size); + ut_asserteq(false, buf.alloced); + + abuf_realloc_inc(&buf, 20); + ut_asserteq(20, buf.size); + ut_asserteq(true, buf.alloced); + + abuf_uninit(&buf); + + /* Check for memory leaks */ + ut_assertok(ut_check_delta(start)); + + return 0; +} +LIB_TEST(lib_test_abuf_realloc_inc, 0); + /* Test handling of buffers that are too large */ static int lib_test_abuf_large(struct unit_test_state *uts) { diff --git a/test/lib/asn1.c b/test/lib/asn1.c index 8661fdd..a66cdd7 100644 --- a/test/lib/asn1.c +++ b/test/lib/asn1.c @@ -120,7 +120,7 @@ static int lib_asn1_x509(struct unit_test_state *uts) cert = x509_cert_parse(cert_data, cert_data_len); - ut_assertf(cert != NULL, "decoding failed\n"); + ut_assertf(!IS_ERR(cert), "decoding failed\n"); ut_assertf(!strcmp(cert->subject, "Linaro: Tester"), "subject doesn't match\n"); ut_assertf(!strcmp(cert->issuer, "Linaro: Tester"), @@ -313,7 +313,7 @@ static int lib_asn1_pkcs7(struct unit_test_state *uts) pkcs7 = pkcs7_parse_message(image_pk7, image_pk7_len); - ut_assertf(pkcs7 != NULL, "decoding failed\n"); + ut_assertf(!IS_ERR(pkcs7), "decoding failed\n"); ut_assertf(pkcs7->data_len == 104, "signature size doesn't match\n"); ut_assertf(pkcs7->signed_infos != NULL, "sign-info doesn't exist\n"); ut_assertf(pkcs7->signed_infos->msgdigest_len == 32, diff --git a/test/lib/strlcat.c b/test/lib/strlcat.c index a0ec037..d8453fe 100644 --- a/test/lib/strlcat.c +++ b/test/lib/strlcat.c @@ -43,11 +43,11 @@ static int do_test_strlcat(struct unit_test_state *uts, int line, size_t align1, s2[i] = 32 + 23 * i % (127 - 32); s2[len2 - 1] = '\0'; - expected = len2 < n ? min(len1 + len2 - 1, n) : n; + expected = min(strlen(s2), n) + strlen(s1); actual = strlcat(s2, s1, n); if (expected != actual) { ut_failf(uts, __FILE__, line, __func__, - "strlcat(s2, s1, 2) == len2 < n ? min(len1 + len2, n) : n", + "strlcat(s2, s1, n) == min(len2, n) + len1", "Expected %#zx (%zd), got %#zx (%zd)", expected, expected, actual, actual); return CMD_RET_FAILURE; diff --git a/test/print_ut.c b/test/print_ut.c index 47a6ce5..b26f628 100644 --- a/test/print_ut.c +++ b/test/print_ut.c @@ -283,16 +283,21 @@ static int print_do_hex_dump(struct unit_test_state *uts) /* bytes */ console_record_reset(); print_hex_dump_bytes("", DUMP_PREFIX_ADDRESS, buf, 0x12); - ut_assert_nextline("00000000: 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff ..\"3DUfw........"); - ut_assert_nextline("00000010: 10 00 .."); + ut_assert_nextline("%0*lx: 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff ..\"3DUfw........", + IS_ENABLED(CONFIG_PHYS_64BIT) ? 16 : 8, 0x0UL); + ut_assert_nextline("%0*lx: 10 00 ..", + IS_ENABLED(CONFIG_PHYS_64BIT) ? 16 : 8, 0x10UL); ut_assert_console_end(); /* line length */ console_record_reset(); print_hex_dump("", DUMP_PREFIX_ADDRESS, 8, 1, buf, 0x12, true); - ut_assert_nextline("00000000: 00 11 22 33 44 55 66 77 ..\"3DUfw"); - ut_assert_nextline("00000008: 88 99 aa bb cc dd ee ff ........"); - ut_assert_nextline("00000010: 10 00 .."); + ut_assert_nextline("%0*lx: 00 11 22 33 44 55 66 77 ..\"3DUfw", + IS_ENABLED(CONFIG_PHYS_64BIT) ? 16 : 8, 0x0UL); + ut_assert_nextline("%0*lx: 88 99 aa bb cc dd ee ff ........", + IS_ENABLED(CONFIG_PHYS_64BIT) ? 16 : 8, 0x8UL); + ut_assert_nextline("%0*lx: 10 00 ..", + IS_ENABLED(CONFIG_PHYS_64BIT) ? 16 : 8, 0x10UL); ut_assert_console_end(); unmap_sysmem(buf); @@ -300,31 +305,39 @@ static int print_do_hex_dump(struct unit_test_state *uts) console_record_reset(); buf[0x41] = 0x41; print_hex_dump("", DUMP_PREFIX_ADDRESS, 0x40, 1, buf, 0x42, true); - ut_assert_nextline("00000000: 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ..\"3DUfw........................................................"); - ut_assert_nextline("00000040: 00 41 .A"); + ut_assert_nextline("%0*lx: 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ..\"3DUfw........................................................", + IS_ENABLED(CONFIG_PHYS_64BIT) ? 16 : 8, 0x0UL); + ut_assert_nextline("%0*lx: 00 41 .A", + IS_ENABLED(CONFIG_PHYS_64BIT) ? 16 : 8, 0x40UL); ut_assert_console_end(); /* 16-bit */ console_record_reset(); print_hex_dump("", DUMP_PREFIX_ADDRESS, 0, 2, buf, 0x12, true); - ut_assert_nextline("00000000: 1100 3322 5544 7766 9988 bbaa ddcc ffee ..\"3DUfw........"); - ut_assert_nextline("00000010: 0010 .."); + ut_assert_nextline("%0*lx: 1100 3322 5544 7766 9988 bbaa ddcc ffee ..\"3DUfw........", + IS_ENABLED(CONFIG_PHYS_64BIT) ? 16 : 8, 0x0UL); + ut_assert_nextline("%0*lx: 0010 ..", + IS_ENABLED(CONFIG_PHYS_64BIT) ? 16 : 8, 0x10UL); ut_assert_console_end(); unmap_sysmem(buf); /* 32-bit */ console_record_reset(); print_hex_dump("", DUMP_PREFIX_ADDRESS, 0, 4, buf, 0x14, true); - ut_assert_nextline("00000000: 33221100 77665544 bbaa9988 ffeeddcc ..\"3DUfw........"); - ut_assert_nextline("00000010: 00000010 ...."); + ut_assert_nextline("%0*lx: 33221100 77665544 bbaa9988 ffeeddcc ..\"3DUfw........", + IS_ENABLED(CONFIG_PHYS_64BIT) ? 16 : 8, 0x0UL); + ut_assert_nextline("%0*lx: 00000010 ....", + IS_ENABLED(CONFIG_PHYS_64BIT) ? 16 : 8, 0x10UL); ut_assert_console_end(); unmap_sysmem(buf); /* 64-bit */ console_record_reset(); print_hex_dump("", DUMP_PREFIX_ADDRESS, 16, 8, buf, 0x18, true); - ut_assert_nextline("00000000: 7766554433221100 ffeeddccbbaa9988 ..\"3DUfw........"); - ut_assert_nextline("00000010: 0000000000000010 ........"); + ut_assert_nextline("%0*lx: 7766554433221100 ffeeddccbbaa9988 ..\"3DUfw........", + IS_ENABLED(CONFIG_PHYS_64BIT) ? 16 : 8, 0x0UL); + ut_assert_nextline("%0*lx: 0000000000000010 ........", + IS_ENABLED(CONFIG_PHYS_64BIT) ? 16 : 8, 0x10UL); ut_assert_console_end(); unmap_sysmem(buf); @@ -337,7 +350,8 @@ static int print_do_hex_dump(struct unit_test_state *uts) buf[4 + i] = 126 + i; buf[8] = 255; print_hex_dump("", DUMP_PREFIX_ADDRESS, 0, 1, buf, 10, true); - ut_assert_nextline("00000000: 00 1f 20 21 7e 7f 80 81 ff 99 .. !~....."); + ut_assert_nextline("%0*lx: 00 1f 20 21 7e 7f 80 81 ff 99 .. !~.....", + IS_ENABLED(CONFIG_PHYS_64BIT) ? 16 : 8, 0x0UL); ut_assert_console_end(); unmap_sysmem(buf); diff --git a/test/py/tests/fs_helper.py b/test/py/tests/fs_helper.py index 17151bc..9882ddb 100644 --- a/test/py/tests/fs_helper.py +++ b/test/py/tests/fs_helper.py @@ -9,7 +9,7 @@ import re import os from subprocess import call, check_call, check_output, CalledProcessError -def mk_fs(config, fs_type, size, prefix, use_src_dir=False): +def mk_fs(config, fs_type, size, prefix): """Create a file system volume Args: @@ -17,14 +17,12 @@ def mk_fs(config, fs_type, size, prefix, use_src_dir=False): fs_type (str): File system type, e.g. 'ext4' size (int): Size of file system in bytes prefix (str): Prefix string of volume's file name - use_src_dir (bool): true to put the file in the source directory Raises: CalledProcessError: if any error occurs when creating the filesystem """ fs_img = f'{prefix}.{fs_type}.img' - fs_img = os.path.join(config.source_dir if use_src_dir - else config.persistent_data_dir, fs_img) + fs_img = os.path.join(config.persistent_data_dir, fs_img) if fs_type == 'fat16': mkfs_opt = '-F 16' diff --git a/test/py/tests/test_efi_capsule/capsule_gen_binman.dts b/test/py/tests/test_efi_capsule/capsule_gen_binman.dts new file mode 100644 index 0000000..e8a1858 --- /dev/null +++ b/test/py/tests/test_efi_capsule/capsule_gen_binman.dts @@ -0,0 +1,321 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Devicetree for capsule generation through binman + */ + +/dts-v1/; + +#include <sandbox_efi_capsule.h> + +/ { + binman: binman { + multiple-images; + }; +}; + +&binman { + itb { + filename = UBOOT_FIT_IMAGE; + + fit { + description = "Automatic U-Boot environment update"; + #address-cells = <2>; + + images { + u-boot-bin { + description = "U-Boot binary on SPI Flash"; + compression = "none"; + type = "firmware"; + arch = "sandbox"; + load = <0>; + text { + text = "u-boot:New"; + }; + + hash-1 { + algo = "sha1"; + }; + }; + u-boot-env { + description = "U-Boot environment on SPI Flash"; + compression = "none"; + type = "firmware"; + arch = "sandbox"; + load = <0>; + text { + text = "u-boot-env:New"; + }; + + hash-1 { + algo = "sha1"; + }; + }; + }; + }; + }; + + capsule1 { + filename = "Test01"; + efi-capsule { + image-index = <0x1>; + image-guid = SANDBOX_UBOOT_IMAGE_GUID; + + text { + text = "u-boot:New"; + }; + }; + }; + + capsule2 { + filename = "Test02"; + efi-capsule { + image-index = <0x2>; + image-guid = SANDBOX_UBOOT_ENV_IMAGE_GUID; + + text { + text = "u-boot-env:New"; + }; + }; + }; + + capsule3 { + filename = "Test03"; + efi-capsule { + image-index = <0x1>; + image-guid = SANDBOX_INCORRECT_GUID; + + text { + text = "u-boot:New"; + }; + }; + }; + + capsule4 { + filename = "Test04"; + efi-capsule { + image-index = <0x1>; + image-guid = SANDBOX_FIT_IMAGE_GUID; + + blob { + filename = UBOOT_FIT_IMAGE; + }; + }; + }; + + capsule5 { + filename = "Test05"; + efi-capsule { + image-index = <0x1>; + image-guid = SANDBOX_INCORRECT_GUID; + + blob { + filename = UBOOT_FIT_IMAGE; + }; + }; + }; + + capsule6 { + filename = "Test101"; + efi-capsule { + image-index = <0x1>; + fw-version = <0x5>; + image-guid = SANDBOX_UBOOT_IMAGE_GUID; + + text { + text = "u-boot:New"; + }; + }; + }; + + capsule7 { + filename = "Test102"; + efi-capsule { + image-index = <0x2>; + fw-version = <0xa>; + image-guid = SANDBOX_UBOOT_ENV_IMAGE_GUID; + + text { + text = "u-boot-env:New"; + }; + }; + }; + + capsule8 { + filename = "Test103"; + efi-capsule { + image-index = <0x1>; + fw-version = <0x2>; + image-guid = SANDBOX_UBOOT_IMAGE_GUID; + + text { + text = "u-boot:New"; + }; + }; + }; + + capsule9 { + filename = "Test104"; + efi-capsule { + image-index = <0x1>; + fw-version = <0x5>; + image-guid = SANDBOX_FIT_IMAGE_GUID; + + blob { + filename = UBOOT_FIT_IMAGE; + }; + }; + }; + + capsule10 { + filename = "Test105"; + efi-capsule { + image-index = <0x1>; + fw-version = <0x2>; + image-guid = SANDBOX_FIT_IMAGE_GUID; + + blob { + filename = UBOOT_FIT_IMAGE; + }; + }; + }; + + capsule11 { + filename = "Test11"; + efi-capsule { + image-index = <0x1>; + image-guid = SANDBOX_UBOOT_IMAGE_GUID; + private-key = CAPSULE_PRIV_KEY; + public-key-cert = CAPSULE_PUB_KEY; + monotonic-count = <0x1>; + + text { + text = "u-boot:New"; + }; + }; + }; + + capsule12 { + filename = "Test12"; + efi-capsule { + image-index = <0x1>; + image-guid = SANDBOX_UBOOT_IMAGE_GUID; + private-key = CAPSULE_INVAL_KEY; + public-key-cert = CAPSULE_INVAL_PUB_KEY; + monotonic-count = <0x1>; + + text { + text = "u-boot:New"; + }; + }; + }; + + capsule13 { + filename = "Test13"; + efi-capsule { + image-index = <0x1>; + image-guid = SANDBOX_FIT_IMAGE_GUID; + private-key = CAPSULE_PRIV_KEY; + public-key-cert = CAPSULE_PUB_KEY; + monotonic-count = <0x1>; + + blob { + filename = UBOOT_FIT_IMAGE; + }; + }; + }; + + capsule14 { + filename = "Test14"; + efi-capsule { + image-index = <0x1>; + image-guid = SANDBOX_FIT_IMAGE_GUID; + private-key = CAPSULE_INVAL_KEY; + public-key-cert = CAPSULE_INVAL_PUB_KEY; + monotonic-count = <0x1>; + + blob { + filename = UBOOT_FIT_IMAGE; + }; + }; + }; + + capsule15 { + filename = "Test111"; + efi-capsule { + image-index = <0x1>; + fw-version = <0x5>; + image-guid = SANDBOX_UBOOT_IMAGE_GUID; + private-key = CAPSULE_PRIV_KEY; + public-key-cert = CAPSULE_PUB_KEY; + monotonic-count = <0x1>; + + text { + text = "u-boot:New"; + }; + }; + }; + + capsule16 { + filename = "Test112"; + efi-capsule { + image-index = <0x2>; + fw-version = <0xa>; + image-guid = SANDBOX_UBOOT_ENV_IMAGE_GUID; + private-key = CAPSULE_PRIV_KEY; + public-key-cert = CAPSULE_PUB_KEY; + monotonic-count = <0x1>; + + text { + text = "u-boot-env:New"; + }; + }; + }; + + capsule17 { + filename = "Test113"; + efi-capsule { + image-index = <0x1>; + fw-version = <0x2>; + image-guid = SANDBOX_UBOOT_IMAGE_GUID; + private-key = CAPSULE_PRIV_KEY; + public-key-cert = CAPSULE_PUB_KEY; + monotonic-count = <0x1>; + + text { + text = "u-boot:New"; + }; + }; + }; + + capsule18 { + filename = "Test114"; + efi-capsule { + image-index = <0x1>; + fw-version = <0x5>; + image-guid = SANDBOX_FIT_IMAGE_GUID; + private-key = CAPSULE_PRIV_KEY; + public-key-cert = CAPSULE_PUB_KEY; + monotonic-count = <0x1>; + + blob { + filename = UBOOT_FIT_IMAGE; + }; + }; + }; + + capsule19 { + filename = "Test115"; + efi-capsule { + image-index = <0x1>; + fw-version = <0x2>; + image-guid = SANDBOX_FIT_IMAGE_GUID; + private-key = CAPSULE_PRIV_KEY; + public-key-cert = CAPSULE_PUB_KEY; + monotonic-count = <0x1>; + + blob { + filename = UBOOT_FIT_IMAGE; + }; + }; + }; +}; diff --git a/test/py/tests/test_efi_capsule/conftest.py b/test/py/tests/test_efi_capsule/conftest.py index 054be1e..dd41da9 100644 --- a/test/py/tests/test_efi_capsule/conftest.py +++ b/test/py/tests/test_efi_capsule/conftest.py @@ -4,6 +4,8 @@ """Fixture for UEFI capsule test.""" +import os + from subprocess import call, check_call, CalledProcessError import pytest from capsule_defs import CAPSULE_DATA_DIR, CAPSULE_INSTALL_DIR, EFITOOLS_PATH @@ -34,40 +36,31 @@ def efi_capsule_data(request, u_boot_config): capsule_auth_enabled = u_boot_config.buildconfig.get( 'config_efi_capsule_authenticate') + key_dir = u_boot_config.source_dir + '/board/sandbox' if capsule_auth_enabled: - # Create private key (SIGNER.key) and certificate (SIGNER.crt) - check_call('cd %s; ' - 'openssl req -x509 -sha256 -newkey rsa:2048 ' - '-subj /CN=TEST_SIGNER/ -keyout SIGNER.key ' - '-out SIGNER.crt -nodes -days 365' - % data_dir, shell=True) - check_call('cd %s; %scert-to-efi-sig-list SIGNER.crt SIGNER.esl' - % (data_dir, EFITOOLS_PATH), shell=True) - - # Update dtb adding capsule certificate - check_call('cd %s; ' - 'cp %s/test/py/tests/test_efi_capsule/signature.dts .' - % (data_dir, u_boot_config.source_dir), shell=True) - check_call('cd %s; ' - 'dtc -@ -I dts -O dtb -o signature.dtbo signature.dts; ' - 'fdtoverlay -i %s/arch/sandbox/dts/test.dtb ' - '-o test_sig.dtb signature.dtbo' - % (data_dir, u_boot_config.build_dir), shell=True) + # Get the keys from the board directory + check_call('cp %s/capsule_priv_key_good.key %s/SIGNER.key' + % (key_dir, data_dir), shell=True) + check_call('cp %s/capsule_pub_key_good.crt %s/SIGNER.crt' + % (key_dir, data_dir), shell=True) + check_call('cp %s/capsule_pub_esl_good.esl %s/SIGNER.esl' + % (key_dir, data_dir), shell=True) - # Create *malicious* private key (SIGNER2.key) and certificate - # (SIGNER2.crt) - check_call('cd %s; ' - 'openssl req -x509 -sha256 -newkey rsa:2048 ' - '-subj /CN=TEST_SIGNER/ -keyout SIGNER2.key ' - '-out SIGNER2.crt -nodes -days 365' - % data_dir, shell=True) + check_call('cp %s/capsule_priv_key_bad.key %s/SIGNER2.key' + % (key_dir, data_dir), shell=True) + check_call('cp %s/capsule_pub_key_bad.crt %s/SIGNER2.crt' + % (key_dir, data_dir), shell=True) # Update dtb to add the version information check_call('cd %s; ' 'cp %s/test/py/tests/test_efi_capsule/version.dts .' % (data_dir, u_boot_config.source_dir), shell=True) + if capsule_auth_enabled: check_call('cd %s; ' + 'cp %s/arch/sandbox/dts/test.dtb test_sig.dtb' + % (data_dir, u_boot_config.build_dir), shell=True) + check_call('cd %s; ' 'dtc -@ -I dts -O dtb -o version.dtbo version.dts; ' 'fdtoverlay -i test_sig.dtb ' '-o test_ver.dtb version.dtbo' @@ -79,132 +72,20 @@ def efi_capsule_data(request, u_boot_config): '-o test_ver.dtb version.dtbo' % (data_dir, u_boot_config.build_dir), shell=True) - # Create capsule files # two regions: one for u-boot.bin and the other for u-boot.env check_call('cd %s; echo -n u-boot:Old > u-boot.bin.old; echo -n u-boot:New > u-boot.bin.new; echo -n u-boot-env:Old > u-boot.env.old; echo -n u-boot-env:New > u-boot.env.new' % data_dir, shell=True) - check_call('sed -e \"s?BINFILE1?u-boot.bin.new?\" -e \"s?BINFILE2?u-boot.env.new?\" %s/test/py/tests/test_efi_capsule/uboot_bin_env.its > %s/uboot_bin_env.its' % - (u_boot_config.source_dir, data_dir), - shell=True) - check_call('cd %s; %s/tools/mkimage -f uboot_bin_env.its uboot_bin_env.itb' % - (data_dir, u_boot_config.build_dir), - shell=True) - check_call('cd %s; %s/tools/mkeficapsule --index 1 --guid 09D7CF52-0720-4710-91D1-08469B7FE9C8 u-boot.bin.new Test01' % - (data_dir, u_boot_config.build_dir), - shell=True) - check_call('cd %s; %s/tools/mkeficapsule --index 2 --guid 5A7021F5-FEF2-48B4-AABA-832E777418C0 u-boot.env.new Test02' % - (data_dir, u_boot_config.build_dir), - shell=True) - check_call('cd %s; %s/tools/mkeficapsule --index 1 --guid 058B7D83-50D5-4C47-A195-60D86AD341C4 u-boot.bin.new Test03' % - (data_dir, u_boot_config.build_dir), - shell=True) - check_call('cd %s; %s/tools/mkeficapsule --index 1 --guid 3673B45D-6A7C-46F3-9E60-ADABB03F7937 uboot_bin_env.itb Test04' % - (data_dir, u_boot_config.build_dir), - shell=True) - check_call('cd %s; %s/tools/mkeficapsule --index 1 --guid 058B7D83-50D5-4C47-A195-60D86AD341C4 uboot_bin_env.itb Test05' % - (data_dir, u_boot_config.build_dir), - shell=True) - check_call('cd %s; %s/tools/mkeficapsule --index 1 --fw-version 5 ' - '--guid 09D7CF52-0720-4710-91D1-08469B7FE9C8 u-boot.bin.new Test101' % - (data_dir, u_boot_config.build_dir), - shell=True) - check_call('cd %s; %s/tools/mkeficapsule --index 2 --fw-version 10 ' - '--guid 5A7021F5-FEF2-48B4-AABA-832E777418C0 u-boot.env.new Test102' % - (data_dir, u_boot_config.build_dir), - shell=True) - check_call('cd %s; %s/tools/mkeficapsule --index 1 --fw-version 2 ' - '--guid 09D7CF52-0720-4710-91D1-08469B7FE9C8 u-boot.bin.new Test103' % - (data_dir, u_boot_config.build_dir), - shell=True) - check_call('cd %s; %s/tools/mkeficapsule --index 1 --fw-version 5 ' - '--guid 3673B45D-6A7C-46F3-9E60-ADABB03F7937 uboot_bin_env.itb Test104' % - (data_dir, u_boot_config.build_dir), - shell=True) - check_call('cd %s; %s/tools/mkeficapsule --index 1 --fw-version 2 ' - '--guid 3673B45D-6A7C-46F3-9E60-ADABB03F7937 uboot_bin_env.itb Test105' % - (data_dir, u_boot_config.build_dir), - shell=True) - if capsule_auth_enabled: - # raw firmware signed with proper key - check_call('cd %s; ' - '%s/tools/mkeficapsule --index 1 --monotonic-count 1 ' - '--private-key SIGNER.key --certificate SIGNER.crt ' - '--guid 09D7CF52-0720-4710-91D1-08469B7FE9C8 ' - 'u-boot.bin.new Test11' - % (data_dir, u_boot_config.build_dir), - shell=True) - # raw firmware signed with *mal* key - check_call('cd %s; ' - '%s/tools/mkeficapsule --index 1 --monotonic-count 1 ' - '--private-key SIGNER2.key ' - '--certificate SIGNER2.crt ' - '--guid 09D7CF52-0720-4710-91D1-08469B7FE9C8 ' - 'u-boot.bin.new Test12' - % (data_dir, u_boot_config.build_dir), - shell=True) - # FIT firmware signed with proper key - check_call('cd %s; ' - '%s/tools/mkeficapsule --index 1 --monotonic-count 1 ' - '--private-key SIGNER.key --certificate SIGNER.crt ' - '--guid 3673B45D-6A7C-46F3-9E60-ADABB03F7937 ' - 'uboot_bin_env.itb Test13' - % (data_dir, u_boot_config.build_dir), - shell=True) - # FIT firmware signed with *mal* key - check_call('cd %s; ' - '%s/tools/mkeficapsule --index 1 --monotonic-count 1 ' - '--private-key SIGNER2.key ' - '--certificate SIGNER2.crt ' - '--guid 3673B45D-6A7C-46F3-9E60-ADABB03F7937 ' - 'uboot_bin_env.itb Test14' - % (data_dir, u_boot_config.build_dir), - shell=True) - # raw firmware signed with proper key with version information - check_call('cd %s; ' - '%s/tools/mkeficapsule --index 1 --monotonic-count 1 ' - '--fw-version 5 ' - '--private-key SIGNER.key --certificate SIGNER.crt ' - '--guid 09D7CF52-0720-4710-91D1-08469B7FE9C8 ' - 'u-boot.bin.new Test111' - % (data_dir, u_boot_config.build_dir), - shell=True) - # raw firmware signed with proper key with version information - check_call('cd %s; ' - '%s/tools/mkeficapsule --index 2 --monotonic-count 1 ' - '--fw-version 10 ' - '--private-key SIGNER.key --certificate SIGNER.crt ' - '--guid 5A7021F5-FEF2-48B4-AABA-832E777418C0 ' - 'u-boot.env.new Test112' - % (data_dir, u_boot_config.build_dir), - shell=True) - # raw firmware signed with proper key with lower version information - check_call('cd %s; ' - '%s/tools/mkeficapsule --index 1 --monotonic-count 1 ' - '--fw-version 2 ' - '--private-key SIGNER.key --certificate SIGNER.crt ' - '--guid 09D7CF52-0720-4710-91D1-08469B7FE9C8 ' - 'u-boot.bin.new Test113' - % (data_dir, u_boot_config.build_dir), - shell=True) - # FIT firmware signed with proper key with version information - check_call('cd %s; ' - '%s/tools/mkeficapsule --index 1 --monotonic-count 1 ' - '--fw-version 5 ' - '--private-key SIGNER.key --certificate SIGNER.crt ' - '--guid 3673B45D-6A7C-46F3-9E60-ADABB03F7937 ' - 'uboot_bin_env.itb Test114' - % (data_dir, u_boot_config.build_dir), - shell=True) - # FIT firmware signed with proper key with lower version information - check_call('cd %s; ' - '%s/tools/mkeficapsule --index 1 --monotonic-count 1 ' - '--fw-version 2 ' - '--private-key SIGNER.key --certificate SIGNER.crt ' - '--guid 3673B45D-6A7C-46F3-9E60-ADABB03F7937 ' - 'uboot_bin_env.itb Test115' - % (data_dir, u_boot_config.build_dir), - shell=True) + pythonpath = os.environ.get('PYTHONPATH', '') + os.environ['PYTHONPATH'] = pythonpath + ':' + '%s/scripts/dtc/pylibfdt' % u_boot_config.build_dir + check_call('cd %s; ' + 'cc -E -I %s/include -x assembler-with-cpp -o capsule_gen_tmp.dts %s/test/py/tests/test_efi_capsule/capsule_gen_binman.dts; ' + 'dtc -I dts -O dtb capsule_gen_tmp.dts -o capsule_binman.dtb;' + % (data_dir, u_boot_config.source_dir, u_boot_config.source_dir), shell=True) + check_call('cd %s; ' + './tools/binman/binman --toolpath %s/tools build -u -d %s/capsule_binman.dtb -O %s -m --allow-missing -I %s -I ./board/sandbox -I ./arch/sandbox/dts' + % (u_boot_config.source_dir, u_boot_config.build_dir, data_dir, data_dir, data_dir), shell=True) + os.environ['PYTHONPATH'] = pythonpath # Create a disk image with EFI system partition check_call('virt-make-fs --partition=gpt --size=+1M --type=vfat %s %s' % diff --git a/test/py/tests/test_efi_capsule/signature.dts b/test/py/tests/test_efi_capsule/signature.dts deleted file mode 100644 index 078cfc7..0000000 --- a/test/py/tests/test_efi_capsule/signature.dts +++ /dev/null @@ -1,10 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; -/plugin/; - -&{/} { - signature { - capsule-key = /incbin/("SIGNER.esl"); - }; -}; diff --git a/test/py/tests/test_efi_capsule/uboot_bin_env.its b/test/py/tests/test_efi_capsule/uboot_bin_env.its deleted file mode 100644 index fc65907..0000000 --- a/test/py/tests/test_efi_capsule/uboot_bin_env.its +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Automatic software update for U-Boot - * Make sure the flashing addresses ('load' prop) is correct for your board! - */ - -/dts-v1/; - -/ { - description = "Automatic U-Boot environment update"; - #address-cells = <2>; - - images { - u-boot-bin { - description = "U-Boot binary on SPI Flash"; - data = /incbin/("BINFILE1"); - compression = "none"; - type = "firmware"; - arch = "sandbox"; - load = <0>; - hash-1 { - algo = "sha1"; - }; - }; - u-boot-env { - description = "U-Boot environment on SPI Flash"; - data = /incbin/("BINFILE2"); - compression = "none"; - type = "firmware"; - arch = "sandbox"; - load = <0>; - hash-1 { - algo = "sha1"; - }; - }; - }; -}; diff --git a/test/py/tests/test_event_dump.py b/test/py/tests/test_event_dump.py index da196df..e282c67 100644 --- a/test/py/tests/test_event_dump.py +++ b/test/py/tests/test_event_dump.py @@ -18,5 +18,7 @@ def test_event_dump(u_boot_console): -------------------- ------------------------------ ------------------------------ EVT_FT_FIXUP bootmeth_vbe_ft_fixup .*boot/vbe_request.c:.* EVT_FT_FIXUP bootmeth_vbe_simple_ft_fixup .*boot/vbe_simple_os.c:.* -EVT_MISC_INIT_F sandbox_misc_init_f .*arch/sandbox/cpu/start.c:''' +EVT_LAST_STAGE_INIT install_smbios_table .*lib/efi_loader/efi_smbios.c:.* +EVT_MISC_INIT_F sandbox_early_getopt_check .*arch/sandbox/cpu/start.c:.* +EVT_TEST h_adder_simple .*test/common/event.c:''' assert re.match(expect, out, re.MULTILINE) is not None diff --git a/test/py/tests/test_gpt.py b/test/py/tests/test_gpt.py index 73bfbf7..6e135b6 100644 --- a/test/py/tests/test_gpt.py +++ b/test/py/tests/test_gpt.py @@ -16,6 +16,35 @@ the test. # Mark all tests here as slow pytestmark = pytest.mark.slow +def parse_gpt_parts(disk_str): + """Parser a partition string into a list of partitions. + + Args: + disk_str: The disk description string, as returned by `gpt read` + + Returns: + A list of parsed partitions. Each partition is a dictionary with the + string value from each specified key in the partition description, or a + key with with the value True for a boolean flag + """ + parts = [] + for part_str in disk_str.split(';'): + part = {} + for option in part_str.split(","): + if not option: + continue + + if "=" in option: + key, value = option.split("=") + part[key] = value + else: + part[option] = True + + if part: + parts.append(part) + + return parts + class GptTestDiskImage(object): """Disk Image used by the GPT tests.""" @@ -49,10 +78,13 @@ class GptTestDiskImage(object): u_boot_utils.run_and_log(u_boot_console, cmd) # part1 offset 1MB size 1MB cmd = ('sgdisk', '--new=1:2048:4095', '--change-name=1:part1', + '--partition-guid=1:33194895-67f6-4561-8457-6fdeed4f50a3', + '-A 1:set:2', persistent) # part2 offset 2MB size 1.5MB u_boot_utils.run_and_log(u_boot_console, cmd) cmd = ('sgdisk', '--new=2:4096:7167', '--change-name=2:part2', + '--partition-guid=2:cc9c6e4a-6551-4cb5-87be-3210f96c86fb', persistent) u_boot_utils.run_and_log(u_boot_console, cmd) cmd = ('sgdisk', '--load-backup=' + persistent) @@ -61,18 +93,14 @@ class GptTestDiskImage(object): cmd = ('cp', persistent, self.path) u_boot_utils.run_and_log(u_boot_console, cmd) -gtdi = None @pytest.fixture(scope='function') def state_disk_image(u_boot_console): """pytest fixture to provide a GptTestDiskImage object to tests. This is function-scoped because it uses u_boot_console, which is also - function-scoped. However, we don't need to actually do any function-scope - work, so this simply returns the same object over and over each time.""" + function-scoped. A new disk is returned each time to prevent tests from + interfering with each other.""" - global gtdi - if not gtdi: - gtdi = GptTestDiskImage(u_boot_console) - return gtdi + return GptTestDiskImage(u_boot_console) @pytest.mark.boardspec('sandbox') @pytest.mark.buildconfigspec('cmd_gpt') @@ -93,6 +121,41 @@ def test_gpt_read(state_disk_image, u_boot_console): @pytest.mark.boardspec('sandbox') @pytest.mark.buildconfigspec('cmd_gpt') +@pytest.mark.buildconfigspec('partition_type_guid') +@pytest.mark.requiredtool('sgdisk') +def test_gpt_read_var(state_disk_image, u_boot_console): + """Test the gpt read command.""" + + u_boot_console.run_command('host bind 0 ' + state_disk_image.path) + output = u_boot_console.run_command('gpt read host 0 gpt_parts') + assert 'success!' in output + + output = u_boot_console.run_command('echo ${gpt_parts}') + parts = parse_gpt_parts(output.rstrip()) + + assert parts == [ + { + "uuid_disk": "375a56f7-d6c9-4e81-b5f0-09d41ca89efe", + }, + { + "name": "part1", + "start": "0x100000", + "size": "0x100000", + "type": "0fc63daf-8483-4772-8e79-3d69d8477de4", + "uuid": "33194895-67f6-4561-8457-6fdeed4f50a3", + "bootable": True, + }, + { + "name": "part2", + "start": "0x200000", + "size": "0x180000", + "type": "0fc63daf-8483-4772-8e79-3d69d8477de4", + "uuid": "cc9c6e4a-6551-4cb5-87be-3210f96c86fb", + }, + ] + +@pytest.mark.boardspec('sandbox') +@pytest.mark.buildconfigspec('cmd_gpt') @pytest.mark.requiredtool('sgdisk') def test_gpt_verify(state_disk_image, u_boot_console): """Test the gpt verify command.""" @@ -124,6 +187,38 @@ def test_gpt_guid(state_disk_image, u_boot_console): @pytest.mark.boardspec('sandbox') @pytest.mark.buildconfigspec('cmd_gpt') @pytest.mark.requiredtool('sgdisk') +def test_gpt_setenv(state_disk_image, u_boot_console): + """Test the gpt setenv command.""" + u_boot_console.run_command('host bind 0 ' + state_disk_image.path) + output = u_boot_console.run_command('gpt setenv host 0 part1') + assert 'success!' in output + output = u_boot_console.run_command('echo ${gpt_partition_addr}') + assert output.rstrip() == '800' + output = u_boot_console.run_command('echo ${gpt_partition_size}') + assert output.rstrip() == '800' + output = u_boot_console.run_command('echo ${gpt_partition_name}') + assert output.rstrip() == 'part1' + output = u_boot_console.run_command('echo ${gpt_partition_entry}') + assert output.rstrip() == '1' + output = u_boot_console.run_command('echo ${gpt_partition_bootable}') + assert output.rstrip() == '1' + + output = u_boot_console.run_command('gpt setenv host 0 part2') + assert 'success!' in output + output = u_boot_console.run_command('echo ${gpt_partition_addr}') + assert output.rstrip() == '1000' + output = u_boot_console.run_command('echo ${gpt_partition_size}') + assert output.rstrip() == 'c00' + output = u_boot_console.run_command('echo ${gpt_partition_name}') + assert output.rstrip() == 'part2' + output = u_boot_console.run_command('echo ${gpt_partition_entry}') + assert output.rstrip() == '2' + output = u_boot_console.run_command('echo ${gpt_partition_bootable}') + assert output.rstrip() == '0' + +@pytest.mark.boardspec('sandbox') +@pytest.mark.buildconfigspec('cmd_gpt') +@pytest.mark.requiredtool('sgdisk') def test_gpt_save_guid(state_disk_image, u_boot_console): """Test the gpt guid command to save GUID into a string.""" @@ -186,12 +281,34 @@ def test_gpt_swap_partitions(state_disk_image, u_boot_console): u_boot_console.run_command('host bind 0 ' + state_disk_image.path) output = u_boot_console.run_command('part list host 0') - assert '0x00000800 0x00000fff "first"' in output - assert '0x00001000 0x00001bff "second"' in output - u_boot_console.run_command('gpt swap host 0 first second') + assert '0x00000800 0x00000fff "part1"' in output + assert '0x00001000 0x00001bff "part2"' in output + u_boot_console.run_command('gpt swap host 0 part1 part2') output = u_boot_console.run_command('part list host 0') - assert '0x00000800 0x00000fff "second"' in output - assert '0x00001000 0x00001bff "first"' in output + assert '0x00000800 0x00000fff "part2"' in output + assert '0x00001000 0x00001bff "part1"' in output + +@pytest.mark.buildconfigspec('cmd_gpt') +@pytest.mark.buildconfigspec('cmd_gpt_rename') +@pytest.mark.buildconfigspec('cmd_part') +@pytest.mark.requiredtool('sgdisk') +def test_gpt_set_bootable(state_disk_image, u_boot_console): + """Test the gpt set-bootable command.""" + + u_boot_console.run_command('host bind 0 ' + state_disk_image.path) + parts = ('part2', 'part1') + for bootable in parts: + output = u_boot_console.run_command(f'gpt set-bootable host 0 {bootable}') + assert 'success!' in output + + for p in parts: + output = u_boot_console.run_command(f'gpt setenv host 0 {p}') + assert 'success!' in output + output = u_boot_console.run_command('echo ${gpt_partition_bootable}') + if p == bootable: + assert output.rstrip() == '1' + else: + assert output.rstrip() == '0' @pytest.mark.boardspec('sandbox') @pytest.mark.buildconfigspec('cmd_gpt') @@ -212,3 +329,22 @@ def test_gpt_write(state_disk_image, u_boot_console): assert '0x00001000 0x00001bff "second"' in output output = u_boot_console.run_command('gpt guid host 0') assert '375a56f7-d6c9-4e81-b5f0-09d41ca89efe' in output + +@pytest.mark.buildconfigspec('cmd_gpt') +@pytest.mark.buildconfigspec('cmd_gpt_rename') +@pytest.mark.buildconfigspec('cmd_part') +@pytest.mark.requiredtool('sgdisk') +def test_gpt_transpose(state_disk_image, u_boot_console): + """Test the gpt transpose command.""" + + u_boot_console.run_command('host bind 0 ' + state_disk_image.path) + output = u_boot_console.run_command('part list host 0') + assert '1\t0x00000800\t0x00000fff\t"part1"' in output + assert '2\t0x00001000\t0x00001bff\t"part2"' in output + + output = u_boot_console.run_command('gpt transpose host 0 1 2') + assert 'success!' in output + + output = u_boot_console.run_command('part list host 0') + assert '2\t0x00000800\t0x00000fff\t"part1"' in output + assert '1\t0x00001000\t0x00001bff\t"part2"' in output diff --git a/test/py/tests/test_semihosting/conftest.py b/test/py/tests/test_semihosting/conftest.py new file mode 100644 index 0000000..b00d8f4 --- /dev/null +++ b/test/py/tests/test_semihosting/conftest.py @@ -0,0 +1,23 @@ +# SPDX-License-Identifier: GPL-2.0-or-later + +"""Fixture for semihosting command test +""" + +import os +import pytest + +@pytest.fixture(scope='session') +def semihosting_data(u_boot_config): + """Set up a file system to be used in semihosting tests + + Args: + u_boot_config -- U-Boot configuration. + """ + image_path = u_boot_config.persistent_data_dir + '/semihosting.txt' + + with open(image_path, 'w', encoding = 'utf-8') as file: + file.write('Das U-Boot\n') + + yield image_path + + os.remove(image_path) diff --git a/test/py/tests/test_semihosting/test_hostfs.py b/test/py/tests/test_semihosting/test_hostfs.py new file mode 100644 index 0000000..51f6fa7 --- /dev/null +++ b/test/py/tests/test_semihosting/test_hostfs.py @@ -0,0 +1,33 @@ +# SPDX-License-Identifier: GPL-2.0+ + +""" Unit test for semihosting +""" + +import pytest + +@pytest.mark.buildconfigspec('semihosting') +def test_semihosting_hostfs(u_boot_console, semihosting_data): + """ Unit test for semihosting + + Args: + u_boot_console -- U-Boot console + semihosting_data -- Path to the disk image used for testing. + """ + response = u_boot_console.run_command( + f'load hostfs - $loadaddr {semihosting_data}') + assert '11 bytes read' in response + + response = u_boot_console.run_command( + 'crc32 $loadaddr $filesize') + assert '==> 60cfccfc' in response + + u_boot_console.run_command( + f'save hostfs - $loadaddr {semihosting_data} 11 11') + + response = u_boot_console.run_command( + f'load hostfs - $loadaddr {semihosting_data} 4 13') + assert '4 bytes read' in response + + response = u_boot_console.run_command( + 'crc32 $loadaddr $filesize') + assert '==> e29063ea' in response diff --git a/test/py/tests/test_tpm2.py b/test/py/tests/test_tpm2.py index fce689c..c2579fa 100644 --- a/test/py/tests/test_tpm2.py +++ b/test/py/tests/test_tpm2.py @@ -71,6 +71,9 @@ def test_tpm2_startup(u_boot_console): Initiate the TPM internal state machine. """ + skip_test = u_boot_console.config.env.get('env__tpm_device_test_skip', False) + if skip_test: + pytest.skip('skip TPM device test') u_boot_console.run_command('tpm2 startup TPM2_SU_CLEAR') output = u_boot_console.run_command('echo $?') assert output.endswith('0') diff --git a/test/py/tests/test_trace.py b/test/py/tests/test_trace.py index ac3e959..28a6e72 100644 --- a/test/py/tests/test_trace.py +++ b/test/py/tests/test_trace.py @@ -61,7 +61,7 @@ def collect_trace(cons): # Read out the trace data addr = 0x02000000 - size = 0x01000000 + size = 0x02000000 out = cons.run_command(f'trace calls {addr:x} {size:x}') print(out) fname = os.path.join(TMPDIR, 'trace') @@ -175,7 +175,7 @@ def check_funcgraph(cons, fname, proftool, map_fname, trace_dat): # Then look for this: # u-boot-1 [000] 282.101375: funcgraph_exit: 0.006 us | } # Then check for this: - # u-boot-1 [000] 282.101375: funcgraph_entry: 0.000 us | event_init(); + # u-boot-1 [000] 282.101375: funcgraph_entry: 0.000 us | initcall_is_event(); expected_indent = None found_start = False @@ -197,8 +197,9 @@ def check_funcgraph(cons, fname, proftool, map_fname, trace_dat): elif found_start and indent == expected_indent and brace == '}': found_end = True - # The next function after initf_bootstage() exits should be event_init() - assert upto == 'event_init()' + # The next function after initf_bootstage() exits should be + # initcall_is_event() + assert upto == 'initcall_is_event()' # Now look for initf_dm() and dm_timer_init() so we can check the bootstage # time @@ -247,7 +248,7 @@ def check_flamegraph(cons, fname, proftool, map_fname, trace_fg): # We expect dm_timer_init() to be called twice: once before relocation and # once after look1 = 'initf_dm;dm_timer_init 1' - look2 = 'board_init_r;initr_dm_devices;dm_timer_init 1' + look2 = 'board_init_r;initcall_run_list;initr_dm_devices;dm_timer_init 1' found = 0 with open(trace_fg, 'r') as fd: for line in fd: @@ -272,7 +273,7 @@ def check_flamegraph(cons, fname, proftool, map_fname, trace_fg): total += count return total - +check_flamegraph @pytest.mark.slow @pytest.mark.boardspec('sandbox') @pytest.mark.buildconfigspec('trace') diff --git a/test/py/tests/test_ut.py b/test/py/tests/test_ut.py index aa1d477..82932a6 100644 --- a/test/py/tests/test_ut.py +++ b/test/py/tests/test_ut.py @@ -1,6 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 # Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. +import collections import getpass import gzip import os @@ -282,13 +283,155 @@ label Fedora-Workstation-armhfp-31-1.9 (5.3.7-301.fc31.armv7hl) copy_prepared_image(cons, mmc_dev, fname) +def setup_cros_image(cons): + """Create a 20MB disk image with ChromiumOS partitions""" + Partition = collections.namedtuple('part', 'start,size,name') + parts = {} + disk_data = None + + def pack_kernel(cons, arch, kern, dummy): + """Pack a kernel containing some fake data + + Args: + cons (ConsoleBase): Console to use + arch (str): Architecture to use ('x86' or 'arm') + kern (str): Filename containing kernel + dummy (str): Dummy filename to use for config and bootloader + + Return: + bytes: Packed-kernel data + """ + kern_part = os.path.join(cons.config.result_dir, 'kern-part-{arch}.bin') + u_boot_utils.run_and_log( + cons, + f'futility vbutil_kernel --pack {kern_part} ' + '--keyblock doc/chromium/files/devkeys/kernel.keyblock ' + '--signprivate doc/chromium/files/devkeys/kernel_data_key.vbprivk ' + f'--version 1 --config {dummy} --bootloader {dummy} ' + f'--vmlinuz {kern}') + + with open(kern_part, 'rb') as inf: + kern_part_data = inf.read() + return kern_part_data + + def set_part_data(partnum, data): + """Set the contents of a disk partition + + This updates disk_data by putting data in the right place + + Args: + partnum (int): Partition number to set + data (bytes): Data for that partition + """ + nonlocal disk_data + + start = parts[partnum].start * sect_size + disk_data = disk_data[:start] + data + disk_data[start + len(data):] + + mmc_dev = 5 + fname = os.path.join(cons.config.source_dir, f'mmc{mmc_dev}.img') + u_boot_utils.run_and_log(cons, 'qemu-img create %s 20M' % fname) + #mnt = os.path.join(cons.config.persistent_data_dir, 'mnt') + #mkdir_cond(mnt) + u_boot_utils.run_and_log(cons, f'cgpt create {fname}') + + uuid_state = 'ebd0a0a2-b9e5-4433-87c0-68b6b72699c7' + uuid_kern = 'fe3a2a5d-4f32-41a7-b725-accc3285a309' + uuid_root = '3cb8e202-3b7e-47dd-8a3c-7ff2a13cfcec' + uuid_rwfw = 'cab6e88e-abf3-4102-a07a-d4bb9be3c1d3' + uuid_reserved = '2e0a753d-9e48-43b0-8337-b15192cb1b5e' + uuid_efi = 'c12a7328-f81f-11d2-ba4b-00a0c93ec93b' + + ptr = 40 + + # Number of sectors in 1MB + sect_size = 512 + sect_1mb = (1 << 20) // sect_size + + required_parts = [ + {'num': 0xb, 'label':'RWFW', 'type': uuid_rwfw, 'size': '1'}, + {'num': 6, 'label':'KERN_C', 'type': uuid_kern, 'size': '1'}, + {'num': 7, 'label':'ROOT_C', 'type': uuid_root, 'size': '1'}, + {'num': 9, 'label':'reserved', 'type': uuid_reserved, 'size': '1'}, + {'num': 0xa, 'label':'reserved', 'type': uuid_reserved, 'size': '1'}, + + {'num': 2, 'label':'KERN_A', 'type': uuid_kern, 'size': '1M'}, + {'num': 4, 'label':'KERN_B', 'type': uuid_kern, 'size': '1M'}, + + {'num': 8, 'label':'OEM', 'type': uuid_state, 'size': '1M'}, + {'num': 0xc, 'label':'EFI-SYSTEM', 'type': uuid_efi, 'size': '1M'}, + + {'num': 5, 'label':'ROOT_B', 'type': uuid_root, 'size': '1'}, + {'num': 3, 'label':'ROOT_A', 'type': uuid_root, 'size': '1'}, + {'num': 1, 'label':'STATE', 'type': uuid_state, 'size': '1M'}, + ] + + for part in required_parts: + size_str = part['size'] + if 'M' in size_str: + size = int(size_str[:-1]) * sect_1mb + else: + size = int(size_str) + u_boot_utils.run_and_log( + cons, + f"cgpt add -i {part['num']} -b {ptr} -s {size} -t {part['type']} {fname}") + ptr += size + + u_boot_utils.run_and_log(cons, f'cgpt boot -p {fname}') + out = u_boot_utils.run_and_log(cons, f'cgpt show -q {fname}') + '''We expect something like this: + 8239 2048 1 Basic data + 45 2048 2 ChromeOS kernel + 8238 1 3 ChromeOS rootfs + 2093 2048 4 ChromeOS kernel + 8237 1 5 ChromeOS rootfs + 41 1 6 ChromeOS kernel + 42 1 7 ChromeOS rootfs + 4141 2048 8 Basic data + 43 1 9 ChromeOS reserved + 44 1 10 ChromeOS reserved + 40 1 11 ChromeOS firmware + 6189 2048 12 EFI System Partition + ''' + + # Create a dict (indexed by partition number) containing the above info + for line in out.splitlines(): + start, size, num, name = line.split(maxsplit=3) + parts[int(num)] = Partition(int(start), int(size), name) + + dummy = os.path.join(cons.config.result_dir, 'dummy.txt') + with open(dummy, 'wb') as outf: + outf.write(b'dummy\n') + + # For now we just use dummy kernels. This limits testing to just detecting + # a signed kernel. We could add support for the x86 data structures so that + # testing could cover getting the cmdline, setup.bin and other pieces. + kern = os.path.join(cons.config.result_dir, 'kern.bin') + with open(kern, 'wb') as outf: + outf.write(b'kernel\n') + + with open(fname, 'rb') as inf: + disk_data = inf.read() + + # put x86 kernel in partition 2 and arm one in partition 4 + set_part_data(2, pack_kernel(cons, 'x86', kern, dummy)) + set_part_data(4, pack_kernel(cons, 'arm', kern, dummy)) + + with open(fname, 'wb') as outf: + outf.write(disk_data) + + return fname + + def setup_cedit_file(cons): infname = os.path.join(cons.config.source_dir, 'test/boot/files/expo_layout.dts') + inhname = os.path.join(cons.config.source_dir, + 'test/boot/files/expo_ids.h') expo_tool = os.path.join(cons.config.source_dir, 'tools/expo.py') outfname = 'cedit.dtb' u_boot_utils.run_and_log( - cons, f'{expo_tool} -e {infname} -l {infname} -o {outfname}') + cons, f'{expo_tool} -e {inhname} -l {infname} -o {outfname}') @pytest.mark.buildconfigspec('ut_dm') @@ -317,10 +460,8 @@ def test_ut_dm_init(u_boot_console): u_boot_utils.run_and_log( u_boot_console, f'sfdisk {fn}', stdin=b'type=83') - fs_helper.mk_fs(u_boot_console.config, 'ext2', 0x200000, '2MB', - use_src_dir=True) - fs_helper.mk_fs(u_boot_console.config, 'fat32', 0x100000, '1MB', - use_src_dir=True) + fs_helper.mk_fs(u_boot_console.config, 'ext2', 0x200000, '2MB') + fs_helper.mk_fs(u_boot_console.config, 'fat32', 0x100000, '1MB') @pytest.mark.buildconfigspec('cmd_bootflow') def test_ut_dm_init_bootstd(u_boot_console): @@ -329,6 +470,7 @@ def test_ut_dm_init_bootstd(u_boot_console): setup_bootflow_image(u_boot_console) setup_bootmenu_image(u_boot_console) setup_cedit_file(u_boot_console) + setup_cros_image(u_boot_console) # Restart so that the new mmc1.img is picked up u_boot_console.restart_uboot() diff --git a/test/unicode_ut.c b/test/unicode_ut.c index b27d711..1d0d90c 100644 --- a/test/unicode_ut.c +++ b/test/unicode_ut.c @@ -807,28 +807,28 @@ static int unicode_test_u16_strlcat(struct unit_test_state *uts) /* dest and src are empty string */ memset(buf, 0, sizeof(buf)); - ret = u16_strlcat(buf, &null_src, sizeof(buf)); - ut_asserteq(1, ret); + ret = u16_strlcat(buf, &null_src, ARRAY_SIZE(buf)); + ut_asserteq(0, ret); /* dest is empty string */ memset(buf, 0, sizeof(buf)); - ret = u16_strlcat(buf, src, sizeof(buf)); - ut_asserteq(5, ret); + ret = u16_strlcat(buf, src, ARRAY_SIZE(buf)); + ut_asserteq(4, ret); ut_assert(!unicode_test_u16_strcmp(buf, src, 40)); /* src is empty string */ memset(buf, 0xCD, (sizeof(buf) - sizeof(u16))); buf[39] = 0; memcpy(buf, dest, sizeof(dest)); - ret = u16_strlcat(buf, &null_src, sizeof(buf)); - ut_asserteq(6, ret); + ret = u16_strlcat(buf, &null_src, ARRAY_SIZE(buf)); + ut_asserteq(5, ret); ut_assert(!unicode_test_u16_strcmp(buf, dest, 40)); for (i = 0; i <= 40; i++) { memset(buf, 0xCD, (sizeof(buf) - sizeof(u16))); buf[39] = 0; memcpy(buf, dest, sizeof(dest)); - expected = 10; + expected = min(5, i) + 4; ret = u16_strlcat(buf, src, i); ut_asserteq(expected, ret); if (i <= 6) { diff --git a/tools/Makefile b/tools/Makefile index 3d0c4b0..1aa1e36 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -123,6 +123,7 @@ dumpimage-mkimage-objs := aisimage.o \ pblimage.o \ pbl_crc32.o \ renesas_spkgimage.o \ + sfspl.o \ vybridimage.o \ stm32image.o \ $(ROCKCHIP_OBS) \ diff --git a/tools/binman/bintool.py b/tools/binman/bintool.py index 0b0f56d..3c4ad1a 100644 --- a/tools/binman/bintool.py +++ b/tools/binman/bintool.py @@ -328,7 +328,7 @@ class Bintool: return result.stdout @classmethod - def build_from_git(cls, git_repo, make_target, bintool_path, flags=None): + def build_from_git(cls, git_repo, make_targets, bintool_path, flags=None): """Build a bintool from a git repo This clones the repo in a temporary directory, builds it with 'make', @@ -336,7 +336,8 @@ class Bintool: Args: git_repo (str): URL of git repo - make_target (str): Target to pass to 'make' to build the tool + make_targets (list of str): List of targets to pass to 'make' to build + the tool bintool_path (str): Relative path of the tool in the repo, after build is complete flags (list of str): Flags or variables to pass to make, or None @@ -350,12 +351,14 @@ class Bintool: tmpdir = tempfile.mkdtemp(prefix='binmanf.') print(f"- clone git repo '{git_repo}' to '{tmpdir}'") tools.run('git', 'clone', '--depth', '1', git_repo, tmpdir) - print(f"- build target '{make_target}'") - cmd = ['make', '-C', tmpdir, '-j', f'{multiprocessing.cpu_count()}', - make_target] - if flags: - cmd += flags - tools.run(*cmd) + for target in make_targets: + print(f"- build target '{target}'") + cmd = ['make', '-C', tmpdir, '-j', f'{multiprocessing.cpu_count()}', + target] + if flags: + cmd += flags + tools.run(*cmd) + fname = os.path.join(tmpdir, bintool_path) if not os.path.exists(fname): print(f"- File '{fname}' was not produced") diff --git a/tools/binman/btool/mkeficapsule.py b/tools/binman/btool/mkeficapsule.py new file mode 100644 index 0000000..6117974 --- /dev/null +++ b/tools/binman/btool/mkeficapsule.py @@ -0,0 +1,101 @@ +# SPDX-License-Identifier: GPL-2.0+ +# Copyright 2023 Linaro Limited +# +"""Bintool implementation for mkeficapsule tool + +mkeficapsule is a tool used for generating EFI capsules. + +The following are the commandline options to be provided +to the tool +Usage: mkeficapsule [options] <image blob> <output file> +Options: + -g, --guid <guid string> guid for image blob type + -i, --index <index> update image index + -I, --instance <instance> update hardware instance + -v, --fw-version <version> firmware version + -p, --private-key <privkey file> private key file + -c, --certificate <cert file> signer's certificate file + -m, --monotonic-count <count> monotonic count + -d, --dump_sig dump signature (*.p7) + -A, --fw-accept firmware accept capsule, requires GUID, no image blob + -R, --fw-revert firmware revert capsule, takes no GUID, no image blob + -o, --capoemflag Capsule OEM Flag, an integer between 0x0000 and 0xffff + -h, --help print a help message +""" + +from binman import bintool + +class Bintoolmkeficapsule(bintool.Bintool): + """Handles the 'mkeficapsule' tool + + This bintool is used for generating the EFI capsules. The + capsule generation parameters can either be specified through + commandline, or through a config file. + """ + def __init__(self, name): + super().__init__(name, 'mkeficapsule tool for generating capsules') + + def generate_capsule(self, image_index, image_guid, hardware_instance, + payload, output_fname, priv_key, pub_key, + monotonic_count=0, version=0, oemflags=0): + """Generate a capsule through commandline-provided parameters + + Args: + image_index (int): Unique number for identifying payload image + image_guid (str): GUID used for identifying the image + hardware_instance (int): Optional unique hardware instance of + a device in the system. 0 if not being used + payload (str): Path to the input payload image + output_fname (str): Path to the output capsule file + priv_key (str): Path to the private key + pub_key(str): Path to the public key + monotonic_count (int): Count used when signing an image + version (int): Image version (Optional) + oemflags (int): Optional 16 bit OEM flags + + Returns: + str: Tool output + """ + args = [ + f'--index={image_index}', + f'--guid={image_guid}', + f'--instance={hardware_instance}' + ] + + if version: + args += [f'--fw-version={version}'] + if oemflags: + args += [f'--capoemflag={oemflags}'] + if priv_key and pub_key: + args += [ + f'--monotonic-count={monotonic_count}', + f'--private-key={priv_key}', + f'--certificate={pub_key}' + ] + + args += [ + payload, + output_fname + ] + + return self.run_cmd(*args) + + def fetch(self, method): + """Fetch handler for mkeficapsule + + This builds the tool from source + + Returns: + tuple: + str: Filename of fetched file to copy to a suitable directory + str: Name of temp directory to remove, or None + """ + if method != bintool.FETCH_BUILD: + return None + + cmd = ['tools-only_defconfig', 'tools'] + result = self.build_from_git( + 'https://source.denx.de/u-boot/u-boot.git', + cmd, + 'tools/mkeficapsule') + return result diff --git a/tools/binman/entries.rst b/tools/binman/entries.rst index e7dfe6b..801bd94 100644 --- a/tools/binman/entries.rst +++ b/tools/binman/entries.rst @@ -468,6 +468,70 @@ updating the EC on startup via software sync. +.. _etype_efi_capsule: + +Entry: capsule: Entry for generating EFI Capsule files +------------------------------------------------------ + +The parameters needed for generation of the capsules can be provided +as properties in the entry. + +Properties / Entry arguments: + - image-index: Unique number for identifying corresponding + payload image. Number between 1 and descriptor count, i.e. + the total number of firmware images that can be updated. Mandatory + property. + - image-guid: Image GUID which will be used for identifying the + updatable image on the board. Mandatory property. + - hardware-instance: Optional number for identifying unique + hardware instance of a device in the system. Default value of 0 + for images where value is not to be used. + - fw-version: Value of image version that can be put on the capsule + through the Firmware Management Protocol(FMP) header. + - monotonic-count: Count used when signing an image. + - private-key: Path to PEM formatted .key private key file. Mandatory + property for generating signed capsules. + - public-key-cert: Path to PEM formatted .crt public key certificate + file. Mandatory property for generating signed capsules. + - oem-flags - OEM flags to be passed through capsule header. + + Since this is a subclass of Entry_section, all properties of the parent + class also apply here. Except for the properties stated as mandatory, the + rest of the properties are optional. + +For more details on the description of the capsule format, and the capsule +update functionality, refer Section 8.5 and Chapter 23 in the `UEFI +specification`_. + +The capsule parameters like image index and image GUID are passed as +properties in the entry. The payload to be used in the capsule is to be +provided as a subnode of the capsule entry. + +A typical capsule entry node would then look something like this:: + + capsule { + type = "efi-capsule"; + image-index = <0x1>; + /* Image GUID for testing capsule update */ + image-guid = SANDBOX_UBOOT_IMAGE_GUID; + hardware-instance = <0x0>; + private-key = "path/to/the/private/key"; + public-key-cert = "path/to/the/public-key-cert"; + oem-flags = <0x8000>; + + u-boot { + }; + }; + +In the above example, the capsule payload is the U-Boot image. The +capsule entry would read the contents of the payload and put them +into the capsule. Any external file can also be specified as the +payload using the blob-ext subnode. + +.. _`UEFI specification`: https://uefi.org/sites/default/files/resources/UEFI_Spec_2_10_Aug29.pdf + + + .. _etype_encrypted: Entry: encrypted: Externally built encrypted binary blob diff --git a/tools/binman/etype/efi_capsule.py b/tools/binman/etype/efi_capsule.py new file mode 100644 index 0000000..006eb63 --- /dev/null +++ b/tools/binman/etype/efi_capsule.py @@ -0,0 +1,143 @@ +# SPDX-License-Identifier: GPL-2.0+ +# Copyright (c) 2023 Linaro Limited +# +# Entry-type module for producing a EFI capsule +# + +import os + +from binman.entry import Entry +from binman.etype.section import Entry_section +from dtoc import fdt_util +from u_boot_pylib import tools + +class Entry_efi_capsule(Entry_section): + """Generate EFI capsules + + The parameters needed for generation of the capsules can + be provided as properties in the entry. + + Properties / Entry arguments: + - image-index: Unique number for identifying corresponding + payload image. Number between 1 and descriptor count, i.e. + the total number of firmware images that can be updated. Mandatory + property. + - image-guid: Image GUID which will be used for identifying the + updatable image on the board. Mandatory property. + - hardware-instance: Optional number for identifying unique + hardware instance of a device in the system. Default value of 0 + for images where value is not to be used. + - fw-version: Value of image version that can be put on the capsule + through the Firmware Management Protocol(FMP) header. + - monotonic-count: Count used when signing an image. + - private-key: Path to PEM formatted .key private key file. Mandatory + property for generating signed capsules. + - public-key-cert: Path to PEM formatted .crt public key certificate + file. Mandatory property for generating signed capsules. + - oem-flags - OEM flags to be passed through capsule header. + + Since this is a subclass of Entry_section, all properties of the parent + class also apply here. Except for the properties stated as mandatory, the + rest of the properties are optional. + + For more details on the description of the capsule format, and the capsule + update functionality, refer Section 8.5 and Chapter 23 in the `UEFI + specification`_. + + The capsule parameters like image index and image GUID are passed as + properties in the entry. The payload to be used in the capsule is to be + provided as a subnode of the capsule entry. + + A typical capsule entry node would then look something like this + + capsule { + type = "efi-capsule"; + image-index = <0x1>; + /* Image GUID for testing capsule update */ + image-guid = SANDBOX_UBOOT_IMAGE_GUID; + hardware-instance = <0x0>; + private-key = "path/to/the/private/key"; + public-key-cert = "path/to/the/public-key-cert"; + oem-flags = <0x8000>; + + u-boot { + }; + }; + + In the above example, the capsule payload is the U-Boot image. The + capsule entry would read the contents of the payload and put them + into the capsule. Any external file can also be specified as the + payload using the blob-ext subnode. + + .. _`UEFI specification`: https://uefi.org/sites/default/files/resources/UEFI_Spec_2_10_Aug29.pdf + """ + def __init__(self, section, etype, node): + super().__init__(section, etype, node) + self.required_props = ['image-index', 'image-guid'] + self.image_index = 0 + self.image_guid = '' + self.hardware_instance = 0 + self.monotonic_count = 0 + self.fw_version = 0 + self.oem_flags = 0 + self.private_key = '' + self.public_key_cert = '' + self.auth = 0 + + def ReadNode(self): + super().ReadNode() + + self.image_index = fdt_util.GetInt(self._node, 'image-index') + self.image_guid = fdt_util.GetString(self._node, 'image-guid') + self.fw_version = fdt_util.GetInt(self._node, 'fw-version') + self.hardware_instance = fdt_util.GetInt(self._node, 'hardware-instance') + self.monotonic_count = fdt_util.GetInt(self._node, 'monotonic-count') + self.oem_flags = fdt_util.GetInt(self._node, 'oem-flags') + + self.private_key = fdt_util.GetString(self._node, 'private-key') + self.public_key_cert = fdt_util.GetString(self._node, 'public-key-cert') + if ((self.private_key and not self.public_key_cert) or (self.public_key_cert and not self.private_key)): + self.Raise('Both private key and public key certificate need to be provided') + elif not (self.private_key and self.public_key_cert): + self.auth = 0 + else: + self.auth = 1 + + def BuildSectionData(self, required): + def get_binman_test_guid(type_str): + TYPE_TO_GUID = { + 'binman-test' : '09d7cf52-0720-4710-91d1-08469b7fe9c8' + } + return TYPE_TO_GUID[type_str] + + private_key = '' + public_key_cert = '' + if self.auth: + if not os.path.isabs(self.private_key): + private_key = tools.get_input_filename(self.private_key) + if not os.path.isabs(self.public_key_cert): + public_key_cert = tools.get_input_filename(self.public_key_cert) + data, payload, uniq = self.collect_contents_to_file( + self._entries.values(), 'capsule_in') + outfile = self._filename if self._filename else 'capsule.%s' % uniq + capsule_fname = tools.get_output_filename(outfile) + guid = self.image_guid + if self.image_guid == "binman-test": + guid = get_binman_test_guid('binman-test') + + ret = self.mkeficapsule.generate_capsule(self.image_index, + guid, + self.hardware_instance, + payload, + capsule_fname, + private_key, + public_key_cert, + self.monotonic_count, + self.fw_version, + self.oem_flags) + if ret is not None: + os.remove(payload) + return tools.read_file(capsule_fname) + + def AddBintools(self, btools): + self.mkeficapsule = self.AddBintool(btools, 'mkeficapsule') diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py index 1293e9d..8e41964 100644 --- a/tools/binman/ftest.py +++ b/tools/binman/ftest.py @@ -48,6 +48,7 @@ U_BOOT_VPL_DATA = b'vpl76543210fedcbazywxyz_' BLOB_DATA = b'89' ME_DATA = b'0abcd' VGA_DATA = b'vga' +EFI_CAPSULE_DATA = b'efi' U_BOOT_DTB_DATA = b'udtb' U_BOOT_SPL_DTB_DATA = b'spldtb' U_BOOT_TPL_DTB_DATA = b'tpldtb' @@ -119,6 +120,11 @@ COMP_BINTOOLS = ['bzip2', 'gzip', 'lz4', 'lzma_alone', 'lzop', 'xz', 'zstd'] TEE_ADDR = 0x5678 +# Firmware Management Protocol(FMP) GUID +FW_MGMT_GUID = 'edd5cb6d2de8444cbda17194199ad92a' +# Image GUID specified in the DTS +CAPSULE_IMAGE_GUID = '52cfd7092007104791d108469b7fe9c8' + class TestFunctional(unittest.TestCase): """Functional tests for binman @@ -215,6 +221,7 @@ class TestFunctional(unittest.TestCase): TestFunctional._MakeInputFile('scp.bin', SCP_DATA) TestFunctional._MakeInputFile('rockchip-tpl.bin', ROCKCHIP_TPL_DATA) TestFunctional._MakeInputFile('ti_unsecure.bin', TI_UNSECURE_DATA) + TestFunctional._MakeInputFile('capsule_input.bin', EFI_CAPSULE_DATA) # Add a few .dtb files for testing TestFunctional._MakeInputFile('%s/test-fdt1.dtb' % TEST_FDT_SUBDIR, @@ -7216,5 +7223,116 @@ fdt fdtmap Extract the devicetree blob from the fdtmap self.assertRegex(err, "Image 'image'.*missing bintools.*: bootgen") + def _CheckCapsule(self, data, signed_capsule=False, version_check=False, + capoemflags=False): + fmp_signature = "4d535331" # 'M', 'S', 'S', '1' + fmp_size = "10" + fmp_fw_version = "02" + oemflag = "0080" + + payload_data = EFI_CAPSULE_DATA + + # TODO - Currently, these offsets for capsule fields are hardcoded. + # There are plans to add support to the mkeficapsule tool to dump + # the capsule contents which can then be used for capsule + # verification. + + # Firmware Management Protocol(FMP) GUID - offset(0 - 32) + self.assertEqual(FW_MGMT_GUID, data.hex()[:32]) + # Image GUID - offset(96 - 128) + self.assertEqual(CAPSULE_IMAGE_GUID, data.hex()[96:128]) + + if capoemflags: + # OEM Flags - offset(40 - 44) + self.assertEqual(oemflag, data.hex()[40:44]) + if signed_capsule and version_check: + # FMP header signature - offset(4770 - 4778) + self.assertEqual(fmp_signature, data.hex()[4770:4778]) + # FMP header size - offset(4778 - 4780) + self.assertEqual(fmp_size, data.hex()[4778:4780]) + # firmware version - offset(4786 - 4788) + self.assertEqual(fmp_fw_version, data.hex()[4786:4788]) + # payload offset signed capsule(4802 - 4808) + self.assertEqual(payload_data.hex(), data.hex()[4802:4808]) + elif signed_capsule: + # payload offset signed capsule(4770 - 4776) + self.assertEqual(payload_data.hex(), data.hex()[4770:4776]) + elif version_check: + # FMP header signature - offset(184 - 192) + self.assertEqual(fmp_signature, data.hex()[184:192]) + # FMP header size - offset(192 - 194) + self.assertEqual(fmp_size, data.hex()[192:194]) + # firmware version - offset(200 - 202) + self.assertEqual(fmp_fw_version, data.hex()[200:202]) + # payload offset for non-signed capsule with version header(216 - 222) + self.assertEqual(payload_data.hex(), data.hex()[216:222]) + else: + # payload offset for non-signed capsule with no version header(184 - 190) + self.assertEqual(payload_data.hex(), data.hex()[184:190]) + + def testCapsuleGen(self): + """Test generation of EFI capsule""" + data = self._DoReadFile('311_capsule.dts') + + self._CheckCapsule(data) + + def testSignedCapsuleGen(self): + """Test generation of EFI capsule""" + data = tools.read_file(self.TestFile("key.key")) + self._MakeInputFile("key.key", data) + data = tools.read_file(self.TestFile("key.pem")) + self._MakeInputFile("key.crt", data) + + data = self._DoReadFile('312_capsule_signed.dts') + + self._CheckCapsule(data, signed_capsule=True) + + def testCapsuleGenVersionSupport(self): + """Test generation of EFI capsule with version support""" + data = self._DoReadFile('313_capsule_version.dts') + + self._CheckCapsule(data, version_check=True) + + def testCapsuleGenSignedVer(self): + """Test generation of signed EFI capsule with version information""" + data = tools.read_file(self.TestFile("key.key")) + self._MakeInputFile("key.key", data) + data = tools.read_file(self.TestFile("key.pem")) + self._MakeInputFile("key.crt", data) + + data = self._DoReadFile('314_capsule_signed_ver.dts') + + self._CheckCapsule(data, signed_capsule=True, version_check=True) + + def testCapsuleGenCapOemFlags(self): + """Test generation of EFI capsule with OEM Flags set""" + data = self._DoReadFile('315_capsule_oemflags.dts') + + self._CheckCapsule(data, capoemflags=True) + + def testCapsuleGenKeyMissing(self): + """Test that binman errors out on missing key""" + with self.assertRaises(ValueError) as e: + self._DoReadFile('316_capsule_missing_key.dts') + + self.assertIn("Both private key and public key certificate need to be provided", + str(e.exception)) + + def testCapsuleGenIndexMissing(self): + """Test that binman errors out on missing image index""" + with self.assertRaises(ValueError) as e: + self._DoReadFile('317_capsule_missing_index.dts') + + self.assertIn("entry is missing properties: image-index", + str(e.exception)) + + def testCapsuleGenGuidMissing(self): + """Test that binman errors out on missing image GUID""" + with self.assertRaises(ValueError) as e: + self._DoReadFile('318_capsule_missing_guid.dts') + + self.assertIn("entry is missing properties: image-guid", + str(e.exception)) + if __name__ == "__main__": unittest.main() diff --git a/tools/binman/test/311_capsule.dts b/tools/binman/test/311_capsule.dts new file mode 100644 index 0000000..8eb4250 --- /dev/null +++ b/tools/binman/test/311_capsule.dts @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + efi-capsule { + image-index = <0x1>; + /* Image GUID for testing capsule update */ + image-guid = "binman-test"; + hardware-instance = <0x0>; + + blob { + filename = "capsule_input.bin"; + }; + }; + }; +}; diff --git a/tools/binman/test/312_capsule_signed.dts b/tools/binman/test/312_capsule_signed.dts new file mode 100644 index 0000000..d1c76e2 --- /dev/null +++ b/tools/binman/test/312_capsule_signed.dts @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + efi-capsule { + image-index = <0x1>; + /* Image GUID for testing capsule update */ + image-guid = "binman-test"; + hardware-instance = <0x0>; + private-key = "key.key"; + public-key-cert = "key.crt"; + + blob { + filename = "capsule_input.bin"; + }; + }; + }; +}; diff --git a/tools/binman/test/313_capsule_version.dts b/tools/binman/test/313_capsule_version.dts new file mode 100644 index 0000000..bafef36 --- /dev/null +++ b/tools/binman/test/313_capsule_version.dts @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + efi-capsule { + image-index = <0x1>; + fw-version = <0x2>; + /* Image GUID for testing capsule update */ + image-guid = "binman-test"; + hardware-instance = <0x0>; + + blob { + filename = "capsule_input.bin"; + }; + }; + }; +}; diff --git a/tools/binman/test/314_capsule_signed_ver.dts b/tools/binman/test/314_capsule_signed_ver.dts new file mode 100644 index 0000000..85c784b --- /dev/null +++ b/tools/binman/test/314_capsule_signed_ver.dts @@ -0,0 +1,24 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + efi-capsule { + image-index = <0x1>; + fw-version = <0x2>; + /* Image GUID for testing capsule update */ + image-guid = "binman-test"; + hardware-instance = <0x0>; + private-key = "key.key"; + public-key-cert = "key.crt"; + + blob { + filename = "capsule_input.bin"; + }; + }; + }; +}; diff --git a/tools/binman/test/315_capsule_oemflags.dts b/tools/binman/test/315_capsule_oemflags.dts new file mode 100644 index 0000000..f736e87 --- /dev/null +++ b/tools/binman/test/315_capsule_oemflags.dts @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + efi-capsule { + image-index = <0x1>; + /* Image GUID for testing capsule update */ + image-guid = "binman-test"; + hardware-instance = <0x0>; + oem-flags = <0x8000>; + + blob { + filename = "capsule_input.bin"; + }; + }; + }; +}; diff --git a/tools/binman/test/316_capsule_missing_key.dts b/tools/binman/test/316_capsule_missing_key.dts new file mode 100644 index 0000000..2080b50 --- /dev/null +++ b/tools/binman/test/316_capsule_missing_key.dts @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + efi-capsule { + image-index = <0x1>; + /* Image GUID for testing capsule update */ + image-guid = "binman-test"; + hardware-instance = <0x0>; + private-key = "tools/binman/test/key.key"; + + blob { + filename = "capsule_input.bin"; + }; + }; + }; +}; diff --git a/tools/binman/test/317_capsule_missing_index.dts b/tools/binman/test/317_capsule_missing_index.dts new file mode 100644 index 0000000..aadb61f --- /dev/null +++ b/tools/binman/test/317_capsule_missing_index.dts @@ -0,0 +1,20 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + efi-capsule { + /* Image GUID for testing capsule update */ + image-guid = "binman-test"; + hardware-instance = <0x0>; + + blob { + filename = "capsule_input.bin"; + }; + }; + }; +}; diff --git a/tools/binman/test/318_capsule_missing_guid.dts b/tools/binman/test/318_capsule_missing_guid.dts new file mode 100644 index 0000000..d76afba --- /dev/null +++ b/tools/binman/test/318_capsule_missing_guid.dts @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + efi-capsule { + image-index = <0x1>; + hardware-instance = <0x0>; + + blob { + filename = "capsule_input.bin"; + }; + }; + }; +}; diff --git a/tools/buildman/boards.py b/tools/buildman/boards.py index eef3f19..341a505 100644 --- a/tools/buildman/boards.py +++ b/tools/buildman/boards.py @@ -19,6 +19,7 @@ import time from buildman import board from buildman import kconfiglib +from u_boot_pylib.terminal import print_clear, tprint ### constant variables ### OUTPUT_FILE = 'boards.cfg' @@ -863,11 +864,19 @@ class Boards: Returns: bool: True if all is well, False if there were warnings """ - if not force and output_is_new(output, CONFIG_DIR, '.'): + if not force: if not quiet: - print(f'{output} is up to date. Nothing to do.') - return True + tprint('\rChecking for Kconfig changes...', newline=False) + is_new = output_is_new(output, CONFIG_DIR, '.') + print_clear() + if is_new: + if not quiet: + print(f'{output} is up to date. Nothing to do.') + return True + if not quiet: + tprint('\rGenerating board list...', newline=False) params_list, warnings = self.build_board_list(CONFIG_DIR, '.', jobs) + print_clear() for warn in warnings: print(warn, file=sys.stderr) self.format_and_output(params_list, output) diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py index ecbd368..5305477 100644 --- a/tools/buildman/builder.py +++ b/tools/buildman/builder.py @@ -328,7 +328,7 @@ class Builder: self._build_period_us = None self._complete_delay = None self._next_delay_update = datetime.now() - self._start_time = datetime.now() + self._start_time = None self._step = step self._error_lines = 0 self.no_subdirs = no_subdirs @@ -1778,6 +1778,7 @@ class Builder: self._prepare_output_space() if not self._ide: tprint('\rStarting build...', newline=False) + self._start_time = datetime.now() self.setup_build(board_selected, commits) self.process_result(None) self.thread_exceptions = [] diff --git a/tools/buildman/builderthread.py b/tools/buildman/builderthread.py index 25f460c..6a61f64 100644 --- a/tools/buildman/builderthread.py +++ b/tools/buildman/builderthread.py @@ -23,6 +23,9 @@ from u_boot_pylib import command RETURN_CODE_RETRY = -1 BASE_ELF_FILENAMES = ['u-boot', 'spl/u-boot-spl', 'tpl/u-boot-tpl'] +# Common extensions for images +COMMON_EXTS = ['.bin', '.rom', '.itb', '.img'] + def mkdir(dirname, parents=False): """Make a directory if it doesn't already exist. @@ -636,10 +639,11 @@ class BuilderThread(threading.Thread): # Now write the actual build output if keep_outputs: - copy_files( - result.out_dir, build_dir, '', - ['u-boot*', '*.bin', '*.map', '*.img', 'MLO', 'SPL', - 'include/autoconf.mk', 'spl/u-boot-spl*']) + to_copy = ['u-boot*', '*.map', 'MLO', 'SPL', + 'include/autoconf.mk', 'spl/u-boot-spl*', + 'tpl/u-boot-tpl*', 'vpl/u-boot-vpl*'] + to_copy += [f'*{ext}' for ext in COMMON_EXTS] + copy_files(result.out_dir, build_dir, '', to_copy) def _send_result(self, result): """Send a result to the builder for processing diff --git a/tools/buildman/control.py b/tools/buildman/control.py index f2ffb7f..8f6850c 100644 --- a/tools/buildman/control.py +++ b/tools/buildman/control.py @@ -621,7 +621,8 @@ def do_buildman(args, toolchains=None, make_func=None, brds=None, if not brds: brds = get_boards_obj(output_dir, args.regen_board_list, args.maintainer_check, args.full_check, - args.threads, args.verbose) + args.threads, args.verbose and + not args.print_arch and not args.print_prefix) if isinstance(brds, int): return brds diff --git a/tools/buildman/toolchain.py b/tools/buildman/toolchain.py index b050011..79c7c11 100644 --- a/tools/buildman/toolchain.py +++ b/tools/buildman/toolchain.py @@ -499,7 +499,7 @@ class Toolchains: if arch == 'aarch64': arch = 'arm64' base = 'https://www.kernel.org/pub/tools/crosstool/files/bin' - versions = ['13.1.0', '12.2.0'] + versions = ['13.2.0', '12.2.0'] links = [] for version in versions: url = '%s/%s/%s/' % (base, arch, version) diff --git a/tools/default_image.c b/tools/default_image.c index 0e49ab3..04bc85b 100644 --- a/tools/default_image.c +++ b/tools/default_image.c @@ -15,7 +15,6 @@ #include "imagetool.h" #include "mkimage.h" -#include <u-boot/crc.h> #include <image.h> #include <tee/optee.h> diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile index ff16829..c4a2596 100644 --- a/tools/docker/Dockerfile +++ b/tools/docker/Dockerfile @@ -2,7 +2,7 @@ # This Dockerfile is used to build an image containing basic stuff to be used # to build U-Boot and run our test suites. -FROM ubuntu:jammy-20230624 +FROM ubuntu:jammy-20230804 MAINTAINER Tom Rini <trini@konsulko.com> LABEL Description=" This image is for building U-Boot inside a container" @@ -14,19 +14,19 @@ RUN apt-get update && apt-get install -y gnupg2 wget xz-utils && rm -rf /var/lib RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - RUN echo deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main | tee /etc/apt/sources.list.d/llvm.list -# Manually install the kernel.org "Crosstool" based toolchains for gcc-13.1.0 -RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.1.0/x86_64-gcc-13.1.0-nolibc-aarch64-linux.tar.xz | tar -C /opt -xJ -RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.1.0/x86_64-gcc-13.1.0-nolibc-arc-linux.tar.xz | tar -C /opt -xJ -RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.1.0/x86_64-gcc-13.1.0-nolibc-arm-linux-gnueabi.tar.xz | tar -C /opt -xJ -RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.1.0/x86_64-gcc-13.1.0-nolibc-i386-linux.tar.xz | tar -C /opt -xJ -RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.1.0/x86_64-gcc-13.1.0-nolibc-m68k-linux.tar.xz | tar -C /opt -xJ -RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.1.0/x86_64-gcc-13.1.0-nolibc-mips-linux.tar.xz | tar -C /opt -xJ -RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.1.0/x86_64-gcc-13.1.0-nolibc-microblaze-linux.tar.xz | tar -C /opt -xJ -RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.1.0/x86_64-gcc-13.1.0-nolibc-nios2-linux.tar.xz | tar -C /opt -xJ -RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.1.0/x86_64-gcc-13.1.0-nolibc-powerpc-linux.tar.xz | tar -C /opt -xJ -RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.1.0/x86_64-gcc-13.1.0-nolibc-riscv64-linux.tar.xz | tar -C /opt -xJ -RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.1.0/x86_64-gcc-13.1.0-nolibc-riscv32-linux.tar.xz | tar -C /opt -xJ -RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.1.0/x86_64-gcc-13.1.0-nolibc-sh2-linux.tar.xz | tar -C /opt -xJ +# Manually install the kernel.org "Crosstool" based toolchains for gcc-13.2.0 +RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.2.0/x86_64-gcc-13.2.0-nolibc-aarch64-linux.tar.xz | tar -C /opt -xJ +RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.2.0/x86_64-gcc-13.2.0-nolibc-arc-linux.tar.xz | tar -C /opt -xJ +RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.2.0/x86_64-gcc-13.2.0-nolibc-arm-linux-gnueabi.tar.xz | tar -C /opt -xJ +RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.2.0/x86_64-gcc-13.2.0-nolibc-i386-linux.tar.xz | tar -C /opt -xJ +RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.2.0/x86_64-gcc-13.2.0-nolibc-m68k-linux.tar.xz | tar -C /opt -xJ +RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.2.0/x86_64-gcc-13.2.0-nolibc-mips-linux.tar.xz | tar -C /opt -xJ +RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.2.0/x86_64-gcc-13.2.0-nolibc-microblaze-linux.tar.xz | tar -C /opt -xJ +RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.2.0/x86_64-gcc-13.2.0-nolibc-nios2-linux.tar.xz | tar -C /opt -xJ +RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.2.0/x86_64-gcc-13.2.0-nolibc-powerpc-linux.tar.xz | tar -C /opt -xJ +RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.2.0/x86_64-gcc-13.2.0-nolibc-riscv64-linux.tar.xz | tar -C /opt -xJ +RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.2.0/x86_64-gcc-13.2.0-nolibc-riscv32-linux.tar.xz | tar -C /opt -xJ +RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.2.0/x86_64-gcc-13.2.0-nolibc-sh2-linux.tar.xz | tar -C /opt -xJ # Manually install other toolchains RUN wget -O - https://github.com/foss-xtensa/toolchain/releases/download/2020.07/x86_64-2020.07-xtensa-dc233c-elf.tar.gz | tar -C /opt -xz @@ -39,10 +39,10 @@ RUN apt-get update && apt-get install -y \ binutils-dev \ bison \ build-essential \ + cgpt \ clang-16 \ coreutils \ cpio \ - cppcheck \ curl \ device-tree-compiler \ dosfstools \ @@ -104,7 +104,6 @@ RUN apt-get update && apt-get install -y \ python3-virtualenv \ rpm2cpio \ sbsigntool \ - sloccount \ socat \ softhsm2 \ sparse \ @@ -115,6 +114,8 @@ RUN apt-get update && apt-get install -y \ util-linux \ uuid-dev \ virtualenv \ + vboot-kernel-utils \ + vboot-utils \ xxd \ zip \ && rm -rf /var/lib/apt/lists/* @@ -134,11 +135,11 @@ RUN git clone git://git.savannah.gnu.org/grub.git /tmp/grub && \ mkdir -p /opt/grub && \ ./configure --target=aarch64 --with-platform=efi \ CC=gcc \ - TARGET_CC=/opt/gcc-13.1.0-nolibc/aarch64-linux/bin/aarch64-linux-gcc \ - TARGET_OBJCOPY=/opt/gcc-13.1.0-nolibc/aarch64-linux/bin/aarch64-linux-objcopy \ - TARGET_STRIP=/opt/gcc-13.1.0-nolibc/aarch64-linux/bin/aarch64-linux-strip \ - TARGET_NM=/opt/gcc-13.1.0-nolibc/aarch64-linux/bin/aarch64-linux-nm \ - TARGET_RANLIB=/opt/gcc-13.1.0-nolibc/aarch64-linux/bin/aarch64-linux-ranlib && \ + TARGET_CC=/opt/gcc-13.2.0-nolibc/aarch64-linux/bin/aarch64-linux-gcc \ + TARGET_OBJCOPY=/opt/gcc-13.2.0-nolibc/aarch64-linux/bin/aarch64-linux-objcopy \ + TARGET_STRIP=/opt/gcc-13.2.0-nolibc/aarch64-linux/bin/aarch64-linux-strip \ + TARGET_NM=/opt/gcc-13.2.0-nolibc/aarch64-linux/bin/aarch64-linux-nm \ + TARGET_RANLIB=/opt/gcc-13.2.0-nolibc/aarch64-linux/bin/aarch64-linux-ranlib && \ make && \ ./grub-mkimage -O arm64-efi -o /opt/grub/grubaa64.efi --prefix= -d \ grub-core cat chain configfile echo efinet ext2 fat halt help linux \ @@ -148,11 +149,11 @@ RUN git clone git://git.savannah.gnu.org/grub.git /tmp/grub && \ make clean && \ ./configure --target=arm --with-platform=efi \ CC=gcc \ - TARGET_CC=/opt/gcc-13.1.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-gcc \ - TARGET_OBJCOPY=/opt/gcc-13.1.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-objcopy \ - TARGET_STRIP=/opt/gcc-13.1.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-strip \ - TARGET_NM=/opt/gcc-13.1.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-nm \ - TARGET_RANLIB=/opt/gcc-13.1.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-ranlib && \ + TARGET_CC=/opt/gcc-13.2.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-gcc \ + TARGET_OBJCOPY=/opt/gcc-13.2.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-objcopy \ + TARGET_STRIP=/opt/gcc-13.2.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-strip \ + TARGET_NM=/opt/gcc-13.2.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-nm \ + TARGET_RANLIB=/opt/gcc-13.2.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-ranlib && \ make && \ ./grub-mkimage -O arm-efi -o /opt/grub/grubarm.efi --prefix= -d \ grub-core cat chain configfile echo efinet ext2 fat halt help linux \ @@ -162,11 +163,11 @@ RUN git clone git://git.savannah.gnu.org/grub.git /tmp/grub && \ make clean && \ ./configure --target=riscv64 --with-platform=efi \ CC=gcc \ - TARGET_CC=/opt/gcc-13.1.0-nolibc/riscv64-linux/bin/riscv64-linux-gcc \ - TARGET_OBJCOPY=/opt/gcc-13.1.0-nolibc/riscv64-linux/bin/riscv64-linux-objcopy \ - TARGET_STRIP=/opt/gcc-13.1.0-nolibc/riscv64-linux/bin/riscv64-linux-strip \ - TARGET_NM=/opt/gcc-13.1.0-nolibc/riscv64-linux/bin/riscv64-linux-nm \ - TARGET_RANLIB=/opt/gcc-13.1.0-nolibc/riscv64-linux/bin/riscv64-linux-ranlib && \ + TARGET_CC=/opt/gcc-13.2.0-nolibc/riscv64-linux/bin/riscv64-linux-gcc \ + TARGET_OBJCOPY=/opt/gcc-13.2.0-nolibc/riscv64-linux/bin/riscv64-linux-objcopy \ + TARGET_STRIP=/opt/gcc-13.2.0-nolibc/riscv64-linux/bin/riscv64-linux-strip \ + TARGET_NM=/opt/gcc-13.2.0-nolibc/riscv64-linux/bin/riscv64-linux-nm \ + TARGET_RANLIB=/opt/gcc-13.2.0-nolibc/riscv64-linux/bin/riscv64-linux-ranlib && \ make && \ ./grub-mkimage -O riscv64-efi -o /opt/grub/grubriscv64.efi --prefix= -d \ grub-core cat chain configfile echo efinet ext2 fat halt help linux \ @@ -246,7 +247,7 @@ RUN virtualenv -p /usr/bin/python3 /tmp/venv && \ # Create the buildman config file RUN /bin/echo -e "[toolchain]\nroot = /usr" > ~/.buildman -RUN /bin/echo -e "kernelorg = /opt/gcc-13.1.0-nolibc/*" >> ~/.buildman +RUN /bin/echo -e "kernelorg = /opt/gcc-13.2.0-nolibc/*" >> ~/.buildman RUN /bin/echo -e "\n[toolchain-prefix]\nxtensa = /opt/2020.07/xtensa-dc233c-elf/bin/xtensa-dc233c-elf-" >> ~/.buildman; RUN /bin/echo -e "\n[toolchain-alias]\nsh = sh2" >> ~/.buildman RUN /bin/echo -e "\nsandbox = x86_64" >> ~/.buildman diff --git a/tools/expo.py b/tools/expo.py index c6eb87a..ea80c70 100755 --- a/tools/expo.py +++ b/tools/expo.py @@ -69,7 +69,10 @@ def calc_ids(fname): def run_expo(args): """Run the expo program""" - ids = calc_ids(args.enum_fname) + fname = args.enum_fname or args.layout + ids = calc_ids(fname) + if not ids: + print(f"Warning: No enum ID values found in file '{fname}'") indata = tools.read_file(args.layout) @@ -88,10 +91,10 @@ def run_expo(args): with open('/tmp/asc', 'wb') as outf: outf.write(data) - proc = subprocess.run('dtc', input=data, capture_output=True, check=True) + proc = subprocess.run('dtc', input=data, capture_output=True) edtb = proc.stdout if proc.stderr: - print(proc.stderr) + print(f"Devicetree compiler error:\n{proc.stderr.decode('utf-8')}") return 1 tools.write_file(args.outfile, edtb) return 0 @@ -109,11 +112,13 @@ def parse_args(argv): args is a list of string arguments """ parser = argparse.ArgumentParser() + parser.add_argument('-D', '--debug', action='store_true', + help='Enable full debug traceback') parser.add_argument('-e', '--enum-fname', type=str, - help='C file containing enum declaration for expo items') - parser.add_argument('-l', '--layout', type=str, - help='Devicetree file source .dts for expo layout') - parser.add_argument('-o', '--outfile', type=str, + help='.dts or C file containing enum declaration for expo items') + parser.add_argument('-l', '--layout', type=str, required=True, + help='Devicetree file source .dts for expo layout (and perhaps enums)') + parser.add_argument('-o', '--outfile', type=str, required=True, help='Filename to write expo layout dtb') return parser.parse_args(argv) @@ -122,6 +127,9 @@ def start_expo(): """Start the expo program""" args = parse_args(sys.argv[1:]) + if not args.debug: + sys.tracebacklimit = 0 + ret_code = run_expo(args) sys.exit(ret_code) diff --git a/tools/image-host.c b/tools/image-host.c index 4a24dee..ca49503 100644 --- a/tools/image-host.c +++ b/tools/image-host.c @@ -38,9 +38,9 @@ static int fit_set_hash_value(void *fit, int noffset, uint8_t *value, ret = fdt_setprop(fit, noffset, FIT_VALUE_PROP, value, value_len); if (ret) { - printf("Can't set hash '%s' property for '%s' node(%s)\n", - FIT_VALUE_PROP, fit_get_name(fit, noffset, NULL), - fdt_strerror(ret)); + fprintf(stderr, "Can't set hash '%s' property for '%s' node(%s)\n", + FIT_VALUE_PROP, fit_get_name(fit, noffset, NULL), + fdt_strerror(ret)); return ret == -FDT_ERR_NOSPACE ? -ENOSPC : -EIO; } @@ -72,21 +72,23 @@ static int fit_image_process_hash(void *fit, const char *image_name, node_name = fit_get_name(fit, noffset, NULL); if (fit_image_hash_get_algo(fit, noffset, &algo)) { - printf("Can't get hash algo property for '%s' hash node in '%s' image node\n", - node_name, image_name); + fprintf(stderr, + "Can't get hash algo property for '%s' hash node in '%s' image node\n", + node_name, image_name); return -ENOENT; } if (calculate_hash(data, size, algo, value, &value_len)) { - printf("Unsupported hash algorithm (%s) for '%s' hash node in '%s' image node\n", - algo, node_name, image_name); + fprintf(stderr, + "Unsupported hash algorithm (%s) for '%s' hash node in '%s' image node\n", + algo, node_name, image_name); return -EPROTONOSUPPORT; } ret = fit_set_hash_value(fit, noffset, value, value_len); if (ret) { - printf("Can't set hash value for '%s' hash node in '%s' image node\n", - node_name, image_name); + fprintf(stderr, "Can't set hash value for '%s' hash node in '%s' image node\n", + node_name, image_name); return ret; } @@ -170,8 +172,9 @@ static int fit_image_setup_sig(struct image_sign_info *info, node_name = fit_get_name(fit, noffset, NULL); if (!algo_name) { if (fit_image_hash_get_algo(fit, noffset, &algo_name)) { - printf("Can't get algo property for '%s' signature node in '%s' image node\n", - node_name, image_name); + fprintf(stderr, + "Can't get algo property for '%s' signature node in '%s' image node\n", + node_name, image_name); return -1; } } @@ -191,8 +194,9 @@ static int fit_image_setup_sig(struct image_sign_info *info, info->require_keys = require_keys; info->engine_id = engine_id; if (!info->checksum || !info->crypto) { - printf("Unsupported signature algorithm (%s) for '%s' signature node in '%s' image node\n", - algo_name, node_name, image_name); + fprintf(stderr, + "Unsupported signature algorithm (%s) for '%s' signature node in '%s' image node\n", + algo_name, node_name, image_name); return -1; } @@ -241,8 +245,8 @@ static int fit_image_process_sig(const char *keydir, const char *keyfile, region.size = size; ret = info.crypto->sign(&info, ®ion, 1, &value, &value_len); if (ret) { - printf("Failed to sign '%s' signature node in '%s' image node: %d\n", - node_name, image_name, ret); + fprintf(stderr, "Failed to sign '%s' signature node in '%s' image node: %d\n", + node_name, image_name, ret); /* We allow keys to be missing */ if (ret == -ENOENT) @@ -255,8 +259,9 @@ static int fit_image_process_sig(const char *keydir, const char *keyfile, if (ret) { if (ret == -FDT_ERR_NOSPACE) return -ENOSPC; - printf("Can't write signature for '%s' signature node in '%s' conf node: %s\n", - node_name, image_name, fdt_strerror(ret)); + fprintf(stderr, + "Can't write signature for '%s' signature node in '%s' conf node: %s\n", + node_name, image_name, fdt_strerror(ret)); return -1; } free(value); @@ -272,8 +277,9 @@ static int fit_image_process_sig(const char *keydir, const char *keyfile, if (keydest) { ret = info.crypto->add_verify_data(&info, keydest); if (ret < 0) { - printf("Failed to add verification data for '%s' signature node in '%s' image node\n", - node_name, image_name); + fprintf(stderr, + "Failed to add verification data for '%s' signature node in '%s' image node\n", + node_name, image_name); return ret; } /* Return the node that was written to */ @@ -293,37 +299,37 @@ static int fit_image_read_data(char *filename, unsigned char *data, /* Open file */ fd = open(filename, O_RDONLY | O_BINARY); if (fd < 0) { - printf("Can't open file %s (err=%d => %s)\n", - filename, errno, strerror(errno)); + fprintf(stderr, "Can't open file %s (err=%d => %s)\n", + filename, errno, strerror(errno)); return -1; } /* Compute file size */ if (fstat(fd, &sbuf) < 0) { - printf("Can't fstat file %s (err=%d => %s)\n", - filename, errno, strerror(errno)); + fprintf(stderr, "Can't fstat file %s (err=%d => %s)\n", + filename, errno, strerror(errno)); goto err; } /* Check file size */ if (sbuf.st_size != expected_size) { - printf("File %s don't have the expected size (size=%lld, expected=%d)\n", - filename, (long long)sbuf.st_size, expected_size); + fprintf(stderr, "File %s don't have the expected size (size=%lld, expected=%d)\n", + filename, (long long)sbuf.st_size, expected_size); goto err; } /* Read data */ n = read(fd, data, sbuf.st_size); if (n < 0) { - printf("Can't read file %s (err=%d => %s)\n", - filename, errno, strerror(errno)); + fprintf(stderr, "Can't read file %s (err=%d => %s)\n", + filename, errno, strerror(errno)); goto err; } /* Check that we have read all the file */ if (n != sbuf.st_size) { - printf("Can't read all file %s (read %zd bytes, expected %lld)\n", - filename, n, (long long)sbuf.st_size); + fprintf(stderr, "Can't read all file %s (read %zd bytes, expected %lld)\n", + filename, n, (long long)sbuf.st_size); goto err; } @@ -341,15 +347,15 @@ static int get_random_data(void *data, int size) int i, ret; if (!tmp) { - printf("%s: pointer data is NULL\n", __func__); + fprintf(stderr, "%s: pointer data is NULL\n", __func__); ret = -1; goto out; } ret = clock_gettime(CLOCK_MONOTONIC, &date); if (ret) { - printf("%s: clock_gettime has failed (%s)\n", __func__, - strerror(errno)); + fprintf(stderr, "%s: clock_gettime has failed (%s)\n", __func__, + strerror(errno)); goto out; } @@ -374,8 +380,8 @@ static int fit_image_setup_cipher(struct image_cipher_info *info, int ret = -1; if (fit_image_cipher_get_algo(fit, noffset, &algo_name)) { - printf("Can't get algo name for cipher in image '%s'\n", - image_name); + fprintf(stderr, "Can't get algo name for cipher in image '%s'\n", + image_name); goto out; } @@ -384,8 +390,8 @@ static int fit_image_setup_cipher(struct image_cipher_info *info, /* Read the key name */ info->keyname = fdt_getprop(fit, noffset, FIT_KEY_HINT, NULL); if (!info->keyname) { - printf("Can't get key name for cipher in image '%s'\n", - image_name); + fprintf(stderr, "Can't get key name for cipher in image '%s'\n", + image_name); goto out; } @@ -403,7 +409,7 @@ static int fit_image_setup_cipher(struct image_cipher_info *info, info->cipher = image_get_cipher_algo(algo_name); if (!info->cipher) { - printf("Can't get algo for cipher '%s'\n", image_name); + fprintf(stderr, "Can't get algo for cipher '%s'\n", image_name); goto out; } @@ -412,7 +418,7 @@ static int fit_image_setup_cipher(struct image_cipher_info *info, info->keydir, info->keyname, ".bin"); info->key = malloc(info->cipher->key_len); if (!info->key) { - printf("Can't allocate memory for key\n"); + fprintf(stderr, "Can't allocate memory for key\n"); ret = -1; goto out; } @@ -423,7 +429,7 @@ static int fit_image_setup_cipher(struct image_cipher_info *info, info->iv = malloc(info->cipher->iv_len); if (!info->iv) { - printf("Can't allocate memory for iv\n"); + fprintf(stderr, "Can't allocate memory for iv\n"); ret = -1; goto out; } @@ -457,7 +463,7 @@ int fit_image_write_cipher(void *fit, int image_noffset, int noffset, goto out; } if (ret) { - printf("Can't replace data with ciphered data (err = %d)\n", ret); + fprintf(stderr, "Can't replace data with ciphered data (err = %d)\n", ret); goto out; } @@ -468,7 +474,7 @@ int fit_image_write_cipher(void *fit, int image_noffset, int noffset, goto out; } if (ret) { - printf("Can't add unciphered data size (err = %d)\n", ret); + fprintf(stderr, "Can't add unciphered data size (err = %d)\n", ret); goto out; } @@ -508,8 +514,9 @@ fit_image_process_cipher(const char *keydir, void *keydest, void *fit, if (keydest) { ret = info.cipher->add_cipher_data(&info, keydest, fit, node_noffset); if (ret) { - printf("Failed to add verification data for cipher '%s' in image '%s'\n", - info.keyname, image_name); + fprintf(stderr, + "Failed to add verification data for cipher '%s' in image '%s'\n", + info.keyname, image_name); goto out; } } @@ -538,13 +545,13 @@ int fit_image_cipher_data(const char *keydir, void *keydest, /* Get image name */ image_name = fit_get_name(fit, image_noffset, NULL); if (!image_name) { - printf("Can't get image name\n"); + fprintf(stderr, "Can't get image name\n"); return -1; } /* Get image data and data length */ if (fit_image_get_data(fit, image_noffset, &data, &size)) { - printf("Can't get image data/size\n"); + fprintf(stderr, "Can't get image data/size\n"); return -1; } @@ -558,7 +565,7 @@ int fit_image_cipher_data(const char *keydir, void *keydest, if (fdt_getprop(fit, image_noffset, "data-size-unciphered", &len)) return 0; if (len != -FDT_ERR_NOTFOUND) { - printf("Failure testing for data-size-unciphered\n"); + fprintf(stderr, "Failure testing for data-size-unciphered\n"); return -1; } @@ -568,7 +575,7 @@ int fit_image_cipher_data(const char *keydir, void *keydest, if (cipher_node_offset == -FDT_ERR_NOTFOUND) return 0; if (cipher_node_offset < 0) { - printf("Failure getting cipher node\n"); + fprintf(stderr, "Failure getting cipher node\n"); return -1; } if (!IMAGE_ENABLE_ENCRYPT || !keydir) @@ -624,7 +631,7 @@ int fit_image_add_verification_data(const char *keydir, const char *keyfile, /* Get image data and data length */ if (fit_image_get_data(fit, image_noffset, &data, &size)) { - printf("Can't get image data/size\n"); + fprintf(stderr, "Can't get image data/size\n"); return -1; } @@ -765,8 +772,9 @@ static int fit_config_add_hash(const void *fit, int image_noffset, } if (!hash_count) { - printf("Failed to find any hash nodes in configuration '%s/%s' image '%s' - without these it is not possible to verify this image\n", - conf_name, sig_name, iname); + fprintf(stderr, + "Failed to find any hash nodes in configuration '%s/%s' image '%s' - without these it is not possible to verify this image\n", + conf_name, sig_name, iname); return -ENOMSG; } @@ -775,9 +783,10 @@ static int fit_config_add_hash(const void *fit, int image_noffset, FIT_CIPHER_NODENAME); if (noffset != -FDT_ERR_NOTFOUND) { if (noffset < 0) { - printf("Failed to get cipher node in configuration '%s/%s' image '%s': %s\n", - conf_name, sig_name, iname, - fdt_strerror(noffset)); + fprintf(stderr, + "Failed to get cipher node in configuration '%s/%s' image '%s': %s\n", + conf_name, sig_name, iname, + fdt_strerror(noffset)); return -EIO; } ret = fdt_get_path(fit, noffset, path, sizeof(path)); @@ -790,13 +799,13 @@ static int fit_config_add_hash(const void *fit, int image_noffset, return 0; err_mem: - printf("Out of memory processing configuration '%s/%s'\n", conf_name, - sig_name); + fprintf(stderr, "Out of memory processing configuration '%s/%s'\n", conf_name, + sig_name); return -ENOMEM; err_path: - printf("Failed to get path for image '%s' in configuration '%s/%s': %s\n", - iname, conf_name, sig_name, fdt_strerror(ret)); + fprintf(stderr, "Failed to get path for image '%s' in configuration '%s/%s': %s\n", + iname, conf_name, sig_name, fdt_strerror(ret)); return -ENOENT; } @@ -857,8 +866,9 @@ static int fit_config_get_hash_list(const void *fit, int conf_noffset, iname, index); if (image_noffset < 0) { - printf("Failed to find image '%s' in configuration '%s/%s'\n", - iname, conf_name, sig_name); + fprintf(stderr, + "Failed to find image '%s' in configuration '%s/%s'\n", + iname, conf_name, sig_name); if (allow_missing) continue; @@ -875,16 +885,16 @@ static int fit_config_get_hash_list(const void *fit, int conf_noffset, } if (!image_count) { - printf("Failed to find any images for configuration '%s/%s'\n", - conf_name, sig_name); + fprintf(stderr, "Failed to find any images for configuration '%s/%s'\n", + conf_name, sig_name); return -ENOMSG; } return 0; err_mem: - printf("Out of memory processing configuration '%s/%s'\n", conf_name, - sig_name); + fprintf(stderr, "Out of memory processing configuration '%s/%s'\n", conf_name, + sig_name); return -ENOMEM; } @@ -946,21 +956,21 @@ static int fit_config_get_regions(const void *fit, int conf_noffset, fdt_regions, ARRAY_SIZE(fdt_regions), path, sizeof(path), 1); if (count < 0) { - printf("Failed to hash configuration '%s/%s': %s\n", conf_name, - sig_name, fdt_strerror(ret)); + fprintf(stderr, "Failed to hash configuration '%s/%s': %s\n", conf_name, + sig_name, fdt_strerror(ret)); return -EIO; } if (count == 0) { - printf("No data to hash for configuration '%s/%s': %s\n", - conf_name, sig_name, fdt_strerror(ret)); + fprintf(stderr, "No data to hash for configuration '%s/%s': %s\n", + conf_name, sig_name, fdt_strerror(ret)); return -EINVAL; } /* Build our list of data blocks */ region = fit_region_make_list(fit, fdt_regions, count, NULL); if (!region) { - printf("Out of memory hashing configuration '%s/%s'\n", - conf_name, sig_name); + fprintf(stderr, "Out of memory hashing configuration '%s/%s'\n", + conf_name, sig_name); return -ENOMEM; } @@ -972,8 +982,8 @@ static int fit_config_get_regions(const void *fit, int conf_noffset, } region_prop = malloc(len); if (!region_prop) { - printf("Out of memory setting up regions for configuration '%s/%s'\n", - conf_name, sig_name); + fprintf(stderr, "Out of memory setting up regions for configuration '%s/%s'\n", + conf_name, sig_name); return -ENOMEM; } for (i = len = 0; i < node_inc.count; @@ -1038,8 +1048,8 @@ static int fit_config_process_sig(const char *keydir, const char *keyfile, &value_len); free(region); if (ret) { - printf("Failed to sign '%s' signature node in '%s' conf node\n", - node_name, conf_name); + fprintf(stderr, "Failed to sign '%s' signature node in '%s' conf node\n", + node_name, conf_name); /* We allow keys to be missing */ if (ret == -ENOENT) @@ -1053,8 +1063,9 @@ static int fit_config_process_sig(const char *keydir, const char *keyfile, if (ret) { if (ret == -FDT_ERR_NOSPACE) return -ENOSPC; - printf("Can't write signature for '%s' signature node in '%s' conf node: %s\n", - node_name, conf_name, fdt_strerror(ret)); + fprintf(stderr, + "Can't write signature for '%s' signature node in '%s' conf node: %s\n", + node_name, conf_name, fdt_strerror(ret)); return -1; } free(value); @@ -1067,8 +1078,9 @@ static int fit_config_process_sig(const char *keydir, const char *keyfile, if (keydest) { ret = info.crypto->add_verify_data(&info, keydest); if (ret < 0) { - printf("Failed to add verification data for '%s' signature node in '%s' configuration node\n", - node_name, conf_name); + fprintf(stderr, + "Failed to add verification data for '%s' signature node in '%s' configuration node\n", + node_name, conf_name); } return ret; } @@ -1148,7 +1160,7 @@ static int read_pub_key(const char *keydir, const void *name, /* Read the certificate */ cert = NULL; if (!PEM_read_X509(f, &cert, NULL, NULL)) { - printf("Couldn't read certificate"); + fprintf(stderr, "Couldn't read certificate"); ret = -EINVAL; goto err_cert; } @@ -1156,7 +1168,7 @@ static int read_pub_key(const char *keydir, const void *name, /* Get the public key from the certificate. */ key = X509_get_pubkey(cert); if (!key) { - printf("Couldn't read public key\n"); + fprintf(stderr, "Couldn't read public key\n"); ret = -EINVAL; goto err_pubkey; } @@ -1164,7 +1176,7 @@ static int read_pub_key(const char *keydir, const void *name, /* Get DER form */ ret = i2d_PublicKey(key, pubkey); if (ret < 0) { - printf("Couldn't get DER form\n"); + fprintf(stderr, "Couldn't get DER form\n"); ret = -EINVAL; goto err_pubkey; } @@ -1203,11 +1215,11 @@ int fit_pre_load_data(const char *keydir, void *keydest, void *fit) /* Check that all mandatory properties are present */ if (!algo_name || !key_name) { if (!algo_name) - printf("The property algo-name is missing in the node %s\n", - IMAGE_PRE_LOAD_PATH); + fprintf(stderr, "The property algo-name is missing in the node %s\n", + IMAGE_PRE_LOAD_PATH); if (!key_name) - printf("The property key-name is missing in the node %s\n", - IMAGE_PRE_LOAD_PATH); + fprintf(stderr, "The property key-name is missing in the node %s\n", + IMAGE_PRE_LOAD_PATH); ret = -EINVAL; goto out; } @@ -1221,8 +1233,8 @@ int fit_pre_load_data(const char *keydir, void *keydest, void *fit) ret = fdt_setprop(keydest, pre_load_noffset, "public-key", pubkey, pubkey_len); if (ret) - printf("Can't set public-key in node %s (ret = %d)\n", - IMAGE_PRE_LOAD_PATH, ret); + fprintf(stderr, "Can't set public-key in node %s (ret = %d)\n", + IMAGE_PRE_LOAD_PATH, ret); out: return ret; @@ -1239,8 +1251,8 @@ int fit_cipher_data(const char *keydir, void *keydest, void *fit, /* Find images parent node offset */ images_noffset = fdt_path_offset(fit, FIT_IMAGES_PATH); if (images_noffset < 0) { - printf("Can't find images parent node '%s' (%s)\n", - FIT_IMAGES_PATH, fdt_strerror(images_noffset)); + fprintf(stderr, "Can't find images parent node '%s' (%s)\n", + FIT_IMAGES_PATH, fdt_strerror(images_noffset)); return images_noffset; } @@ -1276,8 +1288,8 @@ int fit_add_verification_data(const char *keydir, const char *keyfile, /* Find images parent node offset */ images_noffset = fdt_path_offset(fit, FIT_IMAGES_PATH); if (images_noffset < 0) { - printf("Can't find images parent node '%s' (%s)\n", - FIT_IMAGES_PATH, fdt_strerror(images_noffset)); + fprintf(stderr, "Can't find images parent node '%s' (%s)\n", + FIT_IMAGES_PATH, fdt_strerror(images_noffset)); return images_noffset; } @@ -1293,9 +1305,9 @@ int fit_add_verification_data(const char *keydir, const char *keyfile, fit, noffset, comment, require_keys, engine_id, cmdname, algo_name); if (ret) { - printf("Can't add verification data for node '%s' (%s)\n", - fdt_get_name(fit, noffset, NULL), - fdt_strerror(ret)); + fprintf(stderr, "Can't add verification data for node '%s' (%s)\n", + fdt_get_name(fit, noffset, NULL), + fdt_strerror(ret)); return ret; } } @@ -1307,8 +1319,8 @@ int fit_add_verification_data(const char *keydir, const char *keyfile, /* Find configurations parent node offset */ confs_noffset = fdt_path_offset(fit, FIT_CONFS_PATH); if (confs_noffset < 0) { - printf("Can't find images parent node '%s' (%s)\n", - FIT_CONFS_PATH, fdt_strerror(confs_noffset)); + fprintf(stderr, "Can't find images parent node '%s' (%s)\n", + FIT_CONFS_PATH, fdt_strerror(confs_noffset)); return -ENOENT; } diff --git a/tools/logos/ti.bmp b/tools/logos/ti_logo_414x97_32bpp.bmp Binary files differindex 7fee6e8..7fee6e8 100644 --- a/tools/logos/ti.bmp +++ b/tools/logos/ti_logo_414x97_32bpp.bmp diff --git a/tools/logos/ti.gz b/tools/logos/ti_logo_414x97_32bpp.bmp.gz Binary files differindex 3a5b45e..3a5b45e 100644 --- a/tools/logos/ti.gz +++ b/tools/logos/ti_logo_414x97_32bpp.bmp.gz diff --git a/tools/relocate-rela.c b/tools/relocate-rela.c index f230ec5..613abd2 100644 --- a/tools/relocate-rela.c +++ b/tools/relocate-rela.c @@ -24,6 +24,30 @@ #define R_AARCH64_RELATIVE 1027 #endif +#ifndef EM_M68K +#define EM_M68K 4 +#endif + +#ifndef R_68K_NONE +#define R_68K_NONE 0 +#endif + +#ifndef R_68K_32 +#define R_68K_32 1 +#endif + +#ifndef R_68K_GLOB_DAT +#define R_68K_GLOB_DAT 20 +#endif + +#ifndef R_68K_JMP_SLOT +#define R_68K_JMP_SLOT 21 +#endif + +#ifndef R_68K_RELATIVE +#define R_68K_RELATIVE 22 +#endif + #ifndef EM_MICROBLAZE #define EM_MICROBLAZE 189 #endif @@ -46,6 +70,7 @@ static int ei_class; static int ei_data; +static int machine; static uint64_t rela_start, rela_end, text_base, dyn_start; @@ -78,6 +103,14 @@ static uint32_t elf32_to_cpu(uint32_t data) return be32_to_cpu(data); } +static uint32_t cpu_to_elf32(uint32_t data) +{ + if (ei_data == ELFDATA2LSB) + return cpu_to_le32(data); + + return cpu_to_be32(data); +} + static bool supported_rela(Elf64_Rela *rela) { uint64_t mask = 0xffffffffULL; /* would be different on 32-bit */ @@ -103,7 +136,7 @@ static int decode_elf64(FILE *felf, char **argv) uint64_t sh_addr, sh_offset, sh_size; Elf64_Half sh_index, sh_num; Elf64_Shdr *sh_table; /* Elf symbol table */ - int ret, i, machine; + int ret, i; char *sh_str; debug("64bit version\n"); @@ -237,7 +270,7 @@ static int decode_elf32(FILE *felf, char **argv) uint32_t sh_addr, sh_offset, sh_size; Elf32_Half sh_index, sh_num; Elf32_Shdr *sh_table; /* Elf symbol table */ - int ret, i, machine; + int ret, i; char *sh_str; debug("32bit version\n"); @@ -254,12 +287,20 @@ static int decode_elf32(FILE *felf, char **argv) machine = elf16_to_cpu(header.e_machine); debug("Machine %d\n", machine); - if (machine != EM_MICROBLAZE) { + if (machine != EM_MICROBLAZE && machine != EM_M68K) { fprintf(stderr, "%s: Not supported machine type\n", argv[0]); return 30; } text_base = elf32_to_cpu(header.e_entry); + /* + * M68K ELF entry point is MONITOR_BASE, not TEXT_BASE. + * TEXT_BASE is always MONITOR_BASE &~ 0x7ff, so clear + * those bits here. + */ + if (machine == EM_M68K) + text_base &= ~0x7ff; + section_header_base = elf32_to_cpu(header.e_shoff); section_header_size = elf16_to_cpu(header.e_shentsize) * elf16_to_cpu(header.e_shnum); @@ -480,25 +521,44 @@ static bool supported_rela32(Elf32_Rela *rela, uint32_t *type) debug("Type:\t"); - switch (*type) { - case R_MICROBLAZE_32: - debug("R_MICROBLAZE_32\n"); - return true; - case R_MICROBLAZE_GLOB_DAT: - debug("R_MICROBLAZE_GLOB_DAT\n"); - return true; - case R_MICROBLAZE_NONE: - debug("R_MICROBLAZE_NONE - ignoring - do nothing\n"); - return false; - case R_MICROBLAZE_REL: - debug("R_MICROBLAZE_REL\n"); - return true; - default: - fprintf(stderr, "warning: unsupported relocation type %" - PRIu32 " at %" PRIx32 "\n", *type, rela->r_offset); - - return false; + if (machine == EM_M68K) { + switch (*type) { + case R_68K_32: + debug("R_68K_32\n"); + return true; + case R_68K_GLOB_DAT: + debug("R_68K_GLOB_DAT\n"); + return true; + case R_68K_JMP_SLOT: + debug("R_68K_JMP_SLOT\n"); + return true; + case R_68K_NONE: + debug("R_68K_NONE - ignoring - do nothing\n"); + return false; + case R_68K_RELATIVE: + debug("R_68K_RELATIVE\n"); + return true; + } + } else { + switch (*type) { + case R_MICROBLAZE_32: + debug("R_MICROBLAZE_32\n"); + return true; + case R_MICROBLAZE_GLOB_DAT: + debug("R_MICROBLAZE_GLOB_DAT\n"); + return true; + case R_MICROBLAZE_NONE: + debug("R_MICROBLAZE_NONE - ignoring - do nothing\n"); + return false; + case R_MICROBLAZE_REL: + debug("R_MICROBLAZE_REL\n"); + return true; + } } + fprintf(stderr, "warning: unsupported relocation type %" + PRIu32 " at %" PRIx32 "\n", *type, rela->r_offset); + + return false; } static int rela_elf32(char **argv, FILE *f) @@ -561,8 +621,8 @@ static int rela_elf32(char **argv, FILE *f) debug("Addr:\t0x%" PRIx32 "\n", addr); - switch (type) { - case R_MICROBLAZE_REL: + if ((machine == EM_M68K && type == R_68K_RELATIVE) || + (machine == EM_MICROBLAZE && type == R_MICROBLAZE_REL)) { if (fseek(f, addr, SEEK_SET) < 0) { fprintf(stderr, "%s: %s: seek to %" PRIx32 " failed: %s\n", @@ -577,9 +637,12 @@ static int rela_elf32(char **argv, FILE *f) argv[0], argv[1], addr); return 4; } - break; - case R_MICROBLAZE_32: - case R_MICROBLAZE_GLOB_DAT: + } else if ((machine == EM_M68K && + (type == R_68K_32 || type == R_68K_GLOB_DAT || + type == R_68K_JMP_SLOT)) || + (machine == EM_MICROBLAZE && + (type == R_MICROBLAZE_32 || + type == R_MICROBLAZE_GLOB_DAT))) { /* global symbols read it and add reloc offset */ index = swrela.r_info >> 8; pos_dyn = dyn_start + sizeof(Elf32_Sym) * index; @@ -602,14 +665,16 @@ static int rela_elf32(char **argv, FILE *f) } debug("Symbol description:\n"); - debug(" st_name:\t0x%x\n", symbols.st_name); - debug(" st_value:\t0x%x\n", symbols.st_value); - debug(" st_size:\t0x%x\n", symbols.st_size); + debug(" st_name:\t0x%x\n", elf32_to_cpu(symbols.st_name)); + debug(" st_value:\t0x%x\n", elf32_to_cpu(symbols.st_value)); + debug(" st_size:\t0x%x\n", elf32_to_cpu(symbols.st_size)); - value = swrela.r_addend + symbols.st_value; + value = swrela.r_addend + elf32_to_cpu(symbols.st_value); debug("Value:\t0x%x\n", value); + value = cpu_to_elf32(value); + if (fseek(f, addr, SEEK_SET) < 0) { fprintf(stderr, "%s: %s: seek to %" PRIx32 " failed: %s\n", @@ -622,12 +687,11 @@ static int rela_elf32(char **argv, FILE *f) argv[0], argv[1], addr); return 4; } - - break; - case R_MICROBLAZE_NONE: + } else if (machine == EM_M68K && type == R_68K_NONE) { + debug("R_68K_NONE - skip\n"); + } else if (machine == EM_MICROBLAZE && type == R_MICROBLAZE_NONE) { debug("R_MICROBLAZE_NONE - skip\n"); - break; - default: + } else { fprintf(stderr, "warning: unsupported relocation type %" PRIu32 " at %" PRIx32 "\n", type, rela.r_offset); diff --git a/tools/sfspl.c b/tools/sfspl.c new file mode 100644 index 0000000..ec18a0a --- /dev/null +++ b/tools/sfspl.c @@ -0,0 +1,174 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright Heinrich Schuchardt <heinrich.schuchardt@canonical.com> + * + * The StarFive JH7110 requires to prepend a header to u-boot-spl.bin describing + * the payload length and CRC32. + * + * This module implements support in mkimage and dumpimage for this file format. + * + * StarFive's spl_tool available under GPL-2.0-and-later at + * https://github.com/starfive-tech/Tools implements writing the same file + * format and served as a reference. + */ + +#include <compiler.h> +#include <fcntl.h> +#include <u-boot/crc.h> +#include <unistd.h> +#include "imagetool.h" + +#define DEFAULT_VERSION 0x01010101 +#define DEFAULT_BACKUP 0x200000U +#define DEFAULT_OFFSET 0x240 + +/** + * struct spl_hdr - header for SPL on JH7110 + * + * All fields are low-endian. + */ +struct spl_hdr { + /** @offset: offset to SPL header (0x240) */ + unsigned int offset; + /** @bkp_offs: address of backup SPL, defaults to DEFAULT_BACKUP */ + unsigned int bkp_offs; + /** @zero1: set to zero */ + unsigned int zero1[159]; + /** @version: header version, defaults to DEFAULT_VERSION */ + unsigned int version; + /** @file_size: file size */ + unsigned int file_size; + /** @hdr_size: size of the file header (0x400) */ + unsigned int hdr_size; + /** @crc32: CRC32 */ + unsigned int crc32; + /** @zero2: set to zero */ + unsigned int zero2[91]; +}; + +static int sfspl_check_params(struct image_tool_params *params) +{ + /* Only the RISC-V architecture is supported */ + if (params->Aflag && params->arch != IH_ARCH_RISCV) + return EXIT_FAILURE; + + return EXIT_SUCCESS; +} + +static int sfspl_verify_header(unsigned char *buf, int size, + struct image_tool_params *params) +{ + struct spl_hdr *hdr = (void *)buf; + unsigned int hdr_size = le32_to_cpu(hdr->hdr_size); + unsigned int file_size = le32_to_cpu(hdr->file_size); + unsigned int crc = le32_to_cpu(hdr->crc32); + unsigned int crc_check; + + if (size < 0 || + (size_t)size < sizeof(struct spl_hdr) || + (size_t)size < hdr_size + file_size) { + printf("Truncated file\n"); + return EXIT_FAILURE; + } + if (hdr->version != DEFAULT_VERSION) { + printf("Unknown file format version\n"); + return EXIT_FAILURE; + } + crc_check = crc32(0, &buf[hdr_size], size - hdr_size); + if (crc_check != crc) { + printf("Incorrect CRC32\n"); + return EXIT_FAILURE; + } + + return EXIT_SUCCESS; +} + +static void sfspl_print_header(const void *buf, + struct image_tool_params *params) +{ + struct spl_hdr *hdr = (void *)buf; + unsigned int hdr_size = le32_to_cpu(hdr->hdr_size); + unsigned int file_size = le32_to_cpu(hdr->file_size); + + printf("Header size: %u\n", hdr_size); + printf("Payload size: %u\n", file_size); +} + +static int sfspl_image_extract_subimage(void *ptr, + struct image_tool_params *params) +{ + struct spl_hdr *hdr = (void *)ptr; + unsigned char *buf = ptr; + int fd; + unsigned int hdr_size = le32_to_cpu(hdr->hdr_size); + unsigned int file_size = le32_to_cpu(hdr->file_size); + + if (params->pflag) { + printf("Invalid image index %d\n", params->pflag); + return EXIT_FAILURE; + } + + fd = open(params->outfile, O_WRONLY | O_CREAT | O_TRUNC, 0644); + if (fd == -1) { + perror("Can write file"); + return EXIT_FAILURE; + } + if (write(fd, &buf[hdr_size], file_size) != file_size) { + perror("Cannot write file"); + return EXIT_FAILURE; + } + close(fd); + + return EXIT_SUCCESS; +} + +static int sfspl_check_image_type(uint8_t type) +{ + if (type == IH_TYPE_STARFIVE_SPL) + return EXIT_SUCCESS; + + return EXIT_FAILURE; +} + +static void sfspl_set_header(void *buf, struct stat *sbuf, int infd, + struct image_tool_params *params) +{ + struct spl_hdr *hdr = buf; + unsigned int file_size; + unsigned int crc; + + file_size = params->file_size - sizeof(struct spl_hdr); + crc = crc32(0, &((unsigned char *)buf)[sizeof(struct spl_hdr)], + file_size); + + hdr->offset = cpu_to_le32(DEFAULT_OFFSET); + hdr->bkp_offs = cpu_to_le32(DEFAULT_BACKUP); + hdr->version = cpu_to_le32(DEFAULT_VERSION); + hdr->file_size = cpu_to_le32(file_size); + hdr->hdr_size = cpu_to_le32(sizeof(struct spl_hdr)); + hdr->crc32 = cpu_to_le32(crc); +} + +static int sfspl_vrec_header(struct image_tool_params *params, + struct image_type_params *tparams) +{ + tparams->hdr = calloc(sizeof(struct spl_hdr), 1); + + /* No padding */ + return 0; +} + +U_BOOT_IMAGE_TYPE( + sfspl, /* id */ + "StarFive SPL Image", /* name */ + sizeof(struct spl_hdr), /* header_size */ + NULL, /* header */ + sfspl_check_params, /* check_params */ + sfspl_verify_header, /* verify header */ + sfspl_print_header, /* print header */ + sfspl_set_header, /* set header */ + sfspl_image_extract_subimage, /* extract_subimage */ + sfspl_check_image_type, /* check_image_type */ + NULL, /* fflag_handle */ + sfspl_vrec_header /* vrec_header */ +); |