Can U-Boot create mtdparts from device tree partition info?

Hello,
In looking through the source, I'm not yet seeing logic that allows U-Boot to actually use MTD partition information found in the device tree. Does this logic exist and I'm just missing it? Or do I need to parse the device tree partitions manually and create the mtdparts env variable?
Sorry if this is obvious, I'm just not seeing it yet. Also, if the answer is just to manually enter the mtdparts env variable, and keep it in line with the partition information in the device tree as a manual operation, please let me know that too. I'm just hoping there is a way to have U-Boot get the info from the device tree automatically.
Thanks very much, Chuck

Hello Chuck,
Am Wed, Mar 06, 2024 at 11:48:39AM -0500 schrieb Chuck Meade:
Hello,
In looking through the source, I'm not yet seeing logic that allows U-Boot to actually use MTD partition information found in the device tree. Does this logic exist and I'm just missing it? Or do I need to parse the device tree partitions manually and create the mtdparts env variable?
U-Boot can use the partition information from device tree, but not with mtdparts. Try enabling CMD_MTD and run `mtd list` and you will see those partitions.
Sorry if this is obvious, I'm just not seeing it yet. Also, if the answer is just to manually enter the mtdparts env variable, and keep it in line with the partition information in the device tree as a manual operation, please let me know that too. I'm just hoping there is a way to have U-Boot get the info from the device tree automatically.
You could do that, but it is probably not necessary. The 'nand' command has some nice ways to enter commands using those mtdparts labels, but the 'mtd' covers the basic features like read, write, erase too, also with names, but with a different calling syntax for the commands.
Unfortunately the 'nand' command uses mtdparts only and does not work with partitions defined in DT. The 'mtd' command is organized differently and you might not find all features the 'nand' command has.
Greets Alex
Thanks very much, Chuck

Hi Alex,
On Thu, Mar 7, 2024 at 4:17 AM Alexander Dahl ada@thorsis.com wrote:
Hello Chuck,
Am Wed, Mar 06, 2024 at 11:48:39AM -0500 schrieb Chuck Meade:
Hello,
In looking through the source, I'm not yet seeing logic that allows
U-Boot
to actually use MTD partition information found in the device tree. Does this logic exist and I'm just missing it? Or do I need to parse the
device
tree partitions manually and create the mtdparts env variable?
U-Boot can use the partition information from device tree, but not with mtdparts. Try enabling CMD_MTD and run `mtd list` and you will see those partitions.
Thanks very much for the info. I am using a U-Boot source tree from a Petalinux distro, and it turns out that there has been a patch to U-Boot since this distro was created, involving flash_node in mtdparts.c. I was able to incorporate this patch into the U-Boot source tree here and the "mtd list" version now works as you described. I can see all of the MTD partitions from my device tree.
I appreciate your help! Thanks, Chuck
Sorry if this is obvious, I'm just not seeing it yet. Also, if the
answer
is just to manually enter the mtdparts env variable, and keep it in line with the partition information in the device tree as a manual operation, please let me know that too. I'm just hoping there is a way to have
U-Boot
get the info from the device tree automatically.
You could do that, but it is probably not necessary. The 'nand' command has some nice ways to enter commands using those mtdparts labels, but the 'mtd' covers the basic features like read, write, erase too, also with names, but with a different calling syntax for the commands.
Unfortunately the 'nand' command uses mtdparts only and does not work with partitions defined in DT. The 'mtd' command is organized differently and you might not find all features the 'nand' command has.
Greets Alex
Thanks very much, Chuck
participants (2)
-
Alexander Dahl
-
Chuck Meade