[U-Boot] [PATCH 2/4] nds32/ag102: add ag102 soc support

Mike Frysinger vapier at gentoo.org
Sat Nov 19 04:31:31 CET 2011


On Friday 18 November 2011 03:30:55 Macpaul Lin wrote:
> --- /dev/null
> +++ b/arch/nds32/cpu/n1213/ag102/cpu.c
>
> +int cleanup_before_linux(void)
> +{
> +#ifdef CONFIG_MMU
> +	unsigned long i;
> +#endif

this variable is unused

> +int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
> +{
> +	disable_interrupts();
> +
> +	/*
> +	 * reset to the base addr of andesboot.
> +	 * currently no ROM loader at addr 0.
> +	 * do not use reset_cpu(0);
> +	 */
> +#ifdef CONFIG_FTWDT010_WATCHDOG
> +	/*
> +	 * workaround: if we use CONFIG_HW_WATCHDOG with ftwdt010, will lead
> +	 * automatic hardware reset when booting Linux.
> +	 * Please do not use CONFIG_HW_WATCHDOG and WATCHDOG_RESET() here.
> +	 */
> +	ftwdt010_wdt_reset();
> +	while (1)
> +		;
> +#endif /* CONFIG_FTWDT010_WATCHDOG */
> +
> +	/*NOTREACHED*/
> +}

if CONFIG_FTWDT010_WATCHDOG isn't defined, then this command will wrongly 
return.  you probably want to move that while(1) outside of the ifdef.  
actually, delete that while(1) and put a hang() there.

> +void flush_cache(unsigned long addr, unsigned long size)
> +{
> +	dcache_flush_range(addr , addr + size);
> +	icache_inval_range(addr , addr + size);
> +}

no spaces before those commas

> --- /dev/null
> +++ b/arch/nds32/cpu/n1213/ag102/timer.c
>
> +int timer_init(void)
> +{
> +	static struct fttmr010 *tmr = (struct fttmr010 *)CONFIG_FTTMR010_BASE;

don't think this needs to be static

> +void reset_timer_masked(void)
> +{
> +	static struct fttmr010 *tmr = (struct fttmr010 *)CONFIG_FTTMR010_BASE;

this too

> +ulong get_timer_masked(void)
> +{
> +	static struct fttmr010 *tmr = (struct fttmr010 *)CONFIG_FTTMR010_BASE;

and here

> +void __udelay(unsigned long usec)
> +{
> +	static struct fttmr010 *tmr = (struct fttmr010 *)CONFIG_FTTMR010_BASE;

and here

> --- /dev/null
> +++ b/arch/nds32/cpu/n1213/ag102/watchdog.S
>
> +#ifndef CONFIG_SKIP_TRUNOFF_WATCHDOG

looks like a useless define ...

> +.globl	turnoff_watchdog
> +turnoff_watchdog:
> +
> +#define WD_CR		0xC
> +#define WD_ENABLE	0x1
> +
> +	! Turn off the watchdog, according to Faraday FTWDT010 spec
> +	li 	$p0, (CONFIG_FTWDT010_BASE+WD_CR)	! Get the addr of WD CR
> +	lwi	$p1, [$p0]				! Get the config of WD
> +	andi	$p1, $p1, 0x1f				! Wipe out useless bits
> +	li	$r0, ~WD_ENABLE
> +	and	$p1, $p1, $r0				! Set WD disable
> +	sw	$p1, [$p0]				! Write back to WD CR
> +
> +	! Disable Interrupts by clear GIE in $PSW reg
> +	setgie.d

can't this be C code ?
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20111118/853abe54/attachment.pgp>


More information about the U-Boot mailing list