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