All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 04/14] MMC: OMAP: Power functions modified to MMC multislot support
@ 2007-09-20 15:03 Carlos Aguiar
  2007-10-09 15:29 ` Tony Lindgren
  0 siblings, 1 reply; 8+ messages in thread
From: Carlos Aguiar @ 2007-09-20 15:03 UTC (permalink / raw)
  To: omap-linux

From: Juha Yrjola <juha.yrjola@solidboot.com>

Modifications at power functions to MMC multislot support. This patch
also move board-specific code out of MMC OMAP driver.

Signed-off-by: Juha Yrjola <juha.yrjola@solidboot.com>
Signed-off-by: Carlos Eduardo Aguiar <carlos.aguiar@indt.org.br>
---
 drivers/mmc/host/omap.c |   88 ++++++++++++++++++-----------------------------
 1 files changed, 34 insertions(+), 54 deletions(-)

diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
index 5b09e9b..4e32149 100644
--- a/drivers/mmc/host/omap.c
+++ b/drivers/mmc/host/omap.c
@@ -1004,54 +1004,27 @@ static void mmc_omap_request(struct mmc_host *mmc, struct mmc_request *req)
 	mmc_omap_start_request(host, req);
 }
 
-static void innovator_fpga_socket_power(int on)
+static void mmc_omap_set_power(struct mmc_omap_slot *slot, int power_on,
+				int vdd)
 {
-#if defined(CONFIG_MACH_OMAP_INNOVATOR) && defined(CONFIG_ARCH_OMAP15XX)
-	if (on) {
-		fpga_write(fpga_read(OMAP1510_FPGA_POWER) | (1 << 3),
-		     OMAP1510_FPGA_POWER);
-	} else {
-		fpga_write(fpga_read(OMAP1510_FPGA_POWER) & ~(1 << 3),
-		     OMAP1510_FPGA_POWER);
-	}
-#endif
-}
+	struct mmc_omap_host *host;
 
-/*
- * Turn the socket power on/off. Innovator uses FPGA, most boards
- * probably use GPIO.
- */
-static void mmc_omap_power(struct mmc_omap_host *host, int on)
-{
-	if (machine_is_sx1())
-		sx1_setmmcpower(on);
-	else if (on) {
-		if (machine_is_omap_innovator())
-			innovator_fpga_socket_power(1);
-		else if (machine_is_omap_h2())
-			tps65010_set_gpio_out_value(GPIO3, HIGH);
-		else if (machine_is_omap_h3())
-			/* GPIO 4 of TPS65010 sends SD_EN signal */
-			tps65010_set_gpio_out_value(GPIO4, HIGH);
-		else if (cpu_is_omap24xx()) {
-			u16 reg = OMAP_MMC_READ(host, CON);
-			OMAP_MMC_WRITE(host, CON, reg | (1 << 11));
-		} else
-			if (host->power_pin >= 0)
-				omap_set_gpio_dataout(host->power_pin, 1);
-	} else {
-		if (machine_is_omap_innovator())
-			innovator_fpga_socket_power(0);
-		else if (machine_is_omap_h2())
-			tps65010_set_gpio_out_value(GPIO3, LOW);
-		else if (machine_is_omap_h3())
-			tps65010_set_gpio_out_value(GPIO4, LOW);
-		else if (cpu_is_omap24xx()) {
-			u16 reg = OMAP_MMC_READ(host, CON);
-			OMAP_MMC_WRITE(host, CON, reg & ~(1 << 11));
-		} else
-			if (host->power_pin >= 0)
-				omap_set_gpio_dataout(host->power_pin, 0);
+	host = slot->host;
+
+	if (slot->pdata->set_power != NULL)
+		slot->pdata->set_power(mmc_dev(slot->mmc), slot->id, power_on,
+					vdd);
+
+	if (cpu_is_omap24xx()) {
+		u16 w;
+
+		if (power_on) {
+			w = OMAP_MMC_READ(host, CON);
+			OMAP_MMC_WRITE(host, CON, w | (1 << 11));
+		} else {
+			w = OMAP_MMC_READ(host, CON);
+			OMAP_MMC_WRITE(host, CON, w & ~(1 << 11));
+		}
 	}
 }
 
@@ -1090,23 +1063,29 @@ static void mmc_omap_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
 	int i, dsor;
 
 	dsor = mmc_omap_calc_divisor(mmc, ios);
-	host->bus_mode = ios->bus_mode;
-	host->hw_bus_mode = host->bus_mode;
+
+	mmc_omap_select_slot(slot, 0);
+
+	if (ios->vdd != slot->vdd)
+		slot->vdd = ios->vdd;
 
 	switch (ios->power_mode) {
 	case MMC_POWER_OFF:
-		mmc_omap_power(host, 0);
+		mmc_omap_set_power(slot, 0, ios->vdd);
 		break;
 	case MMC_POWER_UP:
-		/* Cannot touch dsor yet, just power up MMC */
-		mmc_omap_power(host, 1);
-		return;
 	case MMC_POWER_ON:
+		mmc_omap_set_power(slot, 1, ios->vdd);
 		dsor |= 1 << 11;
 		break;
 	}
 
-	clk_enable(host->fclk);
+	if (slot->bus_mode != ios->bus_mode) {
+		if (slot->pdata->set_bus_mode != NULL)
+			slot->pdata->set_bus_mode(mmc_dev(mmc), slot->id,
+						  ios->bus_mode);
+		slot->bus_mode = ios->bus_mode;
+	}
 
 	/* On insanely high arm_per frequencies something sometimes
 	 * goes somehow out of sync, and the POW bit is not being set,
@@ -1114,6 +1093,7 @@ static void mmc_omap_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
 	 * Writing to the CON register twice seems to do the trick. */
 	for (i = 0; i < 2; i++)
 		OMAP_MMC_WRITE(host, CON, dsor);
+	slot->saved_con = dsor;
 	if (ios->power_mode == MMC_POWER_ON) {
 		/* Send clock cycles, poll completion */
 		OMAP_MMC_WRITE(host, IE, 0);
@@ -1122,7 +1102,7 @@ static void mmc_omap_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
 		while ((OMAP_MMC_READ(host, STAT) & 1) == 0);
 		OMAP_MMC_WRITE(host, STAT, 1);
 	}
-	clk_disable(host->fclk);
+	mmc_omap_release_slot(slot);
 }
 
 static int mmc_omap_get_ro(struct mmc_host *mmc)
-- 1.5.3.GIT

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 04/14] MMC: OMAP: Power functions modified to MMC multislot support
  2007-09-20 15:03 [PATCH 04/14] MMC: OMAP: Power functions modified to MMC multislot support Carlos Aguiar
@ 2007-10-09 15:29 ` Tony Lindgren
  2007-10-09 17:47   ` Carlos Aguiar
  0 siblings, 1 reply; 8+ messages in thread
From: Tony Lindgren @ 2007-10-09 15:29 UTC (permalink / raw)
  To: Carlos Aguiar; +Cc: omap-linux

Hi,

* Carlos Aguiar <carlos.aguiar@indt.org.br> [070920 08:05]:
> From: Juha Yrjola <juha.yrjola@solidboot.com>
> 
> Modifications at power functions to MMC multislot support. This patch
> also move board-specific code out of MMC OMAP driver.
> 
> Signed-off-by: Juha Yrjola <juha.yrjola@solidboot.com>
> Signed-off-by: Carlos Eduardo Aguiar <carlos.aguiar@indt.org.br>
> ---
>  drivers/mmc/host/omap.c |   88 ++++++++++++++++++-----------------------------
>  1 files changed, 34 insertions(+), 54 deletions(-)
> 
> @@ -1090,23 +1063,29 @@ static void mmc_omap_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
>  	int i, dsor;
>  
>  	dsor = mmc_omap_calc_divisor(mmc, ios);
> -	host->bus_mode = ios->bus_mode;
> -	host->hw_bus_mode = host->bus_mode;
> +
> +	mmc_omap_select_slot(slot, 0);
> +
> +	if (ios->vdd != slot->vdd)
> +		slot->vdd = ios->vdd;
>  
>  	switch (ios->power_mode) {
>  	case MMC_POWER_OFF:
> -		mmc_omap_power(host, 0);
> +		mmc_omap_set_power(slot, 0, ios->vdd);
>  		break;
>  	case MMC_POWER_UP:
> -		/* Cannot touch dsor yet, just power up MMC */
> -		mmc_omap_power(host, 1);
> -		return;
>  	case MMC_POWER_ON:
> +		mmc_omap_set_power(slot, 1, ios->vdd);
>  		dsor |= 1 << 11;
>  		break;
>  	}
>  

This part breaks the MMC_POWER_UP vs MMC_POWER_ON again.

This is third time I comment on the same issue I believe. Please
do not revert changes made in linux-omap with your patches.

You must power up MMC with MMC_POWER_UP, and then just set the
divisor in MMC_POWER_ON.

Regards,

Tony

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 04/14] MMC: OMAP: Power functions modified to MMC multislot support
  2007-10-09 15:29 ` Tony Lindgren
@ 2007-10-09 17:47   ` Carlos Aguiar
  2007-10-16 16:13     ` Carlos Aguiar
  2007-10-16 16:14     ` Carlos Aguiar
  0 siblings, 2 replies; 8+ messages in thread
From: Carlos Aguiar @ 2007-10-09 17:47 UTC (permalink / raw)
  To: ext Tony Lindgren; +Cc: omap-linux

ext Tony Lindgren wrote:
> Hi,
>
> * Carlos Aguiar <carlos.aguiar@indt.org.br> [070920 08:05]:
>   
>> From: Juha Yrjola <juha.yrjola@solidboot.com>
>>
>> Modifications at power functions to MMC multislot support. This patch
>> also move board-specific code out of MMC OMAP driver.
>>
>> Signed-off-by: Juha Yrjola <juha.yrjola@solidboot.com>
>> Signed-off-by: Carlos Eduardo Aguiar <carlos.aguiar@indt.org.br>
>> ---
>>  drivers/mmc/host/omap.c |   88 ++++++++++++++++++-----------------------------
>>  1 files changed, 34 insertions(+), 54 deletions(-)
>>
>> @@ -1090,23 +1063,29 @@ static void mmc_omap_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
>>  	int i, dsor;
>>  
>>  	dsor = mmc_omap_calc_divisor(mmc, ios);
>> -	host->bus_mode = ios->bus_mode;
>> -	host->hw_bus_mode = host->bus_mode;
>> +
>> +	mmc_omap_select_slot(slot, 0);
>> +
>> +	if (ios->vdd != slot->vdd)
>> +		slot->vdd = ios->vdd;
>>  
>>  	switch (ios->power_mode) {
>>  	case MMC_POWER_OFF:
>> -		mmc_omap_power(host, 0);
>> +		mmc_omap_set_power(slot, 0, ios->vdd);
>>  		break;
>>  	case MMC_POWER_UP:
>> -		/* Cannot touch dsor yet, just power up MMC */
>> -		mmc_omap_power(host, 1);
>> -		return;
>>  	case MMC_POWER_ON:
>> +		mmc_omap_set_power(slot, 1, ios->vdd);
>>  		dsor |= 1 << 11;
>>  		break;
>>  	}
>>  
>>     
>
>   
Hi Tony,

First of all, thanks for the comment...
> This part breaks the MMC_POWER_UP vs MMC_POWER_ON again.
>
> This is third time I comment on the same issue I believe. Please
> do not revert changes made in linux-omap with your patches.
>   
Well, I thought the solution proposed here was the best one. As I
mentioned, it worked fine.
> You must power up MMC with MMC_POWER_UP, and then just set the
> divisor in MMC_POWER_ON.
>   
Ok, anyway I will follow your comment. After test it, I will resend this
patch.

BR,

Carlos.
> Regards,
>
> Tony
>
>
>   


-- 
Carlos Eduardo Aguiar
Nokia Institute of Technology - INdT
Open Source Mobile Research Center - OSMRC - Manaus
Core Team
Phone: +55 92 2126-1079
Mobile: +55 92 8127-1797
E-mail: carlos.aguiar@indt.org.br

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 04/14] MMC: OMAP: Power functions modified to MMC multislot support
  2007-10-09 17:47   ` Carlos Aguiar
@ 2007-10-16 16:13     ` Carlos Aguiar
  2007-10-16 16:14     ` Carlos Aguiar
  1 sibling, 0 replies; 8+ messages in thread
From: Carlos Aguiar @ 2007-10-16 16:13 UTC (permalink / raw)
  To: ext Tony Lindgren; +Cc: omap-linux

ext Carlos Aguiar wrote:
> ext Tony Lindgren wrote:
>   
>> Hi,
>>
>> * Carlos Aguiar <carlos.aguiar@indt.org.br> [070920 08:05]:
>>   
>>     
>>> From: Juha Yrjola <juha.yrjola@solidboot.com>
>>>
>>> Modifications at power functions to MMC multislot support. This patch
>>> also move board-specific code out of MMC OMAP driver.
>>>
>>> Signed-off-by: Juha Yrjola <juha.yrjola@solidboot.com>
>>> Signed-off-by: Carlos Eduardo Aguiar <carlos.aguiar@indt.org.br>
>>> ---
>>>  drivers/mmc/host/omap.c |   88 ++++++++++++++++++-----------------------------
>>>  1 files changed, 34 insertions(+), 54 deletions(-)
>>>
>>> @@ -1090,23 +1063,29 @@ static void mmc_omap_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
>>>  	int i, dsor;
>>>  
>>>  	dsor = mmc_omap_calc_divisor(mmc, ios);
>>> -	host->bus_mode = ios->bus_mode;
>>> -	host->hw_bus_mode = host->bus_mode;
>>> +
>>> +	mmc_omap_select_slot(slot, 0);
>>> +
>>> +	if (ios->vdd != slot->vdd)
>>> +		slot->vdd = ios->vdd;
>>>  
>>>  	switch (ios->power_mode) {
>>>  	case MMC_POWER_OFF:
>>> -		mmc_omap_power(host, 0);
>>> +		mmc_omap_set_power(slot, 0, ios->vdd);
>>>  		break;
>>>  	case MMC_POWER_UP:
>>> -		/* Cannot touch dsor yet, just power up MMC */
>>> -		mmc_omap_power(host, 1);
>>> -		return;
>>>  	case MMC_POWER_ON:
>>> +		mmc_omap_set_power(slot, 1, ios->vdd);
>>>  		dsor |= 1 << 11;
>>>  		break;
>>>  	}
>>>  
>>>     
>>>       
>>   
>>     
> Hi Tony,
>
> First of all, thanks for the comment...
>   
>> This part breaks the MMC_POWER_UP vs MMC_POWER_ON again.
>>
>> This is third time I comment on the same issue I believe. Please
>> do not revert changes made in linux-omap with your patches.
>>   
>>     
> Well, I thought the solution proposed here was the best one. As I
> mentioned, it worked fine.
>   
>> You must power up MMC with MMC_POWER_UP, and then just set the
>> divisor in MMC_POWER_ON.
>>   
>>     
> Ok, anyway I will follow your comment. After test it, I will resend this
> patch.
>
> BR,
>
> Carlos.
>   
>> Regards,
>>
>> Tony
>>
>>
>>   
>>     
>
>
>   
Hi Tony,

I'm resendig the patch. As you said, I'd powered up MMC with MMC_POWER_UP and then set the
divisor in MMC_POWER_ON.

Tested with N800, H2 and H3 and works fine.

BR,

Carlos.

-- 
Carlos Eduardo Aguiar
Nokia Institute of Technology - INdT
Open Source Mobile Research Center - OSMRC - Manaus
Core Team
Phone: +55 92 2126-1079
Mobile: +55 92 8127-1797
E-mail: carlos.aguiar@indt.org.br

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 04/14] MMC: OMAP: Power functions modified to MMC multislot support
  2007-10-09 17:47   ` Carlos Aguiar
  2007-10-16 16:13     ` Carlos Aguiar
@ 2007-10-16 16:14     ` Carlos Aguiar
  2007-10-21 23:49       ` Tony Lindgren
  1 sibling, 1 reply; 8+ messages in thread
From: Carlos Aguiar @ 2007-10-16 16:14 UTC (permalink / raw)
  To: ext Tony Lindgren; +Cc: omap-linux

From: Juha Yrjola <juha.yrjola@solidboot.com>

Modifications at power functions to MMC multislot support. This patch
also move board-specific code out of MMC OMAP driver.

Signed-off-by: Juha Yrjola <juha.yrjola@solidboot.com>
Signed-off-by: Carlos Eduardo Aguiar <carlos.aguiar@indt.org.br>
---
 drivers/mmc/host/omap.c |   87 ++++++++++++++++++----------------------------
 1 files changed, 34 insertions(+), 53 deletions(-)

diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
index 5b09e9b..6f3b9a3 100644
--- a/drivers/mmc/host/omap.c
+++ b/drivers/mmc/host/omap.c
@@ -1004,54 +1004,27 @@ static void mmc_omap_request(struct mmc_host *mmc, struct mmc_request *req)
 	mmc_omap_start_request(host, req);
 }
 
-static void innovator_fpga_socket_power(int on)
+static void mmc_omap_set_power(struct mmc_omap_slot *slot, int power_on,
+				int vdd)
 {
-#if defined(CONFIG_MACH_OMAP_INNOVATOR) && defined(CONFIG_ARCH_OMAP15XX)
-	if (on) {
-		fpga_write(fpga_read(OMAP1510_FPGA_POWER) | (1 << 3),
-		     OMAP1510_FPGA_POWER);
-	} else {
-		fpga_write(fpga_read(OMAP1510_FPGA_POWER) & ~(1 << 3),
-		     OMAP1510_FPGA_POWER);
-	}
-#endif
-}
+	struct mmc_omap_host *host;
 
