Merge https://gitlab.denx.de/u-boot/custodians/u-boot-fsl-qoriq
authorTom Rini <trini@konsulko.com>
Mon, 16 Sep 2019 17:13:45 +0000 (13:13 -0400)
committerTom Rini <trini@konsulko.com>
Mon, 16 Sep 2019 17:13:45 +0000 (13:13 -0400)
- Add emmc hs200 support
- Few bug fixes related to serdes, I2C, ethernet, etc

73 files changed:
MAINTAINERS
Makefile
arch/arm/dts/Makefile
arch/arm/dts/am437x-cm-t43.dts [new file with mode: 0644]
arch/arm/dts/dra74x-mmc-iodelay.dtsi
arch/arm/dts/rk3399-rockpro64-u-boot.dtsi
arch/arm/mach-davinci/include/mach/gpio.h
arch/arm/mach-k3/am6_init.c
arch/arm/mach-k3/common.c
arch/arm/mach-k3/security.c
arch/arm/mach-rockchip/Makefile
arch/sh/cpu/sh4/config.mk
arch/sh/cpu/u-boot.lds
arch/sh/dts/sh7751-r2dplus.dts
board/freescale/mpc8536ds/MAINTAINERS
board/freescale/mpc8541cds/MAINTAINERS
board/freescale/mpc8544ds/MAINTAINERS
board/freescale/mpc8548cds/MAINTAINERS
board/freescale/mpc8555cds/MAINTAINERS
board/freescale/mpc8568mds/MAINTAINERS
board/freescale/mpc8569mds/MAINTAINERS
board/freescale/mpc8572ds/MAINTAINERS
board/freescale/mpc8610hpcd/MAINTAINERS
board/freescale/mpc8641hpcn/MAINTAINERS
board/theobroma-systems/lion_rk3368/README
common/usb.c
common/usb_kbd.c
common/usb_storage.c
configs/am65x_hs_evm_a53_defconfig
configs/cm_t43_defconfig
configs/omapl138_lcdk_defconfig
configs/r2dplus_defconfig
doc/README.rockchip
doc/driver-model/migration.rst
doc/git-mailrc
drivers/clk/rockchip/clk_rk3288.c
drivers/clk/rockchip/clk_rk3328.c
drivers/clk/rockchip/clk_rk3368.c
drivers/clk/rockchip/clk_rk3399.c
drivers/mtd/spi/Makefile
drivers/mtd/spi/sf.c [deleted file]
drivers/mtd/spi/sf_dataflash.c
drivers/mtd/spi/sf_internal.h
drivers/mtd/spi/spi-nor-core.c
drivers/mtd/spi/spi-nor-ids.c
drivers/soc/ti/k3-navss-ringacc.c
drivers/spi/Kconfig
drivers/spi/mvebu_a3700_spi.c
drivers/spi/soft_spi.c
drivers/spi/spi-uclass.c
drivers/usb/emul/sandbox_keyb.c
drivers/usb/emul/usb-emul-uclass.c
drivers/usb/host/dwc2.c
drivers/usb/host/ehci-generic.c
drivers/usb/host/ehci-hcd.c
drivers/usb/host/ohci-generic.c
drivers/usb/host/ohci-hcd.c
drivers/usb/host/sl811-hcd.c
drivers/usb/host/usb-sandbox.c
drivers/usb/host/usb-uclass.c
drivers/usb/host/xhci.c
drivers/usb/musb-new/musb_uboot.c
drivers/usb/musb/musb_hcd.c
include/configs/am65x_evm.h
include/configs/omapl138_lcdk.h
include/configs/ti_armv7_common.h
include/efi_api.h
include/efi_loader.h
include/linux/mtd/spi-nor.h
include/spi.h
include/usb.h
lib/efi_loader/efi_device_path_to_text.c
lib/efi_loader/efi_file.c

index 08222fd56948c52d266e2160e32c6093d051384c..e752e4b3de0fadc21b9b32e6dee73f2b1a103704 100644 (file)
@@ -565,7 +565,7 @@ S:  Maintained
 T:     git https://gitlab.denx.de/u-boot/custodians/u-boot-freebsd.git
 
 FREESCALE QORIQ
-M:     Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
+M:     Priyanka Jain <priyanka.jain@nxp.com>
 S:     Maintained
 T:     git https://gitlab.denx.de/u-boot/custodians/u-boot-fsl-qoriq.git
 F:     drivers/watchdog/sp805_wdt.c
@@ -723,13 +723,13 @@ F:        arch/powerpc/cpu/mpc83xx/
 F:     arch/powerpc/include/asm/arch-mpc83xx/
 
 POWERPC MPC85XX
-M:     Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
+M:     Priyanka Jain <priyanka.jain@nxp.com>
 S:     Maintained
 T:     git https://gitlab.denx.de/u-boot/custodians/u-boot-mpc85xx.git
 F:     arch/powerpc/cpu/mpc85xx/
 
 POWERPC MPC86XX
-M:     Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
+M:     Priyanka Jain <priyanka.jain@nxp.com>
 S:     Maintained
 T:     git https://gitlab.denx.de/u-boot/custodians/u-boot-mpc86xx.git
 F:     arch/powerpc/cpu/mpc86xx/
index ae56e47b2c0bfb89e4547badb51a3f451bec3809..57d070022739f790208b7063ed7c1fae916ea928 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -882,6 +882,10 @@ ifeq ($(CONFIG_MPC85xx)$(CONFIG_OF_SEPARATE),yy)
 ALL-y += u-boot-with-dtb.bin
 endif
 
+ifeq ($(CONFIG_ARCH_ROCKCHIP)$(CONFIG_SPL)$(CONFIG_TPL),yyy)
+ALL-y += idbloader.img
+endif
+
 LDFLAGS_u-boot += $(LDFLAGS_FINAL)
 
 # Avoid 'Not enough room for program headers' error on binutils 2.28 onwards.
@@ -1314,6 +1318,14 @@ OBJCOPYFLAGS_u-boot-with-spl.bin = -I binary -O binary \
 u-boot-with-spl.bin: $(SPL_IMAGE) $(SPL_PAYLOAD) FORCE
        $(call if_changed,pad_cat)
 
+ifeq ($(CONFIG_ARCH_ROCKCHIP),y)
+MKIMAGEFLAGS_u-boot-tpl.img = -n $(CONFIG_SYS_SOC) -T rksd
+tpl/u-boot-tpl.img: tpl/u-boot-tpl.bin FORCE
+       $(call if_changed,mkimage)
+idbloader.img: tpl/u-boot-tpl.img spl/u-boot-spl.bin FORCE
+       $(call if_changed,cat)
+endif
+
 ifeq ($(CONFIG_ARCH_LPC32XX)$(CONFIG_SPL),yy)
 MKIMAGEFLAGS_lpc32xx-spl.img = -T lpc32xximage -a $(CONFIG_SPL_TEXT_BASE)
 
index aac1b83d49386b675ca2f8e09358e22a153938ed..62da168ef869bb2ed79fc45bb99f99cd0012bc17 100644 (file)
@@ -302,7 +302,8 @@ dtb-$(CONFIG_AM33XX) += \
 dtb-$(CONFIG_AM43XX) += am437x-gp-evm.dtb am437x-sk-evm.dtb    \
        am43x-epos-evm.dtb \
        am437x-idk-evm.dtb \
-       am4372-generic.dtb
+       am4372-generic.dtb \
+       am437x-cm-t43.dtb
 dtb-$(CONFIG_TARGET_AM3517_EVM) += am3517-evm.dtb
 dtb-$(CONFIG_TI816X) += dm8168-evm.dtb
 dtb-$(CONFIG_THUNDERX) += thunderx-88xx.dtb
