From patchwork Mon Jun 12 15:02:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Jonker X-Patchwork-Id: 13276791 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8D6E3C7EE2E for ; Mon, 12 Jun 2023 15:02:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:References:Cc:To:Subject: From:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=SKDM+FOF9R7/RaxEJ0wKdYhV5uCTZC/aVO4nzYDU5y8=; b=Go1Cab39EeGQta 7VLeQ1927vZrXo1zsFe61fw6JUAaDKPHp7H1lwwf3QNmjFE4NojJEiGD9IDlKjYbqnkhaCzQiD2QE M1Apcs6juWoI48YmJCWCXzW3pIBOdO8fa5UkBxmN2ID1BfOkdqg6F1fGc2+zw0F/lTqaxgfAUX1Xg 7e09JO+luARLHmtIDracgNW/uzKnDq33Hl0lDMMiOHLIFoD0ntbIVRJvpQH2U3ISWj6Xir95HDWXJ CRM6MqJJMd9Rs/DjKvzRPbCY+u1zBEPxzjILbGlZERYvytvHIdu3cr0Iw4gTjozoZTp8uf18fP2jB Kz4rKf+zLL2YYcAF0fmQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q8j4E-004OZa-2d; Mon, 12 Jun 2023 15:02:50 +0000 Received: from mail-lj1-x22f.google.com ([2a00:1450:4864:20::22f]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q8j4A-004OXq-0d; Mon, 12 Jun 2023 15:02:47 +0000 Received: by mail-lj1-x22f.google.com with SMTP id 38308e7fff4ca-2b1adf27823so53113301fa.2; Mon, 12 Jun 2023 08:02:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686582163; x=1689174163; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:from:user-agent:mime-version:date:message-id:from:to :cc:subject:date:message-id:reply-to; bh=vsbB0vH5LsCtdiDXzwFJEcjnZ1bqcJw9xluET8hnyJA=; b=geaq3E+bmBkq6z7kvRXllGNe4ro8ZY2negeHlbij7OD8LDJcNauS8idOAlZ4cheng9 Nx/Afo0cShXI1ObiRE8z3uOjEbhnkYViq+HeeGtERscjnvNGZehHS2ApxhZUoUvoKyu5 IVQC1kTVZgqMsOmO3Lmw8dtkuefsuaERZHR+6wcxdD4Y1AZwxly13rrpRdZC9Lpnr22m MDz9jYciXhhFZ6c6+Gs7lX4JhlVegARLtYXSmBno604MRNBcBQGV0Vaux6WQ9Lr3/ayo 09MT/NlHGenMBJ7KYPbYPpC6Vk+ZPkhNZYL7nlfHSbg6UrgIJ5sUYdoAjq7ep6mBvSzQ niiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686582163; x=1689174163; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:from:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=vsbB0vH5LsCtdiDXzwFJEcjnZ1bqcJw9xluET8hnyJA=; b=HP80EIIrXnqfJ6GZonYYif9Iy+V7cxii0lLBkf11P4wuSUZIz7Xk0CoDlMawvJVeld hsY3mrLE9z1Z63/OLmjraYROu2Lc9L/XxcxDtIIfW2qf0B0Ig7SEgx3LB3jOZ+ytFW7Q 53vAjZ352jOqcWDD94Jzl3u0mi37NZWAyI/eXSIKNNmeKoGSPA/ArYH3sP8C2bfbZdHE d9rEWSn2h7BtCSBrxYRdUs4QrCtfMUoH/+s42vIEhYwg0/OrMOa3BXlHeXtTrW2Yto0h 2NcK2jxSK1y4mLz9n/i47UgZOCyvo++hmdCnBXTAjmbXBRc68++GXskqqvDuoxdS2UTQ ClPg== X-Gm-Message-State: AC+VfDxQNkF/r4MQio5iiKvslXtpHBSTI0bQFoq+nT8Xc7jOcudPlpT3 7goiCmVTMTH1BtYwvKp6ii4= X-Google-Smtp-Source: ACHHUZ6oIv55dIdolZeg9heB91jDSC5+GqANWRfteW66ewwdwraqMlcH+Xy8nktWBYBWwxGOo2lRRw== X-Received: by 2002:a2e:888f:0:b0:29c:921c:4eb0 with SMTP id k15-20020a2e888f000000b0029c921c4eb0mr3450738lji.22.1686582162597; Mon, 12 Jun 2023 08:02:42 -0700 (PDT) Received: from [192.168.2.2] (81-204-249-205.fixed.kpn.net. [81.204.249.205]) by smtp.gmail.com with ESMTPSA id h11-20020a1709063c0b00b0097883000525sm5477783ejg.15.2023.06.12.08.02.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 12 Jun 2023 08:02:41 -0700 (PDT) Message-ID: Date: Mon, 12 Jun 2023 17:02:40 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 From: Johan Jonker Subject: [PATCH v2 1/5] mtd: nand: raw: rockchip-nand-controller: copy hwecc PA data to oob_poi buffer To: miquel.raynal@bootlin.com Cc: richard@nod.at, vigneshr@ti.com, heiko@sntech.de, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, yifeng.zhao@rock-chips.com References: <11e16c3b-6f7b-a6a9-b0ed-b7ac0cd703e3@gmail.com> Content-Language: en-US In-Reply-To: <11e16c3b-6f7b-a6a9-b0ed-b7ac0cd703e3@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230612_080246_231138_67A3168B X-CRM114-Status: GOOD ( 16.37 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org Rockchip boot blocks are written per 4 x 512 byte sectors per page. Each page must have a page address (PA) pointer in OOB to the next page. Pages are written in a pattern depending on the NAND chip ID. This logic used to build a page pattern table is not fully disclosed and is not easy to fit in the MTD framework. The formula in rk_nfc_write_page_hwecc() function is not correct. Make hwecc and raw behavior identical. Generate boot block page address and pattern for hwecc in user space and copy PA data to/from the last 4 bytes in the chip->oob_poi data layout. Signed-off-by: Johan Jonker --- .../mtd/nand/raw/rockchip-nand-controller.c | 34 ++++++++++++------- 1 file changed, 21 insertions(+), 13 deletions(-) -- 2.30.2 diff --git a/drivers/mtd/nand/raw/rockchip-nand-controller.c b/drivers/mtd/nand/raw/rockchip-nand-controller.c index 2312e2736..cafccc324 100644 --- a/drivers/mtd/nand/raw/rockchip-nand-controller.c +++ b/drivers/mtd/nand/raw/rockchip-nand-controller.c @@ -597,7 +597,7 @@ static int rk_nfc_write_page_hwecc(struct nand_chip *chip, const u8 *buf, int pages_per_blk = mtd->erasesize / mtd->writesize; int ret = 0, i, boot_rom_mode = 0; dma_addr_t dma_data, dma_oob; - u32 reg; + u32 tmp; u8 *oob; nand_prog_page_begin_op(chip, page, 0, NULL, 0); @@ -624,6 +624,13 @@ static int rk_nfc_write_page_hwecc(struct nand_chip *chip, const u8 *buf, * * 0xFF 0xFF 0xFF 0xFF | BBM OOB1 OOB2 OOB3 | ... * + * The code here just swaps the first 4 bytes with the last + * 4 bytes without losing any data. + * + * The chip->oob_poi data layout: + * + * BBM OOB1 OOB2 OOB3 |......| PA0 PA1 PA2 PA3 + * * Configure the ECC algorithm supported by the boot ROM. */ if ((page < (pages_per_blk * rknand->boot_blks)) && @@ -634,21 +641,17 @@ static int rk_nfc_write_page_hwecc(struct nand_chip *chip, const u8 *buf, } for (i = 0; i < ecc->steps; i++) { - if (!i) { - reg = 0xFFFFFFFF; - } else { + if (!i) + oob = chip->oob_poi + (ecc->steps - 1) * NFC_SYS_DATA_SIZE; + else oob = chip->oob_poi + (i - 1) * NFC_SYS_DATA_SIZE; - reg = oob[0] | oob[1] << 8 | oob[2] << 16 | - oob[3] << 24; - } - if (!i && boot_rom_mode) - reg = (page & (pages_per_blk - 1)) * 4; + tmp = oob[0] | oob[1] << 8 | oob[2] << 16 | oob[3] << 24; if (nfc->cfg->type == NFC_V9) - nfc->oob_buf[i] = reg; + nfc->oob_buf[i] = tmp; else - nfc->oob_buf[i * (oob_step / 4)] = reg; + nfc->oob_buf[i * (oob_step / 4)] = tmp; } dma_data = dma_map_single(nfc->dev, (void *)nfc->page_buf, @@ -811,12 +814,17 @@ static int rk_nfc_read_page_hwecc(struct nand_chip *chip, u8 *buf, int oob_on, goto timeout_err; } - for (i = 1; i < ecc->steps; i++) { - oob = chip->oob_poi + (i - 1) * NFC_SYS_DATA_SIZE; + for (i = 0; i < ecc->steps; i++) { + if (!i) + oob = chip->oob_poi + (ecc->steps - 1) * NFC_SYS_DATA_SIZE; + else + oob = chip->oob_poi + (i - 1) * NFC_SYS_DATA_SIZE; + if (nfc->cfg->type == NFC_V9) tmp = nfc->oob_buf[i]; else tmp = nfc->oob_buf[i * (oob_step / 4)]; + *oob++ = (u8)tmp; *oob++ = (u8)(tmp >> 8); *oob++ = (u8)(tmp >> 16); From patchwork Mon Jun 12 15:02:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Jonker X-Patchwork-Id: 13276792 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F3FFDC7EE2F for ; Mon, 12 Jun 2023 15:03:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:References:Cc:To:Subject: From:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Q+hWQhUlOpASar/qXBdnuDUKxe+JTWBJJyvzUEpftYM=; b=C/0Q8RFthiKCGy p5Cu06K6Sc5Ce1aIJlW5IFcGMA0vacAaGRA4dOaVf+BhixAk/I+mAYW9wynM2qbYzV/NI1aD+4vbq KHf1GxLweY1W+Wt+RsBE/vSmjck1F2MNxpYufIECZKAbWr0GpWdgjXFT5xvj6YQRI8KDJQ2JmOzkp 33pahdm418AKO998RbX9TAgJtOJBv/ZeKFjRn7xVaz8S0Rgt99tPSg1SwIQPNS9sDkATTxEsNP5C4 D7DqHl+ZhcAjvRftU/5ZDR4yCb1Gzvady02UUmfOSwe7Ljm5UO56SAd9DP8F6+xlgZCAxM260X99l ws0To/gX9XQiw86cn+Fg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q8j4X-004Ofw-08; Mon, 12 Jun 2023 15:03:09 +0000 Received: from mail-lf1-x12a.google.com ([2a00:1450:4864:20::12a]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q8j4T-004OcP-02; Mon, 12 Jun 2023 15:03:06 +0000 Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-4f004cc54f4so5273323e87.3; Mon, 12 Jun 2023 08:03:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686582181; x=1689174181; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:from:user-agent:mime-version:date:message-id:from:to :cc:subject:date:message-id:reply-to; bh=5jdo+u3pfToMD+E2Ff5G6AtrFm+z8Xryt182/z7nGO8=; b=JyOlQBn4VhrhzWei2zg2S52R+Rlo+nZqzmYM/zIbhFBj6NeW/Yjxqg29rXgAVrJw0f /Muk0xDIqzCaxBJ7X/0WiZo92Oswu7wHpjWO/XuoQIN6CYq0adNIhywip16Em6W+K6oC bq2/pU186AY8+6GtYdMBeKT1qCB4yVOsG/1CQhAI39745AN8o2Ju03Ta+/oCGc906TVn qJZf77w+m21RO8JeJISvjRgBv/y0rl232sVwiBZJVboD4MM/VE7VaaSfHEinEBaUYzyl X/GcyxZgI7T1t1j9Xz/qzWVL/pQLOf99RJujvqWJrq3V2JZCZdhcJt3mYoWGNx+T6MAx mHSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686582181; x=1689174181; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:from:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=5jdo+u3pfToMD+E2Ff5G6AtrFm+z8Xryt182/z7nGO8=; b=XVtinMivXC+MWYzMIr8IxwhR1/L3czUUKrgnFLhgK2a0B3+kxbbp1m02uc2lQ677j0 gvHbFEbITWiyggsVuHGcgA6dnVeySGd/VVVe+PSu1fNLsoAQ7Adox3tKkrKQpCqZqFNS D941uZ0zowgfdIAuEkK1qhioGGTmTwPQkplfrdtyQCs8EbyTB7SJml5qaN9BG3lBIBfC kyemnAotXUqGwoNtgRsMf8VCeSy/wpyFmP94v92L5UaZbZq/rv/ucyrPM7OFwaJZGq3G 0u8im1hDgp7pRwwFXuxUMooccnz/UeWGBqqz+yG7eWKhJMLt2sHto0x1vq+DLrkjvkt+ y9Jw== X-Gm-Message-State: AC+VfDxGhI2yFdLePtB9JrTNDkaTrea0+N+F3GdUjHVd9477HBKbEAvt KqU5IKlMTR95lcIRCcZ1P0U= X-Google-Smtp-Source: ACHHUZ7pmGgzXBo31dNj2E6xdZJooe3qMUN1YeT87gDyJtu0kPG3ksApUsSATeC0JkKcFG8T5PGm/g== X-Received: by 2002:ac2:5b5d:0:b0:4f4:c6ab:f119 with SMTP id i29-20020ac25b5d000000b004f4c6abf119mr4150322lfp.64.1686582180763; Mon, 12 Jun 2023 08:03:00 -0700 (PDT) Received: from [192.168.2.2] (81-204-249-205.fixed.kpn.net. [81.204.249.205]) by smtp.gmail.com with ESMTPSA id p4-20020a05640210c400b005158563be4asm5184499edu.33.2023.06.12.08.02.59 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 12 Jun 2023 08:03:00 -0700 (PDT) Message-ID: Date: Mon, 12 Jun 2023 17:02:59 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 From: Johan Jonker Subject: [PATCH v2 2/5] mtd: nand: raw: rockchip-nand-controller: add skipbbt option To: miquel.raynal@bootlin.com Cc: richard@nod.at, vigneshr@ti.com, heiko@sntech.de, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, yifeng.zhao@rock-chips.com References: <11e16c3b-6f7b-a6a9-b0ed-b7ac0cd703e3@gmail.com> Content-Language: en-US In-Reply-To: <11e16c3b-6f7b-a6a9-b0ed-b7ac0cd703e3@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230612_080305_051047_00348E0D X-CRM114-Status: GOOD ( 10.95 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org On Rockchip SoCs the first boot stages are written on NAND with help of manufacturer software that uses a different format then the MTD framework. Skip the automatic BBT scan with the NAND_SKIP_BBTSCAN option so that the original content is unchanged during the driver probe. The NAND_NO_BBM_QUIRK option allows us to erase bad blocks with the nand_erase_nand() function and the flash_erase command. With these options the user has the "freedom of choice" by neutral access mode to read and write in whatever format is needed. Signed-off-by: Johan Jonker --- Changed V2: reword --- drivers/mtd/nand/raw/rockchip-nand-controller.c | 7 +++++++ 1 file changed, 7 insertions(+) -- 2.30.2 diff --git a/drivers/mtd/nand/raw/rockchip-nand-controller.c b/drivers/mtd/nand/raw/rockchip-nand-controller.c index cafccc324..31d8c7a87 100644 --- a/drivers/mtd/nand/raw/rockchip-nand-controller.c +++ b/drivers/mtd/nand/raw/rockchip-nand-controller.c @@ -188,6 +188,10 @@ struct rk_nfc { unsigned long assigned_cs; }; +static int skipbbt; +module_param(skipbbt, int, 0644); +MODULE_PARM_DESC(skipbbt, "Skip BBT scan if data on the NAND chip is not in MTD format."); + static inline struct rk_nfc_nand_chip *rk_nfc_to_rknand(struct nand_chip *chip) { return container_of(chip, struct rk_nfc_nand_chip, chip); @@ -1156,6 +1160,9 @@ static int rk_nfc_nand_chip_init(struct device *dev, struct rk_nfc *nfc, nand_set_controller_data(chip, nfc); + if (skipbbt) + chip->options |= NAND_SKIP_BBTSCAN | NAND_NO_BBM_QUIRK; + chip->options |= NAND_USES_DMA | NAND_NO_SUBPAGE_WRITE; chip->bbt_options = NAND_BBT_USE_FLASH | NAND_BBT_NO_OOB; From patchwork Mon Jun 12 15:03:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Jonker X-Patchwork-Id: 13276793 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C7AE7C88CB4 for ; Mon, 12 Jun 2023 15:03:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:References:Cc:To:Subject: From:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=nCPz+Zn8t9ibTBHBtSBqAU0PKfwP/XYhEsDq8nSr/dY=; b=Wqw2nJHVOT56wH JUs02qqh1yZ9smBO+sNtJGYPhAh/sgVlEkegw/DqW2Adi8FsJhgoScpdsSLfnaNqmGsTNOWCNrNLN 1+ujxNIq+ZYzx1oLsRPQ/FoKyA7Y5tq4LEnMhcgV90wVIUBw8qviTExIyNHG0OJUkWCOoxKVxsiFU g1MZ+RRdP88Zc9Tj3eFaoe7F4sfIFtbOzTCP0AEjz16uoE1xJRD8cHvMAJq4Gdpw4+ifSrYJbZ/X+ yb3TL4w5UJV8F/kiyoUo3da/qGsBP8fe4TG9bveYOXOG1qDeUo5+Kq7FdWVj5/cfKtxPG3/qvlMjI jJoQ+Wkkj04PF2SwUAHA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q8j4p-004Opo-2i; Mon, 12 Jun 2023 15:03:27 +0000 Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q8j4l-004OmH-33; Mon, 12 Jun 2023 15:03:25 +0000 Received: by mail-ej1-x635.google.com with SMTP id a640c23a62f3a-9786fc23505so656880066b.2; Mon, 12 Jun 2023 08:03:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686582200; x=1689174200; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:from:user-agent:mime-version:date:message-id:from:to :cc:subject:date:message-id:reply-to; bh=C6UuLqkfXOKHkrI1ad2tdmANY5TMlVXBKHyBVpKDDNs=; b=fQoS3tSGn8MnsOHfhsD6U5U64Fu3Nmsz50Zwg30oq03i6E9Ezn91hqw2g7JpPIfkYa eMxsDjRIBq9G0jJGBcWaDnePtVmfbNPUTYXkxtjP670BBPDpCwJOCK3L/KPB4zt36UjW kdt6PlviG3u9oMqOmGxqCLIMkk1SKvUtpzyC+hd9ztU8insHBNXyIOokRBp0ctanexIY NJp9NQSsohcxBpxh49DM4vi0azYuVugTJ838AKT94gn1TeK2cUx1267WJIPahLF1PDIo F5UQNY4dJJR83Egpjg+3rjY6RUlKmsbFha9n3Bejl45Oi6Vq1kE4K81JkzKG5nkdhNwm P2ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686582200; x=1689174200; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:from:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=C6UuLqkfXOKHkrI1ad2tdmANY5TMlVXBKHyBVpKDDNs=; b=P8pgfPGctMhQTskCSWNRkRwMQgxJoK+VpH001QOZGlW1+VG9ObzN3D+615HmfqfOGV tx/Yah4IcGLFm3oPIgfNLzMN/FUNumR2SwIiglpKjXaLp6qNwGuNfixEyXRjS1RgeOcj XE4g7ogjd7NMTkzrHeX6TvGUiVKZpj0uuM4LXHiQli4HwM0bFqFHcbeRSaiLHVE4yj2W z0Sd4Hud7tj+KOjVi2+p4SkzaG9pk+kybFyMIHTYkGmxdnmw/MlHRe+9m2fkiyZB5lGi kPdM+uedcmobJencTr1d4pC+WfBubt85o9xlWsOKkzcTDYxgygsMlyUdxcsku16wJ333 8Y/Q== X-Gm-Message-State: AC+VfDwS+13JDXWbBMROEkbne6/lUG9lBB7ikTb+u3t82Ual1/0U7XSX DdB51aZL4EGr/Q/pZemOm1Q= X-Google-Smtp-Source: ACHHUZ4K+07M7JwoUNnwyZygd7mJqgEw47AtVBH7IL8iAes/yi0KtHWRtUq/gJqHa6/nh/N6rjJouQ== X-Received: by 2002:a17:907:3603:b0:96a:19d8:f082 with SMTP id bk3-20020a170907360300b0096a19d8f082mr9821093ejc.25.1686582199969; Mon, 12 Jun 2023 08:03:19 -0700 (PDT) Received: from [192.168.2.2] (81-204-249-205.fixed.kpn.net. [81.204.249.205]) by smtp.gmail.com with ESMTPSA id k14-20020a1709061c0e00b0096f6e2f4d9esm5264570ejg.83.2023.06.12.08.03.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 12 Jun 2023 08:03:19 -0700 (PDT) Message-ID: Date: Mon, 12 Jun 2023 17:03:18 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 From: Johan Jonker Subject: [PATCH v2 3/5] mtd: nand: raw: rockchip-nand-controller: fix oobfree offset and description To: miquel.raynal@bootlin.com Cc: richard@nod.at, vigneshr@ti.com, heiko@sntech.de, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, yifeng.zhao@rock-chips.com References: <11e16c3b-6f7b-a6a9-b0ed-b7ac0cd703e3@gmail.com> Content-Language: en-US In-Reply-To: <11e16c3b-6f7b-a6a9-b0ed-b7ac0cd703e3@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230612_080323_982323_ABDAACF5 X-CRM114-Status: GOOD ( 15.61 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org The MTD framework reserves 1 or 2 bytes for the bad block marker depending on the bus size. The rockchip-nand-controller driver currently only supports a 8 bit bus, but reserves standard 2 bytes for the BBM. The first free OOB byte is therefore OOB2 at offset 2. Page address(PA) bytes are moved to the last 4 positions before ECC. Update the description for Linux. Signed-off-by: Johan Jonker --- drivers/mtd/nand/raw/rockchip-nand-controller.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) -- 2.30.2 diff --git a/drivers/mtd/nand/raw/rockchip-nand-controller.c b/drivers/mtd/nand/raw/rockchip-nand-controller.c index 31d8c7a87..fcda4c760 100644 --- a/drivers/mtd/nand/raw/rockchip-nand-controller.c +++ b/drivers/mtd/nand/raw/rockchip-nand-controller.c @@ -566,9 +566,10 @@ static int rk_nfc_write_page_raw(struct nand_chip *chip, const u8 *buf, * BBM OOB1 OOB2 OOB3 |......| PA0 PA1 PA2 PA3 * * The rk_nfc_ooblayout_free() function already has reserved - * these 4 bytes with: + * these 4 bytes together with 2 bytes for BBM + * by reducing it's length: * - * oob_region->offset = NFC_SYS_DATA_SIZE + 2; + * oob_region->length = rknand->metadata_size - NFC_SYS_DATA_SIZE - 2; */ if (!i) memcpy(rk_nfc_oob_ptr(chip, i), @@ -945,12 +946,8 @@ static int rk_nfc_ooblayout_free(struct mtd_info *mtd, int section, if (section) return -ERANGE; - /* - * The beginning of the OOB area stores the reserved data for the NFC, - * the size of the reserved data is NFC_SYS_DATA_SIZE bytes. - */ oob_region->length = rknand->metadata_size - NFC_SYS_DATA_SIZE - 2; - oob_region->offset = NFC_SYS_DATA_SIZE + 2; + oob_region->offset = 2; return 0; } From patchwork Mon Jun 12 15:03:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Jonker X-Patchwork-Id: 13276794 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 13D60C7EE2E for ; Mon, 12 Jun 2023 15:03:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:References:Cc:To:Subject: From:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=a39ebB2W4GNfeXpLu3QKcBmD9w5zc2kDWi0AcZnLvLU=; b=3GNj9jjKviSktM Qg4R1pg+Vao/BAZmidh/Zmb6vvrTWVBsoGgDBEJqh84fBoi9eVNWavNdyaszikCBDhaHHeHUdItKs oVzR7oyLO7ngBFcL/kQyINrZ4o4aeBwubjW1XiPy/pCGNzBv+4udVrfEmijsixN66NGKFfjOC238N EFxDw05g1FRYhHA4fHM6JzLwV6XQfCVaD5mWzTPfAsimmzJ1khwJqBEMtOzYrNyPLTngRA4S6E3iu kiLRNjc1hP7WJYOX5gM4MnByiv3lnBmjJ8sh8dnNAMiyqF5mAmnPXfqc07fZedJENYQ0/pic80ywa J9IWrI1s1Bkp14JDrYdQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q8j57-004P32-1q; Mon, 12 Jun 2023 15:03:45 +0000 Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q8j51-004OwZ-2T; Mon, 12 Jun 2023 15:03:41 +0000 Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-5149e65c244so6215586a12.3; Mon, 12 Jun 2023 08:03:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686582217; x=1689174217; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:from:user-agent:mime-version:date:message-id:from:to :cc:subject:date:message-id:reply-to; bh=3hduzuBSaxb22Mp/MQNps6D7J398rtVmcYbSbMQMqAA=; b=HZE9ePUeklvDjtpKtqnpLU8kERqxtrhLujkNuviMPAZFzdqmLPnnCpV1xlQ9EVPlXf PKZSesP0sKydEdNv6wGB+Ie4WoJRqF11sSX1En2KgXThWdt+9wyOoiaT+lqlcT0iMAnh e8Jj26C3s1nB3+JTDTuPyuymr3YxsKiLp7B5MNoZ+GfdAhG52TG6zSeR8Rmis90/jE/g jb42By6+iJymx0yBgXE7xa08LuLMnKnLguCQ5NDozgQiTsiwH+N5HoPUcJDulP1PZa1D WCIrRh5xLqWjdgfn5BWCYTIbQ/Qzt7+0TXcWZn0TaRrGszi2wVO0B9i95DNip++shVNN moQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686582217; x=1689174217; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:from:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=3hduzuBSaxb22Mp/MQNps6D7J398rtVmcYbSbMQMqAA=; b=FDZnmNUZQpnZeFxmShujhNRyDbp6PpxF1qOEnYpFMCDNQrJ2H7ptOi6GnjS8gB2eQN WlfFPcvi76S5SVz1C5DuH4+I+S1RLc+72l1dGjCrAJsyD7WEiQYxY32GztNoQ2kSHNMy AfDrVnkjdIQgmkIaYH6i2kKut1TQTaIUwfZrwdrV4U3drYnZtUwuhUD7aiflSMx+HvtF 7+A9H5rIsHfV+Vn0dvdDOXOpm9FQdMHIKwjLAAy32HNBS4oH3w88TjCpTs/mwohkpLFY yPthb2sQSaK8wnGhQQ4ppUn+5BTmOtFrw18hvkXZUuO+W29+ZkfuduiLIWIOnZZRcqfW DUgw== X-Gm-Message-State: AC+VfDwDG+CYFi1Lqnh7dUapy0BqBtJlhgxfqCvYyQprTbs7JpPlyKVD NACqh8cIkHF29T3pA5ngPrA= X-Google-Smtp-Source: ACHHUZ6fqgTKr/hRQnzqwp3paah/caYkP5AtFmnGC+A7mYwkejgfibrJFYryYqFC788qdUmdp0M56Q== X-Received: by 2002:a05:6402:8c1:b0:514:9e07:f33f with SMTP id d1-20020a05640208c100b005149e07f33fmr4779364edz.20.1686582216923; Mon, 12 Jun 2023 08:03:36 -0700 (PDT) Received: from [192.168.2.2] (81-204-249-205.fixed.kpn.net. [81.204.249.205]) by smtp.gmail.com with ESMTPSA id c13-20020aa7c74d000000b0051823c1a10bsm3454421eds.54.2023.06.12.08.03.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 12 Jun 2023 08:03:36 -0700 (PDT) Message-ID: <86aaf385-3c0a-21d9-46fe-f84ee26efbc6@gmail.com> Date: Mon, 12 Jun 2023 17:03:35 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 From: Johan Jonker Subject: [PATCH v2 4/5] mtd: nand: raw: add basic sandisk manufacturer ops To: miquel.raynal@bootlin.com Cc: richard@nod.at, vigneshr@ti.com, heiko@sntech.de, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, yifeng.zhao@rock-chips.com References: <11e16c3b-6f7b-a6a9-b0ed-b7ac0cd703e3@gmail.com> Content-Language: en-US In-Reply-To: <11e16c3b-6f7b-a6a9-b0ed-b7ac0cd703e3@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230612_080339_813140_DA85FB4A X-CRM114-Status: GOOD ( 14.37 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org Add basic Sandisk manufacturer ops support to get SDTNQGAMA timing data with the nand_get_sdr_timings() function. Signed-off-by: Johan Jonker --- Limited to one chip model for now. In need for someone with better knowledge of the Sandisk product range to expand and improve. Documentation is rare to find. --- drivers/mtd/nand/raw/Makefile | 1 + drivers/mtd/nand/raw/internals.h | 1 + drivers/mtd/nand/raw/nand_ids.c | 2 +- drivers/mtd/nand/raw/nand_sandisk.c | 26 ++++++++++++++++++++++++++ 4 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 drivers/mtd/nand/raw/nand_sandisk.c -- 2.30.2 diff --git a/drivers/mtd/nand/raw/Makefile b/drivers/mtd/nand/raw/Makefile index 917cdfb81..d93e861d8 100644 --- a/drivers/mtd/nand/raw/Makefile +++ b/drivers/mtd/nand/raw/Makefile @@ -67,5 +67,6 @@ nand-objs += nand_esmt.o nand-objs += nand_hynix.o nand-objs += nand_macronix.o nand-objs += nand_micron.o +nand-objs += nand_sandisk.o nand-objs += nand_samsung.o nand-objs += nand_toshiba.o diff --git a/drivers/mtd/nand/raw/internals.h b/drivers/mtd/nand/raw/internals.h index 7016e0f38..e9932da18 100644 --- a/drivers/mtd/nand/raw/internals.h +++ b/drivers/mtd/nand/raw/internals.h @@ -73,6 +73,7 @@ extern const struct nand_manufacturer_ops hynix_nand_manuf_ops; extern const struct nand_manufacturer_ops macronix_nand_manuf_ops; extern const struct nand_manufacturer_ops micron_nand_manuf_ops; extern const struct nand_manufacturer_ops samsung_nand_manuf_ops; +extern const struct nand_manufacturer_ops sandisk_nand_manuf_ops; extern const struct nand_manufacturer_ops toshiba_nand_manuf_ops; /* MLC pairing schemes */ diff --git a/drivers/mtd/nand/raw/nand_ids.c b/drivers/mtd/nand/raw/nand_ids.c index dacc5529b..1a89ed796 100644 --- a/drivers/mtd/nand/raw/nand_ids.c +++ b/drivers/mtd/nand/raw/nand_ids.c @@ -188,7 +188,7 @@ static const struct nand_manufacturer_desc nand_manufacturer_descs[] = { {NAND_MFR_NATIONAL, "National"}, {NAND_MFR_RENESAS, "Renesas"}, {NAND_MFR_SAMSUNG, "Samsung", &samsung_nand_manuf_ops}, - {NAND_MFR_SANDISK, "SanDisk"}, + {NAND_MFR_SANDISK, "SanDisk", &sandisk_nand_manuf_ops}, {NAND_MFR_STMICRO, "ST Micro"}, {NAND_MFR_TOSHIBA, "Toshiba", &toshiba_nand_manuf_ops}, {NAND_MFR_WINBOND, "Winbond"}, diff --git a/drivers/mtd/nand/raw/nand_sandisk.c b/drivers/mtd/nand/raw/nand_sandisk.c new file mode 100644 index 000000000..7c66e4187 --- /dev/null +++ b/drivers/mtd/nand/raw/nand_sandisk.c @@ -0,0 +1,26 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "internals.h" + +static int +sdtnqgama_choose_interface_config(struct nand_chip *chip, + struct nand_interface_config *iface) +{ + onfi_fill_interface_config(chip, iface, NAND_SDR_IFACE, 0); + + return nand_choose_best_sdr_timings(chip, iface, NULL); +} + +static int sandisk_nand_init(struct nand_chip *chip) +{ + if (!strncmp("SDTNQGAMA", chip->parameters.model, + sizeof("SDTNQGAMA") - 1)) + chip->ops.choose_interface_config = + &sdtnqgama_choose_interface_config; + + return 0; +} + +const struct nand_manufacturer_ops sandisk_nand_manuf_ops = { + .init = sandisk_nand_init, +}; From patchwork Mon Jun 12 15:03:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Johan Jonker X-Patchwork-Id: 13276795 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 060CFC7EE2E for ; Mon, 12 Jun 2023 15:04:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:References:Cc:To:Subject: From:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=mbD8B0/FkjdmOA400lNzRz7CnveLJaAf3HGorIrCqXY=; b=GU3ivEBlju/Ezv BDG7SEqN5ZqNN2B3f6acWeFHPqO8HN6tAeSOwZLz+3+KH4SAvPyKRMq6xiHrkOEy217Es9QEtoJkz 0rVjSIWyIVsE1/LHz0J8TsAe2oovC2UKSoRQyB3bVATgmuV5A9HTEvpLyQ4QLObro0SzApcQqXVeQ sLi24zEWoc4HqVWWaEDWDyO8knv5RPJQauQawFKtvfDuAm+b4T26p7fWPREXBRSfWMdaCJW12mjzy VqFdlsc0Wb7iIxZbRLVnp1zDeYIkCtSZcqSd1O6JgYUm9etl8GoTN1VXbLs87jyo1ptObHVe6wnpA EbQs1Bj8xeW/8b1akpWg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q8j5M-004PCV-2m; Mon, 12 Jun 2023 15:04:00 +0000 Received: from mail-ej1-x62b.google.com ([2a00:1450:4864:20::62b]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q8j5J-004P8S-15; Mon, 12 Jun 2023 15:03:58 +0000 Received: by mail-ej1-x62b.google.com with SMTP id a640c23a62f3a-9788faaca2dso746879666b.0; Mon, 12 Jun 2023 08:03:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686582233; x=1689174233; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:from:user-agent:mime-version:date:message-id:from:to :cc:subject:date:message-id:reply-to; bh=b5dvgiuwu58z2RBXdkqKsBTMg+eHX490cp2iBeNipXs=; b=oyw5FcG95RMH8gBZPimMuo8K1RUozZQd0fP+vIEKp9XdRHQjIeXucA7M7HcnfFBWeR obL1xrP/WSVuSzcn8sqgEd/DYrTjrYR0xUXJyzZCGoXkekxkkcigqaGYAnGm1+eei7dd 4JVdqYbq56KJ+fxGRK3R00jKH2ShpQRs6CBKpNYFl0pNczf09s1keyYDi9zhuQTRP4kB Yw1W6qDIIu6mABprgil2J7o4dBaxMg+t6YSyDjT+YVwK+mtwSQAse2FajC6VZRWZHKOO Cyldiel5U3c6g3BfT47+swlDyPA7NlC3P5WyZP3wZg8zLkxXtbTQZvOvMiVeHLRdKjCO pZUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686582233; x=1689174233; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:from:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=b5dvgiuwu58z2RBXdkqKsBTMg+eHX490cp2iBeNipXs=; b=kQHmLol7+jowhhEGlO+m4/IzmBd/p70d+9apXHTGVqnRC/svJPlod8LxzGzXe3A4rN ACcOHQnRicv8bu8tcRo4xI4OESCUamH2v3+MFV41o7QWVQvbDrjogD68gCY0WlSxMw55 UFO6nydJflT3THa94jD9Nhyjf84Oxf/6ADGgwWTnBHe8RSPmxpHbe9HA/bddp42DvIkL QKwP71bLCmNTdUvX8nstNhRMqMQvT19fCNW2At6NAxBI1BrLmCInWpUg49BmlJxfZHU1 4wr+iTJ9IiPHJzcjY7F0J3J5CkU9gTkS2u/DteKcS3RacxEElE7vp/U9DGGGy3f1P/yI IUeg== X-Gm-Message-State: AC+VfDzTvZc5Wy4Pxr4ivne8NyXD40qmw7GUxbCzb03FHwa64XColmll CEpdjNZ5A2v65Jgtzz9dlRA= X-Google-Smtp-Source: ACHHUZ6Y8U1kRtrGOzG5Ib4y5z1rRbsqGlhyiWIqgbv1DlOcUMV+/wrK4Syva0l88PDG+OBz0PHfPQ== X-Received: by 2002:a17:907:320e:b0:978:acec:36c0 with SMTP id xg14-20020a170907320e00b00978acec36c0mr9473330ejb.9.1686582233549; Mon, 12 Jun 2023 08:03:53 -0700 (PDT) Received: from [192.168.2.2] (81-204-249-205.fixed.kpn.net. [81.204.249.205]) by smtp.gmail.com with ESMTPSA id o20-20020a170906601400b00977d3fb2a7dsm5298309ejj.76.2023.06.12.08.03.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 12 Jun 2023 08:03:53 -0700 (PDT) Message-ID: <8b5303a0-fb1b-ee05-c2e6-bbd2d9c06cb9@gmail.com> Date: Mon, 12 Jun 2023 17:03:52 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 From: Johan Jonker Subject: [PATCH v2 5/5] mtd: nand: add support for the Sandisk SDTNQGAMA chip To: miquel.raynal@bootlin.com Cc: richard@nod.at, vigneshr@ti.com, heiko@sntech.de, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, yifeng.zhao@rock-chips.com References: <11e16c3b-6f7b-a6a9-b0ed-b7ac0cd703e3@gmail.com> Content-Language: en-US In-Reply-To: <11e16c3b-6f7b-a6a9-b0ed-b7ac0cd703e3@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230612_080357_384845_F0023859 X-CRM114-Status: UNSURE ( 9.08 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org Sandisk SDTNQGAMA is a 8GB size, 3.3V 8 bit chip with 16KB page size, 1KB write size and 40 bit ecc support Co-developed-by: Paweł Jarosz Signed-off-by: Paweł Jarosz Signed-off-by: Johan Jonker --- drivers/mtd/nand/raw/nand_ids.c | 3 +++ 1 file changed, 3 insertions(+) -- 2.30.2 diff --git a/drivers/mtd/nand/raw/nand_ids.c b/drivers/mtd/nand/raw/nand_ids.c index 1a89ed796..650351c62 100644 --- a/drivers/mtd/nand/raw/nand_ids.c +++ b/drivers/mtd/nand/raw/nand_ids.c @@ -44,6 +44,9 @@ struct nand_flash_dev nand_flash_ids[] = { {"TC58NVG6D2 64G 3.3V 8-bit", { .id = {0x98, 0xde, 0x94, 0x82, 0x76, 0x56, 0x04, 0x20} }, SZ_8K, SZ_8K, SZ_2M, 0, 8, 640, NAND_ECC_INFO(40, SZ_1K) }, + {"SDTNQGAMA 64G 3.3V 8-bit", + { .id = {0x45, 0xde, 0x94, 0x93, 0x76, 0x57} }, + SZ_16K, SZ_8K, SZ_4M, 0, 6, 1280, NAND_ECC_INFO(40, SZ_1K) }, {"SDTNRGAMA 64G 3.3V 8-bit", { .id = {0x45, 0xde, 0x94, 0x93, 0x76, 0x50} }, SZ_16K, SZ_8K, SZ_4M, 0, 6, 1280, NAND_ECC_INFO(40, SZ_1K) },