+static uint32_t ich_hwseq_get_erase_block_size(unsigned int addr)
+{
+ REGWRITE32(ICH9_REG_FADDR, (addr & 0x00FFFFFF));
+ uint8_t enc_berase = (REGREAD16(ICH9_REG_HSFS) & HSFS_BERASE) >>
+ HSFS_BERASE_OFF;
+ const uint32_t dec_berase[4] = {
+ 256,
+ 4 * 1024,
+ 8 * 1024,
+ 64 * 1024
+ };
+ return dec_berase[enc_berase];
Others might want to comment, but I think you should avoid doing all that work in the variable declaration area.
+}
+
+int ich_hwseq_probe(struct flashchip *flash)
+{
+ uint32_t total_size, boundary;
+ uint32_t erase_size_low, size_low, erase_size_high, size_high;
+ struct block_eraser eraser;
This should be a pointer, right? I am assuming you intended to directly update the flash->block_erasers[0] member later in this function.