immortalwrt/package/boot/arm-trusted-firmware-mediatek/patches/0010-add-support-for-dosilicon-fmsh-gsto-spi-nand.patch
Tianling Shen de8a2afc84
uboot-mediatek: import dosilicon/fmsh/gsto spi nand support
Imported from linux-rockchip tree:
https://github.com/armbian/linux-rockchip/tree/rk-6.1-rkr5/drivers/mtd/nand/spi

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
(cherry picked from commit df588a6827a26410a1b66f618aa11152d83bd6cb)
2025-03-09 16:42:39 +08:00

37 lines
1.1 KiB
Diff

--- a/plat/mediatek/apsoc_common/drivers/spi_nand/mtk_spi_nand.c
+++ b/plat/mediatek/apsoc_common/drivers/spi_nand/mtk_spi_nand.c
@@ -19,8 +19,11 @@
#define SPI_NAND_MAX_ID_LEN 4U
#define DELAY_US_400MS 400000U
+#define DOSILICON_ID 0xE5U
#define ETRON_ID 0xD5U
+#define FMSH_ID 0xA1U
#define GIGADEVICE_ID 0xC8U
+#define GSTO_ID 0x52U
#define MACRONIX_ID 0xC2U
#define MICRON_ID 0x2CU
#define TOSHIBA_ID 0x98U
@@ -129,7 +132,10 @@ static int spi_nand_quad_enable(uint8_t
if (manufacturer_id != MACRONIX_ID &&
manufacturer_id != GIGADEVICE_ID &&
+ manufacturer_id != GSTO_ID &&
+ manufacturer_id != DOSILICON_ID &&
manufacturer_id != ETRON_ID &&
+ manufacturer_id != FMSH_ID &&
manufacturer_id != FORESEE_ID) {
return 0;
}
@@ -364,6 +370,10 @@ static int spi_nand_check_pp(struct para
INFO("PP COPY %d CRC read: 0x%x, compute: 0x%x\n",
i, crc, crc_compute);
+ // HACK: for FMSH
+ if (crc != crc_compute)
+ crc = htobe16(pp->integrity_crc);
+
if (crc != crc_compute) {
ret = -EBADMSG;
continue;