Skip to contentSkip to conversation

Add support for the ARC700 architecture

PATCH Superseded Alexey Brodkin 2 participants 14 messages Jan 28, 2014 – Jan 29, 2014

Subsystems (3)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

cover Add support for the ARC700 architecture

This patch series adds support for the Synopsys DesignWare ARC700 architecture.

DesignWare ARC700 is family of 32-bit CPUs developed by Synopsys, Inc.

Since version 3.9 ARC architecture is supported in mainline Linux developemnt. And now to get better support in commonly used boot-loader we are introducing port of U-Boot for ARC700 CPUs.

Patches included in this series are also available on GitHub in the 'for-upstream-v1' branch:

git at github.com:foss-for-synopsys-dwc-arc-processors/u-boot.git

Also browsable here:

https://github.com/foss-for-synopsys-dwc-arc-processors/u-boot/tree/for-upstream-v1

NOTE: there's an acked by Tom Rini prerequisite for Arcangel4 board:

http://patchwork.ozlabs.org/patch/300901/

For those who are interested in building this port please download pre-built toolchains for x86_64 hosts.

For RedHat-based distros:
https://github.com/foss-for-synopsys-dwc-arc-processors/toolchain/releases/download/arc-4.8-R2/arc_gnu_4.8-R2_prebuilt_uclibc_le_rhel6_install.tar.gz

For Debian-based distros:
https://github.com/foss-for-synopsys-dwc-arc-processors/toolchain/releases/download/arc-4.8-R2/arc_gnu_4.8-R2_prebuilt_uclibc_le_ubuntu_install.tar.gz

Alexey Brodkin (9):
arc: add architecture header files
arc: add cpu files
arc: add library functions
arc: bdinfo and image support
arc: add support for standalone programs
arc: add Arcangel4 board support
arc: add AXS101 board support
arc: add architecture to MAKEALL
arc: add README for architecture

 MAKEALL                                     |   6 +
 arch/arc/config.mk                          |  31 +++
 arch/arc/cpu/arc700/Makefile                |  13 ++
 arch/arc/cpu/arc700/cache.c                 | 161 ++++++++++++++
 arch/arc/cpu/arc700/config.mk               |   7 +
 arch/arc/cpu/arc700/cpu.c                   |  37 ++++
 arch/arc/cpu/arc700/interrupts.c            | 211 ++++++++++++++++++
 arch/arc/cpu/arc700/reset.c                 |  19 ++
 arch/arc/cpu/arc700/start.S                 | 262 ++++++++++++++++++++++
 arch/arc/cpu/arc700/timer.c                 |  28 +++
 arch/arc/cpu/arc700/u-boot.lds              |  72 +++++++
 arch/arc/include/asm/arch-arc700/hardware.h |   0
 arch/arc/include/asm/arcregs.h              | 324 ++++++++++++++++++++++++++++
 arch/arc/include/asm/bitops.h               |  19 ++
 arch/arc/include/asm/byteorder.h            |  23 ++
 arch/arc/include/asm/cache.h                |  23 ++
 arch/arc/include/asm/config.h               |  12 ++
 arch/arc/include/asm/errno.h                |   1 +
 arch/arc/include/asm/global_data.h          |  19 ++
 arch/arc/include/asm/io.h                   | 287 ++++++++++++++++++++++++
 arch/arc/include/asm/posix_types.h          |  73 +++++++
 arch/arc/include/asm/processor.h            |   0
 arch/arc/include/asm/ptrace.h               | 101 +++++++++
 arch/arc/include/asm/sections.h             |   1 +
 arch/arc/include/asm/string.h               |   0
 arch/arc/include/asm/types.h                |  55 +++++
 arch/arc/include/asm/u-boot.h               |  15 ++
 arch/arc/include/asm/unaligned.h            |   1 +
 arch/arc/lib/Makefile                       |   9 +
 arch/arc/lib/bootm.c                        | 106 +++++++++
 arch/arc/lib/relocate.c                     |  74 +++++++
 arch/arc/lib/sections.c                     |  21 ++
 board/synopsys/arcangel4/Makefile           |   7 +
 board/synopsys/arcangel4/arcangel4.c        |  25 +++
 board/synopsys/axs101/Makefile              |   8 +
 board/synopsys/axs101/axs101.c              |  61 ++++++
 board/synopsys/axs101/nand.c                | 224 +++++++++++++++++++
 boards.cfg                                  |   2 +
 common/cmd_bdinfo.c                         |  18 ++
 common/image.c                              |   1 +
 doc/README.ARC                              |  27 +++
 examples/standalone/stubs.c                 |  13 ++
 include/configs/arcangel4.h                 |  96 +++++++++
 include/configs/axs101.h                    | 194 +++++++++++++++++
 include/image.h                             |   1 +
 45 files changed, 2688 insertions(+)
 create mode 100644 arch/arc/config.mk
 create mode 100644 arch/arc/cpu/arc700/Makefile
 create mode 100644 arch/arc/cpu/arc700/cache.c
 create mode 100644 arch/arc/cpu/arc700/config.mk
 create mode 100644 arch/arc/cpu/arc700/cpu.c
 create mode 100644 arch/arc/cpu/arc700/interrupts.c
 create mode 100644 arch/arc/cpu/arc700/reset.c
 create mode 100644 arch/arc/cpu/arc700/start.S
 create mode 100644 arch/arc/cpu/arc700/timer.c
 create mode 100644 arch/arc/cpu/arc700/u-boot.lds
 create mode 100644 arch/arc/include/asm/arch-arc700/hardware.h
 create mode 100644 arch/arc/include/asm/arcregs.h
 create mode 100644 arch/arc/include/asm/bitops.h
 create mode 100644 arch/arc/include/asm/byteorder.h
 create mode 100644 arch/arc/include/asm/cache.h
 create mode 100644 arch/arc/include/asm/config.h
 create mode 100644 arch/arc/include/asm/errno.h
 create mode 100644 arch/arc/include/asm/global_data.h
 create mode 100644 arch/arc/include/asm/io.h
 create mode 100644 arch/arc/include/asm/posix_types.h
 create mode 100644 arch/arc/include/asm/processor.h
 create mode 100644 arch/arc/include/asm/ptrace.h
 create mode 100644 arch/arc/include/asm/sections.h
 create mode 100644 arch/arc/include/asm/string.h
 create mode 100644 arch/arc/include/asm/types.h
 create mode 100644 arch/arc/include/asm/u-boot.h
 create mode 100644 arch/arc/include/asm/unaligned.h
 create mode 100644 arch/arc/lib/Makefile
 create mode 100644 arch/arc/lib/bootm.c
 create mode 100644 arch/arc/lib/relocate.c
 create mode 100644 arch/arc/lib/sections.c
 create mode 100644 board/synopsys/arcangel4/Makefile
 create mode 100644 board/synopsys/arcangel4/arcangel4.c
 create mode 100644 board/synopsys/axs101/Makefile
 create mode 100644 board/synopsys/axs101/axs101.c
 create mode 100644 board/synopsys/axs101/nand.c
 create mode 100644 doc/README.ARC
 create mode 100644 include/configs/arcangel4.h
 create mode 100644 include/configs/axs101.h
Signature · 1 line
1.8.5.3
#1 lore raw

PATCH 1/9 arc: add architecture header files

Cc Mischa Jonker <[email protected]>
Cc Francois Bedard <[email protected]>
---
 arch/arc/include/asm/arch-arc700/hardware.h |   0
 arch/arc/include/asm/arcregs.h              | 324 ++++++++++++++++++++++++++++
 arch/arc/include/asm/bitops.h               |  19 ++
 arch/arc/include/asm/byteorder.h            |  23 ++
 arch/arc/include/asm/cache.h                |  23 ++
 arch/arc/include/asm/config.h               |  12 ++
 arch/arc/include/asm/errno.h                |   1 +
 arch/arc/include/asm/global_data.h          |  19 ++
 arch/arc/include/asm/io.h                   | 287 ++++++++++++++++++++++++
 arch/arc/include/asm/posix_types.h          |  73 +++++++
 arch/arc/include/asm/processor.h            |   0
 arch/arc/include/asm/ptrace.h               | 101 +++++++++
 arch/arc/include/asm/sections.h             |   1 +
 arch/arc/include/asm/string.h               |   0
 arch/arc/include/asm/types.h                |  55 +++++
 arch/arc/include/asm/u-boot.h               |  15 ++
 arch/arc/include/asm/unaligned.h            |   1 +
 17 files changed, 954 insertions(+)
 create mode 100644 arch/arc/include/asm/arch-arc700/hardware.h
 create mode 100644 arch/arc/include/asm/arcregs.h
 create mode 100644 arch/arc/include/asm/bitops.h
 create mode 100644 arch/arc/include/asm/byteorder.h
 create mode 100644 arch/arc/include/asm/cache.h
 create mode 100644 arch/arc/include/asm/config.h
 create mode 100644 arch/arc/include/asm/errno.h
 create mode 100644 arch/arc/include/asm/global_data.h
 create mode 100644 arch/arc/include/asm/io.h
 create mode 100644 arch/arc/include/asm/posix_types.h
 create mode 100644 arch/arc/include/asm/processor.h
 create mode 100644 arch/arc/include/asm/ptrace.h
 create mode 100644 arch/arc/include/asm/sections.h
 create mode 100644 arch/arc/include/asm/string.h
 create mode 100644 arch/arc/include/asm/types.h
 create mode 100644 arch/arc/include/asm/u-boot.h
 create mode 100644 arch/arc/include/asm/unaligned.h
arch/arc/include/asm/arch-arc700/hardware.h new file +0 -0
new file mode 100644
index 0000000..e69de29
arch/arc/include/asm/arcregs.h new file +324 -0

324 lines not on this page · raw message

arch/arc/include/asm/bitops.h new file +19 -0
new file mode 100644
index 0000000..85721aa
@@ -0,0 +1,19 @@
+/*
+ * Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef __ASM_ARC_BITOPS_H
+#define __ASM_ARC_BITOPS_H
+
+/*
+ * hweightN: returns the hamming weight (i.e. the number
+ * of bits set) of a N-bit word
+ */
+
+#define hweight32(x) generic_hweight32(x)
+#define hweight16(x) generic_hweight16(x)
+#define hweight8(x) generic_hweight8(x)
+
+#endif /* __ASM_ARC_BITOPS_H */
arch/arc/include/asm/byteorder.h new file +23 -0
new file mode 100644
index 0000000..9057624
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef __ASM_ARC_BYTEORDER_H
+#define __ASM_ARC_BYTEORDER_H
+
+#include <asm/types.h>
+
+#if !defined(__STRICT_ANSI__) || defined(__KERNEL__)
+	#define __BYTEORDER_HAS_U64__
+	#define __SWAB_64_THRU_32__
+#endif
+
+#ifndef CONFIG_SYS_BIG_ENDIAN
+	#include <linux/byteorder/little_endian.h>
+#else
+	#include <linux/byteorder/big_endian.h>
+#endif	/* CONFIG_SYS_BIG_ENDIAN */
+
+#endif	/* ASM_ARC_BYTEORDER_H */
arch/arc/include/asm/cache.h new file +23 -0
new file mode 100644
index 0000000..16e7568
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef __ASM_ARC_CACHE_H
+#define __ASM_ARC_CACHE_H
+
+#include <config.h>
+
+/*
+ * The current upper bound for ARC L1 data cache line sizes is 128 bytes.
+ * We use that value for aligning DMA buffers unless the board config has
+ * specified an alternate cache line size.
+ */
+#ifdef CONFIG_SYS_CACHELINE_SIZE
+#define ARCH_DMA_MINALIGN	CONFIG_SYS_CACHELINE_SIZE
+#else
+#define ARCH_DMA_MINALIGN	128
+#endif
+
+#endif /* __ASM_ARC_CACHE_H */
arch/arc/include/asm/config.h new file +12 -0
new file mode 100644
index 0000000..5761def
@@ -0,0 +1,12 @@
+/*
+ * Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef __ASM_ARC_CONFIG_H_
+#define __ASM_ARC_CONFIG_H_
+
+#define CONFIG_LMB
+
+#endif /*__ASM_ARC_CONFIG_H_ */
arch/arc/include/asm/errno.h new file +1 -0
new file mode 100644
index 0000000..4c82b50
@@ -0,0 +1 @@
+#include <asm-generic/errno.h>
arch/arc/include/asm/global_data.h new file +19 -0
new file mode 100644
index 0000000..d644e80
@@ -0,0 +1,19 @@
+/*
+ * Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef	__ASM_ARC_GLOBAL_DATA_H
+#define __ASM_ARC_GLOBAL_DATA_H
+
+/* Architecture-specific global data */
+struct arch_global_data {
+	int running_on_hw;
+};
+
+#include <asm-generic/global_data.h>
+
+#define DECLARE_GLOBAL_DATA_PTR		register volatile gd_t *gd asm ("r25")
+
+#endif /* __ASM_ARC_GLOBAL_DATA_H */
arch/arc/include/asm/io.h new file +287 -0

287 lines not on this page · raw message

arch/arc/include/asm/posix_types.h new file +73 -0

73 lines not on this page · raw message

arch/arc/include/asm/processor.h new file +0 -0
new file mode 100644
index 0000000..e69de29
arch/arc/include/asm/ptrace.h new file +101 -0

101 lines not on this page · raw message

arch/arc/include/asm/sections.h new file +1 -0
new file mode 100644
index 0000000..2b8c516
@@ -0,0 +1 @@
+#include <asm-generic/sections.h>
arch/arc/include/asm/string.h new file +0 -0
new file mode 100644
index 0000000..e69de29
arch/arc/include/asm/types.h new file +55 -0

55 lines not on this page · raw message

arch/arc/include/asm/u-boot.h new file +15 -0
new file mode 100644
index 0000000..e354edf
@@ -0,0 +1,15 @@
+/*
+ * Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef __ASM_ARC_U_BOOT_H__
+#define __ASM_ARC_U_BOOT_H__
+
+#include <asm-generic/u-boot.h>
+
+/* For image.h:image_check_target_arch() */
+#define IH_ARCH_DEFAULT IH_ARCH_ARC
+
+#endif	/* __ASM_ARC_U_BOOT_H__ */
arch/arc/include/asm/unaligned.h new file +1 -0
new file mode 100644
index 0000000..6cecbbb
@@ -0,0 +1 @@
+#include <asm-generic/unaligned.h>
Signature · 1 line
1.8.5.3
#2 lore raw

PATCH 1/9 arc: add architecture header files

Hello Alexey,

Thanks for your patches, more or less just nitpicking comments ...

Am 29.01.2014 00:09, schrieb Alexey Brodkin:

Quoted 1 line

No commit message, please add one. (Are this files from the Linux kernel? If so please add a comment in the commit message + add a hint which linux commit you used, thanks!)

arch/arc/include/asm/arch-arc700/hardware.h

Quoted 43 lines
Cc Mischa Jonker<[email protected]>
Cc Francois Bedard<[email protected]>
---
  arch/arc/include/asm/arch-arc700/hardware.h |   0
  arch/arc/include/asm/arcregs.h              | 324 ++++++++++++++++++++++++++++
  arch/arc/include/asm/bitops.h               |  19 ++
  arch/arc/include/asm/byteorder.h            |  23 ++
  arch/arc/include/asm/cache.h                |  23 ++
  arch/arc/include/asm/config.h               |  12 ++
  arch/arc/include/asm/errno.h                |   1 +
  arch/arc/include/asm/global_data.h          |  19 ++
  arch/arc/include/asm/io.h                   | 287 ++++++++++++++++++++++++
  arch/arc/include/asm/posix_types.h          |  73 +++++++
  arch/arc/include/asm/processor.h            |   0
  arch/arc/include/asm/ptrace.h               | 101 +++++++++
  arch/arc/include/asm/sections.h             |   1 +
  arch/arc/include/asm/string.h               |   0
  arch/arc/include/asm/types.h                |  55 +++++
  arch/arc/include/asm/u-boot.h               |  15 ++
  arch/arc/include/asm/unaligned.h            |   1 +
  17 files changed, 954 insertions(+)

create mode 100644 arch/arc/include/asm/arch-arc700/hardware.h create mode 100644 arch/arc/include/asm/arcregs.h create mode 100644 arch/arc/include/asm/bitops.h create mode 100644 arch/arc/include/asm/byteorder.h create mode 100644 arch/arc/include/asm/cache.h create mode 100644 arch/arc/include/asm/config.h create mode 100644 arch/arc/include/asm/errno.h create mode 100644 arch/arc/include/asm/global_data.h create mode 100644 arch/arc/include/asm/io.h
create mode 100644 arch/arc/include/asm/posix_types.h create mode 100644 arch/arc/include/asm/processor.h create mode 100644 arch/arc/include/asm/ptrace.h create mode 100644 arch/arc/include/asm/sections.h create mode 100644 arch/arc/include/asm/string.h create mode 100644 arch/arc/include/asm/types.h create mode 100644 arch/arc/include/asm/u-boot.h create mode 100644 arch/arc/include/asm/unaligned.h

arch/arc/include/asm/arch-arc700/hardware.h new file +0 -0
new file mode 100644
index 0000000..e69de29

Empty file ?

Quoted 98 lines
arch/arc/include/asm/arcregs.h new file +92 -0
new file mode 100644
index 0000000..87b0a60
@@ -0,0 +1,324 @@
+/*
+ * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. All rights reserved.
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef _ASM_ARC_ARCREGS_H
+#define _ASM_ARC_ARCREGS_H
+
+#ifdef __KERNEL__
+
+/* Build Configuration Registers */
+#define ARC_REG_DCCMBASE_BCR	0x61	/* DCCM Base Addr */
+#define ARC_REG_CRC_BCR		0x62
+#define ARC_REG_DVFB_BCR	0x64
+#define ARC_REG_EXTARITH_BCR	0x65
+#define ARC_REG_VECBASE_BCR	0x68
+#define ARC_REG_PERIBASE_BCR	0x69
+#define ARC_REG_FP_BCR		0x6B	/* Single-Precision FPU */
+#define ARC_REG_DPFP_BCR	0x6C	/* Dbl Precision FPU */
+#define ARC_REG_DCCM_BCR	0x74	/* DCCM Present + SZ */
+#define ARC_REG_TIMERS_BCR	0x75
+#define ARC_REG_ICCM_BCR	0x78
+#define ARC_REG_XY_MEM_BCR	0x79
+#define ARC_REG_MAC_BCR		0x7a
+#define ARC_REG_MUL_BCR		0x7b
+#define ARC_REG_SWAP_BCR	0x7c
+#define ARC_REG_NORM_BCR	0x7d
+#define ARC_REG_MIXMAX_BCR	0x7e
+#define ARC_REG_BARREL_BCR	0x7f
+#define ARC_REG_D_UNCACH_BCR	0x6A
+
+/* status32 Bits Positions */
+#define STATUS_AE_BIT		5	/* Exception active */
+#define STATUS_DE_BIT		6	/* PC is in delay slot */
+#define STATUS_U_BIT		7	/* User/Kernel mode */
+#define STATUS_L_BIT		12	/* Loop inhibit */
+
+/* These masks correspond to the status word(STATUS_32) bits */
+#define STATUS_AE_MASK		(1<<STATUS_AE_BIT)
+#define STATUS_DE_MASK		(1<<STATUS_DE_BIT)
+#define STATUS_U_MASK		(1<<STATUS_U_BIT)
+#define STATUS_L_MASK		(1<<STATUS_L_BIT)
+
+/*
+ * ECR: Exception Cause Reg bits-n-pieces
+ * [23:16] = Exception Vector
+ * [15: 8] = Exception Cause Code
+ * [ 7: 0] = Exception Parameters (for certain types only)
+ */
+#define ECR_VEC_MASK			0xff0000
+#define ECR_CODE_MASK			0x00ff00
+#define ECR_PARAM_MASK			0x0000ff
+
+/* Exception Cause Vector Values */
+#define ECR_V_INSN_ERR			0x02
+#define ECR_V_MACH_CHK			0x20
+#define ECR_V_ITLB_MISS			0x21
+#define ECR_V_DTLB_MISS			0x22
+#define ECR_V_PROTV			0x23
+#define ECR_V_TRAP			0x25
+
+/* Protection Violation Exception Cause Code Values */
+#define ECR_C_PROTV_INST_FETCH		0x00
+#define ECR_C_PROTV_LOAD		0x01
+#define ECR_C_PROTV_STORE		0x02
+#define ECR_C_PROTV_XCHG		0x03
+#define ECR_C_PROTV_MISALIG_DATA	0x04
+
+#define ECR_C_BIT_PROTV_MISALIG_DATA	10
+
+/* Machine Check Cause Code Values */
+#define ECR_C_MCHK_DUP_TLB		0x01
+
+/* DTLB Miss Exception Cause Code Values */
+#define ECR_C_BIT_DTLB_LD_MISS		8
+#define ECR_C_BIT_DTLB_ST_MISS		9
+
+/* Dummy ECR values for Interrupts */
+#define event_IRQ1		0x0031abcd
+#define event_IRQ2		0x0032abcd
+
+/* Auxiliary registers */
+#define AUX_IDENTITY		4
+#define AUX_INTR_VEC_BASE	0x25
+
+
+/*
+ * Floating Pt Registers
+ * Status regs are read-only (build-time) so need not be saved/restored
+ */
+#define ARC_AUX_FP_STAT         0x300

arch/arc/include/asm/arcregs.h line 102

Quoted 10 lines
arch/arc/include/asm/arcregs.h new file +10 -0
+#define ARC_AUX_DPFP_1L         0x301
+#define ARC_AUX_DPFP_1H         0x302
+#define ARC_AUX_DPFP_2L         0x303
+#define ARC_AUX_DPFP_2H         0x304
+#define ARC_AUX_DPFP_STAT       0x305
+
+#ifndef __ASSEMBLY__
+
+/*
+ ******************************************************************

Bad comment style

arch/arc/include/asm/arcregs.h line 115

Quoted 13 lines
arch/arc/include/asm/arcregs.h new file +13 -0
+ *      Inline ASM macros to read/write AUX Regs
+ *      Essentially invocation of lr/sr insns from "C"
+ */
+
+#if 1
+
+#define read_aux_reg(reg)	__builtin_arc_lr(reg)
+
+/* gcc builtin sr needs reg param to be long immediate */
+#define write_aux_reg(reg_immed, val)		\
+		__builtin_arc_sr((unsigned int)val, reg_immed)
+
+#else

Please remove dead code ...

Quoted 47 lines
arch/arc/include/asm/arcregs.h new file +47 -0
+
+#define read_aux_reg(reg)		\
+({					\
+	unsigned int __ret;		\
+	__asm__ __volatile__(		\
+	"	lr    %0, [%1]"		\
+	: "=r"(__ret)			\
+	: "i"(reg));			\
+	__ret;				\
+})
+
+/*
+ * Aux Reg address is specified as long immediate by caller
+ * e.g.
+ *    write_aux_reg(0x69, some_val);
+ * This generates tightest code.
+ */
+#define write_aux_reg(reg_imm, val)	\
+({					\
+	__asm__ __volatile__(		\
+	"	sr   %0, [%1]\n"	\
+	:				\
+	: "ir"(val), "i"(reg_imm));	\
+})
+
+/*
+ * Aux Reg address is specified in a variable
+ *  * e.g.
+ *      reg_num = 0x69
+ *      write_aux_reg2(reg_num, some_val);
+ * This has to generate glue code to load the reg num from
+ *  memory to a reg hence not recommended.
+ */
+#define write_aux_reg2(reg_in_var, val)		\
+({						\
+	unsigned int tmp;			\
+						\
+	__asm__ __volatile__(			\
+	"	ld   %0, [%2]\n\t"		\
+	"	sr   %1, [%0]\n\t"		\
+	: "=&r"(tmp)				\
+	: "r"(val), "memory"(&reg_in_var));	\
+})
+
+#endif
+
+#define READ_BCR(reg, into)				\

arch/arc/include/asm/arcregs.h line 172

Quoted 10 lines
arch/arc/include/asm/arcregs.h new file +10 -0
+{							\
+	unsigned int tmp;				\
+	tmp = read_aux_reg(reg);			\
+	if (sizeof(tmp) == sizeof(into)) {		\
+		into = *((typeof(into) *)&tmp);		\
+	} else {					\
+		extern void bogus_undefined(void);	\
+		bogus_undefined();			\
+	}						\
+}

Why do you use defines here instead of real functions?

arch/arc/include/asm/arcregs.h line 184

Quoted 12 lines
arch/arc/include/asm/arcregs.h new file +12 -0
+
+#define WRITE_BCR(reg, into)				\
+{							\
+	unsigned int tmp;				\
+	if (sizeof(tmp) == sizeof(into)) {		\
+		tmp = (*(unsigned int *)(into));	\
+		write_aux_reg(reg, tmp);		\
+	} else  {					\
+		extern void bogus_undefined(void);	\
+		bogus_undefined();			\
+	}						\
+}

and here?

Quoted 6 lines
arch/arc/include/asm/arcregs.h new file +6 -0
+
+/* Helpers */
+#define TO_KB(bytes)		((bytes)>>  10)
+#define TO_MB(bytes)		(TO_KB(bytes)>>  10)
+#define PAGES_TO_KB(n_pages)	((n_pages)<<  (PAGE_SHIFT - 10))
+#define PAGES_TO_MB(n_pages)	(PAGES_TO_KB(n_pages)>>  10)

[...]

arch/arc/include/asm/processor.h

Quoted 3 lines
arch/arc/include/asm/processor.h new file +0 -0
new file mode 100644
index 0000000..e69de29

Hups, one more empty file ...

Quoted 8 lines
arch/arc/include/asm/ptrace.h new file +2 -0
new file mode 100644
index 0000000..3b2df87
@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. All rights reserved.

arch/arc/include/asm/ptrace.h line 12

Quoted 10 lines
arch/arc/include/asm/ptrace.h new file +10 -0
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef __ASM_ARC_PTRACE_H
+#define __ASM_ARC_PTRACE_H
+
+#ifndef __ASSEMBLY__
+
+/* THE pt_regs: Defines how regs are saved during entry into kernel */

Is the "THE" a shortcut?

arch/arc/include/asm/string.h

Quoted 99 lines
arch/arc/include/asm/ptrace.h new file +89 -0
+
+struct pt_regs {
+	/* Real registers */
+	long bta;	/* bta_l1, bta_l2, erbta */
+
+	long lp_start, lp_end, lp_count;
+
+	long status32;	/* status32_l1, status32_l2, erstatus */
+	long ret;	/* ilink1, ilink2 or eret */
+	long blink;
+	long fp;
+	long r26;	/* gp */
+
+	long r12, r11, r10, r9, r8, r7, r6, r5, r4, r3, r2, r1, r0;
+
+	long sp;	/* user/kernel sp depending on where we came from  */
+	long orig_r0;
+
+	/*
+	 * To distinguish bet excp, syscall, irq
+	 * For traps and exceptions, Exception Cause Register.
+	 *      ECR:<00>  <VV>  <CC>  <PP>
+	 *      Last word used by Linux for extra state mgmt (syscall-restart)
+	 * For interrupts, use artificial ECR values to note current prio-level
+	 */
+	union {
+		struct {
+#ifdef CONFIG_CPU_BIG_ENDIAN
+			unsigned long state:8, ecr_vec:8,
+				      ecr_cause:8, ecr_param:8;
+#else
+			unsigned long ecr_param:8, ecr_cause:8,
+				      ecr_vec:8, state:8;
+#endif
+		};
+		unsigned long event;
+	};
+
+	long user_r25;
+};
+
+/* Callee saved registers - need to be saved only when you are scheduled out */
+
+struct callee_regs {
+	long r25, r24, r23, r22, r21, r20, r19, r18, r17, r16, r15, r14, r13;
+};
+
+#define instruction_pointer(regs)	((regs)->ret)
+#define profile_pc(regs)		instruction_pointer(regs)
+
+/* return 1 if user mode or 0 if kernel mode */
+#define user_mode(regs) (regs->status32&  STATUS_U_MASK)
+
+#define user_stack_pointer(regs)\
+({  unsigned int sp;		\
+	if (user_mode(regs))	\
+		sp = (regs)->sp;\
+	else			\
+		sp = -1;	\
+	sp;			\
+})
+
+/* return 1 if PC in delay slot */
+#define delay_mode(regs) ((regs->status32&  STATUS_DE_MASK) == STATUS_DE_MASK)
+
+#define in_syscall(regs)    ((regs->ecr_vec == ECR_V_TRAP)&&  !regs->ecr_param)
+#define in_brkpt_trap(regs) ((regs->ecr_vec == ECR_V_TRAP)&&  regs->ecr_param)
+
+#define STATE_SCALL_RESTARTED	0x01
+
+#define syscall_wont_restart(reg) (reg->state |= STATE_SCALL_RESTARTED)
+#define syscall_restartable(reg) !(reg->state&   STATE_SCALL_RESTARTED)
+
+#define current_pt_regs()					\
+({								\
+	/* open-coded current_thread_info() */			\
+	register unsigned long sp asm ("sp");			\
+	unsigned long pg_start = (sp&  ~(THREAD_SIZE - 1));	\
+	(struct pt_regs *)(pg_start + THREAD_SIZE) - 1;	\
+})
+
+static inline long regs_return_value(struct pt_regs *regs)
+{
+	return regs->r0;
+}
+
+#endif /* !__ASSEMBLY__ */
+
+#endif /* __ASM_ARC_PTRACE_H */
arch/arc/include/asm/sections.h new file +1 -0
new file mode 100644
index 0000000..2b8c516
@@ -0,0 +1 @@
+#include<asm-generic/sections.h>
arch/arc/include/asm/string.h new file +0 -0
new file mode 100644
index 0000000..e69de29

empty file

Quoted 88 lines
arch/arc/include/asm/types.h new file +55 -0
new file mode 100644
index 0000000..7475db1
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef __ASM_ARC_TYPES_H
+#define __ASM_ARC_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__)&&  !defined(__STRICT_ANSI__)
+typedef __signed__ long long __s64;
+typedef unsigned long long __u64;
+#endif
+
+/*
+ * These aren't exported outside the kernel to avoid name space clashes
+ */
+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 /* __ASM_ARC_TYPES_H */
arch/arc/include/asm/u-boot.h new file +15 -0
new file mode 100644
index 0000000..e354edf
@@ -0,0 +1,15 @@
+/*
+ * Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef __ASM_ARC_U_BOOT_H__
+#define __ASM_ARC_U_BOOT_H__
+
+#include<asm-generic/u-boot.h>
+
+/* For image.h:image_check_target_arch() */
+#define IH_ARCH_DEFAULT IH_ARCH_ARC
+
+#endif	/* __ASM_ARC_U_BOOT_H__ */
arch/arc/include/asm/unaligned.h new file +0 -0
new file mode 100644
index 0000000..6cecbbb

arch/arc/include/asm/unaligned.h line 1

Quoted 1 line
arch/arc/include/asm/unaligned.h new file +1 -0
@@ -0,0 +1 @@
+#include<asm-generic/unaligned.h>

bye,
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#3 lore raw

PATCH 1/9 arc: add architecture header files

Hello Heiko,

Quoted 3 lines · Heiko Schocher

Hello Alexey,

Thanks for your patches, more or less just nitpicking comments ...

Thanks for prompt review.

Quoted 6 lines

Am 29.01.2014 00:09, schrieb Alexey Brodkin:

Quoted 1 line

No commit message, please add one. (Are this files from the Linux kernel? If so please add a comment in the commit message + add a hint which linux commit you used, thanks!)

I thought from commit subject it's already clear what's presented in each particular patch so I left commit messages empty. Frankly I'm not sure still what info may I put in commit messages except mention of headers borrowed from Linux - or this is exactly what is needed?

Agree I forgot to mention which header files came from Linux kernel. Will add mentions.

Quoted 5 lines

arch/arc/include/asm/arch-arc700/hardware.h

Quoted 3 lines
arch/arc/include/asm/arch-arc700/hardware.h new file +0 -0
new file mode 100644
index 0000000..e69de29

Empty file ?

Right, it looks weird, but I had to add this empty file just because of "designware_i2c" driver which refers to "asm/arch/hardware.h".

http://git.denx.de/?p=u-boot.git;a=blob;f=drivers/i2c/designware_i2c.c;h=9ed929521a8944dc870fc2eff546507632b6e86a;hb=HEAD

And to remove "asm/arch/hardware.h" I would need to modify "arch/hardware.h" and "include/configs/..." files for platform/boards I don't own.

Basically this is just a work-around that allows me to use "designware_i2c" driver as it is.

There was a similar dependency ("asm/arch/clk.h") in "dw_mmc" but in that case it was possible to just remove it - what I did -
http://git.denx.de/?p=u-boot.git;a=commit;h=ca6d4d0f8f0fb8ae09a7ba271177367bdfdf3136

So if you insist on removal of this file we would need to fix "designware_i2c" first.

Please let me know what do you think about this item.

Quoted 3 lines
Quoted 3 lines
arch/arc/include/asm/arcregs.h new file +0 -0
new file mode 100644
index 0000000..87b0a60

...

Quoted 26 lines

arch/arc/include/asm/arcregs.h line 102

Quoted 5 lines
arch/arc/include/asm/arcregs.h new file +5 -0
+
+#ifndef __ASSEMBLY__
+
+/*
+ ******************************************************************

Bad comment style

arch/arc/include/asm/arcregs.h line 115

Quoted 13 lines

+ * Inline ASM macros to read/write AUX Regs
+ * Essentially invocation of lr/sr insns from "C"
+ */

arch/arc/include/asm/arcregs.h new file +10 -0
+
+#if 1
+
+#define read_aux_reg(reg)	__builtin_arc_lr(reg)
+
+/* gcc builtin sr needs reg param to be long immediate */
+#define write_aux_reg(reg_immed, val)		\
+		__builtin_arc_sr((unsigned int)val, reg_immed)
+
+#else

Please remove dead code ...

Quoted 2 lines
arch/arc/include/asm/arcregs.h new file +2 -0
+
+#define read_aux_reg(reg)		\

...

Quoted 6 lines

arch/arc/include/asm/arcregs.h line 172

Quoted 3 lines
arch/arc/include/asm/arcregs.h new file +3 -0
+		bogus_undefined();			\
+	}						\
+}

Why do you use defines here instead of real functions?

Quoted 14 lines

arch/arc/include/asm/arcregs.h line 184

Quoted 12 lines
arch/arc/include/asm/arcregs.h new file +12 -0
+
+#define WRITE_BCR(reg, into)				\
+{							\
+	unsigned int tmp;				\
+	if (sizeof(tmp) == sizeof(into)) {		\
+		tmp = (*(unsigned int *)(into));	\
+		write_aux_reg(reg, tmp);		\
+	} else  {					\
+		extern void bogus_undefined(void);	\
+		bogus_undefined();			\
+	}						\
+}

and here?

Ok, so this header is borrowed from Linux sources. That's why I didn't do any modifications and took it as it is on kernel.org.

Quoted 5 lines

arch/arc/include/asm/processor.h

Quoted 3 lines
arch/arc/include/asm/processor.h new file +0 -0
new file mode 100644
index 0000000..e69de29

Hups, one more empty file ...

I thought it was required by some common file. Double-checked and now see that it could be safely removed.

Quoted 12 lines
Quoted 12 lines
arch/arc/include/asm/ptrace.h new file +6 -0
new file mode 100644
index 0000000..3b2df87
@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. All rights reserved.
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
Quoted 9 lines

arch/arc/include/asm/ptrace.h line 12

Quoted 6 lines
arch/arc/include/asm/ptrace.h new file +6 -0
+#ifndef __ASM_ARC_PTRACE_H
+#define __ASM_ARC_PTRACE_H
+
+#ifndef __ASSEMBLY__
+
+/* THE pt_regs: Defines how regs are saved during entry into kernel */

Is the "THE" a shortcut?

Another copy from Linux sources - thus taken as it is.

Quoted 5 lines

arch/arc/include/asm/string.h

Quoted 3 lines
arch/arc/include/asm/string.h new file +0 -0
new file mode 100644
index 0000000..e69de29

empty file

Somehow I missed a fact that ARC already has optimized "string" routines. Will add them in re-spin.

Will send a v2 series soon.

-Alexey

#4 lore raw

PATCH 1/9 arc: add architecture header files

Hello Alexey,

Am 29.01.2014 09:57, schrieb Alexey Brodkin:

Quoted 16 lines

Hello Heiko,

Quoted 3 lines · Heiko Schocher

Hello Alexey,

Thanks for your patches, more or less just nitpicking comments ...

Thanks for prompt review.

Quoted 6 lines

Am 29.01.2014 00:09, schrieb Alexey Brodkin:

Quoted 1 line

No commit message, please add one. (Are this files from the Linux kernel? If so please add a comment in the commit message + add a hint which linux commit you used, thanks!)

Quoted 5 lines

I thought from commit subject it's already clear what's presented in each particular patch so I left commit messages empty. Frankly I'm not sure still what info may I put in commit messages except mention of headers borrowed from Linux - or this is exactly what is needed?

Maybe this site helps you:

http://www.denx.de/wiki/view/U-Boot/Patches#Attributing_Code_Copyrights_Sign

Quoted 22 lines

Agree I forgot to mention which header files came from Linux kernel. Will add mentions.

Quoted 5 lines

arch/arc/include/asm/arch-arc700/hardware.h

Quoted 3 lines
arch/arc/include/asm/arch-arc700/hardware.h new file +0 -0
new file mode 100644
index 0000000..e69de29

Empty file ?

Right, it looks weird, but I had to add this empty file just because of "designware_i2c" driver which refers to "asm/arch/hardware.h".

http://git.denx.de/?p=u-boot.git;a=blob;f=drivers/i2c/designware_i2c.c;h=9ed929521a8944dc870fc2eff546507632b6e86a;hb=HEAD

And to remove "asm/arch/hardware.h" I would need to modify "arch/hardware.h" and "include/configs/..." files for platform/boards I don't own.

Basically this is just a work-around that allows me to use "designware_i2c" driver as it is.

Quoted 8 lines

There was a similar dependency ("asm/arch/clk.h") in "dw_mmc" but in that case it was possible to just remove it - what I did -
http://git.denx.de/?p=u-boot.git;a=commit;h=ca6d4d0f8f0fb8ae09a7ba271177367bdfdf3136

So if you insist on removal of this file we would need to fix "designware_i2c" first.

Please let me know what do you think about this item.

Hmm.. at least you should an comment in this file, why it is necessary.

Quoted 52 lines
Quoted 3 lines
Quoted 3 lines
arch/arc/include/asm/arcregs.h new file +0 -0
new file mode 100644
index 0000000..87b0a60

...

Quoted 26 lines

arch/arc/include/asm/arcregs.h line 102

Quoted 5 lines
arch/arc/include/asm/arcregs.h new file +5 -0
+
+#ifndef __ASSEMBLY__
+
+/*
+ ******************************************************************

Bad comment style

arch/arc/include/asm/arcregs.h line 115

Quoted 13 lines

+ * Inline ASM macros to read/write AUX Regs
+ * Essentially invocation of lr/sr insns from "C"
+ */

arch/arc/include/asm/arcregs.h new file +10 -0
+
+#if 1
+
+#define read_aux_reg(reg)	__builtin_arc_lr(reg)
+
+/* gcc builtin sr needs reg param to be long immediate */
+#define write_aux_reg(reg_immed, val)		\
+		__builtin_arc_sr((unsigned int)val, reg_immed)
+
+#else

Please remove dead code ...

