Merge tag 'u-boot-rockchip-20200501' of https://gitlab.denx.de/u-boot/custodians...
[platform/kernel/u-boot.git] / drivers / mtd / spi / spi-nor-core.c
index d7020c1..e840c60 100644 (file)
@@ -10,6 +10,8 @@
  */
 
 #include <common.h>
+#include <dm/device_compat.h>
+#include <dm/devres.h>
 #include <linux/err.h>
 #include <linux/errno.h>
 #include <linux/log2.h>
@@ -323,6 +325,7 @@ static int set_4byte(struct spi_nor *nor, const struct flash_info *info,
        case SNOR_MFR_MICRON:
                /* Some Micron need WREN command; all will accept it */
                need_wren = true;
+       case SNOR_MFR_ISSI:
        case SNOR_MFR_MACRONIX:
        case SNOR_MFR_WINBOND:
                if (need_wren)
@@ -1244,11 +1247,8 @@ static int spi_nor_write(struct mtd_info *mtd, loff_t to, size_t len,
                 * If page_size is a power of two, the offset can be quickly
                 * calculated with an AND operation. On the other cases we
                 * need to do a modulus operation (more expensive).
-                * Power of two numbers have only one bit set and we can use
-                * the instruction hweight32 to detect if we need to do a
-                * modulus (do_div()) or not.
                 */
-               if (hweight32(nor->page_size) == 1) {
+               if (is_power_of_2(nor->page_size)) {
                        page_offset = addr & (nor->page_size - 1);
                } else {
                        u64 aux = addr;