aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2016-09-14 11:34:35 -0400
committerArnd Bergmann <arnd@arndb.de>2016-09-14 11:34:35 -0400
commite08644b0c74ce9bc6e79291f6ef52aa0eb6bb139 (patch)
treeeeae5a232203e3a0d232b7b00a05a569001c1844
parent292cc1affba5295f38701caa2004b0ac8f61514e (diff)
parentbfe59f92d30613398997f235dbae623583d61b38 (diff)
Merge tag 'amlogic-dt64' of git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-amlogic into next/late
Pull "Amlogic 64-bit DT changes for v4.9" from Kevin Hilman: - add watchdog, reset, IR remote, PWM - add secure monitor and eFuse - add always-on (AO) domain clock and reset * tag 'amlogic-dt64' of git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-amlogic: ARM64: dts: amlogic: gxbb: Enable NVMEM documentation: Add nvmem bindings documentation ARM64: dts: amlogic: gxbb: Enable secure monitor documentation: Add secure monitor bindings documentation ARM64: dts: meson-gxbb: Add PWM pinctrl nodes ARM64: dts: meson-gxbb: Enable the the IR decoder on supported boards ARM64: dts: meson-gxbb: Add Infrared Remote Controller decoder dt-bindings: media: meson-ir: Add Meson8b and GXBB compatible strings ARM64: dts: amlogic: add the input pin for the IR remote ARM64: dts: meson-gxbb: Add GXBB AO Clock and Reset node clk: meson: Fix invalid use of sizeof in gxbb_aoclkc_probe() clk: meson: Add GXBB AO Clock and Reset controller driver dt-bindings: clock: reset: Add GXBB AO Clock and Reset Bindings ARM64: DTS: meson-gxbb: switch ethernet to real clock ARM64: dts: amlogic: meson-gxbb: Add watchdog node
-rw-r--r--Documentation/devicetree/bindings/clock/amlogic,gxbb-aoclkc.txt45
-rw-r--r--Documentation/devicetree/bindings/firmware/meson/meson_sm.txt15
-rw-r--r--Documentation/devicetree/bindings/media/meson-ir.txt5
-rw-r--r--Documentation/devicetree/bindings/nvmem/amlogic-efuse.txt39
-rw-r--r--arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts5
-rw-r--r--arch/arm64/boot/dts/amlogic/meson-gxbb-p20x.dtsi5
-rw-r--r--arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi6
-rw-r--r--arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi133
-rw-r--r--drivers/clk/meson/Makefile2
-rw-r--r--drivers/clk/meson/gxbb-aoclk.c191
-rw-r--r--include/dt-bindings/clock/gxbb-aoclkc.h66
-rw-r--r--include/dt-bindings/reset/gxbb-aoclkc.h66
12 files changed, 575 insertions, 3 deletions
diff --git a/Documentation/devicetree/bindings/clock/amlogic,gxbb-aoclkc.txt b/Documentation/devicetree/bindings/clock/amlogic,gxbb-aoclkc.txt
new file mode 100644
index 000000000000..a55d31b48d6e
--- /dev/null
+++ b/Documentation/devicetree/bindings/clock/amlogic,gxbb-aoclkc.txt
@@ -0,0 +1,45 @@
1* Amlogic GXBB AO Clock and Reset Unit
2
3The Amlogic GXBB AO clock controller generates and supplies clock to various
4controllers within the Always-On part of the SoC.
5
6Required Properties:
7
8- compatible: should be "amlogic,gxbb-aoclkc"
9- reg: physical base address of the clock controller and length of memory
10 mapped region.
11
12- #clock-cells: should be 1.
13
14Each clock is assigned an identifier and client nodes can use this identifier
15to specify the clock which they consume. All available clocks are defined as
16preprocessor macros in the dt-bindings/clock/gxbb-aoclkc.h header and can be
17used in device tree sources.
18
19- #reset-cells: should be 1.
20
21Each reset is assigned an identifier and client nodes can use this identifier
22to specify the reset which they consume. All available resets are defined as
23preprocessor macros in the dt-bindings/reset/gxbb-aoclkc.h header and can be
24used in device tree sources.
25
26Example: AO Clock controller node:
27
28 clkc_AO: clock-controller@040 {
29 compatible = "amlogic,gxbb-aoclkc";
30 reg = <0x0 0x040 0x0 0x4>;
31 #clock-cells = <1>;
32 #reset-cells = <1>;
33 };
34
35Example: UART controller node that consumes the clock and reset generated
36 by the clock controller:
37
38 uart_AO: serial@4c0 {
39 compatible = "amlogic,meson-uart";
40 reg = <0x4c0 0x14>;
41 interrupts = <0 90 1>;
42 clocks = <&clkc_AO CLKID_AO_UART1>;
43 resets = <&clkc_AO RESET_AO_UART1>;
44 status = "disabled";
45 };
diff --git a/Documentation/devicetree/bindings/firmware/meson/meson_sm.txt b/Documentation/devicetree/bindings/firmware/meson/meson_sm.txt
new file mode 100644
index 000000000000..c248cd44f727
--- /dev/null
+++ b/Documentation/devicetree/bindings/firmware/meson/meson_sm.txt
@@ -0,0 +1,15 @@
1* Amlogic Secure Monitor
2
3In the Amlogic SoCs the Secure Monitor code is used to provide access to the
4NVMEM, enable JTAG, set USB boot, etc...
5
6Required properties for the secure monitor node:
7- compatible: Should be "amlogic,meson-gxbb-sm"
8
9Example:
10
11 firmware {
12 sm: secure-monitor {
13 compatible = "amlogic,meson-gxbb-sm";
14 };
15 };
diff --git a/Documentation/devicetree/bindings/media/meson-ir.txt b/Documentation/devicetree/bindings/media/meson-ir.txt
index 407848e85f31..e7e3f3c4fc8f 100644
--- a/Documentation/devicetree/bindings/media/meson-ir.txt
+++ b/Documentation/devicetree/bindings/media/meson-ir.txt
@@ -1,7 +1,10 @@
1* Amlogic Meson IR remote control receiver 1* Amlogic Meson IR remote control receiver
2 2
3Required properties: 3Required properties:
4 - compatible : should be "amlogic,meson6-ir" 4 - compatible : depending on the platform this should be one of:
5 - "amlogic,meson6-ir"
6 - "amlogic,meson8b-ir"
7 - "amlogic,meson-gxbb-ir"
5 - reg : physical base address and length of the device registers 8 - reg : physical base address and length of the device registers
6 - interrupts : a single specifier for the interrupt from the device 9 - interrupts : a single specifier for the interrupt from the device
7 10
diff --git a/Documentation/devicetree/bindings/nvmem/amlogic-efuse.txt b/Documentation/devicetree/bindings/nvmem/amlogic-efuse.txt
new file mode 100644
index 000000000000..fafd85bd67a6
--- /dev/null
+++ b/Documentation/devicetree/bindings/nvmem/amlogic-efuse.txt
@@ -0,0 +1,39 @@
1= Amlogic eFuse device tree bindings =
2
3Required properties:
4- compatible: should be "amlogic,meson-gxbb-efuse"
5
6= Data cells =
7Are child nodes of eFuse, bindings of which as described in
8bindings/nvmem/nvmem.txt
9
10Example:
11
12 efuse: efuse {
13 compatible = "amlogic,meson-gxbb-efuse";
14 #address-cells = <1>;
15 #size-cells = <1>;
16
17 sn: sn@14 {
18 reg = <0x14 0x10>;
19 };
20
21 eth_mac: eth_mac@34 {
22 reg = <0x34 0x10>;
23 };
24
25 bid: bid@46 {
26 reg = <0x46 0x30>;
27 };
28 };
29
30= Data consumers =
31Are device nodes which consume nvmem data cells.
32
33For example:
34
35 eth_mac {
36 ...
37 nvmem-cells = <&eth_mac>;
38 nvmem-cell-names = "eth_mac";
39 };
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts
index 90a84c514d3d..233703529201 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts
@@ -87,3 +87,8 @@
87 pinctrl-names = "default"; 87 pinctrl-names = "default";
88}; 88};
89 89
90&ir {
91 status = "okay";
92 pinctrl-0 = <&remote_input_ao_pins>;
93 pinctrl-names = "default";
94};
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-p20x.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb-p20x.dtsi
index f4f30f674b4c..0eaca7277cfd 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-p20x.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-p20x.dtsi
@@ -72,3 +72,8 @@
72 pinctrl-names = "default"; 72 pinctrl-names = "default";
73}; 73};
74 74
75&ir {
76 status = "okay";
77 pinctrl-0 = <&remote_input_ao_pins>;
78 pinctrl-names = "default";
79};
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi
index 54bb7c739089..560770e6c648 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi
@@ -60,3 +60,9 @@
60 pinctrl-names = "default"; 60 pinctrl-names = "default";
61 61
62}; 62};
63
64&ir {
65 status = "okay";
66 pinctrl-0 = <&remote_input_ao_pins>;
67 pinctrl-names = "default";
68};
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
index e502c24b0ac7..762f3681a49c 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
@@ -45,6 +45,9 @@
45#include <dt-bindings/interrupt-controller/arm-gic.h> 45#include <dt-bindings/interrupt-controller/arm-gic.h>
46#include <dt-bindings/gpio/meson-gxbb-gpio.h> 46#include <dt-bindings/gpio/meson-gxbb-gpio.h>
47#include <dt-bindings/reset/amlogic,meson-gxbb-reset.h> 47#include <dt-bindings/reset/amlogic,meson-gxbb-reset.h>
48#include <dt-bindings/clock/gxbb-clkc.h>
49#include <dt-bindings/clock/gxbb-aoclkc.h>
50#include <dt-bindings/reset/gxbb-aoclkc.h>
48 51
49/ { 52/ {
50 compatible = "amlogic,meson-gxbb"; 53 compatible = "amlogic,meson-gxbb";
@@ -99,6 +102,30 @@
99 method = "smc"; 102 method = "smc";
100 }; 103 };
101 104
105 firmware {
106 sm: secure-monitor {
107 compatible = "amlogic,meson-gxbb-sm";
108 };
109 };
110
111 efuse: efuse {
112 compatible = "amlogic,meson-gxbb-efuse";
113 #address-cells = <1>;
114 #size-cells = <1>;
115
116 sn: sn@14 {
117 reg = <0x14 0x10>;
118 };
119
120 eth_mac: eth_mac@34 {
121 reg = <0x34 0x10>;
122 };
123
124 bid: bid@46 {
125 reg = <0x46 0x30>;
126 };
127 };
128
102 timer { 129 timer {
103 compatible = "arm,armv8-timer"; 130 compatible = "arm,armv8-timer";
104 interrupts = <GIC_PPI 13 131 interrupts = <GIC_PPI 13
@@ -160,6 +187,12 @@
160 clocks = <&xtal>; 187 clocks = <&xtal>;
161 status = "disabled"; 188 status = "disabled";
162 }; 189 };
190
191 watchdog@98d0 {
192 compatible = "amlogic,meson-gxbb-wdt";
193 reg = <0x0 0x098d0 0x0 0x10>;
194 clocks = <&xtal>;
195 };
163 }; 196 };
164 197
165 gic: interrupt-controller@c4301000 { 198 gic: interrupt-controller@c4301000 {
@@ -203,6 +236,48 @@
203 function = "uart_ao"; 236 function = "uart_ao";
204 }; 237 };
205 }; 238 };
239
240 remote_input_ao_pins: remote_input_ao {
241 mux {
242 groups = "remote_input_ao";
243 function = "remote_input_ao";
244 };
245 };
246
247 pwm_ao_a_3_pins: pwm_ao_a_3 {
248 mux {
249 groups = "pwm_ao_a_3";
250 function = "pwm_ao_a_3";
251 };
252 };
253
254 pwm_ao_a_6_pins: pwm_ao_a_6 {
255 mux {
256 groups = "pwm_ao_a_6";
257 function = "pwm_ao_a_6";
258 };
259 };
260
261 pwm_ao_a_12_pins: pwm_ao_a_12 {
262 mux {
263 groups = "pwm_ao_a_12";
264 function = "pwm_ao_a_12";
265 };
266 };
267
268 pwm_ao_b_pins: pwm_ao_b {
269 mux {
270 groups = "pwm_ao_b";
271 function = "pwm_ao_b";
272 };
273 };
274 };
275
276 clkc_AO: clock-controller@040 {
277 compatible = "amlogic,gxbb-aoclkc";
278 reg = <0x0 0x00040 0x0 0x4>;
279 #clock-cells = <1>;
280 #reset-cells = <1>;
206 }; 281 };
207 282
208 uart_AO: serial@4c0 { 283 uart_AO: serial@4c0 {
@@ -212,6 +287,13 @@
212 clocks = <&xtal>; 287 clocks = <&xtal>;
213 status = "disabled"; 288 status = "disabled";
214 }; 289 };
290
291 ir: ir@580 {
292 compatible = "amlogic,meson-gxbb-ir";
293 reg = <0x0 0x00580 0x0 0x40>;
294 interrupts = <GIC_SPI 196 IRQ_TYPE_EDGE_RISING>;
295 status = "disabled";
296 };
215 }; 297 };
216 298
217 periphs: periphs@c8834000 { 299 periphs: periphs@c8834000 {
@@ -306,6 +388,55 @@
306 function = "eth"; 388 function = "eth";
307 }; 389 };
308 }; 390 };
391
392 pwm_a_x_pins: pwm_a_x {
393 mux {
394 groups = "pwm_a_x";
395 function = "pwm_a_x";
396 };
397 };
398
399 pwm_a_y_pins: pwm_a_y {
400 mux {
401 groups = "pwm_a_y";
402 function = "pwm_a_y";
403 };
404 };
405
406 pwm_b_pins: pwm_b {
407 mux {
408 groups = "pwm_b";
409 function = "pwm_b";
410 };
411 };
412
413 pwm_d_pins: pwm_d {
414 mux {
415 groups = "pwm_d";
416 function = "pwm_d";
417 };
418 };
419
420 pwm_e_pins: pwm_e {
421 mux {
422 groups = "pwm_e";
423 function = "pwm_e";
424 };
425 };
426
427 pwm_f_x_pins: pwm_f_x {
428 mux {
429 groups = "pwm_f_x";
430 function = "pwm_f_x";
431 };
432 };
433
434 pwm_f_y_pins: pwm_f_y {
435 mux {
436 groups = "pwm_f_y";
437 function = "pwm_f_y";
438 };
439 };
309 }; 440 };
310 }; 441 };
311 442
@@ -337,7 +468,7 @@
337 0x0 0xc8834540 0x0 0x4>; 468 0x0 0xc8834540 0x0 0x4>;
338 interrupts = <0 8 1>; 469 interrupts = <0 8 1>;
339 interrupt-names = "macirq"; 470 interrupt-names = "macirq";
340 clocks = <&xtal>; 471 clocks = <&clkc CLKID_ETH>;
341 clock-names = "stmmaceth"; 472 clock-names = "stmmaceth";
342 phy-mode = "rgmii"; 473 phy-mode = "rgmii";
343 status = "disabled"; 474 status = "disabled";
diff --git a/drivers/clk/meson/Makefile b/drivers/clk/meson/Makefile
index 197e40175166..d4cd4a35d74e 100644
--- a/drivers/clk/meson/Makefile
+++ b/drivers/clk/meson/Makefile
@@ -4,4 +4,4 @@
4 4
5obj-$(CONFIG_COMMON_CLK_AMLOGIC) += clk-pll.o clk-cpu.o clk-mpll.o 5obj-$(CONFIG_COMMON_CLK_AMLOGIC) += clk-pll.o clk-cpu.o clk-mpll.o
6obj-$(CONFIG_COMMON_CLK_MESON8B) += meson8b-clkc.o 6obj-$(CONFIG_COMMON_CLK_MESON8B) += meson8b-clkc.o
7obj-$(CONFIG_COMMON_CLK_GXBB) += gxbb.o 7obj-$(CONFIG_COMMON_CLK_GXBB) += gxbb.o gxbb-aoclk.o
diff --git a/drivers/clk/meson/gxbb-aoclk.c b/drivers/clk/meson/gxbb-aoclk.c
new file mode 100644
index 000000000000..b45c5fba7e35
--- /dev/null
+++ b/drivers/clk/meson/gxbb-aoclk.c
@@ -0,0 +1,191 @@
1/*
2 * This file is provided under a dual BSD/GPLv2 license. When using or
3 * redistributing this file, you may do so under either license.
4 *
5 * GPL LICENSE SUMMARY
6 *
7 * Copyright (c) 2016 BayLibre, SAS.
8 * Author: Neil Armstrong <narmstrong@baylibre.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of version 2 of the GNU General Public License as
12 * published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, see <http://www.gnu.org/licenses/>.
21 * The full GNU General Public License is included in this distribution
22 * in the file called COPYING.
23 *
24 * BSD LICENSE
25 *
26 * Copyright (c) 2016 BayLibre, SAS.
27 * Author: Neil Armstrong <narmstrong@baylibre.com>
28 *
29 * Redistribution and use in source and binary forms, with or without
30 * modification, are permitted provided that the following conditions
31 * are met:
32 *
33 * * Redistributions of source code must retain the above copyright
34 * notice, this list of conditions and the following disclaimer.
35 * * Redistributions in binary form must reproduce the above copyright
36 * notice, this list of conditions and the following disclaimer in
37 * the documentation and/or other materials provided with the
38 * distribution.
39 * * Neither the name of Intel Corporation nor the names of its
40 * contributors may be used to endorse or promote products derived
41 * from this software without specific prior written permission.
42 *
43 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
44 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
45 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
46 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
47 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
48 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
49 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
50 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
51 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
52 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
53 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
54 */
55#include <linux/clk-provider.h>
56#include <linux/of_address.h>
57#include <linux/platform_device.h>
58#include <linux/reset-controller.h>
59#include <linux/init.h>
60#include <dt-bindings/clock/gxbb-aoclkc.h>
61#include <dt-bindings/reset/gxbb-aoclkc.h>
62
63static DEFINE_SPINLOCK(gxbb_aoclk_lock);
64
65struct gxbb_aoclk_reset_controller {
66 struct reset_controller_dev reset;
67 unsigned int *data;
68 void __iomem *base;
69};
70
71static int gxbb_aoclk_do_reset(struct reset_controller_dev *rcdev,
72 unsigned long id)
73{
74 struct gxbb_aoclk_reset_controller *reset =
75 container_of(rcdev, struct gxbb_aoclk_reset_controller, reset);
76
77 writel(BIT(reset->data[id]), reset->base);
78
79 return 0;
80}
81
82static const struct reset_control_ops gxbb_aoclk_reset_ops = {
83 .reset = gxbb_aoclk_do_reset,
84};
85
86#define GXBB_AO_GATE(_name, _bit) \
87static struct clk_gate _name##_ao = { \
88 .reg = (void __iomem *)0, \
89 .bit_idx = (_bit), \
90 .lock = &gxbb_aoclk_lock, \
91 .hw.init = &(struct clk_init_data) { \
92 .name = #_name "_ao", \
93 .ops = &clk_gate_ops, \
94 .parent_names = (const char *[]){ "clk81" }, \
95 .num_parents = 1, \
96 .flags = (CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED), \
97 }, \
98}
99
100GXBB_AO_GATE(remote, 0);
101GXBB_AO_GATE(i2c_master, 1);
102GXBB_AO_GATE(i2c_slave, 2);
103GXBB_AO_GATE(uart1, 3);
104GXBB_AO_GATE(uart2, 5);
105GXBB_AO_GATE(ir_blaster, 6);
106
107static unsigned int gxbb_aoclk_reset[] = {
108 [RESET_AO_REMOTE] = 16,
109 [RESET_AO_I2C_MASTER] = 18,
110 [RESET_AO_I2C_SLAVE] = 19,
111 [RESET_AO_UART1] = 17,
112 [RESET_AO_UART2] = 22,
113 [RESET_AO_IR_BLASTER] = 23,
114};
115
116static struct clk_gate *gxbb_aoclk_gate[] = {
117 [CLKID_AO_REMOTE] = &remote_ao,
118 [CLKID_AO_I2C_MASTER] = &i2c_master_ao,
119 [CLKID_AO_I2C_SLAVE] = &i2c_slave_ao,
120 [CLKID_AO_UART1] = &uart1_ao,
121 [CLKID_AO_UART2] = &uart2_ao,
122 [CLKID_AO_IR_BLASTER] = &ir_blaster_ao,
123};
124
125static struct clk_hw_onecell_data gxbb_aoclk_onecell_data = {
126 .hws = {
127 [CLKID_AO_REMOTE] = &remote_ao.hw,
128 [CLKID_AO_I2C_MASTER] = &i2c_master_ao.hw,
129 [CLKID_AO_I2C_SLAVE] = &i2c_slave_ao.hw,
130 [CLKID_AO_UART1] = &uart1_ao.hw,
131 [CLKID_AO_UART2] = &uart2_ao.hw,
132 [CLKID_AO_IR_BLASTER] = &ir_blaster_ao.hw,
133 },
134 .num = ARRAY_SIZE(gxbb_aoclk_gate),
135};
136
137static int gxbb_aoclkc_probe(struct platform_device *pdev)
138{
139 struct resource *res;
140 void __iomem *base;
141 int ret, clkid;
142 struct device *dev = &pdev->dev;
143 struct gxbb_aoclk_reset_controller *rstc;
144
145 rstc = devm_kzalloc(dev, sizeof(*rstc), GFP_KERNEL);
146 if (!rstc)
147 return -ENOMEM;
148
149 /* Generic clocks */
150 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
151 base = devm_ioremap_resource(dev, res);
152 if (IS_ERR(base))
153 return PTR_ERR(base);
154
155 /* Reset Controller */
156 rstc->base = base;
157 rstc->data = gxbb_aoclk_reset;
158 rstc->reset.ops = &gxbb_aoclk_reset_ops;
159 rstc->reset.nr_resets = ARRAY_SIZE(gxbb_aoclk_reset);
160 rstc->reset.of_node = dev->of_node;
161 ret = devm_reset_controller_register(dev, &rstc->reset);
162
163 /*
164 * Populate base address and register all clks
165 */
166 for (clkid = 0; clkid < gxbb_aoclk_onecell_data.num; clkid++) {
167 gxbb_aoclk_gate[clkid]->reg = base;
168
169 ret = devm_clk_hw_register(dev,
170 gxbb_aoclk_onecell_data.hws[clkid]);
171 if (ret)
172 return ret;
173 }
174
175 return of_clk_add_hw_provider(dev->of_node, of_clk_hw_onecell_get,
176 &gxbb_aoclk_onecell_data);
177}
178
179static const struct of_device_id gxbb_aoclkc_match_table[] = {
180 { .compatible = "amlogic,gxbb-aoclkc" },
181 { }
182};
183
184static struct platform_driver gxbb_aoclkc_driver = {
185 .probe = gxbb_aoclkc_probe,
186 .driver = {
187 .name = "gxbb-aoclkc",
188 .of_match_table = gxbb_aoclkc_match_table,
189 },
190};
191builtin_platform_driver(gxbb_aoclkc_driver);
diff --git a/include/dt-bindings/clock/gxbb-aoclkc.h b/include/dt-bindings/clock/gxbb-aoclkc.h
new file mode 100644
index 000000000000..31751482d13c
--- /dev/null
+++ b/include/dt-bindings/clock/gxbb-aoclkc.h
@@ -0,0 +1,66 @@
1/*
2 * This file is provided under a dual BSD/GPLv2 license. When using or
3 * redistributing this file, you may do so under either license.
4 *
5 * GPL LICENSE SUMMARY
6 *
7 * Copyright (c) 2016 BayLibre, SAS.
8 * Author: Neil Armstrong <narmstrong@baylibre.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of version 2 of the GNU General Public License as
12 * published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, see <http://www.gnu.org/licenses/>.
21 * The full GNU General Public License is included in this distribution
22 * in the file called COPYING.
23 *
24 * BSD LICENSE
25 *
26 * Copyright (c) 2016 BayLibre, SAS.
27 * Author: Neil Armstrong <narmstrong@baylibre.com>
28 *
29 * Redistribution and use in source and binary forms, with or without
30 * modification, are permitted provided that the following conditions
31 * are met:
32 *
33 * * Redistributions of source code must retain the above copyright
34 * notice, this list of conditions and the following disclaimer.
35 * * Redistributions in binary form must reproduce the above copyright
36 * notice, this list of conditions and the following disclaimer in
37 * the documentation and/or other materials provided with the
38 * distribution.
39 * * Neither the name of Intel Corporation nor the names of its
40 * contributors may be used to endorse or promote products derived
41 * from this software without specific prior written permission.
42 *
43 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
44 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
45 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
46 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
47 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
48 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
49 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
50 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
51 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
52 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
53 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
54 */
55
56#ifndef DT_BINDINGS_CLOCK_AMLOGIC_MESON_GXBB_AOCLK
57#define DT_BINDINGS_CLOCK_AMLOGIC_MESON_GXBB_AOCLK
58
59#define CLKID_AO_REMOTE 0
60#define CLKID_AO_I2C_MASTER 1
61#define CLKID_AO_I2C_SLAVE 2
62#define CLKID_AO_UART1 3
63#define CLKID_AO_UART2 4
64#define CLKID_AO_IR_BLASTER 5
65
66#endif
diff --git a/include/dt-bindings/reset/gxbb-aoclkc.h b/include/dt-bindings/reset/gxbb-aoclkc.h
new file mode 100644
index 000000000000..9e3fd60c309c
--- /dev/null
+++ b/include/dt-bindings/reset/gxbb-aoclkc.h
@@ -0,0 +1,66 @@
1/*
2 * This file is provided under a dual BSD/GPLv2 license. When using or
3 * redistributing this file, you may do so under either license.
4 *
5 * GPL LICENSE SUMMARY
6 *
7 * Copyright (c) 2016 BayLibre, SAS.
8 * Author: Neil Armstrong <narmstrong@baylibre.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of version 2 of the GNU General Public License as
12 * published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, see <http://www.gnu.org/licenses/>.
21 * The full GNU General Public License is included in this distribution
22 * in the file called COPYING.
23 *
24 * BSD LICENSE
25 *
26 * Copyright (c) 2016 BayLibre, SAS.
27 * Author: Neil Armstrong <narmstrong@baylibre.com>
28 *
29 * Redistribution and use in source and binary forms, with or without
30 * modification, are permitted provided that the following conditions
31 * are met:
32 *
33 * * Redistributions of source code must retain the above copyright
34 * notice, this list of conditions and the following disclaimer.
35 * * Redistributions in binary form must reproduce the above copyright
36 * notice, this list of conditions and the following disclaimer in
37 * the documentation and/or other materials provided with the
38 * distribution.
39 * * Neither the name of Intel Corporation nor the names of its
40 * contributors may be used to endorse or promote products derived
41 * from this software without specific prior written permission.
42 *
43 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
44 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
45 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
46 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
47 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
48 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
49 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
50 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
51 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
52 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
53 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
54 */
55
56#ifndef DT_BINDINGS_RESET_AMLOGIC_MESON_GXBB_AOCLK
57#define DT_BINDINGS_RESET_AMLOGIC_MESON_GXBB_AOCLK
58
59#define RESET_AO_REMOTE 0
60#define RESET_AO_I2C_MASTER 1
61#define RESET_AO_I2C_SLAVE 2
62#define RESET_AO_UART1 3
63#define RESET_AO_UART2 4
64#define RESET_AO_IR_BLASTER 5
65
66#endif