linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
  • * Re: [RFC RESEND] GPIO: gpio-generic: Add DT support
           [not found]       ` <1375786850.12043.22.camel@hornet>
           [not found]         ` <20130807140702.GE28558@e106331-lin.cambridge.arm.com>
    @ 2013-08-16 12:29         ` Linus Walleij
      1 sibling, 0 replies; 7+ messages in thread
    From: Linus Walleij @ 2013-08-16 12:29 UTC (permalink / raw)
      To: Pawel Moll
      Cc: Mark Rutland, Stephen Warren, Olof Johansson, Alexander Shiyan,
    	linux-gpio@vger.kernel.org, devicetree@vger.kernel.org,
    	rob.herring@calxeda.com, Ian Campbell, grant.likely@linaro.org,
    	Mike Turquette
    
    Here are my €0.01 for this discussion...
    
    On Tue, Aug 6, 2013 at 1:00 PM, Pawel Moll <pawel.moll@arm.com> wrote:
    > On Wed, 2013-07-31 at 16:56 +0100, Mark Rutland wrote:
    >> > Ah, I guess the question more: Do we want generic bindings that describe
    >> > the low-level details of the HW in a completely generic fashion so that
    >> > new HW can be supported with zero kernel changes, or do we want a simple
    >> > driver with a lookup table that maps from compatible value to the HW
    >> > configuration? One of the potential benefits of DT is to be able to
    >> > support new HW without code changes, although perhaps that's more
    >> > typically considered in the context of new boards rather than new IP
    >> > blocks or SoCs.
    >
    > ... or FPGAs that can be synthesized with random collection of standard
    > IP blocks. With Xilinx's Zynq and Altera's SOCFPGA this is getting
    > simpler and simpler...
    
    I think the stance should be similar as with pinctrl-single:
    we can have such a driver if and only if the hardware:
    
    - Does not really have a fixes, etched in stone, datasheet.
    
    - Flixes and flexes and reconfigures at the wave of a HW
      engineering wand
    
    - Instead of datasheets the HW engineers provide some
      magic markup that you need to process to figure out how
      to hit the bits correctly.
    
    > This is one of the important decisions we may have to make going
    > forward... Do we only accept bindings for "real" blocks of IP? (and how
    > we define "real"?) If so, why does the "simple-bus"?
    
    Yeah how do you define "real" ... I think we all hearda movie quote
    righ there. With the advent of virtual prototyping
    in fast models of SoCs and FPGAs, we're not really dealing with real
    silicon.
    
    Plato in ~400 BC regarded our ideas as the highest form of reality
    as illustrated in the famous allegory of the cave:
    http://en.wikipedia.org/wiki/Allegory_of_the_Cave
    (This is called platonism and found in Gnosticism and popular
    culture references all over the place.)
    
    With a simple DT representation we represent the idea of
    a certain simple GPIO controller, whereas in reality it will have
    flaws, and those will be discovered when adding ever more
    usecases and power management and other things that hit
    the deep silicon structures of the projection of this idea into
    silicon reality.
    
    So I think this thing should be implemented, but the next step
    is to be guarded - when people want to add "quirks" to this
    driver it cannot be called "simple" anymore, and a real driver
    with full knowledge of the hardware need to be created in its
    place at this point, so we should require that any DTS(I)
    using this "simple" driver *also* define a unique compatible
    string for the platform, such that a newer kernel may instantiate
    a more HW-specific driver for this one GPIO and disregard any
    older properties for the "simple" controller.
    
    Yours,
    Linus Walleij
    --
    To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at  http://vger.kernel.org/majordomo-info.html
    
    ^ permalink raw reply	[flat|nested] 7+ messages in thread
  • * Re: [RFC RESEND] GPIO: gpio-generic: Add DT support
           [not found] <1375183115-30237-1-git-send-email-shc_work@mail.ru>
           [not found] ` <20130730162241.GA13634@quad.lixom.net>
    @ 2013-08-16 12:36 ` Linus Walleij
      1 sibling, 0 replies; 7+ messages in thread
    From: Linus Walleij @ 2013-08-16 12:36 UTC (permalink / raw)
      To: Alexander Shiyan
      Cc: linux-gpio@vger.kernel.org, devicetree@vger.kernel.org,
    	Rob Herring, Pawel Moll, Mark Rutland, Stephen Warren,
    	Ian Campbell, Grant Likely
    
    On Tue, Jul 30, 2013 at 1:18 PM, Alexander Shiyan <shc_work@mail.ru> wrote:
    
    > +++ b/Documentation/devicetree/bindings/gpio/gpio-generic.txt
    > @@ -0,0 +1,25 @@
    > +Generic memory-mapped GPIO controller
    > +
    > +Required properties:
    > +- compatible: Should be "basic-mmio-gpio" or "basic-mmio-gpio-be".
    > +- reg: Physical base GPIO controller registers location and length.
    > +- reg-names: Should be the names of reg resources. Each register uses
    > +  its own reg name, so there should be as many reg names as referenced
    > +  registers:
    > +  "dat"                : Input/output register (Required),
    > +  "set"                : Register for set output bits (Optional),
    > +  "clr"                : Register for clear output bits (Optional),
    > +  "dirout"     : Register for setup direction as output (Optional),
    > +  "dirin"      : Register for setup direction as input (Optional).
    > +- gpio-controller: Marks the device node as a gpio controller.
    > +- #gpio-cells: Should be two.
    
    This appears to make a *lot* of implicit assumptions about these
    registers. You absolutely *have* to define every assumption in clear
    text for this.
    
    Example of implicit assumptions:
    
    - Registers in "basic-mmio-gpio" are these assumed to be
      little endian? Or target-CPU-endian?
    
    - Does "-be" mean that the CPU or the bus is big endian?
      (I assume the bus...)
    
    - Is is assumed that 0 in a dat bit is low line and 1is a high line?
    
    - Is it assumed that setting a bit to 1 in set drives the line high and
      setting it to 1 in clr clears the line?
    
    - Same question for dirout/dirin?
    
    - What happens if you set the same bit in both dirin and dirout?
    
    - Is it assumed that the first GPIO line is bit 0, second GPIO line
      is bit 1 (etc) up to bit ....N?
    
    - How many bits are there in a register after all? 8? 16? 32? 64?
      Or the bus size of the architecture maybe?
    
    This really need some very details definition before it can be
    considered for merging.
    
    Yours,
    Linus Walleij
    
    ^ permalink raw reply	[flat|nested] 7+ messages in thread

  • end of thread, other threads:[~2013-08-16 12:36 UTC | newest]
    
    Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
    -- links below jump to the message on this page --
         [not found] <1375183115-30237-1-git-send-email-shc_work@mail.ru>
         [not found] ` <20130730162241.GA13634@quad.lixom.net>
         [not found]   ` <51F7FEE5.1010608@wwwdotorg.org>
         [not found]     ` <20130731155608.GR29859@e106331-lin.cambridge.arm.com>
         [not found]       ` <1375786850.12043.22.camel@hornet>
         [not found]         ` <20130807140702.GE28558@e106331-lin.cambridge.arm.com>
         [not found]           ` <520271DC.2020006@wwwdotorg.org>
         [not found]             ` <20130808091155.GD14648@e106331-lin.cambridge.arm.com>
    2013-08-08 18:34               ` [RFC RESEND] GPIO: gpio-generic: Add DT support Stephen Warren
    2013-08-09  3:21                 ` Grant Likely
    2013-08-09  9:09                 ` Mark Rutland
    2013-08-09 16:31                   ` Stephen Warren
    2013-08-09 16:44                     ` Alexander Shiyan
    2013-08-16 12:29         ` Linus Walleij
    2013-08-16 12:36 ` Linus Walleij
    

    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).