Skip to contentSkip to conversation

clk: x86: Add Atom PMC platform clocks

PATCH Superseded Irina Tirdea 1 participant 1 message Sep 15, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 clk: x86: Add Atom PMC platform clocks

The BayTrail and CherryTrail platforms provide platform clocks through their Power Management Controller (PMC).

The SoC supports up to 6 clocks (PMC_PLT_CLK[5:0]) with a frequency of either 19.2 MHz (PLL) or 25 MHz (XTAL) for BayTrail an a frequency of 19.2 MHz (XTAL) for CherryTrail. These clocks are available for general system use, where appropriate, and each have Control & Frequency register fields associated with them.

For example, the usage for platform clocks suggested in the datasheet is the following:
PLT_CLK[2:0] - Camera
PLT_CLK[3] - Audio Codec
PLT_CLK[4] -
PLT_CLK[5] - COMMs

---

Notes:
Submitting this patch through the clock tree as requested by Mark Brown. This patch specifically enables the audio MCLK required by Baytrail CR devices (support already merged in Mark's tree)

Changes from v3:
- replace devm_kzalloc with devm_kcalloc
- add x86 architecture maintainers

Changes from v2:
- move clk platform data structures to a separate include file
- store clk_hw pointer for the fixed rate clocks

Changes from v1:
- register the clk device as child of pmc device
- pass iomem pointer from pmc driver to clk driver to avoid using
pmc_atom_read()/write() and use readl/writel API instead
- use devm_clk_hw_register/clkdev_hw_create instead of
clk_register/clkdev_create

 arch/x86/Kconfig                          |   1 +
 arch/x86/include/asm/pmc_atom.h           |   3 +
 arch/x86/platform/atom/pmc_atom.c         |  78 +++++-
 drivers/clk/x86/Makefile                  |   1 +
 drivers/clk/x86/clk-byt-plt.c             | 380 ++++++++++++++++++++++++++++++
 include/linux/platform_data/clk-byt-plt.h |  31 +++
 6 files changed, 491 insertions(+), 3 deletions(-)
 create mode 100644 drivers/clk/x86/clk-byt-plt.c
 create mode 100644 include/linux/platform_data/clk-byt-plt.h
arch/x86/Kconfig +1 -0
index 2a1f0ce..3e603a8 100644
@@ -2744,6 +2744,7 @@ config X86_DMA_REMAP
 config PMC_ATOM
 	def_bool y
         depends on PCI
+	select COMMON_CLK
 
 config VMD
 	depends on PCI_MSI
arch/x86/include/asm/pmc_atom.h +3 -0
index aa8744c..2d310cf 100644
@@ -50,6 +50,9 @@
 				BIT_ORED_DEDICATED_IRQ_GPSC | \
 				BIT_SHARED_IRQ_GPSS)
 
+/* Platform clock control registers */
+#define PMC_CLK_CTL_0		0x60
+
 /* The timers acumulate time spent in sleep state */
 #define	PMC_S0IR_TMR		0x80
 #define	PMC_S0I1_TMR		0x84
arch/x86/platform/atom/pmc_atom.c +75 -3

123 lines not on this page · raw message

drivers/clk/x86/Makefile +1 -0
index 0478138..cbdc8cc 100644
@@ -1,2 +1,3 @@
 clk-x86-lpss-objs		:= clk-lpt.o
 obj-$(CONFIG_X86_INTEL_LPSS)	+= clk-x86-lpss.o
+obj-$(CONFIG_PMC_ATOM)		+= clk-byt-plt.o
drivers/clk/x86/clk-byt-plt.c new file +380 -0

380 lines not on this page · raw message

include/linux/platform_data/clk-byt-plt.h new file +31 -0
new file mode 100644
index 0000000..e6bca9c
@@ -0,0 +1,31 @@
+/*
+ * Intel Atom platform clocks for BayTrail and CherryTrail SoC.
+ *
+ * Copyright (C) 2016, Intel Corporation
+ * Author: Irina Tirdea <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ */
+
+#ifndef __CLK_BYT_PLT_H
+#define __CLK_BYT_PLT_H
+
+struct pmc_clk {
+	const char *name;
+	unsigned long freq;
+	const char *parent_name;
+};
+
+struct pmc_clk_data {
+	void __iomem *base;
+	const struct pmc_clk *clks;
+};
+
+#endif /* __CLK_BYT_PLT_H */
Signature · 1 line
1.9.1