From: Chris Blake Date: Sat, 14 Jan 2017 16:20:24 +0000 (-0600) Subject: x86: Add sp5100_tco AMD patches X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=4fab08183b973728a5db2fc691f4845e6a48d0b4;p=openwrt%2Fstaging%2Fjogo.git x86: Add sp5100_tco AMD patches This adds the following patches to the x86 target: sp5100_tco: Add AMD Mullins platform support sp5100_tco: Add AMD Carrizo platform support sp5100_tco: fix the device check for SB800 and later chipsets watchdog: sp5100_tco: properly check for new register layouts With these added, the sp5100_tco driver can then be used on newer AMD platforms, such as the PCEngines APU2/APU3 boards. Signed-off-by: Chris Blake --- diff --git a/target/linux/x86/patches-4.4/097-0001-sp5100_tco-Add-AMD-Mullins-platform-support.patch b/target/linux/x86/patches-4.4/097-0001-sp5100_tco-Add-AMD-Mullins-platform-support.patch new file mode 100644 index 0000000000..ee88859bc6 --- /dev/null +++ b/target/linux/x86/patches-4.4/097-0001-sp5100_tco-Add-AMD-Mullins-platform-support.patch @@ -0,0 +1,30 @@ +From 190aa4304de6fe2185d96392ddf56580fa133e99 Mon Sep 17 00:00:00 2001 +From: Denis Turischev +Date: Tue, 24 Nov 2015 10:46:12 +0200 +Subject: [PATCH] sp5100_tco: Add AMD Mullins platform support + +AMD Mullins watchdog is fully compatible to the previous Hudson chipset, +reuse the existent sp5100_tco driver. + +Signed-off-by: Denis Turischev +Signed-off-by: Guenter Roeck +Signed-off-by: Wim Van Sebroeck +--- + drivers/watchdog/sp5100_tco.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/watchdog/sp5100_tco.c b/drivers/watchdog/sp5100_tco.c +index eb8044e..ef039f8 100644 +--- a/drivers/watchdog/sp5100_tco.c ++++ b/drivers/watchdog/sp5100_tco.c +@@ -306,6 +306,8 @@ static struct miscdevice sp5100_tco_miscdev = { + static const struct pci_device_id sp5100_tco_pci_tbl[] = { + { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_SBX00_SMBUS, PCI_ANY_ID, + PCI_ANY_ID, }, ++ { PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_HUDSON2_SMBUS, PCI_ANY_ID, ++ PCI_ANY_ID, }, + { 0, }, /* End of list */ + }; + MODULE_DEVICE_TABLE(pci, sp5100_tco_pci_tbl); +-- +2.7.4 diff --git a/target/linux/x86/patches-4.4/097-0002-sp5100_tco-Add-AMD-Carrizo-platform-support.patch b/target/linux/x86/patches-4.4/097-0002-sp5100_tco-Add-AMD-Carrizo-platform-support.patch new file mode 100644 index 0000000000..664d4bb615 --- /dev/null +++ b/target/linux/x86/patches-4.4/097-0002-sp5100_tco-Add-AMD-Carrizo-platform-support.patch @@ -0,0 +1,31 @@ +From cca118fa2a0a94e0f0b3c8dd1dda922cdee45089 Mon Sep 17 00:00:00 2001 +From: Huang Rui +Date: Mon, 23 Nov 2015 18:07:36 +0800 +Subject: [PATCH] sp5100_tco: Add AMD Carrizo platform support + +sp5100_tco watchdog is also supported on AMD KernCZ chipset of Carrizo +platform. + +Signed-off-by: Huang Rui +Cc: Denis Turischev +Signed-off-by: Guenter Roeck +Signed-off-by: Wim Van Sebroeck +--- + drivers/watchdog/sp5100_tco.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/watchdog/sp5100_tco.c b/drivers/watchdog/sp5100_tco.c +index ef039f8..0ccadb4 100644 +--- a/drivers/watchdog/sp5100_tco.c ++++ b/drivers/watchdog/sp5100_tco.c +@@ -308,6 +308,8 @@ static const struct pci_device_id sp5100_tco_pci_tbl[] = { + PCI_ANY_ID, }, + { PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_HUDSON2_SMBUS, PCI_ANY_ID, + PCI_ANY_ID, }, ++ { PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_KERNCZ_SMBUS, PCI_ANY_ID, ++ PCI_ANY_ID, }, + { 0, }, /* End of list */ + }; + MODULE_DEVICE_TABLE(pci, sp5100_tco_pci_tbl); +-- +2.7.4 diff --git a/target/linux/x86/patches-4.4/097-0003-sp5100_tco-fix-the-device-check-for-SB800-and-later-chipsets.patch b/target/linux/x86/patches-4.4/097-0003-sp5100_tco-fix-the-device-check-for-SB800-and-later-chipsets.patch new file mode 100644 index 0000000000..e9f451394f --- /dev/null +++ b/target/linux/x86/patches-4.4/097-0003-sp5100_tco-fix-the-device-check-for-SB800-and-later-chipsets.patch @@ -0,0 +1,80 @@ +From bdecfcdb5461834aab24002bb18d3cbdd907b7fb Mon Sep 17 00:00:00 2001 +From: Huang Rui +Date: Mon, 23 Nov 2015 18:07:35 +0800 +Subject: [PATCH] sp5100_tco: fix the device check for SB800 and later chipsets + +For SB800 and later chipsets, the register definitions are the same +with SB800. And for SB700 and older chipsets, the definitions should +be same with SP5100/SB7x0. + +Signed-off-by: Huang Rui +Cc: Denis Turischev +Signed-off-by: Guenter Roeck +Signed-off-by: Wim Van Sebroeck +--- + drivers/watchdog/sp5100_tco.c | 28 ++++++++++++++++------------ + 1 file changed, 16 insertions(+), 12 deletions(-) + +diff --git a/drivers/watchdog/sp5100_tco.c b/drivers/watchdog/sp5100_tco.c +index 0ccadb4..6467b91 100644 +--- a/drivers/watchdog/sp5100_tco.c ++++ b/drivers/watchdog/sp5100_tco.c +@@ -335,21 +335,24 @@ static unsigned char sp5100_tco_setupdevice(void) + if (!sp5100_tco_pci) + return 0; + +- pr_info("PCI Revision ID: 0x%x\n", sp5100_tco_pci->revision); ++ pr_info("PCI Vendor ID: 0x%x, Device ID: 0x%x, Revision ID: 0x%x\n", ++ sp5100_tco_pci->vendor, sp5100_tco_pci->device, ++ sp5100_tco_pci->revision); + + /* + * Determine type of southbridge chipset. + */ +- if (sp5100_tco_pci->revision >= 0x40) { +- dev_name = SB800_DEVNAME; +- index_reg = SB800_IO_PM_INDEX_REG; +- data_reg = SB800_IO_PM_DATA_REG; +- base_addr = SB800_PM_WATCHDOG_BASE; +- } else { ++ if (sp5100_tco_pci->device == PCI_DEVICE_ID_ATI_SBX00_SMBUS && ++ sp5100_tco_pci->revision < 0x40) { + dev_name = SP5100_DEVNAME; + index_reg = SP5100_IO_PM_INDEX_REG; + data_reg = SP5100_IO_PM_DATA_REG; + base_addr = SP5100_PM_WATCHDOG_BASE; ++ } else { ++ dev_name = SB800_DEVNAME; ++ index_reg = SB800_IO_PM_INDEX_REG; ++ data_reg = SB800_IO_PM_DATA_REG; ++ base_addr = SB800_PM_WATCHDOG_BASE; + } + + /* Request the IO ports used by this driver */ +@@ -385,7 +388,12 @@ static unsigned char sp5100_tco_setupdevice(void) + * Secondly, Find the watchdog timer MMIO address + * from SBResource_MMIO register. + */ +- if (sp5100_tco_pci->revision >= 0x40) { ++ if (sp5100_tco_pci->device == PCI_DEVICE_ID_ATI_SBX00_SMBUS && ++ sp5100_tco_pci->revision < 0x40) { ++ /* Read SBResource_MMIO from PCI config(PCI_Reg: 9Ch) */ ++ pci_read_config_dword(sp5100_tco_pci, ++ SP5100_SB_RESOURCE_MMIO_BASE, &val); ++ } else { + /* Read SBResource_MMIO from AcpiMmioEn(PM_Reg: 24h) */ + outb(SB800_PM_ACPI_MMIO_EN+3, SB800_IO_PM_INDEX_REG); + val = inb(SB800_IO_PM_DATA_REG); +@@ -395,10 +403,6 @@ static unsigned char sp5100_tco_setupdevice(void) + val = val << 8 | inb(SB800_IO_PM_DATA_REG); + outb(SB800_PM_ACPI_MMIO_EN+0, SB800_IO_PM_INDEX_REG); + val = val << 8 | inb(SB800_IO_PM_DATA_REG); +- } else { +- /* Read SBResource_MMIO from PCI config(PCI_Reg: 9Ch) */ +- pci_read_config_dword(sp5100_tco_pci, +- SP5100_SB_RESOURCE_MMIO_BASE, &val); + } + + /* The SBResource_MMIO is enabled and mapped memory space? */ +-- +2.7.4 diff --git a/target/linux/x86/patches-4.4/097-0004-watchdog-sp5100_tco-properly-check-for-new-register-.patch b/target/linux/x86/patches-4.4/097-0004-watchdog-sp5100_tco-properly-check-for-new-register-.patch new file mode 100644 index 0000000000..cb7fe98cba --- /dev/null +++ b/target/linux/x86/patches-4.4/097-0004-watchdog-sp5100_tco-properly-check-for-new-register-.patch @@ -0,0 +1,76 @@ +From 46856fabe40cc80f92134683cdec7dc0fc8f4000 Mon Sep 17 00:00:00 2001 +From: Lucas Stach +Date: Tue, 3 May 2016 19:15:58 +0200 +Subject: [PATCH] watchdog: sp5100_tco: properly check for new register layouts + +Commits 190aa4304de6 (Add AMD Mullins platform support) and +cca118fa2a0a94 (Add AMD Carrizo platform support) enabled the +driver on a lot more devices, but the following commit missed +a single location in the code when checking if the SB800 register +offsets should be used. This leads to the wrong register being +written which in turn causes ACPI to go haywire. + +Fix this by introducing a helper function to check for the new +register layout and use this consistently. + +https://bugzilla.kernel.org/show_bug.cgi?id=114201 +https://bugzilla.redhat.com/show_bug.cgi?id=1329910 +Fixes: bdecfcdb5461 (sp5100_tco: fix the device check for SB800 +and later chipsets) +Cc: stable@vger.kernel.org (4.5+) +Signed-off-by: Lucas Stach +Signed-off-by: Guenter Roeck +Signed-off-by: Wim Van Sebroeck +--- + drivers/watchdog/sp5100_tco.c | 15 ++++++++++----- + 1 file changed, 10 insertions(+), 5 deletions(-) + +diff --git a/drivers/watchdog/sp5100_tco.c b/drivers/watchdog/sp5100_tco.c +index 6467b91..028618c 100644 +--- a/drivers/watchdog/sp5100_tco.c ++++ b/drivers/watchdog/sp5100_tco.c +@@ -73,6 +73,13 @@ MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started." + /* + * Some TCO specific functions + */ ++ ++static bool tco_has_sp5100_reg_layout(struct pci_dev *dev) ++{ ++ return dev->device == PCI_DEVICE_ID_ATI_SBX00_SMBUS && ++ dev->revision < 0x40; ++} ++ + static void tco_timer_start(void) + { + u32 val; +@@ -129,7 +136,7 @@ static void tco_timer_enable(void) + { + int val; + +- if (sp5100_tco_pci->revision >= 0x40) { ++ if (!tco_has_sp5100_reg_layout(sp5100_tco_pci)) { + /* For SB800 or later */ + /* Set the Watchdog timer resolution to 1 sec */ + outb(SB800_PM_WATCHDOG_CONFIG, SB800_IO_PM_INDEX_REG); +@@ -342,8 +349,7 @@ static unsigned char sp5100_tco_setupdevice(void) + /* + * Determine type of southbridge chipset. + */ +- if (sp5100_tco_pci->device == PCI_DEVICE_ID_ATI_SBX00_SMBUS && +- sp5100_tco_pci->revision < 0x40) { ++ if (tco_has_sp5100_reg_layout(sp5100_tco_pci)) { + dev_name = SP5100_DEVNAME; + index_reg = SP5100_IO_PM_INDEX_REG; + data_reg = SP5100_IO_PM_DATA_REG; +@@ -388,8 +394,7 @@ static unsigned char sp5100_tco_setupdevice(void) + * Secondly, Find the watchdog timer MMIO address + * from SBResource_MMIO register. + */ +- if (sp5100_tco_pci->device == PCI_DEVICE_ID_ATI_SBX00_SMBUS && +- sp5100_tco_pci->revision < 0x40) { ++ if (tco_has_sp5100_reg_layout(sp5100_tco_pci)) { + /* Read SBResource_MMIO from PCI config(PCI_Reg: 9Ch) */ + pci_read_config_dword(sp5100_tco_pci, + SP5100_SB_RESOURCE_MMIO_BASE, &val); +-- +2.7.4