From: Mark Rutland <mark.rutland@arm.com>
To: Felipe Balbi <balbi@ti.com>
Cc: Kishon Vijay Abraham I <kishon@ti.com>,
"rob.herring@calxeda.com" <rob.herring@calxeda.com>,
"rob@landley.net" <rob@landley.net>,
"tony@atomide.com" <tony@atomide.com>,
"b-cousson@ti.com" <b-cousson@ti.com>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
"devicetree-discuss@lists.ozlabs.org"
<devicetree-discuss@lists.ozlabs.org>,
"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
"linux@arm.linux.org.uk" <linux@arm.linux.org.uk>
Subject: Re: [PATCH v4 1/4] drivers: usb: phy: add a new driver for usb part of control module
Date: Fri, 25 Jan 2013 17:08:45 +0000 [thread overview]
Message-ID: <20130125170845.GE16795@e106331-lin.cambridge.arm.com> (raw)
In-Reply-To: <20130125162346.GM28379@arwen.pp.htv.fi>
On Fri, Jan 25, 2013 at 04:23:46PM +0000, Felipe Balbi wrote:
> Hi,
>
> On Fri, Jan 25, 2013 at 04:14:02PM +0000, Mark Rutland wrote:
> > On Fri, Jan 25, 2013 at 02:59:28PM +0000, Felipe Balbi wrote:
> > > Hi,
> > >
> > > On Fri, Jan 25, 2013 at 12:29:43PM +0000, Mark Rutland wrote:
> > > > > > > + depending upon omap4 or omap5.
> > > > > > > + - reg-names: The names of the register addresses corresponding to the registers
> > > > > > > + filled in "reg".
> > > > > > > + - ti,type: This is used to differentiate whether the control module has
> > > > > > > + usb mailbox or usb3 phy power. omap4 has usb mailbox in control module to
> > > > > > > + notify events to the musb core and omap5 has usb3 phy power register to
> > > > > > > + power on usb3 phy. Should be "1" if it has mailbox and "2" if it has usb3
> > > > > > > + phy power.
> > > > > >
> > > > > > Why not make this a string property, perhaps values "mailbox" or "register"?
> > > > >
> > > > > NAK.
> > > >
> > > > Can I ask what your objection to using a string property is?
> > > >
> > > > As far as I can see, "ti,type" is only used by this driver, so there's no
> > > > common convention to stick to. Using a string makes the binding easier for
> > > > humans to read, and thus harder to mess up in a dts, and it decouples the
> > > > binding from kernel-side constants.
> > >
> > > IIRC there is some work going on to add #define-like support for DT,
> > > which would allow us to match against integers while still having
> > > meaningful symbolic representations.
> >
> > I was under the impression that the motivation for using the preprocessor on
> > the DT was to allow symbolic names for device/soc-specific values like
> > addresses, rather than what amounts to ABI values for the binding.
> >
> > I don't see the point in building a binding that depends on future
> > functionality to be legible, especially as we can make it more readable,
> > robust, and just as extensible today, with a simple change to the proposed
> > binding.
> >
> > Even ignoring the above, the driver isn't doing appropriate sanity checking.
> > If you use a string property, this sanity check is implicit in the parsing --
> > you've either matched a value you can handle or you haven't.
>
> Even IRQs use numbers (not talking about the IRQ number, but the IRQ
> flags), why would we depend on string comparisson ? It doesn't make
> sense.
When describing interrupts, the flags are associated with the interrupt number,
and don't really make sense on their own. devicetree does not allow you to mix
strings and integers in a value, so you'd never be able to encode irq flags
with strings without completely breaking away from the way ePAPR describes how
to encode interrupts.
By using a string property, the binding is self-describing and easy for humans
to read and verify. It doesn't add a large overhead to either the driver or the
dts, and is no worse (possibly better) for future extension of bindings to
support new device variants while retaining backwards compatibility.
See the standard "status" property, which is string encoded. This would still
work were it an integer-encoded enumeration. Having it as a string makes the
meaning clear to a reader of the dts, and it's trivial for code to deal with.
I don't understand why you think encoding a more legible value in the dt does
not make sense.
Thanks,
Mark.
next prev parent reply other threads:[~2013-01-25 17:08 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-25 10:23 [PATCH v4 0/4] usb: musb/dwc3: add driver for control module Kishon Vijay Abraham I
2013-01-25 10:23 ` [PATCH v4 1/4] drivers: usb: phy: add a new driver for usb part of " Kishon Vijay Abraham I
2013-01-25 11:01 ` Mark Rutland
2013-01-25 11:11 ` Felipe Balbi
2013-01-25 12:29 ` Mark Rutland
2013-01-25 14:59 ` Felipe Balbi
2013-01-25 16:14 ` Mark Rutland
2013-01-25 16:23 ` Felipe Balbi
2013-01-25 17:08 ` Mark Rutland [this message]
2013-01-25 10:23 ` [PATCH v4 2/4] ARM: OMAP: devices: create device " Kishon Vijay Abraham I
[not found] ` <1359109440-2195-1-git-send-email-kishon-l0cyMroinI0@public.gmane.org>
2013-01-25 10:23 ` [PATCH v4 3/4] ARM: OMAP2: MUSB: Specify omap4 has mailbox Kishon Vijay Abraham I
2013-01-25 10:24 ` [PATCH v4 4/4] drivers: usb: start using the control module driver Kishon Vijay Abraham I
[not found] ` <1359109440-2195-5-git-send-email-kishon-l0cyMroinI0@public.gmane.org>
2013-01-25 10:27 ` Felipe Balbi
[not found] ` <20130125102700.GO15886-S8G//mZuvNWo5Im9Ml3/Zg@public.gmane.org>
2013-01-25 11:45 ` kishon
2013-02-01 19:14 ` Tony Lindgren
[not found] ` <20130201191424.GQ22517-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2013-02-04 15:53 ` Felipe Balbi
2013-02-04 17:22 ` Tony Lindgren
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=20130125170845.GE16795@e106331-lin.cambridge.arm.com \
--to=mark.rutland@arm.com \
--cc=b-cousson@ti.com \
--cc=balbi@ti.com \
--cc=devicetree-discuss@lists.ozlabs.org \
--cc=gregkh@linuxfoundation.org \
--cc=kishon@ti.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=rob.herring@calxeda.com \
--cc=rob@landley.net \
--cc=tony@atomide.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).