I have an mt7620 board with a Macronix MX30LF2G18AC nand chip. This was configured in an older version of openwrt, and I am attempting to migrate the configuration to a new version.
In the old version the chip was defined in nand_device_list.h as so:
static const flashdev_info gen_FlashTable[]={
{0xC2DA, 0x909506, 5, 8, 256, 128, 2048, 64, 0x30C77fff, "MX30LF2G18AC", 0}
};
with this partition info in the old bootlog:
[ 1.504000] !!! nand page size = 2048, addr len=5
[ 1.516000] ra_nand_init: alloc 1468, at 8fca2000 , btt(8fca30c0, 200), ranfc_mtd:8fca32c0
[ 1.532000] Creating 9 MTD partitions on "ra_nfc":
[ 1.540000] 0x000000000000-0x000010000000 : "ALL"
[ 1.640000] 0x000000000000-0x000000040000 : "uboot"
[ 1.652000] 0x000000040000-0x000000080000 : "uboot-env"
[ 1.664000] 0x000000080000-0x000000480000 : "uImage"
[ 1.676000] 0x000000480000-0x000000880000 : "uImage2"
[ 1.688000] 0x000000880000-0x000005880000 : "rootfs"
[ 1.700000] 0x000005880000-0x00000a880000 : "rootfs2"
[ 1.712000] 0x00000a880000-0x00000b880000 : "config"
[ 1.720000] 0x00000b880000-0x00000fe80000 : "storage"
This is the nand setup in the default dts for the MT7620 eval board:
&spi0 {
status = "okay";
m25p80@0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "jedec,spi-nor";
reg = <0>;
spi-max-frequency = <10000000>;
partition@0 {
label = "u-boot";
reg = <0x0 0x30000>;
read-only;
};
partition@30000 {
label = "u-boot-env";
reg = <0x30000 0x10000>;
read-only;
};
factory: partition@40000 {
label = "factory";
reg = <0x40000 0x10000>;
read-only;
};
partition@50000 {
label = "firmware";
reg = <0x50000 0x7b0000>;
};
};
};
I can probably figure out the partitions, but am confused as to what to use in place of "m25p80@0" and if I need to be under &spi0. Can I get any help getting started?
jeff
April 23, 2019, 5:14am
2
Things may be different on the mt7620, but for the ath79 platform, Linux 4.19 is needed for SPI NAND. (The "hackish" way of twisting the SPI NOR code for SPI NAND was rejected upstream in favor of the SPI-NAND framework.)
linux-4.19.34/drivers/mtd/nand/spi/macronix.c
looks to be present with the two chips populated
MX35LF1GE4AB
MX35LF2GE4AB
The setup is probably similar to what you've shown if it's on SPI, though compatible will be spi-nand
I wish I had more insight, but I just started to try to port then AR750S and its GigaDevice GD5F1GQ4UFxxG onto ath79 / 4.19 in the last day.
musashino:
pararell NAND flash
Hmm, so what interface would I need to try to add it to in the dts?
Looks like there is no support for parallel NAND on MT7620 in current OpenWrt.
By Kernel 4.4 there was a patch to support it, but after 4.9 it seems not.
From fb6e1578cd73d7d81f675e75247a676423f32412 Mon Sep 17 00:00:00 2001
From: John Crispin <blogic@openwrt.org>
Date: Sun, 17 Nov 2013 17:41:46 +0100
Subject: [PATCH 38/53] mtd: ralink: add mt7620 nand driver
Signed-off-by: John Crispin <blogic@openwrt.org>
---
drivers/mtd/maps/Kconfig | 4 +
drivers/mtd/maps/Makefile | 2 +
drivers/mtd/maps/ralink_nand.c | 2136 ++++++++++++++++++++++++++++++++++++++++
drivers/mtd/maps/ralink_nand.h | 232 +++++
4 files changed, 2374 insertions(+)
create mode 100644 drivers/mtd/maps/ralink_nand.c
create mode 100644 drivers/mtd/maps/ralink_nand.h
--- a/drivers/mtd/maps/Kconfig
+++ b/drivers/mtd/maps/Kconfig
@@ -399,4 +399,8 @@ config MTD_LATCH_ADDR
If compiled as a module, it will be called latch-addr-flash.
This file has been truncated. show original
There was a PR for Xiaomi R3 support a year ago.
It included a patch to restore the NAND driver for MT7620, you can dig it out of there and after a refresh, it can likely work.
1 Like
I tried that patch, but its dependent on a struct that was expelled in 4.9
https://patchwork.kernel.org/patch/8518251/
Well, that PR includes a reworked version without the nand_ecclayout struct
I found this version which worked.
I must have missed the other version in the one you linked. Thanks!
Also was able to define partitions in the dts.
1 Like