* [PATCH 7/8] cpufreq: sc520_freq: Drop support for AMD Elan SC520
[not found] <cover.1778071745.git.sean@mess.org>
@ 2026-05-06 14:42 ` Sean Young
2026-05-07 4:44 ` Zhongqiu Han
2026-05-07 6:35 ` Viresh Kumar
2026-05-06 14:42 ` [PATCH 8/8] cpufreq: elanfreq: Drop support for AMD Elan SC4* Sean Young
1 sibling, 2 replies; 7+ messages in thread
From: Sean Young @ 2026-05-06 14:42 UTC (permalink / raw)
To: linux-kernel, Rafael J. Wysocki, Viresh Kumar; +Cc: linux-pm
Since commit 8b793a92d862 ("x86/cpu: Remove M486/M486SX/ELAN support"),
the AMD Elan SC520 is no longer supported, so the cpu frequency
driver is no longer needed.
Signed-off-by: Sean Young <sean@mess.org>
---
drivers/cpufreq/Kconfig.x86 | 11 ---
drivers/cpufreq/Makefile | 1 -
drivers/cpufreq/sc520_freq.c | 136 -----------------------------------
3 files changed, 148 deletions(-)
delete mode 100644 drivers/cpufreq/sc520_freq.c
diff --git a/drivers/cpufreq/Kconfig.x86 b/drivers/cpufreq/Kconfig.x86
index 027e6ea2e038..865b290b01ff 100644
--- a/drivers/cpufreq/Kconfig.x86
+++ b/drivers/cpufreq/Kconfig.x86
@@ -141,17 +141,6 @@ config ELAN_CPUFREQ
If in doubt, say N.
-config SC520_CPUFREQ
- tristate "AMD Elan SC520"
- depends on MELAN
- help
- This adds the CPUFreq driver for AMD Elan SC520 processor.
-
- For details, take a look at <file:Documentation/cpu-freq/>.
-
- If in doubt, say N.
-
-
config X86_POWERNOW_K6
tristate "AMD Mobile K6-2/K6-3 PowerNow!"
depends on X86_32
diff --git a/drivers/cpufreq/Makefile b/drivers/cpufreq/Makefile
index 385c9fcc65c6..96196edf79d5 100644
--- a/drivers/cpufreq/Makefile
+++ b/drivers/cpufreq/Makefile
@@ -41,7 +41,6 @@ obj-$(CONFIG_X86_POWERNOW_K7) += powernow-k7.o
obj-$(CONFIG_X86_LONGHAUL) += longhaul.o
obj-$(CONFIG_X86_E_POWERSAVER) += e_powersaver.o
obj-$(CONFIG_ELAN_CPUFREQ) += elanfreq.o
-obj-$(CONFIG_SC520_CPUFREQ) += sc520_freq.o
obj-$(CONFIG_X86_LONGRUN) += longrun.o
obj-$(CONFIG_X86_GX_SUSPMOD) += gx-suspmod.o
obj-$(CONFIG_X86_SPEEDSTEP_ICH) += speedstep-ich.o
diff --git a/drivers/cpufreq/sc520_freq.c b/drivers/cpufreq/sc520_freq.c
deleted file mode 100644
index b360f03a116f..000000000000
--- a/drivers/cpufreq/sc520_freq.c
+++ /dev/null
@@ -1,136 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * sc520_freq.c: cpufreq driver for the AMD Elan sc520
- *
- * Copyright (C) 2005 Sean Young <sean@mess.org>
- *
- * Based on elanfreq.c
- *
- * 2005-03-30: - initial revision
- */
-
-#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/init.h>
-
-#include <linux/delay.h>
-#include <linux/cpufreq.h>
-#include <linux/timex.h>
-#include <linux/io.h>
-
-#include <asm/cpu_device_id.h>
-
-#define MMCR_BASE 0xfffef000 /* The default base address */
-#define OFFS_CPUCTL 0x2 /* CPU Control Register */
-
-static __u8 __iomem *cpuctl;
-
-static struct cpufreq_frequency_table sc520_freq_table[] = {
- {0, 0x01, 100000},
- {0, 0x02, 133000},
- {0, 0, CPUFREQ_TABLE_END},
-};
-
-static unsigned int sc520_freq_get_cpu_frequency(unsigned int cpu)
-{
- u8 clockspeed_reg = *cpuctl;
-
- switch (clockspeed_reg & 0x03) {
- default:
- pr_err("error: cpuctl register has unexpected value %02x\n",
- clockspeed_reg);
- fallthrough;
- case 0x01:
- return 100000;
- case 0x02:
- return 133000;
- }
-}
-
-static int sc520_freq_target(struct cpufreq_policy *policy, unsigned int state)
-{
-
- u8 clockspeed_reg;
-
- local_irq_disable();
-
- clockspeed_reg = *cpuctl & ~0x03;
- *cpuctl = clockspeed_reg | sc520_freq_table[state].driver_data;
-
- local_irq_enable();
-
- return 0;
-}
-
-/*
- * Module init and exit code
- */
-
-static int sc520_freq_cpu_init(struct cpufreq_policy *policy)
-{
- struct cpuinfo_x86 *c = &cpu_data(0);
-
- /* capability check */
- if (c->x86_vendor != X86_VENDOR_AMD ||
- c->x86 != 4 || c->x86_model != 9)
- return -ENODEV;
-
- /* cpuinfo and default policy values */
- policy->cpuinfo.transition_latency = 1000000; /* 1ms */
- policy->freq_table = sc520_freq_table;
-
- return 0;
-}
-
-
-static struct cpufreq_driver sc520_freq_driver = {
- .get = sc520_freq_get_cpu_frequency,
- .verify = cpufreq_generic_frequency_table_verify,
- .target_index = sc520_freq_target,
- .init = sc520_freq_cpu_init,
- .name = "sc520_freq",
-};
-
-static const struct x86_cpu_id sc520_ids[] = {
- X86_MATCH_VENDOR_FAM_MODEL(AMD, 4, 9, NULL),
- {}
-};
-MODULE_DEVICE_TABLE(x86cpu, sc520_ids);
-
-static int __init sc520_freq_init(void)
-{
- int err;
-
- if (!x86_match_cpu(sc520_ids))
- return -ENODEV;
-
- cpuctl = ioremap((unsigned long)(MMCR_BASE + OFFS_CPUCTL), 1);
- if (!cpuctl) {
- pr_err("sc520_freq: error: failed to remap memory\n");
- return -ENOMEM;
- }
-
- err = cpufreq_register_driver(&sc520_freq_driver);
- if (err)
- iounmap(cpuctl);
-
- return err;
-}
-
-
-static void __exit sc520_freq_exit(void)
-{
- cpufreq_unregister_driver(&sc520_freq_driver);
- iounmap(cpuctl);
-}
-
-
-MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Sean Young <sean@mess.org>");
-MODULE_DESCRIPTION("cpufreq driver for AMD's Elan sc520 CPU");
-
-module_init(sc520_freq_init);
-module_exit(sc520_freq_exit);
-
--
2.54.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 8/8] cpufreq: elanfreq: Drop support for AMD Elan SC4*
[not found] <cover.1778071745.git.sean@mess.org>
2026-05-06 14:42 ` [PATCH 7/8] cpufreq: sc520_freq: Drop support for AMD Elan SC520 Sean Young
@ 2026-05-06 14:42 ` Sean Young
2026-05-07 4:50 ` Zhongqiu Han
2026-05-07 6:35 ` Viresh Kumar
1 sibling, 2 replies; 7+ messages in thread
From: Sean Young @ 2026-05-06 14:42 UTC (permalink / raw)
To: linux-kernel, Rafael J. Wysocki, Viresh Kumar; +Cc: linux-pm
Since commit 8b793a92d862 ("x86/cpu: Remove M486/M486SX/ELAN support"),
the AMD Elan SC4* is no longer supported, so the cpu frequency
driver is no longer needed.
Signed-off-by: Sean Young <sean@mess.org>
---
drivers/cpufreq/Kconfig.x86 | 15 ---
drivers/cpufreq/Makefile | 1 -
drivers/cpufreq/elanfreq.c | 226 ------------------------------------
3 files changed, 242 deletions(-)
delete mode 100644 drivers/cpufreq/elanfreq.c
diff --git a/drivers/cpufreq/Kconfig.x86 b/drivers/cpufreq/Kconfig.x86
index 865b290b01ff..c42dd39e0b2a 100644
--- a/drivers/cpufreq/Kconfig.x86
+++ b/drivers/cpufreq/Kconfig.x86
@@ -126,21 +126,6 @@ config X86_ACPI_CPUFREQ_CPB
By enabling this option the acpi_cpufreq driver provides the old
entry in addition to the new boost ones, for compatibility reasons.
-config ELAN_CPUFREQ
- tristate "AMD Elan SC400 and SC410"
- depends on MELAN
- help
- This adds the CPUFreq driver for AMD Elan SC400 and SC410
- processors.
-
- You need to specify the processor maximum speed as boot
- parameter: elanfreq=maxspeed (in kHz) or as module
- parameter "max_freq".
-
- For details, take a look at <file:Documentation/cpu-freq/>.
-
- If in doubt, say N.
-
config X86_POWERNOW_K6
tristate "AMD Mobile K6-2/K6-3 PowerNow!"
depends on X86_32
diff --git a/drivers/cpufreq/Makefile b/drivers/cpufreq/Makefile
index 96196edf79d5..6c7a39b7f8d2 100644
--- a/drivers/cpufreq/Makefile
+++ b/drivers/cpufreq/Makefile
@@ -40,7 +40,6 @@ obj-$(CONFIG_X86_POWERNOW_K6) += powernow-k6.o
obj-$(CONFIG_X86_POWERNOW_K7) += powernow-k7.o
obj-$(CONFIG_X86_LONGHAUL) += longhaul.o
obj-$(CONFIG_X86_E_POWERSAVER) += e_powersaver.o
-obj-$(CONFIG_ELAN_CPUFREQ) += elanfreq.o
obj-$(CONFIG_X86_LONGRUN) += longrun.o
obj-$(CONFIG_X86_GX_SUSPMOD) += gx-suspmod.o
obj-$(CONFIG_X86_SPEEDSTEP_ICH) += speedstep-ich.o
diff --git a/drivers/cpufreq/elanfreq.c b/drivers/cpufreq/elanfreq.c
deleted file mode 100644
index fc5a58088b35..000000000000
--- a/drivers/cpufreq/elanfreq.c
+++ /dev/null
@@ -1,226 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * elanfreq: cpufreq driver for the AMD ELAN family
- *
- * (c) Copyright 2002 Robert Schwebel <r.schwebel@pengutronix.de>
- *
- * Parts of this code are (c) Sven Geggus <sven@geggus.net>
- *
- * All Rights Reserved.
- *
- * 2002-02-13: - initial revision for 2.4.18-pre9 by Robert Schwebel
- */
-
-#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/init.h>
-
-#include <linux/delay.h>
-#include <linux/cpufreq.h>
-
-#include <asm/cpu_device_id.h>
-#include <linux/timex.h>
-#include <linux/io.h>
-
-#define REG_CSCIR 0x22 /* Chip Setup and Control Index Register */
-#define REG_CSCDR 0x23 /* Chip Setup and Control Data Register */
-
-/* Module parameter */
-static int max_freq;
-
-struct s_elan_multiplier {
- int clock; /* frequency in kHz */
- int val40h; /* PMU Force Mode register */
- int val80h; /* CPU Clock Speed Register */
-};
-
-/*
- * It is important that the frequencies
- * are listed in ascending order here!
- */
-static struct s_elan_multiplier elan_multiplier[] = {
- {1000, 0x02, 0x18},
- {2000, 0x02, 0x10},
- {4000, 0x02, 0x08},
- {8000, 0x00, 0x00},
- {16000, 0x00, 0x02},
- {33000, 0x00, 0x04},
- {66000, 0x01, 0x04},
- {99000, 0x01, 0x05}
-};
-
-static struct cpufreq_frequency_table elanfreq_table[] = {
- {0, 0, 1000},
- {0, 1, 2000},
- {0, 2, 4000},
- {0, 3, 8000},
- {0, 4, 16000},
- {0, 5, 33000},
- {0, 6, 66000},
- {0, 7, 99000},
- {0, 0, CPUFREQ_TABLE_END},
-};
-
-
-/**
- * elanfreq_get_cpu_frequency: determine current cpu speed
- *
- * Finds out at which frequency the CPU of the Elan SOC runs
- * at the moment. Frequencies from 1 to 33 MHz are generated
- * the normal way, 66 and 99 MHz are called "Hyperspeed Mode"
- * and have the rest of the chip running with 33 MHz.
- */
-
-static unsigned int elanfreq_get_cpu_frequency(unsigned int cpu)
-{
- u8 clockspeed_reg; /* Clock Speed Register */
-
- local_irq_disable();
- outb_p(0x80, REG_CSCIR);
- clockspeed_reg = inb_p(REG_CSCDR);
- local_irq_enable();
-
- if ((clockspeed_reg & 0xE0) == 0xE0)
- return 0;
-
- /* Are we in CPU clock multiplied mode (66/99 MHz)? */
- if ((clockspeed_reg & 0xE0) == 0xC0) {
- if ((clockspeed_reg & 0x01) == 0)
- return 66000;
- else
- return 99000;
- }
-
- /* 33 MHz is not 32 MHz... */
- if ((clockspeed_reg & 0xE0) == 0xA0)
- return 33000;
-
- return (1<<((clockspeed_reg & 0xE0) >> 5)) * 1000;
-}
-
-
-static int elanfreq_target(struct cpufreq_policy *policy,
- unsigned int state)
-{
- /*
- * Access to the Elan's internal registers is indexed via
- * 0x22: Chip Setup & Control Register Index Register (CSCI)
- * 0x23: Chip Setup & Control Register Data Register (CSCD)
- *
- */
-
- /*
- * 0x40 is the Power Management Unit's Force Mode Register.
- * Bit 6 enables Hyperspeed Mode (66/100 MHz core frequency)
- */
-
- local_irq_disable();
- outb_p(0x40, REG_CSCIR); /* Disable hyperspeed mode */
- outb_p(0x00, REG_CSCDR);
- local_irq_enable(); /* wait till internal pipelines and */
- udelay(1000); /* buffers have cleaned up */
-
- local_irq_disable();
-
- /* now, set the CPU clock speed register (0x80) */
- outb_p(0x80, REG_CSCIR);
- outb_p(elan_multiplier[state].val80h, REG_CSCDR);
-
- /* now, the hyperspeed bit in PMU Force Mode Register (0x40) */
- outb_p(0x40, REG_CSCIR);
- outb_p(elan_multiplier[state].val40h, REG_CSCDR);
- udelay(10000);
- local_irq_enable();
-
- return 0;
-}
-/*
- * Module init and exit code
- */
-
-static int elanfreq_cpu_init(struct cpufreq_policy *policy)
-{
- struct cpuinfo_x86 *c = &cpu_data(0);
- struct cpufreq_frequency_table *pos;
-
- /* capability check */
- if ((c->x86_vendor != X86_VENDOR_AMD) ||
- (c->x86 != 4) || (c->x86_model != 10))
- return -ENODEV;
-
- /* max freq */
- if (!max_freq)
- max_freq = elanfreq_get_cpu_frequency(0);
-
- /* table init */
- cpufreq_for_each_entry(pos, elanfreq_table)
- if (pos->frequency > max_freq)
- pos->frequency = CPUFREQ_ENTRY_INVALID;
-
- policy->freq_table = elanfreq_table;
- return 0;
-}
-
-
-#ifndef MODULE
-/**
- * elanfreq_setup - elanfreq command line parameter parsing
- *
- * elanfreq command line parameter. Use:
- * elanfreq=66000
- * to set the maximum CPU frequency to 66 MHz. Note that in
- * case you do not give this boot parameter, the maximum
- * frequency will fall back to _current_ CPU frequency which
- * might be lower. If you build this as a module, use the
- * max_freq module parameter instead.
- */
-static int __init elanfreq_setup(char *str)
-{
- max_freq = simple_strtoul(str, &str, 0);
- pr_warn("You're using the deprecated elanfreq command line option. Use elanfreq.max_freq instead, please!\n");
- return 1;
-}
-__setup("elanfreq=", elanfreq_setup);
-#endif
-
-
-static struct cpufreq_driver elanfreq_driver = {
- .get = elanfreq_get_cpu_frequency,
- .flags = CPUFREQ_NO_AUTO_DYNAMIC_SWITCHING,
- .verify = cpufreq_generic_frequency_table_verify,
- .target_index = elanfreq_target,
- .init = elanfreq_cpu_init,
- .name = "elanfreq",
-};
-
-static const struct x86_cpu_id elan_id[] = {
- X86_MATCH_VENDOR_FAM_MODEL(AMD, 4, 10, NULL),
- {}
-};
-MODULE_DEVICE_TABLE(x86cpu, elan_id);
-
-static int __init elanfreq_init(void)
-{
- if (!x86_match_cpu(elan_id))
- return -ENODEV;
- return cpufreq_register_driver(&elanfreq_driver);
-}
-
-
-static void __exit elanfreq_exit(void)
-{
- cpufreq_unregister_driver(&elanfreq_driver);
-}
-
-
-module_param(max_freq, int, 0444);
-
-MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Robert Schwebel <r.schwebel@pengutronix.de>, "
- "Sven Geggus <sven@geggus.net>");
-MODULE_DESCRIPTION("cpufreq driver for AMD's Elan CPUs");
-
-module_init(elanfreq_init);
-module_exit(elanfreq_exit);
--
2.54.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 7/8] cpufreq: sc520_freq: Drop support for AMD Elan SC520
2026-05-06 14:42 ` [PATCH 7/8] cpufreq: sc520_freq: Drop support for AMD Elan SC520 Sean Young
@ 2026-05-07 4:44 ` Zhongqiu Han
2026-05-07 6:35 ` Viresh Kumar
1 sibling, 0 replies; 7+ messages in thread
From: Zhongqiu Han @ 2026-05-07 4:44 UTC (permalink / raw)
To: Sean Young, linux-kernel, Rafael J. Wysocki, Viresh Kumar
Cc: linux-pm, zhongqiu.han
On 5/6/2026 10:42 PM, Sean Young wrote:
> Since commit 8b793a92d862 ("x86/cpu: Remove M486/M486SX/ELAN support"),
> the AMD Elan SC520 is no longer supported, so the cpu frequency
> driver is no longer needed.
>
> Signed-off-by: Sean Young <sean@mess.org>
Reviewed-by: Zhongqiu Han <zhongqiu.han@oss.qualcomm.com>
> ---
> drivers/cpufreq/Kconfig.x86 | 11 ---
> drivers/cpufreq/Makefile | 1 -
> drivers/cpufreq/sc520_freq.c | 136 -----------------------------------
> 3 files changed, 148 deletions(-)
> delete mode 100644 drivers/cpufreq/sc520_freq.c
>
> diff --git a/drivers/cpufreq/Kconfig.x86 b/drivers/cpufreq/Kconfig.x86
> index 027e6ea2e038..865b290b01ff 100644
> --- a/drivers/cpufreq/Kconfig.x86
> +++ b/drivers/cpufreq/Kconfig.x86
> @@ -141,17 +141,6 @@ config ELAN_CPUFREQ
>
> If in doubt, say N.
>
> -config SC520_CPUFREQ
> - tristate "AMD Elan SC520"
> - depends on MELAN
> - help
> - This adds the CPUFreq driver for AMD Elan SC520 processor.
> -
> - For details, take a look at <file:Documentation/cpu-freq/>.
> -
> - If in doubt, say N.
> -
> -
> config X86_POWERNOW_K6
> tristate "AMD Mobile K6-2/K6-3 PowerNow!"
> depends on X86_32
> diff --git a/drivers/cpufreq/Makefile b/drivers/cpufreq/Makefile
> index 385c9fcc65c6..96196edf79d5 100644
> --- a/drivers/cpufreq/Makefile
> +++ b/drivers/cpufreq/Makefile
> @@ -41,7 +41,6 @@ obj-$(CONFIG_X86_POWERNOW_K7) += powernow-k7.o
> obj-$(CONFIG_X86_LONGHAUL) += longhaul.o
> obj-$(CONFIG_X86_E_POWERSAVER) += e_powersaver.o
> obj-$(CONFIG_ELAN_CPUFREQ) += elanfreq.o
> -obj-$(CONFIG_SC520_CPUFREQ) += sc520_freq.o
> obj-$(CONFIG_X86_LONGRUN) += longrun.o
> obj-$(CONFIG_X86_GX_SUSPMOD) += gx-suspmod.o
> obj-$(CONFIG_X86_SPEEDSTEP_ICH) += speedstep-ich.o
> diff --git a/drivers/cpufreq/sc520_freq.c b/drivers/cpufreq/sc520_freq.c
> deleted file mode 100644
> index b360f03a116f..000000000000
> --- a/drivers/cpufreq/sc520_freq.c
> +++ /dev/null
> @@ -1,136 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0-or-later
> -/*
> - * sc520_freq.c: cpufreq driver for the AMD Elan sc520
> - *
> - * Copyright (C) 2005 Sean Young <sean@mess.org>
> - *
> - * Based on elanfreq.c
> - *
> - * 2005-03-30: - initial revision
> - */
> -
> -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> -
> -#include <linux/kernel.h>
> -#include <linux/module.h>
> -#include <linux/init.h>
> -
> -#include <linux/delay.h>
> -#include <linux/cpufreq.h>
> -#include <linux/timex.h>
> -#include <linux/io.h>
> -
> -#include <asm/cpu_device_id.h>
> -
> -#define MMCR_BASE 0xfffef000 /* The default base address */
> -#define OFFS_CPUCTL 0x2 /* CPU Control Register */
> -
> -static __u8 __iomem *cpuctl;
> -
> -static struct cpufreq_frequency_table sc520_freq_table[] = {
> - {0, 0x01, 100000},
> - {0, 0x02, 133000},
> - {0, 0, CPUFREQ_TABLE_END},
> -};
> -
> -static unsigned int sc520_freq_get_cpu_frequency(unsigned int cpu)
> -{
> - u8 clockspeed_reg = *cpuctl;
> -
> - switch (clockspeed_reg & 0x03) {
> - default:
> - pr_err("error: cpuctl register has unexpected value %02x\n",
> - clockspeed_reg);
> - fallthrough;
> - case 0x01:
> - return 100000;
> - case 0x02:
> - return 133000;
> - }
> -}
> -
> -static int sc520_freq_target(struct cpufreq_policy *policy, unsigned int state)
> -{
> -
> - u8 clockspeed_reg;
> -
> - local_irq_disable();
> -
> - clockspeed_reg = *cpuctl & ~0x03;
> - *cpuctl = clockspeed_reg | sc520_freq_table[state].driver_data;
> -
> - local_irq_enable();
> -
> - return 0;
> -}
> -
> -/*
> - * Module init and exit code
> - */
> -
> -static int sc520_freq_cpu_init(struct cpufreq_policy *policy)
> -{
> - struct cpuinfo_x86 *c = &cpu_data(0);
> -
> - /* capability check */
> - if (c->x86_vendor != X86_VENDOR_AMD ||
> - c->x86 != 4 || c->x86_model != 9)
> - return -ENODEV;
> -
> - /* cpuinfo and default policy values */
> - policy->cpuinfo.transition_latency = 1000000; /* 1ms */
> - policy->freq_table = sc520_freq_table;
> -
> - return 0;
> -}
> -
> -
> -static struct cpufreq_driver sc520_freq_driver = {
> - .get = sc520_freq_get_cpu_frequency,
> - .verify = cpufreq_generic_frequency_table_verify,
> - .target_index = sc520_freq_target,
> - .init = sc520_freq_cpu_init,
> - .name = "sc520_freq",
> -};
> -
> -static const struct x86_cpu_id sc520_ids[] = {
> - X86_MATCH_VENDOR_FAM_MODEL(AMD, 4, 9, NULL),
> - {}
> -};
> -MODULE_DEVICE_TABLE(x86cpu, sc520_ids);
> -
> -static int __init sc520_freq_init(void)
> -{
> - int err;
> -
> - if (!x86_match_cpu(sc520_ids))
> - return -ENODEV;
> -
> - cpuctl = ioremap((unsigned long)(MMCR_BASE + OFFS_CPUCTL), 1);
> - if (!cpuctl) {
> - pr_err("sc520_freq: error: failed to remap memory\n");
> - return -ENOMEM;
> - }
> -
> - err = cpufreq_register_driver(&sc520_freq_driver);
> - if (err)
> - iounmap(cpuctl);
> -
> - return err;
> -}
> -
> -
> -static void __exit sc520_freq_exit(void)
> -{
> - cpufreq_unregister_driver(&sc520_freq_driver);
> - iounmap(cpuctl);
> -}
> -
> -
> -MODULE_LICENSE("GPL");
> -MODULE_AUTHOR("Sean Young <sean@mess.org>");
> -MODULE_DESCRIPTION("cpufreq driver for AMD's Elan sc520 CPU");
> -
> -module_init(sc520_freq_init);
> -module_exit(sc520_freq_exit);
> -
--
Thx and BRs,
Zhongqiu Han
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 8/8] cpufreq: elanfreq: Drop support for AMD Elan SC4*
2026-05-06 14:42 ` [PATCH 8/8] cpufreq: elanfreq: Drop support for AMD Elan SC4* Sean Young
@ 2026-05-07 4:50 ` Zhongqiu Han
2026-05-07 8:58 ` Sean Young
2026-05-07 6:35 ` Viresh Kumar
1 sibling, 1 reply; 7+ messages in thread
From: Zhongqiu Han @ 2026-05-07 4:50 UTC (permalink / raw)
To: Sean Young, linux-kernel, Rafael J. Wysocki, Viresh Kumar
Cc: linux-pm, zhongqiu.han
On 5/6/2026 10:42 PM, Sean Young wrote:
> Since commit 8b793a92d862 ("x86/cpu: Remove M486/M486SX/ELAN support"),
> the AMD Elan SC4* is no longer supported, so the cpu frequency
> driver is no longer needed.
>
> Signed-off-by: Sean Young <sean@mess.org>
> ---
> drivers/cpufreq/Kconfig.x86 | 15 ---
> drivers/cpufreq/Makefile | 1 -
> drivers/cpufreq/elanfreq.c | 226 ------------------------------------
> 3 files changed, 242 deletions(-)
> delete mode 100644 drivers/cpufreq/elanfreq.c
>
Thanks Sean,
One minor nit: now that the elanfreq driver and its setup code are
removed, should the corresponding elanfreq= entry in
Documentation/admin-guide/kernel-parameters.txt be dropped as well?
https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git/tree/Documentation/admin-guide/kernel-parameters.txt?h=linux-next#n1671
> diff --git a/drivers/cpufreq/Kconfig.x86 b/drivers/cpufreq/Kconfig.x86
> index 865b290b01ff..c42dd39e0b2a 100644
> --- a/drivers/cpufreq/Kconfig.x86
> +++ b/drivers/cpufreq/Kconfig.x86
> @@ -126,21 +126,6 @@ config X86_ACPI_CPUFREQ_CPB
> By enabling this option the acpi_cpufreq driver provides the old
> entry in addition to the new boost ones, for compatibility reasons.
>
> -config ELAN_CPUFREQ
> - tristate "AMD Elan SC400 and SC410"
> - depends on MELAN
> - help
> - This adds the CPUFreq driver for AMD Elan SC400 and SC410
> - processors.
> -
> - You need to specify the processor maximum speed as boot
> - parameter: elanfreq=maxspeed (in kHz) or as module
> - parameter "max_freq".
> -
> - For details, take a look at <file:Documentation/cpu-freq/>.
> -
> - If in doubt, say N.
> -
> config X86_POWERNOW_K6
> tristate "AMD Mobile K6-2/K6-3 PowerNow!"
> depends on X86_32
> diff --git a/drivers/cpufreq/Makefile b/drivers/cpufreq/Makefile
> index 96196edf79d5..6c7a39b7f8d2 100644
> --- a/drivers/cpufreq/Makefile
> +++ b/drivers/cpufreq/Makefile
> @@ -40,7 +40,6 @@ obj-$(CONFIG_X86_POWERNOW_K6) += powernow-k6.o
> obj-$(CONFIG_X86_POWERNOW_K7) += powernow-k7.o
> obj-$(CONFIG_X86_LONGHAUL) += longhaul.o
> obj-$(CONFIG_X86_E_POWERSAVER) += e_powersaver.o
> -obj-$(CONFIG_ELAN_CPUFREQ) += elanfreq.o
> obj-$(CONFIG_X86_LONGRUN) += longrun.o
> obj-$(CONFIG_X86_GX_SUSPMOD) += gx-suspmod.o
> obj-$(CONFIG_X86_SPEEDSTEP_ICH) += speedstep-ich.o
> diff --git a/drivers/cpufreq/elanfreq.c b/drivers/cpufreq/elanfreq.c
> deleted file mode 100644
> index fc5a58088b35..000000000000
> --- a/drivers/cpufreq/elanfreq.c
> +++ /dev/null
> @@ -1,226 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0-or-later
> -/*
> - * elanfreq: cpufreq driver for the AMD ELAN family
> - *
> - * (c) Copyright 2002 Robert Schwebel <r.schwebel@pengutronix.de>
> - *
> - * Parts of this code are (c) Sven Geggus <sven@geggus.net>
> - *
> - * All Rights Reserved.
> - *
> - * 2002-02-13: - initial revision for 2.4.18-pre9 by Robert Schwebel
> - */
> -
> -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> -
> -#include <linux/kernel.h>
> -#include <linux/module.h>
> -#include <linux/init.h>
> -
> -#include <linux/delay.h>
> -#include <linux/cpufreq.h>
> -
> -#include <asm/cpu_device_id.h>
> -#include <linux/timex.h>
> -#include <linux/io.h>
> -
> -#define REG_CSCIR 0x22 /* Chip Setup and Control Index Register */
> -#define REG_CSCDR 0x23 /* Chip Setup and Control Data Register */
> -
> -/* Module parameter */
> -static int max_freq;
> -
> -struct s_elan_multiplier {
> - int clock; /* frequency in kHz */
> - int val40h; /* PMU Force Mode register */
> - int val80h; /* CPU Clock Speed Register */
> -};
> -
> -/*
> - * It is important that the frequencies
> - * are listed in ascending order here!
> - */
> -static struct s_elan_multiplier elan_multiplier[] = {
> - {1000, 0x02, 0x18},
> - {2000, 0x02, 0x10},
> - {4000, 0x02, 0x08},
> - {8000, 0x00, 0x00},
> - {16000, 0x00, 0x02},
> - {33000, 0x00, 0x04},
> - {66000, 0x01, 0x04},
> - {99000, 0x01, 0x05}
> -};
> -
> -static struct cpufreq_frequency_table elanfreq_table[] = {
> - {0, 0, 1000},
> - {0, 1, 2000},
> - {0, 2, 4000},
> - {0, 3, 8000},
> - {0, 4, 16000},
> - {0, 5, 33000},
> - {0, 6, 66000},
> - {0, 7, 99000},
> - {0, 0, CPUFREQ_TABLE_END},
> -};
> -
> -
> -/**
> - * elanfreq_get_cpu_frequency: determine current cpu speed
> - *
> - * Finds out at which frequency the CPU of the Elan SOC runs
> - * at the moment. Frequencies from 1 to 33 MHz are generated
> - * the normal way, 66 and 99 MHz are called "Hyperspeed Mode"
> - * and have the rest of the chip running with 33 MHz.
> - */
> -
> -static unsigned int elanfreq_get_cpu_frequency(unsigned int cpu)
> -{
> - u8 clockspeed_reg; /* Clock Speed Register */
> -
> - local_irq_disable();
> - outb_p(0x80, REG_CSCIR);
> - clockspeed_reg = inb_p(REG_CSCDR);
> - local_irq_enable();
> -
> - if ((clockspeed_reg & 0xE0) == 0xE0)
> - return 0;
> -
> - /* Are we in CPU clock multiplied mode (66/99 MHz)? */
> - if ((clockspeed_reg & 0xE0) == 0xC0) {
> - if ((clockspeed_reg & 0x01) == 0)
> - return 66000;
> - else
> - return 99000;
> - }
> -
> - /* 33 MHz is not 32 MHz... */
> - if ((clockspeed_reg & 0xE0) == 0xA0)
> - return 33000;
> -
> - return (1<<((clockspeed_reg & 0xE0) >> 5)) * 1000;
> -}
> -
> -
> -static int elanfreq_target(struct cpufreq_policy *policy,
> - unsigned int state)
> -{
> - /*
> - * Access to the Elan's internal registers is indexed via
> - * 0x22: Chip Setup & Control Register Index Register (CSCI)
> - * 0x23: Chip Setup & Control Register Data Register (CSCD)
> - *
> - */
> -
> - /*
> - * 0x40 is the Power Management Unit's Force Mode Register.
> - * Bit 6 enables Hyperspeed Mode (66/100 MHz core frequency)
> - */
> -
> - local_irq_disable();
> - outb_p(0x40, REG_CSCIR); /* Disable hyperspeed mode */
> - outb_p(0x00, REG_CSCDR);
> - local_irq_enable(); /* wait till internal pipelines and */
> - udelay(1000); /* buffers have cleaned up */
> -
> - local_irq_disable();
> -
> - /* now, set the CPU clock speed register (0x80) */
> - outb_p(0x80, REG_CSCIR);
> - outb_p(elan_multiplier[state].val80h, REG_CSCDR);
> -
> - /* now, the hyperspeed bit in PMU Force Mode Register (0x40) */
> - outb_p(0x40, REG_CSCIR);
> - outb_p(elan_multiplier[state].val40h, REG_CSCDR);
> - udelay(10000);
> - local_irq_enable();
> -
> - return 0;
> -}
> -/*
> - * Module init and exit code
> - */
> -
> -static int elanfreq_cpu_init(struct cpufreq_policy *policy)
> -{
> - struct cpuinfo_x86 *c = &cpu_data(0);
> - struct cpufreq_frequency_table *pos;
> -
> - /* capability check */
> - if ((c->x86_vendor != X86_VENDOR_AMD) ||
> - (c->x86 != 4) || (c->x86_model != 10))
> - return -ENODEV;
> -
> - /* max freq */
> - if (!max_freq)
> - max_freq = elanfreq_get_cpu_frequency(0);
> -
> - /* table init */
> - cpufreq_for_each_entry(pos, elanfreq_table)
> - if (pos->frequency > max_freq)
> - pos->frequency = CPUFREQ_ENTRY_INVALID;
> -
> - policy->freq_table = elanfreq_table;
> - return 0;
> -}
> -
> -
> -#ifndef MODULE
> -/**
> - * elanfreq_setup - elanfreq command line parameter parsing
> - *
> - * elanfreq command line parameter. Use:
> - * elanfreq=66000
> - * to set the maximum CPU frequency to 66 MHz. Note that in
> - * case you do not give this boot parameter, the maximum
> - * frequency will fall back to _current_ CPU frequency which
> - * might be lower. If you build this as a module, use the
> - * max_freq module parameter instead.
> - */
> -static int __init elanfreq_setup(char *str)
> -{
> - max_freq = simple_strtoul(str, &str, 0);
> - pr_warn("You're using the deprecated elanfreq command line option. Use elanfreq.max_freq instead, please!\n");
> - return 1;
> -}
> -__setup("elanfreq=", elanfreq_setup);
> -#endif
> -
> -
> -static struct cpufreq_driver elanfreq_driver = {
> - .get = elanfreq_get_cpu_frequency,
> - .flags = CPUFREQ_NO_AUTO_DYNAMIC_SWITCHING,
> - .verify = cpufreq_generic_frequency_table_verify,
> - .target_index = elanfreq_target,
> - .init = elanfreq_cpu_init,
> - .name = "elanfreq",
> -};
> -
> -static const struct x86_cpu_id elan_id[] = {
> - X86_MATCH_VENDOR_FAM_MODEL(AMD, 4, 10, NULL),
> - {}
> -};
> -MODULE_DEVICE_TABLE(x86cpu, elan_id);
> -
> -static int __init elanfreq_init(void)
> -{
> - if (!x86_match_cpu(elan_id))
> - return -ENODEV;
> - return cpufreq_register_driver(&elanfreq_driver);
> -}
> -
> -
> -static void __exit elanfreq_exit(void)
> -{
> - cpufreq_unregister_driver(&elanfreq_driver);
> -}
> -
> -
> -module_param(max_freq, int, 0444);
> -
> -MODULE_LICENSE("GPL");
> -MODULE_AUTHOR("Robert Schwebel <r.schwebel@pengutronix.de>, "
> - "Sven Geggus <sven@geggus.net>");
> -MODULE_DESCRIPTION("cpufreq driver for AMD's Elan CPUs");
> -
> -module_init(elanfreq_init);
> -module_exit(elanfreq_exit);
--
Thx and BRs,
Zhongqiu Han
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 7/8] cpufreq: sc520_freq: Drop support for AMD Elan SC520
2026-05-06 14:42 ` [PATCH 7/8] cpufreq: sc520_freq: Drop support for AMD Elan SC520 Sean Young
2026-05-07 4:44 ` Zhongqiu Han
@ 2026-05-07 6:35 ` Viresh Kumar
1 sibling, 0 replies; 7+ messages in thread
From: Viresh Kumar @ 2026-05-07 6:35 UTC (permalink / raw)
To: Sean Young; +Cc: linux-kernel, Rafael J. Wysocki, linux-pm
On 06-05-26, 15:42, Sean Young wrote:
> Since commit 8b793a92d862 ("x86/cpu: Remove M486/M486SX/ELAN support"),
> the AMD Elan SC520 is no longer supported, so the cpu frequency
> driver is no longer needed.
>
> Signed-off-by: Sean Young <sean@mess.org>
> ---
> drivers/cpufreq/Kconfig.x86 | 11 ---
> drivers/cpufreq/Makefile | 1 -
> drivers/cpufreq/sc520_freq.c | 136 -----------------------------------
> 3 files changed, 148 deletions(-)
> delete mode 100644 drivers/cpufreq/sc520_freq.c
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
--
viresh
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 8/8] cpufreq: elanfreq: Drop support for AMD Elan SC4*
2026-05-06 14:42 ` [PATCH 8/8] cpufreq: elanfreq: Drop support for AMD Elan SC4* Sean Young
2026-05-07 4:50 ` Zhongqiu Han
@ 2026-05-07 6:35 ` Viresh Kumar
1 sibling, 0 replies; 7+ messages in thread
From: Viresh Kumar @ 2026-05-07 6:35 UTC (permalink / raw)
To: Sean Young; +Cc: linux-kernel, Rafael J. Wysocki, linux-pm
On 06-05-26, 15:42, Sean Young wrote:
> Since commit 8b793a92d862 ("x86/cpu: Remove M486/M486SX/ELAN support"),
> the AMD Elan SC4* is no longer supported, so the cpu frequency
> driver is no longer needed.
>
> Signed-off-by: Sean Young <sean@mess.org>
> ---
> drivers/cpufreq/Kconfig.x86 | 15 ---
> drivers/cpufreq/Makefile | 1 -
> drivers/cpufreq/elanfreq.c | 226 ------------------------------------
> 3 files changed, 242 deletions(-)
> delete mode 100644 drivers/cpufreq/elanfreq.c
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
--
viresh
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 8/8] cpufreq: elanfreq: Drop support for AMD Elan SC4*
2026-05-07 4:50 ` Zhongqiu Han
@ 2026-05-07 8:58 ` Sean Young
0 siblings, 0 replies; 7+ messages in thread
From: Sean Young @ 2026-05-07 8:58 UTC (permalink / raw)
To: Zhongqiu Han; +Cc: linux-kernel, Rafael J. Wysocki, Viresh Kumar, linux-pm
On Thu, May 07, 2026 at 12:50:55PM +0800, Zhongqiu Han wrote:
> On 5/6/2026 10:42 PM, Sean Young wrote:
> > Since commit 8b793a92d862 ("x86/cpu: Remove M486/M486SX/ELAN support"),
> > the AMD Elan SC4* is no longer supported, so the cpu frequency
> > driver is no longer needed.
> >
> > Signed-off-by: Sean Young <sean@mess.org>
> > ---
> > drivers/cpufreq/Kconfig.x86 | 15 ---
> > drivers/cpufreq/Makefile | 1 -
> > drivers/cpufreq/elanfreq.c | 226 ------------------------------------
> > 3 files changed, 242 deletions(-)
> > delete mode 100644 drivers/cpufreq/elanfreq.c
> >
>
> Thanks Sean,
>
> One minor nit: now that the elanfreq driver and its setup code are
> removed, should the corresponding elanfreq= entry in
> Documentation/admin-guide/kernel-parameters.txt be dropped as well?
>
> https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git/tree/Documentation/admin-guide/kernel-parameters.txt?h=linux-next#n1671
Yes, good catch. I'll send out a v2 shortly.
Thanks,
Sean
>
>
> > diff --git a/drivers/cpufreq/Kconfig.x86 b/drivers/cpufreq/Kconfig.x86
> > index 865b290b01ff..c42dd39e0b2a 100644
> > --- a/drivers/cpufreq/Kconfig.x86
> > +++ b/drivers/cpufreq/Kconfig.x86
> > @@ -126,21 +126,6 @@ config X86_ACPI_CPUFREQ_CPB
> > By enabling this option the acpi_cpufreq driver provides the old
> > entry in addition to the new boost ones, for compatibility reasons.
> > -config ELAN_CPUFREQ
> > - tristate "AMD Elan SC400 and SC410"
> > - depends on MELAN
> > - help
> > - This adds the CPUFreq driver for AMD Elan SC400 and SC410
> > - processors.
> > -
> > - You need to specify the processor maximum speed as boot
> > - parameter: elanfreq=maxspeed (in kHz) or as module
> > - parameter "max_freq".
> > -
> > - For details, take a look at <file:Documentation/cpu-freq/>.
> > -
> > - If in doubt, say N.
> > -
> > config X86_POWERNOW_K6
> > tristate "AMD Mobile K6-2/K6-3 PowerNow!"
> > depends on X86_32
> > diff --git a/drivers/cpufreq/Makefile b/drivers/cpufreq/Makefile
> > index 96196edf79d5..6c7a39b7f8d2 100644
> > --- a/drivers/cpufreq/Makefile
> > +++ b/drivers/cpufreq/Makefile
> > @@ -40,7 +40,6 @@ obj-$(CONFIG_X86_POWERNOW_K6) += powernow-k6.o
> > obj-$(CONFIG_X86_POWERNOW_K7) += powernow-k7.o
> > obj-$(CONFIG_X86_LONGHAUL) += longhaul.o
> > obj-$(CONFIG_X86_E_POWERSAVER) += e_powersaver.o
> > -obj-$(CONFIG_ELAN_CPUFREQ) += elanfreq.o
> > obj-$(CONFIG_X86_LONGRUN) += longrun.o
> > obj-$(CONFIG_X86_GX_SUSPMOD) += gx-suspmod.o
> > obj-$(CONFIG_X86_SPEEDSTEP_ICH) += speedstep-ich.o
> > diff --git a/drivers/cpufreq/elanfreq.c b/drivers/cpufreq/elanfreq.c
> > deleted file mode 100644
> > index fc5a58088b35..000000000000
> > --- a/drivers/cpufreq/elanfreq.c
> > +++ /dev/null
> > @@ -1,226 +0,0 @@
> > -// SPDX-License-Identifier: GPL-2.0-or-later
> > -/*
> > - * elanfreq: cpufreq driver for the AMD ELAN family
> > - *
> > - * (c) Copyright 2002 Robert Schwebel <r.schwebel@pengutronix.de>
> > - *
> > - * Parts of this code are (c) Sven Geggus <sven@geggus.net>
> > - *
> > - * All Rights Reserved.
> > - *
> > - * 2002-02-13: - initial revision for 2.4.18-pre9 by Robert Schwebel
> > - */
> > -
> > -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> > -
> > -#include <linux/kernel.h>
> > -#include <linux/module.h>
> > -#include <linux/init.h>
> > -
> > -#include <linux/delay.h>
> > -#include <linux/cpufreq.h>
> > -
> > -#include <asm/cpu_device_id.h>
> > -#include <linux/timex.h>
> > -#include <linux/io.h>
> > -
> > -#define REG_CSCIR 0x22 /* Chip Setup and Control Index Register */
> > -#define REG_CSCDR 0x23 /* Chip Setup and Control Data Register */
> > -
> > -/* Module parameter */
> > -static int max_freq;
> > -
> > -struct s_elan_multiplier {
> > - int clock; /* frequency in kHz */
> > - int val40h; /* PMU Force Mode register */
> > - int val80h; /* CPU Clock Speed Register */
> > -};
> > -
> > -/*
> > - * It is important that the frequencies
> > - * are listed in ascending order here!
> > - */
> > -static struct s_elan_multiplier elan_multiplier[] = {
> > - {1000, 0x02, 0x18},
> > - {2000, 0x02, 0x10},
> > - {4000, 0x02, 0x08},
> > - {8000, 0x00, 0x00},
> > - {16000, 0x00, 0x02},
> > - {33000, 0x00, 0x04},
> > - {66000, 0x01, 0x04},
> > - {99000, 0x01, 0x05}
> > -};
> > -
> > -static struct cpufreq_frequency_table elanfreq_table[] = {
> > - {0, 0, 1000},
> > - {0, 1, 2000},
> > - {0, 2, 4000},
> > - {0, 3, 8000},
> > - {0, 4, 16000},
> > - {0, 5, 33000},
> > - {0, 6, 66000},
> > - {0, 7, 99000},
> > - {0, 0, CPUFREQ_TABLE_END},
> > -};
> > -
> > -
> > -/**
> > - * elanfreq_get_cpu_frequency: determine current cpu speed
> > - *
> > - * Finds out at which frequency the CPU of the Elan SOC runs
> > - * at the moment. Frequencies from 1 to 33 MHz are generated
> > - * the normal way, 66 and 99 MHz are called "Hyperspeed Mode"
> > - * and have the rest of the chip running with 33 MHz.
> > - */
> > -
> > -static unsigned int elanfreq_get_cpu_frequency(unsigned int cpu)
> > -{
> > - u8 clockspeed_reg; /* Clock Speed Register */
> > -
> > - local_irq_disable();
> > - outb_p(0x80, REG_CSCIR);
> > - clockspeed_reg = inb_p(REG_CSCDR);
> > - local_irq_enable();
> > -
> > - if ((clockspeed_reg & 0xE0) == 0xE0)
> > - return 0;
> > -
> > - /* Are we in CPU clock multiplied mode (66/99 MHz)? */
> > - if ((clockspeed_reg & 0xE0) == 0xC0) {
> > - if ((clockspeed_reg & 0x01) == 0)
> > - return 66000;
> > - else
> > - return 99000;
> > - }
> > -
> > - /* 33 MHz is not 32 MHz... */
> > - if ((clockspeed_reg & 0xE0) == 0xA0)
> > - return 33000;
> > -
> > - return (1<<((clockspeed_reg & 0xE0) >> 5)) * 1000;
> > -}
> > -
> > -
> > -static int elanfreq_target(struct cpufreq_policy *policy,
> > - unsigned int state)
> > -{
> > - /*
> > - * Access to the Elan's internal registers is indexed via
> > - * 0x22: Chip Setup & Control Register Index Register (CSCI)
> > - * 0x23: Chip Setup & Control Register Data Register (CSCD)
> > - *
> > - */
> > -
> > - /*
> > - * 0x40 is the Power Management Unit's Force Mode Register.
> > - * Bit 6 enables Hyperspeed Mode (66/100 MHz core frequency)
> > - */
> > -
> > - local_irq_disable();
> > - outb_p(0x40, REG_CSCIR); /* Disable hyperspeed mode */
> > - outb_p(0x00, REG_CSCDR);
> > - local_irq_enable(); /* wait till internal pipelines and */
> > - udelay(1000); /* buffers have cleaned up */
> > -
> > - local_irq_disable();
> > -
> > - /* now, set the CPU clock speed register (0x80) */
> > - outb_p(0x80, REG_CSCIR);
> > - outb_p(elan_multiplier[state].val80h, REG_CSCDR);
> > -
> > - /* now, the hyperspeed bit in PMU Force Mode Register (0x40) */
> > - outb_p(0x40, REG_CSCIR);
> > - outb_p(elan_multiplier[state].val40h, REG_CSCDR);
> > - udelay(10000);
> > - local_irq_enable();
> > -
> > - return 0;
> > -}
> > -/*
> > - * Module init and exit code
> > - */
> > -
> > -static int elanfreq_cpu_init(struct cpufreq_policy *policy)
> > -{
> > - struct cpuinfo_x86 *c = &cpu_data(0);
> > - struct cpufreq_frequency_table *pos;
> > -
> > - /* capability check */
> > - if ((c->x86_vendor != X86_VENDOR_AMD) ||
> > - (c->x86 != 4) || (c->x86_model != 10))
> > - return -ENODEV;
> > -
> > - /* max freq */
> > - if (!max_freq)
> > - max_freq = elanfreq_get_cpu_frequency(0);
> > -
> > - /* table init */
> > - cpufreq_for_each_entry(pos, elanfreq_table)
> > - if (pos->frequency > max_freq)
> > - pos->frequency = CPUFREQ_ENTRY_INVALID;
> > -
> > - policy->freq_table = elanfreq_table;
> > - return 0;
> > -}
> > -
> > -
> > -#ifndef MODULE
> > -/**
> > - * elanfreq_setup - elanfreq command line parameter parsing
> > - *
> > - * elanfreq command line parameter. Use:
> > - * elanfreq=66000
> > - * to set the maximum CPU frequency to 66 MHz. Note that in
> > - * case you do not give this boot parameter, the maximum
> > - * frequency will fall back to _current_ CPU frequency which
> > - * might be lower. If you build this as a module, use the
> > - * max_freq module parameter instead.
> > - */
> > -static int __init elanfreq_setup(char *str)
> > -{
> > - max_freq = simple_strtoul(str, &str, 0);
> > - pr_warn("You're using the deprecated elanfreq command line option. Use elanfreq.max_freq instead, please!\n");
> > - return 1;
> > -}
> > -__setup("elanfreq=", elanfreq_setup);
> > -#endif
> > -
> > -
> > -static struct cpufreq_driver elanfreq_driver = {
> > - .get = elanfreq_get_cpu_frequency,
> > - .flags = CPUFREQ_NO_AUTO_DYNAMIC_SWITCHING,
> > - .verify = cpufreq_generic_frequency_table_verify,
> > - .target_index = elanfreq_target,
> > - .init = elanfreq_cpu_init,
> > - .name = "elanfreq",
> > -};
> > -
> > -static const struct x86_cpu_id elan_id[] = {
> > - X86_MATCH_VENDOR_FAM_MODEL(AMD, 4, 10, NULL),
> > - {}
> > -};
> > -MODULE_DEVICE_TABLE(x86cpu, elan_id);
> > -
> > -static int __init elanfreq_init(void)
> > -{
> > - if (!x86_match_cpu(elan_id))
> > - return -ENODEV;
> > - return cpufreq_register_driver(&elanfreq_driver);
> > -}
> > -
> > -
> > -static void __exit elanfreq_exit(void)
> > -{
> > - cpufreq_unregister_driver(&elanfreq_driver);
> > -}
> > -
> > -
> > -module_param(max_freq, int, 0444);
> > -
> > -MODULE_LICENSE("GPL");
> > -MODULE_AUTHOR("Robert Schwebel <r.schwebel@pengutronix.de>, "
> > - "Sven Geggus <sven@geggus.net>");
> > -MODULE_DESCRIPTION("cpufreq driver for AMD's Elan CPUs");
> > -
> > -module_init(elanfreq_init);
> > -module_exit(elanfreq_exit);
>
>
> --
> Thx and BRs,
> Zhongqiu Han
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-05-07 8:58 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <cover.1778071745.git.sean@mess.org>
2026-05-06 14:42 ` [PATCH 7/8] cpufreq: sc520_freq: Drop support for AMD Elan SC520 Sean Young
2026-05-07 4:44 ` Zhongqiu Han
2026-05-07 6:35 ` Viresh Kumar
2026-05-06 14:42 ` [PATCH 8/8] cpufreq: elanfreq: Drop support for AMD Elan SC4* Sean Young
2026-05-07 4:50 ` Zhongqiu Han
2026-05-07 8:58 ` Sean Young
2026-05-07 6:35 ` Viresh Kumar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox