Possible bug in sdhci_set_power_reg

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi MMC team,

I've spent some time trying to add a regulator to control power to an SD card
(vmmc-supply) on an SDHCI-equipped system. After a few false starts and red herrings
I found that powering up the regulator during the boot process was effectively disabling
the SDHCI controller. Note that this was despite having regulator-boot-on set in the
device tree.

The problem seems to be in sdhci_set_power_reg:

	mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, vdd);

	if (mode != MMC_POWER_OFF)
		sdhci_writeb(host, SDHCI_POWER_ON, SDHCI_POWER_CONTROL);
	else
		sdhci_writeb(host, 0, SDHCI_POWER_CONTROL);

This looks plausible for the MMC_POWER_OFF case, but setting the SDHCI_POWER_CONTROL
register to SDHCI_POWER_ON (0x01) has the side effect of settings the SD Bus Voltage
Select bits to 0b000 (a reserved value).

sdhci_set_power_noreg() includes logic to calculate the correct values for the voltage
select bits, so I found that (in my limited test cases) replacing the if/else above
with a chain call to sdhci_set_power_noreg() was sufficient to get everything working.

Can anyone tell me what I've been doing wrong, or suggest a better "fix"?

Thanks for your time,

Phil Elwell



[Index of Archives]     [Linux Memonry Technology]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux