Re: [U-Boot] [RFC 0/9] import x509/pkcs7 parsers from linux
Ping. Does anybody have any comments on this patch set? Happy or unhappy with my approach here? Thanks, -Takahiro Akashi On Tue, Sep 03, 2019 at 02:42:37PM +0900, AKASHI Takahiro wrote: > Asn1 parsers of x509 certificates and pkcs7 messages are required > to implement image authentication and variable authentication as > part of UEFI secure boot feature. > > As we discussed before in the thread[1], most people insisted that > we should re-use corresponding source code from Linux repository > for this purpose. > > Here is my attempt to import all the necessary files from Linux; Those > will eventually be part of UEFI secure boot implementation, but I'd like > to get early feedback from other peoples before submitting the whole > patchset so that they will be better formatted for merging. > > My approach here is > * files from Linux 5.0 > (will be updated to the latest when I will submit them as finalized >patches.) > * modify files as little as possible > * mark/protect unavoidable changes with "#if(n)def __UBOOT__" > so that future fixes/differences in Linux repository will easily > be applied to U-Boot. > > Please note that checkpatch.pl will complain with a bunch of > warnings/errors but I intentionally left them unchanged for the sake > of better maintainability I said above. > > Any comments will be appreciated. > -Takahiro Akashi > > [1] https://lists.denx.de/pipermail/u-boot/2019-April/366423.html > > AKASHI Takahiro (9): > cmd: add asn1_compiler > Makefile: add build script for asn1 parsers > lib: add asn1 decoder > lib: add oid registry utility > lib: crypto: add public key utility > lib: crypto: add public_key_verify_signature() > lib: crypto: add x509 parser > lib: crypto: add pkcs7 message parser > lib: crypto: add rsa public key parser > > cmd/Kconfig |3 + > include/crypto/internal/rsa.h | 62 ++ > include/crypto/pkcs7.h| 51 + > include/crypto/public_key.h | 89 ++ > include/keys/asymmetric-type.h| 92 ++ > include/linux/asn1.h | 69 ++ > include/linux/asn1_ber_bytecode.h | 93 ++ > include/linux/asn1_decoder.h | 24 + > include/linux/oid_registry.h | 103 ++ > lib/Kconfig | 12 + > lib/Makefile | 18 + > lib/asn1_decoder.c| 520 ++ > lib/build_OID_registry| 207 > lib/crypto/Kconfig| 38 + > lib/crypto/Makefile | 46 + > lib/crypto/asymmetric_type.c | 655 > lib/crypto/pkcs7.asn1 | 135 +++ > lib/crypto/pkcs7_parser.c | 690 > lib/crypto/pkcs7_parser.h | 69 ++ > lib/crypto/public_key.c | 344 ++ > lib/crypto/public_key_local.c | 69 ++ > lib/crypto/rsa_helper.c | 81 ++ > lib/crypto/rsapubkey.asn1 |4 + > lib/crypto/x509.asn1 | 60 ++ > lib/crypto/x509_akid.asn1 | 35 + > lib/crypto/x509_cert_parser.c | 644 > lib/crypto/x509_parser.h | 61 ++ > lib/crypto/x509_public_key.c | 284 + > lib/oid_registry.c| 178 > scripts/Makefile |3 + > scripts/Makefile.build|2 +- > scripts/asn1_compiler.c | 1615 + > 32 files changed, 6355 insertions(+), 1 deletion(-) > create mode 100644 include/crypto/internal/rsa.h > create mode 100644 include/crypto/pkcs7.h > create mode 100644 include/crypto/public_key.h > create mode 100644 include/keys/asymmetric-type.h > create mode 100644 include/linux/asn1.h > create mode 100644 include/linux/asn1_ber_bytecode.h > create mode 100644 include/linux/asn1_decoder.h > create mode 100644 include/linux/oid_registry.h > create mode 100644 lib/asn1_decoder.c > create mode 100755 lib/build_OID_registry > create mode 100644 lib/crypto/Kconfig > create mode 100644 lib/crypto/Makefile > create mode 100644 lib/crypto/asymmetric_type.c > create mode 100644 lib/crypto/pkcs7.asn1 > create mode 100644 lib/crypto/pkcs7_parser.c > create mode 100644 lib/crypto/pkcs7_parser.h > create mode 100644 lib/crypto/public_key.c > create mode 100644 lib/crypto/public_key_local.c > create mode 100644 lib/crypto/rsa_helper.c > create mode 100644 lib/crypto/rsapubkey.asn1 > create mode 100644 lib/crypto/x509.asn1 > create mode 100644 lib/crypto/x509_akid.asn1 > create mode 100644 lib/crypto/x509_cert_parser.c > create mode 100644 lib/crypto/x509_parser.h > create mode 100644 lib/crypto/x509_public_key.c > create mode 100644 lib/oid_registry.c > create mode 100644 scripts/asn1_compiler.c > > -- > 2.21.0 > ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [RFC 3/3] lib: rsa: add rsa_verify_with_pkey()
Simon, On Wed, Sep 18, 2019 at 12:03:25PM +0900, AKASHI Takahiro wrote: > Simon, > > Overall, do you agree to my approach here? Ping. Do you mind my sending out v2? -Takahiro Akashi > On Mon, Sep 16, 2019 at 10:48:07PM -0700, Simon Glass wrote: > > Hi AKASHI, > > > > On Fri, 6 Sep 2019 at 00:06, AKASHI Takahiro > > wrote: > > > > > > This function, and hence rsa_verify(), will perform RSA verification > > > with two essential parameters for a RSA public key in contract of > > > rsa_verify_with_keynode(), which requires additional three parameters > > > stored in FIT image. > > > > > > It will be used in implementing UEFI secure boot, i.e. image > > > authentication > > > and variable authentication. > > > > > > Signed-off-by: AKASHI Takahiro > > > --- > > > lib/rsa/Kconfig | 7 + > > > lib/rsa/Makefile | 3 ++- > > > lib/rsa/rsa-verify.c | 63 ++-- > > > 3 files changed, 64 insertions(+), 9 deletions(-) > > > > > > diff --git a/lib/rsa/Kconfig b/lib/rsa/Kconfig > > > index 338c8124da59..3c1986a26f8c 100644 > > > --- a/lib/rsa/Kconfig > > > +++ b/lib/rsa/Kconfig > > > @@ -25,6 +25,13 @@ config RSA_VERIFY > > > help > > > Add RSA signature verification support. > > > > > > +config RSA_VERIFY_WITH_PKEY > > > + bool "Execute RSA verification without key parameters from FDT" > > > + depends on RSA > > > + help > > > + This options enables RSA signature verification without > > > + using public key parameters which is embedded control FDT. > > > > Please expand this, a lot. It is too brief. > > Will add more description. > > > > + > > > config RSA_SOFTWARE_EXP > > > bool "Enable driver for RSA Modular Exponentiation in software" > > > depends on DM > > > diff --git a/lib/rsa/Makefile b/lib/rsa/Makefile > > > index d66eef74c514..fd4592fd6a8a 100644 > > > --- a/lib/rsa/Makefile > > > +++ b/lib/rsa/Makefile > > > @@ -5,5 +5,6 @@ > > > # (C) Copyright 2000-2007 > > > # Wolfgang Denk, DENX Software Engineering, w...@denx.de. > > > > > > -obj-$(CONFIG_RSA_VERIFY) += rsa-verify.o rsa-checksum.o rsa-keyprop.o > > > +obj-$(CONFIG_RSA_VERIFY) += rsa-verify.o rsa-checksum.o > > > +obj-$(CONFIG_RSA_VERIFY_WITH_PKEY) += rsa-keyprop.o > > > obj-$(CONFIG_RSA_SOFTWARE_EXP) += rsa-mod-exp.o > > > diff --git a/lib/rsa/rsa-verify.c b/lib/rsa/rsa-verify.c > > > index 287fcc4d234d..80eabff3e940 100644 > > > --- a/lib/rsa/rsa-verify.c > > > +++ b/lib/rsa/rsa-verify.c > > > @@ -17,9 +17,14 @@ > > > #include "mkimage.h" > > > #include > > > #endif > > > +#include > > > #include > > > #include > > > > > > +#ifndef __UBOOT__ /* for host tools */ > > > +#undef CONFIG_RSA_VERIFY_WITH_PKEY > > > +#endif > > > + > > > /* Default public exponent for backward compatibility */ > > > #define RSA_DEFAULT_PUBEXP 65537 > > > > > > @@ -342,6 +347,34 @@ static int rsa_verify_key(struct image_sign_info > > > *info, > > > return 0; > > > } > > > > > > +#ifdef CONFIG_RSA_VERIFY_WITH_PKEY > > > +/** > > > + * rsa_verify_with_pkey() > > > + * > > > + */ > > > +static int rsa_verify_with_pkey(struct image_sign_info *info, > > > + const void *hash, uint8_t *sig, uint > > > sig_len) > > > +{ > > > + struct key_prop *prop; > > > + int ret; > > > + > > > + /* Public key is self-described to fill key_prop */ > > > + prop = rsa_gen_key_prop(info->key, info->keylen); > > > + if (!prop) { > > > + debug("Generating necessary parameter for decoding > > > failed\n"); > > > + return -EACCES; > > > + } > > > + > > > + ret = rsa_verify_key(info, prop, sig, sig_len, hash, > > > +info->crypto->key_len); > > > + > > > + rsa_free_key_prop(prop); > > > + > > > + return ret; > > > +} > > > +#endif > > > + > > > +#if CONFIG_IS_ENABLED(FIT_SIGNATURE) > > > /** > > > * rsa_verify_with_keynode() - Verify a signature against some data using > > > * information in node with prperties of RSA Key like modulus, exponent > > > etc. > > > @@ -395,18 +428,21 @@ static int rsa_verify_with_keynode(struct > > > image_sign_info *info, > > > > > > return ret; > > > } > > > +#endif > > > > > > int rsa_verify(struct image_sign_info *info, > > >const struct image_region region[], int region_count, > > >uint8_t *sig, uint sig_len) > > > { > > > - const void *blob = info->fdt_blob; > > > /* Reserve memory for maximum checksum-length */ > > > uint8_t hash[info->crypto->key_len]; > > > + int ret = -EACCES; > > > +#if CONFIG_IS_ENABLED(FIT_SIGNATURE) > > > + const void *blob = info->fdt_blob; > > > int ndepth, noffset; > > > int sig_node, node; > > > char name[100]; > > > - int ret; > > > +#endif > > > > > > /* > > > * Verify that the checksum-length does not exceed
Re: [U-Boot] [U-BOOT PATCH v2 1/2] gpio: sifive: add support for DM based gpio driver for FU540-SoC
Hi Bin, On Wed, Oct 2, 2019 at 6:33 PM Bin Meng wrote: > > On Wed, Oct 2, 2019 at 1:01 AM Sagar Shrikant Kadam > wrote: > > > > This patch adds a DM based driver model for gpio controller present in > > FU540-C000 SoC on HiFive Unleashed A00 board. This SoC has one GPIO > > bank and 16 GPIO lines in total, out of which GPIO0 to GPIO9 and > > GPIO15 are routed to the J1 header on the board. > > > > This implementation is ported from linux based gpio driver submitted > > for review by Wesley W. Terpstra and/or Atish Patra > > (many thanks !!). The linux driver can be referred > > here [1] > > > > [1]: https://lkml.org/lkml/2018/10/9/1103 > > > > Signed-off-by: Sagar Shrikant Kadam > > --- > > arch/riscv/include/asm/arch-generic/gpio.h | 35 ++ > > arch/riscv/include/asm/gpio.h | 6 + > > drivers/gpio/Kconfig | 7 ++ > > drivers/gpio/Makefile | 1 + > > drivers/gpio/sifive-gpio.c | 177 > > + > > 5 files changed, 226 insertions(+) > > create mode 100644 arch/riscv/include/asm/arch-generic/gpio.h > > create mode 100644 arch/riscv/include/asm/gpio.h > > create mode 100644 drivers/gpio/sifive-gpio.c > > > > diff --git a/arch/riscv/include/asm/arch-generic/gpio.h > > b/arch/riscv/include/asm/arch-generic/gpio.h > > new file mode 100644 > > index 000..dfcb753 > > --- /dev/null > > +++ b/arch/riscv/include/asm/arch-generic/gpio.h > > @@ -0,0 +1,35 @@ > > +/* SPDX-License-Identifier: GPL-2.0+ */ > > +/* > > + * Copyright (C) 2019 SiFive, Inc. > > + */ > > + > > +#ifndef _GPIO_SIFIVE_H > > +#define _GPIO_SIFIVE_H > > + > > +#define GPIO_INPUT_VAL 0x00 > > +#define GPIO_INPUT_EN 0x04 > > +#define GPIO_OUTPUT_EN 0x08 > > +#define GPIO_OUTPUT_VAL0x0C > > +#define GPIO_RISE_IE 0x18 > > +#define GPIO_RISE_IP 0x1C > > +#define GPIO_FALL_IE 0x20 > > +#define GPIO_FALL_IP 0x24 > > +#define GPIO_HIGH_IE 0x28 > > +#define GPIO_HIGH_IP 0x2C > > +#define GPIO_LOW_IE0x30 > > +#define GPIO_LOW_IP0x34 > > +#define GPIO_OUTPUT_XOR0x40 > > + > > +#define NR_GPIOS 16 > > + > > +enum gpio_state { > > + LOW, > > + HIGH > > +}; > > + > > +/* Details about a GPIO bank */ > > +struct sifive_gpio_platdata { > > + void *base; /* address of registers in physical memory */ > > +}; > > + > > +#endif /* _GPIO_SIFIVE_H */ > > diff --git a/arch/riscv/include/asm/gpio.h b/arch/riscv/include/asm/gpio.h > > new file mode 100644 > > index 000..008d756 > > --- /dev/null > > +++ b/arch/riscv/include/asm/gpio.h > > @@ -0,0 +1,6 @@ > > +/* SPDX-License-Identifier: GPL-2.0+ */ > > +/* > > + * Copyright 2018 SiFive, Inc. > > + */ > > + > > +#include > > diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig > > index f2dabb5..39f2c7e 100644 > > --- a/drivers/gpio/Kconfig > > +++ b/drivers/gpio/Kconfig > > @@ -285,6 +285,13 @@ config STM32_GPIO > > usable on many stm32 families like stm32f4/f7/h7 and stm32mp1. > > Tested on STM32F7. > > > > +config SIFIVE_GPIO > > + bool "SiFive GPIO driver" > > + depends on DM_GPIO > > + help > > + Device model driver for GPIO controller present in SiFive FU540 > > SoC. This > > + driver enables GPIO interface on HiFive Unleashed A00 board. > > + > > config MVEBU_GPIO > > bool "Marvell MVEBU GPIO driver" > > depends on DM_GPIO && ARCH_MVEBU > > diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile > > index 4a8aa0f..ccc49e2 100644 > > --- a/drivers/gpio/Makefile > > +++ b/drivers/gpio/Makefile > > @@ -61,3 +61,4 @@ obj-$(CONFIG_$(SPL_)PCF8575_GPIO) += pcf8575_gpio.o > > obj-$(CONFIG_PM8916_GPIO) += pm8916_gpio.o > > obj-$(CONFIG_MT7621_GPIO) += mt7621_gpio.o > > obj-$(CONFIG_MSCC_SGPIO) += mscc_sgpio.o > > +obj-$(CONFIG_SIFIVE_GPIO) += sifive-gpio.o > > diff --git a/drivers/gpio/sifive-gpio.c b/drivers/gpio/sifive-gpio.c > > new file mode 100644 > > index 000..76d5a1d3 > > --- /dev/null > > +++ b/drivers/gpio/sifive-gpio.c > > @@ -0,0 +1,177 @@ > > +// SPDX-License-Identifier: GPL-2.0+ > > +/* > > + * SiFive GPIO driver > > + * > > + * Copyright (C) 2019 SiFive, Inc. > > + */ > > + > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > +static int sifive_gpio_probe(struct udevice *dev) > > +{ > > + struct sifive_gpio_platdata *plat = dev_get_platdata(dev); > > + struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev); > > + char name[18], *str; > > + > > + sprintf(name, "gpio@%4lx_", (uintptr_t)plat->base); > > + str = strdup(name); > > + if (!str) > > + return -ENOMEM; > > + uc_priv->bank_name = str; > > + > > + /* > > +* Use the gpio count mentioned in device tree, > > +* if not specified in dt, set NR_GPIOS as default > > +*/ > > + uc_priv->gpio_count = dev_read_u32_default(dev,
Re: [U-Boot] [PATCH] efi: device path for nvme
+Heinrich to review On Thu, Oct 3, 2019 at 5:11 AM Patrick Wildt wrote: > > This adds a device path node for NVMe block devices. For that > nvme_get_namespace_id() is added to return the privately stored > namespace identifier. > > Signed-off-by: Patrick Wildt > > diff --git a/drivers/nvme/nvme.c b/drivers/nvme/nvme.c > index 561f757772..0a72fe2b75 100644 > --- a/drivers/nvme/nvme.c > +++ b/drivers/nvme/nvme.c > @@ -627,6 +627,13 @@ static int nvme_get_info_from_identify(struct nvme_dev > *dev) > return 0; > } > > +u32 > +nvme_get_namespace_id(struct udevice *udev) > +{ > + struct nvme_ns *ns = dev_get_priv(udev); > + return ns->ns_id; > +} > + > int nvme_scan_namespace(void) > { > struct uclass *uc; > diff --git a/include/efi_api.h b/include/efi_api.h > index 37e56da460..b4ab1a 100644 > --- a/include/efi_api.h > +++ b/include/efi_api.h > @@ -422,6 +422,7 @@ struct efi_device_path_acpi_path { > # define DEVICE_PATH_SUB_TYPE_MSG_USB 0x05 > # define DEVICE_PATH_SUB_TYPE_MSG_MAC_ADDR0x0b > # define DEVICE_PATH_SUB_TYPE_MSG_USB_CLASS 0x0f > +# define DEVICE_PATH_SUB_TYPE_MSG_NVME0x17 > # define DEVICE_PATH_SUB_TYPE_MSG_SD 0x1a > # define DEVICE_PATH_SUB_TYPE_MSG_MMC 0x1d > > @@ -459,6 +460,12 @@ struct efi_device_path_usb_class { > u8 device_protocol; > } __packed; > > +struct efi_device_path_nvme { > + struct efi_device_path dp; > + u32 nsid; > + u64 eui64; > +} __packed; > + > struct efi_device_path_sd_mmc_path { > struct efi_device_path dp; > u8 slot_number; > diff --git a/include/nvme.h b/include/nvme.h > index 2c3d14d241..95193c0334 100644 > --- a/include/nvme.h > +++ b/include/nvme.h > @@ -78,4 +78,14 @@ int nvme_scan_namespace(void); > */ > int nvme_print_info(struct udevice *udev); > > +/** > + * nvme_get_namespace_id - return namespace identifier > + * > + * This returns the namespace identifier. > + * > + * @udev: NVMe controller device > + * @return:namespace identifier > + */ > +u32 nvme_get_namespace_id(struct udevice *udev); > + > #endif /* __NVME_H__ */ > diff --git a/lib/efi_loader/efi_device_path.c > b/lib/efi_loader/efi_device_path.c > index 86297bb7c1..89ad80c7bd 100644 > --- a/lib/efi_loader/efi_device_path.c > +++ b/lib/efi_loader/efi_device_path.c > @@ -10,6 +10,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -451,6 +452,11 @@ static unsigned dp_size(struct udevice *dev) > return dp_size(dev->parent) + > sizeof(struct efi_device_path_sd_mmc_path); > #endif > +#if defined(CONFIG_NVME) > + case UCLASS_NVME: > + return dp_size(dev->parent) + > + sizeof(struct efi_device_path_nvme); > +#endif > #ifdef CONFIG_SANDBOX > case UCLASS_ROOT: > /* > @@ -583,6 +589,19 @@ static void *dp_fill(void *buf, struct udevice *dev) > sddp->slot_number = dev->seq; > return [1]; > } > +#endif > +#if defined(CONFIG_NVME) > + case UCLASS_NVME: { > + struct efi_device_path_nvme *dp = > + dp_fill(buf, dev->parent); > + > + dp->dp.type = DEVICE_PATH_TYPE_MESSAGING_DEVICE; > + dp->dp.sub_type = DEVICE_PATH_SUB_TYPE_MSG_NVME; > + dp->dp.length = sizeof(*dp); > + dp->nsid= nvme_get_namespace_id(dev); > + dp->eui64 = 0; > + return [1]; > + } > #endif > default: > debug("%s(%u) %s: unhandled parent class: %s (%u)\n", Regards, Bin ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] binman: Use qemu-x86_defconfig in the example
The doc currently uses sandbox_defconfig as examples of enabling debug/verbose output of binman. However during a sandbox build it does not call binman at all. Change it to qemu-x86_defconfig. Signed-off-by: Bin Meng --- tools/binman/README | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/binman/README b/tools/binman/README index 8e0f0a8..c96a564 100644 --- a/tools/binman/README +++ b/tools/binman/README @@ -931,13 +931,13 @@ old. To enable a full backtrace and other debugging features in binman, pass BINMAN_DEBUG=1 to your build: - make sandbox_defconfig + make qemu-x86_defconfig make BINMAN_DEBUG=1 To enable verbose logging from binman, base BINMAN_VERBOSE to your build, which adds a -v option to the call to binman: - make sandbox_defconfig + make qemu-x86_defconfig make BINMAN_VERBOSE=5 -- 2.7.4 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 04/38] mtd: spi: Add 'struct spi_flash {' to the code
On Wed, Oct 2, 2019 at 9:56 PM Bin Meng wrote: > > On Wed, Sep 25, 2019 at 10:12 PM Simon Glass wrote: > > > > At present spi_flash is defined to be spi_nor which is confusing since it > > is not possible to find the 'spi_flash' by normal text search. Add a > > comment to help with this. > > > > Signed-off-by: Simon Glass > > --- > > > > Changes in v2: None > > > > include/linux/mtd/spi-nor.h | 8 +++- > > 1 file changed, 7 insertions(+), 1 deletion(-) > > > > Reviewed-by: Bin Meng applied to u-boot-x86/next, thanks! ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 05/38] serial: ns16550: Allow serial to enabled/disabled in SPL
On Wed, Oct 2, 2019 at 9:56 PM Bin Meng wrote: > > On Wed, Sep 25, 2019 at 10:12 PM Simon Glass wrote: > > > > At present this driver uses the wrong condition for including the code and > > drivers in SPL/TPL. Update it so that the code is only included if > > DM_SERIAL is enabled for SPL/TPL. > > > > Signed-off-by: Simon Glass > > --- > > > > Changes in v2: None > > > > drivers/serial/ns16550.c | 6 +++--- > > 1 file changed, 3 insertions(+), 3 deletions(-) > > > > Reviewed-by: Bin Meng applied to u-boot-x86/next, thanks! ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 02/38] binman: Allow selection of logging verbosity
On Wed, Oct 2, 2019 at 9:56 PM Bin Meng wrote: > > On Wed, Sep 25, 2019 at 10:12 PM Simon Glass wrote: > > > > Support a new BINMAN_VERBOSE option to the build, to allow passing the > > -v flag to binman. > > > > Signed-off-by: Simon Glass > > --- > > > > Changes in v2: None > > > > Makefile| 3 ++- > > tools/binman/README | 6 ++ > > 2 files changed, 8 insertions(+), 1 deletion(-) > > > > diff --git a/Makefile b/Makefile > > index c5caec8267e..fd390e19458 100644 > > --- a/Makefile > > +++ b/Makefile > > @@ -1214,7 +1214,8 @@ u-boot.ldr: u-boot > > quiet_cmd_binman = BINMAN $@ > > cmd_binman = $(srctree)/tools/binman/binman $(if $(BINMAN_DEBUG),-D) \ > > --toolpath $(objtree)/tools \ > > -build -u -d u-boot.dtb -O . -m \ > > + $(if $(BINMAN_VERBOSE),-v$(BINMAN_VERBOSE)) \ > > + build -u -d u-boot.dtb -O . -m \ > > -I . -I $(srctree) -I $(srctree)/board/$(BOARDDIR) \ > > $(BINMAN_$(@F)) > > > > diff --git a/tools/binman/README b/tools/binman/README > > index b4f6392ab74..8e0f0a8c55b 100644 > > --- a/tools/binman/README > > +++ b/tools/binman/README > > @@ -934,6 +934,12 @@ BINMAN_DEBUG=1 to your build: > > make sandbox_defconfig > > make BINMAN_DEBUG=1 > > > > +To enable verbose logging from binman, base BINMAN_VERBOSE to your build, > > which > > +adds a -v option to the call to binman: > > + > > + make sandbox_defconfig > > I don't see sandbox_defconfig enables BINMAN. Shouldn't it be > qemu-x86_defconfig? I will send a separate patch to correct the defconfig. > > > + make BINMAN_VERBOSE=5 > > + > > > > History / Credits > > - > > -- > > Other than that, > Reviewed-by: Bin Meng > Tested-by: Bin Meng > applied to u-boot-x86/next, thanks! ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 03/38] dm: gpio: Allow control of GPIO uclass in SPL
On Wed, Oct 2, 2019 at 9:56 PM Bin Meng wrote: > > On Wed, Sep 25, 2019 at 10:12 PM Simon Glass wrote: > > > > At present if CONFIG_SPL_GPIO_SUPPORT is enabled then the GPIO uclass > > is included in SPL/TPL without any control for boards. Some boards may > > want to disable this to reduce code size where GPIOs are not needed in > > SPL or TPL. > > > > Add a new Kconfig option to permit this. Default it to 'y' so that > > existing boards work correctly. This allows us to remove the hack in > > config_uncmd_spl.h (eventually that file should be removed). > > > > Signed-off-by: Simon Glass > > --- > > > > Changes in v2: > > - Fix the Kconfig condition to avoid build errors on snow > > > > drivers/gpio/Kconfig | 22 ++ > > drivers/gpio/Makefile | 2 +- > > include/config_uncmd_spl.h | 1 - > > 3 files changed, 23 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig > > index f2dabb554fa..11a242d7aa8 100644 > > --- a/drivers/gpio/Kconfig > > +++ b/drivers/gpio/Kconfig > > @@ -14,6 +14,28 @@ config DM_GPIO > > particular GPIOs that they provide. The uclass interface > > is defined in include/asm-generic/gpio.h. > > > > +config SPL_DM_GPIO > > + bool "Enable Driver Model for GPIO drivers in SPL" > > + depends on DM_GPIO && SPL_DM && SPL_GPIO_SUPPORT > > + default y > > + help > > + Enable driver model for GPIO access. The standard GPIO > > nits: Enable driver model for GPIO access in SPL. > > > + interface (gpio_get_value(), etc.) is then implemented by > > + the GPIO uclass. Drivers provide methods to query the > > + particular GPIOs that they provide. The uclass interface > > + is defined in include/asm-generic/gpio.h. > > + > > +config TPL_DM_GPIO > > + bool "Enable Driver Model for GPIO drivers in TPL" > > + depends on DM_GPIO && TPL_DM && TPL_GPIO_SUPPORT > > + default y > > + help > > + Enable driver model for GPIO access. The standard GPIO > > nits: Enable driver model for GPIO access in TPL. > > > + interface (gpio_get_value(), etc.) is then implemented by > > + the GPIO uclass. Drivers provide methods to query the > > + particular GPIOs that they provide. The uclass interface > > + is defined in include/asm-generic/gpio.h. > > + > > config GPIO_HOG > > bool "Enable GPIO hog support" > > depends on DM_GPIO > > diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile > > index 4a8aa0ff6fe..56e9374e308 100644 > > --- a/drivers/gpio/Makefile > > +++ b/drivers/gpio/Makefile > > @@ -7,7 +7,7 @@ ifndef CONFIG_SPL_BUILD > > obj-$(CONFIG_DWAPB_GPIO) += dwapb_gpio.o > > obj-$(CONFIG_AXP_GPIO) += axp_gpio.o > > endif > > -obj-$(CONFIG_DM_GPIO) += gpio-uclass.o > > +obj-$(CONFIG_$(SPL_TPL_)DM_GPIO) += gpio-uclass.o > > > > obj-$(CONFIG_$(SPL_)DM_PCA953X)+= pca953x_gpio.o > > obj-$(CONFIG_DM_74X164)+= 74x164_gpio.o > > diff --git a/include/config_uncmd_spl.h b/include/config_uncmd_spl.h > > index c2f9735ce79..31da6215b3a 100644 > > --- a/include/config_uncmd_spl.h > > +++ b/include/config_uncmd_spl.h > > @@ -12,7 +12,6 @@ > > > > #ifndef CONFIG_SPL_DM > > #undef CONFIG_DM_SERIAL > > -#undef CONFIG_DM_GPIO > > #undef CONFIG_DM_I2C > > #undef CONFIG_DM_SPI > > #endif > > -- > > Other than that, > Reviewed-by: Bin Meng Fixed the nits, and applied to u-boot-x86/next, thanks! ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 01/38] binman: Pass the toolpath to binman from the main Makefile
On Wed, Oct 2, 2019 at 9:55 PM Bin Meng wrote: > > On Wed, Sep 25, 2019 at 10:12 PM Simon Glass wrote: > > > > Pass in the toolpath in case binman needs to use tools compiled in the > > U-Boot tools/ directory. > > > > Signed-off-by: Simon Glass > > --- > > > > Changes in v2: None > > > > Makefile | 1 + > > 1 file changed, 1 insertion(+) > > > > Reviewed-by: Bin Meng applied to u-boot-x86/next, thanks! ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 2/2] watchdog: designware: Convert to DM and DT probing
On Thu, Oct 3, 2019 at 6:56 AM Marek Vasut wrote: > > Convert the designware watchdog timer driver to DM and add DT probing > support. Perform minor coding style clean up, like drop superfluous > braces. These ought to be no functional change. > > Signed-off-by: Marek Vasut > Cc: Chin Liang See > Cc: Dalon Westergreen > Cc: Dinh Nguyen > Cc: Ley Foon Tan > Cc: Simon Goldschmidt > Cc: Tien Fong Chee > --- > configs/socfpga_stratix10_defconfig | 1 + > configs/socfpga_vining_fpga_defconfig | 1 + > drivers/watchdog/Kconfig | 14 ++-- > drivers/watchdog/designware_wdt.c | 97 +++ > 4 files changed, 77 insertions(+), 36 deletions(-) > > diff --git a/configs/socfpga_stratix10_defconfig > b/configs/socfpga_stratix10_defconfig > index 462082b67b..cc5f49a536 100644 > --- a/configs/socfpga_stratix10_defconfig > +++ b/configs/socfpga_stratix10_defconfig > @@ -56,4 +56,5 @@ CONFIG_USB=y > CONFIG_DM_USB=y > CONFIG_USB_DWC2=y > CONFIG_USB_STORAGE=y > +CONFIG_WDT=y > CONFIG_DESIGNWARE_WATCHDOG=y > diff --git a/configs/socfpga_vining_fpga_defconfig > b/configs/socfpga_vining_fpga_defconfig > index 03c43fa8b9..def7a3eca7 100644 > --- a/configs/socfpga_vining_fpga_defconfig > +++ b/configs/socfpga_vining_fpga_defconfig > @@ -91,4 +91,5 @@ CONFIG_USB_GADGET_VENDOR_NUM=0x0525 > CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 > CONFIG_USB_GADGET_DWC2_OTG=y > CONFIG_USB_GADGET_DOWNLOAD=y > +CONFIG_WDT=y > CONFIG_DESIGNWARE_WATCHDOG=y > diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig > index 6fd9b0a177..ec34993664 100644 > --- a/drivers/watchdog/Kconfig > +++ b/drivers/watchdog/Kconfig > @@ -36,13 +36,6 @@ config ULP_WATCHDOG > help > Say Y here to enable i.MX7ULP watchdog driver. > > -config DESIGNWARE_WATCHDOG > - bool "Designware watchdog timer support" > - select HW_WATCHDOG CONFIG_HW_WATCHDOG is disabled now. Few areas of code in arm/mach-socfpga/ still using this CONFIG and call to hw_watchdog_init(). They need to remove too. Do we need call to uclass_get_device(UCLASS_WDT, 0, ) in SPL to probe watchdog and call to wdt_start() to start watchdog? Can't find place that start watchdog. > - help > - Enable this to support Designware Watchdog Timer IP, present e.g. > - on Altera SoCFPGA SoCs. > - > config WDT > bool "Enable driver model for watchdog timer drivers" > depends on DM > @@ -54,6 +47,13 @@ config WDT > What exactly happens when the timer expires is up to a particular > device/driver. > > +config DESIGNWARE_WATCHDOG > + bool "Designware watchdog timer support" > + depends on WDT > + help > + Enable this to support Designware Watchdog Timer IP, present e.g. > + on Altera SoCFPGA SoCs. > + > config WDT_ARMADA_37XX > bool "Marvell Armada 37xx watchdog timer support" > depends on WDT && ARMADA_3700 > diff --git a/drivers/watchdog/designware_wdt.c > b/drivers/watchdog/designware_wdt.c > index c668567c66..f2b9175345 100644 > --- a/drivers/watchdog/designware_wdt.c > +++ b/drivers/watchdog/designware_wdt.c > @@ -4,7 +4,8 @@ > */ > > #include > -#include > +#include > +#include > #include > #include > > @@ -17,57 +18,95 @@ > #define DW_WDT_CR_RMOD_VAL 0x00 > #define DW_WDT_CRR_RESTART_VAL 0x76 > > +struct designware_wdt_priv { > + void __iomem*base; > +}; > + > /* > * Set the watchdog time interval. > * Counter is 32 bit. > */ > -static int designware_wdt_settimeout(unsigned int timeout) > +static int designware_wdt_settimeout(struct udevice *dev, unsigned int > timeout) > { > + struct designware_wdt_priv *priv = dev_get_priv(dev); > signed int i; > > /* calculate the timeout range value */ > i = (log_2_n_round_up(timeout * CONFIG_DW_WDT_CLOCK_KHZ)) - 16; > - if (i > 15) > - i = 15; > - if (i < 0) > - i = 0; > + i = clamp(i, 0, 15); > + > + writel(i | (i << 4), priv->base + DW_WDT_TORR); > > - writel((i | (i << 4)), (CONFIG_DW_WDT_BASE + DW_WDT_TORR)); > return 0; > } > > -static void designware_wdt_enable(void) > +static unsigned int designware_wdt_is_enabled(struct udevice *dev) > { > - writel(((DW_WDT_CR_RMOD_VAL << DW_WDT_CR_RMOD_OFFSET) | > - (0x1 << DW_WDT_CR_EN_OFFSET)), > - (CONFIG_DW_WDT_BASE + DW_WDT_CR)); > -} > + struct designware_wdt_priv *priv = dev_get_priv(dev); > > -static unsigned int designware_wdt_is_enabled(void) > -{ > - unsigned long val; > - val = readl((CONFIG_DW_WDT_BASE + DW_WDT_CR)); > - return val & 0x1; > + return readl(priv->base + DW_WDT_CR) & BIT(0); > } > > -#if defined(CONFIG_HW_WATCHDOG) > -void hw_watchdog_reset(void) > +static int designware_wdt_reset(struct udevice *dev) > { > - if (designware_wdt_is_enabled()) > + struct designware_wdt_priv *priv = dev_get_priv(dev); >
Re: [U-Boot] One u-boot.bin for Raspberry PI 3 and 4 - possible?
> And with a U-Boot based on f5c626c64874d6e1482edf4a76aa22e5e54be63d without my > patches you see correct behavior? The screen turning off issue was caused by a deployment script copying the wrong u-boot binary to the SD card! The patch does not introduce a regression on RPI 3 (tested before/after patch). Once I switched over to the the real u-boot image the grub graphical font didn't load (irrespective of patch) I was able to fix this by changing the rpi_3_defconfig: -CONFIG_OF_EMBED=y -CONFIG_DEFAULT_DEVICE_TREE="bcm2837-rpi-3-b" +CONFIG_OF_BOARD=y I suspect my issues are to do with DTBs and that all these problems will go away once a single defconfig is available. The screen turning off issue I have no idea about but its from a much older version of u-boot and probably relates to something in the image I built. Sorry for the noise - lets park this one. Cheers, Geoff ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] NVMe: do PCI enumerate before nvme scan
Hi Patrick, On Thu, Oct 3, 2019 at 3:58 AM Patrick Wildt wrote: > > Make sure that the PCI busses are enumerated before trying to > find a NVMe device. > > Signed-off-by: Patrick Wildt > > diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h > index 3570a32dff..563f1bf5fa 100644 > --- a/include/config_distro_bootcmd.h > +++ b/include/config_distro_bootcmd.h > @@ -185,6 +185,7 @@ > "nvme_init=" \ > "if ${nvme_need_init}; then " \ > "setenv nvme_need_init false; " \ > + BOOTENV_RUN_PCI_ENUM \ I think we need insert this to "nvme_boot=", just like "virtio_boot=" does. > "nvme scan; " \ > "fi\0" \ > \ Regards, Bin ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] ARM: socfpga: Fix default mtdparts
The default mtdparts value grew a trailing zero during the Kconfig conversion. This is because the mtdparts value in the header file had a \0 at the end, which got misconverted into plain 0 instead of being dropped. Signed-off-by: Marek Vasut Fixes: 43ede0bca7fc ("Kconfig: Migrate MTDIDS_DEFAULT / MTDPARTS_DEFAULT") Cc: Adam Ford Cc: Simon Goldschmidt Cc: Tom Rini --- configs/socfpga_arria5_defconfig | 2 +- configs/socfpga_cyclone5_defconfig | 2 +- configs/socfpga_de0_nano_soc_defconfig | 2 +- configs/socfpga_is1_defconfig | 2 +- configs/socfpga_mcvevk_defconfig | 2 +- configs/socfpga_sockit_defconfig | 2 +- configs/socfpga_socrates_defconfig | 2 +- configs/socfpga_sr1500_defconfig | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/configs/socfpga_arria5_defconfig b/configs/socfpga_arria5_defconfig index 89e5ff8c71..76c207c090 100644 --- a/configs/socfpga_arria5_defconfig +++ b/configs/socfpga_arria5_defconfig @@ -28,7 +28,7 @@ CONFIG_CMD_USB_MASS_STORAGE=y CONFIG_CMD_CACHE=y CONFIG_CMD_EXT4_WRITE=y CONFIG_MTDIDS_DEFAULT="nor0=ff705000.spi.0" -CONFIG_MTDPARTS_DEFAULT="mtdparts=ff705000.spi.0:1m(u-boot),256k(env1),256k(env2),14848k(boot),16m(rootfs),-@1536k(UBI)0" +CONFIG_MTDPARTS_DEFAULT="mtdparts=ff705000.spi.0:1m(u-boot),256k(env1),256k(env2),14848k(boot),16m(rootfs),-@1536k(UBI)" CONFIG_CMD_UBI=y # CONFIG_ISO_PARTITION is not set # CONFIG_EFI_PARTITION is not set diff --git a/configs/socfpga_cyclone5_defconfig b/configs/socfpga_cyclone5_defconfig index 00f2104276..776f798442 100644 --- a/configs/socfpga_cyclone5_defconfig +++ b/configs/socfpga_cyclone5_defconfig @@ -28,7 +28,7 @@ CONFIG_CMD_USB_MASS_STORAGE=y CONFIG_CMD_CACHE=y CONFIG_CMD_EXT4_WRITE=y CONFIG_MTDIDS_DEFAULT="nor0=ff705000.spi.0" -CONFIG_MTDPARTS_DEFAULT="mtdparts=ff705000.spi.0:1m(u-boot),256k(env1),256k(env2),14848k(boot),16m(rootfs),-@1536k(UBI)0" +CONFIG_MTDPARTS_DEFAULT="mtdparts=ff705000.spi.0:1m(u-boot),256k(env1),256k(env2),14848k(boot),16m(rootfs),-@1536k(UBI)" CONFIG_CMD_UBI=y # CONFIG_ISO_PARTITION is not set # CONFIG_EFI_PARTITION is not set diff --git a/configs/socfpga_de0_nano_soc_defconfig b/configs/socfpga_de0_nano_soc_defconfig index de50f17174..2ad11be223 100644 --- a/configs/socfpga_de0_nano_soc_defconfig +++ b/configs/socfpga_de0_nano_soc_defconfig @@ -29,7 +29,7 @@ CONFIG_CMD_USB_MASS_STORAGE=y CONFIG_CMD_CACHE=y CONFIG_CMD_EXT4_WRITE=y CONFIG_MTDIDS_DEFAULT="nor0=ff705000.spi.0" -CONFIG_MTDPARTS_DEFAULT="mtdparts=ff705000.spi.0:1m(u-boot),256k(env1),256k(env2),14848k(boot),16m(rootfs),-@1536k(UBI)0" +CONFIG_MTDPARTS_DEFAULT="mtdparts=ff705000.spi.0:1m(u-boot),256k(env1),256k(env2),14848k(boot),16m(rootfs),-@1536k(UBI)" CONFIG_CMD_UBI=y # CONFIG_ISO_PARTITION is not set # CONFIG_EFI_PARTITION is not set diff --git a/configs/socfpga_is1_defconfig b/configs/socfpga_is1_defconfig index 6ea06c1104..081d5ef18b 100644 --- a/configs/socfpga_is1_defconfig +++ b/configs/socfpga_is1_defconfig @@ -27,7 +27,7 @@ CONFIG_CMD_CACHE=y CONFIG_CMD_TIME=y CONFIG_CMD_EXT4_WRITE=y CONFIG_MTDIDS_DEFAULT="nor0=ff705000.spi.0" -CONFIG_MTDPARTS_DEFAULT="mtdparts=ff705000.spi.0:1m(u-boot),256k(env1),256k(env2),14848k(boot),16m(rootfs),-@1536k(UBI)0" +CONFIG_MTDPARTS_DEFAULT="mtdparts=ff705000.spi.0:1m(u-boot),256k(env1),256k(env2),14848k(boot),16m(rootfs),-@1536k(UBI)" CONFIG_CMD_UBI=y # CONFIG_ISO_PARTITION is not set # CONFIG_EFI_PARTITION is not set diff --git a/configs/socfpga_mcvevk_defconfig b/configs/socfpga_mcvevk_defconfig index 161bd6fca3..0423a7d0ed 100644 --- a/configs/socfpga_mcvevk_defconfig +++ b/configs/socfpga_mcvevk_defconfig @@ -29,7 +29,7 @@ CONFIG_CMD_USB_MASS_STORAGE=y CONFIG_CMD_CACHE=y CONFIG_CMD_EXT4_WRITE=y CONFIG_MTDIDS_DEFAULT="nor0=ff705000.spi.0" -CONFIG_MTDPARTS_DEFAULT="mtdparts=ff705000.spi.0:1m(u-boot),256k(env1),256k(env2),14848k(boot),16m(rootfs),-@1536k(UBI)0" +CONFIG_MTDPARTS_DEFAULT="mtdparts=ff705000.spi.0:1m(u-boot),256k(env1),256k(env2),14848k(boot),16m(rootfs),-@1536k(UBI)" CONFIG_CMD_UBI=y # CONFIG_ISO_PARTITION is not set # CONFIG_EFI_PARTITION is not set diff --git a/configs/socfpga_sockit_defconfig b/configs/socfpga_sockit_defconfig index 8ec1c05571..8734c0be91 100644 --- a/configs/socfpga_sockit_defconfig +++ b/configs/socfpga_sockit_defconfig @@ -28,7 +28,7 @@ CONFIG_CMD_USB_MASS_STORAGE=y CONFIG_CMD_CACHE=y CONFIG_CMD_EXT4_WRITE=y CONFIG_MTDIDS_DEFAULT="nor0=ff705000.spi.0" -CONFIG_MTDPARTS_DEFAULT="mtdparts=ff705000.spi.0:1m(u-boot),256k(env1),256k(env2),14848k(boot),16m(rootfs),-@1536k(UBI)0" +CONFIG_MTDPARTS_DEFAULT="mtdparts=ff705000.spi.0:1m(u-boot),256k(env1),256k(env2),14848k(boot),16m(rootfs),-@1536k(UBI)" CONFIG_CMD_UBI=y # CONFIG_ISO_PARTITION is not set # CONFIG_EFI_PARTITION is not set diff --git a/configs/socfpga_socrates_defconfig b/configs/socfpga_socrates_defconfig index 15f81d1a4b..d46dcf510c 100644 --- a/configs/socfpga_socrates_defconfig +++
[U-Boot] [PATCH 2/2] watchdog: designware: Convert to DM and DT probing
Convert the designware watchdog timer driver to DM and add DT probing support. Perform minor coding style clean up, like drop superfluous braces. These ought to be no functional change. Signed-off-by: Marek Vasut Cc: Chin Liang See Cc: Dalon Westergreen Cc: Dinh Nguyen Cc: Ley Foon Tan Cc: Simon Goldschmidt Cc: Tien Fong Chee --- configs/socfpga_stratix10_defconfig | 1 + configs/socfpga_vining_fpga_defconfig | 1 + drivers/watchdog/Kconfig | 14 ++-- drivers/watchdog/designware_wdt.c | 97 +++ 4 files changed, 77 insertions(+), 36 deletions(-) diff --git a/configs/socfpga_stratix10_defconfig b/configs/socfpga_stratix10_defconfig index 462082b67b..cc5f49a536 100644 --- a/configs/socfpga_stratix10_defconfig +++ b/configs/socfpga_stratix10_defconfig @@ -56,4 +56,5 @@ CONFIG_USB=y CONFIG_DM_USB=y CONFIG_USB_DWC2=y CONFIG_USB_STORAGE=y +CONFIG_WDT=y CONFIG_DESIGNWARE_WATCHDOG=y diff --git a/configs/socfpga_vining_fpga_defconfig b/configs/socfpga_vining_fpga_defconfig index 03c43fa8b9..def7a3eca7 100644 --- a/configs/socfpga_vining_fpga_defconfig +++ b/configs/socfpga_vining_fpga_defconfig @@ -91,4 +91,5 @@ CONFIG_USB_GADGET_VENDOR_NUM=0x0525 CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 CONFIG_USB_GADGET_DWC2_OTG=y CONFIG_USB_GADGET_DOWNLOAD=y +CONFIG_WDT=y CONFIG_DESIGNWARE_WATCHDOG=y diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index 6fd9b0a177..ec34993664 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig @@ -36,13 +36,6 @@ config ULP_WATCHDOG help Say Y here to enable i.MX7ULP watchdog driver. -config DESIGNWARE_WATCHDOG - bool "Designware watchdog timer support" - select HW_WATCHDOG - help - Enable this to support Designware Watchdog Timer IP, present e.g. - on Altera SoCFPGA SoCs. - config WDT bool "Enable driver model for watchdog timer drivers" depends on DM @@ -54,6 +47,13 @@ config WDT What exactly happens when the timer expires is up to a particular device/driver. +config DESIGNWARE_WATCHDOG + bool "Designware watchdog timer support" + depends on WDT + help + Enable this to support Designware Watchdog Timer IP, present e.g. + on Altera SoCFPGA SoCs. + config WDT_ARMADA_37XX bool "Marvell Armada 37xx watchdog timer support" depends on WDT && ARMADA_3700 diff --git a/drivers/watchdog/designware_wdt.c b/drivers/watchdog/designware_wdt.c index c668567c66..f2b9175345 100644 --- a/drivers/watchdog/designware_wdt.c +++ b/drivers/watchdog/designware_wdt.c @@ -4,7 +4,8 @@ */ #include -#include +#include +#include #include #include @@ -17,57 +18,95 @@ #define DW_WDT_CR_RMOD_VAL 0x00 #define DW_WDT_CRR_RESTART_VAL 0x76 +struct designware_wdt_priv { + void __iomem*base; +}; + /* * Set the watchdog time interval. * Counter is 32 bit. */ -static int designware_wdt_settimeout(unsigned int timeout) +static int designware_wdt_settimeout(struct udevice *dev, unsigned int timeout) { + struct designware_wdt_priv *priv = dev_get_priv(dev); signed int i; /* calculate the timeout range value */ i = (log_2_n_round_up(timeout * CONFIG_DW_WDT_CLOCK_KHZ)) - 16; - if (i > 15) - i = 15; - if (i < 0) - i = 0; + i = clamp(i, 0, 15); + + writel(i | (i << 4), priv->base + DW_WDT_TORR); - writel((i | (i << 4)), (CONFIG_DW_WDT_BASE + DW_WDT_TORR)); return 0; } -static void designware_wdt_enable(void) +static unsigned int designware_wdt_is_enabled(struct udevice *dev) { - writel(((DW_WDT_CR_RMOD_VAL << DW_WDT_CR_RMOD_OFFSET) | - (0x1 << DW_WDT_CR_EN_OFFSET)), - (CONFIG_DW_WDT_BASE + DW_WDT_CR)); -} + struct designware_wdt_priv *priv = dev_get_priv(dev); -static unsigned int designware_wdt_is_enabled(void) -{ - unsigned long val; - val = readl((CONFIG_DW_WDT_BASE + DW_WDT_CR)); - return val & 0x1; + return readl(priv->base + DW_WDT_CR) & BIT(0); } -#if defined(CONFIG_HW_WATCHDOG) -void hw_watchdog_reset(void) +static int designware_wdt_reset(struct udevice *dev) { - if (designware_wdt_is_enabled()) + struct designware_wdt_priv *priv = dev_get_priv(dev); + + if (designware_wdt_is_enabled(dev)) /* restart the watchdog counter */ - writel(DW_WDT_CRR_RESTART_VAL, - (CONFIG_DW_WDT_BASE + DW_WDT_CRR)); + writel(DW_WDT_CRR_RESTART_VAL, priv->base + DW_WDT_CRR); + + return 0; } -void hw_watchdog_init(void) +static int designware_wdt_stop(struct udevice *dev) { /* reset to disable the watchdog */ - hw_watchdog_reset(); + designware_wdt_reset(dev); + return 0; +} + +static int designware_wdt_start(struct udevice *dev, u64 timeout, ulong flags) +{ + struct designware_wdt_priv
[U-Boot] [PATCH 1/2] watchdog: designware: Migrate CONFIG_DESIGNWARE_WATCHDOG to Kconfig
Migrate CONFIG_DESIGNWARE_WATCHDOG to Kconfig and update the headers accordingly, no functional change. The S10 enables the WDT only in SPL, but does not enable it in U-Boot itself, hence disable it in the config again. Signed-off-by: Marek Vasut Cc: Chin Liang See Cc: Dalon Westergreen Cc: Dinh Nguyen Cc: Ley Foon Tan Cc: Simon Goldschmidt Cc: Tien Fong Chee --- configs/socfpga_stratix10_defconfig | 1 + configs/socfpga_vining_fpga_defconfig | 1 + drivers/watchdog/Kconfig | 7 +++ include/configs/socfpga_common.h | 3 --- include/configs/socfpga_stratix10_socdk.h | 8 scripts/config_whitelist.txt | 1 - 6 files changed, 13 insertions(+), 8 deletions(-) diff --git a/configs/socfpga_stratix10_defconfig b/configs/socfpga_stratix10_defconfig index ad83f50032..462082b67b 100644 --- a/configs/socfpga_stratix10_defconfig +++ b/configs/socfpga_stratix10_defconfig @@ -56,3 +56,4 @@ CONFIG_USB=y CONFIG_DM_USB=y CONFIG_USB_DWC2=y CONFIG_USB_STORAGE=y +CONFIG_DESIGNWARE_WATCHDOG=y diff --git a/configs/socfpga_vining_fpga_defconfig b/configs/socfpga_vining_fpga_defconfig index 96f806ab5f..03c43fa8b9 100644 --- a/configs/socfpga_vining_fpga_defconfig +++ b/configs/socfpga_vining_fpga_defconfig @@ -91,3 +91,4 @@ CONFIG_USB_GADGET_VENDOR_NUM=0x0525 CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 CONFIG_USB_GADGET_DWC2_OTG=y CONFIG_USB_GADGET_DOWNLOAD=y +CONFIG_DESIGNWARE_WATCHDOG=y diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index a66a9bcbe2..6fd9b0a177 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig @@ -36,6 +36,13 @@ config ULP_WATCHDOG help Say Y here to enable i.MX7ULP watchdog driver. +config DESIGNWARE_WATCHDOG + bool "Designware watchdog timer support" + select HW_WATCHDOG + help + Enable this to support Designware Watchdog Timer IP, present e.g. + on Altera SoCFPGA SoCs. + config WDT bool "Enable driver model for watchdog timer drivers" depends on DM diff --git a/include/configs/socfpga_common.h b/include/configs/socfpga_common.h index b11fe021a7..32b9131be0 100644 --- a/include/configs/socfpga_common.h +++ b/include/configs/socfpga_common.h @@ -104,12 +104,9 @@ /* * L4 Watchdog */ -#ifdef CONFIG_HW_WATCHDOG -#define CONFIG_DESIGNWARE_WATCHDOG #define CONFIG_DW_WDT_BASE SOCFPGA_L4WD0_ADDRESS #define CONFIG_DW_WDT_CLOCK_KHZ25000 #define CONFIG_WATCHDOG_TIMEOUT_MSECS 3 -#endif /* * MMC Driver diff --git a/include/configs/socfpga_stratix10_socdk.h b/include/configs/socfpga_stratix10_socdk.h index 7b55dd14da..17f6e14790 100644 --- a/include/configs/socfpga_stratix10_socdk.h +++ b/include/configs/socfpga_stratix10_socdk.h @@ -160,16 +160,16 @@ unsigned int cm_get_qspi_controller_clk_hz(void); /* * L4 Watchdog */ -#ifdef CONFIG_SPL_BUILD -#define CONFIG_HW_WATCHDOG -#define CONFIG_DESIGNWARE_WATCHDOG +#ifndef CONFIG_SPL_BUILD +#undef CONFIG_HW_WATCHDOG +#undef CONFIG_DESIGNWARE_WATCHDOG +#endif #define CONFIG_DW_WDT_BASE SOCFPGA_L4WD0_ADDRESS #ifndef __ASSEMBLY__ unsigned int cm_get_l4_sys_free_clk_hz(void); #define CONFIG_DW_WDT_CLOCK_KHZ(cm_get_l4_sys_free_clk_hz() / 1000) #endif #define CONFIG_WATCHDOG_TIMEOUT_MSECS 3000 -#endif /* * SPL memory layout diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt index b18eab1707..839eda8c0f 100644 --- a/scripts/config_whitelist.txt +++ b/scripts/config_whitelist.txt @@ -320,7 +320,6 @@ CONFIG_DEFAULT_IMMR CONFIG_DEF_HWCONFIG CONFIG_DELAY_ENVIRONMENT CONFIG_DESIGNWARE_ETH -CONFIG_DESIGNWARE_WATCHDOG CONFIG_DEVELOP CONFIG_DEVICE_TREE_LIST CONFIG_DFU_ALT -- 2.23.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] efi: device path for nvme
This adds a device path node for NVMe block devices. For that nvme_get_namespace_id() is added to return the privately stored namespace identifier. Signed-off-by: Patrick Wildt diff --git a/drivers/nvme/nvme.c b/drivers/nvme/nvme.c index 561f757772..0a72fe2b75 100644 --- a/drivers/nvme/nvme.c +++ b/drivers/nvme/nvme.c @@ -627,6 +627,13 @@ static int nvme_get_info_from_identify(struct nvme_dev *dev) return 0; } +u32 +nvme_get_namespace_id(struct udevice *udev) +{ + struct nvme_ns *ns = dev_get_priv(udev); + return ns->ns_id; +} + int nvme_scan_namespace(void) { struct uclass *uc; diff --git a/include/efi_api.h b/include/efi_api.h index 37e56da460..b4ab1a 100644 --- a/include/efi_api.h +++ b/include/efi_api.h @@ -422,6 +422,7 @@ struct efi_device_path_acpi_path { # define DEVICE_PATH_SUB_TYPE_MSG_USB 0x05 # define DEVICE_PATH_SUB_TYPE_MSG_MAC_ADDR0x0b # define DEVICE_PATH_SUB_TYPE_MSG_USB_CLASS 0x0f +# define DEVICE_PATH_SUB_TYPE_MSG_NVME0x17 # define DEVICE_PATH_SUB_TYPE_MSG_SD 0x1a # define DEVICE_PATH_SUB_TYPE_MSG_MMC 0x1d @@ -459,6 +460,12 @@ struct efi_device_path_usb_class { u8 device_protocol; } __packed; +struct efi_device_path_nvme { + struct efi_device_path dp; + u32 nsid; + u64 eui64; +} __packed; + struct efi_device_path_sd_mmc_path { struct efi_device_path dp; u8 slot_number; diff --git a/include/nvme.h b/include/nvme.h index 2c3d14d241..95193c0334 100644 --- a/include/nvme.h +++ b/include/nvme.h @@ -78,4 +78,14 @@ int nvme_scan_namespace(void); */ int nvme_print_info(struct udevice *udev); +/** + * nvme_get_namespace_id - return namespace identifier + * + * This returns the namespace identifier. + * + * @udev: NVMe controller device + * @return:namespace identifier + */ +u32 nvme_get_namespace_id(struct udevice *udev); + #endif /* __NVME_H__ */ diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c index 86297bb7c1..89ad80c7bd 100644 --- a/lib/efi_loader/efi_device_path.c +++ b/lib/efi_loader/efi_device_path.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -451,6 +452,11 @@ static unsigned dp_size(struct udevice *dev) return dp_size(dev->parent) + sizeof(struct efi_device_path_sd_mmc_path); #endif +#if defined(CONFIG_NVME) + case UCLASS_NVME: + return dp_size(dev->parent) + + sizeof(struct efi_device_path_nvme); +#endif #ifdef CONFIG_SANDBOX case UCLASS_ROOT: /* @@ -583,6 +589,19 @@ static void *dp_fill(void *buf, struct udevice *dev) sddp->slot_number = dev->seq; return [1]; } +#endif +#if defined(CONFIG_NVME) + case UCLASS_NVME: { + struct efi_device_path_nvme *dp = + dp_fill(buf, dev->parent); + + dp->dp.type = DEVICE_PATH_TYPE_MESSAGING_DEVICE; + dp->dp.sub_type = DEVICE_PATH_SUB_TYPE_MSG_NVME; + dp->dp.length = sizeof(*dp); + dp->nsid= nvme_get_namespace_id(dev); + dp->eui64 = 0; + return [1]; + } #endif default: debug("%s(%u) %s: unhandled parent class: %s (%u)\n", ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] NVMe: do PCI enumerate before nvme scan
Make sure that the PCI busses are enumerated before trying to find a NVMe device. Signed-off-by: Patrick Wildt diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h index 3570a32dff..563f1bf5fa 100644 --- a/include/config_distro_bootcmd.h +++ b/include/config_distro_bootcmd.h @@ -185,6 +185,7 @@ "nvme_init=" \ "if ${nvme_need_init}; then " \ "setenv nvme_need_init false; " \ + BOOTENV_RUN_PCI_ENUM \ "nvme scan; " \ "fi\0" \ \ ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 1/2] net: macb: explicitly pass phy_adr to mdio read and write
To support accessing arbitrary addresses the mii/mdio bus it is neccesary that the macb_mdio_read and macb_mdio_write functions do not implicitly use the address of the connected phy. The function signature is extended according to the Linux kernel equivalent. Signed-off-by: Josef Holzmayr --- drivers/net/macb.c | 33 + 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/drivers/net/macb.c b/drivers/net/macb.c index 377188e361..5da490efb7 100644 --- a/drivers/net/macb.c +++ b/drivers/net/macb.c @@ -164,7 +164,8 @@ static int gem_is_gigabit_capable(struct macb_device *macb) return macb_is_gem(macb) && !cpu_is_sama5d2() && !cpu_is_sama5d4(); } -static void macb_mdio_write(struct macb_device *macb, u8 reg, u16 value) +static void macb_mdio_write(struct macb_device *macb, u8 phy_adr, u8 reg, + u16 value) { unsigned long netctl; unsigned long netstat; @@ -176,7 +177,7 @@ static void macb_mdio_write(struct macb_device *macb, u8 reg, u16 value) frame = (MACB_BF(SOF, 1) | MACB_BF(RW, 1) -| MACB_BF(PHYA, macb->phy_addr) +| MACB_BF(PHYA, phy_adr) | MACB_BF(REGA, reg) | MACB_BF(CODE, 2) | MACB_BF(DATA, value)); @@ -191,7 +192,7 @@ static void macb_mdio_write(struct macb_device *macb, u8 reg, u16 value) macb_writel(macb, NCR, netctl); } -static u16 macb_mdio_read(struct macb_device *macb, u8 reg) +static u16 macb_mdio_read(struct macb_device *macb, u8 phy_adr, u8 reg) { unsigned long netctl; unsigned long netstat; @@ -203,7 +204,7 @@ static u16 macb_mdio_read(struct macb_device *macb, u8 reg) frame = (MACB_BF(SOF, 1) | MACB_BF(RW, 2) -| MACB_BF(PHYA, macb->phy_addr) +| MACB_BF(PHYA, phy_adr) | MACB_BF(REGA, reg) | MACB_BF(CODE, 2)); macb_writel(macb, MAN, frame); @@ -243,7 +244,7 @@ int macb_miiphy_read(struct mii_dev *bus, int phy_adr, int devad, int reg) return -1; arch_get_mdio_control(bus->name); - value = macb_mdio_read(macb, reg); + value = macb_mdio_read(macb, macb->phy_addr, reg); return value; } @@ -263,7 +264,7 @@ int macb_miiphy_write(struct mii_dev *bus, int phy_adr, int devad, int reg, return -1; arch_get_mdio_control(bus->name); - macb_mdio_write(macb, reg, value); + macb_mdio_write(macb, macb->phy_addr, reg, value); return 0; } @@ -450,13 +451,13 @@ static void macb_phy_reset(struct macb_device *macb, const char *name) u16 status, adv; adv = ADVERTISE_CSMA | ADVERTISE_ALL; - macb_mdio_write(macb, MII_ADVERTISE, adv); + macb_mdio_write(macb, macb->phy_addr, MII_ADVERTISE, adv); printf("%s: Starting autonegotiation...\n", name); - macb_mdio_write(macb, MII_BMCR, (BMCR_ANENABLE + macb_mdio_write(macb, macb->phy_addr, MII_BMCR, (BMCR_ANENABLE | BMCR_ANRESTART)); for (i = 0; i < MACB_AUTONEG_TIMEOUT / 100; i++) { - status = macb_mdio_read(macb, MII_BMSR); + status = macb_mdio_read(macb, macb->phy_addr, MII_BMSR); if (status & BMSR_ANEGCOMPLETE) break; udelay(100); @@ -477,7 +478,7 @@ static int macb_phy_find(struct macb_device *macb, const char *name) /* Search for PHY... */ for (i = 0; i < 32; i++) { macb->phy_addr = i; - phy_id = macb_mdio_read(macb, MII_PHYSID1); + phy_id = macb_mdio_read(macb, macb->phy_addr, MII_PHYSID1); if (phy_id != 0x) { printf("%s: PHY present at %d\n", name, i); return 0; @@ -595,7 +596,7 @@ static int macb_phy_init(struct macb_device *macb, const char *name) return ret; /* Check if the PHY is up to snuff... */ - phy_id = macb_mdio_read(macb, MII_PHYSID1); + phy_id = macb_mdio_read(macb, macb->phy_addr, MII_PHYSID1); if (phy_id == 0x) { printf("%s: No PHY present\n", name); return -ENODEV; @@ -618,13 +619,13 @@ static int macb_phy_init(struct macb_device *macb, const char *name) phy_config(macb->phydev); #endif - status = macb_mdio_read(macb, MII_BMSR); + status = macb_mdio_read(macb, macb->phy_addr, MII_BMSR); if (!(status & BMSR_LSTATUS)) { /* Try to re-negotiate if we don't have link already. */ macb_phy_reset(macb, name); for (i = 0; i < MACB_AUTONEG_TIMEOUT / 100; i++) { - status = macb_mdio_read(macb, MII_BMSR); + status = macb_mdio_read(macb, macb->phy_addr, MII_BMSR); if (status & BMSR_LSTATUS) {
[U-Boot] [PATCH 0/2] net: macb: support arbitrary mdio addresses
This patch mini-series enables the macb driver to access all addresses on the mdio bus instead of only the one of the connected phy. This is especially useful if you have a tagging switch connected to the macb. Josef Holzmayr (2): net: macb: explicitly pass phy_adr to mdio read and write net: macb: let miiphy_read/_write pass arbitrary addresses drivers/net/macb.c | 39 +-- 1 file changed, 17 insertions(+), 22 deletions(-) -- 2.23.0 -- _ R-S-I Elektrotechnik GmbH & Co. KG Woelkestrasse 11 D-85301 Schweitenkirchen Fon: +49 8444 9204-0 Fax: +49 8444 9204-50 www.rsi-elektrotechnik.de _ Amtsgericht Ingolstadt - GmbH: HRB 191328 - KG: HRA 170363 Geschäftsführer: Dr.-Ing. Michael Sorg, Dipl.-Ing. Franz Sorg USt-IdNr.: DE 128592548 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 2/2] net: macb: let miiphy_read/_write pass arbitrary addresses
This allows passing arbitrary addresses through macb_miiphy_read and macb_miiphy_write, therefore enabling the mii command to access all mdio bus devices instead of only the defined phy. Signed-off-by: Josef Holzmayr --- drivers/net/macb.c | 10 ++ 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/net/macb.c b/drivers/net/macb.c index 5da490efb7..e801d4c4ec 100644 --- a/drivers/net/macb.c +++ b/drivers/net/macb.c @@ -240,11 +240,8 @@ int macb_miiphy_read(struct mii_dev *bus, int phy_adr, int devad, int reg) struct macb_device *macb = to_macb(dev); #endif - if (macb->phy_addr != phy_adr) - return -1; - arch_get_mdio_control(bus->name); - value = macb_mdio_read(macb, macb->phy_addr, reg); + value = macb_mdio_read(macb, phy_adr, reg); return value; } @@ -260,11 +257,8 @@ int macb_miiphy_write(struct mii_dev *bus, int phy_adr, int devad, int reg, struct macb_device *macb = to_macb(dev); #endif - if (macb->phy_addr != phy_adr) - return -1; - arch_get_mdio_control(bus->name); - macb_mdio_write(macb, macb->phy_addr, reg, value); + macb_mdio_write(macb, phy_adr, reg, value); return 0; } -- 2.23.0 -- _ R-S-I Elektrotechnik GmbH & Co. KG Woelkestrasse 11 D-85301 Schweitenkirchen Fon: +49 8444 9204-0 Fax: +49 8444 9204-50 www.rsi-elektrotechnik.de _ Amtsgericht Ingolstadt - GmbH: HRB 191328 - KG: HRA 170363 Geschäftsführer: Dr.-Ing. Michael Sorg, Dipl.-Ing. Franz Sorg USt-IdNr.: DE 128592548 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 2/2] tiny-printf: Support vsnprintf()
Add a simple implementation of this function, to allow logging to be enabled in the SPL or TPL for systems that rely on the tiny printf() implementation. To keep the code size small, - The function is built only when logging is enabled, as it (currently) is not needed otherwise; and - Like the existing implementation of snprintf(), its buffer-size parameter is ignored. Signed-off-by: Simon South --- lib/tiny-printf.c | 16 1 file changed, 16 insertions(+) diff --git a/lib/tiny-printf.c b/lib/tiny-printf.c index ebef92fc9f..62e6381961 100644 --- a/lib/tiny-printf.c +++ b/lib/tiny-printf.c @@ -366,6 +366,22 @@ int sprintf(char *buf, const char *fmt, ...) return ret; } +#if CONFIG_IS_ENABLED(LOG) +/* Note that size is ignored */ +int vsnprintf(char *buf, size_t size, const char *fmt, va_list va) +{ + struct printf_info info; + int ret; + + info.outstr = buf; + info.putc = putc_outstr; + ret = _vprintf(, fmt, va); + *info.outstr = '\0'; + + return ret; +} +#endif + /* Note that size is ignored */ int snprintf(char *buf, size_t size, const char *fmt, ...) { -- 2.23.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 1/2] common: Kconfig: Fix typo in TPL_LOG_CONSOLE description
Signed-off-by: Simon South --- common/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/Kconfig b/common/Kconfig index 28d5e9a0cc..d9ecf79e0a 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -764,7 +764,7 @@ config SPL_LOG_CONSOLE line number are omitted. config TPL_LOG_CONSOLE - bool "Allow log output to the console in SPL" + bool "Allow log output to the console in TPL" depends on TPL_LOG default y help -- 2.23.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 0/2] Small fixes to SPL/TPL logging
These two patches fix small issues I encountered when enabling debugging output for U-Boot's TPL. The first fixes a typo in the description of the TPL_LOG_CONSOLE configuration option. The second adds a simple implementation of vsnprintf() to the tiny-printf library. Without this, enabling either SPL or TPL logging for systems (such as the PINE64 ROCK64) that also use the tiny printf() implementation causes the build to fail with error messages like aarch64-linux-gnu-ld.bfd: common/built-in.o: in function `_log': (...)/u-boot/common/log.c:212: undefined reference to `vsnprintf' make[1]: *** [scripts/Makefile.spl:404: spl/u-boot-spl] Error 1 make: *** [Makefile:1762: spl/u-boot-spl] Error 2 To minimize the impact on code size, the function is built only when logging is enabled, as it appears to be unneeded otherwise. Note we could probably shave off a few bytes by having the existing sprintf() and snprintf() functions call vsnprintf() when it's available. I haven't made this change only because it isn't how the existing code is written (printf() could call vprintf(), and snprintf() could call sprintf(), yet neither do) and I assume this is for a reason. Simon South (2): common: Kconfig: Fix typo in TPL_LOG_CONSOLE description tiny-printf: Support vsnprintf() common/Kconfig| 2 +- lib/tiny-printf.c | 16 2 files changed, 17 insertions(+), 1 deletion(-) -- 2.23.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 31/38] x86: spl: Move broadwell-specific code out of generic x86 spl
On Wed, Sep 25, 2019 at 10:13 PM Simon Glass wrote: > > When TPL is running, broadwell needs to do different init from SPL. There > is no need for this code to be in the generic x86 SPL file, so move it to > arch_cpu_init(). > > Signed-off-by: Simon Glass > --- > > Changes in v2: None > > arch/x86/cpu/broadwell/cpu.c | 5 + > arch/x86/cpu/broadwell/cpu_full.c | 7 +++ > arch/x86/lib/spl.c| 5 - > 3 files changed, 12 insertions(+), 5 deletions(-) > Reviewed-by: Bin Meng ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 35/38] x86: Add more comments to the start-up code
On Wed, Sep 25, 2019 at 10:13 PM Simon Glass wrote: > > The full start-up sequence (TPL->SPL->U-Boot) can be a bit confusing since > each phase has its own 'start' file. Add comments to explain this. > > Signed-off-by: Simon Glass > --- > > Changes in v2: None > > arch/x86/cpu/start.S | 12 > arch/x86/cpu/start_from_spl.S | 5 +++-- > arch/x86/cpu/start_from_tpl.S | 3 ++- > 3 files changed, 17 insertions(+), 3 deletions(-) > Reviewed-by: Bin Meng ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 20/38] x86: fsp: Move common dram functions into a common file
On Wed, Sep 25, 2019 at 10:13 PM Simon Glass wrote: > > Most of the DRAM functionality can be shared between FSP1 and FSP2. Move > it into a shared file. > > Signed-off-by: Simon Glass > --- > > Changes in v2: None > > arch/x86/include/asm/fsp/fsp_support.h | 9 +++ > arch/x86/lib/Makefile | 1 + > arch/x86/lib/fsp/Makefile | 5 ++ > arch/x86/lib/fsp/fsp_dram.c| 90 ++ > arch/x86/lib/fsp1/fsp_dram.c | 80 ++- > 5 files changed, 111 insertions(+), 74 deletions(-) > create mode 100644 arch/x86/lib/fsp/Makefile > create mode 100644 arch/x86/lib/fsp/fsp_dram.c > Reviewed-by: Bin Meng ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 36/38] x86: Add support for booting from Fast SPI
On Wed, Sep 25, 2019 at 10:13 PM Simon Glass wrote: > > Most x86 CPUs use a mechanism where the SPI flash is mapped into the very > top of 32-bit address space, so that it can be executed in place and read > simply by copying from memory. For an 8MB ROM the mapping starts at > 0xff80. > > However some recent Intel CPUs do not use a simple 1:1 memory map. Instead > the map starts at a different address and not all of the SPI flash is > accessible through the map. This 'Fast SPI' feature requires that U-Boot > check the location of the map. It is also possible (optionally) to read > from the SPI flash using a driver. > > Add support for booting from Fast SPI. The memory-mapped version is used > by both TPL and SPL on apollolake. > > Signed-off-by: Simon Glass > --- > > Changes in v2: > - Rename the fast SPI headers > > arch/x86/cpu/intel_common/Makefile | 1 + > arch/x86/cpu/intel_common/fast_spi.c | 48 > arch/x86/include/asm/spl.h | 1 + > 3 files changed, 50 insertions(+) > create mode 100644 arch/x86/cpu/intel_common/fast_spi.c > > diff --git a/arch/x86/cpu/intel_common/Makefile > b/arch/x86/cpu/intel_common/Makefile > index 07f27c29ec7..2de567dd9fe 100644 > --- a/arch/x86/cpu/intel_common/Makefile > +++ b/arch/x86/cpu/intel_common/Makefile > @@ -9,6 +9,7 @@ obj-$(CONFIG_$(SPL_TPL_)X86_32BIT_INIT) += report_platform.o > obj-$(CONFIG_$(SPL_TPL_)X86_32BIT_INIT) += mrc.o > endif > obj-y += cpu.o > +obj-$(CONFIG_SPI_FLASH_INTEL_FAST) += fast_spi.o > obj-y += lpc.o > ifndef CONFIG_TARGET_EFI_APP > obj-$(CONFIG_$(SPL_TPL_)X86_32BIT_INIT) += microcode.o > diff --git a/arch/x86/cpu/intel_common/fast_spi.c > b/arch/x86/cpu/intel_common/fast_spi.c > new file mode 100644 > index 000..a7334ecf1a3 > --- /dev/null > +++ b/arch/x86/cpu/intel_common/fast_spi.c > @@ -0,0 +1,48 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * Copyright 2019 Google LLC > + */ > + > +#include > +#include > +#include > +#include > +#include > + > +/* > + * Returns bios_start and fills in size of the BIOS region. > + */ > +ulong fast_spi_get_bios_region(struct fast_spi_regs *regs, size_t *bios_size) I suspect we need a public header file for these 2 APIs? > +{ > + ulong bios_start, bios_end; > + > + /* > +* BIOS_BFPREG provides info about BIOS-Flash Primary Region Base and > +* Limit. Base and Limit fields are in units of 4K. > +*/ > + u32 val = readl(>bfp); > + > + bios_start = (val & SPIBAR_BFPREG_PRB_MASK) << 12; > + bios_end = (((val & SPIBAR_BFPREG_PRL_MASK) >> > +SPIBAR_BFPREG_PRL_SHIFT) + 1) << 12; > + *bios_size = bios_end - bios_start; > + > + return bios_start; > +} > + > +int fast_spi_get_bios_mmap(ulong *map_basep, size_t *map_sizep, uint > *offsetp) > +{ > + struct fast_spi_regs *regs; > + ulong bar, base, mmio_base; > + > + /* Special case to find mapping without probing the device */ > + pci_x86_read_config(NULL, PCH_DEV_SPI, PCI_BASE_ADDRESS_0, , > + PCI_SIZE_32); > + mmio_base = bar & PCI_BASE_ADDRESS_MEM_MASK; > + regs = (struct fast_spi_regs *)mmio_base; > + base = fast_spi_get_bios_region(regs, map_sizep); > + *map_basep = (u32)-*map_sizep - base; > + *offsetp = base; > + > + return 0; > +} > diff --git a/arch/x86/include/asm/spl.h b/arch/x86/include/asm/spl.h > index 1bef4877eb3..cc6cac08f23 100644 > --- a/arch/x86/include/asm/spl.h > +++ b/arch/x86/include/asm/spl.h > @@ -11,6 +11,7 @@ > > enum { > BOOT_DEVICE_SPI_MMAP= 10, > + BOOT_DEVICE_FAST_SPI, > BOOT_DEVICE_CROS_VBOOT, > }; > > -- Regards, Bin ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 32/38] x86: fsp: Save usable RAM and hob_list in the handoff area
Hi Simon, On Wed, Sep 25, 2019 at 10:13 PM Simon Glass wrote: > > The useable RAM is calculated when the RAM is inited. Save this value so > that it can be easily used in U-Boot proper. > > Also save a pointer to the hob list so that it is accessible (before > relocation only) in U-Boot proper. This avoids having to scan it in SPL, > for everything U-Boot proper might need later. > > Signed-off-by: Simon Glass > --- > > Changes in v2: None > > arch/x86/cpu/intel_common/cpu_from_spl.c | 6 ++ > arch/x86/include/asm/handoff.h | 8 > arch/x86/lib/fsp/fsp_dram.c | 10 ++ > 3 files changed, 24 insertions(+) > > diff --git a/arch/x86/cpu/intel_common/cpu_from_spl.c > b/arch/x86/cpu/intel_common/cpu_from_spl.c > index a6233c75ce2..b7bb524162f 100644 > --- a/arch/x86/cpu/intel_common/cpu_from_spl.c > +++ b/arch/x86/cpu/intel_common/cpu_from_spl.c > @@ -6,6 +6,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -21,6 +22,11 @@ int arch_cpu_init(void) > { > int ret; > > +#if CONFIG_IS_ENABLED(HANDOFF) && IS_ENABLED(CONFIG_USE_HOB) > + struct spl_handoff *ho = gd->spl_handoff; > + > + gd->arch.hob_list = ho->arch.hob_list; We should guard the access to gd->arch.hob_list with #ifdef CONFIG_USE_HOB. > +#endif > ret = x86_cpu_reinit_f(); > > return ret; > diff --git a/arch/x86/include/asm/handoff.h b/arch/x86/include/asm/handoff.h > index 4d18d59efed..aec49b9b815 100644 > --- a/arch/x86/include/asm/handoff.h > +++ b/arch/x86/include/asm/handoff.h > @@ -9,7 +9,15 @@ > #ifndef __x86_asm_handoff_h > #define __x86_asm_handoff_h > > +/** > + * struct arch_spl_handoff - architecture-specific handoff info > + * > + * @usable_ram_top: Value returned by board_get_usable_ram_top() in SPL > + * @hob_list: Start of FSP hand-off blocks (HOBs) > + */ > struct arch_spl_handoff { > + ulong usable_ram_top; > + void *hob_list; ditto > }; > > #endif > diff --git a/arch/x86/lib/fsp/fsp_dram.c b/arch/x86/lib/fsp/fsp_dram.c > index 8fe1e0bf73d..38cc25839ec 100644 > --- a/arch/x86/lib/fsp/fsp_dram.c > +++ b/arch/x86/lib/fsp/fsp_dram.c > @@ -88,3 +88,13 @@ unsigned int install_e820_map(unsigned int max_entries, > > return num_entries; > } > + > +#if CONFIG_IS_ENABLED(HANDOFF) > +int handoff_arch_save(struct spl_handoff *ho) > +{ > + ho->arch.usable_ram_top = > fsp_get_usable_lowmem_top(gd->arch.hob_list); > + ho->arch.hob_list = gd->arch.hob_list; ditto > + > + return 0; > +} > +#endif > -- Regards, Bin ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 37/38] x86: Add various MTRR indexes and values
On Wed, Sep 25, 2019 at 10:13 PM Simon Glass wrote: > > Add some new MTRRs used by Apollolake as well as a mask for the MTRR > type. > > Signed-off-by: Simon Glass > --- > > Changes in v2: None > > arch/x86/include/asm/msr-index.h | 22 ++ > arch/x86/include/asm/mtrr.h | 1 + > 2 files changed, 23 insertions(+) > Reviewed-by: Bin Meng ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 24/38] x86: fsp: Add a few more definitions for FSP2
On Wed, Sep 25, 2019 at 10:13 PM Simon Glass wrote: > > Add definitions for the FSP signature and the FSP init phase. > > Signed-off-by: Simon Glass > --- > > Changes in v2: None > > arch/x86/include/asm/fsp/fsp_infoheader.h | 15 ++- > 1 file changed, 14 insertions(+), 1 deletion(-) > Reviewed-by: Bin Meng ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 34/38] x86: Change condition for using CAR
On Wed, Sep 25, 2019 at 10:13 PM Simon Glass wrote: > > At present we assume that CAR (Cache-as-RAM) is used if HOBs (Hand-off > bLocks) are not, since HOBs typically indicate that an FSP is in use, and nits: blocks > FSPs handle the CAR init. > > However this is a bit indirect, and for FSP2 machines which use their own > CAR implementation (such as apollolake) but use the FSP for other > functions, the logic is wrong. > > To fix this, add a dedicated Kconfig option to indicate when CAR is used. > > Signed-off-by: Simon Glass > --- > > Changes in v2: None > > arch/x86/Kconfig | 8 > arch/x86/cpu/start.S | 4 ++-- > configs/slimbootloader_defconfig | 1 + > 3 files changed, 11 insertions(+), 2 deletions(-) > Reviewed-by: Bin Meng ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 27/38] x86: Add binman symbols to the image
On Wed, Sep 25, 2019 at 10:13 PM Simon Glass wrote: > > It is useful in SPL and TPL to access symbols from binman, such as the > position and size of an entry in the ROM. Collect these symbols together > in the SPL binaries. > > Signed-off-by: Simon Glass > --- > > Changes in v2: None > > arch/x86/cpu/u-boot-spl.lds | 6 ++ > 1 file changed, 6 insertions(+) > Reviewed-by: Bin Meng ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 28/38] x86: pci: Add a function to clear and set PCI config regs
On Wed, Sep 25, 2019 at 10:13 PM Simon Glass wrote: > > At present the x86 pre-DM equivalent of pci_bus_clrset_config32() does not > exist. Add it to simplify PCI init code on x86. > > Also add the missing functions to this header. > > Signed-off-by: Simon Glass > --- > > Changes in v2: None > > arch/x86/cpu/pci.c | 19 ++ > arch/x86/include/asm/pci.h | 40 ++ > 2 files changed, 59 insertions(+) > Reviewed-by: Bin Meng ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 38/38] x86: Rename turbo ratio MSR to MSR_TURBO_RATIO_LIMIT
On Wed, Sep 25, 2019 at 10:13 PM Simon Glass wrote: > > This MSR number is used on most modern Intel processors, so drop the > confusing NHM prefix (which might mean Nehalem). > > Signed-off-by: Simon Glass > --- > > Changes in v2: > - Rebase to master > > arch/x86/cpu/broadwell/cpu_full.c | 2 +- > arch/x86/include/asm/msr-index.h | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/arch/x86/cpu/broadwell/cpu_full.c > b/arch/x86/cpu/broadwell/cpu_full.c > index bd0b2037fa1..9686cf5e0e7 100644 > --- a/arch/x86/cpu/broadwell/cpu_full.c > +++ b/arch/x86/cpu/broadwell/cpu_full.c > @@ -346,7 +346,7 @@ static void set_max_ratio(void) > > /* Check for configurable TDP option */ > if (turbo_get_state() == TURBO_ENABLED) { > - msr = msr_read(MSR_NHM_TURBO_RATIO_LIMIT); > + msr = msr_read(MSR_TURBO_RATIO_LIMIT); > perf_ctl.lo = (msr.lo & 0xff) << 8; > } else if (cpu_config_tdp_levels()) { > /* Set to nominal TDP ratio */ > diff --git a/arch/x86/include/asm/msr-index.h > b/arch/x86/include/asm/msr-index.h > index 1a02d8c8fe5..7cb78beafa1 100644 > --- a/arch/x86/include/asm/msr-index.h > +++ b/arch/x86/include/asm/msr-index.h > @@ -101,7 +101,7 @@ > #define MSR_OFFCORE_RSP_1 0x01a7 > #define MSR_MISC_PWR_MGMT 0x1aa > #define MISC_PWR_MGMT_EIST_HW_DIS (1 << 0) > -#define MSR_NHM_TURBO_RATIO_LIMIT 0x01ad > +#define MSR_TURBO_RATIO_LIMIT 0x01ad > #define MSR_IVT_TURBO_RATIO_LIMIT 0x01ae How about dropping this one too? It's not used in U-Boot. > > #define MSR_IA32_ENERGY_PERFORMANCE_BIAS 0x1b0 > -- Reviewed-by: Bin Meng ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 21/38] x86: Move common fsp functions into a common file
On Wed, Sep 25, 2019 at 10:12 PM Simon Glass wrote: > > Some of this file can be shared between FSP1 and FSP2. Move it into a > shared file. > > Signed-off-by: Simon Glass > --- > > Changes in v2: None > > arch/x86/include/asm/fsp/fsp_support.h | 17 > arch/x86/include/asm/fsp1/fsp_support.h | 10 --- > arch/x86/lib/fsp/Makefile | 1 + > arch/x86/lib/fsp/fsp_common.c | 104 > arch/x86/lib/fsp1/fsp_common.c | 87 > 5 files changed, 122 insertions(+), 97 deletions(-) > create mode 100644 arch/x86/lib/fsp/fsp_common.c > Reviewed-by: Bin Meng ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 30/38] x86: spl: Reduce priority of the basic SPL image loader
On Wed, Sep 25, 2019 at 10:13 PM Simon Glass wrote: > > This image loader works on systems where the flash is directly mapped to > the last part of the 32-bit address space. On recent Intel systems (such > as apollolake) this is not the case. > > Reduce the priority of this loader so that another one can override it. > > While we are here, rename the loader to BOOT_DEVICE_SPI_MMAP since > BOOT_DEVICE_BOARD is not very descriptive. > > Signed-off-by: Simon Glass > --- > > Changes in v2: None > > arch/x86/include/asm/spl.h | 3 +-- > arch/x86/lib/spl.c | 5 +++-- > arch/x86/lib/tpl.c | 4 ++-- > 3 files changed, 6 insertions(+), 6 deletions(-) > Reviewed-by: Bin Meng ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 25/38] x86: fsp: Add access to variable MRC data
On Wed, Sep 25, 2019 at 10:13 PM Simon Glass wrote: > > With FSP2 the non-volatile storage used by the FSP to init memory can be > split into a fixed piece (determined at compile time) and a variable piece > (determined at run time). Add support for reading the latter. > > Signed-off-by: Simon Glass > --- > > Changes in v2: None > > arch/x86/include/asm/fsp/fsp_hob.h | 4 > arch/x86/include/asm/fsp/fsp_support.h | 12 > arch/x86/lib/fsp/fsp_support.c | 7 +++ > 3 files changed, 23 insertions(+) > Reviewed-by: Bin Meng ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 26/38] x86: Move common Intel CPU info code into a function
On Wed, Sep 25, 2019 at 10:13 PM Simon Glass wrote: > > Add cpu_intel_get_info() to find out the CPU info on modern Intel CPUs. > > Signed-off-by: Simon Glass > --- > > Changes in v2: None > > arch/x86/cpu/broadwell/cpu_full.c| 9 + > arch/x86/cpu/intel_common/cpu.c | 13 + > arch/x86/cpu/ivybridge/model_206ax.c | 8 ++-- > arch/x86/include/asm/cpu_common.h| 11 +++ > 4 files changed, 27 insertions(+), 14 deletions(-) > [snip] > diff --git a/arch/x86/include/asm/cpu_common.h > b/arch/x86/include/asm/cpu_common.h > index 4c91a5daced..0d560262d5a 100644 > --- a/arch/x86/include/asm/cpu_common.h > +++ b/arch/x86/include/asm/cpu_common.h > @@ -8,6 +8,8 @@ > > #define IA32_PERF_CTL 0x199 > > +struct cpu_info; > + > /** > * cpu_common_init() - Set up common CPU init > * > @@ -31,4 +33,13 @@ int cpu_common_init(void); > */ > int cpu_set_flex_ratio_to_tdp_nominal(void); > > +/** > + * cpu_intel_get_info() - Obtain CPU info for Intel CPUs > + * > + * Most Intel CPUs use the same MSR to obtain the clock speed, and use the > same > + * features. This function fills in these values, given the value of the base > + * clock in MHz (typically this should be set to 100). nits: please add parameter and return value descriptions. > + */ > +int cpu_intel_get_info(struct cpu_info *info, int bclk_mz); > + > #endif > -- Other than that, Reviewed-by: Bin Meng ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 23/38] efi: Move inline functions to unconditional part of header
On Wed, Sep 25, 2019 at 10:13 PM Simon Glass wrote: > > At present these two functions are defined in efi_loader.h but only if > CONFIG_EFI_LOADER is enabled. But these are functions that are useful to > other code, such as that which deals with Intel Handoff Blocks (HOBs). > > Move these to the top of the function. > > Possibly ascii2unicode() should not be an inline function, since this > might impact code size. > > Signed-off-by: Simon Glass > --- > In general it seems to be bad form to include parts of headers > conditionally. > > Changes in v2: None > > include/efi_loader.h | 10 +- > 1 file changed, 5 insertions(+), 5 deletions(-) > Reviewed-by: Bin Meng ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 19/38] x86: fsp: Tidy up comment style a little
Hi Simon, On Wed, Sep 25, 2019 at 10:12 PM Simon Glass wrote: > > The comments in the FSP code use a different style from the rest of the > x86 code. I am not sure it this is intentional. I guess it's because when it was written I was not familiar with the documenting style :) > > Signed-off-by: Simon Glass > --- > > Changes in v2: None > > arch/x86/include/asm/fsp/fsp_support.h | 42 - > arch/x86/include/asm/fsp1/fsp_support.h | 30 -- > arch/x86/include/asm/hob.h | 18 +-- > arch/x86/lib/hob.c | 8 ++--- > 4 files changed, 54 insertions(+), 44 deletions(-) > [snip] > diff --git a/arch/x86/include/asm/hob.h b/arch/x86/include/asm/hob.h > index b4239821aaa..72151ea045e 100644 > --- a/arch/x86/include/asm/hob.h > +++ b/arch/x86/include/asm/hob.h > @@ -135,7 +135,7 @@ struct hob_guid { > * > * @hdr:A pointer to a HOB. > * > - * @return: A pointer to the next HOB in the HOB list. > + * @return A pointer to the next HOB in the HOB list. > */ > static inline const struct hob_header *get_next_hob(const struct hob_header > *hdr) > @@ -152,8 +152,8 @@ static inline const struct hob_header *get_next_hob(const > struct hob_header > * > * @hdr: A pointer to a HOB. > * > - * @retval true: The HOB specified by hdr is the last HOB in the HOB list. > - * @retval false: The HOB specified by hdr is not the last HOB in the HOB > list. > + * @return true: The HOB specified by hdr is the last HOB in the HOB list. > + * @return false: The HOB specified by hdr is not the last HOB in the HOB > list. > */ > static inline bool end_of_hob(const struct hob_header *hdr) > { > @@ -169,7 +169,7 @@ static inline bool end_of_hob(const struct hob_header > *hdr) > * > * @hdr:A pointer to a HOB. > * > - * @return: A pointer to the data buffer in a HOB. > + * @return A pointer to the data buffer in a HOB. > */ > static inline void *get_guid_hob_data(const struct hob_header *hdr) > { > @@ -185,7 +185,7 @@ static inline void *get_guid_hob_data(const struct > hob_header *hdr) > * > * @hdr:A pointer to a HOB. > * > - * @return: The size of the data buffer. > + * @return The size of the data buffer. > */ > static inline u16 get_guid_hob_data_size(const struct hob_header *hdr) > { > @@ -198,7 +198,7 @@ static inline u16 get_guid_hob_data_size(const struct > hob_header *hdr) > * @type: HOB type to search > * @hob_list: A pointer to the HOB list > * > - * @retval: A HOB object with matching type; Otherwise NULL. > + *@return A HOB object with matching type; Otherwise NULL. should have a space between * and @ > */ > const struct hob_header *hob_get_next_hob(uint type, const void *hob_list); > > @@ -208,7 +208,7 @@ const struct hob_header *hob_get_next_hob(uint type, > const void *hob_list); > * @guid: GUID to search > * @hob_list: A pointer to the HOB list > * > - * @retval: A HOB object with matching GUID; Otherwise NULL. > + *@return A HOB object with matching GUID; Otherwise NULL. should have a space between * and @ > */ > const struct hob_header *hob_get_next_guid_hob(const efi_guid_t *guid, >const void *hob_list); > @@ -221,8 +221,8 @@ const struct hob_header *hob_get_next_guid_hob(const > efi_guid_t *guid, > * If the GUID HOB is located, the length will be updated. > * @guid A pointer to HOB GUID. > * > - * @retval NULL: Failed to find the GUID HOB. > - * @retval others: GUID HOB data buffer pointer. > + * @return NULL: Failed to find the GUID HOB. > + * @return others: GUID HOB data buffer pointer. > */ > void *hob_get_guid_hob_data(const void *hob_list, u32 *len, > const efi_guid_t *guid); > diff --git a/arch/x86/lib/hob.c b/arch/x86/lib/hob.c > index dcee29b04cf..f2c47240ee8 100644 > --- a/arch/x86/lib/hob.c > +++ b/arch/x86/lib/hob.c > @@ -13,7 +13,7 @@ > * @type: HOB type to search > * @hob_list: A pointer to the HOB list > * > - * @retval: A HOB object with matching type; Otherwise NULL. > + * @return A HOB object with matching type; Otherwise NULL. > */ > const struct hob_header *hob_get_next_hob(uint type, const void *hob_list) > { > @@ -38,7 +38,7 @@ const struct hob_header *hob_get_next_hob(uint type, const > void *hob_list) > * @guid: GUID to search > * @hob_list: A pointer to the HOB list > * > - * @retval: A HOB object with matching GUID; Otherwise NULL. > + * @return A HOB object with matching GUID; Otherwise NULL. > */ > const struct hob_header *hob_get_next_guid_hob(const efi_guid_t *guid, >const void *hob_list) > @@ -65,8 +65,8 @@ const struct hob_header *hob_get_next_guid_hob(const > efi_guid_t *guid, > * If the GUID HOB is located, the length will be updated. > * @guid
Re: [U-Boot] [PATCH v2 22/38] x86: fsp: Move common support functions into a common file
On Wed, Sep 25, 2019 at 10:12 PM Simon Glass wrote: > > Some of this file can be shared between FSP1 and FSP2. Move it into a > shared file. > > Signed-off-by: Simon Glass > --- > > Changes in v2: None > > arch/x86/lib/fsp/Makefile | 1 + > arch/x86/lib/fsp/fsp_support.c | 176 > arch/x86/lib/fsp1/fsp_support.c | 167 -- > 3 files changed, 177 insertions(+), 167 deletions(-) > create mode 100644 arch/x86/lib/fsp/fsp_support.c > Reviewed-by: Bin Meng ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 29/38] x86: spl: Use hang() instead of a while() loop
On Wed, Sep 25, 2019 at 10:13 PM Simon Glass wrote: > > Use the standard hang() function when booting fails since this implements > the defined U-Boot behaviour for this situation. > > Signed-off-by: Simon Glass > --- > > Changes in v2: None > > arch/x86/lib/spl.c | 3 +-- > arch/x86/lib/tpl.c | 3 +-- > 2 files changed, 2 insertions(+), 4 deletions(-) > Reviewed-by: Bin Meng ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 16/38] x86: Rename some FSP functions to have an fsp_ prefix
On Wed, Sep 25, 2019 at 10:12 PM Simon Glass wrote: > > Given these exported function an fsp_ prefix since they are declared in an > fsp.h header. > > Signed-off-by: Simon Glass > --- > > Changes in v2: None > > arch/x86/cpu/baytrail/fsp_configs.c | 2 +- > arch/x86/cpu/braswell/fsp_configs.c | 2 +- > arch/x86/cpu/ivybridge/fsp_configs.c| 2 +- > arch/x86/cpu/queensbay/fsp_configs.c| 2 +- > arch/x86/include/asm/fsp1/fsp_support.h | 6 +++--- > arch/x86/lib/fsp1/fsp_car.S | 10 +- > arch/x86/lib/fsp1/fsp_support.c | 14 +++--- > cmd/x86/fsp.c | 2 +- > 8 files changed, 20 insertions(+), 20 deletions(-) > Reviewed-by: Bin Meng ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 18/38] x86: fsp: Use if() instead of #ifdef
Hi Simon, On Tue, Aug 27, 2019 at 12:03 AM Simon Glass wrote: > > Update a few #ifdefs to if() to improve build coverage. > > Signed-off-by: Simon Glass > --- > > arch/x86/lib/fsp1/fsp_common.c | 9 - > arch/x86/lib/fsp1/fsp_dram.c | 8 ++-- > 2 files changed, 6 insertions(+), 11 deletions(-) > > diff --git a/arch/x86/lib/fsp1/fsp_common.c b/arch/x86/lib/fsp1/fsp_common.c > index 591eef7b81..bfd76dccba 100644 > --- a/arch/x86/lib/fsp1/fsp_common.c > +++ b/arch/x86/lib/fsp1/fsp_common.c > @@ -116,11 +116,10 @@ int arch_fsp_init(void) > #endif > > if (!gd->arch.hob_list) { > -#ifdef CONFIG_ENABLE_MRC_CACHE > - nvs = fsp_prepare_mrc_cache(); > -#else > - nvs = NULL; > -#endif > + if (IS_ENABLED(CONFIG_ENABLE_MRC_CACHE)) > + nvs = fsp_prepare_mrc_cache(); > + else > + nvs = NULL; > > #ifdef CONFIG_HAVE_ACPI_RESUME > if (prev_sleep_state == ACPI_S3) { > diff --git a/arch/x86/lib/fsp1/fsp_dram.c b/arch/x86/lib/fsp1/fsp_dram.c > index 3bf65b495c..961e963362 100644 > --- a/arch/x86/lib/fsp1/fsp_dram.c > +++ b/arch/x86/lib/fsp1/fsp_dram.c > @@ -29,13 +29,9 @@ int dram_init(void) > hdr = get_next_hob(hdr); > } > > - gd->ram_size = ram_size; > - post_code(POST_DRAM); This does not look right. > - > -#ifdef CONFIG_ENABLE_MRC_CACHE > - gd->arch.mrc_output = fsp_get_nvs_data(gd->arch.hob_list, > + if (IS_ENABLED(CONFIG_ENABLE_MRC_CACHE)) > + gd->arch.mrc_output = fsp_get_nvs_data(gd->arch.hob_list, >>arch.mrc_output_len); > -#endif > > return 0; > } Regards, Bin ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 17/38] x86: fsp: Create a common fsp_support.h header
On Wed, Sep 25, 2019 at 10:12 PM Simon Glass wrote: > > Many support functions are common between FSP1 and FSP2. Add a new header > to handle this. > > Signed-off-by: Simon Glass > --- > > Changes in v2: None > > arch/x86/include/asm/fsp/fsp_support.h | 128 > arch/x86/include/asm/fsp1/fsp_support.h | 123 +-- > drivers/pci/pci-uclass.c| 2 +- > 3 files changed, 132 insertions(+), 121 deletions(-) > create mode 100644 arch/x86/include/asm/fsp/fsp_support.h > Reviewed-by: Bin Meng ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 15/38] x86: sysreset: Allow reset driver to be included in SPL/TPL
On Wed, Sep 25, 2019 at 10:12 PM Simon Glass wrote: > > At present this driver is always included in SPL and TPL, if U-Boot proper > enables it. Update the Makefile to provide full control using the existing > Kconfig options. > > Signed-off-by: Simon Glass > --- > > Changes in v2: None > > drivers/sysreset/Kconfig | 12 > drivers/sysreset/Makefile | 2 +- > 2 files changed, 13 insertions(+), 1 deletion(-) > Reviewed-by: Bin Meng ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 11/38] spl: Add a function to determine the U-Boot phase
On Wed, Sep 25, 2019 at 10:12 PM Simon Glass wrote: > > U-Boot is built in three phases: TPL, SPL and U-Boot proper. Sometimes > it is necessary to use different init code depending on the phase. For > example, TPL might do very basic CPU init, SPL might do a little more > and U-Boot proper might bring the CPU up to full speed and enable all > cores. > > Add a function which allows easy determination of the current phase being > built. > > Signed-off-by: Simon Glass > --- > > Changes in v2: None > > include/spl.h | 60 +++ > 1 file changed, 60 insertions(+) > Reviewed-by: Bin Meng ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 10/38] spl: Set up the bloblist in board_init_r()
On Wed, Sep 25, 2019 at 10:12 PM Simon Glass wrote: > > At present the bloblist is set up in spl_common_init() which can be called > from spl_early_init(), i.e. before SDRAM is ready. This prevents the > bloblist from being located in SDRAM, which is useful on some platforms > where SRAM is inaccessible after U-Boot relocates (e.g. x86 CAR region). > > It doesn't serve much purpose to have the bloblist available early, since > very little is known about the platform then, and the handoff info is > written when SPL is about to jump to U-Boot. > > Move the code to board_init_r() to avoid any restrictions. > > Signed-off-by: Simon Glass > --- > > Changes in v2: None > > common/spl/spl.c | 35 ++- > 1 file changed, 18 insertions(+), 17 deletions(-) > Reviewed-by: Bin Meng ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 07/38] spl: Avoid checking for Ctrl-C in SPL with print_buffer()
On Wed, Sep 25, 2019 at 10:12 PM Simon Glass wrote: > > We don't have a console in SPL so it doesn't make sense to check for > Ctrl-C when printing a memory dump. Skip this so that print_buffer() can > be used in SPL. > > Signed-off-by: Simon Glass > --- > > Changes in v2: None > > lib/display_options.c | 2 ++ > 1 file changed, 2 insertions(+) > Reviewed-by: Bin Meng ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 09/38] spl: Add an arch-specific hook for writing to SPL handoff
On Wed, Sep 25, 2019 at 10:12 PM Simon Glass wrote: > > At present there is an arch-specific area in the SPL handoff area intended > for use by arch-specific code, but there is no explicit call to fill in > this data. Add a hook for this. > > Also use the hook to remove the sandbox-specific test code from > write_spl_handoff(). > > Signed-off-by: Simon Glass > --- > > Changes in v2: None > > arch/sandbox/cpu/spl.c | 7 +++ > common/spl/spl.c | 12 +--- > include/handoff.h | 13 + > 3 files changed, 29 insertions(+), 3 deletions(-) > Reviewed-by: Bin Meng ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 08/38] spl: handoff: Correct Kconfig condition for SPL and TPL
On Wed, Sep 25, 2019 at 10:12 PM Simon Glass wrote: > > At present these options can be enabled when bloblist is not enabled for > SPL or TPL. This is incorrect as SPL handoff requires bloblist. Fix it. > > Signed-off-by: Simon Glass > --- > > Changes in v2: None > > common/spl/Kconfig | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > Reviewed-by: Bin Meng ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 05/38] serial: ns16550: Allow serial to enabled/disabled in SPL
On Wed, Sep 25, 2019 at 10:12 PM Simon Glass wrote: > > At present this driver uses the wrong condition for including the code and > drivers in SPL/TPL. Update it so that the code is only included if > DM_SERIAL is enabled for SPL/TPL. > > Signed-off-by: Simon Glass > --- > > Changes in v2: None > > drivers/serial/ns16550.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > Reviewed-by: Bin Meng ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 03/38] dm: gpio: Allow control of GPIO uclass in SPL
On Wed, Sep 25, 2019 at 10:12 PM Simon Glass wrote: > > At present if CONFIG_SPL_GPIO_SUPPORT is enabled then the GPIO uclass > is included in SPL/TPL without any control for boards. Some boards may > want to disable this to reduce code size where GPIOs are not needed in > SPL or TPL. > > Add a new Kconfig option to permit this. Default it to 'y' so that > existing boards work correctly. This allows us to remove the hack in > config_uncmd_spl.h (eventually that file should be removed). > > Signed-off-by: Simon Glass > --- > > Changes in v2: > - Fix the Kconfig condition to avoid build errors on snow > > drivers/gpio/Kconfig | 22 ++ > drivers/gpio/Makefile | 2 +- > include/config_uncmd_spl.h | 1 - > 3 files changed, 23 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig > index f2dabb554fa..11a242d7aa8 100644 > --- a/drivers/gpio/Kconfig > +++ b/drivers/gpio/Kconfig > @@ -14,6 +14,28 @@ config DM_GPIO > particular GPIOs that they provide. The uclass interface > is defined in include/asm-generic/gpio.h. > > +config SPL_DM_GPIO > + bool "Enable Driver Model for GPIO drivers in SPL" > + depends on DM_GPIO && SPL_DM && SPL_GPIO_SUPPORT > + default y > + help > + Enable driver model for GPIO access. The standard GPIO nits: Enable driver model for GPIO access in SPL. > + interface (gpio_get_value(), etc.) is then implemented by > + the GPIO uclass. Drivers provide methods to query the > + particular GPIOs that they provide. The uclass interface > + is defined in include/asm-generic/gpio.h. > + > +config TPL_DM_GPIO > + bool "Enable Driver Model for GPIO drivers in TPL" > + depends on DM_GPIO && TPL_DM && TPL_GPIO_SUPPORT > + default y > + help > + Enable driver model for GPIO access. The standard GPIO nits: Enable driver model for GPIO access in TPL. > + interface (gpio_get_value(), etc.) is then implemented by > + the GPIO uclass. Drivers provide methods to query the > + particular GPIOs that they provide. The uclass interface > + is defined in include/asm-generic/gpio.h. > + > config GPIO_HOG > bool "Enable GPIO hog support" > depends on DM_GPIO > diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile > index 4a8aa0ff6fe..56e9374e308 100644 > --- a/drivers/gpio/Makefile > +++ b/drivers/gpio/Makefile > @@ -7,7 +7,7 @@ ifndef CONFIG_SPL_BUILD > obj-$(CONFIG_DWAPB_GPIO) += dwapb_gpio.o > obj-$(CONFIG_AXP_GPIO) += axp_gpio.o > endif > -obj-$(CONFIG_DM_GPIO) += gpio-uclass.o > +obj-$(CONFIG_$(SPL_TPL_)DM_GPIO) += gpio-uclass.o > > obj-$(CONFIG_$(SPL_)DM_PCA953X)+= pca953x_gpio.o > obj-$(CONFIG_DM_74X164)+= 74x164_gpio.o > diff --git a/include/config_uncmd_spl.h b/include/config_uncmd_spl.h > index c2f9735ce79..31da6215b3a 100644 > --- a/include/config_uncmd_spl.h > +++ b/include/config_uncmd_spl.h > @@ -12,7 +12,6 @@ > > #ifndef CONFIG_SPL_DM > #undef CONFIG_DM_SERIAL > -#undef CONFIG_DM_GPIO > #undef CONFIG_DM_I2C > #undef CONFIG_DM_SPI > #endif > -- Other than that, Reviewed-by: Bin Meng ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 04/38] mtd: spi: Add 'struct spi_flash {' to the code
On Wed, Sep 25, 2019 at 10:12 PM Simon Glass wrote: > > At present spi_flash is defined to be spi_nor which is confusing since it > is not possible to find the 'spi_flash' by normal text search. Add a > comment to help with this. > > Signed-off-by: Simon Glass > --- > > Changes in v2: None > > include/linux/mtd/spi-nor.h | 8 +++- > 1 file changed, 7 insertions(+), 1 deletion(-) > Reviewed-by: Bin Meng ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 02/38] binman: Allow selection of logging verbosity
On Wed, Sep 25, 2019 at 10:12 PM Simon Glass wrote: > > Support a new BINMAN_VERBOSE option to the build, to allow passing the > -v flag to binman. > > Signed-off-by: Simon Glass > --- > > Changes in v2: None > > Makefile| 3 ++- > tools/binman/README | 6 ++ > 2 files changed, 8 insertions(+), 1 deletion(-) > > diff --git a/Makefile b/Makefile > index c5caec8267e..fd390e19458 100644 > --- a/Makefile > +++ b/Makefile > @@ -1214,7 +1214,8 @@ u-boot.ldr: u-boot > quiet_cmd_binman = BINMAN $@ > cmd_binman = $(srctree)/tools/binman/binman $(if $(BINMAN_DEBUG),-D) \ > --toolpath $(objtree)/tools \ > -build -u -d u-boot.dtb -O . -m \ > + $(if $(BINMAN_VERBOSE),-v$(BINMAN_VERBOSE)) \ > + build -u -d u-boot.dtb -O . -m \ > -I . -I $(srctree) -I $(srctree)/board/$(BOARDDIR) \ > $(BINMAN_$(@F)) > > diff --git a/tools/binman/README b/tools/binman/README > index b4f6392ab74..8e0f0a8c55b 100644 > --- a/tools/binman/README > +++ b/tools/binman/README > @@ -934,6 +934,12 @@ BINMAN_DEBUG=1 to your build: > make sandbox_defconfig > make BINMAN_DEBUG=1 > > +To enable verbose logging from binman, base BINMAN_VERBOSE to your build, > which > +adds a -v option to the call to binman: > + > + make sandbox_defconfig I don't see sandbox_defconfig enables BINMAN. Shouldn't it be qemu-x86_defconfig? > + make BINMAN_VERBOSE=5 > + > > History / Credits > - > -- Other than that, Reviewed-by: Bin Meng Tested-by: Bin Meng Regards, Bin ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 01/38] binman: Pass the toolpath to binman from the main Makefile
On Wed, Sep 25, 2019 at 10:12 PM Simon Glass wrote: > > Pass in the toolpath in case binman needs to use tools compiled in the > U-Boot tools/ directory. > > Signed-off-by: Simon Glass > --- > > Changes in v2: None > > Makefile | 1 + > 1 file changed, 1 insertion(+) > Reviewed-by: Bin Meng ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] Makefile: Fix typo around CONFIG_SPL_FIT_SOURCE
Trivial fix. Signed-off-by: Michal Simek --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 1d9ade948bab..60ae53d6388a 100644 --- a/Makefile +++ b/Makefile @@ -1232,7 +1232,7 @@ ifndef CONFIG_SYS_UBOOT_START CONFIG_SYS_UBOOT_START := 0 endif -# Boards with more complex image requirments can provide an .its source file +# Boards with more complex image requirements can provide an .its source file # or a generator script ifneq ($(CONFIG_SPL_FIT_SOURCE),"") U_BOOT_ITS = $(subst ",,$(CONFIG_SPL_FIT_SOURCE)) -- 2.17.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 11/13] arm64: zynqmp: probe firmware driver
From: Ibai Erkiaga Probe ZynqMP firmware driver on the board initialization phase and ensure that firmware is in place to continue execution. The probing is done on board_init so it can be used for both SPL and U-Boot proper. Signed-off-by: Ibai Erkiaga Signed-off-by: Michal Simek --- Changes in v2: None arch/arm/Kconfig | 3 +++ board/xilinx/zynqmp/zynqmp.c | 18 ++ 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 257a98d795e5..e4ec703139de 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -1056,9 +1056,12 @@ config ARCH_ZYNQMP select DM_SPI if SPI select DM_SPI_FLASH if DM_SPI select DM_USB if USB + select FIRMWARE select OF_CONTROL select SPL_BOARD_INIT if SPL select SPL_CLK if SPL + select SPL_DM_MAILBOX if SPL + select SPL_FIRMWARE if SPL select SPL_SEPARATE_BSS if SPL select SUPPORT_SPL imply BOARD_LATE_INIT diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c index 8a66d3e50aad..b94936474d7e 100644 --- a/board/xilinx/zynqmp/zynqmp.c +++ b/board/xilinx/zynqmp/zynqmp.c @@ -318,18 +318,6 @@ static char *zynqmp_get_silicon_idcode_name(void) int board_early_init_f(void) { int ret = 0; -#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_CLK_ZYNQMP) - u32 pm_api_version; - - pm_api_version = zynqmp_firmware_version(); - printf("PMUFW:\tv%d.%d\n", - pm_api_version >> ZYNQMP_PM_VERSION_MAJOR_SHIFT, - pm_api_version & ZYNQMP_PM_VERSION_MINOR_MASK); - - if (pm_api_version < ZYNQMP_PM_VERSION) - panic("PMUFW version error. Expected: v%d.%d\n", - ZYNQMP_PM_VERSION_MAJOR, ZYNQMP_PM_VERSION_MINOR); -#endif #if defined(CONFIG_ZYNQMP_PSU_INIT_ENABLED) ret = psu_init(); @@ -340,6 +328,12 @@ int board_early_init_f(void) int board_init(void) { + struct udevice *dev; + + uclass_get_device_by_name(UCLASS_FIRMWARE, "zynqmp-power", ); + if (!dev) + panic("PMU Firmware device not found - Enable it"); + #if defined(CONFIG_SPL_BUILD) /* Check *at build time* if the filename is an non-empty string */ if (sizeof(CONFIG_ZYNQMP_SPL_PM_CFG_OBJ_FILE) > 1) -- 2.17.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 07/13] firmware: zynqmp: get fw version with mailbox driver
From: Ibai Erkiaga Implements the function to get PMU Firmware version using the mailbox driver or smc call based on if running SPL or not. Additionally gets version as part of the ZynqMP Firmware driver probing Signed-off-by: Ibai Erkiaga Signed-off-by: Michal Simek --- Changes in v2: - Align ret handling - Also handle error from mbox_recv/mbox_send drivers/firmware/firmware-zynqmp.c | 76 +- 1 file changed, 74 insertions(+), 2 deletions(-) diff --git a/drivers/firmware/firmware-zynqmp.c b/drivers/firmware/firmware-zynqmp.c index 97ac333296ec..957de9ecae4c 100644 --- a/drivers/firmware/firmware-zynqmp.c +++ b/drivers/firmware/firmware-zynqmp.c @@ -10,11 +10,76 @@ #include #include +#define PMUFW_PAYLOAD_ARG_CNT 8 + struct zynqmp_power { struct mbox_chan tx_chan; struct mbox_chan rx_chan; } zynqmp_power; +static int ipi_req(const u32 *req, size_t req_len, u32 *res, size_t res_maxlen) +{ + struct zynqmp_ipi_msg msg; + int ret; + + if (req_len > PMUFW_PAYLOAD_ARG_CNT || + res_maxlen > PMUFW_PAYLOAD_ARG_CNT) + return -EINVAL; + + if (!(zynqmp_power.tx_chan.dev) || !(_power.rx_chan.dev)) + return -EINVAL; + + msg.buf = (u32 *)req; + msg.len = req_len; + ret = mbox_send(_power.tx_chan, ); + if (ret) { + debug("%s: Sending message failed\n", __func__); + return ret; + } + + msg.buf = res; + msg.len = res_maxlen; + ret = mbox_recv(_power.rx_chan, , 100); + if (ret) + debug("%s: Receiving message failed\n", __func__); + + return ret; +} + +unsigned int zynqmp_firmware_version(void) +{ + int ret; + u32 ret_payload[PAYLOAD_ARG_CNT]; + static u32 pm_api_version = ZYNQMP_PM_VERSION_INVALID; + + /* +* Get PMU version only once and later +* just return stored values instead of +* asking PMUFW again. +**/ + if (pm_api_version == ZYNQMP_PM_VERSION_INVALID) { + if (IS_ENABLED(CONFIG_SPL_BUILD)) { + const u32 request[] = { PM_GET_API_VERSION }; + + ret = ipi_req(request, ARRAY_SIZE(request), + ret_payload, 2); + } else { + ret = invoke_smc(ZYNQMP_SIP_SVC_GET_API_VERSION, 0, 0, +0, 0, ret_payload); + }; + + if (ret) + panic("PMUFW is not found - Please load it!\n"); + + pm_api_version = ret_payload[1]; + if (pm_api_version < ZYNQMP_PM_VERSION) + panic("PMUFW version error. Expected: v%d.%d\n", + ZYNQMP_PM_VERSION_MAJOR, ZYNQMP_PM_VERSION_MINOR); + } + + return pm_api_version; +}; + static int zynqmp_power_probe(struct udevice *dev) { int ret = 0; @@ -28,10 +93,17 @@ static int zynqmp_power_probe(struct udevice *dev) } ret = mbox_get_by_name(dev, "rx", _power.rx_chan); - if (ret) + if (ret) { debug("%s, cannot rx mailbox\n", __func__); + return ret; + } - return ret; + ret = zynqmp_firmware_version(); + printf("PMUFW:\tv%d.%d\n", + ret >> ZYNQMP_PM_VERSION_MAJOR_SHIFT, + ret & ZYNQMP_PM_VERSION_MINOR_MASK); + + return 0; }; static const struct udevice_id zynqmp_power_ids[] = { -- 2.17.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 09/13] arm64: zynqmp: use firmware driver to get version
From: Ibai Erkiaga Use the new function from firmware version to get the firmware version. Signed-off-by: Ibai Erkiaga Signed-off-by: Michal Simek --- Changes in v2: None board/xilinx/zynqmp/zynqmp.c | 2 +- drivers/fpga/zynqmppl.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c index d9186f463f20..8a66d3e50aad 100644 --- a/board/xilinx/zynqmp/zynqmp.c +++ b/board/xilinx/zynqmp/zynqmp.c @@ -321,7 +321,7 @@ int board_early_init_f(void) #if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_CLK_ZYNQMP) u32 pm_api_version; - pm_api_version = zynqmp_pmufw_version(); + pm_api_version = zynqmp_firmware_version(); printf("PMUFW:\tv%d.%d\n", pm_api_version >> ZYNQMP_PM_VERSION_MAJOR_SHIFT, pm_api_version & ZYNQMP_PM_VERSION_MINOR_MASK); diff --git a/drivers/fpga/zynqmppl.c b/drivers/fpga/zynqmppl.c index 6168626aeef3..c2670271c8ea 100644 --- a/drivers/fpga/zynqmppl.c +++ b/drivers/fpga/zynqmppl.c @@ -152,7 +152,7 @@ static ulong zynqmp_align_dma_buffer(u32 *buf, u32 len, u32 swap) buf = new_buf; } else if ((swap != SWAP_DONE) && - (zynqmp_pmufw_version() <= PMUFW_V1_0)) { + (zynqmp_firmware_version() <= PMUFW_V1_0)) { /* For bitstream which are aligned */ new_buf = buf; @@ -205,7 +205,7 @@ static int zynqmp_load(xilinx_desc *desc, const void *buf, size_t bsize, u32 ret_payload[PAYLOAD_ARG_CNT]; bool xilfpga_old = false; - if (zynqmp_pmufw_version() <= PMUFW_V1_0) { + if (zynqmp_firmware_version() <= PMUFW_V1_0) { puts("WARN: PMUFW v1.0 or less is detected\n"); puts("WARN: Not all bitstream formats are supported\n"); puts("WARN: Please upgrade PMUFW\n"); -- 2.17.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 10/13] arm64: zynqmp: remove old fw version function
From: Ibai Erkiaga Removes the old function to get the firmware version. Signed-off-by: Ibai Erkiaga Signed-off-by: Michal Simek --- Changes in v2: None arch/arm/mach-zynqmp/cpu.c| 23 --- arch/arm/mach-zynqmp/include/mach/sys_proto.h | 1 - 2 files changed, 24 deletions(-) diff --git a/arch/arm/mach-zynqmp/cpu.c b/arch/arm/mach-zynqmp/cpu.c index f28b964a1560..bb21cbcadf69 100644 --- a/arch/arm/mach-zynqmp/cpu.c +++ b/arch/arm/mach-zynqmp/cpu.c @@ -180,29 +180,6 @@ int __maybe_unused invoke_smc(u32 pm_api_id, u32 arg0, u32 arg1, u32 arg2, return regs.regs[0]; } -unsigned int __maybe_unused zynqmp_pmufw_version(void) -{ - int ret; - u32 ret_payload[PAYLOAD_ARG_CNT]; - static u32 pm_api_version = ZYNQMP_PM_VERSION_INVALID; - - /* -* Get PMU version only once and later -* just return stored values instead of -* asking PMUFW again. -*/ - if (pm_api_version == ZYNQMP_PM_VERSION_INVALID) { - ret = invoke_smc(ZYNQMP_SIP_SVC_GET_API_VERSION, 0, 0, 0, 0, -ret_payload); - pm_api_version = ret_payload[1]; - - if (ret) - panic("PMUFW is not found - Please load it!\n"); - } - - return pm_api_version; -} - static int zynqmp_mmio_rawwrite(const u32 address, const u32 mask, const u32 value) diff --git a/arch/arm/mach-zynqmp/include/mach/sys_proto.h b/arch/arm/mach-zynqmp/include/mach/sys_proto.h index 658974445417..27603a60ff8f 100644 --- a/arch/arm/mach-zynqmp/include/mach/sys_proto.h +++ b/arch/arm/mach-zynqmp/include/mach/sys_proto.h @@ -48,7 +48,6 @@ unsigned int zynqmp_get_silicon_version(void); void handoff_setup(void); -unsigned int zynqmp_pmufw_version(void); int zynqmp_mmio_write(const u32 address, const u32 mask, const u32 value); int zynqmp_mmio_read(const u32 address, u32 *value); int invoke_smc(u32 pm_api_id, u32 arg0, u32 arg1, u32 arg2, u32 arg3, -- 2.17.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 12/13] firmware: zynqmp: Separate function for sending message via mailbox
U-Boot running in EL3 can't use SMC that's why there is a need to talk to PMUFW directly via mailbox. The same logic is applied to all functions which need to talk to PMUFW that's why move this logic to separate function to avoid code duplication. Also SMC request ID can be composed from PM_SIP_SVC offset that's why ZYNQMP_SIP_SVC_GET_API_VERSION macro can be removed completely. Signed-off-by: Michal Simek --- Changes in v2: - pass rex_maxlen to ipi_req - reported by Luca drivers/firmware/firmware-zynqmp.c | 19 ++- include/zynqmp_firmware.h | 2 -- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/drivers/firmware/firmware-zynqmp.c b/drivers/firmware/firmware-zynqmp.c index e62db2a5138d..597becc04bca 100644 --- a/drivers/firmware/firmware-zynqmp.c +++ b/drivers/firmware/firmware-zynqmp.c @@ -47,6 +47,14 @@ static int ipi_req(const u32 *req, size_t req_len, u32 *res, size_t res_maxlen) return ret; } +static int send_req(const u32 *req, size_t req_len, u32 *res, size_t res_maxlen) +{ + if (IS_ENABLED(CONFIG_SPL_BUILD)) + return ipi_req(req, req_len, res, res_maxlen); + + return invoke_smc(req[0] + PM_SIP_SVC, 0, 0, 0, 0, res); +} + unsigned int zynqmp_firmware_version(void) { int ret; @@ -59,16 +67,9 @@ unsigned int zynqmp_firmware_version(void) * asking PMUFW again. **/ if (pm_api_version == ZYNQMP_PM_VERSION_INVALID) { - if (IS_ENABLED(CONFIG_SPL_BUILD)) { - const u32 request[] = { PM_GET_API_VERSION }; - - ret = ipi_req(request, ARRAY_SIZE(request), - ret_payload, 2); - } else { - ret = invoke_smc(ZYNQMP_SIP_SVC_GET_API_VERSION, 0, 0, -0, 0, ret_payload); - }; + const u32 request[] = { PM_GET_API_VERSION }; + ret = send_req(request, ARRAY_SIZE(request), ret_payload, 2); if (ret) panic("PMUFW is not found - Please load it!\n"); diff --git a/include/zynqmp_firmware.h b/include/zynqmp_firmware.h index 30bf870b02da..cebac74e9140 100644 --- a/include/zynqmp_firmware.h +++ b/include/zynqmp_firmware.h @@ -15,8 +15,6 @@ enum pm_api_id { }; #define PM_SIP_SVC 0xc200 -#define ZYNQMP_SIP_SVC_GET_API_VERSION \ - (PM_SIP_SVC + PM_GET_API_VERSION) #define ZYNQMP_SIP_SVC_PM_SECURE_IMG_LOAD \ (PM_SIP_SVC + PM_SECURE_IMAGE) -- 2.17.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 13/13] arm64: zynqmp: Use mailbox driver for PMUFW config loading
With new mailbox driver PMUFW configuration object can be loaded via the same interface and there is no need to have pmu_ipc.c completely. Signed-off-by: Michal Simek Reviewed-by: Luca Ceresoli --- Changes in v2: None arch/arm/mach-zynqmp/Makefile | 4 - arch/arm/mach-zynqmp/include/mach/sys_proto.h | 2 - arch/arm/mach-zynqmp/pmu_ipc.c| 112 -- drivers/firmware/firmware-zynqmp.c| 24 include/zynqmp_firmware.h | 1 + 5 files changed, 25 insertions(+), 118 deletions(-) delete mode 100644 arch/arm/mach-zynqmp/pmu_ipc.c diff --git a/arch/arm/mach-zynqmp/Makefile b/arch/arm/mach-zynqmp/Makefile index f3765e45b1b9..8a3b0747244a 100644 --- a/arch/arm/mach-zynqmp/Makefile +++ b/arch/arm/mach-zynqmp/Makefile @@ -8,7 +8,3 @@ obj-y += cpu.o obj-$(CONFIG_MP) += mp.o obj-$(CONFIG_SPL_BUILD) += spl.o handoff.o obj-$(CONFIG_ZYNQMP_PSU_INIT_ENABLED) += psu_spl_init.o - -ifneq ($(CONFIG_ZYNQMP_SPL_PM_CFG_OBJ_FILE),"") -obj-$(CONFIG_SPL_BUILD) += pmu_ipc.o -endif diff --git a/arch/arm/mach-zynqmp/include/mach/sys_proto.h b/arch/arm/mach-zynqmp/include/mach/sys_proto.h index 27603a60ff8f..69e729fb7625 100644 --- a/arch/arm/mach-zynqmp/include/mach/sys_proto.h +++ b/arch/arm/mach-zynqmp/include/mach/sys_proto.h @@ -60,6 +60,4 @@ int chip_id(unsigned char id); void tcm_init(u8 mode); #endif -void zynqmp_pmufw_load_config_object(const void *cfg_obj, size_t size); - #endif /* _ASM_ARCH_SYS_PROTO_H */ diff --git a/arch/arm/mach-zynqmp/pmu_ipc.c b/arch/arm/mach-zynqmp/pmu_ipc.c deleted file mode 100644 index d8858ea3ff99.. --- a/arch/arm/mach-zynqmp/pmu_ipc.c +++ /dev/null @@ -1,112 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* - * Inter-Processor Communication with the Platform Management Unit (PMU) - * firmware. - * - * (C) Copyright 2019 Luca Ceresoli - * Luca Ceresoli - */ - -#include -#include -#include - -/* IPI bitmasks, register base and register offsets */ -#define IPI_BIT_MASK_APU 0x1 -#define IPI_BIT_MASK_PMU0 0x1 -#define IPI_REG_BASE_APU 0xFF30 -#define IPI_REG_BASE_PMU0 0xFF33 -#define IPI_REG_OFFSET_TRIG 0x00 -#define IPI_REG_OFFSET_OBR0x04 - -/* IPI mailbox buffer offsets */ -#define IPI_BUF_BASE_APU 0xFF990400 -#define IPI_BUF_OFFSET_TARGET_PMU 0x1C0 -#define IPI_BUF_OFFSET_REQ 0x00 -#define IPI_BUF_OFFSET_RESP0x20 - -#define PMUFW_PAYLOAD_ARG_CNT 8 - -/* PMUFW commands */ -#define PMUFW_CMD_SET_CONFIGURATION2 - -static void pmu_ipc_send_request(const u32 *req, size_t req_len) -{ - u32 *mbx = (u32 *)(IPI_BUF_BASE_APU + - IPI_BUF_OFFSET_TARGET_PMU + - IPI_BUF_OFFSET_REQ); - size_t i; - - for (i = 0; i < req_len; i++) - writel(req[i], [i]); -} - -static void pmu_ipc_read_response(unsigned int *value, size_t count) -{ - u32 *mbx = (u32 *)(IPI_BUF_BASE_APU + - IPI_BUF_OFFSET_TARGET_PMU + - IPI_BUF_OFFSET_RESP); - size_t i; - - for (i = 0; i < count; i++) - value[i] = readl([i]); -} - -/** - * Send request to PMU and get the response. - * - * @req:Request buffer. Byte 0 is the API ID, other bytes are optional - * parameters. - * @req_len:Request length in number of 32-bit words. - * @res:Response buffer. Byte 0 is the error code, other bytes are - * optional parameters. Optional, if @res_maxlen==0 the parameters - * will not be read. - * @res_maxlen: Space allocated for the response in number of 32-bit words. - * - * @return Error code returned by the PMU (i.e. the first word of the response) - */ -static int pmu_ipc_request(const u32 *req, size_t req_len, - u32 *res, size_t res_maxlen) -{ - u32 status; - - if (req_len > PMUFW_PAYLOAD_ARG_CNT || - res_maxlen > PMUFW_PAYLOAD_ARG_CNT) - return -EINVAL; - - pmu_ipc_send_request(req, req_len); - - /* Raise Inter-Processor Interrupt to PMU and wait for response */ - writel(IPI_BIT_MASK_PMU0, IPI_REG_BASE_APU + IPI_REG_OFFSET_TRIG); - do { - status = readl(IPI_REG_BASE_APU + IPI_REG_OFFSET_OBR); - } while (status & IPI_BIT_MASK_PMU0); - - pmu_ipc_read_response(res, res_maxlen); - - return 0; -} - -/** - * Send a configuration object to the PMU firmware. - * - * @cfg_obj: Pointer to the configuration object - * @size:Size of @cfg_obj in bytes - */ -void zynqmp_pmufw_load_config_object(const void *cfg_obj, size_t size) -{ - const u32 request[] = { - PMUFW_CMD_SET_CONFIGURATION, - (u32)((u64)cfg_obj) - }; - u32 response; - int err; - - printf("Loading PMUFW cfg obj (%ld bytes)\n", size); - - err = pmu_ipc_request(request, ARRAY_SIZE(request), ,
[U-Boot] [PATCH v2 06/13] arm64: zynqmp: Cleanup PM SMC macro composition
Cleanup PM ID handling by using enum values. Signed-off-by: Michal Simek Signed-off-by: Ibai Erkiaga --- Changes in v2: None arch/arm/mach-zynqmp/include/mach/sys_proto.h | 13 +++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-zynqmp/include/mach/sys_proto.h b/arch/arm/mach-zynqmp/include/mach/sys_proto.h index f25d414dcb1e..573c4ffceed9 100644 --- a/arch/arm/mach-zynqmp/include/mach/sys_proto.h +++ b/arch/arm/mach-zynqmp/include/mach/sys_proto.h @@ -10,7 +10,8 @@ #define PAYLOAD_ARG_CNT5 #define ZYNQMP_CSU_SILICON_VER_MASK0xF -#define ZYNQMP_SIP_SVC_PM_SECURE_IMG_LOAD 0xC22D +#define ZYNQMP_SIP_SVC_PM_SECURE_IMG_LOAD \ + (PM_SIP_SVC + PM_SECURE_IMAGE) #define KEY_PTR_LEN32 #define ZYNQMP_FPGA_BIT_AUTH_DDR 1 @@ -21,7 +22,8 @@ #define ZYNQMP_FPGA_AUTH_DDR 1 -#define ZYNQMP_SIP_SVC_GET_API_VERSION 0xC201 +#define ZYNQMP_SIP_SVC_GET_API_VERSION \ + (PM_SIP_SVC + PM_GET_API_VERSION) #define ZYNQMP_PM_VERSION_MAJOR1 #define ZYNQMP_PM_VERSION_MINOR0 @@ -36,6 +38,13 @@ #define PMUFW_V1_0 ((1 << ZYNQMP_PM_VERSION_MAJOR_SHIFT) | 0) +#define PM_SIP_SVC 0xc200 + +enum pm_api_id { + PM_GET_API_VERSION = 1, + PM_SECURE_IMAGE = 45, +}; + enum { IDCODE, VERSION, -- 2.17.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 05/13] arm64: zynqmp: add firmware and mailbox node to DT
From: Ibai Erkiaga The following patch adds a mailbox node and firmware node to following the mainline DT. Signed-off-by: Ibai Erkiaga Signed-off-by: Michal Simek --- Changes in v2: None arch/arm/dts/zynqmp.dtsi | 44 +++- 1 file changed, 39 insertions(+), 5 deletions(-) diff --git a/arch/arm/dts/zynqmp.dtsi b/arch/arm/dts/zynqmp.dtsi index dfb6ebc64ce5..8e35171dd01d 100644 --- a/arch/arm/dts/zynqmp.dtsi +++ b/arch/arm/dts/zynqmp.dtsi @@ -96,6 +96,29 @@ }; }; + zynqmp_ipi { + u-boot,dm-pre-reloc; + compatible = "xlnx,zynqmp-ipi-mailbox"; + interrupt-parent = <>; + interrupts = <0 35 4>; + xlnx,ipi-id = <0>; + #address-cells = <2>; + #size-cells = <2>; + ranges; + + ipi_mailbox_pmu1: mailbox@ff990400 { + u-boot,dm-pre-reloc; + reg = <0x0 0xff9905c0 0x0 0x20>, + <0x0 0xff9905e0 0x0 0x20>, + <0x0 0xff990e80 0x0 0x20>, + <0x0 0xff990ea0 0x0 0x20>; + reg-names = "local_request_region" , "local_response_region", + "remote_request_region", "remote_response_region"; + #mbox-cells = <1>; + xlnx,ipi-id = <4>; + }; + }; + dcc: dcc { compatible = "arm,dcc"; status = "disabled"; @@ -116,11 +139,22 @@ method = "smc"; }; - pmufw: firmware { - compatible = "xlnx,zynqmp-pm"; - method = "smc"; - interrupt-parent = <>; - interrupts = <0 35 4>; + firmware { + zynqmp-firmware { + compatible = "xlnx,zynqmp-firmware"; + method = "smc"; + #power-domain-cells = <0x1>; + u-boot,dm-pre-reloc; + + zynqmp_power: zynqmp-power { + u-boot,dm-pre-reloc; + compatible = "xlnx,zynqmp-power"; + interrupt-parent = <>; + interrupts = <0 35 4>; + mboxes = <_mailbox_pmu1 0>, <_mailbox_pmu1 1>; + mbox-names = "tx", "rx"; + }; + }; }; timer { -- 2.17.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 08/13] firmware: zynqmp: create firmware header
From: Ibai Erkiaga New firmware header to place firmware specific macro and function declarations. The patch also moves the macros defining PM operations as well as some helper macros. Signed-off-by: Ibai Erkiaga Signed-off-by: Michal Simek --- Changes in v2: - Move pm_api_id higher - Reported by Luca - Fix macros for header protection MAINTAINERS | 1 + arch/arm/mach-zynqmp/cpu.c| 1 + arch/arm/mach-zynqmp/include/mach/sys_proto.h | 25 board/xilinx/zynqmp/cmds.c| 1 + board/xilinx/zynqmp/zynqmp.c | 1 + drivers/firmware/firmware-zynqmp.c| 1 + drivers/fpga/zynqmppl.c | 1 + include/zynqmp_firmware.h | 38 +++ 8 files changed, 44 insertions(+), 25 deletions(-) create mode 100644 include/zynqmp_firmware.h diff --git a/MAINTAINERS b/MAINTAINERS index f5feb89ac3e9..5d5c0fc61f03 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -460,6 +460,7 @@ F: drivers/timer/cadence-ttc.c F: drivers/usb/host/ehci-zynq.c F: drivers/watchdog/cdns_wdt.c F: include/zynqmppl.h +F: include/zynqmp_firmware.h F: tools/zynqmp* N: ultra96 N: zynqmp diff --git a/arch/arm/mach-zynqmp/cpu.c b/arch/arm/mach-zynqmp/cpu.c index 5ef1a52862c0..f28b964a1560 100644 --- a/arch/arm/mach-zynqmp/cpu.c +++ b/arch/arm/mach-zynqmp/cpu.c @@ -9,6 +9,7 @@ #include #include #include +#include #define ZYNQ_SILICON_VER_MASK 0xF000 #define ZYNQ_SILICON_VER_SHIFT 12 diff --git a/arch/arm/mach-zynqmp/include/mach/sys_proto.h b/arch/arm/mach-zynqmp/include/mach/sys_proto.h index 573c4ffceed9..658974445417 100644 --- a/arch/arm/mach-zynqmp/include/mach/sys_proto.h +++ b/arch/arm/mach-zynqmp/include/mach/sys_proto.h @@ -10,8 +10,6 @@ #define PAYLOAD_ARG_CNT5 #define ZYNQMP_CSU_SILICON_VER_MASK0xF -#define ZYNQMP_SIP_SVC_PM_SECURE_IMG_LOAD \ - (PM_SIP_SVC + PM_SECURE_IMAGE) #define KEY_PTR_LEN32 #define ZYNQMP_FPGA_BIT_AUTH_DDR 1 @@ -22,29 +20,6 @@ #define ZYNQMP_FPGA_AUTH_DDR 1 -#define ZYNQMP_SIP_SVC_GET_API_VERSION \ - (PM_SIP_SVC + PM_GET_API_VERSION) - -#define ZYNQMP_PM_VERSION_MAJOR1 -#define ZYNQMP_PM_VERSION_MINOR0 -#define ZYNQMP_PM_VERSION_MAJOR_SHIFT 16 -#define ZYNQMP_PM_VERSION_MINOR_MASK 0x - -#define ZYNQMP_PM_VERSION \ - ((ZYNQMP_PM_VERSION_MAJOR << ZYNQMP_PM_VERSION_MAJOR_SHIFT) | \ -ZYNQMP_PM_VERSION_MINOR) - -#define ZYNQMP_PM_VERSION_INVALID ~0 - -#define PMUFW_V1_0 ((1 << ZYNQMP_PM_VERSION_MAJOR_SHIFT) | 0) - -#define PM_SIP_SVC 0xc200 - -enum pm_api_id { - PM_GET_API_VERSION = 1, - PM_SECURE_IMAGE = 45, -}; - enum { IDCODE, VERSION, diff --git a/board/xilinx/zynqmp/cmds.c b/board/xilinx/zynqmp/cmds.c index ed7ba58c6475..f53a1b63bea6 100644 --- a/board/xilinx/zynqmp/cmds.c +++ b/board/xilinx/zynqmp/cmds.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c index 6524badf299c..d9186f463f20 100644 --- a/board/xilinx/zynqmp/zynqmp.c +++ b/board/xilinx/zynqmp/zynqmp.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include diff --git a/drivers/firmware/firmware-zynqmp.c b/drivers/firmware/firmware-zynqmp.c index 957de9ecae4c..e62db2a5138d 100644 --- a/drivers/firmware/firmware-zynqmp.c +++ b/drivers/firmware/firmware-zynqmp.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #define PMUFW_PAYLOAD_ARG_CNT 8 diff --git a/drivers/fpga/zynqmppl.c b/drivers/fpga/zynqmppl.c index f6d9d50ef15f..6168626aeef3 100644 --- a/drivers/fpga/zynqmppl.c +++ b/drivers/fpga/zynqmppl.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include diff --git a/include/zynqmp_firmware.h b/include/zynqmp_firmware.h new file mode 100644 index ..30bf870b02da --- /dev/null +++ b/include/zynqmp_firmware.h @@ -0,0 +1,38 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Xilinx Zynq MPSoC Firmware driver + * + * Copyright (C) 2018-2019 Xilinx, Inc. + */ + +#ifndef _ZYNQMP_FIRMWARE_H_ +#define _ZYNQMP_FIRMWARE_H_ + +enum pm_api_id { + PM_GET_API_VERSION = 1, + PM_SET_CONFIGURATION, + PM_SECURE_IMAGE = 45, +}; + +#define PM_SIP_SVC 0xc200 +#define ZYNQMP_SIP_SVC_GET_API_VERSION \ + (PM_SIP_SVC + PM_GET_API_VERSION) +#define ZYNQMP_SIP_SVC_PM_SECURE_IMG_LOAD \ + (PM_SIP_SVC + PM_SECURE_IMAGE) + +#define ZYNQMP_PM_VERSION_MAJOR 1 +#define ZYNQMP_PM_VERSION_MINOR 0 +#define ZYNQMP_PM_VERSION_MAJOR_SHIFT 16 +#define ZYNQMP_PM_VERSION_MINOR_MASK0x + +#define ZYNQMP_PM_VERSION \ + ((ZYNQMP_PM_VERSION_MAJOR << ZYNQMP_PM_VERSION_MAJOR_SHIFT) | \ +
[U-Boot] [PATCH v2 04/13] firmware: zynqmp: Add zynqmp-power support
From: Ibai Erkiaga zynqmp-power driver for ZynqMP to handle the communication with the PMU firmware. Firmware driver just probes subnodes and power driver handles communication with PMU using the IPI mailbox driver. Signed-off-by: Ibai Erkiaga Signed-off-by: Michal Simek --- Changes in v2: - Check error separately - Reported by Luca drivers/firmware/Kconfig | 2 ++ drivers/firmware/firmware-zynqmp.c | 44 ++ 2 files changed, 46 insertions(+) diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig index b70a2063551c..9596ec16c7f7 100644 --- a/drivers/firmware/Kconfig +++ b/drivers/firmware/Kconfig @@ -30,6 +30,8 @@ config TI_SCI_PROTOCOL config ZYNQMP_FIRMWARE bool "ZynqMP Firmware interface" select FIRMWARE + select ZYNQMP_IPI + select DM_MAILBOX help Firmware interface driver is used by different drivers to communicate with the firmware for diff --git a/drivers/firmware/firmware-zynqmp.c b/drivers/firmware/firmware-zynqmp.c index 6644a7166ca0..97ac333296ec 100644 --- a/drivers/firmware/firmware-zynqmp.c +++ b/drivers/firmware/firmware-zynqmp.c @@ -1,6 +1,50 @@ // SPDX-License-Identifier: GPL-2.0 +/* + * Xilinx Zynq MPSoC Firmware driver + * + * Copyright (C) 2018-2019 Xilinx, Inc. + */ +#include #include +#include +#include + +struct zynqmp_power { + struct mbox_chan tx_chan; + struct mbox_chan rx_chan; +} zynqmp_power; + +static int zynqmp_power_probe(struct udevice *dev) +{ + int ret = 0; + + debug("%s, (dev=%p)\n", __func__, dev); + + ret = mbox_get_by_name(dev, "tx", _power.tx_chan); + if (ret) { + debug("%s, cannot tx mailbox\n", __func__); + return ret; + } + + ret = mbox_get_by_name(dev, "rx", _power.rx_chan); + if (ret) + debug("%s, cannot rx mailbox\n", __func__); + + return ret; +}; + +static const struct udevice_id zynqmp_power_ids[] = { + { .compatible = "xlnx,zynqmp-power" }, + { } +}; + +U_BOOT_DRIVER(zynqmp_power) = { + .name = "zynqmp_power", + .id = UCLASS_FIRMWARE, + .of_match = zynqmp_power_ids, + .probe = zynqmp_power_probe, +}; static const struct udevice_id zynqmp_firmware_ids[] = { { .compatible = "xlnx,zynqmp-firmware" }, -- 2.17.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 02/13] mailbox: allow subnode for mbox regs
From: Ibai Erkiaga The following patch allows the mailbox node in DT to host subnodes with mailbox definitions. If the client phandle to the mailbox is not the mailbox driver node, just checks parents as well. Signed-off-by: Ibai Erkiaga Signed-off-by: Michal Simek --- Changes in v2: None drivers/mailbox/mailbox-uclass.c | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/mailbox/mailbox-uclass.c b/drivers/mailbox/mailbox-uclass.c index 809f26b20258..9fdb6279e4f3 100644 --- a/drivers/mailbox/mailbox-uclass.c +++ b/drivers/mailbox/mailbox-uclass.c @@ -49,7 +49,16 @@ int mbox_get_by_index(struct udevice *dev, int index, struct mbox_chan *chan) if (ret) { debug("%s: uclass_get_device_by_of_offset failed: %d\n", __func__, ret); - return ret; + + /* Test with parent node */ + ret = uclass_get_device_by_ofnode(UCLASS_MAILBOX, + ofnode_get_parent(args.node), + _mbox); + if (ret) { + debug("%s: mbox node from parent failed: %d\n", + __func__, ret); + return ret; + }; } ops = mbox_dev_ops(dev_mbox); -- 2.17.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 03/13] mailbox: zynqmp: ipi mailbox driver
From: Ibai Erkiaga ZynqMP mailbox driver implementing IPI communication with PMU. This would allow U-Boot SPL to communicate with PMUFW to request privileged operations. Signed-off-by: Ibai Erkiaga Signed-off-by: Michal Simek --- Changes in v2: None MAINTAINERS | 1 + arch/arm/mach-zynqmp/include/mach/sys_proto.h | 5 + drivers/mailbox/Kconfig | 6 + drivers/mailbox/Makefile | 1 + drivers/mailbox/zynqmp-ipi.c | 134 ++ 5 files changed, 147 insertions(+) create mode 100644 drivers/mailbox/zynqmp-ipi.c diff --git a/MAINTAINERS b/MAINTAINERS index f448c5f19e00..f5feb89ac3e9 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -448,6 +448,7 @@ F: drivers/gpio/zynq_gpio.c F: drivers/i2c/i2c-cdns.c F: drivers/i2c/muxes/pca954x.c F: drivers/i2c/zynq_i2c.c +F: drivers/mailbox/zynqmp-ipi.c F: drivers/mmc/zynq_sdhci.c F: drivers/mtd/nand/raw/zynq_nand.c F: drivers/net/phy/xilinx_phy.c diff --git a/arch/arm/mach-zynqmp/include/mach/sys_proto.h b/arch/arm/mach-zynqmp/include/mach/sys_proto.h index 915badc6fbee..f25d414dcb1e 100644 --- a/arch/arm/mach-zynqmp/include/mach/sys_proto.h +++ b/arch/arm/mach-zynqmp/include/mach/sys_proto.h @@ -54,6 +54,11 @@ enum { TCM_SPLIT, }; +struct zynqmp_ipi_msg { + size_t len; + u32 *buf; +}; + int zynq_board_read_rom_ethaddr(unsigned char *ethaddr); unsigned int zynqmp_get_silicon_version(void); diff --git a/drivers/mailbox/Kconfig b/drivers/mailbox/Kconfig index 11bf5522db53..85c2a829aed8 100644 --- a/drivers/mailbox/Kconfig +++ b/drivers/mailbox/Kconfig @@ -41,4 +41,10 @@ config K3_SEC_PROXY Select this driver if your platform has support for this hardware block. +config ZYNQMP_IPI + bool "Xilinx ZynqMP IPI controller support" + depends on DM_MAILBOX && ARCH_ZYNQMP + help + This enables support for the Xilinx ZynqMP Inter Processor Interrupt + communication controller. endmenu diff --git a/drivers/mailbox/Makefile b/drivers/mailbox/Makefile index a753cc4e6806..d2ace8cd212e 100644 --- a/drivers/mailbox/Makefile +++ b/drivers/mailbox/Makefile @@ -9,3 +9,4 @@ obj-$(CONFIG_SANDBOX_MBOX) += sandbox-mbox-test.o obj-$(CONFIG_STM32_IPCC) += stm32-ipcc.o obj-$(CONFIG_TEGRA_HSP) += tegra-hsp.o obj-$(CONFIG_K3_SEC_PROXY) += k3-sec-proxy.o +obj-$(CONFIG_ZYNQMP_IPI) += zynqmp-ipi.o diff --git a/drivers/mailbox/zynqmp-ipi.c b/drivers/mailbox/zynqmp-ipi.c new file mode 100644 index ..c181a7b81768 --- /dev/null +++ b/drivers/mailbox/zynqmp-ipi.c @@ -0,0 +1,134 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Xilinx Zynq MPSoC Mailbox driver + * + * Copyright (C) 2018-2019 Xilinx, Inc. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +/* IPI bitmasks, register base */ +/* TODO: move reg base to DT */ +#define IPI_BIT_MASK_PMU0 0x1 +#define IPI_INT_REG_BASE_APU 0xFF30 + +struct ipi_int_regs { + u32 trig; /* 0x0 */ + u32 obs; /* 0x4 */ + u32 ist; /* 0x8 */ + u32 imr; /* 0xC */ + u32 ier; /* 0x10 */ + u32 idr; /* 0x14 */ +}; + +#define ipi_int_apu ((struct ipi_int_regs *)IPI_INT_REG_BASE_APU) + +struct zynqmp_ipi { + void __iomem *local_req_regs; + void __iomem *local_res_regs; + void __iomem *remote_req_regs; + void __iomem *remote_res_regs; +}; + +static int zynqmp_ipi_send(struct mbox_chan *chan, const void *data) +{ + const struct zynqmp_ipi_msg *msg = (struct zynqmp_ipi_msg *)data; + struct zynqmp_ipi *zynqmp = dev_get_priv(chan->dev); + u32 ret; + u32 *mbx = (u32 *)zynqmp->local_req_regs; + + for (size_t i = 0; i < msg->len; i++) + writel(msg->buf[i], [i]); + + /* Write trigger interrupt */ + writel(IPI_BIT_MASK_PMU0, _int_apu->trig); + + /* Wait until observation bit is cleared */ + ret = wait_for_bit_le32(_int_apu->obs, IPI_BIT_MASK_PMU0, false, + 100, false); + + debug("%s, send %ld bytes\n", __func__, msg->len); + return ret; +}; + +static int zynqmp_ipi_recv(struct mbox_chan *chan, void *data) +{ + struct zynqmp_ipi_msg *msg = (struct zynqmp_ipi_msg *)data; + struct zynqmp_ipi *zynqmp = dev_get_priv(chan->dev); + u32 *mbx = (u32 *)zynqmp->local_res_regs; + + for (size_t i = 0; i < msg->len; i++) + msg->buf[i] = readl([i]); + + debug("%s, recv %ld bytes\n", __func__, msg->len); + return 0; +}; + +static int zynqmp_ipi_probe(struct udevice *dev) +{ + struct zynqmp_ipi *zynqmp = dev_get_priv(dev); + struct resource res; + ofnode node; + + debug("%s(dev=%p)\n", __func__, dev); + + /* Get subnode where the regs are defined */ + /* Note IPI mailbox node needs to be the first one in DT */ + node =
[U-Boot] [PATCH v2 00/13] arm64: zynqmp: Clean communication with PMUFW
Hi, This patch series using ZynqMP firmware driver to provide a interface to communicate with the PMU Firmware. As part of the series a mailbox driver is also implemented to handle communication through ipi interface. There are two new wiring: 1. Reading PMUFW version via firmware driver - mailbox driver in case of SPL - SMC in case of full U-Boot 2. Using the same patch for loading PMUFW configuration object The whole series is based on several patches I have sent already that's why I am providing a branch which also contains this series. https://gitlab.denx.de/u-boot/custodians/u-boot-microblaze/tree/next Thanks, Michal Changes in v2: - Check error separately - Reported by Luca - Align ret handling - Also handle error from mbox_recv/mbox_send - Move pm_api_id higher - Reported by Luca - Fix macros for header protection - pass rex_maxlen to ipi_req - reported by Luca Ibai Erkiaga (10): mailbox: check ops prior calling mailbox: allow subnode for mbox regs mailbox: zynqmp: ipi mailbox driver firmware: zynqmp: Add zynqmp-power support arm64: zynqmp: add firmware and mailbox node to DT firmware: zynqmp: get fw version with mailbox driver firmware: zynqmp: create firmware header arm64: zynqmp: use firmware driver to get version arm64: zynqmp: remove old fw version function arm64: zynqmp: probe firmware driver Michal Simek (3): arm64: zynqmp: Cleanup PM SMC macro composition firmware: zynqmp: Separate function for sending message via mailbox arm64: zynqmp: Use mailbox driver for PMUFW config loading MAINTAINERS | 2 + arch/arm/Kconfig | 3 + arch/arm/dts/zynqmp.dtsi | 44 +- arch/arm/mach-zynqmp/Makefile | 4 - arch/arm/mach-zynqmp/cpu.c| 24 +-- arch/arm/mach-zynqmp/include/mach/sys_proto.h | 24 +-- arch/arm/mach-zynqmp/pmu_ipc.c| 112 -- board/xilinx/zynqmp/cmds.c| 1 + board/xilinx/zynqmp/zynqmp.c | 19 +-- drivers/firmware/Kconfig | 2 + drivers/firmware/firmware-zynqmp.c| 142 ++ drivers/fpga/zynqmppl.c | 5 +- drivers/mailbox/Kconfig | 6 + drivers/mailbox/Makefile | 1 + drivers/mailbox/mailbox-uclass.c | 19 ++- drivers/mailbox/zynqmp-ipi.c | 134 + include/zynqmp_firmware.h | 37 + 17 files changed, 399 insertions(+), 180 deletions(-) delete mode 100644 arch/arm/mach-zynqmp/pmu_ipc.c create mode 100644 drivers/mailbox/zynqmp-ipi.c create mode 100644 include/zynqmp_firmware.h -- 2.17.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 01/13] mailbox: check ops prior calling
From: Ibai Erkiaga Check if request and free operations are present prior calling to the functions. Signed-off-by: Ibai Erkiaga Signed-off-by: Michal Simek --- Changes in v2: None drivers/mailbox/mailbox-uclass.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/mailbox/mailbox-uclass.c b/drivers/mailbox/mailbox-uclass.c index 1b4a5863c9e5..809f26b20258 100644 --- a/drivers/mailbox/mailbox-uclass.c +++ b/drivers/mailbox/mailbox-uclass.c @@ -63,7 +63,8 @@ int mbox_get_by_index(struct udevice *dev, int index, struct mbox_chan *chan) return ret; } - ret = ops->request(chan); + if (ops->request) + ret = ops->request(chan); if (ret) { debug("ops->request() failed: %d\n", ret); return ret; @@ -94,7 +95,10 @@ int mbox_free(struct mbox_chan *chan) debug("%s(chan=%p)\n", __func__, chan); - return ops->free(chan); + if (ops->free) + return ops->free(chan); + + return 0; } int mbox_send(struct mbox_chan *chan, const void *data) -- 2.17.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [U-BOOT PATCH v2 1/2] gpio: sifive: add support for DM based gpio driver for FU540-SoC
On Wed, Oct 2, 2019 at 1:01 AM Sagar Shrikant Kadam wrote: > > This patch adds a DM based driver model for gpio controller present in > FU540-C000 SoC on HiFive Unleashed A00 board. This SoC has one GPIO > bank and 16 GPIO lines in total, out of which GPIO0 to GPIO9 and > GPIO15 are routed to the J1 header on the board. > > This implementation is ported from linux based gpio driver submitted > for review by Wesley W. Terpstra and/or Atish Patra > (many thanks !!). The linux driver can be referred > here [1] > > [1]: https://lkml.org/lkml/2018/10/9/1103 > > Signed-off-by: Sagar Shrikant Kadam > --- > arch/riscv/include/asm/arch-generic/gpio.h | 35 ++ > arch/riscv/include/asm/gpio.h | 6 + > drivers/gpio/Kconfig | 7 ++ > drivers/gpio/Makefile | 1 + > drivers/gpio/sifive-gpio.c | 177 > + > 5 files changed, 226 insertions(+) > create mode 100644 arch/riscv/include/asm/arch-generic/gpio.h > create mode 100644 arch/riscv/include/asm/gpio.h > create mode 100644 drivers/gpio/sifive-gpio.c > > diff --git a/arch/riscv/include/asm/arch-generic/gpio.h > b/arch/riscv/include/asm/arch-generic/gpio.h > new file mode 100644 > index 000..dfcb753 > --- /dev/null > +++ b/arch/riscv/include/asm/arch-generic/gpio.h > @@ -0,0 +1,35 @@ > +/* SPDX-License-Identifier: GPL-2.0+ */ > +/* > + * Copyright (C) 2019 SiFive, Inc. > + */ > + > +#ifndef _GPIO_SIFIVE_H > +#define _GPIO_SIFIVE_H > + > +#define GPIO_INPUT_VAL 0x00 > +#define GPIO_INPUT_EN 0x04 > +#define GPIO_OUTPUT_EN 0x08 > +#define GPIO_OUTPUT_VAL0x0C > +#define GPIO_RISE_IE 0x18 > +#define GPIO_RISE_IP 0x1C > +#define GPIO_FALL_IE 0x20 > +#define GPIO_FALL_IP 0x24 > +#define GPIO_HIGH_IE 0x28 > +#define GPIO_HIGH_IP 0x2C > +#define GPIO_LOW_IE0x30 > +#define GPIO_LOW_IP0x34 > +#define GPIO_OUTPUT_XOR0x40 > + > +#define NR_GPIOS 16 > + > +enum gpio_state { > + LOW, > + HIGH > +}; > + > +/* Details about a GPIO bank */ > +struct sifive_gpio_platdata { > + void *base; /* address of registers in physical memory */ > +}; > + > +#endif /* _GPIO_SIFIVE_H */ > diff --git a/arch/riscv/include/asm/gpio.h b/arch/riscv/include/asm/gpio.h > new file mode 100644 > index 000..008d756 > --- /dev/null > +++ b/arch/riscv/include/asm/gpio.h > @@ -0,0 +1,6 @@ > +/* SPDX-License-Identifier: GPL-2.0+ */ > +/* > + * Copyright 2018 SiFive, Inc. > + */ > + > +#include > diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig > index f2dabb5..39f2c7e 100644 > --- a/drivers/gpio/Kconfig > +++ b/drivers/gpio/Kconfig > @@ -285,6 +285,13 @@ config STM32_GPIO > usable on many stm32 families like stm32f4/f7/h7 and stm32mp1. > Tested on STM32F7. > > +config SIFIVE_GPIO > + bool "SiFive GPIO driver" > + depends on DM_GPIO > + help > + Device model driver for GPIO controller present in SiFive FU540 > SoC. This > + driver enables GPIO interface on HiFive Unleashed A00 board. > + > config MVEBU_GPIO > bool "Marvell MVEBU GPIO driver" > depends on DM_GPIO && ARCH_MVEBU > diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile > index 4a8aa0f..ccc49e2 100644 > --- a/drivers/gpio/Makefile > +++ b/drivers/gpio/Makefile > @@ -61,3 +61,4 @@ obj-$(CONFIG_$(SPL_)PCF8575_GPIO) += pcf8575_gpio.o > obj-$(CONFIG_PM8916_GPIO) += pm8916_gpio.o > obj-$(CONFIG_MT7621_GPIO) += mt7621_gpio.o > obj-$(CONFIG_MSCC_SGPIO) += mscc_sgpio.o > +obj-$(CONFIG_SIFIVE_GPIO) += sifive-gpio.o > diff --git a/drivers/gpio/sifive-gpio.c b/drivers/gpio/sifive-gpio.c > new file mode 100644 > index 000..76d5a1d3 > --- /dev/null > +++ b/drivers/gpio/sifive-gpio.c > @@ -0,0 +1,177 @@ > +// SPDX-License-Identifier: GPL-2.0+ > +/* > + * SiFive GPIO driver > + * > + * Copyright (C) 2019 SiFive, Inc. > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > + > +static int sifive_gpio_probe(struct udevice *dev) > +{ > + struct sifive_gpio_platdata *plat = dev_get_platdata(dev); > + struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev); > + char name[18], *str; > + > + sprintf(name, "gpio@%4lx_", (uintptr_t)plat->base); > + str = strdup(name); > + if (!str) > + return -ENOMEM; > + uc_priv->bank_name = str; > + > + /* > +* Use the gpio count mentioned in device tree, > +* if not specified in dt, set NR_GPIOS as default > +*/ > + uc_priv->gpio_count = dev_read_u32_default(dev, "ngpios", NR_GPIOS); > + > + return 0; > +} > + > +static void sifive_update_gpio_reg(void *bptr, u32 offset, bool value) > +{ > + void __iomem *ptr = (void __iomem *)bptr; > + > + u32 bit = BIT(offset); > + u32 old = readl(ptr); > + > + if (value) > + writel(old | bit, ptr); > + else > +
[U-Boot] [PATCH v1 4/4] test: Add tests for the multiplexer framework
Provide tests to check the behavior of the multiplexer framework. The test uses a mmio-based multiplexer. Signed-off-by: Jean-Jacques Hiblot --- arch/sandbox/dts/test.dts | 26 +++ configs/sandbox_defconfig | 2 + test/dm/Makefile | 1 + test/dm/mux-mmio.c| 143 ++ 4 files changed, 172 insertions(+) create mode 100644 test/dm/mux-mmio.c diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts index 044895586a..a502dc8bd7 100644 --- a/arch/sandbox/dts/test.dts +++ b/arch/sandbox/dts/test.dts @@ -1,3 +1,5 @@ +#include + /dts-v1/; / { @@ -89,6 +91,11 @@ <_b 9 0xc 3 2 1>; int-value = <1234>; uint-value = <(-1234)>; + + mux-controls = < 0>, < 1>, + < 2>, < 3>; + mux-control-names = "mux0", "mux1", "mux2", "mux3"; + mux-syscon = <>; }; junk { @@ -125,6 +132,9 @@ compatible = "denx,u-boot-fdt-test"; ping-expect = <3>; ping-add = <3>; + + mux-controls = < 0>; + mux-control-names = "mux0"; }; phy_provider0: gen_phy@0 { @@ -640,6 +650,22 @@ 0x58 8>; }; + syscon3: syscon@3 { + compatible = "simple-mfd", "syscon"; + reg = <0x000100 0x10>; + + muxcontroller0: a-mux-controller { + compatible = "mmio-mux"; + #mux-control-cells = <1>; + + mux-reg-masks = <0x0 0x30>, /* 0: reg 0x0, bits 5:4 */ + <0x3 0x1E>, /* 1: reg 0x3, bits 4:1 */ + <0x1 0xFF>; /* 2: reg 0x1, bits 7:0 */ + idle-states = , <0x02>, <0x73>; + u-boot,mux-autoprobe; + }; + }; + timer { compatible = "sandbox,timer"; clock-frequency = <100>; diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig index f77b9e8a7d..aa5d89dfc2 100644 --- a/configs/sandbox_defconfig +++ b/configs/sandbox_defconfig @@ -143,6 +143,8 @@ CONFIG_SPI_FLASH_SPANSION=y CONFIG_SPI_FLASH_STMICRO=y CONFIG_SPI_FLASH_SST=y CONFIG_SPI_FLASH_WINBOND=y +CONFIG_MULTIPLEXER=y +CONFIG_MUX_MMIO=y CONFIG_DM_ETH=y CONFIG_NVME=y CONFIG_PCI=y diff --git a/test/dm/Makefile b/test/dm/Makefile index 55a7940053..5fedcb8a7a 100644 --- a/test/dm/Makefile +++ b/test/dm/Makefile @@ -46,6 +46,7 @@ obj-$(CONFIG_DM_SPI_FLASH) += sf.o obj-$(CONFIG_SMEM) += smem.o obj-$(CONFIG_DM_SPI) += spi.o obj-y += syscon.o +obj-$(CONFIG_MUX_MMIO) += mux-mmio.o obj-$(CONFIG_DM_USB) += usb.o obj-$(CONFIG_DM_PMIC) += pmic.o obj-$(CONFIG_DM_REGULATOR) += regulator.o diff --git a/test/dm/mux-mmio.c b/test/dm/mux-mmio.c new file mode 100644 index 00..8a19281614 --- /dev/null +++ b/test/dm/mux-mmio.c @@ -0,0 +1,143 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2017-2018 Texas Instruments Incorporated - http://www.ti.com/ + * Jean-Jacques Hiblot + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* Test that mmio mux work correctly */ +static int dm_test_mux_mmio(struct unit_test_state *uts) +{ + struct udevice *dev, *dev_b; + struct regmap *map; + struct mux_control *ctl0_a, *ctl0_b; + struct mux_control *ctl1; + struct mux_control *ctl_err; + u32 val; + int i; + + ut_assertok(uclass_get_device(UCLASS_TEST_FDT, 0, )); + ut_assertok(uclass_get_device(UCLASS_TEST_FDT, 1, _b)); + ut_asserteq_str("a-test", dev->name); + ut_asserteq_str("b-test", dev_b->name); + map = syscon_regmap_lookup_by_phandle(dev, "mux-syscon"); + ut_assert(!IS_ERR(map)); + ut_assert(map); + + /* check default states */ + ut_assertok(regmap_read(map, 3, )); + ut_asserteq(0x02, (val & 0x1E) >> 1); + ut_assertok(regmap_read(map, 1, )); + ut_asserteq(0x73, (val & 0xFF) >> 0); + + ut_assertok(mux_control_get(dev, "mux0", _a)); + ut_assertok(mux_control_get(dev, "mux1", )); + ut_asserteq(-ERANGE, mux_control_get(dev, "mux3", _err)); + ut_asserteq(-ENODATA, mux_control_get(dev, "dummy", _err)); + ut_assertok(mux_control_get(dev_b, "mux0", _b)); + + for (i = 0; i < mux_control_states(ctl0_a); i++) { + /* select a new state and verify the value in the regmap */ + ut_assertok(mux_control_select(ctl0_a, i)); + ut_assertok(regmap_read(map, 0, )); + ut_asserteq(i, (val & 0x30) >> 4); + /* +* deselect the mux and verify that the value in the regmap +* reflects the idle state (fixed to MUX_IDLE_AS_IS) +*/ +
[U-Boot] [PATCH v1 1/4] drivers: Add a new framework for multiplexer devices
Add a new subsystem that handles multiplexer controllers. The API is the same as in Linux. Signed-off-by: Jean-Jacques Hiblot --- drivers/Kconfig | 2 + drivers/Makefile | 1 + drivers/mux/Kconfig | 7 + drivers/mux/Makefile | 6 + drivers/mux/mux-uclass.c | 296 ++ include/dm/uclass-id.h| 1 + include/dt-bindings/mux/mux.h | 17 ++ include/mux-internal.h| 80 + include/mux.h | 114 + 9 files changed, 524 insertions(+) create mode 100644 drivers/mux/Kconfig create mode 100644 drivers/mux/Makefile create mode 100644 drivers/mux/mux-uclass.c create mode 100644 include/dt-bindings/mux/mux.h create mode 100644 include/mux-internal.h create mode 100644 include/mux.h diff --git a/drivers/Kconfig b/drivers/Kconfig index 350acf81f3..5334974ad4 100644 --- a/drivers/Kconfig +++ b/drivers/Kconfig @@ -60,6 +60,8 @@ source "drivers/mmc/Kconfig" source "drivers/mtd/Kconfig" +source "drivers/mux/Kconfig" + source "drivers/net/Kconfig" source "drivers/nvme/Kconfig" diff --git a/drivers/Makefile b/drivers/Makefile index a4bb5e4975..f4d71f3b3c 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -12,6 +12,7 @@ obj-$(CONFIG_$(SPL_TPL_)INPUT) += input/ obj-$(CONFIG_$(SPL_TPL_)LED) += led/ obj-$(CONFIG_$(SPL_TPL_)MMC_SUPPORT) += mmc/ obj-$(CONFIG_$(SPL_TPL_)NAND_SUPPORT) += mtd/nand/raw/ +obj-$(CONFIG_$(SPl_)MULTIPLEXER) += mux/ obj-$(CONFIG_$(SPL_TPL_)PCH_SUPPORT) += pch/ obj-$(CONFIG_$(SPL_TPL_)PCI) += pci/ obj-$(CONFIG_$(SPL_TPL_)PHY) += phy/ diff --git a/drivers/mux/Kconfig b/drivers/mux/Kconfig new file mode 100644 index 00..ad0199c058 --- /dev/null +++ b/drivers/mux/Kconfig @@ -0,0 +1,7 @@ +menu "Multiplexer drivers" + +config MULTIPLEXER + bool "Multiplexer Support" + depends on DM + +endmenu diff --git a/drivers/mux/Makefile b/drivers/mux/Makefile new file mode 100644 index 00..351e4363d3 --- /dev/null +++ b/drivers/mux/Makefile @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# (C) Copyright 2019 +# Jean-Jacques Hiblot + +obj-$(CONFIG_$(SPL_)MULTIPLEXER) += mux-uclass.o diff --git a/drivers/mux/mux-uclass.c b/drivers/mux/mux-uclass.c new file mode 100644 index 00..58998af29c --- /dev/null +++ b/drivers/mux/mux-uclass.c @@ -0,0 +1,296 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Multiplexer subsystem + * + * Based on the linux multiplexer framework + * + * Copyright (C) 2017 Axentia Technologies AB + * Author: Peter Rosin + * + * Copyright (C) 2017-2018 Texas Instruments Incorporated - http://www.ti.com/ + * Jean-Jacques Hiblot + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * The idle-as-is "state" is not an actual state that may be selected, it + * only implies that the state should not be changed. So, use that state + * as indication that the cached state of the multiplexer is unknown. + */ +#define MUX_CACHE_UNKNOWN MUX_IDLE_AS_IS + +static inline const struct mux_control_ops *mux_dev_ops(struct udevice *dev) +{ + return (const struct mux_control_ops *)dev->driver->ops; +} + +static int mux_control_set(struct mux_control *mux, int state) +{ + int ret = mux_dev_ops(mux->dev)->set(mux, state); + + mux->cached_state = ret < 0 ? MUX_CACHE_UNKNOWN : state; + + return ret; +} + +unsigned int mux_control_states(struct mux_control *mux) +{ + return mux->states; +} + +static int __mux_control_select(struct mux_control *mux, int state) +{ + int ret; + + if (WARN_ON(state < 0 || state >= mux->states)) + return -EINVAL; + + if (mux->cached_state == state) + return 0; + + ret = mux_control_set(mux, state); + if (ret >= 0) + return 0; + + /* The mux update failed, try to revert if appropriate... */ + if (mux->idle_state != MUX_IDLE_AS_IS) + mux_control_set(mux, mux->idle_state); + + return ret; +} + +int mux_control_select(struct mux_control *mux, unsigned int state) +{ + int ret; + + if (mux->in_use) + return -EBUSY; + + ret = __mux_control_select(mux, state); + + if (ret < 0) + return ret; + + mux->in_use = true; + + return 0; +} + +int mux_control_deselect(struct mux_control *mux) +{ + int ret = 0; + + if (mux->idle_state != MUX_IDLE_AS_IS && + mux->idle_state != mux->cached_state) + ret = mux_control_set(mux, mux->idle_state); + + mux->in_use = false; + + return ret; +} + +static int mux_of_xlate_default(struct mux_chip *mux_chip, + struct ofnode_phandle_args *args, + struct mux_control **muxp) +{ + struct mux_control *mux; + int id; + + debug("%s(mux=%p)\n", __func__, mux); + + if (args->args_count > 1) { +
[U-Boot] [PATCH v1 2/4] dm: board: complete the initialization of the muxes in initr_dm()
This will probe the multiplexer devices that have a "u-boot,mux-autoprobe" property. As a consequence they will be put in their idle state. Signed-off-by: Jean-Jacques Hiblot --- common/board_r.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/common/board_r.c b/common/board_r.c index d6fb5047a2..92a4e2c150 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -32,6 +32,7 @@ #include #endif #include +#include #include #include #include @@ -310,6 +311,7 @@ static int initr_dm(void) if (ret) return ret; #endif + dm_mux_init(); return 0; } -- 2.17.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v1 0/4] drivers: Add a framework for MUX drivers
Add a new minimalistic subsystem that handles multiplexer controllers. It provides the same API as Linux and mux drivers should be portable with a minimum effort. This series also includes a port of the Linux's mmio-mux driver. This series relies on 2 other series [1] and [2] posted earlier. [1] : https://patchwork.ozlabs.org/project/uboot/list/?series=132923 [2] : https://patchwork.ozlabs.org/project/uboot/list/?series=133713 Jean-Jacques Hiblot (4): drivers: Add a new framework for multiplexer devices dm: board: complete the initialization of the muxes in initr_dm() drivers: mux: mmio-based syscon mux controller test: Add tests for the multiplexer framework arch/sandbox/dts/test.dts | 26 +++ common/board_r.c | 2 + configs/sandbox_defconfig | 2 + drivers/Kconfig | 2 + drivers/Makefile | 1 + drivers/mux/Kconfig | 22 +++ drivers/mux/Makefile | 7 + drivers/mux/mmio.c| 155 ++ drivers/mux/mux-uclass.c | 296 ++ include/dm/uclass-id.h| 1 + include/dt-bindings/mux/mux.h | 17 ++ include/mux-internal.h| 80 + include/mux.h | 114 + test/dm/Makefile | 1 + test/dm/mux-mmio.c| 143 15 files changed, 869 insertions(+) create mode 100644 drivers/mux/Kconfig create mode 100644 drivers/mux/Makefile create mode 100644 drivers/mux/mmio.c create mode 100644 drivers/mux/mux-uclass.c create mode 100644 include/dt-bindings/mux/mux.h create mode 100644 include/mux-internal.h create mode 100644 include/mux.h create mode 100644 test/dm/mux-mmio.c -- 2.17.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v1 3/4] drivers: mux: mmio-based syscon mux controller
This adds a driver for mmio-based syscon multiplexers controlled by bitfields in a syscon register range. This is heavily based on the linux mmio-mux driver. Signed-off-by: Jean-Jacques Hiblot --- drivers/mux/Kconfig | 15 + drivers/mux/Makefile | 1 + drivers/mux/mmio.c | 155 +++ 3 files changed, 171 insertions(+) create mode 100644 drivers/mux/mmio.c diff --git a/drivers/mux/Kconfig b/drivers/mux/Kconfig index ad0199c058..bda6a2d9f5 100644 --- a/drivers/mux/Kconfig +++ b/drivers/mux/Kconfig @@ -4,4 +4,19 @@ config MULTIPLEXER bool "Multiplexer Support" depends on DM + +if MULTIPLEXER + +config MUX_MMIO + bool "MMIO register bitfield-controlled Multiplexer" + depends on MULTIPLEXER && SYSCON + help + MMIO register bitfield-controlled Multiplexer controller. + + The driver builds multiplexer controllers for bitfields in a syscon + register. For N bit wide bitfields, there will be 2^N possible + multiplexer states. + +endif + endmenu diff --git a/drivers/mux/Makefile b/drivers/mux/Makefile index 351e4363d3..78ebf04c7a 100644 --- a/drivers/mux/Makefile +++ b/drivers/mux/Makefile @@ -4,3 +4,4 @@ # Jean-Jacques Hiblot obj-$(CONFIG_$(SPL_)MULTIPLEXER) += mux-uclass.o +obj-$(CONFIG_$(SPL_)MUX_MMIO) += mmio.o diff --git a/drivers/mux/mmio.c b/drivers/mux/mmio.c new file mode 100644 index 00..a9faaeb9fd --- /dev/null +++ b/drivers/mux/mmio.c @@ -0,0 +1,155 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * MMIO register bitfield-controlled multiplexer driver + * Based on the linux mmio multiplexer driver + * + * Copyright (C) 2017 Pengutronix, Philipp Zabel + * Copyright (C) 2019 Texas Instrument, Jean-jacques Hiblot + */ +#include +#include +#include +#include +#include +#include +#include +#include + +static int mux_mmio_set(struct mux_control *mux, int state) +{ + struct regmap_field **fields = dev_get_priv(mux->dev); + + return regmap_field_write(fields[mux_control_get_index(mux)], state); +} + +static const struct mux_control_ops mux_mmio_ops = { + .set = mux_mmio_set, +}; + +static const struct udevice_id mmio_mux_of_match[] = { + { .compatible = "mmio-mux" }, + { /* sentinel */ }, +}; + +static int mmio_mux_probe(struct udevice *dev) +{ + struct regmap_field **fields; + struct mux_chip *mux_chip = dev_get_uclass_priv(dev); + struct regmap *regmap; + u32 *mux_reg_masks; + u32 *idle_states; + int num_fields; + int ret; + int i; + + regmap = syscon_node_to_regmap(dev_ofnode(dev->parent)); + if (IS_ERR(regmap)) { + ret = PTR_ERR(regmap); + dev_err(dev, "failed to get regmap: %d\n", ret); + return ret; + } + + num_fields = dev_read_size(dev, "mux-reg-masks"); + if (num_fields < 0) { + dev_err(dev, "mux-reg-masks property missing or invalid: %d\n", + num_fields); + return num_fields; + } + num_fields /= sizeof(u32); + if (num_fields == 0 || num_fields % 2) + ret = -EINVAL; + num_fields = num_fields / 2; + + ret = mux_alloc_controllers(dev, num_fields); + if (ret < 0) { + dev_err(dev, "failed to allocate mux controllers: %d\n", + ret); + return ret; + } + + fields = devm_kmalloc(dev, num_fields * sizeof(*fields), __GFP_ZERO); + if (!fields) + return -ENOMEM; + dev->priv = fields; + + mux_reg_masks = devm_kmalloc(dev, num_fields * 2 * sizeof(u32), +__GFP_ZERO); + if (!mux_reg_masks) + return -ENOMEM; + + ret = dev_read_u32_array(dev, "mux-reg-masks", mux_reg_masks, +num_fields * 2); + if (ret < 0) { + dev_err(dev, "failed to read mux-reg-masks property: %d\n", + ret); + return ret; + } + + idle_states = devm_kmalloc(dev, num_fields * sizeof(u32), __GFP_ZERO); + if (!idle_states) + return -ENOMEM; + + ret = dev_read_u32_array(dev, "idle-states", idle_states, num_fields); + if (ret < 0) { + dev_err(dev, "failed to read idle-states property: %d\n", + ret); + devm_kfree(dev, idle_states); + idle_states = NULL; + } + + for (i = 0; i < num_fields; i++) { + struct mux_control *mux = _chip->mux[i]; + struct reg_field field; + u32 reg, mask; + int bits; + + reg = mux_reg_masks[2 * i]; + mask = mux_reg_masks[2 * i + 1]; + + field.reg = reg; + field.msb = fls(mask) - 1; + field.lsb = ffs(mask) - 1; + + if (mask != GENMASK(field.msb,
[U-Boot] [PATCH] linux_compat: fix potential NULL pointer access
malloc_cache_aligned() might return zero, so fix potential NULL pointer access if __GFP_ZERO flag is set. Signed-off-by: Marek Szyprowski --- lib/linux_compat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/linux_compat.c b/lib/linux_compat.c index 6373b4451e..81ea8fb126 100644 --- a/lib/linux_compat.c +++ b/lib/linux_compat.c @@ -20,7 +20,7 @@ void *kmalloc(size_t size, int flags) void *p; p = malloc_cache_aligned(size); - if (flags & __GFP_ZERO) + if (p && flags & __GFP_ZERO) memset(p, 0, size); return p; -- 2.17.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 000/126] x86: Add initial support for apollolake
Hi Simon, On Wed, Oct 2, 2019 at 10:15 AM Simon Glass wrote: > > Hi Bin, > > On Wed, 25 Sep 2019 at 08:58, Simon Glass wrote: > > > > Apollolake is an Intel SoC generation aimed at relatively low-end embedded > > systems. It was released in 2016 but has become more popular recently with > > some embedded boards using it. > > > > This series adds support for apollolake. As an example it adds an > > implementation of chromebook_coral (a large range of Chromebooks released > > in 2017). > > > > The series provides only enough to boot to a prompt. It does not include > > display, storage, USB, etc. But it does include the major part of the > > plumbing. > > > > Since this is the first time U-Boot has used FSP2 there is quite a bit of > > refactoring needed. Some of this is in previous series, but much of it is > > here. > > > > Some further clean-up is needed with this series and it needs more > > documentation, but it is ready for review. > > > > This series is available at u-boot-dm/coral-working > > Just a note on this series. I sent it out as it was already getting > huge and I don't like sitting on so many patches. > > I have since done a little more work and have more peripherals running > as well as FSP-S. In doing so I've found some clean-ups in the FSP > parts, moving apollolake-specific code out of the fsp/ directory where > it ended up, for example. > > This results in another 20 patches or so :-( > > The first 45 patches in *this* are not specific to x86 so I am > thinking of dealing with them separately. > > So my plan is: > > 1. Get the sandbox/dm patches reviewed and applied > 2. Tidy up the remaining series > 3. Add the new patches > 4. Resend > Sounds like a good plan. I will start reviewing the patches, and apply the patches as many as possible, to save some efforts of resending such a huge patch series. > I am on holiday for a week so will get to this on the 12th or so. Regards, Bin ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] thor: fix error path after g_dnl_register() failure
Set command return value and perform needed cleanup when g_dnl_register() function fails. Signed-off-by: Marek Szyprowski --- cmd/thordown.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/thordown.c b/cmd/thordown.c index dd0544d475..8dae024e31 100644 --- a/cmd/thordown.c +++ b/cmd/thordown.c @@ -40,7 +40,8 @@ int do_thor_down(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) ret = g_dnl_register("usb_dnl_thor"); if (ret) { pr_err("g_dnl_register failed %d\n", ret); - return ret; + ret = CMD_RET_FAILURE; + goto exit; } ret = thor_init(); -- 2.17.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] dwc3: flush cache only if there is a buffer attached to a request
Calling cache flush on invalid buffer, even with zero length might cause an exception on certain platforms. Signed-off-by: Marek Szyprowski --- drivers/usb/dwc3/gadget.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 085f7b8968..67d11b4c0d 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -242,7 +242,8 @@ void dwc3_gadget_giveback(struct dwc3_ep *dep, struct dwc3_request *req, list_del(>list); req->trb = NULL; - dwc3_flush_cache((uintptr_t)req->request.dma, req->request.length); + if (req->request.length) + dwc3_flush_cache((uintptr_t)req->request.dma, req->request.length); if (req->request.status == -EINPROGRESS) req->request.status = status; -- 2.17.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v3 09/10] x86: Move fsp_bootmode.h to the generic fsp directory
On Wed, Sep 25, 2019 at 10:00 PM Simon Glass wrote: > > This header file is the same for FSP v1 and v2, although there may be > some additions to come. Move it into the generic fsp directory. > > Signed-off-by: Simon Glass > Reviewed-by: Bin Meng > --- > > Changes in v3: None > Changes in v2: None > > arch/x86/include/asm/{fsp1 => fsp}/fsp_bootmode.h | 0 > arch/x86/include/asm/fsp1/fsp_support.h | 3 +-- > 2 files changed, 1 insertion(+), 2 deletions(-) > rename arch/x86/include/asm/{fsp1 => fsp}/fsp_bootmode.h (100%) > applied to u-boot-x86/next, thanks! ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v3 07/10] x86: Move fsp_hob.h to the generic fsp directory
On Wed, Oct 2, 2019 at 8:05 AM Bin Meng wrote: > > On Wed, Oct 2, 2019 at 8:00 AM Bin Meng wrote: > > > > On Wed, Sep 25, 2019 at 10:00 PM Simon Glass wrote: > > > > > > This header file is the same for FSP v1 and v2. Move it into the general > > > fsp directory. > > > > > > Signed-off-by: Simon Glass > > > Reviewed-by: Bin Meng > > > --- > > > > > > Changes in v3: None > > > Changes in v2: None > > > > > > arch/x86/include/asm/{fsp1 => fsp}/fsp_hob.h| 0 > > > arch/x86/include/asm/{fsp1 => fsp}/fsp_infoheader.h | 0 > > > arch/x86/include/asm/fsp1/fsp_support.h | 1 + > > > 3 files changed, 1 insertion(+) > > > rename arch/x86/include/asm/{fsp1 => fsp}/fsp_hob.h (100%) > > > rename arch/x86/include/asm/{fsp1 => fsp}/fsp_infoheader.h (100%) > > > > > > diff --git a/arch/x86/include/asm/fsp1/fsp_hob.h > > > b/arch/x86/include/asm/fsp/fsp_hob.h > > > similarity index 100% > > > rename from arch/x86/include/asm/fsp1/fsp_hob.h > > > rename to arch/x86/include/asm/fsp/fsp_hob.h > > > diff --git a/arch/x86/include/asm/fsp1/fsp_infoheader.h > > > b/arch/x86/include/asm/fsp/fsp_infoheader.h > > > similarity index 100% > > > rename from arch/x86/include/asm/fsp1/fsp_infoheader.h > > > rename to arch/x86/include/asm/fsp/fsp_infoheader.h > > The rename of fsp_infoheader.h should be in the next patch, to keep > the bisectability. > > I will fix it when applying. > > > > diff --git a/arch/x86/include/asm/fsp1/fsp_support.h > > > b/arch/x86/include/asm/fsp1/fsp_support.h > > > index de3b1936be8..2f1c5fbb546 100644 > > > --- a/arch/x86/include/asm/fsp1/fsp_support.h > > > +++ b/arch/x86/include/asm/fsp1/fsp_support.h > > > @@ -8,6 +8,7 @@ > > > #define __FSP_SUPPORT_H__ > > > > > > #include > > > +#include > > > #include > > > #include "fsp_hob.h" > > > > This line should be dropped. I will fix it when applying. > > Fixed all the issues, and applied to u-boot-x86/next, thanks! ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v3 10/10] x86: Move fsp_ffs.h include to fsp_arch.h
On Wed, Sep 25, 2019 at 10:00 PM Simon Glass wrote: > > This include file is only used for FSP v1. Avoid including it from > fdt_support.h so we can use the latter with FSP v2. > > Signed-off-by: Simon Glass > Reviewed-by: Bin Meng > --- > > Changes in v3: None > Changes in v2: None > > arch/x86/include/asm/fsp_arch.h | 1 + > 1 file changed, 1 insertion(+) > applied to u-boot-x86/next, thanks! ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v3 08/10] x86: Move fsp_infoheader.h to the generic fsp directory
On Wed, Sep 25, 2019 at 10:00 PM Simon Glass wrote: > > This header file is the same for FSP v1 and v2. Move it into the general > fsp directory. > > Signed-off-by: Simon Glass > Reviewed-by: Bin Meng > --- > > Changes in v3: None > Changes in v2: None > > arch/x86/include/asm/fsp1/fsp_support.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > applied to u-boot-x86/next, thanks! ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v3 02/10] x86: Move fsp_azalia.h to the generic fsp directory
On Wed, Oct 2, 2019 at 6:55 AM Bin Meng wrote: > > Hi Simon, > > On Wed, Oct 2, 2019 at 1:39 AM Simon Glass wrote: > > > > Hi Bin, > > > > On Tue, 1 Oct 2019 at 04:59, Bin Meng wrote: > > > > > > Hi Simon, > > > > > > On Wed, Sep 25, 2019 at 10:00 PM Simon Glass wrote: > > > > > > > > This header file is the same for FSP v1 and v2. Move it into the general > > > > fsp directory. > > > > > > > > Signed-off-by: Simon Glass > > > > --- > > > > > > > > Changes in v3: > > > > - Drop struct efi_guid and add a comment about forward declarations > > > > > > > > Changes in v2: > > > > - Rewrite to make azalia a common file for FSP1 and FSP2 > > > > > > > > arch/x86/include/asm/{fsp1 => fsp}/fsp_azalia.h | 0 > > > > arch/x86/include/asm/fsp1/fsp_support.h | 5 - > > > > 2 files changed, 4 insertions(+), 1 deletion(-) > > > > rename arch/x86/include/asm/{fsp1 => fsp}/fsp_azalia.h (100%) > > > > > > > > diff --git a/arch/x86/include/asm/fsp1/fsp_azalia.h > > > > b/arch/x86/include/asm/fsp/fsp_azalia.h > > > > similarity index 100% > > > > rename from arch/x86/include/asm/fsp1/fsp_azalia.h > > > > rename to arch/x86/include/asm/fsp/fsp_azalia.h > > > > diff --git a/arch/x86/include/asm/fsp1/fsp_support.h > > > > b/arch/x86/include/asm/fsp1/fsp_support.h > > > > index 7b92392a277..6d30dd7fbc8 100644 > > > > --- a/arch/x86/include/asm/fsp1/fsp_support.h > > > > +++ b/arch/x86/include/asm/fsp1/fsp_support.h > > > > @@ -14,7 +14,7 @@ > > > > #include "fsp_api.h" > > > > #include "fsp_infoheader.h" > > > > #include "fsp_bootmode.h" > > > > -#include "fsp_azalia.h" > > > > +#include > > > > #include > > > > #include > > > > > > > > @@ -22,6 +22,9 @@ > > > > #define FSP_HIGHMEM_BASE 0x1ULL > > > > #define UPD_TERMINATOR 0x55AA > > > > > > > > +/* Forward declarations for update_fsp_configs() */ > > > > > > These two structs are defined in and the > > > header is already included. > > > > > > They should be dropped from this patch. Let me know if you have different > > > idea. > > > > I suppose that is OK. My goal was to avoid #include in header files > > where possible, but it's not important here. > > Yes, I understand your intention. > > > > > Thank you. > > > > > > > > I can fix this when applying. Fixed the issue, and > > Reviewed-by: Bin Meng applied to u-boot-x86/next, thanks! ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v3 06/10] x86: Move fsp_fv.h to the generic fsp directory
On Wed, Sep 25, 2019 at 10:00 PM Simon Glass wrote: > > This header file is the same for FSP v1 and v2. Move it into the general > fsp directory. > > Signed-off-by: Simon Glass > Reviewed-by: Bin Meng > --- > > Changes in v3: None > Changes in v2: None > > arch/x86/include/asm/{fsp1 => fsp}/fsp_fv.h | 0 > arch/x86/include/asm/fsp1/fsp_support.h | 2 +- > 2 files changed, 1 insertion(+), 1 deletion(-) > rename arch/x86/include/asm/{fsp1 => fsp}/fsp_fv.h (100%) > applied to u-boot-x86/next, thanks! ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v3 04/10] x86: Move fsp_api.h inclusion out of fsp_support.h
On Wed, Sep 25, 2019 at 10:00 PM Simon Glass wrote: > > This header file is different for each version of FSP. Move it into the > fsp_arch.h header file. > > Signed-off-by: Simon Glass > Reviewed-by: Bin Meng > --- > > Changes in v3: None > Changes in v2: None > > arch/x86/include/asm/fsp1/fsp_support.h | 1 - > arch/x86/include/asm/fsp_arch.h | 1 + > 2 files changed, 1 insertion(+), 1 deletion(-) > applied to u-boot-x86/next, thanks! ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v3 05/10] x86: Move fsp_types.h to the generic fsp directory
On Wed, Sep 25, 2019 at 10:00 PM Simon Glass wrote: > > This header file is the same for FSP v1 and v2. Move it into the general > fsp directory. > > Signed-off-by: Simon Glass > Reviewed-by: Bin Meng > --- > > Changes in v3: None > Changes in v2: None > > arch/x86/include/asm/{fsp1 => fsp}/fsp_types.h | 0 > arch/x86/include/asm/fsp1/fsp_support.h| 2 +- > 2 files changed, 1 insertion(+), 1 deletion(-) > rename arch/x86/include/asm/{fsp1 => fsp}/fsp_types.h (100%) > applied to u-boot-x86/next, thanks! ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v3 03/10] x86: Create a new fsp_arch.h header
On Wed, Sep 25, 2019 at 10:00 PM Simon Glass wrote: > > At present fsp_support.h includes fsp_vpd.h which is an FPSv1 concept > (VPD means Vital Product Data). For FSPv2 only UPD (Updatable Product > Data) is used. > > To avoid mangling header files, put these two includes in a separate > header which we can adjust as necessary for FSPv2. > > Signed-off-by: Simon Glass > Reviewed-by: Bin Meng > --- > > Changes in v3: None > Changes in v2: None > > arch/x86/include/asm/fsp1/fsp_support.h | 3 +-- > arch/x86/include/asm/fsp_arch.h | 20 > 2 files changed, 21 insertions(+), 2 deletions(-) > create mode 100644 arch/x86/include/asm/fsp_arch.h > applied to u-boot-x86/next, thanks! ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v3 01/10] x86: Rename existing FSP code to fsp1
On Wed, Sep 25, 2019 at 10:00 PM Simon Glass wrote: > > Since there is now a new version of the FSP and it is incompatible with > the existing version, move the code into an fsp1 directory. This will > allow us to put FSP v2 code into an fsp2 directory. > > Add a Kconfig which defines which version is in use. > > Some of the code in this new fsp1/ directory is generic across both FSPv1 > and FSPv2. Future patches will address this. > > Signed-off-by: Simon Glass > Reviewed-by: Bin Meng > --- > > Changes in v3: None > Changes in v2: > - Correct Intel FSP web link > > arch/x86/Kconfig | 25 ++- > arch/x86/cpu/baytrail/acpi.c | 2 +- > arch/x86/cpu/baytrail/fsp_configs.c | 2 +- > arch/x86/cpu/braswell/fsp_configs.c | 2 +- > arch/x86/cpu/ivybridge/fsp_configs.c | 2 +- > arch/x86/cpu/queensbay/fsp_configs.c | 2 +- > arch/x86/cpu/queensbay/tnc.c | 2 +- > arch/x86/include/asm/{fsp => fsp1}/fsp_api.h | 0 > .../include/asm/{fsp => fsp1}/fsp_azalia.h| 0 > .../include/asm/{fsp => fsp1}/fsp_bootmode.h | 0 > arch/x86/include/asm/{fsp => fsp1}/fsp_ffs.h | 0 > arch/x86/include/asm/{fsp => fsp1}/fsp_fv.h | 0 > arch/x86/include/asm/{fsp => fsp1}/fsp_hob.h | 0 > .../asm/{fsp => fsp1}/fsp_infoheader.h| 0 > .../include/asm/{fsp => fsp1}/fsp_support.h | 0 > .../x86/include/asm/{fsp => fsp1}/fsp_types.h | 0 > arch/x86/include/asm/u-boot-x86.h | 2 +- > arch/x86/lib/Makefile | 3 ++- > arch/x86/lib/{fsp => fsp1}/Makefile | 0 > arch/x86/lib/{fsp => fsp1}/fsp_car.S | 0 > arch/x86/lib/{fsp => fsp1}/fsp_common.c | 2 +- > arch/x86/lib/{fsp => fsp1}/fsp_dram.c | 2 +- > arch/x86/lib/{fsp => fsp1}/fsp_graphics.c | 2 +- > arch/x86/lib/{fsp => fsp1}/fsp_support.c | 2 +- > .../som-db5800-som-6867/som-db5800-som-6867.c | 2 +- > board/intel/cherryhill/cherryhill.c | 2 +- > cmd/x86/fsp.c | 2 +- > drivers/pci/pci-uclass.c | 2 +- > 28 files changed, 41 insertions(+), 17 deletions(-) > rename arch/x86/include/asm/{fsp => fsp1}/fsp_api.h (100%) > rename arch/x86/include/asm/{fsp => fsp1}/fsp_azalia.h (100%) > rename arch/x86/include/asm/{fsp => fsp1}/fsp_bootmode.h (100%) > rename arch/x86/include/asm/{fsp => fsp1}/fsp_ffs.h (100%) > rename arch/x86/include/asm/{fsp => fsp1}/fsp_fv.h (100%) > rename arch/x86/include/asm/{fsp => fsp1}/fsp_hob.h (100%) > rename arch/x86/include/asm/{fsp => fsp1}/fsp_infoheader.h (100%) > rename arch/x86/include/asm/{fsp => fsp1}/fsp_support.h (100%) > rename arch/x86/include/asm/{fsp => fsp1}/fsp_types.h (100%) > rename arch/x86/lib/{fsp => fsp1}/Makefile (100%) > rename arch/x86/lib/{fsp => fsp1}/fsp_car.S (100%) > rename arch/x86/lib/{fsp => fsp1}/fsp_common.c (99%) > rename arch/x86/lib/{fsp => fsp1}/fsp_dram.c (98%) > rename arch/x86/lib/{fsp => fsp1}/fsp_graphics.c (98%) > rename arch/x86/lib/{fsp => fsp1}/fsp_support.c (99%) > applied to u-boot-x86/next, thanks! ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 4/5] riscv: dts: hifive-unleashed-a00: Add -u-boot.dtsi
On Mon, Sep 30, 2019 at 3:35 PM Bin Meng wrote: > > Hi Jagan, > > On Sun, Sep 29, 2019 at 3:43 PM Jagan Teki wrote: > > > > Add u-boot specific dts file for hifive-unleashed-a00, this > > would help to add u-boot specific properties and other node > > changes without touching the base dts(i) files which are easy > > to sync from Linux. > > > > Added spi2 alias for qspi2 as an initial u-boot specific > > property change. > > > > spi probing in current dm model is very much rely on aliases > > numbering. even though the qspi2 can't comes under any associated > > spi nor flash it would require to specify the same to make proper > > binding happen for other spi slaves. > > > > Signed-off-by: Jagan Teki > > --- > > arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi | 10 ++ > > 1 file changed, 10 insertions(+) > > create mode 100644 arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi > > > > diff --git a/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi > > b/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi > > new file mode 100644 > > index 00..25ec8265a5 > > --- /dev/null > > +++ b/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi > > @@ -0,0 +1,10 @@ > > +// SPDX-License-Identifier: GPL-2.0+ > > +/* > > + * Copyright (C) 2019 Jagan Teki > > + */ > > + > > +/ { > > + aliases { > > + spi2 = > > With the following 2 patches, this is no longer needed for SPI. > > http://patchwork.ozlabs.org/patch/1158960/ > http://patchwork.ozlabs.org/patch/1158961/ These changes doesn't related to this, checked the same. SPI MMC need to bringup like normal spi via alias to make proper graceful probing for next spi slaves. ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2] dfu: mmc: add support for in-partition offset
Add possibility to define a part of partition as a separate DFU entity. This allows to have more than one items on the given partition. The real use case for this option is TM2 board. It can use u-boot stored as Linux kernel on the defined partition (as RAW data) and load the real kernel from the same partition, but stored under the certain offset. Signed-off-by: Marek Szyprowski Acked-by: Lukasz Majewski --- Changelog: - fixed minor coding style issue - made it a stand alone patch, independent from the main patchset: https://patchwork.ozlabs.org/cover/994309/ --- drivers/dfu/dfu_mmc.c | 13 +++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/dfu/dfu_mmc.c b/drivers/dfu/dfu_mmc.c index 403fd5351d..5b551f6ae1 100644 --- a/drivers/dfu/dfu_mmc.c +++ b/drivers/dfu/dfu_mmc.c @@ -352,6 +352,7 @@ int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *devstr, char *s) struct blk_desc *blk_dev = mmc_get_blk_desc(mmc); int mmcdev = second_arg; int mmcpart = third_arg; + int offset = 0; if (part_get_info(blk_dev, mmcpart, ) != 0) { pr_err("Couldn't find part #%d on mmc device #%d\n", @@ -359,9 +360,17 @@ int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *devstr, char *s) return -ENODEV; } + /* +* Check for an extra entry at dfu_alt_info env variable +* specifying the mmc HW defined partition number +*/ + if (s) + if (!strcmp(strsep(, " "), "offset")) + offset = simple_strtoul(s, NULL, 0); + dfu->layout = DFU_RAW_ADDR; - dfu->data.mmc.lba_start = partinfo.start; - dfu->data.mmc.lba_size = partinfo.size; + dfu->data.mmc.lba_start = partinfo.start + offset; + dfu->data.mmc.lba_size = partinfo.size-offset; dfu->data.mmc.lba_blk_size = partinfo.blksz; } else if (!strcmp(entity_type, "fat")) { dfu->layout = DFU_FS_FAT; -- 2.17.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH RESEND] cmd: thor: select DFU subsystem also for 'thor' download tool
'THOR' download command requires DFU infrastructure to properly flash board images. It can be used without enabling DFU command, so add such dependency to Kconfig. Signed-off-by: Marek Szyprowski Acked-by: Lukasz Majewski --- Resend reason: stand alone patch, independent from the main patchset: https://patchwork.ozlabs.org/cover/994309/ --- cmd/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/cmd/Kconfig b/cmd/Kconfig index 98647f58b7..5e4a8ee130 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -391,6 +391,7 @@ config CMD_FITUPD config CMD_THOR_DOWNLOAD bool "thor - TIZEN 'thor' download" + select DFU help Implements the 'thor' download protocol. This is a way of downloading a software update over USB from an attached host. -- 2.17.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 1/5] riscv: dts: Add hifive-unleashed-a00 dts from Linux
On Mon, Sep 30, 2019 at 3:35 PM Bin Meng wrote: > > Hi Jagan, > > On Sun, Sep 29, 2019 at 3:42 PM Jagan Teki wrote: > > > > Sync the hifive-unleashed-a00 dts from Linux with > > below commit details: > > commit 11ae2d892139a1086f257188d457ddcb71ab5257 > > The latest commit should be: > > commit c81007116bd23e9e2103c267184dc38d3acc1099 > Author: Bin Meng > Date: Thu Sep 5 05:45:53 2019 -0700 > > riscv: dts: sifive: Drop "clock-frequency" property of cpu nodes > > Could you use the latest one? Syncing these commits other than the patch used one seems not working. SBI is failing to load u-boot-dtb.bin. I think this would some sort of cpu nodes changes on commits after riscv: dts: fu540-c000: drop "timebase-frequency" ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH RESEND] gadget: f_thor: properly enable 3rd endpoint defined by the protocol
This is needed to make Windows THOR flash tool happy, because it starts sending data only when interrupt packet is received on the 3rd endpoint. Signed-off-by: Marek Szyprowski Acked-by: Lukasz Majewski --- Resend reason: stand alone patch, independent from the main patchset: https://patchwork.ozlabs.org/cover/994309/ --- drivers/usb/gadget/f_thor.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/usb/gadget/f_thor.c b/drivers/usb/gadget/f_thor.c index 8b3b19feaf..920fa5279c 100644 --- a/drivers/usb/gadget/f_thor.c +++ b/drivers/usb/gadget/f_thor.c @@ -941,6 +941,13 @@ static int thor_eps_setup(struct usb_function *f) dev->out_req = req; /* ACM control EP */ ep = dev->int_ep; + d = ep_desc(gadget, _int_desc, _int_desc); + debug("(d)bEndpointAddress: 0x%x\n", d->bEndpointAddress); + + result = usb_ep_enable(ep, d); + if (result) + goto err; + ep->driver_data = cdev; /* claim */ return 0; -- 2.17.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH RESEND] cmd: itest: add support for .q size specifier
Add support for quad (64bits) memory access specifier. Signed-off-by: Marek Szyprowski Acked-by: Lukasz Majewski --- Resend reason: stand alone patch, independent from the main patchset: https://patchwork.ozlabs.org/cover/994309/ --- cmd/itest.c | 12 1 file changed, 12 insertions(+) diff --git a/cmd/itest.c b/cmd/itest.c index 8b630d71e6..e21e1f1b1b 100644 --- a/cmd/itest.c +++ b/cmd/itest.c @@ -73,6 +73,11 @@ static long evalexp(char *s, int w) case 4: l = (long)(*(u32 *)buf); break; +#ifdef CONFIG_PHYS_64BIT + case 8: + l = (long)(*(unsigned long *)buf); + break; +#endif } unmap_physmem(buf, w); return l; @@ -186,6 +191,9 @@ static int do_itest(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) case 1: case 2: case 4: +#ifdef CONFIG_PHYS_64BIT + case 8: +#endif value = binary_test (argv[2], argv[1], argv[3], w); break; case -2: @@ -204,5 +212,9 @@ static int do_itest(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) U_BOOT_CMD( itest, 4, 0, do_itest, "return true/false on integer compare", +#ifdef CONFIG_PHYS_64BIT + "[.b, .w, .l, .q, .s] [*]value1 [*]value2" +#else "[.b, .w, .l, .s] [*]value1 [*]value2" +#endif ); -- 2.17.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v4 04/17] arm: socfpga: agilex: Add reset manager support
On Wed, Oct 2, 2019 at 11:25 AM Ley Foon Tan wrote: > > On Wed, Oct 2, 2019 at 4:26 PM Simon Goldschmidt > wrote: > > > > On Thu, Sep 12, 2019 at 12:11 PM Ley Foon Tan > > wrote: > > > > > > Add reset manager support for Agilex. > > > > > > Signed-off-by: Ley Foon Tan > > > > > > --- > > > v3: > > > - Add reset_manager_soc64.h > > > - Convert to use defines instead of struct. > > > --- > > > arch/arm/mach-socfpga/include/mach/reset_manager.h| 2 ++ > > > .../mach-socfpga/include/mach/reset_manager_agilex.h | 11 +++ > > > 2 files changed, 13 insertions(+) > > > create mode 100644 > > > arch/arm/mach-socfpga/include/mach/reset_manager_agilex.h > > > > > > diff --git a/arch/arm/mach-socfpga/include/mach/reset_manager.h > > > b/arch/arm/mach-socfpga/include/mach/reset_manager.h > > > index a5b6931350..019c518ae4 100644 > > > --- a/arch/arm/mach-socfpga/include/mach/reset_manager.h > > > +++ b/arch/arm/mach-socfpga/include/mach/reset_manager.h > > > @@ -45,6 +45,8 @@ void socfpga_per_reset_all(void); > > > #include > > > #elif defined(CONFIG_TARGET_SOCFPGA_STRATIX10) > > > #include > > > +#elif defined(CONFIG_TARGET_SOCFPGA_AGILEX) > > > +#include > > > > Why don't you just include reset_manager_soc64.h here? No need for the > > additional file. > Do you mean remove reset_manager_s10.h and reset_manager_agilex.h and > include reset_manager_soc64.h directly? > These 2 header files includes reset_manager_soc64.h and don't have > additional define in them now. Right, these files could be removed, no? Unless you're planning to add anything to them soon... Regards, Simon > > Regards > Ley Foon > > > > > > #endif > > > > > > #endif /* _RESET_MANAGER_H_ */ > > > diff --git a/arch/arm/mach-socfpga/include/mach/reset_manager_agilex.h > > > b/arch/arm/mach-socfpga/include/mach/reset_manager_agilex.h > > > new file mode 100644 > > > index 00..617e06ec06 > > > --- /dev/null > > > +++ b/arch/arm/mach-socfpga/include/mach/reset_manager_agilex.h > > > @@ -0,0 +1,11 @@ > > > +/* SPDX-License-Identifier: GPL-2.0 */ > > > +/* > > > + * Copyright (C) 2019 Intel Corporation > > > + */ > > > + > > > +#ifndef_RESET_MANAGER_AGILEX_ > > > +#define_RESET_MANAGER_AGILEX_ > > > + > > > +#include > > > + > > > +#endif /* _RESET_MANAGER_AGILEX_ */ > > > -- > > > 2.19.0 > > > ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 04/13] firmware: zynqmp: Add zynqmp-power support
On 02. 10. 19 11:34, Luca Ceresoli wrote: > Hi Ibai, Michal, > > On 27/09/19 15:34, Michal Simek wrote: >> From: Ibai Erkiaga >> >> zynqmp-power driver for ZynqMP to handle the communication with the PMU >> firmware. Firmware driver just probes subnodes and power driver handles >> communication with PMU using the IPI mailbox driver. >> >> Signed-off-by: Ibai Erkiaga >> Signed-off-by: Michal Simek >> --- >> >> drivers/firmware/Kconfig | 2 ++ >> drivers/firmware/firmware-zynqmp.c | 40 ++ >> 2 files changed, 42 insertions(+) >> >> diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig >> index b70a2063551c..9596ec16c7f7 100644 >> --- a/drivers/firmware/Kconfig >> +++ b/drivers/firmware/Kconfig >> @@ -30,6 +30,8 @@ config TI_SCI_PROTOCOL >> config ZYNQMP_FIRMWARE >> bool "ZynqMP Firmware interface" >> select FIRMWARE >> +select ZYNQMP_IPI >> +select DM_MAILBOX >> help >>Firmware interface driver is used by different >>drivers to communicate with the firmware for >> diff --git a/drivers/firmware/firmware-zynqmp.c >> b/drivers/firmware/firmware-zynqmp.c >> index 6644a7166ca0..b0930447b988 100644 >> --- a/drivers/firmware/firmware-zynqmp.c >> +++ b/drivers/firmware/firmware-zynqmp.c >> @@ -1,6 +1,46 @@ >> // SPDX-License-Identifier: GPL-2.0 >> +/* >> + * Xilinx Zynq MPSoC Firmware driver >> + * >> + * Copyright (C) 2018-2019 Xilinx, Inc. >> + */ >> >> +#include >> #include >> +#include >> +#include >> + >> +struct zynqmp_power { >> +struct mbox_chan tx_chan; >> +struct mbox_chan rx_chan; >> +} zynqmp_power; >> + >> +static int zynqmp_power_probe(struct udevice *dev) >> +{ >> +int ret = 0; >> + >> +debug("%s, (dev=%p)\n", __func__, dev); >> + >> +ret |= mbox_get_by_name(dev, "tx", _power.tx_chan); >> +ret |= mbox_get_by_name(dev, "rx", _power.rx_chan); > > If these two calls return different error values, the binary or will > produce a nonsense 'ret' value. E.g. (-EINVAL | -ENODATA) equals -ENOTDIR. > > Otherwise looks good. > Let's fix this. Also mbox_send/mbox_recv from firmware-zynqmp.c should be fixed too. Thanks, Michal ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot