From patchwork Thu Feb 6 20:22:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shivamurthy Shastri X-Patchwork-Id: 1234559 X-Patchwork-Delegate: miquel.raynal@bootlin.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20170209 header.b=mWty9cG+; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=GS9dN4t3; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48D90C3jyMz9sRK for ; Fri, 7 Feb 2020 07:24:59 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=ccxKiE2jqAoxnz7SglgTy/jRb5Ldd8HdgCUiOxQO8cM=; b=mWty9cG+1gKWTHgvpvc5ZvmDhv tiOPQJJ+vPC+GBJ6h6Gvxtzyji17sI2nbhJ7PJIK6LuEn6eG5X5jAuy2v2XlIGe4DJn1QI6HBy3qu 9XC5R3mgrtGlmrHEOmj/apy02TgGGRdfkBjoCW/esZYp9U0RmvWR3U7ozM4pzpyiOq45E6NLPMwoe JRiET4bhAmGe0fGffD7IgO0kfp4LH58fVhkMVQyE0DF68ZXLC+aG0dL20Nk4dZMZrla1dI/VZoeX3 Xd1rkXsMIQNfWkeTC2HZ/cqB6AggykoCFx6xG5SCBS9dSEd7ZUrdSPb4dtMPCE7MSbv12212SwrRO fzg/IJAw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iznhU-0006r8-LJ; Thu, 06 Feb 2020 20:24:36 +0000 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iznhP-0006fo-DU for linux-mtd@lists.infradead.org; Thu, 06 Feb 2020 20:24:32 +0000 Received: by mail-wr1-x441.google.com with SMTP id c9so8676480wrw.8 for ; Thu, 06 Feb 2020 12:24:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Vcj3e9+EJ4WNrgAbdDvcbbbPfC25UIBCN5ll5T2N4bs=; b=GS9dN4t3AWNdhQsrw7lNOfrPTeUpGVVfpKTXZ5Tr37i2IJdDwWfLfXmUMXLxJEBMtA 1QsVckviqL47iHxcjHK6JGNZL3YRxg41jaeytjeysnnrzszWLS4387t5KFSoLbE2nldH L0J7a7YMHM7eAt0gQh9XJEX7cPIr67yyBemihzHrpngXf9dA1njqmZQS2HS70/at/lRR GuA67WgmfLTA7rjCiwIe+lz5+HjKDlhq8baVhgNL1ebQKkpMVsAjWiYeNala1uz67WBs Ca1ZOWcauhW8XVlfYUysjP/q2za9edtKPvLdxVI60Izi6CPGhEUtNKcrzCDPLUKTjz5w 6vIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Vcj3e9+EJ4WNrgAbdDvcbbbPfC25UIBCN5ll5T2N4bs=; b=UQUobfn6T6RANUwNzkQU+r2/bTjCKp522fKpyFfFuYaDJI2AcqPShMNlhdBwzlbvPD sZo5LbL19j3c4VgmPTelYUMqDcyPpBhJF4Ew7WxHB+2k1v21GEncE+gKupe7I6MLAEDy JrVD6nNz/GjfIXtjJdgFYgGCY0Ecj+RqygcFTJfC8rqIJL7O1KDO+b47zn+Hg46qCowL 2jAfVJXz426kjGmFcUbuuJCsQ/81zxZg/2kAb4A40EDDQc+TkBD4yFMpmIF98TqmNFCd aro+/3daFys5IeYXvndY8QAmIZAeIdxmlDhiCvAC4EdUdXHLj5fnzfh+2G1G0MsIX8G/ th/A== X-Gm-Message-State: APjAAAUVTJh2kN4FjVzYuyCoPuHbQt67aQD/A/a6QoOTHx1eqXrWyNAN 4Gd+H373bVlA7y0nw0Su484= X-Google-Smtp-Source: APXvYqzPoHoZWjpqE5sSi/BYrIxB0T/cfaytBUDaq+eKbJVaq3F1f8ubDSgDWcw3PrZrGwAjO6cyyA== X-Received: by 2002:adf:db48:: with SMTP id f8mr5266232wrj.146.1581020669767; Thu, 06 Feb 2020 12:24:29 -0800 (PST) Received: from opensdev.fritz.box (business-178-015-117-054.static.arcor-ip.net. [178.15.117.54]) by smtp.gmail.com with ESMTPSA id c13sm539929wrx.9.2020.02.06.12.24.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Feb 2020 12:24:29 -0800 (PST) From: shiva.linuxworks@gmail.com X-Google-Original-From: sshivamurthy@micron.com To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Frieder Schrempf , Boris Brezillon , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 1/5] mtd: spinand: micron: Generalize the OOB layout structure and function names Date: Thu, 6 Feb 2020 21:22:02 +0100 Message-Id: <20200206202206.14770-2-sshivamurthy@micron.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200206202206.14770-1-sshivamurthy@micron.com> References: <20200206202206.14770-1-sshivamurthy@micron.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200206_122431_483404_90D40BCA X-CRM114-Status: GOOD ( 11.17 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:441 listed in] [list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [shiva.linuxworks[at]gmail.com] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Shivamurthy Shastri MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Shivamurthy Shastri In order to add new Micron SPI NAND devices, we generalized the OOB layout structure and function names. Signed-off-by: Shivamurthy Shastri Reviewed-by: Boris Brezillon --- drivers/mtd/nand/spi/micron.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/mtd/nand/spi/micron.c b/drivers/mtd/nand/spi/micron.c index 7d7b1f7fcf71..c028d0d7e236 100644 --- a/drivers/mtd/nand/spi/micron.c +++ b/drivers/mtd/nand/spi/micron.c @@ -34,38 +34,38 @@ static SPINAND_OP_VARIANTS(update_cache_variants, SPINAND_PROG_LOAD_X4(false, 0, NULL, 0), SPINAND_PROG_LOAD(false, 0, NULL, 0)); -static int mt29f2g01abagd_ooblayout_ecc(struct mtd_info *mtd, int section, - struct mtd_oob_region *region) +static int micron_8_ooblayout_ecc(struct mtd_info *mtd, int section, + struct mtd_oob_region *region) { if (section) return -ERANGE; - region->offset = 64; - region->length = 64; + region->offset = mtd->oobsize / 2; + region->length = mtd->oobsize / 2; return 0; } -static int mt29f2g01abagd_ooblayout_free(struct mtd_info *mtd, int section, - struct mtd_oob_region *region) +static int micron_8_ooblayout_free(struct mtd_info *mtd, int section, + struct mtd_oob_region *region) { if (section) return -ERANGE; /* Reserve 2 bytes for the BBM. */ region->offset = 2; - region->length = 62; + region->length = (mtd->oobsize / 2) - 2; return 0; } -static const struct mtd_ooblayout_ops mt29f2g01abagd_ooblayout = { - .ecc = mt29f2g01abagd_ooblayout_ecc, - .free = mt29f2g01abagd_ooblayout_free, +static const struct mtd_ooblayout_ops micron_8_ooblayout = { + .ecc = micron_8_ooblayout_ecc, + .free = micron_8_ooblayout_free, }; -static int mt29f2g01abagd_ecc_get_status(struct spinand_device *spinand, - u8 status) +static int micron_8_ecc_get_status(struct spinand_device *spinand, + u8 status) { switch (status & MICRON_STATUS_ECC_MASK) { case STATUS_ECC_NO_BITFLIPS: @@ -98,8 +98,8 @@ static const struct spinand_info micron_spinand_table[] = { &write_cache_variants, &update_cache_variants), 0, - SPINAND_ECCINFO(&mt29f2g01abagd_ooblayout, - mt29f2g01abagd_ecc_get_status)), + SPINAND_ECCINFO(µn_8_ooblayout, + micron_8_ecc_get_status)), }; static int micron_spinand_detect(struct spinand_device *spinand) From patchwork Thu Feb 6 20:22:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shivamurthy Shastri X-Patchwork-Id: 1234560 X-Patchwork-Delegate: miquel.raynal@bootlin.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20170209 header.b=D40xcngb; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=CeYNlxjz; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48D90Q39yTz9sRK for ; Fri, 7 Feb 2020 07:25:10 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=/oeQOCUR3H7PryJqMJXjxY/f7aBXxkeparTVfip1tbQ=; b=D40xcngbS/YSAwEDaxog2SATmj Bows+s3dp2LJTF5Yn41ARtX1F6vKkgghbimrnQX4Yku+iT6/LiUl0YXeYbV7bq1ETyHYaNB/oLwQT Vz0/q9h9nxjiYuPZsF8HL1telgK46hwtMPMQx+hMlZ04HKY0qXXq8GUJjbhfS2pIGvHN2peIb99xs hIE46b+BaiT5IPzr6dGdk5sgthyYxJRgU6qfVjACT/OAYoZvo3k6+nDgKeQwmwFKvZ9hrvIT4eRFH zyEtv9g00U3Dgrs06oFjL4qDCeDu30cVnRkLSO08Ewlt1xvIEmYxA6/fwjwplw6jiPWJDPbK6OFVP VOgYPlSg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iznhl-0007Bc-ST; Thu, 06 Feb 2020 20:24:53 +0000 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iznhS-0006k5-Ux for linux-mtd@lists.infradead.org; Thu, 06 Feb 2020 20:24:36 +0000 Received: by mail-wm1-x341.google.com with SMTP id t23so267133wmi.1 for ; Thu, 06 Feb 2020 12:24:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=WK+KzBfTuQqE2Bcx0psUGki6jAtzDkPOrrhY+kNzNrw=; b=CeYNlxjzHtIWZg/vY47dPxarMHCWklh6vMfP//hs7swnQZfcEmSvk7siiadZno6el+ cY92Zqet6v7EfYdQIPJClnI7JqiMm38lY1E/mm/WLEXEIjnvmec4OFfzFG66rRaySZRr LgzRakLQjea3vek1U7u4Lb+YvTh80JeaLtDxMZXFQnqBuDPV6GQCT+IUzRB1YIueKr6b p4WdZ/ESKPVBx93tVok4cW2zrqhfAapALEnSeWgYqYCCo4Lu124nke0C6HtHAs4nqHSL BEex2iyuVCPz1mAg8+6PxuFF/BbJfL68ktSu/TuYYu8NXAqdfZ2ExGRhHbm5dLmfIiur MI1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=WK+KzBfTuQqE2Bcx0psUGki6jAtzDkPOrrhY+kNzNrw=; b=AS2193+ZgWdMZYNEi4wPgwZT3K0gfFLMXp8VjaFIWQ1as+j+kP3Hwyj2VILWwY+AuD S4Ug5b8scDivpDL+/9hi9H1QgUrf8DHnx4ETXKKskODoUEeHOV5qin0ssKzQ9nRCpOC7 2svHmzxJAxa3CmN09hDuEzvQ3oSc56YOFTwEqT55bUfR580U6VrlLCy7Q1mV1s70VL5/ xCV2V/SnPGxSEIVUHmoS+7HTcnHqI3gHCyo1lJlMG2V/fH/c7zwzvTGi9Ji5bCneECtS 7J5W/umFnH3yIqAKAf8/7hmYN/6T0Vx8OQ4x9PUn2XDeRv48xx4WGmb6SV8WhrQ6qf+v sLAw== X-Gm-Message-State: APjAAAXlxuG+suJ1q3vv29eGwdq5LaYiutSxsK8E+PhV9COlrFf5Hvcv 6i3Fab4sJHBiWrlts3W/qiA= X-Google-Smtp-Source: APXvYqwJHnB1/JUbJWR3PS09nalAM3wop5u4zJscsuPs6GYDb2BIyh1yEJhadIt0O2IBggxqTKYnGA== X-Received: by 2002:a1c:4c5:: with SMTP id 188mr6356293wme.82.1581020673255; Thu, 06 Feb 2020 12:24:33 -0800 (PST) Received: from opensdev.fritz.box (business-178-015-117-054.static.arcor-ip.net. [178.15.117.54]) by smtp.gmail.com with ESMTPSA id c13sm539929wrx.9.2020.02.06.12.24.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Feb 2020 12:24:32 -0800 (PST) From: shiva.linuxworks@gmail.com X-Google-Original-From: sshivamurthy@micron.com To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Frieder Schrempf , Boris Brezillon , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 2/5] mtd: spinand: micron: Add new Micron SPI NAND devices Date: Thu, 6 Feb 2020 21:22:03 +0100 Message-Id: <20200206202206.14770-3-sshivamurthy@micron.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200206202206.14770-1-sshivamurthy@micron.com> References: <20200206202206.14770-1-sshivamurthy@micron.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200206_122435_018387_68A9623E X-CRM114-Status: UNSURE ( 9.79 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:341 listed in] [list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [shiva.linuxworks[at]gmail.com] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Shivamurthy Shastri MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Shivamurthy Shastri Add device table for M79A and M78A series Micron SPI NAND devices. Signed-off-by: Shivamurthy Shastri --- drivers/mtd/nand/spi/micron.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/drivers/mtd/nand/spi/micron.c b/drivers/mtd/nand/spi/micron.c index c028d0d7e236..5fd1f921ef12 100644 --- a/drivers/mtd/nand/spi/micron.c +++ b/drivers/mtd/nand/spi/micron.c @@ -91,6 +91,7 @@ static int micron_8_ecc_get_status(struct spinand_device *spinand, } static const struct spinand_info micron_spinand_table[] = { + /* M79A 2Gb 3.3V */ SPINAND_INFO("MT29F2G01ABAGD", 0x24, NAND_MEMORG(1, 2048, 128, 64, 2048, 40, 2, 1, 1), NAND_ECCREQ(8, 512), @@ -100,6 +101,36 @@ static const struct spinand_info micron_spinand_table[] = { 0, SPINAND_ECCINFO(µn_8_ooblayout, micron_8_ecc_get_status)), + /* M79A 2Gb 1.8V */ + SPINAND_INFO("MT29F2G01ABBGD", 0x25, + NAND_MEMORG(1, 2048, 128, 64, 2048, 40, 2, 1, 1), + NAND_ECCREQ(8, 512), + SPINAND_INFO_OP_VARIANTS(&read_cache_variants, + &write_cache_variants, + &update_cache_variants), + 0, + SPINAND_ECCINFO(µn_8_ooblayout, + micron_8_ecc_get_status)), + /* M78A 1Gb 3.3V */ + SPINAND_INFO("MT29F1G01ABAFD", 0x14, + NAND_MEMORG(1, 2048, 128, 64, 1024, 20, 1, 1, 1), + NAND_ECCREQ(8, 512), + SPINAND_INFO_OP_VARIANTS(&read_cache_variants, + &write_cache_variants, + &update_cache_variants), + 0, + SPINAND_ECCINFO(µn_8_ooblayout, + micron_8_ecc_get_status)), + /* M78A 1Gb 1.8V */ + SPINAND_INFO("MT29F1G01ABAFD", 0x15, + NAND_MEMORG(1, 2048, 128, 64, 1024, 20, 1, 1, 1), + NAND_ECCREQ(8, 512), + SPINAND_INFO_OP_VARIANTS(&read_cache_variants, + &write_cache_variants, + &update_cache_variants), + 0, + SPINAND_ECCINFO(µn_8_ooblayout, + micron_8_ecc_get_status)), }; static int micron_spinand_detect(struct spinand_device *spinand) From patchwork Thu Feb 6 20:22:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shivamurthy Shastri X-Patchwork-Id: 1234561 X-Patchwork-Delegate: miquel.raynal@bootlin.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20170209 header.b=qgUNXfVh; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=k/+ec3Lz; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48D90p1pH6z9sRK for ; Fri, 7 Feb 2020 07:25:30 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=UZGgLg51bEFLSnN9FBeGvYBRREfCakROXGxn/vOqjKs=; b=qgUNXfVhpuQtzno6zV1JdfFpVJ xSUszTm0Pt5oxAxWGXgVubRw98WUBB0zWKJ7s/TVrfdH25HO9oeNqw+n68d6mBPpxXAyhPnInZeAI qgP/ULKnuQqvIIgCxy0CgAfKoZ5iH+Lu/ARlWGPbEPHHdZ6GePDVTP8q4+pKHFvEGq5BRjPMM9uwK 4dnba/yc5cDRvmTufxta2e9aJjCzn7Y5M6haTyGlPMzwkDTJEkevBMh00VOB6CPsbPvU5w2mmsR8/ ljTrXQ/iHoR6f57yPtV5T6FnA3DtzDK2wT+muqj6V2IdjTq4aTiMJtqO+p9BxH5F9THXMtOEVkOxQ 8e5PXEMQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1izni7-0000Cq-7D; Thu, 06 Feb 2020 20:25:15 +0000 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iznhV-0006rg-Py for linux-mtd@lists.infradead.org; Thu, 06 Feb 2020 20:24:39 +0000 Received: by mail-wm1-x343.google.com with SMTP id p9so256788wmc.2 for ; Thu, 06 Feb 2020 12:24:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=LFxMYCi8lGoovOV/sAYPGteEncrVIWaLSH+LK6Sw5BI=; b=k/+ec3LzTqJfjILFR0cc7f2Q6keBUxbOd+AiEs2of8GbeM6GGMyLV8t5tlwRr6KluB Q0ypKUjvislTnM12SgJdNMO4zs4w7G35fKiyxdPp8Ka+faKrRC7xfm0ai1SZ47cQERp8 V58dZd8FLH99DbpwJCzA2vzmXw4+T85nRNz0CKl3lzj7gTFDukAGr9hZQ6iw9uzeamSZ yN5vr+4bbMkRnWqfCBA4hDpo5N+efpViK8lHR5qqNhCPP00uZM2tgoJHKaEqOIln125r BZR5072gpKse4NZwGg9LDF2VVgdT/4tOCILneL6geAW20JTdo2aV5GNv3ilenohoKFzP P1UA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=LFxMYCi8lGoovOV/sAYPGteEncrVIWaLSH+LK6Sw5BI=; b=hKD1T8QBumXJDUFm46aR5XwNEQboPK7AH3in6pxx3+bdv9sfb0Que8LdpLowvLDh82 X1ZxYkmJrVkc0Tc/bvV2q5l5ihKMUq5RyxpuqrWf6MQE+3HsN1tsrMpVm2+t0zaElZSw AekbE0btug+SkYFVouB0iWLzgMkzv+qdtH7HlnPJK2nLuqX8N3YT51S49x0kjbqjpHZc H9qNTK8WxszUUGbKIJxo8dJWTaZNp0woAcuPzHJRJF3DHKYrZCHevsZAnTmhdWrK1r+d vjsZsw7sLOWUOFRttrqCSIQzEimHN4tZwlN01ESxNT19glPsfsGFa4LpGY1wp8AV1Dag Ho2w== X-Gm-Message-State: APjAAAWEjFxBeCpCWeONA0ZOmknm6pkPj4rM6lyygGSXcAEIvXeHnUhP GX4T0Qs3O021IF46hmZxdkv3BdyexlXKnA== X-Google-Smtp-Source: APXvYqyq7CoP1tZczuROmScct0k4Sx4IrB7cBccXjoqRWw1lrhus82/ttE+70/rzdw9FMMxc1pYF6w== X-Received: by 2002:a1c:1f56:: with SMTP id f83mr6336867wmf.93.1581020676029; Thu, 06 Feb 2020 12:24:36 -0800 (PST) Received: from opensdev.fritz.box (business-178-015-117-054.static.arcor-ip.net. [178.15.117.54]) by smtp.gmail.com with ESMTPSA id c13sm539929wrx.9.2020.02.06.12.24.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Feb 2020 12:24:35 -0800 (PST) From: shiva.linuxworks@gmail.com X-Google-Original-From: sshivamurthy@micron.com To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Frieder Schrempf , Boris Brezillon , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 3/5] mtd: spinand: micron: identify SPI NAND device with Continuous Read mode Date: Thu, 6 Feb 2020 21:22:04 +0100 Message-Id: <20200206202206.14770-4-sshivamurthy@micron.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200206202206.14770-1-sshivamurthy@micron.com> References: <20200206202206.14770-1-sshivamurthy@micron.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200206_122437_861018_2282BFF8 X-CRM114-Status: GOOD ( 14.75 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:343 listed in] [list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [shiva.linuxworks[at]gmail.com] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Shivamurthy Shastri MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Shivamurthy Shastri Add SPINAND_HAS_CR_FEAT_BIT flag to identify the SPI NAND device with the Continuous Read mode. Some of the Micron SPI NAND devices have the "Continuous Read" feature enabled by default, which does not fit the subsystem needs. In this mode, the READ CACHE command doesn't require the starting column address. The device always output the data starting from the first column of the cache register, and once the end of the cache register reached, the data output continues through the next page. With the continuous read mode, it is possible to read out the entire block using a single READ command, and once the end of the block reached, the output pins become High-Z state. However, during this mode the read command doesn't output the OOB area. Hence, we disable the feature at probe time. Signed-off-by: Shivamurthy Shastri --- drivers/mtd/nand/spi/micron.c | 16 ++++++++++++++++ include/linux/mtd/spinand.h | 1 + 2 files changed, 17 insertions(+) diff --git a/drivers/mtd/nand/spi/micron.c b/drivers/mtd/nand/spi/micron.c index 5fd1f921ef12..a8e947609cd9 100644 --- a/drivers/mtd/nand/spi/micron.c +++ b/drivers/mtd/nand/spi/micron.c @@ -18,6 +18,8 @@ #define MICRON_STATUS_ECC_4TO6_BITFLIPS (3 << 4) #define MICRON_STATUS_ECC_7TO8_BITFLIPS (5 << 4) +#define MICRON_CFG_CONTI_READ BIT(0) + static SPINAND_OP_VARIANTS(read_cache_variants, SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 2, NULL, 0), SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), @@ -153,8 +155,22 @@ static int micron_spinand_detect(struct spinand_device *spinand) return 1; } +static int micron_spinand_init(struct spinand_device *spinand) +{ + /* + * M70A device series enable Continuous Read feature at Power-up, + * which is not supported. Disable this bit to avoid any possible + * failure. + */ + if (spinand->flags == SPINAND_HAS_CR_FEAT_BIT) + return spinand_upd_cfg(spinand, MICRON_CFG_CONTI_READ, 0); + + return 0; +} + static const struct spinand_manufacturer_ops micron_spinand_manuf_ops = { .detect = micron_spinand_detect, + .init = micron_spinand_init, }; const struct spinand_manufacturer micron_spinand_manufacturer = { diff --git a/include/linux/mtd/spinand.h b/include/linux/mtd/spinand.h index 4ea558bd3c46..333149b2855f 100644 --- a/include/linux/mtd/spinand.h +++ b/include/linux/mtd/spinand.h @@ -270,6 +270,7 @@ struct spinand_ecc_info { }; #define SPINAND_HAS_QE_BIT BIT(0) +#define SPINAND_HAS_CR_FEAT_BIT BIT(1) /** * struct spinand_info - Structure used to describe SPI NAND chips From patchwork Thu Feb 6 20:22:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shivamurthy Shastri X-Patchwork-Id: 1234562 X-Patchwork-Delegate: miquel.raynal@bootlin.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20170209 header.b=jnT9et7p; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=dvHjQ6F0; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48D9110vCSz9sRR for ; Fri, 7 Feb 2020 07:25:41 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=q9yNB++OlkWVKaL0Egf+09P7eDhFGdv9loqpvCjmWOY=; b=jnT9et7pOqn6VsI1lYhf9Ozd2G WCQf7sV8yavEqFfC3WY7HJ/+7RAbk8qUdycipJNCISfQEiXD0LpocdoPp46vueO1YyhDzJjwnoYpH qmP2C6AGgKM9QTLOJFToTJUPaBcFsErMNVF9arWRQ70d7IbBVmd7orl97NNgziAaUxJQmCNIEY8pQ v97bExGJmAuJDQ6b1ICpeLHcS3YXvY8cD0iQ7pJTuRL6nV90VitWh/9Kly+o/qu4gqI2ukDYOcREA oFehirjoWryNFQ3pMnksjkzDrRT3qWSY4ldpPEFsm8uWp9k8TXgY/kYfrZbSNCx+ObbfklEhg3DU6 iWlEdOKw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1izniJ-0000Qx-7x; Thu, 06 Feb 2020 20:25:27 +0000 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iznhX-0006vL-Os for linux-mtd@lists.infradead.org; Thu, 06 Feb 2020 20:24:41 +0000 Received: by mail-wm1-x343.google.com with SMTP id g1so229304wmh.4 for ; Thu, 06 Feb 2020 12:24:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Y1/vJoGTEz84eAnDtx72Ndu+MPAZCnA9yhw+teLVXo0=; b=dvHjQ6F0W51wq8W5czfthpMZ1OOWrPNrp5Sxlg31PPtN5sZZ5mjIZ6CJJq/QCdHS+N GevcgPNDocAYx3cth54wnX6JdqqDZvzoYE4UY40KZVZGsLUqOkkZBTK40dohqBosbt98 wRdAOi4FtQrh8Mqu6W4vF1RFfAXsF7hkT8mfpIpTkjTb5LWsKETgmq6B1kzxmUb6OcYa dc+ZuP4D9xPYPQAb1C2yGZ1ujWkaiqMGEbkNROXqXFLnqYcB+i7Xb8rC7fwdfKxwhm9j UQEGVw0X45ZDnGU7K2+PSD3FJ4pw7JoqoTM+c6GRit0uasA4yWLyHHjnHfFVMPw0z5xi n2BA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Y1/vJoGTEz84eAnDtx72Ndu+MPAZCnA9yhw+teLVXo0=; b=bxiXc+g11YUJg1Vc1c4O3SHZTeOGjEl/KFmtF4lB7ufuV7zXTbU2diEO31Ie+Bo8Op vsupWWwRfNEsO53QmGnH6AqzOk2h7gFIisWQfh6TU8LSYGN/kpxZKmUEggyo2dm0ghT3 V4xV8IHWMIZT8mhR9lj4xa7W3bfhQ4LUwQ7UGGdYur8Dmx+LCuoPiMDpLtXPQs281uRp asMER3IjliRI6Uir9T5xiuLAY/yyCZMPqD5e02/d5NMPuB8qrOZQkP2KWr6j64lw4ru7 HRCy3jOd+rVNZdyniWrebq/rdeFkVodCuY59UjvAfIY+ttCZbL+wj3HBK54m+wtg6Otr fLaQ== X-Gm-Message-State: APjAAAXrWKTEr6O7WXZVjXwzIIjg9LZw+4UGc4DOIhqOv7LVVGJnEIc6 Lp1watMeCi/pAJeUzjdI9kE= X-Google-Smtp-Source: APXvYqx/cxgYne1/eULS2VXuvJcJGurz2A26EKeyBvr3kFw/2Sd/AUf/7GtI4bYoUZi+tIE8evOTog== X-Received: by 2002:a1c:65d6:: with SMTP id z205mr6254021wmb.38.1581020678504; Thu, 06 Feb 2020 12:24:38 -0800 (PST) Received: from opensdev.fritz.box (business-178-015-117-054.static.arcor-ip.net. [178.15.117.54]) by smtp.gmail.com with ESMTPSA id c13sm539929wrx.9.2020.02.06.12.24.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Feb 2020 12:24:37 -0800 (PST) From: shiva.linuxworks@gmail.com X-Google-Original-From: sshivamurthy@micron.com To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Frieder Schrempf , Boris Brezillon , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 4/5] mtd: spinand: micron: Add M70A series Micron SPI NAND devices Date: Thu, 6 Feb 2020 21:22:05 +0100 Message-Id: <20200206202206.14770-5-sshivamurthy@micron.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200206202206.14770-1-sshivamurthy@micron.com> References: <20200206202206.14770-1-sshivamurthy@micron.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200206_122439_840181_62DC2B99 X-CRM114-Status: UNSURE ( 9.55 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:343 listed in] [list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [shiva.linuxworks[at]gmail.com] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Shivamurthy Shastri MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Shivamurthy Shastri Add device table for M70A series Micron SPI NAND devices. Signed-off-by: Shivamurthy Shastri Reviewed-by: Boris Brezillon --- drivers/mtd/nand/spi/micron.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/mtd/nand/spi/micron.c b/drivers/mtd/nand/spi/micron.c index a8e947609cd9..3d3734afc35e 100644 --- a/drivers/mtd/nand/spi/micron.c +++ b/drivers/mtd/nand/spi/micron.c @@ -133,6 +133,26 @@ static const struct spinand_info micron_spinand_table[] = { 0, SPINAND_ECCINFO(µn_8_ooblayout, micron_8_ecc_get_status)), + /* M70A 4Gb 3.3V */ + SPINAND_INFO("MT29F4G01ABAFD", 0x34, + NAND_MEMORG(1, 4096, 256, 64, 2048, 40, 1, 1, 1), + NAND_ECCREQ(8, 512), + SPINAND_INFO_OP_VARIANTS(&read_cache_variants, + &write_cache_variants, + &update_cache_variants), + SPINAND_HAS_CR_FEAT_BIT, + SPINAND_ECCINFO(µn_8_ooblayout, + micron_8_ecc_get_status)), + /* M70A 4Gb 1.8V */ + SPINAND_INFO("MT29F4G01ABBFD", 0x35, + NAND_MEMORG(1, 4096, 256, 64, 2048, 40, 1, 1, 1), + NAND_ECCREQ(8, 512), + SPINAND_INFO_OP_VARIANTS(&read_cache_variants, + &write_cache_variants, + &update_cache_variants), + SPINAND_HAS_CR_FEAT_BIT, + SPINAND_ECCINFO(µn_8_ooblayout, + micron_8_ecc_get_status)), }; static int micron_spinand_detect(struct spinand_device *spinand) From patchwork Thu Feb 6 20:22:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shivamurthy Shastri X-Patchwork-Id: 1234563 X-Patchwork-Delegate: miquel.raynal@bootlin.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20170209 header.b=K1NJLjNT; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=jxhr0TnM; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48D91R35WCz9sRK for ; Fri, 7 Feb 2020 07:26:03 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=z6dB+JQAMSbs1aGTtMABG/K58FREHN9rq43UPcw/wj4=; b=K1NJLjNT/Qa54uQsR0fdc3tpnH L9I3nKGRoB5i7LLqVeB4SccUYl9WS25fbQsGNqGlUaFPIjQDk75Ceel79rkZwHPEoZ7zGXs9YizUi mz/VwahQ4atTAF7XFK+kIAlPRorM3VZOWXZQVWlXynPE7ZLBVpxctqi4J0BUK493nSZSKetBMmHxo JVWqM9hjOo/MqPvjIgmQ5jswhGz89SEpEqlDWVJUzgXcZ5uKsPqyOC1ym0keilgP4/Z9ttilcC669 A93VpUXOVnmtgnn7aJylCofSRk/D/eVbVKRhsPMk2aLXgiAUpDUXkZdUL0CVovrwD/72D66uQXpVM ONG+27/A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1izniZ-0000hI-DI; Thu, 06 Feb 2020 20:25:43 +0000 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iznha-0006yx-OU for linux-mtd@lists.infradead.org; Thu, 06 Feb 2020 20:24:44 +0000 Received: by mail-wm1-x343.google.com with SMTP id f129so259725wmf.2 for ; Thu, 06 Feb 2020 12:24:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=3dLHbgqnxzITEPk0xVr2q4acu5k1gqYIJuRiRDYsyfM=; b=jxhr0TnMonMJJu8Byv9wwBeMUGPmV2t5n4m5e6tv1WCbMtrujFvOyDobJGMgjPRcXn SvNaXcznk2vynoJvVeqA/Z8FETgeS+7oIKEjEGSzpP0s9IwFetTOMpD/I1k+N6jSUgzb Okd54zoXmzx4xJqIzyNc7UUZyixelsFtbpDBlQCL/Bq7QmVidkG9h0q/5aDgT/+PVf1J IVehYXZEwTEeqtzbYMDP1n8l4uWAMpWXKF8OF9LAWXWldEsNSPHqtXnwWys+UmF6uKju 0pYdtoTIKMR5Iu71EcPsMuJzXR/FFplsbPniXK/r91iI++4I6YN02fHS7Sa2sFeDIX8u Llpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=3dLHbgqnxzITEPk0xVr2q4acu5k1gqYIJuRiRDYsyfM=; b=fRv0SKOhW1x6+vQn4mmhSRFDbwS1/c0oLUR/KNStU7AEriMke/TVlMNFTVaYOsM+jz BTbp8MRXwFxjJq72VlXHdsOvZxTITkKboroMYweoA3q3gOVzs/AuhVa3KJlDJ7s34lWc Ckc0cABlQKGy91knIJFuZWRQrH2Nhn3S8T4bFqLZOKhQ13TmkbWIwoPAeGGRiPQj7cuy zbQWRQMP6J2uHR2VYOBZUURkJgsR9NEdDFJYrttaiim2GT+tsqCozYjXj4o7Gu6tEhVF Kfl6tUn+AxR29njMfLmehqPR7R/s01QiQOC+Ul/eY4Rb7OqOrfIhktICqGfpbveVTXqg E7IA== X-Gm-Message-State: APjAAAWB4xRkrteN1cu9kkqmXdXYrpOHJPKUwXy4h1QEL7OxEp6c/DN8 J3x5wBzQ7lEQNrFwEfos6vw= X-Google-Smtp-Source: APXvYqyL8GPV+I2x3uNCsh7w/h15UQdozgbNLBioz7uqTzkfLRWnNUri5Am72ymP5kje+CRc6EJNpA== X-Received: by 2002:a1c:dcd5:: with SMTP id t204mr6395135wmg.34.1581020680609; Thu, 06 Feb 2020 12:24:40 -0800 (PST) Received: from opensdev.fritz.box (business-178-015-117-054.static.arcor-ip.net. [178.15.117.54]) by smtp.gmail.com with ESMTPSA id c13sm539929wrx.9.2020.02.06.12.24.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Feb 2020 12:24:40 -0800 (PST) From: shiva.linuxworks@gmail.com X-Google-Original-From: sshivamurthy@micron.com To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Frieder Schrempf , Boris Brezillon , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 5/5] mtd: spinand: micron: Add new Micron SPI NAND devices with multiple dies Date: Thu, 6 Feb 2020 21:22:06 +0100 Message-Id: <20200206202206.14770-6-sshivamurthy@micron.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200206202206.14770-1-sshivamurthy@micron.com> References: <20200206202206.14770-1-sshivamurthy@micron.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200206_122443_045569_72B1FDCE X-CRM114-Status: GOOD ( 11.40 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:343 listed in] [list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [shiva.linuxworks[at]gmail.com] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Shivamurthy Shastri MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Shivamurthy Shastri Add device table for new Micron SPI NAND devices, which have multiple dies. Also, enable support to select the dies. Signed-off-by: Shivamurthy Shastri --- drivers/mtd/nand/spi/micron.c | 58 +++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/drivers/mtd/nand/spi/micron.c b/drivers/mtd/nand/spi/micron.c index 3d3734afc35e..84e1c109ad0c 100644 --- a/drivers/mtd/nand/spi/micron.c +++ b/drivers/mtd/nand/spi/micron.c @@ -20,6 +20,15 @@ #define MICRON_CFG_CONTI_READ BIT(0) +/* + * As per datasheet, die selection is done by the 6th bit of Die + * Select Register (Address 0xD0). + */ +#define MICRON_DIE_SELECT_REG 0xD0 + +#define MICRON_SELECT_DIE_0 0x00 +#define MICRON_SELECT_DIE_1 0x40 + static SPINAND_OP_VARIANTS(read_cache_variants, SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 2, NULL, 0), SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), @@ -66,6 +75,22 @@ static const struct mtd_ooblayout_ops micron_8_ooblayout = { .free = micron_8_ooblayout_free, }; +static int micron_select_target(struct spinand_device *spinand, + unsigned int target) +{ + struct spi_mem_op op = SPINAND_SET_FEATURE_OP(MICRON_DIE_SELECT_REG, + spinand->scratchbuf); + + if (target == 0) + *spinand->scratchbuf = MICRON_SELECT_DIE_0; + else if (target == 1) + *spinand->scratchbuf = MICRON_SELECT_DIE_1; + else + return -EINVAL; + + return spi_mem_exec_op(spinand->spimem, &op); +} + static int micron_8_ecc_get_status(struct spinand_device *spinand, u8 status) { @@ -133,6 +158,17 @@ static const struct spinand_info micron_spinand_table[] = { 0, SPINAND_ECCINFO(µn_8_ooblayout, micron_8_ecc_get_status)), + /* M79A 4Gb 3.3V */ + SPINAND_INFO("MT29F4G01ADAGD", 0x36, + NAND_MEMORG(1, 2048, 128, 64, 2048, 80, 2, 1, 2), + NAND_ECCREQ(8, 512), + SPINAND_INFO_OP_VARIANTS(&read_cache_variants, + &write_cache_variants, + &update_cache_variants), + 0, + SPINAND_ECCINFO(µn_8_ooblayout, + micron_8_ecc_get_status), + SPINAND_SELECT_TARGET(micron_select_target)), /* M70A 4Gb 3.3V */ SPINAND_INFO("MT29F4G01ABAFD", 0x34, NAND_MEMORG(1, 4096, 256, 64, 2048, 40, 1, 1, 1), @@ -153,6 +189,28 @@ static const struct spinand_info micron_spinand_table[] = { SPINAND_HAS_CR_FEAT_BIT, SPINAND_ECCINFO(µn_8_ooblayout, micron_8_ecc_get_status)), + /* M70A 8Gb 3.3V */ + SPINAND_INFO("MT29F8G01ADAFD", 0x46, + NAND_MEMORG(1, 4096, 256, 64, 2048, 40, 1, 1, 2), + NAND_ECCREQ(8, 512), + SPINAND_INFO_OP_VARIANTS(&read_cache_variants, + &write_cache_variants, + &update_cache_variants), + SPINAND_HAS_CR_FEAT_BIT, + SPINAND_ECCINFO(µn_8_ooblayout, + micron_8_ecc_get_status), + SPINAND_SELECT_TARGET(micron_select_target)), + /* M70A 8Gb 1.8V */ + SPINAND_INFO("MT29F8G01ADBFD", 0x47, + NAND_MEMORG(1, 4096, 256, 64, 2048, 40, 1, 1, 2), + NAND_ECCREQ(8, 512), + SPINAND_INFO_OP_VARIANTS(&read_cache_variants, + &write_cache_variants, + &update_cache_variants), + SPINAND_HAS_CR_FEAT_BIT, + SPINAND_ECCINFO(µn_8_ooblayout, + micron_8_ecc_get_status), + SPINAND_SELECT_TARGET(micron_select_target)), }; static int micron_spinand_detect(struct spinand_device *spinand)