Merge tag 'video-updates-for-2019.07-rc3' of git://git.denx.de/u-boot-video
authorTom Rini <trini@konsulko.com>
Mon, 10 Jun 2019 13:41:19 +0000 (09:41 -0400)
committerTom Rini <trini@konsulko.com>
Mon, 10 Jun 2019 13:41:19 +0000 (09:41 -0400)
- mxsfb DM_VIDEO conversion
- splash fix for DM_VIDEO configurations
- meson HDMI fix for boards without hdmi-supply regulator

117 files changed:
Makefile
arch/arm/dts/armada-388-helios4-u-boot.dtsi
arch/arm/dts/imx6-logicpd-baseboard.dtsi
arch/arm/dts/imx6-logicpd-som.dtsi
arch/arm/dts/imx6q-logicpd.dts
arch/arm/dts/tegra124-apalis.dts
arch/arm/dts/tegra124-cei-tk1-som.dts
arch/arm/dts/tegra124-jetson-tk1.dts
arch/arm/dts/tegra124.dtsi
arch/arm/dts/tegra186-p2771-0000-000.dts
arch/arm/dts/tegra186-p2771-0000-500.dts
arch/arm/dts/tegra186-p2771-0000.dtsi
arch/arm/dts/tegra186.dtsi
arch/arm/dts/tegra20-harmony.dts
arch/arm/dts/tegra20-trimslice.dts
arch/arm/dts/tegra20.dtsi
arch/arm/dts/tegra210-p2371-2180.dts
arch/arm/dts/tegra210.dtsi
arch/arm/dts/tegra30-apalis.dts
arch/arm/dts/tegra30-beaver.dts
arch/arm/dts/tegra30-cardhu.dts
arch/arm/dts/tegra30.dtsi
arch/arm/include/asm/arch-tegra/cboot.h [new file with mode: 0644]
arch/arm/include/asm/arch-tegra/pmc.h
arch/arm/include/asm/arch-tegra/pmu.h [new file with mode: 0644]
arch/arm/include/asm/arch-tegra/tegra.h
arch/arm/include/asm/arch-tegra114/pmu.h [deleted file]
arch/arm/include/asm/arch-tegra124/pmu.h [deleted file]
arch/arm/include/asm/arch-tegra20/pmu.h [deleted file]
arch/arm/include/asm/arch-tegra210/pmu.h [deleted file]
arch/arm/include/asm/arch-tegra30/pmu.h [deleted file]
arch/arm/mach-at91/spl_atmel.c
arch/arm/mach-davinci/Kconfig
arch/arm/mach-davinci/Makefile
arch/arm/mach-davinci/lowlevel_init.S [deleted file]
arch/arm/mach-davinci/spl.c
arch/arm/mach-imx/Makefile
arch/arm/mach-omap2/omap3/board.c
arch/arm/mach-rockchip/rk_timer.c
arch/arm/mach-tegra/Kconfig
arch/arm/mach-tegra/Makefile
arch/arm/mach-tegra/board.c
arch/arm/mach-tegra/board186.c [deleted file]
arch/arm/mach-tegra/board2.c
arch/arm/mach-tegra/cache.c
arch/arm/mach-tegra/cboot.c [new file with mode: 0644]
arch/arm/mach-tegra/clock.c
arch/arm/mach-tegra/cmd_enterrcm.c
arch/arm/mach-tegra/cpu.c
arch/arm/mach-tegra/emc.c
arch/arm/mach-tegra/lowlevel_init.S [deleted file]
arch/arm/mach-tegra/pmc.c [new file with mode: 0644]
arch/arm/mach-tegra/powergate.c
arch/arm/mach-tegra/tegra186/Makefile
arch/arm/mach-tegra/tegra186/nvtboot_board.c [deleted file]
arch/arm/mach-tegra/tegra186/nvtboot_ll.S [deleted file]
arch/arm/mach-tegra/tegra186/nvtboot_mem.c [deleted file]
arch/arm/mach-tegra/tegra210/clock.c
arch/riscv/Kconfig
board/BuR/common/br_resetc.c
board/atmel/sama5d2_icp/sama5d2_icp.c
board/davinci/da8xxevm/da850evm.c
board/davinci/da8xxevm/omapl138_lcdk.c
board/emulation/qemu-riscv/Kconfig
board/keymile/km83xx/MAINTAINERS
board/keymile/km_arm/MAINTAINERS
board/keymile/kmp204x/MAINTAINERS
board/microchip/mpfs_icicle/Kconfig [new file with mode: 0644]
board/microchip/mpfs_icicle/MAINTAINERS [new file with mode: 0644]
board/microchip/mpfs_icicle/Makefile [new file with mode: 0644]
board/microchip/mpfs_icicle/mpfs_icicle.c [new file with mode: 0644]
board/nvidia/p2371-2180/p2371-2180.c
board/nvidia/p2771-0000/p2771-0000.c
board/ti/am335x/mux.c
cmd/efidebug.c
cmd/led.c
cmd/nvedit.c
cmd/nvedit_efi.c
common/spl/Kconfig
configs/da850_am18xxevm_defconfig
configs/da850evm_defconfig
configs/da850evm_nand_defconfig
configs/e2220-1170_defconfig
configs/gardena-smart-gateway-at91sam_defconfig
configs/microchip_mpfs_icicle_defconfig [new file with mode: 0644]
configs/omapl138_lcdk_defconfig
configs/p2371-0000_defconfig
configs/p2371-2180_defconfig
configs/p2571_defconfig
configs/p2771-0000-000_defconfig
configs/p2771-0000-500_defconfig
configs/sama5d2_icp_mmc_defconfig
configs/sama5d2_ptc_ek_mmc_defconfig
configs/sama5d2_ptc_ek_nandflash_defconfig
configs/sama5d4_xplained_mmc_defconfig
configs/tinker-rk3288_defconfig
include/configs/legoev3.h
include/configs/microchip_mpfs_icicle.h [new file with mode: 0644]
include/configs/qemu-riscv.h
include/configs/tegra-common-post.h
include/fdtdec.h
include/linux/string.h
include/time.h
include/uuid.h
lib/efi_loader/efi_bootmgr.c
lib/efi_loader/efi_boottime.c
lib/efi_loader/efi_console.c
lib/efi_loader/efi_memory.c
lib/efi_loader/efi_variable.c
lib/fdtdec.c
lib/string.c
lib/time.c
lib/uuid.c
lib/vsprintf.c
test/print_ut.c
tools/Makefile
tools/spl_size_limit.c [new file with mode: 0644]

index 07106138e9ff5311d9dbd6aebd374dcd3c15e496..8de3d4120aff8c5e5db6d996c66a9c7abed4d874 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -337,6 +337,19 @@ endif
 #  KBUILD_MODULES := 1
 #endif
 
+define size_check
+       actual=$$( wc -c $1 | awk '{print $$1}'); \
+       limit=$$( printf "%d" $2 ); \
+       if test $$actual -gt $$limit; then \
+               echo "$1 exceeds file size limit:" >&2; \
+               echo "  limit:  $$limit bytes" >&2; \
+               echo "  actual: $$actual bytes" >&2; \
+               echo "  excess: $$((actual - limit)) bytes" >&2; \
+               exit 1; \
+       fi
+endef
+export size_check
+
 export KBUILD_MODULES KBUILD_BUILTIN
 export KBUILD_CHECKSRC KBUILD_SRC KBUILD_EXTMOD
 
@@ -778,20 +791,17 @@ LDPPFLAGS += \
 #########################################################################
 
 ifneq ($(CONFIG_BOARD_SIZE_LIMIT),)
-BOARD_SIZE_CHECK = \
-       @actual=`wc -c $@ | awk '{print $$1}'`; \
-       limit=`printf "%d" $(CONFIG_BOARD_SIZE_LIMIT)`; \
-       if test $$actual -gt $$limit; then \
-               echo "$@ exceeds file size limit:" >&2 ; \
-               echo "  limit:  $$limit bytes" >&2 ; \
-               echo "  actual: $$actual bytes" >&2 ; \
-               echo "  excess: $$((actual - limit)) bytes" >&2; \
-               exit 1; \
-       fi
+BOARD_SIZE_CHECK= @ $(call size_check,$@,$(CONFIG_BOARD_SIZE_LIMIT))
 else
 BOARD_SIZE_CHECK =
 endif
 
+ifneq ($(CONFIG_SPL_SIZE_LIMIT),0)
+SPL_SIZE_CHECK = @$(call size_check,$@,$$(tools/spl_size_limit))
+else
+SPL_SIZE_CHECK =
+endif
+
 # Statically apply RELA-style relocations (currently arm64 only)
 # This is useful for arm64 where static relocation needs to be performed on
 # the raw binary, but certain simulators only accept an ELF file (but don't
@@ -1090,6 +1100,7 @@ endif
 
 %.imx: %.bin
        $(Q)$(MAKE) $(build)=arch/arm/mach-imx $@
+       $(BOARD_SIZE_CHECK)
 
 %.vyb: %.imx
        $(Q)$(MAKE) $(build)=arch/arm/cpu/armv7/vf610 $@
@@ -1707,6 +1718,8 @@ u-boot.lds: $(LDSCRIPT) prepare FORCE
 
 spl/u-boot-spl.bin: spl/u-boot-spl
        @:
+       $(SPL_SIZE_CHECK)
+
 spl/u-boot-spl: tools prepare \
                $(if $(CONFIG_OF_SEPARATE)$(CONFIG_OF_EMBED)$(CONFIG_SPL_OF_PLATDATA),dts/dt.dtb) \
                $(if $(CONFIG_OF_SEPARATE)$(CONFIG_OF_EMBED)$(CONFIG_TPL_OF_PLATDATA),dts/dt.dtb)
@@ -1769,6 +1782,7 @@ checkarmreloc: u-boot
 envtools: scripts_basic $(version_h) $(timestamp_h)
        $(Q)$(MAKE) $(build)=tools/env
 
+tools-only: export TOOLS_ONLY=y
 tools-only: scripts_basic $(version_h) $(timestamp_h)
        $(Q)$(MAKE) $(build)=tools
 
index 4b20610d83195da6365f03953c7b7de051e1ec50..f0da9f42de23d63ff09dbdec1155ac766064bc96 100644 (file)
@@ -20,3 +20,7 @@
        status = "okay";
        u-boot,dm-spl;
 };
