Help needed: How to Specify MTD Partitions on NAND in a Device Tree
Hello all,
I have a MT7621A basec SoC, which I am trying to update the boot prcess for. As it is now, I have v2024.10 based U-boot running and I can specify MTD partitions using env variable 'mtdparts' and use them all right. But I am looking for a way to specify them in a device tree.
Linux identifies the flash chip as:
[ 1.830000] nand: device found, Manufacturer ID: 0xc8, Chip ID: 0xda [ 1.840000] nand: ESMT NAND 256MiB 3,3V 8-bit
If someone can give my any pointers it would be much appreciated.
Thanks,
Mauri
Hi Mauri,
Here's an example:
https://github.com/openwrt/openwrt/blob/main/package/boot/uboot-mediatek/patches/105-configs-add-usefull-stuff-to-mt7988-rfb.patch#L316
Weijie
Quoted 18 lines · Mauri Sandberg <[email protected]> 于2025年2月8日周六 03:06写道:
Hello all,
I have a MT7621A basec SoC, which I am trying to update the boot prcess for. As it is now, I have v2024.10 based U-boot running and I can specify MTD partitions using env variable 'mtdparts' and use them all right. But I am looking for a way to specify them in a device tree.
Linux identifies the flash chip as:
[ 1.830000] nand: device found, Manufacturer ID: 0xc8, Chip ID: 0xda [ 1.840000] nand: ESMT NAND 256MiB 3,3V 8-bitIf someone can give my any pointers it would be much appreciated.
Thanks,
Mauri
Hi Weijie
Quoted 2 lines · Weijie Gao
Here's an example:
https://github.com/openwrt/openwrt/blob/main/package/boot/uboot-mediatek/patches/105-configs-add-usefull-stuff-to-mt7988-rfb.patch#L316
Sorry, I should have been more specific. Actually defining the partitions is the simpler part. But the mt7621.dtsi in U-boot tree does not contain NAND controller node to begin with and I was not successful in defining one. I tried copying/mimicking one from the mt7621.dtsi in OpenWrt tree but that did not work out.
At the moment I get NAND working with the raw MT7621 driver only. Can I somehow drive it with "spi-nand" or somthing similar?
Mauri
Quoted 7 lines · Mauri Sandberg
Hi Weijie
Quoted 3 lines · Weijie Gao
Here's an example:
https://github.com/openwrt/openwrt/blob/main/package/boot/uboot-
mediatek/patches/105-configs-add-usefull-stuff-to-mt7988-rfb.patch#L316
Quoted 6 lines
Sorry, I should have been more specific. Actually defining the partitions is the simpler part. But the
mt7621.dtsiin U-boot tree does not contain NAND controller node to begin with and I was not successful in defining one. I tried copying/mimicking one from themt7621.dtsiin OpenWrt tree but that did not work out.
With fresh pair of eyes I found that the 'mt7621_nand.c' in OpenWrt tree implements what the U-boot version is lacking and that they are both your work. Are there plans for bringing device tree support to U-boot or would you be able to review/assist if someone tried it?
Thanks,
Mauri
I remembered that the raw nand framework does not support dt binding. It's not a uclass driver.
So the way is to rewrite the driver as a mtd uclass driver.
Best Regards,
Weijie
Quoted 25 lines · Mauri Sandberg <[email protected]> 于2025年2月8日周六 17:04写道:
Quoted 7 lines · Mauri Sandberg
Hi Weijie
Quoted 3 lines · Weijie Gao
Here's an example:
https://github.com/openwrt/openwrt/blob/main/package/boot/uboot-
mediatek/patches/105-configs-add-usefull-stuff-to-mt7988-rfb.patch#L316Quoted 6 lines
Sorry, I should have been more specific. Actually defining the partitions is the simpler part. But the
mt7621.dtsiin U-boot tree does not contain NAND controller node to begin with and I was not successful in defining one. I tried copying/mimicking one from themt7621.dtsiin OpenWrt tree but that did not work out.With fresh pair of eyes I found that the '
mt7621_nand.c' in OpenWrt tree implements what the U-boot version is lacking and that they are both your work. Are there plans for bringing device tree support to U-boot or would you be able to review/assist if someone tried it?Thanks,
Mauri