summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Robinson <pbrobinson@gmail.com>2019-06-22 10:56:20 +0100
committerPeter Robinson <pbrobinson@gmail.com>2019-06-22 10:56:20 +0100
commit5a11487f7745892488cbfc8006cd133c000ffeb6 (patch)
treeebdedf51291432faa890a2e1c8602f4d8c2b5032
parentb0bc74c2361e228231f13ad8a79f939517f492f9 (diff)
downloadkernel-5a11487f7745892488cbfc8006cd133c000ffeb6.tar.gz
kernel-5a11487f7745892488cbfc8006cd133c000ffeb6.tar.xz
kernel-5a11487f7745892488cbfc8006cd133c000ffeb6.zip
QCom ACPI fixes
-rw-r--r--arm64-acpi-ignore-5.1-fadts-reported-as-5.0.patch41
-rw-r--r--arm64-acpi-make-ac-and-battery-drivers-available-on-non-x86.patch30
-rw-r--r--arm64-qcom-DWC3-USB-Add-support-for-ACPI-based-AArch64-Laptops.patch1002
-rw-r--r--arm64-qcom-pinctrl-support-for-ACPI.patch293
-rw-r--r--configs/fedora/generic/arm/aarch64/CONFIG_ACPI_AC1
-rw-r--r--configs/fedora/generic/arm/aarch64/CONFIG_ACPI_BATTERY1
-rw-r--r--kernel-aarch64-debug.config2
-rw-r--r--kernel-aarch64.config2
-rw-r--r--kernel.spec12
-rw-r--r--qcom-Provide-support-for-ACPI.patch841
10 files changed, 1382 insertions, 843 deletions
diff --git a/arm64-acpi-ignore-5.1-fadts-reported-as-5.0.patch b/arm64-acpi-ignore-5.1-fadts-reported-as-5.0.patch
new file mode 100644
index 000000000..6cf0ba926
--- /dev/null
+++ b/arm64-acpi-ignore-5.1-fadts-reported-as-5.0.patch
@@ -0,0 +1,41 @@
+From a7edc17544709d20f800dc0898096365a3d68613 Mon Sep 17 00:00:00 2001
+From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
+Date: Sun, 2 Jun 2019 16:36:15 +0200
+Subject: [PATCH] acpi/arm64: ignore 5.1 FADTs that are reported as 5.0
+
+Some Qualcomm Snapdragon based laptops built to run Microsoft Windows
+are clearly ACPI 5.1 based, given that that is the first ACPI revision
+that supports ARM, and introduced the FADT 'arm_boot_flags' field,
+which has a non-zero field on those systems.
+
+So in these cases, infer from the ARM boot flags that the FADT must be
+5.1 or later, and treat it as 5.1.
+
+Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
+---
+ arch/arm64/kernel/acpi.c | 10 +++++++---
+ 1 file changed, 7 insertions(+), 3 deletions(-)
+
+diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
+index 803f0494dd3e3..7722e85fb69c3 100644
+--- a/arch/arm64/kernel/acpi.c
++++ b/arch/arm64/kernel/acpi.c
+@@ -155,10 +155,14 @@ static int __init acpi_fadt_sanity_check(void)
+ */
+ if (table->revision < 5 ||
+ (table->revision == 5 && fadt->minor_revision < 1)) {
+- pr_err("Unsupported FADT revision %d.%d, should be 5.1+\n",
++ pr_err(FW_BUG "Unsupported FADT revision %d.%d, should be 5.1+\n",
+ table->revision, fadt->minor_revision);
+- ret = -EINVAL;
+- goto out;
++
++ if (!fadt->arm_boot_flags) {
++ ret = -EINVAL;
++ goto out;
++ }
++ pr_err("FADT has ARM boot flags set, assuming 5.1\n");
+ }
+
+ if (!(fadt->flags & ACPI_FADT_HW_REDUCED)) {
+
diff --git a/arm64-acpi-make-ac-and-battery-drivers-available-on-non-x86.patch b/arm64-acpi-make-ac-and-battery-drivers-available-on-non-x86.patch
new file mode 100644
index 000000000..14e0eebf6
--- /dev/null
+++ b/arm64-acpi-make-ac-and-battery-drivers-available-on-non-x86.patch
@@ -0,0 +1,30 @@
+From 7b87bc98ab598ae40ef1818fb0c420d61dd87ed1 Mon Sep 17 00:00:00 2001
+From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
+Date: Mon, 3 Jun 2019 08:37:11 +0200
+Subject: [PATCH] acpi: make AC and battery drivers available on !X86
+
+Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
+---
+ drivers/acpi/Kconfig | 2 --
+ 1 file changed, 2 deletions(-)
+
+diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
+index e016f7a6ed136..3c8011e7b0d7c 100644
+--- a/drivers/acpi/Kconfig
++++ b/drivers/acpi/Kconfig
+@@ -155,7 +155,6 @@ config ACPI_EC_DEBUGFS
+
+ config ACPI_AC
+ tristate "AC Adapter"
+- depends on X86
+ select POWER_SUPPLY
+ default y
+ help
+@@ -168,7 +167,6 @@ config ACPI_AC
+
+ config ACPI_BATTERY
+ tristate "Battery"
+- depends on X86
+ select POWER_SUPPLY
+ default y
+ help
diff --git a/arm64-qcom-DWC3-USB-Add-support-for-ACPI-based-AArch64-Laptops.patch b/arm64-qcom-DWC3-USB-Add-support-for-ACPI-based-AArch64-Laptops.patch
new file mode 100644
index 000000000..ece8d7af4
--- /dev/null
+++ b/arm64-qcom-DWC3-USB-Add-support-for-ACPI-based-AArch64-Laptops.patch
@@ -0,0 +1,1002 @@
+From patchwork Mon Jun 17 12:51:02 2019
+Content-Type: text/plain; charset="utf-8"
+MIME-Version: 1.0
+Content-Transfer-Encoding: 7bit
+X-Patchwork-Submitter: Lee Jones <lee.jones@linaro.org>
+X-Patchwork-Id: 10999157
+Return-Path:
+ <linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org>
+Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org
+ [172.30.200.125])
+ by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B7F1314BB
+ for <patchwork-linux-arm@patchwork.kernel.org>;
+ Mon, 17 Jun 2019 12:51:26 +0000 (UTC)
+Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1])
+ by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A8630286B3
+ for <patchwork-linux-arm@patchwork.kernel.org>;
+ Mon, 17 Jun 2019 12:51:26 +0000 (UTC)
+Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486)
+ id A691B286B8; Mon, 17 Jun 2019 12:51:26 +0000 (UTC)
+X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on
+ pdx-wl-mail.web.codeaurora.org
+X-Spam-Level:
+X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED,
+ DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1
+Received: from bombadil.infradead.org (bombadil.infradead.org
+ [198.137.202.133])
+ (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits))
+ (No client certificate requested)
+ by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0AC2128910
+ for <patchwork-linux-arm@patchwork.kernel.org>;
+ Mon, 17 Jun 2019 12:51:25 +0000 (UTC)
+DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
+ d=lists.infradead.org; s=bombadil.20170209; h=Sender:
+ Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe:
+ List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References:
+ In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID:
+ Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
+ :Resent-Message-ID:List-Owner;
+ bh=hzd/ICcUtJ+qnY0TkQdQ/iqHchKimp0FpVwcGtPGgc4=; b=gs1Cboo2h8ZzR/erqYcUplo5Zl
+ kriLADbQY4FHKFwsCNhA8pnzI2v6O+vkVQvT8LacdXPkoTeBZ+HbujdKRUkqmjKPMYtG0Q3onvHQc
+ XcSThhrpJSJbDPR+e4SsBF5KOuTrXtDCUy4TIHAXVOQKow1tnieYvX17S9R5eZ96zdiG5mphR24fC
+ IQRF58TLVlspAu6KbO4vGgvef7A+R7rld5MmyzefOvmg5X1OAmBHLaI0Ifg0fpc2ihfyeQgjQaF9H
+ Sl4mE20tulm2qqwgB4o2Lu6EvLVO1OqwBZbV62O8lkUZQhB6YYo2tqAX6GaBkNEkADEhAxsYEiO7i
+ +T+ewIAw==;
+Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org)
+ by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux))
+ id 1hcr6a-0004ri-Gm; Mon, 17 Jun 2019 12:51:24 +0000
+Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444])
+ by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux))
+ id 1hcr6N-0004gG-5m
+ for linux-arm-kernel@lists.infradead.org; Mon, 17 Jun 2019 12:51:12 +0000
+Received: by mail-wr1-x444.google.com with SMTP id f9so9772453wre.12
+ for <linux-arm-kernel@lists.infradead.org>;
+ Mon, 17 Jun 2019 05:51:10 -0700 (PDT)
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google;
+ h=from:to:cc:subject:date:message-id:in-reply-to:references;
+ bh=2zuxNNJ4iuFL5CUgXXBK/C8GK/Wfm+gcHDg2NkvAFB8=;
+ b=q+s/96q0GvL81bpISKq1BYq2qgGMpiINLYY94rSfeJIBgtJ0JASEtiXtDPecNFmtZL
+ IVM+FA8aky8PBmnMLL4+Kt0aJ3tCYdUb9UEdfNN6lMqZIm32xgDsGAGZEN75E5BGglZ5
+ O0qHpPxDxjps+O6mgY7ewWjzgrArHawuVqm5pgALhFmzbvj/vTigwdNoWTRq+QYjzbQW
+ X4PP0kzs+r42vn1y/uQP2HCx+p4e6qaylctjsm4b3GGzN1UOWC+lSwN5UNNB59hZ9phn
+ mt8/uuVdLmFh2bLj3JPXGKXcTYEITepZw7iCLKx8El0VEXOnDiwDYGwUZY8bVg2fGUtk
+ a2Ig==
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
+ d=1e100.net; s=20161025;
+ h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
+ :references;
+ bh=2zuxNNJ4iuFL5CUgXXBK/C8GK/Wfm+gcHDg2NkvAFB8=;
+ b=oEWv7zocZKRfTgHf4lf/nnyVbj27HULH3eZBiAvukYZEy5p/04tKCn2xcjT0OupDq1
+ JtpVjK45a/MT9EP3Q/pSczzpTAIukOZW8LSC0ZXb4h4JQBT/ujIaD6DvM2wwlDk1WJeh
+ hkzOO9qchV2sFB+hwWHCmWYkYfZ8ho6MPHJTnBG50J4aG03XZf8/wecsAZ3u97yuREXb
+ qgUDKvDB5WfS+Zu6k0IsITnMONtutyCaWI1xZ1I7tuVxYkROxaUG9L7ihFnaZL74UCuB
+ C+Hc6U8HY+y/m86LFHP76m6tpOxuUfZARSlzOkmGi/4QPMReV54qtbTGEX2NeRxAPd1d
+ OIDA==
+X-Gm-Message-State: APjAAAU8mxXZGAfxADTLzRLiH5CIXMt9t7Nr3DoYsZO8CGVoMOXu7BYs
+ OGDCo19OAKar6a7vPcigSgL5yA==
+X-Google-Smtp-Source:
+ APXvYqxQmsT3xz0CBZrCiSA472UgfglVRfGZm5u9OAQIPSBLxsX3r/VA44xZ+WxLMb03U8CAncn0Ag==
+X-Received: by 2002:a5d:6050:: with SMTP id j16mr6799737wrt.20.1560775869586;
+ Mon, 17 Jun 2019 05:51:09 -0700 (PDT)
+Received: from dell.watershed.co.uk ([2.27.35.243])
+ by smtp.gmail.com with ESMTPSA id o11sm10477852wmh.37.2019.06.17.05.51.08
+ (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
+ Mon, 17 Jun 2019 05:51:09 -0700 (PDT)
+From: Lee Jones <lee.jones@linaro.org>
+To: alokc@codeaurora.org, agross@kernel.org, david.brown@linaro.org,
+ bjorn.andersson@linaro.org, balbi@kernel.org, gregkh@linuxfoundation.org,
+ ard.biesheuvel@linaro.org, jlhugo@gmail.com, linux-arm-msm@vger.kernel.org,
+ linux-usb@vger.kernel.org, felipe.balbi@linux.intel.com
+Subject: [RESEND v4 1/4] soc: qcom: geni: Add support for ACPI
+Date: Mon, 17 Jun 2019 13:51:02 +0100
+Message-Id: <20190617125105.6186-2-lee.jones@linaro.org>
+X-Mailer: git-send-email 2.17.1
+In-Reply-To: <20190617125105.6186-1-lee.jones@linaro.org>
+References: <20190617125105.6186-1-lee.jones@linaro.org>
+X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3
+X-CRM114-CacheID: sfid-20190617_055111_214407_390679F0
+X-CRM114-Status: GOOD ( 13.52 )
+X-BeenThere: linux-arm-kernel@lists.infradead.org
+X-Mailman-Version: 2.1.29
+Precedence: list
+List-Id: <linux-arm-kernel.lists.infradead.org>
+List-Unsubscribe:
+ <http://lists.infradead.org/mailman/options/linux-arm-kernel>,
+ <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe>
+List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/>
+List-Post: <mailto:linux-arm-kernel@lists.infradead.org>
+List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help>
+List-Subscribe:
+ <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>,
+ <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe>
+Cc: Lee Jones <lee.jones@linaro.org>, linux-kernel@vger.kernel.org,
+ linux-arm-kernel@lists.infradead.org
+MIME-Version: 1.0
+Content-Type: text/plain; charset="us-ascii"
+Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org>
+Errors-To:
+ linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org
+X-Virus-Scanned: ClamAV using ClamSMTP
+
+When booting with ACPI as the active set of configuration tables,
+all; clocks, regulators, pin functions ect are expected to be at
+their ideal values/levels/rates, thus the associated frameworks
+are unavailable. Ensure calls to these APIs are shielded when
+ACPI is enabled.
+
+Signed-off-by: Lee Jones <lee.jones@linaro.org>
+Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
+---
+ drivers/soc/qcom/qcom-geni-se.c | 21 +++++++++++++++------
+ 1 file changed, 15 insertions(+), 6 deletions(-)
+
+diff --git a/drivers/soc/qcom/qcom-geni-se.c b/drivers/soc/qcom/qcom-geni-se.c
+index 6b8ef01472e9..d5cf953b4337 100644
+--- a/drivers/soc/qcom/qcom-geni-se.c
++++ b/drivers/soc/qcom/qcom-geni-se.c
+@@ -1,6 +1,7 @@
+ // SPDX-License-Identifier: GPL-2.0
+ // Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
+
++#include <linux/acpi.h>
+ #include <linux/clk.h>
+ #include <linux/slab.h>
+ #include <linux/dma-mapping.h>
+@@ -450,6 +451,9 @@ int geni_se_resources_off(struct geni_se *se)
+ {
+ int ret;
+
++ if (has_acpi_companion(se->dev))
++ return 0;
++
+ ret = pinctrl_pm_select_sleep_state(se->dev);
+ if (ret)
+ return ret;
+@@ -487,6 +491,9 @@ int geni_se_resources_on(struct geni_se *se)
+ {
+ int ret;
+
++ if (has_acpi_companion(se->dev))
++ return 0;
++
+ ret = geni_se_clks_on(se);
+ if (ret)
+ return ret;
+@@ -724,12 +731,14 @@ static int geni_se_probe(struct platform_device *pdev)
+ if (IS_ERR(wrapper->base))
+ return PTR_ERR(wrapper->base);
+
+- wrapper->ahb_clks[0].id = "m-ahb";
+- wrapper->ahb_clks[1].id = "s-ahb";
+- ret = devm_clk_bulk_get(dev, NUM_AHB_CLKS, wrapper->ahb_clks);
+- if (ret) {
+- dev_err(dev, "Err getting AHB clks %d\n", ret);
+- return ret;
++ if (!has_acpi_companion(&pdev->dev)) {
++ wrapper->ahb_clks[0].id = "m-ahb";
++ wrapper->ahb_clks[1].id = "s-ahb";
++ ret = devm_clk_bulk_get(dev, NUM_AHB_CLKS, wrapper->ahb_clks);
++ if (ret) {
++ dev_err(dev, "Err getting AHB clks %d\n", ret);
++ return ret;
++ }
+ }
+
+ dev_set_drvdata(dev, wrapper);
+
+From patchwork Mon Jun 17 12:51:03 2019
+Content-Type: text/plain; charset="utf-8"
+MIME-Version: 1.0
+Content-Transfer-Encoding: 7bit
+X-Patchwork-Submitter: Lee Jones <lee.jones@linaro.org>
+X-Patchwork-Id: 10999167
+Return-Path:
+ <linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org>
+Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org
+ [172.30.200.125])
+ by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E1A4214BB
+ for <patchwork-linux-arm@patchwork.kernel.org>;
+ Mon, 17 Jun 2019 12:51:48 +0000 (UTC)
+Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1])
+ by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D06A5286E6
+ for <patchwork-linux-arm@patchwork.kernel.org>;
+ Mon, 17 Jun 2019 12:51:48 +0000 (UTC)
+Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486)
+ id C4C772871F; Mon, 17 Jun 2019 12:51:48 +0000 (UTC)
+X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on
+ pdx-wl-mail.web.codeaurora.org
+X-Spam-Level:
+X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED,
+ DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable
+ version=3.3.1
+Received: from bombadil.infradead.org (bombadil.infradead.org
+ [198.137.202.133])
+ (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits))
+ (No client certificate requested)
+ by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D3C9228606
+ for <patchwork-linux-arm@patchwork.kernel.org>;
+ Mon, 17 Jun 2019 12:51:47 +0000 (UTC)
+DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
+ d=lists.infradead.org; s=bombadil.20170209; h=Sender:
+ Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe:
+ List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References:
+ In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID:
+ Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
+ :Resent-Message-ID:List-Owner;
+ bh=eqPeWeTSDW4tiMKnyJbFGfuUug/NP8BBhk/eXQMhuTs=; b=I7CwybOukEfOb8t13TjIrgAV4y
+ 4tH7lG3nM0NXHmiucaIDp4bKD5ly5m7WWzGSIEkg7/U4+EQjpiVd+H3sSH5wmvTRJ/y5J8eRrbiIg
+ DBauCWtmaNnCtHgysxinvyab3cb0ZdRkIKojvbFM9/rA7CNIN22US4++LPC5rDg2FcGknTRyIFaiG
+ rdLXD9yxEYf7K9xhxwIegcc6Zn2ZUOrjzYBt6+fxj85Gx0TWgBdfAGZFl8r+AF8HCXWaNiZjUQlav
+ eZlT6gbr5k/zdCU9/en4cY4fFIdULxg/C5EOMbqV+T9ce52uMt6YrMIeQ+3asgZROgxfua0gGWZ5V
+ cQOaQgWQ==;
+Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org)
+ by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux))
+ id 1hcr6w-0005AV-Te; Mon, 17 Jun 2019 12:51:46 +0000
+Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441])
+ by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux))
+ id 1hcr6O-0004gf-45
+ for linux-arm-kernel@lists.infradead.org; Mon, 17 Jun 2019 12:51:13 +0000
+Received: by mail-wr1-x441.google.com with SMTP id f9so9772521wre.12
+ for <linux-arm-kernel@lists.infradead.org>;
+ Mon, 17 Jun 2019 05:51:11 -0700 (PDT)
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google;
+ h=from:to:cc:subject:date:message-id:in-reply-to:references;
+ bh=ZYares2Zb0CMG5aj1Aq17AxyznnInv9luLnQDrDhVlk=;
+ b=r5dCfxbvH3U5b5C4s33cPxDL1vD/tiW6V96ulvZngp0n/hqT3oktaEclOpyvDC+R58
+ SUfga9aWqbblZtMjr1jj22q46oZc0+qKFJJy1aIwr4ioiZXw8JKRWjnzTglMlhSmvRNj
+ FVCMZY11tsUacCETtgDReiUPN8Om7954wN6SXEkjDtExGnUmuVdTekdpD4US9VRnT5QK
+ i9DLIIfQpyKMQ7VZs5zCI/sBlpMqVBcEZB+9OtVbGIefAMiOnHCEX5mS3c7uu2R1dWb5
+ ggotZKzJpFMA5Mmyzcjj0yPYPWAlMpFx7OZ+P1ZMGP9dwu1u4tj4YPT/IVry3dFV/Yv8
+ YuZQ==
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
+ d=1e100.net; s=20161025;
+ h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
+ :references;
+ bh=ZYares2Zb0CMG5aj1Aq17AxyznnInv9luLnQDrDhVlk=;
+ b=PNg7mntx38NTDxi7cw63EQergFuUJW0s/McRf3KqBgZn60Dr6RjLQ9Pr+hTVheXOj1
+ Yx2COODJLvl0fBxu1/yBZkuPtXxp2p+ASg4+MbAMMcyrkvgpQ6BId0qMtAX6yTIx0Bll
+ sggfQhYcHrGp8EfLBW2RQws5V9Emp2WzZtyjNXzOD4DpDKV3YAI+j4sHusXrwa5xEu2N
+ eGDXG2Mt/icgywLN3k97OmLea06sFRlYf7KYZRxcfE2R6GP522NSHZzNYoJkqgZsBi3Z
+ 2TdYKdw0o9cJHRI2OiapUQ08YLIv0BSmAJaVSPbxEjqa/tn57ty3h+ni5R4lbPEwaGAi
+ pZog==
+X-Gm-Message-State: APjAAAVU7/rtL+UwLWfEM6vsQiiKLK8VD/zwoFn1P33esVlYh5EU2pqr
+ reXEg1fc4ji+BKvEjq+M3I+eFA==
+X-Google-Smtp-Source:
+ APXvYqw4tU4zKvNxRkTtQHBbmrMwW6oDHDoXraOjSJrJg7Vgc+uuvKDECbAHi2x2yB80DzNCJv6ODQ==
+X-Received: by 2002:a5d:5386:: with SMTP id d6mr24077969wrv.207.1560775870686;
+ Mon, 17 Jun 2019 05:51:10 -0700 (PDT)
+Received: from dell.watershed.co.uk ([2.27.35.243])
+ by smtp.gmail.com with ESMTPSA id o11sm10477852wmh.37.2019.06.17.05.51.09
+ (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
+ Mon, 17 Jun 2019 05:51:10 -0700 (PDT)
+From: Lee Jones <lee.jones@linaro.org>
+To: alokc@codeaurora.org, agross@kernel.org, david.brown@linaro.org,
+ bjorn.andersson@linaro.org, balbi@kernel.org, gregkh@linuxfoundation.org,
+ ard.biesheuvel@linaro.org, jlhugo@gmail.com, linux-arm-msm@vger.kernel.org,
+ linux-usb@vger.kernel.org, felipe.balbi@linux.intel.com
+Subject: [RESEND v4 2/4] usb: dwc3: qcom: Add support for booting with ACPI
+Date: Mon, 17 Jun 2019 13:51:03 +0100
+Message-Id: <20190617125105.6186-3-lee.jones@linaro.org>
+X-Mailer: git-send-email 2.17.1
+In-Reply-To: <20190617125105.6186-1-lee.jones@linaro.org>
+References: <20190617125105.6186-1-lee.jones@linaro.org>
+X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3
+X-CRM114-CacheID: sfid-20190617_055112_164384_7E92DD4C
+X-CRM114-Status: GOOD ( 21.26 )
+X-BeenThere: linux-arm-kernel@lists.infradead.org
+X-Mailman-Version: 2.1.29
+Precedence: list
+List-Id: <linux-arm-kernel.lists.infradead.org>
+List-Unsubscribe:
+ <http://lists.infradead.org/mailman/options/linux-arm-kernel>,
+ <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe>
+List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/>
+List-Post: <mailto:linux-arm-kernel@lists.infradead.org>
+List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help>
+List-Subscribe:
+ <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>,
+ <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe>
+Cc: Lee Jones <lee.jones@linaro.org>, linux-kernel@vger.kernel.org,
+ linux-arm-kernel@lists.infradead.org
+MIME-Version: 1.0
+Content-Type: text/plain; charset="us-ascii"
+Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org>
+Errors-To:
+ linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org
+X-Virus-Scanned: ClamAV using ClamSMTP
+
+In Linux, the DWC3 core exists as its own independent platform device.
+Thus when describing relationships in Device Tree, the current default
+boot configuration table option, the DWC3 core often resides as a child
+of the platform specific node. Both of which are given their own
+address space descriptions and the drivers can be mostly agnostic to
+each other.
+
+However, other Operating Systems have taken a more monolithic approach,
+which is evident in the configuration ACPI tables for the Qualcomm
+Snapdragon SDM850, where all DWC3 (core and platform) components are
+described under a single IO memory region.
+
+To ensure successful booting using the supplied ACPI tables, we need to
+devise a way to chop up the address regions provided and subsequently
+register the DWC3 core with the resultant information, which is
+precisely what this patch aims to achieve.
+
+Signed-off-by: Lee Jones <lee.jones@linaro.org>
+Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
+---
+ drivers/usb/dwc3/Kconfig | 2 +-
+ drivers/usb/dwc3/dwc3-qcom.c | 206 ++++++++++++++++++++++++++++++-----
+ 2 files changed, 179 insertions(+), 29 deletions(-)
+
+diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig
+index 4a62045cc812..89abc6078703 100644
+--- a/drivers/usb/dwc3/Kconfig
++++ b/drivers/usb/dwc3/Kconfig
+@@ -128,7 +128,7 @@ config USB_DWC3_QCOM
+ tristate "Qualcomm Platform"
+ depends on ARCH_QCOM || COMPILE_TEST
+ depends on EXTCON || !EXTCON
+- depends on OF
++ depends on (OF || ACPI)
+ default USB_DWC3
+ help
+ Some Qualcomm SoCs use DesignWare Core IP for USB2/3
+diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
+index 184df4daa590..0cb63f6c92d9 100644
+--- a/drivers/usb/dwc3/dwc3-qcom.c
++++ b/drivers/usb/dwc3/dwc3-qcom.c
+@@ -4,6 +4,7 @@
+ * Inspired by dwc3-of-simple.c
+ */
+
++#include <linux/acpi.h>
+ #include <linux/io.h>
+ #include <linux/of.h>
+ #include <linux/clk.h>
+@@ -38,6 +39,20 @@
+ #define PWR_EVNT_LPM_IN_L2_MASK BIT(4)
+ #define PWR_EVNT_LPM_OUT_L2_MASK BIT(5)
+
++#define SDM845_QSCRATCH_BASE_OFFSET 0xf8800
++#define SDM845_QSCRATCH_SIZE 0x400
++#define SDM845_DWC3_CORE_SIZE 0xcd00
++
++struct dwc3_acpi_pdata {
++ u32 qscratch_base_offset;
++ u32 qscratch_base_size;
++ u32 dwc3_core_base_size;
++ int hs_phy_irq_index;
++ int dp_hs_phy_irq_index;
++ int dm_hs_phy_irq_index;
++ int ss_phy_irq_index;
++};
++
+ struct dwc3_qcom {
+ struct device *dev;
+ void __iomem *qscratch_base;
+@@ -56,6 +71,8 @@ struct dwc3_qcom {
+ struct notifier_block vbus_nb;
+ struct notifier_block host_nb;
+
++ const struct dwc3_acpi_pdata *acpi_pdata;
++
+ enum usb_dr_mode mode;
+ bool is_suspended;
+ bool pm_suspended;
+@@ -300,12 +317,27 @@ static void dwc3_qcom_select_utmi_clk(struct dwc3_qcom *qcom)
+ PIPE_UTMI_CLK_DIS);
+ }
+
++static int dwc3_qcom_get_irq(struct platform_device *pdev,
++ const char *name, int num)
++{
++ struct device_node *np = pdev->dev.of_node;
++ int ret;
++
++ if (np)
++ ret = platform_get_irq_byname(pdev, name);
++ else
++ ret = platform_get_irq(pdev, num);
++
++ return ret;
++}
++
+ static int dwc3_qcom_setup_irq(struct platform_device *pdev)
+ {
+ struct dwc3_qcom *qcom = platform_get_drvdata(pdev);
++ const struct dwc3_acpi_pdata *pdata = qcom->acpi_pdata;
+ int irq, ret;
+-
+- irq = platform_get_irq_byname(pdev, "hs_phy_irq");
++ irq = dwc3_qcom_get_irq(pdev, "hs_phy_irq",
++ pdata ? pdata->hs_phy_irq_index : -1);
+ if (irq > 0) {
+ /* Keep wakeup interrupts disabled until suspend */
+ irq_set_status_flags(irq, IRQ_NOAUTOEN);
+@@ -320,7 +352,8 @@ static int dwc3_qcom_setup_irq(struct platform_device *pdev)
+ qcom->hs_phy_irq = irq;
+ }
+
+- irq = platform_get_irq_byname(pdev, "dp_hs_phy_irq");
++ irq = dwc3_qcom_get_irq(pdev, "dp_hs_phy_irq",
++ pdata ? pdata->dp_hs_phy_irq_index : -1);
+ if (irq > 0) {
+ irq_set_status_flags(irq, IRQ_NOAUTOEN);
+ ret = devm_request_threaded_irq(qcom->dev, irq, NULL,
+@@ -334,7 +367,8 @@ static int dwc3_qcom_setup_irq(struct platform_device *pdev)
+ qcom->dp_hs_phy_irq = irq;
+ }
+
+- irq = platform_get_irq_byname(pdev, "dm_hs_phy_irq");
++ irq = dwc3_qcom_get_irq(pdev, "dm_hs_phy_irq",
++ pdata ? pdata->dm_hs_phy_irq_index : -1);
+ if (irq > 0) {
+ irq_set_status_flags(irq, IRQ_NOAUTOEN);
+ ret = devm_request_threaded_irq(qcom->dev, irq, NULL,
+@@ -348,7 +382,8 @@ static int dwc3_qcom_setup_irq(struct platform_device *pdev)
+ qcom->dm_hs_phy_irq = irq;
+ }
+
+- irq = platform_get_irq_byname(pdev, "ss_phy_irq");
++ irq = dwc3_qcom_get_irq(pdev, "ss_phy_irq",
++ pdata ? pdata->ss_phy_irq_index : -1);
+ if (irq > 0) {
+ irq_set_status_flags(irq, IRQ_NOAUTOEN);
+ ret = devm_request_threaded_irq(qcom->dev, irq, NULL,
+@@ -371,11 +406,11 @@ static int dwc3_qcom_clk_init(struct dwc3_qcom *qcom, int count)
+ struct device_node *np = dev->of_node;
+ int i;
+
+- qcom->num_clocks = count;
+-
+- if (!count)
++ if (!np || !count)
+ return 0;
+
++ qcom->num_clocks = count;
++
+ qcom->clks = devm_kcalloc(dev, qcom->num_clocks,
+ sizeof(struct clk *), GFP_KERNEL);
+ if (!qcom->clks)
+@@ -409,12 +444,103 @@ static int dwc3_qcom_clk_init(struct dwc3_qcom *qcom, int count)
+ return 0;
+ }
+
+-static int dwc3_qcom_probe(struct platform_device *pdev)
++static int dwc3_qcom_acpi_register_core(struct platform_device *pdev)
+ {
++ struct dwc3_qcom *qcom = platform_get_drvdata(pdev);
++ struct device *dev = &pdev->dev;
++ struct resource *res, *child_res = NULL;
++ int irq;
++ int ret;
++
++ qcom->dwc3 = platform_device_alloc("dwc3", PLATFORM_DEVID_AUTO);
++ if (!qcom->dwc3)
++ return -ENOMEM;
++
++ qcom->dwc3->dev.parent = dev;
++ qcom->dwc3->dev.type = dev->type;
++ qcom->dwc3->dev.dma_mask = dev->dma_mask;
++ qcom->dwc3->dev.dma_parms = dev->dma_parms;
++ qcom->dwc3->dev.coherent_dma_mask = dev->coherent_dma_mask;
++
++ child_res = kcalloc(2, sizeof(*child_res), GFP_KERNEL);
++ if (!child_res)
++ return -ENOMEM;
++
++ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
++ if (!res) {
++ dev_err(&pdev->dev, "failed to get memory resource\n");
++ ret = -ENODEV;
++ goto out;
++ }
++
++ child_res[0].flags = res->flags;
++ child_res[0].start = res->start;
++ child_res[0].end = child_res[0].start +
++ qcom->acpi_pdata->dwc3_core_base_size;
++
++ irq = platform_get_irq(pdev, 0);
++ child_res[1].flags = IORESOURCE_IRQ;
++ child_res[1].start = child_res[1].end = irq;
++
++ ret = platform_device_add_resources(qcom->dwc3, child_res, 2);
++ if (ret) {
++ dev_err(&pdev->dev, "failed to add resources\n");
++ goto out;
++ }
++
++ ret = platform_device_add(qcom->dwc3);
++ if (ret)
++ dev_err(&pdev->dev, "failed to add device\n");
++
++out:
++ kfree(child_res);
++ return ret;
++}
++
++static int dwc3_qcom_of_register_core(struct platform_device *pdev)
++{
++ struct dwc3_qcom *qcom = platform_get_drvdata(pdev);
+ struct device_node *np = pdev->dev.of_node, *dwc3_np;
+ struct device *dev = &pdev->dev;
++ int ret;
++
++ dwc3_np = of_get_child_by_name(np, "dwc3");
++ if (!dwc3_np) {
++ dev_err(dev, "failed to find dwc3 core child\n");
++ return -ENODEV;
++ }
++
++ ret = of_platform_populate(np, NULL, NULL, dev);
++ if (ret) {
++ dev_err(dev, "failed to register dwc3 core - %d\n", ret);
++ return ret;
++ }
++
++ qcom->dwc3 = of_find_device_by_node(dwc3_np);
++ if (!qcom->dwc3) {
++ dev_err(dev, "failed to get dwc3 platform device\n");
++ return -ENODEV;
++ }
++
++ return 0;
++}
++
++static const struct dwc3_acpi_pdata sdm845_acpi_pdata = {
++ .qscratch_base_offset = SDM845_QSCRATCH_BASE_OFFSET,
++ .qscratch_base_size = SDM845_QSCRATCH_SIZE,
++ .dwc3_core_base_size = SDM845_DWC3_CORE_SIZE,
++ .hs_phy_irq_index = 1,
++ .dp_hs_phy_irq_index = 4,
++ .dm_hs_phy_irq_index = 3,
++ .ss_phy_irq_index = 2
++};
++
++static int dwc3_qcom_probe(struct platform_device *pdev)
++{
++ struct device_node *np = pdev->dev.of_node;
++ struct device *dev = &pdev->dev;
+ struct dwc3_qcom *qcom;
+- struct resource *res;
++ struct resource *res, *parent_res = NULL;
+ int ret, i;
+ bool ignore_pipe_clk;
+
+@@ -425,6 +551,14 @@ static int dwc3_qcom_probe(struct platform_device *pdev)
+ platform_set_drvdata(pdev, qcom);
+ qcom->dev = &pdev->dev;
+
++ if (has_acpi_companion(dev)) {
++ qcom->acpi_pdata = acpi_device_get_match_data(dev);
++ if (!qcom->acpi_pdata) {
++ dev_err(&pdev->dev, "no supporting ACPI device data\n");
++ return -EINVAL;
++ }
++ }
++
+ qcom->resets = devm_reset_control_array_get_optional_exclusive(dev);
+ if (IS_ERR(qcom->resets)) {
+ ret = PTR_ERR(qcom->resets);
+@@ -454,7 +588,21 @@ static int dwc3_qcom_probe(struct platform_device *pdev)
+ }
+
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+- qcom->qscratch_base = devm_ioremap_resource(dev, res);
++
++ if (np) {
++ parent_res = res;
++ } else {
++ parent_res = kmemdup(res, sizeof(struct resource), GFP_KERNEL);
++ if (!parent_res)
++ return -ENOMEM;
++
++ parent_res->start = res->start +
++ qcom->acpi_pdata->qscratch_base_offset;
++ parent_res->end = parent_res->start +
++ qcom->acpi_pdata->qscratch_base_size;
++ }
++
++ qcom->qscratch_base = devm_ioremap_resource(dev, parent_res);
+ if (IS_ERR(qcom->qscratch_base)) {
+ dev_err(dev, "failed to map qscratch, err=%d\n", ret);
+ ret = PTR_ERR(qcom->qscratch_base);
+@@ -462,13 +610,8 @@ static int dwc3_qcom_probe(struct platform_device *pdev)
+ }
+
+ ret = dwc3_qcom_setup_irq(pdev);
+- if (ret)
+- goto clk_disable;
+-
+- dwc3_np = of_get_child_by_name(np, "dwc3");
+- if (!dwc3_np) {
+- dev_err(dev, "failed to find dwc3 core child\n");
+- ret = -ENODEV;
++ if (ret) {
++ dev_err(dev, "failed to setup IRQs, err=%d\n", ret);
+ goto clk_disable;
+ }
+
+@@ -481,16 +624,13 @@ static int dwc3_qcom_probe(struct platform_device *pdev)
+ if (ignore_pipe_clk)
+ dwc3_qcom_select_utmi_clk(qcom);
+
+- ret = of_platform_populate(np, NULL, NULL, dev);
+- if (ret) {
+- dev_err(dev, "failed to register dwc3 core - %d\n", ret);
+- goto clk_disable;
+- }
++ if (np)
++ ret = dwc3_qcom_of_register_core(pdev);
++ else
++ ret = dwc3_qcom_acpi_register_core(pdev);
+
+- qcom->dwc3 = of_find_device_by_node(dwc3_np);
+- if (!qcom->dwc3) {
+- dev_err(&pdev->dev, "failed to get dwc3 platform device\n");
+- ret = -ENODEV;
++ if (ret) {
++ dev_err(dev, "failed to register DWC3 Core, err=%d\n", ret);
+ goto depopulate;
+ }
+
+@@ -514,7 +654,10 @@ static int dwc3_qcom_probe(struct platform_device *pdev)
+ return 0;
+
+ depopulate:
+- of_platform_depopulate(&pdev->dev);
++ if (np)
++ of_platform_depopulate(&pdev->dev);
++ else
++ platform_device_put(pdev);
+ clk_disable:
+ for (i = qcom->num_clocks - 1; i >= 0; i--) {
+ clk_disable_unprepare(qcom->clks[i]);
+@@ -601,6 +744,12 @@ static const struct of_device_id dwc3_qcom_of_match[] = {
+ };
+ MODULE_DEVICE_TABLE(of, dwc3_qcom_of_match);
+
++static const struct acpi_device_id dwc3_qcom_acpi_match[] = {
++ { "QCOM2430", (unsigned long)&sdm845_acpi_pdata },
++ { },
++};
++MODULE_DEVICE_TABLE(acpi, dwc3_qcom_acpi_match);
++
+ static struct platform_driver dwc3_qcom_driver = {
+ .probe = dwc3_qcom_probe,
+ .remove = dwc3_qcom_remove,
+@@ -608,6 +757,7 @@ static struct platform_driver dwc3_qcom_driver = {
+ .name = "dwc3-qcom",
+ .pm = &dwc3_qcom_dev_pm_ops,
+ .of_match_table = dwc3_qcom_of_match,
++ .acpi_match_table = ACPI_PTR(dwc3_qcom_acpi_match),
+ },
+ };
+
+
+From patchwork Mon Jun 17 12:51:04 2019
+Content-Type: text/plain; charset="utf-8"
+MIME-Version: 1.0
+Content-Transfer-Encoding: 7bit
+X-Patchwork-Submitter: Lee Jones <lee.jones@linaro.org>
+X-Patchwork-Id: 10999169
+Return-Path:
+ <linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org>
+Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org
+ [172.30.200.125])
+ by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 59E436C5
+ for <patchwork-linux-arm@patchwork.kernel.org>;
+ Mon, 17 Jun 2019 12:52:08 +0000 (UTC)
+Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1])
+ by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 49F6328720
+ for <patchwork-linux-arm@patchwork.kernel.org>;
+ Mon, 17 Jun 2019 12:52:08 +0000 (UTC)
+Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486)
+ id 484D828732; Mon, 17 Jun 2019 12:52:08 +0000 (UTC)
+X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on
+ pdx-wl-mail.web.codeaurora.org
+X-Spam-Level:
+X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED,
+ DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable
+ version=3.3.1
+Received: from bombadil.infradead.org (bombadil.infradead.org
+ [198.137.202.133])
+ (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits))
+ (No client certificate requested)
+ by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B78822890E
+ for <patchwork-linux-arm@patchwork.kernel.org>;
+ Mon, 17 Jun 2019 12:52:07 +0000 (UTC)
+DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
+ d=lists.infradead.org; s=bombadil.20170209; h=Sender:
+ Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe:
+ List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References:
+ In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID:
+ Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
+ :Resent-Message-ID:List-Owner;
+ bh=1QkFuxjOpyjnOEy2zHsXiVzRtFfJL6FqwyIAZ/9Gut4=; b=YA60sPqjbq2iXlOMXN9dmLURcq
+ Iz4na+d1NKhZtuP2CUDdAaStGbSSjVhK/os6IjlrZc7p41R8M579EqZ0HVEK4qz82WE/sZ1N8aCZx
+ Ruo85uuR/oV66KjW9Hv4ZEVoyqvrAwW0icnAN0s120v2oKHZOp4ALV0ZmFH3qplK8XWT0lEYbYhht
+ YKnq8wuLXiUk8EOTPK53ZAz9Ng8HO6EwyiWt+Et7LBSGHdJu0mTcXlCu2IZu8ojX8mDLaq+gbOdkV
+ RSimIoT8eRaC2kw3zEucerZPiH2j1UuTnfkZ1FKC6k/Y8Z/Xsdudz2ZZiRzFIk1huxmS8WpD+W/Fk
+ j6DSjSxQ==;
+Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org)
+ by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux))
+ id 1hcr79-0005Pa-Na; Mon, 17 Jun 2019 12:51:59 +0000
+Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441])
+ by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux))
+ id 1hcr6O-0004gy-U8
+ for linux-arm-kernel@lists.infradead.org; Mon, 17 Jun 2019 12:51:14 +0000
+Received: by mail-wr1-x441.google.com with SMTP id x4so9820359wrt.6
+ for <linux-arm-kernel@lists.infradead.org>;
+ Mon, 17 Jun 2019 05:51:12 -0700 (PDT)
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google;
+ h=from:to:cc:subject:date:message-id:in-reply-to:references;
+ bh=2C6MxhIF9Gjdvx3J9DYd/48/Suqux1auzpg7O20+XA4=;
+ b=MHuiL6Hd66D8KM0jn4ls2iBDOBivmXgGCkd0bRuw3BVISYThbeIBV65YPTVnC9S5pN
+ 8kwD7l1LeRLhShtYuu/Ido0JQEJeak94CdUos+d7lXijbpc7lq70fcnle30NFz0tcJIj
+ fAbhj9eIhnoDKlZtfNVWfkzOAx8xp0EuIZ9g38860fnnolOIibyFhNmFCQEOV3JsQtou
+ UjFRWCn0iZbk4TdcLNFh4kMAKOur21h0NofVuZCw5wYBD3SEo5yr15DOn4ZrA5obTtoT
+ wSTQGINMn3kmRWVRTFv5WxMKEdA0kEwajLFNzSkDL3ycCAfLXhvSJF2ZlVcb1F43lutn
+ H4ew==
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
+ d=1e100.net; s=20161025;
+ h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
+ :references;
+ bh=2C6MxhIF9Gjdvx3J9DYd/48/Suqux1auzpg7O20+XA4=;
+ b=g5oKdVRTACrVlNT9mDlepCqDm/U02p2CeTx7OdqMmBixU2mjAXvsMj+XahOxs5uFsO
+ Pl3GHa55jW2odCnqU9VxRpCVhjxno2vhx6tg+PXPuTBqk+jUURXrCVXyC22whKZcpHJr
+ yirYn9/pAYDqhMOEU0QXHLc2+hkADBRoIe6q0bwWkHAUhTTBNiXZXE/AmECsikfFweYY
+ /gxI4NxJV+DoqZUCLvfnDQNyMPQ/8PjcV+APjFzTg+joSGYwXUlmkEoTIr7wmU4PRJEJ
+ aqo/p8zPkt9WE7U5AouUleaAYafS7lL462sde12ORut0CLGLeMgOOc1Ts62W1sawCZnK
+ cgJQ==
+X-Gm-Message-State: APjAAAUTdSRQtulqTKizpX2at2737W94BWN/oI7oAXlYMQGY5HDkwL/e
+ JmNLsqSgS0jLCPiCNJxyAmQ1zQ==
+X-Google-Smtp-Source:
+ APXvYqwC65DYERLdER2UmlNerHOaEQY3c4hwpSMWsWud6VpPKrL6rBW7xSk8iiKL0ioPg8v7UxK/qQ==
+X-Received: by 2002:adf:ebc6:: with SMTP id v6mr14844325wrn.222.1560775871713;
+ Mon, 17 Jun 2019 05:51:11 -0700 (PDT)
+Received: from dell.watershed.co.uk ([2.27.35.243])
+ by smtp.gmail.com with ESMTPSA id o11sm10477852wmh.37.2019.06.17.05.51.10
+ (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
+ Mon, 17 Jun 2019 05:51:11 -0700 (PDT)
+From: Lee Jones <lee.jones@linaro.org>
+To: alokc@codeaurora.org, agross@kernel.org, david.brown@linaro.org,
+ bjorn.andersson@linaro.org, balbi@kernel.org, gregkh@linuxfoundation.org,
+ ard.biesheuvel@linaro.org, jlhugo@gmail.com, linux-arm-msm@vger.kernel.org,
+ linux-usb@vger.kernel.org, felipe.balbi@linux.intel.com
+Subject: [RESEND v4 3/4] usb: dwc3: qcom: Start USB in 'host mode' on the
+ SDM845
+Date: Mon, 17 Jun 2019 13:51:04 +0100
+Message-Id: <20190617125105.6186-4-lee.jones@linaro.org>
+X-Mailer: git-send-email 2.17.1
+In-Reply-To: <20190617125105.6186-1-lee.jones@linaro.org>
+References: <20190617125105.6186-1-lee.jones@linaro.org>
+X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3
+X-CRM114-CacheID: sfid-20190617_055112_973743_71B28B61
+X-CRM114-Status: GOOD ( 15.72 )
+X-BeenThere: linux-arm-kernel@lists.infradead.org
+X-Mailman-Version: 2.1.29
+Precedence: list
+List-Id: <linux-arm-kernel.lists.infradead.org>
+List-Unsubscribe:
+ <http://lists.infradead.org/mailman/options/linux-arm-kernel>,
+ <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe>
+List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/>
+List-Post: <mailto:linux-arm-kernel@lists.infradead.org>
+List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help>
+List-Subscribe:
+ <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>,
+ <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe>
+Cc: Lee Jones <lee.jones@linaro.org>, linux-kernel@vger.kernel.org,
+ linux-arm-kernel@lists.infradead.org
+MIME-Version: 1.0
+Content-Type: text/plain; charset="us-ascii"
+Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org>
+Errors-To:
+ linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org
+X-Virus-Scanned: ClamAV using ClamSMTP
+
+When booting with Device Tree, the current default boot configuration
+table option, the request to boot via 'host mode' comes from the
+'dr_mode' property. A property of the same name can be used inside
+ACPI tables too. However it is missing from the SDM845's ACPI tables
+so we have to supply this information using Platform Device Properties
+instead.
+
+This does not change the behaviour of any currently supported devices.
+The property is only set on ACPI enabled platforms, thus for H/W
+booting DT, unless a 'dr_mode' property is present, the default is
+still OTG (On-The-Go) as per [0]. Any new ACPI devices added will
+also be able to over-ride this implementation by providing a 'dr_mode'
+property in their ACPI tables. In cases where 'dr_mode' is omitted
+from the tables AND 'host mode' should not be the default (very
+unlikely), then we will have to add some way of choosing between them
+at run time - most likely by ACPI HID.
+
+[0] Documentation/devicetree/bindings/usb/generic.txt
+
+Signed-off-by: Lee Jones <lee.jones@linaro.org>
+Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
+---
+ drivers/usb/dwc3/dwc3-qcom.c | 12 ++++++++++++
+ 1 file changed, 12 insertions(+)
+
+diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
+index 0cb63f6c92d9..2d050303d564 100644
+--- a/drivers/usb/dwc3/dwc3-qcom.c
++++ b/drivers/usb/dwc3/dwc3-qcom.c
+@@ -444,6 +444,11 @@ static int dwc3_qcom_clk_init(struct dwc3_qcom *qcom, int count)
+ return 0;
+ }
+
++static const struct property_entry dwc3_qcom_acpi_properties[] = {
++ PROPERTY_ENTRY_STRING("dr_mode", "host"),
++ {}
++};
++
+ static int dwc3_qcom_acpi_register_core(struct platform_device *pdev)
+ {
+ struct dwc3_qcom *qcom = platform_get_drvdata(pdev);
+@@ -488,6 +493,13 @@ static int dwc3_qcom_acpi_register_core(struct platform_device *pdev)
+ goto out;
+ }
+
++ ret = platform_device_add_properties(qcom->dwc3,
++ dwc3_qcom_acpi_properties);
++ if (ret < 0) {
++ dev_err(&pdev->dev, "failed to add properties\n");
++ goto out;
++ }
++
+ ret = platform_device_add(qcom->dwc3);
+ if (ret)
+ dev_err(&pdev->dev, "failed to add device\n");
+
+From patchwork Mon Jun 17 12:51:05 2019
+Content-Type: text/plain; charset="utf-8"
+MIME-Version: 1.0
+Content-Transfer-Encoding: 7bit
+X-Patchwork-Submitter: Lee Jones <lee.jones@linaro.org>
+X-Patchwork-Id: 10999171
+Return-Path:
+ <linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org>
+Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org
+ [172.30.200.125])
+ by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 056B014BB
+ for <patchwork-linux-arm@patchwork.kernel.org>;
+ Mon, 17 Jun 2019 12:52:24 +0000 (UTC)
+Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1])
+ by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E9F5D2623D
+ for <patchwork-linux-arm@patchwork.kernel.org>;
+ Mon, 17 Jun 2019 12:52:23 +0000 (UTC)
+Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486)
+ id DE2D8286E6; Mon, 17 Jun 2019 12:52:23 +0000 (UTC)
+X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on
+ pdx-wl-mail.web.codeaurora.org
+X-Spam-Level:
+X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED,
+ DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1
+Received: from bombadil.infradead.org (bombadil.infradead.org
+ [198.137.202.133])
+ (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits))
+ (No client certificate requested)
+ by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4FDCC28910
+ for <patchwork-linux-arm@patchwork.kernel.org>;
+ Mon, 17 Jun 2019 12:52:23 +0000 (UTC)
+DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
+ d=lists.infradead.org; s=bombadil.20170209; h=Sender:
+ Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe:
+ List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References:
+ In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID:
+ Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
+ :Resent-Message-ID:List-Owner;
+ bh=+jtZnHBNzgQH/9Px1oGZt5RysFzYApYYAuGUPTs83g0=; b=isuYAdGtnV2Gnn9HFaejXX5oNk
+ FE+ANauzKQRQvIzRBcIKDx8ulhJQVhcGuK3T8Jch1Uboq+o3eWsxRoURfYBbGrflIOx21Yg8N25eY
+ BI7vshLQoF/8yr4DjMCu38+euxufpLS3Iy1ccfgdSWsrN4xNGQM8EMH9AnNO4CcCRvTNhd66JToDv
+ CeewDT5qNKNXJhX6uK7VSjjpqLLlL9xeDVHuVDlRBijmSlktSvXBSpx/foroGCL6PE/PHbTKY+84M
+ d2iMxiHV7HFNk88oc+cA1XibLNSKlrQqBSh0cTPEy9/FNF/HIhS2nZuW699O25srjt9WD5kHYTkWz
+ Uj9Onb5g==;
+Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org)
+ by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux))
+ id 1hcr7Q-0005fB-VK; Mon, 17 Jun 2019 12:52:16 +0000
+Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342])
+ by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux))
+ id 1hcr6Q-0004hQ-9x
+ for linux-arm-kernel@lists.infradead.org; Mon, 17 Jun 2019 12:51:15 +0000
+Received: by mail-wm1-x342.google.com with SMTP id c6so8984040wml.0
+ for <linux-arm-kernel@lists.infradead.org>;
+ Mon, 17 Jun 2019 05:51:13 -0700 (PDT)
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google;
+ h=from:to:cc:subject:date:message-id:in-reply-to:references;
+ bh=Yh8KWN22mWMhTl8rcvEzBYBWJNOHxR/ZVbPRRDE/D+g=;
+ b=q/VQwMJ7CaCCS2TpiY40tB9SR/0BGYUD9cg5QmvyZlgN0oSe9DGo/a+8W3tFnih/es
+ f/TGbxw2+NhrkghexAa4OElVuqj6adr3zChACFmOr55PBTOD/M1NIEdtp5/IEy9qU/kC
+ fX2Qrs7PhDGqUidNClIWZ04Lwg4RW4iXSfsUN/mQ3Fz6ReP9i0AdV914a9optyVwxJ9W
+ Xy6Y1mSeoVn1NeqGDQGLUT+gzK0PwP6QYlI5aEiS1G795pxPRN55vGKPX1Kr7l+p8xwx
+ 9xxVx3Oo0mrnM/HpISh/Sd3kMq4WHV1BoTnn1nr+LgaU5NktIDT5p1PPAhig5lYx1wqZ
+ dRuw==
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
+ d=1e100.net; s=20161025;
+ h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
+ :references;
+ bh=Yh8KWN22mWMhTl8rcvEzBYBWJNOHxR/ZVbPRRDE/D+g=;
+ b=GDDwWmC9vgwB9dEThqnEfHcQ0p5geoDFCFkO7J5KNb9MMmOnioyHSEX/hc/ZVBKMJO
+ FJ5WEaXuIM9CNXi8tJnFihBgZh+RrxIyQE0XKiThAbKywAG/0O7CzV8zIALI0gjDuHnc
+ Z4EKuFVN6NOFCU4DwnkKs3ti0J1kjwTk4UXRwbCq/tdA25Jfe8s+dpgNFjsGKjJ9rhdb
+ 0HOQglShCMAL4K98A3uZhiBpD3DEYw0PE5f7bE85ztRROxzeyLdmCpE/7P62Tf7i6rRL
+ nLpK6Gkwh6BtejcNXq0oF8WDUhpCWFODaymkmLMZPTcUFsnvALORZa3xnahGffdxUoak
+ xpqw==
+X-Gm-Message-State: APjAAAVe/oIFvOcyv+/Ca5uByLVj7kZtQ4Dw7Gzo/OG5v4XhjWwar3iK
+ OZZ9XFRIxxeYmle7YYU8S4BGNkgSBSw=
+X-Google-Smtp-Source:
+ APXvYqyQ7uC0yXE6+rCbtoO1nXI3vuubKGuLiHCQLeIEVsa7DW/HvoU6icIxjcUwUpeyeJFFHJ6L2g==
+X-Received: by 2002:a1c:63c4:: with SMTP id x187mr17953607wmb.4.1560775872645;
+ Mon, 17 Jun 2019 05:51:12 -0700 (PDT)
+Received: from dell.watershed.co.uk ([2.27.35.243])
+ by smtp.gmail.com with ESMTPSA id o11sm10477852wmh.37.2019.06.17.05.51.11
+ (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
+ Mon, 17 Jun 2019 05:51:12 -0700 (PDT)
+From: Lee Jones <lee.jones@linaro.org>
+To: alokc@codeaurora.org, agross@kernel.org, david.brown@linaro.org,
+ bjorn.andersson@linaro.org, balbi@kernel.org, gregkh@linuxfoundation.org,
+ ard.biesheuvel@linaro.org, jlhugo@gmail.com, linux-arm-msm@vger.kernel.org,
+ linux-usb@vger.kernel.org, felipe.balbi@linux.intel.com
+Subject: [RESEND v4 4/4] usb: dwc3: qcom: Improve error handling
+Date: Mon, 17 Jun 2019 13:51:05 +0100
+Message-Id: <20190617125105.6186-5-lee.jones@linaro.org>
+X-Mailer: git-send-email 2.17.1
+In-Reply-To: <20190617125105.6186-1-lee.jones@linaro.org>
+References: <20190617125105.6186-1-lee.jones@linaro.org>
+X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3
+X-CRM114-CacheID: sfid-20190617_055114_400272_E30946CF
+X-CRM114-Status: GOOD ( 11.45 )
+X-BeenThere: linux-arm-kernel@lists.infradead.org
+X-Mailman-Version: 2.1.29
+Precedence: list
+List-Id: <linux-arm-kernel.lists.infradead.org>
+List-Unsubscribe:
+ <http://lists.infradead.org/mailman/options/linux-arm-kernel>,
+ <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe>
+List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/>
+List-Post: <mailto:linux-arm-kernel@lists.infradead.org>
+List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help>
+List-Subscribe:
+ <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>,
+ <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe>
+Cc: Lee Jones <lee.jones@linaro.org>, linux-kernel@vger.kernel.org,
+ linux-arm-kernel@lists.infradead.org
+MIME-Version: 1.0
+Content-Type: text/plain; charset="us-ascii"
+Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org>
+Errors-To:
+ linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org
+X-Virus-Scanned: ClamAV using ClamSMTP
+
+dwc3_qcom_clk_init() is called with of_count_phandle_with_args() as an
+argument. If of_count_phandle_with_args() returns an error, the number
+of clocks will be a negative value and will lead to undefined behaviour.
+
+Ensure we check for an error before attempting to blindly use the value.
+
+Signed-off-by: Lee Jones <lee.jones@linaro.org>
+Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
+---
+ drivers/usb/dwc3/dwc3-qcom.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
+index 2d050303d564..c59e9d8e8609 100644
+--- a/drivers/usb/dwc3/dwc3-qcom.c
++++ b/drivers/usb/dwc3/dwc3-qcom.c
+@@ -409,6 +409,9 @@ static int dwc3_qcom_clk_init(struct dwc3_qcom *qcom, int count)
+ if (!np || !count)
+ return 0;
+
++ if (count < 0)
++ return count;
++
+ qcom->num_clocks = count;
+
+ qcom->clks = devm_kcalloc(dev, qcom->num_clocks,
diff --git a/arm64-qcom-pinctrl-support-for-ACPI.patch b/arm64-qcom-pinctrl-support-for-ACPI.patch
new file mode 100644
index 000000000..4548d4036
--- /dev/null
+++ b/arm64-qcom-pinctrl-support-for-ACPI.patch
@@ -0,0 +1,293 @@
+From 0ab5b9df0c9f07ae747ddc678d4e423c42f69624 Mon Sep 17 00:00:00 2001
+From: Lee Jones <lee.jones@linaro.org>
+Date: Mon, 10 Jun 2019 09:42:06 +0100
+Subject: [PATCH 1/8] i2c: i2c-qcom-geni: Provide support for ACPI
+
+Add a match table to allow automatic probing of ACPI device
+QCOM0220. Ignore clock attainment errors. Set default clock
+frequency value.
+
+Signed-off-by: Lee Jones <lee.jones@linaro.org>
+Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
+---
+ drivers/i2c/busses/i2c-qcom-geni.c | 15 ++++++++++++++-
+ 1 file changed, 14 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c
+index db075bc0d952..9e3b8a98688d 100644
+--- a/drivers/i2c/busses/i2c-qcom-geni.c
++++ b/drivers/i2c/busses/i2c-qcom-geni.c
+@@ -1,6 +1,7 @@
+ // SPDX-License-Identifier: GPL-2.0
+ // Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
+
++#include <linux/acpi.h>
+ #include <linux/clk.h>
+ #include <linux/dma-mapping.h>
+ #include <linux/err.h>
+@@ -483,6 +484,14 @@ static const struct i2c_algorithm geni_i2c_algo = {
+ .functionality = geni_i2c_func,
+ };
+
++#ifdef CONFIG_ACPI
++static const struct acpi_device_id geni_i2c_acpi_match[] = {
++ { "QCOM0220"},
++ { },
++};
++MODULE_DEVICE_TABLE(acpi, geni_i2c_acpi_match);
++#endif
++
+ static int geni_i2c_probe(struct platform_device *pdev)
+ {
+ struct geni_i2c_dev *gi2c;
+@@ -502,7 +511,7 @@ static int geni_i2c_probe(struct platform_device *pdev)
+ return PTR_ERR(gi2c->se.base);
+
+ gi2c->se.clk = devm_clk_get(&pdev->dev, "se");
+- if (IS_ERR(gi2c->se.clk)) {
++ if (IS_ERR(gi2c->se.clk) && !has_acpi_companion(&pdev->dev)) {
+ ret = PTR_ERR(gi2c->se.clk);
+ dev_err(&pdev->dev, "Err getting SE Core clk %d\n", ret);
+ return ret;
+@@ -516,6 +525,9 @@ static int geni_i2c_probe(struct platform_device *pdev)
+ gi2c->clk_freq_out = KHZ(100);
+ }
+
++ if (has_acpi_companion(&pdev->dev))
++ ACPI_COMPANION_SET(&gi2c->adap.dev, ACPI_COMPANION(&pdev->dev));
++
+ gi2c->irq = platform_get_irq(pdev, 0);
+ if (gi2c->irq < 0) {
+ dev_err(&pdev->dev, "IRQ error for i2c-geni\n");
+@@ -660,6 +672,7 @@ static struct platform_driver geni_i2c_driver = {
+ .name = "geni_i2c",
+ .pm = &geni_i2c_pm_ops,
+ .of_match_table = geni_i2c_dt_match,
++ .acpi_match_table = ACPI_PTR(geni_i2c_acpi_match),
+ },
+ };
+
+--
+2.21.0
+
+From 5a0639fed6e05977d85c4824354e73d0a2fa92ef Mon Sep 17 00:00:00 2001
+From: Lee Jones <lee.jones@linaro.org>
+Date: Mon, 10 Jun 2019 09:42:07 +0100
+Subject: [PATCH 2/8] i2c: i2c-qcom-geni: Signify successful driver probe
+
+The Qualcomm Geni I2C driver currently probes silently which can be
+confusing when debugging potential issues. Add a low level (INFO)
+print when each I2C controller is successfully initially set-up.
+
+Signed-off-by: Lee Jones <lee.jones@linaro.org>
+Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
+---
+ drivers/i2c/busses/i2c-qcom-geni.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c
+index 9e3b8a98688d..a89bfce5388e 100644
+--- a/drivers/i2c/busses/i2c-qcom-geni.c
++++ b/drivers/i2c/busses/i2c-qcom-geni.c
+@@ -596,6 +596,8 @@ static int geni_i2c_probe(struct platform_device *pdev)
+ return ret;
+ }
+
++ dev_dbg(&pdev->dev, "Geni-I2C adaptor successfully added\n");
++
+ return 0;
+ }
+
+--
+2.21.0
+
+From 6f202eb6dbccf3172616a620faf934bf6195a0f9 Mon Sep 17 00:00:00 2001
+From: Lee Jones <lee.jones@linaro.org>
+Date: Mon, 10 Jun 2019 09:42:08 +0100
+Subject: [PATCH 3/8] pinctrl: msm: Add ability for drivers to supply a
+ reserved GPIO list
+
+When booting MSM based platforms with Device Tree or some ACPI
+implementations, it is possible to provide a list of reserved pins
+via the 'gpio-reserved-ranges' and 'gpios' properties respectively.
+However some ACPI tables are not populated with this information,
+thus it has to come from a knowledgable device driver instead.
+
+Here we provide the MSM common driver with additional support to
+parse this informtion and correctly populate the widely used
+'valid_mask'.
+
+Signed-off-by: Lee Jones <lee.jones@linaro.org>
+Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
+---
+ drivers/pinctrl/qcom/pinctrl-msm.c | 18 ++++++++++++++++++
+ drivers/pinctrl/qcom/pinctrl-msm.h | 1 +
+ 2 files changed, 19 insertions(+)
+
+diff --git a/drivers/pinctrl/qcom/pinctrl-msm.c b/drivers/pinctrl/qcom/pinctrl-msm.c
+index 6e319bcc2326..80682b017a47 100644
+--- a/drivers/pinctrl/qcom/pinctrl-msm.c
++++ b/drivers/pinctrl/qcom/pinctrl-msm.c
+@@ -599,8 +599,23 @@ static int msm_gpio_init_valid_mask(struct gpio_chip *chip)
+ int ret;
+ unsigned int len, i;
+ unsigned int max_gpios = pctrl->soc->ngpios;
++ const int *reserved = pctrl->soc->reserved_gpios;
+ u16 *tmp;
+
++ /* Driver provided reserved list overrides DT and ACPI */
++ if (reserved) {
++ bitmap_fill(chip->valid_mask, max_gpios);
++ for (i = 0; reserved[i] >= 0; i++) {
++ if (i >= max_gpios || reserved[i] >= max_gpios) {
++ dev_err(pctrl->dev, "invalid list of reserved GPIOs\n");
++ return -EINVAL;
++ }
++ clear_bit(reserved[i], chip->valid_mask);
++ }
++
++ return 0;
++ }
++
+ /* The number of GPIOs in the ACPI tables */
+ len = ret = device_property_read_u16_array(pctrl->dev, "gpios", NULL,
+ 0);
+@@ -956,6 +971,9 @@ static void msm_gpio_irq_handler(struct irq_desc *desc)
+
+ static bool msm_gpio_needs_valid_mask(struct msm_pinctrl *pctrl)
+ {
++ if (pctrl->soc->reserved_gpios)
++ return true;
++
+ return device_property_read_u16_array(pctrl->dev, "gpios", NULL, 0) > 0;
+ }
+
+diff --git a/drivers/pinctrl/qcom/pinctrl-msm.h b/drivers/pinctrl/qcom/pinctrl-msm.h
+index b724581c605c..48569cda8471 100644
+--- a/drivers/pinctrl/qcom/pinctrl-msm.h
++++ b/drivers/pinctrl/qcom/pinctrl-msm.h
+@@ -113,6 +113,7 @@ struct msm_pinctrl_soc_data {
+ bool pull_no_keeper;
+ const char *const *tiles;
+ unsigned int ntiles;
++ const int *reserved_gpios;
+ };
+
+ extern const struct dev_pm_ops msm_pinctrl_dev_pm_ops;
+--
+2.21.0
+
+From 568ff4c9723d761164416fdf876232f5b14cf3ad Mon Sep 17 00:00:00 2001
+From: Lee Jones <lee.jones@linaro.org>
+Date: Mon, 10 Jun 2019 09:42:09 +0100
+Subject: [PATCH 4/8] pinctrl: qcom: sdm845: Provide ACPI support
+
+This patch provides basic support for booting with ACPI instead
+of the currently supported Device Tree. When doing so there are a
+couple of differences which we need to taken into consideration.
+
+Firstly, the SDM850 ACPI tables omit information pertaining to the
+4 reserved GPIOs on the platform. If Linux attempts to touch/
+initialise any of these lines, the firmware will restart the
+platform.
+
+Secondly, when booting with ACPI, it is expected that the firmware
+will set-up things like; Regulators, Clocks, Pin Functions, etc in
+their ideal configuration. Thus, the possible Pin Functions
+available to this platform are not advertised when providing the
+higher GPIOD/Pinctrl APIs with pin information.
+
+Signed-off-by: Lee Jones <lee.jones@linaro.org>
+Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
+---
+ drivers/pinctrl/qcom/Kconfig | 2 +-
+ drivers/pinctrl/qcom/pinctrl-sdm845.c | 36 ++++++++++++++++++++++++++-
+ 2 files changed, 36 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/pinctrl/qcom/Kconfig b/drivers/pinctrl/qcom/Kconfig
+index 890d0a3a790b..27ab585a639c 100644
+--- a/drivers/pinctrl/qcom/Kconfig
++++ b/drivers/pinctrl/qcom/Kconfig
+@@ -169,7 +169,7 @@ config PINCTRL_SDM660
+
+ config PINCTRL_SDM845
+ tristate "Qualcomm Technologies Inc SDM845 pin controller driver"
+- depends on GPIOLIB && OF
++ depends on GPIOLIB && (OF || ACPI)
+ select PINCTRL_MSM
+ help
+ This is the pinctrl, pinmux, pinconf and gpiolib driver for the
+diff --git a/drivers/pinctrl/qcom/pinctrl-sdm845.c b/drivers/pinctrl/qcom/pinctrl-sdm845.c
+index c97f20fca5fd..98a438dba711 100644
+--- a/drivers/pinctrl/qcom/pinctrl-sdm845.c
++++ b/drivers/pinctrl/qcom/pinctrl-sdm845.c
+@@ -3,6 +3,7 @@
+ * Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
+ */
+
++#include <linux/acpi.h>
+ #include <linux/module.h>
+ #include <linux/of.h>
+ #include <linux/platform_device.h>
+@@ -1277,6 +1278,10 @@ static const struct msm_pingroup sdm845_groups[] = {
+ UFS_RESET(ufs_reset, 0x99f000),
+ };
+
++static const int sdm845_acpi_reserved_gpios[] = {
++ 0, 1, 2, 3, 81, 82, 83, 84, -1
++};
++
+ static const struct msm_pinctrl_soc_data sdm845_pinctrl = {
+ .pins = sdm845_pins,
+ .npins = ARRAY_SIZE(sdm845_pins),
+@@ -1287,11 +1292,39 @@ static const struct msm_pinctrl_soc_data sdm845_pinctrl = {
+ .ngpios = 150,
+ };
+
++static const struct msm_pinctrl_soc_data sdm845_acpi_pinctrl = {
++ .pins = sdm845_pins,
++ .npins = ARRAY_SIZE(sdm845_pins),
++ .groups = sdm845_groups,
++ .ngroups = ARRAY_SIZE(sdm845_groups),
++ .reserved_gpios = sdm845_acpi_reserved_gpios,
++ .ngpios = 150,
++};
++
+ static int sdm845_pinctrl_probe(struct platform_device *pdev)
+ {
+- return msm_pinctrl_probe(pdev, &sdm845_pinctrl);
++ int ret;
++
++ if (pdev->dev.of_node) {
++ ret = msm_pinctrl_probe(pdev, &sdm845_pinctrl);
++ } else if (has_acpi_companion(&pdev->dev)) {
++ ret = msm_pinctrl_probe(pdev, &sdm845_acpi_pinctrl);
++ } else {
++ dev_err(&pdev->dev, "DT and ACPI disabled\n");
++ return -EINVAL;
++ }
++
++ return ret;
+ }
+
++#if CONFIG_ACPI
++static const struct acpi_device_id sdm845_pinctrl_acpi_match[] = {
++ { "QCOM0217"},
++ { },
++};
++MODULE_DEVICE_TABLE(acpi, sdm845_pinctrl_acpi_match);
++#endif
++
+ static const struct of_device_id sdm845_pinctrl_of_match[] = {
+ { .compatible = "qcom,sdm845-pinctrl", },
+ { },
+@@ -1302,6 +1335,7 @@ static struct platform_driver sdm845_pinctrl_driver = {
+ .name = "sdm845-pinctrl",
+ .pm = &msm_pinctrl_dev_pm_ops,
+ .of_match_table = sdm845_pinctrl_of_match,
++ .acpi_match_table = ACPI_PTR(sdm845_pinctrl_acpi_match),
+ },
+ .probe = sdm845_pinctrl_probe,
+ .remove = msm_pinctrl_remove,
+--
+2.21.0
diff --git a/configs/fedora/generic/arm/aarch64/CONFIG_ACPI_AC b/configs/fedora/generic/arm/aarch64/CONFIG_ACPI_AC
new file mode 100644
index 000000000..5dbaee1a8
--- /dev/null
+++ b/configs/fedora/generic/arm/aarch64/CONFIG_ACPI_AC
@@ -0,0 +1 @@
+CONFIG_ACPI_AC=y
diff --git a/configs/fedora/generic/arm/aarch64/CONFIG_ACPI_BATTERY b/configs/fedora/generic/arm/aarch64/CONFIG_ACPI_BATTERY
new file mode 100644
index 000000000..eb3286698
--- /dev/null
+++ b/configs/fedora/generic/arm/aarch64/CONFIG_ACPI_BATTERY
@@ -0,0 +1 @@
+CONFIG_ACPI_BATTERY=y
diff --git a/kernel-aarch64-debug.config b/kernel-aarch64-debug.config
index 93a77001b..e44124219 100644
--- a/kernel-aarch64-debug.config
+++ b/kernel-aarch64-debug.config
@@ -36,6 +36,7 @@ CONFIG_ACCESSIBILITY=y
CONFIG_ACENIC=m
# CONFIG_ACENIC_OMIT_TIGON_I is not set
# CONFIG_ACORN_PARTITION is not set
+CONFIG_ACPI_AC=y
CONFIG_ACPI_ALS=m
# CONFIG_ACPI_APEI_EINJ is not set
# CONFIG_ACPI_APEI_ERST_DEBUG is not set
@@ -44,6 +45,7 @@ CONFIG_ACPI_APEI_MEMORY_FAILURE=y
CONFIG_ACPI_APEI_PCIEAER=y
CONFIG_ACPI_APEI_SEA=y
CONFIG_ACPI_APEI=y
+CONFIG_ACPI_BATTERY=y
CONFIG_ACPI_BGRT=y
CONFIG_ACPI_BUTTON=y
CONFIG_ACPI_CONFIGFS=m
diff --git a/kernel-aarch64.config b/kernel-aarch64.config
index cf06a4b4a..ee270dfc8 100644
--- a/kernel-aarch64.config
+++ b/kernel-aarch64.config
@@ -36,6 +36,7 @@ CONFIG_ACCESSIBILITY=y
CONFIG_ACENIC=m
# CONFIG_ACENIC_OMIT_TIGON_I is not set
# CONFIG_ACORN_PARTITION is not set
+CONFIG_ACPI_AC=y
CONFIG_ACPI_ALS=m
# CONFIG_ACPI_APEI_EINJ is not set
# CONFIG_ACPI_APEI_ERST_DEBUG is not set
@@ -44,6 +45,7 @@ CONFIG_ACPI_APEI_MEMORY_FAILURE=y
CONFIG_ACPI_APEI_PCIEAER=y
CONFIG_ACPI_APEI_SEA=y
CONFIG_ACPI_APEI=y
+CONFIG_ACPI_BATTERY=y
CONFIG_ACPI_BGRT=y
CONFIG_ACPI_BUTTON=y
CONFIG_ACPI_CONFIGFS=m
diff --git a/kernel.spec b/kernel.spec
index c9882313a..664df5b24 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -553,6 +553,7 @@ Patch305: arm-sdhci-esdhc-imx-fixes.patch
Patch306: arm64-rock960-enable-tsadc.patch
+# Raspberry Pi bits
Patch330: ARM-cpufreq-support-for-Raspberry-Pi.patch
Patch331: watchdog-bcm2835_wdt-Fix-module-autoload.patch
@@ -560,8 +561,12 @@ Patch331: watchdog-bcm2835_wdt-Fix-module-autoload.patch
# Tegra bits
Patch340: arm64-tegra-jetson-tx1-fixes.patch
-# qcom bits
-Patch350: qcom-Provide-support-for-ACPI.patch
+# QCom ACPI device support pieces
+Patch350: arm64-qcom-pinctrl-support-for-ACPI.patch
+Patch351: arm64-acpi-ignore-5.1-fadts-reported-as-5.0.patch
+Patch352: arm64-acpi-make-ac-and-battery-drivers-available-on-non-x86.patch
+Patch353: arm64-qcom-DWC3-USB-Add-support-for-ACPI-based-AArch64-Laptops.patch
+
# 400 - IBM (ppc/s390x) patches
@@ -1826,6 +1831,9 @@ fi
#
#
%changelog
+* Sat Jun 22 2019 Peter Robinson <pbrobinson@fedoraproject.org>
+- QCom ACPI fixes
+
* Fri Jun 21 2019 Justin M. Forbes <jforbes@fedoraproject.org> - 5.2.0-0.rc5.git4.1
- Linux v5.2-rc5-290-g4ae004a9bca8
diff --git a/qcom-Provide-support-for-ACPI.patch b/qcom-Provide-support-for-ACPI.patch
deleted file mode 100644
index 8e34a739d..000000000
--- a/qcom-Provide-support-for-ACPI.patch
+++ /dev/null
@@ -1,841 +0,0 @@
-From 0ab5b9df0c9f07ae747ddc678d4e423c42f69624 Mon Sep 17 00:00:00 2001
-From: Lee Jones <lee.jones@linaro.org>
-Date: Mon, 10 Jun 2019 09:42:06 +0100
-Subject: [PATCH 1/8] i2c: i2c-qcom-geni: Provide support for ACPI
-
-Add a match table to allow automatic probing of ACPI device
-QCOM0220. Ignore clock attainment errors. Set default clock
-frequency value.
-
-Signed-off-by: Lee Jones <lee.jones@linaro.org>
-Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
----
- drivers/i2c/busses/i2c-qcom-geni.c | 15 ++++++++++++++-
- 1 file changed, 14 insertions(+), 1 deletion(-)
-
-diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c
-index db075bc0d952..9e3b8a98688d 100644
---- a/drivers/i2c/busses/i2c-qcom-geni.c
-+++ b/drivers/i2c/busses/i2c-qcom-geni.c
-@@ -1,6 +1,7 @@
- // SPDX-License-Identifier: GPL-2.0
- // Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
-
-+#include <linux/acpi.h>
- #include <linux/clk.h>
- #include <linux/dma-mapping.h>
- #include <linux/err.h>
-@@ -483,6 +484,14 @@ static const struct i2c_algorithm geni_i2c_algo = {
- .functionality = geni_i2c_func,
- };
-
-+#ifdef CONFIG_ACPI
-+static const struct acpi_device_id geni_i2c_acpi_match[] = {
-+ { "QCOM0220"},
-+ { },
-+};
-+MODULE_DEVICE_TABLE(acpi, geni_i2c_acpi_match);
-+#endif
-+
- static int geni_i2c_probe(struct platform_device *pdev)
- {
- struct geni_i2c_dev *gi2c;
-@@ -502,7 +511,7 @@ static int geni_i2c_probe(struct platform_device *pdev)
- return PTR_ERR(gi2c->se.base);
-
- gi2c->se.clk = devm_clk_get(&pdev->dev, "se");
-- if (IS_ERR(gi2c->se.clk)) {
-+ if (IS_ERR(gi2c->se.clk) && !has_acpi_companion(&pdev->dev)) {
- ret = PTR_ERR(gi2c->se.clk);
- dev_err(&pdev->dev, "Err getting SE Core clk %d\n", ret);
- return ret;
-@@ -516,6 +525,9 @@ static int geni_i2c_probe(struct platform_device *pdev)
- gi2c->clk_freq_out = KHZ(100);
- }
-
-+ if (has_acpi_companion(&pdev->dev))
-+ ACPI_COMPANION_SET(&gi2c->adap.dev, ACPI_COMPANION(&pdev->dev));
-+
- gi2c->irq = platform_get_irq(pdev, 0);
- if (gi2c->irq < 0) {
- dev_err(&pdev->dev, "IRQ error for i2c-geni\n");
-@@ -660,6 +672,7 @@ static struct platform_driver geni_i2c_driver = {
- .name = "geni_i2c",
- .pm = &geni_i2c_pm_ops,
- .of_match_table = geni_i2c_dt_match,
-+ .acpi_match_table = ACPI_PTR(geni_i2c_acpi_match),
- },
- };
-
---
-2.21.0
-
-From 5a0639fed6e05977d85c4824354e73d0a2fa92ef Mon Sep 17 00:00:00 2001
-From: Lee Jones <lee.jones@linaro.org>
-Date: Mon, 10 Jun 2019 09:42:07 +0100
-Subject: [PATCH 2/8] i2c: i2c-qcom-geni: Signify successful driver probe
-
-The Qualcomm Geni I2C driver currently probes silently which can be
-confusing when debugging potential issues. Add a low level (INFO)
-print when each I2C controller is successfully initially set-up.
-
-Signed-off-by: Lee Jones <lee.jones@linaro.org>
-Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
----
- drivers/i2c/busses/i2c-qcom-geni.c | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c
-index 9e3b8a98688d..a89bfce5388e 100644
---- a/drivers/i2c/busses/i2c-qcom-geni.c
-+++ b/drivers/i2c/busses/i2c-qcom-geni.c
-@@ -596,6 +596,8 @@ static int geni_i2c_probe(struct platform_device *pdev)
- return ret;
- }
-
-+ dev_dbg(&pdev->dev, "Geni-I2C adaptor successfully added\n");
-+
- return 0;
- }
-
---
-2.21.0
-
-From 6f202eb6dbccf3172616a620faf934bf6195a0f9 Mon Sep 17 00:00:00 2001
-From: Lee Jones <lee.jones@linaro.org>
-Date: Mon, 10 Jun 2019 09:42:08 +0100
-Subject: [PATCH 3/8] pinctrl: msm: Add ability for drivers to supply a
- reserved GPIO list
-
-When booting MSM based platforms with Device Tree or some ACPI
-implementations, it is possible to provide a list of reserved pins
-via the 'gpio-reserved-ranges' and 'gpios' properties respectively.
-However some ACPI tables are not populated with this information,
-thus it has to come from a knowledgable device driver instead.
-
-Here we provide the MSM common driver with additional support to
-parse this informtion and correctly populate the widely used
-'valid_mask'.
-
-Signed-off-by: Lee Jones <lee.jones@linaro.org>
-Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
----
- drivers/pinctrl/qcom/pinctrl-msm.c | 18 ++++++++++++++++++
- drivers/pinctrl/qcom/pinctrl-msm.h | 1 +
- 2 files changed, 19 insertions(+)
-
-diff --git a/drivers/pinctrl/qcom/pinctrl-msm.c b/drivers/pinctrl/qcom/pinctrl-msm.c
-index 6e319bcc2326..80682b017a47 100644
---- a/drivers/pinctrl/qcom/pinctrl-msm.c
-+++ b/drivers/pinctrl/qcom/pinctrl-msm.c
-@@ -599,8 +599,23 @@ static int msm_gpio_init_valid_mask(struct gpio_chip *chip)
- int ret;
- unsigned int len, i;
- unsigned int max_gpios = pctrl->soc->ngpios;
-+ const int *reserved = pctrl->soc->reserved_gpios;
- u16 *tmp;
-
-+ /* Driver provided reserved list overrides DT and ACPI */
-+ if (reserved) {
-+ bitmap_fill(chip->valid_mask, max_gpios);
-+ for (i = 0; reserved[i] >= 0; i++) {
-+ if (i >= max_gpios || reserved[i] >= max_gpios) {
-+ dev_err(pctrl->dev, "invalid list of reserved GPIOs\n");
-+ return -EINVAL;
-+ }
-+ clear_bit(reserved[i], chip->valid_mask);
-+ }
-+
-+ return 0;
-+ }
-+
- /* The number of GPIOs in the ACPI tables */
- len = ret = device_property_read_u16_array(pctrl->dev, "gpios", NULL,
- 0);
-@@ -956,6 +971,9 @@ static void msm_gpio_irq_handler(struct irq_desc *desc)
-
- static bool msm_gpio_needs_valid_mask(struct msm_pinctrl *pctrl)
- {
-+ if (pctrl->soc->reserved_gpios)
-+ return true;
-+
- return device_property_read_u16_array(pctrl->dev, "gpios", NULL, 0) > 0;
- }
-
-diff --git a/drivers/pinctrl/qcom/pinctrl-msm.h b/drivers/pinctrl/qcom/pinctrl-msm.h
-index b724581c605c..48569cda8471 100644
---- a/drivers/pinctrl/qcom/pinctrl-msm.h
-+++ b/drivers/pinctrl/qcom/pinctrl-msm.h
-@@ -113,6 +113,7 @@ struct msm_pinctrl_soc_data {
- bool pull_no_keeper;
- const char *const *tiles;
- unsigned int ntiles;
-+ const int *reserved_gpios;
- };
-
- extern const struct dev_pm_ops msm_pinctrl_dev_pm_ops;
---
-2.21.0
-
-From 568ff4c9723d761164416fdf876232f5b14cf3ad Mon Sep 17 00:00:00 2001
-From: Lee Jones <lee.jones@linaro.org>
-Date: Mon, 10 Jun 2019 09:42:09 +0100
-Subject: [PATCH 4/8] pinctrl: qcom: sdm845: Provide ACPI support
-
-This patch provides basic support for booting with ACPI instead
-of the currently supported Device Tree. When doing so there are a
-couple of differences which we need to taken into consideration.
-
-Firstly, the SDM850 ACPI tables omit information pertaining to the
-4 reserved GPIOs on the platform. If Linux attempts to touch/
-initialise any of these lines, the firmware will restart the
-platform.
-
-Secondly, when booting with ACPI, it is expected that the firmware
-will set-up things like; Regulators, Clocks, Pin Functions, etc in
-their ideal configuration. Thus, the possible Pin Functions
-available to this platform are not advertised when providing the
-higher GPIOD/Pinctrl APIs with pin information.
-
-Signed-off-by: Lee Jones <lee.jones@linaro.org>
-Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
----
- drivers/pinctrl/qcom/Kconfig | 2 +-
- drivers/pinctrl/qcom/pinctrl-sdm845.c | 36 ++++++++++++++++++++++++++-
- 2 files changed, 36 insertions(+), 2 deletions(-)
-
-diff --git a/drivers/pinctrl/qcom/Kconfig b/drivers/pinctrl/qcom/Kconfig
-index 890d0a3a790b..27ab585a639c 100644
---- a/drivers/pinctrl/qcom/Kconfig
-+++ b/drivers/pinctrl/qcom/Kconfig
-@@ -169,7 +169,7 @@ config PINCTRL_SDM660
-
- config PINCTRL_SDM845
- tristate "Qualcomm Technologies Inc SDM845 pin controller driver"
-- depends on GPIOLIB && OF
-+ depends on GPIOLIB && (OF || ACPI)
- select PINCTRL_MSM
- help
- This is the pinctrl, pinmux, pinconf and gpiolib driver for the
-diff --git a/drivers/pinctrl/qcom/pinctrl-sdm845.c b/drivers/pinctrl/qcom/pinctrl-sdm845.c
-index c97f20fca5fd..98a438dba711 100644
---- a/drivers/pinctrl/qcom/pinctrl-sdm845.c
-+++ b/drivers/pinctrl/qcom/pinctrl-sdm845.c
-@@ -3,6 +3,7 @@
- * Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
- */
-
-+#include <linux/acpi.h>
- #include <linux/module.h>
- #include <linux/of.h>
- #include <linux/platform_device.h>
-@@ -1277,6 +1278,10 @@ static const struct msm_pingroup sdm845_groups[] = {
- UFS_RESET(ufs_reset, 0x99f000),
- };
-
-+static const int sdm845_acpi_reserved_gpios[] = {
-+ 0, 1, 2, 3, 81, 82, 83, 84, -1
-+};
-+
- static const struct msm_pinctrl_soc_data sdm845_pinctrl = {
- .pins = sdm845_pins,
- .npins = ARRAY_SIZE(sdm845_pins),
-@@ -1287,11 +1292,39 @@ static const struct msm_pinctrl_soc_data sdm845_pinctrl = {
- .ngpios = 150,
- };
-
-+static const struct msm_pinctrl_soc_data sdm845_acpi_pinctrl = {
-+ .pins = sdm845_pins,
-+ .npins = ARRAY_SIZE(sdm845_pins),
-+ .groups = sdm845_groups,
-+ .ngroups = ARRAY_SIZE(sdm845_groups),
-+ .reserved_gpios = sdm845_acpi_reserved_gpios,
-+ .ngpios = 150,
-+};
-+
- static int sdm845_pinctrl_probe(struct platform_device *pdev)
- {
-- return msm_pinctrl_probe(pdev, &sdm845_pinctrl);
-+ int ret;
-+
-+ if (pdev->dev.of_node) {
-+ ret = msm_pinctrl_probe(pdev, &sdm845_pinctrl);
-+ } else if (has_acpi_companion(&pdev->dev)) {
-+ ret = msm_pinctrl_probe(pdev, &sdm845_acpi_pinctrl);
-+ } else {
-+ dev_err(&pdev->dev, "DT and ACPI disabled\n");
-+ return -EINVAL;
-+ }
-+
-+ return ret;
- }
-
-+#if CONFIG_ACPI
-+static const struct acpi_device_id sdm845_pinctrl_acpi_match[] = {
-+ { "QCOM0217"},
-+ { },
-+};
-+MODULE_DEVICE_TABLE(acpi, sdm845_pinctrl_acpi_match);
-+#endif
-+
- static const struct of_device_id sdm845_pinctrl_of_match[] = {
- { .compatible = "qcom,sdm845-pinctrl", },
- { },
-@@ -1302,6 +1335,7 @@ static struct platform_driver sdm845_pinctrl_driver = {
- .name = "sdm845-pinctrl",
- .pm = &msm_pinctrl_dev_pm_ops,
- .of_match_table = sdm845_pinctrl_of_match,
-+ .acpi_match_table = ACPI_PTR(sdm845_pinctrl_acpi_match),
- },
- .probe = sdm845_pinctrl_probe,
- .remove = msm_pinctrl_remove,
---
-2.21.0
-
-From 1960f541ea437ed1c704db11b9ca24a5248b31de Mon Sep 17 00:00:00 2001
-From: Lee Jones <lee.jones@linaro.org>
-Date: Mon, 10 Jun 2019 09:42:10 +0100
-Subject: [PATCH 5/8] soc: qcom: geni: Add support for ACPI
-
-When booting with ACPI as the active set of configuration tables,
-all; clocks, regulators, pin functions ect are expected to be at
-their ideal values/levels/rates, thus the associated frameworks
-are unavailable. Ensure calls to these APIs are shielded when
-ACPI is enabled.
-
-Signed-off-by: Lee Jones <lee.jones@linaro.org>
-Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
----
- drivers/soc/qcom/qcom-geni-se.c | 21 +++++++++++++++------
- 1 file changed, 15 insertions(+), 6 deletions(-)
-
-diff --git a/drivers/soc/qcom/qcom-geni-se.c b/drivers/soc/qcom/qcom-geni-se.c
-index 6b8ef01472e9..d5cf953b4337 100644
---- a/drivers/soc/qcom/qcom-geni-se.c
-+++ b/drivers/soc/qcom/qcom-geni-se.c
-@@ -1,6 +1,7 @@
- // SPDX-License-Identifier: GPL-2.0
- // Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
-
-+#include <linux/acpi.h>
- #include <linux/clk.h>
- #include <linux/slab.h>
- #include <linux/dma-mapping.h>
-@@ -450,6 +451,9 @@ int geni_se_resources_off(struct geni_se *se)
- {
- int ret;
-
-+ if (has_acpi_companion(se->dev))
-+ return 0;
-+
- ret = pinctrl_pm_select_sleep_state(se->dev);
- if (ret)
- return ret;
-@@ -487,6 +491,9 @@ int geni_se_resources_on(struct geni_se *se)
- {
- int ret;
-
-+ if (has_acpi_companion(se->dev))
-+ return 0;
-+
- ret = geni_se_clks_on(se);
- if (ret)
- return ret;
-@@ -724,12 +731,14 @@ static int geni_se_probe(struct platform_device *pdev)
- if (IS_ERR(wrapper->base))
- return PTR_ERR(wrapper->base);
-
-- wrapper->ahb_clks[0].id = "m-ahb";
-- wrapper->ahb_clks[1].id = "s-ahb";
-- ret = devm_clk_bulk_get(dev, NUM_AHB_CLKS, wrapper->ahb_clks);
-- if (ret) {
-- dev_err(dev, "Err getting AHB clks %d\n", ret);
-- return ret;
-+ if (!has_acpi_companion(&pdev->dev)) {
-+ wrapper->ahb_clks[0].id = "m-ahb";
-+ wrapper->ahb_clks[1].id = "s-ahb";
-+ ret = devm_clk_bulk_get(dev, NUM_AHB_CLKS, wrapper->ahb_clks);
-+ if (ret) {
-+ dev_err(dev, "Err getting AHB clks %d\n", ret);
-+ return ret;
-+ }
- }
-
- dev_set_drvdata(dev, wrapper);
---
-2.21.0
-
-From 0b10a369e159e4b76d1a786f613a2f061cdc3246 Mon Sep 17 00:00:00 2001
-From: Peter Robinson <pbrobinson@gmail.com>
-Date: Mon, 10 Jun 2019 10:31:02 +0100
-Subject: [PATCH 6/8] usb: dwc3: qcom: Add support for booting with ACPI
-
-In Linux, the DWC3 core exists as its own independent platform device.
-Thus when describing relationships in Device Tree, the current default
-boot configuration table option, the DWC3 core often resides as a child
-of the platform specific node. Both of which are given their own
-address space descriptions and the drivers can be mostly agnostic to
-each other.
-
-However, other Operating Systems have taken a more monolithic approach,
-which is evident in the configuration ACPI tables for the Qualcomm
-Snapdragon SDM850, where all DWC3 (core and platform) components are
-described under a single IO memory region.
-
-To ensure successful booting using the supplied ACPI tables, we need to
-devise a way to chop up the address regions provided and subsequently
-register the DWC3 core with the resultant information, which is
-precisely what this patch aims to achieve.
-
-Signed-off-by: Lee Jones <lee.jones@linaro.org>
-Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
----
- drivers/usb/dwc3/Kconfig | 2 +-
- drivers/usb/dwc3/dwc3-qcom.c | 206 ++++++++++++++++++++++++++++++-----
- 2 files changed, 179 insertions(+), 29 deletions(-)
-
-diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig
-index 4a62045cc812..89abc6078703 100644
---- a/drivers/usb/dwc3/Kconfig
-+++ b/drivers/usb/dwc3/Kconfig
-@@ -128,7 +128,7 @@ config USB_DWC3_QCOM
- tristate "Qualcomm Platform"
- depends on ARCH_QCOM || COMPILE_TEST
- depends on EXTCON || !EXTCON
-- depends on OF
-+ depends on (OF || ACPI)
- default USB_DWC3
- help
- Some Qualcomm SoCs use DesignWare Core IP for USB2/3
-diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
-index 184df4daa590..1e1f12b7991d 100644
---- a/drivers/usb/dwc3/dwc3-qcom.c
-+++ b/drivers/usb/dwc3/dwc3-qcom.c
-@@ -4,6 +4,7 @@
- * Inspired by dwc3-of-simple.c
- */
-
-+#include <linux/acpi.h>
- #include <linux/io.h>
- #include <linux/of.h>
- #include <linux/clk.h>
-@@ -38,6 +39,20 @@
- #define PWR_EVNT_LPM_IN_L2_MASK BIT(4)
- #define PWR_EVNT_LPM_OUT_L2_MASK BIT(5)
-
-+#define SDM845_QSCRATCH_BASE_OFFSET 0xf8800
-+#define SDM845_QSCRATCH_SIZE 0x400
-+#define SDM845_DWC3_CORE_SIZE 0xcd00
-+
-+struct dwc3_acpi_pdata {
-+ u32 qscratch_base_offset;
-+ u32 qscratch_base_size;
-+ u32 dwc3_core_base_size;
-+ int hs_phy_irq_index;
-+ int dp_hs_phy_irq_index;
-+ int dm_hs_phy_irq_index;
-+ int ss_phy_irq_index;
-+};
-+
- struct dwc3_qcom {
- struct device *dev;
- void __iomem *qscratch_base;
-@@ -56,6 +71,8 @@ struct dwc3_qcom {
- struct notifier_block vbus_nb;
- struct notifier_block host_nb;
-
-+ const struct dwc3_acpi_pdata *acpi_pdata;
-+
- enum usb_dr_mode mode;
- bool is_suspended;
- bool pm_suspended;
-@@ -300,12 +317,27 @@ static void dwc3_qcom_select_utmi_clk(struct dwc3_qcom *qcom)
- PIPE_UTMI_CLK_DIS);
- }
-
-+static int dwc3_qcom_get_irq(struct platform_device *pdev,
-+ const char *name, int num)
-+{
-+ struct device_node *np = pdev->dev.of_node;
-+ int ret;
-+
-+ if (np)
-+ ret = platform_get_irq_byname(pdev, name);
-+ else
-+ ret = platform_get_irq(pdev, num);
-+
-+ return ret;
-+}
-+
- static int dwc3_qcom_setup_irq(struct platform_device *pdev)
- {
- struct dwc3_qcom *qcom = platform_get_drvdata(pdev);
-+ const struct dwc3_acpi_pdata *pdata = qcom->acpi_pdata;
- int irq, ret;
--
-- irq = platform_get_irq_byname(pdev, "hs_phy_irq");
-+ irq = dwc3_qcom_get_irq(pdev, "hs_phy_irq",
-+ pdata ? pdata->hs_phy_irq_index : -1);
- if (irq > 0) {
- /* Keep wakeup interrupts disabled until suspend */
- irq_set_status_flags(irq, IRQ_NOAUTOEN);
-@@ -320,7 +352,8 @@ static int dwc3_qcom_setup_irq(struct platform_device *pdev)
- qcom->hs_phy_irq = irq;
- }
-
-- irq = platform_get_irq_byname(pdev, "dp_hs_phy_irq");
-+ irq = dwc3_qcom_get_irq(pdev, "dp_hs_phy_irq",
-+ pdata ? pdata->dp_hs_phy_irq_index : -1);
- if (irq > 0) {
- irq_set_status_flags(irq, IRQ_NOAUTOEN);
- ret = devm_request_threaded_irq(qcom->dev, irq, NULL,
-@@ -334,7 +367,8 @@ static int dwc3_qcom_setup_irq(struct platform_device *pdev)
- qcom->dp_hs_phy_irq = irq;
- }
-
-- irq = platform_get_irq_byname(pdev, "dm_hs_phy_irq");
-+ irq = dwc3_qcom_get_irq(pdev, "dm_hs_phy_irq",
-+ pdata ? pdata->dm_hs_phy_irq_index : -1);
- if (irq > 0) {
- irq_set_status_flags(irq, IRQ_NOAUTOEN);
- ret = devm_request_threaded_irq(qcom->dev, irq, NULL,
-@@ -348,7 +382,8 @@ static int dwc3_qcom_setup_irq(struct platform_device *pdev)
- qcom->dm_hs_phy_irq = irq;
- }
-
-- irq = platform_get_irq_byname(pdev, "ss_phy_irq");
-+ irq = dwc3_qcom_get_irq(pdev, "ss_phy_irq",
-+ pdata ? pdata->ss_phy_irq_index : -1);
- if (irq > 0) {
- irq_set_status_flags(irq, IRQ_NOAUTOEN);
- ret = devm_request_threaded_irq(qcom->dev, irq, NULL,
-@@ -371,11 +406,11 @@ static int dwc3_qcom_clk_init(struct dwc3_qcom *qcom, int count)
- struct device_node *np = dev->of_node;
- int i;
-
-- qcom->num_clocks = count;
--
-- if (!count)
-+ if (!np || !count)
- return 0;
-
-+ qcom->num_clocks = count;
-+
- qcom->clks = devm_kcalloc(dev, qcom->num_clocks,
- sizeof(struct clk *), GFP_KERNEL);
- if (!qcom->clks)
-@@ -409,12 +444,103 @@ static int dwc3_qcom_clk_init(struct dwc3_qcom *qcom, int count)
- return 0;
- }
-
--static int dwc3_qcom_probe(struct platform_device *pdev)
-+static int dwc3_qcom_acpi_register_core(struct platform_device *pdev)
- {
-+ struct dwc3_qcom *qcom = platform_get_drvdata(pdev);
-+ struct device *dev = &pdev->dev;
-+ struct resource *res, *child_res = NULL;
-+ int irq;
-+ int ret;
-+
-+ qcom->dwc3 = platform_device_alloc("dwc3", PLATFORM_DEVID_AUTO);
-+ if (!qcom->dwc3)
-+ return -ENOMEM;
-+
-+ qcom->dwc3->dev.parent = dev;
-+ qcom->dwc3->dev.type = dev->type;
-+ qcom->dwc3->dev.dma_mask = dev->dma_mask;
-+ qcom->dwc3->dev.dma_parms = dev->dma_parms;
-+ qcom->dwc3->dev.coherent_dma_mask = dev->coherent_dma_mask;
-+
-+ child_res = kcalloc(2, sizeof(*child_res), GFP_KERNEL);
-+ if (!child_res)
-+ return -ENOMEM;
-+
-+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-+ if (!res) {
-+ dev_err(&pdev->dev, "failed to get memory resource\n");
-+ ret = -ENODEV;
-+ goto out;
-+ }
-+
-+ child_res[0].flags = res->flags;
-+ child_res[0].start = res->start;
-+ child_res[0].end = child_res[0].start +
-+ qcom->acpi_pdata->dwc3_core_base_size;
-+
-+ irq = platform_get_irq(pdev, 0);
-+ child_res[1].flags = IORESOURCE_IRQ;
-+ child_res[1].start = child_res[1].end = irq;
-+
-+ ret = platform_device_add_resources(qcom->dwc3, child_res, 2);
-+ if (ret) {
-+ dev_err(&pdev->dev, "failed to add resources\n");
-+ goto out;
-+ }
-+
-+ ret = platform_device_add(qcom->dwc3);
-+ if (ret)
-+ dev_err(&pdev->dev, "failed to add device\n");
-+
-+out:
-+ kfree(child_res);
-+ return ret;
-+}
-+
-+static int dwc3_qcom_of_register_core(struct platform_device *pdev)
-+{
-+ struct dwc3_qcom *qcom = platform_get_drvdata(pdev);
- struct device_node *np = pdev->dev.of_node, *dwc3_np;
- struct device *dev = &pdev->dev;
-+ int ret;
-+
-+ dwc3_np = of_get_child_by_name(np, "dwc3");
-+ if (!dwc3_np) {
-+ dev_err(dev, "failed to find dwc3 core child\n");
-+ return -ENODEV;
-+ }
-+
-+ ret = of_platform_populate(np, NULL, NULL, dev);
-+ if (ret) {
-+ dev_err(dev, "failed to register dwc3 core - %d\n", ret);
-+ return ret;
-+ }
-+
-+ qcom->dwc3 = of_find_device_by_node(dwc3_np);
-+ if (!qcom->dwc3) {
-+ dev_err(dev, "failed to get dwc3 platform device\n");
-+ return -ENODEV;
-+ }
-+
-+ return 0;
-+}
-+
-+static const struct dwc3_acpi_pdata sdm845_acpi_pdata = {
-+ .qscratch_base_offset = SDM845_QSCRATCH_BASE_OFFSET,
-+ .qscratch_base_size = SDM845_QSCRATCH_SIZE,
-+ .dwc3_core_base_size = SDM845_DWC3_CORE_SIZE,
-+ .hs_phy_irq_index = 1,
-+ .dp_hs_phy_irq_index = 4,
-+ .dm_hs_phy_irq_index = 3,
-+ .ss_phy_irq_index = 2
-+};
-+
-+static int dwc3_qcom_probe(struct platform_device *pdev)
-+{
-+ struct device_node *np = pdev->dev.of_node;
-+ struct device *dev = &pdev->dev;
- struct dwc3_qcom *qcom;
-- struct resource *res;
-+ struct resource *res, *parent_res = NULL;
- int ret, i;
- bool ignore_pipe_clk;
-
-@@ -425,6 +551,14 @@ static int dwc3_qcom_probe(struct platform_device *pdev)
- platform_set_drvdata(pdev, qcom);
- qcom->dev = &pdev->dev;
-
-+ if (ACPI_HANDLE(dev)) {
-+ qcom->acpi_pdata = acpi_device_get_match_data(dev);
-+ if (!qcom->acpi_pdata) {
-+ dev_err(&pdev->dev, "no supporting ACPI device data\n");
-+ return -EINVAL;
-+ }
-+ }
-+
- qcom->resets = devm_reset_control_array_get_optional_exclusive(dev);
- if (IS_ERR(qcom->resets)) {
- ret = PTR_ERR(qcom->resets);
-@@ -454,7 +588,21 @@ static int dwc3_qcom_probe(struct platform_device *pdev)
- }
-
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-- qcom->qscratch_base = devm_ioremap_resource(dev, res);
-+
-+ if (np) {
-+ parent_res = res;
-+ } else {
-+ parent_res = kmemdup(res, sizeof(struct resource), GFP_KERNEL);
-+ if (!parent_res)
-+ return -ENOMEM;
-+
-+ parent_res->start = res->start +
-+ qcom->acpi_pdata->qscratch_base_offset;
-+ parent_res->end = parent_res->start +
-+ qcom->acpi_pdata->qscratch_base_size;
-+ }
-+
-+ qcom->qscratch_base = devm_ioremap_resource(dev, parent_res);
- if (IS_ERR(qcom->qscratch_base)) {
- dev_err(dev, "failed to map qscratch, err=%d\n", ret);
- ret = PTR_ERR(qcom->qscratch_base);
-@@ -462,13 +610,8 @@ static int dwc3_qcom_probe(struct platform_device *pdev)
- }
-
- ret = dwc3_qcom_setup_irq(pdev);
-- if (ret)
-- goto clk_disable;
--
-- dwc3_np = of_get_child_by_name(np, "dwc3");
-- if (!dwc3_np) {
-- dev_err(dev, "failed to find dwc3 core child\n");
-- ret = -ENODEV;
-+ if (ret) {
-+ dev_err(dev, "failed to setup IRQs, err=%d\n", ret);
- goto clk_disable;
- }
-
-@@ -481,16 +624,13 @@ static int dwc3_qcom_probe(struct platform_device *pdev)
- if (ignore_pipe_clk)
- dwc3_qcom_select_utmi_clk(qcom);
-
-- ret = of_platform_populate(np, NULL, NULL, dev);
-- if (ret) {
-- dev_err(dev, "failed to register dwc3 core - %d\n", ret);
-- goto clk_disable;
-- }
-+ if (np)
-+ ret = dwc3_qcom_of_register_core(pdev);
-+ else
-+ ret = dwc3_qcom_acpi_register_core(pdev);
-
-- qcom->dwc3 = of_find_device_by_node(dwc3_np);
-- if (!qcom->dwc3) {
-- dev_err(&pdev->dev, "failed to get dwc3 platform device\n");
-- ret = -ENODEV;
-+ if (ret) {
-+ dev_err(dev, "failed to register DWC3 Core, err=%d\n", ret);
- goto depopulate;
- }
-
-@@ -514,7 +654,10 @@ static int dwc3_qcom_probe(struct platform_device *pdev)
- return 0;
-
- depopulate:
-- of_platform_depopulate(&pdev->dev);
-+ if (np)
-+ of_platform_depopulate(&pdev->dev);
-+ else
-+ platform_device_put(pdev);
- clk_disable:
- for (i = qcom->num_clocks - 1; i >= 0; i--) {
- clk_disable_unprepare(qcom->clks[i]);
-@@ -601,6 +744,12 @@ static const struct of_device_id dwc3_qcom_of_match[] = {
- };
- MODULE_DEVICE_TABLE(of, dwc3_qcom_of_match);
-
-+static const struct acpi_device_id dwc3_qcom_acpi_match[] = {
-+ { "QCOM2430", (unsigned long)&sdm845_acpi_pdata },
-+ { },
-+};
-+MODULE_DEVICE_TABLE(acpi, dwc3_qcom_acpi_match);
-+
- static struct platform_driver dwc3_qcom_driver = {
- .probe = dwc3_qcom_probe,
- .remove = dwc3_qcom_remove,
-@@ -608,6 +757,7 @@ static struct platform_driver dwc3_qcom_driver = {
- .name = "dwc3-qcom",
- .pm = &dwc3_qcom_dev_pm_ops,
- .of_match_table = dwc3_qcom_of_match,
-+ .acpi_match_table = ACPI_PTR(dwc3_qcom_acpi_match),
- },
- };
-
---
-2.21.0
-
-From 2511cdbc0cdd6dea8226fbb984418f06bc1983a9 Mon Sep 17 00:00:00 2001
-From: Lee Jones <lee.jones@linaro.org>
-Date: Mon, 10 Jun 2019 09:42:12 +0100
-Subject: [PATCH 7/8] usb: dwc3: qcom: Start USB in 'host mode' on the SDM845
-
-When booting with Device Tree, the current default boot configuration
-table option, the request to boot via 'host mode' comes from the
-'dr_mode' property. A property of the same name can be used inside
-ACPI tables too. However it is missing from the SDM845's ACPI tables
-so we have to supply this information using Platform Device Properties
-instead.
-
-This does not change the behaviour of any currently supported devices.
-The property is only set on ACPI enabled platforms, thus for H/W
-booting DT, unless a 'dr_mode' property is present, the default is
-still OTG (On-The-Go) as per [0]. Any new ACPI devices added will
-also be able to over-ride this implementation by providing a 'dr_mode'
-property in their ACPI tables. In cases where 'dr_mode' is omitted
-from the tables AND 'host mode' should not be the default (very
-unlikely), then we will have to add some way of choosing between them
-at run time - most likely by ACPI HID.
-
-[0] Documentation/devicetree/bindings/usb/generic.txt
-
-Signed-off-by: Lee Jones <lee.jones@linaro.org>
----
- drivers/usb/dwc3/dwc3-qcom.c | 12 ++++++++++++
- 1 file changed, 12 insertions(+)
-
-diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
-index 1e1f12b7991d..55ba04254e38 100644
---- a/drivers/usb/dwc3/dwc3-qcom.c
-+++ b/drivers/usb/dwc3/dwc3-qcom.c
-@@ -444,6 +444,11 @@ static int dwc3_qcom_clk_init(struct dwc3_qcom *qcom, int count)
- return 0;
- }
-
-+static const struct property_entry dwc3_qcom_acpi_properties[] = {
-+ PROPERTY_ENTRY_STRING("dr_mode", "host"),
-+ {}
-+};
-+
- static int dwc3_qcom_acpi_register_core(struct platform_device *pdev)
- {
- struct dwc3_qcom *qcom = platform_get_drvdata(pdev);
-@@ -488,6 +493,13 @@ static int dwc3_qcom_acpi_register_core(struct platform_device *pdev)
- goto out;
- }
-
-+ ret = platform_device_add_properties(qcom->dwc3,
-+ dwc3_qcom_acpi_properties);
-+ if (ret < 0) {
-+ dev_err(&pdev->dev, "failed to add properties\n");
-+ goto out;
-+ }
-+
- ret = platform_device_add(qcom->dwc3);
- if (ret)
- dev_err(&pdev->dev, "failed to add device\n");
---
-2.21.0
-
-From 63a5217702e09f913bcc2d1c98285e7f3d9d1f31 Mon Sep 17 00:00:00 2001
-From: Lee Jones <lee.jones@linaro.org>
-Date: Mon, 10 Jun 2019 09:42:13 +0100
-Subject: [PATCH 8/8] usb: dwc3: qcom: Improve error handling
-
-dwc3_qcom_clk_init() is called with of_count_phandle_with_args() as an
-argument. If of_count_phandle_with_args() returns an error, the number
-of clocks will be a negative value and will lead to undefined behaviour.
-
-Ensure we check for an error before attempting to blindly use the value.
-
-Signed-off-by: Lee Jones <lee.jones@linaro.org>
-Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
----
- drivers/usb/dwc3/dwc3-qcom.c | 3 +++
- 1 file changed, 3 insertions(+)
-
-diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
-index 55ba04254e38..e4dac82abd7d 100644
---- a/drivers/usb/dwc3/dwc3-qcom.c
-+++ b/drivers/usb/dwc3/dwc3-qcom.c
-@@ -409,6 +409,9 @@ static int dwc3_qcom_clk_init(struct dwc3_qcom *qcom, int count)
- if (!np || !count)
- return 0;
-
-+ if (count < 0)
-+ return count;
-+
- qcom->num_clocks = count;
-
- qcom->clks = devm_kcalloc(dev, qcom->num_clocks,
---
-2.21.0
-