Skip to contentSkip to conversation

AVR32: switch to generic mmc framework

PATCH New Sven Schnelle 4 participants 14 messages Oct 12, 2011 – Oct 14, 2011

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 AVR32: switch to generic mmc framework

Hi List,

these patches switch all AVR32 boards to the generic MMC framework. Motivation for doing so is to be able to boot from SDHC cards. The second patch removes the legacy atmel_mci driver, as it is no longer used by any board.

I've only tried this code on the Atmel ATNGW100, as i have no other AVR32 boards. Would be great if some other users could try that patch on different platforms.

It seems like the gen_atmel_mci driver doesn't work with Multible Block transfer on AVR32, but the old code didn't used that mode either. So that's something for the TODO list for future improvements.

Regards,

Sven

#1 lore raw

PATCH 1/2 AVR32: use generic mmc framework

gen_atmel_mci works on AVR32 as well, so no need to use the legacy mmc driver. This also has the nice side effect of being able to use SDHC cards an AVR32 boards.

---
 arch/avr32/lib/board.c            |    3 +++
 board/atmel/atngw100/atngw100.c   |    9 +++++++++
 board/atmel/atstk1000/atstk1000.c |    9 +++++++++
 include/configs/atngw100.h        |    4 +++-
 include/configs/atstk1002.h       |    4 +++-
 include/configs/atstk1003.h       |    3 ++-
 include/configs/atstk1004.h       |    4 +++-
 include/configs/atstk1006.h       |    4 +++-
 include/configs/favr-32-ezkit.h   |    3 ++-
 include/configs/hammerhead.h      |    3 ++-
 include/configs/mimc200.h         |    3 ++-
 include/mmc.h                     |    1 -
 12 files changed, 41 insertions(+), 9 deletions(-)
arch/avr32/lib/board.c +3 -0
index 3e1cc0d..694755c 100644
@@ -334,6 +334,9 @@ void board_init_r(gd_t *new_gd, ulong dest_addr)
 	eth_initialize(gd->bd);
 #endif
 
+#ifdef CONFIG_GENERIC_ATMEL_MCI
+	mmc_initialize(gd->bd);
+#endif
 	for (;;) {
 		main_loop();
 	}
board/atmel/atngw100/atngw100.c +9 -0
index 59577b8..af22403 100644
@@ -139,3 +139,12 @@ void spi_cs_deactivate(struct spi_slave *slave)
 	gpio_set_value(ATNGW100_DATAFLASH_CS_PIN, 1);
 }
 #endif /* CONFIG_ATMEL_SPI */
+
+#ifdef CONFIG_GENERIC_ATMEL_MCI
+int board_mmc_init(bd_t *bd)
+{
+        /* This calls the atmel_mci_init in gen_atmel_mci.c */
+        return atmel_mci_init((void *)ATMEL_BASE_MMCI);
+
+}
+#endif
board/atmel/atstk1000/atstk1000.c +9 -0
index 58048a4..93f8e43 100644
@@ -139,3 +139,12 @@ int board_eth_init(bd_t *bi)
 	return 0;
 }
 #endif
+
+#ifdef CONFIG_GENERIC_ATMEL_MCI
+int board_mmc_init(bd_t *bd)
+{
+        /* This calls the atmel_mci_init in gen_atmel_mci.c */
+        return atmel_mci_init((void *)ATMEL_BASE_MMCI);
+
+}
+#endif
include/configs/atngw100.h +3 -1
index 8f9ed23..5e3155d 100644
@@ -128,7 +128,9 @@
 #define CONFIG_SYS_NR_PIOS			5
 #define CONFIG_SYS_HSDRAMC
 #define CONFIG_MMC
-#define CONFIG_ATMEL_MCI
+#define CONFIG_GENERIC_ATMEL_MCI
+#define CONFIG_GENERIC_MMC
+#define CONFIG_SYS_MMC_MAX_BLK_COUNT 1
 #define CONFIG_ATMEL_SPI
 
 #define CONFIG_SPI_FLASH
include/configs/atstk1002.h +3 -1
index 44ce242..bb426f1 100644
@@ -151,7 +151,9 @@
 #define CONFIG_SYS_NR_PIOS			5
 #define CONFIG_SYS_HSDRAMC
 #define CONFIG_MMC
-#define CONFIG_ATMEL_MCI
+#define CONFIG_GENERIC_ATMEL_MCI
+#define CONFIG_GENERIC_MMC
+#define CONFIG_SYS_MMC_MAX_BLK_COUNT 1
 
 #define CONFIG_SYS_DCACHE_LINESZ		32
 #define CONFIG_SYS_ICACHE_LINESZ		32
include/configs/atstk1003.h +2 -1
index c5e357f..a426f15 100644
@@ -135,7 +135,8 @@
 #define CONFIG_PORTMUX_PIO
 #define CONFIG_SYS_HSDRAMC
 #define CONFIG_MMC
-#define CONFIG_ATMEL_MCI
+#define CONFIG_GENERIC_ATMEL_MCI
+#define CONFIG_GENERIC_MMC
 
 #define CONFIG_SYS_DCACHE_LINESZ		32
 #define CONFIG_SYS_ICACHE_LINESZ		32
include/configs/atstk1004.h +3 -1
index 3814732..1b4a1af 100644
@@ -135,7 +135,9 @@
 #define CONFIG_PORTMUX_PIO
 #define CONFIG_SYS_HSDRAMC
 #define CONFIG_MMC
-#define CONFIG_ATMEL_MCI
+#define CONFIG_GENERIC_ATMEL_MCI
+#define CONFIG_GENERIC_MMC
+#define CONFIG_SYS_MMC_MAX_BLK_COUNT 1
 
 #define CONFIG_SYS_DCACHE_LINESZ		32
 #define CONFIG_SYS_ICACHE_LINESZ		32
include/configs/atstk1006.h +3 -1
index a30aa70..29fdd12 100644
@@ -151,7 +151,9 @@
 #define CONFIG_SYS_NR_PIOS			5
 #define CONFIG_SYS_HSDRAMC
 #define CONFIG_MMC
-#define CONFIG_ATMEL_MCI
+#define CONFIG_GENERIC_ATMEL_MCI
+#define CONFIG_GENERIC_MMC
+#define CONFIG_SYS_MMC_MAX_BLK_COUNT 1
 
 #define CONFIG_SYS_DCACHE_LINESZ		32
 #define CONFIG_SYS_ICACHE_LINESZ		32
include/configs/favr-32-ezkit.h +2 -1
index 757636d..1c8da9f 100644
@@ -150,7 +150,8 @@
 #define CONFIG_SYS_NR_PIOS			5
 #define CONFIG_SYS_HSDRAMC
 #define CONFIG_MMC
-#define CONFIG_ATMEL_MCI
+#define CONFIG_GENERIC_ATMEL_MCI
+#define CONFIG_GENERIC_MMC
 
 #define CONFIG_SYS_DCACHE_LINESZ		32
 #define CONFIG_SYS_ICACHE_LINESZ		32
include/configs/hammerhead.h +2 -1
index 94e680c..5570bdb 100644
@@ -124,7 +124,8 @@
 #define CONFIG_SYS_NR_PIOS			5
 #define CONFIG_SYS_HSDRAMC
 #define CONFIG_MMC
-#define CONFIG_ATMEL_MCI
+#define CONFIG_GENERIC_ATMEL_MCI
+#define CONFIG_GENERIC_MMC
 
 #define CONFIG_SYS_DCACHE_LINESZ		32
 #define CONFIG_SYS_ICACHE_LINESZ		32
include/configs/mimc200.h +2 -1
index d8d8256..8031a05 100644
@@ -129,7 +129,8 @@
 #define CONFIG_SYS_NR_PIOS			5
 #define CONFIG_SYS_HSDRAMC
 #define CONFIG_MMC
-#define CONFIG_ATMEL_MCI
+#define CONFIG_GENERIC_ATMEL_MCI
+#define CONFIG_GENERIC_MMC
 
 #if defined(CONFIG_LCD)
 #define CONFIG_CMD_BMP
include/mmc.h +0 -1
index 53aff9b..2607b4f 100644
@@ -316,7 +316,6 @@ int board_mmc_getcd(u8 *cd, struct mmc *mmc);
 int mmc_switch_part(int dev_num, unsigned int part_num);
 
 #ifdef CONFIG_GENERIC_MMC
-int atmel_mci_init(void *regs);
 #define mmc_host_is_spi(mmc)	((mmc)->host_caps & MMC_MODE_SPI)
 struct mmc *mmc_spi_init(uint bus, uint cs, uint speed, uint mode);
 #else
Signature · 1 line
1.7.6.3
#2 lore raw

PATCH 1/2 AVR32: use generic mmc framework

Dear Sven,

Am 12.10.2011 15:09, schrieb Sven Schnelle:

Quoted 5 lines

gen_atmel_mci works on AVR32 as well, so no need to use the legacy mmc driver. This also has the nice side effect of being able to use SDHC cards an AVR32 boards.

I have to NACK this patch cause it produces new compile warnings.

$ PATH=$AVR32_PATH:$PATH BUILD_DIR=/tmp/build_uboot BUILD_NCPU=8
./MAKEALL atstk1002
Configuring for atstk1002 board...
board.c: In function 'board_init_r':
board.c:338: warning: implicit declaration of function 'mmc_initialize'
atstk1000.c: In function 'board_mmc_init':
atstk1000.c:147: warning: implicit declaration of function 'atmel_mci_init'
   text	   data	    bss	    dec	    hex	filename
 106091	   7504	 211676	 325271	  4f697	/tmp/build_uboot/u-boot

--------------------- SUMMARY ---------------------------- Boards compiled: 1
Boards with warnings or errors: 1 ( atstk1002 )
----------------------------------------------------------

And does not work on device:

