[PATCH v2] mtd: nand: Sunxi calculate timing cfg

Boris Brezillon boris.brezillon at free-electrons.com
Tue Jun 9 05:29:41 PDT 2015


On Tue,  9 Jun 2015 13:31:38 +0200
Roy Spliet <r.spliet at ultimaker.com> wrote:


>  
> +	/* T16 - T19 + tCAD */
> +	tWB  = sunxi_nand_lookup_timing(tWB_lut, timings->tWB_max,
> +			min_clk_period);
> +	tADL = DIV_ROUND_UP(timings->tADL_min, min_clk_period) >> 3;
> +	tWHR = DIV_ROUND_UP(timings->tWHR_min, min_clk_period) >> 3;
> +	tRHW = sunxi_nand_lookup_timing(tRHW_lut, timings->tRHW_min,
> +			min_clk_period);
> +	tCAD = 0x7;
> +	chip->timing_cfg = (tWB & 0x3) |
> +			   (tADL & 0x3) << 2 |
> +			   (tWHR & 0x3) << 4 |
> +			   (tRHW & 0x3) << 6 |
> +			   (tCAD & 0x7) << 8;

Yet another comment: could you define a macro to create the timing_cfg
value ?

#define NFC_TIMING_CFG(tWB, tADL, tWHR, tRHW, tCAD)		\
	((tWB) & 0x3) | (((tADL) & 0x3) << 2) |			\
	(((tWHR) & 0x3) << 4) | (((tRHW) & 0x3) << 6) |		\
	(((tCAD) & 0x7) << 8);



-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com



More information about the linux-arm-kernel mailing list