diff options
author | Tom Rini <trini@konsulko.com> | 2021-11-01 08:14:45 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2021-11-01 08:14:45 -0400 |
commit | daaa10fddb5d9076601473bc53409ab74f04c048 (patch) | |
tree | b5ca780d0e9ce29fe58362533b56765a9ed3abad | |
parent | 360e392274e3bfeda3b7226d2cac7514774d0da1 (diff) | |
parent | 5270bee9b27cf63251696916e4b5a5d4412d3a2d (diff) | |
download | u-boot-daaa10fddb5d9076601473bc53409ab74f04c048.tar.gz |
Merge https://source.denx.de/u-boot/custodians/u-boot-x86
- Fixes for x86 build with Clang/LLVM compiler
- Tangier ACPI changes
- Edison SD card detect pin fix
- EFI on x86 doc update with latest instructions
- PXE utility fixes to align with latest x86 zboot implementation
-rw-r--r-- | arch/x86/cpu/tangier/pinmux.c | 48 | ||||
-rw-r--r-- | arch/x86/dts/chromebook_coral.dts | 1 | ||||
-rw-r--r-- | arch/x86/dts/edison.dts | 17 | ||||
-rw-r--r-- | arch/x86/include/asm/arch-tangier/acpi/southcluster.asl | 81 | ||||
-rw-r--r-- | arch/x86/include/asm/i8254.h | 4 | ||||
-rw-r--r-- | cmd/pxe_utils.c | 45 | ||||
-rw-r--r-- | doc/develop/uefi/u-boot_on_efi.rst | 12 |
7 files changed, 112 insertions, 96 deletions
diff --git a/arch/x86/cpu/tangier/pinmux.c b/arch/x86/cpu/tangier/pinmux.c index acf97e3af5..7b2c35fbf7 100644 --- a/arch/x86/cpu/tangier/pinmux.c +++ b/arch/x86/cpu/tangier/pinmux.c @@ -37,8 +37,9 @@ struct mrfld_family { .npins = (e) - (s) + 1, \ } -/* Now we only support I2C family of pins */ +/* Now we only support SD/SDIO and I2C families of pins */ static struct mrfld_family mrfld_families[] = { + MRFLD_FAMILY(3, 37, 56), MRFLD_FAMILY(7, 101, 114), }; @@ -116,13 +117,35 @@ static int mrfld_pinconfig_protected(unsigned int pin, u32 mask, u32 bits) debug("scu: v: 0x%x p: 0x%x bits: %d, mask: %d bufcfg: 0x%p\n", v, (u32)bufcfg, bits, mask, bufcfg); - ret = scu_ipc_raw_command(IPCMSG_INDIRECT_WRITE, 0, &v, 4, - NULL, 0, (u32)bufcfg, 0); + return scu_ipc_raw_command(IPCMSG_INDIRECT_WRITE, 0, &v, 4, NULL, 0, (u32)bufcfg, 0); +} + +static int mrfld_pinconfig(unsigned int pin, u32 mask, u32 bits) +{ + struct mrfld_pinctrl *pinctrl; + struct udevice *dev; + void __iomem *bufcfg; + u32 v, value; + int ret; + + ret = syscon_get_by_driver_data(X86_SYSCON_PINCONF, &dev); if (ret) - pr_err("Failed to set mode via SCU for pin %u (%d)\n", - pin, ret); + return ret; - return ret; + pinctrl = dev_get_priv(dev); + + bufcfg = mrfld_get_bufcfg(pinctrl, pin); + if (!bufcfg) + return -EINVAL; + + value = readl(bufcfg); + v = (value & ~mask) | (bits & mask); + writel(v, bufcfg); + + debug("v: 0x%x p: 0x%x bits: %d, mask: %d bufcfg: 0x%p\n", + v, (u32)bufcfg, bits, mask, bufcfg); + + return 0; } static int mrfld_pinctrl_cfg_pin(ofnode pin_node) @@ -133,11 +156,6 @@ static int mrfld_pinctrl_cfg_pin(ofnode pin_node) u32 mask; int ret; - /* For now we only support just protected Family of pins */ - is_protected = ofnode_read_bool(pin_node, "protected"); - if (!is_protected) - return -ENOTSUPP; - pad_offset = ofnode_read_s32_default(pin_node, "pad-offset", -1); if (pad_offset == -1) return -EINVAL; @@ -152,7 +170,13 @@ static int mrfld_pinctrl_cfg_pin(ofnode pin_node) if (mode & ~mask) return -ENOTSUPP; - ret = mrfld_pinconfig_protected(pad_offset, mask, mode); + is_protected = ofnode_read_bool(pin_node, "protected"); + if (is_protected) + ret = mrfld_pinconfig_protected(pad_offset, mask, mode); + else + ret = mrfld_pinconfig(pad_offset, mask, mode); + if (ret) + pr_err("Failed to set mode for pin %u (%d)\n", pad_offset, ret); return ret; } diff --git a/arch/x86/dts/chromebook_coral.dts b/arch/x86/dts/chromebook_coral.dts index f0caaacfee..69a1c1ce29 100644 --- a/arch/x86/dts/chromebook_coral.dts +++ b/arch/x86/dts/chromebook_coral.dts @@ -825,6 +825,7 @@ * Refer to EDS-Vol2-22.3 * [14:8] steps of delay for HS400, each 125ps * [6:0] steps of delay for SDR104/HS200, each 125ps + */ /* * EMMC TX DATA Delay 2 diff --git a/arch/x86/dts/edison.dts b/arch/x86/dts/edison.dts index 2c8cf6c071..b3658b8c30 100644 --- a/arch/x86/dts/edison.dts +++ b/arch/x86/dts/edison.dts @@ -94,6 +94,12 @@ sdcard: mmc@ff3fa000 { compatible = "intel,sdhci-tangier"; reg = <0xff3fa000 0x1000>; + /* + * In the disconnected state of the SD Card Detection pin + * the read value is always the same and inverted to what + * we are expecting in the code. + */ + cd-inverted; }; pmu: power@ff00b000 { @@ -132,6 +138,17 @@ reg = <0xff0c0000 0x8000>; /* + * Disconnect SD card detection pin, so it won't affect + * the reality on two different PCB designs where it's + * using the opposite signaling: Edison/Arduino uses + * Active Low, while SparkFun went with Active High. + */ + sd_cd@0 { + pad-offset = <37>; + mode-func = <3>; + }; + + /* * Initial configuration came from the firmware. * Which quite likely has been used in the phones, where I2C #8, * that is not part of Atom peripheral, is in use. diff --git a/arch/x86/include/asm/arch-tangier/acpi/southcluster.asl b/arch/x86/include/asm/arch-tangier/acpi/southcluster.asl index a8852f8202..4a7c854261 100644 --- a/arch/x86/include/asm/arch-tangier/acpi/southcluster.asl +++ b/arch/x86/include/asm/arch-tangier/acpi/southcluster.asl @@ -123,10 +123,7 @@ Device (PCI0) } }) - Method (_STA) - { - Return (STA_VISIBLE) - } + Name (_STA, STA_VISIBLE) } Device (SDHC) @@ -138,10 +135,7 @@ Device (PCI0) }) Name (PSTS, Zero) - Method (_STA) - { - Return (STA_VISIBLE) - } + Name (_STA, STA_VISIBLE) Method (_PS3, 0, NotSerialized) { @@ -168,10 +162,7 @@ Device (PCI0) GPIO }) - Method (_STA) - { - Return (STA_VISIBLE) - } + Name (_STA, STA_VISIBLE) Method (_RMV, 0, NotSerialized) { @@ -203,10 +194,8 @@ Device (PCI0) Device (BRC2) { Name (_ADR, 0x02) - Method (_STA, 0, NotSerialized) - { - Return (STA_VISIBLE) - } + + Name (_STA, STA_VISIBLE) Method (_RMV, 0, NotSerialized) { @@ -257,20 +246,14 @@ Device (PCI0) } }) - Method (_STA, 0, NotSerialized) - { - Return (STA_VISIBLE) - } + Name (_STA, STA_VISIBLE) } Device (I2C1) { Name (_ADR, 0x00080000) - Method (_STA, 0, NotSerialized) - { - Return (STA_VISIBLE) - } + Name (_STA, STA_VISIBLE) Name (SSCN, Package () { @@ -303,10 +286,7 @@ Device (PCI0) { Name (_ADR, 0x00090001) - Method (_STA, 0, NotSerialized) - { - Return (STA_VISIBLE) - } + Name (_STA, STA_VISIBLE) Name (SSCN, Package () { @@ -328,10 +308,7 @@ Device (PCI0) { Name (_ADR, 0x000c0000) - Method (_STA) - { - Return (STA_VISIBLE) - } + Name (_STA, STA_VISIBLE) Name (AVBL, Zero) Method (_REG, 2, NotSerialized) @@ -361,10 +338,7 @@ Device (PCI0) ^IPC1.PMIC }) - Method (_STA, 0, NotSerialized) - { - Return (STA_VISIBLE) - } + Name (_STA, STA_VISIBLE) Device (RHUB) { @@ -404,20 +378,14 @@ Device (PCI0) { Name (_ADR, 0x00170000) - Method (_STA, 0, NotSerialized) - { - Return (STA_VISIBLE) - } + Name (_STA, STA_VISIBLE) } Device (HSU0) { Name (_ADR, 0x00040001) - Method (_STA, 0, NotSerialized) - { - Return (STA_VISIBLE) - } + Name (_STA, STA_VISIBLE) Device (BTH0) { @@ -428,10 +396,7 @@ Device (PCI0) HSU0 }) - Method (_STA, 0, NotSerialized) - { - Return (STA_VISIBLE) - } + Name (_STA, STA_VISIBLE) Name (RBUF, ResourceTemplate() { @@ -466,10 +431,7 @@ Device (PCI0) { Name (_ADR, 0x00130000) - Method (_STA, 0, NotSerialized) - { - Return (STA_VISIBLE) - } + Name (_STA, STA_VISIBLE) Device (PMIC) { @@ -481,10 +443,7 @@ Device (PCI0) IPC1 }) - Method (_STA, 0, NotSerialized) - { - Return (STA_VISIBLE) - } + Name (_STA, STA_VISIBLE) Name (RBUF, ResourceTemplate() { @@ -554,10 +513,7 @@ Device (PCI0) Name (_ADR, 0x00150000) Name (_UID, Zero) - Method (_STA, 0, NotSerialized) - { - Return (STA_VISIBLE) - } + Name (_STA, STA_VISIBLE) Name (RBUF, ResourceTemplate () { @@ -594,8 +550,5 @@ Device (FLIS) Return (RBUF) } - Method (_STA, 0, NotSerialized) - { - Return (STA_VISIBLE) - } + Name (_STA, STA_VISIBLE) } diff --git a/arch/x86/include/asm/i8254.h b/arch/x86/include/asm/i8254.h index d769daf85d..4069b9a2b8 100644 --- a/arch/x86/include/asm/i8254.h +++ b/arch/x86/include/asm/i8254.h @@ -7,7 +7,7 @@ /* i8254.h Intel 8254 PIT registers */ #ifndef _ASMI386_I8254_H_ -#define _ASMI386_I8954_H_ +#define _ASMI386_I8254_H_ #define PIT_T0 0x00 /* PIT channel 0 count/status */ #define PIT_T1 0x01 /* PIT channel 1 count/status */ @@ -53,4 +53,4 @@ int i8254_enable_beep(uint frequency_hz); */ void i8254_disable_beep(void); -#endif /* _ASMI386_I8954_H_ */ +#endif /* _ASMI386_I8254_H_ */ diff --git a/cmd/pxe_utils.c b/cmd/pxe_utils.c index 067c24e5ff..b79fcb6418 100644 --- a/cmd/pxe_utils.c +++ b/cmd/pxe_utils.c @@ -441,13 +441,18 @@ skip_overlay: static int label_boot(struct cmd_tbl *cmdtp, struct pxe_label *label) { char *bootm_argv[] = { "bootm", NULL, NULL, NULL, NULL }; + char *zboot_argv[] = { "zboot", NULL, "0", NULL, NULL }; + char *kernel_addr = NULL; + char *initrd_addr_str = NULL; + char initrd_filesize[10]; char initrd_str[28]; char mac_str[29] = ""; char ip_str[68] = ""; char *fit_addr = NULL; int bootm_argc = 2; + int zboot_argc = 3; int len = 0; - ulong kernel_addr; + ulong kernel_addr_r; void *buf; label_print(label); @@ -473,11 +478,12 @@ static int label_boot(struct cmd_tbl *cmdtp, struct pxe_label *label) return 1; } - bootm_argv[2] = initrd_str; - strncpy(bootm_argv[2], env_get("ramdisk_addr_r"), 18); - strcat(bootm_argv[2], ":"); - strncat(bootm_argv[2], env_get("filesize"), 9); - bootm_argc = 3; + initrd_addr_str = env_get("ramdisk_addr_r"); + strncpy(initrd_filesize, env_get("filesize"), 9); + + strncpy(initrd_str, initrd_addr_str, 18); + strcat(initrd_str, ":"); + strncat(initrd_str, initrd_filesize, 9); } if (get_relfile_envaddr(cmdtp, label->kernel, "kernel_addr_r") < 0) { @@ -528,18 +534,19 @@ static int label_boot(struct cmd_tbl *cmdtp, struct pxe_label *label) printf("append: %s\n", finalbootargs); } - bootm_argv[1] = env_get("kernel_addr_r"); + kernel_addr = env_get("kernel_addr_r"); + /* for FIT, append the configuration identifier */ if (label->config) { - int len = strlen(bootm_argv[1]) + strlen(label->config) + 1; + int len = strlen(kernel_addr) + strlen(label->config) + 1; fit_addr = malloc(len); if (!fit_addr) { printf("malloc fail (FIT address)\n"); return 1; } - snprintf(fit_addr, len, "%s%s", bootm_argv[1], label->config); - bootm_argv[1] = fit_addr; + snprintf(fit_addr, len, "%s%s", kernel_addr, label->config); + kernel_addr = fit_addr; } /* @@ -643,6 +650,18 @@ static int label_boot(struct cmd_tbl *cmdtp, struct pxe_label *label) } } + bootm_argv[1] = kernel_addr; + zboot_argv[1] = kernel_addr; + + if (initrd_addr_str) { + bootm_argv[2] = initrd_str; + bootm_argc = 3; + + zboot_argv[3] = initrd_addr_str; + zboot_argv[4] = initrd_filesize; + zboot_argc = 5; + } + if (!bootm_argv[3]) bootm_argv[3] = env_get("fdt_addr"); @@ -652,8 +671,8 @@ static int label_boot(struct cmd_tbl *cmdtp, struct pxe_label *label) bootm_argc = 4; } - kernel_addr = genimg_get_kernel_addr(bootm_argv[1]); - buf = map_sysmem(kernel_addr, 0); + kernel_addr_r = genimg_get_kernel_addr(kernel_addr); + buf = map_sysmem(kernel_addr_r, 0); /* Try bootm for legacy and FIT format image */ if (genimg_get_format(buf) != IMAGE_FORMAT_INVALID) do_bootm(cmdtp, 0, bootm_argc, bootm_argv); @@ -665,7 +684,7 @@ static int label_boot(struct cmd_tbl *cmdtp, struct pxe_label *label) do_bootz(cmdtp, 0, bootm_argc, bootm_argv); /* Try booting an x86_64 Linux kernel image */ else if (IS_ENABLED(CONFIG_CMD_ZBOOT)) - do_zboot_parent(cmdtp, 0, bootm_argc, bootm_argv, NULL); + do_zboot_parent(cmdtp, 0, zboot_argc, zboot_argv, NULL); unmap_sysmem(buf); diff --git a/doc/develop/uefi/u-boot_on_efi.rst b/doc/develop/uefi/u-boot_on_efi.rst index c9a41bc919..43afb11de5 100644 --- a/doc/develop/uefi/u-boot_on_efi.rst +++ b/doc/develop/uefi/u-boot_on_efi.rst @@ -72,17 +72,19 @@ You will end up with one of these files depending on what you build for: Trying it out ------------- QEMU is an emulator and it can emulate an x86 machine. Please make sure your -QEMU version is 2.3.0 or above to test this. You can run the payload with +QEMU version is 6.0.0 or above to test this. You can run the payload with something like this:: mkdir /tmp/efi cp /path/to/u-boot*.efi /tmp/efi - qemu-system-x86_64 -bios bios.bin -hda fat:/tmp/efi/ + qemu-system-x86_64 -pflash edk2-x86_64-code.fd -hda fat:rw:/tmp/efi/ Add -nographic if you want to use the terminal for output. Once it starts type 'fs0:u-boot-payload.efi' to run the payload or 'fs0:u-boot-app.efi' to -run the application. 'bios.bin' is the EFI 'BIOS'. Check [2] to obtain a -prebuilt EFI BIOS for QEMU or you can build one from source as well. +run the application. 'edk2-x86_64-code.fd' is the EFI 'BIOS'. QEMU already +ships both 32-bit and 64-bit EFI BIOS images. For 32-bit EFI 'BIOS' image, +use 'edk2-i386-code.fd'. + To try it on real hardware, put u-boot-app.efi on a suitable boot medium, such as a USB stick. Then you can type something like this to start it:: @@ -232,4 +234,4 @@ Google, Inc July 2015 * [1] http://www.qemu.org -* [2] http://www.tianocore.org/ovmf/ +* [2] https://github.com/tianocore/tianocore.github.io/wiki/OVMF |