a) mmc init is not known? Is this not longer necessary?

---8<---
U-Boot> mmc init
Unknown command 'mmc' - try 'help'
U-Boot> mmc help
mmc - MMC sub system

Usage:
mmc read addr blk# cnt
mmc write addr blk# cnt
mmc erase blk# cnt
mmc rescan
mmc part - lists available partition on current mmc device mmc dev [dev] [part] - show or set current mmc device [partition] mmc list - lists available devices
U-Boot>
--->8---

b) ext2ls is not reliable:

---8<---
U-Boot> ext2ls mmc 0:1
<DIR> 1024 .
<DIR> 1024 ..
<DIR> 12288 lost+found
gen_atmel_mci: CMDR 00051051 (17) ARGR 02008600 (SR: 00400025) Data Transfer Failed
** ext2fs_devread read error - last part
U-Boot>
--->8---

best regards

Andreas Bie?mann

#3 lore raw

PATCH 1/2 AVR32: use generic mmc framework

Quoted 10 lines · Andreas Bie?mann

Dear Sven,

Am 12.10.2011 15:09, schrieb Sven Schnelle:

Quoted 5 lines

gen_atmel_mci works on AVR32 as well, so no need to use the legacy mmc driver. This also has the nice side effect of being able to use SDHC cards an AVR32 boards.

I have to NACK this patch cause it produces new compile warnings.

Quoted 9 lines
$ PATH=$AVR32_PATH:$PATH BUILD_DIR=/tmp/build_uboot BUILD_NCPU=8
./MAKEALL atstk1002
Configuring for atstk1002 board...
board.c: In function 'board_init_r':
board.c:338: warning: implicit declaration of function 'mmc_initialize'
atstk1000.c: In function 'board_mmc_init':
atstk1000.c:147: warning: implicit declaration of function 'atmel_mci_init'
    text	   data	    bss	    dec	    hex	filename
  106091	   7504	 211676	 325271	  4f697	/tmp/build_uboot/u-boot

Oops. Should be easily fixable.

Quoted 8 lines

--------------------- SUMMARY ---------------------------- Boards compiled: 1
Boards with warnings or errors: 1 ( atstk1002 )
----------------------------------------------------------

And does not work on device:

a) mmc init is not known? Is this not longer necessar

'mmc init' is only available if CONFIG_GENERIC_MMC isn't set, at least that's how i unterstand the source code. (See common/cmd_mmc.c:29)

Quoted 12 lines

b) ext2ls is not reliable:

---8<---
U-Boot> ext2ls mmc 0:1
<DIR> 1024 .
<DIR> 1024 ..
<DIR> 12288 lost+found
gen_atmel_mci: CMDR 00051051 (17) ARGR 02008600 (SR: 00400025) Data Transfer Failed
** ext2fs_devread read error - last part
U-Boot>
--->8---

Hmm, that's really bad. What type of card is this? MMC, SD or SDHC?

Regards
Sven

#4 lore raw

PATCH 1/2 AVR32: use generic mmc framework

Dear Sven,

Am 12.10.2011 16:51, schrieb Sven Schnelle:

Quoted 4 lines · Andreas Bie?mann
Quoted 3 lines

Dear Sven,

Am 12.10.2011 15:09, schrieb Sven Schnelle:

<snip>

Quoted 5 lines
Quoted 3 lines

And does not work on device:

a) mmc init is not known? Is this not longer necessar

'mmc init' is only available if CONFIG_GENERIC_MMC isn't set, at least that's how i unterstand the source code. (See common/cmd_mmc.c:29)

I see, my fault. Didn't know about this new framework.

Quoted 12 lines
Quoted 12 lines

b) ext2ls is not reliable:

---8<---
U-Boot> ext2ls mmc 0:1
<DIR> 1024 .
<DIR> 1024 ..
<DIR> 12288 lost+found
gen_atmel_mci: CMDR 00051051 (17) ARGR 02008600 (SR: 00400025) Data Transfer Failed
** ext2fs_devread read error - last part
U-Boot>
--->8---

Quoted 1 line

Hmm, that's really bad. What type of card is this? MMC, SD or SDHC?

It is SD card (the one delivered with my atstk1002, there is an Atmel label on it ;).

When initialising mmc with old atmel_mci driver I get this:

---8<---
U-Boot> mmc init

Manufacturer ID:       03
OEM/Application ID:    5344
Product name:          SD128
Product Revision:      5.8
Product Serial Number: 8227719
Manufacturing Date:    06/03
SD Card detected (RCA 58916)
CSD data: 00260032 1f5983c0 fefa4fff 924040ab
CSD structure version:   1.0
MMC System Spec version: 0
Card command classes:    1f5
Read block length:       512

Supports partial reads
Write block length: 512
Does not support partial writes
Supports group WP: 32
Card capacity: 125960192 bytes
File format: 0/0
Write protection:
mmc: Using 131072 cycles data timeout (DTOR=0x62)
.mmc1 is available
--->8---

best regards

Andreas Bie?mann

#5 lore raw

PATCH 1/2 AVR32: use generic mmc framework

Quoted 31 lines · Andreas Bie?mann

b) ext2ls is not reliable:

Quoted 11 lines
Quoted 10 lines

---8<---
U-Boot> ext2ls mmc 0:1
<DIR> 1024 .
<DIR> 1024 ..
<DIR> 12288 lost+found
gen_atmel_mci: CMDR 00051051 (17) ARGR 02008600 (SR: 00400025) Data Transfer Failed
** ext2fs_devread read error - last part
U-Boot>
--->8---

Hmm, that's really bad. What type of card is this? MMC, SD or SDHC?

It is SD card (the one delivered with my atstk1002, there is an Atmel label on it ;).

When initialising mmc with old atmel_mci driver I get this:

---8<---
U-Boot> mmc init

Manufacturer ID:       03
OEM/Application ID:    5344
Product name:          SD128
Product Revision:      5.8
Product Serial Number: 8227719
Manufacturing Date:    06/03
SD Card detected (RCA 58916)
CSD data: 00260032 1f5983c0 fefa4fff 924040ab
CSD structure version:   1.0
MMC System Spec version: 0
Card command classes:    1f5
Read block length:       512
Quoted 11 lines

Supports partial reads
Write block length: 512
Does not support partial writes
Supports group WP: 32
Card capacity: 125960192 bytes
File format: 0/0
Write protection:
mmc: Using 131072 cycles data timeout (DTOR=0x62)
.mmc1 is available
--->8---

Thanks for the Info Andreas. Do you have some other SD/SDHC cards handy? would be interesting if it doesn't work at all on your Board, or if this is an card
specific issue...

Regards
Sven

#6 lore raw

PATCH 1/2 AVR32: use generic mmc framework

Dear Sven,

Am 12.10.2011 17:08, schrieb Sven Schnelle:

Quoted 44 lines · Andreas Bie?mann
Quoted 37 lines

b) ext2ls is not reliable:

Quoted 11 lines
Quoted 10 lines

---8<---
U-Boot> ext2ls mmc 0:1
<DIR> 1024 .
<DIR> 1024 ..
<DIR> 12288 lost+found
gen_atmel_mci: CMDR 00051051 (17) ARGR 02008600 (SR: 00400025) Data Transfer Failed
** ext2fs_devread read error - last part
U-Boot>
--->8---

Hmm, that's really bad. What type of card is this? MMC, SD or SDHC?

It is SD card (the one delivered with my atstk1002, there is an Atmel label on it ;).

When initialising mmc with old atmel_mci driver I get this:

---8<---
U-Boot> mmc init

Manufacturer ID:       03
OEM/Application ID:    5344
Product name:          SD128
Product Revision:      5.8
Product Serial Number: 8227719
Manufacturing Date:    06/03
SD Card detected (RCA 58916)
CSD data: 00260032 1f5983c0 fefa4fff 924040ab
CSD structure version:   1.0
MMC System Spec version: 0
Card command classes:    1f5
Read block length:       512
Supports partial reads
Write block length:      512
Does not support partial writes
Supports group WP:      32
Card capacity:        125960192 bytes
File format:            0/0
Quoted 5 lines

Write protection:
mmc: Using 131072 cycles data timeout (DTOR=0x62)
.mmc1 is available
--->8---

Quoted 4 lines

Thanks for the Info Andreas. Do you have some other SD/SDHC cards handy? would be interesting if it doesn't work at all on your Board, or if this is an card
specific issue...

at least one other SD Card works:

---8<---
U-Boot> mmc part

Partition Map for MMC device 0 -- Partition Type: DOS

Partition Start Sector Num Sectors Type

    1		       247	   1995529	 6
U-Boot> mmc list
mci: 0
U-Boot> fatls mmc 0
 11323605   ms-avr-svn4980.sh
 11327707   ms-avr-svn4982-dirty.sh
 11327707   ms-avr-svn4983-dirty.sh
 11323605   ms-avr-svn4985.sh
  1437538   uimage-svn4985-dirty.bin
 11327701   ms-avr-svn4988.sh
 10541275   ms-avr-svn4990-dirty.sh
            1000/
    43229   ms-update-dsp-svn4981.sh
    22749   ms-update-msp-svn4986.sh
    43230   ms-update-lpc-svn4990.sh
    22749   ms-update-msp-svn5000.sh
    43229   ms-update-dsp-svn4996.sh
 10541275   ms-update-avr-svn5000-dirty.sh
    43217   ms-dsp-test.sh
    43229   ms-update-dsp-svn5005.sh
 10586518   ms-qe11-test.sh
      839   ecg-raw2-20111010-122711.dat
      164   ecg-raw2-20111010-130305.dat
    99944   ecg-raw1-20111010-131651.dat
  6607604   ecg-raw2-20111010-134759.dat
   906959   ecg-raw2-20111010-141628.dat
  1601399   ecg-raw2-20111010-151814.dat
 10586518   ms-qe11.sh
 10488027   ms-update-avr-svn5019-dirty.sh

24 file(s), 1 dir(s)

--->8---

best regards

Andreas Bie?mann

#7 lore raw

PATCH 1/2 AVR32: use generic mmc framework

Hi all,

Am 12.10.2011 17:18, schrieb Andreas Bie?mann:

Quoted 47 lines

Dear Sven,

Am 12.10.2011 17:08, schrieb Sven Schnelle:

Quoted 44 lines · Andreas Bie?mann
Quoted 42 lines

b) ext2ls is not reliable:

Quoted 11 lines
Quoted 10 lines

---8<---
U-Boot> ext2ls mmc 0:1
<DIR> 1024 .
<DIR> 1024 ..
<DIR> 12288 lost+found
gen_atmel_mci: CMDR 00051051 (17) ARGR 02008600 (SR: 00400025) Data Transfer Failed
** ext2fs_devread read error - last part
U-Boot>
--->8---

Hmm, that's really bad. What type of card is this? MMC, SD or SDHC?

It is SD card (the one delivered with my atstk1002, there is an Atmel label on it ;).

When initialising mmc with old atmel_mci driver I get this:

---8<---
U-Boot> mmc init

Manufacturer ID:       03
OEM/Application ID:    5344
Product name:          SD128
Product Revision:      5.8
Product Serial Number: 8227719
Manufacturing Date:    06/03
SD Card detected (RCA 58916)
CSD data: 00260032 1f5983c0 fefa4fff 924040ab
CSD structure version:   1.0
MMC System Spec version: 0
Card command classes:    1f5
Read block length:       512
Supports partial reads
Write block length:      512
Does not support partial writes
Supports group WP:      32
Card capacity:        125960192 bytes
File format:            0/0

Write protection:
mmc: Using 131072 cycles data timeout (DTOR=0x62)
.mmc1 is available
--->8---

Quoted 6 lines
Quoted 4 lines

Thanks for the Info Andreas. Do you have some other SD/SDHC cards handy? would be interesting if it doesn't work at all on your Board, or if this is an card
specific issue...

at least one other SD Card works:

to sum it up:
* it is a timeout issue
* the timeout in gen_atmel_mci is set to a fixed value which is way to small for my combination of card and bus-clock

best regards

Andreas Bie?mann

#8 lore raw

PATCH 1/2 AVR32: use generic mmc framework

In reply to Andreas Bießmann
Quoted 49 lines · Andreas Bie?mann

Am 12.10.2011 16:51, schrieb Sven Schnelle:

Quoted 16 lines · Andreas Bie?mann
Quoted 5 lines

Am 12.10.2011 15:09, schrieb Sven Schnelle:
And does not work on device:

b) ext2ls is not reliable:

Quoted 10 lines

---8<---
U-Boot> ext2ls mmc 0:1
<DIR> 1024 .
<DIR> 1024 ..
<DIR> 12288 lost+found
gen_atmel_mci: CMDR 00051051 (17) ARGR 02008600 (SR: 00400025) Data Transfer Failed
** ext2fs_devread read error - last part
U-Boot>
--->8---

Quoted 1 line

Hmm, that's really bad. What type of card is this? MMC, SD or SDHC?

It is SD card (the one delivered with my atstk1002, there is an Atmel label on it ;).

When initialising mmc with old atmel_mci driver I get this:

---8<---
U-Boot> mmc init

Manufacturer ID:       03
OEM/Application ID:    5344
Product name:          SD128
Product Revision:      5.8
Product Serial Number: 8227719
Manufacturing Date:    06/03
SD Card detected (RCA 58916)
CSD data: 00260032 1f5983c0 fefa4fff 924040ab
CSD structure version:   1.0
MMC System Spec version: 0
Card command classes:    1f5
Read block length:       512

Supports partial reads
Write block length: 512
Does not support partial writes
Supports group WP: 32
Card capacity: 125960192 bytes
File format: 0/0
Write protection:
mmc: Using 131072 cycles data timeout (DTOR=0x62)
.mmc1 is available
--->8---

Quoted 3 lines

best regards

Andreas Bie?mann

I've just tried all SD cards i have here, which are in particular:

Noname 32GB SDHC: works
'PLATINUM' 4GB SDHC: works
Sandisk 2GB SD: works
Sandisk 2GB Micro SD: works

So this seems to be an issue with the specific card - it would be nice if you could enable CONFIG_MMC_TRACE, and send me the output.

Regards

Sven

#9 lore raw

PATCH 1/2 AVR32: use generic mmc framework

In reply to Sven Schnelle

Dear Sven Schnelle,

Quoted 4 lines · In message <[email protected]> you wrote:
Quoted 2 lines

a) mmc init is not known? Is this not longer necessar

'mmc init' is only available if CONFIG_GENERIC_MMC isn't set, at least that's how i unterstand the source code. (See common/cmd_mmc.c:29)

Argh. No, we will not allow different implementations / feature sets.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Unser Kopf ist rund, damit das Denken die Richtung wechseln kann.
                                                   -- Francis Picabia
#10 lore raw

PATCH 1/2 AVR32: use generic mmc framework

Hi Wolfgang,

Quoted 9 lines · Wolfgang Denk

Dear Sven Schnelle,

Quoted 4 lines · In message<[email protected]> you wrote:
Quoted 2 lines

a) mmc init is not known? Is this not longer necessar

'mmc init' is only available if CONFIG_GENERIC_MMC isn't set, at least that's how i unterstand the source code. (See common/cmd_mmc.c:29)

Argh. No, we will not allow different implementations / feature sets.

Can you please explain that statement? Actually i have no idea what you're trying to say.

Regards
Sven

#11 lore raw

PATCH 2/2 AVR32: remove old atmel_mci driver

In reply to Sven Schnelle

And while at it, rename gen_atmel_mci.c to atmel_mci.c and replace CONFIG_GENERIC_ATMEL_MCI with CONFIG_ATMEL_MCI.

---
 arch/arm/cpu/arm926ejs/at91/at91sam9260_devices.c |    2 +-
 arch/avr32/lib/board.c                            |    2 +-
 board/atmel/atngw100/atngw100.c                   |    2 +-
 board/atmel/atstk1000/atstk1000.c                 |    2 +-
 board/emk/top9000/top9000.c                       |    2 +-
 doc/README.atmel_mci                              |    8 +-
 drivers/mmc/Makefile                              |    3 +-
 drivers/mmc/atmel_mci.c                           |  691 ++++++++-------------
 drivers/mmc/gen_atmel_mci.c                       |  356 -----------
 include/configs/atngw100.h                        |    2 +-
 include/configs/atstk1002.h                       |    2 +-
 include/configs/atstk1003.h                       |    2 +-
 include/configs/atstk1004.h                       |    2 +-
 include/configs/atstk1006.h                       |    2 +-
 include/configs/favr-32-ezkit.h                   |    2 +-
 include/configs/hammerhead.h                      |    2 +-
 include/configs/mimc200.h                         |    2 +-
 include/configs/top9000.h                         |    2 +-
 18 files changed, 276 insertions(+), 810 deletions(-)
 delete mode 100644 drivers/mmc/gen_atmel_mci.c
arch/arm/cpu/arm926ejs/at91/at91sam9260_devices.c +1 -1
index 65b8d51..9fc94df 100644
@@ -196,7 +196,7 @@ void at91_macb_hw_init(void)
 }
 #endif
 
