diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2013-03-26 02:18:15 -0400 |
---|---|---|
committer | Simon Horman <horms+renesas@verge.net.au> | 2013-04-01 21:58:25 -0400 |
commit | c91cf2fad00f24bfe268d30b75e4015aaa326c04 (patch) | |
tree | d6280345b468c4e0dc314989c693a4844e415263 /arch | |
parent | 6722f6cb763203cab775297b6e9d00834af0d6d7 (diff) |
ARM: shmobile: r8a73a4: add thermal driver support
You can get current thermal by
> cat /sys/class/thermal/thermal_zone?/temp
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Acked-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/boot/dts/r8a73a4.dtsi | 7 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/clock-r8a73a4.c | 13 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/setup-r8a73a4.c | 15 |
3 files changed, 34 insertions, 1 deletions
diff --git a/arch/arm/boot/dts/r8a73a4.dtsi b/arch/arm/boot/dts/r8a73a4.dtsi index 4c68ba15727c..7db5b504e64c 100644 --- a/arch/arm/boot/dts/r8a73a4.dtsi +++ b/arch/arm/boot/dts/r8a73a4.dtsi | |||
@@ -84,4 +84,11 @@ | |||
84 | <0 56 4>, <0 57 4>; | 84 | <0 56 4>, <0 57 4>; |
85 | }; | 85 | }; |
86 | 86 | ||
87 | thermal@e61f0000 { | ||
88 | compatible = "renesas,rcar-thermal"; | ||
89 | reg = <0xe61f0000 0x14>, <0xe61f0100 0x38>, | ||
90 | <0xe61f0200 0x38>, <0xe61f0300 0x38>; | ||
91 | interrupt-parent = <&gic>; | ||
92 | interrupts = <0 69 4>; | ||
93 | }; | ||
87 | }; | 94 | }; |
diff --git a/arch/arm/mach-shmobile/clock-r8a73a4.c b/arch/arm/mach-shmobile/clock-r8a73a4.c index 037713bdff3f..e710c00c3822 100644 --- a/arch/arm/mach-shmobile/clock-r8a73a4.c +++ b/arch/arm/mach-shmobile/clock-r8a73a4.c | |||
@@ -29,6 +29,7 @@ | |||
29 | 29 | ||
30 | #define MPCKCR 0xe6150080 | 30 | #define MPCKCR 0xe6150080 |
31 | #define SMSTPCR2 0xe6150138 | 31 | #define SMSTPCR2 0xe6150138 |
32 | #define SMSTPCR5 0xe6150144 | ||
32 | 33 | ||
33 | static struct clk_mapping cpg_mapping = { | 34 | static struct clk_mapping cpg_mapping = { |
34 | .phys = CPG_BASE, | 35 | .phys = CPG_BASE, |
@@ -56,7 +57,12 @@ static struct clk *main_clks[] = { | |||
56 | &extal2_clk, | 57 | &extal2_clk, |
57 | }; | 58 | }; |
58 | 59 | ||
59 | enum { MSTP217, MSTP216, MSTP207, MSTP206, MSTP204, MSTP203, MSTP_NR }; | 60 | enum { |
61 | MSTP217, MSTP216, MSTP207, MSTP206, MSTP204, MSTP203, | ||
62 | MSTP522, | ||
63 | MSTP_NR | ||
64 | }; | ||
65 | |||
60 | static struct clk mstp_clks[MSTP_NR] = { | 66 | static struct clk mstp_clks[MSTP_NR] = { |
61 | [MSTP204] = SH_CLK_MSTP32(&extal2_clk, SMSTPCR2, 4, 0), /* SCIFA0 */ | 67 | [MSTP204] = SH_CLK_MSTP32(&extal2_clk, SMSTPCR2, 4, 0), /* SCIFA0 */ |
62 | [MSTP203] = SH_CLK_MSTP32(&extal2_clk, SMSTPCR2, 3, 0), /* SCIFA1 */ | 68 | [MSTP203] = SH_CLK_MSTP32(&extal2_clk, SMSTPCR2, 3, 0), /* SCIFA1 */ |
@@ -64,6 +70,7 @@ static struct clk mstp_clks[MSTP_NR] = { | |||
64 | [MSTP207] = SH_CLK_MSTP32(&extal2_clk, SMSTPCR2, 7, 0), /* SCIFB1 */ | 70 | [MSTP207] = SH_CLK_MSTP32(&extal2_clk, SMSTPCR2, 7, 0), /* SCIFB1 */ |
65 | [MSTP216] = SH_CLK_MSTP32(&extal2_clk, SMSTPCR2, 16, 0), /* SCIFB2 */ | 71 | [MSTP216] = SH_CLK_MSTP32(&extal2_clk, SMSTPCR2, 16, 0), /* SCIFB2 */ |
66 | [MSTP217] = SH_CLK_MSTP32(&extal2_clk, SMSTPCR2, 17, 0), /* SCIFB3 */ | 72 | [MSTP217] = SH_CLK_MSTP32(&extal2_clk, SMSTPCR2, 17, 0), /* SCIFB3 */ |
73 | [MSTP522] = SH_CLK_MSTP32(&extal2_clk, SMSTPCR5, 22, 0), /* Thermal */ | ||
67 | }; | 74 | }; |
68 | 75 | ||
69 | static struct clk_lookup lookups[] = { | 76 | static struct clk_lookup lookups[] = { |
@@ -73,6 +80,10 @@ static struct clk_lookup lookups[] = { | |||
73 | CLKDEV_DEV_ID("sh-sci.3", &mstp_clks[MSTP207]), | 80 | CLKDEV_DEV_ID("sh-sci.3", &mstp_clks[MSTP207]), |
74 | CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP216]), | 81 | CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP216]), |
75 | CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP217]), | 82 | CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP217]), |
83 | CLKDEV_DEV_ID("rcar_thermal", &mstp_clks[MSTP522]), | ||
84 | |||
85 | /* for DT */ | ||
86 | CLKDEV_DEV_ID("e61f0000.thermal", &mstp_clks[MSTP522]), | ||
76 | }; | 87 | }; |
77 | 88 | ||
78 | void __init r8a73a4_clock_init(void) | 89 | void __init r8a73a4_clock_init(void) |
diff --git a/arch/arm/mach-shmobile/setup-r8a73a4.c b/arch/arm/mach-shmobile/setup-r8a73a4.c index c2d86f30cde4..c5a75a7a508f 100644 --- a/arch/arm/mach-shmobile/setup-r8a73a4.c +++ b/arch/arm/mach-shmobile/setup-r8a73a4.c | |||
@@ -155,6 +155,20 @@ static const struct resource irqc1_resources[] = { | |||
155 | &irqc##idx##_data, \ | 155 | &irqc##idx##_data, \ |
156 | sizeof(struct renesas_irqc_config)) | 156 | sizeof(struct renesas_irqc_config)) |
157 | 157 | ||
158 | /* Thermal0 -> Thermal2 */ | ||
159 | static const struct resource thermal0_resources[] = { | ||
160 | DEFINE_RES_MEM(0xe61f0000, 0x14), | ||
161 | DEFINE_RES_MEM(0xe61f0100, 0x38), | ||
162 | DEFINE_RES_MEM(0xe61f0200, 0x38), | ||
163 | DEFINE_RES_MEM(0xe61f0300, 0x38), | ||
164 | DEFINE_RES_IRQ(gic_spi(69)), | ||
165 | }; | ||
166 | |||
167 | #define r8a73a4_register_thermal() \ | ||
168 | platform_device_register_simple("rcar_thermal", -1, \ | ||
169 | thermal0_resources, \ | ||
170 | ARRAY_SIZE(thermal0_resources)) | ||
171 | |||
158 | void __init r8a73a4_add_standard_devices(void) | 172 | void __init r8a73a4_add_standard_devices(void) |
159 | { | 173 | { |
160 | r8a73a4_register_scif(SCIFA0); | 174 | r8a73a4_register_scif(SCIFA0); |
@@ -165,6 +179,7 @@ void __init r8a73a4_add_standard_devices(void) | |||
165 | r8a73a4_register_scif(SCIFB3); | 179 | r8a73a4_register_scif(SCIFB3); |
166 | r8a73a4_register_irqc(0); | 180 | r8a73a4_register_irqc(0); |
167 | r8a73a4_register_irqc(1); | 181 | r8a73a4_register_irqc(1); |
182 | r8a73a4_register_thermal(); | ||
168 | } | 183 | } |
169 | 184 | ||
170 | #ifdef CONFIG_USE_OF | 185 | #ifdef CONFIG_USE_OF |