From mboxrd@z Thu Jan 1 00:00:00 1970 From: viresh kumar Subject: Re: [PATCH 4/6] spi/spi-pl022: calculate_effective_freq() must set rate <= requested rate Date: Wed, 10 Aug 2011 09:06:43 +0530 Message-ID: <4E41FCCB.7040609@st.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: Vipin KUMAR , Rajeev KUMAR , Bhavna YADAV , Bhupesh SHARMA , Pratyush ANAND , Armando VISCONTI , Grant Likely , Shiraz HASHIM , Amit VIRDI , Vipul Kumar SAMAR , viresh kumar , deepak sikri , "spi-devel-general@lists.sourceforge.net" , "linux-arm-kernel@lists.infradead.org" To: Linus Walleij Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=m.gmane.org@lists.infradead.org List-Id: linux-spi.vger.kernel.org [Probably you missed reply-all by mistake, so adding them again] On 08/10/2011 01:34 AM, Linus Walleij wrote: > On Tue, Aug 9, 2011 at 1:05 PM, Viresh Kumar wrote: > >> There were few issues with calculate_effective_freq() routine: >> - It was returning first rate found >= requested rate. Now, if system have spi's >> rate as 83 MHz, with possible prescaled rates as 83, 41.5, 20.75, 13.83 (as we >> can prescale with multiples of 2). If user has given rate to be programmed as >> 22 MHz, then driver programmes it to 41.5 MHz. This looks to be incorrect, as >> user might have given the upper limit of the device, and we are programming it >> above it. >> - Driver finds the first satisfying rate and programmes it, but with other >> values of scr & cpsdvsr, it is possible to get more closer rate. > > Good that you found this bug! > >> +#define SPI_RATE(rate, cpsdvsr, scr) (rate / (cpsdvsr * (1 + scr))) > > Can you use a static inline instead of a macro? It is often preferred. > If you do, this is Acked-by. > Not a problem. Will surely do that. -- viresh