* [PATCH v1] mtd: rawnand: macronix: OTP access for MX30LFxG18AC
@ 2023-04-26 7:24 ` Arseniy Krasnov
0 siblings, 0 replies; 25+ messages in thread
From: Arseniy Krasnov @ 2023-04-26 7:24 UTC (permalink / raw)
To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
Sumit Semwal, Christian König, Arseniy Krasnov
Cc: oxffffaa, kernel, linux-mtd, linux-kernel, linux-media, dri-devel,
linaro-mm-sig
This adds support for OTP area access on MX30LFxG18AC chip series.
Signed-off-by: Arseniy Krasnov <AVKrasnov@sberdevices.ru>
---
drivers/mtd/nand/raw/nand_macronix.c | 212 +++++++++++++++++++++++++++
1 file changed, 212 insertions(+)
diff --git a/drivers/mtd/nand/raw/nand_macronix.c b/drivers/mtd/nand/raw/nand_macronix.c
index 1472f925f386..c0d12979933a 100644
--- a/drivers/mtd/nand/raw/nand_macronix.c
+++ b/drivers/mtd/nand/raw/nand_macronix.c
@@ -31,6 +31,20 @@
#define MXIC_CMD_POWER_DOWN 0xB9
+#define ONFI_FEATURE_ADDR_30LFXG18AC_OTP 0x90
+#define MACRONIX_30LFXG18AC_OTP_START_PAGE 0
+#define MACRONIX_30LFXG18AC_OTP_PAGES 30
+#define MACRONIX_30LFXG18AC_OTP_PAGE_SIZE 2112
+#define MACRONIX_30LFXG18AC_OTP_START_BYTE \
+ (MACRONIX_30LFXG18AC_OTP_START_PAGE * \
+ MACRONIX_30LFXG18AC_OTP_PAGE_SIZE)
+#define MACRONIX_30LFXG18AC_OTP_SIZE_BYTES \
+ (MACRONIX_30LFXG18AC_OTP_PAGES * \
+ MACRONIX_30LFXG18AC_OTP_PAGE_SIZE)
+
+#define MACRONIX_30LFXG18AC_OTP_EN BIT(0)
+#define MACRONIX_30LFXG18AC_OTP_LOCKED BIT(1)
+
struct nand_onfi_vendor_macronix {
u8 reserved;
u8 reliability_func;
@@ -316,6 +330,203 @@ static void macronix_nand_deep_power_down_support(struct nand_chip *chip)
chip->ops.resume = mxic_nand_resume;
}
+static int macronix_30lfxg18ac_get_otp_info(struct mtd_info *mtd, size_t len,
+ size_t *retlen,
+ struct otp_info *buf)
+{
+ if (len < sizeof(*buf))
+ return -EINVAL;
+
+ /* Don't know how to check that OTP is locked. */
+ buf->locked = 0;
+ buf->start = MACRONIX_30LFXG18AC_OTP_START_BYTE;
+ buf->length = MACRONIX_30LFXG18AC_OTP_SIZE_BYTES;
+
+ *retlen = sizeof(*buf);
+
+ return 0;
+}
+
+static int macronix_30lfxg18ac_otp_enable(struct nand_chip *nand)
+{
+ uint8_t feature_buf[ONFI_SUBFEATURE_PARAM_LEN] = { 0 };
+
+ feature_buf[0] = MACRONIX_30LFXG18AC_OTP_EN;
+ return nand_set_features(nand, ONFI_FEATURE_ADDR_30LFXG18AC_OTP,
+ feature_buf);
+}
+
+static int macronix_30lfxg18ac_otp_disable(struct nand_chip *nand)
+{
+ uint8_t feature_buf[ONFI_SUBFEATURE_PARAM_LEN] = { 0 };
+
+ return nand_set_features(nand, ONFI_FEATURE_ADDR_30LFXG18AC_OTP,
+ feature_buf);
+}
+
+static int __macronix_30lfxg18ac_rw_otp(struct mtd_info *mtd,
+ loff_t offs_in_flash,
+ size_t len, size_t *retlen,
+ u_char *buf, bool write)
+{
+ struct nand_chip *nand;
+ size_t bytes_handled;
+ unsigned long page;
+ off_t offs_in_page;
+ void *dma_buf;
+ int ret;
+
+ /* 'nand_prog/read_page_op()' may use 'buf' as DMA buffer,
+ * so allocate properly aligned memory for it. This is
+ * needed because cross page accesses may lead to unaligned
+ * buffer address for DMA.
+ */
+ dma_buf = kmalloc(MACRONIX_30LFXG18AC_OTP_PAGE_SIZE, GFP_KERNEL);
+ if (!dma_buf)
+ return -ENOMEM;
+
+ nand = mtd_to_nand(mtd);
+ nand_select_target(nand, 0);
+
+ ret = macronix_30lfxg18ac_otp_enable(nand);
+ if (ret)
+ goto out_otp;
+
+ page = offs_in_flash;
+ /* 'page' will be result of division. */
+ offs_in_page = do_div(page, MACRONIX_30LFXG18AC_OTP_PAGE_SIZE);
+ bytes_handled = 0;
+
+ while (bytes_handled < len &&
+ page < MACRONIX_30LFXG18AC_OTP_PAGES) {
+ size_t bytes_to_handle;
+
+ bytes_to_handle = min_t(size_t, len - bytes_handled,
+ MACRONIX_30LFXG18AC_OTP_PAGE_SIZE -
+ offs_in_page);
+
+ if (write) {
+ memcpy(dma_buf, &buf[bytes_handled], bytes_to_handle);
+ ret = nand_prog_page_op(nand, page, offs_in_page,
+ dma_buf, bytes_to_handle);
+ } else {
+ ret = nand_read_page_op(nand, page, offs_in_page,
+ dma_buf, bytes_to_handle);
+ if (!ret)
+ memcpy(&buf[bytes_handled], dma_buf,
+ bytes_to_handle);
+ }
+ if (ret)
+ goto out_otp;
+
+ bytes_handled += bytes_to_handle;
+ offs_in_page = 0;
+ page++;
+ }
+
+ *retlen = bytes_handled;
+
+out_otp:
+ if (ret)
+ dev_err(&mtd->dev, "failed to perform OTP IO: %i\n", ret);
+
+ ret = macronix_30lfxg18ac_otp_disable(nand);
+ WARN(ret, "failed to leave OTP mode after %s\n",
+ write ? "write" : "read");
+ nand_deselect_target(nand);
+ kfree(dma_buf);
+
+ return ret;
+}
+
+static int macronix_30lfxg18ac_write_otp(struct mtd_info *mtd, loff_t to,
+ size_t len, size_t *rlen,
+ const u_char *buf)
+{
+ return __macronix_30lfxg18ac_rw_otp(mtd, to, len, rlen, (u_char *)buf,
+ true);
+}
+
+static int macronix_30lfxg18ac_read_otp(struct mtd_info *mtd, loff_t from,
+ size_t len, size_t *rlen,
+ u_char *buf)
+{
+ return __macronix_30lfxg18ac_rw_otp(mtd, from, len, rlen, buf, false);
+}
+
+static int macronix_30lfxg18ac_lock_otp(struct mtd_info *mtd, loff_t from,
+ size_t len)
+{
+ uint8_t feature_buf[ONFI_SUBFEATURE_PARAM_LEN] = { 0 };
+ struct nand_chip *nand;
+ int ret;
+
+ if (from != MACRONIX_30LFXG18AC_OTP_START_BYTE ||
+ len != MACRONIX_30LFXG18AC_OTP_SIZE_BYTES)
+ return -EINVAL;
+
+ dev_dbg(&mtd->dev, "locking OTP\n");
+
+ nand = mtd_to_nand(mtd);
+ nand_select_target(nand, 0);
+
+ feature_buf[0] = MACRONIX_30LFXG18AC_OTP_EN |
+ MACRONIX_30LFXG18AC_OTP_LOCKED;
+ ret = nand_set_features(nand, ONFI_FEATURE_ADDR_30LFXG18AC_OTP,
+ feature_buf);
+ if (ret) {
+ dev_err(&mtd->dev,
+ "failed to lock OTP (set features): %i\n", ret);
+ nand_deselect_target(nand);
+ return ret;
+ }
+
+ /* Do dummy page prog with zero address. */
+ feature_buf[0] = 0;
+ ret = nand_prog_page_op(nand, 0, 0, feature_buf, 1);
+ if (ret)
+ dev_err(&mtd->dev,
+ "failed to lock OTP (page prog): %i\n", ret);
+
+ ret = macronix_30lfxg18ac_otp_disable(nand);
+ WARN(ret, "failed to leave OTP mode after lock\n");
+
+ nand_deselect_target(nand);
+
+ return ret;
+}
+
+static void macronix_nand_setup_otp(struct nand_chip *chip)
+{
+ static const char * const supported_otp_models[] = {
+ "MX30LF1G18AC",
+ "MX30LF2G18AC",
+ "MX30LF4G18AC",
+ };
+ struct mtd_info *mtd;
+
+ if (!chip->parameters.supports_set_get_features)
+ return;
+
+ if (match_string(supported_otp_models,
+ ARRAY_SIZE(supported_otp_models),
+ chip->parameters.model) < 0)
+ return;
+
+ bitmap_set(chip->parameters.get_feature_list,
+ ONFI_FEATURE_ADDR_30LFXG18AC_OTP, 1);
+ bitmap_set(chip->parameters.set_feature_list,
+ ONFI_FEATURE_ADDR_30LFXG18AC_OTP, 1);
+
+ mtd = nand_to_mtd(chip);
+ mtd->_get_fact_prot_info = macronix_30lfxg18ac_get_otp_info;
+ mtd->_read_fact_prot_reg = macronix_30lfxg18ac_read_otp;
+ mtd->_get_user_prot_info = macronix_30lfxg18ac_get_otp_info;
+ mtd->_read_user_prot_reg = macronix_30lfxg18ac_read_otp;
+ mtd->_write_user_prot_reg = macronix_30lfxg18ac_write_otp;
+ mtd->_lock_user_prot_reg = macronix_30lfxg18ac_lock_otp;
+}
+
static int macronix_nand_init(struct nand_chip *chip)
{
if (nand_is_slc(chip))
@@ -325,6 +536,7 @@ static int macronix_nand_init(struct nand_chip *chip)
macronix_nand_onfi_init(chip);
macronix_nand_block_protection_support(chip);
macronix_nand_deep_power_down_support(chip);
+ macronix_nand_setup_otp(chip);
return 0;
}
--
2.35.0
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v1] mtd: rawnand: macronix: OTP access for MX30LFxG18AC
@ 2023-04-26 7:24 ` Arseniy Krasnov
0 siblings, 0 replies; 25+ messages in thread
From: Arseniy Krasnov @ 2023-04-26 7:24 UTC (permalink / raw)
To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
Sumit Semwal, Christian König, Arseniy Krasnov
Cc: linux-kernel, dri-devel, linaro-mm-sig, linux-mtd, oxffffaa,
kernel, linux-media
This adds support for OTP area access on MX30LFxG18AC chip series.
Signed-off-by: Arseniy Krasnov <AVKrasnov@sberdevices.ru>
---
drivers/mtd/nand/raw/nand_macronix.c | 212 +++++++++++++++++++++++++++
1 file changed, 212 insertions(+)
diff --git a/drivers/mtd/nand/raw/nand_macronix.c b/drivers/mtd/nand/raw/nand_macronix.c
index 1472f925f386..c0d12979933a 100644
--- a/drivers/mtd/nand/raw/nand_macronix.c
+++ b/drivers/mtd/nand/raw/nand_macronix.c
@@ -31,6 +31,20 @@
#define MXIC_CMD_POWER_DOWN 0xB9
+#define ONFI_FEATURE_ADDR_30LFXG18AC_OTP 0x90
+#define MACRONIX_30LFXG18AC_OTP_START_PAGE 0
+#define MACRONIX_30LFXG18AC_OTP_PAGES 30
+#define MACRONIX_30LFXG18AC_OTP_PAGE_SIZE 2112
+#define MACRONIX_30LFXG18AC_OTP_START_BYTE \
+ (MACRONIX_30LFXG18AC_OTP_START_PAGE * \
+ MACRONIX_30LFXG18AC_OTP_PAGE_SIZE)
+#define MACRONIX_30LFXG18AC_OTP_SIZE_BYTES \
+ (MACRONIX_30LFXG18AC_OTP_PAGES * \
+ MACRONIX_30LFXG18AC_OTP_PAGE_SIZE)
+
+#define MACRONIX_30LFXG18AC_OTP_EN BIT(0)
+#define MACRONIX_30LFXG18AC_OTP_LOCKED BIT(1)
+
struct nand_onfi_vendor_macronix {
u8 reserved;
u8 reliability_func;
@@ -316,6 +330,203 @@ static void macronix_nand_deep_power_down_support(struct nand_chip *chip)
chip->ops.resume = mxic_nand_resume;
}
+static int macronix_30lfxg18ac_get_otp_info(struct mtd_info *mtd, size_t len,
+ size_t *retlen,
+ struct otp_info *buf)
+{
+ if (len < sizeof(*buf))
+ return -EINVAL;
+
+ /* Don't know how to check that OTP is locked. */
+ buf->locked = 0;
+ buf->start = MACRONIX_30LFXG18AC_OTP_START_BYTE;
+ buf->length = MACRONIX_30LFXG18AC_OTP_SIZE_BYTES;
+
+ *retlen = sizeof(*buf);
+
+ return 0;
+}
+
+static int macronix_30lfxg18ac_otp_enable(struct nand_chip *nand)
+{
+ uint8_t feature_buf[ONFI_SUBFEATURE_PARAM_LEN] = { 0 };
+
+ feature_buf[0] = MACRONIX_30LFXG18AC_OTP_EN;
+ return nand_set_features(nand, ONFI_FEATURE_ADDR_30LFXG18AC_OTP,
+ feature_buf);
+}
+
+static int macronix_30lfxg18ac_otp_disable(struct nand_chip *nand)
+{
+ uint8_t feature_buf[ONFI_SUBFEATURE_PARAM_LEN] = { 0 };
+
+ return nand_set_features(nand, ONFI_FEATURE_ADDR_30LFXG18AC_OTP,
+ feature_buf);
+}
+
+static int __macronix_30lfxg18ac_rw_otp(struct mtd_info *mtd,
+ loff_t offs_in_flash,
+ size_t len, size_t *retlen,
+ u_char *buf, bool write)
+{
+ struct nand_chip *nand;
+ size_t bytes_handled;
+ unsigned long page;
+ off_t offs_in_page;
+ void *dma_buf;
+ int ret;
+
+ /* 'nand_prog/read_page_op()' may use 'buf' as DMA buffer,
+ * so allocate properly aligned memory for it. This is
+ * needed because cross page accesses may lead to unaligned
+ * buffer address for DMA.
+ */
+ dma_buf = kmalloc(MACRONIX_30LFXG18AC_OTP_PAGE_SIZE, GFP_KERNEL);
+ if (!dma_buf)
+ return -ENOMEM;
+
+ nand = mtd_to_nand(mtd);
+ nand_select_target(nand, 0);
+
+ ret = macronix_30lfxg18ac_otp_enable(nand);
+ if (ret)
+ goto out_otp;
+
+ page = offs_in_flash;
+ /* 'page' will be result of division. */
+ offs_in_page = do_div(page, MACRONIX_30LFXG18AC_OTP_PAGE_SIZE);
+ bytes_handled = 0;
+
+ while (bytes_handled < len &&
+ page < MACRONIX_30LFXG18AC_OTP_PAGES) {
+ size_t bytes_to_handle;
+
+ bytes_to_handle = min_t(size_t, len - bytes_handled,
+ MACRONIX_30LFXG18AC_OTP_PAGE_SIZE -
+ offs_in_page);
+
+ if (write) {
+ memcpy(dma_buf, &buf[bytes_handled], bytes_to_handle);
+ ret = nand_prog_page_op(nand, page, offs_in_page,
+ dma_buf, bytes_to_handle);
+ } else {
+ ret = nand_read_page_op(nand, page, offs_in_page,
+ dma_buf, bytes_to_handle);
+ if (!ret)
+ memcpy(&buf[bytes_handled], dma_buf,
+ bytes_to_handle);
+ }
+ if (ret)
+ goto out_otp;
+
+ bytes_handled += bytes_to_handle;
+ offs_in_page = 0;
+ page++;
+ }
+
+ *retlen = bytes_handled;
+
+out_otp:
+ if (ret)
+ dev_err(&mtd->dev, "failed to perform OTP IO: %i\n", ret);
+
+ ret = macronix_30lfxg18ac_otp_disable(nand);
+ WARN(ret, "failed to leave OTP mode after %s\n",
+ write ? "write" : "read");
+ nand_deselect_target(nand);
+ kfree(dma_buf);
+
+ return ret;
+}
+
+static int macronix_30lfxg18ac_write_otp(struct mtd_info *mtd, loff_t to,
+ size_t len, size_t *rlen,
+ const u_char *buf)
+{
+ return __macronix_30lfxg18ac_rw_otp(mtd, to, len, rlen, (u_char *)buf,
+ true);
+}
+
+static int macronix_30lfxg18ac_read_otp(struct mtd_info *mtd, loff_t from,
+ size_t len, size_t *rlen,
+ u_char *buf)
+{
+ return __macronix_30lfxg18ac_rw_otp(mtd, from, len, rlen, buf, false);
+}
+
+static int macronix_30lfxg18ac_lock_otp(struct mtd_info *mtd, loff_t from,
+ size_t len)
+{
+ uint8_t feature_buf[ONFI_SUBFEATURE_PARAM_LEN] = { 0 };
+ struct nand_chip *nand;
+ int ret;
+
+ if (from != MACRONIX_30LFXG18AC_OTP_START_BYTE ||
+ len != MACRONIX_30LFXG18AC_OTP_SIZE_BYTES)
+ return -EINVAL;
+
+ dev_dbg(&mtd->dev, "locking OTP\n");
+
+ nand = mtd_to_nand(mtd);
+ nand_select_target(nand, 0);
+
+ feature_buf[0] = MACRONIX_30LFXG18AC_OTP_EN |
+ MACRONIX_30LFXG18AC_OTP_LOCKED;
+ ret = nand_set_features(nand, ONFI_FEATURE_ADDR_30LFXG18AC_OTP,
+ feature_buf);
+ if (ret) {
+ dev_err(&mtd->dev,
+ "failed to lock OTP (set features): %i\n", ret);
+ nand_deselect_target(nand);
+ return ret;
+ }
+
+ /* Do dummy page prog with zero address. */
+ feature_buf[0] = 0;
+ ret = nand_prog_page_op(nand, 0, 0, feature_buf, 1);
+ if (ret)
+ dev_err(&mtd->dev,
+ "failed to lock OTP (page prog): %i\n", ret);
+
+ ret = macronix_30lfxg18ac_otp_disable(nand);
+ WARN(ret, "failed to leave OTP mode after lock\n");
+
+ nand_deselect_target(nand);
+
+ return ret;
+}
+
+static void macronix_nand_setup_otp(struct nand_chip *chip)
+{
+ static const char * const supported_otp_models[] = {
+ "MX30LF1G18AC",
+ "MX30LF2G18AC",
+ "MX30LF4G18AC",
+ };
+ struct mtd_info *mtd;
+
+ if (!chip->parameters.supports_set_get_features)
+ return;
+
+ if (match_string(supported_otp_models,
+ ARRAY_SIZE(supported_otp_models),
+ chip->parameters.model) < 0)
+ return;
+
+ bitmap_set(chip->parameters.get_feature_list,
+ ONFI_FEATURE_ADDR_30LFXG18AC_OTP, 1);
+ bitmap_set(chip->parameters.set_feature_list,
+ ONFI_FEATURE_ADDR_30LFXG18AC_OTP, 1);
+
+ mtd = nand_to_mtd(chip);
+ mtd->_get_fact_prot_info = macronix_30lfxg18ac_get_otp_info;
+ mtd->_read_fact_prot_reg = macronix_30lfxg18ac_read_otp;
+ mtd->_get_user_prot_info = macronix_30lfxg18ac_get_otp_info;
+ mtd->_read_user_prot_reg = macronix_30lfxg18ac_read_otp;
+ mtd->_write_user_prot_reg = macronix_30lfxg18ac_write_otp;
+ mtd->_lock_user_prot_reg = macronix_30lfxg18ac_lock_otp;
+}
+
static int macronix_nand_init(struct nand_chip *chip)
{
if (nand_is_slc(chip))
@@ -325,6 +536,7 @@ static int macronix_nand_init(struct nand_chip *chip)
macronix_nand_onfi_init(chip);
macronix_nand_block_protection_support(chip);
macronix_nand_deep_power_down_support(chip);
+ macronix_nand_setup_otp(chip);
return 0;
}
--
2.35.0
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v1] mtd: rawnand: macronix: OTP access for MX30LFxG18AC
@ 2023-04-26 7:24 ` Arseniy Krasnov
0 siblings, 0 replies; 25+ messages in thread
From: Arseniy Krasnov @ 2023-04-26 7:24 UTC (permalink / raw)
To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
Sumit Semwal, Christian König, Arseniy Krasnov
Cc: oxffffaa, kernel, linux-mtd, linux-kernel, linux-media, dri-devel,
linaro-mm-sig
This adds support for OTP area access on MX30LFxG18AC chip series.
Signed-off-by: Arseniy Krasnov <AVKrasnov@sberdevices.ru>
---
drivers/mtd/nand/raw/nand_macronix.c | 212 +++++++++++++++++++++++++++
1 file changed, 212 insertions(+)
diff --git a/drivers/mtd/nand/raw/nand_macronix.c b/drivers/mtd/nand/raw/nand_macronix.c
index 1472f925f386..c0d12979933a 100644
--- a/drivers/mtd/nand/raw/nand_macronix.c
+++ b/drivers/mtd/nand/raw/nand_macronix.c
@@ -31,6 +31,20 @@
#define MXIC_CMD_POWER_DOWN 0xB9
+#define ONFI_FEATURE_ADDR_30LFXG18AC_OTP 0x90
+#define MACRONIX_30LFXG18AC_OTP_START_PAGE 0
+#define MACRONIX_30LFXG18AC_OTP_PAGES 30
+#define MACRONIX_30LFXG18AC_OTP_PAGE_SIZE 2112
+#define MACRONIX_30LFXG18AC_OTP_START_BYTE \
+ (MACRONIX_30LFXG18AC_OTP_START_PAGE * \
+ MACRONIX_30LFXG18AC_OTP_PAGE_SIZE)
+#define MACRONIX_30LFXG18AC_OTP_SIZE_BYTES \
+ (MACRONIX_30LFXG18AC_OTP_PAGES * \
+ MACRONIX_30LFXG18AC_OTP_PAGE_SIZE)
+
+#define MACRONIX_30LFXG18AC_OTP_EN BIT(0)
+#define MACRONIX_30LFXG18AC_OTP_LOCKED BIT(1)
+
struct nand_onfi_vendor_macronix {
u8 reserved;
u8 reliability_func;
@@ -316,6 +330,203 @@ static void macronix_nand_deep_power_down_support(struct nand_chip *chip)
chip->ops.resume = mxic_nand_resume;
}
+static int macronix_30lfxg18ac_get_otp_info(struct mtd_info *mtd, size_t len,
+ size_t *retlen,
+ struct otp_info *buf)
+{
+ if (len < sizeof(*buf))
+ return -EINVAL;
+
+ /* Don't know how to check that OTP is locked. */
+ buf->locked = 0;
+ buf->start = MACRONIX_30LFXG18AC_OTP_START_BYTE;
+ buf->length = MACRONIX_30LFXG18AC_OTP_SIZE_BYTES;
+
+ *retlen = sizeof(*buf);
+
+ return 0;
+}
+
+static int macronix_30lfxg18ac_otp_enable(struct nand_chip *nand)
+{
+ uint8_t feature_buf[ONFI_SUBFEATURE_PARAM_LEN] = { 0 };
+
+ feature_buf[0] = MACRONIX_30LFXG18AC_OTP_EN;
+ return nand_set_features(nand, ONFI_FEATURE_ADDR_30LFXG18AC_OTP,
+ feature_buf);
+}
+
+static int macronix_30lfxg18ac_otp_disable(struct nand_chip *nand)
+{
+ uint8_t feature_buf[ONFI_SUBFEATURE_PARAM_LEN] = { 0 };
+
+ return nand_set_features(nand, ONFI_FEATURE_ADDR_30LFXG18AC_OTP,
+ feature_buf);
+}
+
+static int __macronix_30lfxg18ac_rw_otp(struct mtd_info *mtd,
+ loff_t offs_in_flash,
+ size_t len, size_t *retlen,
+ u_char *buf, bool write)
+{
+ struct nand_chip *nand;
+ size_t bytes_handled;
+ unsigned long page;
+ off_t offs_in_page;
+ void *dma_buf;
+ int ret;
+
+ /* 'nand_prog/read_page_op()' may use 'buf' as DMA buffer,
+ * so allocate properly aligned memory for it. This is
+ * needed because cross page accesses may lead to unaligned
+ * buffer address for DMA.
+ */
+ dma_buf = kmalloc(MACRONIX_30LFXG18AC_OTP_PAGE_SIZE, GFP_KERNEL);
+ if (!dma_buf)
+ return -ENOMEM;
+
+ nand = mtd_to_nand(mtd);
+ nand_select_target(nand, 0);
+
+ ret = macronix_30lfxg18ac_otp_enable(nand);
+ if (ret)
+ goto out_otp;
+
+ page = offs_in_flash;
+ /* 'page' will be result of division. */
+ offs_in_page = do_div(page, MACRONIX_30LFXG18AC_OTP_PAGE_SIZE);
+ bytes_handled = 0;
+
+ while (bytes_handled < len &&
+ page < MACRONIX_30LFXG18AC_OTP_PAGES) {
+ size_t bytes_to_handle;
+
+ bytes_to_handle = min_t(size_t, len - bytes_handled,
+ MACRONIX_30LFXG18AC_OTP_PAGE_SIZE -
+ offs_in_page);
+
+ if (write) {
+ memcpy(dma_buf, &buf[bytes_handled], bytes_to_handle);
+ ret = nand_prog_page_op(nand, page, offs_in_page,
+ dma_buf, bytes_to_handle);
+ } else {
+ ret = nand_read_page_op(nand, page, offs_in_page,
+ dma_buf, bytes_to_handle);
+ if (!ret)
+ memcpy(&buf[bytes_handled], dma_buf,
+ bytes_to_handle);
+ }
+ if (ret)
+ goto out_otp;
+
+ bytes_handled += bytes_to_handle;
+ offs_in_page = 0;
+ page++;
+ }
+
+ *retlen = bytes_handled;
+
+out_otp:
+ if (ret)
+ dev_err(&mtd->dev, "failed to perform OTP IO: %i\n", ret);
+
+ ret = macronix_30lfxg18ac_otp_disable(nand);
+ WARN(ret, "failed to leave OTP mode after %s\n",
+ write ? "write" : "read");
+ nand_deselect_target(nand);
+ kfree(dma_buf);
+
+ return ret;
+}
+
+static int macronix_30lfxg18ac_write_otp(struct mtd_info *mtd, loff_t to,
+ size_t len, size_t *rlen,
+ const u_char *buf)
+{
+ return __macronix_30lfxg18ac_rw_otp(mtd, to, len, rlen, (u_char *)buf,
+ true);
+}
+
+static int macronix_30lfxg18ac_read_otp(struct mtd_info *mtd, loff_t from,
+ size_t len, size_t *rlen,
+ u_char *buf)
+{
+ return __macronix_30lfxg18ac_rw_otp(mtd, from, len, rlen, buf, false);
+}
+
+static int macronix_30lfxg18ac_lock_otp(struct mtd_info *mtd, loff_t from,
+ size_t len)
+{
+ uint8_t feature_buf[ONFI_SUBFEATURE_PARAM_LEN] = { 0 };
+ struct nand_chip *nand;
+ int ret;
+
+ if (from != MACRONIX_30LFXG18AC_OTP_START_BYTE ||
+ len != MACRONIX_30LFXG18AC_OTP_SIZE_BYTES)
+ return -EINVAL;
+
+ dev_dbg(&mtd->dev, "locking OTP\n");
+
+ nand = mtd_to_nand(mtd);
+ nand_select_target(nand, 0);
+
+ feature_buf[0] = MACRONIX_30LFXG18AC_OTP_EN |
+ MACRONIX_30LFXG18AC_OTP_LOCKED;
+ ret = nand_set_features(nand, ONFI_FEATURE_ADDR_30LFXG18AC_OTP,
+ feature_buf);
+ if (ret) {
+ dev_err(&mtd->dev,
+ "failed to lock OTP (set features): %i\n", ret);
+ nand_deselect_target(nand);
+ return ret;
+ }
+
+ /* Do dummy page prog with zero address. */
+ feature_buf[0] = 0;
+ ret = nand_prog_page_op(nand, 0, 0, feature_buf, 1);
+ if (ret)
+ dev_err(&mtd->dev,
+ "failed to lock OTP (page prog): %i\n", ret);
+
+ ret = macronix_30lfxg18ac_otp_disable(nand);
+ WARN(ret, "failed to leave OTP mode after lock\n");
+
+ nand_deselect_target(nand);
+
+ return ret;
+}
+
+static void macronix_nand_setup_otp(struct nand_chip *chip)
+{
+ static const char * const supported_otp_models[] = {
+ "MX30LF1G18AC",
+ "MX30LF2G18AC",
+ "MX30LF4G18AC",
+ };
+ struct mtd_info *mtd;
+
+ if (!chip->parameters.supports_set_get_features)
+ return;
+
+ if (match_string(supported_otp_models,
+ ARRAY_SIZE(supported_otp_models),
+ chip->parameters.model) < 0)
+ return;
+
+ bitmap_set(chip->parameters.get_feature_list,
+ ONFI_FEATURE_ADDR_30LFXG18AC_OTP, 1);
+ bitmap_set(chip->parameters.set_feature_list,
+ ONFI_FEATURE_ADDR_30LFXG18AC_OTP, 1);
+
+ mtd = nand_to_mtd(chip);
+ mtd->_get_fact_prot_info = macronix_30lfxg18ac_get_otp_info;
+ mtd->_read_fact_prot_reg = macronix_30lfxg18ac_read_otp;
+ mtd->_get_user_prot_info = macronix_30lfxg18ac_get_otp_info;
+ mtd->_read_user_prot_reg = macronix_30lfxg18ac_read_otp;
+ mtd->_write_user_prot_reg = macronix_30lfxg18ac_write_otp;
+ mtd->_lock_user_prot_reg = macronix_30lfxg18ac_lock_otp;
+}
+
static int macronix_nand_init(struct nand_chip *chip)
{
if (nand_is_slc(chip))
@@ -325,6 +536,7 @@ static int macronix_nand_init(struct nand_chip *chip)
macronix_nand_onfi_init(chip);
macronix_nand_block_protection_support(chip);
macronix_nand_deep_power_down_support(chip);
+ macronix_nand_setup_otp(chip);
return 0;
}
--
2.35.0
^ permalink raw reply related [flat|nested] 25+ messages in thread
* Re: [PATCH v1] mtd: rawnand: macronix: OTP access for MX30LFxG18AC
2023-04-26 7:24 ` Arseniy Krasnov
(?)
@ 2023-04-26 9:21 ` kernel test robot
-1 siblings, 0 replies; 25+ messages in thread
From: kernel test robot @ 2023-04-26 9:21 UTC (permalink / raw)
To: Arseniy Krasnov, Miquel Raynal, Richard Weinberger,
Vignesh Raghavendra, Sumit Semwal, Christian König
Cc: oe-kbuild-all, oxffffaa, kernel, linux-mtd, linux-kernel,
linux-media, dri-devel, linaro-mm-sig
Hi Arseniy,
kernel test robot noticed the following build errors:
[auto build test ERROR on mtd/nand/next]
[also build test ERROR on linus/master v6.3 next-20230425]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Arseniy-Krasnov/mtd-rawnand-macronix-OTP-access-for-MX30LFxG18AC/20230426-153143
base: https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next
patch link: https://lore.kernel.org/r/20230426072455.3887717-1-AVKrasnov%40sberdevices.ru
patch subject: [PATCH v1] mtd: rawnand: macronix: OTP access for MX30LFxG18AC
config: m68k-allyesconfig (https://download.01.org/0day-ci/archive/20230426/202304261704.eyrD5KVk-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/3529f3465e99379489b59c035a8a0506c3756ef4
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Arseniy-Krasnov/mtd-rawnand-macronix-OTP-access-for-MX30LFxG18AC/20230426-153143
git checkout 3529f3465e99379489b59c035a8a0506c3756ef4
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=m68k olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=m68k SHELL=/bin/bash drivers/mtd/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202304261704.eyrD5KVk-lkp@intel.com/
All error/warnings (new ones prefixed by >>):
drivers/mtd/nand/raw/nand_macronix.c: In function '__macronix_30lfxg18ac_rw_otp':
>> drivers/mtd/nand/raw/nand_macronix.c:384:19: error: implicit declaration of function 'kmalloc'; did you mean 'mm_alloc'? [-Werror=implicit-function-declaration]
384 | dma_buf = kmalloc(MACRONIX_30LFXG18AC_OTP_PAGE_SIZE, GFP_KERNEL);
| ^~~~~~~
| mm_alloc
>> drivers/mtd/nand/raw/nand_macronix.c:384:17: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
384 | dma_buf = kmalloc(MACRONIX_30LFXG18AC_OTP_PAGE_SIZE, GFP_KERNEL);
| ^
>> drivers/mtd/nand/raw/nand_macronix.c:437:9: error: implicit declaration of function 'kfree'; did you mean 'kvfree'? [-Werror=implicit-function-declaration]
437 | kfree(dma_buf);
| ^~~~~
| kvfree
cc1: some warnings being treated as errors
vim +384 drivers/mtd/nand/raw/nand_macronix.c
366
367 static int __macronix_30lfxg18ac_rw_otp(struct mtd_info *mtd,
368 loff_t offs_in_flash,
369 size_t len, size_t *retlen,
370 u_char *buf, bool write)
371 {
372 struct nand_chip *nand;
373 size_t bytes_handled;
374 unsigned long page;
375 off_t offs_in_page;
376 void *dma_buf;
377 int ret;
378
379 /* 'nand_prog/read_page_op()' may use 'buf' as DMA buffer,
380 * so allocate properly aligned memory for it. This is
381 * needed because cross page accesses may lead to unaligned
382 * buffer address for DMA.
383 */
> 384 dma_buf = kmalloc(MACRONIX_30LFXG18AC_OTP_PAGE_SIZE, GFP_KERNEL);
385 if (!dma_buf)
386 return -ENOMEM;
387
388 nand = mtd_to_nand(mtd);
389 nand_select_target(nand, 0);
390
391 ret = macronix_30lfxg18ac_otp_enable(nand);
392 if (ret)
393 goto out_otp;
394
395 page = offs_in_flash;
396 /* 'page' will be result of division. */
397 offs_in_page = do_div(page, MACRONIX_30LFXG18AC_OTP_PAGE_SIZE);
398 bytes_handled = 0;
399
400 while (bytes_handled < len &&
401 page < MACRONIX_30LFXG18AC_OTP_PAGES) {
402 size_t bytes_to_handle;
403
404 bytes_to_handle = min_t(size_t, len - bytes_handled,
405 MACRONIX_30LFXG18AC_OTP_PAGE_SIZE -
406 offs_in_page);
407
408 if (write) {
409 memcpy(dma_buf, &buf[bytes_handled], bytes_to_handle);
410 ret = nand_prog_page_op(nand, page, offs_in_page,
411 dma_buf, bytes_to_handle);
412 } else {
413 ret = nand_read_page_op(nand, page, offs_in_page,
414 dma_buf, bytes_to_handle);
415 if (!ret)
416 memcpy(&buf[bytes_handled], dma_buf,
417 bytes_to_handle);
418 }
419 if (ret)
420 goto out_otp;
421
422 bytes_handled += bytes_to_handle;
423 offs_in_page = 0;
424 page++;
425 }
426
427 *retlen = bytes_handled;
428
429 out_otp:
430 if (ret)
431 dev_err(&mtd->dev, "failed to perform OTP IO: %i\n", ret);
432
433 ret = macronix_30lfxg18ac_otp_disable(nand);
434 WARN(ret, "failed to leave OTP mode after %s\n",
435 write ? "write" : "read");
436 nand_deselect_target(nand);
> 437 kfree(dma_buf);
438
439 return ret;
440 }
441
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v1] mtd: rawnand: macronix: OTP access for MX30LFxG18AC
@ 2023-04-26 9:21 ` kernel test robot
0 siblings, 0 replies; 25+ messages in thread
From: kernel test robot @ 2023-04-26 9:21 UTC (permalink / raw)
To: Arseniy Krasnov, Miquel Raynal, Richard Weinberger,
Vignesh Raghavendra, Sumit Semwal, Christian König
Cc: oe-kbuild-all, oxffffaa, kernel, linux-mtd, linux-kernel,
linux-media, dri-devel, linaro-mm-sig
Hi Arseniy,
kernel test robot noticed the following build errors:
[auto build test ERROR on mtd/nand/next]
[also build test ERROR on linus/master v6.3 next-20230425]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Arseniy-Krasnov/mtd-rawnand-macronix-OTP-access-for-MX30LFxG18AC/20230426-153143
base: https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next
patch link: https://lore.kernel.org/r/20230426072455.3887717-1-AVKrasnov%40sberdevices.ru
patch subject: [PATCH v1] mtd: rawnand: macronix: OTP access for MX30LFxG18AC
config: m68k-allyesconfig (https://download.01.org/0day-ci/archive/20230426/202304261704.eyrD5KVk-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/3529f3465e99379489b59c035a8a0506c3756ef4
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Arseniy-Krasnov/mtd-rawnand-macronix-OTP-access-for-MX30LFxG18AC/20230426-153143
git checkout 3529f3465e99379489b59c035a8a0506c3756ef4
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=m68k olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=m68k SHELL=/bin/bash drivers/mtd/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202304261704.eyrD5KVk-lkp@intel.com/
All error/warnings (new ones prefixed by >>):
drivers/mtd/nand/raw/nand_macronix.c: In function '__macronix_30lfxg18ac_rw_otp':
>> drivers/mtd/nand/raw/nand_macronix.c:384:19: error: implicit declaration of function 'kmalloc'; did you mean 'mm_alloc'? [-Werror=implicit-function-declaration]
384 | dma_buf = kmalloc(MACRONIX_30LFXG18AC_OTP_PAGE_SIZE, GFP_KERNEL);
| ^~~~~~~
| mm_alloc
>> drivers/mtd/nand/raw/nand_macronix.c:384:17: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
384 | dma_buf = kmalloc(MACRONIX_30LFXG18AC_OTP_PAGE_SIZE, GFP_KERNEL);
| ^
>> drivers/mtd/nand/raw/nand_macronix.c:437:9: error: implicit declaration of function 'kfree'; did you mean 'kvfree'? [-Werror=implicit-function-declaration]
437 | kfree(dma_buf);
| ^~~~~
| kvfree
cc1: some warnings being treated as errors
vim +384 drivers/mtd/nand/raw/nand_macronix.c
366
367 static int __macronix_30lfxg18ac_rw_otp(struct mtd_info *mtd,
368 loff_t offs_in_flash,
369 size_t len, size_t *retlen,
370 u_char *buf, bool write)
371 {
372 struct nand_chip *nand;
373 size_t bytes_handled;
374 unsigned long page;
375 off_t offs_in_page;
376 void *dma_buf;
377 int ret;
378
379 /* 'nand_prog/read_page_op()' may use 'buf' as DMA buffer,
380 * so allocate properly aligned memory for it. This is
381 * needed because cross page accesses may lead to unaligned
382 * buffer address for DMA.
383 */
> 384 dma_buf = kmalloc(MACRONIX_30LFXG18AC_OTP_PAGE_SIZE, GFP_KERNEL);
385 if (!dma_buf)
386 return -ENOMEM;
387
388 nand = mtd_to_nand(mtd);
389 nand_select_target(nand, 0);
390
391 ret = macronix_30lfxg18ac_otp_enable(nand);
392 if (ret)
393 goto out_otp;
394
395 page = offs_in_flash;
396 /* 'page' will be result of division. */
397 offs_in_page = do_div(page, MACRONIX_30LFXG18AC_OTP_PAGE_SIZE);
398 bytes_handled = 0;
399
400 while (bytes_handled < len &&
401 page < MACRONIX_30LFXG18AC_OTP_PAGES) {
402 size_t bytes_to_handle;
403
404 bytes_to_handle = min_t(size_t, len - bytes_handled,
405 MACRONIX_30LFXG18AC_OTP_PAGE_SIZE -
406 offs_in_page);
407
408 if (write) {
409 memcpy(dma_buf, &buf[bytes_handled], bytes_to_handle);
410 ret = nand_prog_page_op(nand, page, offs_in_page,
411 dma_buf, bytes_to_handle);
412 } else {
413 ret = nand_read_page_op(nand, page, offs_in_page,
414 dma_buf, bytes_to_handle);
415 if (!ret)
416 memcpy(&buf[bytes_handled], dma_buf,
417 bytes_to_handle);
418 }
419 if (ret)
420 goto out_otp;
421
422 bytes_handled += bytes_to_handle;
423 offs_in_page = 0;
424 page++;
425 }
426
427 *retlen = bytes_handled;
428
429 out_otp:
430 if (ret)
431 dev_err(&mtd->dev, "failed to perform OTP IO: %i\n", ret);
432
433 ret = macronix_30lfxg18ac_otp_disable(nand);
434 WARN(ret, "failed to leave OTP mode after %s\n",
435 write ? "write" : "read");
436 nand_deselect_target(nand);
> 437 kfree(dma_buf);
438
439 return ret;
440 }
441
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v1] mtd: rawnand: macronix: OTP access for MX30LFxG18AC
@ 2023-04-26 9:21 ` kernel test robot
0 siblings, 0 replies; 25+ messages in thread
From: kernel test robot @ 2023-04-26 9:21 UTC (permalink / raw)
To: Arseniy Krasnov, Miquel Raynal, Richard Weinberger,
Vignesh Raghavendra, Sumit Semwal, Christian König
Cc: linux-kernel, dri-devel, linaro-mm-sig, linux-mtd, oxffffaa,
oe-kbuild-all, kernel, linux-media
Hi Arseniy,
kernel test robot noticed the following build errors:
[auto build test ERROR on mtd/nand/next]
[also build test ERROR on linus/master v6.3 next-20230425]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Arseniy-Krasnov/mtd-rawnand-macronix-OTP-access-for-MX30LFxG18AC/20230426-153143
base: https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next
patch link: https://lore.kernel.org/r/20230426072455.3887717-1-AVKrasnov%40sberdevices.ru
patch subject: [PATCH v1] mtd: rawnand: macronix: OTP access for MX30LFxG18AC
config: m68k-allyesconfig (https://download.01.org/0day-ci/archive/20230426/202304261704.eyrD5KVk-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/3529f3465e99379489b59c035a8a0506c3756ef4
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Arseniy-Krasnov/mtd-rawnand-macronix-OTP-access-for-MX30LFxG18AC/20230426-153143
git checkout 3529f3465e99379489b59c035a8a0506c3756ef4
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=m68k olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=m68k SHELL=/bin/bash drivers/mtd/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202304261704.eyrD5KVk-lkp@intel.com/
All error/warnings (new ones prefixed by >>):
drivers/mtd/nand/raw/nand_macronix.c: In function '__macronix_30lfxg18ac_rw_otp':
>> drivers/mtd/nand/raw/nand_macronix.c:384:19: error: implicit declaration of function 'kmalloc'; did you mean 'mm_alloc'? [-Werror=implicit-function-declaration]
384 | dma_buf = kmalloc(MACRONIX_30LFXG18AC_OTP_PAGE_SIZE, GFP_KERNEL);
| ^~~~~~~
| mm_alloc
>> drivers/mtd/nand/raw/nand_macronix.c:384:17: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
384 | dma_buf = kmalloc(MACRONIX_30LFXG18AC_OTP_PAGE_SIZE, GFP_KERNEL);
| ^
>> drivers/mtd/nand/raw/nand_macronix.c:437:9: error: implicit declaration of function 'kfree'; did you mean 'kvfree'? [-Werror=implicit-function-declaration]
437 | kfree(dma_buf);
| ^~~~~
| kvfree
cc1: some warnings being treated as errors
vim +384 drivers/mtd/nand/raw/nand_macronix.c
366
367 static int __macronix_30lfxg18ac_rw_otp(struct mtd_info *mtd,
368 loff_t offs_in_flash,
369 size_t len, size_t *retlen,
370 u_char *buf, bool write)
371 {
372 struct nand_chip *nand;
373 size_t bytes_handled;
374 unsigned long page;
375 off_t offs_in_page;
376 void *dma_buf;
377 int ret;
378
379 /* 'nand_prog/read_page_op()' may use 'buf' as DMA buffer,
380 * so allocate properly aligned memory for it. This is
381 * needed because cross page accesses may lead to unaligned
382 * buffer address for DMA.
383 */
> 384 dma_buf = kmalloc(MACRONIX_30LFXG18AC_OTP_PAGE_SIZE, GFP_KERNEL);
385 if (!dma_buf)
386 return -ENOMEM;
387
388 nand = mtd_to_nand(mtd);
389 nand_select_target(nand, 0);
390
391 ret = macronix_30lfxg18ac_otp_enable(nand);
392 if (ret)
393 goto out_otp;
394
395 page = offs_in_flash;
396 /* 'page' will be result of division. */
397 offs_in_page = do_div(page, MACRONIX_30LFXG18AC_OTP_PAGE_SIZE);
398 bytes_handled = 0;
399
400 while (bytes_handled < len &&
401 page < MACRONIX_30LFXG18AC_OTP_PAGES) {
402 size_t bytes_to_handle;
403
404 bytes_to_handle = min_t(size_t, len - bytes_handled,
405 MACRONIX_30LFXG18AC_OTP_PAGE_SIZE -
406 offs_in_page);
407
408 if (write) {
409 memcpy(dma_buf, &buf[bytes_handled], bytes_to_handle);
410 ret = nand_prog_page_op(nand, page, offs_in_page,
411 dma_buf, bytes_to_handle);
412 } else {
413 ret = nand_read_page_op(nand, page, offs_in_page,
414 dma_buf, bytes_to_handle);
415 if (!ret)
416 memcpy(&buf[bytes_handled], dma_buf,
417 bytes_to_handle);
418 }
419 if (ret)
420 goto out_otp;
421
422 bytes_handled += bytes_to_handle;
423 offs_in_page = 0;
424 page++;
425 }
426
427 *retlen = bytes_handled;
428
429 out_otp:
430 if (ret)
431 dev_err(&mtd->dev, "failed to perform OTP IO: %i\n", ret);
432
433 ret = macronix_30lfxg18ac_otp_disable(nand);
434 WARN(ret, "failed to leave OTP mode after %s\n",
435 write ? "write" : "read");
436 nand_deselect_target(nand);
> 437 kfree(dma_buf);
438
439 return ret;
440 }
441
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v1] mtd: rawnand: macronix: OTP access for MX30LFxG18AC
2023-04-26 7:24 ` Arseniy Krasnov
(?)
@ 2023-04-26 13:06 ` kernel test robot
-1 siblings, 0 replies; 25+ messages in thread
From: kernel test robot @ 2023-04-26 13:06 UTC (permalink / raw)
To: Arseniy Krasnov, Miquel Raynal, Richard Weinberger,
Vignesh Raghavendra, Sumit Semwal, Christian König
Cc: llvm, oe-kbuild-all, oxffffaa, kernel, linux-mtd, linux-kernel,
linux-media, dri-devel, linaro-mm-sig
Hi Arseniy,
kernel test robot noticed the following build errors:
[auto build test ERROR on mtd/nand/next]
[also build test ERROR on linus/master v6.3 next-20230425]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Arseniy-Krasnov/mtd-rawnand-macronix-OTP-access-for-MX30LFxG18AC/20230426-153143
base: https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next
patch link: https://lore.kernel.org/r/20230426072455.3887717-1-AVKrasnov%40sberdevices.ru
patch subject: [PATCH v1] mtd: rawnand: macronix: OTP access for MX30LFxG18AC
config: i386-randconfig-a001-20230424 (https://download.01.org/0day-ci/archive/20230426/202304262003.Lzpyh2BA-lkp@intel.com/config)
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/3529f3465e99379489b59c035a8a0506c3756ef4
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Arseniy-Krasnov/mtd-rawnand-macronix-OTP-access-for-MX30LFxG18AC/20230426-153143
git checkout 3529f3465e99379489b59c035a8a0506c3756ef4
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/mtd/nand/raw/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202304262003.Lzpyh2BA-lkp@intel.com/
All error/warnings (new ones prefixed by >>):
>> drivers/mtd/nand/raw/nand_macronix.c:384:12: error: implicit declaration of function 'kmalloc' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
dma_buf = kmalloc(MACRONIX_30LFXG18AC_OTP_PAGE_SIZE, GFP_KERNEL);
^
drivers/mtd/nand/raw/nand_macronix.c:384:12: note: did you mean 'mm_alloc'?
include/linux/sched/mm.h:16:26: note: 'mm_alloc' declared here
extern struct mm_struct *mm_alloc(void);
^
>> drivers/mtd/nand/raw/nand_macronix.c:384:10: warning: incompatible integer to pointer conversion assigning to 'void *' from 'int' [-Wint-conversion]
dma_buf = kmalloc(MACRONIX_30LFXG18AC_OTP_PAGE_SIZE, GFP_KERNEL);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/mtd/nand/raw/nand_macronix.c:437:2: error: implicit declaration of function 'kfree' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
kfree(dma_buf);
^
1 warning and 2 errors generated.
vim +/kmalloc +384 drivers/mtd/nand/raw/nand_macronix.c
366
367 static int __macronix_30lfxg18ac_rw_otp(struct mtd_info *mtd,
368 loff_t offs_in_flash,
369 size_t len, size_t *retlen,
370 u_char *buf, bool write)
371 {
372 struct nand_chip *nand;
373 size_t bytes_handled;
374 unsigned long page;
375 off_t offs_in_page;
376 void *dma_buf;
377 int ret;
378
379 /* 'nand_prog/read_page_op()' may use 'buf' as DMA buffer,
380 * so allocate properly aligned memory for it. This is
381 * needed because cross page accesses may lead to unaligned
382 * buffer address for DMA.
383 */
> 384 dma_buf = kmalloc(MACRONIX_30LFXG18AC_OTP_PAGE_SIZE, GFP_KERNEL);
385 if (!dma_buf)
386 return -ENOMEM;
387
388 nand = mtd_to_nand(mtd);
389 nand_select_target(nand, 0);
390
391 ret = macronix_30lfxg18ac_otp_enable(nand);
392 if (ret)
393 goto out_otp;
394
395 page = offs_in_flash;
396 /* 'page' will be result of division. */
397 offs_in_page = do_div(page, MACRONIX_30LFXG18AC_OTP_PAGE_SIZE);
398 bytes_handled = 0;
399
400 while (bytes_handled < len &&
401 page < MACRONIX_30LFXG18AC_OTP_PAGES) {
402 size_t bytes_to_handle;
403
404 bytes_to_handle = min_t(size_t, len - bytes_handled,
405 MACRONIX_30LFXG18AC_OTP_PAGE_SIZE -
406 offs_in_page);
407
408 if (write) {
409 memcpy(dma_buf, &buf[bytes_handled], bytes_to_handle);
410 ret = nand_prog_page_op(nand, page, offs_in_page,
411 dma_buf, bytes_to_handle);
412 } else {
413 ret = nand_read_page_op(nand, page, offs_in_page,
414 dma_buf, bytes_to_handle);
415 if (!ret)
416 memcpy(&buf[bytes_handled], dma_buf,
417 bytes_to_handle);
418 }
419 if (ret)
420 goto out_otp;
421
422 bytes_handled += bytes_to_handle;
423 offs_in_page = 0;
424 page++;
425 }
426
427 *retlen = bytes_handled;
428
429 out_otp:
430 if (ret)
431 dev_err(&mtd->dev, "failed to perform OTP IO: %i\n", ret);
432
433 ret = macronix_30lfxg18ac_otp_disable(nand);
434 WARN(ret, "failed to leave OTP mode after %s\n",
435 write ? "write" : "read");
436 nand_deselect_target(nand);
> 437 kfree(dma_buf);
438
439 return ret;
440 }
441
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v1] mtd: rawnand: macronix: OTP access for MX30LFxG18AC
@ 2023-04-26 13:06 ` kernel test robot
0 siblings, 0 replies; 25+ messages in thread
From: kernel test robot @ 2023-04-26 13:06 UTC (permalink / raw)
To: Arseniy Krasnov, Miquel Raynal, Richard Weinberger,
Vignesh Raghavendra, Sumit Semwal, Christian König
Cc: llvm, oe-kbuild-all, oxffffaa, kernel, linux-mtd, linux-kernel,
linux-media, dri-devel, linaro-mm-sig
Hi Arseniy,
kernel test robot noticed the following build errors:
[auto build test ERROR on mtd/nand/next]
[also build test ERROR on linus/master v6.3 next-20230425]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Arseniy-Krasnov/mtd-rawnand-macronix-OTP-access-for-MX30LFxG18AC/20230426-153143
base: https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next
patch link: https://lore.kernel.org/r/20230426072455.3887717-1-AVKrasnov%40sberdevices.ru
patch subject: [PATCH v1] mtd: rawnand: macronix: OTP access for MX30LFxG18AC
config: i386-randconfig-a001-20230424 (https://download.01.org/0day-ci/archive/20230426/202304262003.Lzpyh2BA-lkp@intel.com/config)
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/3529f3465e99379489b59c035a8a0506c3756ef4
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Arseniy-Krasnov/mtd-rawnand-macronix-OTP-access-for-MX30LFxG18AC/20230426-153143
git checkout 3529f3465e99379489b59c035a8a0506c3756ef4
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/mtd/nand/raw/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202304262003.Lzpyh2BA-lkp@intel.com/
All error/warnings (new ones prefixed by >>):
>> drivers/mtd/nand/raw/nand_macronix.c:384:12: error: implicit declaration of function 'kmalloc' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
dma_buf = kmalloc(MACRONIX_30LFXG18AC_OTP_PAGE_SIZE, GFP_KERNEL);
^
drivers/mtd/nand/raw/nand_macronix.c:384:12: note: did you mean 'mm_alloc'?
include/linux/sched/mm.h:16:26: note: 'mm_alloc' declared here
extern struct mm_struct *mm_alloc(void);
^
>> drivers/mtd/nand/raw/nand_macronix.c:384:10: warning: incompatible integer to pointer conversion assigning to 'void *' from 'int' [-Wint-conversion]
dma_buf = kmalloc(MACRONIX_30LFXG18AC_OTP_PAGE_SIZE, GFP_KERNEL);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/mtd/nand/raw/nand_macronix.c:437:2: error: implicit declaration of function 'kfree' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
kfree(dma_buf);
^
1 warning and 2 errors generated.
vim +/kmalloc +384 drivers/mtd/nand/raw/nand_macronix.c
366
367 static int __macronix_30lfxg18ac_rw_otp(struct mtd_info *mtd,
368 loff_t offs_in_flash,
369 size_t len, size_t *retlen,
370 u_char *buf, bool write)
371 {
372 struct nand_chip *nand;
373 size_t bytes_handled;
374 unsigned long page;
375 off_t offs_in_page;
376 void *dma_buf;
377 int ret;
378
379 /* 'nand_prog/read_page_op()' may use 'buf' as DMA buffer,
380 * so allocate properly aligned memory for it. This is
381 * needed because cross page accesses may lead to unaligned
382 * buffer address for DMA.
383 */
> 384 dma_buf = kmalloc(MACRONIX_30LFXG18AC_OTP_PAGE_SIZE, GFP_KERNEL);
385 if (!dma_buf)
386 return -ENOMEM;
387
388 nand = mtd_to_nand(mtd);
389 nand_select_target(nand, 0);
390
391 ret = macronix_30lfxg18ac_otp_enable(nand);
392 if (ret)
393 goto out_otp;
394
395 page = offs_in_flash;
396 /* 'page' will be result of division. */
397 offs_in_page = do_div(page, MACRONIX_30LFXG18AC_OTP_PAGE_SIZE);
398 bytes_handled = 0;
399
400 while (bytes_handled < len &&
401 page < MACRONIX_30LFXG18AC_OTP_PAGES) {
402 size_t bytes_to_handle;
403
404 bytes_to_handle = min_t(size_t, len - bytes_handled,
405 MACRONIX_30LFXG18AC_OTP_PAGE_SIZE -
406 offs_in_page);
407
408 if (write) {
409 memcpy(dma_buf, &buf[bytes_handled], bytes_to_handle);
410 ret = nand_prog_page_op(nand, page, offs_in_page,
411 dma_buf, bytes_to_handle);
412 } else {
413 ret = nand_read_page_op(nand, page, offs_in_page,
414 dma_buf, bytes_to_handle);
415 if (!ret)
416 memcpy(&buf[bytes_handled], dma_buf,
417 bytes_to_handle);
418 }
419 if (ret)
420 goto out_otp;
421
422 bytes_handled += bytes_to_handle;
423 offs_in_page = 0;
424 page++;
425 }
426
427 *retlen = bytes_handled;
428
429 out_otp:
430 if (ret)
431 dev_err(&mtd->dev, "failed to perform OTP IO: %i\n", ret);
432
433 ret = macronix_30lfxg18ac_otp_disable(nand);
434 WARN(ret, "failed to leave OTP mode after %s\n",
435 write ? "write" : "read");
436 nand_deselect_target(nand);
> 437 kfree(dma_buf);
438
439 return ret;
440 }
441
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v1] mtd: rawnand: macronix: OTP access for MX30LFxG18AC
@ 2023-04-26 13:06 ` kernel test robot
0 siblings, 0 replies; 25+ messages in thread
From: kernel test robot @ 2023-04-26 13:06 UTC (permalink / raw)
To: Arseniy Krasnov, Miquel Raynal, Richard Weinberger,
Vignesh Raghavendra, Sumit Semwal, Christian König
Cc: llvm, linux-kernel, dri-devel, linaro-mm-sig, linux-mtd, oxffffaa,
oe-kbuild-all, kernel, linux-media
Hi Arseniy,
kernel test robot noticed the following build errors:
[auto build test ERROR on mtd/nand/next]
[also build test ERROR on linus/master v6.3 next-20230425]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Arseniy-Krasnov/mtd-rawnand-macronix-OTP-access-for-MX30LFxG18AC/20230426-153143
base: https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next
patch link: https://lore.kernel.org/r/20230426072455.3887717-1-AVKrasnov%40sberdevices.ru
patch subject: [PATCH v1] mtd: rawnand: macronix: OTP access for MX30LFxG18AC
config: i386-randconfig-a001-20230424 (https://download.01.org/0day-ci/archive/20230426/202304262003.Lzpyh2BA-lkp@intel.com/config)
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/3529f3465e99379489b59c035a8a0506c3756ef4
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Arseniy-Krasnov/mtd-rawnand-macronix-OTP-access-for-MX30LFxG18AC/20230426-153143
git checkout 3529f3465e99379489b59c035a8a0506c3756ef4
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/mtd/nand/raw/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202304262003.Lzpyh2BA-lkp@intel.com/
All error/warnings (new ones prefixed by >>):
>> drivers/mtd/nand/raw/nand_macronix.c:384:12: error: implicit declaration of function 'kmalloc' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
dma_buf = kmalloc(MACRONIX_30LFXG18AC_OTP_PAGE_SIZE, GFP_KERNEL);
^
drivers/mtd/nand/raw/nand_macronix.c:384:12: note: did you mean 'mm_alloc'?
include/linux/sched/mm.h:16:26: note: 'mm_alloc' declared here
extern struct mm_struct *mm_alloc(void);
^
>> drivers/mtd/nand/raw/nand_macronix.c:384:10: warning: incompatible integer to pointer conversion assigning to 'void *' from 'int' [-Wint-conversion]
dma_buf = kmalloc(MACRONIX_30LFXG18AC_OTP_PAGE_SIZE, GFP_KERNEL);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/mtd/nand/raw/nand_macronix.c:437:2: error: implicit declaration of function 'kfree' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
kfree(dma_buf);
^
1 warning and 2 errors generated.
vim +/kmalloc +384 drivers/mtd/nand/raw/nand_macronix.c
366
367 static int __macronix_30lfxg18ac_rw_otp(struct mtd_info *mtd,
368 loff_t offs_in_flash,
369 size_t len, size_t *retlen,
370 u_char *buf, bool write)
371 {
372 struct nand_chip *nand;
373 size_t bytes_handled;
374 unsigned long page;
375 off_t offs_in_page;
376 void *dma_buf;
377 int ret;
378
379 /* 'nand_prog/read_page_op()' may use 'buf' as DMA buffer,
380 * so allocate properly aligned memory for it. This is
381 * needed because cross page accesses may lead to unaligned
382 * buffer address for DMA.
383 */
> 384 dma_buf = kmalloc(MACRONIX_30LFXG18AC_OTP_PAGE_SIZE, GFP_KERNEL);
385 if (!dma_buf)
386 return -ENOMEM;
387
388 nand = mtd_to_nand(mtd);
389 nand_select_target(nand, 0);
390
391 ret = macronix_30lfxg18ac_otp_enable(nand);
392 if (ret)
393 goto out_otp;
394
395 page = offs_in_flash;
396 /* 'page' will be result of division. */
397 offs_in_page = do_div(page, MACRONIX_30LFXG18AC_OTP_PAGE_SIZE);
398 bytes_handled = 0;
399
400 while (bytes_handled < len &&
401 page < MACRONIX_30LFXG18AC_OTP_PAGES) {
402 size_t bytes_to_handle;
403
404 bytes_to_handle = min_t(size_t, len - bytes_handled,
405 MACRONIX_30LFXG18AC_OTP_PAGE_SIZE -
406 offs_in_page);
407
408 if (write) {
409 memcpy(dma_buf, &buf[bytes_handled], bytes_to_handle);
410 ret = nand_prog_page_op(nand, page, offs_in_page,
411 dma_buf, bytes_to_handle);
412 } else {
413 ret = nand_read_page_op(nand, page, offs_in_page,
414 dma_buf, bytes_to_handle);
415 if (!ret)
416 memcpy(&buf[bytes_handled], dma_buf,
417 bytes_to_handle);
418 }
419 if (ret)
420 goto out_otp;
421
422 bytes_handled += bytes_to_handle;
423 offs_in_page = 0;
424 page++;
425 }
426
427 *retlen = bytes_handled;
428
429 out_otp:
430 if (ret)
431 dev_err(&mtd->dev, "failed to perform OTP IO: %i\n", ret);
432
433 ret = macronix_30lfxg18ac_otp_disable(nand);
434 WARN(ret, "failed to leave OTP mode after %s\n",
435 write ? "write" : "read");
436 nand_deselect_target(nand);
> 437 kfree(dma_buf);
438
439 return ret;
440 }
441
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v1] mtd: rawnand: macronix: OTP access for MX30LFxG18AC
2023-04-26 7:24 ` Arseniy Krasnov
(?)
@ 2023-04-26 13:37 ` kernel test robot
-1 siblings, 0 replies; 25+ messages in thread
From: kernel test robot @ 2023-04-26 13:37 UTC (permalink / raw)
To: Arseniy Krasnov, Miquel Raynal, Richard Weinberger,
Vignesh Raghavendra, Sumit Semwal, Christian König
Cc: llvm, oe-kbuild-all, oxffffaa, kernel, linux-mtd, linux-kernel,
linux-media, dri-devel, linaro-mm-sig
Hi Arseniy,
kernel test robot noticed the following build errors:
[auto build test ERROR on mtd/nand/next]
[also build test ERROR on linus/master v6.3 next-20230425]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Arseniy-Krasnov/mtd-rawnand-macronix-OTP-access-for-MX30LFxG18AC/20230426-153143
base: https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next
patch link: https://lore.kernel.org/r/20230426072455.3887717-1-AVKrasnov%40sberdevices.ru
patch subject: [PATCH v1] mtd: rawnand: macronix: OTP access for MX30LFxG18AC
config: hexagon-randconfig-r041-20230425 (https://download.01.org/0day-ci/archive/20230426/202304262101.pP2ae1ol-lkp@intel.com/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project 437b7602e4a998220871de78afcb020b9c14a661)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/3529f3465e99379489b59c035a8a0506c3756ef4
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Arseniy-Krasnov/mtd-rawnand-macronix-OTP-access-for-MX30LFxG18AC/20230426-153143
git checkout 3529f3465e99379489b59c035a8a0506c3756ef4
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/mtd/nand/raw/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202304262101.pP2ae1ol-lkp@intel.com/
All error/warnings (new ones prefixed by >>):
>> drivers/mtd/nand/raw/nand_macronix.c:384:12: error: call to undeclared function 'kmalloc'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
dma_buf = kmalloc(MACRONIX_30LFXG18AC_OTP_PAGE_SIZE, GFP_KERNEL);
^
drivers/mtd/nand/raw/nand_macronix.c:384:12: note: did you mean 'mm_alloc'?
include/linux/sched/mm.h:16:26: note: 'mm_alloc' declared here
extern struct mm_struct *mm_alloc(void);
^
>> drivers/mtd/nand/raw/nand_macronix.c:384:10: error: incompatible integer to pointer conversion assigning to 'void *' from 'int' [-Wint-conversion]
dma_buf = kmalloc(MACRONIX_30LFXG18AC_OTP_PAGE_SIZE, GFP_KERNEL);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/mtd/nand/raw/nand_macronix.c:397:17: warning: comparison of distinct pointer types ('typeof ((page)) *' (aka 'unsigned long *') and 'uint64_t *' (aka 'unsigned long long *')) [-Wcompare-distinct-pointer-types]
offs_in_page = do_div(page, MACRONIX_30LFXG18AC_OTP_PAGE_SIZE);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/div64.h:222:28: note: expanded from macro 'do_div'
(void)(((typeof((n)) *)0) == ((uint64_t *)0)); \
~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~
>> drivers/mtd/nand/raw/nand_macronix.c:397:17: error: incompatible pointer types passing 'unsigned long *' to parameter of type 'uint64_t *' (aka 'unsigned long long *') [-Werror,-Wincompatible-pointer-types]
offs_in_page = do_div(page, MACRONIX_30LFXG18AC_OTP_PAGE_SIZE);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/div64.h:238:22: note: expanded from macro 'do_div'
__rem = __div64_32(&(n), __base); \
^~~~
include/asm-generic/div64.h:213:38: note: passing argument to parameter 'dividend' here
extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor);
^
>> drivers/mtd/nand/raw/nand_macronix.c:437:2: error: call to undeclared function 'kfree'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
kfree(dma_buf);
^
drivers/mtd/nand/raw/nand_macronix.c:437:2: note: did you mean 'kvfree'?
include/linux/rcutiny.h:99:13: note: 'kvfree' declared here
extern void kvfree(const void *addr);
^
>> drivers/mtd/nand/raw/nand_macronix.c:397:17: warning: shift count >= width of type [-Wshift-count-overflow]
offs_in_page = do_div(page, MACRONIX_30LFXG18AC_OTP_PAGE_SIZE);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/div64.h:234:25: note: expanded from macro 'do_div'
} else if (likely(((n) >> 32) == 0)) { \
^ ~~
include/linux/compiler.h:77:40: note: expanded from macro 'likely'
# define likely(x) __builtin_expect(!!(x), 1)
^
2 warnings and 4 errors generated.
vim +/kmalloc +384 drivers/mtd/nand/raw/nand_macronix.c
366
367 static int __macronix_30lfxg18ac_rw_otp(struct mtd_info *mtd,
368 loff_t offs_in_flash,
369 size_t len, size_t *retlen,
370 u_char *buf, bool write)
371 {
372 struct nand_chip *nand;
373 size_t bytes_handled;
374 unsigned long page;
375 off_t offs_in_page;
376 void *dma_buf;
377 int ret;
378
379 /* 'nand_prog/read_page_op()' may use 'buf' as DMA buffer,
380 * so allocate properly aligned memory for it. This is
381 * needed because cross page accesses may lead to unaligned
382 * buffer address for DMA.
383 */
> 384 dma_buf = kmalloc(MACRONIX_30LFXG18AC_OTP_PAGE_SIZE, GFP_KERNEL);
385 if (!dma_buf)
386 return -ENOMEM;
387
388 nand = mtd_to_nand(mtd);
389 nand_select_target(nand, 0);
390
391 ret = macronix_30lfxg18ac_otp_enable(nand);
392 if (ret)
393 goto out_otp;
394
395 page = offs_in_flash;
396 /* 'page' will be result of division. */
> 397 offs_in_page = do_div(page, MACRONIX_30LFXG18AC_OTP_PAGE_SIZE);
398 bytes_handled = 0;
399
400 while (bytes_handled < len &&
401 page < MACRONIX_30LFXG18AC_OTP_PAGES) {
402 size_t bytes_to_handle;
403
404 bytes_to_handle = min_t(size_t, len - bytes_handled,
405 MACRONIX_30LFXG18AC_OTP_PAGE_SIZE -
406 offs_in_page);
407
408 if (write) {
409 memcpy(dma_buf, &buf[bytes_handled], bytes_to_handle);
410 ret = nand_prog_page_op(nand, page, offs_in_page,
411 dma_buf, bytes_to_handle);
412 } else {
413 ret = nand_read_page_op(nand, page, offs_in_page,
414 dma_buf, bytes_to_handle);
415 if (!ret)
416 memcpy(&buf[bytes_handled], dma_buf,
417 bytes_to_handle);
418 }
419 if (ret)
420 goto out_otp;
421
422 bytes_handled += bytes_to_handle;
423 offs_in_page = 0;
424 page++;
425 }
426
427 *retlen = bytes_handled;
428
429 out_otp:
430 if (ret)
431 dev_err(&mtd->dev, "failed to perform OTP IO: %i\n", ret);
432
433 ret = macronix_30lfxg18ac_otp_disable(nand);
434 WARN(ret, "failed to leave OTP mode after %s\n",
435 write ? "write" : "read");
436 nand_deselect_target(nand);
> 437 kfree(dma_buf);
438
439 return ret;
440 }
441
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v1] mtd: rawnand: macronix: OTP access for MX30LFxG18AC
@ 2023-04-26 13:37 ` kernel test robot
0 siblings, 0 replies; 25+ messages in thread
From: kernel test robot @ 2023-04-26 13:37 UTC (permalink / raw)
To: Arseniy Krasnov, Miquel Raynal, Richard Weinberger,
Vignesh Raghavendra, Sumit Semwal, Christian König
Cc: llvm, oe-kbuild-all, oxffffaa, kernel, linux-mtd, linux-kernel,
linux-media, dri-devel, linaro-mm-sig
Hi Arseniy,
kernel test robot noticed the following build errors:
[auto build test ERROR on mtd/nand/next]
[also build test ERROR on linus/master v6.3 next-20230425]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Arseniy-Krasnov/mtd-rawnand-macronix-OTP-access-for-MX30LFxG18AC/20230426-153143
base: https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next
patch link: https://lore.kernel.org/r/20230426072455.3887717-1-AVKrasnov%40sberdevices.ru
patch subject: [PATCH v1] mtd: rawnand: macronix: OTP access for MX30LFxG18AC
config: hexagon-randconfig-r041-20230425 (https://download.01.org/0day-ci/archive/20230426/202304262101.pP2ae1ol-lkp@intel.com/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project 437b7602e4a998220871de78afcb020b9c14a661)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/3529f3465e99379489b59c035a8a0506c3756ef4
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Arseniy-Krasnov/mtd-rawnand-macronix-OTP-access-for-MX30LFxG18AC/20230426-153143
git checkout 3529f3465e99379489b59c035a8a0506c3756ef4
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/mtd/nand/raw/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202304262101.pP2ae1ol-lkp@intel.com/
All error/warnings (new ones prefixed by >>):
>> drivers/mtd/nand/raw/nand_macronix.c:384:12: error: call to undeclared function 'kmalloc'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
dma_buf = kmalloc(MACRONIX_30LFXG18AC_OTP_PAGE_SIZE, GFP_KERNEL);
^
drivers/mtd/nand/raw/nand_macronix.c:384:12: note: did you mean 'mm_alloc'?
include/linux/sched/mm.h:16:26: note: 'mm_alloc' declared here
extern struct mm_struct *mm_alloc(void);
^
>> drivers/mtd/nand/raw/nand_macronix.c:384:10: error: incompatible integer to pointer conversion assigning to 'void *' from 'int' [-Wint-conversion]
dma_buf = kmalloc(MACRONIX_30LFXG18AC_OTP_PAGE_SIZE, GFP_KERNEL);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/mtd/nand/raw/nand_macronix.c:397:17: warning: comparison of distinct pointer types ('typeof ((page)) *' (aka 'unsigned long *') and 'uint64_t *' (aka 'unsigned long long *')) [-Wcompare-distinct-pointer-types]
offs_in_page = do_div(page, MACRONIX_30LFXG18AC_OTP_PAGE_SIZE);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/div64.h:222:28: note: expanded from macro 'do_div'
(void)(((typeof((n)) *)0) == ((uint64_t *)0)); \
~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~
>> drivers/mtd/nand/raw/nand_macronix.c:397:17: error: incompatible pointer types passing 'unsigned long *' to parameter of type 'uint64_t *' (aka 'unsigned long long *') [-Werror,-Wincompatible-pointer-types]
offs_in_page = do_div(page, MACRONIX_30LFXG18AC_OTP_PAGE_SIZE);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/div64.h:238:22: note: expanded from macro 'do_div'
__rem = __div64_32(&(n), __base); \
^~~~
include/asm-generic/div64.h:213:38: note: passing argument to parameter 'dividend' here
extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor);
^
>> drivers/mtd/nand/raw/nand_macronix.c:437:2: error: call to undeclared function 'kfree'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
kfree(dma_buf);
^
drivers/mtd/nand/raw/nand_macronix.c:437:2: note: did you mean 'kvfree'?
include/linux/rcutiny.h:99:13: note: 'kvfree' declared here
extern void kvfree(const void *addr);
^
>> drivers/mtd/nand/raw/nand_macronix.c:397:17: warning: shift count >= width of type [-Wshift-count-overflow]
offs_in_page = do_div(page, MACRONIX_30LFXG18AC_OTP_PAGE_SIZE);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/div64.h:234:25: note: expanded from macro 'do_div'
} else if (likely(((n) >> 32) == 0)) { \
^ ~~
include/linux/compiler.h:77:40: note: expanded from macro 'likely'
# define likely(x) __builtin_expect(!!(x), 1)
^
2 warnings and 4 errors generated.
vim +/kmalloc +384 drivers/mtd/nand/raw/nand_macronix.c
366
367 static int __macronix_30lfxg18ac_rw_otp(struct mtd_info *mtd,
368 loff_t offs_in_flash,
369 size_t len, size_t *retlen,
370 u_char *buf, bool write)
371 {
372 struct nand_chip *nand;
373 size_t bytes_handled;
374 unsigned long page;
375 off_t offs_in_page;
376 void *dma_buf;
377 int ret;
378
379 /* 'nand_prog/read_page_op()' may use 'buf' as DMA buffer,
380 * so allocate properly aligned memory for it. This is
381 * needed because cross page accesses may lead to unaligned
382 * buffer address for DMA.
383 */
> 384 dma_buf = kmalloc(MACRONIX_30LFXG18AC_OTP_PAGE_SIZE, GFP_KERNEL);
385 if (!dma_buf)
386 return -ENOMEM;
387
388 nand = mtd_to_nand(mtd);
389 nand_select_target(nand, 0);
390
391 ret = macronix_30lfxg18ac_otp_enable(nand);
392 if (ret)
393 goto out_otp;
394
395 page = offs_in_flash;
396 /* 'page' will be result of division. */
> 397 offs_in_page = do_div(page, MACRONIX_30LFXG18AC_OTP_PAGE_SIZE);
398 bytes_handled = 0;
399
400 while (bytes_handled < len &&
401 page < MACRONIX_30LFXG18AC_OTP_PAGES) {
402 size_t bytes_to_handle;
403
404 bytes_to_handle = min_t(size_t, len - bytes_handled,
405 MACRONIX_30LFXG18AC_OTP_PAGE_SIZE -
406 offs_in_page);
407
408 if (write) {
409 memcpy(dma_buf, &buf[bytes_handled], bytes_to_handle);
410 ret = nand_prog_page_op(nand, page, offs_in_page,
411 dma_buf, bytes_to_handle);
412 } else {
413 ret = nand_read_page_op(nand, page, offs_in_page,
414 dma_buf, bytes_to_handle);
415 if (!ret)
416 memcpy(&buf[bytes_handled], dma_buf,
417 bytes_to_handle);
418 }
419 if (ret)
420 goto out_otp;
421
422 bytes_handled += bytes_to_handle;
423 offs_in_page = 0;
424 page++;
425 }
426
427 *retlen = bytes_handled;
428
429 out_otp:
430 if (ret)
431 dev_err(&mtd->dev, "failed to perform OTP IO: %i\n", ret);
432
433 ret = macronix_30lfxg18ac_otp_disable(nand);
434 WARN(ret, "failed to leave OTP mode after %s\n",
435 write ? "write" : "read");
436 nand_deselect_target(nand);
> 437 kfree(dma_buf);
438
439 return ret;
440 }
441
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v1] mtd: rawnand: macronix: OTP access for MX30LFxG18AC
@ 2023-04-26 13:37 ` kernel test robot
0 siblings, 0 replies; 25+ messages in thread
From: kernel test robot @ 2023-04-26 13:37 UTC (permalink / raw)
To: Arseniy Krasnov, Miquel Raynal, Richard Weinberger,
Vignesh Raghavendra, Sumit Semwal, Christian König
Cc: llvm, linux-kernel, dri-devel, linaro-mm-sig, linux-mtd, oxffffaa,
oe-kbuild-all, kernel, linux-media
Hi Arseniy,
kernel test robot noticed the following build errors:
[auto build test ERROR on mtd/nand/next]
[also build test ERROR on linus/master v6.3 next-20230425]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Arseniy-Krasnov/mtd-rawnand-macronix-OTP-access-for-MX30LFxG18AC/20230426-153143
base: https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next
patch link: https://lore.kernel.org/r/20230426072455.3887717-1-AVKrasnov%40sberdevices.ru
patch subject: [PATCH v1] mtd: rawnand: macronix: OTP access for MX30LFxG18AC
config: hexagon-randconfig-r041-20230425 (https://download.01.org/0day-ci/archive/20230426/202304262101.pP2ae1ol-lkp@intel.com/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project 437b7602e4a998220871de78afcb020b9c14a661)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/3529f3465e99379489b59c035a8a0506c3756ef4
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Arseniy-Krasnov/mtd-rawnand-macronix-OTP-access-for-MX30LFxG18AC/20230426-153143
git checkout 3529f3465e99379489b59c035a8a0506c3756ef4
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/mtd/nand/raw/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202304262101.pP2ae1ol-lkp@intel.com/
All error/warnings (new ones prefixed by >>):
>> drivers/mtd/nand/raw/nand_macronix.c:384:12: error: call to undeclared function 'kmalloc'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
dma_buf = kmalloc(MACRONIX_30LFXG18AC_OTP_PAGE_SIZE, GFP_KERNEL);
^
drivers/mtd/nand/raw/nand_macronix.c:384:12: note: did you mean 'mm_alloc'?
include/linux/sched/mm.h:16:26: note: 'mm_alloc' declared here
extern struct mm_struct *mm_alloc(void);
^
>> drivers/mtd/nand/raw/nand_macronix.c:384:10: error: incompatible integer to pointer conversion assigning to 'void *' from 'int' [-Wint-conversion]
dma_buf = kmalloc(MACRONIX_30LFXG18AC_OTP_PAGE_SIZE, GFP_KERNEL);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/mtd/nand/raw/nand_macronix.c:397:17: warning: comparison of distinct pointer types ('typeof ((page)) *' (aka 'unsigned long *') and 'uint64_t *' (aka 'unsigned long long *')) [-Wcompare-distinct-pointer-types]
offs_in_page = do_div(page, MACRONIX_30LFXG18AC_OTP_PAGE_SIZE);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/div64.h:222:28: note: expanded from macro 'do_div'
(void)(((typeof((n)) *)0) == ((uint64_t *)0)); \
~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~
>> drivers/mtd/nand/raw/nand_macronix.c:397:17: error: incompatible pointer types passing 'unsigned long *' to parameter of type 'uint64_t *' (aka 'unsigned long long *') [-Werror,-Wincompatible-pointer-types]
offs_in_page = do_div(page, MACRONIX_30LFXG18AC_OTP_PAGE_SIZE);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/div64.h:238:22: note: expanded from macro 'do_div'
__rem = __div64_32(&(n), __base); \
^~~~
include/asm-generic/div64.h:213:38: note: passing argument to parameter 'dividend' here
extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor);
^
>> drivers/mtd/nand/raw/nand_macronix.c:437:2: error: call to undeclared function 'kfree'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
kfree(dma_buf);
^
drivers/mtd/nand/raw/nand_macronix.c:437:2: note: did you mean 'kvfree'?
include/linux/rcutiny.h:99:13: note: 'kvfree' declared here
extern void kvfree(const void *addr);
^
>> drivers/mtd/nand/raw/nand_macronix.c:397:17: warning: shift count >= width of type [-Wshift-count-overflow]
offs_in_page = do_div(page, MACRONIX_30LFXG18AC_OTP_PAGE_SIZE);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/div64.h:234:25: note: expanded from macro 'do_div'
} else if (likely(((n) >> 32) == 0)) { \
^ ~~
include/linux/compiler.h:77:40: note: expanded from macro 'likely'
# define likely(x) __builtin_expect(!!(x), 1)
^
2 warnings and 4 errors generated.
vim +/kmalloc +384 drivers/mtd/nand/raw/nand_macronix.c
366
367 static int __macronix_30lfxg18ac_rw_otp(struct mtd_info *mtd,
368 loff_t offs_in_flash,
369 size_t len, size_t *retlen,
370 u_char *buf, bool write)
371 {
372 struct nand_chip *nand;
373 size_t bytes_handled;
374 unsigned long page;
375 off_t offs_in_page;
376 void *dma_buf;
377 int ret;
378
379 /* 'nand_prog/read_page_op()' may use 'buf' as DMA buffer,
380 * so allocate properly aligned memory for it. This is
381 * needed because cross page accesses may lead to unaligned
382 * buffer address for DMA.
383 */
> 384 dma_buf = kmalloc(MACRONIX_30LFXG18AC_OTP_PAGE_SIZE, GFP_KERNEL);
385 if (!dma_buf)
386 return -ENOMEM;
387
388 nand = mtd_to_nand(mtd);
389 nand_select_target(nand, 0);
390
391 ret = macronix_30lfxg18ac_otp_enable(nand);
392 if (ret)
393 goto out_otp;
394
395 page = offs_in_flash;
396 /* 'page' will be result of division. */
> 397 offs_in_page = do_div(page, MACRONIX_30LFXG18AC_OTP_PAGE_SIZE);
398 bytes_handled = 0;
399
400 while (bytes_handled < len &&
401 page < MACRONIX_30LFXG18AC_OTP_PAGES) {
402 size_t bytes_to_handle;
403
404 bytes_to_handle = min_t(size_t, len - bytes_handled,
405 MACRONIX_30LFXG18AC_OTP_PAGE_SIZE -
406 offs_in_page);
407
408 if (write) {
409 memcpy(dma_buf, &buf[bytes_handled], bytes_to_handle);
410 ret = nand_prog_page_op(nand, page, offs_in_page,
411 dma_buf, bytes_to_handle);
412 } else {
413 ret = nand_read_page_op(nand, page, offs_in_page,
414 dma_buf, bytes_to_handle);
415 if (!ret)
416 memcpy(&buf[bytes_handled], dma_buf,
417 bytes_to_handle);
418 }
419 if (ret)
420 goto out_otp;
421
422 bytes_handled += bytes_to_handle;
423 offs_in_page = 0;
424 page++;
425 }
426
427 *retlen = bytes_handled;
428
429 out_otp:
430 if (ret)
431 dev_err(&mtd->dev, "failed to perform OTP IO: %i\n", ret);
432
433 ret = macronix_30lfxg18ac_otp_disable(nand);
434 WARN(ret, "failed to leave OTP mode after %s\n",
435 write ? "write" : "read");
436 nand_deselect_target(nand);
> 437 kfree(dma_buf);
438
439 return ret;
440 }
441
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
^ permalink raw reply [flat|nested] 25+ messages in thread
* [PATCH v1] mtd: rawnand: macronix: OTP access for MX30LFxG18AC
@ 2023-11-30 11:24 Arseniy Krasnov
2023-12-04 19:23 ` Arseniy Krasnov
0 siblings, 1 reply; 25+ messages in thread
From: Arseniy Krasnov @ 2023-11-30 11:24 UTC (permalink / raw)
To: Dario Binacchi, Michael Trimarchi; +Cc: u-boot, kernel, oxffffaa, avkrasnov
Support for OTP area access on MX30LFxG18AC chip series.
Signed-off-by: Arseniy Krasnov <avkrasnov@salutedevices.com>
---
drivers/mtd/nand/raw/nand_macronix.c | 170 +++++++++++++++++++++++++++
1 file changed, 170 insertions(+)
diff --git a/drivers/mtd/nand/raw/nand_macronix.c b/drivers/mtd/nand/raw/nand_macronix.c
index dc972e5909..4c6ddd9233 100644
--- a/drivers/mtd/nand/raw/nand_macronix.c
+++ b/drivers/mtd/nand/raw/nand_macronix.c
@@ -16,13 +16,183 @@
* GNU General Public License for more details.
*/
+#include <dm/device_compat.h>
#include <linux/mtd/rawnand.h>
+#define ONFI_FEATURE_ADDR_30LFXG18AC_OTP 0x90
+#define MACRONIX_30LFXG18AC_OTP_START_PAGE 2
+#define MACRONIX_30LFXG18AC_OTP_PAGES 30
+#define MACRONIX_30LFXG18AC_OTP_PAGE_SIZE 2112
+#define MACRONIX_30LFXG18AC_OTP_SIZE_BYTES \
+ (MACRONIX_30LFXG18AC_OTP_PAGES * \
+ MACRONIX_30LFXG18AC_OTP_PAGE_SIZE)
+
+#define MACRONIX_30LFXG18AC_OTP_EN BIT(0)
+
+static int macronix_30lfxg18ac_get_otp_info(struct mtd_info *mtd, size_t len,
+ size_t *retlen,
+ struct otp_info *buf)
+{
+ if (len < sizeof(*buf))
+ return -EINVAL;
+
+ /* Always report that OTP is unlocked. Reason is that this
+ * type of flash chip doesn't provide way to check that OTP
+ * is locked or not: subfeature parameter is implemented as
+ * volatile register. Technically OTP region could be locked
+ * and become readonly, but as there is no way to check it,
+ * don't allow to lock it ('_lock_user_prot_reg' callback
+ * always returns -EOPNOTSUPP) and thus we report that OTP
+ * is unlocked.
+ */
+ buf->locked = 0;
+ buf->start = 0;
+ buf->length = MACRONIX_30LFXG18AC_OTP_SIZE_BYTES;
+
+ *retlen = sizeof(*buf);
+
+ return 0;
+}
+
+static int macronix_30lfxg18ac_otp_enable(struct nand_chip *nand)
+{
+ u8 feature_buf[ONFI_SUBFEATURE_PARAM_LEN] = { 0 };
+ struct mtd_info *mtd;
+
+ mtd = nand_to_mtd(nand);
+ feature_buf[0] = MACRONIX_30LFXG18AC_OTP_EN;
+
+ return nand->onfi_set_features(mtd, nand, ONFI_FEATURE_ADDR_30LFXG18AC_OTP, feature_buf);
+}
+
+static int macronix_30lfxg18ac_otp_disable(struct nand_chip *nand)
+{
+ u8 feature_buf[ONFI_SUBFEATURE_PARAM_LEN] = { 0 };
+ struct mtd_info *mtd;
+
+ mtd = nand_to_mtd(nand);
+ return nand->onfi_set_features(mtd, nand, ONFI_FEATURE_ADDR_30LFXG18AC_OTP, feature_buf);
+}
+
+static int __macronix_30lfxg18ac_rw_otp(struct mtd_info *mtd,
+ loff_t offs_in_flash,
+ size_t len, size_t *retlen,
+ u_char *buf, bool write)
+{
+ struct nand_chip *nand;
+ size_t bytes_handled;
+ off_t offs_in_page;
+ u64 page;
+ int ret;
+
+ nand = mtd_to_nand(mtd);
+ nand->select_chip(mtd, 0);
+
+ ret = macronix_30lfxg18ac_otp_enable(nand);
+ if (ret)
+ goto out_otp;
+
+ page = offs_in_flash;
+ /* 'page' will be result of division. */
+ offs_in_page = do_div(page, MACRONIX_30LFXG18AC_OTP_PAGE_SIZE);
+ bytes_handled = 0;
+
+ while (bytes_handled < len &&
+ page < MACRONIX_30LFXG18AC_OTP_PAGES) {
+ size_t bytes_to_handle;
+ u64 phys_page = page + MACRONIX_30LFXG18AC_OTP_START_PAGE;
+
+ bytes_to_handle = min_t(size_t, len - bytes_handled,
+ MACRONIX_30LFXG18AC_OTP_PAGE_SIZE -
+ offs_in_page);
+
+ if (write)
+ ret = nand_prog_page_op(nand, phys_page, offs_in_page,
+ &buf[bytes_handled], bytes_to_handle);
+ else
+ ret = nand_read_page_op(nand, phys_page, offs_in_page,
+ &buf[bytes_handled], bytes_to_handle);
+ if (ret)
+ goto out_otp;
+
+ bytes_handled += bytes_to_handle;
+ offs_in_page = 0;
+ page++;
+ }
+
+ *retlen = bytes_handled;
+
+out_otp:
+ if (ret)
+ dev_err(mtd->dev, "failed to perform OTP IO: %i\n", ret);
+
+ ret = macronix_30lfxg18ac_otp_disable(nand);
+ if (ret)
+ dev_err(mtd->dev, "failed to leave OTP mode after %s\n",
+ write ? "write" : "read");
+
+ nand->select_chip(mtd, -1);
+
+ return ret;
+}
+
+static int macronix_30lfxg18ac_write_otp(struct mtd_info *mtd, loff_t to,
+ size_t len, size_t *rlen,
+ u_char *buf)
+{
+ return __macronix_30lfxg18ac_rw_otp(mtd, to, len, rlen, (u_char *)buf,
+ true);
+}
+
+static int macronix_30lfxg18ac_read_otp(struct mtd_info *mtd, loff_t from,
+ size_t len, size_t *rlen,
+ u_char *buf)
+{
+ return __macronix_30lfxg18ac_rw_otp(mtd, from, len, rlen, buf, false);
+}
+
+static int macronix_30lfxg18ac_lock_otp(struct mtd_info *mtd, loff_t from,
+ size_t len)
+{
+ /* See comment in 'macronix_30lfxg18ac_get_otp_info()'. */
+ return -EOPNOTSUPP;
+}
+
+static void macronix_nand_setup_otp(struct nand_chip *chip)
+{
+ static const char * const supported_otp_models[] = {
+ "MX30LF1G18AC",
+ "MX30LF2G18AC",
+ "MX30LF4G18AC",
+ };
+ int i;
+
+ if (!chip->onfi_version ||
+ !(le16_to_cpu(chip->onfi_params.opt_cmd)
+ & ONFI_OPT_CMD_SET_GET_FEATURES))
+ return;
+
+ for (i = 0; i < ARRAY_SIZE(supported_otp_models); i++) {
+ if (!strcmp(chip->onfi_params.model, supported_otp_models[i])) {
+ struct mtd_info *mtd;
+
+ mtd = nand_to_mtd(chip);
+ mtd->_get_user_prot_info = macronix_30lfxg18ac_get_otp_info;
+ mtd->_read_user_prot_reg = macronix_30lfxg18ac_read_otp;
+ mtd->_write_user_prot_reg = macronix_30lfxg18ac_write_otp;
+ mtd->_lock_user_prot_reg = macronix_30lfxg18ac_lock_otp;
+ return;
+ }
+ }
+}
+
static int macronix_nand_init(struct nand_chip *chip)
{
if (nand_is_slc(chip))
chip->bbt_options |= NAND_BBT_SCAN2NDPAGE;
+ macronix_nand_setup_otp(chip);
+
return 0;
}
--
2.35.0
^ permalink raw reply related [flat|nested] 25+ messages in thread
* Re: [PATCH v1] mtd: rawnand: macronix: OTP access for MX30LFxG18AC
2023-11-30 11:24 Arseniy Krasnov
@ 2023-12-04 19:23 ` Arseniy Krasnov
2023-12-18 11:54 ` Arseniy Krasnov
0 siblings, 1 reply; 25+ messages in thread
From: Arseniy Krasnov @ 2023-12-04 19:23 UTC (permalink / raw)
To: Dario Binacchi, Michael Trimarchi; +Cc: u-boot, kernel, oxffffaa, Miquel Raynal
cc: Miquel Raynal
On 30.11.2023 14:24, Arseniy Krasnov wrote:
> Support for OTP area access on MX30LFxG18AC chip series.
>
> Signed-off-by: Arseniy Krasnov <avkrasnov@salutedevices.com>
> ---
> drivers/mtd/nand/raw/nand_macronix.c | 170 +++++++++++++++++++++++++++
> 1 file changed, 170 insertions(+)
>
> diff --git a/drivers/mtd/nand/raw/nand_macronix.c b/drivers/mtd/nand/raw/nand_macronix.c
> index dc972e5909..4c6ddd9233 100644
> --- a/drivers/mtd/nand/raw/nand_macronix.c
> +++ b/drivers/mtd/nand/raw/nand_macronix.c
> @@ -16,13 +16,183 @@
> * GNU General Public License for more details.
> */
>
> +#include <dm/device_compat.h>
> #include <linux/mtd/rawnand.h>
>
> +#define ONFI_FEATURE_ADDR_30LFXG18AC_OTP 0x90
> +#define MACRONIX_30LFXG18AC_OTP_START_PAGE 2
> +#define MACRONIX_30LFXG18AC_OTP_PAGES 30
> +#define MACRONIX_30LFXG18AC_OTP_PAGE_SIZE 2112
> +#define MACRONIX_30LFXG18AC_OTP_SIZE_BYTES \
> + (MACRONIX_30LFXG18AC_OTP_PAGES * \
> + MACRONIX_30LFXG18AC_OTP_PAGE_SIZE)
> +
> +#define MACRONIX_30LFXG18AC_OTP_EN BIT(0)
> +
> +static int macronix_30lfxg18ac_get_otp_info(struct mtd_info *mtd, size_t len,
> + size_t *retlen,
> + struct otp_info *buf)
> +{
> + if (len < sizeof(*buf))
> + return -EINVAL;
> +
> + /* Always report that OTP is unlocked. Reason is that this
> + * type of flash chip doesn't provide way to check that OTP
> + * is locked or not: subfeature parameter is implemented as
> + * volatile register. Technically OTP region could be locked
> + * and become readonly, but as there is no way to check it,
> + * don't allow to lock it ('_lock_user_prot_reg' callback
> + * always returns -EOPNOTSUPP) and thus we report that OTP
> + * is unlocked.
> + */
> + buf->locked = 0;
> + buf->start = 0;
> + buf->length = MACRONIX_30LFXG18AC_OTP_SIZE_BYTES;
> +
> + *retlen = sizeof(*buf);
> +
> + return 0;
> +}
> +
> +static int macronix_30lfxg18ac_otp_enable(struct nand_chip *nand)
> +{
> + u8 feature_buf[ONFI_SUBFEATURE_PARAM_LEN] = { 0 };
> + struct mtd_info *mtd;
> +
> + mtd = nand_to_mtd(nand);
> + feature_buf[0] = MACRONIX_30LFXG18AC_OTP_EN;
> +
> + return nand->onfi_set_features(mtd, nand, ONFI_FEATURE_ADDR_30LFXG18AC_OTP, feature_buf);
> +}
> +
> +static int macronix_30lfxg18ac_otp_disable(struct nand_chip *nand)
> +{
> + u8 feature_buf[ONFI_SUBFEATURE_PARAM_LEN] = { 0 };
> + struct mtd_info *mtd;
> +
> + mtd = nand_to_mtd(nand);
> + return nand->onfi_set_features(mtd, nand, ONFI_FEATURE_ADDR_30LFXG18AC_OTP, feature_buf);
> +}
> +
> +static int __macronix_30lfxg18ac_rw_otp(struct mtd_info *mtd,
> + loff_t offs_in_flash,
> + size_t len, size_t *retlen,
> + u_char *buf, bool write)
> +{
> + struct nand_chip *nand;
> + size_t bytes_handled;
> + off_t offs_in_page;
> + u64 page;
> + int ret;
> +
> + nand = mtd_to_nand(mtd);
> + nand->select_chip(mtd, 0);
> +
> + ret = macronix_30lfxg18ac_otp_enable(nand);
> + if (ret)
> + goto out_otp;
> +
> + page = offs_in_flash;
> + /* 'page' will be result of division. */
> + offs_in_page = do_div(page, MACRONIX_30LFXG18AC_OTP_PAGE_SIZE);
> + bytes_handled = 0;
> +
> + while (bytes_handled < len &&
> + page < MACRONIX_30LFXG18AC_OTP_PAGES) {
> + size_t bytes_to_handle;
> + u64 phys_page = page + MACRONIX_30LFXG18AC_OTP_START_PAGE;
> +
> + bytes_to_handle = min_t(size_t, len - bytes_handled,
> + MACRONIX_30LFXG18AC_OTP_PAGE_SIZE -
> + offs_in_page);
> +
> + if (write)
> + ret = nand_prog_page_op(nand, phys_page, offs_in_page,
> + &buf[bytes_handled], bytes_to_handle);
> + else
> + ret = nand_read_page_op(nand, phys_page, offs_in_page,
> + &buf[bytes_handled], bytes_to_handle);
> + if (ret)
> + goto out_otp;
> +
> + bytes_handled += bytes_to_handle;
> + offs_in_page = 0;
> + page++;
> + }
> +
> + *retlen = bytes_handled;
> +
> +out_otp:
> + if (ret)
> + dev_err(mtd->dev, "failed to perform OTP IO: %i\n", ret);
> +
> + ret = macronix_30lfxg18ac_otp_disable(nand);
> + if (ret)
> + dev_err(mtd->dev, "failed to leave OTP mode after %s\n",
> + write ? "write" : "read");
> +
> + nand->select_chip(mtd, -1);
> +
> + return ret;
> +}
> +
> +static int macronix_30lfxg18ac_write_otp(struct mtd_info *mtd, loff_t to,
> + size_t len, size_t *rlen,
> + u_char *buf)
> +{
> + return __macronix_30lfxg18ac_rw_otp(mtd, to, len, rlen, (u_char *)buf,
> + true);
> +}
> +
> +static int macronix_30lfxg18ac_read_otp(struct mtd_info *mtd, loff_t from,
> + size_t len, size_t *rlen,
> + u_char *buf)
> +{
> + return __macronix_30lfxg18ac_rw_otp(mtd, from, len, rlen, buf, false);
> +}
> +
> +static int macronix_30lfxg18ac_lock_otp(struct mtd_info *mtd, loff_t from,
> + size_t len)
> +{
> + /* See comment in 'macronix_30lfxg18ac_get_otp_info()'. */
> + return -EOPNOTSUPP;
> +}
> +
> +static void macronix_nand_setup_otp(struct nand_chip *chip)
> +{
> + static const char * const supported_otp_models[] = {
> + "MX30LF1G18AC",
> + "MX30LF2G18AC",
> + "MX30LF4G18AC",
> + };
> + int i;
> +
> + if (!chip->onfi_version ||
> + !(le16_to_cpu(chip->onfi_params.opt_cmd)
> + & ONFI_OPT_CMD_SET_GET_FEATURES))
> + return;
> +
> + for (i = 0; i < ARRAY_SIZE(supported_otp_models); i++) {
> + if (!strcmp(chip->onfi_params.model, supported_otp_models[i])) {
> + struct mtd_info *mtd;
> +
> + mtd = nand_to_mtd(chip);
> + mtd->_get_user_prot_info = macronix_30lfxg18ac_get_otp_info;
> + mtd->_read_user_prot_reg = macronix_30lfxg18ac_read_otp;
> + mtd->_write_user_prot_reg = macronix_30lfxg18ac_write_otp;
> + mtd->_lock_user_prot_reg = macronix_30lfxg18ac_lock_otp;
> + return;
> + }
> + }
> +}
> +
> static int macronix_nand_init(struct nand_chip *chip)
> {
> if (nand_is_slc(chip))
> chip->bbt_options |= NAND_BBT_SCAN2NDPAGE;
>
> + macronix_nand_setup_otp(chip);
> +
> return 0;
> }
>
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v1] mtd: rawnand: macronix: OTP access for MX30LFxG18AC
2023-12-04 19:23 ` Arseniy Krasnov
@ 2023-12-18 11:54 ` Arseniy Krasnov
2024-01-08 18:33 ` Arseniy Krasnov
0 siblings, 1 reply; 25+ messages in thread
From: Arseniy Krasnov @ 2023-12-18 11:54 UTC (permalink / raw)
To: Dario Binacchi, Michael Trimarchi
Cc: u-boot, kernel, oxffffaa, Miquel Raynal, Jaime Liao, Jaime Liao
cc: Jaime Liao
On 04.12.2023 22:23, Arseniy Krasnov wrote:
> cc: Miquel Raynal
>
> On 30.11.2023 14:24, Arseniy Krasnov wrote:
>> Support for OTP area access on MX30LFxG18AC chip series.
>>
>> Signed-off-by: Arseniy Krasnov <avkrasnov@salutedevices.com>
>> ---
>> drivers/mtd/nand/raw/nand_macronix.c | 170 +++++++++++++++++++++++++++
>> 1 file changed, 170 insertions(+)
>>
>> diff --git a/drivers/mtd/nand/raw/nand_macronix.c b/drivers/mtd/nand/raw/nand_macronix.c
>> index dc972e5909..4c6ddd9233 100644
>> --- a/drivers/mtd/nand/raw/nand_macronix.c
>> +++ b/drivers/mtd/nand/raw/nand_macronix.c
>> @@ -16,13 +16,183 @@
>> * GNU General Public License for more details.
>> */
>>
>> +#include <dm/device_compat.h>
>> #include <linux/mtd/rawnand.h>
>>
>> +#define ONFI_FEATURE_ADDR_30LFXG18AC_OTP 0x90
>> +#define MACRONIX_30LFXG18AC_OTP_START_PAGE 2
>> +#define MACRONIX_30LFXG18AC_OTP_PAGES 30
>> +#define MACRONIX_30LFXG18AC_OTP_PAGE_SIZE 2112
>> +#define MACRONIX_30LFXG18AC_OTP_SIZE_BYTES \
>> + (MACRONIX_30LFXG18AC_OTP_PAGES * \
>> + MACRONIX_30LFXG18AC_OTP_PAGE_SIZE)
>> +
>> +#define MACRONIX_30LFXG18AC_OTP_EN BIT(0)
>> +
>> +static int macronix_30lfxg18ac_get_otp_info(struct mtd_info *mtd, size_t len,
>> + size_t *retlen,
>> + struct otp_info *buf)
>> +{
>> + if (len < sizeof(*buf))
>> + return -EINVAL;
>> +
>> + /* Always report that OTP is unlocked. Reason is that this
>> + * type of flash chip doesn't provide way to check that OTP
>> + * is locked or not: subfeature parameter is implemented as
>> + * volatile register. Technically OTP region could be locked
>> + * and become readonly, but as there is no way to check it,
>> + * don't allow to lock it ('_lock_user_prot_reg' callback
>> + * always returns -EOPNOTSUPP) and thus we report that OTP
>> + * is unlocked.
>> + */
>> + buf->locked = 0;
>> + buf->start = 0;
>> + buf->length = MACRONIX_30LFXG18AC_OTP_SIZE_BYTES;
>> +
>> + *retlen = sizeof(*buf);
>> +
>> + return 0;
>> +}
>> +
>> +static int macronix_30lfxg18ac_otp_enable(struct nand_chip *nand)
>> +{
>> + u8 feature_buf[ONFI_SUBFEATURE_PARAM_LEN] = { 0 };
>> + struct mtd_info *mtd;
>> +
>> + mtd = nand_to_mtd(nand);
>> + feature_buf[0] = MACRONIX_30LFXG18AC_OTP_EN;
>> +
>> + return nand->onfi_set_features(mtd, nand, ONFI_FEATURE_ADDR_30LFXG18AC_OTP, feature_buf);
>> +}
>> +
>> +static int macronix_30lfxg18ac_otp_disable(struct nand_chip *nand)
>> +{
>> + u8 feature_buf[ONFI_SUBFEATURE_PARAM_LEN] = { 0 };
>> + struct mtd_info *mtd;
>> +
>> + mtd = nand_to_mtd(nand);
>> + return nand->onfi_set_features(mtd, nand, ONFI_FEATURE_ADDR_30LFXG18AC_OTP, feature_buf);
>> +}
>> +
>> +static int __macronix_30lfxg18ac_rw_otp(struct mtd_info *mtd,
>> + loff_t offs_in_flash,
>> + size_t len, size_t *retlen,
>> + u_char *buf, bool write)
>> +{
>> + struct nand_chip *nand;
>> + size_t bytes_handled;
>> + off_t offs_in_page;
>> + u64 page;
>> + int ret;
>> +
>> + nand = mtd_to_nand(mtd);
>> + nand->select_chip(mtd, 0);
>> +
>> + ret = macronix_30lfxg18ac_otp_enable(nand);
>> + if (ret)
>> + goto out_otp;
>> +
>> + page = offs_in_flash;
>> + /* 'page' will be result of division. */
>> + offs_in_page = do_div(page, MACRONIX_30LFXG18AC_OTP_PAGE_SIZE);
>> + bytes_handled = 0;
>> +
>> + while (bytes_handled < len &&
>> + page < MACRONIX_30LFXG18AC_OTP_PAGES) {
>> + size_t bytes_to_handle;
>> + u64 phys_page = page + MACRONIX_30LFXG18AC_OTP_START_PAGE;
>> +
>> + bytes_to_handle = min_t(size_t, len - bytes_handled,
>> + MACRONIX_30LFXG18AC_OTP_PAGE_SIZE -
>> + offs_in_page);
>> +
>> + if (write)
>> + ret = nand_prog_page_op(nand, phys_page, offs_in_page,
>> + &buf[bytes_handled], bytes_to_handle);
>> + else
>> + ret = nand_read_page_op(nand, phys_page, offs_in_page,
>> + &buf[bytes_handled], bytes_to_handle);
>> + if (ret)
>> + goto out_otp;
>> +
>> + bytes_handled += bytes_to_handle;
>> + offs_in_page = 0;
>> + page++;
>> + }
>> +
>> + *retlen = bytes_handled;
>> +
>> +out_otp:
>> + if (ret)
>> + dev_err(mtd->dev, "failed to perform OTP IO: %i\n", ret);
>> +
>> + ret = macronix_30lfxg18ac_otp_disable(nand);
>> + if (ret)
>> + dev_err(mtd->dev, "failed to leave OTP mode after %s\n",
>> + write ? "write" : "read");
>> +
>> + nand->select_chip(mtd, -1);
>> +
>> + return ret;
>> +}
>> +
>> +static int macronix_30lfxg18ac_write_otp(struct mtd_info *mtd, loff_t to,
>> + size_t len, size_t *rlen,
>> + u_char *buf)
>> +{
>> + return __macronix_30lfxg18ac_rw_otp(mtd, to, len, rlen, (u_char *)buf,
>> + true);
>> +}
>> +
>> +static int macronix_30lfxg18ac_read_otp(struct mtd_info *mtd, loff_t from,
>> + size_t len, size_t *rlen,
>> + u_char *buf)
>> +{
>> + return __macronix_30lfxg18ac_rw_otp(mtd, from, len, rlen, buf, false);
>> +}
>> +
>> +static int macronix_30lfxg18ac_lock_otp(struct mtd_info *mtd, loff_t from,
>> + size_t len)
>> +{
>> + /* See comment in 'macronix_30lfxg18ac_get_otp_info()'. */
>> + return -EOPNOTSUPP;
>> +}
>> +
>> +static void macronix_nand_setup_otp(struct nand_chip *chip)
>> +{
>> + static const char * const supported_otp_models[] = {
>> + "MX30LF1G18AC",
>> + "MX30LF2G18AC",
>> + "MX30LF4G18AC",
>> + };
>> + int i;
>> +
>> + if (!chip->onfi_version ||
>> + !(le16_to_cpu(chip->onfi_params.opt_cmd)
>> + & ONFI_OPT_CMD_SET_GET_FEATURES))
>> + return;
>> +
>> + for (i = 0; i < ARRAY_SIZE(supported_otp_models); i++) {
>> + if (!strcmp(chip->onfi_params.model, supported_otp_models[i])) {
>> + struct mtd_info *mtd;
>> +
>> + mtd = nand_to_mtd(chip);
>> + mtd->_get_user_prot_info = macronix_30lfxg18ac_get_otp_info;
>> + mtd->_read_user_prot_reg = macronix_30lfxg18ac_read_otp;
>> + mtd->_write_user_prot_reg = macronix_30lfxg18ac_write_otp;
>> + mtd->_lock_user_prot_reg = macronix_30lfxg18ac_lock_otp;
>> + return;
>> + }
>> + }
>> +}
>> +
>> static int macronix_nand_init(struct nand_chip *chip)
>> {
>> if (nand_is_slc(chip))
>> chip->bbt_options |= NAND_BBT_SCAN2NDPAGE;
>>
>> + macronix_nand_setup_otp(chip);
>> +
>> return 0;
>> }
>>
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v1] mtd: rawnand: macronix: OTP access for MX30LFxG18AC
2023-12-18 11:54 ` Arseniy Krasnov
@ 2024-01-08 18:33 ` Arseniy Krasnov
2024-02-10 23:16 ` Arseniy Krasnov
0 siblings, 1 reply; 25+ messages in thread
From: Arseniy Krasnov @ 2024-01-08 18:33 UTC (permalink / raw)
To: Dario Binacchi, Michael Trimarchi
Cc: u-boot, kernel, oxffffaa, Miquel Raynal, Jaime Liao, Jaime Liao
Sorry, pls ping
Thanks, Arseniy
On 18.12.2023 14:54, Arseniy Krasnov wrote:
> cc: Jaime Liao
>
> On 04.12.2023 22:23, Arseniy Krasnov wrote:
>> cc: Miquel Raynal
>>
>> On 30.11.2023 14:24, Arseniy Krasnov wrote:
>>> Support for OTP area access on MX30LFxG18AC chip series.
>>>
>>> Signed-off-by: Arseniy Krasnov <avkrasnov@salutedevices.com>
>>> ---
>>> drivers/mtd/nand/raw/nand_macronix.c | 170 +++++++++++++++++++++++++++
>>> 1 file changed, 170 insertions(+)
>>>
>>> diff --git a/drivers/mtd/nand/raw/nand_macronix.c b/drivers/mtd/nand/raw/nand_macronix.c
>>> index dc972e5909..4c6ddd9233 100644
>>> --- a/drivers/mtd/nand/raw/nand_macronix.c
>>> +++ b/drivers/mtd/nand/raw/nand_macronix.c
>>> @@ -16,13 +16,183 @@
>>> * GNU General Public License for more details.
>>> */
>>>
>>> +#include <dm/device_compat.h>
>>> #include <linux/mtd/rawnand.h>
>>>
>>> +#define ONFI_FEATURE_ADDR_30LFXG18AC_OTP 0x90
>>> +#define MACRONIX_30LFXG18AC_OTP_START_PAGE 2
>>> +#define MACRONIX_30LFXG18AC_OTP_PAGES 30
>>> +#define MACRONIX_30LFXG18AC_OTP_PAGE_SIZE 2112
>>> +#define MACRONIX_30LFXG18AC_OTP_SIZE_BYTES \
>>> + (MACRONIX_30LFXG18AC_OTP_PAGES * \
>>> + MACRONIX_30LFXG18AC_OTP_PAGE_SIZE)
>>> +
>>> +#define MACRONIX_30LFXG18AC_OTP_EN BIT(0)
>>> +
>>> +static int macronix_30lfxg18ac_get_otp_info(struct mtd_info *mtd, size_t len,
>>> + size_t *retlen,
>>> + struct otp_info *buf)
>>> +{
>>> + if (len < sizeof(*buf))
>>> + return -EINVAL;
>>> +
>>> + /* Always report that OTP is unlocked. Reason is that this
>>> + * type of flash chip doesn't provide way to check that OTP
>>> + * is locked or not: subfeature parameter is implemented as
>>> + * volatile register. Technically OTP region could be locked
>>> + * and become readonly, but as there is no way to check it,
>>> + * don't allow to lock it ('_lock_user_prot_reg' callback
>>> + * always returns -EOPNOTSUPP) and thus we report that OTP
>>> + * is unlocked.
>>> + */
>>> + buf->locked = 0;
>>> + buf->start = 0;
>>> + buf->length = MACRONIX_30LFXG18AC_OTP_SIZE_BYTES;
>>> +
>>> + *retlen = sizeof(*buf);
>>> +
>>> + return 0;
>>> +}
>>> +
>>> +static int macronix_30lfxg18ac_otp_enable(struct nand_chip *nand)
>>> +{
>>> + u8 feature_buf[ONFI_SUBFEATURE_PARAM_LEN] = { 0 };
>>> + struct mtd_info *mtd;
>>> +
>>> + mtd = nand_to_mtd(nand);
>>> + feature_buf[0] = MACRONIX_30LFXG18AC_OTP_EN;
>>> +
>>> + return nand->onfi_set_features(mtd, nand, ONFI_FEATURE_ADDR_30LFXG18AC_OTP, feature_buf);
>>> +}
>>> +
>>> +static int macronix_30lfxg18ac_otp_disable(struct nand_chip *nand)
>>> +{
>>> + u8 feature_buf[ONFI_SUBFEATURE_PARAM_LEN] = { 0 };
>>> + struct mtd_info *mtd;
>>> +
>>> + mtd = nand_to_mtd(nand);
>>> + return nand->onfi_set_features(mtd, nand, ONFI_FEATURE_ADDR_30LFXG18AC_OTP, feature_buf);
>>> +}
>>> +
>>> +static int __macronix_30lfxg18ac_rw_otp(struct mtd_info *mtd,
>>> + loff_t offs_in_flash,
>>> + size_t len, size_t *retlen,
>>> + u_char *buf, bool write)
>>> +{
>>> + struct nand_chip *nand;
>>> + size_t bytes_handled;
>>> + off_t offs_in_page;
>>> + u64 page;
>>> + int ret;
>>> +
>>> + nand = mtd_to_nand(mtd);
>>> + nand->select_chip(mtd, 0);
>>> +
>>> + ret = macronix_30lfxg18ac_otp_enable(nand);
>>> + if (ret)
>>> + goto out_otp;
>>> +
>>> + page = offs_in_flash;
>>> + /* 'page' will be result of division. */
>>> + offs_in_page = do_div(page, MACRONIX_30LFXG18AC_OTP_PAGE_SIZE);
>>> + bytes_handled = 0;
>>> +
>>> + while (bytes_handled < len &&
>>> + page < MACRONIX_30LFXG18AC_OTP_PAGES) {
>>> + size_t bytes_to_handle;
>>> + u64 phys_page = page + MACRONIX_30LFXG18AC_OTP_START_PAGE;
>>> +
>>> + bytes_to_handle = min_t(size_t, len - bytes_handled,
>>> + MACRONIX_30LFXG18AC_OTP_PAGE_SIZE -
>>> + offs_in_page);
>>> +
>>> + if (write)
>>> + ret = nand_prog_page_op(nand, phys_page, offs_in_page,
>>> + &buf[bytes_handled], bytes_to_handle);
>>> + else
>>> + ret = nand_read_page_op(nand, phys_page, offs_in_page,
>>> + &buf[bytes_handled], bytes_to_handle);
>>> + if (ret)
>>> + goto out_otp;
>>> +
>>> + bytes_handled += bytes_to_handle;
>>> + offs_in_page = 0;
>>> + page++;
>>> + }
>>> +
>>> + *retlen = bytes_handled;
>>> +
>>> +out_otp:
>>> + if (ret)
>>> + dev_err(mtd->dev, "failed to perform OTP IO: %i\n", ret);
>>> +
>>> + ret = macronix_30lfxg18ac_otp_disable(nand);
>>> + if (ret)
>>> + dev_err(mtd->dev, "failed to leave OTP mode after %s\n",
>>> + write ? "write" : "read");
>>> +
>>> + nand->select_chip(mtd, -1);
>>> +
>>> + return ret;
>>> +}
>>> +
>>> +static int macronix_30lfxg18ac_write_otp(struct mtd_info *mtd, loff_t to,
>>> + size_t len, size_t *rlen,
>>> + u_char *buf)
>>> +{
>>> + return __macronix_30lfxg18ac_rw_otp(mtd, to, len, rlen, (u_char *)buf,
>>> + true);
>>> +}
>>> +
>>> +static int macronix_30lfxg18ac_read_otp(struct mtd_info *mtd, loff_t from,
>>> + size_t len, size_t *rlen,
>>> + u_char *buf)
>>> +{
>>> + return __macronix_30lfxg18ac_rw_otp(mtd, from, len, rlen, buf, false);
>>> +}
>>> +
>>> +static int macronix_30lfxg18ac_lock_otp(struct mtd_info *mtd, loff_t from,
>>> + size_t len)
>>> +{
>>> + /* See comment in 'macronix_30lfxg18ac_get_otp_info()'. */
>>> + return -EOPNOTSUPP;
>>> +}
>>> +
>>> +static void macronix_nand_setup_otp(struct nand_chip *chip)
>>> +{
>>> + static const char * const supported_otp_models[] = {
>>> + "MX30LF1G18AC",
>>> + "MX30LF2G18AC",
>>> + "MX30LF4G18AC",
>>> + };
>>> + int i;
>>> +
>>> + if (!chip->onfi_version ||
>>> + !(le16_to_cpu(chip->onfi_params.opt_cmd)
>>> + & ONFI_OPT_CMD_SET_GET_FEATURES))
>>> + return;
>>> +
>>> + for (i = 0; i < ARRAY_SIZE(supported_otp_models); i++) {
>>> + if (!strcmp(chip->onfi_params.model, supported_otp_models[i])) {
>>> + struct mtd_info *mtd;
>>> +
>>> + mtd = nand_to_mtd(chip);
>>> + mtd->_get_user_prot_info = macronix_30lfxg18ac_get_otp_info;
>>> + mtd->_read_user_prot_reg = macronix_30lfxg18ac_read_otp;
>>> + mtd->_write_user_prot_reg = macronix_30lfxg18ac_write_otp;
>>> + mtd->_lock_user_prot_reg = macronix_30lfxg18ac_lock_otp;
>>> + return;
>>> + }
>>> + }
>>> +}
>>> +
>>> static int macronix_nand_init(struct nand_chip *chip)
>>> {
>>> if (nand_is_slc(chip))
>>> chip->bbt_options |= NAND_BBT_SCAN2NDPAGE;
>>>
>>> + macronix_nand_setup_otp(chip);
>>> +
>>> return 0;
>>> }
>>>
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v1] mtd: rawnand: macronix: OTP access for MX30LFxG18AC
2024-01-08 18:33 ` Arseniy Krasnov
@ 2024-02-10 23:16 ` Arseniy Krasnov
2024-03-13 6:33 ` Arseniy Krasnov
0 siblings, 1 reply; 25+ messages in thread
From: Arseniy Krasnov @ 2024-02-10 23:16 UTC (permalink / raw)
To: Dario Binacchi, Michael Trimarchi
Cc: u-boot, kernel, oxffffaa, Miquel Raynal, Jaime Liao, Jaime Liao
Sorry, pls ping
Thanks, Arseniy
On 08.01.2024 21:33, Arseniy Krasnov wrote:
> Sorry, pls ping
>
> Thanks, Arseniy
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v1] mtd: rawnand: macronix: OTP access for MX30LFxG18AC
2024-02-10 23:16 ` Arseniy Krasnov
@ 2024-03-13 6:33 ` Arseniy Krasnov
2024-03-13 6:46 ` Michael Nazzareno Trimarchi
0 siblings, 1 reply; 25+ messages in thread
From: Arseniy Krasnov @ 2024-03-13 6:33 UTC (permalink / raw)
To: Dario Binacchi, Michael Trimarchi
Cc: u-boot, kernel, oxffffaa, Miquel Raynal, Jaime Liao, Jaime Liao
Sorry, please ping
Thanks, Arseniy
On 11.02.2024 02:16, Arseniy Krasnov wrote:
> Sorry, pls ping
>
> Thanks, Arseniy
>
> On 08.01.2024 21:33, Arseniy Krasnov wrote:
>> Sorry, pls ping
>>
>> Thanks, Arseniy
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v1] mtd: rawnand: macronix: OTP access for MX30LFxG18AC
2024-03-13 6:33 ` Arseniy Krasnov
@ 2024-03-13 6:46 ` Michael Nazzareno Trimarchi
2024-04-17 18:33 ` Arseniy Krasnov
0 siblings, 1 reply; 25+ messages in thread
From: Michael Nazzareno Trimarchi @ 2024-03-13 6:46 UTC (permalink / raw)
To: Arseniy Krasnov
Cc: Dario Binacchi, u-boot, kernel, oxffffaa, Miquel Raynal,
Jaime Liao, Jaime Liao
Hi Dario
Can apply this series and put in CI?
Michael
On Wed, Mar 13, 2024 at 7:43 AM Arseniy Krasnov
<avkrasnov@salutedevices.com> wrote:
>
> Sorry, please ping
>
> Thanks, Arseniy
>
> On 11.02.2024 02:16, Arseniy Krasnov wrote:
> > Sorry, pls ping
> >
> > Thanks, Arseniy
> >
> > On 08.01.2024 21:33, Arseniy Krasnov wrote:
> >> Sorry, pls ping
> >>
> >> Thanks, Arseniy
--
Michael Nazzareno Trimarchi
Co-Founder & Chief Executive Officer
M. +39 347 913 2170
michael@amarulasolutions.com
__________________________________
Amarula Solutions BV
Joop Geesinkweg 125, 1114 AB, Amsterdam, NL
T. +31 (0)85 111 9172
info@amarulasolutions.com
www.amarulasolutions.com
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v1] mtd: rawnand: macronix: OTP access for MX30LFxG18AC
2024-03-13 6:46 ` Michael Nazzareno Trimarchi
@ 2024-04-17 18:33 ` Arseniy Krasnov
2024-04-17 18:44 ` Michael Nazzareno Trimarchi
0 siblings, 1 reply; 25+ messages in thread
From: Arseniy Krasnov @ 2024-04-17 18:33 UTC (permalink / raw)
To: Michael Nazzareno Trimarchi, Dario Binacchi
Cc: u-boot, kernel, oxffffaa, Miquel Raynal, Jaime Liao, Jaime Liao
Hello,
Sorry, pls ping
Thanks, Arseniy
On 13.03.2024 09:46, Michael Nazzareno Trimarchi wrote:
> Hi Dario
>
> Can apply this series and put in CI?
>
> Michael
>
> On Wed, Mar 13, 2024 at 7:43 AM Arseniy Krasnov
> <avkrasnov@salutedevices.com> wrote:
>>
>> Sorry, please ping
>>
>> Thanks, Arseniy
>>
>> On 11.02.2024 02:16, Arseniy Krasnov wrote:
>>> Sorry, pls ping
>>>
>>> Thanks, Arseniy
>>>
>>> On 08.01.2024 21:33, Arseniy Krasnov wrote:
>>>> Sorry, pls ping
>>>>
>>>> Thanks, Arseniy
>
>
>
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v1] mtd: rawnand: macronix: OTP access for MX30LFxG18AC
2024-04-17 18:33 ` Arseniy Krasnov
@ 2024-04-17 18:44 ` Michael Nazzareno Trimarchi
2024-04-18 6:55 ` Dario Binacchi
0 siblings, 1 reply; 25+ messages in thread
From: Michael Nazzareno Trimarchi @ 2024-04-17 18:44 UTC (permalink / raw)
To: Arseniy Krasnov
Cc: Dario Binacchi, u-boot, kernel, oxffffaa, Miquel Raynal,
Jaime Liao, Jaime Liao
Hi
Dario did you add those patches in CI and test them again?
Michael
On Wed, Apr 17, 2024 at 8:44 PM Arseniy Krasnov
<avkrasnov@salutedevices.com> wrote:
>
> Hello,
>
> Sorry, pls ping
>
> Thanks, Arseniy
>
> On 13.03.2024 09:46, Michael Nazzareno Trimarchi wrote:
> > Hi Dario
> >
> > Can apply this series and put in CI?
> >
> > Michael
> >
> > On Wed, Mar 13, 2024 at 7:43 AM Arseniy Krasnov
> > <avkrasnov@salutedevices.com> wrote:
> >>
> >> Sorry, please ping
> >>
> >> Thanks, Arseniy
> >>
> >> On 11.02.2024 02:16, Arseniy Krasnov wrote:
> >>> Sorry, pls ping
> >>>
> >>> Thanks, Arseniy
> >>>
> >>> On 08.01.2024 21:33, Arseniy Krasnov wrote:
> >>>> Sorry, pls ping
> >>>>
> >>>> Thanks, Arseniy
> >
> >
> >
--
Michael Nazzareno Trimarchi
Co-Founder & Chief Executive Officer
M. +39 347 913 2170
michael@amarulasolutions.com
__________________________________
Amarula Solutions BV
Joop Geesinkweg 125, 1114 AB, Amsterdam, NL
T. +31 (0)85 111 9172
info@amarulasolutions.com
www.amarulasolutions.com
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v1] mtd: rawnand: macronix: OTP access for MX30LFxG18AC
2024-04-17 18:44 ` Michael Nazzareno Trimarchi
@ 2024-04-18 6:55 ` Dario Binacchi
2024-05-24 9:14 ` Arseniy Krasnov
0 siblings, 1 reply; 25+ messages in thread
From: Dario Binacchi @ 2024-04-18 6:55 UTC (permalink / raw)
To: Arseniy Krasnov
Cc: u-boot, kernel, Michael Nazzareno Trimarchi, oxffffaa,
Miquel Raynal, Jaime Liao, Jaime Liao
Arseniy, Michael, All
On Wed, Apr 17, 2024 at 8:44 PM Michael Nazzareno Trimarchi
<michael@amarulasolutions.com> wrote:
>
> Hi
>
> Dario did you add those patches in CI and test them again?
>
> Michael
>
> On Wed, Apr 17, 2024 at 8:44 PM Arseniy Krasnov
> <avkrasnov@salutedevices.com> wrote:
> >
> > Hello,
> >
> > Sorry, pls ping
> >
> > Thanks, Arseniy
> >
> > On 13.03.2024 09:46, Michael Nazzareno Trimarchi wrote:
> > > Hi Dario
> > >
> > > Can apply this series and put in CI?
Sorry, but I mistakenly tagged it as 'superseded'.
I just pushed it to my nand-next branch and I'm running the CI now.
Thanks and regards,
Dario
> > >
> > > Michael
> > >
> > > On Wed, Mar 13, 2024 at 7:43 AM Arseniy Krasnov
> > > <avkrasnov@salutedevices.com> wrote:
> > >>
> > >> Sorry, please ping
> > >>
> > >> Thanks, Arseniy
> > >>
> > >> On 11.02.2024 02:16, Arseniy Krasnov wrote:
> > >>> Sorry, pls ping
> > >>>
> > >>> Thanks, Arseniy
> > >>>
> > >>> On 08.01.2024 21:33, Arseniy Krasnov wrote:
> > >>>> Sorry, pls ping
> > >>>>
> > >>>> Thanks, Arseniy
> > >
> > >
> > >
>
>
>
> --
> Michael Nazzareno Trimarchi
> Co-Founder & Chief Executive Officer
> M. +39 347 913 2170
> michael@amarulasolutions.com
> __________________________________
>
> Amarula Solutions BV
> Joop Geesinkweg 125, 1114 AB, Amsterdam, NL
> T. +31 (0)85 111 9172
> info@amarulasolutions.com
> www.amarulasolutions.com
--
Dario Binacchi
Senior Embedded Linux Developer
dario.binacchi@amarulasolutions.com
__________________________________
Amarula Solutions SRL
Via Le Canevare 30, 31100 Treviso, Veneto, IT
T. +39 042 243 5310
info@amarulasolutions.com
www.amarulasolutions.com
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v1] mtd: rawnand: macronix: OTP access for MX30LFxG18AC
2024-04-18 6:55 ` Dario Binacchi
@ 2024-05-24 9:14 ` Arseniy Krasnov
2024-05-24 13:31 ` Dario Binacchi
0 siblings, 1 reply; 25+ messages in thread
From: Arseniy Krasnov @ 2024-05-24 9:14 UTC (permalink / raw)
To: Dario Binacchi
Cc: u-boot, kernel, Michael Nazzareno Trimarchi, oxffffaa,
Miquel Raynal, Jaime Liao, Jaime Liao
Hi Dario!
Sorry, is this patch ok?
Thanks
On 18.04.2024 09:55, Dario Binacchi wrote:
> Arseniy, Michael, All
>
> On Wed, Apr 17, 2024 at 8:44 PM Michael Nazzareno Trimarchi
> <michael@amarulasolutions.com> wrote:
>>
>> Hi
>>
>> Dario did you add those patches in CI and test them again?
>>
>> Michael
>>
>> On Wed, Apr 17, 2024 at 8:44 PM Arseniy Krasnov
>> <avkrasnov@salutedevices.com> wrote:
>>>
>>> Hello,
>>>
>>> Sorry, pls ping
>>>
>>> Thanks, Arseniy
>>>
>>> On 13.03.2024 09:46, Michael Nazzareno Trimarchi wrote:
>>>> Hi Dario
>>>>
>>>> Can apply this series and put in CI?
>
> Sorry, but I mistakenly tagged it as 'superseded'.
> I just pushed it to my nand-next branch and I'm running the CI now.
>
> Thanks and regards,
> Dario
>
>>>>
>>>> Michael
>>>>
>>>> On Wed, Mar 13, 2024 at 7:43 AM Arseniy Krasnov
>>>> <avkrasnov@salutedevices.com> wrote:
>>>>>
>>>>> Sorry, please ping
>>>>>
>>>>> Thanks, Arseniy
>>>>>
>>>>> On 11.02.2024 02:16, Arseniy Krasnov wrote:
>>>>>> Sorry, pls ping
>>>>>>
>>>>>> Thanks, Arseniy
>>>>>>
>>>>>> On 08.01.2024 21:33, Arseniy Krasnov wrote:
>>>>>>> Sorry, pls ping
>>>>>>>
>>>>>>> Thanks, Arseniy
>>>>
>>>>
>>>>
>>
>>
>>
>> --
>> Michael Nazzareno Trimarchi
>> Co-Founder & Chief Executive Officer
>> M. +39 347 913 2170
>> michael@amarulasolutions.com
>> __________________________________
>>
>> Amarula Solutions BV
>> Joop Geesinkweg 125, 1114 AB, Amsterdam, NL
>> T. +31 (0)85 111 9172
>> info@amarulasolutions.com
>> www.amarulasolutions.com
>
>
>
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v1] mtd: rawnand: macronix: OTP access for MX30LFxG18AC
2024-05-24 9:14 ` Arseniy Krasnov
@ 2024-05-24 13:31 ` Dario Binacchi
2024-05-24 14:05 ` Arseniy Krasnov
0 siblings, 1 reply; 25+ messages in thread
From: Dario Binacchi @ 2024-05-24 13:31 UTC (permalink / raw)
To: Arseniy Krasnov
Cc: u-boot, kernel, Michael Nazzareno Trimarchi, oxffffaa,
Miquel Raynal, Jaime Liao, Jaime Liao
Hi Arseniy,
On Fri, May 24, 2024 at 11:25 AM Arseniy Krasnov
<avkrasnov@salutedevices.com> wrote:
>
> Hi Dario!
>
> Sorry, is this patch ok?
Sorry, I told you I was testing it but I forgot to tell you that
testing was successfully
completed for this patch.
Thanks and regards,
Dario
>
> Thanks
>
> On 18.04.2024 09:55, Dario Binacchi wrote:
> > Arseniy, Michael, All
> >
> > On Wed, Apr 17, 2024 at 8:44 PM Michael Nazzareno Trimarchi
> > <michael@amarulasolutions.com> wrote:
> >>
> >> Hi
> >>
> >> Dario did you add those patches in CI and test them again?
> >>
> >> Michael
> >>
> >> On Wed, Apr 17, 2024 at 8:44 PM Arseniy Krasnov
> >> <avkrasnov@salutedevices.com> wrote:
> >>>
> >>> Hello,
> >>>
> >>> Sorry, pls ping
> >>>
> >>> Thanks, Arseniy
> >>>
> >>> On 13.03.2024 09:46, Michael Nazzareno Trimarchi wrote:
> >>>> Hi Dario
> >>>>
> >>>> Can apply this series and put in CI?
> >
> > Sorry, but I mistakenly tagged it as 'superseded'.
> > I just pushed it to my nand-next branch and I'm running the CI now.
> >
> > Thanks and regards,
> > Dario
> >
> >>>>
> >>>> Michael
> >>>>
> >>>> On Wed, Mar 13, 2024 at 7:43 AM Arseniy Krasnov
> >>>> <avkrasnov@salutedevices.com> wrote:
> >>>>>
> >>>>> Sorry, please ping
> >>>>>
> >>>>> Thanks, Arseniy
> >>>>>
> >>>>> On 11.02.2024 02:16, Arseniy Krasnov wrote:
> >>>>>> Sorry, pls ping
> >>>>>>
> >>>>>> Thanks, Arseniy
> >>>>>>
> >>>>>> On 08.01.2024 21:33, Arseniy Krasnov wrote:
> >>>>>>> Sorry, pls ping
> >>>>>>>
> >>>>>>> Thanks, Arseniy
> >>>>
> >>>>
> >>>>
> >>
> >>
> >>
> >> --
> >> Michael Nazzareno Trimarchi
> >> Co-Founder & Chief Executive Officer
> >> M. +39 347 913 2170
> >> michael@amarulasolutions.com
> >> __________________________________
> >>
> >> Amarula Solutions BV
> >> Joop Geesinkweg 125, 1114 AB, Amsterdam, NL
> >> T. +31 (0)85 111 9172
> >> info@amarulasolutions.com
> >> www.amarulasolutions.com
> >
> >
> >
--
Dario Binacchi
Senior Embedded Linux Developer
dario.binacchi@amarulasolutions.com
__________________________________
Amarula Solutions SRL
Via Le Canevare 30, 31100 Treviso, Veneto, IT
T. +39 042 243 5310
info@amarulasolutions.com
www.amarulasolutions.com
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v1] mtd: rawnand: macronix: OTP access for MX30LFxG18AC
2024-05-24 13:31 ` Dario Binacchi
@ 2024-05-24 14:05 ` Arseniy Krasnov
0 siblings, 0 replies; 25+ messages in thread
From: Arseniy Krasnov @ 2024-05-24 14:05 UTC (permalink / raw)
To: Dario Binacchi
Cc: u-boot, kernel, Michael Nazzareno Trimarchi, oxffffaa,
Miquel Raynal, Jaime Liao, Jaime Liao
On 24.05.2024 16:31, Dario Binacchi wrote:
> Hi Arseniy,
>
> On Fri, May 24, 2024 at 11:25 AM Arseniy Krasnov
> <avkrasnov@salutedevices.com> wrote:
>>
>> Hi Dario!
>>
>> Sorry, is this patch ok?
>
> Sorry, I told you I was testing it but I forgot to tell you that
> testing was successfully
> completed for this patch.
Ah, no problem, it will be merged to next release ?
Thanks
>
> Thanks and regards,
> Dario
>
>>
>> Thanks
>>
>> On 18.04.2024 09:55, Dario Binacchi wrote:
>>> Arseniy, Michael, All
>>>
>>> On Wed, Apr 17, 2024 at 8:44 PM Michael Nazzareno Trimarchi
>>> <michael@amarulasolutions.com> wrote:
>>>>
>>>> Hi
>>>>
>>>> Dario did you add those patches in CI and test them again?
>>>>
>>>> Michael
>>>>
>>>> On Wed, Apr 17, 2024 at 8:44 PM Arseniy Krasnov
>>>> <avkrasnov@salutedevices.com> wrote:
>>>>>
>>>>> Hello,
>>>>>
>>>>> Sorry, pls ping
>>>>>
>>>>> Thanks, Arseniy
>>>>>
>>>>> On 13.03.2024 09:46, Michael Nazzareno Trimarchi wrote:
>>>>>> Hi Dario
>>>>>>
>>>>>> Can apply this series and put in CI?
>>>
>>> Sorry, but I mistakenly tagged it as 'superseded'.
>>> I just pushed it to my nand-next branch and I'm running the CI now.
>>>
>>> Thanks and regards,
>>> Dario
>>>
>>>>>>
>>>>>> Michael
>>>>>>
>>>>>> On Wed, Mar 13, 2024 at 7:43 AM Arseniy Krasnov
>>>>>> <avkrasnov@salutedevices.com> wrote:
>>>>>>>
>>>>>>> Sorry, please ping
>>>>>>>
>>>>>>> Thanks, Arseniy
>>>>>>>
>>>>>>> On 11.02.2024 02:16, Arseniy Krasnov wrote:
>>>>>>>> Sorry, pls ping
>>>>>>>>
>>>>>>>> Thanks, Arseniy
>>>>>>>>
>>>>>>>> On 08.01.2024 21:33, Arseniy Krasnov wrote:
>>>>>>>>> Sorry, pls ping
>>>>>>>>>
>>>>>>>>> Thanks, Arseniy
>>>>>>
>>>>>>
>>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Michael Nazzareno Trimarchi
>>>> Co-Founder & Chief Executive Officer
>>>> M. +39 347 913 2170
>>>> michael@amarulasolutions.com
>>>> __________________________________
>>>>
>>>> Amarula Solutions BV
>>>> Joop Geesinkweg 125, 1114 AB, Amsterdam, NL
>>>> T. +31 (0)85 111 9172
>>>> info@amarulasolutions.com
>>>> www.amarulasolutions.com
>>>
>>>
>>>
>
>
>
^ permalink raw reply [flat|nested] 25+ messages in thread
end of thread, other threads:[~2024-05-24 14:16 UTC | newest]
Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-26 7:24 [PATCH v1] mtd: rawnand: macronix: OTP access for MX30LFxG18AC Arseniy Krasnov
2023-04-26 7:24 ` Arseniy Krasnov
2023-04-26 7:24 ` Arseniy Krasnov
2023-04-26 9:21 ` kernel test robot
2023-04-26 9:21 ` kernel test robot
2023-04-26 9:21 ` kernel test robot
2023-04-26 13:06 ` kernel test robot
2023-04-26 13:06 ` kernel test robot
2023-04-26 13:06 ` kernel test robot
2023-04-26 13:37 ` kernel test robot
2023-04-26 13:37 ` kernel test robot
2023-04-26 13:37 ` kernel test robot
-- strict thread matches above, loose matches on Subject: below --
2023-11-30 11:24 Arseniy Krasnov
2023-12-04 19:23 ` Arseniy Krasnov
2023-12-18 11:54 ` Arseniy Krasnov
2024-01-08 18:33 ` Arseniy Krasnov
2024-02-10 23:16 ` Arseniy Krasnov
2024-03-13 6:33 ` Arseniy Krasnov
2024-03-13 6:46 ` Michael Nazzareno Trimarchi
2024-04-17 18:33 ` Arseniy Krasnov
2024-04-17 18:44 ` Michael Nazzareno Trimarchi
2024-04-18 6:55 ` Dario Binacchi
2024-05-24 9:14 ` Arseniy Krasnov
2024-05-24 13:31 ` Dario Binacchi
2024-05-24 14:05 ` Arseniy Krasnov
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.