diff mbox

[4/5] ARM: bcm4760: Add stub clock driver

Message ID 20130721002714.459727324@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Domenico Andreoli July 21, 2013, 12:23 a.m. UTC
From: Domenico Andreoli <domenico.andreoli@linux.com>

Minimal clock support required for the BCM4760 SoCs boot.

Cc: Mike Turquette <mturquette@linaro.org>
Cc: linux-arm-kernel@lists.infradead.org
Signed-off-by: Domenico Andreoli <domenico.andreoli@linux.com>
---
 arch/arm/mach-bcm/bcm4760.c |    2 ++
 drivers/clk/Makefile        |    1 +
 drivers/clk/clk-bcm4760.c   |   35 +++++++++++++++++++++++++++++++++++
 include/linux/clk/bcm4760.h |   22 ++++++++++++++++++++++
 4 files changed, 60 insertions(+)
 create mode 100644 drivers/clk/clk-bcm4760.c
 create mode 100644 include/linux/clk/bcm4760.h

Comments

Arnd Bergmann July 21, 2013, 8:16 a.m. UTC | #1
On Sunday 21 July 2013, Domenico Andreoli wrote:
> +#include <linux/clk-provider.h>
> +#include <linux/clkdev.h>
> +#include <linux/clk/bcm4760.h>
> +
> +void __init bcm4760_init_clocks(void)
> +{
> +       struct clk *clk;
> +
> +       clk = clk_register_fixed_rate(NULL, "pclk", NULL, CLK_IS_ROOT, 78000000);
> +       if (IS_ERR(clk))
> +               pr_err("pclk not registered\n");
> +
> +       if (clk_register_clkdev(clk, NULL, "c0000.uart0"))
> +               pr_err("uart0 clk alias not registered\n");
> +       if (clk_register_clkdev(clk, NULL, "c1000.uart1"))
> +               pr_err("uart1 clk alias not registered\n");
> +       if (clk_register_clkdev(clk, NULL, "b2000.uart2"))
> +               pr_err("uart2 clk alias not registered\n");
> +}


Since these are all fixed-rate clocks, I think what you should do here is to
put them into the device tree as compatible="fixed-clock" and remove the code
here.

	Arnd
diff mbox

Patch

Index: b/arch/arm/mach-bcm/bcm4760.c
===================================================================
--- a/arch/arm/mach-bcm/bcm4760.c
+++ b/arch/arm/mach-bcm/bcm4760.c
@@ -18,6 +18,7 @@ 
 #include <linux/irqchip.h>
 #include <linux/of_irq.h>
 #include <linux/of_platform.h>
+#include <linux/clk/bcm4760.h>
 
 #include <asm/system_info.h>
 #include <asm/mach/arch.h>
@@ -60,6 +61,7 @@  static void __init bcm4760_init(void)
 	int err;
 
 	bcm4760_system_rev();
+	bcm4760_init_clocks();
 
 	err = of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
 	if (err) {
Index: b/drivers/clk/Makefile
===================================================================
--- a/drivers/clk/Makefile
+++ b/drivers/clk/Makefile
@@ -11,6 +11,7 @@  obj-$(CONFIG_COMMON_CLK)	+= clk-composit
 
 # SoCs specific
 obj-$(CONFIG_ARCH_BCM2835)	+= clk-bcm2835.o
+obj-$(CONFIG_ARCH_BCM4760)	+= clk-bcm4760.o
 obj-$(CONFIG_ARCH_NOMADIK)	+= clk-nomadik.o
 obj-$(CONFIG_ARCH_HIGHBANK)	+= clk-highbank.o
 obj-$(CONFIG_ARCH_NSPIRE)	+= clk-nspire.o
Index: b/drivers/clk/clk-bcm4760.c
===================================================================
--- /dev/null
+++ b/drivers/clk/clk-bcm4760.c
@@ -0,0 +1,35 @@ 
+/*
+ * Broadcom BCM4760 based ARM11 SoCs clocks
+ *
+ * Copyright (C) 2012 Domenico Andreoli <domenico.andreoli@linux.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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.
+ */
+
+#include <linux/clk-provider.h>
+#include <linux/clkdev.h>
+#include <linux/clk/bcm4760.h>
+
+void __init bcm4760_init_clocks(void)
+{
+	struct clk *clk;
+
+	clk = clk_register_fixed_rate(NULL, "pclk", NULL, CLK_IS_ROOT, 78000000);
+	if (IS_ERR(clk))
+		pr_err("pclk not registered\n");
+
+	if (clk_register_clkdev(clk, NULL, "c0000.uart0"))
+		pr_err("uart0 clk alias not registered\n");
+	if (clk_register_clkdev(clk, NULL, "c1000.uart1"))
+		pr_err("uart1 clk alias not registered\n");
+	if (clk_register_clkdev(clk, NULL, "b2000.uart2"))
+		pr_err("uart2 clk alias not registered\n");
+}
Index: b/include/linux/clk/bcm4760.h
===================================================================
--- /dev/null
+++ b/include/linux/clk/bcm4760.h
@@ -0,0 +1,22 @@ 
+/*
+ * Broadcom BCM4760 based ARM11 SoCs clocks
+ *
+ * Copyright (C) 2012 Domenico Andreoli <domenico.andreoli@linux.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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.
+ */
+
+#ifndef _LINUX_CLK_BCM4760_H
+#define _LINUX_CLK_BCM4760_H
+
+void __init bcm4760_init_clocks(void);
+
+#endif