10101111 */
1212
13- #include <linux/kernel.h>
14- #include <linux/module.h>
15- #include <linux/platform_device.h>
1613#include <linux/err.h>
1714#include <linux/iopoll.h>
18- #include <linux/mtd/rawnand.h>
15+ #include <linux/kernel.h>
16+ #include <linux/module.h>
1917#include <linux/mtd/partitions.h>
18+ #include <linux/mtd/rawnand.h>
19+ #include <linux/platform_device.h>
20+ #include <linux/property.h>
2021#include <linux/slab.h>
21- #include <linux/of.h>
2222
2323#define NRCSR_OFFSET 0x00
2424#define NANDFCR_OFFSET 0x60
@@ -487,10 +487,10 @@ static const struct of_device_id davinci_nand_of_match[] = {
487487};
488488MODULE_DEVICE_TABLE (of , davinci_nand_of_match );
489489
490- static struct davinci_nand_pdata
491- * nand_davinci_get_pdata (struct platform_device * pdev )
490+ static struct davinci_nand_pdata *
491+ nand_davinci_get_pdata (struct platform_device * pdev )
492492{
493- if (!dev_get_platdata (& pdev -> dev ) && pdev -> dev . of_node ) {
493+ if (!dev_get_platdata (& pdev -> dev )) {
494494 struct davinci_nand_pdata * pdata ;
495495 const char * mode ;
496496 u32 prop ;
@@ -501,40 +501,42 @@ static struct davinci_nand_pdata
501501 pdev -> dev .platform_data = pdata ;
502502 if (!pdata )
503503 return ERR_PTR (- ENOMEM );
504- if (!of_property_read_u32 ( pdev -> dev . of_node ,
505- "ti,davinci-chipselect" , & prop ))
504+ if (!device_property_read_u32 ( & pdev -> dev ,
505+ "ti,davinci-chipselect" , & prop ))
506506 pdata -> core_chipsel = prop ;
507507 else
508508 return ERR_PTR (- EINVAL );
509509
510- if (!of_property_read_u32 ( pdev -> dev . of_node ,
511- "ti,davinci-mask-ale" , & prop ))
510+ if (!device_property_read_u32 ( & pdev -> dev ,
511+ "ti,davinci-mask-ale" , & prop ))
512512 pdata -> mask_ale = prop ;
513- if (!of_property_read_u32 ( pdev -> dev . of_node ,
514- "ti,davinci-mask-cle" , & prop ))
513+ if (!device_property_read_u32 ( & pdev -> dev ,
514+ "ti,davinci-mask-cle" , & prop ))
515515 pdata -> mask_cle = prop ;
516- if (!of_property_read_u32 ( pdev -> dev . of_node ,
517- "ti,davinci-mask-chipsel" , & prop ))
516+ if (!device_property_read_u32 ( & pdev -> dev ,
517+ "ti,davinci-mask-chipsel" , & prop ))
518518 pdata -> mask_chipsel = prop ;
519- if (!of_property_read_string (pdev -> dev .of_node ,
520- "ti,davinci-ecc-mode" , & mode )) {
519+ if (!device_property_read_string (& pdev -> dev ,
520+ "ti,davinci-ecc-mode" ,
521+ & mode )) {
521522 if (!strncmp ("none" , mode , 4 ))
522523 pdata -> engine_type = NAND_ECC_ENGINE_TYPE_NONE ;
523524 if (!strncmp ("soft" , mode , 4 ))
524525 pdata -> engine_type = NAND_ECC_ENGINE_TYPE_SOFT ;
525526 if (!strncmp ("hw" , mode , 2 ))
526527 pdata -> engine_type = NAND_ECC_ENGINE_TYPE_ON_HOST ;
527528 }
528- if (!of_property_read_u32 ( pdev -> dev . of_node ,
529- "ti,davinci-ecc-bits" , & prop ))
529+ if (!device_property_read_u32 ( & pdev -> dev ,
530+ "ti,davinci-ecc-bits" , & prop ))
530531 pdata -> ecc_bits = prop ;
531532
532- if (!of_property_read_u32 (pdev -> dev .of_node ,
533- "ti,davinci-nand-buswidth" , & prop ) && prop == 16 )
533+ if (!device_property_read_u32 (& pdev -> dev ,
534+ "ti,davinci-nand-buswidth" ,
535+ & prop ) && prop == 16 )
534536 pdata -> options |= NAND_BUSWIDTH_16 ;
535537
536- if (of_property_read_bool ( pdev -> dev . of_node ,
537- "ti,davinci-nand-use-bbt" ))
538+ if (device_property_read_bool ( & pdev -> dev ,
539+ "ti,davinci-nand-use-bbt" ))
538540 pdata -> bbt_options = NAND_BBT_USE_FLASH ;
539541
540542 /*
@@ -548,17 +550,15 @@ static struct davinci_nand_pdata
548550 * then use "ti,davinci-nand" as the compatible in your
549551 * device-tree file.
550552 */
551- if (of_device_is_compatible (pdev -> dev .of_node ,
552- "ti,keystone-nand" )) {
553+ if (device_is_compatible (& pdev -> dev , "ti,keystone-nand" ))
553554 pdata -> options |= NAND_NO_SUBPAGE_WRITE ;
554- }
555555 }
556556
557557 return dev_get_platdata (& pdev -> dev );
558558}
559559#else
560- static struct davinci_nand_pdata
561- * nand_davinci_get_pdata (struct platform_device * pdev )
560+ static struct davinci_nand_pdata *
561+ nand_davinci_get_pdata (struct platform_device * pdev )
562562{
563563 return dev_get_platdata (& pdev -> dev );
564564}
0 commit comments