<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>LayerscapeのトピックRe: LS1021A NAND driver does not support raw read/write operations</title>
    <link>https://community.nxp.com/t5/Layerscape/LS1021A-NAND-driver-does-not-support-raw-read-write-operations/m-p/663587#M2407</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The following patch file add support for raw read/write operations:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;From 6fcc13592d8b639a850d20f40046127d65ccd55d Mon Sep 17 00:00:00 2001&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&lt;SPAN&gt;From: Kees Trommel &amp;lt;&lt;/SPAN&gt;&lt;A class="jive-link-email-small" href="mailto:ctrommel@linvm302.aimsys.nl"&gt;ctrommel@linvm302.aimsys.nl&lt;/A&gt;&lt;SPAN&gt;&amp;gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;Date: Tue, 15 Nov 2016 17:03:49 +0100&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;Subject: [PATCH] fsl_ifc_nand-linux-raw-read-write&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&lt;SPAN&gt;Signed-off-by: Kees Trommel &amp;lt;&lt;/SPAN&gt;&lt;A class="jive-link-email-small" href="mailto:ctrommel@linvm302.aimsys.nl"&gt;ctrommel@linvm302.aimsys.nl&lt;/A&gt;&lt;SPAN&gt;&amp;gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;---&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; drivers/mtd/nand/fsl_ifc_nand.c | 58 +++++++++++++++++++++++++++++++++++++----&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; 1 file changed, 53 insertions(+), 5 deletions(-)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;diff --git a/drivers/mtd/nand/fsl_ifc_nand.c b/drivers/mtd/nand/fsl_ifc_nand.c&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;index ca36b35..31f7094 100644&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;--- a/drivers/mtd/nand/fsl_ifc_nand.c&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+++ b/drivers/mtd/nand/fsl_ifc_nand.c&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;@@ -64,6 +64,7 @@ struct fsl_ifc_nand_ctrl {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; unsigned int eccread; /* Non zero for a full-page ECC read */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; unsigned int counter; /* counter for the initializations */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; unsigned int max_bitflips; /* Saved during READ0 cmd */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ unsigned int raw; /* Non zero if operating raw (no ECC) */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; };&lt;/SPAN&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; static struct fsl_ifc_nand_ctrl *ifc_nand_ctrl;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;@@ -422,15 +423,21 @@ static void fsl_ifc_cmdfunc(struct mtd_info *mtd, unsigned int command,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; switch (command) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; /* READ0 read the entire buffer to use hardware ECC. */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; case NAND_CMD_READ0:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;- ifc_out32(0, &amp;amp;ifc-&amp;gt;ifc_nand.nand_fbcr);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ if (chip-&amp;gt;ecc.mode == NAND_ECC_HW &amp;amp;&amp;amp; !ifc_nand_ctrl-&amp;gt;raw)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ ifc_nand_ctrl-&amp;gt;eccread = 1;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ if (ifc_nand_ctrl-&amp;gt;raw) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ /* If BC (fbcr) != 0 then ECC is disabled */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ ifc_out32(mtd-&amp;gt;writesize + mtd-&amp;gt;oobsize, &amp;amp;ifc-&amp;gt;ifc_nand.nand_fbcr);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ ifc_nand_ctrl-&amp;gt;raw = 0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ } else {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ ifc_out32(0, &amp;amp;ifc-&amp;gt;ifc_nand.nand_fbcr);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; set_addr(mtd, 0, page_addr, 0);&lt;/SPAN&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; ifc_nand_ctrl-&amp;gt;read_bytes = mtd-&amp;gt;writesize + mtd-&amp;gt;oobsize;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; ifc_nand_ctrl-&amp;gt;index += column;&lt;/SPAN&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;- if (chip-&amp;gt;ecc.mode == NAND_ECC_HW)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;- ifc_nand_ctrl-&amp;gt;eccread = 1;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;-&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; fsl_ifc_do_read(chip, 0, mtd);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; fsl_ifc_run_command(mtd);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; return;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;@@ -560,10 +567,12 @@ static void fsl_ifc_cmdfunc(struct mtd_info *mtd, unsigned int command,&lt;/SPAN&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; /* PAGEPROG reuses all of the setup from SEQIN and adds the length */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; case NAND_CMD_PAGEPROG: {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;- if (ifc_nand_ctrl-&amp;gt;oob) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ if (ifc_nand_ctrl-&amp;gt;oob || ifc_nand_ctrl-&amp;gt;raw) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ /* If BC (fbcr) != 0 then ECC is disabled */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; ifc_out32(ifc_nand_ctrl-&amp;gt;index -&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; ifc_nand_ctrl-&amp;gt;column,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; &amp;amp;ifc-&amp;gt;ifc_nand.nand_fbcr);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ ifc_nand_ctrl-&amp;gt;raw = 0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; } else {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; ifc_out32(0, &amp;amp;ifc-&amp;gt;ifc_nand.nand_fbcr);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;@@ -780,6 +789,43 @@ static int fsl_ifc_write_page(struct mtd_info *mtd, struct nand_chip *chip,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; return 0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; }&lt;/SPAN&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+/* ECC will be disabled&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+static int fsl_ifc_read_page_raw(struct mtd_info *mtd, struct nand_chip *chip,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ uint8_t *buf, int oob_required, int page)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ struct fsl_ifc_mtd *priv = chip-&amp;gt;priv;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ struct fsl_ifc_ctrl *ctrl = priv-&amp;gt;ctrl;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ struct fsl_ifc_nand_ctrl *nctrl = ifc_nand_ctrl;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ /* the READ0 command but this time with the raw flag set */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ ifc_nand_ctrl-&amp;gt;raw = 1;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ fsl_ifc_cmdfunc(mtd, NAND_CMD_READ0, 0x00, page);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ fsl_ifc_read_buf(mtd, buf, mtd-&amp;gt;writesize);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ if (oob_required)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ fsl_ifc_read_buf(mtd, chip-&amp;gt;oob_poi, mtd-&amp;gt;oobsize);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ if (ctrl-&amp;gt;nand_stat != IFC_NAND_EVTER_STAT_OPC)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ mtd-&amp;gt;ecc_stats.failed++;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ return nctrl-&amp;gt;max_bitflips;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+static int fsl_ifc_write_page_raw(struct mtd_info *mtd, struct nand_chip *chip,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ const uint8_t *buf, int oob_required)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ fsl_ifc_write_buf(mtd, buf, mtd-&amp;gt;writesize);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ if (oob_required)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ fsl_ifc_write_buf(mtd, chip-&amp;gt;oob_poi, mtd-&amp;gt;oobsize);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ ifc_nand_ctrl-&amp;gt;raw = 1;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ return 0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; static int fsl_ifc_chip_init_tail(struct mtd_info *mtd)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; struct nand_chip *chip = mtd-&amp;gt;priv;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;@@ -923,7 +969,9 @@ static int fsl_ifc_chip_init(struct fsl_ifc_mtd *priv)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; chip-&amp;gt;priv = priv;&lt;/SPAN&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; chip-&amp;gt;ecc.read_page = fsl_ifc_read_page;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ chip-&amp;gt;ecc.read_page_raw = fsl_ifc_read_page_raw;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; chip-&amp;gt;ecc.write_page = fsl_ifc_write_page;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ chip-&amp;gt;ecc.write_page_raw = fsl_ifc_write_page_raw;&lt;/SPAN&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; csor = ifc_in32(&amp;amp;ifc_global-&amp;gt;csor_cs[priv-&amp;gt;bank].csor);&lt;/SPAN&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;-- &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;2.5.5&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 15 Nov 2016 16:05:55 GMT</pubDate>
    <dc:creator>keestrommel</dc:creator>
    <dc:date>2016-11-15T16:05:55Z</dc:date>
    <item>
      <title>LS1021A NAND driver does not support raw read/write operations</title>
      <link>https://community.nxp.com/t5/Layerscape/LS1021A-NAND-driver-does-not-support-raw-read-write-operations/m-p/663586#M2406</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The LS1021A Linux NAND driver provided with the QorIQ Linux SDK 2.0 does not provide raw read/write operations. E.g. the following command does not return the page data with bit flips but with the bit flips corrected:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;nanddump -n -o -s 0 -l 4096 -f /tmp/page0-oob /dev/mtd1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and the following command re-calculates the ECCs in the OOB rather than writing the OOB provided in the file page0-oob-8f:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;nandwrite -n -o -s 0x2ff000 /dev/mtd1 page0-oob-8f&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note: page0-oob-8f is page0-oob of the nanddump command but with 8 bit flips edited by an hex editor.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Nov 2016 15:57:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Layerscape/LS1021A-NAND-driver-does-not-support-raw-read-write-operations/m-p/663586#M2406</guid>
      <dc:creator>keestrommel</dc:creator>
      <dc:date>2016-11-15T15:57:13Z</dc:date>
    </item>
    <item>
      <title>Re: LS1021A NAND driver does not support raw read/write operations</title>
      <link>https://community.nxp.com/t5/Layerscape/LS1021A-NAND-driver-does-not-support-raw-read-write-operations/m-p/663587#M2407</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The following patch file add support for raw read/write operations:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;From 6fcc13592d8b639a850d20f40046127d65ccd55d Mon Sep 17 00:00:00 2001&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&lt;SPAN&gt;From: Kees Trommel &amp;lt;&lt;/SPAN&gt;&lt;A class="jive-link-email-small" href="mailto:ctrommel@linvm302.aimsys.nl"&gt;ctrommel@linvm302.aimsys.nl&lt;/A&gt;&lt;SPAN&gt;&amp;gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;Date: Tue, 15 Nov 2016 17:03:49 +0100&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;Subject: [PATCH] fsl_ifc_nand-linux-raw-read-write&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&lt;SPAN&gt;Signed-off-by: Kees Trommel &amp;lt;&lt;/SPAN&gt;&lt;A class="jive-link-email-small" href="mailto:ctrommel@linvm302.aimsys.nl"&gt;ctrommel@linvm302.aimsys.nl&lt;/A&gt;&lt;SPAN&gt;&amp;gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;---&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; drivers/mtd/nand/fsl_ifc_nand.c | 58 +++++++++++++++++++++++++++++++++++++----&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; 1 file changed, 53 insertions(+), 5 deletions(-)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;diff --git a/drivers/mtd/nand/fsl_ifc_nand.c b/drivers/mtd/nand/fsl_ifc_nand.c&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;index ca36b35..31f7094 100644&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;--- a/drivers/mtd/nand/fsl_ifc_nand.c&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+++ b/drivers/mtd/nand/fsl_ifc_nand.c&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;@@ -64,6 +64,7 @@ struct fsl_ifc_nand_ctrl {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; unsigned int eccread; /* Non zero for a full-page ECC read */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; unsigned int counter; /* counter for the initializations */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; unsigned int max_bitflips; /* Saved during READ0 cmd */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ unsigned int raw; /* Non zero if operating raw (no ECC) */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; };&lt;/SPAN&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; static struct fsl_ifc_nand_ctrl *ifc_nand_ctrl;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;@@ -422,15 +423,21 @@ static void fsl_ifc_cmdfunc(struct mtd_info *mtd, unsigned int command,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; switch (command) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; /* READ0 read the entire buffer to use hardware ECC. */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; case NAND_CMD_READ0:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;- ifc_out32(0, &amp;amp;ifc-&amp;gt;ifc_nand.nand_fbcr);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ if (chip-&amp;gt;ecc.mode == NAND_ECC_HW &amp;amp;&amp;amp; !ifc_nand_ctrl-&amp;gt;raw)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ ifc_nand_ctrl-&amp;gt;eccread = 1;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ if (ifc_nand_ctrl-&amp;gt;raw) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ /* If BC (fbcr) != 0 then ECC is disabled */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ ifc_out32(mtd-&amp;gt;writesize + mtd-&amp;gt;oobsize, &amp;amp;ifc-&amp;gt;ifc_nand.nand_fbcr);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ ifc_nand_ctrl-&amp;gt;raw = 0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ } else {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ ifc_out32(0, &amp;amp;ifc-&amp;gt;ifc_nand.nand_fbcr);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; set_addr(mtd, 0, page_addr, 0);&lt;/SPAN&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; ifc_nand_ctrl-&amp;gt;read_bytes = mtd-&amp;gt;writesize + mtd-&amp;gt;oobsize;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; ifc_nand_ctrl-&amp;gt;index += column;&lt;/SPAN&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;- if (chip-&amp;gt;ecc.mode == NAND_ECC_HW)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;- ifc_nand_ctrl-&amp;gt;eccread = 1;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;-&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; fsl_ifc_do_read(chip, 0, mtd);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; fsl_ifc_run_command(mtd);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; return;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;@@ -560,10 +567,12 @@ static void fsl_ifc_cmdfunc(struct mtd_info *mtd, unsigned int command,&lt;/SPAN&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; /* PAGEPROG reuses all of the setup from SEQIN and adds the length */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; case NAND_CMD_PAGEPROG: {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;- if (ifc_nand_ctrl-&amp;gt;oob) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ if (ifc_nand_ctrl-&amp;gt;oob || ifc_nand_ctrl-&amp;gt;raw) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ /* If BC (fbcr) != 0 then ECC is disabled */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; ifc_out32(ifc_nand_ctrl-&amp;gt;index -&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; ifc_nand_ctrl-&amp;gt;column,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; &amp;amp;ifc-&amp;gt;ifc_nand.nand_fbcr);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ ifc_nand_ctrl-&amp;gt;raw = 0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; } else {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; ifc_out32(0, &amp;amp;ifc-&amp;gt;ifc_nand.nand_fbcr);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;@@ -780,6 +789,43 @@ static int fsl_ifc_write_page(struct mtd_info *mtd, struct nand_chip *chip,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; return 0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; }&lt;/SPAN&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+/* ECC will be disabled&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+static int fsl_ifc_read_page_raw(struct mtd_info *mtd, struct nand_chip *chip,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ uint8_t *buf, int oob_required, int page)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ struct fsl_ifc_mtd *priv = chip-&amp;gt;priv;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ struct fsl_ifc_ctrl *ctrl = priv-&amp;gt;ctrl;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ struct fsl_ifc_nand_ctrl *nctrl = ifc_nand_ctrl;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ /* the READ0 command but this time with the raw flag set */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ ifc_nand_ctrl-&amp;gt;raw = 1;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ fsl_ifc_cmdfunc(mtd, NAND_CMD_READ0, 0x00, page);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ fsl_ifc_read_buf(mtd, buf, mtd-&amp;gt;writesize);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ if (oob_required)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ fsl_ifc_read_buf(mtd, chip-&amp;gt;oob_poi, mtd-&amp;gt;oobsize);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ if (ctrl-&amp;gt;nand_stat != IFC_NAND_EVTER_STAT_OPC)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ mtd-&amp;gt;ecc_stats.failed++;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ return nctrl-&amp;gt;max_bitflips;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+static int fsl_ifc_write_page_raw(struct mtd_info *mtd, struct nand_chip *chip,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ const uint8_t *buf, int oob_required)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ fsl_ifc_write_buf(mtd, buf, mtd-&amp;gt;writesize);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ if (oob_required)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ fsl_ifc_write_buf(mtd, chip-&amp;gt;oob_poi, mtd-&amp;gt;oobsize);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ ifc_nand_ctrl-&amp;gt;raw = 1;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ return 0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; static int fsl_ifc_chip_init_tail(struct mtd_info *mtd)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; struct nand_chip *chip = mtd-&amp;gt;priv;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;@@ -923,7 +969,9 @@ static int fsl_ifc_chip_init(struct fsl_ifc_mtd *priv)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; chip-&amp;gt;priv = priv;&lt;/SPAN&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; chip-&amp;gt;ecc.read_page = fsl_ifc_read_page;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ chip-&amp;gt;ecc.read_page_raw = fsl_ifc_read_page_raw;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; chip-&amp;gt;ecc.write_page = fsl_ifc_write_page;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;+ chip-&amp;gt;ecc.write_page_raw = fsl_ifc_write_page_raw;&lt;/SPAN&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; csor = ifc_in32(&amp;amp;ifc_global-&amp;gt;csor_cs[priv-&amp;gt;bank].csor);&lt;/SPAN&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;-- &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;2.5.5&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Nov 2016 16:05:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Layerscape/LS1021A-NAND-driver-does-not-support-raw-read-write-operations/m-p/663587#M2407</guid>
      <dc:creator>keestrommel</dc:creator>
      <dc:date>2016-11-15T16:05:55Z</dc:date>
    </item>
  </channel>
</rss>

