Commit Graph

61 Commits

Author SHA1 Message Date
Sunny Luo d30056cc9f spicc: reset controller when busy [1/1]
PD#SWPL-183022

Problem:
ldim crash caused by spi abnormal transfer

Solution:
reset spicc controller when busy

Verify:
t5m

Change-Id: I1317e8e5b2ddec6198126e8cd4a9c569f13eb4d5
Signed-off-by: Sunny Luo <sunny.luo@amlogic.com>
2024-08-22 07:40:49 -07:00
Sunny Luo 0585d28c0b spi: spicc-v2: add vsync trig mode support [1/1]
PD#SWPL-159505

Problem:
vsync trig mode requirement from LDIM

Solution:
add vsync trig mode support for spicc-v2

Verify:
T3X T968D4-BC302

Change-Id: I16e24c55d884cf4871875e5a22c0935b13e36f01
Signed-off-by: Sunny Luo <sunny.luo@amlogic.com>
2024-08-13 01:46:32 -07:00
Sunny Luo 12ceda73f6 spisg: fix mutex lock panic of dirspi_async [1/1]
PD#SWPL-179542

Problem:
dirspi_async is designed for the ldim isr. Unfortunately, the
clk_set_rate and clk_get_rate it calls use a mutex lock, which
will lead to a mutex lock panic.

Solution:
Set spi speed in spi_setup only when controller_data use_dirspi=1
Pre-save the spi speed to avoid calling clk_get_rate

Verify:
t5m

Change-Id: I4fdf9d3be687901a5e8cffa1f838f99551b7d94a
Signed-off-by: Sunny Luo <sunny.luo@amlogic.com>
2024-07-31 01:52:43 -07:00
Sunny Luo f62b139bbe spisg: unnecessary clk rate setting for the spi device max_speed_hz [1/1]
PD#SWPL-174740

Problem:
SPISG driver sets clk rate twice for a transfer, one sets the clk rate
with the spi device max_speed_hz in prepare_message, and the other sets
the clk rate with the transfer speed_hz in one_transfer.
Normally, the subsequent clk rate setting would be ingored if the speed
doesn't change. But if the two speeds are different, it would bring about
the clk_set_rate calling twice, and each calling takes about 2~3 msec.

Solution:
Port from cl-434207
Remove the unnecessary clk rate setting of prepare_message

Verify:
s7 bh201

Change-Id: I655a03f166415a256b35739e898be29ae047082a
Signed-off-by: Sunny Luo <sunny.luo@amlogic.com>
2024-07-22 21:54:05 -07:00
Sunny Luo 5f87bd7b34 spisg: fix config conflicting when multiple slave devices working [1/1]
PD#SWPL-174740

Problem:
SPISG driver configure the mode/speed/timing etc for a slave device only
once in spi_setup. For multiple slave devices, the earlier configures
are
covered by the last one.

Solution:
Port from cl-431613
Configure the mode/speed/timing etc for a slave device in
prepare_message.

Verify:
s7 bh201

Change-Id: Ie23ec354d9b3026575c5e908ce9900a41ad857e1
Signed-off-by: Sunny Luo <sunny.luo@amlogic.com>
2024-07-22 21:54:01 -07:00
Sunny Luo cda0b5744b spi: change to use clk-tree divider [1/1]
PD#SWPL-174740

Problem:
SCLK rate range depends on the parent asssigned in dts;
SCLK rate is imprecise because of only one parent clk rate option;
Speed low than 1MHz unsupported;
Slave configurations achieved by spi_setup are cleared away later by
the controller initialization.

Solution:
Port from cl-431163;
Change to use clk-tree divider;
change controller min_speed_hz from 1MHz to 10000Hz;
Initialize controller configurations before devm_spi_register_master.

Verify:
s7 bh201

Change-Id: I4c6d91ad8381c30ba538c6136ab890e1f8223e6b
Signed-off-by: Sunny Luo <sunny.luo@amlogic.com>
2024-07-22 21:53:40 -07:00
Sunny Luo 28dccce892 spisg: fix spicc driver buildin error [1/1]
PD#SWPL-174740

Problem:
fix spicc driver buildin error

Solution:
Port from CL-427327
Fix spicc driver buildin error

Verify:
s7 bh201

Change-Id: If76774c2746fd18a02bc3ea01d35a2c56907ebbc
Signed-off-by: Sunny Luo <sunny.luo@amlogic.com>
2024-07-22 21:53:36 -07:00
Sunny Luo 5b40487bb4 spisg: fix dma address width error on arm32 [1/1]
PD#SWPL-174740

Problem:
spisg descriptor dma address is 64 bits, but it is defined as
a dma_addr_t, which width is 32 bits in arm32.

Solution:
Port from cl-420129
Change the dma address type with u64.

Verify:
s7_bh201

Change-Id: I263dcd7bd8edf69411b536551d4ad0b4cdcab44d
Signed-off-by: Sunny Luo <sunny.luo@amlogic.com>
2024-07-22 21:53:31 -07:00
Sunny Luo dd0bf6be0a spicc: add a hw interface dirspi_xfer for ldim [1/1]
PD#SWPL-174974

Problem:
ldim require a hw interface dirspi_xfer to run in interrupt handle

Solution:
add a hw interface dirspi_xfer for ldim

Verify:
t5m ay301

Change-Id: I26e1a9890cc45ac0420d15ebea5e0a4bf2f18a56
Signed-off-by: Sunny Luo <sunny.luo@amlogic.com>
2024-07-19 00:15:16 -07:00
zhikui.cui ada3981ec7 nand: support new boot layout [1/1]
PD#SWPL-167197

Problem:
don't support ota the new boot layout (BOOT_DISCRETE_BL2)

Solution:
init support

Verify:
AW419-C308L-Socket #20

Change-Id: Ia2d1022f72a73f09f32c89fed4534795b0ecc49c
Signed-off-by: zhikui.cui <zhikui.cui@amlogic.com>
2024-07-17 05:57:19 -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 94ea752313 spinand: fix compile errors [1/1]
PD#SWPL-169271

Problem:
a label can only be part of a statement and a declaration is not a
statement.

Solution:
fix compile errors.

Verify:
s1a_bg201

Change-Id: I4794aea1816f22ba3b0b0f92b72a4de6e67c7406
Signed-off-by: Bichao Zheng <bichao.zheng@amlogic.com>
2024-05-22 23:58:24 -07:00
Liang Yang 7a9cfa3934 spinand: out of range access [1/1]
PD#SWPL-169271

Problem:
regmap_read() access 4B each time, but the length
of buffer passed from spi core is mismatch.

Solution:
NFC driver use the local variable to fix it.

Verify:
s1a_bg201

Change-Id: Id1377f03f594cbc249f85c8a9ab49ba827f47cf4
Signed-off-by: Liang Yang <liang.yang@amlogic.com>
2024-05-20 23:56:01 -07:00
zijie.lin 03b65068b0 ldim: ldim suspend/resume and spi fix [1/1]
PD#SWPL-165259

Problem:
1. T5W/T3 do not support SPI_LSB_FIRST.
2. T5W suspend/resume will reset the reg.
3. ldim_pwm_level is 0 when power on.

Solution:
1. ldim software implementation of big-endian
and little-endian data conversion.
2. ldim send mode base on spi controller.
3. When resume ldim_fw reset the reg value again.
4. Set ldim_set_duty_pwm after set pwm pinmux.

Verify:
T5W/T5M

Change-Id: I409c4d378fc972f7f643ee64a6588119e1494e1b
Signed-off-by: zijie.lin <zijie.lin@amlogic.com>
2024-05-13 05:53:35 -07:00
Bichao Zheng bba707d1d8 spinfc: fix wrong oob free layout [1/1]
PD#SWPL-156043

Problem:
oob layout not switch when switch ecc.

Solution:
switch oob free layout when switch ecc.

Verify:
S1A

Change-Id: I23de5bf220371723d3adb1b0f7148bc10c02bd60
Signed-off-by: Bichao Zheng <bichao.zheng@amlogic.com>
2024-04-30 03:54: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
Sunny Luo 90418e4780 spi: spicc: disable 8/16/32 bits DMA-SPI mode [1/1]
PD#SWPL-158019

Problem:
panic cause by 8 bit DMA-SPI mode

Solution:
disable 8/16/32 bits DMA-SPI mode;
change start mode from smc to xch;

Verify:
T5M T963D4_AY301

Change-Id: I091f7b8b252ae7eadbc38825131940e8ff6a7805
Signed-off-by: Sunny Luo <sunny.luo@amlogic.com>
2024-02-22 05:55:15 -07:00
Sunny Luo 0fe37455c0 spi: spicc: fix dma trig issue after suspend/resume [1/1]
PD#SWPL-149033

Problem:
vsync trig xfer failed after suspend/resume

Solution:
change ldim to tx duty data only without rx;
change spicc to support tx only without rx;
stop dma trig unless spi complete;
reset fifo before start dma trig

Verify:
T5M T963D4_AY301

Change-Id: Icbac15138a3f7f33e1436047cd99a9882aaf2738
Signed-off-by: Sunny Luo <sunny.luo@amlogic.com>
2024-01-11 23:07:46 -07:00
Sunny Luo 2d0084707c spi: spicc: store/restore all registers when suspend/resume [1/1]
PD#SWPL-149033

Problem:
dirspi transferring error after str wake up,
- unexpected sclk rate
- unexpected sclk polarity
- SS pull up every word

Solution:
store/restore all registers when suspend/resume

Verify:
T5M T963D4_AY301, T7 A311D2_AN400

Change-Id: I313f7ad1dfbc38db8e92189f543eac4649f6810f
Signed-off-by: Sunny Luo <sunny.luo@amlogic.com>
2024-01-11 23:07:26 -07:00
Bichao Zheng 928af37a16 spinand: optimize for read-write speed [1/1]
PD#SWPL-150570

Problem:
nand driver optimize for read-write speed.

Solution:
remove some operation which with sleep.

Verify:
s1a

Change-Id: Idb58a1a10731ca111c2bfce3c4e5cfdb8f3f9112
Signed-off-by: Bichao Zheng <bichao.zheng@amlogic.com>
2023-12-22 08:32:55 -07:00
Sunny Luo ea696eb3ce spi: spicc: fix unexpected sclk pulse in spi device setup [1/1]
PD#SWPL-150135

Problem:
an unexpected 2 us sclk negative pulse in spi device setup.
first setup only

Solution:
inconformity between sclk-pullup and default sclk polarity 0.

Verify:
t5m ay301

Change-Id: I99f6889164bed2b1c12b74e1e05cd004c65982be
Signed-off-by: Sunny Luo <sunny.luo@amlogic.com>
2023-12-19 20:16:50 -07:00
Sunny Luo 48d6065aec spi: spicc: fix dmc violation issue [1/1]
PD#SWPL-150135

Problem:
dmc violation because of spicc dma reading/writing address.
caused by a error configure for spicc ldim vsync mode

Solution:
set 0x28[8]=1 to load dma address from 0x30/0x34

Verify:
t5m ay301

Change-Id: I09fabbb9490674de1d02b38da0bc2bcb38c74a67
Signed-off-by: Sunny Luo <sunny.luo@amlogic.com>
2023-12-19 20:16:27 -07:00
Bichao Zheng cb464ce112 spinand: S1A add buildin ecc support [3/3]
PD#SWPL-149792

Problem:
need add buildin ecc support

Solution:
switch ecc mode by poc4

Verify:
s1a

Change-Id: Ie9f4af14daa111a7795ecff383d6cf447348470f
Signed-off-by: Bichao Zheng <bichao.zheng@amlogic.com>
2023-12-13 22:59:33 -07:00
Sunny Luo 4c482d166a spi: refactor test entry for spicc & spicc-v2 [1/1]
PD#SWPL-147512

Problem:
refactor test entry for spicc & spicc-v2

Solution:
Refactor test entry for spicc & spicc-v2;
Fix chip select issue to support more SPI devices.
Porting from 5.4 f55b06c4

Verify:
t3 t982

Change-Id: I113e3ac4f1926fd98e94ad8cf3cf2aebeeada970
Signed-off-by: Sunny Luo <sunny.luo@amlogic.com>
2023-12-07 04:41:29 -07:00
Sunny Luo 0f3f980eaf spicc: add dma transfer by vsync/line-n triggering support [1/1]
PD#SWPL-147512

Problem:
LDIM requires a strict timing sequence to match with the vsync signal

Solution:
SPICC supports vsync/line-n triggering control, Add a interface to
start/stop the vsync triggering transfer for LDIM
Porting from 5.4 1f62b7d1

Verify:
t3 t982

Change-Id: Ida2f63cbe318dceebbe97514e41a588e4ea143d4
Signed-off-by: Sunny Luo <sunny.luo@amlogic.com>
2023-12-07 04:41:17 -07:00
Sunny Luo def5c7e92c spicc: add cs-gpio requesting in device setup [1/1]
PD#SWPL-145604

Problem:
The cs-gpio pin can possibly be in other mux state, and yet
SPI HAL didn't request it into gpio state before use it.

Solution:
Request its cs-gpio into GPIO state in device setup

Verify:
C308L-AW419

Change-Id: Ie94ff7bda9f0f4fd2512d765e0698a5cea522183
Signed-off-by: Sunny Luo <sunny.luo@amlogic.com>
2023-11-27 20:09:25 -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
Sunny Luo dd74dae811 spi: spicc(v2): add poweroff clk control [1/1]
PD#SWPL-133609

Problem:
spicc(v2) clk works in poweroff state

Solution:
disable spicc(v2) clk when poweroff

Verify:
T3X BC309

Change-Id: Ie9c9ffd4ecc450b9a9e7b3f5bd3429c5b095c798
Signed-off-by: Sunny Luo <sunny.luo@amlogic.com>
2023-09-14 05:34:18 -07:00
Sunny Luo d54b3fffed spi: fix spicc timed out issue(speed low than 200K) [1/1]
PD#SWPL-137044

Problem:
transfer timed out when spicc works at low speed(200K)

Solution:
TC is triggered by tx-fifo empty, but the last data is not yet transferred
at this time. we have to wait the last data which is sending/receiving.

Verify:
C1

Change-Id: I7e0fca3fdf6ed6c3b40a8399564eae2cf6d3a9b0
Signed-off-by: Sunny Luo <sunny.luo@amlogic.com>
2023-08-21 22:54:03 -07:00
Sunny Luo c48e7843e4 spi: back sync with t5m openliux/tv/s-amlogic [1/1]
PD#SWPL-136205

Problem:
back sync with t5m openliux/tv/s-amlogic

Solution:
- configure spicc1 ss leading/trailing gap for local-dimming;
- add dirspi support in test entry;
- remove the limit of min_speed_hz.

Verify:
t5m

Change-Id: If84e2a5a5cac080f543c18988524da58fabeda0a
Signed-off-by: Sunny Luo <sunny.luo@amlogic.com>
2023-08-15 04:19:20 -07:00
Bichao Zheng 6210ca19b3 spinfc: add QUAD IO support [1/1]
PD#SWPL-133132

Problem:
need support QUAD IO

Solution:
add QUAD IO support

Verify:
s1a

Change-Id: I77e189cf55c10e6a51be7d940400173deb8720d5
Signed-off-by: Bichao Zheng <bichao.zheng@amlogic.com>
2023-08-15 10:36:51 +08:00
Bichao Zheng c50c808ed1 spinfc: fix typo error [1/1]
PD#SWPL-133132

Problem:
need fix typo error

Solution:
fixed typo error

Verify:
s1a

Change-Id: Iea5de11905a8ea584671d15b147d3756c1d9a31b
Signed-off-by: Bichao Zheng <bichao.zheng@amlogic.com>
2023-08-15 10:36:49 +08: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 baa120160b spifc: add buildin support [1/1]
PD#SWPL-135127

Problem:
no register driver on buildin.

Solution:
add register driver on buildin.

Verify:
C3

Change-Id: Ie7d0cb27f936dfff1419f2cad65dc234b68a0b49
Signed-off-by: Bichao Zheng <bichao.zheng@amlogic.com>
2023-08-13 21:58:49 -07:00
Sunny Luo e6ca294947 spi: spicc(v2): add suspend/resume clk control [1/1]
PD#SWPL-133609

Problem:
spicc(v2) clk works in suspend

Solution:
disable/enable spicc(v2) clk when suspend/resume

Verify:
T3X BC309

Change-Id: Id9589de0238400731a9cc6a218016c558690da0a
Signed-off-by: Sunny Luo <sunny.luo@amlogic.com>
2023-08-04 02:18:45 -07:00
Feng Chen 26f07efab0 spicc: spi mode polarity error [1/1]
PD#SWPL-128741

Problem:
spi mode3 initial polarity error.

Solution:
change the use rule of spic clk_ao.

Verify:
c3

Change-Id: Ic1113f9fb29f450d1e5bf565869e795356401de9
Signed-off-by: Feng Chen <feng.chen@amlogic.com>
2023-07-21 07:01:43 -07:00
Sunny Luo 8620a28dac spi: spicc(v2) add dma sg mode support [1/1]
PD#SWPL-119667

Problem:
spicc(v2) add dma sg mode support

Solution:
spicc(v2) add dma sg mode support

Verify:
T3X BC309

Change-Id: I9ecfcee3e8456c3d857b205cafc6a1b6130a2214
Signed-off-by: Sunny Luo <sunny.luo@amlogic.com>
2023-07-04 21:08:41 -07:00
Sunny Luo 3f835c8f25 spi: spicc(v2) test entry optimize [1/1]
PD#SWPL-124874

Problem:
spi: spicc(v2) test entry optimize

Solution:
spi: spicc(v2) test entry optimize

Verify:
T3X BC309

Change-Id: Id0c3ebff5ea0eb02771e8652a58ecda3c3c2bee4
Signed-off-by: Sunny Luo <sunny.luo@amlogic.com>
2023-06-16 05:34:14 -07:00
Feng Chen b74b9630b4 spicc: spi transfer time optimization [1/1]
PD#SWPL-128155

Problem:
optimize SPI transaction time.

Solution:
optimize SPI transaction time.

Verify:
c3

Change-Id: If8a7d2b1e1d1234f12baca6471ebf2bb64d96ac9
Signed-off-by: Feng Chen <feng.chen@amlogic.com>
2023-06-15 05:06:55 -07:00
Sunny Luo aa855ca63d spi: add dirspi interface for new spicc(v2) controller driver [1/1]
PD#SWPL-124874

Problem:
add dirspi interface for new spicc(v2) controller driver

Solution:
1. add dirspi interface for new spicc(v2) controller driver
2. remove dirspi EXPORT_SYMBOL of old spicc driver, replace with
callback APIs from controller_data

Verify:
T3X BC309

Change-Id: I407b5d3dfa7d88bbe834853817666c9234dabe60
Signed-off-by: Sunny Luo <sunny.luo@amlogic.com>
2023-06-12 00:48:15 -07:00
Sunny Luo cf18a587d2 spi: new spicc(v2) controller 9bit/DC mode bringup [1/1]
PD#SWPL-119664

Problem:
new spicc(v2) controller 9bit/DC mode bringup

Solution:
new spicc(v2) controller 9bit/DC mode bringup

Verify:
T3X BC309

Change-Id: I7115488e35aaba698883ee22bc0b6f6bbfe96788
Signed-off-by: Sunny Luo <sunny.luo@amlogic.com>
2023-06-06 22:43:38 -07:00
Sunny Luo e978b126a5 spi: new spicc(v2) controller slave mode bringup [1/1]
PD#SWPL-119660

Problem:
new spicc(v2) controller slave mode bringup

Solution:
new spicc(v2) controller slave mode bringup

Verify:
T3X BC309

Change-Id: I91aab0f038d452f2eb65b651efe8afb21b0160ad
Signed-off-by: Sunny Luo <sunny.luo@amlogic.com>
2023-05-18 21:08:42 +08:00
Sunny Luo def9f94e2d spi: T3X spicc bringup [1/1]
PD#SWPL-117197

Problem:
T3X SOCs new spi controller driver bringup

Solution:
T3X SOCs new spi controller driver bringup

Verify:
T3X BC302

Change-Id: I90a560f840dea7c3f9ee5984b7795154eca06bd9
Signed-off-by: Sunny Luo <sunny.luo@amlogic.com>
2023-05-18 21:08:41 +08:00
Sunny Luo e7261bb40d spicc: fix xfer timed out error on g12 serials [1/1]
PD#SWPL-122937

Problem:
xfer timed out or set clk rate failed on g12 serials,
because of SCLK parent clk missed

Solution:
Assign the async clk as the parent of SCLK

Verify:
t3

Change-Id: I02247d677c17705f4af413f74baf17625fbd8f41
Signed-off-by: Sunny Luo <sunny.luo@amlogic.com>
2023-05-10 01:36:07 -07:00
Feng Chen 973a3ca6f7 spicc: add driver support [1/1]
PD#SWPL-113267

Problem:
t5w bringup

Solution:
add spicc support

Verify:
t5w

Change-Id: I45a9390517f625e8876e8448a323b1ede587484d
Signed-off-by: Feng Chen <feng.chen@amlogic.com>
2023-04-27 06:55:20 +00:00
Feng Chen 0c699bb18f spicc: c3 build error [1/1]
PD#SWPL-119671

Problem:
no need sram pm

Solution:
add CONFIG_PM control

Verify:
c3

Change-Id: Iaeaaeb31b9c028f4e81b4515f34956c1d86dbbfc
Signed-off-by: Feng Chen <feng.chen@amlogic.com>
2023-04-17 22:10:13 -07:00
Feng Chen 01ca21bede spicc: s5 bringup [1/1]
PD#SWPL-108747

Problem:
s5 bringup

Solution:
add spicc support

Verify:
s5

Change-Id: I39c58d142948079b88fc548183479075c213bb18
Signed-off-by: Feng Chen <feng.chen@amlogic.com>
2023-04-15 08:59:04 +08:00
Feng Chen 775041f87d spicc: spicc not work [1/1]
PD#SWPL-115993

Problem:
spicc not work in android r release

Solution:
make spicc platform driver register
successfully in builtin way

Verify:
t5m

Change-Id: I35edfba35e05a13d895b421a98cebcbd07f4ef55
Signed-off-by: Feng Chen <feng.chen@amlogic.com>
2023-04-05 22:13:39 -07:00
Feng Chen 3bca29f408 spicc: dma transfer timeout [1/1]
PD#SWPL-117579

Problem:
spicc transfer timeout in dma mode

Solution:
fill txbuf in dma read operation

Verify:
t5m

Change-Id: Id9d6cb25f4971b5f0529909110a04a2e6851c42b
Signed-off-by: Feng Chen <feng.chen@amlogic.com>
2023-04-03 22:41:28 -07:00
Feng Chen 5187f9c349 spifc: modify ahb read addr in different soc platform [1/1]
PD#SWPL-107882

Problem:
fault address error cause by  error
spifc ahb read addr.

Solution:
add ahb reg property in dts.

Verify:
c3

Change-Id: I5c125d20750df5f4e2ad756f02d111a128b10c46
Signed-off-by: Feng Chen <feng.chen@amlogic.com>
2023-01-11 03:29:14 -08:00