From mboxrd@z Thu Jan 1 00:00:00 1970 From: R, Vignesh Date: Fri, 14 Oct 2016 16:18:40 +0530 Subject: [U-Boot] [PATCH 2/2] spi: ti_qspi: Fix baudrate divider calculation In-Reply-To: References: <20161012041620.25077-1-vigneshr@ti.com> <20161012041620.25077-2-vigneshr@ti.com> <53018cd2-21f7-0e42-0f10-059884bc672f@ti.com> Message-ID: <985f4eae-c08b-2cce-3efd-e91ae2806c6e@ti.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 10/14/2016 12:27 PM, Jagan Teki wrote: > On Fri, Oct 14, 2016 at 10:54 AM, Vignesh R wrote: ... >>>> DECLARE_GLOBAL_DATA_PTR; >>>> >>>> @@ -118,7 +119,7 @@ static void ti_spi_set_speed(struct ti_qspi_priv *priv, uint hz) >>>> if (!hz) >>>> clk_div = 0; >>>> else >>>> - clk_div = (priv->fclk / hz) - 1; >>>> + clk_div = DIV_ROUND_UP(priv->fclk, hz) - 1; >>> >>> Better to have a checks for min and max divider values or mask. >> >> That code already exists in this function. > > True but it's unnecessary to print the wrong baud prior to checking. > Do the check, then print/debug and finally write reg. > Posted a v2 in reply to the patch. Thanks for the review! Regards Vignesh