Commit Graph

375 Commits

Author SHA1 Message Date
Mario Bălănică
f8768a8a02 Add initial support for Fydetab Duo
The DSI panel is not yet working.

Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
2024-07-09 05:22:29 +03:00
Mario Bălănică
c02b333c22 RkSdmmcDxe: Add option for inverted card detect signal
It's worth noting that when the detection logic is inverted,
the boot ROM assumes the SD card is disconnected and skips
booting from it altogether.

Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
2024-07-09 05:22:29 +03:00
Mario Bălănică
1b6ef19bf3 RkSdmmcPlatformLib: Ensure JTAG is disabled
If the card is not connected at boot, force_jtag in
SYS_GRF_SOC_CON6 may remain set. This muxes DAT2/DAT3 over
to JTAG instead of SDMMC, preventing SD card operation in
4-bit mode.

Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
2024-07-09 05:22:24 +03:00
Mario Bălănică
0bfa31ff0e Update README.md
Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
v0.10
2024-06-24 03:32:36 +03:00
Mario Bălănică
83e1b9bbea rkbin: Downgrade SPL back to v1.12
SD card driver in v1.13 throws errors and won't boot anymore.
Tested on Indiedroid Nova.

Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
2024-06-24 00:16:36 +03:00
Mario Bălănică
9678f643ec Update to latest rkbin
* ATF (BL31) from v1.40 to v1.45
* OP-TEE (BL32) from v1.13 to v1.15
* ddrbin from v1.12 to v1.16
* U-Boot SPL from v1.12 to v1.13

Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
2024-06-24 00:02:48 +03:00
Mario Bălănică
359354e0bb Enable Arm TRNG service
Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
2024-06-23 22:49:05 +03:00
Mario Bălănică
8e7e736365 Update TF-A submodule
Adds support for TRNG SMC service.

Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
2024-06-23 22:46:44 +03:00
Mario Bălănică
1bb15338fc Fix networking after EDK2 update
Latest EDK2 requires a proper RNG driver in order to use network boot
(CVE-2023-45237).

We ought to implement one, but for now bypass this check.

Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
2024-06-23 04:01:20 +03:00
Mario Bălănică
f0727b8e35 Update to latest EDK2
edk2-stable202405

Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
2024-06-23 01:33:00 +03:00
Mario Bălănică
02d150251c DwcSdhciDxe: Disable ADMA2 to avoid data corruption
This controller has the limitation that a single ADMA2 descriptor cannot
cross 128 MB boundaries and must be split.
This would require a patch in SdMmcPciHcDxe, but SDMA works fine for the
time being.

Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
2024-06-22 20:10:08 +03:00
Mario Bălănică
053cf714a7 ACPI: Prepare SD controller support for Windows
Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
2024-06-18 21:17:17 +03:00
Mario Bălănică
dd0b22f5fd ACPI: Add SCMI clock and voltage domain methods
Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
2024-06-18 20:59:23 +03:00
Mario Bălănică
bffaee6af4 Update TF-A submodule
This enables the upcoming SCMI support in ACPI and SD/MMC clock &
voltage control for Windows.

Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
2024-06-18 19:49:41 +03:00
Mario Bălănică
de6b6f843e Switch to open-source TF-A
Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
2024-06-18 19:34:52 +03:00
Mario Bălănică
ee52a5a8ce PlatformLib: Fix overlapping memory map regions
Regions should be clearly delimited so attributes don't mix up.

Also ensure that the TF-A region containing SCMI shared memory is not
added to the UEFI map. This addresses an issue where attributes seem to
change at runtime and the mismatch leads to a loss of cache coherency
between EL3 and lower level accesses.

TF-A maps the shared memory as Device memory, so it needs to remain at
least non-cacheable here too (Device is not exactly possible due to
unaligned accesses from ArmScmiDxe). This could actually just be normal
write-back memory, since it's not shared with any external clients, but
whatever.

Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
2024-06-18 19:34:51 +03:00
Mario Bălănică
1b9a49f624 RK3588Dxe: Enable M.2 slot power in SATA mode
Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
2024-06-18 19:29:56 +03:00
Mario Bălănică
b1c1c2cd13 SdramLib: Fix detection for LPDDR4X and LPDDR5
Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
2024-06-18 19:29:48 +03:00
Jianfeng Liu
1fa01b9ea1 Add support for rock-5-itx (#138) 2024-04-25 21:15:54 +03:00
silime
a39e76ff86 Platform/ROCK5B: Enable WIFI Bluetooth regulator (#134) 2024-04-05 17:38:12 +03:00
Ricardo Pardini
956bbdc73b update DTBs from Armbian rk-6.1-rkr1 (#133)
Signed-off-by: Ricardo Pardini <ricardo@pardini.net>
2024-04-01 17:29:13 +03:00
Doug Cook
94a242cf05 New platform: AIO-3588q (#130) 2024-03-26 23:50:10 +02:00
Mario Bălănică
779b6dc5bc workflows: Update actions 2024-03-16 22:42:39 +02:00
Mario Bălănică
06a6d8843f Clean-up build.sh
Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
2024-03-16 22:42:25 +02:00
Mario Bălănică
3e5a3c8c06 ACPI: Unconditionally mask off PCIe native hot plug control
We don't actually support hot plug and this causes lockups in Windows.

Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
2024-03-02 00:01:00 +02:00
Mario Bălănică
ba8fbeea98 Rk3588PciHostBridgeLib: Try to avoid a potential bus hang up
Some devices that appear to have working CFG0 filtering (my VIA VL805)
do not actually like config cycles at B/D/F 01:01.0 and may screw up
further accesses (e.g. read 0xFFFFFFFF at valid locations) + eventually
hang up the bus after a few more attempts.

Checking for mirroring in this case is asking for trouble, but it seems
that trying 01:01.0 first and then 01:00.0 avoids the problem in UEFI.

OSes that rely on single device ECAM mode in ACPI are still going to
hang up the system, since they scan the entire affected bus.

Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
2024-02-13 01:53:04 +02:00
Mario Bălănică
4b915e69f5 ACPI: Support PCIe root port and switches in Windows and Linux
To deal with the broken ECAM on this platform, reuse some existing OS
workarounds:
- for Windows: "NXPMX6" OEM ID in FADT and split MCFG entries for root
port and main config space.

- for Linux: "AMAZON" OEM ID + "GRAVITON" OEM Table ID in MCFG. An
"AMZN0001" device with _UID matching the RC segment number returns the
root port's DBI address in _CRS.

Both workarounds filter device > 0 on primary and secondary buses of RP
to hide ghost and duplicate devices.

The compatibility mode used can be configured in the setup menu.
Default is "Auto (NXPMX6 + Single Device)", which selects the NXPMX6
mode when Windows is booted and the classic single device/bus mode for
other OSes, since it's the most compatible one.

Also move the PCIe and SATA SSDT definitions in DSDT and patch _STA
instead to disable the unnecessary controllers.

Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
2024-02-11 21:48:46 +02:00
Mario Bălănică
ccf967ed7a ACPI: Expose EHCI unconditionally
But detect the OS booted and hide the PNP0D20 ID for Windows, so we
don't end up binding to the inbox driver package and crashing.

The fixed driver package[^1] will bind to the custom RKCP0D20 _HID
instead.

[^1]: https://github.com/worproject/Rockchip-Windows-Drivers/tree/master/drivers/usb/usbehci_noncoherent

Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
2024-02-11 21:48:44 +02:00
Mario Bălănică
4684b3ad73 ACPI: Set MSI not supported flag in FADT
This stops Linux from attempting to enable MSI and ultimately failing.

Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
2024-02-11 21:48:42 +02:00
Mario Bălănică
0b69d04421 ACPI: Remove "rockchip,rk3399-i2c" compatible
Linux does not like the DT properties and kernel panics.

Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
2024-02-11 21:48:36 +02:00
Mario Bălănică
4af3a03c11 Drop dependency on string.h
Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
2024-01-19 20:39:23 +02:00
Mario Bălănică
21c4983009 ACPI: Support I2S master clock adjustment via _DSM
Mux the TX clock source accordingly and initialize MCLK at 256 * 48000Hz
to fix playback speed in Windows.

RX is not configured yet.

Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
2024-01-19 04:19:17 +02:00
Mario Bălănică
2124a8c3de CruLib: Assorted improvements
Lay groundwork to support:
- clocks from other CRU instances (e.g. PMU1CRU).
- gating and reset. Resets are separate due to them controlling not only
clocks but also peripheral blocks.

Also:
- validate input parameters
- fix PMU1CRU definitions

Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
2024-01-19 04:19:16 +02:00
Mario Bălănică
4209774c09 RK3588Dxe: Clean up unused code
Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
2024-01-19 04:19:16 +02:00
Mario Bălănică
1598d883be Platform/OPi5: Fix i2c0m2
Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
2024-01-19 04:19:15 +02:00
Mario Bălănică
cc77cee865 Platform/Mekotronics: Fix i2c0_sda_m2
Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
2024-01-13 05:56:50 +02:00
CoolStar
e452f9d179 Platform/RK3588: Enable I2S and codec depending on board (#114) 2024-01-12 03:22:26 +02:00
Mario Bălănică
72385b183a PlatformBootManagerLib: Add USB keyboard path to ConIn earlier
When a keyboard gets installed after connecting the USB controller
handles, ConPlatformDxe will check that its short-form device path
exists in the ConIn variable before enabling input from it.

This variable is missing at first boot, so adding the path after the
keyboard was already ignored means it won't be usable during BDS
countdown.

Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
2024-01-11 06:01:33 +02:00
Mario Bălănică
bc0a1bc833 Silicon/RK3588: Add option to change serial baud rate within UEFI
Firstly, split up the Dw8250 serial lib into "full" and "debug"
versions. The full version is only used at SEC phase (PrePi) for setting
the specified baud rate, while the debug one is used everywhere else and
cannot reinitialize the UART.

To read the baud rate NV variable in SEC, introduce BaseVariableLib,
which is just a slightly modified FaultTolerantWritePei + VariablePei to
not use HOBs and PPIs, since they're not available this early.

Previous boot stages (DDR, TF-A, U-Boot SPL) are still hardcoded to
output at 1.5 Mbaud.

Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
2024-01-10 03:00:05 +02:00
Mario Bălănică
a7806a34ac Silicon/Rockchip: Fork Dw8250SerialPortLib
Before I do anything to it..

Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
2024-01-10 03:00:05 +02:00
Mario Bălănică
601a81a813 Silicon/RK3588: Remove own NvStorage PCDs
Use gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorage* everywhere for
consistency.

This also fixes FTW, since its PCDs were previously set to wrong
addresses in the DSC.

Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
2024-01-10 02:59:59 +02:00
Molly Sophia
526d9e9a7b GpioLib: Fix dead loops
Signed-off-by: Molly Sophia <mollysophia379@gmail.com>
2024-01-08 04:50:46 +00:00
CoolStar
0da51416c7 Platform/RK3588: Refactor I2cIoMux to use GpioPinSetFunction and add missing controllers (#113) 2024-01-06 01:35:05 +02:00
root
5974d88a1e Platform/OPi5Plus: Enable Wi-Fi regulator 2024-01-04 19:56:24 +02:00
SleepWalker
cf562625e5 Platform/NanoPC-T6: Power on 4G/LTE module and fix logo (#111) 2024-01-04 19:12:34 +02:00
Mario Bălănică
22d22a4338 Silicon/RK3588: Add _DSM for setting GMAC RGMII speed
Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
2024-01-03 23:02:30 +02:00
Doug Cook
dc1d255855 GMAC - add hardware IDs for use by Windows
Set GMAC HID to RKCP6543 (arbitrarily-chosen, open to alternatives).

Move the PRP0001 id to `_CID`.
2023-12-22 09:11:49 +08:00
shimmyshai00
a6c7ca1fef Platform/RK3588: Add Firefly ITX-3588J board support (#109) 2023-12-17 12:01:16 +02:00
CoolStar
05bc33baee Silicon/RK3588: Adjust I2C for Windows driver, add DMA, and enable in boards 2023-12-08 20:42:18 +08:00
CoolStar
83fe40896f Silicon/RK3588: Adjust GPIO for Windows driver and enable in boards (#106) 2023-12-02 17:49:46 +02:00