2019-05-29 07:17:58 -07:00
/* SPDX-License-Identifier: GPL-2.0-only */
2015-08-06 16:07:42 +05:30
/*
2018-04-09 14:11:44 +05:30
* Copyright ( c ) 2015 , 2017 - 2018 , The Linux Foundation . All rights reserved .
2015-08-06 16:07:42 +05:30
*/
# ifndef __QCOM_GDSC_H__
# define __QCOM_GDSC_H__
# include <linux/err.h>
# include <linux/pm_domain.h>
struct regmap ;
2020-04-17 00:00:41 -07:00
struct regulator ;
2015-08-06 16:07:45 +05:30
struct reset_controller_dev ;
2015-08-06 16:07:42 +05:30
/**
* struct gdsc - Globally Distributed Switch Controller
* @ pd : generic power domain
* @ regmap : regmap for MMIO accesses
* @ gdscr : gsdc control register
2015-12-01 21:42:12 +05:30
* @ gds_hw_ctrl : gds_hw_ctrl register
2015-08-06 16:07:44 +05:30
* @ cxcs : offsets of branch registers to toggle mem / periph bits in
* @ cxc_count : number of @ cxcs
* @ pwrsts : Possible powerdomain power states
2015-08-06 16:07:45 +05:30
* @ resets : ids of resets associated with this gdsc
* @ reset_count : number of @ resets
* @ rcdev : reset controller
2015-08-06 16:07:42 +05:30
*/
struct gdsc {
struct generic_pm_domain pd ;
2015-12-01 21:42:11 +05:30
struct generic_pm_domain * parent ;
2015-08-06 16:07:42 +05:30
struct regmap * regmap ;
unsigned int gdscr ;
2015-12-01 21:42:12 +05:30
unsigned int gds_hw_ctrl ;
2016-10-20 15:08:06 +05:30
unsigned int clamp_io_ctrl ;
2015-08-06 16:07:44 +05:30
unsigned int * cxcs ;
unsigned int cxc_count ;
const u8 pwrsts ;
2015-12-01 21:42:13 +05:30
/* Powerdomain allowable state bitfields */
# define PWRSTS_OFF BIT(0)
# define PWRSTS_RET BIT(1)
# define PWRSTS_ON BIT(2)
# define PWRSTS_OFF_ON (PWRSTS_OFF | PWRSTS_ON)
# define PWRSTS_RET_ON (PWRSTS_RET | PWRSTS_ON)
2021-01-13 19:38:15 +01:00
const u16 flags ;
2015-12-01 21:42:13 +05:30
# define VOTABLE BIT(0)
2016-10-20 15:08:06 +05:30
# define CLAMP_IO BIT(1)
2016-11-18 17:58:26 +05:30
# define HW_CTRL BIT(2)
2018-04-09 14:11:44 +05:30
# define SW_RESET BIT(3)
# define AON_RESET BIT(4)
2018-05-01 10:33:33 +05:30
# define POLL_CFG_GDSCR BIT(5)
2018-06-04 12:34:51 -07:00
# define ALWAYS_ON BIT(6)
2020-07-24 21:37:55 +05:30
# define RETAIN_FF_ENABLE BIT(7)
2021-01-13 19:38:15 +01:00
# define NO_RET_PERIPH BIT(8)
2015-08-06 16:07:45 +05:30
struct reset_controller_dev * rcdev ;
unsigned int * resets ;
unsigned int reset_count ;
2020-04-17 00:00:41 -07:00
const char * supply ;
struct regulator * rsupply ;
2015-08-06 16:07:42 +05:30
} ;
2015-12-01 21:42:11 +05:30
struct gdsc_desc {
struct device * dev ;
struct gdsc * * scs ;
size_t num ;
} ;
2015-08-06 16:07:42 +05:30
# ifdef CONFIG_QCOM_GDSC
2015-12-01 21:42:11 +05:30
int gdsc_register ( struct gdsc_desc * desc , struct reset_controller_dev * ,
struct regmap * ) ;
void gdsc_unregister ( struct gdsc_desc * desc ) ;
2020-07-09 09:52:40 -04:00
int gdsc_gx_do_nothing_enable ( struct generic_pm_domain * domain ) ;
2015-08-06 16:07:42 +05:30
# else
2015-12-01 21:42:11 +05:30
static inline int gdsc_register ( struct gdsc_desc * desc ,
2015-08-06 16:07:45 +05:30
struct reset_controller_dev * rcdev ,
2015-08-06 16:07:42 +05:30
struct regmap * r )
{
return - ENOSYS ;
}
2015-12-01 21:42:11 +05:30
static inline void gdsc_unregister ( struct gdsc_desc * desc ) { } ;
2015-08-06 16:07:42 +05:30
# endif /* CONFIG_QCOM_GDSC */
# endif /* __QCOM_GDSC_H__ */