From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: Re: [RFC 14/29] xen/arm: Retrieve timer interrupts from the device tree Date: Mon, 29 Apr 2013 21:23:03 +0100 Message-ID: <517ED6A7.6060108@linaro.org> References: <1367249898.3142.350.camel@zakaz.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1367249898.3142.350.camel@zakaz.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Campbell Cc: Anthony Perard , "patches@linaro.org" , Stefano Stabellini , "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org On 04/29/2013 04:38 PM, Ian Campbell wrote: > On Mon, 2013-04-29 at 00:01 +0100, Julien Grall wrote: > >> +/* List of timer's IRQ */ >> +enum ppi_nr >> +{ >> + PHYS_SECURE_PPI, >> + PHYS_NONSECURE_PPI, >> + VIRT_PPI, >> + HYP_PPI, >> + MAX_TIMER_PPI, >> +}; >> + >> +static struct dt_irq timer_irq[MAX_TIMER_PPI]; >> + >> /*static inline*/ s_time_t ticks_to_ns(uint64_t ticks) >> { >> return muldiv64(ticks, SECONDS(1), 1000 * cpu_khz); >> @@ -90,6 +103,28 @@ static uint32_t calibrate_timer(void) >> /* Set up the timer on the boot CPU */ >> int __init init_xen_time(void) >> { >> + struct dt_device_node *dev; >> + int res; >> + unsigned int i; >> + >> + dev = dt_find_compatible_node(NULL, NULL, "arm,armv7-timer"); >> + if ( !dev ) >> + panic("Unable to find a compatible timer in the device tree\n"); >> + >> + dt_device_set_used_by(dev, DT_USED_BY_XEN); >> + >> + /* Retrieve all IRQs for the timer */ >> + for ( i = PHYS_SECURE_PPI; i < MAX_TIMER_PPI; i++ ) >> + { >> + res = dt_device_get_irq(dev, i, &timer_irq[i]); > > If you expect the PPI nrs to have specific values you should declare > them as such in the enum. Right. I will fix it on the next patch series. -- Julien