All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gabriele Paoloni <gabriele.paoloni@huawei.com>
To: catalin.marinas@arm.com, will.deacon@arm.com, robh+dt@kernel.org,
	frowand.list@gmail.com, bhelgaas@google.com, rafael@kernel.org,
	arnd@arndb.de, linux-arm-kernel@lists.infradead.org,
	lorenzo.pieralisi@arm.com
Cc: gabriele.paoloni@huawei.com, mark.rutland@arm.com,
	brian.starkey@arm.com, olof@lixom.net, benh@kernel.crashing.org,
	linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org,
	linuxarm@huawei.com, linux-pci@vger.kernel.org, minyard@acm.org,
	john.garry@huawei.com, xuwei5@hisilicon.com,
	"zhichang.yuan" <yuanzhichang@hisilicon.com>
Subject: [PATCH v9 6/7] LPC: Add the ACPI LPC support
Date: Thu, 25 May 2017 12:37:27 +0100	[thread overview]
Message-ID: <1495712248-5232-7-git-send-email-gabriele.paoloni@huawei.com> (raw)
In-Reply-To: <1495712248-5232-1-git-send-email-gabriele.paoloni@huawei.com>

From: "zhichang.yuan" <yuanzhichang@hisilicon.com>

Based on the provious patches, this patch supports the ACPI LPC host on
Hip06/Hip07.

Signed-off-by: zhichang.yuan <yuanzhichang@hisilicon.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Gabriele Paoloni <gabriele.paoloni@huawei.com>
Tested-by: dann frazier <dann.frazier@canonical.com>
---
 drivers/acpi/arm64/acpi_indirect_pio.c |  3 ++
 drivers/bus/hisi_lpc.c                 | 71 ++++++++++++++++++++++++++++++++--
 include/acpi/acpi_indirect_pio.h       |  4 ++
 3 files changed, 75 insertions(+), 3 deletions(-)

diff --git a/drivers/acpi/arm64/acpi_indirect_pio.c b/drivers/acpi/arm64/acpi_indirect_pio.c
index 7813f73..3a5ba7a 100644
--- a/drivers/acpi/arm64/acpi_indirect_pio.c
+++ b/drivers/acpi/arm64/acpi_indirect_pio.c
@@ -261,6 +261,9 @@ int acpi_set_logic_pio_resource(struct device *child,
 
 /* All the host devices which apply indirect-PIO can be listed here. */
 static const struct acpi_device_id acpi_indirect_host_id[] = {
+#ifdef CONFIG_HISILICON_LPC
+	{"HISI0191", INDIRECT_PIO_INFO(lpc_host_desc)},
+#endif
 	{""},
 };
 
diff --git a/drivers/bus/hisi_lpc.c b/drivers/bus/hisi_lpc.c
index 4f3bf76..05a0a84 100644
--- a/drivers/bus/hisi_lpc.c
+++ b/drivers/bus/hisi_lpc.c
@@ -467,7 +467,9 @@ static int hisilpc_probe(struct platform_device *pdev)
 	}
 
 	/* register the LPC host PIO resources */
-	if (!has_acpi_companion(dev)) {
+	if (has_acpi_companion(dev)) {
+		lpcdev->io_host = find_io_range_by_fwnode(dev->fwnode);
+	} else {
 		struct logic_pio_hwaddr *range;
 
 		range = kzalloc(sizeof(*range), GFP_KERNEL);
@@ -481,13 +483,14 @@ static int hisilpc_probe(struct platform_device *pdev)
 		ret = logic_pio_register_range(range);
 		if (ret) {
 			kfree(range);
-			dev_err(dev, "OF: register IO range FAIL!\n");
+			dev_err(dev, "OF: logic_pio_register_range returned %d!\n",
+					ret);
 			return -ret;
 		}
 		lpcdev->io_host = range;
 	}
 	if (!lpcdev->io_host) {
-		dev_err(dev, "Hisilpc IO hasn't registered!\n");
+		dev_err(dev, "HiSi LPC IO hasn't been registered!\n");
 		return -EFAULT;
 	}
 
@@ -533,10 +536,72 @@ static const struct of_device_id hisilpc_of_match[] = {
 	{},
 };
 
+#ifdef CONFIG_ACPI
+#include <acpi/acpi_indirect_pio.h>
+
+struct lpc_private_data {
+	resource_size_t io_size;
+	resource_size_t io_start;
+};
+
+static struct lpc_private_data lpc_data = {
+	.io_size = LPC_BUS_IO_SIZE,
+	.io_start = LPC_MIN_BUS_RANGE,
+};
+
+static int lpc_host_io_setup(struct acpi_device *adev, void *pdata)
+{
+	int ret = 0;
+	struct logic_pio_hwaddr *range;
+	struct lpc_private_data *lpc_private;
+	struct acpi_device *child;
+
+	lpc_private = (struct lpc_private_data *)pdata;
+	range = kzalloc(sizeof(*range), GFP_KERNEL);
+	if (!range)
+		return -ENOMEM;
+	range->fwnode = &adev->fwnode;
+	range->flags = PIO_INDIRECT;
+	range->size = lpc_private->io_size;
+	range->hw_start = lpc_private->io_start;
+
+	ret = logic_pio_register_range(range);
+	if (ret) {
+		kfree(range);
+		return ret;
+	}
+
+	/* In HiSilicon lpc, only care about the children of the host. */
+	list_for_each_entry(child, &adev->children, node) {
+		ret = acpi_set_logic_pio_resource(&child->dev, &adev->dev);
+		if (ret) {
+			dev_err(&child->dev,
+					"acpi_set_logic_pio_resource() returned %d\n",
+					ret);
+			return ret;
+		}
+	}
+
+	return ret;
+}
+
+static const struct acpi_device_id hisilpc_acpi_match[] = {
+	{"HISI0191", },
+	{},
+};
+
+const struct indirect_pio_device_desc lpc_host_desc = {
+	.pdata = &lpc_data,
+	.pre_setup = lpc_host_io_setup,
+};
+
+#endif
+
 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,
 };
diff --git a/include/acpi/acpi_indirect_pio.h b/include/acpi/acpi_indirect_pio.h
index efc5c43..7a8d26b 100644
--- a/include/acpi/acpi_indirect_pio.h
+++ b/include/acpi/acpi_indirect_pio.h
@@ -18,6 +18,10 @@ struct indirect_pio_device_desc {
 	int (*pre_setup)(struct acpi_device *adev, void *pdata);
 };
 
+#ifdef CONFIG_HISILICON_LPC
+extern const struct indirect_pio_device_desc lpc_host_desc;
+#endif
+
 int acpi_set_logic_pio_resource(struct device *child,
 		struct device *hostdev);
 
-- 
2.7.4

WARNING: multiple messages have this Message-ID (diff)
From: Gabriele Paoloni <gabriele.paoloni@huawei.com>
To: <catalin.marinas@arm.com>, <will.deacon@arm.com>,
	<robh+dt@kernel.org>, <frowand.list@gmail.com>,
	<bhelgaas@google.com>, <rafael@kernel.org>, <arnd@arndb.de>,
	<linux-arm-kernel@lists.infradead.org>,
	<lorenzo.pieralisi@arm.com>
Cc: <gabriele.paoloni@huawei.com>, <mark.rutland@arm.com>,
	<brian.starkey@arm.com>, <olof@lixom.net>,
	<benh@kernel.crashing.org>, <linux-kernel@vger.kernel.org>,
	<linux-acpi@vger.kernel.org>, <linuxarm@huawei.com>,
	<linux-pci@vger.kernel.org>, <minyard@acm.org>,
	<john.garry@huawei.com>, <xuwei5@hisilicon.com>,
	"zhichang.yuan" <yuanzhichang@hisilicon.com>
Subject: [PATCH v9 6/7] LPC: Add the ACPI LPC support
Date: Thu, 25 May 2017 12:37:27 +0100	[thread overview]
Message-ID: <1495712248-5232-7-git-send-email-gabriele.paoloni@huawei.com> (raw)
In-Reply-To: <1495712248-5232-1-git-send-email-gabriele.paoloni@huawei.com>

From: "zhichang.yuan" <yuanzhichang@hisilicon.com>

Based on the provious patches, this patch supports the ACPI LPC host on
Hip06/Hip07.

Signed-off-by: zhichang.yuan <yuanzhichang@hisilicon.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Gabriele Paoloni <gabriele.paoloni@huawei.com>
Tested-by: dann frazier <dann.frazier@canonical.com>
---
 drivers/acpi/arm64/acpi_indirect_pio.c |  3 ++
 drivers/bus/hisi_lpc.c                 | 71 ++++++++++++++++++++++++++++++++--
 include/acpi/acpi_indirect_pio.h       |  4 ++
 3 files changed, 75 insertions(+), 3 deletions(-)

diff --git a/drivers/acpi/arm64/acpi_indirect_pio.c b/drivers/acpi/arm64/acpi_indirect_pio.c
index 7813f73..3a5ba7a 100644
--- a/drivers/acpi/arm64/acpi_indirect_pio.c
+++ b/drivers/acpi/arm64/acpi_indirect_pio.c
@@ -261,6 +261,9 @@ int acpi_set_logic_pio_resource(struct device *child,
 
 /* All the host devices which apply indirect-PIO can be listed here. */
 static const struct acpi_device_id acpi_indirect_host_id[] = {
+#ifdef CONFIG_HISILICON_LPC
+	{"HISI0191", INDIRECT_PIO_INFO(lpc_host_desc)},
+#endif
 	{""},
 };
 
diff --git a/drivers/bus/hisi_lpc.c b/drivers/bus/hisi_lpc.c
index 4f3bf76..05a0a84 100644
--- a/drivers/bus/hisi_lpc.c
+++ b/drivers/bus/hisi_lpc.c
@@ -467,7 +467,9 @@ static int hisilpc_probe(struct platform_device *pdev)
 	}
 
 	/* register the LPC host PIO resources */
-	if (!has_acpi_companion(dev)) {
+	if (has_acpi_companion(dev)) {
+		lpcdev->io_host = find_io_range_by_fwnode(dev->fwnode);
+	} else {
 		struct logic_pio_hwaddr *range;
 
 		range = kzalloc(sizeof(*range), GFP_KERNEL);
@@ -481,13 +483,14 @@ static int hisilpc_probe(struct platform_device *pdev)
 		ret = logic_pio_register_range(range);
 		if (ret) {
 			kfree(range);
-			dev_err(dev, "OF: register IO range FAIL!\n");
+			dev_err(dev, "OF: logic_pio_register_range returned %d!\n",
+					ret);
 			return -ret;
 		}
 		lpcdev->io_host = range;
 	}
 	if (!lpcdev->io_host) {
-		dev_err(dev, "Hisilpc IO hasn't registered!\n");
+		dev_err(dev, "HiSi LPC IO hasn't been registered!\n");
 		return -EFAULT;
 	}
 
@@ -533,10 +536,72 @@ static const struct of_device_id hisilpc_of_match[] = {
 	{},
 };
 
+#ifdef CONFIG_ACPI
+#include <acpi/acpi_indirect_pio.h>
+
+struct lpc_private_data {
+	resource_size_t io_size;
+	resource_size_t io_start;
+};
+
+static struct lpc_private_data lpc_data = {
+	.io_size = LPC_BUS_IO_SIZE,
+	.io_start = LPC_MIN_BUS_RANGE,
+};
+
+static int lpc_host_io_setup(struct acpi_device *adev, void *pdata)
+{
+	int ret = 0;
+	struct logic_pio_hwaddr *range;
+	struct lpc_private_data *lpc_private;
+	struct acpi_device *child;
+
+	lpc_private = (struct lpc_private_data *)pdata;
+	range = kzalloc(sizeof(*range), GFP_KERNEL);
+	if (!range)
+		return -ENOMEM;
+	range->fwnode = &adev->fwnode;
+	range->flags = PIO_INDIRECT;
+	range->size = lpc_private->io_size;
+	range->hw_start = lpc_private->io_start;
+
+	ret = logic_pio_register_range(range);
+	if (ret) {
+		kfree(range);
+		return ret;
+	}
+
+	/* In HiSilicon lpc, only care about the children of the host. */
+	list_for_each_entry(child, &adev->children, node) {
+		ret = acpi_set_logic_pio_resource(&child->dev, &adev->dev);
+		if (ret) {
+			dev_err(&child->dev,
+					"acpi_set_logic_pio_resource() returned %d\n",
+					ret);
+			return ret;
+		}
+	}
+
+	return ret;
+}
+
+static const struct acpi_device_id hisilpc_acpi_match[] = {
+	{"HISI0191", },
+	{},
+};
+
+const struct indirect_pio_device_desc lpc_host_desc = {
+	.pdata = &lpc_data,
+	.pre_setup = lpc_host_io_setup,
+};
+
+#endif
+
 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,
 };
diff --git a/include/acpi/acpi_indirect_pio.h b/include/acpi/acpi_indirect_pio.h
index efc5c43..7a8d26b 100644
--- a/include/acpi/acpi_indirect_pio.h
+++ b/include/acpi/acpi_indirect_pio.h
@@ -18,6 +18,10 @@ struct indirect_pio_device_desc {
 	int (*pre_setup)(struct acpi_device *adev, void *pdata);
 };
 
+#ifdef CONFIG_HISILICON_LPC
+extern const struct indirect_pio_device_desc lpc_host_desc;
+#endif
+
 int acpi_set_logic_pio_resource(struct device *child,
 		struct device *hostdev);
 
-- 
2.7.4

WARNING: multiple messages have this Message-ID (diff)
From: Gabriele Paoloni <gabriele.paoloni@huawei.com>
To: <catalin.marinas@arm.com>, <will.deacon@arm.com>,
	<robh+dt@kernel.org>, <frowand.list@gmail.com>,
	<bhelgaas@google.com>, <rafael@kernel.org>, <arnd@arndb.de>,
	<linux-arm-kernel@lists.infradead.org>,
	<lorenzo.pieralisi@arm.com>
