summaryrefslogtreecommitdiff
path: root/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c
diff options
context:
space:
mode:
authorMiquel Raynal <miquel.raynal@bootlin.com>2025-04-25 08:49:32 +0200
committerFabio Estevam <festevam@denx.de>2025-04-28 10:41:19 -0300
commit9086b64ca07166b1e72b29ad04e3fe2a483c5454 (patch)
treec0831e6897098ae547796fe77beb0666d94743b4 /arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c
parentddd6d6f8dbd940edf3b62e1b37bc86734aec236c (diff)
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>
Diffstat (limited to 'arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c')
0 files changed, 0 insertions, 0 deletions