Page MenuHomeFreeBSD

sdhci_fsl_fdt: Add voltage switching through syscon

Authored by on Jan 25 2022, 8:36 AM.
Referenced Files
Unknown Object (File)
Sat, Jun 15, 9:24 PM
Unknown Object (File)
Sun, Jun 9, 7:25 AM
Unknown Object (File)
Mon, Jun 3, 9:50 PM
Unknown Object (File)
Mon, Jun 3, 4:45 AM
Unknown Object (File)
Mon, Jun 3, 2:22 AM
Unknown Object (File)
Mon, Jun 3, 2:22 AM
Unknown Object (File)
Sat, May 25, 11:48 PM
Unknown Object (File)
May 15 2024, 7:14 AM



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

rG FreeBSD src repository
Lint Not Applicable
Tests Not Applicable

Event Timeline


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


s/char* syscon_compat/char *syscon_compat


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.


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.


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?


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.