1 From 0557114f39ead28bb9d9b81291970c72728786a4 Mon Sep 17 00:00:00 2001
2 From: Terry Lv <r65388@freescale.com>
3 Date: Wed, 17 Jun 2009 18:46:13 +0800
4 Subject: [PATCH] ENGR00113439: BBG2, enable SPI NOR and MMC in one image.
6 BBG2, enable SPI NOR and MMC in one image.
8 Signed-off-by: Terry Lv <r65388@freescale.com>
10 board/freescale/imx51/imx51.c | 1 -
11 drivers/mtd/spi/imx_spi_nor.c | 16 +++++++++++-----
12 include/asm-arm/arch-mx51/imx_spi_pmic.h | 6 +++---
13 include/configs/imx51.h | 16 ++++++----------
14 4 files changed, 20 insertions(+), 19 deletions(-)
16 diff --git a/board/freescale/imx51/imx51.c b/board/freescale/imx51/imx51.c
17 index 793afa2..b0bbf46 100644
18 --- a/board/freescale/imx51/imx51.c
19 +++ b/board/freescale/imx51/imx51.c
20 @@ -258,7 +258,6 @@ int board_eth_init(bd_t *bis)
23 u32 interface_esdhc = 0;
27 interface_esdhc = (readl(SRC_BASE_ADDR + 0x4) & (0x00180000)) >> 19;
28 diff --git a/drivers/mtd/spi/imx_spi_nor.c b/drivers/mtd/spi/imx_spi_nor.c
29 index a912a3f..bd10ca4 100644
30 --- a/drivers/mtd/spi/imx_spi_nor.c
31 +++ b/drivers/mtd/spi/imx_spi_nor.c
32 @@ -230,6 +230,8 @@ static int spi_nor_flash_read(struct spi_flash *flash, u32 offset,
36 + printf("Reading SPI NOR flash 0x%x [0x%x bytes] -> ram 0x%p\n",
38 debug("%s(from flash=0x%08x to ram=%p len=0x%x)\n",
41 @@ -271,7 +273,7 @@ static int spi_nor_flash_read(struct spi_flash *flash, u32 offset,
46 + printf("SUCCESS\n\n");
50 @@ -302,7 +304,7 @@ static int spi_nor_flash_read(struct spi_flash *flash, u32 offset,
51 if ((s32remain_size % imx_sf->params->block_size) == 0)
55 + printf("SUCCESS\n\n");
59 @@ -321,6 +323,8 @@ static int spi_nor_flash_write(struct spi_flash *flash, u32 offset,
63 + printf("Writing SPI NOR flash 0x%x [0x%x bytes] <- ram 0x%p\n",
65 debug("%s(flash addr=0x%08x, ram=%p, len=0x%x)\n",
66 __func__, offset, buf, len);
68 @@ -395,7 +399,7 @@ static int spi_nor_flash_write(struct spi_flash *flash, u32 offset,
69 if ((s32remain_size % imx_sf->params->block_size) == 0)
73 + printf("SUCCESS\n\n");
74 debug("100%% transferred\n");
77 @@ -423,12 +427,14 @@ static int spi_nor_flash_write(struct spi_flash *flash, u32 offset,
78 static int spi_nor_flash_erase(struct spi_flash *flash, u32 offset,
81 - struct imx_spi_flash *imx_sf = to_imx_spi_flash(flash);
82 s32 s32remain_size = len;
87 + printf("Erasing SPI NOR flash 0x%x [0x%x bytes]\n",
90 if ((len % SZ_4K) != 0 || len == 0) {
91 printf("Error: size (0x%x) is not integer multiples of 4kB(0x1000)\n",
93 @@ -450,7 +456,7 @@ static int spi_nor_flash_erase(struct spi_flash *flash, u32 offset,
98 + printf("SUCCESS\n\n");
99 debug("100%% erased\n");
102 diff --git a/include/asm-arm/arch-mx51/imx_spi_pmic.h b/include/asm-arm/arch-mx51/imx_spi_pmic.h
103 index 1c32a9e..acd8cbf 100644
104 --- a/include/asm-arm/arch-mx51/imx_spi_pmic.h
105 +++ b/include/asm-arm/arch-mx51/imx_spi_pmic.h
108 #include <linux/types.h>
110 -struct spi_slave *spi_pmic_probe();
111 -void spi_pmic_free(struct spi_slave *slave);
112 -u32 pmic_reg(struct spi_slave *slave,
113 +extern struct spi_slave *spi_pmic_probe();
114 +extern void spi_pmic_free(struct spi_slave *slave);
115 +extern u32 pmic_reg(struct spi_slave *slave,
116 u32 reg, u32 val, u32 write);
118 #endif /* _IMX_SPI_PMIC_H_ */
119 diff --git a/include/configs/imx51.h b/include/configs/imx51.h
120 index 238457e..7bd6c38 100644
121 --- a/include/configs/imx51.h
122 +++ b/include/configs/imx51.h
124 #define CONFIG_MX51_UART 1
125 #define CONFIG_MX51_UART1 1
127 -#if defined(BOOT_MEDIA_SPI_NOR)
132 #define CONFIG_FSL_SF 1
133 #define CONFIG_CMD_SPI
134 #define CONFIG_CMD_SF
136 #define CONFIG_IMX_SPI
137 #define CONFIG_IMX_SPI_PMIC
138 #define CONFIG_IMX_SPI_PMIC_CS 0
140 #define MAX_SPI_BYTES (64 * 4)
142 -#elif defined(BOOT_MEDIA_MMC)
147 #define CONFIG_FSL_MMC 1
149 +#define CONFIG_MMC 1
150 +#define CONFIG_CMD_MMC
151 #define CONFIG_DOS_PARTITION 1
152 #define CONFIG_CMD_FAT 1
156 /* allow to overwrite serial and ethaddr */
157 #define CONFIG_ENV_OVERWRITE
158 #define CONFIG_CONS_INDEX 1
160 #if defined(CONFIG_FSL_SF)
161 #define CONFIG_FSL_ENV_IN_SF
162 #elif defined(CONFIG_FSL_MMC)
163 - #define CONFIG_MMC 1
164 - #define CONFIG_CMD_MMC
166 #define CONFIG_FSL_ENV_IN_MMC
168 #elif defined(CONFIG_CMD_NAND)
169 #define CONFIG_FSL_ENV_IN_NAND