linux/drivers/watchdog
Takahisa Tanaka 740fbddf5c watchdog: sp5100_tco: Add SB8x0 chipset support
The current sp5100_tco driver only supports SP5100/SB7x0 chipset, doesn't
support SB8x0 chipset, because current sp5100_tco driver doesn't know that the
offset address for watchdog timer was changed from SB8x0 chipset.

The offset address of SP5100 and SB7x0 chipsets are as follows, quote from the
AMD SB700/710/750 Register Reference Guide (Page 164) and the AMD SP5100
Register Reference Guide (Page 166).

  WatchDogTimerControl 69h
  WatchDogTimerBase0   6Ch
  WatchDogTimerBase1   6Dh
  WatchDogTimerBase2   6Eh
  WatchDogTimerBase3   6Fh

In contrast, the offset address of SB8x0 chipset is as follows, quote from
AMD SB800-Series Southbridges Register Reference Guide (Page 147).

  WatchDogTimerEn      48h
  WatchDogTimerConfig  4Ch

So, In the case of SB8x0 chipset, sp5100_tco reads meaningless MMIO
address (for example, 0xbafe00) from wrong offset address, and the following
message is logged.

   SP5100 TCO timer: mmio address 0xbafe00 already in use

With this patch, sp5100_tco driver supports SB8x0 chipset, and can avoid
iomem resource conflict. The processing of this patch is as follows.

 Step 1) Attempt to get the watchdog base address from indirect I/O (0xCD6
         and 0xCD7).
  - Go to the step 7 if obtained address hasn't conflicted with other
    resource. But, currently, the address (0xfec000f0) conflicts with the
    IOAPIC MMIO address, and the following message is logged.

       SP5100 TCO timer: mmio address 0xfec000f0 already in use

    0xfec000f0 is recommended by AMD BIOS Developer's Guide. So, go to the
    next step.

 Step 2) Attempt to get the SBResource_MMIO base address from AcpiMmioEN (for
         SB8x0,  PM_Reg:24h) or SBResource_MMIO (SP5100/SB7x0, PCI_Reg:9Ch)
         register.
  - Go to the step 7 if these register has enabled by BIOS, and obtained
    address hasn't conflicted with other resource.
  - If above condition isn't true, go to the next step.

 Step 3) Attempt to get the free MMIO address from allocate_resource().
  - Go to the step 7 if these register has enabled by BIOS, and obtained
    address hasn't conflicted with other resource.
  - Driver initialization has failed if obtained address has conflicted
    with other resource, and no 'force_addr' parameter is specified.

 Step 4) Use the specified address If 'force_addr' parameter is specified.
  - allocate_resource() function may fail, when the PCI bridge device occupies
    iomem resource from 0xf0000000 to 0xffffffff. To handle such a case,
    I added 'force_addr' parameter to sp5100_tco driver. With 'force_addr'
    parameter, sp5100_tco driver directly can assign MMIO address for watchdog
    timer from free iomem region. Note that It's dangerous to specify wrong
    address in the 'force_addr' parameter.

      Example of force_addr parameter use
        # cat /proc/iomem
        ...snip...
        fec00000-fec003ff : IOAPIC 0
                                      <--- free MMIO region
        fec10000-fec1001f : pnp 00:0b
        fec20000-fec203ff : IOAPIC 1
        ...snip...
        # cat /etc/modprobe.d/sp5100_tco.conf
        options sp5100_tco force_addr=0xfec00800
        # modprobe sp5100_tco
        # cat /proc/iomem
        ...snip...
        fec00000-fec003ff : IOAPIC 0
        fec00800-fec00807 : SP5100 TCO  <--- watchdog timer MMIO address
        fec10000-fec1001f : pnp 00:0b
        fec20000-fec203ff : IOAPIC 1
        ...snip...
        #

  - Driver initialization has failed if specified address has conflicted
    with other resource.

 Step 5) Disable the watchdog timer
  - To rewrite the watchdog timer register of the chipset, absolutely
    guarantee that the watchdog timer is disabled.

 Step 6) Re-program the watchdog timer MMIO address to chipset.
  - Re-program the obtained MMIO address in Step 3 or Step 4 to chipset via
    indirect I/O (0xCD6 and 0xCD7).

 Step 7) Enable and setup the watchdog timer

This patch has worked fine on my test environment (ASUS M4A89GTD-PRO/USB3 and
DL165G7). therefore I believe that it's no problem to re-program the MMIO
address for watchdog timer to chipset during disabled watchdog. However,
I'm not sure about it, because I don't know much about chipset programming.

So, any comments will be welcome.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=43176
Tested-by: Arkadiusz Miskiewicz <arekm@maven.pl>
Tested-by: Paul Menzel <paulepanter@users.sourceforge.net>
Signed-off-by: Takahisa Tanaka <mc74hc00@gmail.com>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
2012-12-19 22:25:09 +01:00
..
acquirewdt.c watchdog: remove use of __devexit 2012-11-28 12:00:24 -08:00
advantechwdt.c watchdog: remove use of __devexit 2012-11-28 12:00:24 -08:00
alim1535_wdt.c watchdog: nowayout is bool 2012-03-27 20:06:02 +02:00
alim7101_wdt.c Disintegrate and delete asm/system.h 2012-03-28 15:58:21 -07:00
ar7_wdt.c watchdog: remove use of __devexit 2012-11-28 12:00:24 -08:00
at32ap700x_wdt.c watchdog: nowayout is bool 2012-03-27 20:06:02 +02:00
at91rm9200_wdt.c watchdog: remove use of __devexit 2012-11-28 12:00:24 -08:00
at91sam9_wdt.c watchdog: at91sam9_wdt: add device tree support 2012-11-16 15:48:30 +01:00
at91sam9_wdt.h ARM: at91: make watchdog drivers soc independent 2011-11-28 22:50:39 +08:00
ath79_wdt.c watchdog: ath79_wdt: convert to use module_platform_driver 2012-12-19 22:24:38 +01:00
bcm47xx_wdt.c watchdog: nowayout is bool 2012-03-27 20:06:02 +02:00
bcm63xx_wdt.c watchdog: remove use of __devexit 2012-11-28 12:00:24 -08:00
bfin_wdt.c watchdog: remove use of __devexit 2012-11-28 12:00:24 -08:00
booke_wdt.c Fix misspellings of "whether" in comments. 2012-11-19 14:31:35 +01:00
coh901327_wdt.c watchdog: coh901327_wdt: use clk_prepare/unprepare 2012-07-23 12:46:49 +02:00
cpu5wdt.c watchdog: cpu5wdt.c: add missing del_timer call 2012-12-19 22:24:41 +01:00
cpwd.c watchdog: remove use of __devexit 2012-11-28 12:00:24 -08:00
da9052_wdt.c watchdog: da9052: Fix invalid free of devm_ allocated data 2012-12-19 22:25:07 +01:00
da9055_wdt.c watchdog: DA9055 Watchdog driver 2012-12-19 22:24:58 +01:00
davinci_wdt.c watchdog: davinci_wdt: add OF support 2012-12-19 22:25:08 +01:00
dw_wdt.c watchdog: remove use of __devexit 2012-11-28 12:00:24 -08:00
ep93xx_wdt.c watchdog: remove use of __devexit 2012-11-28 12:00:24 -08:00
eurotechwdt.c Disintegrate and delete asm/system.h 2012-03-28 15:58:21 -07:00
f71808e_wdt.c watchdog: f71808e_wdt: Add support for Jetway JNF99 motherboard 2012-07-23 12:46:38 +02:00
gef_wdt.c watchdog: remove use of __devexit 2012-11-28 12:00:24 -08:00
geodewdt.c watchdog: remove use of __devexit 2012-11-28 12:00:24 -08:00
hpwdt.c watchdog: hpwdt.c: Increase version string 2012-12-19 22:24:40 +01:00
i6300esb.c watchdog: remove use of __devexit 2012-11-28 12:00:24 -08:00
ib700wdt.c watchdog: remove use of __devexit 2012-11-28 12:00:24 -08:00
ibmasr.c watchdog: nowayout is bool 2012-03-27 20:06:02 +02:00
ie6xx_wdt.c watchdog: remove use of __devexit 2012-11-28 12:00:24 -08:00
imx2_wdt.c watchdog: imx2_wdt: remove unneeded mach/hardware.h inclusion 2012-10-15 10:03:14 +08:00
indydog.c watchdog: nowayout is bool 2012-03-27 20:06:02 +02:00
intel_scu_watchdog.c watchdog: Use pr_<fmt> and pr_<level> 2012-03-27 19:59:26 +02:00
intel_scu_watchdog.h watchdog: Use pr_<fmt> and pr_<level> 2012-03-27 19:59:26 +02:00
iop_wdt.c watchdog: nowayout is bool 2012-03-27 20:06:02 +02:00
it87_wdt.c watchdog: it87_wdt: Add support for IT8728F watchdog. 2012-05-23 16:24:43 +02:00
it8712f_wdt.c watchdog: nowayout is bool 2012-03-27 20:06:02 +02:00
iTCO_vendor_support.c watchdog: Convert iTCO_wdt driver to mfd model 2012-05-09 17:20:09 +02:00
iTCO_vendor.h watchdog: Convert iTCO_wdt driver to mfd model 2012-05-09 17:20:09 +02:00
iTCO_wdt.c watchdog: remove use of __devexit 2012-11-28 12:00:24 -08:00
ixp4xx_wdt.c watchdog: nowayout is bool 2012-03-27 20:06:02 +02:00
jz4740_wdt.c watchdog: remove use of __devexit 2012-11-28 12:00:24 -08:00
Kconfig watchdog: remove depends on CONFIG_EXPERIMENTAL 2012-12-19 22:25:06 +01:00
ks8695_wdt.c watchdog: remove use of __devexit 2012-11-28 12:00:24 -08:00
lantiq_wdt.c watchdog: remove use of __devexit 2012-11-28 12:00:24 -08:00
m54xx_wdt.c m68knommu: clean up ColdFire 54xx General Timer definitions 2012-09-27 23:34:03 +10:00
machzwd.c Disintegrate and delete asm/system.h 2012-03-28 15:58:21 -07:00
Makefile watchdog: DA9055 Watchdog driver 2012-12-19 22:24:58 +01:00
max63xx_wdt.c watchdog: remove use of __devexit 2012-11-28 12:00:24 -08:00
mixcomwd.c watchdog: remove use of __devinitdata 2012-11-28 12:00:24 -08:00
mpc8xxx_wdt.c watchdog: remove use of __devexit 2012-11-28 12:00:24 -08:00
mpcore_wdt.c watchdog: Convert dev_printk(KERN_<LEVEL> to dev_<level>( 2012-12-19 22:25:06 +01:00
mtx-1_wdt.c watchdog: remove use of __devexit 2012-11-28 12:00:24 -08:00
mv64x60_wdt.c watchdog: remove use of __devexit 2012-11-28 12:00:24 -08:00
nuc900_wdt.c watchdog: remove use of __devexit 2012-11-28 12:00:24 -08:00
nv_tco.c watchdog: remove use of __devexit 2012-11-28 12:00:24 -08:00
nv_tco.h watchdog: Add TCO support for nVidia chipsets 2011-01-12 13:51:23 +00:00
octeon-wdt-main.c watchdog: nowayout is bool 2012-03-27 20:06:02 +02:00
octeon-wdt-nmi.S WATCHDOG: Add watchdog driver for OCTEON SOCs 2010-08-05 13:26:22 +01:00
of_xilinx_wdt.c watchdog: remove use of __devexit 2012-11-28 12:00:24 -08:00
omap_wdt.c watchdog: omap_wdt: eliminate goto 2012-12-19 22:24:57 +01:00
omap_wdt.h watchdog: cleanup spaces before tabs 2011-03-15 16:02:27 +00:00
orion_wdt.c watchdog: remove use of __devexit 2012-11-28 12:00:24 -08:00
pc87413_wdt.c Disintegrate and delete asm/system.h 2012-03-28 15:58:21 -07:00
pcwd_pci.c watchdog: remove use of __devexit 2012-11-28 12:00:24 -08:00
pcwd_usb.c watchdog: nowayout is bool 2012-03-27 20:06:02 +02:00
pcwd.c watchdog: remove use of __devexit 2012-11-28 12:00:24 -08:00
pika_wdt.c watchdog: nowayout is bool 2012-03-27 20:06:02 +02:00
pnx833x_wdt.c watchdog: nowayout is bool 2012-03-27 20:06:02 +02:00
pnx4008_wdt.c watchdog: remove use of __devexit 2012-11-28 12:00:24 -08:00
rc32434_wdt.c watchdog: remove use of __devexit 2012-11-28 12:00:24 -08:00
rdc321x_wdt.c watchdog: remove use of __devexit 2012-11-28 12:00:24 -08:00
riowd.c watchdog: remove use of __devexit 2012-11-28 12:00:24 -08:00
s3c2410_wdt.c watchdog: s3c2410_wdt: use clk_prepare_enable and clk_disable_unprepare 2012-12-19 22:24:43 +01:00
sa1100_wdt.c ARM: sa11x0/pxa: convert OS timer registers to IOMEM 2012-07-09 17:37:35 +01:00
sb_wdog.c watchdog: Use pr_<fmt> and pr_<level> 2012-03-27 19:59:26 +02:00
sbc60xxwdt.c Disintegrate and delete asm/system.h 2012-03-28 15:58:21 -07:00
sbc7240_wdt.c Disintegrate and delete asm/system.h 2012-03-28 15:58:21 -07:00
sbc8360.c Disintegrate and delete asm/system.h 2012-03-28 15:58:21 -07:00
sbc_epx_c3.c watchdog: nowayout is bool 2012-03-27 20:06:02 +02:00
sbc_fitpc2_wdt.c Disintegrate and delete asm/system.h 2012-03-28 15:58:21 -07:00
sc520_wdt.c Disintegrate and delete asm/system.h 2012-03-28 15:58:21 -07:00
sc1200wdt.c watchdog: nowayout is bool 2012-03-27 20:06:02 +02:00
sch311x_wdt.c watchdog: remove use of __devexit 2012-11-28 12:00:24 -08:00
scx200_wdt.c watchdog: nowayout is bool 2012-03-27 20:06:02 +02:00
shwdt.c watchdog: remove use of __devexit 2012-11-28 12:00:24 -08:00
smsc37b787_wdt.c Disintegrate and delete asm/system.h 2012-03-28 15:58:21 -07:00
softdog.c watchdog: softdog: convert to watchdog core 2012-03-27 20:07:21 +02:00
sp805_wdt.c watchdog: sp805_wdt.c: use clk_prepare_enable and clk_disable_unprepare 2012-12-19 22:24:38 +01:00
sp5100_tco.c watchdog: sp5100_tco: Add SB8x0 chipset support 2012-12-19 22:25:09 +01:00
sp5100_tco.h watchdog: sp5100_tco: Add SB8x0 chipset support 2012-12-19 22:25:09 +01:00
stmp3xxx_wdt.c watchdog: remove use of __devexit 2012-11-28 12:00:24 -08:00
ts72xx_wdt.c watchdog: remove use of __devexit 2012-11-28 12:00:24 -08:00
twl4030_wdt.c watchdog: twl4030_wdt: Change TWL4030_MODULE_PM_RECEIVER to TWL_MODULE_PM_RECEIVER 2012-12-19 22:25:07 +01:00
txx9wdt.c watchdog: txx9wdt: fix timeout 2012-03-27 20:16:13 +02:00
via_wdt.c watchdog: remove use of __devexit 2012-11-28 12:00:24 -08:00
w83627hf_wdt.c Disintegrate and delete asm/system.h 2012-03-28 15:58:21 -07:00
w83697hf_wdt.c Disintegrate and delete asm/system.h 2012-03-28 15:58:21 -07:00
w83697ug_wdt.c Disintegrate and delete asm/system.h 2012-03-28 15:58:21 -07:00
w83877f_wdt.c Disintegrate and delete asm/system.h 2012-03-28 15:58:21 -07:00
w83977f_wdt.c Disintegrate and delete asm/system.h 2012-03-28 15:58:21 -07:00
wafer5823wdt.c watchdog: nowayout is bool 2012-03-27 20:06:02 +02:00
watchdog_core.c watchdog: move the dereference below the NULL test 2012-09-10 17:33:17 +02:00
watchdog_core.h watchdog: Add multiple device support 2012-05-30 07:54:25 +02:00
watchdog_dev.c watchdog: core: fix WDIOC_GETSTATUS return value 2012-06-28 20:40:56 +02:00
wd501p.h [WATCHDOG] More coding-style and trivial clean-up 2009-03-25 09:07:04 +00:00
wdrtas.c watchdog: nowayout is bool 2012-03-27 20:06:02 +02:00
wdt285.c Disintegrate and delete asm/system.h 2012-03-28 15:58:21 -07:00
wdt977.c Disintegrate and delete asm/system.h 2012-03-28 15:58:21 -07:00
wdt_pci.c watchdog: remove use of __devexit 2012-11-28 12:00:24 -08:00
wdt.c Disintegrate and delete asm/system.h 2012-03-28 15:58:21 -07:00
wm831x_wdt.c watchdog: remove use of __devexit 2012-11-28 12:00:24 -08:00
wm8350_wdt.c watchdog: remove use of __devexit 2012-11-28 12:00:24 -08:00
xen_wdt.c watchdog: remove use of __devexit 2012-11-28 12:00:24 -08:00