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)
Thu, Mar 7, 6:28 PM
Unknown Object (File)
Jan 21 2024, 12:53 AM
Unknown Object (File)
Jan 12 2024, 11:14 PM
Unknown Object (File)
Jan 1 2024, 9:34 AM
Unknown Object (File)
Jan 1 2024, 9:34 AM
Unknown Object (File)
Dec 23 2023, 3:22 PM
Unknown Object (File)
Dec 22 2023, 10:20 PM
Unknown Object (File)
Dec 17 2023, 4:04 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 Not Applicable
Unit
Tests Not Applicable

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
728

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.