All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot]  [PATCH v3] AT91: Add SD/MMC controller support
@ 2009-10-01  7:22 Sebastian Heutling
  2009-10-01  7:59 ` [U-Boot] AT91 working SD with u-boot Konrad Mattheis
  0 siblings, 1 reply; 7+ messages in thread
From: Sebastian Heutling @ 2009-10-01  7:22 UTC (permalink / raw)
  To: u-boot

Hello there,

I tried to get mmc working on a board using an at91sam9g20. The mmc-card 
is wired on slotb.

I applied the patches:

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

It didn't work as I always got (apart from the message of a too low 
clock which I avoided by setting f_min / f_max on my own):

mmc: command 8 failed (status: 0x0010c1e5)
mmc: command 55 failed (status: 0x0010c1e5)
mmc: command 1 failed (status: 0x0010c1e5)
Card did not respond to voltage select!

So I had a look at linux sources and discovered that the MCI selected 
the wrong slot. After modifying atmel_mci_set_ios() to set SDCR to use 
slotb ("mmci_writel(SDCR, sdcr | 1);") I got my card working.

Hope this helps someone.

Regards

Sebastian Heutling

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

* [U-Boot] AT91 working SD with u-boot
  2009-10-01  7:22 [U-Boot] [PATCH v3] AT91: Add SD/MMC controller support Sebastian Heutling
@ 2009-10-01  7:59 ` Konrad Mattheis
  2009-10-01  8:25   ` Sebastian Heutling
  0 siblings, 1 reply; 7+ messages in thread
From: Konrad Mattheis @ 2009-10-01  7:59 UTC (permalink / raw)
  To: u-boot

Hi,

for me this is working:

Downloaded u-boot 2009.08

file cpu/arm926ejs/at91/at91sam9260_devices.c
> 
> changed:
> >#if defined(CONFIG_HAS_DATAFLASH)
> to:
> >#if defined(CONFIG_HAS_DATAFLASH) || defined(CONFIG_ATMEL_SPI)

patches:

SOC headers:
http://lists.denx.de/pipermail/u-boot/2009-September/060053.html

SD Patch V3
http://lists.denx.de/pipermail/u-boot/2009-September/060243.html

MCI support
http://lists.denx.de/pipermail/u-boot/2009-August/059595.html

add to board init code:

at91_mciX_hw_init (X for mci unit 0 / 1) for parameters have a look at cpu/arm926ejs/at91/at91sam9260_devices.c

bye
Konrad Mattheis

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

* [U-Boot] AT91 working SD with u-boot
  2009-10-01  7:59 ` [U-Boot] AT91 working SD with u-boot Konrad Mattheis
@ 2009-10-01  8:25   ` Sebastian Heutling
  2009-10-01  8:33     ` Konrad Mattheis
  2010-05-26 19:03     ` Kalyan
  0 siblings, 2 replies; 7+ messages in thread
From: Sebastian Heutling @ 2009-10-01  8:25 UTC (permalink / raw)
  To: u-boot

Hi Konrad,

are you using the AT91SAM9G20-EK?

In that case the difference between us is that I'm working on a 
different board which is using the slotb MCI while the AT91SAM9G20-EK 
uses slota.

In case of slota it just worked because MCI_SDCR is 0 on reset but for 
slotb the SDCSEL field must be set to 1.

Regards

Sebastian Heutling


On 10/01/2009 09:59 AM, Konrad Mattheis wrote:
> Hi,
>
> for me this is working:
>
> Downloaded u-boot 2009.08
>
> file cpu/arm926ejs/at91/at91sam9260_devices.c
>>
>> changed:
>>> #if defined(CONFIG_HAS_DATAFLASH)
>> to:
>>> #if defined(CONFIG_HAS_DATAFLASH) || defined(CONFIG_ATMEL_SPI)
>
> patches:
>
> SOC headers:
> http://lists.denx.de/pipermail/u-boot/2009-September/060053.html
>
> SD Patch V3
> http://lists.denx.de/pipermail/u-boot/2009-September/060243.html
>
> MCI support
> http://lists.denx.de/pipermail/u-boot/2009-August/059595.html
>
> add to board init code:
>
> at91_mciX_hw_init (X for mci unit 0 / 1) for parameters have a look at cpu/arm926ejs/at91/at91sam9260_devices.c
>
> bye
> Konrad Mattheis
>
>
>

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

* [U-Boot] AT91 working SD with u-boot
  2009-10-01  8:25   ` Sebastian Heutling
@ 2009-10-01  8:33     ` Konrad Mattheis
  2009-10-01  9:28       ` Sebastian Heutling
  2010-05-26 19:03     ` Kalyan
  1 sibling, 1 reply; 7+ messages in thread
From: Konrad Mattheis @ 2009-10-01  8:33 UTC (permalink / raw)
  To: u-boot

Hi Sebastian,

yes I'm using an AT91SAM9G20-EK Rev.c with two SD slots.
I used slot a but I think you just have to init slot b.

in PatchV3 you can read:

>at91_mci0_hw_init(int slot, int bus_width)

>switch (slot) {
>		case 0:
>			.....
>		case 1:
So I think you just have to call at91_mci0_hw_init(1,4) for
slot b.

bye
Konrad


> -----Urspr?ngliche Nachricht-----
> Von: Sebastian Heutling [mailto:heutling at who-ing.de]
> Gesendet: Donnerstag, 1. Oktober 2009 10:26
> An: Konrad Mattheis
> Cc: u-boot at lists.denx.de
> Betreff: Re: AT91 working SD with u-boot
> 
> Hi Konrad,
> 
> are you using the AT91SAM9G20-EK?
> 
> In that case the difference between us is that I'm working on a
> different board which is using the slotb MCI while the AT91SAM9G20-EK
> uses slota.
> 
> In case of slota it just worked because MCI_SDCR is 0 on reset but for
> slotb the SDCSEL field must be set to 1.
> 
> Regards
> 
> Sebastian Heutling
> 
> 
> On 10/01/2009 09:59 AM, Konrad Mattheis wrote:
> > Hi,
> >
> > for me this is working:
> >
> > Downloaded u-boot 2009.08
> >
> > file cpu/arm926ejs/at91/at91sam9260_devices.c
> >>
> >> changed:
> >>> #if defined(CONFIG_HAS_DATAFLASH)
> >> to:
> >>> #if defined(CONFIG_HAS_DATAFLASH) || defined(CONFIG_ATMEL_SPI)
> >
> > patches:
> >
> > SOC headers:
> > http://lists.denx.de/pipermail/u-boot/2009-September/060053.html
> >
> > SD Patch V3
> > http://lists.denx.de/pipermail/u-boot/2009-September/060243.html
> >
> > MCI support
> > http://lists.denx.de/pipermail/u-boot/2009-August/059595.html
> >
> > add to board init code:
> >
> > at91_mciX_hw_init (X for mci unit 0 / 1) for parameters have a look
> at cpu/arm926ejs/at91/at91sam9260_devices.c
> >
> > bye
> > Konrad Mattheis
> >
> >
> >
> 

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

* [U-Boot] AT91 working SD with u-boot
  2009-10-01  8:33     ` Konrad Mattheis
@ 2009-10-01  9:28       ` Sebastian Heutling
  2009-10-04 12:54         ` Albin Tonnerre
  0 siblings, 1 reply; 7+ messages in thread
From: Sebastian Heutling @ 2009-10-01  9:28 UTC (permalink / raw)
  To: u-boot

Hi Konrad,


