Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752816AbbDFSyR (ORCPT ); Mon, 6 Apr 2015 14:54:17 -0400 Received: from mail-gw1-out.broadcom.com ([216.31.210.62]:60149 "EHLO mail-gw1-out.broadcom.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751331AbbDFSyP (ORCPT ); Mon, 6 Apr 2015 14:54:15 -0400 X-IronPort-AV: E=Sophos;i="5.11,533,1422950400"; d="scan'208";a="61541801" Message-ID: <5522D652.4020205@broadcom.com> Date: Mon, 6 Apr 2015 11:54:10 -0700 From: Jonathan Richardson User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: Mark Brown CC: Florian Fainelli , Dmitry Torokhov , Anatol Pomazau , Scott Branden , Rob Herring , Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala , , , bcm-kernel-feedback-list , , Rafal Milecki , Brian Norris , Kevin Cernekee Subject: Re: [PATCH 4/4] spi: bcm-mspi: Add support to set serial baud clock rate References: <1428002603-21892-1-git-send-email-jonathar@broadcom.com> <1428002603-21892-5-git-send-email-jonathar@broadcom.com> <552037BB.7050803@gmail.com> <20150406094636.GC6023@sirena.org.uk> In-Reply-To: <20150406094636.GC6023@sirena.org.uk> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1695 Lines: 37 On 15-04-06 02:46 AM, Mark Brown wrote: > On Sat, Apr 04, 2015 at 12:12:59PM -0700, Florian Fainelli wrote: >> Le 02/04/2015 12:23, Jonathan Richardson a ?crit : > >>> + /* Calculate SPBR if clock-frequency provided. */ >>> + if (of_property_read_u32(dev->of_node, "clock-frequency", >>> + &desired_rate) >= 0) { >>> + u32 spbr = clk_get_rate(data->clk) / (2 * desired_rate); > >> Usually, specifying a "clock-frequency" property is done when there is >> no clock provider available, yet we take this code path only if we could >> find a "mspi_clk" which sounds a litle weird. > >> Once there is a proper "mspi_clk" clock, I would make it mandatory for >> the clock provider to be able to provide the rate as well? > > As far as I can tell it's already mandatory if the property is present - > it's taking the clock presented to the block and then using an internal > divider to bring that down to the desired rate. > > We are missing error handling though. > Thanks for the review. Yes that's correct. I also tried to make it backwards compatible with the current version of the driver where you can ignore configuring the frequency. The result being ref clock frequency / 2 * 255. If you provide the clock then it will enable/prepare it. If you also provide clock-frequency then it will configure the SPBR. If you don't provide anything then it works as before - it assumes the clock is already enabled and uses the h/w default SPBR. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/