ATMEL: switch atmel_mci users to gen_atmel_mci
Subsystems (3)
PATCH v2 1/1 ATMEL: switch atmel_mci users to gen_atmel_mci
Hi List,
this is the second iteration of my patches to switch ATMEL tagets using atmel_mci to gen_atmel_mci.
Changes against v1:
- fix warnings during build
- don't rename gen_atmel_mci to atmel_mci
Regards
Sven
PATCH 1/2 ATMEL: 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 those boards.
--- arch/avr32/lib/board.c | 6 + board/atmel/atngw100/atngw100.c | 10 ++ board/atmel/atstk1000/atstk1000.c | 10 ++ drivers/mmc/atmel_mci.h | 245 ------------------------------------ include/atmel_mci.h | 247 +++++++++++++++++++++++++++++++++++++ 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 - 14 files changed, 293 insertions(+), 254 deletions(-) delete mode 100644 drivers/mmc/atmel_mci.h create mode 100644 include/atmel_mci.h
arch/avr32/lib/board.c +6 -0
@@ -37,6 +37,9 @@#define CONFIG_IDENT_STRING ""#endif +#ifdef CONFIG_ATMEL_MCI +#include <mmc.h> +#endif DECLARE_GLOBAL_DATA_PTR ;unsigned long monitor_flash_len;
@@ -334,6 +337,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 +10 -0
@@ -29,6 +29,7 @@#include <asm/arch/mmu.h> #include <asm/arch/portmux.h> #include <netdev.h> +#include <atmel_mci.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -139,3 +140,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 +10 -0
@@ -28,6 +28,7 @@#include <asm/arch/mmu.h> #include <asm/arch/portmux.h> #include <netdev.h> +#include <atmel_mci.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -139,3 +140,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
drivers/mmc/atmel_mci.h deleted +0 -245
245 lines not on this page · raw message
include/atmel_mci.h new file +247 -0
247 lines not on this page · raw message
include/configs/atngw100.h +3 -1
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
PATCH 1/2 ATMEL: use generic mmc framework
Dear Sven,
Quoted 15 lines · Sven Schnelle
gen_atmel_mciworks 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 those boards.Signed-off-by Sven Schnelle <[email protected]>--- arch/avr32/lib/board.c | 6 + board/atmel/atngw100/atngw100.c | 10 ++ board/atmel/atstk1000/atstk1000.c | 10 ++ drivers/mmc/atmel_mci.h | 245 ------------------------------------ include/atmel_mci.h | 247 +++++++++++++++++++++++++++++++++++++ include/configs/atngw100.h | 4 +- include/configs/atstk1002.h | 4 +- include/configs/atstk1003.h | 3 +- include/configs/atstk1004.h | 4 +-
Quoted 8 lines
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 - 14 files changed, 293 insertions(+), 254 deletions(-) delete mode 100644 drivers/mmc/atmel_mci.h create mode 100644 include/atmel_mci.h
I did test this driver and decided to apply it now to u-boot-avr32 but unfortunately there is one final issue. You switched all avr32 boards to the generic driver by changing the board includes but missed the necessary 'int board_mmc_init(bd_t *bd)' in some boards (namely mimc200, hammerhead and favr-32-ezkit).
I guess you can not react suddenly on this mail and I'd like to apply it now. Therefore I will modify this patch and provide a weak 'int board_mmc_init(bd_t *bd)' in board.c.
regards
Andreas Bie?mann
PATCH v3 1/1 ATMEL: use generic mmc framework
From: Sven Schnelle <[email protected]>
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 those boards.
---
changes since v2:
* remove board_mmc_init in atstk100x and atngw100 files in favour of cpu_mmc_init
* add cpu_mmc_init to arch/avr32/lib/board.c
* add CONFIG_SYS_MMC_MAX_BLK_COUNT 1 to _every_ changed board config
* replace 'mmcinit' by 'mmc rescan' in provided environment
arch/avr32/lib/board.c | 15 +++++++++++++++
{drivers/mmc => include}/atmel_mci.h | 8 +++++---
include/configs/atngw100.h | 4 +++-
include/configs/atstk1002.h | 4 +++-
include/configs/atstk1003.h | 5 +++--
include/configs/atstk1004.h | 6 ++++--
include/configs/atstk1006.h | 4 +++-
include/configs/favr-32-ezkit.h | 4 +++-
include/configs/hammerhead.h | 4 +++-
include/configs/mimc200.h | 4 +++-
include/mmc.h | 1 -
11 files changed, 45 insertions(+), 14 deletions(-)
rename {drivers/mmc => include}/atmel_mci.h (98%)arch/avr32/lib/board.c +15 -0
@@ -25,6 +25,7 @@#include <stdio_dev.h> #include <version.h> #include <net.h> +#include <atmel_mci.h> #ifdef CONFIG_BITBANGMII #include <miiphy.h>
@@ -32,11 +33,15 @@#include <asm/sections.h> #include <asm/arch/mmu.h> +#include <asm/arch/hardware.h> #ifndef CONFIG_IDENT_STRING #define CONFIG_IDENT_STRING ""#endif +#ifdef CONFIG_ATMEL_MCI +#include <mmc.h> +#endif DECLARE_GLOBAL_DATA_PTR ;unsigned long monitor_flash_len;
@@ -49,6 +54,13 @@ static int __do_nothing(void)int board_postclk_init (void ) __attribute__((weak,alias ("__do_nothing" )));int board_early_init_r (void ) __attribute__((weak,alias ("__do_nothing" ))); +/* provide cpu_mmc_init, to overwrite provide board_mmc_init */ +int cpu_mmc_init (bd_t *bd) +{ +/* This calls the atmel_mci_init in gen_atmel_mci.c */ +return atmel_mci_init ((void *)ATMEL_BASE_MMCI ); +} +#ifdef CONFIG_SYS_DMA_ALLOC_LEN #include <asm/arch/cacheflush.h> #include <asm/io.h>
@@ -324,6 +336,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 (); }
include/atmel_mci.h renamed from drivers/mmc/atmel_mci.h +5 -3
@@ -19,8 +19,10 @@* Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA */ -#ifndef __CPU_AT32AP_ATMEL_MCI_H__ -#define __CPU_AT32AP_ATMEL_MCI_H__ +#ifndef __ATMEL_MCI_H__ +#define __ATMEL_MCI_H__ + +int atmel_mci_init (void *regs);#ifndef __ASSEMBLY__
@@ -242,4 +244,4 @@ typedef struct atmel_mci {#define mmci_writel (reg,value) \ writel((value), (void *)ATMEL_BASE_MMCI + MMCI_##reg) -#endif /* __CPU_AT32AP_ATMEL_MCI_H__ */ +#endif /* __ATMEL_MCI_H__ */
include/configs/atngw100.h +3 -1
@@ -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
@@ -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 +4 -2
@@ -100,7 +100,7 @@"console=ttyS0 root=/dev/mmcblk0p1 rootwait" #define CONFIG_BOOTCOMMAND \ -"mmcinit; ext2load mmc 0:1 0x10400000 /boot/uImage; bootm" +"mmc rescan; ext2load mmc 0:1 0x10400000 /boot/uImage; bootm" /* * Only interrupt autoboot if <space> is pressed. Otherwise, garbage
@@ -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/atstk1004.h +4 -2
@@ -100,7 +100,7 @@"console=ttyS0 root=/dev/mmcblk0p1 rootwait" #define CONFIG_BOOTCOMMAND \ -"mmcinit; ext2load mmc 0:1 0x10200000 /boot/uImage; bootm" +"mmc rescan; ext2load mmc 0:1 0x10200000 /boot/uImage; bootm" /* * Only interrupt autoboot if <space> is pressed. Otherwise, garbage
@@ -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
@@ -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 +3 -1
@@ -150,7 +150,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/hammerhead.h +3 -1
@@ -124,7 +124,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/mimc200.h +3 -1
@@ -129,7 +129,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#if defined(CONFIG_LCD )#define CONFIG_CMD_BMP
include/mmc.h +0 -1
@@ -322,7 +322,6 @@ int mmc_switch_part(int dev_num, unsigned int part_num);int mmc_getcd (struct mmc *mmc);#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.9.1
PATCH v3 1/1 ATMEL: use generic mmc framework
Quoted 16 lines · Andreas Bie?mann
From: Sven Schnelle <[email protected]>
gen_atmel_mciworks 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 those boards.Signed-off-by Sven Schnelle <[email protected]>Signed-off-by Andreas Bie?mann <[email protected]>---
changes since v2:
* removeboard_mmc_initin atstk100x and atngw100 files in favour ofcpu_mmc_init
* addcpu_mmc_inittoarch/avr32/lib/board.c
* addCONFIG_SYS_MMC_MAX_BLK_COUNT1 to _every_ changed board config
* replace 'mmcinit' by 'mmc rescan' in provided environment
Quoted 13 lines
arch/avr32/lib/board.c | 15 +++++++++++++++
{drivers/mmc => include}/atmel_mci.h | 8 +++++---
include/configs/atngw100.h | 4 +++-
include/configs/atstk1002.h | 4 +++-
include/configs/atstk1003.h | 5 +++--
include/configs/atstk1004.h | 6 ++++--
include/configs/atstk1006.h | 4 +++-
include/configs/favr-32-ezkit.h | 4 +++-
include/configs/hammerhead.h | 4 +++-
include/configs/mimc200.h | 4 +++-
include/mmc.h | 1 -
11 files changed, 45 insertions(+), 14 deletions(-)
rename {drivers/mmc => include}/atmel_mci.h (98%)applied to u-boot-avr32
PATCH 2/2 ATMEL: remove old atmel_mci driver
In reply to Sven SchnelleAll boards are using the gen_atmel_mci driver now, so no need to carry the old driver around.
--- arch/arm/cpu/arm926ejs/at91/at91sam9260_devices.c | 2 +- arch/avr32/lib/board.c | 2 +- doc/README.atmel_mci | 2 +- drivers/mmc/Makefile | 1 - drivers/mmc/atmel_mci.c | 533 --------------------- 5 files changed, 3 insertions(+), 537 deletions(-) delete mode 100644 drivers/mmc/atmel_mci.c
arch/arm/cpu/arm926ejs/at91/at91sam9260_devices.c +1 -1
@@ -196,7 +196,7 @@ void at91_macb_hw_init(void) }#endif -#if defined(CONFIG_ATMEL_MCI ) || defined(CONFIG_GENERIC_ATMEL_MCI ) +#if defined(CONFIG_GENERIC_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
@@ -37,7 +37,7 @@#define CONFIG_IDENT_STRING ""#endif -#ifdef CONFIG_ATMEL_MCI +#ifdef CONFIG_GENERIC_ATMEL_MCI #include <mmc.h> #endif DECLARE_GLOBAL_DATA_PTR ;
doc/README.atmel_mci +1 -1
@@ -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_GENERIC_ATMEL_MCI) void at91_mci_hw_init(void) { at91_set_a_periph(AT91_PIO_PORTA, 8, PUP); /* MCCK */
drivers/mmc/Makefile +0 -1
@@ -25,7 +25,6 @@ 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
drivers/mmc/atmel_mci.c deleted +0 -533
533 lines not on this page · raw message
Signature · 1 line
1.7.6.3
PATCH 2/2 ATMEL: remove old atmel_mci driver
Quoted 4 lines · Sven Schnelle
All boards are using the
gen_atmel_mcidriver now, so no need to carry the old driver around.Signed-off-by Sven Schnelle <[email protected]>
Quoted 8 lines
--- arch/arm/cpu/arm926ejs/at91/at91sam9260_devices.c | 2 +- arch/avr32/lib/board.c | 2 +- doc/README.atmel_mci | 2 +- drivers/mmc/Makefile | 1 - drivers/mmc/atmel_mci.c | 533 --------------------- 5 files changed, 3 insertions(+), 537 deletions(-) delete mode 100644 drivers/mmc/atmel_mci.c
applied to u-boot-avr32