Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

cpufreq: ppc_cbe: Remove powerpc Cell driver

This driver can no longer be built since support for IBM Cell Blades was
removed, in particular CBE_RAS.

Remove the driver.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/20241218105523.416573-22-mpe@ellerman.id.au

authored by

Michael Ellerman and committed by
Madhavan Srinivasan
16479389 333e8eb3

-479
-18
drivers/cpufreq/Kconfig.powerpc
··· 1 1 # SPDX-License-Identifier: GPL-2.0-only 2 - config CPU_FREQ_CBE 3 - tristate "CBE frequency scaling" 4 - depends on CBE_RAS && PPC_CELL 5 - default m 6 - help 7 - This adds the cpufreq driver for Cell BE processors. 8 - For details, take a look at <file:Documentation/cpu-freq/>. 9 - If you don't have such processor, say N 10 - 11 - config CPU_FREQ_CBE_PMI 12 - bool "CBE frequency scaling using PMI interface" 13 - depends on CPU_FREQ_CBE 14 - default n 15 - help 16 - Select this, if you want to use the PMI interface to switch 17 - frequencies. Using PMI, the processor will not only be able to run at 18 - lower speed, but also at lower core voltage. 19 - 20 2 config CPU_FREQ_PMAC 21 3 bool "Support for Apple PowerBooks" 22 4 depends on ADB_PMU && PPC32
-3
drivers/cpufreq/Makefile
··· 91 91 92 92 ################################################################################## 93 93 # PowerPC platform drivers 94 - obj-$(CONFIG_CPU_FREQ_CBE) += ppc-cbe-cpufreq.o 95 - ppc-cbe-cpufreq-y += ppc_cbe_cpufreq_pervasive.o ppc_cbe_cpufreq.o 96 - obj-$(CONFIG_CPU_FREQ_CBE_PMI) += ppc_cbe_cpufreq_pmi.o 97 94 obj-$(CONFIG_QORIQ_CPUFREQ) += qoriq-cpufreq.o 98 95 obj-$(CONFIG_CPU_FREQ_PMAC) += pmac32-cpufreq.o 99 96 obj-$(CONFIG_CPU_FREQ_PMAC64) += pmac64-cpufreq.o
-173
drivers/cpufreq/ppc_cbe_cpufreq.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-or-later 2 - /* 3 - * cpufreq driver for the cell processor 4 - * 5 - * (C) Copyright IBM Deutschland Entwicklung GmbH 2005-2007 6 - * 7 - * Author: Christian Krafft <krafft@de.ibm.com> 8 - */ 9 - 10 - #include <linux/cpufreq.h> 11 - #include <linux/module.h> 12 - #include <linux/of.h> 13 - 14 - #include <asm/machdep.h> 15 - #include <asm/cell-regs.h> 16 - 17 - #include "ppc_cbe_cpufreq.h" 18 - 19 - /* the CBE supports an 8 step frequency scaling */ 20 - static struct cpufreq_frequency_table cbe_freqs[] = { 21 - {0, 1, 0}, 22 - {0, 2, 0}, 23 - {0, 3, 0}, 24 - {0, 4, 0}, 25 - {0, 5, 0}, 26 - {0, 6, 0}, 27 - {0, 8, 0}, 28 - {0, 10, 0}, 29 - {0, 0, CPUFREQ_TABLE_END}, 30 - }; 31 - 32 - /* 33 - * hardware specific functions 34 - */ 35 - 36 - static int set_pmode(unsigned int cpu, unsigned int slow_mode) 37 - { 38 - int rc; 39 - 40 - if (cbe_cpufreq_has_pmi) 41 - rc = cbe_cpufreq_set_pmode_pmi(cpu, slow_mode); 42 - else 43 - rc = cbe_cpufreq_set_pmode(cpu, slow_mode); 44 - 45 - pr_debug("register contains slow mode %d\n", cbe_cpufreq_get_pmode(cpu)); 46 - 47 - return rc; 48 - } 49 - 50 - /* 51 - * cpufreq functions 52 - */ 53 - 54 - static int cbe_cpufreq_cpu_init(struct cpufreq_policy *policy) 55 - { 56 - struct cpufreq_frequency_table *pos; 57 - const u32 *max_freqp; 58 - u32 max_freq; 59 - int cur_pmode; 60 - struct device_node *cpu; 61 - 62 - cpu = of_get_cpu_node(policy->cpu, NULL); 63 - 64 - if (!cpu) 65 - return -ENODEV; 66 - 67 - pr_debug("init cpufreq on CPU %d\n", policy->cpu); 68 - 69 - /* 70 - * Let's check we can actually get to the CELL regs 71 - */ 72 - if (!cbe_get_cpu_pmd_regs(policy->cpu) || 73 - !cbe_get_cpu_mic_tm_regs(policy->cpu)) { 74 - pr_info("invalid CBE regs pointers for cpufreq\n"); 75 - of_node_put(cpu); 76 - return -EINVAL; 77 - } 78 - 79 - max_freqp = of_get_property(cpu, "clock-frequency", NULL); 80 - 81 - of_node_put(cpu); 82 - 83 - if (!max_freqp) 84 - return -EINVAL; 85 - 86 - /* we need the freq in kHz */ 87 - max_freq = *max_freqp / 1000; 88 - 89 - pr_debug("max clock-frequency is at %u kHz\n", max_freq); 90 - pr_debug("initializing frequency table\n"); 91 - 92 - /* initialize frequency table */ 93 - cpufreq_for_each_entry(pos, cbe_freqs) { 94 - pos->frequency = max_freq / pos->driver_data; 95 - pr_debug("%d: %d\n", (int)(pos - cbe_freqs), pos->frequency); 96 - } 97 - 98 - /* if DEBUG is enabled set_pmode() measures the latency 99 - * of a transition */ 100 - policy->cpuinfo.transition_latency = 25000; 101 - 102 - cur_pmode = cbe_cpufreq_get_pmode(policy->cpu); 103 - pr_debug("current pmode is at %d\n",cur_pmode); 104 - 105 - policy->cur = cbe_freqs[cur_pmode].frequency; 106 - 107 - #ifdef CONFIG_SMP 108 - cpumask_copy(policy->cpus, cpu_sibling_mask(policy->cpu)); 109 - #endif 110 - 111 - policy->freq_table = cbe_freqs; 112 - cbe_cpufreq_pmi_policy_init(policy); 113 - return 0; 114 - } 115 - 116 - static void cbe_cpufreq_cpu_exit(struct cpufreq_policy *policy) 117 - { 118 - cbe_cpufreq_pmi_policy_exit(policy); 119 - } 120 - 121 - static int cbe_cpufreq_target(struct cpufreq_policy *policy, 122 - unsigned int cbe_pmode_new) 123 - { 124 - pr_debug("setting frequency for cpu %d to %d kHz, " \ 125 - "1/%d of max frequency\n", 126 - policy->cpu, 127 - cbe_freqs[cbe_pmode_new].frequency, 128 - cbe_freqs[cbe_pmode_new].driver_data); 129 - 130 - return set_pmode(policy->cpu, cbe_pmode_new); 131 - } 132 - 133 - static struct cpufreq_driver cbe_cpufreq_driver = { 134 - .verify = cpufreq_generic_frequency_table_verify, 135 - .target_index = cbe_cpufreq_target, 136 - .init = cbe_cpufreq_cpu_init, 137 - .exit = cbe_cpufreq_cpu_exit, 138 - .name = "cbe-cpufreq", 139 - .flags = CPUFREQ_CONST_LOOPS, 140 - }; 141 - 142 - /* 143 - * module init and destoy 144 - */ 145 - 146 - static int __init cbe_cpufreq_init(void) 147 - { 148 - int ret; 149 - 150 - if (!machine_is(cell)) 151 - return -ENODEV; 152 - 153 - cbe_cpufreq_pmi_init(); 154 - 155 - ret = cpufreq_register_driver(&cbe_cpufreq_driver); 156 - if (ret) 157 - cbe_cpufreq_pmi_exit(); 158 - 159 - return ret; 160 - } 161 - 162 - static void __exit cbe_cpufreq_exit(void) 163 - { 164 - cpufreq_unregister_driver(&cbe_cpufreq_driver); 165 - cbe_cpufreq_pmi_exit(); 166 - } 167 - 168 - module_init(cbe_cpufreq_init); 169 - module_exit(cbe_cpufreq_exit); 170 - 171 - MODULE_DESCRIPTION("cpufreq driver for Cell BE processors"); 172 - MODULE_LICENSE("GPL"); 173 - MODULE_AUTHOR("Christian Krafft <krafft@de.ibm.com>");
-33
drivers/cpufreq/ppc_cbe_cpufreq.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - /* 3 - * ppc_cbe_cpufreq.h 4 - * 5 - * This file contains the definitions used by the cbe_cpufreq driver. 6 - * 7 - * (C) Copyright IBM Deutschland Entwicklung GmbH 2005-2007 8 - * 9 - * Author: Christian Krafft <krafft@de.ibm.com> 10 - * 11 - */ 12 - 13 - #include <linux/cpufreq.h> 14 - #include <linux/types.h> 15 - 16 - int cbe_cpufreq_set_pmode(int cpu, unsigned int pmode); 17 - int cbe_cpufreq_get_pmode(int cpu); 18 - 19 - int cbe_cpufreq_set_pmode_pmi(int cpu, unsigned int pmode); 20 - 21 - #if IS_ENABLED(CONFIG_CPU_FREQ_CBE_PMI) 22 - extern bool cbe_cpufreq_has_pmi; 23 - void cbe_cpufreq_pmi_policy_init(struct cpufreq_policy *policy); 24 - void cbe_cpufreq_pmi_policy_exit(struct cpufreq_policy *policy); 25 - void cbe_cpufreq_pmi_init(void); 26 - void cbe_cpufreq_pmi_exit(void); 27 - #else 28 - #define cbe_cpufreq_has_pmi (0) 29 - static inline void cbe_cpufreq_pmi_policy_init(struct cpufreq_policy *policy) {} 30 - static inline void cbe_cpufreq_pmi_policy_exit(struct cpufreq_policy *policy) {} 31 - static inline void cbe_cpufreq_pmi_init(void) {} 32 - static inline void cbe_cpufreq_pmi_exit(void) {} 33 - #endif
-102
drivers/cpufreq/ppc_cbe_cpufreq_pervasive.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-or-later 2 - /* 3 - * pervasive backend for the cbe_cpufreq driver 4 - * 5 - * This driver makes use of the pervasive unit to 6 - * engage the desired frequency. 7 - * 8 - * (C) Copyright IBM Deutschland Entwicklung GmbH 2005-2007 9 - * 10 - * Author: Christian Krafft <krafft@de.ibm.com> 11 - */ 12 - 13 - #include <linux/io.h> 14 - #include <linux/kernel.h> 15 - #include <linux/time.h> 16 - #include <asm/machdep.h> 17 - #include <asm/hw_irq.h> 18 - #include <asm/cell-regs.h> 19 - 20 - #include "ppc_cbe_cpufreq.h" 21 - 22 - /* to write to MIC register */ 23 - static u64 MIC_Slow_Fast_Timer_table[] = { 24 - [0 ... 7] = 0x007fc00000000000ull, 25 - }; 26 - 27 - /* more values for the MIC */ 28 - static u64 MIC_Slow_Next_Timer_table[] = { 29 - 0x0000240000000000ull, 30 - 0x0000268000000000ull, 31 - 0x000029C000000000ull, 32 - 0x00002D0000000000ull, 33 - 0x0000300000000000ull, 34 - 0x0000334000000000ull, 35 - 0x000039C000000000ull, 36 - 0x00003FC000000000ull, 37 - }; 38 - 39 - 40 - int cbe_cpufreq_set_pmode(int cpu, unsigned int pmode) 41 - { 42 - struct cbe_pmd_regs __iomem *pmd_regs; 43 - struct cbe_mic_tm_regs __iomem *mic_tm_regs; 44 - unsigned long flags; 45 - u64 value; 46 - #ifdef DEBUG 47 - long time; 48 - #endif 49 - 50 - local_irq_save(flags); 51 - 52 - mic_tm_regs = cbe_get_cpu_mic_tm_regs(cpu); 53 - pmd_regs = cbe_get_cpu_pmd_regs(cpu); 54 - 55 - #ifdef DEBUG 56 - time = jiffies; 57 - #endif 58 - 59 - out_be64(&mic_tm_regs->slow_fast_timer_0, MIC_Slow_Fast_Timer_table[pmode]); 60 - out_be64(&mic_tm_regs->slow_fast_timer_1, MIC_Slow_Fast_Timer_table[pmode]); 61 - 62 - out_be64(&mic_tm_regs->slow_next_timer_0, MIC_Slow_Next_Timer_table[pmode]); 63 - out_be64(&mic_tm_regs->slow_next_timer_1, MIC_Slow_Next_Timer_table[pmode]); 64 - 65 - value = in_be64(&pmd_regs->pmcr); 66 - /* set bits to zero */ 67 - value &= 0xFFFFFFFFFFFFFFF8ull; 68 - /* set bits to next pmode */ 69 - value |= pmode; 70 - 71 - out_be64(&pmd_regs->pmcr, value); 72 - 73 - #ifdef DEBUG 74 - /* wait until new pmode appears in status register */ 75 - value = in_be64(&pmd_regs->pmsr) & 0x07; 76 - while (value != pmode) { 77 - cpu_relax(); 78 - value = in_be64(&pmd_regs->pmsr) & 0x07; 79 - } 80 - 81 - time = jiffies - time; 82 - time = jiffies_to_msecs(time); 83 - pr_debug("had to wait %lu ms for a transition using " \ 84 - "pervasive unit\n", time); 85 - #endif 86 - local_irq_restore(flags); 87 - 88 - return 0; 89 - } 90 - 91 - 92 - int cbe_cpufreq_get_pmode(int cpu) 93 - { 94 - int ret; 95 - struct cbe_pmd_regs __iomem *pmd_regs; 96 - 97 - pmd_regs = cbe_get_cpu_pmd_regs(cpu); 98 - ret = in_be64(&pmd_regs->pmsr) & 0x07; 99 - 100 - return ret; 101 - } 102 -
-150
drivers/cpufreq/ppc_cbe_cpufreq_pmi.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-or-later 2 - /* 3 - * pmi backend for the cbe_cpufreq driver 4 - * 5 - * (C) Copyright IBM Deutschland Entwicklung GmbH 2005-2007 6 - * 7 - * Author: Christian Krafft <krafft@de.ibm.com> 8 - */ 9 - 10 - #include <linux/kernel.h> 11 - #include <linux/types.h> 12 - #include <linux/timer.h> 13 - #include <linux/init.h> 14 - #include <linux/pm_qos.h> 15 - #include <linux/slab.h> 16 - 17 - #include <asm/processor.h> 18 - #include <asm/pmi.h> 19 - #include <asm/cell-regs.h> 20 - 21 - #ifdef DEBUG 22 - #include <asm/time.h> 23 - #endif 24 - 25 - #include "ppc_cbe_cpufreq.h" 26 - 27 - bool cbe_cpufreq_has_pmi = false; 28 - EXPORT_SYMBOL_GPL(cbe_cpufreq_has_pmi); 29 - 30 - /* 31 - * hardware specific functions 32 - */ 33 - 34 - int cbe_cpufreq_set_pmode_pmi(int cpu, unsigned int pmode) 35 - { 36 - int ret; 37 - pmi_message_t pmi_msg; 38 - #ifdef DEBUG 39 - long time; 40 - #endif 41 - pmi_msg.type = PMI_TYPE_FREQ_CHANGE; 42 - pmi_msg.data1 = cbe_cpu_to_node(cpu); 43 - pmi_msg.data2 = pmode; 44 - 45 - #ifdef DEBUG 46 - time = jiffies; 47 - #endif 48 - pmi_send_message(pmi_msg); 49 - 50 - #ifdef DEBUG 51 - time = jiffies - time; 52 - time = jiffies_to_msecs(time); 53 - pr_debug("had to wait %lu ms for a transition using " \ 54 - "PMI\n", time); 55 - #endif 56 - ret = pmi_msg.data2; 57 - pr_debug("PMI returned slow mode %d\n", ret); 58 - 59 - return ret; 60 - } 61 - EXPORT_SYMBOL_GPL(cbe_cpufreq_set_pmode_pmi); 62 - 63 - 64 - static void cbe_cpufreq_handle_pmi(pmi_message_t pmi_msg) 65 - { 66 - struct cpufreq_policy *policy; 67 - struct freq_qos_request *req; 68 - u8 node, slow_mode; 69 - int cpu, ret; 70 - 71 - BUG_ON(pmi_msg.type != PMI_TYPE_FREQ_CHANGE); 72 - 73 - node = pmi_msg.data1; 74 - slow_mode = pmi_msg.data2; 75 - 76 - cpu = cbe_node_to_cpu(node); 77 - 78 - pr_debug("cbe_handle_pmi: node: %d max_freq: %d\n", node, slow_mode); 79 - 80 - policy = cpufreq_cpu_get(cpu); 81 - if (!policy) { 82 - pr_warn("cpufreq policy not found cpu%d\n", cpu); 83 - return; 84 - } 85 - 86 - req = policy->driver_data; 87 - 88 - ret = freq_qos_update_request(req, 89 - policy->freq_table[slow_mode].frequency); 90 - if (ret < 0) 91 - pr_warn("Failed to update freq constraint: %d\n", ret); 92 - else 93 - pr_debug("limiting node %d to slow mode %d\n", node, slow_mode); 94 - 95 - cpufreq_cpu_put(policy); 96 - } 97 - 98 - static struct pmi_handler cbe_pmi_handler = { 99 - .type = PMI_TYPE_FREQ_CHANGE, 100 - .handle_pmi_message = cbe_cpufreq_handle_pmi, 101 - }; 102 - 103 - void cbe_cpufreq_pmi_policy_init(struct cpufreq_policy *policy) 104 - { 105 - struct freq_qos_request *req; 106 - int ret; 107 - 108 - if (!cbe_cpufreq_has_pmi) 109 - return; 110 - 111 - req = kzalloc(sizeof(*req), GFP_KERNEL); 112 - if (!req) 113 - return; 114 - 115 - ret = freq_qos_add_request(&policy->constraints, req, FREQ_QOS_MAX, 116 - policy->freq_table[0].frequency); 117 - if (ret < 0) { 118 - pr_err("Failed to add freq constraint (%d)\n", ret); 119 - kfree(req); 120 - return; 121 - } 122 - 123 - policy->driver_data = req; 124 - } 125 - EXPORT_SYMBOL_GPL(cbe_cpufreq_pmi_policy_init); 126 - 127 - void cbe_cpufreq_pmi_policy_exit(struct cpufreq_policy *policy) 128 - { 129 - struct freq_qos_request *req = policy->driver_data; 130 - 131 - if (cbe_cpufreq_has_pmi) { 132 - freq_qos_remove_request(req); 133 - kfree(req); 134 - } 135 - } 136 - EXPORT_SYMBOL_GPL(cbe_cpufreq_pmi_policy_exit); 137 - 138 - void cbe_cpufreq_pmi_init(void) 139 - { 140 - if (!pmi_register_handler(&cbe_pmi_handler)) 141 - cbe_cpufreq_has_pmi = true; 142 - } 143 - EXPORT_SYMBOL_GPL(cbe_cpufreq_pmi_init); 144 - 145 - void cbe_cpufreq_pmi_exit(void) 146 - { 147 - pmi_unregister_handler(&cbe_pmi_handler); 148 - cbe_cpufreq_has_pmi = false; 149 - } 150 - EXPORT_SYMBOL_GPL(cbe_cpufreq_pmi_exit);