blob: dd5971937a643c0703563a6ba4fa353237b6696c [file] [log] [blame]
Dave Gerlach41d9d442018-02-23 09:43:56 -06001/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * TI pm33xx platform data
4 *
5 * Copyright (C) 2016-2018 Texas Instruments, Inc.
6 * Dave Gerlach <d-gerlach@ti.com>
7 */
8
9#ifndef _LINUX_PLATFORM_DATA_PM33XX_H
10#define _LINUX_PLATFORM_DATA_PM33XX_H
11
12#include <linux/kbuild.h>
13#include <linux/types.h>
14
Dave Gerlach746557492018-07-09 13:03:16 +053015/*
16 * WFI Flags for sleep code control
17 *
18 * These flags allow PM code to exclude certain operations from happening
19 * in the low level ASM code found in sleep33xx.S and sleep43xx.S
20 *
21 * WFI_FLAG_FLUSH_CACHE: Flush the ARM caches and disable caching. Only
22 * needed when MPU will lose context.
23 * WFI_FLAG_SELF_REFRESH: Let EMIF place DDR memory into self-refresh and
24 * disable EMIF.
25 * WFI_FLAG_SAVE_EMIF: Save context of all EMIF registers and restore in
26 * resume path. Only needed if PER domain loses context
27 * and must also have WFI_FLAG_SELF_REFRESH set.
28 * WFI_FLAG_WAKE_M3: Disable MPU clock or clockdomain to cause wkup_m3 to
29 * execute when WFI instruction executes.
30 * WFI_FLAG_RTC_ONLY: Configure the RTC to enter RTC+DDR mode.
31 */
32#define WFI_FLAG_FLUSH_CACHE BIT(0)
33#define WFI_FLAG_SELF_REFRESH BIT(1)
34#define WFI_FLAG_SAVE_EMIF BIT(2)
35#define WFI_FLAG_WAKE_M3 BIT(3)
36#define WFI_FLAG_RTC_ONLY BIT(4)
37
Dave Gerlach41d9d442018-02-23 09:43:56 -060038#ifndef __ASSEMBLER__
39struct am33xx_pm_sram_addr {
40 void (*do_wfi)(void);
41 unsigned long *do_wfi_sz;
42 unsigned long *resume_offset;
43 unsigned long *emif_sram_table;
44 unsigned long *ro_sram_data;
Keerthy8c5a9162018-07-09 13:03:17 +053045 unsigned long resume_address;
Dave Gerlach41d9d442018-02-23 09:43:56 -060046};
47
48struct am33xx_pm_platform_data {
49 int (*init)(void);
Dave Gerlach746557492018-07-09 13:03:16 +053050 int (*soc_suspend)(unsigned int state, int (*fn)(unsigned long),
51 unsigned long args);
Dave Gerlach41d9d442018-02-23 09:43:56 -060052 struct am33xx_pm_sram_addr *(*get_sram_addrs)(void);
Keerthy8c5a9162018-07-09 13:03:17 +053053 void __iomem *(*get_rtc_base_addr)(void);
Keerthy44c22a22019-04-03 10:27:40 +053054 void (*save_context)(void);
55 void (*restore_context)(void);
56 void (*prepare_rtc_suspend)(void);
57 void (*prepare_rtc_resume)(void);
58 int (*check_off_mode_enable)(void);
Dave Gerlach41d9d442018-02-23 09:43:56 -060059};
60
61struct am33xx_pm_sram_data {
62 u32 wfi_flags;
63 u32 l2_aux_ctrl_val;
64 u32 l2_prefetch_ctrl_val;
65} __packed __aligned(8);
66
67struct am33xx_pm_ro_sram_data {
68 u32 amx3_pm_sram_data_virt;
69 u32 amx3_pm_sram_data_phys;
Keerthy8c5a9162018-07-09 13:03:17 +053070 void __iomem *rtc_base_virt;
Dave Gerlach41d9d442018-02-23 09:43:56 -060071} __packed __aligned(8);
72
73#endif /* __ASSEMBLER__ */
74#endif /* _LINUX_PLATFORM_DATA_PM33XX_H */