mtd: rawnand: add default values for dynamic timings
[sfrench/cifs-2.6.git] / drivers / mtd / nand / raw / nand_timings.c
index 7c4e4a371bbc586a07b28ea087f62ddf881dae96..9bb599106a31486b223b0ff8d04b97b7565b6c4e 100644 (file)
@@ -13,6 +13,8 @@
 #include <linux/export.h>
 #include <linux/mtd/rawnand.h>
 
+#define ONFI_DYN_TIMING_MAX U16_MAX
+
 static const struct nand_data_interface onfi_sdr_timings[] = {
        /* Mode 0 */
        {
@@ -303,7 +305,7 @@ int onfi_fill_data_interface(struct nand_chip *chip,
 
        /*
         * Initialize timings that cannot be deduced from timing mode:
-        * tR, tPROG, tCCS, ...
+        * tPROG, tBERS, tR and tCCS.
         * These information are part of the ONFI parameter page.
         */
        if (chip->parameters.onfi.version) {
@@ -317,6 +319,22 @@ int onfi_fill_data_interface(struct nand_chip *chip,
 
                /* nanoseconds -> picoseconds */
                timings->tCCS_min = 1000UL * params->onfi.tCCS;
+       } else {
+               struct nand_sdr_timings *timings = &iface->timings.sdr;
+               /*
+                * For non-ONFI chips we use the highest possible value for
+                * tPROG and tBERS. tR and tCCS will take the default values
+                * precised in the ONFI specification for timing mode 0,
+                * respectively 200us and 500ns.
+                */
+
+               /* microseconds -> picoseconds */
+               timings->tPROG_max = 1000000ULL * ONFI_DYN_TIMING_MAX;
+               timings->tBERS_max = 1000000ULL * ONFI_DYN_TIMING_MAX;
+               timings->tR_max = 1000000ULL * 200000000ULL;
+
+               /* nanoseconds -> picoseconds */
+               timings->tCCS_min = 1000UL * 500000;
        }
 
        return 0;