097-0003-sp5100_tco-fix-the-device-check-for-SB800-and-later-chipsets.patch 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. From bdecfcdb5461834aab24002bb18d3cbdd907b7fb Mon Sep 17 00:00:00 2001
  2. From: Huang Rui <ray.huang@amd.com>
  3. Date: Mon, 23 Nov 2015 18:07:35 +0800
  4. Subject: [PATCH] sp5100_tco: fix the device check for SB800 and later chipsets
  5. For SB800 and later chipsets, the register definitions are the same
  6. with SB800. And for SB700 and older chipsets, the definitions should
  7. be same with SP5100/SB7x0.
  8. Signed-off-by: Huang Rui <ray.huang@amd.com>
  9. Cc: Denis Turischev <denis.turischev@compulab.co.il>
  10. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
  11. Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
  12. ---
  13. drivers/watchdog/sp5100_tco.c | 28 ++++++++++++++++------------
  14. 1 file changed, 16 insertions(+), 12 deletions(-)
  15. --- a/drivers/watchdog/sp5100_tco.c
  16. +++ b/drivers/watchdog/sp5100_tco.c
  17. @@ -335,21 +335,24 @@ static unsigned char sp5100_tco_setupdev
  18. if (!sp5100_tco_pci)
  19. return 0;
  20. - pr_info("PCI Revision ID: 0x%x\n", sp5100_tco_pci->revision);
  21. + pr_info("PCI Vendor ID: 0x%x, Device ID: 0x%x, Revision ID: 0x%x\n",
  22. + sp5100_tco_pci->vendor, sp5100_tco_pci->device,
  23. + sp5100_tco_pci->revision);
  24. /*
  25. * Determine type of southbridge chipset.
  26. */
  27. - if (sp5100_tco_pci->revision >= 0x40) {
  28. - dev_name = SB800_DEVNAME;
  29. - index_reg = SB800_IO_PM_INDEX_REG;
  30. - data_reg = SB800_IO_PM_DATA_REG;
  31. - base_addr = SB800_PM_WATCHDOG_BASE;
  32. - } else {
  33. + if (sp5100_tco_pci->device == PCI_DEVICE_ID_ATI_SBX00_SMBUS &&
  34. + sp5100_tco_pci->revision < 0x40) {
  35. dev_name = SP5100_DEVNAME;
  36. index_reg = SP5100_IO_PM_INDEX_REG;
  37. data_reg = SP5100_IO_PM_DATA_REG;
  38. base_addr = SP5100_PM_WATCHDOG_BASE;
  39. + } else {
  40. + dev_name = SB800_DEVNAME;
  41. + index_reg = SB800_IO_PM_INDEX_REG;
  42. + data_reg = SB800_IO_PM_DATA_REG;
  43. + base_addr = SB800_PM_WATCHDOG_BASE;
  44. }
  45. /* Request the IO ports used by this driver */
  46. @@ -385,7 +388,12 @@ static unsigned char sp5100_tco_setupdev
  47. * Secondly, Find the watchdog timer MMIO address
  48. * from SBResource_MMIO register.
  49. */
  50. - if (sp5100_tco_pci->revision >= 0x40) {
  51. + if (sp5100_tco_pci->device == PCI_DEVICE_ID_ATI_SBX00_SMBUS &&
  52. + sp5100_tco_pci->revision < 0x40) {
  53. + /* Read SBResource_MMIO from PCI config(PCI_Reg: 9Ch) */
  54. + pci_read_config_dword(sp5100_tco_pci,
  55. + SP5100_SB_RESOURCE_MMIO_BASE, &val);
  56. + } else {
  57. /* Read SBResource_MMIO from AcpiMmioEn(PM_Reg: 24h) */
  58. outb(SB800_PM_ACPI_MMIO_EN+3, SB800_IO_PM_INDEX_REG);
  59. val = inb(SB800_IO_PM_DATA_REG);
  60. @@ -395,10 +403,6 @@ static unsigned char sp5100_tco_setupdev
  61. val = val << 8 | inb(SB800_IO_PM_DATA_REG);
  62. outb(SB800_PM_ACPI_MMIO_EN+0, SB800_IO_PM_INDEX_REG);
  63. val = val << 8 | inb(SB800_IO_PM_DATA_REG);
  64. - } else {
  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);
  68. }
  69. /* The SBResource_MMIO is enabled and mapped memory space? */