Commit Graph

54 Commits

Author SHA1 Message Date
zhikui.cui 0d66cb18e4 NAND: slcnand support register partition from cmdline [1/2]
PD#SWPL-181442

Problem:
initial support

Solution:
register partition from cmdline if partition information don't exist in dtb

Verify:
BR309-T950D5_SOCKET #48

Change-Id: I241508ea4ec6b03741ad8a831783ae61564250a8
Signed-off-by: zhikui.cui <zhikui.cui@amlogic.com>
2024-08-27 02:47:41 -07:00
Feng Chen 932190b3f1 spinand: F35SQA001G QPL qualify [1/1]
PD#SWPL-148920

Problem:
STB QPL qualify

Solution:
add F35SQA001G to flash id table.

Verify:
S1A_BG201

Change-Id: I3da23fa93396f96822a3bb32fc3d2332b9e9a7fd
Signed-off-by: Feng Chen <feng.chen@amlogic.com>
2024-08-19 07:42:40 -07:00
zhikui.cui 2cbe833488 NAND: spinand support W25N04KVZEIR [1/1]
PD#SWPL-175760

Problem:
support W25N04KVZEIR spinand

Solution:
support W25N04KVZEIR in winbond id table

Verify:
C308L-AW419

Change-Id: I46e19cb951a0f61fcad979934612105e3f84543a
Signed-off-by: zhikui.cui <zhikui.cui@amlogic.com>
2024-07-24 02:06:09 -07:00
zhikui.cui 09f428d530 NAND: spinand support W25N02KVZEIR [1/1]
PD#SWPL-175754

Problem:
support W25N02KVZEIR spinand

Solution:
support W25N02KVZEIR in winbond id table

Verify:
C302x-AW429

Change-Id: Idc2ba614392aa6ca15250d4e8df6701dbdf9dbd2
Signed-off-by: zhikui.cui <zhikui.cui@amlogic.com>
2024-07-22 21:53:49 -07:00
zhikui.cui 61cc009f04 NAND: fix flash identification in winbond spinand [1/1]
PD#SWPL-175754

Problem:
Winbond uses 3 bytes to identify flash: vendor_id, dev_id_0, dev_id_1,
but current driver uses only first 2 bytes of it for devices
identification. As result Winbond W25N02KV flash (id_bytes: EF, AA, 22)
is identified as W25N01GV (id_bytes: EF, AA, 21).

Solution:
Fix this by adding missed identification bytes.
(sync linux kernel community commit <dbf70fc2>)

Verify:
C302x-AW429

Change-Id: I055c20d1c636a1812590ccd2f78a1acf1192d3da
Signed-off-by: zhikui.cui <zhikui.cui@amlogic.com>
2024-07-22 21:53:44 -07:00
zhikui.cui 6d366b548c NAND: adjust the mechanism of register partition and get rsv parameter [1/1]
PD#SWPL-177473

Problem:
1.uboot pass partitions by cmdline in default
2.uboot pass rsv parameter by kernel dtb

Solution:
1.first register partitions from cmdline rather than dts
2.first parse rsv parameter from dts rsv part table

Verify:
AW419-C308L-Socket #020

Change-Id: Id7cb010d012768d54602be37d35940efed367d6e
Signed-off-by: zhikui.cui <zhikui.cui@amlogic.com>
2024-07-16 03:55:17 -07:00
Feng Chen 7bad5d948a spinor: filesystem support [1/1]
PD#SWPL-164860

Problem:
mount jffs2/UBI filesystem failed.

Solution:
all partition align with default 64K.

Verify:
C3

Change-Id: If0f2b6eb99ae59a587fb9003aad5911569a5e4e7
Signed-off-by: Feng Chen <feng.chen@amlogic.com>
2024-06-26 04:38:18 -07:00
Bichao Zheng f4b6a8586a spinand: add W25N01KV support [2/2]
PD#SWPL-148922

Problem:
add W25N01KV support.

Solution:
add the nand id into amlogic nand flash id table

Verify:
s1a

Change-Id: Ia335633779e0e9ee4b70656d20ea0c84e3249688
Signed-off-by: Bichao Zheng <bichao.zheng@amlogic.com>
2024-06-18 01:55:33 -07:00
Feng Chen cf7c866d33 spinor: update spi-nor layer [1/1]
PD#SWPL-164866

Problem:
update spi-nor layer.

Solution:
update spi-nor layer.

Verify:
C3_AW409

Change-Id: Ic93021b04cc0721d57c9c5c88e5f9e0abcdd090e
Signed-off-by: Feng Chen <feng.chen@amlogic.com>
2024-05-30 06:02:50 -07:00
Bichao Zheng 9cbc6d2f35 spinfc: compatible with host ecc and device ecc [2/2]
PD#SWPL-156043

Problem:
need to select ecc mode according to the nand model.

Solution:
1. only MX35LF1G24AD select host ecc.
2. all info page use host ecc

Verify:
S1A

Change-Id: I833f4ca00b2b53c52afc57cca666762aeffc5671
Signed-off-by: Bichao Zheng <bichao.zheng@amlogic.com>
2024-04-14 22:35:57 -07:00
zhikui.cui 9796e942a9 nand: spinand bitflip threshold set to 75% ecc strength [1/1]
PD#SWPL-162429

Problem:
It is not really very good for ecc threshold
to be equal to the maximum capacity of ecc.
we refer to raw nand method to set it.

Solution:
Refer to raw nand method (nand_base.c) to set ecc
threshold to the 75% of ecc maximum capacity.

Verify:
S1A-BG201

Change-Id: I92fea91008a93fd5472bfcadcd338e89e985d40c
Signed-off-by: zhikui.cui <zhikui.cui@amlogic.com>
2024-04-02 00:39:10 -07:00
zhikui.cui b42c4003f4 nand: fix can't scan nbbt in bitflips case [1/1]
PD#OTT-57502

Problem:
system partition filesystem mount fail. the problem is bring from commit
<b68a304179e8> (nand: slcnand & spinand: fix mutex deadlock)

Solution:
fix rsv_ops->_read_oob should return -EUCLEAN or 0 or negative error

Verify:
S1A-BG201

Change-Id: I40704ca9d89e5122622111513b7874fa103e3750
Signed-off-by: zhikui.cui <zhikui.cui@amlogic.com>
2024-04-01 04:39:26 -07:00
zhikui.cui d1d4b39ab5 nand: support S34ML04G300BHI00 [2/2]
PD#SWPL-155674

Problem:
S34ML04G300BHI00 not support yet

Solution:
id table support S34ML04G300BHI00

Verify:
AT301_T962D4-K35E(1.5G) #256

Change-Id: Icceb39538624ff87e57d93c720742491b7cc6a40
Signed-off-by: zhikui.cui <zhikui.cui@amlogic.com>
2024-01-30 04:03:35 -07:00
zhikui.cui c4633a3355 nand: fix memory corruption in meson_nfc_execp_op [1/1]
PD#SWPL-113283

Problem:
when use dma to read a small amount of data to a memory by kzalloc,
kzalloc memory len less than dma minimum handling length,
e.g. kzalloc one byte memory, but dma moves data with a width 64 bits,
so it would destroy the 7 bytes memory space on the right side of the
requested memory.

BUG: KFENCE: memory corruption in meson_nfc_exec_op+0x3b4/0x4c8

Corrupted memory at 0x00000000527f2fd0 [ ! ! ! ! ! ! ! . . . . . . . ]
meson_nfc_exec_op+0x3b4/0x4c8
nand_status_op+0x1ac/0x294
nand_erase_op+0x19c/0x328
nand_erase_nand+0x1d0/0x3cc
nand_erase+0x14/0x20
mtd_erase+0x174/0x1f0
mtdchar_ioctl+0x1c1c/0x2704
mtdchar_unlocked_ioctl+0x50/0x74
__arm64_sys_ioctl+0xa4/0x114
invoke_syscall+0x5c/0x140
el0_svc_common.llvm.4567374417812983254+0xb4/0xf0
do_el0_svc+0x24/0x84
el0_svc+0x2c/0xa4
el0t_64_sync_handler+0x68/0xb4
el0t_64_sync+0x1b4/0x1b8

kfence-#52: 0x00000000d4c8f37e-0x00000000d4c8f37e, size=1, cache=kmalloc-64

Solution:
align dma minimum handling length to kzalloc

Verify:
AT301_T962D4-K35E(1.5G) #256

Change-Id: I541b6acecaa9dd69ec6466bd7040af94b45ae596
Signed-off-by: zhikui.cui <zhikui.cui@amlogic.com>
2024-01-29 02:08:41 -07:00
Feng Chen d1522e840c spinand: add new flash support [1/1]
PD#SWPL-148917

Problem:
fix oob layout error.

Solution:
modify oob layout.

Verify:
s1a

Change-Id: Ic69ce83ff84fc7ed8046ce772c8bea082cff94be
Signed-off-by: Feng Chen <feng.chen@amlogic.com>
2024-01-25 07:47:21 -07:00
Feng Chen dd12f97911 spinand: add gd spinand support [1/1]
PD#SWPL-148064

Problem:
new spinand support.

Solution:
add id support.

Verify:
s1a

Change-Id: I925b785330a42aff506e1c7fa97876210e51fd89
Signed-off-by: Feng Chen <feng.chen@amlogic.com>
2024-01-25 07:47:07 -07:00
zhikui.cui 8248d69720 nand: read bootloader(BB1ST) don't skip info page [1/1]
PD#SWPL-151737

Problem:
don't skip info page when read bootloader

Solution:
skip info page to read bootloader

Verify:
AM301_T950D4_REF #096

Change-Id: I7788ed5273ed75832ae548c626b4efc6a7af3ecc
Signed-off-by: zhikui.cui <zhikui.cui@amlogic.com>
2024-01-02 06:07:24 -07:00
Feng Chen f8c72c139b nand: fix page read error [1/1]
PD#SWPL-148386

Problem:
one rsv read operation occurs between two consecutive
read of the same page(without oob) will cause error.

Solution:
use meson chip buf to replace nand chip databuf.

Verify:
c3

Change-Id: I05475c21ccad28ae4fea8f128fd9c79e75d882e3
Signed-off-by: Feng Chen <feng.chen@amlogic.com>
2023-12-06 04:21:21 -07:00
Liang Yang a856f9ff4a spi-nand: device encryption [1/1]
PD#SWPL-130883

Problem:
need to support inline partition encryption

Solution:
add support inline partition encryption in
spi nand driver

Verify:
s1a

Change-Id: Iadb9b9ae121939ef37a3abbd603a5eec17500739
Signed-off-by: Liang Yang <liang.yang@amlogic.com>
2023-11-29 00:33:11 -07:00
Bichao Zheng 92da8aaea5 spinand: add DS35Q2GB support [2/2]
PD#SWPL-134893

Problem:
need add DS35Q2GB support

Solution:
add DS35Q2GB id

Verify:
a1

Change-Id: I18eef2cae78a2e672ee6ea8a0b3e1bac734b53b5
Signed-off-by: Bichao Zheng <bichao.zheng@amlogic.com>
2023-11-28 02:15:14 -07:00
Feng Chen b68a304179 nand: slcnand & spinand: fix mutex deadlock [1/1]
PD#SWPL-142875

Problem:
deadlock will happen in mark bad block process.

Solution:
add rsv-ops interface in rsv-manage to avoid deadlock.

Verify:
c3

Change-Id: I3841a8d3ca8c8f48142828b03ba9aefdf21adc62
Signed-off-by: Feng Chen <feng.chen@amlogic.com>
2023-11-27 20:09:21 -07:00
shufei.zhao 92ffe3e6aa unifykey: auto attach after flash probe [1/1]
PD#SWPL-143927

Problem:
unifykey ready too late

Solution:
attach after flash probe

Verify:
g12b

Change-Id: I637874304ea70f34074d32ac08c4728a1b80cef8
Signed-off-by: shufei.zhao <shufei.zhao@amlogic.com>
2023-11-21 22:39:17 -07:00
zhikui.cui 6996aaf408 nand: support driver for T5D [1/1]
PD#SWPL-129598

Problem:
need support nand driver for T5D bringup

Solution:
select FixDiv2PLL clock source in module

Verify:
AM301_T950D4

Change-Id: Ida6b579062937fc3089583de300a69ec8ddfde91
Signed-off-by: zhikui.cui <zhikui.cui@amlogic.com>
2023-11-10 08:17:22 -07:00
Bichao Zheng 60620d53d2 spinand: disabled read cache Quad & Dual IO [1/1]
PD#SWPL-145250

Problem:
no support read cache Quad&Dual IO.

Solution:
disabled read cache Quad & Dual IO

Verify:
A1

Change-Id: I3b59927a26874b529615ed627256bb462c1d6307
Signed-off-by: Bichao Zheng <bichao.zheng@amlogic.com>
2023-11-08 22:03:34 -07:00
zhikui.cui d5c9255e8c nand: dump bootloader at mtdblock0 [1/1]
PD#SWPL-143171

Problem:
parse data ecc

Solution:
The parsed data structure should be consistent with
the written data structure

Verify:
A4

Change-Id: I5ff24de085f0a46937830fa0b327f7c08bd23fc1
Signed-off-by: zhikui.cui <zhikui.cui@amlogic.com>
2023-10-26 23:53:47 -07:00
zhikui.cui a3c1189645 nand: select slc nand mode [1/1]
PD#SWPL-142784

Problem:
can't read slc nand id

Solution:
select slc mode when detect prop "spi_cfg" in dts

Verify:
A4

Change-Id: I64d536d72c628bcd525177f5d732a8554b08b7b8
Signed-off-by: zhikui.cui <zhikui.cui@amlogic.com>
2023-10-26 23:53:41 -07:00
zhikui.cui c6034dd6a6 nand: coverity clean [1/1]
PD#SWPL-141996

Problem:
Unintentional integer overflow

Solution:
redefine related variables to u64

Verify:
just coverity pass

Change-Id: Idcced22cdecb2a925692e88eee0cd3b658fb71c4
Signed-off-by: zhikui.cui <zhikui.cui@amlogic.com>
2023-10-17 05:58:41 -07:00
Bichao Zheng 0292be1b5c spinand: update info page [1/1]
PD#SWPL-140211

Problem:
need update spinand info page.

Solution:
update new info page, for compatibility with A1 S1A C3.

Verify:
A1 S1A C3

Change-Id: I73ce561dc716aedd18ac2887af00fa912818794b
Signed-off-by: Bichao Zheng <bichao.zheng@amlogic.com>
2023-09-26 02:28:52 -07:00
Bichao Zheng 6602b833fc nand: s1a nand partition confirmation [1/3]
PD#SWPL-137498

Problem:
1. need get partition from env
2. need get rsv info from env

Solution:
1. get partition from cmdline
2. get rsv info from cmdline

Verify:
s1a

Change-Id: I5de9ca2479d60ce0c24698abda1b01403be4c283
Signed-off-by: Bichao Zheng <bichao.zheng@amlogic.com>
2023-08-31 21:58:38 -07:00
qinglin.li 9f54c42bbd break_gki: adjust break gki config [2/2]
PD#SWPL-137861

Problem:
adjust break gki config

Solution:
CONFIG_AMLOGIC_BREAK_GKI_20 only break gki2.0
CONFIG_AMLOGIC_BREAK_GKI break gki 1.0 and 2.0

Verify:
local

Change-Id: Ic86c771027980aa24c638d5f89c014240d65ec91
Signed-off-by: qinglin.li <qinglin.li@amlogic.com>
2023-08-30 20:13:49 -07:00
Bichao Zheng 3d744698f9 spinand: remove meson mtd erase interface [1/1]
PD#SWPL-136164

Problem:
No need to implement the erase interface for mtd

Solution:
remove meson mtd erase interface

Verify:
S1A

Change-Id: Id214b1551018586304dfffee06ba8d6cecbcb14d
Signed-off-by: Bichao Zheng <bichao.zheng@amlogic.com>
2023-08-16 02:29:00 -07:00
Bichao Zheng ccc09fb175 spinand: adjust meson bbt [1/1]
PD#SWPL-136164

Problem:
if oob bit flips, may misidentify bad blocks

Solution:
find meson bbt directly.

Verify:
c3

Change-Id: I66e168963a3210052d154256c6b9ec0f6a1b862f
Signed-off-by: Bichao Zheng <bichao.zheng@amlogic.com>
2023-08-15 04:19:30 -07:00
Bichao Zheng 540d825988 spinfc: add new spi nfc driver [1/1]
PD#SWPL-133132

Problem:
adopt new spi flash controller with ecc engine

Solution:
add a new spi nfc flash driver

Verify:
s1a

Change-Id: I551d27ac29effe2bd0bb090a8cc9bc9897080a20
Signed-off-by: Bichao Zheng <bichao.zheng@amlogic.com>
2023-08-15 10:36:49 +08:00
Bichao Zheng 71225d83b0 nand: adjust the use of DMA [1/1]
PD#SWPL-135072

Problem:
fix ecc timeout.

Solution:
1. add dma_sync_single_for_cpu before read info.
2. remove invalid code

Verify:
S4

Change-Id: Ia7ba219d1e15415eea1507b9f864e1e81f8b6225
Signed-off-by: Bichao Zheng <bichao.zheng@amlogic.com>
2023-08-10 21:48:55 -07:00
Feng Chen 8b3b1996e7 nand: erase failed error [1/1]
PD#SWPL-129754

Problem:
erase flash error during OTA upgrade.

Solution:
change the check way of badblock.

Verify:
s4

Change-Id: I82b64b03f584d449e30a435f8ec7e7aa0bab3be7
Signed-off-by: Feng Chen <feng.chen@amlogic.com>
2023-07-09 15:08:14 -07:00
Bichao Zheng 20f5935b04 bf201: nand partition confirmation [1/1]
PD#SWPL-124386

Problem:
1. Reduce bootloader area

Solution:
1. remove ddrfip area
2. Reduce RSV to 14 blocks.
3. Reduce backup of BL2E BL2X DEVFIP to 2
4. Bootloader area reduced from 0x1600000 to 0x940000 bytes

Verify:
s4

Change-Id: I97187d33f211c7a5ab60e4cda2b369defb8363dd
Signed-off-by: Bichao Zheng <bichao.zheng@amlogic.com>
2023-06-16 20:23:48 -07:00
Feng Chen 03fe0b2794 mtd nand: CB2 optimize nand boot area [1/1]
PD#SWPL-123982

Problem:
- optimize nand boot area

Solution:
- optimize nand boot area

Verify:
BF201_S805C1A

Change-Id: I520add1439c625fdb5b8cded86090b1b21ccda2c
Signed-off-by: Feng Chen <feng.chen@amlogic.com>
2023-05-19 02:33:15 -07:00
Feng Chen 2d1b3f30de spinand: cannot be mounted normally [1/1]
PD#SWPL-123829

Problem:
nand cannot be mounted normally.

Solution:
modify oob layout for BBM

Verify:
a1

Change-Id: I19b038cf6e9a5196d0637467d2572eb1178a9496
Signed-off-by: Feng Chen <feng.chen@amlogic.com>
2023-05-19 01:56:14 -07:00
Bichao Zheng 83a117c836 nand: get onfi mode from id table [1/1]
PD#SWPL-120491

Problem:
Wrong select onfi mode

Solution:
get onfi mode from id table

Verify:
s4

Change-Id: I478181a369b608b1d1598f9ab05760cbb9ab12e3
Signed-off-by: Bichao Zheng <bichao.zheng@amlogic.com>
2023-04-25 05:05:19 -07:00
Feng Chen 05429451ae mtdblock: modify for squashfs mount [2/2]
PD#SWPL-116004

Problem:
1.squashfs don't handle bad block
2.partition size returned from mtdblock
is incorrect

Solution:
add Macro CONFIG_AML_NAND

Verify:
s4_aq243

Change-Id: I82110118b0bfe78a6615bd9159f741800b37abda
Signed-off-by: Feng Chen <feng.chen@amlogic.com>
2023-03-27 22:32:48 +08:00
Feng Chen 7b9735c463 spinand: add env_size for a1 [1/1]
PD#SWPL-115118

Problem:
error cause by different env size
define under uboot and kernel

Solution:
add env_size in dts

Verify:
a1

Change-Id: I2abfa546e38d650524da52641a7958f1c1f50d4b
Signed-off-by: Feng Chen <feng.chen@amlogic.com>
2023-03-23 05:12:12 -07:00
Feng Chen 9639867fc4 slcnand: 32b mount system partition fail in ramdisk [1/1]
PD#SWPL-110677

Problem:
mount system partition fail

Solution:
there is different partition
backup num of board platform,
4 or 8, add flag in dts file
to mark it as 8-backup

Verify:
s4d_t215

Change-Id: I2ce7682cb04163a5c3464853b90f4693608cac4f
Signed-off-by: Feng Chen <feng.chen@amlogic.com>
2023-02-20 06:03:35 -08:00
Feng Chen dc764e2a01 spinand: add F50L1G41LB support [1/1]
PD#SH-13003

Problem:
spinand need F50L1G41LB support

Solution:
add flash id support

Verify:
a1_ad403

Change-Id: Icf9a78b3e8268063eaea628f0304c4f7c751eeac
Signed-off-by: Feng Chen <feng.chen@amlogic.com>
2023-02-19 22:05:31 -08:00
Feng Chen 38e1d98d92 nand: rsv memory allocation failure [1/1]
PD#SWPL-107508

Problem:
nand rsv memory allocation failure
in sometimes cause by apply for
continuous physical memory

Solution:
use discontinuous physical memory
memory malloc method

Verify:
s4

Change-Id: I86f99096e8c48562b78801c3f500a0ae291094b7
Signed-off-by: Feng Chen <feng.chen@amlogic.com>
2023-01-13 15:47:48 +08:00
Bichao Zheng b6cf12ed03 typo: Fix mtd typo errors [1/1]
PD#SWPL-103473

Problem:
1. typo errors

Solution:
1. fix typo errors

Verify:
s4

Change-Id: Icd7b87b77c763d4a8a8807a8ab25b1e59770c0ec
Signed-off-by: Bichao Zheng <bichao.zheng@amlogic.com>
2022-12-31 06:19:28 -08:00
Bichao Zheng f886d9e766 nand: modify check bad block rule in add partition [1/1]
PD#SWPL-104886

Problem:
1. partition will change, when have use bad block

Solution:
1. only skip factory bad blocks in add partitions.

Verify:
s4

Change-Id: Ibb796410add3d02a34c8a41e7ef0e354d4f65e67
Signed-off-by: Bichao Zheng <bichao.zheng@amlogic.com>
2022-12-13 06:17:00 -08:00
Feng Chen 9a7b2542e8 spi-nand: modify check bad block rule in add partition method [1/1]
PD#SWPL-100114

Problem:
factory bad blocks and the other bad blocks
both in the return result of mtd check bad
blocks method, but in add partitions process
that not safety, because system partition might
use the same block in next startup.

Solution:
only skip factory bad blocks in add partitions
method.

Verify:
c3_aw419

Signed-off-by: Feng Chen <feng.chen@amlogic.com>
Change-Id: If9b0b10f41c07052ef955c1ebf3193ab657ec09e
2022-12-07 02:01:28 -07:00
pengzhao.liu b946ffb848 typo: clear typo problem [1/1]
PD#SWPL-89627

Problem:
clear typo problem

Solution:
clear typo problem

Verify:
s4d

Signed-off-by: pengzhao.liu <pengzhao.liu@amlogic.com>
Change-Id: I9121c9d4b54df9b9a7c244182693e0fd616f5a9e
2022-09-07 20:06:45 +08:00
Bichao Zheng 2a4446af15 spi nand: c3 fix mtd0 write&read fail [1/1]
PD#SWPL-88624

Problem:
1. swupdate mtd0 fail

Solution:
1. add front info page support.

Verify:
c3

Change-Id: I99da5578b4d130656924fcdbd96ac7e85a1d0d8e
Signed-off-by: Bichao Zheng <bichao.zheng@amlogic.com>
2022-07-21 03:53:12 -07:00
Bichao Zheng 3ed03c5332 nand: fix rsv read fail [1/2]
PD#SWPL-86523

Problem:
rsv read fail when bit flip

Solution:
Use mtd api instead

Verify:
c3

Signed-off-by: Bichao Zheng <bichao.zheng@amlogic.com>
Change-Id: I4fc9c94b2e47235c7a7d5a1c5fd592d84223f0ab
2022-06-30 18:20:42 +08:00