Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1380884imu; Wed, 16 Jan 2019 18:36:47 -0800 (PST) X-Google-Smtp-Source: ALg8bN4mvv5VYsdJaxGhFZAZie/wYorCPZStzuFiaXcVsxLu/5UGne+opM7GL1995tr44vmlhpJT X-Received: by 2002:aa7:810c:: with SMTP id b12mr13030552pfi.44.1547692607844; Wed, 16 Jan 2019 18:36:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547692607; cv=none; d=google.com; s=arc-20160816; b=nwQcyeJN/85IxOzdCcdPDEjk/5ralmy33s4O2ArmaHxDvThdpyXcDX6dHHGzI0G0/v HDCQZcQ9o+1WqQYHv42hGsGIu15GL7rrf1FocvBtlcWWPPwNIAl4hxrmMyRtNnUpbd9d 8xbRK9EXt8cdiP+rrKXbIwwz1q/o7fjrObnOJbMHaOhLosl2sU4nl513RkRfHF6BBck9 Tgnl9NVwWw5VXQT+M+zZFY1DBgqe3HXcCPaRuAwvdWlLy2OjidsLNqYjsIRu1khK2djB GY0hxlqlj8t+7lxj/8mEoNpQYeU9Q7P1ctkZDzsDnv9xvoSRhSESW7o+3fTmyzOwelC+ OA2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=tEYcLFq0MLoMdHx7wNTnTvSv98l/+Cykhjwy0MBFIkc=; b=jPXWMA6jfojNks7zXmvP1fYiycizPbmTuhxWVNWJVwn5n27DRRvnws2oBw221KaNkl JG70Gt8we5VqP7rpGfaYZto2ux+S6PN0fpgAbfJ1fo3x0Seb7EQgp71K03mmtirFIN2W HTTBFt5WdFdfKzSznb7WfXLylSidNSJTBXGX9ChdFzLhtWWTgNV1zf39vwwgoRl48YXU quqRsQGTyZp/sK/ooiiwHbZSAjk2/t3K+Nbc/b2V5J98w04CKsjbrUJBfJVr/FU4qKTH GuJFBWziTe3YB85aM9Okfc9pIh6o7ufc6RAfeDIEyQJ1l+78aJkRvzwylG88ejdK8n+L S4Dw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=toshiba.co.jp Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b14si278710plk.333.2019.01.16.18.36.29; Wed, 16 Jan 2019 18:36:47 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=toshiba.co.jp Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733206AbfAPGOg (ORCPT + 99 others); Wed, 16 Jan 2019 01:14:36 -0500 Received: from mo-csw-fb1515.securemx.jp ([210.130.202.171]:43348 "EHLO mo-csw-fb.securemx.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730701AbfAPGOf (ORCPT ); Wed, 16 Jan 2019 01:14:35 -0500 X-Greylist: delayed 1324 seconds by postgrey-1.27 at vger.kernel.org; Wed, 16 Jan 2019 01:14:34 EST Received: by mo-csw-fb.securemx.jp (mx-mo-csw-fb1515) id x0G5qUpe014388; Wed, 16 Jan 2019 14:52:30 +0900 Received: by mo-csw.securemx.jp (mx-mo-csw1514) id x0G5pTvj011528; Wed, 16 Jan 2019 14:51:30 +0900 X-Iguazu-Qid: 34tKHS48TsYsTHngOX X-Iguazu-QSIG: v=2; s=0; t=1547617889; q=34tKHS48TsYsTHngOX; m=J6YwhIuYWFJ/V/M/bgmPeDrialCVb3bpbgqylT4MdVw= Received: from imx12.toshiba.co.jp (imx12.toshiba.co.jp [61.202.160.132]) by relay.securemx.jp (mx-mr1513) id x0G5pMX3003462; Wed, 16 Jan 2019 14:51:22 +0900 Received: from hop101.toshiba.co.jp ([133.199.85.107]) by imx12.toshiba.co.jp with ESMTP id x0G5pLfY014709; Wed, 16 Jan 2019 14:51:21 +0900 (JST) From: Yoshio Furuyama To: bbrezillon@kernel.org, miquel.raynal@bootlin.com Cc: richard@nod.at, dwmw2@infradead.org, computersforpeace@gmail.com, marek.vasut@gmail.com, frieder.schrempf@kontron.De, peron.clem@gmail.com, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, tmcmc-mb-yfuruyama7@ml.toshiba.co.jp Subject: [PATCH] mtd: spinand: Add support for all Toshiba Memory products Date: Wed, 16 Jan 2019 14:53:19 +0900 X-TSB-HOP: ON Message-Id: <20190116055319.2755-1-tmcmc-mb-yfuruyama7@ml.toshiba.co.jp> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add device table for Toshiba Memory products. Also, generalize OOB layout structure and function names. Signed-off-by: Yoshio Furuyama --- drivers/mtd/nand/spi/toshiba.c | 79 +++++++++++++++++++++++++++++++++------- 1 file changed, 65 insertions(+), 14 deletions(-) diff --git a/drivers/mtd/nand/spi/toshiba.c b/drivers/mtd/nand/spi/toshiba.c index 0812655..0916962 100644 --- a/drivers/mtd/nand/spi/toshiba.c +++ b/drivers/mtd/nand/spi/toshiba.c @@ -25,19 +25,19 @@ static SPINAND_OP_VARIANTS(write_cache_variants, static SPINAND_OP_VARIANTS(update_cache_variants, SPINAND_PROG_LOAD(false, 0, NULL, 0)); -static int tc58cvg2s0h_ooblayout_ecc(struct mtd_info *mtd, int section, +static int tc58cxgxsx_ooblayout_ecc(struct mtd_info *mtd, int section, struct mtd_oob_region *region) { - if (section > 7) + if (section > 0) return -ERANGE; - region->offset = 128 + 16 * section; - region->length = 16; + region->offset = mtd->oobsize / 2; + region->length = mtd->oobsize / 2; return 0; } -static int tc58cvg2s0h_ooblayout_free(struct mtd_info *mtd, int section, +static int tc58cxgxsx_ooblayout_free(struct mtd_info *mtd, int section, struct mtd_oob_region *region) { if (section > 0) @@ -45,17 +45,17 @@ static int tc58cvg2s0h_ooblayout_free(struct mtd_info *mtd, int section, /* 2 bytes reserved for BBM */ region->offset = 2; - region->length = 126; + region->length = mtd->oobsize / 2 - 2; return 0; } -static const struct mtd_ooblayout_ops tc58cvg2s0h_ooblayout = { - .ecc = tc58cvg2s0h_ooblayout_ecc, - .free = tc58cvg2s0h_ooblayout_free, +static const struct mtd_ooblayout_ops tc58cxgxsx_ooblayout = { + .ecc = tc58cxgxsx_ooblayout_ecc, + .free = tc58cxgxsx_ooblayout_free, }; -static int tc58cvg2s0h_ecc_get_status(struct spinand_device *spinand, +static int tc58cxgxsx_ecc_get_status(struct spinand_device *spinand, u8 status) { struct nand_device *nand = spinand_to_nand(spinand); @@ -94,15 +94,66 @@ static int tc58cvg2s0h_ecc_get_status(struct spinand_device *spinand, } static const struct spinand_info toshiba_spinand_table[] = { - SPINAND_INFO("TC58CVG2S0H", 0xCD, + /* 3.3V 1Gb */ + SPINAND_INFO("TC58CVG0S3", 0xC2, + NAND_MEMORG(1, 2048, 128, 64, 1024, 1, 1, 1), + NAND_ECCREQ(8, 512), + SPINAND_INFO_OP_VARIANTS(&read_cache_variants, + &write_cache_variants, + &update_cache_variants), + 0, + SPINAND_ECCINFO(&tc58cxgxsx_ooblayout, + tc58cxgxsx_ecc_get_status)), + /* 3.3V 2Gb */ + SPINAND_INFO("TC58CVG1S3", 0xCB, + NAND_MEMORG(1, 2048, 128, 64, 2048, 1, 1, 1), + NAND_ECCREQ(8, 512), + SPINAND_INFO_OP_VARIANTS(&read_cache_variants, + &write_cache_variants, + &update_cache_variants), + 0, + SPINAND_ECCINFO(&tc58cxgxsx_ooblayout, + tc58cxgxsx_ecc_get_status)), + /* 3.3V 4Gb */ + SPINAND_INFO("TC58CVG2S0", 0xCD, + NAND_MEMORG(1, 4096, 256, 64, 2048, 1, 1, 1), + NAND_ECCREQ(8, 512), + SPINAND_INFO_OP_VARIANTS(&read_cache_variants, + &write_cache_variants, + &update_cache_variants), + 0, + SPINAND_ECCINFO(&tc58cxgxsx_ooblayout, + tc58cxgxsx_ecc_get_status)), + /* 1.8V 1Gb */ + SPINAND_INFO("TC58CYG0S3", 0xB2, + NAND_MEMORG(1, 2048, 128, 64, 1024, 1, 1, 1), + NAND_ECCREQ(8, 512), + SPINAND_INFO_OP_VARIANTS(&read_cache_variants, + &write_cache_variants, + &update_cache_variants), + 0, + SPINAND_ECCINFO(&tc58cxgxsx_ooblayout, + tc58cxgxsx_ecc_get_status)), + /* 1.8V 2Gb */ + SPINAND_INFO("TC58CYG1S3", 0xBB, + NAND_MEMORG(1, 2048, 128, 64, 2048, 1, 1, 1), + NAND_ECCREQ(8, 512), + SPINAND_INFO_OP_VARIANTS(&read_cache_variants, + &write_cache_variants, + &update_cache_variants), + 0, + SPINAND_ECCINFO(&tc58cxgxsx_ooblayout, + tc58cxgxsx_ecc_get_status)), + /* 1.8V 4Gb */ + SPINAND_INFO("TC58CYG2S0", 0xBD, NAND_MEMORG(1, 4096, 256, 64, 2048, 1, 1, 1), NAND_ECCREQ(8, 512), SPINAND_INFO_OP_VARIANTS(&read_cache_variants, &write_cache_variants, &update_cache_variants), - SPINAND_HAS_QE_BIT, - SPINAND_ECCINFO(&tc58cvg2s0h_ooblayout, - tc58cvg2s0h_ecc_get_status)), + 0, + SPINAND_ECCINFO(&tc58cxgxsx_ooblayout, + tc58cxgxsx_ecc_get_status)), }; static int toshiba_spinand_detect(struct spinand_device *spinand) -- 1.7.9.5