aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-04-06 00:29:35 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-04-06 00:29:35 -0400
commit38c23685b273cfb4ccf31a199feccce3bdcb5d83 (patch)
tree6b693a36c6ea6c64aaaf34112c57e89f1b5c4b0f /include/linux
parent167569343fac74ec6825a3ab982f795b5880e63e (diff)
parent7df3f0bb5f90e3470de2798452000e221420059c (diff)
Merge tag 'armsoc-drivers' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull ARM SoC driver updates from Arnd Bergmann: "The main addition this time around is the new ARM "SCMI" framework, which is the latest in a series of standards coming from ARM to do power management in a platform independent way. This has been through many review cycles, and it relies on a rather interesting way of using the mailbox subsystem, but in the end I agreed that Sudeep's version was the best we could do after all. Other changes include: - the ARM CCN driver is moved out of drivers/bus into drivers/perf, which makes more sense. Similarly, the performance monitoring portion of the CCI driver are moved the same way and cleaned up a little more. - a series of updates to the SCPI framework - support for the Mediatek mt7623a SoC in drivers/soc - support for additional NVIDIA Tegra hardware in drivers/soc - a new reset driver for Socionext Uniphier - lesser bug fixes in drivers/soc, drivers/tee, drivers/memory, and drivers/firmware and drivers/reset across platforms" * tag 'armsoc-drivers' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (87 commits) reset: uniphier: add ethernet reset control support for PXs3 reset: stm32mp1: Enable stm32mp1 reset driver dt-bindings: reset: add STM32MP1 resets reset: uniphier: add Pro4/Pro5/PXs2 audio systems reset control reset: imx7: add 'depends on HAS_IOMEM' to fix unmet dependency reset: modify the way reset lookup works for board files reset: add support for non-DT systems clk: scmi: use devm_of_clk_add_hw_provider() API and drop scmi_clocks_remove firmware: arm_scmi: prevent accessing rate_discrete uninitialized hwmon: (scmi) return -EINVAL when sensor information is unavailable amlogic: meson-gx-socinfo: Update soc ids soc/tegra: pmc: Use the new reset APIs to manage reset controllers soc: mediatek: update power domain data of MT2712 dt-bindings: soc: update MT2712 power dt-bindings cpufreq: scmi: add thermal dependency soc: mediatek: fix the mistaken pointer accessed when subdomains are added soc: mediatek: add SCPSYS power domain driver for MediaTek MT7623A SoC soc: mediatek: avoid hardcoded value with bus_prot_mask dt-bindings: soc: add header files required for MT7623A SCPSYS dt-binding dt-bindings: soc: add SCPSYS binding for MT7623 and MT7623A SoC ...
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/hwmon.h1
-rw-r--r--include/linux/reset-controller.h30
-rw-r--r--include/linux/scmi_protocol.h277
-rw-r--r--include/linux/soc/mediatek/infracfg.h4
-rw-r--r--include/linux/soc/samsung/exynos-pmu.h5
-rw-r--r--include/linux/soc/samsung/exynos-regs-pmu.h6
6 files changed, 314 insertions, 9 deletions
diff --git a/include/linux/hwmon.h b/include/linux/hwmon.h
index ceb751987c40..e5fd2707b6df 100644
--- a/include/linux/hwmon.h
+++ b/include/linux/hwmon.h
@@ -29,6 +29,7 @@ enum hwmon_sensor_types {
29 hwmon_humidity, 29 hwmon_humidity,
30 hwmon_fan, 30 hwmon_fan,
31 hwmon_pwm, 31 hwmon_pwm,
32 hwmon_max,
32}; 33};
33 34
34enum hwmon_chip_attributes { 35enum hwmon_chip_attributes {
diff --git a/include/linux/reset-controller.h b/include/linux/reset-controller.h
index adb88f8cefbc..9326d671b6e6 100644
--- a/include/linux/reset-controller.h
+++ b/include/linux/reset-controller.h
@@ -27,12 +27,38 @@ struct device_node;
27struct of_phandle_args; 27struct of_phandle_args;
28 28
29/** 29/**
30 * struct reset_control_lookup - represents a single lookup entry
31 *
32 * @list: internal list of all reset lookup entries
33 * @provider: name of the reset controller device controlling this reset line
34 * @index: ID of the reset controller in the reset controller device
35 * @dev_id: name of the device associated with this reset line
36 * @con_id name of the reset line (can be NULL)
37 */
38struct reset_control_lookup {
39 struct list_head list;
40 const char *provider;
41 unsigned int index;
42 const char *dev_id;
43 const char *con_id;
44};
45
46#define RESET_LOOKUP(_provider, _index, _dev_id, _con_id) \
47 { \
48 .provider = _provider, \
49 .index = _index, \
50 .dev_id = _dev_id, \
51 .con_id = _con_id, \
52 }
53
54/**
30 * struct reset_controller_dev - reset controller entity that might 55 * struct reset_controller_dev - reset controller entity that might
31 * provide multiple reset controls 56 * provide multiple reset controls
32 * @ops: a pointer to device specific struct reset_control_ops 57 * @ops: a pointer to device specific struct reset_control_ops
33 * @owner: kernel module of the reset controller driver 58 * @owner: kernel module of the reset controller driver
34 * @list: internal list of reset controller devices 59 * @list: internal list of reset controller devices
35 * @reset_control_head: head of internal list of requested reset controls 60 * @reset_control_head: head of internal list of requested reset controls
61 * @dev: corresponding driver model device struct
36 * @of_node: corresponding device tree node as phandle target 62 * @of_node: corresponding device tree node as phandle target
37 * @of_reset_n_cells: number of cells in reset line specifiers 63 * @of_reset_n_cells: number of cells in reset line specifiers
38 * @of_xlate: translation function to translate from specifier as found in the 64 * @of_xlate: translation function to translate from specifier as found in the
@@ -44,6 +70,7 @@ struct reset_controller_dev {
44 struct module *owner; 70 struct module *owner;
45 struct list_head list; 71 struct list_head list;
46 struct list_head reset_control_head; 72 struct list_head reset_control_head;
73 struct device *dev;
47 struct device_node *of_node; 74 struct device_node *of_node;
48 int of_reset_n_cells; 75 int of_reset_n_cells;
49 int (*of_xlate)(struct reset_controller_dev *rcdev, 76 int (*of_xlate)(struct reset_controller_dev *rcdev,
@@ -58,4 +85,7 @@ struct device;
58int devm_reset_controller_register(struct device *dev, 85int devm_reset_controller_register(struct device *dev,
59 struct reset_controller_dev *rcdev); 86 struct reset_controller_dev *rcdev);
60 87
88void reset_controller_add_lookup(struct reset_control_lookup *lookup,
89 unsigned int num_entries);
90
61#endif 91#endif
diff --git a/include/linux/scmi_protocol.h b/include/linux/scmi_protocol.h
new file mode 100644
index 000000000000..b458c87b866c
--- /dev/null
+++ b/include/linux/scmi_protocol.h
@@ -0,0 +1,277 @@
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * SCMI Message Protocol driver header
4 *
5 * Copyright (C) 2018 ARM Ltd.
6 */
7#include <linux/device.h>
8#include <linux/types.h>
9
10#define SCMI_MAX_STR_SIZE 16
11#define SCMI_MAX_NUM_RATES 16
12
13/**
14 * struct scmi_revision_info - version information structure
15 *
16 * @major_ver: Major ABI version. Change here implies risk of backward
17 * compatibility break.
18 * @minor_ver: Minor ABI version. Change here implies new feature addition,
19 * or compatible change in ABI.
20 * @num_protocols: Number of protocols that are implemented, excluding the
21 * base protocol.
22 * @num_agents: Number of agents in the system.
23 * @impl_ver: A vendor-specific implementation version.
24 * @vendor_id: A vendor identifier(Null terminated ASCII string)
25 * @sub_vendor_id: A sub-vendor identifier(Null terminated ASCII string)
26 */
27struct scmi_revision_info {
28 u16 major_ver;
29 u16 minor_ver;
30 u8 num_protocols;
31 u8 num_agents;
32 u32 impl_ver;
33 char vendor_id[SCMI_MAX_STR_SIZE];
34 char sub_vendor_id[SCMI_MAX_STR_SIZE];
35};
36
37struct scmi_clock_info {
38 char name[SCMI_MAX_STR_SIZE];
39 bool rate_discrete;
40 union {
41 struct {
42 int num_rates;
43 u64 rates[SCMI_MAX_NUM_RATES];
44 } list;
45 struct {
46 u64 min_rate;
47 u64 max_rate;
48 u64 step_size;
49 } range;
50 };
51};
52
53struct scmi_handle;
54
55/**
56 * struct scmi_clk_ops - represents the various operations provided
57 * by SCMI Clock Protocol
58 *
59 * @count_get: get the count of clocks provided by SCMI
60 * @info_get: get the information of the specified clock
61 * @rate_get: request the current clock rate of a clock
62 * @rate_set: set the clock rate of a clock
63 * @enable: enables the specified clock
64 * @disable: disables the specified clock
65 */
66struct scmi_clk_ops {
67 int (*count_get)(const struct scmi_handle *handle);
68
69 const struct scmi_clock_info *(*info_get)
70 (const struct scmi_handle *handle, u32 clk_id);
71 int (*rate_get)(const struct scmi_handle *handle, u32 clk_id,
72 u64 *rate);
73 int (*rate_set)(const struct scmi_handle *handle, u32 clk_id,
74 u32 config, u64 rate);
75 int (*enable)(const struct scmi_handle *handle, u32 clk_id);
76 int (*disable)(const struct scmi_handle *handle, u32 clk_id);
77};
78
79/**
80 * struct scmi_perf_ops - represents the various operations provided
81 * by SCMI Performance Protocol
82 *
83 * @limits_set: sets limits on the performance level of a domain
84 * @limits_get: gets limits on the performance level of a domain
85 * @level_set: sets the performance level of a domain
86 * @level_get: gets the performance level of a domain
87 * @device_domain_id: gets the scmi domain id for a given device
88 * @get_transition_latency: gets the DVFS transition latency for a given device
89 * @add_opps_to_device: adds all the OPPs for a given device
90 * @freq_set: sets the frequency for a given device using sustained frequency
91 * to sustained performance level mapping
92 * @freq_get: gets the frequency for a given device using sustained frequency
93 * to sustained performance level mapping
94 */
95struct scmi_perf_ops {
96 int (*limits_set)(const struct scmi_handle *handle, u32 domain,
97 u32 max_perf, u32 min_perf);
98 int (*limits_get)(const struct scmi_handle *handle, u32 domain,
99 u32 *max_perf, u32 *min_perf);
100 int (*level_set)(const struct scmi_handle *handle, u32 domain,
101 u32 level, bool poll);
102 int (*level_get)(const struct scmi_handle *handle, u32 domain,
103 u32 *level, bool poll);
104 int (*device_domain_id)(struct device *dev);
105 int (*get_transition_latency)(const struct scmi_handle *handle,
106 struct device *dev);
107 int (*add_opps_to_device)(const struct scmi_handle *handle,
108 struct device *dev);
109 int (*freq_set)(const struct scmi_handle *handle, u32 domain,
110 unsigned long rate, bool poll);
111 int (*freq_get)(const struct scmi_handle *handle, u32 domain,
112 unsigned long *rate, bool poll);
113};
114
115/**
116 * struct scmi_power_ops - represents the various operations provided
117 * by SCMI Power Protocol
118 *
119 * @num_domains_get: get the count of power domains provided by SCMI
120 * @name_get: gets the name of a power domain
121 * @state_set: sets the power state of a power domain
122 * @state_get: gets the power state of a power domain
123 */
124struct scmi_power_ops {
125 int (*num_domains_get)(const struct scmi_handle *handle);
126 char *(*name_get)(const struct scmi_handle *handle, u32 domain);
127#define SCMI_POWER_STATE_TYPE_SHIFT 30
128#define SCMI_POWER_STATE_ID_MASK (BIT(28) - 1)
129#define SCMI_POWER_STATE_PARAM(type, id) \
130 ((((type) & BIT(0)) << SCMI_POWER_STATE_TYPE_SHIFT) | \
131 ((id) & SCMI_POWER_STATE_ID_MASK))
132#define SCMI_POWER_STATE_GENERIC_ON SCMI_POWER_STATE_PARAM(0, 0)
133#define SCMI_POWER_STATE_GENERIC_OFF SCMI_POWER_STATE_PARAM(1, 0)
134 int (*state_set)(const struct scmi_handle *handle, u32 domain,
135 u32 state);
136 int (*state_get)(const struct scmi_handle *handle, u32 domain,
137 u32 *state);
138};
139
140struct scmi_sensor_info {
141 u32 id;
142 u8 type;
143 char name[SCMI_MAX_STR_SIZE];
144};
145
146/*
147 * Partial list from Distributed Management Task Force (DMTF) specification:
148 * DSP0249 (Platform Level Data Model specification)
149 */
150enum scmi_sensor_class {
151 NONE = 0x0,
152 TEMPERATURE_C = 0x2,
153 VOLTAGE = 0x5,
154 CURRENT = 0x6,
155 POWER = 0x7,
156 ENERGY = 0x8,
157};
158
159/**
160 * struct scmi_sensor_ops - represents the various operations provided
161 * by SCMI Sensor Protocol
162 *
163 * @count_get: get the count of sensors provided by SCMI
164 * @info_get: get the information of the specified sensor
165 * @configuration_set: control notifications on cross-over events for
166 * the trip-points
167 * @trip_point_set: selects and configures a trip-point of interest
168 * @reading_get: gets the current value of the sensor
169 */
170struct scmi_sensor_ops {
171 int (*count_get)(const struct scmi_handle *handle);
172
173 const struct scmi_sensor_info *(*info_get)
174 (const struct scmi_handle *handle, u32 sensor_id);
175 int (*configuration_set)(const struct scmi_handle *handle,
176 u32 sensor_id);
177 int (*trip_point_set)(const struct scmi_handle *handle, u32 sensor_id,
178 u8 trip_id, u64 trip_value);
179 int (*reading_get)(const struct scmi_handle *handle, u32 sensor_id,
180 bool async, u64 *value);
181};
182
183/**
184 * struct scmi_handle - Handle returned to ARM SCMI clients for usage.
185 *
186 * @dev: pointer to the SCMI device
187 * @version: pointer to the structure containing SCMI version information
188 * @power_ops: pointer to set of power protocol operations
189 * @perf_ops: pointer to set of performance protocol operations
190 * @clk_ops: pointer to set of clock protocol operations
191 * @sensor_ops: pointer to set of sensor protocol operations
192 */
193struct scmi_handle {
194 struct device *dev;
195 struct scmi_revision_info *version;
196 struct scmi_perf_ops *perf_ops;
197 struct scmi_clk_ops *clk_ops;
198 struct scmi_power_ops *power_ops;
199 struct scmi_sensor_ops *sensor_ops;
200 /* for protocol internal use */
201 void *perf_priv;
202 void *clk_priv;
203 void *power_priv;
204 void *sensor_priv;
205};
206
207enum scmi_std_protocol {
208 SCMI_PROTOCOL_BASE = 0x10,
209 SCMI_PROTOCOL_POWER = 0x11,
210 SCMI_PROTOCOL_SYSTEM = 0x12,
211 SCMI_PROTOCOL_PERF = 0x13,
212 SCMI_PROTOCOL_CLOCK = 0x14,
213 SCMI_PROTOCOL_SENSOR = 0x15,
214};
215
216struct scmi_device {
217 u32 id;
218 u8 protocol_id;
219 struct device dev;
220 struct scmi_handle *handle;
221};
222
223#define to_scmi_dev(d) container_of(d, struct scmi_device, dev)
224
225struct scmi_device *
226scmi_device_create(struct device_node *np, struct device *parent, int protocol);
227void scmi_device_destroy(struct scmi_device *scmi_dev);
228
229struct scmi_device_id {
230 u8 protocol_id;
231};
232
233struct scmi_driver {
234 const char *name;
235 int (*probe)(struct scmi_device *sdev);
236 void (*remove)(struct scmi_device *sdev);
237 const struct scmi_device_id *id_table;
238
239 struct device_driver driver;
240};
241
242#define to_scmi_driver(d) container_of(d, struct scmi_driver, driver)
243
244#ifdef CONFIG_ARM_SCMI_PROTOCOL
245int scmi_driver_register(struct scmi_driver *driver,
246 struct module *owner, const char *mod_name);
247void scmi_driver_unregister(struct scmi_driver *driver);
248#else
249static inline int
250scmi_driver_register(struct scmi_driver *driver, struct module *owner,
251 const char *mod_name)
252{
253 return -EINVAL;
254}
255
256static inline void scmi_driver_unregister(struct scmi_driver *driver) {}
257#endif /* CONFIG_ARM_SCMI_PROTOCOL */
258
259#define scmi_register(driver) \
260 scmi_driver_register(driver, THIS_MODULE, KBUILD_MODNAME)
261#define scmi_unregister(driver) \
262 scmi_driver_unregister(driver)
263
264/**
265 * module_scmi_driver() - Helper macro for registering a scmi driver
266 * @__scmi_driver: scmi_driver structure
267 *
268 * Helper macro for scmi drivers to set up proper module init / exit
269 * functions. Replaces module_init() and module_exit() and keeps people from
270 * printing pointless things to the kernel log when their driver is loaded.
271 */
272#define module_scmi_driver(__scmi_driver) \
273 module_driver(__scmi_driver, scmi_register, scmi_unregister)
274
275typedef int (*scmi_prot_init_fn_t)(struct scmi_handle *);
276int scmi_protocol_register(int protocol_id, scmi_prot_init_fn_t fn);
277void scmi_protocol_unregister(int protocol_id);
diff --git a/include/linux/soc/mediatek/infracfg.h b/include/linux/soc/mediatek/infracfg.h
index b0a507d356ef..fd25f0148566 100644
--- a/include/linux/soc/mediatek/infracfg.h
+++ b/include/linux/soc/mediatek/infracfg.h
@@ -21,6 +21,10 @@
21#define MT8173_TOP_AXI_PROT_EN_MFG_M1 BIT(22) 21#define MT8173_TOP_AXI_PROT_EN_MFG_M1 BIT(22)
22#define MT8173_TOP_AXI_PROT_EN_MFG_SNOOP_OUT BIT(23) 22#define MT8173_TOP_AXI_PROT_EN_MFG_SNOOP_OUT BIT(23)
23 23
24#define MT2701_TOP_AXI_PROT_EN_MM_M0 BIT(1)
25#define MT2701_TOP_AXI_PROT_EN_CONN_M BIT(2)
26#define MT2701_TOP_AXI_PROT_EN_CONN_S BIT(8)
27
24#define MT7622_TOP_AXI_PROT_EN_ETHSYS (BIT(3) | BIT(17)) 28#define MT7622_TOP_AXI_PROT_EN_ETHSYS (BIT(3) | BIT(17))
25#define MT7622_TOP_AXI_PROT_EN_HIF0 (BIT(24) | BIT(25)) 29#define MT7622_TOP_AXI_PROT_EN_HIF0 (BIT(24) | BIT(25))
26#define MT7622_TOP_AXI_PROT_EN_HIF1 (BIT(26) | BIT(27) | \ 30#define MT7622_TOP_AXI_PROT_EN_HIF1 (BIT(26) | BIT(27) | \
diff --git a/include/linux/soc/samsung/exynos-pmu.h b/include/linux/soc/samsung/exynos-pmu.h
index e57eb4b6cc5a..fc0b445bb36b 100644
--- a/include/linux/soc/samsung/exynos-pmu.h
+++ b/include/linux/soc/samsung/exynos-pmu.h
@@ -1,12 +1,9 @@
1/* SPDX-License-Identifier: GPL-2.0 */
1/* 2/*
2 * Copyright (c) 2014 Samsung Electronics Co., Ltd. 3 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
3 * http://www.samsung.com 4 * http://www.samsung.com
4 * 5 *
5 * Header for EXYNOS PMU Driver support 6 * Header for EXYNOS PMU Driver support
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */ 7 */
11 8
12#ifndef __LINUX_SOC_EXYNOS_PMU_H 9#ifndef __LINUX_SOC_EXYNOS_PMU_H
diff --git a/include/linux/soc/samsung/exynos-regs-pmu.h b/include/linux/soc/samsung/exynos-regs-pmu.h
index bebdde5dccd6..66dcb9ec273a 100644
--- a/include/linux/soc/samsung/exynos-regs-pmu.h
+++ b/include/linux/soc/samsung/exynos-regs-pmu.h
@@ -1,14 +1,10 @@
1/* SPDX-License-Identifier: GPL-2.0 */
1/* 2/*
2 * Copyright (c) 2010-2015 Samsung Electronics Co., Ltd. 3 * Copyright (c) 2010-2015 Samsung Electronics Co., Ltd.
3 * http://www.samsung.com 4 * http://www.samsung.com
4 * 5 *
5 * EXYNOS - Power management unit definition 6 * EXYNOS - Power management unit definition
6 * 7 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 *
12 * Notice: 8 * Notice:
13 * This is not a list of all Exynos Power Management Unit SFRs. 9 * This is not a list of all Exynos Power Management Unit SFRs.
14 * There are too many of them, not mentioning subtle differences 10 * There are too many of them, not mentioning subtle differences