125f1ca31SMika Westerberg /* SPDX-License-Identifier: GPL-2.0 */
225f1ca31SMika Westerberg #ifndef MFD_INTEL_PMC_BXT_H
325f1ca31SMika Westerberg #define MFD_INTEL_PMC_BXT_H
425f1ca31SMika Westerberg
525f1ca31SMika Westerberg /* GCR reg offsets from GCR base */
625f1ca31SMika Westerberg #define PMC_GCR_PMC_CFG_REG 0x08
725f1ca31SMika Westerberg #define PMC_GCR_TELEM_DEEP_S0IX_REG 0x78
825f1ca31SMika Westerberg #define PMC_GCR_TELEM_SHLW_S0IX_REG 0x80
925f1ca31SMika Westerberg
1025f1ca31SMika Westerberg /* PMC_CFG_REG bit masks */
1125f1ca31SMika Westerberg #define PMC_CFG_NO_REBOOT_EN BIT(4)
1225f1ca31SMika Westerberg
1325f1ca31SMika Westerberg /**
1425f1ca31SMika Westerberg * struct intel_pmc_dev - Intel PMC device structure
1525f1ca31SMika Westerberg * @dev: Pointer to the parent PMC device
1625f1ca31SMika Westerberg * @scu: Pointer to the SCU IPC device data structure
1725f1ca31SMika Westerberg * @gcr_mem_base: Virtual base address of GCR (Global Configuration Registers)
1825f1ca31SMika Westerberg * @gcr_lock: Lock used to serialize access to GCR registers
1925f1ca31SMika Westerberg * @telem_base: Pointer to telemetry SSRAM base resource or %NULL if not
2025f1ca31SMika Westerberg * available
2125f1ca31SMika Westerberg */
2225f1ca31SMika Westerberg struct intel_pmc_dev {
2325f1ca31SMika Westerberg struct device *dev;
2425f1ca31SMika Westerberg struct intel_scu_ipc_dev *scu;
2525f1ca31SMika Westerberg void __iomem *gcr_mem_base;
2625f1ca31SMika Westerberg spinlock_t gcr_lock;
2725f1ca31SMika Westerberg struct resource *telem_base;
2825f1ca31SMika Westerberg };
2925f1ca31SMika Westerberg
3025f1ca31SMika Westerberg #if IS_ENABLED(CONFIG_MFD_INTEL_PMC_BXT)
3125f1ca31SMika Westerberg int intel_pmc_gcr_read64(struct intel_pmc_dev *pmc, u32 offset, u64 *data);
3225f1ca31SMika Westerberg int intel_pmc_gcr_update(struct intel_pmc_dev *pmc, u32 offset, u32 mask, u32 val);
3325f1ca31SMika Westerberg int intel_pmc_s0ix_counter_read(struct intel_pmc_dev *pmc, u64 *data);
3425f1ca31SMika Westerberg #else
intel_pmc_gcr_read64(struct intel_pmc_dev * pmc,u32 offset,u64 * data)3525f1ca31SMika Westerberg static inline int intel_pmc_gcr_read64(struct intel_pmc_dev *pmc, u32 offset,
3625f1ca31SMika Westerberg u64 *data)
3725f1ca31SMika Westerberg {
3825f1ca31SMika Westerberg return -ENOTSUPP;
3925f1ca31SMika Westerberg }
4025f1ca31SMika Westerberg
intel_pmc_gcr_update(struct intel_pmc_dev * pmc,u32 offset,u32 mask,u32 val)4125f1ca31SMika Westerberg static inline int intel_pmc_gcr_update(struct intel_pmc_dev *pmc, u32 offset,
4225f1ca31SMika Westerberg u32 mask, u32 val)
4325f1ca31SMika Westerberg {
4425f1ca31SMika Westerberg return -ENOTSUPP;
4525f1ca31SMika Westerberg }
4625f1ca31SMika Westerberg
intel_pmc_s0ix_counter_read(struct intel_pmc_dev * pmc,u64 * data)4725f1ca31SMika Westerberg static inline int intel_pmc_s0ix_counter_read(struct intel_pmc_dev *pmc, u64 *data)
4825f1ca31SMika Westerberg {
4925f1ca31SMika Westerberg return -ENOTSUPP;
5025f1ca31SMika Westerberg }
5125f1ca31SMika Westerberg #endif
5225f1ca31SMika Westerberg
5325f1ca31SMika Westerberg #endif /* MFD_INTEL_PMC_BXT_H */
54