All of lore.kernel.org
 help / color / mirror / Atom feed
From: Linus Walleij <linus.walleij@linaro.org>
To: Stephen Warren <swarren@nvidia.com>
Cc: Linus Walleij <linus.walleij@stericsson.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	Grant Likely <grant.likely@secretlab.ca>,
	Lee Jones <lee.jones@linaro.org>, Joe Perches <joe@perches.com>,
	Russell King <linux@arm.linux.org.uk>,
	Linaro Dev <linaro-dev@lists.linaro.org>,
	ext Tony Lindgren <tony@atomide.com>,
	David Brown <davidb@codeaurora.org>,
	Sascha Hauer <kernel@pengutronix.de>
Subject: Re: [PATCH 1/4 v4] drivers: create a pin control subsystem
Date: Fri, 26 Aug 2011 10:35:02 +0200	[thread overview]
Message-ID: <CACRpkdbBBaNFETLLcxeCFZoLbdMok7uRi_o-HcbpYdMtRiGFcw@mail.gmail.com> (raw)
In-Reply-To: <74CDBE0F657A3D45AFBB94109FB122FF04B24A3EDB@HQMAIL01.nvidia.com>

On Thu, Aug 25, 2011 at 9:13 PM, Stephen Warren <swarren@nvidia.com> wrote:
> Linus Walleij wrote at Thursday, August 25, 2011 4:13 AM:
>
>> So this is radically different in that it requires the pin control
>> system to assume basically that any one pin can be used for
>> any one function.
>
> I think that's the wrong conclusion; 1:many isn't the same as 1:all/any.
> The data model might be structured to allow that, but in practice most
> HW allows 1:some_subset, not 1:all/any. I think this was well-covered in
> some other recent responses in this thread.

OK what I was mainly after was if the data model should
be structured to accept phone-exchange type muxing. If it
does and such a hardware appears - I mean a hardware where
any pin can be muxed anywhere, and given the second point
you make that the pinmux subsystem should expose all possible
combinations, it will lead to a situation where the driver
needs to expose all permutations i.e. (n over k) combinations
per function where n is the number of available pins and k
is the number of pins used by any one function. That would
just explode...

So if we assume that such a hardware does not exist but
the number of permutations of functions will always be limited,
it makes much more sense.

I'll encode this theoretical assumption in
Documentation/pinctrl.txt as I go along.

>> So the data model I'm assuming is:
>>
>> - Pins has a 1..* relation to functions
>> - Functions in general have a 1..1 relation to pins,
>> - Device drivers in general have a 1..1 relation to
>>   functions
>> - Functions with 1..* relation to pins is uncommon
>>   as is 1..* realtions between device drivers and
>>   functions.
>>
>> The latter is the crucial point where I think we have
>> different assumptions.
>
> As a few other replies pointed out, a number of chips do allow the at
> least some logical functions to be mux'd onto different pins. Tegra
> certainly isn't unique in this.

Yeah I get this now... and it's a handful of alternatives for a
few functions, sorry for being such a slow learner.

>> If it holds, it leads to the fact that a pinmux driver
>> will present a few functions for say i2s0 usually only
>> one, maybe two, three, never hundreds.
>
> Certainly I'd assume the number of pins/groups that a given function
> could be mux'd out onto is small, say 1-3. But, certainly not limited
> to just 1 in many cases.

Sure, we're on the same page. So I now need to find a
way to expose a few different localities per function from
the system and all the way to the map, and drop the string
naming system so instead of using spi0-0, spi0-1, spi0-2
I use some tuple like {"spi0", 0}, {"spi0", 1}, {"spi0", 2}
and I call the latter integer something like "locality" or
"position".

> Just a note: There are Tegra-based boards in wide use (in fact, boards
> for which some support is in mainline) that make active use of switching
> the routing of a HW function between different pins at run-time.
> Specifically, switching 1 I2C controller between 2 busses on the board.
>
> In fact, soon after the pinmux system is upstream, I hope we (NVIDIA) will
> be writing and submitting an I2C bus mux driver based on that. In our
> downstream kernels, we do this as custom code in the I2C host driver, but
> I want to move it out into a separate driver that anyone can use.

This is pretty cool and a usecase that I was thinking about. It'll
be fun!

Yours,
Linus Walleij

WARNING: multiple messages have this Message-ID (diff)
From: linus.walleij@linaro.org (Linus Walleij)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/4 v4] drivers: create a pin control subsystem
Date: Fri, 26 Aug 2011 10:35:02 +0200	[thread overview]
Message-ID: <CACRpkdbBBaNFETLLcxeCFZoLbdMok7uRi_o-HcbpYdMtRiGFcw@mail.gmail.com> (raw)
In-Reply-To: <74CDBE0F657A3D45AFBB94109FB122FF04B24A3EDB@HQMAIL01.nvidia.com>

On Thu, Aug 25, 2011 at 9:13 PM, Stephen Warren <swarren@nvidia.com> wrote:
> Linus Walleij wrote at Thursday, August 25, 2011 4:13 AM:
>
>> So this is radically different in that it requires the pin control
>> system to assume basically that any one pin can be used for
>> any one function.
>
> I think that's the wrong conclusion; 1:many isn't the same as 1:all/any.
> The data model might be structured to allow that, but in practice most
> HW allows 1:some_subset, not 1:all/any. I think this was well-covered in
> some other recent responses in this thread.

OK what I was mainly after was if the data model should
be structured to accept phone-exchange type muxing. If it
does and such a hardware appears - I mean a hardware where
any pin can be muxed anywhere, and given the second point
you make that the pinmux subsystem should expose all possible
combinations, it will lead to a situation where the driver
needs to expose all permutations i.e. (n over k) combinations
per function where n is the number of available pins and k
is the number of pins used by any one function. That would
just explode...

