097-0004-watchdog-sp5100_tco-properly-check-for-new-register-.patch 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. From 46856fabe40cc80f92134683cdec7dc0fc8f4000 Mon Sep 17 00:00:00 2001
  2. From: Lucas Stach <dev@lynxeye.de>
  3. Date: Tue, 3 May 2016 19:15:58 +0200
  4. Subject: [PATCH] watchdog: sp5100_tco: properly check for new register layouts
  5. Commits 190aa4304de6 (Add AMD Mullins platform support) and
  6. cca118fa2a0a94 (Add AMD Carrizo platform support) enabled the
  7. driver on a lot more devices, but the following commit missed
  8. a single location in the code when checking if the SB800 register
  9. offsets should be used. This leads to the wrong register being
  10. written which in turn causes ACPI to go haywire.
  11. Fix this by introducing a helper function to check for the new
  12. register layout and use this consistently.
  13. https://bugzilla.kernel.org/show_bug.cgi?id=114201
  14. https://bugzilla.redhat.com/show_bug.cgi?id=1329910
  15. Fixes: bdecfcdb5461 (sp5100_tco: fix the device check for SB800
  16. and later chipsets)
  17. Cc: stable@vger.kernel.org (4.5+)
  18. Signed-off-by: Lucas Stach <dev@lynxeye.de>
  19. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
  20. Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
  21. ---
  22. drivers/watchdog/sp5100_tco.c | 15 ++++++++++-----
  23. 1 file changed, 10 insertions(+), 5 deletions(-)
  24. --- a/drivers/watchdog/sp5100_tco.c
  25. +++ b/drivers/watchdog/sp5100_tco.c
  26. @@ -73,6 +73,13 @@ MODULE_PARM_DESC(nowayout, "Watchdog can
  27. /*
  28. * Some TCO specific functions
  29. */
  30. +
  31. +static bool tco_has_sp5100_reg_layout(struct pci_dev *dev)
  32. +{
  33. + return dev->device == PCI_DEVICE_ID_ATI_SBX00_SMBUS &&
  34. + dev->revision < 0x40;
  35. +}
  36. +
  37. static void tco_timer_start(void)
  38. {
  39. u32 val;
  40. @@ -129,7 +136,7 @@ static void tco_timer_enable(void)
  41. {
  42. int val;
  43. - if (sp5100_tco_pci->revision >= 0x40) {
  44. + if (!tco_has_sp5100_reg_layout(sp5100_tco_pci)) {
  45. /* For SB800 or later */
  46. /* Set the Watchdog timer resolution to 1 sec */
  47. outb(SB800_PM_WATCHDOG_CONFIG, SB800_IO_PM_INDEX_REG);
  48. @@ -342,8 +349,7 @@ static unsigned char sp5100_tco_setupdev
  49. /*
  50. * Determine type of southbridge chipset.
  51. */
  52. - if (sp5100_tco_pci->device == PCI_DEVICE_ID_ATI_SBX00_SMBUS &&
  53. - sp5100_tco_pci->revision < 0x40) {
  54. + if (tco_has_sp5100_reg_layout(sp5100_tco_pci)) {
  55. dev_name = SP5100_DEVNAME;
  56. index_reg = SP5100_IO_PM_INDEX_REG;
  57. data_reg = SP5100_IO_PM_DATA_REG;
  58. @@ -388,8 +394,7 @@ static unsigned char sp5100_tco_setupdev
  59. * Secondly, Find the watchdog timer MMIO address
  60. * from SBResource_MMIO register.
  61. */
  62. - if (sp5100_tco_pci->device == PCI_DEVICE_ID_ATI_SBX00_SMBUS &&
  63. - sp5100_tco_pci->revision < 0x40) {
  64. + if (tco_has_sp5100_reg_layout(sp5100_tco_pci)) {
  65. /* Read SBResource_MMIO from PCI config(PCI_Reg: 9Ch) */
  66. pci_read_config_dword(sp5100_tco_pci,
  67. SP5100_SB_RESOURCE_MMIO_BASE, &val);