From patchwork Mon Mar 13 02:42:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhichang Yuan X-Patchwork-Id: 737951 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3vhLy62mVWz9s7K for ; Mon, 13 Mar 2017 13:13:34 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933073AbdCMCNV (ORCPT ); Sun, 12 Mar 2017 22:13:21 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:4301 "EHLO dggrg01-dlp.huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1755854AbdCMCNR (ORCPT ); Sun, 12 Mar 2017 22:13:17 -0400 Received: from 172.30.72.57 (EHLO DGGEML401-HUB.china.huawei.com) ([172.30.72.57]) by dggrg01-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id AKQ82053; Mon, 13 Mar 2017 10:11:20 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEML401-HUB.china.huawei.com (10.3.17.32) with Microsoft SMTP Server id 14.3.301.0; Mon, 13 Mar 2017 10:11:09 +0800 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 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-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org 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, };