So if we assume that such a hardware does not exist but
the number of permutations of functions will always be limited,
it makes much more sense.

I'll encode this theoretical assumption in
Documentation/pinctrl.txt as I go along.

>> So the data model I'm assuming is:
>>
>> - Pins has a 1..* relation to functions
>> - Functions in general have a 1..1 relation to pins,
>> - Device drivers in general have a 1..1 relation to
>> ? functions
>> - Functions with 1..* relation to pins is uncommon
>> ? as is 1..* realtions between device drivers and
>> ? functions.
>>
>> The latter is the crucial point where I think we have
>> different assumptions.
>
> As a few other replies pointed out, a number of chips do allow the at
> least some logical functions to be mux'd onto different pins. Tegra
> certainly isn't unique in this.

Yeah I get this now... and it's a handful of alternatives for a
few functions, sorry for being such a slow learner.

>> If it holds, it leads to the fact that a pinmux driver
>> will present a few functions for say i2s0 usually only
>> one, maybe two, three, never hundreds.
>
> Certainly I'd assume the number of pins/groups that a given function
> could be mux'd out onto is small, say 1-3. But, certainly not limited
> to just 1 in many cases.

Sure, we're on the same page. So I now need to find a
way to expose a few different localities per function from
the system and all the way to the map, and drop the string
naming system so instead of using spi0-0, spi0-1, spi0-2
I use some tuple like {"spi0", 0}, {"spi0", 1}, {"spi0", 2}
and I call the latter integer something like "locality" or
"position".

> Just a note: There are Tegra-based boards in wide use (in fact, boards
> for which some support is in mainline) that make active use of switching
> the routing of a HW function between different pins at run-time.
> Specifically, switching 1 I2C controller between 2 busses on the board.
>
> In fact, soon after the pinmux system is upstream, I hope we (NVIDIA) will
> be writing and submitting an I2C bus mux driver based on that. In our
> downstream kernels, we do this as custom code in the I2C host driver, but
> I want to move it out into a separate driver that anyone can use.

This is pretty cool and a usecase that I was thinking about. It'll
be fun!

Yours,
Linus Walleij

  reply	other threads:[~2011-08-26  8:35 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-19  9:53 [PATCH 1/4 v4] drivers: create a pin control subsystem Linus Walleij
2011-08-19  9:53 ` Linus Walleij
2011-08-19 10:48 ` Jamie Iles
2011-08-19 10:48   ` Jamie Iles
2011-08-19 14:04   ` Linus Walleij
2011-08-19 14:04     ` Linus Walleij
2011-08-19 14:26     ` Jamie Iles
2011-08-19 14:26       ` Jamie Iles
2011-08-21 14:24       ` Jamie Iles
2011-08-21 14:24         ` Jamie Iles
2011-08-22 12:38         ` Linus Walleij
2011-08-22 12:38           ` Linus Walleij
2011-08-22 12:54           ` Jamie Iles
2011-08-22 12:54             ` Jamie Iles
2011-08-19 14:36     ` Arnd Bergmann
2011-08-19 14:36       ` Arnd Bergmann
2011-08-19 16:52       ` Greg KH
2011-08-19 16:52         ` Greg KH
2011-08-22 12:29         ` Linus Walleij
2011-08-22 12:29           ` Linus Walleij
2011-08-21 14:53 ` Barry Song
2011-08-21 14:53   ` Barry Song
2011-08-24  6:24 ` Barry Song
2011-08-24  6:24   ` Barry Song
2011-08-24  7:41   ` Linus Walleij
2011-08-24  7:41     ` Linus Walleij
2011-08-24 18:29 ` Stephen Warren
2011-08-24 18:29   ` Stephen Warren
2011-08-25 10:12   ` Linus Walleij
2011-08-25 10:12     ` Linus Walleij
2011-08-25 11:04     ` Sascha Hauer
2011-08-25 11:04       ` Sascha Hauer
2011-08-25 11:58       ` Linus Walleij
2011-08-25 11:58         ` Linus Walleij
2011-08-25 12:07         ` Sascha Hauer
2011-08-25 12:07           ` Sascha Hauer
2011-08-25 15:12     ` David Brown
2011-08-25 15:12       ` David Brown
2011-08-25 18:14       ` Gregory Bean
2011-08-25 18:14         ` Gregory Bean
2011-08-25 19:13     ` Stephen Warren
2011-08-25 19:13       ` Stephen Warren
2011-08-26  8:35       ` Linus Walleij [this message]
2011-08-26  8:35         ` Linus Walleij
2011-08-26 17:33         ` Stephen Warren
2011-08-26 17:33           ` Stephen Warren
2011-08-29  8:40           ` Linus Walleij
2011-08-29  8:40             ` Linus Walleij
2011-08-26  3:12 ` Barry Song
2011-08-26  3:12   ` Barry Song
2011-08-26  8:36   ` Linus Walleij
2011-08-26  8:36     ` Linus Walleij
2011-09-02  7:02 ` Stijn Devriendt
2011-09-02  7:02   ` Stijn Devriendt
2011-09-02  7:57   ` Linus Walleij
2011-09-02  7:57     ` Linus Walleij

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=CACRpkdbBBaNFETLLcxeCFZoLbdMok7uRi_o-HcbpYdMtRiGFcw@mail.gmail.com \
    --to=linus.walleij@linaro.org \
    --cc=davidb@codeaurora.org \
    --cc=grant.likely@secretlab.ca \
    --cc=joe@perches.com \
    --cc=kernel@pengutronix.de \
    --cc=lee.jones@linaro.org \
    --cc=linaro-dev@lists.linaro.org \
    --cc=linus.walleij@stericsson.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=swarren@nvidia.com \
    --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 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.