aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/layerscape/patches-4.4/1093-mtd-spi-nor-check-return-value-from-read-write.patch
diff options
context:
space:
mode:
authorYutang Jiang <yutang.jiang@nxp.com>2016-10-29 00:18:23 +0800
committerJohn Crispin <john@phrozen.org>2016-10-31 17:00:10 +0100
commit15a14cf1665ef3d8b5c77cce69b52d131340e3b3 (patch)
treebd544b24bd3e7fc7efc61f80e1755274971c5582 /target/linux/layerscape/patches-4.4/1093-mtd-spi-nor-check-return-value-from-read-write.patch
parentc6c731fe311f7da42777ffd31804a4f6aa3f8e19 (diff)
downloadupstream-15a14cf1665ef3d8b5c77cce69b52d131340e3b3.tar.gz
upstream-15a14cf1665ef3d8b5c77cce69b52d131340e3b3.tar.bz2
upstream-15a14cf1665ef3d8b5c77cce69b52d131340e3b3.zip
layerscape: add 64b/32b target for ls1012ardb device
The QorIQ LS1012A processor, optimized for battery-backed or USB-powered, integrates a single ARM Cortex-A53 core with a hardware packet forwarding engine and high-speed interfaces to deliver line-rate networking performance. QorIQ LS1012A Reference Design System (LS1012ARDB) is a high-performance development platform, with a complete debugging environment. The LS1012ARDB board supports the QorIQ LS1012A processor and is optimized to support the high-bandwidth DDR3L memory and a full complement of high-speed SerDes ports. LEDE/OPENWRT will auto strip executable program file while make. So we need select CONFIG_NO_STRIP=y while make menuconfig to avoid the ppfe network fiemware be destroyed, then run make to build ls1012ardb firmware. The fsl-quadspi flash with jffs2 fs is unstable and arise some failed message. This issue have noticed the IP owner for investigate, hope he can solve it earlier. So the ls1012ardb now also provide a xx-firmware.ext4.bin as default firmware, and the uboot bootcmd will run wrtboot_ext4rfs for "rootfstype=ext4" bootargs. Signed-off-by: Yutang Jiang <yutang.jiang@nxp.com>
Diffstat (limited to 'target/linux/layerscape/patches-4.4/1093-mtd-spi-nor-check-return-value-from-read-write.patch')
-rw-r--r--target/linux/layerscape/patches-4.4/1093-mtd-spi-nor-check-return-value-from-read-write.patch127
1 files changed, 127 insertions, 0 deletions
diff --git a/target/linux/layerscape/patches-4.4/1093-mtd-spi-nor-check-return-value-from-read-write.patch b/target/linux/layerscape/patches-4.4/1093-mtd-spi-nor-check-return-value-from-read-write.patch
new file mode 100644
index 0000000000..0721a067af
--- /dev/null
+++ b/target/linux/layerscape/patches-4.4/1093-mtd-spi-nor-check-return-value-from-read-write.patch
@@ -0,0 +1,127 @@
+From 8527843351169d999995d331bbdad75560ccafb2 Mon Sep 17 00:00:00 2001
+From: Michal Suchanek <hramrach@gmail.com>
+Date: Wed, 2 Dec 2015 10:38:20 +0000
+Subject: [PATCH 093/113] mtd: spi-nor: check return value from read/write
+
+SPI NOR hardware drivers now return useful value from their read/write
+functions so check them.
+
+Signed-off-by: Michal Suchanek <hramrach@gmail.com>
+Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@freescale.com>
+---
+ drivers/mtd/spi-nor/spi-nor.c | 50 +++++++++++++++++++++++++++++------------
+ 1 file changed, 36 insertions(+), 14 deletions(-)
+
+--- a/drivers/mtd/spi-nor/spi-nor.c
++++ b/drivers/mtd/spi-nor/spi-nor.c
+@@ -922,7 +922,10 @@ static int spi_nor_read(struct mtd_info
+ ret = nor->read(nor, from, len, retlen, buf);
+
+ spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_READ);
+- return ret;
++ if (ret < 0)
++ return ret;
++
++ return 0;
+ }
+
+ static int sst_write(struct mtd_info *mtd, loff_t to, size_t len,
+@@ -948,10 +951,14 @@ static int sst_write(struct mtd_info *mt
+ nor->program_opcode = SPINOR_OP_BP;
+
+ /* write one byte. */
+- nor->write(nor, to, 1, retlen, buf);
++ ret = nor->write(nor, to, 1, retlen, buf);
++ if (ret < 0)
++ goto sst_write_err;
++ WARN(ret != 1, "While writing 1 byte written %i bytes\n",
++ (int)ret);
+ ret = spi_nor_wait_till_ready(nor);
+ if (ret)
+- goto time_out;
++ goto sst_write_err;
+ }
+ to += actual;
+
+@@ -960,10 +967,14 @@ static int sst_write(struct mtd_info *mt
+ nor->program_opcode = SPINOR_OP_AAI_WP;
+
+ /* write two bytes. */
+- nor->write(nor, to, 2, retlen, buf + actual);
++ ret = nor->write(nor, to, 2, retlen, buf + actual);
++ if (ret < 0)
++ goto sst_write_err;
++ WARN(ret != 2, "While writing 2 bytes written %i bytes\n",
++ (int)ret);
+ ret = spi_nor_wait_till_ready(nor);
+ if (ret)
+- goto time_out;
++ goto sst_write_err;
+ to += 2;
+ nor->sst_write_second = true;
+ }
+@@ -972,21 +983,24 @@ static int sst_write(struct mtd_info *mt
+ write_disable(nor);
+ ret = spi_nor_wait_till_ready(nor);
+ if (ret)
+- goto time_out;
++ goto sst_write_err;
+
+ /* Write out trailing byte if it exists. */
+ if (actual != len) {
+ write_enable(nor);
+
+ nor->program_opcode = SPINOR_OP_BP;
+- nor->write(nor, to, 1, retlen, buf + actual);
+-
++ ret = nor->write(nor, to, 1, retlen, buf + actual);
++ if (ret < 0)
++ goto sst_write_err;
++ WARN(ret != 1, "While writing 1 byte written %i bytes\n",
++ (int)ret);
+ ret = spi_nor_wait_till_ready(nor);
+ if (ret)
+- goto time_out;
++ goto sst_write_err;
+ write_disable(nor);
+ }
+-time_out:
++sst_write_err:
+ spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_WRITE);
+ return ret;
+ }
+@@ -1015,14 +1029,18 @@ static int spi_nor_write(struct mtd_info
+
+ /* do all the bytes fit onto one page? */
+ if (page_offset + len <= nor->page_size) {
+- nor->write(nor, to, len, retlen, buf);
++ ret = nor->write(nor, to, len, retlen, buf);
++ if (ret < 0)
++ goto write_err;
+ } else {
+ /* the size of data remaining on the first page */
+ page_size = nor->page_size - page_offset;
+- nor->write(nor, to, page_size, retlen, buf);
++ ret = nor->write(nor, to, page_size, retlen, buf);
++ if (ret < 0)
++ goto write_err;
+
+ /* write everything in nor->page_size chunks */
+- for (i = page_size; i < len; i += page_size) {
++ for (i = ret; i < len; ) {
+ page_size = len - i;
+ if (page_size > nor->page_size)
+ page_size = nor->page_size;
+@@ -1033,7 +1051,11 @@ static int spi_nor_write(struct mtd_info
+
+ write_enable(nor);
+
+- nor->write(nor, to + i, page_size, retlen, buf + i);
++ ret = nor->write(nor, to + i, page_size, retlen,
++ buf + i);
++ if (ret < 0)
++ goto write_err;
++ i += ret;
+ }
+ }
+