mmc: at91: fix bus speed
Subsystems (2)
PATCH 1/1 mmc: at91: fix bus speed
This patch change minimum and maximum clock speed because some noname cards doesn't work during init even at 375kHz and new cards (SD v. 3.0) can run at 50 or 100 MHz.
Also aded clkdiv register overrun fix when setting low speeds.
---
linux-3.5-rc3/drivers/mmc/host/at91_mci.c renamed from linux-3.5-rc3/drivers/mmc/host/at91_mci.c.orig +6 -2
@@ -724,6 +724,10 @@ static void at91_mci_set_ios(struct mmc_else clkdiv = (at91_master_clock / ios->clock) /2 ; +/* set maximum divider */ +if (clkdiv >255 ) + clkdiv =255 ; +pr_debug ("clkdiv = %d. mcck = %ld\n" , clkdiv, at91_master_clock / (2 * (clkdiv +1 ))); }
@@ -948,8 +952,8 @@ static int __init at91_mci_probe(struct } mmc->ops = &at91_mci_ops; - mmc->f_min =375000 ; - mmc->f_max =25000000 ; + mmc->f_min =200000 ;/* not all cards can run at 375kHz */ + mmc->f_max =100000000 ;/* new cards can run at 100MHz */ mmc->ocr_avail =MMC_VDD_32_33 |MMC_VDD_33_34 ; mmc->caps =0 ;
PATCH 1/1 mmc: at91: fix bus speed
Hello Jiri,
Thanks for your patch but at91-mci is now deprecated and should be removed in 3.7.
On one hand I don't know if we have to continue to take patches for this driver, on the other hand it's a fix for some SD cards.
Le 06/20/2012 10:15 AM, Prchal Ji?? a ?crit :
Quoted 24 lines
This patch change minimum and maximum clock speed because some noname cards doesn't work during init even at 375kHz and new cards (SD v. 3.0) can run at 50 or 100 MHz.
Also aded clkdiv register overrun fix when setting low speeds.Signed-off-by Jiri Prchal <[email protected]>---
--- linux/linux-3.5-rc3/drivers/mmc/host/at91_mci.c.orig 2012-06-17
02:25:17.000000000 +0200
+++linux/linux-3.5-rc3/drivers/mmc/host/at91_mci.c2012-06-18
11:01:49.751415984 +0200linux-3.5-rc3/drivers/mmc/host/at91_mci.c renamed from linux-3.5-rc3/drivers/mmc/host/at91_mci.c.orig +4
-0@@ -724,6 +724,10 @@ static void at91_mci_set_ios(struct mmc_else clkdiv = (at91_master_clock / ios->clock) /2 ; +/* set maximum divider */ +if (clkdiv >255 ) + clkdiv =255 ; +pr_debug ("clkdiv = %d. mcck = %ld\n" , clkdiv, at91_master_clock / (2 * (clkdiv +1 ))); }
linux-3.5-rc3/drivers/mmc/host/at91_mci.c static int __init at91_mci_probe(struct · line 955
Quoted 6 lines
linux-3.5-rc3/drivers/mmc/host/at91_mci.c renamed from linux-3.5-rc3/drivers/mmc/host/at91_mci.c.orig +1
-2@@ -948,8 +952,8 @@ static int __init at91_mci_probe(struct } mmc->ops = &at91_mci_ops; - mmc->f_min =375000 ; - mmc->f_max =25000000 ; + mmc->f_min =200000 ;/* not all cards can run at 375kHz */
I will check on atmel-mci if we have to decrease f_min.
linux-3.5-rc3/drivers/mmc/host/at91_mci.c static int __init at91_mci_probe(struct · line 956
Quoted 1 line
linux-3.5-rc3/drivers/mmc/host/at91_mci.c renamed from linux-3.5-rc3/drivers/mmc/host/at91_mci.c.orig +1
-0+ mmc->f_max =100000000 ;/* new cards can run at 100MHz */
MCI operates at a rate of up to master clock divided by two so you can't reach 100MHz as max frequency since it means that our master clock is at 200MHz that is not the case. I would say 50MHz is the maximum frequency for product compatible with at91-mci.
linux-3.5-rc3/drivers/mmc/host/at91_mci.c static int __init at91_mci_probe(struct
Quoted 5 lines
linux-3.5-rc3/drivers/mmc/host/at91_mci.c renamed from linux-3.5-rc3/drivers/mmc/host/at91_mci.c.orig +0
-0mmc->ocr_avail =MMC_VDD_32_33 |MMC_VDD_33_34 ; mmc->caps =0 ;
Regards
Ludovic
Add mmc mailing list.
-------- Message original --------
Sujet: Re: [PATCH] mmc: at91: fix bus speed Date : Wed, 20 Jun 2012 10:49:08 +0200
De : ludovic.desroches <[email protected]> Pour : Prchal Ji?? <[email protected]> Copie ? : <[email protected]>, <[email protected]>
Hello Jiri,
Thanks for your patch but at91-mci is now deprecated and should be removed in 3.7.
On one hand I don't know if we have to continue to take patches for this driver, on the other hand it's a fix for some SD cards.
Le 06/20/2012 10:15 AM, Prchal Ji?? a ?crit :
Quoted 24 lines
This patch change minimum and maximum clock speed because some noname cards doesn't work during init even at 375kHz and new cards (SD v. 3.0) can run at 50 or 100 MHz.
Also aded clkdiv register overrun fix when setting low speeds.Signed-off-by Jiri Prchal <[email protected]>---
--- linux/linux-3.5-rc3/drivers/mmc/host/at91_mci.c.orig 2012-06-17
02:25:17.000000000 +0200
+++linux/linux-3.5-rc3/drivers/mmc/host/at91_mci.c2012-06-18
11:01:49.751415984 +0200linux-3.5-rc3/drivers/mmc/host/at91_mci.c renamed from linux-3.5-rc3/drivers/mmc/host/at91_mci.c.orig +4
-0@@ -724,6 +724,10 @@ static void at91_mci_set_ios(struct mmc_else clkdiv = (at91_master_clock / ios->clock) /2 ; +/* set maximum divider */ +if (clkdiv >255 ) + clkdiv =255 ; +pr_debug ("clkdiv = %d. mcck = %ld\n" , clkdiv, at91_master_clock / (2 * (clkdiv +1 ))); }
linux-3.5-rc3/drivers/mmc/host/at91_mci.c static int __init at91_mci_probe(struct · line 955
Quoted 6 lines
linux-3.5-rc3/drivers/mmc/host/at91_mci.c renamed from linux-3.5-rc3/drivers/mmc/host/at91_mci.c.orig +1
-2@@ -948,8 +952,8 @@ static int __init at91_mci_probe(struct } mmc->ops = &at91_mci_ops; - mmc->f_min =375000 ; - mmc->f_max =25000000 ; + mmc->f_min =200000 ;/* not all cards can run at 375kHz */
I will check on atmel-mci if we have to decrease f_min.
linux-3.5-rc3/drivers/mmc/host/at91_mci.c static int __init at91_mci_probe(struct · line 956
Quoted 1 line
linux-3.5-rc3/drivers/mmc/host/at91_mci.c renamed from linux-3.5-rc3/drivers/mmc/host/at91_mci.c.orig +1
-0+ mmc->f_max =100000000 ;/* new cards can run at 100MHz */
MCI operates at a rate of up to master clock divided by two so you can't reach 100MHz as max frequency since it means that our master clock is at 200MHz that is not the case. I would say 50MHz is the maximum frequency for product compatible with at91-mci.
linux-3.5-rc3/drivers/mmc/host/at91_mci.c static int __init at91_mci_probe(struct
Quoted 5 lines
linux-3.5-rc3/drivers/mmc/host/at91_mci.c renamed from linux-3.5-rc3/drivers/mmc/host/at91_mci.c.orig +0
-0mmc->ocr_avail =MMC_VDD_32_33 |MMC_VDD_33_34 ; mmc->caps =0 ;
Regards
Ludovic
Hello Ludovic,
I have tried it with atmel-mci driver. It took me little time to change setting of my board. It seems to try clock down to 200kHz:
[ 5.860000] mmc0: mmc_rescan_try_freq: trying to init card at 400000 Hz [ 5.920000] mmc0: mmc_rescan_try_freq: trying to init card at 300000 Hz [ 5.980000] mmc0: mmc_rescan_try_freq: trying to init card at 205079 Hz
As I see in driver source, there is better clkdiv overrun work around.
But I don't find min and max freq definitions in this driver, it is probably somewhere else. So this would be OK.
Dne 20.6.2012 11:13, ludovic.desroches napsal(a):
Quoted 72 lines
Add mmc mailing list.
-------- Message original --------
Sujet: Re: [PATCH] mmc: at91: fix bus speed
Date : Wed, 20 Jun 2012 10:49:08 +0200
De : ludovic.desroches <[email protected]>
Pour : Prchal Ji?? <[email protected]>
Copie ? : <[email protected]>, <[email protected]>Hello Jiri,
Thanks for your patch but at91-mci is now deprecated and should be removed in 3.7.
On one hand I don't know if we have to continue to take patches for this driver, on the other hand it's a fix for some SD cards.Le 06/20/2012 10:15 AM, Prchal Ji?? a ?crit :
Quoted 24 lines
This patch change minimum and maximum clock speed because some noname cards doesn't work during init even at 375kHz and new cards (SD v. 3.0) can run at 50 or 100 MHz.
Also aded clkdiv register overrun fix when setting low speeds.Signed-off-by Jiri Prchal <[email protected]>---
--- linux/linux-3.5-rc3/drivers/mmc/host/at91_mci.c.orig 2012-06-17 02:25:17.000000000 +0200
+++linux/linux-3.5-rc3/drivers/mmc/host/at91_mci.c2012-06-18 11:01:49.751415984 +0200(quoted diff) +0
-0@@ -724,6 +724,10 @@ static void at91_mci_set_ios(struct mmc_else
clkdiv = (at91_master_clock/ios->clock) / 2;+ /* set maximum divider */
+ if (clkdiv > 255)
+ clkdiv = 255;
+
pr_debug("clkdiv = %d. mcck = %ld\n", clkdiv,at91_master_clock/ (2 * (clkdiv + 1)));
}linux-3.5-rc3/drivers/mmc/host/at91_mci.c static int __init at91_mci_probe(struct · line 955
Quoted 6 lines
linux-3.5-rc3/drivers/mmc/host/at91_mci.c renamed from linux-3.5-rc3/drivers/mmc/host/at91_mci.c.orig +1
-2@@ -948,8 +952,8 @@ static int __init at91_mci_probe(struct } mmc->ops = &at91_mci_ops; - mmc->f_min =375000 ; - mmc->f_max =25000000 ; + mmc->f_min =200000 ;/* not all cards can run at 375kHz */ I will check on atmel-mci if we have to decrease
f_min.linux-3.5-rc3/drivers/mmc/host/at91_mci.c static int __init at91_mci_probe(struct · line 956
Quoted 1 line
linux-3.5-rc3/drivers/mmc/host/at91_mci.c renamed from linux-3.5-rc3/drivers/mmc/host/at91_mci.c.orig +1
-0+ mmc->f_max =100000000 ;/* new cards can run at 100MHz */ MCI operates at a rate of up to master clock divided by two so you can't reach 100MHz as max frequency since it means that our master clock is at 200MHz that is not the case. I would say 50MHz is the maximum frequency for product compatible with at91-mci.
linux-3.5-rc3/drivers/mmc/host/at91_mci.c static int __init at91_mci_probe(struct
Quoted 5 lines
linux-3.5-rc3/drivers/mmc/host/at91_mci.c renamed from linux-3.5-rc3/drivers/mmc/host/at91_mci.c.orig +0
-0mmc->ocr_avail =MMC_VDD_32_33 |MMC_VDD_33_34 ; mmc->caps =0 ;Regards
Ludovic
Hello Prchal,
Le 06/21/2012 09:56 AM, Prchal Ji?? a ?crit :
Quoted 8 lines
Hello Ludovic,
I have tried it with atmel-mci driver. It took me little time to change setting of my board.
It seems to try clock down to 200kHz:[ 5.860000] mmc0: mmc_rescan_try_freq: trying to init card at 400000 Hz [ 5.920000] mmc0: mmc_rescan_try_freq: trying to init card at 300000 Hz [ 5.980000] mmc0: mmc_rescan_try_freq: trying to init card at 205079 HzAs I see in driver source, there is better clkdiv overrun work around.
Yes it was well managed in this driver.
Quoted 2 lines
But I don't find min and max freq definitions in this driver, it is probably somewhere else.
Into atmel_init_slot:mmc->f_min = DIV_ROUND_UP(host->bus_hz, 512);mmc->f_max = host->bus_hz / 2;
Regards
Ludovic
Quoted 79 lines
So this would be OK.
Dne 20.6.2012 11:13, ludovic.desroches napsal(a):
Quoted 73 lines
Add mmc mailing list.
-------- Message original --------
Sujet: Re: [PATCH] mmc: at91: fix bus speed Date : Wed, 20 Jun 2012 10:49:08 +0200
De : ludovic.desroches <[email protected]> Pour : Prchal Ji?? <[email protected]> Copie ? : <[email protected]>, <[email protected]>Hello Jiri,
Thanks for your patch but at91-mci is now deprecated and should be removed in 3.7.
On one hand I don't know if we have to continue to take patches for this driver, on the other hand it's a fix for some SD cards.Le 06/20/2012 10:15 AM, Prchal Ji?? a ?crit :
Quoted 24 lines
This patch change minimum and maximum clock speed because some noname cards doesn't work during init even at 375kHz and new cards (SD v. 3.0) can run at 50 or 100 MHz.
Also aded clkdiv register overrun fix when setting low speeds.Signed-off-by Jiri Prchal <[email protected]>---
--- linux/linux-3.5-rc3/drivers/mmc/host/at91_mci.c.orig 2012-06-17 02:25:17.000000000 +0200
+++linux/linux-3.5-rc3/drivers/mmc/host/at91_mci.c2012-06-18 11:01:49.751415984 +0200(quoted diff) +0
-0@@ -724,6 +724,10 @@ static void at91_mci_set_ios(struct mmc_else
clkdiv = (at91_master_clock/ios->clock) / 2;+ /* set maximum divider */
+ if (clkdiv > 255)
+ clkdiv = 255;
+
pr_debug("clkdiv = %d. mcck = %ld\n", clkdiv,at91_master_clock/ (2 * (clkdiv + 1)));
}linux-3.5-rc3/drivers/mmc/host/at91_mci.c static int __init at91_mci_probe(struct · line 955
Quoted 6 lines
linux-3.5-rc3/drivers/mmc/host/at91_mci.c renamed from linux-3.5-rc3/drivers/mmc/host/at91_mci.c.orig +1
-2@@ -948,8 +952,8 @@ static int __init at91_mci_probe(struct } mmc->ops = &at91_mci_ops; - mmc->f_min =375000 ; - mmc->f_max =25000000 ; + mmc->f_min =200000 ;/* not all cards can run at 375kHz */ I will check on atmel-mci if we have to decrease
f_min.linux-3.5-rc3/drivers/mmc/host/at91_mci.c static int __init at91_mci_probe(struct · line 956
Quoted 1 line
linux-3.5-rc3/drivers/mmc/host/at91_mci.c renamed from linux-3.5-rc3/drivers/mmc/host/at91_mci.c.orig +1
-0+ mmc->f_max =100000000 ;/* new cards can run at 100MHz */ MCI operates at a rate of up to master clock divided by two so you can't reach 100MHz as max frequency since it means that our master clock is at 200MHz that is not the case. I would say 50MHz is the maximum frequency for product compatible with at91-mci.
linux-3.5-rc3/drivers/mmc/host/at91_mci.c static int __init at91_mci_probe(struct
Quoted 5 lines
linux-3.5-rc3/drivers/mmc/host/at91_mci.c renamed from linux-3.5-rc3/drivers/mmc/host/at91_mci.c.orig +0
-0mmc->ocr_avail =MMC_VDD_32_33 |MMC_VDD_33_34 ; mmc->caps =0 ;Regards
Ludovic