aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Turquette <mturquette@baylibre.com>2015-12-22 19:49:38 -0500
committerMichael Turquette <mturquette@baylibre.com>2015-12-22 19:49:38 -0500
commitce6dd266d535d66ac90abdd0241e7e5be4890568 (patch)
tree16f5d98d8fcc1559c449c5f8a850bf3d6613e6ff
parent471a9abeb18f43cf437f58d3a13ed8f43b7dede7 (diff)
parent5e63dcc74b3066659ea53aeefbee1fc1d79f4b6f (diff)
Merge branch 'clk-bcm2835' into clk-next
-rw-r--r--Documentation/devicetree/bindings/clock/brcm,bcm2835-aux-clock.txt31
-rw-r--r--drivers/clk/bcm/Makefile1
-rw-r--r--drivers/clk/bcm/clk-bcm2835-aux.c85
-rw-r--r--include/dt-bindings/clock/bcm2835-aux.h17
4 files changed, 134 insertions, 0 deletions
diff --git a/Documentation/devicetree/bindings/clock/brcm,bcm2835-aux-clock.txt b/Documentation/devicetree/bindings/clock/brcm,bcm2835-aux-clock.txt
new file mode 100644
index 000000000000..7a837d2182ac
--- /dev/null
+++ b/Documentation/devicetree/bindings/clock/brcm,bcm2835-aux-clock.txt
@@ -0,0 +1,31 @@
1Broadcom BCM2835 auxiliary peripheral support
2
3This binding uses the common clock binding:
4 Documentation/devicetree/bindings/clock/clock-bindings.txt
5
6The auxiliary peripherals (UART, SPI1, and SPI2) have a small register
7area controlling clock gating to the peripherals, and providing an IRQ
8status register.
9
10Required properties:
11- compatible: Should be "brcm,bcm2835-aux"
12- #clock-cells: Should be <1>. The permitted clock-specifier values can be
13 found in include/dt-bindings/clock/bcm2835-aux.h
14- reg: Specifies base physical address and size of the registers
15- clocks: The parent clock phandle
16
17Example:
18
19 clocks: cprman@7e101000 {
20 compatible = "brcm,bcm2835-cprman";
21 #clock-cells = <1>;
22 reg = <0x7e101000 0x2000>;
23 clocks = <&clk_osc>;
24 };
25
26 aux: aux@0x7e215004 {
27 compatible = "brcm,bcm2835-aux";
28 #clock-cells = <1>;
29 reg = <0x7e215000 0x8>;
30 clocks = <&clocks BCM2835_CLOCK_VPU>;
31 };
diff --git a/drivers/clk/bcm/Makefile b/drivers/clk/bcm/Makefile
index 247c26750d8b..1d79bd2c36f0 100644
--- a/drivers/clk/bcm/Makefile
+++ b/drivers/clk/bcm/Makefile
@@ -5,6 +5,7 @@ obj-$(CONFIG_CLK_BCM_KONA) += clk-bcm281xx.o
5obj-$(CONFIG_CLK_BCM_KONA) += clk-bcm21664.o 5obj-$(CONFIG_CLK_BCM_KONA) += clk-bcm21664.o
6obj-$(CONFIG_COMMON_CLK_IPROC) += clk-iproc-armpll.o clk-iproc-pll.o clk-iproc-asiu.o 6obj-$(CONFIG_COMMON_CLK_IPROC) += clk-iproc-armpll.o clk-iproc-pll.o clk-iproc-asiu.o
7obj-$(CONFIG_ARCH_BCM2835) += clk-bcm2835.o 7obj-$(CONFIG_ARCH_BCM2835) += clk-bcm2835.o
8obj-$(CONFIG_ARCH_BCM2835) += clk-bcm2835-aux.o
8obj-$(CONFIG_COMMON_CLK_IPROC) += clk-ns2.o 9obj-$(CONFIG_COMMON_CLK_IPROC) += clk-ns2.o
9obj-$(CONFIG_ARCH_BCM_CYGNUS) += clk-cygnus.o 10obj-$(CONFIG_ARCH_BCM_CYGNUS) += clk-cygnus.o
10obj-$(CONFIG_ARCH_BCM_NSP) += clk-nsp.o 11obj-$(CONFIG_ARCH_BCM_NSP) += clk-nsp.o
diff --git a/drivers/clk/bcm/clk-bcm2835-aux.c b/drivers/clk/bcm/clk-bcm2835-aux.c
new file mode 100644
index 000000000000..e4f89e28b5ec
--- /dev/null
+++ b/drivers/clk/bcm/clk-bcm2835-aux.c
@@ -0,0 +1,85 @@
1/*
2 * Copyright (C) 2015 Broadcom
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#include <linux/clk.h>
16#include <linux/clk-provider.h>
17#include <linux/clk/bcm2835.h>
18#include <linux/module.h>
19#include <linux/platform_device.h>
20#include <dt-bindings/clock/bcm2835-aux.h>
21
22#define BCM2835_AUXIRQ 0x00
23#define BCM2835_AUXENB 0x04
24
25static int bcm2835_aux_clk_probe(struct platform_device *pdev)
26{
27 struct device *dev = &pdev->dev;
28 struct clk_onecell_data *onecell;
29 const char *parent;
30 struct clk *parent_clk;
31 struct resource *res;
32 void __iomem *reg, *gate;
33
34 parent_clk = devm_clk_get(dev, NULL);
35 if (IS_ERR(parent_clk))
36 return PTR_ERR(parent_clk);
37 parent = __clk_get_name(parent_clk);
38
39 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
40 reg = devm_ioremap_resource(dev, res);
41 if (!reg)
42 return -ENODEV;
43
44 onecell = devm_kmalloc(dev, sizeof(*onecell), GFP_KERNEL);
45 if (!onecell)
46 return -ENOMEM;
47 onecell->clk_num = BCM2835_AUX_CLOCK_COUNT;
48 onecell->clks = devm_kcalloc(dev, BCM2835_AUX_CLOCK_COUNT,
49 sizeof(*onecell->clks), GFP_KERNEL);
50 if (!onecell->clks)
51 return -ENOMEM;
52
53 gate = reg + BCM2835_AUXENB;
54 onecell->clks[BCM2835_AUX_CLOCK_UART] =
55 clk_register_gate(dev, "aux_uart", parent, 0, gate, 0, 0, NULL);
56
57 onecell->clks[BCM2835_AUX_CLOCK_SPI1] =
58 clk_register_gate(dev, "aux_spi1", parent, 0, gate, 1, 0, NULL);
59
60 onecell->clks[BCM2835_AUX_CLOCK_SPI2] =
61 clk_register_gate(dev, "aux_spi2", parent, 0, gate, 2, 0, NULL);
62
63 of_clk_add_provider(pdev->dev.of_node, of_clk_src_onecell_get, onecell);
64
65 return 0;
66}
67
68static const struct of_device_id bcm2835_aux_clk_of_match[] = {
69 { .compatible = "brcm,bcm2835-aux", },
70 {},
71};
72MODULE_DEVICE_TABLE(of, bcm2835_aux_clk_of_match);
73
74static struct platform_driver bcm2835_aux_clk_driver = {
75 .driver = {
76 .name = "bcm2835-aux-clk",
77 .of_match_table = bcm2835_aux_clk_of_match,
78 },
79 .probe = bcm2835_aux_clk_probe,
80};
81builtin_platform_driver(bcm2835_aux_clk_driver);
82
83MODULE_AUTHOR("Eric Anholt <eric@anholt.net>");
84MODULE_DESCRIPTION("BCM2835 auxiliary peripheral clock driver");
85MODULE_LICENSE("GPL v2");
diff --git a/include/dt-bindings/clock/bcm2835-aux.h b/include/dt-bindings/clock/bcm2835-aux.h
new file mode 100644
index 000000000000..d91156e2658d
--- /dev/null
+++ b/include/dt-bindings/clock/bcm2835-aux.h
@@ -0,0 +1,17 @@
1/*
2 * Copyright (C) 2015 Broadcom Corporation
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation version 2.
7 *
8 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 * kind, whether express or implied; without even the implied warranty
10 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 */
13
14#define BCM2835_AUX_CLOCK_UART 0
15#define BCM2835_AUX_CLOCK_SPI1 1
16#define BCM2835_AUX_CLOCK_SPI2 2
17#define BCM2835_AUX_CLOCK_COUNT 3