Cc: mark.rutland@arm.com, minyard@acm.org,
	gabriele.paoloni@huawei.com, benh@kernel.crashing.org,
	john.garry@huawei.com, linux-kernel@vger.kernel.org,
	xuwei5@hisilicon.com, linuxarm@huawei.com,
	linux-acpi@vger.kernel.org,
	"zhichang.yuan" <yuanzhichang@hisilicon.com>,
	linux-pci@vger.kernel.org, olof@lixom.net, brian.starkey@arm.com
Subject: [PATCH v9 6/7] LPC: Add the ACPI LPC support
Date: Thu, 25 May 2017 12:37:27 +0100	[thread overview]
Message-ID: <1495712248-5232-7-git-send-email-gabriele.paoloni@huawei.com> (raw)
In-Reply-To: <1495712248-5232-1-git-send-email-gabriele.paoloni@huawei.com>

From: "zhichang.yuan" <yuanzhichang@hisilicon.com>

Based on the provious patches, this patch supports the ACPI LPC host on
Hip06/Hip07.

Signed-off-by: zhichang.yuan <yuanzhichang@hisilicon.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Gabriele Paoloni <gabriele.paoloni@huawei.com>
Tested-by: dann frazier <dann.frazier@canonical.com>
---
 drivers/acpi/arm64/acpi_indirect_pio.c |  3 ++
 drivers/bus/hisi_lpc.c                 | 71 ++++++++++++++++++++++++++++++++--
 include/acpi/acpi_indirect_pio.h       |  4 ++
 3 files changed, 75 insertions(+), 3 deletions(-)

diff --git a/drivers/acpi/arm64/acpi_indirect_pio.c b/drivers/acpi/arm64/acpi_indirect_pio.c
index 7813f73..3a5ba7a 100644
--- a/drivers/acpi/arm64/acpi_indirect_pio.c
+++ b/drivers/acpi/arm64/acpi_indirect_pio.c
@@ -261,6 +261,9 @@ int acpi_set_logic_pio_resource(struct device *child,
 
 /* All the host devices which apply indirect-PIO can be listed here. */
 static const struct acpi_device_id acpi_indirect_host_id[] = {
+#ifdef CONFIG_HISILICON_LPC
+	{"HISI0191", INDIRECT_PIO_INFO(lpc_host_desc)},
+#endif
 	{""},
 };
 
diff --git a/drivers/bus/hisi_lpc.c b/drivers/bus/hisi_lpc.c
index 4f3bf76..05a0a84 100644
--- a/drivers/bus/hisi_lpc.c
+++ b/drivers/bus/hisi_lpc.c
@@ -467,7 +467,9 @@ static int hisilpc_probe(struct platform_device *pdev)
 	}
 
 	/* register the LPC host PIO resources */
-	if (!has_acpi_companion(dev)) {
+	if (has_acpi_companion(dev)) {
+		lpcdev->io_host = find_io_range_by_fwnode(dev->fwnode);
+	} else {
 		struct logic_pio_hwaddr *range;
 
 		range = kzalloc(sizeof(*range), GFP_KERNEL);
@@ -481,13 +483,14 @@ static int hisilpc_probe(struct platform_device *pdev)
 		ret = logic_pio_register_range(range);
 		if (ret) {
 			kfree(range);
-			dev_err(dev, "OF: register IO range FAIL!\n");
+			dev_err(dev, "OF: logic_pio_register_range returned %d!\n",
+					ret);
 			return -ret;
 		}
 		lpcdev->io_host = range;
 	}
 	if (!lpcdev->io_host) {
-		dev_err(dev, "Hisilpc IO hasn't registered!\n");
+		dev_err(dev, "HiSi LPC IO hasn't been registered!\n");
 		return -EFAULT;
 	}
 
@@ -533,10 +536,72 @@ static const struct of_device_id hisilpc_of_match[] = {
 	{},
 };
 
+#ifdef CONFIG_ACPI
+#include <acpi/acpi_indirect_pio.h>
+
+struct lpc_private_data {
+	resource_size_t io_size;
+	resource_size_t io_start;
+};
+
+static struct lpc_private_data lpc_data = {
+	.io_size = LPC_BUS_IO_SIZE,
+	.io_start = LPC_MIN_BUS_RANGE,
+};
+
+static int lpc_host_io_setup(struct acpi_device *adev, void *pdata)
+{
+	int ret = 0;
+	struct logic_pio_hwaddr *range;
+	struct lpc_private_data *lpc_private;
+	struct acpi_device *child;
+
+	lpc_private = (struct lpc_private_data *)pdata;
+	range = kzalloc(sizeof(*range), GFP_KERNEL);
+	if (!range)
+		return -ENOMEM;
+	range->fwnode = &adev->fwnode;
+	range->flags = PIO_INDIRECT;
+	range->size = lpc_private->io_size;
+	range->hw_start = lpc_private->io_start;
+
+	ret = logic_pio_register_range(range);
+	if (ret) {
+		kfree(range);
+		return ret;
+	}
+
+	/* In HiSilicon lpc, only care about the children of the host. */
+	list_for_each_entry(child, &adev->children, node) {
+		ret = acpi_set_logic_pio_resource(&child->dev, &adev->dev);
+		if (ret) {
+			dev_err(&child->dev,
+					"acpi_set_logic_pio_resource() returned %d\n",
+					ret);
+			return ret;
+		}
+	}
+
+	return ret;
+}
+
+static const struct acpi_device_id hisilpc_acpi_match[] = {
+	{"HISI0191", },
+	{},
+};
+
+const struct indirect_pio_device_desc lpc_host_desc = {
+	.pdata = &lpc_data,
+	.pre_setup = lpc_host_io_setup,
+};
+
+#endif
+
 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,
 };
