diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-05-19 20:02:26 +0300 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-05-19 20:02:26 +0300 |
commit | 07b75260ebc2c789724c594d7eaf0194fa47b3be (patch) | |
tree | d88b770bca479789e688d95e50aacd5d09b59b21 /drivers/cpufreq | |
parent | 0efacbbaee1e94e9942da0912f5b46ffd45a74bd (diff) | |
parent | 6e4ad1b413604b9130bdbe532aafdbd47ff5318e (diff) | |
download | linux-07b75260ebc2c789724c594d7eaf0194fa47b3be.tar.xz |
Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus
Pull MIPS updates from Ralf Baechle:
"This is the main pull request for MIPS for 4.7. Here's the summary of
the changes:
- ATH79: Support for DTB passuing using the UHI boot protocol
- ATH79: Remove support for builtin DTB.
- ATH79: Add zboot debug serial support.
- ATH79: Add initial support for Dragino MS14 (Dragine 2), Onion Omega
and DPT-Module.
- ATH79: Update devicetree clock support for AR9132 and AR9331.
- ATH79: Cleanup the DT code.
- ATH79: Support newer SOCs in ath79_ddr_ctrl_init.
- ATH79: Fix regression in PCI window initialization.
- BCM47xx: Move SPROM driver to drivers/firmware/
- BCM63xx: Enable partition parser in defconfig.
- BMIPS: BMIPS5000 has I cache filing from D cache
- BMIPS: BMIPS: Add cpu-feature-overrides.h
- BMIPS: Add Whirlwind support
- BMIPS: Adjust mips-hpt-frequency for BCM7435
- BMIPS: Remove maxcpus from BCM97435SVMB DTS
- BMIPS: Add missing 7038 L1 register cells to BCM7435
- BMIPS: Various tweaks to initialization code.
- BMIPS: Enable partition parser in defconfig.
- BMIPS: Cache tweaks.
- BMIPS: Add UART, I2C and SATA devices to DT.
- BMIPS: Add BCM6358 and BCM63268support
- BMIPS: Add device tree example for BCM6358.
- BMIPS: Improve Improve BCM6328 and BCM6368 device trees
- Lantiq: Add support for device tree file from boot loader
- Lantiq: Allow build with no built-in DT.
- Loongson 3: Reserve 32MB for RS780E integrated GPU.
- Loongson 3: Fix build error after ld-version.sh modification
- Loongson 3: Move chipset ACPI code from drivers to arch.
- Loongson 3: Speedup irq processing.
- Loongson 3: Add basic Loongson 3A support.
- Loongson 3: Set cache flush handlers to nop.
- Loongson 3: Invalidate special TLBs when needed.
- Loongson 3: Fast TLB refill handler.
- MT7620: Fallback strategy for invalid syscfg0.
- Netlogic: Fix CP0_EBASE redefinition warnings
- Octeon: Initialization fixes
- Octeon: Add DTS files for the D-Link DSR-1000N and EdgeRouter Lite
- Octeon: Enable add Octeon-drivers in cavium_octeon_defconfig
- Octeon: Correctly handle endian-swapped initramfs images.
- Octeon: Support CN73xx, CN75xx and CN78xx.
- Octeon: Remove dead code from cvmx-sysinfo.
- Octeon: Extend number of supported CPUs past 32.
- Octeon: Remove some code limiting NR_IRQS to 255.
- Octeon: Simplify octeon_irq_ciu_gpio_set_type.
- Octeon: Mark some functions __init in smp.c
- Octeon: Octeon: Add Octeon III CN7xxx interface detection
- PIC32: Add serial driver and bindings for it.
- PIC32: Add PIC32 deadman timer driver and bindings.
- PIC32: Add PIC32 clock timer driver and bindings.
- Pistachio: Determine SoC revision during boot
- Sibyte: Fix Kconfig dependencies of SIBYTE_BUS_WATCHER.
- Sibyte: Strip redundant comments from bcm1480_regs.h.
- Panic immediately if panic_on_oops is set.
- module: fix incorrect IS_ERR_VALUE macro usage.
- module: Make consistent use of pr_*
- Remove no longer needed work_on_cpu() call.
- Remove CONFIG_IPV6_PRIVACY from defconfigs.
- Fix registers of non-crashing CPUs in dumps.
- Handle MIPSisms in new vmcore_elf32_check_arch.
- Select CONFIG_HANDLE_DOMAIN_IRQ and make it work.
- Allow RIXI to be used on non-R2 or R6 cores.
- Reserve nosave data for hibernation
- Fix siginfo.h to use strict POSIX types.
- Don't unwind user mode with EVA.
- Fix watchpoint restoration
- Ptrace watchpoints for R6.
- Sync icache when it fills from dcache
- I6400 I-cache fills from dcache.
- Various MSA fixes.
- Cleanup MIPS_CPU_* definitions.
- Signal: Move generic copy_siginfo to signal.h
- Signal: Fix uapi include in exported asm/siginfo.h
- Timer fixes for sake of KVM.
- XPA TLB refill fixes.
- Treat perf counter feature
- Update John Crispin's email address
- Add PIC32 watchdog and bindings.
- Handle R10000 LL/SC bug in set_pte()
- cpufreq: Various fixes for Longson1.
- R6: Fix R2 emulation.
- mathemu: Cosmetic fix to ADDIUPC emulation, plenty of other small fixes
- ELF: ABI and FP fixes.
- Allow for relocatable kernel and use that to support KASLR.
- Fix CPC_BASE_ADDR mask
- Plenty fo smp-cps, CM, R6 and M6250 fixes.
- Make reset_control_ops const.
- Fix kernel command line handling of leading whitespace.
- Cleanups to cache handling.
- Add brcm, bcm6345-l1-intc device tree bindings.
- Use generic clkdev.h header
- Remove CLK_IS_ROOT usage.
- Misc small cleanups.
- CM: Fix compilation error when !MIPS_CM
- oprofile: Fix a preemption issue
- Detect DSP ASE v3 support:1"
* 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus: (275 commits)
MIPS: pic32mzda: fix getting timer clock rate.
MIPS: ath79: fix regression in PCI window initialization
MIPS: ath79: make ath79_ddr_ctrl_init() compatible for newer SoCs
MIPS: Fix VZ probe gas errors with binutils <2.24
MIPS: perf: Fix I6400 event numbers
MIPS: DEC: Export `ioasic_ssr_lock' to modules
MIPS: MSA: Fix a link error on `_init_msa_upper' with older GCC
MIPS: CM: Fix compilation error when !MIPS_CM
MIPS: Fix genvdso error on rebuild
USB: ohci-jz4740: Remove obsolete driver
MIPS: JZ4740: Probe OHCI platform device via DT
MIPS: JZ4740: Qi LB60: Remove support for AVT2 variant
MIPS: pistachio: Determine SoC revision during boot
MIPS: BMIPS: Adjust mips-hpt-frequency for BCM7435
mips: mt7620: fallback to SDRAM when syscfg0 does not have a valid value for the memory type
MIPS: Prevent "restoration" of MSA context in non-MSA kernels
MIPS: cevt-r4k: Dynamically calculate min_delta_ns
MIPS: malta-time: Take seconds into account
MIPS: malta-time: Start GIC count before syncing to RTC
MIPS: Force CPUs to lose FP context during mode switches
...
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r-- | drivers/cpufreq/Makefile | 2 | ||||
-rw-r--r-- | drivers/cpufreq/loongson1-cpufreq.c (renamed from drivers/cpufreq/ls1x-cpufreq.c) | 114 |
2 files changed, 58 insertions, 58 deletions
diff --git a/drivers/cpufreq/Makefile b/drivers/cpufreq/Makefile index e1eb11ee3570..0a9b6a093646 100644 --- a/drivers/cpufreq/Makefile +++ b/drivers/cpufreq/Makefile @@ -102,7 +102,7 @@ obj-$(CONFIG_CRIS_MACH_ARTPEC3) += cris-artpec3-cpufreq.o obj-$(CONFIG_ETRAXFS) += cris-etraxfs-cpufreq.o obj-$(CONFIG_IA64_ACPI_CPUFREQ) += ia64-acpi-cpufreq.o obj-$(CONFIG_LOONGSON2_CPUFREQ) += loongson2_cpufreq.o -obj-$(CONFIG_LOONGSON1_CPUFREQ) += ls1x-cpufreq.o +obj-$(CONFIG_LOONGSON1_CPUFREQ) += loongson1-cpufreq.o obj-$(CONFIG_SH_CPU_FREQ) += sh-cpufreq.o obj-$(CONFIG_SPARC_US2E_CPUFREQ) += sparc-us2e-cpufreq.o obj-$(CONFIG_SPARC_US3_CPUFREQ) += sparc-us3-cpufreq.o diff --git a/drivers/cpufreq/ls1x-cpufreq.c b/drivers/cpufreq/loongson1-cpufreq.c index 262581b3318d..be89416e2358 100644 --- a/drivers/cpufreq/ls1x-cpufreq.c +++ b/drivers/cpufreq/loongson1-cpufreq.c @@ -1,7 +1,7 @@ /* * CPU Frequency Scaling for Loongson 1 SoC * - * Copyright (C) 2014 Zhang, Keguang <keguang.zhang@gmail.com> + * Copyright (C) 2014-2016 Zhang, Keguang <keguang.zhang@gmail.com> * * This file is licensed under the terms of the GNU General Public * License version 2. This program is licensed "as is" without any @@ -20,7 +20,7 @@ #include <cpufreq.h> #include <loongson1.h> -static struct { +struct ls1x_cpufreq { struct device *dev; struct clk *clk; /* CPU clk */ struct clk *mux_clk; /* MUX of CPU clk */ @@ -28,7 +28,9 @@ static struct { struct clk *osc_clk; /* OSC clk */ unsigned int max_freq; unsigned int min_freq; -} ls1x_cpufreq; +}; + +static struct ls1x_cpufreq *cpufreq; static int ls1x_cpufreq_notifier(struct notifier_block *nb, unsigned long val, void *data) @@ -46,6 +48,7 @@ static struct notifier_block ls1x_cpufreq_notifier_block = { static int ls1x_cpufreq_target(struct cpufreq_policy *policy, unsigned int index) { + struct device *cpu_dev = get_cpu_device(policy->cpu); unsigned int old_freq, new_freq; old_freq = policy->cur; @@ -60,53 +63,49 @@ static int ls1x_cpufreq_target(struct cpufreq_policy *policy, * - Reparent CPU clk back to CPU DIV clk */ - dev_dbg(ls1x_cpufreq.dev, "%u KHz --> %u KHz\n", old_freq, new_freq); - clk_set_parent(policy->clk, ls1x_cpufreq.osc_clk); + clk_set_parent(policy->clk, cpufreq->osc_clk); __raw_writel(__raw_readl(LS1X_CLK_PLL_DIV) | RST_CPU_EN | RST_CPU, LS1X_CLK_PLL_DIV); __raw_writel(__raw_readl(LS1X_CLK_PLL_DIV) & ~(RST_CPU_EN | RST_CPU), LS1X_CLK_PLL_DIV); - clk_set_rate(ls1x_cpufreq.mux_clk, new_freq * 1000); - clk_set_parent(policy->clk, ls1x_cpufreq.mux_clk); + clk_set_rate(cpufreq->mux_clk, new_freq * 1000); + clk_set_parent(policy->clk, cpufreq->mux_clk); + dev_dbg(cpu_dev, "%u KHz --> %u KHz\n", old_freq, new_freq); return 0; } static int ls1x_cpufreq_init(struct cpufreq_policy *policy) { + struct device *cpu_dev = get_cpu_device(policy->cpu); struct cpufreq_frequency_table *freq_tbl; unsigned int pll_freq, freq; int steps, i, ret; - pll_freq = clk_get_rate(ls1x_cpufreq.pll_clk) / 1000; + pll_freq = clk_get_rate(cpufreq->pll_clk) / 1000; steps = 1 << DIV_CPU_WIDTH; - freq_tbl = kzalloc(sizeof(*freq_tbl) * steps, GFP_KERNEL); - if (!freq_tbl) { - dev_err(ls1x_cpufreq.dev, - "failed to alloc cpufreq_frequency_table\n"); - ret = -ENOMEM; - goto out; - } + freq_tbl = kcalloc(steps, sizeof(*freq_tbl), GFP_KERNEL); + if (!freq_tbl) + return -ENOMEM; for (i = 0; i < (steps - 1); i++) { freq = pll_freq / (i + 1); - if ((freq < ls1x_cpufreq.min_freq) || - (freq > ls1x_cpufreq.max_freq)) + if ((freq < cpufreq->min_freq) || (freq > cpufreq->max_freq)) freq_tbl[i].frequency = CPUFREQ_ENTRY_INVALID; else freq_tbl[i].frequency = freq; - dev_dbg(ls1x_cpufreq.dev, + dev_dbg(cpu_dev, "cpufreq table: index %d: frequency %d\n", i, freq_tbl[i].frequency); } freq_tbl[i].frequency = CPUFREQ_TABLE_END; - policy->clk = ls1x_cpufreq.clk; + policy->clk = cpufreq->clk; ret = cpufreq_generic_init(policy, freq_tbl, 0); if (ret) kfree(freq_tbl); -out: + return ret; } @@ -138,85 +137,86 @@ static int ls1x_cpufreq_remove(struct platform_device *pdev) static int ls1x_cpufreq_probe(struct platform_device *pdev) { - struct plat_ls1x_cpufreq *pdata = pdev->dev.platform_data; + struct plat_ls1x_cpufreq *pdata = dev_get_platdata(&pdev->dev); struct clk *clk; int ret; - if (!pdata || !pdata->clk_name || !pdata->osc_clk_name) + if (!pdata || !pdata->clk_name || !pdata->osc_clk_name) { + dev_err(&pdev->dev, "platform data missing\n"); return -EINVAL; + } - ls1x_cpufreq.dev = &pdev->dev; + cpufreq = + devm_kzalloc(&pdev->dev, sizeof(struct ls1x_cpufreq), GFP_KERNEL); + if (!cpufreq) + return -ENOMEM; + + cpufreq->dev = &pdev->dev; clk = devm_clk_get(&pdev->dev, pdata->clk_name); if (IS_ERR(clk)) { - dev_err(ls1x_cpufreq.dev, "unable to get %s clock\n", + dev_err(&pdev->dev, "unable to get %s clock\n", pdata->clk_name); - ret = PTR_ERR(clk); - goto out; + return PTR_ERR(clk); } - ls1x_cpufreq.clk = clk; + cpufreq->clk = clk; clk = clk_get_parent(clk); if (IS_ERR(clk)) { - dev_err(ls1x_cpufreq.dev, "unable to get parent of %s clock\n", - __clk_get_name(ls1x_cpufreq.clk)); - ret = PTR_ERR(clk); - goto out; + dev_err(&pdev->dev, "unable to get parent of %s clock\n", + __clk_get_name(cpufreq->clk)); + return PTR_ERR(clk); } - ls1x_cpufreq.mux_clk = clk; + cpufreq->mux_clk = clk; clk = clk_get_parent(clk); if (IS_ERR(clk)) { - dev_err(ls1x_cpufreq.dev, "unable to get parent of %s clock\n", - __clk_get_name(ls1x_cpufreq.mux_clk)); - ret = PTR_ERR(clk); - goto out; + dev_err(&pdev->dev, "unable to get parent of %s clock\n", + __clk_get_name(cpufreq->mux_clk)); + return PTR_ERR(clk); } - ls1x_cpufreq.pll_clk = clk; + cpufreq->pll_clk = clk; clk = devm_clk_get(&pdev->dev, pdata->osc_clk_name); if (IS_ERR(clk)) { - dev_err(ls1x_cpufreq.dev, "unable to get %s clock\n", + dev_err(&pdev->dev, "unable to get %s clock\n", pdata->osc_clk_name); - ret = PTR_ERR(clk); - goto out; + return PTR_ERR(clk); } - ls1x_cpufreq.osc_clk = clk; + cpufreq->osc_clk = clk; - ls1x_cpufreq.max_freq = pdata->max_freq; - ls1x_cpufreq.min_freq = pdata->min_freq; + cpufreq->max_freq = pdata->max_freq; + cpufreq->min_freq = pdata->min_freq; ret = cpufreq_register_driver(&ls1x_cpufreq_driver); if (ret) { - dev_err(ls1x_cpufreq.dev, - "failed to register cpufreq driver: %d\n", ret); - goto out; + dev_err(&pdev->dev, + "failed to register CPUFreq driver: %d\n", ret); + return ret; } ret = cpufreq_register_notifier(&ls1x_cpufreq_notifier_block, CPUFREQ_TRANSITION_NOTIFIER); - if (!ret) - goto out; - - dev_err(ls1x_cpufreq.dev, "failed to register cpufreq notifier: %d\n", - ret); + if (ret) { + dev_err(&pdev->dev, + "failed to register CPUFreq notifier: %d\n",ret); + cpufreq_unregister_driver(&ls1x_cpufreq_driver); + } - cpufreq_unregister_driver(&ls1x_cpufreq_driver); -out: return ret; } static struct platform_driver ls1x_cpufreq_platdrv = { - .driver = { + .probe = ls1x_cpufreq_probe, + .remove = ls1x_cpufreq_remove, + .driver = { .name = "ls1x-cpufreq", }, - .probe = ls1x_cpufreq_probe, - .remove = ls1x_cpufreq_remove, }; module_platform_driver(ls1x_cpufreq_platdrv); MODULE_AUTHOR("Kelvin Cheung <keguang.zhang@gmail.com>"); -MODULE_DESCRIPTION("Loongson 1 CPUFreq driver"); +MODULE_DESCRIPTION("Loongson1 CPUFreq driver"); MODULE_LICENSE("GPL"); |