Commit a0ce4383ab7bf27bc0f81fbafd5c448f31461620
1 parent
ededb7dfee
Exists in
smarc_8mm-imx_v2019.04_4.19.35_1.1.0
and in
1 other branch
MLK-21831 scu_api: Add sc_misc_set_control API
Signed-off-by: Ye Li <ye.li@nxp.com>
Showing 2 changed files with 29 additions and 0 deletions Side-by-side Diff
arch/arm/include/asm/arch-imx8/sci/sci.h
... | ... | @@ -74,6 +74,8 @@ |
74 | 74 | sc_faddr_t address); |
75 | 75 | |
76 | 76 | /* MISC API */ |
77 | +int sc_misc_set_control(sc_ipc_t ipc, sc_rsrc_t resource, | |
78 | + sc_ctrl_t ctrl, u32 val); | |
77 | 79 | int sc_misc_get_control(sc_ipc_t ipc, sc_rsrc_t resource, sc_ctrl_t ctrl, |
78 | 80 | u32 *val); |
79 | 81 | void sc_misc_get_boot_dev(sc_ipc_t ipc, sc_rsrc_t *boot_dev); |
drivers/misc/imx8/scu_api.c
... | ... | @@ -148,6 +148,33 @@ |
148 | 148 | } |
149 | 149 | |
150 | 150 | /* MISC */ |
151 | +int sc_misc_set_control(sc_ipc_t ipc, sc_rsrc_t resource, | |
152 | + sc_ctrl_t ctrl, u32 val) | |
153 | +{ | |
154 | + struct udevice *dev = gd->arch.scu_dev; | |
155 | + int size = sizeof(struct sc_rpc_msg_s); | |
156 | + struct sc_rpc_msg_s msg; | |
157 | + int ret; | |
158 | + | |
159 | + if (!dev) | |
160 | + hang(); | |
161 | + | |
162 | + RPC_VER(&msg) = SC_RPC_VERSION; | |
163 | + RPC_SVC(&msg) = (u8)(SC_RPC_SVC_MISC); | |
164 | + RPC_FUNC(&msg) = (u8)(MISC_FUNC_SET_CONTROL); | |
165 | + RPC_U32(&msg, 0U) = (u32)(ctrl); | |
166 | + RPC_U32(&msg, 4U) = (u32)(val); | |
167 | + RPC_U16(&msg, 8U) = (u16)(resource); | |
168 | + RPC_SIZE(&msg) = 4U; | |
169 | + | |
170 | + ret = misc_call(dev, SC_FALSE, &msg, size, &msg, size); | |
171 | + if (ret) | |
172 | + printf("%s: ctrl:%d resource:%d: res:%d\n", | |
173 | + __func__, ctrl, resource, RPC_R8(&msg)); | |
174 | + | |
175 | + return ret; | |
176 | +} | |
177 | + | |
151 | 178 | int sc_misc_get_control(sc_ipc_t ipc, sc_rsrc_t resource, sc_ctrl_t ctrl, |
152 | 179 | u32 *val) |
153 | 180 | { |