* [U-Boot] [PATCH 3/4] c6x: Add suport build davinci SOC with c674x CPUs
[not found] ` <1340394370-1550-4-git-send-email-bond@inmys.ru>
@ 2012-06-22 21:57 ` Tom Rini
0 siblings, 0 replies; 31+ messages in thread
From: Tom Rini @ 2012-06-22 21:57 UTC (permalink / raw)
To: u-boot
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 06/22/2012 12:46 PM, Dmitry Bondar wrote:
> 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.
Please cc me on all of the v2 as this will go in via u-boot-ti, thanks.
[snip]
> 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..201eb6d --- /dev/null +++
> b/arch/arm/cpu/arm926ejs/davinci/reset_c.c @@ -0,0 +1,33 @@
> +#include <stdint.h> +#include <asm/arch/hardware.h> + +void
> reset_cpu(unsigned long a) +{ + volatile uint32_t *WDT_TGCR; +
> volatile uint32_t *WDT_TIM12; + volatile uint32_t *WDT_TIM34; +
> volatile uint32_t *WDT_PRD12; + volatile uint32_t *WDT_PRD34; +
> volatile uint32_t *WDT_TCR; + volatile uint32_t *WDT_WDTCR; +
> WDT_TGCR = (volatile uint32_t *)(DAVINCI_TIMER1_BASE + 0x24); +
> WDT_TIM12 = (volatile uint32_t *)(DAVINCI_TIMER1_BASE + 0x10); +
> WDT_TIM34 = (volatile uint32_t *)(DAVINCI_TIMER1_BASE + 0x14); +
> WDT_PRD12 = (volatile uint32_t *)(DAVINCI_TIMER1_BASE + 0x18); +
> WDT_PRD34 = (volatile uint32_t *)(DAVINCI_TIMER1_BASE + 0x1c); +
> WDT_TCR = (volatile uint32_t *)(DAVINCI_TIMER1_BASE + 0x20); +
> WDT_WDTCR = (volatile uint32_t *)(DAVINCI_TIMER1_BASE + 0x28); + +
> *WDT_TGCR = 0x08; + *WDT_TGCR |= 0x3; + *WDT_TIM12 = 0; +
> *WDT_TIM34 = 0; + *WDT_PRD12 = 0; + *WDT_PRD34 = 0; + *WDT_TCR |=
> 0x40; + *WDT_WDTCR |= 0x4000; + *WDT_WDTCR = 0xa5c64000; +
> *WDT_WDTCR = 0xda7e4000; + *WDT_WDTCR = 0x4000; + /*while(1);*/ +}
This should be readl/writel and then if possible, just re-used on
davinci as well (which would need to be tested).
- --
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iQIcBAEBAgAGBQJP5OpfAAoJENk4IS6UOR1WiykP/jIXgJhE+BUXapXdDX2HI5eW
JbLNBX5HA/QKSZ2tQJeFlAgzKxPLWHrVkFXKLG3ArioDF2BVWrEYoa0HAh8q1OrG
366BSDNglkpEAYvWxioBXpY7YO8eULgyw1OHFUQohTmUZHIhBjZeSPrOuDulgAEt
u12gYAe58U1zj5z4S2Iguru91u1ltOLQfCP3u0If0X7I9eUJrPQLZKTD6wXK8bG/
LVfkkLnQNl+uNUo7yJH0i9OVENiOmOr3fSZXxo6ofSmCsS69O2geVSU2t6FsRaJf
3H1P3ZqpFOSRwEJ9r1vmpKCsf0bjK8/AZJDYP+F1SOq26trk+7843jnXpRRk4rw7
O5AlwDxhR41XRHtBXRqIdSIAUMGMB9vCWzJCAR6tKra4CZecbgxNYasgCENeXjiM
ewKzHVP8okrEHlG6eoV2wKehJ65ox6Tt4Gtjt+u1KimvwkReklrX8QiyNYgKYGgc
GrJ/BnP5CgC+vk2RZF5UZ9inYMpdYgHyr9YTAhsPzRJf403r/dfjQLXEESGjjbIE
vNjQpmAfZk+ZrvwzisAqKdJIWfyBl8tzLINRfFdXT7PY4WOUBTOXDH0ShDzlPSOq
3JhjUOHi2p6q13oqnWeQVhiCUk/1uSs66dfqmNzjRwWlk9q6q02i+HnYWGmmQU/V
LVA0pTJDtN/WmmYWHnE2
=/ozC
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 31+ messages in thread
* [U-Boot] [PATCH v2 0/4] Add support new arch: c6x
[not found] <add_c6x_arch>
[not found] ` <1340394370-1550-4-git-send-email-bond@inmys.ru>
@ 2012-06-23 11:11 ` Dmitry Bondar
2012-06-23 12:33 ` Wolfgang Denk
2012-06-23 11:11 ` [U-Boot] [PATCH v2 1/4] " Dmitry Bondar
` (8 subsequent siblings)
10 siblings, 1 reply; 31+ messages in thread
From: Dmitry Bondar @ 2012-06-23 11:11 UTC (permalink / raw)
To: u-boot
C6X (C6000) is family of fixed and floating-point DSPs manufactured by Texas Instruments.
Signed-off-by: Dmitry Bondar <bond@inmys.ru>
Cc: Tom Rini <trini@ti.com>
---
Changes for v2:
- davinci SOC reset_c.c rewritten with readl/writel.
- Tom Rini <trini@ti.com> added to cc
Dmitry Bondar (4):
Add support new arch: c6x
c6x: Add support c674x CPUs
c6x: Add suport build davinci SOC with c674x CPUs
c6x: Add support c6745-som board
MAINTAINERS | 3 +
Makefile | 1 +
arch/arm/cpu/arm926ejs/davinci/Makefile | 5 +
arch/arm/cpu/arm926ejs/davinci/reset_c.c | 31 +++
arch/c6x/config.mk | 1 +
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 ++++++
arch/c6x/include/asm/bitops.h | 88 +++++++
arch/c6x/include/asm/byteorder.h | 1 +
arch/c6x/include/asm/cache.h | 29 ++
arch/c6x/include/asm/config.h | 3 +
arch/c6x/include/asm/errno.h | 1 +
arch/c6x/include/asm/global_data.h | 88 +++++++
arch/c6x/include/asm/gpio.h | 2 +
arch/c6x/include/asm/io.h | 53 ++++
arch/c6x/include/asm/posix_types.h | 72 ++++++
arch/c6x/include/asm/processor.h | 4 +
arch/c6x/include/asm/ptrace.h | 302 ++++++++++++++++++++++
arch/c6x/include/asm/sizes.h | 51 ++++
arch/c6x/include/asm/string.h | 26 ++
arch/c6x/include/asm/types.h | 53 ++++
arch/c6x/include/asm/u-boot.h | 57 ++++
arch/c6x/include/asm/unaligned.h | 1 +
arch/c6x/lib/Makefile | 51 ++++
arch/c6x/lib/board.c | 201 +++++++++++++++
arch/c6x/lib/bootm.c | 59 +++++
arch/c6x/lib/csum_64plus.S | 408 ++++++++++++++++++++++++++++++
arch/c6x/lib/delay.S | 39 +++
arch/c6x/lib/divi.S | 54 ++++
arch/c6x/lib/divremi.S | 61 +++++
arch/c6x/lib/divremu.S | 86 +++++++
arch/c6x/lib/divu.S | 100 ++++++++
arch/c6x/lib/divull.c | 336 ++++++++++++++++++++++++
arch/c6x/lib/llshl.S | 36 +++
arch/c6x/lib/llshr.S | 36 +++
arch/c6x/lib/llshru.S | 36 +++
arch/c6x/lib/memcmp.c | 24 ++
arch/c6x/lib/memcpy_64plus.S | 45 ++++
arch/c6x/lib/memmove.c | 30 +++
arch/c6x/lib/memset.c | 20 ++
arch/c6x/lib/mpyll.S | 47 ++++
arch/c6x/lib/negll.S | 29 ++
arch/c6x/lib/pop_rts.S | 30 +++
arch/c6x/lib/push_rts.S | 28 ++
arch/c6x/lib/remi.S | 78 ++++++
arch/c6x/lib/remu.S | 81 ++++++
arch/c6x/lib/strasgi.S | 88 +++++++
arch/c6x/lib/strasgi_64plus.S | 37 +++
arch/c6x/lib/unaligned.S | 117 +++++++++
board/inmys/c6745-som/Makefile | 27 ++
board/inmys/c6745-som/c6745-som.c | 247 ++++++++++++++++++
boards.cfg | 1 +
common/cmd_bdinfo.c | 5 +
common/image.c | 4 +
examples/standalone/stubs.c | 15 +
include/configs/c6745-som-inmys.h | 294 +++++++++++++++++++++
mkconfig | 7 +-
60 files changed, 3787 insertions(+), 1 deletions(-)
create mode 100644 arch/arm/cpu/arm926ejs/davinci/reset_c.c
create mode 100644 arch/c6x/config.mk
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
create mode 100644 arch/c6x/include/asm/bitops.h
create mode 100644 arch/c6x/include/asm/byteorder.h
create mode 100644 arch/c6x/include/asm/cache.h
create mode 100644 arch/c6x/include/asm/config.h
create mode 100644 arch/c6x/include/asm/errno.h
create mode 100644 arch/c6x/include/asm/global_data.h
create mode 100644 arch/c6x/include/asm/gpio.h
create mode 100644 arch/c6x/include/asm/io.h
create mode 100644 arch/c6x/include/asm/posix_types.h
create mode 100644 arch/c6x/include/asm/processor.h
create mode 100644 arch/c6x/include/asm/ptrace.h
create mode 100644 arch/c6x/include/asm/sizes.h
create mode 100644 arch/c6x/include/asm/string.h
create mode 100644 arch/c6x/include/asm/types.h
create mode 100644 arch/c6x/include/asm/u-boot.h
create mode 100644 arch/c6x/include/asm/unaligned.h
create mode 100644 arch/c6x/lib/Makefile
create mode 100644 arch/c6x/lib/board.c
create mode 100644 arch/c6x/lib/bootm.c
create mode 100644 arch/c6x/lib/csum_64plus.S
create mode 100644 arch/c6x/lib/delay.S
create mode 100644 arch/c6x/lib/divi.S
create mode 100644 arch/c6x/lib/divremi.S
create mode 100644 arch/c6x/lib/divremu.S
create mode 100644 arch/c6x/lib/divu.S
create mode 100644 arch/c6x/lib/divull.c
create mode 100644 arch/c6x/lib/llshl.S
create mode 100644 arch/c6x/lib/llshr.S
create mode 100644 arch/c6x/lib/llshru.S
create mode 100644 arch/c6x/lib/memcmp.c
create mode 100644 arch/c6x/lib/memcpy_64plus.S
create mode 100644 arch/c6x/lib/memmove.c
create mode 100644 arch/c6x/lib/memset.c
create mode 100644 arch/c6x/lib/mpyll.S
create mode 100644 arch/c6x/lib/negll.S
create mode 100644 arch/c6x/lib/pop_rts.S
create mode 100644 arch/c6x/lib/push_rts.S
create mode 100644 arch/c6x/lib/remi.S
create mode 100644 arch/c6x/lib/remu.S
create mode 100644 arch/c6x/lib/strasgi.S
create mode 100644 arch/c6x/lib/strasgi_64plus.S
create mode 100644 arch/c6x/lib/unaligned.S
create mode 100644 board/inmys/c6745-som/Makefile
create mode 100644 board/inmys/c6745-som/c6745-som.c
create mode 100644 include/configs/c6745-som-inmys.h
--
1.7.2.5
^ permalink raw reply [flat|nested] 31+ messages in thread
* [U-Boot] [PATCH v2 1/4] Add support new arch: c6x
[not found] <add_c6x_arch>
[not found] ` <1340394370-1550-4-git-send-email-bond@inmys.ru>
2012-06-23 11:11 ` [U-Boot] [PATCH v2 0/4] Add support new arch: c6x Dmitry Bondar
@ 2012-06-23 11:11 ` Dmitry Bondar
2012-06-23 11:11 ` [U-Boot] [PATCH v2 2/4] c6x: Add support c674x CPUs Dmitry Bondar
` (7 subsequent siblings)
10 siblings, 0 replies; 31+ messages in thread
From: Dmitry Bondar @ 2012-06-23 11:11 UTC (permalink / raw)
To: u-boot
C6X (C6000) is Texas Instruments architecture of fixed and floating-point DSPs.
This patch add basic support.
Many of code in arch/c6x/include/asm come from c6x-linux project (http://linux-c6x.org)
Signed-off-by: Dmitry Bondar <bond@inmys.ru>
Cc: Tom Rini <trini@ti.com>
---
arch/c6x/config.mk | 1 +
arch/c6x/include/asm/bitops.h | 88 ++++++++
arch/c6x/include/asm/byteorder.h | 1 +
arch/c6x/include/asm/cache.h | 29 +++
arch/c6x/include/asm/config.h | 3 +
arch/c6x/include/asm/errno.h | 1 +
arch/c6x/include/asm/global_data.h | 88 ++++++++
arch/c6x/include/asm/gpio.h | 2 +
arch/c6x/include/asm/io.h | 53 +++++
arch/c6x/include/asm/posix_types.h | 72 +++++++
arch/c6x/include/asm/processor.h | 4 +
arch/c6x/include/asm/ptrace.h | 302 ++++++++++++++++++++++++++
arch/c6x/include/asm/sizes.h | 51 +++++
arch/c6x/include/asm/string.h | 26 +++
arch/c6x/include/asm/types.h | 53 +++++
arch/c6x/include/asm/u-boot.h | 57 +++++
arch/c6x/include/asm/unaligned.h | 1 +
arch/c6x/lib/Makefile | 51 +++++
arch/c6x/lib/board.c | 201 ++++++++++++++++++
arch/c6x/lib/bootm.c | 59 +++++
arch/c6x/lib/csum_64plus.S | 408 ++++++++++++++++++++++++++++++++++++
arch/c6x/lib/delay.S | 39 ++++
arch/c6x/lib/divi.S | 54 +++++
arch/c6x/lib/divremi.S | 61 ++++++
arch/c6x/lib/divremu.S | 86 ++++++++
arch/c6x/lib/divu.S | 100 +++++++++
arch/c6x/lib/divull.c | 336 +++++++++++++++++++++++++++++
arch/c6x/lib/llshl.S | 36 ++++
arch/c6x/lib/llshr.S | 36 ++++
arch/c6x/lib/llshru.S | 36 ++++
arch/c6x/lib/memcmp.c | 24 ++
arch/c6x/lib/memcpy_64plus.S | 45 ++++
arch/c6x/lib/memmove.c | 30 +++
arch/c6x/lib/memset.c | 20 ++
arch/c6x/lib/mpyll.S | 47 ++++
arch/c6x/lib/negll.S | 29 +++
arch/c6x/lib/pop_rts.S | 30 +++
arch/c6x/lib/push_rts.S | 28 +++
arch/c6x/lib/remi.S | 78 +++++++
arch/c6x/lib/remu.S | 81 +++++++
arch/c6x/lib/strasgi.S | 88 ++++++++
arch/c6x/lib/strasgi_64plus.S | 37 ++++
arch/c6x/lib/unaligned.S | 117 ++++++++++
common/cmd_bdinfo.c | 5 +
common/image.c | 4 +
examples/standalone/stubs.c | 15 ++
46 files changed, 3013 insertions(+), 0 deletions(-)
create mode 100644 arch/c6x/config.mk
create mode 100644 arch/c6x/include/asm/bitops.h
create mode 100644 arch/c6x/include/asm/byteorder.h
create mode 100644 arch/c6x/include/asm/cache.h
create mode 100644 arch/c6x/include/asm/config.h
create mode 100644 arch/c6x/include/asm/errno.h
create mode 100644 arch/c6x/include/asm/global_data.h
create mode 100644 arch/c6x/include/asm/gpio.h
create mode 100644 arch/c6x/include/asm/io.h
create mode 100644 arch/c6x/include/asm/posix_types.h
create mode 100644 arch/c6x/include/asm/processor.h
create mode 100644 arch/c6x/include/asm/ptrace.h
create mode 100644 arch/c6x/include/asm/sizes.h
create mode 100644 arch/c6x/include/asm/string.h
create mode 100644 arch/c6x/include/asm/types.h
create mode 100644 arch/c6x/include/asm/u-boot.h
create mode 100644 arch/c6x/include/asm/unaligned.h
create mode 100644 arch/c6x/lib/Makefile
create mode 100644 arch/c6x/lib/board.c
create mode 100644 arch/c6x/lib/bootm.c
create mode 100644 arch/c6x/lib/csum_64plus.S
create mode 100644 arch/c6x/lib/delay.S
create mode 100644 arch/c6x/lib/divi.S
create mode 100644 arch/c6x/lib/divremi.S
create mode 100644 arch/c6x/lib/divremu.S
create mode 100644 arch/c6x/lib/divu.S
create mode 100644 arch/c6x/lib/divull.c
create mode 100644 arch/c6x/lib/llshl.S
create mode 100644 arch/c6x/lib/llshr.S
create mode 100644 arch/c6x/lib/llshru.S
create mode 100644 arch/c6x/lib/memcmp.c
create mode 100644 arch/c6x/lib/memcpy_64plus.S
create mode 100644 arch/c6x/lib/memmove.c
create mode 100644 arch/c6x/lib/memset.c
create mode 100644 arch/c6x/lib/mpyll.S
create mode 100644 arch/c6x/lib/negll.S
create mode 100644 arch/c6x/lib/pop_rts.S
create mode 100644 arch/c6x/lib/push_rts.S
create mode 100644 arch/c6x/lib/remi.S
create mode 100644 arch/c6x/lib/remu.S
create mode 100644 arch/c6x/lib/strasgi.S
create mode 100644 arch/c6x/lib/strasgi_64plus.S
create mode 100644 arch/c6x/lib/unaligned.S
diff --git a/arch/c6x/config.mk b/arch/c6x/config.mk
new file mode 100644
index 0000000..9cbddbc
--- /dev/null
+++ b/arch/c6x/config.mk
@@ -0,0 +1 @@
+CROSS_COMPILE ?= c6x-uclinux-
diff --git a/arch/c6x/include/asm/bitops.h b/arch/c6x/include/asm/bitops.h
new file mode 100644
index 0000000..5896b5e
--- /dev/null
+++ b/arch/c6x/include/asm/bitops.h
@@ -0,0 +1,88 @@
+/*
+ * linux/include/asm-c6x/bitops.h
+ *
+ * Port on Texas Instruments TMS320C6x architecture
+ *
+ * Copyright (C) 2004, 2009, 2010 Texas Instruments Incorporated
+ * Author: Aurelien Jacquiot (aurelien.jacquiot at jaluna.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#ifndef __ASM_C6X_BITOPS_H_
+#define __ASM_C6X_BITOPS_H_
+
+#ifdef __KERNEL__
+
+#include <linux/bitops.h>
+#include <asm/byteorder.h>
+
+/*
+ * We are lucky, DSP is perfect for bitops: do it in 3 cycles
+ */
+
+/**
+ * __ffs - find first bit in word.
+ * @word: The word to search
+ *
+ * Undefined if no bit exists, so code should check against 0 first.
+ * Note __ffs(0) = undef, __ffs(1) = 0, __ffs(0x80000000) = 31.
+ *
+ */
+static inline unsigned long __ffs(unsigned long x)
+{
+ asm (" bitr .M1 %0,%0\n"
+ " nop\n"
+ " lmbd .L1 1,%0,%0\n"
+ : "+a"(x));
+
+ return x;
+}
+
+/*
+ * ffz - find first zero in word.
+ * @word: The word to search
+ *
+ * Undefined if no zero exists, so code should check against ~0UL first.
+ */
+#define ffz(x) __ffs(~(x))
+
+/**
+ * fls - find last (most-significant) bit set
+ * @x: the word to search
+ *
+ * This is defined the same way as ffs.
+ * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32.
+ */
+static inline unsigned long fls(unsigned long x)
+{
+ if (!x)
+ return 0;
+
+ asm (" lmbd .L1 1,%0,%0\n" : "+a"(x));
+
+ return 32 - x;
+}
+
+/**
+ * ffs - find first bit set
+ * @x: the word to search
+ *
+ * This is defined the same way as
+ * the libc and compiler builtin ffs routines, therefore
+ * differs in spirit from the above ffz (man ffs).
+ * Note ffs(0) = 0, ffs(1) = 1, ffs(0x80000000) = 32.
+ */
+static inline int ffs(int x)
+{
+ if (!x)
+ return 0;
+
+ return __ffs(x) + 1;
+}
+
+#define hweight8(x) generic_hweight8(x)
+
+#endif /* __KERNEL__ */
+#endif /* __ASM_C6X_BITOPS_H */
diff --git a/arch/c6x/include/asm/byteorder.h b/arch/c6x/include/asm/byteorder.h
new file mode 100644
index 0000000..9558416
--- /dev/null
+++ b/arch/c6x/include/asm/byteorder.h
@@ -0,0 +1 @@
+#include <linux/byteorder/little_endian.h>
diff --git a/arch/c6x/include/asm/cache.h b/arch/c6x/include/asm/cache.h
new file mode 100644
index 0000000..75b2043
--- /dev/null
+++ b/arch/c6x/include/asm/cache.h
@@ -0,0 +1,29 @@
+/*
+ * (C) Copyright 2011, Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
+ *
+ * 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
+ */
+
+#ifndef __ASM_C6X_CACHE_H_
+#define __ASM_C6X_CACHE_H_
+
+#ifdef CONFIG_SYS_CACHELINE_SIZE
+#define ARCH_DMA_MINALIGN CONFIG_SYS_CACHELINE_SIZE
+#else
+#define ARCH_DMA_MINALIGN 128
+#endif
+
+#endif /* __ASM_C6X_CACHE_H_ */
diff --git a/arch/c6x/include/asm/config.h b/arch/c6x/include/asm/config.h
new file mode 100644
index 0000000..db59e8a
--- /dev/null
+++ b/arch/c6x/include/asm/config.h
@@ -0,0 +1,3 @@
+#ifndef _ASM_CONFIG_H_
+#define _ASM_CONFIG_H_
+#endif
diff --git a/arch/c6x/include/asm/errno.h b/arch/c6x/include/asm/errno.h
new file mode 100644
index 0000000..4c82b50
--- /dev/null
+++ b/arch/c6x/include/asm/errno.h
@@ -0,0 +1 @@
+#include <asm-generic/errno.h>
diff --git a/arch/c6x/include/asm/global_data.h b/arch/c6x/include/asm/global_data.h
new file mode 100644
index 0000000..1ffd781
--- /dev/null
+++ b/arch/c6x/include/asm/global_data.h
@@ -0,0 +1,88 @@
+/*
+ * (C) Copyright 2002-2010
+ * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+ *
+ * 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
+ */
+
+#ifndef __ASM_GBL_DATA_H
+#define __ASM_GBL_DATA_H
+/*
+ * The following data structure is placed in some memory which is
+ * available very early after boot (like DPRAM on MPC8xx/MPC82xx, or
+ * some locked parts of the data cache) to allow for a minimum set of
+ * global variables during system initialization (until we have set
+ * up the memory controller so that we can use RAM).
+ *
+ * Keep it *SMALL* and remember to set GENERATED_GBL_DATA_SIZE > sizeof(gd_t)
+ */
+
+typedef struct global_data {
+ bd_t *bd;
+ unsigned long flags;
+ unsigned long baudrate;
+ unsigned long have_console; /* serial_init() was called */
+#ifdef CONFIG_PRE_CONSOLE_BUFFER
+ unsigned long precon_buf_idx; /* Pre-Console buffer index */
+#endif
+ unsigned long env_addr; /* Address of Environment struct */
+ unsigned long env_valid; /* Checksum of Environment valid? */
+ unsigned long fb_base; /* base address of frame buffer */
+
+ /* "static data" needed by most of timer.c (like on ARM platform) */
+ unsigned long timer_rate_hz;
+ unsigned long tbl;
+ unsigned long tbu;
+ unsigned long long timer_reset_value;
+ unsigned long lastinc;
+
+ phys_size_t ram_size; /* RAM size */
+#if 0
+ unsigned long relocaddr; /* Start address of U-Boot in RAM */
+ phys_size_t ram_size; /* RAM size */
+ unsigned long mon_len; /* monitor len */
+ unsigned long irq_sp; /* irq stack pointer */
+ unsigned long start_addr_sp; /* start_addr_stackpointer */
+ unsigned long reloc_off;
+#endif
+
+ void **jt; /* jump table */
+ char env_buf[32]; /* buffer for getenv() before reloc. */
+#if defined(CONFIG_POST) || defined(CONFIG_LOGBUFFER)
+ unsigned long post_log_word; /* Record POST activities */
+ unsigned long post_log_res; /* success of POST test */
+ unsigned long post_init_f_time; /* When post_init_f started */
+#endif
+} gd_t;
+
+/*
+ * Global Data Flags
+ */
+#define GD_FLG_RELOC 0x00001 /* Code was relocated to RAM */
+#define GD_FLG_DEVINIT 0x00002 /* Devices have been initialized */
+#define GD_FLG_SILENT 0x00004 /* Silent mode */
+#define GD_FLG_POSTFAIL 0x00008 /* Critical POST test failed */
+#define GD_FLG_POSTSTOP 0x00010 /* POST seqeunce aborted */
+#define GD_FLG_LOGINIT 0x00020 /* Log Buffer has been initialized */
+#define GD_FLG_DISABLE_CONSOLE 0x00040 /* Disable console (in & out) */
+#define GD_FLG_ENV_READY 0x00080 /* Environment imported into hash table */
+
+#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("B31")
+
+#endif /* __ASM_GBL_DATA_H */
diff --git a/arch/c6x/include/asm/gpio.h b/arch/c6x/include/asm/gpio.h
new file mode 100644
index 0000000..d49ad08
--- /dev/null
+++ b/arch/c6x/include/asm/gpio.h
@@ -0,0 +1,2 @@
+#include <asm/arch/gpio.h>
+#include <asm-generic/gpio.h>
diff --git a/arch/c6x/include/asm/io.h b/arch/c6x/include/asm/io.h
new file mode 100644
index 0000000..9afde27
--- /dev/null
+++ b/arch/c6x/include/asm/io.h
@@ -0,0 +1,53 @@
+/*
+ * linux/include/asm-c6x/io.h
+ *
+ * Port on Texas Instruments TMS320C6x architecture
+ *
+ * Copyright (C) 2004, 2009, 2010, 2011 Texas Instruments Incorporated
+ * Author: Aurelien Jacquiot (aurelien.jacquiot at jaluna.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+static inline unsigned char __readb(volatile unsigned char *addr) { return (*addr); }
+static inline unsigned short __readw(volatile unsigned short *addr) { return (*addr); }
+static inline unsigned long __readl(volatile unsigned int *addr) { return (*addr); }
+
+#define readb(addr) __readb((volatile unsigned char *) (addr))
+#define readw(addr) __readw((volatile unsigned short *) (addr))
+#define readl(addr) __readl((volatile unsigned int *) (addr))
+
+#define writeb(b,addr) ((*(volatile unsigned char *) (addr)) = (b))
+#define writew(b,addr) ((*(volatile unsigned short *) (addr)) = (b))
+#define writel(b,addr) ((*(volatile unsigned int *) (addr)) = (b))
+
+#define __raw_readb readb
+#define __raw_readw readw
+#define __raw_readl readl
+#define __raw_writeb writeb
+#define __raw_writew writew
+#define __raw_writel writel
+
+
+#define in_le16(addr) \
+ ({ unsigned short __v = le16_to_cpu(*(volatile unsigned short *) (addr)); __v; })
+#define in_le32(addr) \
+ ({ unsigned int __v = le32_to_cpu(*(volatile unsigned int *) (addr)); __v; })
+#define out_le16(addr,w) (void)((*(volatile unsigned short *) (addr)) = cpu_to_le16(w))
+#define out_le32(addr,l) (void)((*(volatile unsigned int *) (addr)) = cpu_to_le32(l))
+
+#define clrbits(type, addr, clear) \
+ out_##type((addr), in_##type(addr) & ~(clear))
+
+#define setbits(type, addr, set) \
+ out_##type((addr), in_##type(addr) | (set))
+
+#define clrsetbits(type, addr, clear, set) \
+ out_##type((addr), (in_##type(addr) & ~(clear)) | (set))
+
+#define clrbits_le32(addr, clear) clrbits(le32, addr, clear)
+#define setbits_le32(addr, set) setbits(le32, addr, set)
+#define clrsetbits_le32(addr, clear, set) clrsetbits(le32, addr, clear, set)
+
diff --git a/arch/c6x/include/asm/posix_types.h b/arch/c6x/include/asm/posix_types.h
new file mode 100644
index 0000000..d1fffe0
--- /dev/null
+++ b/arch/c6x/include/asm/posix_types.h
@@ -0,0 +1,72 @@
+/*
+ * Based on microblaze implementation:
+ * Copyright (C) 2003 John Williams <jwilliams@itee.uq.edu.au>
+ * Copyright (C) 2001,2002 NEC Corporation
+ * Copyright (C) 2001,2002 Miles Bader <miles@gnu.org>
+ *
+ * This file is subject to the terms and conditions of the GNU General
+ * Public License. See the file COPYING in the main directory of this
+ * archive for more details.
+ *
+ * Written by Miles Bader <miles@gnu.org>
+ * Microblaze port by John Williams
+ */
+
+#ifndef __ASM_OPENRISC_POSIX_TYPES_H
+#define __ASM_OPENRISC_POSIX_TYPES_H
+
+typedef unsigned int __kernel_dev_t;
+typedef unsigned long __kernel_ino_t;
+typedef unsigned long long __kernel_ino64_t;
+typedef unsigned int __kernel_mode_t;
+typedef unsigned int __kernel_nlink_t;
+typedef long __kernel_off_t;
+typedef long long __kernel_loff_t;
+typedef int __kernel_pid_t;
+typedef unsigned short __kernel_ipc_pid_t;
+typedef unsigned int __kernel_uid_t;
+typedef unsigned int __kernel_gid_t;
+typedef unsigned int __kernel_size_t;
+typedef int __kernel_ssize_t;
+typedef int __kernel_ptrdiff_t;
+typedef long __kernel_time_t;
+typedef long __kernel_suseconds_t;
+typedef long __kernel_clock_t;
+typedef int __kernel_daddr_t;
+typedef char *__kernel_caddr_t;
+typedef unsigned short __kernel_uid16_t;
+typedef unsigned short __kernel_gid16_t;
+typedef unsigned int __kernel_uid32_t;
+typedef unsigned int __kernel_gid32_t;
+
+typedef unsigned short __kernel_old_uid_t;
+typedef unsigned short __kernel_old_gid_t;
+
+
+typedef struct {
+#if defined(__KERNEL__) || defined(__USE_ALL)
+ int val[2];
+#else /* !defined(__KERNEL__) && !defined(__USE_ALL) */
+ int __val[2];
+#endif /* !defined(__KERNEL__) && !defined(__USE_ALL) */
+} __kernel_fsid_t;
+
+
+#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
+
+#undef __FD_SET
+#define __FD_SET(fd, fd_set) \
+ __set_bit(fd, (void *)&((__kernel_fd_set *)fd_set)->fds_bits)
+#undef __FD_CLR
+#define __FD_CLR(fd, fd_set) \
+ __clear_bit(fd, (void *)&((__kernel_fd_set *)fd_set)->fds_bits)
+#undef __FD_ISSET
+#define __FD_ISSET(fd, fd_set) \
+ __test_bit(fd, (void *)&((__kernel_fd_set *)fd_set)->fds_bits)
+#undef __FD_ZERO
+#define __FD_ZERO(fd_set) \
+ memset(fd_set, 0, sizeof(*(fd_set *)fd_set))
+
+#endif /* defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) */
+
+#endif /* __ASM_OPENRISC_POSIX_TYPES_H */
diff --git a/arch/c6x/include/asm/processor.h b/arch/c6x/include/asm/processor.h
new file mode 100644
index 0000000..ec98171
--- /dev/null
+++ b/arch/c6x/include/asm/processor.h
@@ -0,0 +1,4 @@
+#ifndef __ASM_C6X_PROCESSOR_H
+#define __ASM_C6X_PROCESSOR_H
+
+#endif
diff --git a/arch/c6x/include/asm/ptrace.h b/arch/c6x/include/asm/ptrace.h
new file mode 100644
index 0000000..5c4665e
--- /dev/null
+++ b/arch/c6x/include/asm/ptrace.h
@@ -0,0 +1,302 @@
+/*
+ * linux/include/asm-c6x/ptrace.h
+ *
+ * Port on Texas Instruments TMS320C6x architecture
+ *
+ * Copyright (C) 2004, 2006, 2009, 2010, 2011 Texas Instruments Incorporated
+ * Author: Aurelien Jacquiot (aurelien.jacquiot at jaluna.com)
+ *
+ * Updated for 2.6.34: Mark Salter <msalter@redhat.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#ifndef __ASM_C6X_PTRACE_H
+#define __ASM_C6X_PTRACE_H
+
+#if defined(__TMS320C6XPLUS__) || defined(_TMS320C6400_PLUS) || defined(__TMS320C66X__)
+#define BKPT_OPCODE 0x56454314 /* illegal opcode */
+#else
+#define BKPT_OPCODE 0x0000a122 /* BNOP .S2 0,5 */
+#endif
+
+#ifdef _BIG_ENDIAN
+#define PT_LO(odd,even) odd
+#define PT_HI(odd,even) even
+#else
+#define PT_LO(odd,even) even
+#define PT_HI(odd,even) odd
+#endif
+
+#if defined(__TMS320C6XPLUS__) || defined(_TMS320C6400_PLUS) || defined(__TMS320C66X__)
+
+#define PT_A4_ORG PT_LO(1,0)
+#define PT_TSR PT_HI(1,0)
+#define PT_ILC PT_LO(3,2)
+#define PT_RILC PT_HI(3,2)
+#define PT_CSR PT_LO(5,4)
+#define PT_PC PT_HI(5,4)
+#define PT_B16 PT_LO(7,6)
+#define PT_B17 PT_HI(7,6)
+#define PT_B18 PT_LO(9,8)
+#define PT_B19 PT_HI(9,8)
+#define PT_B20 PT_LO(11,10)
+#define PT_B21 PT_HI(11,10)
+#define PT_B22 PT_LO(13,12)
+#define PT_B23 PT_HI(13,12)
+#define PT_B24 PT_LO(15,14)
+#define PT_B25 PT_HI(15,14)
+#define PT_B26 PT_LO(17,16)
+#define PT_B27 PT_HI(17,16)
+#define PT_B28 PT_LO(19,18)
+#define PT_B29 PT_HI(19,18)
+#define PT_B30 PT_LO(21,20)
+#define PT_B31 PT_HI(21,20)
+#define PT_B0 PT_LO(23,22)
+#define PT_B1 PT_HI(23,22)
+#define PT_B2 PT_LO(25,24)
+#define PT_B3 PT_HI(25,24)
+#define PT_B4 PT_LO(27,26)
+#define PT_B5 PT_HI(27,26)
+#define PT_B6 PT_LO(29,28)
+#define PT_B7 PT_HI(29,28)
+#define PT_B8 PT_LO(31,30)
+#define PT_B9 PT_HI(31,30)
+#define PT_B10 PT_LO(33,32)
+#define PT_B11 PT_HI(33,32)
+#define PT_B12 PT_LO(35,34)
+#define PT_B13 PT_HI(35,34)
+#define PT_A16 PT_LO(37,36)
+#define PT_A17 PT_HI(37,36)
+#define PT_A18 PT_LO(39,38)
+#define PT_A19 PT_HI(39,38)
+#define PT_A20 PT_LO(41,40)
+#define PT_A21 PT_HI(41,40)
+#define PT_A22 PT_LO(43,42)
+#define PT_A23 PT_HI(43,42)
+#define PT_A24 PT_LO(45,44)
+#define PT_A25 PT_HI(45,44)
+#define PT_A26 PT_LO(47,46)
+#define PT_A27 PT_HI(47,46)
+#define PT_A28 PT_LO(49,48)
+#define PT_A29 PT_HI(49,48)
+#define PT_A30 PT_LO(51,50)
+#define PT_A31 PT_HI(51,50)
+#define PT_A0 PT_LO(53,52)
+#define PT_A1 PT_HI(53,52)
+#define PT_A2 PT_LO(55,54)
+#define PT_A3 PT_HI(55,54)
+#define PT_A4 PT_LO(57,56)
+#define PT_A5 PT_HI(57,56)
+#define PT_A6 PT_LO(59,58)
+#define PT_A7 PT_HI(59,58)
+#define PT_A8 PT_LO(61,60)
+#define PT_A9 PT_HI(61,60)
+#define PT_A10 PT_LO(63,62)
+#define PT_A11 PT_HI(63,62)
+#define PT_A12 PT_LO(65,64)
+#define PT_A13 PT_HI(65,64)
+#define PT_A14 PT_LO(67,66)
+#define PT_A15 PT_HI(67,66)
+#define PT_B14 PT_LO(69,68)
+#define PT_B15 PT_HI(69,68)
+
+#else /* defined(__TMS320C6XPLUS__) */
+
+#define PT_A4_ORG PT_LO(1,0)
+#define PT_STKADJ PT_HI(1,0)
+#define PT_CSR PT_LO(3,2)
+#define PT_PC PT_HI(3,2)
+#if defined(_TMS320C6400)
+#define PT_B16 PT_LO(5,4)
+#define PT_B17 PT_HI(5,4)
+#define PT_B18 PT_LO(7,6)
+#define PT_B19 PT_HI(7,6)
+#define PT_B20 PT_LO(9,8)
+#define PT_B21 PT_HI(9,8)
+#define PT_B22 PT_LO(11,10)
+#define PT_B23 PT_HI(11,10)
+#define PT_B24 PT_LO(13,12)
+#define PT_B25 PT_HI(13,12)
+#define PT_B26 PT_LO(15,14)
+#define PT_B27 PT_HI(15,14)
+#define PT_B28 PT_LO(17,16)
+#define PT_B29 PT_HI(17,16)
+#define PT_B30 PT_LO(19,18)
+#define PT_B31 PT_HI(19,18)
+#endif /* defined(_TMS320C6400) */
+#define PT_B0 PT_LO(21,20)
+#define PT_B1 PT_HI(21,20)
+#define PT_B2 PT_LO(23,22)
+#define PT_B3 PT_HI(23,22)
+#define PT_B4 PT_LO(25,24)
+#define PT_B5 PT_HI(25,24)
+#define PT_B6 PT_LO(27,26)
+#define PT_B7 PT_HI(27,26)
+#define PT_B8 PT_LO(29,28)
+#define PT_B9 PT_HI(29,28)
+#define PT_B10 PT_LO(31,30)
+#define PT_B11 PT_HI(31,30)
+#define PT_B12 PT_LO(33,32)
+#define PT_B13 PT_HI(33,32)
+#if defined(_TMS320C6400)
+#define PT_A16 PT_LO(35,34)
+#define PT_A17 PT_HI(35,34)
+#define PT_A18 PT_LO(37,36)
+#define PT_A19 PT_HI(37,36)
+#define PT_A20 PT_LO(39,38)
+#define PT_A21 PT_HI(39,38)
+#define PT_A22 PT_LO(41,40)
+#define PT_A23 PT_HI(41,40)
+#define PT_A24 PT_LO(43,42)
+#define PT_A25 PT_HI(43,42)
+#define PT_A26 PT_LO(45,44)
+#define PT_A27 PT_HI(45,44)
+#define PT_A28 PT_LO(47,46)
+#define PT_A29 PT_HI(47,46)
+#define PT_A30 PT_LO(49,48)
+#define PT_A31 PT_HI(49,48)
+#endif /* defined(_TMS320C6400) */
+#define PT_A0 PT_LO(51,50)
+#define PT_A1 PT_HI(51,50)
+#define PT_A2 PT_LO(53,52)
+#define PT_A3 PT_HI(53,52)
+#define PT_A4 PT_LO(55,54)
+#define PT_A5 PT_HI(55,54)
+#define PT_A6 PT_LO(57,56)
+#define PT_A7 PT_HI(57,56)
+#define PT_A8 PT_LO(59,58)
+#define PT_A9 PT_HI(59,58)
+#define PT_A10 PT_LO(61,60)
+#define PT_A11 PT_HI(61,60)
+#define PT_A12 PT_LO(63,62)
+#define PT_A13 PT_HI(63,62)
+#define PT_A14 PT_LO(65,64)
+#define PT_A15 PT_HI(65,64)
+#define PT_B14 PT_LO(67,66)
+#define PT_B15 PT_HI(67,66)
+
+#endif /* defined(__TMS320C6XPLUS__) */
+
+#define PT_DP PT_B14 /* Data Segment Pointer (B14) */
+#define PT_SP PT_B15 /* Stack Pointer (B15) */
+
+#ifndef __ASSEMBLY__
+
+#ifdef _BIG_ENDIAN
+#define REG_PAIR(odd,even) unsigned long odd; unsigned long even
+#else
+#define REG_PAIR(odd,even) unsigned long even; unsigned long odd
+#endif
+
+/*
+ * this struct defines the way the registers are stored on the
+ * stack during a system call. fields defined with REG_PAIR
+ * are saved and restored using double-word memory operations
+ * which means the word ordering of the pair depends on endianess.
+ */
+struct pt_regs {
+#if defined(__TMS320C6XPLUS__) || defined(_TMS320C6400_PLUS) || defined(__TMS320C66X__)
+ REG_PAIR(tsr,orig_a4);
+ REG_PAIR(rilc,ilc);
+#else
+ REG_PAIR(stkadj,orig_a4);
+#endif
+ REG_PAIR(pc,csr);
+
+#if defined(_TMS320C6400)
+ REG_PAIR(b17,b16);
+ REG_PAIR(b19,b18);
+ REG_PAIR(b21,b20);
+ REG_PAIR(b23,b22);
+ REG_PAIR(b25,b24);
+ REG_PAIR(b27,b26);
+ REG_PAIR(b29,b28);
+ REG_PAIR(b31,b30);
+#endif /* defined(_TMS320C6400) */
+
+ REG_PAIR(b1,b0);
+ REG_PAIR(b3,b2);
+ REG_PAIR(b5,b4);
+ REG_PAIR(b7,b6);
+ REG_PAIR(b9,b8);
+ REG_PAIR(b11,b10);
+ REG_PAIR(b13,b12);
+
+#if defined(_TMS320C6400)
+ REG_PAIR(a17,a16);
+ REG_PAIR(a19,a18);
+ REG_PAIR(a21,a20);
+ REG_PAIR(a23,a22);
+ REG_PAIR(a25,a24);
+ REG_PAIR(a27,a26);
+ REG_PAIR(a29,a28);
+ REG_PAIR(a31,a30);
+#endif /* defined(_TMS320C6400) */
+
+ REG_PAIR(a1,a0);
+ REG_PAIR(a3,a2);
+ REG_PAIR(a5,a4);
+ REG_PAIR(a7,a6);
+ REG_PAIR(a9,a8);
+ REG_PAIR(a11,a10);
+ REG_PAIR(a13,a12);
+
+ REG_PAIR(a15,a14);
+ REG_PAIR(sp,dp);
+};
+
+/*
+ * This is the extended stack used by the context switcher
+ */
+struct switch_stack {
+#if defined(__TMS320C6XPLUS__) || defined(_TMS320C6400_PLUS) || defined(__TMS320C66X__)
+ REG_PAIR(rilc,ilc);
+#endif
+ REG_PAIR(a11,a10);
+ REG_PAIR(a13,a12);
+ REG_PAIR(a15,a14);
+ REG_PAIR(b11,b10);
+ REG_PAIR(b13,b12);
+
+ unsigned long retpc;
+ unsigned long pad;
+};
+
+/*
+ * These are 'magic' values for PTRACE_PEEKUSR that return info about where a
+ * process is located in memory.
+ */
+#define PT_TEXT_ADDR 0x10000
+#define PT_DATA_ADDR 0x10004
+#define PT_TEXT_END_ADDR 0x10008
+
+/* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */
+#define PTRACE_GETREGS 12
+#define PTRACE_SETREGS 13
+#define PTRACE_GETFPREGS 14
+#define PTRACE_SETFPREGS 15
+
+#define PTRACE_GETDSBT 31 /* get the ELF DSBT loadmap address */
+#define PTRACE_GETDSBT_EXEC 0 /* [addr] request the executable loadmap */
+#define PTRACE_GETDSBT_INTERP 1 /* [addr] request the interpreter loadmap */
+
+#ifdef __KERNEL__
+
+#define DEFAULT_CSR 0x0001 /* interrupt enable by default */
+ /* used in /include/asm/processor.h*/
+
+#if !defined(CONFIG_TMS320C64XPLUS) && !defined(CONFIG_TMS320C66X)
+extern unsigned long current_ksp;
+#define user_mode(regs) (((((regs)->sp) ^ current_ksp) >> PAGE_SHIFT) != 0)
+#else
+#define user_mode(regs) ((((regs)->tsr) & 0x40) != 0)
+#endif
+#define instruction_pointer(regs) ((regs)->pc)
+#define profile_pc(regs) instruction_pointer(regs)
+extern void show_regs(struct pt_regs *);
+
+#endif /* __KERNEL__ */
+#endif /* __ASSEMBLY__ */
+#endif /* __ASM_C6X_PTRACE_H */
diff --git a/arch/c6x/include/asm/sizes.h b/arch/c6x/include/asm/sizes.h
new file mode 100644
index 0000000..b0b4f6a
--- /dev/null
+++ b/arch/c6x/include/asm/sizes.h
@@ -0,0 +1,51 @@
+/*
+ * 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
+ */
+/* Size defintions
+ * Copyright (C) ARM Limited 1998. All rights reserved.
+ */
+
+#ifndef __sizes_h
+#define __sizes_h 1
+
+/* handy sizes */
+#define SZ_1K 0x00000400
+#define SZ_4K 0x00001000
+#define SZ_8K 0x00002000
+#define SZ_16K 0x00004000
+#define SZ_32K 0x00008000
+#define SZ_64K 0x00010000
+#define SZ_128K 0x00020000
+#define SZ_256K 0x00040000
+#define SZ_512K 0x00080000
+
+#define SZ_1M 0x00100000
+#define SZ_2M 0x00200000
+#define SZ_4M 0x00400000
+#define SZ_8M 0x00800000
+#define SZ_16M 0x01000000
+#define SZ_31M 0x01F00000
+#define SZ_32M 0x02000000
+#define SZ_64M 0x04000000
+#define SZ_128M 0x08000000
+#define SZ_256M 0x10000000
+#define SZ_512M 0x20000000
+
+#define SZ_1G 0x40000000
+#define SZ_2G 0x80000000
+
+#endif
+
+/* END */
diff --git a/arch/c6x/include/asm/string.h b/arch/c6x/include/asm/string.h
new file mode 100644
index 0000000..e9fa53a
--- /dev/null
+++ b/arch/c6x/include/asm/string.h
@@ -0,0 +1,26 @@
+/*
+ * linux/include/asm-c6x/string.h
+ *
+ * Port on Texas Instruments TMS320C6x architecture
+ *
+ * Copyright (C) 2004, 2009 Texas Instruments Incorporated
+ * Author: Aurelien Jacquiot (aurelien.jacquiot at jaluna.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#ifndef __ASM_C6X_STRING_H
+#define __ASM_C6X_STRING_H
+
+extern void * memcpy(void *to, const void *from, size_t n);
+extern void * memset(void *s, int c, size_t count);
+extern int memcmp(const void *cs, const void *ct, size_t count);
+extern void *memmove(void *s1, const void *s2, size_t n);
+
+#define __HAVE_ARCH_MEMCPY
+#define __HAVE_ARCH_MEMMOVE
+#define __HAVE_ARCH_MEMSET
+#define __HAVE_ARCH_MEMCMP
+
+#endif /* __ASM_C6X_STRING_H */
diff --git a/arch/c6x/include/asm/types.h b/arch/c6x/include/asm/types.h
new file mode 100644
index 0000000..857c792
--- /dev/null
+++ b/arch/c6x/include/asm/types.h
@@ -0,0 +1,53 @@
+#ifndef __ASM_C6X_TYPES_H
+#define __ASM_C6X_TYPES_H
+
+typedef unsigned short umode_t;
+
+/*
+ * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
+ * header files exported to user space
+ */
+
+typedef __signed__ char __s8;
+typedef unsigned char __u8;
+
+typedef __signed__ short __s16;
+typedef unsigned short __u16;
+
+typedef __signed__ int __s32;
+typedef unsigned int __u32;
+
+#if defined(__GNUC__)
+__extension__ typedef __signed__ long long __s64;
+__extension__ typedef unsigned long long __u64;
+#endif
+
+/*
+ * These aren't exported outside the kernel to avoid name space clashes
+ */
+#ifdef __KERNEL__
+
+typedef signed char s8;
+typedef unsigned char u8;
+
+typedef signed short s16;
+typedef unsigned short u16;
+
+typedef signed int s32;
+typedef unsigned int u32;
+
+typedef signed long long s64;
+typedef unsigned long long u64;
+
+#define BITS_PER_LONG 32
+
+/* Dma addresses are 32-bits wide. */
+
+typedef u32 dma_addr_t;
+
+typedef unsigned long phys_addr_t;
+typedef unsigned long phys_size_t;
+
+#endif /* __KERNEL__ */
+
+#endif
diff --git a/arch/c6x/include/asm/u-boot.h b/arch/c6x/include/asm/u-boot.h
new file mode 100644
index 0000000..759d976
--- /dev/null
+++ b/arch/c6x/include/asm/u-boot.h
@@ -0,0 +1,57 @@
+/*
+ * (C) Copyright 2002
+ * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
+ * Marius Groeger <mgroeger@sysgo.de>
+ *
+ * (C) Copyright 2002
+ * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
+ * Alex Zuepke <azu@sysgo.de>
+ *
+ * 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
+ *
+ ********************************************************************
+ * NOTE: This header file defines an interface to U-Boot. Including
+ * this (unmodified) header file in another file is considered normal
+ * use of U-Boot, and does *not* fall under the heading of "derived
+ * work".
+ ********************************************************************
+ */
+
+#ifndef _U_BOOT_H_
+#define _U_BOOT_H_ 1
+
+typedef struct bd_info {
+ int bi_baudrate; /* serial console baudrate */
+ unsigned long bi_ip_addr; /* IP Address */
+ ulong bi_arch_number; /* unique id for this board */
+ ulong bi_boot_params; /* where this board expects params */
+ unsigned long bi_arm_freq; /* arm frequency */
+ unsigned long bi_dsp_freq; /* dsp core frequency */
+ unsigned long bi_ddr_freq; /* ddr frequency */
+ struct /* RAM configuration */
+ {
+ ulong start;
+ ulong size;
+ } bi_dram[CONFIG_NR_DRAM_BANKS];
+} bd_t;
+
+/* For image.h:image_check_target_arch() */
+#define IH_ARCH_DEFAULT IH_ARCH_ARM
+
+#endif /* _U_BOOT_H_ */
diff --git a/arch/c6x/include/asm/unaligned.h b/arch/c6x/include/asm/unaligned.h
new file mode 100644
index 0000000..6cecbbb
--- /dev/null
+++ b/arch/c6x/include/asm/unaligned.h
@@ -0,0 +1 @@
+#include <asm-generic/unaligned.h>
diff --git a/arch/c6x/lib/Makefile b/arch/c6x/lib/Makefile
new file mode 100644
index 0000000..8214df7
--- /dev/null
+++ b/arch/c6x/lib/Makefile
@@ -0,0 +1,51 @@
+#
+# (C) Copyright 2000-2006
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# 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
+#
+
+include $(TOPDIR)/config.mk
+
+LIB = $(obj)lib$(ARCH).o
+
+SOBJS-y += csum_64plus.o memcpy_64plus.o strasgi_64plus.o
+SOBJS-y += unaligned.o divu.o divi.o pop_rts.o push_rts.o remi.o remu.o \
+ strasgi.o llshru.o llshr.o llshl.o negll.o mpyll.o \
+ divremi.o divremu.o delay.o
+
+COBJS-y += memcmp.o memmove.o memset.o divull.o
+
+COBJS-y += board.o
+COBJS-y += bootm.o
+
+SRCS := $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
+OBJS := $(addprefix $(obj),$(SOBJS-y) $(COBJS-y))
+
+$(LIB): $(obj).depend $(OBJS)
+ $(call cmd_link_o_target, $(OBJS))
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/arch/c6x/lib/board.c b/arch/c6x/lib/board.c
new file mode 100644
index 0000000..5a8ddb5
--- /dev/null
+++ b/arch/c6x/lib/board.c
@@ -0,0 +1,201 @@
+/*
+ * (C) Copyright 2012 Dmitry Bondar <bond@inmys.ru>
+ *
+ * (C) Copyright 2011
+ * Julius Baxter, julius at opencores.org
+ *
+ * (C) Copyright 2003, Psyent Corporation <www.psyent.com>
+ * Scott McNutt <smcnutt@psyent.com>
+ *
+ * (C) Copyright 2000-2002
+ * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+ *
+ *
+ * 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
+ */
+
+#include <common.h>
+#include <stdio_dev.h>
+#include <watchdog.h>
+#include <malloc.h>
+#include <mmc.h>
+#include <net.h>
+#ifdef CONFIG_STATUS_LED
+#include <status_led.h>
+#endif
+#ifdef CONFIG_CMD_NAND
+#include <nand.h> /* cannot even include nand.h if it isnt configured */
+#endif
+
+#include <timestamp.h>
+#include <version.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+static int display_banner(void)
+{
+ printf("\n\n%s\n\n", version_string);
+ return 0;
+}
+
+#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C)
+static int init_func_i2c(void)
+{
+ puts("I2C: ");
+ i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
+ puts("ready\n");
+ return 0;
+}
+#endif
+
+
+/*
+ * Initialization sequence
+ */
+extern int print_cpuinfo(void);
+
+static int (* const init_sequence[])(void) = {
+#if defined(CONFIG_ARCH_CPU_INIT)
+ arch_cpu_init, /* basic arch cpu dependent setup */
+#endif
+#if defined(CONFIG_BOARD_EARLY_INIT_F)
+ board_early_init_f,
+#endif
+ timer_init, /* initialize timer */
+ env_init,
+ serial_init,
+ console_init_f,
+
+ display_banner, /* say that we are here */
+#if defined(CONFIG_DISPLAY_CPUINFO)
+ print_cpuinfo, /* display cpu info (and speed) */
+#endif
+#if defined(CONFIG_DISPLAY_BOARDINFO)
+ checkboard, /* display board info */
+#endif
+#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C)
+ init_func_i2c,
+#endif
+};
+
+
+extern ulong __bss_start;
+extern ulong __bss_end__;
+static int clear_bss(void)
+{
+ ulong dst_addr = (ulong)&__bss_start;
+ size_t len = (size_t)&__bss_end__ - (size_t)&__bss_start;
+ memset((void *)dst_addr, 0x00, len);
+ return 0;
+}
+
+/***********************************************************************/
+void board_init_f(ulong bootflag)
+{
+ bd_t *bd;
+ int i;
+
+ clear_bss();
+
+ gd = (gd_t *)CONFIG_SYS_GBL_DATA_ADDR;
+ __asm__ __volatile__("": : :"memory");
+ memset((void *)gd, 0, GENERATED_GBL_DATA_SIZE);
+
+ gd->bd = (bd_t *)(gd+1); /* At end of global data */
+ gd->baudrate = CONFIG_BAUDRATE;
+
+ bd = gd->bd;
+#ifndef CONFIG_SYS_NO_FLASH
+ bd->bi_flashstart = CONFIG_SYS_FLASH_BASE;
+#endif
+ bd->bi_baudrate = CONFIG_BAUDRATE;
+
+ for (i = 0; i < ARRAY_SIZE(init_sequence); i++) {
+ WATCHDOG_RESET();
+ if (init_sequence[i]())
+ hang();
+ }
+
+ WATCHDOG_RESET();
+
+ /* The Malloc area is immediately below the monitor copy in RAM */
+ mem_malloc_init(CONFIG_SYS_MALLOC_BASE, CONFIG_SYS_MALLOC_LEN);
+
+ board_init();
+
+#ifndef CONFIG_SYS_NO_FLASH
+ WATCHDOG_RESET();
+ bd->bi_flashsize = flash_init();
+#endif
+
+#ifdef CONFIG_CMD_NAND
+ puts("NAND: ");
+ nand_init();
+#endif
+
+#ifdef CONFIG_GENERIC_MMC
+ puts("MMC: ");
+ mmc_initialize(bd);
+#endif
+
+ WATCHDOG_RESET();
+ env_relocate();
+
+ WATCHDOG_RESET();
+ stdio_init();
+ jumptable_init();
+ console_init_r();
+
+ WATCHDOG_RESET();
+/* interrupt_init();*/
+
+#if defined(CONFIG_BOARD_LATE_INIT)
+ board_late_init();
+#endif
+
+#if defined(CONFIG_CMD_NET)
+ puts("NET: ");
+ eth_initialize(bd);
+#endif
+
+ /* main_loop */
+ for (;;) {
+ WATCHDOG_RESET();
+ main_loop();
+ }
+}
+
+
+/***********************************************************************/
+
+void hang(void)
+{
+ disable_interrupts();
+ puts("### ERROR ### Please reset board ###\n");
+
+ for (;;)
+ ;
+}
+
+int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+ reset_cpu(0);
+ return 0;
+}
+
diff --git a/arch/c6x/lib/bootm.c b/arch/c6x/lib/bootm.c
new file mode 100644
index 0000000..4a64ef6
--- /dev/null
+++ b/arch/c6x/lib/bootm.c
@@ -0,0 +1,59 @@
+/*
+ * (C) Copyright 2003, Psyent Corporation <www.psyent.com>
+ * Scott McNutt <smcnutt@psyent.com>
+ *
+ * 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
+ */
+
+#include <common.h>
+#include <command.h>
+
+int disable_interrupts()
+{
+ return 0;
+}
+
+void enable_interrupts()
+{
+}
+
+int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *images)
+{
+ void (*kernel)() = (void *)images->ep;
+ char *commandline = getenv ("bootargs");
+ if (commandline) {
+ char *dst = (char *)images->ep + 0x1000;
+ strncpy(dst, commandline, 1023);
+ dst[1023] = 0;
+ }
+ {
+ unsigned int *ptr = (unsigned int *)0xc1f00000;
+ ptr[0] = 0x64000001; /*TAG_SOL*/
+ ptr[1] = 0; /*size SOL*/
+ ptr[2] = 0x64000002; /*TAG_EOL*/
+ ptr[3] = 0;
+ }
+ asm("MVKL .S1 0x54694265,A4");
+ asm("MVKH .S1 0x54694265,A4");
+ asm("MVKL .S2 0xc1f00000,B4");
+ asm("MVKH .S2 0xc1f00000,B4");
+ kernel();
+ printf("after kernel\n");
+ return 1;
+}
diff --git a/arch/c6x/lib/csum_64plus.S b/arch/c6x/lib/csum_64plus.S
new file mode 100644
index 0000000..db26ed4
--- /dev/null
+++ b/arch/c6x/lib/csum_64plus.S
@@ -0,0 +1,408 @@
+;
+; linux/arch/c6x/lib/csum_64plus.s
+;
+; Port on Texas Instruments TMS320C6x architecture
+;
+; Copyright (C) 2006, 2009, 2010 Texas Instruments Incorporated
+; Author: Aurelien Jacquiot (aurelien.jacquiot at jaluna.com)
+;
+; This program is free software; you can redistribute it and/or modify
+; it under the terms of the GNU General Public License version 2 as
+; published by the Free Software Foundation.
+;
+
+;
+;unsigned int csum_partial_copy(const char *src, char * dst,
+; int len, int sum)
+;
+; A4: src
+; B4: dst
+; A6: len
+; B6: sum
+; return csum in A4
+;
+
+ .global csum_partial_copy
+ .text
+
+csum_partial_copy:
+ MVC .S2 ILC,B30
+
+ MV .D1X B6,A31 ; given csum
+ ZERO .D1 A9 ; csum (a side)
+|| ZERO .D2 B9 ; csum (b side)
+|| SHRU .S2X A6,2,B5 ; len / 4
+
+ ;; Check alignment and size
+ AND .S1 3,A4,A1
+|| AND .S2 3,B4,B0
+ OR .L2X B0,A1,B0 ; non aligned condition
+|| MVC .S2 B5,ILC
+|| MVK .D2 1,B2
+|| MV .D1X B5,A1 ; words condition
+ [!A1] B .S1 L8
+ [B0] BNOP .S1 L6,5
+
+ SPLOOP 1
+
+ ;; Main loop for aligned words
+ LDW .D1T1 *A4++,A7
+ NOP 4
+ MV .S2X A7,B7
+|| EXTU .S1 A7,0,16,A16
+ STW .D2T2 B7,*B4++
+|| MPYU .M2 B7,B2,B8
+|| ADD .L1 A16,A9,A9
+ NOP
+ SPKERNEL 8,0
+|| ADD .L2 B8,B9,B9
+
+ ZERO .D1 A1
+|| ADD .L1X A9,B9,A9 ; add csum from a and b sides
+
+L6:
+ [!A1] BNOP .S1 L8,5
+
+ ;; Main loop for non-aligned words
+ SPLOOP 2
+ || MVK .L1 1,A2
+
+ LDNW .D1T1 *A4++,A7
+ NOP 3
+
+ NOP
+ MV .S2X A7,B7
+ || EXTU .S1 A7,0,16,A16
+ || MPYU .M1 A7,A2,A8
+
+ ADD .L1 A16,A9,A9
+ SPKERNEL 6,0
+ || STNW .D2T2 B7,*B4++
+ || ADD .L1 A8,A9,A9
+
+L8: AND .S2X 2,A6,B5
+ CMPGT .L2 B5,0,B0
+ [!B0] BNOP .S1 L82,4
+
+ ;; Manage half-word
+ ZERO .L1 A7
+|| ZERO .D1 A8
+
+#ifdef CONFIG_CPU_BIG_ENDIAN
+
+ LDBU .D1T1 *A4++,A7
+ LDBU .D1T1 *A4++,A8
+ NOP 3
+ SHL .S1 A7,8,A0
+ ADD .S1 A8,A9,A9
+ STB .D2T1 A7,*B4++
+|| ADD .S1 A0,A9,A9
+ STB .D2T1 A8,*B4++
+
+#else
+
+ LDBU .D1T1 *A4++,A7
+ LDBU .D1T1 *A4++,A8
+ NOP 3
+ ADD .S1 A7,A9,A9
+ SHL .S1 A8,8,A0
+
+ STB .D2T1 A7,*B4++
+|| ADD .S1 A0,A9,A9
+ STB .D2T1 A8,*B4++
+
+#endif
+
+ ;; Manage eventually the last byte
+L82: AND .S2X 1,A6,B0
+ [!B0] BNOP .S1 L9,5
+
+|| ZERO .L1 A7
+
+L83: LDBU .D1T1 *A4++,A7
+ NOP 4
+
+ MV .L2X A7,B7
+
+#ifdef CONFIG_CPU_BIG_ENDIAN
+
+ STB .D2T2 B7,*B4++
+|| SHL .S1 A7,8,A7
+ ADD .S1 A7,A9,A9
+
+#else
+
+ STB .D2T2 B7,*B4++
+|| ADD .S1 A7,A9,A9
+
+#endif
+
+ ;; Fold the csum
+L9: SHRU .S2X A9,16,B0
+ [!B0] BNOP .S1 L10,5
+
+L91: SHRU .S2X A9,16,B4
+|| EXTU .S1 A9,16,16,A3
+ ADD .D1X A3,B4,A9
+
+ SHRU .S1 A9,16,A0
+ [A0] BNOP .S1 L91,5
+
+L10: ADD .D1 A31,A9,A9
+ MV .D1 A9,A4
+
+ BNOP .S2 B3,4
+ MVC .S2 B30,ILC
+
+ .global csum_partial_copy_old
+ .text
+
+;
+;unsigned short
+;ip_fast_csum(unsigned char *iph, unsigned int ihl)
+;{
+; unsigned int checksum = 0;
+; unsigned short *tosum = (unsigned short *) iph;
+; int len;
+;
+; len = ihl*4;
+;
+; if (len <= 0)
+; return 0;
+;
+; while(len) {
+; len -= 2;
+; checksum += *tosum++;
+; }
+; if (len & 1)
+; checksum += *(unsigned char*) tosum;
+;
+; while(checksum >> 16)
+; checksum = (checksum & 0xffff) + (checksum >> 16);
+;
+; return ~checksum;
+;}
+;
+; A4: iph
+; B4: ihl
+; return checksum in A4
+;
+
+ .global ip_fast_csum
+ .text
+
+ip_fast_csum:
+ ZERO .D1 A5
+ || MVC .S2 ILC,B30
+ SHL .S2 B4,2,B0
+ CMPGT .L2 B0,0,B1
+ [!B1] BNOP .S1 L15,4
+ [!B1] ZERO .D1 A3
+
+ [!B0] B .S1 L12
+ SHRU .S2 B0,1,B0
+ MVC .S2 B0,ILC
+ NOP 3
+
+ SPLOOP 1
+ LDHU .D1T1 *A4++,A3
+ NOP 3
+ NOP
+ SPKERNEL 5,0
+ || ADD .L1 A3,A5,A5
+
+L12: SHRU .S1 A5,16,A0
+ [!A0] BNOP .S1 L14,5
+
+L13: SHRU .S2X A5,16,B4
+ EXTU .S1 A5,16,16,A3
+ ADD .D1X A3,B4,A5
+ SHRU .S1 A5,16,A0
+ [A0] BNOP .S1 L13,5
+
+L14: NOT .D1 A5,A3
+ EXTU .S1 A3,16,16,A3
+
+L15: BNOP .S2 B3,3
+ MVC .S2 B30,ILC
+ MV .D1 A3,A4
+
+;
+;unsigned short
+;do_csum(unsigned char *buff, unsigned int len)
+;{
+; int odd, count;
+; unsigned int result = 0;
+;
+; if (len <= 0)
+; goto out;
+; odd = 1 & (unsigned long) buff;
+; if (odd) {
+;#ifdef __LITTLE_ENDIAN
+; result += (*buff << 8);
+;#else
+; result = *buff;
+;#endif
+; len--;
+; buff++;
+; }
+; count = len >> 1; /* nr of 16-bit words.. */
+; if (count) {
+; if (2 & (unsigned long) buff) {
+; result += *(unsigned short *) buff;
+; count--;
+; len -= 2;
+; buff += 2;
+; }
+; count >>= 1; /* nr of 32-bit words.. */
+; if (count) {
+; unsigned int carry = 0;
+; do {
+; unsigned int w = *(unsigned int *) buff;
+; count--;
+; buff += 4;
+; result += carry;
+; result += w;
+; carry = (w > result);
+; } while (count);
+; result += carry;
+; result = (result & 0xffff) + (result >> 16);
+; }
+; if (len & 2) {
+; result += *(unsigned short *) buff;
+; buff += 2;
+; }
+; }
+; if (len & 1)
+;#ifdef __LITTLE_ENDIAN
+; result += *buff;
+;#else
+; result += (*buff << 8);
+;#endif
+; result = (result & 0xffff) + (result >> 16);
+; /* add up carry.. */
+; result = (result & 0xffff) + (result >> 16);
+; if (odd)
+; result = ((result >> 8) & 0xff) | ((result & 0xff) << 8);
+;out:
+; return result;
+;}
+;
+; A4: buff
+; B4: len
+; return checksum in A4
+;
+ .global do_csum
+ .text
+do_csum:
+ CMPGT .L2 B4,0,B0
+ [!B0] BNOP .S1 L26,3
+ EXTU .S1 A4,31,31,A0
+
+ MV .L1 A0,A3
+|| MV .S1X B3,A5
+|| MV .L2 B4,B3
+|| ZERO .D1 A1
+
+#ifdef CONFIG_CPU_BIG_ENDIAN
+ [A0] SUB .L2 B3,1,B3
+|| [A0] LDBU .D1T1 *A4++,A1
+#else
+ [!A0] BNOP .S1 L21,5
+|| [A0] LDBU .D1T1 *A4++,A0
+ SUB .L2 B3,1,B3
+|| SHL .S1 A0,8,A1
+L21:
+#endif
+ SHR .S2 B3,1,B0
+ [!B0] BNOP .S1 L24,3
+ MVK .L1 2,A0
+ AND .L1 A4,A0,A0
+
+ [!A0] BNOP .S1 L22,5
+|| [A0] LDHU .D1T1 *A4++,A0
+ SUB .L2 B0,1,B0
+|| SUB .S2 B3,2,B3
+|| ADD .L1 A0,A1,A1
+L22:
+ SHR .S2 B0,1,B0
+|| ZERO .L1 A0
+
+ [!B0] BNOP .S1 L23,5
+|| [B0] MVC .S2 B0,ILC
+
+ SPLOOP 3
+ SPMASK L1
+|| MV .L1 A1,A2
+|| LDW .D1T1 *A4++,A1
+
+ NOP 4
+ ADD .L1 A0,A1,A0
+ ADD .L1 A2,A0,A2
+
+ SPKERNEL 1,2
+|| CMPGTU .L1 A1,A2,A0
+
+ ADD .L1 A0,A2,A6
+ EXTU .S1 A6,16,16,A7
+ SHRU .S2X A6,16,B0
+ NOP 1
+ ADD .L1X A7,B0,A1
+L23:
+ MVK .L2 2,B0
+ AND .L2 B3,B0,B0
+ [B0] LDHU .D1T1 *A4++,A0
+ NOP 4
+ [B0] ADD .L1 A0,A1,A1
+L24:
+ EXTU .S2 B3,31,31,B0
+#ifdef CONFIG_CPU_BIG_ENDIAN
+ [!B0] BNOP .S1 L25,4
+|| [B0] LDBU .D1T1 *A4,A0
+ SHL .S1 A0,8,A0
+ ADD .L1 A0,A1,A1
+L25:
+#else
+ [B0] LDBU .D1T1 *A4,A0
+ NOP 4
+ [B0] ADD .L1 A0,A1,A1
+#endif
+ EXTU .S1 A1,16,16,A0
+ SHRU .S2X A1,16,B0
+ NOP 1
+ ADD .L1X A0,B0,A0
+ SHRU .S1 A0,16,A1
+ ADD .L1 A0,A1,A0
+ EXTU .S1 A0,16,16,A1
+ EXTU .S1 A1,16,24,A2
+
+ EXTU .S1 A1,24,16,A0
+|| MV .L2X A3,B0
+
+ [B0] OR .L1 A0,A2,A1
+L26:
+ NOP 1
+ BNOP .S2X A5,4
+ MV .L1 A1,A4
+
+;__wsum csum_partial(const void *buff, int len, __wsum wsum)
+;{
+; unsigned int sum = (__force unsigned int)wsum;
+; unsigned int result = do_csum(buff, len);
+;
+; /* add in old sum, and carry.. */
+; result += sum;
+; if (sum > result)
+; result += 1;
+; return (__force __wsum)result;
+;}
+;
+ .global csum_partial
+csum_partial:
+ MV .L1X B3,A9
+|| CALLP .S2 do_csum,B3
+|| MV .S1 A6,A8
+ BNOP .S2X A9,2
+ ADD .L1 A8,A4,A1
+ CMPGTU .L1 A8,A1,A0
+ ADD .L1 A1,A0,A4
diff --git a/arch/c6x/lib/delay.S b/arch/c6x/lib/delay.S
new file mode 100644
index 0000000..44f2a7f
--- /dev/null
+++ b/arch/c6x/lib/delay.S
@@ -0,0 +1,39 @@
+;
+; linux/arch/c6x/lib/delay.s
+;
+; Port on Texas Instruments TMS320C6x architecture
+;
+; Copyright (C) 2004, 2009, 2010 Texas Instruments Incorporated
+; Author: Aurelien Jacquiot (aurelien.jacquiot at jaluna.com)
+;
+; This program is free software; you can redistribute it and/or modify
+; it under the terms of the GNU General Public License version 2 as
+; published by the Free Software Foundation.
+;
+ .sect ".text"
+ .global _c6x_delay
+
+_c6x_delay:
+ bdec .s1 _c6x_delay,A4
+ nop 5
+ b .s2 B3
+ nop 5
+
+#ifdef CONFIG_TI_C6X_COMPILER
+ ;; this is inlined with gcc
+
+ .global _c6x_tickdelay
+_c6x_tickdelay:
+ mvc .s2 TSCL,B1
+ add .s2x B1,A4,B1
+ || mvk .l2 1,B0
+$0:
+ [B0] b .s2 $0
+ mvc .s2 TSCL,B0
+ sub .s2 B0,B1,B0
+ cmpgt .l2 0,B0,B0
+ nop
+ nop
+ b .s2 B3
+ nop 5
+#endif
diff --git a/arch/c6x/lib/divi.S b/arch/c6x/lib/divi.S
new file mode 100644
index 0000000..cfa1e4c
--- /dev/null
+++ b/arch/c6x/lib/divi.S
@@ -0,0 +1,54 @@
+;; Copyright 2010 Free Software Foundation, Inc.
+;; Contributed by Bernd Schmidt <bernds@codesourcery.com>.
+;;
+;; 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.
+
+ ;; ABI considerations for the divide functions
+ ;; The following registers are call-used:
+ ;; __c6xabi_divi A0,A1,A2,A4,A6,B0,B1,B2,B4,B5
+ ;; __c6xabi_divu A0,A1,A2,A4,A6,B0,B1,B2,B4
+ ;; __c6xabi_remi A1,A2,A4,A5,A6,B0,B1,B2,B4
+ ;; __c6xabi_remu A1,A4,A5,A7,B0,B1,B2,B4
+ ;;
+ ;; In our implementation, divu and remu are leaf functions,
+ ;; while both divi and remi call into divu.
+ ;; A0 is not clobbered by any of the functions.
+ ;; divu does not clobber B2 either, which is taken advantage of
+ ;; in remi.
+ ;; divi uses B5 to hold the original return address during
+ ;; the call to divu.
+ ;; remi uses B2 and A5 to hold the input values during the
+ ;; call to divu. It stores B3 in on the stack.
+
+#ifdef CONFIG_TI_C6X_COMPILER
+ .ref __c6xabi_divu
+#endif
+ .text
+ .global __c6xabi_divi
+__c6xabi_divi:
+ call .s2 __c6xabi_divu
+|| mv .d2 B3, B5
+|| cmpgt .l1 0, A4, A1
+|| cmpgt .l2 0, B4, B1
+
+ [A1] neg .l1 A4, A4
+|| [B1] neg .l2 B4, B4
+|| xor .s1x A1, B1, A1
+ [A1] addkpc .s2 _divu_ret, B3, 4
+_divu_ret:
+ neg .l1 A4, A4
+|| mv .l2 B3,B5
+|| ret .s2 B5
+ nop 5
diff --git a/arch/c6x/lib/divremi.S b/arch/c6x/lib/divremi.S
new file mode 100644
index 0000000..b7664c3
--- /dev/null
+++ b/arch/c6x/lib/divremi.S
@@ -0,0 +1,61 @@
+;; Copyright 2010 Free Software Foundation, Inc.
+;; Contributed by Bernd Schmidt <bernds@codesourcery.com>.
+;;
+;; 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.
+
+#ifdef CONFIG_TI_C6X_COMPILER
+ .ref __c6xabi_divu
+#endif
+ .text
+ .global __c6xabi_divremi
+
+__c6xabi_divremi:
+ stw .d2t2 B3, *B15--[2]
+|| cmpgt .l1 0, A4, A1
+|| cmpgt .l2 0, B4, B2
+|| mv .s1 A4, A5
+|| call .s2 __c6xabi_divu
+
+ [A1] neg .l1 A4, A4
+|| [B2] neg .l2 B4, B4
+|| xor .s2x B2, A1, B0
+|| mv .d2 B4, B2
+
+ [B0] addkpc .s2 _divu_ret_1, B3, 1
+ [!B0] addkpc .s2 _divu_ret_2, B3, 1
+ nop 2
+_divu_ret_1:
+ neg .l1 A4, A4
+_divu_ret_2:
+ ldw .d2t2 *++B15[2], B3
+
+#if defined(CONFIG_TMS320C64XPLUS) || defined(CONFIG_TMS320C66X)
+ mpy32 .m1x A4, B2, A6
+ nop 3
+ ret .s2 B3
+ sub .l1 A5, A6, A5
+ nop 4
+#else
+ mpyu .m1x A4, B2, A1
+ nop 1
+ mpylhu .m1x A4, B2, A6
+|| mpylhu .m2x B2, A4, B2
+|| ret .s2 B3
+ nop 1
+ add .l1x A6, B2, A6
+ shl .s1 A6, 16, A6
+ add .d1 A6, A1, A6
+ sub .l1 A5, A6, A5
+#endif
diff --git a/arch/c6x/lib/divremu.S b/arch/c6x/lib/divremu.S
new file mode 100644
index 0000000..83e2bb7
--- /dev/null
+++ b/arch/c6x/lib/divremu.S
@@ -0,0 +1,86 @@
+;; Copyright 2011 Free Software Foundation, Inc.
+;; Contributed by Bernd Schmidt <bernds@codesourcery.com>.
+;;
+;; 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.
+
+ .text
+ .global __c6xabi_divremu
+
+__c6xabi_divremu:
+ ;; We use a series of up to 31 subc instructions. First, we find
+ ;; out how many leading zero bits there are in the divisor. This
+ ;; gives us both a shift count for aligning (shifting) the divisor
+ ;; to the, and the number of times we have to execute subc.
+
+ ;; At the end, we have both the remainder and most of the quotient
+ ;; in A4. The top bit of the quotient is computed first and is
+ ;; placed in A2.
+
+ ;; Return immediately if the dividend is zero. Setting B4 to 1
+ ;; is a trick to allow us to leave the following insns in the jump
+ ;; delay slot without affecting the result.
+ mv .s2x A4, B1
+
+[b1] lmbd .l2 1, B4, B1
+||[!b1] b .s2 B3 ; RETURN A
+||[!b1] mvk .d2 1, B4
+
+||[!b1] zero .s1 A5
+ mv .l1x B1, A6
+|| shl .s2 B4, B1, B4
+
+ ;; The loop performs a maximum of 28 steps, so we do the
+ ;; first 3 here.
+ cmpltu .l1x A4, B4, A2
+[!A2] sub .l1x A4, B4, A4
+|| shru .s2 B4, 1, B4
+|| xor .s1 1, A2, A2
+
+ shl .s1 A2, 31, A2
+|| [b1] subc .l1x A4,B4,A4
+|| [b1] add .s2 -1, B1, B1
+[b1] subc .l1x A4,B4,A4
+|| [b1] add .s2 -1, B1, B1
+
+ ;; RETURN A may happen here (note: must happen before the next branch)
+0:
+ cmpgt .l2 B1, 7, B0
+|| [b1] subc .l1x A4,B4,A4
+|| [b1] add .s2 -1, B1, B1
+[b1] subc .l1x A4,B4,A4
+|| [b1] add .s2 -1, B1, B1
+|| [b0] b .s1 0b
+[b1] subc .l1x A4,B4,A4
+|| [b1] add .s2 -1, B1, B1
+[b1] subc .l1x A4,B4,A4
+|| [b1] add .s2 -1, B1, B1
+[b1] subc .l1x A4,B4,A4
+|| [b1] add .s2 -1, B1, B1
+[b1] subc .l1x A4,B4,A4
+|| [b1] add .s2 -1, B1, B1
+[b1] subc .l1x A4,B4,A4
+|| [b1] add .s2 -1, B1, B1
+ ;; loop backwards branch happens here
+
+ ret .s2 B3
+|| mvk .s1 32, A1
+ sub .l1 A1, A6, A6
+|| extu .s1 A4, A6, A5
+ shl .s1 A4, A6, A4
+ shru .s1 A4, 1, A4
+|| sub .l1 A6, 1, A6
+ or .l1 A2, A4, A4
+ shru .s1 A4, A6, A4
+ nop
diff --git a/arch/c6x/lib/divu.S b/arch/c6x/lib/divu.S
new file mode 100644
index 0000000..340b536
--- /dev/null
+++ b/arch/c6x/lib/divu.S
@@ -0,0 +1,100 @@
+;; Copyright 2010 Free Software Foundation, Inc.
+;; Contributed by Bernd Schmidt <bernds@codesourcery.com>.
+;;
+;; 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.
+
+ ;; ABI considerations for the divide functions
+ ;; The following registers are call-used:
+ ;; __c6xabi_divi A0,A1,A2,A4,A6,B0,B1,B2,B4,B5
+ ;; __c6xabi_divu A0,A1,A2,A4,A6,B0,B1,B2,B4
+ ;; __c6xabi_remi A1,A2,A4,A5,A6,B0,B1,B2,B4
+ ;; __c6xabi_remu A1,A4,A5,A7,B0,B1,B2,B4
+ ;;
+ ;; In our implementation, divu and remu are leaf functions,
+ ;; while both divi and remi call into divu.
+ ;; A0 is not clobbered by any of the functions.
+ ;; divu does not clobber B2 either, which is taken advantage of
+ ;; in remi.
+ ;; divi uses B5 to hold the original return address during
+ ;; the call to divu.
+ ;; remi uses B2 and A5 to hold the input values during the
+ ;; call to divu. It stores B3 in on the stack.
+
+#ifdef CONFIG_TI_C6X_COMPILER
+ .def __c6xabi_divu
+#endif
+ .text
+ .global __c6xabi_divu
+__c6xabi_divu:
+ ;; We use a series of up to 31 subc instructions. First, we find
+ ;; out how many leading zero bits there are in the divisor. This
+ ;; gives us both a shift count for aligning (shifting) the divisor
+ ;; to the, and the number of times we have to execute subc.
+
+ ;; At the end, we have both the remainder and most of the quotient
+ ;; in A4. The top bit of the quotient is computed first and is
+ ;; placed in A2.
+
+ ;; Return immediately if the dividend is zero.
+ mv .s2x A4, B1
+ [B1] lmbd .l2 1, B4, B1
+|| [!B1] b .s2 B3 ; RETURN A
+|| [!B1] mvk .d2 1, B4
+ mv .l1x B1, A6
+|| shl .s2 B4, B1, B4
+
+ ;; The loop performs a maximum of 28 steps, so we do the
+ ;; first 3 here.
+ cmpltu .l1x A4, B4, A2
+ [!A2] sub .l1x A4, B4, A4
+|| shru .s2 B4, 1, B4
+|| xor .s1 1, A2, A2
+
+ shl .s1 A2, 31, A2
+|| [B1] subc .l1x A4,B4,A4
+|| [B1] add .s2 -1, B1, B1
+ [B1] subc .l1x A4,B4,A4
+|| [B1] add .s2 -1, B1, B1
+
+ ;; RETURN A may happen here (note: must happen before the next branch)
+_divu_loop:
+ cmpgt .l2 B1, 7, B0
+|| [B1] subc .l1x A4,B4,A4
+|| [B1] add .s2 -1, B1, B1
+ [B1] subc .l1x A4,B4,A4
+|| [B1] add .s2 -1, B1, B1
+|| [B0] b .s1 _divu_loop
+ [B1] subc .l1x A4,B4,A4
+|| [B1] add .s2 -1, B1, B1
+ [B1] subc .l1x A4,B4,A4
+|| [B1] add .s2 -1, B1, B1
+ [B1] subc .l1x A4,B4,A4
+|| [B1] add .s2 -1, B1, B1
+ [B1] subc .l1x A4,B4,A4
+|| [B1] add .s2 -1, B1, B1
+ [B1] subc .l1x A4,B4,A4
+|| [B1] add .s2 -1, B1, B1
+ ;; loop backwards branch happens here
+
+ ret .s2 B3
+|| mvk .s1 32, A1
+ sub .l1 A1, A6, A6
+ shl .s1 A4, A6, A4
+ shru .s1 A4, 1, A4
+|| sub .l1 A6, 1, A6
+ or .l1 A2, A4, A4
+ shru .s1 A4, A6, A4
+ nop
+
diff --git a/arch/c6x/lib/divull.c b/arch/c6x/lib/divull.c
new file mode 100644
index 0000000..8c00edc
--- /dev/null
+++ b/arch/c6x/lib/divull.c
@@ -0,0 +1,336 @@
+/* Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+ 2000, 2001, 2002 Free Software Foundation, Inc.
+
+This code was pulled from an old (GPLv2) libgcc.
+
+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, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file. (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+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 GCC; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+
+#include <linux/types.h>
+#include <linux/bitops.h>
+
+#ifdef CONFIG_TI_C6X_COMPILER
+#define count_leading_zeros(count, x) (count) = _lmbd(1, (x))
+#else
+static inline unsigned __clz(unsigned x)
+{
+ asm(" lmbd .l1 1,%0,%0\n" : "+a"(x));
+ return x;
+}
+#define count_leading_zeros(count, x) (count) = __clz(x)
+#endif
+
+#define W_TYPE_SIZE 32
+
+#define __BITS4 (W_TYPE_SIZE / 4)
+#define __ll_B ((uint32_t) 1 << (W_TYPE_SIZE / 2))
+#define __ll_lowpart(t) ((uint32_t) (t) & (__ll_B - 1))
+#define __ll_highpart(t) ((uint32_t) (t) >> (W_TYPE_SIZE / 2))
+
+
+#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
+ do { \
+ uint32_t __x; \
+ __x = (al) - (bl); \
+ (sh) = (ah) - (bh) - (__x > (al)); \
+ (sl) = __x; \
+ } while (0)
+
+#define umul_ppmm(w1, w0, u, v) \
+ do { \
+ uint32_t __x0, __x1, __x2, __x3; \
+ uint16_t __ul, __vl, __uh, __vh; \
+ \
+ __ul = __ll_lowpart(u); \
+ __uh = __ll_highpart(u); \
+ __vl = __ll_lowpart(v); \
+ __vh = __ll_highpart(v); \
+ \
+ __x0 = (uint32_t) __ul * __vl; \
+ __x1 = (uint32_t) __ul * __vh; \
+ __x2 = (uint32_t) __uh * __vl; \
+ __x3 = (uint32_t) __uh * __vh; \
+ \
+ __x1 += __ll_highpart(__x0);/* this can't give carry */ \
+ __x1 += __x2; /* but this indeed can */ \
+ if (__x1 < __x2) /* did we get it? */ \
+ __x3 += __ll_B; /* yes, add it in the proper pos. */ \
+ \
+ (w1) = __x3 + __ll_highpart(__x1); \
+ (w0) = __ll_lowpart(__x1) * __ll_B + __ll_lowpart(__x0); \
+ } while (0)
+
+#define __udiv_qrnnd_c(q, r, n1, n0, d) \
+ do { \
+ uint32_t __d1, __d0, __q1, __q0; \
+ uint32_t __r1, __r0, __m; \
+ __d1 = __ll_highpart(d); \
+ __d0 = __ll_lowpart(d); \
+ \
+ __r1 = (n1) % __d1; \
+ __q1 = (n1) / __d1; \
+ __m = (uint32_t) __q1 * __d0; \
+ __r1 = __r1 * __ll_B | __ll_highpart(n0); \
+ if (__r1 < __m) { \
+ __q1--, __r1 += (d); \
+ /* i.e. we didn't get carry when adding to __r1 */ \
+ if (__r1 >= (d)) \
+ if (__r1 < __m) \
+ __q1--, __r1 += (d); \
+ } \
+ __r1 -= __m; \
+ \
+ __r0 = __r1 % __d1; \
+ __q0 = __r1 / __d1; \
+ __m = (uint32_t) __q0 * __d0; \
+ __r0 = __r0 * __ll_B | __ll_lowpart(n0); \
+ if (__r0 < __m) { \
+ __q0--, __r0 += (d); \
+ if (__r0 >= (d)) \
+ if (__r0 < __m) \
+ __q0--, __r0 += (d); \
+ } \
+ __r0 -= __m; \
+ \
+ (q) = (uint32_t) __q1 * __ll_B | __q0; \
+ (r) = __r0; \
+ } while (0)
+
+#define UDIV_NEEDS_NORMALIZATION 1
+#define udiv_qrnnd __udiv_qrnnd_c
+
+struct llstruct {
+#ifdef CONFIG_CPU_BIG_ENDIAN
+ uint32_t high;
+ uint32_t low;
+#else
+ uint32_t low;
+ uint32_t high;
+#endif
+};
+
+typedef union {
+ struct llstruct s;
+ int64_t ll;
+} llunion_t;
+
+static inline uint64_t __udivmoddi4(uint64_t n, uint64_t d, uint64_t *rp)
+{
+ llunion_t ww;
+ llunion_t nn, dd;
+ llunion_t rr;
+ uint32_t d0, d1, n0, n1, n2;
+ uint32_t q0, q1;
+ uint32_t b, bm;
+
+ nn.ll = n;
+ dd.ll = d;
+
+ d0 = dd.s.low;
+ d1 = dd.s.high;
+ n0 = nn.s.low;
+ n1 = nn.s.high;
+
+#if !UDIV_NEEDS_NORMALIZATION
+ if (d1 == 0) {
+ if (d0 > n1) {
+ /* 0q = nn / 0D */
+
+ udiv_qrnnd(q0, n0, n1, n0, d0);
+ q1 = 0;
+
+ /* Remainder in n0. */
+ } else {
+ /* qq = NN / 0d */
+
+ if (d0 == 0)
+ d0 = 1 / d0; /* Divide intentionally by zero. */
+
+ udiv_qrnnd(q1, n1, 0, n1, d0);
+ udiv_qrnnd(q0, n0, n1, n0, d0);
+
+ /* Remainder in n0. */
+ }
+
+ if (rp != 0) {
+ rr.s.low = n0;
+ rr.s.high = 0;
+ *rp = rr.ll;
+ }
+ }
+
+#else /* UDIV_NEEDS_NORMALIZATION */
+
+ if (d1 == 0) {
+ if (d0 > n1) {
+ /* 0q = nn / 0D */
+
+ count_leading_zeros(bm, d0);
+
+ if (bm != 0) {
+ /* Normalize, i.e. make the most significant
+ bit of the denominator set. */
+
+ d0 = d0 << bm;
+ n1 = (n1 << bm) | (n0 >> (W_TYPE_SIZE - bm));
+ n0 = n0 << bm;
+ }
+
+ udiv_qrnnd(q0, n0, n1, n0, d0);
+ q1 = 0;
+
+ /* Remainder in n0 >> bm. */
+ } else {
+ /* qq = NN / 0d */
+
+ if (d0 == 0)
+ d0 = 1 / d0; /* Divide intentionally by zero. */
+
+ count_leading_zeros(bm, d0);
+
+ if (bm == 0) {
+ /* From (n1 >= d0) /\ (the most significant bit
+ of d0 is set), conclude (the most significant
+ bit of n1 is set) /\ (the leading quotient
+ digit q1 = 1).
+
+ This special case is necessary, not an
+ optimization. (Shifts counts of W_TYPE_SIZE
+ are undefined.) */
+
+ n1 -= d0;
+ q1 = 1;
+ } else {
+ /* Normalize. */
+
+ b = W_TYPE_SIZE - bm;
+
+ d0 = d0 << bm;
+ n2 = n1 >> b;
+ n1 = (n1 << bm) | (n0 >> b);
+ n0 = n0 << bm;
+
+ udiv_qrnnd(q1, n1, n2, n1, d0);
+ }
+
+ /* n1 != d0... */
+
+ udiv_qrnnd(q0, n0, n1, n0, d0);
+
+ /* Remainder in n0 >> bm. */
+ }
+
+ if (rp != 0) {
+ rr.s.low = n0 >> bm;
+ rr.s.high = 0;
+ *rp = rr.ll;
+ }
+ }
+#endif /* UDIV_NEEDS_NORMALIZATION */
+
+ else {
+ if (d1 > n1) {
+ /* 00 = nn / DD */
+
+ q0 = 0;
+ q1 = 0;
+
+ /* Remainder in n1n0. */
+ if (rp != 0) {
+ rr.s.low = n0;
+ rr.s.high = n1;
+ *rp = rr.ll;
+ }
+ } else {
+ /* 0q = NN / dd */
+
+ count_leading_zeros(bm, d1);
+ if (bm == 0) {
+ /* From (n1 >= d1) /\ (the most significant bit
+ of d1 is set), conclude (the most significant
+ bit of n1 is set) /\ (the quotient digit
+ q0 = 0 or 1).
+
+ This special case is necessary, not an
+ optimization. */
+
+ /* The condition on the next line takes
+ advantage of that n1 >= d1 (true due to
+ program flow). */
+ if (n1 > d1 || n0 >= d0) {
+ q0 = 1;
+ sub_ddmmss(n1, n0, n1, n0, d1, d0);
+ } else
+ q0 = 0;
+
+ q1 = 0;
+
+ if (rp != 0) {
+ rr.s.low = n0;
+ rr.s.high = n1;
+ *rp = rr.ll;
+ }
+ } else {
+ uint32_t m1, m0;
+ /* Normalize. */
+
+ b = W_TYPE_SIZE - bm;
+
+ d1 = (d1 << bm) | (d0 >> b);
+ d0 = d0 << bm;
+ n2 = n1 >> b;
+ n1 = (n1 << bm) | (n0 >> b);
+ n0 = n0 << bm;
+
+ udiv_qrnnd(q0, n1, n2, n1, d1);
+ umul_ppmm(m1, m0, q0, d0);
+
+ if (m1 > n1 || (m1 == n1 && m0 > n0)) {
+ q0--;
+ sub_ddmmss(m1, m0, m1, m0, d1, d0);
+ }
+
+ q1 = 0;
+
+ /* Remainder in (n1n0 - m1m0) >> bm. */
+ if (rp != 0) {
+ sub_ddmmss(n1, n0, n1, n0, m1, m0);
+ rr.s.low = (n1 << b) | (n0 >> bm);
+ rr.s.high = n1 >> bm;
+ *rp = rr.ll;
+ }
+ }
+ }
+ }
+
+ ww.s.low = q0;
+ ww.s.high = q1;
+ return ww.ll;
+}
+
+uint64_t
+__c6xabi_divull(uint64_t n, uint64_t d)
+{
+ return __udivmoddi4(n, d, (uint64_t *)0);
+}
+
diff --git a/arch/c6x/lib/llshl.S b/arch/c6x/lib/llshl.S
new file mode 100644
index 0000000..99b739e
--- /dev/null
+++ b/arch/c6x/lib/llshl.S
@@ -0,0 +1,36 @@
+;; Copyright (C) 2010 Texas Instruments Incorporated
+;; Contributed by Mark Salter <msalter@redhat.com>.
+;;
+;; 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.
+
+;; uint64_t __c6xabi_llshl(uint64_t val, uint shift)
+
+ .text
+ .global __c6xabi_llshl
+__c6xabi_llshl:
+ mv .l1x B4,A1
+ [!A1] b .s2 B3 ; just return if zero shift
+ mvk .s1 32,A0
+ sub .d1 A0,A1,A0
+ cmplt .l1 0,A0,A2
+ [A2] shru .s1 A4,A0,A0
+ [!A2] neg .l1 A0,A5
+|| [A2] shl .s1 A5,A1,A5
+ [!A2] shl .s1 A4,A5,A5
+|| [A2] or .d1 A5,A0,A5
+|| [!A2] mvk .l1 0,A4
+ [A2] shl .s1 A4,A1,A4
+ bnop .s2 B3,5
+
diff --git a/arch/c6x/lib/llshr.S b/arch/c6x/lib/llshr.S
new file mode 100644
index 0000000..989feed
--- /dev/null
+++ b/arch/c6x/lib/llshr.S
@@ -0,0 +1,36 @@
+;; Copyright (C) 2010 Texas Instruments Incorporated
+;; Contributed by Mark Salter <msalter@redhat.com>.
+;;
+;; 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.
+
+;; uint64_t __c6xabi_llshr(uint64_t val, uint shift)
+
+ .text
+ .global __c6xabi_llshr
+__c6xabi_llshr:
+ mv .l1x B4,A1
+ [!A1] b .s2 B3 ; return if zero shift count
+ mvk .s1 32,A0
+ sub .d1 A0,A1,A0
+ cmplt .l1 0,A0,A2
+ [A2] shl .s1 A5,A0,A0
+ nop
+ [!A2] neg .l1 A0,A4
+|| [A2] shru .s1 A4,A1,A4
+ [!A2] shr .s1 A5,A4,A4
+|| [A2] or .d1 A4,A0,A4
+ [!A2] shr .s1 A5,0x1f,A5
+ [A2] shr .s1 A5,A1,A5
+ bnop .s2 B3,5
diff --git a/arch/c6x/lib/llshru.S b/arch/c6x/lib/llshru.S
new file mode 100644
index 0000000..07a4631
--- /dev/null
+++ b/arch/c6x/lib/llshru.S
@@ -0,0 +1,36 @@
+;; Copyright (C) 2010 Texas Instruments Incorporated
+;; Contributed by Mark Salter <msalter@redhat.com>.
+;;
+;; 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.
+
+;; uint64_t __c6xabi_llshru(uint64_t val, uint shift)
+
+ .text
+ .global __c6xabi_llshru
+__c6xabi_llshru:
+ mv .l1x B4,A1
+ [!A1] b .s2 B3 ; return if zero shift count
+ mvk .s1 32,A0
+ sub .d1 A0,A1,A0
+ cmplt .l1 0,A0,A2
+ [A2] shl .s1 A5,A0,A0
+ nop
+ [!A2] neg .l1 A0,A4
+|| [A2] shru .s1 A4,A1,A4
+ [!A2] shru .s1 A5,A4,A4
+|| [A2] or .d1 A4,A0,A4
+|| [!A2] mvk .l1 0,A5
+ [A2] shru .s1 A5,A1,A5
+ bnop .s2 B3,5
diff --git a/arch/c6x/lib/memcmp.c b/arch/c6x/lib/memcmp.c
new file mode 100644
index 0000000..e3a98bc
--- /dev/null
+++ b/arch/c6x/lib/memcmp.c
@@ -0,0 +1,24 @@
+/*
+ * linux/arch/c6x/lib/memcmp.c
+ *
+ * Port on Texas Instruments TMS320C6x architecture
+ *
+ * Copyright (C) 2004, 2009 Texas Instruments Incorporated
+ * Author: Aurelien Jacquiot (aurelien.jacquiot at jaluna.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include <linux/types.h>
+
+int memcmp(const void *cs, const void *ct, size_t count)
+{
+ const unsigned char *su1, *su2;
+
+ for (su1 = cs, su2 = ct; 0 < count; ++su1, ++su2, count--)
+ if (*su1 != *su2)
+ return (*su1 < *su2) ? -1 : 1;
+ return 0;
+}
+
diff --git a/arch/c6x/lib/memcpy_64plus.S b/arch/c6x/lib/memcpy_64plus.S
new file mode 100644
index 0000000..ce1d7c6
--- /dev/null
+++ b/arch/c6x/lib/memcpy_64plus.S
@@ -0,0 +1,45 @@
+; Port on Texas Instruments TMS320C6x architecture
+;
+; Copyright (C) 2006, 2009, 2010 Texas Instruments Incorporated
+; Author: Aurelien Jacquiot (aurelien.jacquiot at jaluna.com)
+;
+; This program is free software; you can redistribute it and/or modify
+; it under the terms of the GNU General Public License version 2 as
+; published by the Free Software Foundation.
+;
+
+ .global memcpy
+ .text
+
+memcpy:
+ AND .L1 0x1,A6,A0
+ || AND .S1 0x2,A6,A1
+ || AND .L2X 0x4,A6,B0
+ || MV .D1 A4,A3
+ || MVC .S2 ILC,B2
+
+ [A0] LDB .D2T1 *B4++,A5
+ [A1] LDB .D2T1 *B4++,A7
+ [A1] LDB .D2T1 *B4++,A8
+ [B0] LDNW .D2T1 *B4++,A9
+ || SHRU .S2X A6,0x3,B1
+ [!B1] BNOP .S2 B3,1
+
+ [A0] STB .D1T1 A5,*A3++
+ ||[B1] MVC .S2 B1,ILC
+ [A1] STB .D1T1 A7,*A3++
+ [A1] STB .D1T1 A8,*A3++
+ [B0] STNW .D1T1 A9,*A3++ ; return when len < 8
+
+ SPLOOP 2
+
+ LDNDW .D2T1 *B4++,A9:A8
+ NOP 3
+
+ NOP
+ SPKERNEL 0,0
+ || STNDW .D1T1 A9:A8,*A3++
+
+ BNOP .S2 B3,4
+ MVC .S2 B2,ILC
+
diff --git a/arch/c6x/lib/memmove.c b/arch/c6x/lib/memmove.c
new file mode 100644
index 0000000..5672937
--- /dev/null
+++ b/arch/c6x/lib/memmove.c
@@ -0,0 +1,30 @@
+/*
+ * linux/arch/c6x/lib/memmove.c
+ *
+ * Port on Texas Instruments TMS320C6x architecture
+ *
+ * Copyright (C) 2005, 2009 Texas Instruments Incorporated
+ * Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include <linux/types.h>
+#include <linux/string.h>
+
+void *memmove(void *s1, const void *s2, size_t n)
+{
+ register char *s = (char *) s1;
+ register const char *p = (const char *) s2;
+
+ if (p >= s) {
+ return memcpy(s, p, n);
+ } else {
+ while (n) {
+ --n;
+ s[n] = p[n];
+ }
+ }
+ return s1;
+}
diff --git a/arch/c6x/lib/memset.c b/arch/c6x/lib/memset.c
new file mode 100644
index 0000000..da4275b
--- /dev/null
+++ b/arch/c6x/lib/memset.c
@@ -0,0 +1,20 @@
+/*
+ * linux/arch/c6x/lib/memcmp.c
+ *
+ * Port on Texas Instruments TMS320C6x architecture
+ *
+ * Copyright (C) 2004, 2009 Texas Instruments Incorporated
+ * Author: Aurelien Jacquiot (aurelien.jacquiot at jaluna.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include <linux/types.h>
+void *memset(void *mem, register int ch, register size_t length)
+{
+ register char *m = (char *)mem - 1;
+ while (length--)
+ *++m = ch;
+ return mem;
+}
diff --git a/arch/c6x/lib/mpyll.S b/arch/c6x/lib/mpyll.S
new file mode 100644
index 0000000..8da8417
--- /dev/null
+++ b/arch/c6x/lib/mpyll.S
@@ -0,0 +1,47 @@
+;; Copyright (C) 2010 Texas Instruments Incorporated
+;; Contributed by Mark Salter <msalter@redhat.com>.
+;;
+;; 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.
+
+ ;; uint64_t __c6xabi_mpyll(uint64_t x, uint64_t y)
+ ;;
+ ;; 64x64 multiply
+ ;; First compute partial results using 32-bit parts of x and y:
+ ;;
+ ;; b63 b32 b31 b0
+ ;; -----------------------------
+ ;; | 1 | 0 |
+ ;; -----------------------------
+ ;;
+ ;; P0 = X0*Y0
+ ;; P1 = X0*Y1 + X1*Y0
+ ;; P2 = X1*Y1
+ ;;
+ ;; result = (P2 << 64) + (P1 << 32) + P0
+ ;;
+ ;; Since the result is also 64-bit, we can skip the P2 term.
+
+ .text
+ .global __c6xabi_mpyll
+__c6xabi_mpyll:
+ mpy32u .m1x A4,B4,A1:A0 ; X0*Y0
+ b .s2 B3
+ || mpy32u .m2x B5,A4,B1:B0 ; X0*Y1 (don't need upper 32-bits)
+ || mpy32u .m1x A5,B4,A3:A2 ; X1*Y0 (don't need upper 32-bits)
+ nop
+ nop
+ mv .s1 A0,A4
+ add .l1x A2,B0,A5
+ add .s1 A1,A5,A5
diff --git a/arch/c6x/lib/negll.S b/arch/c6x/lib/negll.S
new file mode 100644
index 0000000..7747521
--- /dev/null
+++ b/arch/c6x/lib/negll.S
@@ -0,0 +1,29 @@
+;; Copyright (C) 2010 Texas Instruments Incorporated
+;; Contributed by Mark Salter <msalter@redhat.com>.
+;;
+;; 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.
+
+;; int64_t __c6xabi_negll(int64_t val)
+
+ .text
+ .global __c6xabi_negll
+__c6xabi_negll:
+ b .s2 B3
+ mvk .l1 0,A0
+ subu .l1 A0,A4,A3:A2
+ sub .l1 A0,A5,A0
+|| ext .s1 A3,24,24,A5
+ add .l1 A5,A0,A5
+ mv .s1 A2,A4
diff --git a/arch/c6x/lib/pop_rts.S b/arch/c6x/lib/pop_rts.S
new file mode 100644
index 0000000..e1847fb
--- /dev/null
+++ b/arch/c6x/lib/pop_rts.S
@@ -0,0 +1,30 @@
+;; Copyright 2010 Free Software Foundation, Inc.
+;; Contributed by Bernd Schmidt <bernds@codesourcery.com>.
+;;
+;; 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.
+
+ .text
+ .global __c6xabi_pop_rts
+
+__c6xabi_pop_rts:
+ lddw .d2t2 *++B15, B3:B2
+ lddw .d2t1 *++B15, A11:A10
+ lddw .d2t2 *++B15, B11:B10
+ lddw .d2t1 *++B15, A13:A12
+ lddw .d2t2 *++B15, B13:B12
+ lddw .d2t1 *++B15, A15:A14
+|| b .s2 B3
+ ldw .d2t2 *++B15[2], B14
+ nop 4
diff --git a/arch/c6x/lib/push_rts.S b/arch/c6x/lib/push_rts.S
new file mode 100644
index 0000000..637d56a
--- /dev/null
+++ b/arch/c6x/lib/push_rts.S
@@ -0,0 +1,28 @@
+;; Copyright 2010 Free Software Foundation, Inc.
+;; Contributed by Bernd Schmidt <bernds@codesourcery.com>.
+;;
+;; 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.
+
+ .text
+ .global __c6xabi_push_rts
+__c6xabi_push_rts:
+ stw .d2t2 B14, *B15--[2]
+ stdw .d2t1 A15:A14, *B15--
+|| b .s2x A3
+ stdw .d2t2 B13:B12, *B15--
+ stdw .d2t1 A13:A12, *B15--
+ stdw .d2t2 B11:B10, *B15--
+ stdw .d2t1 A11:A10, *B15--
+ stdw .d2t2 B3:B2, *B15--
diff --git a/arch/c6x/lib/remi.S b/arch/c6x/lib/remi.S
new file mode 100644
index 0000000..2760d77
--- /dev/null
+++ b/arch/c6x/lib/remi.S
@@ -0,0 +1,78 @@
+;; Copyright 2010, 2011 Free Software Foundation, Inc.
+;; Contributed by Bernd Schmidt <bernds@codesourcery.com>.
+;;
+;; 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.
+
+ ;; ABI considerations for the divide functions
+ ;; The following registers are call-used:
+ ;; __c6xabi_divi A0,A1,A2,A4,A6,B0,B1,B2,B4,B5
+ ;; __c6xabi_divu A0,A1,A2,A4,A6,B0,B1,B2,B4
+ ;; __c6xabi_remi A1,A2,A4,A5,A6,B0,B1,B2,B4
+ ;; __c6xabi_remu A1,A4,A5,A7,B0,B1,B2,B4
+ ;;
+ ;; In our implementation, divu and remu are leaf functions,
+ ;; while both divi and remi call into divu.
+ ;; A0 is not clobbered by any of the functions.
+ ;; divu does not clobber B2 either, which is taken advantage of
+ ;; in remi.
+ ;; divi uses B5 to hold the original return address during
+ ;; the call to divu.
+ ;; remi uses B2 and A5 to hold the input values during the
+ ;; call to divu. It stores B3 in on the stack.
+
+#ifdef CONFIG_TI_C6X_COMPILER
+ .ref __c6xabi_divu
+#endif
+ .text
+ .global __c6xabi_remi
+
+__c6xabi_remi:
+ stw .d2t2 B3, *B15--[2]
+|| cmpgt .l1 0, A4, A1
+|| cmpgt .l2 0, B4, B2
+|| mv .s1 A4, A5
+|| call .s2 __c6xabi_divu
+
+ [A1] neg .l1 A4, A4
+|| [B2] neg .l2 B4, B4
+|| xor .s2x B2, A1, B0
+|| mv .d2 B4, B2
+
+ [B0] addkpc .s2 _divu_ret_1, B3, 1
+ [!B0] addkpc .s2 _divu_ret_2, B3, 1
+ nop 2
+_divu_ret_1:
+ neg .l1 A4, A4
+_divu_ret_2:
+ ldw .d2t2 *++B15[2], B3
+
+#if defined(CONFIG_TMS320C64XPLUS) || defined(CONFIG_TMS320C66X)
+ mpy32 .m1x A4, B2, A6
+ nop 3
+ ret .s2 B3
+ sub .l1 A5, A6, A4
+ nop 4
+#else
+ mpyu .m1x A4, B2, A1
+ nop 1
+ mpylhu .m1x A4, B2, A6
+|| mpylhu .m2x B2, A4, B2
+|| ret .s2 B3
+ nop 1
+ add .l1x A6, B2, A6
+ shl .s1 A6, 16, A6
+ add .d1 A6, A1, A6
+ sub .l1 A5, A6, A4
+#endif
diff --git a/arch/c6x/lib/remu.S b/arch/c6x/lib/remu.S
new file mode 100644
index 0000000..e1d9f30
--- /dev/null
+++ b/arch/c6x/lib/remu.S
@@ -0,0 +1,81 @@
+;; Copyright 2010 Free Software Foundation, Inc.
+;; Contributed by Bernd Schmidt <bernds@codesourcery.com>.
+;;
+;; 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.
+
+ ;; ABI considerations for the divide functions
+ ;; The following registers are call-used:
+ ;; __c6xabi_divi A0,A1,A2,A4,A6,B0,B1,B2,B4,B5
+ ;; __c6xabi_divu A0,A1,A2,A4,A6,B0,B1,B2,B4
+ ;; __c6xabi_remi A1,A2,A4,A5,A6,B0,B1,B2,B4
+ ;; __c6xabi_remu A1,A4,A5,A7,B0,B1,B2,B4
+ ;;
+ ;; In our implementation, divu and remu are leaf functions,
+ ;; while both divi and remi call into divu.
+ ;; A0 is not clobbered by any of the functions.
+ ;; divu does not clobber B2 either, which is taken advantage of
+ ;; in remi.
+ ;; divi uses B5 to hold the original return address during
+ ;; the call to divu.
+ ;; remi uses B2 and A5 to hold the input values during the
+ ;; call to divu. It stores B3 in on the stack.
+
+
+ .text
+ .global __c6xabi_remu
+
+__c6xabi_remu:
+ ;; The ABI seems designed to prevent these functions calling each other,
+ ;; so we duplicate most of the divsi3 code here.
+ mv .s2x A4, B1
+ lmbd .l2 1, B4, B1
+|| [!B1] b .s2 B3 ; RETURN A
+|| [!B1] mvk .d2 1, B4
+
+ mv .l1x B1, A7
+|| shl .s2 B4, B1, B4
+
+ cmpltu .l1x A4, B4, A1
+ [!A1] sub .l1x A4, B4, A4
+ shru .s2 B4, 1, B4
+
+_remu_loop:
+ cmpgt .l2 B1, 7, B0
+|| [B1] subc .l1x A4,B4,A4
+|| [B1] add .s2 -1, B1, B1
+ ;; RETURN A may happen here (note: must happen before the next branch)
+ [B1] subc .l1x A4,B4,A4
+|| [B1] add .s2 -1, B1, B1
+|| [B0] b .s1 _remu_loop
+ [B1] subc .l1x A4,B4,A4
+|| [B1] add .s2 -1, B1, B1
+ [B1] subc .l1x A4,B4,A4
+|| [B1] add .s2 -1, B1, B1
+ [B1] subc .l1x A4,B4,A4
+|| [B1] add .s2 -1, B1, B1
+ [B1] subc .l1x A4,B4,A4
+|| [B1] add .s2 -1, B1, B1
+ [B1] subc .l1x A4,B4,A4
+|| [B1] add .s2 -1, B1, B1
+ ;; loop backwards branch happens here
+
+ ret .s2 B3
+ [B1] subc .l1x A4,B4,A4
+|| [B1] add .s2 -1, B1, B1
+ [B1] subc .l1x A4,B4,A4
+
+ extu .s1 A4, A7, A4
+ nop 2
+
diff --git a/arch/c6x/lib/strasgi.S b/arch/c6x/lib/strasgi.S
new file mode 100644
index 0000000..6861e25
--- /dev/null
+++ b/arch/c6x/lib/strasgi.S
@@ -0,0 +1,88 @@
+;; Copyright 2010 Free Software Foundation, Inc.
+;; Contributed by Bernd Schmidt <bernds@codesourcery.com>.
+;;
+;; 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.
+
+ .text
+ .global __c6xabi_strasgi
+
+__c6xabi_strasgi:
+
+ ;; This is essentially memcpy, with alignment known to be at least
+ ;; 4, and the size a multiple of 4 greater than or equal to 28.
+ ldw .d2t1 *B4++, A0
+|| mvk .s2 16, B1
+ ldw .d2t1 *B4++, A1
+|| mvk .s2 20, B2
+|| sub .d1 A6, 24, A6
+ ldw .d2t1 *B4++, A5
+ ldw .d2t1 *B4++, A7
+|| mv .l2x A6, B7
+ ldw .d2t1 *B4++, A8
+ ldw .d2t1 *B4++, A9
+|| mv .s2x A0, B5
+|| cmpltu .l2 B2, B7, B0
+
+_strasgi_loop:
+ stw .d1t2 B5, *A4++
+|| [B0] ldw .d2t1 *B4++, A0
+|| mv .s2x A1, B5
+|| mv .l2 B7, B6
+
+ [B0] sub .d2 B6, 24, B7
+|| [B0] b .s2 _strasgi_loop
+|| cmpltu .l2 B1, B6, B0
+
+ [B0] ldw .d2t1 *B4++, A1
+|| stw .d1t2 B5, *A4++
+|| mv .s2x A5, B5
+|| cmpltu .l2 12, B6, B0
+
+ [B0] ldw .d2t1 *B4++, A5
+|| stw .d1t2 B5, *A4++
+|| mv .s2x A7, B5
+|| cmpltu .l2 8, B6, B0
+
+ [B0] ldw .d2t1 *B4++, A7
+|| stw .d1t2 B5, *A4++
+|| mv .s2x A8, B5
+|| cmpltu .l2 4, B6, B0
+
+ [B0] ldw .d2t1 *B4++, A8
+|| stw .d1t2 B5, *A4++
+|| mv .s2x A9, B5
+|| cmpltu .l2 0, B6, B0
+
+ [B0] ldw .d2t1 *B4++, A9
+|| stw .d1t2 B5, *A4++
+|| mv .s2x A0, B5
+|| cmpltu .l2 B2, B7, B0
+
+ ;; loop back branch happens here
+
+ cmpltu .l2 B1, B6, B0
+|| ret .s2 b3
+
+ [B0] stw .d1t1 A1, *A4++
+|| cmpltu .l2 12, B6, B0
+ [B0] stw .d1t1 A5, *A4++
+|| cmpltu .l2 8, B6, B0
+ [B0] stw .d1t1 A7, *A4++
+|| cmpltu .l2 4, B6, B0
+ [B0] stw .d1t1 A8, *A4++
+|| cmpltu .l2 0, B6, B0
+ [B0] stw .d1t1 A9, *A4++
+
+ ;; return happens here
diff --git a/arch/c6x/lib/strasgi_64plus.S b/arch/c6x/lib/strasgi_64plus.S
new file mode 100644
index 0000000..cbeab22
--- /dev/null
+++ b/arch/c6x/lib/strasgi_64plus.S
@@ -0,0 +1,37 @@
+;; Copyright 2010 Free Software Foundation, Inc.
+;; Contributed by Bernd Schmidt <bernds@codesourcery.com>.
+;;
+;; 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.
+
+ .text
+ .global __c6xabi_strasgi_64plus
+
+__c6xabi_strasgi_64plus:
+ shru .s2x a6, 2, b31
+|| mv .s1 a4, a30
+|| mv .d2 b4, b30
+
+ add .s2 -4, b31, b31
+
+ sploopd 1
+|| mvc .s2 b31, ilc
+ ldw .d2t2 *b30++, b31
+ nop 4
+ mv .s1x b31,a31
+ spkernel 6, 0
+|| stw .d1t1 a31, *a30++
+
+ ret .s2 b3
+ nop 5
diff --git a/arch/c6x/lib/unaligned.S b/arch/c6x/lib/unaligned.S
new file mode 100644
index 0000000..a825b4d
--- /dev/null
+++ b/arch/c6x/lib/unaligned.S
@@ -0,0 +1,117 @@
+;
+; arch/c6x/kernel/unaligned.S
+;
+; Port on Texas Instruments TMS320C6x architecture
+;
+; Copyright (C) 2010 Texas Instruments Incorporated
+; Author: Mark Salter (msalter at redhat.com)
+;
+; This program is free software; you can redistribute it and/or modify
+; it under the terms of the GNU General Public License version 2 as
+; published by the Free Software Foundation.
+;
+
+ .text
+ .global get_unaligned_le64
+ .global get_unaligned_be64
+ .global get_unaligned_le32
+ .global get_unaligned_be32
+ .global put_unaligned_le64
+ .global put_unaligned_be64
+ .global put_unaligned_le32
+ .global put_unaligned_be32
+
+; u64 get_unaligned_le64(void *ptr);
+; u64 get_unaligned_be64(void *ptr);
+;
+#ifdef CONFIG_CPU_BIG_ENDIAN
+get_unaligned_le64:
+#else
+get_unaligned_be64:
+#endif
+ LDNDW .D1T1 *A4,A5:A4
+ NOP 2
+ BNOP .S2 B3,1
+ MV .D2X A4,B0
+ SWAP2 .S2 B0,B1
+ || SWAP2 .S1 A5,A0
+ SWAP4 .L2 B1,B0
+ || SWAP4 .L1 A0,A4
+ MV .D1X B0,A5
+
+#ifdef CONFIG_CPU_BIG_ENDIAN
+get_unaligned_be64:
+#else
+get_unaligned_le64:
+#endif
+ BNOP .S2 B3,5
+ || LDNDW .D1T1 *A4,A5:A4
+
+; u32 get_unaligned_le32(void *ptr, int size);
+; u32 get_unaligned_be32(void *ptr, int size);
+;
+#ifdef CONFIG_CPU_BIG_ENDIAN
+get_unaligned_le32:
+#else
+get_unaligned_be32:
+#endif
+ LDNW .D1T1 *A4,A4
+ BNOP .S2 B3,3
+ SWAP2 .S1 A4,A0
+ SWAP4 .L1 A0,A4
+
+#ifdef CONFIG_CPU_BIG_ENDIAN
+get_unaligned_be32:
+#else
+get_unaligned_le32:
+#endif
+ BNOP .S2 B3,5
+ || LDNW .D1T1 *A4,A4
+
+
+; void put_unaligned_le64(u64 val, void *ptr);
+; void put_unaligned_be64(u64 val, void *ptr);
+;
+#ifdef CONFIG_CPU_BIG_ENDIAN
+put_unaligned_le64:
+#else
+put_unaligned_be64:
+#endif
+ B .S2 B3
+ MV .D2X A4,B0
+ SWAP2 .S2 B0,B1
+ || SWAP2 .S1 A5,A0
+ SWAP4 .L2 B1,B0
+ || SWAP4 .L1 A0,A4
+ MV .D1X B0,A5
+ STNDW .D2T1 A5:A4,*B4
+
+#ifdef CONFIG_CPU_BIG_ENDIAN
+put_unaligned_be64:
+#else
+put_unaligned_le64:
+#endif
+ BNOP .S2 B3,5
+ || STNDW .D2T1 A5:A4,*B4
+
+; void put_unaligned_le32(u32 val, void *ptr);
+; void put_unaligned_be32(u32 val, void *ptr);
+;
+#ifdef CONFIG_CPU_BIG_ENDIAN
+put_unaligned_le32:
+#else
+put_unaligned_be32:
+#endif
+ BNOP .S2 B3,2
+ SWAP2 .S1 A4,A5
+ SWAP4 .L1 A5,A4
+ STNW .D2T1 A4,*B4
+
+#ifdef CONFIG_CPU_BIG_ENDIAN
+put_unaligned_be32:
+#else
+put_unaligned_le32:
+#endif
+ BNOP .S2 B3,5
+ || STNW .D2T1 A4,*B4
+
diff --git a/common/cmd_bdinfo.c b/common/cmd_bdinfo.c
index 42f08fd..faf534b 100644
--- a/common/cmd_bdinfo.c
+++ b/common/cmd_bdinfo.c
@@ -513,6 +513,11 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
return 0;
}
+#elif defined(CONFIG_C6X)
+int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+ return 0;
+}
#else
#error "a case for this architecture does not exist!"
diff --git a/common/image.c b/common/image.c
index 91954ac..0fff687 100644
--- a/common/image.c
+++ b/common/image.c
@@ -456,8 +456,12 @@ phys_size_t getenv_bootm_size(void)
#if defined(CONFIG_ARM)
return gd->bd->bi_dram[0].size - tmp;
#else
+#if defined(CONFIG_C6X)
+ return gd->bd->bi_dram[0].size - tmp;
+#else
return gd->bd->bi_memsize - tmp;
#endif
+#endif
}
phys_size_t getenv_bootm_mapsize(void)
diff --git a/examples/standalone/stubs.c b/examples/standalone/stubs.c
index 15e9afc..c9e0819 100644
--- a/examples/standalone/stubs.c
+++ b/examples/standalone/stubs.c
@@ -195,6 +195,21 @@ gd_t *global_data;
" l.jr r13\n" \
" l.nop\n" \
: : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "r13");
+
+#elif defined(CONFIG_C6X)
+/*
+ * b31 holds the pointer to the global_data, a0 is a call-clobbered
+ * register
+ */
+#define EXPORT_FUNC(x) \
+ asm volatile ( \
+" .globl " #x "\n" \
+#x ":\n" \
+" B .S2X A0\n" \
+" NOP 3\n" \
+ : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "A0");
+
+
#else
/*" addi $sp, $sp, -24\n" \
" br $r16\n" \*/
--
1.7.2.5
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [U-Boot] [PATCH v2 2/4] c6x: Add support c674x CPUs
[not found] <add_c6x_arch>
` (2 preceding siblings ...)
2012-06-23 11:11 ` [U-Boot] [PATCH v2 1/4] " Dmitry Bondar
@ 2012-06-23 11:11 ` Dmitry Bondar
2012-06-23 11:11 ` [U-Boot] [PATCH v2 3/4] c6x: Add suport build davinci SOC with " Dmitry Bondar
` (6 subsequent siblings)
10 siblings, 0 replies; 31+ messages in thread
From: Dmitry Bondar @ 2012-06-23 11:11 UTC (permalink / raw)
To: u-boot
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
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*) }
+}
--
1.7.2.5
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [U-Boot] [PATCH v2 3/4] c6x: Add suport build davinci SOC with c674x CPUs
[not found] <add_c6x_arch>
` (3 preceding siblings ...)
2012-06-23 11:11 ` [U-Boot] [PATCH v2 2/4] c6x: Add support c674x CPUs Dmitry Bondar
@ 2012-06-23 11:11 ` Dmitry Bondar
2012-06-23 11:11 ` [U-Boot] [PATCH v2 4/4] c6x: Add support c6745-som board Dmitry Bondar
` (5 subsequent siblings)
10 siblings, 0 replies; 31+ messages in thread
From: Dmitry Bondar @ 2012-06-23 11:11 UTC (permalink / raw)
To: u-boot
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@inmys.ru>
Cc: Tom Rini <trini@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@inmys.ru>
+ * Copyright (C) 2007 Sergey Kubushyn <ksi@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
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [U-Boot] [PATCH v2 4/4] c6x: Add support c6745-som board
[not found] <add_c6x_arch>
` (4 preceding siblings ...)
2012-06-23 11:11 ` [U-Boot] [PATCH v2 3/4] c6x: Add suport build davinci SOC with " Dmitry Bondar
@ 2012-06-23 11:11 ` Dmitry Bondar
2012-06-25 18:02 ` [U-Boot] [PATCH v3 0/4] Add support new arch: c6x Dmitry Bondar
` (4 subsequent siblings)
10 siblings, 0 replies; 31+ messages in thread
From: Dmitry Bondar @ 2012-06-23 11:11 UTC (permalink / raw)
To: u-boot
Add support board c6745-som (http://inmys.ru/?_=/products/som_c6745) with C6745 cpu.
Signed-off-by: Dmitry Bondar <bond@inmys.ru>
Cc: Tom Rini <trini@ti.com>
---
MAINTAINERS | 3 +
board/inmys/c6745-som/Makefile | 27 ++++
board/inmys/c6745-som/c6745-som.c | 247 +++++++++++++++++++++++++++++++
boards.cfg | 1 +
include/configs/c6745-som-inmys.h | 294 +++++++++++++++++++++++++++++++++++++
5 files changed, 572 insertions(+), 0 deletions(-)
create mode 100644 board/inmys/c6745-som/Makefile
create mode 100644 board/inmys/c6745-som/c6745-som.c
create mode 100644 include/configs/c6745-som-inmys.h
diff --git a/MAINTAINERS b/MAINTAINERS
index e55893b..710f3df 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -62,6 +62,9 @@ Jerry Van Baren <gerald.vanbaren@smiths-aerospace.com>
sacsng MPC8260
+Dmitry Bondar <bond@inmys.ru>
+ c6745-som c674x
+
Oliver Brown <obrown@adventnetworks.com>
gw8260 MPC8260
diff --git a/board/inmys/c6745-som/Makefile b/board/inmys/c6745-som/Makefile
new file mode 100644
index 0000000..9a91ed2
--- /dev/null
+++ b/board/inmys/c6745-som/Makefile
@@ -0,0 +1,27 @@
+# (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$(BOARD).o
+
+COBJS-$(CONFIG_MACH_INMYS_C6745_SOM) += c6745-som.o
+
+COBJS := $(COBJS-y)
+
+SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS := $(addprefix $(obj),$(COBJS))
+SOBJS := $(addprefix $(obj),$(SOBJS))
+
+$(LIB): $(obj).depend $(OBJS) $(SOBJS)
+ $(call cmd_link_o_target, $(OBJS) $(SOBJS))
+
+#########################################################################
+# This is for $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/board/inmys/c6745-som/c6745-som.c b/board/inmys/c6745-som/c6745-som.c
new file mode 100644
index 0000000..c4530a2
--- /dev/null
+++ b/board/inmys/c6745-som/c6745-som.c
@@ -0,0 +1,247 @@
+/*
+ * (C) Copyright 2012 Dmitry Bondar <bond@inmys.ru>
+ * From da830. Original Notices follow:
+ *
+ * Copyright (C) 2009 Nick Thompson, GE Fanuc, Ltd. <nick.thompson@gefanuc.com>
+ *
+ * Base on code from TI. Original Notices follow:
+ *
+ * (C) Copyright 2008, Texas Instruments, Inc. http://www.ti.com/
+ *
+ * Modified for DA8xx EVM.
+ *
+ * Copyright (C) 2007 Sergey Kubushyn <ksi@koi8.net>
+ *
+ * Parts are shamelessly stolen from various TI sources, original copyright
+ * follows:
+ * -----------------------------------------------------------------
+ *
+ * Copyright (C) 2004 Texas Instruments.
+ *
+ * ----------------------------------------------------------------------------
+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * ----------------------------------------------------------------------------
+ */
+
+#include <common.h>
+#include <i2c.h>
+#include <net.h>
+#include <netdev.h>
+#include <asm/arch/hardware.h>
+#include <asm/arch/emif_defs.h>
+#include <asm/arch/emac_defs.h>
+#include <asm/io.h>
+#include <asm/arch/davinci_misc.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#define pinmux(x) (&davinci_syscfg_regs->pinmux[x])
+
+/* SPI0 pin muxer settings */
+static const struct pinmux_config spi0_pins[] = {
+ { pinmux(7), 1, 3 },
+ { pinmux(7), 1, 4 },
+ { pinmux(7), 1, 5 },
+ { pinmux(7), 1, 6 },
+ { pinmux(7), 1, 7 }
+};
+
+/* EMIF-A bus pins for 8-bit NAND support on CS3 */
+static const struct pinmux_config emifa_nand_pins[] = {
+ { pinmux(13), 1, 6 },
+ { pinmux(13), 1, 7 },
+ { pinmux(14), 1, 0 },
+ { pinmux(14), 1, 1 },
+ { pinmux(14), 1, 2 },
+ { pinmux(14), 1, 3 },
+ { pinmux(14), 1, 4 },
+ { pinmux(14), 1, 5 },
+ { pinmux(15), 1, 7 },
+ { pinmux(16), 1, 0 },
+ { pinmux(18), 1, 1 },
+ { pinmux(18), 1, 4 },
+ { pinmux(18), 1, 5 },
+};
+
+/* EMAC PHY interface pins */
+static const struct pinmux_config emac_pins[] = {
+ { pinmux(9), 0, 5 },
+ { pinmux(10), 2, 1 },
+ { pinmux(10), 2, 2 },
+ { pinmux(10), 2, 3 },
+ { pinmux(10), 2, 4 },
+ { pinmux(10), 2, 5 },
+ { pinmux(10), 2, 6 },
+ { pinmux(10), 2, 7 },
+ { pinmux(11), 2, 0 },
+ { pinmux(11), 2, 1 },
+};
+
+/* UART pin muxer settings */
+static const struct pinmux_config uart_pins[] = {
+ { pinmux(8), 2, 7 },
+ { pinmux(9), 2, 0 }
+};
+
+/* I2C pin muxer settings */
+static const struct pinmux_config i2c_pins[] = {
+ { pinmux(8), 2, 3 },
+ { pinmux(8), 2, 4 }
+};
+
+/* USB0_DRVVBUS pin muxer settings */
+static const struct pinmux_config usb_pins[] = {
+ { pinmux(9), 1, 1 }
+};
+
+static const struct pinmux_resource pinmuxes[] = {
+#ifdef CONFIG_SPI_FLASH
+ PINMUX_ITEM(spi0_pins),
+#endif
+ PINMUX_ITEM(uart_pins),
+ PINMUX_ITEM(i2c_pins),
+#ifdef CONFIG_USB_DA8XX
+ PINMUX_ITEM(usb_pins),
+#endif
+#ifdef CONFIG_USE_NAND
+ PINMUX_ITEM(emifa_nand_pins),
+#endif
+#if defined(CONFIG_DRIVER_TI_EMAC)
+ PINMUX_ITEM(emac_pins),
+#endif
+};
+
+static const struct lpsc_resource lpsc[] = {
+ { DAVINCI_LPSC_AEMIF }, /* NAND, NOR */
+ { DAVINCI_LPSC_SPI0 }, /* Serial Flash */
+ { DAVINCI_LPSC_EMAC }, /* image download */
+ { DAVINCI_LPSC_UART2 }, /* console */
+ { DAVINCI_LPSC_GPIO },
+};
+
+int board_early_init_f(void)
+{
+#ifndef CONFIG_USE_IRQ
+ irq_init();
+#endif
+
+#ifdef CONFIG_NAND_DAVINCI
+ /* EMIFA 100MHz clock select */
+ writel(readl(&davinci_syscfg_regs->cfgchip3) & ~2,
+ &davinci_syscfg_regs->cfgchip3);
+ /* NAND CS setup */
+ writel((DAVINCI_ABCR_WSETUP(0) |
+ DAVINCI_ABCR_WSTROBE(2) |
+ DAVINCI_ABCR_WHOLD(0) |
+ DAVINCI_ABCR_RSETUP(0) |
+ DAVINCI_ABCR_RSTROBE(2) |
+ DAVINCI_ABCR_RHOLD(0) |
+ DAVINCI_ABCR_TA(2) |
+ DAVINCI_ABCR_ASIZE_8BIT),
+ &davinci_emif_regs->ab2cr);
+#endif
+
+ /* arch number of the board */
+ /*gd->bd->bi_arch_number = MACH_TYPE_DAVINCI_DA830_EVM;*/
+ gd->bd->bi_arch_number = 0;
+
+ /* address of boot parameters */
+ gd->bd->bi_boot_params = LINUX_BOOT_PARAM_ADDR;
+
+ /*
+ * Power on required peripherals
+ * ARM does not have access by default to PSC0 and PSC1
+ * assuming here that the DSP bootloader has set the IOPU
+ * such that PSC access is available to ARM
+ */
+ if (da8xx_configure_lpsc_items(lpsc, ARRAY_SIZE(lpsc)))
+ return 1;
+
+ /* setup the SUSPSRC for ARM to control emulation suspend */
+ writel(readl(&davinci_syscfg_regs->suspsrc) &
+ ~(DAVINCI_SYSCFG_SUSPSRC_EMAC | DAVINCI_SYSCFG_SUSPSRC_I2C |
+ DAVINCI_SYSCFG_SUSPSRC_SPI0 | DAVINCI_SYSCFG_SUSPSRC_TIMER0 |
+ DAVINCI_SYSCFG_SUSPSRC_UART2),
+ &davinci_syscfg_regs->suspsrc);
+
+#if 1
+ /* configure pinmux settings */
+ if (davinci_configure_pin_mux_items(pinmuxes, ARRAY_SIZE(pinmuxes)))
+ return 1;
+#endif
+ /*
+ * If we boot over UART, Terminal doesn't display characters
+ * Reset the values set by Boot ROM
+ */
+#if 1
+ {
+ int j;
+ for (j = 0; j < 15; j++){
+ REG(DAVINCI_UART2_BASE + (j*4)) = 0;
+ }
+ }
+ REG(DAVINCI_UART2_BASE + 0x30) = 1 | (1 << 13) | (1 << 14);
+#endif
+ /* enable the console UART */
+ writel((DAVINCI_UART_PWREMU_MGMT_FREE | DAVINCI_UART_PWREMU_MGMT_URRST |
+ DAVINCI_UART_PWREMU_MGMT_UTRST),
+ &davinci_uart2_ctrl_regs->pwremu_mgmt);
+
+ return 0;
+}
+
+int board_init()
+{
+ return 0;
+}
+
+
+#if defined(CONFIG_DRIVER_TI_EMAC)
+
+#define PHY_SW_I2C_ADDR 0x57 /* Address of PHY on i2c bus */
+
+/*
+ * Initializes on-board ethernet controllers.
+ */
+int board_eth_init(bd_t *bis)
+{
+ u_int8_t mac_addr[6];
+ struct eth_device *dev;
+
+ /* Read Ethernet MAC address from EEPROM */
+ if (dvevm_read_mac_address(mac_addr))
+ /* set address env if not already set */
+ davinci_sync_env_enetaddr(mac_addr);
+
+ /* read the address back from env */
+ if (!eth_getenv_enetaddr("ethaddr", mac_addr))
+ return -1;
+
+ /* finally, initialise the driver */
+ if (!davinci_emac_initialize()) {
+ printf("Error: Ethernet init failed!\n");
+ return -1;
+ }
+
+ dev = eth_get_dev();
+
+ /* provide the resulting addr to the driver */
+ memcpy(dev->enetaddr, mac_addr, 6);
+ dev->write_hwaddr(dev);
+
+ return 0;
+}
+#endif /* CONFIG_DRIVER_TI_EMAC */
+
diff --git a/boards.cfg b/boards.cfg
index a723f67..7acbfd1 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -302,6 +302,7 @@ ip04 blackfin blackfin
pr1 blackfin blackfin
tcm-bf518 blackfin blackfin
tcm-bf537 blackfin blackfin
+c6745-som-inmys c6x c674x c6745-som inmys davinci c6745-som-inmys
M52277EVB m68k mcf5227x m52277evb freescale - M52277EVB:SYS_SPANSION_BOOT,SYS_TEXT_BASE=0x00000000
M52277EVB_stmicro m68k mcf5227x m52277evb freescale - M52277EVB:CF_SBF,SYS_STMICRO_BOOT,SYS_TEXT_BASE=0x43E00000
M5235EVB m68k mcf523x m5235evb freescale - M5235EVB:SYS_TEXT_BASE=0xFFE00000
diff --git a/include/configs/c6745-som-inmys.h b/include/configs/c6745-som-inmys.h
new file mode 100644
index 0000000..7c8d567
--- /dev/null
+++ b/include/configs/c6745-som-inmys.h
@@ -0,0 +1,294 @@
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+/* Based on da830evm.h
+*/
+#define TMPVAL 0
+
+/*
+ * Board
+ */
+#define CONFIG_USE_NAND
+#define CONFIG_DRIVER_TI_EMAC
+#define CONFIG_CMD_GPIO
+#define CONFIG_DA8XX_GPIO
+/*#define CONFIG_DISPLAY_CPUINFO*/
+#define CONFIG_SKIP_LOWLEVEL_INIT
+
+#if 0
+#define CONFIG_USE_SPIFLASH
+#endif
+
+/*
+ * SoC Configuration
+ */
+#define CONFIG_MACH_INMYS_C6745_SOM
+#define CONFIG_C6X /* */
+#define CONFIG_SOC_DA8XX /* TI DA8xx SoC */
+#define CONFIG_SYS_CLK_FREQ clk_get(DAVINCI_ARM_CLKID)
+#define CONFIG_SYS_OSCIN_FREQ 24000000
+#define CONFIG_SYS_TIMERBASE DAVINCI_TIMER0_BASE
+#define CONFIG_SYS_HZ_CLOCK clk_get(DAVINCI_AUXCLK_CLKID)
+#define CONFIG_SYS_HZ 1000
+#define CONFIG_SKIP_LOWLEVEL_INIT
+#define CONFIG_SYS_TEXT_BASE 0xc1f80000
+#define CONFIG_BOARD_EARLY_INIT_F
+
+
+/*
+ * Memory Info
+ */
+#define CONFIG_SYS_MALLOC_LEN (0x10000 + 1*1024*1024) /* malloc() len */
+#define PHYS_SDRAM_1 0xc0000000 /* SDRAM Start */
+#define CONFIG_SYS_MEMTEST_START (PHYS_SDRAM_1 + 0x2000000)
+#define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_MEMTEST_START + (32 << 20))
+#define CONFIG_SYS_SDRAM_SIZE (32*1024*1024)
+#define CONFIG_NR_DRAM_BANKS 1 /* we have 1 bank of DRAM */
+#define CONFIG_STACKSIZE (256*1024) /* regular stack */
+
+/*
+ * Memory organisation:
+ *
+ * RAM start ---------------------------
+ * | ... |
+ * ---------------------------
+ * | Stack |
+ * ---------------------------
+ * | Global data |
+ * ---------------------------
+ * | Environment |
+ * ---------------------------
+ * | Monitor |
+ * RAM end ---------------------------
+ */
+/* We're running in RAM */
+#define CONFIG_MONITOR_IS_IN_RAM
+#define CONFIG_SYS_MONITOR_LEN 0x80000 /* Reserve 512k */
+#define CONFIG_SYS_MONITOR_BASE (CONFIG_SYS_SDRAM_BASE + \
+ CONFIG_SYS_SDRAM_SIZE - \
+ CONFIG_SYS_MONITOR_LEN)
+
+#define CONFIG_SYS_GBL_DATA_OFFSET (CONFIG_SYS_MONITOR_BASE - \
+ GENERATED_GBL_DATA_SIZE)
+#define CONFIG_SYS_GBL_DATA_ADDR CONFIG_SYS_GBL_DATA_OFFSET
+#define CONFIG_SYS_INIT_SP_ADDR CONFIG_SYS_GBL_DATA_OFFSET
+#define CONFIG_SYS_INIT_SP_OFFSET CONFIG_SYS_GBL_DATA_OFFSET
+#define CONFIG_SYS_MALLOC_BASE (CONFIG_SYS_INIT_SP_OFFSET \
+ - CONFIG_STACKSIZE \
+ - CONFIG_SYS_MALLOC_LEN)
+
+/*
+ * Serial Driver info
+ */
+#define CONFIG_SYS_NS16550
+#define CONFIG_SYS_NS16550_SERIAL
+#define CONFIG_SYS_NS16550_REG_SIZE -4 /* NS16550 register size */
+#define CONFIG_SYS_NS16550_COM1 DAVINCI_UART2_BASE /* Base address of UART2 */
+#define CONFIG_SYS_NS16550_CLK clk_get(DAVINCI_UART2_CLKID)
+#define CONFIG_CONS_INDEX 1 /* use UART0 for console */
+#define CONFIG_BAUDRATE 115200 /* Default baud rate */
+#define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 }
+
+#if 1
+/*
+ * I2C Configuration
+ */
+#define CONFIG_HARD_I2C
+#define CONFIG_DRIVER_DAVINCI_I2C
+#define CONFIG_SYS_I2C_SPEED 25000 /* 100Kbps won't work, H/W bug */
+#define CONFIG_SYS_I2C_SLAVE 10 /* Bogus, master-only in U-Boot */
+
+
+#define CONFIG_CMD_I2C
+
+#define CONFIG_CMD_DATE
+#define CONFIG_RTC_PCF8563
+#define CONFIG_SYS_I2C_RTC_ADDR 0x51
+
+#define CONFIG_CMD_EEPROM
+/* EEPROM configuration */
+#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1
+#define CONFIG_SYS_EEPROM_SIZE 256
+#define CONFIG_SYS_I2C_EEPROM_ADDR 0x57
+
+#endif
+
+/*
+ * Network & Ethernet Configuration
+ */
+#ifdef CONFIG_DRIVER_TI_EMAC
+#define CONFIG_EMAC_MDIO_PHY_NUM 1
+#define CONFIG_MII
+#define CONFIG_BOOTP_DEFAULT
+#define CONFIG_BOOTP_DNS
+#define CONFIG_BOOTP_DNS2
+#define CONFIG_BOOTP_SEND_HOSTNAME
+#define CONFIG_NET_RETRY_COUNT 10
+#endif
+
+
+/*
+ * Flash & Environment
+ */
+#undef CONFIG_ENV_IS_IN_FLASH
+#define CONFIG_NAND_DAVINCI
+#define CONFIG_SYS_NO_FLASH
+#define CONFIG_ENV_IS_IN_NAND /* U-Boot env in NAND Flash */
+#define CONFIG_ENV_OFFSET 0
+#define CONFIG_ENV_SIZE (128*1024)
+#define CONFIG_SYS_NAND_4BIT_HW_ECC_OOBFIRST
+#define CONFIG_SYS_NAND_CS 3
+#define CONFIG_SYS_NAND_BASE DAVINCI_ASYNC_EMIF_DATA_CE3_BASE
+#define CONFIG_SYS_NAND_PAGE_2K
+#define CONFIG_SYS_64BIT_VSPRINTF /* needed for nand_util.c */
+#define CONFIG_SYS_CLE_MASK 0x10
+#define CONFIG_SYS_ALE_MASK 0x8
+#define CONFIG_SYS_MAX_NAND_DEVICE 1 /* Max number of NAND devices */
+#define NAND_MAX_CHIPS 1
+
+#if 1
+/*
+ * USB configuration
+ */
+#define CONFIG_USB_DA8XX /* Platform hookup to MUSB controller */
+#define CONFIG_MUSB_HCD
+
+#endif
+
+/*
+ * U-Boot general configuration
+ */
+#undef CONFIG_USE_IRQ /* No IRQ/FIQ in U-Boot */
+#undef CONFIG_MISC_INIT_R
+#undef CONFIG_BOOTDELAY
+#define CONFIG_BOOTFILE "uImage" /* Boot file name */
+#define CONFIG_SYS_PROMPT "c6745-som > " /* Command Prompt */
+#define CONFIG_SYS_CBSIZE 1024 /* Console I/O Buffer Size */
+#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE+sizeof(CONFIG_SYS_PROMPT)+16)
+#define CONFIG_SYS_MAXARGS 16 /* max number of command args */
+#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE /* Boot Args Buffer Size */
+#define CONFIG_SYS_LOAD_ADDR (PHYS_SDRAM_1 + 0x700000)
+#define CONFIG_VERSION_VARIABLE
+#define CONFIG_AUTO_COMPLETE /* Won't work with hush so far, may be later */
+#define CONFIG_SYS_HUSH_PARSER
+#define CONFIG_SYS_PROMPT_HUSH_PS2 "> "
+#define CONFIG_CMDLINE_EDITING
+#define CONFIG_SYS_LONGHELP
+#define CONFIG_CRC32_VERIFY
+#define CONFIG_MX_CYCLIC
+
+/*
+ * Linux Information
+ */
+#define LINUX_BOOT_PARAM_ADDR (PHYS_SDRAM_1 + 0x100)
+#define CONFIG_CMDLINE_TAG
+#define CONFIG_SETUP_MEMORY_TAGS
+#define CONFIG_BOOTARGS "mem=32M console=ttyS2,115200n8 root=/dev/mtdblock/2 rw noinitrd ip=dhcp"
+#define CONFIG_BOOTCOMMAND ""
+#define CONFIG_BOOTDELAY 3
+
+/*
+ * U-Boot commands
+ */
+#include <config_cmd_default.h>
+#define CONFIG_CMD_ENV
+#define CONFIG_CMD_ASKENV
+
+#define CONFIG_CMD_DHCP
+#define CONFIG_CMD_DIAG
+#define CONFIG_CMD_MII
+#define CONFIG_CMD_PING
+
+#define CONFIG_CMD_SAVES
+#define CONFIG_CMD_MEMORY
+#undef CONFIG_CMD_FPGA
+#undef CONFIG_CMD_SETGETDCR
+
+#ifndef CONFIG_DRIVER_TI_EMAC
+#undef CONFIG_CMD_NET
+#undef CONFIG_CMD_DHCP
+#undef CONFIG_CMD_MII
+#undef CONFIG_CMD_PING
+#endif
+
+#ifdef CONFIG_USE_NAND
+#undef CONFIG_CMD_FLASH
+#undef CONFIG_CMD_IMLS
+#define CONFIG_CMD_NAND
+#define CONFIG_CMD_MTDPARTS
+#define CONFIG_MTD_PARTITIONS
+#define CONFIG_MTD_DEVICE
+#endif
+
+#ifdef CONFIG_USE_SPIFLASH
+#undef CONFIG_CMD_IMLS
+#undef CONFIG_CMD_FLASH
+#define CONFIG_CMD_SPI
+#define CONFIG_CMD_SF
+#define CONFIG_CMD_SAVEENV
+#endif
+
+#if !defined(CONFIG_USE_NAND) && \
+ !defined(CONFIG_USE_NOR) && \
+ !defined(CONFIG_USE_SPIFLASH)
+#define CONFIG_ENV_IS_NOWHERE
+#define CONFIG_SYS_NO_FLASH
+#define CONFIG_ENV_SIZE (16 << 10)
+#undef CONFIG_CMD_IMLS
+#undef CONFIG_CMD_FLASH
+#undef CONFIG_CMD_ENV
+#endif
+
+#ifdef CONFIG_USB_DA8XX
+
+#ifdef CONFIG_MUSB_HCD /* include support for usb host */
+#define CONFIG_CMD_USB /* include support for usb cmd */
+
+#define CONFIG_USB_STORAGE /* MSC class support */
+#define CONFIG_CMD_STORAGE /* inclue support for usb-storage cmd */
+#define CONFIG_CMD_FAT /* inclue support for FAT/storage */
+#define CONFIG_DOS_PARTITION /* inclue support for FAT/storage */
+
+#ifdef CONFIG_USB_KEYBOARD /* HID class support */
+#define CONFIG_SYS_USB_EVENT_POLL
+#define CONFIG_PREBOOT "usb start"
+#endif /* CONFIG_USB_KEYBOARD */
+
+#endif /* CONFIG_MUSB_HCD */
+
+#ifdef CONFIG_MUSB_UDC
+/* USB device configuration */
+#define CONFIG_USB_DEVICE 1
+#define CONFIG_USB_TTY 1
+#define CONFIG_SYS_CONSOLE_IS_IN_ENV 1
+/* Change these to suit your needs */
+#define CONFIG_USBD_VENDORID 0x0451
+#define CONFIG_USBD_PRODUCTID 0x5678
+#define CONFIG_USBD_MANUFACTURER "InMys"
+#define CONFIG_USBD_PRODUCT_NAME "c6745-som"
+#endif /* CONFIG_MUSB_UDC */
+
+#endif /* CONFIG_USB_DA8XX */
+
+#ifdef CONFIG_MTD_PARTITIONS
+#define MTDIDS_DEFAULT "nand0=davinci_nand.1"
+#define PART_BOOT "512k(bootloader)ro,"
+#define PART_PARAMS "512k(params)ro,"
+#define PART_KERNEL "4m(kernel),"
+#define PART_REST "-(filesystem)"
+#define MTDPARTS_DEFAULT \
+ "mtdparts=davinci_nand.1:" PART_BOOT PART_PARAMS PART_KERNEL PART_REST
+#endif
+
+#define CONFIG_MAX_RAM_BANK_SIZE (512 << 20) /* max size from SPRS586*/
+
+/* additions for new relocation code, must be added to all boards */
+#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM_1
+
+#undef CONFIG_CMD_NFS
+#undef CONFIG_CMD_BOOTD
+#undef CONFIG_RESET_TO_RETRY
+
+#define CONFIG_STANDALONE_LOAD_ADDR 0xc1f80000
+
+#endif /* __CONFIG_H */
--
1.7.2.5
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [U-Boot] [PATCH v2 0/4] Add support new arch: c6x
2012-06-23 11:11 ` [U-Boot] [PATCH v2 0/4] Add support new arch: c6x Dmitry Bondar
@ 2012-06-23 12:33 ` Wolfgang Denk
2012-06-24 11:40 ` bond at inmys.ru
0 siblings, 1 reply; 31+ messages in thread
From: Wolfgang Denk @ 2012-06-23 12:33 UTC (permalink / raw)
To: u-boot
Dear Dmitry Bondar,
In message <1340449870-26456-1-git-send-email-bond@inmys.ru> you wrote:
> C6X (C6000) is family of fixed and floating-point DSPs manufactured by Texas Instruments.
>
> Signed-off-by: Dmitry Bondar <bond@inmys.ru>
> Cc: Tom Rini <trini@ti.com>
>
> ---
> Changes for v2:
> - davinci SOC reset_c.c rewritten with readl/writel.
> - Tom Rini <trini@ti.com> added to cc
Please run your patches through checkpatch and fix the issues. Then
try and resubmit:
WARNING: do not add new typedefs
#377: FILE: arch/c6x/include/asm/global_data.h:36:
+typedef struct global_data {
WARNING: line over 80 characters
#418: FILE: arch/c6x/include/asm/global_data.h:77:
+#define GD_FLG_RELOC 0x00001 /* Code was relocated to RAM */
WARNING: line over 80 characters
#419: FILE: arch/c6x/include/asm/global_data.h:78:
+#define GD_FLG_DEVINIT 0x00002 /* Devices have been initialized */
WARNING: line over 80 characters
#420: FILE: arch/c6x/include/asm/global_data.h:79:
+#define GD_FLG_SILENT 0x00004 /* Silent mode */
WARNING: line over 80 characters
#421: FILE: arch/c6x/include/asm/global_data.h:80:
+#define GD_FLG_POSTFAIL 0x00008 /* Critical POST test failed */
WARNING: line over 80 characters
#422: FILE: arch/c6x/include/asm/global_data.h:81:
+#define GD_FLG_POSTSTOP 0x00010 /* POST seqeunce aborted */
WARNING: line over 80 characters
#423: FILE: arch/c6x/include/asm/global_data.h:82:
+#define GD_FLG_LOGINIT 0x00020 /* Log Buffer has been initialized */
WARNING: line over 80 characters
#424: FILE: arch/c6x/include/asm/global_data.h:83:
+#define GD_FLG_DISABLE_CONSOLE 0x00040 /* Disable console (in & out) */
WARNING: line over 80 characters
#425: FILE: arch/c6x/include/asm/global_data.h:84:
+#define GD_FLG_ENV_READY 0x00080 /* Environment imported into hash table */
WARNING: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt
#427: FILE: arch/c6x/include/asm/global_data.h:86:
+#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("B31")
WARNING: line over 80 characters
#457: FILE: arch/c6x/include/asm/io.h:14:
+static inline unsigned char __readb(volatile unsigned char *addr) { return (*addr); }
WARNING: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt
#457: FILE: arch/c6x/include/asm/io.h:14:
+static inline unsigned char __readb(volatile unsigned char *addr) { return (*addr); }
WARNING: line over 80 characters
#458: FILE: arch/c6x/include/asm/io.h:15:
+static inline unsigned short __readw(volatile unsigned short *addr) { return (*addr); }
WARNING: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt
#458: FILE: arch/c6x/include/asm/io.h:15:
+static inline unsigned short __readw(volatile unsigned short *addr) { return (*addr); }
WARNING: line over 80 characters
#459: FILE: arch/c6x/include/asm/io.h:16:
+static inline unsigned long __readl(volatile unsigned int *addr) { return (*addr); }
WARNING: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt
#459: FILE: arch/c6x/include/asm/io.h:16:
+static inline unsigned long __readl(volatile unsigned int *addr) { return (*addr); }
WARNING: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt
#461: FILE: arch/c6x/include/asm/io.h:18:
+#define readb(addr) __readb((volatile unsigned char *) (addr))
WARNING: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt
#462: FILE: arch/c6x/include/asm/io.h:19:
+#define readw(addr) __readw((volatile unsigned short *) (addr))
WARNING: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt
#463: FILE: arch/c6x/include/asm/io.h:20:
+#define readl(addr) __readl((volatile unsigned int *) (addr))
ERROR: space required after that ',' (ctx:VxV)
#465: FILE: arch/c6x/include/asm/io.h:22:
+#define writeb(b,addr) ((*(volatile unsigned char *) (addr)) = (b))
^
WARNING: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt
#465: FILE: arch/c6x/include/asm/io.h:22:
+#define writeb(b,addr) ((*(volatile unsigned char *) (addr)) = (b))
ERROR: space required after that ',' (ctx:VxV)
#466: FILE: arch/c6x/include/asm/io.h:23:
+#define writew(b,addr) ((*(volatile unsigned short *) (addr)) = (b))
^
WARNING: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt
#466: FILE: arch/c6x/include/asm/io.h:23:
+#define writew(b,addr) ((*(volatile unsigned short *) (addr)) = (b))
ERROR: space required after that ',' (ctx:VxV)
#467: FILE: arch/c6x/include/asm/io.h:24:
+#define writel(b,addr) ((*(volatile unsigned int *) (addr)) = (b))
^
WARNING: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt
#467: FILE: arch/c6x/include/asm/io.h:24:
+#define writel(b,addr) ((*(volatile unsigned int *) (addr)) = (b))
WARNING: line over 80 characters
#478: FILE: arch/c6x/include/asm/io.h:35:
+ ({ unsigned short __v = le16_to_cpu(*(volatile unsigned short *) (addr)); __v; })
WARNING: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt
#478: FILE: arch/c6x/include/asm/io.h:35:
+ ({ unsigned short __v = le16_to_cpu(*(volatile unsigned short *) (addr)); __v; })
WARNING: line over 80 characters
#480: FILE: arch/c6x/include/asm/io.h:37:
+ ({ unsigned int __v = le32_to_cpu(*(volatile unsigned int *) (addr)); __v; })
WARNING: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt
#480: FILE: arch/c6x/include/asm/io.h:37:
+ ({ unsigned int __v = le32_to_cpu(*(volatile unsigned int *) (addr)); __v; })
WARNING: line over 80 characters
#481: FILE: arch/c6x/include/asm/io.h:38:
+#define out_le16(addr,w) (void)((*(volatile unsigned short *) (addr)) = cpu_to_le16(w))
ERROR: space required after that ',' (ctx:VxV)
#481: FILE: arch/c6x/include/asm/io.h:38:
+#define out_le16(addr,w) (void)((*(volatile unsigned short *) (addr)) = cpu_to_le16(w))
^
WARNING: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt
#481: FILE: arch/c6x/include/asm/io.h:38:
+#define out_le16(addr,w) (void)((*(volatile unsigned short *) (addr)) = cpu_to_le16(w))
WARNING: line over 80 characters
#482: FILE: arch/c6x/include/asm/io.h:39:
+#define out_le32(addr,l) (void)((*(volatile unsigned int *) (addr)) = cpu_to_le32(l))
ERROR: space required after that ',' (ctx:VxV)
#482: FILE: arch/c6x/include/asm/io.h:39:
+#define out_le32(addr,l) (void)((*(volatile unsigned int *) (addr)) = cpu_to_le32(l))
^
WARNING: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt
#482: FILE: arch/c6x/include/asm/io.h:39:
+#define out_le32(addr,l) (void)((*(volatile unsigned int *) (addr)) = cpu_to_le32(l))
WARNING: do not add new typedefs
#520: FILE: arch/c6x/include/asm/posix_types.h:18:
+typedef unsigned int __kernel_dev_t;
WARNING: do not add new typedefs
#521: FILE: arch/c6x/include/asm/posix_types.h:19:
+typedef unsigned long __kernel_ino_t;
WARNING: do not add new typedefs
#522: FILE: arch/c6x/include/asm/posix_types.h:20:
+typedef unsigned long long __kernel_ino64_t;
WARNING: do not add new typedefs
#523: FILE: arch/c6x/include/asm/posix_types.h:21:
+typedef unsigned int __kernel_mode_t;
WARNING: do not add new typedefs
#524: FILE: arch/c6x/include/asm/posix_types.h:22:
+typedef unsigned int __kernel_nlink_t;
WARNING: do not add new typedefs
#525: FILE: arch/c6x/include/asm/posix_types.h:23:
+typedef long __kernel_off_t;
WARNING: do not add new typedefs
#526: FILE: arch/c6x/include/asm/posix_types.h:24:
+typedef long long __kernel_loff_t;
WARNING: do not add new typedefs
#527: FILE: arch/c6x/include/asm/posix_types.h:25:
+typedef int __kernel_pid_t;
WARNING: do not add new typedefs
#528: FILE: arch/c6x/include/asm/posix_types.h:26:
+typedef unsigned short __kernel_ipc_pid_t;
WARNING: do not add new typedefs
#529: FILE: arch/c6x/include/asm/posix_types.h:27:
+typedef unsigned int __kernel_uid_t;
WARNING: do not add new typedefs
#530: FILE: arch/c6x/include/asm/posix_types.h:28:
+typedef unsigned int __kernel_gid_t;
WARNING: do not add new typedefs
#531: FILE: arch/c6x/include/asm/posix_types.h:29:
+typedef unsigned int __kernel_size_t;
WARNING: do not add new typedefs
#532: FILE: arch/c6x/include/asm/posix_types.h:30:
+typedef int __kernel_ssize_t;
WARNING: do not add new typedefs
#533: FILE: arch/c6x/include/asm/posix_types.h:31:
+typedef int __kernel_ptrdiff_t;
WARNING: do not add new typedefs
#534: FILE: arch/c6x/include/asm/posix_types.h:32:
+typedef long __kernel_time_t;
WARNING: do not add new typedefs
#535: FILE: arch/c6x/include/asm/posix_types.h:33:
+typedef long __kernel_suseconds_t;
WARNING: do not add new typedefs
#536: FILE: arch/c6x/include/asm/posix_types.h:34:
+typedef long __kernel_clock_t;
WARNING: do not add new typedefs
#537: FILE: arch/c6x/include/asm/posix_types.h:35:
+typedef int __kernel_daddr_t;
WARNING: do not add new typedefs
#538: FILE: arch/c6x/include/asm/posix_types.h:36:
+typedef char *__kernel_caddr_t;
WARNING: do not add new typedefs
#539: FILE: arch/c6x/include/asm/posix_types.h:37:
+typedef unsigned short __kernel_uid16_t;
WARNING: do not add new typedefs
#540: FILE: arch/c6x/include/asm/posix_types.h:38:
+typedef unsigned short __kernel_gid16_t;
WARNING: do not add new typedefs
#541: FILE: arch/c6x/include/asm/posix_types.h:39:
+typedef unsigned int __kernel_uid32_t;
WARNING: do not add new typedefs
#542: FILE: arch/c6x/include/asm/posix_types.h:40:
+typedef unsigned int __kernel_gid32_t;
WARNING: do not add new typedefs
#544: FILE: arch/c6x/include/asm/posix_types.h:42:
+typedef unsigned short __kernel_old_uid_t;
WARNING: do not add new typedefs
#545: FILE: arch/c6x/include/asm/posix_types.h:43:
+typedef unsigned short __kernel_old_gid_t;
WARNING: do not add new typedefs
#548: FILE: arch/c6x/include/asm/posix_types.h:46:
+typedef struct {
WARNING: line over 80 characters
#608: FILE: arch/c6x/include/asm/ptrace.h:18:
+#if defined(__TMS320C6XPLUS__) || defined(_TMS320C6400_PLUS) || defined(__TMS320C66X__)
ERROR: trailing whitespace
#615: FILE: arch/c6x/include/asm/ptrace.h:25:
+#define PT_LO(odd,even) odd $
ERROR: space required after that ',' (ctx:VxV)
#615: FILE: arch/c6x/include/asm/ptrace.h:25:
+#define PT_LO(odd,even) odd
^
ERROR: space required after that ',' (ctx:VxV)
#616: FILE: arch/c6x/include/asm/ptrace.h:26:
+#define PT_HI(odd,even) even
^
ERROR: space required after that ',' (ctx:VxV)
#618: FILE: arch/c6x/include/asm/ptrace.h:28:
+#define PT_LO(odd,even) even
^
ERROR: space required after that ',' (ctx:VxV)
#619: FILE: arch/c6x/include/asm/ptrace.h:29:
+#define PT_HI(odd,even) odd
^
WARNING: line over 80 characters
#622: FILE: arch/c6x/include/asm/ptrace.h:32:
+#if defined(__TMS320C6XPLUS__) || defined(_TMS320C6400_PLUS) || defined(__TMS320C66X__)
ERROR: space required after that ',' (ctx:VxV)
#624: FILE: arch/c6x/include/asm/ptrace.h:34:
+#define PT_A4_ORG PT_LO(1,0)
^
ERROR: space required after that ',' (ctx:VxV)
#625: FILE: arch/c6x/include/asm/ptrace.h:35:
+#define PT_TSR PT_HI(1,0)
^
ERROR: space required after that ',' (ctx:VxV)
#626: FILE: arch/c6x/include/asm/ptrace.h:36:
+#define PT_ILC PT_LO(3,2)
^
ERROR: space required after that ',' (ctx:VxV)
#627: FILE: arch/c6x/include/asm/ptrace.h:37:
+#define PT_RILC PT_HI(3,2)
^
ERROR: space required after that ',' (ctx:VxV)
#628: FILE: arch/c6x/include/asm/ptrace.h:38:
+#define PT_CSR PT_LO(5,4)
^
ERROR: space required after that ',' (ctx:VxV)
#629: FILE: arch/c6x/include/asm/ptrace.h:39:
+#define PT_PC PT_HI(5,4)
^
ERROR: space required after that ',' (ctx:VxV)
#630: FILE: arch/c6x/include/asm/ptrace.h:40:
+#define PT_B16 PT_LO(7,6)
^
ERROR: space required after that ',' (ctx:VxV)
#631: FILE: arch/c6x/include/asm/ptrace.h:41:
+#define PT_B17 PT_HI(7,6)
^
ERROR: space required after that ',' (ctx:VxV)
#632: FILE: arch/c6x/include/asm/ptrace.h:42:
+#define PT_B18 PT_LO(9,8)
^
ERROR: space required after that ',' (ctx:VxV)
#633: FILE: arch/c6x/include/asm/ptrace.h:43:
+#define PT_B19 PT_HI(9,8)
^
ERROR: space required after that ',' (ctx:VxV)
#634: FILE: arch/c6x/include/asm/ptrace.h:44:
+#define PT_B20 PT_LO(11,10)
^
ERROR: space required after that ',' (ctx:VxV)
#635: FILE: arch/c6x/include/asm/ptrace.h:45:
+#define PT_B21 PT_HI(11,10)
^
ERROR: space required after that ',' (ctx:VxV)
#636: FILE: arch/c6x/include/asm/ptrace.h:46:
+#define PT_B22 PT_LO(13,12)
^
ERROR: space required after that ',' (ctx:VxV)
#637: FILE: arch/c6x/include/asm/ptrace.h:47:
+#define PT_B23 PT_HI(13,12)
^
ERROR: space required after that ',' (ctx:VxV)
#638: FILE: arch/c6x/include/asm/ptrace.h:48:
+#define PT_B24 PT_LO(15,14)
^
ERROR: space required after that ',' (ctx:VxV)
#639: FILE: arch/c6x/include/asm/ptrace.h:49:
+#define PT_B25 PT_HI(15,14)
^
ERROR: space required after that ',' (ctx:VxV)
#640: FILE: arch/c6x/include/asm/ptrace.h:50:
+#define PT_B26 PT_LO(17,16)
^
ERROR: space required after that ',' (ctx:VxV)
#641: FILE: arch/c6x/include/asm/ptrace.h:51:
+#define PT_B27 PT_HI(17,16)
^
ERROR: space required after that ',' (ctx:VxV)
#642: FILE: arch/c6x/include/asm/ptrace.h:52:
+#define PT_B28 PT_LO(19,18)
^
ERROR: space required after that ',' (ctx:VxV)
#643: FILE: arch/c6x/include/asm/ptrace.h:53:
+#define PT_B29 PT_HI(19,18)
^
ERROR: space required after that ',' (ctx:VxV)
#644: FILE: arch/c6x/include/asm/ptrace.h:54:
+#define PT_B30 PT_LO(21,20)
^
ERROR: space required after that ',' (ctx:VxV)
#645: FILE: arch/c6x/include/asm/ptrace.h:55:
+#define PT_B31 PT_HI(21,20)
^
ERROR: space required after that ',' (ctx:VxV)
#646: FILE: arch/c6x/include/asm/ptrace.h:56:
+#define PT_B0 PT_LO(23,22)
^
ERROR: space required after that ',' (ctx:VxV)
#647: FILE: arch/c6x/include/asm/ptrace.h:57:
+#define PT_B1 PT_HI(23,22)
^
ERROR: space required after that ',' (ctx:VxV)
#648: FILE: arch/c6x/include/asm/ptrace.h:58:
+#define PT_B2 PT_LO(25,24)
^
ERROR: space required after that ',' (ctx:VxV)
#649: FILE: arch/c6x/include/asm/ptrace.h:59:
+#define PT_B3 PT_HI(25,24)
^
ERROR: space required after that ',' (ctx:VxV)
#650: FILE: arch/c6x/include/asm/ptrace.h:60:
+#define PT_B4 PT_LO(27,26)
^
ERROR: space required after that ',' (ctx:VxV)
#651: FILE: arch/c6x/include/asm/ptrace.h:61:
+#define PT_B5 PT_HI(27,26)
^
ERROR: space required after that ',' (ctx:VxV)
#652: FILE: arch/c6x/include/asm/ptrace.h:62:
+#define PT_B6 PT_LO(29,28)
^
ERROR: space required after that ',' (ctx:VxV)
#653: FILE: arch/c6x/include/asm/ptrace.h:63:
+#define PT_B7 PT_HI(29,28)
^
ERROR: space required after that ',' (ctx:VxV)
#654: FILE: arch/c6x/include/asm/ptrace.h:64:
+#define PT_B8 PT_LO(31,30)
^
ERROR: space required after that ',' (ctx:VxV)
#655: FILE: arch/c6x/include/asm/ptrace.h:65:
+#define PT_B9 PT_HI(31,30)
^
ERROR: space required after that ',' (ctx:VxV)
#656: FILE: arch/c6x/include/asm/ptrace.h:66:
+#define PT_B10 PT_LO(33,32)
^
ERROR: space required after that ',' (ctx:VxV)
#657: FILE: arch/c6x/include/asm/ptrace.h:67:
+#define PT_B11 PT_HI(33,32)
^
ERROR: space required after that ',' (ctx:VxV)
#658: FILE: arch/c6x/include/asm/ptrace.h:68:
+#define PT_B12 PT_LO(35,34)
^
ERROR: space required after that ',' (ctx:VxV)
#659: FILE: arch/c6x/include/asm/ptrace.h:69:
+#define PT_B13 PT_HI(35,34)
^
ERROR: space required after that ',' (ctx:VxV)
#660: FILE: arch/c6x/include/asm/ptrace.h:70:
+#define PT_A16 PT_LO(37,36)
^
ERROR: space required after that ',' (ctx:VxV)
#661: FILE: arch/c6x/include/asm/ptrace.h:71:
+#define PT_A17 PT_HI(37,36)
^
ERROR: space required after that ',' (ctx:VxV)
#662: FILE: arch/c6x/include/asm/ptrace.h:72:
+#define PT_A18 PT_LO(39,38)
^
ERROR: space required after that ',' (ctx:VxV)
#663: FILE: arch/c6x/include/asm/ptrace.h:73:
+#define PT_A19 PT_HI(39,38)
^
ERROR: space required after that ',' (ctx:VxV)
#664: FILE: arch/c6x/include/asm/ptrace.h:74:
+#define PT_A20 PT_LO(41,40)
^
ERROR: space required after that ',' (ctx:VxV)
#665: FILE: arch/c6x/include/asm/ptrace.h:75:
+#define PT_A21 PT_HI(41,40)
^
ERROR: space required after that ',' (ctx:VxV)
#666: FILE: arch/c6x/include/asm/ptrace.h:76:
+#define PT_A22 PT_LO(43,42)
^
ERROR: space required after that ',' (ctx:VxV)
#667: FILE: arch/c6x/include/asm/ptrace.h:77:
+#define PT_A23 PT_HI(43,42)
^
ERROR: space required after that ',' (ctx:VxV)
#668: FILE: arch/c6x/include/asm/ptrace.h:78:
+#define PT_A24 PT_LO(45,44)
^
ERROR: space required after that ',' (ctx:VxV)
#669: FILE: arch/c6x/include/asm/ptrace.h:79:
+#define PT_A25 PT_HI(45,44)
^
ERROR: space required after that ',' (ctx:VxV)
#670: FILE: arch/c6x/include/asm/ptrace.h:80:
+#define PT_A26 PT_LO(47,46)
^
ERROR: space required after that ',' (ctx:VxV)
#671: FILE: arch/c6x/include/asm/ptrace.h:81:
+#define PT_A27 PT_HI(47,46)
^
ERROR: space required after that ',' (ctx:VxV)
#672: FILE: arch/c6x/include/asm/ptrace.h:82:
+#define PT_A28 PT_LO(49,48)
^
ERROR: space required after that ',' (ctx:VxV)
#673: FILE: arch/c6x/include/asm/ptrace.h:83:
+#define PT_A29 PT_HI(49,48)
^
ERROR: space required after that ',' (ctx:VxV)
#674: FILE: arch/c6x/include/asm/ptrace.h:84:
+#define PT_A30 PT_LO(51,50)
^
ERROR: space required after that ',' (ctx:VxV)
#675: FILE: arch/c6x/include/asm/ptrace.h:85:
+#define PT_A31 PT_HI(51,50)
^
ERROR: space required after that ',' (ctx:VxV)
#676: FILE: arch/c6x/include/asm/ptrace.h:86:
+#define PT_A0 PT_LO(53,52)
^
ERROR: space required after that ',' (ctx:VxV)
#677: FILE: arch/c6x/include/asm/ptrace.h:87:
+#define PT_A1 PT_HI(53,52)
^
ERROR: space required after that ',' (ctx:VxV)
#678: FILE: arch/c6x/include/asm/ptrace.h:88:
+#define PT_A2 PT_LO(55,54)
^
ERROR: space required after that ',' (ctx:VxV)
#679: FILE: arch/c6x/include/asm/ptrace.h:89:
+#define PT_A3 PT_HI(55,54)
^
ERROR: space required after that ',' (ctx:VxV)
#680: FILE: arch/c6x/include/asm/ptrace.h:90:
+#define PT_A4 PT_LO(57,56)
^
ERROR: space required after that ',' (ctx:VxV)
#681: FILE: arch/c6x/include/asm/ptrace.h:91:
+#define PT_A5 PT_HI(57,56)
^
ERROR: space required after that ',' (ctx:VxV)
#682: FILE: arch/c6x/include/asm/ptrace.h:92:
+#define PT_A6 PT_LO(59,58)
^
ERROR: space required after that ',' (ctx:VxV)
#683: FILE: arch/c6x/include/asm/ptrace.h:93:
+#define PT_A7 PT_HI(59,58)
^
ERROR: space required after that ',' (ctx:VxV)
#684: FILE: arch/c6x/include/asm/ptrace.h:94:
+#define PT_A8 PT_LO(61,60)
^
ERROR: space required after that ',' (ctx:VxV)
#685: FILE: arch/c6x/include/asm/ptrace.h:95:
+#define PT_A9 PT_HI(61,60)
^
ERROR: space required after that ',' (ctx:VxV)
#686: FILE: arch/c6x/include/asm/ptrace.h:96:
+#define PT_A10 PT_LO(63,62)
^
ERROR: space required after that ',' (ctx:VxV)
#687: FILE: arch/c6x/include/asm/ptrace.h:97:
+#define PT_A11 PT_HI(63,62)
^
ERROR: space required after that ',' (ctx:VxV)
#688: FILE: arch/c6x/include/asm/ptrace.h:98:
+#define PT_A12 PT_LO(65,64)
^
ERROR: space required after that ',' (ctx:VxV)
#689: FILE: arch/c6x/include/asm/ptrace.h:99:
+#define PT_A13 PT_HI(65,64)
^
ERROR: space required after that ',' (ctx:VxV)
#690: FILE: arch/c6x/include/asm/ptrace.h:100:
+#define PT_A14 PT_LO(67,66)
^
ERROR: space required after that ',' (ctx:VxV)
#691: FILE: arch/c6x/include/asm/ptrace.h:101:
+#define PT_A15 PT_HI(67,66)
^
ERROR: space required after that ',' (ctx:VxV)
#692: FILE: arch/c6x/include/asm/ptrace.h:102:
+#define PT_B14 PT_LO(69,68)
^
ERROR: space required after that ',' (ctx:VxV)
#693: FILE: arch/c6x/include/asm/ptrace.h:103:
+#define PT_B15 PT_HI(69,68)
^
ERROR: space required after that ',' (ctx:VxV)
#697: FILE: arch/c6x/include/asm/ptrace.h:107:
+#define PT_A4_ORG PT_LO(1,0)
^
ERROR: space required after that ',' (ctx:VxV)
#698: FILE: arch/c6x/include/asm/ptrace.h:108:
+#define PT_STKADJ PT_HI(1,0)
^
ERROR: space required after that ',' (ctx:VxV)
#699: FILE: arch/c6x/include/asm/ptrace.h:109:
+#define PT_CSR PT_LO(3,2)
^
ERROR: space required after that ',' (ctx:VxV)
#700: FILE: arch/c6x/include/asm/ptrace.h:110:
+#define PT_PC PT_HI(3,2)
^
ERROR: space required after that ',' (ctx:VxV)
#702: FILE: arch/c6x/include/asm/ptrace.h:112:
+#define PT_B16 PT_LO(5,4)
^
ERROR: space required after that ',' (ctx:VxV)
#703: FILE: arch/c6x/include/asm/ptrace.h:113:
+#define PT_B17 PT_HI(5,4)
^
ERROR: space required after that ',' (ctx:VxV)
#704: FILE: arch/c6x/include/asm/ptrace.h:114:
+#define PT_B18 PT_LO(7,6)
^
ERROR: space required after that ',' (ctx:VxV)
#705: FILE: arch/c6x/include/asm/ptrace.h:115:
+#define PT_B19 PT_HI(7,6)
^
ERROR: space required after that ',' (ctx:VxV)
#706: FILE: arch/c6x/include/asm/ptrace.h:116:
+#define PT_B20 PT_LO(9,8)
^
ERROR: space required after that ',' (ctx:VxV)
#707: FILE: arch/c6x/include/asm/ptrace.h:117:
+#define PT_B21 PT_HI(9,8)
^
ERROR: space required after that ',' (ctx:VxV)
#708: FILE: arch/c6x/include/asm/ptrace.h:118:
+#define PT_B22 PT_LO(11,10)
^
ERROR: space required after that ',' (ctx:VxV)
#709: FILE: arch/c6x/include/asm/ptrace.h:119:
+#define PT_B23 PT_HI(11,10)
^
ERROR: space required after that ',' (ctx:VxV)
#710: FILE: arch/c6x/include/asm/ptrace.h:120:
+#define PT_B24 PT_LO(13,12)
^
ERROR: space required after that ',' (ctx:VxV)
#711: FILE: arch/c6x/include/asm/ptrace.h:121:
+#define PT_B25 PT_HI(13,12)
^
ERROR: space required after that ',' (ctx:VxV)
#712: FILE: arch/c6x/include/asm/ptrace.h:122:
+#define PT_B26 PT_LO(15,14)
^
ERROR: space required after that ',' (ctx:VxV)
#713: FILE: arch/c6x/include/asm/ptrace.h:123:
+#define PT_B27 PT_HI(15,14)
^
ERROR: space required after that ',' (ctx:VxV)
#714: FILE: arch/c6x/include/asm/ptrace.h:124:
+#define PT_B28 PT_LO(17,16)
^
ERROR: space required after that ',' (ctx:VxV)
#715: FILE: arch/c6x/include/asm/ptrace.h:125:
+#define PT_B29 PT_HI(17,16)
^
ERROR: space required after that ',' (ctx:VxV)
#716: FILE: arch/c6x/include/asm/ptrace.h:126:
+#define PT_B30 PT_LO(19,18)
^
ERROR: space required after that ',' (ctx:VxV)
#717: FILE: arch/c6x/include/asm/ptrace.h:127:
+#define PT_B31 PT_HI(19,18)
^
ERROR: space required after that ',' (ctx:VxV)
#719: FILE: arch/c6x/include/asm/ptrace.h:129:
+#define PT_B0 PT_LO(21,20)
^
ERROR: space required after that ',' (ctx:VxV)
#720: FILE: arch/c6x/include/asm/ptrace.h:130:
+#define PT_B1 PT_HI(21,20)
^
ERROR: space required after that ',' (ctx:VxV)
#721: FILE: arch/c6x/include/asm/ptrace.h:131:
+#define PT_B2 PT_LO(23,22)
^
ERROR: space required after that ',' (ctx:VxV)
#722: FILE: arch/c6x/include/asm/ptrace.h:132:
+#define PT_B3 PT_HI(23,22)
^
ERROR: space required after that ',' (ctx:VxV)
#723: FILE: arch/c6x/include/asm/ptrace.h:133:
+#define PT_B4 PT_LO(25,24)
^
ERROR: space required after that ',' (ctx:VxV)
#724: FILE: arch/c6x/include/asm/ptrace.h:134:
+#define PT_B5 PT_HI(25,24)
^
ERROR: space required after that ',' (ctx:VxV)
#725: FILE: arch/c6x/include/asm/ptrace.h:135:
+#define PT_B6 PT_LO(27,26)
^
ERROR: space required after that ',' (ctx:VxV)
#726: FILE: arch/c6x/include/asm/ptrace.h:136:
+#define PT_B7 PT_HI(27,26)
^
ERROR: space required after that ',' (ctx:VxV)
#727: FILE: arch/c6x/include/asm/ptrace.h:137:
+#define PT_B8 PT_LO(29,28)
^
ERROR: space required after that ',' (ctx:VxV)
#728: FILE: arch/c6x/include/asm/ptrace.h:138:
+#define PT_B9 PT_HI(29,28)
^
ERROR: space required after that ',' (ctx:VxV)
#729: FILE: arch/c6x/include/asm/ptrace.h:139:
+#define PT_B10 PT_LO(31,30)
^
ERROR: space required after that ',' (ctx:VxV)
#730: FILE: arch/c6x/include/asm/ptrace.h:140:
+#define PT_B11 PT_HI(31,30)
^
ERROR: space required after that ',' (ctx:VxV)
#731: FILE: arch/c6x/include/asm/ptrace.h:141:
+#define PT_B12 PT_LO(33,32)
^
ERROR: space required after that ',' (ctx:VxV)
#732: FILE: arch/c6x/include/asm/ptrace.h:142:
+#define PT_B13 PT_HI(33,32)
^
ERROR: space required after that ',' (ctx:VxV)
#734: FILE: arch/c6x/include/asm/ptrace.h:144:
+#define PT_A16 PT_LO(35,34)
^
ERROR: space required after that ',' (ctx:VxV)
#735: FILE: arch/c6x/include/asm/ptrace.h:145:
+#define PT_A17 PT_HI(35,34)
^
ERROR: space required after that ',' (ctx:VxV)
#736: FILE: arch/c6x/include/asm/ptrace.h:146:
+#define PT_A18 PT_LO(37,36)
^
ERROR: space required after that ',' (ctx:VxV)
#737: FILE: arch/c6x/include/asm/ptrace.h:147:
+#define PT_A19 PT_HI(37,36)
^
ERROR: space required after that ',' (ctx:VxV)
#738: FILE: arch/c6x/include/asm/ptrace.h:148:
+#define PT_A20 PT_LO(39,38)
^
ERROR: space required after that ',' (ctx:VxV)
#739: FILE: arch/c6x/include/asm/ptrace.h:149:
+#define PT_A21 PT_HI(39,38)
^
ERROR: space required after that ',' (ctx:VxV)
#740: FILE: arch/c6x/include/asm/ptrace.h:150:
+#define PT_A22 PT_LO(41,40)
^
ERROR: space required after that ',' (ctx:VxV)
#741: FILE: arch/c6x/include/asm/ptrace.h:151:
+#define PT_A23 PT_HI(41,40)
^
ERROR: space required after that ',' (ctx:VxV)
#742: FILE: arch/c6x/include/asm/ptrace.h:152:
+#define PT_A24 PT_LO(43,42)
^
ERROR: space required after that ',' (ctx:VxV)
#743: FILE: arch/c6x/include/asm/ptrace.h:153:
+#define PT_A25 PT_HI(43,42)
^
ERROR: space required after that ',' (ctx:VxV)
#744: FILE: arch/c6x/include/asm/ptrace.h:154:
+#define PT_A26 PT_LO(45,44)
^
ERROR: space required after that ',' (ctx:VxV)
#745: FILE: arch/c6x/include/asm/ptrace.h:155:
+#define PT_A27 PT_HI(45,44)
^
ERROR: space required after that ',' (ctx:VxV)
#746: FILE: arch/c6x/include/asm/ptrace.h:156:
+#define PT_A28 PT_LO(47,46)
^
ERROR: space required after that ',' (ctx:VxV)
#747: FILE: arch/c6x/include/asm/ptrace.h:157:
+#define PT_A29 PT_HI(47,46)
^
ERROR: space required after that ',' (ctx:VxV)
#748: FILE: arch/c6x/include/asm/ptrace.h:158:
+#define PT_A30 PT_LO(49,48)
^
ERROR: space required after that ',' (ctx:VxV)
#749: FILE: arch/c6x/include/asm/ptrace.h:159:
+#define PT_A31 PT_HI(49,48)
^
ERROR: space required after that ',' (ctx:VxV)
#751: FILE: arch/c6x/include/asm/ptrace.h:161:
+#define PT_A0 PT_LO(51,50)
^
ERROR: space required after that ',' (ctx:VxV)
#752: FILE: arch/c6x/include/asm/ptrace.h:162:
+#define PT_A1 PT_HI(51,50)
^
ERROR: space required after that ',' (ctx:VxV)
#753: FILE: arch/c6x/include/asm/ptrace.h:163:
+#define PT_A2 PT_LO(53,52)
^
ERROR: space required after that ',' (ctx:VxV)
#754: FILE: arch/c6x/include/asm/ptrace.h:164:
+#define PT_A3 PT_HI(53,52)
^
ERROR: space required after that ',' (ctx:VxV)
#755: FILE: arch/c6x/include/asm/ptrace.h:165:
+#define PT_A4 PT_LO(55,54)
^
ERROR: space required after that ',' (ctx:VxV)
#756: FILE: arch/c6x/include/asm/ptrace.h:166:
+#define PT_A5 PT_HI(55,54)
^
ERROR: space required after that ',' (ctx:VxV)
#757: FILE: arch/c6x/include/asm/ptrace.h:167:
+#define PT_A6 PT_LO(57,56)
^
ERROR: space required after that ',' (ctx:VxV)
#758: FILE: arch/c6x/include/asm/ptrace.h:168:
+#define PT_A7 PT_HI(57,56)
^
ERROR: space required after that ',' (ctx:VxV)
#759: FILE: arch/c6x/include/asm/ptrace.h:169:
+#define PT_A8 PT_LO(59,58)
^
ERROR: space required after that ',' (ctx:VxV)
#760: FILE: arch/c6x/include/asm/ptrace.h:170:
+#define PT_A9 PT_HI(59,58)
^
ERROR: space required after that ',' (ctx:VxV)
#761: FILE: arch/c6x/include/asm/ptrace.h:171:
+#define PT_A10 PT_LO(61,60)
^
ERROR: space required after that ',' (ctx:VxV)
#762: FILE: arch/c6x/include/asm/ptrace.h:172:
+#define PT_A11 PT_HI(61,60)
^
ERROR: space required after that ',' (ctx:VxV)
#763: FILE: arch/c6x/include/asm/ptrace.h:173:
+#define PT_A12 PT_LO(63,62)
^
ERROR: space required after that ',' (ctx:VxV)
#764: FILE: arch/c6x/include/asm/ptrace.h:174:
+#define PT_A13 PT_HI(63,62)
^
ERROR: space required after that ',' (ctx:VxV)
#765: FILE: arch/c6x/include/asm/ptrace.h:175:
+#define PT_A14 PT_LO(65,64)
^
ERROR: space required after that ',' (ctx:VxV)
#766: FILE: arch/c6x/include/asm/ptrace.h:176:
+#define PT_A15 PT_HI(65,64)
^
ERROR: space required after that ',' (ctx:VxV)
#767: FILE: arch/c6x/include/asm/ptrace.h:177:
+#define PT_B14 PT_LO(67,66)
^
ERROR: space required after that ',' (ctx:VxV)
#768: FILE: arch/c6x/include/asm/ptrace.h:178:
+#define PT_B15 PT_HI(67,66)
^
ERROR: space required after that ',' (ctx:VxV)
#778: FILE: arch/c6x/include/asm/ptrace.h:188:
+#define REG_PAIR(odd,even) unsigned long odd; unsigned long even
^
ERROR: space required after that ',' (ctx:VxV)
#780: FILE: arch/c6x/include/asm/ptrace.h:190:
+#define REG_PAIR(odd,even) unsigned long even; unsigned long odd
^
WARNING: line over 80 characters
#790: FILE: arch/c6x/include/asm/ptrace.h:200:
+#if defined(__TMS320C6XPLUS__) || defined(_TMS320C6400_PLUS) || defined(__TMS320C66X__)
ERROR: space required after that ',' (ctx:VxV)
#791: FILE: arch/c6x/include/asm/ptrace.h:201:
+ REG_PAIR(tsr,orig_a4);
^
ERROR: space required after that ',' (ctx:VxV)
#792: FILE: arch/c6x/include/asm/ptrace.h:202:
+ REG_PAIR(rilc,ilc);
^
ERROR: space required after that ',' (ctx:VxV)
#794: FILE: arch/c6x/include/asm/ptrace.h:204:
+ REG_PAIR(stkadj,orig_a4);
^
ERROR: space required after that ',' (ctx:VxV)
#796: FILE: arch/c6x/include/asm/ptrace.h:206:
+ REG_PAIR(pc,csr);
^
ERROR: space required after that ',' (ctx:VxV)
#799: FILE: arch/c6x/include/asm/ptrace.h:209:
+ REG_PAIR(b17,b16);
^
ERROR: space required after that ',' (ctx:VxV)
#800: FILE: arch/c6x/include/asm/ptrace.h:210:
+ REG_PAIR(b19,b18);
^
ERROR: space required after that ',' (ctx:VxV)
#801: FILE: arch/c6x/include/asm/ptrace.h:211:
+ REG_PAIR(b21,b20);
^
ERROR: space required after that ',' (ctx:VxV)
#802: FILE: arch/c6x/include/asm/ptrace.h:212:
+ REG_PAIR(b23,b22);
^
ERROR: space required after that ',' (ctx:VxV)
#803: FILE: arch/c6x/include/asm/ptrace.h:213:
+ REG_PAIR(b25,b24);
^
ERROR: space required after that ',' (ctx:VxV)
#804: FILE: arch/c6x/include/asm/ptrace.h:214:
+ REG_PAIR(b27,b26);
^
ERROR: space required after that ',' (ctx:VxV)
#805: FILE: arch/c6x/include/asm/ptrace.h:215:
+ REG_PAIR(b29,b28);
^
ERROR: space required after that ',' (ctx:VxV)
#806: FILE: arch/c6x/include/asm/ptrace.h:216:
+ REG_PAIR(b31,b30);
^
ERROR: space required after that ',' (ctx:VxV)
#809: FILE: arch/c6x/include/asm/ptrace.h:219:
+ REG_PAIR(b1,b0);
^
ERROR: space required after that ',' (ctx:VxV)
#810: FILE: arch/c6x/include/asm/ptrace.h:220:
+ REG_PAIR(b3,b2);
^
ERROR: space required after that ',' (ctx:VxV)
#811: FILE: arch/c6x/include/asm/ptrace.h:221:
+ REG_PAIR(b5,b4);
^
ERROR: space required after that ',' (ctx:VxV)
#812: FILE: arch/c6x/include/asm/ptrace.h:222:
+ REG_PAIR(b7,b6);
^
ERROR: space required after that ',' (ctx:VxV)
#813: FILE: arch/c6x/include/asm/ptrace.h:223:
+ REG_PAIR(b9,b8);
^
ERROR: space required after that ',' (ctx:VxV)
#814: FILE: arch/c6x/include/asm/ptrace.h:224:
+ REG_PAIR(b11,b10);
^
ERROR: space required after that ',' (ctx:VxV)
#815: FILE: arch/c6x/include/asm/ptrace.h:225:
+ REG_PAIR(b13,b12);
^
ERROR: space required after that ',' (ctx:VxV)
#818: FILE: arch/c6x/include/asm/ptrace.h:228:
+ REG_PAIR(a17,a16);
^
ERROR: space required after that ',' (ctx:VxV)
#819: FILE: arch/c6x/include/asm/ptrace.h:229:
+ REG_PAIR(a19,a18);
^
ERROR: space required after that ',' (ctx:VxV)
#820: FILE: arch/c6x/include/asm/ptrace.h:230:
+ REG_PAIR(a21,a20);
^
ERROR: space required after that ',' (ctx:VxV)
#821: FILE: arch/c6x/include/asm/ptrace.h:231:
+ REG_PAIR(a23,a22);
^
ERROR: space required after that ',' (ctx:VxV)
#822: FILE: arch/c6x/include/asm/ptrace.h:232:
+ REG_PAIR(a25,a24);
^
ERROR: space required after that ',' (ctx:VxV)
#823: FILE: arch/c6x/include/asm/ptrace.h:233:
+ REG_PAIR(a27,a26);
^
ERROR: space required after that ',' (ctx:VxV)
#824: FILE: arch/c6x/include/asm/ptrace.h:234:
+ REG_PAIR(a29,a28);
^
ERROR: space required after that ',' (ctx:VxV)
#825: FILE: arch/c6x/include/asm/ptrace.h:235:
+ REG_PAIR(a31,a30);
^
ERROR: space required after that ',' (ctx:VxV)
#828: FILE: arch/c6x/include/asm/ptrace.h:238:
+ REG_PAIR(a1,a0);
^
ERROR: space required after that ',' (ctx:VxV)
#829: FILE: arch/c6x/include/asm/ptrace.h:239:
+ REG_PAIR(a3,a2);
^
ERROR: space required after that ',' (ctx:VxV)
#830: FILE: arch/c6x/include/asm/ptrace.h:240:
+ REG_PAIR(a5,a4);
^
ERROR: space required after that ',' (ctx:VxV)
#831: FILE: arch/c6x/include/asm/ptrace.h:241:
+ REG_PAIR(a7,a6);
^
ERROR: space required after that ',' (ctx:VxV)
#832: FILE: arch/c6x/include/asm/ptrace.h:242:
+ REG_PAIR(a9,a8);
^
ERROR: space required after that ',' (ctx:VxV)
#833: FILE: arch/c6x/include/asm/ptrace.h:243:
+ REG_PAIR(a11,a10);
^
ERROR: space required after that ',' (ctx:VxV)
#834: FILE: arch/c6x/include/asm/ptrace.h:244:
+ REG_PAIR(a13,a12);
^
ERROR: space required after that ',' (ctx:VxV)
#836: FILE: arch/c6x/include/asm/ptrace.h:246:
+ REG_PAIR(a15,a14);
^
ERROR: space required after that ',' (ctx:VxV)
#837: FILE: arch/c6x/include/asm/ptrace.h:247:
+ REG_PAIR(sp,dp);
^
WARNING: line over 80 characters
#844: FILE: arch/c6x/include/asm/ptrace.h:254:
+#if defined(__TMS320C6XPLUS__) || defined(_TMS320C6400_PLUS) || defined(__TMS320C66X__)
ERROR: space required after that ',' (ctx:VxV)
#845: FILE: arch/c6x/include/asm/ptrace.h:255:
+ REG_PAIR(rilc,ilc);
^
ERROR: space required after that ',' (ctx:VxV)
#847: FILE: arch/c6x/include/asm/ptrace.h:257:
+ REG_PAIR(a11,a10);
^
ERROR: space required after that ',' (ctx:VxV)
#848: FILE: arch/c6x/include/asm/ptrace.h:258:
+ REG_PAIR(a13,a12);
^
ERROR: space required after that ',' (ctx:VxV)
#849: FILE: arch/c6x/include/asm/ptrace.h:259:
+ REG_PAIR(a15,a14);
^
ERROR: space required after that ',' (ctx:VxV)
#850: FILE: arch/c6x/include/asm/ptrace.h:260:
+ REG_PAIR(b11,b10);
^
ERROR: space required after that ',' (ctx:VxV)
#851: FILE: arch/c6x/include/asm/ptrace.h:261:
+ REG_PAIR(b13,b12);
^
WARNING: line over 80 characters
#872: FILE: arch/c6x/include/asm/ptrace.h:282:
+#define PTRACE_GETDSBT_EXEC 0 /* [addr] request the executable loadmap */
WARNING: line over 80 characters
#873: FILE: arch/c6x/include/asm/ptrace.h:283:
+#define PTRACE_GETDSBT_INTERP 1 /* [addr] request the interpreter loadmap */
WARNING: line over 80 characters
#877: FILE: arch/c6x/include/asm/ptrace.h:287:
+#define DEFAULT_CSR 0x0001 /* interrupt enable by default */
WARNING: line over 80 characters
#878: FILE: arch/c6x/include/asm/ptrace.h:288:
+ /* used in /include/asm/processor.h*/
ERROR: code indent should use tabs where possible
#878: FILE: arch/c6x/include/asm/ptrace.h:288:
+ /* used in /include/asm/processor.h*/$
WARNING: line over 80 characters
#882: FILE: arch/c6x/include/asm/ptrace.h:292:
+#define user_mode(regs) (((((regs)->sp) ^ current_ksp) >> PAGE_SHIFT) != 0)
ERROR: "foo * bar" should be "foo *bar"
#971: FILE: arch/c6x/include/asm/string.h:16:
+extern void * memcpy(void *to, const void *from, size_t n);
ERROR: "foo * bar" should be "foo *bar"
#972: FILE: arch/c6x/include/asm/string.h:17:
+extern void * memset(void *s, int c, size_t count);
WARNING: do not add new typedefs
#991: FILE: arch/c6x/include/asm/types.h:4:
+typedef unsigned short umode_t;
WARNING: do not add new typedefs
#1035: FILE: arch/c6x/include/asm/types.h:48:
+typedef unsigned long phys_addr_t;
WARNING: do not add new typedefs
#1036: FILE: arch/c6x/include/asm/types.h:49:
+typedef unsigned long phys_size_t;
WARNING: do not add new typedefs
#1085: FILE: arch/c6x/include/asm/u-boot.h:39:
+typedef struct bd_info {
WARNING: externs should be avoided in .c files
#1244: FILE: arch/c6x/lib/board.c:71:
+extern int print_cpuinfo(void);
WARNING: externs should be avoided in .c files
#1271: FILE: arch/c6x/lib/board.c:98:
+extern ulong __bss_start;
WARNING: externs should be avoided in .c files
#1272: FILE: arch/c6x/lib/board.c:99:
+extern ulong __bss_end__;
ERROR: spaces required around that ':' (ctx:VxW)
#1290: FILE: arch/c6x/lib/board.c:117:
+ __asm__ __volatile__("": : :"memory");
^
ERROR: spaces required around that ':' (ctx:WxV)
#1290: FILE: arch/c6x/lib/board.c:117:
+ __asm__ __volatile__("": : :"memory");
^
WARNING: Whitespace before semicolon
#1366: FILE: arch/c6x/lib/board.c:193:
+ ;
WARNING: line over 80 characters
#1416: FILE: arch/c6x/lib/bootm.c:36:
+int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *images)
WARNING: space prohibited between function name and open parenthesis '('
#1419: FILE: arch/c6x/lib/bootm.c:39:
+ char *commandline = getenv ("bootargs");
WARNING: do not add new typedefs
#2361: FILE: arch/c6x/lib/divull.c:132:
+typedef union {
total: 197 errors, 76 warnings, 3033 lines checked
NOTE: whitespace errors detected, you may wish to use scripts/cleanpatch or
scripts/cleanfile
NOTE: Ignored message types: COMPLEX_MACRO CONSIDER_KSTRTO MINMAX MULTISTATEMENT_MACRO_USE_DO_WHILE
/home/wd/Mail/U-Boot/19345 has style problems, please review.
If any of these errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
total: 0 errors, 0 warnings, 159 lines checked
NOTE: Ignored message types: COMPLEX_MACRO CONSIDER_KSTRTO MINMAX MULTISTATEMENT_MACRO_USE_DO_WHILE
ERROR: trailing whitespace
#153: FILE: arch/arm/cpu/arm926ejs/davinci/reset_c.c:17:
+^Istruct davinci_timer * const wdttimer = $
ERROR: space required before the open parenthesis '('
#166: FILE: arch/arm/cpu/arm926ejs/davinci/reset_c.c:30:
+ while(1);
ERROR: trailing statements should be on next line
#166: FILE: arch/arm/cpu/arm926ejs/davinci/reset_c.c:30:
+ while(1);
total: 3 errors, 0 warnings, 63 lines checked
NOTE: whitespace errors detected, you may wish to use scripts/cleanpatch or
scripts/cleanfile
NOTE: Ignored message types: COMPLEX_MACRO CONSIDER_KSTRTO MINMAX MULTISTATEMENT_MACRO_USE_DO_WHILE
/home/wd/Mail/U-Boot/19347 has style problems, please review.
If any of these errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
ERROR: space required before the open brace '{'
#336: FILE: board/inmys/c6745-som/c6745-som.c:191:
+ for (j = 0; j < 15; j++){
WARNING: braces {} are not necessary for single statement blocks
#336: FILE: board/inmys/c6745-som/c6745-som.c:191:
+ for (j = 0; j < 15; j++){
+ REG(DAVINCI_UART2_BASE + (j*4)) = 0;
+ }
WARNING: line over 80 characters
#596: FILE: include/configs/c6745-som-inmys.h:186:
+#define CONFIG_BOOTARGS "mem=32M console=ttyS2,115200n8 root=/dev/mtdblock/2 rw noinitrd ip=dhcp"
total: 1 errors, 2 warnings, 584 lines checked
NOTE: Ignored message types: COMPLEX_MACRO CONSIDER_KSTRTO MINMAX MULTISTATEMENT_MACRO_USE_DO_WHILE
/home/wd/Mail/U-Boot/19348 has style problems, please review.
If any of these errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
total: 0 errors, 0 warnings, 18 lines checked
NOTE: Ignored message types: COMPLEX_MACRO CONSIDER_KSTRTO MINMAX MULTISTATEMENT_MACRO_USE_DO_WHILE
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
I see that Microsoft's campaign to destroy all knowledge of any
operating environment but its own environment-of-the-year has
succeeded in creating a generation of users who don't understand the
concept of a shell...
-- L. Peter Deutsch in <m0x5jNX-000R2UC@lamp.aladdin.com>
^ permalink raw reply [flat|nested] 31+ messages in thread
* [U-Boot] [PATCH v2 0/4] Add support new arch: c6x
2012-06-23 12:33 ` Wolfgang Denk
@ 2012-06-24 11:40 ` bond at inmys.ru
2012-06-24 13:50 ` Wolfgang Denk
0 siblings, 1 reply; 31+ messages in thread
From: bond at inmys.ru @ 2012-06-24 11:40 UTC (permalink / raw)
To: u-boot
Dear Wolfgang Denk,
In message <20120623123302.5ABCA2000F1@gemini.denx.de> you wrote:
> Dear Dmitry Bondar,
>
> In message <1340449870-26456-1-git-send-email-bond@inmys.ru> you wrote:
>> C6X (C6000) is family of fixed and floating-point DSPs manufactured by
>> Texas Instruments.
>>
>> Signed-off-by: Dmitry Bondar <bond@inmys.ru>
>> Cc: Tom Rini <trini@ti.com>
>>
>> ---
>> Changes for v2:
>> - davinci SOC reset_c.c rewritten with readl/writel.
>> - Tom Rini <trini@ti.com> added to cc
>
> Please run your patches through checkpatch and fix the issues. Then
> try and resubmit:
>
( tools/checkpatch.pl out removed )
After rework, code in arch/c6x
tools/checkpatch.pl 0001-Add-support-new-arch-c6x.patch tell me:
"total: 0 errors, 39 warnings, 3065 lines checked"
can i try send patch to list, or if not, what i must do with typedefs of
global_data, volatile in asm/io.h and __kernel... types in
asm/posix_types.h (all other arch has same code)?
tools/checkpatch.pl out now:
$ tools/checkpatch.pl 0001-Add-support-new-arch-c6x.patch
WARNING: do not add new typedefs
#306: FILE: arch/c6x/include/asm/global_data.h:36:
+typedef struct global_data {
WARNING: Use of volatile is usually wrong: see
Documentation/volatile-considered-harmful.txt
#364: FILE: arch/c6x/include/asm/global_data.h:94:
+#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("B31")
WARNING: Use of volatile is usually wrong: see
Documentation/volatile-considered-harmful.txt
#394: FILE: arch/c6x/include/asm/io.h:14:
+#define readb(addr) (*(volatile unsigned char *) (addr))
WARNING: Use of volatile is usually wrong: see
Documentation/volatile-considered-harmful.txt
#395: FILE: arch/c6x/include/asm/io.h:15:
+#define readw(addr) (*(volatile unsigned short *) (addr))
WARNING: Use of volatile is usually wrong: see
Documentation/volatile-considered-harmful.txt
#396: FILE: arch/c6x/include/asm/io.h:16:
+#define readl(addr) (*(volatile unsigned int *) (addr))
WARNING: Use of volatile is usually wrong: see
Documentation/volatile-considered-harmful.txt
#398: FILE: arch/c6x/include/asm/io.h:18:
+#define writeb(b, addr) ((*(volatile unsigned char *) (addr)) = (b))
WARNING: Use of volatile is usually wrong: see
Documentation/volatile-considered-harmful.txt
#399: FILE: arch/c6x/include/asm/io.h:19:
+#define writew(b, addr) ((*(volatile unsigned short *) (addr)) = (b))
WARNING: Use of volatile is usually wrong: see
Documentation/volatile-considered-harmful.txt
#400: FILE: arch/c6x/include/asm/io.h:20:
+#define writel(b, addr) ((*(volatile unsigned int *) (addr)) = (b))
WARNING: do not add new typedefs
#463: FILE: arch/c6x/include/asm/posix_types.h:18:
+typedef unsigned int __kernel_dev_t;
WARNING: do not add new typedefs
#464: FILE: arch/c6x/include/asm/posix_types.h:19:
+typedef unsigned long __kernel_ino_t;
WARNING: do not add new typedefs
#465: FILE: arch/c6x/include/asm/posix_types.h:20:
+typedef unsigned long long __kernel_ino64_t;
WARNING: do not add new typedefs
#466: FILE: arch/c6x/include/asm/posix_types.h:21:
+typedef unsigned int __kernel_mode_t;
WARNING: do not add new typedefs
#467: FILE: arch/c6x/include/asm/posix_types.h:22:
+typedef unsigned int __kernel_nlink_t;
WARNING: do not add new typedefs
#468: FILE: arch/c6x/include/asm/posix_types.h:23:
+typedef long __kernel_off_t;
WARNING: do not add new typedefs
#469: FILE: arch/c6x/include/asm/posix_types.h:24:
+typedef long long __kernel_loff_t;
WARNING: do not add new typedefs
#470: FILE: arch/c6x/include/asm/posix_types.h:25:
+typedef int __kernel_pid_t;
WARNING: do not add new typedefs
#471: FILE: arch/c6x/include/asm/posix_types.h:26:
+typedef unsigned short __kernel_ipc_pid_t;
WARNING: do not add new typedefs
#472: FILE: arch/c6x/include/asm/posix_types.h:27:
+typedef unsigned int __kernel_uid_t;
WARNING: do not add new typedefs
#473: FILE: arch/c6x/include/asm/posix_types.h:28:
+typedef unsigned int __kernel_gid_t;
WARNING: do not add new typedefs
#474: FILE: arch/c6x/include/asm/posix_types.h:29:
+typedef unsigned int __kernel_size_t;
WARNING: do not add new typedefs
#475: FILE: arch/c6x/include/asm/posix_types.h:30:
+typedef int __kernel_ssize_t;
WARNING: do not add new typedefs
#476: FILE: arch/c6x/include/asm/posix_types.h:31:
+typedef int __kernel_ptrdiff_t;
WARNING: do not add new typedefs
#477: FILE: arch/c6x/include/asm/posix_types.h:32:
+typedef long __kernel_time_t;
WARNING: do not add new typedefs
#478: FILE: arch/c6x/include/asm/posix_types.h:33:
+typedef long __kernel_suseconds_t;
WARNING: do not add new typedefs
#479: FILE: arch/c6x/include/asm/posix_types.h:34:
+typedef long __kernel_clock_t;
WARNING: do not add new typedefs
#480: FILE: arch/c6x/include/asm/posix_types.h:35:
+typedef int __kernel_daddr_t;
WARNING: do not add new typedefs
#481: FILE: arch/c6x/include/asm/posix_types.h:36:
+typedef char *__kernel_caddr_t;
WARNING: do not add new typedefs
#482: FILE: arch/c6x/include/asm/posix_types.h:37:
+typedef unsigned short __kernel_uid16_t;
WARNING: do not add new typedefs
#483: FILE: arch/c6x/include/asm/posix_types.h:38:
+typedef unsigned short __kernel_gid16_t;
WARNING: do not add new typedefs
#484: FILE: arch/c6x/include/asm/posix_types.h:39:
+typedef unsigned int __kernel_uid32_t;
WARNING: do not add new typedefs
#485: FILE: arch/c6x/include/asm/posix_types.h:40:
+typedef unsigned int __kernel_gid32_t;
WARNING: do not add new typedefs
#487: FILE: arch/c6x/include/asm/posix_types.h:42:
+typedef unsigned short __kernel_old_uid_t;
WARNING: do not add new typedefs
#488: FILE: arch/c6x/include/asm/posix_types.h:43:
+typedef unsigned short __kernel_old_gid_t;
WARNING: do not add new typedefs
#491: FILE: arch/c6x/include/asm/posix_types.h:46:
+typedef struct {
WARNING: do not add new typedefs
#942: FILE: arch/c6x/include/asm/types.h:4:
+typedef unsigned short umode_t;
WARNING: do not add new typedefs
#986: FILE: arch/c6x/include/asm/types.h:48:
+typedef unsigned long phys_addr_t;
WARNING: do not add new typedefs
#987: FILE: arch/c6x/include/asm/types.h:49:
+typedef unsigned long phys_size_t;
WARNING: do not add new typedefs
#1056: FILE: arch/c6x/include/asm/u-boot.h:39:
+typedef struct bd_info {
WARNING: do not add new typedefs
#2328: FILE: arch/c6x/lib/divull.c:132:
+typedef union {
total: 0 errors, 39 warnings, 3065 lines checked
^ permalink raw reply [flat|nested] 31+ messages in thread
* [U-Boot] [PATCH v2 0/4] Add support new arch: c6x
2012-06-24 11:40 ` bond at inmys.ru
@ 2012-06-24 13:50 ` Wolfgang Denk
0 siblings, 0 replies; 31+ messages in thread
From: Wolfgang Denk @ 2012-06-24 13:50 UTC (permalink / raw)
To: u-boot
Dear bond at inmys.ru,
In message <31ab63da18246416f011fefc86653461.squirrel@78.108.93.81> you wrote:
>
> After rework, code in arch/c6x
> tools/checkpatch.pl 0001-Add-support-new-arch-c6x.patch tell me:
> "total: 0 errors, 39 warnings, 3065 lines checked"
Thanks.
> can i try send patch to list, or if not, what i must do with typedefs of
> global_data, volatile in asm/io.h and __kernel... types in
> asm/posix_types.h (all other arch has same code)?
If you really need to come up with your own versions of asm/io.h,
asm/posix_types.h etc. the typedefs are probably OK.
> WARNING: Use of volatile is usually wrong: see
> Documentation/volatile-considered-harmful.txt
> #394: FILE: arch/c6x/include/asm/io.h:14:
> +#define readb(addr) (*(volatile unsigned char *) (addr))
This is indeed unacceptable code, as it does not contain any kind of
memory barrier instructions. Please use proper I/O accessors, resp.
define such.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Life would be so much easier if we could just look at the source
code. -- Dave Olson
^ permalink raw reply [flat|nested] 31+ messages in thread
* [U-Boot] [PATCH v3 0/4] Add support new arch: c6x
[not found] <add_c6x_arch>
` (5 preceding siblings ...)
2012-06-23 11:11 ` [U-Boot] [PATCH v2 4/4] c6x: Add support c6745-som board Dmitry Bondar
@ 2012-06-25 18:02 ` Dmitry Bondar
2012-06-25 22:31 ` Tom Rini
2012-06-25 18:02 ` [U-Boot] [PATCH v3 1/4] " Dmitry Bondar
` (3 subsequent siblings)
10 siblings, 1 reply; 31+ messages in thread
From: Dmitry Bondar @ 2012-06-25 18:02 UTC (permalink / raw)
To: u-boot
C6X (C6000) is family of fixed and floating-point DSPs manufactured by Texas Instruments.
---
Changes for v2:
- reset_c.c rewritten with readl/writel.
- Tom Rini <trini@ti.com> added to cc
Changes for v3:
- fix coding style
- arch/c6x/include/asm/io.h - add memory barriers on readl/writel ()
Dmitry Bondar (4):
Add support new arch: c6x
c6x: Add support c674x CPUs
c6x: Add suport build davinci SOC with c674x CPUs
c6x: Add support c6745-som board
MAINTAINERS | 3 +
Makefile | 1 +
arch/arm/cpu/arm926ejs/davinci/Makefile | 5 +
arch/arm/cpu/arm926ejs/davinci/reset_c.c | 32 +++
arch/c6x/config.mk | 1 +
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 ++++++
arch/c6x/include/asm/bitops.h | 88 +++++++
arch/c6x/include/asm/byteorder.h | 1 +
arch/c6x/include/asm/cache.h | 29 ++
arch/c6x/include/asm/config.h | 3 +
arch/c6x/include/asm/errno.h | 1 +
arch/c6x/include/asm/global_data.h | 96 +++++++
arch/c6x/include/asm/gpio.h | 2 +
arch/c6x/include/asm/io.h | 68 +++++
arch/c6x/include/asm/posix_types.h | 72 ++++++
arch/c6x/include/asm/processor.h | 4 +
arch/c6x/include/asm/ptrace.h | 310 +++++++++++++++++++++++
arch/c6x/include/asm/sizes.h | 51 ++++
arch/c6x/include/asm/string.h | 26 ++
arch/c6x/include/asm/types.h | 53 ++++
arch/c6x/include/asm/u-boot-c6x.h | 14 +
arch/c6x/include/asm/u-boot.h | 57 ++++
arch/c6x/include/asm/unaligned.h | 1 +
arch/c6x/lib/Makefile | 51 ++++
arch/c6x/lib/board.c | 196 ++++++++++++++
arch/c6x/lib/bootm.c | 60 +++++
arch/c6x/lib/csum_64plus.S | 408 ++++++++++++++++++++++++++++++
arch/c6x/lib/delay.S | 39 +++
arch/c6x/lib/divi.S | 54 ++++
arch/c6x/lib/divremi.S | 61 +++++
arch/c6x/lib/divremu.S | 86 +++++++
arch/c6x/lib/divu.S | 100 ++++++++
arch/c6x/lib/divull.c | 336 ++++++++++++++++++++++++
arch/c6x/lib/llshl.S | 36 +++
arch/c6x/lib/llshr.S | 36 +++
arch/c6x/lib/llshru.S | 36 +++
arch/c6x/lib/memcmp.c | 24 ++
arch/c6x/lib/memcpy_64plus.S | 45 ++++
arch/c6x/lib/memmove.c | 30 +++
arch/c6x/lib/memset.c | 20 ++
arch/c6x/lib/mpyll.S | 47 ++++
arch/c6x/lib/negll.S | 29 ++
arch/c6x/lib/pop_rts.S | 30 +++
arch/c6x/lib/push_rts.S | 28 ++
arch/c6x/lib/remi.S | 78 ++++++
arch/c6x/lib/remu.S | 81 ++++++
arch/c6x/lib/strasgi.S | 88 +++++++
arch/c6x/lib/strasgi_64plus.S | 37 +++
arch/c6x/lib/unaligned.S | 117 +++++++++
board/inmys/c6745-som/Makefile | 27 ++
board/inmys/c6745-som/c6745-som.c | 246 ++++++++++++++++++
boards.cfg | 1 +
common/cmd_bdinfo.c | 5 +
common/image.c | 4 +
examples/standalone/stubs.c | 15 +
include/configs/c6745-som-inmys.h | 294 +++++++++++++++++++++
mkconfig | 7 +-
61 files changed, 3828 insertions(+), 1 deletions(-)
create mode 100644 arch/arm/cpu/arm926ejs/davinci/reset_c.c
create mode 100644 arch/c6x/config.mk
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
create mode 100644 arch/c6x/include/asm/bitops.h
create mode 100644 arch/c6x/include/asm/byteorder.h
create mode 100644 arch/c6x/include/asm/cache.h
create mode 100644 arch/c6x/include/asm/config.h
create mode 100644 arch/c6x/include/asm/errno.h
create mode 100644 arch/c6x/include/asm/global_data.h
create mode 100644 arch/c6x/include/asm/gpio.h
create mode 100644 arch/c6x/include/asm/io.h
create mode 100644 arch/c6x/include/asm/posix_types.h
create mode 100644 arch/c6x/include/asm/processor.h
create mode 100644 arch/c6x/include/asm/ptrace.h
create mode 100644 arch/c6x/include/asm/sizes.h
create mode 100644 arch/c6x/include/asm/string.h
create mode 100644 arch/c6x/include/asm/types.h
create mode 100644 arch/c6x/include/asm/u-boot-c6x.h
create mode 100644 arch/c6x/include/asm/u-boot.h
create mode 100644 arch/c6x/include/asm/unaligned.h
create mode 100644 arch/c6x/lib/Makefile
create mode 100644 arch/c6x/lib/board.c
create mode 100644 arch/c6x/lib/bootm.c
create mode 100644 arch/c6x/lib/csum_64plus.S
create mode 100644 arch/c6x/lib/delay.S
create mode 100644 arch/c6x/lib/divi.S
create mode 100644 arch/c6x/lib/divremi.S
create mode 100644 arch/c6x/lib/divremu.S
create mode 100644 arch/c6x/lib/divu.S
create mode 100644 arch/c6x/lib/divull.c
create mode 100644 arch/c6x/lib/llshl.S
create mode 100644 arch/c6x/lib/llshr.S
create mode 100644 arch/c6x/lib/llshru.S
create mode 100644 arch/c6x/lib/memcmp.c
create mode 100644 arch/c6x/lib/memcpy_64plus.S
create mode 100644 arch/c6x/lib/memmove.c
create mode 100644 arch/c6x/lib/memset.c
create mode 100644 arch/c6x/lib/mpyll.S
create mode 100644 arch/c6x/lib/negll.S
create mode 100644 arch/c6x/lib/pop_rts.S
create mode 100644 arch/c6x/lib/push_rts.S
create mode 100644 arch/c6x/lib/remi.S
create mode 100644 arch/c6x/lib/remu.S
create mode 100644 arch/c6x/lib/strasgi.S
create mode 100644 arch/c6x/lib/strasgi_64plus.S
create mode 100644 arch/c6x/lib/unaligned.S
create mode 100644 board/inmys/c6745-som/Makefile
create mode 100644 board/inmys/c6745-som/c6745-som.c
create mode 100644 include/configs/c6745-som-inmys.h
--
1.7.2.5
^ permalink raw reply [flat|nested] 31+ messages in thread
* [U-Boot] [PATCH v3 1/4] Add support new arch: c6x
[not found] <add_c6x_arch>
` (6 preceding siblings ...)
2012-06-25 18:02 ` [U-Boot] [PATCH v3 0/4] Add support new arch: c6x Dmitry Bondar
@ 2012-06-25 18:02 ` Dmitry Bondar
2012-06-25 22:04 ` Tom Rini
2012-07-19 3:53 ` Mike Frysinger
2012-06-25 18:02 ` [U-Boot] [PATCH v3 2/4] c6x: Add support c674x CPUs Dmitry Bondar
` (2 subsequent siblings)
10 siblings, 2 replies; 31+ messages in thread
From: Dmitry Bondar @ 2012-06-25 18:02 UTC (permalink / raw)
To: u-boot
C6X (C6000) is Texas Instruments architecture of fixed and floating-point DSPs.
This patch add basic support.
Many of code in arch/c6x/include/asm come from c6x-linux project (http://linux-c6x.org)
Signed-off-by: Dmitry Bondar <bond@inmys.ru>
Cc: Tom Rini <trini@ti.com>
---
arch/c6x/config.mk | 1 +
arch/c6x/include/asm/bitops.h | 88 ++++++++
arch/c6x/include/asm/byteorder.h | 1 +
arch/c6x/include/asm/cache.h | 29 +++
arch/c6x/include/asm/config.h | 3 +
arch/c6x/include/asm/errno.h | 1 +
arch/c6x/include/asm/global_data.h | 96 +++++++++
arch/c6x/include/asm/gpio.h | 2 +
arch/c6x/include/asm/io.h | 68 ++++++
arch/c6x/include/asm/posix_types.h | 72 +++++++
arch/c6x/include/asm/processor.h | 4 +
arch/c6x/include/asm/ptrace.h | 310 +++++++++++++++++++++++++++
arch/c6x/include/asm/sizes.h | 51 +++++
arch/c6x/include/asm/string.h | 26 +++
arch/c6x/include/asm/types.h | 53 +++++
arch/c6x/include/asm/u-boot-c6x.h | 14 ++
arch/c6x/include/asm/u-boot.h | 57 +++++
arch/c6x/include/asm/unaligned.h | 1 +
arch/c6x/lib/Makefile | 51 +++++
arch/c6x/lib/board.c | 196 +++++++++++++++++
arch/c6x/lib/bootm.c | 60 ++++++
arch/c6x/lib/csum_64plus.S | 408 ++++++++++++++++++++++++++++++++++++
arch/c6x/lib/delay.S | 39 ++++
arch/c6x/lib/divi.S | 54 +++++
arch/c6x/lib/divremi.S | 61 ++++++
arch/c6x/lib/divremu.S | 86 ++++++++
arch/c6x/lib/divu.S | 100 +++++++++
arch/c6x/lib/divull.c | 336 +++++++++++++++++++++++++++++
arch/c6x/lib/llshl.S | 36 ++++
arch/c6x/lib/llshr.S | 36 ++++
arch/c6x/lib/llshru.S | 36 ++++
arch/c6x/lib/memcmp.c | 24 ++
arch/c6x/lib/memcpy_64plus.S | 45 ++++
arch/c6x/lib/memmove.c | 30 +++
arch/c6x/lib/memset.c | 20 ++
arch/c6x/lib/mpyll.S | 47 ++++
arch/c6x/lib/negll.S | 29 +++
arch/c6x/lib/pop_rts.S | 30 +++
arch/c6x/lib/push_rts.S | 28 +++
arch/c6x/lib/remi.S | 78 +++++++
arch/c6x/lib/remu.S | 81 +++++++
arch/c6x/lib/strasgi.S | 88 ++++++++
arch/c6x/lib/strasgi_64plus.S | 37 ++++
arch/c6x/lib/unaligned.S | 117 ++++++++++
common/cmd_bdinfo.c | 5 +
common/image.c | 4 +
examples/standalone/stubs.c | 15 ++
47 files changed, 3054 insertions(+), 0 deletions(-)
create mode 100644 arch/c6x/config.mk
create mode 100644 arch/c6x/include/asm/bitops.h
create mode 100644 arch/c6x/include/asm/byteorder.h
create mode 100644 arch/c6x/include/asm/cache.h
create mode 100644 arch/c6x/include/asm/config.h
create mode 100644 arch/c6x/include/asm/errno.h
create mode 100644 arch/c6x/include/asm/global_data.h
create mode 100644 arch/c6x/include/asm/gpio.h
create mode 100644 arch/c6x/include/asm/io.h
create mode 100644 arch/c6x/include/asm/posix_types.h
create mode 100644 arch/c6x/include/asm/processor.h
create mode 100644 arch/c6x/include/asm/ptrace.h
create mode 100644 arch/c6x/include/asm/sizes.h
create mode 100644 arch/c6x/include/asm/string.h
create mode 100644 arch/c6x/include/asm/types.h
create mode 100644 arch/c6x/include/asm/u-boot-c6x.h
create mode 100644 arch/c6x/include/asm/u-boot.h
create mode 100644 arch/c6x/include/asm/unaligned.h
create mode 100644 arch/c6x/lib/Makefile
create mode 100644 arch/c6x/lib/board.c
create mode 100644 arch/c6x/lib/bootm.c
create mode 100644 arch/c6x/lib/csum_64plus.S
create mode 100644 arch/c6x/lib/delay.S
create mode 100644 arch/c6x/lib/divi.S
create mode 100644 arch/c6x/lib/divremi.S
create mode 100644 arch/c6x/lib/divremu.S
create mode 100644 arch/c6x/lib/divu.S
create mode 100644 arch/c6x/lib/divull.c
create mode 100644 arch/c6x/lib/llshl.S
create mode 100644 arch/c6x/lib/llshr.S
create mode 100644 arch/c6x/lib/llshru.S
create mode 100644 arch/c6x/lib/memcmp.c
create mode 100644 arch/c6x/lib/memcpy_64plus.S
create mode 100644 arch/c6x/lib/memmove.c
create mode 100644 arch/c6x/lib/memset.c
create mode 100644 arch/c6x/lib/mpyll.S
create mode 100644 arch/c6x/lib/negll.S
create mode 100644 arch/c6x/lib/pop_rts.S
create mode 100644 arch/c6x/lib/push_rts.S
create mode 100644 arch/c6x/lib/remi.S
create mode 100644 arch/c6x/lib/remu.S
create mode 100644 arch/c6x/lib/strasgi.S
create mode 100644 arch/c6x/lib/strasgi_64plus.S
create mode 100644 arch/c6x/lib/unaligned.S
diff --git a/arch/c6x/config.mk b/arch/c6x/config.mk
new file mode 100644
index 0000000..9cbddbc
--- /dev/null
+++ b/arch/c6x/config.mk
@@ -0,0 +1 @@
+CROSS_COMPILE ?= c6x-uclinux-
diff --git a/arch/c6x/include/asm/bitops.h b/arch/c6x/include/asm/bitops.h
new file mode 100644
index 0000000..5896b5e
--- /dev/null
+++ b/arch/c6x/include/asm/bitops.h
@@ -0,0 +1,88 @@
+/*
+ * linux/include/asm-c6x/bitops.h
+ *
+ * Port on Texas Instruments TMS320C6x architecture
+ *
+ * Copyright (C) 2004, 2009, 2010 Texas Instruments Incorporated
+ * Author: Aurelien Jacquiot (aurelien.jacquiot at jaluna.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#ifndef __ASM_C6X_BITOPS_H_
+#define __ASM_C6X_BITOPS_H_
+
+#ifdef __KERNEL__
+
+#include <linux/bitops.h>
+#include <asm/byteorder.h>
+
+/*
+ * We are lucky, DSP is perfect for bitops: do it in 3 cycles
+ */
+
+/**
+ * __ffs - find first bit in word.
+ * @word: The word to search
+ *
+ * Undefined if no bit exists, so code should check against 0 first.
+ * Note __ffs(0) = undef, __ffs(1) = 0, __ffs(0x80000000) = 31.
+ *
+ */
+static inline unsigned long __ffs(unsigned long x)
+{
+ asm (" bitr .M1 %0,%0\n"
+ " nop\n"
+ " lmbd .L1 1,%0,%0\n"
+ : "+a"(x));
+
+ return x;
+}
+
+/*
+ * ffz - find first zero in word.
+ * @word: The word to search
+ *
+ * Undefined if no zero exists, so code should check against ~0UL first.
+ */
+#define ffz(x) __ffs(~(x))
+
+/**
+ * fls - find last (most-significant) bit set
+ * @x: the word to search
+ *
+ * This is defined the same way as ffs.
+ * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32.
+ */
+static inline unsigned long fls(unsigned long x)
+{
+ if (!x)
+ return 0;
+
+ asm (" lmbd .L1 1,%0,%0\n" : "+a"(x));
+
+ return 32 - x;
+}
+
+/**
+ * ffs - find first bit set
+ * @x: the word to search
+ *
+ * This is defined the same way as
+ * the libc and compiler builtin ffs routines, therefore
+ * differs in spirit from the above ffz (man ffs).
+ * Note ffs(0) = 0, ffs(1) = 1, ffs(0x80000000) = 32.
+ */
+static inline int ffs(int x)
+{
+ if (!x)
+ return 0;
+
+ return __ffs(x) + 1;
+}
+
+#define hweight8(x) generic_hweight8(x)
+
+#endif /* __KERNEL__ */
+#endif /* __ASM_C6X_BITOPS_H */
diff --git a/arch/c6x/include/asm/byteorder.h b/arch/c6x/include/asm/byteorder.h
new file mode 100644
index 0000000..9558416
--- /dev/null
+++ b/arch/c6x/include/asm/byteorder.h
@@ -0,0 +1 @@
+#include <linux/byteorder/little_endian.h>
diff --git a/arch/c6x/include/asm/cache.h b/arch/c6x/include/asm/cache.h
new file mode 100644
index 0000000..75b2043
--- /dev/null
+++ b/arch/c6x/include/asm/cache.h
@@ -0,0 +1,29 @@
+/*
+ * (C) Copyright 2011, Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
+ *
+ * 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
+ */
+
+#ifndef __ASM_C6X_CACHE_H_
+#define __ASM_C6X_CACHE_H_
+
+#ifdef CONFIG_SYS_CACHELINE_SIZE
+#define ARCH_DMA_MINALIGN CONFIG_SYS_CACHELINE_SIZE
+#else
+#define ARCH_DMA_MINALIGN 128
+#endif
+
+#endif /* __ASM_C6X_CACHE_H_ */
diff --git a/arch/c6x/include/asm/config.h b/arch/c6x/include/asm/config.h
new file mode 100644
index 0000000..db59e8a
--- /dev/null
+++ b/arch/c6x/include/asm/config.h
@@ -0,0 +1,3 @@
+#ifndef _ASM_CONFIG_H_
+#define _ASM_CONFIG_H_
+#endif
diff --git a/arch/c6x/include/asm/errno.h b/arch/c6x/include/asm/errno.h
new file mode 100644
index 0000000..4c82b50
--- /dev/null
+++ b/arch/c6x/include/asm/errno.h
@@ -0,0 +1 @@
+#include <asm-generic/errno.h>
diff --git a/arch/c6x/include/asm/global_data.h b/arch/c6x/include/asm/global_data.h
new file mode 100644
index 0000000..a8e0766
--- /dev/null
+++ b/arch/c6x/include/asm/global_data.h
@@ -0,0 +1,96 @@
+/*
+ * (C) Copyright 2002-2010
+ * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+ *
+ * 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
+ */
+
+#ifndef __ASM_GBL_DATA_H
+#define __ASM_GBL_DATA_H
+/*
+ * The following data structure is placed in some memory which is
+ * available very early after boot (like DPRAM on MPC8xx/MPC82xx, or
+ * some locked parts of the data cache) to allow for a minimum set of
+ * global variables during system initialization (until we have set
+ * up the memory controller so that we can use RAM).
+ *
+ * Keep it *SMALL* and remember to set GENERATED_GBL_DATA_SIZE > sizeof(gd_t)
+ */
+
+typedef struct global_data {
+ bd_t *bd;
+ unsigned long flags;
+ unsigned long baudrate;
+ unsigned long have_console; /* serial_init() was called */
+#ifdef CONFIG_PRE_CONSOLE_BUFFER
+ unsigned long precon_buf_idx; /* Pre-Console buffer index */
+#endif
+ unsigned long env_addr; /* Address of Environment struct */
+ unsigned long env_valid; /* Checksum of Environment valid? */
+ unsigned long fb_base; /* base address of frame buffer */
+
+ /* "static data" needed by most of timer.c (like on ARM platform) */
+ unsigned long timer_rate_hz;
+ unsigned long tbl;
+ unsigned long tbu;
+ unsigned long long timer_reset_value;
+ unsigned long lastinc;
+
+ phys_size_t ram_size; /* RAM size */
+#if 0
+ unsigned long relocaddr; /* Start address of U-Boot in RAM */
+ phys_size_t ram_size; /* RAM size */
+ unsigned long mon_len; /* monitor len */
+ unsigned long irq_sp; /* irq stack pointer */
+ unsigned long start_addr_sp; /* start_addr_stackpointer */
+ unsigned long reloc_off;
+#endif
+
+ void **jt; /* jump table */
+ char env_buf[32]; /* buffer for getenv() before reloc. */
+#if defined(CONFIG_POST) || defined(CONFIG_LOGBUFFER)
+ unsigned long post_log_word; /* Record POST activities */
+ unsigned long post_log_res; /* success of POST test */
+ unsigned long post_init_f_time; /* When post_init_f started */
+#endif
+} gd_t;
+
+/*
+ * Global Data Flags
+ */
+/* Code was relocated to RAM */
+#define GD_FLG_RELOC 0x00001
+/* Devices have been initialized */
+#define GD_FLG_DEVINIT 0x00002
+/* Silent mode */
+#define GD_FLG_SILENT 0x00004
+/* Critical POST test failed */
+#define GD_FLG_POSTFAIL 0x00008
+/* POST seqeunce aborted */
+#define GD_FLG_POSTSTOP 0x00010
+/* Log Buffer has been initialized */
+#define GD_FLG_LOGINIT 0x00020
+/* Disable console (in & out) */
+#define GD_FLG_DISABLE_CONSOLE 0x00040
+/* Environment imported into hash table */
+#define GD_FLG_ENV_READY 0x00080
+
+#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("B31")
+
+#endif /* __ASM_GBL_DATA_H */
diff --git a/arch/c6x/include/asm/gpio.h b/arch/c6x/include/asm/gpio.h
new file mode 100644
index 0000000..d49ad08
--- /dev/null
+++ b/arch/c6x/include/asm/gpio.h
@@ -0,0 +1,2 @@
+#include <asm/arch/gpio.h>
+#include <asm-generic/gpio.h>
diff --git a/arch/c6x/include/asm/io.h b/arch/c6x/include/asm/io.h
new file mode 100644
index 0000000..7c4ab87
--- /dev/null
+++ b/arch/c6x/include/asm/io.h
@@ -0,0 +1,68 @@
+/*
+ * linux/include/asm-c6x/io.h
+ *
+ * Port on Texas Instruments TMS320C6x architecture
+ *
+ * Copyright (C) 2004, 2009, 2010, 2011 Texas Instruments Incorporated
+ * Author: Aurelien Jacquiot (aurelien.jacquiot at jaluna.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#define __arch_getb(a) (*(volatile unsigned char *)(a))
+#define __arch_getw(a) (*(volatile unsigned short *)(a))
+#define __arch_getl(a) (*(volatile unsigned int *)(a))
+
+#define __arch_putb(v, a) (*(volatile unsigned char *)(a) = (v))
+#define __arch_putw(v, a) (*(volatile unsigned short *)(a) = (v))
+#define __arch_putl(v, a) (*(volatile unsigned int *)(a) = (v))
+
+#define __raw_writeb(v, a) __arch_putb(v, a)
+#define __raw_writew(v, a) __arch_putw(v, a)
+#define __raw_writel(v, a) __arch_putl(v, a)
+
+#define __raw_readb(a) __arch_getb(a)
+#define __raw_readw(a) __arch_getw(a)
+#define __raw_readl(a) __arch_getl(a)
+
+#define dmb() __asm__ __volatile__ ("" : : : "memory")
+#define __iormb() dmb()
+#define __iowmb() dmb()
+
+#define writeb(v, c) ({ u8 __v = v; __iowmb(); __arch_putb(__v, c); __v; })
+#define writew(v, c) ({ u16 __v = v; __iowmb(); __arch_putw(__v, c); __v; })
+#define writel(v, c) ({ u32 __v = v; __iowmb(); __arch_putl(__v, c); __v; })
+
+#define readb(c) ({ u8 __v = __arch_getb(c); __iormb(); __v; })
+#define readw(c) ({ u16 __v = __arch_getw(c); __iormb(); __v; })
+#define readl(c) ({ u32 __v = __arch_getl(c); __iormb(); __v; })
+
+
+#define in_le16(addr) \
+ ({ \
+ unsigned short __v = le16_to_cpu(readw(addr)); \
+ __v; \
+ })
+#define in_le32(addr) \
+ ({ \
+ unsigned int __v = le32_to_cpu(readl(addr)); \
+ __v; \
+ })
+#define out_le16(addr, w) (writew(cpu_to_le16(w), addr))
+#define out_le32(addr, l) (writel(cpu_to_le32(l), addr))
+
+#define clrbits(type, addr, clear) \
+ out_##type((addr), in_##type(addr) & ~(clear))
+
+#define setbits(type, addr, set) \
+ out_##type((addr), in_##type(addr) | (set))
+
+#define clrsetbits(type, addr, clear, set) \
+ out_##type((addr), (in_##type(addr) & ~(clear)) | (set))
+
+#define clrbits_le32(addr, clear) clrbits(le32, addr, clear)
+#define setbits_le32(addr, set) setbits(le32, addr, set)
+#define clrsetbits_le32(addr, clear, set) clrsetbits(le32, addr, clear, set)
+
diff --git a/arch/c6x/include/asm/posix_types.h b/arch/c6x/include/asm/posix_types.h
new file mode 100644
index 0000000..d1fffe0
--- /dev/null
+++ b/arch/c6x/include/asm/posix_types.h
@@ -0,0 +1,72 @@
+/*
+ * Based on microblaze implementation:
+ * Copyright (C) 2003 John Williams <jwilliams@itee.uq.edu.au>
+ * Copyright (C) 2001,2002 NEC Corporation
+ * Copyright (C) 2001,2002 Miles Bader <miles@gnu.org>
+ *
+ * This file is subject to the terms and conditions of the GNU General
+ * Public License. See the file COPYING in the main directory of this
+ * archive for more details.
+ *
+ * Written by Miles Bader <miles@gnu.org>
+ * Microblaze port by John Williams
+ */
+
+#ifndef __ASM_OPENRISC_POSIX_TYPES_H
+#define __ASM_OPENRISC_POSIX_TYPES_H
+
+typedef unsigned int __kernel_dev_t;
+typedef unsigned long __kernel_ino_t;
+typedef unsigned long long __kernel_ino64_t;
+typedef unsigned int __kernel_mode_t;
+typedef unsigned int __kernel_nlink_t;
+typedef long __kernel_off_t;
+typedef long long __kernel_loff_t;
+typedef int __kernel_pid_t;
+typedef unsigned short __kernel_ipc_pid_t;
+typedef unsigned int __kernel_uid_t;
+typedef unsigned int __kernel_gid_t;
+typedef unsigned int __kernel_size_t;
+typedef int __kernel_ssize_t;
+typedef int __kernel_ptrdiff_t;
+typedef long __kernel_time_t;
+typedef long __kernel_suseconds_t;
+typedef long __kernel_clock_t;
+typedef int __kernel_daddr_t;
+typedef char *__kernel_caddr_t;
+typedef unsigned short __kernel_uid16_t;
+typedef unsigned short __kernel_gid16_t;
+typedef unsigned int __kernel_uid32_t;
+typedef unsigned int __kernel_gid32_t;
+
+typedef unsigned short __kernel_old_uid_t;
+typedef unsigned short __kernel_old_gid_t;
+
+
+typedef struct {
+#if defined(__KERNEL__) || defined(__USE_ALL)
+ int val[2];
+#else /* !defined(__KERNEL__) && !defined(__USE_ALL) */
+ int __val[2];
+#endif /* !defined(__KERNEL__) && !defined(__USE_ALL) */
+} __kernel_fsid_t;
+
+
+#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
+
+#undef __FD_SET
+#define __FD_SET(fd, fd_set) \
+ __set_bit(fd, (void *)&((__kernel_fd_set *)fd_set)->fds_bits)
+#undef __FD_CLR
+#define __FD_CLR(fd, fd_set) \
+ __clear_bit(fd, (void *)&((__kernel_fd_set *)fd_set)->fds_bits)
+#undef __FD_ISSET
+#define __FD_ISSET(fd, fd_set) \
+ __test_bit(fd, (void *)&((__kernel_fd_set *)fd_set)->fds_bits)
+#undef __FD_ZERO
+#define __FD_ZERO(fd_set) \
+ memset(fd_set, 0, sizeof(*(fd_set *)fd_set))
+
+#endif /* defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) */
+
+#endif /* __ASM_OPENRISC_POSIX_TYPES_H */
diff --git a/arch/c6x/include/asm/processor.h b/arch/c6x/include/asm/processor.h
new file mode 100644
index 0000000..ec98171
--- /dev/null
+++ b/arch/c6x/include/asm/processor.h
@@ -0,0 +1,4 @@
+#ifndef __ASM_C6X_PROCESSOR_H
+#define __ASM_C6X_PROCESSOR_H
+
+#endif
diff --git a/arch/c6x/include/asm/ptrace.h b/arch/c6x/include/asm/ptrace.h
new file mode 100644
index 0000000..2eaeb11
--- /dev/null
+++ b/arch/c6x/include/asm/ptrace.h
@@ -0,0 +1,310 @@
+/*
+ * linux/include/asm-c6x/ptrace.h
+ *
+ * Port on Texas Instruments TMS320C6x architecture
+ *
+ * Copyright (C) 2004, 2006, 2009, 2010, 2011 Texas Instruments Incorporated
+ * Author: Aurelien Jacquiot (aurelien.jacquiot at jaluna.com)
+ *
+ * Updated for 2.6.34: Mark Salter <msalter@redhat.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#ifndef __ASM_C6X_PTRACE_H
+#define __ASM_C6X_PTRACE_H
+
+#if defined(__TMS320C6XPLUS__) || defined(_TMS320C6400_PLUS) \
+ || defined(__TMS320C66X__)
+#define BKPT_OPCODE 0x56454314 /* illegal opcode */
+#else
+#define BKPT_OPCODE 0x0000a122 /* BNOP .S2 0,5 */
+#endif
+
+#ifdef _BIG_ENDIAN
+#define PT_LO(odd, even) odd
+#define PT_HI(odd, even) even
+#else
+#define PT_LO(odd, even) even
+#define PT_HI(odd, even) odd
+#endif
+
+#if defined(__TMS320C6XPLUS__) || defined(_TMS320C6400_PLUS) || \
+ defined(__TMS320C66X__)
+
+#define PT_A4_ORG PT_LO(1, 0)
+#define PT_TSR PT_HI(1, 0)
+#define PT_ILC PT_LO(3, 2)
+#define PT_RILC PT_HI(3, 2)
+#define PT_CSR PT_LO(5, 4)
+#define PT_PC PT_HI(5, 4)
+#define PT_B16 PT_LO(7, 6)
+#define PT_B17 PT_HI(7, 6)
+#define PT_B18 PT_LO(9, 8)
+#define PT_B19 PT_HI(9, 8)
+#define PT_B20 PT_LO(11, 10)
+#define PT_B21 PT_HI(11, 10)
+#define PT_B22 PT_LO(13, 12)
+#define PT_B23 PT_HI(13, 12)
+#define PT_B24 PT_LO(15, 14)
+#define PT_B25 PT_HI(15, 14)
+#define PT_B26 PT_LO(17, 16)
+#define PT_B27 PT_HI(17, 16)
+#define PT_B28 PT_LO(19, 18)
+#define PT_B29 PT_HI(19, 18)
+#define PT_B30 PT_LO(21, 20)
+#define PT_B31 PT_HI(21, 20)
+#define PT_B0 PT_LO(23, 22)
+#define PT_B1 PT_HI(23, 22)
+#define PT_B2 PT_LO(25, 24)
+#define PT_B3 PT_HI(25, 24)
+#define PT_B4 PT_LO(27, 26)
+#define PT_B5 PT_HI(27, 26)
+#define PT_B6 PT_LO(29, 28)
+#define PT_B7 PT_HI(29, 28)
+#define PT_B8 PT_LO(31, 30)
+#define PT_B9 PT_HI(31, 30)
+#define PT_B10 PT_LO(33, 32)
+#define PT_B11 PT_HI(33, 32)
+#define PT_B12 PT_LO(35, 34)
+#define PT_B13 PT_HI(35, 34)
+#define PT_A16 PT_LO(37, 36)
+#define PT_A17 PT_HI(37, 36)
+#define PT_A18 PT_LO(39, 38)
+#define PT_A19 PT_HI(39, 38)
+#define PT_A20 PT_LO(41, 40)
+#define PT_A21 PT_HI(41, 40)
+#define PT_A22 PT_LO(43, 42)
+#define PT_A23 PT_HI(43, 42)
+#define PT_A24 PT_LO(45, 44)
+#define PT_A25 PT_HI(45, 44)
+#define PT_A26 PT_LO(47, 46)
+#define PT_A27 PT_HI(47, 46)
+#define PT_A28 PT_LO(49, 48)
+#define PT_A29 PT_HI(49, 48)
+#define PT_A30 PT_LO(51, 50)
+#define PT_A31 PT_HI(51, 50)
+#define PT_A0 PT_LO(53, 52)
+#define PT_A1 PT_HI(53, 52)
+#define PT_A2 PT_LO(55, 54)
+#define PT_A3 PT_HI(55, 54)
+#define PT_A4 PT_LO(57, 56)
+#define PT_A5 PT_HI(57, 56)
+#define PT_A6 PT_LO(59, 58)
+#define PT_A7 PT_HI(59, 58)
+#define PT_A8 PT_LO(61, 60)
+#define PT_A9 PT_HI(61, 60)
+#define PT_A10 PT_LO(63, 62)
+#define PT_A11 PT_HI(63, 62)
+#define PT_A12 PT_LO(65, 64)
+#define PT_A13 PT_HI(65, 64)
+#define PT_A14 PT_LO(67, 66)
+#define PT_A15 PT_HI(67, 66)
+#define PT_B14 PT_LO(69, 68)
+#define PT_B15 PT_HI(69, 68)
+
+#else /* defined(__TMS320C6XPLUS__) */
+
+#define PT_A4_ORG PT_LO(1, 0)
+#define PT_STKADJ PT_HI(1, 0)
+#define PT_CSR PT_LO(3, 2)
+#define PT_PC PT_HI(3, 2)
+#if defined(_TMS320C6400)
+#define PT_B16 PT_LO(5, 4)
+#define PT_B17 PT_HI(5, 4)
+#define PT_B18 PT_LO(7, 6)
+#define PT_B19 PT_HI(7, 6)
+#define PT_B20 PT_LO(9, 8)
+#define PT_B21 PT_HI(9, 8)
+#define PT_B22 PT_LO(11, 10)
+#define PT_B23 PT_HI(11, 10)
+#define PT_B24 PT_LO(13, 12)
+#define PT_B25 PT_HI(13, 12)
+#define PT_B26 PT_LO(15, 14)
+#define PT_B27 PT_HI(15, 14)
+#define PT_B28 PT_LO(17, 16)
+#define PT_B29 PT_HI(17, 16)
+#define PT_B30 PT_LO(19, 18)
+#define PT_B31 PT_HI(19, 18)
+#endif /* defined(_TMS320C6400) */
+#define PT_B0 PT_LO(21, 20)
+#define PT_B1 PT_HI(21, 20)
+#define PT_B2 PT_LO(23, 22)
+#define PT_B3 PT_HI(23, 22)
+#define PT_B4 PT_LO(25, 24)
+#define PT_B5 PT_HI(25, 24)
+#define PT_B6 PT_LO(27, 26)
+#define PT_B7 PT_HI(27, 26)
+#define PT_B8 PT_LO(29, 28)
+#define PT_B9 PT_HI(29, 28)
+#define PT_B10 PT_LO(31, 30)
+#define PT_B11 PT_HI(31, 30)
+#define PT_B12 PT_LO(33, 32)
+#define PT_B13 PT_HI(33, 32)
+#if defined(_TMS320C6400)
+#define PT_A16 PT_LO(35, 34)
+#define PT_A17 PT_HI(35, 34)
+#define PT_A18 PT_LO(37, 36)
+#define PT_A19 PT_HI(37, 36)
+#define PT_A20 PT_LO(39, 38)
+#define PT_A21 PT_HI(39, 38)
+#define PT_A22 PT_LO(41, 40)
+#define PT_A23 PT_HI(41, 40)
+#define PT_A24 PT_LO(43, 42)
+#define PT_A25 PT_HI(43, 42)
+#define PT_A26 PT_LO(45, 44)
+#define PT_A27 PT_HI(45, 44)
+#define PT_A28 PT_LO(47, 46)
+#define PT_A29 PT_HI(47, 46)
+#define PT_A30 PT_LO(49, 48)
+#define PT_A31 PT_HI(49, 48)
+#endif /* defined(_TMS320C6400) */
+#define PT_A0 PT_LO(51, 50)
+#define PT_A1 PT_HI(51, 50)
+#define PT_A2 PT_LO(53, 52)
+#define PT_A3 PT_HI(53, 52)
+#define PT_A4 PT_LO(55, 54)
+#define PT_A5 PT_HI(55, 54)
+#define PT_A6 PT_LO(57, 56)
+#define PT_A7 PT_HI(57, 56)
+#define PT_A8 PT_LO(59, 58)
+#define PT_A9 PT_HI(59, 58)
+#define PT_A10 PT_LO(61, 60)
+#define PT_A11 PT_HI(61, 60)
+#define PT_A12 PT_LO(63, 62)
+#define PT_A13 PT_HI(63, 62)
+#define PT_A14 PT_LO(65, 64)
+#define PT_A15 PT_HI(65, 64)
+#define PT_B14 PT_LO(67, 66)
+#define PT_B15 PT_HI(67, 66)
+
+#endif /* defined(__TMS320C6XPLUS__) */
+
+#define PT_DP PT_B14 /* Data Segment Pointer (B14) */
+#define PT_SP PT_B15 /* Stack Pointer (B15) */
+
+#ifndef __ASSEMBLY__
+
+#ifdef _BIG_ENDIAN
+#define REG_PAIR(odd, even) unsigned long odd; unsigned long even
+#else
+#define REG_PAIR(odd, even) unsigned long even; unsigned long odd
+#endif
+
+/*
+ * this struct defines the way the registers are stored on the
+ * stack during a system call. fields defined with REG_PAIR
+ * are saved and restored using double-word memory operations
+ * which means the word ordering of the pair depends on endianess.
+ */
+struct pt_regs {
+#if defined(__TMS320C6XPLUS__) || defined(_TMS320C6400_PLUS) || \
+ defined(__TMS320C66X__)
+ REG_PAIR(tsr, orig_a4);
+ REG_PAIR(rilc, ilc);
+#else
+ REG_PAIR(stkadj, orig_a4);
+#endif
+ REG_PAIR(pc, csr);
+
+#if defined(_TMS320C6400)
+ REG_PAIR(b17, b16);
+ REG_PAIR(b19, b18);
+ REG_PAIR(b21, b20);
+ REG_PAIR(b23, b22);
+ REG_PAIR(b25, b24);
+ REG_PAIR(b27, b26);
+ REG_PAIR(b29, b28);
+ REG_PAIR(b31, b30);
+#endif /* defined(_TMS320C6400) */
+
+ REG_PAIR(b1, b0);
+ REG_PAIR(b3, b2);
+ REG_PAIR(b5, b4);
+ REG_PAIR(b7, b6);
+ REG_PAIR(b9, b8);
+ REG_PAIR(b11, b10);
+ REG_PAIR(b13, b12);
+
+#if defined(_TMS320C6400)
+ REG_PAIR(a17, a16);
+ REG_PAIR(a19, a18);
+ REG_PAIR(a21, a20);
+ REG_PAIR(a23, a22);
+ REG_PAIR(a25, a24);
+ REG_PAIR(a27, a26);
+ REG_PAIR(a29, a28);
+ REG_PAIR(a31, a30);
+#endif /* defined(_TMS320C6400) */
+
+ REG_PAIR(a1, a0);
+ REG_PAIR(a3, a2);
+ REG_PAIR(a5, a4);
+ REG_PAIR(a7, a6);
+ REG_PAIR(a9, a8);
+ REG_PAIR(a11, a10);
+ REG_PAIR(a13, a12);
+
+ REG_PAIR(a15, a14);
+ REG_PAIR(sp, dp);
+};
+
+/*
+ * This is the extended stack used by the context switcher
+ */
+struct switch_stack {
+#if defined(__TMS320C6XPLUS__) || defined(_TMS320C6400_PLUS) || \
+ defined(__TMS320C66X__)
+ REG_PAIR(rilc, ilc);
+#endif
+ REG_PAIR(a11, a10);
+ REG_PAIR(a13, a12);
+ REG_PAIR(a15, a14);
+ REG_PAIR(b11, b10);
+ REG_PAIR(b13, b12);
+
+ unsigned long retpc;
+ unsigned long pad;
+};
+
+/*
+ * These are 'magic' values for PTRACE_PEEKUSR that return info about where a
+ * process is located in memory.
+ */
+#define PT_TEXT_ADDR 0x10000
+#define PT_DATA_ADDR 0x10004
+#define PT_TEXT_END_ADDR 0x10008
+
+/* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */
+#define PTRACE_GETREGS 12
+#define PTRACE_SETREGS 13
+#define PTRACE_GETFPREGS 14
+#define PTRACE_SETFPREGS 15
+
+/* get the ELF DSBT loadmap address */
+#define PTRACE_GETDSBT 31
+/* [addr] request the executable loadmap */
+#define PTRACE_GETDSBT_EXEC 0
+/* [addr] request the interpreter loadmap */
+#define PTRACE_GETDSBT_INTERP 1
+
+#ifdef __KERNEL__
+
+/* interrupt enable by default */
+/* used in /include/asm/processor.h*/
+#define DEFAULT_CSR 0x0001
+
+#if !defined(CONFIG_TMS320C64XPLUS) && !defined(CONFIG_TMS320C66X)
+extern unsigned long current_ksp;
+#define user_mode(regs) (((((regs)->sp) ^ current_ksp) >> PAGE_SHIFT) != 0)
+#else
+#define user_mode(regs) ((((regs)->tsr) & 0x40) != 0)
+#endif
+#define instruction_pointer(regs) ((regs)->pc)
+#define profile_pc(regs) instruction_pointer(regs)
+extern void show_regs(struct pt_regs *);
+
+#endif /* __KERNEL__ */
+#endif /* __ASSEMBLY__ */
+#endif /* __ASM_C6X_PTRACE_H */
diff --git a/arch/c6x/include/asm/sizes.h b/arch/c6x/include/asm/sizes.h
new file mode 100644
index 0000000..b0b4f6a
--- /dev/null
+++ b/arch/c6x/include/asm/sizes.h
@@ -0,0 +1,51 @@
+/*
+ * 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
+ */
+/* Size defintions
+ * Copyright (C) ARM Limited 1998. All rights reserved.
+ */
+
+#ifndef __sizes_h
+#define __sizes_h 1
+
+/* handy sizes */
+#define SZ_1K 0x00000400
+#define SZ_4K 0x00001000
+#define SZ_8K 0x00002000
+#define SZ_16K 0x00004000
+#define SZ_32K 0x00008000
+#define SZ_64K 0x00010000
+#define SZ_128K 0x00020000
+#define SZ_256K 0x00040000
+#define SZ_512K 0x00080000
+
+#define SZ_1M 0x00100000
+#define SZ_2M 0x00200000
+#define SZ_4M 0x00400000
+#define SZ_8M 0x00800000
+#define SZ_16M 0x01000000
+#define SZ_31M 0x01F00000
+#define SZ_32M 0x02000000
+#define SZ_64M 0x04000000
+#define SZ_128M 0x08000000
+#define SZ_256M 0x10000000
+#define SZ_512M 0x20000000
+
+#define SZ_1G 0x40000000
+#define SZ_2G 0x80000000
+
+#endif
+
+/* END */
diff --git a/arch/c6x/include/asm/string.h b/arch/c6x/include/asm/string.h
new file mode 100644
index 0000000..98e26ed
--- /dev/null
+++ b/arch/c6x/include/asm/string.h
@@ -0,0 +1,26 @@
+/*
+ * linux/include/asm-c6x/string.h
+ *
+ * Port on Texas Instruments TMS320C6x architecture
+ *
+ * Copyright (C) 2004, 2009 Texas Instruments Incorporated
+ * Author: Aurelien Jacquiot (aurelien.jacquiot at jaluna.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#ifndef __ASM_C6X_STRING_H
+#define __ASM_C6X_STRING_H
+
+extern void *memcpy(void *to, const void *from, size_t n);
+extern void *memset(void *s, int c, size_t count);
+extern int memcmp(const void *cs, const void *ct, size_t count);
+extern void *memmove(void *s1, const void *s2, size_t n);
+
+#define __HAVE_ARCH_MEMCPY
+#define __HAVE_ARCH_MEMMOVE
+#define __HAVE_ARCH_MEMSET
+#define __HAVE_ARCH_MEMCMP
+
+#endif /* __ASM_C6X_STRING_H */
diff --git a/arch/c6x/include/asm/types.h b/arch/c6x/include/asm/types.h
new file mode 100644
index 0000000..857c792
--- /dev/null
+++ b/arch/c6x/include/asm/types.h
@@ -0,0 +1,53 @@
+#ifndef __ASM_C6X_TYPES_H
+#define __ASM_C6X_TYPES_H
+
+typedef unsigned short umode_t;
+
+/*
+ * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
+ * header files exported to user space
+ */
+
+typedef __signed__ char __s8;
+typedef unsigned char __u8;
+
+typedef __signed__ short __s16;
+typedef unsigned short __u16;
+
+typedef __signed__ int __s32;
+typedef unsigned int __u32;
+
+#if defined(__GNUC__)
+__extension__ typedef __signed__ long long __s64;
+__extension__ typedef unsigned long long __u64;
+#endif
+
+/*
+ * These aren't exported outside the kernel to avoid name space clashes
+ */
+#ifdef __KERNEL__
+
+typedef signed char s8;
+typedef unsigned char u8;
+
+typedef signed short s16;
+typedef unsigned short u16;
+
+typedef signed int s32;
+typedef unsigned int u32;
+
+typedef signed long long s64;
+typedef unsigned long long u64;
+
+#define BITS_PER_LONG 32
+
+/* Dma addresses are 32-bits wide. */
+
+typedef u32 dma_addr_t;
+
+typedef unsigned long phys_addr_t;
+typedef unsigned long phys_size_t;
+
+#endif /* __KERNEL__ */
+
+#endif
diff --git a/arch/c6x/include/asm/u-boot-c6x.h b/arch/c6x/include/asm/u-boot-c6x.h
new file mode 100644
index 0000000..2367516
--- /dev/null
+++ b/arch/c6x/include/asm/u-boot-c6x.h
@@ -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.
+*/
+
+#ifndef _U_BOOT_C6X_H_
+#define _U_BOOT_C6X_H_ 1
+
+extern ulong __bss_start;
+extern ulong __bss_end__;
+
+#endif /* _U_BOOT_C6X_H_ */
+
diff --git a/arch/c6x/include/asm/u-boot.h b/arch/c6x/include/asm/u-boot.h
new file mode 100644
index 0000000..759d976
--- /dev/null
+++ b/arch/c6x/include/asm/u-boot.h
@@ -0,0 +1,57 @@
+/*
+ * (C) Copyright 2002
+ * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
+ * Marius Groeger <mgroeger@sysgo.de>
+ *
+ * (C) Copyright 2002
+ * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
+ * Alex Zuepke <azu@sysgo.de>
+ *
+ * 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
+ *
+ ********************************************************************
+ * NOTE: This header file defines an interface to U-Boot. Including
+ * this (unmodified) header file in another file is considered normal
+ * use of U-Boot, and does *not* fall under the heading of "derived
+ * work".
+ ********************************************************************
+ */
+
+#ifndef _U_BOOT_H_
+#define _U_BOOT_H_ 1
+
+typedef struct bd_info {
+ int bi_baudrate; /* serial console baudrate */
+ unsigned long bi_ip_addr; /* IP Address */
+ ulong bi_arch_number; /* unique id for this board */
+ ulong bi_boot_params; /* where this board expects params */
+ unsigned long bi_arm_freq; /* arm frequency */
+ unsigned long bi_dsp_freq; /* dsp core frequency */
+ unsigned long bi_ddr_freq; /* ddr frequency */
+ struct /* RAM configuration */
+ {
+ ulong start;
+ ulong size;
+ } bi_dram[CONFIG_NR_DRAM_BANKS];
+} bd_t;
+
+/* For image.h:image_check_target_arch() */
+#define IH_ARCH_DEFAULT IH_ARCH_ARM
+
+#endif /* _U_BOOT_H_ */
diff --git a/arch/c6x/include/asm/unaligned.h b/arch/c6x/include/asm/unaligned.h
new file mode 100644
index 0000000..6cecbbb
--- /dev/null
+++ b/arch/c6x/include/asm/unaligned.h
@@ -0,0 +1 @@
+#include <asm-generic/unaligned.h>
diff --git a/arch/c6x/lib/Makefile b/arch/c6x/lib/Makefile
new file mode 100644
index 0000000..8214df7
--- /dev/null
+++ b/arch/c6x/lib/Makefile
@@ -0,0 +1,51 @@
+#
+# (C) Copyright 2000-2006
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# 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
+#
+
+include $(TOPDIR)/config.mk
+
+LIB = $(obj)lib$(ARCH).o
+
+SOBJS-y += csum_64plus.o memcpy_64plus.o strasgi_64plus.o
+SOBJS-y += unaligned.o divu.o divi.o pop_rts.o push_rts.o remi.o remu.o \
+ strasgi.o llshru.o llshr.o llshl.o negll.o mpyll.o \
+ divremi.o divremu.o delay.o
+
+COBJS-y += memcmp.o memmove.o memset.o divull.o
+
+COBJS-y += board.o
+COBJS-y += bootm.o
+
+SRCS := $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
+OBJS := $(addprefix $(obj),$(SOBJS-y) $(COBJS-y))
+
+$(LIB): $(obj).depend $(OBJS)
+ $(call cmd_link_o_target, $(OBJS))
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/arch/c6x/lib/board.c b/arch/c6x/lib/board.c
new file mode 100644
index 0000000..00a5a49
--- /dev/null
+++ b/arch/c6x/lib/board.c
@@ -0,0 +1,196 @@
+/*
+ * (C) Copyright 2012 Dmitry Bondar <bond@inmys.ru>
+ *
+ * (C) Copyright 2011
+ * Julius Baxter, julius at opencores.org
+ *
+ * (C) Copyright 2003, Psyent Corporation <www.psyent.com>
+ * Scott McNutt <smcnutt@psyent.com>
+ *
+ * (C) Copyright 2000-2002
+ * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+ *
+ *
+ * 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
+ */
+
+#include <common.h>
+#include <stdio_dev.h>
+#include <watchdog.h>
+#include <malloc.h>
+#include <mmc.h>
+#include <net.h>
+#ifdef CONFIG_STATUS_LED
+#include <status_led.h>
+#endif
+#ifdef CONFIG_CMD_NAND
+#include <nand.h> /* cannot even include nand.h if it isnt configured */
+#endif
+
+#include <timestamp.h>
+#include <version.h>
+#include <asm/u-boot-c6x.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+static int display_banner(void)
+{
+ printf("\n\n%s\n\n", version_string);
+ return 0;
+}
+
+#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C)
+static int init_func_i2c(void)
+{
+ puts("I2C: ");
+ i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
+ puts("ready\n");
+ return 0;
+}
+#endif
+
+
+/*
+ * Initialization sequence
+ */
+static int (* const init_sequence[])(void) = {
+#if defined(CONFIG_ARCH_CPU_INIT)
+ arch_cpu_init, /* basic arch cpu dependent setup */
+#endif
+#if defined(CONFIG_BOARD_EARLY_INIT_F)
+ board_early_init_f,
+#endif
+ timer_init, /* initialize timer */
+ env_init,
+ serial_init,
+ console_init_f,
+
+ display_banner, /* say that we are here */
+#if defined(CONFIG_DISPLAY_BOARDINFO)
+ checkboard, /* display board info */
+#endif
+#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C)
+ init_func_i2c,
+#endif
+};
+
+
+static int clear_bss(void)
+{
+ ulong dst_addr = (ulong)&__bss_start;
+ size_t len = (size_t)&__bss_end__ - (size_t)&__bss_start;
+ memset((void *)dst_addr, 0x00, len);
+ return 0;
+}
+
+/***********************************************************************/
+void board_init_f(ulong bootflag)
+{
+ bd_t *bd;
+ int i;
+
+ clear_bss();
+
+ gd = (gd_t *)CONFIG_SYS_GBL_DATA_ADDR;
+ __asm__ __volatile__("" : : : "memory");
+ memset((void *)gd, 0, GENERATED_GBL_DATA_SIZE);
+
+ gd->bd = (bd_t *)(gd+1); /* At end of global data */
+ gd->baudrate = CONFIG_BAUDRATE;
+
+ bd = gd->bd;
+#ifndef CONFIG_SYS_NO_FLASH
+ bd->bi_flashstart = CONFIG_SYS_FLASH_BASE;
+#endif
+ bd->bi_baudrate = CONFIG_BAUDRATE;
+
+ for (i = 0; i < ARRAY_SIZE(init_sequence); i++) {
+ WATCHDOG_RESET();
+ if (init_sequence[i]())
+ hang();
+ }
+
+ WATCHDOG_RESET();
+
+ /* The Malloc area is immediately below the monitor copy in RAM */
+ mem_malloc_init(CONFIG_SYS_MALLOC_BASE, CONFIG_SYS_MALLOC_LEN);
+
+ board_init();
+
+#ifndef CONFIG_SYS_NO_FLASH
+ WATCHDOG_RESET();
+ bd->bi_flashsize = flash_init();
+#endif
+
+#ifdef CONFIG_CMD_NAND
+ puts("NAND: ");
+ nand_init();
+#endif
+
+#ifdef CONFIG_GENERIC_MMC
+ puts("MMC: ");
+ mmc_initialize(bd);
+#endif
+
+ WATCHDOG_RESET();
+ env_relocate();
+
+ WATCHDOG_RESET();
+ stdio_init();
+ jumptable_init();
+ console_init_r();
+
+ WATCHDOG_RESET();
+/* interrupt_init();*/
+
+#if defined(CONFIG_BOARD_LATE_INIT)
+ board_late_init();
+#endif
+
+#if defined(CONFIG_CMD_NET)
+ puts("NET: ");
+ eth_initialize(bd);
+#endif
+
+ /* main_loop */
+ for (;;) {
+ WATCHDOG_RESET();
+ main_loop();
+ }
+}
+
+
+/***********************************************************************/
+
+void hang(void)
+{
+ disable_interrupts();
+ puts("### ERROR ### Please reset board ###\n");
+
+ while (1)
+ /*nothing*/;
+}
+
+int do_reset(cmd_tbl_t *cmdtp, int flag, int argc,
+ char *const argv[])
+{
+ reset_cpu(0);
+ return 0;
+}
+
diff --git a/arch/c6x/lib/bootm.c b/arch/c6x/lib/bootm.c
new file mode 100644
index 0000000..4bafacf
--- /dev/null
+++ b/arch/c6x/lib/bootm.c
@@ -0,0 +1,60 @@
+/*
+ * (C) Copyright 2003, Psyent Corporation <www.psyent.com>
+ * Scott McNutt <smcnutt@psyent.com>
+ *
+ * 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
+ */
+
+#include <common.h>
+#include <command.h>
+
+int disable_interrupts()
+{
+ return 0;
+}
+
+void enable_interrupts()
+{
+}
+
+int do_bootm_linux(int flag, int argc, char * const argv[],
+ bootm_headers_t *images)
+{
+ void (*kernel)() = (void *)images->ep;
+ char *commandline = getenv("bootargs");
+ if (commandline) {
+ char *dst = (char *)images->ep + 0x1000;
+ strncpy(dst, commandline, 1023);
+ dst[1023] = 0;
+ }
+ {
+ unsigned int *ptr = (unsigned int *)0xc1f00000;
+ ptr[0] = 0x64000001; /*TAG_SOL*/
+ ptr[1] = 0; /*size SOL*/
+ ptr[2] = 0x64000002; /*TAG_EOL*/
+ ptr[3] = 0;
+ }
+ asm("MVKL .S1 0x54694265,A4");
+ asm("MVKH .S1 0x54694265,A4");
+ asm("MVKL .S2 0xc1f00000,B4");
+ asm("MVKH .S2 0xc1f00000,B4");
+ kernel();
+ printf("after kernel\n");
+ return 1;
+}
diff --git a/arch/c6x/lib/csum_64plus.S b/arch/c6x/lib/csum_64plus.S
new file mode 100644
index 0000000..db26ed4
--- /dev/null
+++ b/arch/c6x/lib/csum_64plus.S
@@ -0,0 +1,408 @@
+;
+; linux/arch/c6x/lib/csum_64plus.s
+;
+; Port on Texas Instruments TMS320C6x architecture
+;
+; Copyright (C) 2006, 2009, 2010 Texas Instruments Incorporated
+; Author: Aurelien Jacquiot (aurelien.jacquiot at jaluna.com)
+;
+; This program is free software; you can redistribute it and/or modify
+; it under the terms of the GNU General Public License version 2 as
+; published by the Free Software Foundation.
+;
+
+;
+;unsigned int csum_partial_copy(const char *src, char * dst,
+; int len, int sum)
+;
+; A4: src
+; B4: dst
+; A6: len
+; B6: sum
+; return csum in A4
+;
+
+ .global csum_partial_copy
+ .text
+
+csum_partial_copy:
+ MVC .S2 ILC,B30
+
+ MV .D1X B6,A31 ; given csum
+ ZERO .D1 A9 ; csum (a side)
+|| ZERO .D2 B9 ; csum (b side)
+|| SHRU .S2X A6,2,B5 ; len / 4
+
+ ;; Check alignment and size
+ AND .S1 3,A4,A1
+|| AND .S2 3,B4,B0
+ OR .L2X B0,A1,B0 ; non aligned condition
+|| MVC .S2 B5,ILC
+|| MVK .D2 1,B2
+|| MV .D1X B5,A1 ; words condition
+ [!A1] B .S1 L8
+ [B0] BNOP .S1 L6,5
+
+ SPLOOP 1
+
+ ;; Main loop for aligned words
+ LDW .D1T1 *A4++,A7
+ NOP 4
+ MV .S2X A7,B7
+|| EXTU .S1 A7,0,16,A16
+ STW .D2T2 B7,*B4++
+|| MPYU .M2 B7,B2,B8
+|| ADD .L1 A16,A9,A9
+ NOP
+ SPKERNEL 8,0
+|| ADD .L2 B8,B9,B9
+
+ ZERO .D1 A1
+|| ADD .L1X A9,B9,A9 ; add csum from a and b sides
+
+L6:
+ [!A1] BNOP .S1 L8,5
+
+ ;; Main loop for non-aligned words
+ SPLOOP 2
+ || MVK .L1 1,A2
+
+ LDNW .D1T1 *A4++,A7
+ NOP 3
+
+ NOP
+ MV .S2X A7,B7
+ || EXTU .S1 A7,0,16,A16
+ || MPYU .M1 A7,A2,A8
+
+ ADD .L1 A16,A9,A9
+ SPKERNEL 6,0
+ || STNW .D2T2 B7,*B4++
+ || ADD .L1 A8,A9,A9
+
+L8: AND .S2X 2,A6,B5
+ CMPGT .L2 B5,0,B0
+ [!B0] BNOP .S1 L82,4
+
+ ;; Manage half-word
+ ZERO .L1 A7
+|| ZERO .D1 A8
+
+#ifdef CONFIG_CPU_BIG_ENDIAN
+
+ LDBU .D1T1 *A4++,A7
+ LDBU .D1T1 *A4++,A8
+ NOP 3
+ SHL .S1 A7,8,A0
+ ADD .S1 A8,A9,A9
+ STB .D2T1 A7,*B4++
+|| ADD .S1 A0,A9,A9
+ STB .D2T1 A8,*B4++
+
+#else
+
+ LDBU .D1T1 *A4++,A7
+ LDBU .D1T1 *A4++,A8
+ NOP 3
+ ADD .S1 A7,A9,A9
+ SHL .S1 A8,8,A0
+
+ STB .D2T1 A7,*B4++
+|| ADD .S1 A0,A9,A9
+ STB .D2T1 A8,*B4++
+
+#endif
+
+ ;; Manage eventually the last byte
+L82: AND .S2X 1,A6,B0
+ [!B0] BNOP .S1 L9,5
+
+|| ZERO .L1 A7
+
+L83: LDBU .D1T1 *A4++,A7
+ NOP 4
+
+ MV .L2X A7,B7
+
+#ifdef CONFIG_CPU_BIG_ENDIAN
+
+ STB .D2T2 B7,*B4++
+|| SHL .S1 A7,8,A7
+ ADD .S1 A7,A9,A9
+
+#else
+
+ STB .D2T2 B7,*B4++
+|| ADD .S1 A7,A9,A9
+
+#endif
+
+ ;; Fold the csum
+L9: SHRU .S2X A9,16,B0
+ [!B0] BNOP .S1 L10,5
+
+L91: SHRU .S2X A9,16,B4
+|| EXTU .S1 A9,16,16,A3
+ ADD .D1X A3,B4,A9
+
+ SHRU .S1 A9,16,A0
+ [A0] BNOP .S1 L91,5
+
+L10: ADD .D1 A31,A9,A9
+ MV .D1 A9,A4
+
+ BNOP .S2 B3,4
+ MVC .S2 B30,ILC
+
+ .global csum_partial_copy_old
+ .text
+
+;
+;unsigned short
+;ip_fast_csum(unsigned char *iph, unsigned int ihl)
+;{
+; unsigned int checksum = 0;
+; unsigned short *tosum = (unsigned short *) iph;
+; int len;
+;
+; len = ihl*4;
+;
+; if (len <= 0)
+; return 0;
+;
+; while(len) {
+; len -= 2;
+; checksum += *tosum++;
+; }
+; if (len & 1)
+; checksum += *(unsigned char*) tosum;
+;
+; while(checksum >> 16)
+; checksum = (checksum & 0xffff) + (checksum >> 16);
+;
+; return ~checksum;
+;}
+;
+; A4: iph
+; B4: ihl
+; return checksum in A4
+;
+
+ .global ip_fast_csum
+ .text
+
+ip_fast_csum:
+ ZERO .D1 A5
+ || MVC .S2 ILC,B30
+ SHL .S2 B4,2,B0
+ CMPGT .L2 B0,0,B1
+ [!B1] BNOP .S1 L15,4
+ [!B1] ZERO .D1 A3
+
+ [!B0] B .S1 L12
+ SHRU .S2 B0,1,B0
+ MVC .S2 B0,ILC
+ NOP 3
+
+ SPLOOP 1
+ LDHU .D1T1 *A4++,A3
+ NOP 3
+ NOP
+ SPKERNEL 5,0
+ || ADD .L1 A3,A5,A5
+
+L12: SHRU .S1 A5,16,A0
+ [!A0] BNOP .S1 L14,5
+
+L13: SHRU .S2X A5,16,B4
+ EXTU .S1 A5,16,16,A3
+ ADD .D1X A3,B4,A5
+ SHRU .S1 A5,16,A0
+ [A0] BNOP .S1 L13,5
+
+L14: NOT .D1 A5,A3
+ EXTU .S1 A3,16,16,A3
+
+L15: BNOP .S2 B3,3
+ MVC .S2 B30,ILC
+ MV .D1 A3,A4
+
+;
+;unsigned short
+;do_csum(unsigned char *buff, unsigned int len)
+;{
+; int odd, count;
+; unsigned int result = 0;
+;
+; if (len <= 0)
+; goto out;
+; odd = 1 & (unsigned long) buff;
+; if (odd) {
+;#ifdef __LITTLE_ENDIAN
+; result += (*buff << 8);
+;#else
+; result = *buff;
+;#endif
+; len--;
+; buff++;
+; }
+; count = len >> 1; /* nr of 16-bit words.. */
+; if (count) {
+; if (2 & (unsigned long) buff) {
+; result += *(unsigned short *) buff;
+; count--;
+; len -= 2;
+; buff += 2;
+; }
+; count >>= 1; /* nr of 32-bit words.. */
+; if (count) {
+; unsigned int carry = 0;
+; do {
+; unsigned int w = *(unsigned int *) buff;
+; count--;
+; buff += 4;
+; result += carry;
+; result += w;
+; carry = (w > result);
+; } while (count);
+; result += carry;
+; result = (result & 0xffff) + (result >> 16);
+; }
+; if (len & 2) {
+; result += *(unsigned short *) buff;
+; buff += 2;
+; }
+; }
+; if (len & 1)
+;#ifdef __LITTLE_ENDIAN
+; result += *buff;
+;#else
+; result += (*buff << 8);
+;#endif
+; result = (result & 0xffff) + (result >> 16);
+; /* add up carry.. */
+; result = (result & 0xffff) + (result >> 16);
+; if (odd)
+; result = ((result >> 8) & 0xff) | ((result & 0xff) << 8);
+;out:
+; return result;
+;}
+;
+; A4: buff
+; B4: len
+; return checksum in A4
+;
+ .global do_csum
+ .text
+do_csum:
+ CMPGT .L2 B4,0,B0
+ [!B0] BNOP .S1 L26,3
+ EXTU .S1 A4,31,31,A0
+
+ MV .L1 A0,A3
+|| MV .S1X B3,A5
+|| MV .L2 B4,B3
+|| ZERO .D1 A1
+
+#ifdef CONFIG_CPU_BIG_ENDIAN
+ [A0] SUB .L2 B3,1,B3
+|| [A0] LDBU .D1T1 *A4++,A1
+#else
+ [!A0] BNOP .S1 L21,5
+|| [A0] LDBU .D1T1 *A4++,A0
+ SUB .L2 B3,1,B3
+|| SHL .S1 A0,8,A1
+L21:
+#endif
+ SHR .S2 B3,1,B0
+ [!B0] BNOP .S1 L24,3
+ MVK .L1 2,A0
+ AND .L1 A4,A0,A0
+
+ [!A0] BNOP .S1 L22,5
+|| [A0] LDHU .D1T1 *A4++,A0
+ SUB .L2 B0,1,B0
+|| SUB .S2 B3,2,B3
+|| ADD .L1 A0,A1,A1
+L22:
+ SHR .S2 B0,1,B0
+|| ZERO .L1 A0
+
+ [!B0] BNOP .S1 L23,5
+|| [B0] MVC .S2 B0,ILC
+
+ SPLOOP 3
+ SPMASK L1
+|| MV .L1 A1,A2
+|| LDW .D1T1 *A4++,A1
+
+ NOP 4
+ ADD .L1 A0,A1,A0
+ ADD .L1 A2,A0,A2
+
+ SPKERNEL 1,2
+|| CMPGTU .L1 A1,A2,A0
+
+ ADD .L1 A0,A2,A6
+ EXTU .S1 A6,16,16,A7
+ SHRU .S2X A6,16,B0
+ NOP 1
+ ADD .L1X A7,B0,A1
+L23:
+ MVK .L2 2,B0
+ AND .L2 B3,B0,B0
+ [B0] LDHU .D1T1 *A4++,A0
+ NOP 4
+ [B0] ADD .L1 A0,A1,A1
+L24:
+ EXTU .S2 B3,31,31,B0
+#ifdef CONFIG_CPU_BIG_ENDIAN
+ [!B0] BNOP .S1 L25,4
+|| [B0] LDBU .D1T1 *A4,A0
+ SHL .S1 A0,8,A0
+ ADD .L1 A0,A1,A1
+L25:
+#else
+ [B0] LDBU .D1T1 *A4,A0
+ NOP 4
+ [B0] ADD .L1 A0,A1,A1
+#endif
+ EXTU .S1 A1,16,16,A0
+ SHRU .S2X A1,16,B0
+ NOP 1
+ ADD .L1X A0,B0,A0
+ SHRU .S1 A0,16,A1
+ ADD .L1 A0,A1,A0
+ EXTU .S1 A0,16,16,A1
+ EXTU .S1 A1,16,24,A2
+
+ EXTU .S1 A1,24,16,A0
+|| MV .L2X A3,B0
+
+ [B0] OR .L1 A0,A2,A1
+L26:
+ NOP 1
+ BNOP .S2X A5,4
+ MV .L1 A1,A4
+
+;__wsum csum_partial(const void *buff, int len, __wsum wsum)
+;{
+; unsigned int sum = (__force unsigned int)wsum;
+; unsigned int result = do_csum(buff, len);
+;
+; /* add in old sum, and carry.. */
+; result += sum;
+; if (sum > result)
+; result += 1;
+; return (__force __wsum)result;
+;}
+;
+ .global csum_partial
+csum_partial:
+ MV .L1X B3,A9
+|| CALLP .S2 do_csum,B3
+|| MV .S1 A6,A8
+ BNOP .S2X A9,2
+ ADD .L1 A8,A4,A1
+ CMPGTU .L1 A8,A1,A0
+ ADD .L1 A1,A0,A4
diff --git a/arch/c6x/lib/delay.S b/arch/c6x/lib/delay.S
new file mode 100644
index 0000000..44f2a7f
--- /dev/null
+++ b/arch/c6x/lib/delay.S
@@ -0,0 +1,39 @@
+;
+; linux/arch/c6x/lib/delay.s
+;
+; Port on Texas Instruments TMS320C6x architecture
+;
+; Copyright (C) 2004, 2009, 2010 Texas Instruments Incorporated
+; Author: Aurelien Jacquiot (aurelien.jacquiot at jaluna.com)
+;
+; This program is free software; you can redistribute it and/or modify
+; it under the terms of the GNU General Public License version 2 as
+; published by the Free Software Foundation.
+;
+ .sect ".text"
+ .global _c6x_delay
+
+_c6x_delay:
+ bdec .s1 _c6x_delay,A4
+ nop 5
+ b .s2 B3
+ nop 5
+
+#ifdef CONFIG_TI_C6X_COMPILER
+ ;; this is inlined with gcc
+
+ .global _c6x_tickdelay
+_c6x_tickdelay:
+ mvc .s2 TSCL,B1
+ add .s2x B1,A4,B1
+ || mvk .l2 1,B0
+$0:
+ [B0] b .s2 $0
+ mvc .s2 TSCL,B0
+ sub .s2 B0,B1,B0
+ cmpgt .l2 0,B0,B0
+ nop
+ nop
+ b .s2 B3
+ nop 5
+#endif
diff --git a/arch/c6x/lib/divi.S b/arch/c6x/lib/divi.S
new file mode 100644
index 0000000..cfa1e4c
--- /dev/null
+++ b/arch/c6x/lib/divi.S
@@ -0,0 +1,54 @@
+;; Copyright 2010 Free Software Foundation, Inc.
+;; Contributed by Bernd Schmidt <bernds@codesourcery.com>.
+;;
+;; 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.
+
+ ;; ABI considerations for the divide functions
+ ;; The following registers are call-used:
+ ;; __c6xabi_divi A0,A1,A2,A4,A6,B0,B1,B2,B4,B5
+ ;; __c6xabi_divu A0,A1,A2,A4,A6,B0,B1,B2,B4
+ ;; __c6xabi_remi A1,A2,A4,A5,A6,B0,B1,B2,B4
+ ;; __c6xabi_remu A1,A4,A5,A7,B0,B1,B2,B4
+ ;;
+ ;; In our implementation, divu and remu are leaf functions,
+ ;; while both divi and remi call into divu.
+ ;; A0 is not clobbered by any of the functions.
+ ;; divu does not clobber B2 either, which is taken advantage of
+ ;; in remi.
+ ;; divi uses B5 to hold the original return address during
+ ;; the call to divu.
+ ;; remi uses B2 and A5 to hold the input values during the
+ ;; call to divu. It stores B3 in on the stack.
+
+#ifdef CONFIG_TI_C6X_COMPILER
+ .ref __c6xabi_divu
+#endif
+ .text
+ .global __c6xabi_divi
+__c6xabi_divi:
+ call .s2 __c6xabi_divu
+|| mv .d2 B3, B5
+|| cmpgt .l1 0, A4, A1
+|| cmpgt .l2 0, B4, B1
+
+ [A1] neg .l1 A4, A4
+|| [B1] neg .l2 B4, B4
+|| xor .s1x A1, B1, A1
+ [A1] addkpc .s2 _divu_ret, B3, 4
+_divu_ret:
+ neg .l1 A4, A4
+|| mv .l2 B3,B5
+|| ret .s2 B5
+ nop 5
diff --git a/arch/c6x/lib/divremi.S b/arch/c6x/lib/divremi.S
new file mode 100644
index 0000000..b7664c3
--- /dev/null
+++ b/arch/c6x/lib/divremi.S
@@ -0,0 +1,61 @@
+;; Copyright 2010 Free Software Foundation, Inc.
+;; Contributed by Bernd Schmidt <bernds@codesourcery.com>.
+;;
+;; 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.
+
+#ifdef CONFIG_TI_C6X_COMPILER
+ .ref __c6xabi_divu
+#endif
+ .text
+ .global __c6xabi_divremi
+
+__c6xabi_divremi:
+ stw .d2t2 B3, *B15--[2]
+|| cmpgt .l1 0, A4, A1
+|| cmpgt .l2 0, B4, B2
+|| mv .s1 A4, A5
+|| call .s2 __c6xabi_divu
+
+ [A1] neg .l1 A4, A4
+|| [B2] neg .l2 B4, B4
+|| xor .s2x B2, A1, B0
+|| mv .d2 B4, B2
+
+ [B0] addkpc .s2 _divu_ret_1, B3, 1
+ [!B0] addkpc .s2 _divu_ret_2, B3, 1
+ nop 2
+_divu_ret_1:
+ neg .l1 A4, A4
+_divu_ret_2:
+ ldw .d2t2 *++B15[2], B3
+
+#if defined(CONFIG_TMS320C64XPLUS) || defined(CONFIG_TMS320C66X)
+ mpy32 .m1x A4, B2, A6
+ nop 3
+ ret .s2 B3
+ sub .l1 A5, A6, A5
+ nop 4
+#else
+ mpyu .m1x A4, B2, A1
+ nop 1
+ mpylhu .m1x A4, B2, A6
+|| mpylhu .m2x B2, A4, B2
+|| ret .s2 B3
+ nop 1
+ add .l1x A6, B2, A6
+ shl .s1 A6, 16, A6
+ add .d1 A6, A1, A6
+ sub .l1 A5, A6, A5
+#endif
diff --git a/arch/c6x/lib/divremu.S b/arch/c6x/lib/divremu.S
new file mode 100644
index 0000000..83e2bb7
--- /dev/null
+++ b/arch/c6x/lib/divremu.S
@@ -0,0 +1,86 @@
+;; Copyright 2011 Free Software Foundation, Inc.
+;; Contributed by Bernd Schmidt <bernds@codesourcery.com>.
+;;
+;; 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.
+
+ .text
+ .global __c6xabi_divremu
+
+__c6xabi_divremu:
+ ;; We use a series of up to 31 subc instructions. First, we find
+ ;; out how many leading zero bits there are in the divisor. This
+ ;; gives us both a shift count for aligning (shifting) the divisor
+ ;; to the, and the number of times we have to execute subc.
+
+ ;; At the end, we have both the remainder and most of the quotient
+ ;; in A4. The top bit of the quotient is computed first and is
+ ;; placed in A2.
+
+ ;; Return immediately if the dividend is zero. Setting B4 to 1
+ ;; is a trick to allow us to leave the following insns in the jump
+ ;; delay slot without affecting the result.
+ mv .s2x A4, B1
+
+[b1] lmbd .l2 1, B4, B1
+||[!b1] b .s2 B3 ; RETURN A
+||[!b1] mvk .d2 1, B4
+
+||[!b1] zero .s1 A5
+ mv .l1x B1, A6
+|| shl .s2 B4, B1, B4
+
+ ;; The loop performs a maximum of 28 steps, so we do the
+ ;; first 3 here.
+ cmpltu .l1x A4, B4, A2
+[!A2] sub .l1x A4, B4, A4
+|| shru .s2 B4, 1, B4
+|| xor .s1 1, A2, A2
+
+ shl .s1 A2, 31, A2
+|| [b1] subc .l1x A4,B4,A4
+|| [b1] add .s2 -1, B1, B1
+[b1] subc .l1x A4,B4,A4
+|| [b1] add .s2 -1, B1, B1
+
+ ;; RETURN A may happen here (note: must happen before the next branch)
+0:
+ cmpgt .l2 B1, 7, B0
+|| [b1] subc .l1x A4,B4,A4
+|| [b1] add .s2 -1, B1, B1
+[b1] subc .l1x A4,B4,A4
+|| [b1] add .s2 -1, B1, B1
+|| [b0] b .s1 0b
+[b1] subc .l1x A4,B4,A4
+|| [b1] add .s2 -1, B1, B1
+[b1] subc .l1x A4,B4,A4
+|| [b1] add .s2 -1, B1, B1
+[b1] subc .l1x A4,B4,A4
+|| [b1] add .s2 -1, B1, B1
+[b1] subc .l1x A4,B4,A4
+|| [b1] add .s2 -1, B1, B1
+[b1] subc .l1x A4,B4,A4
+|| [b1] add .s2 -1, B1, B1
+ ;; loop backwards branch happens here
+
+ ret .s2 B3
+|| mvk .s1 32, A1
+ sub .l1 A1, A6, A6
+|| extu .s1 A4, A6, A5
+ shl .s1 A4, A6, A4
+ shru .s1 A4, 1, A4
+|| sub .l1 A6, 1, A6
+ or .l1 A2, A4, A4
+ shru .s1 A4, A6, A4
+ nop
diff --git a/arch/c6x/lib/divu.S b/arch/c6x/lib/divu.S
new file mode 100644
index 0000000..340b536
--- /dev/null
+++ b/arch/c6x/lib/divu.S
@@ -0,0 +1,100 @@
+;; Copyright 2010 Free Software Foundation, Inc.
+;; Contributed by Bernd Schmidt <bernds@codesourcery.com>.
+;;
+;; 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.
+
+ ;; ABI considerations for the divide functions
+ ;; The following registers are call-used:
+ ;; __c6xabi_divi A0,A1,A2,A4,A6,B0,B1,B2,B4,B5
+ ;; __c6xabi_divu A0,A1,A2,A4,A6,B0,B1,B2,B4
+ ;; __c6xabi_remi A1,A2,A4,A5,A6,B0,B1,B2,B4
+ ;; __c6xabi_remu A1,A4,A5,A7,B0,B1,B2,B4
+ ;;
+ ;; In our implementation, divu and remu are leaf functions,
+ ;; while both divi and remi call into divu.
+ ;; A0 is not clobbered by any of the functions.
+ ;; divu does not clobber B2 either, which is taken advantage of
+ ;; in remi.
+ ;; divi uses B5 to hold the original return address during
+ ;; the call to divu.
+ ;; remi uses B2 and A5 to hold the input values during the
+ ;; call to divu. It stores B3 in on the stack.
+
+#ifdef CONFIG_TI_C6X_COMPILER
+ .def __c6xabi_divu
+#endif
+ .text
+ .global __c6xabi_divu
+__c6xabi_divu:
+ ;; We use a series of up to 31 subc instructions. First, we find
+ ;; out how many leading zero bits there are in the divisor. This
+ ;; gives us both a shift count for aligning (shifting) the divisor
+ ;; to the, and the number of times we have to execute subc.
+
+ ;; At the end, we have both the remainder and most of the quotient
+ ;; in A4. The top bit of the quotient is computed first and is
+ ;; placed in A2.
+
+ ;; Return immediately if the dividend is zero.
+ mv .s2x A4, B1
+ [B1] lmbd .l2 1, B4, B1
+|| [!B1] b .s2 B3 ; RETURN A
+|| [!B1] mvk .d2 1, B4
+ mv .l1x B1, A6
+|| shl .s2 B4, B1, B4
+
+ ;; The loop performs a maximum of 28 steps, so we do the
+ ;; first 3 here.
+ cmpltu .l1x A4, B4, A2
+ [!A2] sub .l1x A4, B4, A4
+|| shru .s2 B4, 1, B4
+|| xor .s1 1, A2, A2
+
+ shl .s1 A2, 31, A2
+|| [B1] subc .l1x A4,B4,A4
+|| [B1] add .s2 -1, B1, B1
+ [B1] subc .l1x A4,B4,A4
+|| [B1] add .s2 -1, B1, B1
+
+ ;; RETURN A may happen here (note: must happen before the next branch)
+_divu_loop:
+ cmpgt .l2 B1, 7, B0
+|| [B1] subc .l1x A4,B4,A4
+|| [B1] add .s2 -1, B1, B1
+ [B1] subc .l1x A4,B4,A4
+|| [B1] add .s2 -1, B1, B1
+|| [B0] b .s1 _divu_loop
+ [B1] subc .l1x A4,B4,A4
+|| [B1] add .s2 -1, B1, B1
+ [B1] subc .l1x A4,B4,A4
+|| [B1] add .s2 -1, B1, B1
+ [B1] subc .l1x A4,B4,A4
+|| [B1] add .s2 -1, B1, B1
+ [B1] subc .l1x A4,B4,A4
+|| [B1] add .s2 -1, B1, B1
+ [B1] subc .l1x A4,B4,A4
+|| [B1] add .s2 -1, B1, B1
+ ;; loop backwards branch happens here
+
+ ret .s2 B3
+|| mvk .s1 32, A1
+ sub .l1 A1, A6, A6
+ shl .s1 A4, A6, A4
+ shru .s1 A4, 1, A4
+|| sub .l1 A6, 1, A6
+ or .l1 A2, A4, A4
+ shru .s1 A4, A6, A4
+ nop
+
diff --git a/arch/c6x/lib/divull.c b/arch/c6x/lib/divull.c
new file mode 100644
index 0000000..8c00edc
--- /dev/null
+++ b/arch/c6x/lib/divull.c
@@ -0,0 +1,336 @@
+/* Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+ 2000, 2001, 2002 Free Software Foundation, Inc.
+
+This code was pulled from an old (GPLv2) libgcc.
+
+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, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file. (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+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 GCC; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+
+#include <linux/types.h>
+#include <linux/bitops.h>
+
+#ifdef CONFIG_TI_C6X_COMPILER
+#define count_leading_zeros(count, x) (count) = _lmbd(1, (x))
+#else
+static inline unsigned __clz(unsigned x)
+{
+ asm(" lmbd .l1 1,%0,%0\n" : "+a"(x));
+ return x;
+}
+#define count_leading_zeros(count, x) (count) = __clz(x)
+#endif
+
+#define W_TYPE_SIZE 32
+
+#define __BITS4 (W_TYPE_SIZE / 4)
+#define __ll_B ((uint32_t) 1 << (W_TYPE_SIZE / 2))
+#define __ll_lowpart(t) ((uint32_t) (t) & (__ll_B - 1))
+#define __ll_highpart(t) ((uint32_t) (t) >> (W_TYPE_SIZE / 2))
+
+
+#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
+ do { \
+ uint32_t __x; \
+ __x = (al) - (bl); \
+ (sh) = (ah) - (bh) - (__x > (al)); \
+ (sl) = __x; \
+ } while (0)
+
+#define umul_ppmm(w1, w0, u, v) \
+ do { \
+ uint32_t __x0, __x1, __x2, __x3; \
+ uint16_t __ul, __vl, __uh, __vh; \
+ \
+ __ul = __ll_lowpart(u); \
+ __uh = __ll_highpart(u); \
+ __vl = __ll_lowpart(v); \
+ __vh = __ll_highpart(v); \
+ \
+ __x0 = (uint32_t) __ul * __vl; \
+ __x1 = (uint32_t) __ul * __vh; \
+ __x2 = (uint32_t) __uh * __vl; \
+ __x3 = (uint32_t) __uh * __vh; \
+ \
+ __x1 += __ll_highpart(__x0);/* this can't give carry */ \
+ __x1 += __x2; /* but this indeed can */ \
+ if (__x1 < __x2) /* did we get it? */ \
+ __x3 += __ll_B; /* yes, add it in the proper pos. */ \
+ \
+ (w1) = __x3 + __ll_highpart(__x1); \
+ (w0) = __ll_lowpart(__x1) * __ll_B + __ll_lowpart(__x0); \
+ } while (0)
+
+#define __udiv_qrnnd_c(q, r, n1, n0, d) \
+ do { \
+ uint32_t __d1, __d0, __q1, __q0; \
+ uint32_t __r1, __r0, __m; \
+ __d1 = __ll_highpart(d); \
+ __d0 = __ll_lowpart(d); \
+ \
+ __r1 = (n1) % __d1; \
+ __q1 = (n1) / __d1; \
+ __m = (uint32_t) __q1 * __d0; \
+ __r1 = __r1 * __ll_B | __ll_highpart(n0); \
+ if (__r1 < __m) { \
+ __q1--, __r1 += (d); \
+ /* i.e. we didn't get carry when adding to __r1 */ \
+ if (__r1 >= (d)) \
+ if (__r1 < __m) \
+ __q1--, __r1 += (d); \
+ } \
+ __r1 -= __m; \
+ \
+ __r0 = __r1 % __d1; \
+ __q0 = __r1 / __d1; \
+ __m = (uint32_t) __q0 * __d0; \
+ __r0 = __r0 * __ll_B | __ll_lowpart(n0); \
+ if (__r0 < __m) { \
+ __q0--, __r0 += (d); \
+ if (__r0 >= (d)) \
+ if (__r0 < __m) \
+ __q0--, __r0 += (d); \
+ } \
+ __r0 -= __m; \
+ \
+ (q) = (uint32_t) __q1 * __ll_B | __q0; \
+ (r) = __r0; \
+ } while (0)
+
+#define UDIV_NEEDS_NORMALIZATION 1
+#define udiv_qrnnd __udiv_qrnnd_c
+
+struct llstruct {
+#ifdef CONFIG_CPU_BIG_ENDIAN
+ uint32_t high;
+ uint32_t low;
+#else
+ uint32_t low;
+ uint32_t high;
+#endif
+};
+
+typedef union {
+ struct llstruct s;
+ int64_t ll;
+} llunion_t;
+
+static inline uint64_t __udivmoddi4(uint64_t n, uint64_t d, uint64_t *rp)
+{
+ llunion_t ww;
+ llunion_t nn, dd;
+ llunion_t rr;
+ uint32_t d0, d1, n0, n1, n2;
+ uint32_t q0, q1;
+ uint32_t b, bm;
+
+ nn.ll = n;
+ dd.ll = d;
+
+ d0 = dd.s.low;
+ d1 = dd.s.high;
+ n0 = nn.s.low;
+ n1 = nn.s.high;
+
+#if !UDIV_NEEDS_NORMALIZATION
+ if (d1 == 0) {
+ if (d0 > n1) {
+ /* 0q = nn / 0D */
+
+ udiv_qrnnd(q0, n0, n1, n0, d0);
+ q1 = 0;
+
+ /* Remainder in n0. */
+ } else {
+ /* qq = NN / 0d */
+
+ if (d0 == 0)
+ d0 = 1 / d0; /* Divide intentionally by zero. */
+
+ udiv_qrnnd(q1, n1, 0, n1, d0);
+ udiv_qrnnd(q0, n0, n1, n0, d0);
+
+ /* Remainder in n0. */
+ }
+
+ if (rp != 0) {
+ rr.s.low = n0;
+ rr.s.high = 0;
+ *rp = rr.ll;
+ }
+ }
+
+#else /* UDIV_NEEDS_NORMALIZATION */
+
+ if (d1 == 0) {
+ if (d0 > n1) {
+ /* 0q = nn / 0D */
+
+ count_leading_zeros(bm, d0);
+
+ if (bm != 0) {
+ /* Normalize, i.e. make the most significant
+ bit of the denominator set. */
+
+ d0 = d0 << bm;
+ n1 = (n1 << bm) | (n0 >> (W_TYPE_SIZE - bm));
+ n0 = n0 << bm;
+ }
+
+ udiv_qrnnd(q0, n0, n1, n0, d0);
+ q1 = 0;
+
+ /* Remainder in n0 >> bm. */
+ } else {
+ /* qq = NN / 0d */
+
+ if (d0 == 0)
+ d0 = 1 / d0; /* Divide intentionally by zero. */
+
+ count_leading_zeros(bm, d0);
+
+ if (bm == 0) {
+ /* From (n1 >= d0) /\ (the most significant bit
+ of d0 is set), conclude (the most significant
+ bit of n1 is set) /\ (the leading quotient
+ digit q1 = 1).
+
+ This special case is necessary, not an
+ optimization. (Shifts counts of W_TYPE_SIZE
+ are undefined.) */
+
+ n1 -= d0;
+ q1 = 1;
+ } else {
+ /* Normalize. */
+
+ b = W_TYPE_SIZE - bm;
+
+ d0 = d0 << bm;
+ n2 = n1 >> b;
+ n1 = (n1 << bm) | (n0 >> b);
+ n0 = n0 << bm;
+
+ udiv_qrnnd(q1, n1, n2, n1, d0);
+ }
+
+ /* n1 != d0... */
+
+ udiv_qrnnd(q0, n0, n1, n0, d0);
+
+ /* Remainder in n0 >> bm. */
+ }
+
+ if (rp != 0) {
+ rr.s.low = n0 >> bm;
+ rr.s.high = 0;
+ *rp = rr.ll;
+ }
+ }
+#endif /* UDIV_NEEDS_NORMALIZATION */
+
+ else {
+ if (d1 > n1) {
+ /* 00 = nn / DD */
+
+ q0 = 0;
+ q1 = 0;
+
+ /* Remainder in n1n0. */
+ if (rp != 0) {
+ rr.s.low = n0;
+ rr.s.high = n1;
+ *rp = rr.ll;
+ }
+ } else {
+ /* 0q = NN / dd */
+
+ count_leading_zeros(bm, d1);
+ if (bm == 0) {
+ /* From (n1 >= d1) /\ (the most significant bit
+ of d1 is set), conclude (the most significant
+ bit of n1 is set) /\ (the quotient digit
+ q0 = 0 or 1).
+
+ This special case is necessary, not an
+ optimization. */
+
+ /* The condition on the next line takes
+ advantage of that n1 >= d1 (true due to
+ program flow). */
+ if (n1 > d1 || n0 >= d0) {
+ q0 = 1;
+ sub_ddmmss(n1, n0, n1, n0, d1, d0);
+ } else
+ q0 = 0;
+
+ q1 = 0;
+
+ if (rp != 0) {
+ rr.s.low = n0;
+ rr.s.high = n1;
+ *rp = rr.ll;
+ }
+ } else {
+ uint32_t m1, m0;
+ /* Normalize. */
+
+ b = W_TYPE_SIZE - bm;
+
+ d1 = (d1 << bm) | (d0 >> b);
+ d0 = d0 << bm;
+ n2 = n1 >> b;
+ n1 = (n1 << bm) | (n0 >> b);
+ n0 = n0 << bm;
+
+ udiv_qrnnd(q0, n1, n2, n1, d1);
+ umul_ppmm(m1, m0, q0, d0);
+
+ if (m1 > n1 || (m1 == n1 && m0 > n0)) {
+ q0--;
+ sub_ddmmss(m1, m0, m1, m0, d1, d0);
+ }
+
+ q1 = 0;
+
+ /* Remainder in (n1n0 - m1m0) >> bm. */
+ if (rp != 0) {
+ sub_ddmmss(n1, n0, n1, n0, m1, m0);
+ rr.s.low = (n1 << b) | (n0 >> bm);
+ rr.s.high = n1 >> bm;
+ *rp = rr.ll;
+ }
+ }
+ }
+ }
+
+ ww.s.low = q0;
+ ww.s.high = q1;
+ return ww.ll;
+}
+
+uint64_t
+__c6xabi_divull(uint64_t n, uint64_t d)
+{
+ return __udivmoddi4(n, d, (uint64_t *)0);
+}
+
diff --git a/arch/c6x/lib/llshl.S b/arch/c6x/lib/llshl.S
new file mode 100644
index 0000000..99b739e
--- /dev/null
+++ b/arch/c6x/lib/llshl.S
@@ -0,0 +1,36 @@
+;; Copyright (C) 2010 Texas Instruments Incorporated
+;; Contributed by Mark Salter <msalter@redhat.com>.
+;;
+;; 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.
+
+;; uint64_t __c6xabi_llshl(uint64_t val, uint shift)
+
+ .text
+ .global __c6xabi_llshl
+__c6xabi_llshl:
+ mv .l1x B4,A1
+ [!A1] b .s2 B3 ; just return if zero shift
+ mvk .s1 32,A0
+ sub .d1 A0,A1,A0
+ cmplt .l1 0,A0,A2
+ [A2] shru .s1 A4,A0,A0
+ [!A2] neg .l1 A0,A5
+|| [A2] shl .s1 A5,A1,A5
+ [!A2] shl .s1 A4,A5,A5
+|| [A2] or .d1 A5,A0,A5
+|| [!A2] mvk .l1 0,A4
+ [A2] shl .s1 A4,A1,A4
+ bnop .s2 B3,5
+
diff --git a/arch/c6x/lib/llshr.S b/arch/c6x/lib/llshr.S
new file mode 100644
index 0000000..989feed
--- /dev/null
+++ b/arch/c6x/lib/llshr.S
@@ -0,0 +1,36 @@
+;; Copyright (C) 2010 Texas Instruments Incorporated
+;; Contributed by Mark Salter <msalter@redhat.com>.
+;;
+;; 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.
+
+;; uint64_t __c6xabi_llshr(uint64_t val, uint shift)
+
+ .text
+ .global __c6xabi_llshr
+__c6xabi_llshr:
+ mv .l1x B4,A1
+ [!A1] b .s2 B3 ; return if zero shift count
+ mvk .s1 32,A0
+ sub .d1 A0,A1,A0
+ cmplt .l1 0,A0,A2
+ [A2] shl .s1 A5,A0,A0
+ nop
+ [!A2] neg .l1 A0,A4
+|| [A2] shru .s1 A4,A1,A4
+ [!A2] shr .s1 A5,A4,A4
+|| [A2] or .d1 A4,A0,A4
+ [!A2] shr .s1 A5,0x1f,A5
+ [A2] shr .s1 A5,A1,A5
+ bnop .s2 B3,5
diff --git a/arch/c6x/lib/llshru.S b/arch/c6x/lib/llshru.S
new file mode 100644
index 0000000..07a4631
--- /dev/null
+++ b/arch/c6x/lib/llshru.S
@@ -0,0 +1,36 @@
+;; Copyright (C) 2010 Texas Instruments Incorporated
+;; Contributed by Mark Salter <msalter@redhat.com>.
+;;
+;; 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.
+
+;; uint64_t __c6xabi_llshru(uint64_t val, uint shift)
+
+ .text
+ .global __c6xabi_llshru
+__c6xabi_llshru:
+ mv .l1x B4,A1
+ [!A1] b .s2 B3 ; return if zero shift count
+ mvk .s1 32,A0
+ sub .d1 A0,A1,A0
+ cmplt .l1 0,A0,A2
+ [A2] shl .s1 A5,A0,A0
+ nop
+ [!A2] neg .l1 A0,A4
+|| [A2] shru .s1 A4,A1,A4
+ [!A2] shru .s1 A5,A4,A4
+|| [A2] or .d1 A4,A0,A4
+|| [!A2] mvk .l1 0,A5
+ [A2] shru .s1 A5,A1,A5
+ bnop .s2 B3,5
diff --git a/arch/c6x/lib/memcmp.c b/arch/c6x/lib/memcmp.c
new file mode 100644
index 0000000..e3a98bc
--- /dev/null
+++ b/arch/c6x/lib/memcmp.c
@@ -0,0 +1,24 @@
+/*
+ * linux/arch/c6x/lib/memcmp.c
+ *
+ * Port on Texas Instruments TMS320C6x architecture
+ *
+ * Copyright (C) 2004, 2009 Texas Instruments Incorporated
+ * Author: Aurelien Jacquiot (aurelien.jacquiot at jaluna.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include <linux/types.h>
+
+int memcmp(const void *cs, const void *ct, size_t count)
+{
+ const unsigned char *su1, *su2;
+
+ for (su1 = cs, su2 = ct; 0 < count; ++su1, ++su2, count--)
+ if (*su1 != *su2)
+ return (*su1 < *su2) ? -1 : 1;
+ return 0;
+}
+
diff --git a/arch/c6x/lib/memcpy_64plus.S b/arch/c6x/lib/memcpy_64plus.S
new file mode 100644
index 0000000..ce1d7c6
--- /dev/null
+++ b/arch/c6x/lib/memcpy_64plus.S
@@ -0,0 +1,45 @@
+; Port on Texas Instruments TMS320C6x architecture
+;
+; Copyright (C) 2006, 2009, 2010 Texas Instruments Incorporated
+; Author: Aurelien Jacquiot (aurelien.jacquiot at jaluna.com)
+;
+; This program is free software; you can redistribute it and/or modify
+; it under the terms of the GNU General Public License version 2 as
+; published by the Free Software Foundation.
+;
+
+ .global memcpy
+ .text
+
+memcpy:
+ AND .L1 0x1,A6,A0
+ || AND .S1 0x2,A6,A1
+ || AND .L2X 0x4,A6,B0
+ || MV .D1 A4,A3
+ || MVC .S2 ILC,B2
+
+ [A0] LDB .D2T1 *B4++,A5
+ [A1] LDB .D2T1 *B4++,A7
+ [A1] LDB .D2T1 *B4++,A8
+ [B0] LDNW .D2T1 *B4++,A9
+ || SHRU .S2X A6,0x3,B1
+ [!B1] BNOP .S2 B3,1
+
+ [A0] STB .D1T1 A5,*A3++
+ ||[B1] MVC .S2 B1,ILC
+ [A1] STB .D1T1 A7,*A3++
+ [A1] STB .D1T1 A8,*A3++
+ [B0] STNW .D1T1 A9,*A3++ ; return when len < 8
+
+ SPLOOP 2
+
+ LDNDW .D2T1 *B4++,A9:A8
+ NOP 3
+
+ NOP
+ SPKERNEL 0,0
+ || STNDW .D1T1 A9:A8,*A3++
+
+ BNOP .S2 B3,4
+ MVC .S2 B2,ILC
+
diff --git a/arch/c6x/lib/memmove.c b/arch/c6x/lib/memmove.c
new file mode 100644
index 0000000..5672937
--- /dev/null
+++ b/arch/c6x/lib/memmove.c
@@ -0,0 +1,30 @@
+/*
+ * linux/arch/c6x/lib/memmove.c
+ *
+ * Port on Texas Instruments TMS320C6x architecture
+ *
+ * Copyright (C) 2005, 2009 Texas Instruments Incorporated
+ * Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include <linux/types.h>
+#include <linux/string.h>
+
+void *memmove(void *s1, const void *s2, size_t n)
+{
+ register char *s = (char *) s1;
+ register const char *p = (const char *) s2;
+
+ if (p >= s) {
+ return memcpy(s, p, n);
+ } else {
+ while (n) {
+ --n;
+ s[n] = p[n];
+ }
+ }
+ return s1;
+}
diff --git a/arch/c6x/lib/memset.c b/arch/c6x/lib/memset.c
new file mode 100644
index 0000000..da4275b
--- /dev/null
+++ b/arch/c6x/lib/memset.c
@@ -0,0 +1,20 @@
+/*
+ * linux/arch/c6x/lib/memcmp.c
+ *
+ * Port on Texas Instruments TMS320C6x architecture
+ *
+ * Copyright (C) 2004, 2009 Texas Instruments Incorporated
+ * Author: Aurelien Jacquiot (aurelien.jacquiot at jaluna.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include <linux/types.h>
+void *memset(void *mem, register int ch, register size_t length)
+{
+ register char *m = (char *)mem - 1;
+ while (length--)
+ *++m = ch;
+ return mem;
+}
diff --git a/arch/c6x/lib/mpyll.S b/arch/c6x/lib/mpyll.S
new file mode 100644
index 0000000..8da8417
--- /dev/null
+++ b/arch/c6x/lib/mpyll.S
@@ -0,0 +1,47 @@
+;; Copyright (C) 2010 Texas Instruments Incorporated
+;; Contributed by Mark Salter <msalter@redhat.com>.
+;;
+;; 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.
+
+ ;; uint64_t __c6xabi_mpyll(uint64_t x, uint64_t y)
+ ;;
+ ;; 64x64 multiply
+ ;; First compute partial results using 32-bit parts of x and y:
+ ;;
+ ;; b63 b32 b31 b0
+ ;; -----------------------------
+ ;; | 1 | 0 |
+ ;; -----------------------------
+ ;;
+ ;; P0 = X0*Y0
+ ;; P1 = X0*Y1 + X1*Y0
+ ;; P2 = X1*Y1
+ ;;
+ ;; result = (P2 << 64) + (P1 << 32) + P0
+ ;;
+ ;; Since the result is also 64-bit, we can skip the P2 term.
+
+ .text
+ .global __c6xabi_mpyll
+__c6xabi_mpyll:
+ mpy32u .m1x A4,B4,A1:A0 ; X0*Y0
+ b .s2 B3
+ || mpy32u .m2x B5,A4,B1:B0 ; X0*Y1 (don't need upper 32-bits)
+ || mpy32u .m1x A5,B4,A3:A2 ; X1*Y0 (don't need upper 32-bits)
+ nop
+ nop
+ mv .s1 A0,A4
+ add .l1x A2,B0,A5
+ add .s1 A1,A5,A5
diff --git a/arch/c6x/lib/negll.S b/arch/c6x/lib/negll.S
new file mode 100644
index 0000000..7747521
--- /dev/null
+++ b/arch/c6x/lib/negll.S
@@ -0,0 +1,29 @@
+;; Copyright (C) 2010 Texas Instruments Incorporated
+;; Contributed by Mark Salter <msalter@redhat.com>.
+;;
+;; 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.
+
+;; int64_t __c6xabi_negll(int64_t val)
+
+ .text
+ .global __c6xabi_negll
+__c6xabi_negll:
+ b .s2 B3
+ mvk .l1 0,A0
+ subu .l1 A0,A4,A3:A2
+ sub .l1 A0,A5,A0
+|| ext .s1 A3,24,24,A5
+ add .l1 A5,A0,A5
+ mv .s1 A2,A4
diff --git a/arch/c6x/lib/pop_rts.S b/arch/c6x/lib/pop_rts.S
new file mode 100644
index 0000000..e1847fb
--- /dev/null
+++ b/arch/c6x/lib/pop_rts.S
@@ -0,0 +1,30 @@
+;; Copyright 2010 Free Software Foundation, Inc.
+;; Contributed by Bernd Schmidt <bernds@codesourcery.com>.
+;;
+;; 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.
+
+ .text
+ .global __c6xabi_pop_rts
+
+__c6xabi_pop_rts:
+ lddw .d2t2 *++B15, B3:B2
+ lddw .d2t1 *++B15, A11:A10
+ lddw .d2t2 *++B15, B11:B10
+ lddw .d2t1 *++B15, A13:A12
+ lddw .d2t2 *++B15, B13:B12
+ lddw .d2t1 *++B15, A15:A14
+|| b .s2 B3
+ ldw .d2t2 *++B15[2], B14
+ nop 4
diff --git a/arch/c6x/lib/push_rts.S b/arch/c6x/lib/push_rts.S
new file mode 100644
index 0000000..637d56a
--- /dev/null
+++ b/arch/c6x/lib/push_rts.S
@@ -0,0 +1,28 @@
+;; Copyright 2010 Free Software Foundation, Inc.
+;; Contributed by Bernd Schmidt <bernds@codesourcery.com>.
+;;
+;; 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.
+
+ .text
+ .global __c6xabi_push_rts
+__c6xabi_push_rts:
+ stw .d2t2 B14, *B15--[2]
+ stdw .d2t1 A15:A14, *B15--
+|| b .s2x A3
+ stdw .d2t2 B13:B12, *B15--
+ stdw .d2t1 A13:A12, *B15--
+ stdw .d2t2 B11:B10, *B15--
+ stdw .d2t1 A11:A10, *B15--
+ stdw .d2t2 B3:B2, *B15--
diff --git a/arch/c6x/lib/remi.S b/arch/c6x/lib/remi.S
new file mode 100644
index 0000000..2760d77
--- /dev/null
+++ b/arch/c6x/lib/remi.S
@@ -0,0 +1,78 @@
+;; Copyright 2010, 2011 Free Software Foundation, Inc.
+;; Contributed by Bernd Schmidt <bernds@codesourcery.com>.
+;;
+;; 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.
+
+ ;; ABI considerations for the divide functions
+ ;; The following registers are call-used:
+ ;; __c6xabi_divi A0,A1,A2,A4,A6,B0,B1,B2,B4,B5
+ ;; __c6xabi_divu A0,A1,A2,A4,A6,B0,B1,B2,B4
+ ;; __c6xabi_remi A1,A2,A4,A5,A6,B0,B1,B2,B4
+ ;; __c6xabi_remu A1,A4,A5,A7,B0,B1,B2,B4
+ ;;
+ ;; In our implementation, divu and remu are leaf functions,
+ ;; while both divi and remi call into divu.
+ ;; A0 is not clobbered by any of the functions.
+ ;; divu does not clobber B2 either, which is taken advantage of
+ ;; in remi.
+ ;; divi uses B5 to hold the original return address during
+ ;; the call to divu.
+ ;; remi uses B2 and A5 to hold the input values during the
+ ;; call to divu. It stores B3 in on the stack.
+
+#ifdef CONFIG_TI_C6X_COMPILER
+ .ref __c6xabi_divu
+#endif
+ .text
+ .global __c6xabi_remi
+
+__c6xabi_remi:
+ stw .d2t2 B3, *B15--[2]
+|| cmpgt .l1 0, A4, A1
+|| cmpgt .l2 0, B4, B2
+|| mv .s1 A4, A5
+|| call .s2 __c6xabi_divu
+
+ [A1] neg .l1 A4, A4
+|| [B2] neg .l2 B4, B4
+|| xor .s2x B2, A1, B0
+|| mv .d2 B4, B2
+
+ [B0] addkpc .s2 _divu_ret_1, B3, 1
+ [!B0] addkpc .s2 _divu_ret_2, B3, 1
+ nop 2
+_divu_ret_1:
+ neg .l1 A4, A4
+_divu_ret_2:
+ ldw .d2t2 *++B15[2], B3
+
+#if defined(CONFIG_TMS320C64XPLUS) || defined(CONFIG_TMS320C66X)
+ mpy32 .m1x A4, B2, A6
+ nop 3
+ ret .s2 B3
+ sub .l1 A5, A6, A4
+ nop 4
+#else
+ mpyu .m1x A4, B2, A1
+ nop 1
+ mpylhu .m1x A4, B2, A6
+|| mpylhu .m2x B2, A4, B2
+|| ret .s2 B3
+ nop 1
+ add .l1x A6, B2, A6
+ shl .s1 A6, 16, A6
+ add .d1 A6, A1, A6
+ sub .l1 A5, A6, A4
+#endif
diff --git a/arch/c6x/lib/remu.S b/arch/c6x/lib/remu.S
new file mode 100644
index 0000000..e1d9f30
--- /dev/null
+++ b/arch/c6x/lib/remu.S
@@ -0,0 +1,81 @@
+;; Copyright 2010 Free Software Foundation, Inc.
+;; Contributed by Bernd Schmidt <bernds@codesourcery.com>.
+;;
+;; 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.
+
+ ;; ABI considerations for the divide functions
+ ;; The following registers are call-used:
+ ;; __c6xabi_divi A0,A1,A2,A4,A6,B0,B1,B2,B4,B5
+ ;; __c6xabi_divu A0,A1,A2,A4,A6,B0,B1,B2,B4
+ ;; __c6xabi_remi A1,A2,A4,A5,A6,B0,B1,B2,B4
+ ;; __c6xabi_remu A1,A4,A5,A7,B0,B1,B2,B4
+ ;;
+ ;; In our implementation, divu and remu are leaf functions,
+ ;; while both divi and remi call into divu.
+ ;; A0 is not clobbered by any of the functions.
+ ;; divu does not clobber B2 either, which is taken advantage of
+ ;; in remi.
+ ;; divi uses B5 to hold the original return address during
+ ;; the call to divu.
+ ;; remi uses B2 and A5 to hold the input values during the
+ ;; call to divu. It stores B3 in on the stack.
+
+
+ .text
+ .global __c6xabi_remu
+
+__c6xabi_remu:
+ ;; The ABI seems designed to prevent these functions calling each other,
+ ;; so we duplicate most of the divsi3 code here.
+ mv .s2x A4, B1
+ lmbd .l2 1, B4, B1
+|| [!B1] b .s2 B3 ; RETURN A
+|| [!B1] mvk .d2 1, B4
+
+ mv .l1x B1, A7
+|| shl .s2 B4, B1, B4
+
+ cmpltu .l1x A4, B4, A1
+ [!A1] sub .l1x A4, B4, A4
+ shru .s2 B4, 1, B4
+
+_remu_loop:
+ cmpgt .l2 B1, 7, B0
+|| [B1] subc .l1x A4,B4,A4
+|| [B1] add .s2 -1, B1, B1
+ ;; RETURN A may happen here (note: must happen before the next branch)
+ [B1] subc .l1x A4,B4,A4
+|| [B1] add .s2 -1, B1, B1
+|| [B0] b .s1 _remu_loop
+ [B1] subc .l1x A4,B4,A4
+|| [B1] add .s2 -1, B1, B1
+ [B1] subc .l1x A4,B4,A4
+|| [B1] add .s2 -1, B1, B1
+ [B1] subc .l1x A4,B4,A4
+|| [B1] add .s2 -1, B1, B1
+ [B1] subc .l1x A4,B4,A4
+|| [B1] add .s2 -1, B1, B1
+ [B1] subc .l1x A4,B4,A4
+|| [B1] add .s2 -1, B1, B1
+ ;; loop backwards branch happens here
+
+ ret .s2 B3
+ [B1] subc .l1x A4,B4,A4
+|| [B1] add .s2 -1, B1, B1
+ [B1] subc .l1x A4,B4,A4
+
+ extu .s1 A4, A7, A4
+ nop 2
+
diff --git a/arch/c6x/lib/strasgi.S b/arch/c6x/lib/strasgi.S
new file mode 100644
index 0000000..6861e25
--- /dev/null
+++ b/arch/c6x/lib/strasgi.S
@@ -0,0 +1,88 @@
+;; Copyright 2010 Free Software Foundation, Inc.
+;; Contributed by Bernd Schmidt <bernds@codesourcery.com>.
+;;
+;; 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.
+
+ .text
+ .global __c6xabi_strasgi
+
+__c6xabi_strasgi:
+
+ ;; This is essentially memcpy, with alignment known to be at least
+ ;; 4, and the size a multiple of 4 greater than or equal to 28.
+ ldw .d2t1 *B4++, A0
+|| mvk .s2 16, B1
+ ldw .d2t1 *B4++, A1
+|| mvk .s2 20, B2
+|| sub .d1 A6, 24, A6
+ ldw .d2t1 *B4++, A5
+ ldw .d2t1 *B4++, A7
+|| mv .l2x A6, B7
+ ldw .d2t1 *B4++, A8
+ ldw .d2t1 *B4++, A9
+|| mv .s2x A0, B5
+|| cmpltu .l2 B2, B7, B0
+
+_strasgi_loop:
+ stw .d1t2 B5, *A4++
+|| [B0] ldw .d2t1 *B4++, A0
+|| mv .s2x A1, B5
+|| mv .l2 B7, B6
+
+ [B0] sub .d2 B6, 24, B7
+|| [B0] b .s2 _strasgi_loop
+|| cmpltu .l2 B1, B6, B0
+
+ [B0] ldw .d2t1 *B4++, A1
+|| stw .d1t2 B5, *A4++
+|| mv .s2x A5, B5
+|| cmpltu .l2 12, B6, B0
+
+ [B0] ldw .d2t1 *B4++, A5
+|| stw .d1t2 B5, *A4++
+|| mv .s2x A7, B5
+|| cmpltu .l2 8, B6, B0
+
+ [B0] ldw .d2t1 *B4++, A7
+|| stw .d1t2 B5, *A4++
+|| mv .s2x A8, B5
+|| cmpltu .l2 4, B6, B0
+
+ [B0] ldw .d2t1 *B4++, A8
+|| stw .d1t2 B5, *A4++
+|| mv .s2x A9, B5
+|| cmpltu .l2 0, B6, B0
+
+ [B0] ldw .d2t1 *B4++, A9
+|| stw .d1t2 B5, *A4++
+|| mv .s2x A0, B5
+|| cmpltu .l2 B2, B7, B0
+
+ ;; loop back branch happens here
+
+ cmpltu .l2 B1, B6, B0
+|| ret .s2 b3
+
+ [B0] stw .d1t1 A1, *A4++
+|| cmpltu .l2 12, B6, B0
+ [B0] stw .d1t1 A5, *A4++
+|| cmpltu .l2 8, B6, B0
+ [B0] stw .d1t1 A7, *A4++
+|| cmpltu .l2 4, B6, B0
+ [B0] stw .d1t1 A8, *A4++
+|| cmpltu .l2 0, B6, B0
+ [B0] stw .d1t1 A9, *A4++
+
+ ;; return happens here
diff --git a/arch/c6x/lib/strasgi_64plus.S b/arch/c6x/lib/strasgi_64plus.S
new file mode 100644
index 0000000..cbeab22
--- /dev/null
+++ b/arch/c6x/lib/strasgi_64plus.S
@@ -0,0 +1,37 @@
+;; Copyright 2010 Free Software Foundation, Inc.
+;; Contributed by Bernd Schmidt <bernds@codesourcery.com>.
+;;
+;; 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.
+
+ .text
+ .global __c6xabi_strasgi_64plus
+
+__c6xabi_strasgi_64plus:
+ shru .s2x a6, 2, b31
+|| mv .s1 a4, a30
+|| mv .d2 b4, b30
+
+ add .s2 -4, b31, b31
+
+ sploopd 1
+|| mvc .s2 b31, ilc
+ ldw .d2t2 *b30++, b31
+ nop 4
+ mv .s1x b31,a31
+ spkernel 6, 0
+|| stw .d1t1 a31, *a30++
+
+ ret .s2 b3
+ nop 5
diff --git a/arch/c6x/lib/unaligned.S b/arch/c6x/lib/unaligned.S
new file mode 100644
index 0000000..a825b4d
--- /dev/null
+++ b/arch/c6x/lib/unaligned.S
@@ -0,0 +1,117 @@
+;
+; arch/c6x/kernel/unaligned.S
+;
+; Port on Texas Instruments TMS320C6x architecture
+;
+; Copyright (C) 2010 Texas Instruments Incorporated
+; Author: Mark Salter (msalter at redhat.com)
+;
+; This program is free software; you can redistribute it and/or modify
+; it under the terms of the GNU General Public License version 2 as
+; published by the Free Software Foundation.
+;
+
+ .text
+ .global get_unaligned_le64
+ .global get_unaligned_be64
+ .global get_unaligned_le32
+ .global get_unaligned_be32
+ .global put_unaligned_le64
+ .global put_unaligned_be64
+ .global put_unaligned_le32
+ .global put_unaligned_be32
+
+; u64 get_unaligned_le64(void *ptr);
+; u64 get_unaligned_be64(void *ptr);
+;
+#ifdef CONFIG_CPU_BIG_ENDIAN
+get_unaligned_le64:
+#else
+get_unaligned_be64:
+#endif
+ LDNDW .D1T1 *A4,A5:A4
+ NOP 2
+ BNOP .S2 B3,1
+ MV .D2X A4,B0
+ SWAP2 .S2 B0,B1
+ || SWAP2 .S1 A5,A0
+ SWAP4 .L2 B1,B0
+ || SWAP4 .L1 A0,A4
+ MV .D1X B0,A5
+
+#ifdef CONFIG_CPU_BIG_ENDIAN
+get_unaligned_be64:
+#else
+get_unaligned_le64:
+#endif
+ BNOP .S2 B3,5
+ || LDNDW .D1T1 *A4,A5:A4
+
+; u32 get_unaligned_le32(void *ptr, int size);
+; u32 get_unaligned_be32(void *ptr, int size);
+;
+#ifdef CONFIG_CPU_BIG_ENDIAN
+get_unaligned_le32:
+#else
+get_unaligned_be32:
+#endif
+ LDNW .D1T1 *A4,A4
+ BNOP .S2 B3,3
+ SWAP2 .S1 A4,A0
+ SWAP4 .L1 A0,A4
+
+#ifdef CONFIG_CPU_BIG_ENDIAN
+get_unaligned_be32:
+#else
+get_unaligned_le32:
+#endif
+ BNOP .S2 B3,5
+ || LDNW .D1T1 *A4,A4
+
+
+; void put_unaligned_le64(u64 val, void *ptr);
+; void put_unaligned_be64(u64 val, void *ptr);
+;
+#ifdef CONFIG_CPU_BIG_ENDIAN
+put_unaligned_le64:
+#else
+put_unaligned_be64:
+#endif
+ B .S2 B3
+ MV .D2X A4,B0
+ SWAP2 .S2 B0,B1
+ || SWAP2 .S1 A5,A0
+ SWAP4 .L2 B1,B0
+ || SWAP4 .L1 A0,A4
+ MV .D1X B0,A5
+ STNDW .D2T1 A5:A4,*B4
+
+#ifdef CONFIG_CPU_BIG_ENDIAN
+put_unaligned_be64:
+#else
+put_unaligned_le64:
+#endif
+ BNOP .S2 B3,5
+ || STNDW .D2T1 A5:A4,*B4
+
+; void put_unaligned_le32(u32 val, void *ptr);
+; void put_unaligned_be32(u32 val, void *ptr);
+;
+#ifdef CONFIG_CPU_BIG_ENDIAN
+put_unaligned_le32:
+#else
+put_unaligned_be32:
+#endif
+ BNOP .S2 B3,2
+ SWAP2 .S1 A4,A5
+ SWAP4 .L1 A5,A4
+ STNW .D2T1 A4,*B4
+
+#ifdef CONFIG_CPU_BIG_ENDIAN
+put_unaligned_be32:
+#else
+put_unaligned_le32:
+#endif
+ BNOP .S2 B3,5
+ || STNW .D2T1 A4,*B4
+
diff --git a/common/cmd_bdinfo.c b/common/cmd_bdinfo.c
index 42f08fd..faf534b 100644
--- a/common/cmd_bdinfo.c
+++ b/common/cmd_bdinfo.c
@@ -513,6 +513,11 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
return 0;
}
+#elif defined(CONFIG_C6X)
+int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+ return 0;
+}
#else
#error "a case for this architecture does not exist!"
diff --git a/common/image.c b/common/image.c
index 91954ac..0fff687 100644
--- a/common/image.c
+++ b/common/image.c
@@ -456,8 +456,12 @@ phys_size_t getenv_bootm_size(void)
#if defined(CONFIG_ARM)
return gd->bd->bi_dram[0].size - tmp;
#else
+#if defined(CONFIG_C6X)
+ return gd->bd->bi_dram[0].size - tmp;
+#else
return gd->bd->bi_memsize - tmp;
#endif
+#endif
}
phys_size_t getenv_bootm_mapsize(void)
diff --git a/examples/standalone/stubs.c b/examples/standalone/stubs.c
index 15e9afc..c9e0819 100644
--- a/examples/standalone/stubs.c
+++ b/examples/standalone/stubs.c
@@ -195,6 +195,21 @@ gd_t *global_data;
" l.jr r13\n" \
" l.nop\n" \
: : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "r13");
+
+#elif defined(CONFIG_C6X)
+/*
+ * b31 holds the pointer to the global_data, a0 is a call-clobbered
+ * register
+ */
+#define EXPORT_FUNC(x) \
+ asm volatile ( \
+" .globl " #x "\n" \
+#x ":\n" \
+" B .S2X A0\n" \
+" NOP 3\n" \
+ : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "A0");
+
+
#else
/*" addi $sp, $sp, -24\n" \
" br $r16\n" \*/
--
1.7.2.5
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [U-Boot] [PATCH v3 2/4] c6x: Add support c674x CPUs
[not found] <add_c6x_arch>
` (7 preceding siblings ...)
2012-06-25 18:02 ` [U-Boot] [PATCH v3 1/4] " Dmitry Bondar
@ 2012-06-25 18:02 ` Dmitry Bondar
2012-06-25 22:44 ` Tom Rini
2012-07-19 3:59 ` Mike Frysinger
2012-06-25 18:02 ` [U-Boot] [PATCH v3 3/4] c6x: Add suport build davinci SOC with " Dmitry Bondar
2012-06-25 18:02 ` [U-Boot] [PATCH v3 4/4] c6x: Add support c6745-som board Dmitry Bondar
10 siblings, 2 replies; 31+ messages in thread
From: Dmitry Bondar @ 2012-06-25 18:02 UTC (permalink / raw)
To: u-boot
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
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*) }
+}
--
1.7.2.5
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [U-Boot] [PATCH v3 3/4] c6x: Add suport build davinci SOC with c674x CPUs
[not found] <add_c6x_arch>
` (8 preceding siblings ...)
2012-06-25 18:02 ` [U-Boot] [PATCH v3 2/4] c6x: Add support c674x CPUs Dmitry Bondar
@ 2012-06-25 18:02 ` Dmitry Bondar
2012-06-25 22:46 ` Tom Rini
` (2 more replies)
2012-06-25 18:02 ` [U-Boot] [PATCH v3 4/4] c6x: Add support c6745-som board Dmitry Bondar
10 siblings, 3 replies; 31+ messages in thread
From: Dmitry Bondar @ 2012-06-25 18:02 UTC (permalink / raw)
To: u-boot
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@inmys.ru>
Cc: Tom Rini <trini@ti.com>
---
Makefile | 1 +
arch/arm/cpu/arm926ejs/davinci/Makefile | 5 ++++
arch/arm/cpu/arm926ejs/davinci/reset_c.c | 32 ++++++++++++++++++++++++++++++
mkconfig | 7 +++++-
4 files changed, 44 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..44ae364
--- /dev/null
+++ b/arch/arm/cpu/arm926ejs/davinci/reset_c.c
@@ -0,0 +1,32 @@
+/*
+ * Processor reset using WDT.
+ *
+ * Copyright (C) 2012 Dmitry Bondar <bond@inmys.ru>
+ * Copyright (C) 2007 Sergey Kubushyn <ksi@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)
+ /*nothing*/;
+}
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
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [U-Boot] [PATCH v3 4/4] c6x: Add support c6745-som board
[not found] <add_c6x_arch>
` (9 preceding siblings ...)
2012-06-25 18:02 ` [U-Boot] [PATCH v3 3/4] c6x: Add suport build davinci SOC with " Dmitry Bondar
@ 2012-06-25 18:02 ` Dmitry Bondar
2012-06-25 22:42 ` Tom Rini
` (2 more replies)
10 siblings, 3 replies; 31+ messages in thread
From: Dmitry Bondar @ 2012-06-25 18:02 UTC (permalink / raw)
To: u-boot
Add support board c6745-som (http://inmys.ru/?_=/products/som_c6745) with C6745 cpu.
Signed-off-by: Dmitry Bondar <bond@inmys.ru>
Cc: Tom Rini <trini@ti.com>
---
MAINTAINERS | 3 +
board/inmys/c6745-som/Makefile | 27 ++++
board/inmys/c6745-som/c6745-som.c | 246 +++++++++++++++++++++++++++++++
boards.cfg | 1 +
include/configs/c6745-som-inmys.h | 294 +++++++++++++++++++++++++++++++++++++
5 files changed, 571 insertions(+), 0 deletions(-)
create mode 100644 board/inmys/c6745-som/Makefile
create mode 100644 board/inmys/c6745-som/c6745-som.c
create mode 100644 include/configs/c6745-som-inmys.h
diff --git a/MAINTAINERS b/MAINTAINERS
index e55893b..710f3df 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -62,6 +62,9 @@ Jerry Van Baren <gerald.vanbaren@smiths-aerospace.com>
sacsng MPC8260
+Dmitry Bondar <bond@inmys.ru>
+ c6745-som c674x
+
Oliver Brown <obrown@adventnetworks.com>
gw8260 MPC8260
diff --git a/board/inmys/c6745-som/Makefile b/board/inmys/c6745-som/Makefile
new file mode 100644
index 0000000..9a91ed2
--- /dev/null
+++ b/board/inmys/c6745-som/Makefile
@@ -0,0 +1,27 @@
+# (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$(BOARD).o
+
+COBJS-$(CONFIG_MACH_INMYS_C6745_SOM) += c6745-som.o
+
+COBJS := $(COBJS-y)
+
+SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS := $(addprefix $(obj),$(COBJS))
+SOBJS := $(addprefix $(obj),$(SOBJS))
+
+$(LIB): $(obj).depend $(OBJS) $(SOBJS)
+ $(call cmd_link_o_target, $(OBJS) $(SOBJS))
+
+#########################################################################
+# This is for $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/board/inmys/c6745-som/c6745-som.c b/board/inmys/c6745-som/c6745-som.c
new file mode 100644
index 0000000..d71ac2b
--- /dev/null
+++ b/board/inmys/c6745-som/c6745-som.c
@@ -0,0 +1,246 @@
+/*
+ * (C) Copyright 2012 Dmitry Bondar <bond@inmys.ru>
+ * From da830. Original Notices follow:
+ *
+ * Copyright (C) 2009 Nick Thompson, GE Fanuc, Ltd. <nick.thompson@gefanuc.com>
+ *
+ * Base on code from TI. Original Notices follow:
+ *
+ * (C) Copyright 2008, Texas Instruments, Inc. http://www.ti.com/
+ *
+ * Modified for DA8xx EVM.
+ *
+ * Copyright (C) 2007 Sergey Kubushyn <ksi@koi8.net>
+ *
+ * Parts are shamelessly stolen from various TI sources, original copyright
+ * follows:
+ * -----------------------------------------------------------------
+ *
+ * Copyright (C) 2004 Texas Instruments.
+ *
+ * ----------------------------------------------------------------------------
+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * ----------------------------------------------------------------------------
+ */
+
+#include <common.h>
+#include <i2c.h>
+#include <net.h>
+#include <netdev.h>
+#include <asm/arch/hardware.h>
+#include <asm/arch/emif_defs.h>
+#include <asm/arch/emac_defs.h>
+#include <asm/io.h>
+#include <asm/arch/davinci_misc.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#define pinmux(x) (&davinci_syscfg_regs->pinmux[x])
+
+/* SPI0 pin muxer settings */
+static const struct pinmux_config spi0_pins[] = {
+ { pinmux(7), 1, 3 },
+ { pinmux(7), 1, 4 },
+ { pinmux(7), 1, 5 },
+ { pinmux(7), 1, 6 },
+ { pinmux(7), 1, 7 }
+};
+
+/* EMIF-A bus pins for 8-bit NAND support on CS3 */
+static const struct pinmux_config emifa_nand_pins[] = {
+ { pinmux(13), 1, 6 },
+ { pinmux(13), 1, 7 },
+ { pinmux(14), 1, 0 },
+ { pinmux(14), 1, 1 },
+ { pinmux(14), 1, 2 },
+ { pinmux(14), 1, 3 },
+ { pinmux(14), 1, 4 },
+ { pinmux(14), 1, 5 },
+ { pinmux(15), 1, 7 },
+ { pinmux(16), 1, 0 },
+ { pinmux(18), 1, 1 },
+ { pinmux(18), 1, 4 },
+ { pinmux(18), 1, 5 },
+};
+
+/* EMAC PHY interface pins */
+static const struct pinmux_config emac_pins[] = {
+ { pinmux(9), 0, 5 },
+ { pinmux(10), 2, 1 },
+ { pinmux(10), 2, 2 },
+ { pinmux(10), 2, 3 },
+ { pinmux(10), 2, 4 },
+ { pinmux(10), 2, 5 },
+ { pinmux(10), 2, 6 },
+ { pinmux(10), 2, 7 },
+ { pinmux(11), 2, 0 },
+ { pinmux(11), 2, 1 },
+};
+
+/* UART pin muxer settings */
+static const struct pinmux_config uart_pins[] = {
+ { pinmux(8), 2, 7 },
+ { pinmux(9), 2, 0 }
+};
+
+/* I2C pin muxer settings */
+static const struct pinmux_config i2c_pins[] = {
+ { pinmux(8), 2, 3 },
+ { pinmux(8), 2, 4 }
+};
+
+/* USB0_DRVVBUS pin muxer settings */
+static const struct pinmux_config usb_pins[] = {
+ { pinmux(9), 1, 1 }
+};
+
+static const struct pinmux_resource pinmuxes[] = {
+#ifdef CONFIG_SPI_FLASH
+ PINMUX_ITEM(spi0_pins),
+#endif
+ PINMUX_ITEM(uart_pins),
+ PINMUX_ITEM(i2c_pins),
+#ifdef CONFIG_USB_DA8XX
+ PINMUX_ITEM(usb_pins),
+#endif
+#ifdef CONFIG_USE_NAND
+ PINMUX_ITEM(emifa_nand_pins),
+#endif
+#if defined(CONFIG_DRIVER_TI_EMAC)
+ PINMUX_ITEM(emac_pins),
+#endif
+};
+
+static const struct lpsc_resource lpsc[] = {
+ { DAVINCI_LPSC_AEMIF }, /* NAND, NOR */
+ { DAVINCI_LPSC_SPI0 }, /* Serial Flash */
+ { DAVINCI_LPSC_EMAC }, /* image download */
+ { DAVINCI_LPSC_UART2 }, /* console */
+ { DAVINCI_LPSC_GPIO },
+};
+
+int board_early_init_f(void)
+{
+#ifndef CONFIG_USE_IRQ
+ irq_init();
+#endif
+
+#ifdef CONFIG_NAND_DAVINCI
+ /* EMIFA 100MHz clock select */
+ writel(readl(&davinci_syscfg_regs->cfgchip3) & ~2,
+ &davinci_syscfg_regs->cfgchip3);
+ /* NAND CS setup */
+ writel((DAVINCI_ABCR_WSETUP(0) |
+ DAVINCI_ABCR_WSTROBE(2) |
+ DAVINCI_ABCR_WHOLD(0) |
+ DAVINCI_ABCR_RSETUP(0) |
+ DAVINCI_ABCR_RSTROBE(2) |
+ DAVINCI_ABCR_RHOLD(0) |
+ DAVINCI_ABCR_TA(2) |
+ DAVINCI_ABCR_ASIZE_8BIT),
+ &davinci_emif_regs->ab2cr);
+#endif
+
+ /* arch number of the board */
+ /*gd->bd->bi_arch_number = MACH_TYPE_DAVINCI_DA830_EVM;*/
+ gd->bd->bi_arch_number = 0;
+
+ /* address of boot parameters */
+ gd->bd->bi_boot_params = LINUX_BOOT_PARAM_ADDR;
+
+ /*
+ * Power on required peripherals
+ * ARM does not have access by default to PSC0 and PSC1
+ * assuming here that the DSP bootloader has set the IOPU
+ * such that PSC access is available to ARM
+ */
+ if (da8xx_configure_lpsc_items(lpsc, ARRAY_SIZE(lpsc)))
+ return 1;
+
+ /* setup the SUSPSRC for ARM to control emulation suspend */
+ writel(readl(&davinci_syscfg_regs->suspsrc) &
+ ~(DAVINCI_SYSCFG_SUSPSRC_EMAC | DAVINCI_SYSCFG_SUSPSRC_I2C |
+ DAVINCI_SYSCFG_SUSPSRC_SPI0 | DAVINCI_SYSCFG_SUSPSRC_TIMER0 |
+ DAVINCI_SYSCFG_SUSPSRC_UART2),
+ &davinci_syscfg_regs->suspsrc);
+
+#if 1
+ /* configure pinmux settings */
+ if (davinci_configure_pin_mux_items(pinmuxes, ARRAY_SIZE(pinmuxes)))
+ return 1;
+#endif
+ /*
+ * If we boot over UART, Terminal doesn't display characters
+ * Reset the values set by Boot ROM
+ */
+#if 1
+ {
+ int j;
+ for (j = 0; j < 15; j++)
+ REG(DAVINCI_UART2_BASE + (j*4)) = 0;
+ }
+ REG(DAVINCI_UART2_BASE + 0x30) = 1 | (1 << 13) | (1 << 14);
+#endif
+ /* enable the console UART */
+ writel((DAVINCI_UART_PWREMU_MGMT_FREE | DAVINCI_UART_PWREMU_MGMT_URRST |
+ DAVINCI_UART_PWREMU_MGMT_UTRST),
+ &davinci_uart2_ctrl_regs->pwremu_mgmt);
+
+ return 0;
+}
+
+int board_init()
+{
+ return 0;
+}
+
+
+#if defined(CONFIG_DRIVER_TI_EMAC)
+
+#define PHY_SW_I2C_ADDR 0x57 /* Address of PHY on i2c bus */
+
+/*
+ * Initializes on-board ethernet controllers.
+ */
+int board_eth_init(bd_t *bis)
+{
+ u_int8_t mac_addr[6];
+ struct eth_device *dev;
+
+ /* Read Ethernet MAC address from EEPROM */
+ if (dvevm_read_mac_address(mac_addr))
+ /* set address env if not already set */
+ davinci_sync_env_enetaddr(mac_addr);
+
+ /* read the address back from env */
+ if (!eth_getenv_enetaddr("ethaddr", mac_addr))
+ return -1;
+
+ /* finally, initialise the driver */
+ if (!davinci_emac_initialize()) {
+ printf("Error: Ethernet init failed!\n");
+ return -1;
+ }
+
+ dev = eth_get_dev();
+
+ /* provide the resulting addr to the driver */
+ memcpy(dev->enetaddr, mac_addr, 6);
+ dev->write_hwaddr(dev);
+
+ return 0;
+}
+#endif /* CONFIG_DRIVER_TI_EMAC */
+
diff --git a/boards.cfg b/boards.cfg
index a723f67..7acbfd1 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -302,6 +302,7 @@ ip04 blackfin blackfin
pr1 blackfin blackfin
tcm-bf518 blackfin blackfin
tcm-bf537 blackfin blackfin
+c6745-som-inmys c6x c674x c6745-som inmys davinci c6745-som-inmys
M52277EVB m68k mcf5227x m52277evb freescale - M52277EVB:SYS_SPANSION_BOOT,SYS_TEXT_BASE=0x00000000
M52277EVB_stmicro m68k mcf5227x m52277evb freescale - M52277EVB:CF_SBF,SYS_STMICRO_BOOT,SYS_TEXT_BASE=0x43E00000
M5235EVB m68k mcf523x m5235evb freescale - M5235EVB:SYS_TEXT_BASE=0xFFE00000
diff --git a/include/configs/c6745-som-inmys.h b/include/configs/c6745-som-inmys.h
new file mode 100644
index 0000000..7c8d567
--- /dev/null
+++ b/include/configs/c6745-som-inmys.h
@@ -0,0 +1,294 @@
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+/* Based on da830evm.h
+*/
+#define TMPVAL 0
+
+/*
+ * Board
+ */
+#define CONFIG_USE_NAND
+#define CONFIG_DRIVER_TI_EMAC
+#define CONFIG_CMD_GPIO
+#define CONFIG_DA8XX_GPIO
+/*#define CONFIG_DISPLAY_CPUINFO*/
+#define CONFIG_SKIP_LOWLEVEL_INIT
+
+#if 0
+#define CONFIG_USE_SPIFLASH
+#endif
+
+/*
+ * SoC Configuration
+ */
+#define CONFIG_MACH_INMYS_C6745_SOM
+#define CONFIG_C6X /* */
+#define CONFIG_SOC_DA8XX /* TI DA8xx SoC */
+#define CONFIG_SYS_CLK_FREQ clk_get(DAVINCI_ARM_CLKID)
+#define CONFIG_SYS_OSCIN_FREQ 24000000
+#define CONFIG_SYS_TIMERBASE DAVINCI_TIMER0_BASE
+#define CONFIG_SYS_HZ_CLOCK clk_get(DAVINCI_AUXCLK_CLKID)
+#define CONFIG_SYS_HZ 1000
+#define CONFIG_SKIP_LOWLEVEL_INIT
+#define CONFIG_SYS_TEXT_BASE 0xc1f80000
+#define CONFIG_BOARD_EARLY_INIT_F
+
+
+/*
+ * Memory Info
+ */
+#define CONFIG_SYS_MALLOC_LEN (0x10000 + 1*1024*1024) /* malloc() len */
+#define PHYS_SDRAM_1 0xc0000000 /* SDRAM Start */
+#define CONFIG_SYS_MEMTEST_START (PHYS_SDRAM_1 + 0x2000000)
+#define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_MEMTEST_START + (32 << 20))
+#define CONFIG_SYS_SDRAM_SIZE (32*1024*1024)
+#define CONFIG_NR_DRAM_BANKS 1 /* we have 1 bank of DRAM */
+#define CONFIG_STACKSIZE (256*1024) /* regular stack */
+
+/*
+ * Memory organisation:
+ *
+ * RAM start ---------------------------
+ * | ... |
+ * ---------------------------
+ * | Stack |
+ * ---------------------------
+ * | Global data |
+ * ---------------------------
+ * | Environment |
+ * ---------------------------
+ * | Monitor |
+ * RAM end ---------------------------
+ */
+/* We're running in RAM */
+#define CONFIG_MONITOR_IS_IN_RAM
+#define CONFIG_SYS_MONITOR_LEN 0x80000 /* Reserve 512k */
+#define CONFIG_SYS_MONITOR_BASE (CONFIG_SYS_SDRAM_BASE + \
+ CONFIG_SYS_SDRAM_SIZE - \
+ CONFIG_SYS_MONITOR_LEN)
+
+#define CONFIG_SYS_GBL_DATA_OFFSET (CONFIG_SYS_MONITOR_BASE - \
+ GENERATED_GBL_DATA_SIZE)
+#define CONFIG_SYS_GBL_DATA_ADDR CONFIG_SYS_GBL_DATA_OFFSET
+#define CONFIG_SYS_INIT_SP_ADDR CONFIG_SYS_GBL_DATA_OFFSET
+#define CONFIG_SYS_INIT_SP_OFFSET CONFIG_SYS_GBL_DATA_OFFSET
+#define CONFIG_SYS_MALLOC_BASE (CONFIG_SYS_INIT_SP_OFFSET \
+ - CONFIG_STACKSIZE \
+ - CONFIG_SYS_MALLOC_LEN)
+
+/*
+ * Serial Driver info
+ */
+#define CONFIG_SYS_NS16550
+#define CONFIG_SYS_NS16550_SERIAL
+#define CONFIG_SYS_NS16550_REG_SIZE -4 /* NS16550 register size */
+#define CONFIG_SYS_NS16550_COM1 DAVINCI_UART2_BASE /* Base address of UART2 */
+#define CONFIG_SYS_NS16550_CLK clk_get(DAVINCI_UART2_CLKID)
+#define CONFIG_CONS_INDEX 1 /* use UART0 for console */
+#define CONFIG_BAUDRATE 115200 /* Default baud rate */
+#define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 }
+
+#if 1
+/*
+ * I2C Configuration
+ */
+#define CONFIG_HARD_I2C
+#define CONFIG_DRIVER_DAVINCI_I2C
+#define CONFIG_SYS_I2C_SPEED 25000 /* 100Kbps won't work, H/W bug */
+#define CONFIG_SYS_I2C_SLAVE 10 /* Bogus, master-only in U-Boot */
+
+
+#define CONFIG_CMD_I2C
+
+#define CONFIG_CMD_DATE
+#define CONFIG_RTC_PCF8563
+#define CONFIG_SYS_I2C_RTC_ADDR 0x51
+
+#define CONFIG_CMD_EEPROM
+/* EEPROM configuration */
+#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1
+#define CONFIG_SYS_EEPROM_SIZE 256
+#define CONFIG_SYS_I2C_EEPROM_ADDR 0x57
+
+#endif
+
+/*
+ * Network & Ethernet Configuration
+ */
+#ifdef CONFIG_DRIVER_TI_EMAC
+#define CONFIG_EMAC_MDIO_PHY_NUM 1
+#define CONFIG_MII
+#define CONFIG_BOOTP_DEFAULT
+#define CONFIG_BOOTP_DNS
+#define CONFIG_BOOTP_DNS2
+#define CONFIG_BOOTP_SEND_HOSTNAME
+#define CONFIG_NET_RETRY_COUNT 10
+#endif
+
+
+/*
+ * Flash & Environment
+ */
+#undef CONFIG_ENV_IS_IN_FLASH
+#define CONFIG_NAND_DAVINCI
+#define CONFIG_SYS_NO_FLASH
+#define CONFIG_ENV_IS_IN_NAND /* U-Boot env in NAND Flash */
+#define CONFIG_ENV_OFFSET 0
+#define CONFIG_ENV_SIZE (128*1024)
+#define CONFIG_SYS_NAND_4BIT_HW_ECC_OOBFIRST
+#define CONFIG_SYS_NAND_CS 3
+#define CONFIG_SYS_NAND_BASE DAVINCI_ASYNC_EMIF_DATA_CE3_BASE
+#define CONFIG_SYS_NAND_PAGE_2K
+#define CONFIG_SYS_64BIT_VSPRINTF /* needed for nand_util.c */
+#define CONFIG_SYS_CLE_MASK 0x10
+#define CONFIG_SYS_ALE_MASK 0x8
+#define CONFIG_SYS_MAX_NAND_DEVICE 1 /* Max number of NAND devices */
+#define NAND_MAX_CHIPS 1
+
+#if 1
+/*
+ * USB configuration
+ */
+#define CONFIG_USB_DA8XX /* Platform hookup to MUSB controller */
+#define CONFIG_MUSB_HCD
+
+#endif
+
+/*
+ * U-Boot general configuration
+ */
+#undef CONFIG_USE_IRQ /* No IRQ/FIQ in U-Boot */
+#undef CONFIG_MISC_INIT_R
+#undef CONFIG_BOOTDELAY
+#define CONFIG_BOOTFILE "uImage" /* Boot file name */
+#define CONFIG_SYS_PROMPT "c6745-som > " /* Command Prompt */
+#define CONFIG_SYS_CBSIZE 1024 /* Console I/O Buffer Size */
+#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE+sizeof(CONFIG_SYS_PROMPT)+16)
+#define CONFIG_SYS_MAXARGS 16 /* max number of command args */
+#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE /* Boot Args Buffer Size */
+#define CONFIG_SYS_LOAD_ADDR (PHYS_SDRAM_1 + 0x700000)
+#define CONFIG_VERSION_VARIABLE
+#define CONFIG_AUTO_COMPLETE /* Won't work with hush so far, may be later */
+#define CONFIG_SYS_HUSH_PARSER
+#define CONFIG_SYS_PROMPT_HUSH_PS2 "> "
+#define CONFIG_CMDLINE_EDITING
+#define CONFIG_SYS_LONGHELP
+#define CONFIG_CRC32_VERIFY
+#define CONFIG_MX_CYCLIC
+
+/*
+ * Linux Information
+ */
+#define LINUX_BOOT_PARAM_ADDR (PHYS_SDRAM_1 + 0x100)
+#define CONFIG_CMDLINE_TAG
+#define CONFIG_SETUP_MEMORY_TAGS
+#define CONFIG_BOOTARGS "mem=32M console=ttyS2,115200n8 root=/dev/mtdblock/2 rw noinitrd ip=dhcp"
+#define CONFIG_BOOTCOMMAND ""
+#define CONFIG_BOOTDELAY 3
+
+/*
+ * U-Boot commands
+ */
+#include <config_cmd_default.h>
+#define CONFIG_CMD_ENV
+#define CONFIG_CMD_ASKENV
+
+#define CONFIG_CMD_DHCP
+#define CONFIG_CMD_DIAG
+#define CONFIG_CMD_MII
+#define CONFIG_CMD_PING
+
+#define CONFIG_CMD_SAVES
+#define CONFIG_CMD_MEMORY
+#undef CONFIG_CMD_FPGA
+#undef CONFIG_CMD_SETGETDCR
+
+#ifndef CONFIG_DRIVER_TI_EMAC
+#undef CONFIG_CMD_NET
+#undef CONFIG_CMD_DHCP
+#undef CONFIG_CMD_MII
+#undef CONFIG_CMD_PING
+#endif
+
+#ifdef CONFIG_USE_NAND
+#undef CONFIG_CMD_FLASH
+#undef CONFIG_CMD_IMLS
+#define CONFIG_CMD_NAND
+#define CONFIG_CMD_MTDPARTS
+#define CONFIG_MTD_PARTITIONS
+#define CONFIG_MTD_DEVICE
+#endif
+
+#ifdef CONFIG_USE_SPIFLASH
+#undef CONFIG_CMD_IMLS
+#undef CONFIG_CMD_FLASH
+#define CONFIG_CMD_SPI
+#define CONFIG_CMD_SF
+#define CONFIG_CMD_SAVEENV
+#endif
+
+#if !defined(CONFIG_USE_NAND) && \
+ !defined(CONFIG_USE_NOR) && \
+ !defined(CONFIG_USE_SPIFLASH)
+#define CONFIG_ENV_IS_NOWHERE
+#define CONFIG_SYS_NO_FLASH
+#define CONFIG_ENV_SIZE (16 << 10)
+#undef CONFIG_CMD_IMLS
+#undef CONFIG_CMD_FLASH
+#undef CONFIG_CMD_ENV
+#endif
+
+#ifdef CONFIG_USB_DA8XX
+
+#ifdef CONFIG_MUSB_HCD /* include support for usb host */
+#define CONFIG_CMD_USB /* include support for usb cmd */
+
+#define CONFIG_USB_STORAGE /* MSC class support */
+#define CONFIG_CMD_STORAGE /* inclue support for usb-storage cmd */
+#define CONFIG_CMD_FAT /* inclue support for FAT/storage */
+#define CONFIG_DOS_PARTITION /* inclue support for FAT/storage */
+
+#ifdef CONFIG_USB_KEYBOARD /* HID class support */
+#define CONFIG_SYS_USB_EVENT_POLL
+#define CONFIG_PREBOOT "usb start"
+#endif /* CONFIG_USB_KEYBOARD */
+
+#endif /* CONFIG_MUSB_HCD */
+
+#ifdef CONFIG_MUSB_UDC
+/* USB device configuration */
+#define CONFIG_USB_DEVICE 1
+#define CONFIG_USB_TTY 1
+#define CONFIG_SYS_CONSOLE_IS_IN_ENV 1
+/* Change these to suit your needs */
+#define CONFIG_USBD_VENDORID 0x0451
+#define CONFIG_USBD_PRODUCTID 0x5678
+#define CONFIG_USBD_MANUFACTURER "InMys"
+#define CONFIG_USBD_PRODUCT_NAME "c6745-som"
+#endif /* CONFIG_MUSB_UDC */
+
+#endif /* CONFIG_USB_DA8XX */
+
+#ifdef CONFIG_MTD_PARTITIONS
+#define MTDIDS_DEFAULT "nand0=davinci_nand.1"
+#define PART_BOOT "512k(bootloader)ro,"
+#define PART_PARAMS "512k(params)ro,"
+#define PART_KERNEL "4m(kernel),"
+#define PART_REST "-(filesystem)"
+#define MTDPARTS_DEFAULT \
+ "mtdparts=davinci_nand.1:" PART_BOOT PART_PARAMS PART_KERNEL PART_REST
+#endif
+
+#define CONFIG_MAX_RAM_BANK_SIZE (512 << 20) /* max size from SPRS586*/
+
+/* additions for new relocation code, must be added to all boards */
+#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM_1
+
+#undef CONFIG_CMD_NFS
+#undef CONFIG_CMD_BOOTD
+#undef CONFIG_RESET_TO_RETRY
+
+#define CONFIG_STANDALONE_LOAD_ADDR 0xc1f80000
+
+#endif /* __CONFIG_H */
--
1.7.2.5
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [U-Boot] [PATCH v3 1/4] Add support new arch: c6x
2012-06-25 18:02 ` [U-Boot] [PATCH v3 1/4] " Dmitry Bondar
@ 2012-06-25 22:04 ` Tom Rini
2012-06-27 20:36 ` bond at inmys.ru
2012-07-19 3:53 ` Mike Frysinger
1 sibling, 1 reply; 31+ messages in thread
From: Tom Rini @ 2012-06-25 22:04 UTC (permalink / raw)
To: u-boot
On Mon, Jun 25, 2012 at 10:02:38PM +0400, Dmitry Bondar wrote:
> C6X (C6000) is Texas Instruments architecture of fixed and floating-point DSPs.
> This patch add basic support.
> Many of code in arch/c6x/include/asm come from c6x-linux project (http://linux-c6x.org)
>
> Signed-off-by: Dmitry Bondar <bond@inmys.ru>
> Cc: Tom Rini <trini@ti.com>
Please cite the exact commit from upstream where this comes from (I
imagine you could even use kernel.org proper, but I didn't check all
files just a few) and say for example:
Backport from linux commit 27406e978f596a646b87941cba5247eb0ccc8916
> +#ifndef __ASM_GBL_DATA_H
Tabs instead of spaces. I don't know why checkpatch didn't complain but
please give all of the files a quick check for things like <tab><space>
and '#define<tab>' and '#ifndef<tab>.
I spot-checked a few of the library files and they seem to match the
kernel which is important so I'll set aside disliking ';' as a comment
char.
[snip]
> diff --git a/common/cmd_bdinfo.c b/common/cmd_bdinfo.c
> index 42f08fd..faf534b 100644
> --- a/common/cmd_bdinfo.c
> +++ b/common/cmd_bdinfo.c
> @@ -513,6 +513,11 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
>
> return 0;
> }
> +#elif defined(CONFIG_C6X)
> +int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
> +{
> + return 0;
> +}
You should be able to define a minimal set of prints here, see the
OpenRISC example above it.
> diff --git a/common/image.c b/common/image.c
> index 91954ac..0fff687 100644
> --- a/common/image.c
> +++ b/common/image.c
> @@ -456,8 +456,12 @@ phys_size_t getenv_bootm_size(void)
> #if defined(CONFIG_ARM)
> return gd->bd->bi_dram[0].size - tmp;
> #else
> +#if defined(CONFIG_C6X)
> + return gd->bd->bi_dram[0].size - tmp;
Here and possibly another place or two in the file, just change the
check from defined(CONFIG_ARM) to defined(CONFIG_ARM) ||
defined(CONFIG_C6X).
Thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120625/36b53cc5/attachment.pgp>
^ permalink raw reply [flat|nested] 31+ messages in thread
* [U-Boot] [PATCH v3 0/4] Add support new arch: c6x
2012-06-25 18:02 ` [U-Boot] [PATCH v3 0/4] Add support new arch: c6x Dmitry Bondar
@ 2012-06-25 22:31 ` Tom Rini
2012-06-28 17:43 ` Dmitry Bondar
0 siblings, 1 reply; 31+ messages in thread
From: Tom Rini @ 2012-06-25 22:31 UTC (permalink / raw)
To: u-boot
On Mon, Jun 25, 2012 at 10:02:37PM +0400, Dmitry Bondar wrote:
> C6X (C6000) is family of fixed and floating-point DSPs manufactured by Texas Instruments.
> ---
> Changes for v2:
> - reset_c.c rewritten with readl/writel.
> - Tom Rini <trini@ti.com> added to cc
>
> Changes for v3:
> - fix coding style
> - arch/c6x/include/asm/io.h - add memory barriers on readl/writel ()
>
>
> Dmitry Bondar (4):
> Add support new arch: c6x
> c6x: Add support c674x CPUs
> c6x: Add suport build davinci SOC with c674x CPUs
> c6x: Add support c6745-som board
I found a good toolchain and gave building the series a whirl, and
here's a few things that need fixing:
- The davinci symlink isn't safe, running make again results in ln
complaining.
- The symlink doesn't work in conjunction with separate object
directories as it is in the main src tree.
- With O= we get arch/arm/cpu/arm926ejs/davinci/libdavinci.o because of
the above, which makes link fail.
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120625/8fec4687/attachment.pgp>
^ permalink raw reply [flat|nested] 31+ messages in thread
* [U-Boot] [PATCH v3 4/4] c6x: Add support c6745-som board
2012-06-25 18:02 ` [U-Boot] [PATCH v3 4/4] c6x: Add support c6745-som board Dmitry Bondar
@ 2012-06-25 22:42 ` Tom Rini
2012-07-19 4:05 ` Mike Frysinger
2012-08-10 20:53 ` Wolfgang Denk
2 siblings, 0 replies; 31+ messages in thread
From: Tom Rini @ 2012-06-25 22:42 UTC (permalink / raw)
To: u-boot
On Mon, Jun 25, 2012 at 10:02:41PM +0400, Dmitry Bondar wrote:
> Add support board c6745-som (http://inmys.ru/?_=/products/som_c6745) with C6745 cpu.
>
> Signed-off-by: Dmitry Bondar <bond@inmys.ru>
> Cc: Tom Rini <trini@ti.com>
[snip]
> diff --git a/MAINTAINERS b/MAINTAINERS
> index e55893b..710f3df 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -62,6 +62,9 @@ Jerry Van Baren <gerald.vanbaren@smiths-aerospace.com>
>
> sacsng MPC8260
>
> +Dmitry Bondar <bond@inmys.ru>
> + c6745-som c674x
> +
> Oliver Brown <obrown@adventnetworks.com>
>
> gw8260 MPC8260
Note that the file is sorted by architecture, so you get to add in a new
C6000 section.
> diff --git a/board/inmys/c6745-som/Makefile b/board/inmys/c6745-som/Makefile
> new file mode 100644
> index 0000000..9a91ed2
> --- /dev/null
> +++ b/board/inmys/c6745-som/Makefile
> @@ -0,0 +1,27 @@
> +# (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$(BOARD).o
> +
> +COBJS-$(CONFIG_MACH_INMYS_C6745_SOM) += c6745-som.o
> +
> +COBJS := $(COBJS-y)
We should only be here on this board, yes? So just:
COBJS-y<tab>:= c6745-som.o
> +SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
> +OBJS := $(addprefix $(obj),$(COBJS))
> +SOBJS := $(addprefix $(obj),$(SOBJS))
This seems a little complicated, and should just be:
COBJS<tab>:= $(sort $(COBJS-y))
SRCS<tab>:= $(COBJS:.o=.c)
OBJS<tab>:= $(addprefix $(obj),$(COBJS))
[snip]
> + * Parts are shamelessly stolen from various TI sources, original copyright
> + * follows:
> + * -----------------------------------------------------------------
> + *
> + * Copyright (C) 2004 Texas Instruments.
> + *
> + * ----------------------------------------------------------------------------
Please drop both of the extra-long '-..-' lines.
> +#if 1
> + /* configure pinmux settings */
> + if (davinci_configure_pin_mux_items(pinmuxes, ARRAY_SIZE(pinmuxes)))
> + return 1;
> +#endif
I'm fond of '#if 1' when debugging code myself but please remove when
posting, thanks!
[snip]
> +++ b/include/configs/c6745-som-inmys.h
> @@ -0,0 +1,294 @@
> +#ifndef __CONFIG_H
> +#define __CONFIG_H
> +
> +/* Based on da830evm.h
> +*/
> +#define TMPVAL 0
Unused.
> +#if 0
> +#define CONFIG_USE_SPIFLASH
> +#endif
Please just add a comment saying SPI flash support is still missing
instead of this
> +#define CONFIG_C6X /* */
Just '#define CONFIG_C6X'.
[snip]
> +#define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 }
There's a default now, don't need this line.
> +#if 1
See above :) (And there's a few of these).
> +#define CONFIG_SYS_PROMPT_HUSH_PS2 "> "
Also not needed now.
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120625/3cbb00cc/attachment.pgp>
^ permalink raw reply [flat|nested] 31+ messages in thread
* [U-Boot] [PATCH v3 2/4] c6x: Add support c674x CPUs
2012-06-25 18:02 ` [U-Boot] [PATCH v3 2/4] c6x: Add support c674x CPUs Dmitry Bondar
@ 2012-06-25 22:44 ` Tom Rini
2012-07-19 3:59 ` Mike Frysinger
1 sibling, 0 replies; 31+ messages in thread
From: Tom Rini @ 2012-06-25 22:44 UTC (permalink / raw)
To: u-boot
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.
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120625/66509982/attachment.pgp>
^ permalink raw reply [flat|nested] 31+ messages in thread
* [U-Boot] [PATCH v3 3/4] c6x: Add suport build davinci SOC with c674x CPUs
2012-06-25 18:02 ` [U-Boot] [PATCH v3 3/4] c6x: Add suport build davinci SOC with " Dmitry Bondar
@ 2012-06-25 22:46 ` Tom Rini
2012-06-27 15:27 ` [U-Boot] [PATCH] davinci, c6x: Always use C version of reset code Tom Rini
2012-07-19 4:00 ` [U-Boot] [PATCH v3 3/4] c6x: Add suport build davinci SOC with c674x CPUs Mike Frysinger
2 siblings, 0 replies; 31+ messages in thread
From: Tom Rini @ 2012-06-25 22:46 UTC (permalink / raw)
To: u-boot
On Mon, Jun 25, 2012 at 10:02:40PM +0400, Dmitry Bondar wrote:
> 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@inmys.ru>
> Cc: Tom Rini <trini@ti.com>
The symlink comments I posted before are for this specific patch. Also,
anyone out there that could easily test if this reset in C code is fine
on their arm9 davinci platform?
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120625/4ce5906c/attachment.pgp>
^ permalink raw reply [flat|nested] 31+ messages in thread
* [U-Boot] [PATCH] davinci, c6x: Always use C version of reset code
2012-06-25 18:02 ` [U-Boot] [PATCH v3 3/4] c6x: Add suport build davinci SOC with " Dmitry Bondar
2012-06-25 22:46 ` Tom Rini
@ 2012-06-27 15:27 ` Tom Rini
2012-06-27 15:28 ` Tom Rini
2012-07-19 4:00 ` [U-Boot] [PATCH v3 3/4] c6x: Add suport build davinci SOC with c674x CPUs Mike Frysinger
2 siblings, 1 reply; 31+ messages in thread
From: Tom Rini @ 2012-06-27 15:27 UTC (permalink / raw)
To: u-boot
We can safely use the same reset code written in C for both Davinci and
C6X platforms. In addition the C version of the code is marginally
smaller on Davinci.
Tested-by: Matt Porter <mporter@ti.com>
Signed-off-by: Tom Rini <trini@ti.com>
---
arch/arm/cpu/arm926ejs/davinci/Makefile | 9 +---
arch/arm/cpu/arm926ejs/davinci/reset.S | 81 ------------------------------
arch/arm/cpu/arm926ejs/davinci/reset.c | 32 ++++++++++++
arch/arm/cpu/arm926ejs/davinci/reset_c.c | 32 ------------
4 files changed, 33 insertions(+), 121 deletions(-)
delete mode 100644 arch/arm/cpu/arm926ejs/davinci/reset.S
create mode 100644 arch/arm/cpu/arm926ejs/davinci/reset.c
delete mode 100644 arch/arm/cpu/arm926ejs/davinci/reset_c.c
diff --git a/arch/arm/cpu/arm926ejs/davinci/Makefile b/arch/arm/cpu/arm926ejs/davinci/Makefile
index 54f096d..c91928e 100644
--- a/arch/arm/cpu/arm926ejs/davinci/Makefile
+++ b/arch/arm/cpu/arm926ejs/davinci/Makefile
@@ -27,7 +27,7 @@ include $(TOPDIR)/config.mk
LIB = $(obj)lib$(SOC).o
-COBJS-y += cpu.o misc.o timer.o psc.o pinmux.o
+COBJS-y += cpu.o misc.o timer.o psc.o pinmux.o reset.o
COBJS-$(CONFIG_DA850_LOWLEVEL) += da850_lowlevel.o
COBJS-$(CONFIG_SOC_DM355) += dm355.o
COBJS-$(CONFIG_SOC_DM365) += dm365.o
@@ -42,13 +42,6 @@ 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
endif
diff --git a/arch/arm/cpu/arm926ejs/davinci/reset.S b/arch/arm/cpu/arm926ejs/davinci/reset.S
deleted file mode 100644
index ba0a7c3..0000000
--- a/arch/arm/cpu/arm926ejs/davinci/reset.S
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Processor reset using WDT for TI TMS320DM644x SoC.
- *
- * Copyright (C) 2007 Sergey Kubushyn <ksi@koi8.net>
- *
- * -----------------------------------------------------
- *
- * 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
- */
-
-.globl reset_cpu
-reset_cpu:
- ldr r0, WDT_TGCR
- mov r1, $0x08
- str r1, [r0]
- ldr r1, [r0]
- orr r1, r1, $0x03
- str r1, [r0]
- mov r1, $0
- ldr r0, WDT_TIM12
- str r1, [r0]
- ldr r0, WDT_TIM34
- str r1, [r0]
- ldr r0, WDT_PRD12
- str r1, [r0]
- ldr r0, WDT_PRD34
- str r1, [r0]
- ldr r0, WDT_TCR
- ldr r1, [r0]
- orr r1, r1, $0x40
- str r1, [r0]
- ldr r0, WDT_WDTCR
- ldr r1, [r0]
- orr r1, r1, $0x4000
- str r1, [r0]
- ldr r1, WDTCR_VAL1
- str r1, [r0]
- ldr r1, WDTCR_VAL2
- str r1, [r0]
- /* Write an invalid value to the WDKEY field to trigger
- * an immediate watchdog reset */
- mov r1, $0x4000
- str r1, [r0]
- nop
- nop
- nop
- nop
-reset_cpu_loop:
- b reset_cpu_loop
-
-WDT_TGCR:
- .word 0x01c21c24
-WDT_TIM12:
- .word 0x01c21c10
-WDT_TIM34:
- .word 0x01c21c14
-WDT_PRD12:
- .word 0x01c21c18
-WDT_PRD34:
- .word 0x01c21c1c
-WDT_TCR:
- .word 0x01c21c20
-WDT_WDTCR:
- .word 0x01c21c28
-WDTCR_VAL1:
- .word 0xa5c64000
-WDTCR_VAL2:
- .word 0xda7e4000
diff --git a/arch/arm/cpu/arm926ejs/davinci/reset.c b/arch/arm/cpu/arm926ejs/davinci/reset.c
new file mode 100644
index 0000000..44ae364
--- /dev/null
+++ b/arch/arm/cpu/arm926ejs/davinci/reset.c
@@ -0,0 +1,32 @@
+/*
+ * Processor reset using WDT.
+ *
+ * Copyright (C) 2012 Dmitry Bondar <bond@inmys.ru>
+ * Copyright (C) 2007 Sergey Kubushyn <ksi@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)
+ /*nothing*/;
+}
diff --git a/arch/arm/cpu/arm926ejs/davinci/reset_c.c b/arch/arm/cpu/arm926ejs/davinci/reset_c.c
deleted file mode 100644
index 44ae364..0000000
--- a/arch/arm/cpu/arm926ejs/davinci/reset_c.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Processor reset using WDT.
- *
- * Copyright (C) 2012 Dmitry Bondar <bond@inmys.ru>
- * Copyright (C) 2007 Sergey Kubushyn <ksi@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)
- /*nothing*/;
-}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [U-Boot] [PATCH] davinci, c6x: Always use C version of reset code
2012-06-27 15:27 ` [U-Boot] [PATCH] davinci, c6x: Always use C version of reset code Tom Rini
@ 2012-06-27 15:28 ` Tom Rini
0 siblings, 0 replies; 31+ messages in thread
From: Tom Rini @ 2012-06-27 15:28 UTC (permalink / raw)
To: u-boot
On Wed, Jun 27, 2012 at 08:27:05AM -0700, Tom Rini wrote:
> We can safely use the same reset code written in C for both Davinci and
> C6X platforms. In addition the C version of the code is marginally
> smaller on Davinci.
>
> Tested-by: Matt Porter <mporter@ti.com>
> Signed-off-by: Tom Rini <trini@ti.com>
In the next go-round of the c6x patches please just fold this (and the
tested-by) into the patch you add that creates the C version of the
reset code. Thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120627/d6b2cad9/attachment.pgp>
^ permalink raw reply [flat|nested] 31+ messages in thread
* [U-Boot] [PATCH v3 1/4] Add support new arch: c6x
2012-06-25 22:04 ` Tom Rini
@ 2012-06-27 20:36 ` bond at inmys.ru
2012-06-27 20:55 ` Tom Rini
2012-06-27 22:16 ` Wolfgang Denk
0 siblings, 2 replies; 31+ messages in thread
From: bond at inmys.ru @ 2012-06-27 20:36 UTC (permalink / raw)
To: u-boot
> On Mon, Jun 25, 2012 at 10:02:38PM +0400, Dmitry Bondar wrote:
>
>> C6X (C6000) is Texas Instruments architecture of fixed and
>> floating-point DSPs.
>> This patch add basic support.
>> Many of code in arch/c6x/include/asm come from c6x-linux project
>> (http://linux-c6x.org)
>>
>> Signed-off-by: Dmitry Bondar <bond@inmys.ru>
>> Cc: Tom Rini <trini@ti.com>
>
> Please cite the exact commit from upstream where this comes from (I
> imagine you could even use kernel.org proper, but I didn't check all
> files just a few) and say for example:
> Backport from linux commit 27406e978f596a646b87941cba5247eb0ccc8916
>
Must I say it in each file, or in commit message?
If in commit, how about something like this:
"
Many of code in arch/c6x/include/asm and arch/c6x/lib come from linux kernel,
c6x headers (arch/c6x/include/asm) in linux kernel mainline from commit
a7f626c1948ab6178d2338831c5ffea7385e9f7f
c6x libs (arch/c6x/lib) in linux kernel mainline from
09831ca73443bd819ad7993db5409b19c899ba33
"
>> +#ifndef __ASM_GBL_DATA_H
>
> Tabs instead of spaces. I don't know why checkpatch didn't complain but
> please give all of the files a quick check for things like <tab><space>
> and '#define<tab>' and '#ifndef<tab>.
>
> I spot-checked a few of the library files and they seem to match the
> kernel which is important so I'll set aside disliking ';' as a comment
> char.
>
> [snip]
>> diff --git a/common/cmd_bdinfo.c b/common/cmd_bdinfo.c
>> index 42f08fd..faf534b 100644
>> --- a/common/cmd_bdinfo.c
>> +++ b/common/cmd_bdinfo.c
>> @@ -513,6 +513,11 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc,
>> char * const argv[])
>>
>> return 0;
>> }
>> +#elif defined(CONFIG_C6X)
>> +int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const
>> argv[])
>> +{
>> + return 0;
>> +}
>
> You should be able to define a minimal set of prints here, see the
> OpenRISC example above it.
>
>> diff --git a/common/image.c b/common/image.c
>> index 91954ac..0fff687 100644
>> --- a/common/image.c
>> +++ b/common/image.c
>> @@ -456,8 +456,12 @@ phys_size_t getenv_bootm_size(void)
>> #if defined(CONFIG_ARM)
>> return gd->bd->bi_dram[0].size - tmp;
>> #else
>> +#if defined(CONFIG_C6X)
>> + return gd->bd->bi_dram[0].size - tmp;
>
> Here and possibly another place or two in the file, just change the
> check from defined(CONFIG_ARM) to defined(CONFIG_ARM) ||
> defined(CONFIG_C6X).
>
> Thanks!
>
> --
> Tom
>
^ permalink raw reply [flat|nested] 31+ messages in thread
* [U-Boot] [PATCH v3 1/4] Add support new arch: c6x
2012-06-27 20:36 ` bond at inmys.ru
@ 2012-06-27 20:55 ` Tom Rini
2012-06-27 22:16 ` Wolfgang Denk
1 sibling, 0 replies; 31+ messages in thread
From: Tom Rini @ 2012-06-27 20:55 UTC (permalink / raw)
To: u-boot
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 06/27/2012 01:36 PM, bond at inmys.ru wrote:
>> On Mon, Jun 25, 2012 at 10:02:38PM +0400, Dmitry Bondar wrote:
>>
>>> C6X (C6000) is Texas Instruments architecture of fixed and
>>> floating-point DSPs. This patch add basic support. Many of code
>>> in arch/c6x/include/asm come from c6x-linux project
>>> (http://linux-c6x.org)
>>>
>>> Signed-off-by: Dmitry Bondar <bond@inmys.ru> Cc: Tom Rini
>>> <trini@ti.com>
>>
>> Please cite the exact commit from upstream where this comes from
>> (I imagine you could even use kernel.org proper, but I didn't
>> check all files just a few) and say for example: Backport from
>> linux commit 27406e978f596a646b87941cba5247eb0ccc8916
>>
> Must I say it in each file, or in commit message?
Just the commit message.
> If in commit, how about something like this: " Many of code in
> arch/c6x/include/asm and arch/c6x/lib come from linux kernel, c6x
> headers (arch/c6x/include/asm) in linux kernel mainline from
> commit a7f626c1948ab6178d2338831c5ffea7385e9f7f c6x libs
> (arch/c6x/lib) in linux kernel mainline from
> 09831ca73443bd819ad7993db5409b19c899ba33 "
Yes, or just make sure that both parts are still in sync with the
kernel at whichever of those commits is later. That'll make any
future re-syncs easier on you :)
- --
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iQIcBAEBAgAGBQJP63NeAAoJENk4IS6UOR1WmjUP/3b/SAQxeJXzupGW0PhKH5TZ
ptwHPxkzTDcSXGNYmL42XdD4NLTM0rgNxQxZoPobKVVSAynlxv58Bzb9e4Umf/BH
HWs4L/TvnAWlAu45BU3wjzPYqF+lo7aDyiw4jDsX0zb+WxArPY90kM1NTCiUvK9U
BexzFTrqL0Rfw0vAAIfGSw46qyIRaZp2AM2q97J0Q7j4satiA8AJ7Ly6XcWu43/s
4L5FBF0lDeLLmsMnFXvJOj0O2KWxvyaQx7ola1YkXSSFPdSXY9M2gbkbz+spSe81
Pgw43XJ7OXlrASDsvov7U9V/LHLuqXS/Lo8jVMFTp5hLfXD830mA5dBCipsPJF/1
mIxXy3qIgdxNwtOMeebhfknpIhW6TQV1T5F5RyTFmsB5g1N+5lBTQveMCE1qMqmK
Lki6ftPGhsJpPTxNvev/gx3acBQ6O+/X/zWujlj6YUcx1QCZYZq4bXP4a+4MB07N
bmuSNwl3PlH03lO9SDUZVBc6h+eLJ2jU1rMba+ojQmcGOUUeq42Cs+W1Lr5dfQEE
rcg/y4HxUIbYxkR4P0jJwE0SGsEy25/8X8859rGnQw25Pvxg0xFXmtisDb2WYDzd
SU9y31JsLybpa6HeO8F5ex3aRb7+KYhLrOSxoGCGKmgeuJ0ndcQP3dRigrw3jVs6
Tq7hNvK/kgUBVT6pXimQ
=4ngS
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 31+ messages in thread
* [U-Boot] [PATCH v3 1/4] Add support new arch: c6x
2012-06-27 20:36 ` bond at inmys.ru
2012-06-27 20:55 ` Tom Rini
@ 2012-06-27 22:16 ` Wolfgang Denk
1 sibling, 0 replies; 31+ messages in thread
From: Wolfgang Denk @ 2012-06-27 22:16 UTC (permalink / raw)
To: u-boot
Dear bond at inmys.ru,
In message <9cc1576e223fd1ac2b8a3329ad55bca8.squirrel@78.108.93.81> you wrote:
>
> > Please cite the exact commit from upstream where this comes from (I
> > imagine you could even use kernel.org proper, but I didn't check all
> > files just a few) and say for example:
> > Backport from linux commit 27406e978f596a646b87941cba5247eb0ccc8916
> >
> Must I say it in each file, or in commit message?
How about reading the documentation? It answers such questions, with
examples and all that.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"There is nothing so deadly as not to hold up to people the
opportunity to do great and wonderful things, if we wish to stimulate
them in an active way."
- Dr. Harold Urey, Nobel Laureate in chemistry
^ permalink raw reply [flat|nested] 31+ messages in thread
* [U-Boot] [PATCH v3 0/4] Add support new arch: c6x
2012-06-25 22:31 ` Tom Rini
@ 2012-06-28 17:43 ` Dmitry Bondar
2012-06-28 18:02 ` Tom Rini
0 siblings, 1 reply; 31+ messages in thread
From: Dmitry Bondar @ 2012-06-28 17:43 UTC (permalink / raw)
To: u-boot
On Mon, 25/06/2012 at 15:31 -0700, Tom Rini wrote:
> On Mon, Jun 25, 2012 at 10:02:37PM +0400, Dmitry Bondar wrote:
>
> > C6X (C6000) is family of fixed and floating-point DSPs manufactured by Texas Instruments.
> > ---
> > Changes for v2:
> > - reset_c.c rewritten with readl/writel.
> > - Tom Rini <trini@ti.com> added to cc
> >
> > Changes for v3:
> > - fix coding style
> > - arch/c6x/include/asm/io.h - add memory barriers on readl/writel ()
> >
> >
> > Dmitry Bondar (4):
> > Add support new arch: c6x
> > c6x: Add support c674x CPUs
> > c6x: Add suport build davinci SOC with c674x CPUs
> > c6x: Add support c6745-som board
>
> I found a good toolchain and gave building the series a whirl, and
> here's a few things that need fixing:
> - The davinci symlink isn't safe, running make again results in ln
> complaining.
> - The symlink doesn't work in conjunction with separate object
> directories as it is in the main src tree.
> - With O= we get arch/arm/cpu/arm926ejs/davinci/libdavinci.o because of
> the above, which makes link fail.
May be i must copy pinmux.c,reset.c,timer.c,cpu.c from
arch/arm/arm926ejs/davinci to arch/c6x/c674x/c674x, remove from them all
not used ifdef (#ifdef CONFIG_SOC_DM355) and don't set in boards.cfg SOC
for board?
This allow don't use symlink.
^ permalink raw reply [flat|nested] 31+ messages in thread
* [U-Boot] [PATCH v3 0/4] Add support new arch: c6x
2012-06-28 17:43 ` Dmitry Bondar
@ 2012-06-28 18:02 ` Tom Rini
0 siblings, 0 replies; 31+ messages in thread
From: Tom Rini @ 2012-06-28 18:02 UTC (permalink / raw)
To: u-boot
On Thu, Jun 28, 2012 at 09:43:57PM +0400, Dmitry Bondar wrote:
> On Mon, 25/06/2012 at 15:31 -0700, Tom Rini wrote:
> > On Mon, Jun 25, 2012 at 10:02:37PM +0400, Dmitry Bondar wrote:
> >
> > > C6X (C6000) is family of fixed and floating-point DSPs manufactured by Texas Instruments.
> > > ---
> > > Changes for v2:
> > > - reset_c.c rewritten with readl/writel.
> > > - Tom Rini <trini@ti.com> added to cc
> > >
> > > Changes for v3:
> > > - fix coding style
> > > - arch/c6x/include/asm/io.h - add memory barriers on readl/writel ()
> > >
> > >
> > > Dmitry Bondar (4):
> > > Add support new arch: c6x
> > > c6x: Add support c674x CPUs
> > > c6x: Add suport build davinci SOC with c674x CPUs
> > > c6x: Add support c6745-som board
> >
> > I found a good toolchain and gave building the series a whirl, and
> > here's a few things that need fixing:
> > - The davinci symlink isn't safe, running make again results in ln
> > complaining.
> > - The symlink doesn't work in conjunction with separate object
> > directories as it is in the main src tree.
> > - With O= we get arch/arm/cpu/arm926ejs/davinci/libdavinci.o because of
> > the above, which makes link fail.
>
> May be i must copy pinmux.c,reset.c,timer.c,cpu.c from
> arch/arm/arm926ejs/davinci to arch/c6x/c674x/c674x, remove from them all
> not used ifdef (#ifdef CONFIG_SOC_DM355) and don't set in boards.cfg SOC
> for board?
> This allow don't use symlink.
No, I think you just need to rework the mkconfig logic you're adding.
It should be, roughly, outside of the ! -z ${soc} check:
If c6x and davinci
rm -f arch/c6x/cpu/c674x/davinci
rm -f asm/arch
if srctree != objtree
set symlinks one way
else
set symlinks another way
fi
fi
Then once that works, see if you can shrink the logic down to just set a
prefix variable or two and always set the symlinks.
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120628/29680a47/attachment.pgp>
^ permalink raw reply [flat|nested] 31+ messages in thread
* [U-Boot] [PATCH v3 1/4] Add support new arch: c6x
2012-06-25 18:02 ` [U-Boot] [PATCH v3 1/4] " Dmitry Bondar
2012-06-25 22:04 ` Tom Rini
@ 2012-07-19 3:53 ` Mike Frysinger
1 sibling, 0 replies; 31+ messages in thread
From: Mike Frysinger @ 2012-07-19 3:53 UTC (permalink / raw)
To: u-boot
On Monday 25 June 2012 14:02:38 Dmitry Bondar wrote:
> C6X (C6000) is Texas Instruments architecture of fixed and floating-point
> DSPs. This patch add basic support.
> Many of code in arch/c6x/include/asm come from c6x-linux project
> (http://linux-c6x.org)
you should also update README and doc/README.standalone with some notes about
the C6X architecture. just search for "blackfin" for the areas you should fill
in.
> --- /dev/null
> +++ b/arch/c6x/config.mk
> @@ -0,0 +1 @@
> +CROSS_COMPILE ?= c6x-uclinux-
missing intro comment block w/copyright/licnese. look at any other arch's
config.mk to see an example.
you should prob also add a default CONFIG_STANDALONE_LOAD_ADDR
> --- /dev/null
> +++ b/arch/c6x/include/asm/global_data.h
>
> +#ifndef __ASM_GBL_DATA_H
should be space after the ifndef, not a tab
> +typedef struct global_data {
> + bd_t *bd;
> + unsigned long flags;
> + unsigned long baudrate;
> + unsigned long have_console; /* serial_init() was called */
> +#ifdef CONFIG_PRE_CONSOLE_BUFFER
> + unsigned long precon_buf_idx; /* Pre-Console buffer index */
> +#endif
> + unsigned long env_addr; /* Address of Environment struct */
> + unsigned long env_valid; /* Checksum of Environment valid? */
> + unsigned long fb_base; /* base address of frame buffer */
> +
> + /* "static data" needed by most of timer.c (like on ARM platform) */
> + unsigned long timer_rate_hz;
> + unsigned long tbl;
> + unsigned long tbu;
> + unsigned long long timer_reset_value;
> + unsigned long lastinc;
> +
> + phys_size_t ram_size; /* RAM size */
> +#if 0
> + unsigned long relocaddr; /* Start address of U-Boot in RAM */
> + phys_size_t ram_size; /* RAM size */
> + unsigned long mon_len; /* monitor len */
> + unsigned long irq_sp; /* irq stack pointer */
> + unsigned long start_addr_sp; /* start_addr_stackpointer */
> + unsigned long reloc_off;
> +#endif
delete dead code. you should also kill any fields you don't actually need
rather than just copying from another arch. the
timer_rate_hz/tbl/tbu/timer_reset_value/lastinc look suspicious to me.
> --- /dev/null
> +++ b/arch/c6x/include/asm/sizes.h
do you actually need this ? i don't think you do, so kill it. if you have
some file that includes it, fix it and get rid of this file.
> --- /dev/null
> +++ b/arch/c6x/include/asm/u-boot-c6x.h
please rename to sections.h
> +#ifndef _U_BOOT_C6X_H_
> +#define _U_BOOT_C6X_H_ 1
no need to define to 1
> --- /dev/null
> +++ b/arch/c6x/include/asm/u-boot.h
>
> +typedef struct bd_info {
> + int bi_baudrate; /* serial console baudrate */
> + unsigned long bi_ip_addr; /* IP Address */
> + ulong bi_arch_number; /* unique id for this board */
> + ulong bi_boot_params; /* where this board expects params */
> + unsigned long bi_arm_freq; /* arm frequency */
> + unsigned long bi_dsp_freq; /* dsp core frequency */
> + unsigned long bi_ddr_freq; /* ddr frequency */
> + struct /* RAM configuration */
> + {
> + ulong start;
> + ulong size;
> + } bi_dram[CONFIG_NR_DRAM_BANKS];
> +} bd_t;
again, please go through here and delete members you don't actually need
> +/* For image.h:image_check_target_arch() */
> +#define IH_ARCH_DEFAULT IH_ARCH_ARM
brrrr-wrong
> --- /dev/null
> +++ b/arch/c6x/lib/board.c
>
> +#ifdef CONFIG_STATUS_LED
> +#include <status_led.h>
> +#endif
no need to conditionalize the include
> +static int display_banner(void)
> +{
> + printf("\n\n%s\n\n", version_string);
just call display_options()
> + WATCHDOG_RESET();
> +/* interrupt_init();*/
delete dead code
> +int do_reset(cmd_tbl_t *cmdtp, int flag, int argc,
> + char *const argv[])
> +{
> + reset_cpu(0);
> + return 0;
> +}
> +
delete trailing newlines
> --- /dev/null
> +++ b/arch/c6x/lib/bootm.c
>
> +int disable_interrupts()
(void)
> +void enable_interrupts()
(void)
> --- /dev/null
> +++ b/arch/c6x/lib/memcmp.c
>
> +int memcmp(const void *cs, const void *ct, size_t count)
> +{
> + const unsigned char *su1, *su2;
> +
> + for (su1 = cs, su2 = ct; 0 < count; ++su1, ++su2, count--)
> + if (*su1 != *su2)
> + return (*su1 < *su2) ? -1 : 1;
> + return 0;
> +}
>
> --- /dev/null
> +++ b/arch/c6x/lib/memmove.c
>
> +void *memmove(void *s1, const void *s2, size_t n)
> +{
> + register char *s = (char *) s1;
> + register const char *p = (const char *) s2;
> +
> + if (p >= s) {
> + return memcpy(s, p, n);
> + } else {
> + while (n) {
> + --n;
> + s[n] = p[n];
> + }
> + }
> + return s1;
> +}
>
> --- /dev/null
> +++ b/arch/c6x/lib/memset.c
>
> +void *memset(void *mem, register int ch, register size_t length)
> +{
> + register char *m = (char *)mem - 1;
> + while (length--)
> + *++m = ch;
> + return mem;
> +}
i can't see how these would be any better than the ones we already have in
lib/string.c. i say delete these files and don't bother.
-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/20120718/6039e63b/attachment.pgp>
^ permalink raw reply [flat|nested] 31+ messages in thread
* [U-Boot] [PATCH v3 2/4] c6x: Add support c674x CPUs
2012-06-25 18:02 ` [U-Boot] [PATCH v3 2/4] c6x: Add support c674x CPUs Dmitry Bondar
2012-06-25 22:44 ` Tom Rini
@ 2012-07-19 3:59 ` Mike Frysinger
1 sibling, 0 replies; 31+ messages in thread
From: Mike Frysinger @ 2012-07-19 3:59 UTC (permalink / raw)
To: u-boot
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
-------------- 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/20120718/4fa11b49/attachment.pgp>
^ permalink raw reply [flat|nested] 31+ messages in thread
* [U-Boot] [PATCH v3 3/4] c6x: Add suport build davinci SOC with c674x CPUs
2012-06-25 18:02 ` [U-Boot] [PATCH v3 3/4] c6x: Add suport build davinci SOC with " Dmitry Bondar
2012-06-25 22:46 ` Tom Rini
2012-06-27 15:27 ` [U-Boot] [PATCH] davinci, c6x: Always use C version of reset code Tom Rini
@ 2012-07-19 4:00 ` Mike Frysinger
2 siblings, 0 replies; 31+ messages in thread
From: Mike Frysinger @ 2012-07-19 4:00 UTC (permalink / raw)
To: u-boot
On Monday 25 June 2012 14:02:40 Dmitry Bondar wrote:
> --- a/mkconfig
> +++ b/mkconfig
>
> + if [ "${arch}" == "c6x" -a "$soc" == "davinci" ]; then
use "=", not "=="
-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/20120719/c5319302/attachment.pgp>
^ permalink raw reply [flat|nested] 31+ messages in thread
* [U-Boot] [PATCH v3 4/4] c6x: Add support c6745-som board
2012-06-25 18:02 ` [U-Boot] [PATCH v3 4/4] c6x: Add support c6745-som board Dmitry Bondar
2012-06-25 22:42 ` Tom Rini
@ 2012-07-19 4:05 ` Mike Frysinger
2012-08-10 20:53 ` Wolfgang Denk
2 siblings, 0 replies; 31+ messages in thread
From: Mike Frysinger @ 2012-07-19 4:05 UTC (permalink / raw)
To: u-boot
On Monday 25 June 2012 14:02:41 Dmitry Bondar wrote:
> --- /dev/null
> +++ b/board/inmys/c6745-som/c6745-som.c
>
> +int board_init()
(void)
> +int board_eth_init(bd_t *bis)
> +{
> + u_int8_t mac_addr[6];
uchar
> + /* Read Ethernet MAC address from EEPROM */
> + if (dvevm_read_mac_address(mac_addr))
> + /* set address env if not already set */
> + davinci_sync_env_enetaddr(mac_addr);
> +
> + /* read the address back from env */
> + if (!eth_getenv_enetaddr("ethaddr", mac_addr))
> + return -1;
i think logic here is incorrect. usually it's:
if (!eth_getenv_enetaddr("ethaddr", mac_addr))
/* read mac from hardware */
> + dev = eth_get_dev();
> +
> + /* provide the resulting addr to the driver */
> + memcpy(dev->enetaddr, mac_addr, 6);
> + dev->write_hwaddr(dev);
err, this should be in the driver, not the board init
> --- /dev/null
> +++ b/include/configs/c6745-som-inmys.h
> @@ -0,0 +1,294 @@
> +#ifndef __CONFIG_H
> +#define __CONFIG_H
missing intro comment block
-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/20120719/8347fcee/attachment.pgp>
^ permalink raw reply [flat|nested] 31+ messages in thread
* [U-Boot] [PATCH v3 4/4] c6x: Add support c6745-som board
2012-06-25 18:02 ` [U-Boot] [PATCH v3 4/4] c6x: Add support c6745-som board Dmitry Bondar
2012-06-25 22:42 ` Tom Rini
2012-07-19 4:05 ` Mike Frysinger
@ 2012-08-10 20:53 ` Wolfgang Denk
2 siblings, 0 replies; 31+ messages in thread
From: Wolfgang Denk @ 2012-08-10 20:53 UTC (permalink / raw)
To: u-boot
Dear Dmitry Bondar,
In message <1340647361-23387-5-git-send-email-bond@inmys.ru> you wrote:
> Add support board c6745-som (http://inmys.ru/?_=/products/som_c6745) with C6745 cpu.
>
> Signed-off-by: Dmitry Bondar <bond@inmys.ru>
> Cc: Tom Rini <trini@ti.com>
...
> +#define LINUX_BOOT_PARAM_ADDR (PHYS_SDRAM_1 + 0x100)
> +#define CONFIG_CMDLINE_TAG
> +#define CONFIG_SETUP_MEMORY_TAGS
> +#define CONFIG_BOOTARGS "mem=32M console=ttyS2,115200n8 root=/dev/mtdblock/2 rw noinitrd ip=dhcp"
WARNING: line over 80 characters
Please fix.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Never ascribe to malice that which can adequately be explained by
stupidity.
^ permalink raw reply [flat|nested] 31+ messages in thread
end of thread, other threads:[~2012-08-10 20:53 UTC | newest]
Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <add_c6x_arch>
[not found] ` <1340394370-1550-4-git-send-email-bond@inmys.ru>
2012-06-22 21:57 ` [U-Boot] [PATCH 3/4] c6x: Add suport build davinci SOC with c674x CPUs Tom Rini
2012-06-23 11:11 ` [U-Boot] [PATCH v2 0/4] Add support new arch: c6x Dmitry Bondar
2012-06-23 12:33 ` Wolfgang Denk
2012-06-24 11:40 ` bond at inmys.ru
2012-06-24 13:50 ` Wolfgang Denk
2012-06-23 11:11 ` [U-Boot] [PATCH v2 1/4] " Dmitry Bondar
2012-06-23 11:11 ` [U-Boot] [PATCH v2 2/4] c6x: Add support c674x CPUs Dmitry Bondar
2012-06-23 11:11 ` [U-Boot] [PATCH v2 3/4] c6x: Add suport build davinci SOC with " Dmitry Bondar
2012-06-23 11:11 ` [U-Boot] [PATCH v2 4/4] c6x: Add support c6745-som board Dmitry Bondar
2012-06-25 18:02 ` [U-Boot] [PATCH v3 0/4] Add support new arch: c6x Dmitry Bondar
2012-06-25 22:31 ` Tom Rini
2012-06-28 17:43 ` Dmitry Bondar
2012-06-28 18:02 ` Tom Rini
2012-06-25 18:02 ` [U-Boot] [PATCH v3 1/4] " Dmitry Bondar
2012-06-25 22:04 ` Tom Rini
2012-06-27 20:36 ` bond at inmys.ru
2012-06-27 20:55 ` Tom Rini
2012-06-27 22:16 ` Wolfgang Denk
2012-07-19 3:53 ` Mike Frysinger
2012-06-25 18:02 ` [U-Boot] [PATCH v3 2/4] c6x: Add support c674x CPUs Dmitry Bondar
2012-06-25 22:44 ` Tom Rini
2012-07-19 3:59 ` Mike Frysinger
2012-06-25 18:02 ` [U-Boot] [PATCH v3 3/4] c6x: Add suport build davinci SOC with " Dmitry Bondar
2012-06-25 22:46 ` Tom Rini
2012-06-27 15:27 ` [U-Boot] [PATCH] davinci, c6x: Always use C version of reset code Tom Rini
2012-06-27 15:28 ` Tom Rini
2012-07-19 4:00 ` [U-Boot] [PATCH v3 3/4] c6x: Add suport build davinci SOC with c674x CPUs Mike Frysinger
2012-06-25 18:02 ` [U-Boot] [PATCH v3 4/4] c6x: Add support c6745-som board Dmitry Bondar
2012-06-25 22:42 ` Tom Rini
2012-07-19 4:05 ` Mike Frysinger
2012-08-10 20:53 ` Wolfgang Denk
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.