Hi,
> Issue (1) isn't too hard: we add the device to the dynamic
sysbus device
> white-list, move a sysbus_mmio_map() from pflash_cfi01_realize() into
> pflash_cfi01_realize(). The latter requires a new device property to
> configure the base address. I got a working prototype. Since this
> makes the device model's name and properties ABI, review would be
> advisable.
Flash devices exist on the board at specific addresses, so they
should in general be created by the board model. Creating them
by the user on the command line is a mess because then the
user has to know the right base address. And then the board
code needs to do something for "if the user didn't create this
then we need to do it", because the flash device should exist
in the model whether the user cared about its contents or not.
The tricky part is the access control here. On physical hardware you
typically have one flash rom, say 16M below 4G (on x86).
Our pflash device doesn't allow to define multiple regions, so we use
multiple pflash devices instead, each with different access permissions
(code vs. vars). Because of that they are more dynamic than they are on
phyiscal hardware, x86 sizes them according to the size of the firmware
images (arm is easier here, we have fixed size and location no matter
how big the firmware images are).
So I think the options we have are:
(a) leave pflash as-is, which pretty much implies physaddr and size
must be user-configurable.
(b) add support for multiple regions to pflash, so one can attach
multiple blockdev at different offsets to a single pflash device.
cheers,
Gerd