diff --git a/include/acpi/acpi_indirect_pio.h b/include/acpi/acpi_indirect_pio.h
index efc5c43..7a8d26b 100644
--- a/include/acpi/acpi_indirect_pio.h
+++ b/include/acpi/acpi_indirect_pio.h
@@ -18,6 +18,10 @@ struct indirect_pio_device_desc {
 	int (*pre_setup)(struct acpi_device *adev, void *pdata);
 };
 
+#ifdef CONFIG_HISILICON_LPC
+extern const struct indirect_pio_device_desc lpc_host_desc;
+#endif
+
 int acpi_set_logic_pio_resource(struct device *child,
 		struct device *hostdev);
 
-- 
2.7.4



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: gabriele.paoloni@huawei.com (Gabriele Paoloni)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v9 6/7] LPC: Add the ACPI LPC support
Date: Thu, 25 May 2017 12:37:27 +0100	[thread overview]
Message-ID: <1495712248-5232-7-git-send-email-gabriele.paoloni@huawei.com> (raw)
In-Reply-To: <1495712248-5232-1-git-send-email-gabriele.paoloni@huawei.com>

From: "zhichang.yuan" <yuanzhichang@hisilicon.com>

Based on the provious patches, this patch supports the ACPI LPC host on
Hip06/Hip07.

Signed-off-by: zhichang.yuan <yuanzhichang@hisilicon.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Gabriele Paoloni <gabriele.paoloni@huawei.com>
Tested-by: dann frazier <dann.frazier@canonical.com>
---
 drivers/acpi/arm64/acpi_indirect_pio.c |  3 ++
 drivers/bus/hisi_lpc.c                 | 71 ++++++++++++++++++++++++++++++++--
 include/acpi/acpi_indirect_pio.h       |  4 ++
 3 files changed, 75 insertions(+), 3 deletions(-)

diff --git a/drivers/acpi/arm64/acpi_indirect_pio.c b/drivers/acpi/arm64/acpi_indirect_pio.c
index 7813f73..3a5ba7a 100644
--- a/drivers/acpi/arm64/acpi_indirect_pio.c
+++ b/drivers/acpi/arm64/acpi_indirect_pio.c
@@ -261,6 +261,9 @@ int acpi_set_logic_pio_resource(struct device *child,
 
 /* All the host devices which apply indirect-PIO can be listed here. */
 static const struct acpi_device_id acpi_indirect_host_id[] = {
+#ifdef CONFIG_HISILICON_LPC
+	{"HISI0191", INDIRECT_PIO_INFO(lpc_host_desc)},
+#endif
 	{""},
 };
 
diff --git a/drivers/bus/hisi_lpc.c b/drivers/bus/hisi_lpc.c
index 4f3bf76..05a0a84 100644
--- a/drivers/bus/hisi_lpc.c
+++ b/drivers/bus/hisi_lpc.c
@@ -467,7 +467,9 @@ static int hisilpc_probe(struct platform_device *pdev)
 	}
 
 	/* register the LPC host PIO resources */
-	if (!has_acpi_companion(dev)) {
+	if (has_acpi_companion(dev)) {
+		lpcdev->io_host = find_io_range_by_fwnode(dev->fwnode);
+	} else {
 		struct logic_pio_hwaddr *range;
 
 		range = kzalloc(sizeof(*range), GFP_KERNEL);
@@ -481,13 +483,14 @@ static int hisilpc_probe(struct platform_device *pdev)
 		ret = logic_pio_register_range(range);
 		if (ret) {
 			kfree(range);
-			dev_err(dev, "OF: register IO range FAIL!\n");
+			dev_err(dev, "OF: logic_pio_register_range returned %d!\n",
+					ret);
 			return -ret;
 		}
 		lpcdev->io_host = range;
 	}
 	if (!lpcdev->io_host) {
-		dev_err(dev, "Hisilpc IO hasn't registered!\n");
+		dev_err(dev, "HiSi LPC IO hasn't been registered!\n");
 		return -EFAULT;
 	}
 
@@ -533,10 +536,72 @@ static const struct of_device_id hisilpc_of_match[] = {
 	{},
 };
 
+#ifdef CONFIG_ACPI
+#include <acpi/acpi_indirect_pio.h>
+
+struct lpc_private_data {
+	resource_size_t io_size;
+	resource_size_t io_start;
+};
+
+static struct lpc_private_data lpc_data = {
+	.io_size = LPC_BUS_IO_SIZE,
+	.io_start = LPC_MIN_BUS_RANGE,
+};
+
+static int lpc_host_io_setup(struct acpi_device *adev, void *pdata)
+{
+	int ret = 0;
+	struct logic_pio_hwaddr *range;
+	struct lpc_private_data *lpc_private;
+	struct acpi_device *child;
+
+	lpc_private = (struct lpc_private_data *)pdata;
+	range = kzalloc(sizeof(*range), GFP_KERNEL);
+	if (!range)
+		return -ENOMEM;
+	range->fwnode = &adev->fwnode;
+	range->flags = PIO_INDIRECT;
+	range->size = lpc_private->io_size;
+	range->hw_start = lpc_private->io_start;
+
+	ret = logic_pio_register_range(range);
+	if (ret) {
+		kfree(range);
+		return ret;
+	}
+
+	/* In HiSilicon lpc, only care about the children of the host. */
+	list_for_each_entry(child, &adev->children, node) {
+		ret = acpi_set_logic_pio_resource(&child->dev, &adev->dev);
+		if (ret) {
+			dev_err(&child->dev,
+					"acpi_set_logic_pio_resource() returned %d\n",
+					ret);
+			return ret;
+		}
+	}
+
+	return ret;
+}
+
+static const struct acpi_device_id hisilpc_acpi_match[] = {
+	{"HISI0191", },
+	{},
+};
+
+const struct indirect_pio_device_desc lpc_host_desc = {
+	.pdata = &lpc_data,
+	.pre_setup = lpc_host_io_setup,
+};
+
+#endif
+
 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,
 };
diff --git a/include/acpi/acpi_indirect_pio.h b/include/acpi/acpi_indirect_pio.h
index efc5c43..7a8d26b 100644
--- a/include/acpi/acpi_indirect_pio.h
+++ b/include/acpi/acpi_indirect_pio.h
@@ -18,6 +18,10 @@ struct indirect_pio_device_desc {
 	int (*pre_setup)(struct acpi_device *adev, void *pdata);
 };
 
+#ifdef CONFIG_HISILICON_LPC
+extern const struct indirect_pio_device_desc lpc_host_desc;
+#endif
+
 int acpi_set_logic_pio_resource(struct device *child,
 		struct device *hostdev);
 
-- 
2.7.4

  parent reply	other threads:[~2017-05-25 11:37 UTC|newest]

Thread overview: 171+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-25 11:37 [PATCH v9 0/7] LPC: legacy ISA I/O support Gabriele Paoloni
2017-05-25 11:37 ` Gabriele Paoloni
2017-05-25 11:37 ` Gabriele Paoloni
2017-05-25 11:37 ` Gabriele Paoloni
2017-05-25 11:37 ` [PATCH v9 1/7] LIB: Introduce a generic PIO mapping method Gabriele Paoloni
2017-05-25 11:37   ` Gabriele Paoloni
2017-05-25 11:37   ` Gabriele Paoloni
2017-05-25 11:37   ` Gabriele Paoloni
2017-05-26 20:57   ` Bjorn Helgaas
2017-05-26 20:57     ` Bjorn Helgaas
2017-05-26 20:57     ` Bjorn Helgaas
2017-05-26 20:57     ` Bjorn Helgaas
2017-05-30 15:09     ` Gabriele Paoloni
2017-05-30 15:09       ` Gabriele Paoloni
2017-05-30 15:09       ` Gabriele Paoloni
2017-05-30 15:09       ` Gabriele Paoloni
2017-05-25 11:37 ` [PATCH v9 2/7] PCI: Apply the new generic I/O management on PCI IO hosts Gabriele Paoloni
2017-05-25 11:37   ` Gabriele Paoloni
2017-05-25 11:37   ` Gabriele Paoloni
2017-05-25 11:37   ` Gabriele Paoloni
2017-05-26 21:20   ` Bjorn Helgaas
2017-05-26 21:20     ` Bjorn Helgaas
2017-05-26 21:20     ` Bjorn Helgaas
2017-05-26 21:20     ` Bjorn Helgaas
2017-05-30  8:12     ` Gabriele Paoloni
2017-05-30  8:12       ` Gabriele Paoloni
2017-05-30  8:12       ` Gabriele Paoloni
2017-05-30  8:12       ` Gabriele Paoloni
2017-05-25 11:37 ` [PATCH v9 3/7] OF: Add missing I/O range exception for indirect-IO devices Gabriele Paoloni
2017-05-25 11:37   ` Gabriele Paoloni
2017-05-25 11:37   ` Gabriele Paoloni
2017-05-25 11:37   ` Gabriele Paoloni
2017-05-25 11:37 ` [PATCH v9 4/7] LPC: Support the device-tree LPC host on Hip06/Hip07 Gabriele Paoloni
2017-05-25 11:37   ` Gabriele Paoloni
2017-05-25 11:37   ` Gabriele Paoloni
2017-05-25 11:37   ` Gabriele Paoloni
2017-05-25 11:37 ` [PATCH v9 5/7] ACPI: Translate the I/O range of non-MMIO devices before scanning Gabriele Paoloni
2017-05-25 11:37   ` Gabriele Paoloni
2017-05-25 11:37   ` Gabriele Paoloni
2017-05-25 11:37   ` Gabriele Paoloni
2017-05-26  0:03   ` kbuild test robot
2017-05-26  0:03     ` kbuild test robot
2017-05-26  0:03     ` kbuild test robot
2017-05-26  0:03     ` kbuild test robot
2017-05-30 13:24   ` Lorenzo Pieralisi
2017-05-30 13:24     ` Lorenzo Pieralisi
2017-05-30 13:24     ` Lorenzo Pieralisi
2017-05-31 10:24     ` Gabriele Paoloni
2017-05-31 10:24       ` Gabriele Paoloni
2017-05-31 10:24       ` Gabriele Paoloni
2017-05-31 10:24       ` Gabriele Paoloni
2017-06-06  8:55       ` Lorenzo Pieralisi
2017-06-06  8:55         ` Lorenzo Pieralisi
2017-06-06  8:55         ` Lorenzo Pieralisi
2017-06-06  8:55         ` Lorenzo Pieralisi
2017-06-12 15:57         ` Lorenzo Pieralisi
2017-06-12 15:57           ` Lorenzo Pieralisi
2017-06-12 15:57           ` Lorenzo Pieralisi
2017-06-12 15:57           ` Lorenzo Pieralisi
2017-06-13  7:24           ` Gabriele Paoloni
2017-06-13  7:24             ` Gabriele Paoloni
2017-06-13  7:24             ` Gabriele Paoloni
2017-06-13  7:24             ` Gabriele Paoloni
2017-06-13  8:48           ` Mika Westerberg
2017-06-13  8:48             ` Mika Westerberg
2017-06-13  8:48             ` Mika Westerberg
2017-06-13  8:48             ` Mika Westerberg
2017-06-13 14:38             ` Gabriele Paoloni
2017-06-13 14:38               ` Gabriele Paoloni
2017-06-13 14:38               ` Gabriele Paoloni
2017-06-13 14:38               ` Gabriele Paoloni
2017-06-13 15:10               ` Mika Westerberg
2017-06-13 15:10                 ` Mika Westerberg
2017-06-13 15:10                 ` Mika Westerberg
2017-06-13 15:10                 ` Mika Westerberg
2017-06-13 19:01                 ` Gabriele Paoloni
2017-06-13 19:01                   ` Gabriele Paoloni
2017-06-13 19:01                   ` Gabriele Paoloni
2017-06-13 19:01                   ` Gabriele Paoloni
2017-06-13 20:03                   ` Mika Westerberg
2017-06-13 20:03                     ` Mika Westerberg
2017-06-13 20:03                     ` Mika Westerberg
2017-06-13 20:03                     ` Mika Westerberg
2017-06-15 18:01                     ` Gabriele Paoloni
2017-06-15 18:01                       ` Gabriele Paoloni
2017-06-15 18:01                       ` Gabriele Paoloni
2017-06-15 18:01                       ` Gabriele Paoloni
2017-06-16  8:33                       ` Mika Westerberg
2017-06-16  8:33                         ` Mika Westerberg
2017-06-16  8:33                         ` Mika Westerberg
2017-06-16  8:33                         ` Mika Westerberg
2017-06-16 11:24                         ` Rafael J. Wysocki
2017-06-16 11:24                           ` Rafael J. Wysocki
2017-06-16 11:24                           ` Rafael J. Wysocki
2017-06-16 11:24                           ` Rafael J. Wysocki
2017-06-16 12:00                           ` Mika Westerberg
2017-06-16 12:00                             ` Mika Westerberg
2017-06-16 12:00                             ` Mika Westerberg
2017-06-16 12:00                             ` Mika Westerberg
2017-06-16 12:22                             ` Rafael J. Wysocki
2017-06-16 12:22                               ` Rafael J. Wysocki
2017-06-16 12:22                               ` Rafael J. Wysocki
2017-06-16 12:22                               ` Rafael J. Wysocki
2017-06-19  9:50                               ` Gabriele Paoloni
2017-06-19  9:50                                 ` Gabriele Paoloni
2017-06-19  9:50                                 ` Gabriele Paoloni
2017-06-19  9:50                                 ` Gabriele Paoloni
2017-06-19 10:02                                 ` Mika Westerberg
2017-06-19 10:02                                   ` Mika Westerberg
2017-06-19 10:02                                   ` Mika Westerberg
2017-06-19 10:02                                   ` Mika Westerberg
2017-06-19 10:04                                   ` Gabriele Paoloni
2017-06-19 10:04                                     ` Gabriele Paoloni
2017-06-19 10:04                                     ` Gabriele Paoloni
2017-06-19 10:04                                     ` Gabriele Paoloni
2017-07-03 16:08                                     ` Gabriele Paoloni
2017-07-03 16:08                                       ` Gabriele Paoloni
2017-07-03 16:08                                       ` Gabriele Paoloni
2017-07-03 16:08                                       ` Gabriele Paoloni
2017-07-03 16:23                                       ` Gabriele Paoloni
2017-07-03 16:23                                         ` Gabriele Paoloni
2017-07-03 16:23                                         ` Gabriele Paoloni
2017-07-03 16:23                                         ` Gabriele Paoloni
2017-07-03 20:22                                       ` Andy Shevchenko
2017-07-03 20:22                                         ` Andy Shevchenko
2017-07-03 20:22                                         ` Andy Shevchenko
2017-07-03 20:22                                         ` Andy Shevchenko
2017-07-04 15:14                                         ` Gabriele Paoloni
2017-07-04 15:14                                           ` Gabriele Paoloni
2017-07-04 15:14                                           ` Gabriele Paoloni
2017-07-04 15:14                                           ` Gabriele Paoloni
2017-07-04 15:46                                           ` Andy Shevchenko
2017-07-04 15:46                                             ` Andy Shevchenko
2017-07-04 15:46                                             ` Andy Shevchenko
2017-07-04 15:46                                             ` Andy Shevchenko
2017-07-04 16:22                                             ` Gabriele Paoloni
2017-07-04 16:22                                               ` Gabriele Paoloni
2017-07-04 16:22                                               ` Gabriele Paoloni
2017-07-04 16:22                                               ` Gabriele Paoloni
2017-06-29 16:16                           ` John Garry
2017-06-29 16:16                             ` John Garry
2017-06-29 16:16                             ` John Garry
2017-06-29 16:16                             ` John Garry
2017-06-30  9:05                             ` Mika Westerberg
2017-06-30  9:05                               ` Mika Westerberg
2017-06-30  9:05                               ` Mika Westerberg
2017-06-30  9:05                               ` Mika Westerberg
2017-06-30  9:28                               ` John Garry
2017-06-30  9:28                                 ` John Garry
2017-06-30  9:28                                 ` John Garry
2017-06-30  9:28                                 ` John Garry
2017-06-30 12:56                                 ` Rafael J. Wysocki
2017-06-30 12:56                                   ` Rafael J. Wysocki
2017-06-30 12:56                                   ` Rafael J. Wysocki
2017-06-30 12:56                                   ` Rafael J. Wysocki
2017-05-25 11:37 ` Gabriele Paoloni [this message]
2017-05-25 11:37   ` [PATCH v9 6/7] LPC: Add the ACPI LPC support Gabriele Paoloni
2017-05-25 11:37   ` Gabriele Paoloni
2017-05-25 11:37   ` Gabriele Paoloni
2017-05-26  3:12   ` kbuild test robot
2017-05-26  3:12     ` kbuild test robot
2017-05-26  3:12     ` kbuild test robot
2017-05-26  3:12     ` kbuild test robot
2017-05-26 10:12     ` Gabriele Paoloni
2017-05-26 10:12       ` Gabriele Paoloni
2017-05-26 10:12       ` Gabriele Paoloni
2017-05-26 10:12       ` Gabriele Paoloni
2017-05-25 11:37 ` [PATCH v9 7/7] MANTAINERS: Add maintainer for HiSilicon LPC driver Gabriele Paoloni
2017-05-25 11:37   ` Gabriele Paoloni
2017-05-25 11:37   ` Gabriele Paoloni
2017-05-25 11:37   ` Gabriele Paoloni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1495712248-5232-7-git-send-email-gabriele.paoloni@huawei.com \
    --to=gabriele.paoloni@huawei.com \
    --cc=arnd@arndb.de \
    --cc=benh@kernel.crashing.org \
    --cc=bhelgaas@google.com \
    --cc=brian.starkey@arm.com \
    --cc=catalin.marinas@arm.com \
    --cc=frowand.list@gmail.com \
    --cc=john.garry@huawei.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=mark.rutland@arm.com \
    --cc=minyard@acm.org \
    --cc=olof@lixom.net \
    --cc=rafael@kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=will.deacon@arm.com \
    --cc=xuwei5@hisilicon.com \
    --cc=yuanzhichang@hisilicon.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.