All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Simek <michal.simek@xilinx.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/4] ARM: zynq: Remove spi-max-frequency
Date: Tue, 20 Dec 2016 07:54:43 +0100	[thread overview]
Message-ID: <4a8157c4-e3fc-0efe-bdfd-2d96719eb9ab@xilinx.com> (raw)
In-Reply-To: <CAAtXAHf-QMziNWT_Hop6T72wc7_u4GKXBXeWRLMgCEzFAOiofQ@mail.gmail.com>

On 16.12.2016 18:28, Moritz Fischer wrote:
> Hi Michal,
> 
> On Fri, Dec 16, 2016 at 5:38 AM, Michal Simek <michal.simek@xilinx.com> wrote:
>> spi-max-frequency for spi bus depends on devices which are
>> connected to it. Remove this parameter from dtsi file.
>>
>> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
>> ---
>>
>>  arch/arm/dts/zynq-7000.dtsi | 2 --
>>  1 file changed, 2 deletions(-)
>>
>> diff --git a/arch/arm/dts/zynq-7000.dtsi b/arch/arm/dts/zynq-7000.dtsi
>> index 668f54ec219d..fa9ee276cb59 100644
>> --- a/arch/arm/dts/zynq-7000.dtsi
>> +++ b/arch/arm/dts/zynq-7000.dtsi
>> @@ -177,7 +177,6 @@
>>                         interrupts = <0 26 4>;
>>                         clocks = <&clkc 25>, <&clkc 34>;
>>                         clock-names = "ref_clk", "pclk";
>> -                       spi-max-frequency = <166666700>;
>>                         #address-cells = <1>;
>>                         #size-cells = <0>;
>>                 };
>> @@ -190,7 +189,6 @@
>>                         interrupts = <0 49 4>;
>>                         clocks = <&clkc 26>, <&clkc 35>;
>>                         clock-names = "ref_clk", "pclk";
>> -                       spi-max-frequency = <166666700>;
>>                         #address-cells = <1>;
>>                         #size-cells = <0>;
>>                 };
>> --
>> 1.9.1
>>
> 
> While I agree with the patch, doesn't the drivers/spi/zynq_spi.c in u-boot
> (wrongly) use this to determine it's peripheral clock speed?
> 
> <snip>
> plat->frequency = fdtdec_get_int(blob, node, "spi-max-frequency",
>                                                       250000000);
> </snip>
> 
> and later in zynq_spi_set_speed() to calculate divisors?

Based on DT binding
spi-max-frequency - (required) Maximum SPI clocking speed of device in Hz

In node itself it should be max speed what controller can operate. Every
node should set it up for self and driver should be able to handle it.

Back to your point. plat->frequency setup is weird. It looks like input
reference clock to IP itself instead of max IP freq. I expect the reason
was that we couldn't get this value and Jagan was using it as workaround
how to get any value.
It should be simply clk_get_rate() and clk driver should return value.
And this value should be used in speed calculation. (Linux
Time to move zynq clk driver to DM to get these stuff for free.

Thanks,
Michal

  reply	other threads:[~2016-12-20  6:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-16 12:38 [U-Boot] [PATCH 1/4] ARM: zynq: Remove CONFIG_BOOTP_SERVERIP Michal Simek
2016-12-16 12:38 ` [U-Boot] [PATCH 2/4] ARM: zynq: Remove spi-max-frequency Michal Simek
2016-12-16 17:28   ` Moritz Fischer
2016-12-20  6:54     ` Michal Simek [this message]
2016-12-16 12:38 ` [U-Boot] [PATCH 3/4] ARM: zynq: Setup modeboot variable based on boot mode Michal Simek
2016-12-16 12:38 ` [U-Boot] [PATCH 4/4] ARM: dts: zynq: replace gpio-key, wakeup with wakeup-source property Michal Simek
2016-12-16 13:23   ` Sudeep Holla
2016-12-16 13:30     ` Michal Simek
2016-12-16 13:31       ` Sudeep Holla

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4a8157c4-e3fc-0efe-bdfd-2d96719eb9ab@xilinx.com \
    --to=michal.simek@xilinx.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.