+
+&sdhci {
+       u-boot,dm-spl;
+};
index 303c09334ba7e6405e1710da087768b7181becc6..c40a7af6ebee08b0f2de80c6cb300d3081387494 100644 (file)
@@ -1,45 +1,6 @@
-/*
- * Copyright 2018 Logic PD, Inc.
- * Based on SabreSD, Copyright 2016 Freescale Semiconductor, Inc.
- *
- * This file is dual-licensed: you can use it either under the terms
- * of the GPL or the X11 license, at your option. Note that this dual
- * licensing only applies to this file, and not this project as a
- * whole.
- *
- *  a) This file is free software; you can redistribute it and/or
- *     modify it under the terms of the GNU General Public License as
- *     published by the Free Software Foundation; either version 2 of the
- *     License, or (at your option) any later version.
- *
- *     This file is distributed in the hope that it will be useful,
- *     but WITHOUT ANY WARRANTY; without even the implied warranty of
- *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *     GNU General Public License for more details.
- *
- * Or, alternatively,
- *
- *  b) Permission is hereby granted, free of charge, to any person
- *     obtaining a copy of this software and associated documentation
- *     files (the "Software"), to deal in the Software without
- *     restriction, including without limitation the rights to use,
- *     copy, modify, merge, publish, distribute, sublicense, and/or
- *     sell copies of the Software, and to permit persons to whom the
- *     Software is furnished to do so, subject to the following
- *     conditions:
- *
- *     The above copyright notice and this permission notice shall be
- *     included in all copies or substantial portions of the Software.
- *
- *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- *     OTHER DEALINGS IN THE SOFTWARE.
- */
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright (C) 2019 Logic PD, Inc.
 
 / {
        keyboard {
@@ -68,6 +29,7 @@
                        debounce-interval = <10>;
                        wakeup-source;
                };
+
                btn3 {
                        gpios = <&pcf8575 3 GPIO_ACTIVE_LOW>;
                        label = "btn3";
@@ -81,7 +43,7 @@
        leds {
                compatible = "gpio-leds";
 
-               gen_led0 {
+               gen-led0 {
                        label = "led0";
                        pinctrl-names = "default";
                        pinctrl-0 = <&pinctrl_led0>;
                        linux,default-trigger = "cpu0";
                };
 
-               gen_led1 {
+               gen-led1 {
                        label = "led1";
                        gpios = <&pcf8575 8 GPIO_ACTIVE_HIGH>;
                };
 
-               gen_led2 {
+               gen-led2 {
                        label = "led2";
                        gpios = <&pcf8575 9 GPIO_ACTIVE_HIGH>;
                        linux,default-trigger = "heartbeat";
                };
 
-               gen_led3 {
+               gen-led3 {
                        label = "led3";
                        gpios = <&pcf8575 10 GPIO_ACTIVE_HIGH>;
                        linux,default-trigger = "default-on";
                };
        };
 
-       reg_usb_otg_vbus: regulator-otg-vbus@0 {
+       reg_usb_otg_vbus: regulator-otg-vbus {
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_reg_usb_otg>;
                compatible = "regulator-fixed";
                regulator-name = "usb_otg_vbus";
                regulator-min-microvolt = <5000000>;
                enable-active-high;
        };
 
-       reg_usb_h1_vbus: regulator-usbh1vbus@1 {
+       reg_usb_h1_vbus: regulator-usb-h1-vbus {
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_reg_usb_h1_vbus>;
                compatible = "regulator-fixed";
                regulator-name = "usb_h1_vbus";
                regulator-min-microvolt = <5000000>;
                regulator-max-microvolt = <5000000>;
+               gpio = <&gpio7 12 GPIO_ACTIVE_HIGH>;
+               startup-delay-us = <70000>;
+               enable-active-high;
        };
 
-       reg_3v3: regulator-3v3@2 {
+       reg_3v3: regulator-3v3 {
                pinctrl-names = "default";
                pinctrl-0 = <&pinctrl_reg_3v3>;
                compatible = "regulator-fixed";
                regulator-min-microvolt = <3300000>;
                regulator-max-microvolt = <3300000>;
                gpio = <&gpio1 26 GPIO_ACTIVE_HIGH>;
+               startup-delay-us = <70000>;
                enable-active-high;
                regulator-always-on;
        };
 
-       reg_enet: regulator-ethernet@3 {
+       reg_enet: regulator-ethernet {
                pinctrl-names = "default";
-               pinctrl-0 = <&pinctrl_enet_pwr>;
+               pinctrl-0 = <&pinctrl_reg_enet>;
                compatible = "regulator-fixed";
                regulator-name = "ethernet-supply";
                regulator-min-microvolt = <3300000>;
                vin-supply = <&sw4_reg>;
        };
 
-       reg_audio: regulator-audio@4 {
+       reg_audio: regulator-audio {
                pinctrl-names = "default";
                pinctrl-0 = <&pinctrl_reg_audio>;
                compatible = "regulator-fixed";
                regulator-max-microvolt = <3300000>;
                gpio = <&gpio1 29 GPIO_ACTIVE_HIGH>;
                enable-active-high;
-               regulator-always-on;
                vin-supply = <&reg_3v3>;
        };
 
-       reg_hdmi: regulator-hdmi@5 {
+       reg_hdmi: regulator-hdmi {
                pinctrl-names = "default";
                pinctrl-0 = <&pinctrl_reg_hdmi>;
                compatible = "regulator-fixed";
                vin-supply = <&reg_3v3>;
        };
 
-       reg_uart3: regulator-uart3@6 {
+       reg_uart3: regulator-uart3 {
                pinctrl-names = "default";
                pinctrl-0 = <&pinctrl_reg_uart3>;
                compatible = "regulator-fixed";
                vin-supply = <&reg_3v3>;
        };
 
-       reg_1v8: regulator-1v8@7 {
+       reg_1v8: regulator-1v8 {
                pinctrl-names = "default";
                pinctrl-0 = <&pinctrl_reg_1v8>;
                compatible = "regulator-fixed";
                vin-supply = <&reg_3v3>;
        };
 
-       reg_pcie: regulator@8 {
+       reg_pcie: regulator-pcie {
                compatible = "regulator-fixed";
                pinctrl-names = "default";
-               pinctrl-0 = <&pinctrl_pcie_reg>;
-               regulator-name = "MPCIE_3V3";
+               pinctrl-0 = <&pinctrl_reg_pcie>;
+               regulator-name = "mpcie_3v3";
                regulator-min-microvolt = <3300000>;
                regulator-max-microvolt = <3300000>;
                gpio = <&gpio1 2 GPIO_ACTIVE_HIGH>;
                enable-active-high;
        };
 
-       mipi_pwr: regulator@9 {
+       reg_mipi: regulator-mipi {
                compatible = "regulator-fixed";
                pinctrl-names = "default";
-               pinctrl-0 = <&pinctrl_mipi_pwr>;
+               pinctrl-0 = <&pinctrl_reg_mipi>;
                regulator-name = "mipi_pwr_en";
                regulator-min-microvolt = <2800000>;
                regulator-max-microvolt = <2800000>;
                compatible = "fsl,imx-audio-wm8962";
                model = "wm8962-audio";
                ssi-controller = <&ssi2>;
-               audio-codec = <&codec>;
+               audio-codec = <&wm8962>;
                audio-routing =
                        "Headphone Jack", "HPOUTL",
                        "Headphone Jack", "HPOUTR",
        status = "disabled";
 };
 
-&pwm3 {
-       pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_pwm3>;
-};
-
-&uart3 {
-       pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_uart3>;
-       status = "okay";
-};
-
-&usbh1 {
-       vbus-supply = <&reg_usb_h1_vbus>;
-       status = "okay";
-};
-
-&usbotg {
-       vbus-supply = <&reg_usb_otg_vbus>;
-       pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_usbotg>;
-       disable-over-current;
-       status = "okay";
-};
-
 &fec {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_enet>;
-       phy-mode = "rgmii";
+       phy-mode = "rgmii-id";
        phy-reset-duration = <10>;
        phy-reset-gpios = <&gpio1 24 GPIO_ACTIVE_LOW>;
        phy-supply = <&reg_enet>;
        status = "okay";
 };
 
-&usdhc2 {
-       pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_usdhc2>;
-       pinctrl-1 = <&pinctrl_usdhc2_100mhz>;
-       pinctrl-2 = <&pinctrl_usdhc2_200mhz>;
-       no-1-8-v;
-       keep-power-in-suspend;
-       status = "okay";
-};
-
 &i2c1 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_i2c1>;
        clock-frequency = <400000>;
        status = "okay";
 
-       codec: wm8962@1a {
+       wm8962: audio-codec@1a {
                compatible = "wlf,wm8962";
                reg = <0x1a>;
                clocks = <&clks IMX6QDL_CLK_CKO>;
                reg = <0x10>;
                clocks = <&clks IMX6QDL_CLK_CKO>;
                clock-names = "xclk";
-               DOVDD-supply = <&mipi_pwr>;
-               AVDD-supply = <&mipi_pwr>;
-               DVDD-supply = <&mipi_pwr>;
+               DOVDD-supply = <&reg_mipi>;
+               AVDD-supply = <&reg_mipi>;
+               DVDD-supply = <&reg_mipi>;
                reset-gpios = <&gpio3 26 GPIO_ACTIVE_LOW>;
                powerdown-gpios = <&gpio3 27 GPIO_ACTIVE_HIGH>;
 
        };
 };
 
+&ipu1_csi1_from_mipi_vc1 {
+       clock-lanes = <0>;
+       data-lanes = <1 2>;
+};
+
 &mipi_csi {
        status = "okay";
 
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_pcie>;
        reset-gpio = <&gpio1 9 GPIO_ACTIVE_LOW>;
-       status = "okay";
        vpcie-supply = <&reg_pcie>;
-       /* fsl,max-link-speed = <2>; */
+       status = "okay";
+};
+
+&pwm3 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pwm3>;
 };
 
 &ssi2 {
        status = "okay";
 };
 
-&iomuxc {
+&uart3 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart3>;
+       status = "okay";
+};
 
+&usbh1 {
+       vbus-supply = <&reg_usb_h1_vbus>;
+       status = "okay";
+};
+
+&usbotg {
+       vbus-supply = <&reg_usb_otg_vbus>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_usbotg>;
+       disable-over-current;
+       dr_mode = "otg";
+       status = "okay";
+};
+
+&usdhc2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_usdhc2>;
+       pinctrl-1 = <&pinctrl_usdhc2_100mhz>;
+       pinctrl-2 = <&pinctrl_usdhc2_200mhz>;
+       vmmc-supply = <&reg_3v3>;
+       no-1-8-v;
+       keep-power-in-suspend;
+       cd-gpios = <&gpio1 4 GPIO_ACTIVE_LOW>;
+       status = "okay";
+};
+
+&iomuxc {
        pinctrl_audmux: audmuxgrp {
                fsl,pins = <
                        MX6QDL_PAD_DISP0_DAT20__AUD4_TXC  0x130b0
                >;
        };
 
-       pinctrl_i2c1: i2c1 {
+       pinctrl_ecspi1: ecspi1grp {
                fsl,pins = <
-                       MX6QDL_PAD_EIM_D21__I2C1_SCL    0x4001b8b1
-                       MX6QDL_PAD_EIM_D28__I2C1_SDA    0x4001b8b1
+                       MX6QDL_PAD_KEY_COL0__ECSPI1_SCLK        0x100b1
+                       MX6QDL_PAD_KEY_ROW0__ECSPI1_MOSI        0x100b1
+                       MX6QDL_PAD_KEY_COL1__ECSPI1_MISO        0x100b1
+                       MX6QDL_PAD_KEY_ROW1__ECSPI1_SS0         0x100b1
                >;
        };
 
-       pinctrl_enet_pwr: enet_pwr {
+       pinctrl_enet: enetgrp {
                fsl,pins = <
-                       MX6QDL_PAD_EIM_D31__GPIO3_IO31  0x1b0b0
+                       MX6QDL_PAD_ENET_MDIO__ENET_MDIO         0x1b8b0
+                       MX6QDL_PAD_ENET_MDC__ENET_MDC           0x1b0b0
+                       MX6QDL_PAD_RGMII_TXC__RGMII_TXC         0x1b030
+                       MX6QDL_PAD_RGMII_TD0__RGMII_TD0         0x1b030
+                       MX6QDL_PAD_RGMII_TD1__RGMII_TD1         0x1b030
+                       MX6QDL_PAD_RGMII_TD2__RGMII_TD2         0x1b030
+                       MX6QDL_PAD_RGMII_TD3__RGMII_TD3         0x1b030
+                       MX6QDL_PAD_ENET_REF_CLK__ENET_TX_CLK    0x100b0
+                       MX6QDL_PAD_RGMII_TX_CTL__RGMII_TX_CTL   0x1b030
+                       MX6QDL_PAD_GPIO_16__ENET_REF_CLK        0x4001b0a8
+                       MX6QDL_PAD_RGMII_RXC__RGMII_RXC         0x1b030
+                       MX6QDL_PAD_RGMII_RD0__RGMII_RD0         0x13030
+                       MX6QDL_PAD_RGMII_RD1__RGMII_RD1         0x13030
+                       MX6QDL_PAD_RGMII_RD2__RGMII_RD2         0x1b030
+                       MX6QDL_PAD_RGMII_RD3__RGMII_RD3         0x1b030
+                       MX6QDL_PAD_RGMII_RX_CTL__RGMII_RX_CTL   0x13030
+                       MX6QDL_PAD_ENET_CRS_DV__GPIO1_IO25      0x1b0b0 /* ENET_INT */
+                       MX6QDL_PAD_ENET_RX_ER__GPIO1_IO24       0x1b0b0 /* ETHR_nRST */
                >;
        };
 
-       pinctrl_mipi_pwr: pwr_mipi {
-               fsl,pins = <MX6QDL_PAD_EIM_D19__GPIO3_IO19 0x1b0b1>;
+       pinctrl_i2c1: i2c1grp {
+               fsl,pins = <
+                       MX6QDL_PAD_EIM_D21__I2C1_SCL    0x4001b8b1
+                       MX6QDL_PAD_EIM_D28__I2C1_SDA    0x4001b8b1
+               >;
+       };
+
+       pinctrl_led0: led0grp {
+           fsl,pins = <
+               MX6QDL_PAD_ENET_TXD0__GPIO1_IO30        0x1b0b0
+           >;
        };
 
        pinctrl_ov5640: ov5640grp {
                >;
        };
 
-       pinctrl_reg_hdmi: reg_hdmi {
+       pinctrl_pcf8574: pcf8575grp {
                fsl,pins = <
-                       MX6QDL_PAD_EIM_D20__GPIO3_IO20  0x1b0b0
+                       MX6QDL_PAD_EIM_BCLK__GPIO6_IO31 0x1b0b0
                >;
        };
 
-       pinctrl_uart3: uart3grp {
+       pinctrl_pcie: pciegrp {
                fsl,pins = <
-                       MX6QDL_PAD_EIM_D23__UART3_CTS_B         0x1b0b1
-                       MX6QDL_PAD_EIM_D24__UART3_TX_DATA       0x1b0b1
-                       MX6QDL_PAD_EIM_D25__UART3_RX_DATA       0x1b0b1
-                       MX6QDL_PAD_EIM_EB3__UART3_RTS_B         0x1b0b1
+                       MX6QDL_PAD_GPIO_8__GPIO1_IO08 0x1b0b0
+                       MX6QDL_PAD_GPIO_9__GPIO1_IO09 0x1b0b0
                >;
        };
 
-       pinctrl_usbotg: usbotggrp {
-               fsl,pins = <
-                       MX6QDL_PAD_GPIO_1__USB_OTG_ID   0xd17059
-                       MX6QDL_PAD_KEY_ROW4__USB_OTG_PWR 0x130b0
-               >;
+       pinctrl_pwm3: pwm3grp {
+           fsl,pins = <
+               MX6QDL_PAD_SD4_DAT1__PWM3_OUT           0x1b0b1
+           >;
        };
 
-       pinctrl_ecspi1: ecspi1grp {
-               fsl,pins = <
-                       MX6QDL_PAD_KEY_COL0__ECSPI1_SCLK        0x100b1
-                       MX6QDL_PAD_KEY_ROW0__ECSPI1_MOSI        0x100b1
-                       MX6QDL_PAD_KEY_COL1__ECSPI1_MISO        0x100b1
-                       MX6QDL_PAD_KEY_ROW1__ECSPI1_SS0         0x100b1
-               >;
+       pinctrl_reg_1v8: reg1v8grp {
+           fsl,pins = <
+               MX6QDL_PAD_EIM_D30__GPIO3_IO30          0x1b0b0
+           >;
        };
 
-       pinctrl_usdhc2: usdhc2grp {
-               fsl,pins = <
-                       MX6QDL_PAD_GPIO_4__GPIO1_IO04           0x1b0b0 /* CD */
-                       MX6QDL_PAD_SD2_CMD__SD2_CMD             0x17069
-                       MX6QDL_PAD_SD2_CLK__SD2_CLK             0x10069
-                       MX6QDL_PAD_SD2_DAT0__SD2_DATA0          0x17069
-                       MX6QDL_PAD_SD2_DAT1__SD2_DATA1          0x17069
-                       MX6QDL_PAD_SD2_DAT2__SD2_DATA2          0x17069
-                       MX6QDL_PAD_SD2_DAT3__SD2_DATA3          0x17069
-               >;
-       };
-
-       pinctrl_usdhc2_100mhz: h100-usdhc2-100mhz {
-               fsl,pins = <
-                       MX6QDL_PAD_GPIO_4__GPIO1_IO04           0x1b0b0 /* CD */
-                       MX6QDL_PAD_SD2_CMD__SD2_CMD             0x170b9
-                       MX6QDL_PAD_SD2_CLK__SD2_CLK             0x100b9
-                       MX6QDL_PAD_SD2_DAT0__SD2_DATA0          0x170b9
-                       MX6QDL_PAD_SD2_DAT1__SD2_DATA1          0x170b9
-                       MX6QDL_PAD_SD2_DAT2__SD2_DATA2          0x170b9
-                       MX6QDL_PAD_SD2_DAT3__SD2_DATA3          0x170b9
-               >;
+       pinctrl_reg_3v3: reg3v3grp {
+           fsl,pins = <
+               MX6QDL_PAD_ENET_RXD1__GPIO1_IO26        0x1b0b0
+           >;
        };
 
-       pinctrl_usdhc2_200mhz: h100-usdhc2-200mhz {
+       pinctrl_reg_audio: reg-audiogrp {
                fsl,pins = <
-                       MX6QDL_PAD_GPIO_4__GPIO1_IO04           0x1b0b0 /* CD */
-                       MX6QDL_PAD_SD2_CMD__SD2_CMD             0x170f9
-                       MX6QDL_PAD_SD2_CLK__SD2_CLK             0x100f9
-                       MX6QDL_PAD_SD2_DAT0__SD2_DATA0          0x170f9
-                       MX6QDL_PAD_SD2_DAT1__SD2_DATA1          0x170f9
-                       MX6QDL_PAD_SD2_DAT2__SD2_DATA2          0x170f9
-                       MX6QDL_PAD_SD2_DAT3__SD2_DATA3          0x170f9
+                       MX6QDL_PAD_ENET_TXD1__GPIO1_IO29 0x1b0b0
                >;
        };
 
-       pinctrl_enet: enetgrp {
+       pinctrl_reg_enet: reg-enetgrp {
                fsl,pins = <
-                       MX6QDL_PAD_ENET_MDIO__ENET_MDIO         0x1b8b0
-                       MX6QDL_PAD_ENET_MDC__ENET_MDC           0x1b0b0
-                       MX6QDL_PAD_RGMII_TXC__RGMII_TXC         0x1b030
-                       MX6QDL_PAD_RGMII_TD0__RGMII_TD0         0x1b030
-                       MX6QDL_PAD_RGMII_TD1__RGMII_TD1         0x1b030
-                       MX6QDL_PAD_RGMII_TD2__RGMII_TD2         0x1b030
-                       MX6QDL_PAD_RGMII_TD3__RGMII_TD3         0x1b030
-                       MX6QDL_PAD_ENET_REF_CLK__ENET_TX_CLK    0x100b0
-                       MX6QDL_PAD_RGMII_TX_CTL__RGMII_TX_CTL   0x1b030
-                       MX6QDL_PAD_GPIO_16__ENET_REF_CLK        0x4001b0a8
-                       MX6QDL_PAD_RGMII_RXC__RGMII_RXC         0x1b030
-                       MX6QDL_PAD_RGMII_RD0__RGMII_RD0         0x13030
-                       MX6QDL_PAD_RGMII_RD1__RGMII_RD1         0x13030
-                       MX6QDL_PAD_RGMII_RD2__RGMII_RD2         0x1b030
-                       MX6QDL_PAD_RGMII_RD3__RGMII_RD3         0x1b030
-                       MX6QDL_PAD_RGMII_RX_CTL__RGMII_RX_CTL   0x13030
-                       MX6QDL_PAD_ENET_CRS_DV__GPIO1_IO25      0x1b0b0 /* ENET_INT */
-                       MX6QDL_PAD_ENET_RX_ER__GPIO1_IO24       0x1b0b0 /* ETHR_nRST */
+                       MX6QDL_PAD_EIM_D31__GPIO3_IO31  0x1b0b0
                >;
        };
 
-       pinctrl_reg_audio: audio-reg {
+       pinctrl_reg_hdmi: reg-hdmigrp {
                fsl,pins = <
-                       MX6QDL_PAD_ENET_TXD1__GPIO1_IO29 0x1b0b0
+                       MX6QDL_PAD_EIM_D20__GPIO3_IO20  0x1b0b0
                >;
        };
 
-       pinctrl_pcie: pcie {
-               fsl,pins = <
-                       MX6QDL_PAD_GPIO_8__GPIO1_IO08 0x1b0b0
-                       MX6QDL_PAD_GPIO_9__GPIO1_IO09 0x1b0b0
-               >;
+       pinctrl_reg_mipi: reg-mipigrp {
+               fsl,pins = <MX6QDL_PAD_EIM_D19__GPIO3_IO19 0x1b0b1>;
        };
 
-       pinctrl_pcie_reg: pciereggrp {
+       pinctrl_reg_pcie: reg-pciegrp {
                fsl,pins = <
                        MX6QDL_PAD_GPIO_2__GPIO1_IO02   0x1b0b0
                        >;
        };
 
-       pinctrl_pcf8574: pcf8575-pins {
+       pinctrl_reg_uart3: reguart3grp {
+           fsl,pins = <
+               MX6QDL_PAD_ENET_TX_EN__GPIO1_IO28       0x1b0b0
+           >;
+       };
+
+       pinctrl_reg_usb_h1_vbus: usbh1grp {
                fsl,pins = <
-                       MX6QDL_PAD_EIM_BCLK__GPIO6_IO31 0x1b0b0
+                       MX6QDL_PAD_GPIO_17__GPIO7_IO12          0x1b0b0
                >;
        };
 
-       pinctrl_lcd: lcdgrp {
+       pinctrl_reg_usb_otg: reg-usb-otggrp {
                fsl,pins = <
-                       MX6QDL_PAD_DI0_DISP_CLK__IPU1_DI0_DISP_CLK 0x10 /* R_LCD_DCLK */
-                       MX6QDL_PAD_DI0_PIN15__GPIO4_IO17        0x100b0 /* R_LCD_PANEL_PWR */
-                       MX6QDL_PAD_DI0_PIN2__IPU1_DI0_PIN02     0x10    /* R_LCD_HSYNC */
-                       MX6QDL_PAD_DI0_PIN3__IPU1_DI0_PIN03     0x10    /* R_LCD_VSYNC */
-                       MX6QDL_PAD_DI0_PIN4__IPU1_DI0_PIN04     0x10    /* R_LCD_MDISP */
-                       MX6QDL_PAD_DISP0_DAT1__IPU1_DISP0_DATA01        0x10
-                       MX6QDL_PAD_DISP0_DAT2__IPU1_DISP0_DATA02        0x10
-                       MX6QDL_PAD_DISP0_DAT3__IPU1_DISP0_DATA03   0x10
-                       MX6QDL_PAD_DISP0_DAT4__IPU1_DISP0_DATA04   0x10
-                       MX6QDL_PAD_DISP0_DAT5__IPU1_DISP0_DATA05   0x10
-                       MX6QDL_PAD_DISP0_DAT6__IPU1_DISP0_DATA06   0x10
-                       MX6QDL_PAD_DISP0_DAT7__IPU1_DISP0_DATA07   0x10
-                       MX6QDL_PAD_DISP0_DAT8__IPU1_DISP0_DATA08   0x10
-                       MX6QDL_PAD_DISP0_DAT9__IPU1_DISP0_DATA09   0x10
-                       MX6QDL_PAD_DISP0_DAT10__IPU1_DISP0_DATA10  0x10
-                       MX6QDL_PAD_DISP0_DAT11__IPU1_DISP0_DATA11  0x10
-                       MX6QDL_PAD_DISP0_DAT12__IPU1_DISP0_DATA12  0x10
-                       MX6QDL_PAD_DISP0_DAT13__IPU1_DISP0_DATA13  0x10
-                       MX6QDL_PAD_DISP0_DAT14__IPU1_DISP0_DATA14  0x10
-                       MX6QDL_PAD_DISP0_DAT15__IPU1_DISP0_DATA15  0x10
-                       MX6QDL_PAD_DISP0_DAT16__IPU1_DISP0_DATA16  0x10
+                       MX6QDL_PAD_KEY_ROW4__GPIO4_IO15         0x1b0b0
                >;
        };
 
-       pinctrl_pwm3: pwm3grp {
+       pinctrl_uart3: uart3grp {
                fsl,pins = <
-                       MX6QDL_PAD_SD4_DAT1__PWM3_OUT           0x1b0b1
+                       MX6QDL_PAD_EIM_D23__UART3_CTS_B         0x1b0b1
+                       MX6QDL_PAD_EIM_D24__UART3_TX_DATA       0x1b0b1
+                       MX6QDL_PAD_EIM_D25__UART3_RX_DATA       0x1b0b1
+                       MX6QDL_PAD_EIM_EB3__UART3_RTS_B         0x1b0b1
                >;
        };
 
-       pinctrl_reg_uart3: uart3reg {
+       pinctrl_usbotg: usbotggrp {
                fsl,pins = <
-                       MX6QDL_PAD_ENET_TX_EN__GPIO1_IO28       0x1b0b0
+                       MX6QDL_PAD_GPIO_1__USB_OTG_ID   0xd17059
                >;
        };
 
-       pinctrl_reg_3v3: reg-3v3 {
+       pinctrl_usdhc2: usdhc2grp {
                fsl,pins = <
-                       MX6QDL_PAD_ENET_RXD1__GPIO1_IO26        0x1b0b0
+                       MX6QDL_PAD_GPIO_4__GPIO1_IO04           0x1b0b0 /* CD */
+                       MX6QDL_PAD_SD2_CMD__SD2_CMD             0x17069
+                       MX6QDL_PAD_SD2_CLK__SD2_CLK             0x10069
+                       MX6QDL_PAD_SD2_DAT0__SD2_DATA0          0x17069
+                       MX6QDL_PAD_SD2_DAT1__SD2_DATA1          0x17069
+                       MX6QDL_PAD_SD2_DAT2__SD2_DATA2          0x17069
+                       MX6QDL_PAD_SD2_DAT3__SD2_DATA3          0x17069
                >;
        };
 
-       pinctrl_reg_1v8: reg-1v8 {
+       pinctrl_usdhc2_100mhz: h100-usdhc2-100mhz {
                fsl,pins = <
-                       MX6QDL_PAD_EIM_D30__GPIO3_IO30          0x1b0b0
+                       MX6QDL_PAD_GPIO_4__GPIO1_IO04           0x1b0b0 /* CD */
+                       MX6QDL_PAD_SD2_CMD__SD2_CMD             0x170b9
+                       MX6QDL_PAD_SD2_CLK__SD2_CLK             0x100b9
+                       MX6QDL_PAD_SD2_DAT0__SD2_DATA0          0x170b9
+                       MX6QDL_PAD_SD2_DAT1__SD2_DATA1          0x170b9
+                       MX6QDL_PAD_SD2_DAT2__SD2_DATA2          0x170b9
+                       MX6QDL_PAD_SD2_DAT3__SD2_DATA3          0x170b9
                >;
        };
 
-       pinctrl_led0: led0 {
+       pinctrl_usdhc2_200mhz: h100-usdhc2-200mhz {
                fsl,pins = <
-                       MX6QDL_PAD_ENET_TXD0__GPIO1_IO30        0x1b0b0
+                       MX6QDL_PAD_GPIO_4__GPIO1_IO04           0x1b0b0 /* CD */
+                       MX6QDL_PAD_SD2_CMD__SD2_CMD             0x170f9
+                       MX6QDL_PAD_SD2_CLK__SD2_CLK             0x100f9
+                       MX6QDL_PAD_SD2_DAT0__SD2_DATA0          0x170f9
+                       MX6QDL_PAD_SD2_DAT1__SD2_DATA1          0x170f9
+                       MX6QDL_PAD_SD2_DAT2__SD2_DATA2          0x170f9
+                       MX6QDL_PAD_SD2_DAT3__SD2_DATA3          0x170f9
                >;
        };
+
 };
index 3fc50babf09979816c67c17fbe3248b13d29a6a8..7ceae357324860c9ff79bf41c5deb34d6fff3cc1 100644 (file)
@@ -1,16 +1,6 @@
-/*
- * Copyright 2018 Logic PD
- * This file is adapted from imx6qdl-sabresd.dtsi.
- * Copyright 2012 Freescale Semiconductor, Inc.
- * Copyright 2011 Linaro Ltd.
- *
- * The code contained herein is licensed under the GNU General Public
- * License. You may obtain a copy of the GNU General Public License
- * Version 2 or later at the following locations:
- *
- * http://www.opensource.org/licenses/gpl-license.html
- * http://www.gnu.org/copyleft/gpl.html
- */
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright (C) 2019 Logic PD, Inc.
 
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/input/input.h>
@@ -20,7 +10,8 @@
                stdout-path = &uart1;
        };
 
-       memory {
+       memory@10000000 {
+               device_type = "memory";
                reg = <0x10000000 0x80000000>;
        };
 
        };
 };
 
-/* Reroute power feeding the CPU to come from the external PMIC */
-&reg_arm
-{
-       vin-supply = <&sw1a_reg>;
-};
-
-&reg_soc
-{
-       vin-supply = <&sw1c_reg>;
-};
-
 &clks {
        assigned-clocks = <&clks IMX6QDL_CLK_LDB_DI0_SEL>,
                          <&clks IMX6QDL_CLK_LDB_DI1_SEL>;
@@ -56,8 +36,8 @@
 &gpmi {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_gpmi_nand>;
-       status = "okay";
        nand-on-flash-bbt;
+       status = "okay";
 };
 
 &i2c3 {
@@ -66,7 +46,7 @@
        pinctrl-0 = <&pinctrl_i2c3>;
        status = "okay";
 
-       pmic: pfuze100@08 {
+       pfuze100: pmic@8 {
                compatible = "fsl,pfuze100";
                reg = <0x08>;
 
                                regulator-max-microvolt = <3300000>;
                                regulator-name = "gen_3v3";
                                regulator-boot-on;
-                               /* regulator-always-on; */
                        };
 
                        sw3a_reg: sw3a {
-                               regulator-min-microvolt = <400000>;
-                               regulator-max-microvolt = <1975000>;
+                               regulator-min-microvolt = <1350000>;
+                               regulator-max-microvolt = <1350000>;
                                regulator-name = "sw3a_vddr";
                                regulator-boot-on;
                                regulator-always-on;
                        };
 
                        sw3b_reg: sw3b {
-                               regulator-min-microvolt = <400000>;
-                               regulator-max-microvolt = <1975000>;
+                               regulator-min-microvolt = <1350000>;
+                               regulator-max-microvolt = <1350000>;
                                regulator-name = "sw3b_vddr";
                                regulator-boot-on;
                                regulator-always-on;
 
                        vgen3_reg: vgen3 {
                                regulator-name = "gen_vadj_0";
-                               regulator-min-microvolt = <3000000>;
-                               regulator-max-microvolt = <3000000>;
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <3300000>;
                        };
 
                        vgen4_reg: vgen4 {
                        };
 
                        vgen5_reg: vgen5 {
-                               regulator-name = "gen_adj_1";
-                               regulator-min-microvolt = <3300000>;
+                               regulator-name = "gen_vadj_1";
+                               regulator-min-microvolt = <1800000>;
                                regulator-max-microvolt = <3300000>;
                                regulator-always-on;
                        };
                };
        };
 
-       temp_sense0: tmp102@4a {
+       temperature-sensor@49 {
                compatible = "ti,tmp102";
-               reg = <0x4a>;
-               pinctrl-names = "default";
-               pinctrl-0 = <&pinctrl_tempsense>;
+               reg = <0x49>;
                interrupt-parent = <&gpio6>;
                interrupts = <15 IRQ_TYPE_LEVEL_LOW>;
                #thermal-sensor-cells = <1>;
        };
 
-       temp_sense1: tmp102@49 {
+       temperature-sensor@4a {
                compatible = "ti,tmp102";
-               reg = <0x49>;
+               reg = <0x4a>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_tempsense>;
                interrupt-parent = <&gpio6>;
                interrupts = <15 IRQ_TYPE_LEVEL_LOW>;
                #thermal-sensor-cells = <1>;
        };
 
-       mfg_eeprom: at24@51 {
+       eeprom@51 {
                compatible = "atmel,24c64";
                pagesize = <32>;
-               read-only;
+               read-only;      /* Manufacturing EEPROM programmed at factory */
                reg = <0x51>;
        };
 
-       user_eeprom: at24@52 {
+       eeprom@52 {
                compatible = "atmel,24c64";
                pagesize = <32>;
                reg = <0x52>;
        };
 };
 
+/* Reroute power feeding the CPU to come from the external PMIC */
+&reg_arm
+{
+       vin-supply = <&sw1a_reg>;
+};
+
+&reg_soc
+{
+       vin-supply = <&sw1c_reg>;
+};
+
 &iomuxc {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_hog>;
 
-       pinctrl_hog: hoggrp {
+       pinctrl_gpmi_nand: gpmi-nandgrp {
                fsl,pins = <
+                       MX6QDL_PAD_NANDF_CLE__NAND_CLE          0x0b0b1
+                       MX6QDL_PAD_NANDF_ALE__NAND_ALE          0x0b0b1
+                       MX6QDL_PAD_NANDF_WP_B__NAND_WP_B        0x0b0b1
+                       MX6QDL_PAD_NANDF_RB0__NAND_READY_B      0x0b000
+                       MX6QDL_PAD_NANDF_CS0__NAND_CE0_B        0x0b0b1
+                       MX6QDL_PAD_SD4_CMD__NAND_RE_B           0x0b0b1
+                       MX6QDL_PAD_SD4_CLK__NAND_WE_B           0x0b0b1
+                       MX6QDL_PAD_NANDF_D0__NAND_DATA00        0x0b0b1
+                       MX6QDL_PAD_NANDF_D1__NAND_DATA01        0x0b0b1
+                       MX6QDL_PAD_NANDF_D2__NAND_DATA02        0x0b0b1
+                       MX6QDL_PAD_NANDF_D3__NAND_DATA03        0x0b0b1
+                       MX6QDL_PAD_NANDF_D4__NAND_DATA04        0x0b0b1
+                       MX6QDL_PAD_NANDF_D5__NAND_DATA05        0x0b0b1
+                       MX6QDL_PAD_NANDF_D6__NAND_DATA06        0x0b0b1
+                       MX6QDL_PAD_NANDF_D7__NAND_DATA07        0x0b0b1
+               >;
+       };
+
+       pinctrl_hog: hoggrp {
+               fsl,pins = <    /* Enable ARM Debugger */
                        MX6QDL_PAD_CSI0_MCLK__ARM_TRACE_CTL     0x1b0b0
                        MX6QDL_PAD_CSI0_PIXCLK__ARM_EVENTO      0x1b0b0
                        MX6QDL_PAD_CSI0_VSYNC__ARM_TRACE00      0x1b0b0
                >;
        };
 
-       pinctrl_gpmi_nand: gpminandgrp {
+       pinctrl_i2c3: i2c3grp {
                fsl,pins = <
-                       MX6QDL_PAD_NANDF_CLE__NAND_CLE          0x0b0b1
-                       MX6QDL_PAD_NANDF_ALE__NAND_ALE          0x0b0b1
-                       MX6QDL_PAD_NANDF_WP_B__NAND_WP_B        0x0b0b1
-                       MX6QDL_PAD_NANDF_RB0__NAND_READY_B      0x0b000
-                       MX6QDL_PAD_NANDF_CS0__NAND_CE0_B        0x0b0b1
-                       MX6QDL_PAD_SD4_CMD__NAND_RE_B           0x0b0b1
-                       MX6QDL_PAD_SD4_CLK__NAND_WE_B           0x0b0b1
-                       MX6QDL_PAD_NANDF_D0__NAND_DATA00        0x0b0b1
-                       MX6QDL_PAD_NANDF_D1__NAND_DATA01        0x0b0b1
-                       MX6QDL_PAD_NANDF_D2__NAND_DATA02        0x0b0b1
-                       MX6QDL_PAD_NANDF_D3__NAND_DATA03        0x0b0b1
-                       MX6QDL_PAD_NANDF_D4__NAND_DATA04        0x0b0b1
-                       MX6QDL_PAD_NANDF_D5__NAND_DATA05        0x0b0b1
-                       MX6QDL_PAD_NANDF_D6__NAND_DATA06        0x0b0b1
-                       MX6QDL_PAD_NANDF_D7__NAND_DATA07        0x0b0b1
+                       MX6QDL_PAD_EIM_D17__I2C3_SCL            0x4001b8b1
+                       MX6QDL_PAD_EIM_D18__I2C3_SDA            0x4001b8b1
                >;
        };
 
-       pinctrl_i2c3: i2c3grp {
+       pinctrl_tempsense: tempsensegrp {
                fsl,pins = <
-                       MX6QDL_PAD_EIM_D17__I2C3_SCL            0x4001b8b1
-                       MX6QDL_PAD_EIM_D18__I2C3_SDA            0x4001b8b1
+                       MX6QDL_PAD_NANDF_CS2__GPIO6_IO15 0x1b0b0
                >;
        };
 
 
        pinctrl_uart2: uart2grp {
                fsl,pins = <
-                       MX6QDL_PAD_SD3_RST__GPIO7_IO08  0x13059 /* BT_EN */
+                       MX6QDL_PAD_SD3_RST__GPIO7_IO08          0x13059 /* BT_EN */
                        MX6QDL_PAD_SD4_DAT4__UART2_RX_DATA      0x1b0b1
                        MX6QDL_PAD_SD4_DAT5__UART2_RTS_B        0x1b0b1
                        MX6QDL_PAD_SD4_DAT6__UART2_CTS_B        0x1b0b1
                        MX6QDL_PAD_SD3_DAT5__GPIO7_IO00 0x17059 /* WLAN_EN */
                >;
        };
-
-       pinctrl_tempsense: tempsensegrp {
-               fsl,pins = <
-                       MX6QDL_PAD_NANDF_CS2__GPIO6_IO15 0x1b0b0        /* Temp Sense Alert */
-               >;
-       };
 };
 
 &snvs_poweroff {
 &uart2 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_uart2>;
-       status = "okay";
        uart-has-rtscts;
+       status = "okay";
+
        bluetooth {
                compatible = "ti,wl1837-st";
                enable-gpios = <&gpio7 8 GPIO_ACTIVE_HIGH>;
        pinctrl-0 = <&pinctrl_usdhc1>;
        non-removable;
        keep-power-in-suspend;
-       enable-sdio-wakeup;
-       status = "okay";
+       wakeup-source;
        vmmc-supply = <&sw2_reg>;
+       status = "okay";
 };
 
 &usdhc3 {
        keep-power-in-suspend;
        wakeup-source;
        vmmc-supply = <&reg_wl18xx_vmmc>;
-       status = "okay";
        #address-cells = <1>;
        #size-cells = <0>;
+       status = "okay";
+
        wlcore: wlcore@2 {
                  compatible = "ti,wl1837";
                  reg = <2>;
index dcea784477be96880319a65a3e4a44ecbba5fd54..45eb0b7f75f83c88339a7e04ebc42cdf77e037fb 100644 (file)
@@ -1,45 +1,6 @@
-/*
- * Copyright 2018 Logic PD, Inc.
- * Based on SabreSD, Copyright 2016 Freescale Semiconductor, Inc.
- *
- * This file is dual-licensed: you can use it either under the terms
- * of the GPL or the X11 license, at your option. Note that this dual
- * licensing only applies to this file, and not this project as a
- * whole.
- *
- *  a) This file is free software; you can redistribute it and/or
- *     modify it under the terms of the GNU General Public License as
- *     published by the Free Software Foundation; either version 2 of the
- *     License, or (at your option) any later version.
- *
- *     This file is distributed in the hope that it will be useful,
- *     but WITHOUT ANY WARRANTY; without even the implied warranty of
- *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *     GNU General Public License for more details.
- *
- * Or, alternatively,
- *
- *  b) Permission is hereby granted, free of charge, to any person
- *     obtaining a copy of this software and associated documentation
- *     files (the "Software"), to deal in the Software without
- *     restriction, including without limitation the rights to use,
- *     copy, modify, merge, publish, distribute, sublicense, and/or
- *     sell copies of the Software, and to permit persons to whom the
- *     Software is furnished to do so, subject to the following
- *     conditions:
- *
- *     The above copyright notice and this permission notice shall be
- *     included in all copies or substantial portions of the Software.
- *
- *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- *     OTHER DEALINGS IN THE SOFTWARE.
- */
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright (C) 2019 Logic PD, Inc.
 
 /dts-v1/;
 #include "imx6q.dtsi"
 #include "imx6-logicpd-baseboard.dtsi"
 
 / {
-       model = "Logic PD i.MX6QD SOM-M3 (HDMI)";
+       model = "Logic PD i.MX6QD SOM-M3";
        compatible = "fsl,imx6q";
 
-       backlight: backlight_lvds {
+       backlight: backlight-lvds {
                compatible = "pwm-backlight";
                pwms = <&pwm3 0 20000>;
                brightness-levels = <0 4 8 16 32 64 128 255>;
                power-supply = <&reg_lcd>;
        };
 
+       panel-lvds0 {
+               compatible = "okaya,rs800480t-7x0gp";
+
+               port {
+                       panel_in_lvds0: endpoint {
+                               remote-endpoint = <&lvds0_out>;
+                       };
+               };
+       };
+
        reg_lcd: regulator-lcd {
                pinctrl-names = "default";
                pinctrl-0 = <&pinctrl_lcd_reg>;
@@ -72,7 +43,7 @@
                startup-delay-us = <500000>;
        };
 
-       lcd_reset: lcd_reset {
+       reg_lcd_reset: regulator-lcd-reset {
                pinctrl-names = "default";
                pinctrl-0 = <&pinctrl_lcd_reset>;
                compatible = "regulator-fixed";
                regulator-always-on;
                vin-supply = <&reg_lcd>;
        };
+};
 
-       panel-lvds0 {
-               compatible = "ampire,am800480b3tmqw";
-               backlight = <&backlight>;
-
-               port {
-                       panel_in_lvds0: endpoint {
-                               remote-endpoint = <&lvds0_out>;
-                       };
-               };
-       };
+&clks {
+       assigned-clocks = <&clks IMX6QDL_CLK_LDB_DI0_SEL>,
+                         <&clks IMX6QDL_CLK_LDB_DI1_SEL>,
+                         <&clks IMX6QDL_CLK_IPU1_DI0_PRE_SEL>,
+                         <&clks IMX6QDL_CLK_IPU2_DI0_PRE_SEL>;
+       assigned-clock-parents = <&clks IMX6QDL_CLK_PLL5_VIDEO_DIV>,
+                                <&clks IMX6QDL_CLK_PLL5_VIDEO_DIV>,
+                                <&clks IMX6QDL_CLK_PLL2_PFD2_396M>,
+                                <&clks IMX6QDL_CLK_PLL2_PFD2_396M>;
 };
 
 &hdmi {
        status = "okay";
 };
 
-&i2c1 {
-       ili_touch: ilitouch@26 {
-               compatible = "ili,ili2117a";
-               reg = <0x26>;
-               pinctrl-names = "default";
-               pinctrl-0 = <&pinctrl_touchscreen>;
-               interrupts-extended = <&gpio1 6 IRQ_TYPE_EDGE_RISING>;
-               ili2117a,poll-period = <10>;
-               ili2117a,max-touch = <2>;
-       };
-};
-
-&reg_hdmi {
-       regulator-always-on;
-};
-
 &ldb {
        status = "okay";
 
 
                port@4 {
                        reg = <4>;
-
                        lvds0_out: endpoint {
                                remote-endpoint = <&panel_in_lvds0>;
                        };
 
 };
 
-&clks {
-       assigned-clocks = <&clks IMX6QDL_CLK_LDB_DI0_SEL>,
-                         <&clks IMX6QDL_CLK_LDB_DI1_SEL>,
-                         <&clks IMX6QDL_CLK_IPU1_DI0_PRE_SEL>,
-                         <&clks IMX6QDL_CLK_IPU2_DI0_PRE_SEL>;
-       assigned-clock-parents = <&clks IMX6QDL_CLK_PLL5_VIDEO_DIV>,
-                                <&clks IMX6QDL_CLK_PLL5_VIDEO_DIV>,
-                                <&clks IMX6QDL_CLK_PLL2_PFD2_396M>,
-                                <&clks IMX6QDL_CLK_PLL2_PFD2_396M>;
-};
-
 &pwm3 {
        status = "okay";
 };
 
-&usdhc2 {
-       cd-gpios = <&gpio1 4 GPIO_ACTIVE_LOW>;
+&reg_hdmi {
+       regulator-always-on;    /* Without this, the level shifter on HDMI doesn't turn on */
 };
 
 &iomuxc {
 
        pinctrl_lcd_reset: lcdreset {
                fsl,pins = <
-                       MX6QDL_PAD_EIM_A25__GPIO5_IO02      0x100b0     /* LCD_nRESET */
+                       MX6QDL_PAD_EIM_A25__GPIO5_IO02  0x100b0 /* LCD_nRESET */
                >;
        };
 
                >;
        };
 };
-
index fe08d3ea7304901d6af33ed57e12571c78d2f0db..a962c0a2f0ae10a34840a9dd2c5087da4ef463e0 100644 (file)
@@ -77,7 +77,7 @@
                reg = <0x0 0x80000000 0x0 0x80000000>;
        };
 
-       pcie-controller@01003000 {
+       pcie@1003000 {
                status = "okay";
                avddio-pex-supply = <&vdd_1v05>;
                avdd-pex-pll-supply = <&vdd_1v05>;
index b1dd4181ac038e5a1aa5cb48f2b53687185719cc..e5b41f3183cd98b02bc2c09bcd06368e81b8a57e 100644 (file)
@@ -29,7 +29,7 @@
                reg = <0x80000000 0x80000000>;
        };
 
-       pcie-controller@01003000 {
+       pcie@1003000 {
                status = "okay";
 
                avddio-pex-supply = <&vdd_1v05_run>;
index d6420436cde823469d6b71b5d6008f51e7c5b66b..59e080a8af6f6346a4d8677ac7a7fa032cdc27dc 100644 (file)
@@ -29,7 +29,7 @@
                reg = <0x80000000 0x80000000>;
        };
 
-       pcie-controller@01003000 {
+       pcie@1003000 {
                status = "okay";
 
                avddio-pex-supply = <&vdd_1v05_run>;
index 83d63480471ba07173f44187f0ec5791fa6f8df1..f473ba28e4a645e3b588436ad9bc2b8c8b479b37 100644 (file)
@@ -14,7 +14,7 @@
        interrupt-parent = <&lic>;
 
 
-       pcie-controller@01003000 {
+       pcie@1003000 {
                compatible = "nvidia,tegra124-pcie";
                device_type = "pci";
                reg = <0x01003000 0x00000800   /* PADS registers */
index d97c6fd3d09a61bca6277d968e3838239f45aafe..84e850d6fca6d6675eadcb1a61d9dea7ebe205ee 100644 (file)
@@ -11,7 +11,7 @@
                power-gpios = <&gpio_main TEGRA_MAIN_GPIO(P, 5) GPIO_ACTIVE_HIGH>;
        };
 
-       pcie-controller@10003000 {
+       pcie@10003000 {
                status = "okay";
 
                pci@1,0 {
index 393a8b246a0bd47a76c4a17db4d17709e64d7a5c..1ac8ab431e9017b3c0e7735668e6835c9a022722 100644 (file)
@@ -11,7 +11,7 @@
                power-gpios = <&gpio_main TEGRA_MAIN_GPIO(P, 6) GPIO_ACTIVE_HIGH>;
        };
 
-       pcie-controller@10003000 {
+       pcie@10003000 {
                status = "okay";
 
                pci@1,0 {
index a1319dc4936f00ff508b8f2ede12b0b00d9bd6d1..7cda0b41f74b61a84e8181352e4eb6a646113ba7 100644 (file)
@@ -9,6 +9,7 @@
        };
 
        aliases {
+               ethernet = "/ethernet@2490000";
                mmc0 = "/sdhci@3460000";
                mmc1 = "/sdhci@3400000";
                i2c0 = "/bpmp/i2c";
@@ -28,6 +29,7 @@
        ethernet@2490000 {
                status = "okay";
                phy-reset-gpios = <&gpio_main TEGRA_MAIN_GPIO(M, 4) GPIO_ACTIVE_LOW>;
+               local-mac-address = [ 00 00 00 00 00 00 ];
        };
 
        i2c@3160000 {
index dd9e3b869de716c43bcb8f559207adfbf2cb6ddb..0a9db9825b85d0ebaae38ef9b5398416bbe97340 100644 (file)
                #interrupt-cells = <2>;
        };
 
-       pcie-controller@10003000 {
+       pcie@10003000 {
                compatible = "nvidia,tegra186-pcie";
                device_type = "pci";
                reg = <0x0 0x10003000 0x0 0x00000800   /* PADS registers */
index 0c907054dbd4afbf697ec8366f546ebe6876c191..7fe7d52096c4d8c7a069e770dc8d5fa7269bcc6b 100644 (file)
                nvidia,sys-clock-req-active-high;
        };
 
-       pcie-controller@80003000 {
+       pcie@80003000 {
                status = "okay";
 
                avdd-pex-supply = <&pci_vdd_reg>;
index 31f509ab12c8022be201ad448388533864dae3fe..e19001ee2bdfdfc6e074c9beaa3158ee0ec3cb0f 100644 (file)
@@ -30,7 +30,7 @@
                spi-max-frequency = <25000000>;
        };
 
-       pcie-controller@80003000 {
+       pcie@80003000 {
                status = "okay";
 
                avdd-pex-supply = <&pci_vdd_reg>;
index e21ee258b3788cfdc77a0b22eb711706428bc127..275b3432bd88f111672a3f5161def625a6e686bf 100644 (file)
                reset-names = "fuse";
        };
 
-       pcie-controller@80003000 {
+       pcie@80003000 {
                compatible = "nvidia,tegra20-pcie";
                device_type = "pci";
                reg = <0x80003000 0x00000800   /* PADS registers */
index da4349bd039f8dbe72ea87d0857f2a1c4e155fe3..c2f497c524affd1245ebe9ac17278fa19e5e73a5 100644 (file)
@@ -21,7 +21,7 @@
                reg = <0x0 0x80000000 0x0 0xc0000000>;
        };
 
-       pcie-controller@01003000 {
+       pcie@1003000 {
                status = "okay";
 
                pci@1,0 {
index 229fed04529a1622884f8eeaf1931b76b7413070..3ec54b11c43f45841bc82ed58e366ec0d9cd272a 100644 (file)
@@ -11,7 +11,7 @@
        #address-cells = <2>;
        #size-cells = <2>;
 
-       pcie-controller@01003000 {
+       pcie@1003000 {
                compatible = "nvidia,tegra210-pcie";
                device_type = "pci";
                reg = <0x0 0x01003000 0x0 0x00000800   /* PADS registers */
index 1a9ce2720acd4b25537d3163860d2f737084ab04..77502dfdb4783f83f8dc535fdec1b1a87774824a 100644 (file)
@@ -32,7 +32,7 @@
                reg = <0x80000000 0x40000000>;
        };
 
-       pcie-controller@00003000 {
+       pcie@3000 {
                status = "okay";
                avdd-pexa-supply = <&vdd2_reg>;
                vdd-pexa-supply = <&vdd2_reg>;
index f5fbbe849e26eee624a4796678a7fe0e3273ec7b..9bb097b081362997c54437e0efb748837876811f 100644 (file)
@@ -28,7 +28,7 @@
                reg = <0x80000000 0x7ff00000>;
        };
 
-       pcie-controller@00003000 {
+       pcie@3000 {
                status = "okay";
 
                avdd-pexa-supply = <&ldo1_reg>;
index 5b9798c5a874035a190092fd60334787a354ab79..7534861e40d9f47203d3e669ddd5d58f7bc734a9 100644 (file)
@@ -27,7 +27,7 @@
                reg = <0x80000000 0x40000000>;
        };
 
-       pcie-controller@00003000 {
+       pcie@3000 {
                status = "okay";
 
                /* AVDD_PEXA and VDD_PEXA inputs are grounded on Cardhu. */
index 5030065cbdfe38df667fb8cc9e89e4154d5a7798..f198bc0edbe80a702a8b93cf45d7c11d9824767c 100644 (file)
@@ -10,7 +10,7 @@
        compatible = "nvidia,tegra30";
        interrupt-parent = <&lic>;
 
-       pcie-controller@00003000 {
+       pcie@3000 {
                compatible = "nvidia,tegra30-pcie";
                device_type = "pci";
                reg = <0x00003000 0x00000800   /* PADS registers */
diff --git a/arch/arm/include/asm/arch-tegra/cboot.h b/arch/arm/include/asm/arch-tegra/cboot.h
new file mode 100644 (file)
index 0000000..021c246
--- /dev/null
@@ -0,0 +1,45 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (c) 2019 NVIDIA Corporation. All rights reserved.
+ */
+
+#ifndef _TEGRA_CBOOT_H_
+#define _TEGRA_CBOOT_H_
+
+#ifdef CONFIG_ARM64
+extern unsigned long cboot_boot_x0;
+
+void cboot_save_boot_params(unsigned long x0, unsigned long x1,
+                           unsigned long x2, unsigned long x3);
+int cboot_dram_init(void);
+int cboot_dram_init_banksize(void);
+ulong cboot_get_usable_ram_top(ulong total_size);
+int cboot_get_ethaddr(const void *fdt, uint8_t mac[ETH_ALEN]);
+#else
+static inline void cboot_save_boot_params(unsigned long x0, unsigned long x1,
+                                         unsigned long x2, unsigned long x3)
+{
+}
+
+static inline int cboot_dram_init(void)
+{
+       return -ENOSYS;
+}
+
+static inline int cboot_dram_init_banksize(void)
+{
+       return -ENOSYS;
+}
+
+static inline ulong cboot_get_usable_ram_top(ulong total_size)
+{
+       return 0;
+}
+
+static inline int cboot_get_ethaddr(const void *fdt, uint8_t mac[ETH_ALEN])
+{
+       return -ENOSYS;
+}
+#endif
+
+#endif
index 34bbe75d5fdb1b7ca4f6aa902af3f6882e66bc4a..1524bf29116433f3ff8e126d338f51acddacc897 100644 (file)
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0+ */
 /*
- *  (C) Copyright 2010-2015
+ *  (C) Copyright 2010-2019
  *  NVIDIA Corporation <www.nvidia.com>
  */
 
@@ -388,4 +388,22 @@ struct pmc_ctlr {
 /* APBDEV_PMC_CNTRL2_0 0x440 */
 #define HOLD_CKE_LOW_EN                                (1 << 12)
 
+/* PMC read/write functions */
+u32 tegra_pmc_readl(unsigned long offset);
+void tegra_pmc_writel(u32 value, unsigned long offset);
+
+#define PMC_CNTRL              0x0
+#define  PMC_CNTRL_MAIN_RST    BIT(4)
+
+#if IS_ENABLED(CONFIG_TEGRA186)
+#  define PMC_SCRATCH0 0x32000
+#else
+#  define PMC_SCRATCH0 0x00050
+#endif
+
+/* for secure PMC */
+#define TEGRA_SMC_PMC          0xc2fffe00
+#define  TEGRA_SMC_PMC_READ    0xaa
+#define  TEGRA_SMC_PMC_WRITE   0xbb
+
 #endif /* PMC_H */
diff --git a/arch/arm/include/asm/arch-tegra/pmu.h b/arch/arm/include/asm/arch-tegra/pmu.h
new file mode 100644 (file)
index 0000000..e850875
--- /dev/null
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ *  (C) Copyright 2010,2011
+ *  NVIDIA Corporation <www.nvidia.com>
+ */
+
+#ifndef _TEGRA_PMU_H_
+#define _TEGRA_PMU_H_
+
+/* Set core and CPU voltages to nominal levels */
+int pmu_set_nominal(void);
+
+#endif /* _TEGRA_PMU_H_ */
index 7ae0129e2db3d65b08cae7ba7b23849779658ce3..7a4e0972fb76f4d56de28247b6f6eee547465af5 100644 (file)
 #define NV_PA_SLINK5_BASE      (NV_PA_APB_MISC_BASE + 0xDC00)
 #define NV_PA_SLINK6_BASE      (NV_PA_APB_MISC_BASE + 0xDE00)
 #define TEGRA_DVC_BASE         (NV_PA_APB_MISC_BASE + 0xD000)
+#if defined(CONFIG_TEGRA20) || defined(CONFIG_TEGRA30) || \
+       defined(CONFIG_TEGRA114) || defined(CONFIG_TEGRA124) || \
+       defined(CONFIG_TEGRA132) || defined(CONFIG_TEGRA210)
 #define NV_PA_PMC_BASE         (NV_PA_APB_MISC_BASE + 0xE400)
+#else
+#define NV_PA_PMC_BASE         0xc360000
+#endif
 #define NV_PA_EMC_BASE         (NV_PA_APB_MISC_BASE + 0xF400)
 #define NV_PA_FUSE_BASE                (NV_PA_APB_MISC_BASE + 0xF800)
 #if defined(CONFIG_TEGRA20) || defined(CONFIG_TEGRA30) || \
diff --git a/arch/arm/include/asm/arch-tegra114/pmu.h b/arch/arm/include/asm/arch-tegra114/pmu.h
deleted file mode 100644 (file)
index 1e571ee..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright (c) 2010-2013, NVIDIA CORPORATION.  All rights reserved.
- */
-
-#ifndef _TEGRA114_PMU_H_
-#define _TEGRA114_PMU_H_
-
-/* Set core and CPU voltages to nominal levels */
-int pmu_set_nominal(void);
-
-#endif /* _TEGRA114_PMU_H_ */
diff --git a/arch/arm/include/asm/arch-tegra124/pmu.h b/arch/arm/include/asm/arch-tegra124/pmu.h
deleted file mode 100644 (file)
index c38393e..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * (C) Copyright 2010-2013
- * NVIDIA Corporation <www.nvidia.com>
- */
-
-#ifndef _TEGRA124_PMU_H_
-#define _TEGRA124_PMU_H_
-
-/* Set core and CPU voltages to nominal levels */
-int pmu_set_nominal(void);
-
-#endif /* _TEGRA124_PMU_H_ */
diff --git a/arch/arm/include/asm/arch-tegra20/pmu.h b/arch/arm/include/asm/arch-tegra20/pmu.h
deleted file mode 100644 (file)
index 18766df..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- *  (C) Copyright 2010,2011
- *  NVIDIA Corporation <www.nvidia.com>
- */
-
-#ifndef _ARCH_PMU_H_
-#define _ARCH_PMU_H_
-
-/* Set core and CPU voltages to nominal levels */
-int pmu_set_nominal(void);
-
-#endif /* _ARCH_PMU_H_ */
diff --git a/arch/arm/include/asm/arch-tegra210/pmu.h b/arch/arm/include/asm/arch-tegra210/pmu.h
deleted file mode 100644 (file)
index 6ea36aa..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * (C) Copyright 2010-2015
- * NVIDIA Corporation <www.nvidia.com>
- */
-
-#ifndef _TEGRA210_PMU_H_
-#define _TEGRA210_PMU_H_
-
-/* Set core and CPU voltages to nominal levels */
-int pmu_set_nominal(void);
-
-#endif /* _TEGRA210_PMU_H_ */
diff --git a/arch/arm/include/asm/arch-tegra30/pmu.h b/arch/arm/include/asm/arch-tegra30/pmu.h
deleted file mode 100644 (file)
index a823f0f..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright (c) 2010-2012, NVIDIA CORPORATION.  All rights reserved.
- */
-
-#ifndef _TEGRA30_PMU_H_
-#define _TEGRA30_PMU_H_
-
-/* Set core and CPU voltages to nominal levels */
-int pmu_set_nominal(void);
-
-#endif /* _TEGRA30_PMU_H_ */
index ef745c94775dc81f80d0fa19650b8244642625a0..85290be3696535ffdfd5e439fc4485c689659cb6 100644 (file)
@@ -44,7 +44,15 @@ static void switch_to_main_crystal_osc(void)
 #endif
 
        tmp = readl(&pmc->mor);
+/*
+ * some boards have an external oscillator with driving.
+ * in this case we need to disable the internal SoC driving (bypass mode)
+ */
+#if defined(CONFIG_SPL_AT91_MCK_BYPASS)
+       tmp |= AT91_PMC_MOR_OSCBYPASS;
+#else
        tmp &= ~AT91_PMC_MOR_OSCBYPASS;
+#endif
        tmp &= ~AT91_PMC_MOR_KEY(0xff);
        tmp |= AT91_PMC_MOR_KEY(0x37);
        writel(tmp, &pmc->mor);
index 61e84e512991e9c30478aeab7d86c6a23fac575b..adc50922c8f562d9572f2cc0b78cd5ba596c28de 100644 (file)
@@ -134,7 +134,6 @@ source "board/davinci/da8xxevm/Kconfig"
 source "board/lego/ev3/Kconfig"
 
 config SPL_LDSCRIPT
-       default "board/$(BOARDDIR)/u-boot-spl-ipam390.lds" if TARGET_IPAM390
        default "board/$(BOARDDIR)/u-boot-spl-da850evm.lds"
 
 endif
index 6887fe05dd8625ba84dade5116591649cbb9d1f4..ed882740720614568e59a6f9968ffa6f3bcf9e36 100644 (file)
@@ -18,7 +18,3 @@ obj-$(CONFIG_SPL_FRAMEWORK)   += spl.o
 obj-$(CONFIG_SOC_DM365)        += dm365_lowlevel.o
 obj-$(CONFIG_SOC_DA8XX)        += da850_lowlevel.o
 endif
-
-ifndef CONFIG_SKIP_LOWLEVEL_INIT
-obj-y  += lowlevel_init.o
-endif
diff --git a/arch/arm/mach-davinci/lowlevel_init.S b/arch/arm/mach-davinci/lowlevel_init.S
deleted file mode 100644 (file)
index b82dafa..0000000
+++ /dev/null
@@ -1,692 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * Low-level board setup code for TI DaVinci SoC based boards.
- *
- * Copyright (C) 2007 Sergey Kubushyn <ksi@koi8.net>
- *
- * Partially based on TI sources, original copyrights follow:
- */
-
-/*
- * Board specific setup info
- *
- * (C) Copyright 2003
- * Texas Instruments, <www.ti.com>
- * Kshitij Gupta <Kshitij@ti.com>
- *
- * Modified for OMAP 1610 H2 board by Nishant Kamat, Jan 2004
- *
- * Modified for OMAP 5912 OSK board by Rishi Bhattacharya, Apr 2004
- *
- * Modified for DV-EVM board by Rishi Bhattacharya, Apr 2005
- *
- * Modified for DV-EVM board by Swaminathan S, Nov 2005
- */
-
-#include <config.h>
-
-#define MDSTAT_STATE   0x3f
-
-.globl lowlevel_init
-lowlevel_init:
-#ifdef CONFIG_SOC_DM644X
-
-       /*-------------------------------------------------------*
-        * Mask all IRQs by setting all bits in the EINT default *
-        *-------------------------------------------------------*/
-       mov     r1, $0
-       ldr     r0, =EINT_ENABLE0
-       str     r1, [r0]
-       ldr     r0, =EINT_ENABLE1
-       str     r1, [r0]
-
-       /*------------------------------------------------------*
-        * Put the GEM in reset                                 *
-        *------------------------------------------------------*/
-
-       /* Put the GEM in reset */
-       ldr     r8, PSC_GEM_FLAG_CLEAR
-       ldr     r6, MDCTL_GEM
-       ldr     r7, [r6]
-       and     r7, r7, r8
-       str     r7, [r6]
-
-       /* Enable the Power Domain Transition Command */
-       ldr     r6, PTCMD
-       ldr     r7, [r6]
-       orr     r7, r7, $0x02
-       str     r7, [r6]
-
-       /* Check for Transition Complete(PTSTAT) */
-checkStatClkStopGem:
-       ldr     r6, PTSTAT
-       ldr     r7, [r6]
-       ands    r7, r7, $0x02
-       bne     checkStatClkStopGem
-
-       /* Check for GEM Reset Completion */
-checkGemStatClkStop:
-       ldr     r6, MDSTAT_GEM
-       ldr     r7, [r6]
-       ands    r7, r7, $0x100
-       bne     checkGemStatClkStop
-
-       /* Do this for enabling a WDT initiated reset this is a workaround
-          for a chip bug.  Not required under normal situations */
-       ldr     r6, P1394
-       mov     r10, $0
-       str     r10, [r6]
-
-       /*------------------------------------------------------*
-        * Enable L1 & L2 Memories in Fast mode                 *
-        *------------------------------------------------------*/
-       ldr     r6, DFT_ENABLE
-       mov     r10, $0x01
-       str     r10, [r6]
-
-       ldr     r6, MMARG_BRF0
-       ldr     r10, MMARG_BRF0_VAL
-       str     r10, [r6]
-
-       ldr     r6, DFT_ENABLE
-       mov     r10, $0
-       str     r10, [r6]
-
-       /*------------------------------------------------------*
-        * DDR2 PLL Initialization                              *
-        *------------------------------------------------------*/
-
-       /* Select the Clock Mode Depending on the Value written in the Boot Table by the run script */
-       mov     r10, $0
-       ldr     r6, PLL2_CTL
-       ldr     r7, PLL_CLKSRC_MASK
-       ldr     r8, [r6]
-       and     r8, r8, r7
-       mov     r9, r10, lsl $8
-       orr     r8, r8, r9
-       str     r8, [r6]
-
-       /* Select the PLLEN source */
-       ldr     r7, PLL_ENSRC_MASK
-       and     r8, r8, r7
-       str     r8, [r6]
-
-       /* Bypass the PLL */
-       ldr     r7, PLL_BYPASS_MASK
-       and     r8, r8, r7
-       str     r8, [r6]
-
-       /* Wait for few cycles to allow PLLEN Mux switch properly to bypass Clock */
-       mov     r10, $0x20
-WaitPPL2Loop:
-       subs    r10, r10, $1
-       bne     WaitPPL2Loop
-
-       /* Reset the PLL */
-       ldr     r7, PLL_RESET_MASK
-       and     r8, r8, r7
-       str     r8, [r6]
-
-       /* Power up the PLL */
-       ldr     r7, PLL_PWRUP_MASK
-       and     r8, r8, r7
-       str     r8, [r6]
-
-       /* Enable the PLL from Disable Mode */
-       ldr     r7, PLL_DISABLE_ENABLE_MASK
-       and     r8, r8, r7
-       str     r8, [r6]
-
-       /* Program the PLL Multiplier */
-       ldr     r6, PLL2_PLLM
-       mov     r2, $0x17       /* 162 MHz */
-       str     r2, [r6]
-
-       /* Program the PLL2 Divisor Value */
-       ldr     r6, PLL2_DIV2
-       mov     r3, $0x01
-       str     r3, [r6]
-
-       /* Program the PLL2 Divisor Value */
-       ldr     r6, PLL2_DIV1
-       mov     r4, $0x0b       /* 54 MHz */
-       str     r4, [r6]
-
-       /* PLL2 DIV2 MMR */
-       ldr     r8, PLL2_DIV_MASK
-       ldr     r6, PLL2_DIV2
-       ldr     r9, [r6]
-       and     r8, r8, r9
-       mov     r9, $0x01
-       mov     r9, r9, lsl $15
-       orr     r8, r8, r9
-       str     r8, [r6]
-
-       /* Program the GOSET bit to take new divider values */
-       ldr     r6, PLL2_PLLCMD
-       ldr     r7, [r6]
-       orr     r7, r7, $0x01
-       str     r7, [r6]
-
-       /* Wait for Done */
-       ldr     r6, PLL2_PLLSTAT
-doneLoop_0:
-       ldr     r7, [r6]
-       ands    r7, r7, $0x01
-       bne     doneLoop_0
-
-       /* PLL2 DIV1 MMR */
-       ldr     r8, PLL2_DIV_MASK
-       ldr     r6, PLL2_DIV1
-       ldr     r9, [r6]
-       and     r8, r8, r9
-       mov     r9, $0x01
-       mov     r9, r9, lsl $15
-       orr     r8, r8, r9
-       str     r8, [r6]
-
-       /* Program the GOSET bit to take new divider values */
-       ldr     r6, PLL2_PLLCMD
-       ldr     r7, [r6]
-       orr     r7, r7, $0x01
-       str     r7, [r6]
-
-       /* Wait for Done */
-       ldr     r6, PLL2_PLLSTAT
-doneLoop:
-       ldr     r7, [r6]
-       ands    r7, r7, $0x01
-       bne     doneLoop
-
-       /* Wait for PLL to Reset Properly */
-       mov     r10, $0x218
-ResetPPL2Loop:
-       subs    r10, r10, $1
-       bne     ResetPPL2Loop
-
-       /* Bring PLL out of Reset */
-       ldr     r6, PLL2_CTL
-       ldr     r8, [r6]
-       orr     r8, r8, $0x08
-       str     r8, [r6]
-
-       /* Wait for PLL to Lock */
-       ldr     r10, PLL_LOCK_COUNT
-PLL2Lock:
-       subs    r10, r10, $1
-       bne     PLL2Lock
-
-       /* Enable the PLL */
-       ldr     r6, PLL2_CTL
-       ldr     r8, [r6]
-       orr     r8, r8, $0x01
-       str     r8, [r6]
-
-       /*------------------------------------------------------*
-        * Issue Soft Reset to DDR Module                       *
-        *------------------------------------------------------*/
-
-       /* Shut down the DDR2 LPSC Module */
-       ldr     r8, PSC_FLAG_CLEAR
-       ldr     r6, MDCTL_DDR2
-       ldr     r7, [r6]
-       and     r7, r7, r8
-       orr     r7, r7, $0x03
-       str     r7, [r6]
-
-       /* Enable the Power Domain Transition Command */
-       ldr     r6, PTCMD
-       ldr     r7, [r6]
-       orr     r7, r7, $0x01
-       str     r7, [r6]
-
-       /* Check for Transition Complete(PTSTAT) */
-checkStatClkStop:
-       ldr     r6, PTSTAT
-       ldr     r7, [r6]
-       ands    r7, r7, $0x01
-       bne     checkStatClkStop
-
-       /* Check for DDR2 Controller Enable Completion */
-checkDDRStatClkStop:
-       ldr     r6, MDSTAT_DDR2
-       ldr     r7, [r6]
-       and     r7, r7, $MDSTAT_STATE
-       cmp     r7, $0x03
-       bne     checkDDRStatClkStop
-
-       /*------------------------------------------------------*
-        * Program DDR2 MMRs for 162MHz Setting                 *
-        *------------------------------------------------------*/
-
-       /* Program PHY Control Register */
-       ldr     r6, DDRCTL
-       ldr     r7, DDRCTL_VAL
-       str     r7, [r6]
-
-       /* Program SDRAM Bank Config Register */
-       ldr     r6, SDCFG
-       ldr     r7, SDCFG_VAL
-       str     r7, [r6]
-
-       /* Program SDRAM TIM-0 Config Register */
-       ldr     r6, SDTIM0
-       ldr     r7, SDTIM0_VAL_162MHz
-       str     r7, [r6]
-
-       /* Program SDRAM TIM-1 Config Register */
-       ldr     r6, SDTIM1
-       ldr     r7, SDTIM1_VAL_162MHz
-       str     r7, [r6]
-
-       /* Program the SDRAM Bank Config Control Register */
-       ldr     r10, MASK_VAL
-       ldr     r8, SDCFG
-       ldr     r9, SDCFG_VAL
-       and     r9, r9, r10
-       str     r9, [r8]
-
-       /* Program SDRAM SDREF Config Register */
-       ldr     r6, SDREF
-       ldr     r7, SDREF_VAL
-       str     r7, [r6]
-
-       /*------------------------------------------------------*
-        * Issue Soft Reset to DDR Module                       *
-        *------------------------------------------------------*/
-
-       /* Issue a Dummy DDR2 read/write */
-       ldr     r8, DDR2_START_ADDR
-       ldr     r7, DUMMY_VAL
-       str     r7, [r8]
-       ldr     r7, [r8]
-
-       /* Shut down the DDR2 LPSC Module */
-       ldr     r8, PSC_FLAG_CLEAR
-       ldr     r6, MDCTL_DDR2
-       ldr     r7, [r6]
-       and     r7, r7, r8
-       orr     r7, r7, $0x01
-       str     r7, [r6]
-
-       /* Enable the Power Domain Transition Command */
-       ldr     r6, PTCMD
-       ldr     r7, [r6]
-       orr     r7, r7, $0x01
-       str     r7, [r6]
-
-       /* Check for Transition Complete(PTSTAT) */
-checkStatClkStop2:
-       ldr     r6, PTSTAT
-       ldr     r7, [r6]
-       ands    r7, r7, $0x01
-       bne     checkStatClkStop2
-
-       /* Check for DDR2 Controller Enable Completion */
-checkDDRStatClkStop2:
-       ldr     r6, MDSTAT_DDR2
-       ldr     r7, [r6]
-       and     r7, r7, $MDSTAT_STATE
-       cmp     r7, $0x01
-       bne     checkDDRStatClkStop2
-
-       /*------------------------------------------------------*
-        * Turn DDR2 Controller Clocks On                       *
-        *------------------------------------------------------*/
-
-       /* Enable the DDR2 LPSC Module */
-       ldr     r6, MDCTL_DDR2
-       ldr     r7, [r6]
-       orr     r7, r7, $0x03
-       str     r7, [r6]
-
-       /* Enable the Power Domain Transition Command */
-       ldr     r6, PTCMD
-       ldr     r7, [r6]
-       orr     r7, r7, $0x01
-       str     r7, [r6]
-
-       /* Check for Transition Complete(PTSTAT) */
-checkStatClkEn2:
-       ldr     r6, PTSTAT
-       ldr     r7, [r6]
-       ands    r7, r7, $0x01
-       bne     checkStatClkEn2
-
-       /* Check for DDR2 Controller Enable Completion */
-checkDDRStatClkEn2:
-       ldr     r6, MDSTAT_DDR2
-       ldr     r7, [r6]
-       and     r7, r7, $MDSTAT_STATE
-       cmp     r7, $0x03
-       bne     checkDDRStatClkEn2
-
-       /*  DDR Writes and Reads */
-       ldr     r6, CFGTEST
-       mov     r3, $0x01
-       str     r3, [r6]
-
-       /*------------------------------------------------------*
-        * System PLL Initialization                            *
-        *------------------------------------------------------*/
-
-       /* Select the Clock Mode Depending on the Value written in the Boot Table by the run script */
-       mov     r2, $0
-       ldr     r6, PLL1_CTL
-       ldr     r7, PLL_CLKSRC_MASK
-       ldr     r8, [r6]
-       and     r8, r8, r7
-       mov     r9, r2, lsl $8
-       orr     r8, r8, r9
-       str     r8, [r6]
-
-       /* Select the PLLEN source */
-       ldr     r7, PLL_ENSRC_MASK
-       and     r8, r8, r7
-       str     r8, [r6]
-
-       /* Bypass the PLL */
-       ldr     r7, PLL_BYPASS_MASK
-       and     r8, r8, r7
-       str     r8, [r6]
-
-       /* Wait for few cycles to allow PLLEN Mux switch properly to bypass Clock */
-       mov     r10, $0x20
-
-WaitLoop:
-       subs    r10, r10, $1
-       bne     WaitLoop
-
-       /* Reset the PLL */
-       ldr     r7, PLL_RESET_MASK
-       and     r8, r8, r7
-       str     r8, [r6]
-
-       /* Disable the PLL */
-       orr     r8, r8, $0x10
-       str     r8, [r6]
-
-       /* Power up the PLL */
-       ldr     r7, PLL_PWRUP_MASK
-       and     r8, r8, r7
-       str     r8, [r6]
-
-       /* Enable the PLL from Disable Mode */
-       ldr     r7, PLL_DISABLE_ENABLE_MASK
-       and     r8, r8, r7
-       str     r8, [r6]
-
-       /* Program the PLL Multiplier */
-       ldr     r6, PLL1_PLLM
-       mov     r3, $0x15       /* For 594MHz */
-       str     r3, [r6]
-
-       /* Wait for PLL to Reset Properly */
-       mov     r10, $0xff
-
-ResetLoop:
-       subs    r10, r10, $1
-       bne     ResetLoop
-
-       /* Bring PLL out of Reset */
-       ldr     r6, PLL1_CTL
-       orr     r8, r8, $0x08
-       str     r8, [r6]
-
-       /* Wait for PLL to Lock */
-       ldr     r10, PLL_LOCK_COUNT
-
-PLL1Lock:
-       subs    r10, r10, $1
-       bne     PLL1Lock
-
-       /* Enable the PLL */
-       orr     r8, r8, $0x01
-       str     r8, [r6]
-
-       nop
-       nop
-       nop
-       nop
-
-       /*------------------------------------------------------*
-        * AEMIF configuration for NOR Flash (double check)     *
-        *------------------------------------------------------*/
-       ldr     r0, _PINMUX0
-       ldr     r1, _DEV_SETTING
-       str     r1, [r0]
-
-       ldr     r0, WAITCFG
-       ldr     r1, WAITCFG_VAL
-       ldr     r2, [r0]
-       orr     r2, r2, r1
-       str     r2, [r0]
-
-       ldr     r0, ACFG3
-       ldr     r1, ACFG3_VAL
-       ldr     r2, [r0]
-       and     r1, r2, r1
-       str     r1, [r0]
-
-       ldr     r0, ACFG4
-       ldr     r1, ACFG4_VAL
-       ldr     r2, [r0]
-       and     r1, r2, r1
-       str     r1, [r0]
-
-       ldr     r0, ACFG5
-       ldr     r1, ACFG5_VAL
-       ldr     r2, [r0]
-       and     r1, r2, r1
-       str     r1, [r0]
-
-       /*--------------------------------------*
-        * VTP manual Calibration               *
-        *--------------------------------------*/
-       ldr     r0, VTPIOCR
-       ldr     r1, VTP_MMR0
-       str     r1, [r0]
-
-       ldr     r0, VTPIOCR
-       ldr     r1, VTP_MMR1
-       str     r1, [r0]
-
-       /* Wait for 33 VTP CLK cycles.  VRP operates at 27 MHz */
-       ldr     r10, VTP_LOCK_COUNT
-VTPLock:
-       subs    r10, r10, $1
-       bne     VTPLock
-
-       ldr     r6, DFT_ENABLE
-       mov     r10, $0x01
-       str     r10, [r6]
-
-       ldr     r6, DDRVTPR
-       ldr     r7, [r6]
-       mov     r8, r7, LSL #32-10
-       mov     r8, r8, LSR #32-10        /* grab low 10 bits  */
-       ldr     r7, VTP_RECAL
-       orr     r8, r7, r8
-       ldr     r7, VTP_EN
-       orr     r8, r7, r8
-       str     r8, [r0]
-
-
-       /* Wait for 33 VTP CLK cycles.  VRP operates at 27 MHz */
-       ldr     r10, VTP_LOCK_COUNT
-VTP1Lock:
-       subs    r10, r10, $1
-       bne     VTP1Lock
-
-       ldr     r1, [r0]
-       ldr     r2, VTP_MASK
-       and     r2, r1, r2
-       str     r2, [r0]
-
-       ldr     r6, DFT_ENABLE
-       mov     r10, $0
-       str     r10, [r6]
-
-       /*
-        * Call board-specific lowlevel init.
-        * That MUST be present and THAT returns
-        * back to arch calling code with "mov pc, lr."
-        */
-       b       dv_board_init
-
-.ltorg
-
-_PINMUX0:
-       .word   0x01c40000              /* Device Configuration Registers */
-_PINMUX1:
-       .word   0x01c40004              /* Device Configuration Registers */
-
-_DEV_SETTING:
-       .word   0x00000c1f
-
-WAITCFG:
-       .word   0x01e00004
-WAITCFG_VAL:
-       .word   0
-ACFG3:
-       .word   0x01e00014
-ACFG3_VAL:
-       .word   0x3ffffffd
-ACFG4:
-       .word   0x01e00018
-ACFG4_VAL:
-       .word   0x3ffffffd
-ACFG5:
-       .word   0x01e0001c
-ACFG5_VAL:
-       .word   0x3ffffffd
-
-MDCTL_DDR2:
-       .word   0x01c41a34
-MDSTAT_DDR2:
-       .word   0x01c41834
-
-PTCMD:
-       .word   0x01c41120
-PTSTAT:
-       .word   0x01c41128
-
-EINT_ENABLE0:
-       .word   0x01c48018
-EINT_ENABLE1:
-       .word   0x01c4801c
-
-PSC_FLAG_CLEAR:
-       .word   0xffffffe0
-PSC_GEM_FLAG_CLEAR:
-       .word   0xfffffeff
-
-/* DDR2 MMR & CONFIGURATION VALUES, 162 MHZ clock */
-DDRCTL:
-       .word   0x200000e4
-DDRCTL_VAL:
-       .word   0x50006405
-SDREF:
-       .word   0x2000000c
-SDREF_VAL:
-       .word   0x000005c3
-SDCFG:
-       .word   0x20000008
-SDCFG_VAL:
-#ifdef DDR_4BANKS
-       .word   0x00178622
-#elif defined DDR_8BANKS
-       .word   0x00178632
-#else
-#error "Unknown DDR configuration!!!"
-#endif
-SDTIM0:
-       .word   0x20000010
-SDTIM0_VAL_162MHz:
-       .word   0x28923211
-SDTIM1:
-       .word   0x20000014
-SDTIM1_VAL_162MHz:
-       .word   0x0016c722
-VTPIOCR:
-       .word   0x200000f0      /* VTP IO Control register */
-DDRVTPR:
-       .word   0x01c42030      /* DDR VPTR MMR */
-VTP_MMR0:
-       .word   0x201f
-VTP_MMR1:
-       .word   0xa01f
-DFT_ENABLE:
-       .word   0x01c4004c
-VTP_LOCK_COUNT:
-       .word   0x5b0
-VTP_MASK:
-       .word   0xffffdfff
-VTP_RECAL:
-       .word   0x08000
-VTP_EN:
-       .word   0x02000
-CFGTEST:
-       .word   0x80010000
-MASK_VAL:
-       .word   0x00000fff
-
-/* GEM Power Up & LPSC Control Register */
-MDCTL_GEM:
-       .word   0x01c41a9c
-MDSTAT_GEM:
-       .word   0x01c4189c
-
-/* For WDT reset chip bug */
-P1394:
-       .word   0x01c41a20
-
-PLL_CLKSRC_MASK:
-       .word   0xfffffeff      /* Mask the Clock Mode bit */
-PLL_ENSRC_MASK:
-       .word   0xffffffdf      /* Select the PLLEN source */
-PLL_BYPASS_MASK:
-       .word   0xfffffffe      /* Put the PLL in BYPASS */
-PLL_RESET_MASK:
-       .word   0xfffffff7      /* Put the PLL in Reset Mode */
-PLL_PWRUP_MASK:
-       .word   0xfffffffd      /* PLL Power up Mask Bit  */
-PLL_DISABLE_ENABLE_MASK:
-       .word   0xffffffef      /* Enable the PLL from Disable */
-PLL_LOCK_COUNT:
-       .word   0x2000
-
-/* PLL1-SYSTEM PLL MMRs */
-PLL1_CTL:
-       .word   0x01c40900
-PLL1_PLLM:
-       .word   0x01c40910
-
-/* PLL2-SYSTEM PLL MMRs */
-PLL2_CTL:
-       .word   0x01c40d00
-PLL2_PLLM:
-       .word   0x01c40d10
-PLL2_DIV1:
-       .word   0x01c40d18
-PLL2_DIV2:
-       .word   0x01c40d1c
-PLL2_PLLCMD:
-       .word   0x01c40d38
-PLL2_PLLSTAT:
-       .word   0x01c40d3c
-PLL2_DIV_MASK:
-       .word   0xffff7fff
-
-MMARG_BRF0:
-       .word   0x01c42010      /* BRF margin mode 0 (R/W)*/
-MMARG_BRF0_VAL:
-       .word   0x00444400
-
-DDR2_START_ADDR:
-       .word   0x80000000
-DUMMY_VAL:
-       .word   0xa55aa55a
-#else /* CONFIG_SOC_DM644X */
-       mov pc, lr
-#endif
index 103639e347579410b8005ba36e773b97afbf048a..be3daa9bc02dfe715d72bc12897be10b66774d7f 100644 (file)
@@ -31,9 +31,12 @@ void putc(char c)
 }
 #endif /* CONFIG_SPL_LIBCOMMON_SUPPORT */
 
-void spl_board_init(void)
+void board_init_f(ulong dummy)
 {
        arch_cpu_init();
+
+       spl_early_init();
+
        preloader_console_init();
 }
 
index 37675d05586fc5fe93c5560f10c959a3f261b190..c46984994a182f43daec361a69ca8f82f8141c0b 100644 (file)
@@ -61,21 +61,6 @@ obj-$(CONFIG_CMD_HDMIDETECT) += cmd_hdmidet.o
 obj-$(CONFIG_CMD_DEKBLOB) += cmd_dek.o
 endif
 
-ifneq ($(CONFIG_BOARD_SIZE_LIMIT),)
-BOARD_SIZE_CHECK = \
-        @actual=`wc -c $@ | awk '{print $$1}'`; \
-        limit=`printf "%d" $(CONFIG_BOARD_SIZE_LIMIT)`; \
-        if test $$actual -gt $$limit; then \
-                echo "$@ exceeds file size limit:" >&2 ; \
-                echo "  limit:  $$limit bytes" >&2 ; \
-                echo "  actual: $$actual bytes" >&2 ; \
-                echo "  excess: $$((actual - limit)) bytes" >&2; \
-                exit 1; \
-        fi
-else
-BOARD_SIZE_CHECK =
-endif
-
 PLUGIN = board/$(BOARDDIR)/plugin
 
 ifeq ($(CONFIG_USE_IMXIMG_PLUGIN),y)
@@ -124,7 +109,6 @@ u-boot.imx: MKIMAGEOUTPUT = u-boot.imx.log
 
 u-boot.imx: u-boot.bin u-boot.cfgout $(PLUGIN).bin FORCE
        $(call if_changed,mkimage)
-       $(BOARD_SIZE_CHECK)
 
 ifeq ($(CONFIG_OF_SEPARATE),y)
 MKIMAGEFLAGS_u-boot-dtb.imx = -n $(filter-out $(PLUGIN).bin $< $(PHONY),$^) \
index 2d25fc60a0eec6cdfb5f1f784286b631b10fd4d3..658ef8c1f11e5a44e2f954d20ea90407fad84224 100644 (file)
@@ -34,6 +34,8 @@ static void omap3_invalidate_l2_cache_secure(void);
 #endif
 
 #ifdef CONFIG_DM_GPIO
+#if !CONFIG_IS_ENABLED(OF_CONTROL)
+/* Manually initialize GPIO banks when OF_CONTROL doesn't */
 static const struct omap_gpio_platdata omap34xx_gpio[] = {
        { 0, OMAP34XX_GPIO1_BASE },
        { 1, OMAP34XX_GPIO2_BASE },
@@ -51,7 +53,7 @@ U_BOOT_DEVICES(omap34xx_gpios) = {
        { "gpio_omap", &omap34xx_gpio[4] },
        { "gpio_omap", &omap34xx_gpio[5] },
 };
-
+#endif
 #else
 
 static const struct gpio_bank gpio_bank_34xx[6] = {
index f20e64f48ece7ceb6d937286ed174eb7afd87593..29d379fa0abc11ea3ef1b055cd448cb868393d73 100644 (file)
@@ -20,13 +20,6 @@ static uint64_t rockchip_get_ticks(void)
        return timebase_h << 32 | timebase_l;
 }
 
-static uint64_t usec_to_tick(unsigned int usec)
-{
-       uint64_t tick = usec;
-       tick *= CONFIG_SYS_TIMER_RATE / (1000 * 1000);
-       return tick;
-}
-
 void rockchip_udelay(unsigned int usec)
 {
        uint64_t tmp;
index 86b1cd11f752c4573a381419c71bb098ec50ff26..97e22ead59859e79631bf2b12c57f37ff41cff22 100644 (file)
@@ -12,6 +12,12 @@ config SPL_LIBGENERIC_SUPPORT
 config SPL_SERIAL_SUPPORT
        default y
 
+config TEGRA_CLKRST
+       bool
+
+config TEGRA_GP_PADCTRL
+       bool
+
 config TEGRA_IVC
        bool "Tegra IVC protocol"
        help
@@ -20,6 +26,19 @@ config TEGRA_IVC
          U-Boot, it is typically used for communication between the main CPU
          and various auxiliary processors.
 
+config TEGRA_MC
+       bool
+
+config TEGRA_PINCTRL
+       bool
+
+config TEGRA_PMC
+       bool
+
+config TEGRA_PMC_SECURE
+       bool
+       depends on TEGRA_PMC
+
 config TEGRA_COMMON
        bool "Tegra common options"
        select BINMAN
@@ -55,14 +74,20 @@ config TEGRA_ARMV7_COMMON
        select SPL
        select SPL_BOARD_INIT if SPL
        select SUPPORT_SPL
+       select TEGRA_CLKRST
        select TEGRA_COMMON
        select TEGRA_GPIO
+       select TEGRA_GP_PADCTRL
+       select TEGRA_MC
        select TEGRA_NO_BPMP
+       select TEGRA_PINCTRL
+       select TEGRA_PMC
 
 config TEGRA_ARMV8_COMMON
        bool "Tegra 64-bit common options"
        select ARM64
        select LINUX_KERNEL_IMAGE_HEADER
+       select POSITION_INDEPENDENT
        select TEGRA_COMMON
 
 if TEGRA_ARMV8_COMMON
@@ -100,8 +125,14 @@ config TEGRA124
 config TEGRA210
        bool "Tegra210 family"
        select TEGRA_ARMV8_COMMON
+       select TEGRA_CLKRST
        select TEGRA_GPIO
+       select TEGRA_GP_PADCTRL
+       select TEGRA_MC
        select TEGRA_NO_BPMP
+       select TEGRA_PINCTRL
+       select TEGRA_PMC
+       select TEGRA_PMC_SECURE
 
 config TEGRA186
        bool "Tegra186 family"
@@ -118,6 +149,7 @@ endchoice
 
 config TEGRA_DISCONNECT_UDC_ON_BOOT
        bool "Disconnect USB device mode controller on boot"
+       depends on CI_UDC
        default y
        help
          When loading U-Boot into RAM over USB protocols using tools such as
index d4b4666fb1e22a29d0689df400cd2b7edd53837d..7165d70a60da926be271ac2df8ec564f319c77f4 100644 (file)
@@ -1,11 +1,10 @@
 # SPDX-License-Identifier: GPL-2.0+
 #
-# (C) Copyright 2010-2015 Nvidia Corporation.
+# (C) Copyright 2010-2019 Nvidia Corporation.
 #
 # (C) Copyright 2000-2008
 # Wolfgang Denk, DENX Software Engineering, wd@denx.de.
 
-ifndef CONFIG_TEGRA186
 ifdef CONFIG_SPL_BUILD
 obj-y += spl.o
 obj-y += cpu.o
@@ -13,25 +12,24 @@ else
 obj-$(CONFIG_CMD_ENTERRCM) += cmd_enterrcm.o
 endif
 
-obj-y += ap.o
+obj-$(CONFIG_TEGRA_GP_PADCTRL) += ap.o
 obj-y += board.o board2.o
 obj-y += cache.o
-obj-y += clock.o
-obj-y += pinmux-common.o
-obj-y += powergate.o
+obj-$(CONFIG_TEGRA_CLKRST) += clock.o
+obj-$(CONFIG_TEGRA_PINCTRL) += pinmux-common.o
+obj-$(CONFIG_TEGRA_PMC) += powergate.o
 obj-y += xusb-padctl-dummy.o
-endif
 
-obj-$(CONFIG_ARM64) += arm64-mmu.o
+obj-$(CONFIG_ARM64) += arm64-mmu.o cboot.o
 obj-y += dt-setup.o
 obj-$(CONFIG_TEGRA_CLOCK_SCALING) += emc.o
 obj-$(CONFIG_TEGRA_GPU) += gpu.o
 obj-$(CONFIG_TEGRA_IVC) += ivc.o
-obj-y += lowlevel_init.o
 ifndef CONFIG_SPL_BUILD
 obj-$(CONFIG_ARMV7_PSCI) += psci.o
 endif
 obj-$(CONFIG_DISPLAY_CPUINFO) += sys_info.o
+obj-y += pmc.o
 
 obj-$(CONFIG_TEGRA20) += tegra20/
 obj-$(CONFIG_TEGRA30) += tegra30/
index 4e159075d379bdb90aad5253ef2088dc6dfbc5f8..abcae15ea3315c8ab925056b5b24e935a4019c05 100644 (file)
@@ -9,12 +9,19 @@
 #include <ns16550.h>
 #include <spl.h>
 #include <asm/io.h>
+#if IS_ENABLED(CONFIG_TEGRA_CLKRST)
 #include <asm/arch/clock.h>
+#endif
+#if IS_ENABLED(CONFIG_TEGRA_PINCTRL)
 #include <asm/arch/funcmux.h>
+#endif
+#if IS_ENABLED(CONFIG_TEGRA_MC)
 #include <asm/arch/mc.h>
+#endif
 #include <asm/arch/tegra.h>
 #include <asm/arch-tegra/ap.h>
 #include <asm/arch-tegra/board.h>
+#include <asm/arch-tegra/cboot.h>
 #include <asm/arch-tegra/pmc.h>
 #include <asm/arch-tegra/sys_proto.h>
 #include <asm/arch-tegra/warmboot.h>
@@ -36,9 +43,25 @@ enum {
 static bool from_spl __attribute__ ((section(".data")));
 
 #ifndef CONFIG_SPL_BUILD
-void save_boot_params(u32 r0, u32 r1, u32 r2, u32 r3)
+void save_boot_params(unsigned long r0, unsigned long r1, unsigned long r2,
+                     unsigned long r3)
 {
        from_spl = r0 != UBOOT_NOT_LOADED_FROM_SPL;
+
+       /*
+        * The logic for this is somewhat indirect. The purpose of the marker
+        * (UBOOT_NOT_LOADED_FROM_SPL) is in fact used to determine if U-Boot
+        * was loaded from a read-only instance of itself, which is something
+        * that can happen in secure boot setups. So basically the presence
+        * of the marker is an indication that U-Boot was loaded by one such
+        * special variant of U-Boot. Conversely, the absence of the marker
+        * indicates that this instance of U-Boot was loaded by something
+        * other than a special U-Boot. This could be SPL, but it could just
+        * as well be one of any number of other first stage bootloaders.
+        */
+       if (from_spl)
+               cboot_save_boot_params(r0, r1, r2, r3);
+
        save_boot_params_ret();
 }
 #endif
@@ -66,6 +89,7 @@ bool tegra_cpu_is_non_secure(void)
 }
 #endif
 
+#if IS_ENABLED(CONFIG_TEGRA_MC)
 /* Read the RAM size directly from the memory controller */
 static phys_size_t query_sdram_size(void)
 {
@@ -115,14 +139,26 @@ static phys_size_t query_sdram_size(void)
 
        return size_bytes;
 }
+#endif
 
 int dram_init(void)
 {
+       int err;
+
+       /* try to initialize DRAM from cboot DTB first */
+       err = cboot_dram_init();
+       if (err == 0)
+               return 0;
+
+#if IS_ENABLED(CONFIG_TEGRA_MC)
        /* We do not initialise DRAM here. We just query the size */
        gd->ram_size = query_sdram_size();
+#endif
+
        return 0;
 }
 
+#if IS_ENABLED(CONFIG_TEGRA_PINCTRL)
 static int uart_configs[] = {
 #if defined(CONFIG_TEGRA20)
  #if defined(CONFIG_TEGRA_UARTA_UAA_UAB)
@@ -190,9 +226,11 @@ static void setup_uarts(int uart_ids)
                }
        }
 }
+#endif
 
 void board_init_uart_f(void)
 {
+#if IS_ENABLED(CONFIG_TEGRA_PINCTRL)
        int uart_ids = 0;       /* bit mask of which UART ids to enable */
 
 #ifdef CONFIG_TEGRA_ENABLE_UARTA
@@ -211,6 +249,7 @@ void board_init_uart_f(void)
        uart_ids |= UARTE;
 #endif
        setup_uarts(uart_ids);
+#endif
 }
 
 #if !CONFIG_IS_ENABLED(OF_CONTROL)
diff --git a/arch/arm/mach-tegra/board186.c b/arch/arm/mach-tegra/board186.c
deleted file mode 100644 (file)
index 80b5570..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Copyright (c) 2016, NVIDIA CORPORATION.
- */
-
-#include <common.h>
-#include <asm/arch/tegra.h>
-
-int board_early_init_f(void)
-{
-       return 0;
-}
-
-__weak int tegra_board_init(void)
-{
-       return 0;
-}
-
-int board_init(void)
-{
-       return tegra_board_init();
-}
-
-__weak int tegra_soc_board_init_late(void)
-{
-       return 0;
-}
-
-int board_late_init(void)
-{
-       return tegra_soc_board_init_late();
-}
index 12257a42b51b645da544dd5f1b9fc458ccde7681..bbc487aa3bf6c03f9c8ed461aaae79b05466eabc 100644 (file)
 #include <asm/io.h>
 #include <asm/arch-tegra/ap.h>
 #include <asm/arch-tegra/board.h>
+#include <asm/arch-tegra/cboot.h>
 #include <asm/arch-tegra/clk_rst.h>
 #include <asm/arch-tegra/pmc.h>
+#include <asm/arch-tegra/pmu.h>
 #include <asm/arch-tegra/sys_proto.h>
 #include <asm/arch-tegra/uart.h>
 #include <asm/arch-tegra/warmboot.h>
 #include <asm/arch-tegra/gpu.h>
 #include <asm/arch-tegra/usb.h>
 #include <asm/arch-tegra/xusb-padctl.h>
+#if IS_ENABLED(CONFIG_TEGRA_CLKRST)
 #include <asm/arch/clock.h>
+#endif
+#if IS_ENABLED(CONFIG_TEGRA_PINCTRL)
 #include <asm/arch/funcmux.h>
 #include <asm/arch/pinmux.h>
-#include <asm/arch/pmu.h>
+#endif
 #include <asm/arch/tegra.h>
 #ifdef CONFIG_TEGRA_CLOCK_SCALING
 #include <asm/arch/emc.h>
@@ -47,6 +52,7 @@ __weak void pin_mux_mmc(void) {}
 __weak void gpio_early_init_uart(void) {}
 __weak void pin_mux_display(void) {}
 __weak void start_cpu_fan(void) {}
+__weak void cboot_late_init(void) {}
 
 #if defined(CONFIG_TEGRA_NAND)
 __weak void pin_mux_nand(void)
@@ -109,8 +115,10 @@ int board_init(void)
        __maybe_unused int board_id;
 
        /* Do clocks and UART first so that printf() works */
+#if IS_ENABLED(CONFIG_TEGRA_CLKRST)
        clock_init();
        clock_verify();
+#endif
 
        tegra_gpu_config();
 
@@ -181,8 +189,10 @@ void gpio_early_init(void) __attribute__((weak, alias("__gpio_early_init")));
 
 int board_early_init_f(void)
 {
+#if IS_ENABLED(CONFIG_TEGRA_CLKRST)
        if (!clock_early_init_done())
                clock_early_init();
+#endif
 
 #if defined(CONFIG_TEGRA_DISCONNECT_UDC_ON_BOOT)
 #define USBCMD_FS2 (1 << 15)
@@ -193,10 +203,12 @@ int board_early_init_f(void)
 #endif
 
        /* Do any special system timer/TSC setup */
-#if defined(CONFIG_TEGRA_SUPPORT_NON_SECURE)
+#if IS_ENABLED(CONFIG_TEGRA_CLKRST)
+#  if defined(CONFIG_TEGRA_SUPPORT_NON_SECURE)
        if (!tegra_cpu_is_non_secure())
-#endif
+#  endif
                arch_timer_init();
+#endif
 
        pinmux_init();
        board_init_uart_f();
@@ -233,6 +245,7 @@ int board_late_init(void)
        }
 #endif
        start_cpu_fan();
+       cboot_late_init();
 
        return 0;
 }
@@ -327,6 +340,15 @@ static ulong usable_ram_size_below_4g(void)
  */
 int dram_init_banksize(void)
 {
+       int err;
+
+       /* try to compute DRAM bank size based on cboot DTB first */
+       err = cboot_dram_init_banksize();
+       if (err == 0)
+               return err;
+
+       /* fall back to default DRAM bank size computation */
+
        gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
        gd->bd->bi_dram[0].size = usable_ram_size_below_4g();
 
@@ -360,5 +382,14 @@ int dram_init_banksize(void)
  */
 ulong board_get_usable_ram_top(ulong total_size)
 {
+       ulong ram_top;
+
+       /* try to get top of usable RAM based on cboot DTB first */
+       ram_top = cboot_get_usable_ram_top(total_size);
+       if (ram_top > 0)
+               return ram_top;
+
+       /* fall back to default usable RAM computation */
+
        return CONFIG_SYS_SDRAM_BASE + usable_ram_size_below_4g();
 }
index be414e4e4aca296206e05cadd3534684d6b1c572..d7063490e222092e04e634df94e3edafe225ecad 100644 (file)
@@ -8,7 +8,9 @@
 #include <common.h>
 #include <asm/io.h>
 #include <asm/arch-tegra/ap.h>
+#if IS_ENABLED(CONFIG_TEGRA_GP_PADCTRL)
 #include <asm/arch/gp_padctrl.h>
+#endif
 
 #ifndef CONFIG_ARM64
 void config_cache(void)
diff --git a/arch/arm/mach-tegra/cboot.c b/arch/arm/mach-tegra/cboot.c
new file mode 100644 (file)
index 0000000..a829ef7
--- /dev/null
@@ -0,0 +1,620 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (c) 2016-2018, NVIDIA CORPORATION.
+ */
+
+#include <common.h>
+#include <environment.h>
+#include <fdt_support.h>
+#include <fdtdec.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <linux/ctype.h>
+#include <linux/sizes.h>
+
+#include <asm/arch/tegra.h>
+#include <asm/arch-tegra/cboot.h>
+#include <asm/armv8/mmu.h>
+
+/*
+ * Size of a region that's large enough to hold the relocated U-Boot and all
+ * other allocations made around it (stack, heap, page tables, etc.)
+ * In practice, running "bdinfo" at the shell prompt, the stack reaches about
+ * 5MB from the address selected for ram_top as of the time of writing,
+ * so a 16MB region should be plenty.
+ */
+#define MIN_USABLE_RAM_SIZE SZ_16M
+/*
+ * The amount of space we expect to require for stack usage. Used to validate
+ * that all reservations fit into the region selected for the relocation target
+ */
+#define MIN_USABLE_STACK_SIZE SZ_1M
+
+DECLARE_GLOBAL_DATA_PTR;
+
+extern struct mm_region tegra_mem_map[];
+
+/*
+ * These variables are written to before relocation, and hence cannot be
+ * in.bss, since .bss overlaps the DTB that's appended to the U-Boot binary.
+ * The section attribute forces this into .data and avoids this issue. This
+ * also has the nice side-effect of the content being valid after relocation.
+ */
+
+/* The number of valid entries in ram_banks[] */
+static int ram_bank_count __attribute__((section(".data")));
+
+/*
+ * The usable top-of-RAM for U-Boot. This is both:
+ * a) Below 4GB to avoid issues with peripherals that use 32-bit addressing.
+ * b) At the end of a region that has enough space to hold the relocated U-Boot
+ *    and all other allocations made around it (stack, heap, page tables, etc.)
+ */
+static u64 ram_top __attribute__((section(".data")));
+/* The base address of the region of RAM that ends at ram_top */
+static u64 region_base __attribute__((section(".data")));
+
+/*
+ * Explicitly put this in the .data section because it is written before the
+ * .bss section is zeroed out but it needs to persist.
+ */
+unsigned long cboot_boot_x0 __attribute__((section(".data")));
+
+void cboot_save_boot_params(unsigned long x0, unsigned long x1,
+                           unsigned long x2, unsigned long x3)
+{
+       cboot_boot_x0 = x0;
+}
+
+int cboot_dram_init(void)
+{
+       unsigned int na, ns;
+       const void *cboot_blob = (void *)cboot_boot_x0;
+       int node, len, i;
+       const u32 *prop;
+
+       if (!cboot_blob)
+               return -EINVAL;
+
+       na = fdtdec_get_uint(cboot_blob, 0, "#address-cells", 2);
+       ns = fdtdec_get_uint(cboot_blob, 0, "#size-cells", 2);
+
+       node = fdt_path_offset(cboot_blob, "/memory");
+       if (node < 0) {
+               pr_err("Can't find /memory node in cboot DTB");
+               hang();
+       }
+       prop = fdt_getprop(cboot_blob, node, "reg", &len);
+       if (!prop) {
+               pr_err("Can't find /memory/reg property in cboot DTB");
+               hang();
+       }
+
+       /* Calculate the true # of base/size pairs to read */
+       len /= 4;               /* Convert bytes to number of cells */
+       len /= (na + ns);       /* Convert cells to number of banks */
+       if (len > CONFIG_NR_DRAM_BANKS)
+               len = CONFIG_NR_DRAM_BANKS;
+
+       /* Parse the /memory node, and save useful entries */
+       gd->ram_size = 0;
+       ram_bank_count = 0;
+       for (i = 0; i < len; i++) {
+               u64 bank_start, bank_end, bank_size, usable_bank_size;
+
+               /* Extract raw memory region data from DTB */
+               bank_start = fdt_read_number(prop, na);
+               prop += na;
+               bank_size = fdt_read_number(prop, ns);
+               prop += ns;
+               gd->ram_size += bank_size;
+               bank_end = bank_start + bank_size;
+               debug("Bank %d: %llx..%llx (+%llx)\n", i,
+                     bank_start, bank_end, bank_size);
+
+               /*
+                * Align the bank to MMU section size. This is not strictly
+                * necessary, since the translation table construction code
+                * handles page granularity without issue. However, aligning
+                * the MMU entries reduces the size and number of levels in the
+                * page table, so is worth it.
+                */
+               bank_start = ROUND(bank_start, SZ_2M);
+               bank_end = bank_end & ~(SZ_2M - 1);
+               bank_size = bank_end - bank_start;
+               debug("  aligned: %llx..%llx (+%llx)\n",
+                     bank_start, bank_end, bank_size);
+               if (bank_end <= bank_start)
+                       continue;
+
+               /* Record data used to create MMU translation tables */
+               ram_bank_count++;
+               /* Index below is deliberately 1-based to skip MMIO entry */
+               tegra_mem_map[ram_bank_count].virt = bank_start;
+               tegra_mem_map[ram_bank_count].phys = bank_start;
+               tegra_mem_map[ram_bank_count].size = bank_size;
+               tegra_mem_map[ram_bank_count].attrs =
+                       PTE_BLOCK_MEMTYPE(MT_NORMAL) | PTE_BLOCK_INNER_SHARE;
+
+               /* Determine best bank to relocate U-Boot into */
+               if (bank_end > SZ_4G)
+                       bank_end = SZ_4G;
+               debug("  end  %llx (usable)\n", bank_end);
+               usable_bank_size = bank_end - bank_start;
+               debug("  size %llx (usable)\n", usable_bank_size);
+               if ((usable_bank_size >= MIN_USABLE_RAM_SIZE) &&
+                   (bank_end > ram_top)) {
+                       ram_top = bank_end;
+                       region_base = bank_start;
+                       debug("ram top now %llx\n", ram_top);
+               }
+       }
+
+       /* Ensure memory map contains the desired sentinel entry */
+       tegra_mem_map[ram_bank_count + 1].virt = 0;
+       tegra_mem_map[ram_bank_count + 1].phys = 0;
+       tegra_mem_map[ram_bank_count + 1].size = 0;
+       tegra_mem_map[ram_bank_count + 1].attrs = 0;
+
+       /* Error out if a relocation target couldn't be found */
+       if (!ram_top) {
+               pr_err("Can't find a usable RAM top");
+               hang();
+       }
+
+       return 0;
+}
+
+int cboot_dram_init_banksize(void)
+{
+       int i;
+
+       if (ram_bank_count == 0)
+               return -EINVAL;
+
+       if ((gd->start_addr_sp - region_base) < MIN_USABLE_STACK_SIZE) {
+               pr_err("Reservations exceed chosen region size");
+               hang();
+       }
+
+       for (i = 0; i < ram_bank_count; i++) {
+               gd->bd->bi_dram[i].start = tegra_mem_map[1 + i].virt;
+               gd->bd->bi_dram[i].size = tegra_mem_map[1 + i].size;
+       }
+
+#ifdef CONFIG_PCI
+       gd->pci_ram_top = ram_top;
+#endif
+
+       return 0;
+}
+
+ulong cboot_get_usable_ram_top(ulong total_size)
+{
+       return ram_top;
+}
+
+/*
+ * The following few functions run late during the boot process and dynamically
+ * calculate the load address of various binaries. To keep track of multiple
+ * allocations, some writable list of RAM banks must be used. tegra_mem_map[]
+ * is used for this purpose to avoid making yet another copy of the list of RAM
+ * banks. This is safe because tegra_mem_map[] is only used once during very
+ * early boot to create U-Boot's page tables, long before this code runs. If
+ * this assumption becomes invalid later, we can just fix the code to copy the
+ * list of RAM banks into some private data structure before running.
+ */
+
+static char *gen_varname(const char *var, const char *ext)
+{
+       size_t len_var = strlen(var);
+       size_t len_ext = strlen(ext);
+       size_t len = len_var + len_ext + 1;
+       char *varext = malloc(len);
+
+       if (!varext)
+               return 0;
+       strcpy(varext, var);
+       strcpy(varext + len_var, ext);
+       return varext;
+}
+
+static void mark_ram_allocated(int bank, u64 allocated_start, u64 allocated_end)
+{
+       u64 bank_start = tegra_mem_map[bank].virt;
+       u64 bank_size = tegra_mem_map[bank].size;
+       u64 bank_end = bank_start + bank_size;
+       bool keep_front = allocated_start != bank_start;
+       bool keep_tail = allocated_end != bank_end;
+
+       if (keep_front && keep_tail) {
+               /*
+                * There are CONFIG_NR_DRAM_BANKS DRAM entries in the array,
+                * starting at index 1 (index 0 is MMIO). So, we are at DRAM
+                * entry "bank" not "bank - 1" as for a typical 0-base array.
+                * The number of remaining DRAM entries is therefore
+                * "CONFIG_NR_DRAM_BANKS - bank". We want to duplicate the
+                * current entry and shift up the remaining entries, dropping
+                * the last one. Thus, we must copy one fewer entry than the
+                * number remaining.
+                */
+               memmove(&tegra_mem_map[bank + 1], &tegra_mem_map[bank],
+                       CONFIG_NR_DRAM_BANKS - bank - 1);
+               tegra_mem_map[bank].size = allocated_start - bank_start;
+               bank++;
+               tegra_mem_map[bank].virt = allocated_end;
+               tegra_mem_map[bank].phys = allocated_end;
+               tegra_mem_map[bank].size = bank_end - allocated_end;
+       } else if (keep_front) {
+               tegra_mem_map[bank].size = allocated_start - bank_start;
+       } else if (keep_tail) {
+               tegra_mem_map[bank].virt = allocated_end;
+               tegra_mem_map[bank].phys = allocated_end;
+               tegra_mem_map[bank].size = bank_end - allocated_end;
+       } else {
+               /*
+                * We could move all subsequent banks down in the array but
+                * that's not necessary for subsequent allocations to work, so
+                * we skip doing so.
+                */
+               tegra_mem_map[bank].size = 0;
+       }
+}
+
+static void reserve_ram(u64 start, u64 size)
+{
+       int bank;
+       u64 end = start + size;
+
+       for (bank = 1; bank <= CONFIG_NR_DRAM_BANKS; bank++) {
+               u64 bank_start = tegra_mem_map[bank].virt;
+               u64 bank_size = tegra_mem_map[bank].size;
+               u64 bank_end = bank_start + bank_size;
+
+               if (end <= bank_start || start > bank_end)
+                       continue;
+               mark_ram_allocated(bank, start, end);
+               break;
+       }
+}
+
+static u64 alloc_ram(u64 size, u64 align, u64 offset)
+{
+       int bank;
+
+       for (bank = 1; bank <= CONFIG_NR_DRAM_BANKS; bank++) {
+               u64 bank_start = tegra_mem_map[bank].virt;
+               u64 bank_size = tegra_mem_map[bank].size;
+               u64 bank_end = bank_start + bank_size;
+               u64 allocated = ROUND(bank_start, align) + offset;
+               u64 allocated_end = allocated + size;
+
+               if (allocated_end > bank_end)
+                       continue;
+               mark_ram_allocated(bank, allocated, allocated_end);
+               return allocated;
+       }
+       return 0;
+}
+
+static void set_calculated_aliases(char *aliases, u64 address)
+{
+       char *tmp, *alias;
+       int err;
+
+       aliases = strdup(aliases);
+       if (!aliases) {
+               pr_err("strdup(aliases) failed");
+               return;
+       }
+
+       tmp = aliases;
+       while (true) {
+               alias = strsep(&tmp, " ");
+               if (!alias)
+                       break;
+               debug("%s: alias: %s\n", __func__, alias);
+               err = env_set_hex(alias, address);
+               if (err)
+                       pr_err("Could not set %s\n", alias);
+       }
+
+       free(aliases);
+}
+
+static void set_calculated_env_var(const char *var)
+{
+       char *var_size;
+       char *var_align;
+       char *var_offset;
+       char *var_aliases;
+       u64 size;
+       u64 align;
+       u64 offset;
+       char *aliases;
+       u64 address;
+       int err;
+
+       var_size = gen_varname(var, "_size");
+       if (!var_size)
+               return;
+       var_align = gen_varname(var, "_align");
+       if (!var_align)
+               goto out_free_var_size;
+       var_offset = gen_varname(var, "_offset");
+       if (!var_offset)
+               goto out_free_var_align;
+       var_aliases = gen_varname(var, "_aliases");
+       if (!var_aliases)
+               goto out_free_var_offset;
+
+       size = env_get_hex(var_size, 0);
+       if (!size) {
+               pr_err("%s not set or zero\n", var_size);
+               goto out_free_var_aliases;
+       }
+       align = env_get_hex(var_align, 1);
+       /* Handle extant variables, but with a value of 0 */
+       if (!align)
+               align = 1;
+       offset = env_get_hex(var_offset, 0);
+       aliases = env_get(var_aliases);
+
+       debug("%s: Calc var %s; size=%llx, align=%llx, offset=%llx\n",
+             __func__, var, size, align, offset);
+       if (aliases)
+               debug("%s: Aliases: %s\n", __func__, aliases);
+
+       address = alloc_ram(size, align, offset);
+       if (!address) {
+               pr_err("Could not allocate %s\n", var);
+               goto out_free_var_aliases;
+       }
+       debug("%s: Address %llx\n", __func__, address);
+
+       err = env_set_hex(var, address);
+       if (err)
+               pr_err("Could not set %s\n", var);
+       if (aliases)
+               set_calculated_aliases(aliases, address);
+
+out_free_var_aliases:
+       free(var_aliases);
+out_free_var_offset:
+       free(var_offset);
+out_free_var_align:
+       free(var_align);
+out_free_var_size:
+       free(var_size);
+}
+
+#ifdef DEBUG
+static void dump_ram_banks(void)
+{
+       int bank;
+
+       for (bank = 1; bank <= CONFIG_NR_DRAM_BANKS; bank++) {
+               u64 bank_start = tegra_mem_map[bank].virt;
+               u64 bank_size = tegra_mem_map[bank].size;
+               u64 bank_end = bank_start + bank_size;
+
+               if (!bank_size)
+                       continue;
+               printf("%d: %010llx..%010llx (+%010llx)\n", bank - 1,
+                      bank_start, bank_end, bank_size);
+       }
+}
+#endif
+
+static void set_calculated_env_vars(void)
+{
+       char *vars, *tmp, *var;
+
+#ifdef DEBUG
+       printf("RAM banks before any calculated env. var.s:\n");
+       dump_ram_banks();
+#endif
+
+       reserve_ram(cboot_boot_x0, fdt_totalsize(cboot_boot_x0));
+
+#ifdef DEBUG
+       printf("RAM after reserving cboot DTB:\n");
+       dump_ram_banks();
+#endif
+
+       vars = env_get("calculated_vars");
+       if (!vars) {
+               debug("%s: No env var calculated_vars\n", __func__);
+               return;
+       }
+
+       vars = strdup(vars);
+       if (!vars) {
+               pr_err("strdup(calculated_vars) failed");
+               return;
+       }
+
+       tmp = vars;
+       while (true) {
+               var = strsep(&tmp, " ");
+               if (!var)
+                       break;
+               debug("%s: var: %s\n", __func__, var);
+               set_calculated_env_var(var);
+#ifdef DEBUG
+               printf("RAM banks after allocating %s:\n", var);
+               dump_ram_banks();
+#endif
+       }
+
+       free(vars);
+}
+
+static int set_fdt_addr(void)
+{
+       int ret;
+
+       ret = env_set_hex("fdt_addr", cboot_boot_x0);
+       if (ret) {
+               printf("Failed to set fdt_addr to point at DTB: %d\n", ret);
+               return ret;
+       }
+
+       return 0;
+}
+
+/*
+ * Attempt to use /chosen/nvidia,ether-mac in the cboot DTB to U-Boot's
+ * ethaddr environment variable if possible.
+ */
+static int cboot_get_ethaddr_legacy(const void *fdt, uint8_t mac[ETH_ALEN])
+{
+       const char *const properties[] = {
+               "nvidia,ethernet-mac",
+               "nvidia,ether-mac",
+       };
+       const char *prop;
+       unsigned int i;
+       int node, len;
+
+       node = fdt_path_offset(fdt, "/chosen");
+       if (node < 0) {
+               printf("Can't find /chosen node in cboot DTB\n");
+               return node;
+       }
+
+       for (i = 0; i < ARRAY_SIZE(properties); i++) {
+               prop = fdt_getprop(fdt, node, properties[i], &len);
+               if (prop)
+                       break;
+       }
+
+       if (!prop) {
+               printf("Can't find Ethernet MAC address in cboot DTB\n");
+               return -ENOENT;
+       }
+
+       eth_parse_enetaddr(prop, mac);
+
+       if (!is_valid_ethaddr(mac)) {
+               printf("Invalid MAC address: %s\n", prop);
+               return -EINVAL;
+       }
+
+       debug("Legacy MAC address: %pM\n", mac);
+
+       return 0;
+}
+
+int cboot_get_ethaddr(const void *fdt, uint8_t mac[ETH_ALEN])
+{
+       int node, len, err = 0;
+       const uchar *prop;
+       const char *path;
+
+       path = fdt_get_alias(fdt, "ethernet");
+       if (!path) {
+               err = -ENOENT;
+               goto out;
+       }
+
+       debug("ethernet alias found: %s\n", path);
+
+       node = fdt_path_offset(fdt, path);
+       if (node < 0) {
+               err = -ENOENT;
+               goto out;
+       }
+
+       prop = fdt_getprop(fdt, node, "local-mac-address", &len);
+       if (!prop) {
+               err = -ENOENT;
+               goto out;
+       }
+
+       if (len != ETH_ALEN) {
+               err = -EINVAL;
+               goto out;
+       }
+
+       debug("MAC address: %pM\n", prop);
+       memcpy(mac, prop, ETH_ALEN);
+
+out:
+       if (err < 0)
+               err = cboot_get_ethaddr_legacy(fdt, mac);
+
+       return err;
+}
+
+static char *strip(const char *ptr)
+{
+       const char *end;
+
+       while (*ptr && isblank(*ptr))
+               ptr++;
+
+       /* empty string */
+       if (*ptr == '\0')
+               return strdup(ptr);
+
+       end = ptr;
+
+       while (end[1])
+               end++;
+
+       while (isblank(*end))
+               end--;
+
+       return strndup(ptr, end - ptr + 1);
+}
+
+static char *cboot_get_bootargs(const void *fdt)
+{
+       const char *args;
+       int offset, len;
+
+       offset = fdt_path_offset(fdt, "/chosen");
+       if (offset < 0)
+               return NULL;
+
+       args = fdt_getprop(fdt, offset, "bootargs", &len);
+       if (!args)
+               return NULL;
+
+       return strip(args);
+}
+
+int cboot_late_init(void)
+{
+       const void *fdt = (const void *)cboot_boot_x0;
+       uint8_t mac[ETH_ALEN];
+       char *bootargs;
+       int err;
+
+       set_calculated_env_vars();
+       /*
+        * Ignore errors here; the value may not be used depending on
+        * extlinux.conf or boot script content.
+        */
+       set_fdt_addr();
+
+       /* Ignore errors here; not all cases care about Ethernet addresses */
+       err = cboot_get_ethaddr(fdt, mac);
+       if (!err) {
+               void *blob = (void *)gd->fdt_blob;
+
+               err = fdtdec_set_ethernet_mac_address(blob, mac, sizeof(mac));
+               if (err < 0)
+                       printf("failed to set MAC address %pM: %d\n", mac, err);
+       }
+
+       bootargs = cboot_get_bootargs(fdt);
+       if (bootargs) {
+               env_set("cbootargs", bootargs);
+               free(bootargs);
+       }
+
+       return 0;
+}
index dc5f16b41b60fa03737829751316a7dc7858b101..e539ad8b30a7bbe532e267cd2eb0679252e04a0c 100644 (file)
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 /*
- * Copyright (c) 2010-2015, NVIDIA CORPORATION.  All rights reserved.
+ * Copyright (c) 2010-2019, NVIDIA CORPORATION.  All rights reserved.
  */
 
 /* Tegra SoC common clock control functions */
@@ -815,11 +815,16 @@ void tegra30_set_up_pllp(void)
 
 int clock_external_output(int clk_id)
 {
-       struct pmc_ctlr *pmc = (struct pmc_ctlr *)NV_PA_PMC_BASE;
+       u32 val;
 
        if (clk_id >= 1 && clk_id <= 3) {
-               setbits_le32(&pmc->pmc_clk_out_cntrl,
-                            1 << (2 + (clk_id - 1) * 8));
+               val = tegra_pmc_readl(offsetof(struct pmc_ctlr,
+                                     pmc_clk_out_cntrl));
+               val |= 1 << (2 + (clk_id - 1) * 8);
+               tegra_pmc_writel(val,
+                                offsetof(struct pmc_ctlr,
+                                pmc_clk_out_cntrl));
+
        } else {
                printf("%s: Unknown output clock id %d\n", __func__, clk_id);
                return -EINVAL;
index 4e6beb3e5bb472b11bf27b11704d91b401b56737..4a889f0e3422fc1261f37bc37c7a52161cc32d26 100644 (file)
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0+
 /*
- * Copyright (c) 2012, NVIDIA CORPORATION.  All rights reserved.
+ * Copyright (c) 2012-2019, NVIDIA CORPORATION. All rights reserved.
  *
  * Derived from code (arch/arm/lib/reset.c) that is:
  *
 static int do_enterrcm(cmd_tbl_t *cmdtp, int flag, int argc,
                       char * const argv[])
 {
-       struct pmc_ctlr *pmc = (struct pmc_ctlr *)NV_PA_PMC_BASE;
-
        puts("Entering RCM...\n");
        udelay(50000);
 
-       pmc->pmc_scratch0 = 2;
+       tegra_pmc_writel(2, PMC_SCRATCH0);
        disable_interrupts();
        reset_cpu(0);
 
index 1b6ad074ed8fcd7fd9a729445bcc4e67081fa3e4..3d140760e68fed6b52a9a45f7e76b6d601c936c5 100644 (file)
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 /*
- * Copyright (c) 2010-2015, NVIDIA CORPORATION.  All rights reserved.
+ * Copyright (c) 2010-2019, NVIDIA CORPORATION.  All rights reserved.
  */
 
 #include <common.h>
@@ -299,21 +299,19 @@ void enable_cpu_clock(int enable)
 
 static int is_cpu_powered(void)
 {
-       struct pmc_ctlr *pmc = (struct pmc_ctlr *)NV_PA_PMC_BASE;
-
-       return (readl(&pmc->pmc_pwrgate_status) & CPU_PWRED) ? 1 : 0;
+       return (tegra_pmc_readl(offsetof(struct pmc_ctlr,
+                               pmc_pwrgate_status)) & CPU_PWRED) ? 1 : 0;
 }
 
 static void remove_cpu_io_clamps(void)
 {
-       struct pmc_ctlr *pmc = (struct pmc_ctlr *)NV_PA_PMC_BASE;
        u32 reg;
        debug("%s entry\n", __func__);
 
        /* Remove the clamps on the CPU I/O signals */
-       reg = readl(&pmc->pmc_remove_clamping);
+       reg = tegra_pmc_readl(offsetof(struct pmc_ctlr, pmc_remove_clamping));
        reg |= CPU_CLMP;
-       writel(reg, &pmc->pmc_remove_clamping);
+       tegra_pmc_writel(reg, offsetof(struct pmc_ctlr, pmc_remove_clamping));
 
        /* Give I/O signals time to stabilize */
        udelay(IO_STABILIZATION_DELAY);
@@ -321,17 +319,19 @@ static void remove_cpu_io_clamps(void)
 
 void powerup_cpu(void)
 {
-       struct pmc_ctlr *pmc = (struct pmc_ctlr *)NV_PA_PMC_BASE;
        u32 reg;
        int timeout = IO_STABILIZATION_DELAY;
        debug("%s entry\n", __func__);
 
        if (!is_cpu_powered()) {
                /* Toggle the CPU power state (OFF -> ON) */
-               reg = readl(&pmc->pmc_pwrgate_toggle);
+               reg = tegra_pmc_readl(offsetof(struct pmc_ctlr,
+                                     pmc_pwrgate_toggle));
                reg &= PARTID_CP;
                reg |= START_CP;
-               writel(reg, &pmc->pmc_pwrgate_toggle);
+               tegra_pmc_writel(reg,
+                                offsetof(struct pmc_ctlr,
+                                pmc_pwrgate_toggle));
 
                /* Wait for the power to come up */
                while (!is_cpu_powered()) {
index 6697909d9a3e2269e877b59711670315f37c29c0..66628933b65398ffa6c60f614e7c269449451828 100644 (file)
@@ -8,10 +8,10 @@
 #include <asm/io.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/emc.h>
-#include <asm/arch/pmu.h>
 #include <asm/arch/tegra.h>
 #include <asm/arch-tegra/ap.h>
 #include <asm/arch-tegra/clk_rst.h>
+#include <asm/arch-tegra/pmu.h>
 #include <asm/arch-tegra/sys_proto.h>
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/arch/arm/mach-tegra/lowlevel_init.S b/arch/arm/mach-tegra/lowlevel_init.S
deleted file mode 100644 (file)
index 626f1b6..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * SoC-specific setup info
- *
- * (C) Copyright 2010,2011
- * NVIDIA Corporation <www.nvidia.com>
- */
-
-#include <config.h>
-#include <linux/linkage.h>
-
-#ifdef CONFIG_ARM64
-       .align  5
-ENTRY(reset_cpu)
-       /* get address for global reset register */
-       ldr     x1, =PRM_RSTCTRL
-       ldr     w3, [x1]
-       /* force reset */
-       orr     w3, w3, #0x10
-       str     w3, [x1]
-       mov     w0, w0
-1:
-       b       1b
-ENDPROC(reset_cpu)
-#else
-       .align  5
-ENTRY(reset_cpu)
-       ldr     r1, rstctl                      @ get addr for global reset
-                                               @ reg
-       ldr     r3, [r1]
-       orr     r3, r3, #0x10
-       str     r3, [r1]                        @ force reset
-       mov     r0, r0
-_loop_forever:
-       b       _loop_forever
-rstctl:
-       .word   PRM_RSTCTRL
-ENDPROC(reset_cpu)
-#endif
diff --git a/arch/arm/mach-tegra/pmc.c b/arch/arm/mach-tegra/pmc.c
new file mode 100644 (file)
index 0000000..afd3c54
--- /dev/null
@@ -0,0 +1,92 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2018-2019, NVIDIA CORPORATION. All rights reserved.
+ */
+
+#include <common.h>
+
+#include <linux/arm-smccc.h>
+
+#include <asm/io.h>
+#include <asm/arch-tegra/pmc.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#if IS_ENABLED(CONFIG_TEGRA_PMC_SECURE)
+static bool tegra_pmc_detect_tz_only(void)
+{
+       static bool initialized = false;
+       static bool is_tz_only = false;
+       u32 value, saved;
+
+       if (!initialized) {
+               saved = readl(NV_PA_PMC_BASE + PMC_SCRATCH0);
+               value = saved ^ 0xffffffff;
+
+               if (value == 0xffffffff)
+                       value = 0xdeadbeef;
+
+               /* write pattern and read it back */
+               writel(value, NV_PA_PMC_BASE + PMC_SCRATCH0);
+               value = readl(NV_PA_PMC_BASE + PMC_SCRATCH0);
+
+               /* if we read all-zeroes, access is restricted to TZ only */
+               if (value == 0) {
+                       debug("access to PMC is restricted to TZ\n");
+                       is_tz_only = true;
+               } else {
+                       /* restore original value */
+                       writel(saved, NV_PA_PMC_BASE + PMC_SCRATCH0);
+               }
+
+               initialized = true;
+       }
+
+       return is_tz_only;
+}
+#endif
+
+uint32_t tegra_pmc_readl(unsigned long offset)
+{
+#if IS_ENABLED(CONFIG_TEGRA_PMC_SECURE)
+       if (tegra_pmc_detect_tz_only()) {
+               struct arm_smccc_res res;
+
+               arm_smccc_smc(TEGRA_SMC_PMC, TEGRA_SMC_PMC_READ, offset, 0, 0,
+                             0, 0, 0, &res);
+               if (res.a0)
+                       printf("%s(): SMC failed: %lu\n", __func__, res.a0);
+
+               return res.a1;
+       }
+#endif
+
+       return readl(NV_PA_PMC_BASE + offset);
+}
+
+void tegra_pmc_writel(u32 value, unsigned long offset)
+{
+#if IS_ENABLED(CONFIG_TEGRA_PMC_SECURE)
+       if (tegra_pmc_detect_tz_only()) {
+               struct arm_smccc_res res;
+
+               arm_smccc_smc(TEGRA_SMC_PMC, TEGRA_SMC_PMC_WRITE, offset,
+                             value, 0, 0, 0, 0, &res);
+               if (res.a0)
+                       printf("%s(): SMC failed: %lu\n", __func__, res.a0);
+
+               return;
+       }
+#endif
+
+       writel(value, NV_PA_PMC_BASE + offset);
+}
+
+void reset_cpu(ulong addr)
+{
+       u32 value;
+
+       value = tegra_pmc_readl(PMC_CNTRL);
+       value |= PMC_CNTRL_MAIN_RST;
+       tegra_pmc_writel(value, PMC_CNTRL);
+}
index e45f0961b242cdd92c344bcd186583dc80131f5b..761c9ef19e3b3abc6481bc42a5f114912bf9758e 100644 (file)
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 /*
- * Copyright (c) 2014, NVIDIA CORPORATION.  All rights reserved.
+ * Copyright (c) 2014-2019, NVIDIA CORPORATION.  All rights reserved.
  */
 
 #include <common.h>
@@ -11,6 +11,7 @@
 
 #include <asm/arch/powergate.h>
 #include <asm/arch/tegra.h>
+#include <asm/arch-tegra/pmc.h>
 
 #define PWRGATE_TOGGLE 0x30
 #define  PWRGATE_TOGGLE_START (1 << 8)
@@ -24,18 +25,18 @@ static int tegra_powergate_set(enum tegra_powergate id, bool state)
        u32 value, mask = state ? (1 << id) : 0, old_mask;
        unsigned long start, timeout = 25;
 
-       value = readl(NV_PA_PMC_BASE + PWRGATE_STATUS);
+       value = tegra_pmc_readl(PWRGATE_STATUS);
        old_mask = value & (1 << id);
 
        if (mask == old_mask)
                return 0;
 
-       writel(PWRGATE_TOGGLE_START | id, NV_PA_PMC_BASE + PWRGATE_TOGGLE);
+       tegra_pmc_writel(PWRGATE_TOGGLE_START | id, PWRGATE_TOGGLE);
 
        start = get_timer(0);
 
        while (get_timer(start) < timeout) {
-               value = readl(NV_PA_PMC_BASE + PWRGATE_STATUS);
+               value = tegra_pmc_readl(PWRGATE_STATUS);
                if ((value & (1 << id)) == mask)
                        return 0;
        }
@@ -69,7 +70,7 @@ static int tegra_powergate_remove_clamping(enum tegra_powergate id)
        else
                value = 1 << id;
 
-       writel(value, NV_PA_PMC_BASE + REMOVE_CLAMPING);
+       tegra_pmc_writel(value, REMOVE_CLAMPING);
 
        return 0;
 }
index 56f3378ecea373b938433e70b47682fd796f8326..3a24050277048c286498d0c075f0d78f4e5941c5 100644 (file)
@@ -2,8 +2,4 @@
 #
 # SPDX-License-Identifier: GPL-2.0
 
-obj-y += ../board186.o
 obj-y += cache.o
-obj-y += nvtboot_board.o
-obj-y += nvtboot_ll.o
-obj-y += nvtboot_mem.o
diff --git a/arch/arm/mach-tegra/tegra186/nvtboot_board.c b/arch/arm/mach-tegra/tegra186/nvtboot_board.c
deleted file mode 100644 (file)
index 83c0e93..0000000
+++ /dev/null
@@ -1,332 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Copyright (c) 2016-2018, NVIDIA CORPORATION.
- */
-
-#include <stdlib.h>
-#include <common.h>
-#include <fdt_support.h>
-#include <fdtdec.h>
-#include <asm/arch/tegra.h>
-#include <asm/armv8/mmu.h>
-
-extern unsigned long nvtboot_boot_x0;
-
-/*
- * The following few functions run late during the boot process and dynamically
- * calculate the load address of various binaries. To keep track of multiple
- * allocations, some writable list of RAM banks must be used. tegra_mem_map[]
- * is used for this purpose to avoid making yet another copy of the list of RAM
- * banks. This is safe because tegra_mem_map[] is only used once during very
- * early boot to create U-Boot's page tables, long before this code runs. If
- * this assumption becomes invalid later, we can just fix the code to copy the
- * list of RAM banks into some private data structure before running.
- */
-
-extern struct mm_region tegra_mem_map[];
-
-static char *gen_varname(const char *var, const char *ext)
-{
-       size_t len_var = strlen(var);
-       size_t len_ext = strlen(ext);
-       size_t len = len_var + len_ext + 1;
-       char *varext = malloc(len);
-
-       if (!varext)
-               return 0;
-       strcpy(varext, var);
-       strcpy(varext + len_var, ext);
-       return varext;
-}
-
-static void mark_ram_allocated(int bank, u64 allocated_start, u64 allocated_end)
-{
-       u64 bank_start = tegra_mem_map[bank].virt;
-       u64 bank_size = tegra_mem_map[bank].size;
-       u64 bank_end = bank_start + bank_size;
-       bool keep_front = allocated_start != bank_start;
-       bool keep_tail = allocated_end != bank_end;
-
-       if (keep_front && keep_tail) {
-               /*
-                * There are CONFIG_NR_DRAM_BANKS DRAM entries in the array,
-                * starting at index 1 (index 0 is MMIO). So, we are at DRAM
-                * entry "bank" not "bank - 1" as for a typical 0-base array.
-                * The number of remaining DRAM entries is therefore
-                * "CONFIG_NR_DRAM_BANKS - bank". We want to duplicate the
-                * current entry and shift up the remaining entries, dropping
-                * the last one. Thus, we must copy one fewer entry than the
-                * number remaining.
-                */
-               memmove(&tegra_mem_map[bank + 1], &tegra_mem_map[bank],
-                       CONFIG_NR_DRAM_BANKS - bank - 1);
-               tegra_mem_map[bank].size = allocated_start - bank_start;
-               bank++;
-               tegra_mem_map[bank].virt = allocated_end;
-               tegra_mem_map[bank].phys = allocated_end;
-               tegra_mem_map[bank].size = bank_end - allocated_end;
-       } else if (keep_front) {
-               tegra_mem_map[bank].size = allocated_start - bank_start;
-       } else if (keep_tail) {
-               tegra_mem_map[bank].virt = allocated_end;
-               tegra_mem_map[bank].phys = allocated_end;
-               tegra_mem_map[bank].size = bank_end - allocated_end;
-       } else {
-               /*
-                * We could move all subsequent banks down in the array but
-                * that's not necessary for subsequent allocations to work, so
-                * we skip doing so.
-                */
-               tegra_mem_map[bank].size = 0;
-       }
-}
-
-static void reserve_ram(u64 start, u64 size)
-{
-       int bank;
-       u64 end = start + size;
-
-       for (bank = 1; bank <= CONFIG_NR_DRAM_BANKS; bank++) {
-               u64 bank_start = tegra_mem_map[bank].virt;
-               u64 bank_size = tegra_mem_map[bank].size;
-               u64 bank_end = bank_start + bank_size;
-
-               if (end <= bank_start || start > bank_end)
-                       continue;
-               mark_ram_allocated(bank, start, end);
-               break;
-       }
-}
-
-static u64 alloc_ram(u64 size, u64 align, u64 offset)
-{
-       int bank;
-
-       for (bank = 1; bank <= CONFIG_NR_DRAM_BANKS; bank++) {
-               u64 bank_start = tegra_mem_map[bank].virt;
-               u64 bank_size = tegra_mem_map[bank].size;
-               u64 bank_end = bank_start + bank_size;
-               u64 allocated = ROUND(bank_start, align) + offset;
-               u64 allocated_end = allocated + size;
-
-               if (allocated_end > bank_end)
-                       continue;
-               mark_ram_allocated(bank, allocated, allocated_end);
-               return allocated;
-       }
-       return 0;
-}
-
-static void set_calculated_aliases(char *aliases, u64 address)
-{
-       char *tmp, *alias;
-       int err;
-
-       aliases = strdup(aliases);
-       if (!aliases) {
-               pr_err("strdup(aliases) failed");
-               return;
-       }
-
-       tmp = aliases;
-       while (true) {
-               alias = strsep(&tmp, " ");
-               if (!alias)
-                       break;
-               debug("%s: alias: %s\n", __func__, alias);
-               err = env_set_hex(alias, address);
-               if (err)
-                       pr_err("Could not set %s\n", alias);
-       }
-
-       free(aliases);
-}
-
-static void set_calculated_env_var(const char *var)
-{
-       char *var_size;
-       char *var_align;
-       char *var_offset;
-       char *var_aliases;
-       u64 size;
-       u64 align;
-       u64 offset;
-       char *aliases;
-       u64 address;
-       int err;
-
-       var_size = gen_varname(var, "_size");
-       if (!var_size)
-               return;
-       var_align = gen_varname(var, "_align");
-       if (!var_align)
-               goto out_free_var_size;
-       var_offset = gen_varname(var, "_offset");
-       if (!var_offset)
-               goto out_free_var_align;
-       var_aliases = gen_varname(var, "_aliases");
-       if (!var_aliases)
-               goto out_free_var_offset;
-
-       size = env_get_hex(var_size, 0);
-       if (!size) {
-               pr_err("%s not set or zero\n", var_size);
-               goto out_free_var_aliases;
-       }
-       align = env_get_hex(var_align, 1);
-       /* Handle extant variables, but with a value of 0 */
-       if (!align)
-               align = 1;
-       offset = env_get_hex(var_offset, 0);
-       aliases = env_get(var_aliases);
-
-       debug("%s: Calc var %s; size=%llx, align=%llx, offset=%llx\n",
-             __func__, var, size, align, offset);
-       if (aliases)
-               debug("%s: Aliases: %s\n", __func__, aliases);
-
-       address = alloc_ram(size, align, offset);
-       if (!address) {
-               pr_err("Could not allocate %s\n", var);
-               goto out_free_var_aliases;
-       }
-       debug("%s: Address %llx\n", __func__, address);
-
-       err = env_set_hex(var, address);
-       if (err)
-               pr_err("Could not set %s\n", var);
-       if (aliases)
-               set_calculated_aliases(aliases, address);
-
-out_free_var_aliases:
-       free(var_aliases);
-out_free_var_offset:
-       free(var_offset);
-out_free_var_align:
-       free(var_align);
-out_free_var_size:
-       free(var_size);
-}
-
-#ifdef DEBUG
-static void dump_ram_banks(void)
-{
-       int bank;
-
-       for (bank = 1; bank <= CONFIG_NR_DRAM_BANKS; bank++) {
-               u64 bank_start = tegra_mem_map[bank].virt;
-               u64 bank_size = tegra_mem_map[bank].size;
-               u64 bank_end = bank_start + bank_size;
-
-               if (!bank_size)
-                       continue;
-               printf("%d: %010llx..%010llx (+%010llx)\n", bank - 1,
-                      bank_start, bank_end, bank_size);
-       }
-}
-#endif
-
-static void set_calculated_env_vars(void)
-{
-       char *vars, *tmp, *var;
-
-#ifdef DEBUG
-       printf("RAM banks before any calculated env. var.s:\n");
-       dump_ram_banks();
-#endif
-
-       reserve_ram(nvtboot_boot_x0, fdt_totalsize(nvtboot_boot_x0));
-
-#ifdef DEBUG
-       printf("RAM after reserving cboot DTB:\n");
-       dump_ram_banks();
-#endif
-
-       vars = env_get("calculated_vars");
-       if (!vars) {
-               debug("%s: No env var calculated_vars\n", __func__);
-               return;
-       }
-
-       vars = strdup(vars);
-       if (!vars) {
-               pr_err("strdup(calculated_vars) failed");
-               return;
-       }
-
-       tmp = vars;
-       while (true) {
-               var = strsep(&tmp, " ");
-               if (!var)
-                       break;
-               debug("%s: var: %s\n", __func__, var);
-               set_calculated_env_var(var);
-#ifdef DEBUG
-               printf("RAM banks affter allocating %s:\n", var);
-               dump_ram_banks();
-#endif
-       }
-
-       free(vars);
-}
-
-static int set_fdt_addr(void)
-{
-       int ret;
-
-       ret = env_set_hex("fdt_addr", nvtboot_boot_x0);
-       if (ret) {
-               printf("Failed to set fdt_addr to point at DTB: %d\n", ret);
-               return ret;
-       }
-
-       return 0;
-}
-
-/*
- * Attempt to use /chosen/nvidia,ether-mac in the nvtboot DTB to U-Boot's
- * ethaddr environment variable if possible.
- */
-static int set_ethaddr_from_nvtboot(void)
-{
-       const void *nvtboot_blob = (void *)nvtboot_boot_x0;
-       int ret, node, len;
-       const u32 *prop;
-
-       /* Already a valid address in the environment? If so, keep it */
-       if (env_get("ethaddr"))
-               return 0;
-
-       node = fdt_path_offset(nvtboot_blob, "/chosen");
-       if (node < 0) {
-               printf("Can't find /chosen node in nvtboot DTB\n");
-               return node;
-       }
-       prop = fdt_getprop(nvtboot_blob, node, "nvidia,ether-mac", &len);
-       if (!prop) {
-               printf("Can't find nvidia,ether-mac property in nvtboot DTB\n");
-               return -ENOENT;
-       }
-
-       ret = env_set("ethaddr", (void *)prop);
-       if (ret) {
-               printf("Failed to set ethaddr from nvtboot DTB: %d\n", ret);
-               return ret;
-       }
-
-       return 0;
-}
-
-int tegra_soc_board_init_late(void)
-{
-       set_calculated_env_vars();
-       /*
-        * Ignore errors here; the value may not be used depending on
-        * extlinux.conf or boot script content.
-        */
-       set_fdt_addr();
-       /* Ignore errors here; not all cases care about Ethernet addresses */
-       set_ethaddr_from_nvtboot();
-
-       return 0;
-}
diff --git a/arch/arm/mach-tegra/tegra186/nvtboot_ll.S b/arch/arm/mach-tegra/tegra186/nvtboot_ll.S
deleted file mode 100644 (file)
index aa7a863..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * Save nvtboot-related boot-time CPU state
- *
- * (C) Copyright 2015-2016 NVIDIA Corporation <www.nvidia.com>
- */
-
-#include <config.h>
-#include <linux/linkage.h>
-
-.align 8
-.globl nvtboot_boot_x0
-nvtboot_boot_x0:
-       .dword 0
-
-ENTRY(save_boot_params)
-       adr     x8, nvtboot_boot_x0
-       str     x0, [x8]
-       b       save_boot_params_ret
-ENDPROC(save_boot_params)
diff --git a/arch/arm/mach-tegra/tegra186/nvtboot_mem.c b/arch/arm/mach-tegra/tegra186/nvtboot_mem.c
deleted file mode 100644 (file)
index 6214282..0000000
+++ /dev/null
@@ -1,172 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Copyright (c) 2016-2018, NVIDIA CORPORATION.
- */
-
-#include <common.h>
-#include <fdt_support.h>
-#include <fdtdec.h>
-#include <linux/sizes.h>
-#include <asm/arch/tegra.h>
-#include <asm/armv8/mmu.h>
-
-/*
- * Size of a region that's large enough to hold the relocated U-Boot and all
- * other allocations made around it (stack, heap, page tables, etc.)
- * In practice, running "bdinfo" at the shell prompt, the stack reaches about
- * 5MB from the address selected for ram_top as of the time of writing,
- * so a 16MB region should be plenty.
- */
-#define MIN_USABLE_RAM_SIZE SZ_16M
-/*
- * The amount of space we expect to require for stack usage. Used to validate
- * that all reservations fit into the region selected for the relocation target
- */
-#define MIN_USABLE_STACK_SIZE SZ_1M
-
-DECLARE_GLOBAL_DATA_PTR;
-
-extern unsigned long nvtboot_boot_x0;
-extern struct mm_region tegra_mem_map[];
-
-/*
- * These variables are written to before relocation, and hence cannot be
- * in.bss, since .bss overlaps the DTB that's appended to the U-Boot binary.
- * The section attribute forces this into .data and avoids this issue. This
- * also has the nice side-effect of the content being valid after relocation.
- */
-
-/* The number of valid entries in ram_banks[] */
-static int ram_bank_count __attribute__((section(".data")));
-
-/*
- * The usable top-of-RAM for U-Boot. This is both:
- * a) Below 4GB to avoid issues with peripherals that use 32-bit addressing.
- * b) At the end of a region that has enough space to hold the relocated U-Boot
- *    and all other allocations made around it (stack, heap, page tables, etc.)
- */
-static u64 ram_top __attribute__((section(".data")));
-/* The base address of the region of RAM that ends at ram_top */
-static u64 region_base __attribute__((section(".data")));
-
-int dram_init(void)
-{
-       unsigned int na, ns;
-       const void *nvtboot_blob = (void *)nvtboot_boot_x0;
-       int node, len, i;
-       const u32 *prop;
-
-       na = fdtdec_get_uint(nvtboot_blob, 0, "#address-cells", 2);
-       ns = fdtdec_get_uint(nvtboot_blob, 0, "#size-cells", 2);
-
-       node = fdt_path_offset(nvtboot_blob, "/memory");
-       if (node < 0) {
-               pr_err("Can't find /memory node in nvtboot DTB");
-               hang();
-       }
-       prop = fdt_getprop(nvtboot_blob, node, "reg", &len);
-       if (!prop) {
-               pr_err("Can't find /memory/reg property in nvtboot DTB");
-               hang();
-       }
-
-       /* Calculate the true # of base/size pairs to read */
-       len /= 4;               /* Convert bytes to number of cells */
-       len /= (na + ns);       /* Convert cells to number of banks */
-       if (len > CONFIG_NR_DRAM_BANKS)
-               len = CONFIG_NR_DRAM_BANKS;
-
-       /* Parse the /memory node, and save useful entries */
-       gd->ram_size = 0;
-       ram_bank_count = 0;
-       for (i = 0; i < len; i++) {
-               u64 bank_start, bank_end, bank_size, usable_bank_size;
-
-               /* Extract raw memory region data from DTB */
-               bank_start = fdt_read_number(prop, na);
-               prop += na;
-               bank_size = fdt_read_number(prop, ns);
-               prop += ns;
-               gd->ram_size += bank_size;
-               bank_end = bank_start + bank_size;
-               debug("Bank %d: %llx..%llx (+%llx)\n", i,
-                     bank_start, bank_end, bank_size);
-
-               /*
-                * Align the bank to MMU section size. This is not strictly
-                * necessary, since the translation table construction code
-                * handles page granularity without issue. However, aligning
-                * the MMU entries reduces the size and number of levels in the
-                * page table, so is worth it.
-                */
-               bank_start = ROUND(bank_start, SZ_2M);
-               bank_end = bank_end & ~(SZ_2M - 1);
-               bank_size = bank_end - bank_start;
-               debug("  aligned: %llx..%llx (+%llx)\n",
-                     bank_start, bank_end, bank_size);
-               if (bank_end <= bank_start)
-                       continue;
-
-               /* Record data used to create MMU translation tables */
-               ram_bank_count++;
-               /* Index below is deliberately 1-based to skip MMIO entry */
-               tegra_mem_map[ram_bank_count].virt = bank_start;
-               tegra_mem_map[ram_bank_count].phys = bank_start;
-               tegra_mem_map[ram_bank_count].size = bank_size;
-               tegra_mem_map[ram_bank_count].attrs =
-                       PTE_BLOCK_MEMTYPE(MT_NORMAL) | PTE_BLOCK_INNER_SHARE;
-
-               /* Determine best bank to relocate U-Boot into */
-               if (bank_end > SZ_4G)
-                       bank_end = SZ_4G;
-               debug("  end  %llx (usable)\n", bank_end);
-               usable_bank_size = bank_end - bank_start;
-               debug("  size %llx (usable)\n", usable_bank_size);
-               if ((usable_bank_size >= MIN_USABLE_RAM_SIZE) &&
-                   (bank_end > ram_top)) {
-                       ram_top = bank_end;
-                       region_base = bank_start;
-                       debug("ram top now %llx\n", ram_top);
-               }
-       }
-
-       /* Ensure memory map contains the desired sentinel entry */
-       tegra_mem_map[ram_bank_count + 1].virt = 0;
-       tegra_mem_map[ram_bank_count + 1].phys = 0;
-       tegra_mem_map[ram_bank_count + 1].size = 0;
-       tegra_mem_map[ram_bank_count + 1].attrs = 0;
-
-       /* Error out if a relocation target couldn't be found */
-       if (!ram_top) {
-               pr_err("Can't find a usable RAM top");
-               hang();
-       }
-
-       return 0;
-}
-
-int dram_init_banksize(void)
-{
-       int i;
-
-       if ((gd->start_addr_sp - region_base) < MIN_USABLE_STACK_SIZE) {
-               pr_err("Reservations exceed chosen region size");
-               hang();
-       }
-
-       for (i = 0; i < ram_bank_count; i++) {
-               gd->bd->bi_dram[i].start = tegra_mem_map[1 + i].virt;
-               gd->bd->bi_dram[i].size = tegra_mem_map[1 + i].size;
-       }
-
-#ifdef CONFIG_PCI
-       gd->pci_ram_top = ram_top;
-#endif
-
-       return 0;
-}
-
-ulong board_get_usable_ram_top(ulong total_size)
-{
-       return ram_top;
-}
index 06068c4b7b8d4406249b645138d59d5380b1d248..b240860f08cf30e8c74dbdcf0f16dd701dc1978b 100644 (file)
@@ -40,7 +40,7 @@ enum clock_type_id {
        CLOCK_TYPE_PDCT,
        CLOCK_TYPE_ACPT,
        CLOCK_TYPE_ASPTE,
-       CLOCK_TYPE_PMDACD2T,
+       CLOCK_TYPE_PDD2T,
        CLOCK_TYPE_PCST,
        CLOCK_TYPE_DP,
 
@@ -97,8 +97,8 @@ static enum clock_id clock_source[CLOCK_TYPE_COUNT][CLOCK_MAX_MUX+1] = {
        { CLK(AUDIO),   CLK(SFROM32KHZ),        CLK(PERIPH),    CLK(OSC),
                CLK(EPCI),      CLK(NONE),      CLK(NONE),      CLK(NONE),
                MASK_BITS_31_29},
-       { CLK(PERIPH),  CLK(MEMORY),    CLK(DISPLAY),   CLK(AUDIO),
-               CLK(CGENERAL),  CLK(DISPLAY2),  CLK(OSC),       CLK(NONE),
+       { CLK(PERIPH),  CLK(NONE),      CLK(DISPLAY),   CLK(NONE),
+               CLK(NONE),      CLK(DISPLAY2),  CLK(OSC),       CLK(NONE),
                MASK_BITS_31_29},
        { CLK(PERIPH),  CLK(CGENERAL),  CLK(SFROM32KHZ),        CLK(OSC),
                CLK(NONE),      CLK(NONE),      CLK(NONE),      CLK(NONE),
@@ -174,8 +174,8 @@ static enum clock_type_id clock_periph_type[PERIPHC_COUNT] = {
        TYPE(PERIPHC_0bh,       CLOCK_TYPE_NONE),
        TYPE(PERIPHC_0ch,       CLOCK_TYPE_NONE),
        TYPE(PERIPHC_SBC1,      CLOCK_TYPE_PC2CC3M_T),
-       TYPE(PERIPHC_DISP1,     CLOCK_TYPE_PMDACD2T),
-       TYPE(PERIPHC_DISP2,     CLOCK_TYPE_PMDACD2T),
+       TYPE(PERIPHC_DISP1,     CLOCK_TYPE_PDD2T),
+       TYPE(PERIPHC_DISP2,     CLOCK_TYPE_PDD2T),
 
        /* 0x10 */
        TYPE(PERIPHC_10h,       CLOCK_TYPE_NONE),
@@ -1265,7 +1265,6 @@ struct periph_clk_init periph_clk_init_table[] = {
        { PERIPH_ID_SBC5, CLOCK_ID_PERIPH },
        { PERIPH_ID_SBC6, CLOCK_ID_PERIPH },
        { PERIPH_ID_HOST1X, CLOCK_ID_PERIPH },
-       { PERIPH_ID_DISP1, CLOCK_ID_CGENERAL },
        { PERIPH_ID_SDMMC1, CLOCK_ID_PERIPH },
        { PERIPH_ID_SDMMC2, CLOCK_ID_PERIPH },
        { PERIPH_ID_SDMMC3, CLOCK_ID_PERIPH },
index 0d04d91ad49517f10962180105a0009ccfe41d4a..8cfc7d0faaac1a98a00ac9e1b364f4016a05afaf 100644 (file)
@@ -11,6 +11,9 @@ choice
 config TARGET_AX25_AE350
        bool "Support ax25-ae350"
 
+config TARGET_MICROCHIP_ICICLE
+       bool "Support Microchip PolarFire-SoC Icicle Board"
+
 config TARGET_QEMU_VIRT
        bool "Support QEMU Virt Board"
 
@@ -48,6 +51,7 @@ config SPL_SYS_DCACHE_OFF
 # board-specific options below
 source "board/AndesTech/ax25-ae350/Kconfig"
 source "board/emulation/qemu-riscv/Kconfig"
+source "board/microchip/mpfs_icicle/Kconfig"
 source "board/sifive/fu540/Kconfig"
 
 # platform-specific options below
index 190f141091f2369dcb6ccca1efd0dd781dcd1916..c8cc73ab1417167499c7be1f4ece82e618efbe72 100644 (file)
@@ -64,6 +64,7 @@ static int resetc_init(void)
                return -1;
        }
 
+       resetc.is_psoc = 1;
        rc = dm_i2c_probe(i2cbus,
                          RSTCTRL_ADDR_PSOC, 0, &resetc.i2cdev);
        if (rc) {
index 807cfcdb196f631e6d4b86ed5e4c901e15069ace..1593e2bd4ea33936bc98d8d1afa1b8fe3eb99053 100644 (file)
@@ -73,6 +73,36 @@ int misc_init_r(void)
 /* SPL */
 #ifdef CONFIG_SPL_BUILD
 
+/* must set PB25 low to enable the CAN transceivers */
+static void board_can_stdby_dis(void)
+{
+       atmel_pio4_set_pio_output(AT91_PIO_PORTB, 25, 0);
+}
+
+static void board_leds_init(void)
+{
+       atmel_pio4_set_pio_output(AT91_PIO_PORTB, 0, 0); /* RED */
+       atmel_pio4_set_pio_output(AT91_PIO_PORTB, 1, 1); /* GREEN */
+       atmel_pio4_set_pio_output(AT91_PIO_PORTA, 31, 0); /* BLUE */
+}
+
+/* deassert reset lines for external periph in case of warm reboot */
+static void board_reset_additional_periph(void)
+{
+       atmel_pio4_set_pio_output(AT91_PIO_PORTB, 16, 0); /* LAN9252_RST */
+       atmel_pio4_set_pio_output(AT91_PIO_PORTC, 2, 0); /* HSIC_RST */
+       atmel_pio4_set_pio_output(AT91_PIO_PORTC, 17, 0); /* USB2534_RST */
+       atmel_pio4_set_pio_output(AT91_PIO_PORTD, 4, 0); /* KSZ8563_RST */
+}
+
+static void board_start_additional_periph(void)
+{
+       atmel_pio4_set_pio_output(AT91_PIO_PORTB, 16, 1); /* LAN9252_RST */
+       atmel_pio4_set_pio_output(AT91_PIO_PORTC, 2, 1); /* HSIC_RST */
+       atmel_pio4_set_pio_output(AT91_PIO_PORTC, 17, 1); /* USB2534_RST */
+       atmel_pio4_set_pio_output(AT91_PIO_PORTD, 4, 1); /* KSZ8563_RST */
+}
+
 #ifdef CONFIG_SD_BOOT
 void spl_mmc_init(void)
 {
@@ -93,12 +123,20 @@ void spl_board_init(void)
 #ifdef CONFIG_SD_BOOT
        spl_mmc_init();
 #endif
+       board_reset_additional_periph();
+       board_can_stdby_dis();
+       board_leds_init();
 }
 
 void spl_display_print(void)
 {
 }
 
+void spl_board_prepare_for_boot(void)
+{
+       board_start_additional_periph();
+}
+
 static void ddrc_conf(struct atmel_mpddrc_config *ddrc)
 {
        ddrc->md = (ATMEL_MPDDRC_MD_DBW_32_BITS | ATMEL_MPDDRC_MD_DDR3_SDRAM);
index 1bc26828bfa207fd28908766d57b8bfac4fa36ae..a90b7a353833c02d20d1de8728a6cb1455cdf896 100644 (file)
@@ -62,7 +62,7 @@ static int get_mac_addr(u8 *addr)
                return -1;
        }
 
-       ret = spi_flash_read(flash, (CFG_MAC_ADDR_OFFSET) + 1, 7, addr);
+       ret = spi_flash_read(flash, (CFG_MAC_ADDR_OFFSET), 6, addr);
        if (ret) {
                printf("Error - unable to read MAC address from SPI flash.\n");
                return -1;
index 2c2f885d43e4536a0280833f37c5d047b11490a6..fe1bf4410145b98da241300f6d45019247729e09 100644 (file)
@@ -353,7 +353,7 @@ int misc_init_r(void)
        return 0;
 }
 
-#ifndef CONFIG_DM_MMC
+#if !CONFIG_IS_ENABLED(DM_MMC)
 #ifdef CONFIG_MMC_DAVINCI
 static struct davinci_mmc mmc_sd0 = {
        .reg_base = (struct davinci_mmc_regs *)DAVINCI_MMC_SD0_BASE,
index 20ea6dc59b740fb5abab42667ee42e01959cabee..7f9a74dd48e384f0908a599d4ffed12dec1b433a 100644 (file)
@@ -36,5 +36,11 @@ config BOARD_SPECIFIC_OPTIONS # dummy
        imply OF_BOARD_SETUP
        imply SIFIVE_SERIAL
        imply SMP
+       imply PCI
+       imply DM_PCI
+       imply PCIE_ECAM_GENERIC
+       imply CMD_PCI
+       imply E1000
+       imply NVME
 
 endif
index 63b06517ac3e1e1c98499597683a6e6f74b34246..94e0d572e22cfffc706fbcd8b0c513c32a0cbb8e 100644 (file)
@@ -1,5 +1,5 @@
 KM83XX BOARD
-M:     Holger Brunck <holger.brunck@keymile.com>
+M:     Holger Brunck <holger.brunck@ch.abb.com>
 S:     Maintained
 F:     board/keymile/km83xx/
 F:     include/configs/km8360.h
index 079c8036772b102552d1c2c11dd3ccbf7878f01d..d156e8574bd0ef3516c6178133bacccb787f3c0e 100644 (file)
@@ -1,5 +1,5 @@
 KM_ARM BOARD
-M:     Valentin Longchamp <valentin.longchamp@keymile.com>
+M:     Valentin Longchamp <valentin.longchamp@ch.abb.com>
 S:     Maintained
 F:     board/keymile/km_arm/
 F:     include/configs/km_kirkwood.h
index 93b6bad0a8b72c7d559042b923ae553a8f714d24..c5170c97e710141de2147a5610392841eec0e2f6 100644 (file)
@@ -1,5 +1,5 @@
 KMP204X BOARD
-M:     Valentin Longchamp <valentin.longchamp@keymile.com>
+M:     Valentin Longchamp <valentin.longchamp@ch.abb.com>
 S:     Maintained
 F:     board/keymile/kmp204x/
 F:     include/configs/kmp204x.h
diff --git a/board/microchip/mpfs_icicle/Kconfig b/board/microchip/mpfs_icicle/Kconfig
new file mode 100644 (file)
index 0000000..bf8e1a1
--- /dev/null
@@ -0,0 +1,26 @@
+if TARGET_MICROCHIP_ICICLE
+
+config SYS_BOARD
+       default "mpfs_icicle"
+
+config SYS_VENDOR
+       default "microchip"
+
+config SYS_CPU
+       default "generic"
+
+config SYS_CONFIG_NAME
+       default "microchip_mpfs_icicle"
+
+config SYS_TEXT_BASE
+       default 0x80000000 if !RISCV_SMODE
+       default 0x80200000 if RISCV_SMODE
+
+config BOARD_SPECIFIC_OPTIONS # dummy
+       def_bool y
+       select GENERIC_RISCV
+       select BOARD_EARLY_INIT_F
+       imply SMP
+       imply SYS_NS16550
+
+endif
diff --git a/board/microchip/mpfs_icicle/MAINTAINERS b/board/microchip/mpfs_icicle/MAINTAINERS
new file mode 100644 (file)
index 0000000..22f3b97
--- /dev/null
@@ -0,0 +1,7 @@
+Microchip MPFS icicle
+M:     Padmarao Begari <padmarao.begari@microchip.com>
+M:     Cyril Jean <cyril.jean@microchip.com>
+S:     Maintained
+F:     board/microchip/mpfs_icicle/
+F:     include/configs/microchip_mpfs_icicle.h
+F:     configs/microchip_mpfs_icicle_defconfig
diff --git a/board/microchip/mpfs_icicle/Makefile b/board/microchip/mpfs_icicle/Makefile
new file mode 100644 (file)
index 0000000..72b0410
--- /dev/null
@@ -0,0 +1,7 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright (C) 2019 Microchip Technology Inc.
+# Padmarao Begari <padmarao.begari@microchip.com>
+#
+
+obj-y  += mpfs_icicle.o
diff --git a/board/microchip/mpfs_icicle/mpfs_icicle.c b/board/microchip/mpfs_icicle/mpfs_icicle.c
new file mode 100644 (file)
index 0000000..0ef2431
--- /dev/null
@@ -0,0 +1,30 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2019 Microchip Technology Inc.
+ * Padmarao Begari <padmarao.begari@microchip.com>
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <asm/io.h>
+
+#define MPFS_SYSREG_SOFT_RESET ((unsigned int *)0x20002088)
+
+int board_init(void)
+{
+       /* For now nothing to do here. */
+
+       return 0;
+}
+
+int board_early_init_f(void)
+{
+       unsigned int val;
+
+       /* Reset uart peripheral */
+       val = readl(MPFS_SYSREG_SOFT_RESET);
+       val = (val & ~(1u << 5u));
+       writel(val, MPFS_SYSREG_SOFT_RESET);
+
+       return 0;
+}
index 212037da5ac03ccd32e51b9380080213220605db..4985302d6bc2129c74b2074e3a1d3428f6436e97 100644 (file)
@@ -5,9 +5,13 @@
  */
 
 #include <common.h>
+#include <environment.h>
+#include <fdtdec.h>
 #include <i2c.h>
+#include <linux/libfdt.h>
 #include <asm/arch/gpio.h>
 #include <asm/arch/pinmux.h>
+#include <asm/arch-tegra/cboot.h>
 #include "../p2571/max77620_init.h"
 #include "pinmux-config-p2371-2180.h"
 
@@ -94,3 +98,96 @@ int tegra_pcie_board_init(void)
        return 0;
 }
 #endif /* PCI */
+
+static void ft_mac_address_setup(void *fdt)
+{
+       const void *cboot_fdt = (const void *)cboot_boot_x0;
+       uint8_t mac[ETH_ALEN], local_mac[ETH_ALEN];
+       const char *path;
+       int offset, err;
+
+       err = cboot_get_ethaddr(cboot_fdt, local_mac);
+       if (err < 0)
+               memset(local_mac, 0, ETH_ALEN);
+
+       path = fdt_get_alias(fdt, "ethernet");
+       if (!path)
+               return;
+
+       debug("ethernet alias found: %s\n", path);
+
+       offset = fdt_path_offset(fdt, path);
+       if (offset < 0) {
+               printf("ethernet alias points to absent node %s\n", path);
+               return;
+       }
+
+       if (is_valid_ethaddr(local_mac)) {
+               err = fdt_setprop(fdt, offset, "local-mac-address", local_mac,
+                                 ETH_ALEN);
+               if (!err)
+                       debug("Local MAC address set: %pM\n", local_mac);
+       }
+
+       if (eth_env_get_enetaddr("ethaddr", mac)) {
+               if (memcmp(local_mac, mac, ETH_ALEN) != 0) {
+                       err = fdt_setprop(fdt, offset, "mac-address", mac,
+                                         ETH_ALEN);
+                       if (!err)
+                               debug("MAC address set: %pM\n", mac);
+               }
+       }
+}
+
+static int ft_copy_carveout(void *dst, const void *src, const char *node)
+{
+       struct fdt_memory fb;
+       int err;
+
+       err = fdtdec_get_carveout(src, node, "memory-region", 0, &fb);
+       if (err < 0) {
+               if (err != -FDT_ERR_NOTFOUND)
+                       printf("failed to get carveout for %s: %d\n", node,
+                              err);
+
+               return err;
+       }
+
+       err = fdtdec_set_carveout(dst, node, "memory-region", 0, "framebuffer",
+                                 &fb);
+       if (err < 0) {
+               printf("failed to set carveout for %s: %d\n", node, err);
+               return err;
+       }
+
+       return 0;
+}
+
+static void ft_carveout_setup(void *fdt)
+{
+       const void *cboot_fdt = (const void *)cboot_boot_x0;
+       static const char * const nodes[] = {
+               "/host1x@50000000/dc@54200000",
+               "/host1x@50000000/dc@54240000",
+       };
+       unsigned int i;
+       int err;
+
+       for (i = 0; i < ARRAY_SIZE(nodes); i++) {
+               err = ft_copy_carveout(fdt, cboot_fdt, nodes[i]);
+               if (err < 0) {
+                       if (err != -FDT_ERR_NOTFOUND)
+                               printf("failed to copy carveout for %s: %d\n",
+                                      nodes[i], err);
+                       continue;
+               }
+       }
+}
+
+int ft_board_setup(void *fdt, bd_t *bd)
+{
+       ft_mac_address_setup(fdt);
+       ft_carveout_setup(fdt);
+
+       return 0;
+}
index 496e8a02111e9a91c17f7c7026cdd8a6b6c4b5e2..d294c7ae01367ccb982e0b15dbe91dfa3b2284c3 100644 (file)
@@ -4,10 +4,14 @@
  */
 
 #include <common.h>
+#include <environment.h>
+#include <fdtdec.h>
 #include <i2c.h>
+#include <linux/libfdt.h>
+#include <asm/arch-tegra/cboot.h>
 #include "../p2571/max77620_init.h"
 
-int tegra_board_init(void)
+void pin_mux_mmc(void)
 {
        struct udevice *dev;
        uchar val;
@@ -18,19 +22,18 @@ int tegra_board_init(void)
        ret = i2c_get_chip_for_busnum(0, MAX77620_I2C_ADDR_7BIT, 1, &dev);
        if (ret) {
                printf("%s: Cannot find MAX77620 I2C chip\n", __func__);
-               return ret;
+               return;
        }
        /* 0xF2 for 3.3v, enabled: bit7:6 = 11 = enable, bit5:0 = voltage */
        val = 0xF2;
        ret = dm_i2c_write(dev, MAX77620_CNFG1_L3_REG, &val, 1);
        if (ret) {
                printf("i2c_write 0 0x3c 0x27 failed: %d\n", ret);
-               return ret;
+               return;
        }
-
-       return 0;
 }
 
+#ifdef CONFIG_PCI_TEGRA
 int tegra_pcie_board_init(void)
 {
        struct udevice *dev;
@@ -52,3 +55,101 @@ int tegra_pcie_board_init(void)
 
        return 0;
 }
+#endif
+
+static void ft_mac_address_setup(void *fdt)
+{
+       const void *cboot_fdt = (const void *)cboot_boot_x0;
+       uint8_t mac[ETH_ALEN], local_mac[ETH_ALEN];
+       const char *path;
+       int offset, err;
+
+       err = cboot_get_ethaddr(cboot_fdt, local_mac);
+       if (err < 0)
+               memset(local_mac, 0, ETH_ALEN);
+
+       path = fdt_get_alias(fdt, "ethernet");
+       if (!path)
+               return;
+
+       debug("ethernet alias found: %s\n", path);
+
+       offset = fdt_path_offset(fdt, path);
+       if (offset < 0) {
+               printf("ethernet alias points to absent node %s\n", path);
+               return;
+       }
+
+       if (is_valid_ethaddr(local_mac)) {
+               err = fdt_setprop(fdt, offset, "local-mac-address", local_mac,
+                                 ETH_ALEN);
+               if (!err)
+                       debug("Local MAC address set: %pM\n", local_mac);
+       }
+
+       if (eth_env_get_enetaddr("ethaddr", mac)) {
+               if (memcmp(local_mac, mac, ETH_ALEN) != 0) {
+                       err = fdt_setprop(fdt, offset, "mac-address", mac,
+                                         ETH_ALEN);
+                       if (!err)
+                               debug("MAC address set: %pM\n", mac);
+               }
+       }
+}
+
+static int ft_copy_carveout(void *dst, const void *src, const char *node)
+{
+       struct fdt_memory fb;
+       int err;
+
+       err = fdtdec_get_carveout(src, node, "memory-region", 0, &fb);
+       if (err < 0) {
+               if (err != -FDT_ERR_NOTFOUND)
+                       printf("failed to get carveout for %s: %d\n", node,
+                              err);
+
+               return err;
+       }
+
+       err = fdtdec_set_carveout(dst, node, "memory-region", 0, "framebuffer",
+                                 &fb);
+       if (err < 0) {
+               printf("failed to set carveout for %s: %d\n", node, err);
+               return err;
+       }
+
+       return 0;
+}
+
+static void ft_carveout_setup(void *fdt)
+{
+       const void *cboot_fdt = (const void *)cboot_boot_x0;
+       static const char * const nodes[] = {
+               "/host1x@13e00000/display-hub@15200000/display@15200000",
+               "/host1x@13e00000/display-hub@15200000/display@15210000",
+               "/host1x@13e00000/display-hub@15200000/display@15220000",
+       };
+       unsigned int i;
+       int err;
+
+       for (i = 0; i < ARRAY_SIZE(nodes); i++) {
+               printf("copying carveout for %s...\n", nodes[i]);
+
+               err = ft_copy_carveout(fdt, cboot_fdt, nodes[i]);
+               if (err < 0) {
+                       if (err != -FDT_ERR_NOTFOUND)
+                               printf("failed to copy carveout for %s: %d\n",
+                                      nodes[i], err);
+
+                       continue;
+               }
+       }
+}
+
+int ft_board_setup(void *fdt, bd_t *bd)
+{
+       ft_mac_address_setup(fdt);
+       ft_carveout_setup(fdt);
+
+       return 0;
+}
index 37a599768b1054ceea478656db38c4fee00ff133..6e1ede393398307b1f4f90aae8040c0442db29bd 100644 (file)
@@ -93,6 +93,10 @@ static struct module_pin_mux mmc0_pin_mux_sk_evm[] = {
 };
 
 static struct module_pin_mux mmc1_pin_mux[] = {
+       {OFFSET(gpmc_ad7), (MODE(1) | RXACTIVE | PULLUP_EN)},   /* MMC1_DAT7 */
+       {OFFSET(gpmc_ad6), (MODE(1) | RXACTIVE | PULLUP_EN)},   /* MMC1_DAT6 */
+       {OFFSET(gpmc_ad5), (MODE(1) | RXACTIVE | PULLUP_EN)},   /* MMC1_DAT5 */
+       {OFFSET(gpmc_ad4), (MODE(1) | RXACTIVE | PULLUP_EN)},   /* MMC1_DAT4 */
        {OFFSET(gpmc_ad3), (MODE(1) | RXACTIVE | PULLUP_EN)},   /* MMC1_DAT3 */
        {OFFSET(gpmc_ad2), (MODE(1) | RXACTIVE | PULLUP_EN)},   /* MMC1_DAT2 */
        {OFFSET(gpmc_ad1), (MODE(1) | RXACTIVE | PULLUP_EN)},   /* MMC1_DAT1 */
index c4ac9dd634e2628fe19472a47fd435d0114fae7a..e6572262545557ac02b3d0ad3555f11a93a436b0 100644 (file)
@@ -558,6 +558,7 @@ static int do_efi_boot_add(cmd_tbl_t *cmdtp, int flag,
        }
 
        ret = EFI_CALL(RT->set_variable(var_name16, &guid,
+                                       EFI_VARIABLE_NON_VOLATILE |
                                        EFI_VARIABLE_BOOTSERVICE_ACCESS |
                                        EFI_VARIABLE_RUNTIME_ACCESS,
                                        size, data));
@@ -909,6 +910,7 @@ static int do_efi_boot_next(cmd_tbl_t *cmdtp, int flag,
        guid = efi_global_variable_guid;
        size = sizeof(u16);
        ret = EFI_CALL(RT->set_variable(L"BootNext", &guid,
+                                       EFI_VARIABLE_NON_VOLATILE |
                                        EFI_VARIABLE_BOOTSERVICE_ACCESS |
                                        EFI_VARIABLE_RUNTIME_ACCESS,
                                        size, &bootnext));
@@ -964,6 +966,7 @@ static int do_efi_boot_order(cmd_tbl_t *cmdtp, int flag,
 
        guid = efi_global_variable_guid;
        ret = EFI_CALL(RT->set_variable(L"BootOrder", &guid,
+                                       EFI_VARIABLE_NON_VOLATILE |
                                        EFI_VARIABLE_BOOTSERVICE_ACCESS |
                                        EFI_VARIABLE_RUNTIME_ACCESS,
                                        size, bootorder));
index fc07ca95a3153e36faa5d3ff7f385440789880f1..403abbc6bcf2666f96b0a28ee2a785d8dfda8545 100644 (file)
--- a/cmd/led.c
+++ b/cmd/led.c
@@ -85,7 +85,7 @@ int do_led(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
        if (argc < 2)
                return CMD_RET_USAGE;
        led_label = argv[1];
-       if (*led_label == 'l')
+       if (strncmp(led_label, "list", 4) == 0)
                return list_leds();
 
        cmd = argc > 2 ? get_led_cmd(argv[2]) : LEDST_COUNT;
@@ -137,6 +137,6 @@ U_BOOT_CMD(
        led, 4, 1, do_led,
        "manage LEDs",
        "<led_label> on|off|toggle" BLINK "\tChange LED state\n"
-       "led [<led_label>\tGet LED state\n"
+       "led [<led_label>]\tGet LED state\n"
        "led list\t\tshow a list of LEDs"
 );
index 24a6cf7824ad2816b723d33a3a24537564b2bc77..52c242b4f62277e8bff19a9536d32179b949f08e 100644 (file)
@@ -1344,8 +1344,9 @@ U_BOOT_CMD_COMPLETE(
        setenv, CONFIG_SYS_MAXARGS, 0,  do_env_set,
        "set environment variables",
 #if defined(CONFIG_CMD_NVEDIT_EFI)
-       "-e name [value ...]\n"
+       "-e [-nv] name [value ...]\n"
        "    - set UEFI variable 'name' to 'value' ...'\n"
+       "      'nv' option makes the variable non-volatile\n"
        "    - delete UEFI variable 'name' if 'value' not specified\n"
 #endif
        "setenv [-f] name value ...\n"
index ff8eaa1aad2df4c2b23678daee3f52017e44b38d..60a8ac84c8113a5e51a04ca312a17f52354b9dc5 100644 (file)
@@ -349,6 +349,7 @@ int do_env_set_efi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
        u16 *var_name16 = NULL, *p;
        size_t len;
        efi_guid_t guid;
+       u32 attributes;
        efi_status_t ret;
 
        if (argc == 1)
@@ -362,6 +363,16 @@ int do_env_set_efi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                return CMD_RET_FAILURE;
        }
 
+       attributes = EFI_VARIABLE_BOOTSERVICE_ACCESS |
+                    EFI_VARIABLE_RUNTIME_ACCESS;
+       if (!strcmp(argv[1], "-nv")) {
+               attributes |= EFI_VARIABLE_NON_VOLATILE;
+               argc--;
+               argv++;
+               if (argc == 1)
+                       return CMD_RET_SUCCESS;
+       }
+
        var_name = argv[1];
        if (argc == 2) {
                /* delete */
@@ -391,9 +402,7 @@ int do_env_set_efi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
        utf8_utf16_strncpy(&p, var_name, len + 1);
 
        guid = efi_global_variable_guid;
-       ret = EFI_CALL(efi_set_variable(var_name16, &guid,
-                                       EFI_VARIABLE_BOOTSERVICE_ACCESS |
-                                       EFI_VARIABLE_RUNTIME_ACCESS,
+       ret = EFI_CALL(efi_set_variable(var_name16, &guid, attributes,
                                        size, value));
        if (ret == EFI_SUCCESS) {
                ret = CMD_RET_SUCCESS;
index c7cd34449a525fc0bec0300e589023c3460b476b..9b9e788eb3f86239afd9236f0d7707e30cd2ffd5 100644 (file)
@@ -25,6 +25,42 @@ config SPL_FRAMEWORK
          supports MMC, NAND and YMODEM and other methods loading of U-Boot
          and the Linux Kernel.  If unsure, say Y.
 
+config SPL_SIZE_LIMIT
+       int "Maximum size of SPL image"
+       depends on SPL
+       default 0
+       help
+         Specifies the maximum length of the U-Boot SPL image.
+         If this value is zero, it is ignored.
+
+config SPL_SIZE_LIMIT_SUBTRACT_GD
+       bool "SPL image size check: provide space for global data"
+       depends on SPL_SIZE_LIMIT > 0
+       help
+         If enabled, aligned size of global data is reserved in
+         SPL_SIZE_LIMIT check to ensure such an image does not overflow SRAM
+         if SPL_SIZE_LIMIT describes the size of SRAM available for SPL when
+         pre-reloc global data is put into this SRAM, too.
+
+config SPL_SIZE_LIMIT_SUBTRACT_MALLOC
+       bool "SPL image size check: provide space for malloc() pool before relocation"
+       depends on SPL_SIZE_LIMIT > 0
+       help
+         If enabled, SPL_SYS_MALLOC_F_LEN is reserved in SPL_SIZE_LIMIT check
+         to ensure such an image does not overflow SRAM if SPL_SIZE_LIMIT
+         describes the size of SRAM available for SPL when pre-reloc malloc
+         pool is put into this SRAM, too.
+
+config SPL_SIZE_LIMIT_PROVIDE_STACK
+       hex "SPL image size check: provide stack space before relocation"
+       depends on SPL_SIZE_LIMIT > 0
+       default 0
+       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
+         of SRAM available for SPL when the stack required before reolcation
+         uses this SRAM, too.
+
 config HANDOFF
        bool "Pass hand-off information from SPL to U-Boot proper"
        depends on BLOBLIST
@@ -1151,5 +1187,17 @@ config TPL_YMODEM_SUPPORT
 
 endif # TPL
 
+config SPL_AT91_MCK_BYPASS
+       bool "Use external clock signal as a source of main clock for AT91 platforms"
+       depends on ARCH_AT91
+       default n
+       help
+         Use external 8 to 24 Mhz clock signal as source of main clock instead
+         of an external crystal oscillator.
+         This option disables the internal driving on the XOUT pin.
+         The external source has to provide a stable clock on the XIN pin.
+         If this option is disabled, the SoC expects a crystal oscillator
+         that needs driving on both XIN and XOUT lines.
+
 endif # SPL
 endmenu
index f098222113123172eb8e946976392da9d442c233..7ecdc361ce8568a10222ba9611549d8ba7b742ba 100644 (file)
@@ -20,7 +20,6 @@ CONFIG_VERSION_VARIABLE=y
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_SPL_TEXT_BASE=0x80000000
-CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_PROMPT="U-Boot > "
index 8c16d5c4f5a7935cd2542b19dd8622c3f8e86141..c09505828255cafc7f064486082afb745c8a02b2 100644 (file)
@@ -21,7 +21,6 @@ CONFIG_VERSION_VARIABLE=y
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_SPL_TEXT_BASE=0x80000000
-CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_SEPARATE_BSS=y
 CONFIG_SPL_SPI_LOAD=y
index b8eac0e6599543f0fd51630369536d186ba0dc5b..727101634679e00defba37c5df841784faee95b0 100644 (file)
@@ -19,7 +19,6 @@ CONFIG_VERSION_VARIABLE=y
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_SPL_TEXT_BASE=0x80000000
-CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_SEPARATE_BSS=y
 CONFIG_SPL_NAND_SUPPORT=y
index 4d253c507253a1f9fc71b0967cb818913786d084..d650acae24ce55d8f7d7de2755dce0157ee950af 100644 (file)
@@ -1,6 +1,6 @@
 CONFIG_ARM=y
 CONFIG_TEGRA=y
-CONFIG_SYS_TEXT_BASE=0x80110000
+CONFIG_SYS_TEXT_BASE=0x80080000
 CONFIG_NR_DRAM_BANKS=2
 CONFIG_TEGRA210=y
 CONFIG_OF_SYSTEM_SETUP=y
index 577dceb2d4b05509ac6dd9bbd3f13f254f66d71d..a25d3780640fe98b4a49f947fe5196a8e84ab9fd 100644 (file)
@@ -36,6 +36,7 @@ CONFIG_CMD_DM=y
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_MTD=y
 CONFIG_CMD_NAND=y
+CONFIG_CMD_WDT=y
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_CMD_DHCP=y
 CONFIG_CMD_PING=y
diff --git a/configs/microchip_mpfs_icicle_defconfig b/configs/microchip_mpfs_icicle_defconfig
new file mode 100644 (file)
index 0000000..a375546
--- /dev/null
@@ -0,0 +1,8 @@
+CONFIG_RISCV=y
+CONFIG_ARCH_RV64I=y
+CONFIG_NR_CPUS=5
+CONFIG_TARGET_MICROCHIP_ICICLE=y
+CONFIG_BOOTDELAY=3
+CONFIG_SYS_PROMPT="RISC-V # "
+CONFIG_FIT=y
+CONFIG_OF_PRIOR_STAGE=y
index e43141844a102561b423dd6448bf513b053df850..48f251ebb804e889532cd4d871b4c82c00a3dcb3 100644 (file)
@@ -18,7 +18,6 @@ CONFIG_VERSION_VARIABLE=y
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_SPL_TEXT_BASE=0x80000000
-CONFIG_SPL_BOARD_INIT=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0xb5
 CONFIG_SPL_NAND_SUPPORT=y
 CONFIG_HUSH_PARSER=y
index cdcb98a77eabf413479def3d6beb3a080a347136..aa9c1f66c4f0b31459081dd116518b5b4f353bf4 100644 (file)
@@ -1,6 +1,6 @@
 CONFIG_ARM=y
 CONFIG_TEGRA=y
-CONFIG_SYS_TEXT_BASE=0x80110000
+CONFIG_SYS_TEXT_BASE=0x80080000
 CONFIG_NR_DRAM_BANKS=2
 CONFIG_TEGRA210=y
 CONFIG_TARGET_P2371_0000=y
index 122b1b1fd5aa7000a54890e18b5cb74b69929789..2a21ff1dd08c11df01c724899d33abddfa0ce0de 100644 (file)
@@ -1,10 +1,11 @@
 CONFIG_ARM=y
 CONFIG_TEGRA=y
-CONFIG_SYS_TEXT_BASE=0x80110000
+CONFIG_SYS_TEXT_BASE=0x80080000
 CONFIG_NR_DRAM_BANKS=2
 CONFIG_TEGRA210=y
 CONFIG_TARGET_P2371_2180=y
 CONFIG_OF_SYSTEM_SETUP=y
+CONFIG_OF_BOARD_SETUP=y
 CONFIG_CONSOLE_MUX=y
 CONFIG_SYS_STDIO_DEREGISTER=y
 CONFIG_SYS_PROMPT="Tegra210 (P2371-2180) # "
index d28506b1c66751218b31bca368ebd9668cc70405..1c47064c04a5be04c8a66e66de7c6e2f2f557be2 100644 (file)
@@ -1,6 +1,6 @@
 CONFIG_ARM=y
 CONFIG_TEGRA=y
-CONFIG_SYS_TEXT_BASE=0x80110000
+CONFIG_SYS_TEXT_BASE=0x80080000
 CONFIG_NR_DRAM_BANKS=2
 CONFIG_TEGRA210=y
 CONFIG_TARGET_P2571=y
index 6d66cae3aafc7e394f2b86be6b86fb3e67e23848..4ac810db35d559d8bb20acc8a6a545c27c51fb50 100644 (file)
@@ -1,9 +1,10 @@
 CONFIG_ARM=y
 CONFIG_TEGRA=y
 CONFIG_SYS_TEXT_BASE=0x80080000
-CONFIG_NR_DRAM_BANKS=8
+CONFIG_NR_DRAM_BANKS=1026
 CONFIG_TEGRA186=y
 CONFIG_OF_SYSTEM_SETUP=y
+CONFIG_OF_BOARD_SETUP=y
 CONFIG_CONSOLE_MUX=y
 CONFIG_SYS_STDIO_DEREGISTER=y
 CONFIG_SYS_PROMPT="Tegra186 (P2771-0000-000) # "
index b8ac94ce60e508253e70e2a196347525043ac260..3ca85272a821bbc71bce2d8f0d461dbeb2d6f6f7 100644 (file)
@@ -1,9 +1,10 @@
 CONFIG_ARM=y
 CONFIG_TEGRA=y
 CONFIG_SYS_TEXT_BASE=0x80080000
-CONFIG_NR_DRAM_BANKS=8
+CONFIG_NR_DRAM_BANKS=1026
 CONFIG_TEGRA186=y
 CONFIG_OF_SYSTEM_SETUP=y
+CONFIG_OF_BOARD_SETUP=y
 CONFIG_CONSOLE_MUX=y
 CONFIG_SYS_STDIO_DEREGISTER=y
 CONFIG_SYS_PROMPT="Tegra186 (P2771-0000-500) # "
index 1fafb767af78ad428ef9e536ea3263fdb04cd019..e0471086d6a3a1c445fc2ac13dc25c014caf90ab 100644 (file)
@@ -23,12 +23,12 @@ CONFIG_SD_BOOT=y
 CONFIG_BOOTDELAY=3
 CONFIG_USE_BOOTARGS=y
 # CONFIG_DISPLAY_BOARDINFO is not set
-CONFIG_SPL_TEXT_BASE=0x200000
 CONFIG_SPL_SEPARATE_BSS=y
 CONFIG_SPL_DISPLAY_PRINT=y
 # CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
 CONFIG_SPL_RAM_SUPPORT=y
 CONFIG_SPL_RAM_DEVICE=y
+CONFIG_SPL_AT91_MCK_BYPASS=y
 CONFIG_HUSH_PARSER=y
 CONFIG_CMD_BOOTZ=y
 # CONFIG_CMD_IMI is not set
@@ -75,3 +75,4 @@ CONFIG_TIMER=y
 CONFIG_SPL_TIMER=y
 CONFIG_ATMEL_PIT_TIMER=y
 CONFIG_OF_LIBFDT_OVERLAY=y
+# CONFIG_EFI_LOADER_HII is not set
index bf2b5584df17b53d0d2ba8a5d21459da7fabb934..25b3aaf623edb339bcd2643036f5067a8cee8c24 100644 (file)
@@ -51,6 +51,7 @@ CONFIG_MMC_SDHCI_ATMEL=y
 CONFIG_NAND=y
 CONFIG_NAND_ATMEL=y
 CONFIG_ATMEL_NAND_HW_PMECC=y
+CONFIG_PMECC_CAP=4
 CONFIG_DM_ETH=y
 CONFIG_MACB=y
 CONFIG_PINCTRL=y
index 9608ecd0b33fb2e043bec9de8e9e61113c578e29..3f7e6270d0ca86409bdc30b4fe23b28edb53777b 100644 (file)
@@ -50,6 +50,7 @@ CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_ATMEL=y
 CONFIG_NAND_ATMEL=y
 CONFIG_ATMEL_NAND_HW_PMECC=y
+CONFIG_PMECC_CAP=4
 CONFIG_DM_ETH=y
 CONFIG_MACB=y
 CONFIG_PINCTRL=y
index f673832dffcd313d2e7bb023edfcca399fa0e914..0504b4ec0fc6aa75360514a38ba56d4fb4624aa1 100644 (file)
@@ -59,6 +59,8 @@ CONFIG_DM_MMC=y
 CONFIG_GENERIC_ATMEL_MCI=y
 CONFIG_NAND=y
 CONFIG_NAND_ATMEL=y
+CONFIG_ATMEL_NAND_HW_PMECC=y
+CONFIG_PMECC_CAP=8
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=30000000
index 07e0d45781819d7548c96af14711b51ab09034fb..4b48689ee81914200e6cd69c027951446fb32165 100644 (file)
@@ -3,6 +3,7 @@ CONFIG_ARCH_ROCKCHIP=y
 CONFIG_SYS_TEXT_BASE=0x00000000
 CONFIG_SYS_MALLOC_F_LEN=0x2000
 CONFIG_ROCKCHIP_RK3288=y
+CONFIG_SPL_SIZE_LIMIT=30720
 CONFIG_SPL_ROCKCHIP_BACK_TO_BROM=y
 CONFIG_TARGET_TINKER_RK3288=y
 CONFIG_NR_DRAM_BANKS=1
index 1e239ecadd016f43474ea8db302a326de8a51a2e..36ca3b201edf0dbcf6144aab462f82d0d9922deb 100644 (file)
@@ -22,6 +22,7 @@
 #define CONFIG_SYS_OSCIN_FREQ          24000000
 #define CONFIG_SYS_TIMERBASE           DAVINCI_TIMER0_BASE
 #define CONFIG_SYS_HZ_CLOCK            clk_get(DAVINCI_AUXCLK_CLKID)
+#define CONFIG_SKIP_LOWLEVEL_INIT
 
 /*
  * Memory Info
diff --git a/include/configs/microchip_mpfs_icicle.h b/include/configs/microchip_mpfs_icicle.h
new file mode 100644 (file)
index 0000000..82c7fbb
--- /dev/null
@@ -0,0 +1,63 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (C) 2019 Microchip Technology Inc.
+ * Padmarao Begari <padmarao.begari@microchip.com>
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+/*
+ * CPU and Board Configuration Options
+ */
+#define CONFIG_BOOTP_SEND_HOSTNAME
+
+/*
+ * Miscellaneous configurable options
+ */
+#define CONFIG_SYS_CBSIZE      1024 /* Console I/O Buffer Size */
+
+/*
+ * Print Buffer Size
+ */
+#define CONFIG_SYS_PBSIZE      \
+       (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
+
+/*
+ * max number of command args
+ */
+#define CONFIG_SYS_MAXARGS     16
+
+/*
+ * Boot Argument Buffer Size
+ */
+#define CONFIG_SYS_BARGSIZE    CONFIG_SYS_CBSIZE
+
+/*
+ * Size of malloc() pool
+ * 512kB is suggested, (CONFIG_ENV_SIZE + 128 * 1024) was not enough
+ */
+#define CONFIG_SYS_MALLOC_LEN  (512 << 10)
+
+/*
+ * Physical Memory Map
+ */
+#define PHYS_SDRAM_0           0x80000000 /* SDRAM Bank #1 */
+#define PHYS_SDRAM_0_SIZE      0x40000000 /* 1 GB */
+#define CONFIG_SYS_SDRAM_BASE  PHYS_SDRAM_0
+
+/* Init Stack Pointer */
+#define CONFIG_SYS_INIT_SP_ADDR        (CONFIG_SYS_SDRAM_BASE + 0x200000)
+
+#define CONFIG_SYS_LOAD_ADDR   0x80000000 /* SDRAM */
+
+/*
+ * memtest works on DRAM
+ */
+#define CONFIG_SYS_MEMTEST_START       PHYS_SDRAM_0
+#define CONFIG_SYS_MEMTEST_END         (PHYS_SDRAM_0 + PHYS_SDRAM_0_SIZE)
+
+/* When we use RAM as ENV */
+#define CONFIG_ENV_SIZE        0x2000
+
+#endif /* __CONFIG_H */
index b7110edebcbfb56cee394c76bc53c5dcfd328fe2..df22f780b09946a573198aa609af9a06f70480ab 100644 (file)
@@ -20,7 +20,7 @@
 #define CONFIG_STANDALONE_LOAD_ADDR    0x80200000
 
 /* Environment options */
-#define CONFIG_ENV_SIZE                        SZ_4K
+#define CONFIG_ENV_SIZE                        SZ_128K
 
 #define BOOT_TARGET_DEVICES(func) \
        func(QEMU, qemu, na) \
index e54428ba43e202acdd8a363874c1bbd4f4feb65b..9685ee5059abede014ee3089c76c65e769159685 100644 (file)
 #define CONFIG_SYS_NONCACHED_MEMORY    (1 << 20)       /* 1 MiB */
 
 #ifndef CONFIG_SPL_BUILD
+#ifndef BOOT_TARGET_DEVICES
 #define BOOT_TARGET_DEVICES(func) \
        func(MMC, mmc, 1) \
        func(MMC, mmc, 0) \
        func(USB, usb, 0) \
        func(PXE, pxe, na) \
        func(DHCP, dhcp, na)
+#endif
 #include <config_distro_bootcmd.h>
 #else
 #define BOOTENV
index fa8e34f6f9608e48e380c8c4e0011d342832f5e7..e6c22dd5cd5c17abc7f0eb3c57402d4ffd52dd3a 100644 (file)
@@ -996,6 +996,30 @@ int fdtdec_setup_memory_banksize_fdt(const void *blob);
  */
 int fdtdec_setup_memory_banksize(void);
 
+/**
+ * fdtdec_set_ethernet_mac_address() - set MAC address for default interface
+ *
+ * Looks up the default interface via the "ethernet" alias (in the /aliases
+ * node) and stores the given MAC in its "local-mac-address" property. This
+ * is useful on platforms that store the MAC address in a custom location.
+ * Board code can call this in the late init stage to make sure that the
+ * interface device tree node has the right MAC address configured for the
+ * Ethernet uclass to pick it up.
+ *
+ * Typically the FDT passed into this function will be U-Boot's control DTB.
+ * Given that a lot of code may be holding offsets to various nodes in that
+ * tree, this code will only set the "local-mac-address" property in-place,
+ * which means that it needs to exist and have space for the 6-byte address.
+ * This ensures that the operation is non-destructive and does not invalidate
+ * offsets that other drivers may be using.
+ *
+ * @param fdt FDT blob
+ * @param mac buffer containing the MAC address to set
+ * @param size size of MAC address
+ * @return 0 on success or a negative error code on failure
+ */
+int fdtdec_set_ethernet_mac_address(void *fdt, const u8 *mac, size_t size);
+
 /**
  * fdtdec_set_phandle() - sets the phandle of a given node
  *
index 36066207392e9c478b1e7a08c389ba34196827a3..5d63be4ce5b065a1b81fd57ca6612f04716af7db 100644 (file)
@@ -94,6 +94,7 @@ size_t strcspn(const char *s, const char *reject);
 #ifndef __HAVE_ARCH_STRDUP
 extern char * strdup(const char *);
 #endif
+extern char * strndup(const char *, size_t);
 #ifndef __HAVE_ARCH_STRSWAB
 extern char * strswab(const char *);
 #endif
index 9fd0d73fb4e4342dc7650c1b4dcb114772b257ea..1e9b369be7cb029f0eafa6ad9180affe73b36b6e 100644 (file)
@@ -4,6 +4,7 @@
 #define _TIME_H
 
 #include <linux/typecheck.h>
+#include <linux/types.h>
 
 unsigned long get_timer(unsigned long base);
 
@@ -21,6 +22,14 @@ unsigned long timer_get_us(void);
  */
 void timer_test_add_offset(unsigned long offset);
 
+/**
+ * usec_to_tick() - convert microseconds to clock ticks
+ *
+ * @usec:      duration in microseconds
+ * Return:     duration in clock ticks
+ */
+uint64_t usec_to_tick(unsigned long usec);
+
 /*
  *     These inlines deal with timer wrapping correctly. You are
  *     strongly encouraged to use them
index 124bbce8a2cfea5d17d31349b477b331073a010c..abcc325eae9a2aed554158005ebc5b249a9dc27c 100644 (file)
@@ -6,6 +6,8 @@
 #ifndef __UUID_H__
 #define __UUID_H__
 
+#include <linux/bitops.h>
+
 /* This is structure is in big-endian */
 struct uuid {
        unsigned int time_low;
@@ -16,10 +18,10 @@ struct uuid {
        unsigned char node[6];
 } __packed;
 
-enum {
-       UUID_STR_FORMAT_STD,
-       UUID_STR_FORMAT_GUID
-};
+/* Bits of a bitmask specifying the output format for GUIDs */
+#define UUID_STR_FORMAT_STD    0
+#define UUID_STR_FORMAT_GUID   BIT(0)
+#define UUID_STR_UPPER_CASE    BIT(1)
 
 #define UUID_STR_LEN           36
 #define UUID_BIN_LEN           sizeof(struct uuid)
index 43791422c8191d3081e0b71fdbe96abb91ab7779..b2102c5b5af24697e65aa9b3a97f5295f657751c 100644 (file)
@@ -210,7 +210,8 @@ efi_status_t efi_bootmgr_load(efi_handle_t *handle)
                ret = EFI_CALL(efi_set_variable(
                                        L"BootNext",
                                        (efi_guid_t *)&efi_global_variable_guid,
-                                       0, 0, &bootnext));
+                                       EFI_VARIABLE_NON_VOLATILE, 0,
+                                       &bootnext));
 
                /* load BootNext */
                if (ret == EFI_SUCCESS) {
index 5c6bc691a5c4154214b05a5245444bf0164d1d62..7d1d6e92138ed297251104b5d2f91cdd888875ab 100644 (file)
@@ -1153,11 +1153,15 @@ static efi_status_t efi_get_drivers(efi_handle_t handle,
                                ++count;
                }
        }
+       *number_of_drivers = 0;
+       if (!count) {
+               *driver_handle_buffer = NULL;
+               return EFI_SUCCESS;
+       }
        /*
         * Create buffer. In case of duplicate driver assignments the buffer
         * will be too large. But that does not harm.
         */
-       *number_of_drivers = 0;
        *driver_handle_buffer = calloc(count, sizeof(efi_handle_t));
        if (!*driver_handle_buffer)
                return EFI_OUT_OF_RESOURCES;
@@ -1213,7 +1217,8 @@ static efi_status_t efi_disconnect_all_drivers
                              &driver_handle_buffer);
        if (ret != EFI_SUCCESS)
                return ret;
-
+       if (!number_of_drivers)
+               return EFI_SUCCESS;
        ret = EFI_NOT_FOUND;
        while (number_of_drivers) {
                r = EFI_CALL(efi_disconnect_controller(
@@ -1985,8 +1990,14 @@ out:
  */
 static efi_status_t EFIAPI efi_stall(unsigned long microseconds)
 {
+       u64 end_tick;
+
        EFI_ENTRY("%ld", microseconds);
-       udelay(microseconds);
+
+       end_tick = get_ticks() + usec_to_tick(microseconds);
+       while (get_ticks() < end_tick)
+               efi_timer_check();
+
        return EFI_EXIT(EFI_SUCCESS);
 }
 
@@ -2868,12 +2879,46 @@ efi_status_t EFIAPI efi_start_image(efi_handle_t image_handle,
  * @image_obj:                 handle of the loaded image
  * @loaded_image_protocol:     loaded image protocol
  */
-static void efi_delete_image(struct efi_loaded_image_obj *image_obj,
-                            struct efi_loaded_image *loaded_image_protocol)
+static efi_status_t efi_delete_image
+                       (struct efi_loaded_image_obj *image_obj,
+                        struct efi_loaded_image *loaded_image_protocol)
 {
+       struct efi_object *efiobj;
+       efi_status_t r, ret = EFI_SUCCESS;
+
+close_next:
+       list_for_each_entry(efiobj, &efi_obj_list, link) {
+               struct efi_handler *protocol;
+
+               list_for_each_entry(protocol, &efiobj->protocols, link) {
+                       struct efi_open_protocol_info_item *info;
+
+                       list_for_each_entry(info, &protocol->open_infos, link) {
+                               if (info->info.agent_handle !=
+                                   (efi_handle_t)image_obj)
+                                       continue;
+                               r = EFI_CALL(efi_close_protocol
+                                               (efiobj, protocol->guid,
+                                                info->info.agent_handle,
+                                                info->info.controller_handle
+                                               ));
+                               if (r !=  EFI_SUCCESS)
+                                       ret = r;
+                               /*
+                                * Closing protocols may results in further
+                                * items being deleted. To play it safe loop
+                                * over all elements again.
+                                */
+                               goto close_next;
+                       }
+               }
+       }
+
        efi_free_pages((uintptr_t)loaded_image_protocol->image_base,
                       efi_size_in_pages(loaded_image_protocol->image_size));
        efi_delete_handle(&image_obj->header);
+
+       return ret;
 }
 
 /**
index b2cb18e6d67021c194dff39914c5b401a6e1967d..3b7578f3aa4f6d7c218afd3cd3c398f0ec3199a3 100644 (file)
@@ -430,6 +430,7 @@ static efi_status_t EFIAPI efi_cout_enable_cursor(
        EFI_ENTRY("%p, %d", this, enable);
 
        printf(ESC"[?25%c", enable ? 'h' : 'l');
+       efi_con_mode.cursor_visible = !!enable;
 
        return EFI_EXIT(EFI_SUCCESS);
 }
index 76dcaa48f494dbf95c3ea09a33da520238166b4c..386cf924fe26a3c457c60878de55d5dfcb60e544 100644 (file)
@@ -230,6 +230,7 @@ uint64_t efi_add_memory_map(uint64_t start, uint64_t pages, int memory_type,
        struct efi_mem_list *newlist;
        bool carve_again;
        uint64_t carved_pages = 0;
+       struct efi_event *evt;
 
        EFI_PRINT("%s: 0x%llx 0x%llx %d %s\n", __func__,
                  start, pages, memory_type, overlap_only_ram ? "yes" : "no");
@@ -315,6 +316,16 @@ uint64_t efi_add_memory_map(uint64_t start, uint64_t pages, int memory_type,
        /* And make sure memory is listed in descending order */
        efi_mem_sort();
 
+       /* Notify that the memory map was changed */
+       list_for_each_entry(evt, &efi_events, link) {
+               if (evt->group &&
+                   !guidcmp(evt->group,
+                            &efi_guid_event_group_memory_map_change)) {
+                       efi_signal_event(evt, false);
+                       break;
+               }
+       }
+
        return start;
 }
 
index 50bc10537f404002f6927d1cce0133a797ea9fd2..e56053194daec46642103607904e85ed4f37aa3c 100644 (file)
@@ -125,6 +125,8 @@ static const char *parse_attr(const char *str, u32 *attrp)
 
                if ((s = prefix(str, "ro"))) {
                        attr |= READ_ONLY;
+               } else if ((s = prefix(str, "nv"))) {
+                       attr |= EFI_VARIABLE_NON_VOLATILE;
                } else if ((s = prefix(str, "boot"))) {
                        attr |= EFI_VARIABLE_BOOTSERVICE_ACCESS;
                } else if ((s = prefix(str, "run"))) {
@@ -468,7 +470,7 @@ efi_status_t EFIAPI efi_set_variable(u16 *variable_name,
                }
        }
 
-       val = malloc(2 * data_size + strlen("{ro,run,boot}(blob)") + 1);
+       val = malloc(2 * data_size + strlen("{ro,run,boot,nv}(blob)") + 1);
        if (!val) {
                ret = EFI_OUT_OF_RESOURCES;
                goto out;
@@ -480,12 +482,16 @@ efi_status_t EFIAPI efi_set_variable(u16 *variable_name,
         * store attributes
         * TODO: several attributes are not supported
         */
-       attributes &= (EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS);
+       attributes &= (EFI_VARIABLE_NON_VOLATILE |
+                      EFI_VARIABLE_BOOTSERVICE_ACCESS |
+                      EFI_VARIABLE_RUNTIME_ACCESS);
        s += sprintf(s, "{");
        while (attributes) {
                u32 attr = 1 << (ffs(attributes) - 1);
 
-               if (attr == EFI_VARIABLE_BOOTSERVICE_ACCESS)
+               if (attr == EFI_VARIABLE_NON_VOLATILE)
+                       s += sprintf(s, "nv");
+               else if (attr == EFI_VARIABLE_BOOTSERVICE_ACCESS)
                        s += sprintf(s, "boot");
                else if (attr == EFI_VARIABLE_RUNTIME_ACCESS)
                        s += sprintf(s, "run");
index d0ba8889733592001dc41d3a4a77a54270c6ce4c..3ee786b57940df4b12f89cce3003f2c2a252c9e0 100644 (file)
@@ -1261,6 +1261,35 @@ __weak void *board_fdt_blob_setup(void)
 }
 #endif
 
+int fdtdec_set_ethernet_mac_address(void *fdt, const u8 *mac, size_t size)
+{
+       const char *path;
+       int offset, err;
+
+       if (!is_valid_ethaddr(mac))
+               return -EINVAL;
+
+       path = fdt_get_alias(fdt, "ethernet");
+       if (!path)
+               return 0;
+
+       debug("ethernet alias found: %s\n", path);
+
+       offset = fdt_path_offset(fdt, path);
+       if (offset < 0) {
+               debug("ethernet alias points to absent node %s\n", path);
+               return -ENOENT;
+       }
+
+       err = fdt_setprop_inplace(fdt, offset, "local-mac-address", mac, size);
+       if (err < 0)
+               return err;
+
+       debug("MAC address: %pM\n", mac);
+
+       return 0;
+}
+
 static int fdtdec_init_reserved_memory(void *blob)
 {
        int na, ns, node, err;
index af17c16f616db4b8afc71cb55b31ad394457636b..9b779ddc3bbe42b6df36a70c3ece2213b40e5fa6 100644 (file)
@@ -326,6 +326,29 @@ char * strdup(const char *s)
 }
 #endif
 
+char * strndup(const char *s, size_t n)
+{
+       size_t len;
+       char *new;
+
+       if (s == NULL)
+               return NULL;
+
+       len = strlen(s);
+
+       if (n < len)
+               len = n;
+
+       new = malloc(len + 1);
+       if (new == NULL)
+               return NULL;
+
+       strncpy(new, s, len);
+       new[len] = '\0';
+
+       return new;
+}
+
 #ifndef __HAVE_ARCH_STRSPN
 /**
  * strspn - Calculate the length of the initial substring of @s which only
index 9c55da6f1b3914adde3bf67107896a962bc29d44..f5751ab162b69643404f37f08d0472b3105824e9 100644 (file)
@@ -139,7 +139,7 @@ unsigned long __weak notrace timer_get_us(void)
        return tick_to_time(get_ticks() * 1000);
 }
 
-static uint64_t usec_to_tick(unsigned long usec)
+uint64_t usec_to_tick(unsigned long usec)
 {
        uint64_t tick = usec;
        tick *= get_tbclk();
index 2d4d6ef7e461d15e85cf3a4dbd9a842af1b467bf..7d7a2749b6410650362b6b0fa9c1b618872b893f 100644 (file)
@@ -187,9 +187,10 @@ int uuid_str_to_bin(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     - UUID string format: 0 - UUID; 1 - 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(unsigned char *uuid_bin, char *uuid_str, int str_format)
 {
@@ -198,6 +199,7 @@ void uuid_bin_to_str(unsigned char *uuid_bin, char *uuid_str, int str_format)
        const u8 guid_char_order[UUID_BIN_LEN] = {3, 2, 1, 0, 5, 4, 7, 6, 8,
                                                  9, 10, 11, 12, 13, 14, 15};
        const u8 *char_order;
+       const char *format;
        int i;
 
        /*
@@ -205,13 +207,17 @@ void uuid_bin_to_str(unsigned char *uuid_bin, char *uuid_str, int str_format)
         * 4B-2B-2B-2B-6B
         * be be be be be
         */
-       if (str_format == UUID_STR_FORMAT_STD)
+       if (str_format & UUID_STR_FORMAT_GUID)
+               char_order = guid_char_order;
+       else
                char_order = uuid_char_order;
+       if (str_format & UUID_STR_UPPER_CASE)
+               format = "%02X";
        else
-               char_order = guid_char_order;
+               format = "%02x";
 
        for (i = 0; i < 16; i++) {
-               sprintf(uuid_str, "%02x", uuid_bin[char_order[i]]);
+               sprintf(uuid_str, format, uuid_bin[char_order[i]]);
                uuid_str += 2;
                switch (i) {
                case 3:
index 8bbbd48c54b8af52b75d3904ae5bec6023d8d40d..425f2f53f79770d53047a27893aad6b0b776216b 100644 (file)
@@ -383,29 +383,31 @@ static char *ip4_addr_string(char *buf, char *end, u8 *addr, int field_width,
 
 #ifdef CONFIG_LIB_UUID
 /*
- * This works (roughly) the same way as linux's, but we currently always
- * print lower-case (ie. we just keep %pUB and %pUL for compat with linux),
- * mostly just because that is what uuid_bin_to_str() supports.
+ * This works (roughly) the same way as Linux's.
  *
  *   %pUb:   01020304-0506-0708-090a-0b0c0d0e0f10
+ *   %pUB:   01020304-0506-0708-090A-0B0C0D0E0F10
  *   %pUl:   04030201-0605-0807-090a-0b0c0d0e0f10
+ *   %pUL:   04030201-0605-0807-090A-0B0C0D0E0F10
  */
 static char *uuid_string(char *buf, char *end, u8 *addr, int field_width,
                         int precision, int flags, const char *fmt)
 {
        char uuid[UUID_STR_LEN + 1];
-       int str_format = UUID_STR_FORMAT_STD;
+       int str_format;
 
        switch (*(++fmt)) {
        case 'L':
+               str_format = UUID_STR_FORMAT_GUID | UUID_STR_UPPER_CASE;
+               break;
        case 'l':
                str_format = UUID_STR_FORMAT_GUID;
                break;
        case 'B':
-       case 'b':
-               /* this is the default */
+               str_format = UUID_STR_FORMAT_STD | UUID_STR_UPPER_CASE;
                break;
        default:
+               str_format = UUID_STR_FORMAT_STD;
                break;
        }
 
index 0bc548dca831cc09e0de630a7ded77e282a48d1c..a3b9974ad26c9a2b6855513665b10945aa99d78f 100644 (file)
 #define FAKE_BUILD_TAG "jenkins-u-boot-denx_uboot_dm-master-build-aarch64" \
                        "and a lot more text to come"
 
+/* Test printing GUIDs */
+static void guid_ut_print(void)
+{
+#if CONFIG_IS_ENABLED(LIB_UUID)
+       unsigned char guid[16] = {
+               1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16
+       };
+       char str[40];
+
+       sprintf(str, "%pUb", guid);
+       assert(!strcmp("01020304-0506-0708-090a-0b0c0d0e0f10", str));
+       sprintf(str, "%pUB", guid);
+       assert(!strcmp("01020304-0506-0708-090A-0B0C0D0E0F10", str));
+       sprintf(str, "%pUl", guid);
+       assert(!strcmp("04030201-0605-0807-090a-0b0c0d0e0f10", str));
+       sprintf(str, "%pUL", guid);
+       assert(!strcmp("04030201-0605-0807-090A-0B0C0D0E0F10", str));
+#endif
+}
+
 /* Test efi_loader specific printing */
 static void efi_ut_print(void)
 {
@@ -117,6 +137,9 @@ static int do_ut_print(cmd_tbl_t *cmdtp, int flag, int argc,
        /* Test efi_loader specific printing */
        efi_ut_print();
 
+       /* Test printing GUIDs */
+       guid_ut_print();
+
        printf("%s: Everything went swimmingly\n", __func__);
        return 0;
 }
index e2f572cae1b478cb72fa73effab35b54e7a02de1..33e90a8025a738945c4906e3ea725e8db9381dc3 100644 (file)
@@ -199,6 +199,10 @@ hostprogs-$(CONFIG_RISCV) += prelink-riscv
 hostprogs-y += fdtgrep
 fdtgrep-objs += $(LIBFDT_OBJS) fdtgrep.o
 
+ifneq ($(TOOLS_ONLY),y)
+hostprogs-y += spl_size_limit
+endif
+
 hostprogs-$(CONFIG_MIPS) += mips-relocs
 
 # We build some files with extra pedantic flags to try to minimize things
diff --git a/tools/spl_size_limit.c b/tools/spl_size_limit.c
new file mode 100644 (file)
index 0000000..98ff491
--- /dev/null
@@ -0,0 +1,30 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (c) 2019, Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
+ *
+ * This tool helps to return the size available for SPL image during build
+ */
+
+#include <generated/autoconf.h>
+#include <generated/generic-asm-offsets.h>
+
+int main(int argc, char *argv[])
+{
+       int spl_size_limit = 0;
+
+#ifdef CONFIG_SPL_SIZE_LIMIT
+       spl_size_limit = CONFIG_SPL_SIZE_LIMIT;
+#ifdef CONFIG_SPL_SIZE_LIMIT_SUBTRACT_GD
+       spl_size_limit -= GENERATED_GBL_DATA_SIZE;
+#endif
+#ifdef CONFIG_SPL_SIZE_LIMIT_SUBTRACT_MALLOC
+       spl_size_limit -= CONFIG_SPL_SYS_MALLOC_F_LEN;
+#endif
+#ifdef CONFIG_SPL_SIZE_LIMIT_PROVIDE_STACK
+       spl_size_limit -= CONFIG_SPL_SIZE_LIMIT_PROVIDE_STACK;
+#endif
+#endif
+
+       printf("%d", spl_size_limit);
+       return 0;
+}