All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] at91sam9g45ekes SDHC/MMC
@ 2010-03-15 19:51 Henry Súcart
  2010-03-15 20:10 ` Albin Tonnerre
  2010-04-06  9:57 ` Ulf Samuelsson
  0 siblings, 2 replies; 17+ messages in thread
From: Henry Súcart @ 2010-03-15 19:51 UTC (permalink / raw)
  To: u-boot

Hi,

I've been trying to get an SD card working with an at91sam9g45ek-es board. I
read a couple of threads in the archive and ended up doing this:

I applied these patches:

http://lists.denx.de/pipermail/u-boot/2009-August/059595.html
http://lists.denx.de/pipermail/u-boot/2009-September/060053.html
http://lists.denx.de/pipermail/u-boot/2009-September/060243.html

Added these #define's to include/configs/at91sam9m10g45ek.h:

#define CONFIG_CMD_EXT2   1
#define CONFIG_CMD_FAT     1
#define CONFIG_CMD_MMC   1
#define CONFIG_MMC            1
#define CONFIG_ATMEL_MCI  1

Finally, I added this to the board init function:

#ifdef CONFIG_ATMEL_MCI
at91_mci0_hw_init(0, 4);
#endif

When I try it out this is what I get:
U-Boot> mmc init 0
mmc: clock 150000 too low; setting CLKDIV to 255
mmc: command 1 failed (status: 0x0c100025)
No MMC card found

Am I doing something wrong? Any help is appreciated,

Henry

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

* [U-Boot] at91sam9g45ekes SDHC/MMC
  2010-03-15 19:51 [U-Boot] at91sam9g45ekes SDHC/MMC Henry Súcart
@ 2010-03-15 20:10 ` Albin Tonnerre
  2010-03-15 21:40   ` Henry Súcart
  2010-04-06  9:57 ` Ulf Samuelsson
  1 sibling, 1 reply; 17+ messages in thread
From: Albin Tonnerre @ 2010-03-15 20:10 UTC (permalink / raw)
  To: u-boot

On Mon, 15 Mar 2010 15:51 -0400, Henry S?cart wrote :
> Hi,

Hi Henry,

> I've been trying to get an SD card working with an at91sam9g45ek-es board. I
> read a couple of threads in the archive and ended up doing this:
> 
> I applied these patches:
> 
> http://lists.denx.de/pipermail/u-boot/2009-August/059595.html
> http://lists.denx.de/pipermail/u-boot/2009-September/060053.html
> http://lists.denx.de/pipermail/u-boot/2009-September/060243.html
> 
> Added these #define's to include/configs/at91sam9m10g45ek.h:
> 
> #define CONFIG_CMD_EXT2   1
> #define CONFIG_CMD_FAT     1
> #define CONFIG_CMD_MMC   1
> #define CONFIG_MMC            1
> #define CONFIG_ATMEL_MCI  1
> 
> Finally, I added this to the board init function:
> 
> #ifdef CONFIG_ATMEL_MCI
> at91_mci0_hw_init(0, 4);
> #endif
> 
> When I try it out this is what I get:
> U-Boot> mmc init 0
> mmc: clock 150000 too low; setting CLKDIV to 255
> mmc: command 1 failed (status: 0x0c100025)
> No MMC card found
> 
> Am I doing something wrong? Any help is appreciated,

Maybe you're not. The at91sam9m10g45 has 2 MMC ports, and the atmel_mci driver
only uses one, defined using MMCI_BASE. Now if you look at the end of the third
patch:

diff --git a/include/asm-arm/arch-at91/memory-map.h b/include/asm-arm/arch-at91/memory-map.h
index f605f37..de0aba7 100644
--- a/include/asm-arm/arch-at91/memory-map.h
+++ b/include/asm-arm/arch-at91/memory-map.h
@@ -32,4 +32,10 @@
 #define USART3_BASE (AT91_BASE_SYS + AT91_DBGU)
 #define SPI0_BASE	AT91_BASE_SPI
 
+#ifndef CONFIG_AT91_MCI1
+#define MMCI_BASE AT91_BASE_MCI0
+#else
+#define MMCI_BASE AT91_BASE_MCI1
+#endif
+

So maybe the issue is that it's trying to read on the wrong port. Could you try
to add #define CONFIG_AT91_MCI1 in your board config, recompile and see if that
works better?

Thanks,
-- 
Albin Tonnerre, Free Electrons
Kernel, drivers and embedded Linux development,
consulting, training and support.
http://free-electrons.com

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

* [U-Boot] at91sam9g45ekes SDHC/MMC
  2010-03-15 20:10 ` Albin Tonnerre
@ 2010-03-15 21:40   ` Henry Súcart
  2010-03-15 22:15     ` Albin Tonnerre
  0 siblings, 1 reply; 17+ messages in thread
From: Henry Súcart @ 2010-03-15 21:40 UTC (permalink / raw)
  To: u-boot

Hi Albin,

First of all thanks for the quick reply.

I tried out what you said about adding #define CONFIG_AT91_MCI1 to the board
config file but although that did got rid of the mmc: command 1 failed
(status: 0x0c100025) error it still doesn't see the SD card. After doing
some debugging it seems like the statement:

if (aresp[0] & (R1_ILLEGAL_COMMAND | R1_APP_CMD)) != R1_APP_CMD)
     return -ENODEV;

in mmc_acmd() is being executed, which is causing my problem. Any
suggestions?

Thanks,
Henry

On Mon, Mar 15, 2010 at 4:10 PM, Albin Tonnerre <
albin.tonnerre@free-electrons.com> wrote:

> On Mon, 15 Mar 2010 15:51 -0400, Henry S?cart wrote :
> > Hi,
>
> Hi Henry,
>
> > I've been trying to get an SD card working with an at91sam9g45ek-es
> board. I
> > read a couple of threads in the archive and ended up doing this:
> >
> > I applied these patches:
> >
> > http://lists.denx.de/pipermail/u-boot/2009-August/059595.html
> > http://lists.denx.de/pipermail/u-boot/2009-September/060053.html
> > http://lists.denx.de/pipermail/u-boot/2009-September/060243.html
> >
> > Added these #define's to include/configs/at91sam9m10g45ek.h:
> >
> > #define CONFIG_CMD_EXT2   1
> > #define CONFIG_CMD_FAT     1
> > #define CONFIG_CMD_MMC   1
> > #define CONFIG_MMC            1
> > #define CONFIG_ATMEL_MCI  1
> >
> > Finally, I added this to the board init function:
> >
> > #ifdef CONFIG_ATMEL_MCI
> > at91_mci0_hw_init(0, 4);
> > #endif
> >
> > When I try it out this is what I get:
> > U-Boot> mmc init 0
> > mmc: clock 150000 too low; setting CLKDIV to 255
> > mmc: command 1 failed (status: 0x0c100025)
> > No MMC card found
> >
> > Am I doing something wrong? Any help is appreciated,
>
> Maybe you're not. The at91sam9m10g45 has 2 MMC ports, and the atmel_mci
> driver
> only uses one, defined using MMCI_BASE. Now if you look at the end of the
> third
> patch:
>
> diff --git a/include/asm-arm/arch-at91/memory-map.h
> b/include/asm-arm/arch-at91/memory-map.h
> index f605f37..de0aba7 100644
> --- a/include/asm-arm/arch-at91/memory-map.h
> +++ b/include/asm-arm/arch-at91/memory-map.h
> @@ -32,4 +32,10 @@
>  #define USART3_BASE (AT91_BASE_SYS + AT91_DBGU)
>  #define SPI0_BASE      AT91_BASE_SPI
>
> +#ifndef CONFIG_AT91_MCI1
> +#define MMCI_BASE AT91_BASE_MCI0
> +#else
> +#define MMCI_BASE AT91_BASE_MCI1
> +#endif
> +
>
> So maybe the issue is that it's trying to read on the wrong port. Could you
> try
> to add #define CONFIG_AT91_MCI1 in your board config, recompile and see if
> that
> works better?
>
> Thanks,
> --
> Albin Tonnerre, Free Electrons
> Kernel, drivers and embedded Linux development,
> consulting, training and support.
> http://free-electrons.com
>

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

