From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christian Riesch Date: Mon, 26 Sep 2011 10:02:59 +0200 Subject: [U-Boot] [PATCH 6/8] arm, davinci, am1808: add lowlevel functions for booting from NOR In-Reply-To: <1316066380-7397-7-git-send-email-hs@denx.de> References: <1316066380-7397-1-git-send-email-hs@denx.de> <1316066380-7397-7-git-send-email-hs@denx.de> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 wrote: > Signed-off-by: Heiko Schocher > Cc: Paulraj Sandeep > Cc: Albert ARIBAUD > --- > ?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 = ®->psc0.mdstat[module]; > + ? ? ? ? ? ? ? mdctl = ®->psc0.mdctl[module]; > + ? ? ? } else { > + ? ? ? ? ? ? ? reg = davinci_psc1_regs; > + ? ? ? ? ? ? ? mdstat = ®->psc1.mdstat[module]; > + ? ? ? ? ? ? ? mdctl = ®->psc1.mdctl[module]; > + ? ? ? } > + > + ? ? ? /* Wait for any outstanding transition to complete */ > + ? ? ? while ((readl(®->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(®->ptcmd, (0x00000001 << domain)); > + > + ? ? ? /* Wait for transition to complete */ > + ? ? ? while (readl(®->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