diff options
author | Dave Gerlach <d-gerlach@ti.com> | 2018-07-04 23:19:06 -0400 |
---|---|---|
committer | Santosh Shilimkar <santosh.shilimkar@oracle.com> | 2018-07-04 23:19:06 -0400 |
commit | ec93b62fec9c7138d2b75334d192ecc12376f885 (patch) | |
tree | 608754957d2e8ff6be574a8a14c57726325cc9e0 /drivers/soc/ti | |
parent | 7a872b6fb7fdc4213e9bb4e1c83a65e6b8af7ebd (diff) |
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: Dave Gerlach <d-gerlach@ti.com>
Signed-off-by: Keerthy <j-keerthy@ti.com>
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
Diffstat (limited to 'drivers/soc/ti')
-rw-r--r-- | drivers/soc/ti/wkup_m3_ipc.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/drivers/soc/ti/wkup_m3_ipc.c b/drivers/soc/ti/wkup_m3_ipc.c index b732c39e2754..6840688236b9 100644 --- a/drivers/soc/ti/wkup_m3_ipc.c +++ b/drivers/soc/ti/wkup_m3_ipc.c | |||
@@ -46,6 +46,7 @@ | |||
46 | #define M3_BASELINE_VERSION 0x191 | 46 | #define M3_BASELINE_VERSION 0x191 |
47 | #define M3_STATUS_RESP_MASK (0xffff << 16) | 47 | #define M3_STATUS_RESP_MASK (0xffff << 16) |
48 | #define M3_FW_VERSION_MASK 0xffff | 48 | #define M3_FW_VERSION_MASK 0xffff |
49 | #define M3_WAKE_SRC_MASK 0xff | ||
49 | 50 | ||
50 | #define M3_STATE_UNKNOWN 0 | 51 | #define M3_STATE_UNKNOWN 0 |
51 | #define M3_STATE_RESET 1 | 52 | #define M3_STATE_RESET 1 |
@@ -55,6 +56,23 @@ | |||
55 | 56 | ||
56 | static struct wkup_m3_ipc *m3_ipc_state; | 57 | static struct wkup_m3_ipc *m3_ipc_state; |
57 | 58 | ||
59 | static const struct wkup_m3_wakeup_src wakeups[] = { | ||
60 | {.irq_nr = 35, .src = "USB0_PHY"}, | ||
61 | {.irq_nr = 36, .src = "USB1_PHY"}, | ||
62 | {.irq_nr = 40, .src = "I2C0"}, | ||
63 | {.irq_nr = 41, .src = "RTC Timer"}, | ||
64 | {.irq_nr = 42, .src = "RTC Alarm"}, | ||
65 | {.irq_nr = 43, .src = "Timer0"}, | ||
66 | {.irq_nr = 44, .src = "Timer1"}, | ||
67 | {.irq_nr = 45, .src = "UART"}, | ||
68 | {.irq_nr = 46, .src = "GPIO0"}, | ||
69 | {.irq_nr = 48, .src = "MPU_WAKE"}, | ||
70 | {.irq_nr = 49, .src = "WDT0"}, | ||
71 | {.irq_nr = 50, .src = "WDT1"}, | ||
72 | {.irq_nr = 51, .src = "ADC_TSC"}, | ||
73 | {.irq_nr = 0, .src = "Unknown"}, | ||
74 | }; | ||
75 | |||
58 | static void am33xx_txev_eoi(struct wkup_m3_ipc *m3_ipc) | 76 | static void am33xx_txev_eoi(struct wkup_m3_ipc *m3_ipc) |
59 | { | 77 | { |
60 | writel(AM33XX_M3_TXEV_ACK, | 78 | writel(AM33XX_M3_TXEV_ACK, |
@@ -330,6 +348,26 @@ static int wkup_m3_finish_low_power(struct wkup_m3_ipc *m3_ipc) | |||
330 | } | 348 | } |
331 | 349 | ||
332 | /** | 350 | /** |
351 | * wkup_m3_request_wake_src - Get the wakeup source info passed from wkup_m3 | ||
352 | * @m3_ipc: Pointer to wkup_m3_ipc context | ||
353 | */ | ||
354 | static const char *wkup_m3_request_wake_src(struct wkup_m3_ipc *m3_ipc) | ||
355 | { | ||
356 | unsigned int wakeup_src_idx; | ||
357 | int j, val; | ||
358 | |||
359 | val = wkup_m3_ctrl_ipc_read(m3_ipc, 6); | ||
360 | |||
361 | wakeup_src_idx = val & M3_WAKE_SRC_MASK; | ||
362 | |||
363 | for (j = 0; j < ARRAY_SIZE(wakeups) - 1; j++) { | ||
364 | if (wakeups[j].irq_nr == wakeup_src_idx) | ||
365 | return wakeups[j].src; | ||
366 | } | ||
367 | return wakeups[j].src; | ||
368 | } | ||
369 | |||
370 | /** | ||
333 | * wkup_m3_set_rtc_only - Set the rtc_only flag | 371 | * wkup_m3_set_rtc_only - Set the rtc_only flag |
334 | * @wkup_m3_wakeup: struct wkup_m3_wakeup_src * gets assigned the | 372 | * @wkup_m3_wakeup: struct wkup_m3_wakeup_src * gets assigned the |
335 | * wakeup src value | 373 | * wakeup src value |
@@ -346,6 +384,7 @@ static struct wkup_m3_ipc_ops ipc_ops = { | |||
346 | .prepare_low_power = wkup_m3_prepare_low_power, | 384 | .prepare_low_power = wkup_m3_prepare_low_power, |
347 | .finish_low_power = wkup_m3_finish_low_power, | 385 | .finish_low_power = wkup_m3_finish_low_power, |
348 | .request_pm_status = wkup_m3_request_pm_status, | 386 | .request_pm_status = wkup_m3_request_pm_status, |
387 | .request_wake_src = wkup_m3_request_wake_src, | ||
349 | .set_rtc_only = wkup_m3_set_rtc_only, | 388 | .set_rtc_only = wkup_m3_set_rtc_only, |
350 | }; | 389 | }; |
351 | 390 | ||