RE: eSDHC controller driver on MPC8308rdb

2010-10-19 Thread Maria Johansen


-Original Message-
From: Tonyliu [mailto:bo@windriver.com] 
snip
 Could this be a problem related the eSDHC controller (or the driver), 
 or is it the memory card? (a 4GB SanDisk Extreme SDHC card, which 
 unfortunately is the only card I have available at the moment.) I will keep 
 digging into drivers/mmc/host/sdhci.c in search of a solution, and any tips 
 to how I should proceed would be greatly appreciated!
   
Hi,
Try the patch in attatchment. By default, on some e300 platforms such as 
mpc8308_rdb, the entry clock-frequency of section sdchi in DTB is not fixed 
by u-boot, so has to caculate the input clock for sdhci controller explicitly 
in driver.

Tony

Thanks, the missing clock-frequency was part of my problem. The rest was solved 
by adding some more quirks to the esdhc-driver (SDHCI_QUIRK_FORCE_1_BIT_DATA 
and SDHCI_QUIRK_RESET_AFTER_REQUEST). Why it is necessary to force 1-bit data 
transfers I am a bit unsure about, since the mpc8308 reference manual clearly 
states that 4-bit transfers are supported.

Thanks for your help :)

--
Maria




___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: eSDHC controller driver on MPC8308rdb

2010-10-19 Thread Tonyliu

Maria Johansen wrote:
  

-Original Message-
From: Tonyliu [mailto:bo@windriver.com] 
snip

Could this be a problem related the eSDHC controller (or the driver), 
or is it the memory card? (a 4GB SanDisk Extreme SDHC card, which unfortunately is the only card I have available at the moment.) I will keep digging into drivers/mmc/host/sdhci.c in search of a solution, and any tips to how I should proceed would be greatly appreciated!
  
  

Hi,
Try the patch in attatchment. By default, on some e300 platforms such as mpc8308_rdb, the 
entry clock-frequency of section sdchi in DTB is not fixed by u-boot, so has to 
caculate the input clock for sdhci controller explicitly in driver.

Tony



Thanks, the missing clock-frequency was part of my problem. The rest was solved 
by adding some more quirks to the esdhc-driver (SDHCI_QUIRK_FORCE_1_BIT_DATA 
and SDHCI_QUIRK_RESET_AFTER_REQUEST). Why it is necessary to force 1-bit data 
transfers I am a bit unsure about, since the mpc8308 reference manual clearly 
states that 4-bit transfers are supported.
  

Actually, I did use 4-bit mode. You can try another 2 quicks:

+   if (of_get_property(np, sdhci,auto-cmd12, NULL))
+   host-quirks |= SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12;
+
+   if (of_get_property(np, sdhci,broken-timeout, NULL))
+   host-quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL;
+

===
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 9d4fdfa..b7a1ce4 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -807,8 +807,12 @@ static void sdhci_set_transfer_mode(struct 
sdhci_host *host,

   WARN_ON(!host-data);

   mode = SDHCI_TRNS_BLK_CNT_EN;
-   if (data-blocks  1)
+   if (data-blocks  1) {
+   if (host-quirks  SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12)
+   mode |= SDHCI_TRNS_MULTI | SDHCI_TRNS_ACMD12;
+   else
   mode |= SDHCI_TRNS_MULTI;
+   }
   if (data-flags  MMC_DATA_READ)
   mode |= SDHCI_TRNS_READ;
   if (host-flags  SDHCI_REQ_USE_DMA)
@@ -1099,6 +1103,13 @@ static void sdhci_request(struct mmc_host *mmc, 
struct mmc_request *mrq)

   sdhci_activate_led(host);
#endif

+   if (host-quirks  SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12) {
+   if (mrq-stop) {
+   mrq-data-stop = NULL;
+   mrq-stop = NULL;
+   }
+   }
+
   host-mrq = mrq;


I don't have patch for upstream, you can add them manually.

Tony

Thanks for your help :)

--
Maria




  


___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


RE: eSDHC controller driver on MPC8308rdb

2010-10-19 Thread Zang Roy-R61911


 -Original Message-
 From: linuxppc-dev-bounces+tie-fei.zang=freescale@lists.ozlabs.org

[mailto:linuxppc-dev-bounces+tie-fei.zang=freescale@lists.ozlabs.org
] On
 Behalf Of Tonyliu
 Sent: Tuesday, October 19, 2010 15:56 PM
 To: Maria Johansen
 Cc: linuxppc-dev@lists.ozlabs.org
 Subject: Re: eSDHC controller driver on MPC8308rdb
 
 Maria Johansen wrote:
 
  -Original Message-
  From: Tonyliu [mailto:bo@windriver.com]
  snip
 
  Could this be a problem related the eSDHC controller (or the
driver),
  or is it the memory card? (a 4GB SanDisk Extreme SDHC card, which
 unfortunately is the only card I have available at the moment.) I will
keep
 digging into drivers/mmc/host/sdhci.c in search of a solution, and any
tips to
 how I should proceed would be greatly appreciated!
 
 
  Hi,
  Try the patch in attatchment. By default, on some e300 platforms
such as
 mpc8308_rdb, the entry clock-frequency of section sdchi in DTB is
not fixed
 by u-boot, so has to caculate the input clock for sdhci controller
explicitly
 in driver.
 
  Tony
 
 
  Thanks, the missing clock-frequency was part of my problem. The rest
was
 solved by adding some more quirks to the esdhc-driver
 (SDHCI_QUIRK_FORCE_1_BIT_DATA and SDHCI_QUIRK_RESET_AFTER_REQUEST).
Why it is
 necessary to force 1-bit data transfers I am a bit unsure about, since
the
 mpc8308 reference manual clearly states that 4-bit transfers are
supported.
 
 Actually, I did use 4-bit mode. You can try another 2 quicks:
 
 +   if (of_get_property(np, sdhci,auto-cmd12, NULL))
 +   host-quirks |= SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12;
 +
 +   if (of_get_property(np, sdhci,broken-timeout, NULL))
 +   host-quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL;
 +
 
 ===
 diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
 index 9d4fdfa..b7a1ce4 100644
 --- a/drivers/mmc/host/sdhci.c
 +++ b/drivers/mmc/host/sdhci.c
 @@ -807,8 +807,12 @@ static void sdhci_set_transfer_mode(struct
 sdhci_host *host,
 WARN_ON(!host-data);
 
 mode = SDHCI_TRNS_BLK_CNT_EN;
 -   if (data-blocks  1)
 +   if (data-blocks  1) {
 +   if (host-quirks  SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12)
 +   mode |= SDHCI_TRNS_MULTI | SDHCI_TRNS_ACMD12;
 +   else
 mode |= SDHCI_TRNS_MULTI;
 +   }
 if (data-flags  MMC_DATA_READ)
 mode |= SDHCI_TRNS_READ;
 if (host-flags  SDHCI_REQ_USE_DMA)
 @@ -1099,6 +1103,13 @@ static void sdhci_request(struct mmc_host *mmc,
 struct mmc_request *mrq)
 sdhci_activate_led(host);
  #endif
 
 +   if (host-quirks  SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12) {
 +   if (mrq-stop) {
 +   mrq-data-stop = NULL;
 +   mrq-stop = NULL;
 +   }
 +   }
 +
 host-mrq = mrq;
 
 
 I don't have patch for upstream, you can add them manually.


https://patchwork.kernel.org/patch/176752/


Roy

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


RE: eSDHC controller driver on MPC8308rdb

2010-10-19 Thread Maria Johansen
-Original Message-
From: Tonyliu [mailto:bo@windriver.com] 
snip
 Thanks, the missing clock-frequency was part of my problem. The rest was 
 solved by adding some more quirks to the esdhc-driver 
 (SDHCI_QUIRK_FORCE_1_BIT_DATA and SDHCI_QUIRK_RESET_AFTER_REQUEST). Why it 
 is necessary to force 1-bit data transfers I am a bit unsure about, since 
 the mpc8308 reference manual clearly states that 4-bit transfers are 
 supported.
   
Actually, I did use 4-bit mode. You can try another 2 quicks:

+   if (of_get_property(np, sdhci,auto-cmd12, NULL))
+   host-quirks |= SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12;
+
+   if (of_get_property(np, sdhci,broken-timeout, NULL))
+   host-quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL;
+


SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12 worked (with my other quirks disabled), 
thanks!

--
Maria
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: eSDHC controller driver on MPC8308rdb

2010-10-18 Thread Tonyliu

Maria Johansen wrote:

Hello,
(apologies for writing such a long e-mail, hope you can bother to read it all ☺ 
)
I have some difficulties with the eSDHC controller driver used on a MPC8308 evaluation board with kernel 2.6.36-rc7, and hope that some of you may be able to help me with the debugging. 

The driver is loaded properly, and binds to the eSDHC controller without problems. When inserting a sd-card it is bound to the  mmcblk-driver, so no problems there either.  


However, I am not able to read nor write to the card, I have attached output 
with error messages below:

**
mmc0: new SDHC card at address 9155
mmcblk0: mmc0:9155 SD04G 3.69 GiB
mmc0: Too large timeout requested!
mmcblk0: retrying using single block read
mmc0: Too large timeout requested!
mmcblk0: error -84 sending status comand
mmcblk0: error -110 sending read/write command, response 0x0, card status 0x0
end_request: I/O error, dev mmcblk0, sector 0
mmc0: Too large timeout requested!
mmcblk0: error -84 sending status comand
mmcblk0: error -110 sending read/write command, response 0x0, card status 0x0
end_request: I/O error, dev mmcblk0, sector 1
…..this continues up to sector 7 before starting anew

Debug output with no SD-card:
**
mmc0: clock 0Hz busmode 1 powermode 1 cs 0 Vdd 20 width 0 timing 0
mmc0: clock 40Hz busmode 1 powermode 2 cs 0 Vdd 20 width 0 timing 0
of:sdhci-of e002e000.sdhci: desired SD clock: 40, actual: 0
mmc0: starting CMD52 arg 0c00 flags 0195
sdhci [sdhci_irq()]: *** mmc0 got interrupt: 0x00010001
mmc0: req done (CMD52): -110:    
mmc0: starting CMD52 arg 8c08 flags 0195
sdhci [sdhci_irq()]: *** mmc0 got interrupt: 0x00010001
mmc0: req done (CMD52): -110:    
mmc0: clock 40Hz busmode 1 powermode 2 cs 1 Vdd 20 width 0 timing 0
mmc0: starting CMD0 arg  flags 00c0
sdhci [sdhci_irq()]: *** mmc0 got interrupt: 0x0001
mmc0: req done (CMD0): 0:    
mmc0: clock 40Hz busmode 1 powermode 2 cs 0 Vdd 20 width 0 timing 0
mmc0: starting CMD8 arg 01aa flags 02f5
sdhci [sdhci_irq()]: *** mmc0 got interrupt: 0x00010001
mmc0: req done (CMD8): -110:    
mmc0: starting CMD5 arg  flags 02e1
sdhci [sdhci_irq()]: *** mmc0 got interrupt: 0x00010001
mmc0: req failed (CMD5): -110, retrying...
sdhci [sdhci_irq()]: *** mmc0 got interrupt: 0x00010001
mmc0: req failed (CMD5): -110, retrying...
sdhci [sdhci_irq()]: *** mmc0 got interrupt: 0x00010001
mmc0: req failed (CMD5): -110, retrying...
…

I have the following in my dts:
   sd...@2e000 {
compatible = fsl,mpc8308-esdhc, fsl,esdhc;
reg = 0x2e000 0x1000;
interrupts = 42 0x8;
interrupt-parent = ipic;
clock-frequency = 0;
};


Could this be a problem related the eSDHC controller (or the driver), or is it 
the memory card? (a 4GB SanDisk Extreme SDHC card, which unfortunately is the 
only card I have available at the moment.)
I will keep digging into drivers/mmc/host/sdhci.c in search of a solution, and 
any tips to how I should proceed would be greatly appreciated!
  

Hi,
Try the patch in attatchment. By default, on some e300 platforms such as 
mpc8308_rdb, the entry clock-frequency of section sdchi in DTB is not 
fixed by u-boot, so has to caculate the input clock for sdhci controller 
explicitly in driver.


Tony

--
Maria 
___

Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev



--
Tony Liu | Liu Bo
-
WIND RIVER | China Development Center
Tel: 86-10-8477-8542 ext: 8542 |  Fax: 86-10-64790367
(M): 86-136-7117-3612
Address: 15/F, Wangjing TowerB, Chaoyang District, Beijing, P.R.China



From 02dcd667389aa5143a43d245ac5ecc1559a956ed Mon Sep 17 00:00:00 2001
From: Tonyliu bo@windriver.com
Date: Mon, 18 Oct 2010 16:24:21 +0800
Subject: [PATCH] esdhci: fix clock-frequency for e300

The DTB clock-frequency property of esdhci is not fixed in u-boot by default for most
e300 platforms.So has to caculate the input clock frequency explicitly from CPU's
bus-frequency property.

Signed-off-by: Tonyliu bo@windriver.com
---
 drivers/mmc/host/sdhci-of-core.c |   43 ++
 1 files changed, 43 insertions(+), 0 deletions(-)

diff --git a/drivers/mmc/host/sdhci-of-core.c b/drivers/mmc/host/sdhci-of-core.c
index c51b711..2a1ef0b 100644
--- a/drivers/mmc/host/sdhci-of-core.c
+++ b/drivers/mmc/host/sdhci-of-core.c
@@ -167,6 +167,49 @@ static int __devinit sdhci_of_probe(struct platform_device *ofdev,
 	clk = of_get_property(np, clock-frequency, size);
 	if (clk  size == sizeof(*clk)  *clk)
 		of_host-clock = *clk;
+	else {
+		

eSDHC controller driver on MPC8308rdb

2010-10-14 Thread Maria Johansen
Hello,
(apologies for writing such a long e-mail, hope you can bother to read it all ☺ 
)
I have some difficulties with the eSDHC controller driver used on a MPC8308 
evaluation board with kernel 2.6.36-rc7, and hope that some of you may be able 
to help me with the debugging. 

The driver is loaded properly, and binds to the eSDHC controller without 
problems. When inserting a sd-card it is bound to the  mmcblk-driver, so no 
problems there either.  

However, I am not able to read nor write to the card, I have attached output 
with error messages below:

**
mmc0: new SDHC card at address 9155
mmcblk0: mmc0:9155 SD04G 3.69 GiB
mmc0: Too large timeout requested!
mmcblk0: retrying using single block read
mmc0: Too large timeout requested!
mmcblk0: error -84 sending status comand
mmcblk0: error -110 sending read/write command, response 0x0, card status 0x0
end_request: I/O error, dev mmcblk0, sector 0
mmc0: Too large timeout requested!
mmcblk0: error -84 sending status comand
mmcblk0: error -110 sending read/write command, response 0x0, card status 0x0
end_request: I/O error, dev mmcblk0, sector 1
…..this continues up to sector 7 before starting anew

Debug output with no SD-card:
**
mmc0: clock 0Hz busmode 1 powermode 1 cs 0 Vdd 20 width 0 timing 0
mmc0: clock 40Hz busmode 1 powermode 2 cs 0 Vdd 20 width 0 timing 0
of:sdhci-of e002e000.sdhci: desired SD clock: 40, actual: 0
mmc0: starting CMD52 arg 0c00 flags 0195
sdhci [sdhci_irq()]: *** mmc0 got interrupt: 0x00010001
mmc0: req done (CMD52): -110:    
mmc0: starting CMD52 arg 8c08 flags 0195
sdhci [sdhci_irq()]: *** mmc0 got interrupt: 0x00010001
mmc0: req done (CMD52): -110:    
mmc0: clock 40Hz busmode 1 powermode 2 cs 1 Vdd 20 width 0 timing 0
mmc0: starting CMD0 arg  flags 00c0
sdhci [sdhci_irq()]: *** mmc0 got interrupt: 0x0001
mmc0: req done (CMD0): 0:    
mmc0: clock 40Hz busmode 1 powermode 2 cs 0 Vdd 20 width 0 timing 0
mmc0: starting CMD8 arg 01aa flags 02f5
sdhci [sdhci_irq()]: *** mmc0 got interrupt: 0x00010001
mmc0: req done (CMD8): -110:    
mmc0: starting CMD5 arg  flags 02e1
sdhci [sdhci_irq()]: *** mmc0 got interrupt: 0x00010001
mmc0: req failed (CMD5): -110, retrying...
sdhci [sdhci_irq()]: *** mmc0 got interrupt: 0x00010001
mmc0: req failed (CMD5): -110, retrying...
sdhci [sdhci_irq()]: *** mmc0 got interrupt: 0x00010001
mmc0: req failed (CMD5): -110, retrying...
…

I have the following in my dts:
   sd...@2e000 {
compatible = fsl,mpc8308-esdhc, fsl,esdhc;
reg = 0x2e000 0x1000;
interrupts = 42 0x8;
interrupt-parent = ipic;
clock-frequency = 0;
};


Could this be a problem related the eSDHC controller (or the driver), or is it 
the memory card? (a 4GB SanDisk Extreme SDHC card, which unfortunately is the 
only card I have available at the moment.)
I will keep digging into drivers/mmc/host/sdhci.c in search of a solution, and 
any tips to how I should proceed would be greatly appreciated!

--
Maria 
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev