Commit graph

1198 commits

Author SHA1 Message Date
Md Sadre Alam
599391c231 driver: mtd: qpic: Enable support for page_scope & multi_page read command.
This change will enable page_scope_read & multipage_read support for
QPIC.
QPIC version 2.0 onwards , QPIC support page_scope_read &
multipage_read command to enhance the read performance.
In normal page read command SW is needed to write EXEC_CMD register
for each Code word and collect any Status related to that CW before
issueing EXEC_CMD for next CW.

For page_scope read command SW is required to issue EXEC_CMD
only once for a page. Controller HW takes care of Codeword specific
details and automatically returns status associated with each CW to
BAM pipe, dedicated for status deposition.

enabling all bits in NAND_AUTO_STATUS_EN will require 4 data
descriptors of 24 bytes each. This will publish all NANDc status
registers in system memory.

For multipage_read command SW is required to issue EXEC_CMD only
once for all the pages which configured in QPIC_NAND_MULTI_PAGE_CMD
register.
All interrupts will be operational and valid in these modes.

To check the status for each codeword, it is not possible to access
the status registers while the read command is operational in
page_scope & multi_page read  modes. Hence, another feature to publish the
status data (for all NAND status registers) by programming the
NAND_AUTO_STATUS_EN register.

For serial NAND:
Read command for page_scope_read = 0x78800032 (QPIC_NAND_FLASH_CMD)
Read command for multi_page_read = 0x78400032 (QPIC_NAND_FLASH_CMD)

For Parallel NAND:
Read command for page_scope_read = 0x00800032 (QPIC_NAND_FLASH_CMD)
Read command for multi_page_read = 0x00400032 (QPIC_NAND_FLASH_CMD)

Now we fixed maximum data bytes read in one go 128KiB(2KiB page),
256KiB (4KiB page), 512 KiB (8kiB page), because from upper layer
we are getting more than 128KiB data bytes request in one go. if so
just changing the value of "MAX_MULTI_PAGE" macro will increase the
maximum data bytes in one go.

Change-Id: I48eea51ff8f5f79f3490d8a538c295ecc3eeee19
Signed-off-by: Md Sadre Alam <mdalam@codeaurora.org>
2020-03-06 15:52:15 +05:30
Gokul Sriram Palanisamy
7f77903353 ipq: Moved board params structure to qca common
Change-Id: I58ac138f4585a64bf1a89302ec212afe133c2101
Signed-off-by: Gokul Sriram Palanisamy <gokulsri@codeaurora.org>
2020-02-10 11:42:21 +05:30
Gokul Sriram Palanisamy
b8b1da8bfd nand: ipq807x: Removed nand_gpio entries from dts
Since nand configuration is fixed across all HK boards,
removing the nand gpio_entries from device tree and
adding static board param entries. This helps reduce
image footprint and opens up space for new board support.

Change-Id: I89bc11165a6cdfcdb3b4650a73cbeea17895f991
Signed-off-by: Gokul Sriram Palanisamy <gokulsri@codeaurora.org>
2020-02-07 16:54:10 +05:30
Vandhiadevan Karunamoorthy
db70e98a74 board: ipq5018: Enable gcc cbcr clk for qpic.
Change-Id: Id30214131b0ef5476437597aba70d81e48fe7c8d
Signed-off-by: Vandhiadevan Karunamoorthy <vkarunam@codeaurora.org>
Signed-off-by: Md Sadre Alam <mdalam@codeaurora.org>
2020-01-23 00:38:21 -08:00
Kathiravan T
3a8f8f7b4b spi_nand: ipq40xx: enable support for Fidelix SPI NAND
Fidelix SPI NAND FM35X2GA has two planes namely plane 0 and plane 1.
This change adds the support to calculate the plane bit accordingly
and use the same for command formation.

Change-Id: I6fb4b652e1c897f248cb9ad8914f67be7a7365f3
Signed-off-by: Kathiravan T <kathirav@codeaurora.org>
2020-01-06 21:09:01 -08:00
Linux Build Service Account
5d3735cfac Merge "ipq5018: Enable support for serial nand in qpic" 2019-12-25 18:31:09 -08:00
Md Sadre Alam
2c13362d84 ipq5018: Enable support for serial nand in qpic
This change will add support for serial nand.

QPIC-2.1.1 supports parallel nand as well as serial nand.

QPIC will operate either in parallel configuration or
serial nand. Both can't work together.

This change will support initially four serial nand parts.

MT29F1G01ABBFDWB-IT (Micron-0x2C,0x15, 2K + 128)

GD5F1GQ4RE9IG (Giga Device-0xC8,0xC1, 2K + 128)

GD5F2GQ5REYIH (Giga Device-0xC8,0x22, 2K + 64)

GD5F1GQ4RE9IH (Giga Device-0xC8, 0xC9, 2K + 64)

Device Internal ECC is disabled for all three devices. This change will
enabele QPIC ECC engine.

For MT29F1G01ABBFDWB-IT 4-bit ECC as well 8-bit ECC will be supported.

For  GD5F1GQ4RE9IG 4-bit ECC as well 8-bit ECC will be supported.

For GD5F2GQ5REYIH only 4-bit ECC will be supported due to 64-bytes spare.

For GD5F1GQ4RE9IH only 4-bit ECC will be supported due to 64-bytes spare.

Change-Id: I3f38f9c76b7bb235bb335a481fbc42ae1bd00395
Signed-off-by: Md Sadre Alam <mdalam@codeaurora.org>
2019-12-23 11:54:23 +05:30
Antony Arun T
687d46c783 ipq807x: fix nand flash size issue
This patch fixes the nand flash size access issue
found in flash with two logical units

Change-Id: Ifcbaa40709c4ac5d508b629fcc6cf7006f167628
Signed-off-by: Antony Arun T <antothom@codeaurora.org>
2019-12-12 17:26:53 +05:30
Vandhiadevan Karunamoorthy
a13842f5cf ipq5018: spi-nor: Add offset 0x0 erase support for S25FL128S_64K
Note : This S25FL128S_64K chip has Hybrid sector's
First 64Kb (4Kb * 8 + 32Kb) and rest all 64Kb sectors

Change-Id: Ibac9bd9dbd7b5a4eb1c31427b4d315fc5353ec62
Signed-off-by: Vandhiadevan Karunamoorthy <vkarunam@codeaurora.org>
2019-11-05 10:32:27 +05:30
Md Sadre Alam
f2ed166473 driver: mtd: Add support to read entire ONFI parameter page structure.
This change will read entire ONFI parameter page. This will helpful
while validating new ONFI AVL part.

To read entire ONFI parameter page data structure use command:

"#nand onfipara".

Change-Id: Icea80fce6900716871d8c82a2d1ac0c00531af98
Signed-off-by: Md Sadre Alam <mdalam@codeaurora.org>
2019-06-11 22:51:13 +05:30
Linux Build Service Account
62ace151d1 Merge "ipq807x: Add support for 512M Toshiba Nand in U-Boot" 2019-06-07 15:35:28 -07:00
sameeruddin shaik
4b4060b8c8 ipq807x: Add support for 512M Toshiba Nand in U-Boot
This device is non onfi device, so adding the device id
and oob information in the nand_ids table.
1.pagesize:2048 bytes
2.oob size:128bytes
3.Ecc:8bits for 512 bytes
4.Manufacturer & device id: 0x98, 0xaC

Change-Id: I43f2ffb33b82b6dbf9da7adbef8e4e93f6d94c87
Signed-off-by: sameeruddin shaik <samesh@codeaurora.org>
2019-06-03 15:38:26 +05:30
Md Sadre Alam
39c56dd3a0 driver: spi: Add support for Macronix-(MX25U51245G) nor flash.
This change is to add support for Macronix-(MX25U51245G) nor
flash device.

The total density of this device is 64 MiB. Sector size 64K.
64K sector we are cosidering due to 64K sector size works with
CMD_ERASE_64K.

Total number of sector for this device will 1024 because,

64K * 1024 = 64MiB.

Change-Id: Ia1f2117bc42457e4b3c25934ff1fdcb798e4ea6f
Signed-off-by: Md Sadre Alam <mdalam@codeaurora.org>
2019-05-31 10:43:45 +05:30
Md Sadre Alam
648bdc897b driver: spi: Add support for Macronix-(MX66U1G45GMI00) nor flash.
This change is to add support for Macronix-(MX66U1G45GMI00) nor
flash device.

The total density of this device is 128 MiB. Sector size 64K.
64K sector we are cosidering due to 64K sector size works with
CMD_ERASE_64K.

Total number of sector for this device will 2048 because,

64K * 2048 = 128MiB.

Change-Id: I63bcd4bd5c979a82ca8c45d480acc41208a886ef
Signed-off-by: Md Sadre Alam <mdalam@codeaurora.org>
2019-05-31 10:42:54 +05:30
sameeruddin shaik
63a507e7ff ipq: Fix compiler warnings in u-boot-2016
This change will fix the following compiler warnings for AK and DK targets.
1.Wimplicit-function-declaration
2.Wdiscarded-qualifiers
3.Wstrict-prototypes
4.Wmaybe-uninitialized
5.Wunused-variable
6.Wint-conversion

Change-Id: I364904283172ccb19602ae1b6deceb8c61ea7638
Signed-off-by: sameeruddin shaik <samesh@codeaurora.org>
2019-05-23 18:36:28 +05:30
sameeruddin shaik
241e5e86b0 ipq807x: Add support for Toshiba 128M nand
This device is a non onfi device, so adding the device id and
oob details to nand_ids table.
This device is non onfi device, so adding the device id
and oob information in the nand_ids table.
1.pagesize:2048 bytes
2.oob size:128bytes
3.Ecc:8bits for 512 bytes
4.Man & dev id: 0x98 0xa1
Change-Id: I69763ea28fc3f81a74cacad4338b6d55c42d93b6
Signed-off-by: sameeruddin shaik <samesh@codeaurora.org>
2019-04-29 02:39:11 -07:00
sameeruddin shaik
8338952d77 ipq807x: Fix compiler warnings in u-boot
Change-Id: Icd0c082fcc5d191745e4e4242dda5a7f3b22c4f0
Signed-off-by: sameeruddin shaik <samesh@codeaurora.org>
2019-01-22 12:57:57 +05:30
Linux Build Service Account
def2d0cf7b Merge "ipq6018: Adding support for new read id command sequence for spi nand" 2018-12-07 07:05:20 -08:00
Linux Build Service Account
e307ba9c56 Merge "ipq6018: choose spi nand bus number and cs number from dts" 2018-12-07 07:05:20 -08:00
Antony Arun T
cbcc15acfe ipq6018: choose spi nand bus number and cs number from dts
Change-Id: Ic9d2fed8ca8d656d7b0ab1f2a4eb1fc55aeb1133
Signed-off-by: Antony Arun T <antothom@codeaurora.org>
2018-12-06 15:26:29 +05:30
Antony Arun T
fc4ec308a0 ipq6018: Adding support for new read id command sequence for spi nand
Some spi nand flash uses single byte read id(9FH) command,
for those devices the sequence is
byte1	byte2	byte3	byte4
9FH	MID	DID	DID
some other spi nand flashes uses two byte read id(9F 00H) command
for those devices the sequence is
byte1	byte2	byte3	byte4
9FH	A7-A0	MID	DID
The first byte is the actual command and the second byte is a dummy byte.
For devices which uses new sequence, we need to pass
appropriate read id command with dummy byte.

