iPod Classic: s5l8702 clocking rewrite+documentation

This is a rewrite of the clocking section, the resulting system
frequencies are the same as the current git version.

This pàtch uses fixed FClk and just one register is written to switch
all system frequencies, it needs less steps than the current git
version to reach the desired frequency, so it is faster and safer.
Includes functions to step-up/down over a table of predefined set of
frequencies.

The major difference is that Vcore is decreased from 1050 to 1000 mV.

See clocking-s5l8702.h for more information.

Change-Id: I58ac6634e1996adbe1c0c0918a7ce94ad1917d8e
This commit is contained in:
Cástor Muñoz 2015-09-26 01:35:15 +02:00
parent ad5e5c42fb
commit f753b8ead1
7 changed files with 791 additions and 78 deletions

View file

@ -33,6 +33,7 @@
#ifdef HAVE_SERIAL
#include "uc8702.h"
#endif
#include "clocking-s5l8702.h"
#define DEBUG_CANCEL BUTTON_MENU
@ -66,9 +67,10 @@ bool dbg_hw_info(void)
if(state == 0)
{
unsigned cpu_hz;
get_system_freqs(&cpu_hz, NULL, NULL);
_DEBUG_PRINTF("CPU:");
_DEBUG_PRINTF("speed: %d MHz", ((CLKCON0 & 1) ?
CPUFREQ_NORMAL : CPUFREQ_MAX) / 1000000);
_DEBUG_PRINTF("speed: %d MHz", cpu_hz / 1000000);
_DEBUG_PRINTF("current_tick: %d", (unsigned int)current_tick);
uint32_t __res;
asm volatile ("mrc p15, 0, %0, c0, c0, 0" : "=r"(__res));
@ -82,6 +84,31 @@ bool dbg_hw_info(void)
_DEBUG_PRINTF("capture HW: %d", rec_hw_ver);
line++;
#ifdef CLOCKING_DEBUG
/* show all clocks */
unsigned f_clk, c_clk, h_clk, p_clk, l_clk, s_clk;
f_clk = get_system_freqs(&c_clk, &h_clk, &p_clk);
s_clk = h_clk / soc_get_hsdiv();
l_clk = h_clk >> ((LCD_CONFIG & 7) + 1); /* div = 2^(val+1) */
#define MHZ 1000000
#define TMHZ 100000
_DEBUG_PRINTF("Clocks (MHz):");
_DEBUG_PRINTF(" FClk: %d.%d", f_clk / MHZ, (f_clk % MHZ) / TMHZ);
_DEBUG_PRINTF(" CPU: %d.%d", c_clk / MHZ, (c_clk % MHZ) / TMHZ);
_DEBUG_PRINTF(" AHB: %d.%d", h_clk / MHZ, (h_clk % MHZ) / TMHZ);
_DEBUG_PRINTF(" SM1: %d.%d", s_clk / MHZ, (s_clk % MHZ) / TMHZ);
_DEBUG_PRINTF(" LCD: %d.%d", l_clk / MHZ, (l_clk % MHZ) / TMHZ);
_DEBUG_PRINTF(" APB: %d.%d", p_clk / MHZ, (p_clk % MHZ) / TMHZ);
line++;
_DEBUG_PRINTF("CG16_SEL_x (Hz):");
_DEBUG_PRINTF(" OSC: %d", soc_get_oscsel_freq());
for (int i = 0; i < 3; i++)
_DEBUG_PRINTF(" PLL%d: %d (%d)", i,
pll_get_out_freq(i), pll_get_cfg_freq(i));
#endif
}
else if(state==1)
{