Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752813AbbDDTNI (ORCPT ); Sat, 4 Apr 2015 15:13:08 -0400 Received: from mail-ob0-f178.google.com ([209.85.214.178]:33900 "EHLO mail-ob0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752522AbbDDTND (ORCPT ); Sat, 4 Apr 2015 15:13:03 -0400 Message-ID: <552037BB.7050803@gmail.com> Date: Sat, 04 Apr 2015 12:12:59 -0700 From: Florian Fainelli User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Jonathan Richardson , Mark Brown , Dmitry Torokhov , Anatol Pomazau CC: Scott Branden , Rob Herring , Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala , linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org, bcm-kernel-feedback-list , devicetree@vger.kernel.org, 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> In-Reply-To: <1428002603-21892-5-git-send-email-jonathar@broadcom.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1386 Lines: 38 Le 02/04/2015 12:23, Jonathan Richardson a écrit : > The driver wasn't setting the SPBR (serial clock baud rate) which caused > it to run at the slowest speed possible. The driver now calculates the > SPBR based on the reference clock frequency resulting in much faster > SPI transfers. > > Signed-off-by: Jonathan Richardson > --- [snip] > + data->clk = devm_clk_get(dev, "mspi_clk"); > + if (!IS_ERR(data->clk)) { > + int ret = clk_prepare_enable(data->clk); > + > + if (ret < 0) { > + dev_err(dev, "failed to enable clock: %d\n", ret); > + return 0; > + } > + > + /* 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? -- Florian -- 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/