mirror of
https://github.com/hzyitc/openwrt-redmi-ax3000.git
synced 2025-12-16 08:22:16 +00:00
This commit adds support for Bell XG-140G-Y003 models.
Hardware
--------
SoC: Airoha AN7581
RAM: TN4G16D3CSER-EK (512MB DDR3 1866MHz)
Flash: S35ML02G300 (256M)
ETH: AN7581 GbE Switch (eth0: LAN2, LAN3, LAN4)
EN8811H 2.5GbE PHY (eth1: LAN1)
Installation
------------
1. Connect uart to PC, press enter to login into U-Boot console.
Username: telecomadmin
Password: nE7jA%5m
2. Run the following command to setup bootcmd.
setenv bootcmd 'flash read 0x000c0000 0x880000 $loadaddr && bootm'
saveenv
3. Use a TFTP client to PUT "*-squashfs-factory.bin" to "192.168.1.1".
4. Run the following command to flash.
flash erase 0x000c0000 0x02880000
flash write 0x000c0000 $filesize $loadaddr
5. Reboot.
reset
Signed-off-by: Ziyang Huang <hzyitc@outlook.com>
89 lines
3.0 KiB
Diff
89 lines
3.0 KiB
Diff
From 6d9d6ab3a82af50e36e13e7bc8e2d1b970e39f79 Mon Sep 17 00:00:00 2001
|
|
From: Takahiro Kuwano <Takahiro.Kuwano@infineon.com>
|
|
Date: Tue, 3 Dec 2024 11:46:49 +0900
|
|
Subject: [PATCH 1/1] mtd: spinand: Introduce a way to avoid raw access
|
|
|
|
SkyHigh spinand device has ECC enable bit in configuration register but
|
|
it must be always enabled. If ECC is disabled, read and write ops
|
|
results in undetermined state. For such devices, a way to avoid raw
|
|
access is needed.
|
|
|
|
Introduce SPINAND_NO_RAW_ACCESS flag to advertise the device does not
|
|
support raw access. In such devices, the on-die ECC engine ops returns
|
|
error to I/O request in raw mode.
|
|
|
|
Checking and marking BBM need to be cared as special case, by adding
|
|
fallback mechanism that tries read/write OOB with ECC enabled.
|
|
|
|
Signed-off-by: Takahiro Kuwano <Takahiro.Kuwano@infineon.com>
|
|
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
|
|
---
|
|
drivers/mtd/nand/spi/core.c | 22 ++++++++++++++++++++--
|
|
include/linux/mtd/spinand.h | 1 +
|
|
2 files changed, 21 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c
|
|
index 00e1bfa416ce..f46769eda388 100644
|
|
--- a/drivers/mtd/nand/spi/core.c
|
|
+++ b/drivers/mtd/nand/spi/core.c
|
|
@@ -294,6 +294,9 @@ static int spinand_ondie_ecc_prepare_io_req(struct nand_device *nand,
|
|
struct spinand_device *spinand = nand_to_spinand(nand);
|
|
bool enable = (req->mode != MTD_OPS_RAW);
|
|
|
|
+ if (!enable && spinand->flags & SPINAND_NO_RAW_ACCESS)
|
|
+ return -EOPNOTSUPP;
|
|
+
|
|
memset(spinand->oobbuf, 0xff, nanddev_per_page_oobsize(nand));
|
|
|
|
/* Only enable or disable the engine */
|
|
@@ -901,9 +904,17 @@ static bool spinand_isbad(struct nand_device *nand, const struct nand_pos *pos)
|
|
.oobbuf.in = marker,
|
|
.mode = MTD_OPS_RAW,
|
|
};
|
|
+ int ret;
|
|
|
|
spinand_select_target(spinand, pos->target);
|
|
- spinand_read_page(spinand, &req);
|
|
+
|
|
+ ret = spinand_read_page(spinand, &req);
|
|
+ if (ret == -EOPNOTSUPP) {
|
|
+ /* Retry with ECC in case raw access is not supported */
|
|
+ req.mode = MTD_OPS_PLACE_OOB;
|
|
+ spinand_read_page(spinand, &req);
|
|
+ }
|
|
+
|
|
if (marker[0] != 0xff || marker[1] != 0xff)
|
|
return true;
|
|
|
|
@@ -942,7 +953,14 @@ static int spinand_markbad(struct nand_device *nand, const struct nand_pos *pos)
|
|
if (ret)
|
|
return ret;
|
|
|
|
- return spinand_write_page(spinand, &req);
|
|
+ ret = spinand_write_page(spinand, &req);
|
|
+ if (ret == -EOPNOTSUPP) {
|
|
+ /* Retry with ECC in case raw access is not supported */
|
|
+ req.mode = MTD_OPS_PLACE_OOB;
|
|
+ ret = spinand_write_page(spinand, &req);
|
|
+ }
|
|
+
|
|
+ return ret;
|
|
}
|
|
|
|
static int spinand_mtd_block_markbad(struct mtd_info *mtd, loff_t offs)
|
|
diff --git a/include/linux/mtd/spinand.h b/include/linux/mtd/spinand.h
|
|
index 702e5fb13dae..5cf11005b41a 100644
|
|
--- a/include/linux/mtd/spinand.h
|
|
+++ b/include/linux/mtd/spinand.h
|
|
@@ -314,6 +314,7 @@ struct spinand_ecc_info {
|
|
#define SPINAND_HAS_CR_FEAT_BIT BIT(1)
|
|
#define SPINAND_HAS_PROG_PLANE_SELECT_BIT BIT(2)
|
|
#define SPINAND_HAS_READ_PLANE_SELECT_BIT BIT(3)
|
|
+#define SPINAND_NO_RAW_ACCESS BIT(4)
|
|
|
|
/**
|
|
* struct spinand_ondie_ecc_conf - private SPI-NAND on-die ECC engine structure
|
|
--
|
|
2.40.1
|
|
|