* [U-Boot] at91sam9g45ekes SDHC/MMC
  2010-03-15 21:40   ` Henry Súcart
@ 2010-03-15 22:15     ` Albin Tonnerre
  2010-03-16 12:30       ` Henry Súcart
  0 siblings, 1 reply; 17+ messages in thread
From: Albin Tonnerre @ 2010-03-15 22:15 UTC (permalink / raw)
  To: u-boot

On Mon, 15 Mar 2010 17:40 -0400, Henry S?cart wrote :
> Hi Albin,
> 
> First of all thanks for the quick reply.

You're welcome.

> I tried out what you said about adding #define CONFIG_AT91_MCI1 to the board
> config file but although that did got rid of the mmc: command 1 failed
> (status: 0x0c100025) error

Great. At least know we know it's actually reading the card :)

> it still doesn't see the SD card. After doing
> some debugging it seems like the statement:
> 
> if (aresp[0] & (R1_ILLEGAL_COMMAND | R1_APP_CMD)) != R1_APP_CMD)
>      return -ENODEV;
> 
> in mmc_acmd() is being executed, which is causing my problem. Any
> suggestions?

Not on the top of my head - I have to admit I haven't played with the MMC
support for quite some time. Would you mind providing me the exact command you
typed and the ouput you got when trying with the "fixed" u-boot? That might
help.

Regards,
-- 
Albin Tonnerre, Free Electrons
Kernel, drivers and embedded Linux development,
consulting, training and support.
http://free-electrons.com

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

* [U-Boot] at91sam9g45ekes SDHC/MMC
  2010-03-15 22:15     ` Albin Tonnerre
@ 2010-03-16 12:30       ` Henry Súcart
  2010-03-16 20:36         ` Albin Tonnerre
  0 siblings, 1 reply; 17+ messages in thread
From: Henry Súcart @ 2010-03-16 12:30 UTC (permalink / raw)
  To: u-boot

Here's the command I'm using and the output. I put a debugging statement in
sd_init_card() after the for loop (HJS:).

U-Boot> mmc init 0
mmc: clock 150000 too low; setting CLKDIV to 255
HJS: sd_init_card() mmc_acmd for loop finished. ret = -19, resp[0] =
0x6B200020
No MMC card found

The same thing happens if I try mmc init 1.

Thanks,

Henry

On Mon, Mar 15, 2010 at 6:15 PM, Albin Tonnerre <
albin.tonnerre@free-electrons.com> wrote:

> On Mon, 15 Mar 2010 17:40 -0400, Henry S?cart wrote :
> > Hi Albin,
> >
> > First of all thanks for the quick reply.
>
> You're welcome.
>
> > I tried out what you said about adding #define CONFIG_AT91_MCI1 to the
> board
> > config file but although that did got rid of the mmc: command 1 failed
> > (status: 0x0c100025) error
>
> Great. At least know we know it's actually reading the card :)
>
> > it still doesn't see the SD card. After doing
> > some debugging it seems like the statement:
> >
> > if (aresp[0] & (R1_ILLEGAL_COMMAND | R1_APP_CMD)) != R1_APP_CMD)
> >      return -ENODEV;
> >
> > in mmc_acmd() is being executed, which is causing my problem. Any
> > suggestions?
>
> Not on the top of my head - I have to admit I haven't played with the MMC
> support for quite some time. Would you mind providing me the exact command
> you
> typed and the ouput you got when trying with the "fixed" u-boot? That might
> help.
>
> Regards,
> --
> Albin Tonnerre, Free Electrons
> Kernel, drivers and embedded Linux development,
> consulting, training and support.
> http://free-electrons.com
>

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

* [U-Boot] at91sam9g45ekes SDHC/MMC
  2010-03-16 12:30       ` Henry Súcart
@ 2010-03-16 20:36         ` Albin Tonnerre
  2010-03-16 22:08           ` Henry Súcart
  0 siblings, 1 reply; 17+ messages in thread
From: Albin Tonnerre @ 2010-03-16 20:36 UTC (permalink / raw)
  To: u-boot

On Tue, 16 Mar 2010 08:30 -0400, Henry S?cart wrote :
> Here's the command I'm using and the output. I put a debugging statement in
> sd_init_card() after the for loop (HJS:).
> 
> U-Boot> mmc init 0
> mmc: clock 150000 too low; setting CLKDIV to 255
> HJS: sd_init_card() mmc_acmd for loop finished. ret = -19, resp[0] =
> 0x6B200020
> No MMC card found

Err, well, that's weird. I have to admit I can't even guess whether it's
trying to read the right slot. Could you please:

1/ add a #define DEBUG at the top of drivers/mmc/atmel_mci.c
2/ get the output of mmc init (0 or 1 doesn't matter) for both CONFIG_ATMEL_MCI1
and !CONFIG_ATMEL_MCI1 (with the SD card staying in the same slot, of course)
3/ In the process, add a debug printf in the mci driver displaying the value of
MMCI_CR (you'd get that by calling mmci_readl(CR))

I'm sorry I can't help you further. Unfortunately I don't own such hardware, and
this kind of thing is rather hard to debug remotely.

Regards,
-- 
Albin Tonnerre, Free Electrons
Kernel, drivers and embedded Linux development,
consulting, training and support.
http://free-electrons.com

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

* [U-Boot] at91sam9g45ekes SDHC/MMC
  2010-03-16 20:36         ` Albin Tonnerre
@ 2010-03-16 22:08           ` Henry Súcart
  2010-03-17 19:23             ` Henry Súcart
  0 siblings, 1 reply; 17+ messages in thread
From: Henry Súcart @ 2010-03-16 22:08 UTC (permalink / raw)
  To: u-boot

I put the printf you asked for in sd_init_card, right after the for loop.
Here's the output:

With #define CONFIG_ATMEL_MCI1  1

U-Boot> mmc init 0
mmc: setting clock 150000 Hz, block size 512
mmc: clock 150000 too low; setting CLKDIV to 255
mmc: CMD0 0x0 (flags 0x0)
mmc: status 0x0c000025

mmc: CMD0 0x0 (flags 0x100)
mmc: status 0x0c000025

mmc: CMD55 0x0 (flags 0x1040)
mmc: status 0x0c000025
mmc: response: 00000000

HJS: MMCI_CR = 0
HJS: sd_init_card() mmc_acmd after for loop. ret: -19, resp[0] = 0x6B200020

mmc: CMD0 0x0 (flags 0x0)
mmc: status 0x0c000025

mmc: CMD0 0x0 (flags 0x100)
mmc: status 0x0c000025

mmc: CMD1 0x100000 (flags 0x841)
mmc: status 0x0c000025
mmc: response: 00000000


...This keeps going for a while and at the end...

mmc: CMD1 0x100000 (flags 0x841)
mmc: status 0x0c000025
mmc: response: 00000000
No MMC card found

