19258: drivers/mtd_flashpage: implement pagewise API, don't use raw addresses r=benpicco a=benpicco
Co-authored-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
Co-authored-by: Benjamin Valentin <benjamin.valentin@bht-berlin.de>
Co-authored-by: Benjamin Valentin <benpicco@beuth-hochschule.de>
Currently work_buf is only NULL when MTD_DRIVER_FLAG_DIRECT_WRITE is
set, so it served as a proxy for that flag.
However, we might want to have a work buffer even when writes without
erase are possible.
If the underlying driver implements 'plain' read/write/erase
fucntions, don't convert them to pagewise functions and back.
Just use the old direct functions.
Currently read(), write() and erase() all use 32 bit addressing.
This is a problem when writing to media > 4 GiB, e.g. SD cards.
The current implementation would wrap around after 4 GiB and corrupt data.
To avoid this, add functions to the MTD subsystem that allow for page-wise
addressing. This is how most of the underling storage drivers and the
file-systems above work anyway.
In the future we should then deprecate the 32-bit functions if all drivers
are converted.