diff options
author | Robert Rosengren <robert.rosengren@stericsson.com> | 2011-01-05 13:09:09 +0100 |
---|---|---|
committer | Michael BRANDT <michael.brandt@stericsson.com> | 2011-02-23 13:00:44 +0100 |
commit | e1ca4a4df367d4f64ef9254011d15a3ae14a98e0 (patch) | |
tree | b8fda2a659fcb8ab78c5419dc3b7998abd9ad3fb | |
parent | 029082880fb1684f132d5ad6102fa54af84f4207 (diff) |
U8500: Move MMC code into drivers
Moved mmc_host and mmc_fifo files into drivers.
board_mmc_init method is moved into u8500.c to be kept in board directory,
as different boards might use different setup of eMMCs. Introducing public
header in include directory for accessing necessary mmc_host-functions.
ST-Ericsson ID: None
ST-Ericsson FOSS-OUT ID: Trivial
Change-Id: Ifec7249a7e7282677b0bc7ced6c16ecaeadf0772
Signed-off-by: Robert Rosengren <robert.rosengren@stericsson.com>
Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/11900
Reviewed-by: Michael BRANDT <michael.brandt@stericsson.com>
Reviewed-by: Markus HELGESSON <markus.helgesson@stericsson.com>
-rw-r--r-- | board/st/u8500/Makefile | 6 | ||||
-rw-r--r-- | board/st/u8500/u8500.c | 57 | ||||
-rw-r--r-- | drivers/mmc/Makefile | 11 | ||||
-rw-r--r-- | drivers/mmc/u8500_mmc_fifo.S (renamed from board/st/u8500/mmc_fifo.S) | 4 | ||||
-rw-r--r-- | drivers/mmc/u8500_mmc_fifo.h (renamed from board/st/u8500/mmc_fifo.h) | 0 | ||||
-rw-r--r-- | drivers/mmc/u8500_mmc_host.c (renamed from board/st/u8500/mmc_host.c) | 64 | ||||
-rw-r--r-- | drivers/mmc/u8500_mmc_types.h (renamed from board/st/u8500/mmc_host.h) | 4 | ||||
-rw-r--r-- | include/configs/u8500.h | 1 | ||||
-rw-r--r-- | include/u8500_mmc_host.h | 17 |
9 files changed, 94 insertions, 70 deletions
diff --git a/board/st/u8500/Makefile b/board/st/u8500/Makefile index 26af32e76..248144e98 100644 --- a/board/st/u8500/Makefile +++ b/board/st/u8500/Makefile @@ -25,8 +25,7 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(BOARD).a -COBJS := u8500.o u8500_i2c.o mmc_host.o mmc_utils.o ab8500vibra.o cmd_cdump.o -SOBJS := mmc_fifo.o +COBJS := u8500.o u8500_i2c.o mmc_utils.o ab8500vibra.o cmd_cdump.o COBJS-$(CONFIG_VIDEO_LOGO) += mcde_display.o mcde_display_dsi.o mcde_display_dpi.o COBJS-$(CONFIG_VIDEO_LOGO) += mcde_hw.o mcde_display_image.o @@ -35,9 +34,6 @@ COBJS += $(COBJS-y) SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS)) -SOBJS := $(addprefix $(obj),$(SOBJS)) - -$(obj)mmc_host.o: CFLAGS += -O2 $(LIB): $(obj).depend $(OBJS) $(SOBJS) $(AR) $(ARFLAGS) $@ $(OBJS) $(SOBJS) diff --git a/board/st/u8500/u8500.c b/board/st/u8500/u8500.c index 50a54e864..8ec67795c 100644 --- a/board/st/u8500/u8500.c +++ b/board/st/u8500/u8500.c @@ -7,6 +7,7 @@ #include <config.h> #include <common.h> #include <i2c.h> +#include <mmc.h> #include <asm/types.h> #include <asm/mach-types.h> #include <asm/io.h> @@ -18,6 +19,7 @@ #include <asm/arch/prcmu.h> #include <asm/arch/itp.h> #include <tc35892.h> +#include <u8500_mmc_host.h> #include <asm/arch/common.h> @@ -238,6 +240,61 @@ int dram_init(void) return 0; } +/* + * board_mmc_init - initialize all the mmc/sd host controllers. + * Called by generic mmc framework. + */ +int board_mmc_init(bd_t *bis) +{ + int error; + struct mmc *dev; + + debugX(DBG_LVL_VERBOSE, "mmc_host - board_mmc_init\n"); + + (void) bis; /* Parameter not used! */ + + dev = u8500_alloc_mmc_struct(); + if (!dev) + return -1; + + error = u8500_emmc_host_init(dev); + if (error) { + printf("emmc_host_init() %d \n", error); + return -1; + } + mmc_register(dev); + debugX(DBG_LVL_VERBOSE, "registered emmc interface number is:%d\n", + dev->block_dev.dev); + + + mmc_init(dev); + + /* + * In a perfect world board_early_access shouldn't be here but we want + * some functionality to be loaded as quickly as possible and putting it + * here will get the shortest time to start that functionality. Time + * saved by putting it here compared to later is somewhere between + * 0.3-0.7s. That is enough to be able to justify putting it here. + */ + + board_early_access(&dev->block_dev); + + dev = u8500_alloc_mmc_struct(); + if (!dev) + return -1; + + error = u8500_mmc_host_init(dev); + if (error) { + printf("mmc_host_init() %d \n", error); + return -1; + } + mmc_register(dev); + debugX(DBG_LVL_VERBOSE, "registered mmc/sd interface number is:%d\n", + dev->block_dev.dev); + + return 0; +} + #ifdef CONFIG_VIDEO_LOGO #if CONFIG_SYS_DISPLAY_DSI diff --git a/drivers/mmc/Makefile b/drivers/mmc/Makefile index 6fa04b84f..4f07c2233 100644 --- a/drivers/mmc/Makefile +++ b/drivers/mmc/Makefile @@ -32,15 +32,22 @@ COBJS-$(CONFIG_OMAP3_MMC) += omap3_mmc.o COBJS-$(CONFIG_FSL_ESDHC) += fsl_esdhc.o COBJS-$(CONFIG_MXC_MMC) += mxcmmc.o COBJS-$(CONFIG_PXA_MMC) += pxa_mmc.o +COBJS-$(CONFIG_U8500_MMC) += u8500_mmc_host.o + +SOBJS-$(CONFIG_U8500_MMC) += u8500_mmc_fifo.o COBJS := $(COBJS-y) SRCS := $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS)) +SOBJS := $(SOBJS-y) +SOBJS := $(addprefix $(obj),$(SOBJS)) + +$(obj)mmc_host.o: CFLAGS += -O2 all: $(LIB) -$(LIB): $(obj).depend $(OBJS) - $(AR) $(ARFLAGS) $@ $(OBJS) +$(LIB): $(obj).depend $(OBJS) $(SOBJS) + $(AR) $(ARFLAGS) $@ $(OBJS) $(SOBJS) ######################################################################### diff --git a/board/st/u8500/mmc_fifo.S b/drivers/mmc/u8500_mmc_fifo.S index 44911a8d5..c203a0f40 100644 --- a/board/st/u8500/mmc_fifo.S +++ b/drivers/mmc/u8500_mmc_fifo.S @@ -6,8 +6,8 @@ * License terms: GNU General Public License (GPL), version 2. */ -#include "mmc_fifo.h" -#include "mmc_host.h" +#include "u8500_mmc_fifo.h" +#include "u8500_mmc_types.h" /* * Function: mmc_fifo_read() diff --git a/board/st/u8500/mmc_fifo.h b/drivers/mmc/u8500_mmc_fifo.h index e2fb0a53b..e2fb0a53b 100644 --- a/board/st/u8500/mmc_fifo.h +++ b/drivers/mmc/u8500_mmc_fifo.h diff --git a/board/st/u8500/mmc_host.c b/drivers/mmc/u8500_mmc_host.c index d86f1f3ca..5f049cc76 100644 --- a/board/st/u8500/mmc_host.c +++ b/drivers/mmc/u8500_mmc_host.c @@ -18,10 +18,10 @@ #include <asm/arch/common.h> #include <asm/arch/cpu.h> #include <mmc.h> -#include "mmc_host.h" #include <malloc.h> #include <div64.h> -#include "mmc_fifo.h" +#include "u8500_mmc_types.h" +#include "u8500_mmc_fifo.h" struct mmc_host { @@ -427,7 +427,7 @@ static void host_set_ios(struct mmc *dev) udelay(CLK_CHANGE_DELAY); } -struct mmc *alloc_mmc_struct(void) +struct mmc *u8500_alloc_mmc_struct(void) { struct mmc_host *host = NULL; struct mmc *mmc_device = NULL; @@ -454,7 +454,7 @@ struct mmc *alloc_mmc_struct(void) * Configure GPIO settings, set initial clock and power for emmc slot. * Initialize mmc struct and register with mmc framework. */ -static int emmc_host_init(struct mmc *dev) +int u8500_emmc_host_init(struct mmc *dev) { struct mmc_host *host = dev->priv; u32 sdi_u32; @@ -499,7 +499,7 @@ static int emmc_host_init(struct mmc *dev) * Configure GPIO settings, set initial clock and power for mmc slot. * Initialize mmc struct and register with mmc framework. */ -static int mmc_host_init(struct mmc *dev) +int u8500_mmc_host_init(struct mmc *dev) { struct mmc_host *host = dev->priv; u32 sdi_u32; @@ -529,57 +529,3 @@ static int mmc_host_init(struct mmc *dev) return 0; } -/* - * board_mmc_init - initialize all the mmc/sd host controllers. - * Called by generic mmc framework. - */ -int board_mmc_init(bd_t *bis) -{ - int error; - struct mmc *dev; - - debugX(DBG_LVL_VERBOSE, "mmc_host - board_mmc_init\n"); - - (void) bis; /* Parameter not used! */ - - dev = alloc_mmc_struct(); - if (!dev) - return -1; - - error = emmc_host_init(dev); - if (error) { - printf("emmc_host_init() %d \n", error); - return -1; - } - mmc_register(dev); - debugX(DBG_LVL_VERBOSE, "registered emmc interface number is:%d\n", - dev->block_dev.dev); - - - mmc_init(dev); - - /* - * In a perfect world board_early_access shouldn't be here but we want - * some functionality to be loaded as quickly as possible and putting it - * here will get the shortest time to start that functionality. Time - * saved by putting it here compared to later is somewhere between - * 0.3-0.7s. That is enough to be able to justify putting it here. - */ - - board_early_access(&dev->block_dev); - - dev = alloc_mmc_struct(); - if (!dev) - return -1; - - error = mmc_host_init(dev); - if (error) { - printf("mmc_host_init() %d \n", error); - return -1; - } - mmc_register(dev); - debugX(DBG_LVL_VERBOSE, "registered mmc/sd interface number is:%d\n", - dev->block_dev.dev); - - return 0; -} diff --git a/board/st/u8500/mmc_host.h b/drivers/mmc/u8500_mmc_types.h index 3b5e1c589..ff0736066 100644 --- a/board/st/u8500/mmc_host.h +++ b/drivers/mmc/u8500_mmc_types.h @@ -7,8 +7,8 @@ * License terms: GNU General Public License (GPL), version 2. */ -#ifndef __MMC_NOMADIK_H__ -#define __MMC_NOMADIK_H__ +#ifndef __U8500_MMC_TYPES_H__ +#define __U8500_MMC_TYPES_H__ /* See SDI (SD card host interface) documentation in U8500 sw specification. */ diff --git a/include/configs/u8500.h b/include/configs/u8500.h index caa31b9eb..5bd02d140 100644 --- a/include/configs/u8500.h +++ b/include/configs/u8500.h @@ -90,6 +90,7 @@ #define CONFIG_ROCKBOX_FAT 1 #define CONFIG_U_BOOT 1 /* needed by Rockbox code */ #define CONFIG_SUPPORT_VFAT 1 /* Rockbox */ +#define CONFIG_U8500_MMC 1 /* * Commands diff --git a/include/u8500_mmc_host.h b/include/u8500_mmc_host.h new file mode 100644 index 000000000..82a49eed5 --- /dev/null +++ b/include/u8500_mmc_host.h @@ -0,0 +1,17 @@ +/* + * Copyright (C) ST-Ericsson SA 2011 + * + * License terms: GNU General Public License (GPL), version 2. + */ + + +#ifndef __U8500_MMC_HOST_H__ +#define __U8500_MMC_HOST_H__ + +#include <mmc.h> + +int u8500_mmc_host_init(struct mmc *dev); +int u8500_emmc_host_init(struct mmc *dev); +struct mmc *u8500_alloc_mmc_struct(void); + +#endif
\ No newline at end of file |