With #define CONFIG_ATMEL_MCI1  0
U-Boot> mmc init 0
mmc: setting clock 150000 Hz, block size 512
mmc: clock 150000 too low; setting CLKDIV to 255
mmc: CMD0 0x0 (flags 0x0)
mmc: status 0x0c000025

mmc: CMD0 0x0 (flags 0x100)
mmc: status 0x0c000025

mmc: CMD55 0x0 (flags 0x1040)
mmc: status 0x0c000025
mmc: response: 00000000

HJS: MMCI_CR = 0
HJS: sd_init_card() mmc_acmd after for loop. ret: -19, resp[0] = 0x6B200020

mmc: CMD0 0x0 (flags 0x0)
mmc: status 0x0c000025

mmc: CMD0 0x0 (flags 0x100)
mmc: status 0x0c000025

mmc: CMD1 0x100000 (flags 0x841)
mmc: status 0x0c000025
mmc: response: 00000000
mmc: CMD1 0x100000 (flags 0x841)
mmc: status 0x0c000025
mmc: response: 00000000
mmc: CMD1 0x100000 (flags 0x841)
mmc: status 0x0c000025
mmc: response: 00000000
mmc: CMD1 0x100000 (flags 0x841)
mmc: status 0x0c000025
mmc: response: 00000000
mmc: CMD1 0x100000 (flags 0x841)
mmc: status 0x0c000025
mmc: response: 00000000

...This keeps going for a while and at the end...

mmc: CMD1 0x100000 (flags 0x841)
mmc: status 0x0c000025
mmc: response: 00000000
No MMC card found

If i take out the #define CONFIG_ATMEL_MCI1

U-Boot> mmc init 0
mmc: setting clock 150000 Hz, block size 512
mmc: clock 150000 too low; setting CLKDIV to 255
mmc: CMD0 0x0 (flags 0x0)
mmc: status 0x0c000025

mmc: CMD0 0x0 (flags 0x100)
mmc: status 0x0c000025

mmc: CMD55 0x0 (flags 0x1040)
mmc: status 0x0c000025
mmc: response: 00000120
mmc: CMD41 0x100000 (flags 0x41)
mmc: status 0x0c040025
mmc: response: 00ff8000
mmc: CMD55 0x0 (flags 0x1040)
mmc: status 0x0c000025
mmc: response: 00000120
mmc: CMD41 0x100000 (flags 0x41)
mmc: status 0x0c040025
mmc: response: 00ff8000

... Goes on for a while...

HJS: MMCI_CR = 0
HJS: sd_init_card() mmc_acmd for loop ret: -110, resp[0] = 0x00FF8000

mmc: CMD0 0x0 (flags 0x0)
mmc: status 0x0c000025

mmc: CMD0 0x0 (flags 0x100)
mmc: status 0x0c000025

mmc: CMD1 0x100000 (flags 0x841)
mmc: status 0x0c100025
mmc: command 1 failed (status: 0x0c100025)
HJS: error_flags: 0x005B0000, status & error_flags: 0x00100000
HJS: mmc_init_card() ret = -5
HJS: mmc_init_card failed
No MMC card found

In all of them I used the slot J6. I tried it with J5 too but it did the
same thing.

On Tue, Mar 16, 2010 at 4:36 PM, Albin Tonnerre <
albin.tonnerre@free-electrons.com> wrote:

> On Tue, 16 Mar 2010 08:30 -0400, Henry S?cart wrote :
> > Here's the command I'm using and the output. I put a debugging statement
> in
> > sd_init_card() after the for loop (HJS:).
> >
> > U-Boot> mmc init 0
> > mmc: clock 150000 too low; setting CLKDIV to 255
> > HJS: sd_init_card() mmc_acmd for loop finished. ret = -19, resp[0] =
> > 0x6B200020
> > No MMC card found
>
> Err, well, that's weird. I have to admit I can't even guess whether it's
> trying to read the right slot. Could you please:
>
> 1/ add a #define DEBUG at the top of drivers/mmc/atmel_mci.c
> 2/ get the output of mmc init (0 or 1 doesn't matter) for both
> CONFIG_ATMEL_MCI1
> and !CONFIG_ATMEL_MCI1 (with the SD card staying in the same slot, of
> course)
> 3/ In the process, add a debug printf in the mci driver displaying the
> value of
> MMCI_CR (you'd get that by calling mmci_readl(CR))
>
> I'm sorry I can't help you further. Unfortunately I don't own such
> hardware, and
> this kind of thing is rather hard to debug remotely.
>
> Regards,
> --
> Albin Tonnerre, Free Electrons
> Kernel, drivers and embedded Linux development,
> consulting, training and support.
> http://free-electrons.com
>

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

* [U-Boot] at91sam9g45ekes SDHC/MMC
  2010-03-16 22:08           ` Henry Súcart
@ 2010-03-17 19:23             ` Henry Súcart
  0 siblings, 0 replies; 17+ messages in thread
From: Henry Súcart @ 2010-03-17 19:23 UTC (permalink / raw)
  To: u-boot

Hi Albin,

Thanks for all the help :).

After doing some research i found out that I the configuration I need is
!CONFIG_ATMEL_MCI1 since I the interface I'm trying to use is MCI0. When I
try it out it does seem like it's trying to read from it (it immediately
returns with an -EIO if I remove the SD card) and I guess the problem is
with the response.

In the for loop in sd_init_card() it should break out of the loop if either
there is a return value for mmc_acmd() (which only happens when there's an
error) or when (resp[0] & 0x80000000) which I guess is that we read
something successfully. When I run "mmc init 0" it never breaks out of that
loop. I'm guessing that the response should be something like 0x8XXXXXXXX,
then. Am I right? The responses I'm getting are:

mmc: CMD55 0x0 (flags 0x1040)
mmc: status 0x0c000025
mmc: response: 00000120
mmc: CMD41 0x100000 (flags 0x41)
mmc: status 0x0c040025
mmc: response: 00ff8000

What does this number mean? Am I right in my assumption?

Thanks,
Henry

On Tue, Mar 16, 2010 at 6:08 PM, Henry S?cart <henry.sucart@gmail.com>wrote:

> I put the printf you asked for in sd_init_card, right after the for loop.
> Here's the output:
>
> With #define CONFIG_ATMEL_MCI1  1
>
>
> U-Boot> mmc init 0
> mmc: setting clock 150000 Hz, block size 512
>
> mmc: clock 150000 too low; setting CLKDIV to 255
> mmc: CMD0 0x0 (flags 0x0)
> mmc: status 0x0c000025
>
> mmc: CMD0 0x0 (flags 0x100)
> mmc: status 0x0c000025
>
> mmc: CMD55 0x0 (flags 0x1040)
> mmc: status 0x0c000025
> mmc: response: 00000000
>
> HJS: MMCI_CR = 0
> HJS: sd_init_card() mmc_acmd after for loop. ret: -19, resp[0] = 0x6B200020
>
> mmc: CMD0 0x0 (flags 0x0)
> mmc: status 0x0c000025
>
> mmc: CMD0 0x0 (flags 0x100)
> mmc: status 0x0c000025
>
> mmc: CMD1 0x100000 (flags 0x841)
> mmc: status 0x0c000025
> mmc: response: 00000000
>
>
> ...This keeps going for a while and at the end...
>
> mmc: CMD1 0x100000 (flags 0x841)
> mmc: status 0x0c000025
> mmc: response: 00000000
> No MMC card found
>
> With #define CONFIG_ATMEL_MCI1  0
>
> U-Boot> mmc init 0
> mmc: setting clock 150000 Hz, block size 512
>
> mmc: clock 150000 too low; setting CLKDIV to 255
> mmc: CMD0 0x0 (flags 0x0)
> mmc: status 0x0c000025
>
> mmc: CMD0 0x0 (flags 0x100)
> mmc: status 0x0c000025
>
> mmc: CMD55 0x0 (flags 0x1040)
> mmc: status 0x0c000025
> mmc: response: 00000000
>
> HJS: MMCI_CR = 0
> HJS: sd_init_card() mmc_acmd after for loop. ret: -19, resp[0] = 0x6B200020
>
> mmc: CMD0 0x0 (flags 0x0)
> mmc: status 0x0c000025
>
> mmc: CMD0 0x0 (flags 0x100)
> mmc: status 0x0c000025
>
> mmc: CMD1 0x100000 (flags 0x841)
> mmc: status 0x0c000025
> mmc: response: 00000000
> mmc: CMD1 0x100000 (flags 0x841)
> mmc: status 0x0c000025
> mmc: response: 00000000
> mmc: CMD1 0x100000 (flags 0x841)
> mmc: status 0x0c000025
> mmc: response: 00000000
> mmc: CMD1 0x100000 (flags 0x841)
> mmc: status 0x0c000025
> mmc: response: 00000000
> mmc: CMD1 0x100000 (flags 0x841)
> mmc: status 0x0c000025
> mmc: response: 00000000
>
> ...This keeps going for a while and at the end...
>
> mmc: CMD1 0x100000 (flags 0x841)
> mmc: status 0x0c000025
> mmc: response: 00000000
> No MMC card found
>
> If i take out the #define CONFIG_ATMEL_MCI1
>
>
> U-Boot> mmc init 0
> mmc: setting clock 150000 Hz, block size 512
>
> mmc: clock 150000 too low; setting CLKDIV to 255
> mmc: CMD0 0x0 (flags 0x0)
> mmc: status 0x0c000025
>
> mmc: CMD0 0x0 (flags 0x100)
> mmc: status 0x0c000025
>
> mmc: CMD55 0x0 (flags 0x1040)
> mmc: status 0x0c000025
> mmc: response: 00000120
> mmc: CMD41 0x100000 (flags 0x41)
> mmc: status 0x0c040025
> mmc: response: 00ff8000
> mmc: CMD55 0x0 (flags 0x1040)
> mmc: status 0x0c000025
> mmc: response: 00000120
> mmc: CMD41 0x100000 (flags 0x41)
> mmc: status 0x0c040025
> mmc: response: 00ff8000
>
> ... Goes on for a while...
>
> HJS: MMCI_CR = 0
> HJS: sd_init_card() mmc_acmd for loop ret: -110, resp[0] = 0x00FF8000
>
> mmc: CMD0 0x0 (flags 0x0)
> mmc: status 0x0c000025
>
> mmc: CMD0 0x0 (flags 0x100)
> mmc: status 0x0c000025
>
> mmc: CMD1 0x100000 (flags 0x841)
> mmc: status 0x0c100025
>
> mmc: command 1 failed (status: 0x0c100025)
> HJS: error_flags: 0x005B0000, status & error_flags: 0x00100000
> HJS: mmc_init_card() ret = -5
> HJS: mmc_init_card failed
> No MMC card found
>
> In all of them I used the slot J6. I tried it with J5 too but it did the
> same thing.
>
>
> On Tue, Mar 16, 2010 at 4:36 PM, Albin Tonnerre <
> albin.tonnerre at free-electrons.com> wrote:
>
>> On Tue, 16 Mar 2010 08:30 -0400, Henry S?cart wrote :
>> > Here's the command I'm using and the output. I put a debugging statement
>> in
>> > sd_init_card() after the for loop (HJS:).
>> >
>> > U-Boot> mmc init 0
>> > mmc: clock 150000 too low; setting CLKDIV to 255
>> > HJS: sd_init_card() mmc_acmd for loop finished. ret = -19, resp[0] =
>> > 0x6B200020
>> > No MMC card found
>>
>> Err, well, that's weird. I have to admit I can't even guess whether it's
>> trying to read the right slot. Could you please:
>>
>> 1/ add a #define DEBUG at the top of drivers/mmc/atmel_mci.c
>> 2/ get the output of mmc init (0 or 1 doesn't matter) for both
>> CONFIG_ATMEL_MCI1
>> and !CONFIG_ATMEL_MCI1 (with the SD card staying in the same slot, of
>> course)
>> 3/ In the process, add a debug printf in the mci driver displaying the
>> value of
>> MMCI_CR (you'd get that by calling mmci_readl(CR))
>>
>> I'm sorry I can't help you further. Unfortunately I don't own such
>> hardware, and
>> this kind of thing is rather hard to debug remotely.
>>
>> Regards,
>> --
>> Albin Tonnerre, Free Electrons
>> Kernel, drivers and embedded Linux development,
>> consulting, training and support.
>> http://free-electrons.com
>>
>
>

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

* [U-Boot] at91sam9g45ekes SDHC/MMC
  2010-03-15 19:51 [U-Boot] at91sam9g45ekes SDHC/MMC Henry Súcart
  2010-03-15 20:10 ` Albin Tonnerre
@ 2010-04-06  9:57 ` Ulf Samuelsson
  2010-04-12 13:55   ` Henry Súcart
  1 sibling, 1 reply; 17+ messages in thread
From: Ulf Samuelsson @ 2010-04-06  9:57 UTC (permalink / raw)
  To: u-boot

Henry S?cart skrev:
> Hi,
> 
> I've been trying to get an SD card working with an at91sam9g45ek-es board. I
> read a couple of threads in the archive and ended up doing this:
> 

I have booted the AT91SAM9G45EKES (Actually the AT91SAM9M10EKES,
but it is almost the same) from SD-Card for the last month.
The patchset for 2009.11 is available for testing in my private git
branch on www.openembedded.org: origin/ulf/linux-2.6.30-20100317

I came to the conclusion that the atmel MCI driver (written for the big
endian AVR32) has significant byte sex problems.

BR
Ulf Samuelsson.


> I applied these patches:
> 
> http://lists.denx.de/pipermail/u-boot/2009-August/059595.html
> http://lists.denx.de/pipermail/u-boot/2009-September/060053.html
> http://lists.denx.de/pipermail/u-boot/2009-September/060243.html
> 
> Added these #define's to include/configs/at91sam9m10g45ek.h:
> 
> #define CONFIG_CMD_EXT2   1
> #define CONFIG_CMD_FAT     1
> #define CONFIG_CMD_MMC   1
> #define CONFIG_MMC            1
> #define CONFIG_ATMEL_MCI  1
> 
> Finally, I added this to the board init function:
> 
> #ifdef CONFIG_ATMEL_MCI
> at91_mci0_hw_init(0, 4);
> #endif
> 
> When I try it out this is what I get:
> U-Boot> mmc init 0
> mmc: clock 150000 too low; setting CLKDIV to 255
> mmc: command 1 failed (status: 0x0c100025)
> No MMC card found
> 
> Am I doing something wrong? Any help is appreciated,
> 
> Henry
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot

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

* [U-Boot] at91sam9g45ekes SDHC/MMC
  2010-04-06  9:57 ` Ulf Samuelsson
@ 2010-04-12 13:55   ` Henry Súcart
  2010-04-23  0:51     ` Rob Emanuele
  0 siblings, 1 reply; 17+ messages in thread
From: Henry Súcart @ 2010-04-12 13:55 UTC (permalink / raw)
  To: u-boot

Hi Ulf,

Thanks for the reply. I applied your patches but I still can't get it to
read the SD card

Without the SD card:
U-Boot> mmc init 0
mmc: command 55 failed (status: 0x0c100025)
mmc: command 1 failed (status: 0x0c100025)
No MMC card found

With the SD card:
U-Boot> mmc init 0
mmc: command 1 failed (status: 0x0c100025)
No MMC card found



I'm not sure what's going on.
On Tue, Apr 6, 2010 at 5:57 AM, Ulf Samuelsson <ulf.samuelsson@atmel.com>wrote:

> Henry S?cart skrev:
> > Hi,
> >
> > I've been trying to get an SD card working with an at91sam9g45ek-es
> board. I
> > read a couple of threads in the archive and ended up doing this:
> >
>
> I have booted the AT91SAM9G45EKES (Actually the AT91SAM9M10EKES,
> but it is almost the same) from SD-Card for the last month.
> The patchset for 2009.11 is available for testing in my private git
> branch on www.openembedded.org: origin/ulf/linux-2.6.30-20100317
>
> I came to the conclusion that the atmel MCI driver (written for the big
> endian AVR32) has significant byte sex problems.
>
> BR
> Ulf Samuelsson.
>
>
> > I applied these patches:
> >
> > http://lists.denx.de/pipermail/u-boot/2009-August/059595.html
> > http://lists.denx.de/pipermail/u-boot/2009-September/060053.html
> > http://lists.denx.de/pipermail/u-boot/2009-September/060243.html
> >
> > Added these #define's to include/configs/at91sam9m10g45ek.h:
> >
> > #define CONFIG_CMD_EXT2   1
> > #define CONFIG_CMD_FAT     1
> > #define CONFIG_CMD_MMC   1
> > #define CONFIG_MMC            1
> > #define CONFIG_ATMEL_MCI  1
> >
> > Finally, I added this to the board init function:
> >
> > #ifdef CONFIG_ATMEL_MCI
> > at91_mci0_hw_init(0, 4);
> > #endif
> >
> > When I try it out this is what I get:
> > U-Boot> mmc init 0
> > mmc: clock 150000 too low; setting CLKDIV to 255
> > mmc: command 1 failed (status: 0x0c100025)
> > No MMC card found
> >
> > Am I doing something wrong? Any help is appreciated,
> >
> > Henry
> >
> >
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > U-Boot mailing list
> > U-Boot at lists.denx.de
> > http://lists.denx.de/mailman/listinfo/u-boot
>
>

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

* [U-Boot] at91sam9g45ekes SDHC/MMC
  2010-04-12 13:55   ` Henry Súcart
@ 2010-04-23  0:51     ` Rob Emanuele
  2010-04-23  6:24       ` Samuelsson, Ulf
  2010-04-23 21:58       ` Andy Fleming
  0 siblings, 2 replies; 17+ messages in thread
From: Rob Emanuele @ 2010-04-23  0:51 UTC (permalink / raw)
  To: u-boot

Hi Henry & U-Boot Community,

I've been experiencing the same errors and frustration you have.

So I've been looking at this code and these patch sets for a day or
two now.  I've done that in conjunction with reading the SD card spec:
http://www.sdcard.org/developers/tech/sdcard/pls/

I've come to the conclusion that this code as it stands will not work
with any card that conforms to the SD Physical Layer Simplified
Specification Version 2.0.  This includes all SDHC cards and some
non-HC cards that conform to version 2.0.  I have a few 1GB cards that
work just fine with the atmel_mci.c code on a 'G45 as it was in rev
95c44ec485b46ffb43dbdaa299f1491a500fdadf .

If your SD card is newer, you'll see in the for loop in "sd_init_card"
in atmel_mci.c time out.  In the 2.0 spec, you need to perform a CMD8
(SEND_IF_COND) first to see if your card is a 2.0 card.  In CMD8 you
tell the card the voltages you support and if you support HC cards.
Once you send it the right data there, then ACMD41 will not have its
BUSY bit set.  That's all well and good, but additionally the CSD
register is in a new format and that needs updating before any of this
will work.

In another post, I will be more talk of the mmc/sd code and taking it forward.

Rob


On Mon, Apr 12, 2010 at 6:55 AM, Henry S?cart <henry.sucart@gmail.com> wrote:
> Hi Ulf,
>
> Thanks for the reply. I applied your patches but I still can't get it to
> read the SD card
>
> Without the SD card:
> U-Boot> mmc init 0
> mmc: command 55 failed (status: 0x0c100025)
> mmc: command 1 failed (status: 0x0c100025)
> No MMC card found
>
> With the SD card:
> U-Boot> mmc init 0
> mmc: command 1 failed (status: 0x0c100025)
> No MMC card found
>
>
>
> I'm not sure what's going on.
> On Tue, Apr 6, 2010 at 5:57 AM, Ulf Samuelsson <ulf.samuelsson@atmel.com>wrote:
>
>> Henry S?cart skrev:
>> > Hi,
>> >
>> > I've been trying to get an SD card working with an at91sam9g45ek-es
>> board. I
>> > read a couple of threads in the archive and ended up doing this:
>> >
>>
>> I have booted the AT91SAM9G45EKES (Actually the AT91SAM9M10EKES,
>> but it is almost the same) from SD-Card for the last month.
>> The patchset for 2009.11 is available for testing in my private git
>> branch on www.openembedded.org: origin/ulf/linux-2.6.30-20100317
>>
>> I came to the conclusion that the atmel MCI driver (written for the big
>> endian AVR32) has significant byte sex problems.
>>
>> BR
>> Ulf Samuelsson.
>>
>>
>> > I applied these patches:
>> >
>> > http://lists.denx.de/pipermail/u-boot/2009-August/059595.html
>> > http://lists.denx.de/pipermail/u-boot/2009-September/060053.html
>> > http://lists.denx.de/pipermail/u-boot/2009-September/060243.html
>> >
>> > Added these #define's to include/configs/at91sam9m10g45ek.h:
>> >
>> > #define CONFIG_CMD_EXT2 ? 1
>> > #define CONFIG_CMD_FAT ? ? 1
>> > #define CONFIG_CMD_MMC ? 1
>> > #define CONFIG_MMC ? ? ? ? ? ?1
>> > #define CONFIG_ATMEL_MCI ?1
>> >
>> > Finally, I added this to the board init function:
>> >
>> > #ifdef CONFIG_ATMEL_MCI
>> > at91_mci0_hw_init(0, 4);
>> > #endif
>> >
>> > When I try it out this is what I get:
>> > U-Boot> mmc init 0
>> > mmc: clock 150000 too low; setting CLKDIV to 255
>> > mmc: command 1 failed (status: 0x0c100025)
>> > No MMC card found
>> >
>> > Am I doing something wrong? Any help is appreciated,
>> >
>> > Henry
>> >
>> >
>> >
>> > ------------------------------------------------------------------------
>> >
>> > _______________________________________________
>> > U-Boot mailing list
>> > U-Boot at lists.denx.de
>> > http://lists.denx.de/mailman/listinfo/u-boot
>>
>>
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>
>

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

* [U-Boot] at91sam9g45ekes SDHC/MMC
  2010-04-23  0:51     ` Rob Emanuele
@ 2010-04-23  6:24       ` Samuelsson, Ulf
  2010-04-23 21:58       ` Andy Fleming
  1 sibling, 0 replies; 17+ messages in thread
From: Samuelsson, Ulf @ 2010-04-23  6:24 UTC (permalink / raw)
  To: u-boot

Fix the problem, send me the patch, and I change my source ;-)
/Ulf

> -----Ursprungligt meddelande-----
> Fr?n: rje at crystalfontz.com [mailto:rje at crystalfontz.com] F?r Rob
> Emanuele
> Skickat: den 23 april 2010 02:52
> Till: Henry S?cart
> Kopia: Samuelsson, Ulf; u-boot at lists.denx.de
> ?mne: Re: [U-Boot] at91sam9g45ekes SDHC/MMC
> 
> Hi Henry & U-Boot Community,
> 
> I've been experiencing the same errors and frustration you have.
> 
> So I've been looking at this code and these patch sets for a day or
> two now.  I've done that in conjunction with reading the SD card spec:
> http://www.sdcard.org/developers/tech/sdcard/pls/
> 
> I've come to the conclusion that this code as it stands will not work
> with any card that conforms to the SD Physical Layer Simplified
> Specification Version 2.0.  This includes all SDHC cards and some
> non-HC cards that conform to version 2.0.  I have a few 1GB cards that
> work just fine with the atmel_mci.c code on a 'G45 as it was in rev
> 95c44ec485b46ffb43dbdaa299f1491a500fdadf .
> 
> If your SD card is newer, you'll see in the for loop in "sd_init_card"
> in atmel_mci.c time out.  In the 2.0 spec, you need to perform a CMD8
> (SEND_IF_COND) first to see if your card is a 2.0 card.  In CMD8 you
> tell the card the voltages you support and if you support HC cards.
> Once you send it the right data there, then ACMD41 will not have its
> BUSY bit set.  That's all well and good, but additionally the CSD
> register is in a new format and that needs updating before any of this
> will work.
> 
> In another post, I will be more talk of the mmc/sd code and taking it
> forward.
> 
> Rob
> 
> 
> On Mon, Apr 12, 2010 at 6:55 AM, Henry S?cart <henry.sucart@gmail.com>
> wrote:
> > Hi Ulf,
> >
> > Thanks for the reply. I applied your patches but I still can't get it
> to
> > read the SD card
> >
> > Without the SD card:
> > U-Boot> mmc init 0
> > mmc: command 55 failed (status: 0x0c100025)
> > mmc: command 1 failed (status: 0x0c100025)
> > No MMC card found
> >
> > With the SD card:
> > U-Boot> mmc init 0
> > mmc: command 1 failed (status: 0x0c100025)
> > No MMC card found
> >
> >
> >
> > I'm not sure what's going on.
> > On Tue, Apr 6, 2010 at 5:57 AM, Ulf Samuelsson
> <ulf.samuelsson@atmel.com>wrote:
> >
> >> Henry S?cart skrev:
> >> > Hi,
> >> >
> >> > I've been trying to get an SD card working with an at91sam9g45ek-
> es
> >> board. I
> >> > read a couple of threads in the archive and ended up doing this:
> >> >
> >>
> >> I have booted the AT91SAM9G45EKES (Actually the AT91SAM9M10EKES,
> >> but it is almost the same) from SD-Card for the last month.
> >> The patchset for 2009.11 is available for testing in my private git
> >> branch on www.openembedded.org: origin/ulf/linux-2.6.30-20100317
> >>
> >> I came to the conclusion that the atmel MCI driver (written for the
> big
> >> endian AVR32) has significant byte sex problems.
> >>
> >> BR
> >> Ulf Samuelsson.
> >>
> >>
> >> > I applied these patches:
> >> >
> >> > http://lists.denx.de/pipermail/u-boot/2009-August/059595.html
> >> > http://lists.denx.de/pipermail/u-boot/2009-September/060053.html
> >> > http://lists.denx.de/pipermail/u-boot/2009-September/060243.html
> >> >
> >> > Added these #define's to include/configs/at91sam9m10g45ek.h:
> >> >
> >> > #define CONFIG_CMD_EXT2 ? 1
> >> > #define CONFIG_CMD_FAT ? ? 1
> >> > #define CONFIG_CMD_MMC ? 1
> >> > #define CONFIG_MMC ? ? ? ? ? ?1
> >> > #define CONFIG_ATMEL_MCI ?1
> >> >
> >> > Finally, I added this to the board init function:
> >> >
> >> > #ifdef CONFIG_ATMEL_MCI
> >> > at91_mci0_hw_init(0, 4);
> >> > #endif
> >> >
> >> > When I try it out this is what I get:
> >> > U-Boot> mmc init 0
> >> > mmc: clock 150000 too low; setting CLKDIV to 255
> >> > mmc: command 1 failed (status: 0x0c100025)
> >> > No MMC card found
> >> >
> >> > Am I doing something wrong? Any help is appreciated,
> >> >
> >> > Henry
> >> >
> >> >
> >> >
> >> > ------------------------------------------------------------------
> ------
> >> >
> >> > _______________________________________________
> >> > U-Boot mailing list
> >> > U-Boot at lists.denx.de
> >> > http://lists.denx.de/mailman/listinfo/u-boot
> >>
> >>
> >
> > _______________________________________________
> > U-Boot mailing list
> > U-Boot at lists.denx.de
> > http://lists.denx.de/mailman/listinfo/u-boot
> >
> >

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

* [U-Boot] at91sam9g45ekes SDHC/MMC
  2010-04-23  0:51     ` Rob Emanuele
  2010-04-23  6:24       ` Samuelsson, Ulf
@ 2010-04-23 21:58       ` Andy Fleming
  2010-04-23 23:21         ` Albin Tonnerre
  1 sibling, 1 reply; 17+ messages in thread
From: Andy Fleming @ 2010-04-23 21:58 UTC (permalink / raw)
  To: u-boot

On Thu, Apr 22, 2010 at 7:51 PM, Rob Emanuele <rob@emanuele.us> wrote:
> Hi Henry & U-Boot Community,
>
> I've been experiencing the same errors and frustration you have.
>
> So I've been looking at this code and these patch sets for a day or
> two now. ?I've done that in conjunction with reading the SD card spec:
> http://www.sdcard.org/developers/tech/sdcard/pls/
>
> I've come to the conclusion that this code as it stands will not work
> with any card that conforms to the SD Physical Layer Simplified
> Specification Version 2.0. ?This includes all SDHC cards and some
> non-HC cards that conform to version 2.0. ?I have a few 1GB cards that
> work just fine with the atmel_mci.c code on a 'G45 as it was in rev
> 95c44ec485b46ffb43dbdaa299f1491a500fdadf .
>
> If your SD card is newer, you'll see in the for loop in "sd_init_card"
> in atmel_mci.c time out. ?In the 2.0 spec, you need to perform a CMD8
> (SEND_IF_COND) first to see if your card is a 2.0 card. ?In CMD8 you
> tell the card the voltages you support and if you support HC cards.
> Once you send it the right data there, then ACMD41 will not have its
> BUSY bit set. ?That's all well and good, but additionally the CSD
> register is in a new format and that needs updating before any of this
> will work.


The best solution is to use the MMC framework, which *does* do all of
these things that you suggest.  It should be fairly straightforward to
port the atmel_mci driver to this framework.  If you see something
lacking, feel free to mention it, or modify the framework.  :)

Andy

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

* [U-Boot] at91sam9g45ekes SDHC/MMC
  2010-04-23 21:58       ` Andy Fleming
@ 2010-04-23 23:21         ` Albin Tonnerre
  2010-04-24  1:18           ` Andy Fleming
  0 siblings, 1 reply; 17+ messages in thread
From: Albin Tonnerre @ 2010-04-23 23:21 UTC (permalink / raw)
  To: u-boot

On Fri, 23 Apr 2010 16:58 -0500, Andy Fleming wrote :
> On Thu, Apr 22, 2010 at 7:51 PM, Rob Emanuele <rob@emanuele.us> wrote:
> > Hi Henry & U-Boot Community,
> >
> > I've been experiencing the same errors and frustration you have.
> >
> > So I've been looking at this code and these patch sets for a day or
> > two now. ?I've done that in conjunction with reading the SD card spec:
> > http://www.sdcard.org/developers/tech/sdcard/pls/
> >
> > I've come to the conclusion that this code as it stands will not work
> > with any card that conforms to the SD Physical Layer Simplified
> > Specification Version 2.0. ?This includes all SDHC cards and some
> > non-HC cards that conform to version 2.0. ?I have a few 1GB cards that
> > work just fine with the atmel_mci.c code on a 'G45 as it was in rev
> > 95c44ec485b46ffb43dbdaa299f1491a500fdadf .
> >
> > If your SD card is newer, you'll see in the for loop in "sd_init_card"
> > in atmel_mci.c time out. ?In the 2.0 spec, you need to perform a CMD8
> > (SEND_IF_COND) first to see if your card is a 2.0 card. ?In CMD8 you
> > tell the card the voltages you support and if you support HC cards.
> > Once you send it the right data there, then ACMD41 will not have its
> > BUSY bit set. ?That's all well and good, but additionally the CSD
> > register is in a new format and that needs updating before any of this
> > will work.
> 
> 
> The best solution is to use the MMC framework, which *does* do all of
> these things that you suggest.  It should be fairly straightforward to
> port the atmel_mci driver to this framework.  If you see something
> lacking, feel free to mention it, or modify the framework.  :)

I did port the atmel_mci driver to the MMC framework and posted the results on
this mailing list a few months back. However, some people apparently experienced
issues I have never been able to reproduce, and got few review.
I recently adapted the AT91 SD/MMC support patch and the atmel_mci port to use
the new C structures access, I'll repost it in a couple days in case anyone's
interested.

Cheers,
-- 
Albin Tonnerre, Free Electrons
Kernel, drivers and embedded Linux development,
consulting, training and support.
http://free-electrons.com

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

* [U-Boot] at91sam9g45ekes SDHC/MMC
  2010-04-23 23:21         ` Albin Tonnerre
@ 2010-04-24  1:18           ` Andy Fleming
  2010-04-28 20:17             ` Robert Emanuele
  0 siblings, 1 reply; 17+ messages in thread
From: Andy Fleming @ 2010-04-24  1:18 UTC (permalink / raw)
  To: u-boot

On Fri, Apr 23, 2010 at 6:21 PM, Albin Tonnerre
<albin.tonnerre@free-electrons.com> wrote:
> On Fri, 23 Apr 2010 16:58 -0500, Andy Fleming wrote :
>> On Thu, Apr 22, 2010 at 7:51 PM, Rob Emanuele <rob@emanuele.us> wrote:
>> > Hi Henry & U-Boot Community,
>> >
>> > I've been experiencing the same errors and frustration you have.
>> >
>> > So I've been looking at this code and these patch sets for a day or
>> > two now. ?I've done that in conjunction with reading the SD card spec:
>> > http://www.sdcard.org/developers/tech/sdcard/pls/
>> >
>> > I've come to the conclusion that this code as it stands will not work
>> > with any card that conforms to the SD Physical Layer Simplified
>> > Specification Version 2.0. ?This includes all SDHC cards and some
>> > non-HC cards that conform to version 2.0. ?I have a few 1GB cards that
>> > work just fine with the atmel_mci.c code on a 'G45 as it was in rev
>> > 95c44ec485b46ffb43dbdaa299f1491a500fdadf .
>> >
>> > If your SD card is newer, you'll see in the for loop in "sd_init_card"
>> > in atmel_mci.c time out. ?In the 2.0 spec, you need to perform a CMD8
>> > (SEND_IF_COND) first to see if your card is a 2.0 card. ?In CMD8 you
>> > tell the card the voltages you support and if you support HC cards.
>> > Once you send it the right data there, then ACMD41 will not have its
>> > BUSY bit set. ?That's all well and good, but additionally the CSD
>> > register is in a new format and that needs updating before any of this
>> > will work.
>>
>>
>> The best solution is to use the MMC framework, which *does* do all of
>> these things that you suggest. ?It should be fairly straightforward to
>> port the atmel_mci driver to this framework. ?If you see something
>> lacking, feel free to mention it, or modify the framework. ?:)
>
> I did port the atmel_mci driver to the MMC framework and posted the results on
> this mailing list a few months back. However, some people apparently experienced
> issues I have never been able to reproduce, and got few review.
> I recently adapted the AT91 SD/MMC support patch and the atmel_mci port to use
> the new C structures access, I'll repost it in a couple days in case anyone's
> interested.
>


Yeah, I see that now.  I'm catching up from being in various other
project quagmires.  Sadly,
I can't apply your patch if people are running into problems with it,
but I'd far prefer it.

I also don't have such a board, though.  If someone could apply
Albin's patches, and try to identify why it's not working, I'd be very
appreciative.  :)

Andy

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

* [U-Boot] at91sam9g45ekes SDHC/MMC
  2010-04-24  1:18           ` Andy Fleming
@ 2010-04-28 20:17             ` Robert Emanuele
  2010-05-03 14:45               ` Henry Súcart
  0 siblings, 1 reply; 17+ messages in thread
From: Robert Emanuele @ 2010-04-28 20:17 UTC (permalink / raw)
  To: u-boot

Andy, Henry, Ulf, and the rest,

I've posted the patch that I'm using for my SD/MMC support.  It is a
new driver based on some of the code from the original Atmel driver
that uses the MMC framework.  I've tested it on a at91sam9g45 (ES and
production chips) and on an ek board and our own board.

I hope this can help you guys out and I hope this can get mainlined
for others to enjoy.

If the patch is not in your email, here is a link to it in the archives:
http://lists.denx.de/pipermail/u-boot/2010-April/070816.html

--Rob

On Fri, Apr 23, 2010 at 6:18 PM, Andy Fleming <afleming@gmail.com> wrote:
> On Fri, Apr 23, 2010 at 6:21 PM, Albin Tonnerre
> <albin.tonnerre@free-electrons.com> wrote:
>> On Fri, 23 Apr 2010 16:58 -0500, Andy Fleming wrote :
>>> On Thu, Apr 22, 2010 at 7:51 PM, Rob Emanuele <rob@emanuele.us> wrote:
>>> > Hi Henry & U-Boot Community,
>>> >
>>> > I've been experiencing the same errors and frustration you have.
>>> >
>>> > So I've been looking at this code and these patch sets for a day or
>>> > two now. ?I've done that in conjunction with reading the SD card spec:
>>> > http://www.sdcard.org/developers/tech/sdcard/pls/
>>> >
>>> > I've come to the conclusion that this code as it stands will not work
>>> > with any card that conforms to the SD Physical Layer Simplified
>>> > Specification Version 2.0. ?This includes all SDHC cards and some
>>> > non-HC cards that conform to version 2.0. ?I have a few 1GB cards that
>>> > work just fine with the atmel_mci.c code on a 'G45 as it was in rev
>>> > 95c44ec485b46ffb43dbdaa299f1491a500fdadf .
>>> >
>>> > If your SD card is newer, you'll see in the for loop in "sd_init_card"
>>> > in atmel_mci.c time out. ?In the 2.0 spec, you need to perform a CMD8
>>> > (SEND_IF_COND) first to see if your card is a 2.0 card. ?In CMD8 you
>>> > tell the card the voltages you support and if you support HC cards.
>>> > Once you send it the right data there, then ACMD41 will not have its
>>> > BUSY bit set. ?That's all well and good, but additionally the CSD
>>> > register is in a new format and that needs updating before any of this
>>> > will work.
>>>
>>>
>>> The best solution is to use the MMC framework, which *does* do all of
>>> these things that you suggest. ?It should be fairly straightforward to
>>> port the atmel_mci driver to this framework. ?If you see something
>>> lacking, feel free to mention it, or modify the framework. ?:)
>>
>> I did port the atmel_mci driver to the MMC framework and posted the results on
>> this mailing list a few months back. However, some people apparently experienced
>> issues I have never been able to reproduce, and got few review.
>> I recently adapted the AT91 SD/MMC support patch and the atmel_mci port to use
>> the new C structures access, I'll repost it in a couple days in case anyone's
>> interested.
>>
>
>
> Yeah, I see that now. ?I'm catching up from being in various other
> project quagmires. ?Sadly,
> I can't apply your patch if people are running into problems with it,
> but I'd far prefer it.
>
> I also don't have such a board, though. ?If someone could apply
> Albin's patches, and try to identify why it's not working, I'd be very
> appreciative. ?:)
>
> Andy
>

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

