From 3178aa69871f5315d5b7f635c715a7e332f33e09 Mon Sep 17 00:00:00 2001 From: CalcLoverHK <0v0katai@gmail.com> Date: Sun, 16 Feb 2025 17:04:27 +0800 Subject: [PATCH] cpg: add superhyway clock frequency calculation --- include/gint/clock.h | 2 ++ src/cpg/cpg.c | 3 +++ 2 files changed, 5 insertions(+) diff --git a/include/gint/clock.h b/include/gint/clock.h index acb5479..3236b93 100644 --- a/include/gint/clock.h +++ b/include/gint/clock.h @@ -35,6 +35,7 @@ typedef struct int Bphi_div; int Iphi_div; int Pphi_div; + int Sphi_div; union { int CKIO_f; @@ -44,6 +45,7 @@ typedef struct int Bphi_f; int Iphi_f; int Pphi_f; + int Sphi_f; } clock_frequency_t; diff --git a/src/cpg/cpg.c b/src/cpg/cpg.c index ae230b4..0d6ed07 100644 --- a/src/cpg/cpg.c +++ b/src/cpg/cpg.c @@ -84,10 +84,12 @@ static void sh7305_probe(void) int divb = CPG.FRQCR.BFC; int divi = CPG.FRQCR.IFC; int divp = CPG.FRQCR.P1FC; + int divs = CPG.FRQCR.SFC; freq.Bphi_div = 1 << (divb + 1); freq.Iphi_div = 1 << (divi + 1); freq.Pphi_div = 1 << (divp + 1); + freq.Sphi_div = 1 << (divs + 1); /* Deduce the input frequency of divider 1 */ int base = 32768; @@ -99,6 +101,7 @@ static void sh7305_probe(void) freq.Bphi_f = base >> (divb + 1); freq.Iphi_f = base >> (divi + 1); freq.Pphi_f = base >> (divp + 1); + freq.Sphi_f = base >> (divs + 1); } #undef CPG