per NXP UM10398 26.7.1, this should be the number of the last sector to prepare/erase, so it should be (addr  + len - 1) / 4096.