Message ID | 20230109120154.2868-6-philmd@linaro.org |
---|---|
State | New |
Headers | show |
Series | hw: Cleanups around PFLASH use | expand |
On Mon, 9 Jan 2023, Philippe Mathieu-Daudé wrote: > Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> > --- > hw/sh4/r2d.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/hw/sh4/r2d.c b/hw/sh4/r2d.c > index b3667e9b12..6e0c65124a 100644 > --- a/hw/sh4/r2d.c > +++ b/hw/sh4/r2d.c > @@ -45,7 +45,8 @@ > #include "hw/block/flash.h" > > #define FLASH_BASE 0x00000000 > -#define FLASH_SIZE (16 * MiB) > +#define FLASH_SIZE (16 * MiB) > +#define FLASH_SECTOR_SIZE (128 * KiB) I'm not a fan of single use defines when it makes harder to see what value is used than using a constant. This one is border line case as the pflash_cfi02_register() function has so many arguments that it's not clear which is which but I'm not sure it worth the churn but I don't care too much either. Regards, BALATON Zoltan > #define SDRAM_BASE (192 * MiB) /* Physical location of SDRAM: Area 3 */ > #define SDRAM_SIZE (64 * MiB) > @@ -304,8 +305,8 @@ static void r2d_init(MachineState *machine) > dinfo = drive_get(IF_PFLASH, 0, 0); > pflash_cfi02_register(0x0, "r2d.flash", FLASH_SIZE, > dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, > - 64 * KiB, 1, 2, 0x0001, 0x227e, 0x2220, 0x2200, > - 0x555, 0x2aa, 0); > + FLASH_SECTOR_SIZE, 1, 2, > + 0x0001, 0x227e, 0x2220, 0x2200, 0x555, 0x2aa, 0); > > /* NIC: rtl8139 on-board, and 2 slots. */ > for (i = 0; i < nb_nics; i++) >
diff --git a/hw/sh4/r2d.c b/hw/sh4/r2d.c index b3667e9b12..6e0c65124a 100644 --- a/hw/sh4/r2d.c +++ b/hw/sh4/r2d.c @@ -45,7 +45,8 @@ #include "hw/block/flash.h" #define FLASH_BASE 0x00000000 -#define FLASH_SIZE (16 * MiB) +#define FLASH_SIZE (16 * MiB) +#define FLASH_SECTOR_SIZE (128 * KiB) #define SDRAM_BASE (192 * MiB) /* Physical location of SDRAM: Area 3 */ #define SDRAM_SIZE (64 * MiB) @@ -304,8 +305,8 @@ static void r2d_init(MachineState *machine) dinfo = drive_get(IF_PFLASH, 0, 0); pflash_cfi02_register(0x0, "r2d.flash", FLASH_SIZE, dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, - 64 * KiB, 1, 2, 0x0001, 0x227e, 0x2220, 0x2200, - 0x555, 0x2aa, 0); + FLASH_SECTOR_SIZE, 1, 2, + 0x0001, 0x227e, 0x2220, 0x2200, 0x555, 0x2aa, 0); /* NIC: rtl8139 on-board, and 2 slots. */ for (i = 0; i < nb_nics; i++)
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- hw/sh4/r2d.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)