6836674fed51cd4a03e005ae13ae64c7381a854b
[openwrt/svn-archive/archive.git] / package / boot / uboot-lantiq / patches / 0007-sf-eon-use-16-bit-ID-for-comparison.patch
1 From d32f45357f0475a2f810752eeb9412fe692e1c0a Mon Sep 17 00:00:00 2001
2 From: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
3 Date: Wed, 7 Nov 2012 14:09:21 +0100
4 Subject: sf: eon: use 16 bit ID for comparison
5
6 Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
7
8 --- a/drivers/mtd/spi/eon.c
9 +++ b/drivers/mtd/spi/eon.c
10 @@ -11,19 +11,19 @@
11 #include "spi_flash_internal.h"
12
13 struct eon_spi_flash_params {
14 - u8 idcode1;
15 + u16 idcode;
16 u16 nr_sectors;
17 const char *name;
18 };
19
20 static const struct eon_spi_flash_params eon_spi_flash_table[] = {
21 {
22 - .idcode1 = 0x16,
23 + .idcode = 0x3016,
24 .nr_sectors = 1024,
25 .name = "EN25Q32B",
26 },
27 {
28 - .idcode1 = 0x18,
29 + .idcode = 0x3018,
30 .nr_sectors = 4096,
31 .name = "EN25Q128",
32 },
33 @@ -33,10 +33,11 @@ int spi_flash_probe_eon(struct spi_flash
34 {
35 const struct eon_spi_flash_params *params;
36 unsigned int i;
37 + u16 id = idcode[2] | idcode[1] << 8;
38
39 for (i = 0; i < ARRAY_SIZE(eon_spi_flash_table); ++i) {
40 params = &eon_spi_flash_table[i];
41 - if (params->idcode1 == idcode[2])
42 + if (params->idcode == id)
43 break;
44 }
45