Atmel website | ARM Community | AVR freaks | Technical Support
Banner
 FAQ •  Search •  Register •  Login 

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: AT91SAM9G45-EKES U-Boot read SD Card
PostPosted: Thu Oct 08, 2009 11:31 pm 
Offline

Joined: Thu Sep 24, 2009 1:20 am
Posts: 2
Hello!

I'm trying to get to get the AT91SAM9G45 qualified for my use. Which involves reading an SD card in U-Boot, but am not having much luck with that.
Starting with 2009.08, I've applied the following patches:
http://lists.denx.de/pipermail/u-boot/2 ... 59456.html
http://lists.denx.de/pipermail/u-boot/2 ... 60053.html
http://lists.denx.de/pipermail/u-boot/2 ... 60243.html

Then added:
Code:
#ifdef CONFIG_ATMEL_MCI
int cpu_mmc_init(bd_t *bis)
{
   atmel_mci_init(bis);
}
#endif

to the end of cpu/arm926ejs/at91/cpu.c based on this:
http://lists.denx.de/pipermail/u-boot/2 ... 59457.html

Then added a call to the initialize function from the board init code in:
board/atmel/at91sam9m10g45ek/at91sam9m10g45ek.c
Code:
#ifdef CONFIG_ATMEL_MCI
   at91_mci0_hw_init(0, 4);
#endif


In the board configuration file, include/configs/at91sam9m10g45ek.h, I added:
Code:
/* SD Card */
#define CONFIG_CMD_EXT2 1
#define CONFIG_CMD_MMC 1
#define CONFIG_MMC 1
#define CONFIG_GENERIC_MMC 1
#define CONFIG_ATMEL_MCI 1


And see things show up at the start of U-Boot:
Code:
DRAM:  128 MB
## Unknown FLASH on Bank 1 - Size = 0x00000000 = 0 MB
Flash:  0 kB
NAND:  256 MiB
In:    serial
Out:   serial
Err:   serial
MMC:   ATMEL MCI: 0
Net:   macb0
macb0: Starting autonegotiation...
macb0: Autonegotiation complete
macb0: link up, 100Mbps full-duplex (lpa: 0xc1e1)
Hit any key to stop autoboot:  0

(I'm not sure about that Unknown FLASH, I originally thought it was the DataFlash, but pulling the chip select jumper didn't make it go away.)

However, executing 'mmc init' and 'mmcinfo' yield no results:
Code:
U-Boot> mmc init
U-Boot> mmcinfo
mmc: clock 150000 too low; setting CLKDIV to 255
mmc: clock 150000 too low; setting CLKDIV to 255
Device: ATMEL MCI
Manufacturer ID: 0
OEM: 0
Name: Tran Speed: 0
Rd Block Len: 1
MMC version 0.0
High Capacity: No
Capacity: 19124448563
Bus Width: 1-bit


I've compared the U-Boot at91sam9m10g45_devices.c and Linux's at91sam9g45_devices.c and they seem to agree with how to configure the MCI device in the chip, and the SD card works under Linux. I'm not sure how to proceed from here.

Thanks,
Dan


Top
 Profile  
 
 Post subject: Re: AT91SAM9G45-EKES U-Boot read SD Card
PostPosted: Mon Dec 14, 2009 12:46 am 
Offline

Joined: Sun Jul 19, 2009 8:18 am
Posts: 2
Hi,

Did you already solved the problem? If you still have the problem register to the u-boot devel maillinglist and aks again.
Hopefully I have the same problem like you in about 4 days and than the can discuss it there.

bye
Konrad


Top
 Profile  
 
 Post subject: Re: AT91SAM9G45-EKES U-Boot read SD Card
PostPosted: Thu Mar 29, 2012 5:11 pm 
Offline

Joined: Thu Mar 29, 2012 1:19 am
Posts: 4
Hi,

Has anyone managed to get the mmc working in U-boot for the at91sam9m10g45-ek? The hardware works fine under Linux, so it's just the U-boot driver that needs to be fixed. I tried various CONFIG_ arrangements for u-boot-2011.12 based on Web search of postings, but wasn't successful in getting a working mmc. I guess if this hasn't been done, then I'll have to try to get the U-boot mmc to work the same way as that in Linux.

Thanks for help.

Peter Lu


Top
 Profile  
 
 Post subject: Re: AT91SAM9G45-EKES U-Boot read SD Card
PostPosted: Sat Apr 14, 2012 5:29 pm 
Offline

Joined: Thu Mar 29, 2012 1:19 am
Posts: 4
Turns out the MCI controller on the at91sam9m10g45-ek doesn't do multi-block transfers in PIO mode very well, freezing up when the transfer-abort CMD12 is issued. So, it's just easier to have the U-boot driver use single-block transfers. The necessary configurations applied to u-boot-2011.12 are shown below...




== In at91sam9m10g45ek.h

#define CONFIG_CMD_MMC
#define CONFIG_CMD_FAT

/* MMC/SD */
#define CONFIG_MMC 1
#define CONFIG_GENERIC_MMC 1
#define CONFIG_GENERIC_ATMEL_MCI 1
#define CONFIG_SYS_MMC_MAX_BLK_COUNT 1 // Use single transfers, as multi-transfers hang




== In at91sam9m10g45ek.c

#if defined(CONFIG_GENERIC_ATMEL_MCI)
# include <mmc.h>
#endif


...



#ifdef CONFIG_GENERIC_ATMEL_MCI
void at91_mci_hw_init_dev(int dev)
{
if (dev == 0) {
at91_set_A_periph(AT91_PIN_PA0, 0); /* MCCKA */
at91_set_A_periph(AT91_PIN_PA1, 1); /* MCCDA */
at91_set_A_periph(AT91_PIN_PA2, 1); /* MCDA0 */
at91_set_A_periph(AT91_PIN_PA3, 1); /* MCDA1 */
at91_set_A_periph(AT91_PIN_PA4, 1); /* MCDA2 */
at91_set_A_periph(AT91_PIN_PA5, 1); /* MCDA3 */
}
else {
at91_set_A_periph(AT91_PIN_PA31, 0); /* MCCKB */
at91_set_A_periph(AT91_PIN_PA22, 1); /* MCCDB */
at91_set_A_periph(AT91_PIN_PA23, 1); /* MCDB0 */
at91_set_A_periph(AT91_PIN_PA24, 1); /* MCDB1 */
at91_set_A_periph(AT91_PIN_PA25, 1); /* MCDB2 */
at91_set_A_periph(AT91_PIN_PA26, 1); /* MCDB3 */
}
}

int board_mmc_init(bd_t *bd)
{
struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;

writel(1 << ATMEL_ID_MCI0, &pmc->pcer); // enable MCI clock
at91_mci_hw_init_dev(0);
atmel_mci_init((void *)ATMEL_BASE_MCI0); // in gen_atmel_mci.c

writel(1 << ATMEL_ID_MCI1, &pmc->pcer); // enable MCI clock
at91_mci_hw_init_dev(1);
atmel_mci_init((void *)ATMEL_BASE_MCI1); // in gen_atmel_mci.c

return 0;
}
#endif


== Suggested but not necessary changes in gen_atmel_mci.c for cleanliness

81c81
< debug("mci: setting clock %u Hz, block size %u\n",
---
> printf("mci: setting clock %u Hz, block size %u\n",
243c243
< print_buffer(0, data->dest + block_count * data->blocksize, 1,
---
> print_buffer(0, data->dest, 1,


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: