Creating DTS file for board with multiple flash chips

Hi there,

I'm currently attempting to write a dts file for "Fritz!Box 3272", but I'm stuck at the "flash" section.
First of all: Is it correct to replicate the manufacturers partitions or do I have to make a scheme up myself?

This board makes use of 2 separate flash chips "s-flash" and "NAND", the manufacturer placed 3 partitions "tffs (1)", "tffs (2)", "urlader" on the former, while filesystem, kernel etc are placed on the latter.
Urlader is the bootloader I suppose.

I took a look at similar flash chip configurations - for example the "Fritz!Box 4040" makes use of a similar scheme. As this board is already integrated with OpenWRT 19.07, I took a look at the dts file:
It only lists one entry "flash@0" and under that all partitions.
Is this the preferred way?
I would very much appreciate any reference on creating partitions in the dts as I couldn't make much use of the wiki 0.

The specific questions I try to answer:
What do those partition definitions represent: The state of the device as is in vendor state or as we want it to be after installing openwrt?
How do I handle the bootloader on a separate Flashchip, can I just add another "flash" node? Is there some reference dts on how thats done?


Fritzbox 4040 is a bad example for flash, it is only using 1 flash chip

First of all, you should know the model of both flash chips, and look up their datasheets to see if they are both using SPI protocol (in other words, making sure the NAND is not raw NAND)

then, assuming they are using the same SPI interface for both chips, you would have a flash@0 and flash@1 where the reg value is the chip-select pin number. It is possible that the reg values are something else in which case you might have flash@2 and flash@3

sometimes some SOC have more than one SPI interface, where the root nodes would be something like &spi0 and &spi1, and if that's the case you look in relevant DTSI for those nodes

upstream doc:

SPI NAND flash

Required properties:
- compatible: should be "spi-nand"
- reg: should encode the chip-select line used to access the NAND chip

a good example

also for your testing purposes, I would use only initramfs-kernel.bin and make all partitions read-only, unless you have a backup of both flash already