From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932100AbbCEIf2 (ORCPT ); Thu, 5 Mar 2015 03:35:28 -0500 Received: from metis.ext.pengutronix.de ([92.198.50.35]:36528 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751390AbbCEIf1 (ORCPT ); Thu, 5 Mar 2015 03:35:27 -0500 Date: Thu, 5 Mar 2015 09:35:18 +0100 From: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= To: Mike Turquette , Stephen Boyd Cc: linux-arm-kernel@lists.infradead.org, =?iso-8859-1?Q?S=F6ren?= Brinkmann , linux-kernel@vger.kernel.org, kernel@pengutronix.de Subject: Re: [PATCH 1/3] clk: divider: fix calculation of maximal parent rate for a given divider Message-ID: <20150305083518.GR7865@pengutronix.de> References: <20150221085620.GV19388@pengutronix.de> <1424515225-6929-1-git-send-email-u.kleine-koenig@pengutronix.de> <1424515225-6929-2-git-send-email-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1424515225-6929-2-git-send-email-u.kleine-koenig@pengutronix.de> User-Agent: Mutt/1.5.21 (2010-09-15) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c0 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello Mike, hello Stephen, On Sat, Feb 21, 2015 at 11:40:23AM +0100, Uwe Kleine-König wrote: > The rate provided at the output of a clk-divider is calculated as: > > DIV_ROUND_UP(parent_rate, div) > > since commit b11d282dbea2 (clk: divider: fix rate calculation for > fractional rates). So to yield a rate not bigger than r parent_rate > must be <= r * div. > > The effect of choosing a parent rate that is too big as was done before > this patch results in wrongly ruling out good dividers. > > Note that this is not a complete fix as __clk_round_rate might return a > value >= its 2nd parameter. Also for dividers with > CLK_DIVIDER_ROUND_CLOSEST set the calculation is not accurate. But this > fixes the test case by Sascha Hauer that uses a chain of three dividers > under a fixed clock. > > Fixes: b11d282dbea2 (clk: divider: fix rate calculation for fractional rates) > Suggested-by: Sascha Hauer > Signed-off-by: Uwe Kleine-König Gentle ping. IMHO this is patch should go into 4.0. Feedback for patches 2 and 3 (or the alternative to rip off specialised round-closest) would be very welcome, too. Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |