From: Michal Simek <monstr@monstr.eu>
To: Rob Herring <robherring2@gmail.com>
Cc: Harini Katakam <harinik@xilinx.com>,
Rob Herring <robh+dt@kernel.org>, Pawel Moll <pawel.moll@arm.com>,
Mark Rutland <mark.rutland@arm.com>,
Ian Campbell <ijc+devicetree@hellion.org.uk>,
Kumar Gala <galak@codeaurora.org>, Rob Landley <rob@landley.net>,
Mark Brown <broonie@kernel.org>,
Grant Likely <grant.likely@linaro.org>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-spi@vger.kernel.org" <linux-spi@vger.kernel.org>
Subject: Re: [PATCH] SPI: Add driver for Cadence SPI controller
Date: Thu, 20 Mar 2014 12:23:08 +0100 [thread overview]
Message-ID: <532ACF9C.6030103@monstr.eu> (raw)
In-Reply-To: <CAL_JsqL9z_4T+cz425bHHpwx_dXaZjJEHwZKFCOibWYuWM4rkA@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 4826 bytes --]
On 03/17/2014 08:00 PM, Rob Herring wrote:
> On Mon, Mar 17, 2014 at 8:22 AM, Michal Simek <monstr@monstr.eu> wrote:
>> Hi Rob,
>>
>> On 03/17/2014 01:47 PM, Rob Herring wrote:
>>> On Mon, Mar 17, 2014 at 7:05 AM, Harini Katakam <harinik@xilinx.com> wrote:
>>>> Add driver for Cadence SPI controller. This is used in Xilinx Zynq.
>>>>
>>>> Signed-off-by: Harini Katakam <harinik@xilinx.com>
>>>> ---
>>>> .../devicetree/bindings/spi/spi-cadence.txt | 25 +
>>>
>>> We prefer binding docs in separate patch.
>>
>> I have heard several times that also for binding review you need driver
>> to look if this binding make sense that's why Harini sent this together.
>> It means 2 emails instead of one.
>> But if you wish to have this in two files no problem to split it
>> but then I believe both should be copied to DT mailing list.
>
> Yes, for 2 reasons:
> - To prepare for DT bindings to get merged to separate repo if we ever
> get there.
> - So DT maintainers can review/ack just the bindings.
ok. No problem to divide it.
>>>> +- reg : Physical base address and size of SPI registers map.
>>>> +- interrupts : Property with a value describing the interrupt
>>>> + number.
>>>> +- interrupt-parent : Must be core interrupt controller
>>>> +- clock-names : List of input clock names - "ref_clk", "pclk"
>>>> + (See clock bindings for details).
>>>> +- clocks : Clock phandles (see clock bindings for details).
>>>> +- num-chip-select : Number of chip selects used.
>>>
>>> See Documentation/devicetree/bindings/spi/spi-bus.txt. Use "num-cs" here.
>>>
>>>> +
>>>> +Example:
>>>> +
>>>> + spi@e0007000 {
>>>> + clock-names = "ref_clk", "pclk";
>>>> + clocks = <&clkc 26>, <&clkc 35>;
>>>> + compatible = "cdns,spi-r1p6";
>>>
>>> Nit. We usually put compatible first in the node.
>>
>> Our device-tree generator sorts them that's why it is just like this
>> but not a problem to fix just in documentation.
>>
>>
>>>> + interrupt-parent = <&intc>;
>>>> + interrupts = <0 49 4>;
>>>> + num-chip-select = /bits/ 16 <4>;
>>
>> I was expecting you will comment this a little bit. :-)
>> Because all just reading this num-cs as 32bit and then
>> assigning this value to master->num_chipselect which is 16bit.
>
> Well, everyone else has that problem then. Obviously it takes a bit
> more care than just reading into a u32, but that is a kernel problem
> and not a problem of the binding.
They are not reading it directly with read_u32 but they are using
intermediate u32 value which is assigned to u16 which is fine.
This pattern is in most drivers(maybe all).
The point is if binding should or can't simplify driver code.
And from your reaction above I expect that it is up to driver
owner and binding doc how you want to do it.
>>>> +/* Macros for the SPI controller read/write */
>>>> +#define cdns_spi_read(addr) readl_relaxed(addr)
>>>> +#define cdns_spi_write(addr, val) writel_relaxed((val), (addr))
>>>
>>> Just use readl/writel directly.
>>
>> There shouldn't be any problem to use these helper macros
>> and even I think this is better than using readl/writel directly
>> because you are more flexible if you want to change it to different
>> IO.
>
> Then when I read the code I have to go lookup what they do while I
> know exactly what writel/readl do already. It is really the same
> reasons as why the kernel doesn't have register set and clear bits
> accessors.
I understand your reasons but on the other hand if we want to run
ARM-BE then using direct readl/writel functions is also not correct.
Mark proposed one solution and I will see how it looks like.
>>>> + irq = platform_get_irq(pdev, 0);
>>>> + if (irq < 0) {
>>>
>>> I believe this returns NO_IRQ which could be 0.
>>>
>>> s/</<=/
>>
>> Are you sure regarding this?
>> NO_IRQ on ARM is -1.
>> And IRC irq = 0 should be just valid number.
>>
>> But if you are right then others drivers have to fixed too.
>
> The definition varies by arch being 0 or -1, so drivers need to deal
> with both. The preference is 0 is NO_IRQ. It has been decreed by
> Linus. ARM is actually pretty close to being able to change NO_IRQ to
> 0.
I think that resolution was to completely remove NO_IRQ.
Thanks,
Michal
--
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]
next prev parent reply other threads:[~2014-03-20 11:23 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-17 12:05 [PATCH] SPI: Add driver for Cadence SPI controller Harini Katakam
2014-03-17 12:47 ` Rob Herring
[not found] ` <CAL_JsqKacetGytGUJir7ky3qOgCy-3ny1pT_Bx4eCYV2wMgcTg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-03-17 13:14 ` Mark Brown
2014-03-17 13:22 ` Michal Simek
2014-03-17 13:30 ` Geert Uytterhoeven
2014-03-17 13:54 ` Harini Katakam
[not found] ` <5326F72E.7010401-pSz03upnqPeHXe+LvDLADg@public.gmane.org>
2014-03-17 19:00 ` Rob Herring
2014-03-20 11:23 ` Michal Simek [this message]
2014-03-17 14:01 ` Harini Katakam
[not found] ` <1395057936-8643-1-git-send-email-harinik-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
2014-03-17 17:30 ` Mark Brown
2014-03-17 17:59 ` Josh Cartwright
2014-03-17 18:14 ` Mark Brown
2014-03-18 5:22 ` Harini Katakam
[not found] ` <554ccbca-f92e-454c-90c0-b8a4ddddf3fd-p/+QeVIcf1BZbvUCbuG1mrjjLBE8jN/0@public.gmane.org>
2014-03-18 11:06 ` Mark Brown
2014-03-18 5:16 ` Harini Katakam
2014-03-18 11:04 ` Mark Brown
[not found] ` <20140318110401.GH11706-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2014-03-18 12:13 ` Harini Katakam
2014-03-18 12:33 ` Mark Brown
2014-03-18 14:45 ` Harini Katakam
2014-03-18 15:59 ` Mark Brown
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=532ACF9C.6030103@monstr.eu \
--to=monstr@monstr.eu \
--cc=broonie@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=galak@codeaurora.org \
--cc=grant.likely@linaro.org \
--cc=harinik@xilinx.com \
--cc=ijc+devicetree@hellion.org.uk \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=pawel.moll@arm.com \
--cc=rob@landley.net \
--cc=robh+dt@kernel.org \
--cc=robherring2@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).