Commit graph

611 commits

Author SHA1 Message Date
Subrata Banik
50099def6f soc/qualcomm/x1p42100: Relocate CBMEM top to PIL region base
The current CBMEM top is situated at the base of 'dram_xbl_log'
(0x81A00000), leaving only 4.4MB of usable memory below it. This
space has become insufficient for the growing size requirements of
the coreboot configuration tables and boot services.

Relocate the CBMEM top to the base of the PIL region (0x866C0000).
This move increases the available contiguous memory for CBMEM
allocation from 4.4MB to 7.3MB, ensuring sufficient headroom for
the tables and reducing fragmentation for the OS and runtime services.

Changes:
- Update cbmem_top_chipset() to return _dram_pil as the new boundary.
- Update memlayout.ld documentation to reflect CBMEM's new position
  directly below the PIL region.

TEST=Verified CBMEM initialization on Bluey; confirmed coreboot
tables are correctly allocated at the new high-memory boundary and
no overlaps occur with reserved regions.

Change-Id: I26d95b952634ce06ed2171c75bc6a129c15ec3b8
Signed-off-by: Subrata Banik <subratabanik@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90912
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Avi Uday <aviuday@google.com>
2026-01-28 05:51:14 +00:00
Subrata Banik
4fa14338ef soc/qualcomm/x1p42100: Align and expand DMA and stack regions
Fix the 4K alignment for PRERAM_DMA_COHERENT and adjust the post-RAM
memory layout to ensure page-aligned boundaries.

- Shift PRERAM_DMA_COHERENT from 0x14857000 to 0x14858000. This 4K
  alignment is required for the MMU to correctly apply uncached
  attributes without overlapping adjacent regions.
- Increase POSTRAM_STACK from 16K to 32K to provide more headroom
  for complex ramstage operations.
- Shift and expand POSTRAM_DMA_COHERENT to 0x8000C000 (16K). This
  ensures the coherent region starts on a 4K boundary after the
  expanded stack, preventing cache coherency issues.

This alignment fix resolves intermittent SPI DMA failures and hash
mismatches observed when the DMA engine was handed unaligned
buffer addresses.

BUG=b:477842629
TEST=Verified successful boot on Bluey; confirmed SPI read
stability and vboot verification pass.

Change-Id: Ic5f813e4722d732c122186897abf845e4060db37
Signed-off-by: Subrata Banik <subratabanik@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90888
Reviewed-by: Derek Huang <derekhuang@google.com>
Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2026-01-27 02:01:20 +00:00
Subrata Banik
c31c194228 soc/qualcomm/x1p42100: Increase SPI bus frequency to 75MHz
Boost the SPI bus clock frequency from 50MHz to 75MHz in the
bootblock early initialization.

This increase reduces the latency for loading subsequent stages
(romstage/ramstage) from the SPI flash. Since the QSPI core
can now be configured to 300MHz, this 75MHz bus speed
maintains a stable 1:4 integer divider ratio, ensuring optimal
signal integrity and timing margins for the flash interface.

BUG=b:478226455
TEST=Verified successful boot on Bluey. Observed a reduction (10ms)
in 'read SPI' duration in the console logs and confirmed that the
vboot hash verification passes consistently.

Change-Id: Idea0dbdd435cbbfe22a756d2b94b1cdfa3c70ffe
Signed-off-by: Subrata Banik <subratabanik@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90887
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
Reviewed-by: Derek Huang <derekhuang@google.com>
2026-01-27 02:01:08 +00:00
Subrata Banik
54e7b5734f soc/qualcomm/x1p42100: Add 75MHz configuration for QSPI core
Add a new frequency entry to the QSPI core clock configuration table
to support 75MHz (75 * 4 = 300MHz).

This is achieved by using the GPLL0 600MHz source with a divisor of 2.

Providing a 300MHz core clock allows for more granular control over
the physical bus speed (SCK). Specifically, it enables a stable 75MHz
SPI bus frequency via a clean 1/4 divider, which is an optimization
target for improving boot times on Bluey/Quenbi platforms.

BUG=b:478226455
TEST=Verified that 'clock_configure_qspi' can correctly look up and
set the 300MHz frequency in romstage.

Change-Id: I5320a68ff50a0d79daa2fc855b18b0f3ae819bbe
Signed-off-by: Subrata Banik <subratabanik@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90886
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Derek Huang <derekhuang@google.com>
2026-01-27 02:01:02 +00:00
Swathi Tamilselvan
b3e8bd4125 soc/qualcomm/x1p42100: Add API support for audio clock configuration
Add API support to enable LPASS core clocks and vote for LP0 BCM
resource required for LPASS. This change includes support to enable
audio clocks.

LPASS is Low Power Audio Subsystem that runs audio and voice
processing on a dedicated DSP. This enables low-power audio operation
while the main CPUs remain in low-power states.

Test=1. Create an image.serial.bin and ensure it boots on X1P42100.

Change-Id: If7684bee10d127866acac80e6aeefadaa177dc1f
Signed-off-by: Swathi Tamilselvan <tswathi@qualcomm.corp-partner.google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90851
Reviewed-by: Subrata Banik <subratabanik@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
2026-01-23 03:47:22 +00:00
Subrata Banik
f9b917d391 soc/qualcomm/x1p42100: Relocate CBMEM top below XBL log
Relocate the CBMEM top address from a hardcoded 0xC7800000 to the
start of the XBL log region (_dram_xbl_log).

This change moves the CBMEM region from the high Linux Kernel Reserve
block down into the lower DRAM Space 0, adjacent to other firmware
reserved regions. This consolidation prevents marking CBMEM range as
`reserved` and ensures CBMEM is placed in a more stable memory location
(marked available aka System RAM).

- Remove CBMEM_TOP define from addressmap.h.
- Update cbmem_top_chipset() to return (uintptr_t)_dram_xbl_log.
- Update memlayout.ld documentation to reflect the new memory map.

BUG=none
TEST=Boot on X1P42100 platform, verify CBMEM console and tables are
accessible and correctly located via 'cbmem -l'.

w/o this patch:

```
c7800000-cb7fffff : reserved
```

w/ this patch:

```
815a0000-819fffff : System RAM
```

Change-Id: I7392bb7a62d50640696301931940a7baa00351e3
Signed-off-by: Subrata Banik <subratabanik@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90760
Reviewed-by: Derek Huang <derekhuang@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
Reviewed-by: Jayvik Desai <jayvik@google.com>
2026-01-16 06:28:36 +00:00
Yu-Ping Wu
a6407000f1 mipi/panel: Add 'poweroff' field to panel_serializable_data
Some payloads such as depthcharge need to run MIPI panel power-off
commands before booting to the kernel. Otherwise, the abnormal power-off
timing would prevent the pixel charge from being cleared before
power-off, leading to the risk of LCD overpotential hence resulting in
image stickiness or flicker upon restarting.

