Create a new driver for Atmel at91/avr MCI adapters that uses the u-boot mmc framework.
Subsystems (2)
PATCH 1/1 Create a new driver for Atmel at91/avr MCI adapters that uses the u-boot mmc framework.
To use it on your platform add defines like these:
#define CONFIG_MMC 1 #define CONFIG_GENERIC_MMC 1 #define CONFIG_GENERIC_ATMEL_MCI 1
/*change this for your cpu */
#define MMCI_BASE 0xFFF80000
Then create an init routine in your platform code:
/* this is a weak define that we are overriding */ int board_mmc_init(bd_t *bd)
{
/* This calls your code to clock the interface
* and set the pins up, etc.
*/
mmc_hw_init();
/* This calls the atmel_mmc_init in gen_atmel_mci.c */
return atmel_mmc_init(bd);
}--- drivers/mmc/Makefile | 1 + drivers/mmc/gen_atmel_mci.c | 330 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 331 insertions(+), 0 deletions(-) create mode 100644 drivers/mmc/gen_atmel_mci.c
drivers/mmc/Makefile +1 -0
@@ -26,6 +26,7 @@ include $(TOPDIR)/config.mk LIB := $(obj)libmmc.a COBJS-$(CONFIG_GENERIC_MMC) += mmc.o +COBJS-$(CONFIG_GENERIC_ATMEL_MCI) += gen_atmel_mci.o COBJS-$(CONFIG_ATMEL_MCI) += atmel_mci.o COBJS-$(CONFIG_BFIN_SDH) += bfin_sdh.o COBJS-$(CONFIG_OMAP3_MMC) += omap3_mmc.o
drivers/mmc/gen_atmel_mci.c new file +330 -0
330 lines not on this page · raw message
Signature · 1 line
1.6.3.3
PATCH 1/1 Create a new driver for Atmel at91/avr MCI adapters that uses the u-boot mmc framework.
Quoted 4 lines · Rob Emanuele
To use it on your platform add defines like these:
#define CONFIG_MMC 1 #define CONFIG_GENERIC_MMC 1 #define CONFIG_GENERIC_ATMEL_MCI 1
<snip>
Dear Rob Emanuele,
this patch applies to current TOT, however it does not work flawlessly:
TOP9000> fatls mmc 0:1gen_atmel_mci: CMDR 0x00001050 (16) ARGR 0x00000000 (SR: 0x00000000) COMMAND Dbg
Msggen_atmel_mci: CMDR 0x00051051 (17) ARGR 0x00000000 (SR: 0x00000000) COMMAND Dbg
Msg
*** system hangs here ***
But, if preceeded by a mmc read command it works (except for some odd clock related messages):
TOP9000> mmc read 0 21000000 0 1
MMC read: dev # 0, block # 0, count 1 ... mmc: setting clock 150000 Hz, block size 512
mmc: clock 150000 too low; setting CLKDIV to 255
mmc: setting clock 0 Hz, block size 512
mmc: clock 0 too low; setting CLKDIV to 255
mmc: setting clock 194000 Hz, block size 512gen_atmel_mci: CMDR 0x00001048 ( 8) ARGR 0x000001aa (SR: 0x0010c0e5) COMMAND Failed
mmc: setting clock 194000 Hz, block size 512
mmc: setting clock 25000000 Hz, block size 512
1 blocks read: OK
TOP9000> fatls mmc 0:1
28521 blaue berge.jpg
1 file(s), 0 dir(s)
Which hardware(CPU) did you test it, and which u-boot version?
Best Regards,
Reinhard Meyer
PATCH 1/1 Create a new driver for Atmel at91/avr MCI adapters that uses the u-boot mmc framework.
Quoted 10 lines · Reinhard Meyer
TOP9000> fatls mmc 0:1
gen_atmel_mci: CMDR0x00001050(16) ARGR0x00000000(SR:0x00000000) COMMAND Dbg
Msggen_atmel_mci: CMDR0x00051051(17) ARGR0x00000000(SR:0x00000000) COMMAND Dbg
Msg*** system hangs here ***
But, if preceeded by a mmc read command it works (except for some odd clock related messages):
Ok, the problem is that fatls does not call any init functions, its first call is a read...
I added a check for initialized so read will fail if MCI has not been initialized.
The command "mmcinfo" does the initialisation.
TOP9000> fatls mmc 0:1
MCI not initialized!
** Can't read from device 0 **
** Unable to use mmc 0:1 for fatls ** TOP9000> mmci
mmc: setting clock 150000 Hz, block size 512
mmc: clock 150000 too low; setting CLKDIV to 255
mmc: setting clock 0 Hz, block size 512
mmc: clock 0 too low; setting CLKDIV to 255
mmc: setting clock 194000 Hz, block size 512
mmc: setting clock 194000 Hz, block size 512
mmc: setting clock 25000000 Hz, block size 512
Device: Atmel MCI
Manufacturer ID: 89
OEM: 303
Name: NCard
Tran Speed: 25000000
Rd Block Len: 512
SD version 2.0
High Capacity: No
Capacity: 2006974464
Bus Width: 4-bit
TOP9000> fatls mmc 0:1
windows/
programme/
0 file(s), 2 dir(s)
I'll rework this driver to use struct SoC access and present it as a patch soon.
Reinhard