Message ID | 1341825639-23475-6-git-send-email-monstr@monstr.eu |
---|---|
State | Accepted |
Delegated to: | Michal Simek |
Headers | show |
Hi Michal, On Mon, Jul 9, 2012 at 2:20 AM, Michal Simek <monstr@monstr.eu> wrote: > Read configuration from DTB. > > Signed-off-by: Michal Simek <monstr@monstr.eu> > --- > arch/microblaze/cpu/interrupts.c | 19 +++++++++++++++++++ > 1 files changed, 19 insertions(+), 0 deletions(-) > > diff --git a/arch/microblaze/cpu/interrupts.c > b/arch/microblaze/cpu/interrupts.c > index 79ee96a..98c9110 100644 > --- a/arch/microblaze/cpu/interrupts.c > +++ b/arch/microblaze/cpu/interrupts.c > @@ -29,6 +29,9 @@ > #include <malloc.h> > #include <asm/microblaze_intc.h> > #include <asm/asm.h> > +#include <fdtdec.h> > + > +DECLARE_GLOBAL_DATA_PTR; > > #undef DEBUG_INT > > @@ -134,10 +137,26 @@ int interrupts_init(void) > { > int i; > > +#ifndef CONFIG_OF_CONTROL > #if defined(CONFIG_SYS_INTC_0_ADDR) && defined(CONFIG_SYS_INTC_0_NUM) > intc = (microblaze_intc_t *) (CONFIG_SYS_INTC_0_ADDR); > irq_no = CONFIG_SYS_INTC_0_NUM; > #endif > +#else > + int temp; > + int offset = 0; > I don't think you need the = 0. > + > + offset = fdt_node_offset_by_compatible(gd->fdt_blob, offset, > + "xlnx,xps-intc-1.00.a"); > + if (offset > 0) { > + temp = fdtdec_get_addr(gd->fdt_blob, offset, "reg"); > + if (temp != FDT_ADDR_T_NONE) { > + intc = (microblaze_intc_t *)temp; > + irq_no = fdtdec_get_int(gd->fdt_blob, offset, > + "xlnx,num-intr-inputs", 0); > + } > + } > +#endif > if (irq_no) { > vecs = calloc(1, sizeof(struct irq_action) * irq_no); > if (vecs == NULL) { > I'm not completely clear about whether this should be doing a realloc() (copying the existing array and adding a new member) or not. > -- > 1.7.0.4 > > Regards, Simon
On 07/09/2012 11:26 PM, Simon Glass wrote: > Hi Michal, > > On Mon, Jul 9, 2012 at 2:20 AM, Michal Simek <monstr@monstr.eu <mailto:monstr@monstr.eu>> wrote: > > Read configuration from DTB. > > Signed-off-by: Michal Simek <monstr@monstr.eu <mailto:monstr@monstr.eu>> > --- > arch/microblaze/cpu/interrupts.c | 19 +++++++++++++++++++ > 1 files changed, 19 insertions(+), 0 deletions(-) > > diff --git a/arch/microblaze/cpu/interrupts.c b/arch/microblaze/cpu/interrupts.c > index 79ee96a..98c9110 100644 > --- a/arch/microblaze/cpu/interrupts.c > +++ b/arch/microblaze/cpu/interrupts.c > @@ -29,6 +29,9 @@ > #include <malloc.h> > #include <asm/microblaze_intc.h> > #include <asm/asm.h> > +#include <fdtdec.h> > + > +DECLARE_GLOBAL_DATA_PTR; > > #undef DEBUG_INT > > @@ -134,10 +137,26 @@ int interrupts_init(void) > { > int i; > > +#ifndef CONFIG_OF_CONTROL > #if defined(CONFIG_SYS_INTC_0_ADDR) && defined(CONFIG_SYS_INTC_0_NUM) > intc = (microblaze_intc_t *) (CONFIG_SYS_INTC_0_ADDR); > irq_no = CONFIG_SYS_INTC_0_NUM; > #endif > +#else > + int temp; > + int offset = 0; > > > I don't think you need the = 0. Agree. Will remove it. > > + > + offset = fdt_node_offset_by_compatible(gd->fdt_blob, offset, > + "xlnx,xps-intc-1.00.a"); > + if (offset > 0) { > + temp = fdtdec_get_addr(gd->fdt_blob, offset, "reg"); > + if (temp != FDT_ADDR_T_NONE) { > + intc = (microblaze_intc_t *)temp; > + irq_no = fdtdec_get_int(gd->fdt_blob, offset, > + "xlnx,num-intr-inputs", 0); > + } > + } > +#endif > if (irq_no) { > vecs = calloc(1, sizeof(struct irq_action) * irq_no); > if (vecs == NULL) { > > > I'm not completely clear about whether this should be doing a realloc() (copying the existing array and adding a new member) or not. I am not sure what you mean by that. This is done after mem_alloc_init and microblaze u-boot does not any reallocation like other platforms. Is it what did you mean? Thanks, Michal
Hi Michal, On Tue, Jul 10, 2012 at 11:07 AM, Michal Simek <monstr@monstr.eu> wrote: > On 07/09/2012 11:26 PM, Simon Glass wrote: > >> Hi Michal, >> >> >> On Mon, Jul 9, 2012 at 2:20 AM, Michal Simek <monstr@monstr.eu <mailto: >> monstr@monstr.eu>> wrote: >> >> Read configuration from DTB. >> >> Signed-off-by: Michal Simek <monstr@monstr.eu <mailto: >> monstr@monstr.eu>> >> >> --- >> arch/microblaze/cpu/**interrupts.c | 19 +++++++++++++++++++ >> 1 files changed, 19 insertions(+), 0 deletions(-) >> >> diff --git a/arch/microblaze/cpu/**interrupts.c >> b/arch/microblaze/cpu/**interrupts.c >> index 79ee96a..98c9110 100644 >> --- a/arch/microblaze/cpu/**interrupts.c >> +++ b/arch/microblaze/cpu/**interrupts.c >> @@ -29,6 +29,9 @@ >> #include <malloc.h> >> #include <asm/microblaze_intc.h> >> #include <asm/asm.h> >> +#include <fdtdec.h> >> + >> +DECLARE_GLOBAL_DATA_PTR; >> >> #undef DEBUG_INT >> >> @@ -134,10 +137,26 @@ int interrupts_init(void) >> { >> int i; >> >> +#ifndef CONFIG_OF_CONTROL >> #if defined(CONFIG_SYS_INTC_0_**ADDR) && >> defined(CONFIG_SYS_INTC_0_NUM) >> intc = (microblaze_intc_t *) (CONFIG_SYS_INTC_0_ADDR); >> irq_no = CONFIG_SYS_INTC_0_NUM; >> #endif >> +#else >> + int temp; >> + int offset = 0; >> >> >> I don't think you need the = 0. >> > > Agree. Will remove it. > > > >> + >> + offset = fdt_node_offset_by_compatible(**gd->fdt_blob, >> offset, >> + "xlnx,xps-intc-1.00.a"); >> + if (offset > 0) { >> + temp = fdtdec_get_addr(gd->fdt_blob, offset, "reg"); >> + if (temp != FDT_ADDR_T_NONE) { >> + intc = (microblaze_intc_t *)temp; >> + irq_no = fdtdec_get_int(gd->fdt_blob, offset, >> + "xlnx,num-intr-inputs", 0); >> + } >> + } >> +#endif >> if (irq_no) { >> vecs = calloc(1, sizeof(struct irq_action) * irq_no); >> if (vecs == NULL) { >> >> >> I'm not completely clear about whether this should be doing a realloc() >> (copying the existing array and adding a new member) or not. >> > > I am not sure what you mean by that. > This is done after mem_alloc_init and microblaze u-boot does not any > reallocation like other platforms. > Is it what did you mean? > > No I just meant that if you had several calls to this it would need to add to the existing list. But I see now that this is just a single item being alloced, so it is fine. > 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 > Regards, Simon
On 07/10/2012 11:02 PM, Simon Glass wrote: > Hi Michal, > > On Tue, Jul 10, 2012 at 11:07 AM, Michal Simek <monstr@monstr.eu <mailto:monstr@monstr.eu>> wrote: > > On 07/09/2012 11:26 PM, Simon Glass wrote: > > Hi Michal, > > > On Mon, Jul 9, 2012 at 2:20 AM, Michal Simek <monstr@monstr.eu <mailto:monstr@monstr.eu> <mailto:monstr@monstr.eu <mailto:monstr@monstr.eu>>> wrote: > > Read configuration from DTB. > > Signed-off-by: Michal Simek <monstr@monstr.eu <mailto:monstr@monstr.eu> <mailto:monstr@monstr.eu <mailto:monstr@monstr.eu>>> > > --- > arch/microblaze/cpu/__interrupts.c | 19 +++++++++++++++++++ > 1 files changed, 19 insertions(+), 0 deletions(-) > > diff --git a/arch/microblaze/cpu/__interrupts.c b/arch/microblaze/cpu/__interrupts.c > index 79ee96a..98c9110 100644 > --- a/arch/microblaze/cpu/__interrupts.c > +++ b/arch/microblaze/cpu/__interrupts.c > @@ -29,6 +29,9 @@ > #include <malloc.h> > #include <asm/microblaze_intc.h> > #include <asm/asm.h> > +#include <fdtdec.h> > + > +DECLARE_GLOBAL_DATA_PTR; > > #undef DEBUG_INT > > @@ -134,10 +137,26 @@ int interrupts_init(void) > { > int i; > > +#ifndef CONFIG_OF_CONTROL > #if defined(CONFIG_SYS_INTC_0___ADDR) && defined(CONFIG_SYS_INTC_0_NUM) > intc = (microblaze_intc_t *) (CONFIG_SYS_INTC_0_ADDR); > irq_no = CONFIG_SYS_INTC_0_NUM; > #endif > +#else > + int temp; > + int offset = 0; > > > I don't think you need the = 0. > > > Agree. Will remove it. > > > > + > + offset = fdt_node_offset_by_compatible(__gd->fdt_blob, offset, > + "xlnx,xps-intc-1.00.a"); > + if (offset > 0) { > + temp = fdtdec_get_addr(gd->fdt_blob, offset, "reg"); > + if (temp != FDT_ADDR_T_NONE) { > + intc = (microblaze_intc_t *)temp; > + irq_no = fdtdec_get_int(gd->fdt_blob, offset, > + "xlnx,num-intr-inputs", 0); > + } > + } > +#endif > if (irq_no) { > vecs = calloc(1, sizeof(struct irq_action) * irq_no); > if (vecs == NULL) { > > > I'm not completely clear about whether this should be doing a realloc() (copying the existing array and adding a new member) or not. > > > I am not sure what you mean by that. > This is done after mem_alloc_init and microblaze u-boot does not any reallocation like other platforms. > Is it what did you mean? > > No I just meant that if you had several calls to this it would need to add to the existing list. But I see now that this is just a single item being alloced, so it is fine. ok. Thanks, Michal
diff --git a/arch/microblaze/cpu/interrupts.c b/arch/microblaze/cpu/interrupts.c index 79ee96a..98c9110 100644 --- a/arch/microblaze/cpu/interrupts.c +++ b/arch/microblaze/cpu/interrupts.c @@ -29,6 +29,9 @@ #include <malloc.h> #include <asm/microblaze_intc.h> #include <asm/asm.h> +#include <fdtdec.h> + +DECLARE_GLOBAL_DATA_PTR; #undef DEBUG_INT @@ -134,10 +137,26 @@ int interrupts_init(void) { int i; +#ifndef CONFIG_OF_CONTROL #if defined(CONFIG_SYS_INTC_0_ADDR) && defined(CONFIG_SYS_INTC_0_NUM) intc = (microblaze_intc_t *) (CONFIG_SYS_INTC_0_ADDR); irq_no = CONFIG_SYS_INTC_0_NUM; #endif +#else + int temp; + int offset = 0; + + offset = fdt_node_offset_by_compatible(gd->fdt_blob, offset, + "xlnx,xps-intc-1.00.a"); + if (offset > 0) { + temp = fdtdec_get_addr(gd->fdt_blob, offset, "reg"); + if (temp != FDT_ADDR_T_NONE) { + intc = (microblaze_intc_t *)temp; + irq_no = fdtdec_get_int(gd->fdt_blob, offset, + "xlnx,num-intr-inputs", 0); + } + } +#endif if (irq_no) { vecs = calloc(1, sizeof(struct irq_action) * irq_no); if (vecs == NULL) {
Read configuration from DTB. Signed-off-by: Michal Simek <monstr@monstr.eu> --- arch/microblaze/cpu/interrupts.c | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-)