diff options
author | Adrian Hunter <adrian.hunter@nokia.com> | 2011-02-07 03:46:58 -0500 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2011-02-17 18:44:45 -0500 |
commit | 1435ca0fc1a269f9496343e24223a0fc430aff7a (patch) | |
tree | 88b23f790a7b1076a1ae104d1aca609cef67b672 /arch/arm/mach-omap2/gpmc-onenand.c | |
parent | f040d33253b2daf6f305fc35fca2399047ced028 (diff) |
OMAP: OneNAND: fix 104MHz support
104MHz needs a latency of 8 clock cycles and the VHF
flag must be set. Also t_rdyo is specified as
"not applicable" so pick a lower value, and force at
least 1 clk between AVD High to OE Low.
Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap2/gpmc-onenand.c')
-rw-r--r-- | arch/arm/mach-omap2/gpmc-onenand.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/arch/arm/mach-omap2/gpmc-onenand.c b/arch/arm/mach-omap2/gpmc-onenand.c index 3a7d25fb00ef..3a4307b8f7cf 100644 --- a/arch/arm/mach-omap2/gpmc-onenand.c +++ b/arch/arm/mach-omap2/gpmc-onenand.c | |||
@@ -94,7 +94,7 @@ static int omap2_onenand_set_async_mode(int cs, void __iomem *onenand_base) | |||
94 | } | 94 | } |
95 | 95 | ||
96 | static void set_onenand_cfg(void __iomem *onenand_base, int latency, | 96 | static void set_onenand_cfg(void __iomem *onenand_base, int latency, |
97 | int sync_read, int sync_write, int hf) | 97 | int sync_read, int sync_write, int hf, int vhf) |
98 | { | 98 | { |
99 | u32 reg; | 99 | u32 reg; |
100 | 100 | ||
@@ -114,6 +114,10 @@ static void set_onenand_cfg(void __iomem *onenand_base, int latency, | |||
114 | reg |= ONENAND_SYS_CFG1_HF; | 114 | reg |= ONENAND_SYS_CFG1_HF; |
115 | else | 115 | else |
116 | reg &= ~ONENAND_SYS_CFG1_HF; | 116 | reg &= ~ONENAND_SYS_CFG1_HF; |
117 | if (vhf) | ||
118 | reg |= ONENAND_SYS_CFG1_VHF; | ||
119 | else | ||
120 | reg &= ~ONENAND_SYS_CFG1_VHF; | ||
117 | writew(reg, onenand_base + ONENAND_REG_SYS_CFG1); | 121 | writew(reg, onenand_base + ONENAND_REG_SYS_CFG1); |
118 | } | 122 | } |
119 | 123 | ||
@@ -130,7 +134,7 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg, | |||
130 | const int t_wph = 30; | 134 | const int t_wph = 30; |
131 | int min_gpmc_clk_period, t_ces, t_avds, t_avdh, t_ach, t_aavdh, t_rdyo; | 135 | int min_gpmc_clk_period, t_ces, t_avds, t_avdh, t_ach, t_aavdh, t_rdyo; |
132 | int tick_ns, div, fclk_offset_ns, fclk_offset, gpmc_clk_ns, latency; | 136 | int tick_ns, div, fclk_offset_ns, fclk_offset, gpmc_clk_ns, latency; |
133 | int first_time = 0, hf = 0, sync_read = 0, sync_write = 0; | 137 | int first_time = 0, hf = 0, vhf = 0, sync_read = 0, sync_write = 0; |
134 | int err, ticks_cez; | 138 | int err, ticks_cez; |
135 | int cs = cfg->cs; | 139 | int cs = cfg->cs; |
136 | u32 reg; | 140 | u32 reg; |
@@ -180,7 +184,7 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg, | |||
180 | t_avdh = 2; | 184 | t_avdh = 2; |
181 | t_ach = 3; | 185 | t_ach = 3; |
182 | t_aavdh = 6; | 186 | t_aavdh = 6; |
183 | t_rdyo = 9; | 187 | t_rdyo = 6; |
184 | break; | 188 | break; |
185 | case 83: | 189 | case 83: |
186 | min_gpmc_clk_period = 12000; /* 83 MHz */ | 190 | min_gpmc_clk_period = 12000; /* 83 MHz */ |
@@ -217,7 +221,11 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg, | |||
217 | gpmc_clk_ns = gpmc_ticks_to_ns(div); | 221 | gpmc_clk_ns = gpmc_ticks_to_ns(div); |
218 | if (gpmc_clk_ns < 15) /* >66Mhz */ | 222 | if (gpmc_clk_ns < 15) /* >66Mhz */ |
219 | hf = 1; | 223 | hf = 1; |
220 | if (hf) | 224 | if (gpmc_clk_ns < 12) /* >83Mhz */ |
225 | vhf = 1; | ||
226 | if (vhf) | ||
227 | latency = 8; | ||
228 | else if (hf) | ||
221 | latency = 6; | 229 | latency = 6; |
222 | else if (gpmc_clk_ns >= 25) /* 40 MHz*/ | 230 | else if (gpmc_clk_ns >= 25) /* 40 MHz*/ |
223 | latency = 3; | 231 | latency = 3; |
@@ -226,7 +234,7 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg, | |||
226 | 234 | ||
227 | if (first_time) | 235 | if (first_time) |
228 | set_onenand_cfg(onenand_base, latency, | 236 | set_onenand_cfg(onenand_base, latency, |
229 | sync_read, sync_write, hf); | 237 | sync_read, sync_write, hf, vhf); |
230 | 238 | ||
231 | if (div == 1) { | 239 | if (div == 1) { |
232 | reg = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG2); | 240 | reg = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG2); |
@@ -264,6 +272,9 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg, | |||
264 | /* Read */ | 272 | /* Read */ |
265 | t.adv_rd_off = gpmc_ticks_to_ns(fclk_offset + gpmc_ns_to_ticks(t_avdh)); | 273 | t.adv_rd_off = gpmc_ticks_to_ns(fclk_offset + gpmc_ns_to_ticks(t_avdh)); |
266 | t.oe_on = gpmc_ticks_to_ns(fclk_offset + gpmc_ns_to_ticks(t_ach)); | 274 | t.oe_on = gpmc_ticks_to_ns(fclk_offset + gpmc_ns_to_ticks(t_ach)); |
275 | /* Force at least 1 clk between AVD High to OE Low */ | ||
276 | if (t.oe_on <= t.adv_rd_off) | ||
277 | t.oe_on = t.adv_rd_off + gpmc_round_ns_to_ticks(1); | ||
267 | t.access = gpmc_ticks_to_ns(fclk_offset + (latency + 1) * div); | 278 | t.access = gpmc_ticks_to_ns(fclk_offset + (latency + 1) * div); |
268 | t.oe_off = t.access + gpmc_round_ns_to_ticks(1); | 279 | t.oe_off = t.access + gpmc_round_ns_to_ticks(1); |
269 | t.cs_rd_off = t.oe_off; | 280 | t.cs_rd_off = t.oe_off; |
@@ -317,7 +328,7 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg, | |||
317 | if (err) | 328 | if (err) |
318 | return err; | 329 | return err; |
319 | 330 | ||
320 | set_onenand_cfg(onenand_base, latency, sync_read, sync_write, hf); | 331 | set_onenand_cfg(onenand_base, latency, sync_read, sync_write, hf, vhf); |
321 | 332 | ||
322 | return 0; | 333 | return 0; |
323 | } | 334 | } |