mips: add base support for atheros ar71xx based SOCs
Subsystems (2)
PATCH 1/1 mips: add base support for atheros ar71xx based SOCs
This patch enable work for ar933x SOC, tested on ar9331
---
arch/mips/Makefile | 1 + arch/mips/include/asm/ar71xx.h | 1144 +++++++++++++++++++++++++++ arch/mips/mach-ath79/Makefile | 8 + arch/mips/mach-ath79/ar933x/Makefile | 11 + arch/mips/mach-ath79/ar933x/dram.c | 27 + arch/mips/mach-ath79/ar933x/lowlevel_init.S | 784 ++++++++++++++++++ arch/mips/mach-ath79/ar933x/reset.c | 29 + arch/mips/mach-ath79/ar933x/serial.c | 348 ++++++++ arch/mips/mach-ath79/config.mk | 8 + 9 files changed, 2360 insertions(+) create mode 100644 arch/mips/include/asm/ar71xx.h 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/dram.c create mode 100644 arch/mips/mach-ath79/ar933x/lowlevel_init.S create mode 100644 arch/mips/mach-ath79/ar933x/reset.c create mode 100644 arch/mips/mach-ath79/ar933x/serial.c create mode 100644 arch/mips/mach-ath79/config.mk
arch/mips/Makefile +1 -0
@@ -8,3 +8,4 @@ libs-y += arch/mips/cpu/ libs-y += arch/mips/lib/ libs-$(CONFIG_SOC_AU1X00) += arch/mips/mach-au1x00/ +libs-$(CONFIG_SOC_ATH79) += arch/mips/mach-ath79/
arch/mips/include/asm/ar71xx.h new file +1144 -0
1,144 lines not on this page · raw message
arch/mips/mach-ath79/Makefile new file +8 -0
@@ -0,0 +1,8 @@ +# +# (C) Copyright 2011 +# Wolfgang Denk, DENX Software Engineering, wd at denx.de. +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-$(CONFIG_SOC_AR933X) += ar933x/
arch/mips/mach-ath79/ar933x/Makefile new file +11 -0
@@ -0,0 +1,11 @@ +# +# (C) Copyright 2011 +# Wolfgang Denk, DENX Software Engineering, wd at denx.de. +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y += serial.o +obj-y += reset.o +obj-y += dram.o +obj-y += lowlevel_init.o
arch/mips/mach-ath79/ar933x/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> + +extern void ddr_tap_init (void ); +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/ar933x/lowlevel_init.S new file +784 -0
784 lines not on this page · raw message
arch/mips/mach-ath79/ar933x/reset.c new file +29 -0
@@ -0,0 +1,29 @@ +/* +* (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/ar71xx.h> + +#define REG_READ (b, o) readl(KSEG1ADDR(b + o)) +#define REG_WRITE (b, o, v) writel(v, KSEG1ADDR((b + o))) +#define RST_READ (a) REG_READ(AR71XX_RESET_BASE, a) +#define RST_WRITE (a, v) REG_WRITE(AR71XX_RESET_BASE, a, v) + +void _machine_restart (void ) +{ +u32 val; + + val =RST_READ (AR933X_RESET_REG_RESET_MODULE ); + val |=AR71XX_RESET_FULL_CHIP ; +RST_WRITE (AR933X_RESET_REG_RESET_MODULE , val); +while (1 ) +/* NOP */ ; +} +
arch/mips/mach-ath79/ar933x/serial.c new file +348 -0
348 lines not on this page · raw message
arch/mips/mach-ath79/config.mk new file +8 -0
@@ -0,0 +1,8 @@ +# +# (C) Copyright 2011 +# Wolfgang Denk, DENX Software Engineering, [email protected]. +# +# SPDX-License-Identifier: GPL-2.0+ +# + +PLATFORM_CPPFLAGS += -mtune=24kc
Signature · 1 line
1.9.1
PATCH 1/1 mips: add base support for atheros ar71xx based SOCs
Quoted 15 lines · On Fri, 18 Dec 2015 15:34:29 +0800 Wills Wang <[email protected]> wrote:
This patch enable work for ar933x SOC, tested on ar9331
Signed-off-by Wills Wang <[email protected]>---
arch/mips/Makefile | 1 + arch/mips/include/asm/ar71xx.h | 1144 +++++++++++++++++++++++++++ arch/mips/mach-ath79/Makefile | 8 + arch/mips/mach-ath79/ar933x/Makefile | 11 + arch/mips/mach-ath79/ar933x/dram.c | 27 + arch/mips/mach-ath79/ar933x/lowlevel_init.S | 784 ++++++++++++++++++ arch/mips/mach-ath79/ar933x/reset.c | 29 + arch/mips/mach-ath79/ar933x/serial.c | 348 ++++++++ arch/mips/mach-ath79/config.mk | 8 + 9 files changed, 2360 insertions(+)
Quoted 8 lines
create mode 100644 arch/mips/include/asm/ar71xx.h 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/dram.c create mode 100644 arch/mips/mach-ath79/ar933x/lowlevel_init.S create mode 100644 arch/mips/mach-ath79/ar933x/reset.c create mode 100644 arch/mips/mach-ath79/ar933x/serial.c create mode 100644 arch/mips/mach-ath79/config.mk
1. Your lowlevel_init routine duplicates cache maintenance functions by Paul Burton (please see commit 4a5d8898bca3e442b6 'MIPS: unify cache initialization code').
2. Can we select build for ar71xx from .config? I suppose 'No', because the patch does not add any Kconfig option.
3. Can we put your arch/mips/mach-ath79/ar933x/serial.c into drivers/serial?
4. The patch is suffering from very very many unused macros in ar71xx.h.
5. The patch has whitespace errors, please see this git-am log:
Applying: mips: add base support for atheros ar71xx based SOCs .git/rebase-apply/patch:1180: new blank line at EOF. +
.git/rebase-apply/patch:2069: new blank line at EOF. +
warning: 2 lines add whitespace errors.
--?
Best regards,
? Antony Pavlov
PATCH 1/1 mips: add base support for atheros ar71xx based SOCs
Quoted 27 lines · Antony Pavlov
Quoted 15 lines · On Fri, 18 Dec 2015 15:34:29 +0800 Wills Wang <[email protected]> wrote:
This patch enable work for ar933x SOC, tested on ar9331
Signed-off-by Wills Wang <[email protected]>---
arch/mips/Makefile | 1 + arch/mips/include/asm/ar71xx.h | 1144 +++++++++++++++++++++++++++ arch/mips/mach-ath79/Makefile | 8 + arch/mips/mach-ath79/ar933x/Makefile | 11 + arch/mips/mach-ath79/ar933x/dram.c | 27 + arch/mips/mach-ath79/ar933x/lowlevel_init.S | 784 ++++++++++++++++++ arch/mips/mach-ath79/ar933x/reset.c | 29 + arch/mips/mach-ath79/ar933x/serial.c | 348 ++++++++ arch/mips/mach-ath79/config.mk | 8 + 9 files changed, 2360 insertions(+)Quoted 8 lines
create mode 100644
arch/mips/include/asm/ar71xx.hcreate mode 100644arch/mips/mach-ath79/Makefilecreate mode 100644arch/mips/mach-ath79/ar933x/Makefilecreate mode 100644arch/mips/mach-ath79/ar933x/dram.ccreate mode 100644arch/mips/mach-ath79/ar933x/lowlevel_init.Screate mode 100644arch/mips/mach-ath79/ar933x/reset.ccreate mode 100644arch/mips/mach-ath79/ar933x/serial.ccreate mode 100644arch/mips/mach-ath79/config.mk
Quoted 2 lines
1. Your
lowlevel_initroutine duplicates cache maintenance functions by Paul Burton (please see commit4a5d8898bca3e442b6'MIPS: unify cache initialization code').
Can you tell me which lines involve the cache maintenance function?
Quoted 2 lines
2. Can we select build for ar71xx from .config? I suppose 'No', because the patch does not add any
Kconfigoption.
Yes, this patch refer to the au1x00 machine, we can select which target was build.
Quoted 1 line
3. Can we put your
arch/mips/mach-ath79/ar933x/serial.cintodrivers/serial?
Ok.
Quoted 1 line
4. The patch is suffering from very very many unused macros in
ar71xx.h.
File "ar71xx.h" copy from mainline kernel, the future patch should use other macros.
Quoted 8 lines
5. The patch has whitespace errors, please see this git-am log:
Applying: mips: add base support for atheros ar71xx based SOCs .git/rebase-apply/patch:1180: new blank line at EOF. +
.git/rebase-apply/patch:2069: new blank line at EOF. +
warning: 2 lines add whitespace errors.
Ok, thanks!
Quoted 5 lines
Signature · 2 lines
Best regards, Antony Pavlov
Best Regards
Wills
PATCH 1/1 mips: add base support for atheros ar71xx based SOCs
Quoted 28 lines · On Fri, 18 Dec 2015 23:24:22 +0800 Wills Wang <[email protected]> wrote:
Quoted 27 lines · Antony Pavlov
Quoted 23 lines · On Fri, 18 Dec 2015 15:34:29 +0800 Wills Wang <[email protected]> wrote:
This patch enable work for ar933x SOC, tested on ar9331
Signed-off-by Wills Wang <[email protected]>---
arch/mips/Makefile | 1 + arch/mips/include/asm/ar71xx.h | 1144 +++++++++++++++++++++++++++ arch/mips/mach-ath79/Makefile | 8 + arch/mips/mach-ath79/ar933x/Makefile | 11 + arch/mips/mach-ath79/ar933x/dram.c | 27 + arch/mips/mach-ath79/ar933x/lowlevel_init.S | 784 ++++++++++++++++++ arch/mips/mach-ath79/ar933x/reset.c | 29 + arch/mips/mach-ath79/ar933x/serial.c | 348 ++++++++ arch/mips/mach-ath79/config.mk | 8 + 9 files changed, 2360 insertions(+)create mode 100644
arch/mips/include/asm/ar71xx.hcreate mode 100644arch/mips/mach-ath79/Makefilecreate mode 100644arch/mips/mach-ath79/ar933x/Makefilecreate mode 100644arch/mips/mach-ath79/ar933x/dram.ccreate mode 100644arch/mips/mach-ath79/ar933x/lowlevel_init.Screate mode 100644arch/mips/mach-ath79/ar933x/reset.ccreate mode 100644arch/mips/mach-ath79/ar933x/serial.ccreate mode 100644arch/mips/mach-ath79/config.mk
Quoted 3 lines
Quoted 2 lines
1. Your
lowlevel_initroutine duplicates cache maintenance functions by Paul Burton (please see commit4a5d8898bca3e442b6'MIPS: unify cache initialization code').Can you tell me which lines involve the cache maintenance function?
Please see mips_cache_reset and dcache_enable functions
in the commit 4a5d8898bca3e442b6 'MIPS: unify cache initialization code'.
Quoted 26 lines
Quoted 2 lines
2. Can we select build for ar71xx from .config? I suppose 'No', because the patch does not add any
Kconfigoption.Yes, this patch refer to the au1x00 machine, we can select which target was build.
Quoted 1 line
3. Can we put your
arch/mips/mach-ath79/ar933x/serial.cintodrivers/serial?Ok.
Quoted 1 line
4. The patch is suffering from very very many unused macros in
ar71xx.h.File "
ar71xx.h" copy from mainline kernel, the future patch should use other macros.Quoted 8 lines
5. The patch has whitespace errors, please see this git-am log:
Applying: mips: add base support for atheros ar71xx based SOCs .git/rebase-apply/patch:1180: new blank line at EOF. +
.git/rebase-apply/patch:2069: new blank line at EOF. +
warning: 2 lines add whitespace errors.Ok, thanks!
Quoted 5 lines
Signature · 2 lines
Best regards, Antony PavlovBest Regards
Wills
Signature · 3 lines
--? Best regards, ? Antony Pavlov
PATCH 1/1 mips: add base support for atheros ar71xx based SOCs
Hi, Antony,
I'm sorry, i can't find any code for cache operation in lowlevel_init routine.
I mean there are no code maintenance cache in this patch , such as "cache reset" and "dcache enable".
Best Regards
Wills
Quoted 64 lines · Antony Pavlov
Quoted 27 lines · On Fri, 18 Dec 2015 23:24:22 +0800 Wills Wang <[email protected]> wrote:
Quoted 26 lines · Antony Pavlov
Quoted 23 lines · On Fri, 18 Dec 2015 15:34:29 +0800 Wills Wang <[email protected]> wrote:
This patch enable work for ar933x SOC, tested on ar9331
Signed-off-by Wills Wang <[email protected]>---
arch/mips/Makefile | 1 + arch/mips/include/asm/ar71xx.h | 1144 +++++++++++++++++++++++++++ arch/mips/mach-ath79/Makefile | 8 + arch/mips/mach-ath79/ar933x/Makefile | 11 + arch/mips/mach-ath79/ar933x/dram.c | 27 + arch/mips/mach-ath79/ar933x/lowlevel_init.S | 784 ++++++++++++++++++ arch/mips/mach-ath79/ar933x/reset.c | 29 + arch/mips/mach-ath79/ar933x/serial.c | 348 ++++++++ arch/mips/mach-ath79/config.mk | 8 + 9 files changed, 2360 insertions(+)create mode 100644
arch/mips/include/asm/ar71xx.hcreate mode 100644arch/mips/mach-ath79/Makefilecreate mode 100644arch/mips/mach-ath79/ar933x/Makefilecreate mode 100644arch/mips/mach-ath79/ar933x/dram.ccreate mode 100644arch/mips/mach-ath79/ar933x/lowlevel_init.Screate mode 100644arch/mips/mach-ath79/ar933x/reset.ccreate mode 100644arch/mips/mach-ath79/ar933x/serial.ccreate mode 100644arch/mips/mach-ath79/config.mkQuoted 3 lines
Quoted 2 lines
1. Your
lowlevel_initroutine duplicates cache maintenance functions by Paul Burton (please see commit4a5d8898bca3e442b6'MIPS: unify cache initialization code').Can you tell me which lines involve the cache maintenance function?
Please see
mips_cache_resetanddcache_enablefunctions
in the commit4a5d8898bca3e442b6'MIPS: unify cache initialization code'.Quoted 25 lines
Quoted 2 lines
2. Can we select build for ar71xx from .config? I suppose 'No', because the patch does not add any
Kconfigoption.Yes, this patch refer to the au1x00 machine, we can select which target was build.
Quoted 1 line
3. Can we put your
arch/mips/mach-ath79/ar933x/serial.cintodrivers/serial?Ok.
Quoted 1 line
4. The patch is suffering from very very many unused macros in
ar71xx.h.File "
ar71xx.h" copy from mainline kernel, the future patch should use other macros.Quoted 8 lines
5. The patch has whitespace errors, please see this git-am log:
Applying: mips: add base support for atheros ar71xx based SOCs .git/rebase-apply/patch:1180: new blank line at EOF. +
.git/rebase-apply/patch:2069: new blank line at EOF. +
warning: 2 lines add whitespace errors.Ok, thanks!
Quoted 5 lines
Signature · 2 lines
Best regards, Antony PavlovBest Regards
Wills
PATCH 1/1 mips: add base support for atheros ar71xx based SOCs
Quoted 6 lines · On Sat, 19 Dec 2015 00:44:19 +0800 Wills Wang <[email protected]> wrote:
Hi, Antony,
I'm sorry, i can't find any code for cache operation in
lowlevel_initroutine.
I mean there are no code maintenance cache in this patch , such as "cache reset" and "dcache enable".
I so sorry! My bad: your lowlevel_init actually does not contain any cache code. common code from arch/mips/cpu/start.S calls mips_cache_reset just after invoking lowlevel_init.
Quoted 66 lines · Antony Pavlov
Quoted 64 lines
Quoted 27 lines · On Fri, 18 Dec 2015 23:24:22 +0800 Wills Wang <[email protected]> wrote:
Quoted 26 lines · Antony Pavlov
Quoted 23 lines · On Fri, 18 Dec 2015 15:34:29 +0800 Wills Wang <[email protected]> wrote:
This patch enable work for ar933x SOC, tested on ar9331
Signed-off-by Wills Wang <[email protected]>---
arch/mips/Makefile | 1 + arch/mips/include/asm/ar71xx.h | 1144 +++++++++++++++++++++++++++ arch/mips/mach-ath79/Makefile | 8 + arch/mips/mach-ath79/ar933x/Makefile | 11 + arch/mips/mach-ath79/ar933x/dram.c | 27 + arch/mips/mach-ath79/ar933x/lowlevel_init.S | 784 ++++++++++++++++++ arch/mips/mach-ath79/ar933x/reset.c | 29 + arch/mips/mach-ath79/ar933x/serial.c | 348 ++++++++ arch/mips/mach-ath79/config.mk | 8 + 9 files changed, 2360 insertions(+)create mode 100644
arch/mips/include/asm/ar71xx.hcreate mode 100644arch/mips/mach-ath79/Makefilecreate mode 100644arch/mips/mach-ath79/ar933x/Makefilecreate mode 100644arch/mips/mach-ath79/ar933x/dram.ccreate mode 100644arch/mips/mach-ath79/ar933x/lowlevel_init.Screate mode 100644arch/mips/mach-ath79/ar933x/reset.ccreate mode 100644arch/mips/mach-ath79/ar933x/serial.ccreate mode 100644arch/mips/mach-ath79/config.mkQuoted 3 lines
Quoted 2 lines
1. Your
lowlevel_initroutine duplicates cache maintenance functions by Paul Burton (please see commit4a5d8898bca3e442b6'MIPS: unify cache initialization code').Can you tell me which lines involve the cache maintenance function?
Please see
mips_cache_resetanddcache_enablefunctions
in the commit4a5d8898bca3e442b6'MIPS: unify cache initialization code'.Quoted 25 lines
Quoted 2 lines
2. Can we select build for ar71xx from .config? I suppose 'No', because the patch does not add any
Kconfigoption.Yes, this patch refer to the au1x00 machine, we can select which target was build.
Quoted 1 line
3. Can we put your
arch/mips/mach-ath79/ar933x/serial.cintodrivers/serial?Ok.
Quoted 1 line
4. The patch is suffering from very very many unused macros in
ar71xx.h.File "
ar71xx.h" copy from mainline kernel, the future patch should use other macros.Quoted 8 lines
5. The patch has whitespace errors, please see this git-am log:
Applying: mips: add base support for atheros ar71xx based SOCs .git/rebase-apply/patch:1180: new blank line at EOF. +
.git/rebase-apply/patch:2069: new blank line at EOF. +
warning: 2 lines add whitespace errors.Ok, thanks!
Quoted 5 lines
Signature · 2 lines
Best regards, Antony PavlovBest Regards
Wills
Signature · 3 lines
--? Best regards, ? Antony Pavlov
PATCH 1/1 mips: add base support for atheros ar71xx based SOCs
In reply to Wills WangAm 18.12.2015 um 08:34 schrieb Wills Wang:
Quoted 15 lines
This patch enable work for ar933x SOC, tested on ar9331
Signed-off-by Wills Wang <[email protected]>---
arch/mips/Makefile | 1 + arch/mips/include/asm/ar71xx.h | 1144 +++++++++++++++++++++++++++ arch/mips/mach-ath79/Makefile | 8 + arch/mips/mach-ath79/ar933x/Makefile | 11 + arch/mips/mach-ath79/ar933x/dram.c | 27 + arch/mips/mach-ath79/ar933x/lowlevel_init.S | 784 ++++++++++++++++++ arch/mips/mach-ath79/ar933x/reset.c | 29 + arch/mips/mach-ath79/ar933x/serial.c | 348 ++++++++ arch/mips/mach-ath79/config.mk | 8 + 9 files changed, 2360 insertions(+)
Quoted 9 lines
create mode 100644 arch/mips/include/asm/ar71xx.h 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/dram.c create mode 100644 arch/mips/mach-ath79/ar933x/lowlevel_init.S create mode 100644 arch/mips/mach-ath79/ar933x/reset.c create mode 100644 arch/mips/mach-ath79/ar933x/serial.c create mode 100644 arch/mips/mach-ath79/config.mk
We are transitioning towards "Driver Model" and new code should already support it where possible. Thus rewrite at least serial.c as DM compatible driver in drivers/serial/. If possible you should also support device-tree. The next branch in u-boot-mips tree has a patch which adds the initial infrastructure for it on MIPS.
Put all SoC specific header files in arch/mips/include/asm/arch-ath79/. The next branch in u-boot-mips tree already has a patch to support again the creation of symbolic links arch/mips/include/asm/arch -> arch/mips/include/asm/arch-SOC. Apart from that your directory structure is fine.
Add proper Kconfig symbols for your SoC. Also you need to have at least one board that uses your SoC. That board have to be created in board/ directory along with proper Kconfig and MAINTAINERS files. Additionally you need to add a Kconfig defconfig file for your board in directory configs/. I wonder how you got your code compiled without a possibility to select it with Kconfig.
Try to minimize the code in lowlevel_init.S. It is only intended to bring up memory controllers and DRAM and maybe some clocks before a C environment is available. Other code should be always written in C. If your SoC has some SRAM space, you could use that for the initial stack and global data and drop lowlevel_init.S entirely.
Please create at least three patches in your next patch series:
1) add ar933x SoC
2) add serial driver for ar933x (or one for all ath79 compatible SoC's)
3) add one ar933x based board (e.g. an official evaluation kit)
Signature · 1 line
- Daniel