Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933585AbdCMCSt (ORCPT ); Sun, 12 Mar 2017 22:18:49 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:4304 "EHLO dggrg01-dlp.huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751935AbdCMCSn (ORCPT ); Sun, 12 Mar 2017 22:18:43 -0400 From: "zhichang.yuan" To: , , , , , , , , , CC: , , , , , , , , , , , , , , , , "zhichang.yuan" Subject: [PATCH V7 7/7] LPC: Add the ACPI LPC support Date: Mon, 13 Mar 2017 10:42:43 +0800 Message-ID: <1489372963-9000-8-git-send-email-yuanzhichang@hisilicon.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1489372963-9000-1-git-send-email-yuanzhichang@hisilicon.com> References: <1489372963-9000-1-git-send-email-yuanzhichang@hisilicon.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A010204.58C5FFC9.000C,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: aa2a315b428ac4e49169c7906cf41405 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1747 Lines: 64 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 Signed-off-by: John Garry --- drivers/bus/hisi_lpc.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/drivers/bus/hisi_lpc.c b/drivers/bus/hisi_lpc.c index 345ea12..3796b1f 100644 --- a/drivers/bus/hisi_lpc.c +++ b/drivers/bus/hisi_lpc.c @@ -464,6 +464,27 @@ static int hisilpc_host_io_register(struct device *dev, lpcdev->io_host = range; + /* + * 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, root); + if (ret) { + dev_err(&child->dev, "set resource failed..\n"); + return ret; + } + } + } + return 0; } @@ -558,10 +579,18 @@ static int hisilpc_probe(struct platform_device *pdev) {}, }; +#ifdef CONFIG_ACPI +static const struct acpi_device_id hisilpc_acpi_match[] = { + {"HISI0191", }, + {}, +}; +#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, }; -- 1.9.1