linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Hilman <khilman@linaro.org>
To: Dave Gerlach <d-gerlach@ti.com>
Cc: linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org,
	Paul Walmsley <paul@pwsan.com>,
	Vaibhav Bedia <vaibhav.bedia@ti.com>,
	Tony Lingren <tony@atomide.com>,
	Santosh Shilimkar <santosh.shilimkar@ti.com>,
	Benoit Cousson <benoit.cousson@linaro.org>
Subject: Re: [PATCHv3 8/9] ARM: OMAP2+: AM33XX: Basic suspend resume support
Date: Tue, 27 Aug 2013 14:45:19 -0700	[thread overview]
Message-ID: <87mwo2vmds.fsf@linaro.org> (raw)
In-Reply-To: <1375811376-49985-9-git-send-email-d-gerlach@ti.com> (Dave Gerlach's message of "Tue, 6 Aug 2013 12:49:35 -0500")

Dave Gerlach <d-gerlach@ti.com> writes:

> From: Vaibhav Bedia <vaibhav.bedia@ti.com>
>
> AM335x supports various low power modes as documented
> in section 8.1.4.3 of the AM335x TRM which is available
> @ http://www.ti.com/litv/pdf/spruh73f
>
> DeepSleep0 mode offers the lowest power mode with limited
> wakeup sources without a system reboot and is mapped as
> the suspend state in the kernel. In this state, MPU and
> PER domains are turned off with the internal RAM held in
> retention to facilitate resume process. As part of the boot
> process, the assembly code is copied over to OCMCRAM using
> the OMAP SRAM code.
>
> AM335x has a Cortex-M3 (WKUP_M3) which assists the MPU
> in DeepSleep0 entry and exit. WKUP_M3 takes care of the
> clockdomain and powerdomain transitions based on the
> intended low power state. MPU needs to load the appropriate
> WKUP_M3 binary onto the WKUP_M3 memory space before it can
> leverage any of the PM features like DeepSleep.
>
> The IPC mechanism between MPU and WKUP_M3 uses a mailbox
> sub-module and 8 IPC registers in the Control module. MPU
> uses the assigned Mailbox for issuing an interrupt to
> WKUP_M3 which then goes and checks the IPC registers for
> the payload. WKUP_M3 has the ability to trigger on interrupt

s/trigger on interrupt/trigger an interrupt/  ??

> to MPU by executing the "sev" instruction.
>
> In the current implementation when the suspend process
> is initiated MPU interrupts the WKUP_M3 to let it know about
> the intent of entering DeepSleep0 and waits for an ACK. When
> the ACK is received MPU continues with its suspend process
> to suspend all the drivers and then jumps to assembly in
> OCMC RAM. The assembly code puts the PLLs in bypass, puts the
> external RAM in self-refresh mode and then finally execute the
> WFI instruction. Execution of the WFI instruction triggers another
> interrupt to the WKUP_M3 which then continues wiht the power down
> sequence wherein the clockdomain and powerdomain transition takes
> place. As part of the sleep sequence, WKUP_M3 unmasks the interrupt
> lines for the wakeup sources. WFI execution on WKUP_M3 causes the
> hardware to disable the main oscillator of the SoC.
>
> When a wakeup event occurs, WKUP_M3 starts the power-up
> sequence by switching on the power domains and finally
> enabling the clock to MPU. Since the MPU gets powered down
> as part of the sleep sequence in the resume path ROM code
> starts executing. The ROM code detects a wakeup from sleep
> and then jumps to the resume location in OCMC which was
> populated in one of the IPC registers as part of the suspend
> sequence.
>
> The low level code in OCMC relocks the PLLs, enables access
> to external RAM and then jumps to the cpu_resume code of
> the kernel to finish the resume process.

[...]

>  arch/arm/mach-omap2/pm33xx.c  |  474 +++++++++++++++++++++++++++++++++++++++++
>  arch/arm/mach-omap2/pm33xx.h  |   77 +++++++
>  arch/arm/mach-omap2/wkup_m3.c |  183 ++++++++++++++++


Looking closer at this code as I'm trying to fully get my head around
all the IPC, I have some more comments.

I think the split between pm33xx.c and the M3 driver is still confusing
here.  For example, am33xx_ping_wkup_m3(),
am33xx_m3_state_machine_reset() and the guts of am33xx_pm_begin() all
belong inside the M3 driver, along with all the wakeup_src stuff, which
is info coming from the M3.

IOW, the communication with M3 should be abstracted from pm33xx by the
M3 driver (or possibly an eventual remoteproc/rpmsg implementation) with
a well defined API.  In this implementation, the interface is pretty
fuzzy and mixed between pm33xx.c and wkup_m3.c.

Kevin

P.S. I'd also suggest renaming wakeup_src to something else since
it's close to wakeup_source which has a rather different meaning in the
kernel (c.f. linux/pm_wakeup.h)

  parent reply	other threads:[~2013-08-27 21:45 UTC|newest]

Thread overview: 106+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-06 17:49 [PATCHv3 0/9] ARM: OMAP2+: AM33XX: Add suspend-resume support Dave Gerlach
2013-08-06 17:49 ` [PATCHv3 1/9] memory: emif: Move EMIF register defines to include/linux/ Dave Gerlach
2013-08-08  0:48   ` Russ Dill
2013-08-08 13:35   ` Santosh Shilimkar
2013-08-12 19:32     ` Greg Kroah-Hartman
2013-08-12 19:33       ` Santosh Shilimkar
2013-08-06 17:49 ` [PATCHv3 2/9] ARM: OMAP2+: AM33XX: control: Add some control module registers and APIs Dave Gerlach
2013-08-08  0:52   ` Russ Dill
2013-08-08 13:44   ` Santosh Shilimkar
2013-08-08 16:16     ` Dave Gerlach
2013-08-09  5:11       ` Tony Lindgren
2013-08-09 20:55         ` Dave Gerlach
2013-08-12  7:54           ` Tony Lindgren
2013-08-12 19:17           ` Kevin Hilman
2013-08-12 21:40             ` Dave Gerlach
2013-08-13 14:29               ` Kevin Hilman
2013-08-13 15:08                 ` Santosh Shilimkar
2013-08-13 16:19                   ` Kevin Hilman
2013-08-13 18:18                     ` Santosh Shilimkar
2013-08-13 18:30                       ` Russ Dill
2013-08-13 18:40                         ` Santosh Shilimkar
2013-08-13 19:11                         ` Kevin Hilman
2013-08-14 17:27                           ` Suman Anna
2013-08-14 19:16                             ` Russ Dill
2013-08-20 23:39                             ` Paul Walmsley
2013-08-21 17:32                               ` Suman Anna
2013-08-06 17:49 ` [PATCHv3 3/9] ARM: OMAP: DTB: Update IRQ data for WKUP_M3 Dave Gerlach
2013-08-08  0:53   ` Russ Dill
2013-08-08 13:46   ` Santosh Shilimkar
2013-08-06 17:49 ` [PATCHv3 4/9] ARM: OMAP2+: AM33XX: Reserve memory to comply with EMIF spec Dave Gerlach
2013-08-08  2:30   ` Russ Dill
2013-08-08 14:19   ` Santosh Shilimkar
2013-08-08 18:16   ` Kevin Hilman
2013-08-08 19:31     ` Santosh Shilimkar
2013-08-08 20:05       ` Kevin Hilman
2013-08-08 20:11         ` Santosh Shilimkar
2013-08-09 15:11           ` Kevin Hilman
2013-08-09 16:25             ` Dave Gerlach
2013-08-06 17:49 ` [PATCHv3 5/9] ARM: OMAP2+: AM33XX: Add assembly code for PM operations Dave Gerlach
2013-08-08  7:02   ` Russ Dill
2013-08-08 14:50   ` Santosh Shilimkar
2013-08-08 15:16     ` Russ Dill
2013-08-08 15:22       ` Santosh Shilimkar
2013-08-08 16:03         ` Russ Dill
2013-08-19 12:54   ` Gururaja Hebbar
2013-08-19 17:51     ` Dave Gerlach
2013-08-06 17:49 ` [PATCHv3 6/9] ARM: OMAP2+: timer: Add suspend-resume callbacks for clkevent device Dave Gerlach
2013-08-08  7:03   ` Russ Dill
2013-08-08 14:23   ` Santosh Shilimkar
2013-08-08 16:09     ` Dave Gerlach
2013-08-08 18:25   ` Kevin Hilman
2013-08-08 19:49     ` Dave Gerlach
2013-08-06 17:49 ` [PATCHv3 7/9] ARM: OMAP: omap_device: Add APIs to enable and idle hwmods Dave Gerlach
2013-08-08  7:05   ` Russ Dill
2013-08-08 14:26   ` Santosh Shilimkar
2013-08-06 17:49 ` [PATCHv3 8/9] ARM: OMAP2+: AM33XX: Basic suspend resume support Dave Gerlach
2013-08-07 16:22   ` Nishanth Menon
2013-08-07 18:12     ` Dave Gerlach
2013-08-07 19:16       ` Nishanth Menon
2013-08-08  8:45   ` Russ Dill
2013-08-08 12:26     ` Nishanth Menon
2013-08-08 15:03       ` Santosh Shilimkar
2013-08-08 16:06         ` Dave Gerlach
2013-08-08 16:22           ` Nishanth Menon
2013-08-08 21:14           ` Kevin Hilman
2013-08-08 21:32             ` Nishanth Menon
2013-08-08 23:04               ` Kevin Hilman
2013-08-09 15:11                 ` Nishanth Menon
2013-08-09 16:12                   ` Kevin Hilman
2013-08-09 16:36                     ` Nishanth Menon
2013-08-09 20:34                       ` Kevin Hilman
2013-08-09 21:35                         ` Nishanth Menon
2013-08-09 22:28                         ` Russ Dill
2013-08-12 16:09                           ` Kevin Hilman
2013-08-30 17:29                 ` Vaibhav Bedia
2013-08-20 22:48             ` Paul Walmsley
2013-08-23 14:56               ` Dave Gerlach
2013-08-13  7:43   ` Russ Dill
2013-08-13 14:59     ` Kevin Hilman
2013-08-27 21:45   ` Kevin Hilman [this message]
2013-08-29 21:41     ` Dave Gerlach
2013-08-29 22:02       ` Kevin Hilman
2013-08-30 17:39     ` Vaibhav Bedia
2013-08-30 21:18       ` Kevin Hilman
2013-08-06 17:49 ` [PATCHv3 9/9] ARM: OMAP2+: AM33XX: Hookup AM33XX PM code into OMAP builds Dave Gerlach
2013-08-08  8:47   ` Russ Dill
2013-08-08 14:53   ` Santosh Shilimkar
2013-08-08 13:31 ` [PATCHv3 0/9] ARM: OMAP2+: AM33XX: Add suspend-resume support Santosh Shilimkar
2013-08-11 11:53 ` Daniel Mack
2013-08-12 18:59   ` Dave Gerlach
2013-08-13 12:39     ` Daniel Mack
2013-08-13 15:33       ` Dave Gerlach
2013-08-13 15:51         ` Daniel Mack
2013-08-19  9:23 ` Gururaja Hebbar
2013-08-19 17:47   ` Dave Gerlach
2013-08-27 20:23     ` Kevin Hilman
2013-08-29 21:30       ` Dave Gerlach
2013-08-29 21:52         ` Kevin Hilman
2013-08-29 22:20           ` Dave Gerlach
2013-08-29 22:20         ` Kevin Hilman
2013-08-29 22:43           ` Russ Dill
2013-08-29 23:02             ` Kevin Hilman
2013-09-03 17:24               ` Dave Gerlach
2013-09-04 15:01                 ` Kevin Hilman
2013-09-04 15:12                   ` Russ Dill
2013-09-04 15:18                     ` Kevin Hilman

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=87mwo2vmds.fsf@linaro.org \
    --to=khilman@linaro.org \
    --cc=benoit.cousson@linaro.org \
    --cc=d-gerlach@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=paul@pwsan.com \
    --cc=santosh.shilimkar@ti.com \
    --cc=tony@atomide.com \
    --cc=vaibhav.bedia@ti.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).