diff mbox

[RFC,4/7] mmc: sdhci: Add quirk to indicate broken POWER_CONTROL

Message ID 20170807160142.12134-5-kishon@ti.com (mailing list archive)
State New, archived
Headers show

Commit Message

Kishon Vijay Abraham I Aug. 7, 2017, 4:01 p.m. UTC
TI's implementation of sdhci controller used in DRA7 SoC's uses
POWER_CONTROL register for configuring IO voltage and not
for core voltage (vdd) which is it's intended use. Add a quirk
to indicate broken POWER_CONTROL register.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 drivers/mmc/host/sdhci.c | 6 ++++++
 drivers/mmc/host/sdhci.h | 2 ++
 2 files changed, 8 insertions(+)

Comments

Adrian Hunter Aug. 15, 2017, 7:41 a.m. UTC | #1
On 07/08/17 19:01, Kishon Vijay Abraham I wrote:
> TI's implementation of sdhci controller used in DRA7 SoC's uses
> POWER_CONTROL register for configuring IO voltage and not
> for core voltage (vdd) which is it's intended use. Add a quirk
> to indicate broken POWER_CONTROL register.

A quirk isn't needed for this.  Use the ->set_power() callback instead.

> 
> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
> ---
>  drivers/mmc/host/sdhci.c | 6 ++++++
>  drivers/mmc/host/sdhci.h | 2 ++
>  2 files changed, 8 insertions(+)
> 
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index d5050ec42481..a7465a56e6b5 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -1419,6 +1419,9 @@ static void sdhci_set_power_reg(struct sdhci_host *host, unsigned char mode,
>  
>  	mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, vdd);
>  
> +	if (host->quirks2 & SDHCI_QUIRK2_BROKEN_POWER_CONTROL)
> +		return;
> +
>  	if (mode != MMC_POWER_OFF)
>  		sdhci_writeb(host, SDHCI_POWER_ON, SDHCI_POWER_CONTROL);
>  	else
> @@ -1430,6 +1433,9 @@ void sdhci_set_power_noreg(struct sdhci_host *host, unsigned char mode,
>  {
>  	u8 pwr = 0;
>  
> +	if (host->quirks2 & SDHCI_QUIRK2_BROKEN_POWER_CONTROL)
> +		return;
> +
>  	if (mode != MMC_POWER_OFF) {
>  		switch (1 << vdd) {
>  		case MMC_VDD_165_195:
> diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
> index 39c7a2723906..ba94cca7c892 100644
> --- a/drivers/mmc/host/sdhci.h
> +++ b/drivers/mmc/host/sdhci.h
> @@ -439,6 +439,8 @@ struct sdhci_host {
>  #define SDHCI_QUIRK2_NO_CRC_STRIPPING			(1<<16)
>  /* Controller has bad caps bits, but really supports DMA */
>  #define SDHCI_QUIRK2_FORCE_ADMA				(1<<17)
> +/* Controller uses POWER_CONTROL for managing IO voltage and not core voltage */
> +#define SDHCI_QUIRK2_BROKEN_POWER_CONTROL		(1<<18)
>  
>  	int irq;		/* Device IRQ */
>  	void __iomem *ioaddr;	/* Mapped address */
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Kishon Vijay Abraham I Aug. 17, 2017, 5:32 a.m. UTC | #2
On Tuesday 15 August 2017 01:11 PM, Adrian Hunter wrote:
> On 07/08/17 19:01, Kishon Vijay Abraham I wrote:
>> TI's implementation of sdhci controller used in DRA7 SoC's uses
>> POWER_CONTROL register for configuring IO voltage and not
>> for core voltage (vdd) which is it's intended use. Add a quirk
>> to indicate broken POWER_CONTROL register.
> 
> A quirk isn't needed for this.  Use the ->set_power() callback instead.

sure!

Thanks
Kishon
> 
>>
>> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
>> ---
>>  drivers/mmc/host/sdhci.c | 6 ++++++
>>  drivers/mmc/host/sdhci.h | 2 ++
>>  2 files changed, 8 insertions(+)
>>
>> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
>> index d5050ec42481..a7465a56e6b5 100644
>> --- a/drivers/mmc/host/sdhci.c
>> +++ b/drivers/mmc/host/sdhci.c
>> @@ -1419,6 +1419,9 @@ static void sdhci_set_power_reg(struct sdhci_host *host, unsigned char mode,
>>  
>>  	mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, vdd);
>>  
>> +	if (host->quirks2 & SDHCI_QUIRK2_BROKEN_POWER_CONTROL)
>> +		return;
>> +
>>  	if (mode != MMC_POWER_OFF)
>>  		sdhci_writeb(host, SDHCI_POWER_ON, SDHCI_POWER_CONTROL);
>>  	else
>> @@ -1430,6 +1433,9 @@ void sdhci_set_power_noreg(struct sdhci_host *host, unsigned char mode,
>>  {
>>  	u8 pwr = 0;
>>  
>> +	if (host->quirks2 & SDHCI_QUIRK2_BROKEN_POWER_CONTROL)
>> +		return;
>> +
>>  	if (mode != MMC_POWER_OFF) {
>>  		switch (1 << vdd) {
>>  		case MMC_VDD_165_195:
>> diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
>> index 39c7a2723906..ba94cca7c892 100644
>> --- a/drivers/mmc/host/sdhci.h
>> +++ b/drivers/mmc/host/sdhci.h
>> @@ -439,6 +439,8 @@ struct sdhci_host {
>>  #define SDHCI_QUIRK2_NO_CRC_STRIPPING			(1<<16)
>>  /* Controller has bad caps bits, but really supports DMA */
>>  #define SDHCI_QUIRK2_FORCE_ADMA				(1<<17)
>> +/* Controller uses POWER_CONTROL for managing IO voltage and not core voltage */
>> +#define SDHCI_QUIRK2_BROKEN_POWER_CONTROL		(1<<18)
>>  
>>  	int irq;		/* Device IRQ */
>>  	void __iomem *ioaddr;	/* Mapped address */
>>
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index d5050ec42481..a7465a56e6b5 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1419,6 +1419,9 @@  static void sdhci_set_power_reg(struct sdhci_host *host, unsigned char mode,
 
 	mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, vdd);
 
+	if (host->quirks2 & SDHCI_QUIRK2_BROKEN_POWER_CONTROL)
+		return;
+
 	if (mode != MMC_POWER_OFF)
 		sdhci_writeb(host, SDHCI_POWER_ON, SDHCI_POWER_CONTROL);
 	else
@@ -1430,6 +1433,9 @@  void sdhci_set_power_noreg(struct sdhci_host *host, unsigned char mode,
 {
 	u8 pwr = 0;
 
+	if (host->quirks2 & SDHCI_QUIRK2_BROKEN_POWER_CONTROL)
+		return;
+
 	if (mode != MMC_POWER_OFF) {
 		switch (1 << vdd) {
 		case MMC_VDD_165_195:
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
index 39c7a2723906..ba94cca7c892 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -439,6 +439,8 @@  struct sdhci_host {
 #define SDHCI_QUIRK2_NO_CRC_STRIPPING			(1<<16)
 /* Controller has bad caps bits, but really supports DMA */
 #define SDHCI_QUIRK2_FORCE_ADMA				(1<<17)
+/* Controller uses POWER_CONTROL for managing IO voltage and not core voltage */
+#define SDHCI_QUIRK2_BROKEN_POWER_CONTROL		(1<<18)
 
 	int irq;		/* Device IRQ */
 	void __iomem *ioaddr;	/* Mapped address */