diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-05-09 13:01:15 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-05-09 13:01:15 -0400 |
commit | 0160e00ae8e987be8822745fb166aa76451c9bcc (patch) | |
tree | deca2d09a729155ed0cb631f2bc8f557e634ab06 /drivers/firmware/meson/meson_sm.c | |
parent | c81ee18e97e4e3162169a749eb7f2b79b3510c7a (diff) | |
parent | b6942b68f85ed3161c91741791ec6f1779574919 (diff) |
Merge tag 'armsoc-drivers' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull ARM SoC driver updates from Olof Johansson:
"Driver updates for ARM SoCs:
Reset subsystem, merged through arm-soc by tradition:
- Make bool drivers explicitly non-modular
- New support for i.MX7 and Arria10 reset controllers
PATA driver for Palmchip BK371 (acked by Tejun)
Power domain drivers for i.MX (GPC, GPCv2)
- Moved out of mach-imx for GPC
- Bunch of tweaks, fixes, etc
PMC support for Tegra186
SoC detection support for Renesas RZ/G1H and RZ/G1N
Move Tegra flow controller driver from mach directory to drivers/soc
- (Power management / CPU power driver)
Misc smaller tweaks for other platforms"
* tag 'armsoc-drivers' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (60 commits)
soc: pm-domain: Fix the mangled urls
soc: renesas: rcar-sysc: Add support for R-Car H3 ES2.0
soc: renesas: rcar-sysc: Add support for fixing up power area tables
soc: renesas: Register SoC device early
soc: imx: gpc: add workaround for i.MX6QP to the GPC PD driver
dt-bindings: imx-gpc: add i.MX6 QuadPlus compatible
soc: imx: gpc: add defines for domain index
soc: imx: Add GPCv2 power gating driver
dt-bindings: Add GPCv2 power gating driver
ARM/clk: move the ICST library to drivers/clk
ARM: plat-versatile: remove stale clock header
ARM: keystone: Drop PM domain support for k2g
soc: ti: Add ti_sci_pm_domains driver
dt-bindings: Add TI SCI PM Domains
PM / Domains: Do not check if simple providers have phandle cells
PM / Domains: Add generic data pointer to genpd data struct
soc/tegra: Add initial flowctrl support for Tegra132/210
soc/tegra: flowctrl: Add basic platform driver
soc/tegra: Move Tegra flowctrl driver
ARM: tegra: Remove unnecessary inclusion of flowctrl header
...
Diffstat (limited to 'drivers/firmware/meson/meson_sm.c')
-rw-r--r-- | drivers/firmware/meson/meson_sm.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/drivers/firmware/meson/meson_sm.c b/drivers/firmware/meson/meson_sm.c index b0d254930ed3..ff204421117b 100644 --- a/drivers/firmware/meson/meson_sm.c +++ b/drivers/firmware/meson/meson_sm.c | |||
@@ -127,6 +127,7 @@ EXPORT_SYMBOL(meson_sm_call); | |||
127 | * meson_sm_call_read - retrieve data from secure-monitor | 127 | * meson_sm_call_read - retrieve data from secure-monitor |
128 | * | 128 | * |
129 | * @buffer: Buffer to store the retrieved data | 129 | * @buffer: Buffer to store the retrieved data |
130 | * @bsize: Size of the buffer | ||
130 | * @cmd_index: Index of the SMC32 function ID | 131 | * @cmd_index: Index of the SMC32 function ID |
131 | * @arg0: SMC32 Argument 0 | 132 | * @arg0: SMC32 Argument 0 |
132 | * @arg1: SMC32 Argument 1 | 133 | * @arg1: SMC32 Argument 1 |
@@ -135,11 +136,14 @@ EXPORT_SYMBOL(meson_sm_call); | |||
135 | * @arg4: SMC32 Argument 4 | 136 | * @arg4: SMC32 Argument 4 |
136 | * | 137 | * |
137 | * Return: size of read data on success, a negative value on error | 138 | * Return: size of read data on success, a negative value on error |
139 | * When 0 is returned there is no guarantee about the amount of | ||
140 | * data read and bsize bytes are copied in buffer. | ||
138 | */ | 141 | */ |
139 | int meson_sm_call_read(void *buffer, unsigned int cmd_index, u32 arg0, | 142 | int meson_sm_call_read(void *buffer, unsigned int bsize, unsigned int cmd_index, |
140 | u32 arg1, u32 arg2, u32 arg3, u32 arg4) | 143 | u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4) |
141 | { | 144 | { |
142 | u32 size; | 145 | u32 size; |
146 | int ret; | ||
143 | 147 | ||
144 | if (!fw.chip) | 148 | if (!fw.chip) |
145 | return -ENOENT; | 149 | return -ENOENT; |
@@ -147,16 +151,24 @@ int meson_sm_call_read(void *buffer, unsigned int cmd_index, u32 arg0, | |||
147 | if (!fw.chip->cmd_shmem_out_base) | 151 | if (!fw.chip->cmd_shmem_out_base) |
148 | return -EINVAL; | 152 | return -EINVAL; |
149 | 153 | ||
154 | if (bsize > fw.chip->shmem_size) | ||
155 | return -EINVAL; | ||
156 | |||
150 | if (meson_sm_call(cmd_index, &size, arg0, arg1, arg2, arg3, arg4) < 0) | 157 | if (meson_sm_call(cmd_index, &size, arg0, arg1, arg2, arg3, arg4) < 0) |
151 | return -EINVAL; | 158 | return -EINVAL; |
152 | 159 | ||
153 | if (!size || size > fw.chip->shmem_size) | 160 | if (size > bsize) |
154 | return -EINVAL; | 161 | return -EINVAL; |
155 | 162 | ||
163 | ret = size; | ||
164 | |||
165 | if (!size) | ||
166 | size = bsize; | ||
167 | |||
156 | if (buffer) | 168 | if (buffer) |
157 | memcpy(buffer, fw.sm_shmem_out_base, size); | 169 | memcpy(buffer, fw.sm_shmem_out_base, size); |
158 | 170 | ||
159 | return size; | 171 | return ret; |
160 | } | 172 | } |
161 | EXPORT_SYMBOL(meson_sm_call_read); | 173 | EXPORT_SYMBOL(meson_sm_call_read); |
162 | 174 | ||