• Home
  • Raw
  • Download

Lines Matching +full:scu +full:- +full:index

1 // SPDX-License-Identifier: GPL-2.0+
7 #include <dt-bindings/firmware/imx/rsrc.h>
8 #include <linux/arm-smccc.h>
9 #include <linux/clk-provider.h>
13 #include "clk-scu.h"
21 * struct clk_scu - Description of one SCU clock
23 * @rsrc_id: resource ID of this SCU clock
33 * struct imx_sc_msg_req_set_clock_rate - clock set rate protocol
34 * @hdr: SCU protocol header
39 * This structure describes the SCU protocol of clock rate set
58 * struct imx_sc_msg_get_clock_rate - clock get rate protocol
59 * @hdr: SCU protocol header
63 * This structure describes the SCU protocol of clock rate get
74 * struct imx_sc_msg_get_clock_parent - clock get parent protocol
75 * @hdr: SCU protocol header
79 * This structure describes the SCU protocol of clock get parent
95 * struct imx_sc_msg_set_clock_parent - clock set parent protocol
96 * @hdr: SCU protocol header
99 * This structure describes the SCU protocol of clock set parent
109 * struct imx_sc_msg_req_clock_enable - clock gate protocol
110 * @hdr: SCU protocol header
116 * This structure describes the SCU protocol of clock gate
137 * clk_scu_recalc_rate - Get clock rate for a SCU clock
141 * Gets the current clock rate of a SCU clock. Returns the current
152 hdr->ver = IMX_SC_RPC_VERSION; in clk_scu_recalc_rate()
153 hdr->svc = IMX_SC_RPC_SVC_PM; in clk_scu_recalc_rate()
154 hdr->func = IMX_SC_PM_FUNC_GET_CLOCK_RATE; in clk_scu_recalc_rate()
155 hdr->size = 2; in clk_scu_recalc_rate()
157 msg.data.req.resource = cpu_to_le16(clk->rsrc_id); in clk_scu_recalc_rate()
158 msg.data.req.clk = clk->clk_type; in clk_scu_recalc_rate()
171 * clk_scu_round_rate - Round clock rate for a SCU clock
182 * Assume we support all the requested rate and let the SCU firmware in clk_scu_round_rate()
195 if (clk->rsrc_id == IMX_SC_R_A35) in clk_scu_atf_set_cpu_rate()
198 return -EINVAL; in clk_scu_atf_set_cpu_rate()
200 /* CPU frequency scaling can ONLY be done by ARM-Trusted-Firmware */ in clk_scu_atf_set_cpu_rate()
208 * clk_scu_set_rate - Set rate for a SCU clock
211 * @parent_rate: rate of the clock parent, not used for SCU clocks
213 * Sets a clock frequency for a SCU clock. Returns the SCU
223 hdr->ver = IMX_SC_RPC_VERSION; in clk_scu_set_rate()
224 hdr->svc = IMX_SC_RPC_SVC_PM; in clk_scu_set_rate()
225 hdr->func = IMX_SC_PM_FUNC_SET_CLOCK_RATE; in clk_scu_set_rate()
226 hdr->size = 3; in clk_scu_set_rate()
229 msg.resource = cpu_to_le16(clk->rsrc_id); in clk_scu_set_rate()
230 msg.clk = clk->clk_type; in clk_scu_set_rate()
242 hdr->ver = IMX_SC_RPC_VERSION; in clk_scu_get_parent()
243 hdr->svc = IMX_SC_RPC_SVC_PM; in clk_scu_get_parent()
244 hdr->func = IMX_SC_PM_FUNC_GET_CLOCK_PARENT; in clk_scu_get_parent()
245 hdr->size = 2; in clk_scu_get_parent()
247 msg.data.req.resource = cpu_to_le16(clk->rsrc_id); in clk_scu_get_parent()
248 msg.data.req.clk = clk->clk_type; in clk_scu_get_parent()
260 static int clk_scu_set_parent(struct clk_hw *hw, u8 index) in clk_scu_set_parent() argument
266 hdr->ver = IMX_SC_RPC_VERSION; in clk_scu_set_parent()
267 hdr->svc = IMX_SC_RPC_SVC_PM; in clk_scu_set_parent()
268 hdr->func = IMX_SC_PM_FUNC_SET_CLOCK_PARENT; in clk_scu_set_parent()
269 hdr->size = 2; in clk_scu_set_parent()
271 msg.resource = cpu_to_le16(clk->rsrc_id); in clk_scu_set_parent()
272 msg.clk = clk->clk_type; in clk_scu_set_parent()
273 msg.parent = index; in clk_scu_set_parent()
284 hdr->ver = IMX_SC_RPC_VERSION; in sc_pm_clock_enable()
285 hdr->svc = IMX_SC_RPC_SVC_PM; in sc_pm_clock_enable()
286 hdr->func = IMX_SC_PM_FUNC_CLOCK_ENABLE; in sc_pm_clock_enable()
287 hdr->size = 3; in sc_pm_clock_enable()
298 * clk_scu_prepare - Enable a SCU clock
307 return sc_pm_clock_enable(ccm_ipc_handle, clk->rsrc_id, in clk_scu_prepare()
308 clk->clk_type, true, false); in clk_scu_prepare()
312 * clk_scu_unprepare - Disable a SCU clock
322 ret = sc_pm_clock_enable(ccm_ipc_handle, clk->rsrc_id, in clk_scu_unprepare()
323 clk->clk_type, false, false); in clk_scu_unprepare()
357 return ERR_PTR(-ENOMEM); in __imx_clk_scu()
359 clk->rsrc_id = rsrc_id; in __imx_clk_scu()
360 clk->clk_type = clk_type; in __imx_clk_scu()
379 clk->hw.init = &init; in __imx_clk_scu()
381 hw = &clk->hw; in __imx_clk_scu()