| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (C) 2002 Thomas Gleixner (tglx@linutronix.de) |
|---|
| 3 | | - * |
|---|
| 4 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 5 | | - * it under the terms of the GNU General Public License version 2 as |
|---|
| 6 | | - * published by the Free Software Foundation. |
|---|
| 7 | | - * |
|---|
| 8 | 4 | */ |
|---|
| 9 | | -#include <linux/mtd/rawnand.h> |
|---|
| 5 | + |
|---|
| 10 | 6 | #include <linux/sizes.h> |
|---|
| 7 | + |
|---|
| 8 | +#include "internals.h" |
|---|
| 11 | 9 | |
|---|
| 12 | 10 | #define LP_OPTIONS 0 |
|---|
| 13 | 11 | #define LP_OPTIONS16 (LP_OPTIONS | NAND_BUSWIDTH_16) |
|---|
| .. | .. |
|---|
| 30 | 28 | */ |
|---|
| 31 | 29 | {"TC58NVG0S3E 1G 3.3V 8-bit", |
|---|
| 32 | 30 | { .id = {0x98, 0xd1, 0x90, 0x15, 0x76, 0x14, 0x01, 0x00} }, |
|---|
| 33 | | - SZ_2K, SZ_128, SZ_128K, 0, 8, 64, NAND_ECC_INFO(1, SZ_512), |
|---|
| 34 | | - 2 }, |
|---|
| 31 | + SZ_2K, SZ_128, SZ_128K, 0, 8, 64, NAND_ECC_INFO(1, SZ_512), }, |
|---|
| 35 | 32 | {"TC58NVG2S0F 4G 3.3V 8-bit", |
|---|
| 36 | 33 | { .id = {0x98, 0xdc, 0x90, 0x26, 0x76, 0x15, 0x01, 0x08} }, |
|---|
| 37 | 34 | SZ_4K, SZ_512, SZ_256K, 0, 8, 224, NAND_ECC_INFO(4, SZ_512) }, |
|---|
| .. | .. |
|---|
| 44 | 41 | {"TC58NVG5D2 32G 3.3V 8-bit", |
|---|
| 45 | 42 | { .id = {0x98, 0xd7, 0x94, 0x32, 0x76, 0x56, 0x09, 0x00} }, |
|---|
| 46 | 43 | SZ_8K, SZ_4K, SZ_1M, 0, 8, 640, NAND_ECC_INFO(40, SZ_1K) }, |
|---|
| 47 | | - {"TC58NVG5H2 32G 3.3V 24-bit", |
|---|
| 48 | | - { .id = {0x98, 0xd7, 0xa0, 0x32, 0x76, 0x56, 0x08, 0x08} }, |
|---|
| 49 | | - SZ_8K, SZ_4K, SZ_1M, 0, 8, 1024, NAND_ECC_INFO(24, SZ_1K) }, |
|---|
| 50 | 44 | {"TC58NVG6D2 64G 3.3V 8-bit", |
|---|
| 51 | 45 | { .id = {0x98, 0xde, 0x94, 0x82, 0x76, 0x56, 0x04, 0x20} }, |
|---|
| 52 | 46 | SZ_8K, SZ_8K, SZ_2M, 0, 8, 640, NAND_ECC_INFO(40, SZ_1K) }, |
|---|
| .. | .. |
|---|
| 56 | 50 | {"H27UCG8T2ATR-BC 64G 3.3V 8-bit", |
|---|
| 57 | 51 | { .id = {0xad, 0xde, 0x94, 0xda, 0x74, 0xc4} }, |
|---|
| 58 | 52 | SZ_8K, SZ_8K, SZ_2M, NAND_NEED_SCRAMBLING, 6, 640, |
|---|
| 59 | | - NAND_ECC_INFO(40, SZ_1K), 4 }, |
|---|
| 53 | + NAND_ECC_INFO(40, SZ_1K) }, |
|---|
| 54 | + {"TH58NVG2S3HBAI4 4G 3.3V 8-bit", |
|---|
| 55 | + { .id = {0x98, 0xdc, 0x91, 0x15, 0x76} }, |
|---|
| 56 | + SZ_2K, SZ_512, SZ_128K, 0, 5, 128, NAND_ECC_INFO(8, SZ_512) }, |
|---|
| 60 | 57 | |
|---|
| 61 | 58 | LEGACY_ID_NAND("NAND 4MiB 5V 8-bit", 0x6B, 4, SZ_8K, SP_OPTIONS), |
|---|
| 62 | 59 | LEGACY_ID_NAND("NAND 4MiB 3,3V 8-bit", 0xE3, 4, SZ_8K, SP_OPTIONS), |
|---|
| .. | .. |
|---|
| 171 | 168 | }; |
|---|
| 172 | 169 | |
|---|
| 173 | 170 | /* Manufacturer IDs */ |
|---|
| 174 | | -static const struct nand_manufacturer nand_manufacturers[] = { |
|---|
| 175 | | - {NAND_MFR_TOSHIBA, "Toshiba", &toshiba_nand_manuf_ops}, |
|---|
| 176 | | - {NAND_MFR_ESMT, "ESMT"}, |
|---|
| 177 | | - {NAND_MFR_SAMSUNG, "Samsung", &samsung_nand_manuf_ops}, |
|---|
| 171 | +static const struct nand_manufacturer_desc nand_manufacturer_descs[] = { |
|---|
| 172 | + {NAND_MFR_AMD, "AMD/Spansion", &amd_nand_manuf_ops}, |
|---|
| 173 | + {NAND_MFR_ATO, "ATO"}, |
|---|
| 174 | + {NAND_MFR_EON, "Eon"}, |
|---|
| 175 | + {NAND_MFR_ESMT, "ESMT", &esmt_nand_manuf_ops}, |
|---|
| 178 | 176 | {NAND_MFR_FUJITSU, "Fujitsu"}, |
|---|
| 177 | + {NAND_MFR_HYNIX, "Hynix", &hynix_nand_manuf_ops}, |
|---|
| 178 | + {NAND_MFR_INTEL, "Intel"}, |
|---|
| 179 | + {NAND_MFR_MACRONIX, "Macronix", ¯onix_nand_manuf_ops}, |
|---|
| 180 | + {NAND_MFR_MICRON, "Micron", µn_nand_manuf_ops}, |
|---|
| 179 | 181 | {NAND_MFR_NATIONAL, "National"}, |
|---|
| 180 | 182 | {NAND_MFR_RENESAS, "Renesas"}, |
|---|
| 181 | | - {NAND_MFR_STMICRO, "ST Micro"}, |
|---|
| 182 | | - {NAND_MFR_HYNIX, "Hynix", &hynix_nand_manuf_ops}, |
|---|
| 183 | | - {NAND_MFR_MICRON, "Micron", µn_nand_manuf_ops}, |
|---|
| 184 | | - {NAND_MFR_AMD, "AMD/Spansion", &amd_nand_manuf_ops}, |
|---|
| 185 | | - {NAND_MFR_MACRONIX, "Macronix", ¯onix_nand_manuf_ops}, |
|---|
| 186 | | - {NAND_MFR_EON, "Eon"}, |
|---|
| 183 | + {NAND_MFR_SAMSUNG, "Samsung", &samsung_nand_manuf_ops}, |
|---|
| 187 | 184 | {NAND_MFR_SANDISK, "SanDisk"}, |
|---|
| 188 | | - {NAND_MFR_INTEL, "Intel"}, |
|---|
| 189 | | - {NAND_MFR_ATO, "ATO"}, |
|---|
| 185 | + {NAND_MFR_STMICRO, "ST Micro"}, |
|---|
| 186 | + {NAND_MFR_TOSHIBA, "Toshiba", &toshiba_nand_manuf_ops}, |
|---|
| 190 | 187 | {NAND_MFR_WINBOND, "Winbond"}, |
|---|
| 191 | 188 | }; |
|---|
| 192 | 189 | |
|---|
| 193 | 190 | /** |
|---|
| 194 | | - * nand_get_manufacturer - Get manufacturer information from the manufacturer |
|---|
| 195 | | - * ID |
|---|
| 191 | + * nand_get_manufacturer_desc - Get manufacturer information from the |
|---|
| 192 | + * manufacturer ID |
|---|
| 196 | 193 | * @id: manufacturer ID |
|---|
| 197 | 194 | * |
|---|
| 198 | | - * Returns a pointer a nand_manufacturer object if the manufacturer is defined |
|---|
| 195 | + * Returns a nand_manufacturer_desc object if the manufacturer is defined |
|---|
| 199 | 196 | * in the NAND manufacturers database, NULL otherwise. |
|---|
| 200 | 197 | */ |
|---|
| 201 | | -const struct nand_manufacturer *nand_get_manufacturer(u8 id) |
|---|
| 198 | +const struct nand_manufacturer_desc *nand_get_manufacturer_desc(u8 id) |
|---|
| 202 | 199 | { |
|---|
| 203 | 200 | int i; |
|---|
| 204 | 201 | |
|---|
| 205 | | - for (i = 0; i < ARRAY_SIZE(nand_manufacturers); i++) |
|---|
| 206 | | - if (nand_manufacturers[i].id == id) |
|---|
| 207 | | - return &nand_manufacturers[i]; |
|---|
| 202 | + for (i = 0; i < ARRAY_SIZE(nand_manufacturer_descs); i++) |
|---|
| 203 | + if (nand_manufacturer_descs[i].id == id) |
|---|
| 204 | + return &nand_manufacturer_descs[i]; |
|---|
| 208 | 205 | |
|---|
| 209 | 206 | return NULL; |
|---|
| 210 | 207 | } |
|---|