drivers: spi_flash: add erase boundary check and correct an error
drivers: spi_flash: add erase boundary check and correct an error

Add spi flash erase boundary check. The erase boundary must be
4K-aligned. So, the flash chip will round down an non-4K aligned
address to the nearest 4K boundary automatically. As a result of
this, the erase area will start from a different address (if the
API caller specifies an non-4K alighed address), even though the
size of the erased area is the same as what is specified by the
API caller. Let's add a boundary check to make sure the starting
address (from the API caller) is 4K aligned.

Correct an error in the highest address check. Because of the
error, the erase api call will fail if the flash's highest
address byte is involved.

Jira: ZEP-1277 ZEP-1278

Change-Id: I8b6be57cc8f636f94e5fe67d5a492841a8555005
Signed-off-by: Baohong Liu <04f4a475e25708ef58f834bd7b5f2fc86c2e7841@intel.com>

kraj/zephyr,fbsder/zephyr,Vudentz/zephyr,mbolivar/zephyr,kraj/zephyr,ldts/zephyr,tidyjiang8/zephyr-doc,runchip/zephyr-cc3200,aceofall/zephyr-iotos,bigdinotech/zephyr,pklazy/zephyr,kraj/zephyr,bboozzoo/zephyr,ldts/zephyr,GiulianoFranchetto/zephyr,finikorg/zephyr,sharronliu/zephyr,zephyriot/zephyr,holtmann/zephyr,rsalveti/zephyr,bboozzoo/zephyr,zephyrproject-rtos/zephyr,sharronliu/zephyr,rsalveti/zephyr,runchip/zephyr-cc3220,erwango/zephyr,fractalclone/zephyr-riscv,punitvara/zephyr,nashif/zephyr,Vudentz/zephyr,zephyrproject-rtos/zephyr,GiulianoFranchetto/zephyr,Vudentz/zephyr,nashif/zephyr,runchip/zephyr-cc3200,zephyriot/zephyr,runchip/zephyr-cc3220,galak/zephyr,ldts/zephyr,punitvara/zephyr,tidyjiang8/zephyr-doc,punitvara/zephyr,pklazy/zephyr,erwango/zephyr,finikorg/zephyr,runchip/zephyr-cc3200,bigdinotech/zephyr,galak/zephyr,ldts/zephyr,nashif/zephyr,erwango/zephyr,pklazy/zephyr,pklazy/zephyr,bboozzoo/zephyr,fbsder/zephyr,runchip/zephyr-cc3220,runchip/zephyr-cc3220,tidyjiang8/zephyr-doc,GiulianoFranchetto/zephyr,runchip/zephyr-cc3200,rsalveti/zephyr,sharronliu/zephyr,runchip/zephyr-cc3220,Vudentz/zephyr,finikorg/zephyr,zephyriot/zephyr,explora26/zephyr,galak/zephyr,finikorg/zephyr,ldts/zephyr,aceofall/zephyr-iotos,sharronliu/zephyr,pklazy/zephyr,galak/zephyr,kraj/zephyr,fbsder/zephyr,sharronliu/zephyr,fbsder/zephyr,rsalveti/zephyr,bigdinotech/zephyr,aceofall/zephyr-iotos,zephyriot/zephyr,bboozzoo/zephyr,mbolivar/zephyr,holtmann/zephyr,explora26/zephyr,zephyriot/zephyr,bigdinotech/zephyr,GiulianoFranchetto/zephyr,erwango/zephyr,mbolivar/zephyr,erwango/zephyr,Vudentz/zephyr,kraj/zephyr,nashif/zephyr,aceofall/zephyr-iotos,punitvara/zephyr,explora26/zephyr,finikorg/zephyr,fractalclone/zephyr-riscv,aceofall/zephyr-iotos,rsalveti/zephyr,mbolivar/zephyr,tidyjiang8/zephyr-doc,fbsder/zephyr,fractalclone/zephyr-riscv,nashif/zephyr,punitvara/zephyr,galak/zephyr,GiulianoFranchetto/zephyr,holtmann/zephyr,holtmann/zephyr,explora26/zephyr,mbolivar/zephyr,zephyrproject-rtos/zephyr,tidyjiang8/zephyr-doc,fractalclone/zephyr-riscv,explora26/zephyr,bboozzoo/zephyr,holtmann/zephyr,Vudentz/zephyr,zephyrproject-rtos/zephyr,zephyrproject-rtos/zephyr,bigdinotech/zephyr,runchip/zephyr-cc3200,fractalclone/zephyr-riscv