From: Ian Campbell Subject: Re: [PATCH V6] xen: arm: platforms: Adding reset support for xgene arm64 platform. Date: Mon, 27 Jan 2014 11:38:00 +0000 Message-ID: <1390822680.12230.24.camel@kazak.uk.xensource.com> References: <1390822488-22183-1-git-send-email-pranavkumar@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1390822488-22183-1-git-send-email-pranavkumar@linaro.org> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Pranavkumar Sawargaonkar Cc: Anup Patel , patches@linaro.org, George Dunlap , patches@apm.com, xen-devel@lists.xen.org, stefano.stabellini@citrix.com List-Id: xen-devel@lists.xenproject.org On Mon, 2014-01-27 at 17:04 +0530, Pranavkumar Sawargaonkar wrote: > This patch adds a reset support for xgene arm64 platform. > > V6: > - Incorporating comments received on V5 patch. > V5: > - Incorporating comments received on V4 patch. > 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 > Signed-off-by: Anup Patel Looks good, thanks: Acked-by: Ian Campbell George, I'd like to put this in 4.4. The impact on non-xgene is non existent and I think reset is basic functionality which we should enable. > --- > xen/arch/arm/platforms/xgene-storm.c | 72 ++++++++++++++++++++++++++++++++++ > 1 file changed, 72 insertions(+) > > diff --git a/xen/arch/arm/platforms/xgene-storm.c b/xen/arch/arm/platforms/xgene-storm.c > index 5b0bd5f..4fc185b 100644 > --- a/xen/arch/arm/platforms/xgene-storm.c > +++ b/xen/arch/arm/platforms/xgene-storm.c > @@ -20,8 +20,16 @@ > > #include > #include > +#include > +#include > +#include > #include > > +/* Variables to save reset address of soc during platform initialization. */ > +static u64 reset_addr, reset_size; > +static u32 reset_mask; > +static bool reset_vals_valid = false; > + > static uint32_t xgene_storm_quirks(void) > { > return PLATFORM_QUIRK_GIC_64K_STRIDE; > @@ -107,6 +115,68 @@ err: > return ret; > } > > +static void xgene_storm_reset(void) > +{ > + void __iomem *addr; > + > + if ( !reset_vals_valid ) > + { > + printk("XGENE: Invalid reset values, can not reset XGENE...\n"); > + return; > + } > + > + addr = ioremap_nocache(reset_addr, reset_size); > + > + if ( !addr ) > + { > + printk("XGENE: Unable to map xgene reset address, can not reset XGENE...\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_COMPATIBLE("apm,xgene-reboot"), > + {}, > + }; > + struct dt_device_node *dev; > + int res; > + > + dev = dt_find_matching_node(NULL, reset_ids); > + if ( !dev ) > + { > + printk("XGENE: Unable to find a compatible reset node in the device tree"); > + return 0; > + } > + > + 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("XGENE: Unable to retrieve the base address for reset\n"); > + return 0; > + } > + > + /* Get reset mask */ > + res = dt_property_read_u32(dev, "mask", &reset_mask); > + if ( !res ) > + { > + printk("XGENE: Unable to retrieve the reset mask\n"); > + return 0; > + } > + > + reset_vals_valid = true; > + return 0; > +} > > static const char * const xgene_storm_dt_compat[] __initconst = > { > @@ -116,6 +186,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, >