From 09f5910d069ee9a760e8321e9162e535df080f18 Mon Sep 17 00:00:00 2001 From: Chen Xinke Date: Fri, 1 Dec 2017 11:39:09 +0800 Subject: [PATCH] Fix HT PLL configure bug and opt FAN speed control. Change-Id: I8ccea81448034ad054d38d6883dd03290bc1f0f8 --- Targets/Bonito3a3000_7a/Bonito/ls7a_config.h | 1 + Targets/Bonito3a3000_7a/Bonito/start.S | 18 +++++++++++++++++- Targets/Bonito3a3000_7a/Bonito/tgt_machdep.c | 13 +++++++++---- pmon/arch/mips/ls7a/ht.h | 2 +- pmon/arch/mips/ls7a/ls3a7a_setup_ht_link.S | 4 ++-- 5 files changed, 30 insertions(+), 8 deletions(-) diff --git a/Targets/Bonito3a3000_7a/Bonito/ls7a_config.h b/Targets/Bonito3a3000_7a/Bonito/ls7a_config.h index 89e7de02..204f552b 100644 --- a/Targets/Bonito3a3000_7a/Bonito/ls7a_config.h +++ b/Targets/Bonito3a3000_7a/Bonito/ls7a_config.h @@ -6,6 +6,7 @@ //#define DEBUG_HT1 #ifdef DEBUG_HT1 //#define PRINT_HT1_REG +//#define DEBUG_HT1_PARAM #endif #define CHECK_HT_PLL_MODE diff --git a/Targets/Bonito3a3000_7a/Bonito/start.S b/Targets/Bonito3a3000_7a/Bonito/start.S index fb550b99..33c2ffb1 100644 --- a/Targets/Bonito3a3000_7a/Bonito/start.S +++ b/Targets/Bonito3a3000_7a/Bonito/start.S @@ -440,9 +440,25 @@ bsp_start: dli t0, CONFBUS_HEADER_ADDR li t1, CONFBUS_BASE_ADDR sw t1, 0x10(t0) - TTYDBG("set LS7A MISC and confbus base address done.\r\n") + //set PWM output 1 + dli t0, (LS7A_MISC_BASE_ADDR | PWM_BASE_ADDR_OFFSET) + li a0, 0x100 + li a1, (1<<0) + sw $0, 0x4(t0) + sw a0, 0x8(t0) + sw a1, 0xc(t0) + sw $0, 0x104(t0) + sw a0, 0x108(t0) + sw a1, 0x10c(t0) + sw $0, 0x204(t0) + sw a0, 0x208(t0) + sw a1, 0x20c(t0) + sw $0, 0x304(t0) + sw a0, 0x308(t0) + sw a1, 0x30c(t0) + bal beep_off nop diff --git a/Targets/Bonito3a3000_7a/Bonito/tgt_machdep.c b/Targets/Bonito3a3000_7a/Bonito/tgt_machdep.c index fd77d777..fb01e551 100644 --- a/Targets/Bonito3a3000_7a/Bonito/tgt_machdep.c +++ b/Targets/Bonito3a3000_7a/Bonito/tgt_machdep.c @@ -196,7 +196,7 @@ void initmips(unsigned int raw_memsz) /* * Probe clock frequencys so delays will work properly. */ - ls7a_pwm(0,100); + ls7a_pwm(5000, 10000); tgt_cpufreq(); SBD_DISPLAY("DONE",0); /* @@ -487,18 +487,23 @@ void tgt_logo() static void ls7a_pwm(int x,int y) { + readl(LS7A_PWM0_CTRL) &= ~1; outl(LS7A_PWM0_LOW,x); outl(LS7A_PWM0_FULL,y); readl(LS7A_PWM0_CTRL) |= 1; + readl(LS7A_PWM1_CTRL) &= ~1; outl(LS7A_PWM1_LOW,x); outl(LS7A_PWM1_FULL,y); readl(LS7A_PWM1_CTRL) |= 1; - outl(LS7A_PWM2_LOW,x); - outl(LS7A_PWM2_FULL,y); - readl(LS7A_PWM2_CTRL) |= 1; + //as now, the 7A Fan control circuit(PWM2) has problem, keep it constant to avoid wearing fan. + //readl(LS7A_PWM2_CTRL) &= ~1; + //outl(LS7A_PWM2_LOW,x); + //outl(LS7A_PWM2_FULL,y); + //readl(LS7A_PWM2_CTRL) |= 1; + readl(LS7A_PWM3_CTRL) &= ~1; outl(LS7A_PWM3_LOW,x); outl(LS7A_PWM3_FULL,y); readl(LS7A_PWM3_CTRL) |= 1; diff --git a/pmon/arch/mips/ls7a/ht.h b/pmon/arch/mips/ls7a/ht.h index 52d5a6d9..093c566f 100644 --- a/pmon/arch/mips/ls7a/ht.h +++ b/pmon/arch/mips/ls7a/ht.h @@ -46,7 +46,7 @@ #define LS7A_HT_PLL_2400M ((1 << LS7A_HT_PLL_DIV_LO) | (1 << LS7A_HT_PLL_DIV_HI) | (3 << LS7A_HT_PLL_DIV_REFC) | (24*4 << LS7A_HT_PLL_LOOPC) | (4 << LS7A_HT_PLL_DIV_CTRL)) #define LS7A_HT_PLL_2200M ((1 << LS7A_HT_PLL_DIV_LO) | (1 << LS7A_HT_PLL_DIV_HI) | (3 << LS7A_HT_PLL_DIV_REFC) | (22*4 << LS7A_HT_PLL_LOOPC) | (4 << LS7A_HT_PLL_DIV_CTRL)) #define LS7A_HT_PLL_2000M ((1 << LS7A_HT_PLL_DIV_LO) | (1 << LS7A_HT_PLL_DIV_HI) | (3 << LS7A_HT_PLL_DIV_REFC) | (20*4 << LS7A_HT_PLL_LOOPC) | (4 << LS7A_HT_PLL_DIV_CTRL)) -#define LS7A_HT_PLL_1600M ((2 << LS7A_HT_PLL_DIV_LO) | (2 << LS7A_HT_PLL_DIV_HI) | (3 << LS7A_HT_PLL_DIV_REFC) | (32*4 << LS7A_HT_PLL_LOOPC) | (8 << LS7A_HT_PLL_DIV_CTRL)) +#define LS7A_HT_PLL_1600M ((2 << LS7A_HT_PLL_DIV_LO) | (2 << LS7A_HT_PLL_DIV_HI) | (2 << LS7A_HT_PLL_DIV_REFC) | (32*2 << LS7A_HT_PLL_LOOPC) | (8 << LS7A_HT_PLL_DIV_CTRL)) #define LS7A_HT_PLL_1200M ((2 << LS7A_HT_PLL_DIV_LO) | (2 << LS7A_HT_PLL_DIV_HI) | (3 << LS7A_HT_PLL_DIV_REFC) | (24*4 << LS7A_HT_PLL_LOOPC) | (4 << LS7A_HT_PLL_DIV_CTRL)) #define LS7A_HT_PLL_1000M ((2 << LS7A_HT_PLL_DIV_LO) | (2 << LS7A_HT_PLL_DIV_HI) | (3 << LS7A_HT_PLL_DIV_REFC) | (20*4 << LS7A_HT_PLL_LOOPC) | (4 << LS7A_HT_PLL_DIV_CTRL)) #define LS7A_HT_PLL_800M ((2 << LS7A_HT_PLL_DIV_LO) | (2 << LS7A_HT_PLL_DIV_HI) | (3 << LS7A_HT_PLL_DIV_REFC) | (16*4 << LS7A_HT_PLL_LOOPC) | (4 << LS7A_HT_PLL_DIV_CTRL)) diff --git a/pmon/arch/mips/ls7a/ls3a7a_setup_ht_link.S b/pmon/arch/mips/ls7a/ls3a7a_setup_ht_link.S index a645e4aa..0d16a6d4 100644 --- a/pmon/arch/mips/ls7a/ls3a7a_setup_ht_link.S +++ b/pmon/arch/mips/ls7a/ls3a7a_setup_ht_link.S @@ -206,7 +206,7 @@ config_ht_link: nop TTYDBG("\r\n") 4: -#ifdef DEBUG_HT1 +#ifdef DEBUG_HT1_PARAM PRINTSTR("\r\nChange some parameters of HT:"); 1: PRINTSTR("\r\nPlease input the register address you want to change!!!(0xfff:jump out.): "); @@ -309,7 +309,7 @@ config_ht_link: nop TTYDBG("\r\n") 4: -#ifdef DEBUG_HT1 +#ifdef DEBUG_HT1_PARAM PRINTSTR("\r\nChange some parameters of HT:"); 1: PRINTSTR("\r\nPlease input the register address you want to change!!!(0xfff:jump out.): ");