ar71xx: build firmware image for the WNDR3700 v4 board
[openwrt/svn-archive/archive.git] / package / boot / uboot-lantiq / patches / 0002-sf-handle-CONFIG_MANUAL_RELOC.patch
1 From 60e8a35f0efa5a7e5d797a3f239971c84061ef11 Mon Sep 17 00:00:00 2001
2 From: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
3 Date: Tue, 6 Nov 2012 21:39:47 +0100
4 Subject: sf: handle CONFIG_MANUAL_RELOC
5
6 Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
7
8 --- a/drivers/mtd/spi/spi_flash.c
9 +++ b/drivers/mtd/spi/spi_flash.c
10 @@ -293,7 +293,7 @@ int spi_flash_cmd_write_status(struct sp
11 */
12 #define IDCODE_CONT_LEN 0
13 #define IDCODE_PART_LEN 5
14 -static const struct {
15 +static struct {
16 const u8 shift;
17 const u8 idcode;
18 struct spi_flash *(*probe) (struct spi_slave *spi, u8 *idcode);
19 @@ -335,6 +335,10 @@ static const struct {
20 };
21 #define IDCODE_LEN (IDCODE_CONT_LEN + IDCODE_PART_LEN)
22
23 +#ifdef CONFIG_NEEDS_MANUAL_RELOC
24 +DECLARE_GLOBAL_DATA_PTR;
25 +#endif
26 +
27 struct spi_flash *spi_flash_probe(unsigned int bus, unsigned int cs,
28 unsigned int max_hz, unsigned int spi_mode)
29 {
30 @@ -342,6 +346,16 @@ struct spi_flash *spi_flash_probe(unsign
31 struct spi_flash *flash = NULL;
32 int ret, i, shift;
33 u8 idcode[IDCODE_LEN], *idp;
34 +#ifdef CONFIG_NEEDS_MANUAL_RELOC
35 + static int relocated;
36 +
37 + if (!relocated) {
38 + for (i = 0; i < ARRAY_SIZE(flashes); i++)
39 + flashes[i].probe += gd->reloc_off;
40 +
41 + relocated = 1;
42 + }
43 +#endif
44
45 spi = spi_setup_slave(bus, cs, max_hz, spi_mode);
46 if (!spi) {