Therefore, add a 'poweroff' field to the panel_serializable_data struct,
which, in a follow-up patch, will be passed to payloads for running the
power-off commands. Each MIPI panel can define the power-off commands in
that field.

As both init and power-off commands are supported, remove "_init" from
related structs and enums.

BUG=b:474187570
TEST=emerge-jedi coreboot libpayload
BRANCH=skywalker

Change-Id: I1a7c0a14d5c197a0887a26269e4c36e498e8b7ae
Signed-off-by: Yu-Ping Wu <yupingso@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90737
Reviewed-by: Yidi Lin <yidilin@google.com>
Reviewed-by: Alicja Michalska <ahplka19@gmail.com>
Reviewed-by: Subrata Banik <subratabanik@google.com>
Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
Reviewed-by: Chen-Tsung Hsieh <chentsung@google.com>
2026-01-14 09:40:54 +00:00
Yu-Ping Wu
b4fbc59c6f treewide: Move mipi_panel_parse_commands() to commonlib
Move the MIPI panel init command parsing function
mipi_panel_parse_init_commands() and related macros and structs from
drivers/mipi/ to commonlib/mipi/, so that the function can be shared
with payloads.

In a follow-up patch, a 'poweroff' field will be added to the
panel_serializable_data struct and then passed to payloads, so that
payloads can utilize mipi_panel_parse_init_commands() to run the panel
poweroff commands.

BUG=b:474187570
TEST=emerge-jedi coreboot libpayload
BRANCH=skywalker

Change-Id: I19011669f03d060e9f030b673687cbe5965d7e2f
Signed-off-by: Yu-Ping Wu <yupingso@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90736
Reviewed-by: Subrata Banik <subratabanik@google.com>
Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Chen-Tsung Hsieh <chentsung@google.com>
Reviewed-by: Alicja Michalska <ahplka19@gmail.com>
Reviewed-by: Julius Werner <jwerner@chromium.org>
Reviewed-by: Yidi Lin <yidilin@google.com>
2026-01-14 09:38:36 +00:00
Kapil Porwal
e303357cb9 soc/qualcomm/x1p42100: Call mainboard Type-C config hook
Update the SoC USB driver to invoke mainboard_usb_typec_configure for
both primary and secondary ports. This is called after the QMP PHY
initialization to ensure the external signal path is correctly
muxed for the detected orientation.

BUG=b:473489095
TEST=Verify USB SS detection on Quartz.

Sample output:
```
firmware-shell: md 0x0a800420 8
0a800420: 000002a0 00000000 00000000 00000000    ................
0a800430: 00001203 00000000 00000000 00000000    ................
firmware-shell: md 0x0a600420 8
0a600420: 000002a0 00000000 00000000 00000000    ................
0a600430: 00001203 00000000 00000000 00000000    ................
```

Change-Id: Ic90a62b1f6ad62a8870c6d5333d06b6a11d26d4f
Signed-off-by: Kapil Porwal <kapilporwal@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90711
Reviewed-by: Pranava Y N <pranavayn@google.com>
Reviewed-by: Jayvik Desai <jayvik@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Subrata Banik <subratabanik@google.com>
2026-01-09 18:18:16 +00:00
Kapil Porwal
17a52ce94e soc/qualcomm/x1p42100: Add mainboard USB Type-C config hook
Add a function declaration for mainboard_usb_typec_configure. This
allows mainboards to implement custom logic for external components,
such as retimers or muxes, that need orientation-aware configuration.

BUG=b:473489095
TEST=Verify USB SS detection on Quartz.

Change-Id: I20d9a23da5b855a413f8358b8783f44c1632ccdf
Signed-off-by: Kapil Porwal <kapilporwal@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90709
Reviewed-by: Pranava Y N <pranavayn@google.com>
Reviewed-by: Subrata Banik <subratabanik@google.com>
Reviewed-by: Jayvik Desai <jayvik@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2026-01-09 18:17:48 +00:00
Swathi Tamilselvan
e1e7b9b203 soc/qualcomm/x1p42100: Add API to enable display clocks
Add API to enable the essential display clocks required for display
subsystem initialization.

Test=1. Build and boot on X1P42100.

Change-Id: Ifc634f2c00eb933bf03b898e132ab5bf137149f8
Signed-off-by: Swathi Tamilselvan <tswathi@qualcomm.corp-partner.google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90468
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
Reviewed-by: Subrata Banik <subratabanik@google.com>
2026-01-05 03:10:37 +00:00
Swathi Tamilselvan
02e6f2a214 soc/qualcomm/x1p42100: Add API to intialize RPMh resources for display
Add API to initialize RPMh resources for display. It includes CMD-DB
initialization, enable the MMCX power rail and cast a vote for the MM0
Bus Clock Manager (BCM) resource to enable display clocks.

Test=1. Create an image.serial.bin and ensure it boots on X1P42100.
2. Verified MMCX rail enablement and MM0 BCM vote using ARC and
BCM AOP dump with API invoking changes hooked up with follow-on
commits.
Serial Log:
[INFO ]  RPMH_REG: Initialized mmcx.lvl at addr=0x30080
[INFO ]  ARC regulator initialized successfully
[DEBUG]  RPMH_REG: Sent active request for mmcx.lvl
[INFO ]  ARC level was set successfully
[DEBUG]  BCM: Found address 0x00050024 for resource MM0
[INFO ]  BCM: Successfully voted for MM0 (addr=0x00050024, val=0x60004001)
[INFO ]  BCM vote for MM0 sent successfully

Change-Id: I1997ce7a1ced4504d6a3170e5f2ddd4f52e0763d
Signed-off-by: Swathi Tamilselvan <tswathi@qualcomm.corp-partner.google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90467
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2026-01-05 03:10:27 +00:00
Swathi Tamilselvan
dc162f84be soc/qualcomm/common: Add RPMh driver support
Add RPMh driver support, introducing the core driver that provides
an interface to the RPMh protocol for managing ARC/VRM/BCM type
resource requests. This includes basic TCS (Trigger Command Sets)
handling and helper functions for sending RPMh requests.

RPMh (Resource Power Manager – hardware) is a protocol that enables
processors (e.g., APSS, LPASS) to send power-related commands to the
RPMh hardware block. Dynamic management of power and clocks for shared
resources is handled either directly by hardware or by RPM.

Key features include:
- Core infrastructure for submitting TCS (Trigger Command Sets)
commands to the RPMh.
- Regulator driver using RPMh for LDOs and SMPS control.
- BCM (Bus Clock Manager) voting for clock resources.

Test=Create an image.serial.bin and ensure it boots on X1P42100.

Change-Id: I1f85459c68d0256e15765b0716856dc928080df9
Signed-off-by: Swathi Tamilselvan <tswathi@qualcomm.corp-partner.google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90466
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
2026-01-05 03:10:19 +00:00
Venkateshwar S
b8402a8dfc src/qualcomm/common: Remove display buffer region declarations
The display buffer reservation logic has been removed, so the related
symbol declarations are no longer needed.

TEST=Create an image.serial.bin and ensure it boots on X1P42100.

Change-Id: I873fdcff4071e0d2cf683017557abdfdb13e8b16
Signed-off-by: Venkateshwar S <vens@qualcomm.corp-partner.google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90653
Reviewed-by: Subrata Banik <subratabanik@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
2026-01-01 17:14:02 +00:00
Venkateshwar S
7896d94c76 soc/qualcomm/x1p42100: Avoid reserving display buffer region
The display buffer was previously reserved as unavailable by coreboot,
which prevented the kernel from mapping it. When the splash driver
released the buffer, the kernel later crashed on access because the
region was never mapped.

This patch removes the reservation so the kernel can map the display
buffer and reuse it safely.

TEST=Create an image.serial.bin and ensure it boots on X1P42100.
Check that the display memory region is mapped by kernel in UART logs:

[    0.000000][    T0]   node   0: [mem 0x00000000e36a0000-
						0x00000000f7bfffff]

Change-Id: I507d48713690bac3030f81a29c7e123fd3a03b95
Signed-off-by: Venkateshwar S <vens@qualcomm.corp-partner.google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90648
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
Reviewed-by: Subrata Banik <subratabanik@google.com>
2026-01-01 17:13:57 +00:00
Venkateshwar S
fe0e14d716 soc/qualcomm/x1p42100: Skip SHRM meta firmware load in ramdump mode
QCLib passes SHRM metadata to TME for authentication and to bring SHRM
out of reset. In RAM dump mode, this sequence is unnecessary because
the system is preserving state for post-crash analysis.

This patch adds a RAM-dump-mode check and ensures:
- SHRM metadata is not loaded or populated into the interface table
  when RAM dump mode is detected, preventing QCLib from sending it to
  TME.

Test=Create an image.serial.bin and verify it boots on X1P42100.

Change-Id: I921a2b99543ee462433bec8e8471ad836cabc5dd
Signed-off-by: Venkateshwar S <vens@qualcomm.corp-partner.google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90652
Reviewed-by: Subrata Banik <subratabanik@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
2026-01-01 17:13:43 +00:00
Swathi Tamilselvan
01bc527afa soc/qualcomm/common: Add CMD-DB driver support
Introduce CMD-DB driver to enable reading command database entries,
querying SoC resource data, and providing helper functions required
by AOP and other subsystems.

Test=Create an image.serial.bin and ensure it boots on X1P42100.

Change-Id: I3788bf7c97cc1133ae4893f4fdeaf36882e71276
Signed-off-by: Swathi Tamilselvan <tswathi@qualcomm.corp-partner.google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90465
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Subrata Banik <subratabanik@google.com>
2025-12-17 13:55:02 +00:00
Swathi Tamilselvan
2277edff88 soc/qualcomm/x1p42100: Split dram_aop region to map dram_aop_cmd_db as
non-cacheable

Add support to split the dram_aop memory region into three in order to
map dram_aop_cmd_db as non-cacheable. The purpose of dram_aop_config
is memory region where the aop_devcfg.mbn image is loaded.

Test=1. Build and boot on X1P42100.
2. Dump the MMU table in coreboot ramstage and verify whether the region
is mapped as non-cacheable.

Change-Id: Id73d878b7d343f248a845bd5727c43e22c4c348a
Signed-off-by: Swathi Tamilselvan <tswathi@qualcomm.corp-partner.google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90521
Reviewed-by: Subrata Banik <subratabanik@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2025-12-17 13:54:52 +00:00
Swathi Tamilselvan
a4cc178486 soc/qualcomm/common: Map AOP CMD-DB region as uncached region in MMU
Add support to map AOP CMD-DB region as uncached region in MMU. The
reason for this change is that the CMD-DB region is configured as
read-only region and any write to this region will be treated as
fatal. Mapping it as cacheable can lead to cache-line writebacks,
causing invalid accesses and device crashes.

Test=1. Create an image.serial.bin and ensure it boots on X1P42100.
MMU Table dump from Trace32:
'M:0000000081C60000--0000000081C7FFFF|    AM:0000000081C60000--0000000081C7FFFF| s  |  | 00001000| read/write access        exec        | yes| inn| non-cacheable                     |  1| no | \\ramstage\Global\_dram_aop_cmd_db'

Change-Id: I296b505f670f3be28eb998fdac8164a85bf757b0
Signed-off-by: Swathi Tamilselvan <tswathi@qualcomm.corp-partner.google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90464
Reviewed-by: Subrata Banik <subratabanik@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2025-12-17 13:54:44 +00:00
Yu-Ping Wu
1dc3e45f7c mipi: Support passing user data to mipi_cmd_func_t
The mipi_cmd_func_t callback for mipi_panel_parse_init_commands()
currently doesn't support passing additional data for storing context.
Therefore user code would need to store any extra data in global
variables. For example, in the upcoming DSI dual channel support for
MediaTek platforms, the callback needs to know whether the MIPI panel
supports dual channel or not. To support that use case, pass an extra
`user_data` argument to mipi_cmd_func_t.

BUG=b:424782827
TEST=util/abuild/abuild -x -t GOOGLE_SAPPHIRE -a
BRANCH=none

Change-Id: Id5d7b168cdcadfe8d8435c29d7e855a535815057
Signed-off-by: Yu-Ping Wu <yupingso@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90519
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Subrata Banik <subratabanik@google.com>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Yidi Lin <yidilin@google.com>
2025-12-17 06:56:00 +00:00
Kapil Porwal
f28997dcdd soc/qualcomm/common: Add PD negotiation attribute macro
Define the QCLIB_GA_ENABLE_PD_NEGOTIATION bit in the QcLib global
attributes. This flag signals to QcLib that Power Delivery
negotiation should be performed.

BUG=b:457566143
TEST=Verify different boot modes on Google/Quenbi.
TEST=Verify that PD negotiation is skipped in normal mode.

Change-Id: Ia046f68ebeacaa1c1d9a73c4b957315c9f7b68b6
Signed-off-by: Kapil Porwal <kapilporwal@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90512
Reviewed-by: Subrata Banik <subratabanik@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2025-12-16 17:16:04 +00:00
Kapil Porwal
eb79807bec soc/qualcomm/x1p42100: Add mainboard hook for QcLib override
Introduce a weak function qclib_mainboard_override to allow
mainboards to customize QcLib policies or global attributes.
This hook is called from the SoC-specific QcLib initialization
path.

BUG=b:457566143
TEST=Configure QcLib policy for Google/Quenbi.

Change-Id: I0397b7138db260973ea86852cfa9f408e14d195d
Signed-off-by: Kapil Porwal <kapilporwal@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90510
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Subrata Banik <subratabanik@google.com>
2025-12-16 08:00:30 +00:00
Kapil Porwal
8ece648c30 soc/qualcomm/common: Use bitwise OR for global_attributes
Ensure that existing flags in global_attributes are not overwritten
when enabling UART logging. Using a bitwise OR preserves any
previously set attributes.

BUG=b:457566143
TEST=Verify the QcLib global attributes.

With this CL -
```
[DEBUG]  Global Attributes[0x3]..Table Entries Count[8]
```

Change-Id: Iffceb06cb800ba4c9e5c07381745cbed1fb7d550
Signed-off-by: Kapil Porwal <kapilporwal@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90509
Reviewed-by: Subrata Banik <subratabanik@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2025-12-16 08:00:18 +00:00
Subrata Banik
22e54a701d soc/qualcomm/x1p42100: Add AOP, QDSS, and QSEE regions to SSRAM layout
This commit updates the SSRAM memory layout in memlayout.ld to reserve
space for several new regions.

The following regions are added to the SSRAM section:
 - qsee: 100K at 0x14680000
 - qdss_usb_trace: 8K at 0x146A6000
 - aop_imem: 8K at 0x146A8000

The memory map diagram in the comments is also updated to reflect the
reservation of aop_imem and qdss_usb_trace.

BUG=b:456953373
TEST=Able to build and boot google/quenbih.

Change-Id: I17c2a97d31cdcb81ffdd0c83d8c6d19b9a03a91b
Signed-off-by: Subrata Banik <subratabanik@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90443
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Jayvik Desai <jayvik@google.com>
2025-12-15 10:49:52 +00:00
Subrata Banik
4d53aa7704 soc/qualcomm/x1p42100: Relocate PRERAM stack to BSRAM memory
Relocate the PRERAM_STACK region to a new address to resolve a memory
conflict with the QSEE Trust Zone environment.

Details:
 - The previous location of the PRERAM_STACK starting at 0x14680000 in
   SSRAM is now reserved for QC QSEE.

 - This change moves the 16KB PRERAM_STACK from 0x14680000 (SSRAM) to
   the available memory region starting at 0x14850000 in the BSRAM.

BUG=b:456953373
BRANCH=None
TEST=Able to build google/bluey.

Change-Id: Ifa9bc457e28b9ec21aa59c6ab9114993f23b2bc8
Signed-off-by: Subrata Banik <subratabanik@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90406
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Jayvik Desai <jayvik@google.com>
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
2025-12-15 10:49:40 +00:00
Subrata Banik
a26b718d5a soc/qc/x1p42100: Define pre- & post-RAM stack regions in linker script
Implement the newly introduced PRERAM_STACK and POSTRAM_STACK macros in
the x1p42100 memory layout, addressing the memory constraints on this
SoC.

Changes
 - Pre-RAM Stack: The temporary stack used before DRAM is ready is
   defined using PRERAM_STACK(0x14680000, 16K) in the SSRAM region,
   replacing the old generic STACK definition.

 - Post-RAM Stack: The final stack is defined using
   POSTRAM_STACK(0x80000000, 16K) at the start of DRAM.

 - The POSTRAM_DMA_COHERENT region is shifted up to 0x80004000 to
   accommodate the new 16KB post-RAM stack, avoiding memory overlap.

This guarantees a distinct and properly sized stack region for each
stage of the boot process, resolving conflicts with Trust Zone and
ensuring a clean stack transition during the RAM stage.

BUG=b:456953373
BRANCH=None
TEST=Able to build google/bluey.

w/o this patch

```
[SPEW ]  stack: top_of_stack address is 0x14684000
```

w/ this patch

```
[SPEW ]  stack: top_of_stack address is 0x80004000
```

Change-Id: Iccf3f99aff31a8e44386ea52b2196b49797caa79
Signed-off-by: Subrata Banik <subratabanik@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90405
Reviewed-by: Jayvik Desai <jayvik@google.com>
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2025-12-15 10:49:32 +00:00
Subrata Banik
2183326306 soc/qualcomm/x1p42100: Rename qcsdi region to aop_sdi in memlayout
On the X1P42100 SoC, the System Debug Image (SDI) flow is handled by
the Always-On Processor (AOP), unlike previous architectures (e.g.,
Kodiak) which utilized a dedicated 'QcSDI' image.

Rename the memory region at 0x14699000 from 'qcsdi' to 'aop_sdi' to
accurately reflect ownership by the AOP and to align with the new
chipset architecture. This change clarifies the memory map and serves
as a prerequisite for removing legacy QcSDI artifacts once the
modern SDI flow is fully enabled.

BUG=b:456953373
TEST=Build and boot on google/quenbih target.

Change-Id: Ic5626c06decaadfd459aa21bde4efcfec92e1e47
Signed-off-by: Subrata Banik <subratabanik@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90505
Reviewed-by: Jayvik Desai <jayvik@google.com>
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2025-12-15 10:48:28 +00:00
Kirubakaran E
c3afc13a0a soc/qualcomm/x1p42100: Update memlayout for BL31 region and realign TA region
TF-A feature additions have increased BL31 memory requirements. Expand
BL31 reservation from 600KB to 800KB and adjust the TA region start
address to prevent overlap. The TA region change requires FDT memory
reservation updates, which are handled in Depthcharge.This update
ensures proper memory alignment for secure firmware execution.

TEST=Created image.serial.bin and verified successful boot on X1P42100.
Basic device boot functionality with the updated memory reservation has
been validated.

Change-Id: Ia0145c9e8d5925de4a7fee3399efc76059944c10
Signed-off-by: Kirubakaran E <kirue@qualcomm.corp-partner.google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90429
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Subrata Banik <subratabanik@google.com>
2025-12-11 00:12:03 +00:00
Swathi Tamilselvan
6957f84aa7 soc/qualcomm/x1p42100: Define MDSS domain registers for display
clock enablement

Add register address and clock value definitions required to enable
the display clock. The register details are part of HRD-X1P42100-S1
document.
https://docs.qualcomm.com/bundle/resource/topics/HRD-X1P42100-S1/

TEST=Generated image.serial.bin and verified boot on X1P42100.
Validated only basic device boot functionality, as clock enablement API
and its invocation sequence from display driver are not yet implemented.

Change-Id: Id23dd12c9c1ee4968546c8b928f9360163446a9d
Signed-off-by: Swathi Tamilselvan <tswathi@qualcomm.corp-partner.google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90393
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Subrata Banik <subratabanik@google.com>
2025-12-11 00:11:30 +00:00
Swathi Tamilselvan
9a95aef482 soc/qualcomm/common: Add API to enable Lucidole PLL for X1P42100
Add API to enable Lucidole PLL.

TEST=Create an image.serial.bin and ensure it boots on X1P42100.

Change-Id: Idfefebcbe57498446e32c75d5c1532d321b8fb74
Signed-off-by: Swathi Tamilselvan <tswathi@qualcomm.corp-partner.google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90392
Reviewed-by: Subrata Banik <subratabanik@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2025-12-11 00:11:25 +00:00
Venkateshwar S
36edc2e371 soc/qualcomm/x1p42100: Add Dload mode detection and ramdump packing
This patch adds support for download mode detection and packing of
ramdump image in CBFS.

Key changes:
1) qclib.c: Add qclib_check_dload_mode() to read TCSR register and
   detect download mode.
2) addressmap.h: Add TCSR_BOOT_MISC_DETECT register and download mode
   cookie definitions.
3) Makefile.mk: Add build rules for ramdump image.

TEST=Create an image.serial.bin and ensure it boots on X1P42100.

Change-Id: I7c6008be79ea0487273e060ac99ddf037111f6fa
Signed-off-by: Venkateshwar S <vens@qualcomm.corp-partner.google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90307
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Subrata Banik <subratabanik@google.com>
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
2025-12-08 03:01:30 +00:00
Venkateshwar S
445961c604 soc/qualcomm/common: Add support for loading ramdump image
Ramdump is a debug image loaded during a crash to capture memory
contents for post-crash analysis. This patch adds support for
loading this image during the qclib_rerun() sequence.

Key changes:
1) Introduce QC_RAMDUMP_ENABLE Kconfig option to control ramdump image
   loading.
2) Add qclib_check_dload_mode() as a weak function that works in
   conjunction with the Kconfig check to decide whether the ramdump
   image should be loaded.
3) Add new CBFS file entry and table entry definition for ramdump_meta.
4) Re-use "apdp_ramdump_meta" region for ramdump metadata storage.

TEST=Create an image.serial.bin and ensure it boots on X1P42100.

Change-Id: I42bcd74c3d236a6af49ec4b548bc9cda33bd0825
Signed-off-by: Venkateshwar S <vens@qualcomm.corp-partner.google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90306
Reviewed-by: Subrata Banik <subratabanik@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2025-12-05 06:53:43 +00:00
Venkateshwar S
3c563669b5 soc/qualcomm/x1p42100: Add support for APDP image packing in CBFS
This patch adds build rules for packing the APDP image in CBFS.
It also updates the memory layout to include a dedicated region
for APDP metadata storage (4KB at 0x14890000).

TEST=Create an image.serial.bin and ensure it boots on X1P42100.

Change-Id: Ia3093ef6619dd504c829cf6ba6f672f16070f68a
Signed-off-by: Venkateshwar S <vens@qualcomm.corp-partner.google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90302
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
Reviewed-by: Subrata Banik <subratabanik@google.com>
2025-12-05 06:53:35 +00:00
Venkateshwar S
1d70286d4e soc/qualcomm/common: Add support for loading APDP image
This patch introduces a new Kconfig option, QC_APDP_ENABLE, to control
Application Processor Debug Policy (APDP) image loading. When this
option is enabled, the APDP image is loaded during the
qclib_load_and_run() sequence. It also adds a new CBFS file entry and
table entry definition for apdp_meta, along with a memory region symbol
apdp_ramdump_meta for metadata storage.

TEST=Create an image.serial.bin and ensure it boots on X1P42100.

Change-Id: I8d0847c99a1129359f2c758b7a07b9c022f1c8c8
Signed-off-by: Venkateshwar S <vens@qualcomm.corp-partner.google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90303
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
Reviewed-by: Subrata Banik <subratabanik@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2025-12-05 06:53:26 +00:00
Swathi Tamilselvan
36632a08a8 soc/qualcomm/x1p42100: Reserve 33 MB DRAM memory for Display requirement
Add support to reserve 33 MB DRAM memory for display in memlayout.ld
file.

TEST=Create an image.serial.bin and ensure it boots on X1P42100.
Basic device boot functionality with the specified memory reservation
has been validated. Display functionality has not yet been tested, as
the display driver porting is yet to be done.

Change-Id: I49a4a20b9869bc5cf0b11f4eb6cff7865bb2e761
Signed-off-by: Swathi Tamilselvan <tswathi@qualcomm.corp-partner.google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90242
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
Reviewed-by: Subrata Banik <subratabanik@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2025-12-02 07:54:54 +00:00
Kapil Porwal
201ebd48ee soc/qc/x1p42100: Add APIs to read PON reason from PMIC
Add the Power-On (PON) history log parsing and status API to the
SOC layer (soc/qualcomm/x1p42100/pmic.c).

This code is specific to the Qualcomm PMIC architecture (reading
registers for PON events and reasons), making it an SOC-specific
utility rather than a board-level policy. Moving it here improves
modularization and allows other X1p42100-based boards to reuse this
critical power management logic.

Key APIs introduced:
- pm_pon_read_pon_hist(): Reads the raw circular PON event log
  from the PMIC, reverses the buffer to put the latest entry first.
- is_pon_on_ac(): Interprets the log to detect if the power-on
  reason was due to AC/Cable Power (PON_CBLPWR_RSN).

Key changes:
- Create src/soc/qualcomm/x1p42100/include/soc/pmic.h with PON
  definitions and API prototypes.
- Create src/soc/qualcomm/x1p42100/pmic.c containing the PON
  log reading and parsing logic.
- Add pmic.c to the SOC's romstage build via Makefile.mk.

BUG=b:439819922
TEST=Verify off-mode charging behavior on Google/Quenbi.

Change-Id: I8cd1478b9f8d53519f603e8f5168d0a51fa54971
Signed-off-by: Kapil Porwal <kapilporwal@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90192
Reviewed-by: Subrata Banik <subratabanik@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2025-11-26 18:56:25 +00:00
Kapil Porwal
293f3a7f5c soc/qc/spmi: Add API to read byte array
Introduce a new API, spmi_read_bytes(), to allow reading a
sequence of registers from a Qualcomm PMIC using the SPMI bus.

While the existing spmi_read8() is suitable for single-byte
access, reading large log areas (like the PON history log)
requires iterating over a contiguous block of addresses. This
new function encapsulates the required loop, calling spmi_read8()
sequentially for each address in the range.

This abstraction improves code cleanliness and makes high-level PMIC
log parsing much simpler.

Key changes:
- Define spmi_read_bytes() prototype in qcom_spmi.h.
- Implement spmi_read_bytes() in spmi.c to perform sequential
  reads using spmi_read8().

