ARM: OMAP2+: nand: board_nand_init timing arguement
authorAfzal Mohammed <afzal@ti.com>
Wed, 29 Feb 2012 12:41:56 +0000 (18:11 +0530)
committerPhilip, Avinash <avinashphilip@ti.com>
Thu, 8 Mar 2012 11:55:42 +0000 (17:25 +0530)
Modify board_nand_init to take additional arguement,
timings for gpmc. Also rename the function to
omap_nand_init & let it return pointer to structure
of omap_nand_platform_data.

A prerequisite for combining different board nand
initialization functions.

Signed-off-by: Afzal Mohammed <afzal@ti.com>
Signed-off-by: Philip, Avinash <avinashphilip@ti.com>
arch/arm/mach-omap2/board-flash.c
arch/arm/mach-omap2/board-flash.h
arch/arm/mach-omap2/board-ldp.c
arch/arm/mach-omap2/board-omap3evm.c
arch/arm/mach-omap2/board-zoom.c

index 30a6f527510c05e624a692c936642693badba97e..caa1e82f1e72a95910663aaf71f2e71df9b18a04 100644 (file)
@@ -108,7 +108,7 @@ __init board_onenand_init(struct mtd_partition *nor_parts, u8 nr_parts, u8 cs)
                defined(CONFIG_MTD_NAND_OMAP2_MODULE)
 
 /* Note that all values in this struct are in nanoseconds */
-static struct gpmc_timings nand_timings = {
+struct gpmc_timings nand_default_timings = {
 
        .sync_clk = 0,
 
@@ -131,22 +131,21 @@ static struct gpmc_timings nand_timings = {
        .wr_data_mux_bus = 0,
 };
 
-static struct omap_nand_platform_data board_nand_data = {
-       .gpmc_t         = &nand_timings,
+static struct omap_nand_platform_data omap_nand_data = {
+       .gpmc_t         = &nand_default_timings,
 };
 
-void
-__init board_nand_init(struct mtd_partition *nand_parts,
-                       u8 nr_parts, u8 cs, int nand_type)
+struct omap_nand_platform_data *
+__init omap_nand_init(struct mtd_partition *nand_parts, u8 nr_parts, u8 cs,
+                               int nand_type, struct gpmc_timings *gpmc_t)
 {
-       board_nand_data.cs              = cs;
-       board_nand_data.parts           = nand_parts;
-       board_nand_data.nr_parts        = nr_parts;
-       board_nand_data.devsize         = nand_type;
-
-       board_nand_data.ecc_opt = OMAP_ECC_HAMMING_CODE_DEFAULT;
-       board_nand_data.gpmc_irq = OMAP_GPMC_IRQ_BASE + cs;
-       gpmc_nand_init(&board_nand_data);
+       omap_nand_data.cs               = cs;
+       omap_nand_data.parts            = nand_parts;
+       omap_nand_data.nr_parts         = nr_parts;
+       omap_nand_data.devsize          = nand_type;
+       omap_nand_data.gpmc_t           = gpmc_t;
+
+       return &omap_nand_data;
 }
 #endif /* CONFIG_MTD_NAND_OMAP2 || CONFIG_MTD_NAND_OMAP2_MODULE */
 
@@ -242,6 +241,7 @@ void board_flash_init(struct flash_partitions partition_info[],
        if (nandcs > GPMC_CS_NUM)
                pr_err("NAND: Unable to find configuration in GPMC\n");
        else
-               board_nand_init(partition_info[2].parts,
-                       partition_info[2].nr_parts, nandcs, nand_type);
+               omap_nand_init(partition_info[2].parts,
+                       partition_info[2].nr_parts, nandcs,
+                       nand_type, &nand_default_timings);
 }
index d25503a98417d6d8b02a5bd1fb8ace8af1e9fcf3..b758990b3ca17c1b48f61e7d9c7a7896820a7a2c 100644 (file)
@@ -39,11 +39,14 @@ static inline void board_flash_init(struct flash_partitions part[],
 
 #if defined(CONFIG_MTD_NAND_OMAP2) || \
                defined(CONFIG_MTD_NAND_OMAP2_MODULE)
-extern void board_nand_init(struct mtd_partition *nand_parts,
-                                       u8 nr_parts, u8 cs, int nand_type);
+extern struct gpmc_timings nand_default_timings;
+extern struct omap_nand_platform_data *
+__init omap_nand_init(struct mtd_partition *nand_parts, u8 nr_parts, u8 cs,
+                               int nand_type, struct gpmc_timings *gpmc_t);
 #else
-static inline void board_nand_init(struct mtd_partition *nand_parts,
-                                       u8 nr_parts, u8 cs, int nand_type)
+static inline struct omap_nand_platform_data *
+omap_nand_init(struct mtd_partition *nand_parts,
+               u8 nr_parts, u8 cs, int nand_type, struct gpmc_timings *gpmc_t);
 {
 }
 #endif
index 13bde0e6693463a61610eba0749ad2315571e119..09e92356afab23774d3c8005e8a35a81ca6b5ff4 100644 (file)
@@ -421,8 +421,8 @@ static void __init omap_ldp_init(void)
        omap_serial_init();
        omap_sdrc_init(NULL, NULL);
        usb_musb_init(NULL);
-       board_nand_init(ldp_nand_partitions,
-               ARRAY_SIZE(ldp_nand_partitions), ZOOM_NAND_CS, 0);
+       omap_nand_init(ldp_nand_partitions, ARRAY_SIZE(ldp_nand_partitions),
+                               ZOOM_NAND_CS, 0, &nand_default_timings);
 
        omap2_hsmmc_init(mmc);
        ldp_display_init();
index 1284e6e524fe9c521ffcb020e2b1f8bb399aacdb..620056f9ed77ad43715e22e1da6ebd520d2ac4bf 100644 (file)
@@ -672,6 +672,12 @@ static void __init omap3_evm_init(void)
                pr_err("error setting wl12xx data\n");
        platform_device_register(&omap3evm_wlan_regulator);
 #endif
+       /* NAND */
+       omap_nand_init(omap3_evm_nand_partitions,
+                       ARRAY_SIZE(omap3_evm_nand_partitions),
+                       0, NAND_BUSWIDTH_16, &nand_default_timings);
+       board_onenand_init(omap3_evm_onenand_partitions,
+                       ARRAY_SIZE(omap3_evm_onenand_partitions), 0);
 }
 
 MACHINE_START(OMAP3EVM, "OMAP3 EVM")
index 70e5b54a2115ec3adfbaa6746e619f28ccb8655a..fb6d606755c635cf8c16e4965cb9d55a1b2e714a 100644 (file)
@@ -114,8 +114,9 @@ static void __init omap_zoom_init(void)
                usbhs_init(&usbhs_bdata);
        }
 
-       board_nand_init(zoom_nand_partitions, ARRAY_SIZE(zoom_nand_partitions),
-                                               ZOOM_NAND_CS, NAND_BUSWIDTH_16);
+       omap_nand_init(zoom_nand_partitions,
+                       ARRAY_SIZE(zoom_nand_partitions), ZOOM_NAND_CS,
+                       NAND_BUSWIDTH_16, &nand_default_timings);
        zoom_debugboard_init();
        zoom_peripherals_init();