On 10/01/2009 10:33 AM, Konrad Mattheis wrote:
> Hi Sebastian,
>
> yes I'm using an AT91SAM9G20-EK Rev.c with two SD slots.
> I used slot a but I think you just have to init slot b.
>
> in PatchV3 you can read:
>
>> at91_mci0_hw_init(int slot, int bus_width)
>
>> switch (slot) {
>> 		case 0:
>> 			.....
>> 		case 1:
> So I think you just have to call at91_mci0_hw_init(1,4) for
> slot b.

No - that is not enough. It just enables the clock for MCI and 
configures the pins. But the MCI itself needs to know which slot to 
address.

Suppose you want to use both slots at the same time (and the drivers 
would support that).
Then you would call:

at91_mci0_hw_init(0, 4)
at91_mci0_hw_init(1, 4)

In order to access both slots the driver (atmel_mci) needs to select 
which slot to address. And that is what the SDCSEL field of MCI-SDCR is 
for (see also Datasheet of the AT91SAM9G20 35.9.4 (probably at page 607)).

Regards

Sebastian

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

* [U-Boot] AT91 working SD with u-boot
  2009-10-01  9:28       ` Sebastian Heutling
@ 2009-10-04 12:54         ` Albin Tonnerre
  0 siblings, 0 replies; 7+ messages in thread
From: Albin Tonnerre @ 2009-10-04 12:54 UTC (permalink / raw)
  To: u-boot

On Thu, 01 Oct 2009 11:28 +0200, Sebastian Heutling wrote :
> Hi Konrad,


> On 10/01/2009 10:33 AM, Konrad Mattheis wrote:
> > Hi Sebastian,

> > yes I'm using an AT91SAM9G20-EK Rev.c with two SD slots.
> > I used slot a but I think you just have to init slot b.

> > in PatchV3 you can read:

> >> at91_mci0_hw_init(int slot, int bus_width)

> >> switch (slot) {
> >> 		case 0:
> >> 			.....
> >> 		case 1:
> > So I think you just have to call at91_mci0_hw_init(1,4) for
> > slot b.

> No - that is not enough. It just enables the clock for MCI and 
> configures the pins. But the MCI itself needs to know which slot to 
> address.

> Suppose you want to use both slots at the same time (and the drivers 
> would support that).
> Then you would call:

> at91_mci0_hw_init(0, 4)
> at91_mci0_hw_init(1, 4)

> In order to access both slots the driver (atmel_mci) needs to select 
> which slot to address. And that is what the SDCSEL field of MCI-SDCR is 
> for (see also Datasheet of the AT91SAM9G20 35.9.4 (probably at page 607)).

But the driver doesn't support for the moment. I might add such support if I
have some time (and if that works - has anybody ever tried doing that with
Linux?). For now the best way to get it working is to select the correct slot
in your board config code.

Cheers,
-- 
Albin Tonnerre, Free Electrons
Kernel, drivers and embedded Linux development,
consulting, training and support.
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
Url : http://lists.denx.de/pipermail/u-boot/attachments/20091004/ac8252e4/attachment.pgp 

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

* [U-Boot] AT91 working SD with u-boot
  2009-10-01  8:25   ` Sebastian Heutling
  2009-10-01  8:33     ` Konrad Mattheis
@ 2010-05-26 19:03     ` Kalyan
  1 sibling, 0 replies; 7+ messages in thread
From: Kalyan @ 2010-05-26 19:03 UTC (permalink / raw)
  To: u-boot

Sebastian Heutling <heutling <at> who-ing.de> writes:

> 
> Hi Konrad,
> 
> are you using the AT91SAM9G20-EK?
> 
> In that case the difference between us is that I'm working on a 
> different board which is using the slotb MCI while the AT91SAM9G20-EK 
> uses slota.
> 
> In case of slota it just worked because MCI_SDCR is 0 on reset but for 
> slotb the SDCSEL field must be set to 1.
> 
> Regards
> 
> Sebastian Heutling
> 
> On 10/01/2009 09:59 AM, Konrad Mattheis wrote:
> > Hi,
> >
> > for me this is working:
> >
> > Downloaded u-boot 2009.08
> >
> > file cpu/arm926ejs/at91/at91sam9260_devices.c
> >>
> >> changed:
> >>> #if defined(CONFIG_HAS_DATAFLASH)
> >> to:
> >>> #if defined(CONFIG_HAS_DATAFLASH) || defined(CONFIG_ATMEL_SPI)
> >
> > patches:
> >
> > SOC headers:
> > http://lists.denx.de/pipermail/u-boot/2009-September/060053.html
> >
> > SD Patch V3
> > http://lists.denx.de/pipermail/u-boot/2009-September/060243.html
> >
> > MCI support
> > http://lists.denx.de/pipermail/u-boot/2009-August/059595.html
> >
> > add to board init code:
> >
> > at91_mciX_hw_init (X for mci unit 0 / 1) for parameters have a look at
cpu/arm926ejs/at91/at91sam9260_devices.c
> >
> > bye
> > Konrad Mattheis
> >
> >
> >
> 


Hello,

Thanks a lot for your post. Could you please let me know what configurations are
to be added to /include/configs/board.h file to enable MMC/SD support.
I've added the following configurations 

/* MMC/SD Support */

/* To include File system support for MMC */
#define CONFIG_DOS_PARTITION
#define CONFIG_CMD_EXT2
#define CONFIG_CMD_FAT
#define CONFIG_MMC
#define CONFIG_GENERIC_MMC
#define CONFIG_DAVINCI_MMC
#define CONFIG_CMD_MM

/* To enable Environment variables to reside on MMC.  */
#define CONFIG_DOS_PARTITION	1
//#undef CONFIG_MMC
#define CONFIG_SYS_MMC_BASE		0xFFFB4000
#define CONFIG_SYS_MMC_BLOCKSIZE	512

and when I enter mmcinit, u-boot says command not found. Please find the logs:
and thanks alot for your time :)

Electrum> mmcElectrum> mmc
Usage:
MMC sub system
Electrum> mmcinit
Unknown command 'mmcinit' - try 'help'
Electrum> mmcinfo
MMC Device 0 not found



Thanks,
Kalyan.

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

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

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-01  7:22 [U-Boot] [PATCH v3] AT91: Add SD/MMC controller support Sebastian Heutling
2009-10-01  7:59 ` [U-Boot] AT91 working SD with u-boot Konrad Mattheis
2009-10-01  8:25   ` Sebastian Heutling
2009-10-01  8:33     ` Konrad Mattheis
2009-10-01  9:28       ` Sebastian Heutling
2009-10-04 12:54         ` Albin Tonnerre
2010-05-26 19:03     ` Kalyan

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.