-#if defined(CONFIG_ATMEL_MCI) || defined(CONFIG_GENERIC_ATMEL_MCI)
+#if defined(CONFIG_ATMEL_MCI) || defined(CONFIG_ATMEL_MCI)
 void at91_mci_hw_init(void)
 {
 	at91_set_a_periph(AT91_PIO_PORTA, 8, 1);	/* MCCK */
arch/avr32/lib/board.c +1 -1
index 694755c..131b9bf 100644
@@ -334,7 +334,7 @@ void board_init_r(gd_t *new_gd, ulong dest_addr)
 	eth_initialize(gd->bd);
 #endif
 
-#ifdef CONFIG_GENERIC_ATMEL_MCI
+#ifdef CONFIG_ATMEL_MCI
 	mmc_initialize(gd->bd);
 #endif
 	for (;;) {
board/atmel/atngw100/atngw100.c +1 -1
index af22403..194f465 100644
@@ -140,7 +140,7 @@ void spi_cs_deactivate(struct spi_slave *slave)
 }
 #endif /* CONFIG_ATMEL_SPI */
 
-#ifdef CONFIG_GENERIC_ATMEL_MCI
+#ifdef CONFIG_ATMEL_MCI
 int board_mmc_init(bd_t *bd)
 {
         /* This calls the atmel_mci_init in gen_atmel_mci.c */
board/atmel/atstk1000/atstk1000.c +1 -1
index 93f8e43..6885e09 100644
@@ -140,7 +140,7 @@ int board_eth_init(bd_t *bi)
 }
 #endif
 
-#ifdef CONFIG_GENERIC_ATMEL_MCI
+#ifdef CONFIG_ATMEL_MCI
 int board_mmc_init(bd_t *bd)
 {
         /* This calls the atmel_mci_init in gen_atmel_mci.c */
board/emk/top9000/top9000.c +1 -1
index 61dee62..11f0e97 100644
@@ -91,7 +91,7 @@ static void macb_hw_init(void)
 }
 #endif
 
-#ifdef CONFIG_GENERIC_ATMEL_MCI
+#ifdef CONFIG_ATMEL_MCI
 /* this is a weak define that we are overriding */
 int board_mmc_init(bd_t *bd)
 {
doc/README.atmel_mci +4 -4
index dee0cf0..cd995dc 100644
@@ -20,7 +20,7 @@ board/SoC specific manner before the driver is initialized:
 
 example: this is added to at91sam9260_devices.c:
 
-#if defined(CONFIG_ATMEL_MCI) || defined(CONFIG_GENERIC_ATMEL_MCI)
+#if defined(CONFIG_ATMEL_MCI) || defined(CONFIG_ATMEL_MCI)
 void at91_mci_hw_init(void)
 {
 	at91_set_a_periph(AT91_PIO_PORTA, 8, PUP);	/* MCCK */
@@ -42,11 +42,11 @@ void at91_mci_hw_init(void)
 
 the board specific file need added:
 ...
-#ifdef CONFIG_GENERIC_ATMEL_MCI
+#ifdef CONFIG_ATMEL_MCI
 # include <mmc.h>
 #endif
 ...
-#ifdef CONFIG_GENERIC_ATMEL_MCI
+#ifdef CONFIG_ATMEL_MCI
 /* this is a weak define that we are overriding */
 int board_mmc_init(bd_t *bd)
 {
@@ -79,7 +79,7 @@ and the board definition files needs:
 /* SD/MMC card */
 #define CONFIG_MMC			1
 #define CONFIG_GENERIC_MMC		1
-#define CONFIG_GENERIC_ATMEL_MCI	1
+#define CONFIG_ATMEL_MCI	1
 #define CONFIG_ATMEL_MCI_PORTB		1	/* Atmel XE-EK uses port B */
 #define CONFIG_SYS_MMC_CD_PIN		AT91_PIN_PC9
 #define CONFIG_CMD_MMC			1
drivers/mmc/Makefile +1 -2
index 6e94860..9ae5f53 100644
@@ -25,13 +25,12 @@ include $(TOPDIR)/config.mk
 
 LIB	:= $(obj)libmmc.o
 
-COBJS-$(CONFIG_ATMEL_MCI) += atmel_mci.o
 COBJS-$(CONFIG_BFIN_SDH) += bfin_sdh.o
 COBJS-$(CONFIG_DAVINCI_MMC) += davinci_mmc.o
 COBJS-$(CONFIG_FSL_ESDHC) += fsl_esdhc.o
 COBJS-$(CONFIG_FTSDC010) += ftsdc010_esdhc.o
 COBJS-$(CONFIG_GENERIC_MMC) += mmc.o
-COBJS-$(CONFIG_GENERIC_ATMEL_MCI) += gen_atmel_mci.o
+COBJS-$(CONFIG_ATMEL_MCI) += atmel_mci.o
 COBJS-$(CONFIG_MMC_SPI) += mmc_spi.o
 COBJS-$(CONFIG_ARM_PL180_MMCI) += arm_pl180_mmci.o
 COBJS-$(CONFIG_MV_SDHCI) += mv_sdhci.o
drivers/mmc/atmel_mci.c +257 -434

783 lines not on this page · raw message

drivers/mmc/gen_atmel_mci.c deleted +0 -356

356 lines not on this page · raw message

include/configs/atngw100.h +1 -1
index 5e3155d..7775697 100644
@@ -128,7 +128,7 @@
 #define CONFIG_SYS_NR_PIOS			5
 #define CONFIG_SYS_HSDRAMC
 #define CONFIG_MMC
-#define CONFIG_GENERIC_ATMEL_MCI
+#define CONFIG_ATMEL_MCI
 #define CONFIG_GENERIC_MMC
 #define CONFIG_SYS_MMC_MAX_BLK_COUNT 1
 #define CONFIG_ATMEL_SPI
include/configs/atstk1002.h +1 -1
index bb426f1..793b43d 100644
@@ -151,7 +151,7 @@
 #define CONFIG_SYS_NR_PIOS			5
 #define CONFIG_SYS_HSDRAMC
 #define CONFIG_MMC
-#define CONFIG_GENERIC_ATMEL_MCI
+#define CONFIG_ATMEL_MCI
 #define CONFIG_GENERIC_MMC
 #define CONFIG_SYS_MMC_MAX_BLK_COUNT 1
 
include/configs/atstk1003.h +1 -1
index a426f15..8b485a1 100644
@@ -135,7 +135,7 @@
 #define CONFIG_PORTMUX_PIO
 #define CONFIG_SYS_HSDRAMC
 #define CONFIG_MMC
-#define CONFIG_GENERIC_ATMEL_MCI
+#define CONFIG_ATMEL_MCI
 #define CONFIG_GENERIC_MMC
 
 #define CONFIG_SYS_DCACHE_LINESZ		32
include/configs/atstk1004.h +1 -1
index 1b4a1af..5eb5ba0 100644
@@ -135,7 +135,7 @@
 #define CONFIG_PORTMUX_PIO
 #define CONFIG_SYS_HSDRAMC
 #define CONFIG_MMC
-#define CONFIG_GENERIC_ATMEL_MCI
+#define CONFIG_ATMEL_MCI
 #define CONFIG_GENERIC_MMC
 #define CONFIG_SYS_MMC_MAX_BLK_COUNT 1
 
include/configs/atstk1006.h +1 -1
index 29fdd12..958fdf5 100644
@@ -151,7 +151,7 @@
 #define CONFIG_SYS_NR_PIOS			5
 #define CONFIG_SYS_HSDRAMC
 #define CONFIG_MMC
-#define CONFIG_GENERIC_ATMEL_MCI
+#define CONFIG_ATMEL_MCI
 #define CONFIG_GENERIC_MMC
 #define CONFIG_SYS_MMC_MAX_BLK_COUNT 1
 
include/configs/favr-32-ezkit.h +1 -1
index 1c8da9f..b301f14 100644
@@ -150,7 +150,7 @@
 #define CONFIG_SYS_NR_PIOS			5
 #define CONFIG_SYS_HSDRAMC
 #define CONFIG_MMC
-#define CONFIG_GENERIC_ATMEL_MCI
+#define CONFIG_ATMEL_MCI
 #define CONFIG_GENERIC_MMC
 
 #define CONFIG_SYS_DCACHE_LINESZ		32
include/configs/hammerhead.h +1 -1
index 5570bdb..56b5ffe 100644
@@ -124,7 +124,7 @@
 #define CONFIG_SYS_NR_PIOS			5
 #define CONFIG_SYS_HSDRAMC
 #define CONFIG_MMC
-#define CONFIG_GENERIC_ATMEL_MCI
+#define CONFIG_ATMEL_MCI
 #define CONFIG_GENERIC_MMC
 
 #define CONFIG_SYS_DCACHE_LINESZ		32
include/configs/mimc200.h +1 -1
index 8031a05..d60eff4 100644
@@ -129,7 +129,7 @@
 #define CONFIG_SYS_NR_PIOS			5
 #define CONFIG_SYS_HSDRAMC
 #define CONFIG_MMC
-#define CONFIG_GENERIC_ATMEL_MCI
+#define CONFIG_ATMEL_MCI
 #define CONFIG_GENERIC_MMC
 
 #if defined(CONFIG_LCD)
include/configs/top9000.h +1 -1
index 2c66f33..d2b8b9a 100644
@@ -95,7 +95,7 @@
 /* SD/MMC card */
 #define CONFIG_MMC
 #define CONFIG_GENERIC_MMC
-#define CONFIG_GENERIC_ATMEL_MCI
+#define CONFIG_ATMEL_MCI
 #define CONFIG_SYS_MMC_CD_PIN		AT91_PIN_PC9
 #define CONFIG_CMD_MMC
 
Signature · 1 line
1.7.6.3
#12 lore raw

PATCH 1/1 AVR32: switch to generic mmc framework

In reply to Sven Schnelle

Dear Sven Schnelle,

Quoted 6 lines

Hi List,

these patches switch all AVR32 boards to the generic MMC framework. Motivation for doing so is to be able to boot from SDHC cards. The second patch removes the legacy atmel_mci driver, as it is no longer used by any board.

Quoted 6 lines

I've only tried this code on the Atmel ATNGW100, as i have no other AVR32 boards. Would be great if some other users could try that patch on different platforms.

It seems like the gen_atmel_mci driver doesn't work with Multible Block transfer on AVR32, but the old code didn't used that mode either. So that's something for the TODO list for future improvements.

1. your patch title is misleading, because it also affects the AT91 architecture. use AVR32 when patches affect avr32 only
use AT91 when patches affect at91 only
use ATMEL when patches affect generic Atmel stuff
2. you should use the git rename feature to rename files

As I see it, all this should come as three patches:

1. switching *all* AVR32 and AT91 boards to use the *existing* generic driver

2. removal of the now obsolete legacy driver

3. renaming the existing generic driver into the old legacy name (this is a pure cosmetic act)

I would tend to dispute whether 3. is really necessary and beneficial

Best Regards
Reinhard

#13 lore raw

PATCH 1/1 AVR32: switch to generic mmc framework

Dear Reinhard,
Dear Sven,

Am 12.10.2011 19:01, schrieb Reinhard Meyer:

Quoted 3 lines

Dear Sven Schnelle,

Quoted 2 lines

Hi List,

<snip>

Quoted 10 lines

As I see it, all this should come as three patches:

1. switching *all* AVR32 and AT91 boards to use the *existing* generic driver

2. removal of the now obsolete legacy driver

3. renaming the existing generic driver into the old legacy name (this is a pure cosmetic act)

I would tend to dispute whether 3. is really necessary and beneficial

Now that Reinhard brings this up I would also say the name gen_atmel_mci is better than atmel_mci here cause it implements the GENERIC_MMC framework. So I guess it would be best to have again two patches:
1. switch all AVR32 (and AT91, if there are still some) to gen_atmel_mci
2. remove legacy atmel_mci (but no renaming)

But before applying I would like to dig into my issue with the special card. So maybe do 1) immediately and 2) later, I don't think I will get the issue til merge window is closed and maybe not until final release 2011.12.

best regards

Andreas Bie?mann