BUG=b:439819922
TEST=Verify off-mode charging behavior on Google/Quenbi.

Change-Id: I6017336a882a8fa8d771b0127e78dd4f0fdbdd0e
Signed-off-by: Kapil Porwal <kapilporwal@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90191
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Subrata Banik <subratabanik@google.com>
2025-11-26 18:56:19 +00:00
Kapil Porwal
9f675eb96b soc/qc/common: Update SPMI_ADDR macro for better type safety
Update the SPMI_ADDR macro to wrap both the slave and reg
arguments in parentheses.

The previous definition, ((slave << 16) | reg), led to incorrect
address calculation when the slave argument was an arithmetic or
logical expression (e.g., (a | b)), as the bit-shift operator (<<)
has higher precedence than the logical OR (|).

The revised macro guarantees that the full slave expression is
evaluated before the bit shift, ensuring correct SPMI register
address construction.

Key changes:
- Wrap slave and reg arguments in parentheses within
  SPMI_ADDR definition.

BUG=b:439819922
TEST=Verify that the SPMI_ADDR output is correct.

e.g. SPMI_ADDR(0x02 | 0x01, 0x200)
Output before this change:
```
((0x02 | 0x01 << 16) | 0x200)
(0x02 | 0x010000 | 0x200)
(0x010202)
```
Output after this change:
```
(((0x02 | 0x01) << 16) | 0x200)
(((0x03) << 16) | 0x200)
((0x030000) | 0x200)
(0x030200)
```

Change-Id: I58b36b62f0b5a59c03a1c1d08640fe9086d81d7a
Signed-off-by: Kapil Porwal <kapilporwal@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90198
Reviewed-by: Subrata Banik <subratabanik@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2025-11-26 18:56:14 +00:00
Swathi Tamilselvan
2f9b4ad6a5 soc/qualcomm/x1p42100: Add DFSR table configuration support
Add support to configure DFSR table, introduce qupv3_clock_v2
structure to calculate register addresses for serial engines 2
and 3. Update CBCR registers to use the new structure for QUPv3
clock enablement.

BUG=b:444617760
TEST=Create an image.serial.bin and ensure it boots on X1P42100.
Dump DFSR registers for corresponding QUP and check if values are
updated properly into correct register address.

Change-Id: Ibd7e4bf121bd99130336047a50ed70d4cbec2234
Signed-off-by: Swathi Tamilselvan <tswathi@qualcomm.corp-partner.google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90145
Reviewed-by: Subrata Banik <subratabanik@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
2025-11-25 16:47:20 +00:00
Subrata Banik
7521f3ea83 soc/qualcomm/x1p42100: Define pre and post-RAM DMA coherent regions
This commit updates the linker script to properly define and name the
DMA coherent memory regions used before and after DRAM initialization.

1. Rename Pre-RAM DMA Region:
The existing `DMA_COHERENT` region allocated in BSRAM at `0x14857000` is
renamed to `PRERAM_DMA_COHERENT`. This aligns the linker script with the
code changes (in `mmu.c`) which use the more specific name for the early
boot DMA buffer.

2. Add Post-RAM DMA Region:
A new region, `POSTRAM_DMA_COHERENT`, is defined at the very start of
DRAM (`0x80000000`) with an 8KB size. This region is intended for
general-purpose DMA operations that occur after DRAM is active,
ensuring a reserved, known, and uncached region for peripherals.

The memory map diagram comments are also updated to reflect these new
region names.

BUG=b:456953373
TEST=Able to build and boot google/quenbi.

Change-Id: I6fb4b9bf3425b311169ac43e1997f6574b571e00
Signed-off-by: Subrata Banik <subratabanik@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90098
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
2025-11-22 17:24:20 +00:00
Subrata Banik
d277b35307 soc/qualcomm/x1p42100: Relocate ddr_information and watchdog tombstone
This commit relocates the following two regions:
1. `ddr_information`
2. `WATCHDOG_TOMBSTONE`

Previously, these regions were allocated in a higher address range
(starting near 0x14800000).

