xref: /linux/include/linux/platform_data/ti-sysc.h (revision ef70b0bdeaf893dd6d9c3a8d05d9b65d395506c0)
149a0a3d8STony Lindgren #ifndef __TI_SYSC_DATA_H__
249a0a3d8STony Lindgren #define __TI_SYSC_DATA_H__
349a0a3d8STony Lindgren 
470a65240STony Lindgren enum ti_sysc_module_type {
570a65240STony Lindgren 	TI_SYSC_OMAP2,
670a65240STony Lindgren 	TI_SYSC_OMAP2_TIMER,
770a65240STony Lindgren 	TI_SYSC_OMAP3_SHAM,
870a65240STony Lindgren 	TI_SYSC_OMAP3_AES,
970a65240STony Lindgren 	TI_SYSC_OMAP4,
1070a65240STony Lindgren 	TI_SYSC_OMAP4_TIMER,
1170a65240STony Lindgren 	TI_SYSC_OMAP4_SIMPLE,
1270a65240STony Lindgren 	TI_SYSC_OMAP34XX_SR,
1370a65240STony Lindgren 	TI_SYSC_OMAP36XX_SR,
1470a65240STony Lindgren 	TI_SYSC_OMAP4_SR,
1570a65240STony Lindgren 	TI_SYSC_OMAP4_MCASP,
1670a65240STony Lindgren 	TI_SYSC_OMAP4_USB_HOST_FS,
1770a65240STony Lindgren };
1870a65240STony Lindgren 
19*ef70b0bdSTony Lindgren struct ti_sysc_cookie {
20*ef70b0bdSTony Lindgren 	void *data;
21*ef70b0bdSTony Lindgren };
22*ef70b0bdSTony Lindgren 
2349a0a3d8STony Lindgren /**
2449a0a3d8STony Lindgren  * struct sysc_regbits - TI OCP_SYSCONFIG register field offsets
2549a0a3d8STony Lindgren  * @midle_shift: Offset of the midle bit
2649a0a3d8STony Lindgren  * @clkact_shift: Offset of the clockactivity bit
2749a0a3d8STony Lindgren  * @sidle_shift: Offset of the sidle bit
2849a0a3d8STony Lindgren  * @enwkup_shift: Offset of the enawakeup bit
2949a0a3d8STony Lindgren  * @srst_shift: Offset of the softreset bit
3049a0a3d8STony Lindgren  * @autoidle_shift: Offset of the autoidle bit
3149a0a3d8STony Lindgren  * @dmadisable_shift: Offset of the dmadisable bit
3249a0a3d8STony Lindgren  * @emufree_shift; Offset of the emufree bit
3349a0a3d8STony Lindgren  *
3449a0a3d8STony Lindgren  * Note that 0 is a valid shift, and for ti-sysc.c -ENODEV can be used if a
3549a0a3d8STony Lindgren  * feature is not available.
3649a0a3d8STony Lindgren  */
3749a0a3d8STony Lindgren struct sysc_regbits {
3849a0a3d8STony Lindgren 	s8 midle_shift;
3949a0a3d8STony Lindgren 	s8 clkact_shift;
4049a0a3d8STony Lindgren 	s8 sidle_shift;
4149a0a3d8STony Lindgren 	s8 enwkup_shift;
4249a0a3d8STony Lindgren 	s8 srst_shift;
4349a0a3d8STony Lindgren 	s8 autoidle_shift;
4449a0a3d8STony Lindgren 	s8 dmadisable_shift;
4549a0a3d8STony Lindgren 	s8 emufree_shift;
4649a0a3d8STony Lindgren };
4749a0a3d8STony Lindgren 
48c5a2de97STony Lindgren #define SYSC_QUIRK_RESET_STATUS		BIT(7)
49566a9b05STony Lindgren #define SYSC_QUIRK_NO_IDLE_ON_INIT	BIT(6)
50566a9b05STony Lindgren #define SYSC_QUIRK_NO_RESET_ON_INIT	BIT(5)
51566a9b05STony Lindgren #define SYSC_QUIRK_OPT_CLKS_NEEDED	BIT(4)
52566a9b05STony Lindgren #define SYSC_QUIRK_OPT_CLKS_IN_RESET	BIT(3)
53a7199e2bSTony Lindgren #define SYSC_QUIRK_16BIT		BIT(2)
5470a65240STony Lindgren #define SYSC_QUIRK_UNCACHED		BIT(1)
5570a65240STony Lindgren #define SYSC_QUIRK_USE_CLOCKACT		BIT(0)
5670a65240STony Lindgren 
57c5a2de97STony Lindgren #define SYSC_NR_IDLEMODES		4
58c5a2de97STony Lindgren 
5970a65240STony Lindgren /**
6070a65240STony Lindgren  * struct sysc_capabilities - capabilities for an interconnect target module
6170a65240STony Lindgren  *
6270a65240STony Lindgren  * @sysc_mask: bitmask of supported SYSCONFIG register bits
6370a65240STony Lindgren  * @regbits: bitmask of SYSCONFIG register bits
6470a65240STony Lindgren  * @mod_quirks: bitmask of module specific quirks
6570a65240STony Lindgren  */
6670a65240STony Lindgren struct sysc_capabilities {
6770a65240STony Lindgren 	const enum ti_sysc_module_type type;
6870a65240STony Lindgren 	const u32 sysc_mask;
6970a65240STony Lindgren 	const struct sysc_regbits *regbits;
7070a65240STony Lindgren 	const u32 mod_quirks;
7170a65240STony Lindgren };
7270a65240STony Lindgren 
7370a65240STony Lindgren /**
7470a65240STony Lindgren  * struct sysc_config - configuration for an interconnect target module
75c5a2de97STony Lindgren  * @sysc_val: configured value for sysc register
76c5a2de97STony Lindgren  * @midlemodes: bitmask of supported master idle modes
77c5a2de97STony Lindgren  * @sidlemodes: bitmask of supported master idle modes
78566a9b05STony Lindgren  * @srst_udelay: optional delay needed after OCP soft reset
7970a65240STony Lindgren  * @quirks: bitmask of enabled quirks
8070a65240STony Lindgren  */
8170a65240STony Lindgren struct sysc_config {
82c5a2de97STony Lindgren 	u32 sysc_val;
83c5a2de97STony Lindgren 	u32 syss_mask;
84c5a2de97STony Lindgren 	u8 midlemodes;
85c5a2de97STony Lindgren 	u8 sidlemodes;
86566a9b05STony Lindgren 	u8 srst_udelay;
8770a65240STony Lindgren 	u32 quirks;
8870a65240STony Lindgren };
8970a65240STony Lindgren 
90*ef70b0bdSTony Lindgren enum sysc_registers {
91*ef70b0bdSTony Lindgren 	SYSC_REVISION,
92*ef70b0bdSTony Lindgren 	SYSC_SYSCONFIG,
93*ef70b0bdSTony Lindgren 	SYSC_SYSSTATUS,
94*ef70b0bdSTony Lindgren 	SYSC_MAX_REGS,
95*ef70b0bdSTony Lindgren };
96*ef70b0bdSTony Lindgren 
97*ef70b0bdSTony Lindgren /**
98*ef70b0bdSTony Lindgren  * struct ti_sysc_module_data - ti-sysc to hwmod translation data for a module
99*ef70b0bdSTony Lindgren  * @name: legacy "ti,hwmods" module name
100*ef70b0bdSTony Lindgren  * @module_pa: physical address of the interconnect target module
101*ef70b0bdSTony Lindgren  * @module_size: size of the interconnect target module
102*ef70b0bdSTony Lindgren  * @offsets: array of register offsets as listed in enum sysc_registers
103*ef70b0bdSTony Lindgren  * @nr_offsets: number of registers
104*ef70b0bdSTony Lindgren  * @cap: interconnect target module capabilities
105*ef70b0bdSTony Lindgren  * @cfg: interconnect target module configuration
106*ef70b0bdSTony Lindgren  *
107*ef70b0bdSTony Lindgren  * This data is enough to allocate a new struct omap_hwmod_class_sysconfig
108*ef70b0bdSTony Lindgren  * based on device tree data parsed by ti-sysc driver.
109*ef70b0bdSTony Lindgren  */
110*ef70b0bdSTony Lindgren struct ti_sysc_module_data {
111*ef70b0bdSTony Lindgren 	const char *name;
112*ef70b0bdSTony Lindgren 	u64 module_pa;
113*ef70b0bdSTony Lindgren 	u32 module_size;
114*ef70b0bdSTony Lindgren 	int *offsets;
115*ef70b0bdSTony Lindgren 	int nr_offsets;
116*ef70b0bdSTony Lindgren 	const struct sysc_capabilities *cap;
117*ef70b0bdSTony Lindgren 	struct sysc_config *cfg;
118*ef70b0bdSTony Lindgren };
119*ef70b0bdSTony Lindgren 
120*ef70b0bdSTony Lindgren struct device;
121*ef70b0bdSTony Lindgren 
122*ef70b0bdSTony Lindgren struct ti_sysc_platform_data {
123*ef70b0bdSTony Lindgren 	struct of_dev_auxdata *auxdata;
124*ef70b0bdSTony Lindgren 	int (*init_module)(struct device *dev,
125*ef70b0bdSTony Lindgren 			   const struct ti_sysc_module_data *data,
126*ef70b0bdSTony Lindgren 			   struct ti_sysc_cookie *cookie);
127*ef70b0bdSTony Lindgren 	int (*enable_module)(struct device *dev,
128*ef70b0bdSTony Lindgren 			     const struct ti_sysc_cookie *cookie);
129*ef70b0bdSTony Lindgren 	int (*idle_module)(struct device *dev,
130*ef70b0bdSTony Lindgren 			   const struct ti_sysc_cookie *cookie);
131*ef70b0bdSTony Lindgren 	int (*shutdown_module)(struct device *dev,
132*ef70b0bdSTony Lindgren 			       const struct ti_sysc_cookie *cookie);
133*ef70b0bdSTony Lindgren };
134*ef70b0bdSTony Lindgren 
13549a0a3d8STony Lindgren #endif	/* __TI_SYSC_DATA_H__ */
136