From 00dab5fcba05b134140ab5471d6fa1f99c1bec1f Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Tue, 5 Sep 2017 21:18:59 +0100 Subject: [PATCH] 2017.09 RC4, Add qemu arm target config, patches rebase --- arm-boards | 1 + dragonboard-fixes.patch | 90 +- ...ix-out-of-tree-building-of-tools-all.patch | 69 + qemu-machine-virt-ARM.patch | 514 +++++++ rpi-Enable-USB-keyboard-support.patch | 74 - rpi-Revert-dm-Drop-CONFIG_OF_EMBED.patch | 24 +- sources | 2 +- sti-STiH410-B2260-support.patch | 1323 +++++++++++++++-- sunxi-Fix-CONFIG_SUNXI_GMAC-references.patch | 81 - sunxi-mmc-fixes.patch | 309 ---- uboot-tools.spec | 26 +- uefi-fixes.patch | 14 - 12 files changed, 1840 insertions(+), 687 deletions(-) create mode 100644 env-Fix-out-of-tree-building-of-tools-all.patch create mode 100644 qemu-machine-virt-ARM.patch delete mode 100644 rpi-Enable-USB-keyboard-support.patch delete mode 100644 sunxi-Fix-CONFIG_SUNXI_GMAC-references.patch delete mode 100644 sunxi-mmc-fixes.patch diff --git a/arm-boards b/arm-boards index 8b3f1c6..6c5f424 100644 --- a/arm-boards +++ b/arm-boards @@ -97,6 +97,7 @@ q8_a13_tablet q8_a23_tablet_800x480 q8_a33_tablet_1024x600 q8_a33_tablet_800x480 +qemu_arm r7-tv-dongle riotboard rock diff --git a/dragonboard-fixes.patch b/dragonboard-fixes.patch index 03cf481..bc418b0 100644 --- a/dragonboard-fixes.patch +++ b/dragonboard-fixes.patch @@ -666,51 +666,6 @@ index 626dff8dcd..bbc9685e0e 100644 -- 2.13.3 -From 76fba480e6ee494e2e01c19bb8952f42a3b6a710 Mon Sep 17 00:00:00 2001 -From: Rob Clark -Date: Mon, 3 Jul 2017 09:15:44 -0400 -Subject: [PATCH 12/23] usb: kbd: don't fail with iomux - -stdin might not be set, which would cause iomux_doenv() to fail -therefore causing probe_usb_keyboard() to fail. Furthermore if we do -have iomux enabled, the sensible thing (in terms of user experience) -would be to simply add ourselves to the list of stdin devices. - -Signed-off-by: Rob Clark ---- - common/usb_kbd.c | 15 +++++++++++++++ - 1 file changed, 15 insertions(+) - -diff --git a/common/usb_kbd.c b/common/usb_kbd.c -index d2d29cc98f..703dd748f5 100644 ---- a/common/usb_kbd.c -+++ b/common/usb_kbd.c -@@ -517,7 +517,22 @@ static int probe_usb_keyboard(struct usb_device *dev) - - stdinname = getenv("stdin"); - #if CONFIG_IS_ENABLED(CONSOLE_MUX) -+ char *devname = DEVNAME; -+ /* -+ * stdin might not be set yet.. either way, with console-mux the -+ * sensible thing to do is add ourselves to the list of stdio -+ * devices: -+ */ -+ if (stdinname && !strstr(stdinname, DEVNAME)) { -+ char *newstdin = malloc(strlen(stdinname) + strlen(","DEVNAME) + 1); -+ sprintf(newstdin, "%s,"DEVNAME, stdinname); -+ stdinname = newstdin; -+ } else if (!stdinname) { -+ stdinname = devname; -+ } - error = iomux_doenv(stdin, stdinname); -+ if (stdinname != devname) -+ free(stdinname); - if (error) - return error; - #else --- -2.13.3 - From 47f22a41df082c62411389ab5bf6e9ae26d93083 Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Wed, 19 Jul 2017 10:39:12 -0400 @@ -764,3 +719,48 @@ index d9dc639aeb..626dff8dcd 100644 -- 2.13.3 +From 76fba480e6ee494e2e01c19bb8952f42a3b6a710 Mon Sep 17 00:00:00 2001 +From: Rob Clark +Date: Mon, 3 Jul 2017 09:15:44 -0400 +Subject: [PATCH 12/23] usb: kbd: don't fail with iomux + +stdin might not be set, which would cause iomux_doenv() to fail +therefore causing probe_usb_keyboard() to fail. Furthermore if we do +have iomux enabled, the sensible thing (in terms of user experience) +would be to simply add ourselves to the list of stdin devices. + +Signed-off-by: Rob Clark +--- + common/usb_kbd.c | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +diff --git a/common/usb_kbd.c b/common/usb_kbd.c +index d2d29cc98f..703dd748f5 100644 +--- a/common/usb_kbd.c ++++ b/common/usb_kbd.c +@@ -517,7 +517,22 @@ + + stdinname = env_get("stdin"); + #if CONFIG_IS_ENABLED(CONSOLE_MUX) ++ char *devname = DEVNAME; ++ /* ++ * stdin might not be set yet.. either way, with console-mux the ++ * sensible thing to do is add ourselves to the list of stdio ++ * devices: ++ */ ++ if (stdinname && !strstr(stdinname, DEVNAME)) { ++ char *newstdin = malloc(strlen(stdinname) + strlen(","DEVNAME) + 1); ++ sprintf(newstdin, "%s,"DEVNAME, stdinname); ++ stdinname = newstdin; ++ } else if (!stdinname) { ++ stdinname = devname; ++ } + error = iomux_doenv(stdin, stdinname); ++ if (stdinname != devname) ++ free(stdinname); + if (error) + return error; + #else +-- +2.13.3 + diff --git a/env-Fix-out-of-tree-building-of-tools-all.patch b/env-Fix-out-of-tree-building-of-tools-all.patch new file mode 100644 index 0000000..277f1f1 --- /dev/null +++ b/env-Fix-out-of-tree-building-of-tools-all.patch @@ -0,0 +1,69 @@ +From patchwork Tue Sep 5 18:20:09 2017 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Subject: [U-Boot] env: Fix out of tree building of tools-all +X-Patchwork-Submitter: Tom Rini +X-Patchwork-Id: 810244 +Message-Id: <1504635609-23585-1-git-send-email-trini@konsulko.com> +To: u-boot@lists.denx.de +Date: Tue, 5 Sep 2017 14:20:09 -0400 +From: Tom Rini +List-Id: U-Boot discussion + +With the move of environment code from common/ to env/ a number of +changes needed to be made to various make targets. We missed updating +some of the files required for out of tree builds of the tools. Correct +the 'environ' target to know that we need to work under tools/env/ still +(not tools/environ/) and then update the wrappers in env_attr.c and +env_flags.c to point to the new correct file. + +Reported-by: Peter Robinson +Signed-off-by: Tom Rini +--- + Makefile | 2 +- + tools/env/env_attr.c | 2 +- + tools/env/env_flags.c | 2 +- + tools/env/fw_env.c | 2 +- + 4 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/Makefile b/Makefile +index 792162521155..020ebd50ad22 100644 +--- a/Makefile ++++ b/Makefile +@@ -1466,7 +1466,7 @@ checkarmreloc: u-boot + fi + + environ: scripts_basic +- $(Q)$(MAKE) $(build)=tools/$@ ++ $(Q)$(MAKE) $(build)=tools/env + + tools-only: scripts_basic $(version_h) $(timestamp_h) + $(Q)$(MAKE) $(build)=tools +diff --git a/tools/env/env_attr.c b/tools/env/env_attr.c +index 502d4c900bf2..4d8536335c30 100644 +--- a/tools/env/env_attr.c ++++ b/tools/env/env_attr.c +@@ -1 +1 @@ +-#include "../../common/env_attr.c" ++#include "../../env/attr.c" +diff --git a/tools/env/env_flags.c b/tools/env/env_flags.c +index b261cb8e3907..71e13e2021f6 100644 +--- a/tools/env/env_flags.c ++++ b/tools/env/env_flags.c +@@ -1 +1 @@ +-#include "../../common/env_flags.c" ++#include "../../env/flags.c" +diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c +index 965e1662d702..ab06415898c2 100644 +--- a/tools/env/fw_env.c ++++ b/tools/env/fw_env.c +@@ -755,7 +755,7 @@ static int flash_read_buf (int dev, int fd, void *buf, size_t count, + + /* + * If a block is bad, we retry in the next block at the same +- * offset - see common/env_nand.c::writeenv() ++ * offset - see env/nand.c::writeenv() + */ + lseek (fd, blockstart + block_seek, SEEK_SET); + diff --git a/qemu-machine-virt-ARM.patch b/qemu-machine-virt-ARM.patch new file mode 100644 index 0000000..d73a07f --- /dev/null +++ b/qemu-machine-virt-ARM.patch @@ -0,0 +1,514 @@ +From patchwork Wed Aug 30 08:31:34 2017 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Subject: [U-Boot, + 1/2] PCI: Add driver for a 'pci-host-ecam-generic' host controller +X-Patchwork-Submitter: Tuomas Tynkkynen +X-Patchwork-Id: 807714 +Message-Id: <20170830083135.9183-2-tuomas.tynkkynen@iki.fi> +To: u-boot@lists.denx.de +Cc: Tom Rini +Date: Wed, 30 Aug 2017 11:31:34 +0300 +From: Tuomas Tynkkynen +List-Id: U-Boot discussion + +QEMU emulates such a device with '-machine virt,highmem=off' on ARM. +The 'highmem=off' part is required for things to work as the PCI code +in U-Boot doesn't seem to support 64-bit BARs. + +This driver is basically a copy-paste of the Xilinx PCIE driver with the +Xilinx-specific bits removed and compatible string changed... The +generic code should probably be extracted into some sort of library +functions instead of duplicating them before committing this driver. + +Signed-off-by: Tuomas Tynkkynen +--- + drivers/pci/Kconfig | 8 ++ + drivers/pci/Makefile | 1 + + drivers/pci/pcie_ecam_generic.c | 193 ++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 202 insertions(+) + create mode 100644 drivers/pci/pcie_ecam_generic.c + +diff --git a/drivers/pci/Kconfig b/drivers/pci/Kconfig +index e2a1c0a409..745161fb9f 100644 +--- a/drivers/pci/Kconfig ++++ b/drivers/pci/Kconfig +@@ -33,6 +33,14 @@ config PCI_PNP + help + Enable PCI memory and I/O space resource allocation and assignment. + ++config PCIE_ECAM_GENERIC ++ bool "Generic PCI-E ECAM support" ++ default n ++ depends on DM_PCI ++ help ++ Say Y here if you want to enable support for generic ECAM-based ++ PCIe controllers, such as the one emulated by QEMU. ++ + config PCIE_DW_MVEBU + bool "Enable Armada-8K PCIe driver (DesignWare core)" + default n +diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile +index ad44e83996..5eb12efbf5 100644 +--- a/drivers/pci/Makefile ++++ b/drivers/pci/Makefile +@@ -17,6 +17,7 @@ obj-$(CONFIG_PCI) += pci.o pci_auto_old.o + endif + obj-$(CONFIG_PCI) += pci_auto_common.o pci_common.o + ++obj-$(CONFIG_PCIE_ECAM_GENERIC) += pcie_ecam_generic.o + obj-$(CONFIG_FSL_PCI_INIT) += fsl_pci_init.o + obj-$(CONFIG_PCI_INDIRECT_BRIDGE) += pci_indirect.o + obj-$(CONFIG_PCI_GT64120) += pci_gt64120.o +diff --git a/drivers/pci/pcie_ecam_generic.c b/drivers/pci/pcie_ecam_generic.c +new file mode 100644 +index 0000000000..039e378cb0 +--- /dev/null ++++ b/drivers/pci/pcie_ecam_generic.c +@@ -0,0 +1,193 @@ ++/* ++ * Generic PCIE host provided by e.g. QEMU ++ * ++ * Heavily based on drivers/pci/pcie_xilinx.c ++ * ++ * Copyright (C) 2016 Imagination Technologies ++ * ++ * SPDX-License-Identifier: GPL-2.0 ++ */ ++ ++#include ++#include ++#include ++ ++#include ++ ++/** ++ * struct generic_ecam_pcie - generic_ecam PCIe controller state ++ * @hose: The parent classes PCI controller state ++ * @cfg_base: The base address of memory mapped configuration space ++ */ ++struct generic_ecam_pcie { ++ struct pci_controller hose; ++ void *cfg_base; ++}; ++ ++/** ++ * pcie_generic_ecam_config_address() - Calculate the address of a config access ++ * @pcie: Pointer to the PCI controller state ++ * @bdf: Identifies the PCIe device to access ++ * @offset: The offset into the device's configuration space ++ * @paddress: Pointer to the pointer to write the calculates address to ++ * ++ * Calculates the address that should be accessed to perform a PCIe ++ * configuration space access for a given device identified by the PCIe ++ * controller device @pcie and the bus, device & function numbers in @bdf. If ++ * access to the device is not valid then the function will return an error ++ * code. Otherwise the address to access will be written to the pointer pointed ++ * to by @paddress. ++ * ++ * Return: 0 on success, else -ENODEV ++ */ ++static int pcie_generic_ecam_config_address(struct generic_ecam_pcie *pcie, pci_dev_t bdf, ++ uint offset, void **paddress) ++{ ++ unsigned int bus = PCI_BUS(bdf); ++ unsigned int dev = PCI_DEV(bdf); ++ unsigned int func = PCI_FUNC(bdf); ++ void *addr; ++ ++ addr = pcie->cfg_base; ++ addr += bus << 20; ++ addr += dev << 15; ++ addr += func << 12; ++ addr += offset; ++ *paddress = addr; ++ ++ return 0; ++} ++ ++/** ++ * pcie_generic_ecam_read_config() - Read from configuration space ++ * @pcie: Pointer to the PCI controller state ++ * @bdf: Identifies the PCIe device to access ++ * @offset: The offset into the device's configuration space ++ * @valuep: A pointer at which to store the read value ++ * @size: Indicates the size of access to perform ++ * ++ * Read a value of size @size from offset @offset within the configuration ++ * space of the device identified by the bus, device & function numbers in @bdf ++ * on the PCI bus @bus. ++ * ++ * Return: 0 on success, else -ENODEV or -EINVAL ++ */ ++static int pcie_generic_ecam_read_config(struct udevice *bus, pci_dev_t bdf, ++ uint offset, ulong *valuep, ++ enum pci_size_t size) ++{ ++ struct generic_ecam_pcie *pcie = dev_get_priv(bus); ++ void *address; ++ int err; ++ ++ err = pcie_generic_ecam_config_address(pcie, bdf, offset, &address); ++ if (err < 0) { ++ *valuep = pci_get_ff(size); ++ return 0; ++ } ++ ++ switch (size) { ++ case PCI_SIZE_8: ++ *valuep = __raw_readb(address); ++ return 0; ++ case PCI_SIZE_16: ++ *valuep = __raw_readw(address); ++ return 0; ++ case PCI_SIZE_32: ++ *valuep = __raw_readl(address); ++ return 0; ++ default: ++ return -EINVAL; ++ } ++} ++ ++/** ++ * pcie_generic_ecam_write_config() - Write to configuration space ++ * @pcie: Pointer to the PCI controller state ++ * @bdf: Identifies the PCIe device to access ++ * @offset: The offset into the device's configuration space ++ * @value: The value to write ++ * @size: Indicates the size of access to perform ++ * ++ * Write the value @value of size @size from offset @offset within the ++ * configuration space of the device identified by the bus, device & function ++ * numbers in @bdf on the PCI bus @bus. ++ * ++ * Return: 0 on success, else -ENODEV or -EINVAL ++ */ ++static int pcie_generic_ecam_write_config(struct udevice *bus, pci_dev_t bdf, ++ uint offset, ulong value, ++ enum pci_size_t size) ++{ ++ struct generic_ecam_pcie *pcie = dev_get_priv(bus); ++ void *address; ++ int err; ++ ++ err = pcie_generic_ecam_config_address(pcie, bdf, offset, &address); ++ if (err < 0) ++ return 0; ++ ++ switch (size) { ++ case PCI_SIZE_8: ++ __raw_writeb(value, address); ++ return 0; ++ case PCI_SIZE_16: ++ __raw_writew(value, address); ++ return 0; ++ case PCI_SIZE_32: ++ __raw_writel(value, address); ++ return 0; ++ default: ++ return -EINVAL; ++ } ++} ++ ++/** ++ * pcie_generic_ecam_ofdata_to_platdata() - Translate from DT to device state ++ * @dev: A pointer to the device being operated on ++ * ++ * Translate relevant data from the device tree pertaining to device @dev into ++ * state that the driver will later make use of. This state is stored in the ++ * device's private data structure. ++ * ++ * Return: 0 on success, else -EINVAL ++ */ ++static int pcie_generic_ecam_ofdata_to_platdata(struct udevice *dev) ++{ ++ struct generic_ecam_pcie *pcie = dev_get_priv(dev); ++ struct fdt_resource reg_res; ++ DECLARE_GLOBAL_DATA_PTR; ++ int err; ++ ++ err = fdt_get_resource(gd->fdt_blob, dev_of_offset(dev), "reg", ++ 0, ®_res); ++ if (err < 0) { ++ error("\"reg\" resource not found\n"); ++ return err; ++ } ++ ++ pcie->cfg_base = map_physmem(reg_res.start, ++ fdt_resource_size(®_res), ++ MAP_NOCACHE); ++ ++ return 0; ++} ++ ++static const struct dm_pci_ops pcie_generic_ecam_ops = { ++ .read_config = pcie_generic_ecam_read_config, ++ .write_config = pcie_generic_ecam_write_config, ++}; ++ ++static const struct udevice_id pcie_generic_ecam_ids[] = { ++ { .compatible = "pci-host-ecam-generic" }, ++ { } ++}; ++ ++U_BOOT_DRIVER(pcie_generic_ecam) = { ++ .name = "pcie_generic_ecam", ++ .id = UCLASS_PCI, ++ .of_match = pcie_generic_ecam_ids, ++ .ops = &pcie_generic_ecam_ops, ++ .ofdata_to_platdata = pcie_generic_ecam_ofdata_to_platdata, ++ .priv_auto_alloc_size = sizeof(struct generic_ecam_pcie), ++}; + +From patchwork Wed Aug 30 08:31:35 2017 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Subject: [U-Boot,2/2] ARM: Add a new arch + board for QEMU's 'virt' machine +X-Patchwork-Submitter: Tuomas Tynkkynen +X-Patchwork-Id: 807716 +Message-Id: <20170830083135.9183-3-tuomas.tynkkynen@iki.fi> +To: u-boot@lists.denx.de +Cc: Tom Rini +Date: Wed, 30 Aug 2017 11:31:35 +0300 +From: Tuomas Tynkkynen +List-Id: U-Boot discussion + +This board builds an U-Boot binary that is bootable with QEMU's 'virt' +machine on ARM. The minimal QEMU command line is: + + qemu-system-arm -machine virt,highmem=off -bios u-boot.bin + +(Note that the 'highmem=off' parameter to the 'virt' machine is required for +PCI to work in U-Boot.) This command line enables the following: + - u-boot.bin loaded and executing in the emulated flash at address 0x0 + - A generated device tree blob placed at the start of RAM + - A freely configurable amount of RAM, described by the DTB + - A PL011 serial port, discoverable via the DTB + - An ARMv7 architected timer + - PSCI for rebooting the system + - A generic ECAM-based PCI host controller, discoverable via the DTB + +Additionally, QEMU allows plugging a bunch of useful peripherals to the PCI bus. +The following ones are supported by both U-Boot and Linux: + +- To enable a Serial ATA disk via an Intel ICH9 AHCI controller, pass e.g.: + -drive if=none,file=disk.img,id=mydisk -device ich9-ahci,id=ahci -device ide-drive,drive=mydisk,bus=ahci.0 +- To enable an Intel E1000 network adapter, pass e.g.: + -net nic,model=e1000 -net user +- To add an EHCI-compliant USB host controller, pass e.g.: + -device usb-ehci,id=ehci + +Signed-off-by: Tuomas Tynkkynen +--- + arch/arm/Kconfig | 10 ++++++++ + arch/arm/mach-qemu/Kconfig | 9 +++++++ + board/qemu-arm/Makefile | 5 ++++ + board/qemu-arm/qemu-arm.c | 35 ++++++++++++++++++++++++++ + configs/qemu_arm_defconfig | 27 ++++++++++++++++++++ + include/configs/qemu-arm.h | 63 ++++++++++++++++++++++++++++++++++++++++++++++ + 6 files changed, 149 insertions(+) + create mode 100644 arch/arm/mach-qemu/Kconfig + create mode 100644 board/qemu-arm/Makefile + create mode 100644 board/qemu-arm/qemu-arm.c + create mode 100644 configs/qemu_arm_defconfig + create mode 100644 include/configs/qemu-arm.h + +diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig +index 53d0831935..0d01ba1b73 100644 +--- a/arch/arm/Kconfig ++++ b/arch/arm/Kconfig +@@ -630,6 +630,14 @@ config ARCH_MX5 + select CPU_V7 + select BOARD_EARLY_INIT_F + ++config ARCH_QEMU ++ bool "QEMU Virtual Platform" ++ select CPU_V7 ++ select ARCH_SUPPORT_PSCI ++ select DM ++ select DM_SERIAL ++ select OF_CONTROL ++ + config ARCH_RMOBILE + bool "Renesas ARM SoCs" + select DM +@@ -1149,6 +1157,8 @@ source "arch/arm/mach-stm32/Kconfig" + + source "arch/arm/mach-sunxi/Kconfig" + ++source "arch/arm/mach-qemu/Kconfig" ++ + source "arch/arm/mach-tegra/Kconfig" + + source "arch/arm/mach-uniphier/Kconfig" +diff --git a/arch/arm/mach-qemu/Kconfig b/arch/arm/mach-qemu/Kconfig +new file mode 100644 +index 0000000000..89d2a36719 +--- /dev/null ++++ b/arch/arm/mach-qemu/Kconfig +@@ -0,0 +1,9 @@ ++if ARCH_QEMU ++ ++config SYS_BOARD ++ default "qemu-arm" ++ ++config SYS_CONFIG_NAME ++ default "qemu-arm" ++ ++endif +diff --git a/board/qemu-arm/Makefile b/board/qemu-arm/Makefile +new file mode 100644 +index 0000000000..3e9907d983 +--- /dev/null ++++ b/board/qemu-arm/Makefile +@@ -0,0 +1,5 @@ ++# ++# SPDX-License-Identifier: GPL-2.0 ++# ++ ++obj-y += qemu-arm.o +diff --git a/board/qemu-arm/qemu-arm.c b/board/qemu-arm/qemu-arm.c +new file mode 100644 +index 0000000000..90d7badbf4 +--- /dev/null ++++ b/board/qemu-arm/qemu-arm.c +@@ -0,0 +1,35 @@ ++/* ++ * Copyright (c) 2017 Tuomas Tynkkynen ++ * ++ * SPDX-License-Identifier: GPL-2.0+ ++ */ ++#include ++#include ++ ++DECLARE_GLOBAL_DATA_PTR; ++ ++int board_init(void) ++{ ++ return 0; ++} ++ ++int dram_init(void) ++{ ++ if (fdtdec_setup_memory_size() != 0) ++ return -EINVAL; ++ ++ return 0; ++} ++ ++int dram_init_banksize(void) ++{ ++ fdtdec_setup_memory_banksize(); ++ ++ return 0; ++} ++ ++void *board_fdt_blob_setup(void) ++{ ++ /* QEMU loads a generated DTB for us at the start of RAM. */ ++ return (void *)CONFIG_SYS_SDRAM_BASE; ++} +diff --git a/configs/qemu_arm_defconfig b/configs/qemu_arm_defconfig +new file mode 100644 +index 0000000000..d34512dd0d +--- /dev/null ++++ b/configs/qemu_arm_defconfig +@@ -0,0 +1,27 @@ ++CONFIG_ARM=y ++CONFIG_ARM_SMCCC=y ++CONFIG_ARCH_QEMU=y ++CONFIG_AHCI=y ++CONFIG_DISTRO_DEFAULTS=y ++# CONFIG_DISPLAY_CPUINFO is not set ++# CONFIG_DISPLAY_BOARDINFO is not set ++# CONFIG_CMD_IMLS is not set ++CONFIG_CMD_PCI=y ++CONFIG_CMD_USB=y ++CONFIG_OF_BOARD=y ++CONFIG_AHCI_PCI=y ++CONFIG_BLK=y ++# CONFIG_MMC is not set ++CONFIG_DM_ETH=y ++CONFIG_E1000=y ++CONFIG_PCI=y ++CONFIG_DM_PCI=y ++CONFIG_PCIE_ECAM_GENERIC=y ++CONFIG_SCSI=y ++CONFIG_DM_SCSI=y ++CONFIG_SYSRESET=y ++CONFIG_SYSRESET_PSCI=y ++CONFIG_USB=y ++CONFIG_DM_USB=y ++CONFIG_USB_EHCI_HCD=y ++CONFIG_USB_EHCI_PCI=y +diff --git a/include/configs/qemu-arm.h b/include/configs/qemu-arm.h +new file mode 100644 +index 0000000000..2bcc0efad0 +--- /dev/null ++++ b/include/configs/qemu-arm.h +@@ -0,0 +1,63 @@ ++/* ++ * Copyright (c) 2017 Tuomas Tynkkynen ++ * ++ * SPDX-License-Identifier: GPL-2.0+ ++ */ ++ ++#ifndef __CONFIG_H ++#define __CONFIG_H ++ ++#include ++ ++/* Physical memory map */ ++#define CONFIG_SYS_TEXT_BASE 0x00000000 ++ ++#define CONFIG_NR_DRAM_BANKS 1 ++#define CONFIG_SYS_SDRAM_BASE 0x40000000 ++ ++/* The DTB generated by QEMU is placed at start of RAM, stay away from there */ ++#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_SDRAM_BASE + SZ_2M) ++#define CONFIG_SYS_LOAD_ADDR (CONFIG_SYS_SDRAM_BASE + SZ_2M) ++#define CONFIG_SYS_MALLOC_LEN SZ_16M ++ ++/* QEMU's PL011 serial port is detected via FDT using the device model */ ++#define CONFIG_PL01X_SERIAL ++ ++/* QEMU implements a 62.5MHz architected timer */ ++/* FIXME: can we rely on CNTFREQ instead of hardcoding this fact here? */ ++#define CONFIG_SYS_ARCH_TIMER ++#define CONFIG_SYS_HZ 1000 ++#define CONFIG_SYS_HZ_CLOCK 62500000 ++ ++/* Command prompt options */ ++#define CONFIG_SYS_CBSIZE 512 /* Console I/O Buffer Size */ ++#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \ ++ sizeof(CONFIG_SYS_PROMPT) + 16) ++#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE ++#define CONFIG_SYS_MAXARGS 64 /* max command args */ ++ ++/* For block devices, QEMU emulates an ICH9 AHCI controller over PCI */ ++#define CONFIG_SYS_SCSI_MAX_SCSI_ID 8 ++#define CONFIG_SCSI_AHCI ++#define CONFIG_LIBATA ++ ++/* Environment options */ ++#define CONFIG_ENV_SIZE SZ_64K ++ ++#include ++ ++#define BOOT_TARGET_DEVICES(func) \ ++ func(SCSI, scsi, 0) ++ ++#include ++ ++#define CONFIG_PREBOOT "pci enum" ++#define CONFIG_EXTRA_ENV_SETTINGS \ ++ "fdt_addr=0x40000000\0" \ ++ "scriptaddr=0x40200000\0" \ ++ "pxefile_addr_r=0x40300000\0" \ ++ "kernel_addr_r=0x40400000\0" \ ++ "ramdisk_addr_r=0x44000000\0" \ ++ BOOTENV ++ ++#endif /* __CONFIG_H */ diff --git a/rpi-Enable-USB-keyboard-support.patch b/rpi-Enable-USB-keyboard-support.patch deleted file mode 100644 index 2363fbf..0000000 --- a/rpi-Enable-USB-keyboard-support.patch +++ /dev/null @@ -1,74 +0,0 @@ -From patchwork Fri Aug 25 01:45:31 2017 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -Subject: [U-Boot] rpi: Enable USB keyboard support -From: Simon Glass -X-Patchwork-Id: 805721 -Message-Id: <20170825014531.192640-1-sjg@chromium.org> -To: U-Boot Mailing List -Cc: Fabian Vogt , Stephen Warren -Date: Thu, 24 Aug 2017 19:45:31 -0600 - -This is currently disabled, so USB keyboards are not detected in U_Boot. -Enable this option to fix that. - -Signed-off-by: Simon Glass -Tested-by: Jonathan Gray -Reviewed-by: Bin Meng ---- - - configs/rpi_2_defconfig | 1 + - configs/rpi_3_32b_defconfig | 1 + - configs/rpi_3_defconfig | 1 + - configs/rpi_defconfig | 1 + - 4 files changed, 4 insertions(+) - -diff --git a/configs/rpi_2_defconfig b/configs/rpi_2_defconfig -index 63d1e4042d..5150eed79c 100644 ---- a/configs/rpi_2_defconfig -+++ b/configs/rpi_2_defconfig -@@ -15,6 +15,7 @@ CONFIG_SYS_PROMPT="U-Boot> " - CONFIG_CMD_GPIO=y - CONFIG_CMD_MMC=y - CONFIG_CMD_USB=y -+CONFIG_DM_KEYBOARD=y - CONFIG_DM_MMC=y - CONFIG_MMC_SDHCI=y - CONFIG_MMC_SDHCI_BCM2835=y -diff --git a/configs/rpi_3_32b_defconfig b/configs/rpi_3_32b_defconfig -index 343cb197a1..caceb85b07 100644 ---- a/configs/rpi_3_32b_defconfig -+++ b/configs/rpi_3_32b_defconfig -@@ -16,6 +16,7 @@ CONFIG_SYS_PROMPT="U-Boot> " - CONFIG_CMD_GPIO=y - CONFIG_CMD_MMC=y - CONFIG_CMD_USB=y -+CONFIG_DM_KEYBOARD=y - CONFIG_DM_MMC=y - CONFIG_MMC_SDHCI=y - CONFIG_MMC_SDHCI_BCM2835=y -diff --git a/configs/rpi_3_defconfig b/configs/rpi_3_defconfig -index 6c9f2e32b5..e3dd1b9124 100644 ---- a/configs/rpi_3_defconfig -+++ b/configs/rpi_3_defconfig -@@ -16,6 +16,7 @@ CONFIG_SYS_PROMPT="U-Boot> " - CONFIG_CMD_GPIO=y - CONFIG_CMD_MMC=y - CONFIG_CMD_USB=y -+CONFIG_DM_KEYBOARD=y - CONFIG_DM_MMC=y - CONFIG_MMC_SDHCI=y - CONFIG_MMC_SDHCI_BCM2835=y -diff --git a/configs/rpi_defconfig b/configs/rpi_defconfig -index 6b3cec5ce0..eaf9bb9189 100644 ---- a/configs/rpi_defconfig -+++ b/configs/rpi_defconfig -@@ -15,6 +15,7 @@ CONFIG_SYS_PROMPT="U-Boot> " - CONFIG_CMD_GPIO=y - CONFIG_CMD_MMC=y - CONFIG_CMD_USB=y -+CONFIG_DM_KEYBOARD=y - CONFIG_DM_MMC=y - CONFIG_MMC_SDHCI=y - CONFIG_MMC_SDHCI_BCM2835=y diff --git a/rpi-Revert-dm-Drop-CONFIG_OF_EMBED.patch b/rpi-Revert-dm-Drop-CONFIG_OF_EMBED.patch index ee64ed9..f53a81d 100644 --- a/rpi-Revert-dm-Drop-CONFIG_OF_EMBED.patch +++ b/rpi-Revert-dm-Drop-CONFIG_OF_EMBED.patch @@ -15,50 +15,50 @@ diff --git a/configs/rpi_2_defconfig b/configs/rpi_2_defconfig index 63d1e4042d..98353d0683 100644 --- a/configs/rpi_2_defconfig +++ b/configs/rpi_2_defconfig -@@ -4,6 +4,7 @@ CONFIG_TARGET_RPI_2=y +@@ -4,6 +4,7 @@ CONFIG_DEFAULT_DEVICE_TREE="bcm2836-rpi-2-b" CONFIG_DISTRO_DEFAULTS=y CONFIG_OF_BOARD_SETUP=y +CONFIG_OF_EMBED=y - CONFIG_ENV_FAT_INTERFACE="mmc" - CONFIG_ENV_FAT_DEVICE_AND_PART="0:1" # CONFIG_DISPLAY_CPUINFO is not set + # CONFIG_DISPLAY_BOARDINFO is not set + CONFIG_SYS_PROMPT="U-Boot> " diff --git a/configs/rpi_3_32b_defconfig b/configs/rpi_3_32b_defconfig index 343cb197a1..51009bccb9 100644 --- a/configs/rpi_3_32b_defconfig +++ b/configs/rpi_3_32b_defconfig -@@ -5,6 +5,7 @@ CONFIG_SYS_MALLOC_F_LEN=0x2000 +@@ -5,6 +5,7 @@ CONFIG_DEFAULT_DEVICE_TREE="bcm2837-rpi-3-b" CONFIG_DISTRO_DEFAULTS=y CONFIG_OF_BOARD_SETUP=y +CONFIG_OF_EMBED=y - CONFIG_ENV_FAT_INTERFACE="mmc" - CONFIG_ENV_FAT_DEVICE_AND_PART="0:1" # CONFIG_DISPLAY_CPUINFO is not set + # CONFIG_DISPLAY_BOARDINFO is not set + CONFIG_SYS_PROMPT="U-Boot> " diff --git a/configs/rpi_3_defconfig b/configs/rpi_3_defconfig index 6c9f2e32b5..c3c0185954 100644 --- a/configs/rpi_3_defconfig +++ b/configs/rpi_3_defconfig -@@ -5,6 +5,7 @@ CONFIG_SYS_MALLOC_F_LEN=0x2000 +@@ -5,6 +5,7 @@ CONFIG_DEFAULT_DEVICE_TREE="bcm2837-rpi-3-b" CONFIG_DISTRO_DEFAULTS=y CONFIG_OF_BOARD_SETUP=y +CONFIG_OF_EMBED=y - CONFIG_ENV_FAT_INTERFACE="mmc" - CONFIG_ENV_FAT_DEVICE_AND_PART="0:1" # CONFIG_DISPLAY_CPUINFO is not set + # CONFIG_DISPLAY_BOARDINFO is not set + CONFIG_SYS_PROMPT="U-Boot> " diff --git a/configs/rpi_defconfig b/configs/rpi_defconfig index 6b3cec5ce0..ad5be72510 100644 --- a/configs/rpi_defconfig +++ b/configs/rpi_defconfig -@@ -4,6 +4,7 @@ CONFIG_TARGET_RPI=y +@@ -4,6 +4,7 @@ CONFIG_DEFAULT_DEVICE_TREE="bcm2835-rpi-b" CONFIG_DISTRO_DEFAULTS=y CONFIG_OF_BOARD_SETUP=y +CONFIG_OF_EMBED=y - CONFIG_ENV_FAT_INTERFACE="mmc" - CONFIG_ENV_FAT_DEVICE_AND_PART="0:1" # CONFIG_DISPLAY_CPUINFO is not set + # CONFIG_DISPLAY_BOARDINFO is not set + CONFIG_SYS_PROMPT="U-Boot> " -- 2.13.4 diff --git a/sources b/sources index 2e73596..59cf916 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (u-boot-2017.09-rc2.tar.bz2) = a0cf9db7d2226cb8f10ab0f9c4010aca024d48193df3c15ded38d08bb7c3fda2f2901621f66d6437c03de7980689c92e27793fdc375a51935b87c6c65ba93f9f +SHA512 (u-boot-2017.09-rc4.tar.bz2) = 3fbada7aab3208e5ec43fe675776da7d9a36acd793c84aadcd52bc6f18a040565e3d3639c0b1801a33a959ee56757331da4630f0de5fa7b46c7ae3b2666e5cf2 diff --git a/sti-STiH410-B2260-support.patch b/sti-STiH410-B2260-support.patch index 39bda68..fdcf93f 100644 --- a/sti-STiH410-B2260-support.patch +++ b/sti-STiH410-B2260-support.patch @@ -1,7 +1,18 @@ -From c8ba51a9128dad186794a0bc20639c38851477fa Mon Sep 17 00:00:00 2001 +From patchwork Tue Sep 5 09:04:18 2017 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Subject: [U-Boot,v10,01/10] mmc: sti_sdhci: Rework sti_mmc_core_config() +X-Patchwork-Submitter: Patrice CHOTARD +X-Patchwork-Id: 810017 +Message-Id: <1504602267-31283-2-git-send-email-patrice.chotard@st.com> +To: , , , + , +Date: Tue, 5 Sep 2017 11:04:18 +0200 +From: +List-Id: U-Boot discussion + From: Patrice Chotard -Date: Mon, 13 Feb 2017 10:24:16 +0100 -Subject: [PATCH 1/7] mmc: sti_sdhci: Rework sti_mmc_core_config() Use struct udevice* as input parameter. Previous parameters are retrieved through plat and priv data. @@ -10,12 +21,23 @@ This to prepare to use the reset framework. Signed-off-by: Patrice Chotard Reviewed-by: Jaehoon Chung +Reviewed-by: Simon Glass --- +v10: _ none +v9: _ none +v8: _ none +v7: _ none +v6: _ add reviewed-by Simon Glass +v5: _ none +v4: _ none +v3: _ none +v2: _ none + drivers/mmc/sti_sdhci.c | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/drivers/mmc/sti_sdhci.c b/drivers/mmc/sti_sdhci.c -index f85f6b4db6..714afd92e3 100644 +index f85f6b4..714afd9 100644 --- a/drivers/mmc/sti_sdhci.c +++ b/drivers/mmc/sti_sdhci.c @@ -16,6 +16,7 @@ DECLARE_GLOBAL_DATA_PTR; @@ -106,26 +128,46 @@ index f85f6b4db6..714afd92e3 100644 host->quirks = SDHCI_QUIRK_WAIT_SEND_CMD | SDHCI_QUIRK_32BIT_DMA_ADDR | --- -2.13.4 -From 9da099b52c1e64c831b4243a0ac76c8f9c9f04fb Mon Sep 17 00:00:00 2001 +From patchwork Tue Sep 5 09:04:19 2017 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Subject: [U-Boot, v10, + 02/10] ARM: dts: stih410-family: Add missing reset_names for mmc1 node +X-Patchwork-Submitter: Patrice CHOTARD +X-Patchwork-Id: 810023 +Message-Id: <1504602267-31283-3-git-send-email-patrice.chotard@st.com> +To: , , , + , +Date: Tue, 5 Sep 2017 11:04:19 +0200 +From: +List-Id: U-Boot discussion + From: Patrice Chotard -Date: Mon, 13 Feb 2017 10:00:07 +0100 -Subject: [PATCH 2/7] ARM: dts: stih410-family: Add missing reset_names for - mmc1 node reset-names property is needed to use the reset API for STi sdhci driver. Signed-off-by: Patrice Chotard Reviewed-by: Jaehoon Chung +Reviewed-by: Simon Glass --- + +v10: _ none +v9: _ none +v8: _ none +v7: _ none +v6: _ add reviewed-by Simon Glass +v5: _ none +v4: _ none +v3: _ none +v2: _ none arch/arm/dts/stih407-family.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/dts/stih407-family.dtsi b/arch/arm/dts/stih407-family.dtsi -index af66b53471..452ac1cdce 100644 +index af66b53..452ac1c 100644 --- a/arch/arm/dts/stih407-family.dtsi +++ b/arch/arm/dts/stih407-family.dtsi @@ -563,6 +563,7 @@ @@ -136,22 +178,41 @@ index af66b53471..452ac1cdce 100644 bus-width = <4>; }; --- -2.13.4 -From dcf231fae86261375f95043c7eee880f9027fa37 Mon Sep 17 00:00:00 2001 +From patchwork Tue Sep 5 09:04:20 2017 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Subject: [U-Boot,v10,03/10] mmc: sti_sdhci: Use reset framework +X-Patchwork-Submitter: Patrice CHOTARD +X-Patchwork-Id: 810027 +Message-Id: <1504602267-31283-4-git-send-email-patrice.chotard@st.com> +To: , , , + , +Date: Tue, 5 Sep 2017 11:04:20 +0200 +From: +List-Id: U-Boot discussion + From: Patrice Chotard -Date: Tue, 28 Feb 2017 18:18:42 +0100 -Subject: [PATCH 3/7] mmc: sti_sdhci: Use reset framework Signed-off-by: Patrice Chotard Reviewed-by: Jaehoon Chung +Reviewed-by: Simon Glass --- - drivers/mmc/sti_sdhci.c | 31 ++++++++++++++++++++++--------- - 1 file changed, 22 insertions(+), 9 deletions(-) +v10: _ none +v9: _ none +v8: _ none +v7: _ none +v6: _ add reviewed-by Simon Glass +v5: _ none +v4: _ none +v3: _ none +v2: _ none + drivers/mmc/sti_sdhci.c | 35 ++++++++++++++++++++--------------- + 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/drivers/mmc/sti_sdhci.c b/drivers/mmc/sti_sdhci.c -index 714afd92e3..b0ff54cf73 100644 +index 714afd9..d8b5888 100644 --- a/drivers/mmc/sti_sdhci.c +++ b/drivers/mmc/sti_sdhci.c @@ -8,6 +8,7 @@ @@ -162,7 +223,7 @@ index 714afd92e3..b0ff54cf73 100644 #include #include -@@ -16,6 +17,7 @@ DECLARE_GLOBAL_DATA_PTR; +@@ -16,15 +17,10 @@ DECLARE_GLOBAL_DATA_PTR; struct sti_sdhci_plat { struct mmc_config cfg; struct mmc mmc; @@ -170,7 +231,16 @@ index 714afd92e3..b0ff54cf73 100644 int instance; }; -@@ -37,17 +39,19 @@ struct sti_sdhci_plat { +-/* +- * used to get access to MMC1 reset, +- * will be removed when STi reset driver will be available +- */ +-#define STIH410_SYSCONF5_BASE 0x092b0000 +- + /** + * sti_mmc_core_config: configure the Arasan HC + * @dev : udevice +@@ -37,17 +33,19 @@ struct sti_sdhci_plat { * W/o these settings the SDHCI could configure and use the embedded controller * with limited features. */ @@ -195,7 +265,7 @@ index 714afd92e3..b0ff54cf73 100644 } writel(STI_FLASHSS_MMC_CORE_CONFIG_1, -@@ -66,6 +70,8 @@ static void sti_mmc_core_config(struct udevice *dev) +@@ -66,6 +64,8 @@ static void sti_mmc_core_config(struct udevice *dev) } writel(STI_FLASHSS_MMC_CORE_CONFIG4, host->ioaddr + FLASHSS_MMC_CORE_CONFIG_4); @@ -204,23 +274,21 @@ index 714afd92e3..b0ff54cf73 100644 } static int sti_sdhci_probe(struct udevice *dev) -@@ -80,13 +86,20 @@ static int sti_sdhci_probe(struct udevice *dev) +@@ -80,13 +80,18 @@ static int sti_sdhci_probe(struct udevice *dev) * MMC0 is wired to the SD slot, * MMC1 is wired on the high speed connector */ - - if (fdt_getprop(gd->fdt_blob, dev_of_offset(dev), "resets", NULL)) -+ if (fdt_getprop(gd->fdt_blob, dev_of_offset(dev), "resets", NULL)) { ++ ret = reset_get_by_index(dev, 0, &plat->reset); ++ if (!ret) plat->instance = 1; -- else -+ ret = reset_get_by_name(dev, "softreset", &plat->reset); -+ if (ret) { -+ error("can't get reset for %s (%d)", dev->name, ret); + else +- plat->instance = 0; ++ if (ret == -ENOENT) ++ plat->instance = 0; ++ else + return ret; -+ } -+ } else { - plat->instance = 0; -+ } - sti_mmc_core_config(dev); + ret = sti_mmc_core_config(dev); @@ -229,56 +297,342 @@ index 714afd92e3..b0ff54cf73 100644 host->quirks = SDHCI_QUIRK_WAIT_SEND_CMD | SDHCI_QUIRK_32BIT_DMA_ADDR | --- -2.13.4 -From 57f7ca4d9419eab5021866f3d2deae088d7ef545 Mon Sep 17 00:00:00 2001 +From patchwork Tue Sep 5 09:04:21 2017 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Subject: [U-Boot,v10,04/10] usb: phy: Add STi USB2 PHY +X-Patchwork-Submitter: Patrice CHOTARD +X-Patchwork-Id: 810026 +Message-Id: <1504602267-31283-5-git-send-email-patrice.chotard@st.com> +To: , , , + , +Date: Tue, 5 Sep 2017 11:04:21 +0200 +From: +List-Id: U-Boot discussion + From: Patrice Chotard -Date: Mon, 20 Mar 2017 13:40:41 +0100 -Subject: [PATCH 4/7] board: STiH410-B2260: add OHCI and XHCI related defines + +This is the generic phy driver for the picoPHY ports +used by USB2/1.1 controllers. It is found on STiH407 SoC +family from STMicroelectronics. Signed-off-by: Patrice Chotard +Reviewed-by: Simon Glass --- - include/configs/stih410-b2260.h | 3 +++ - 1 file changed, 3 insertions(+) +v10: _ none +v9: _ update doc/device-tree-bindings/phy/phy-stih407-usb.txt requested by + Marek Vasut +v8: _ add Reviewed-by Simon Glass +v7: _ replace fdtdec_parse_phandle_with_args() by dev_read_phandle_with_args() + _ replace uclass_get_device_by_of_offset() by uclass_get_device_by_ofnode() +v6: _ none +v5: _ add Reviewed-by: Marek Vasut +v4: _ update to use the new PHY uclass currently available on dm-next branch +v3: _ convert driver to USB PHY uclass +v2: _ replace bitfield_replace() by clrsetbits_le32() -diff --git a/include/configs/stih410-b2260.h b/include/configs/stih410-b2260.h -index c71413cc53..5cc6ef884b 100644 ---- a/include/configs/stih410-b2260.h -+++ b/include/configs/stih410-b2260.h -@@ -48,4 +48,7 @@ - - #define CONFIG_SKIP_LOWLEVEL_INIT - -+#define CONFIG_USB_OHCI_NEW -+#define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS 2 + doc/device-tree-bindings/phy/phy-stih407-usb.txt | 24 +++ + drivers/phy/Kconfig | 8 + + drivers/phy/Makefile | 1 + + drivers/phy/sti_usb_phy.c | 181 +++++++++++++++++++++++ + 4 files changed, 214 insertions(+) + create mode 100644 doc/device-tree-bindings/phy/phy-stih407-usb.txt + create mode 100644 drivers/phy/sti_usb_phy.c + +diff --git a/doc/device-tree-bindings/phy/phy-stih407-usb.txt b/doc/device-tree-bindings/phy/phy-stih407-usb.txt +new file mode 100644 +index 0000000..371a7fe +--- /dev/null ++++ b/doc/device-tree-bindings/phy/phy-stih407-usb.txt +@@ -0,0 +1,24 @@ ++ST STiH407 USB PHY controller + - #endif /* __CONFIG_H */ --- -2.13.4 ++This file documents the dt bindings for the usb picoPHY driver which is the PHY for both USB2 and USB3 ++host controllers (when controlling usb2/1.1 devices) available on STiH407 SoC family from STMicroelectronics. ++ ++Required properties: ++- compatible : should be "st,stih407-usb2-phy" ++- st,syscfg : phandle of sysconfig bank plus integer array containing phyparam and phyctrl register offsets ++- resets : list of phandle and reset specifier pairs. There should be two entries, one ++ for the whole phy and one for the port ++- reset-names : list of reset signal names. Should be "global" and "port" ++See: Documentation/devicetree/bindings/reset/st,sti-powerdown.txt ++See: Documentation/devicetree/bindings/reset/reset.txt ++ ++Example: ++ ++usb2_picophy0: usbpicophy { ++ compatible = "st,stih407-usb2-phy"; ++ #phy-cells = <0>; ++ st,syscfg = <&syscfg_core 0x100 0xf4>; ++ resets = <&softreset STIH407_PICOPHY_SOFTRESET>, ++ <&picophyreset STIH407_PICOPHY0_RESET>; ++ reset-names = "global", "port"; ++}; +diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig +index 98f2a1b..3b9a09c 100644 +--- a/drivers/phy/Kconfig ++++ b/drivers/phy/Kconfig +@@ -77,4 +77,12 @@ config SPL_PIPE3_PHY + This PHY is found on omap devices supporting SATA such as dra7, am57x + and omap5 + ++config STI_USB_PHY ++ bool "STMicroelectronics USB2 picoPHY driver for STiH407 family" ++ depends on PHY && ARCH_STI ++ help ++ This is the generic phy driver for the picoPHY ports ++ used by USB2 and USB3 Host controllers available on ++ STiH407 SoC families. ++ + endmenu +diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile +index ab56c46..668040b 100644 +--- a/drivers/phy/Makefile ++++ b/drivers/phy/Makefile +@@ -9,3 +9,4 @@ obj-$(CONFIG_$(SPL_)PHY) += phy-uclass.o + obj-$(CONFIG_$(SPL_)NOP_PHY) += nop-phy.o + obj-$(CONFIG_PHY_SANDBOX) += sandbox-phy.o + obj-$(CONFIG_$(SPL_)PIPE3_PHY) += ti-pipe3-phy.o ++obj-$(CONFIG_STI_USB_PHY) += sti_usb_phy.o +diff --git a/drivers/phy/sti_usb_phy.c b/drivers/phy/sti_usb_phy.c +new file mode 100644 +index 0000000..0e0b1c0 +--- /dev/null ++++ b/drivers/phy/sti_usb_phy.c +@@ -0,0 +1,181 @@ ++/* ++ * Copyright (c) 2017 ++ * Patrice Chotard ++ * ++ * SPDX-License-Identifier: GPL-2.0+ ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++ ++DECLARE_GLOBAL_DATA_PTR; ++ ++/* Default PHY_SEL and REFCLKSEL configuration */ ++#define STIH407_USB_PICOPHY_CTRL_PORT_CONF 0x6 ++ ++/* ports parameters overriding */ ++#define STIH407_USB_PICOPHY_PARAM_DEF 0x39a4dc ++ ++#define PHYPARAM_REG 1 ++#define PHYCTRL_REG 2 ++#define PHYPARAM_NB 3 ++ ++struct sti_usb_phy { ++ struct regmap *regmap; ++ struct reset_ctl global_ctl; ++ struct reset_ctl port_ctl; ++ int param; ++ int ctrl; ++}; ++ ++static int sti_usb_phy_deassert(struct sti_usb_phy *phy) ++{ ++ int ret; ++ ++ ret = reset_deassert(&phy->global_ctl); ++ if (ret < 0) { ++ error("PHY global deassert failed: %d", ret); ++ return ret; ++ } ++ ++ ret = reset_deassert(&phy->port_ctl); ++ if (ret < 0) ++ error("PHY port deassert failed: %d", ret); ++ ++ return ret; ++} ++ ++static int sti_usb_phy_init(struct phy *usb_phy) ++{ ++ struct udevice *dev = usb_phy->dev; ++ struct sti_usb_phy *phy = dev_get_priv(dev); ++ void __iomem *reg; ++ ++ /* set ctrl picophy value */ ++ reg = (void __iomem *)phy->regmap->base + phy->ctrl; ++ /* CTRL_PORT mask is 0x1f */ ++ clrsetbits_le32(reg, 0x1f, STIH407_USB_PICOPHY_CTRL_PORT_CONF); ++ ++ /* set ports parameters overriding */ ++ reg = (void __iomem *)phy->regmap->base + phy->param; ++ /* PARAM_DEF mask is 0xffffffff */ ++ clrsetbits_le32(reg, 0xffffffff, STIH407_USB_PICOPHY_PARAM_DEF); ++ ++ return sti_usb_phy_deassert(phy); ++} ++ ++static int sti_usb_phy_exit(struct phy *usb_phy) ++{ ++ struct udevice *dev = usb_phy->dev; ++ struct sti_usb_phy *phy = dev_get_priv(dev); ++ int ret; ++ ++ ret = reset_assert(&phy->port_ctl); ++ if (ret < 0) { ++ error("PHY port assert failed: %d", ret); ++ return ret; ++ } ++ ++ ret = reset_assert(&phy->global_ctl); ++ if (ret < 0) ++ error("PHY global assert failed: %d", ret); ++ ++ return ret; ++} ++ ++struct phy_ops sti_usb_phy_ops = { ++ .init = sti_usb_phy_init, ++ .exit = sti_usb_phy_exit, ++}; ++ ++int sti_usb_phy_probe(struct udevice *dev) ++{ ++ struct sti_usb_phy *priv = dev_get_priv(dev); ++ struct udevice *syscon; ++ struct ofnode_phandle_args syscfg_phandle; ++ u32 cells[PHYPARAM_NB]; ++ int ret, count; ++ ++ /* get corresponding syscon phandle */ ++ ret = dev_read_phandle_with_args(dev, "st,syscfg", NULL, 0, 0, ++ &syscfg_phandle); ++ ++ if (ret < 0) { ++ error("Can't get syscfg phandle: %d\n", ret); ++ return ret; ++ } ++ ++ ret = uclass_get_device_by_ofnode(UCLASS_SYSCON, syscfg_phandle.node, ++ &syscon); ++ if (ret) { ++ error("unable to find syscon device (%d)\n", ret); ++ return ret; ++ } ++ ++ priv->regmap = syscon_get_regmap(syscon); ++ if (!priv->regmap) { ++ error("unable to find regmap\n"); ++ return -ENODEV; ++ } ++ ++ /* get phy param offset */ ++ count = fdtdec_get_int_array_count(gd->fdt_blob, dev_of_offset(dev), ++ "st,syscfg", cells, ++ ARRAY_SIZE(cells)); ++ ++ if (count < 0) { ++ error("Bad PHY st,syscfg property %d\n", count); ++ return -EINVAL; ++ } ++ ++ if (count > PHYPARAM_NB) { ++ error("Unsupported PHY param count %d\n", count); ++ return -EINVAL; ++ } ++ ++ priv->param = cells[PHYPARAM_REG]; ++ priv->ctrl = cells[PHYCTRL_REG]; ++ ++ /* get global reset control */ ++ ret = reset_get_by_name(dev, "global", &priv->global_ctl); ++ if (ret) { ++ error("can't get global reset for %s (%d)", dev->name, ret); ++ return ret; ++ } ++ ++ /* get port reset control */ ++ ret = reset_get_by_name(dev, "port", &priv->port_ctl); ++ if (ret) { ++ error("can't get port reset for %s (%d)", dev->name, ret); ++ return ret; ++ } ++ ++ return 0; ++} ++ ++static const struct udevice_id sti_usb_phy_ids[] = { ++ { .compatible = "st,stih407-usb2-phy" }, ++ { } ++}; ++ ++U_BOOT_DRIVER(sti_usb_phy) = { ++ .name = "sti_usb_phy", ++ .id = UCLASS_PHY, ++ .of_match = sti_usb_phy_ids, ++ .probe = sti_usb_phy_probe, ++ .ops = &sti_usb_phy_ops, ++ .priv_auto_alloc_size = sizeof(struct sti_usb_phy), ++}; + +From patchwork Tue Sep 5 09:04:22 2017 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Subject: [U-Boot,v10,05/10] STiH410-B2260: enable USB Host Networking +X-Patchwork-Submitter: Patrice CHOTARD +X-Patchwork-Id: 810018 +Message-Id: <1504602267-31283-6-git-send-email-patrice.chotard@st.com> +To: , , , + , +Date: Tue, 5 Sep 2017 11:04:22 +0200 +From: +List-Id: U-Boot discussion -From accdee28c26f95b9ff82db8b46c5ce7c0993fefb Mon Sep 17 00:00:00 2001 From: Patrice Chotard -Date: Mon, 20 Mar 2017 14:38:49 +0100 -Subject: [PATCH 5/7] STiH410-B2260: enable USB Host Networking + +Enable USB Host Networking support by enabling Ethernet/USB +adaptors support and by enabling some BOOTP flags Signed-off-by: Patrice Chotard --- - include/configs/stih410-b2260.h | 12 ++++++++++++ - 1 file changed, 12 insertions(+) + +v10: _ remove obsolete CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS +v9: _ none +v8: _ none +v7: _ none +v6: _ add reviewed-by Simon Glass + _ add missing comment in commit message +v5: _ none +v4: _ none +v3: _ none +v2: _ none + + include/configs/stih410-b2260.h | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) diff --git a/include/configs/stih410-b2260.h b/include/configs/stih410-b2260.h -index 5cc6ef884b..ecf8944818 100644 +index e07dd0e..372c083 100644 --- a/include/configs/stih410-b2260.h +++ b/include/configs/stih410-b2260.h -@@ -48,7 +48,19 @@ +@@ -45,4 +45,19 @@ #define CONFIG_SKIP_LOWLEVEL_INIT +/* USB Configs */ - #define CONFIG_USB_OHCI_NEW - #define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS 2 - ++#define CONFIG_USB_OHCI_NEW ++#define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS 2 ++ +#define CONFIG_USB_HOST_ETHER +#define CONFIG_USB_ETHER_ASIX +#define CONFIG_USB_ETHER_MCS7830 @@ -291,63 +645,65 @@ index 5cc6ef884b..ecf8944818 100644 +#define CONFIG_BOOTP_BOOTPATH + #endif /* __CONFIG_H */ --- -2.13.4 -From 11154aae6801c09838e61da6645015e86c95ee5f Mon Sep 17 00:00:00 2001 -From: Nicolas Le Bayon -Date: Mon, 27 Mar 2017 16:10:45 +0200 -Subject: [PATCH 6/7] board: STiH410-B2260: fix sdram size +From patchwork Tue Sep 5 09:04:23 2017 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Subject: [U-Boot, v10, 06/10] STiH410-B2260: enable USB, fastboot, reset, + PHY related flags +X-Patchwork-Submitter: Patrice CHOTARD +X-Patchwork-Id: 810024 +Message-Id: <1504602267-31283-7-git-send-email-patrice.chotard@st.com> +To: , , , + , +Date: Tue, 5 Sep 2017 11:04:23 +0200 +From: +List-Id: U-Boot discussion -32MB are reserved for Trusted Zone purpose +From: Patrice Chotard -Signed-off-by: Nicolas Le Bayon +Signed-off-by: Patrice Chotard +Reviewed-by: Simon Glass --- - include/configs/stih410-b2260.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) +v10: _ none +v9: _ none +v8: _ none +v7: _ none +v6: _ add reviewed-by Simon Glass +v5: _ remove CONFIG_USB_OHCI_STI and CONFIG_USB_EHCI_STI +: _ enable CONFIG_USB_EHCI_GENERIC and CONFIG_USB_OHCI_GENERIC +v4: _ enable CONFIG_PHY and CONFIG_STI_USB_PHY +v3: _ none +v2: _ none -diff --git a/include/configs/stih410-b2260.h b/include/configs/stih410-b2260.h -index ecf8944818..2ef5c3c68c 100644 ---- a/include/configs/stih410-b2260.h -+++ b/include/configs/stih410-b2260.h -@@ -14,7 +14,7 @@ - #define CONFIG_NR_DRAM_BANKS 1 - #define PHYS_SDRAM_1 0x40000000 - #define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM_1 --#define PHYS_SDRAM_1_SIZE 0x3FE00000 -+#define PHYS_SDRAM_1_SIZE 0x3E000000 - #define CONFIG_SYS_TEXT_BASE 0x7D600000 - #define CONFIG_SYS_LOAD_ADDR PHYS_SDRAM_1 /* default load addr */ - --- -2.13.4 -From ea8ddd51d7c4c27e83586ca5520a26a90d14671d Mon Sep 17 00:00:00 2001 -From: Peter Robinson -Date: Tue, 15 Aug 2017 11:08:31 +0100 -Subject: [PATCH 7/7] sti: enable distro defaults, USB and a few other bits - -Signed-off-by: Peter Robinson ---- - configs/stih410-b2260_defconfig | 26 ++++++++++++++++++++++---- - include/configs/stih410-b2260.h | 24 +++++++++++++++++++++--- - 2 files changed, 43 insertions(+), 7 deletions(-) + configs/stih410-b2260_defconfig | 39 +++++++++++++++++++++++++++++++++++---- + 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/configs/stih410-b2260_defconfig b/configs/stih410-b2260_defconfig -index 998602c3b2..9b5db8503b 100644 +index 10e1a2d..8fd1ff2 100644 --- a/configs/stih410-b2260_defconfig +++ b/configs/stih410-b2260_defconfig -@@ -2,6 +2,7 @@ CONFIG_ARM=y +@@ -2,27 +2,58 @@ CONFIG_ARM=y CONFIG_ARCH_STI=y CONFIG_IDENT_STRING="STMicroelectronics STiH410-B2260" CONFIG_DEFAULT_DEVICE_TREE="stih410-b2260" +CONFIG_DISTRO_DEFAULTS=y CONFIG_FIT=y CONFIG_FIT_VERBOSE=y - CONFIG_ENV_IS_NOWHERE=y -@@ -10,20 +11,37 @@ CONFIG_BOOTARGS="console=ttyS0,115200 earlyprintk consoleblank=0 ignore_loglevel + CONFIG_USE_BOOTARGS=y + CONFIG_BOOTARGS="console=ttyS0,115200 earlyprintk consoleblank=0 ignore_loglevel" # CONFIG_DISPLAY_CPUINFO is not set CONFIG_SYS_PROMPT="stih410-b2260 => " ++CONFIG_FASTBOOT=y ++CONFIG_USB_FUNCTION_FASTBOOT=y ++CONFIG_CMD_FASTBOOT=y ++CONFIG_ANDROID_BOOT_IMAGE=y ++CONFIG_FASTBOOT_BUF_ADDR=0x40000000 ++CONFIG_FASTBOOT_BUF_SIZE=0x3DF00000 ++CONFIG_FASTBOOT_FLASH=y ++CONFIG_FASTBOOT_FLASH_MMC_DEV=0 # CONFIG_CMD_IMLS is not set +CONFIG_CMD_GPT=y CONFIG_CMD_MMC=y @@ -363,9 +719,12 @@ index 998602c3b2..9b5db8503b 100644 CONFIG_OF_CONTROL=y CONFIG_REGMAP=y CONFIG_SYSCON=y ++CONFIG_CLK=y +CONFIG_MISC=y CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_STI=y ++CONFIG_PHY=y ++CONFIG_STI_USB_PHY=y CONFIG_PINCTRL=y +CONFIG_STI_RESET=y CONFIG_STI_ASC_SERIAL=y @@ -376,7 +735,10 @@ index 998602c3b2..9b5db8503b 100644 +CONFIG_USB_XHCI_HCD=y +CONFIG_USB_XHCI_DWC3=y +CONFIG_USB_EHCI_HCD=y ++CONFIG_USB_EHCI_GENERIC=y +CONFIG_USB_OHCI_HCD=y ++CONFIG_USB_OHCI_GENERIC=y ++CONFIG_USB_DWC3=y +CONFIG_USB_DWC3_GADGET=y +CONFIG_USB_STORAGE=y +CONFIG_USB_GADGET=y @@ -384,45 +746,726 @@ index 998602c3b2..9b5db8503b 100644 +CONFIG_G_DNL_MANUFACTURER="STMicroelectronics" +CONFIG_G_DNL_VENDOR_NUM=0x483 +CONFIG_G_DNL_PRODUCT_NUM=0x7270 -+CONFIG_USB_PHY=y +CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_SPL_OF_LIBFDT=y -diff --git a/include/configs/stih410-b2260.h b/include/configs/stih410-b2260.h -index 2ef5c3c68c..c1149b707c 100644 ---- a/include/configs/stih410-b2260.h -+++ b/include/configs/stih410-b2260.h -@@ -20,10 +20,28 @@ - - #define CONFIG_SYS_HZ_CLOCK 1000000000 /* 1 GHz */ - -+#include -+ - /* Environment */ --#define CONFIG_EXTRA_ENV_SETTINGS \ -- "board= B2260" \ -- "load_addr= #CONFIG_SYS_LOAD_ADDR \0" -+#define CONFIG_LOADADDR CONFIG_SYS_LOAD_ADDR -+ -+#define CONFIG_ENV_VARS_UBOOT_CONFIG -+ -+#define BOOT_TARGET_DEVICES(func) \ -+ func(MMC, mmc, 0) \ -+ func(USB, usb, 0) \ -+ func(DHCP, dhcp, na) -+#include -+#define CONFIG_BOOTFILE "uImage" -+#define CONFIG_EXTRA_ENV_SETTINGS \ -+ "kernel_addr_r=0x40000000\0" \ -+ "fdtfile=stih410-b2260.dtb\0" \ -+ "fdt_addr_r=0x47000000\0" \ -+ "scriptaddr=0x50000000\0" \ -+ "fdt_high=0xffffffffffffffff\0" \ -+ "initrd_high=0xffffffffffffffff\0" \ -+ "ramdisk_addr_r=0x48000000\0" \ -+ BOOTENV - - #define CONFIG_ENV_SIZE 0x4000 - --- -2.13.4 +From patchwork Tue Sep 5 09:04:24 2017 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Subject: [U-Boot,v10,07/10] usb: dwc3: Add dwc3 glue driver support for STi +X-Patchwork-Submitter: Patrice CHOTARD +X-Patchwork-Id: 810020 +Message-Id: <1504602267-31283-8-git-send-email-patrice.chotard@st.com> +To: , , , + , +Date: Tue, 5 Sep 2017 11:04:24 +0200 +From: +List-Id: U-Boot discussion + +From: Patrice Chotard + +This patch adds the ST glue logic to manage the DWC3 HC +on STiH407 SoC family. It configures the internal glue +logic and syscfg registers. + +Part of this code been extracted from kernel.org driver +(drivers/usb/dwc3/dwc3-st.c) + +Signed-off-by: Patrice Chotard +Reviewed-by: Simon Glass +--- +v10: _ none +v9: _ move inclusion of linux/usb/otg.h from include/dwc3-sti-glue.h to + drivers/usb/host/dwc3-sti-glue.c requested by Marek Vasut +v8: _ update failpath label names in sti_dwc3_glue_probe() +v7: _ none +v6: _ add reviewed-by Simon Glass + _ put #define first +v5: _ none +v4: _ none +v3: _ rename dwc3-sti.c to dwc3-sti-glue.c + respect device tree hierarchy, this driver is now responsible +: for xhci-sti binding (done in sti_dwc3_glue_bind()) +v2: _ use setbits_le32() instead of read, modify, write sequence + add missing parenthesis + + + + arch/arm/include/asm/arch-stih410/sys_proto.h | 11 ++ + doc/device-tree-bindings/usb/dwc3-st.txt | 60 ++++++ + drivers/usb/host/Kconfig | 9 + + drivers/usb/host/Makefile | 1 + + drivers/usb/host/dwc3-sti-glue.c | 257 ++++++++++++++++++++++++++ + include/dwc3-sti-glue.h | 41 ++++ + 6 files changed, 379 insertions(+) + create mode 100644 arch/arm/include/asm/arch-stih410/sys_proto.h + create mode 100644 doc/device-tree-bindings/usb/dwc3-st.txt + create mode 100644 drivers/usb/host/dwc3-sti-glue.c + create mode 100644 include/dwc3-sti-glue.h + +diff --git a/arch/arm/include/asm/arch-stih410/sys_proto.h b/arch/arm/include/asm/arch-stih410/sys_proto.h +new file mode 100644 +index 0000000..5c40d3b +--- /dev/null ++++ b/arch/arm/include/asm/arch-stih410/sys_proto.h +@@ -0,0 +1,11 @@ ++/* ++ * Copyright (c) 2017 ++ * Patrice Chotard ++ * ++ * SPDX-License-Identifier: GPL-2.0+ ++ */ ++ ++#ifndef _ASM_ARCH_SYS_PROTO_H ++#define _ASM_ARCH_SYS_PROTO_H ++ ++#endif /* _ASM_ARCH_SYS_PROTO_H */ +diff --git a/doc/device-tree-bindings/usb/dwc3-st.txt b/doc/device-tree-bindings/usb/dwc3-st.txt +new file mode 100644 +index 0000000..a26a139 +--- /dev/null ++++ b/doc/device-tree-bindings/usb/dwc3-st.txt +@@ -0,0 +1,60 @@ ++ST DWC3 glue logic ++ ++This file documents the parameters for the dwc3-st driver. ++This driver controls the glue logic used to configure the dwc3 core on ++STiH407 based platforms. ++ ++Required properties: ++ - compatible : must be "st,stih407-dwc3" ++ - reg : glue logic base address and USB syscfg ctrl register offset ++ - reg-names : should be "reg-glue" and "syscfg-reg" ++ - st,syscon : should be phandle to system configuration node which ++ encompasses the glue registers ++ - resets : list of phandle and reset specifier pairs. There should be two entries, one ++ for the powerdown and softreset lines of the usb3 IP ++ - reset-names : list of reset signal names. Names should be "powerdown" and "softreset" ++ ++ - #address-cells, #size-cells : should be '1' if the device has sub-nodes ++ with 'reg' property ++ ++ - pinctl-names : A pinctrl state named "default" must be defined ++ ++ - pinctrl-0 : Pin control group ++ ++ - ranges : allows valid 1:1 translation between child's address space and ++ parent's address space ++ ++Sub-nodes: ++The dwc3 core should be added as subnode to ST DWC3 glue as shown in the ++example below. ++ ++NB: The dr_mode property is NOT optional for this driver, as the default value ++is "otg", which isn't supported by this SoC. Valid dr_mode values for dwc3-st are ++either "host" or "device". ++ ++Example: ++ ++st_dwc3: dwc3@8f94000 { ++ status = "disabled"; ++ compatible = "st,stih407-dwc3"; ++ reg = <0x08f94000 0x1000>, <0x110 0x4>; ++ reg-names = "reg-glue", "syscfg-reg"; ++ st,syscfg = <&syscfg_core>; ++ resets = <&powerdown STIH407_USB3_POWERDOWN>, ++ <&softreset STIH407_MIPHY2_SOFTRESET>; ++ reset-names = "powerdown", "softreset"; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_usb3>; ++ ranges; ++ ++ dwc3: dwc3@9900000 { ++ compatible = "snps,dwc3"; ++ reg = <0x09900000 0x100000>; ++ interrupts = ; ++ dr_mode = "host"; ++ phy-names = "usb2-phy", "usb3-phy"; ++ phys = <&usb2_picophy2>, <&phy_port2 PHY_TYPE_USB3>; ++ }; ++}; +diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig +index eb035a4..f797a25 100644 +--- a/drivers/usb/host/Kconfig ++++ b/drivers/usb/host/Kconfig +@@ -47,6 +47,15 @@ config USB_XHCI_ROCKCHIP + help + Enables support for the on-chip xHCI controller on Rockchip SoCs. + ++config USB_XHCI_STI ++ bool "Support for STMicroelectronics STiH407 family on-chip xHCI USB controller" ++ depends on ARCH_STI ++ default y ++ help ++ Enables support for the on-chip xHCI controller on STMicroelectronics ++ STiH407 family SoCs. This is a driver for the dwc3 to provide the glue logic ++ to configure the controller. ++ + config USB_XHCI_ZYNQMP + bool "Support for Xilinx ZynqMP on-chip xHCI USB controller" + depends on ARCH_ZYNQMP +diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile +index ab5a99f..29afb7c 100644 +--- a/drivers/usb/host/Makefile ++++ b/drivers/usb/host/Makefile +@@ -60,6 +60,7 @@ obj-$(CONFIG_USB_XHCI_FSL) += xhci-fsl.o + obj-$(CONFIG_USB_XHCI_MVEBU) += xhci-mvebu.o + obj-$(CONFIG_USB_XHCI_OMAP) += xhci-omap.o + obj-$(CONFIG_USB_XHCI_PCI) += xhci-pci.o ++obj-$(CONFIG_USB_XHCI_STI) += dwc3-sti-glue.o + + # designware + obj-$(CONFIG_USB_DWC2) += dwc2.o +diff --git a/drivers/usb/host/dwc3-sti-glue.c b/drivers/usb/host/dwc3-sti-glue.c +new file mode 100644 +index 0000000..02ad311 +--- /dev/null ++++ b/drivers/usb/host/dwc3-sti-glue.c +@@ -0,0 +1,257 @@ ++/* ++ * STiH407 family DWC3 specific Glue layer ++ * ++ * Copyright (c) 2017 ++ * Patrice Chotard ++ * ++ * SPDX-License-Identifier: GPL-2.0+ ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++ ++DECLARE_GLOBAL_DATA_PTR; ++ ++/* ++ * struct sti_dwc3_glue_platdata - dwc3 STi glue driver private structure ++ * @syscfg_base: addr for the glue syscfg ++ * @glue_base: addr for the glue registers ++ * @syscfg_offset: usb syscfg control offset ++ * @powerdown_ctl: rest controller for powerdown signal ++ * @softreset_ctl: reset controller for softreset signal ++ * @mode: drd static host/device config ++ */ ++struct sti_dwc3_glue_platdata { ++ phys_addr_t syscfg_base; ++ phys_addr_t glue_base; ++ phys_addr_t syscfg_offset; ++ struct reset_ctl powerdown_ctl; ++ struct reset_ctl softreset_ctl; ++ enum usb_dr_mode mode; ++}; ++ ++static int sti_dwc3_glue_drd_init(struct sti_dwc3_glue_platdata *plat) ++{ ++ unsigned long val; ++ ++ val = readl(plat->syscfg_base + plat->syscfg_offset); ++ ++ val &= USB3_CONTROL_MASK; ++ ++ switch (plat->mode) { ++ case USB_DR_MODE_PERIPHERAL: ++ val &= ~(USB3_DELAY_VBUSVALID ++ | USB3_SEL_FORCE_OPMODE | USB3_FORCE_OPMODE(0x3) ++ | USB3_SEL_FORCE_DPPULLDOWN2 | USB3_FORCE_DPPULLDOWN2 ++ | USB3_SEL_FORCE_DMPULLDOWN2 | USB3_FORCE_DMPULLDOWN2); ++ ++ val |= USB3_DEVICE_NOT_HOST | USB3_FORCE_VBUSVALID; ++ break; ++ ++ case USB_DR_MODE_HOST: ++ val &= ~(USB3_DEVICE_NOT_HOST | USB3_FORCE_VBUSVALID ++ | USB3_SEL_FORCE_OPMODE | USB3_FORCE_OPMODE(0x3) ++ | USB3_SEL_FORCE_DPPULLDOWN2 | USB3_FORCE_DPPULLDOWN2 ++ | USB3_SEL_FORCE_DMPULLDOWN2 | USB3_FORCE_DMPULLDOWN2); ++ ++ val |= USB3_DELAY_VBUSVALID; ++ break; ++ ++ default: ++ error("Unsupported mode of operation %d\n", plat->mode); ++ return -EINVAL; ++ } ++ writel(val, plat->syscfg_base + plat->syscfg_offset); ++ ++ return 0; ++} ++ ++static void sti_dwc3_glue_init(struct sti_dwc3_glue_platdata *plat) ++{ ++ unsigned long reg; ++ ++ reg = readl(plat->glue_base + CLKRST_CTRL); ++ ++ reg |= AUX_CLK_EN | EXT_CFG_RESET_N | XHCI_REVISION; ++ reg &= ~SW_PIPEW_RESET_N; ++ ++ writel(reg, plat->glue_base + CLKRST_CTRL); ++ ++ /* configure mux for vbus, powerpresent and bvalid signals */ ++ reg = readl(plat->glue_base + USB2_VBUS_MNGMNT_SEL1); ++ ++ reg |= SEL_OVERRIDE_VBUSVALID(USB2_VBUS_UTMIOTG) | ++ SEL_OVERRIDE_POWERPRESENT(USB2_VBUS_UTMIOTG) | ++ SEL_OVERRIDE_BVALID(USB2_VBUS_UTMIOTG); ++ ++ writel(reg, plat->glue_base + USB2_VBUS_MNGMNT_SEL1); ++ ++ setbits_le32(plat->glue_base + CLKRST_CTRL, SW_PIPEW_RESET_N); ++} ++ ++static int sti_dwc3_glue_ofdata_to_platdata(struct udevice *dev) ++{ ++ struct sti_dwc3_glue_platdata *plat = dev_get_platdata(dev); ++ struct udevice *syscon; ++ struct regmap *regmap; ++ int ret; ++ u32 reg[4]; ++ ++ ret = fdtdec_get_int_array(gd->fdt_blob, dev_of_offset(dev), ++ "reg", reg, ARRAY_SIZE(reg)); ++ if (ret) { ++ error("unable to find st,stih407-dwc3 reg property(%d)\n", ret); ++ return ret; ++ } ++ ++ plat->glue_base = reg[0]; ++ plat->syscfg_offset = reg[2]; ++ ++ /* get corresponding syscon phandle */ ++ ret = uclass_get_device_by_phandle(UCLASS_SYSCON, dev, "st,syscfg", ++ &syscon); ++ if (ret) { ++ error("unable to find syscon device (%d)\n", ret); ++ return ret; ++ } ++ ++ /* get syscfg-reg base address */ ++ regmap = syscon_get_regmap(syscon); ++ if (!regmap) { ++ error("unable to find regmap\n"); ++ return -ENODEV; ++ } ++ plat->syscfg_base = regmap->base; ++ ++ /* get powerdown reset */ ++ ret = reset_get_by_name(dev, "powerdown", &plat->powerdown_ctl); ++ if (ret) { ++ error("can't get powerdown reset for %s (%d)", dev->name, ret); ++ return ret; ++ } ++ ++ /* get softreset reset */ ++ ret = reset_get_by_name(dev, "softreset", &plat->softreset_ctl); ++ if (ret) ++ error("can't get soft reset for %s (%d)", dev->name, ret); ++ ++ return ret; ++}; ++ ++static int sti_dwc3_glue_bind(struct udevice *dev) ++{ ++ struct sti_dwc3_glue_platdata *plat = dev_get_platdata(dev); ++ int dwc3_node; ++ ++ /* check if one subnode is present */ ++ dwc3_node = fdt_first_subnode(gd->fdt_blob, dev_of_offset(dev)); ++ if (dwc3_node <= 0) { ++ error("Can't find subnode for %s\n", dev->name); ++ return -ENODEV; ++ } ++ ++ /* check if the subnode compatible string is the dwc3 one*/ ++ if (fdt_node_check_compatible(gd->fdt_blob, dwc3_node, ++ "snps,dwc3") != 0) { ++ error("Can't find dwc3 subnode for %s\n", dev->name); ++ return -ENODEV; ++ } ++ ++ /* retrieve the DWC3 dual role mode */ ++ plat->mode = usb_get_dr_mode(dwc3_node); ++ if (plat->mode == USB_DR_MODE_UNKNOWN) ++ /* by default set dual role mode to HOST */ ++ plat->mode = USB_DR_MODE_HOST; ++ ++ return dm_scan_fdt_dev(dev); ++} ++ ++static int sti_dwc3_glue_probe(struct udevice *dev) ++{ ++ struct sti_dwc3_glue_platdata *plat = dev_get_platdata(dev); ++ int ret; ++ ++ /* deassert both powerdown and softreset */ ++ ret = reset_deassert(&plat->powerdown_ctl); ++ if (ret < 0) { ++ error("DWC3 powerdown reset deassert failed: %d", ret); ++ return ret; ++ } ++ ++ ret = reset_deassert(&plat->softreset_ctl); ++ if (ret < 0) { ++ error("DWC3 soft reset deassert failed: %d", ret); ++ goto softreset_err; ++ } ++ ++ ret = sti_dwc3_glue_drd_init(plat); ++ if (ret) ++ goto init_err; ++ ++ sti_dwc3_glue_init(plat); ++ ++ return 0; ++ ++init_err: ++ ret = reset_assert(&plat->softreset_ctl); ++ if (ret < 0) { ++ error("DWC3 soft reset deassert failed: %d", ret); ++ return ret; ++ } ++ ++softreset_err: ++ ret = reset_assert(&plat->powerdown_ctl); ++ if (ret < 0) ++ error("DWC3 powerdown reset deassert failed: %d", ret); ++ ++ return ret; ++} ++ ++static int sti_dwc3_glue_remove(struct udevice *dev) ++{ ++ struct sti_dwc3_glue_platdata *plat = dev_get_platdata(dev); ++ int ret; ++ ++ /* assert both powerdown and softreset */ ++ ret = reset_assert(&plat->powerdown_ctl); ++ if (ret < 0) { ++ error("DWC3 powerdown reset deassert failed: %d", ret); ++ return ret; ++ } ++ ++ ret = reset_assert(&plat->softreset_ctl); ++ if (ret < 0) ++ error("DWC3 soft reset deassert failed: %d", ret); ++ ++ return ret; ++} ++ ++static const struct udevice_id sti_dwc3_glue_ids[] = { ++ { .compatible = "st,stih407-dwc3" }, ++ { } ++}; ++ ++U_BOOT_DRIVER(dwc3_sti_glue) = { ++ .name = "dwc3_sti_glue", ++ .id = UCLASS_MISC, ++ .of_match = sti_dwc3_glue_ids, ++ .ofdata_to_platdata = sti_dwc3_glue_ofdata_to_platdata, ++ .probe = sti_dwc3_glue_probe, ++ .remove = sti_dwc3_glue_remove, ++ .bind = sti_dwc3_glue_bind, ++ .platdata_auto_alloc_size = sizeof(struct sti_dwc3_glue_platdata), ++ .flags = DM_FLAG_ALLOC_PRIV_DMA, ++}; +diff --git a/include/dwc3-sti-glue.h b/include/dwc3-sti-glue.h +new file mode 100644 +index 0000000..98e7696 +--- /dev/null ++++ b/include/dwc3-sti-glue.h +@@ -0,0 +1,41 @@ ++/* ++ * Copyright (c) 2017 ++ * Patrice Chotard ++ * ++ * SPDX-License-Identifier: GPL-2.0+ ++ */ ++ ++#ifndef __DWC3_STI_UBOOT_H_ ++#define __DWC3_STI_UBOOT_H_ ++ ++/* glue registers */ ++#define CLKRST_CTRL 0x00 ++#define AUX_CLK_EN BIT(0) ++#define SW_PIPEW_RESET_N BIT(4) ++#define EXT_CFG_RESET_N BIT(8) ++ ++#define XHCI_REVISION BIT(12) ++ ++#define USB2_VBUS_MNGMNT_SEL1 0x2C ++#define USB2_VBUS_UTMIOTG 0x1 ++ ++#define SEL_OVERRIDE_VBUSVALID(n) ((n) << 0) ++#define SEL_OVERRIDE_POWERPRESENT(n) ((n) << 4) ++#define SEL_OVERRIDE_BVALID(n) ((n) << 8) ++ ++/* Static DRD configuration */ ++#define USB3_CONTROL_MASK 0xf77 ++ ++#define USB3_DEVICE_NOT_HOST BIT(0) ++#define USB3_FORCE_VBUSVALID BIT(1) ++#define USB3_DELAY_VBUSVALID BIT(2) ++#define USB3_SEL_FORCE_OPMODE BIT(4) ++#define USB3_FORCE_OPMODE(n) ((n) << 5) ++#define USB3_SEL_FORCE_DPPULLDOWN2 BIT(8) ++#define USB3_FORCE_DPPULLDOWN2 BIT(9) ++#define USB3_SEL_FORCE_DMPULLDOWN2 BIT(10) ++#define USB3_FORCE_DMPULLDOWN2 BIT(11) ++ ++int sti_dwc3_init(enum usb_dr_mode mode); ++ ++#endif /* __DWC3_STI_UBOOT_H_ */ + +From patchwork Tue Sep 5 09:04:25 2017 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Subject: [U-Boot, v10, + 08/10] ARM: dts: STiH410: set DWC3 dual role mode to peripheral +X-Patchwork-Submitter: Patrice CHOTARD +X-Patchwork-Id: 810021 +Message-Id: <1504602267-31283-9-git-send-email-patrice.chotard@st.com> +To: , , , + , +Date: Tue, 5 Sep 2017 11:04:25 +0200 +From: +List-Id: U-Boot discussion + +From: Patrice Chotard + +On STi 96boards, configure by default the micro USB connector +(managed by DWC3 hardware block) in peripheral mode. +This will allow to use fastboot feature. + +Signed-off-by: Patrice Chotard +Reviewed-by: Simon Glass +--- + +v10: _ none +v9: _ none +v8: _ add Reviewed-by: Simon Glass +v7: _ none + + arch/arm/dts/stih407-family.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm/dts/stih407-family.dtsi b/arch/arm/dts/stih407-family.dtsi +index 452ac1c..6c6de58 100644 +--- a/arch/arm/dts/stih407-family.dtsi ++++ b/arch/arm/dts/stih407-family.dtsi +@@ -655,7 +655,7 @@ + compatible = "snps,dwc3"; + reg = <0x09900000 0x100000>; + interrupts = ; +- dr_mode = "host"; ++ dr_mode = "peripheral"; + phy-names = "usb2-phy", "usb3-phy"; + phys = <&usb2_picophy0>, + <&phy_port2 PHY_TYPE_USB3>; + +From patchwork Tue Sep 5 09:04:26 2017 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Subject: [U-Boot, v10, + 09/10] ARM: dts: STiH410: update ehci and ohci compatible +X-Patchwork-Submitter: Patrice CHOTARD +X-Patchwork-Id: 810019 +Message-Id: <1504602267-31283-10-git-send-email-patrice.chotard@st.com> +To: , , , + , +Date: Tue, 5 Sep 2017 11:04:26 +0200 +From: +List-Id: U-Boot discussion + +From: Patrice Chotard + +Update ehci and ohci node's compatible string in order to +use ehci-generic and ohci-generic drivers. + +Signed-off-by: Patrice Chotard +Reviewed-by: Simon Glass +--- + +v10: _ none +v9: _ none +v8: _ add Reviewed-by: Simon Glass +v7: _ none + + arch/arm/dts/stih410.dtsi | 11 +++++++---- + 1 file changed, 7 insertions(+), 4 deletions(-) + +diff --git a/arch/arm/dts/stih410.dtsi b/arch/arm/dts/stih410.dtsi +index f118a9e..b59b110 100644 +--- a/arch/arm/dts/stih410.dtsi ++++ b/arch/arm/dts/stih410.dtsi +@@ -83,7 +83,7 @@ + }; + + ohci0: usb@9a03c00 { +- compatible = "st,st-ohci-300x"; ++ compatible = "generic-ohci"; + reg = <0x9a03c00 0x100>; + interrupts = ; + clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>, +@@ -91,6 +91,7 @@ + resets = <&powerdown STIH407_USB2_PORT0_POWERDOWN>, + <&softreset STIH407_USB2_PORT0_SOFTRESET>; + reset-names = "power", "softreset"; ++ + phys = <&usb2_picophy1>; + phy-names = "usb"; + +@@ -98,7 +99,7 @@ + }; + + ehci0: usb@9a03e00 { +- compatible = "st,st-ehci-300x"; ++ compatible = "generic-ehci"; + reg = <0x9a03e00 0x100>; + interrupts = ; + pinctrl-names = "default"; +@@ -115,7 +116,7 @@ + }; + + ohci1: usb@9a83c00 { +- compatible = "st,st-ohci-300x"; ++ compatible = "generic-ohci"; + reg = <0x9a83c00 0x100>; + interrupts = ; + clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>, +@@ -123,6 +124,7 @@ + resets = <&powerdown STIH407_USB2_PORT1_POWERDOWN>, + <&softreset STIH407_USB2_PORT1_SOFTRESET>; + reset-names = "power", "softreset"; ++ + phys = <&usb2_picophy2>; + phy-names = "usb"; + +@@ -130,7 +132,7 @@ + }; + + ehci1: usb@9a83e00 { +- compatible = "st,st-ehci-300x"; ++ compatible = "generic-ehci"; + reg = <0x9a83e00 0x100>; + interrupts = ; + pinctrl-names = "default"; +@@ -140,6 +142,7 @@ + resets = <&powerdown STIH407_USB2_PORT1_POWERDOWN>, + <&softreset STIH407_USB2_PORT1_SOFTRESET>; + reset-names = "power", "softreset"; ++ + phys = <&usb2_picophy2>; + phy-names = "usb"; + + +From patchwork Tue Sep 5 09:04:27 2017 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Subject: [U-Boot,v10,10/10] board: STiH410-B2260: add fastboot support +X-Patchwork-Submitter: Patrice CHOTARD +X-Patchwork-Id: 810022 +Message-Id: <1504602267-31283-11-git-send-email-patrice.chotard@st.com> +To: , , , + , +Date: Tue, 5 Sep 2017 11:04:27 +0200 +From: +List-Id: U-Boot discussion + +From: Patrice Chotard + +Add usb_gadget_handle_interrupts(), board_usb_init(), +board_usb_cleanup() and g_dnl_board_usb_cable_connected() +callbacks needed for FASTBOOT support + +Signed-off-by: Patrice Chotard +Reviewed-by: Simon Glass +--- +v10: _ none +v9: _ none +v8: _ none +v7: _ none +v6: _ add reviewed-by Simon Glass +v5: _ none +v4: _ none +v3: _ none +v2: _ none + + + + board/st/stih410-b2260/board.c | 42 ++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 42 insertions(+) + +diff --git a/board/st/stih410-b2260/board.c b/board/st/stih410-b2260/board.c +index 92b0695..d6cbbb8 100644 +--- a/board/st/stih410-b2260/board.c ++++ b/board/st/stih410-b2260/board.c +@@ -7,6 +7,10 @@ + */ + + #include ++#include ++#include ++#include ++#include + + DECLARE_GLOBAL_DATA_PTR; + +@@ -36,3 +40,41 @@ int board_init(void) + { + return 0; + } ++ ++#ifdef CONFIG_USB_DWC3 ++static struct dwc3_device dwc3_device_data = { ++ .maximum_speed = USB_SPEED_HIGH, ++ .dr_mode = USB_DR_MODE_PERIPHERAL, ++ .index = 0, ++}; ++ ++int usb_gadget_handle_interrupts(int index) ++{ ++ dwc3_uboot_handle_interrupt(index); ++ return 0; ++} ++ ++int board_usb_init(int index, enum usb_init_type init) ++{ ++ int node; ++ const void *blob = gd->fdt_blob; ++ ++ /* find the snps,dwc3 node */ ++ node = fdt_node_offset_by_compatible(blob, -1, "snps,dwc3"); ++ ++ dwc3_device_data.base = fdtdec_get_addr(blob, node, "reg"); ++ ++ return dwc3_uboot_init(&dwc3_device_data); ++} ++ ++int board_usb_cleanup(int index, enum usb_init_type init) ++{ ++ dwc3_uboot_exit(index); ++ return 0; ++} ++ ++int g_dnl_board_usb_cable_connected(void) ++{ ++ return 1; ++} ++#endif diff --git a/sunxi-Fix-CONFIG_SUNXI_GMAC-references.patch b/sunxi-Fix-CONFIG_SUNXI_GMAC-references.patch deleted file mode 100644 index d0828f5..0000000 --- a/sunxi-Fix-CONFIG_SUNXI_GMAC-references.patch +++ /dev/null @@ -1,81 +0,0 @@ -From aeac5d911f15e3d17ca857b6e0830e770b4e6db1 Mon Sep 17 00:00:00 2001 -From: Peter Robinson -Date: Tue, 22 Aug 2017 15:52:50 +0100 -Subject: [PATCH] sun7i: fix gmac rename - ---- - arch/arm/include/asm/arch-sunxi/sys_proto.h | 2 +- - board/sunxi/Makefile | 2 +- - include/configs/sunxi-common.h | 2 +- - scripts/build-whitelist.sh | 2 +- - scripts/config_whitelist.txt | 2 +- - 5 files changed, 5 insertions(+), 5 deletions(-) - -diff --git a/arch/arm/include/asm/arch-sunxi/sys_proto.h b/arch/arm/include/asm/arch-sunxi/sys_proto.h -index a373319a2b..096510b787 100644 ---- a/arch/arm/include/asm/arch-sunxi/sys_proto.h -+++ b/arch/arm/include/asm/arch-sunxi/sys_proto.h -@@ -24,7 +24,7 @@ void sdelay(unsigned long); - void return_to_fel(uint32_t lr, uint32_t sp); - - /* Board / SoC level designware gmac init */ --#if !defined CONFIG_SPL_BUILD && defined CONFIG_SUNXI_GMAC -+#if !defined CONFIG_SPL_BUILD && defined CONFIG_SUN7I_GMAC - void eth_init_board(void); - #else - static inline void eth_init_board(void) {} -diff --git a/board/sunxi/Makefile b/board/sunxi/Makefile -index f4411f01c3..526cb72a51 100644 ---- a/board/sunxi/Makefile -+++ b/board/sunxi/Makefile -@@ -9,7 +9,7 @@ - # SPDX-License-Identifier: GPL-2.0+ - # - obj-y += board.o --obj-$(CONFIG_SUNXI_GMAC) += gmac.o -+obj-$(CONFIG_SUN7I_GMAC) += gmac.o - ifndef CONFIG_SPL_BUILD - obj-$(CONFIG_SUNXI_AHCI) += ahci.o - endif -diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h -index 212862acd1..1373b1f037 100644 ---- a/include/configs/sunxi-common.h -+++ b/include/configs/sunxi-common.h -@@ -294,7 +294,7 @@ extern int soft_i2c_gpio_scl; - #define CONFIG_MII /* MII PHY management */ - #endif - --#ifdef CONFIG_SUNXI_GMAC -+#ifdef CONFIG_SUN7I_GMAC - #define CONFIG_PHY_ADDR 1 - #define CONFIG_MII /* MII PHY management */ - #define CONFIG_PHY_REALTEK -diff --git a/scripts/build-whitelist.sh b/scripts/build-whitelist.sh -index 7d8160d5f2..0f102a0585 100755 ---- a/scripts/build-whitelist.sh -+++ b/scripts/build-whitelist.sh -@@ -16,7 +16,7 @@ export LC_ALL=C LC_COLLATE=C - # SUNXI_GMAC,AHCI,SATAPWR=SUNXI_GPB(8) - # - # We want this to produce: --# CONFIG_SUNXI_GMAC -+# CONFIG_SUN7I_GMAC - # CONFIG_AHCI - # CONFIG_SATAPWR - # -diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt -index 6c628c878c..024dcd6a1e 100644 ---- a/scripts/config_whitelist.txt -+++ b/scripts/config_whitelist.txt -@@ -2308,7 +2308,7 @@ CONFIG_STV0991_HZ_CLOCK - CONFIG_ST_SMI - CONFIG_SUNXI_AHCI - CONFIG_SUNXI_EMAC --CONFIG_SUNXI_GMAC -+CONFIG_SUN7I_GMAC - CONFIG_SUNXI_GPIO - CONFIG_SUNXI_MAX_FB_SIZE - CONFIG_SUNXI_USB_PHYS --- -2.13.5 - diff --git a/sunxi-mmc-fixes.patch b/sunxi-mmc-fixes.patch deleted file mode 100644 index a3ebc22..0000000 --- a/sunxi-mmc-fixes.patch +++ /dev/null @@ -1,309 +0,0 @@ -From patchwork Wed Aug 23 11:41:33 2017 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -Subject: [U-Boot,1/4] mmc: sunxi: fix legacy MMC initialisation -From: Maxime Ripard -X-Patchwork-Id: 804954 -Message-Id: <20170823114136.10919-2-maxime.ripard@free-electrons.com> -To: Jagan Teki , Jaehoon Chung , - Simon Glass -Cc: u-boot@lists.denx.de, Maxime Ripard -Date: Wed, 23 Aug 2017 13:41:33 +0200 - -The driver-model rework changed, among other things, the way the private -data were moved around. It now uses the private field in the struct mmc. - -However, the mmc_create argument was changed in the process to always pass -the array we used to have to store our private structures. - -The basically means that all the MMC driver instances will now have the -private data of the first instance, which obviously doesn't work very well. - -Pass the proper pointer to mmc_create. - -Fixes: 034e226bc77e ("dm: mmc: sunxi: Pass private data around explicitly") -Signed-off-by: Maxime Ripard -Tested-by: Chen-Yu Tsai -Tested-by: Jagan Teki -Reviewed-by: Jagan Teki ---- - drivers/mmc/sunxi_mmc.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/drivers/mmc/sunxi_mmc.c b/drivers/mmc/sunxi_mmc.c -index 588574fab6a9..30f1f76e9f8c 100644 ---- a/drivers/mmc/sunxi_mmc.c -+++ b/drivers/mmc/sunxi_mmc.c -@@ -498,7 +498,7 @@ struct mmc *sunxi_mmc_init(int sdc_no) - if (ret) - return NULL; - -- return mmc_create(cfg, mmc_host); -+ return mmc_create(cfg, priv); - } - #else - -From patchwork Wed Aug 23 11:41:34 2017 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -Subject: [U-Boot,2/4] arm: sunxi: compile spl_boot_device even for U-Boot -From: Maxime Ripard -X-Patchwork-Id: 804955 -Message-Id: <20170823114136.10919-3-maxime.ripard@free-electrons.com> -To: Jagan Teki , Jaehoon Chung , - Simon Glass -Cc: u-boot@lists.denx.de, Maxime Ripard -Date: Wed, 23 Aug 2017 13:41:34 +0200 - -U-Boot itself might need to identify the boot device, for example to be -able to tell where to load the kernel from when several options are -possible. - -Remove the guard preventing it from being compiled. - -Signed-off-by: Maxime Ripard -Tested-by: Chen-Yu Tsai ---- - arch/arm/mach-sunxi/board.c | 4 +--- - 1 file changed, 1 insertion(+), 3 deletions(-) - -diff --git a/arch/arm/mach-sunxi/board.c b/arch/arm/mach-sunxi/board.c -index 65b1ebd83787..f5e977b4183d 100644 ---- a/arch/arm/mach-sunxi/board.c -+++ b/arch/arm/mach-sunxi/board.c -@@ -14,9 +14,7 @@ - #include - #include - #include --#ifdef CONFIG_SPL_BUILD - #include --#endif - #include - #include - #include -@@ -210,7 +208,6 @@ void s_init(void) - eth_init_board(); - } - --#ifdef CONFIG_SPL_BUILD - DECLARE_GLOBAL_DATA_PTR; - - /* The sunxi internal brom will try to loader external bootloader -@@ -261,6 +258,7 @@ u32 spl_boot_mode(const u32 boot_device) - return MMCSD_MODE_RAW; - } - -+#ifdef CONFIG_SPL_BUILD - void board_init_f(ulong dummy) - { - spl_init(); -From patchwork Wed Aug 23 11:41:35 2017 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -Subject: [U-Boot,3/4] sunxi: Use spl_boot_device -From: Maxime Ripard -X-Patchwork-Id: 804957 -Message-Id: <20170823114136.10919-4-maxime.ripard@free-electrons.com> -To: Jagan Teki , Jaehoon Chung , - Simon Glass -Cc: u-boot@lists.denx.de, Maxime Ripard -Date: Wed, 23 Aug 2017 13:41:35 +0200 - -Our current board code duplicates a bit the spl_boot_device logic. Now that -we can use that function in the full-flavoured U-Boot, remove that -duplication and call the function instead. - -Signed-off-by: Maxime Ripard ---- - board/sunxi/board.c | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -diff --git a/board/sunxi/board.c b/board/sunxi/board.c -index 800f412b383d..e1d48140878f 100644 ---- a/board/sunxi/board.c -+++ b/board/sunxi/board.c -@@ -32,6 +32,7 @@ - #include - #include - #include -+#include - #include - #include - -@@ -720,11 +721,14 @@ static void setup_environment(const void *fdt) - int misc_init_r(void) - { - __maybe_unused int ret; -+ uint boot; - - setenv("fel_booted", NULL); - setenv("fel_scriptaddr", NULL); -+ -+ boot = spl_boot_device(); - /* determine if we are running in FEL mode */ -- if (!is_boot0_magic(SPL_ADDR + 4)) { /* eGON.BT0 */ -+ if (boot == BOOT_DEVICE_BOARD) { - setenv("fel_booted", "1"); - parse_spl_header(SPL_ADDR); - } -From patchwork Wed Aug 23 11:41:36 2017 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -Subject: [U-Boot,4/4] sunxi: Remove the MMC index hack -From: Maxime Ripard -X-Patchwork-Id: 804956 -Message-Id: <20170823114136.10919-5-maxime.ripard@free-electrons.com> -To: Jagan Teki , Jaehoon Chung , - Simon Glass -Cc: u-boot@lists.denx.de, Maxime Ripard -Date: Wed, 23 Aug 2017 13:41:36 +0200 - -The current code, if there's both an eMMC and an MMC slot available on the -board, will swap the MMC indices based on whether we booted from the eMMC -or the MMC. This way, the MMC we're supposed to boot on will always have -the index 0. - -However, this causes various issues, for example when using other -components that base their behaviour on the MMC index, such as fastboot. - -Let's remove that hack, and take the opposite approach. The MMC will always -have the same index, but the bootcmd will pick the same device than the one -we booted from. This is done through the introduction of the mmc_bootdev -environment variable that will be filled by the board code based on the -boot device informations we can get from the SoC. - -In order to not introduce regressions, we also need to adjust the fastboot -MMC device and the environment device in order to set it to the eMMC, over -the MMC, like it used to be the case. - -Signed-off-by: Maxime Ripard -Tested-by: Chen-Yu Tsai ---- - board/sunxi/board.c | 20 ++++++-------------- - include/configs/sunxi-common.h | 36 ++++++++++++++++++++++++++++++------ - 2 files changed, 36 insertions(+), 20 deletions(-) - -diff --git a/board/sunxi/board.c b/board/sunxi/board.c -index e1d48140878f..664c7d2d8126 100644 ---- a/board/sunxi/board.c -+++ b/board/sunxi/board.c -@@ -492,20 +492,6 @@ int board_mmc_init(bd_t *bis) - return -1; - #endif - --#if !defined(CONFIG_SPL_BUILD) && CONFIG_MMC_SUNXI_SLOT_EXTRA == 2 -- /* -- * On systems with an emmc (mmc2), figure out if we are booting from -- * the emmc and if we are make it "mmc dev 0" so that boot.scr, etc. -- * are searched there first. Note we only do this for u-boot proper, -- * not for the SPL, see spl_boot_device(). -- */ -- if (readb(SPL_ADDR + 0x28) == SUNXI_BOOTED_FROM_MMC2) { -- /* Booting from emmc / mmc2, swap */ -- mmc0->block_dev.devnum = 1; -- mmc1->block_dev.devnum = 0; -- } --#endif -- - return 0; - } - #endif -@@ -725,12 +711,18 @@ int misc_init_r(void) - - setenv("fel_booted", NULL); - setenv("fel_scriptaddr", NULL); -+ setenv("mmc_bootdev", NULL); - - boot = spl_boot_device(); - /* determine if we are running in FEL mode */ - if (boot == BOOT_DEVICE_BOARD) { - setenv("fel_booted", "1"); - parse_spl_header(SPL_ADDR); -+ /* or if we booted from MMC, and which one */ -+ } else if (boot == BOOT_DEVICE_MMC1) { -+ setenv("mmc_bootdev", "0"); -+ } else if (boot == BOOT_DEVICE_MMC2) { -+ setenv("mmc_bootdev", "1"); - } - - setup_environment(gd->fdt_blob); -diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h -index 07c7ffd7f204..79dc3dddd0cc 100644 ---- a/include/configs/sunxi-common.h -+++ b/include/configs/sunxi-common.h -@@ -148,7 +148,13 @@ - #endif - - #if defined(CONFIG_ENV_IS_IN_MMC) --#define CONFIG_SYS_MMC_ENV_DEV 0 /* first detected MMC controller */ -+#if CONFIG_MMC_SUNXI_SLOT_EXTRA != -1 -+/* If we have two devices (most likely eMMC + MMC), favour the eMMC */ -+#define CONFIG_SYS_MMC_ENV_DEV 1 -+#else -+/* Otherwise, use the only device we have */ -+#define CONFIG_SYS_MMC_ENV_DEV 0 -+#endif - #define CONFIG_SYS_MMC_MAX_DEVICE 4 - #elif defined(CONFIG_ENV_IS_NOWHERE) - #define CONFIG_ENV_SIZE (128 << 10) -@@ -328,9 +334,15 @@ extern int soft_i2c_gpio_scl; - #define CONFIG_FASTBOOT_FLASH - - #ifdef CONFIG_MMC -+#if CONFIG_MMC_SUNXI_SLOT_EXTRA != -1 -+/* If we have two devices (most likely eMMC + MMC), favour the eMMC */ -+#define CONFIG_FASTBOOT_FLASH_MMC_DEV 1 -+#else -+/* Otherwise, use the only device we have */ - #define CONFIG_FASTBOOT_FLASH_MMC_DEV 0 - #endif - #endif -+#endif - - #ifdef CONFIG_USB_FUNCTION_MASS_STORAGE - #endif -@@ -405,15 +417,28 @@ extern int soft_i2c_gpio_scl; - "ramdisk ram " RAMDISK_ADDR_R " 0x4000000\0" - - #ifdef CONFIG_MMC --#define BOOT_TARGET_DEVICES_MMC(func) func(MMC, mmc, 0) - #if CONFIG_MMC_SUNXI_SLOT_EXTRA != -1 --#define BOOT_TARGET_DEVICES_MMC_EXTRA(func) func(MMC, mmc, 1) -+#define BOOTENV_DEV_MMC_AUTO(devtypeu, devtypel, instance) \ -+ BOOTENV_DEV_MMC(MMC, mmc, 0) \ -+ BOOTENV_DEV_MMC(MMC, mmc, 1) \ -+ "bootcmd_mmc_auto=" \ -+ "if test ${mmc_bootdev} -eq 1; then " \ -+ "run bootcmd_mmc1; " \ -+ "run bootcmd_mmc0; " \ -+ "elif test ${mmc_bootdev} -eq 0; then " \ -+ "run bootcmd_mmc0; " \ -+ "run bootcmd_mmc1; " \ -+ "fi\0" -+ -+#define BOOTENV_DEV_NAME_MMC_AUTO(devtypeu, devtypel, instance) \ -+ "mmc_auto " -+ -+#define BOOT_TARGET_DEVICES_MMC(func) func(MMC_AUTO, mmc_auto, na) - #else --#define BOOT_TARGET_DEVICES_MMC_EXTRA(func) -+#define BOOT_TARGET_DEVICES_MMC(func) func(MMC, mmc, 0) - #endif - #else - #define BOOT_TARGET_DEVICES_MMC(func) --#define BOOT_TARGET_DEVICES_MMC_EXTRA(func) - #endif - - #ifdef CONFIG_AHCI -@@ -441,7 +466,6 @@ extern int soft_i2c_gpio_scl; - #define BOOT_TARGET_DEVICES(func) \ - func(FEL, fel, na) \ - BOOT_TARGET_DEVICES_MMC(func) \ -- BOOT_TARGET_DEVICES_MMC_EXTRA(func) \ - BOOT_TARGET_DEVICES_SCSI(func) \ - BOOT_TARGET_DEVICES_USB(func) \ - func(PXE, pxe, na) \ diff --git a/uboot-tools.spec b/uboot-tools.spec index 4acfb30..07dc82f 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -1,8 +1,8 @@ -%global candidate rc2 +%global candidate rc4 Name: uboot-tools Version: 2017.09 -Release: 0.4%{?candidate:.%{candidate}}%{?dist} +Release: 0.5%{?candidate:.%{candidate}}%{?dist} Summary: U-Boot utilities License: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+ URL: http://www.denx.de/wiki/U-Boot @@ -16,18 +16,17 @@ Source4: aarch64-chromebooks # Fedoraisms patches, general fixes Patch1: uefi-use-Fedora-specific-path-name.patch Patch2: uefi-fixes.patch +Patch3: env-Fix-out-of-tree-building-of-tools-all.patch # Board fixes and enablement Patch10: dragonboard-fixes.patch -Patch11: mx6-Initial-Hummingboard-2-support.patch -Patch12: sti-STiH410-B2260-support.patch -Patch13: rpi-Revert-dm-Drop-CONFIG_OF_EMBED.patch -Patch14: rpi-Enable-USB-keyboard-support.patch -Patch15: sunxi-Fix-CONFIG_SUNXI_GMAC-references.patch -Patch16: sunxi-mmc-fixes.patch +Patch11: rpi-Revert-dm-Drop-CONFIG_OF_EMBED.patch +Patch12: qemu-machine-virt-ARM.patch +Patch13: sti-STiH410-B2260-support.patch -# Patch17: sunxi-dm-pine64.patch -# Patch14: mvebu-enable-generic-distro-boot-config.patch +# Patch15: mx6-Initial-Hummingboard-2-support.patch +# Patch16: sunxi-dm-pine64.patch +# Patch17: mvebu-enable-generic-distro-boot-config.patch BuildRequires: bc BuildRequires: dtc @@ -37,6 +36,7 @@ BuildRequires: openssl-devel BuildRequires: python2-devel BuildRequires: python2-setuptools BuildRequires: python2-libfdt +BuildRequires: SDL-devel BuildRequires: swig %ifarch %{arm} aarch64 BuildRequires: vboot-utils @@ -107,7 +107,7 @@ do echo "Building board: $board" mkdir builds/$(echo $board)/ # ATF selection, needs improving, suggestions of ATF SoC to Board matrix welcome - sun50i=(pine64_plus bananapi_m64 nanopi_neo2 orangepi_pc2 orangepi_prime orangepi_win orangepi_zero_plus2 sopine_baseboard) + sun50i=(pine64_plus a64-olinuxino bananapi_m64 nanopi_a64 nanopi_neo2 orangepi_pc2 orangepi_prime orangepi_win orangepi_zero_plus2 sopine_baseboard) if [[ " ${sun50i[*]} " == *" $board "* ]]; then echo "Board: $board using sun50iw1p1" cp /usr/share/arm-trusted-firmware/sun50iw1p1/bl31.bin builds/$(echo $board)/ @@ -278,6 +278,10 @@ cp -p board/warp7/README builds/docs/README.warp7 %endif %changelog +* Tue Sep 5 2017 Peter Robinson 2017.09-0.5.rc4 +- 2017.09 RC4 +- Add qemu arm target config + * Fri Aug 25 2017 Peter Robinson 2017.09-0.4.rc2 - Raspberry Pi and Allwinner fixes - Enable some new devices diff --git a/uefi-fixes.patch b/uefi-fixes.patch index 956235c..662c8b5 100644 --- a/uefi-fixes.patch +++ b/uefi-fixes.patch @@ -2340,17 +2340,3 @@ index 4b78f6d556..4a19fabdb3 100644 struct efi_device_path *file_path, -- 2.13.3 - -diff --git a/lib/efi_loader/efi_gop.c b/lib/efi_loader/efi_gop.c -index e063e0c79b..411a8c9226 100644 ---- a/lib/efi_loader/efi_gop.c -+++ b/lib/efi_loader/efi_gop.c -@@ -137,7 +137,7 @@ int efi_gop_register(void) - struct udevice *vdev; - - /* We only support a single video output device for now */ -- if (uclass_first_device(UCLASS_VIDEO, &vdev)) -+ if (uclass_first_device(UCLASS_VIDEO, &vdev) || !vdev) - return -1; - - struct video_priv *priv = dev_get_uclass_priv(vdev);