[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAD=FV=WnWaXLYkjb=6TrM79_MTMdTkhrgmCkLqHeV4sUdCYhug@mail.gmail.com>
Date: Thu, 26 Mar 2015 17:27:13 -0700
From: Doug Anderson <dianders@...omium.org>
To: Julius Werner <jwerner@...omium.org>
Cc: Mark Brown <broonie@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Heiko Stuebner <heiko@...ech.de>,
addy ke <addy.ke@...k-chips.com>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
linux-spi@...r.kernel.org,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/2] spi/rockchip: Round up clock rate divisor to err on
the safe side
Julius,
On Thu, Mar 26, 2015 at 4:30 PM, Julius Werner <jwerner@...omium.org> wrote:
> The Rockchip SPI driver currently calculates its clock rate divisor by
> integer dividing the parent rate by the target rate, and then rounding
> the result up to the next even number (since the divisor must be
> even).
>
> Clock rate divisors should always be rounded up, so that the resulting
> frequency is lower or equal to the target. This is correctly done in the
> second step here but not in the first, so we still have a risk of
> exceeding the desired target frequency (e.g. setting spi-max-frequency
> to 40000000 with a parent clock of 99000000 could lead to a divisor of
> 99000000 / 40000000 == 2 (which is even) that then results in an
> effective frequency of 99000000 / 2 == 49500000 (potentially exceeding
> the flash chip's specifications).
>
> This patch changes the division to round up to fix this problem.
>
> Signed-off-by: Julius Werner <jwerner@...omium.org>
> ---
> drivers/spi/spi-rockchip.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Doug Anderson <dianders@...omium.org>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists