From: d-gerlach@ti.com (Dave Gerlach)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCHv3 2/9] ARM: OMAP2+: AM33XX: control: Add some control module registers and APIs
Date: Thu, 8 Aug 2013 11:16:23 -0500 [thread overview]
Message-ID: <5203C457.80301@ti.com> (raw)
In-Reply-To: <5203A0BC.8060205@ti.com>
On 08/08/2013 08:44 AM, Santosh Shilimkar wrote:
> On Tuesday 06 August 2013 01:49 PM, Dave Gerlach wrote:
>> From: Vaibhav Bedia <vaibhav.bedia@ti.com>
>>
>> Interacting with WKUP-M3 requires some more control
>> module register writes. Add the register offsets and
>> APIs to write to these.
>>
>> Signed-off-by: Vaibhav Bedia <vaibhav.bedia@ti.com>
>> Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
>> ---
>> arch/arm/mach-omap2/control.c | 57 +++++++++++++++++++++++++++++++++++++++++
>> arch/arm/mach-omap2/control.h | 54 ++++++++++++++++++++++++++++++++++++++
>> 2 files changed, 111 insertions(+)
>>
>> diff --git a/arch/arm/mach-omap2/control.c b/arch/arm/mach-omap2/control.c
>> index 31e0dfe..934041a 100644
>> --- a/arch/arm/mach-omap2/control.c
>> +++ b/arch/arm/mach-omap2/control.c
>> @@ -605,3 +605,60 @@ int omap3_ctrl_save_padconf(void)
>> }
>>
>> #endif /* CONFIG_ARCH_OMAP3 && CONFIG_PM */
>> +
>> +#if defined(CONFIG_SOC_AM33XX) && defined(CONFIG_PM)
>> +void am33xx_txev_eoi(void)
>> +{
>> + omap_ctrl_writel(AM33XX_M3_TXEV_ACK, AM33XX_CONTROL_M3_TXEV_EOI);
>> +}
>> +
>> +void am33xx_txev_enable(void)
>> +{
>> + omap_ctrl_writel(AM33XX_M3_TXEV_ENABLE, AM33XX_CONTROL_M3_TXEV_EOI);
>> +}
>> +
>> +/*
>> + * Invalidate M3 firmware version before hardreset.
>> + * Write invalid version in lower 4 nibbles of parameter
>> + * register (ipc_regs + 0x8).
>> + */
>> +void am33xx_pm_version_clear(void)
>> +{
>> + omap_ctrl_writel(0xffff0000, AM33XX_CONTROL_IPC_MSG_REG2);
>> +}
>> +
>> +int am33xx_pm_version_get(void)
>> +{
>> + return omap_ctrl_readl(AM33XX_CONTROL_IPC_MSG_REG2) & M3_VERSION_MASK;
>> +}
>> +
>> +void am33xx_pm_ipc_cmd(struct am33xx_ipc_data *data)
>> +{
>> + omap_ctrl_writel(data->resume_addr, AM33XX_CONTROL_IPC_MSG_REG0);
>> + omap_ctrl_writel(data->sleep_mode, AM33XX_CONTROL_IPC_MSG_REG1);
>> + omap_ctrl_writel(data->param1, AM33XX_CONTROL_IPC_MSG_REG2);
>> + omap_ctrl_writel(data->param2, AM33XX_CONTROL_IPC_MSG_REG3);
>> + omap_ctrl_writel(data->param3, AM33XX_CONTROL_IPC_MSG_REG4);
>> +}
>> +
>> +int am33xx_pm_status(void)
>> +{
>> + int i;
>> +
>> + i = omap_ctrl_readl(AM33XX_CONTROL_IPC_MSG_REG1);
>> + i &= IPC_RESP_MASK;
>> + i >>= __ffs(IPC_RESP_MASK);
>> +
>> + return i;
>> +}
>> +
>> +int am33xx_pm_wake_src(void)
>> +{
>> + int i;
>> +
>> + i = omap_ctrl_readl(AM33XX_CONTROL_IPC_MSG_REG6);
>> + i &= 0xff;
>> +
>> + return i;
>> +}
>> +#endif /* CONFIG_SOC_AM33XX && CONFIG_PM */
>> diff --git a/arch/arm/mach-omap2/control.h b/arch/arm/mach-omap2/control.h
>> index f7d7c2e..9be587c 100644
>> --- a/arch/arm/mach-omap2/control.h
>> +++ b/arch/arm/mach-omap2/control.h
>> @@ -370,6 +370,22 @@
>> #define AM33XX_DEV_FEATURE 0x604
>> #define AM33XX_SGX_MASK BIT(29)
>>
>> +/* AM33XX M3_TXEV_EOI register */
>> +#define AM33XX_CONTROL_M3_TXEV_EOI 0x1324
>> +
>> +#define AM33XX_M3_TXEV_ACK (0x1 << 0)
>> +#define AM33XX_M3_TXEV_ENABLE (0x0 << 0)
>> +
>> +/* AM33XX IPC message registers */
>> +#define AM33XX_CONTROL_IPC_MSG_REG0 0x1328
>> +#define AM33XX_CONTROL_IPC_MSG_REG1 0x132C
>> +#define AM33XX_CONTROL_IPC_MSG_REG2 0x1330
>> +#define AM33XX_CONTROL_IPC_MSG_REG3 0x1334
>> +#define AM33XX_CONTROL_IPC_MSG_REG4 0x1338
>> +#define AM33XX_CONTROL_IPC_MSG_REG5 0x133C
>> +#define AM33XX_CONTROL_IPC_MSG_REG6 0x1340
>> +#define AM33XX_CONTROL_IPC_MSG_REG7 0x1344
>> +
>> /* CONTROL OMAP STATUS register to identify OMAP3 features */
>> #define OMAP3_CONTROL_OMAP_STATUS 0x044c
>>
>> @@ -429,6 +445,44 @@ extern void omap3630_ctrl_disable_rta(void);
>> extern int omap3_ctrl_save_padconf(void);
>> extern void omap2_set_globals_control(void __iomem *ctrl,
>> void __iomem *ctrl_pad);
>> +struct am33xx_ipc_data {
>> + u32 resume_addr;
>> + u32 sleep_mode;
>> + u32 param1;
>> + u32 param2;
>> + u32 param3;
>> + u32 param4;
>> + u32 param5;
>> + u32 param6;
>> +};
>> +
>> +#define IPC_RESP_SHIFT 16
>> +#define IPC_RESP_MASK (0xffff << 16)
>> +
>> +#define M3_VERSION_SHIFT 0
>> +#define M3_VERSION_MASK (0xffff << 0)
>> +
>> +/*
>> + * 9-4 = VTT GPIO PIN (6 Bits)
>> + * 3 = VTT Status (1 Bit)
>> + * 2-0 = Memory Type (2 Bits)
>> +*/
>> +#define MEM_TYPE_SHIFT (0x0)
>> +#define MEM_TYPE_MASK (0x7 << 0)
>> +#define VTT_STAT_SHIFT (0x3)
>> +#define VTT_STAT_MASK (0x1 << 3)
>> +#define VTT_GPIO_PIN_SHIFT (0x4)
>> +#define VTT_GPIO_PIN_MASK (0x2f << 4)
>> +
>> +extern void am33xx_wkup_m3_ipc_cmd(struct am33xx_ipc_data *data);
>> +extern void am33xx_txev_eoi(void);
>> +extern void am33xx_txev_enable(void);
>> +extern void am33xx_pm_version_clear(void);
>> +extern int am33xx_pm_version_get(void);
>> +extern void am33xx_pm_ipc_cmd(struct am33xx_ipc_data *data);
>> +extern int am33xx_pm_status(void);
>> +extern int am33xx_pm_wake_src(void);
>> +
> Lets address the above better. I don't see a need of 8 functions
> exported doing one or 2 register writes.
>
> Look M3 based handling is going to be there on future SOCs
> as well and this kind of handling of IPC is very short cited.
>
The idea here was to move all control module register accesses into one
file in planning of implementing a driver for the control module itself
in the future.
> Probably we should have a separate driver for M3 in linux which
> can have all this local code instead of all these exports.
The wkup_m3 code has been moved to a small driver found in patch 8 of
this series, would it better to move this code there rather than with
the rest of the control module code?
>
> Regards,
> Santosh
>
next prev parent reply other threads:[~2013-08-08 16:16 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 [this message]
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
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=5203C457.80301@ti.com \
--to=d-gerlach@ti.com \
--cc=linux-arm-kernel@lists.infradead.org \
/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).