aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/watchdog
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2014-11-27 05:47:10 -0500
committerThomas Gleixner <tglx@linutronix.de>2014-11-27 05:47:38 -0500
commit89de77a8c557f14d2713a1f43fbc33980e639b98 (patch)
tree3d7f32120b6b155e3d1374b277a6333cdb9c31cc /drivers/watchdog
parentcb2aa63469f81426c7406227be70b628b42f7a05 (diff)
parent4a22d9c93af1f2b2c40354c4bc59fd007f33f05e (diff)
Merge branch 'clockevents/3.19' of http://git.linaro.org/people/daniel.lezcano/linux into timers/core
Daniel Lezcano muttered: * Marvell timer updates from Ezequiel Garcia - Add missing clock enable calls for armada - Change source clock for clocksource and watchdog * SIRF timer updates from Yanchang Li - Make clock rate configurable
Diffstat (limited to 'drivers/watchdog')
-rw-r--r--drivers/watchdog/orion_wdt.c42
1 files changed, 41 insertions, 1 deletions
diff --git a/drivers/watchdog/orion_wdt.c b/drivers/watchdog/orion_wdt.c
index 00d0741228fc..8cb1ff3bcd90 100644
--- a/drivers/watchdog/orion_wdt.c
+++ b/drivers/watchdog/orion_wdt.c
@@ -114,6 +114,46 @@ static int armada370_wdt_clock_init(struct platform_device *pdev,
114 return 0; 114 return 0;
115} 115}
116 116
117static int armada375_wdt_clock_init(struct platform_device *pdev,
118 struct orion_watchdog *dev)
119{
120 int ret;
121
122 dev->clk = of_clk_get_by_name(pdev->dev.of_node, "fixed");
123 if (!IS_ERR(dev->clk)) {
124 ret = clk_prepare_enable(dev->clk);
125 if (ret) {
126 clk_put(dev->clk);
127 return ret;
128 }
129
130 atomic_io_modify(dev->reg + TIMER_CTRL,
131 WDT_AXP_FIXED_ENABLE_BIT,
132 WDT_AXP_FIXED_ENABLE_BIT);
133 dev->clk_rate = clk_get_rate(dev->clk);
134
135 return 0;
136 }
137
138 /* Mandatory fallback for proper devicetree backward compatibility */
139 dev->clk = clk_get(&pdev->dev, NULL);
140 if (IS_ERR(dev->clk))
141 return PTR_ERR(dev->clk);
142
143 ret = clk_prepare_enable(dev->clk);
144 if (ret) {
145 clk_put(dev->clk);
146 return ret;
147 }
148
149 atomic_io_modify(dev->reg + TIMER_CTRL,
150 WDT_A370_RATIO_MASK(WDT_A370_RATIO_SHIFT),
151 WDT_A370_RATIO_MASK(WDT_A370_RATIO_SHIFT));
152 dev->clk_rate = clk_get_rate(dev->clk) / WDT_A370_RATIO;
153
154 return 0;
155}
156
117static int armadaxp_wdt_clock_init(struct platform_device *pdev, 157static int armadaxp_wdt_clock_init(struct platform_device *pdev,
118 struct orion_watchdog *dev) 158 struct orion_watchdog *dev)
119{ 159{
@@ -394,7 +434,7 @@ static const struct orion_watchdog_data armada375_data = {
394 .rstout_mask_bit = BIT(10), 434 .rstout_mask_bit = BIT(10),
395 .wdt_enable_bit = BIT(8), 435 .wdt_enable_bit = BIT(8),
396 .wdt_counter_offset = 0x34, 436 .wdt_counter_offset = 0x34,
397 .clock_init = armada370_wdt_clock_init, 437 .clock_init = armada375_wdt_clock_init,
398 .enabled = armada375_enabled, 438 .enabled = armada375_enabled,
399 .start = armada375_start, 439 .start = armada375_start,
400 .stop = armada375_stop, 440 .stop = armada375_stop,