1 #ifndef __TI_SYSC_DATA_H__ 2 #define __TI_SYSC_DATA_H__ 3 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, 17 TI_SYSC_DRA7_MCAN, 18 }; 19 20 struct ti_sysc_cookie { 21 void *data; 22 }; 23 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 49 #define SYSC_QUIRK_SWSUP_MSTANDBY BIT(13) 50 #define SYSC_QUIRK_SWSUP_SIDLE_ACT BIT(12) 51 #define SYSC_QUIRK_SWSUP_SIDLE BIT(11) 52 #define SYSC_QUIRK_EXT_OPT_CLOCK BIT(10) 53 #define SYSC_QUIRK_LEGACY_IDLE BIT(9) 54 #define SYSC_QUIRK_RESET_STATUS BIT(8) 55 #define SYSC_QUIRK_NO_IDLE BIT(7) 56 #define SYSC_QUIRK_NO_IDLE_ON_INIT BIT(6) 57 #define SYSC_QUIRK_NO_RESET_ON_INIT BIT(5) 58 #define SYSC_QUIRK_OPT_CLKS_NEEDED BIT(4) 59 #define SYSC_QUIRK_OPT_CLKS_IN_RESET BIT(3) 60 #define SYSC_QUIRK_16BIT BIT(2) 61 #define SYSC_QUIRK_UNCACHED BIT(1) 62 #define SYSC_QUIRK_USE_CLOCKACT BIT(0) 63 64 #define SYSC_NR_IDLEMODES 4 65 66 /** 67 * struct sysc_capabilities - capabilities for an interconnect target module 68 * 69 * @sysc_mask: bitmask of supported SYSCONFIG register bits 70 * @regbits: bitmask of SYSCONFIG register bits 71 * @mod_quirks: bitmask of module specific quirks 72 */ 73 struct sysc_capabilities { 74 const enum ti_sysc_module_type type; 75 const u32 sysc_mask; 76 const struct sysc_regbits *regbits; 77 const u32 mod_quirks; 78 }; 79 80 /** 81 * struct sysc_config - configuration for an interconnect target module 82 * @sysc_val: configured value for sysc register 83 * @midlemodes: bitmask of supported master idle modes 84 * @sidlemodes: bitmask of supported master idle modes 85 * @srst_udelay: optional delay needed after OCP soft reset 86 * @quirks: bitmask of enabled quirks 87 */ 88 struct sysc_config { 89 u32 sysc_val; 90 u32 syss_mask; 91 u8 midlemodes; 92 u8 sidlemodes; 93 u8 srst_udelay; 94 u32 quirks; 95 }; 96 97 enum sysc_registers { 98 SYSC_REVISION, 99 SYSC_SYSCONFIG, 100 SYSC_SYSSTATUS, 101 SYSC_MAX_REGS, 102 }; 103 104 /** 105 * struct ti_sysc_module_data - ti-sysc to hwmod translation data for a module 106 * @name: legacy "ti,hwmods" module name 107 * @module_pa: physical address of the interconnect target module 108 * @module_size: size of the interconnect target module 109 * @offsets: array of register offsets as listed in enum sysc_registers 110 * @nr_offsets: number of registers 111 * @cap: interconnect target module capabilities 112 * @cfg: interconnect target module configuration 113 * 114 * This data is enough to allocate a new struct omap_hwmod_class_sysconfig 115 * based on device tree data parsed by ti-sysc driver. 116 */ 117 struct ti_sysc_module_data { 118 const char *name; 119 u64 module_pa; 120 u32 module_size; 121 int *offsets; 122 int nr_offsets; 123 const struct sysc_capabilities *cap; 124 struct sysc_config *cfg; 125 }; 126 127 struct device; 128 129 struct ti_sysc_platform_data { 130 struct of_dev_auxdata *auxdata; 131 int (*init_module)(struct device *dev, 132 const struct ti_sysc_module_data *data, 133 struct ti_sysc_cookie *cookie); 134 int (*enable_module)(struct device *dev, 135 const struct ti_sysc_cookie *cookie); 136 int (*idle_module)(struct device *dev, 137 const struct ti_sysc_cookie *cookie); 138 int (*shutdown_module)(struct device *dev, 139 const struct ti_sysc_cookie *cookie); 140 }; 141 142 #endif /* __TI_SYSC_DATA_H__ */ 143