From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michal Simek Date: Tue, 10 Jul 2012 11:34:03 +0200 Subject: [U-Boot] [PATCH 09/12] microblaze: timer: Add device-tree driver configuration In-Reply-To: References: <1341825639-23475-1-git-send-email-monstr@monstr.eu> <1341825639-23475-9-git-send-email-monstr@monstr.eu> Message-ID: <4FFBF70B.8000305@monstr.eu> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 07/09/2012 11:32 PM, Simon Glass wrote: > Hi Michal, > > On Mon, Jul 9, 2012 at 2:20 AM, Michal Simek > wrote: > > Read configuration from DTB. > > Signed-off-by: Michal Simek > > --- > arch/microblaze/cpu/timer.c | 25 +++++++++++++++++++++++++ > 1 files changed, 25 insertions(+), 0 deletions(-) > > diff --git a/arch/microblaze/cpu/timer.c b/arch/microblaze/cpu/timer.c > index dfaaaf5..91ca42b 100644 > --- a/arch/microblaze/cpu/timer.c > +++ b/arch/microblaze/cpu/timer.c > @@ -25,6 +25,9 @@ > #include > #include > #include > +#include > + > +DECLARE_GLOBAL_DATA_PTR; > > volatile int timestamp = 0; > microblaze_timer_t *tmr; > @@ -62,11 +65,33 @@ int timer_init (void) > u32 preload = 0; > u32 ret = 0; > > +#ifndef CONFIG_OF_CONTROL > > > Maybe make this #ifdef and put the fdt code first? > > #if defined(CONFIG_SYS_TIMER_0_ADDR) && defined(CONFIG_SYS_INTC_0_NUM) > preload = XILINX_CLOCK_FREQ / CONFIG_SYS_HZ; > irq = CONFIG_SYS_TIMER_0_IRQ; > tmr = (microblaze_timer_t *) (CONFIG_SYS_TIMER_0_ADDR); > #endif > +#else > + int temp; > + int offset = 0; > > > Can remove =0 I think. > > + > + offset = fdt_node_offset_by_compatible(gd->fdt_blob, offset, > + "xlnx,xps-timer-1.00.a"); ok. It must be initialized because offset is passed as argument to the next function. For interrupt code is fine to add there zero but for timer I would keep there offset because system can contain more timers and we can change it to while loop soon. (NOTE: We have had discussion to use aliases for system timer but we haven't finished it. Thanks, Michal -- Michal Simek, Ing. (M.Eng) w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/ Microblaze U-BOOT custodian