Change-Id: Idf2e8740f8341596cd8f58d22d5e33a4b4972a31
Signed-off-by: Antony Arun T <antothom@codeaurora.org>
2018-12-06 15:19:46 +05:30
Antony Arun T
0e7bb084f4 ipq6018: Enabling support for SPI NAND flash "GD5F1GQ4R"
Change-Id: I8df9be7ca1b8497e018dd563c7522e52a2433cb6
Signed-off-by: Antony Arun T <antothom@codeaurora.org>
2018-11-30 15:50:28 +05:30
Antony Arun T
6b53042f2d ipq40xx: adding support for ESMT(GIGADEVICE) nand flash
Change-Id: Iaf99a3dd0ee79fa75ee7ad97299dcd9fe36679bb
Signed-off-by: Antony Arun T <antothom@codeaurora.org>
2018-09-16 21:44:03 -07:00
Pavithra Palanisamy
d40f554e9f qca: Modify kstrtoint() function
This change modifies kstrtoint function to update
the result in destination buffer and return zero on success.

Change-Id: Ibdd9b36eed39d5e2ee3afc6f1609c1e35d5fb464
Signed-off-by: Pavithra Palanisamy <pavip@codeaurora.org>
2018-08-02 17:55:36 +05:30
Abhishek Sahu
961d3301a2 mtd: nand: qcom: support for non-page aligned read start address
Currently, the nand driver expects the start address to be page
aligned. This patch adds the support for reading data from
non-page aligned start address by using intermediate buffer.

1. Determine the number of pages with start address and
   length.
2. Do the full page read for all the pages. For first page,
   check the start address and determine the column. If column is
   non-zero then use the intermediate buffer for page data and copy
   the required number of bytes from this intermediate buffer to
   actual buffer.

Change-Id: I05a4b98547c83f785096027596cedd83a283edd8
Signed-off-by: Abhishek Sahu <absahu@codeaurora.org>
2018-06-06 23:02:13 -07:00
Linux Build Service Account
39fb368aa1 Merge "mtd: qcom: write NAND_CTRL only once" 2018-05-04 06:10:20 -07:00
Abhishek Sahu
3edd3544f0 mtd: qcom: write NAND_CTRL only once
Currently NAND_CTRL register write generates error.
Register writes to operational registers should always be done
through command descriptors if BAM_MODE is already enabled.
For NAND boot, bootloader already enables BAM_MODE so read the
NAND_CTRL register value and write only if BAM_MODE is not set.

Change-Id: Iabc3e06dc7d8d8b36cdf35907217e1c4d7cc960a
Signed-off-by: Abhishek Sahu <absahu@codeaurora.org>
2018-05-04 14:55:07 +05:30
Abhishek Sahu
8c71e56950 mtd: nand: qcom: use oobsize from nand id table
If nand id table has specified oobsize then use the same.

Change-Id: I58b19f8f9989c7332d103b83b6920d5b59b29a13
Signed-off-by: Abhishek Sahu <absahu@codeaurora.org>
2018-04-26 12:20:14 +05:30
Abhishek Sahu
a7ab5a19c2 mtd: nand: qcom: fix ubi mount error for non ONFI nand devices
Following error is coming during UBI mount for non ONFI nand
device since mtd->writebufsize is coming as zero

   ubi0: attaching mtd2
   UBI init error 22

The mtd->writebufsize is being assigned currently for ONFI
devices only so move this assigment to common place.

Change-Id: Idd22800dd65035952c1afd07ba375a28ffcf76ad
Signed-off-by: Abhishek Sahu <absahu@codeaurora.org>
2018-04-26 12:20:14 +05:30
Abhishek Sahu
2be258bb00 mtd: nand: qcom: use ECC according chip spare bytes for non ONFI
The ONFI NAND device specifies the required ECC correction in its
param page but for non ONFI device, we don't have such info.
The QPIC NAND contoller can use 8 bit ECC if the chip has required
number of spare bytes. This patch calculates the minimum required
spare bytes for using 8 bit ECC and select the same, if non ONFI
device has required number of spare bytes otherwise 4 bit ECC
will be used.

Change-Id: If7c718f4288eee16857171335897e3209a05fd0b
Signed-off-by: Abhishek Sahu <absahu@codeaurora.org>
2018-04-26 12:20:14 +05:30
Abhishek Sahu
f02cc3797e mtd: nand: add Toshiba TH58NYG3S0H to nand_ids table
Add the full description of the Toshiba TH58NYG3S0H NAND chip
in the nand_ids table since its spare bytes are coming as 128
instead of 256 with standard calculation. This device is non
ONFI/JEDEC device.

Change-Id: If1938fbcd0ebceb70aa9b620186cc92c6d504f75
Signed-off-by: Abhishek Sahu <absahu@codeaurora.org>
2018-04-26 11:33:25 +05:30
Linux Build Service Account
e29cf10dc6 Merge "ipq807x: Enable 4-byte address mode for flash W25Q256JW" 2018-04-04 03:16:31 -07:00
Santan Kumar
98b37b1dd8 ipq807x: Enable 4-byte address mode for flash W25Q256JW
Software SPI reset mode can be trigger from 4-Byte Address mode
in flash W25Q256JW.

Change-Id: I3f8ec46c2732c07a7af0cc7331102334413067ba
Signed-off-by: Santan Kumar <santank@codeaurora.org>
2018-03-30 17:44:43 +05:30
Sasirekaa Madhesu
9400a07874 ipq40xx: spi: Add support for 4Gb Toshiba-TC58CVG2S0F SPI NAND flash
Change-Id: I6c7427fec4bd486c572547a844f22d941f777bf5
Signed-off-by: Sasirekaa Madhesu <smadhesu@codeaurora.org>
2018-03-19 16:21:32 +05:30
Balaji Jagadeesan
6086a41473 ipq40xx: Support for SPI NOR not listed in vendor ID table
Do generic flash structure initialization, for the devices
not listed in the SPI NOR flash lookup table, so that
we can access the flash even before the support is added.
Block size and density are obtained from smem.

Change-Id: I568eb538615bb36124c43a2509bcfce2e4a1188a
Signed-off-by: Balaji Jagadeesan <bjagadee@codeaurora.org>
2018-03-13 11:49:29 +05:30
Balaji Jagadeesan
a47b19fc2b ipq: spi: Increased performance of spi erase
When 4K sector size support is enabled for spi, always
4K sector erase command is passed for all the erase operations.
To increase the performance, 64K erase command is
passed to the command buffer based on length and offset.

Change-Id: Ia762d192ba5d424f0ba3538fff8aff4954050bf7
Signed-off-by: Balaji Jagadeesan <bjagadee@codeaurora.org>
2018-03-06 09:29:48 -08:00
Antony Arun T
4ca40fa90d SF: Bulk Erase command support for spansion
Change-Id: Ida70d167cafc6af823f31c660d108cc25be6edff
Signed-off-by: Antony Arun T <antothom@codeaurora.org>
2018-02-23 13:10:34 +05:30
Gokul Sriram Palanisamy
a0ff1642d4 ipq807x: dcache support for nand driver
This patch adds the support on nand driver to work
when dcache is on.
flush_dcache_range will do both clean and invalidate.
To avoid any data loss when an un-aligned buffer used
in RX path, before giving buffer to bam and after bam
updates the data in buffer, buffer will be flushed.

Change-Id: Ib38d68726efe1692ae94c2be1af61cf29d1c2e50
Signed-off-by: Gokul Sriram Palanisamy <gokulsri@codeaurora.org>
2018-02-18 22:15:23 -08:00
Linux Build Service Account
0f5b9a078e Merge "sf: params: Add MX25U12835F part support" 2018-02-17 03:54:30 -08:00
Kathiravan T
7d93e5bcac ipq806x: FLASH XFER STEP register settings
This change is ported from U-Boot 2012.07 version. Reference commit:
commit a653a9f554 ('ipq806x: FLASH XFER STEP register settings')

Change-Id: I372b0745e53b2d7a222c3445183bb1407fe113d4
Signed-off-by: Kathiravan T <kathirav@codeaurora.org>
2018-02-15 00:02:30 -08:00
Abhishek Sahu
f7375a5dbe mtd: nand: ipq: erased page bitflips detection
Some of the newer nand parts can have bit flips in an erased
page due to the process technology used. In this case, ipq
nand controller is not able to identify that page as an erased
page. In case of bitflips, the ECC engine tries to correct the
data and then it generates the uncorrectable error. Now, this
data is not equal to original raw data.

Following logic is being added to identify the erased
codeword bitflips.

1. Maintain the bitmasks for the codewords which generated
   uncorrectable error.
2. Read the raw data again in temp buffer and count the
   number of zeros. Since spare bytes are unused in ECC layout and
   won’t affect ECC correctability so no need to count number of
   zero in spare bytes.
3. If the number of zero is below ECC correctability then it
   can be treated as erased CW. In this case, make all the data/oob
   of actual user buffers as 0xff.

Change-Id: I5a80cd371a926efa36c40b4db68e78ed78c30536
Signed-off-by: Abhishek Sahu <absahu@codeaurora.org>
2018-02-09 01:50:12 -08:00
Abhishek Sahu
408362f410 mtd: nand: ipq: reorganize read page error handling
Following are the major issues in current implementation

1. The mtd layer expects the driver to return non-negative
   integer representing the maximum number of bitflips that were
   corrected on any one ecc region. The mtd layer takes care of
   returning EUCLEAN based on returned number.
2. The read should return the complete data in case of
   EBADMSG so move the EBADMSG check in the main read function.

Change-Id: Iab3a28427e8350e8c99368762373f2cbce918786
Signed-off-by: Abhishek Sahu <absahu@codeaurora.org>
2018-02-09 15:18:54 +05:30
Abhishek Sahu
e86df26289 mtd: nand: ipq: init mtd ecc strength and bitflip_threshold
1. assign ecc strength in mtd structure which will be used by
   mtd layer
2. Initialize bitflip_threshold with 3*4 of ecc strength so
   that MTD layer will return EUCLEAN if number of ecc correction
   are more than bitflip_threshold.

Change-Id: I81cfe6059375117ced7888b877705919287a7be2
Signed-off-by: Abhishek Sahu <absahu@codeaurora.org>
2018-02-09 15:18:53 +05:30
Antony Arun T
fff58f6989 sf: params: Add MX25U12835F part support
Change-Id: Ib112587634758b0ada0e369971402f3e8ef6a8be
Signed-off-by: Antony Arun T <antothom@codeaurora.org>
2018-02-08 23:39:39 -08:00
Linux Build Service Account
7be2d06674 Merge "mtd: nand: qcom: erased page bitflips detection." 2018-02-08 15:43:35 -08:00
Linux Build Service Account
3221496969 Merge "qca: spi-nor: Store the probe information to avoid unnecessary probes" 2018-02-08 15:43:34 -08:00
Santan Kumar
a0dd6f4332 qca: spi-nor: Store the probe information to avoid unnecessary probes
Change-Id: If7260e4a4065d6406d9a8554f43853663f0e8f3b
Signed-off-by: Santan Kumar <santank@codeaurora.org>
2018-02-08 15:58:22 +05:30
Rajkumar Ayyasamy
8ac98b5fd9 ipq40xx: spi: Added support for GD25Q256
Change-Id: Iefc667c95558234e54111e6052f16e0f035b24ab
Signed-off-by: Rajkumar Ayyasamy <arajkuma@codeaurora.org>
2018-02-06 14:46:09 +05:30
Rajkumar Ayyasamy
f44fe93184 ipq40xx: Add SPI NAND support
Change-Id: I74de22fcea6455f73f263672b72b30b796f6c820
Signed-off-by: Rajkumar Ayyasamy <arajkuma@codeaurora.org>
2018-01-02 14:57:16 +05:30
Linux Build Service Account
0f0347f694 Merge "ipq40xx: add snapshot of spi_nand driver" 2017-12-26 06:59:33 -08:00