Commit graph

1138 commits

Author SHA1 Message Date
Sham Muthayyan
db4516262a qcom: nand: Issue the Reset command before probe
Reset command must be the first command issued to all
targets after the NAND flash device is powered on.

Change-Id: I617dc5b0ad8d72705dcf20f1cb554134b166e533
Signed-off-by: Sham Muthayyan <smuthayy@codeaurora.org>
2017-10-25 23:45:34 -07:00
Sham Muthayyan
23f9381f86 ipq807x: Add 4byte mode support for Winbond nor flash
Change-Id: I4f31612091bff4f03527fbfd41f02f4a7267f248
Signed-off-by: Sham Muthayyan <smuthayy@codeaurora.org>
2017-10-25 04:25:04 -07:00
Sham Muthayyan
da2e958e58 ipq807x: Added the W25Q256JW flash support
Change-Id: Iee648d783567ed2b6ff09addbb000709fa6461ff
Signed-off-by: Sham Muthayyan <smuthayy@codeaurora.org>
2017-09-14 01:56:40 -07:00
Abhishek Sahu
3813ce677b ubi: fix data aborts in case of NAND bit flips during block read
The UBI layer generates the following data aborts if any of the
NAND block contains bit flips

    ubi0: attaching mtd2
    ubi0: fixable bit-flip detected at PEB 149
    ubi0: scanning is finished
    ubi0: fixable bit-flip detected at PEB 149
    data abort
    pc : [<4a934cc8>]          lr : [<4a933aec>]
    reloc pc : [<4a934cc8>]    lr : [<4a933aec>]
    sp : 4a77f2e0  ip : 00000095     fp : 00000075
    r10: 000001b7  r9 : 4a77fea0     r8 : 00000001
    r7 : 0001f000  r6 : 0001f000     r5 : 4a785e40  r4 : 4a7c4180
    r3 : 00000000  r2 : 00000075     r1 : 4a7860b8  r0 : 4a7c49c0
    Flags: nzcv  IRQs off  FIQs off  Mode SVC_32
    Resetting CPU ...

UBI layer will move the data from original block to some other
block in case of bit flips in the function ubi_eba_copy_leb. This
function uses volume EBA table vol->eba_tbl. The current UBI code
calls ubi_wl_init followed by ubi_eba_init but the ubi_eba_init
only initializes the volume EBA table. In case of bit failure,
the ubi_wl_init calls function __schedule_ubi_work which will
call ubi_eba_copy_leb and triggers data abort.

ubi_attach() {
    ubi_wl_init ->  __schedule_ubi_work -> ubi_eba_copy_leb
    ubi_eba_init
}

The UBI code has been written for Linux kernel and it has been
ported to UBOOT. Since UBOOT does not support threads so all the
thread functions are being called in uboot synchronously.
In Linux kernel, the UBI background thread starts
after the initialization, which is being controlled by
thread_enabled variable which will be set to true after all
initialization.

Now this patch checks for thread_enabled variable and call the
do_work only if the thread is enabled.

Change-Id: I4b2b40031dbd5f16ceefef541248973ca326cd9c
Signed-off-by: Abhishek Sahu <absahu@codeaurora.org>
2017-09-05 16:52:06 +05:30
Linux Build Service Account
9c30999bb6 Merge "qcom: nand: fix NAND dummy spare area programming" 2017-08-03 05:36:34 -07:00
Linux Build Service Account
16562b7f20 Merge "qcom: nand: fixed the 8 bit NAND ECC support" 2017-08-03 05:36:34 -07:00
Vasudevan Murugesan
6ebedacfc5 ipq807x: Fixed flash ID for MX25U3235F
Change-Id: Ie9e2224b963428386f6970ef5950a9d04ac3cad8
Signed-off-by: Vasudevan Murugesan <vmuruges@codeaurora.org>
2017-07-27 02:15:14 -07:00
Abhishek Sahu
98c1c8e9db qcom: nand: fix NAND dummy spare area programming
NAND_CMD_PRG_PAGE_ALL uses the spare data from buffer itself
which is not applicable. The spare area in NAND page for
QPIC are dummy bytes so 0xff should be written to these
spare area. NAND_CMD_PRG_PAGE does the same thing and HLOS
driver uses this command for all page program
operations.  The actual spare data is being written along
with every codeword since the codewords size is 516 in which
512 bytes are user data and 4 bytes are spare data.

Change-Id: I5651caf5ea95f046570e8318f59e140398869ece
Signed-off-by: Abhishek Sahu <absahu@codeaurora.org>
2017-06-26 04:33:46 -07:00
Abhishek Sahu
25137add04 qcom: nand: fixed the 8 bit NAND ECC support
1. This driver is directly being registered with MTD
   layer so for OOB operations, the device OOB size will be
   passed. QPIC can’t handle the complete OOB so calculate QPIC
   supported OOB size and overwrite the device OOB size with
   QPIC supported OOB size.

2. OOB available calculation was wrong. The available OOB’s are
   4 bytes per codeword.

3. Raw configuration codeword size was hardcoded to 528 while 8
   bit ECC codeword size is 532.

Change-Id: Idc118e2fdd9882758da9dc6b1e977e04697a5640
Signed-off-by: Abhishek Sahu <absahu@codeaurora.org>
2017-06-26 04:33:36 -07:00
Abhishek Sahu
4d61ddbda3 qcom: nand: configure QPIC XFER STEPS registers
The QPIC XFER STEPS will not be configured in non NAND boot
mode and the data transfer speed will be very slow. Now this
patch reads the timing parameter from ONFI page and configures
the NAND XFER STEPS registers for highest supported ONFI mode.
For NON ONFI device, it will configure to default mode.

Change-Id: I2daf4a92255307efc53db9bb7fe2f02e8c00c3fa
Signed-off-by: Abhishek Sahu <absahu@codeaurora.org>
2017-06-22 23:48:48 -07:00
Prabhu Jayakumar
97c3087906 qca: move ARM specific files to another sublevel
As the U-boot source is going to be common between ARM and MIPS
architecture , it is required to pick only the files specific
to the respective architectures during the build.

So, move the qca arm target specific common files to another
sub level by specifying the ARCH arm.

Change-Id: I06b538834109981f21fef6270bfb8e437a2f5a7e
Signed-off-by: Prabhu Jayakumar <pjayak@codeaurora.org>
2017-01-06 12:33:30 +05:30
Gokul Sriram Palanisamy
5c0dd6970e ARM: qca: ipq8074: Added support for NOR+NAND
Change includes
1. Device tree entry for SPI_NOR GPIO configuration
2. Register SPI_NOR as psudo NAND

Change-Id: I4d271dcd2970af370975e4a8d9a78199e1cfd2a2
Signed-off-by: Gokul Sriram Palanisamy <gpalan@codeaurora.org>
2016-12-02 15:17:35 +05:30
Ajay Kishore
d38583f326 ipq806x: nand: Add missing writebufsize initialization for ubi fastmap
The writebufsize is introduced in mtd struct for the ubi fastmap
support.
This is not initialized in the qpic nand driver which leads to ubi
error.
Fixed the following ubi error.
	bad write buffer size 0 for 2048 min. I/O unit
	UBI init error 22

Change-Id: I35778366b95930bd01108bf300f073ee21940bc6
Signed-off-by: Ajay Kishore <akisho@codeaurora.org>
2016-10-20 13:02:43 +05:30
Gokul Sriram Palanisamy
96fa862182 qca: moving qpic-nand initialization to common location
Moves qpic-nand configuration and gpio initialization routine
to common location.

Change-Id: Ic78230d4e66450bb6804cf9cbd79cec9e8d2f5df
Signed-off-by: Gokul Sriram Palanisamy <gpalan@codeaurora.org>
2016-10-18 05:27:50 -07:00
Sham Muthayyan
7da9e191b4 mtd: nand: Fixed the nand controller for IPQ806x
Change-Id: I3d5ca487d809f72f3b2015f7dd02eb5b4daf536d
Signed-off-by: Sham Muthayyan <smuthayy@codeaurora.org>
2016-10-17 02:34:24 -07:00
Sham Muthayyan
d3c1ef65db mtd: nand: Add nand controller driver for IPQ806x
Change-Id: Ie424c792da6cd0850ecbc0236e62102cf18e38f6
Signed-off-by: Sham Muthayyan <smuthayy@codeaurora.org>
2016-10-17 02:33:39 -07:00
Gokul Sriram Palanisamy
5b87057c5d qcom: nand: Add missing writebufsize initialization for ubi fastmap
The writebufsize is introduced in mtd struct for the ubi fastmap
support.
This is not initialized in the qpic nand driver which leads to ubi
error.
Fixed the following ubi error.
	bad write buffer size 0 for 2048 min. I/O unit
	UBI init error 22

Change-Id: Ie523affe2d202f0e7b3e17dc4ecec19f7c02de27
Signed-off-by: Gokul Sriram Palanisamy <gpalan@codeaurora.org>
2016-08-31 21:59:25 -07:00
Gokul Sriram Palanisamy
3891c01666 qca: Moved CONFIG_SF_DEFAULT_SPEED to board specific
To avoid compiler warning.

Change-Id: Iedbbbe9166af77286715c7a6b09a90f00cb3b34e
Signed-off-by: Gokul Sriram Palanisamy <gpalan@codeaurora.org>
2016-07-27 01:59:36 -07:00
Saravanan Jaganathan
2230d5482d qca: ipq: Fixed compiler warnings
Fixed warnings for both ipq807x and ipq40xx
builds.

Change-Id: I69accebf525ee52f470335a14474378f5e7f65b0
Signed-off-by: Saravanan Jaganathan <sjaganat@codeaurora.org>
2016-07-09 17:41:34 +05:30
Sham Muthayyan
2a8bb9d7d7 qcom: nand: Add IPQ807x support
Change-Id: If83199c83275dba83350ddbf0f2d3a80de3e9c65
Signed-off-by: Sham Muthayyan <smuthayy@codeaurora.org>
2016-06-27 06:40:50 -07:00
Sham Muthayyan
32d68e6e5b ipq807x: QPIC NAND Makefile and board file changes
Change-Id: I67aeca19bcb7bdc5c83cb1fc6666cdb55bb24c37
Signed-off-by: Sham Muthayyan <smuthayy@codeaurora.org>
2016-06-27 19:09:37 +05:30
Sham Muthayyan
df863e53b2 qcom: nand: Add QPIC NAND driver with BAM support
These files are copied from
https://us.codeaurora.org/cgit/quic/qsdk/oss/boot/uboot-1.0/tree/arch/arm/include/asm/arch-qcom-common/qpic_nand.h
https://us.codeaurora.org/cgit/quic/qsdk/oss/boot/uboot-1.0/tree/drivers/mtd/qpic_nand.c

Change-Id: I21956eae14487086680d81c21468dbde1306a8e2
Signed-off-by: Sham Muthayyan <smuthayy@codeaurora.org>
2016-06-24 16:57:43 +05:30
Linux Build Service Account
89cefaa85b Merge changes I22bde577,I1aad7193,Ic7849ca2 into eggplant
* changes:
  qca: ipq40xx: Expose SPI driver as pseudo NAND driver
  qca: ipq40xx: Adding files scm.c and scm.h
  qca: ipq40xx: Configure u-boot environment in nand
2016-06-02 23:13:07 -07:00
Vasudevan Murugesan
a6f449b528 ipq807x: Modified micron flash params to support RUMI
Change-Id: I08c52c7218e01170c5fe489f1e910ccd2abfd852
Signed-off-by: Vasudevan Murugesan <vmuruges@codeaurora.org>
2016-04-29 11:35:42 +05:30
Vasudevan Murugesan
4cf0b0294a ipq807x: Enabled spi-nor flash support
Change-Id: Id3b876e9d3c00268e608a2fcb76a30a38d965e48
Signed-off-by: Vasudevan Murugesan <vmuruges@codeaurora.org>
2016-04-27 11:44:00 +05:30
Akila N
1149982888 qca: ipq40xx: Expose SPI driver as pseudo NAND driver
Change-Id: I22bde577152837b4e8ca5b09e1a0985462fcb1c9
Signed-off-by: Akila N <akilan@codeaurora.org>
2016-04-20 11:29:45 +05:30
Akila N
1aa59e6721 qca: ipq40xx: Enable spi nor driver in fifo mode
Change-Id: I641f2a206f0537c6b715841447100dcbe89f87b3
Signed-off-by: Akila N <akilan@codeaurora.org>
2016-04-18 15:38:30 +05:30
Tom Rini
67ecb84ccb Merge branch 'master' of git://git.denx.de/u-boot-spi 2016-01-07 12:41:57 -05:00
Fabio Estevam
5092158359 spi: spi_flash: Fix the arguments of stm_is_locked_sr()
stm_is_locked_sr() takes the status register (SR) value as the last
parameter, not the second.

Based on a patch from Brian Norris for the linux kernel:
http://git.infradead.org/linux-mtd.git/commit/a32d5b726ff8cf32bf491522b0ac8ae2545a063e

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Jagan Teki <jteki@openedev.com>
2016-01-07 20:29:33 +05:30
Ladislav Michl
6a4595600b UBI: Fix compile error when CONFIG_UBI_SILENCE_MSG defined
drivers/mtd/ubi/io.c:1354:3: error: 'dump_len' undeclared (first use in
this function)
   dump_len = max_t(int, 128, len - i);

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
2016-01-04 09:11:10 +01:00
Thomas Chou
8e8106dcd5 altera_qspi: allow ctrl-c to abort the erase ops
Allow ctrl-c to abort the erase ops.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
2015-12-28 09:32:43 +08:00
Thomas Chou
d579d38f3f altera_qspi: show erase progress
Show sector erase progress with dot and comma.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
2015-12-28 09:32:43 +08:00
Thomas Chou
f81a673ec4 altera_qspi: skip erase if the sector is blank
Skip erase if the sector is blank. The sector erase is slow, and
may take 0.7 sec typically or up to 3 sec worst-case.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
2015-12-28 09:32:43 +08:00
Thomas Chou
a1b1d7eceb altera_qspi: set fail_addr for erase ops
If the erase fails, fail_addr might indicate exactly which block
failed. If fail_addr = MTD_FAIL_ADDR_UNKNOWN, the failure was not
at the device level or was not specific to any particular block.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
2015-12-28 09:32:43 +08:00
Thomas Chou
9e957aa4ce altera_qspi: call callback even if the erase failed
Erase is an asynchronous operation.  Device drivers are supposed
to call instr->callback() whenever the operation completes, even
if it completes with a failure.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
2015-12-28 09:32:43 +08:00
Thomas Chou
1c0e84ca82 altera_qspi: initialize instr.mtd in flash_erase
Initialize instr.mtd in flash_erase(). This fixes the system
hang issue when CONFIG_MTD_PARTITIONS is selected.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Marek Vasut <marex@denx.de>
2015-12-19 09:51:19 +08:00
Jagan Teki
cba65a77c4 sf: Rename sf_ops.c to spi-flash.c
Since all spi-flash core operations are moved into
sf_ops.c then it's better to renamed as spi-flash.c

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Jagan Teki <jteki@openedev.com>
2015-12-11 22:12:24 +05:30
Jagan Teki
339fd6dca5 sf: Use static for file-scope functions
Used static for file-scope functions in sf_probe.c

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Jagan Teki <jteki@openedev.com>
2015-12-11 22:12:24 +05:30
Jagan Teki
bfdb07eb4b sf: sf_probe: Remove spi_slave pointer argument
Since spi_slave is a spi pointer in spi_flash{} then assign
spi_slave{} pointer to flash->spi and remove spi_slave
pointer argument to
- spi_flash_probe_slave
- spi_flash_scan

