aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/clk
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-02-20 14:26:56 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-02-20 14:26:56 -0500
commit8793422fd9ac5037f5047f80473007301df3689f (patch)
treef5aa3b3a564f053e1b5604c45db80193abc734a4 /drivers/clk
parentb3cdda2b4f541439ca4205793040aa2e1c852e3b (diff)
parent10baf04e95fbf7eb6089410220a547211dd2ffa7 (diff)
Merge tag 'pm+acpi-3.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull ACPI and power management updates from Rafael Wysocki: - Rework of the ACPI namespace scanning code from Rafael J. Wysocki with contributions from Bjorn Helgaas, Jiang Liu, Mika Westerberg, Toshi Kani, and Yinghai Lu. - ACPI power resources handling and ACPI device PM update from Rafael J Wysocki. - ACPICA update to version 20130117 from Bob Moore and Lv Zheng with contributions from Aaron Lu, Chao Guan, Jesper Juhl, and Tim Gardner. - Support for Intel Lynxpoint LPSS from Mika Westerberg. - cpuidle update from Len Brown including Intel Haswell support, C1 state for intel_idle, removal of global pm_idle. - cpuidle fixes and cleanups from Daniel Lezcano. - cpufreq fixes and cleanups from Viresh Kumar and Fabio Baltieri with contributions from Stratos Karafotis and Rickard Andersson. - Intel P-states driver for Sandy Bridge processors from Dirk Brandewie. - cpufreq driver for Marvell Kirkwood SoCs from Andrew Lunn. - cpufreq fixes related to ordering issues between acpi-cpufreq and powernow-k8 from Borislav Petkov and Matthew Garrett. - cpufreq support for Calxeda Highbank processors from Mark Langsdorf and Rob Herring. - cpufreq driver for the Freescale i.MX6Q SoC and cpufreq-cpu0 update from Shawn Guo. - cpufreq Exynos fixes and cleanups from Jonghwan Choi, Sachin Kamat, and Inderpal Singh. - Support for "lightweight suspend" from Zhang Rui. - Removal of the deprecated power trace API from Paul Gortmaker. - Assorted updates from Andreas Fleig, Colin Ian King, Davidlohr Bueso, Joseph Salisbury, Kees Cook, Li Fei, Nishanth Menon, ShuoX Liu, Srinivas Pandruvada, Tejun Heo, Thomas Renninger, and Yasuaki Ishimatsu. * tag 'pm+acpi-3.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (267 commits) PM idle: remove global declaration of pm_idle unicore32 idle: delete stray pm_idle comment openrisc idle: delete pm_idle mn10300 idle: delete pm_idle microblaze idle: delete pm_idle m32r idle: delete pm_idle, and other dead idle code ia64 idle: delete pm_idle cris idle: delete idle and pm_idle ARM64 idle: delete pm_idle ARM idle: delete pm_idle blackfin idle: delete pm_idle sparc idle: rename pm_idle to sparc_idle sh idle: rename global pm_idle to static sh_idle x86 idle: rename global pm_idle to static x86_idle APM idle: register apm_cpu_idle via cpuidle cpufreq / intel_pstate: Add kernel command line option disable intel_pstate. cpufreq / intel_pstate: Change to disallow module build tools/power turbostat: display SMI count by default intel_idle: export both C1 and C1E ACPI / hotplug: Fix concurrency issues and memory leaks ...
Diffstat (limited to 'drivers/clk')
-rw-r--r--drivers/clk/Makefile1
-rw-r--r--drivers/clk/clk-highbank.c2
-rw-r--r--drivers/clk/mvebu/clk-gating-ctrl.c1
-rw-r--r--drivers/clk/x86/Makefile2
-rw-r--r--drivers/clk/x86/clk-lpss.c99
-rw-r--r--drivers/clk/x86/clk-lpss.h36
-rw-r--r--drivers/clk/x86/clk-lpt.c86
7 files changed, 227 insertions, 0 deletions
diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile
index 0ad642fbe794..14fde73ea6ff 100644
--- a/drivers/clk/Makefile
+++ b/drivers/clk/Makefile
@@ -26,6 +26,7 @@ obj-$(CONFIG_MACH_LOONGSON1) += clk-ls1x.o
26obj-$(CONFIG_ARCH_U8500) += ux500/ 26obj-$(CONFIG_ARCH_U8500) += ux500/
27obj-$(CONFIG_ARCH_VT8500) += clk-vt8500.o 27obj-$(CONFIG_ARCH_VT8500) += clk-vt8500.o
28obj-$(CONFIG_ARCH_ZYNQ) += clk-zynq.o 28obj-$(CONFIG_ARCH_ZYNQ) += clk-zynq.o
29obj-$(CONFIG_X86) += x86/
29 30
30# Chip specific 31# Chip specific
31obj-$(CONFIG_COMMON_CLK_WM831X) += clk-wm831x.o 32obj-$(CONFIG_COMMON_CLK_WM831X) += clk-wm831x.o
diff --git a/drivers/clk/clk-highbank.c b/drivers/clk/clk-highbank.c
index 5d1de2e11753..2e08cb001936 100644
--- a/drivers/clk/clk-highbank.c
+++ b/drivers/clk/clk-highbank.c
@@ -182,8 +182,10 @@ static int clk_pll_set_rate(struct clk_hw *hwclk, unsigned long rate,
182 reg |= HB_PLL_EXT_ENA; 182 reg |= HB_PLL_EXT_ENA;
183 reg &= ~HB_PLL_EXT_BYPASS; 183 reg &= ~HB_PLL_EXT_BYPASS;
184 } else { 184 } else {
185 writel(reg | HB_PLL_EXT_BYPASS, hbclk->reg);
185 reg &= ~HB_PLL_DIVQ_MASK; 186 reg &= ~HB_PLL_DIVQ_MASK;
186 reg |= divq << HB_PLL_DIVQ_SHIFT; 187 reg |= divq << HB_PLL_DIVQ_SHIFT;
188 writel(reg | HB_PLL_EXT_BYPASS, hbclk->reg);
187 } 189 }
188 writel(reg, hbclk->reg); 190 writel(reg, hbclk->reg);
189 191
diff --git a/drivers/clk/mvebu/clk-gating-ctrl.c b/drivers/clk/mvebu/clk-gating-ctrl.c
index 8fa5408b6c7d..ebf141d4374b 100644
--- a/drivers/clk/mvebu/clk-gating-ctrl.c
+++ b/drivers/clk/mvebu/clk-gating-ctrl.c
@@ -193,6 +193,7 @@ static const struct mvebu_soc_descr __initconst kirkwood_gating_descr[] = {
193 { "runit", NULL, 7 }, 193 { "runit", NULL, 7 },
194 { "xor0", NULL, 8 }, 194 { "xor0", NULL, 8 },
195 { "audio", NULL, 9 }, 195 { "audio", NULL, 9 },
196 { "powersave", "cpuclk", 11 },
196 { "sata0", NULL, 14 }, 197 { "sata0", NULL, 14 },
197 { "sata1", NULL, 15 }, 198 { "sata1", NULL, 15 },
198 { "xor1", NULL, 16 }, 199 { "xor1", NULL, 16 },
diff --git a/drivers/clk/x86/Makefile b/drivers/clk/x86/Makefile
new file mode 100644
index 000000000000..f9ba4fab0ddc
--- /dev/null
+++ b/drivers/clk/x86/Makefile
@@ -0,0 +1,2 @@
1clk-x86-lpss-objs := clk-lpss.o clk-lpt.o
2obj-$(CONFIG_X86_INTEL_LPSS) += clk-x86-lpss.o
diff --git a/drivers/clk/x86/clk-lpss.c b/drivers/clk/x86/clk-lpss.c
new file mode 100644
index 000000000000..b5e229f3c3d9
--- /dev/null
+++ b/drivers/clk/x86/clk-lpss.c
@@ -0,0 +1,99 @@
1/*
2 * Intel Low Power Subsystem clocks.
3 *
4 * Copyright (C) 2013, Intel Corporation
5 * Authors: Mika Westerberg <mika.westerberg@linux.intel.com>
6 * Heikki Krogerus <heikki.krogerus@linux.intel.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#include <linux/acpi.h>
14#include <linux/clk.h>
15#include <linux/clk-provider.h>
16#include <linux/err.h>
17#include <linux/io.h>
18#include <linux/module.h>
19
20static int clk_lpss_is_mmio_resource(struct acpi_resource *res, void *data)
21{
22 struct resource r;
23 return !acpi_dev_resource_memory(res, &r);
24}
25
26static acpi_status clk_lpss_find_mmio(acpi_handle handle, u32 level,
27 void *data, void **retval)
28{
29 struct resource_list_entry *rentry;
30 struct list_head resource_list;
31 struct acpi_device *adev;
32 const char *uid = data;
33 int ret;
34
35 if (acpi_bus_get_device(handle, &adev))
36 return AE_OK;
37
38 if (uid) {
39 if (!adev->pnp.unique_id)
40 return AE_OK;
41 if (strcmp(uid, adev->pnp.unique_id))
42 return AE_OK;
43 }
44
45 INIT_LIST_HEAD(&resource_list);
46 ret = acpi_dev_get_resources(adev, &resource_list,
47 clk_lpss_is_mmio_resource, NULL);
48 if (ret < 0)
49 return AE_NO_MEMORY;
50
51 list_for_each_entry(rentry, &resource_list, node)
52 if (resource_type(&rentry->res) == IORESOURCE_MEM) {
53 *(struct resource *)retval = rentry->res;
54 break;
55 }
56
57 acpi_dev_free_resource_list(&resource_list);
58 return AE_OK;
59}
60
61/**
62 * clk_register_lpss_gate - register LPSS clock gate
63 * @name: name of this clock gate
64 * @parent_name: parent clock name
65 * @hid: ACPI _HID of the device
66 * @uid: ACPI _UID of the device (optional)
67 * @offset: LPSS PRV_CLOCK_PARAMS offset
68 *
69 * Creates and registers LPSS clock gate.
70 */
71struct clk *clk_register_lpss_gate(const char *name, const char *parent_name,
72 const char *hid, const char *uid,
73 unsigned offset)
74{
75 struct resource res = { };
76 void __iomem *mmio_base;
77 acpi_status status;
78 struct clk *clk;
79
80 /*
81 * First try to look the device and its mmio resource from the
82 * ACPI namespace.
83 */
84 status = acpi_get_devices(hid, clk_lpss_find_mmio, (void *)uid,
85 (void **)&res);
86 if (ACPI_FAILURE(status) || !res.start)
87 return ERR_PTR(-ENODEV);
88
89 mmio_base = ioremap(res.start, resource_size(&res));
90 if (!mmio_base)
91 return ERR_PTR(-ENOMEM);
92
93 clk = clk_register_gate(NULL, name, parent_name, 0, mmio_base + offset,
94 0, 0, NULL);
95 if (IS_ERR(clk))
96 iounmap(mmio_base);
97
98 return clk;
99}
diff --git a/drivers/clk/x86/clk-lpss.h b/drivers/clk/x86/clk-lpss.h
new file mode 100644
index 000000000000..e9460f442297
--- /dev/null
+++ b/drivers/clk/x86/clk-lpss.h
@@ -0,0 +1,36 @@
1/*
2 * Intel Low Power Subsystem clock.
3 *
4 * Copyright (C) 2013, Intel Corporation
5 * Authors: Mika Westerberg <mika.westerberg@linux.intel.com>
6 * Heikki Krogerus <heikki.krogerus@linux.intel.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#ifndef __CLK_LPSS_H
14#define __CLK_LPSS_H
15
16#include <linux/err.h>
17#include <linux/errno.h>
18#include <linux/clk.h>
19
20#ifdef CONFIG_ACPI
21extern struct clk *clk_register_lpss_gate(const char *name,
22 const char *parent_name,
23 const char *hid, const char *uid,
24 unsigned offset);
25#else
26static inline struct clk *clk_register_lpss_gate(const char *name,
27 const char *parent_name,
28 const char *hid,
29 const char *uid,
30 unsigned offset)
31{
32 return ERR_PTR(-ENODEV);
33}
34#endif
35
36#endif /* __CLK_LPSS_H */
diff --git a/drivers/clk/x86/clk-lpt.c b/drivers/clk/x86/clk-lpt.c
new file mode 100644
index 000000000000..81298aeef7e3
--- /dev/null
+++ b/drivers/clk/x86/clk-lpt.c
@@ -0,0 +1,86 @@
1/*
2 * Intel Lynxpoint LPSS clocks.
3 *
4 * Copyright (C) 2013, Intel Corporation
5 * Authors: Mika Westerberg <mika.westerberg@linux.intel.com>
6 * Heikki Krogerus <heikki.krogerus@linux.intel.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#include <linux/acpi.h>
14#include <linux/clk.h>
15#include <linux/clkdev.h>
16#include <linux/clk-provider.h>
17#include <linux/err.h>
18#include <linux/module.h>
19#include <linux/platform_device.h>
20
21#include "clk-lpss.h"
22
23#define PRV_CLOCK_PARAMS 0x800
24
25static int lpt_clk_probe(struct platform_device *pdev)
26{
27 struct clk *clk;
28
29 /* LPSS free running clock */
30 clk = clk_register_fixed_rate(&pdev->dev, "lpss_clk", NULL, CLK_IS_ROOT,
31 100000000);
32 if (IS_ERR(clk))
33 return PTR_ERR(clk);
34
35 /* Shared DMA clock */
36 clk_register_clkdev(clk, "hclk", "INTL9C60.0.auto");
37
38 /* SPI clocks */
39 clk = clk_register_lpss_gate("spi0_clk", "lpss_clk", "INT33C0", NULL,
40 PRV_CLOCK_PARAMS);
41 if (!IS_ERR(clk))
42 clk_register_clkdev(clk, NULL, "INT33C0:00");
43
44 clk = clk_register_lpss_gate("spi1_clk", "lpss_clk", "INT33C1", NULL,
45 PRV_CLOCK_PARAMS);
46 if (!IS_ERR(clk))
47 clk_register_clkdev(clk, NULL, "INT33C1:00");
48
49 /* I2C clocks */
50 clk = clk_register_lpss_gate("i2c0_clk", "lpss_clk", "INT33C2", NULL,
51 PRV_CLOCK_PARAMS);
52 if (!IS_ERR(clk))
53 clk_register_clkdev(clk, NULL, "INT33C2:00");
54
55 clk = clk_register_lpss_gate("i2c1_clk", "lpss_clk", "INT33C3", NULL,
56 PRV_CLOCK_PARAMS);
57 if (!IS_ERR(clk))
58 clk_register_clkdev(clk, NULL, "INT33C3:00");
59
60 /* UART clocks */
61 clk = clk_register_lpss_gate("uart0_clk", "lpss_clk", "INT33C4", NULL,
62 PRV_CLOCK_PARAMS);
63 if (!IS_ERR(clk))
64 clk_register_clkdev(clk, NULL, "INT33C4:00");
65
66 clk = clk_register_lpss_gate("uart1_clk", "lpss_clk", "INT33C5", NULL,
67 PRV_CLOCK_PARAMS);
68 if (!IS_ERR(clk))
69 clk_register_clkdev(clk, NULL, "INT33C5:00");
70
71 return 0;
72}
73
74static struct platform_driver lpt_clk_driver = {
75 .driver = {
76 .name = "clk-lpt",
77 .owner = THIS_MODULE,
78 },
79 .probe = lpt_clk_probe,
80};
81
82static int __init lpt_clk_init(void)
83{
84 return platform_driver_register(&lpt_clk_driver);
85}
86arch_initcall(lpt_clk_init);