1 From db214513f62fd13c0a9af3bd5c5d634dba37e65d Mon Sep 17 00:00:00 2001
2 From: Yoshio Furuyama <tmcmc-mb-yfuruyama7@ml.toshiba.co.jp>
3 Date: Wed, 16 Jan 2019 14:53:19 +0900
4 Subject: [PATCH 7/8] mtd: spinand: Add support for all Toshiba Memory products
6 Add device table for Toshiba Memory products.
7 Also, generalize OOB layout structure and function names.
9 Signed-off-by: Yoshio Furuyama <tmcmc-mb-yfuruyama7@ml.toshiba.co.jp>
10 Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
11 Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
13 drivers/mtd/nand/spi/toshiba.c | 79 ++++++++++++++++++++++++++++------
14 1 file changed, 65 insertions(+), 14 deletions(-)
16 --- a/drivers/mtd/nand/spi/toshiba.c
17 +++ b/drivers/mtd/nand/spi/toshiba.c
18 @@ -25,19 +25,19 @@ static SPINAND_OP_VARIANTS(write_cache_v
19 static SPINAND_OP_VARIANTS(update_cache_variants,
20 SPINAND_PROG_LOAD(false, 0, NULL, 0));
22 -static int tc58cvg2s0h_ooblayout_ecc(struct mtd_info *mtd, int section,
23 +static int tc58cxgxsx_ooblayout_ecc(struct mtd_info *mtd, int section,
24 struct mtd_oob_region *region)
30 - region->offset = 128 + 16 * section;
31 - region->length = 16;
32 + region->offset = mtd->oobsize / 2;
33 + region->length = mtd->oobsize / 2;
38 -static int tc58cvg2s0h_ooblayout_free(struct mtd_info *mtd, int section,
39 +static int tc58cxgxsx_ooblayout_free(struct mtd_info *mtd, int section,
40 struct mtd_oob_region *region)
43 @@ -45,17 +45,17 @@ static int tc58cvg2s0h_ooblayout_free(st
45 /* 2 bytes reserved for BBM */
47 - region->length = 126;
48 + region->length = (mtd->oobsize / 2) - 2;
53 -static const struct mtd_ooblayout_ops tc58cvg2s0h_ooblayout = {
54 - .ecc = tc58cvg2s0h_ooblayout_ecc,
55 - .free = tc58cvg2s0h_ooblayout_free,
56 +static const struct mtd_ooblayout_ops tc58cxgxsx_ooblayout = {
57 + .ecc = tc58cxgxsx_ooblayout_ecc,
58 + .free = tc58cxgxsx_ooblayout_free,
61 -static int tc58cvg2s0h_ecc_get_status(struct spinand_device *spinand,
62 +static int tc58cxgxsx_ecc_get_status(struct spinand_device *spinand,
65 struct nand_device *nand = spinand_to_nand(spinand);
66 @@ -94,15 +94,66 @@ static int tc58cvg2s0h_ecc_get_status(st
69 static const struct spinand_info toshiba_spinand_table[] = {
70 - SPINAND_INFO("TC58CVG2S0H", 0xCD,
72 + SPINAND_INFO("TC58CVG0S3", 0xC2,
73 + NAND_MEMORG(1, 2048, 128, 64, 1024, 1, 1, 1),
74 + NAND_ECCREQ(8, 512),
75 + SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
76 + &write_cache_variants,
77 + &update_cache_variants),
79 + SPINAND_ECCINFO(&tc58cxgxsx_ooblayout,
80 + tc58cxgxsx_ecc_get_status)),
82 + SPINAND_INFO("TC58CVG1S3", 0xCB,
83 + NAND_MEMORG(1, 2048, 128, 64, 2048, 1, 1, 1),
84 + NAND_ECCREQ(8, 512),
85 + SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
86 + &write_cache_variants,
87 + &update_cache_variants),
89 + SPINAND_ECCINFO(&tc58cxgxsx_ooblayout,
90 + tc58cxgxsx_ecc_get_status)),
92 + SPINAND_INFO("TC58CVG2S0", 0xCD,
93 + NAND_MEMORG(1, 4096, 256, 64, 2048, 1, 1, 1),
94 + NAND_ECCREQ(8, 512),
95 + SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
96 + &write_cache_variants,
97 + &update_cache_variants),
99 + SPINAND_ECCINFO(&tc58cxgxsx_ooblayout,
100 + tc58cxgxsx_ecc_get_status)),
102 + SPINAND_INFO("TC58CYG0S3", 0xB2,
103 + NAND_MEMORG(1, 2048, 128, 64, 1024, 1, 1, 1),
104 + NAND_ECCREQ(8, 512),
105 + SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
106 + &write_cache_variants,
107 + &update_cache_variants),
109 + SPINAND_ECCINFO(&tc58cxgxsx_ooblayout,
110 + tc58cxgxsx_ecc_get_status)),
112 + SPINAND_INFO("TC58CYG1S3", 0xBB,
113 + NAND_MEMORG(1, 2048, 128, 64, 2048, 1, 1, 1),
114 + NAND_ECCREQ(8, 512),
115 + SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
116 + &write_cache_variants,
117 + &update_cache_variants),
119 + SPINAND_ECCINFO(&tc58cxgxsx_ooblayout,
120 + tc58cxgxsx_ecc_get_status)),
122 + SPINAND_INFO("TC58CYG2S0", 0xBD,
123 NAND_MEMORG(1, 4096, 256, 64, 2048, 1, 1, 1),
125 SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
126 &write_cache_variants,
127 &update_cache_variants),
128 - SPINAND_HAS_QE_BIT,
129 - SPINAND_ECCINFO(&tc58cvg2s0h_ooblayout,
130 - tc58cvg2s0h_ecc_get_status)),
132 + SPINAND_ECCINFO(&tc58cxgxsx_ooblayout,
133 + tc58cxgxsx_ecc_get_status)),
136 static int toshiba_spinand_detect(struct spinand_device *spinand)