From 2fecb4e76d83902a1390cdab917a304ef8e85f67 Mon Sep 17 00:00:00 2001 From: Piotr Dymacz Date: Mon, 16 Nov 2015 02:08:18 +0100 Subject: [PATCH] Clean mess with AR933x low level related code --- u-boot/board/ar7240/ap121/Makefile | 7 +- u-boot/board/ar7240/ap121/ap121.c | 8 +- u-boot/board/ar7240/common/lowlevel_init.S | 89 ------------------- .../{hornet_ddr_init.S => ar933x_ddr_init.S} | 14 +-- .../mips/ar7240/ar933x_pll_init.S} | 5 +- 5 files changed, 15 insertions(+), 108 deletions(-) delete mode 100644 u-boot/board/ar7240/common/lowlevel_init.S rename u-boot/cpu/mips/ar7240/{hornet_ddr_init.S => ar933x_ddr_init.S} (98%) rename u-boot/{board/ar7240/ap121/hornet_pll_init.S => cpu/mips/ar7240/ar933x_pll_init.S} (99%) diff --git a/u-boot/board/ar7240/ap121/Makefile b/u-boot/board/ar7240/ap121/Makefile index f93b1d3..ee459ab 100644 --- a/u-boot/board/ar7240/ap121/Makefile +++ b/u-boot/board/ar7240/ap121/Makefile @@ -2,12 +2,7 @@ include $(TOPDIR)/config.mk LIB = lib$(BOARD).a -OBJS = $(BOARD).o ../common/ar7240_flash.o ../common/ar7240_s26_phy.o ../common/common.o -SOBJS = ../common/lowlevel_init.o - -ifeq ($(BOARD), ap121) -SOBJS += hornet_pll_init.o -endif +OBJS = $(BOARD).o ../common/ar7240_flash.o ../common/ar7240_s26_phy.o ../common/common.o $(LIB): .depend $(OBJS) $(SOBJS) $(AR) crv $@ $(OBJS) $(SOBJS) diff --git a/u-boot/board/ar7240/ap121/ap121.c b/u-boot/board/ar7240/ap121/ap121.c index 12c213d..44ea92d 100644 --- a/u-boot/board/ar7240/ap121/ap121.c +++ b/u-boot/board/ar7240/ap121/ap121.c @@ -7,11 +7,11 @@ #include "ar7240_soc.h" #if !defined(COMPRESSED_UBOOT) -extern void hornet_ddr_init(void); +extern void ar933x_ddr_init(void); #endif extern int ar7240_ddr_find_size(void); -extern void hornet_ddr_tap_init(void); +extern void ar933x_ddr_tap_init(void); #define SETBITVAL(val, pos, bit) do {ulong bitval = (bit) ? 0x1 : 0x0; (val) = ((val) & ~(0x1 << (pos))) | ( (bitval) << (pos));} while(0) @@ -427,7 +427,7 @@ int ar7240_mem_config(void) { #ifndef CONFIG_SKIP_LOWLEVEL_INIT #ifndef COMPRESSED_UBOOT - hornet_ddr_init(); + ar933x_ddr_init(); #endif /* Default tap values for starting the tap_init*/ @@ -438,7 +438,7 @@ int ar7240_mem_config(void) all_led_off(); #ifndef CONFIG_SKIP_LOWLEVEL_INIT - hornet_ddr_tap_init(); + ar933x_ddr_tap_init(); #endif // return memory size diff --git a/u-boot/board/ar7240/common/lowlevel_init.S b/u-boot/board/ar7240/common/lowlevel_init.S deleted file mode 100644 index a19988d..0000000 --- a/u-boot/board/ar7240/common/lowlevel_init.S +++ /dev/null @@ -1,89 +0,0 @@ -#include -#include -#include -#include -#include -#include - -/* - * Helper macros. - * These Clobber t7, t8 and t9 - */ -#define clear_mask(_reg, _mask) \ - li t7, KSEG1ADDR(_reg); \ - lw t8, 0(t7); \ - li t9, ~_mask; \ - and t8, t8, t9; \ - sw t8, 0(t7) - -#define set_val(_reg, _mask, _val) \ - li t7, KSEG1ADDR(_reg); \ - lw t8, 0(t7); \ - li t9, ~_mask; \ - and t8, t8, t9; \ - li t9, _val; \ - or t8, t8, t9; \ - sw t8, 0(t7) - -#define set_val_f(_reg, _mask, _val) \ - li t7, KSEG1ADDR(_reg); \ - lw t8, 0(t7); \ - li t9, ~_mask; \ - and t8, t8, t9; \ - li t6, KSEG1ADDR(_val); \ - lw t9, 0(t6); \ - or t8, t8, t9; \ - sw t8, 0(t7) - - -#define get_val(_reg, _mask, _shift, _res_reg) \ - li t7, KSEG1ADDR(_reg); \ - lw t8, 0(t7); \ - li t9, _mask; \ - and t8, t8, t9; \ - srl _res_reg, t8, _shift \ - -#define pll_clr(_mask) \ - clear_mask(AR7240_CPU_PLL_CONFIG, _mask) - -#define pll_set(_mask, _val) \ - set_val(AR7240_CPU_PLL_CONFIG, _mask, _val) - -#define pll_set_f(_mask, _val) \ - set_val_f(AR7240_CPU_PLL_CONFIG, _mask, _val) - -#define pll_get(_mask, _shift, _res_reg) \ - get_val(AR7240_CPU_PLL_CONFIG, _mask, _shift, _res_reg) - -#define clk_clr(_mask) \ - clear_mask(AR7240_CPU_CLOCK_CONTROL, _mask) - -#define clk_set(_mask, _val) \ - set_val(AR7240_CPU_CLOCK_CONTROL, _mask, _val) - -#define clk_get(_mask, _shift, _res_reg) \ - get_val(AR7240_CPU_CLOCK_CONTROL, _mask, _shift, _res_reg) - - -/****************************************************************************** - * first level initialization: - * - * 0) If clock cntrl reset switch is already set, we're recovering from - * "divider reset"; goto 3. - * 1) Setup divide ratios. - * 2) Reset. - * 3) Setup pll's, wait for lock. - * - *****************************************************************************/ - -.globl lowlevel_init - -lowlevel_init: - /* - * The code below is for the real chip. Wont work on FPGA - */ - - b hornet_pll_init - jr ra - nop - diff --git a/u-boot/cpu/mips/ar7240/hornet_ddr_init.S b/u-boot/cpu/mips/ar7240/ar933x_ddr_init.S similarity index 98% rename from u-boot/cpu/mips/ar7240/hornet_ddr_init.S rename to u-boot/cpu/mips/ar7240/ar933x_ddr_init.S index ef57280..c379321 100644 --- a/u-boot/cpu/mips/ar7240/hornet_ddr_init.S +++ b/u-boot/cpu/mips/ar7240/ar933x_ddr_init.S @@ -30,7 +30,7 @@ #include #include - .globl hornet_ddr_init + .globl ar933x_ddr_init .text .align 4 @@ -41,7 +41,7 @@ //============================================ // init DDR1 parameter before rel_start //=========================================== -hornet_ddr_init: +ar933x_ddr_init: // 0x18000000 (DDR_CONFIG, p. 54) // CFG_DDR_CONFIG_VAL = 0x7fbc8cd0 (ap121.h) li t8, CFG_DDR_CONFIG_VAL; @@ -249,13 +249,13 @@ ddr1_config: jr ra /* - * void hornet_ddr_tap_init(void) + * void ar933x_ddr_tap_init(void) * * This "function" is used to find the tap settings for the DDR */ - .globl hornet_ddr_tap_init - .ent hornet_ddr_tap_init -hornet_ddr_tap_init: /* { */ + .globl ar933x_ddr_tap_init + .ent ar933x_ddr_tap_init +ar933x_ddr_tap_init: /* { */ li t1,0x80500000 li t0,0xffffffff @@ -559,5 +559,5 @@ end: nop jr ra - .end hornet_ddr_tap_init + .end ar933x_ddr_tap_init /* } */ diff --git a/u-boot/board/ar7240/ap121/hornet_pll_init.S b/u-boot/cpu/mips/ar7240/ar933x_pll_init.S similarity index 99% rename from u-boot/board/ar7240/ap121/hornet_pll_init.S rename to u-boot/cpu/mips/ar7240/ar933x_pll_init.S index 6960d8c..21f77a6 100644 --- a/u-boot/board/ar7240/ap121/hornet_pll_init.S +++ b/u-boot/cpu/mips/ar7240/ar933x_pll_init.S @@ -5,7 +5,8 @@ #include #include - .globl hornet_pll_init + .globl lowlevel_init + .type lowlevel_init, @function .text .align 4 @@ -38,7 +39,7 @@ beq t1, (1 << GPIO_RST_BUTTON_BIT), _branch; #endif -hornet_pll_init: +lowlevel_init: #if 1 /* These three wlan reset will avoid original issue, -- 2.25.1