ARM OMAP2+ GPMC: calculate GPMCFCLKDIVIDER based on WAITMONITORINGTIME
authorRobert ABEL <rabel@cit-ec.uni-bielefeld.de>
Fri, 27 Feb 2015 15:56:53 +0000 (16:56 +0100)
committerRoger Quadros <rogerq@ti.com>
Fri, 6 Mar 2015 10:39:48 +0000 (12:39 +0200)
The WAITMONITORINGTIME is expressed as a number of GPMC_CLK clock cycles,
even though the access is defined as asynchronous, and no GPMC_CLK clock
is provided to the external device. Still, GPMCFCLKDIVIDER is used as a divider
for the GPMC clock, so it must be programmed to define the
correct WAITMONITORINGTIME delay.

Calculate GPMCFCLKDIVIDER independent of gpmc,sync-clk-ps in DT for
pure asynchronous accesses, i.e. both read and write asynchronous.

Signed-off-by: Robert ABEL <rabel@cit-ec.uni-bielefeld.de>
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Roger Quadros <rogerq@ti.com>
arch/arm/mach-omap2/gpmc-nand.c
arch/arm/mach-omap2/gpmc-onenand.c
arch/arm/mach-omap2/usb-tusb6010.c
drivers/memory/omap-gpmc.c
include/linux/omap-gpmc.h

index d5951b1..72918c4 100644 (file)
@@ -96,14 +96,6 @@ int gpmc_nand_init(struct omap_nand_platform_data *gpmc_nand_data,
        gpmc_nand_res[1].start = gpmc_get_client_irq(GPMC_IRQ_FIFOEVENTENABLE);
        gpmc_nand_res[2].start = gpmc_get_client_irq(GPMC_IRQ_COUNT_EVENT);
 
-       if (gpmc_t) {
-               err = gpmc_cs_set_timings(gpmc_nand_data->cs, gpmc_t);
-               if (err < 0) {
-                       pr_err("omap2-gpmc: Unable to set gpmc timings: %d\n", err);
-                       return err;
-               }
-       }
-
        memset(&s, 0, sizeof(struct gpmc_settings));
        if (gpmc_nand_data->of_node)
                gpmc_read_settings_dt(gpmc_nand_data->of_node, &s);
@@ -111,6 +103,16 @@ int gpmc_nand_init(struct omap_nand_platform_data *gpmc_nand_data,
                gpmc_set_legacy(gpmc_nand_data, &s);
 
        s.device_nand = true;
+
+       if (gpmc_t) {
+               err = gpmc_cs_set_timings(gpmc_nand_data->cs, gpmc_t, &s);
+               if (err < 0) {
+                       pr_err("omap2-gpmc: Unable to set gpmc timings: %d\n",
+                              err);
+                       return err;
+               }
+       }
+
        err = gpmc_cs_program_settings(gpmc_nand_data->cs, &s);
        if (err < 0)
                goto out_free_cs;
Simple merge
Simple merge
Simple merge
Simple merge