[U-Boot] [PATCH v2 3/4] c6x: Add suport build davinci SOC with c674x CPUs

Dmitry Bondar bond at inmys.ru
Sat Jun 23 13:11:09 CEST 2012


C674x CPUs has same peripherals(uart,emac,nand contoller) like sitara processors (am1705/am1707/omapl137/omapl138).
In u-boot this peripheral known as davinci SOC, and placed in arch/arm/cpu/arm926ejs/davinci
This patch allow compile davinci SOC code whith c674x CPU.

Reset code rewritten in C for compile not only for arm.

Signed-off-by: Dmitry Bondar <bond at inmys.ru>
Cc: Tom Rini <trini at ti.com>
---
Changes for v2:
   - reset_c.c rewritten with readl/writel.

---
 Makefile                                 |    1 +
 arch/arm/cpu/arm926ejs/davinci/Makefile  |    5 ++++
 arch/arm/cpu/arm926ejs/davinci/reset_c.c |   31 ++++++++++++++++++++++++++++++
 mkconfig                                 |    7 +++++-
 4 files changed, 43 insertions(+), 1 deletions(-)
 create mode 100644 arch/arm/cpu/arm926ejs/davinci/reset_c.c

diff --git a/Makefile b/Makefile
index 0197239..33e12cf 100644
--- a/Makefile
+++ b/Makefile
@@ -779,6 +779,7 @@ clobber:	tidy
 	@rm -f $(obj)arch/powerpc/cpu/mpc824x/bedbug_603e.c
 	@rm -f $(obj)arch/powerpc/cpu/mpc83xx/ddr-gen?.c
 	@rm -fr $(obj)include/asm/proc $(obj)include/asm/arch $(obj)include/asm
+	@rm -f ${obj}arch/c6x/cpu/c674x/davinci
 	@rm -fr $(obj)include/generated
 	@[ ! -d $(obj)nand_spl ] || find $(obj)nand_spl -name "*" -type l -print | xargs rm -f
 	@[ ! -d $(obj)onenand_ipl ] || find $(obj)onenand_ipl -name "*" -type l -print | xargs rm -f
diff --git a/arch/arm/cpu/arm926ejs/davinci/Makefile b/arch/arm/cpu/arm926ejs/davinci/Makefile
index da7efac..54f096d 100644
--- a/arch/arm/cpu/arm926ejs/davinci/Makefile
+++ b/arch/arm/cpu/arm926ejs/davinci/Makefile
@@ -42,7 +42,12 @@ COBJS-$(CONFIG_SOC_DM365)	+= dm365_lowlevel.o
 COBJS-$(CONFIG_SOC_DA8XX)	+= da850_lowlevel.o
 endif
 
+
+ifeq ($(CPU),c674x)
+COBJS-y	+= reset_c.o
+else
 SOBJS	= reset.o
+endif
 
 ifndef CONFIG_SKIP_LOWLEVEL_INIT
 SOBJS	+= lowlevel_init.o
diff --git a/arch/arm/cpu/arm926ejs/davinci/reset_c.c b/arch/arm/cpu/arm926ejs/davinci/reset_c.c
new file mode 100644
index 0000000..c1340e3
--- /dev/null
+++ b/arch/arm/cpu/arm926ejs/davinci/reset_c.c
@@ -0,0 +1,31 @@
+/*
+ *  Processor reset using WDT.
+ *
+ * Copyright (C) 2012 Dmitry Bondar <bond at inmys.ru>
+ * Copyright (C) 2007 Sergey Kubushyn <ksi at koi8.net>
+ *
+ * This file is released under the terms of GPL v2 and any later version.
+ * See the file COPYING in the root directory of the source tree for details.
+*/
+
+#include <common.h>
+#include <asm/io.h>
+#include <asm/arch/timer_defs.h>
+
+void reset_cpu(unsigned long a)
+{
+	struct davinci_timer * const wdttimer = 
+		(struct davinci_timer *)DAVINCI_TIMER1_BASE;
+	writel(0x08, &wdttimer->tgcr);
+	writel(readl(&wdttimer->tgcr) | 0x03, &wdttimer->tgcr);
+	writel(0, &wdttimer->tim12);
+	writel(0, &wdttimer->tim34);
+	writel(0, &wdttimer->prd12);
+	writel(0, &wdttimer->prd34);
+	writel(readl(&wdttimer->tcr) | 0x40, &wdttimer->tcr);
+	writel(readl(&wdttimer->wdtcr) | 0x4000, &wdttimer->wdtcr);
+	writel(0xa5c64000, &wdttimer->wdtcr);
+	writel(0xda7e4000, &wdttimer->wdtcr);
+	writel(0x4000, &wdttimer->wdtcr);
+	while(1);
+}
diff --git a/mkconfig b/mkconfig
index daa1810..c80625e 100755
--- a/mkconfig
+++ b/mkconfig
@@ -119,7 +119,12 @@ rm -f asm/arch
 if [ -z "${soc}" ] ; then
 	ln -s ${LNPREFIX}arch-${cpu} asm/arch
 else
-	ln -s ${LNPREFIX}arch-${soc} asm/arch
+	if [ "${arch}" == "c6x" -a "$soc" == "davinci" ]; then
+		ln -s ${SRCTREE}/arch/arm/include/asm/arch-davinci asm/arch
+		ln -s ${SRCTREE}/arch/arm/cpu/arm926ejs/davinci ${SRCTREE}/arch/c6x/cpu/c674x/davinci
+	else
+		ln -s ${LNPREFIX}arch-${soc} asm/arch
+	fi
 fi
 
 if [ "${arch}" = "arm" ] ; then
-- 
1.7.2.5



More information about the U-Boot mailing list