From: Domenico Andreoli <cavokz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Cc: Domenico Andreoli
<domenico.andreoli-vYTEC60ixJUAvxtiuMwx3w@public.gmane.org>,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
Subject: [PATCH 4/6] ARM: bcm476x: Add stub clock driver
Date: Sun, 07 Oct 2012 03:53:04 +0200 [thread overview]
Message-ID: <20121007015407.154476821@gmail.com> (raw)
In-Reply-To: 20121007015300.828366635@gmail.com
[-- Attachment #1: arm-bcm476x-add-stub-clock-driver.patch --]
[-- Type: text/plain, Size: 4725 bytes --]
From: Domenico Andreoli <domenico.andreoli-vYTEC60ixJUAvxtiuMwx3w@public.gmane.org>
This is the minimal clock support required for the boot, a more complete
implementation will follow (shortly).
Signed-off-by: Domenico Andreoli <domenico.andreoli-vYTEC60ixJUAvxtiuMwx3w@public.gmane.org>
---
arch/arm/mach-bcm476x/bcm476x.c | 3 ++
drivers/clk/Makefile | 1 +
drivers/clk/clk-bcm476x.c | 52 ++++++++++++++++++++++++++++++++++++++++
include/linux/clk/bcm476x.h | 22 +++++++++++++++++
4 files changed, 78 insertions(+)
create mode 100644 drivers/clk/clk-bcm476x.c
create mode 100644 include/linux/clk/bcm476x.h
Index: b/arch/arm/mach-bcm476x/bcm476x.c
===================================================================
--- a/arch/arm/mach-bcm476x/bcm476x.c
+++ b/arch/arm/mach-bcm476x/bcm476x.c
@@ -18,6 +18,7 @@
#include <linux/of_irq.h>
#include <linux/of_platform.h>
#include <linux/bcm476x_timer.h>
+#include <linux/clk/bcm476x.h>
#include <asm/hardware/vic.h>
#include <asm/mach/arch.h>
@@ -43,6 +44,8 @@ void __init bcm476x_init(void)
{
int ret;
+ bcm476x_init_clocks();
+
ret = of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
if (ret) {
pr_err("of_platform_populate failed: %d\n", ret);
Index: b/drivers/clk/Makefile
===================================================================
--- a/drivers/clk/Makefile
+++ b/drivers/clk/Makefile
@@ -5,6 +5,7 @@ obj-$(CONFIG_COMMON_CLK) += clk.o clk-fi
clk-mux.o clk-divider.o clk-fixed-factor.o
# SoCs specific
obj-$(CONFIG_ARCH_BCM2835) += clk-bcm2835.o
+obj-$(CONFIG_ARCH_BCM476X) += clk-bcm476x.o
obj-$(CONFIG_ARCH_NOMADIK) += clk-nomadik.o
obj-$(CONFIG_ARCH_HIGHBANK) += clk-highbank.o
obj-$(CONFIG_ARCH_MXS) += mxs/
Index: b/drivers/clk/clk-bcm476x.c
===================================================================
--- /dev/null
+++ b/drivers/clk/clk-bcm476x.c
@@ -0,0 +1,52 @@
+/*
+ * Broadcom BCM476x SoCs clocks
+ *
+ * Copyright (C) 2011-2012 Domenico Andreoli <domenico.andreoli-vYTEC60ixJUAvxtiuMwx3w@public.gmane.org>
+ *
+ * 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.h>
+#include <linux/clk-private.h>
+#include <linux/clk-provider.h>
+#include <linux/clkdev.h>
+#include <linux/clk/bcm476x.h>
+
+/*
+ * These are fixed clocks (and device tree doesn't support clk!).
+ *
+ * They're probably not all root clocks and it may be possible to
+ * turn them on and off but until this is mapped out better it's
+ * the only way they can be used.
+ */
+DEFINE_CLK_FIXED_RATE(sys_pclk, CLK_IS_ROOT, 312000000, 0);
+DEFINE_CLK_FIXED_RATE(apb_pclk, CLK_IS_ROOT, 156000000, 0);
+DEFINE_CLK_FIXED_RATE(uart0_pclk, CLK_IS_ROOT, 78000000, 0);
+DEFINE_CLK_FIXED_RATE(uart1_pclk, CLK_IS_ROOT, 78000000, 0);
+DEFINE_CLK_FIXED_RATE(uart2_pclk, CLK_IS_ROOT, 78000000, 0);
+
+static struct clk_lookup lookups[] = {
+ { .con_id = "sys_pclk", .clk = &sys_pclk },
+ { .con_id = "apb_pclk", .clk = &apb_pclk },
+ { .dev_id = "c0000.uart0", .clk = &uart0_pclk },
+ { .dev_id = "c1000.uart1", .clk = &uart1_pclk },
+ { .dev_id = "b2000.uart2", .clk = &uart2_pclk },
+};
+
+void __init bcm476x_init_clocks(void)
+{
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(lookups); i++) {
+ __clk_init(NULL, lookups[i].clk);
+ clkdev_add(&lookups[i]);
+ }
+}
Index: b/include/linux/clk/bcm476x.h
===================================================================
--- /dev/null
+++ b/include/linux/clk/bcm476x.h
@@ -0,0 +1,22 @@
+/*
+ * Broadcom BCM476x SoCs clocks
+ *
+ * Copyright (C) 2011-2012 Domenico Andreoli <domenico.andreoli-vYTEC60ixJUAvxtiuMwx3w@public.gmane.org>
+ *
+ * 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_BCM476X_H_
+#define __LINUX_CLK_BCM476X_H_
+
+void __init bcm476x_init_clocks(void);
+
+#endif
next prev parent reply other threads:[~2012-10-07 1:53 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-07 1:53 [PATCH 0/6] ARM: Add support for Broadcom BCM476x SoCs Domenico Andreoli
2012-10-07 1:53 ` [PATCH 1/6] ARM: bcm476x: Add infrastructure Domenico Andreoli
[not found] ` <20121007015405.958959522-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-10-07 19:57 ` Jean-Christophe PLAGNIOL-VILLARD
[not found] ` <20121007195759.GG12801-RQcB7r2h9QmfDR2tN2SG5Ni2O/JbrIOy@public.gmane.org>
2012-10-07 22:54 ` Domenico Andreoli
2012-10-08 13:13 ` Jean-Christophe PLAGNIOL-VILLARD
2012-10-09 2:37 ` Stephen Warren
[not found] ` <50738DD0.5090406-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-10-09 11:50 ` Domenico Andreoli
2012-10-09 2:48 ` Stephen Warren
[not found] ` <50739074.8000001-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-10-09 11:54 ` Domenico Andreoli
2012-10-09 3:08 ` Stephen Warren
[not found] ` <50739541.2030603-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-10-09 11:55 ` Domenico Andreoli
2012-10-09 9:18 ` Arnd Bergmann
[not found] ` <201210090918.56725.arnd-r2nGTMty4D4@public.gmane.org>
2012-10-09 22:58 ` Domenico Andreoli
2012-10-10 6:29 ` Arnd Bergmann
2012-10-12 7:06 ` Domenico Andreoli
2012-10-12 7:26 ` Thomas Petazzoni
2012-10-12 8:03 ` Arnd Bergmann
2012-10-12 8:12 ` Thomas Petazzoni
2012-10-12 10:48 ` Arnd Bergmann
2012-10-12 11:01 ` Thomas Petazzoni
2012-10-12 11:17 ` Arnd Bergmann
2012-10-08 11:50 ` Florian Fainelli
2012-10-09 2:41 ` Stephen Warren
2012-10-08 12:14 ` Thomas Petazzoni
2012-10-09 11:52 ` Domenico Andreoli
2012-10-07 1:53 ` [PATCH 2/6] ARM: bcm476x: Add system timer Domenico Andreoli
2012-10-08 11:50 ` Florian Fainelli
2012-10-09 2:43 ` Stephen Warren
[not found] ` <50738F48.5010002-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-10-09 23:04 ` Domenico Andreoli
2012-10-07 1:53 ` [PATCH 3/6] ARM: bcm476x: Add sched clock Domenico Andreoli
[not found] ` <20121007015406.809888002-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-10-09 2:54 ` Stephen Warren
2012-10-07 1:53 ` Domenico Andreoli [this message]
[not found] ` <20121007015407.154476821-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-10-09 3:00 ` [PATCH 4/6] ARM: bcm476x: Add stub clock driver Stephen Warren
2012-10-12 14:52 ` Mike Turquette
2012-10-12 15:28 ` Domenico Andreoli
2012-10-07 1:53 ` [PATCH 5/6] ARM: bcm476x: Add restart hook Domenico Andreoli
2012-10-07 1:53 ` [PATCH 6/6] ARM: bcm476x: Instantiate console UART Domenico Andreoli
[not found] ` <20121007015407.840781689-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-10-07 20:03 ` Jean-Christophe PLAGNIOL-VILLARD
[not found] ` <20121007200300.GH12801-RQcB7r2h9QmfDR2tN2SG5Ni2O/JbrIOy@public.gmane.org>
2012-10-07 23:14 ` Domenico Andreoli
2012-10-09 3:06 ` Stephen Warren
[not found] ` <507394CB.5080300-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-10-09 23:37 ` Domenico Andreoli
[not found] ` <20121007015300.828366635-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-10-07 5:22 ` [PATCH 0/6] ARM: Add support for Broadcom BCM476x SoCs Stephen Warren
[not found] ` <5071118A.6040508-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-10-07 10:14 ` Domenico Andreoli
2012-10-09 2:44 ` Stephen Warren
[not found] ` <50738F8F.3030006-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-10-09 23:57 ` Domenico Andreoli
2012-10-07 19:47 ` Olof Johansson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20121007015407.154476821@gmail.com \
--to=cavokz-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
--cc=domenico.andreoli-vYTEC60ixJUAvxtiuMwx3w@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).