get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/2217009/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2217009,
    "url": "http://patchwork.ozlabs.org/api/patches/2217009/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/20260327140508.3680105-2-richard.genoud@bootlin.com/",
    "project": {
        "id": 18,
        "url": "http://patchwork.ozlabs.org/api/projects/18/?format=api",
        "name": "U-Boot",
        "link_name": "uboot",
        "list_id": "u-boot.lists.denx.de",
        "list_email": "u-boot@lists.denx.de",
        "web_url": null,
        "scm_url": null,
        "webscm_url": null,
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20260327140508.3680105-2-richard.genoud@bootlin.com>",
    "list_archive_url": null,
    "date": "2026-03-27T14:05:04",
    "name": "[v2,1/5] mtd: rawnand: sunxi: Replace hard coded value by a define",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "7795ae40f1fe5b68f11c1a95d6b65c5ad907e4bf",
    "submitter": {
        "id": 88519,
        "url": "http://patchwork.ozlabs.org/api/people/88519/?format=api",
        "name": "Richard Genoud",
        "email": "richard.genoud@bootlin.com"
    },
    "delegate": {
        "id": 114289,
        "url": "http://patchwork.ozlabs.org/api/users/114289/?format=api",
        "username": "apritzel",
        "first_name": "Andre",
        "last_name": "Przywara",
        "email": "andre.przywara@arm.com"
    },
    "mbox": "http://patchwork.ozlabs.org/project/uboot/patch/20260327140508.3680105-2-richard.genoud@bootlin.com/mbox/",
    "series": [
        {
            "id": 497775,
            "url": "http://patchwork.ozlabs.org/api/series/497775/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/uboot/list/?series=497775",
            "date": "2026-03-27T14:05:03",
            "name": "mtd: rawnand: sunxi: Fix user data length for H6",
            "version": 2,
            "mbox": "http://patchwork.ozlabs.org/series/497775/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2217009/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2217009/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<u-boot-bounces@lists.denx.de>",
        "X-Original-To": "incoming@patchwork.ozlabs.org",
        "Delivered-To": "patchwork-incoming@legolas.ozlabs.org",
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256\n header.s=dkim header.b=A9Z7Rgzk;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de\n (client-ip=85.214.62.61; helo=phobos.denx.de;\n envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org)",
            "phobos.denx.de;\n dmarc=pass (p=reject dis=none) header.from=bootlin.com",
            "phobos.denx.de;\n spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de",
            "phobos.denx.de;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=bootlin.com header.i=@bootlin.com header.b=\"A9Z7Rgzk\";\n\tdkim-atps=neutral",
            "phobos.denx.de;\n dmarc=pass (p=reject dis=none) header.from=bootlin.com",
            "phobos.denx.de;\n spf=pass smtp.mailfrom=richard.genoud@bootlin.com"
        ],
        "Received": [
            "from phobos.denx.de (phobos.denx.de [85.214.62.61])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fj2VP6Vm7z1y1P\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 28 Mar 2026 01:05:49 +1100 (AEDT)",
            "from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id A41F883FC6;\n\tFri, 27 Mar 2026 15:05:37 +0100 (CET)",
            "by phobos.denx.de (Postfix, from userid 109)\n id 8FFE983DA7; Fri, 27 Mar 2026 15:05:36 +0100 (CET)",
            "from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))\n (No client certificate requested)\n by phobos.denx.de (Postfix) with ESMTPS id 68EF483DA7\n for <u-boot@lists.denx.de>; Fri, 27 Mar 2026 15:05:34 +0100 (CET)",
            "from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233])\n by smtpout-03.galae.net (Postfix) with ESMTPS id E885E4E42825;\n Fri, 27 Mar 2026 14:05:33 +0000 (UTC)",
            "from mail.galae.net (mail.galae.net [212.83.136.155])\n by smtpout-01.galae.net (Postfix) with ESMTPS id BD8D260230;\n Fri, 27 Mar 2026 14:05:33 +0000 (UTC)",
            "from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon)\n with ESMTPSA id 02E2B1045128C; Fri, 27 Mar 2026 15:05:31 +0100 (CET)"
        ],
        "X-Spam-Checker-Version": "SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de",
        "X-Spam-Level": "",
        "X-Spam-Status": "No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,\n DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED,\n RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,\n SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim;\n t=1774620332; h=from:subject:date:message-id:to:cc:mime-version:\n content-transfer-encoding:in-reply-to:references;\n bh=Qpgyjfb4vT/y7A1Yoq3Xbc5rWaJ3y4isjEsXoeVmTLU=;\n b=A9Z7RgzkMdpFO9QILQyvIgMfwUES9gpCTO/6UK3Ipj42nIg++8tBlLI8lbrX47YjSlRB8y\n 33v/tuUBu3UYoSjoWMXDChs+y7tG5khF9lGpuK3a+I2P42gKbjY3kTJR2hfRr4mlATjpQA\n a+1ofNKCioLNNqgbjIu4/eT1G4M/T84ojYO9BP/4eJei7p5wak43VFT/apnLrnussErfse\n apxuZH6OVbymfZuJqbhC1R9UAtnyRHUjw0/z1w85gX4zMxY09l/b3fBOwSiKgfzcFoE84C\n x928CRW4som/PgXvZeDyF9v4YHEMqbaP3tXQXl7QICmD3tPghx+LOYYiQMnpww==",
        "From": "Richard Genoud <richard.genoud@bootlin.com>",
        "To": "Dario Binacchi <dario.binacchi@amarulasolutions.com>,\n Michael Trimarchi <michael@amarulasolutions.com>,\n Tom Rini <trini@konsulko.com>, Andre Przywara <andre.przywara@arm.com>",
        "Cc": "Andrew Goodbody <andrew.goodbody@linaro.org>,\n Miquel Raynal <miquel.raynal@bootlin.com>,\n James Hilliard <james.hilliard1@gmail.com>,\n Boris Brezillon <bbrezillon@kernel.org>,\n Thomas Petazzoni <thomas.petazzoni@bootlin.com>, u-boot@lists.denx.de,\n Richard Genoud <richard.genoud@bootlin.com>",
        "Subject": "[PATCH v2 1/5] mtd: rawnand: sunxi: Replace hard coded value by a\n define",
        "Date": "Fri, 27 Mar 2026 15:05:04 +0100",
        "Message-ID": "<20260327140508.3680105-2-richard.genoud@bootlin.com>",
        "X-Mailer": "git-send-email 2.47.3",
        "In-Reply-To": "<20260327140508.3680105-1-richard.genoud@bootlin.com>",
        "References": "<20260327140508.3680105-1-richard.genoud@bootlin.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-Last-TLS-Session-Version": "TLSv1.3",
        "X-BeenThere": "u-boot@lists.denx.de",
        "X-Mailman-Version": "2.1.39",
        "Precedence": "list",
        "List-Id": "U-Boot discussion <u-boot.lists.denx.de>",
        "List-Unsubscribe": "<https://lists.denx.de/options/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=unsubscribe>",
        "List-Archive": "<https://lists.denx.de/pipermail/u-boot/>",
        "List-Post": "<mailto:u-boot@lists.denx.de>",
        "List-Help": "<mailto:u-boot-request@lists.denx.de?subject=help>",
        "List-Subscribe": "<https://lists.denx.de/listinfo/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=subscribe>",
        "Errors-To": "u-boot-bounces@lists.denx.de",
        "Sender": "\"U-Boot\" <u-boot-bounces@lists.denx.de>",
        "X-Virus-Scanned": "clamav-milter 0.103.8 at phobos.denx.de",
        "X-Virus-Status": "Clean"
    },
    "content": "The user data length (4) used all over the code hard coded.\nAnd sometimes, it's not that trivial to know that it's the user data\nlength and not something else.\nMoreover, for the H6/H616 this value is no more fixed by hardware, but\ncould be modified.\n\nUsing a define here makes the code more readable.\n\nSuggested-by: Miquel Raynal <miquel.raynal@bootlin.com>\nReviewed-by: Michael Trimarchi <michael@amarulasolutions.com>\nSigned-off-by: Richard Genoud <richard.genoud@bootlin.com>\n---\n drivers/mtd/nand/raw/sunxi_nand.c     | 58 +++++++++++++--------------\n drivers/mtd/nand/raw/sunxi_nand.h     |  3 ++\n drivers/mtd/nand/raw/sunxi_nand_spl.c |  7 +++-\n 3 files changed, 38 insertions(+), 30 deletions(-)",
    "diff": "diff --git a/drivers/mtd/nand/raw/sunxi_nand.c b/drivers/mtd/nand/raw/sunxi_nand.c\nindex ef27a4b7a36a..91f7da2c5ce5 100644\n--- a/drivers/mtd/nand/raw/sunxi_nand.c\n+++ b/drivers/mtd/nand/raw/sunxi_nand.c\n@@ -772,7 +772,7 @@ static int sunxi_nfc_hw_ecc_read_chunk(struct mtd_info *mtd,\n \t\treturn ret;\n \n \tsunxi_nfc_reset_user_data_len(nfc);\n-\tsunxi_nfc_set_user_data_len(nfc, 4, 0);\n+\tsunxi_nfc_set_user_data_len(nfc, USER_DATA_SZ, 0);\n \n \tsunxi_nfc_randomizer_enable(mtd);\n \twritel(NFC_DATA_TRANS | NFC_DATA_SWAP_METHOD | NFC_ECC_OP,\n@@ -783,7 +783,7 @@ static int sunxi_nfc_hw_ecc_read_chunk(struct mtd_info *mtd,\n \tif (ret)\n \t\treturn ret;\n \n-\t*cur_off = oob_off + ecc->bytes + 4;\n+\t*cur_off = oob_off + ecc->bytes + USER_DATA_SZ;\n \n \tpattern_found = readl(nfc->regs + nfc->caps->reg_pat_found);\n \tpattern_found = field_get(NFC_ECC_PAT_FOUND_MSK(nfc), pattern_found);\n@@ -794,7 +794,7 @@ static int sunxi_nfc_hw_ecc_read_chunk(struct mtd_info *mtd,\n \t\t\tpattern = 0x0;\n \n \t\tmemset(data, pattern, ecc->size);\n-\t\tmemset(oob, pattern, ecc->bytes + 4);\n+\t\tmemset(oob, pattern, ecc->bytes + USER_DATA_SZ);\n \n \t\treturn 1;\n \t}\n@@ -804,7 +804,7 @@ static int sunxi_nfc_hw_ecc_read_chunk(struct mtd_info *mtd,\n \tmemcpy_fromio(data, nfc->regs + NFC_RAM0_BASE, ecc->size);\n \n \tnand->cmdfunc(mtd, NAND_CMD_RNDOUT, oob_off, -1);\n-\tsunxi_nfc_randomizer_read_buf(mtd, oob, ecc->bytes + 4, true, page);\n+\tsunxi_nfc_randomizer_read_buf(mtd, oob, ecc->bytes + USER_DATA_SZ, true, page);\n \n \tstatus = readl(nfc->regs + NFC_REG_ECC_ST);\n \tif (status & NFC_ECC_ERR(0)) {\n@@ -816,17 +816,17 @@ static int sunxi_nfc_hw_ecc_read_chunk(struct mtd_info *mtd,\n \t\t\tnand->cmdfunc(mtd, NAND_CMD_RNDOUT, data_off, -1);\n \t\t\tnand->read_buf(mtd, data, ecc->size);\n \t\t\tnand->cmdfunc(mtd, NAND_CMD_RNDOUT, oob_off, -1);\n-\t\t\tnand->read_buf(mtd, oob, ecc->bytes + 4);\n+\t\t\tnand->read_buf(mtd, oob, ecc->bytes + USER_DATA_SZ);\n \t\t}\n \n \t\tret = nand_check_erased_ecc_chunk(data,\tecc->size,\n-\t\t\t\t\t\t  oob, ecc->bytes + 4,\n+\t\t\t\t\t\t  oob, ecc->bytes + USER_DATA_SZ,\n \t\t\t\t\t\t  NULL, 0, ecc->strength);\n \t\tif (ret >= 0)\n \t\t\traw_mode = 1;\n \t} else {\n \t\t/*\n-\t\t * The engine protects 4 bytes of OOB data per chunk.\n+\t\t * The engine protects USER_DATA_SZ bytes of OOB data per chunk.\n \t\t * Retrieve the corrected OOB bytes.\n \t\t */\n \t\tsunxi_nfc_user_data_to_buf(readl(nfc->regs +\n@@ -854,7 +854,7 @@ static void sunxi_nfc_hw_ecc_read_extra_oob(struct mtd_info *mtd,\n {\n \tstruct nand_chip *nand = mtd_to_nand(mtd);\n \tstruct nand_ecc_ctrl *ecc = &nand->ecc;\n-\tint offset = ((ecc->bytes + 4) * ecc->steps);\n+\tint offset = ((ecc->bytes + USER_DATA_SZ) * ecc->steps);\n \tint len = mtd->oobsize - offset;\n \n \tif (len <= 0)\n@@ -896,9 +896,9 @@ static int sunxi_nfc_hw_ecc_write_chunk(struct mtd_info *mtd,\n \n \t/* Fill OOB data in */\n \tif ((nand->options & NAND_NEED_SCRAMBLING) && bbm) {\n-\t\tu8 user_data[4];\n+\t\tu8 user_data[USER_DATA_SZ];\n \n-\t\tmemcpy(user_data, oob, 4);\n+\t\tmemcpy(user_data, oob, USER_DATA_SZ);\n \t\tsunxi_nfc_randomize_bbm(mtd, page, user_data);\n \t\twritel(sunxi_nfc_buf_to_user_data(user_data),\n \t\t       nfc->regs + NFC_REG_USER_DATA(nfc, 0));\n@@ -915,7 +915,7 @@ static int sunxi_nfc_hw_ecc_write_chunk(struct mtd_info *mtd,\n \t\treturn ret;\n \n \tsunxi_nfc_reset_user_data_len(nfc);\n-\tsunxi_nfc_set_user_data_len(nfc, 4, 0);\n+\tsunxi_nfc_set_user_data_len(nfc, USER_DATA_SZ, 0);\n \n \tsunxi_nfc_randomizer_enable(mtd);\n \twritel(NFC_DATA_TRANS | NFC_DATA_SWAP_METHOD |\n@@ -927,7 +927,7 @@ static int sunxi_nfc_hw_ecc_write_chunk(struct mtd_info *mtd,\n \tif (ret)\n \t\treturn ret;\n \n-\t*cur_off = oob_off + ecc->bytes + 4;\n+\t*cur_off = oob_off + ecc->bytes + USER_DATA_SZ;\n \n \treturn 0;\n }\n@@ -938,7 +938,7 @@ static void sunxi_nfc_hw_ecc_write_extra_oob(struct mtd_info *mtd,\n {\n \tstruct nand_chip *nand = mtd_to_nand(mtd);\n \tstruct nand_ecc_ctrl *ecc = &nand->ecc;\n-\tint offset = ((ecc->bytes + 4) * ecc->steps);\n+\tint offset = ((ecc->bytes + USER_DATA_SZ) * ecc->steps);\n \tint len = mtd->oobsize - offset;\n \n \tif (len <= 0)\n@@ -966,7 +966,7 @@ static int sunxi_nfc_hw_ecc_read_page(struct mtd_info *mtd,\n \n \tfor (i = 0; i < ecc->steps; i++) {\n \t\tint data_off = i * ecc->size;\n-\t\tint oob_off = i * (ecc->bytes + 4);\n+\t\tint oob_off = i * (ecc->bytes + USER_DATA_SZ);\n \t\tu8 *data = buf + data_off;\n \t\tu8 *oob = chip->oob_poi + oob_off;\n \n@@ -1004,7 +1004,7 @@ static int sunxi_nfc_hw_ecc_read_subpage(struct mtd_info *mtd,\n \tfor (i = data_offs / ecc->size;\n \t     i < DIV_ROUND_UP(data_offs + readlen, ecc->size); i++) {\n \t\tint data_off = i * ecc->size;\n-\t\tint oob_off = i * (ecc->bytes + 4);\n+\t\tint oob_off = i * (ecc->bytes + USER_DATA_SZ);\n \t\tu8 *data = bufpoi + data_off;\n \t\tu8 *oob = chip->oob_poi + oob_off;\n \n@@ -1032,7 +1032,7 @@ static int sunxi_nfc_hw_ecc_write_page(struct mtd_info *mtd,\n \n \tfor (i = 0; i < ecc->steps; i++) {\n \t\tint data_off = i * ecc->size;\n-\t\tint oob_off = i * (ecc->bytes + 4);\n+\t\tint oob_off = i * (ecc->bytes + USER_DATA_SZ);\n \t\tconst u8 *data = buf + data_off;\n \t\tconst u8 *oob = chip->oob_poi + oob_off;\n \n@@ -1066,7 +1066,7 @@ static int sunxi_nfc_hw_ecc_write_subpage(struct mtd_info *mtd,\n \tfor (i = data_offs / ecc->size;\n \t     i < DIV_ROUND_UP(data_offs + data_len, ecc->size); i++) {\n \t\tint data_off = i * ecc->size;\n-\t\tint oob_off = i * (ecc->bytes + 4);\n+\t\tint oob_off = i * (ecc->bytes + USER_DATA_SZ);\n \t\tconst u8 *data = buf + data_off;\n \t\tconst u8 *oob = chip->oob_poi + oob_off;\n \n@@ -1095,10 +1095,10 @@ static int sunxi_nfc_hw_syndrome_ecc_read_page(struct mtd_info *mtd,\n \tsunxi_nfc_hw_ecc_enable(mtd);\n \n \tfor (i = 0; i < ecc->steps; i++) {\n-\t\tint data_off = i * (ecc->size + ecc->bytes + 4);\n+\t\tint data_off = i * (ecc->size + ecc->bytes + USER_DATA_SZ);\n \t\tint oob_off = data_off + ecc->size;\n \t\tu8 *data = buf + (i * ecc->size);\n-\t\tu8 *oob = chip->oob_poi + (i * (ecc->bytes + 4));\n+\t\tu8 *oob = chip->oob_poi + (i * (ecc->bytes + USER_DATA_SZ));\n \n \t\tret = sunxi_nfc_hw_ecc_read_chunk(mtd, data, data_off, oob,\n \t\t\t\t\t\t  oob_off, &cur_off,\n@@ -1129,10 +1129,10 @@ static int sunxi_nfc_hw_syndrome_ecc_write_page(struct mtd_info *mtd,\n \tsunxi_nfc_hw_ecc_enable(mtd);\n \n \tfor (i = 0; i < ecc->steps; i++) {\n-\t\tint data_off = i * (ecc->size + ecc->bytes + 4);\n+\t\tint data_off = i * (ecc->size + ecc->bytes + USER_DATA_SZ);\n \t\tint oob_off = data_off + ecc->size;\n \t\tconst u8 *data = buf + (i * ecc->size);\n-\t\tconst u8 *oob = chip->oob_poi + (i * (ecc->bytes + 4));\n+\t\tconst u8 *oob = chip->oob_poi + (i * (ecc->bytes + USER_DATA_SZ));\n \n \t\tret = sunxi_nfc_hw_ecc_write_chunk(mtd, data, data_off,\n \t\t\t\t\t\t   oob, oob_off, &cur_off,\n@@ -1390,7 +1390,7 @@ static int sunxi_nand_hw_common_ecc_ctrl_init(struct mtd_info *mtd,\n \tlayout = &data->layout;\n \tnsectors = mtd->writesize / ecc->size;\n \n-\tif (mtd->oobsize < ((ecc->bytes + 4) * nsectors)) {\n+\tif (mtd->oobsize < ((ecc->bytes + USER_DATA_SZ) * nsectors)) {\n \t\tret = -EINVAL;\n \t\tgoto err;\n \t}\n@@ -1440,14 +1440,14 @@ static int sunxi_nand_hw_ecc_ctrl_init(struct mtd_info *mtd,\n \t\t\t\tlayout->oobfree[i - 1].offset +\n \t\t\t\tlayout->oobfree[i - 1].length +\n \t\t\t\tecc->bytes;\n-\t\t\tlayout->oobfree[i].length = 4;\n+\t\t\tlayout->oobfree[i].length = USER_DATA_SZ;\n \t\t} else {\n \t\t\t/*\n \t\t\t * The first 2 bytes are used for BB markers, hence we\n-\t\t\t * only have 2 bytes available in the first user data\n-\t\t\t * section.\n+\t\t\t * only have USER_DATA_SZ - 2 bytes available in the\n+\t\t\t * first user data section.\n \t\t\t */\n-\t\t\tlayout->oobfree[i].length = 2;\n+\t\t\tlayout->oobfree[i].length = USER_DATA_SZ - 2;\n \t\t\tlayout->oobfree[i].offset = 2;\n \t\t}\n \n@@ -1457,13 +1457,13 @@ static int sunxi_nand_hw_ecc_ctrl_init(struct mtd_info *mtd,\n \t\t\t\t\tlayout->oobfree[i].length + j;\n \t}\n \n-\tif (mtd->oobsize > (ecc->bytes + 4) * nsectors) {\n+\tif (mtd->oobsize > (ecc->bytes + USER_DATA_SZ) * nsectors) {\n \t\tlayout->oobfree[nsectors].offset =\n \t\t\t\tlayout->oobfree[nsectors - 1].offset +\n \t\t\t\tlayout->oobfree[nsectors - 1].length +\n \t\t\t\tecc->bytes;\n \t\tlayout->oobfree[nsectors].length = mtd->oobsize -\n-\t\t\t\t((ecc->bytes + 4) * nsectors);\n+\t\t\t\t((ecc->bytes + USER_DATA_SZ) * nsectors);\n \t}\n \n \treturn 0;\n@@ -1481,7 +1481,7 @@ static int sunxi_nand_hw_syndrome_ecc_ctrl_init(struct mtd_info *mtd,\n \tif (ret)\n \t\treturn ret;\n \n-\tecc->prepad = 4;\n+\tecc->prepad = USER_DATA_SZ;\n \tecc->read_page = sunxi_nfc_hw_syndrome_ecc_read_page;\n \tecc->write_page = sunxi_nfc_hw_syndrome_ecc_write_page;\n \ndiff --git a/drivers/mtd/nand/raw/sunxi_nand.h b/drivers/mtd/nand/raw/sunxi_nand.h\nindex 6ee3ea14ee17..d7a8b3dd40c3 100644\n--- a/drivers/mtd/nand/raw/sunxi_nand.h\n+++ b/drivers/mtd/nand/raw/sunxi_nand.h\n@@ -181,6 +181,9 @@\n \n #define NFC_MAX_CS\t\t7\n \n+/* On A10, the user data length register is 4 bytes */\n+#define USER_DATA_SZ 4\n+\n /*\n  * NAND Controller capabilities structure: stores NAND controller capabilities\n  * for distinction between compatible strings.\ndiff --git a/drivers/mtd/nand/raw/sunxi_nand_spl.c b/drivers/mtd/nand/raw/sunxi_nand_spl.c\nindex 67f7d22ed2c8..3a5271b49c36 100644\n--- a/drivers/mtd/nand/raw/sunxi_nand_spl.c\n+++ b/drivers/mtd/nand/raw/sunxi_nand_spl.c\n@@ -269,6 +269,11 @@ static void sunxi_nfc_set_user_data_len(const struct nfc_config *nfc,\n \twritel_nfc(val, NFC_REG_USER_DATA_LEN(nfc, step));\n }\n \n+/*\n+ * Values in this table are obtained by doing:\n+ * DIV_ROUND_UP(info->ecc_strength * 14, 8) + USER_DATA_SZ\n+ * So it's the number of bytes needed for ECC + user data for one step.\n+ */\n #if defined(CONFIG_MACH_SUN50I_H616) || defined(CONFIG_MACH_SUN50I_H6)\n static const int ecc_bytes[] = {\n \t32, 46, 54, 60, 74, 82, 88, 96, 102, 110, 116, 124, 130, 138, 144\n@@ -338,7 +343,7 @@ static int nand_read_page(const struct nfc_config *conf, u32 offs,\n \t\tnand_change_column(oob_off);\n \n \t\tsunxi_nfc_reset_user_data_len(conf);\n-\t\tsunxi_nfc_set_user_data_len(conf, 4, 0);\n+\t\tsunxi_nfc_set_user_data_len(conf, USER_DATA_SZ, 0);\n \n \t\tnand_exec_cmd(NFC_DATA_TRANS | NFC_ECC_OP);\n \t\t/* Get the ECC status */\n",
    "prefixes": [
        "v2",
        "1/5"
    ]
}