Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.18.33 Removed upstreamed: generic/backport-6.18/742-v7.1-r8152-fix-incorrect-register-write-to-USB_UPHY_XTAL.patch[1] generic/backport-6.18/827-v7.0-crypto-inside-secure-eip93-fix-register-definition.patch[2] generic/backport-6.18/828-v7.0-crypto-inside-secure-eip93-register-hash-before-auth.patch[3] generic/backport-6.18/940-v7.1-net-dsa-realtek-rtl8365mb-fix-mode-mask-calculation.patch[4] generic/pending-6.18/928-crypto-eip93-fix-hmac-setkey-algo-selection.patch[5] All other patches automatically rebased via update_kernel.sh 1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.18.33&id=50c601805fe3 2. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.18.33&id=7ed07c9ce525 3. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.18.33&id=b6263eb2b188 4. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.18.33&id=b707f3109f1a 5. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.18.33&id=fc9310d79fdb Build system: x86/64 Build-tested: x86/64-glibc Run-tested: x86/64-glibc Signed-off-by: John Audia <therealgraysky@proton.me> Link: https://github.com/openwrt/openwrt/pull/23419 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
82 lines
2.2 KiB
Diff
82 lines
2.2 KiB
Diff
From eef758fee8d25f56086eaaf7df1edb19929ced1a Mon Sep 17 00:00:00 2001
|
|
From: "SkyLake.Huang" <skylake.huang@mediatek.com>
|
|
Date: Thu, 23 Jun 2022 18:39:56 +0800
|
|
Subject: [PATCH 5/6] drivers: mtd: spinand: Add calibration support for
|
|
spinand
|
|
|
|
Signed-off-by: SkyLake.Huang <skylake.huang@mediatek.com>
|
|
---
|
|
drivers/mtd/nand/spi/core.c | 54 +++++++++++++++++++++++++++++++++++++
|
|
1 file changed, 54 insertions(+)
|
|
|
|
--- a/drivers/mtd/nand/spi/core.c
|
|
+++ b/drivers/mtd/nand/spi/core.c
|
|
@@ -1270,6 +1270,56 @@ static int spinand_manufacturer_match(st
|
|
return -EOPNOTSUPP;
|
|
}
|
|
|
|
+static int spinand_cal_read(void *priv, u32 *addr, int addrlen, u8 *buf, int readlen) {
|
|
+ struct spinand_device *spinand = (struct spinand_device *)priv;
|
|
+ struct device *dev = &spinand->spimem->spi->dev;
|
|
+ struct spi_mem_op op = SPINAND_PAGE_READ_FROM_CACHE_1S_1S_1S_OP(0, 1, buf, readlen, 0);
|
|
+ struct nand_pos pos;
|
|
+ struct nand_page_io_req req;
|
|
+ u8 status;
|
|
+ int ret;
|
|
+
|
|
+ if(addrlen != sizeof(struct nand_addr)/sizeof(unsigned int)) {
|
|
+ dev_err(dev, "Must provide correct addr(length) for spinand calibration\n");
|
|
+ return -EINVAL;
|
|
+ }
|
|
+
|
|
+ ret = spinand_reset_op(spinand);
|
|
+ if (ret)
|
|
+ return ret;
|
|
+
|
|
+ /* We should store our golden data in first target because
|
|
+ * we can't switch target at this moment.
|
|
+ */
|
|
+ pos = (struct nand_pos){
|
|
+ .target = 0,
|
|
+ .lun = *addr,
|
|
+ .plane = *(addr+1),
|
|
+ .eraseblock = *(addr+2),
|
|
+ .page = *(addr+3),
|
|
+ };
|
|
+
|
|
+ req = (struct nand_page_io_req){
|
|
+ .pos = pos,
|
|
+ .dataoffs = *(addr+4),
|
|
+ .datalen = readlen,
|
|
+ .databuf.in = buf,
|
|
+ .mode = MTD_OPS_AUTO_OOB,
|
|
+ };
|
|
+
|
|
+ ret = spinand_load_page_op(spinand, &req);
|
|
+ if (ret)
|
|
+ return ret;
|
|
+
|
|
+ ret = spinand_wait(spinand, &status);
|
|
+ if (ret < 0)
|
|
+ return ret;
|
|
+
|
|
+ ret = spi_mem_exec_op(spinand->spimem, &op);
|
|
+
|
|
+ return 0;
|
|
+}
|
|
+
|
|
static int spinand_id_detect(struct spinand_device *spinand)
|
|
{
|
|
u8 *id = spinand->id.data;
|
|
@@ -1589,6 +1639,10 @@ static int spinand_init(struct spinand_d
|
|
|
|
spinand_init_ssdr_templates(spinand);
|
|
|
|
+ ret = spi_mem_do_calibration(spinand->spimem, spinand_cal_read, spinand);
|
|
+ if (ret)
|
|
+ dev_err(dev, "Failed to calibrate SPI-NAND (err = %d)\n", ret);
|
|
+
|
|
ret = spinand_detect(spinand);
|
|
if (ret)
|
|
goto err_free_bufs;
|