Page MenuHomeFreeBSD

sdhci_fsl_fdt: Add voltage switching through syscon
ClosedPublic

Authored by hum_semihalf.com on Jan 25 2022, 8:36 AM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, May 15, 7:14 AM
Unknown Object (File)
Sat, May 4, 12:46 AM
Unknown Object (File)
Sun, Apr 28, 12:05 PM
Unknown Object (File)
Apr 23 2024, 2:00 PM
Unknown Object (File)
Apr 21 2024, 7:18 AM
Unknown Object (File)
Apr 8 2024, 1:20 AM
Unknown Object (File)
Apr 7 2024, 1:10 AM
Unknown Object (File)
Mar 30 2024, 10:26 AM

Details

Summary

Some SoCs does not have a fixed regulator to handle voltage
switching automatically. Add support for voltage switching
through syscon register when necessary. Add new errata flag
indicating missing regulator. Apply errata to SoCs, which are
known to be affected, i.e. LS1046 and LS1012.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

sys/dev/sdhci/sdhci_fsl_fdt.c
175

s/does not have fixed regulator/don't have a fixed regulator

215

s/char* syscon_compat/char *syscon_compat

675

Does a write to SCFG_SDHCIOVSELCR clear SCFG_SDHCIOVSELCR_TGLEN? Otherwise I see no reason setting it again for each voltage, when it's already set in line 665.

735

Will we still get non-null value here on boards that have the regulator connected by syscon? If so, I think the logic should terminate here.

Fix typos. Don't return from function right after voltage switching with a syscon, but go to the fixed regulator logic.

sys/dev/sdhci/sdhci_fsl_fdt.c
734

Now we're skipping over the switch (slot->host.ios.vccq) block, leaving uvolt uninitialized, but we later use it in regulator_set_voltage(vqmmc_supply, uvolt, uvolt).
I will reiterate my question - can boards with syscon voltage regulator get non-null vqmmc_supply?

sys/dev/sdhci/sdhci_fsl_fdt.c
714

One more thought - to prevent this code from becoming spaghetti, I'd suggest to delegate the actual voltage switch logic to its own helper.
I.e. sc->soc_data->vccq_switch(brdev, reqdev), that will do the switching either through syscon or device register set, depending on the SoC revision. This way we don't have to awkwardly skip over switch (slot->host.ios.vccq), or use SDHCI_FSL_MISSING_VCCQ_REG.

Change voltage switching logic. After setting registers check for errata flag for missing regulator and use syscon register for voltage switch if necessary. Check for a fixed regulator presence afterwards, as it still might be possible and use it.

This revision was not accepted when it landed; it landed in state Needs Review.Feb 22 2022, 8:59 AM
This revision was automatically updated to reflect the committed changes.