diff options
author | Arnd Bergmann <arnd@arndb.de> | 2023-04-14 14:05:48 +0200 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2023-04-14 14:05:49 +0200 |
commit | 3e54e7c8c42a0a640f4b4c4a491c7e0b34b8ebbd (patch) | |
tree | 7b92ea701c67bdca4e8e29ad4a51d5e5efe78dc3 /arch | |
parent | bda649b9a8bff3e234f92061986e3de920f458e4 (diff) | |
parent | 3c01b05407bfeb42c4db0f7cc079437228ab0ab2 (diff) |
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/20230410232606.1917803-4-f.fainelli@gmail.com
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-bcm/bcm_kona_smc.c | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/arch/arm/mach-bcm/bcm_kona_smc.c b/arch/arm/mach-bcm/bcm_kona_smc.c index 185335843bbd..f236e12d7a59 100644 --- a/arch/arm/mach-bcm/bcm_kona_smc.c +++ b/arch/arm/mach-bcm/bcm_kona_smc.c @@ -31,34 +31,23 @@ static const struct of_device_id bcm_kona_smc_ids[] __initconst = { int __init bcm_kona_smc_init(void) { struct device_node *node; - const __be32 *prop_val; - u64 prop_size = 0; - unsigned long buffer_size; - u32 buffer_phys; + struct resource res; + int ret; /* Read buffer addr and size from the device tree node */ node = of_find_matching_node(NULL, bcm_kona_smc_ids); if (!node) return -ENODEV; - prop_val = of_get_address(node, 0, &prop_size, NULL); + ret = of_address_to_resource(node, 0, &res); of_node_put(node); - if (!prop_val) + if (ret) return -EINVAL; - /* We assume space for four 32-bit arguments */ - if (prop_size < 4 * sizeof(u32) || prop_size > (u64)ULONG_MAX) - return -EINVAL; - buffer_size = (unsigned long)prop_size; - - buffer_phys = be32_to_cpup(prop_val); - if (!buffer_phys) - return -EINVAL; - - bcm_smc_buffer = ioremap(buffer_phys, buffer_size); + bcm_smc_buffer = ioremap(res.start, resource_size(&res)); if (!bcm_smc_buffer) return -ENOMEM; - bcm_smc_buffer_phys = buffer_phys; + bcm_smc_buffer_phys = res.start; pr_info("Kona Secure API initialized\n"); |