diff options
| author | Tom Rini <trini@konsulko.com> | 2025-04-11 09:12:16 -0600 |
|---|---|---|
| committer | Tom Rini <trini@konsulko.com> | 2025-04-11 09:12:16 -0600 |
| commit | ff0b7d741dec48c9d1ce5e80ada5eaeac19b1b93 (patch) | |
| tree | 8f3952ebeb31a9ce0a35d419121e80cae41b547b /board | |
| parent | 295376ce8a32268a1bb0879eb0448e0c0e580727 (diff) | |
| parent | f3563fc30356c8079527b90e532407050dff7c7b (diff) | |
Merge tag 'qcom-for-2025.07' of https://source.denx.de/u-boot/custodians/u-boot-snapdragon
Qualcomm changes for v2025.07:
CI: https://source.denx.de/u-boot/custodians/u-boot-snapdragon/-/pipelines/25653
There's been a surprising amount of activity lately on the Qualcomm
side with the two oldest boards getting some fresh attention and a lot
of cleanup and polish going on across the board.
* SDM660 gets USB phy fixes and a pinctrl driver
* The recently added SA8775P/QCS9100 SoC gets a pinctrl driver
* The Qualcomm pinctrl driver now handles reserved pins correctly,
fixing crashes on some boards when running "gpio status -a"
* OF_UPSTREAM_BUILD_VENDOR is enabled in qcom_defconfig
* SDM845 and SC7280 get missing clocks added (since we're now stricter
about those). This gets USB working more reliably in more cases.
* DM_USB_GADGET is enabled for all boards using DWC3 and fasbtoot is
enabled too
* A bug in the livetree fixup code is fixed (making USB work on a lot
more platforms)
* Button label lookup is made case insensitive* bootretry becomes more dynamic, allowing it to be hijacked to make a
"persistent" boot menu that allows dropping to U-Boot shell later on
* A new qcom-phone.config fragment is added along with a phone-specific
default environment and phone-specific debugging/bringup docs. These
make U-Boot more usable on devices without a serial port or keyboard.
* The db820c gets fixed up and updated documentation
* The db410c also gets some love and modernisation as well as a new
reviewer.
* A new driver is added for the USB VBUS regulator found on various
Qualcomm PMICs
* The Qualcomm SPMI driver gets some fixes and cleanup for SPMI v5 and
v7 support.
Diffstat (limited to 'board')
| -rw-r--r-- | board/qualcomm/dragonboard410c/MAINTAINERS | 3 | ||||
| -rw-r--r-- | board/qualcomm/dragonboard410c/dragonboard410c.c | 67 | ||||
| -rw-r--r-- | board/qualcomm/dragonboard410c/dragonboard410c.env | 38 | ||||
| -rw-r--r-- | board/qualcomm/dragonboard820c/dragonboard820c.c | 2 | ||||
| -rw-r--r-- | board/qualcomm/dragonboard820c/readme.txt | 47 | ||||
| -rw-r--r-- | board/qualcomm/qcom-phone.config | 29 | ||||
| -rw-r--r-- | board/qualcomm/qcom-phone.env | 47 |
7 files changed, 126 insertions, 107 deletions
diff --git a/board/qualcomm/dragonboard410c/MAINTAINERS b/board/qualcomm/dragonboard410c/MAINTAINERS index e78f5b2d642..9c10fa3053b 100644 --- a/board/qualcomm/dragonboard410c/MAINTAINERS +++ b/board/qualcomm/dragonboard410c/MAINTAINERS @@ -1,5 +1,6 @@ DRAGONBOARD410C BOARD -M: Ramon Fried <rfried.dev@gmail.com> +M: Stephan Gerhold <stephan@gerhold.net> +R: Sam Day <me@samcday.com> S: Maintained F: board/qualcomm/dragonboard410c/ F: include/configs/dragonboard410c.h diff --git a/board/qualcomm/dragonboard410c/dragonboard410c.c b/board/qualcomm/dragonboard410c/dragonboard410c.c index fcbf2c3fe60..4698b9d5e3e 100644 --- a/board/qualcomm/dragonboard410c/dragonboard410c.c +++ b/board/qualcomm/dragonboard410c/dragonboard410c.c @@ -22,21 +22,6 @@ DECLARE_GLOBAL_DATA_PTR; -/* UNSTUFF_BITS macro taken from Linux Kernel: drivers/mmc/core/sd.c */ -#define UNSTUFF_BITS(resp, start, size) \ - ({ \ - const int __size = size; \ - const u32 __mask = (__size < 32 ? 1 << __size : 0) - 1; \ - const int __off = 3 - ((start) / 32); \ - const int __shft = (start) & 31; \ - u32 __res; \ - \ - __res = resp[__off] >> __shft; \ - if (__size + __shft > 32) \ - __res |= resp[__off - 1] << ((32 - __shft) % 32); \ - __res & __mask; \ - }) - static u32 msm_board_serial(void) { struct mmc *mmc_dev; @@ -48,7 +33,8 @@ static u32 msm_board_serial(void) if (mmc_init(mmc_dev)) return 0; - return UNSTUFF_BITS(mmc_dev->cid, 16, 32); + /* MMC serial number */ + return mmc_dev->cid[2] << 16 | mmc_dev->cid[3] >> 16; } static void msm_generate_mac_addr(u8 *mac) @@ -65,28 +51,6 @@ static void msm_generate_mac_addr(u8 *mac) put_unaligned_be32(msm_board_serial(), &mac[2]); } -/* Check for vol- button - if pressed - stop autoboot */ -int misc_init_r(void) -{ - struct udevice *btn; - int ret; - enum button_state_t state; - - ret = button_get_by_label("vol_down", &btn); - if (ret < 0) { - printf("Couldn't find power button!\n"); - return ret; - } - - state = button_get_state(btn); - if (state == BUTTON_ON) { - env_set("preboot", "setenv preboot; fastboot 0"); - printf("vol_down pressed - Starting fastboot.\n"); - } - - return 0; -} - int qcom_late_init(void) { char serial[16]; @@ -97,9 +61,9 @@ int qcom_late_init(void) return 0; } -/* Fixup of DTB for Linux Kernel - * 1. Fixup installed DRAM. - * 2. Fixup WLAN/BT Mac address: +/* + * Fixup of DTB for Linux Kernel + * 1. Fixup WLAN/BT Mac address: * First, check if MAC addresses for WLAN/BT exists as environemnt * variables wlanaddr,btaddr. if not, generate a unique address. */ @@ -107,6 +71,7 @@ int qcom_late_init(void) int ft_board_setup(void *blob, struct bd_info *bd) { u8 mac[ARP_HLEN]; + int i; if (!eth_env_get_enetaddr("wlanaddr", mac)) { msm_generate_mac_addr(mac); @@ -118,12 +83,24 @@ int ft_board_setup(void *blob, struct bd_info *bd) if (!eth_env_get_enetaddr("btaddr", mac)) { msm_generate_mac_addr(mac); -/* The BD address is same as WLAN MAC address but with - * least significant bit flipped. - */ - mac[0] ^= 0x01; + /* + * The BD address is same as WLAN MAC address but with + * least significant bit flipped. + */ + mac[ARP_HLEN - 1] ^= 0x01; }; + /* + * Reverse array since local-bd-address is formatted with least + * significant byte first (little endian). + */ + for (i = 0; i < ARP_HLEN / 2; ++i) { + u8 tmp = mac[i]; + + mac[i] = mac[ARP_HLEN - 1 - i]; + mac[ARP_HLEN - 1 - i] = tmp; + } + do_fixup_by_compat(blob, "qcom,wcnss-bt", "local-bd-address", mac, ARP_HLEN, 1); return 0; diff --git a/board/qualcomm/dragonboard410c/dragonboard410c.env b/board/qualcomm/dragonboard410c/dragonboard410c.env index 9d9a575a0c3..38399d65c64 100644 --- a/board/qualcomm/dragonboard410c/dragonboard410c.env +++ b/board/qualcomm/dragonboard410c/dragonboard410c.env @@ -1,36 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0+ */ - -/* Does what recovery does */ -#define REFLASH(file, partnum) \ -part start mmc 0 partnum start && \ -part size mmc 0 partnum size && \ -tftp $loadaddr file && \ -mmc write $loadaddr $start $size && - -reflash= -mmc dev 0 && -usb start && -dhcp && -tftp $loadaddr dragonboard/rescue/gpt_both0.bin && -mmc write $loadaddr 0 43 && -mmc rescan && -REFLASH(dragonboard/rescue/NON-HLOS.bin, 1) -REFLASH(dragonboard/rescue/sbl1.mbn, 2) -REFLASH(dragonboard/rescue/rpm.mbn, 3) -REFLASH(dragonboard/rescue/tz.mbn, 4) -REFLASH(dragonboard/rescue/hyp.mbn, 5) -REFLASH(dragonboard/rescue/sec.dat, 6) -REFLASH(dragonboard/rescue/emmc_appsboot.mbn, 7) -REFLASH(dragonboard/u-boot.img, 8) -usb stop && -echo Reflash completed - -loadaddr=0x81000000 initrd_high=0xffffffffffffffff -linux_image=Image -kernel_addr_r=0x81000000 -fdtfile=qcom/apq8016-sbc.dtb -fdt_addr_r=0x83000000 -ramdisk_addr_r=0x84000000 -scriptaddr=0x90000000 -pxefile_addr_r=0x90100000 +fastboot=fastboot -l $fastboot_addr_r usb 0 +boot_targets=usb mmc1 mmc0 pxe +button_cmd_0_name=vol_down +button_cmd_0=run fastboot diff --git a/board/qualcomm/dragonboard820c/dragonboard820c.c b/board/qualcomm/dragonboard820c/dragonboard820c.c index d3333a59db0..12a9273ec4b 100644 --- a/board/qualcomm/dragonboard820c/dragonboard820c.c +++ b/board/qualcomm/dragonboard820c/dragonboard820c.c @@ -106,7 +106,7 @@ int misc_init_r(void) int ret; enum button_state_t state; - ret = button_get_by_label("pwrkey", &btn); + ret = button_get_by_label("Power Button", &btn); if (ret < 0) { printf("Couldn't find power button!\n"); return ret; diff --git a/board/qualcomm/dragonboard820c/readme.txt b/board/qualcomm/dragonboard820c/readme.txt index 966e9520e85..a01d24122cb 100644 --- a/board/qualcomm/dragonboard820c/readme.txt +++ b/board/qualcomm/dragonboard820c/readme.txt @@ -16,10 +16,7 @@ Build & Run instructions ================================================================================ -1) Install mkbootimg and dtbTool from Codeaurora: - - git://codeaurora.org/quic/kernel/skales - commit 8492547e404e969262d9070dee9bdd15668bb70f worked for me. +1) Install mkbootimg 2) Setup CROSS_COMPILE to aarch64 compiler or if you use ccache just do CROSS_COMPILE="ccache aarch64-linux-gnu-" @@ -33,15 +30,15 @@ $ touch rd -5) Generate qualcomm device tree table with dtbTool +5) Append the dtb to the u-boot binary discarding the internal dtb. - $ dtbTool -o dt.img arch/arm/dts + $ gzip u-boot-nodtb.bin + $ cat u-boot.dtb >> u-boot-nodtb.bin.gz 6) Generate Android boot image with mkbootimg: - $ mkbootimg --kernel=u-boot-dtb.bin \ + $ mkbootimg --kernel=u-boot-nodtb.bin.gz \ --output=u-boot.img \ - --dt=dt.img \ --pagesize 4096 \ --base 0x80000000 \ --ramdisk=rd \ @@ -251,44 +248,42 @@ Wait for 5 seconds before proceeding [5300] booting linux @ 0x80080000, ramdisk @ 0x82200000 (0), tags/device tree @ 0x82000000 [5310] Jumping to kernel via monitor -U-Boot 2017.11-00145-ge895117 (Nov 29 2017 - 10:04:06 +0100) +U-Boot 2025.04-rc5-00020-g40a61ca0e7eb-dirty (Apr 07 2025 - 09:37:03 +0200) Qualcomm-DragonBoard 820C -DRAM: 3 GiB -PSCI: v1.0 -MMC: sdhci@74a4900: 0 +DRAM: 3.5 GiB (effective 3 GiB) +Core: 136 devices, 18 uclasses, devicetree: board +MMC: Bulk clocks not available (-19), trying core clock +mmc@74a4900: 0 +Loading Environment from EXT4... OK In: serial@75b0000 Out: serial@75b0000 Err: serial@75b0000 -Net: Net Initialization Skipped -No ethernet found. +Net: No ethernet found. Hit any key to stop autoboot: 0 switch to partitions #0, OK mmc0 is current device Scanning mmc 0:1... Found /extlinux/extlinux.conf Retrieving file: /extlinux/extlinux.conf -433 bytes read in 71 ms (5.9 KiB/s) 1: nfs root - +Enter choice: 1: nfs root Retrieving file: /uImage -19397184 bytes read in 2024 ms (9.1 MiB/s) -append: root=/dev/nfs rw nfsroot=192.168.1.2:/db820c/rootfs,v3,tcp rootwait ip=dhcp consoleblank=0 console=tty0 console=ttyMSM0,115200n8 earlyprintk earlycon=msm_serial_dm,0x75b0000 androidboot.bootdevice=624000.ufshc androidboot.verifiedbootstate=orange androidboot.ver0 - +append: root=/dev/nfs rw nfsroot=192.168.1.6:/home/jramirez/Src/qualcomm-lt/db820c/rootfs,v3,tcp rootwait ip=dhcp consoleblank=0 console=tty0 console=ttyMSM0,115200n8 earlyprintk earlyco0 Retrieving file: /apq8096-db820c.dtb -38134 bytes read in 37 ms (1005.9 KiB/s) - -## Booting kernel from Legacy Image at 95000000 ... +## Booting kernel from Legacy Image at 155000000 ... Image Name: Dragonboard820c Image Type: AArch64 Linux Kernel Image (uncompressed) Data Size: 19397120 Bytes = 18.5 MiB Load Address: 80080000 Entry Point: 80080000 Verifying Checksum ... OK -## Flattened Device Tree blob at 93000000 - Booting using the fdt blob at 0x93000000 - Loading Kernel Image ... OK - Using Device Tree in place at 0000000093000000, end 000000009300c4f5 +## Flattened Device Tree blob at 148600000 + Booting using the fdt blob at 0x148600000 +Working FDT set to 148600000 + Loading Kernel Image to 80080000 + Using Device Tree in place at 0000000148600000, end 000000014860c4f5 +Working FDT set to 148600000 Starting kernel ... diff --git a/board/qualcomm/qcom-phone.config b/board/qualcomm/qcom-phone.config new file mode 100644 index 00000000000..913c91757c1 --- /dev/null +++ b/board/qualcomm/qcom-phone.config @@ -0,0 +1,29 @@ +# Settings for phones +CONFIG_DEFAULT_ENV_FILE="board/qualcomm/qcom-phone.env" +# Hang on panic so the error message can be read +CONFIG_PANIC_HANG=y +# We use pause in various places to allow text to be read +# before it scrolls off the screen +CONFIG_CMD_PAUSE=y +CONFIG_BOOT_RETRY=y +CONFIG_BOOT_RETRY_TIME=1 +CONFIG_BUTTON_REMAP_PHONE_KEYS=y +CONFIG_RETRY_BOOTCMD=y +CONFIG_FASTBOOT_BUF_ADDR=0x1A000000 +CONFIG_USB_FUNCTION_FASTBOOT=y +CONFIG_USB_FUNCTION_ACM=y +CONFIG_CMD_UMS_ABORT_KEYED=y + +# Record all console output and let it be dumped via fastboot +CONFIG_CONSOLE_RECORD=y +CONFIG_CONSOLE_RECORD_INIT_F=y +CONFIG_CONSOLE_RECORD_OUT_SIZE=0x6000 +CONFIG_FASTBOOT_CMD_OEM_CONSOLE=y + +# Only MMC is supported by fastboot currently, but this is still useful. +CONFIG_FASTBOOT_FLASH=y +CONFIG_FASTBOOT_FLASH_MMC_DEV=0 +CONFIG_FASTBOOT_OEM_RUN=y + +# Many phones don't actually define a serial port in their DTS +# CONFIG_REQUIRE_SERIAL_CONSOLE is not set diff --git a/board/qualcomm/qcom-phone.env b/board/qualcomm/qcom-phone.env new file mode 100644 index 00000000000..e91ae3ecdfb --- /dev/null +++ b/board/qualcomm/qcom-phone.env @@ -0,0 +1,47 @@ +bootdelay=0 +bootretry=1 +stdin=serial,button-kbd +stdout=serial,vidconsole +stderr=serial,vidconsole + +# Fastboot is keen to use the address from kconfig, but we +# allocate its buffer at runtime. +fastboot=fastboot -l $fastboot_addr_r usb 0 + +# Always probe for UFS storage, though it should be done by board code. +preboot=scsi scan + +# Shortcut to enable USB serial gadget and disable bootretry +serial_gadget=setenv stdin serial,button-kbd,usbacm; \ + setenv stdout serial,vidconsole,usbacm; \ + setenv stderr serial,vidconsole,usbacm; \ + setenv bootretry -1; \ + echo Enabled U-Boot console serial gadget + +# bootretry will run this command over and over, if we fail once +# then bail out to the boot menu instead (with a pause to read +# the error message) +bootcmd=bootefi bootmgr; pause; run menucmd + +# When entering the menu (either from button press or failed boot) +# remap bootcmd so it will re-open the menu and we won't get stuck +# at the console with no way to type +menucmd=setenv bootcmd run menucmd; bootmenu -1 + +# Pause is used so the output can be read on the display +bootmenu_0=Boot=bootefi bootmgr; pause +bootmenu_1=Enable serial console gadget=run serial_gadget +bootmenu_2=Enable USB mass storage=echo "Press any key to exit UMS mode"; ums 0 scsi 0 +bootmenu_3=Enable fastboot mode=run fastboot +# Disabling bootretry means we'll just drop the shell +bootmenu_4=Drop to shell=setenv bootretry -1 +bootmenu_5=Reset device=reset +bootmenu_6=Dump clocks=clk dump; pause +bootmenu_7=Dump environment=printenv; pause +bootmenu_8=Board info=bdinfo; pause +bootmenu_9=Dump bootargs=fdt print /chosen bootargs; pause + +# Allow holding the volume down button while U-Boot loads to enter +# the boot menu +button_cmd_0_name=Volume Down +button_cmd_0=run menucmd |
