include: Add support for "do_div" macro
Subsystems (4)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH v4 1/8 include: Add support for "do_div" macro
Use the div64 header files from the kernel.
---
Changes in v4: None
Changes in v3: None
Changes in v2: None
arch/mips/include/asm/div64.h | 68 +++++++++++++++++++++++++++++++++++++++++++ include/asm-generic/div64.h | 59 +++++++++++++++++++++++++++++++++++++ 2 files changed, 127 insertions(+) create mode 100644 arch/mips/include/asm/div64.h create mode 100644 include/asm-generic/div64.h
arch/mips/include/asm/div64.h new file +68 -0
@@ -0,0 +1,68 @@ +/* +* Copyright (C) 2000, 2004 Maciej W. Rozycki +* Copyright (C) 2003, 07 Ralf Baechle (ralf at linux-mips.org) +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +*/ +#ifndef __ASM_DIV64_H +#define __ASM_DIV64_H + +#include <asm-generic/div64.h> + +#if BITS_PER_LONG ==64 + +#include <linux/types.h> + +/* +* No traps on overflows for any of these... +*/ + +#define __div64_32 (n, base) \ +({ \ + unsigned long __cf, __tmp, __tmp2, __i; \ + unsigned long __quot32, __mod32; \ + unsigned long __high, __low; \ + unsigned long long __n; \ + \ + __high = *__n >> 32; \ + __low = __n; \ + __asm__( \ + " .set push\n" \ + " .set noat\n" \ + " .set noreorder\n" \ + " move %2, $0\n" \ + " move %3, $0\n" \ + " b 1f\n" \ + " li %4, 0x21\n" \ + "0:\n" \ + " sll $1, %0, 0x1\n" \ + " srl %3, %0, 0x1f\n" \ + " or %0, $1, %5\n" \ + " sll %1, %1, 0x1\n" \ + " sll %2, %2, 0x1\n" \ + "1:\n" \ + " bnez %3, 2f\n" \ + " sltu %5, %0, %z6\n" \ + " bnez %5, 3f\n" \ + "2:\n" \ + " addiu %4, %4, -1\n" \ + " subu %0, %0, %z6\n" \ + " addiu %2, %2, 1\n" \ + "3:\n" \ + " bnez %4, 0b\n\t" \ + " srl %5, %1, 0x1f\n\t" \ + " .set pop" \ + : "=&r" (__mod32), "=&r" (__tmp), \ + "=&r" (__quot32), "=&r" (__cf), \ + "=&r" (__i), "=&r" (__tmp2) \ + : "Jr" (base), "0" (__high), "1" (__low)); \ + \ + (__n) = __quot32; \ + __mod32; \ +}) + +#endif /* BITS_PER_LONG == 64 */ + +#endif /* __ASM_DIV64_H */
include/asm-generic/div64.h new file +59 -0
59 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v4 1/8 include: Add support for "do_div" macro
Quoted 4 lines · Wills Wang
Use the div64 header files from the kernel.
Signed-off-by Wills Wang <[email protected]>---
We already have include/div64.h , is that what you're after ?
Best regards,
Marek Vasut
PATCH v4 1/8 include: Add support for "do_div" macro
Sorry, i missed this file.
Quoted 11 lines · Marek Vasut
Quoted 4 lines · Wills Wang
Use the div64 header files from the kernel.
Signed-off-by Wills Wang <[email protected]>---
We already have
include/div64.h, is that what you're after ?Best regards,
Marek Vasut
PATCH v4 1/8 include: Add support for "do_div" macro
In reply to Wills WangAm 25.12.2015 um 19:56 schrieb Wills Wang:
Quoted 9 lines
Use the div64 header files from the kernel.
Signed-off-by Wills Wang <[email protected]>---
Changes in v4: None
Changes in v3: None
Changes in v2: None
Quoted 5 lines
arch/mips/include/asm/div64.h | 68 +++++++++++++++++++++++++++++++++++++++++++ include/asm-generic/div64.h | 59 +++++++++++++++++++++++++++++++++++++ 2 files changed, 127 insertions(+) create mode 100644 arch/mips/include/asm/div64.h create mode 100644 include/asm-generic/div64.h
please drop this patch, we already have a generic do_div() implementation. Also we do not really need an assembly optimized implementation for MIPS.
Quoted 141 lines
arch/mips/include/asm/div64.h new file +68
-0@@ -0,0 +1,68 @@ +/* +* Copyright (C) 2000, 2004 Maciej W. Rozycki +* Copyright (C) 2003, 07 Ralf Baechle (ralf at linux-mips.org) +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +*/ +#ifndef __ASM_DIV64_H +#define __ASM_DIV64_H + +#include <asm-generic/div64.h> + +#if BITS_PER_LONG ==64 + +#include <linux/types.h> + +/* +* No traps on overflows for any of these... +*/ + +#define __div64_32 (n, base) \ +({ \ + unsigned long __cf, __tmp, __tmp2, __i; \ + unsigned long __quot32, __mod32; \ + unsigned long __high, __low; \ + unsigned long long __n; \ + \ + __high = *__n >> 32; \ + __low = __n; \ + __asm__( \ + " .set push\n" \ + " .set noat\n" \ + " .set noreorder\n" \ + " move %2, $0\n" \ + " move %3, $0\n" \ + " b 1f\n" \ + " li %4, 0x21\n" \ + "0:\n" \ + " sll $1, %0, 0x1\n" \ + " srl %3, %0, 0x1f\n" \ + " or %0, $1, %5\n" \ + " sll %1, %1, 0x1\n" \ + " sll %2, %2, 0x1\n" \ + "1:\n" \ + " bnez %3, 2f\n" \ + " sltu %5, %0, %z6\n" \ + " bnez %5, 3f\n" \ + "2:\n" \ + " addiu %4, %4, -1\n" \ + " subu %0, %0, %z6\n" \ + " addiu %2, %2, 1\n" \ + "3:\n" \ + " bnez %4, 0b\n\t" \ + " srl %5, %1, 0x1f\n\t" \ + " .set pop" \ + : "=&r" (__mod32), "=&r" (__tmp), \ + "=&r" (__quot32), "=&r" (__cf), \ + "=&r" (__i), "=&r" (__tmp2) \ + : "Jr" (base), "0" (__high), "1" (__low)); \ + \ + (__n) = __quot32; \ + __mod32; \ +}) + +#endif /* BITS_PER_LONG == 64 */ + +#endif /* __ASM_DIV64_H */ include/asm-generic/div64.h new file +59
-0@@ -0,0 +1,59 @@ +/* +* Copyright (C) 2003 Bernardo Innocenti <[email protected]> +* Based on former asm-ppc/div64.h and asm-m68knommu/div64.h +* +* The semantics of do_div() are: +* +* uint32_t do_div(uint64_t *n, uint32_t base) +* { +* uint32_t remainder = *n % base; +* *n = *n / base; +* return remainder; +* } +* +* NOTE: macro parameter n is evaluated multiple times, +* beware of side effects! +*/ + +#ifndef _ASM_GENERIC_DIV64_H +#define _ASM_GENERIC_DIV64_H + +#include <linux/types.h> +#include <linux/compiler.h> + +#if BITS_PER_LONG ==64 + +# define do_div (n, base) ({ \ + uint32_t __base = (base); \ + uint32_t __rem; \ + __rem = ((uint64_t)(n)) % __base; \ + (n) = ((uint64_t)(n)) / __base; \ + __rem; \ +}) + +#elif BITS_PER_LONG ==32 + +extern uint32_t __div64_32 (uint64_t *dividend,uint32_t divisor); + +/* The unnecessary pointer compare is there +* to check for type safety (n must be 64bit) +*/ +# define do_div (n, base) ({ \ + uint32_t __base = (base); \ + uint32_t __rem; \ + (void)(((typeof((n)) *)0) == ((uint64_t *)0)); \ + if (likely(((n) >> 32) == 0)) { \ + __rem = (uint32_t)(n) % __base; \ + (n) = (uint32_t)(n) / __base; \ + } else \ + __rem = __div64_32(&(n), __base); \ + __rem; \ +}) + +#else /* BITS_PER_LONG == ?? */ + +# error do_div() does not yet support the C64 + +#endif /* BITS_PER_LONG */ + +#endif /* _ASM_GENERIC_DIV64_H */
Signature · 1 line
- Daniel
PATCH v4 1/8 include: Add support for "do_div" macro
Quoted 11 lines · Daniel Schwierzeck
Am 25.12.2015 um 19:56 schrieb Wills Wang:
Quoted 9 lines
Use the div64 header files from the kernel.
Signed-off-by Wills Wang <[email protected]>---
Changes in v4: None
Changes in v3: None
Changes in v2: None
Quoted 8 lines
Quoted 5 lines
arch/mips/include/asm/div64.h | 68 +++++++++++++++++++++++++++++++++++++++++++ include/asm-generic/div64.h | 59 +++++++++++++++++++++++++++++++++++++ 2 files changed, 127 insertions(+)create mode 100644
arch/mips/include/asm/div64.hcreate mode 100644include/asm-generic/div64.hplease drop this patch, we already have a generic
do_div()implementation. Also we do not really need an assembly optimized implementation for MIPS.
I missed this file, please ignore this patch.
Quoted 140 lines
Quoted 140 lines
arch/mips/include/asm/div64.h new file +68
-0@@ -0,0 +1,68 @@ +/* +* Copyright (C) 2000, 2004 Maciej W. Rozycki +* Copyright (C) 2003, 07 Ralf Baechle (ralf at linux-mips.org) +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +*/ +#ifndef __ASM_DIV64_H +#define __ASM_DIV64_H + +#include <asm-generic/div64.h> + +#if BITS_PER_LONG ==64 + +#include <linux/types.h> + +/* +* No traps on overflows for any of these... +*/ + +#define __div64_32 (n, base) \ +({ \ + unsigned long __cf, __tmp, __tmp2, __i; \ + unsigned long __quot32, __mod32; \ + unsigned long __high, __low; \ + unsigned long long __n; \ + \ + __high = *__n >> 32; \ + __low = __n; \ + __asm__( \ + " .set push\n" \ + " .set noat\n" \ + " .set noreorder\n" \ + " move %2, $0\n" \ + " move %3, $0\n" \ + " b 1f\n" \ + " li %4, 0x21\n" \ + "0:\n" \ + " sll $1, %0, 0x1\n" \ + " srl %3, %0, 0x1f\n" \ + " or %0, $1, %5\n" \ + " sll %1, %1, 0x1\n" \ + " sll %2, %2, 0x1\n" \ + "1:\n" \ + " bnez %3, 2f\n" \ + " sltu %5, %0, %z6\n" \ + " bnez %5, 3f\n" \ + "2:\n" \ + " addiu %4, %4, -1\n" \ + " subu %0, %0, %z6\n" \ + " addiu %2, %2, 1\n" \ + "3:\n" \ + " bnez %4, 0b\n\t" \ + " srl %5, %1, 0x1f\n\t" \ + " .set pop" \ + : "=&r" (__mod32), "=&r" (__tmp), \ + "=&r" (__quot32), "=&r" (__cf), \ + "=&r" (__i), "=&r" (__tmp2) \ + : "Jr" (base), "0" (__high), "1" (__low)); \ + \ + (__n) = __quot32; \ + __mod32; \ +}) + +#endif /* BITS_PER_LONG == 64 */ + +#endif /* __ASM_DIV64_H */ include/asm-generic/div64.h new file +59
-0@@ -0,0 +1,59 @@ +/* +* Copyright (C) 2003 Bernardo Innocenti <[email protected]> +* Based on former asm-ppc/div64.h and asm-m68knommu/div64.h +* +* The semantics of do_div() are: +* +* uint32_t do_div(uint64_t *n, uint32_t base) +* { +* uint32_t remainder = *n % base; +* *n = *n / base; +* return remainder; +* } +* +* NOTE: macro parameter n is evaluated multiple times, +* beware of side effects! +*/ + +#ifndef _ASM_GENERIC_DIV64_H +#define _ASM_GENERIC_DIV64_H + +#include <linux/types.h> +#include <linux/compiler.h> + +#if BITS_PER_LONG ==64 + +# define do_div (n, base) ({ \ + uint32_t __base = (base); \ + uint32_t __rem; \ + __rem = ((uint64_t)(n)) % __base; \ + (n) = ((uint64_t)(n)) / __base; \ + __rem; \ +}) + +#elif BITS_PER_LONG ==32 + +extern uint32_t __div64_32 (uint64_t *dividend,uint32_t divisor); + +/* The unnecessary pointer compare is there +* to check for type safety (n must be 64bit) +*/ +# define do_div (n, base) ({ \ + uint32_t __base = (base); \ + uint32_t __rem; \ + (void)(((typeof((n)) *)0) == ((uint64_t *)0)); \ + if (likely(((n) >> 32) == 0)) { \ + __rem = (uint32_t)(n) % __base; \ + (n) = (uint32_t)(n) / __base; \ + } else \ + __rem = __div64_32(&(n), __base); \ + __rem; \ +}) + +#else /* BITS_PER_LONG == ?? */ + +# error do_div() does not yet support the C64 + +#endif /* BITS_PER_LONG */ + +#endif /* _ASM_GENERIC_DIV64_H */
PATCH v4 2/8 mips: implement to access the KSEG0/1 memory range in map_physmem
In reply to a message not in the archiveU-boot just use the no MMU virtual address segment(KSEG0/1), this patch enable access the uncached memory range(KSEG1) by flag "MAP_NOCACHE", other flag for KSEG0 access.
---
Changes in v4: None
Changes in v3: None
Changes in v2: None
arch/mips/include/asm/io.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
arch/mips/include/asm/io.h +5 -2
@@ -485,7 +485,7 @@ static inline void sync(void)* that can be used to access the memory range with the caching * properties specified by "flags". */ -#define MAP_NOCACHE (0) +#define MAP_NOCACHE (1)#define MAP_WRCOMBINE (0)#define MAP_WRBACK (0)#define MAP_WRTHROUGH (0)
@@ -493,7 +493,10 @@ static inline void sync(void)static inline void *map_physmem (phys_addr_t paddr,unsigned long len,unsigned long flags) { -return (void *)paddr; +if (flags) +return (void *)KSEG1ADDR (paddr); +else +return (void *)KSEG0ADDR (paddr); }/*
Signature · 1 line
1.9.1
PATCH v4 2/8 mips: implement to access the KSEG0/1 memory range in map_physmem
Quoted 19 lines · Wills Wang
U-boot just use the no MMU virtual address segment(KSEG0/1), this patch enable access the uncached memory range(KSEG1) by flag "
MAP_NOCACHE", other flag for KSEG0 access.Signed-off-by Wills Wang <[email protected]>---
Changes in v4: None
Changes in v3: None
Changes in v2: Nonearch/mips/include/asm/io.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)arch/mips/include/asm/io.h +0
-0
arch/mips/include/asm/io.h static inline void sync(void) · line 488
Quoted 5 lines
arch/mips/include/asm/io.h +1
-1@@ -485,7 +485,7 @@ static inline void sync(void)* that can be used to access the memory range with the caching * properties specified by "flags". */ -#define MAP_NOCACHE (0) +#define MAP_NOCACHE (1)
I _think_ this is something someone familiar with mips has to review, since I think this has a potential to break a lot of machines.
Quoted 5 lines
arch/mips/include/asm/io.h +0
-0#define MAP_WRCOMBINE (0)#define MAP_WRBACK (0)#define MAP_WRTHROUGH (0)@@ -493,7 +493,10 @@ static inline void sync(void) static inline void *
arch/mips/include/asm/io.h static inline void sync(void) · line 502
Quoted 10 lines
arch/mips/include/asm/io.h +4
-1map_physmem(phys_addr_t paddr, unsigned long len, unsigned long flags) { - return (void *)paddr; + if (flags) + return (void *)KSEG1ADDR(paddr); + else + return (void *)KSEG0ADDR(paddr); }/*
Best regards,
Marek Vasut
PATCH v4 3/8 mips: add base support for atheros ath79 based SOCs
In reply to a message not in the archiveThis patch enable work for ar933x SOC, tested on ar9331 board.
---
Changes in v4: None
Changes in v3: None
Changes in v2: None
arch/mips/Makefile | 1 + arch/mips/include/asm/global_data.h | 5 + arch/mips/mach-ath79/Makefile | 9 + arch/mips/mach-ath79/ar933x/Makefile | 8 + arch/mips/mach-ath79/ar933x/clk.c | 86 ++ arch/mips/mach-ath79/ar933x/cpu.c | 32 + arch/mips/mach-ath79/ar933x/ddr_tap.S | 268 ++++++ arch/mips/mach-ath79/ar933x/lowlevel_init.S | 460 +++++++++ arch/mips/mach-ath79/cpu.c | 171 ++++ arch/mips/mach-ath79/dram.c | 27 + arch/mips/mach-ath79/include/mach/ar71xx_regs.h | 1144 +++++++++++++++++++++++ arch/mips/mach-ath79/include/mach/ath79.h | 143 +++ arch/mips/mach-ath79/include/mach/ddr.h | 13 + arch/mips/mach-ath79/reset.c | 46 + 14 files changed, 2413 insertions(+) create mode 100644 arch/mips/mach-ath79/Makefile create mode 100644 arch/mips/mach-ath79/ar933x/Makefile create mode 100644 arch/mips/mach-ath79/ar933x/clk.c create mode 100644 arch/mips/mach-ath79/ar933x/cpu.c create mode 100644 arch/mips/mach-ath79/ar933x/ddr_tap.S create mode 100644 arch/mips/mach-ath79/ar933x/lowlevel_init.S create mode 100644 arch/mips/mach-ath79/cpu.c create mode 100644 arch/mips/mach-ath79/dram.c create mode 100644 arch/mips/mach-ath79/include/mach/ar71xx_regs.h create mode 100644 arch/mips/mach-ath79/include/mach/ath79.h create mode 100644 arch/mips/mach-ath79/include/mach/ddr.h create mode 100644 arch/mips/mach-ath79/reset.c
arch/mips/Makefile +1 -0
@@ -8,6 +8,7 @@ libs-y += arch/mips/cpu/ libs-y += arch/mips/lib/ machine-$(CONFIG_SOC_AU1X00) += au1x00 +machine-$(CONFIG_ARCH_ATH79) += ath79 machdirs := $(patsubst %,arch/mips/mach-%/,$(machine-y)) libs-y += $(machdirs)
arch/mips/include/asm/global_data.h +5 -0
@@ -20,6 +20,11 @@ struct arch_global_data {unsigned long tbl;unsigned long lastinc;#endif +#ifdef CONFIG_ARCH_ATH79 +unsigned long soc; +unsigned long rev; +unsigned long id; +#endif };#include <asm-generic/global_data.h>
arch/mips/mach-ath79/Makefile new file +9 -0
@@ -0,0 +1,9 @@ +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y += reset.o +obj-y += cpu.o +obj-y += dram.o + +obj-$(CONFIG_SOC_AR933X) += ar933x/
arch/mips/mach-ath79/ar933x/Makefile new file +8 -0
@@ -0,0 +1,8 @@ +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y += cpu.o +obj-y += clk.o +obj-y += lowlevel_init.o +obj-y += ddr_tap.o
arch/mips/mach-ath79/ar933x/clk.c new file +86 -0
86 lines not on this page · raw message
arch/mips/mach-ath79/ar933x/cpu.c new file +32 -0
@@ -0,0 +1,32 @@ +/* +* (C) Copyright 2015 +* Wills Wang, <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <asm/io.h> +#include <asm/addrspace.h> +#include <asm/types.h> +#include <asm/arch/ar71xx_regs.h> + +DECLARE_GLOBAL_DATA_PTR ; + +int arch_cpu_init (void ) +{ +u32 val; + +/* +* Set GPIO10 (UART_SO) as output and enable UART, +* BIT(15) in GPIO_FUNCTION_1 register must be written with 1 +*/ + val =readl (KSEG1ADDR (AR71XX_GPIO_BASE +AR71XX_GPIO_REG_OE )); + val |=BIT (10 ); +writel (val,KSEG1ADDR (AR71XX_GPIO_BASE +AR71XX_GPIO_REG_OE )); + + val =readl (KSEG1ADDR (AR71XX_GPIO_BASE +AR71XX_GPIO_REG_FUNC )); + val |= (AR933X_GPIO_FUNC_UART_EN |BIT (15 )); +writel (val,KSEG1ADDR (AR71XX_GPIO_BASE +AR71XX_GPIO_REG_FUNC )); +return 0 ; +}
arch/mips/mach-ath79/ar933x/ddr_tap.S new file +268 -0
268 lines not on this page · raw message
arch/mips/mach-ath79/ar933x/lowlevel_init.S new file +460 -0
460 lines not on this page · raw message
arch/mips/mach-ath79/cpu.c new file +171 -0
171 lines not on this page · raw message
arch/mips/mach-ath79/dram.c new file +27 -0
@@ -0,0 +1,27 @@ +/* +* (C) Copyright 2015 +* Wills Wang, <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <asm/addrspace.h> +#include <asm/arch/ddr.h> + +phys_size_t initdram (int board_type) +{ +uint8_t *addr, *p; +int i; + +ddr_tap_init (); + addr = (uint8_t *)KSEG1 ; + *addr =0x77 ; +for (i =0 , p = addr; p < (uint8_t *)KSEG2 ; i++) { + p +=0x1000000 ; + *p = i; +if (*addr !=0x77 ) +break ; + } +return (phys_size_t)(p - addr); +}
arch/mips/mach-ath79/include/mach/ar71xx_regs.h new file +1144 -0
1,144 lines not on this page · raw message
arch/mips/mach-ath79/include/mach/ath79.h new file +143 -0
143 lines not on this page · raw message
arch/mips/mach-ath79/include/mach/ddr.h new file +13 -0
@@ -0,0 +1,13 @@ +/* +* (C) Copyright 2015 +* Wills Wang, <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef __ASM_MACH_DDR_H +#define __ASM_MACH_DDR_H + +void ddr_tap_init (void ); + +#endif /* __ASM_MACH_DDR_H */
arch/mips/mach-ath79/reset.c new file +46 -0
46 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v4 3/8 mips: add base support for atheros ath79 based SOCs
Quoted 4 lines · Wills Wang
This patch enable work for ar933x SOC, tested on ar9331 board.
Signed-off-by Wills Wang <[email protected]>---
[...]
Quoted 7 lines
arch/mips/mach-ath79/ar933x/cpu.c new file +7
-0+int arch_cpu_init (void ) +{ +u32 val; + +/* +* Set GPIO10 (UART_SO) as output and enable UART, +* BIT(15) in GPIO_FUNCTION_1 register must be written with 1
arch/mips/mach-ath79/ar933x/cpu.c line 32
Quoted 10 lines
arch/mips/mach-ath79/ar933x/cpu.c new file +10
-0+*/ + val =readl (KSEG1ADDR (AR71XX_GPIO_BASE +AR71XX_GPIO_REG_OE )); + val |=BIT (10 ); +writel (val,KSEG1ADDR (AR71XX_GPIO_BASE +AR71XX_GPIO_REG_OE )); + + val =readl (KSEG1ADDR (AR71XX_GPIO_BASE +AR71XX_GPIO_REG_FUNC )); + val |= (AR933X_GPIO_FUNC_UART_EN |BIT (15 )); +writel (val,KSEG1ADDR (AR71XX_GPIO_BASE +AR71XX_GPIO_REG_FUNC )); +return 0 ; +}
Pinmux should be done on a per-board basis, not per-CPU. Also, please use setbits_le32().
Quoted 26 lines
(quoted diff) +0
-0
b/arch/mips/mach-ath79/ar933x/ddr_tap.Snew file mode 100644 index 0000000..18c57dearch/mips/mach-ath79/ar933x/ddr_tap.S new file +20
-0@@ -0,0 +1,268 @@ +/* + * (C) Copyright 2015 + * Wills Wang, <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include <config.h> +#include <asm/asm.h> +#include <asm/regdef.h> +#include <asm/mipsregs.h> +#include <asm/addrspace.h> +#include <asm/arch/ar71xx_regs.h> + +#define DRAM_K0(x) KSEG0ADDR(x) +#define DRAM_K1(x) KSEG1ADDR(x) + + .text + .set noreorder +
arch/mips/mach-ath79/ar933x/ddr_tap.S line 30
Quoted 10 lines
arch/mips/mach-ath79/ar933x/ddr_tap.S new file +10
-0+LEAF(ddr_tap_init) + /* Tap settings for the DDR */ + li t0, 0xffffffff + li t1, DRAM_K0(0x500000) + sw t0, 0x0(t1) + sw t0, 0x4(t1) + sw t0, 0x8(t1) + sw t0, 0xc(t1) + nop + nop
This should be C code, pretty please.
[...]
arch/mips/mach-ath79/ar933x/lowlevel_init.S
Quoted 5 lines
(quoted diff) +0
-0
b/arch/mips/mach-ath79/ar933x/lowlevel_init.Snew file mode 100644 index 0000000..72509caarch/mips/mach-ath79/ar933x/lowlevel_init.S new file +0
-0
lowlevel_init.S should be C code too, I don't see anything which would require this to be ASM .
[...]
Quoted 27 lines
arch/mips/mach-ath79/cpu.c new file +21
-0@@ -0,0 +1,171 @@ +/* +* (C) Copyright 2015 +* Wills Wang, <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <asm/io.h> +#include <asm/addrspace.h> +#include <asm/types.h> +#include <asm/arch/ath79.h> +#include <asm/arch/ar71xx_regs.h> + +int print_cpuinfo (void ) +{ +enum ath79_soc_type soc =ATH79_SOC_UNKNOWN ; +char *chip ="????" ; +u32 id, major, minor; +u32 rev =0 ; +u32 ver =1 ;
arch/mips/mach-ath79/cpu.c line 31
Quoted 10 lines
arch/mips/mach-ath79/cpu.c new file +10
-0+ + id =readl (KSEG1ADDR (AR71XX_RESET_BASE +AR71XX_RESET_REG_REV_ID )); + major = id &REV_ID_MAJOR_MASK ; + +switch (major) { +case REV_ID_MAJOR_AR71XX : + minor = id &AR71XX_REV_ID_MINOR_MASK ; + rev = id >>AR71XX_REV_ID_REVISION_SHIFT ; + rev &=AR71XX_REV_ID_REVISION_MASK ; +switch (minor) {
I did review this already and my suggestions were ignored :-( I stop here ...
[...]
PATCH v4 3/8 mips: add base support for atheros ath79 based SOCs
Quoted 18 lines · Marek Vasut
Quoted 4 lines · Wills Wang
This patch enable work for ar933x SOC, tested on ar9331 board.
Signed-off-by Wills Wang <[email protected]>---
[...]
Quoted 11 lines
arch/mips/mach-ath79/ar933x/cpu.c new file +11
-0+int arch_cpu_init (void ) +{ +u32 val; + +/* +* Set GPIO10 (UART_SO) as output and enable UART, +* BIT(15) in GPIO_FUNCTION_1 register must be written with 1 +*/ + val =readl (KSEG1ADDR (AR71XX_GPIO_BASE +AR71XX_GPIO_REG_OE )); + val |=BIT (10 ); +writel (val,KSEG1ADDR (AR71XX_GPIO_BASE +AR71XX_GPIO_REG_OE ));
Quoted 8 lines
arch/mips/mach-ath79/ar933x/cpu.c line 32
Quoted 6 lines
arch/mips/mach-ath79/ar933x/cpu.c new file +6
-0+ + val =readl (KSEG1ADDR (AR71XX_GPIO_BASE +AR71XX_GPIO_REG_FUNC )); + val |= (AR933X_GPIO_FUNC_UART_EN |BIT (15 )); +writel (val,KSEG1ADDR (AR71XX_GPIO_BASE +AR71XX_GPIO_REG_FUNC )); +return 0 ; +}Pinmux should be done on a per-board basis, not per-CPU. Also, please use
setbits_le32().
I don't find other more fit entry for pinctrl initialization. We must set these IO pin before serial initialization. Put it into board directory?
Quoted 29 lines
Quoted 29 lines
(quoted diff) +0
-0
b/arch/mips/mach-ath79/ar933x/ddr_tap.Snew file mode 100644 index 0000000..18c57dearch/mips/mach-ath79/ar933x/ddr_tap.S new file +23
-0@@ -0,0 +1,268 @@ +/* + * (C) Copyright 2015 + * Wills Wang, <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include <config.h> +#include <asm/asm.h> +#include <asm/regdef.h> +#include <asm/mipsregs.h> +#include <asm/addrspace.h> +#include <asm/arch/ar71xx_regs.h> + +#define DRAM_K0(x) KSEG0ADDR(x) +#define DRAM_K1(x) KSEG1ADDR(x) + + .text + .set noreorder + +LEAF(ddr_tap_init) + /* Tap settings for the DDR */ + li t0, 0xffffffff
Quoted 8 lines
arch/mips/mach-ath79/ar933x/ddr_tap.S line 30
Quoted 7 lines
arch/mips/mach-ath79/ar933x/ddr_tap.S new file +7
-0+ li t1, DRAM_K0(0x500000) + sw t0, 0x0(t1) + sw t0, 0x4(t1) + sw t0, 0x8(t1) + sw t0, 0xc(t1) + nop + nopThis should be C code, pretty please.
Must this be change to c code?
I think there should be no problem.
Quoted 10 lines
[...]
arch/mips/mach-ath79/ar933x/lowlevel_init.S
Quoted 5 lines
(quoted diff) +0
-0
b/arch/mips/mach-ath79/ar933x/lowlevel_init.Snew file mode 100644 index 0000000..72509caarch/mips/mach-ath79/ar933x/lowlevel_init.S new file +0
-0
lowlevel_init.Sshould be C code too, I don't see anything which would require this to be ASM .
I don't find SRAM in this chip, we need DDR memory to handle C runtime statck.
Quoted 32 lines
[...]
Quoted 30 lines
arch/mips/mach-ath79/cpu.c new file +24
-0@@ -0,0 +1,171 @@ +/* +* (C) Copyright 2015 +* Wills Wang, <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <asm/io.h> +#include <asm/addrspace.h> +#include <asm/types.h> +#include <asm/arch/ath79.h> +#include <asm/arch/ar71xx_regs.h> + +int print_cpuinfo (void ) +{ +enum ath79_soc_type soc =ATH79_SOC_UNKNOWN ; +char *chip ="????" ; +u32 id, major, minor; +u32 rev =0 ; +u32 ver =1 ; + + id =readl (KSEG1ADDR (AR71XX_RESET_BASE +AR71XX_RESET_REG_REV_ID )); + major = id &REV_ID_MAJOR_MASK ;
Quoted 8 lines
arch/mips/mach-ath79/cpu.c line 31
Quoted 7 lines
arch/mips/mach-ath79/cpu.c new file +7
-0+ +switch (major) { +case REV_ID_MAJOR_AR71XX : + minor = id &AR71XX_REV_ID_MINOR_MASK ; + rev = id >>AR71XX_REV_ID_REVISION_SHIFT ; + rev &=AR71XX_REV_ID_REVISION_MASK ; +switch (minor) {I did review this already and my suggestions were ignored :-( I stop here ...
Sorry, I forget this.
This code inherit from kernel, to change would maintain it much more difficult.
Quoted 4 lines
[...]
PATCH v4 3/8 mips: add base support for atheros ath79 based SOCs
Am 26.12.2015 um 17:17 schrieb Wills Wang:
Quoted 29 lines · Marek Vasut
Quoted 18 lines · Wills Wang
Quoted 4 lines
This patch enable work for ar933x SOC, tested on ar9331 board.
Signed-off-by Wills Wang <[email protected]>---
[...]
Quoted 11 lines
arch/mips/mach-ath79/ar933x/cpu.c new file +11
-0+int arch_cpu_init (void ) +{ +u32 val; + +/* +* Set GPIO10 (UART_SO) as output and enable UART, +* BIT(15) in GPIO_FUNCTION_1 register must be written with 1 +*/ + val =readl (KSEG1ADDR (AR71XX_GPIO_BASE +AR71XX_GPIO_REG_OE )); + val |=BIT (10 ); +writel (val,KSEG1ADDR (AR71XX_GPIO_BASE +AR71XX_GPIO_REG_OE ));Quoted 8 lines
arch/mips/mach-ath79/ar933x/cpu.c line 32
Quoted 6 lines
arch/mips/mach-ath79/ar933x/cpu.c new file +6
-0+ + val =readl (KSEG1ADDR (AR71XX_GPIO_BASE +AR71XX_GPIO_REG_FUNC )); + val |= (AR933X_GPIO_FUNC_UART_EN |BIT (15 )); +writel (val,KSEG1ADDR (AR71XX_GPIO_BASE +AR71XX_GPIO_REG_FUNC )); +return 0 ; +}Pinmux should be done on a per-board basis, not per-CPU. Also, please use
setbits_le32().
Quoted 3 lines
I don't find other more fit entry for pinctrl initialization. We must set these IO pin before serial initialization. Put it into board directory?
you could use the board_early_init_f hook, implemented in board/ath79/ap121/ap121.c. If possible you should add a real pinctrl driver in a later step
Quoted 37 lines
Quoted 29 lines
Quoted 29 lines
(quoted diff) +0
-0
b/arch/mips/mach-ath79/ar933x/ddr_tap.Snew file mode 100644 index 0000000..18c57dearch/mips/mach-ath79/ar933x/ddr_tap.S new file +23
-0@@ -0,0 +1,268 @@ +/* + * (C) Copyright 2015 + * Wills Wang, <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include <config.h> +#include <asm/asm.h> +#include <asm/regdef.h> +#include <asm/mipsregs.h> +#include <asm/addrspace.h> +#include <asm/arch/ar71xx_regs.h> + +#define DRAM_K0(x) KSEG0ADDR(x) +#define DRAM_K1(x) KSEG1ADDR(x) + + .text + .set noreorder + +LEAF(ddr_tap_init) + /* Tap settings for the DDR */ + li t0, 0xffffffffQuoted 8 lines
arch/mips/mach-ath79/ar933x/ddr_tap.S line 30
Quoted 7 lines
arch/mips/mach-ath79/ar933x/ddr_tap.S new file +7
-0+ li t1, DRAM_K0(0x500000) + sw t0, 0x0(t1) + sw t0, 0x4(t1) + sw t0, 0x8(t1) + sw t0, 0xc(t1) + nop + nopThis should be C code, pretty please.
Quoted 2 lines
Must this be change to c code?
I think there should be no problem.
this function is only called from init_dram() which already runs in a full C environment. The conversion to C should be simple. But I would accept the current patch for the initial merge if you do the conversion later.
Quoted 10 lines
Quoted 10 lines
[...]
arch/mips/mach-ath79/ar933x/lowlevel_init.S
Quoted 5 lines
(quoted diff) +0
-0
b/arch/mips/mach-ath79/ar933x/lowlevel_init.Snew file mode 100644 index 0000000..72509caarch/mips/mach-ath79/ar933x/lowlevel_init.S new file +0
-0
lowlevel_init.Sshould be C code too, I don't see anything which would require this to be ASM .
Quoted 2 lines
I don't find SRAM in this chip, we need DDR memory to handle C runtime statck.
currently lowlevel_init() must be coded in assembly because it runs before RAM and caches are initialized. This function only exists to do that initialization. MIPS did this from the beginning. Maybe I will send some patches to use locked cache lines, but that should not be a hard requirement for adding new SoC's. Actually all modern MIPS based SoC's have some type of SRAM or first-stage bootloaders, thus adding the cache line lock feature was not really necessary. I would accept the current patch for the initial merge.
Quoted 18 lines
Quoted 18 lines
[...]
Quoted 16 lines
arch/mips/mach-ath79/cpu.c new file +10
-0@@ -0,0 +1,171 @@ +/* +* (C) Copyright 2015 +* Wills Wang, <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <asm/io.h> +#include <asm/addrspace.h>
Quoted 8 lines
Quoted 8 lines
arch/mips/mach-ath79/cpu.c line 18
Quoted 8 lines
arch/mips/mach-ath79/cpu.c new file +8
-0+#include <asm/types.h> +#include <asm/arch/ath79.h> +#include <asm/arch/ar71xx_regs.h> + +int print_cpuinfo (void ) +{ +enum ath79_soc_type soc =ATH79_SOC_UNKNOWN ; +char *chip ="????" ;
const char *chip
Quoted 15 lines
Quoted 7 lines
Quoted 7 lines
arch/mips/mach-ath79/cpu.c new file +7
-0+u32 id, major, minor; +u32 rev =0 ; +u32 ver =1 ; + + id =readl (KSEG1ADDR (AR71XX_RESET_BASE +AR71XX_RESET_REG_REV_ID )); + major = id &REV_ID_MAJOR_MASK ; +Quoted 8 lines
arch/mips/mach-ath79/cpu.c line 31
Quoted 6 lines
arch/mips/mach-ath79/cpu.c new file +6
-0+switch (major) { +case REV_ID_MAJOR_AR71XX : + minor = id &AR71XX_REV_ID_MINOR_MASK ; + rev = id >>AR71XX_REV_ID_REVISION_SHIFT ; + rev &=AR71XX_REV_ID_REVISION_MASK ; +switch (minor) {I did review this already and my suggestions were ignored :-( I stop here ...
Quoted 4 lines
Sorry, I forget this.
This code inherit from kernel, to change would maintain it much more difficult.Quoted 1 line
I agree with Marek that a lookup table would be better. But why do you want to add all possible QCA based SoC's? Until there is no supported board for other SoC's than yours, this would be dead code.
Signature · 1 line
- Daniel
PATCH v4 3/8 mips: add base support for atheros ath79 based SOCs
On Saturday, December 26, 2015 at 06:01:36 PM, Daniel Schwierzeck wrote:
[...]
Quoted 9 lines
Quoted 4 lines
Quoted 1 line
This should be C code, pretty please.
Must this be change to c code?
I think there should be no problem.this function is only called from
init_dram()which already runs in a full C environment. The conversion to C should be simple. But I would accept the current patch for the initial merge if you do the conversion later.
I'm quite opposed to that, we should keep the code out of tree until it's in sensible state, otherwise it'd only set a bad example. Especially if the conversion is easy and it has full C env, we should just do that.
Quoted 14 lines
Quoted 11 lines
Quoted 10 lines
[...]
arch/mips/mach-ath79/ar933x/lowlevel_init.S
Quoted 5 lines
(quoted diff) +0
-0
b/arch/mips/mach-ath79/ar933x/lowlevel_init.Snew file mode 100644 index 0000000..72509caarch/mips/mach-ath79/ar933x/lowlevel_init.S new file +0
-0
lowlevel_init.Sshould be C code too, I don't see anything which would require this to be ASM .Quoted 2 lines
I don't find SRAM in this chip, we need DDR memory to handle C runtime statck.
Quoted 8 lines
currently
lowlevel_init()must be coded in assembly because it runs before RAM and caches are initialized. This function only exists to do that initialization. MIPS did this from the beginning. Maybe I will send some patches to use locked cache lines, but that should not be a hard requirement for adding new SoC's. Actually all modern MIPS based SoC's have some type of SRAM or first-stage bootloaders, thus adding the cache line lock feature was not really necessary. I would accept the current patch for the initial merge.
I believe the AR9331 has SRAM , at least according to the datasheet I have. We should therefore use it.
[...]
Best regards,
Marek Vasut
PATCH v4 3/8 mips: add base support for atheros ath79 based SOCs
In reply to Daniel SchwierzeckQuoted 15 lines · Daniel Schwierzeck
Quoted 15 lines
Quoted 15 lines
arch/mips/mach-ath79/cpu.c line 31
Quoted 13 lines
arch/mips/mach-ath79/cpu.c new file +13
-0+u32 id, major, minor; +u32 rev =0 ; +u32 ver =1 ; + + id =readl (KSEG1ADDR (AR71XX_RESET_BASE +AR71XX_RESET_REG_REV_ID )); + major = id &REV_ID_MAJOR_MASK ; + +switch (major) { +case REV_ID_MAJOR_AR71XX : + minor = id &AR71XX_REV_ID_MINOR_MASK ; + rev = id >>AR71XX_REV_ID_REVISION_SHIFT ; + rev &=AR71XX_REV_ID_REVISION_MASK ; +switch (minor) {I did review this already and my suggestions were ignored :-( I stop here ...
Quoted 7 lines
Quoted 3 lines
Sorry, I forget this.
This code inherit from kernel, to change would maintain it much more difficult.I agree with Marek that a lookup table would be better. But why do you want to add all possible QCA based SoC's? Until there is no supported board for other SoC's than yours, this would be dead code.
The shift bits of minor and revision is different for same chips, same chips should ignore the minor bits, the lookup table must store these shift information and which was ignored in common, so the table will become more complex if this code want to be compatible with many other SOCs. If people want to add other QCA's SoC, need spend a great deal of time to debug this code.
Signature · 2 lines
Best Regards Wills
PATCH v4 4/8 mips: ath79: add serial driver for ar933x SOC
In reply to a message not in the archive---
Changes in v4: None
Changes in v3: None
Changes in v2: None
drivers/serial/Makefile | 1 + drivers/serial/serial_ar933x.c | 225 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 226 insertions(+) create mode 100644 drivers/serial/serial_ar933x.c
drivers/serial/Makefile +1 -0
@@ -17,6 +17,7 @@ endif obj-$(CONFIG_ALTERA_UART) += altera_uart.o obj-$(CONFIG_ALTERA_JTAG_UART) += altera_jtag_uart.o +obj-$(CONFIG_AR933X_SERIAL) += serial_ar933x.o obj-$(CONFIG_ARM_DCC) += arm_dcc.o obj-$(CONFIG_ATMEL_USART) += atmel_usart.o obj-$(CONFIG_EFI_APP) += serial_efi.o
drivers/serial/serial_ar933x.c new file +225 -0
225 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v4 4/8 mips: ath79: add serial driver for ar933x SOC
Am 25.12.2015 um 19:56 schrieb Wills Wang:
Quoted 34 lines
Signed-off-by Wills Wang <[email protected]>---
Changes in v4: None
Changes in v3: None
Changes in v2: Nonedrivers/serial/Makefile | 1 + drivers/serial/serial_ar933x.c | 225 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 226 insertions(+) create mode 100644 drivers/serial/serial_ar933x.cdrivers/serial/Makefile +1
-0@@ -17,6 +17,7 @@ endif obj-$(CONFIG_ALTERA_UART) += altera_uart.o obj-$(CONFIG_ALTERA_JTAG_UART) += altera_jtag_uart.o +obj-$(CONFIG_AR933X_SERIAL) += serial_ar933x.o obj-$(CONFIG_ARM_DCC) += arm_dcc.o obj-$(CONFIG_ATMEL_USART) += atmel_usart.o obj-$(CONFIG_EFI_APP) += serial_efi.odrivers/serial/serial_ar933x.c new file +4
-0@@ -0,0 +1,225 @@ +/* +* (C) Copyright 2015 +* Wills Wang, <[email protected]> +*
drivers/serial/serial_ar933x.c line 14
Quoted 10 lines
drivers/serial/serial_ar933x.c new file +10
-0+* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <dm.h> +#include <errno.h> +#include <serial.h> +#include <asm/io.h> +#include <asm/addrspace.h> +#include <asm/div64.h>
use the existing and generic implementation in include/div64.h
drivers/serial/serial_ar933x.c line 16
Quoted 2 lines
drivers/serial/serial_ar933x.c new file +2
-0+#include <asm/types.h> +#include <asm/arch/ar71xx_regs.h>
#include <mach/ar71xx_regs.h>
I wonder how you can stil compile your code
Quoted 14 lines
drivers/serial/serial_ar933x.c new file +14
-0+ +DECLARE_GLOBAL_DATA_PTR ; + +#define AR933X_UART_DATA_REG 0x00 +#define AR933X_UART_CS_REG 0x04 +#define AR933X_UART_CLK_REG 0x08 + +#define AR933X_UART_DATA_TX_RX_MASK 0xff +#define AR933X_UART_DATA_RX_CSR BIT(8) +#define AR933X_UART_DATA_TX_CSR BIT(9) +#define AR933X_UART_CS_IF_MODE_S 2 +#define AR933X_UART_CS_IF_MODE_M 0x3 +#define AR933X_UART_CS_IF_MODE_DTE 1 +#define AR933X_UART_CS_IF_MODE_DCE 2
drivers/serial/serial_ar933x.c line 40
Quoted 10 lines
drivers/serial/serial_ar933x.c new file +10
-0+#define AR933X_UART_CS_TX_RDY_ORIDE BIT(7) +#define AR933X_UART_CS_RX_RDY_ORIDE BIT(8) +#define AR933X_UART_CLK_STEP_M 0xffff +#define AR933X_UART_CLK_SCALE_M 0xfff +#define AR933X_UART_CLK_SCALE_S 16 +#define AR933X_UART_CLK_STEP_S 0 + +struct ar933x_serial_platdata { +void __iomem *regs; +};
if you always support device-tree, you do not need platform data
Quoted 78 lines
drivers/serial/serial_ar933x.c new file +78
-0+ +struct ar933x_serial_priv { +void __iomem *regs; +}; + +static inline u32 ar933x_serial_read (struct udevice *dev,u32 offset) +{ +struct ar933x_serial_priv *priv =dev_get_priv (dev); +return readl (priv->regs + offset); +} + +static inline void ar933x_serial_write (struct udevice *dev, +u32 val,u32 offset) +{ +struct ar933x_serial_priv *priv =dev_get_priv (dev); +writel (val, priv->regs + offset); +} + +/* +* baudrate = (clk / (scale + 1)) * (step * (1 / 2^17)) +*/ +static u32 ar933x_serial_get_baud (u32 clk,u32 scale,u32 step) +{ +u64 t; +u32 div; + + div = (2 <<16 ) * (scale +1 ); + t = clk; + t *= step; + t += (div /2 ); +do_div (t, div); + +return t; +} + +static void ar933x_serial_get_scale_step (u32 clk,u32 baud, +u32 *scale,u32 *step) +{ +u32 tscale, baudrate; +long min_diff; + + *scale =0 ; + *step =0 ; + + min_diff = baud; +for (tscale =0 ; tscale <AR933X_UART_CLK_SCALE_M ; tscale++) { +u64 tstep; +int diff; + + tstep = baud * (tscale +1 ); + tstep *= (2 <<16 ); +do_div (tstep, clk); + +if (tstep >AR933X_UART_CLK_STEP_M ) +break ; + + baudrate =ar933x_serial_get_baud (clk, tscale, tstep); + diff =abs (baudrate - baud); +if (diff < min_diff) { + min_diff = diff; + *scale = tscale; + *step = tstep; + } + } +} + +static int ar933x_serial_setbrg (struct udevice *dev,int baudrate) +{ +u32 val, scale, step; + + val =get_serial_clock (); +ar933x_serial_get_scale_step (val, baudrate, &scale, &step); + + val = (scale &AR933X_UART_CLK_SCALE_M ) + <<AR933X_UART_CLK_SCALE_S ; + val |= (step &AR933X_UART_CLK_STEP_M ) + <<AR933X_UART_CLK_STEP_S ; +ar933x_serial_write (dev, val,AR933X_UART_CLK_REG );
drivers/serial/serial_ar933x.c line 128
Quoted 10 lines
drivers/serial/serial_ar933x.c new file +10
-0+ +return 0 ; +} + +static int ar933x_serial_putc (struct udevice *dev,const char c) +{ +u32 data; + +if (c =='\n' ) +ar933x_serial_putc (dev,'\r' );
remove this, the serial core driver takes care of it
drivers/serial/serial_ar933x.c line 132
Quoted 4 lines
drivers/serial/serial_ar933x.c new file +4
-0+ +do { + data =ar933x_serial_read (dev,AR933X_UART_DATA_REG ); + }while (!(data &AR933X_UART_DATA_TX_CSR ));
remove this, the serial core driver takes care of it via your pending callback (ar933x_serial_pending)
Quoted 4 lines
drivers/serial/serial_ar933x.c new file +4
-0+ + data = (u32 )c |AR933X_UART_DATA_TX_CSR ; +ar933x_serial_write (dev, data,AR933X_UART_DATA_REG ); +
drivers/serial/serial_ar933x.c line 146
Quoted 10 lines
drivers/serial/serial_ar933x.c new file +10
-0+return 0 ; +} + +static int ar933x_serial_getc (struct udevice *dev) +{ +u32 data; + +do { + data =ar933x_serial_read (dev,AR933X_UART_DATA_REG ); + }while (!(data &AR933X_UART_DATA_RX_CSR ));
dito
Quoted 43 lines
drivers/serial/serial_ar933x.c new file +43
-0+ + data =ar933x_serial_read (dev,AR933X_UART_DATA_REG ); +ar933x_serial_write (dev,AR933X_UART_DATA_RX_CSR , +AR933X_UART_DATA_REG ); +return data &AR933X_UART_DATA_TX_RX_MASK ; +} + +static int ar933x_serial_pending (struct udevice *dev,bool input) +{ +u32 data; + + data =ar933x_serial_read (dev,AR933X_UART_DATA_REG ); +if (input) +return (data &AR933X_UART_DATA_RX_CSR ) ?1 :0 ; +else +return (data &AR933X_UART_DATA_TX_CSR ) ?0 :1 ; +} + +static int ar933x_serial_probe (struct udevice *dev) +{ +struct ar933x_serial_priv *priv =dev_get_priv (dev); +struct ar933x_serial_platdata *plat =dev_get_platdata (dev); +u32 val; + + priv->regs = plat->regs; + +/* +* UART controller configuration: +* - no DMA +* - no interrupt +* - DCE mode +* - no flow control +* - set RX ready oride +* - set TX ready oride +*/ + val = (AR933X_UART_CS_IF_MODE_DCE <<AR933X_UART_CS_IF_MODE_S ) | +AR933X_UART_CS_TX_RDY_ORIDE |AR933X_UART_CS_RX_RDY_ORIDE ; +ar933x_serial_write (dev, val,AR933X_UART_CS_REG ); +return 0 ; +} + +static int ar933x_serial_ofdata_to_platdata (struct udevice *dev) +{
drivers/serial/serial_ar933x.c line 199
Quoted 10 lines
drivers/serial/serial_ar933x.c new file +10
-0+struct ar933x_serial_platdata *plat =dev_get_platdata (dev); +fdt_addr_t addr; + + addr =dev_get_addr (dev); +if (addr ==FDT_ADDR_T_NONE ) +return -EINVAL ; + + plat->regs =map_physmem (addr, +AR933X_UART_SIZE , +MAP_NOCACHE );
move this code to function ar933x_serial_probe and drop this function
Quoted 11 lines
drivers/serial/serial_ar933x.c new file +11
-0+return 0 ; +} + +static const struct dm_serial_ops ar933x_serial_ops = { + .putc = ar933x_serial_putc, + .pending = ar933x_serial_pending, + .getc = ar933x_serial_getc, + .setbrg = ar933x_serial_setbrg, +}; + +static const struct udevice_id ar933x_serial_ids[] = {
drivers/serial/serial_ar933x.c line 220
Quoted 10 lines
drivers/serial/serial_ar933x.c new file +10
-0+ { .compatible = "ath79,ar933x-uart" }, + { } +}; + +U_BOOT_DRIVER (serial_ar933x) = { + .name ="serial_ar933x" , + .id =UCLASS_SERIAL , + .of_match = ar933x_serial_ids, + .ofdata_to_platdata = ar933x_serial_ofdata_to_platdata, + .platdata_auto_alloc_size =sizeof (struct ar933x_serial_platdata ),
drop the two lines, you do not need to allocate platdata
Quoted 6 lines
drivers/serial/serial_ar933x.c new file +5
-0+ .priv_auto_alloc_size = sizeof(struct ar933x_serial_priv), + .probe = ar933x_serial_probe, + .ops = &ar933x_serial_ops, + .flags = DM_FLAG_PRE_RELOC, +};
Signature · 1 line
- Daniel
PATCH v4 4/8 mips: ath79: add serial driver for ar933x SOC
Quoted 39 lines · Daniel Schwierzeck
Am 25.12.2015 um 19:56 schrieb Wills Wang:
Quoted 37 lines
Signed-off-by Wills Wang <[email protected]>---
Changes in v4: None
Changes in v3: None
Changes in v2: Nonedrivers/serial/Makefile | 1 + drivers/serial/serial_ar933x.c | 225 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 226 insertions(+)create mode 100644
drivers/serial/serial_ar933x.cdrivers/serial/Makefile +1
-0@@ -17,6 +17,7 @@ endif obj-$(CONFIG_ALTERA_UART) += altera_uart.o obj-$(CONFIG_ALTERA_JTAG_UART) += altera_jtag_uart.o +obj-$(CONFIG_AR933X_SERIAL) += serial_ar933x.o obj-$(CONFIG_ARM_DCC) += arm_dcc.o obj-$(CONFIG_ATMEL_USART) += atmel_usart.o obj-$(CONFIG_EFI_APP) += serial_efi.odrivers/serial/serial_ar933x.c new file +7
-0@@ -0,0 +1,225 @@ +/* +* (C) Copyright 2015 +* Wills Wang, <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ +
Quoted 8 lines
drivers/serial/serial_ar933x.c line 14
Quoted 7 lines
drivers/serial/serial_ar933x.c new file +7
-0+#include <common.h> +#include <dm.h> +#include <errno.h> +#include <serial.h> +#include <asm/io.h> +#include <asm/addrspace.h> +#include <asm/div64.h> use the existing and generic implementation in
include/div64.h
Ok.
Quoted 5 lines
drivers/serial/serial_ar933x.c line 16
Quoted 2 lines
drivers/serial/serial_ar933x.c new file +2
-0+#include <asm/types.h> +#include <asm/arch/ar71xx_regs.h> #include <
mach/ar71xx_regs.h>I wonder how you can stil compile your code
U-boot create symbolic links from arch/mips/mach-ath79/include/mach to arch/mips/include/asm/arch.
Quoted 19 lines
Quoted 19 lines
drivers/serial/serial_ar933x.c new file +17
-0+ +DECLARE_GLOBAL_DATA_PTR ; + +#define AR933X_UART_DATA_REG 0x00 +#define AR933X_UART_CS_REG 0x04 +#define AR933X_UART_CLK_REG 0x08 + +#define AR933X_UART_DATA_TX_RX_MASK 0xff +#define AR933X_UART_DATA_RX_CSR BIT(8) +#define AR933X_UART_DATA_TX_CSR BIT(9) +#define AR933X_UART_CS_IF_MODE_S 2 +#define AR933X_UART_CS_IF_MODE_M 0x3 +#define AR933X_UART_CS_IF_MODE_DTE 1 +#define AR933X_UART_CS_IF_MODE_DCE 2 +#define AR933X_UART_CS_TX_RDY_ORIDE BIT(7) +#define AR933X_UART_CS_RX_RDY_ORIDE BIT(8) +#define AR933X_UART_CLK_STEP_M 0xffff
Quoted 8 lines
drivers/serial/serial_ar933x.c line 40
Quoted 7 lines
drivers/serial/serial_ar933x.c new file +7
-0+#define AR933X_UART_CLK_SCALE_M 0xfff +#define AR933X_UART_CLK_SCALE_S 16 +#define AR933X_UART_CLK_STEP_S 0 + +struct ar933x_serial_platdata { +void __iomem *regs; +};if you always support device-tree, you do not need platform data
Ok.
Quoted 81 lines
Quoted 81 lines
drivers/serial/serial_ar933x.c new file +81
-0+ +struct ar933x_serial_priv { +void __iomem *regs; +}; + +static inline u32 ar933x_serial_read (struct udevice *dev,u32 offset) +{ +struct ar933x_serial_priv *priv =dev_get_priv (dev); +return readl (priv->regs + offset); +} + +static inline void ar933x_serial_write (struct udevice *dev, +u32 val,u32 offset) +{ +struct ar933x_serial_priv *priv =dev_get_priv (dev); +writel (val, priv->regs + offset); +} + +/* +* baudrate = (clk / (scale + 1)) * (step * (1 / 2^17)) +*/ +static u32 ar933x_serial_get_baud (u32 clk,u32 scale,u32 step) +{ +u64 t; +u32 div; + + div = (2 <<16 ) * (scale +1 ); + t = clk; + t *= step; + t += (div /2 ); +do_div (t, div); + +return t; +} + +static void ar933x_serial_get_scale_step (u32 clk,u32 baud, +u32 *scale,u32 *step) +{ +u32 tscale, baudrate; +long min_diff; + + *scale =0 ; + *step =0 ; + + min_diff = baud; +for (tscale =0 ; tscale <AR933X_UART_CLK_SCALE_M ; tscale++) { +u64 tstep; +int diff; + + tstep = baud * (tscale +1 ); + tstep *= (2 <<16 ); +do_div (tstep, clk); + +if (tstep >AR933X_UART_CLK_STEP_M ) +break ; + + baudrate =ar933x_serial_get_baud (clk, tscale, tstep); + diff =abs (baudrate - baud); +if (diff < min_diff) { + min_diff = diff; + *scale = tscale; + *step = tstep; + } + } +} + +static int ar933x_serial_setbrg (struct udevice *dev,int baudrate) +{ +u32 val, scale, step; + + val =get_serial_clock (); +ar933x_serial_get_scale_step (val, baudrate, &scale, &step); + + val = (scale &AR933X_UART_CLK_SCALE_M ) + <<AR933X_UART_CLK_SCALE_S ; + val |= (step &AR933X_UART_CLK_STEP_M ) + <<AR933X_UART_CLK_STEP_S ; +ar933x_serial_write (dev, val,AR933X_UART_CLK_REG ); + +return 0 ; +}
Quoted 8 lines
drivers/serial/serial_ar933x.c line 128
Quoted 7 lines
drivers/serial/serial_ar933x.c new file +7
-0+ +static int ar933x_serial_putc (struct udevice *dev,const char c) +{ +u32 data; + +if (c =='\n' ) +ar933x_serial_putc (dev,'\r' );remove this, the serial core driver takes care of it
Ok.
Quoted 6 lines
drivers/serial/serial_ar933x.c line 132
Quoted 4 lines
drivers/serial/serial_ar933x.c new file +4
-0+ +do { + data =ar933x_serial_read (dev,AR933X_UART_DATA_REG ); + }while (!(data &AR933X_UART_DATA_TX_CSR ));remove this, the serial core driver takes care of it via your pending callback (
ar933x_serial_pending)
Ok.
Quoted 7 lines
Quoted 7 lines
drivers/serial/serial_ar933x.c new file +7
-0+ + data = (u32 )c |AR933X_UART_DATA_TX_CSR ; +ar933x_serial_write (dev, data,AR933X_UART_DATA_REG ); + +return 0 ; +} +
Quoted 8 lines
drivers/serial/serial_ar933x.c line 146
Quoted 7 lines
drivers/serial/serial_ar933x.c new file +7
-0+static int ar933x_serial_getc (struct udevice *dev) +{ +u32 data; + +do { + data =ar933x_serial_read (dev,AR933X_UART_DATA_REG ); + }while (!(data &AR933X_UART_DATA_RX_CSR ));dito
Ok.
Quoted 46 lines
Quoted 46 lines
drivers/serial/serial_ar933x.c new file +46
-0+ + data =ar933x_serial_read (dev,AR933X_UART_DATA_REG ); +ar933x_serial_write (dev,AR933X_UART_DATA_RX_CSR , +AR933X_UART_DATA_REG ); +return data &AR933X_UART_DATA_TX_RX_MASK ; +} + +static int ar933x_serial_pending (struct udevice *dev,bool input) +{ +u32 data; + + data =ar933x_serial_read (dev,AR933X_UART_DATA_REG ); +if (input) +return (data &AR933X_UART_DATA_RX_CSR ) ?1 :0 ; +else +return (data &AR933X_UART_DATA_TX_CSR ) ?0 :1 ; +} + +static int ar933x_serial_probe (struct udevice *dev) +{ +struct ar933x_serial_priv *priv =dev_get_priv (dev); +struct ar933x_serial_platdata *plat =dev_get_platdata (dev); +u32 val; + + priv->regs = plat->regs; + +/* +* UART controller configuration: +* - no DMA +* - no interrupt +* - DCE mode +* - no flow control +* - set RX ready oride +* - set TX ready oride +*/ + val = (AR933X_UART_CS_IF_MODE_DCE <<AR933X_UART_CS_IF_MODE_S ) | +AR933X_UART_CS_TX_RDY_ORIDE |AR933X_UART_CS_RX_RDY_ORIDE ; +ar933x_serial_write (dev, val,AR933X_UART_CS_REG ); +return 0 ; +} + +static int ar933x_serial_ofdata_to_platdata (struct udevice *dev) +{ +struct ar933x_serial_platdata *plat =dev_get_platdata (dev); +fdt_addr_t addr; +
Quoted 8 lines
drivers/serial/serial_ar933x.c line 199
Quoted 7 lines
drivers/serial/serial_ar933x.c new file +7
-0+ addr =dev_get_addr (dev); +if (addr ==FDT_ADDR_T_NONE ) +return -EINVAL ; + + plat->regs =map_physmem (addr, +AR933X_UART_SIZE , +MAP_NOCACHE );move this code to function
ar933x_serial_probeand drop this function
Ok.
Quoted 14 lines
Quoted 14 lines
drivers/serial/serial_ar933x.c new file +14
-0+return 0 ; +} + +static const struct dm_serial_ops ar933x_serial_ops = { + .putc = ar933x_serial_putc, + .pending = ar933x_serial_pending, + .getc = ar933x_serial_getc, + .setbrg = ar933x_serial_setbrg, +}; + +static const struct udevice_id ar933x_serial_ids[] = { + { .compatible ="ath79,ar933x-uart" }, + { } +};
Quoted 9 lines
drivers/serial/serial_ar933x.c line 220
Quoted 7 lines
drivers/serial/serial_ar933x.c new file +7
-0+ +U_BOOT_DRIVER (serial_ar933x) = { + .name ="serial_ar933x" , + .id =UCLASS_SERIAL , + .of_match = ar933x_serial_ids, + .ofdata_to_platdata = ar933x_serial_ofdata_to_platdata, + .platdata_auto_alloc_size =sizeof (struct ar933x_serial_platdata ),drop the two lines, you do not need to allocate platdata
Ok.
Quoted 6 lines
Quoted 6 lines
drivers/serial/serial_ar933x.c new file +5
-0+ .priv_auto_alloc_size = sizeof(struct ar933x_serial_priv), + .probe = ar933x_serial_probe, + .ops = &ar933x_serial_ops, + .flags = DM_FLAG_PRE_RELOC, +};
PATCH v4 4/8 mips: ath79: add serial driver for ar933x SOC
Am 26.12.2015 um 17:54 schrieb Wills Wang:
Quoted 51 lines · Daniel Schwierzeck
Quoted 40 lines
Am 25.12.2015 um 19:56 schrieb Wills Wang:
Quoted 38 lines
Signed-off-by Wills Wang <[email protected]>---
Changes in v4: None
Changes in v3: None
Changes in v2: Nonedrivers/serial/Makefile | 1 + drivers/serial/serial_ar933x.c | 225 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 226 insertions(+)create mode 100644
drivers/serial/serial_ar933x.cdrivers/serial/Makefile +1
-0@@ -17,6 +17,7 @@ endif obj-$(CONFIG_ALTERA_UART) += altera_uart.o obj-$(CONFIG_ALTERA_JTAG_UART) += altera_jtag_uart.o +obj-$(CONFIG_AR933X_SERIAL) += serial_ar933x.o obj-$(CONFIG_ARM_DCC) += arm_dcc.o obj-$(CONFIG_ATMEL_USART) += atmel_usart.o obj-$(CONFIG_EFI_APP) += serial_efi.odrivers/serial/serial_ar933x.c new file +7
-0@@ -0,0 +1,225 @@ +/* +* (C) Copyright 2015 +* Wills Wang, <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ +Quoted 8 lines
drivers/serial/serial_ar933x.c line 14
Quoted 7 lines
drivers/serial/serial_ar933x.c new file +7
-0+#include <common.h> +#include <dm.h> +#include <errno.h> +#include <serial.h> +#include <asm/io.h> +#include <asm/addrspace.h> +#include <asm/div64.h> use the existing and generic implementation in
include/div64.h
Quoted 8 lines
Ok.
Quoted 5 lines
drivers/serial/serial_ar933x.c line 16
Quoted 2 lines
drivers/serial/serial_ar933x.c new file +2
-0+#include <asm/types.h> +#include <asm/arch/ar71xx_regs.h> #include <
mach/ar71xx_regs.h>I wonder how you can stil compile your code
U-boot create symbolic links from
arch/mips/mach-ath79/include/machtoarch/mips/include/asm/arch.
but it should not. Only if you enable CREATE_ARCH_SYMLINK. Maybe this is some magic for backward compatibility. Anyway the long-term goal is to remove the creation of symbolic links and to use "#include <mach/file.h>".
Quoted 227 lines
Quoted 19 lines
Quoted 19 lines
drivers/serial/serial_ar933x.c new file +17
-0+ +DECLARE_GLOBAL_DATA_PTR ; + +#define AR933X_UART_DATA_REG 0x00 +#define AR933X_UART_CS_REG 0x04 +#define AR933X_UART_CLK_REG 0x08 + +#define AR933X_UART_DATA_TX_RX_MASK 0xff +#define AR933X_UART_DATA_RX_CSR BIT(8) +#define AR933X_UART_DATA_TX_CSR BIT(9) +#define AR933X_UART_CS_IF_MODE_S 2 +#define AR933X_UART_CS_IF_MODE_M 0x3 +#define AR933X_UART_CS_IF_MODE_DTE 1 +#define AR933X_UART_CS_IF_MODE_DCE 2 +#define AR933X_UART_CS_TX_RDY_ORIDE BIT(7) +#define AR933X_UART_CS_RX_RDY_ORIDE BIT(8) +#define AR933X_UART_CLK_STEP_M 0xffffQuoted 8 lines
drivers/serial/serial_ar933x.c line 40
Quoted 7 lines
drivers/serial/serial_ar933x.c new file +7
-0+#define AR933X_UART_CLK_SCALE_M 0xfff +#define AR933X_UART_CLK_SCALE_S 16 +#define AR933X_UART_CLK_STEP_S 0 + +struct ar933x_serial_platdata { +void __iomem *regs; +};if you always support device-tree, you do not need platform data
Ok.
Quoted 81 lines
Quoted 81 lines
drivers/serial/serial_ar933x.c new file +81
-0+ +struct ar933x_serial_priv { +void __iomem *regs; +}; + +static inline u32 ar933x_serial_read (struct udevice *dev,u32 offset) +{ +struct ar933x_serial_priv *priv =dev_get_priv (dev); +return readl (priv->regs + offset); +} + +static inline void ar933x_serial_write (struct udevice *dev, +u32 val,u32 offset) +{ +struct ar933x_serial_priv *priv =dev_get_priv (dev); +writel (val, priv->regs + offset); +} + +/* +* baudrate = (clk / (scale + 1)) * (step * (1 / 2^17)) +*/ +static u32 ar933x_serial_get_baud (u32 clk,u32 scale,u32 step) +{ +u64 t; +u32 div; + + div = (2 <<16 ) * (scale +1 ); + t = clk; + t *= step; + t += (div /2 ); +do_div (t, div); + +return t; +} + +static void ar933x_serial_get_scale_step (u32 clk,u32 baud, +u32 *scale,u32 *step) +{ +u32 tscale, baudrate; +long min_diff; + + *scale =0 ; + *step =0 ; + + min_diff = baud; +for (tscale =0 ; tscale <AR933X_UART_CLK_SCALE_M ; tscale++) { +u64 tstep; +int diff; + + tstep = baud * (tscale +1 ); + tstep *= (2 <<16 ); +do_div (tstep, clk); + +if (tstep >AR933X_UART_CLK_STEP_M ) +break ; + + baudrate =ar933x_serial_get_baud (clk, tscale, tstep); + diff =abs (baudrate - baud); +if (diff < min_diff) { + min_diff = diff; + *scale = tscale; + *step = tstep; + } + } +} + +static int ar933x_serial_setbrg (struct udevice *dev,int baudrate) +{ +u32 val, scale, step; + + val =get_serial_clock (); +ar933x_serial_get_scale_step (val, baudrate, &scale, &step); + + val = (scale &AR933X_UART_CLK_SCALE_M ) + <<AR933X_UART_CLK_SCALE_S ; + val |= (step &AR933X_UART_CLK_STEP_M ) + <<AR933X_UART_CLK_STEP_S ; +ar933x_serial_write (dev, val,AR933X_UART_CLK_REG ); + +return 0 ; +}Quoted 8 lines
drivers/serial/serial_ar933x.c line 128
Quoted 7 lines
drivers/serial/serial_ar933x.c new file +7
-0+ +static int ar933x_serial_putc (struct udevice *dev,const char c) +{ +u32 data; + +if (c =='\n' ) +ar933x_serial_putc (dev,'\r' );remove this, the serial core driver takes care of it
Ok.
Quoted 6 lines
drivers/serial/serial_ar933x.c line 132
Quoted 4 lines
drivers/serial/serial_ar933x.c new file +4
-0+ +do { + data =ar933x_serial_read (dev,AR933X_UART_DATA_REG ); + }while (!(data &AR933X_UART_DATA_TX_CSR ));remove this, the serial core driver takes care of it via your pending callback (
ar933x_serial_pending)Ok.
Quoted 7 lines
Quoted 7 lines
drivers/serial/serial_ar933x.c new file +7
-0+ + data = (u32 )c |AR933X_UART_DATA_TX_CSR ; +ar933x_serial_write (dev, data,AR933X_UART_DATA_REG ); + +return 0 ; +} +Quoted 8 lines
drivers/serial/serial_ar933x.c line 146
Quoted 7 lines
drivers/serial/serial_ar933x.c new file +7
-0+static int ar933x_serial_getc (struct udevice *dev) +{ +u32 data; + +do { + data =ar933x_serial_read (dev,AR933X_UART_DATA_REG ); + }while (!(data &AR933X_UART_DATA_RX_CSR ));dito
Ok.
Quoted 46 lines
Quoted 46 lines
drivers/serial/serial_ar933x.c new file +46
-0+ + data =ar933x_serial_read (dev,AR933X_UART_DATA_REG ); +ar933x_serial_write (dev,AR933X_UART_DATA_RX_CSR , +AR933X_UART_DATA_REG ); +return data &AR933X_UART_DATA_TX_RX_MASK ; +} + +static int ar933x_serial_pending (struct udevice *dev,bool input) +{ +u32 data; + + data =ar933x_serial_read (dev,AR933X_UART_DATA_REG ); +if (input) +return (data &AR933X_UART_DATA_RX_CSR ) ?1 :0 ; +else +return (data &AR933X_UART_DATA_TX_CSR ) ?0 :1 ; +} + +static int ar933x_serial_probe (struct udevice *dev) +{ +struct ar933x_serial_priv *priv =dev_get_priv (dev); +struct ar933x_serial_platdata *plat =dev_get_platdata (dev); +u32 val; + + priv->regs = plat->regs; + +/* +* UART controller configuration: +* - no DMA +* - no interrupt +* - DCE mode +* - no flow control +* - set RX ready oride +* - set TX ready oride +*/ + val = (AR933X_UART_CS_IF_MODE_DCE <<AR933X_UART_CS_IF_MODE_S ) | +AR933X_UART_CS_TX_RDY_ORIDE |AR933X_UART_CS_RX_RDY_ORIDE ; +ar933x_serial_write (dev, val,AR933X_UART_CS_REG ); +return 0 ; +} + +static int ar933x_serial_ofdata_to_platdata (struct udevice *dev) +{ +struct ar933x_serial_platdata *plat =dev_get_platdata (dev); +fdt_addr_t addr; +Quoted 8 lines
drivers/serial/serial_ar933x.c line 199
Quoted 7 lines
drivers/serial/serial_ar933x.c new file +7
-0+ addr =dev_get_addr (dev); +if (addr ==FDT_ADDR_T_NONE ) +return -EINVAL ; + + plat->regs =map_physmem (addr, +AR933X_UART_SIZE , +MAP_NOCACHE );move this code to function
ar933x_serial_probeand drop this functionOk.
Quoted 14 lines
Quoted 14 lines
drivers/serial/serial_ar933x.c new file +14
-0+return 0 ; +} + +static const struct dm_serial_ops ar933x_serial_ops = { + .putc = ar933x_serial_putc, + .pending = ar933x_serial_pending, + .getc = ar933x_serial_getc, + .setbrg = ar933x_serial_setbrg, +}; + +static const struct udevice_id ar933x_serial_ids[] = { + { .compatible ="ath79,ar933x-uart" }, + { } +};Quoted 9 lines
drivers/serial/serial_ar933x.c line 220
Quoted 7 lines
drivers/serial/serial_ar933x.c new file +7
-0+ +U_BOOT_DRIVER (serial_ar933x) = { + .name ="serial_ar933x" , + .id =UCLASS_SERIAL , + .of_match = ar933x_serial_ids, + .ofdata_to_platdata = ar933x_serial_ofdata_to_platdata, + .platdata_auto_alloc_size =sizeof (struct ar933x_serial_platdata ),drop the two lines, you do not need to allocate platdata
Ok.
Quoted 6 lines
Quoted 6 lines
drivers/serial/serial_ar933x.c new file +5
-0+ .priv_auto_alloc_size = sizeof(struct ar933x_serial_priv), + .probe = ar933x_serial_probe, + .ops = &ar933x_serial_ops, + .flags = DM_FLAG_PRE_RELOC, +};
Signature · 1 line
- Daniel
PATCH v4 4/8 mips: ath79: add serial driver for ar933x SOC
In reply to Daniel SchwierzeckQuoted 171 lines · Daniel Schwierzeck
Am 25.12.2015 um 19:56 schrieb Wills Wang:
Quoted 34 lines
Signed-off-by Wills Wang <[email protected]>---
Changes in v4: None
Changes in v3: None
Changes in v2: Nonedrivers/serial/Makefile | 1 + drivers/serial/serial_ar933x.c | 225 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 226 insertions(+)create mode 100644
drivers/serial/serial_ar933x.cdrivers/serial/Makefile +1
-0@@ -17,6 +17,7 @@ endif obj-$(CONFIG_ALTERA_UART) += altera_uart.o obj-$(CONFIG_ALTERA_JTAG_UART) += altera_jtag_uart.o +obj-$(CONFIG_AR933X_SERIAL) += serial_ar933x.o obj-$(CONFIG_ARM_DCC) += arm_dcc.o obj-$(CONFIG_ATMEL_USART) += atmel_usart.o obj-$(CONFIG_EFI_APP) += serial_efi.odrivers/serial/serial_ar933x.c new file +4
-0@@ -0,0 +1,225 @@ +/* +* (C) Copyright 2015 +* Wills Wang, <[email protected]> +* drivers/serial/serial_ar933x.c line 14
Quoted 10 lines
drivers/serial/serial_ar933x.c new file +10
-0+* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <dm.h> +#include <errno.h> +#include <serial.h> +#include <asm/io.h> +#include <asm/addrspace.h> +#include <asm/div64.h> use the existing and generic implementation in
include/div64.hdrivers/serial/serial_ar933x.c line 16
Quoted 2 lines
drivers/serial/serial_ar933x.c new file +2
-0+#include <asm/types.h> +#include <asm/arch/ar71xx_regs.h> #include <
mach/ar71xx_regs.h>I wonder how you can stil compile your code
Quoted 14 lines
drivers/serial/serial_ar933x.c new file +14
-0+ +DECLARE_GLOBAL_DATA_PTR ; + +#define AR933X_UART_DATA_REG 0x00 +#define AR933X_UART_CS_REG 0x04 +#define AR933X_UART_CLK_REG 0x08 + +#define AR933X_UART_DATA_TX_RX_MASK 0xff +#define AR933X_UART_DATA_RX_CSR BIT(8) +#define AR933X_UART_DATA_TX_CSR BIT(9) +#define AR933X_UART_CS_IF_MODE_S 2 +#define AR933X_UART_CS_IF_MODE_M 0x3 +#define AR933X_UART_CS_IF_MODE_DTE 1 +#define AR933X_UART_CS_IF_MODE_DCE 2drivers/serial/serial_ar933x.c line 40
Quoted 10 lines
drivers/serial/serial_ar933x.c new file +10
-0+#define AR933X_UART_CS_TX_RDY_ORIDE BIT(7) +#define AR933X_UART_CS_RX_RDY_ORIDE BIT(8) +#define AR933X_UART_CLK_STEP_M 0xffff +#define AR933X_UART_CLK_SCALE_M 0xfff +#define AR933X_UART_CLK_SCALE_S 16 +#define AR933X_UART_CLK_STEP_S 0 + +struct ar933x_serial_platdata { +void __iomem *regs; +};if you always support device-tree, you do not need platform data
Quoted 78 lines
drivers/serial/serial_ar933x.c new file +78
-0+ +struct ar933x_serial_priv { +void __iomem *regs; +}; + +static inline u32 ar933x_serial_read (struct udevice *dev,u32 offset) +{ +struct ar933x_serial_priv *priv =dev_get_priv (dev); +return readl (priv->regs + offset); +} + +static inline void ar933x_serial_write (struct udevice *dev, +u32 val,u32 offset) +{ +struct ar933x_serial_priv *priv =dev_get_priv (dev); +writel (val, priv->regs + offset); +} + +/* +* baudrate = (clk / (scale + 1)) * (step * (1 / 2^17)) +*/ +static u32 ar933x_serial_get_baud (u32 clk,u32 scale,u32 step) +{ +u64 t; +u32 div; + + div = (2 <<16 ) * (scale +1 ); + t = clk; + t *= step; + t += (div /2 ); +do_div (t, div); + +return t; +} + +static void ar933x_serial_get_scale_step (u32 clk,u32 baud, +u32 *scale,u32 *step) +{ +u32 tscale, baudrate; +long min_diff; + + *scale =0 ; + *step =0 ; + + min_diff = baud; +for (tscale =0 ; tscale <AR933X_UART_CLK_SCALE_M ; tscale++) { +u64 tstep; +int diff; + + tstep = baud * (tscale +1 ); + tstep *= (2 <<16 ); +do_div (tstep, clk); + +if (tstep >AR933X_UART_CLK_STEP_M ) +break ; + + baudrate =ar933x_serial_get_baud (clk, tscale, tstep); + diff =abs (baudrate - baud); +if (diff < min_diff) { + min_diff = diff; + *scale = tscale; + *step = tstep; + } + } +} + +static int ar933x_serial_setbrg (struct udevice *dev,int baudrate) +{ +u32 val, scale, step; + + val =get_serial_clock (); +ar933x_serial_get_scale_step (val, baudrate, &scale, &step); + + val = (scale &AR933X_UART_CLK_SCALE_M ) + <<AR933X_UART_CLK_SCALE_S ; + val |= (step &AR933X_UART_CLK_STEP_M ) + <<AR933X_UART_CLK_STEP_S ; +ar933x_serial_write (dev, val,AR933X_UART_CLK_REG );drivers/serial/serial_ar933x.c line 128
Quoted 10 lines
drivers/serial/serial_ar933x.c new file +10
-0+ +return 0 ; +} + +static int ar933x_serial_putc (struct udevice *dev,const char c) +{ +u32 data; + +if (c =='\n' ) +ar933x_serial_putc (dev,'\r' );remove this, the serial core driver takes care of it
Quoted 7 lines
drivers/serial/serial_ar933x.c line 132
Quoted 4 lines
drivers/serial/serial_ar933x.c new file +4
-0+ +do { + data =ar933x_serial_read (dev,AR933X_UART_DATA_REG ); + }while (!(data &AR933X_UART_DATA_TX_CSR ));remove this, the serial core driver takes care of it via your pending callback (
ar933x_serial_pending)
Serial core driver don't query and wait the pending function before "serial_getc" and "serial_putc", so these statements can't remove, or board don't work.
Quoted 7 lines
Quoted 7 lines
drivers/serial/serial_ar933x.c new file +7
-0+ + data = (u32 )c |AR933X_UART_DATA_TX_CSR ; +ar933x_serial_write (dev, data,AR933X_UART_DATA_REG ); + +return 0 ; +} +
Quoted 8 lines
drivers/serial/serial_ar933x.c line 146
Quoted 7 lines
drivers/serial/serial_ar933x.c new file +7
-0+static int ar933x_serial_getc (struct udevice *dev) +{ +u32 data; + +do { + data =ar933x_serial_read (dev,AR933X_UART_DATA_REG ); + }while (!(data &AR933X_UART_DATA_RX_CSR ));dito
ditto
Quoted 85 lines
Quoted 44 lines
drivers/serial/serial_ar933x.c new file +43
-0+ + data =ar933x_serial_read (dev,AR933X_UART_DATA_REG ); +ar933x_serial_write (dev,AR933X_UART_DATA_RX_CSR , +AR933X_UART_DATA_REG ); +return data &AR933X_UART_DATA_TX_RX_MASK ; +} + +static int ar933x_serial_pending (struct udevice *dev,bool input) +{ +u32 data; + + data =ar933x_serial_read (dev,AR933X_UART_DATA_REG ); +if (input) +return (data &AR933X_UART_DATA_RX_CSR ) ?1 :0 ; +else +return (data &AR933X_UART_DATA_TX_CSR ) ?0 :1 ; +} + +static int ar933x_serial_probe (struct udevice *dev) +{ +struct ar933x_serial_priv *priv =dev_get_priv (dev); +struct ar933x_serial_platdata *plat =dev_get_platdata (dev); +u32 val; + + priv->regs = plat->regs; + +/* +* UART controller configuration: +* - no DMA +* - no interrupt +* - DCE mode +* - no flow control +* - set RX ready oride +* - set TX ready oride +*/ + val = (AR933X_UART_CS_IF_MODE_DCE <<AR933X_UART_CS_IF_MODE_S ) | +AR933X_UART_CS_TX_RDY_ORIDE |AR933X_UART_CS_RX_RDY_ORIDE ; +ar933x_serial_write (dev, val,AR933X_UART_CS_REG ); +return 0 ; +} + +static int ar933x_serial_ofdata_to_platdata (struct udevice *dev) +{drivers/serial/serial_ar933x.c line 199
Quoted 10 lines
drivers/serial/serial_ar933x.c new file +10
-0+struct ar933x_serial_platdata *plat =dev_get_platdata (dev); +fdt_addr_t addr; + + addr =dev_get_addr (dev); +if (addr ==FDT_ADDR_T_NONE ) +return -EINVAL ; + + plat->regs =map_physmem (addr, +AR933X_UART_SIZE , +MAP_NOCACHE );move this code to function
ar933x_serial_probeand drop this functionQuoted 11 lines
drivers/serial/serial_ar933x.c new file +11
-0+return 0 ; +} + +static const struct dm_serial_ops ar933x_serial_ops = { + .putc = ar933x_serial_putc, + .pending = ar933x_serial_pending, + .getc = ar933x_serial_getc, + .setbrg = ar933x_serial_setbrg, +}; + +static const struct udevice_id ar933x_serial_ids[] = {drivers/serial/serial_ar933x.c line 220
Quoted 10 lines
drivers/serial/serial_ar933x.c new file +10
-0+ { .compatible = "ath79,ar933x-uart" }, + { } +}; + +U_BOOT_DRIVER (serial_ar933x) = { + .name ="serial_ar933x" , + .id =UCLASS_SERIAL , + .of_match = ar933x_serial_ids, + .ofdata_to_platdata = ar933x_serial_ofdata_to_platdata, + .platdata_auto_alloc_size =sizeof (struct ar933x_serial_platdata ),drop the two lines, you do not need to allocate platdata
Quoted 6 lines
drivers/serial/serial_ar933x.c new file +5
-0+ .priv_auto_alloc_size = sizeof(struct ar933x_serial_priv), + .probe = ar933x_serial_probe, + .ops = &ar933x_serial_ops, + .flags = DM_FLAG_PRE_RELOC, +};
PATCH v4 4/8 mips: ath79: add serial driver for ar933x SOC
Hi Wills,
Quoted 12 lines · Wills Wang
Quoted 12 lines
drivers/serial/serial_ar933x.c line 128
Quoted 6 lines
drivers/serial/serial_ar933x.c new file +6
-0+static int ar933x_serial_putc (struct udevice *dev,const char c) +{ +u32 data; + +if (c =='\n' ) +ar933x_serial_putc (dev,'\r' );remove this, the serial core driver takes care of it
Quoted 4 lines
drivers/serial/serial_ar933x.c new file +4
-0+ +do { + data =ar933x_serial_read (dev,AR933X_UART_DATA_REG ); + }while (!(data &AR933X_UART_DATA_TX_CSR ));
Quoted 7 lines
Quoted 3 lines
remove this, the serial core driver takes care of it via your pending callback (
ar933x_serial_pending)Serial core driver don't query and wait the pending function before "
serial_getc" and "serial_putc", so these statements can't remove, or board don't work.
As I wrote in the v3 patch review, both the getc() and putc() should return -EAGAIN if there is no available data to read or not ready to write. The polling is done in the serial-uclass.c
Regards,
Thomas
PATCH v4 4/8 mips: ath79: add serial driver for ar933x SOC
Hi Wills,
Please note the following,
1. add this uart to drivers/serial/Kconfig .
2. add debug uart support. see include/debug_uart.h . also add it to Kconfig
3. cp linux/Documentation/devicetree/bindings/serial/qca,ar9330-uart.txt u-boot/doc/device-tree-bindings/serial/
4. to save change to xxx_defconfig, run
make savedefconfig
cp defconfig configs/xxx_defconfig
Best regards,
Thomas
PATCH v4 4/8 mips: ath79: add serial driver for ar933x SOC
In reply to Daniel SchwierzeckHi Wills,
Quoted 53 lines · Daniel Schwierzeck
Quoted 25 lines
drivers/serial/serial_ar933x.c new file +25
-0+static int ar933x_serial_probe (struct udevice *dev) +{ +struct ar933x_serial_priv *priv =dev_get_priv (dev); +struct ar933x_serial_platdata *plat =dev_get_platdata (dev); +u32 val; + + priv->regs = plat->regs; + +/* +* UART controller configuration: +* - no DMA +* - no interrupt +* - DCE mode +* - no flow control +* - set RX ready oride +* - set TX ready oride +*/ + val = (AR933X_UART_CS_IF_MODE_DCE <<AR933X_UART_CS_IF_MODE_S ) | +AR933X_UART_CS_TX_RDY_ORIDE |AR933X_UART_CS_RX_RDY_ORIDE ; +ar933x_serial_write (dev, val,AR933X_UART_CS_REG ); +return 0 ; +} + +static int ar933x_serial_ofdata_to_platdata (struct udevice *dev) +{drivers/serial/serial_ar933x.c line 199
Quoted 10 lines
drivers/serial/serial_ar933x.c new file +10
-0+struct ar933x_serial_platdata *plat =dev_get_platdata (dev); +fdt_addr_t addr; + + addr =dev_get_addr (dev); +if (addr ==FDT_ADDR_T_NONE ) +return -EINVAL ; + + plat->regs =map_physmem (addr, +AR933X_UART_SIZE , +MAP_NOCACHE );move this code to function
ar933x_serial_probeand drop this functionQuoted 15 lines
drivers/serial/serial_ar933x.c new file +15
-0+return 0 ; +} + +static const struct dm_serial_ops ar933x_serial_ops = { + .putc = ar933x_serial_putc, + .pending = ar933x_serial_pending, + .getc = ar933x_serial_getc, + .setbrg = ar933x_serial_setbrg, +}; + +static const struct udevice_id ar933x_serial_ids[] = { + { .compatible ="ath79,ar933x-uart" }, + { } +}; +
Quoted 9 lines
drivers/serial/serial_ar933x.c line 220
Quoted 6 lines
drivers/serial/serial_ar933x.c new file +6
-0+U_BOOT_DRIVER (serial_ar933x) = { + .name ="serial_ar933x" , + .id =UCLASS_SERIAL , + .of_match = ar933x_serial_ids, + .ofdata_to_platdata = ar933x_serial_ofdata_to_platdata, + .platdata_auto_alloc_size =sizeof (struct ar933x_serial_platdata ),drop the two lines, you do not need to allocate platdata
It might be another option to keep platdata and ofdata_to_platdata(), and remove the priv data. Let ofdata_to_platdata() do the DT conversion and probe() detect and initialize the hardware. This is what these func expected to do. The priv data is needed only when there is variable data to save per device.
Best regards,
Thomas
PATCH v4 5/8 mips: ath79: add spi driver
In reply to a message not in the archive---
Changes in v4: None
Changes in v3: None
Changes in v2: None
drivers/spi/Kconfig | 8 ++ drivers/spi/Makefile | 1 + drivers/spi/ath79_spi.c | 211 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 220 insertions(+) create mode 100644 drivers/spi/ath79_spi.c
drivers/spi/Kconfig +8 -0
@@ -23,6 +23,14 @@ config ALTERA_SPI IP core. Please find details on the "Embedded Peripherals IP User Guide" of Altera. +config ATH79_SPI + bool "Atheros SPI driver" + help + Enable the Atheros ar7xxx/ar9xxx SoC SPI driver, it was used + to access SPI NOR flash and other SPI peripherals. This driver + uses driver model and requires a device tree binding to + operate. + config CADENCE_QSPI bool "Cadence QSPI driver" help
drivers/spi/Makefile +1 -0
@@ -17,6 +17,7 @@ endif obj-$(CONFIG_ALTERA_SPI) += altera_spi.o obj-$(CONFIG_ARMADA100_SPI) += armada100_spi.o +obj-$(CONFIG_ATH79_SPI) += ath79_spi.o obj-$(CONFIG_ATMEL_DATAFLASH_SPI) += atmel_dataflash_spi.o obj-$(CONFIG_ATMEL_SPI) += atmel_spi.o obj-$(CONFIG_BFIN_SPI) += bfin_spi.o
drivers/spi/ath79_spi.c new file +211 -0
211 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v4 5/8 mips: ath79: add spi driver
Am 25.12.2015 um 19:56 schrieb Wills Wang:
Quoted 55 lines
Signed-off-by Wills Wang <[email protected]>---
Changes in v4: None
Changes in v3: None
Changes in v2: Nonedrivers/spi/Kconfig | 8 ++ drivers/spi/Makefile | 1 + drivers/spi/ath79_spi.c | 211 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 220 insertions(+) create mode 100644 drivers/spi/ath79_spi.cdrivers/spi/Kconfig +8
-0@@ -23,6 +23,14 @@ config ALTERA_SPI IP core. Please find details on the "Embedded Peripherals IP User Guide" of Altera. +config ATH79_SPI + bool "Atheros SPI driver" + help + Enable the Atheros ar7xxx/ar9xxx SoC SPI driver, it was used + to access SPI NOR flash and other SPI peripherals. This driver + uses driver model and requires a device tree binding to + operate. + config CADENCE_QSPI bool "Cadence QSPI driver" helpdrivers/spi/Makefile +1
-0@@ -17,6 +17,7 @@ endif obj-$(CONFIG_ALTERA_SPI) += altera_spi.o obj-$(CONFIG_ARMADA100_SPI) += armada100_spi.o +obj-$(CONFIG_ATH79_SPI) += ath79_spi.o obj-$(CONFIG_ATMEL_DATAFLASH_SPI) += atmel_dataflash_spi.o obj-$(CONFIG_ATMEL_SPI) += atmel_spi.o obj-$(CONFIG_BFIN_SPI) += bfin_spi.odrivers/spi/ath79_spi.c new file +5
-0@@ -0,0 +1,211 @@ +/* +* (C) Copyright 2015 +* Wills Wang, <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+
drivers/spi/ath79_spi.c line 15
Quoted 10 lines
drivers/spi/ath79_spi.c new file +10
-0+*/ + +#include <common.h> +#include <spi.h> +#include <dm.h> +#include <errno.h> +#include <asm/io.h> +#include <asm/addrspace.h> +#include <asm/types.h> +#include <asm/arch/ar71xx_regs.h>
#include <mach/ar71xx_regs.h>
drivers/spi/ath79_spi.c line 22
Quoted 7 lines
drivers/spi/ath79_spi.c new file +7
-0+ +/* CLOCK_DIVIDER = 3 (SPI clock = 200 / 8 ~ 25 MHz) */ +#define SPI_CLK_DIV (x) (((x) >> 1) - 1) + +struct ath79_spi_platdata { +void __iomem *regs; +};
again, platdata is not needed
Quoted 152 lines
drivers/spi/ath79_spi.c new file +152
-0+ +struct ath79_spi_priv { +void __iomem *regs; +}; + +static inline u32 ath79_spi_read (struct udevice *bus,u32 offset) +{ +struct ath79_spi_priv *priv =dev_get_priv (bus); +return readl (priv->regs + offset); +} + +static inline void ath79_spi_write (struct udevice *bus, +u32 val,u32 offset) +{ +struct ath79_spi_priv *priv =dev_get_priv (bus); +writel (val, priv->regs + offset); +} + +static int ath79_spi_claim_bus (struct udevice *dev) +{ +return 0 ; +} + +static int ath79_spi_release_bus (struct udevice *dev) +{ +return 0 ; +} + +static int ath79_spi_xfer (struct udevice *dev,unsigned int bitlen, +const void *dout,void *din,unsigned long flags) +{ +struct udevice *bus = dev->parent; +struct dm_spi_slave_platdata *slave =dev_get_parent_platdata (dev); +uint8_t *rx = din; +const uint8_t *tx = dout; +uint8_t curbyte, curbitlen, restbits; +uint32_t bytes = bitlen /8 ; +uint32_t out; +uint32_t in; + +if (flags &SPI_XFER_BEGIN ) { +ath79_spi_write (bus,AR71XX_SPI_FS_GPIO ,AR71XX_SPI_REG_FS ); +ath79_spi_write (bus,AR71XX_SPI_IOC_CS_ALL ,AR71XX_SPI_REG_IOC ); + } + + restbits = (bitlen %8 ); +if (restbits) + bytes++; + +/* enable chip select */ + out =AR71XX_SPI_IOC_CS_ALL & ~(AR71XX_SPI_IOC_CS (slave->cs)); +while (bytes--) { + curbyte =0 ; +if (tx) + curbyte = *tx++; + +if (restbits) { + curbitlen = restbits; + curbyte <<=8 - restbits; + }else { + curbitlen =8 ; + } + +/* clock starts at inactive polarity */ +for (curbyte <<= (8 - curbitlen); curbitlen; curbitlen--) { +if (curbyte &0x80 ) + out |=AR71XX_SPI_IOC_DO ; +else + out &= ~(AR71XX_SPI_IOC_DO ); + +/* setup MSB (to slave) on trailing edge */ +ath79_spi_write (bus, out,AR71XX_SPI_REG_IOC ); +ath79_spi_write (bus, out |AR71XX_SPI_IOC_CLK , +AR71XX_SPI_REG_IOC ); + curbyte <<=1 ; + } + + in =ath79_spi_read (bus,AR71XX_SPI_REG_RDS ); +if (rx) { +if (restbits) + *rx++ = (in << (8 - restbits)); +else + *rx++ = in; + } + } + +if (flags &SPI_XFER_END ) { +ath79_spi_write (bus,AR71XX_SPI_IOC_CS (slave->cs), +AR71XX_SPI_REG_IOC ); +ath79_spi_write (bus,AR71XX_SPI_IOC_CS_ALL ,AR71XX_SPI_REG_IOC ); +ath79_spi_write (bus,0 ,AR71XX_SPI_REG_FS ); + } + +return 0 ; +} + + +static int ath79_spi_set_speed (struct udevice *bus,uint speed) +{ +u32 val, div =0 ; + +if (speed) + div =get_bus_freq (0 ) / speed; + +if (div >63 ) + div =63 ; + +if (div <5 ) + div =5 ; + +ath79_spi_write (bus,AR71XX_SPI_FS_GPIO ,AR71XX_SPI_REG_FS ); + val =ath79_spi_read (bus,AR71XX_SPI_REG_CTRL ); + val &= ~AR71XX_SPI_CTRL_DIV_MASK ; + val |=SPI_CLK_DIV (div); +ath79_spi_write (bus, val,AR71XX_SPI_REG_CTRL ); +ath79_spi_write (bus,0 ,AR71XX_SPI_REG_FS ); +return 0 ; +} + +static int ath79_spi_set_mode (struct udevice *bus,uint mode) +{ +return 0 ; +} + +static int ath79_spi_probe (struct udevice *bus) +{ +struct ath79_spi_priv *priv =dev_get_priv (bus); +struct ath79_spi_platdata *plat =dev_get_platdata (bus); + + priv->regs = plat->regs; + +/* Init SPI Hardware, disable remap, set clock */ +ath79_spi_write (bus,AR71XX_SPI_FS_GPIO ,AR71XX_SPI_REG_FS ); +ath79_spi_write (bus,AR71XX_SPI_CTRL_RD |SPI_CLK_DIV (8 ), +AR71XX_SPI_REG_CTRL ); +ath79_spi_write (bus,0 ,AR71XX_SPI_REG_FS ); + +return 0 ; +} + +static int ath79_cs_info (struct udevice *bus,uint cs, +struct spi_cs_info *info) +{ +/* Always allow activity on CS 0/1/2 */ +if (cs >=3 ) +return -ENODEV ; + +return 0 ; +} + +static int ath79_spi_ofdata_to_platdata (struct udevice *bus) +{
drivers/spi/ath79_spi.c line 184
Quoted 10 lines
drivers/spi/ath79_spi.c new file +10
-0+struct ath79_spi_platdata *plat =dev_get_platdata (bus); +fdt_addr_t addr; + + addr =dev_get_addr (bus); +if (addr ==FDT_ADDR_T_NONE ) +return -EINVAL ; + + plat->regs =map_physmem (addr, +AR71XX_SPI_SIZE , +MAP_NOCACHE );
move this code to function ath79_spi_probe and drop this function
Quoted 14 lines
drivers/spi/ath79_spi.c new file +14
-0+return 0 ; +} + +static const struct dm_spi_ops ath79_spi_ops = { + .claim_bus = ath79_spi_claim_bus, + .release_bus = ath79_spi_release_bus, + .xfer = ath79_spi_xfer, + .set_speed = ath79_spi_set_speed, + .set_mode = ath79_spi_set_mode, + .cs_info = ath79_cs_info, +}; + +static const struct udevice_id ath79_spi_ids[] = { + { .compatible ="ath79,ath79-spi" },
drivers/spi/ath79_spi.c line 208
Quoted 10 lines
drivers/spi/ath79_spi.c new file +10
-0+ {} +}; + +U_BOOT_DRIVER (ath79_spi) = { + .name ="ath79_spi" , + .id =UCLASS_SPI , + .of_match = ath79_spi_ids, + .ops = &ath79_spi_ops, + .ofdata_to_platdata = ath79_spi_ofdata_to_platdata, + .platdata_auto_alloc_size =sizeof (struct ath79_spi_platdata ),
again, no platdata needed
Quoted 4 lines
drivers/spi/ath79_spi.c new file +3
-0+ .priv_auto_alloc_size = sizeof(struct ath79_spi_priv), + .probe = ath79_spi_probe, +};
Signature · 1 line
- Daniel
PATCH v4 5/8 mips: ath79: add spi driver
Quoted 60 lines · Daniel Schwierzeck
Am 25.12.2015 um 19:56 schrieb Wills Wang:
Quoted 58 lines
Signed-off-by Wills Wang <[email protected]>---
Changes in v4: None
Changes in v3: None
Changes in v2: Nonedrivers/spi/Kconfig | 8 ++ drivers/spi/Makefile | 1 + drivers/spi/ath79_spi.c | 211 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 220 insertions(+)create mode 100644
drivers/spi/ath79_spi.cdrivers/spi/Kconfig +8
-0@@ -23,6 +23,14 @@ config ALTERA_SPI IP core. Please find details on the "Embedded Peripherals IP User Guide" of Altera. +config ATH79_SPI + bool "Atheros SPI driver" + help + Enable the Atheros ar7xxx/ar9xxx SoC SPI driver, it was used + to access SPI NOR flash and other SPI peripherals. This driver + uses driver model and requires a device tree binding to + operate. + config CADENCE_QSPI bool "Cadence QSPI driver" helpdrivers/spi/Makefile +1
-0@@ -17,6 +17,7 @@ endif obj-$(CONFIG_ALTERA_SPI) += altera_spi.o obj-$(CONFIG_ARMADA100_SPI) += armada100_spi.o +obj-$(CONFIG_ATH79_SPI) += ath79_spi.o obj-$(CONFIG_ATMEL_DATAFLASH_SPI) += atmel_dataflash_spi.o obj-$(CONFIG_ATMEL_SPI) += atmel_spi.o obj-$(CONFIG_BFIN_SPI) += bfin_spi.odrivers/spi/ath79_spi.c new file +8
-0@@ -0,0 +1,211 @@ +/* +* (C) Copyright 2015 +* Wills Wang, <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h>
Quoted 8 lines
drivers/spi/ath79_spi.c line 15
Quoted 7 lines
drivers/spi/ath79_spi.c new file +7
-0+#include <spi.h> +#include <dm.h> +#include <errno.h> +#include <asm/io.h> +#include <asm/addrspace.h> +#include <asm/types.h> +#include <asm/arch/ar71xx_regs.h> #include <
mach/ar71xx_regs.h>
Ok.
Quoted 9 lines
drivers/spi/ath79_spi.c line 22
Quoted 8 lines
drivers/spi/ath79_spi.c new file +7
-0+ +/* CLOCK_DIVIDER = 3 (SPI clock = 200 / 8 ~ 25 MHz) */ +#define SPI_CLK_DIV (x) (((x) >> 1) - 1) + +struct ath79_spi_platdata { +void __iomem *regs; +};again, platdata is not needed
Ok.
Quoted 155 lines
Quoted 155 lines
drivers/spi/ath79_spi.c new file +155
-0+ +struct ath79_spi_priv { +void __iomem *regs; +}; + +static inline u32 ath79_spi_read (struct udevice *bus,u32 offset) +{ +struct ath79_spi_priv *priv =dev_get_priv (bus); +return readl (priv->regs + offset); +} + +static inline void ath79_spi_write (struct udevice *bus, +u32 val,u32 offset) +{ +struct ath79_spi_priv *priv =dev_get_priv (bus); +writel (val, priv->regs + offset); +} + +static int ath79_spi_claim_bus (struct udevice *dev) +{ +return 0 ; +} + +static int ath79_spi_release_bus (struct udevice *dev) +{ +return 0 ; +} + +static int ath79_spi_xfer (struct udevice *dev,unsigned int bitlen, +const void *dout,void *din,unsigned long flags) +{ +struct udevice *bus = dev->parent; +struct dm_spi_slave_platdata *slave =dev_get_parent_platdata (dev); +uint8_t *rx = din; +const uint8_t *tx = dout; +uint8_t curbyte, curbitlen, restbits; +uint32_t bytes = bitlen /8 ; +uint32_t out; +uint32_t in; + +if (flags &SPI_XFER_BEGIN ) { +ath79_spi_write (bus,AR71XX_SPI_FS_GPIO ,AR71XX_SPI_REG_FS ); +ath79_spi_write (bus,AR71XX_SPI_IOC_CS_ALL ,AR71XX_SPI_REG_IOC ); + } + + restbits = (bitlen %8 ); +if (restbits) + bytes++; + +/* enable chip select */ + out =AR71XX_SPI_IOC_CS_ALL & ~(AR71XX_SPI_IOC_CS (slave->cs)); +while (bytes--) { + curbyte =0 ; +if (tx) + curbyte = *tx++; + +if (restbits) { + curbitlen = restbits; + curbyte <<=8 - restbits; + }else { + curbitlen =8 ; + } + +/* clock starts at inactive polarity */ +for (curbyte <<= (8 - curbitlen); curbitlen; curbitlen--) { +if (curbyte &0x80 ) + out |=AR71XX_SPI_IOC_DO ; +else + out &= ~(AR71XX_SPI_IOC_DO ); + +/* setup MSB (to slave) on trailing edge */ +ath79_spi_write (bus, out,AR71XX_SPI_REG_IOC ); +ath79_spi_write (bus, out |AR71XX_SPI_IOC_CLK , +AR71XX_SPI_REG_IOC ); + curbyte <<=1 ; + } + + in =ath79_spi_read (bus,AR71XX_SPI_REG_RDS ); +if (rx) { +if (restbits) + *rx++ = (in << (8 - restbits)); +else + *rx++ = in; + } + } + +if (flags &SPI_XFER_END ) { +ath79_spi_write (bus,AR71XX_SPI_IOC_CS (slave->cs), +AR71XX_SPI_REG_IOC ); +ath79_spi_write (bus,AR71XX_SPI_IOC_CS_ALL ,AR71XX_SPI_REG_IOC ); +ath79_spi_write (bus,0 ,AR71XX_SPI_REG_FS ); + } + +return 0 ; +} + + +static int ath79_spi_set_speed (struct udevice *bus,uint speed) +{ +u32 val, div =0 ; + +if (speed) + div =get_bus_freq (0 ) / speed; + +if (div >63 ) + div =63 ; + +if (div <5 ) + div =5 ; + +ath79_spi_write (bus,AR71XX_SPI_FS_GPIO ,AR71XX_SPI_REG_FS ); + val =ath79_spi_read (bus,AR71XX_SPI_REG_CTRL ); + val &= ~AR71XX_SPI_CTRL_DIV_MASK ; + val |=SPI_CLK_DIV (div); +ath79_spi_write (bus, val,AR71XX_SPI_REG_CTRL ); +ath79_spi_write (bus,0 ,AR71XX_SPI_REG_FS ); +return 0 ; +} + +static int ath79_spi_set_mode (struct udevice *bus,uint mode) +{ +return 0 ; +} + +static int ath79_spi_probe (struct udevice *bus) +{ +struct ath79_spi_priv *priv =dev_get_priv (bus); +struct ath79_spi_platdata *plat =dev_get_platdata (bus); + + priv->regs = plat->regs; + +/* Init SPI Hardware, disable remap, set clock */ +ath79_spi_write (bus,AR71XX_SPI_FS_GPIO ,AR71XX_SPI_REG_FS ); +ath79_spi_write (bus,AR71XX_SPI_CTRL_RD |SPI_CLK_DIV (8 ), +AR71XX_SPI_REG_CTRL ); +ath79_spi_write (bus,0 ,AR71XX_SPI_REG_FS ); + +return 0 ; +} + +static int ath79_cs_info (struct udevice *bus,uint cs, +struct spi_cs_info *info) +{ +/* Always allow activity on CS 0/1/2 */ +if (cs >=3 ) +return -ENODEV ; + +return 0 ; +} + +static int ath79_spi_ofdata_to_platdata (struct udevice *bus) +{ +struct ath79_spi_platdata *plat =dev_get_platdata (bus); +fdt_addr_t addr; +
Quoted 8 lines
drivers/spi/ath79_spi.c line 184
Quoted 7 lines
drivers/spi/ath79_spi.c new file +7
-0+ addr =dev_get_addr (bus); +if (addr ==FDT_ADDR_T_NONE ) +return -EINVAL ; + + plat->regs =map_physmem (addr, +AR71XX_SPI_SIZE , +MAP_NOCACHE );move this code to function
ath79_spi_probeand drop this function
Ok.
Quoted 17 lines
Quoted 17 lines
drivers/spi/ath79_spi.c new file +17
-0+return 0 ; +} + +static const struct dm_spi_ops ath79_spi_ops = { + .claim_bus = ath79_spi_claim_bus, + .release_bus = ath79_spi_release_bus, + .xfer = ath79_spi_xfer, + .set_speed = ath79_spi_set_speed, + .set_mode = ath79_spi_set_mode, + .cs_info = ath79_cs_info, +}; + +static const struct udevice_id ath79_spi_ids[] = { + { .compatible ="ath79,ath79-spi" }, + {} +}; +
Quoted 8 lines
drivers/spi/ath79_spi.c line 208
Quoted 7 lines
drivers/spi/ath79_spi.c new file +7
-0+U_BOOT_DRIVER (ath79_spi) = { + .name ="ath79_spi" , + .id =UCLASS_SPI , + .of_match = ath79_spi_ids, + .ops = &ath79_spi_ops, + .ofdata_to_platdata = ath79_spi_ofdata_to_platdata, + .platdata_auto_alloc_size =sizeof (struct ath79_spi_platdata ),again, no platdata needed
Ok.
Quoted 4 lines
Quoted 4 lines
drivers/spi/ath79_spi.c new file +3
-0+ .priv_auto_alloc_size = sizeof(struct ath79_spi_priv), + .probe = ath79_spi_probe, +};
PATCH v4 6/8 mips: ath79: add AP121 reference board
In reply to a message not in the archive---
Changes in v4: None
Changes in v3: None
Changes in v2: None
arch/mips/Kconfig | 8 +++++ arch/mips/dts/Makefile | 2 +- arch/mips/dts/ap121.dts | 37 +++++++++++++++++++ arch/mips/dts/ar933x.dtsi | 64 +++++++++++++++++++++++++++++++++ board/ath79/ap121/Kconfig | 15 ++++++++ board/ath79/ap121/MAINTAINERS | 6 ++++ board/ath79/ap121/Makefile | 8 +++++ board/ath79/ap121/README | 18 ++++++++++ board/ath79/ap121/ap121.c | 17 +++++++++ board/ath79/ap121/config.mk | 16 +++++++++ configs/ap121_defconfig | 42 ++++++++++++++++++++++ include/configs/ap121.h | 82 +++++++++++++++++++++++++++++++++++++++++++ 12 files changed, 314 insertions(+), 1 deletion(-) create mode 100644 arch/mips/dts/ap121.dts create mode 100644 arch/mips/dts/ar933x.dtsi create mode 100644 board/ath79/ap121/Kconfig create mode 100644 board/ath79/ap121/MAINTAINERS create mode 100644 board/ath79/ap121/Makefile create mode 100644 board/ath79/ap121/README create mode 100644 board/ath79/ap121/ap121.c create mode 100644 board/ath79/ap121/config.mk create mode 100644 configs/ap121_defconfig create mode 100644 include/configs/ap121.h
arch/mips/Kconfig +8 -0
@@ -51,6 +51,13 @@ config TARGET_PB1X00 select SUPPORTS_CPU_MIPS32_R2 select SYS_MIPS_CACHE_INIT_RAM_LOAD +config TARGET_AP121 + bool "Support ap121" + select SUPPORTS_BIG_ENDIAN + select SUPPORTS_CPU_MIPS32_R1 + select SUPPORTS_CPU_MIPS32_R2 + select SYS_MIPS_CACHE_INIT_RAM_LOAD + endchoice
@@ -59,6 +66,7 @@ source "board/imgtec/malta/Kconfig" source "board/micronas/vct/Kconfig" source "board/pb1x00/Kconfig" source "board/qemu-mips/Kconfig" +source "board/ath79/ap121/Kconfig" if MIPS
arch/mips/dts/Makefile +1 -1
@@ -2,7 +2,7 @@ # SPDX-License-Identifier: GPL-2.0+ # -dtb-y += +dtb-$(CONFIG_TARGET_AP121) += ap121.dtb targets += $(dtb-y)
arch/mips/dts/ap121.dts new file +37 -0
@@ -0,0 +1,37 @@ +/dts-v1/; +#include "ar933x.dtsi" + +/ { + model = "AP121 Reference Board"; + compatible = "ath79,ap121", "ath79,ar933x"; + + aliases { + spi0 = &spi0; + serial0 = &uart0; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; +}; + +&xtal { + clock-frequency = <25000000>; +}; + +&uart0 { + status = "okay"; +}; + +&spi0 { + spi-max-frequency = <25000000>; + status = "okay"; + spi-flash at 0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "spi-flash"; + memory-map = <0x9f000000 0x00800000>; + spi-max-frequency = <25000000>; + reg = <0>; + }; +};
arch/mips/dts/ar933x.dtsi new file +64 -0
64 lines not on this page · raw message
board/ath79/ap121/Kconfig new file +15 -0
@@ -0,0 +1,15 @@ +if TARGET_AP121 + +config SYS_BOARD + default "ap121" + +config SYS_VENDOR + default "ath79" + +config SYS_SOC + default "ath79" + +config SYS_CONFIG_NAME + default "ap121" + +endif
board/ath79/ap121/MAINTAINERS new file +6 -0
@@ -0,0 +1,6 @@ +AP121 BOARD +M: Wills Wang <[email protected]> +S: Maintained +F: board/ath79/ap121/ +F: include/configs/ap121.h +F: configs/ap121_defconfig
board/ath79/ap121/Makefile new file +8 -0
@@ -0,0 +1,8 @@ +# +# (C) Copyright 2003-2006 +# Wolfgang Denk, DENX Software Engineering, wd at denx.de. +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y = ap121.o
board/ath79/ap121/README new file +18 -0
@@ -0,0 +1,18 @@ +ATHEROS AP121 +================== + +Supported hardware: AP121 referance board. + +Files of the AP121 port +-------------------------- + +arch/mips/mach-ath79/ar933x/ - The CPU support code for the Atheros ar933x +arch/mips/include/asm/arch-ath79 - Header files for the Atheros ath79 +board/ath79/ap121/ - AP121 board specific files +include/configs/ap121.h - AP121 configuration file + +Configure +------------------- + +To configure for the current board + make ap121_defconfig
board/ath79/ap121/ap121.c new file +17 -0
@@ -0,0 +1,17 @@ +/* +* (C) Copyright 2015 +* Wills Wang, <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <command.h> +#include <asm/mipsregs.h> +#include <asm/addrspace.h> +#include <asm/io.h> + +int checkboard (void ) +{ +return 0 ; +}
board/ath79/ap121/config.mk new file +16 -0
@@ -0,0 +1,16 @@ +# +# (C) Copyright 2003 +# Wolfgang Denk, DENX Software Engineering, wd at denx.de. +# +# SPDX-License-Identifier: GPL-2.0+ +# + +# +# AP121 referance board, MIPS32 core +# + +# ROM version +CONFIG_SYS_TEXT_BASE = 0x9f000000 + +# RAM version +#CONFIG_SYS_TEXT_BASE = 0x80010000
configs/ap121_defconfig new file +42 -0
42 lines not on this page · raw message
include/configs/ap121.h new file +82 -0
82 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v4 6/8 mips: ath79: add AP121 reference board
Am 25.12.2015 um 19:56 schrieb Wills Wang:
Quoted 36 lines
Signed-off-by Wills Wang <[email protected]>---
Changes in v4: None
Changes in v3: None
Changes in v2: Nonearch/mips/Kconfig | 8 +++++ arch/mips/dts/Makefile | 2 +- arch/mips/dts/ap121.dts | 37 +++++++++++++++++++ arch/mips/dts/ar933x.dtsi | 64 +++++++++++++++++++++++++++++++++ board/ath79/ap121/Kconfig | 15 ++++++++ board/ath79/ap121/MAINTAINERS | 6 ++++ board/ath79/ap121/Makefile | 8 +++++ board/ath79/ap121/README | 18 ++++++++++ board/ath79/ap121/ap121.c | 17 +++++++++ board/ath79/ap121/config.mk | 16 +++++++++ configs/ap121_defconfig | 42 ++++++++++++++++++++++ include/configs/ap121.h | 82 +++++++++++++++++++++++++++++++++++++++++++ 12 files changed, 314 insertions(+), 1 deletion(-) create mode 100644 arch/mips/dts/ap121.dts create mode 100644 arch/mips/dts/ar933x.dtsi create mode 100644 board/ath79/ap121/Kconfig create mode 100644 board/ath79/ap121/MAINTAINERS create mode 100644 board/ath79/ap121/Makefile create mode 100644 board/ath79/ap121/README create mode 100644 board/ath79/ap121/ap121.c create mode 100644 board/ath79/ap121/config.mk create mode 100644 configs/ap121_defconfig create mode 100644 include/configs/ap121.harch/mips/Kconfig +0
-0
arch/mips/Kconfig config TARGET_PB1X00 · line 60
Quoted 10 lines
arch/mips/Kconfig +7
-0@@ -51,6 +51,13 @@ config TARGET_PB1X00 select SUPPORTS_CPU_MIPS32_R2 select SYS_MIPS_CACHE_INIT_RAM_LOAD +config TARGET_AP121 + bool "Support ap121" + select SUPPORTS_BIG_ENDIAN + select SUPPORTS_CPU_MIPS32_R1 + select SUPPORTS_CPU_MIPS32_R2 + select SYS_MIPS_CACHE_INIT_RAM_LOAD +
please create a dedicated Kconfig in arch/mips/mach-ath79/ and add this board there. Have a look at following links for examples:
http://patchwork.ozlabs.org/patch/558465/
http://patchwork.ozlabs.org/patch/558469/
Quoted 73 lines
arch/mips/Kconfig +1
-0endchoice@@ -59,6 +66,7 @@ source "board/imgtec/malta/Kconfig" source "board/micronas/vct/Kconfig" source "board/pb1x00/Kconfig" source "board/qemu-mips/Kconfig" +source "board/ath79/ap121/Kconfig" if MIPSarch/mips/dts/Makefile +1
-1@@ -2,7 +2,7 @@ # SPDX-License-Identifier: GPL-2.0+ # -dtb-y += +dtb-$(CONFIG_TARGET_AP121) += ap121.dtb targets += $(dtb-y)arch/mips/dts/ap121.dts new file +37
-0@@ -0,0 +1,37 @@ +/dts-v1/; +#include "ar933x.dtsi" + +/ { + model = "AP121 Reference Board"; + compatible = "ath79,ap121", "ath79,ar933x"; + + aliases { + spi0 = &spi0; + serial0 = &uart0; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; +}; + +&xtal { + clock-frequency = <25000000>; +}; + +&uart0 { + status = "okay"; +}; + +&spi0 { + spi-max-frequency = <25000000>; + status = "okay"; + spi-flash at 0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "spi-flash"; + memory-map = <0x9f000000 0x00800000>; + spi-max-frequency = <25000000>; + reg = <0>; + }; +};arch/mips/dts/ar933x.dtsi new file +0
-0
arch/mips/dts/ar933x.dtsi line 4
Quoted 4 lines
arch/mips/dts/ar933x.dtsi new file +4
-0@@ -0,0 +1,64 @@ +#include "skeleton.dtsi" + +/ { + compatible = "ath79,ar933x";
the first part should be a vendor name and according to device-trees from kernel this should be "qca"
Quoted 33 lines
arch/mips/dts/ar933x.dtsi new file +33
-0+ + #address-cells = <1>; + #size-cells = <1>; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpu at 0 { + device_type = "cpu"; + compatible = "mips,mips24Kc"; + reg = <0>; + }; + }; + + clocks { + #address-cells = <1>; + #size-cells = <1>; + ranges; + + xtal: xtal { + #clock-cells = <0>; + compatible = "fixed-clock"; + clock-output-names = "xtal"; + }; + }; + + ahb { + compatible = "simple-bus"; + ranges; + + #address-cells = <1>; + #size-cells = <1>;
arch/mips/dts/ar933x.dtsi line 47
Quoted 10 lines
arch/mips/dts/ar933x.dtsi new file +10
-0+ + apb { + compatible = "simple-bus"; + ranges; + + #address-cells = <1>; + #size-cells = <1>; + + uart0: uart at 18020000 { + compatible = "ath79,ar933x-uart";
I suggest to use "qca,ar9330-uart" like the kernel driver
arch/mips/dts/ar933x.dtsi line 55
Quoted 8 lines
arch/mips/dts/ar933x.dtsi new file +8
-0+ reg = <0x18020000 0x20>; + + status = "disabled"; + }; + }; + + spi0: spi at 1f000000 { + compatible = "ath79,ath79-spi";
I suggest to use "qca,ar7100-spi" like the kernel driver
Quoted 48 lines
arch/mips/dts/ar933x.dtsi new file +9
-0+ reg = <0x1f000000 0x10>; + + status = "disabled"; + + #address-cells = <1>; + #size-cells = <0>; + }; + }; +};board/ath79/ap121/Kconfig new file +15
-0@@ -0,0 +1,15 @@ +if TARGET_AP121 + +config SYS_BOARD + default "ap121" + +config SYS_VENDOR + default "ath79" + +config SYS_SOC + default "ath79" + +config SYS_CONFIG_NAME + default "ap121" + +endifboard/ath79/ap121/MAINTAINERS new file +6
-0@@ -0,0 +1,6 @@ +AP121 BOARD +M: Wills Wang <[email protected]> +S: Maintained +F: board/ath79/ap121/ +F: include/configs/ap121.h +F: configs/ap121_defconfigboard/ath79/ap121/Makefile new file +0
-0
board/ath79/ap121/Makefile line 3
Quoted 3 lines
board/ath79/ap121/Makefile new file +3
-0@@ -0,0 +1,8 @@ +# +# (C) Copyright 2003-2006 +# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
again, no historic copyright needed for a simple one-line Makefile
Quoted 19 lines
board/ath79/ap121/Makefile new file +5
-0+# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y = ap121.oboard/ath79/ap121/README new file +8
-0@@ -0,0 +1,18 @@ +ATHEROS AP121 +================== + +Supported hardware: AP121 referance board. + +Files of the AP121 port +-------------------------- +
board/ath79/ap121/README line 18
Quoted 10 lines
board/ath79/ap121/README new file +10
-0+arch/mips/mach-ath79/ar933x/ - The CPU support code for the Atheros ar933x +arch/mips/include/asm/arch-ath79 - Header files for the Atheros ath79 +board/ath79/ap121/ - AP121 board specific files +include/configs/ap121.h - AP121 configuration file + +Configure +------------------- + +To configure for the current board + make ap121_defconfig
you can drop this README. There is no new or relevant information in it
Quoted 13 lines
board/ath79/ap121/ap121.c new file +7
-0@@ -0,0 +1,17 @@ +/* +* (C) Copyright 2015 +* Wills Wang, <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ +
board/ath79/ap121/ap121.c line 17
Quoted 10 lines
board/ath79/ap121/ap121.c new file +10
-0+#include <common.h> +#include <command.h> +#include <asm/mipsregs.h> +#include <asm/addrspace.h> +#include <asm/io.h> + +int checkboard (void ) +{ +return 0 ; +}
you could/should print your board name here
Quoted 12 lines
board/ath79/ap121/config.mk new file +6
-0@@ -0,0 +1,16 @@ +# +# (C) Copyright 2003 +# Wolfgang Denk, DENX Software Engineering, wd at denx.de. +# +# SPDX-License-Identifier: GPL-2.0+ +#
board/ath79/ap121/config.mk line 16
Quoted 10 lines
board/ath79/ap121/config.mk new file +10
-0+ +# +# AP121 referance board, MIPS32 core +# + +# ROM version +CONFIG_SYS_TEXT_BASE = 0x9f000000 + +# RAM version +#CONFIG_SYS_TEXT_BASE = 0x80010000
config.mk files in board directory are also deprecated. Please add "#define CONFIG_SYS_TEXT_BASE 0x9f000000" to include/configs/ap121.h
configs/ap121_defconfig line 7
Quoted 13 lines
configs/ap121_defconfig new file +7
-0@@ -0,0 +1,42 @@ +CONFIG_MIPS=y +CONFIG_TARGET_AP121=y +CONFIG_SYS_MALLOC_F_LEN=0x2000 +CONFIG_SYS_PROMPT="ap121 # " +CONFIG_OF_CONTROL=y +CONFIG_DEFAULT_DEVICE_TREE="ap121" +CONFIG_DM=y
options like CONFIG_OF_CONTROL and CONFIG_DM should be pre-selected by the mach or SoC specific Kconfig file if you always require it. An user of your board should not be able to disable those options.
Quoted 41 lines
configs/ap121_defconfig new file +35
-0+CONFIG_DM_SERIAL=y +CONFIG_DM_SPI=y +CONFIG_DM_SPI_FLASH=y +CONFIG_ATH79_SPI=y +CONFIG_SPI_FLASH=y +CONFIG_SPI_FLASH_BAR=y +CONFIG_SPI_FLASH_ATMEL=y +CONFIG_SPI_FLASH_EON=y +CONFIG_SPI_FLASH_GIGADEVICE=y +CONFIG_SPI_FLASH_MACRONIX=y +CONFIG_SPI_FLASH_SPANSION=y +CONFIG_SPI_FLASH_STMICRO=y +CONFIG_SPI_FLASH_SST=y +CONFIG_SPI_FLASH_WINBOND=y +CONFIG_SPI_FLASH_USE_4K_SECTORS=y +CONFIG_SPI_FLASH_DATAFLASH=y +CONFIG_SPI_FLASH_MTD=y +CONFIG_CMD_DM=y +CONFIG_CMD_SF=y +CONFIG_CMD_SPI=y +# CONFIG_NET is not set +# CONFIG_CMD_BDI is not set +# CONFIG_CMD_CONSOLE is not set +# CONFIG_CMD_IMLS is not set +# CONFIG_CMD_XIMG is not set +# CONFIG_CMD_ELF is not set +# CONFIG_CMD_EXPORTENV is not set +# CONFIG_CMD_IMPORTENV is not set +# CONFIG_CMD_EDITENV is not set +# CONFIG_CMD_CRC32 is not set +# CONFIG_CMD_FLASH is not set +# CONFIG_CMD_FPGA is not set +# CONFIG_CMD_NFS is not set +# CONFIG_CMD_NET is not set +CONFIG_USE_PRIVATE_LIBGCC=yinclude/configs/ap121.h new file +0
-0
include/configs/ap121.h line 5
Quoted 5 lines
include/configs/ap121.h new file +5
-0@@ -0,0 +1,82 @@ +#ifndef __CONFIG_H +#define __CONFIG_H + +#include <linux/kconfig.h> +#include <linux/sizes.h>
those includes are not needed in a board config header file respectively they are already included implicitely
include/configs/ap121.h line 8
Quoted 3 lines
include/configs/ap121.h new file +3
-0+ +#define CONFIG_ARCH_ATH79 +#define CONFIG_SOC_AR933X
this is already configured by Kconfig
Quoted 4 lines
include/configs/ap121.h new file +4
-0+ +#define CONFIG_DISPLAY_CPUINFO +#define CONFIG_DISPLAY_BOARDINFO +
include/configs/ap121.h line 22
Quoted 10 lines
include/configs/ap121.h new file +10
-0+#define CONFIG_OF_LIBFDT + +#define CONFIG_SYS_HZ 1000 +#define CONFIG_SYS_MHZ 200 +#define CONFIG_SYS_MIPS_TIMER_FREQ (CONFIG_SYS_MHZ * 1000000) + +/* Cache Configuration */ +#define CONFIG_SYS_DCACHE_SIZE 32 * SZ_1K +#define CONFIG_SYS_ICACHE_SIZE 64 * SZ_1K +#define CONFIG_SYS_CACHELINE_SIZE 32
you can drop this, the cache sizes will be detected automatically
include/configs/ap121.h line 26
Quoted 4 lines
include/configs/ap121.h new file +4
-0+ +#define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE + +#define CONFIG_SYS_MALLOC_LEN ROUND(0x30000 + 128 * SZ_1K, 0x1000)
no need for a magic calculation, please choose a fixed value
include/configs/ap121.h line 36
Quoted 10 lines
include/configs/ap121.h new file +10
-0+ +#define CONFIG_SYS_BOOTPARAMS_LEN 128 * SZ_1K + +#define CONFIG_SYS_SDRAM_BASE 0x80000000 +#define CONFIG_SYS_LOAD_ADDR 0x81000000 + +#define CONFIG_SYS_INIT_SP_OFFSET 0x20000 +#define CONFIG_SYS_NO_FLASH + +#define CONFIG_AR933X_SERIAL
this is already configured by Kconfig
Quoted 27 lines
include/configs/ap121.h new file +27
-0+#define CONFIG_BAUDRATE 115200 +#define CONFIG_SYS_BAUDRATE_TABLE {9600, 19200, 38400, 57600, 115200} + +#define CONFIG_BOOTDELAY 3 +#define CONFIG_BOOTARGS "console=ttyS0,115200 " \ + "root=/dev/mtdblock2 " \ + "rootfstype=squashfs" +#define CONFIG_BOOTCOMMAND "sf probe;" \ + "mtdparts default;" \ + "bootm 0x9f300000" +#define CONFIG_LZMA + +#define MTDIDS_DEFAULT "nor0=spi-flash.0" +#define MTDPARTS_DEFAULT "mtdparts=spi-flash.0:256k(u-boot)," \ + "64k(u-boot-env),2752k(rootfs),896k(uImage),64k(NVRAM),64k(ART)" + +#define CONFIG_ENV_SPI_MAX_HZ 25000000 +#define CONFIG_ENV_IS_IN_SPI_FLASH +#define CONFIG_ENV_OFFSET (256 * SZ_1K) +#define CONFIG_ENV_SECT_SIZE (64 * SZ_1K) +#define CONFIG_ENV_SIZE (64 * SZ_1K) + +/* +* Command +*/ +#define CONFIG_CMD_MTDPARTS +
include/configs/ap121.h line 73
Quoted 10 lines
include/configs/ap121.h new file +10
-0+/* Miscellaneous configurable options */ +#define CONFIG_SYS_CBSIZE 256 +#define CONFIG_SYS_MAXARGS 16 +#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \ + sizeof(CONFIG_SYS_PROMPT) + 16) +#define CONFIG_SYS_LONGHELP +#define CONFIG_CMDLINE_EDITING +#define CONFIG_AUTO_COMPLETE +#define CONFIG_SYS_HUSH_PARSER +#define CONFIG_SYS_PROMPT_HUSH_PS2 "> "
this is already configured by Kconfig
Quoted 10 lines
include/configs/ap121.h new file +9
-0+ +/* +* Diagnostics +*/ +#define CONFIG_SYS_MEMTEST_START 0x80100000 +#define CONFIG_SYS_MEMTEST_END 0x83f00000 +#define CONFIG_CMD_MEMTEST + +#endif /* __CONFIG_H */
Signature · 1 line
- Daniel
PATCH v4 6/8 mips: ath79: add AP121 reference board
Quoted 51 lines · Daniel Schwierzeck
Am 25.12.2015 um 19:56 schrieb Wills Wang:
Quoted 36 lines
Signed-off-by Wills Wang <[email protected]>---
Changes in v4: None
Changes in v3: None
Changes in v2: Nonearch/mips/Kconfig | 8 +++++ arch/mips/dts/Makefile | 2 +- arch/mips/dts/ap121.dts | 37 +++++++++++++++++++ arch/mips/dts/ar933x.dtsi | 64 +++++++++++++++++++++++++++++++++ board/ath79/ap121/Kconfig | 15 ++++++++ board/ath79/ap121/MAINTAINERS | 6 ++++ board/ath79/ap121/Makefile | 8 +++++ board/ath79/ap121/README | 18 ++++++++++ board/ath79/ap121/ap121.c | 17 +++++++++ board/ath79/ap121/config.mk | 16 +++++++++ configs/ap121_defconfig | 42 ++++++++++++++++++++++ include/configs/ap121.h | 82 +++++++++++++++++++++++++++++++++++++++++++ 12 files changed, 314 insertions(+), 1 deletion(-)create mode 100644
arch/mips/dts/ap121.dtscreate mode 100644arch/mips/dts/ar933x.dtsicreate mode 100644 board/ath79/ap121/Kconfig create mode 100644 board/ath79/ap121/MAINTAINERS create mode 100644 board/ath79/ap121/Makefile create mode 100644 board/ath79/ap121/README create mode 100644board/ath79/ap121/ap121.ccreate mode 100644board/ath79/ap121/config.mkcreate mode 100644 configs/ap121_defconfig create mode 100644include/configs/ap121.harch/mips/Kconfig +0
-0arch/mips/Kconfig config TARGET_PB1X00 · line 60
Quoted 10 lines
arch/mips/Kconfig +7
-0@@ -51,6 +51,13 @@ config TARGET_PB1X00 select SUPPORTS_CPU_MIPS32_R2 select SYS_MIPS_CACHE_INIT_RAM_LOAD +config TARGET_AP121 + bool "Support ap121" + select SUPPORTS_BIG_ENDIAN + select SUPPORTS_CPU_MIPS32_R1 + select SUPPORTS_CPU_MIPS32_R2 + select SYS_MIPS_CACHE_INIT_RAM_LOAD +please create a dedicated
Kconfiginarch/mips/mach-ath79/and add this board there. Have a look at following links for examples:
Ok.
Quoted 71 lines
Quoted 71 lines
arch/mips/Kconfig +1
-0endchoice@@ -59,6 +66,7 @@ source "board/imgtec/malta/Kconfig" source "board/micronas/vct/Kconfig" source "board/pb1x00/Kconfig" source "board/qemu-mips/Kconfig" +source "board/ath79/ap121/Kconfig" if MIPSarch/mips/dts/Makefile +1
-1@@ -2,7 +2,7 @@ # SPDX-License-Identifier: GPL-2.0+ # -dtb-y += +dtb-$(CONFIG_TARGET_AP121) += ap121.dtb targets += $(dtb-y)arch/mips/dts/ap121.dts new file +37
-0@@ -0,0 +1,37 @@ +/dts-v1/; +#include "ar933x.dtsi" + +/ { + model = "AP121 Reference Board"; + compatible = "ath79,ap121", "ath79,ar933x"; + + aliases { + spi0 = &spi0; + serial0 = &uart0; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; +}; + +&xtal { + clock-frequency = <25000000>; +}; + +&uart0 { + status = "okay"; +}; + +&spi0 { + spi-max-frequency = <25000000>; + status = "okay"; + spi-flash at 0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "spi-flash"; + memory-map = <0x9f000000 0x00800000>; + spi-max-frequency = <25000000>; + reg = <0>; + }; +};arch/mips/dts/ar933x.dtsi new file +0
-1--- /dev/null
Quoted 8 lines
arch/mips/dts/ar933x.dtsi line 4
Quoted 6 lines
+++
b/arch/mips/dts/ar933x.dtsiarch/mips/dts/ar933x.dtsi new file +4
-0@@ -0,0 +1,64 @@ +#include "skeleton.dtsi" + +/ { + compatible = "ath79,ar933x";the first part should be a vendor name and according to device-trees from kernel this should be "qca"
Ok.
Quoted 36 lines
Quoted 36 lines
arch/mips/dts/ar933x.dtsi new file +36
-0+ + #address-cells = <1>; + #size-cells = <1>; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpu at 0 { + device_type = "cpu"; + compatible = "mips,mips24Kc"; + reg = <0>; + }; + }; + + clocks { + #address-cells = <1>; + #size-cells = <1>; + ranges; + + xtal: xtal { + #clock-cells = <0>; + compatible = "fixed-clock"; + clock-output-names = "xtal"; + }; + }; + + ahb { + compatible = "simple-bus"; + ranges; + + #address-cells = <1>; + #size-cells = <1>; + + apb { + compatible = "simple-bus";
Quoted 9 lines
arch/mips/dts/ar933x.dtsi line 47
Quoted 7 lines
arch/mips/dts/ar933x.dtsi new file +7
-0+ ranges; + + #address-cells = <1>; + #size-cells = <1>; + + uart0: uart at 18020000 { + compatible = "ath79,ar933x-uart";I suggest to use "qca,ar9330-uart" like the kernel driver
Ok.
Quoted 9 lines
arch/mips/dts/ar933x.dtsi line 55
Quoted 8 lines
arch/mips/dts/ar933x.dtsi new file +8
-0+ reg = <0x18020000 0x20>; + + status = "disabled"; + }; + }; + + spi0: spi at 1f000000 { + compatible = "ath79,ath79-spi";I suggest to use "qca,ar7100-spi" like the kernel driver
Ok.
Quoted 44 lines
Quoted 44 lines
arch/mips/dts/ar933x.dtsi new file +9
-0+ reg = <0x1f000000 0x10>; + + status = "disabled"; + + #address-cells = <1>; + #size-cells = <0>; + }; + }; +};board/ath79/ap121/Kconfig new file +15
-0@@ -0,0 +1,15 @@ +if TARGET_AP121 + +config SYS_BOARD + default "ap121" + +config SYS_VENDOR + default "ath79" + +config SYS_SOC + default "ath79" + +config SYS_CONFIG_NAME + default "ap121" + +endifboard/ath79/ap121/MAINTAINERS new file +6
-0@@ -0,0 +1,6 @@ +AP121 BOARD +M: Wills Wang <[email protected]> +S: Maintained +F: board/ath79/ap121/ +F: include/configs/ap121.h +F: configs/ap121_defconfigboard/ath79/ap121/Makefile new file +0
-0
Quoted 8 lines
board/ath79/ap121/Makefile line 3
Quoted 7 lines
index 0000000..9132118
board/ath79/ap121/Makefile new file +3
-0@@ -0,0 +1,8 @@ +# +# (C) Copyright 2003-2006 +# Wolfgang Denk, DENX Software Engineering, wd at denx.de.again, no historic copyright needed for a simple one-line
Makefile
Ok.
Quoted 22 lines
Quoted 22 lines
board/ath79/ap121/Makefile new file +5
-0+# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y = ap121.oboard/ath79/ap121/README new file +11
-0@@ -0,0 +1,18 @@ +ATHEROS AP121 +================== + +Supported hardware: AP121 referance board. + +Files of the AP121 port +-------------------------- + +arch/mips/mach-ath79/ar933x/ - The CPU support code for the Atheros ar933x +arch/mips/include/asm/arch-ath79 - Header files for the Atheros ath79 +board/ath79/ap121/ - AP121 board specific files
Quoted 9 lines
board/ath79/ap121/README line 18
Quoted 7 lines
board/ath79/ap121/README new file +7
-0+include/configs/ap121.h - AP121 configuration file + +Configure +------------------- + +To configure for the current board + make ap121_defconfigyou can drop this README. There is no new or relevant information in it
Ok.
Quoted 16 lines
Quoted 16 lines
board/ath79/ap121/ap121.c new file +10
-0@@ -0,0 +1,17 @@ +/* +* (C) Copyright 2015 +* Wills Wang, <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <command.h> +#include <asm/mipsregs.h>
Quoted 8 lines
board/ath79/ap121/ap121.c line 17
Quoted 7 lines
board/ath79/ap121/ap121.c new file +7
-0+#include <asm/addrspace.h> +#include <asm/io.h> + +int checkboard (void ) +{ +return 0 ; +}you could/should print your board name here
U-boot print the board model property from device tree when power up, I think it's duplicated.
Quoted 16 lines
Quoted 16 lines
board/ath79/ap121/config.mk new file +10
-0@@ -0,0 +1,16 @@ +# +# (C) Copyright 2003 +# Wolfgang Denk, DENX Software Engineering, wd at denx.de. +# +# SPDX-License-Identifier: GPL-2.0+ +# + +# +# AP121 referance board, MIPS32 core +#
Quoted 8 lines
board/ath79/ap121/config.mk line 16
Quoted 6 lines
board/ath79/ap121/config.mk new file +6
-0+ +# ROM version +CONFIG_SYS_TEXT_BASE = 0x9f000000 + +# RAM version +#CONFIG_SYS_TEXT_BASE = 0x80010000config.mk files in board directory are also deprecated. Please add "#define
CONFIG_SYS_TEXT_BASE0x9f000000" toinclude/configs/ap121.h
Ok.
Quoted 8 lines
Quoted 8 lines
configs/ap121_defconfig new file +2
-0@@ -0,0 +1,42 @@ +CONFIG_MIPS=y +CONFIG_TARGET_AP121=y
Quoted 9 lines
configs/ap121_defconfig line 7
Quoted 5 lines
configs/ap121_defconfig new file +5
-0+CONFIG_SYS_MALLOC_F_LEN=0x2000 +CONFIG_SYS_PROMPT="ap121 # " +CONFIG_OF_CONTROL=y +CONFIG_DEFAULT_DEVICE_TREE="ap121" +CONFIG_DM=yoptions like
CONFIG_OF_CONTROLandCONFIG_DMshould be pre-selected by the mach or SoC specificKconfigfile if you always require it. An user of your board should not be able to disable those options.
Ok.
Quoted 40 lines
Quoted 40 lines
configs/ap121_defconfig new file +35
-0+CONFIG_DM_SERIAL=y +CONFIG_DM_SPI=y +CONFIG_DM_SPI_FLASH=y +CONFIG_ATH79_SPI=y +CONFIG_SPI_FLASH=y +CONFIG_SPI_FLASH_BAR=y +CONFIG_SPI_FLASH_ATMEL=y +CONFIG_SPI_FLASH_EON=y +CONFIG_SPI_FLASH_GIGADEVICE=y +CONFIG_SPI_FLASH_MACRONIX=y +CONFIG_SPI_FLASH_SPANSION=y +CONFIG_SPI_FLASH_STMICRO=y +CONFIG_SPI_FLASH_SST=y +CONFIG_SPI_FLASH_WINBOND=y +CONFIG_SPI_FLASH_USE_4K_SECTORS=y +CONFIG_SPI_FLASH_DATAFLASH=y +CONFIG_SPI_FLASH_MTD=y +CONFIG_CMD_DM=y +CONFIG_CMD_SF=y +CONFIG_CMD_SPI=y +# CONFIG_NET is not set +# CONFIG_CMD_BDI is not set +# CONFIG_CMD_CONSOLE is not set +# CONFIG_CMD_IMLS is not set +# CONFIG_CMD_XIMG is not set +# CONFIG_CMD_ELF is not set +# CONFIG_CMD_EXPORTENV is not set +# CONFIG_CMD_IMPORTENV is not set +# CONFIG_CMD_EDITENV is not set +# CONFIG_CMD_CRC32 is not set +# CONFIG_CMD_FLASH is not set +# CONFIG_CMD_FPGA is not set +# CONFIG_CMD_NFS is not set +# CONFIG_CMD_NET is not set +CONFIG_USE_PRIVATE_LIBGCC=yinclude/configs/ap121.h new file +0
-0
Quoted 8 lines
include/configs/ap121.h line 5
Quoted 6 lines
include/configs/ap121.h new file +5
-0@@ -0,0 +1,82 @@ +#ifndef __CONFIG_H +#define __CONFIG_H + +#include <linux/kconfig.h> +#include <linux/sizes.h> those includes are not needed in a board config header file respectively they are already included implicitely
Ok.
Quoted 5 lines
include/configs/ap121.h line 8
Quoted 3 lines
include/configs/ap121.h new file +3
-0+ +#define CONFIG_ARCH_ATH79 +#define CONFIG_SOC_AR933X this is already configured by
Kconfig
Ok.
Quoted 7 lines
Quoted 7 lines
include/configs/ap121.h new file +7
-0+ +#define CONFIG_DISPLAY_CPUINFO +#define CONFIG_DISPLAY_BOARDINFO + +#define CONFIG_OF_LIBFDT + +#define CONFIG_SYS_HZ 1000
Quoted 8 lines
include/configs/ap121.h line 22
Quoted 7 lines
include/configs/ap121.h new file +7
-0+#define CONFIG_SYS_MHZ 200 +#define CONFIG_SYS_MIPS_TIMER_FREQ (CONFIG_SYS_MHZ * 1000000) + +/* Cache Configuration */ +#define CONFIG_SYS_DCACHE_SIZE 32 * SZ_1K +#define CONFIG_SYS_ICACHE_SIZE 64 * SZ_1K +#define CONFIG_SYS_CACHELINE_SIZE 32you can drop this, the cache sizes will be detected automatically
I have a try later, i will drop this if it work fine.
Quoted 5 lines
include/configs/ap121.h line 26
Quoted 4 lines
include/configs/ap121.h new file +4
-0+ +#define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE + +#define CONFIG_SYS_MALLOC_LEN ROUND(0x30000 + 128 * SZ_1K, 0x1000)no need for a magic calculation, please choose a fixed value
Ok.
Quoted 11 lines
include/configs/ap121.h line 36
Quoted 10 lines
include/configs/ap121.h new file +10
-0+ +#define CONFIG_SYS_BOOTPARAMS_LEN 128 * SZ_1K + +#define CONFIG_SYS_SDRAM_BASE 0x80000000 +#define CONFIG_SYS_LOAD_ADDR 0x81000000 + +#define CONFIG_SYS_INIT_SP_OFFSET 0x20000 +#define CONFIG_SYS_NO_FLASH + +#define CONFIG_AR933X_SERIAL this is already configured by
Kconfig
Ok.
Quoted 30 lines
Quoted 30 lines
include/configs/ap121.h new file +30
-0+#define CONFIG_BAUDRATE 115200 +#define CONFIG_SYS_BAUDRATE_TABLE {9600, 19200, 38400, 57600, 115200} + +#define CONFIG_BOOTDELAY 3 +#define CONFIG_BOOTARGS "console=ttyS0,115200 " \ + "root=/dev/mtdblock2 " \ + "rootfstype=squashfs" +#define CONFIG_BOOTCOMMAND "sf probe;" \ + "mtdparts default;" \ + "bootm 0x9f300000" +#define CONFIG_LZMA + +#define MTDIDS_DEFAULT "nor0=spi-flash.0" +#define MTDPARTS_DEFAULT "mtdparts=spi-flash.0:256k(u-boot)," \ + "64k(u-boot-env),2752k(rootfs),896k(uImage),64k(NVRAM),64k(ART)" + +#define CONFIG_ENV_SPI_MAX_HZ 25000000 +#define CONFIG_ENV_IS_IN_SPI_FLASH +#define CONFIG_ENV_OFFSET (256 * SZ_1K) +#define CONFIG_ENV_SECT_SIZE (64 * SZ_1K) +#define CONFIG_ENV_SIZE (64 * SZ_1K) + +/* +* Command +*/ +#define CONFIG_CMD_MTDPARTS + +/* Miscellaneous configurable options */ +#define CONFIG_SYS_CBSIZE 256 +#define CONFIG_SYS_MAXARGS 16
Quoted 8 lines
include/configs/ap121.h line 73
Quoted 7 lines
include/configs/ap121.h new file +7
-0+#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \ + sizeof(CONFIG_SYS_PROMPT) + 16) +#define CONFIG_SYS_LONGHELP +#define CONFIG_CMDLINE_EDITING +#define CONFIG_AUTO_COMPLETE +#define CONFIG_SYS_HUSH_PARSER +#define CONFIG_SYS_PROMPT_HUSH_PS2 "> "this is already configured by
Kconfig
Ok.
Quoted 10 lines
Quoted 10 lines
include/configs/ap121.h new file +9
-0+ +/* +* Diagnostics +*/ +#define CONFIG_SYS_MEMTEST_START 0x80100000 +#define CONFIG_SYS_MEMTEST_END 0x83f00000 +#define CONFIG_CMD_MEMTEST + +#endif /* __CONFIG_H */
PATCH v4 6/8 mips: ath79: add AP121 reference board
Am 26.12.2015 um 17:59 schrieb Wills Wang:
Quoted 301 lines · Daniel Schwierzeck
Quoted 51 lines
Am 25.12.2015 um 19:56 schrieb Wills Wang:
Quoted 37 lines
Signed-off-by Wills Wang <[email protected]>---
Changes in v4: None
Changes in v3: None
Changes in v2: Nonearch/mips/Kconfig | 8 +++++ arch/mips/dts/Makefile | 2 +- arch/mips/dts/ap121.dts | 37 +++++++++++++++++++ arch/mips/dts/ar933x.dtsi | 64 +++++++++++++++++++++++++++++++++ board/ath79/ap121/Kconfig | 15 ++++++++ board/ath79/ap121/MAINTAINERS | 6 ++++ board/ath79/ap121/Makefile | 8 +++++ board/ath79/ap121/README | 18 ++++++++++ board/ath79/ap121/ap121.c | 17 +++++++++ board/ath79/ap121/config.mk | 16 +++++++++ configs/ap121_defconfig | 42 ++++++++++++++++++++++ include/configs/ap121.h | 82 +++++++++++++++++++++++++++++++++++++++++++ 12 files changed, 314 insertions(+), 1 deletion(-)create mode 100644
arch/mips/dts/ap121.dtscreate mode 100644arch/mips/dts/ar933x.dtsicreate mode 100644 board/ath79/ap121/Kconfig create mode 100644 board/ath79/ap121/MAINTAINERS create mode 100644 board/ath79/ap121/Makefile create mode 100644 board/ath79/ap121/README create mode 100644board/ath79/ap121/ap121.ccreate mode 100644board/ath79/ap121/config.mkcreate mode 100644 configs/ap121_defconfig create mode 100644include/configs/ap121.harch/mips/Kconfig +0
-0arch/mips/Kconfig config TARGET_PB1X00 · line 59
Quoted 9 lines
arch/mips/Kconfig +6
-0@@ -51,6 +51,13 @@ config TARGET_PB1X00 select SUPPORTS_CPU_MIPS32_R2 select SYS_MIPS_CACHE_INIT_RAM_LOAD +config TARGET_AP121 + bool "Support ap121" + select SUPPORTS_BIG_ENDIAN + select SUPPORTS_CPU_MIPS32_R1 + select SUPPORTS_CPU_MIPS32_R2 + select SYS_MIPS_CACHE_INIT_RAM_LOAD +please create a dedicated
Kconfiginarch/mips/mach-ath79/and add this board there. Have a look at following links for examples:Ok.
Quoted 64 lines
Quoted 64 lines
arch/mips/Kconfig +1
-0endchoice @@ -59,6 +66,7 @@ source "board/imgtec/malta/Kconfig" source "board/micronas/vct/Kconfig" source "board/pb1x00/Kconfig" source "board/qemu-mips/Kconfig" +source "board/ath79/ap121/Kconfig" if MIPS diff --git a/arch/mips/dts/Makefile b/arch/mips/dts/Makefileindex 47b6eb5..6f8b413 100644
arch/mips/dts/Makefile +1
-0@@ -2,7 +2,7 @@ # SPDX-License-Identifier: GPL-2.0+ # -dtb-y += +dtb-$(CONFIG_TARGET_AP121) += ap121.dtb targets += $(dtb-y) diff --git a/arch/mips/dts/ap121.dts b/arch/mips/dts/ap121.dtsnew file mode 100644
index 0000000..769458aarch/mips/dts/ap121.dts new file +37
-0@@ -0,0 +1,37 @@ +/dts-v1/; +#include "ar933x.dtsi" + +/ { + model = "AP121 Reference Board"; + compatible = "ath79,ap121", "ath79,ar933x"; + + aliases { + spi0 = &spi0; + serial0 = &uart0; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; +}; + +&xtal { + clock-frequency = <25000000>; +}; + +&uart0 { + status = "okay"; +}; + +&spi0 { + spi-max-frequency = <25000000>; + status = "okay"; + spi-flash at 0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "spi-flash"; + memory-map = <0x9f000000 0x00800000>; + spi-max-frequency = <25000000>; + reg = <0>; + }; +};arch/mips/dts/ar933x.dtsi new file +0
-1--- /dev/nullQuoted 8 lines
arch/mips/dts/ar933x.dtsi line 4
Quoted 6 lines
+++
b/arch/mips/dts/ar933x.dtsiarch/mips/dts/ar933x.dtsi new file +4
-0@@ -0,0 +1,64 @@ +#include "skeleton.dtsi" + +/ { + compatible = "ath79,ar933x";the first part should be a vendor name and according to device-trees from kernel this should be "qca"
Ok.
Quoted 36 lines
Quoted 36 lines
arch/mips/dts/ar933x.dtsi new file +36
-0+ + #address-cells = <1>; + #size-cells = <1>; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpu at 0 { + device_type = "cpu"; + compatible = "mips,mips24Kc"; + reg = <0>; + }; + }; + + clocks { + #address-cells = <1>; + #size-cells = <1>; + ranges; + + xtal: xtal { + #clock-cells = <0>; + compatible = "fixed-clock"; + clock-output-names = "xtal"; + }; + }; + + ahb { + compatible = "simple-bus"; + ranges; + + #address-cells = <1>; + #size-cells = <1>; + + apb { + compatible = "simple-bus";Quoted 9 lines
arch/mips/dts/ar933x.dtsi line 47
Quoted 7 lines
arch/mips/dts/ar933x.dtsi new file +7
-0+ ranges; + + #address-cells = <1>; + #size-cells = <1>; + + uart0: uart at 18020000 { + compatible = "ath79,ar933x-uart";I suggest to use "qca,ar9330-uart" like the kernel driver
Ok.
Quoted 9 lines
arch/mips/dts/ar933x.dtsi line 55
Quoted 8 lines
arch/mips/dts/ar933x.dtsi new file +8
-0+ reg = <0x18020000 0x20>; + + status = "disabled"; + }; + }; + + spi0: spi at 1f000000 { + compatible = "ath79,ath79-spi";I suggest to use "qca,ar7100-spi" like the kernel driver
Ok.
Quoted 45 lines
Quoted 45 lines
arch/mips/dts/ar933x.dtsi new file +9
-0+ reg = <0x1f000000 0x10>; + + status = "disabled"; + + #address-cells = <1>; + #size-cells = <0>; + }; + }; +};board/ath79/ap121/Kconfig new file +15
-0@@ -0,0 +1,15 @@ +if TARGET_AP121 + +config SYS_BOARD + default "ap121" + +config SYS_VENDOR + default "ath79" + +config SYS_SOC + default "ath79" + +config SYS_CONFIG_NAME + default "ap121" + +endifboard/ath79/ap121/MAINTAINERS new file +6
-0@@ -0,0 +1,6 @@ +AP121 BOARD +M: Wills Wang <[email protected]> +S: Maintained +F: board/ath79/ap121/ +F: include/configs/ap121.h +F: configs/ap121_defconfigboard/ath79/ap121/Makefile new file +0
-0Quoted 8 lines
board/ath79/ap121/Makefile line 3
Quoted 7 lines
index 0000000..9132118
board/ath79/ap121/Makefile new file +3
-0@@ -0,0 +1,8 @@ +# +# (C) Copyright 2003-2006 +# Wolfgang Denk, DENX Software Engineering, wd at denx.de.again, no historic copyright needed for a simple one-line
MakefileOk.
Quoted 24 lines
Quoted 24 lines
board/ath79/ap121/Makefile new file +5
-0+# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y = ap121.oboard/ath79/ap121/README new file +9
-0@@ -0,0 +1,18 @@ +ATHEROS AP121 +================== + +Supported hardware: AP121 referance board. + +Files of the AP121 port +-------------------------- + +arch/mips/mach-ath79/ar933x/ - The CPU support code for theAtheros ar933x
+arch/mips/include/asm/arch-ath79 - Header files for the Atheros
ath79
+board/ath79/ap121/ - AP121 board specific filesQuoted 9 lines
board/ath79/ap121/README line 18
Quoted 7 lines
board/ath79/ap121/README new file +7
-0+include/configs/ap121.h - AP121 configuration file + +Configure +------------------- + +To configure for the current board + make ap121_defconfigyou can drop this README. There is no new or relevant information in it
Ok.
Quoted 16 lines
Quoted 16 lines
board/ath79/ap121/ap121.c new file +10
-0@@ -0,0 +1,17 @@ +/* +* (C) Copyright 2015 +* Wills Wang, <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <command.h> +#include <asm/mipsregs.h> Quoted 8 lines
board/ath79/ap121/ap121.c line 17
Quoted 7 lines
board/ath79/ap121/ap121.c new file +7
-0+#include <asm/addrspace.h> +#include <asm/io.h> + +int checkboard (void ) +{ +return 0 ; +}you could/should print your board name here
Quoted 2 lines
U-boot print the board model property from device tree when power up, I think it's duplicated.
yes, you are right. But checkboard is already implemented in common/board_info.c as empty and weak function. Thus you can drop your implementation.
Quoted 186 lines
Quoted 16 lines
Quoted 16 lines
board/ath79/ap121/config.mk new file +10
-0@@ -0,0 +1,16 @@ +# +# (C) Copyright 2003 +# Wolfgang Denk, DENX Software Engineering, wd at denx.de. +# +# SPDX-License-Identifier: GPL-2.0+ +# + +# +# AP121 referance board, MIPS32 core +#Quoted 8 lines
board/ath79/ap121/config.mk line 16
Quoted 6 lines
board/ath79/ap121/config.mk new file +6
-0+ +# ROM version +CONFIG_SYS_TEXT_BASE = 0x9f000000 + +# RAM version +#CONFIG_SYS_TEXT_BASE = 0x80010000config.mk files in board directory are also deprecated. Please add "#define
CONFIG_SYS_TEXT_BASE0x9f000000" toinclude/configs/ap121.hOk.
Quoted 8 lines
Quoted 8 lines
configs/ap121_defconfig new file +2
-0@@ -0,0 +1,42 @@ +CONFIG_MIPS=y +CONFIG_TARGET_AP121=yQuoted 9 lines
configs/ap121_defconfig line 7
Quoted 5 lines
configs/ap121_defconfig new file +5
-0+CONFIG_SYS_MALLOC_F_LEN=0x2000 +CONFIG_SYS_PROMPT="ap121 # " +CONFIG_OF_CONTROL=y +CONFIG_DEFAULT_DEVICE_TREE="ap121" +CONFIG_DM=yoptions like
CONFIG_OF_CONTROLandCONFIG_DMshould be pre-selected by the mach or SoC specificKconfigfile if you always require it. An user of your board should not be able to disable those options.Ok.
Quoted 40 lines
Quoted 40 lines
configs/ap121_defconfig new file +35
-0+CONFIG_DM_SERIAL=y +CONFIG_DM_SPI=y +CONFIG_DM_SPI_FLASH=y +CONFIG_ATH79_SPI=y +CONFIG_SPI_FLASH=y +CONFIG_SPI_FLASH_BAR=y +CONFIG_SPI_FLASH_ATMEL=y +CONFIG_SPI_FLASH_EON=y +CONFIG_SPI_FLASH_GIGADEVICE=y +CONFIG_SPI_FLASH_MACRONIX=y +CONFIG_SPI_FLASH_SPANSION=y +CONFIG_SPI_FLASH_STMICRO=y +CONFIG_SPI_FLASH_SST=y +CONFIG_SPI_FLASH_WINBOND=y +CONFIG_SPI_FLASH_USE_4K_SECTORS=y +CONFIG_SPI_FLASH_DATAFLASH=y +CONFIG_SPI_FLASH_MTD=y +CONFIG_CMD_DM=y +CONFIG_CMD_SF=y +CONFIG_CMD_SPI=y +# CONFIG_NET is not set +# CONFIG_CMD_BDI is not set +# CONFIG_CMD_CONSOLE is not set +# CONFIG_CMD_IMLS is not set +# CONFIG_CMD_XIMG is not set +# CONFIG_CMD_ELF is not set +# CONFIG_CMD_EXPORTENV is not set +# CONFIG_CMD_IMPORTENV is not set +# CONFIG_CMD_EDITENV is not set +# CONFIG_CMD_CRC32 is not set +# CONFIG_CMD_FLASH is not set +# CONFIG_CMD_FPGA is not set +# CONFIG_CMD_NFS is not set +# CONFIG_CMD_NET is not set +CONFIG_USE_PRIVATE_LIBGCC=yinclude/configs/ap121.h new file +0
-0Quoted 8 lines
include/configs/ap121.h line 5
Quoted 6 lines
include/configs/ap121.h new file +5
-0@@ -0,0 +1,82 @@ +#ifndef __CONFIG_H +#define __CONFIG_H + +#include <linux/kconfig.h> +#include <linux/sizes.h> those includes are not needed in a board config header file respectively they are already included implicitely
Ok.
Quoted 5 lines
include/configs/ap121.h line 8
Quoted 3 lines
include/configs/ap121.h new file +3
-0+ +#define CONFIG_ARCH_ATH79 +#define CONFIG_SOC_AR933X this is already configured by
KconfigOk.
Quoted 7 lines
Quoted 7 lines
include/configs/ap121.h new file +7
-0+ +#define CONFIG_DISPLAY_CPUINFO +#define CONFIG_DISPLAY_BOARDINFO + +#define CONFIG_OF_LIBFDT + +#define CONFIG_SYS_HZ 1000Quoted 8 lines
include/configs/ap121.h line 22
Quoted 7 lines
include/configs/ap121.h new file +7
-0+#define CONFIG_SYS_MHZ 200 +#define CONFIG_SYS_MIPS_TIMER_FREQ (CONFIG_SYS_MHZ * 1000000) + +/* Cache Configuration */ +#define CONFIG_SYS_DCACHE_SIZE 32 * SZ_1K +#define CONFIG_SYS_ICACHE_SIZE 64 * SZ_1K +#define CONFIG_SYS_CACHELINE_SIZE 32you can drop this, the cache sizes will be detected automatically
I have a try later, i will drop this if it work fine.
Quoted 6 lines
Quoted 5 lines
include/configs/ap121.h new file +4
-0+ +#define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE + +#define CONFIG_SYS_MALLOC_LEN ROUND(0x30000 + 128 * SZ_1K,
0x1000)no need for a magic calculation, please choose a fixed value
Ok.
Quoted 11 lines
include/configs/ap121.h line 36
Quoted 10 lines
include/configs/ap121.h new file +10
-0+ +#define CONFIG_SYS_BOOTPARAMS_LEN 128 * SZ_1K + +#define CONFIG_SYS_SDRAM_BASE 0x80000000 +#define CONFIG_SYS_LOAD_ADDR 0x81000000 + +#define CONFIG_SYS_INIT_SP_OFFSET 0x20000 +#define CONFIG_SYS_NO_FLASH + +#define CONFIG_AR933X_SERIAL this is already configured by
KconfigOk.
Quoted 33 lines
Quoted 33 lines
include/configs/ap121.h new file +2
-0+#define CONFIG_BAUDRATE 115200 +#define CONFIG_SYS_BAUDRATE_TABLE {9600, 19200, 38400, 57600,115200}
include/configs/ap121.h new file +12
-0+ +#define CONFIG_BOOTDELAY 3 +#define CONFIG_BOOTARGS "console=ttyS0,115200 " \ + "root=/dev/mtdblock2 " \ + "rootfstype=squashfs" +#define CONFIG_BOOTCOMMAND "sf probe;" \ + "mtdparts default;" \ + "bootm 0x9f300000" +#define CONFIG_LZMA + +#define MTDIDS_DEFAULT "nor0=spi-flash.0" +#define MTDPARTS_DEFAULT "mtdparts=spi-flash.0:256k(u-boot)," \
+ "64k(u-boot-env),2752k(rootfs),896k(uImage),64k(NVRAM),64k(ART)"include/configs/ap121.h new file +15
-0+ +#define CONFIG_ENV_SPI_MAX_HZ 25000000 +#define CONFIG_ENV_IS_IN_SPI_FLASH +#define CONFIG_ENV_OFFSET (256 * SZ_1K) +#define CONFIG_ENV_SECT_SIZE (64 * SZ_1K) +#define CONFIG_ENV_SIZE (64 * SZ_1K) + +/* +* Command +*/ +#define CONFIG_CMD_MTDPARTS + +/* Miscellaneous configurable options */ +#define CONFIG_SYS_CBSIZE 256 +#define CONFIG_SYS_MAXARGS 16Quoted 8 lines
include/configs/ap121.h line 73
Quoted 7 lines
include/configs/ap121.h new file +7
-0+#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \ + sizeof(CONFIG_SYS_PROMPT) + 16) +#define CONFIG_SYS_LONGHELP +#define CONFIG_CMDLINE_EDITING +#define CONFIG_AUTO_COMPLETE +#define CONFIG_SYS_HUSH_PARSER +#define CONFIG_SYS_PROMPT_HUSH_PS2 "> "this is already configured by
KconfigOk.
Quoted 10 lines
Quoted 10 lines
include/configs/ap121.h new file +9
-0+ +/* +* Diagnostics +*/ +#define CONFIG_SYS_MEMTEST_START 0x80100000 +#define CONFIG_SYS_MEMTEST_END 0x83f00000 +#define CONFIG_CMD_MEMTEST + +#endif /* __CONFIG_H */
Signature · 1 line
- Daniel
PATCH v4 6/8 mips: ath79: add AP121 reference board
In reply to Daniel SchwierzeckQuoted 396 lines · Daniel Schwierzeck
Am 25.12.2015 um 19:56 schrieb Wills Wang:
Quoted 36 lines
Signed-off-by Wills Wang <[email protected]>---
Changes in v4: None
Changes in v3: None
Changes in v2: Nonearch/mips/Kconfig | 8 +++++ arch/mips/dts/Makefile | 2 +- arch/mips/dts/ap121.dts | 37 +++++++++++++++++++ arch/mips/dts/ar933x.dtsi | 64 +++++++++++++++++++++++++++++++++ board/ath79/ap121/Kconfig | 15 ++++++++ board/ath79/ap121/MAINTAINERS | 6 ++++ board/ath79/ap121/Makefile | 8 +++++ board/ath79/ap121/README | 18 ++++++++++ board/ath79/ap121/ap121.c | 17 +++++++++ board/ath79/ap121/config.mk | 16 +++++++++ configs/ap121_defconfig | 42 ++++++++++++++++++++++ include/configs/ap121.h | 82 +++++++++++++++++++++++++++++++++++++++++++ 12 files changed, 314 insertions(+), 1 deletion(-)create mode 100644
arch/mips/dts/ap121.dtscreate mode 100644arch/mips/dts/ar933x.dtsicreate mode 100644 board/ath79/ap121/Kconfig create mode 100644 board/ath79/ap121/MAINTAINERS create mode 100644 board/ath79/ap121/Makefile create mode 100644 board/ath79/ap121/README create mode 100644board/ath79/ap121/ap121.ccreate mode 100644board/ath79/ap121/config.mkcreate mode 100644 configs/ap121_defconfig create mode 100644include/configs/ap121.harch/mips/Kconfig +0
-0arch/mips/Kconfig config TARGET_PB1X00 · line 60
Quoted 10 lines
arch/mips/Kconfig +7
-0@@ -51,6 +51,13 @@ config TARGET_PB1X00 select SUPPORTS_CPU_MIPS32_R2 select SYS_MIPS_CACHE_INIT_RAM_LOAD +config TARGET_AP121 + bool "Support ap121" + select SUPPORTS_BIG_ENDIAN + select SUPPORTS_CPU_MIPS32_R1 + select SUPPORTS_CPU_MIPS32_R2 + select SYS_MIPS_CACHE_INIT_RAM_LOAD +please create a dedicated
Kconfiginarch/mips/mach-ath79/and add this board there. Have a look at following links for examples:http://patchwork.ozlabs.org/patch/558465/
http://patchwork.ozlabs.org/patch/558469/Quoted 73 lines
arch/mips/Kconfig +1
-0endchoice@@ -59,6 +66,7 @@ source "board/imgtec/malta/Kconfig" source "board/micronas/vct/Kconfig" source "board/pb1x00/Kconfig" source "board/qemu-mips/Kconfig" +source "board/ath79/ap121/Kconfig" if MIPSarch/mips/dts/Makefile +1
-1@@ -2,7 +2,7 @@ # SPDX-License-Identifier: GPL-2.0+ # -dtb-y += +dtb-$(CONFIG_TARGET_AP121) += ap121.dtb targets += $(dtb-y)arch/mips/dts/ap121.dts new file +37
-0@@ -0,0 +1,37 @@ +/dts-v1/; +#include "ar933x.dtsi" + +/ { + model = "AP121 Reference Board"; + compatible = "ath79,ap121", "ath79,ar933x"; + + aliases { + spi0 = &spi0; + serial0 = &uart0; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; +}; + +&xtal { + clock-frequency = <25000000>; +}; + +&uart0 { + status = "okay"; +}; + +&spi0 { + spi-max-frequency = <25000000>; + status = "okay"; + spi-flash at 0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "spi-flash"; + memory-map = <0x9f000000 0x00800000>; + spi-max-frequency = <25000000>; + reg = <0>; + }; +};arch/mips/dts/ar933x.dtsi new file +0
-0arch/mips/dts/ar933x.dtsi line 4
Quoted 4 lines
arch/mips/dts/ar933x.dtsi new file +4
-0@@ -0,0 +1,64 @@ +#include "skeleton.dtsi" + +/ { + compatible = "ath79,ar933x";the first part should be a vendor name and according to device-trees from kernel this should be "qca"
Quoted 33 lines
arch/mips/dts/ar933x.dtsi new file +33
-0+ + #address-cells = <1>; + #size-cells = <1>; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpu at 0 { + device_type = "cpu"; + compatible = "mips,mips24Kc"; + reg = <0>; + }; + }; + + clocks { + #address-cells = <1>; + #size-cells = <1>; + ranges; + + xtal: xtal { + #clock-cells = <0>; + compatible = "fixed-clock"; + clock-output-names = "xtal"; + }; + }; + + ahb { + compatible = "simple-bus"; + ranges; + + #address-cells = <1>; + #size-cells = <1>;arch/mips/dts/ar933x.dtsi line 47
Quoted 10 lines
arch/mips/dts/ar933x.dtsi new file +10
-0+ + apb { + compatible = "simple-bus"; + ranges; + + #address-cells = <1>; + #size-cells = <1>; + + uart0: uart at 18020000 { + compatible = "ath79,ar933x-uart";I suggest to use "qca,ar9330-uart" like the kernel driver
arch/mips/dts/ar933x.dtsi line 55
Quoted 8 lines
arch/mips/dts/ar933x.dtsi new file +8
-0+ reg = <0x18020000 0x20>; + + status = "disabled"; + }; + }; + + spi0: spi at 1f000000 { + compatible = "ath79,ath79-spi";I suggest to use "qca,ar7100-spi" like the kernel driver
Quoted 48 lines
arch/mips/dts/ar933x.dtsi new file +9
-0+ reg = <0x1f000000 0x10>; + + status = "disabled"; + + #address-cells = <1>; + #size-cells = <0>; + }; + }; +};board/ath79/ap121/Kconfig new file +15
-0@@ -0,0 +1,15 @@ +if TARGET_AP121 + +config SYS_BOARD + default "ap121" + +config SYS_VENDOR + default "ath79" + +config SYS_SOC + default "ath79" + +config SYS_CONFIG_NAME + default "ap121" + +endifboard/ath79/ap121/MAINTAINERS new file +6
-0@@ -0,0 +1,6 @@ +AP121 BOARD +M: Wills Wang <[email protected]> +S: Maintained +F: board/ath79/ap121/ +F: include/configs/ap121.h +F: configs/ap121_defconfigboard/ath79/ap121/Makefile new file +0
-0board/ath79/ap121/Makefile line 3
Quoted 3 lines
board/ath79/ap121/Makefile new file +3
-0@@ -0,0 +1,8 @@ +# +# (C) Copyright 2003-2006 +# Wolfgang Denk, DENX Software Engineering, wd at denx.de.again, no historic copyright needed for a simple one-line
MakefileQuoted 19 lines
board/ath79/ap121/Makefile new file +5
-0+# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y = ap121.oboard/ath79/ap121/README new file +8
-0@@ -0,0 +1,18 @@ +ATHEROS AP121 +================== + +Supported hardware: AP121 referance board. + +Files of the AP121 port +-------------------------- +board/ath79/ap121/README line 18
Quoted 10 lines
board/ath79/ap121/README new file +10
-0+arch/mips/mach-ath79/ar933x/ - The CPU support code for the Atheros ar933x +arch/mips/include/asm/arch-ath79 - Header files for the Atheros ath79 +board/ath79/ap121/ - AP121 board specific files +include/configs/ap121.h - AP121 configuration file + +Configure +------------------- + +To configure for the current board + make ap121_defconfigyou can drop this README. There is no new or relevant information in it
Quoted 13 lines
board/ath79/ap121/ap121.c new file +7
-0@@ -0,0 +1,17 @@ +/* +* (C) Copyright 2015 +* Wills Wang, <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ +board/ath79/ap121/ap121.c line 17
Quoted 10 lines
board/ath79/ap121/ap121.c new file +10
-0+#include <common.h> +#include <command.h> +#include <asm/mipsregs.h> +#include <asm/addrspace.h> +#include <asm/io.h> + +int checkboard (void ) +{ +return 0 ; +}you could/should print your board name here
Quoted 12 lines
board/ath79/ap121/config.mk new file +6
-0@@ -0,0 +1,16 @@ +# +# (C) Copyright 2003 +# Wolfgang Denk, DENX Software Engineering, wd at denx.de. +# +# SPDX-License-Identifier: GPL-2.0+ +#board/ath79/ap121/config.mk line 16
Quoted 10 lines
board/ath79/ap121/config.mk new file +10
-0+ +# +# AP121 referance board, MIPS32 core +# + +# ROM version +CONFIG_SYS_TEXT_BASE = 0x9f000000 + +# RAM version +#CONFIG_SYS_TEXT_BASE = 0x80010000config.mk files in board directory are also deprecated. Please add "#define
CONFIG_SYS_TEXT_BASE0x9f000000" toinclude/configs/ap121.hconfigs/ap121_defconfig line 7
Quoted 13 lines
configs/ap121_defconfig new file +7
-0@@ -0,0 +1,42 @@ +CONFIG_MIPS=y +CONFIG_TARGET_AP121=y +CONFIG_SYS_MALLOC_F_LEN=0x2000 +CONFIG_SYS_PROMPT="ap121 # " +CONFIG_OF_CONTROL=y +CONFIG_DEFAULT_DEVICE_TREE="ap121" +CONFIG_DM=yoptions like
CONFIG_OF_CONTROLandCONFIG_DMshould be pre-selected by the mach or SoC specificKconfigfile if you always require it. An user of your board should not be able to disable those options.Quoted 41 lines
configs/ap121_defconfig new file +35
-0+CONFIG_DM_SERIAL=y +CONFIG_DM_SPI=y +CONFIG_DM_SPI_FLASH=y +CONFIG_ATH79_SPI=y +CONFIG_SPI_FLASH=y +CONFIG_SPI_FLASH_BAR=y +CONFIG_SPI_FLASH_ATMEL=y +CONFIG_SPI_FLASH_EON=y +CONFIG_SPI_FLASH_GIGADEVICE=y +CONFIG_SPI_FLASH_MACRONIX=y +CONFIG_SPI_FLASH_SPANSION=y +CONFIG_SPI_FLASH_STMICRO=y +CONFIG_SPI_FLASH_SST=y +CONFIG_SPI_FLASH_WINBOND=y +CONFIG_SPI_FLASH_USE_4K_SECTORS=y +CONFIG_SPI_FLASH_DATAFLASH=y +CONFIG_SPI_FLASH_MTD=y +CONFIG_CMD_DM=y +CONFIG_CMD_SF=y +CONFIG_CMD_SPI=y +# CONFIG_NET is not set +# CONFIG_CMD_BDI is not set +# CONFIG_CMD_CONSOLE is not set +# CONFIG_CMD_IMLS is not set +# CONFIG_CMD_XIMG is not set +# CONFIG_CMD_ELF is not set +# CONFIG_CMD_EXPORTENV is not set +# CONFIG_CMD_IMPORTENV is not set +# CONFIG_CMD_EDITENV is not set +# CONFIG_CMD_CRC32 is not set +# CONFIG_CMD_FLASH is not set +# CONFIG_CMD_FPGA is not set +# CONFIG_CMD_NFS is not set +# CONFIG_CMD_NET is not set +CONFIG_USE_PRIVATE_LIBGCC=yinclude/configs/ap121.h new file +0
-0include/configs/ap121.h line 5
Quoted 5 lines
include/configs/ap121.h new file +5
-0@@ -0,0 +1,82 @@ +#ifndef __CONFIG_H +#define __CONFIG_H + +#include <linux/kconfig.h> +#include <linux/sizes.h> those includes are not needed in a board config header file respectively they are already included implicitely
include/configs/ap121.h line 8
Quoted 3 lines
include/configs/ap121.h new file +3
-0+ +#define CONFIG_ARCH_ATH79 +#define CONFIG_SOC_AR933X this is already configured by
Kconfig
Quoted 15 lines
Quoted 4 lines
include/configs/ap121.h new file +4
-0+ +#define CONFIG_DISPLAY_CPUINFO +#define CONFIG_DISPLAY_BOARDINFO +include/configs/ap121.h line 22
Quoted 10 lines
include/configs/ap121.h new file +10
-0+#define CONFIG_OF_LIBFDT + +#define CONFIG_SYS_HZ 1000 +#define CONFIG_SYS_MHZ 200 +#define CONFIG_SYS_MIPS_TIMER_FREQ (CONFIG_SYS_MHZ * 1000000) + +/* Cache Configuration */ +#define CONFIG_SYS_DCACHE_SIZE 32 * SZ_1K +#define CONFIG_SYS_ICACHE_SIZE 64 * SZ_1K +#define CONFIG_SYS_CACHELINE_SIZE 32you can drop this, the cache sizes will be detected automatically
My board don't boot up if drop this.
Quoted 67 lines
include/configs/ap121.h line 26
Quoted 4 lines
include/configs/ap121.h new file +4
-0+ +#define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE + +#define CONFIG_SYS_MALLOC_LEN ROUND(0x30000 + 128 * SZ_1K, 0x1000)no need for a magic calculation, please choose a fixed value
include/configs/ap121.h line 36
Quoted 10 lines
include/configs/ap121.h new file +10
-0+ +#define CONFIG_SYS_BOOTPARAMS_LEN 128 * SZ_1K + +#define CONFIG_SYS_SDRAM_BASE 0x80000000 +#define CONFIG_SYS_LOAD_ADDR 0x81000000 + +#define CONFIG_SYS_INIT_SP_OFFSET 0x20000 +#define CONFIG_SYS_NO_FLASH + +#define CONFIG_AR933X_SERIAL this is already configured by
KconfigQuoted 27 lines
include/configs/ap121.h new file +27
-0+#define CONFIG_BAUDRATE 115200 +#define CONFIG_SYS_BAUDRATE_TABLE {9600, 19200, 38400, 57600, 115200} + +#define CONFIG_BOOTDELAY 3 +#define CONFIG_BOOTARGS "console=ttyS0,115200 " \ + "root=/dev/mtdblock2 " \ + "rootfstype=squashfs" +#define CONFIG_BOOTCOMMAND "sf probe;" \ + "mtdparts default;" \ + "bootm 0x9f300000" +#define CONFIG_LZMA + +#define MTDIDS_DEFAULT "nor0=spi-flash.0" +#define MTDPARTS_DEFAULT "mtdparts=spi-flash.0:256k(u-boot)," \ + "64k(u-boot-env),2752k(rootfs),896k(uImage),64k(NVRAM),64k(ART)" + +#define CONFIG_ENV_SPI_MAX_HZ 25000000 +#define CONFIG_ENV_IS_IN_SPI_FLASH +#define CONFIG_ENV_OFFSET (256 * SZ_1K) +#define CONFIG_ENV_SECT_SIZE (64 * SZ_1K) +#define CONFIG_ENV_SIZE (64 * SZ_1K) + +/* +* Command +*/ +#define CONFIG_CMD_MTDPARTS +include/configs/ap121.h line 73
Quoted 10 lines
include/configs/ap121.h new file +10
-0+/* Miscellaneous configurable options */ +#define CONFIG_SYS_CBSIZE 256 +#define CONFIG_SYS_MAXARGS 16 +#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \ + sizeof(CONFIG_SYS_PROMPT) + 16) +#define CONFIG_SYS_LONGHELP +#define CONFIG_CMDLINE_EDITING +#define CONFIG_AUTO_COMPLETE +#define CONFIG_SYS_HUSH_PARSER +#define CONFIG_SYS_PROMPT_HUSH_PS2 "> "this is already configured by
KconfigQuoted 10 lines
include/configs/ap121.h new file +9
-0+ +/* +* Diagnostics +*/ +#define CONFIG_SYS_MEMTEST_START 0x80100000 +#define CONFIG_SYS_MEMTEST_END 0x83f00000 +#define CONFIG_CMD_MEMTEST + +#endif /* __CONFIG_H */
PATCH v4 6/8 mips: ath79: add AP121 reference board
Quoted 3 lines · Wills Wang
Quoted 2 lines · Daniel Schwierzeck
Am 25.12.2015 um 19:56 schrieb Wills Wang:
Quoted 1 line
Signed-off-by Wills Wang <[email protected]>
[...]
Quoted 45 lines
Quoted 45 lines
configs/ap121_defconfig line 7
Quoted 13 lines
configs/ap121_defconfig new file +7
-0@@ -0,0 +1,42 @@ +CONFIG_MIPS=y +CONFIG_TARGET_AP121=y +CONFIG_SYS_MALLOC_F_LEN=0x2000 +CONFIG_SYS_PROMPT="ap121 # " +CONFIG_OF_CONTROL=y +CONFIG_DEFAULT_DEVICE_TREE="ap121" +CONFIG_DM=yoptions like
CONFIG_OF_CONTROLandCONFIG_DMshould be pre-selected by the mach or SoC specificKconfigfile if you always require it. An user of your board should not be able to disable those options.Quoted 27 lines
configs/ap121_defconfig new file +27
-0+CONFIG_DM_SERIAL=y +CONFIG_DM_SPI=y +CONFIG_DM_SPI_FLASH=y +CONFIG_ATH79_SPI=y +CONFIG_SPI_FLASH=y +CONFIG_SPI_FLASH_BAR=y +CONFIG_SPI_FLASH_ATMEL=y +CONFIG_SPI_FLASH_EON=y +CONFIG_SPI_FLASH_GIGADEVICE=y +CONFIG_SPI_FLASH_MACRONIX=y +CONFIG_SPI_FLASH_SPANSION=y +CONFIG_SPI_FLASH_STMICRO=y +CONFIG_SPI_FLASH_SST=y +CONFIG_SPI_FLASH_WINBOND=y +CONFIG_SPI_FLASH_USE_4K_SECTORS=y +CONFIG_SPI_FLASH_DATAFLASH=y +CONFIG_SPI_FLASH_MTD=y +CONFIG_CMD_DM=y +CONFIG_CMD_SF=y +CONFIG_CMD_SPI=y +# CONFIG_NET is not set +# CONFIG_CMD_BDI is not set +# CONFIG_CMD_CONSOLE is not set +# CONFIG_CMD_IMLS is not set +# CONFIG_CMD_XIMG is not set +# CONFIG_CMD_ELF is not set +# CONFIG_CMD_EXPORTENV is not set
Quoted 8 lines
Quoted 8 lines
configs/ap121_defconfig line 42
Quoted 8 lines
configs/ap121_defconfig new file +8
-0+# CONFIG_CMD_IMPORTENV is not set +# CONFIG_CMD_EDITENV is not set +# CONFIG_CMD_CRC32 is not set +# CONFIG_CMD_FLASH is not set +# CONFIG_CMD_FPGA is not set +# CONFIG_CMD_NFS is not set +# CONFIG_CMD_NET is not set +CONFIG_USE_PRIVATE_LIBGCC=y
Why is private libgcc enabled here ? Is your toolchain buggy ?
Quoted 38 lines
Quoted 21 lines
include/configs/ap121.h line 5
Quoted 11 lines
include/configs/ap121.h new file +5
-0@@ -0,0 +1,82 @@ +#ifndef __CONFIG_H +#define __CONFIG_H + +#include <linux/kconfig.h> +#include <linux/sizes.h> those includes are not needed in a board config header file respectively they are already included implicitely
include/configs/ap121.h line 8
Quoted 3 lines
include/configs/ap121.h new file +3
-0+ +#define CONFIG_ARCH_ATH79 +#define CONFIG_SOC_AR933X this is already configured by
KconfigQuoted 16 lines
Quoted 4 lines
include/configs/ap121.h new file +4
-0+ +#define CONFIG_DISPLAY_CPUINFO +#define CONFIG_DISPLAY_BOARDINFO +include/configs/ap121.h line 22
Quoted 10 lines
include/configs/ap121.h new file +10
-0+#define CONFIG_OF_LIBFDT + +#define CONFIG_SYS_HZ 1000 +#define CONFIG_SYS_MHZ 200 +#define CONFIG_SYS_MIPS_TIMER_FREQ (CONFIG_SYS_MHZ * 1000000) + +/* Cache Configuration */ +#define CONFIG_SYS_DCACHE_SIZE 32 * SZ_1K +#define CONFIG_SYS_ICACHE_SIZE 64 * SZ_1K +#define CONFIG_SYS_CACHELINE_SIZE 32you can drop this, the cache sizes will be detected automatically
Quoted 1 line
My board don't boot up if drop this.
btw please use the [...] to trim your reply to relevant parts only, it's often real hard to find the relevant one-liner reply in a sea of quoted text.
[...]
PATCH v4 6/8 mips: ath79: add AP121 reference board
Quoted 51 lines · Marek Vasut
Quoted 3 lines · Wills Wang
Quoted 2 lines · Daniel Schwierzeck
Am 25.12.2015 um 19:56 schrieb Wills Wang:
Quoted 1 line
Signed-off-by Wills Wang <[email protected]>[...]
Quoted 45 lines
Quoted 45 lines
configs/ap121_defconfig line 7
Quoted 13 lines
configs/ap121_defconfig new file +7
-0@@ -0,0 +1,42 @@ +CONFIG_MIPS=y +CONFIG_TARGET_AP121=y +CONFIG_SYS_MALLOC_F_LEN=0x2000 +CONFIG_SYS_PROMPT="ap121 # " +CONFIG_OF_CONTROL=y +CONFIG_DEFAULT_DEVICE_TREE="ap121" +CONFIG_DM=yoptions like
CONFIG_OF_CONTROLandCONFIG_DMshould be pre-selected by the mach or SoC specificKconfigfile if you always require it. An user of your board should not be able to disable those options.Quoted 28 lines
configs/ap121_defconfig new file +28
-0+CONFIG_DM_SERIAL=y +CONFIG_DM_SPI=y +CONFIG_DM_SPI_FLASH=y +CONFIG_ATH79_SPI=y +CONFIG_SPI_FLASH=y +CONFIG_SPI_FLASH_BAR=y +CONFIG_SPI_FLASH_ATMEL=y +CONFIG_SPI_FLASH_EON=y +CONFIG_SPI_FLASH_GIGADEVICE=y +CONFIG_SPI_FLASH_MACRONIX=y +CONFIG_SPI_FLASH_SPANSION=y +CONFIG_SPI_FLASH_STMICRO=y +CONFIG_SPI_FLASH_SST=y +CONFIG_SPI_FLASH_WINBOND=y +CONFIG_SPI_FLASH_USE_4K_SECTORS=y +CONFIG_SPI_FLASH_DATAFLASH=y +CONFIG_SPI_FLASH_MTD=y +CONFIG_CMD_DM=y +CONFIG_CMD_SF=y +CONFIG_CMD_SPI=y +# CONFIG_NET is not set +# CONFIG_CMD_BDI is not set +# CONFIG_CMD_CONSOLE is not set +# CONFIG_CMD_IMLS is not set +# CONFIG_CMD_XIMG is not set +# CONFIG_CMD_ELF is not set +# CONFIG_CMD_EXPORTENV is not set +# CONFIG_CMD_IMPORTENV is not set
Quoted 8 lines
Quoted 7 lines
Quoted 7 lines
configs/ap121_defconfig line 42
Quoted 7 lines
configs/ap121_defconfig new file +7
-0+# CONFIG_CMD_EDITENV is not set +# CONFIG_CMD_CRC32 is not set +# CONFIG_CMD_FLASH is not set +# CONFIG_CMD_FPGA is not set +# CONFIG_CMD_NFS is not set +# CONFIG_CMD_NET is not set +CONFIG_USE_PRIVATE_LIBGCC=yWhy is private libgcc enabled here ? Is your toolchain buggy ?
Follow from dbau1000_defconfig.
Quoted 42 lines
Quoted 34 lines
Quoted 19 lines
include/configs/ap121.h line 5
Quoted 11 lines
include/configs/ap121.h new file +5
-0@@ -0,0 +1,82 @@ +#ifndef __CONFIG_H +#define __CONFIG_H + +#include <linux/kconfig.h> +#include <linux/sizes.h> those includes are not needed in a board config header file respectively they are already included implicitely
include/configs/ap121.h line 8
Quoted 3 lines
include/configs/ap121.h new file +3
-0+ +#define CONFIG_ARCH_ATH79 +#define CONFIG_SOC_AR933X this is already configured by
KconfigQuoted 15 lines
Quoted 4 lines
include/configs/ap121.h new file +4
-0+ +#define CONFIG_DISPLAY_CPUINFO +#define CONFIG_DISPLAY_BOARDINFO +include/configs/ap121.h line 22
Quoted 10 lines
include/configs/ap121.h new file +10
-0+#define CONFIG_OF_LIBFDT + +#define CONFIG_SYS_HZ 1000 +#define CONFIG_SYS_MHZ 200 +#define CONFIG_SYS_MIPS_TIMER_FREQ (CONFIG_SYS_MHZ * 1000000) + +/* Cache Configuration */ +#define CONFIG_SYS_DCACHE_SIZE 32 * SZ_1K +#define CONFIG_SYS_ICACHE_SIZE 64 * SZ_1K +#define CONFIG_SYS_CACHELINE_SIZE 32you can drop this, the cache sizes will be detected automatically
Quoted 1 line
My board don't boot up if drop this.
btw please use the [...] to trim your reply to relevant parts only, it's often real hard to find the relevant one-liner reply in a sea of quoted text.
[...]
PATCH v4 6/8 mips: ath79: add AP121 reference board
Quoted 64 lines · Wills Wang
Quoted 54 lines · Marek Vasut
Quoted 3 lines · Wills Wang
Quoted 2 lines · Daniel Schwierzeck
Am 25.12.2015 um 19:56 schrieb Wills Wang:
Quoted 1 line
Signed-off-by Wills Wang <[email protected]>[...]
Quoted 47 lines
Quoted 47 lines
configs/ap121_defconfig line 7
Quoted 13 lines
configs/ap121_defconfig new file +7
-0@@ -0,0 +1,42 @@ +CONFIG_MIPS=y +CONFIG_TARGET_AP121=y +CONFIG_SYS_MALLOC_F_LEN=0x2000 +CONFIG_SYS_PROMPT="ap121 # " +CONFIG_OF_CONTROL=y +CONFIG_DEFAULT_DEVICE_TREE="ap121" +CONFIG_DM=yoptions like
CONFIG_OF_CONTROLandCONFIG_DMshould be pre-selected by the mach or SoC specificKconfigfile if you always require it. An user of your board should not be able to disable those options.Quoted 29 lines
configs/ap121_defconfig new file +29
-0+CONFIG_DM_SERIAL=y +CONFIG_DM_SPI=y +CONFIG_DM_SPI_FLASH=y +CONFIG_ATH79_SPI=y +CONFIG_SPI_FLASH=y +CONFIG_SPI_FLASH_BAR=y +CONFIG_SPI_FLASH_ATMEL=y +CONFIG_SPI_FLASH_EON=y +CONFIG_SPI_FLASH_GIGADEVICE=y +CONFIG_SPI_FLASH_MACRONIX=y +CONFIG_SPI_FLASH_SPANSION=y +CONFIG_SPI_FLASH_STMICRO=y +CONFIG_SPI_FLASH_SST=y +CONFIG_SPI_FLASH_WINBOND=y +CONFIG_SPI_FLASH_USE_4K_SECTORS=y +CONFIG_SPI_FLASH_DATAFLASH=y +CONFIG_SPI_FLASH_MTD=y +CONFIG_CMD_DM=y +CONFIG_CMD_SF=y +CONFIG_CMD_SPI=y +# CONFIG_NET is not set +# CONFIG_CMD_BDI is not set +# CONFIG_CMD_CONSOLE is not set +# CONFIG_CMD_IMLS is not set +# CONFIG_CMD_XIMG is not set +# CONFIG_CMD_ELF is not set +# CONFIG_CMD_EXPORTENV is not set +# CONFIG_CMD_IMPORTENV is not set +# CONFIG_CMD_EDITENV is not setQuoted 8 lines
Quoted 6 lines
Quoted 6 lines
configs/ap121_defconfig line 42
Quoted 6 lines
configs/ap121_defconfig new file +6
-0+# CONFIG_CMD_CRC32 is not set +# CONFIG_CMD_FLASH is not set +# CONFIG_CMD_FPGA is not set +# CONFIG_CMD_NFS is not set +# CONFIG_CMD_NET is not set +CONFIG_USE_PRIVATE_LIBGCC=yWhy is private libgcc enabled here ? Is your toolchain buggy ?
Quoted 1 line
Follow from
dbau1000_defconfig.
Daniel, can you clarify why this is enabled ?
[...]
PATCH v4 7/8 mips: support optimize tuning for same common processor cores
In reply to a message not in the archive---
Changes in v4: None
Changes in v3: None
Changes in v2: None
arch/mips/Makefile | 7 +++++++ 1 file changed, 7 insertions(+)
arch/mips/Makefile +7 -0
@@ -2,6 +2,13 @@ # SPDX-License-Identifier: GPL-2.0+ # +tune-$(CONFIG_OPTIMIZE_CPU_MIPS_4KC) =-mtune=4kc +tune-$(CONFIG_OPTIMIZE_CPU_MIPS_24KC) =-mtune=24kc + +tune-y := $(tune-y) + +PLATFORM_CPPFLAGS += $(tune-y) + head-y := arch/mips/cpu/start.o libs-y += arch/mips/cpu/
Signature · 1 line
1.9.1
PATCH v4 7/8 mips: support optimize tuning for same common processor cores
On Friday, December 25, 2015 at 07:56:27 PM, Wills Wang wrote:
Missing commit message. There is exactly zero explanation why this patch is necessary/beneficial/whatever . I just do not understand why we should pick this patch.
Quoted 18 lines
Signed-off-by Wills Wang <[email protected]>---
Changes in v4: None
Changes in v3: None
Changes in v2: Nonearch/mips/Makefile | 7 +++++++ 1 file changed, 7 insertions(+)arch/mips/Makefile +0
-0@@ -2,6 +2,13 @@ # SPDX-License-Identifier: GPL-2.0+ #
arch/mips/Makefile line 14
Quoted 10 lines
arch/mips/Makefile +7
-0+tune-$(CONFIG_OPTIMIZE_CPU_MIPS_4KC) =-mtune=4kc +tune-$(CONFIG_OPTIMIZE_CPU_MIPS_24KC) =-mtune=24kc + +tune-y := $(tune-y) + +PLATFORM_CPPFLAGS += $(tune-y) + head-y := arch/mips/cpu/start.o libs-y += arch/mips/cpu/
Best regards,
Marek Vasut
PATCH v4 7/8 mips: support optimize tuning for same common processor cores
In reply to Wills WangAm 25.12.2015 um 19:56 schrieb Wills Wang:
Quoted 6 lines
Signed-off-by Wills Wang <[email protected]>---
Changes in v4: None
Changes in v3: None
Changes in v2: None
I would prefer it like this [1] so you can drop patches 07/08 and 08/08.
[1] http://patchwork.ozlabs.org/patch/561113/
Quoted 23 lines
arch/mips/Makefile | 7 +++++++ 1 file changed, 7 insertions(+)arch/mips/Makefile +7
-0@@ -2,6 +2,13 @@ # SPDX-License-Identifier: GPL-2.0+ # +tune-$(CONFIG_OPTIMIZE_CPU_MIPS_4KC) =-mtune=4kc +tune-$(CONFIG_OPTIMIZE_CPU_MIPS_24KC) =-mtune=24kc + +tune-y := $(tune-y) + +PLATFORM_CPPFLAGS += $(tune-y) + head-y := arch/mips/cpu/start.o libs-y += arch/mips/cpu/
Signature · 1 line
- Daniel
PATCH v4 7/8 mips: support optimize tuning for same common processor cores
Quoted 11 lines · Daniel Schwierzeck
Am 25.12.2015 um 19:56 schrieb Wills Wang:
Quoted 6 lines
Signed-off-by Wills Wang <[email protected]>---
Changes in v4: None
Changes in v3: None
Changes in v2: NoneI would prefer it like this [1] so you can drop patches 07/08 and 08/08.
Ok.
Quoted 22 lines
Quoted 22 lines
arch/mips/Makefile | 7 +++++++ 1 file changed, 7 insertions(+)arch/mips/Makefile +7
-0@@ -2,6 +2,13 @@ # SPDX-License-Identifier: GPL-2.0+ # +tune-$(CONFIG_OPTIMIZE_CPU_MIPS_4KC) =-mtune=4kc +tune-$(CONFIG_OPTIMIZE_CPU_MIPS_24KC) =-mtune=24kc + +tune-y := $(tune-y) + +PLATFORM_CPPFLAGS += $(tune-y) + head-y := arch/mips/cpu/start.o libs-y += arch/mips/cpu/
PATCH v4 8/8 mips: move optimize tuning option from deprecated config.mk to Kconfig
In reply to a message not in the archiveconfig.mk files in mach-xxx directory are deprecated, this patch move the processor tuning option of compiler into Kconfig
---
Changes in v4:
- Add div64 macro for MIPS
- Convert physical address to uncached and cached(KSEG0/1) memory range in map_physmem
- Auto calculate baudrate for serial driver
- Move pinctrl code in serial driver into arch/mips/mach-ath79
- Use global_data to save CPU/DDR/AHB clock
- Use get_serial_clock to serial clock source
- Use get_bus_freq instead of hardcode in SPI driver
- Use arch_global_data to save SOC's type, revison and id
- move CPU optimize tuning flag from config.mk to Kconfig
Changes in v3:
- Convert serial driver to driver model
- Convert spi driver to driver model
- Add support for device tree
- Move SoC specific header files into arch/mips/mach-ath79/include/mach
- Optimize assembly code
- Same code style convertion
Changes in v2:
- Move all SoC specific header files into arch/mips/include/asm/arch-ath79
- Check SOC type and extract common code into arch/mips/mach-ath79
- Add a compatible spi driver
- Move serial driver code into drivers/serial
- Add a reference board implemention
arch/mips/Kconfig | 9 +++++++++ arch/mips/mach-au1x00/config.mk | 8 -------- 2 files changed, 9 insertions(+), 8 deletions(-) delete mode 100644 arch/mips/mach-au1x00/config.mk
arch/mips/Kconfig +9 -0
@@ -43,6 +43,7 @@ config TARGET_DBAU1X00 select SUPPORTS_CPU_MIPS32_R1 select SUPPORTS_CPU_MIPS32_R2 select SYS_MIPS_CACHE_INIT_RAM_LOAD + select OPTIMIZE_CPU_MIPS_4KC config TARGET_PB1X00 bool "Support pb1x00"
@@ -50,6 +51,7 @@ config TARGET_PB1X00 select SUPPORTS_CPU_MIPS32_R1 select SUPPORTS_CPU_MIPS32_R2 select SYS_MIPS_CACHE_INIT_RAM_LOAD + select OPTIMIZE_CPU_MIPS_4KC config TARGET_AP121 bool "Support ap121"
@@ -57,6 +59,7 @@ config TARGET_AP121 select SUPPORTS_CPU_MIPS32_R1 select SUPPORTS_CPU_MIPS32_R2 select SYS_MIPS_CACHE_INIT_RAM_LOAD + select OPTIMIZE_CPU_MIPS_24KC endchoice
@@ -174,6 +177,12 @@ config SUPPORTS_CPU_MIPS64_R1 config SUPPORTS_CPU_MIPS64_R2 bool +config OPTIMIZE_CPU_MIPS_4KC + bool + +config OPTIMIZE_CPU_MIPS_24KC + bool + config CPU_MIPS32 bool default y if CPU_MIPS32_R1 || CPU_MIPS32_R2
arch/mips/mach-au1x00/config.mk deleted +0 -8
@@ -1,8 +0,0 @@ -# -# (C) Copyright 2011 -# Wolfgang Denk, DENX Software Engineering, wd at denx.de. -# -# SPDX-License-Identifier: GPL-2.0+ -# - -PLATFORM_CPPFLAGS += -mtune=4kc
Signature · 1 line
1.9.1
PATCH v4 8/8 mips: move optimize tuning option from deprecated config.mk to Kconfig
Quoted 6 lines · Wills Wang
config.mk files in mach-xxx directory are deprecated, this patch move the processor tuning option of compiler into
KconfigSigned-off-by Wills Wang <[email protected]>---
Quoted 11 lines
Changes in v4:
- Add div64 macro for MIPS
- Convert physical address to uncached and cached(KSEG0/1) memory range inmap_physmem
- Auto calculate baudrate for serial driver
- Move pinctrl code in serial driver intoarch/mips/mach-ath79
- Useglobal_datato save CPU/DDR/AHB clock
- Useget_serial_clockto serial clock source
- Useget_bus_freqinstead of hardcode in SPI driver
- Usearch_global_datato save SOC's type, revison and id
- move CPU optimize tuning flag from config.mk toKconfig
The changelog should be at patch 0/8 and there should be a dedicated changelog with each patch. The changelog for entire series should not be with patch 8/8.
Best regards,
Marek Vasut
PATCH v4 8/8 mips: move optimize tuning option from deprecated config.mk to Kconfig
Sorry, i use patman tool incorrectly.
Quoted 25 lines · Marek Vasut
Quoted 6 lines · Wills Wang
config.mk files in mach-xxx directory are deprecated, this patch move the processor tuning option of compiler into
KconfigSigned-off-by Wills Wang <[email protected]>---
Quoted 11 lines
Changes in v4:
- Add div64 macro for MIPS
- Convert physical address to uncached and cached(KSEG0/1) memory range inmap_physmem
- Auto calculate baudrate for serial driver
- Move pinctrl code in serial driver intoarch/mips/mach-ath79
- Useglobal_datato save CPU/DDR/AHB clock
- Useget_serial_clockto serial clock source
- Useget_bus_freqinstead of hardcode in SPI driver
- Usearch_global_datato save SOC's type, revison and id
- move CPU optimize tuning flag from config.mk toKconfigThe changelog should be at patch 0/8 and there should be a dedicated changelog with each patch. The changelog for entire series should not be with patch 8/8.
Best regards,
Marek Vasut