Skip to content

Commit 3e54e7c

Browse files
committed
Merge tag 'arm-soc/for-6.4/soc' of https://github.com/Broadcom/stblinux into soc/arm
This pull request contains ARM-based platform code changes for 6.4, please pull the following: - Rob makes use of the of_address_to_resource() helper instead of open coding it in the Kona SMC code. * tag 'arm-soc/for-6.4/soc' of https://github.com/Broadcom/stblinux: ARM: bcm: Use of_address_to_resource() Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnd Bergmann <[email protected]>
2 parents bda649b + 3c01b05 commit 3e54e7c

File tree

1 file changed

+6
-17
lines changed

1 file changed

+6
-17
lines changed

arch/arm/mach-bcm/bcm_kona_smc.c

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -31,34 +31,23 @@ static const struct of_device_id bcm_kona_smc_ids[] __initconst = {
3131
int __init bcm_kona_smc_init(void)
3232
{
3333
struct device_node *node;
34-
const __be32 *prop_val;
35-
u64 prop_size = 0;
36-
unsigned long buffer_size;
37-
u32 buffer_phys;
34+
struct resource res;
35+
int ret;
3836

3937
/* Read buffer addr and size from the device tree node */
4038
node = of_find_matching_node(NULL, bcm_kona_smc_ids);
4139
if (!node)
4240
return -ENODEV;
4341

44-
prop_val = of_get_address(node, 0, &prop_size, NULL);
42+
ret = of_address_to_resource(node, 0, &res);
4543
of_node_put(node);
46-
if (!prop_val)
44+
if (ret)
4745
return -EINVAL;
4846

49-
/* We assume space for four 32-bit arguments */
50-
if (prop_size < 4 * sizeof(u32) || prop_size > (u64)ULONG_MAX)
51-
return -EINVAL;
52-
buffer_size = (unsigned long)prop_size;
53-
54-
buffer_phys = be32_to_cpup(prop_val);
55-
if (!buffer_phys)
56-
return -EINVAL;
57-
58-
bcm_smc_buffer = ioremap(buffer_phys, buffer_size);
47+
bcm_smc_buffer = ioremap(res.start, resource_size(&res));
5948
if (!bcm_smc_buffer)
6049
return -ENOMEM;
61-
bcm_smc_buffer_phys = buffer_phys;
50+
bcm_smc_buffer_phys = res.start;
6251

6352
pr_info("Kona Secure API initialized\n");
6453

0 commit comments

Comments
 (0)