mtd: rawnand: hynix: Implement ->choose_interface_config() for H27UCG8T2ATR-BC
authorMiquel Raynal <miquel.raynal@bootlin.com>
Fri, 29 May 2020 11:13:19 +0000 (13:13 +0200)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Fri, 26 Jun 2020 06:35:08 +0000 (08:35 +0200)
This chip supports ONFI SDR timing mode 4, implement the new hook to
advertize it.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20200529111322.7184-26-miquel.raynal@bootlin.com
drivers/mtd/nand/raw/nand_hynix.c
drivers/mtd/nand/raw/nand_ids.c

index 7d1be53..6d08eb8 100644 (file)
@@ -673,6 +673,15 @@ static void hynix_nand_cleanup(struct nand_chip *chip)
        nand_set_manufacturer_data(chip, NULL);
 }
 
+static int
+h27ucg8t2atrbc_choose_interface_config(struct nand_chip *chip,
+                                      struct nand_interface_config *iface)
+{
+       onfi_fill_interface_config(chip, iface, NAND_SDR_IFACE, 4);
+
+       return nand_choose_best_sdr_timings(chip, iface, NULL);
+}
+
 static int hynix_nand_init(struct nand_chip *chip)
 {
        struct hynix_nand *hynix;
@@ -689,6 +698,11 @@ static int hynix_nand_init(struct nand_chip *chip)
 
        nand_set_manufacturer_data(chip, hynix);
 
+       if (!strncmp("H27UCG8T2ATR-BC", chip->parameters.model,
+                    sizeof("H27UCG8T2ATR-BC") - 1))
+               chip->ops.choose_interface_config =
+                       h27ucg8t2atrbc_choose_interface_config;
+
        ret = hynix_nand_rr_init(chip);
        if (ret)
                hynix_nand_cleanup(chip);
index c729a8b..3b890d5 100644 (file)
@@ -50,7 +50,7 @@ struct nand_flash_dev nand_flash_ids[] = {
        {"H27UCG8T2ATR-BC 64G 3.3V 8-bit",
                { .id = {0xad, 0xde, 0x94, 0xda, 0x74, 0xc4} },
                  SZ_8K, SZ_8K, SZ_2M, NAND_NEED_SCRAMBLING, 6, 640,
-                 NAND_ECC_INFO(40, SZ_1K), 4 },
+                 NAND_ECC_INFO(40, SZ_1K) },
 
        LEGACY_ID_NAND("NAND 4MiB 5V 8-bit",   0x6B, 4, SZ_8K, SP_OPTIONS),
        LEGACY_ID_NAND("NAND 4MiB 3,3V 8-bit", 0xE3, 4, SZ_8K, SP_OPTIONS),