diff mbox

[U-Boot,v3,2/4] c6x: Add support c674x CPUs

Message ID 1340647361-23387-3-git-send-email-bond@inmys.ru
State Deferred
Delegated to: Tom Rini
Headers show

Commit Message

Dmitry Bondar June 25, 2012, 6:02 p.m. UTC
C6X has subfamilys: C62x C64x C66x C67x C645x C674x.
This patch add support of subfamily C674x (C6745/C6746/C6747 CPUs).

Signed-off-by: Dmitry Bondar <bond@inmys.ru>
Cc: Tom Rini <trini@ti.com>
---
 arch/c6x/cpu/c674x/Makefile  |   30 ++++++++++++++++
 arch/c6x/cpu/c674x/cache.c   |   17 +++++++++
 arch/c6x/cpu/c674x/config.mk |   14 ++++++++
 arch/c6x/cpu/c674x/start.S   |   22 ++++++++++++
 arch/c6x/cpu/u-boot.lds      |   76 ++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 159 insertions(+), 0 deletions(-)
 create mode 100644 arch/c6x/cpu/c674x/Makefile
 create mode 100644 arch/c6x/cpu/c674x/cache.c
 create mode 100644 arch/c6x/cpu/c674x/config.mk
 create mode 100644 arch/c6x/cpu/c674x/start.S
 create mode 100644 arch/c6x/cpu/u-boot.lds

Comments

Tom Rini June 25, 2012, 10:44 p.m. UTC | #1
On Mon, Jun 25, 2012 at 10:02:39PM +0400, Dmitry Bondar wrote:

> C6X has subfamilys: C62x C64x C66x C67x C645x C674x.
> This patch add support of subfamily C674x (C6745/C6746/C6747 CPUs).
> 
> Signed-off-by: Dmitry Bondar <bond@inmys.ru>
> Cc: Tom Rini <trini@ti.com>

This one is fine, FYI.
Mike Frysinger July 19, 2012, 3:59 a.m. UTC | #2
On Monday 25 June 2012 14:02:39 Dmitry Bondar wrote:
> --- /dev/null
> +++ b/arch/c6x/cpu/c674x/cache.c
>
> +void flush_cache(unsigned long addr, unsigned long len)
> +{
> +}
> +
> +void flush_dcache_range(unsigned long start, unsigned long stop)
> +{
> +}
> +
> +void invalidate_dcache_range(unsigned long start, unsigned long stop)
> +{
> +}

you /really/ should implement these.  i can't see how this would be that hard.

> --- /dev/null
> +++ b/arch/c6x/cpu/c674x/config.mk
>
> +PLATFORM_RELFLAGS += -fno-common -ffixed-B31

this belongs in arch/c6x/config.mk, not this file

> +PLATFORM_CPPFLAGS += -march=c674x -msdata=none -mno-dsbt
> -DCONFIG_TMS320C64XPLUS

most likely the msdata/dsbt settings also belong in arch/c6x/config.mk, not 
here

> +PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call
> cc-option,-malignment-traps,))

and these too belong in arch/c6x/config.mk

also, it should be:
PLATFORM_ALIGN_FLAGS := $(...)
PLATFORM_RELFLAGS += $(PLATFORM_ALIGN_FLAGS)

> --- /dev/null
> +++ b/arch/c6x/cpu/c674x/start.S
>
> +        .global _start
> +_start:
> +	;; Jump to u-boot
> +	MVKL    .S2     CONFIG_SYS_INIT_SP_ADDR,B15
> +	MVKH    .S2     CONFIG_SYS_INIT_SP_ADDR,B15
> +	MVKL    .S1     board_init_f,A0
> +	MVKH    .S1     board_init_f,A0
> +	B       .S2X    A0
> +	MVKL    .S2     L1,B3
> +	MVKH    .S2     L1,B3
> +	NOP     3
> +L1:	B       .S2     B3
> +	NOP     5

i know nothing about C6X, but i suspect this is not specific to the c674x cpu, 
and should probably be in a common arch/c6x/cpu/start.S location

> --- /dev/null
> +++ b/arch/c6x/cpu/u-boot.lds
>
> +/*OUTPUT_FORMAT("elf32-littlec6x", "elf32-littlec6x", "elf32-littlec6x")*/
> +/*OUTPUT_ARCH(c6x)*/

delete dead code

