lkml.org 
[lkml]   [2013]   [Dec]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 03/36] mtd: st_spi_fsm: Initialise and configure the FSM for normal working conditions
On Tue, Dec 10, 2013 at 11:01:00AM -0800, Brian Norris wrote:
> On Fri, Nov 29, 2013 at 12:18:52PM +0000, Lee Jones wrote:
> > + /*
> > + * Calculate clk_div - values between 2 and 128
> > + * Multiple of 2, rounded up
> > + */
> > + clk_div = 2*((emi_freq + (2*spi_freq - 1))/(2*spi_freq));
>
> I think this can use the <linux/kerne.h> round_up() macro. Also, you're
> missing some spacing. Possibly:
>
> clk_div = 2 * round_up(emi_freq, 2 * spi_freq);

Sorry, I was reading one thing and writing another; this would be
DIV_ROUND_UP():

clk_div = 2 * DIV_ROUND_UP(emi_freq, 2 * spi_freq);

> > + fsm->fifo_dir_delay = (clk_div + 9) / 10;
>
> round_down()?

Sorry, I again meant DIV_ROUND_UP:

fsm->fifo_dir_delay = DIV_ROUND_UP(clk_div, 10);

Brian


\
 
 \ /
  Last update: 2013-12-10 21:21    [W:0.050 / U:1.236 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site