git: bb6a069c595a - main - arm/mv: Remove the unused get_l2clk

From: Andrew Turner <andrew_at_FreeBSD.org>
Date: Tue, 08 Apr 2025 10:49:18 UTC
The branch main has been updated by andrew:

URL: https://cgit.FreeBSD.org/src/commit/?id=bb6a069c595ad49ad59b3eb2d98d074b4cc006f9

commit bb6a069c595ad49ad59b3eb2d98d074b4cc006f9
Author:     Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2025-04-08 10:46:38 +0000
Commit:     Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2025-04-08 10:48:28 +0000

    arm/mv: Remove the unused get_l2clk
    
    Reviewed by:    cognet
    Sponsored by:   Arm Ltd
    Differential Revision:  https://reviews.freebsd.org/D49534
---
 sys/arm/mv/armadaxp/armadaxp.c | 95 ------------------------------------------
 sys/arm/mv/mvvar.h             |  1 -
 2 files changed, 96 deletions(-)

diff --git a/sys/arm/mv/armadaxp/armadaxp.c b/sys/arm/mv/armadaxp/armadaxp.c
index 2835a0d6b637..17a4b082d686 100644
--- a/sys/arm/mv/armadaxp/armadaxp.c
+++ b/sys/arm/mv/armadaxp/armadaxp.c
@@ -49,11 +49,9 @@
 #define FAB_FREQ_FIELD(sar)	(((0x01 & (sar >> 51)) << 4) | \
 				    (0x0F & (sar >> 24)))
 
-static uint32_t count_l2clk(void);
 void armadaxp_l2_init(void);
 void armadaxp_init_coher_fabric(void);
 int platform_get_ncpus(void);
-static uint64_t get_sar_value_armadaxp(void);
 
 #define ARMADAXP_L2_BASE		(MV_BASE + 0x8000)
 #define ARMADAXP_L2_CTRL		0x100
@@ -93,48 +91,6 @@ struct vco_freq_ratio {
 	uint8_t	vco_ddr;	/* VCO to DR(DDR memory) clock ratio */
 };
 
-static struct vco_freq_ratio freq_conf_table[] = {
-/*00*/	{ 1, 1,	 4,  2 },
-/*01*/	{ 1, 2,	 2,  2 },
-/*02*/	{ 2, 2,	 6,  3 },
-/*03*/	{ 2, 2,	 3,  3 },
-/*04*/	{ 1, 2,	 3,  3 },
-/*05*/	{ 1, 2,	 4,  2 },
-/*06*/	{ 1, 1,	 2,  2 },
-/*07*/	{ 2, 3,	 6,  6 },
-/*08*/	{ 2, 3,	 5,  5 },
-/*09*/	{ 1, 2,	 6,  3 },
-/*10*/	{ 2, 4,	10,  5 },
-/*11*/	{ 1, 3,	 6,  6 },
-/*12*/	{ 1, 2,	 5,  5 },
-/*13*/	{ 1, 3,	 6,  3 },
-/*14*/	{ 1, 2,	 5,  5 },
-/*15*/	{ 2, 2,	 5,  5 },
-/*16*/	{ 1, 1,	 3,  3 },
-/*17*/	{ 2, 5,	10, 10 },
-/*18*/	{ 1, 3,	 8,  4 },
-/*19*/	{ 1, 1,	 2,  1 },
-/*20*/	{ 2, 3,	 6,  3 },
-/*21*/	{ 1, 2,	 8,  4 },
-/*22*/	{ 2, 5,	10,  5 }
-};
-
-static uint16_t	cpu_clock_table[] = {
-    1000, 1066, 1200, 1333, 1500, 1666, 1800, 2000, 600,  667,  800,  1600,
-    2133, 2200, 2400 };
-
-static uint64_t
-get_sar_value_armadaxp(void)
-{
-	uint32_t sar_low, sar_high;
-
-	sar_high = bus_space_read_4(fdtbus_bs_tag, MV_MISC_BASE,
-	    SAMPLE_AT_RESET_HI);
-	sar_low = bus_space_read_4(fdtbus_bs_tag, MV_MISC_BASE,
-	    SAMPLE_AT_RESET_LO);
-	return (((uint64_t)sar_high << 32) | sar_low);
-}
-
 uint32_t
 get_tclk_armadaxp(void)
 {
@@ -156,57 +112,6 @@ get_cpu_freq_armadaxp(void)
 	return (0);
 }
 
-static uint32_t
-count_l2clk(void)
-{
-	uint64_t sar_reg;
-	uint32_t freq_vco, freq_l2clk;
-	uint8_t  sar_cpu_freq, sar_fab_freq, array_size;
-
-	/* Get value of the SAR register and process it */
-	sar_reg = get_sar_value_armadaxp();
-	sar_cpu_freq = CPU_FREQ_FIELD(sar_reg);
-	sar_fab_freq = FAB_FREQ_FIELD(sar_reg);
-
-	/* Check if CPU frequency field has correct value */
-	array_size = nitems(cpu_clock_table);
-	if (sar_cpu_freq >= array_size)
-		panic("Reserved value in cpu frequency configuration field: "
-		    "%d", sar_cpu_freq);
-
-	/* Check if fabric frequency field has correct value */
-	array_size = nitems(freq_conf_table);
-	if (sar_fab_freq >= array_size)
-		panic("Reserved value in fabric frequency configuration field: "
-		    "%d", sar_fab_freq);
-
-	/* Get CPU clock frequency */
-	freq_vco = cpu_clock_table[sar_cpu_freq] *
-	    freq_conf_table[sar_fab_freq].vco_cpu;
-
-	/* Get L2CLK clock frequency */
-	freq_l2clk = freq_vco / freq_conf_table[sar_fab_freq].vco_l2c;
-
-	/* Round L2CLK value to integer MHz */
-	if (((freq_vco % freq_conf_table[sar_fab_freq].vco_l2c) * 10 /
-	    freq_conf_table[sar_fab_freq].vco_l2c) >= 5)
-		freq_l2clk++;
-
-	return (freq_l2clk * 1000000);
-}
-
-uint32_t
-get_l2clk(void)
-{
-	static uint32_t	l2clk_freq = 0;
-
-	/* If get_l2clk is called first time get L2CLK value from register */
-	if (l2clk_freq == 0)
-		l2clk_freq = count_l2clk();
-
-	return (l2clk_freq);
-}
-
 static uint32_t
 read_coher_fabric(uint32_t reg)
 {
diff --git a/sys/arm/mv/mvvar.h b/sys/arm/mv/mvvar.h
index fe0867860e6a..733cde06667e 100644
--- a/sys/arm/mv/mvvar.h
+++ b/sys/arm/mv/mvvar.h
@@ -99,7 +99,6 @@ uint32_t ddr_attr(int i);
 
 uint32_t get_tclk(void);
 uint32_t get_cpu_freq(void);
-uint32_t get_l2clk(void);
 uint32_t read_cpu_ctrl(uint32_t);
 void write_cpu_ctrl(uint32_t, uint32_t);