Commit ec93b62f authored by Dave Gerlach's avatar Dave Gerlach Committed by Santosh Shilimkar

soc: ti: wkup_m3_ipc: Add wkup_m3_request_wake_src

Add wkup_m3_request_wake_src to allow users to get the name of
the wakeup source after a DeepSleep or Standby transition.
Signed-off-by: default avatarDave Gerlach <d-gerlach@ti.com>
Signed-off-by: default avatarKeerthy <j-keerthy@ti.com>
Signed-off-by: default avatarSantosh Shilimkar <santosh.shilimkar@oracle.com>
parent 7a872b6f
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
#define M3_BASELINE_VERSION 0x191 #define M3_BASELINE_VERSION 0x191
#define M3_STATUS_RESP_MASK (0xffff << 16) #define M3_STATUS_RESP_MASK (0xffff << 16)
#define M3_FW_VERSION_MASK 0xffff #define M3_FW_VERSION_MASK 0xffff
#define M3_WAKE_SRC_MASK 0xff
#define M3_STATE_UNKNOWN 0 #define M3_STATE_UNKNOWN 0
#define M3_STATE_RESET 1 #define M3_STATE_RESET 1
...@@ -55,6 +56,23 @@ ...@@ -55,6 +56,23 @@
static struct wkup_m3_ipc *m3_ipc_state; static struct wkup_m3_ipc *m3_ipc_state;
static const struct wkup_m3_wakeup_src wakeups[] = {
{.irq_nr = 35, .src = "USB0_PHY"},
{.irq_nr = 36, .src = "USB1_PHY"},
{.irq_nr = 40, .src = "I2C0"},
{.irq_nr = 41, .src = "RTC Timer"},
{.irq_nr = 42, .src = "RTC Alarm"},
{.irq_nr = 43, .src = "Timer0"},
{.irq_nr = 44, .src = "Timer1"},
{.irq_nr = 45, .src = "UART"},
{.irq_nr = 46, .src = "GPIO0"},
{.irq_nr = 48, .src = "MPU_WAKE"},
{.irq_nr = 49, .src = "WDT0"},
{.irq_nr = 50, .src = "WDT1"},
{.irq_nr = 51, .src = "ADC_TSC"},
{.irq_nr = 0, .src = "Unknown"},
};
static void am33xx_txev_eoi(struct wkup_m3_ipc *m3_ipc) static void am33xx_txev_eoi(struct wkup_m3_ipc *m3_ipc)
{ {
writel(AM33XX_M3_TXEV_ACK, writel(AM33XX_M3_TXEV_ACK,
...@@ -329,6 +347,26 @@ static int wkup_m3_finish_low_power(struct wkup_m3_ipc *m3_ipc) ...@@ -329,6 +347,26 @@ static int wkup_m3_finish_low_power(struct wkup_m3_ipc *m3_ipc)
return 0; return 0;
} }
/**
* wkup_m3_request_wake_src - Get the wakeup source info passed from wkup_m3
* @m3_ipc: Pointer to wkup_m3_ipc context
*/
static const char *wkup_m3_request_wake_src(struct wkup_m3_ipc *m3_ipc)
{
unsigned int wakeup_src_idx;
int j, val;
val = wkup_m3_ctrl_ipc_read(m3_ipc, 6);
wakeup_src_idx = val & M3_WAKE_SRC_MASK;
for (j = 0; j < ARRAY_SIZE(wakeups) - 1; j++) {
if (wakeups[j].irq_nr == wakeup_src_idx)
return wakeups[j].src;
}
return wakeups[j].src;
}
/** /**
* wkup_m3_set_rtc_only - Set the rtc_only flag * wkup_m3_set_rtc_only - Set the rtc_only flag
* @wkup_m3_wakeup: struct wkup_m3_wakeup_src * gets assigned the * @wkup_m3_wakeup: struct wkup_m3_wakeup_src * gets assigned the
...@@ -346,6 +384,7 @@ static struct wkup_m3_ipc_ops ipc_ops = { ...@@ -346,6 +384,7 @@ static struct wkup_m3_ipc_ops ipc_ops = {
.prepare_low_power = wkup_m3_prepare_low_power, .prepare_low_power = wkup_m3_prepare_low_power,
.finish_low_power = wkup_m3_finish_low_power, .finish_low_power = wkup_m3_finish_low_power,
.request_pm_status = wkup_m3_request_pm_status, .request_pm_status = wkup_m3_request_pm_status,
.request_wake_src = wkup_m3_request_wake_src,
.set_rtc_only = wkup_m3_set_rtc_only, .set_rtc_only = wkup_m3_set_rtc_only,
}; };
......
...@@ -43,12 +43,18 @@ struct wkup_m3_ipc { ...@@ -43,12 +43,18 @@ struct wkup_m3_ipc {
int is_rtc_only; int is_rtc_only;
}; };
struct wkup_m3_wakeup_src {
int irq_nr;
char src[10];
};
struct wkup_m3_ipc_ops { struct wkup_m3_ipc_ops {
void (*set_mem_type)(struct wkup_m3_ipc *m3_ipc, int mem_type); void (*set_mem_type)(struct wkup_m3_ipc *m3_ipc, int mem_type);
void (*set_resume_address)(struct wkup_m3_ipc *m3_ipc, void *addr); void (*set_resume_address)(struct wkup_m3_ipc *m3_ipc, void *addr);
int (*prepare_low_power)(struct wkup_m3_ipc *m3_ipc, int state); int (*prepare_low_power)(struct wkup_m3_ipc *m3_ipc, int state);
int (*finish_low_power)(struct wkup_m3_ipc *m3_ipc); int (*finish_low_power)(struct wkup_m3_ipc *m3_ipc);
int (*request_pm_status)(struct wkup_m3_ipc *m3_ipc); int (*request_pm_status)(struct wkup_m3_ipc *m3_ipc);
const char *(*request_wake_src)(struct wkup_m3_ipc *m3_ipc);
void (*set_rtc_only)(struct wkup_m3_ipc *m3_ipc); void (*set_rtc_only)(struct wkup_m3_ipc *m3_ipc);
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment