openwrtv4/package/boot/uboot-layerscape/patches/0057-driver-spi-Fix-DSPI-bug-after-adding-exceed-16MB-for.patch
Yutang Jiang 15a14cf166 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>
2016-10-31 17:00:10 +01:00

92 lines
3 KiB
Diff

From 0ff26c3761e5a17d21e7ee0bd9a2068f55c84d55 Mon Sep 17 00:00:00 2001
From: Yunhui Cui <yunhui.cui@nxp.com>
Date: Wed, 15 Jun 2016 14:57:08 +0800
Subject: [PATCH 57/93] driver: spi: Fix DSPI bug after adding exceed 16MB for
QSPI
=> sf probe 1:0
SF: Detected N25Q128A with page size 256 Bytes, erase size 64 KiB, total
16 MiB
=> mw.l 80000000 55555555 1100
=> mw.l 80020000 aaaaaaaa 1100
=> sf erase 0 +1100
SF: 65536 bytes @ 0x0 Erased: OK
=> sf write 80020000 0 1100
device 0 offset 0x0, size 0x1100
SF: 4352 bytes @ 0x0 Written: OK
=> sf read 80000000 0 1100
device 0 offset 0x0, size 0x1100
SF: 4352 bytes @ 0x0 Read: OK
=> cmp.b 80000000 80020000 1100
byte at 0x00000000800010fe (0xff) != byte at 0x00000000800210fe (0xaa)
Total of 4350 byte(s) were the same
Signed-off-by: Yunhui Cui <yunhui.cui@nxp.com>
---
drivers/mtd/spi/spi_flash.c | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c
index b0f09ab..e04bd55 100644
--- a/drivers/mtd/spi/spi_flash.c
+++ b/drivers/mtd/spi/spi_flash.c
@@ -326,8 +326,11 @@ int spi_flash_cmd_erase_ops(struct spi_flash *flash, u32 offset, size_t len)
return -EINVAL;
}
}
+ if (flash->size > SPI_FLASH_16MB_BOUN)
+ cmdsz = SPI_FLASH_CMD_LEN_EXT + flash->dummy_byte;
+ else
+ cmdsz = SPI_FLASH_CMD_LEN;
- cmdsz = SPI_FLASH_CMD_LEN_EXT + flash->dummy_byte;
cmd = calloc(1, cmdsz);
if (!cmd) {
debug("SF: Failed to allocate cmd\n");
@@ -353,7 +356,7 @@ int spi_flash_cmd_erase_ops(struct spi_flash *flash, u32 offset, size_t len)
debug("SF: erase %2x %2x %2x %2x (%x)\n", cmd[0], cmd[1],
cmd[2], cmd[3], erase_addr);
- ret = spi_flash_write_common(flash, cmd, sizeof(cmd), NULL, 0);
+ ret = spi_flash_write_common(flash, cmd, cmdsz, NULL, 0);
if (ret < 0) {
debug("SF: erase failed\n");
break;
@@ -385,8 +388,10 @@ int spi_flash_cmd_write_ops(struct spi_flash *flash, u32 offset,
return -EINVAL;
}
}
-
- cmdsz = SPI_FLASH_CMD_LEN_EXT + flash->dummy_byte;
+ if (flash->size > SPI_FLASH_16MB_BOUN)
+ cmdsz = SPI_FLASH_CMD_LEN_EXT + flash->dummy_byte;
+ else
+ cmdsz = SPI_FLASH_CMD_LEN;
cmd = calloc(1, cmdsz);
if (!cmd) {
debug("SF: Failed to allocate cmd\n");
@@ -418,7 +423,7 @@ int spi_flash_cmd_write_ops(struct spi_flash *flash, u32 offset,
debug("SF: 0x%p => cmd = { 0x%02x 0x%02x%02x%02x } chunk_len = %zu\n",
buf + actual, cmd[0], cmd[1], cmd[2], cmd[3], chunk_len);
- ret = spi_flash_write_common(flash, cmd, sizeof(cmd),
+ ret = spi_flash_write_common(flash, cmd, cmdsz,
buf + actual, chunk_len);
if (ret < 0) {
debug("SF: write failed\n");
@@ -482,7 +487,11 @@ int spi_flash_cmd_read_ops(struct spi_flash *flash, u32 offset,
return 0;
}
- cmdsz = SPI_FLASH_CMD_LEN_EXT + flash->dummy_byte;
+ if (flash->size > SPI_FLASH_16MB_BOUN)
+ cmdsz = SPI_FLASH_CMD_LEN_EXT + flash->dummy_byte;
+ else
+ cmdsz = SPI_FLASH_CMD_LEN + flash->dummy_byte;
+
cmd = calloc(1, cmdsz);
if (!cmd) {
debug("SF: Failed to allocate cmd\n");
--
1.7.9.5