mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-26 00:41:17 +00:00
02050f7e7d
Some MikroTik devices are using a Winbond NAND flash. Linux treats it as an unknown NAND before version 4.11: nand: device found, Manufacturer ID: 0xef, Chip ID: 0xf1 nand: Unknown NAND 128MiB 3,3V 8-bit nand: 128 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64 Backport a patch from 4.11 to show the manufacturer correctly: nand: device found, Manufacturer ID: 0xef, Chip ID: 0xf1 nand: Winbond NAND 128MiB 3,3V 8-bit nand: 128 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64 Tested on a MikroTik R951Ui-2HnD board. Signed-off-by: Gabor Juhos <juhosg@freemail.hu>
38 lines
925 B
Diff
38 lines
925 B
Diff
---
|
|
drivers/mtd/nand/plat_nand.c | 13 ++++++++++++-
|
|
include/linux/mtd/nand.h | 1 +
|
|
2 files changed, 13 insertions(+), 1 deletion(-)
|
|
|
|
--- a/include/linux/mtd/nand.h
|
|
+++ b/include/linux/mtd/nand.h
|
|
@@ -864,6 +864,7 @@ struct platform_nand_chip {
|
|
unsigned int options;
|
|
unsigned int bbt_options;
|
|
const char **part_probe_types;
|
|
+ int (*chip_fixup)(struct mtd_info *mtd);
|
|
};
|
|
|
|
/* Keep gcc happy */
|
|
--- a/drivers/mtd/nand/plat_nand.c
|
|
+++ b/drivers/mtd/nand/plat_nand.c
|
|
@@ -87,7 +87,18 @@ static int plat_nand_probe(struct platfo
|
|
}
|
|
|
|
/* Scan to find existence of the device */
|
|
- if (nand_scan(&data->mtd, pdata->chip.nr_chips)) {
|
|
+ if (nand_scan_ident(&data->mtd, pdata->chip.nr_chips, NULL)) {
|
|
+ err = -ENXIO;
|
|
+ goto out;
|
|
+ }
|
|
+
|
|
+ if (pdata->chip.chip_fixup) {
|
|
+ err = pdata->chip.chip_fixup(&data->mtd);
|
|
+ if (err)
|
|
+ goto out;
|
|
+ }
|
|
+
|
|
+ if (nand_scan_tail(&data->mtd)) {
|
|
err = -ENXIO;
|
|
goto out;
|
|
}
|