Skip to content

Commit 2970bf5

Browse files
passgatmiquelraynal
authored andcommitted
mtd: rawnand: gpmi: fix controller timings setting
Set the controller registers according to the real clock rate. The controller registers configuration (setup, hold, timeout, ... cycles) depends on the clock rate of the GPMI. Using the real rate instead of the ideal one, avoids that this inaccuracy (required_rate - real_rate) affects the registers setting. This patch has been tested on two custom boards with i.MX28 and i.MX6 SOCs: - i.MX28: required rate 100MHz, real rate 99.3MHz - i.MX6 required rate 100MHz, real rate 99MHz Fixes: b120612 ("mtd: rawnand: gpmi: use core timings instead of an empirical derivation") Co-developed-by: Michael Trimarchi <[email protected]> Signed-off-by: Michael Trimarchi <[email protected]> Signed-off-by: Dario Binacchi <[email protected]> Tested-by: Sascha Hauer <[email protected]> Reviewed-by: Sascha Hauer <[email protected]> Signed-off-by: Miquel Raynal <[email protected]> Link: https://lore.kernel.org/linux-mtd/[email protected]
1 parent feca4cc commit 2970bf5

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,7 @@ static void gpmi_nfc_compute_timings(struct gpmi_nand_data *this,
648648
const struct nand_sdr_timings *sdr)
649649
{
650650
struct gpmi_nfc_hardware_timing *hw = &this->hw;
651+
struct resources *r = &this->resources;
651652
unsigned int dll_threshold_ps = this->devdata->max_chain_delay;
652653
unsigned int period_ps, reference_period_ps;
653654
unsigned int data_setup_cycles, data_hold_cycles, addr_setup_cycles;
@@ -671,6 +672,8 @@ static void gpmi_nfc_compute_timings(struct gpmi_nand_data *this,
671672
wrn_dly_sel = BV_GPMI_CTRL1_WRN_DLY_SEL_NO_DELAY;
672673
}
673674

675+
hw->clk_rate = clk_round_rate(r->clock[0], hw->clk_rate);
676+
674677
/* SDR core timings are given in picoseconds */
675678
period_ps = div_u64((u64)NSEC_PER_SEC * 1000, hw->clk_rate);
676679

0 commit comments

Comments
 (0)