xen: arm: platforms: Adding reset support for xgene arm64 platform.
PATCH v4 1/1 xen: arm: platforms: Adding reset support for xgene arm64 platform.
This patch adds a reset support for xgene arm64 platform.
V4:
- Removing TODO comment about retriving reset base address from dts as that is done now.
V3:
- Retriving reset base address and reset mask from device tree.
- Removed unnecssary header files included earlier.
V2:
- Removed unnecssary mdelay in code.
- Adding iounmap of the base address.
V1:
-Initial patch.
Signed-off-by Pranavkumar Sawargaonkar <[email protected]>
Signed-off-by Anup Patel <[email protected]>
--- xen/arch/arm/platforms/xgene-storm.c | 67 ++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+)
xen/arch/arm/platforms/xgene-storm.c +67 -0
@@ -20,8 +20,17 @@#include <xen/config.h> #include <asm/platform.h> +#include <xen/vmap.h> +#include <asm/io.h> #include <asm/gic.h> +#define DT_MATCH_RESET \ + DT_MATCH_COMPATIBLE("apm,xgene-reboot") + +/* Variables to save reset address of soc during platform initialization. */ +static u64 reset_addr, reset_size; +static u32 reset_mask; +static uint32_t xgene_storm_quirks (void ) {return PLATFORM_QUIRK_GIC_64K_STRIDE ;
@@ -107,6 +116,62 @@ err:return ret; } +static void xgene_storm_reset (void ) +{ +void __iomem *addr; + + addr =ioremap_nocache (reset_addr, reset_size); + +if ( !addr ) + { +printk ("Unable to map xgene reset address\n" ); +return ; + } + +/* Write reset mask to base address */ +writel (reset_mask, addr); + +iounmap (addr); +} + +static int xgene_storm_init (void ) +{ +static const struct dt_device_match reset_ids[]__initconst = + { +DT_MATCH_RESET , + {}, + }; +struct dt_device_node *dev; +int res; + + dev =dt_find_matching_node (NULL , reset_ids); +if ( !dev ) + { +printk ("Unable to find a compatible reset node in " +"the device tree" ); +return -ENODEV ; + } + +dt_device_set_used_by (dev,DOMID_XEN ); + +/* Retrieve base address and size */ + res =dt_device_get_address (dev,0 , &reset_addr, &reset_size); +if ( res ) + { +printk ("Unable to retrieve the base address for reset\n" ); +return res; + } + +/* Get reset mask */ + res =dt_property_read_u32 (dev,"mask" , &reset_mask); +if ( !res ) + { +printk ("Unable to retrieve the reset mask\n" ); +return res; + } + +return 0 ; +}static const char *const xgene_storm_dt_compat[]__initconst = {
@@ -116,6 +181,8 @@ static const char * const xgene_storm_dt_compat[] __initconst =PLATFORM_START (xgene_storm,"APM X-GENE STORM" ) .compatible = xgene_storm_dt_compat, + .init = xgene_storm_init, + .reset = xgene_storm_reset, .quirks = xgene_storm_quirks, .specific_mapping = xgene_storm_specific_mapping,
Signature · 1 line
1.7.9.5