Add support for the ARC700 architecture
Subsystems (3)
v2 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-v2' 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-v2
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
Changes for v2:
* Deleted unused empty file "asm/processor.h"
* Added borrowed from Linux optimized string routines
* Added commit messages for most of patches
* Added explicit mention of files borrowed from Linux sources with reference to versoin/commit in Linux git repository
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/linkage.h | 63 ++++++ arch/arc/include/asm/posix_types.h | 73 +++++++ arch/arc/include/asm/ptrace.h | 101 +++++++++ arch/arc/include/asm/sections.h | 1 + arch/arc/include/asm/string.h | 27 +++ 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 | 16 ++ arch/arc/lib/bootm.c | 106 +++++++++ arch/arc/lib/memcmp.S | 122 +++++++++++ arch/arc/lib/memcpy-700.S | 64 ++++++ arch/arc/lib/memset.S | 59 +++++ arch/arc/lib/relocate.c | 74 +++++++ arch/arc/lib/sections.c | 21 ++ arch/arc/lib/strchr-700.S | 133 ++++++++++++ arch/arc/lib/strcmp.S | 96 +++++++++ arch/arc/lib/strcpy-700.S | 70 ++++++ arch/arc/lib/strlen.S | 83 +++++++ 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 + 52 files changed, 3412 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/linkage.h create mode 100644 arch/arc/include/asm/posix_types.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/memcmp.S create mode 100644 arch/arc/lib/memcpy-700.S create mode 100644 arch/arc/lib/memset.S create mode 100644 arch/arc/lib/relocate.c create mode 100644 arch/arc/lib/sections.c create mode 100644 arch/arc/lib/strchr-700.S create mode 100644 arch/arc/lib/strcmp.S create mode 100644 arch/arc/lib/strcpy-700.S create mode 100644 arch/arc/lib/strlen.S 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
PATCH v2 1/9 arc: add architecture header files
These are header files used by ARC700 architecture.
Following files were borrowed from Linux kernel sources, commit 5ee54f38171b9b3541c5e9cf9c3a9e53455fd8b4 (Linux 3.11.10):
* arcregs.h
* linkage.h
* ptrace.h
* string.h
Also note that "arch-arc700/hardware.h" is only required for compilation of "designware_i2c" driver which refers to "asm/arch/hardware.h". It would be good to fix mentioned driver sometime soon but it will cause changes in ARM board configs that use "designware_i2c".
Changes for v2:
* Deleted unused empty file "asm/processor.h"
* Added commit message
* Added explicit mention of header files borrowed from Linux sources with reference to versoin/commit in Linux git repository
--- 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/linkage.h | 63 ++++++ arch/arc/include/asm/posix_types.h | 73 +++++++ arch/arc/include/asm/ptrace.h | 101 +++++++++ arch/arc/include/asm/sections.h | 1 + arch/arc/include/asm/string.h | 27 +++ 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, 1044 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/linkage.h create mode 100644 arch/arc/include/asm/posix_types.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
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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -0,0 +1 @@ +#include <asm-generic/errno.h>
arch/arc/include/asm/global_data.h new file +19 -0
@@ -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/linkage.h new file +63 -0
63 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/ptrace.h new file +101 -0
101 lines not on this page · raw message
arch/arc/include/asm/sections.h new file +1 -0
@@ -0,0 +1 @@ +#include <asm-generic/sections.h>
arch/arc/include/asm/string.h new file +27 -0
@@ -0,0 +1,27 @@ +/* +* Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. All rights reserved. +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef __ASM_ARC_STRING_H +#define __ASM_ARC_STRING_H + +#define __HAVE_ARCH_MEMSET +#define __HAVE_ARCH_MEMCPY +#define __HAVE_ARCH_MEMCMP +#define __HAVE_ARCH_STRCHR +#define __HAVE_ARCH_STRCPY +#define __HAVE_ARCH_STRCMP +#define __HAVE_ARCH_STRLEN + +extern void *memset (void *ptr,int ,__kernel_size_t ); +extern void *memcpy (void *,const void *,__kernel_size_t ); +extern void memzero (void *ptr,__kernel_size_t n); +extern int memcmp (const void *,const void *,__kernel_size_t ); +extern char *strchr (const char *s,int c); +extern char *strcpy (char *dest,const char *src); +extern int strcmp (const char *cs,const char *ct); +extern __kernel_size_t strlen (const char *); + +#endif /* __ASM_ARC_STRING_H */
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
@@ -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
@@ -0,0 +1 @@ +#include <asm-generic/unaligned.h>
Signature · 1 line
1.8.5.3
PATCH v2 2/9 arc: add cpu files
In reply to Alexey BrodkinNo changes for v2.
--- 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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
PATCH v2 3/9 arc: add library functions
In reply to Alexey BrodkinThese are library functions used by ARC700 architecture.
Following files were borrowed from Linux kernel sources, commit 5ee54f38171b9b3541c5e9cf9c3a9e53455fd8b4 (Linux 3.11.10):
* memcmp.S
* memcpy-700.S
* memset.S
* strchr-700.S
* strcmp.S
* strcpy-700.S
* strlen.S
Changes for v2:
* Added commit message
* Added borrowed from Linux optimized string routines
* Added explicit mention of files borrowed from Linux sources with reference to versoin/commit in Linux git repository
--- arch/arc/lib/Makefile | 16 ++++++ arch/arc/lib/bootm.c | 106 ++++++++++++++++++++++++++++++++++++ arch/arc/lib/memcmp.S | 122 ++++++++++++++++++++++++++++++++++++++++++ arch/arc/lib/memcpy-700.S | 64 ++++++++++++++++++++++ arch/arc/lib/memset.S | 59 ++++++++++++++++++++ arch/arc/lib/relocate.c | 74 ++++++++++++++++++++++++++ arch/arc/lib/sections.c | 21 ++++++++ arch/arc/lib/strchr-700.S | 133 ++++++++++++++++++++++++++++++++++++++++++++++ arch/arc/lib/strcmp.S | 96 +++++++++++++++++++++++++++++++++ arch/arc/lib/strcpy-700.S | 70 ++++++++++++++++++++++++ arch/arc/lib/strlen.S | 83 +++++++++++++++++++++++++++++ 11 files changed, 844 insertions(+) create mode 100644 arch/arc/lib/Makefile create mode 100644 arch/arc/lib/bootm.c create mode 100644 arch/arc/lib/memcmp.S create mode 100644 arch/arc/lib/memcpy-700.S create mode 100644 arch/arc/lib/memset.S create mode 100644 arch/arc/lib/relocate.c create mode 100644 arch/arc/lib/sections.c create mode 100644 arch/arc/lib/strchr-700.S create mode 100644 arch/arc/lib/strcmp.S create mode 100644 arch/arc/lib/strcpy-700.S create mode 100644 arch/arc/lib/strlen.S
arch/arc/lib/Makefile new file +16 -0
@@ -0,0 +1,16 @@ +# +# Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved. +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y += sections.o +obj-y += relocate.o +obj-y += strchr-700.o +obj-y += strcmp.o +obj-y += strcpy-700.o +obj-y += strlen.o +obj-y += memcmp.o +obj-y += memcpy-700.o +obj-y += memset.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/memcmp.S new file +122 -0
122 lines not on this page · raw message
arch/arc/lib/memcpy-700.S new file +64 -0
64 lines not on this page · raw message
arch/arc/lib/memset.S new file +59 -0
59 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
@@ -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")));
arch/arc/lib/strchr-700.S new file +133 -0
133 lines not on this page · raw message
arch/arc/lib/strcmp.S new file +96 -0
96 lines not on this page · raw message
arch/arc/lib/strcpy-700.S new file +70 -0
70 lines not on this page · raw message
arch/arc/lib/strlen.S new file +83 -0
83 lines not on this page · raw message
Signature · 1 line
1.8.5.3
PATCH v2 4/9 arc: bdinfo and image support
In reply to Alexey BrodkinNo changes for v2.
--- common/cmd_bdinfo.c | 18 ++++++++++++++++++ common/image.c | 1 + include/image.h | 1 + 3 files changed, 20 insertions(+)
common/cmd_bdinfo.c +18 -0
@@ -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
@@ -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
@@ -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
PATCH v2 5/9 arc: add support for standalone programs
In reply to Alexey BrodkinNo changes for v2.
--- examples/standalone/stubs.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
examples/standalone/stubs.c +13 -0
@@ -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
PATCH v2 6/9 arc: add Arcangel4 board support
In reply to Alexey BrodkinArcangel4 is a FPGA-based development board that is used for prototyping and verificationof of both ARC hardware (CPUs) and software running upon CPU.
Prerequisite is http://patchwork.ozlabs.org/patch/300901/
Changes for v2:
* Added commit message
--- 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
@@ -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
@@ -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
@@ -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
PATCH v2 7/9 arc: add AXS101 board support
In reply to Alexey BrodkinAXS101 is a new generation of devlopment boards from Synopsys that houses ASIC with ARC700 and lots of DesignWare peripherals:
* DW APB UART
* DW Mobile Storage (MMC/SD)
* DW I2C
* DW GMAC
Changes for v2:
* Added commit message
--- 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
@@ -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
@@ -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
PATCH v2 8/9 arc: add architecture to MAKEALL
In reply to Alexey BrodkinNo changes for v2.
--- MAKEALL | 6 ++++++ 1 file changed, 6 insertions(+)
MAKEALL +6 -0
@@ -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
PATCH v2 9/9 arc: add README for architecture
In reply to Alexey BrodkinNo changes for v2.
--- doc/README.ARC | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 doc/README.ARC
doc/README.ARC new file +27 -0
@@ -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
PATCH v2 1/9 arc: add architecture header files
In reply to Alexey BrodkinDear Alexey Brodkin,
Quoted 1 line · In message <[email protected]> you wrote:
These are header files used by ARC700 architecture.
...
Quoted 10 lines
arch/arc/include/asm/arcregs.h new file +10
-0+/* 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 */
arch/arc/include/asm/arcregs.h line 31
Quoted 10 lines
arch/arc/include/asm/arcregs.h new file +10
-0+#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
Are you sure that this should not become a C struct declaration? This looks much like offsets, and we so not allow a base address + offset notation for device I/O ...
arch/arc/include/asm/arcregs.h line 37
Quoted 5 lines
arch/arc/include/asm/arcregs.h new file +5
-0+/* 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 */
Please uses masks instead of bit numbers. Bitfields are inherently non-portable and dangerous.
arch/arc/include/asm/arcregs.h line 43
Quoted 5 lines
arch/arc/include/asm/arcregs.h new file +5
-0+/* 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)
As the STATUS_??_BIT defiens should not be used anywhere else, you might drop them without loss of readability.
Quoted 5 lines
+/*
+ ******************************************************************
+ * Inline ASM macros to read/write AUX Regs
+ * Essentially invocation of lr/sr insns from "C"
+ */
Can we drop this "*******************" line?
Quoted 11 lines
arch/arc/include/asm/arcregs.h new file +11
-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 + +#define read_aux_reg (reg) \
...
Quoted 1 line
+#endif
This pretty long else branch is just dead code. Please get rid of all such "#if 1" or "#if 0" blocks in your code, globally.
Quoted 13 lines
arch/arc/include/asm/arcregs.h new file +13
-0+#define READ_BCR (reg, into) \ +{ \ + 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(); \ + } \ +} + +#define WRITE_BCR (reg, into) \
arch/arc/include/asm/arcregs.h line 184
Quoted 10 lines
arch/arc/include/asm/arcregs.h new file +10
-0+{ \ +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 (); \ + } \ +}
Do we really need this? No other architecture does anything like that. Can you not just use standard I/O accessors?
arch/arc/include/asm/arcregs.h line 190
Quoted 5 lines
arch/arc/include/asm/arcregs.h new file +5
-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)
Please drop these. The just make the code harder to read.
arch/arc/include/asm/arcregs.h line 211
Quoted 7 lines
arch/arc/include/asm/arcregs.h new file +7
-0+struct bcr_identity { +#ifdef CONFIG_CPU_BIG_ENDIAN +unsigned int chip_id:16 , cpu_id:8 , family:8 ; +#else +unsigned int family:8 , cpu_id:8 , chip_id:16 ; +#endif +};
Arghh... Please by all means try to avoid bitfields! They are pure evil and are strongly discouraged!
arch/arc/include/asm/arcregs.h line 226
Quoted 9 lines
arch/arc/include/asm/arcregs.h new file +9
-0+struct bcr_extn { +#ifdef CONFIG_CPU_BIG_ENDIAN +unsigned int pad:20 , crc:1 , ext_arith:2 , mul:2 , barrel:2 , minmax:2 , + norm:2 , swap:1 ; +#else +unsigned int swap:1 , norm:2 , minmax:2 , barrel:2 , mul:2 , ext_arith:2 , + crc:1 , pad:20 ; +#endif +};
Do you really need your own definition CONFIG_CPU_BIG_ENDIAN here? Can you not use the existing standard defines instead? If you do, please keep inmind that all new CONFIG_ optins must be explained in the README.
Quoted 6 lines
arch/arc/include/asm/arcregs.h new file +6
-0+/* DSP Options Ref Manual */ +struct bcr_extn_mac_mul { +#ifdef CONFIG_CPU_BIG_ENDIAN +unsigned int pad:16 , type:8 , ver:8 ; +#else +unsigned int ver:8 , type:8 , pad:16 ;
arch/arc/include/asm/arcregs.h line 243
Quoted 10 lines
arch/arc/include/asm/arcregs.h new file +10
-0+#endif +}; + +struct bcr_extn_xymem { +#ifdef CONFIG_CPU_BIG_ENDIAN +unsigned int ram_org:2 , num_banks:4 , bank_sz:4 , ver:8 ; +#else +unsigned int ver:8 , bank_sz:4 , num_banks:4 , ram_org:2 ; +#endif +};
..
etc.
With all these tons of bitfields the code will be a mess to read and
understand. Please really try and get rid of using bitfields!
Quoted 4 lines
+/*
+ *******************************************************************
+ * Generic structures to hold build configuration used at runtime
+ */
Incorrect multiline comment style. Please fix globally.
arch/arc/include/asm/arcregs.h line 294
Quoted 3 lines
arch/arc/include/asm/arcregs.h new file +3
-0+struct cpuinfo_arc_mmu { +unsigned int ver, pg_sz, sets, ways, u_dtlb, u_itlb, num_tlb; +};
Please declare structs one field per line, and comment the meaning of the fields. Please fix globally.
arch/arc/include/asm/byteorder.h line 15
Quoted 4 lines
arch/arc/include/asm/byteorder.h new file +4
-0+#if !defined(__STRICT_ANSI__) || defined(__KERNEL__) +#define __BYTEORDER_HAS_U64__ +#define __SWAB_64_THRU_32__ +#endif
We don't have __KERNEL__ much longer, I think...
arch/arc/include/asm/io.h line 32
Quoted 11 lines
arch/arc/include/asm/io.h new file +11
-0+#define IO_WRITE32 (val, addr) ({__asm__ __volatile__ ("st.di %0,[%1]" : : \ + "r" ((val)) , "r" ((addr))); }) + +#define IO_READ32 (addr) ({unsigned int val = 0; __asm__ __volatile__ \ + ("ld.di %0,[%1]" : "=&r" ((val)) : "r" ((addr))); val; }) + +#define IO_WRITE8 (val, addr) ({__asm__ __volatile__ ("stb.di %0,[%1]" : : \ + "r" ((val)), "r" ((addr))); }) + +#define IO_READ8 (addr) ({unsigned int val = 0; __asm__ __volatile__ \ + ("ldb.di %0,[%1]" : "=&r" ((val)) : "r" ((addr))); val; })
Why would these IOREAD*/IO_WRITE* macros be needed in addition to the read*/write* accessors? Their definitions look pretty much identical to me.
Quoted 7 lines
arch/arc/include/asm/io.h new file +7
-0+#define writeb (val, addr) ({ __asm__ __volatile__ ("stb.di %0,[%1]" : :\ + "r" ((val)), "r" ((addr))); }) + +#define writew (val, addr) ({ __asm__ __volatile__ ("stw.di %0,[%1]" : :\ + "r" ((val)), "r" ((addr))); }) + +#define writel (val, addr) ({ __asm__ __volatile__ ("st.di %0,[%1]" : :\
arch/arc/include/asm/io.h line 50
Quoted 10 lines
arch/arc/include/asm/io.h new file +10
-0+ "r" ((val)), "r" ((addr))); }) + +#define readb (addr) ({unsigned int val = 0; __asm__ __volatile__ \ + ("ldb.di %0,[%1]" : "=&r" ((val)) : "r" ((addr))); val; }) + +#define readw (addr) ({unsigned int val = 0; __asm__ __volatile__ \ + ("ldw.di %0,[%1]" : "=&r" ((val)) : "r" ((addr))); val; }) + +#define readl (addr) ({unsigned int val = 0; __asm__ __volatile__ \ + ("ld.di %0,[%1]" : "=&r" ((val)) : "r"((addr))); val; })
As far as I can tell there is no type checking for the arguments passed here. Can this please be added, so the compiler can catch when you for example try to use a writel() on a address that points to char only?
Quoted 29 lines
arch/arc/include/asm/io.h new file +29
-0+/* +* Generic virtual read/write +*/ +#define iomem_valid_addr (iomem, sz) (1) +#define iomem_to_phys (iomem) (iomem) + +#ifdef __io +#define outb (v, p) __raw_writeb(v, __io(p)) +#define outw (v, p) __raw_writew(cpu_to_le16(v), __io(p)) +#define outl (v, p) __raw_writel(cpu_to_le32(v), __io(p)) + +#define inb (p) ({ unsigned int __v = __raw_readb(__io(p)); __v; }) +#define inw (p) ({ unsigned int __v = le16_to_cpu(__raw_readw(__io(p))); __v; }) +#define inl (p) ({ unsigned int __v = le32_to_cpu(__raw_readl(__io(p))); __v; }) + +#define outsb (p, d, l) __raw_writesb(__io(p), d, l) +#define outsw (p, d, l) __raw_writesw(__io(p), d, l) +#define outsl (p, d, l) __raw_writesl(__io(p), d, l) + +#define insb (p, d, l) __raw_readsb(__io(p), d, l) +#define insw (p, d, l) __raw_readsw(__io(p), d, l) +#define insl (p, d, l) __raw_readsl(__io(p), d, l) +#endif + +#define outb_p (val, port) outb((val), (port)) +#define outw_p (val, port) outw((val), (port)) +#define outl_p (val, port) outl((val), (port)) + +#define inb_p (port) inb((port))
arch/arc/include/asm/io.h line 179
Quoted 10 lines
arch/arc/include/asm/io.h new file +10
-0+#define inw_p (port) inw((port)) +#define inl_p (port) inl((port)) + +#define outsb_p (port, from, len) outsb(port, from, len) +#define outsw_p (port, from, len) outsw(port, from, len) +#define outsl_p (port, from, len) outsl(port, from, len) + +#define insb_p (port, to, len) insb(port, to, len) +#define insw_p (port, to, len) insw(port, to, len) +#define insl_p (port, to, len) insl(port, to, len)
Do we actually need any of this in U-Boot?
Please clean up and remove unused stuff...
arch/arc/include/asm/io.h line 244
Quoted 9 lines
arch/arc/include/asm/io.h new file +9
-0+/* +* Given a physical address and a length, return a virtual address +* that can be used to access the memory range with the caching +* properties specified by "flags". +*/ +#define MAP_NOCACHE (0) +#define MAP_WRCOMBINE (0) +#define MAP_WRBACK (0) +#define MAP_WRTHROUGH (0)
Needed in U-Boot? Please fix globally.
arch/arc/include/asm/io.h line 284
Quoted 12 lines
arch/arc/include/asm/io.h new file +12
-0+/* Written to pacify arch indepeandant code. +* Not used by ARC I/O +*/ +#define _inb inb +#define _outb outb + +#define IO_SPACE_LIMIT 0xffff + +#define IOMAP_FULL_CACHING 0 +#define IOMAP_NOCACHE_SER 1 +#define IOMAP_NOCACHE_NONSER 2 +#define IOMAP_WRITETHROUGH 3
I think you can drop that, too?
arch/arc/include/asm/linkage.h line 21
Quoted 8 lines
arch/arc/include/asm/linkage.h new file +8
-0+/* Can't use the ENTRY macro in linux/linkage.h +* gas considers ';' as comment vs. newline +*/ +.macro ARC_ENTRY name + .global \name + .align 4 + \name: +.endm
Is this really correct sytax for this architecture? I would expect that the "\n" means a newline character ;-)
Quoted 47 lines
arch/arc/include/asm/posix_types.h new file +47
-0+/* +* This file is generally used by user-level software, so you need to +* be a little careful about namespace pollution etc. Also, we cannot +* assume GCC is being used. +*/ + +typedef unsigned short __kernel_dev_t ; +typedef unsigned long __kernel_ino_t ; +typedef unsigned short __kernel_mode_t ; +typedef unsigned short __kernel_nlink_t ; +typedef long __kernel_off_t ; +typedef int __kernel_pid_t ; +typedef unsigned short __kernel_ipc_pid_t ; +typedef unsigned short __kernel_uid_t ; +typedef unsigned short __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 ; + +#ifdef __GNUC__ +typedef long long __kernel_loff_t ; +#endif + +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, fdsetp) \
arch/arc/include/asm/posix_types.h line 66
Quoted 10 lines
arch/arc/include/asm/posix_types.h new file +10
-0+ (((fd_set *)fdsetp)->fds_bits[fd >> 5] |= (1<<(fd & 31))) + +#undef __FD_CLR +#define __FD_CLR (fd, fdsetp) \ + (((fd_set *)fdsetp)->fds_bits[fd >> 5] &= ~(1<<(fd & 31))) + +#undef __FD_ISSET +#define __FD_ISSET (fd, fdsetp) \ + ((((fd_set *)fdsetp)->fds_bits[fd >> 5] & (1<<(fd & 31))) != 0) +
Is any of this actually relevant in U-Boot?
arch/arc/include/asm/posix_types.h line 71
Quoted 5 lines
arch/arc/include/asm/posix_types.h new file +5
-0+#undef __FD_ZERO +#define __FD_ZERO (fdsetp) \ + (memset (fdsetp, 0, sizeof (*(fd_set *)fdsetp))) + +#endif
Note that checkpatch throws warnings here:
WARNING: space prohibited between function name and open parenthesis '('
Please make sure to run all your patches through checkpatch and fix such errors and warnings!
Quoted 9 lines
arch/arc/include/asm/posix_types.h new file +1
-0+#endif /* __ASM_ARC_POSIX_TYPES_H */ arch/arc/include/asm/ptrace.h new file +2
-0@@ -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 */
Needed?
arch/arc/include/asm/ptrace.h line 64
Quoted 2 lines
arch/arc/include/asm/ptrace.h new file +2
-0+/* return 1 if user mode or 0 if kernel mode */ +#define user_mode (regs) (regs->status32 & STATUS_U_MASK)
Certainly not needed, right?
etc. etc.
Best regards,
Wolfgang Denk
Signature · 6 lines
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 The price of success is hard work, dedication to the job at hand, and the determination that whether we win or lose, we have applied the best of ourselves to the task at hand. - Vince Lombardi
PATCH v2 2/9 arc: add cpu files
In reply to Alexey BrodkinDear Alexey Brodkin,
Quoted 6 lines · In message <[email protected]> you wrote:
Signed-off-by Alexey Brodkin <[email protected]>Cc Mischa Jonker <[email protected]>Cc Francois Bedard <[email protected]>No changes for v2.
This belongs into the comment section (below the "---" line), not into the commit message.
Quoted 1 line
---
...
arch/arc/cpu/arc700/cache.c line 50
Quoted 11 lines
arch/arc/cpu/arc700/cache.c new file +11
-0+int icache_status (void ) +{ +return (read_aux_reg (ARC_REG_IC_CTRL ) &IC_CTRL_CACHE_DISABLE ) != +IC_CTRL_CACHE_DISABLE ; +} + +void icache_enable (void ) +{ +write_aux_reg (ARC_REG_IC_CTRL ,read_aux_reg (ARC_REG_IC_CTRL ) & + ~IC_CTRL_CACHE_DISABLE ); +}
I missed this in patch # 1 - why do you need these read_aux_reg() / write_aux_reg() macros? Why cannot you use standard I/O accessors instead?
arch/arc/cpu/arc700/interrupts.c line 22
Quoted 10 lines
arch/arc/cpu/arc700/interrupts.c new file +10
-0+/* STATUS32 register bits related to Interrupt Handling */ +#define STATUS_E1_BIT 1/* Int 1 enable */ +#define STATUS_E2_BIT 2/* Int 2 enable */ +#define STATUS_A1_BIT 3/* Int 1 active */ +#define STATUS_A2_BIT 4/* Int 2 active */ + +#define STATUS_E1_MASK (1<<STATUS_E1_BIT) +#define STATUS_E2_MASK (1<<STATUS_E2_BIT) +#define STATUS_A1_MASK (1<<STATUS_A1_BIT) +#define STATUS_A2_MASK (1<<STATUS_A2_BIT)
See before.
arch/arc/cpu/arc700/interrupts.c line 39
Quoted 8 lines
arch/arc/cpu/arc700/interrupts.c new file +8
-0+int disable_interrupts (void ) +{ +int status =read_aux_reg (ARC_REG_STATUS32 ); +int state = (status |STATUS_E1_MASK |STATUS_E2_MASK ) ?1 :0 ; + status &= ~(STATUS_E1_MASK |STATUS_E2_MASK ); + __asm__("flag %0" : :"r" (status)); +return state; +}
Please insert blankk line between declarations and code. Please fix globally.
arch/arc/cpu/arc700/interrupts.c line 50
Quoted 10 lines
arch/arc/cpu/arc700/interrupts.c new file +10
-0+void enable_interrupts (void ) +{ +unsigned int status =read_aux_reg (ARC_REG_STATUS32 ); + status |=STATUS_E1_MASK |STATUS_E2_MASK ; + __asm__("flag %0" : :"r" (status)); +} + +/* +* Common routine to print scratch regs (r0-r12) or callee regs (r13-r25) +* -Prints 3 regs per line and a CR.
Comment and code disagree: You print "\n", not "\r" !
Best regards,
Wolfgang Denk
Signature · 7 lines
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
GUIs are virtually useless. Learn tools. They're configurable,
scriptable, automatable, cron-able, interoperable, etc. We don't need
no brain-dead winslurping monolithic claptrap.
-- Tom Christiansen in 371140df at csnewsPATCH v2 3/9 arc: add library functions
In reply to Alexey BrodkinDear Alexey Brodkin,
Quoted 1 line · In message <[email protected]> you wrote:
These are library functions used by ARC700 architecture.
checkpatch says:
WARNING: line over 80 characters
#610: FILE: arch/arc/lib/relocate.c:61:
+ debug(" %p: rom reloc %x, ram %p, value %x, limit %x\n",
Best regards,
Wolfgang Denk
Signature · 4 lines
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 ######## This message was made from 100% recycled electrons. ########
PATCH v2 7/9 arc: add AXS101 board support
In reply to Alexey BrodkinDear Alexey Brodkin,
Quoted 2 lines · In message <[email protected]> you wrote:
AXS101 is a new generation of devlopment boards from Synopsys that houses ASIC with ARC700 and lots of DesignWare peripherals:
....
include/configs/axs101.h line 142
Quoted 6 lines
include/configs/axs101.h new file +6
-0+#define CONFIG_HOSTNAME axs101 +#define CONFIG_ETHADDR 4a:56:49:22:3e:43 +#define CONFIG_IPADDR 10.121.8.200 +#define CONFIG_SERVERIP 10.121.8.31 +#define CONFIG_GATEWAYIP 10.121.8.1 +#define CONFIG_NETMASK 255.255.255.0
We do not allow any such fixed network parameters in the board config headers.
Best regards,
Wolfgang Denk
Signature · 4 lines
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 Things are not as simple as they seem at first. - Edward Thorp
PATCH v2 3/9 arc: add library functions
In reply to a message not in the archiveDear Mischa,
Quoted 9 lines · In message <E6BF041E97966E4DB955F0DF883AD2D685F4004E@de02wembxa.internal.synops…
Quoted 6 lines
checkpatch says:
WARNING: line over 80 characters
#610: FILE:arch/arc/lib/relocate.c:61:
+ debug(" %p: rom reloc %x, ram %p, value %x,
limit %x\n",In the Linux kernel this is OK if it is a string, because it allows you to grep through the sources for strings. What's the policy with u-boot?
Same here. Sorry for the false alarm.
Best regards,
Wolfgang Denk
Signature · 5 lines
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
"An open mind has but one disadvantage: it collects dirt."
- a saying at RPIPATCH v2 2/9 arc: add cpu files
In reply to a message not in the archiveDear Mischa,
Quoted 11 lines · In message <E6BF041E97966E4DB955F0DF883AD2D685F40060@de02wembxa.internal.synops…
Quoted 9 lines
arch/arc/cpu/arc700/cache.c line 50
Quoted 5 lines
arch/arc/cpu/arc700/cache.c new file +5
-0+void icache_enable (void ) +{ +write_aux_reg (ARC_REG_IC_CTRL ,read_aux_reg (ARC_REG_IC_CTRL ) & + ~IC_CTRL_CACHE_DISABLE ); +}I missed this in patch # 1 - why do you need these
read_aux_reg()/write_aux_reg()macros? Why cannot you use standard I/O accessors instead?Auxiliary registers are not I/O registers. The ARC architecture has general purpose registers (like any processor core has), and another set of registers, the auxiliary registers. These require a specific assembly instruction to be accessed.
Thanks for the explanation. And sorry for my ignorance - I don't know ARC at all...
Best regards,
Wolfgang Denk
Signature · 7 lines
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
: 1. What is the possibility of this being added in the future?
In the near future, the probability is close to zero. In the distant
future, I'll be dead, and posterity can do whatever they like... :-)
- lwallPATCH v2 1/9 arc: add architecture header files
In reply to Wolfgang DenkHello Wolfgang,
Quoted 108 lines · Wolfgang Denk
Dear Alexey Brodkin,
Quoted 1 line · In message <[email protected]> you wrote:
These are header files used by ARC700 architecture.
...
Quoted 10 lines
arch/arc/include/asm/arcregs.h new file +10
-0+/* 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 */ arch/arc/include/asm/arcregs.h line 31
Quoted 10 lines
arch/arc/include/asm/arcregs.h new file +10
-0+#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 0x6AAre you sure that this should not become a C struct declaration? This looks much like offsets, and we so not allow a base address + offset notation for device I/O ...
arch/arc/include/asm/arcregs.h line 37
Quoted 5 lines
arch/arc/include/asm/arcregs.h new file +5
-0+/* 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 */ Please uses masks instead of bit numbers. Bitfields are inherently non-portable and dangerous.
arch/arc/include/asm/arcregs.h line 43
Quoted 5 lines
arch/arc/include/asm/arcregs.h new file +5
-0+/* 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)As the STATUS_??_BIT defiens should not be used anywhere else, you might drop them without loss of readability.
Quoted 5 lines
+/*
+ ******************************************************************
+ * Inline ASM macros to read/write AUX Regs
+ * Essentially invocation of lr/sr insns from "C"
+ */Can we drop this "*******************" line?
Quoted 11 lines
arch/arc/include/asm/arcregs.h new file +11
-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 + +#define read_aux_reg (reg) \...
Quoted 1 line
+#endif
This pretty long else branch is just dead code. Please get rid of all such "#if 1" or "#if 0" blocks in your code, globally.
Quoted 13 lines
arch/arc/include/asm/arcregs.h new file +13
-0+#define READ_BCR (reg, into) \ +{ \ + 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(); \ + } \ +} + +#define WRITE_BCR (reg, into) \arch/arc/include/asm/arcregs.h line 184
Quoted 10 lines
arch/arc/include/asm/arcregs.h new file +10
-0+{ \ +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 (); \ + } \ +}Do we really need this? No other architecture does anything like that. Can you not just use standard I/O accessors?
arch/arc/include/asm/arcregs.h line 190
Quoted 5 lines
arch/arc/include/asm/arcregs.h new file +5
-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)Please drop these. The just make the code harder to read.
Quoted 7 lines
arch/arc/include/asm/arcregs.h line 211
Quoted 7 lines
arch/arc/include/asm/arcregs.h new file +7
-0+struct bcr_identity { +#ifdef CONFIG_CPU_BIG_ENDIAN +unsigned int chip_id:16 , cpu_id:8 , family:8 ; +#else +unsigned int family:8 , cpu_id:8 , chip_id:16 ; +#endif +};
As it is clearly mentioned in commit message "arcregs.h" came from Linux sources and that's why kept as it was. You may refer to it here -
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/arc/include/asm/arcregs.h?id=v3.11
So I'm wondering if you insist on fixing all mentioned items in "arcregs.h" or I may keep it as it is still?
Quoted 17 lines
Arghh... Please by all means try to avoid bitfields! They are pure evil and are strongly discouraged!
arch/arc/include/asm/arcregs.h line 226
Quoted 9 lines
arch/arc/include/asm/arcregs.h new file +9
-0+struct bcr_extn { +#ifdef CONFIG_CPU_BIG_ENDIAN +unsigned int pad:20 , crc:1 , ext_arith:2 , mul:2 , barrel:2 , minmax:2 , + norm:2 , swap:1 ; +#else +unsigned int swap:1 , norm:2 , minmax:2 , barrel:2 , mul:2 , ext_arith:2 , + crc:1 , pad:20 ; +#endif +};Do you really need your own definition
CONFIG_CPU_BIG_ENDIANhere? Can you not use the existing standard defines instead? If you do, please keep inmind that all newCONFIG_optins must be explained in the README.
Makes perfect sense. I missed the fact that similar defines have a bit different names in Linux/U-boot.
It's CONFIG_CPU_BIG_ENDIAN in Linux while CONFIG_SYS_BIG_ENDIAN in U-Boot. So I'll substitute it here with proper CONFIG_SYS_BIG_ENDIAN.
Quoted 6 lines
arch/arc/include/asm/byteorder.h line 15
Quoted 4 lines
arch/arc/include/asm/byteorder.h new file +4
-0+#if !defined(__STRICT_ANSI__) || defined(__KERNEL__) +#define __BYTEORDER_HAS_U64__ +#define __SWAB_64_THRU_32__ +#endif We don't have
__KERNEL__much longer, I think...
Ok, I copy-pasted it from "arch/arm/include/asm/byteorder.h". And it still has __KERNEL__ -
http://git.denx.de/?p=u-boot.git;a=blob;f=arch/arm/include/asm/byteorder.h;h=20cce7657e1059a170fd5ef32688cb96064fcd7f;hb=HEAD
Are we going to fix it for existing arches (note all arches except M68K, PowerPC and SPARC have it in "byteorder.h")?
So do I need to eliminate all checks for __KERNEL__ then?
Quoted 7 lines
Quoted 7 lines
arch/arc/include/asm/io.h new file +7
-0+#define IO_WRITE32 (val, addr) ({__asm__ __volatile__ ("st.di %0,[%1]" : : \ + "r" ((val)) , "r" ((addr))); }) + +#define IO_READ32 (addr) ({unsigned int val = 0; __asm__ __volatile__ \ + ("ld.di %0,[%1]" : "=&r" ((val)) : "r" ((addr))); val; }) + +#define IO_WRITE8 (val, addr) ({__asm__ __volatile__ ("stb.di %0,[%1]" : : \
Quoted 8 lines
arch/arc/include/asm/io.h line 32
Quoted 4 lines
arch/arc/include/asm/io.h new file +4
-0+ "r" ((val)), "r" ((addr))); }) + +#define IO_READ8 (addr) ({unsigned int val = 0; __asm__ __volatile__ \ + ("ldb.di %0,[%1]" : "=&r" ((val)) : "r" ((addr))); val; })Why would these IOREAD*/IO_WRITE* macros be needed in addition to the read*/write* accessors? Their definitions look pretty much identical to me.
Indeed they are obsolete and I'll remove them completely.
Quoted 14 lines
Quoted 14 lines
arch/arc/include/asm/io.h new file +14
-0+#define writeb (val, addr) ({ __asm__ __volatile__ ("stb.di %0,[%1]" : :\ + "r" ((val)), "r" ((addr))); }) + +#define writew (val, addr) ({ __asm__ __volatile__ ("stw.di %0,[%1]" : :\ + "r" ((val)), "r" ((addr))); }) + +#define writel (val, addr) ({ __asm__ __volatile__ ("st.di %0,[%1]" : :\ + "r" ((val)), "r" ((addr))); }) + +#define readb (addr) ({unsigned int val = 0; __asm__ __volatile__ \ + ("ldb.di %0,[%1]" : "=&r" ((val)) : "r" ((addr))); val; }) + +#define readw (addr) ({unsigned int val = 0; __asm__ __volatile__ \ + ("ldw.di %0,[%1]" : "=&r" ((val)) : "r" ((addr))); val; })
Quoted 8 lines
arch/arc/include/asm/io.h line 50
Quoted 3 lines
arch/arc/include/asm/io.h new file +3
-0+ +#define readl (addr) ({unsigned int val = 0; __asm__ __volatile__ \ + ("ld.di %0,[%1]" : "=&r" ((val)) : "r"((addr))); val; })As far as I can tell there is no type checking for the arguments passed here. Can this please be added, so the compiler can catch when you for example try to use a
writel()on a address that points to char only?
Good suggestion, but I'm wondering if this kind of checks are already implemented in other arches - may I have a reference?
Quoted 42 lines
Quoted 29 lines
arch/arc/include/asm/io.h new file +29
-0+/* +* Generic virtual read/write +*/ +#define iomem_valid_addr (iomem, sz) (1) +#define iomem_to_phys (iomem) (iomem) + +#ifdef __io +#define outb (v, p) __raw_writeb(v, __io(p)) +#define outw (v, p) __raw_writew(cpu_to_le16(v), __io(p)) +#define outl (v, p) __raw_writel(cpu_to_le32(v), __io(p)) + +#define inb (p) ({ unsigned int __v = __raw_readb(__io(p)); __v; }) +#define inw (p) ({ unsigned int __v = le16_to_cpu(__raw_readw(__io(p))); __v; }) +#define inl (p) ({ unsigned int __v = le32_to_cpu(__raw_readl(__io(p))); __v; }) + +#define outsb (p, d, l) __raw_writesb(__io(p), d, l) +#define outsw (p, d, l) __raw_writesw(__io(p), d, l) +#define outsl (p, d, l) __raw_writesl(__io(p), d, l) + +#define insb (p, d, l) __raw_readsb(__io(p), d, l) +#define insw (p, d, l) __raw_readsw(__io(p), d, l) +#define insl (p, d, l) __raw_readsl(__io(p), d, l) +#endif + +#define outb_p (val, port) outb((val), (port)) +#define outw_p (val, port) outw((val), (port)) +#define outl_p (val, port) outl((val), (port)) + +#define inb_p (port) inb((port))arch/arc/include/asm/io.h line 179
Quoted 10 lines
arch/arc/include/asm/io.h new file +10
-0+#define inw_p (port) inw((port)) +#define inl_p (port) inl((port)) + +#define outsb_p (port, from, len) outsb(port, from, len) +#define outsw_p (port, from, len) outsw(port, from, len) +#define outsl_p (port, from, len) outsl(port, from, len) + +#define insb_p (port, to, len) insb(port, to, len) +#define insw_p (port, to, len) insw(port, to, len) +#define insl_p (port, to, len) insl(port, to, len)Do we actually need any of this in U-Boot?
Quoted 1 line
Please clean up and remove unused stuff...
Well for example "inb"/"outb" is used in "drivers/serial/ns16550.c" and in many other places. So we need to clean drivers and common files first.
Quoted 11 lines
arch/arc/include/asm/io.h line 244
Quoted 9 lines
arch/arc/include/asm/io.h new file +9
-0+/* +* Given a physical address and a length, return a virtual address +* that can be used to access the memory range with the caching +* properties specified by "flags". +*/ +#define MAP_NOCACHE (0) +#define MAP_WRCOMBINE (0) +#define MAP_WRBACK (0) +#define MAP_WRTHROUGH (0)Needed in U-Boot? Please fix globally.
MAP_WRCOMBINE is not used really.
While MAP_NOCACHE and MAP_WRBACK are still in use in couple of places together with "map_physmem()".
Quoted 6 lines
Quoted 6 lines
arch/arc/include/asm/io.h new file +6
-0+/* Written to pacify arch indepeandant code. +* Not used by ARC I/O +*/ +#define _inb inb +#define _outb outb +
Quoted 8 lines
arch/arc/include/asm/io.h line 284
Quoted 6 lines
arch/arc/include/asm/io.h new file +6
-0+#define IO_SPACE_LIMIT 0xffff + +#define IOMAP_FULL_CACHING 0 +#define IOMAP_NOCACHE_SER 1 +#define IOMAP_NOCACHE_NONSER 2 +#define IOMAP_WRITETHROUGH 3I think you can drop that, too?
will do.
Quoted 12 lines
arch/arc/include/asm/linkage.h line 21
Quoted 9 lines
arch/arc/include/asm/linkage.h new file +8
-0+/* Can't use the ENTRY macro in linux/linkage.h +* gas considers ';' as comment vs. newline +*/ +.macro ARC_ENTRY name + .global \name + .align 4 + \name: +.endmIs this really correct sytax for this architecture? I would expect that the "\n" means a newline character ;-)
This is GNU Assembler macro syntax -
https://sourceware.org/binutils/docs/as/Macro.html#Macro
That's how you use parameters passed to macro.
So here parameter name is "name" and you use it as "\name" in macro's body.
And it works which is proven by built and executed both Linux kernel and U-boot on ARC CPUs.
Quoted 51 lines
Quoted 51 lines
arch/arc/include/asm/posix_types.h new file +51
-0+/* +* This file is generally used by user-level software, so you need to +* be a little careful about namespace pollution etc. Also, we cannot +* assume GCC is being used. +*/ + +typedef unsigned short __kernel_dev_t ; +typedef unsigned long __kernel_ino_t ; +typedef unsigned short __kernel_mode_t ; +typedef unsigned short __kernel_nlink_t ; +typedef long __kernel_off_t ; +typedef int __kernel_pid_t ; +typedef unsigned short __kernel_ipc_pid_t ; +typedef unsigned short __kernel_uid_t ; +typedef unsigned short __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 ; + +#ifdef __GNUC__ +typedef long long __kernel_loff_t ; +#endif + +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, fdsetp) \ + (((fd_set *)fdsetp)->fds_bits[fd >> 5] |= (1<<(fd & 31))) + +#undef __FD_CLR +#define __FD_CLR (fd, fdsetp) \
Quoted 8 lines
arch/arc/include/asm/posix_types.h line 66
Quoted 6 lines
arch/arc/include/asm/posix_types.h new file +6
-0+ (((fd_set *)fdsetp)->fds_bits[fd >> 5] &= ~(1<<(fd & 31))) + +#undef __FD_ISSET +#define __FD_ISSET (fd, fdsetp) \ + ((((fd_set *)fdsetp)->fds_bits[fd >> 5] & (1<<(fd & 31))) != 0) +Is any of this actually relevant in U-Boot?
Once again - "posix_types.h" are very similar in all arches now and so I took ARM's one. If everything or some parts there are useless we may want to clean-up this globally.
But I see that in "include/linux/types.h" "__kernel_XXX_t" types are used.
Quoted 8 lines
arch/arc/include/asm/posix_types.h line 71
Quoted 5 lines
arch/arc/include/asm/posix_types.h new file +5
-0+#undef __FD_ZERO +#define __FD_ZERO (fdsetp) \ + (memset (fdsetp, 0, sizeof (*(fd_set *)fdsetp))) + +#endif Note that checkpatch throws warnings here:
Quoted 4 lines
WARNING: space prohibited between function name and open parenthesis '('
Please make sure to run all your patches through checkpatch and fix such errors and warnings!
As I mentioned I took this one from ARM so I left it as it is. I might just add explicit mention that my file is a copy. Will it work?
Quoted 22 lines
Quoted 9 lines
arch/arc/include/asm/posix_types.h new file +1
-0+#endif /* __ASM_ARC_POSIX_TYPES_H */ arch/arc/include/asm/ptrace.h new file +2
-0@@ -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 */ Needed?
Quoted 6 lines
arch/arc/include/asm/ptrace.h line 64
Quoted 2 lines
arch/arc/include/asm/ptrace.h new file +2
-0+/* return 1 if user mode or 0 if kernel mode */ +#define user_mode (regs) (regs->status32 & STATUS_U_MASK)Certainly not needed, right?
etc. etc.
This is another file taken from Linux kernel source that's why I didn't touch it at all.
Regards,
Alexey
PATCH v2 7/9 arc: add AXS101 board support
In reply to Wolfgang DenkHello Wolfgang,
Quoted 7 lines · Wolfgang Denk
Dear Alexey Brodkin,
Quoted 2 lines · In message <[email protected]> you wrote:
AXS101 is a new generation of devlopment boards from Synopsys that houses ASIC with ARC700 and lots of DesignWare peripherals:
....
Quoted 9 lines
include/configs/axs101.h line 142
Quoted 6 lines
include/configs/axs101.h new file +6
-0+#define CONFIG_HOSTNAME axs101 +#define CONFIG_ETHADDR 4a:56:49:22:3e:43 +#define CONFIG_IPADDR 10.121.8.200 +#define CONFIG_SERVERIP 10.121.8.31 +#define CONFIG_GATEWAYIP 10.121.8.1 +#define CONFIG_NETMASK 255.255.255.0We do not allow any such fixed network parameters in the board config headers.
I see tons of boards do have these parameters set in "include/configs/xxx".
I may indeed remove them in from my board but why keep it in others? So people won't be confused any longer.
Regards,
Alexey
PATCH v2 2/9 arc: add cpu files
In reply to Wolfgang DenkHello Wolfgang,
Quoted 5 lines · Wolfgang Denk
Dear Alexey Brodkin,
Quoted 2 lines · In message <[email protected]> you wrote:
Signed-off-by Alexey Brodkin <[email protected]>
Quoted 7 lines
Quoted 4 lines
Cc Mischa Jonker <[email protected]>Cc Francois Bedard <[email protected]>No changes for v2.
This belongs into the comment section (below the "---" line), not into the commit message.
Good point, will fix next time.
Quoted 18 lines
Quoted 1 line
---
...
arch/arc/cpu/arc700/cache.c line 50
Quoted 11 lines
arch/arc/cpu/arc700/cache.c new file +11
-0+int icache_status (void ) +{ +return (read_aux_reg (ARC_REG_IC_CTRL ) &IC_CTRL_CACHE_DISABLE ) != +IC_CTRL_CACHE_DISABLE ; +} + +void icache_enable (void ) +{ +write_aux_reg (ARC_REG_IC_CTRL ,read_aux_reg (ARC_REG_IC_CTRL ) & + ~IC_CTRL_CACHE_DISABLE ); +}I missed this in patch # 1 - why do you need these
read_aux_reg()/write_aux_reg()macros? Why cannot you use standard I/O accessors instead?
This is already answered by Mischa.
Quoted 4 lines
Quoted 4 lines
arch/arc/cpu/arc700/interrupts.c new file +4
-0+/* STATUS32 register bits related to Interrupt Handling */ +#define STATUS_E1_BIT 1/* Int 1 enable */ +#define STATUS_E2_BIT 2/* Int 2 enable */ +#define STATUS_A1_BIT 3/* Int 1 active */
Quoted 8 lines
arch/arc/cpu/arc700/interrupts.c line 22
Quoted 6 lines
arch/arc/cpu/arc700/interrupts.c new file +6
-0+#define STATUS_A2_BIT 4/* Int 2 active */ + +#define STATUS_E1_MASK (1<<STATUS_E1_BIT) +#define STATUS_E2_MASK (1<<STATUS_E2_BIT) +#define STATUS_A1_MASK (1<<STATUS_A1_BIT) +#define STATUS_A2_MASK (1<<STATUS_A2_BIT)See before.
As I answered in comments for the first patch - most of STATUS_xx_BITs are defined in "arcregs.h" which is a copy of kernel's one.
In kernel sources for some reason A1, A2, E1 and E2 bits are defined in separate header "irqflags.h" which as a whole substance we don't need in U-Boot. So I defined these flags in "arch/arc/cpu/arc700/interrupts.c" and did it in the same manner as they are in "arcregs.h".
Moreover it is expected that these mask defines all look the same way STATUS_xx_MASK by handy macro:
====
#define STS_BIT(r, bit) r->status32 & STATUS_##bit##_MASK ? #bit : ""
====
So we may easily access each and every status bit.
Also IMHO it's good to keep the same defines in both Linux kernel and in U-Boot so reader familiar with Linux for ARC understands what happens in U-Boot and vise versa.
That's my motivation here.
Quoted 12 lines
arch/arc/cpu/arc700/interrupts.c line 39
Quoted 8 lines
arch/arc/cpu/arc700/interrupts.c new file +8
-0+int disable_interrupts (void ) +{ +int status =read_aux_reg (ARC_REG_STATUS32 ); +int state = (status |STATUS_E1_MASK |STATUS_E2_MASK ) ?1 :0 ; + status &= ~(STATUS_E1_MASK |STATUS_E2_MASK ); + __asm__("flag %0" : :"r" (status)); +return state; +}Please insert blankk line between declarations and code. Please fix globally.
Quoted 12 lines
arch/arc/cpu/arc700/interrupts.c line 50
Quoted 10 lines
arch/arc/cpu/arc700/interrupts.c new file +10
-0+void enable_interrupts (void ) +{ +unsigned int status =read_aux_reg (ARC_REG_STATUS32 ); + status |=STATUS_E1_MASK |STATUS_E2_MASK ; + __asm__("flag %0" : :"r" (status)); +} + +/* +* Common routine to print scratch regs (r0-r12) or callee regs (r13-r25) +* -Prints 3 regs per line and a CR. Comment and code disagree: You print "\n", not "\r" !
Agree, so I'll remove entire comment before function and put small comments within function itself - IMHO will be easier to understand a logic.
Regards,
Alexey
PATCH v2 1/9 arc: add architecture header files
In reply to Alexey BrodkinDear Alexey,
Quoted 7 lines · In message <[email protected]> you…
As it is clearly mentioned in commit message "
arcregs.h" came from Linux sources and that's why kept as it was. You may refer to it here -
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/arc/include/asm/arcregs.h?id=v3.11So I'm wondering if you insist on fixing all mentioned items in "
arcregs.h" or I may keep it as it is still?
This is difficult to impossible for me to decide yet. MY general feeling is that there is an overwhelming amount of code that is completely unused in U-Boot. That should really be dropped.
Also, it would help if you could give reasons (I mean, other than "this comes form Linux, so it must be good") why this code should be written as it is.
Or, for example, if it is realistic to expect that both BE and LE configurations of your systems will be supported in U-Boot, etc.
Quoted 6 lines
Ok, I copy-pasted it from "
arch/arm/include/asm/byteorder.h".
And it still has__KERNEL__-
http://git.denx.de/?p=u-boot.git;a=blob;f=arch/arm/include/asm/byteor> der.h;h=20cce7657e1059a170fd5ef32688cb96064fcd7f;hb=HEADAre we going to fix it for existing arches (note all arches except M68K, PowerPC and SPARC have it in "
byteorder.h")?
IIRC it might go away in the context of the Kconfig changes.
Quoted 20 lines
Quoted 11 lines
Quoted 11 lines
arch/arc/include/asm/io.h new file +11
-0+#define writew (val, addr) ({ __asm__ __volatile__ ("stw.di %0,[%1]" : > :\ + "r" ((val)), "r" ((addr))); }) + +#define writel (val, addr) ({ __asm__ __volatile__ ("st.di %0,[%1]" : :> \ + "r" ((val)), "r" ((addr))); }) + +#define readb (addr) ({unsigned int val = 0; __asm__ __volatile__ \ + ("ldb.di %0,[%1]" : "=&r" ((val)) : "r" ((addr))); val; }) + +#define readw (addr) ({unsigned int val = 0; __asm__ __volatile__ \ + ("ldw.di %0,[%1]" : "=&r" ((val)) : "r" ((addr))); val; })Quoted 8 lines
arch/arc/include/asm/io.h line 50
Quoted 3 lines
arch/arc/include/asm/io.h new file +3
-0+ +#define readl (addr) ({unsigned int val = 0; __asm__ __volatile__ \ + ("ld.di %0,[%1]" : "=&r" ((val)) : "r"((addr))); val; })As far as I can tell there is no type checking for the arguments passed here. Can this please be added, so the compiler can catch when you for example try to use a
writel()on a address that points to char only?
Quoted 2 lines
Good suggestion, but I'm wondering if this kind of checks are already implemented in other arches - may I have a reference?
It should be sufficient to use inline functions instead of macros; for example something like
extern inline u8 readb(const volatile unsigned char __iomem *addr)
{
u8 val;
__asm__ __volatile__(
"ldb.di %0,[%1]" : "=&r" ((val)) : "r" ((addr)));
return val;
}Quoted 42 lines
Quoted 42 lines
Quoted 29 lines
arch/arc/include/asm/io.h new file +29
-0+/* +* Generic virtual read/write +*/ +#define iomem_valid_addr (iomem, sz) (1) +#define iomem_to_phys (iomem) (iomem) + +#ifdef __io +#define outb (v, p) __raw_writeb(v, __io(p)) +#define outw (v, p) __raw_writew(cpu_to_le16(v), __io(p)) +#define outl (v, p) __raw_writel(cpu_to_le32(v), __io(p)) + +#define inb (p) ({ unsigned int __v = __raw_readb(__io(p)); __v; }) +#define inw (p) ({ unsigned int __v = le16_to_cpu(__raw_readw(__io(p)> )); __v; }) +#define inl (p) ({ unsigned int __v = le32_to_cpu(__raw_readl(__io(p)> )); __v; }) + +#define outsb (p, d, l) __raw_writesb(__io(p), d, l) +#define outsw (p, d, l) __raw_writesw(__io(p), d, l) +#define outsl (p, d, l) __raw_writesl(__io(p), d, l) + +#define insb (p, d, l) __raw_readsb(__io(p), d, l) +#define insw (p, d, l) __raw_readsw(__io(p), d, l) +#define insl (p, d, l) __raw_readsl(__io(p), d, l) +#endif + +#define outb_p (val, port) outb((val), (port)) +#define outw_p (val, port) outw((val), (port)) +#define outl_p (val, port) outl((val), (port)) + +#define inb_p (port) inb((port))arch/arc/include/asm/io.h line 179
Quoted 10 lines
arch/arc/include/asm/io.h new file +10
-0+#define inw_p (port) inw((port)) +#define inl_p (port) inl((port)) + +#define outsb_p (port, from, len) outsb(port, from, len) +#define outsw_p (port, from, len) outsw(port, from, len) +#define outsl_p (port, from, len) outsl(port, from, len) + +#define insb_p (port, to, len) insb(port, to, len) +#define insw_p (port, to, len) insw(port, to, len) +#define insl_p (port, to, len) insl(port, to, len)Do we actually need any of this in U-Boot?
Quoted 5 lines
Quoted 1 line
Please clean up and remove unused stuff...
Well for example "inb"/"outb" is used in "
drivers/serial/ns16550.c" and in many other places. So we need to clean drivers and common files first.
Are you sure all of these are actually used?
Quoted 12 lines
Quoted 11 lines
arch/arc/include/asm/io.h line 244
Quoted 9 lines
arch/arc/include/asm/io.h new file +9
-0+/* +* Given a physical address and a length, return a virtual address +* that can be used to access the memory range with the caching +* properties specified by "flags". +*/ +#define MAP_NOCACHE (0) +#define MAP_WRCOMBINE (0) +#define MAP_WRBACK (0) +#define MAP_WRTHROUGH (0)Needed in U-Boot? Please fix globally.
Quoted 3 lines
MAP_WRCOMBINEis not used really.
WhileMAP_NOCACHEandMAP_WRBACKare still in use in couple of places together with "map_physmem()".
So drop the unused, please...
Quoted 98 lines
Quoted 6 lines
Quoted 6 lines
arch/arc/include/asm/io.h new file +6
-0+/* Written to pacify arch indepeandant code. +* Not used by ARC I/O +*/ +#define _inb inb +#define _outb outb +Quoted 8 lines
arch/arc/include/asm/io.h line 284
Quoted 6 lines
arch/arc/include/asm/io.h new file +6
-0+#define IO_SPACE_LIMIT 0xffff + +#define IOMAP_FULL_CACHING 0 +#define IOMAP_NOCACHE_SER 1 +#define IOMAP_NOCACHE_NONSER 2 +#define IOMAP_WRITETHROUGH 3I think you can drop that, too?
will do.
Quoted 12 lines
arch/arc/include/asm/linkage.h line 21
Quoted 9 lines
arch/arc/include/asm/linkage.h new file +8
-0+/* Can't use the ENTRY macro in linux/linkage.h +* gas considers ';' as comment vs. newline +*/ +.macro ARC_ENTRY name + .global \name + .align 4 + \name: +.endmIs this really correct sytax for this architecture? I would expect that the "\n" means a newline character ;-)
This is GNU Assembler macro syntax -
https://sourceware.org/binutils/docs/as/Macro.html#Macro
That's how you use parameters passed to macro.
So here parameter name is "name" and you use it as "\name" in macro's body.And it works which is proven by built and executed both Linux kernel and U-boot on ARC CPUs.
Quoted 51 lines
Quoted 51 lines
arch/arc/include/asm/posix_types.h new file +51
-0+/* +* This file is generally used by user-level software, so you need to +* be a little careful about namespace pollution etc. Also, we cannot +* assume GCC is being used. +*/ + +typedef unsigned short __kernel_dev_t ; +typedef unsigned long __kernel_ino_t ; +typedef unsigned short __kernel_mode_t ; +typedef unsigned short __kernel_nlink_t ; +typedef long __kernel_off_t ; +typedef int __kernel_pid_t ; +typedef unsigned short __kernel_ipc_pid_t ; +typedef unsigned short __kernel_uid_t ; +typedef unsigned short __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 ; + +#ifdef __GNUC__ +typedef long long __kernel_loff_t ; +#endif + +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, fdsetp) \ + (((fd_set *)fdsetp)->fds_bits[fd >> 5] |= (1<<(fd & 31))) + +#undef __FD_CLR +#define __FD_CLR (fd, fdsetp) \Quoted 8 lines
arch/arc/include/asm/posix_types.h line 66
Quoted 6 lines
arch/arc/include/asm/posix_types.h new file +6
-0+ (((fd_set *)fdsetp)->fds_bits[fd >> 5] &= ~(1<<(fd & 31))) + +#undef __FD_ISSET +#define __FD_ISSET (fd, fdsetp) \ + ((((fd_set *)fdsetp)->fds_bits[fd >> 5] & (1<<(fd & 31))) != 0) +Is any of this actually relevant in U-Boot?
Quoted 3 lines
Once again - "
posix_types.h" are very similar in all arches now and so I took ARM's one. If everything or some parts there are useless we may want to clean-up this globally.
It appears you avoid to answer my questions. Referring to existing sub-optimal code is not really an answer. But you are right, if othe rarchitectures include such stuff, they should be cleaned up, too.
Patches are always welcome.
Quoted 10 lines
Quoted 6 lines
Note that checkpatch throws warnings here:
WARNING: space prohibited between function name and open parenthesis '('
Please make sure to run all your patches through checkpatch and fix such errors and warnings!
As I mentioned I took this one from ARM so I left it as it is. I might just add explicit mention that my file is a copy. Will it work?
No. Everybody can make mistakes. But to knowingly copy poor code would be... well, no.
Quoted 27 lines
Quoted 27 lines
Quoted 9 lines
arch/arc/include/asm/posix_types.h new file +1
-0+#endif /* __ASM_ARC_POSIX_TYPES_H */ arch/arc/include/asm/ptrace.h new file +2
-0@@ -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 */ Needed?
arch/arc/include/asm/ptrace.h line 64
Quoted 2 lines
arch/arc/include/asm/ptrace.h new file +2
-0+/* return 1 if user mode or 0 if kernel mode */ +#define user_mode (regs) (regs->status32 & STATUS_U_MASK)Certainly not needed, right?
Quoted 4 lines
Quoted 1 line
etc. etc.
This is another file taken from Linux kernel source that's why I didn't touch it at all.
Maybe we can take only the parts that are actually needed or useful?
Best regards,
Wolfgang Denk
Signature · 4 lines
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 It's a small world, but I wouldn't want to paint it.
PATCH v2 7/9 arc: add AXS101 board support
In reply to Alexey BrodkinDear Alexey,
Quoted 11 lines · In message <[email protected]> you…
Quoted 10 lines
include/configs/axs101.h line 142
Quoted 7 lines
include/configs/axs101.h new file +6
-0+#define CONFIG_HOSTNAME axs101 +#define CONFIG_ETHADDR 4a:56:49:22:3e:43 +#define CONFIG_IPADDR 10.121.8.200 +#define CONFIG_SERVERIP 10.121.8.31 +#define CONFIG_GATEWAYIP 10.121.8.1 +#define CONFIG_NETMASK 255.255.255.0We do not allow any such fixed network parameters in the board config headers.
Quoted 2 lines
I see tons of boards do have these parameters set in "
include/configs/xxx".
Pre-historic sins. You happen to have a bit of tough luck when chosing your examples to copy from.
Quoted 2 lines
I may indeed remove them in from my board but why keep it in others? So people won't be confused any longer.
Cleanup patches are welcome.
Best regards,
Wolfgang Denk
Signature · 7 lines
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 are two ways of constructing a software design. One way is to make it so simple that there are obviously no deficiencies and the other is to make it so complicated that there are no obvious defi- ciencies. - Charles Anthony Richard Hoare
PATCH v2 7/9 arc: add AXS101 board support
Hello Wolfgang,
Quoted 17 lines · Wolfgang Denk
Dear Alexey,
Quoted 11 lines · In message <[email protected]> you…
Quoted 10 lines
include/configs/axs101.h line 142
Quoted 7 lines
include/configs/axs101.h new file +6
-0+#define CONFIG_HOSTNAME axs101 +#define CONFIG_ETHADDR 4a:56:49:22:3e:43 +#define CONFIG_IPADDR 10.121.8.200 +#define CONFIG_SERVERIP 10.121.8.31 +#define CONFIG_GATEWAYIP 10.121.8.1 +#define CONFIG_NETMASK 255.255.255.0We do not allow any such fixed network parameters in the board config headers.
Quoted 2 lines
I see tons of boards do have these parameters set in "
include/configs/xxx".
Quoted 7 lines
Pre-historic sins. You happen to have a bit of tough luck when chosing your examples to copy from.
Quoted 2 lines
I may indeed remove them in from my board but why keep it in others? So people won't be confused any longer.
Cleanup patches are welcome.
Understood.
I removed all my network parameters and will take a duty of cleaning up other configs.
The question then if CONFIG_HOSTNAME could be left?
I see people rely on host name for selection (through name) of boot files (uImage, fdt etc.)
For example "include/configs/amcc-common.h",
"include/configs/manroland/common.h" and others.
Regards,
Alexey
PATCH v2 1/9 arc: add architecture header files
In reply to Wolfgang DenkHello Wolfgang,
Quoted 15 lines · Wolfgang Denk
Dear Alexey,
Quoted 7 lines · In message <[email protected]> you…
As it is clearly mentioned in commit message "
arcregs.h" came from Linux sources and that's why kept as it was. You may refer to it here -
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/arc/include/asm/arcregs.h?id=v3.11So I'm wondering if you insist on fixing all mentioned items in "
arcregs.h" or I may keep it as it is still?This is difficult to impossible for me to decide yet. MY general feeling is that there is an overwhelming amount of code that is completely unused in U-Boot. That should really be dropped.
Quoted 6 lines
Also, it would help if you could give reasons (I mean, other than "this comes form Linux, so it must be good") why this code should be written as it is.
Or, for example, if it is realistic to expect that both BE and LE configurations of your systems will be supported in U-Boot, etc.
Your comments and reasons make perfect sense so I think I'll do a massive clean-up of those headers. It will definitely benefit U-Boot and hopefully then similar clean-up will be accepted in Linux - everybody will be happy.
And indeed I do expect to support both LE and BE flavors of ARC CPUs. Because right away one of the active users (I mean company here not individual) use BE ARC CPU.
Quoted 8 lines
Quoted 6 lines
Ok, I copy-pasted it from "
arch/arm/include/asm/byteorder.h".
And it still has__KERNEL__-
http://git.denx.de/?p=u-boot.git;a=blob;f=arch/arm/include/asm/byteor> der.h;h=20cce7657e1059a170fd5ef32688cb96064fcd7f;hb=HEADAre we going to fix it for existing arches (note all arches except M68K, PowerPC and SPARC have it in "
byteorder.h")?IIRC it might go away in the context of the
Kconfigchanges.
Good. I fixed mine, hope others will follow.
Quoted 27 lines
Quoted 20 lines
Quoted 11 lines
Quoted 11 lines
arch/arc/include/asm/io.h new file +11
-0+#define writew (val, addr) ({ __asm__ __volatile__ ("stw.di %0,[%1]" : > :\ + "r" ((val)), "r" ((addr))); }) + +#define writel (val, addr) ({ __asm__ __volatile__ ("st.di %0,[%1]" : :> \ + "r" ((val)), "r" ((addr))); }) + +#define readb (addr) ({unsigned int val = 0; __asm__ __volatile__ \ + ("ldb.di %0,[%1]" : "=&r" ((val)) : "r" ((addr))); val; }) + +#define readw (addr) ({unsigned int val = 0; __asm__ __volatile__ \ + ("ldw.di %0,[%1]" : "=&r" ((val)) : "r" ((addr))); val; })Quoted 8 lines
arch/arc/include/asm/io.h line 50
Quoted 3 lines
arch/arc/include/asm/io.h new file +3
-0+ +#define readl (addr) ({unsigned int val = 0; __asm__ __volatile__ \ + ("ld.di %0,[%1]" : "=&r" ((val)) : "r"((addr))); val; })As far as I can tell there is no type checking for the arguments passed here. Can this please be added, so the compiler can catch when you for example try to use a
writel()on a address that points to char only?Quoted 2 lines
Good suggestion, but I'm wondering if this kind of checks are already implemented in other arches - may I have a reference?
It should be sufficient to use inline functions instead of macros; for example something like
extern inline u8
readb(const volatile unsigned char __iomem *addr)
Quoted 8 lines
{
u8 val;
__asm__ __volatile__(
"ldb.di %0,[%1]" : "=&r" ((val)) : "r" ((addr)));
return val;
}Good suggestion. Will definitely replace macros with in-lined functions. Still I don't quite understand how this implementation helps with data type checking. I may feed any address and compiler happily puts 1 byte aligned address as argument for word load/store instruction.
I'm not sure if this is a flaw of our GCC port or I'm doing something wrong here.
Quoted 42 lines
Quoted 42 lines
Quoted 42 lines
Quoted 29 lines
arch/arc/include/asm/io.h new file +29
-0+/* +* Generic virtual read/write +*/ +#define iomem_valid_addr (iomem, sz) (1) +#define iomem_to_phys (iomem) (iomem) + +#ifdef __io +#define outb (v, p) __raw_writeb(v, __io(p)) +#define outw (v, p) __raw_writew(cpu_to_le16(v), __io(p)) +#define outl (v, p) __raw_writel(cpu_to_le32(v), __io(p)) + +#define inb (p) ({ unsigned int __v = __raw_readb(__io(p)); __v; }) +#define inw (p) ({ unsigned int __v = le16_to_cpu(__raw_readw(__io(p)> )); __v; }) +#define inl (p) ({ unsigned int __v = le32_to_cpu(__raw_readl(__io(p)> )); __v; }) + +#define outsb (p, d, l) __raw_writesb(__io(p), d, l) +#define outsw (p, d, l) __raw_writesw(__io(p), d, l) +#define outsl (p, d, l) __raw_writesl(__io(p), d, l) + +#define insb (p, d, l) __raw_readsb(__io(p), d, l) +#define insw (p, d, l) __raw_readsw(__io(p), d, l) +#define insl (p, d, l) __raw_readsl(__io(p), d, l) +#endif + +#define outb_p (val, port) outb((val), (port)) +#define outw_p (val, port) outw((val), (port)) +#define outl_p (val, port) outl((val), (port)) + +#define inb_p (port) inb((port))arch/arc/include/asm/io.h line 179
Quoted 10 lines
arch/arc/include/asm/io.h new file +10
-0+#define inw_p (port) inw((port)) +#define inl_p (port) inl((port)) + +#define outsb_p (port, from, len) outsb(port, from, len) +#define outsw_p (port, from, len) outsw(port, from, len) +#define outsl_p (port, from, len) outsl(port, from, len) + +#define insb_p (port, to, len) insb(port, to, len) +#define insw_p (port, to, len) insw(port, to, len) +#define insl_p (port, to, len) insl(port, to, len)Do we actually need any of this in U-Boot?
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Please clean up and remove unused stuff...
Well for example "inb"/"outb" is used in "
drivers/serial/ns16550.c" and in many other places. So we need to clean drivers and common files first.Are you sure all of these are actually used?
Well, most of these are used here and there.
And the problem I see is we have many very similar accessors in U-Boot. And people randomly (or based on their preference) use either of them.
Let's look at "outb".
Different arches define it as an alias for "writeb", "__raw_writeb", "out_8" etc.
Now I see "outb" is used in "drivers/serial/ns16550.c" as I mentioned. And this is one of the most common serial port devices right?
"writeb" is used everywhere.
"__raw_writeb" is used in "drivers/mtd/cfi_flash.c"
And the same picture with other accessors.
It would be good if we re-visit this topic and come up with some guide that explains which accessers could be used and in which cases.
In current situation it looks like every arch sort of emulates accessors of other platform.
For example this is a comment from "io.h" for "SH" architecture:
=====
The {in,out}[bwl] macros are for emulating x86-style PCI/ISA IO space
=====
And indeed I may remove these "in/out" accessors from "ARC" port. But as a maintainer/submitter of ARC port I'd like my users to have access to all (or at least most of) already existing and working drivers and common things (like commands etc).
But IMHO it will be unfair. ARC users will complain on "buggy"/obsolete drivers while users of all other architectures will rest in pease and just use existing code-base.
That's why I would prefer to have an accessors clean-up as a separate movement among all arches at once - so everybody gets affected and many hands will start fixing stuff all together.
Quoted 12 lines
Quoted 12 lines
Quoted 11 lines
arch/arc/include/asm/io.h line 244
Quoted 9 lines
arch/arc/include/asm/io.h new file +9
-0+/* +* Given a physical address and a length, return a virtual address +* that can be used to access the memory range with the caching +* properties specified by "flags". +*/ +#define MAP_NOCACHE (0) +#define MAP_WRCOMBINE (0) +#define MAP_WRBACK (0) +#define MAP_WRTHROUGH (0)Needed in U-Boot? Please fix globally.
Quoted 5 lines
Quoted 3 lines
MAP_WRCOMBINEis not used really.
WhileMAP_NOCACHEandMAP_WRBACKare still in use in couple of places together with "map_physmem()".So drop the unused, please...
Already did.
Quoted 102 lines
Quoted 98 lines
Quoted 6 lines
Quoted 6 lines
arch/arc/include/asm/io.h new file +6
-0+/* Written to pacify arch indepeandant code. +* Not used by ARC I/O +*/ +#define _inb inb +#define _outb outb +Quoted 8 lines
arch/arc/include/asm/io.h line 284
Quoted 6 lines
arch/arc/include/asm/io.h new file +6
-0+#define IO_SPACE_LIMIT 0xffff + +#define IOMAP_FULL_CACHING 0 +#define IOMAP_NOCACHE_SER 1 +#define IOMAP_NOCACHE_NONSER 2 +#define IOMAP_WRITETHROUGH 3I think you can drop that, too?
will do.
Quoted 12 lines
arch/arc/include/asm/linkage.h line 21
Quoted 9 lines
arch/arc/include/asm/linkage.h new file +8
-0+/* Can't use the ENTRY macro in linux/linkage.h +* gas considers ';' as comment vs. newline +*/ +.macro ARC_ENTRY name + .global \name + .align 4 + \name: +.endmIs this really correct sytax for this architecture? I would expect that the "\n" means a newline character ;-)
This is GNU Assembler macro syntax -
https://sourceware.org/binutils/docs/as/Macro.html#Macro
That's how you use parameters passed to macro.
So here parameter name is "name" and you use it as "\name" in macro's body.And it works which is proven by built and executed both Linux kernel and U-boot on ARC CPUs.
Quoted 51 lines
Quoted 51 lines
arch/arc/include/asm/posix_types.h new file +51
-0+/* +* This file is generally used by user-level software, so you need to +* be a little careful about namespace pollution etc. Also, we cannot +* assume GCC is being used. +*/ + +typedef unsigned short __kernel_dev_t ; +typedef unsigned long __kernel_ino_t ; +typedef unsigned short __kernel_mode_t ; +typedef unsigned short __kernel_nlink_t ; +typedef long __kernel_off_t ; +typedef int __kernel_pid_t ; +typedef unsigned short __kernel_ipc_pid_t ; +typedef unsigned short __kernel_uid_t ; +typedef unsigned short __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 ; + +#ifdef __GNUC__ +typedef long long __kernel_loff_t ; +#endif + +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, fdsetp) \ + (((fd_set *)fdsetp)->fds_bits[fd >> 5] |= (1<<(fd & 31))) + +#undef __FD_CLR +#define __FD_CLR (fd, fdsetp) \Quoted 8 lines
arch/arc/include/asm/posix_types.h line 66
Quoted 6 lines
arch/arc/include/asm/posix_types.h new file +6
-0+ (((fd_set *)fdsetp)->fds_bits[fd >> 5] &= ~(1<<(fd & 31))) + +#undef __FD_ISSET +#define __FD_ISSET (fd, fdsetp) \ + ((((fd_set *)fdsetp)->fds_bits[fd >> 5] & (1<<(fd & 31))) != 0) +Is any of this actually relevant in U-Boot?
Quoted 3 lines
Once again - "
posix_types.h" are very similar in all arches now and so I took ARM's one. If everything or some parts there are useless we may want to clean-up this globally.
Quoted 5 lines
It appears you avoid to answer my questions. Referring to existing sub-optimal code is not really an answer. But you are right, if othe rarchitectures include such stuff, they should be cleaned up, too.
Patches are always welcome.
Sure there're questions I don't have a good technical answer for. I have to confess that I'm not an expert of each and every tiny bit of U-boot.
But I see that those types in Linux sources are defined in single one header "include/linux/types.h". And all arches use it.
PATCH v2 7/9 arc: add AXS101 board support
In reply to Alexey BrodkinDear Alexey,
Quoted 4 lines · In message <1391179745.4721.36.camel@abrodkin-8560l> you wrote:
Understood.
I removed all my network parameters and will take a duty of cleaning up other configs.
thanks in advance.
Quoted 3 lines
The question then if
CONFIG_HOSTNAMEcould be left?
I see people rely on host name for selection (through name) of boot files (uImage, fdt etc.)
Yes, hostname is harmless - also in real life: it will not cause any issues on the network, if several hosts set (locally) the same hostname. Several boards with the same IP address or (even worse) the same MAC addresse are much more "interesting" ;-)
Best regards,
Wolfgang Denk
Signature · 5 lines
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 What the world needs is not dogma but an attitude of scientific inquiry. - Bertrand Russell
PATCH v2 7/9 arc: add AXS101 board support
Hello Wolfgang,
Quoted 10 lines · Wolfgang Denk
Dear Alexey,
Quoted 4 lines · In message <1391179745.4721.36.camel@abrodkin-8560l> you wrote:
Understood.
I removed all my network parameters and will take a duty of cleaning up other configs.thanks in advance.
Quoted 8 lines
Quoted 3 lines
The question then if
CONFIG_HOSTNAMEcould be left?
I see people rely on host name for selection (through name) of boot files (uImage, fdt etc.)Yes, hostname is harmless - also in real life: it will not cause any issues on the network, if several hosts set (locally) the same hostname. Several boards with the same IP address or (even worse) the same MAC addresse are much more "interesting" ;-)
I'm sorry for another continuation away from original patch discussion.
If actually not all network properties are really that harmful could you please comment on others as well - this will save a number of iterations on clean-up submission.
CONFIG_ETHADDR & CONFIG_IPADDR - it's simple - we don't want to have duplicates of the same MAC or/and IP address within one network. So definitely these ones must go away.
But others doesn't affect other devices in the network so why don't we leave them as well?
-Alexey
PATCH v2 7/9 arc: add AXS101 board support
Dear Alexey,
Quoted 7 lines · In message <1391193816.4721.100.camel@abrodkin-8560l> you wrote:
CONFIG_ETHADDR&CONFIG_IPADDR- it's simple - we don't want to have duplicates of the same MAC or/and IP address within one network. So definitely these ones must go away.But others doesn't affect other devices in the network so why don't we leave them as well?
It seems only consequent to omit all settings specific to the network
interface: addresses, netmask, etc. And if you do not set an IP address, it does not make sense to set a netmask, right?
Hostname (set to generic board name) is in so far somewhat of an exception as quite a lot of people appear to use this to organize their TFTP download directories.
It is difficult to give simple rules for these things. There is a lot of habits and decade old traditions involved, so please don't ask me for some formally defined rule sets.
Best regards,
Wolfgang Denk
Signature · 6 lines
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
Hiring experienced unix people is like a built-in filter against
idiots. Hiring experienced NT people provides no such guarantee.
-- Miguel Cruz in WgL96.349$CC.122704 at typhoon2.ba-dsg.net