From patchwork Tue Jan 23 16:36:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 125554 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp1832831ljf; Tue, 23 Jan 2018 07:46:47 -0800 (PST) X-Google-Smtp-Source: AH8x225O5UOuBn0z6W0EeOSdzt3/5b9NPvxKMaSVyCOWzdpg5xbu74fWCG3Cj0Nu93q4cm21Ikyk X-Received: by 10.36.123.137 with SMTP id q131mr4034875itc.121.1516722407325; Tue, 23 Jan 2018 07:46:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516722407; cv=none; d=google.com; s=arc-20160816; b=FQJrksfwX/Os+xhYQEIL+uZE9Ti0I5xqwvwO53Fme2sjj+XtRuMwx5WN8nAGO3zFm3 ja34JWGEy1eWgTw1h1S6Cl0gHlfkaLtPXNf0UrOGpA6/x6YXZGOMvTN4TZfSS1jVwRCh mCld9SjwBmORBPeZe7XvI8oyFRTMkKmWG86cDeoRjUqY5GF86+seCZhSQJONdfpshiT3 MXexZQ+jZizfIBhK/fT18RYxpQ4dVDlBS1oyg/Z45Z8TMwUuIS2UMf2q6xlM16xM9mkC LYxBKZp4tsXdfzCrRTUaQrxPBBvdDd2Jep3jN/MWrovdSUvXLv9dBfgU4In2xv1cY3Eh KX1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=POSFDRgCAtHWFOIUANlwetSbQ/3Aq69W1mseupVUcgk=; b=LQBV2GwPwGFIEtS1SoYe8GROnb9UbtzfvQs2hMErpeisiGRnL4a99NI9EewB3Uz2Be kCXnfEZguTEuklwgrHXvXhP7e7myEaPPXcelThwsnYV3elcXmN3sQ5DRYOe33hVwJ8PL Ps7FHKxBkMvRY5MyymzYu3tuy0dFVBvHsJJ6ov+REhZEnZM7UN3rHEctAo9U/KMplBKB rVLW8jI96Ig7vOOBjmqGHhETyvtVW6crdLnqu5gzOgQtf47wCDOPx0XlFpRnhZQWTfXZ /r42JyvZ09cJlwDtjV0Hwsq17B1TVhrgs43Ub+pBSMdrRTkFT1dCIXB2huFNhER5XgGC /jOQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 87si15313040iop.223.2018.01.23.07.46.47; Tue, 23 Jan 2018 07:46:47 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752284AbeAWPpl (ORCPT + 28 others); Tue, 23 Jan 2018 10:45:41 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:4683 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751615AbeAWPpf (ORCPT ); Tue, 23 Jan 2018 10:45:35 -0500 Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 99F8629A0A415; Tue, 23 Jan 2018 23:45:07 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id 14.3.361.1; Tue, 23 Jan 2018 23:45:00 +0800 From: John Garry To: , , , , , , , , , , CC: , , , , , , , , , John Garry , Zhichang Yuan , "Gabriele Paoloni" Subject: [PATCH v12 8/9] LPC, ACPI: Add the HISI LPC ACPI support Date: Wed, 24 Jan 2018 00:36:24 +0800 Message-ID: <1516725385-24535-9-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1516725385-24535-1-git-send-email-john.garry@huawei.com> References: <1516725385-24535-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Based on the previous patches, this patch supports the LPC host on Hip06/Hip07 for ACPI FW. Signed-off-by: John Garry Signed-off-by: Zhichang Yuan Signed-off-by: Gabriele Paoloni Tested-by: Dann Frazier --- drivers/acpi/arm64/acpi_indirectio.c | 11 ++++++++++- drivers/bus/hisi_lpc.c | 17 ++++++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) -- 1.9.1 diff --git a/drivers/acpi/arm64/acpi_indirectio.c b/drivers/acpi/arm64/acpi_indirectio.c index 2649f57..6403f84 100644 --- a/drivers/acpi/arm64/acpi_indirectio.c +++ b/drivers/acpi/arm64/acpi_indirectio.c @@ -142,7 +142,7 @@ int acpi_indirectio_set_logicio_res(struct device *child, return ret; } -int +static int acpi_indirectio_pre_setup(struct acpi_device *adev, struct acpi_indirectio_host_data *pdata) { @@ -239,8 +239,17 @@ int acpi_indirectio_set_logicio_res(struct device *child, return ret; } +const struct acpi_indirectio_device_desc hisi_lpc_host_desc = { + .pdata = { + .io_size = PIO_INDIRECT_SIZE, + .io_start = 0, + }, + .pre_setup = acpi_indirectio_pre_setup, +}; + /* All the host devices which apply indirect-IO can be listed here. */ static const struct acpi_device_id acpi_indirect_host_id[] = { + {"HISI0191", INDIRECT_IO_INFO(hisi_lpc_host_desc)}, {""}, }; diff --git a/drivers/bus/hisi_lpc.c b/drivers/bus/hisi_lpc.c index 4ce089a..9cabb84 100644 --- a/drivers/bus/hisi_lpc.c +++ b/drivers/bus/hisi_lpc.c @@ -457,7 +457,13 @@ static int hisilpc_probe(struct platform_device *pdev) } /* register the LPC host PIO resources */ - { + if (has_acpi_companion(dev)) { + lpcdev->io_host = find_io_range_by_fwnode(dev->fwnode); + if (!lpcdev->io_host) { + dev_err(dev, "range not registered!\n"); + return -EFAULT; + } + } else { struct logic_pio_hwaddr *range; range = devm_kzalloc(dev, sizeof(*range), GFP_KERNEL); @@ -515,10 +521,19 @@ 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, };