From: Felipe Balbi <balbi@ti.com>
To: Dave Gerlach <d-gerlach@ti.com>
Cc: balbi@ti.com, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org,
devicetree@vger.kernel.org,
Benoit Cousson <bcousson@baylibre.com>,
Ohad Ben-Cohen <ohad@wizery.com>, Suman Anna <s-anna@ti.com>,
Arnd Bergmann <arnd@arndb.de>, Kevin Hilman <khilman@linaro.org>,
Tony Lindgren <tony@atomide.com>
Subject: Re: [PATCH 3/3] remoteproc: wkup_m3: Add wkup_m3 remote proc driver
Date: Mon, 5 Jan 2015 14:20:32 -0600 [thread overview]
Message-ID: <20150105202032.GQ19336@saruman> (raw)
In-Reply-To: <54AAEFA6.3080603@ti.com>
[-- Attachment #1: Type: text/plain, Size: 5287 bytes --]
Hi,
On Mon, Jan 05, 2015 at 02:10:14PM -0600, Dave Gerlach wrote:
> >> Add a remoteproc driver to load the firmware for and boot the wkup_m3
> >> present on am33xx. The wkup_m3 is an integrated Cortex M3 that allows
> >> the SoC to enter the lowest possible power state by taking control from
> >> the MPU after it has gone into its own low power state and shutting off
> >> any additional peripherals.
> >>
> >> The driver expects a resource table to be present in the wkup_m3
> >> firmware to define the required memory resources needed by the wkup_m3,
> >> at least the data memory so that the firmware can be copied to the proper
> >> place for execution.
> >>
> >> Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
> >> ---
> >> drivers/remoteproc/Kconfig | 12 +++
> >> drivers/remoteproc/Makefile | 1 +
> >> drivers/remoteproc/wkup_m3_rproc.c | 175 +++++++++++++++++++++++++++++++++++++
> >> 3 files changed, 188 insertions(+)
> >> create mode 100644 drivers/remoteproc/wkup_m3_rproc.c
> >>
> >> diff --git a/drivers/remoteproc/Kconfig b/drivers/remoteproc/Kconfig
> >> index 5e343ba..7fbdb53 100644
> >> --- a/drivers/remoteproc/Kconfig
> >> +++ b/drivers/remoteproc/Kconfig
> >> @@ -41,6 +41,18 @@ config STE_MODEM_RPROC
> >> This can be either built-in or a loadable module.
> >> If unsure say N.
> >>
> >> +config WKUP_M3_RPROC
> >> + bool "AM33xx wkup-m3 remoteproc support"
> >
> > it would be nicer if this could be a loadable module.
>
> Do we really want that though? This is required for core PM functionality like
> CPUIdle and Suspend/resume, I feel that it should always be built in for am335x.
> I had been taking this approach with all of the PM dependencies.
right, will we have CPUIdle or suspend/resume during boot ?
> >> +static const struct of_device_id wkup_m3_rproc_of_match[] = {
> >> + {
> >> + .compatible = "ti,am3353-wkup-m3",
> >> + .data = (void *)"am335x-pm-firmware.elf",
> >
> > do you know of anybody else who might want to different firmware image
> > name ? Otherwise why pass it as driver_data ?
>
> I suppose we could pass the name in the devicetree. I do not know of any other
> users of other firmware but it's probably better to keep things flexible.
or, since this is handled internally to the driver, we can refactor this
name passing later, when we actually need a different firmware depending
on different devices. No ?
> >> +static int wkup_m3_rproc_probe(struct platform_device *pdev)
> >> +{
> >> + struct device *dev = &pdev->dev;
> >> + const char *fw_name;
> >> + struct wkup_m3_platform_data *pdata = dev->platform_data;
> >> + struct wkup_m3_rproc *m3_rproc;
> >> + const struct of_device_id *match;
> >> + struct rproc *rproc;
> >> + int ret;
> >> +
> >> + if (!(pdata && pdata->deassert_reset && pdata->assert_reset &&
> >> + pdata->reset_name)) {
> >> + dev_err(dev, "Platform data missing!\n");
> >> + return -ENODEV;
> >> + }
> >
> > if pdata is missing, couldn't you assume the thing has been reset and
> > try to load anyway ?
>
> Probably not, we MUST reset after loading the firmware as that is what boots the
> wkup_m3.
alright, perhaps add a comment ?
> >> + match = of_match_device(wkup_m3_rproc_of_match, &pdev->dev);
> >> + if (!match)
> >> + return -ENODEV;
> >> + fw_name = (char *)match->data;
> >> +
> >> + pm_runtime_enable(&pdev->dev);
> >> +
> >> + ret = pm_runtime_get_sync(&pdev->dev);
> >> + if (IS_ERR_VALUE(ret)) {
> >> + dev_err(&pdev->dev, "pm_runtime_get_sync() failed\n");
> >> + return ret;
> >
> > this is wrong for two reasons:
> >
> > a) you need to pm_runtime_disable();
> > b) even if pm_runtime_get*() fails, you _must_ call
> > pm_runtime_put_sync();
>
> Ok I will fix this and the following pm_runtime issues. Didn't realize you still
> had to call put_sync after a failed get_sync.
alright.
> >> +static int wkup_m3_rpm_suspend(struct device *dev)
> >> +{
> >> + return -EBUSY;
> >> +}
> >
> > looks like this is just coping with omap_device bogosity, no ?
> >
>
> Yes, without this omap_device shuts down ther wkup_m3 during suspend, which of
> course prevents the wkup_m3 from finishing suspend process or waking SoC back
> up. Haven't found a better solution for the problem than this.
Tony, any better for this ? Do we keep this small hack or find a better
way ?
> >> +static int wkup_m3_rpm_resume(struct device *dev)
> >> +{
> >> + return 0;
> >> +}
> >> +
> >> +static const struct dev_pm_ops wkup_m3_rproc_pm_ops = {
> >> + SET_RUNTIME_PM_OPS(wkup_m3_rpm_suspend, wkup_m3_rpm_resume, NULL)
> >> +};
> >> +
> >> +static struct platform_driver wkup_m3_rproc_driver = {
> >> + .probe = wkup_m3_rproc_probe,
> >> + .remove = wkup_m3_rproc_remove,
> >> + .driver = {
> >> + .name = "wkup_m3",
> >> + .of_match_table = wkup_m3_rproc_of_match,
> >> + .pm = &wkup_m3_rproc_pm_ops,
> >> + },
> >> +};
> >> +
> >> +module_platform_driver(wkup_m3_rproc_driver);
> >> +
> >> +MODULE_LICENSE("GPL v2");
> >> +MODULE_DESCRIPTION("wkup m3 remote processor control driver");
> >
> > do you want to add MODULE_AUTHOR() ?
> >
>
> Yes. Thanks for the comments.
np.
--
balbi
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2015-01-05 20:20 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-02 19:51 [PATCH 0/3] remoteproc: Introduce wkup_m3_rproc driver Dave Gerlach
[not found] ` <1420228319-41085-1-git-send-email-d-gerlach-l0cyMroinI0@public.gmane.org>
2015-01-02 19:51 ` [PATCH 1/3] ARM: OMAP2+: Use pdata-quirks for wkup_m3 deassert_hardreset Dave Gerlach
2015-01-02 19:51 ` [PATCH 2/3] Documentation: dt: add ti,am3353-wkup-m3 bindings Dave Gerlach
2015-01-02 19:51 ` [PATCH 3/3] remoteproc: wkup_m3: Add wkup_m3 remote proc driver Dave Gerlach
2015-01-02 20:04 ` Felipe Balbi
2015-01-05 20:10 ` Dave Gerlach
2015-01-05 20:20 ` Felipe Balbi [this message]
2015-01-05 22:48 ` Tony Lindgren
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=20150105202032.GQ19336@saruman \
--to=balbi@ti.com \
--cc=arnd@arndb.de \
--cc=bcousson@baylibre.com \
--cc=d-gerlach@ti.com \
--cc=devicetree@vger.kernel.org \
--cc=khilman@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=ohad@wizery.com \
--cc=s-anna@ti.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 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).