Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp796349ybh; Wed, 11 Mar 2020 11:01:09 -0700 (PDT) X-Google-Smtp-Source: ADFU+vv1ZiuG95ND+ED17P+eKlnXqlX/8IEEPBPp+Jy6KV+llpVlBVGArIzDdW1n/Htu0JcmxWD5 X-Received: by 2002:a9d:372:: with SMTP id 105mr3185128otv.15.1583949669589; Wed, 11 Mar 2020 11:01:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583949669; cv=none; d=google.com; s=arc-20160816; b=pgqtDLg2Kyh4/dgmwwLsnpGN9e1Tci+nnd5Hf0lf6TrHhsvV5+vEkL6u2L9JJqax5a kmEOIdt7t9oxP/kNXzSGd9ew2Dt4f9CKuazkqF9utnQ5mQELVvdXk6p/+MuG6E4sSeCv SPPYzw/f7XKepRJGVwVW5m9T4Z3fnNWoNTE+BAfvT5gDifKnmsG6/sEW+APfFJkJANUc W77TeUzJ/pP5o1snn7Ggqs/hBiAU6WOz07b+jHokYTD0AhcPObZBkxmrnR/bLRmq3fB6 iNUDriCzCeaOeyhtwR2FC1xCDAUKxr352tF+yE35YG9yiy9H9+m2PDqy6VH5qHPjp7PH 76AQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=+0g3TUuCJUm9ZTQt2upCbsRVi7/9EKui7ktihNwzaDc=; b=ei4mh60FFagupqCa9ePaTPBLo6YkMSX6kkLmKxdW4BSQRbtDsuL20v5a9SdNUGx+fL irCmyjxUB3JN6ZfZTmZUdVNu/qqURkeNYecGhfPLf/NQC0e/t9d9Ie/LXTqOpehre9bn kmAYb2d3HlgosBS44D+cYABZtNARSJwBYKqD7leog5pkAw7O1Tt/AqBtgNPIetmKP+Cw pHHHloA/jDqYfJ5MxgM+8H3fJkKqqe/IvthPhtp0CozrNaNO3nXsm9z/LdTAPlZK0JcV bc++PeFT3nknuqGw5ANwpmRY5WvFJZ2NudTaI0mXB2JRZiygDi0/MBFiP6Qj3e0oowQr cHGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=TsTUXdsh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g24si1580744otn.296.2020.03.11.11.00.57; Wed, 11 Mar 2020 11:01:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=TsTUXdsh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730713AbgCKR7D (ORCPT + 99 others); Wed, 11 Mar 2020 13:59:03 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:32929 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730682AbgCKR65 (ORCPT ); Wed, 11 Mar 2020 13:58:57 -0400 Received: by mail-wr1-f68.google.com with SMTP id a25so3850859wrd.0 for ; Wed, 11 Mar 2020 10:58:56 -0700 (PDT) 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=+0g3TUuCJUm9ZTQt2upCbsRVi7/9EKui7ktihNwzaDc=; b=TsTUXdsh8sqrSedFXRED2/dAg2vNMf1h5465VRoyvVgEc9E6uIUY6+CBePtQ7zR1oe rpM6XhSyyZf+l4tpClm2v/slstLRScfHQ5bJ3bmzMKR/z8iXTrdI8vWlN13rfV0/0BIN VvPOlu4Lw6whyjKKQtY5C+HGahEQW+YW85KXhBNjHc5D1Gy3XJNsuCFomtR0sgtKh7WL WwUrr1mU4WdB7rgCM798dEmsLgiQbZNDfaRRPVfFT5biQ8Qt+P6LmbQolFayf7gJXCYH /NAtaaScmV3PHAfQieHXFxyICJNhOqwJjqH5nCTc5fi5gJqbkNm1e+JSEAY+UgzTYUGS jGUw== 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=+0g3TUuCJUm9ZTQt2upCbsRVi7/9EKui7ktihNwzaDc=; b=djDMpB+EWrIYF7LgOuprjg63kppfn1d0n0EELWhQ0bkyZh0ygxMrokW4dMbbEJ6eOT GAUY5hKWdtdlckOJy6YMsq7MRG4fPveIOZIImvUcMg1JzjsUBXWSmoAbP1xZrnp0kbp8 V3sdVWDVzW/J3p2Vn02+XCsxAmgMJbsoaYRhsLP2diVLJuLk6jrRjKlmUs70BU44n/MZ 417Q0ba4KHjwzISO5rc9ri3i6UORmJpNvSENV99O+R+yxAaofpKErxMpsq3T+IngpsyX l5wbPmpzPsr4mUmu8WiBiyE5GMTuMwu4xLepTqE5h5iHIV12TNacV7vyY/IbIPny3RpB HuuQ== X-Gm-Message-State: ANhLgQ1JW9iPG3hZP+cchStXsVjkp7QeSiP/wP7BuKgm82XAJbuFsUhT eeRLC56zIj0p0Z87KoAindI= X-Received: by 2002:a05:6000:1081:: with SMTP id y1mr5666948wrw.52.1583949535510; Wed, 11 Mar 2020 10:58:55 -0700 (PDT) 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 l18sm1502107wrr.17.2020.03.11.10.58.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Mar 2020 10:58:54 -0700 (PDT) From: shiva.linuxworks@gmail.com X-Google-Original-From: sshivamurthy@micron.com To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Boris Brezillon , Chuanhong Guo , Frieder Schrempf , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Shivamurthy Shastri Subject: [PATCH v7 6/6] mtd: spinand: micron: Add new Micron SPI NAND devices with multiple dies Date: Wed, 11 Mar 2020 18:57:35 +0100 Message-Id: <20200311175735.2007-7-sshivamurthy@micron.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200311175735.2007-1-sshivamurthy@micron.com> References: <20200311175735.2007-1-sshivamurthy@micron.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 Reviewed-by: Boris Brezillon --- 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 d6fd63008782..5d370cfcdaaa 100644 --- a/drivers/mtd/nand/spi/micron.c +++ b/drivers/mtd/nand/spi/micron.c @@ -20,6 +20,14 @@ #define MICRON_CFG_CR 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(x) ((x) << 6) + 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 +74,20 @@ 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 > 1) + return -EINVAL; + + *spinand->scratchbuf = MICRON_SELECT_DIE(target); + + return spi_mem_exec_op(spinand->spimem, &op); +} + static int micron_8_ecc_get_status(struct spinand_device *spinand, u8 status) { @@ -137,6 +159,18 @@ 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", + SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 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", SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x34), @@ -159,6 +193,30 @@ 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", + SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 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", + SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 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_init(struct spinand_device *spinand) -- 2.17.1