The regions are now defined within SSRAM`:

- `ddr_information` is moved from `0x14860000` to `0x146ABFE8`.
- `WATCHDOG_TOMBSTONE` is moved from `0x14818FFC` to `0x146ABFFC`.

This memory map change updates the linker script's visual diagram and
section definitions to reflect the new memory layout.

BUG=b:456953373
TEST=Able to build google/quenbi.

Change-Id: I4545722a836ec472e8086d1a941515cb3956c763
Signed-off-by: Subrata Banik <subratabanik@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90052
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
Reviewed-by: Julius Werner <jwerner@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2025-11-22 17:24:13 +00:00
Subrata Banik
958099b114 soc/qualcomm: Map the post-RAM DMA coherent buffer
The MMU configuration in qc_mmu_dram_config_post_dram_init() needs to
include the memory region allocated for DMA coherent buffers.

Map the `postram_dma_coherent` region as UNCACHED_RAM to ensure memory
writes bypass the CPU cache hierarchy.

The mapping is only configured if the `_postram_dma_coherent` address
is different from `_preram_dma_coherent` address aka migration of the
region.

This is necessary for DMA operations that occur after DRAM is
initialized.

BUG=b:456953373
TEST=Able to build google/quenbi.

Change-Id: If5f625ad74f4f6ea244c8b377543be3666122cea
Signed-off-by: Subrata Banik <subratabanik@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90050
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
2025-11-22 17:24:05 +00:00
Subrata Banik
af9d809823 soc/qualcomm/x1p42100: Move coreboot stack to SSRAM
This patch relocates the coreboot stack from the BSRAM (Boot IMEM)
region to the SSRAM (Shared System RAM) region.

The 16K stack definition is moved from:

BSRAM region (0x14850000)

To:

SSRAM region (0x14680000)

This move is crucial because the BSRAM region is actively cleared during
the later stages of the IP loading process, which would wipe the stack
and lead to instability. Placing the stack in the persistent SSRAM
ensures it remains accessible throughout the early boot process.

BUG=BUG=b:456953373
TEST=Able to build google/quenbi w/ new stack region.

Change-Id: I59cd14fed2a5907bcbb8bed027dd5a55eb73e56d
Signed-off-by: Subrata Banik <subratabanik@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90137
Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
2025-11-22 17:23:48 +00:00
Subrata Banik
d0177bd102 soc/qualcomm: Add QCLib execution timestamps
Instrument the Qualcomm QCLib flow with timestamps to measure
execution time for both the initial loading/running phase and the
subsequent re-entry phase.

The timestamps are placed as follows:
- TS_QUALCOMM_QCLIB_INIT_START/END: Tracks the execution of
  `qclib_load_and_run()`.
- TS_QUALCOMM_QCLIB_REINIT_START/END: Tracks the execution of
  `qclib_rerun()`, which typically handles the AOP bring-up.

This instrumentation helps in profiling and optimizing the boot
performance on Qualcomm platforms.

Change-Id: I200ea5a78f4630000e80aed6dc38581af4d2e8aa
Signed-off-by: Subrata Banik <subratabanik@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90112
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
2025-11-22 00:42:58 +00:00
Subrata Banik
33418b7e68 soc/qc/x1p42100: Disable compression for peripheral firmware binaries
The firmware binaries for UART, SPI, I2C, and GSI are loaded early in
the boot process. Disable CBFS compression for these files by explicitly
setting $(CBFS_..._compression) to 'none'.

This ensures the firmware is stored and loaded as a raw binary,
mitigating potential boot time impact with decompression.

BUG=b:449871690
TEST=Able to save ~10ms of the boot time while booting google/quenbi.

Change-Id: I0418aadeb860143e766b0fe1ba10a0316d4cc6a7
Signed-off-by: Subrata Banik <subratabanik@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90040
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2025-11-18 05:00:18 +00:00
Subrata Banik
5bfc2d23bb soc/qc/x1p42100:: Select Secure OS options in SoC Kconfig
Refactor Kconfig dependency by moving the selection of Secure OS
(TrustZone/TEE) features from the mainboard configuration to the
specific SoC configuration layer.

The selections for `ARM64_USE_SECURE_OS` and
`ARM64_USE_SECURE_OS_PAYLOAD` are moved from `BOARD_GOOGLE_BLUEY_COMMON`
to `SOC_QUALCOMM_HAMOA`.

This ensures that the Secure OS requirements are correctly associated
with the Hamoa chipset family itself, leading to better modularity and
future compatibility for Hamoa-based platforms.

Crucially, this change allows for precise control of the Secure OS
(BL32 firmware) applicability. By selecting the feature only within
`SOC_QUALCOMM_HAMOA`, we can ensure that platforms utilizing the
"Purwa SoC" family (which currently does not have a ready/available
SecureOS) automatically avoid the selection of these Kconfig options.

The change is verified by ensuring the QTEE (SecureOS) feature is
disabled for platforms using the Purwa SoC, specifically verified on the
google/quenbi mainboard.

BUG=b:459268465
TEST=Ensure disabling QTEE aka SecureOS feature for google/quenbi w/
Purwa SoC.

AP firmware log shows the expected path taken when SecureOS is disabled:

```
WARNING: No QTEE entry point provided by BL2 boot loader,
Booting device without QTEE initialization.
```

Change-Id: Ic82a29a4330cc6e5f99727fc40ec73b38cbbc72d
Signed-off-by: Subrata Banik <subratabanik@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90011
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2025-11-18 05:00:07 +00:00
Hari L
62fc93de90 soc/qualcomm/x1p42100: Add NVMe Power Loss Notification GPIO configuration
Add support for configuring the NVMe Power Loss Notification (PLN)
GPIO before powering on the NVMe device.

The Hamoa target has the PLN signal wired to SoC GPIO 157. The voltage
level conversion circuitry between the SoC (1.2V) and NVMe (3.3V) causes
the PLN signal voltage level to vary depending on the NVMe part used.

This change configures GPIO 157 as an input with no pull resistors and
2mA drive strength to ensure proper PLN signal handling and allow the
GPIO to be used for other hardware configurations.

Changes:
- Add NVME_PLN_GPIO definition for GPIO(157)
- Add nvme_core_pln_gpio() function to configure PLN GPIO
- Update gcom_pcie_power_on_ep() to call nvme_core_pln_gpio() before
  enabling NVMe power regulator

TEST=Boot the Google/Bluey board and verify NVMe device is detected
and functional

Debug logs:

Initializing NVMe controller 1e0f:000c
nvme_ctrlr_init: PCI Command register = 0x2
nvme_ctrlr_init: PCI Status register = 0x10
nvme_ctrlr_init: PCI Command after bus master enable = 0x6
iosq_sz = 11, iocq_sz = 11
nvme_wait_status: Waiting for CSTS & 0x1 == 0x0, timeout=30000 ms
nvme_ctrlr_init: Waited 100ms after controller disable
nvme_enable_controller: CSTS before enable = 0x0
nvme_enable_controller: CAP register = 0x303c03ffff
nvme_enable_controller: CAP.TO timeout = 30000 ms
nvme_enable_controller: Writing CC register = 0x460001
nvme_enable_controller: CC register readback = 0x460001
nvme_wait_status: Waiting for CSTS & 0x1 == 0x1, timeout=30000 ms
nvme_enable_controller: CSTS after enable = 0x1 (status=0)
Identified NVMe model KBG50ZNS256G KIOXIA
Added NVMe drive "NVMe Namespace 1" lbasize:512, count:0x1dcf32b0

Change-Id: Icc22cfd397a0adbc051b2b1a2178aeedb7389ac0
Signed-off-by: Hari L <haril@qualcomm.corp-partner.google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90037
Reviewed-by: Subrata Banik <subratabanik@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2025-11-16 18:36:26 +00:00
Hari L
2b7b89ae31 soc/qualcomm/x1p42100: Update PCIE PHY init sequence
Update PCIE PHY sequence as per hardware setting reference(HSR)
specifically, PCIE RC Config sequence(PCIE RC Cfg Seq).

Key changes:

- Add RX1-specific overrides applied after common RX settings
- Update TX lane mode register (LANE_MODE_3: 0x90 -> 0x51)
- Modify RX calibration and equalization parameters
- Adjust RX signal detection level (0xAA -> 0xCC)
- Add NVME_PLN_GPIO definition for Power Loss Notification

The changes ensure proper PHY initialization for PCIe Gen 4 link
establishment and improve signal integrity.

TEST=Boot the Google/Bluey board and check that the link is up

Debug logs:

[INFO ]  Enumerating buses...
[SPEW ]  Show all devs... Before device enumeration.
[SPEW ]  Root Device: enabled 1
[SPEW ]  CPU_CLUSTER: 0: enabled 1
[SPEW ]  DOMAIN: 00000000: enabled 1
[SPEW ]  PCI: 00:00:00.0: enabled 1
[SPEW ]  Compare with tree...
[SPEW ]  Root Device: enabled 1
[SPEW ]   CPU_CLUSTER: 0: enabled 1
[SPEW ]   DOMAIN: 00000000: enabled 1
[SPEW ]    PCI: 00:00:00.0: enabled 1
[DEBUG]  Root Device scanning...
[SPEW ]  scan_static_bus for Root Device
[DEBUG]  CPU_CLUSTER: 0 enabled
[INFO ]  Setup PCIe in RC mode
[DEBUG]  Skipping pipe
[DEBUG]  PCIe QPHY Initialized took 13us
[INFO ]  PCIe Link speed configured in Gen 4
[INFO ]  PCIe link is up
[NOTE ]  PCIe enumerated succussfully..
[DEBUG]  DOMAIN: 00000000 enabled
[DEBUG]  DOMAIN: 00000000 scanning...
[DEBUG]  PCI: pci_scan_bus for segment group 00 bus 00
[DEBUG]  PCI: 00:00:00.0 subordinate bus PCI Express
[DEBUG]  PCI: 00:00:00.0 [17cb/0111] enabled
[DEBUG]  PCI: 00:00:00.0 scanning...
[SPEW ]  do_pci_scan_bridge for PCI: 00:00:00.0
[DEBUG]  PCI: pci_scan_bus for segment group 00 bus 01
[DEBUG]  PCI: 00:01:00.0 [1e0f/000c] enabled
[INFO ]  PCI: 00:00:00.0: Setting Max_Payload_Size to 256
		for devices under this root port
[DEBUG]  scan_bus: bus PCI: 00:00:00.0 finished in 29 msecs
[DEBUG]  scan_bus: bus DOMAIN: 00000000 finished in 60 msecs
[SPEW ]  scan_static_bus for Root Device done
[DEBUG]  scan_bus: bus Root Device finished in 220 msecs
[INFO ]  done

Debug logs show successful PCIe enumeration with Gen 4 link up
and device [1e0f/000c] detected.

Change-Id: Ifb07839818e30622e35b6ee39af824fd5f19dec5
Signed-off-by: Hari L <haril@qualcomm.corp-partner.google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90036
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Subrata Banik <subratabanik@google.com>
2025-11-16 18:36:21 +00:00
Hari L
8449a15aed soc/qualcomm/x1p42100: Reduce USB OTG state enable timeout to 20ms
Reduce maximum timeout from 100ms to 20ms for OTG Enablement polling
for USB Type-C.

Avoid OTG enablement polling when in sink mode

BUG=b:455551151
TEST: Verify USB3.0 (SS) works for C0/C1 on Google/Bluey.

Background:
During USB Type-C port initialization, the OTG (On-The-Go) status must
be verified when the port operates in source mode to ensure proper VBUS
power delivery. The previous implementation polled the OTG status
register with a 100ms timeout on all ports regardless of their role.

Previous Implementation Issues:
1. Overly conservative timeout: The 100ms maximum wait significantly
   exceeded actual requirements, as OTG enablement consistently
   completes in approximately 14ms under normal conditions
2. Inefficient polling logic: OTG status was polled even when ports
   operated in sink mode, where OTG functionality is irrelevant since
   the port receives rather than provides power

Improvements:
1. Timeout reduction: Decreased maximum polling duration from 100ms to
   20ms, maintaining adequate margin (>40% headroom) while reducing boot
   time by up to 80ms per sink-mode port
2. Mode-aware polling: Added logic to detect port role and skip OTG
   status polling entirely for sink-mode ports, as demonstrated by the
   "Primary in SNK mode - skipping OTG status read" log entry

The changes maintain full USB3.0 SuperSpeed functionality while
improving initialization efficiency. The 20ms timeout remains
sufficiently conservative to accommodate normal timing variations.

Debug logs:
[DEBUG]  QMP PHY SS0 initialized and locked in 1671us,
	phy_status: 0x86868686
[INFO ]  Enabling Primary VBUS SuperSpeed
[INFO ]  Primary in SNK mode - skipping OTG status read
[INFO ]  Primary Type-C Status:
[INFO ]    Misc Status (0x2B0B): 0x1a
[INFO ]    Src Status (0x2B08): 0x00
[INFO ]    Mode Config (0x2B44): 0x00
[INFO ]    Interrupt En Cfg 1 (0x2B5E): 0xff
[INFO ]    State Machine Status (0x2B09): 0x02
[DEBUG]  USB HS PHY initialized for index 3
[DEBUG]  QMP-1x16 USB4 DP PHY SS1 init
[DEBUG]  QMP PHY SS1 initialized and locked in 1671us,
	phy_status: 0x86868686
[INFO ]  Enabling Secondary VBUS SuperSpeed
[INFO ]  Secondary in SRC mode - OTG Status: 0x02, State: 0x02
	(OTG Enabled) - Time: 14 ms
[INFO ]  Secondary Type-C Status:
[INFO ]    Misc Status (0x2B0B): 0x4b
[INFO ]    Src Status (0x2B08): 0x08
[INFO ]    Mode Config (0x2B44): 0x00
[INFO ]    Interrupt En Cfg 1 (0x2B5E): 0xff
[INFO ]    State Machine Status (0x2B09): 0xa6

confirmed that there are no otg polling for sink mode and
polling timeout is reduced to max of 20ms.

Change-Id: I7467248185c9d0526816ac62e1e1a1496440fddc
Signed-off-by: Hari L <haril@qualcomm.corp-partner.google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/89826
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
2025-11-06 13:17:24 +00:00
Hari L
155041ad4c soc/qualcomm/x1p42100: Add EUSB2 HS repeater support for USB Type-C
Add usb_repeater_spmi_init() and usb_repeater_spmi_tune() functions
for USB repeater internal to SMB2360 via SPMI configuration
during HS PHY initialization.

The usb_repeater_spmi_init() function enables Embedded USB2 control for
both SMB1 and SMB2 cores, while usb_repeater_spmi_tune() configures
optimal signal integrity parameters (IUSB2, USB2_SLEW, USB2_PREEM)
for reliable Type-C connectivity.

BUG=b:451814646
TEST=Verify USB2.0 (HS) works for C1 on Google/Bluey.

Without this CL -
USB2 key doesn't work for C1.

Verified HS1 functionality by turning on L14B from coreboot.

Before USB insertion:
firmware-shell:  md 0x0a800420 8
0a800420: 000002a0 00000000 00000000 00000000    ................
0a800430: 000002a0 00000000 00000000 00000000    ................

firmware-shell: Added USB disk 2.
firmware-shell:  md 0x0a800420 8
0a800420: 00000e03 00000000 00000000 00000000    ................
0a800430: 000002a0 00000000 00000000 00000000    ................

firmware-shell: Removed USB disk 2.
firmware-shell:  md 0x0a800420 8
0a800420: 000002a0 00000000 00000000 00000000    ................
0a800430: 000002a0 00000000 00000000 00000000    ................

Change-Id: I24e0af062fc7a6b5effd9317ec5c0b2d89fe288e
Signed-off-by: Hari L <haril@qualcomm.corp-partner.google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/89613
Reviewed-by: Subrata Banik <subratabanik@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
2025-10-22 18:49:51 +00:00