Merge branch 'msm-next' of git://people.freedesktop.org/~robclark/linux into drm...
[platform/adaptation/renesas_rcar/renesas_kernel.git] / drivers / mtd / devices / m25p80.c
index 19632e3..ad19139 100644 (file)
@@ -489,6 +489,16 @@ static inline int m25p80_dummy_cycles_read(struct m25p *flash)
        }
 }
 
+static inline unsigned int m25p80_rx_nbits(const struct m25p *flash)
+{
+       switch (flash->flash_read) {
+       case M25P80_QUAD:
+               return 4;
+       default:
+               return 0;
+       }
+}
+
 /*
  * Read an address range from the flash chip.  The address range
  * may be any size provided it is within the physical boundaries.
@@ -519,6 +529,7 @@ static int m25p80_read(struct mtd_info *mtd, loff_t from, size_t len,
        spi_message_add_tail(&t[0], &m);
 
        t[1].rx_buf = buf;
+       t[1].rx_nbits = m25p80_rx_nbits(flash);
        t[1].len = len;
        spi_message_add_tail(&t[1], &m);
 
@@ -943,7 +954,7 @@ static const struct spi_device_id m25p_ids[] = {
        { "s25sl064p",  INFO(0x010216, 0x4d00,  64 * 1024, 128, 0) },
        { "s25fl256s0", INFO(0x010219, 0x4d00, 256 * 1024, 128, 0) },
        { "s25fl256s1", INFO(0x010219, 0x4d01,  64 * 1024, 512, M25P80_QUAD_READ) },
-       { "s25fl512s",  INFO(0x010220, 0x4d00, 256 * 1024, 256, 0) },
+       { "s25fl512s",  INFO(0x010220, 0x4d00, 256 * 1024, 256, M25P80_QUAD_READ) },
        { "s70fl01gs",  INFO(0x010221, 0x4d00, 256 * 1024, 256, 0) },
        { "s25sl12800", INFO(0x012018, 0x0300, 256 * 1024,  64, 0) },
        { "s25sl12801", INFO(0x012018, 0x0301,  64 * 1024, 256, 0) },
@@ -1204,6 +1215,8 @@ static int m25p_probe(struct spi_device *spi)
                /* If we were instantiated by DT, use it */
                if (of_property_read_bool(np, "m25p,fast-read"))
                        flash->flash_read = M25P80_FAST;
+               else
+                       flash->flash_read = M25P80_NORMAL;
        } else {
                /* If we weren't instantiated by DT, default to fast-read */
                flash->flash_read = M25P80_FAST;