f2bb0542b91c8a593d21456d82cde4cb55f0d0f6
[openwrt/staging/mkresin.git] / target / linux / bcm53xx / patches-3.14 / 405-mtd-bcm53xxspiflash-try-using-JEDEC-as-one-of-method.patch
1 --- a/drivers/mtd/spi-nor/bcm53xxspiflash.c
2 +++ b/drivers/mtd/spi-nor/bcm53xxspiflash.c
3 @@ -173,7 +173,8 @@ static const struct spi_device_id *bcm53
4
5 /* TODO: Try more ID commands */
6
7 - return ERR_PTR(-ENODEV);
8 + /* Some chips used by Broadcom may actually support JEDEC */
9 + return spi_nor_read_id(nor);
10
11 found_name:
12 id = spi_nor_match_id(name);
13 --- a/drivers/mtd/spi-nor/spi-nor.c
14 +++ b/drivers/mtd/spi-nor/spi-nor.c
15 @@ -629,7 +629,7 @@ const struct spi_device_id spi_nor_ids[]
16 };
17 EXPORT_SYMBOL_GPL(spi_nor_ids);
18
19 -static const struct spi_device_id *spi_nor_read_id(struct spi_nor *nor)
20 +const struct spi_device_id *spi_nor_read_id(struct spi_nor *nor)
21 {
22 int tmp;
23 u8 id[5];
24 @@ -660,6 +660,7 @@ static const struct spi_device_id *spi_n
25 dev_err(nor->dev, "unrecognized JEDEC id %06x\n", jedec);
26 return ERR_PTR(-ENODEV);
27 }
28 +EXPORT_SYMBOL_GPL(spi_nor_read_id);
29
30 static int spi_nor_read(struct mtd_info *mtd, loff_t from, size_t len,
31 size_t *retlen, u_char *buf)
32 --- a/include/linux/mtd/spi-nor.h
33 +++ b/include/linux/mtd/spi-nor.h
34 @@ -188,6 +188,8 @@ struct spi_nor {
35 void *priv;
36 };
37
38 +const struct spi_device_id *spi_nor_read_id(struct spi_nor *nor);
39 +
40 /**
41 * spi_nor_scan() - scan the SPI NOR
42 * @nor: the spi_nor structure