mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
mtd: nand: sunxi: adapt clk_rate to tWB, tADL, tWHR and tRHW timings
Adapt the NAND controller clk rate to the tWB, tADL, tWHR and tRHW timings instead of returning an error when the maximum clk divisor is not big enough to provide an appropriate timing. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
This commit is contained in:
parent
2d43457f79
commit
5abcd95d8c
1 changed files with 12 additions and 0 deletions
|
@ -1163,6 +1163,18 @@ static int sunxi_nand_chip_set_timings(struct sunxi_nand_chip *chip,
|
|||
min_clk_period = DIV_ROUND_UP(timings->tWC_min, 2);
|
||||
|
||||
/* T16 - T19 + tCAD */
|
||||
if (timings->tWB_max > (min_clk_period * 20))
|
||||
min_clk_period = DIV_ROUND_UP(timings->tWB_max, 20);
|
||||
|
||||
if (timings->tADL_min > (min_clk_period * 32))
|
||||
min_clk_period = DIV_ROUND_UP(timings->tADL_min, 32);
|
||||
|
||||
if (timings->tWHR_min > (min_clk_period * 32))
|
||||
min_clk_period = DIV_ROUND_UP(timings->tWHR_min, 32);
|
||||
|
||||
if (timings->tRHW_min > (min_clk_period * 20))
|
||||
min_clk_period = DIV_ROUND_UP(timings->tRHW_min, 20);
|
||||
|
||||
tWB = sunxi_nand_lookup_timing(tWB_lut, timings->tWB_max,
|
||||
min_clk_period);
|
||||
if (tWB < 0) {
|
||||
|
|
Loading…
Add table
Reference in a new issue