All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: Roy Spliet <r.spliet@ultimaker.com>
Cc: David Woodhouse <dwmw2@infradead.org>,
	Maxime Ripard <maxime.ripard@free-electrons.com>,
	Brian Norris <computersforpeace@gmail.com>,
	Linux MTD <linux-mtd@lists.infradead.org>,
	Linux ARM Kernel <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v2] mtd: nand: Sunxi calculate timing cfg
Date: Tue, 9 Jun 2015 14:29:41 +0200	[thread overview]
Message-ID: <20150609142941.069f468d@bbrezillon> (raw)
In-Reply-To: <1433849498-3270-1-git-send-email-r.spliet@ultimaker.com>

On Tue,  9 Jun 2015 13:31:38 +0200
Roy Spliet <r.spliet@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

WARNING: multiple messages have this Message-ID (diff)
From: boris.brezillon@free-electrons.com (Boris Brezillon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2] mtd: nand: Sunxi calculate timing cfg
Date: Tue, 9 Jun 2015 14:29:41 +0200	[thread overview]
Message-ID: <20150609142941.069f468d@bbrezillon> (raw)
In-Reply-To: <1433849498-3270-1-git-send-email-r.spliet@ultimaker.com>

On Tue,  9 Jun 2015 13:31:38 +0200
Roy Spliet <r.spliet@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

  parent reply	other threads:[~2015-06-09 12:29 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-09 11:31 [PATCH v2] mtd: nand: Sunxi calculate timing cfg Roy Spliet
2015-06-09 11:31 ` Roy Spliet
2015-06-09 12:23 ` Boris Brezillon
2015-06-09 12:23   ` Boris Brezillon
2015-06-09 13:18   ` Roy Spliet
2015-06-09 13:18     ` Roy Spliet
2015-06-09 14:20     ` Boris Brezillon
2015-06-09 14:20       ` Boris Brezillon
2015-06-10  7:31       ` Roy Spliet
2015-06-10  7:31         ` Roy Spliet
     [not found]       ` <5577E783.8050900@ultimaker.com>
2015-06-10  7:45         ` Boris Brezillon
2015-06-10  7:45           ` Boris Brezillon
2015-06-09 12:29 ` Boris Brezillon [this message]
2015-06-09 12:29   ` Boris Brezillon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150609142941.069f468d@bbrezillon \
    --to=boris.brezillon@free-electrons.com \
    --cc=computersforpeace@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=maxime.ripard@free-electrons.com \
    --cc=r.spliet@ultimaker.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.