| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * sp5100_tco : TCO timer driver for sp5100 chipsets |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 6 | 7 | * Based on i8xx_tco.c: |
|---|
| 7 | 8 | * (c) Copyright 2000 kernel concepts <nils@kernelconcepts.de>, All Rights |
|---|
| 8 | 9 | * Reserved. |
|---|
| 9 | | - * http://www.kernelconcepts.de |
|---|
| 10 | | - * |
|---|
| 11 | | - * This program is free software; you can redistribute it and/or |
|---|
| 12 | | - * modify it under the terms of the GNU General Public License |
|---|
| 13 | | - * as published by the Free Software Foundation; either version |
|---|
| 14 | | - * 2 of the License, or (at your option) any later version. |
|---|
| 10 | + * https://www.kernelconcepts.de |
|---|
| 15 | 11 | * |
|---|
| 16 | 12 | * See AMD Publication 43009 "AMD SB700/710/750 Register Reference Guide", |
|---|
| 17 | 13 | * AMD Publication 45482 "AMD SB800-Series Southbridges Register |
|---|
| .. | .. |
|---|
| 21 | 17 | * AMD Publication 51192 "AMD Bolton FCH Register Reference Guide" |
|---|
| 22 | 18 | * AMD Publication 52740 "BIOS and Kernel Developer’s Guide (BKDG) |
|---|
| 23 | 19 | * for AMD Family 16h Models 30h-3Fh Processors" |
|---|
| 20 | + * AMD Publication 55570-B1-PUB "Processor Programming Reference (PPR) |
|---|
| 21 | + * for AMD Family 17h Model 18h, Revision B1 |
|---|
| 22 | + * Processors (PUB) |
|---|
| 23 | + * AMD Publication 55772-A1-PUB "Processor Programming Reference (PPR) |
|---|
| 24 | + * for AMD Family 17h Model 20h, Revision A1 |
|---|
| 25 | + * Processors (PUB) |
|---|
| 24 | 26 | */ |
|---|
| 25 | 27 | |
|---|
| 26 | 28 | /* |
|---|
| .. | .. |
|---|
| 100 | 102 | |
|---|
| 101 | 103 | val = readl(SP5100_WDT_CONTROL(tco->tcobase)); |
|---|
| 102 | 104 | val |= SP5100_WDT_START_STOP_BIT; |
|---|
| 105 | + writel(val, SP5100_WDT_CONTROL(tco->tcobase)); |
|---|
| 106 | + |
|---|
| 107 | + /* This must be a distinct write. */ |
|---|
| 108 | + val |= SP5100_WDT_TRIGGER_BIT; |
|---|
| 103 | 109 | writel(val, SP5100_WDT_CONTROL(tco->tcobase)); |
|---|
| 104 | 110 | |
|---|
| 105 | 111 | return 0; |
|---|
| .. | .. |
|---|
| 245 | 251 | break; |
|---|
| 246 | 252 | case efch: |
|---|
| 247 | 253 | dev_name = SB800_DEVNAME; |
|---|
| 254 | + /* |
|---|
| 255 | + * On Family 17h devices, the EFCH_PM_DECODEEN_WDT_TMREN bit of |
|---|
| 256 | + * EFCH_PM_DECODEEN not only enables the EFCH_PM_WDT_ADDR memory |
|---|
| 257 | + * region, it also enables the watchdog itself. |
|---|
| 258 | + */ |
|---|
| 259 | + if (boot_cpu_data.x86 == 0x17) { |
|---|
| 260 | + val = sp5100_tco_read_pm_reg8(EFCH_PM_DECODEEN); |
|---|
| 261 | + if (!(val & EFCH_PM_DECODEEN_WDT_TMREN)) { |
|---|
| 262 | + sp5100_tco_update_pm_reg8(EFCH_PM_DECODEEN, 0xff, |
|---|
| 263 | + EFCH_PM_DECODEEN_WDT_TMREN); |
|---|
| 264 | + } |
|---|
| 265 | + } |
|---|
| 248 | 266 | val = sp5100_tco_read_pm_reg8(EFCH_PM_DECODEEN); |
|---|
| 249 | 267 | if (val & EFCH_PM_DECODEEN_WDT_TMREN) |
|---|
| 250 | 268 | mmio_addr = EFCH_PM_WDT_ADDR; |
|---|
| .. | .. |
|---|
| 395 | 413 | wdd->min_timeout = 1; |
|---|
| 396 | 414 | wdd->max_timeout = 0xffff; |
|---|
| 397 | 415 | |
|---|
| 398 | | - if (watchdog_init_timeout(wdd, heartbeat, NULL)) |
|---|
| 399 | | - dev_info(dev, "timeout value invalid, using %d\n", |
|---|
| 400 | | - wdd->timeout); |
|---|
| 416 | + watchdog_init_timeout(wdd, heartbeat, NULL); |
|---|
| 401 | 417 | watchdog_set_nowayout(wdd, nowayout); |
|---|
| 402 | 418 | watchdog_stop_on_reboot(wdd); |
|---|
| 403 | 419 | watchdog_stop_on_unregister(wdd); |
|---|
| .. | .. |
|---|
| 408 | 424 | return ret; |
|---|
| 409 | 425 | |
|---|
| 410 | 426 | ret = devm_watchdog_register_device(dev, wdd); |
|---|
| 411 | | - if (ret) { |
|---|
| 412 | | - dev_err(dev, "cannot register watchdog device (err=%d)\n", ret); |
|---|
| 427 | + if (ret) |
|---|
| 413 | 428 | return ret; |
|---|
| 414 | | - } |
|---|
| 415 | 429 | |
|---|
| 416 | 430 | /* Show module parameters */ |
|---|
| 417 | 431 | dev_info(dev, "initialized. heartbeat=%d sec (nowayout=%d)\n", |
|---|