u-boot/test
Miquel Raynal 9086b64ca0 power-domain: Add support for refcounting (again)
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.

Some drivers implement their own mechanism for that, but it is probably
best to add this feature in the uclass and share the common code across
drivers. In order to avoid breaking existing drivers, refcounting is
only enabled if the number of subdomains a device node supports is
explicitly set in the probe function. ->xlate() callbacks will return
the power domain ID which is then being used as the array index to reach
the correct refcounter.

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.

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. They
are also extended to test the low-level functions.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
2025-04-28 10:41:19 -03:00
..
boot dm: usb: initialize and scan multiple buses simultaneously with uthread 2025-04-23 13:19:44 -06:00
cmd Merge patch series "Uthreads" 2025-04-23 13:21:39 -06:00
common lib/uuid.c: use unique name for PARTITION_SYSTEM_GUID 2025-04-22 12:54:32 -06:00
dm power-domain: Add support for refcounting (again) 2025-04-28 10:41:19 -03:00
env test: Drop suites.h 2025-02-11 20:12:36 -06:00
fdt_overlay test: Drop suites.h 2025-02-11 20:12:36 -06:00
fs test: fs: fs-test: Move the tests to use sha256sum 2024-01-11 21:19:25 -05:00
fuzz Kbuild: Always use $(PHASE_) 2025-04-11 12:16:44 -06:00
hush test: Drop the function for running hush tests 2025-01-24 14:34:40 -06:00
image spl: Create a function to init spl_load_info 2024-08-23 15:58:42 -06:00
lib test: lib: add uthread_mutex test 2025-04-23 13:19:44 -06:00
log test: Drop suites.h 2025-02-11 20:12:36 -06:00
optee test: Drop suites.h 2025-02-11 20:12:36 -06:00
py test/py: spi: Prevent to overwrite the reserved memory 2025-04-24 08:23:05 -06:00
stdint Revert "Merge patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet"" 2024-05-19 08:16:36 -06:00
cmd_ut.c test: Update documentation 2025-02-11 20:12:36 -06:00
Kconfig test: Make all tests depend on UNIT_TEST 2025-02-11 20:10:59 -06:00
Makefile Kbuild: Always use $(PHASE_) 2025-04-11 12:16:44 -06:00
run test: Run the VPL tests with 'make check' 2023-04-03 06:53:53 +12:00
test-main.c test: Allow running a selection of suites 2025-02-11 20:12:36 -06:00
ut.c test: Move stats into a struct 2025-01-24 14:34:41 -06:00