From: Marcin Wojtas <mw@semihalf.com>
To: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: "Russell King - ARM Linux" <linux@arm.linux.org.uk>,
"Andrew Lunn" <andrew@lunn.ch>,
"Jason Cooper" <jason@lakedaemon.net>,
"Tawfik Bayouk" <tawfik@marvell.com>,
"Grzegorz Jaszczyk" <jaz@semihalf.com>,
"Linus Walleij" <linus.walleij@linaro.org>,
linux-kernel@vger.kernel.org, nadavh@marvell.com,
linux-gpio@vger.kernel.org, "Lior Amsalem" <alior@marvell.com>,
"Gregory Clément" <gregory.clement@free-electrons.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"Sebastian Hesselbarth" <sebastian.hesselbarth@gmail.com>
Subject: Re: [PATCH] pinctrl: mvebu: armada-38x: add suspend/resume support
Date: Mon, 19 Oct 2015 11:25:49 +0200 [thread overview]
Message-ID: <CAPv3WKfxmwKaPA7BUffwsn8rweSShCSVaCyH4nrQcUkNk7uB2Q@mail.gmail.com> (raw)
In-Reply-To: <20151019092320.33d48dba@free-electrons.com>
Thomas,
2015-10-19 9:23 GMT+02:00 Thomas Petazzoni
<thomas.petazzoni@free-electrons.com>:
> Hello,
>
> On Mon, 19 Oct 2015 08:04:49 +0200, Marcin Wojtas wrote:
>
>> > I don't like this. The mvebu_pinctrl_soc_info structure is meant to be
>> > a read-only structure that only describes static information giving
>> > SoC-specific details for pin-muxing. The idea is that in the event
>> > where you had multiple pinctrl in the same system, you would still have
>> > only one instance of mvebu_pinctrl_soc_info.
>>
>> Ok, understood. What with current static globals, like mpp_base? This
>> is a problem when we consider hypothetical multi-pintrl system...
>
> The current driver is indeed not designed for multiple instances of the
> same pinctrl controller. But that's exactly what Russell is asking for.
>
In each mvebu pinctl there are <soc>_mpp_ctrl_get/set force usage of
global mpp_base. In order not to use it this way the functions have to
be redesigned. IMO having an acces to pdev would be sufficient (please
see my proposal below), but yet I don't have a clear idea, how to do
it,
>> In genereal, I think storing additional global data is not
>> starightforward, as dev->platform_data and dev->driver_data are
>> currently occupied by mvebu_pinctrl and mvebu_pinctrl_soc_info. I
>> propose the following:
>>
>>
>> 1. Create a new structure:
>> struct mvebu_pinctrl_pm_info {
>
> This definitely shouldn't be called "pm_info", because 'base' is not PM
> related. It should be mvebu_pinctrl_state or something like that.
>
>> void __iomem *base;
>> static u32 *mpp_saved_regs;
>> int nregs;
>> }
>>
>> 2. Add new field to struct mvebu_pinctrl:
>> struct mvebu_pinctrl_pm_info *pm_info;
>
> Does not work because "mvebu_pinctrl_pm_info" cannot be a generic
> structure, it has to be a per-SoC driver structure, since the set of
> registers to save for PM reasons is different from one SoC to the
> other. Also, some SoC have only one "base" pointer, some others (like
> Dove) have multiple.
>
> So it should be the other way around: the SoC-specific driver create a
> structure, and this structure points back to the mvebu_pinctrl
> structure.
>
How about a following compromise:
Instead of forcing pm_info, we can add a generic pointer to struct
mvebu_pinctrl, e.g. void *priv; and enable passing it in a way I
proposed before.
This way each SoC-specific driver can attach whatever is needed for
its operation. For example in A38X/AXP it would be *base,
*mpp_saved_regs and nregs gathered in one structure, but it wouldn't
force anything specific for other machines. As a result in A38X/AXP in
suspend/resume routines, there would be no globals in use at all.
Best regards,
Marcin
next prev parent reply other threads:[~2015-10-19 9:25 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-17 21:28 [PATCH] pinctrl: mvebu: armada-38x: add suspend/resume support Marcin Wojtas
2015-10-17 22:29 ` Russell King - ARM Linux
2015-10-18 8:43 ` Marcin Wojtas
2015-10-18 14:01 ` Thomas Petazzoni
2015-10-19 6:04 ` Marcin Wojtas
2015-10-19 7:23 ` Thomas Petazzoni
2015-10-19 9:25 ` Marcin Wojtas [this message]
2015-10-19 10:10 ` Marcin Wojtas
2015-10-19 10:40 ` Russell King - ARM Linux
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=CAPv3WKfxmwKaPA7BUffwsn8rweSShCSVaCyH4nrQcUkNk7uB2Q@mail.gmail.com \
--to=mw@semihalf.com \
--cc=alior@marvell.com \
--cc=andrew@lunn.ch \
--cc=gregory.clement@free-electrons.com \
--cc=jason@lakedaemon.net \
--cc=jaz@semihalf.com \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=nadavh@marvell.com \
--cc=sebastian.hesselbarth@gmail.com \
--cc=tawfik@marvell.com \
--cc=thomas.petazzoni@free-electrons.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).