Tony Lindgren | 49a0a3d | 2017-12-15 09:41:05 -0800 | [diff] [blame] | 1 | #ifndef __TI_SYSC_DATA_H__ |
| 2 | #define __TI_SYSC_DATA_H__ |
| 3 | |
Tony Lindgren | 70a6524 | 2017-12-15 09:41:09 -0800 | [diff] [blame] | 4 | enum ti_sysc_module_type { |
| 5 | TI_SYSC_OMAP2, |
| 6 | TI_SYSC_OMAP2_TIMER, |
| 7 | TI_SYSC_OMAP3_SHAM, |
| 8 | TI_SYSC_OMAP3_AES, |
| 9 | TI_SYSC_OMAP4, |
| 10 | TI_SYSC_OMAP4_TIMER, |
| 11 | TI_SYSC_OMAP4_SIMPLE, |
| 12 | TI_SYSC_OMAP34XX_SR, |
| 13 | TI_SYSC_OMAP36XX_SR, |
| 14 | TI_SYSC_OMAP4_SR, |
| 15 | TI_SYSC_OMAP4_MCASP, |
| 16 | TI_SYSC_OMAP4_USB_HOST_FS, |
Faiz Abbas | 7f35e63 | 2018-07-09 22:18:38 +0530 | [diff] [blame] | 17 | TI_SYSC_DRA7_MCAN, |
Tony Lindgren | 70a6524 | 2017-12-15 09:41:09 -0800 | [diff] [blame] | 18 | }; |
| 19 | |
Tony Lindgren | ef70b0b | 2018-02-22 14:00:25 -0800 | [diff] [blame] | 20 | struct ti_sysc_cookie { |
| 21 | void *data; |
| 22 | }; |
| 23 | |
Tony Lindgren | 49a0a3d | 2017-12-15 09:41:05 -0800 | [diff] [blame] | 24 | /** |
| 25 | * struct sysc_regbits - TI OCP_SYSCONFIG register field offsets |
| 26 | * @midle_shift: Offset of the midle bit |
| 27 | * @clkact_shift: Offset of the clockactivity bit |
| 28 | * @sidle_shift: Offset of the sidle bit |
| 29 | * @enwkup_shift: Offset of the enawakeup bit |
| 30 | * @srst_shift: Offset of the softreset bit |
| 31 | * @autoidle_shift: Offset of the autoidle bit |
| 32 | * @dmadisable_shift: Offset of the dmadisable bit |
| 33 | * @emufree_shift; Offset of the emufree bit |
| 34 | * |
| 35 | * Note that 0 is a valid shift, and for ti-sysc.c -ENODEV can be used if a |
| 36 | * feature is not available. |
| 37 | */ |
| 38 | struct sysc_regbits { |
| 39 | s8 midle_shift; |
| 40 | s8 clkact_shift; |
| 41 | s8 sidle_shift; |
| 42 | s8 enwkup_shift; |
| 43 | s8 srst_shift; |
| 44 | s8 autoidle_shift; |
| 45 | s8 dmadisable_shift; |
| 46 | s8 emufree_shift; |
| 47 | }; |
| 48 | |
Tony Lindgren | e7420c2 | 2018-04-16 10:26:46 -0700 | [diff] [blame] | 49 | #define SYSC_QUIRK_RESOURCE_PROVIDER BIT(9) |
Tony Lindgren | a885f0f | 2018-02-22 14:03:48 -0800 | [diff] [blame] | 50 | #define SYSC_QUIRK_LEGACY_IDLE BIT(8) |
Tony Lindgren | c5a2de9 | 2017-12-15 09:41:23 -0800 | [diff] [blame] | 51 | #define SYSC_QUIRK_RESET_STATUS BIT(7) |
Tony Lindgren | 566a9b0 | 2017-12-15 09:41:19 -0800 | [diff] [blame] | 52 | #define SYSC_QUIRK_NO_IDLE_ON_INIT BIT(6) |
| 53 | #define SYSC_QUIRK_NO_RESET_ON_INIT BIT(5) |
| 54 | #define SYSC_QUIRK_OPT_CLKS_NEEDED BIT(4) |
| 55 | #define SYSC_QUIRK_OPT_CLKS_IN_RESET BIT(3) |
Tony Lindgren | a7199e2 | 2017-12-15 09:41:14 -0800 | [diff] [blame] | 56 | #define SYSC_QUIRK_16BIT BIT(2) |
Tony Lindgren | 70a6524 | 2017-12-15 09:41:09 -0800 | [diff] [blame] | 57 | #define SYSC_QUIRK_UNCACHED BIT(1) |
| 58 | #define SYSC_QUIRK_USE_CLOCKACT BIT(0) |
| 59 | |
Tony Lindgren | c5a2de9 | 2017-12-15 09:41:23 -0800 | [diff] [blame] | 60 | #define SYSC_NR_IDLEMODES 4 |
| 61 | |
Tony Lindgren | 70a6524 | 2017-12-15 09:41:09 -0800 | [diff] [blame] | 62 | /** |
| 63 | * struct sysc_capabilities - capabilities for an interconnect target module |
| 64 | * |
| 65 | * @sysc_mask: bitmask of supported SYSCONFIG register bits |
| 66 | * @regbits: bitmask of SYSCONFIG register bits |
| 67 | * @mod_quirks: bitmask of module specific quirks |
| 68 | */ |
| 69 | struct sysc_capabilities { |
| 70 | const enum ti_sysc_module_type type; |
| 71 | const u32 sysc_mask; |
| 72 | const struct sysc_regbits *regbits; |
| 73 | const u32 mod_quirks; |
| 74 | }; |
| 75 | |
| 76 | /** |
| 77 | * struct sysc_config - configuration for an interconnect target module |
Tony Lindgren | c5a2de9 | 2017-12-15 09:41:23 -0800 | [diff] [blame] | 78 | * @sysc_val: configured value for sysc register |
| 79 | * @midlemodes: bitmask of supported master idle modes |
| 80 | * @sidlemodes: bitmask of supported master idle modes |
Tony Lindgren | 566a9b0 | 2017-12-15 09:41:19 -0800 | [diff] [blame] | 81 | * @srst_udelay: optional delay needed after OCP soft reset |
Tony Lindgren | 70a6524 | 2017-12-15 09:41:09 -0800 | [diff] [blame] | 82 | * @quirks: bitmask of enabled quirks |
| 83 | */ |
| 84 | struct sysc_config { |
Tony Lindgren | c5a2de9 | 2017-12-15 09:41:23 -0800 | [diff] [blame] | 85 | u32 sysc_val; |
| 86 | u32 syss_mask; |
| 87 | u8 midlemodes; |
| 88 | u8 sidlemodes; |
Tony Lindgren | 566a9b0 | 2017-12-15 09:41:19 -0800 | [diff] [blame] | 89 | u8 srst_udelay; |
Tony Lindgren | 70a6524 | 2017-12-15 09:41:09 -0800 | [diff] [blame] | 90 | u32 quirks; |
| 91 | }; |
| 92 | |
Tony Lindgren | ef70b0b | 2018-02-22 14:00:25 -0800 | [diff] [blame] | 93 | enum sysc_registers { |
| 94 | SYSC_REVISION, |
| 95 | SYSC_SYSCONFIG, |
| 96 | SYSC_SYSSTATUS, |
| 97 | SYSC_MAX_REGS, |
| 98 | }; |
| 99 | |
| 100 | /** |
| 101 | * struct ti_sysc_module_data - ti-sysc to hwmod translation data for a module |
| 102 | * @name: legacy "ti,hwmods" module name |
| 103 | * @module_pa: physical address of the interconnect target module |
| 104 | * @module_size: size of the interconnect target module |
| 105 | * @offsets: array of register offsets as listed in enum sysc_registers |
| 106 | * @nr_offsets: number of registers |
| 107 | * @cap: interconnect target module capabilities |
| 108 | * @cfg: interconnect target module configuration |
| 109 | * |
| 110 | * This data is enough to allocate a new struct omap_hwmod_class_sysconfig |
| 111 | * based on device tree data parsed by ti-sysc driver. |
| 112 | */ |
| 113 | struct ti_sysc_module_data { |
| 114 | const char *name; |
| 115 | u64 module_pa; |
| 116 | u32 module_size; |
| 117 | int *offsets; |
| 118 | int nr_offsets; |
| 119 | const struct sysc_capabilities *cap; |
| 120 | struct sysc_config *cfg; |
| 121 | }; |
| 122 | |
| 123 | struct device; |
| 124 | |
| 125 | struct ti_sysc_platform_data { |
| 126 | struct of_dev_auxdata *auxdata; |
| 127 | int (*init_module)(struct device *dev, |
| 128 | const struct ti_sysc_module_data *data, |
| 129 | struct ti_sysc_cookie *cookie); |
| 130 | int (*enable_module)(struct device *dev, |
| 131 | const struct ti_sysc_cookie *cookie); |
| 132 | int (*idle_module)(struct device *dev, |
| 133 | const struct ti_sysc_cookie *cookie); |
| 134 | int (*shutdown_module)(struct device *dev, |
| 135 | const struct ti_sysc_cookie *cookie); |
| 136 | }; |
| 137 | |
Tony Lindgren | 49a0a3d | 2017-12-15 09:41:05 -0800 | [diff] [blame] | 138 | #endif /* __TI_SYSC_DATA_H__ */ |