[U-Boot] [PATCH v4] da830: Move common code out of da830evm.c file
Nick Thompson
nick.thompson at ge.com
Thu Jun 3 12:53:36 CEST 2010
On 03/06/10 05:25, Sudhakar Rajashekhara wrote:
> TI's DA850/OMAP-L138 platform is similar to DA830/OMAP-L137
> in many aspects. So instead of repeating the same code in
> multiple files, move the common code to a different file
> and call those functions from the respective da830/da850
> files.
>
> Signed-off-by: Sudhakar Rajashekhara <sudhakar.raj at ti.com>
> Acked-by: Nick Thompson <nick.thompson at ge.com>
> Acked-by: Ben Gardiner <bengardiner at nanometrics.ca>
> ---
> Since v3:
> Fixes the following compiler error for other davinci targets:
>
> misc.c: In function 'irq_init':
> misc.c:51: error: 'davinci_aintc_regs' undeclared (first use in this function)
> misc.c:51: error: (Each undeclared identifier is reported only once
> misc.c:51: error: for each function it appears in.)
> make[1]: *** [.../build/board/davinci/common/misc.o] Error 1
> make: *** [.../build/board/davinci/common/libdavinci.a] Error 2
> make: *** Waiting for unfinished jobs....
>
> board/davinci/common/misc.c | 32 ++++++++++++++++++++++++++++++++
> board/davinci/common/misc.h | 7 +++++++
> board/davinci/da830evm/da830evm.c | 28 +++++++++++-----------------
> 3 files changed, 50 insertions(+), 17 deletions(-)
>
> diff --git a/board/davinci/common/misc.c b/board/davinci/common/misc.c
> index 25ca326..dcf3cf2 100644
> --- a/board/davinci/common/misc.c
> +++ b/board/davinci/common/misc.c
> @@ -41,6 +41,24 @@ int dram_init(void)
> return(0);
> }
>
> +#ifdef CONFIG_SOC_DA8XX
> +void irq_init(void)
> +{
> + /*
> + * Mask all IRQs by clearing the global enable and setting
> + * the enable clear for all the 90 interrupts.
> + */
> +
> + writel(0, &davinci_aintc_regs->ger);
> +
> + writel(0, &davinci_aintc_regs->hier);
> +
> + writel(0xffffffff, &davinci_aintc_regs->ecr1);
> + writel(0xffffffff, &davinci_aintc_regs->ecr2);
> + writel(0xffffffff, &davinci_aintc_regs->ecr3);
> +}
> +#endif
In the current code base, this code is not included in the da830 compilation
if IRQs are not used. With this patch the code is included, but not called
if IRQs are not used. IRQs are often not used, so this change causes bloat.
Could you please make this conditional on IRQs?
> diff --git a/board/davinci/common/misc.h b/board/davinci/common/misc.h
> index 329c369..ee35f01 100644
> --- a/board/davinci/common/misc.h
> +++ b/board/davinci/common/misc.h
> @@ -45,10 +45,17 @@ struct pinmux_resource {
> .n_pins = ARRAY_SIZE(item) \
> }
>
> +struct lpsc_resource {
> + const int lpsc_no;
> +};
> +
> +void irq_init(void);
See comment below...
> int dvevm_read_mac_address(uint8_t *buf);
> void dv_configure_mac_address(uint8_t *rom_enetaddr);
> int davinci_configure_pin_mux(const struct pinmux_config *pins, int n_pins);
> int davinci_configure_pin_mux_items(const struct pinmux_resource *item,
> int n_items);
> +int davinci_configure_lpsc_items(const struct lpsc_resource *item,
> + int n_items);
>
> #endif /* __MISC_H */
> diff --git a/board/davinci/da830evm/da830evm.c b/board/davinci/da830evm/da830evm.c
> index 6385443..ed89473 100644
> --- a/board/davinci/da830evm/da830evm.c
> +++ b/board/davinci/da830evm/da830evm.c
> @@ -120,21 +120,18 @@ static const struct pinmux_resource pinmuxes[] = {
> #endif
> };
>
> +static const struct lpsc_resource lpsc[] = {
> + { DAVINCI_LPSC_AEMIF }, /* NAND, NOR */
> + { DAVINCI_LPSC_SPI0 }, /* Serial Flash */
> + { DAVINCI_LPSC_EMAC }, /* image download */
> + { DAVINCI_LPSC_UART2 }, /* console */
> + { DAVINCI_LPSC_GPIO },
> +};
> +
> int board_init(void)
> {
> #ifndef CONFIG_USE_IRQ
> - /*
> - * Mask all IRQs by clearing the global enable and setting
> - * the enable clear for all the 90 interrupts.
> - */
> -
> - writel(0, &davinci_aintc_regs->ger);
> -
> - writel(0, &davinci_aintc_regs->hier);
> -
> - writel(0xffffffff, &davinci_aintc_regs->ecr1);
> - writel(0xffffffff, &davinci_aintc_regs->ecr2);
> - writel(0xffffffff, &davinci_aintc_regs->ecr3);
> + irq_init();
> #endif
I'm okay with this part, but does it make sense to have a weak declaration (above)
and remove the IRQ ifdef from here?
Nick.
More information about the U-Boot
mailing list