> +ENTRY(_start)
> +SECTIONS
> +{
> +	. = ALIGN(4);
> +	.text :
> +	{
> +		CPUDIR/start.o	(.text)

CPUDIR can't be right.  did you compile this ?

this file in general looks generic and should probably live at 
arch/c6x/cpu/init.lds.S instead
-mike
diff mbox

Patch

diff --git a/arch/c6x/cpu/c674x/Makefile b/arch/c6x/cpu/c674x/Makefile
new file mode 100644
index 0000000..bfe0db6
--- /dev/null
+++ b/arch/c6x/cpu/c674x/Makefile
@@ -0,0 +1,30 @@ 
+# (C) Copyright 2012  Dmitry Bondar <bond@inmys.ru>
+#
+# 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 $(TOPDIR)/config.mk
+
+LIB	= $(obj)lib$(CPU).o
+
+START	= start.o
+COBJS	= cache.o
+
+SRCS	:= $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS	:= $(addprefix $(obj),$(COBJS) $(SOBJS))
+START	:= $(addprefix $(obj),$(START))
+
+all:	$(obj).depend $(START) $(LIB)
+
+$(LIB):	$(OBJS)
+	$(call cmd_link_o_target, $(OBJS))
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/arch/c6x/cpu/c674x/cache.c b/arch/c6x/cpu/c674x/cache.c
new file mode 100644
index 0000000..e2d6866
--- /dev/null
+++ b/arch/c6x/cpu/c674x/cache.c
@@ -0,0 +1,17 @@ 
+/* (C) Copyright 2012  Dmitry Bondar <bond@inmys.ru>
+ *
+ * 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.
+*/
+
+void flush_cache(unsigned long addr, unsigned long len)
+{
+}
+
+void flush_dcache_range(unsigned long start, unsigned long stop)
+{
+}
+
+void invalidate_dcache_range(unsigned long start, unsigned long stop)
+{
+}
diff --git a/arch/c6x/cpu/c674x/config.mk b/arch/c6x/cpu/c674x/config.mk
new file mode 100644
index 0000000..8ee1325
--- /dev/null
+++ b/arch/c6x/cpu/c674x/config.mk
@@ -0,0 +1,14 @@ 
+# (C) Copyright 2012  Dmitry Bondar <bond@inmys.ru>
+#
+# 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.
+
+PLATFORM_RELFLAGS += -fno-common -ffixed-B31
+
+PLATFORM_CPPFLAGS += -march=c674x -msdata=none -mno-dsbt -DCONFIG_TMS320C64XPLUS
+# =========================================================================
+#
+# Supply options according to compiler version
+#
+# =========================================================================
+PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
diff --git a/arch/c6x/cpu/c674x/start.S b/arch/c6x/cpu/c674x/start.S
new file mode 100644
index 0000000..c144978
--- /dev/null
+++ b/arch/c6x/cpu/c674x/start.S
@@ -0,0 +1,22 @@ 
+; (C) Copyright 2012  Dmitry Bondar <bond@inmys.ru>
+;
+; 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 <config.h>
+#include <asm-offsets.h>
+
+        .global _start
+_start:
+	;; Jump to u-boot
+	MVKL    .S2     CONFIG_SYS_INIT_SP_ADDR,B15
+	MVKH    .S2     CONFIG_SYS_INIT_SP_ADDR,B15
+	MVKL    .S1     board_init_f,A0
+	MVKH    .S1     board_init_f,A0
+	B       .S2X    A0
+	MVKL    .S2     L1,B3
+	MVKH    .S2     L1,B3
+	NOP     3
+L1:	B       .S2     B3
+	NOP     5
+
diff --git a/arch/c6x/cpu/u-boot.lds b/arch/c6x/cpu/u-boot.lds
new file mode 100644
index 0000000..a6d7c82
--- /dev/null
+++ b/arch/c6x/cpu/u-boot.lds
@@ -0,0 +1,76 @@ 
+/*
+ * (C) Copyright 2002-2004
+ * Gary Jennejohn, DENX Software Engineering, <gj@denx.de>
+ *
+ * (C) Copyright 2012  Dmitry Bondar <bond@inmys.ru>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+/*OUTPUT_FORMAT("elf32-littlec6x", "elf32-littlec6x", "elf32-littlec6x")*/
+/*OUTPUT_ARCH(c6x)*/
+ENTRY(_start)
+SECTIONS
+{
+	. = ALIGN(4);
+	.text :
+	{
+		CPUDIR/start.o	(.text)
+		*(.text)
+	}
+
+	. = ALIGN(4);
+	.rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) }
+
+	. = ALIGN(4);
+	.data : {
+		*(.data)
+	}
+	. = ALIGN(4);
+	.fardata : {
+		*(.data)
+	}
+	. = ALIGN(4);
+	.const : {
+		*(.const)
+	}
+
+	. = ALIGN(4);
+
+	. = .;
+	__u_boot_cmd_start = .;
+	.u_boot_cmd : { *(.u_boot_cmd) }
+	__u_boot_cmd_end = .;
+
+	. = ALIGN(4);
+
+	_end = .;
+
+	__bss_start = .;
+	. = ALIGN(32);
+	.far : { *(.far) }
+	. = ALIGN(32);
+	__bss_end__ = .;
+
+	/DISCARD/ : { *(.dynstr*) }
+	/DISCARD/ : { *(.dynamic*) }
+	/DISCARD/ : { *(.plt*) }
+	/DISCARD/ : { *(.interp*) }
+	/DISCARD/ : { *(.gnu*) }
+}