public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: linux-arm-kernel@lists.infradead.org
Cc: "linaro-acpi@lists.linaro.org" <linaro-acpi@lists.linaro.org>,
	Mark Brown <broonie@kernel.org>,
	Jassi Brar <jassisinghbrar@gmail.com>,
	rjw@rjwysocki.net, linux-acpi@vger.kernel.org,
	Ashwin Chaugule <ashwin.chaugule@linaro.org>,
	Patch Tracking <patches@linaro.org>
Subject: Re: [Linaro-acpi] [RFC v2 1/3] Mailbox: Add support for ACPI
Date: Wed, 25 Jun 2014 17:08:06 +0200	[thread overview]
Message-ID: <6663855.4TI1cqqRkF@wuerfel> (raw)
In-Reply-To: <53A9BB9E.7050707@linaro.org>

On Tuesday 24 June 2014 13:55:42 Ashwin Chaugule wrote:
> 
> Hi Arnd,
> 
> On 06/24/2014 10:18 AM, Arnd Bergmann wrote:
> 
> >
> > I think a model that's closer to the mailbox subsystem would imply
> > that the common mailbox code (or the pcc driver itself) parses the
> > PCCT table, while the slave driver only passes an index.
> 
> This is pretty close to what I have here:
> 
> The PCC mailbox version:
> 
> https://git.linaro.org/people/ashwin.chaugule/leg-kernel.git/shortlog/refs/heads/mbox-pcc-review
> 
> 
> Here the pcc driver in /drivers/acpi/pcc.c is the PCC mailbox controller 
> which parses the PCCT and /drivers/acpi/pcc-test.c is a sample PCC 
> client that sends dummy PCC reads/writes.
> 
> 
> The PCC + CPPC non-mailbox version:
> 
> https://git.linaro.org/people/ashwin.chaugule/leg-kernel.git/shortlog/refs/heads/pcc-cppc-dev
> 
> Here, the CPPC is the PCC client driver which parses the CPC tables. The 
> mailbox conversion for this stuff is a WIP. But it should give an idea 
> of how PCC and PCC clients would work.

Ok, but unfortunately it seems that there is no way for the CPPC to tell
the PCC driver to pull the index out of the CPPC tables as far as I can
tell.

> > Or even better, the slave driver would only pass a device pointer,
> > from which the pcc driver can find the pcc_register_resource in
> > the corresponding ACPI table. The name of that table can be the
> > string you pass down to the mailbox API. I suspect there is some
> > issue that makes this all break down though, but that would be
> > a portable way to do this for both DT and ACPI:
> >
> > If we wanted to use DT with the same driver, we would put the
> > name of the table containing pcc_register_resource into the
> > mbox-names property, and that could get used to look up a
> > reference to the pcc device, and to the other data that you
> > have in pcc_register_resource and PCCT.
> 
> So I dont think we should worry about the PCC clients being used in the 
> DT case, since the PCC and its client specification is very ACPI centric 
> and platforms that want to use these drivers will need an ACPI based 
> firmware anyway. Which is why I think having a separate PCC specific 
> mbox API makes sense.

I think we should be prepared to add any feature that exists in ACPI
also for DT if the need arises, even if we don't expect it to be
necessary.

There are a number of reasons why you might want to use the drivers
with DT, e.g. board bringup (before firmware is available), or to use
some features of a SoC that cannot be represented in ACPI but that
may be useful for a special-purpose appliance.

> Something like what you suggested should work well for ACPI based platforms.
> 
> struct mbox_controller *
> mbox_find_pcc_controller(char *name)
> {
> 	list_for_each_entry(mbox, &mbox_cons, node) {
> 		if (mbox->name)
> 			if (!strncmp(mbox->name, name))
> 				return mbox;
> 	}
> 
> 	return -ENODEV;
> }
> 
> int pcc_mbox_get_channel(struct mbox_client *cl,
> 		char *name, unsigned chan_id,
> 		struct mbox_chan **chan)
> {
> 	struct mbox_controller *mbox;
> 	mbox = mbox_find_pcc_controller(name);
> 
> 	if (!mbox) {
> 		pr_err("PCC mbox %s not found.\n", name);
> 		return -ENODEV;
> 	}
> 
> 	*chan = &mbox->chans[chan_id];
> 	return init_channel(*chan, cl);
> }

Yes, that seems fine, and it will just work with DT as well
if we need that.

	Arnd

  reply	other threads:[~2014-06-25 15:08 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-12 16:48 [RFC v2 0/3] ACPI Platform Communication Channel driver Ashwin Chaugule
2014-06-12 16:48 ` [RFC v2 1/3] Mailbox: Add support for ACPI Ashwin Chaugule
2014-06-12 16:52   ` Ashwin Chaugule
2014-06-12 17:02   ` Arnd Bergmann
2014-06-12 17:14     ` Ashwin Chaugule
2014-06-20 18:55       ` Ashwin Chaugule
2014-06-20 18:57         ` Ashwin Chaugule
2014-06-20 19:08         ` [Linaro-acpi] " Arnd Bergmann
2014-06-20 19:29           ` Ashwin Chaugule
2014-06-20 20:49             ` Arnd Bergmann
2014-06-20 21:43               ` Ashwin Chaugule
2014-06-21  9:34                 ` Arnd Bergmann
2014-06-23 18:25                   ` Ashwin Chaugule
2014-06-23 19:10                     ` Arnd Bergmann
2014-06-23 19:46                       ` Ashwin Chaugule
2014-06-23 20:21                         ` Arnd Bergmann
2014-06-23 21:27                           ` Ashwin Chaugule
2014-06-24 14:18                             ` Arnd Bergmann
2014-06-24 17:55                               ` Ashwin Chaugule
2014-06-25 15:08                                 ` Arnd Bergmann [this message]
2014-06-12 16:48 ` [RFC v2 2/3] ACPI: Add support for Platform Communication Channel Ashwin Chaugule
2014-06-12 16:48 ` [RFC v2 3/3] PCC test driver Ashwin Chaugule

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=6663855.4TI1cqqRkF@wuerfel \
    --to=arnd@arndb.de \
    --cc=ashwin.chaugule@linaro.org \
    --cc=broonie@kernel.org \
    --cc=jassisinghbrar@gmail.com \
    --cc=linaro-acpi@lists.linaro.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=patches@linaro.org \
    --cc=rjw@rjwysocki.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