Skip to content

Commit 000de54

Browse files
AnsuelWim Van Sebroeck
authored andcommitted
watchdog: qcom-wdt: disable pretimeout on timer platform
Some platform like ipq806x doesn't support pretimeout and define some interrupts used by qcom,msm-timer. Change the driver to check and use pretimeout only on qcom,kpss-wdt as it's the only platform that actually supports it. Signed-off-by: Ansuel Smith <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Link: https://lore.kernel.org/r/[email protected] [groeck: Conflict resolution] Signed-off-by: Guenter Roeck <[email protected]> Signed-off-by: Wim Van Sebroeck <[email protected]>
1 parent fb33c65 commit 000de54

File tree

1 file changed

+23
-8
lines changed

1 file changed

+23
-8
lines changed

drivers/watchdog/qcom-wdt.c

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ static const u32 reg_offset_data_kpss[] = {
4040
[WDT_BITE_TIME] = 0x14,
4141
};
4242

43+
struct qcom_wdt_match_data {
44+
const u32 *offset;
45+
bool pretimeout;
46+
};
47+
4348
struct qcom_wdt {
4449
struct watchdog_device wdd;
4550
unsigned long rate;
@@ -179,19 +184,29 @@ static void qcom_clk_disable_unprepare(void *data)
179184
clk_disable_unprepare(data);
180185
}
181186

187+
static const struct qcom_wdt_match_data match_data_apcs_tmr = {
188+
.offset = reg_offset_data_apcs_tmr,
189+
.pretimeout = false,
190+
};
191+
192+
static const struct qcom_wdt_match_data match_data_kpss = {
193+
.offset = reg_offset_data_kpss,
194+
.pretimeout = true,
195+
};
196+
182197
static int qcom_wdt_probe(struct platform_device *pdev)
183198
{
184199
struct device *dev = &pdev->dev;
185200
struct qcom_wdt *wdt;
186201
struct resource *res;
187202
struct device_node *np = dev->of_node;
188-
const u32 *regs;
203+
const struct qcom_wdt_match_data *data;
189204
u32 percpu_offset;
190205
int irq, ret;
191206
struct clk *clk;
192207

193-
regs = of_device_get_match_data(dev);
194-
if (!regs) {
208+
data = of_device_get_match_data(dev);
209+
if (!data) {
195210
dev_err(dev, "Unsupported QCOM WDT module\n");
196211
return -ENODEV;
197212
}
@@ -247,7 +262,7 @@ static int qcom_wdt_probe(struct platform_device *pdev)
247262

248263
/* check if there is pretimeout support */
249264
irq = platform_get_irq_optional(pdev, 0);
250-
if (irq > 0) {
265+
if (data->pretimeout && irq > 0) {
251266
ret = devm_request_irq(dev, irq, qcom_wdt_isr,
252267
IRQF_TRIGGER_RISING,
253268
"wdt_bark", &wdt->wdd);
@@ -267,7 +282,7 @@ static int qcom_wdt_probe(struct platform_device *pdev)
267282
wdt->wdd.min_timeout = 1;
268283
wdt->wdd.max_timeout = 0x10000000U / wdt->rate;
269284
wdt->wdd.parent = dev;
270-
wdt->layout = regs;
285+
wdt->layout = data->offset;
271286

272287
if (readl(wdt_addr(wdt, WDT_STS)) & 1)
273288
wdt->wdd.bootstatus = WDIOF_CARDRESET;
@@ -311,9 +326,9 @@ static int __maybe_unused qcom_wdt_resume(struct device *dev)
311326
static SIMPLE_DEV_PM_OPS(qcom_wdt_pm_ops, qcom_wdt_suspend, qcom_wdt_resume);
312327

313328
static const struct of_device_id qcom_wdt_of_table[] = {
314-
{ .compatible = "qcom,kpss-timer", .data = reg_offset_data_apcs_tmr },
315-
{ .compatible = "qcom,scss-timer", .data = reg_offset_data_apcs_tmr },
316-
{ .compatible = "qcom,kpss-wdt", .data = reg_offset_data_kpss },
329+
{ .compatible = "qcom,kpss-timer", .data = &match_data_apcs_tmr },
330+
{ .compatible = "qcom,scss-timer", .data = &match_data_apcs_tmr },
331+
{ .compatible = "qcom,kpss-wdt", .data = &match_data_kpss },
317332
{ },
318333
};
319334
MODULE_DEVICE_TABLE(of, qcom_wdt_of_table);

0 commit comments

Comments
 (0)