summaryrefslogtreecommitdiff
path: root/arch/arm/mach-snapdragon
AgeCommit message (Collapse)Author
2026-06-24treewide: move bi_dram[] from bd to gdIlias Apalodimas
Currently, the bi_dram[] information is stored in the board info structure (bd). Because bd is only valid after reserve_board(), dram_init_banksize() must be called late in the initialization process. This limitation is problematic, as it forces us to rely on a variety of bespoke functions to determine board RAM, bank memory sizes, and other early setup requirements. By moving bi_dram[] into the global data (gd), we can run it earlier. This is particularly convenient since boards define their own dram_init_banksize() routines, which do not always rely on parsing Device Tree (DT) memory nodes. Additionally, U-Boot defaults to relocating to the top of the first memory bank. While boards currently use custom functions to override this behavior, having the DRAM bank information available earlier in gd makes relocating to a different bank trivial and standardizes the process. Reviewed-by: Anshul Dalal <[email protected]> Tested-by: Michal Simek <[email protected]> # Versal Gen 2 Vek385 Tested-by: Anshul Dalal <[email protected]> Reviewed-by: Simon Glass <[email protected]> Signed-off-by: Ilias Apalodimas <[email protected]> Tested-by: Christophe Leroy (CS GROUP) <[email protected]>
2026-04-27mach-snapdragon: of_fixup: Add OP-TEE DT fixup supportSumit Garg
Add support for OP-TEE live tree DT fixup support which enables U-Boot OP-TEE driver to be probed. As well as the EFI DT fixup protocol allows the live tree fixup to be carried over to the OS for the OP-TEE driver in the OS to probe as well. Note that this fixup only gets applied if OP-TEE support is detected via checking for OP-TEE message UID. Signed-off-by: Sumit Garg <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Casey Connolly <[email protected]>
2026-04-27arch: arm: mach-snapdragon: Auto-detect USB SSPHY driver supportBalaji Selvanathan
Automatically detect super-speed USB PHY driver availability and skip the USB speed fixup if driver is available, eliminating the need for manual configuration. Previously, U-Boot unconditionally limited USB to high-speed mode on all Qualcomm platforms because most lacked super-speed PHY drivers. This change implements runtime detection that checks if a PHY driver exists for the super-speed PHY node referenced by the DWC3 controller. The fixup is automatically skipped when a compatible driver is found, allowing the hardware to operate at full capability. Platforms without super-speed PHY drivers continue to receive the fixup automatically. Signed-off-by: Balaji Selvanathan <[email protected]> [casey: rebased on flat-dwc3 dt support + fix Balaji's signoff] [casey: make erroneous printf() a debug() again] Link: https://patch.msgid.link/[email protected] Signed-off-by: Casey Connolly <[email protected]>
2026-04-27mach-snapdragon: allocate memory for DT overlaysAntony Kurniawan Soemardi
Allocate a 1 MiB LMB region for fdtoverlay_addr_r when CONFIG_OF_LIBFDT_OVERLAY is enabled, allowing runtime application of DT overlays on Snapdragon platforms. This is useful for Android-based boot flows where the final DT passed to the kernel must contain modified /firmware/android/fstab entries. One use case is redirecting system and vendor partitions to microSD storage instead of internal eMMC without rebuilding the base DTB. The allocation is conditional on CONFIG_OF_LIBFDT_OVERLAY and has no effect on boards that do not enable overlay support. Signed-off-by: Antony Kurniawan Soemardi <[email protected]> Reviewed-by: Sumit Garg <[email protected]> Reviewed-by: Casey Connolly <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Casey Connolly <[email protected]>
2026-04-27mach-snapdragon: Remove RPMH power domain DT fixup codeAswin Murugan
Remove the device tree fixup code that was stripping power-domains properties from device tree nodes. This fixup was a temporary workaround needed when RPMH power domain driver support was not available in U-Boot. Now that RPMH power domain driver support has been added, the power domain properties can be preserved in the device tree, allowing proper power domain management. If a suitable power domain driver is not found for the power-controller node, it will be handled with a warning in dev_power_domain_ctrl(). Reviewed-by: Varadarajan Narayanan <[email protected]> Signed-off-by: Aswin Murugan <[email protected]> Reviewed-by: Sumit Garg <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Casey Connolly <[email protected]>
2026-04-07arm: Remove redundant "xPL_SYS_MALLOC_F default y" entriesTom Rini
The symbol SPL_SYS_MALLOC_F defaults to y when visible and TPL_SYS_MALLOC_F defaults to y when visible and SPL_SYS_MALLOC_F is enabled. Remove the places from Kconfig files that had unneccsary "default y" for these options. Signed-off-by: Tom Rini <[email protected]>
2026-01-14mach-snapdragon: of_fixup: support new flat dwc3 nodeCasey Connolly
Qualcomm DTs are being updated to use a new format where the dwc3 glue node and controller are combined into a single DT node. Update the fixup code to handle this case. Reviewed-by: Neil Armstrong <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Casey Connolly <[email protected]>
2026-01-14mach-snapdragon: capsule_update: Fix eMMC detection for non-UFS devicesAlexey Minnekhanov
Currently (since 2026.01-rc) on all SDM630/660 based devices this is printed, after observing long boot delay (several seconds) before executing preboot commands: QCOM-FMP: Failed to find boot partition find_target_partition() function incorrectly assumes that eMMC is always at number 0. In general you can't rely on device numbering to determine if particular block device is eMMC or SD-card, because it depends on how aliases are defined in device tree "chosen" node. Some SoCs have MMC numbers starting at 1, not 0; so mmc1 is eMMC, mmc2 is SD-card. Make eMMC detection reliable by using IS_SD() macro from mmc.h header. Using this method target boot partition can be found successfully. With debug prints enabled, this is printed: QCOM-FMP: skipped SD-Card (devnum 2) QCOM-FMP: Capsule update target: boot (disk 1:60) QCOM-FMP: DFU string: 'mmc 0=u-boot.bin part 1 60' Without debug prints nothing is printed, no error about failure to find boot partition. Fixes: fe80a5f80095 ("mach-snapdragon: CapsuleUpdate: support all boot methods") Signed-off-by: Alexey Minnekhanov <[email protected]> Reviewed-by: Casey Connolly <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Casey Connolly <[email protected]>
2025-08-13mach-snapdragon: fix erroneous lmb allocationsCasey Connolly
In commit 6e4675b8e5d8 ("lmb: replace the lmb_alloc() and lmb_alloc_base() API's") an additional allocation was mistakenly introduced resulting in ${kernel_comp_size} containing the address of a second 64mb region rather than the actual value of KERNEL_COMP_SIZE. Additionally, in commit b40d7b8f72f1 ("Merge patch series "lmb: use a single API for all allocations"") merge conflict resulted in an additional 128mb allocation for ${loadaddr} when CONFIG_FASTBOOT is enabled, where it should actually be set to the same value as ${fastboot_addr_r} to respect size constraints (and since it doesn't seem to interfer with any bootflows). Fixup both of these, freeing up 192mb of memory. Fixes: 6e4675b8e5d8 ("lmb: replace the lmb_alloc() and lmb_alloc_base() API's") Fixes: b40d7b8f72f1 ("Merge patch series "lmb: use a single API for all allocations"") Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Casey Connolly <[email protected]>
2025-07-28treewide: fix Casey's nameCasey Connolly
I updated the mailmap a while back but it's nice to have authorship comments adjusted too. Signed-off-by: Casey Connolly <[email protected]>
2025-06-25Merge patch series "lmb: use a single API for all allocations"Tom Rini
Sughosh Ganu <[email protected]> says: The LMB module has a bunch for API's which are used for allocating memory. There are a couple of API's for requesting memory, and two more for reserving regions of memory. Replace these different API's with a single one, lmb_alloc_mem(). The type of allocation to be made is specified through one of the parameters to the function. Additionally, the two API's for reserving regions of memory, lmb_reserve() and lmb_alloc_addr() are the same with one difference. One can reserve any memory region with lmb_reserve(), while lmb_alloc_addr() actually checks that the memory region being requested is part of the LMB memory map. Reserving memory that is not part of the LMB memory map is pretty futile -- the allocation functions do not allocate memory which has not been added to the LMB memory map. This series also removes the functionality allowing for reserving memory regions outside the LMB memory map. Any request for reserving a region of memory outside the LMB memory map now returns an -EINVAL error. Certain places in the common code using the LMB API's were not checking the return value of the functions. Checks have been added for them. There are some calls being made from the architecture/platform specific code which too do not check the return value. Those have been kept the same, as I do not have the platform with me to check if it causes any issues on those platforms. In addition, there is a patch which refactors code in lmb_overlaps_region() and lmb_can_reserve_region() so that both functionalities can be put in a single function, lmb_overlap_checks(). Finally, a new patch has been added which checks the return value of the lmb allocation function before copying the device-tree to the allocated address. Link: https://lore.kernel.org/r/[email protected] [trini: Rework arch/arm/mach-snapdragon/board.c merge] Signed-off-by: Tom Rini <[email protected]>
2025-06-25mach-snapdragon: add a check before copying FDT to fdt_addr_rSughosh Ganu
The board_late_init() function allocates memory for a bunch of environment variables, including fdt_addr_r. The device-tree then gets copied to the memory pointed to by fdt_addr_r. However, the memory allocation request can fail, in which case the address that is being written to would not be allocated. Add a check that the memory allocation has succeeded before copying the device-tree. Signed-off-by: Sughosh Ganu <[email protected]>
2025-06-25lmb: replace the lmb_alloc() and lmb_alloc_base() API'sSughosh Ganu
There currently are two API's for requesting memory from the LMB module, lmb_alloc() and lmb_alloc_base(). The function which does the actual allocation is the same. Use the earlier introduced API lmb_alloc_mem() for both types of allocation requests. Signed-off-by: Sughosh Ganu <[email protected]> Acked-by: Ilias Apalodimas <[email protected]>
2025-06-24mach-snapdragon: CapsuleUpdate: support all boot methodsCaleb Connolly
Expand capsule update support to correctly identify which partition U-Boot is flashed to (between xbl, uefi, and boot including A/B variants). Use qcom_boot_source to determine if we were chainloaded from ABL, meaning U-Boot is on the boot partition, otherwise we assume uefi if it's available, finally leaving the xbl partition. Set a different fw_name based on the target partition to prevent GUID collisions, since a board may support U-Boot flashed to boot or XBL we need to differentiate them since the U-Boot binary must be built differently. Reviewed-by: Neil Armstrong <[email protected]> Signed-off-by: Caleb Connolly <[email protected]> Link: https://lore.kernel.org/r/20250411-b4-qcom-capsule-update-improvements-v2-2-27f6b2fcc4a9@linaro.org Signed-off-by: Casey Connolly <[email protected]>
2025-06-24mach-snapdragon: track boot sourceCaleb Connolly
Keep track of whether we were loaded via ABL or if U-Boot is running as a first-stage bootloader. For now we set this based on if we have a valid external FDT or not, since it isn't possible to chainload U-Boot from ABL without there being an external FDT. This will be used to inform the capsule update logic which partition U-Boot is flashed to. Signed-off-by: Caleb Connolly <[email protected]> Link: https://lore.kernel.org/r/20250411-b4-qcom-capsule-update-improvements-v2-1-27f6b2fcc4a9@linaro.org Signed-off-by: Casey Connolly <[email protected]>
2025-06-24mach-snapdragon: Enhance android image handling memory footprintGeorge Chan
In order to unzipped kernel from androidboot img, extra memory for loadaddr is needed. So once fastboot is enabled fastboot memory also share with loadaddr. That can balance with memory constrain soc and android usecase. Reviewed-by: Neil Armstrong <[email protected]> Signed-off-by: George Chan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Casey Connolly <[email protected]>
2025-06-24mach-snapdragon: of_fixup: Drop USB dr_mode override for RB1/2Sumit Garg
The default DIP switch configuration on RB1/2 is to enable flashing support via USB type-c port either using QDL or fastboot. It's just cumbersome to get the host mode working in U-Boot via DIP switch toggle when you need the flashing capability using the type-c port. So instead lets enable fastboot in U-Boot for RB1/2 boards which is more useful in the default board DIP switch configuration. This let's us to drop dr_mode DT fixup. Signed-off-by: Sumit Garg <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Casey Connolly <[email protected]>
2025-06-02mach-snapdragon: Update fdtfile logic to work for RB1 and RB2Sumit Garg
RB1 and RB2 have three root compatibles where the last one can't be used to decode fdtfile name (qcm* vs qrb*). So rather just rely on the first compatible to retrieve the SoC name. Signed-off-by: Sumit Garg <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Casey Connolly <[email protected]>
2025-05-02Merge patch series "Qualcomm: cleanup OF_LIVE fixup and fix RB1/2"Tom Rini
Caleb Connolly <[email protected]> says: Introduce a new event to signal that the live tree has been built, allowing boards to perform fixups on the tree before devices are bound. Crucially this allows for devices to be enabled or disabled, but also allows for properties that are parsed during the bind stage to be modified (such as dr_mode for dwc3). With this in place, mach-snapdragon is switched over to use the event and some hacky U-Boot specific DT overrides (which had to be undone prior to booting an image) are removed in favour of fixing up the livetree (which is not passed on to further boot stages). Finally, some minor fixes are made for the QCM2290 RB1 board, the sdcard is enabled and it now uses USB host mode in U-Boot like it's bigger sibling the RB2. Link: https://lore.kernel.org/r/[email protected]
2025-05-02mach-snapdragon: of_fixup: set dr_mode for RB1/2 boardsCaleb Connolly
The RB1 and RB2 have a single USB controller which is manually muxed between a type-c port and an internal USB hub via a DIP switch. OTG is supported in Linux, but the DWC3 driver in U-Boot can only handle a single mode, and defaults to peripheral mode. We did hack around this on the RB2, but the RB1 got left out. Now that we can fix up the live tree before devices are bound, drop the DTS hacks and do the fixup at runtime instead. Reviewed-by: Sumit Garg <[email protected]> Reviewed-by: Neil Armstrong <[email protected]> Tested-by: Sumit Garg <[email protected]> Signed-off-by: Caleb Connolly <[email protected]>
2025-05-02mach-snapdragon: of_fixup: update commentCaleb Connolly
we don't rewrite the volume buttons any more. Signed-off-by: Caleb Connolly <[email protected]> Reviewed-by: Neil Armstrong <[email protected]>
2025-05-02mach-snapdragon: of_fixup: remove confusing log messageCaleb Connolly
The debug log here had the logic completely backwards, even though the code is actually correct. Remove it since it's extraneous anyway. Signed-off-by: Caleb Connolly <[email protected]> Reviewed-by: Neil Armstrong <[email protected]>
2025-05-02mach-snapdragon: of_fixup: skip disabled USB nodesCaleb Connolly
There's no need to waste time fixing up nodes that aren't used on this device. Skip them. Reviewed-by: Sumit Garg <[email protected]> Reviewed-by: Neil Armstrong <[email protected]> Tested-by: Sumit Garg <[email protected]> Signed-off-by: Caleb Connolly <[email protected]>
2025-05-02mach-snapdragon: use EVT_OF_LIVE_INIT to apply DT fixupsCaleb Connolly
This will now apply fixups prior to devices being bound, which makes it possible to enable/disable devices and adjust more properties that might be read before devices probe. Signed-off-by: Caleb Connolly <[email protected]>
2025-04-11pinctrl: qcom: handle reserved rangesCaleb Connolly
Some Qualcomm boards feature reserved ranges of pins which are protected by firmware. Attempting to read or write any registers associated with these pins results the board resetting. Add support for parsing these ranges from devicetree and ensure that the pinctrl and GPIO drivers don't try to interact with these pins. Signed-off-by: Neil Armstrong <[email protected]> Reviewed-by: Sumit Garg <[email protected]> Link: https://lore.kernel.org/r/20250410-topic-sm8x50-pinctrl-reserved-ranges-v2-1-654488392b9a@linaro.org Signed-off-by: Caleb Connolly <[email protected]>
2025-04-10mach-snapdragon: of_fixup: fix condition check in ft_board_setup()Caleb Connolly
The fdt_node_check_compatible() function returns 0 on success which is pretty confusing, and we were using it wrong! Invert the condition check and refactor things to be more readable. Additionally, add the check for the RB1 which needs the same fixup as the RB2. Reported-by: Sam Day <[email protected]> Fixes: e64503f1fcdf ("mach-snapdragon: implement ft_board_setup() for USB role selection") Tested-by: Alexey Minnekhanov <[email protected]> Tested-by: Sam Day <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Caleb Connolly <[email protected]>
2025-04-10mach-snapdragon: of_fixup: fix property length at writingRui Miguel Silva
The length of a property includes '\0' in a string type one, so the length passed by needs to have that in account, if not, when getting the property value it will fail because it has the wrong size. Signed-off-by: Rui Miguel Silva <[email protected]> Tested-by: [email protected] # db845c Reviewed-by: Caleb Connolly <[email protected]> Reviewed-by: Neil Armstrong <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Caleb Connolly <[email protected]>
2025-03-17mach-snapdragon: use PSCI sysreset driverSam Day
Drop the `board_reset` function from mach-snapdragon board code, and instead use the standard PSCI sysreset driver. Signed-off-by: Sam Day <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Caleb Connolly <[email protected]>
2025-03-17mach-snapdragon: handle platforms without PSCI supportSam Day
Most MSM8916 devices shipped without PSCI support. The history is quite nuanced (a good overview can be found in [1]), but the end result is that the upstream DTs for this SoC pretend that PSCI exists, and it's expected that the bootloader handles the case where it doesn't. This is codified by the de-facto bootloader for MSM8916 devices, lk2nd [2]. So we handle it here by deleting the /psci node if we detect the absence of PSCI. We need to do this early to ensure sysreset works correctly, since the PSCI firmware driver is PRE_RELOC and binds the PSCI sysreset driver. Additionally, show_psci_version is updated to check that PSCI exists. Currently this banner outputs "PSCI: 65535.65535" on devices without PSCI support, which isn't very useful :) [1]: https://github.com/msm8916-mainline/linux/issues/388 [2]: https://github.com/msm8916-mainline/lk2nd/blob/8183ea2/lk2nd/smp/spin-table/spin-table.c#L237 Signed-off-by: Sam Day <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Caleb Connolly <[email protected]>
2025-03-17mach-snapdragon: support parsing memory info from external FDTSam Day
qcom_parse_memory is updated to return a -ENODATA error if the passed FDT does not contain a /memory node, or that node is incomplete (size=0) board_fdt_blob_setup first tries to call qcom_parse_memory with the internal FDT (if present+valid). If that fails, it tries again with the external FDT (again, if present+valid). When booting with an internal FDT from upstream, it's likely that this change results in a slight performance hit, since virtually all upstream qcom DTs lack a fully specified memory node. The impact should be negligible, though. qcom_parse_memory was given a detailed docstring adapted from Caleb's original commit message that introduced the function. Reviewed-by: Caleb Connolly <[email protected]> Signed-off-by: Sam Day <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Caleb Connolly <[email protected]>
2025-01-22mach-snapdragon: pass fdt to qcom_parse_memorySam Day
commit fc37a73e6679 ("fdt: Swap the signature for board_fdt_blob_setup()") introduced a subtle change to the Snapdragon implementation, removing the assignment to gd->fdt_blob partway through the function. This breaks qcom_parse_memory() which was also called during board_fdt_blob_setup(). The underlying issue here is that qcom_parse_memory is using the of_ api to traverse a devicetree, which relies on the fdt_blob in global data. Rather than relying on this subtle behaviour, explicitly pass the FDT that should be consulted for a /memory node. Using the OF API is typically preferable because it's easier to read, but using the lower level fdt_ methods instead here doesn't add too much complexity, I think. Finally, a minor tweak was made to board_fdt_blob_setup to use the passed fdt blob pointer instead of gd->fdt_blob, which removes the last of the references to global data in this area. Fixes: fc37a73e6679 (fdt: Swap the signature for board_fdt_blob_setup()) Reviewed-by: Caleb Connolly <[email protected]> Signed-off-by: Sam Day <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Caleb Connolly <[email protected]>
2024-12-18fdt: Swap the signature for board_fdt_blob_setup()Simon Glass
This returns a devicetree and updates a parameter with an error code. Swap it, since this fits better with the way U-Boot normally works. It also (more easily) allows leaving the existing pointer unchanged. No yaks were harmed in this change, but there is a very small code-size reduction. For sifive, the OF_BOARD option must be set for the function to be called, so there is no point in checking it again. Also OF_SEPARATE is defined always. Signed-off-by: Simon Glass <[email protected]> Reviewed-by: Matthias Brugger <[email protected]> Reviewed-by: Patrice Chotard <[email protected]> [trini: Update total_compute] Signed-off-by: Tom Rini <[email protected]>
2024-11-20mach-snapdragon: implement capsule update supportCaleb Connolly
Qualcomm boards flash U-Boot a variety of partitions, implement support for determining which slot U-Boot is running from, finding the correct partition for that slot and configuring the appropriate DFU string. Initially, we only support the RB3 Gen 2 where U-Boot is flashed to the UEFI partition, and ignore handling of slots. In the future we will additionally support booting U-Boot from other partitions (e.g. boot) and correct handling for A/B. Reviewed-by: Neil Armstrong <[email protected]> Acked-by: Ilias Apalodimas <[email protected]> Signed-off-by: Caleb Connolly <[email protected]>
2024-11-20mach-snapdragon: configure loggingCaleb Connolly
Set LOG_CATEGORY and pr_fmt. Also fix the time.h include. Reviewed-by: Neil Armstrong <[email protected]> Signed-off-by: Caleb Connolly <[email protected]>
2024-11-20ARM: mach-snapdragon: configure a larger default SYS_MALLOC_LEN for fastbootNeil Armstrong
Fastboot is very hungry when it flashes larges chunks, and 8MiB is way too small, allocate a much bigger size like other platforms using Fastboot. Signed-off-by: Neil Armstrong <[email protected]> Tested-by: Caleb Connolly <[email protected]> # rb1 Reviewed-by: Caleb Connolly <[email protected]>
2024-09-30power: regulator: Drop regulators_enable_boot_on/off()Marek Vasut
Both regulators_enable_boot_on/off() are unused and superseded by regulator uclass regulator_post_probe(). Remove both functions. Signed-off-by: Marek Vasut <[email protected]>
2024-09-06mach-snapdragon: set loadaddrCaleb Connolly
This variable is used by default in some commands, set it to the same as kernel_addr_r. Reviewed-by: Neil Armstrong <[email protected]> Signed-off-by: Caleb Connolly <[email protected]>
2024-09-06mach-snapdragon: populate fallback FDTCaleb Connolly
Set the fdt_addr_r environment variable to a region of LMB allocated memory, and populate it by default with a copy of U-Boots FDT. This will be used for Linux if no other DT is provided. Reviewed-by: Neil Armstrong <[email protected]> Signed-off-by: Caleb Connolly <[email protected]>
2024-09-06mach-snapdragon: allocate fastboot buffer dynamicallyCaleb Connolly
We don't know at build time where a sensible place for this is, allocate it at runtime like the other variables. Reviewed-by: Neil Armstrong <[email protected]> Signed-off-by: Caleb Connolly <[email protected]>
2024-09-06mach-snapdragon: set serial numberCaleb Connolly
In the typical case where we chainload from ABL, the serial number is available in the DT bootargs. Read it out and set the serial# environment variable so that it can be used by fastboot. Reviewed-by: Neil Armstrong <[email protected]> Signed-off-by: Caleb Connolly <[email protected]>
2024-09-06mach-snapdragon: use 1MiB for get_page_table_size()Neil Armstrong
With 14+ entries in the memory map, we need quite a bit more space for the page tables. Signed-off-by: Neil Armstrong <[email protected]> Signed-off-by: Caleb Connolly <[email protected]>
2024-09-06mach-snapdragon: parse memory ourselvesCaleb Connolly
The generic memory parsing code in U-Boot lacks a few things that we need on Qualcomm: 1. It sets gd->ram_size and gd->ram_base to represent a single memory block. 2. setup_dest_addr() later relocates U-Boot to ram_base + ram_size, the end of that first memory block. This results in all memory beyond U-Boot being unusable in Linux when booting with EFI. Since the ranges in the memory node may be out of order, the only way for us to correctly determine the relocation address for U-Boot is to parse all memory regions and find the highest valid address. We can't use fdtdec_setup_memory_banksize() since it stores the result in gd->bd which is not yet allocated. Hence, this commit, which implements an optimised parser to read the memory blocks and store them in the .data section where they will survive relocation. We set ram_base and ram_size to describe the entire address space of memory, with the assumption that the last memory region is big enough for U-Boot, its DTB, and heap. On all boards tested so far this seems to be a reasonable assumption. As a nice side effect, our fdt parsing also winds up being faster since we avoid the overhead of checking address/size-cells or populating struct resource. We can safely make these optimisations since we only support ARM64, and trust the reg property to be populated correctly. After relocation, we then populate gd->bd->bi_dram with the data we parsed earlier. Reviewed-by: Neil Armstrong <[email protected]> Signed-off-by: Caleb Connolly <[email protected]>
2024-09-06mach-snapdragon: refactor board_fdt_blob_setup()Caleb Connolly
If U-Boot has a DTB built in (appended to the image directly) then this was likely intentional, we should prioritise it over one provided by ABL (if there was one). Make this behaviour explicit, and panic if no valid DTB could be found anywhere. Returning an error is not useful in this case as U-Boot would just crash later in a more confusing way. Reviewed-by: Neil Armstrong <[email protected]> Signed-off-by: Caleb Connolly <[email protected]>
2024-09-03lmb: remove the lmb_init_and_reserve() functionSughosh Ganu
With the changes to make the LMB reservations persistent, the common memory regions are being added during board init. Remove the now superfluous lmb_init_and_reserve() function. Signed-off-by: Sughosh Ganu <[email protected]> Reviewed-by: Simon Glass <[email protected]> Reviewed-by: Ilias Apalodimas <[email protected]>
2024-09-03lmb: make LMB memory map persistent and globalSughosh Ganu
The current LMB API's for allocating and reserving memory use a per-caller based memory view. Memory allocated by a caller can then be overwritten by another caller. Make these allocations and reservations persistent using the alloced list data structure. Two alloced lists are declared -- one for the available(free) memory, and one for the used memory. Once full, the list can then be extended at runtime. [sjg: Use a stack to store pointer of lmb struct when running lmb tests] Signed-off-by: Sughosh Ganu <[email protected]> Signed-off-by: Simon Glass <[email protected]> [sjg: Optimise the logic to add a region in lmb_add_region_flags()]
2024-07-05arm: mach-snapdragon: gpio: introduce msm_special_pin_dataNeil Armstrong
In order to help setup pin configuration for special pins (UFS, SDCard), introduce the msm_special_pin_data struct largely inspired from the Linux conterpart but with only U-Boot required fields. This struct is added to the pins_data to allow specifying the special pins data for each SoC. Signed-off-by: Neil Armstrong <[email protected]> Reviewed-by: Sumit Garg <[email protected]>
2024-05-14mach-snapdragon: do carveouts for qcs404 onlySam Day
The newly introduced carve_out_reserved_memory causes issues when U-Boot is chained from the lk2nd bootloader. lk2nd provides a simple-framebuffer device and marks the framebuffer region as no-map in the supplied /reserved-memory. Consequently, the simple_video driver triggers a page fault when it tries to write to this region. As per Caleb's advice, this simple patch only does the carveouts for the qcs404 SoC for which it was originally designed. The intent is to do the carveouts for more Qualcomm SoCs in future. Signed-off-by: Caleb Connolly <[email protected]>
2024-04-23mach-snapdragon: implement ft_board_setup() for USB role selectionCaleb Connolly
Some Qualcomm boards have only one USB controller which is muxed between the type-c port and an internal USB hub for type-A and ethernet. We modify the DT for these to force them to host mode in U-Boot. However in Linux DRD role switching is supported (required, even). Use ft_board_setup() to adjust the dr_mode property for these boards. While we're here, define pr_fmt for this file so we can more easily identify log messages. Signed-off-by: Caleb Connolly <[email protected]>
2024-04-23mach-snapdragon: Allow other board vendors apart from QcomSumit Garg
Qcom SoCs derived boards can come from various OEMs/ODMs and not just Qcom itself. So allow CONFIG_SYS_VENDOR to be set correctly corressponding to the actual board vendor. Suggested-by: Stephan Gerhold <[email protected]> Reviewed-by: Caleb Connolly <[email protected]> Signed-off-by: Sumit Garg <[email protected]> Signed-off-by: Caleb Connolly <[email protected]>
2024-04-04mach-snapdragon: call regulators_enable_boot_on()Caleb Connolly
Make sure we power on any boot-on or always-on regulators. These are used for peripherals like USB on some platforms. Reviewed-by: Sumit Garg <[email protected]> Reviewed-by: Neil Armstrong <[email protected]> Signed-off-by: Caleb Connolly <[email protected]>