[U-Boot] [PATCH 6/8] arm, davinci, am1808: add lowlevel functions for booting from NOR

Christian Riesch christian.riesch at omicron.at
Mon Sep 26 10:02:59 CEST 2011


Heiko,
I am looking forward to see these patches in mainline u-boot. My
custom board also directly boots from NOR, so I think there is a lot I
can re-use for my board.
I have one question, please see below:

On Thu, Sep 15, 2011 at 7:59 AM, Heiko Schocher <hs at denx.de> wrote:
> Signed-off-by: Heiko Schocher <hs at denx.de>
> Cc: Paulraj Sandeep <s-paulraj at ti.com>
> Cc: Albert ARIBAUD <albert.u.boot at aribaud.net>
> ---
>  arch/arm/cpu/arm926ejs/davinci/Makefile            |    1 +
>  arch/arm/cpu/arm926ejs/davinci/am1808_lowlevel.c   |  428 ++++++++++++++++++++
>  .../arm/include/asm/arch-davinci/am1808_lowlevel.h |   44 ++
>  3 files changed, 473 insertions(+), 0 deletions(-)
>  create mode 100644 arch/arm/cpu/arm926ejs/davinci/am1808_lowlevel.c
>  create mode 100644 arch/arm/include/asm/arch-davinci/am1808_lowlevel.h

[...]

> diff --git a/arch/arm/cpu/arm926ejs/davinci/am1808_lowlevel.c b/arch/arm/cpu/arm926ejs/davinci/am1808_lowlevel.c
> new file mode 100644
> index 0000000..1ea4a9f
> --- /dev/null
> +++ b/arch/arm/cpu/arm926ejs/davinci/am1808_lowlevel.c

[...]

> +void am1808_lpc_transition(unsigned char pscnum, unsigned char module,
> +               unsigned char domain, unsigned char state)
> +{
> +       struct davinci_psc_regs *reg;
> +       dv_reg_p mdstat, mdctl;
> +
> +       if (pscnum == 0) {
> +               reg = davinci_psc0_regs;
> +               mdstat = &reg->psc0.mdstat[module];
> +               mdctl = &reg->psc0.mdctl[module];
> +       } else {
> +               reg = davinci_psc1_regs;
> +               mdstat = &reg->psc1.mdstat[module];
> +               mdctl = &reg->psc1.mdctl[module];
> +       }
> +
> +       /* Wait for any outstanding transition to complete */
> +       while ((readl(&reg->ptstat) & (0x00000001 << domain)))
> +               ;
> +
> +       /* If we are already in that state, just return */
> +       if ((readl(mdstat) & 0x1F) == state)
> +               return;
> +
> +       /* Perform transition */
> +       writel((readl(mdctl) & 0xFFFFFFE0) | state, mdctl);
> +       setbits_le32(&reg->ptcmd, (0x00000001 << domain));
> +
> +       /* Wait for transition to complete */
> +       while (readl(&reg->ptstat) & (0x00000001 << domain))
> +               ;
> +
> +       /* Wait and verify the state */
> +       while ((readl(mdstat) & 0x1F) != state)
> +               ;
> +}

There is some similar code in arch/arm/cpu/arm926ejs/davinci/psc.c. Is
there any reason why you don't use this code or adapt it for your
needs?
Regards, Christian


More information about the U-Boot mailing list