Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mtd: nand: davinci: adjust DT properties to MTD generic

The properties davinci-ecc-mode, davinci-nand-use-bbt, davinci-nand-buswidth
are MTD generic. Correct names for them are: nand-ecc-mode, nand-on-flash-bbt,
nand-bus-width accordingly. So rename them in dts and documentation.

Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>
Reviewed-by: Taras Kondratiuk <taras@ti.com>
Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@ti.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>

authored by

Ivan Khoronzhuk and committed by
Brian Norris
75be1ea2 9ba51cff

+30 -9
+20 -5
Documentation/devicetree/bindings/mtd/davinci-nand.txt
··· 37 37 - ti,davinci-mask-chipsel: mask for chipselect address. Needed to mask 38 38 addresses for given chipselect. 39 39 40 - - ti,davinci-ecc-mode: operation mode of the NAND ecc mode. ECC mode 40 + - nand-ecc-mode: operation mode of the NAND ecc mode. ECC mode 41 41 valid values for davinci driver: 42 42 - "none" 43 43 - "soft" ··· 45 45 46 46 - ti,davinci-ecc-bits: used ECC bits, currently supported 1 or 4. 47 47 48 - - ti,davinci-nand-buswidth: buswidth 8 or 16. 48 + - nand-bus-width: buswidth 8 or 16. If not present 8. 49 + 50 + - nand-on-flash-bbt: use flash based bad block table support. OOB 51 + identifier is saved in OOB area. If not present 52 + false. 53 + 54 + Deprecated properties: 55 + 56 + - ti,davinci-ecc-mode: operation mode of the NAND ecc mode. ECC mode 57 + valid values for davinci driver: 58 + - "none" 59 + - "soft" 60 + - "hw" 61 + 62 + - ti,davinci-nand-buswidth: buswidth 8 or 16. If not present 8. 49 63 50 64 - ti,davinci-nand-use-bbt: use flash based bad block table support. OOB 51 - identifier is saved in OOB area. 65 + identifier is saved in OOB area. If not present 66 + false. 52 67 53 68 Nand device bindings may contain additional sub-nodes describing partitions of 54 69 the address space. See partition.txt for more detail. The NAND Flash timing ··· 81 66 ti,davinci-mask-ale = <0>; 82 67 ti,davinci-mask-cle = <0>; 83 68 ti,davinci-mask-chipsel = <0>; 84 - ti,davinci-ecc-mode = "hw"; 69 + nand-ecc-mode = "hw"; 85 70 ti,davinci-ecc-bits = <4>; 86 - ti,davinci-nand-use-bbt; 71 + nand-on-flash-bbt; 87 72 88 73 partition@180000 { 89 74 label = "ubifs";
+10 -4
drivers/mtd/nand/davinci_nand.c
··· 35 35 #include <linux/slab.h> 36 36 #include <linux/of_device.h> 37 37 #include <linux/of.h> 38 + #include <linux/of_mtd.h> 38 39 39 40 #include <linux/platform_data/mtd-davinci.h> 40 41 #include <linux/platform_data/mtd-davinci-aemif.h> ··· 535 534 struct davinci_nand_pdata *pdata; 536 535 const char *mode; 537 536 u32 prop; 538 - int len; 539 537 540 538 pdata = devm_kzalloc(&pdev->dev, 541 539 sizeof(struct davinci_nand_pdata), ··· 558 558 "ti,davinci-mask-chipsel", &prop)) 559 559 pdata->mask_chipsel = prop; 560 560 if (!of_property_read_string(pdev->dev.of_node, 561 + "nand-ecc-mode", &mode) || 562 + !of_property_read_string(pdev->dev.of_node, 561 563 "ti,davinci-ecc-mode", &mode)) { 562 564 if (!strncmp("none", mode, 4)) 563 565 pdata->ecc_mode = NAND_ECC_NONE; ··· 571 569 if (!of_property_read_u32(pdev->dev.of_node, 572 570 "ti,davinci-ecc-bits", &prop)) 573 571 pdata->ecc_bits = prop; 574 - if (!of_property_read_u32(pdev->dev.of_node, 572 + 573 + prop = of_get_nand_bus_width(pdev->dev.of_node); 574 + if (0 < prop || !of_property_read_u32(pdev->dev.of_node, 575 575 "ti,davinci-nand-buswidth", &prop)) 576 576 if (prop == 16) 577 577 pdata->options |= NAND_BUSWIDTH_16; 578 - if (of_find_property(pdev->dev.of_node, 579 - "ti,davinci-nand-use-bbt", &len)) 578 + if (of_property_read_bool(pdev->dev.of_node, 579 + "nand-on-flash-bbt") || 580 + of_property_read_bool(pdev->dev.of_node, 581 + "ti,davinci-nand-use-bbt")) 580 582 pdata->bbt_options = NAND_BBT_USE_FLASH; 581 583 } 582 584