Quoted 2 lines
arch/arc/include/asm/arcregs.h new file +2 -0
+
+#define read_aux_reg(reg)		\

...

Quoted 6 lines

arch/arc/include/asm/arcregs.h line 172

Quoted 3 lines
arch/arc/include/asm/arcregs.h new file +3 -0
+		bogus_undefined();			\
+	}						\
+}

Why do you use defines here instead of real functions?

Quoted 14 lines

arch/arc/include/asm/arcregs.h line 184

Quoted 12 lines
arch/arc/include/asm/arcregs.h new file +12 -0
+
+#define WRITE_BCR(reg, into)				\
+{							\
+	unsigned int tmp;				\
+	if (sizeof(tmp) == sizeof(into)) {		\
+		tmp = (*(unsigned int *)(into));	\
+		write_aux_reg(reg, tmp);		\
+	} else  {					\
+		extern void bogus_undefined(void);	\
+		bogus_undefined();			\
+	}						\
+}

and here?

Quoted 2 lines

Ok, so this header is borrowed from Linux sources. That's why I didn't do any modifications and took it as it is on kernel.org.

Ah, ok, so this is ok I think.

Quoted 8 lines
Quoted 5 lines

arch/arc/include/asm/processor.h

Quoted 3 lines
arch/arc/include/asm/processor.h new file +0 -0
new file mode 100644
index 0000000..e69de29

Hups, one more empty file ...

I thought it was required by some common file. Double-checked and now see that it could be safely removed.

Great!

Quoted 30 lines
Quoted 12 lines
Quoted 12 lines
arch/arc/include/asm/ptrace.h new file +6 -0
new file mode 100644
index 0000000..3b2df87
@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. All rights reserved.
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
Quoted 9 lines

arch/arc/include/asm/ptrace.h line 12

Quoted 6 lines
arch/arc/include/asm/ptrace.h new file +6 -0
+#ifndef __ASM_ARC_PTRACE_H
+#define __ASM_ARC_PTRACE_H
+
+#ifndef __ASSEMBLY__
+
+/* THE pt_regs: Defines how regs are saved during entry into kernel */

Is the "THE" a shortcut?

Another copy from Linux sources - thus taken as it is.

Quoted 5 lines

arch/arc/include/asm/string.h

Quoted 3 lines
arch/arc/include/asm/string.h new file +0 -0
new file mode 100644
index 0000000..e69de29

empty file

Quoted 4 lines

Somehow I missed a fact that ARC already has optimized "string" routines. Will add them in re-spin.

Will send a v2 series soon.

Ok, hope to find time for your other patches ...

bye,
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#5 lore raw

PATCH 1/9 arc: add architecture header files

Hello Heiko,

Quoted 4 lines · Heiko Schocher

Maybe this site helps you:

http://www.denx.de/wiki/view/U-Boot/Patches#Attributing_Code_Copyrights_Sign

Indeed I even went through this readme a while ago but didn't pay enough attention to it on submission.

The question is - if only some files in "arch/arc/include" are copies from Linux sources may I still have a cumulative patch with all arc headers and just list borrowed files in commit message or I need to put borrowed files in a separate patch?

Quoted 26 lines
Quoted 26 lines

Agree I forgot to mention which header files came from Linux kernel. Will add mentions.

Quoted 5 lines

arch/arc/include/asm/arch-arc700/hardware.h

Quoted 3 lines
arch/arc/include/asm/arch-arc700/hardware.h new file +0 -0
new file mode 100644
index 0000000..e69de29

Empty file ?

Right, it looks weird, but I had to add this empty file just because of "designware_i2c" driver which refers to "asm/arch/hardware.h".

http://git.denx.de/?p=u-boot.git;a=blob;f=drivers/i2c/designware_i2c.c;h=9ed929521a8944dc870fc2eff546507632b6e86a;hb=HEAD

And to remove "asm/arch/hardware.h" I would need to modify "arch/hardware.h" and "include/configs/..." files for platform/boards I don't own.

Basically this is just a work-around that allows me to use "designware_i2c" driver as it is.

There was a similar dependency ("asm/arch/clk.h") in "dw_mmc" but in that case it was possible to just remove it - what I did -
http://git.denx.de/?p=u-boot.git;a=commit;h=ca6d4d0f8f0fb8ae09a7ba271177367bdfdf3136

Quoted 6 lines
Quoted 4 lines

So if you insist on removal of this file we would need to fix "designware_i2c" first.

Please let me know what do you think about this item.

Hmm.. at least you should an comment in this file, why it is necessary.

Once again may I just mention it in commit message? Otherwise because of this mention in file itself I would need to add licensing (copyright) info in the file and then we have a file which only needs to exist to satisfy pre-processor but with contents of about 10 lines (which doesn't have any technical purpose).

Quoted 1 line

Ok, hope to find time for your other patches ...

Much appreciated!

Thanks a lot,
Alexey

#6 lore raw

PATCH 2/9 arc: add cpu files

In reply to Alexey Brodkin
Cc Mischa Jonker <[email protected]>
Cc Francois Bedard <[email protected]>
---
 arch/arc/config.mk               |  31 +++++
 arch/arc/cpu/arc700/Makefile     |  13 ++
 arch/arc/cpu/arc700/cache.c      | 161 ++++++++++++++++++++++++
 arch/arc/cpu/arc700/config.mk    |   7 ++
 arch/arc/cpu/arc700/cpu.c        |  37 ++++++
 arch/arc/cpu/arc700/interrupts.c | 211 +++++++++++++++++++++++++++++++
 arch/arc/cpu/arc700/reset.c      |  19 +++
 arch/arc/cpu/arc700/start.S      | 262 +++++++++++++++++++++++++++++++++++++++
 arch/arc/cpu/arc700/timer.c      |  28 +++++
 arch/arc/cpu/arc700/u-boot.lds   |  72 +++++++++++
 10 files changed, 841 insertions(+)
 create mode 100644 arch/arc/config.mk
 create mode 100644 arch/arc/cpu/arc700/Makefile
 create mode 100644 arch/arc/cpu/arc700/cache.c
 create mode 100644 arch/arc/cpu/arc700/config.mk
 create mode 100644 arch/arc/cpu/arc700/cpu.c
 create mode 100644 arch/arc/cpu/arc700/interrupts.c
 create mode 100644 arch/arc/cpu/arc700/reset.c
 create mode 100644 arch/arc/cpu/arc700/start.S
 create mode 100644 arch/arc/cpu/arc700/timer.c
 create mode 100644 arch/arc/cpu/arc700/u-boot.lds
arch/arc/config.mk new file +31 -0
new file mode 100644
index 0000000..76f4f7c
@@ -0,0 +1,31 @@
+#
+# Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+ifndef CONFIG_SYS_BIG_ENDIAN
+CONFIG_SYS_LITTLE_ENDIAN = 1
+endif
+
+ifdef CONFIG_SYS_LITTLE_ENDIAN
+CROSS_COMPILE ?= arc-buildroot-linux-uclibc-
+endif
+
+ifdef CONFIG_SYS_BIG_ENDIAN
+CROSS_COMPILE ?= arceb-buildroot-linux-uclibc-
+PLATFORM_LDFLAGS += -EB
+endif
+
+PLATFORM_CPPFLAGS += -ffixed-r25 -D__ARC__ -DCONFIG_ARC -gdwarf-2
+
+LDSCRIPT := $(SRCTREE)/$(CPUDIR)/u-boot.lds
+
+# Needed for relocation
+LDFLAGS_FINAL += -pie
+
+# Load address for standalone apps
+CONFIG_STANDALONE_LOAD_ADDR ?= 0x82000000
+
+# Support generic board on ARC
+__HAVE_ARCH_GENERIC_BOARD := y
arch/arc/cpu/arc700/Makefile new file +13 -0
new file mode 100644
index 0000000..cdc5002
@@ -0,0 +1,13 @@
+#
+# Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+extra-y	+= start.o
+
+obj-y	+= cache.o
+obj-y	+= cpu.o
+obj-y	+= interrupts.o
+obj-y	+= reset.o
+obj-y	+= timer.o
arch/arc/cpu/arc700/cache.c new file +161 -0

161 lines not on this page · raw message

arch/arc/cpu/arc700/config.mk new file +7 -0
new file mode 100644
index 0000000..3206ff4
@@ -0,0 +1,7 @@
+#
+# Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+PLATFORM_CPPFLAGS += -mA7
arch/arc/cpu/arc700/cpu.c new file +37 -0
new file mode 100644
index 0000000..ec9d2cb
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+#include <asm/arcregs.h>
+#include <asm/cache.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int arch_cpu_init(void)
+{
+#ifdef CONFIG_SYS_ICACHE_OFF
+	icache_disable();
+#else
+	icache_enable();
+	invalidate_icache_all();
+#endif
+
+	flush_dcache_all();
+#ifdef CONFIG_SYS_DCACHE_OFF
+	dcache_disable();
+#else
+	dcache_enable();
+#endif
+
+	/* In simulation (ISS) "CHIPID" and "ARCNUM" are all "ff" */
+	if ((read_aux_reg(AUX_IDENTITY) & 0xffffff00) == 0xffffff00)
+		gd->arch.running_on_hw = 0;
+	else
+		gd->arch.running_on_hw = 1;
+
+	timer_init();
+	return 0;
+}
arch/arc/cpu/arc700/interrupts.c new file +211 -0

211 lines not on this page · raw message

arch/arc/cpu/arc700/reset.c new file +19 -0
new file mode 100644
index 0000000..98ebf1d
@@ -0,0 +1,19 @@
+/*
+ * Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <command.h>
+#include <common.h>
+
+int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+{
+	printf("Put your restart handler here\n");
+
+#ifdef DEBUG
+	/* Stop debug session here */
+	__asm__("brk");
+#endif
+	return 0;
+}
arch/arc/cpu/arc700/start.S new file +262 -0

262 lines not on this page · raw message

arch/arc/cpu/arc700/timer.c new file +28 -0
new file mode 100644
index 0000000..02ba319
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <asm/arcregs.h>
+
+/* Timer related Aux registers */
+#define ARC_REG_TIMER0_LIMIT	0x23	/* timer 0 limit */
+#define ARC_REG_TIMER0_CTRL	0x22	/* timer 0 control */
+#define ARC_REG_TIMER0_CNT	0x21	/* timer 0 count */
+
+#define TIMER0_LIMIT		-1	/* Maximum limit for timer */
+
+int timer_init(void)
+{
+	write_aux_reg(ARC_REG_TIMER0_CTRL, 0);
+	write_aux_reg(ARC_REG_TIMER0_LIMIT, TIMER0_LIMIT);
+	write_aux_reg(ARC_REG_TIMER0_CTRL, 2);
+	write_aux_reg(ARC_REG_TIMER0_CNT, 0);
+	return 0;
+}
+
+unsigned long timer_read_counter(void)
+{
+	return read_aux_reg(ARC_REG_TIMER0_CNT);
+}
arch/arc/cpu/arc700/u-boot.lds new file +72 -0

72 lines not on this page · raw message

Signature · 1 line
1.8.5.3
#7 lore raw

PATCH 3/9 arc: add library functions

In reply to Alexey Brodkin
Cc Mischa Jonker <[email protected]>
Cc Francois Bedard <[email protected]>
---
 arch/arc/lib/Makefile   |   9 ++++
 arch/arc/lib/bootm.c    | 106 ++++++++++++++++++++++++++++++++++++++++++++++++
 arch/arc/lib/relocate.c |  74 +++++++++++++++++++++++++++++++++
 arch/arc/lib/sections.c |  21 ++++++++++
 4 files changed, 210 insertions(+)
 create mode 100644 arch/arc/lib/Makefile
 create mode 100644 arch/arc/lib/bootm.c
 create mode 100644 arch/arc/lib/relocate.c
 create mode 100644 arch/arc/lib/sections.c
arch/arc/lib/Makefile new file +9 -0
new file mode 100644
index 0000000..6420cf2
@@ -0,0 +1,9 @@
+#
+# Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+obj-y += sections.o
+obj-y += relocate.o
+obj-$(CONFIG_CMD_BOOTM) += bootm.o
arch/arc/lib/bootm.c new file +106 -0

106 lines not on this page · raw message

arch/arc/lib/relocate.c new file +74 -0

74 lines not on this page · raw message

arch/arc/lib/sections.c new file +21 -0
new file mode 100644
index 0000000..b0b46a4
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+/*
+ * For some reason linker sets linker-generated symbols to zero in PIE mode.
+ * A work-around is substitution of linker-generated symbols with
+ * compiler-generated symbols which are properly handled by linker in PAE mode.
+ */
+
+char __bss_start[0] __attribute__((section(".__bss_start")));
+char __bss_end[0] __attribute__((section(".__bss_end")));
+char __image_copy_start[0] __attribute__((section(".__image_copy_start")));
+char __image_copy_end[0] __attribute__((section(".__image_copy_end")));
+char __rel_dyn_start[0] __attribute__((section(".__rel_dyn_start")));
+char __rel_dyn_end[0] __attribute__((section(".__rel_dyn_end")));
+char __text_start[0] __attribute__((section(".__text_start")));
+char __text_end[0] __attribute__((section(".__text_end")));
+char __init_end[0] __attribute__((section(".__init_end")));
Signature · 1 line
1.8.5.3
#8 lore raw

PATCH 4/9 arc: bdinfo and image support

In reply to Alexey Brodkin
Cc Mischa Jonker <[email protected]>
Cc Francois Bedard <[email protected]>
---
 common/cmd_bdinfo.c | 18 ++++++++++++++++++
 common/image.c      |  1 +
 include/image.h     |  1 +
 3 files changed, 20 insertions(+)
common/cmd_bdinfo.c +18 -0
index 713de14..15119a7 100644
@@ -517,6 +517,24 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	return 0;
 }
 
+#elif defined(CONFIG_ARC700)
+
+int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+	bd_t *bd = gd->bd;
+
+	print_num("mem start",		bd->bi_memstart);
+	print_lnum("mem size",		bd->bi_memsize);
+
+#if defined(CONFIG_CMD_NET)
+	print_eth(0);
+	printf("ip_addr     = %s\n", getenv("ipaddr"));
+#endif
+	printf("baudrate    = %d bps\n", bd->bi_baudrate);
+
+	return 0;
+}
+
 #else
  #error "a case for this architecture does not exist!"
 #endif
common/image.c +1 -0
index ae95c3f..9c6bec5 100644
@@ -82,6 +82,7 @@ static const table_entry_t uimage_arch[] = {
 	{	IH_ARCH_OPENRISC,	"or1k",		"OpenRISC 1000",},
 	{	IH_ARCH_SANDBOX,	"sandbox",	"Sandbox",	},
 	{	IH_ARCH_ARM64,		"arm64",	"AArch64",	},
+	{	IH_ARCH_ARC,		"arc",		"ARC",		},
 	{	-1,			"",		"",		},
 };
 
include/image.h +1 -0
index 7de2bb2..3ba8c2e 100644
@@ -157,6 +157,7 @@ struct lmb;
 #define IH_ARCH_NDS32	        20	/* ANDES Technology - NDS32  */
 #define IH_ARCH_OPENRISC        21	/* OpenRISC 1000  */
 #define IH_ARCH_ARM64		22	/* ARM64	*/
+#define IH_ARCH_ARC		23	/* Synopsys DesignWare ARC */
 
 /*
  * Image Types
Signature · 1 line
1.8.5.3
#9 lore raw

PATCH 5/9 arc: add support for standalone programs

In reply to Alexey Brodkin
Cc Mischa Jonker <[email protected]>
Cc Francois Bedard <[email protected]>
---
 examples/standalone/stubs.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
examples/standalone/stubs.c +13 -0
index 32a19ce..9346bc2 100644
@@ -210,6 +210,19 @@ 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_ARC)
+/*
+ * r25 holds the pointer to the global_data. r10 is call clobbered.
+  */
+#define EXPORT_FUNC(x) \
+	asm volatile( \
+"	.align 4\n" \
+"	.globl " #x "\n" \
+#x ":\n" \
+"	ld	%%r10, [%%r25, %0]\n" \
+"	ld	%%r10, [%%r10, %1]\n" \
+"	j	[%%r10]\n" \
+	: : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "r10");
 #else
 /*"	addi	$sp, $sp, -24\n"	\
 "	br	$r16\n"			\*/