Tested-by: Jagan Teki <jteki@openedev.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Jagan Teki <jteki@openedev.com>
2015-12-11 22:12:24 +05:30
Jagan Teki
b6a2c436e0 sf: ops: Fix missing break on spansion read_bar
For assigning read_bar commands in spansion case, break
is missing this patch add that break.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Jagan Teki <jteki@openedev.com>
2015-12-11 22:12:24 +05:30
Jagan Teki
aae00f8bab sf: Remove unneeded SST_BP and SST_WP
SST parts added on sf_params.c supports both SST_WR which consits
of both BP and WP and there is a spi controller ich which supports
only BP so the relevent _write hook set based on "slave->op_mode_tx"
hence there is no respective change required from flash side hance
removed these.

Tested-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Jagan Teki <jteki@openedev.com>
2015-12-11 22:12:24 +05:30
Jagan Teki
615879ac1a sf: Remove unneeded header includes
Removed unneeded header includes in sf_ops and sf_probe

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Jagan Teki <jteki@openedev.com>
2015-12-11 22:12:24 +05:30
Jagan Teki
6f9d670d8e sf: Flash power up read-only based on idcode0
Using macro's for flash power up read-only access code
leads wrong behaviour hence use idcode0 for runtime
detection, hence the flash which require this functionality
gets detected at runtime.

Tested-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Jagan Teki <jteki@openedev.com>
2015-12-11 22:12:24 +05:30
Jagan Teki
cb37518516 sf: Use simple name for register access functions
Most of the register access function are static,
so used simple name to represent each.

Tested-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Jagan Teki <jteki@openedev.com>
2015-12-11 22:12:23 +05:30
Jagan Teki
fc335d63b0 sf: Fix Makefile
This patch removes unneeded ifdef and fixed accordingly.

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Jagan Teki <jteki@openedev.com>
2015-12-11 22:12:23 +05:30
Jagan Teki
6fa40e796c sf: Use static for file-scope functions
Use static for file-scope functions and removed
them from header files.

Tested-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Jagan Teki <jteki@openedev.com>
2015-12-11 22:12:23 +05:30
Jagan Teki
0edae52f08 sf: probe: Code cleanup
- Move bar read code below the bar write hance both
  at once place, hence it easy for #ifdef macro only
  once and readable.
- Move read_cmd_array at top

Tested-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Jagan Teki <jteki@openedev.com>
2015-12-11 22:12:23 +05:30
Jagan Teki
1e90d9fd31 sf: Move read_id code to sf_ops
read_id code is related to spi_flash stuff
hence moved to sf_ops.

Tested-by: Jagan Teki <jteki@openedev.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Jagan Teki <jteki@openedev.com>
2015-12-11 22:12:23 +05:30
Jagan Teki
3847c0c180 sf: Move spi_flash_scan code to sf_ops
Intension is that sf_ops should deals all spi_flash
related stuff and sf_probe (which should renamed future)
should be an interface layer for spi_flash versus spi drivers.

sf_ops => spi_flash interface
sf_probe => interface layer vs spi_flash(sf_probe) to spi drivers

Tested-by: Jagan Teki <jteki@openedev.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Jagan Teki <jteki@openedev.com>
2015-12-11 22:12:23 +05:30
Jagan Teki
3a1adb621b sf: spi_flash_validate_params => spi_flash_scan
Rename spi_flash_validate_params to spi_flash_scan
as this code not only deals with params setup but
also configure all spi_flash attributes.

And also moved all flash related code into
spi_flash_scan for future functionality addition.

Tested-by: Jagan Teki <jteki@openedev.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Jagan Teki <jteki@openedev.com>
2015-12-11 22:12:23 +05:30