Skip to contentSkip to conversation

ARM: vt8500: clk: Add clock support for arch-vt8500

PATCH Superseded Tony Prisk 4 participants 4 messages Jul 22, 2012 – Jul 25, 2012

Subsystems (4)

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Tony Prisk

author
#0 lore raw

PATCH 1/1 ARM: vt8500: clk: Add clock support for arch-vt8500

This patch adds common clock framework support for arch-vt8500. WM8650 support is included in preparation for devicetree support. Each SoC has a seperate initialization function due to no devicetree support to identify SoCs at the moment. Once devicetree is implemented, VT8500 and WM8505 should be combined. WM8650 uses different functions for clocks.

---
 arch/arm/Kconfig                        |    2 +
 arch/arm/mach-vt8500/bv07.c             |    4 +
 arch/arm/mach-vt8500/include/mach/clk.h |    9 ++
 arch/arm/mach-vt8500/wm8505_7in.c       |    4 +
 drivers/clk/Makefile                    |    1 +
 drivers/clk/vt8500/Makefile             |   12 +++
 drivers/clk/vt8500/clk-gatediv.c        |  152 +++++++++++++++++++++++++++++++
 drivers/clk/vt8500/clk.h                |   36 +++++++
 drivers/clk/vt8500/vt8500_clk.c         |  108 ++++++++++++++++++++++
 drivers/clk/vt8500/wm8505_clk.c         |  122 +++++++++++++++++++++++++
 drivers/clk/vt8500/wm85xx-pll.c         |  103 +++++++++++++++++++++
 drivers/clk/vt8500/wm8650_clk.c         |  127 ++++++++++++++++++++++++++
 drivers/clk/vt8500/wm86xx-pll.c         |  135 +++++++++++++++++++++++++++
 13 files changed, 815 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-vt8500/include/mach/clk.h
 create mode 100644 drivers/clk/vt8500/Makefile
 create mode 100644 drivers/clk/vt8500/clk-gatediv.c
 create mode 100644 drivers/clk/vt8500/clk.h
 create mode 100644 drivers/clk/vt8500/vt8500_clk.c
 create mode 100644 drivers/clk/vt8500/wm8505_clk.c
 create mode 100644 drivers/clk/vt8500/wm85xx-pll.c
 create mode 100644 drivers/clk/vt8500/wm8650_clk.c
 create mode 100644 drivers/clk/vt8500/wm86xx-pll.c
arch/arm/Kconfig +2 -0
index c0c465e..721bb2c 100644
@@ -999,6 +999,8 @@ config ARCH_VT8500
 	select ARCH_HAS_CPUFREQ
 	select GENERIC_CLOCKEVENTS
 	select ARCH_REQUIRE_GPIOLIB
+	select CLKDEV_LOOKUP
+	select COMMON_CLK
 	help
 	  Support for VIA/WonderMedia VT8500/WM85xx System-on-Chip.
 
arch/arm/mach-vt8500/bv07.c +4 -0
index f9fbeb2..ec84b2a 100644
@@ -24,6 +24,7 @@
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <mach/restart.h>
+#include <mach/clk.h>
 
 #include "devices.h"
 
@@ -67,6 +68,9 @@ void __init bv07_init(void)
 	vt8500_set_resources();
 	platform_add_devices(devices, ARRAY_SIZE(devices));
 	vt8500_gpio_init();
+
+	/* this call can be moved to timer_init once devicetree is ready */
+	vt8500_clk_init();
 }
 
 MACHINE_START(BV07, "Benign BV07 Mini Netbook")
arch/arm/mach-vt8500/include/mach/clk.h new file +9 -0
new file mode 100644
index 0000000..d4cc9c4
@@ -0,0 +1,9 @@
+#ifndef __WMT_CLK
+#define __WMT_CLK
+
+void __init vt8500_clk_init(void);
+void __init wm8505_clk_init(void);
+/* WM8650 support not added yet, but included for completeness */
+void __init wm8650_clk_init(void);
+
+#endif
arch/arm/mach-vt8500/wm8505_7in.c +4 -0
index db19886..d6049bb 100644
@@ -24,6 +24,7 @@
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <mach/restart.h>
+#include <mach/clk.h>
 
 #include "devices.h"
 
@@ -66,6 +67,9 @@ void __init wm8505_7in_init(void)
 	wm8505_set_resources();
 	platform_add_devices(devices, ARRAY_SIZE(devices));
 	vt8500_gpio_init();
+
+	/* this call can be moved to timer_init once devicetree is ready */
+	wm8505_clk_init();
 }
 
 MACHINE_START(WM8505_7IN_NETBOOK, "WM8505 7-inch generic netbook")
drivers/clk/Makefile +1 -0
index 5869ea3..2d37177 100644
@@ -10,6 +10,7 @@ obj-$(CONFIG_ARCH_SOCFPGA)	+= socfpga/
 obj-$(CONFIG_PLAT_SPEAR)	+= spear/
 obj-$(CONFIG_ARCH_U300)		+= clk-u300.o
 obj-$(CONFIG_ARCH_INTEGRATOR)	+= versatile/
+obj-$(CONFIG_ARCH_VT8500)	+= vt8500/
 
 # Chip specific
 obj-$(CONFIG_COMMON_CLK_WM831X) += clk-wm831x.o
drivers/clk/vt8500/Makefile new file +12 -0
new file mode 100644
index 0000000..319f65b
@@ -0,0 +1,12 @@
+#
+# Wondermedia Clock specific Makefile
+#
+obj-y	+= clk-gatediv.o
+
+obj-$(CONFIG_VTWM_VERSION_VT8500)	+= vt8500_clk.o wm85xx-pll.o
+obj-$(CONFIG_VTWM_VERSION_WM8505)	+= wm8505_clk.o wm85xx-pll.o
+
+# WM8650 board support missing - has different clock functions so
+# added for completeness. Will be needed for devicetree support.
+obj-$(CONFIG_VTWM_VERSION_WM8650)	+= wm8650_clk.o wm86xx-pll.o
+
drivers/clk/vt8500/clk-gatediv.c new file +152 -0

152 lines not on this page · raw message

drivers/clk/vt8500/clk.h new file +36 -0
new file mode 100644
index 0000000..12f87a2
@@ -0,0 +1,36 @@
+/* drivers/clk/wmt/clk.h
+ *
+ * Copyright (C) 2012 Tony Prisk <[email protected]>
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that 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.
+ *
+ */
+
+struct clk_pll {
+	struct clk_hw hw;
+	void __iomem	*reg;
+	spinlock_t	*lock;
+};
+
+struct clk_gatediv {
+	struct clk_hw hw;
+	void __iomem	*en_reg;
+	u8		en_bit;
+	void __iomem	*div_reg;
+	spinlock_t	*lock;
+};
+
+struct clk *clk_register_pll_wm85xx(const char *name, const char *parent_name,
+		unsigned long flags, void __iomem *reg, spinlock_t *lock);
+struct clk *clk_register_pll_wm86xx(const char *name, const char *parent_name,
+		unsigned long flags, void __iomem *reg, spinlock_t *lock);
+struct clk *clk_register_gatediv(const char *name, const char *parent_name,
+		unsigned long flags, void __iomem *div_reg,
+		void __iomem *en_reg, u8 en_bit, spinlock_t *lock);
drivers/clk/vt8500/vt8500_clk.c new file +108 -0

108 lines not on this page · raw message

drivers/clk/vt8500/wm8505_clk.c new file +122 -0

122 lines not on this page · raw message

drivers/clk/vt8500/wm85xx-pll.c new file +103 -0

103 lines not on this page · raw message

drivers/clk/vt8500/wm8650_clk.c new file +127 -0

127 lines not on this page · raw message

drivers/clk/vt8500/wm86xx-pll.c new file +135 -0

135 lines not on this page · raw message

Signature · 1 line
1.7.2.5
Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · Tony Prisk

This patch adds common clock framework support for arch-vt8500. WM8650 support is included in preparation for devicetree support. Each SoC has a seperate initialization function due to no devicetree support to identify SoCs at the moment. Once devicetree is implemented, VT8500 and WM8505 should be combined. WM8650 uses different functions for clocks.

arch/arm parts:

#2 lore raw
In reply to Tony Prisk
Quoted 8 lines · Tony Prisk

This patch adds common clock framework support for arch-vt8500. WM8650 support is included in preparation for devicetree support. Each SoC has a seperate initialization function due to no devicetree support to identify SoCs at the moment. Once devicetree is implemented, VT8500 and WM8505 should be combined. WM8650 uses different functions for clocks.

Hi Tony,

I'll give this a more thorough review once the -rc1 window is over.

Regards,
Mike

#3 lore raw

Thanks Mike,

I might actually have a new patch up by then as the device tree support is coming along nicely.

Regards,
Tony

Quoted 25 lines

-----Original Message-----
From: vt8500-wm8505-linux-kernel at googlegroups.com [mailto:vt8500-wm8505-linux-kernel at googlegroups.com] On Behalf Of Turquette, Mike
Sent: Wednesday, 25 July 2012 9:08 a.m.
To: Tony Prisk
Cc: VT8500 mailing list; linux-kernel at vger.kernel.org; linux-arm-kernel at lists.infradead.org; Russell King; Arnd Bergmann; Alexey Charkov
Subject: Re: [PATCH] ARM: vt8500: clk: Add clock support for arch-vt8500

Quoted 8 lines · Tony Prisk

This patch adds common clock framework support for arch-vt8500. WM8650 support is included in preparation for devicetree support. Each SoC has a seperate initialization function due to no devicetree support to identify SoCs at the moment. Once devicetree is implemented, VT8500 and WM8505 should be combined. WM8650 uses different functions for clocks.

Hi Tony,

I'll give this a more thorough review once the -rc1 window is over.

Regards,
Mike