ar71xx: refresh patches
[openwrt.git] / target / linux / ar71xx / patches-3.14 / 406-mtd-m25p80-allow-to-specify-max-read-size.patch
index 194b8be..d229b7f 100644 (file)
@@ -43,8 +43,7 @@
 +              size_t readlen;
 +              size_t done;
 +              int ret;
--      spi_sync(flash->spi, &m);
++
 +              ret = wait_till_ready(flash);
 +              if (ret) {
 +                      mutex_unlock(&flash->lock);
 +                      readlen = flash->max_read_len;
 +              else
 +                      readlen = len;
--      *retlen = m.actual_length - m25p_cmdsz(flash) - dummy;
++
 +              t[1].rx_buf = buf + ofs;
 +              t[1].rx_nbits = m25p80_rx_nbits(flash);
 +              t[1].len = readlen;
++
 +              m25p_addr2cmd(flash, from + ofs, flash->command);
 +
 +              spi_sync(flash->spi, &m);
-+
+-      spi_sync(flash->spi, &m);
 +              done = m.actual_length - m25p_cmdsz(flash) -
 +                     dummy;
 +              if (done != readlen) {
 +                      mutex_unlock(&flash->lock);
 +                      return 1;
 +              }
-+
+-      *retlen = m.actual_length - m25p_cmdsz(flash) - dummy;
 +              ofs += done;
 +              len -= done;
 +      }
-+
 +      *retlen = ofs;
        mutex_unlock(&flash->lock);
  
        return 0;
-@@ -1193,6 +1217,12 @@ static int m25p_probe(struct spi_device 
+@@ -1193,6 +1217,12 @@ static int m25p_probe(struct spi_device
                flash->mtd._unlock = m25p80_unlock;
        }