]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
UBUNTU: SAUCE: LPC: Add the ACPI LPC support
authorzhichang.yuan <yuanzhichang@hisilicon.com>
Mon, 13 Mar 2017 02:42:43 +0000 (10:42 +0800)
committerThadeu Lima de Souza Cascardo <cascardo@canonical.com>
Wed, 17 May 2017 16:36:53 +0000 (13:36 -0300)
BugLink: http://bugs.launchpad.net/bugs/1677319
The patch update the _CRS of LPC children based on the relevant LIBIO
interfaces. Then the ACPI platform device enumeration for LPC can apply the
right I/O resource to request the system I/O space from ioport_resource and
ensure the LPC peripherals work well.

Signed-off-by: zhichang.yuan <yuanzhichang@hisilicon.com>
Signed-off-by: John Garry <john.garry@huawei.com>
(v7 submission)
Reference: http://www.spinics.net/lists/linux-pci/msg59174.html
[dannf: Include fix from zhichang to support early LPC bus probing]
Signed-off-by: dann frazier <dann.frazier@canonical.com>
Acked-by: Seth Forshee <seth.forshee@canonical.com>
Acked-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/bus/hisi_lpc.c

index db3274f64c121848cc0f2547b942d572d7227ad2..755a79fa1ac41b391e704b25df1fb009f2c434f8 100644 (file)
@@ -20,6 +20,7 @@
 #include <linux/console.h>
 #include <linux/delay.h>
 #include <linux/io.h>
+#include <linux/libio.h>
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
@@ -461,6 +462,27 @@ static int hisilpc_host_io_register(struct device *dev)
                        return -EFAULT;
        }
 
+       /*
+        * For ACPI children, translate the bus-local I/O range to logical
+        * I/O range and set it as the current resource before the children
+        * are enumerated.
+        */
+       if (has_acpi_companion(dev)) {
+               struct acpi_device *root, *child;
+
+               root = to_acpi_device_node(dev->fwnode);
+               /* For hisilpc, only care about the sons of host. */
+               list_for_each_entry(child, &root->children, node) {
+                       int ret;
+
+                       ret = acpi_set_libio_resource(&child->dev, &root->dev);
+                       if (ret) {
+                               dev_err(&child->dev, "set resource failed..\n");
+                               return ret;
+                       }
+               }
+       }
+
        return 0;
 }
 
@@ -544,10 +566,16 @@ static const struct of_device_id hisilpc_of_match[] = {
        {},
 };
 
+static const struct acpi_device_id hisilpc_acpi_match[] = {
+       {"HISI0191", },
+       {},
+};
+
 static struct platform_driver hisilpc_driver = {
        .driver = {
                .name           = "hisi_lpc",
                .of_match_table = hisilpc_of_match,
+               .acpi_match_table = ACPI_PTR(hisilpc_acpi_match),
        },
        .probe = hisilpc_probe,
 };