Signature · 1 line
1.8.5.3
#10 lore raw

PATCH 6/9 arc: add Arcangel4 board support

In reply to Alexey Brodkin

Prerequisite is http://patchwork.ozlabs.org/patch/300901/

Cc Mischa Jonker <[email protected]>
Cc Francois Bedard <[email protected]>
---
 board/synopsys/arcangel4/Makefile    |  7 +++
 board/synopsys/arcangel4/arcangel4.c | 25 ++++++++++
 boards.cfg                           |  1 +
 include/configs/arcangel4.h          | 96 ++++++++++++++++++++++++++++++++++++
 4 files changed, 129 insertions(+)
 create mode 100644 board/synopsys/arcangel4/Makefile
 create mode 100644 board/synopsys/arcangel4/arcangel4.c
 create mode 100644 include/configs/arcangel4.h
board/synopsys/arcangel4/Makefile new file +7 -0
new file mode 100644
index 0000000..f849750
@@ -0,0 +1,7 @@
+#
+# Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+obj-y	+= arcangel4.o
board/synopsys/arcangel4/arcangel4.c new file +25 -0
new file mode 100644
index 0000000..e2ffcd0
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int board_early_init_f(void)
+{
+	gd->cpu_clk = CONFIG_SYS_CLK_FREQ;
+	gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
+
+	return 0;
+}
+
+int board_early_init_r(void)
+{
+	gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
+	gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE;
+
+	return 0;
+}
boards.cfg +1 -0
index 2dfd2b4..41269fe 100644
@@ -1229,6 +1229,7 @@ Active  sparc       leon3          -           gaisler         -
 Active  sparc       leon3          -           gaisler         -                   gr_xc3s_1500                         -                                                                                                                                 -
 Active  sparc       leon3          -           gaisler         -                   grsim                                -                                                                                                                                 -
 Active  x86         x86            coreboot    chromebook-x86  coreboot            coreboot-x86                         coreboot:SYS_TEXT_BASE=0x01110000                                                                                                 -
+Active  arc         arc700         -           synopsys        arcangel4           arcangel4                            -                                                                                                                                 Alexey Brodkin <[email protected]>
 Orphan  arm         arm1136        mx31        -               imx31_phycore       imx31_phycore_eet                    imx31_phycore:IMX31_PHYCORE_EET                                                                                                   (resigned) Guennadi Liakhovetski <[email protected]>
 Orphan  arm         arm1136        mx31        freescale       -                   mx31ads                              -                                                                                                                                 (resigned) Guennadi Liakhovetski <[email protected]>
 Orphan  arm         pxa            -           -               -                   lubbock                              -                                                                                                                                 (dead address) Kyle Harris <[email protected]>
include/configs/arcangel4.h new file +96 -0

96 lines not on this page · raw message

Signature · 1 line
1.8.5.3
#11 lore raw

PATCH 7/9 arc: add AXS101 board support

In reply to Alexey Brodkin
Cc Mischa Jonker <[email protected]>
Cc Francois Bedard <[email protected]>
---
 board/synopsys/axs101/Makefile |   8 ++
 board/synopsys/axs101/axs101.c |  61 +++++++++++
 board/synopsys/axs101/nand.c   | 224 +++++++++++++++++++++++++++++++++++++++++
 boards.cfg                     |   1 +
 include/configs/axs101.h       | 194 +++++++++++++++++++++++++++++++++++
 5 files changed, 488 insertions(+)
 create mode 100644 board/synopsys/axs101/Makefile
 create mode 100644 board/synopsys/axs101/axs101.c
 create mode 100644 board/synopsys/axs101/nand.c
 create mode 100644 include/configs/axs101.h
board/synopsys/axs101/Makefile new file +8 -0
new file mode 100644
index 0000000..f0965f7
@@ -0,0 +1,8 @@
+#
+# Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+obj-y	+= axs101.o
+obj-$(CONFIG_CMD_NAND) += nand.o
board/synopsys/axs101/axs101.c new file +61 -0

61 lines not on this page · raw message

board/synopsys/axs101/nand.c new file +224 -0

224 lines not on this page · raw message

boards.cfg +1 -0
index 41269fe..cb6bc37 100644
@@ -1229,6 +1229,7 @@ Active  sparc       leon3          -           gaisler         -
 Active  sparc       leon3          -           gaisler         -                   gr_xc3s_1500                         -                                                                                                                                 -
 Active  sparc       leon3          -           gaisler         -                   grsim                                -                                                                                                                                 -
 Active  x86         x86            coreboot    chromebook-x86  coreboot            coreboot-x86                         coreboot:SYS_TEXT_BASE=0x01110000                                                                                                 -
+Active  arc         arc700         -           synopsys        axs101              axs101                               -                                                                                                                                 Alexey Brodkin <[email protected]>
 Active  arc         arc700         -           synopsys        arcangel4           arcangel4                            -                                                                                                                                 Alexey Brodkin <[email protected]>
 Orphan  arm         arm1136        mx31        -               imx31_phycore       imx31_phycore_eet                    imx31_phycore:IMX31_PHYCORE_EET                                                                                                   (resigned) Guennadi Liakhovetski <[email protected]>
 Orphan  arm         arm1136        mx31        freescale       -                   mx31ads                              -                                                                                                                                 (resigned) Guennadi Liakhovetski <[email protected]>
include/configs/axs101.h new file +194 -0

194 lines not on this page · raw message

Signature · 1 line
1.8.5.3
#12 lore raw

PATCH 8/9 arc: add architecture to MAKEALL

In reply to Alexey Brodkin
Cc Mischa Jonker <[email protected]>
Cc Francois Bedard <[email protected]>
---
 MAKEALL | 6 ++++++
 1 file changed, 6 insertions(+)
MAKEALL +6 -0
index 562071a..54b0d89 100755
@@ -529,6 +529,12 @@ LIST_sparc="$(targets_by_arch sparc)"
 
 LIST_nds32="$(targets_by_arch nds32)"
 
+#########################################################################
+## ARC Systems
+#########################################################################
+
+LIST_arc="$(targets_by_arch arc)"
+
 #-----------------------------------------------------------------------
 
 get_target_location() {
Signature · 1 line
1.8.5.3
#13 lore raw

PATCH 9/9 arc: add README for architecture

In reply to Alexey Brodkin
Cc Mischa Jonker <[email protected]>
Cc Francois Bedard <[email protected]>
---
 doc/README.ARC | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
 create mode 100644 doc/README.ARC
doc/README.ARC new file +27 -0
new file mode 100644
index 0000000..5f414fb
@@ -0,0 +1,27 @@
+Synopsys' DesignWare(r) ARC(r) Processors are a family of 32-bit CPUs
+that SoC designers can optimize for a wide range of uses, from deeply embedded
+to high-performance host applications.
+
+More information on ARC cores avaialble here:
+http://www.synopsys.com/IP/ProcessorIP/ARCProcessors/Pages/default.aspx
+
+Designers can differentiate their products by using patented configuration
+technology to tailor each ARC processor instance to meet specific performance,
+power and area requirements.
+
+The DesignWare ARC processors are also extendable, allowing designers to add
+their own custom instructions that dramatically increase performance.
+
+Synopsys' ARC processors have been used by over 170 customers worldwide who
+collectively ship more than 1 billion ARC-based chips annually.
+
+All DesignWare ARC processors utilize a 16-/32-bit ISA that provides excellent
+performance and code density for embedded and host SoC applications.
+
+The RISC microprocessors are synthesizable and can be implemented in any foundry
+or process, and are supported by a complete suite of development tools.
+
+The ARC GNU toolchain with support for all ARC Processors can be downloaded
+from here (available pre-built toolchains as well):
+
+https://github.com/foss-for-synopsys-dwc-arc-processors/toolchain/releases
Signature · 1 line
1.8.5.3