aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlof Johansson <olof@lixom.net>2014-03-09 14:51:19 -0400
committerOlof Johansson <olof@lixom.net>2014-03-09 14:51:29 -0400
commit555e2a5cf234f5cbce74200281c8754934126824 (patch)
tree7bd2b2e5120b070b0d32ac88e2f1b619ecda00dd
parentdba5bedb96b0956a544b363227fd081d97701fd5 (diff)
parente7eda91f6323bd7dc85598c639f5e4709efc2309 (diff)
Merge tag 'sirf-soc-for-3.15' of git://git.kernel.org/pub/scm/linux/kernel/git/baohua/linux into next/cleanup
ARM: sirf: machine update for 3.15 from Barry Song: Most of the below are some minor fixes for coding style. "ARM: prima2: move to generic reset controller driver framework" has been ready near 3.14 merge window, but it was late to merge in 3.14, so move this one to 3.15. * tag 'sirf-soc-for-3.15' of git://git.kernel.org/pub/scm/linux/kernel/git/baohua/linux: ARM: prima2: move to generic reset controller driver framework ARM: prima2: staticize sirfsoc_init_late function ARM: prima2: rtciobrg: fix the typo about license ARM: prima2: common: fix checkpatch issues ARM: prima2: platsmp: fix checkpatch issues ARM: prima2: l2x0: fix checkpatch issues Signed-off-by: Olof Johansson <olof@lixom.net>
-rw-r--r--Documentation/devicetree/bindings/reset/sirf,rstc.txt42
-rw-r--r--arch/arm/boot/dts/atlas6.dtsi3
-rw-r--r--arch/arm/boot/dts/marco.dtsi3
-rw-r--r--arch/arm/boot/dts/prima2.dtsi3
-rw-r--r--arch/arm/mach-prima2/Kconfig1
-rw-r--r--arch/arm/mach-prima2/common.c8
-rw-r--r--arch/arm/mach-prima2/l2x0.c9
-rw-r--r--arch/arm/mach-prima2/platsmp.c6
-rw-r--r--arch/arm/mach-prima2/rstc.c93
-rw-r--r--arch/arm/mach-prima2/rtciobrg.c2
10 files changed, 120 insertions, 50 deletions
diff --git a/Documentation/devicetree/bindings/reset/sirf,rstc.txt b/Documentation/devicetree/bindings/reset/sirf,rstc.txt
new file mode 100644
index 000000000000..0505de742d30
--- /dev/null
+++ b/Documentation/devicetree/bindings/reset/sirf,rstc.txt
@@ -0,0 +1,42 @@
1CSR SiRFSoC Reset Controller
2======================================
3
4Please also refer to reset.txt in this directory for common reset
5controller binding usage.
6
7Required properties:
8- compatible: Should be "sirf,prima2-rstc" or "sirf,marco-rstc"
9- reg: should be register base and length as documented in the
10 datasheet
11- #reset-cells: 1, see below
12
13example:
14
15rstc: reset-controller@88010000 {
16 compatible = "sirf,prima2-rstc";
17 reg = <0x88010000 0x1000>;
18 #reset-cells = <1>;
19};
20
21Specifying reset lines connected to IP modules
22==============================================
23
24The reset controller(rstc) manages various reset sources. This module provides
25reset signals for most blocks in system. Those device nodes should specify the
26reset line on the rstc in their resets property, containing a phandle to the
27rstc device node and a RESET_INDEX specifying which module to reset, as described
28in reset.txt.
29
30For SiRFSoC, RESET_INDEX is just reset_bit defined in SW_RST0 and SW_RST1 registers.
31For modules whose rest_bit is in SW_RST0, its RESET_INDEX is 0~31. For modules whose
32rest_bit is in SW_RST1, its RESET_INDEX is 32~63.
33
34example:
35
36vpp@90020000 {
37 compatible = "sirf,prima2-vpp";
38 reg = <0x90020000 0x10000>;
39 interrupts = <31>;
40 clocks = <&clks 35>;
41 resets = <&rstc 6>;
42};
diff --git a/arch/arm/boot/dts/atlas6.dtsi b/arch/arm/boot/dts/atlas6.dtsi
index f8674bcc4489..f7f9cafb42f5 100644
--- a/arch/arm/boot/dts/atlas6.dtsi
+++ b/arch/arm/boot/dts/atlas6.dtsi
@@ -65,9 +65,10 @@
65 #clock-cells = <1>; 65 #clock-cells = <1>;
66 }; 66 };
67 67
68 reset-controller@88010000 { 68 rstc: reset-controller@88010000 {
69 compatible = "sirf,prima2-rstc"; 69 compatible = "sirf,prima2-rstc";
70 reg = <0x88010000 0x1000>; 70 reg = <0x88010000 0x1000>;
71 #reset-cells = <1>;
71 }; 72 };
72 73
73 rsc-controller@88020000 { 74 rsc-controller@88020000 {
diff --git a/arch/arm/boot/dts/marco.dtsi b/arch/arm/boot/dts/marco.dtsi
index 1579c3491ccd..0c9647d28765 100644
--- a/arch/arm/boot/dts/marco.dtsi
+++ b/arch/arm/boot/dts/marco.dtsi
@@ -58,9 +58,10 @@
58 #size-cells = <1>; 58 #size-cells = <1>;
59 ranges = <0xc2000000 0xc2000000 0x1000000>; 59 ranges = <0xc2000000 0xc2000000 0x1000000>;
60 60
61 reset-controller@c2000000 { 61 rstc: reset-controller@c2000000 {
62 compatible = "sirf,marco-rstc"; 62 compatible = "sirf,marco-rstc";
63 reg = <0xc2000000 0x10000>; 63 reg = <0xc2000000 0x10000>;
64 #reset-cells = <1>;
64 }; 65 };
65 }; 66 };
66 67
diff --git a/arch/arm/boot/dts/prima2.dtsi b/arch/arm/boot/dts/prima2.dtsi
index 0e219932d7cc..0ca0d7fd7a6e 100644
--- a/arch/arm/boot/dts/prima2.dtsi
+++ b/arch/arm/boot/dts/prima2.dtsi
@@ -76,9 +76,10 @@
76 #clock-cells = <1>; 76 #clock-cells = <1>;
77 }; 77 };
78 78
79 reset-controller@88010000 { 79 rstc: reset-controller@88010000 {
80 compatible = "sirf,prima2-rstc"; 80 compatible = "sirf,prima2-rstc";
81 reg = <0x88010000 0x1000>; 81 reg = <0x88010000 0x1000>;
82 #reset-cells = <1>;
82 }; 83 };
83 84
84 rsc-controller@88020000 { 85 rsc-controller@88020000 {
diff --git a/arch/arm/mach-prima2/Kconfig b/arch/arm/mach-prima2/Kconfig
index 2c726b4f9356..3e8189186a5b 100644
--- a/arch/arm/mach-prima2/Kconfig
+++ b/arch/arm/mach-prima2/Kconfig
@@ -1,5 +1,6 @@
1config ARCH_SIRF 1config ARCH_SIRF
2 bool "CSR SiRF" if ARCH_MULTI_V7 2 bool "CSR SiRF" if ARCH_MULTI_V7
3 select ARCH_HAS_RESET_CONTROLLER
3 select ARCH_REQUIRE_GPIOLIB 4 select ARCH_REQUIRE_GPIOLIB
4 select GENERIC_IRQ_CHIP 5 select GENERIC_IRQ_CHIP
5 select NO_IOPORT 6 select NO_IOPORT
diff --git a/arch/arm/mach-prima2/common.c b/arch/arm/mach-prima2/common.c
index d49aff74de98..3b8865a140ee 100644
--- a/arch/arm/mach-prima2/common.c
+++ b/arch/arm/mach-prima2/common.c
@@ -15,7 +15,7 @@
15#include <linux/of_platform.h> 15#include <linux/of_platform.h>
16#include "common.h" 16#include "common.h"
17 17
18void __init sirfsoc_init_late(void) 18static void __init sirfsoc_init_late(void)
19{ 19{
20 sirfsoc_pm_init(); 20 sirfsoc_pm_init();
21} 21}
@@ -27,7 +27,7 @@ static __init void sirfsoc_map_io(void)
27} 27}
28 28
29#ifdef CONFIG_ARCH_ATLAS6 29#ifdef CONFIG_ARCH_ATLAS6
30static const char *atlas6_dt_match[] __initdata = { 30static const char *atlas6_dt_match[] __initconst = {
31 "sirf,atlas6", 31 "sirf,atlas6",
32 NULL 32 NULL
33}; 33};
@@ -42,7 +42,7 @@ MACHINE_END
42#endif 42#endif
43 43
44#ifdef CONFIG_ARCH_PRIMA2 44#ifdef CONFIG_ARCH_PRIMA2
45static const char *prima2_dt_match[] __initdata = { 45static const char *prima2_dt_match[] __initconst = {
46 "sirf,prima2", 46 "sirf,prima2",
47 NULL 47 NULL
48}; 48};
@@ -58,7 +58,7 @@ MACHINE_END
58#endif 58#endif
59 59
60#ifdef CONFIG_ARCH_MARCO 60#ifdef CONFIG_ARCH_MARCO
61static const char *marco_dt_match[] __initdata = { 61static const char *marco_dt_match[] __initconst = {
62 "sirf,marco", 62 "sirf,marco",
63 NULL 63 NULL
64}; 64};
diff --git a/arch/arm/mach-prima2/l2x0.c b/arch/arm/mach-prima2/l2x0.c
index cbcbe9cb094c..c7102539c0b0 100644
--- a/arch/arm/mach-prima2/l2x0.c
+++ b/arch/arm/mach-prima2/l2x0.c
@@ -11,24 +11,23 @@
11#include <linux/of.h> 11#include <linux/of.h>
12#include <asm/hardware/cache-l2x0.h> 12#include <asm/hardware/cache-l2x0.h>
13 13
14struct l2x0_aux 14struct l2x0_aux {
15{
16 u32 val; 15 u32 val;
17 u32 mask; 16 u32 mask;
18}; 17};
19 18
20static struct l2x0_aux prima2_l2x0_aux __initconst = { 19static const struct l2x0_aux prima2_l2x0_aux __initconst = {
21 .val = 2 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT, 20 .val = 2 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT,
22 .mask = 0, 21 .mask = 0,
23}; 22};
24 23
25static struct l2x0_aux marco_l2x0_aux __initconst = { 24static const struct l2x0_aux marco_l2x0_aux __initconst = {
26 .val = (2 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT) | 25 .val = (2 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT) |
27 (1 << L2X0_AUX_CTRL_ASSOCIATIVITY_SHIFT), 26 (1 << L2X0_AUX_CTRL_ASSOCIATIVITY_SHIFT),
28 .mask = L2X0_AUX_CTRL_MASK, 27 .mask = L2X0_AUX_CTRL_MASK,
29}; 28};
30 29
31static struct of_device_id sirf_l2x0_ids[] __initconst = { 30static const struct of_device_id sirf_l2x0_ids[] __initconst = {
32 { .compatible = "sirf,prima2-pl310-cache", .data = &prima2_l2x0_aux, }, 31 { .compatible = "sirf,prima2-pl310-cache", .data = &prima2_l2x0_aux, },
33 { .compatible = "sirf,marco-pl310-cache", .data = &marco_l2x0_aux, }, 32 { .compatible = "sirf,marco-pl310-cache", .data = &marco_l2x0_aux, },
34 {}, 33 {},
diff --git a/arch/arm/mach-prima2/platsmp.c b/arch/arm/mach-prima2/platsmp.c
index e358b0736dea..335c12e92262 100644
--- a/arch/arm/mach-prima2/platsmp.c
+++ b/arch/arm/mach-prima2/platsmp.c
@@ -138,9 +138,9 @@ static void __init sirfsoc_smp_prepare_cpus(unsigned int max_cpus)
138} 138}
139 139
140struct smp_operations sirfsoc_smp_ops __initdata = { 140struct smp_operations sirfsoc_smp_ops __initdata = {
141 .smp_prepare_cpus = sirfsoc_smp_prepare_cpus, 141 .smp_prepare_cpus = sirfsoc_smp_prepare_cpus,
142 .smp_secondary_init = sirfsoc_secondary_init, 142 .smp_secondary_init = sirfsoc_secondary_init,
143 .smp_boot_secondary = sirfsoc_boot_secondary, 143 .smp_boot_secondary = sirfsoc_boot_secondary,
144#ifdef CONFIG_HOTPLUG_CPU 144#ifdef CONFIG_HOTPLUG_CPU
145 .cpu_die = sirfsoc_cpu_die, 145 .cpu_die = sirfsoc_cpu_die,
146#endif 146#endif
diff --git a/arch/arm/mach-prima2/rstc.c b/arch/arm/mach-prima2/rstc.c
index ccb53391147a..a59976743332 100644
--- a/arch/arm/mach-prima2/rstc.c
+++ b/arch/arm/mach-prima2/rstc.c
@@ -13,57 +13,36 @@
13#include <linux/device.h> 13#include <linux/device.h>
14#include <linux/of.h> 14#include <linux/of.h>
15#include <linux/of_address.h> 15#include <linux/of_address.h>
16#include <linux/platform_device.h>
16#include <linux/reboot.h> 17#include <linux/reboot.h>
18#include <linux/reset-controller.h>
19
20#define SIRFSOC_RSTBIT_NUM 64
17 21
18void __iomem *sirfsoc_rstc_base; 22void __iomem *sirfsoc_rstc_base;
19static DEFINE_MUTEX(rstc_lock); 23static DEFINE_MUTEX(rstc_lock);
20 24
21static struct of_device_id rstc_ids[] = { 25static int sirfsoc_reset_module(struct reset_controller_dev *rcdev,
22 { .compatible = "sirf,prima2-rstc" }, 26 unsigned long sw_reset_idx)
23 { .compatible = "sirf,marco-rstc" },
24 {},
25};
26
27static int __init sirfsoc_of_rstc_init(void)
28{
29 struct device_node *np;
30
31 np = of_find_matching_node(NULL, rstc_ids);
32 if (!np) {
33 pr_err("unable to find compatible sirf rstc node in dtb\n");
34 return -ENOENT;
35 }
36
37 sirfsoc_rstc_base = of_iomap(np, 0);
38 if (!sirfsoc_rstc_base)
39 panic("unable to map rstc cpu registers\n");
40
41 of_node_put(np);
42
43 return 0;
44}
45early_initcall(sirfsoc_of_rstc_init);
46
47int sirfsoc_reset_device(struct device *dev)
48{ 27{
49 u32 reset_bit; 28 u32 reset_bit = sw_reset_idx;
50 29
51 if (of_property_read_u32(dev->of_node, "reset-bit", &reset_bit)) 30 if (reset_bit >= SIRFSOC_RSTBIT_NUM)
52 return -EINVAL; 31 return -EINVAL;
53 32
54 mutex_lock(&rstc_lock); 33 mutex_lock(&rstc_lock);
55 34
56 if (of_device_is_compatible(dev->of_node, "sirf,prima2-rstc")) { 35 if (of_device_is_compatible(rcdev->of_node, "sirf,prima2-rstc")) {
57 /* 36 /*
58 * Writing 1 to this bit resets corresponding block. Writing 0 to this 37 * Writing 1 to this bit resets corresponding block. Writing 0 to this
59 * bit de-asserts reset signal of the corresponding block. 38 * bit de-asserts reset signal of the corresponding block.
60 * datasheet doesn't require explicit delay between the set and clear 39 * datasheet doesn't require explicit delay between the set and clear
61 * of reset bit. it could be shorter if tests pass. 40 * of reset bit. it could be shorter if tests pass.
62 */ 41 */
63 writel(readl(sirfsoc_rstc_base + (reset_bit / 32) * 4) | reset_bit, 42 writel(readl(sirfsoc_rstc_base + (reset_bit / 32) * 4) | (1 << reset_bit),
64 sirfsoc_rstc_base + (reset_bit / 32) * 4); 43 sirfsoc_rstc_base + (reset_bit / 32) * 4);
65 msleep(10); 44 msleep(10);
66 writel(readl(sirfsoc_rstc_base + (reset_bit / 32) * 4) & ~reset_bit, 45 writel(readl(sirfsoc_rstc_base + (reset_bit / 32) * 4) & ~(1 << reset_bit),
67 sirfsoc_rstc_base + (reset_bit / 32) * 4); 46 sirfsoc_rstc_base + (reset_bit / 32) * 4);
68 } else { 47 } else {
69 /* 48 /*
@@ -73,9 +52,9 @@ int sirfsoc_reset_device(struct device *dev)
73 * datasheet doesn't require explicit delay between the set and clear 52 * datasheet doesn't require explicit delay between the set and clear
74 * of reset bit. it could be shorter if tests pass. 53 * of reset bit. it could be shorter if tests pass.
75 */ 54 */
76 writel(reset_bit, sirfsoc_rstc_base + (reset_bit / 32) * 8); 55 writel(1 << reset_bit, sirfsoc_rstc_base + (reset_bit / 32) * 8);
77 msleep(10); 56 msleep(10);
78 writel(reset_bit, sirfsoc_rstc_base + (reset_bit / 32) * 8 + 4); 57 writel(1 << reset_bit, sirfsoc_rstc_base + (reset_bit / 32) * 8 + 4);
79 } 58 }
80 59
81 mutex_unlock(&rstc_lock); 60 mutex_unlock(&rstc_lock);
@@ -83,6 +62,52 @@ int sirfsoc_reset_device(struct device *dev)
83 return 0; 62 return 0;
84} 63}
85 64
65static struct reset_control_ops sirfsoc_rstc_ops = {
66 .reset = sirfsoc_reset_module,
67};
68
69static struct reset_controller_dev sirfsoc_reset_controller = {
70 .ops = &sirfsoc_rstc_ops,
71 .nr_resets = SIRFSOC_RSTBIT_NUM,
72};
73
74static int sirfsoc_rstc_probe(struct platform_device *pdev)
75{
76 struct device_node *np = pdev->dev.of_node;
77 sirfsoc_rstc_base = of_iomap(np, 0);
78 if (!sirfsoc_rstc_base) {
79 dev_err(&pdev->dev, "unable to map rstc cpu registers\n");
80 return -ENOMEM;
81 }
82
83 sirfsoc_reset_controller.of_node = np;
84
85 reset_controller_register(&sirfsoc_reset_controller);
86
87 return 0;
88}
89
90static const struct of_device_id rstc_ids[] = {
91 { .compatible = "sirf,prima2-rstc" },
92 { .compatible = "sirf,marco-rstc" },
93 {},
94};
95
96static struct platform_driver sirfsoc_rstc_driver = {
97 .probe = sirfsoc_rstc_probe,
98 .driver = {
99 .name = "sirfsoc_rstc",
100 .owner = THIS_MODULE,
101 .of_match_table = rstc_ids,
102 },
103};
104
105static int __init sirfsoc_rstc_init(void)
106{
107 return platform_driver_register(&sirfsoc_rstc_driver);
108}
109subsys_initcall(sirfsoc_rstc_init);
110
86#define SIRFSOC_SYS_RST_BIT BIT(31) 111#define SIRFSOC_SYS_RST_BIT BIT(31)
87 112
88void sirfsoc_restart(enum reboot_mode mode, const char *cmd) 113void sirfsoc_restart(enum reboot_mode mode, const char *cmd)
diff --git a/arch/arm/mach-prima2/rtciobrg.c b/arch/arm/mach-prima2/rtciobrg.c
index 9f2da2eec4dc..a17c88b74fa1 100644
--- a/arch/arm/mach-prima2/rtciobrg.c
+++ b/arch/arm/mach-prima2/rtciobrg.c
@@ -137,4 +137,4 @@ postcore_initcall(sirfsoc_rtciobrg_init);
137MODULE_AUTHOR("Zhiwu Song <zhiwu.song@csr.com>, " 137MODULE_AUTHOR("Zhiwu Song <zhiwu.song@csr.com>, "
138 "Barry Song <baohua.song@csr.com>"); 138 "Barry Song <baohua.song@csr.com>");
139MODULE_DESCRIPTION("CSR SiRFprimaII rtc io bridge"); 139MODULE_DESCRIPTION("CSR SiRFprimaII rtc io bridge");
140MODULE_LICENSE("GPL"); 140MODULE_LICENSE("GPL v2");