1
0
Fork 0
mirror of https://github.com/u-boot/u-boot.git synced 2025-04-27 07:51:38 +00:00
u-boot/test/dm
Miquel Raynal 197376fbf3 power-domain: Add refcounting
It is very surprising that such an uclass, specifically designed to
handle resources that may be shared by different devices, is not keeping
the count of the number of times a power domain has been
enabled/disabled to avoid shutting it down unexpectedly or disabling it
several times.

Doing this causes troubles on eg. i.MX8MP because disabling power
domains can be done in recursive loops were the same power domain
disabled up to 4 times in a row. PGCs seem to have tight FSM internal
timings to respect and it is easy to produce a race condition that puts
the power domains in an unstable state, leading to ADB400 errors and
later crashes in Linux.

CI tests using power domains are slightly updated to make sure the count
of on/off calls is even and the results match what we *now* expect.

As we do not want to break existing users while stile getting
interesting error codes, the implementation is split between:
- a low-level helper reporting error codes if the requested transition
  could not be operated,
- a higher-level helper ignoring the "non error" codes, like EALREADY and
  EBUSY.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
2025-04-10 22:32:55 -03:00
..
acpi.c acpi: Support checking checksums 2025-04-03 11:43:22 -06:00
acpi.h doc: replace @return by Return: 2022-01-19 18:11:34 +01:00
acpi_dp.c include: export uuid.h 2024-09-12 17:35:37 +02:00
acpigen.c test: acpi: Add IORT tests 2025-04-03 11:38:14 -06:00
adc.c test: Rename unit-test flags 2024-08-26 18:51:48 -06:00
audio.c test: Rename unit-test flags 2024-08-26 18:51:48 -06:00
axi.c test: Drop the blank line before test macros 2024-08-26 18:51:49 -06:00
blk.c test: Rename unit-test flags 2024-08-26 18:51:48 -06:00
blkmap.c test: dm: Use UTF_CONSOLE in tests 2024-08-26 18:51:49 -06:00
bootcount.c test: Drop the blank line before test macros 2024-08-26 18:51:49 -06:00
bus.c test: Rename unit-test flags 2024-08-26 18:51:48 -06:00
button.c test: Rename unit-test flags 2024-08-26 18:51:48 -06:00
cache.c test: Rename unit-test flags 2024-08-26 18:51:48 -06:00
clk.c test: Drop the blank line before test macros 2024-08-26 18:51:49 -06:00
clk_ccf.c test: Drop the blank line before test macros 2024-08-26 18:51:49 -06:00
core.c dm: core: Provide ofnode_name_eq_unit() to accept a unit address 2025-01-22 17:08:24 -06:00
cpu.c test: Drop the blank line before test macros 2024-08-26 18:51:49 -06:00
cros_ec.c test: dm: Use UTF_CONSOLE in tests 2024-08-26 18:51:49 -06:00
cros_ec_pwm.c test: Rename unit-test flags 2024-08-26 18:51:48 -06:00
devres.c test: Rename unit-test flags 2024-08-26 18:51:48 -06:00
dma.c test: Rename unit-test flags 2024-08-26 18:51:48 -06:00
dsa.c test: Drop the blank line before test macros 2024-08-26 18:51:49 -06:00
dsi_host.c test: Drop the blank line before test macros 2024-08-26 18:51:49 -06:00
ecdsa.c test: Rename unit-test flags 2024-08-26 18:51:48 -06:00
efi_media.c test: Rename unit-test flags 2024-08-26 18:51:48 -06:00
eth.c test: Drop the blank line before test macros 2024-08-26 18:51:49 -06:00
extcon.c test: Drop the blank line before test macros 2024-08-26 18:51:49 -06:00
fastboot.c test: Rename unit-test flags 2024-08-26 18:51:48 -06:00
fdtdec.c test: Rename unit-test flags 2024-08-26 18:51:48 -06:00
ffa.c test: Rename UTF_CONSOLE_REC to UTF_CONSOLE 2024-08-26 18:51:49 -06:00
firmware.c test: Rename unit-test flags 2024-08-26 18:51:48 -06:00
fpga.c test: Drop the blank line before test macros 2024-08-26 18:51:49 -06:00
fwu_mdata.c test: Rename unit-test flags 2024-08-26 18:51:48 -06:00
fwu_mdata_disk_image.h test: dm: Add test cases for FWU Metadata uclass 2022-10-31 14:47:33 -04:00
gpio.c test: Rename unit-test flags 2024-08-26 18:51:48 -06:00
host.c test: dm: Use UTF_CONSOLE in tests 2024-08-26 18:51:49 -06:00
hwspinlock.c test: Drop the blank line before test macros 2024-08-26 18:51:49 -06:00
i2c.c test: Drop the blank line before test macros 2024-08-26 18:51:49 -06:00
i2s.c test: Rename unit-test flags 2024-08-26 18:51:48 -06:00
iommu.c test: Rename unit-test flags 2024-08-26 18:51:48 -06:00
irq.c drivers: misc: irq-uclass: Update irq_get_by_index 2024-10-27 17:24:13 -06:00
k210_pll.c test: Remove <common.h> and add needed includes 2024-05-06 15:05:04 -06:00
Kconfig test: Make all tests depend on UNIT_TEST 2025-02-11 20:10:59 -06:00
led.c led: add function naming option from linux 2025-02-07 10:53:39 -06:00
mailbox.c test: Rename unit-test flags 2024-08-26 18:51:48 -06:00
Makefile test: dm: add video bridge tests 2025-03-08 16:35:46 +02:00
mdio.c test: Drop the blank line before test macros 2024-08-26 18:51:49 -06:00
mdio_mux.c test: Drop the blank line before test macros 2024-08-26 18:51:49 -06:00
memory.c test: Drop the blank line before test macros 2024-08-26 18:51:49 -06:00
misc.c test: Drop the blank line before test macros 2024-08-26 18:51:49 -06:00
mmc.c test: Rename unit-test flags 2024-08-26 18:51:48 -06:00
mux-cmd.c test: Drop sandbox_set_enable_memio() from mux-cmd test 2025-02-11 20:10:58 -06:00
mux-emul.c test: Rename unit-test flags 2024-08-26 18:51:48 -06:00
mux-mmio.c test: Rename unit-test flags 2024-08-26 18:51:48 -06:00
nand.c test: Update NAND test to avoid extra macros 2024-08-26 18:51:49 -06:00
nop.c test: Drop the blank line before test macros 2024-08-26 18:51:49 -06:00
nvmxip.c test: Rename UTF_CONSOLE_REC to UTF_CONSOLE 2024-08-26 18:51:49 -06:00
of_extra.c test: Remove <common.h> and add needed includes 2024-05-06 15:05:04 -06:00
of_platdata.c test: Rename unit-test flags 2024-08-26 18:51:48 -06:00
ofnode.c test: dm: add ofnode_graph tests 2025-03-08 16:35:46 +02:00
ofread.c test: Rename unit-test flags 2024-08-26 18:51:48 -06:00
osd.c test: Drop the blank line before test macros 2024-08-26 18:51:49 -06:00
p2sb.c test: Rename unit-test flags 2024-08-26 18:51:48 -06:00
panel.c power: regulator: Trigger probe of regulators which are always-on or boot-on 2024-09-30 19:19:07 -06:00
part.c test: Rename unit-test flags 2024-08-26 18:51:48 -06:00
pch.c test: Rename unit-test flags 2024-08-26 18:51:48 -06:00
pci.c test: Rename unit-test flags 2024-08-26 18:51:48 -06:00
pci_ep.c test: Drop the blank line before test macros 2024-08-26 18:51:49 -06:00
phy.c phy: test: Implement sandbox PHY .set_mode and DM test 2024-09-09 17:18:04 +02:00
phys2bus.c test: Rename unit-test flags 2024-08-26 18:51:48 -06:00
pinmux.c test: Rename unit-test flags 2024-08-26 18:51:48 -06:00
pmc.c test: Rename unit-test flags 2024-08-26 18:51:48 -06:00
pmic.c test: Drop the blank line before test macros 2024-08-26 18:51:49 -06:00
power-domain.c power-domain: Add refcounting 2025-04-10 22:32:55 -03:00
pwm.c test: Rename unit-test flags 2024-08-26 18:51:48 -06:00
qfw.c test: Drop the blank line before test macros 2024-08-26 18:51:49 -06:00
ram.c test: Rename unit-test flags 2024-08-26 18:51:48 -06:00
read.c test: Rename unit-test flags 2024-08-26 18:51:48 -06:00
reboot-mode.c test: Drop the blank line before test macros 2024-08-26 18:51:49 -06:00
regmap.c test: Drop the blank line before test macros 2024-08-26 18:51:49 -06:00
regulator.c power: regulator: Trigger probe of regulators which are always-on or boot-on 2024-09-30 19:19:07 -06:00
remoteproc.c test: Rename unit-test flags 2024-08-26 18:51:48 -06:00
reset.c test: Drop the blank line before test macros 2024-08-26 18:51:49 -06:00
rkmtd.c test: Rename UTF_CONSOLE_REC to UTF_CONSOLE 2024-08-26 18:51:49 -06:00
rng.c test: dm: Use UTF_CONSOLE in tests 2024-08-26 18:51:49 -06:00
rtc.c test: dm: Use UTF_CONSOLE in tests 2024-08-26 18:51:49 -06:00
scmi.c test: dm: Use UTF_CONSOLE in tests 2024-08-26 18:51:49 -06:00
scsi.c test: Rename unit-test flags 2024-08-26 18:51:48 -06:00
serial.c test: Drop the blank line before test macros 2024-08-26 18:51:49 -06:00
sf.c test: Rename unit-test flags 2024-08-26 18:51:48 -06:00
simple-bus.c test: Rename unit-test flags 2024-08-26 18:51:48 -06:00
simple-pm-bus.c test: Rename unit-test flags 2024-08-26 18:51:48 -06:00
sm.c test: Drop the blank line before test macros 2024-08-26 18:51:49 -06:00
smem.c test: Rename unit-test flags 2024-08-26 18:51:48 -06:00
soc.c test: Drop the blank line before test macros 2024-08-26 18:51:49 -06:00
sound.c test: Rename unit-test flags 2024-08-26 18:51:48 -06:00
spi.c test: Rename unit-test flags 2024-08-26 18:51:48 -06:00
spmi.c test: Rename unit-test flags 2024-08-26 18:51:48 -06:00
syscon-reset.c test: Rename unit-test flags 2024-08-26 18:51:48 -06:00
syscon.c test: Rename unit-test flags 2024-08-26 18:51:48 -06:00
sysinfo-gpio.c dm: sysinfo: Shorten the SYSINFO_ID prefix 2024-11-17 13:12:54 -06:00
sysinfo.c test/dm: add sandbox test for sysinfo_get_data 2025-01-14 14:29:29 -06:00
sysreset.c test: Rename unit-test flags 2024-08-26 18:51:48 -06:00
tag.c test: Drop the blank line before test macros 2024-08-26 18:51:49 -06:00
tee.c test: Drop the blank line before test macros 2024-08-26 18:51:49 -06:00
test-driver.c test: Rename test_get_state() to ut_get_state() 2025-01-24 14:34:39 -06:00
test-fdt.c test: dm: test-fdt: Add checks for uclass_get_device_by_endpoint() 2025-04-10 22:32:55 -03:00
test-uclass.c test: Rename test_get_state() to ut_get_state() 2025-01-24 14:34:39 -06:00
timer.c test: Rename unit-test flags 2024-08-26 18:51:48 -06:00
tpm.c test: Rename unit-test flags 2024-08-26 18:51:48 -06:00
usb.c test: Rename unit-test flags 2024-08-26 18:51:48 -06:00
video.c test: Rename unit-test flags 2024-08-26 18:51:48 -06:00
video_bridge.c test: dm: add video bridge tests 2025-03-08 16:35:46 +02:00
virtio.c test: Rename unit-test flags 2024-08-26 18:51:48 -06:00
virtio_device.c test: Rename unit-test flags 2024-08-26 18:51:48 -06:00
virtio_rng.c test: Rename unit-test flags 2024-08-26 18:51:48 -06:00
wdt.c test: dm: wdt: replace cyclic_run() by schedule() 2024-10-23 06:52:38 +02:00