diff --git a/arch/arm/dts/am437x-cm-t43.dts b/arch/arm/dts/am437x-cm-t43.dts
new file mode 100644 (file)
index 0000000..063113a
--- /dev/null
@@ -0,0 +1,420 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (C) 2015 CompuLab, Ltd. - http://www.compulab.co.il/
+ */
+
+/dts-v1/;
+
+#include <dt-bindings/pinctrl/am43xx.h>
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/interrupt-controller/irq.h>
+#include "am4372.dtsi"
+
+/ {
+       model = "CompuLab CM-T43";
+       compatible = "compulab,am437x-cm-t43", "ti,am4372", "ti,am43";
+
+       leds {
+               compatible = "gpio-leds";
+
+               ledb {
+                       label = "cm-t43:green";
+                       gpios = <&gpio0 24 GPIO_ACTIVE_HIGH>;
+                       linux,default-trigger = "heartbeat";
+               };
+       };
+
+       vmmc_3v3: fixedregulator-v3_3 {
+               compatible = "regulator-fixed";
+               regulator-name = "vmmc_3v3";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               regulator-always-on;
+               enable-active-high;
+       };
+};
+
+&am43xx_pinmux {
+       pinctrl-names = "default";
+       pinctrl-0 = <&cm_t43_led_pins>;
+
+       cm_t43_led_pins: cm_t43_led_pins {
+               pinctrl-single,pins = <
+                       AM4372_IOPAD(0xa78, MUX_MODE7)
+               >;
+       };
+
+       i2c0_pins: i2c0_pins {
+               pinctrl-single,pins = <
+                       AM4372_IOPAD(0x988, PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE0)  /* i2c0_sda.i2c0_sda */
+                       AM4372_IOPAD(0x98c, PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE0)  /* i2c0_scl.i2c0_scl */
+               >;
+       };
+
+       emmc_pins: emmc_pins {
+               pinctrl-single,pins = <
+                       AM4372_IOPAD(0x820, PIN_INPUT_PULLUP | MUX_MODE2) /* gpmc_ad8.mmc1_dat0 */
+                       AM4372_IOPAD(0x824, PIN_INPUT_PULLUP | MUX_MODE2) /* gpmc_ad9.mmc1_dat1 */
+                       AM4372_IOPAD(0x828, PIN_INPUT_PULLUP | MUX_MODE2) /* gpmc_ad10.mmc1_dat2 */
+                       AM4372_IOPAD(0x82c, PIN_INPUT_PULLUP | MUX_MODE2) /* gpmc_ad11.mmc1_dat3 */
+                       AM4372_IOPAD(0x830, PIN_INPUT_PULLUP | MUX_MODE2) /* gpmc_ad12.mmc1_dat4 */
+                       AM4372_IOPAD(0x834, PIN_INPUT_PULLUP | MUX_MODE2) /* gpmc_ad13.mmc1_dat5 */
+                       AM4372_IOPAD(0x838, PIN_INPUT_PULLUP | MUX_MODE2) /* gpmc_ad14.mmc1_dat6 */
+                       AM4372_IOPAD(0x83c, PIN_INPUT_PULLUP | MUX_MODE2) /* gpmc_ad15.mmc1_dat7 */
+                       AM4372_IOPAD(0x880, PIN_INPUT_PULLUP | MUX_MODE2) /* gpmc_csn1.mmc1_clk */
+                       AM4372_IOPAD(0x884, PIN_INPUT_PULLUP | MUX_MODE2) /* gpmc_csn2.mmc1_cmd */
+               >;
+       };
+
+       spi0_pins: pinmux_spi0_pins {
+               pinctrl-single,pins = <
+                       AM4372_IOPAD(0x950, PIN_INPUT | MUX_MODE0) /* spi0_sclk.spi0_sclk */
+                       AM4372_IOPAD(0x954, PIN_INPUT | MUX_MODE0) /* spi0_d0.spi0_d0 */
+                       AM4372_IOPAD(0x958, PIN_OUTPUT | MUX_MODE0) /* spi0_d1.spi0_d1 */
+                       AM4372_IOPAD(0x95C, PIN_OUTPUT | MUX_MODE0) /* spi0_cs0.spi0_cs0 */
+               >;
+       };
+
+       nand_flash_x8: nand_flash_x8 {
+               pinctrl-single,pins = <
+                       AM4372_IOPAD(0x800, PIN_INPUT | PULL_DISABLE | MUX_MODE0)
+                       AM4372_IOPAD(0x804, PIN_INPUT | PULL_DISABLE | MUX_MODE0)
+                       AM4372_IOPAD(0x808, PIN_INPUT | PULL_DISABLE | MUX_MODE0)
+                       AM4372_IOPAD(0x80c, PIN_INPUT | PULL_DISABLE | MUX_MODE0)
+                       AM4372_IOPAD(0x810, PIN_INPUT | PULL_DISABLE | MUX_MODE0)
+                       AM4372_IOPAD(0x814, PIN_INPUT | PULL_DISABLE | MUX_MODE0)
+                       AM4372_IOPAD(0x818, PIN_INPUT | PULL_DISABLE | MUX_MODE0)
+                       AM4372_IOPAD(0x81c, PIN_INPUT | PULL_DISABLE | MUX_MODE0)
+                       AM4372_IOPAD(0x870, PIN_INPUT_PULLUP  | MUX_MODE0)
+                       AM4372_IOPAD(0x874, PIN_OUTPUT_PULLUP | MUX_MODE0)
+                       AM4372_IOPAD(0x87c, PIN_OUTPUT_PULLUP | MUX_MODE0)
+                       AM4372_IOPAD(0x898, PIN_OUTPUT_PULLDOWN | MUX_MODE0)
+                       AM4372_IOPAD(0x894, PIN_OUTPUT_PULLDOWN | MUX_MODE0)
+                       AM4372_IOPAD(0x890, PIN_OUTPUT_PULLDOWN | MUX_MODE0)
+                       AM4372_IOPAD(0x89c, PIN_OUTPUT_PULLDOWN | MUX_MODE0)
+               >;
+       };
+
+       cpsw_default: cpsw_default {
+               pinctrl-single,pins = <
+                       /* Slave 1 */
+                       AM4372_IOPAD(0x914, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* mii1_txen.rgmii1_txen */
+                       AM4372_IOPAD(0x918, PIN_INPUT_PULLDOWN | MUX_MODE2)     /* mii1_rxdv.rgmii1_rxctl */
+                       AM4372_IOPAD(0x91c, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* mii1_txd1.rgmii1_txd3 */
+                       AM4372_IOPAD(0x920, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* mii1_txd0.rgmii1_txd2 */
+                       AM4372_IOPAD(0x924, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* mii1_txd1.rgmii1_txd1 */
+                       AM4372_IOPAD(0x928, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* mii1_txd0.rgmii1_txd0 */
+                       AM4372_IOPAD(0x92c, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* mii1_txclk.rmii1_tclk */
+                       AM4372_IOPAD(0x930, PIN_INPUT_PULLDOWN | MUX_MODE2)     /* mii1_rxclk.rmii1_rclk */
+                       AM4372_IOPAD(0x934, PIN_INPUT_PULLDOWN | MUX_MODE2)     /* mii1_rxd1.rgmii1_rxd3 */
+                       AM4372_IOPAD(0x938, PIN_INPUT_PULLDOWN | MUX_MODE2)     /* mii1_rxd0.rgmii1_rxd2 */
+                       AM4372_IOPAD(0x93c, PIN_INPUT_PULLDOWN | MUX_MODE2)     /* mii1_rxd1.rgmii1_rxd1 */
+                       AM4372_IOPAD(0x940, PIN_INPUT_PULLDOWN | MUX_MODE2)     /* mii1_rxd0.rgmii1_rxd0 */
+                       AM4372_IOPAD(0xa74, MUX_MODE3)
+                       /* Slave 2 */
+                       AM4372_IOPAD(0x840, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* gpmc_a0.txen */
+                       AM4372_IOPAD(0x844, PIN_INPUT_PULLDOWN  | MUX_MODE2)    /* gpmc_a1.rxctl */
+                       AM4372_IOPAD(0x848, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* gpmc_a2.txd3 */
+                       AM4372_IOPAD(0x84c, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* gpmc_a3.txd2 */
+                       AM4372_IOPAD(0x850, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* gpmc_a4.txd1 */
+                       AM4372_IOPAD(0x854, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* gpmc_a5.txd0 */
+                       AM4372_IOPAD(0x858, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* gpmc_a6.tclk */
+                       AM4372_IOPAD(0x85c, PIN_INPUT_PULLDOWN  | MUX_MODE2)    /* gpmc_a7.rclk */
+                       AM4372_IOPAD(0x860, PIN_INPUT_PULLDOWN  | MUX_MODE2)    /* gpmc_a8.rxd3 */
+                       AM4372_IOPAD(0x864, PIN_INPUT_PULLDOWN  | MUX_MODE2)    /* gpmc_a9.rxd2 */
+                       AM4372_IOPAD(0x868, PIN_INPUT_PULLDOWN  | MUX_MODE2)    /* gpmc_a10.rxd1 */
+                       AM4372_IOPAD(0x86c, PIN_INPUT_PULLDOWN  | MUX_MODE2)    /* gpmc_a11.rxd0 */
+                       AM4372_IOPAD(0xa38, MUX_MODE7)
+               >;
+       };
+
+       davinci_mdio_default: davinci_mdio_default {
+               pinctrl-single,pins = <
+                       /* MDIO */
+                       AM4372_IOPAD(0x948, PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE0)       /* mdio_data.mdio_data */
+                       AM4372_IOPAD(0x94c, PIN_OUTPUT_PULLUP | MUX_MODE0)                      /* mdio_clk.mdio_clk */
+               >;
+       };
+};
+
+&gpmc {
+       status = "okay";
+       pinctrl-names = "default";
+       pinctrl-0 = <&nand_flash_x8>;
+       ranges = <0 0 0x08000000 0x1000000>;
+       nand@0,0 {
+               compatible = "ti,omap2-nand";
+               reg = <0 0 4>;          /* CS0, offset 0, IO size 4 */
+               interrupt-parent = <&gpmc>;
+               interrupts = <0 IRQ_TYPE_NONE>, /* fifoevent */
+                            <1 IRQ_TYPE_NONE>; /* termcount */
+               ti,nand-ecc-opt = "bch8";
+               ti,elm-id = <&elm>;
+
+               nand-bus-width = <8>;
+               gpmc,device-width = <1>;
+               gpmc,sync-clk-ps = <0>;
+               gpmc,cs-on-ns = <0>;
+               gpmc,cs-rd-off-ns = <44>;
+               gpmc,cs-wr-off-ns = <44>;
+               gpmc,adv-on-ns = <6>;
+               gpmc,adv-rd-off-ns = <34>;
+               gpmc,adv-wr-off-ns = <44>;
+               gpmc,we-on-ns = <0>;
+               gpmc,we-off-ns = <40>;
+               gpmc,oe-on-ns = <0>;
+               gpmc,oe-off-ns = <54>;
+               gpmc,access-ns = <64>;
+               gpmc,rd-cycle-ns = <82>;
+               gpmc,wr-cycle-ns = <82>;
+               gpmc,bus-turnaround-ns = <0>;
+               gpmc,cycle2cycle-delay-ns = <0>;
+               gpmc,clk-activation-ns = <0>;
+               gpmc,wr-access-ns = <40>;
+               gpmc,wr-data-mux-bus-ns = <0>;
+
+               #address-cells = <1>;
+               #size-cells = <1>;
+               /* MTD partition table */
+               partition@0 {
+                       label = "kernel";
+                       reg = <0x0 0x00980000>;
+               };
+               partition@980000 {
+                       label = "dtb";
+                       reg = <0x00980000 0x00080000>;
+               };
+               partition@a00000 {
+                       label = "rootfs";
+                       reg = <0x00a00000 0x0>;
+               };
+       };
+};
+
+&i2c0 {
+       status = "okay";
+       pinctrl-names = "default";
+       pinctrl-0 = <&i2c0_pins>;
+       clock-frequency = <100000>;
+
+       tps65218: tps65218@24 {
+               compatible = "ti,tps65218";
+               reg = <0x24>;
+               interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>; /* NMIn */
+               interrupt-parent = <&gic>;
+               interrupt-controller;
+               #interrupt-cells = <2>;
+
+               dcdc1: regulator-dcdc1 {
+                       regulator-name = "vdd_core";
+                       regulator-min-microvolt = <912000>;
+                       regulator-max-microvolt = <1144000>;
+                       regulator-boot-on;
+                       regulator-always-on;
+               };
+
+               dcdc2: regulator-dcdc2 {
+                       regulator-name = "vdd_mpu";
+                       regulator-min-microvolt = <912000>;
+                       regulator-max-microvolt = <1378000>;
+                       regulator-boot-on;
+                       regulator-always-on;
+               };
+
+               dcdc3: regulator-dcdc3 {
+                       regulator-name = "vdcdc3";
+                       regulator-suspend-enable;
+                       regulator-min-microvolt = <1500000>;
+                       regulator-max-microvolt = <1500000>;
+                       regulator-boot-on;
+                       regulator-always-on;
+               };
+
+               dcdc5: regulator-dcdc5 {
+                       regulator-name = "v1_0bat";
+                       regulator-min-microvolt = <1000000>;
+                       regulator-max-microvolt = <1000000>;
+                       regulator-boot-on;
+                       regulator-always-on;
+               };
+
+               dcdc6: regulator-dcdc6 {
+                       regulator-name = "v1_8bat";
+                       regulator-min-microvolt = <1800000>;
+                       regulator-max-microvolt = <1800000>;
+                       regulator-boot-on;
+                       regulator-always-on;
+               };
+
+               ldo1: regulator-ldo1 {
+                       regulator-min-microvolt = <1800000>;
+                       regulator-max-microvolt = <1800000>;
+                       regulator-boot-on;
+                       regulator-always-on;
+               };
+       };
+
+       eeprom_module: at24@50 {
+               compatible = "atmel,24c02";
+               reg = <0x50>;
+               pagesize = <16>;
+       };
+};
+
+&gpio0 {
+       status = "okay";
+};
+
+&gpio1 {
+       status = "okay";
+};
+
+&gpio2 {
+       status = "okay";
+};
+
+&gpio3 {
+       status = "okay";
+};
+
+&gpio4 {
+       status = "okay";
+};
+
+&gpio5 {
+       status = "okay";
+};
+
+&mmc2 {
+       status = "okay";
+       pinctrl-names = "default";
+       pinctrl-0 = <&emmc_pins>;
+       vmmc-supply = <&vmmc_3v3>;
+       bus-width = <8>;
+       ti,non-removable;
+};
+
+&spi0 {
+       status = "okay";
+       pinctrl-names = "default";
+       pinctrl-0 = <&spi0_pins>;
+       dmas = <&edma 16 0
+               &edma 17 0>;
+       dma-names = "tx0", "rx0";
+
+       flash: w25q64cvzpig@0 {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               compatible = "jedec,spi-nor";
+               reg = <0>;
+               spi-max-frequency = <20000000>;
+               partition@0 {
+                       label = "uboot";
+                       reg = <0x0 0xc0000>;
+               };
+
+               partition@c0000 {
+                       label = "uboot environment";
+                       reg = <0xc0000 0x40000>;
+               };
+
+               partition@100000 {
+                       label = "reserved";
+                       reg = <0x100000 0x100000>;
+               };
+       };
+};
+
+&mac {
+       pinctrl-names = "default";
+       pinctrl-0 = <&cpsw_default>;
+       dual_emac = <1>;
+       status = "okay";
+};
+
+&davinci_mdio {
+       pinctrl-names = "default";
+       pinctrl-0 = <&davinci_mdio_default>;
+       status = "okay";
+
+       ethphy0: ethernet-phy@0 {
+               reg = <0>;
+       };
+
+       ethphy1: ethernet-phy@1 {
+               reg = <1>;
+       };
+};
+
+&cpsw_emac0 {
+       phy-handle = <&ethphy0>;
+       phy-mode = "rgmii-txid";
+       dual_emac_res_vlan = <1>;
+};
+
+&cpsw_emac1 {
+       phy-handle = <&ethphy1>;
+       phy-mode = "rgmii-txid";
+       dual_emac_res_vlan = <2>;
+};
+
+&dwc3_1 {
+       status = "okay";
+};
+
+&usb2_phy1 {
+       status = "okay";
+};
+
+&usb1 {
+       dr_mode = "host";
+       status = "okay";
+};
+
+&dwc3_2 {
+       status = "okay";
+};
+
+&usb2_phy2 {
+       status = "okay";
+};
+
+&usb2 {
+       dr_mode = "host";
+       status = "okay";
+       interrupts = <GIC_SPI 174 IRQ_TYPE_LEVEL_HIGH>,
+                    <GIC_SPI 174 IRQ_TYPE_LEVEL_HIGH>,
+                    <GIC_SPI 178 IRQ_TYPE_LEVEL_HIGH>;
+       interrupt-names = "peripheral", "host", "otg";
+};
+
+&elm {
+       status = "okay";
+};
+
+&uart0 {
+       status = "okay";
+};
+
+&tscadc {
+       status = "okay";
+       tsc {
+               ti,wires = <4>;
+               ti,x-plate-resistance = <200>;
+               ti,coordiante-readouts = <5>;
+               ti,wire-config = <0x00 0x11 0x22 0x33>;
+       };
+
+       adc {
+               ti,adc-channels = <4 5 6 7>;
+       };
+};
+
+&cpu {
+       cpu0-supply = <&dcdc2>;
+       operating-points = <1000000 1330000>,
+                          <800000 1260000>,
+                          <720000 1200000>,
+                          <600000 1100000>,
+                          <300000 950000>;
+};
index 28ebb4eb884a9450f51508c576e2b37d3d8a0808..214b9e6de2c356d1c6a3650ba9fc92bcc17b8240 100644 (file)
@@ -32,7 +32,7 @@
  *
  * Datamanual Revisions:
  *
- * AM572x Silicon Revision 2.0: SPRS953B, Revised November 2016
+ * AM572x Silicon Revision 2.0: SPRS953F, Revised May 2019
  * AM572x Silicon Revision 1.1: SPRS915R, Revised November 2016
  *
  */
 
        mmc3_pins_default: mmc3_pins_default {
                pinctrl-single,pins = <
-                       DRA7XX_CORE_IOPAD(0x377c, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_clk.mmc3_clk */
-                       DRA7XX_CORE_IOPAD(0x3780, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_cmd.mmc3_cmd */
-                       DRA7XX_CORE_IOPAD(0x3784, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_dat0.mmc3_dat0 */
-                       DRA7XX_CORE_IOPAD(0x3788, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_dat1.mmc3_dat1 */
-                       DRA7XX_CORE_IOPAD(0x378c, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_dat2.mmc3_dat2 */
-                       DRA7XX_CORE_IOPAD(0x3790, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_dat3.mmc3_dat3 */
+                       DRA7XX_CORE_IOPAD(0x377c, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_clk.mmc3_clk */
+                       DRA7XX_CORE_IOPAD(0x3780, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_cmd.mmc3_cmd */
+                       DRA7XX_CORE_IOPAD(0x3784, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_dat0.mmc3_dat0 */
+                       DRA7XX_CORE_IOPAD(0x3788, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_dat1.mmc3_dat1 */
+                       DRA7XX_CORE_IOPAD(0x378c, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_dat2.mmc3_dat2 */
+                       DRA7XX_CORE_IOPAD(0x3790, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_dat3.mmc3_dat3 */
                >;
        };
 
        mmc3_pins_hs: mmc3_pins_hs {
                pinctrl-single,pins = <
-                       DRA7XX_CORE_IOPAD(0x377c, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_clk.mmc3_clk */
-                       DRA7XX_CORE_IOPAD(0x3780, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_cmd.mmc3_cmd */
-                       DRA7XX_CORE_IOPAD(0x3784, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_dat0.mmc3_dat0 */
-                       DRA7XX_CORE_IOPAD(0x3788, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_dat1.mmc3_dat1 */
-                       DRA7XX_CORE_IOPAD(0x378c, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_dat2.mmc3_dat2 */
-                       DRA7XX_CORE_IOPAD(0x3790, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_dat3.mmc3_dat3 */
+                       DRA7XX_CORE_IOPAD(0x377c, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_clk.mmc3_clk */
+                       DRA7XX_CORE_IOPAD(0x3780, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_cmd.mmc3_cmd */
+                       DRA7XX_CORE_IOPAD(0x3784, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_dat0.mmc3_dat0 */
+                       DRA7XX_CORE_IOPAD(0x3788, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_dat1.mmc3_dat1 */
+                       DRA7XX_CORE_IOPAD(0x378c, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_dat2.mmc3_dat2 */
+                       DRA7XX_CORE_IOPAD(0x3790, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_dat3.mmc3_dat3 */
                >;
        };
 
        mmc3_pins_sdr12: mmc3_pins_sdr12 {
                pinctrl-single,pins = <
-                       DRA7XX_CORE_IOPAD(0x377c, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_clk.mmc3_clk */
-                       DRA7XX_CORE_IOPAD(0x3780, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_cmd.mmc3_cmd */
-                       DRA7XX_CORE_IOPAD(0x3784, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_dat0.mmc3_dat0 */
-                       DRA7XX_CORE_IOPAD(0x3788, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_dat1.mmc3_dat1 */
-                       DRA7XX_CORE_IOPAD(0x378c, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_dat2.mmc3_dat2 */
-                       DRA7XX_CORE_IOPAD(0x3790, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_dat3.mmc3_dat3 */
+                       DRA7XX_CORE_IOPAD(0x377c, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_clk.mmc3_clk */
+                       DRA7XX_CORE_IOPAD(0x3780, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_cmd.mmc3_cmd */
+                       DRA7XX_CORE_IOPAD(0x3784, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_dat0.mmc3_dat0 */
+                       DRA7XX_CORE_IOPAD(0x3788, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_dat1.mmc3_dat1 */
+                       DRA7XX_CORE_IOPAD(0x378c, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_dat2.mmc3_dat2 */
+                       DRA7XX_CORE_IOPAD(0x3790, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_dat3.mmc3_dat3 */
                >;
        };
 
        mmc3_pins_sdr25: mmc3_pins_sdr25 {
                pinctrl-single,pins = <
-                       DRA7XX_CORE_IOPAD(0x377c, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_clk.mmc3_clk */
-                       DRA7XX_CORE_IOPAD(0x3780, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_cmd.mmc3_cmd */
-                       DRA7XX_CORE_IOPAD(0x3784, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_dat0.mmc3_dat0 */
-                       DRA7XX_CORE_IOPAD(0x3788, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_dat1.mmc3_dat1 */
-                       DRA7XX_CORE_IOPAD(0x378c, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_dat2.mmc3_dat2 */
-                       DRA7XX_CORE_IOPAD(0x3790, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_dat3.mmc3_dat3 */
+                       DRA7XX_CORE_IOPAD(0x377c, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_clk.mmc3_clk */
+                       DRA7XX_CORE_IOPAD(0x3780, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_cmd.mmc3_cmd */
+                       DRA7XX_CORE_IOPAD(0x3784, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_dat0.mmc3_dat0 */
+                       DRA7XX_CORE_IOPAD(0x3788, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_dat1.mmc3_dat1 */
+                       DRA7XX_CORE_IOPAD(0x378c, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_dat2.mmc3_dat2 */
+                       DRA7XX_CORE_IOPAD(0x3790, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_dat3.mmc3_dat3 */
                >;
        };
 
index f7f26d584f9e82b4378e2522b0201ef24ace3612..a073ea25f51b80e9fd06bde1e203c9f4abb45ec7 100644 (file)
@@ -5,6 +5,11 @@
 
 #include "rk3399-u-boot.dtsi"
 #include "rk3399-sdram-lpddr4-100.dtsi"
+/ {
+       chosen {
+               u-boot,spl-boot-order = "same-as-spl", &sdmmc, &sdhci;
+       };
+};
 
 &vdd_log {
        regulator-init-microvolt = <950000>;
index 3dca50f776befbd83ce7e626318dc191378aac41..c1502409626259830d94e0e4eaf07a617afd72ac 100644 (file)
 #define gpio_status()          gpio_info()
 #endif
 #define GPIO_NAME_SIZE         20
-#if !defined(CONFIG_SOC_DA850)
-#define MAX_NUM_GPIOS          128
-#else
 #define MAX_NUM_GPIOS          144
-#endif
 #define GPIO_BANK(gp)          (davinci_gpio_bank01 + ((gp) >> 5))
 
 void gpio_info(void);
index 6558fe0ef4bc055e2f282991c7588d52116d7688..0b564f7bd16647134a9e84be1044c9fa2e887b1f 100644 (file)
@@ -219,10 +219,9 @@ u32 spl_boot_device(void)
 
 void release_resources_for_core_shutdown(void)
 {
-       struct udevice *dev;
-       struct ti_sci_handle *ti_sci;
-       struct ti_sci_dev_ops *dev_ops;
-       struct ti_sci_proc_ops *proc_ops;
+       struct ti_sci_handle *ti_sci = get_ti_sci_handle();
+       struct ti_sci_dev_ops *dev_ops = &ti_sci->ops.dev_ops;
+       struct ti_sci_proc_ops *proc_ops = &ti_sci->ops.proc_ops;
        int ret;
        u32 i;
 
@@ -231,15 +230,6 @@ void release_resources_for_core_shutdown(void)
                AM6_DEV_MCU_RTI1,
        };
 
-       /* Get handle to Device Management and Security Controller (SYSFW) */
-       ret = uclass_get_device_by_name(UCLASS_FIRMWARE, "dmsc", &dev);
-       if (ret)
-               panic("Failed to get handle to SYSFW (%d)\n", ret);
-
-       ti_sci = (struct ti_sci_handle *)(ti_sci_get_handle_from_sysfw(dev));
-       dev_ops = &ti_sci->ops.dev_ops;
-       proc_ops = &ti_sci->ops.proc_ops;
-
        /* Iterate through list of devices to put (shutdown) */
        for (i = 0; i < ARRAY_SIZE(put_device_ids); i++) {
                u32 id = put_device_ids[i];
index bab5ffdf403d9bc7b9e39d17a59e19787ffbfb58..3e36d90aceff0d9677b146c29ea5aaeb1c2f79a9 100644 (file)
@@ -20,7 +20,7 @@ struct ti_sci_handle *get_ti_sci_handle(void)
        struct udevice *dev;
        int ret;
 
-       ret = uclass_get_device_by_name(UCLASS_FIRMWARE, "dmsc", &dev);
+       ret = uclass_get_device(UCLASS_FIRMWARE, 0, &dev);
        if (ret)
                panic("Failed to get SYSFW (%d)\n", ret);
 
index 52f49bf01fe2a1c360f920a885ec933e64c54b62..4e011ee10ef7038839c006eba92eaa915ac9d5fa 100644 (file)
 #include <linux/soc/ti/ti_sci_protocol.h>
 #include <mach/spl.h>
 #include <spl.h>
+#include <asm/arch/sys_proto.h>
 
 void board_fit_image_post_process(void **p_image, size_t *p_size)
 {
-       struct udevice *dev;
-       struct ti_sci_handle *ti_sci;
-       struct ti_sci_proc_ops *proc_ops;
+       struct ti_sci_handle *ti_sci = get_ti_sci_handle();
+       struct ti_sci_proc_ops *proc_ops = &ti_sci->ops.proc_ops;
        u64 image_addr;
        u32 image_size;
        int ret;
 
-       /* Get handle to Device Management and Security Controller (SYSFW) */
-       ret = uclass_get_device_by_name(UCLASS_FIRMWARE, "dmsc", &dev);
-       if (ret) {
-               printf("Failed to get handle to SYSFW (%d)\n", ret);
-               hang();
-       }
-       ti_sci = (struct ti_sci_handle *)(ti_sci_get_handle_from_sysfw(dev));
-       proc_ops = &ti_sci->ops.proc_ops;
-
        image_addr = (uintptr_t)*p_image;
 
        debug("Authenticating image at address 0x%016llx\n", image_addr);
index 207f9000110db46b5f7fae6978b9b94a51a60d6b..45d9b06233fdc347e0d3dd809c165034d7a97d51 100644 (file)
@@ -1,6 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0+
 #
 # Copyright (c) 2014 Google, Inc
+# Copyright (c) 2019 Rockchip Electronics Co., Ltd.
 
 # We don't want the bootrom-helper present in a full U-Boot build, as
 # this may have entered from ATF with the stack-pointer pointing to
@@ -21,19 +22,14 @@ ifeq ($(CONFIG_SPL_BUILD)$(CONFIG_TPL_BUILD),)
 # meaning "turn it off".
 obj-y += boot_mode.o
 obj-$(CONFIG_ROCKCHIP_COMMON_BOARD) += board.o
+obj-$(CONFIG_MISC_INIT_R) += misc.o
 endif
 
 obj-$(CONFIG_$(SPL_TPL_)RAM) += sdram_common.o
 
-ifdef CONFIG_MISC_INIT_R
-obj-y += misc.o
-endif
-
 obj-$(CONFIG_ROCKCHIP_RK3036) += rk3036/
 obj-$(CONFIG_ROCKCHIP_RK3128) += rk3128/
-ifndef CONFIG_TPL_BUILD
 obj-$(CONFIG_ROCKCHIP_RK3188) += rk3188/
-endif
 obj-$(CONFIG_ROCKCHIP_RK322X) += rk322x/
 obj-$(CONFIG_ROCKCHIP_RK3288) += rk3288/
 obj-$(CONFIG_ROCKCHIP_RK3328) += rk3328/
index d62d285e606d309930dea116155e3229a8b520cb..23fec6649293b51acc27c9bf321f443acf2ed4bc 100644 (file)
@@ -6,4 +6,4 @@
 # (C) Copyright 2007
 # Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
 #
-PLATFORM_CPPFLAGS += -m4-nofpu
+PLATFORM_CPPFLAGS += $(call cc-option,-m4-nofpu,-m4)
index 47302da252a9311369d50b4d3df7b8f32edeb9f5..4cc97737f1c97e0ad6811f633460cbf20bfb80a1 100644 (file)
@@ -25,6 +25,7 @@ ENTRY(_start)
 
 SECTIONS
 {
+       . = CONFIG_SYS_TEXT_BASE;
        reloc_dst = .;
 
        PROVIDE (_ftext = .);
index ecaf0772d8fee550eb68b94203761a7e9e6b42db..efaeb33e360f3eb1f43b9189085eb03d4f2d8cc5 100644 (file)
@@ -21,6 +21,7 @@
                #size-cells = <2>;
                #interrupt-cells = <1>;
                ranges = <0x01000000 0 0xfe240000 0 0xfe240000 0 0x00040000
-                         0x02000000 0 0xfd000000 0 0xfd000000 0 0x01000000>;
+                         0x02000000 0 0xfd000000 0 0xfd000000 0 0x01000000
+                         0x42000000 0 0x0c000000 0 0x8c000000 0 0x04000000>;
        };
 };
index d640f89845074bd60c591fde95e15aef6abf0815..5ce5164e49965d606a70647937e3d8d6ec7faa7f 100644 (file)
@@ -1,5 +1,5 @@
 MPC8536DS BOARD
-M:     Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
+M:     Priyanka Jain <priyanka.jain@nxp.com>
 S:     Maintained
 F:     board/freescale/mpc8536ds/
 F:     include/configs/MPC8536DS.h
index 100077608bb30d388bdf2c966ebdb13c09e4f28a..cf3b9cf5f723acb5a3a62de7989eaadc18d133f9 100644 (file)
@@ -1,5 +1,5 @@
 MPC8541CDS BOARD
-M:     Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
+M:     Priyanka Jain <priyanka.jain@nxp.com>
 S:     Maintained
 F:     board/freescale/mpc8541cds/
 F:     include/configs/MPC8541CDS.h
index 78019fbfea7832a73aeb16e2e20b849f13b63983..74e7249e4734cb95b268bb4d2e42062179aa02c9 100644 (file)
@@ -1,5 +1,5 @@
 MPC8544DS BOARD
-M:     Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
+M:     Priyanka Jain <priyanka.jain@nxp.com>
 S:     Maintained
 F:     board/freescale/mpc8544ds/
 F:     include/configs/MPC8544DS.h
index 385dc85576c6539c23dd0818b4a966d96a20c2c0..fbbedb1d1d19fe289a12cb20e29c7dc071a261f1 100644 (file)
@@ -1,5 +1,5 @@
 MPC8548CDS BOARD
-M:     Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
+M:     Priyanka Jain <priyanka.jain@nxp.com>
 S:     Maintained
 F:     board/freescale/mpc8548cds/
 F:     include/configs/MPC8548CDS.h
index 815cffec1b71047b63729e379d6f584a361937cd..8f32febd9147a3cd5baca0a6a9fe2a181c2243b8 100644 (file)
@@ -1,5 +1,5 @@
 MPC8555CDS BOARD
-M:     Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
+M:     Priyanka Jain <priyanka.jain@nxp.com>
 S:     Maintained
 F:     board/freescale/mpc8555cds/
 F:     include/configs/MPC8555CDS.h
index 79f04d1a90fe3c9ed7f5b38e95c983d6e58ca95a..f4747866d2bd9c80cd385a6f4ba84788d86f53fc 100644 (file)
@@ -1,5 +1,5 @@
 MPC8568MDS BOARD
-M:     Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
+M:     Priyanka Jain <priyanka.jain@nxp.com>
 S:     Maintained
 F:     board/freescale/mpc8568mds/
 F:     include/configs/MPC8568MDS.h
index b2e3bdfa11412999b888df6d34a5fae1c0a5619a..9df3f3cca8f1c9bcf22fa36b0794096acdaa60cf 100644 (file)
@@ -1,5 +1,5 @@
 MPC8569MDS BOARD
-M:     Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
+M:     Priyanka Jain <priyanka.jain@nxp.com>
 S:     Maintained
 F:     board/freescale/mpc8569mds/
 F:     include/configs/MPC8569MDS.h
index 80a309665318163f3d8cd75c21337e294959580d..d7e9b1f41f411eab155e0520492d1c99d709abe4 100644 (file)
@@ -1,5 +1,5 @@
 MPC8572DS BOARD
-M:     Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
+M:     Priyanka Jain <priyanka.jain@nxp.com>
 S:     Maintained
 F:     board/freescale/mpc8572ds/
 F:     include/configs/MPC8572DS.h
index 633c5ed192dae66958d23107404f169a08d63fe8..9b1e0cd4e56b77e72a20da5e494131a0141b693d 100644 (file)
@@ -1,5 +1,5 @@
 MPC8610HPCD BOARD
-M:     Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
+M:     Priyanka Jain <priyanka.jain@nxp.com>
 S:     Maintained
 F:     board/freescale/mpc8610hpcd/
 F:     include/configs/MPC8610HPCD.h
index 827bb79aef6720532d810e62601e65c7810d84b0..c9572187675185b2d01672b2279a3c80fb0b61ab 100644 (file)
@@ -1,5 +1,5 @@
 MPC8641HPCN BOARD
-M:     Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
+M:     Priyanka Jain <priyanka.jain@nxp.com>
 S:     Maintained
 F:     board/freescale/mpc8641hpcn/
 F:     include/configs/MPC8641HPCN.h
index 83e4332984303c24c7f8199f4de93c855b30fcbb..ad3ac93bd44b6f7a4531c3ec869d7daf9dabfb8e 100644 (file)
@@ -18,8 +18,6 @@ Build the TPL/SPL stage
 =======================
 
   > make CROSS_COMPILE=aarch64-unknown-elf- ARCH=arm
-  > tools/mkimage -n rk3368 -T rksd -d tpl/u-boot-tpl.bin spl-3368.img
-  > cat spl/u-boot-spl-dtb.bin >> spl-3368.img
 
 Build the full U-Boot and a FIT image including the ATF
 =======================================================
@@ -35,7 +33,7 @@ Copy the SPL to offset 32k and the FIT image containing the payloads
 SD-Card
 -------
 
-  > dd if=spl-3368.img of=/dev/sdb seek=64
+  > dd if=idbloader.img of=/dev/sdb seek=64
   > dd if=u-boot.itb of=/dev/sdb seek=512
 
 eMMC
index b70f614d244f56a2ea2c29b007f45158dc92818c..d9bcb5a57e89f5922aaba1e353a120d82490ef34 100644 (file)
@@ -192,12 +192,15 @@ int usb_disable_asynch(int disable)
  */
 
 /*
- * submits an Interrupt Message
+ * submits an Interrupt Message. Some drivers may implement non-blocking
+ * polling: when non-block is true and the device is not responding return
+ * -EAGAIN instead of waiting for device to respond.
  */
-int usb_submit_int_msg(struct usb_device *dev, unsigned long pipe,
-                       void *buffer, int transfer_len, int interval)
+int usb_int_msg(struct usb_device *dev, unsigned long pipe,
+               void *buffer, int transfer_len, int interval, bool nonblock)
 {
-       return submit_int_msg(dev, pipe, buffer, transfer_len, interval);
+       return submit_int_msg(dev, pipe, buffer, transfer_len, interval,
+                             nonblock);
 }
 
 /*
index 387373746147dff2e22b99860b37c6fcc405d2b8..d178af248af0d5ad0b93892f00ec2dc778fbbb63 100644 (file)
@@ -340,10 +340,9 @@ static inline void usb_kbd_poll_for_event(struct usb_device *dev)
        struct usb_kbd_pdata *data = dev->privptr;
 
        /* Submit a interrupt transfer request */
-       usb_submit_int_msg(dev, data->intpipe, &data->new[0], data->intpktsize,
-                          data->intinterval);
-
-       usb_kbd_irq_worker(dev);
+       if (usb_int_msg(dev, data->intpipe, &data->new[0],
+                       data->intpktsize, data->intinterval, true) >= 0)
+               usb_kbd_irq_worker(dev);
 #elif defined(CONFIG_SYS_USB_EVENT_POLL_VIA_CONTROL_EP) || \
       defined(CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE)
 #if defined(CONFIG_SYS_USB_EVENT_POLL_VIA_CONTROL_EP)
@@ -505,8 +504,8 @@ static int usb_kbd_probe_dev(struct usb_device *dev, unsigned int ifnum)
        if (usb_get_report(dev, iface->desc.bInterfaceNumber,
                           1, 0, data->new, USB_KBD_BOOT_REPORT_SIZE) < 0) {
 #else
-       if (usb_submit_int_msg(dev, data->intpipe, data->new, data->intpktsize,
-                              data->intinterval) < 0) {
+       if (usb_int_msg(dev, data->intpipe, data->new, data->intpktsize,
+                       data->intinterval, false) < 0) {
 #endif
                printf("Failed to get keyboard state from device %04x:%04x\n",
                       dev->descriptor.idVendor, dev->descriptor.idProduct);
index 8c889bb1a64856060196b87daf23e3365c2a0260..54f8e53c63076cec6dc5a5ba27b746c9edec1908 100644 (file)
@@ -650,8 +650,8 @@ static int usb_stor_CBI_get_status(struct scsi_cmd *srb, struct us_data *us)
        int timeout;
 
        us->ip_wanted = 1;
-       submit_int_msg(us->pusb_dev, us->irqpipe,
-                       (void *) &us->ip_data, us->irqmaxp, us->irqinterval);
+       usb_int_msg(us->pusb_dev, us->irqpipe,
+                   (void *)&us->ip_data, us->irqmaxp, us->irqinterval, false);
        timeout = 1000;
        while (timeout--) {
                if (us->ip_wanted == 0)
index 87547ed9abf796910db807a7e91ab6bb01e6bc85..28c92f9106cb953e95cef1117ba2409b4123808c 100644 (file)
@@ -19,7 +19,7 @@ CONFIG_FIT_IMAGE_POST_PROCESS=y
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_SPL_FIT_IMAGE_POST_PROCESS=y
 CONFIG_OF_BOARD_SETUP=y
-CONFIG_BOOTCOMMAND="run findfdt; run envboot; run init_${boot}; run get_kern_${boot}; run get_fdt_${boot}; run get_overlay_${boot}; run run_kern"
+CONFIG_BOOTCOMMAND="run findfdt; run envboot; run init_${boot}; run get_fit_${boot}; run get_overlaystring; run run_fit"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_SPL_TEXT_BASE=0x80080000
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
index 214a054ac48764984f689de54a6fa9de90636fd9..44d727f58f4d9fa77bef0d84a0a655e985e76176 100644 (file)
@@ -32,6 +32,8 @@ CONFIG_SPL_POWER_SUPPORT=y
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SYS_SPI_U_BOOT_OFFS=0x40000
 CONFIG_SYS_PROMPT="CM-T43 # "
+CONFIG_OF_CONTROL=y
+CONFIG_DEFAULT_DEVICE_TREE="am437x-cm-t43"
 CONFIG_CMD_ASKENV=y
 CONFIG_CMD_EEPROM=y
 CONFIG_CMD_EEPROM_LAYOUT=y
@@ -52,9 +54,13 @@ CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
 CONFIG_DM=y
 CONFIG_DM_GPIO=y
+CONFIG_BLK=y
+CONFIG_DM_MMC=y
 CONFIG_MMC_OMAP_HS=y
 CONFIG_NAND=y
+CONFIG_DM_SPI=y
 CONFIG_SPI_FLASH=y
+CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=48000000
 CONFIG_SPI_FLASH_ATMEL=y
 CONFIG_SPI_FLASH_EON=y
@@ -70,6 +76,7 @@ CONFIG_DM_SERIAL=y
 CONFIG_SPI=y
 CONFIG_OMAP3_SPI=y
 CONFIG_USB=y
+CONFIG_DM_USB=y
 CONFIG_USB_XHCI_HCD=y
 CONFIG_USB_XHCI_DWC3=y
 CONFIG_OMAP_USB_PHY=y
index d2342c37cff1e4ab309675cba5c6dcb6dd2959ef..a8d09f40d0f152a9a84e7861123bf85ddccc315d 100644 (file)
@@ -25,9 +25,10 @@ CONFIG_HUSH_PARSER=y
 CONFIG_CRC32_VERIFY=y
 # CONFIG_CMD_EEPROM is not set
 CONFIG_MX_CYCLIC=y
+CONFIG_CMD_DM=y
 # CONFIG_CMD_FLASH is not set
-# CONFIG_CMD_GPIO is not set
 CONFIG_CMD_NAND=y
+# CONFIG_CMD_PINMUX is not set
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_CMD_MTDPARTS=y
 CONFIG_CMD_DIAG=y
@@ -40,6 +41,8 @@ CONFIG_ENV_IS_IN_NAND=y
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_DM=y
 CONFIG_SPL_DM=y
+CONFIG_DM_GPIO=y
+CONFIG_DA8XX_GPIO=y
 CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_DAVINCI=y
 CONFIG_DM_MMC=y
@@ -56,11 +59,14 @@ CONFIG_MII=y
 CONFIG_DRIVER_TI_EMAC=y
 CONFIG_PHY=y
 CONFIG_PHY_DA8XX_USB=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_SINGLE=y
 CONFIG_SPECIFY_CONSOLE_INDEX=y
 CONFIG_DM_SERIAL=y
 CONFIG_SYS_NS16550=y
 CONFIG_USB=y
 CONFIG_DM_USB=y
+# CONFIG_SPL_DM_USB is not set
 CONFIG_USB_OHCI_HCD=y
 CONFIG_USB_OHCI_DA8XX=y
 CONFIG_USB_MUSB_HOST=y
index b2334affc3e878b17479786fc73a2ea9883a4e5f..e10ac939c5b9354470091efd2dcd72bc3769f69e 100644 (file)
@@ -12,6 +12,7 @@ CONFIG_CMD_DM=y
 CONFIG_CMD_IDE=y
 CONFIG_CMD_PCI=y
 # CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_DHCP=y
 CONFIG_CMD_PING=y
 CONFIG_CMD_CACHE=y
 CONFIG_CMD_EXT2=y
index 531a062c9ec8e2ed546ef072b045371d2b993d02..d17afeabdd2c646720bdfc483a1f92753a152b43 100644 (file)
@@ -275,9 +275,7 @@ As of now TPL is added on Vyasa-RK3288 board.
 
 To write an image that boots from an SD card (assumed to be /dev/mmcblk0):
 
-   ./tools/mkimage -n rk3288 -T rksd -d ./tpl/u-boot-tpl.bin out &&
-    cat ./spl/u-boot-spl-dtb.bin >> out &&
-    sudo dd if=out of=/dev/mmcblk0 seek=64 &&
+    sudo dd if=idbloader.img of=/dev/mmcblk0 seek=64 &&
     sudo dd if=u-boot-dtb.img of=/dev/mmcblk0 seek=16384
 
 Booting from an SD card on RK3188
@@ -310,11 +308,6 @@ Booting from an SD card on Pine64 Rock64 (RK3328)
 For Rock64 rk3328 board the following three parts are required:
 TPL, SPL, and the u-boot image tree blob.
 
-  - Create TPL/SPL image
-
-    => tools/mkimage -n rk3328 -T rksd -d tpl/u-boot-tpl.bin idbloader.img
-    => cat spl/u-boot-spl.bin >> idbloader.img
-
   - Write TPL/SPL image at 64 sector
 
     => sudo dd if=idbloader.img of=/dev/mmcblk0 seek=64
@@ -473,19 +466,9 @@ Hit any key to stop autoboot:  0
 
 Option 3: Package the image with TPL:
 
-  - Prefix rk3399 header to TPL image
-
-    => cd /path/to/u-boot
-    => ./tools/mkimage -n rk3399 -T rksd -d tpl/u-boot-tpl-dtb.bin out
-
-  - Concatinate tpl with spl
-
-    => cd /path/to/u-boot
-    => cat ./spl/u-boot-spl-dtb.bin >> out
-
   - Write tpl+spl at 64th sector
 
-    => sudo dd if=out of=/dev/sdc seek=64
+    => sudo dd if=idbloader.img of=/dev/sdc seek=64
 
   - Write U-Boot proper at 16384 sector
 
index 75b85235ef38a6250ea395fa78c7b04c5ada510e..fd499fb74a84b9546138c84f5ad641c30367d256 100644 (file)
@@ -58,10 +58,8 @@ to move the migration with in the deadline.
 
 No dm conversion yet::
 
-       drivers/spi/cf_spi.c
        drivers/spi/fsl_espi.c
        drivers/spi/lpc32xx_ssp.c
-       drivers/spi/mxs_spi.c
        drivers/spi/sh_spi.c
        drivers/spi/soft_spi_legacy.c
 
@@ -74,6 +72,7 @@ Partially converted::
        drivers/spi/fsl_dspi.c
        drivers/spi/kirkwood_spi.c
        drivers/spi/mxc_spi.c
+       drivers/spi/mxs_spi.c
        drivers/spi/omap3_spi.c
        drivers/spi/sh_qspi.c
 
index 1d36f5845ae1afd893141e96e956d23d29675b9b..6f383b1f60519967924e4220cbd740a158c8693f 100644 (file)
@@ -46,7 +46,7 @@ alias smcnutt        Scott McNutt <smcnutt@psyent.com>
 alias stroese        Stefan Roese <sr@denx.de>
 alias trini          Tom Rini <trini@konsulko.com>
 alias wd             Wolfgang Denk <wd@denx.de>
-alias prabhu_kush    Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
+alias priyankajain   Priyanka Jain <priyanka.jain@nxp.com>
 
 # Architecture aliases
 alias arch           arc, arm, m68k, microblaze, mips, nds32, nios2, powerpc, sandbox, superh, x86
@@ -91,12 +91,12 @@ alias nds32          uboot, macpaul
 alias nios           uboot, Thomas Chou <thomas@wytron.com.tw>, smcnutt
 alias nios2          nios
 
-alias powerpc        uboot, afleming, stroese, wd, prabhu_kush, mariosix
+alias powerpc        uboot, afleming, stroese, wd, priyankajain, mariosix
 alias ppc            powerpc
 alias mpc8xx         uboot, wd, Christophe Leroy <christophe.leroy@c-s.fr>
 alias mpc83xx        uboot, mariosix
-alias mpc85xx        uboot, afleming, prabhu_kush
-alias mpc86xx        uboot, afleming, prabhu_kush
+alias mpc85xx        uboot, afleming, priyankajain
+alias mpc86xx        uboot, afleming, priyankajain
 
 alias sandbox        sjg
 alias sb             sandbox
index 375d7f8acbbb306e87aa963fa8e3a893c4e30bff..01223816337660386bc5f163c30c1e1b6caf3412 100644 (file)
@@ -940,35 +940,12 @@ static int __maybe_unused rk3288_clk_set_parent(struct clk *clk, struct clk *par
        return -ENOENT;
 }
 
-static int rk3288_clk_enable(struct clk *clk)
-{
-       switch (clk->id) {
-       case HCLK_USBHOST0:
-       case HCLK_HSIC:
-               return 0;
-
-       case SCLK_MAC:
-       case SCLK_MAC_RX:
-       case SCLK_MAC_TX:
-       case SCLK_MACREF:
-       case SCLK_MACREF_OUT:
-       case ACLK_GMAC:
-       case PCLK_GMAC:
-               /* Required to successfully probe the Designware GMAC driver */
-               return 0;
-       }
-
-       debug("%s: unsupported clk %ld\n", __func__, clk->id);
-       return -ENOENT;
-}
-
 static struct clk_ops rk3288_clk_ops = {
        .get_rate       = rk3288_clk_get_rate,
        .set_rate       = rk3288_clk_set_rate,
 #if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
        .set_parent     = rk3288_clk_set_parent,
 #endif
-       .enable = rk3288_clk_enable,
 };
 
 static int rk3288_clk_ofdata_to_platdata(struct udevice *dev)
index 5957a00402d657fae85d369fb35d1474dd662f42..a89e2ecc4ad6651cc73764448eb261d2a2d6a5e6 100644 (file)
@@ -745,22 +745,10 @@ static int rk3328_clk_set_parent(struct clk *clk, struct clk *parent)
        return -ENOENT;
 }
 
-static int rk3328_clk_enable(struct clk *clk)
-{
-       switch (clk->id) {
-       case HCLK_HOST0:
-               /* Required to successfully probe the ehci generic driver */
-               return 0;
-       }
-
-       return -ENOENT;
-}
-
 static struct clk_ops rk3328_clk_ops = {
        .get_rate = rk3328_clk_get_rate,
        .set_rate = rk3328_clk_set_rate,
        .set_parent = rk3328_clk_set_parent,
-       .enable = rk3328_clk_enable,
 };
 
 static int rk3328_clk_probe(struct udevice *dev)
index 89cbae59c5e0ca1eb58fc4c0a9394354e9176bcf..c1a867b2eded7fb355ef72233584c979e08580f7 100644 (file)
@@ -566,31 +566,12 @@ static int __maybe_unused rk3368_clk_set_parent(struct clk *clk, struct clk *par
        return -ENOENT;
 }
 
-static int rk3368_clk_enable(struct clk *clk)
-{
-       switch (clk->id) {
-       case SCLK_MAC:
-       case SCLK_MAC_RX:
-       case SCLK_MAC_TX:
-       case SCLK_MACREF:
-       case SCLK_MACREF_OUT:
-       case ACLK_GMAC:
-       case PCLK_GMAC:
-               /* Required to successfully probe the Designware GMAC driver */
-               return 0;
-       }
-
-       debug("%s: unsupported clk %ld\n", __func__, clk->id);
-       return -ENOENT;
-}
-
 static struct clk_ops rk3368_clk_ops = {
        .get_rate = rk3368_clk_get_rate,
        .set_rate = rk3368_clk_set_rate,
 #if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
        .set_parent = rk3368_clk_set_parent,
 #endif
-       .enable = rk3368_clk_enable,
 };
 
 static int rk3368_clk_probe(struct udevice *dev)
index d9950c159bd697da9f18cc6f178669b2c10f82df..a273bd1bebe476164a2356a3ed03aba993d3f30b 100644 (file)
@@ -1062,49 +1062,12 @@ static int __maybe_unused rk3399_clk_set_parent(struct clk *clk,
        return -ENOENT;
 }
 
-static int rk3399_clk_enable(struct clk *clk)
-{
-       switch (clk->id) {
-       case HCLK_HOST0:
-       case HCLK_HOST0_ARB:
-       case HCLK_HOST1:
-       case HCLK_HOST1_ARB:
-               return 0;
-
-       case SCLK_MAC:
-       case SCLK_MAC_RX:
-       case SCLK_MAC_TX:
-       case SCLK_MACREF:
-       case SCLK_MACREF_OUT:
-       case ACLK_GMAC:
-       case PCLK_GMAC:
-               /* Required to successfully probe the Designware GMAC driver */
-               return 0;
-
-       case SCLK_USB3OTG0_REF:
-       case SCLK_USB3OTG1_REF:
-       case SCLK_USB3OTG0_SUSPEND:
-       case SCLK_USB3OTG1_SUSPEND:
-       case ACLK_USB3OTG0:
-       case ACLK_USB3OTG1:
-       case ACLK_USB3_RKSOC_AXI_PERF:
-       case ACLK_USB3:
-       case ACLK_USB3_GRF:
-               /* Required to successfully probe the Designware USB3 driver */
-               return 0;
-       }
-
-       debug("%s: unsupported clk %ld\n", __func__, clk->id);
-       return -ENOENT;
-}
-
 static struct clk_ops rk3399_clk_ops = {
        .get_rate = rk3399_clk_get_rate,
        .set_rate = rk3399_clk_set_rate,
 #if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
        .set_parent = rk3399_clk_set_parent,
 #endif
-       .enable = rk3399_clk_enable,
 };
 
 #ifdef CONFIG_SPL_BUILD
index f99f6cb16e2969f91c693b7eef92382f87d71596..20db1015d9ed6323af60bf818051f1296c1a7775 100644 (file)
@@ -18,6 +18,6 @@ spi-nor-y += spi-nor-core.o
 endif
 
 obj-$(CONFIG_SPI_FLASH) += spi-nor.o
-obj-$(CONFIG_SPI_FLASH_DATAFLASH) += sf_dataflash.o sf.o
+obj-$(CONFIG_SPI_FLASH_DATAFLASH) += sf_dataflash.o
 obj-$(CONFIG_SPI_FLASH_MTD) += sf_mtd.o
 obj-$(CONFIG_SPI_FLASH_SANDBOX) += sandbox.o
diff --git a/drivers/mtd/spi/sf.c b/drivers/mtd/spi/sf.c
deleted file mode 100644 (file)
index ee3cf8b..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * SPI flash interface
- *
- * Copyright (C) 2008 Atmel Corporation
- * Copyright (C) 2010 Reinhard Meyer, EMK Elektronik
- */
-
-#include <common.h>
-#include <spi.h>
-
-static int spi_flash_read_write(struct spi_slave *spi,
-                               const u8 *cmd, size_t cmd_len,
-                               const u8 *data_out, u8 *data_in,
-                               size_t data_len)
-{
-       unsigned long flags = SPI_XFER_BEGIN;
-       int ret;
-
-       if (data_len == 0)
-               flags |= SPI_XFER_END;
-
-       ret = spi_xfer(spi, cmd_len * 8, cmd, NULL, flags);
-       if (ret) {
-               debug("SF: Failed to send command (%zu bytes): %d\n",
-                     cmd_len, ret);
-       } else if (data_len != 0) {
-               ret = spi_xfer(spi, data_len * 8, data_out, data_in,
-                                       SPI_XFER_END);
-               if (ret)
-                       debug("SF: Failed to transfer %zu bytes of data: %d\n",
-                             data_len, ret);
-       }
-
-       return ret;
-}
-
-int spi_flash_cmd_read(struct spi_slave *spi, const u8 *cmd,
-               size_t cmd_len, void *data, size_t data_len)
-{
-       return spi_flash_read_write(spi, cmd, cmd_len, NULL, data, data_len);
-}
-
-int spi_flash_cmd(struct spi_slave *spi, u8 cmd, void *response, size_t len)
-{
-       return spi_flash_cmd_read(spi, &cmd, 1, response, len);
-}
-
-int spi_flash_cmd_write(struct spi_slave *spi, const u8 *cmd, size_t cmd_len,
-               const void *data, size_t data_len)
-{
-       return spi_flash_read_write(spi, cmd, cmd_len, data, NULL, data_len);
-}
index b6a2631747a9d89aea718b5f20eb2b62ec1e4e2c..55fb4bd31ac1df1db0d162b3c18174968abc3d20 100644 (file)
@@ -76,12 +76,14 @@ struct dataflash {
 static inline int dataflash_status(struct spi_slave *spi)
 {
        int ret;
+       u8 opcode = OP_READ_STATUS;
        u8 status;
+
        /*
         * NOTE:  at45db321c over 25 MHz wants to write
         * a dummy byte after the opcode...
         */
-       ret = spi_flash_cmd(spi, OP_READ_STATUS, &status, 1);
+       ret =  spi_write_then_read(spi, &opcode, 1, NULL, &status, 1);
        return ret ? -EIO : status;
 }
 
@@ -173,7 +175,7 @@ static int spi_dataflash_erase(struct udevice *dev, u32 offset, size_t len)
                      command[0], command[1], command[2], command[3],
                      pageaddr);
 
-               status = spi_flash_cmd_write(spi, command, 4, NULL, 0);
+               status = spi_write_then_read(spi, command, 4, NULL, NULL, 0);
                if (status < 0) {
                        debug("%s: erase send command error!\n", dev->name);
                        return -EIO;
@@ -248,7 +250,7 @@ static int spi_dataflash_read(struct udevice *dev, u32 offset, size_t len,
        command[3] = (uint8_t)(addr >> 0);
 
        /* plus 4 "don't care" bytes, command len: 4 + 4 "don't care" bytes */
-       status = spi_flash_cmd_read(spi, command, 8, buf, len);
+       status = spi_write_then_read(spi, command, 8, NULL, buf, len);
 
        spi_release_bus(spi);
 
@@ -327,7 +329,8 @@ int spi_dataflash_write(struct udevice *dev, u32 offset, size_t len,
                        debug("TRANSFER: (%x) %x %x %x\n",
                              command[0], command[1], command[2], command[3]);
 
-                       status = spi_flash_cmd_write(spi, command, 4, NULL, 0);
+                       status = spi_write_then_read(spi, command, 4,
+                                                    NULL, NULL, 0);
                        if (status < 0) {
                                debug("%s: write(<pagesize) command error!\n",
                                      dev->name);
@@ -352,8 +355,8 @@ int spi_dataflash_write(struct udevice *dev, u32 offset, size_t len,
                debug("PROGRAM: (%x) %x %x %x\n",
                      command[0], command[1], command[2], command[3]);
 
-               status = spi_flash_cmd_write(spi, command,
-                                            4, writebuf, writelen);
+               status = spi_write_then_read(spi, command, 4,
+                                            writebuf, NULL, writelen);
                if (status < 0) {
                        debug("%s: write send command error!\n", dev->name);
                        return -EIO;
@@ -376,8 +379,8 @@ int spi_dataflash_write(struct udevice *dev, u32 offset, size_t len,
                debug("COMPARE: (%x) %x %x %x\n",
                      command[0], command[1], command[2], command[3]);
 
-               status = spi_flash_cmd_write(spi, command,
-                                            4, writebuf, writelen);
+               status = spi_write_then_read(spi, command, 4,
+                                            writebuf, NULL, writelen);
                if (status < 0) {
                        debug("%s: write(compare) send command error!\n",
                              dev->name);
@@ -508,6 +511,7 @@ static struct data_flash_info *jedec_probe(struct spi_slave *spi)
        uint8_t                 id[5];
        uint32_t                jedec;
        struct data_flash_info  *info;
+       u8 opcode               = CMD_READ_ID;
        int status;
 
        /*
@@ -519,7 +523,7 @@ static struct data_flash_info *jedec_probe(struct spi_slave *spi)
         * That's not an error; only rev C and newer chips handle it, and
         * only Atmel sells these chips.
         */
-       tmp = spi_flash_cmd(spi, CMD_READ_ID, id, sizeof(id));
+       tmp = spi_write_then_read(spi, &opcode, 1, NULL, id, sizeof(id));
        if (tmp < 0) {
                printf("dataflash: error %d reading JEDEC ID\n", tmp);
                return ERR_PTR(tmp);
index a6bf734830a71956b8fdb292774cf6567a326672..bb8c19a31cf70df90de1d89e2a3fdad236354a56 100644 (file)
@@ -65,6 +65,7 @@ struct flash_info {
 #define NO_CHIP_ERASE          BIT(12) /* Chip does not support chip erase */
 #define SPI_NOR_SKIP_SFDP      BIT(13) /* Skip parsing of SFDP tables */
 #define USE_CLSR               BIT(14) /* use CLSR command */
+#define SPI_NOR_HAS_SST26LOCK  BIT(15) /* Flash supports lock/unlock via BPR */
 };
 
 extern const struct flash_info spi_nor_ids[];
@@ -72,24 +73,6 @@ extern const struct flash_info spi_nor_ids[];
 #define JEDEC_MFR(info)        ((info)->id[0])
 #define JEDEC_ID(info)         (((info)->id[1]) << 8 | ((info)->id[2]))
 
-/* Send a single-byte command to the device and read the response */
-int spi_flash_cmd(struct spi_slave *spi, u8 cmd, void *response, size_t len);
-
-/*
- * Send a multi-byte command to the device and read the response. Used
- * for flash array reads, etc.
- */
-int spi_flash_cmd_read(struct spi_slave *spi, const u8 *cmd,
-               size_t cmd_len, void *data, size_t data_len);
-
-/*
- * Send a multi-byte command to the device followed by (optional)
- * data. Used for programming the flash array, etc.
- */
-int spi_flash_cmd_write(struct spi_slave *spi, const u8 *cmd, size_t cmd_len,
-               const void *data, size_t data_len);
-
-
 /* Get software write-protect value (BP bits) */
 int spi_flash_cmd_get_sw_write_prot(struct spi_flash *flash);
 
index 1acff745d1a225e124ee6ec79bffeb3a86a21d16..990e39d7c2f6f50c72cfb99619ef83c3160cc391 100644 (file)
@@ -945,6 +945,177 @@ read_err:
 }
 
 #ifdef CONFIG_SPI_FLASH_SST
+/*
+ * sst26 flash series has its own block protection implementation:
+ * 4x   - 8  KByte blocks - read & write protection bits - upper addresses
+ * 1x   - 32 KByte blocks - write protection bits
+ * rest - 64 KByte blocks - write protection bits
+ * 1x   - 32 KByte blocks - write protection bits
+ * 4x   - 8  KByte blocks - read & write protection bits - lower addresses
+ *
+ * We'll support only per 64k lock/unlock so lower and upper 64 KByte region
+ * will be treated as single block.
+ */
+#define SST26_BPR_8K_NUM               4
+#define SST26_MAX_BPR_REG_LEN          (18 + 1)
+#define SST26_BOUND_REG_SIZE           ((32 + SST26_BPR_8K_NUM * 8) * SZ_1K)
+
+enum lock_ctl {
+       SST26_CTL_LOCK,
+       SST26_CTL_UNLOCK,
+       SST26_CTL_CHECK
+};
+
+static bool sst26_process_bpr(u32 bpr_size, u8 *cmd, u32 bit, enum lock_ctl ctl)
+{
+       switch (ctl) {
+       case SST26_CTL_LOCK:
+               cmd[bpr_size - (bit / 8) - 1] |= BIT(bit % 8);
+               break;
+       case SST26_CTL_UNLOCK:
+               cmd[bpr_size - (bit / 8) - 1] &= ~BIT(bit % 8);
+               break;
+       case SST26_CTL_CHECK:
+               return !!(cmd[bpr_size - (bit / 8) - 1] & BIT(bit % 8));
+       }
+
+       return false;
+}
+
+/*
+ * Lock, unlock or check lock status of the flash region of the flash (depending
+ * on the lock_ctl value)
+ */
+static int sst26_lock_ctl(struct spi_nor *nor, loff_t ofs, uint64_t len, enum lock_ctl ctl)
+{
+       struct mtd_info *mtd = &nor->mtd;
+       u32 i, bpr_ptr, rptr_64k, lptr_64k, bpr_size;
+       bool lower_64k = false, upper_64k = false;
+       u8 bpr_buff[SST26_MAX_BPR_REG_LEN] = {};
+       int ret;
+
+       /* Check length and offset for 64k alignment */
+       if ((ofs & (SZ_64K - 1)) || (len & (SZ_64K - 1))) {
+               dev_err(nor->dev, "length or offset is not 64KiB allighned\n");
+               return -EINVAL;
+       }
+
+       if (ofs + len > mtd->size) {
+               dev_err(nor->dev, "range is more than device size: %#llx + %#llx > %#llx\n",
+                       ofs, len, mtd->size);
+               return -EINVAL;
+       }
+
+       /* SST26 family has only 16 Mbit, 32 Mbit and 64 Mbit IC */
+       if (mtd->size != SZ_2M &&
+           mtd->size != SZ_4M &&
+           mtd->size != SZ_8M)
+               return -EINVAL;
+
+       bpr_size = 2 + (mtd->size / SZ_64K / 8);
+
+       ret = nor->read_reg(nor, SPINOR_OP_READ_BPR, bpr_buff, bpr_size);
+       if (ret < 0) {
+               dev_err(nor->dev, "fail to read block-protection register\n");
+               return ret;
+       }
+
+       rptr_64k = min_t(u32, ofs + len, mtd->size - SST26_BOUND_REG_SIZE);
+       lptr_64k = max_t(u32, ofs, SST26_BOUND_REG_SIZE);
+
+       upper_64k = ((ofs + len) > (mtd->size - SST26_BOUND_REG_SIZE));
+       lower_64k = (ofs < SST26_BOUND_REG_SIZE);
+
+       /* Lower bits in block-protection register are about 64k region */
+       bpr_ptr = lptr_64k / SZ_64K - 1;
+
+       /* Process 64K blocks region */
+       while (lptr_64k < rptr_64k) {
+               if (sst26_process_bpr(bpr_size, bpr_buff, bpr_ptr, ctl))
+                       return EACCES;
+
+               bpr_ptr++;
+               lptr_64k += SZ_64K;
+       }
+
+       /* 32K and 8K region bits in BPR are after 64k region bits */
+       bpr_ptr = (mtd->size - 2 * SST26_BOUND_REG_SIZE) / SZ_64K;
+
+       /* Process lower 32K block region */
+       if (lower_64k)
+               if (sst26_process_bpr(bpr_size, bpr_buff, bpr_ptr, ctl))
+                       return EACCES;
+
+       bpr_ptr++;
+
+       /* Process upper 32K block region */
+       if (upper_64k)
+               if (sst26_process_bpr(bpr_size, bpr_buff, bpr_ptr, ctl))
+                       return EACCES;
+
+       bpr_ptr++;
+
+       /* Process lower 8K block regions */
+       for (i = 0; i < SST26_BPR_8K_NUM; i++) {
+               if (lower_64k)
+                       if (sst26_process_bpr(bpr_size, bpr_buff, bpr_ptr, ctl))
+                               return EACCES;
+
+               /* In 8K area BPR has both read and write protection bits */
+               bpr_ptr += 2;
+       }
+
+       /* Process upper 8K block regions */
+       for (i = 0; i < SST26_BPR_8K_NUM; i++) {
+               if (upper_64k)
+                       if (sst26_process_bpr(bpr_size, bpr_buff, bpr_ptr, ctl))
+                               return EACCES;
+
+               /* In 8K area BPR has both read and write protection bits */
+               bpr_ptr += 2;
+       }
+
+       /* If we check region status we don't need to write BPR back */
+       if (ctl == SST26_CTL_CHECK)
+               return 0;
+
+       ret = nor->write_reg(nor, SPINOR_OP_WRITE_BPR, bpr_buff, bpr_size);
+       if (ret < 0) {
+               dev_err(nor->dev, "fail to write block-protection register\n");
+               return ret;
+       }
+
+       return 0;
+}
+
+static int sst26_unlock(struct spi_nor *nor, loff_t ofs, uint64_t len)
+{
+       return sst26_lock_ctl(nor, ofs, len, SST26_CTL_UNLOCK);
+}
+
+static int sst26_lock(struct spi_nor *nor, loff_t ofs, uint64_t len)
+{
+       return sst26_lock_ctl(nor, ofs, len, SST26_CTL_LOCK);
+}
+
+/*
+ * Returns EACCES (positive value) if region is locked, 0 if region is unlocked,
+ * and negative on errors.
+ */
+static int sst26_is_locked(struct spi_nor *nor, loff_t ofs, uint64_t len)
+{
+       /*
+        * is_locked function is used for check before reading or erasing flash
+        * region, so offset and length might be not 64k allighned, so adjust
+        * them to be 64k allighned as sst26_lock_ctl works only with 64k
+        * allighned regions.
+        */
+       ofs -= ofs & (SZ_64K - 1);
+       len = len & (SZ_64K - 1) ? (len & ~(SZ_64K - 1)) + SZ_64K : len;
+
+       return sst26_lock_ctl(nor, ofs, len, SST26_CTL_CHECK);
+}
+
 static int sst_write_byteprogram(struct spi_nor *nor, loff_t to, size_t len,
                                 size_t *retlen, const u_char *buf)
 {
@@ -2302,6 +2473,16 @@ int spi_nor_scan(struct spi_nor *nor)
 #endif
 
 #ifdef CONFIG_SPI_FLASH_SST
+       /*
+        * sst26 series block protection implementation differs from other
+        * series.
+        */
+       if (info->flags & SPI_NOR_HAS_SST26LOCK) {
+               nor->flash_lock = sst26_lock;
+               nor->flash_unlock = sst26_unlock;
+               nor->flash_is_locked = sst26_is_locked;
+       }
+
        /* sst nor chips use AAI word program */
        if (info->flags & SST_WRITE)
                mtd->_write = sst_write;
index a3920ba520e0eb9d414a0e2f5f913e0b52ab5b1e..6996c0a2864f9ef549035e02aa3dd73ee4fa2a41 100644 (file)
@@ -214,10 +214,10 @@ const struct flash_info spi_nor_ids[] = {
        { INFO("sst25wf040b", 0x621613, 0, 64 * 1024,  8, SECT_4K) },
        { INFO("sst25wf040",  0xbf2504, 0, 64 * 1024,  8, SECT_4K | SST_WRITE) },
        { INFO("sst25wf080",  0xbf2505, 0, 64 * 1024, 16, SECT_4K | SST_WRITE) },
-       { INFO("sst26vf064b", 0xbf2643, 0, 64 * 1024, 128, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
-       { INFO("sst26wf016",  0xbf2651, 0, 64 * 1024,  32, SECT_4K) },
-       { INFO("sst26wf032",  0xbf2622, 0, 64 * 1024,  64, SECT_4K) },
-       { INFO("sst26wf064",  0xbf2643, 0, 64 * 1024, 128, SECT_4K) },
+       { INFO("sst26vf064b", 0xbf2643, 0, 64 * 1024, 128, SECT_4K | SPI_NOR_HAS_SST26LOCK | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
+       { INFO("sst26wf016",  0xbf2651, 0, 64 * 1024,  32, SECT_4K | SPI_NOR_HAS_SST26LOCK) },
+       { INFO("sst26wf032",  0xbf2622, 0, 64 * 1024,  64, SECT_4K | SPI_NOR_HAS_SST26LOCK) },
+       { INFO("sst26wf064",  0xbf2643, 0, 64 * 1024, 128, SECT_4K | SPI_NOR_HAS_SST26LOCK) },
 #endif
 #ifdef CONFIG_SPI_FLASH_STMICRO                /* STMICRO */
        /* ST Microelectronics -- newer production may have feature updates */
index fcb84f7aa49b96c0fd21fc90f65d77f58ac3ef7f..64ebc0ba0030b06205bb1e34188a58529a583bd9 100644 (file)
@@ -366,8 +366,10 @@ void k3_nav_ringacc_ring_reset_dma(struct k3_nav_ring *ring, u32 occ)
        if (!ring || !(ring->flags & KNAV_RING_FLAG_BUSY))
                return;
 
-       if (!ring->parent->dma_ring_reset_quirk)
+       if (!ring->parent->dma_ring_reset_quirk) {
+               k3_nav_ringacc_ring_reset(ring);
                return;
+       }
 
        if (!occ)
                occ = ringacc_readl(&ring->rt->occ);
index f459c0a41138fe56fe4092637ad7fd86d898c6a8..8dd3213d485b492139fa8cc310255e7b0ac057a6 100644 (file)
@@ -419,7 +419,6 @@ config MXC_SPI
 
 config MXS_SPI
        bool "MXS SPI Driver"
-       depends on DEPRECATED
        help
          Enable the MXS SPI controller driver. This driver can be used
          on the i.MX23 and i.MX28 SoCs.
index feeafdceaa618680de3f41a5c8945b4e200a124a..99ad505f24e4daf3c964596a5fdb3a8667b1cc6c 100644 (file)
@@ -181,10 +181,9 @@ static int mvebu_spi_set_speed(struct udevice *bus, uint hz)
        data = readl(&reg->cfg);
 
        prescale = DIV_ROUND_UP(clk_get_rate(&plat->clk), hz);
-       if (prescale > 0x1f)
-               prescale = 0x1f;
-       else if (prescale > 0xf)
+       if (prescale > 0xf)
                prescale = 0x10 + (prescale + 1) / 2;
+       prescale = min(prescale, 0x1fu);
 
        data &= ~MVEBU_SPI_A3700_CLK_PRESCALE_MASK;
        data |= prescale & MVEBU_SPI_A3700_CLK_PRESCALE_MASK;
index b06883f9d0448bd026bee20eadcb4e54a10f5a3f..b80f810bd157ae464bd39a94f0d9bdab6f66b86b 100644 (file)
@@ -215,8 +215,8 @@ static int soft_spi_probe(struct udevice *dev)
        int cs_flags, clk_flags;
        int ret;
 
-       cs_flags = (slave->mode & SPI_CS_HIGH) ? 0 : GPIOD_ACTIVE_LOW;
-       clk_flags = (slave->mode & SPI_CPOL) ? GPIOD_ACTIVE_LOW : 0;
+       cs_flags = (slave && slave->mode & SPI_CS_HIGH) ? 0 : GPIOD_ACTIVE_LOW;
+       clk_flags = (slave && slave->mode & SPI_CPOL) ? GPIOD_ACTIVE_LOW : 0;
 
        if (gpio_request_by_name(dev, "cs-gpios", 0, &plat->cs,
                                 GPIOD_IS_OUT | cs_flags) ||
index 88cb2a126227156d18342796d4022f25c3aefbba..76c4b53c165c764e496a40c101e6e34c65b8a887 100644 (file)
@@ -108,6 +108,30 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen,
        return dm_spi_xfer(slave->dev, bitlen, dout, din, flags);
 }
 
+int spi_write_then_read(struct spi_slave *slave, const u8 *opcode,
+                       size_t n_opcode, const u8 *txbuf, u8 *rxbuf,
+                       size_t n_buf)
+{
+       unsigned long flags = SPI_XFER_BEGIN;
+       int ret;
+
+       if (n_buf == 0)
+               flags |= SPI_XFER_END;
+
+       ret = spi_xfer(slave, n_opcode * 8, opcode, NULL, flags);
+       if (ret) {
+               debug("spi: failed to send command (%zu bytes): %d\n",
+                     n_opcode, ret);
+       } else if (n_buf != 0) {
+               ret = spi_xfer(slave, n_buf * 8, txbuf, rxbuf, SPI_XFER_END);
+               if (ret)
+                       debug("spi: failed to transfer %zu bytes of data: %d\n",
+                             n_buf, ret);
+       }
+
+       return ret;
+}
+
 #if !CONFIG_IS_ENABLED(OF_PLATDATA)
 static int spi_child_post_bind(struct udevice *dev)
 {
index 635945179efcc038965407fd4709202282d9589c..dc43880d27e69bc9882ddd3847303bd4e9544b91 100644 (file)
@@ -178,7 +178,8 @@ static int sandbox_keyb_control(struct udevice *dev, struct usb_device *udev,
 }
 
 static int sandbox_keyb_interrupt(struct udevice *dev, struct usb_device *udev,
-               unsigned long pipe, void *buffer, int length, int interval)
+               unsigned long pipe, void *buffer, int length, int interval,
+               bool nonblock)
 {
        struct sandbox_keyb_priv *priv = dev_get_priv(dev);
        uint8_t *data = buffer;
index 973981545b91a23c71004c45f5744e7e48148bed..50da6bda8e4eda036aae71bdd04727840a6fa49a 100644 (file)
@@ -245,7 +245,8 @@ int usb_emul_bulk(struct udevice *emul, struct usb_device *udev,
 }
 
 int usb_emul_int(struct udevice *emul, struct usb_device *udev,
-                 unsigned long pipe, void *buffer, int length, int interval)
+                 unsigned long pipe, void *buffer, int length, int interval,
+                 bool nonblock)
 {
        struct dm_usb_ops *ops = usb_get_emul_ops(emul);
 
@@ -253,7 +254,8 @@ int usb_emul_int(struct udevice *emul, struct usb_device *udev,
                return -ENOSYS;
        debug("%s: dev=%s\n", __func__, emul->name);
 
-       return ops->interrupt(emul, udev, pipe, buffer, length, interval);
+       return ops->interrupt(emul, udev, pipe, buffer, length, interval,
+                             nonblock);
 }
 
 int usb_emul_setup_device(struct udevice *dev, struct usb_string *strings,
index a62a2f8a951d1ecd8572db56647dcc4b748491fd..350d820a6e50b914e564ea180eb804628d327164 100644 (file)
@@ -1108,7 +1108,8 @@ static int _submit_control_msg(struct dwc2_priv *priv, struct usb_device *dev,
 }
 
 int _submit_int_msg(struct dwc2_priv *priv, struct usb_device *dev,
-                   unsigned long pipe, void *buffer, int len, int interval)
+                   unsigned long pipe, void *buffer, int len, int interval,
+                   bool nonblock)
 {
        unsigned long timeout;
        int ret;
@@ -1122,7 +1123,7 @@ int _submit_int_msg(struct dwc2_priv *priv, struct usb_device *dev,
                        return -ETIMEDOUT;
                }
                ret = _submit_bulk_msg(priv, dev, pipe, buffer, len);
-               if (ret != -EAGAIN)
+               if ((ret != -EAGAIN) || nonblock)
                        return ret;
        }
 }
@@ -1236,9 +1237,10 @@ int submit_bulk_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
 }
 
 int submit_int_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
-                  int len, int interval)
+                  int len, int interval, bool nonblock)
 {
-       return _submit_int_msg(&local, dev, pipe, buffer, len, interval);
+       return _submit_int_msg(&local, dev, pipe, buffer, len, interval,
+                              nonblock);
 }
 
 /* U-Boot USB control interface */
@@ -1292,13 +1294,14 @@ static int dwc2_submit_bulk_msg(struct udevice *dev, struct usb_device *udev,
 
 static int dwc2_submit_int_msg(struct udevice *dev, struct usb_device *udev,
                               unsigned long pipe, void *buffer, int length,
-                              int interval)
+                              int interval, bool nonblock)
 {
        struct dwc2_priv *priv = dev_get_priv(dev);
 
        debug("%s: dev='%s', udev=%p\n", __func__, dev->name, udev);
 
-       return _submit_int_msg(priv, udev, pipe, buffer, length, interval);
+       return _submit_int_msg(priv, udev, pipe, buffer, length, interval,
+                              nonblock);
 }
 
 static int dwc2_usb_ofdata_to_platdata(struct udevice *dev)
index 0270f3bc95acac5a14c56c46316ed2ac8612ffd9..682a0703060f41d733d01f8ecab2473bd31abb5c 100644 (file)
@@ -96,7 +96,7 @@ static int ehci_usb_probe(struct udevice *dev)
                        if (err < 0)
                                break;
                        err = clk_enable(&priv->clocks[i]);
-                       if (err) {
+                       if (err && err != -ENOSYS) {
                                dev_err(dev, "failed to enable clock %d\n", i);
                                clk_free(&priv->clocks[i]);
                                goto clk_err;
index 4b28db70a5665f744920280118ad7aa2aff504bb..61a61abb21129ed0a2c6e3d5c70e6ba47231af78 100644 (file)
@@ -1482,7 +1482,8 @@ out:
 }
 
 static int _ehci_submit_int_msg(struct usb_device *dev, unsigned long pipe,
-                               void *buffer, int length, int interval)
+                               void *buffer, int length, int interval,
+                               bool nonblock)
 {
        void *backbuffer;
        struct int_queue *queue;
@@ -1532,9 +1533,10 @@ int submit_control_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
 }
 
 int submit_int_msg(struct usb_device *dev, unsigned long pipe,
-                  void *buffer, int length, int interval)
+                  void *buffer, int length, int interval, bool nonblock)
 {
-       return _ehci_submit_int_msg(dev, pipe, buffer, length, interval);
+       return _ehci_submit_int_msg(dev, pipe, buffer, length, interval,
+                                   nonblock);
 }
 
 struct int_queue *create_int_queue(struct usb_device *dev,
@@ -1576,10 +1578,11 @@ static int ehci_submit_bulk_msg(struct udevice *dev, struct usb_device *udev,
 
 static int ehci_submit_int_msg(struct udevice *dev, struct usb_device *udev,
                               unsigned long pipe, void *buffer, int length,
-                              int interval)
+                              int interval, bool nonblock)
 {
        debug("%s: dev='%s', udev=%p\n", __func__, dev->name, udev);
-       return _ehci_submit_int_msg(udev, pipe, buffer, length, interval);
+       return _ehci_submit_int_msg(udev, pipe, buffer, length, interval,
+                                   nonblock);
 }
 
 static struct int_queue *ehci_create_int_queue(struct udevice *dev,
index 24b5c3156f09a756ad9b9233aa003948718eba0e..916ea0b9555809406e93f465a5273d6238dd9a8e 100644 (file)
@@ -95,7 +95,7 @@ static int ohci_usb_probe(struct udevice *dev)
                                break;
 
                        err = clk_enable(&priv->clocks[i]);
-                       if (err) {
+                       if (err && err != -ENOSYS) {
                                dev_err(dev, "failed to enable clock %d\n", i);
                                clk_free(&priv->clocks[i]);
                                goto clk_err;
index 58aa824ec0347685e0b08fac304eb6db6e46cf41..57e92a9c89317b5d100f68f5f4670a97ed932931 100644 (file)
@@ -1703,7 +1703,7 @@ int submit_bulk_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
 }
 
 int submit_int_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
-               int transfer_len, int interval)
+               int transfer_len, int interval, bool nonblock)
 {
        info("submit_int_msg");
        return submit_common_msg(&gohci, dev, pipe, buffer, transfer_len, NULL,
@@ -2155,7 +2155,7 @@ static int ohci_submit_bulk_msg(struct udevice *dev, struct usb_device *udev,
 
 static int ohci_submit_int_msg(struct udevice *dev, struct usb_device *udev,
                               unsigned long pipe, void *buffer, int length,
-                              int interval)
+                              int interval, bool nonblock)
 {
        ohci_t *ohci = dev_get_priv(usb_get_bus(dev));
 
index daba0dcd1aeea4a885c2537c80c46f0b905cfc2e..e08da6130bd5ca7d53f71c688c4250d41aad79ee 100644 (file)
@@ -384,7 +384,7 @@ int submit_control_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
 }
 
 int submit_int_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
-                  int len, int interval)
+                  int len, int interval, bool nonblock)
 {
        PDEBUG(0, "dev = %p pipe = %#lx buf = %p size = %d int = %d\n", dev, pipe,
               buffer, len, interval);
index ff9d5b7231e82090b09f1e3bc719755eedc961d8..28ee4b093b64820250ae7e72e7997cac9ff04eaf 100644 (file)
@@ -99,7 +99,7 @@ static int sandbox_submit_bulk(struct udevice *bus, struct usb_device *udev,
 
 static int sandbox_submit_int(struct udevice *bus, struct usb_device *udev,
                              unsigned long pipe, void *buffer, int length,
-                             int interval)
+                             int interval, bool nonblock)
 {
        struct udevice *emul;
        int ret;
@@ -110,7 +110,8 @@ static int sandbox_submit_int(struct udevice *bus, struct usb_device *udev,
        usbmon_trace(bus, pipe, NULL, emul);
        if (ret)
                return ret;
-       ret = usb_emul_int(emul, udev, pipe, buffer, length, interval);
+       ret = usb_emul_int(emul, udev, pipe, buffer, length, interval,
+                          nonblock);
 
        return ret;
 }
index 6e118b5a8ffa408fd8b9c7f5595e0ae47b200b58..852165158869f7031c48b76d11281f3e5d519aef 100644 (file)
@@ -31,7 +31,7 @@ int usb_disable_asynch(int disable)
 }
 
 int submit_int_msg(struct usb_device *udev, unsigned long pipe, void *buffer,
-                  int length, int interval)
+                  int length, int interval, bool nonblock)
 {
        struct udevice *bus = udev->controller_dev;
        struct dm_usb_ops *ops = usb_get_ops(bus);
@@ -39,7 +39,8 @@ int submit_int_msg(struct usb_device *udev, unsigned long pipe, void *buffer,
        if (!ops->interrupt)
                return -ENOSYS;
 
-       return ops->interrupt(bus, udev, pipe, buffer, length, interval);
+       return ops->interrupt(bus, udev, pipe, buffer, length, interval,
+                             nonblock);
 }
 
 int submit_control_msg(struct usb_device *udev, unsigned long pipe,
index 44c5f2d264c16cd3e8c1ff433fff7f89a21ca467..b3e4dcd66fa1b611ab743fe63a39b1afa8d6f919 100644 (file)
@@ -1109,7 +1109,8 @@ unknown:
  * @return 0
  */
 static int _xhci_submit_int_msg(struct usb_device *udev, unsigned long pipe,
-                               void *buffer, int length, int interval)
+                               void *buffer, int length, int interval,
+                               bool nonblock)
 {
        if (usb_pipetype(pipe) != PIPE_INTERRUPT) {
                printf("non-interrupt pipe (type=%lu)", usb_pipetype(pipe));
@@ -1277,9 +1278,10 @@ int submit_bulk_msg(struct usb_device *udev, unsigned long pipe, void *buffer,
 }
 
 int submit_int_msg(struct usb_device *udev, unsigned long pipe, void *buffer,
-                  int length, int interval)
+                  int length, int interval, bool nonblock)
 {
-       return _xhci_submit_int_msg(udev, pipe, buffer, length, interval);
+       return _xhci_submit_int_msg(udev, pipe, buffer, length, interval,
+                                   nonblock);
 }
 
 /**
@@ -1386,10 +1388,11 @@ static int xhci_submit_bulk_msg(struct udevice *dev, struct usb_device *udev,
 
 static int xhci_submit_int_msg(struct udevice *dev, struct usb_device *udev,
                               unsigned long pipe, void *buffer, int length,
-                              int interval)
+                              int interval, bool nonblock)
 {
        debug("%s: dev='%s', udev=%p\n", __func__, dev->name, udev);
-       return _xhci_submit_int_msg(udev, pipe, buffer, length, interval);
+       return _xhci_submit_int_msg(udev, pipe, buffer, length, interval,
+                                   nonblock);
 }
 
 static int xhci_alloc_device(struct udevice *dev, struct usb_device *udev)
index 9c8cc6e584439850310ee126c268346cadcbc613..9eb593402ea0c55c625adc09b052a38805e11995 100644 (file)
@@ -110,7 +110,7 @@ static int _musb_submit_bulk_msg(struct musb_host_data *host,
 
 static int _musb_submit_int_msg(struct musb_host_data *host,
        struct usb_device *dev, unsigned long pipe,
-       void *buffer, int len, int interval)
+       void *buffer, int len, int interval, bool nonblock)
 {
        construct_urb(&host->urb, &host->hep, dev, USB_ENDPOINT_XFER_INT, pipe,
                      buffer, len, NULL, interval);
@@ -268,9 +268,10 @@ int submit_control_msg(struct usb_device *dev, unsigned long pipe,
 }
 
 int submit_int_msg(struct usb_device *dev, unsigned long pipe,
-                  void *buffer, int length, int interval)
+                  void *buffer, int length, int interval, bool nonblock)
 {
-       return _musb_submit_int_msg(&musb_host, dev, pipe, buffer, length, interval);
+       return _musb_submit_int_msg(&musb_host, dev, pipe, buffer, length,
+                                   interval, nonblock);
 }
 
 struct int_queue *create_int_queue(struct usb_device *dev,
@@ -320,10 +321,11 @@ static int musb_submit_bulk_msg(struct udevice *dev, struct usb_device *udev,
 
 static int musb_submit_int_msg(struct udevice *dev, struct usb_device *udev,
                               unsigned long pipe, void *buffer, int length,
-                              int interval)
+                              int interval, bool nonblock)
 {
        struct musb_host_data *host = dev_get_priv(dev);
-       return _musb_submit_int_msg(host, udev, pipe, buffer, length, interval);
+       return _musb_submit_int_msg(host, udev, pipe, buffer, length, interval,
+                                   nonblock);
 }
 
 static struct int_queue *musb_create_int_queue(struct udevice *dev,
index 1f2805270aa3690d6a3b1d9db519e4f0986d19ba..adcd319b6d0b865f57a2201716603cd03d9f1756 100644 (file)
@@ -1049,8 +1049,8 @@ int usb_lowlevel_stop(int index)
  * This function supports usb interrupt transfers. Currently, usb interrupt
  * transfers are not supported.
  */
-int submit_int_msg(struct usb_device *dev, unsigned long pipe,
-                               void *buffer, int len, int interval)
+int submit_int_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
+                  int len, int interval, bool nonblock)
 {
        int dir_out = usb_pipeout(pipe);
        int ep = usb_pipeendpoint(pipe);
index 6072e4a48c8f0e3d294947537566c77075fb1f8d..0249a20ba8fa0573963076245a3cf5a5c430bcbe 100644 (file)
                "done;\0"                                               \
        "get_kern_mmc=load mmc ${bootpart} ${loadaddr} "                \
                "${bootdir}/${name_kern}\0"                             \
+       "get_fit_mmc=load mmc ${bootpart} ${addr_fit} "                 \
+               "${bootdir}/${name_fit}\0"                              \
        "partitions=" PARTS_DEFAULT
 
 /* Incorporate settings into the U-Boot environment */
 #define CONFIG_EXTRA_ENV_SETTINGS                                      \
        DEFAULT_MMC_TI_ARGS                                             \
+       DEFAULT_FIT_TI_ARGS                                             \
        EXTRA_ENV_AM65X_BOARD_SETTINGS                                  \
        EXTRA_ENV_AM65X_BOARD_SETTINGS_MMC
 
index cab402a484caf505adaa8775aa6bda9e2e3ecd35..1c41e7e97adc53d3997dd09e3f61c0e8f685df4d 100644 (file)
@@ -13,8 +13,6 @@
 /*
  * Board
  */
-#undef CONFIG_USE_SPIFLASH
-#undef CONFIG_SYS_USE_NOR
 
 /*
  * SoC Configuration
  * Serial Driver info
  */
 #define CONFIG_SYS_NS16550_CLK clk_get(DAVINCI_UART2_CLKID)
-#if !defined(CONFIG_DM_SERIAL)
-#define CONFIG_SYS_NS16550_SERIAL
-#define CONFIG_SYS_NS16550_REG_SIZE    -4      /* NS16550 register size */
-#define CONFIG_SYS_NS16550_COM1        DAVINCI_UART2_BASE /* Base address of UART2 */
-#define CONFIG_SYS_NS16550_CLK clk_get(DAVINCI_UART2_CLKID)
-#define CONFIG_SYS_BAUDRATE_TABLE      { 9600, 19200, 38400, 57600, 115200 }
-#endif
 
 #define CONFIG_SYS_SPI_BASE            DAVINCI_SPI1_BASE
 #define CONFIG_SYS_SPI_CLK             clk_get(DAVINCI_SPI1_CLKID)
 
-#ifdef CONFIG_USE_SPIFLASH
-#define CONFIG_SYS_SPI_U_BOOT_SIZE     0x30000
-#endif
-
 /*
  * I2C Configuration
  */
 #define CONFIG_SPL_NAND_LOAD
 #endif
 
-#ifdef CONFIG_SYS_USE_NOR
-#define CONFIG_SYS_MAX_FLASH_BANKS     1 /* max number of flash banks */
-#define CONFIG_SYS_FLASH_SECT_SZ       (128 << 10) /* 128KB */
-#define CONFIG_ENV_OFFSET              (CONFIG_SYS_FLASH_SECT_SZ * 3)
-#define CONFIG_ENV_SIZE                        (128 << 10)
-#define CONFIG_SYS_FLASH_BASE          DAVINCI_ASYNC_EMIF_DATA_CE2_BASE
-#define PHYS_FLASH_SIZE                        (8 << 20) /* Flash size 8MB */
-#define CONFIG_SYS_MAX_FLASH_SECT ((PHYS_FLASH_SIZE/CONFIG_SYS_FLASH_SECT_SZ)\
-              + 3)
-#define CONFIG_ENV_SECT_SIZE           CONFIG_SYS_FLASH_SECT_SZ
-#endif
-
-#ifdef CONFIG_USE_SPIFLASH
-#define CONFIG_ENV_SIZE                        (64 << 10)
-#define CONFIG_ENV_OFFSET              (256 << 10)
-#define CONFIG_ENV_SECT_SIZE           (64 << 10)
-#endif
-
 /*
  * Network & Ethernet Configuration
  */
 #define CONFIG_CLOCKS
 #endif
 
-#if !defined(CONFIG_NAND) && \
-       !defined(CONFIG_SYS_USE_NOR) && \
-       !defined(CONFIG_USE_SPIFLASH)
-#define CONFIG_ENV_SIZE                (16 << 10)
-#endif
-
 /* SD/MMC */
 
 #ifdef CONFIG_ENV_IS_IN_MMC
 #define CONFIG_ENV_OFFSET      (51 << 9)       /* Sector 51 */
 #endif
 
-#ifndef CONFIG_DIRECT_NOR_BOOT
 /* defines for SPL */
 #define CONFIG_SYS_SPL_MALLOC_START    (CONFIG_SYS_TEXT_BASE - \
                                                CONFIG_SYS_MALLOC_LEN)
 #define CONFIG_SPL_STACK       0x8001ff00
 #define CONFIG_SPL_MAX_FOOTPRINT       32768
 #define CONFIG_SPL_PAD_TO      32768
-#endif
 
 /* additions for new relocation code, must added to all boards */
 #define CONFIG_SYS_SDRAM_BASE          0xc0000000
index 2058f8de0fda6f3190ddadbff4882b58e6102de9..2de6bc239090c4d4fd926d716012cf4d27913550 100644 (file)
        "addr_fit=0x90000000\0" \
        "name_fit=fitImage\0" \
        "update_to_fit=setenv loadaddr ${addr_fit}; setenv bootfile ${name_fit}\0" \
-       "loadfit=run args_mmc; bootm ${loadaddr}#${fdtfile};\0" \
+       "get_overlaystring=" \
+               "for overlay in $overlay_files;" \
+               "do;" \
+               "setenv overlaystring ${overlaystring}'#'${overlay};" \
+               "done;\0" \
+       "run_fit=bootm ${loadaddr}#${fdtfile}${overlaystring}\0" \
+       "loadfit=run args_mmc; run run_fit;\0" \
 
 /*
  * DDR information.  If the CONFIG_NR_DRAM_BANKS is not defined,
index cb895f31e5eb1f1502eb7b757a54b46659aae66d..37e56da46030883010d55ba524cf74c198ca9cc9 100644 (file)
@@ -1461,6 +1461,12 @@ struct efi_pxe_base_code_protocol {
 #define EFI_FILE_PROTOCOL_REVISION2    0x00020000
 #define EFI_FILE_PROTOCOL_LATEST_REVISION EFI_FILE_PROTOCOL_REVISION2
 
+struct efi_file_io_token {
+       struct efi_event *event;
+       efi_status_t status;
+       efi_uintn_t buffer_size;
+       void *buffer;};
+
 struct efi_file_handle {
        u64 rev;
        efi_status_t (EFIAPI *open)(struct efi_file_handle *file,
@@ -1483,10 +1489,16 @@ struct efi_file_handle {
                        const efi_guid_t *info_type, efi_uintn_t buffer_size,
                        void *buffer);
        efi_status_t (EFIAPI *flush)(struct efi_file_handle *file);
-       /*
-        * TODO: We currently only support EFI file protocol revision 0x00010000
-        *       while UEFI specs 2.4 - 2.7 prescribe revision 0x00020000.
-        */
+       efi_status_t (EFIAPI *open_ex)(struct efi_file_handle *file,
+                       struct efi_file_handle **new_handle,
+                       u16 *file_name, u64 open_mode, u64 attributes,
+                       struct efi_file_io_token *token);
+       efi_status_t (EFIAPI *read_ex)(struct efi_file_handle *file,
+                       struct efi_file_io_token *token);
+       efi_status_t (EFIAPI *write_ex)(struct efi_file_handle *file,
+                       struct efi_file_io_token *token);
+       efi_status_t (EFIAPI *flush_ex)(struct efi_file_handle *file,
+                       struct efi_file_io_token *token);
 };
 
 #define EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_REVISION 0x00010000
@@ -1505,6 +1517,10 @@ struct efi_simple_file_system_protocol {
        EFI_GUID(0x09576e93, 0x6d3f, 0x11d2, \
                 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b)
 
+#define EFI_FILE_SYSTEM_VOLUME_LABEL_ID \
+       EFI_GUID(0xdb47d7d3, 0xfe81, 0x11d3, \
+                0x9a, 0x35, 0x00, 0x90, 0x27, 0x3f, 0xC1, 0x4d)
+
 #define EFI_FILE_MODE_READ     0x0000000000000001
 #define EFI_FILE_MODE_WRITE    0x0000000000000002
 #define EFI_FILE_MODE_CREATE   0x8000000000000000
index 00eba8afa4de92f1a0324973cc5978dee0562b87..dd24a2746c92e777b2322334240f553e39b8cdd2 100644 (file)
@@ -555,22 +555,6 @@ efi_status_t efi_dp_from_name(const char *dev, const char *devnr,
        (((_dp)->type == DEVICE_PATH_TYPE_##_type) && \
         ((_dp)->sub_type == DEVICE_PATH_SUB_TYPE_##_subtype))
 
-/**
- * ascii2unicode() - convert ASCII string to UTF-16 string
- *
- * A zero terminated ASCII string is converted to a zero terminated UTF-16
- * string. The output buffer must be preassigned.
- *
- * @unicode:   preassigned output buffer for UTF-16 string
- * @ascii:     ASCII string to be converted
- */
-static inline void ascii2unicode(u16 *unicode, const char *ascii)
-{
-       while (*ascii)
-               *(unicode++) = *(ascii++);
-       *unicode = 0;
-}
-
 static inline int guidcmp(const void *g1, const void *g2)
 {
        return memcmp(g1, g2, sizeof(efi_guid_t));
index 88e80af57941556474c87276bbaa11e5364caf82..709b49d3936da1cc0858c1d42afd6736cf01e2f0 100644 (file)
 #define SPINOR_OP_WRDI         0x04    /* Write disable */
 #define SPINOR_OP_AAI_WP       0xad    /* Auto address increment word program */
 
+/* Used for SST26* flashes only. */
+#define SPINOR_OP_READ_BPR     0x72    /* Read block protection register */
+#define SPINOR_OP_WRITE_BPR    0x42    /* Write block protection register */
+
 /* Used for S3AN flashes only */
 #define SPINOR_OP_XSE          0x50    /* Sector erase */
 #define SPINOR_OP_XPP          0x82    /* Page program */
index 378594163b874246e606a41edf6e404e81412f81..5eec0c4775e5c9a3122f772841e1952fb803b6ac 100644 (file)
@@ -248,6 +248,26 @@ int spi_set_wordlen(struct spi_slave *slave, unsigned int wordlen);
 int  spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout,
                void *din, unsigned long flags);
 
+/**
+ * spi_write_then_read - SPI synchronous write followed by read
+ *
+ * This performs a half duplex transaction in which the first transaction
+ * is to send the opcode and if the length of buf is non-zero then it start
+ * the second transaction as tx or rx based on the need from respective slave.
+ *
+ * @slave:     The SPI slave device with which opcode/data will be exchanged
+ * @opcode:    opcode used for specific transfer
+ * @n_opcode:  size of opcode, in bytes
+ * @txbuf:     buffer into which data to be written
+ * @rxbuf:     buffer into which data will be read
+ * @n_buf:     size of buf (whether it's [tx|rx]buf), in bytes
+ *
+ * Returns: 0 on success, not 0 on failure
+ */
+int spi_write_then_read(struct spi_slave *slave, const u8 *opcode,
+                       size_t n_opcode, const u8 *txbuf, u8 *rxbuf,
+                       size_t n_buf);
+
 /* Copy memory mapped data */
 void spi_flash_copy_mmap(void *data, void *offset, size_t len);
 
index 420a30e49fa157b259da5794a72b45fecb1d1af2..bcad552f85f033009a3a436c9b0e593501ffa0bd 100644 (file)
@@ -184,7 +184,7 @@ int submit_bulk_msg(struct usb_device *dev, unsigned long pipe,
 int submit_control_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
                        int transfer_len, struct devrequest *setup);
 int submit_int_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
-                       int transfer_len, int interval);
+                       int transfer_len, int interval, bool nonblock);
 
 #if defined CONFIG_USB_EHCI_HCD || defined CONFIG_USB_MUSB_HOST \
        || CONFIG_IS_ENABLED(DM_USB)
@@ -261,8 +261,8 @@ int usb_control_msg(struct usb_device *dev, unsigned int pipe,
                        void *data, unsigned short size, int timeout);
 int usb_bulk_msg(struct usb_device *dev, unsigned int pipe,
                        void *data, int len, int *actual_length, int timeout);
-int usb_submit_int_msg(struct usb_device *dev, unsigned long pipe,
-                       void *buffer, int transfer_len, int interval);
+int usb_int_msg(struct usb_device *dev, unsigned long pipe,
+               void *buffer, int transfer_len, int interval, bool nonblock);
 int usb_disable_asynch(int disable);
 int usb_maxpacket(struct usb_device *dev, unsigned long pipe);
 int usb_get_configuration_no(struct usb_device *dev, int cfgno,
@@ -708,7 +708,7 @@ struct dm_usb_ops {
         */
        int (*interrupt)(struct udevice *bus, struct usb_device *udev,
                         unsigned long pipe, void *buffer, int length,
-                        int interval);
+                        int interval, bool nonblock);
 
        /**
         * create_int_queue() - Create and queue interrupt packets
@@ -1029,7 +1029,8 @@ int usb_emul_bulk(struct udevice *emul, struct usb_device *udev,
  * @return 0 if OK, -ve on error
  */
 int usb_emul_int(struct udevice *emul, struct usb_device *udev,
-                 unsigned long pipe, void *buffer, int length, int interval);
+                 unsigned long pipe, void *buffer, int length, int interval,
+                 bool nonblock);
 
 /**
  * usb_emul_find() - Find an emulator for a particular device
index b20b7c097c98227b25c21e1d6c7c7c268df06f53..0f3796b373bb8707902d90d13b9d75d75fcbaa3c 100644 (file)
@@ -29,15 +29,15 @@ const efi_guid_t efi_guid_device_path_to_text_protocol =
 static u16 *efi_str_to_u16(char *str)
 {
        efi_uintn_t len;
-       u16 *out;
+       u16 *out, *dst;
        efi_status_t ret;
 
-       len = strlen(str) + 1;
-       ret = efi_allocate_pool(EFI_ALLOCATE_ANY_PAGES, len * sizeof(u16),
-                               (void **)&out);
+       len = sizeof(u16) * (utf8_utf16_strlen(str) + 1);
+       ret = efi_allocate_pool(EFI_ALLOCATE_ANY_PAGES, len, (void **)&out);
        if (ret != EFI_SUCCESS)
                return NULL;
-       ascii2unicode(out, str);
+       dst = out;
+       utf8_utf16_strcpy(&dst, str);
        return out;
 }
 
index f4ca5694eee3a688ca2a4331096f42ab7f30a122..6d3f680e56ca2b4300666f02c40bda408af19190 100644 (file)
@@ -1,8 +1,8 @@
 // SPDX-License-Identifier: GPL-2.0+
 /*
- *  EFI utils
+ * EFI_FILE_PROTOCOL
  *
- *  Copyright (c) 2017 Rob Clark
+ * Copyright (c) 2017 Rob Clark
  */
 
 #include <common.h>
@@ -15,6 +15,9 @@
 /* GUID for file system information */
 const efi_guid_t efi_file_system_info_guid = EFI_FILE_SYSTEM_INFO_GUID;
 
+/* GUID to obtain the volume label */
+const efi_guid_t efi_system_volume_label_id = EFI_FILE_SYSTEM_VOLUME_LABEL_ID;
+
 struct file_system {
        struct efi_simple_file_system_protocol base;
        struct efi_device_path *dp;
@@ -28,6 +31,7 @@ struct file_handle {
        struct file_system *fs;
        loff_t offset;       /* current file position/cursor */
        int isdir;
+       u64 open_mode;
 
        /* for reading a directory: */
        struct fs_dir_stream *dirs;
@@ -161,13 +165,13 @@ static int efi_create_file(struct file_handle *fh, u64 attributes)
  * @file_name:         path of the file to be opened. '\', '.', or '..' may
  *                     be used as modifiers. A leading backslash indicates an
  *                     absolute path.
- * @mode:              bit mask indicating the access mode (read, write,
+ * @open_mode:         bit mask indicating the access mode (read, write,
  *                     create)
  * @attributes:                attributes for newly created file
  * Returns:            handle to the opened file or NULL
  */
 static struct efi_file_handle *file_open(struct file_system *fs,
-               struct file_handle *parent, u16 *file_name, u64 mode,
+               struct file_handle *parent, u16 *file_name, u64 open_mode,
                u64 attributes)
 {
        struct file_handle *fh;
@@ -190,6 +194,7 @@ static struct efi_file_handle *file_open(struct file_system *fs,
        /* +2 is for null and '/' */
        fh = calloc(1, sizeof(*fh) + plen + (flen * MAX_UTF8_PER_UTF16) + 2);
 
+       fh->open_mode = open_mode;
        fh->base = efi_file_handle_protocol;
        fh->fs = fs;
 
@@ -218,9 +223,11 @@ static struct efi_file_handle *file_open(struct file_system *fs,
                        goto error;
 
                if (!exists) {
-                       if (!(mode & EFI_FILE_MODE_CREATE) ||
+                       if (!(open_mode & EFI_FILE_MODE_CREATE) ||
                            efi_create_file(fh, attributes))
                                goto error;
+                       if (set_blk_dev(fh))
+                               goto error;
                }
 
                /* figure out if file is a directory: */
@@ -314,11 +321,42 @@ static efi_status_t EFIAPI efi_file_delete(struct efi_file_handle *file)
        return EFI_EXIT(ret);
 }
 
+/**
+ * efi_get_file_size() - determine the size of a file
+ *
+ * @fh:                file handle
+ * @file_size: pointer to receive file size
+ * Return:     status code
+ */
+static efi_status_t efi_get_file_size(struct file_handle *fh,
+                                     loff_t *file_size)
+{
+       if (set_blk_dev(fh))
+               return EFI_DEVICE_ERROR;
+
+       if (fs_size(fh->path, file_size))
+               return EFI_DEVICE_ERROR;
+
+       return EFI_SUCCESS;
+}
+
 static efi_status_t file_read(struct file_handle *fh, u64 *buffer_size,
                void *buffer)
 {
        loff_t actread;
+       efi_status_t ret;
+       loff_t file_size;
+
+       ret = efi_get_file_size(fh, &file_size);
+       if (ret != EFI_SUCCESS)
+               return ret;
+       if (file_size < fh->offset) {
+               ret = EFI_DEVICE_ERROR;
+               return ret;
+       }
 
+       if (set_blk_dev(fh))
+               return EFI_DEVICE_ERROR;
        if (fs_read(fh->path, map_to_sysmem(buffer), fh->offset,
                    *buffer_size, &actread))
                return EFI_DEVICE_ERROR;
@@ -334,13 +372,18 @@ static efi_status_t dir_read(struct file_handle *fh, u64 *buffer_size,
 {
        struct efi_file_info *info = buffer;
        struct fs_dirent *dent;
-       unsigned int required_size;
+       u64 required_size;
+       u16 *dst;
+
+       if (set_blk_dev(fh))
+               return EFI_DEVICE_ERROR;
 
        if (!fh->dirs) {
                assert(fh->offset == 0);
                fh->dirs = fs_opendir(fh->path);
                if (!fh->dirs)
                        return EFI_DEVICE_ERROR;
+               fh->dent = NULL;
        }
 
        /*
@@ -351,38 +394,25 @@ static efi_status_t dir_read(struct file_handle *fh, u64 *buffer_size,
         */
        if (fh->dent) {
                dent = fh->dent;
-               fh->dent = NULL;
        } else {
                dent = fs_readdir(fh->dirs);
        }
 
-
        if (!dent) {
-               /* no more files in directory: */
-               /* workaround shim.efi bug/quirk.. as find_boot_csv()
-                * loops through directory contents, it initially calls
-                * read w/ zero length buffer to find out how much mem
-                * to allocate for the EFI_FILE_INFO, then allocates,
-                * and then calls a 2nd time.  If we return size of
-                * zero the first time, it happily passes that to
-                * AllocateZeroPool(), and when that returns NULL it
-                * thinks it is EFI_OUT_OF_RESOURCES.  So on first
-                * call return a non-zero size:
-                */
-               if (*buffer_size == 0)
-                       *buffer_size = sizeof(*info);
-               else
-                       *buffer_size = 0;
+               /* no more files in directory */
+               *buffer_size = 0;
                return EFI_SUCCESS;
        }
 
        /* check buffer size: */
-       required_size = sizeof(*info) + 2 * (strlen(dent->name) + 1);
+       required_size = sizeof(*info) +
+                       2 * (utf8_utf16_strlen(dent->name) + 1);
        if (*buffer_size < required_size) {
                *buffer_size = required_size;
                fh->dent = dent;
                return EFI_BUFFER_TOO_SMALL;
        }
+       fh->dent = NULL;
 
        *buffer_size = required_size;
        memset(info, 0, required_size);
@@ -394,7 +424,8 @@ static efi_status_t dir_read(struct file_handle *fh, u64 *buffer_size,
        if (dent->type == FS_DT_DIR)
                info->attribute |= EFI_FILE_DIRECTORY;
 
-       ascii2unicode(info->file_name, dent->name);
+       dst = info->file_name;
+       utf8_utf16_strcpy(&dst, dent->name);
 
        fh->offset++;
 
@@ -415,11 +446,6 @@ static efi_status_t EFIAPI efi_file_read(struct efi_file_handle *file,
                goto error;
        }
 
-       if (set_blk_dev(fh)) {
-               ret = EFI_DEVICE_ERROR;
-               goto error;
-       }
-
        bs = *buffer_size;
        if (fh->isdir)
                ret = dir_read(fh, &bs, buffer);
@@ -434,6 +460,19 @@ error:
        return EFI_EXIT(ret);
 }
 
+/**
+ * efi_file_write() - write to file
+ *
+ * This function implements the Write() service of the EFI_FILE_PROTOCOL.
+ *
+ * See the Unified Extensible Firmware Interface (UEFI) specification for
+ * details.
+ *
+ * @file:              file handle
+ * @buffer_size:       number of bytes to write
+ * @buffer:            buffer with the bytes to write
+ * Return:             status code
+ */
 static efi_status_t EFIAPI efi_file_write(struct efi_file_handle *file,
                                          efi_uintn_t *buffer_size,
                                          void *buffer)
@@ -444,21 +483,35 @@ static efi_status_t EFIAPI efi_file_write(struct efi_file_handle *file,
 
        EFI_ENTRY("%p, %p, %p", file, buffer_size, buffer);
 
+       if (!file || !buffer_size || !buffer) {
+               ret = EFI_INVALID_PARAMETER;
+               goto out;
+       }
+       if (fh->isdir) {
+               ret = EFI_UNSUPPORTED;
+               goto out;
+       }
+       if (!(fh->open_mode & EFI_FILE_MODE_WRITE)) {
+               ret = EFI_ACCESS_DENIED;
+               goto out;
+       }
+
+       if (!*buffer_size)
+               goto out;
+
        if (set_blk_dev(fh)) {
                ret = EFI_DEVICE_ERROR;
-               goto error;
+               goto out;
        }
-
        if (fs_write(fh->path, map_to_sysmem(buffer), fh->offset, *buffer_size,
                     &actwrite)) {
                ret = EFI_DEVICE_ERROR;
-               goto error;
+               goto out;
        }
-
        *buffer_size = actwrite;
        fh->offset += actwrite;
 
-error:
+out:
        return EFI_EXIT(ret);
 }
 
@@ -520,16 +573,9 @@ static efi_status_t EFIAPI efi_file_setpos(struct efi_file_handle *file,
        if (pos == ~0ULL) {
                loff_t file_size;
 
-               if (set_blk_dev(fh)) {
-                       ret = EFI_DEVICE_ERROR;
-                       goto error;
-               }
-
-               if (fs_size(fh->path, &file_size)) {
-                       ret = EFI_DEVICE_ERROR;
+               ret = efi_get_file_size(fh, &file_size);
+               if (ret != EFI_SUCCESS)
                        goto error;
-               }
-
                pos = file_size;
        }
 
@@ -546,9 +592,16 @@ static efi_status_t EFIAPI efi_file_getinfo(struct efi_file_handle *file,
 {
        struct file_handle *fh = to_fh(file);
        efi_status_t ret = EFI_SUCCESS;
+       u16 *dst;
 
        EFI_ENTRY("%p, %pUl, %p, %p", file, info_type, buffer_size, buffer);
 
+       if (!file || !info_type || !buffer_size ||
+           (*buffer_size && !buffer)) {
+               ret = EFI_INVALID_PARAMETER;
+               goto error;
+       }
+
        if (!guidcmp(info_type, &efi_file_info_guid)) {
                struct efi_file_info *info = buffer;
                char *filename = basename(fh);
@@ -556,22 +609,17 @@ static efi_status_t EFIAPI efi_file_getinfo(struct efi_file_handle *file,
                loff_t file_size;
 
                /* check buffer size: */
-               required_size = sizeof(*info) + 2 * (strlen(filename) + 1);
+               required_size = sizeof(*info) +
+                               2 * (utf8_utf16_strlen(filename) + 1);
                if (*buffer_size < required_size) {
                        *buffer_size = required_size;
                        ret = EFI_BUFFER_TOO_SMALL;
                        goto error;
                }
 
-               if (set_blk_dev(fh)) {
-                       ret = EFI_DEVICE_ERROR;
-                       goto error;
-               }
-
-               if (fs_size(fh->path, &file_size)) {
-                       ret = EFI_DEVICE_ERROR;
+               ret = efi_get_file_size(fh, &file_size);
+               if (ret != EFI_SUCCESS)
                        goto error;
-               }
 
                memset(info, 0, required_size);
 
@@ -582,7 +630,8 @@ static efi_status_t EFIAPI efi_file_getinfo(struct efi_file_handle *file,
                if (fh->isdir)
                        info->attribute |= EFI_FILE_DIRECTORY;
 
-               ascii2unicode(info->file_name, filename);
+               dst = info->file_name;
+               utf8_utf16_strcpy(&dst, filename);
        } else if (!guidcmp(info_type, &efi_file_system_info_guid)) {
                struct efi_file_system_info *info = buffer;
                disk_partition_t part;
@@ -597,8 +646,7 @@ static efi_status_t EFIAPI efi_file_getinfo(struct efi_file_handle *file,
                        ret = EFI_DEVICE_ERROR;
                        goto error;
                }
-               required_size = sizeof(info) + 2 *
-                               (strlen((const char *)part.name) + 1);
+               required_size = sizeof(*info) + 2;
                if (*buffer_size < required_size) {
                        *buffer_size = required_size;
                        ret = EFI_BUFFER_TOO_SMALL;
@@ -614,10 +662,15 @@ static efi_status_t EFIAPI efi_file_getinfo(struct efi_file_handle *file,
                info->block_size = part.blksz;
                /*
                 * TODO: The volume label is not available in U-Boot.
-                * Use the partition name as substitute.
                 */
-               ascii2unicode((u16 *)info->volume_label,
-                             (const char *)part.name);
+               info->volume_label[0] = 0;
+       } else if (!guidcmp(info_type, &efi_system_volume_label_id)) {
+               if (*buffer_size < 2) {
+                       *buffer_size = 2;
+                       ret = EFI_BUFFER_TOO_SMALL;
+                       goto error;
+               }
+               *(u16 *)buffer = 0;
        } else {
                ret = EFI_UNSUPPORTED;
        }
@@ -642,7 +695,9 @@ static efi_status_t EFIAPI efi_file_setinfo(struct efi_file_handle *file,
                char *new_file_name, *pos;
                loff_t file_size;
 
-               if (buffer_size < sizeof(struct efi_file_info)) {
+               /* The buffer will always contain a file name. */
+               if (buffer_size < sizeof(struct efi_file_info) + 2 ||
+                   buffer_size < info->size) {
                        ret = EFI_BAD_BUFFER_SIZE;
                        goto out;
                }
@@ -668,14 +723,9 @@ static efi_status_t EFIAPI efi_file_setinfo(struct efi_file_handle *file,
                }
                free(new_file_name);
                /* Check for truncation */
-               if (set_blk_dev(fh)) {
-                       ret = EFI_DEVICE_ERROR;
-                       goto out;
-               }
-               if (fs_size(fh->path, &file_size)) {
-                       ret = EFI_DEVICE_ERROR;
+               ret = efi_get_file_size(fh, &file_size);
+               if (ret != EFI_SUCCESS)
                        goto out;
-               }
                if (file_size != info->file_size) {
                        /* TODO: we do not support truncation */
                        EFI_PRINT("Truncation not supported\n");
@@ -687,12 +737,8 @@ static efi_status_t EFIAPI efi_file_setinfo(struct efi_file_handle *file,
                 * TODO: Support read only
                 */
                ret = EFI_SUCCESS;
-       } else if (!guidcmp(info_type, &efi_file_system_info_guid)) {
-               if (buffer_size < sizeof(struct efi_file_system_info)) {
-                       ret = EFI_BAD_BUFFER_SIZE;
-                       goto out;
-               }
        } else {
+               /* TODO: We do not support changing the volume label */
                ret = EFI_UNSUPPORTED;
        }
 out:
@@ -705,12 +751,34 @@ static efi_status_t EFIAPI efi_file_flush(struct efi_file_handle *file)
        return EFI_EXIT(EFI_SUCCESS);
 }
 
+static efi_status_t EFIAPI efi_file_open_ex(struct efi_file_handle *file,
+                       struct efi_file_handle **new_handle,
+                       u16 *file_name, u64 open_mode, u64 attributes,
+                       struct efi_file_io_token *token)
+{
+       return EFI_UNSUPPORTED;
+}
+
+static efi_status_t EFIAPI efi_file_read_ex(struct efi_file_handle *file,
+                       struct efi_file_io_token *token)
+{
+       return EFI_UNSUPPORTED;
+}
+
+static efi_status_t EFIAPI efi_file_write_ex(struct efi_file_handle *file,
+                       struct efi_file_io_token *token)
+{
+       return EFI_UNSUPPORTED;
+}
+
+static efi_status_t EFIAPI efi_file_flush_ex(struct efi_file_handle *file,
+                       struct efi_file_io_token *token)
+{
+       return EFI_UNSUPPORTED;
+}
+
 static const struct efi_file_handle efi_file_handle_protocol = {
-       /*
-        * TODO: We currently only support EFI file protocol revision 0x00010000
-        *       while UEFI specs 2.4 - 2.7 prescribe revision 0x00020000.
-        */
-       .rev = EFI_FILE_PROTOCOL_REVISION,
+       .rev = EFI_FILE_PROTOCOL_REVISION2,
        .open = efi_file_open,
        .close = efi_file_close,
        .delete = efi_file_delete,
@@ -721,6 +789,10 @@ static const struct efi_file_handle efi_file_handle_protocol = {
        .getinfo = efi_file_getinfo,
        .setinfo = efi_file_setinfo,
        .flush = efi_file_flush,
+       .open_ex = efi_file_open_ex,
+       .read_ex = efi_file_read_ex,
+       .write_ex = efi_file_write_ex,
+       .flush_ex = efi_file_flush_ex,
 };
 
 /**