devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Fainelli <florian@openwrt.org>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: olof@lixom.net, devicetree-discuss@lists.ozlabs.org,
	Mike Turquette <mturquette@linaro.org>,
	linux-arm-kernel@lists.infradead.org,
	Arnd Bergmann <arnd@arndb.de>
Subject: Re: [PATCH 1/8] ARM: support for Moschip MCS814x SoCs
Date: Tue, 17 Jul 2012 11:35:20 +0200	[thread overview]
Message-ID: <3983660.QARsS5NXnS@flexo> (raw)
In-Reply-To: <CACRpkdbxesmgFswBKzAFHUBt-Np7wX0SXXVKrmGzubUN3OVN2w@mail.gmail.com>

On Tuesday 17 July 2012 00:12:01 Linus Walleij wrote:
> On Mon, Jul 16, 2012 at 5:54 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> 
> >> +static const struct cpu_mode cpu_modes[] = {
> >> +     {
> >> +             .name           = "I2S",
> >> +             .gpio_start     = 4,
> >> +             .gpio_end       = 8,
> >> +     },
> >> +     {
> >> +             .name           = "UART",
> >> +             .gpio_start     = 4,
> >> +             .gpio_end       = 9,
> >> +     },
> >> +     {
> >> +             .name           = "External MII",
> >> +             .gpio_start     = 0,
> >> +             .gpio_end       = 16,
> >> +     },
> >> +     {
> >> +             .name           = "Normal",
> >> +             .gpio_start     = -1,
> >> +             .gpio_end       = -1,
> >> +     },
> >> +};
> >> +
> >> +void __init mcs814x_init_machine(void)
> >> +{
> >> +     u32 bs2, cpu_mode;
> >> +     int gpio;
> >> +
> >> +     bs2 = __raw_readl(mcs814x_sysdbg_base + SYSDBG_BS2);
> >> +     cpu_mode = (bs2 >> CPU_MODE_SHIFT) & CPU_MODE_MASK;
> >> +
> >> +     pr_info("CPU mode: %s\n", cpu_modes[cpu_mode].name);
> >> +
> >> +     /* request the gpios since the pins are muxed for functionnality */
> >> +     for (gpio = cpu_modes[cpu_mode].gpio_start;
> >> +             gpio == cpu_modes[cpu_mode].gpio_end; gpio++) {
> >> +             if (gpio != -1)
> >> +                     gpio_request(gpio, cpu_modes[cpu_mode].name);
> >> +     }
> >> +}
> >
> > This looks like a very simple instance of a pinmux driver. I wonder
> > if it's worth doing an actual pinctrl driver that knows about these
> > modes and about the gpio handling of the platform. Maybe Linus Walleij
> > can comment on that.
> 
> It is worth, because usually it is not simple at all but these are,
> as I highly suspect, the first few entries to get the platform up and
> running. Then it's going to need to add another one, and then
> another one, and then break it into a separate file, and then it's a
> custom pin controller implementation all over again
> 
> Nothing is forbidding a simple pin controller implementation
> in drivers/pinctrl, just a few tens of lines is perfectly OK
> with me.

In this particular case, I do not think it is even worth having a pinctrl 
driver since the settings are hardwired using bootstrap registers, so we 
cannot runtime change them afterwards.

> 
> Documentation/pinctrl.txt is the friend at all times.
> arch/arm/mach-u300/core.c shows how a simple set-up
> at boot time can be achieved using so-called pinctrl
> hogs.
> 
> Yours,
> Linus Walleij

  reply	other threads:[~2012-07-17  9:35 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-15 14:49 [PATCH 0/8] ARM: support for Moschip MCS814x SoCs Florian Fainelli
2012-07-15 14:49 ` [PATCH 1/8] " Florian Fainelli
2012-07-16 12:29   ` Thomas Petazzoni
2012-07-16 12:43     ` Florian Fainelli
2012-07-16 15:55       ` Arnd Bergmann
2012-07-16 17:57       ` Nicolas Pitre
2012-07-23 19:11     ` Florian Fainelli
2012-07-27 22:42       ` Linus Walleij
     [not found]   ` <1342363754-30808-2-git-send-email-florian-p3rKhJxN3npAfugRpC6u6w@public.gmane.org>
2012-07-16 15:54     ` Arnd Bergmann
     [not found]       ` <201207161554.04812.arnd-r2nGTMty4D4@public.gmane.org>
2012-07-16 20:47         ` Turquette, Mike
2012-07-17  9:41           ` Florian Fainelli
2012-07-17 10:47           ` Florian Fainelli
2012-07-16 22:12         ` Linus Walleij
2012-07-17  9:35           ` Florian Fainelli [this message]
2012-07-17  9:34       ` Florian Fainelli
2012-07-17 13:07         ` Arnd Bergmann
2012-07-17 13:32           ` Florian Fainelli
2012-07-17 13:45             ` Arnd Bergmann
2012-07-17 10:16       ` Thomas Petazzoni
2012-07-17 13:12         ` Arnd Bergmann
2012-07-17 13:28           ` Thomas Petazzoni
2012-07-17 13:51             ` Arnd Bergmann
2012-07-16 22:06     ` Linus Walleij
2012-07-15 14:49 ` [PATCH 2/8] ARM: MCS814x: add Device Tree based MCS8140 board support Florian Fainelli
     [not found]   ` <1342363754-30808-3-git-send-email-florian-p3rKhJxN3npAfugRpC6u6w@public.gmane.org>
2012-07-17 13:19     ` Arnd Bergmann
2012-07-17 13:34       ` Florian Fainelli
2012-07-17 13:53         ` Arnd Bergmann
2012-07-17 13:57           ` Florian Fainelli
2012-07-15 14:49 ` [PATCH 3/8] ARM: MCS814x: add Device Tree bindings documentation Florian Fainelli
     [not found]   ` <1342363754-30808-4-git-send-email-florian-p3rKhJxN3npAfugRpC6u6w@public.gmane.org>
2012-07-17 13:24     ` Arnd Bergmann
2012-07-17 13:35       ` Florian Fainelli
2012-07-15 14:49 ` [PATCH 4/8] ARM: MCS814X: add DTS file for Tigal/Robotech RBT-832 Florian Fainelli
     [not found]   ` <1342363754-30808-5-git-send-email-florian-p3rKhJxN3npAfugRpC6u6w@public.gmane.org>
2012-07-17 13:27     ` Arnd Bergmann
2012-07-15 14:49 ` [PATCH 5/8] ARM: MCS814x: add DTS file for Devolo dLAN USB Extender Florian Fainelli
2012-07-15 14:49 ` [PATCH 6/8] ARM: MCS814x: provide a sample defconfig file Florian Fainelli
2012-07-15 14:49 ` [PATCH 7/8] ARM: MSC814X: add Kconfig and Makefile to arch/arm Florian Fainelli
2012-07-15 14:49 ` [PATCH 8/8] ARM: MSC814x: add MAINTAINERS entry Florian Fainelli
     [not found] ` <1342363754-30808-1-git-send-email-florian-p3rKhJxN3npAfugRpC6u6w@public.gmane.org>
2012-07-15 19:59   ` [PATCH 0/8] ARM: support for Moschip MCS814x SoCs Arnd Bergmann
2012-07-16  8:16     ` Florian Fainelli
     [not found]     ` <201207151959.19620.arnd-r2nGTMty4D4@public.gmane.org>
2012-07-16 18:09       ` Nicolas Pitre

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=3983660.QARsS5NXnS@flexo \
    --to=florian@openwrt.org \
    --cc=arnd@arndb.de \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=mturquette@linaro.org \
    --cc=olof@lixom.net \
    /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).