]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - patches/0019-ENGR00113439-BBG2-enable-SPI-NOR-and-MMC-in-one-im.patch
imported Ka-Ro specific additions to U-Boot 2009.08 for TX28
[karo-tx-uboot.git] / patches / 0019-ENGR00113439-BBG2-enable-SPI-NOR-and-MMC-in-one-im.patch
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.
5
6 BBG2, enable SPI NOR and MMC in one image.
7
8 Signed-off-by: Terry Lv <r65388@freescale.com>
9 ---
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(-)
15
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)
21  int sdhc_init(void)
22  {
23         u32 interface_esdhc = 0;
24 -       u32 pad_val = 0;
25         s32 status = 0;
26  
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,
33         if (!(flash->spi))
34                 return -1;
35  
36 +       printf("Reading SPI NOR flash 0x%x [0x%x bytes] -> ram 0x%p\n",
37 +               offset, len, buf);
38         debug("%s(from flash=0x%08x to ram=%p len=0x%x)\n",
39                 __func__,
40                 offset, buf, len);
41 @@ -271,7 +273,7 @@ static int spi_nor_flash_read(struct spi_flash *flash, u32 offset,
42                                                 *d_buf++ = s_buf[1];
43                                                 *d_buf++ = s_buf[0];
44                                         }
45 -                                       printf("\n");
46 +                                       printf("SUCCESS\n\n");
47                                         return 0;
48                                 }
49                                 /* copy 4 bytes */
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)
52                         printf(".");
53         }
54 -       printf("\n");
55 +       printf("SUCCESS\n\n");
56  
57         return -1;
58  }
59 @@ -321,6 +323,8 @@ static int spi_nor_flash_write(struct spi_flash *flash, u32 offset,
60         if (len == 0)
61                 return 0;
62  
63 +       printf("Writing SPI NOR flash 0x%x [0x%x bytes] <- ram 0x%p\n",
64 +               offset, len, buf);
65         debug("%s(flash addr=0x%08x, ram=%p, len=0x%x)\n",
66                         __func__, offset, buf, len);
67  
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)
70                         printf(".");
71         }
72 -       printf("\n");
73 +       printf("SUCCESS\n\n");
74         debug("100%% transferred\n");
75  
76         WRITE_DISABLE(flash);
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,
79                 size_t len)
80  {
81 -       struct imx_spi_flash *imx_sf = to_imx_spi_flash(flash);
82         s32 s32remain_size = len;
83  
84         if (!(flash->spi))
85                 return -1;
86  
87 +       printf("Erasing SPI NOR flash 0x%x [0x%x bytes]\n",
88 +               offset, len);
89 +
90         if ((len % SZ_4K) != 0 || len == 0) {
91                 printf("Error: size (0x%x) is not integer multiples of 4kB(0x1000)\n",
92                         len);
93 @@ -450,7 +456,7 @@ static int spi_nor_flash_erase(struct spi_flash *flash, u32 offset,
94                 }
95                 printf(".");
96         }
97 -       printf("\n");
98 +       printf("SUCCESS\n\n");
99         debug("100%% erased\n");
100         return 0;
101  }
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
106 @@ -25,9 +25,9 @@
107  
108  #include <linux/types.h>
109  
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);
117  
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
123 @@ -68,10 +68,9 @@
124  #define CONFIG_MX51_UART       1
125  #define CONFIG_MX51_UART1      1
126  
127 -#if defined(BOOT_MEDIA_SPI_NOR)
128  /*
129   * SPI Configs
130 - */
131 + * */
132  #define CONFIG_FSL_SF          1
133  #define CONFIG_CMD_SPI
134  #define CONFIG_CMD_SF
135 @@ -80,18 +79,19 @@
136  #define CONFIG_IMX_SPI
137  #define CONFIG_IMX_SPI_PMIC
138  #define CONFIG_IMX_SPI_PMIC_CS 0
139 +
140  #define MAX_SPI_BYTES          (64 * 4)
141  
142 -#elif defined(BOOT_MEDIA_MMC)
143  /*
144   * MMC Configs
145 - */
146 + * */
147  #define CONFIG_FSL_MMC         1
148 +
149 +#define CONFIG_MMC              1
150 +#define CONFIG_CMD_MMC
151  #define CONFIG_DOS_PARTITION   1
152  #define CONFIG_CMD_FAT         1
153  
154 -#endif
155 -
156  /* allow to overwrite serial and ethaddr */
157  #define CONFIG_ENV_OVERWRITE
158  #define CONFIG_CONS_INDEX      1
159 @@ -208,11 +208,7 @@
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
165 -/*
166         #define CONFIG_FSL_ENV_IN_MMC
167 -*/
168  #elif defined(CONFIG_CMD_NAND)
169         #define CONFIG_FSL_ENV_IN_NAND
170  #endif
171 -- 
172 1.5.4.4
173