-/*
- * Turn the socket power on/off. Innovator uses FPGA, most boards
- * probably use GPIO.
- */
-static void mmc_omap_power(struct mmc_omap_host *host, int on)
-{
-	if (machine_is_sx1())
-		sx1_setmmcpower(on);
-	else if (on) {
-		if (machine_is_omap_innovator())
-			innovator_fpga_socket_power(1);
-		else if (machine_is_omap_h2())
-			tps65010_set_gpio_out_value(GPIO3, HIGH);
-		else if (machine_is_omap_h3())
-			/* GPIO 4 of TPS65010 sends SD_EN signal */
-			tps65010_set_gpio_out_value(GPIO4, HIGH);
-		else if (cpu_is_omap24xx()) {
-			u16 reg = OMAP_MMC_READ(host, CON);
-			OMAP_MMC_WRITE(host, CON, reg | (1 << 11));
-		} else
-			if (host->power_pin >= 0)
-				omap_set_gpio_dataout(host->power_pin, 1);
-	} else {
-		if (machine_is_omap_innovator())
-			innovator_fpga_socket_power(0);
-		else if (machine_is_omap_h2())
-			tps65010_set_gpio_out_value(GPIO3, LOW);
-		else if (machine_is_omap_h3())
-			tps65010_set_gpio_out_value(GPIO4, LOW);
-		else if (cpu_is_omap24xx()) {
-			u16 reg = OMAP_MMC_READ(host, CON);
-			OMAP_MMC_WRITE(host, CON, reg & ~(1 << 11));
-		} else
-			if (host->power_pin >= 0)
-				omap_set_gpio_dataout(host->power_pin, 0);
+	host = slot->host;
+
+	if (slot->pdata->set_power != NULL)
+		slot->pdata->set_power(mmc_dev(slot->mmc), slot->id, power_on,
+					vdd);
+
+	if (cpu_is_omap24xx()) {
+		u16 w;
+
+		if (power_on) {
+			w = OMAP_MMC_READ(host, CON);
+			OMAP_MMC_WRITE(host, CON, w | (1 << 11));
+		} else {
+			w = OMAP_MMC_READ(host, CON);
+			OMAP_MMC_WRITE(host, CON, w & ~(1 << 11));
+		}
 	}
 }
 
@@ -1090,23 +1063,30 @@ static void mmc_omap_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
 	int i, dsor;
 
 	dsor = mmc_omap_calc_divisor(mmc, ios);
-	host->bus_mode = ios->bus_mode;
-	host->hw_bus_mode = host->bus_mode;
+
+	mmc_omap_select_slot(slot, 0);
+
+	if (ios->vdd != slot->vdd)
+		slot->vdd = ios->vdd;
 
 	switch (ios->power_mode) {
 	case MMC_POWER_OFF:
-		mmc_omap_power(host, 0);
+		mmc_omap_set_power(slot, 0, ios->vdd);
 		break;
 	case MMC_POWER_UP:
 		/* Cannot touch dsor yet, just power up MMC */
-		mmc_omap_power(host, 1);
-		return;
+		mmc_omap_set_power(slot, 1, ios->vdd);
 	case MMC_POWER_ON:
 		dsor |= 1 << 11;
 		break;
 	}
 
-	clk_enable(host->fclk);
+	if (slot->bus_mode != ios->bus_mode) {
+		if (slot->pdata->set_bus_mode != NULL)
+			slot->pdata->set_bus_mode(mmc_dev(mmc), slot->id,
+						  ios->bus_mode);
+		slot->bus_mode = ios->bus_mode;
+	}
 
 	/* On insanely high arm_per frequencies something sometimes
 	 * goes somehow out of sync, and the POW bit is not being set,
@@ -1114,6 +1094,7 @@ static void mmc_omap_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
 	 * Writing to the CON register twice seems to do the trick. */
 	for (i = 0; i < 2; i++)
 		OMAP_MMC_WRITE(host, CON, dsor);
+	slot->saved_con = dsor;
 	if (ios->power_mode == MMC_POWER_ON) {
 		/* Send clock cycles, poll completion */
 		OMAP_MMC_WRITE(host, IE, 0);
@@ -1122,7 +1103,7 @@ static void mmc_omap_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
 		while ((OMAP_MMC_READ(host, STAT) & 1) == 0);
 		OMAP_MMC_WRITE(host, STAT, 1);
 	}
-	clk_disable(host->fclk);
+	mmc_omap_release_slot(slot);
 }
 
 static int mmc_omap_get_ro(struct mmc_host *mmc)
-- 1.5.3.GIT

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 04/14] MMC: OMAP: Power functions modified to MMC multislot support
  2007-10-16 16:14     ` Carlos Aguiar
@ 2007-10-21 23:49       ` Tony Lindgren
  2007-10-23 15:24         ` Carlos Aguiar
  0 siblings, 1 reply; 8+ messages in thread
From: Tony Lindgren @ 2007-10-21 23:49 UTC (permalink / raw)
  To: Carlos Aguiar; +Cc: omap-linux

Hi,

* Carlos Aguiar <carlos.aguiar@indt.org.br> [071016 09:17]:
> From: Juha Yrjola <juha.yrjola@solidboot.com>
> 
> Modifications at power functions to MMC multislot support. This patch
> also move board-specific code out of MMC OMAP driver.

<snip>

> @@ -1090,23 +1063,30 @@ static void mmc_omap_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
>  	int i, dsor;
>  
>  	dsor = mmc_omap_calc_divisor(mmc, ios);
> -	host->bus_mode = ios->bus_mode;
> -	host->hw_bus_mode = host->bus_mode;
> +
> +	mmc_omap_select_slot(slot, 0);
> +
> +	if (ios->vdd != slot->vdd)
> +		slot->vdd = ios->vdd;
>  
>  	switch (ios->power_mode) {
>  	case MMC_POWER_OFF:
> -		mmc_omap_power(host, 0);
> +		mmc_omap_set_power(slot, 0, ios->vdd);
>  		break;
>  	case MMC_POWER_UP:
>  		/* Cannot touch dsor yet, just power up MMC */
> -		mmc_omap_power(host, 1);
> -		return;
> +		mmc_omap_set_power(slot, 1, ios->vdd);
>  	case MMC_POWER_ON:
>  		dsor |= 1 << 11;
>  		break;
>  	}
>  
> -	clk_enable(host->fclk);
> +	if (slot->bus_mode != ios->bus_mode) {
> +		if (slot->pdata->set_bus_mode != NULL)
> +			slot->pdata->set_bus_mode(mmc_dev(mmc), slot->id,
> +						  ios->bus_mode);
> +		slot->bus_mode = ios->bus_mode;
> +	}
>  
>  	/* On insanely high arm_per frequencies something sometimes
>  	 * goes somehow out of sync, and the POW bit is not being set,

The above still changes behaviour, you've left out return after
MMC_POWER_UP. That is not supposed to do anything except power
up the slot and return as mentioned in the comment.

Tony

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 04/14] MMC: OMAP: Power functions modified to MMC multislot support
  2007-10-21 23:49       ` Tony Lindgren
@ 2007-10-23 15:24         ` Carlos Aguiar
  2007-11-04 22:54           ` Carlos Aguiar
  0 siblings, 1 reply; 8+ messages in thread
From: Carlos Aguiar @ 2007-10-23 15:24 UTC (permalink / raw)
  To: ext Tony Lindgren; +Cc: omap-linux

ext Tony Lindgren wrote:
> Hi,
>
> * Carlos Aguiar <carlos.aguiar@indt.org.br> [071016 09:17]:
>   
>> From: Juha Yrjola <juha.yrjola@solidboot.com>
>>
>> Modifications at power functions to MMC multislot support. This patch
>> also move board-specific code out of MMC OMAP driver.
>>     
>
> <snip>
>
>   
>> @@ -1090,23 +1063,30 @@ static void mmc_omap_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
>>  	int i, dsor;
>>  
>>  	dsor = mmc_omap_calc_divisor(mmc, ios);
>> -	host->bus_mode = ios->bus_mode;
>> -	host->hw_bus_mode = host->bus_mode;
>> +
>> +	mmc_omap_select_slot(slot, 0);
>> +
>> +	if (ios->vdd != slot->vdd)
>> +		slot->vdd = ios->vdd;
>>  
>>  	switch (ios->power_mode) {
>>  	case MMC_POWER_OFF:
>> -		mmc_omap_power(host, 0);
>> +		mmc_omap_set_power(slot, 0, ios->vdd);
>>  		break;
>>  	case MMC_POWER_UP:
>>  		/* Cannot touch dsor yet, just power up MMC */
>> -		mmc_omap_power(host, 1);
>> -		return;
>> +		mmc_omap_set_power(slot, 1, ios->vdd);
>>  	case MMC_POWER_ON:
>>  		dsor |= 1 << 11;
>>  		break;
>>  	}
>>  
>> -	clk_enable(host->fclk);
>> +	if (slot->bus_mode != ios->bus_mode) {
>> +		if (slot->pdata->set_bus_mode != NULL)
>> +			slot->pdata->set_bus_mode(mmc_dev(mmc), slot->id,
>> +						  ios->bus_mode);
>> +		slot->bus_mode = ios->bus_mode;
>> +	}
>>  
>>  	/* On insanely high arm_per frequencies something sometimes
>>  	 * goes somehow out of sync, and the POW bit is not being set,
>>     
>
>   
Hi Tony,

Sorry for my late response. In fact, I'm in sick leave.


> The above still changes behaviour, you've left out return after
> MMC_POWER_UP. That is not supposed to do anything except power
> up the slot and return as mentioned in the comment.
>   
Well, the first option I tried was of course return after MMC_POWER_UP. But, unexpectedly, such return is broken on N800. 

I'm working and investigating this today.

BR,

Carlos.

> Tony
>
>   


-- 
Carlos Eduardo Aguiar
Nokia Institute of Technology - INdT
Open Source Mobile Research Center - OSMRC - Manaus
Core Team
Phone: +55 92 2126-1079
Mobile: +55 92 8127-1797
E-mail: carlos.aguiar@indt.org.br

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 04/14] MMC: OMAP: Power functions modified to MMC multislot support
  2007-10-23 15:24         ` Carlos Aguiar
@ 2007-11-04 22:54           ` Carlos Aguiar
  0 siblings, 0 replies; 8+ messages in thread
From: Carlos Aguiar @ 2007-11-04 22:54 UTC (permalink / raw)
  To: ext Tony Lindgren; +Cc: omap-linux

[-- Attachment #1: Type: text/plain, Size: 2984 bytes --]

ext Carlos Aguiar wrote:
> ext Tony Lindgren wrote:
>   
>> Hi,
>>
>> * Carlos Aguiar <carlos.aguiar@indt.org.br> [071016 09:17]:
>>   
>>     
>>> From: Juha Yrjola <juha.yrjola@solidboot.com>
>>>
>>> Modifications at power functions to MMC multislot support. This patch
>>> also move board-specific code out of MMC OMAP driver.
>>>     
>>>       
>> <snip>
>>
>>   
>>     
>>> @@ -1090,23 +1063,30 @@ static void mmc_omap_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
>>>  	int i, dsor;
>>>  
>>>  	dsor = mmc_omap_calc_divisor(mmc, ios);
>>> -	host->bus_mode = ios->bus_mode;
>>> -	host->hw_bus_mode = host->bus_mode;
>>> +
>>> +	mmc_omap_select_slot(slot, 0);
>>> +
>>> +	if (ios->vdd != slot->vdd)
>>> +		slot->vdd = ios->vdd;
>>>  
>>>  	switch (ios->power_mode) {
>>>  	case MMC_POWER_OFF:
>>> -		mmc_omap_power(host, 0);
>>> +		mmc_omap_set_power(slot, 0, ios->vdd);
>>>  		break;
>>>  	case MMC_POWER_UP:
>>>  		/* Cannot touch dsor yet, just power up MMC */
>>> -		mmc_omap_power(host, 1);
>>> -		return;
>>> +		mmc_omap_set_power(slot, 1, ios->vdd);
>>>  	case MMC_POWER_ON:
>>>  		dsor |= 1 << 11;
>>>  		break;
>>>  	}
>>>  
>>> -	clk_enable(host->fclk);
>>> +	if (slot->bus_mode != ios->bus_mode) {
>>> +		if (slot->pdata->set_bus_mode != NULL)
>>> +			slot->pdata->set_bus_mode(mmc_dev(mmc), slot->id,
>>> +						  ios->bus_mode);
>>> +		slot->bus_mode = ios->bus_mode;
>>> +	}
>>>  
>>>  	/* On insanely high arm_per frequencies something sometimes
>>>  	 * goes somehow out of sync, and the POW bit is not being set,
>>>     
>>>       
>>   
>>     
> Hi Tony,
>
> Sorry for my late response. In fact, I'm in sick leave.
>
>
>   
>> The above still changes behaviour, you've left out return after
>> MMC_POWER_UP. That is not supposed to do anything except power
>> up the slot and return as mentioned in the comment.
>>   
>>     
> Well, the first option I tried was of course return after MMC_POWER_UP. But, unexpectedly, such return is broken on N800. 
>
> I'm working and investigating this today.
>
> BR,
>
> Carlos.
>
>   
>> Tony
>>
>>   
>>     
>
>
>   
Hi Tony,

As I mentioned on previous mail, the return after MMC_POWER_UP unexpectedly is broken on N800. So, I was investigating such problem and I'm resending the patch with a new solution, that I aim to don't revert MMC_POWER_UP vs MMC_POWER_ON.

This solution was tested on N800 and H3 and works fine with multislot patch series on top of previous commit (47c7785083ea67a7be90c7ace22ea639fa2e48f4). The patch is attached to this mail.

As Linux-OMAP tree was updated last days and merged with linus tree, some modifications must be updated to multislot series and tested. I'd already start this task.

So, I'm going to resend the whole series until next Wed (Nov,7).

BR,

Carlos.


-- 
Carlos Eduardo Aguiar
Nokia Institute of Technology - INdT
Open Source Mobile Research Center - OSMRC - Manaus
Core Team
Phone: +55 92 2126-1079
Mobile: +55 92 8127-1797
E-mail: carlos.aguiar@indt.org.br


[-- Attachment #2: 0004-MMC-OMAP-Power-functions-modified-to-MMC-multislot.patch --]
[-- Type: text/x-patch, Size: 4645 bytes --]

>From e22e4723f6ba673dc938be09ea096474c00c1e72 Mon Sep 17 00:00:00 2001
From: Juha Yrjola <juha.yrjola@solidboot.com>
Date: Mon, 17 Sep 2007 11:32:17 -0400
Subject: [PATCH 04/17] MMC: OMAP: Power functions modified to MMC multislot support

Modifications at power functions to MMC multislot support. This patch
also move board-specific code out of MMC OMAP driver.

Signed-off-by: Juha Yrjola <juha.yrjola@solidboot.com>
Signed-off-by: Carlos Eduardo Aguiar <carlos.aguiar@indt.org.br>
---
 drivers/mmc/host/omap.c |   90 +++++++++++++++++++---------------------------
 1 files changed, 37 insertions(+), 53 deletions(-)

diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
index 4cc5265..02f4463 100644
--- a/drivers/mmc/host/omap.c
+++ b/drivers/mmc/host/omap.c
@@ -1004,54 +1004,27 @@ static void mmc_omap_request(struct mmc_host *mmc, struct mmc_request *req)
 	mmc_omap_start_request(host, req);
 }
 
-static void innovator_fpga_socket_power(int on)
+static void mmc_omap_set_power(struct mmc_omap_slot *slot, int power_on,
+				int vdd)
 {
-#if defined(CONFIG_MACH_OMAP_INNOVATOR) && defined(CONFIG_ARCH_OMAP15XX)
-	if (on) {
-		fpga_write(fpga_read(OMAP1510_FPGA_POWER) | (1 << 3),
-		     OMAP1510_FPGA_POWER);
-	} else {
-		fpga_write(fpga_read(OMAP1510_FPGA_POWER) & ~(1 << 3),
-		     OMAP1510_FPGA_POWER);
-	}
-#endif
-}
+	struct mmc_omap_host *host;
 
-/*
- * Turn the socket power on/off. Innovator uses FPGA, most boards
- * probably use GPIO.
- */
-static void mmc_omap_power(struct mmc_omap_host *host, int on)
-{
-	if (machine_is_sx1())
-		sx1_setmmcpower(on);
-	else if (on) {
-		if (machine_is_omap_innovator())
-			innovator_fpga_socket_power(1);
-		else if (machine_is_omap_h2())
-			tps65010_set_gpio_out_value(GPIO3, HIGH);
-		else if (machine_is_omap_h3())
-			/* GPIO 4 of TPS65010 sends SD_EN signal */
-			tps65010_set_gpio_out_value(GPIO4, HIGH);
-		else if (cpu_is_omap24xx()) {
-			u16 reg = OMAP_MMC_READ(host, CON);
-			OMAP_MMC_WRITE(host, CON, reg | (1 << 11));
-		} else
-			if (host->power_pin >= 0)
-				omap_set_gpio_dataout(host->power_pin, 1);
-	} else {
-		if (machine_is_omap_innovator())
-			innovator_fpga_socket_power(0);
-		else if (machine_is_omap_h2())
-			tps65010_set_gpio_out_value(GPIO3, LOW);
-		else if (machine_is_omap_h3())
-			tps65010_set_gpio_out_value(GPIO4, LOW);
-		else if (cpu_is_omap24xx()) {
-			u16 reg = OMAP_MMC_READ(host, CON);
-			OMAP_MMC_WRITE(host, CON, reg & ~(1 << 11));
-		} else
-			if (host->power_pin >= 0)
-				omap_set_gpio_dataout(host->power_pin, 0);
+	host = slot->host;
+
+	if (slot->pdata->set_power != NULL)
+		slot->pdata->set_power(mmc_dev(slot->mmc), slot->id, power_on,
+					vdd);
+
+	if (cpu_is_omap24xx()) {
+		u16 w;
+
+		if (power_on) {
+			w = OMAP_MMC_READ(host, CON);
+			OMAP_MMC_WRITE(host, CON, w | (1 << 11));
+		} else {
+			w = OMAP_MMC_READ(host, CON);
+			OMAP_MMC_WRITE(host, CON, w & ~(1 << 11));
+		}
 	}
 }
 
@@ -1090,23 +1063,31 @@ static void mmc_omap_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
 	int i, dsor;
 
 	dsor = mmc_omap_calc_divisor(mmc, ios);
-	host->bus_mode = ios->bus_mode;
-	host->hw_bus_mode = host->bus_mode;
+
+	mmc_omap_select_slot(slot, 0);
+
+	if (ios->vdd != slot->vdd)
+		slot->vdd = ios->vdd;
 
 	switch (ios->power_mode) {
 	case MMC_POWER_OFF:
-		mmc_omap_power(host, 0);
+		mmc_omap_set_power(slot, 0, ios->vdd);
 		break;
 	case MMC_POWER_UP:
 		/* Cannot touch dsor yet, just power up MMC */
-		mmc_omap_power(host, 1);
-		return;
+		mmc_omap_set_power(slot, 1, ios->vdd);
+		goto exit;
 	case MMC_POWER_ON:
 		dsor |= 1 << 11;
 		break;
 	}
 
-	clk_enable(host->fclk);
+	if (slot->bus_mode != ios->bus_mode) {
+		if (slot->pdata->set_bus_mode != NULL)
+			slot->pdata->set_bus_mode(mmc_dev(mmc), slot->id,
+						  ios->bus_mode);
+		slot->bus_mode = ios->bus_mode;
+	}
 
 	/* On insanely high arm_per frequencies something sometimes
 	 * goes somehow out of sync, and the POW bit is not being set,
@@ -1114,6 +1095,7 @@ static void mmc_omap_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
 	 * Writing to the CON register twice seems to do the trick. */
 	for (i = 0; i < 2; i++)
 		OMAP_MMC_WRITE(host, CON, dsor);
+	slot->saved_con = dsor;
 	if (ios->power_mode == MMC_POWER_ON) {
 		/* Send clock cycles, poll completion */
 		OMAP_MMC_WRITE(host, IE, 0);
@@ -1122,7 +1104,9 @@ static void mmc_omap_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
 		while ((OMAP_MMC_READ(host, STAT) & 1) == 0);
 		OMAP_MMC_WRITE(host, STAT, 1);
 	}
-	clk_disable(host->fclk);
+
+exit:
+	mmc_omap_release_slot(slot);
 }
 
 static int mmc_omap_get_ro(struct mmc_host *mmc)
-- 
1.5.3.GIT


[-- Attachment #3: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2007-11-04 22:54 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-09-20 15:03 [PATCH 04/14] MMC: OMAP: Power functions modified to MMC multislot support Carlos Aguiar
2007-10-09 15:29 ` Tony Lindgren
2007-10-09 17:47   ` Carlos Aguiar
2007-10-16 16:13     ` Carlos Aguiar
2007-10-16 16:14     ` Carlos Aguiar
2007-10-21 23:49       ` Tony Lindgren
2007-10-23 15:24         ` Carlos Aguiar
2007-11-04 22:54           ` Carlos Aguiar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.