diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2019-02-13 20:31:47 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2019-02-13 20:31:47 +0100 |
commit | e6b18f7fa973e22f4a7829412a9ac1aabb51b286 (patch) | |
tree | 521d2da0cd5f0cd3025ff72afa5a1e7157fea011 /include | |
parent | 13e7822149d6f7653dabba6b4e4a1f122d3dae6f (diff) | |
parent | 527422a4ad764c46bc958f91603e6b5e9860d4ba (diff) | |
download | barebox-e6b18f7fa973e22f4a7829412a9ac1aabb51b286.tar.gz barebox-e6b18f7fa973e22f4a7829412a9ac1aabb51b286.tar.xz |
Merge branch 'for-next/imx'
Diffstat (limited to 'include')
-rw-r--r-- | include/dt-bindings/reset/imx8mq-reset.h | 64 | ||||
-rw-r--r-- | include/linux/reset-controller.h | 2 | ||||
-rw-r--r-- | include/pm_domain.h | 82 | ||||
-rw-r--r-- | include/regulator.h | 41 |
4 files changed, 186 insertions, 3 deletions
diff --git a/include/dt-bindings/reset/imx8mq-reset.h b/include/dt-bindings/reset/imx8mq-reset.h new file mode 100644 index 0000000000..57c592498a --- /dev/null +++ b/include/dt-bindings/reset/imx8mq-reset.h @@ -0,0 +1,64 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (C) 2018 Zodiac Inflight Innovations + * + * Author: Andrey Smirnov <andrew.smirnov@gmail.com> + */ + +#ifndef DT_BINDING_RESET_IMX8MQ_H +#define DT_BINDING_RESET_IMX8MQ_H + +#define IMX8MQ_RESET_A53_CORE_POR_RESET0 0 +#define IMX8MQ_RESET_A53_CORE_POR_RESET1 1 +#define IMX8MQ_RESET_A53_CORE_POR_RESET2 2 +#define IMX8MQ_RESET_A53_CORE_POR_RESET3 3 +#define IMX8MQ_RESET_A53_CORE_RESET0 4 +#define IMX8MQ_RESET_A53_CORE_RESET1 5 +#define IMX8MQ_RESET_A53_CORE_RESET2 6 +#define IMX8MQ_RESET_A53_CORE_RESET3 7 +#define IMX8MQ_RESET_A53_DBG_RESET0 8 +#define IMX8MQ_RESET_A53_DBG_RESET1 9 +#define IMX8MQ_RESET_A53_DBG_RESET2 10 +#define IMX8MQ_RESET_A53_DBG_RESET3 11 +#define IMX8MQ_RESET_A53_ETM_RESET0 12 +#define IMX8MQ_RESET_A53_ETM_RESET1 13 +#define IMX8MQ_RESET_A53_ETM_RESET2 14 +#define IMX8MQ_RESET_A53_ETM_RESET3 15 +#define IMX8MQ_RESET_A53_SOC_DBG_RESET 16 +#define IMX8MQ_RESET_A53_L2RESET 17 +#define IMX8MQ_RESET_SW_NON_SCLR_M4C_RST 18 +#define IMX8MQ_RESET_OTG1_PHY_RESET 19 +#define IMX8MQ_RESET_OTG2_PHY_RESET 20 +#define IMX8MQ_RESET_MIPI_DSI_RESET_BYTE_N 21 +#define IMX8MQ_RESET_MIPI_DSI_RESET_N 22 +#define IMX8MQ_RESET_MIPI_DIS_DPI_RESET_N 23 +#define IMX8MQ_RESET_MIPI_DIS_ESC_RESET_N 24 +#define IMX8MQ_RESET_MIPI_DIS_PCLK_RESET_N 25 +#define IMX8MQ_RESET_PCIEPHY 26 +#define IMX8MQ_RESET_PCIEPHY_PERST 27 +#define IMX8MQ_RESET_PCIE_CTRL_APPS_EN 28 +#define IMX8MQ_RESET_PCIE_CTRL_APPS_TURNOFF 29 +#define IMX8MQ_RESET_HDMI_PHY_APB_RESET 30 +#define IMX8MQ_RESET_DISP_RESET 31 +#define IMX8MQ_RESET_GPU_RESET 32 +#define IMX8MQ_RESET_VPU_RESET 33 +#define IMX8MQ_RESET_PCIEPHY2 34 +#define IMX8MQ_RESET_PCIEPHY2_PERST 35 +#define IMX8MQ_RESET_PCIE2_CTRL_APPS_EN 36 +#define IMX8MQ_RESET_PCIE2_CTRL_APPS_TURNOFF 37 +#define IMX8MQ_RESET_MIPI_CSI1_CORE_RESET 38 +#define IMX8MQ_RESET_MIPI_CSI1_PHY_REF_RESET 39 +#define IMX8MQ_RESET_MIPI_CSI1_ESC_RESET 40 +#define IMX8MQ_RESET_MIPI_CSI2_CORE_RESET 41 +#define IMX8MQ_RESET_MIPI_CSI2_PHY_REF_RESET 42 +#define IMX8MQ_RESET_MIPI_CSI2_ESC_RESET 43 +#define IMX8MQ_RESET_DDRC1_PRST 44 +#define IMX8MQ_RESET_DDRC1_CORE_RESET 45 +#define IMX8MQ_RESET_DDRC1_PHY_RESET 46 +#define IMX8MQ_RESET_DDRC2_PRST 47 +#define IMX8MQ_RESET_DDRC2_CORE_RESET 48 +#define IMX8MQ_RESET_DDRC2_PHY_RESET 49 + +#define IMX8MQ_RESET_NUM 50 + +#endif diff --git a/include/linux/reset-controller.h b/include/linux/reset-controller.h index d8265486a0..aff03a9c62 100644 --- a/include/linux/reset-controller.h +++ b/include/linux/reset-controller.h @@ -35,7 +35,7 @@ struct of_phandle_args; * @nr_resets: number of reset controls in this reset controller device */ struct reset_controller_dev { - struct reset_control_ops *ops; + const struct reset_control_ops *ops; struct list_head list; struct device_node *of_node; int of_reset_n_cells; diff --git a/include/pm_domain.h b/include/pm_domain.h new file mode 100644 index 0000000000..6d59587ece --- /dev/null +++ b/include/pm_domain.h @@ -0,0 +1,82 @@ +#ifndef _PM_DOMAIN_H +#define _PM_DOMAIN_H + +enum gpd_status { + GPD_STATE_ACTIVE = 0, /* PM domain is active */ + GPD_STATE_POWER_OFF, /* PM domain is off */ +}; + +struct generic_pm_domain { + const char *name; + struct list_head gpd_list_node; /* Node in the global PM domains list */ + + enum gpd_status status; /* Current state of the domain */ + + int (*power_off)(struct generic_pm_domain *domain); + int (*power_on)(struct generic_pm_domain *domain); +}; + +typedef struct generic_pm_domain *(*genpd_xlate_t)(struct of_phandle_args *args, + void *data); + +#ifdef CONFIG_PM_GENERIC_DOMAINS + +int genpd_dev_pm_attach(struct device_d *dev); + +/** + * dev_pm_domain_attach - Attach a device to its PM domain. + * @dev: Device to attach. + * @power_on: Used to indicate whether we should power on the device. + * + * The @dev may only be attached to a single PM domain. By iterating through + * the available alternatives we try to find a valid PM domain for the device. + * As attachment succeeds, the ->detach() callback in the struct dev_pm_domain + * should be assigned by the corresponding attach function. + * + * This function should typically be invoked from subsystem level code during + * the probe phase. Especially for those that holds devices which requires + * power management through PM domains. + * + * Callers must ensure proper synchronization of this function with power + * management callbacks. + * + * Returns 0 on successfully attached PM domain or negative error code. + */ +static inline int dev_pm_domain_attach(struct device_d *dev, bool power_on) +{ + return genpd_dev_pm_attach(dev); +} + +int pm_genpd_init(struct generic_pm_domain *genpd, void *gov, bool is_off); + +int of_genpd_add_provider_simple(struct device_node *np, + struct generic_pm_domain *genpd); + +#else + +static inline int pm_genpd_init(struct generic_pm_domain *genpd, + void *gov, bool is_off) +{ + return -ENOSYS; +} + +static inline int genpd_dev_pm_attach(struct device_d *dev) +{ + return 0; +} + +static inline int dev_pm_domain_attach(struct device_d *dev, bool power_on) +{ + return 0; +} + +static inline int +of_genpd_add_provider_simple(struct device_node *np, + struct generic_pm_domain *genpd) +{ + return -ENOTSUPP; +} + +#endif + +#endif
\ No newline at end of file diff --git a/include/regulator.h b/include/regulator.h index 367e13f05b..cd1d3ccf55 100644 --- a/include/regulator.h +++ b/include/regulator.h @@ -4,8 +4,28 @@ /* struct regulator is an opaque object for consumers */ struct regulator; +struct regulator_desc { + unsigned n_voltages; + const struct regulator_ops *ops; + + unsigned int min_uV; + unsigned int uV_step; + unsigned int linear_min_sel; + + unsigned int vsel_reg; + unsigned int vsel_mask; + unsigned int apply_reg; + unsigned int apply_bit; + unsigned int enable_reg; + unsigned int enable_mask; + unsigned int enable_val; + unsigned int disable_val; + bool enable_is_inverted; +}; + struct regulator_dev { - struct regulator_ops *ops; + const struct regulator_desc *desc; + struct regmap *regmap; int boot_on; }; @@ -14,6 +34,9 @@ struct regulator_ops { int (*enable) (struct regulator_dev *); int (*disable) (struct regulator_dev *); int (*is_enabled) (struct regulator_dev *); + + int (*list_voltage) (struct regulator_dev *, unsigned int); + int (*set_voltage_sel) (struct regulator_dev *, unsigned int); }; #ifdef CONFIG_OFDEVICE @@ -35,7 +58,15 @@ void regulators_print(void); struct regulator *regulator_get(struct device_d *, const char *); int regulator_enable(struct regulator *); int regulator_disable(struct regulator *); - +int regulator_is_enabled_regmap(struct regulator_dev *); +int regulator_enable_regmap(struct regulator_dev *); +int regulator_disable_regmap(struct regulator_dev *); +int regulator_set_voltage_sel_regmap(struct regulator_dev *, unsigned); +int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV); +int regulator_map_voltage_linear(struct regulator_dev *rdev, + int min_uV, int max_uV); +int regulator_list_voltage_linear(struct regulator_dev *rdev, + unsigned int selector); #else static inline struct regulator *regulator_get(struct device_d *dev, const char *id) @@ -53,6 +84,12 @@ static inline int regulator_disable(struct regulator *r) return 0; } +static inline int regulator_set_voltage(struct regulator *regulator, + int min_uV, int max_uV) +{ + return 0; +} + #endif #endif /* __REGULATOR_H */ |