* [U-Boot] at91sam9g45ekes SDHC/MMC
  2010-04-28 20:17             ` Robert Emanuele
@ 2010-05-03 14:45               ` Henry Súcart
  0 siblings, 0 replies; 17+ messages in thread
From: Henry Súcart @ 2010-05-03 14:45 UTC (permalink / raw)
  To: u-boot

The patch works. Thanks Rob!

This is what I did, in case somebody else is looking for this:

Apply the patch. Add all the other stuff mentioned in the patch link.

Add the #define CONFIG_CMD_MMC 1 and #define CONFIG_CMD_FAT 1 to your board
config file (in my case at91sam9mg45ek.h). I only needed to read from a FAT
partition, so I only enabled that command.

Add an mmc_hw_init() function to the board specific file. In my case the
function is called at91sam9m10g45ekes_mmc_hw_init().

static void at91sam9m10g45ekes_mmc_hw_init(void)
{
       at91_set_A_periph(AT91_PIN_PA0, 0); /* CLK */
       at91_set_A_periph(AT91_PIN_PA1, 1); /* CDA */
       at91_set_A_periph(AT91_PIN_PA2, 1); /* D0 */
       at91_set_A_periph(AT91_PIN_PA3, 1); /* D1 */
       at91_set_A_periph(AT91_PIN_PA4, 1); /* D2 */
       at91_set_A_periph(AT91_PIN_PA5, 1); /* D3 */

       at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9G45_ID_MCI0);
}

(Thanks again Rob).

Before using the fat commands run "mmc rescan 0" (just one time) or the fat
command will hang.



On Wed, Apr 28, 2010 at 4:17 PM, Robert Emanuele <rob@emanuele.us> wrote:

> Andy, Henry, Ulf, and the rest,
>
> I've posted the patch that I'm using for my SD/MMC support.  It is a
> new driver based on some of the code from the original Atmel driver
> that uses the MMC framework.  I've tested it on a at91sam9g45 (ES and
> production chips) and on an ek board and our own board.
>
> I hope this can help you guys out and I hope this can get mainlined
> for others to enjoy.
>
> If the patch is not in your email, here is a link to it in the archives:
> http://lists.denx.de/pipermail/u-boot/2010-April/070816.html
>
> --Rob
>
> On Fri, Apr 23, 2010 at 6:18 PM, Andy Fleming <afleming@gmail.com> wrote:
> > On Fri, Apr 23, 2010 at 6:21 PM, Albin Tonnerre
> > <albin.tonnerre@free-electrons.com> wrote:
> >> On Fri, 23 Apr 2010 16:58 -0500, Andy Fleming wrote :
> >>> On Thu, Apr 22, 2010 at 7:51 PM, Rob Emanuele <rob@emanuele.us> wrote:
> >>> > Hi Henry & U-Boot Community,
> >>> >
> >>> > I've been experiencing the same errors and frustration you have.
> >>> >
> >>> > So I've been looking at this code and these patch sets for a day or
> >>> > two now.  I've done that in conjunction with reading the SD card
> spec:
> >>> > http://www.sdcard.org/developers/tech/sdcard/pls/
> >>> >
> >>> > I've come to the conclusion that this code as it stands will not work
> >>> > with any card that conforms to the SD Physical Layer Simplified
> >>> > Specification Version 2.0.  This includes all SDHC cards and some
> >>> > non-HC cards that conform to version 2.0.  I have a few 1GB cards
> that
> >>> > work just fine with the atmel_mci.c code on a 'G45 as it was in rev
> >>> > 95c44ec485b46ffb43dbdaa299f1491a500fdadf .
> >>> >
> >>> > If your SD card is newer, you'll see in the for loop in
> "sd_init_card"
> >>> > in atmel_mci.c time out.  In the 2.0 spec, you need to perform a CMD8
> >>> > (SEND_IF_COND) first to see if your card is a 2.0 card.  In CMD8 you
> >>> > tell the card the voltages you support and if you support HC cards.
> >>> > Once you send it the right data there, then ACMD41 will not have its
> >>> > BUSY bit set.  That's all well and good, but additionally the CSD
> >>> > register is in a new format and that needs updating before any of
> this
> >>> > will work.
> >>>
> >>>
> >>> The best solution is to use the MMC framework, which *does* do all of
> >>> these things that you suggest.  It should be fairly straightforward to
> >>> port the atmel_mci driver to this framework.  If you see something
> >>> lacking, feel free to mention it, or modify the framework.  :)
> >>
> >> I did port the atmel_mci driver to the MMC framework and posted the
> results on
> >> this mailing list a few months back. However, some people apparently
> experienced
> >> issues I have never been able to reproduce, and got few review.
> >> I recently adapted the AT91 SD/MMC support patch and the atmel_mci port
> to use
> >> the new C structures access, I'll repost it in a couple days in case
> anyone's
> >> interested.
> >>
> >
> >
> > Yeah, I see that now.  I'm catching up from being in various other
> > project quagmires.  Sadly,
> > I can't apply your patch if people are running into problems with it,
> > but I'd far prefer it.
> >
> > I also don't have such a board, though.  If someone could apply
> > Albin's patches, and try to identify why it's not working, I'd be very
> > appreciative.  :)
> >
> > Andy
> >
>

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

end of thread, other threads:[~2010-05-03 14:45 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-15 19:51 [U-Boot] at91sam9g45ekes SDHC/MMC Henry Súcart
2010-03-15 20:10 ` Albin Tonnerre
2010-03-15 21:40   ` Henry Súcart
2010-03-15 22:15     ` Albin Tonnerre
2010-03-16 12:30       ` Henry Súcart
2010-03-16 20:36         ` Albin Tonnerre
2010-03-16 22:08           ` Henry Súcart
2010-03-17 19:23             ` Henry Súcart
2010-04-06  9:57 ` Ulf Samuelsson
2010-04-12 13:55   ` Henry Súcart
2010-04-23  0:51     ` Rob Emanuele
2010-04-23  6:24       ` Samuelsson, Ulf
2010-04-23 21:58       ` Andy Fleming
2010-04-23 23:21         ` Albin Tonnerre
2010-04-24  1:18           ` Andy Fleming
2010-04-28 20:17             ` Robert Emanuele
2010-05-03 14:45               ` Henry Súcart

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.