From patchwork Fri Jun 7 08:28:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 166063 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp346102ili; Fri, 7 Jun 2019 01:29:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqyZkmJKpnPGfpXRmI+AhQRXUrCYO2hn6ChCew1SjfbrlRUKAFcb1xG/bWwEP7I1SPNy8X7v X-Received: by 2002:a17:90a:7107:: with SMTP id h7mr4130439pjk.38.1559896147607; Fri, 07 Jun 2019 01:29:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559896147; cv=none; d=google.com; s=arc-20160816; b=KzDqAP4jmHCBVs1r0kgBE2sfu/j9kt9bjhRJfTrp/46JN3mdoRGq19rIA4bxHvDQ0w ecjfp8b5NkbZazESsyf3lVI8nTToX1oh4nB46cPcePk+XVvuOHBG0W0kD52flAFQoNHz VXpOBqxPYXeaekRpy+C/yeOcqEafdYjHei2dqa7CZfgcPhiMxs/xTY0TMpfJMmtIl6wV PJ/Allt8l45yh7dZlJdqJvE9rYFoL5lCh5FE93rxNuozKFEmlGq5g3BxvcLgh4XJQvXn 3mzAFyKEC4OkHFkVqiivBn7dxsiXZxHAm+Q9xuTw57twAq+KHWjifI2l7/DsUcEGV1IT GUdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=jzlILgVOq+qa8QnWXtHWObcbjxta0J+JIjopEg5uUuk=; b=XyXnE5Iu9w67GVhwnuM4RlrsIpxNv605kKBl3AvabXTvtflD2YqR2ysmxN49sGQUmR 2qGSnxTMq4PpgWB5yLQS9skhObpCDP2oMUl51y3sweNQnzMBwlHqH01irLtN5rZ2qMoA z7Y1yBjqJeO9DZeoTy2JZrHoVAcXy401GNlXHi68z926FN2ax+h3UrQVSHj1+1nmfaC8 zc20/RPBC7tYP5qDkAkcl4fMdmG6A2Blp/L54mFDIljsXGRN1UGFWc1XqLoEBJp6OupC 9ZdniNRXWZN2BTKQGu7Vj7m958y0veuu1QN8oq8a4IQ+JuvPsFdRr3GBKB7XSA8pMHt4 CFQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cOSA5ceD; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f92si1397328plf.100.2019.06.07.01.29.07; Fri, 07 Jun 2019 01:29:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cOSA5ceD; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727875AbfFGI3G (ORCPT + 5 others); Fri, 7 Jun 2019 04:29:06 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:36604 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727633AbfFGI3G (ORCPT ); Fri, 7 Jun 2019 04:29:06 -0400 Received: by mail-wr1-f68.google.com with SMTP id n4so1244831wrs.3 for ; Fri, 07 Jun 2019 01:29:05 -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=jzlILgVOq+qa8QnWXtHWObcbjxta0J+JIjopEg5uUuk=; b=cOSA5ceD6DU90AczpWWeDFQqT7XMn1TslGtXrC+8Qgjy95ZdnObkBVL8UMmW9IYqFZ ly1EA8Xk7mSCU+6Q97tX0JUm4+q68XTAiT5Mh8Stkx6bEhUsxeOx0qdEw45vNnkrBk/o /RGAxiHMWRp1LjcUAV0QP4+SMHQaUjIfnlbdXIt5EEi3e6g1JqKnlSvd2p5n9IskMzYX O5cxIdBRkHbuQletelSuTniO4lKcrqHCsUaTJOOH/wwIODiqHSs2BZLqtQUKArJK3uEh 3zDlBQREIzgp71Rt4d6nl5fPxN2UMvLeReBM/2nuGvF5iobsw4ccx3az8ignVslYorRA pELA== 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=jzlILgVOq+qa8QnWXtHWObcbjxta0J+JIjopEg5uUuk=; b=cqavWrUZzpoYfNBD8QOSZWJ+Y+sdcerH1xEGWwNM4OBASd+RRQ1jdJPGXOt9f21bXJ KRIOmA2IVwtwmN60m44PomaBr+Vxoi2FYmWxrUJlyliF12qcPWwxMbc0yIJdCdJW+VV7 ZCEieLEWb3yO1MEA0jIgBTyNzAMjdyeu7ctFiUf3cnesRr8jqd6upHtP47EObqIBBm7r DvB/eATfMWD90mV0BwpSpLnuoEjKnKtSlRkJaEx2t7UbdE/ewQftKUX0uVK9gOvjRHA2 dNftodpisFaDdWCsvYWbLKIhWliMz5zjrU4AlDhmS2kYDyVTxzAQ6sJgLn7f1qaTS4BK umfw== X-Gm-Message-State: APjAAAVr+LA1WlZ6phewYU2dWvRPyyPAXhqWKv+sDcrXu8Gh5RIHm8mz xIjRxtayM57FbWh7tIvVWoA36A== X-Received: by 2002:adf:e344:: with SMTP id n4mr8538433wrj.192.1559896144520; Fri, 07 Jun 2019 01:29:04 -0700 (PDT) Received: from localhost.localdomain ([2.31.167.229]) by smtp.gmail.com with ESMTPSA id a3sm1092946wmb.35.2019.06.07.01.29.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Jun 2019 01:29:04 -0700 (PDT) From: Lee Jones To: alokc@codeaurora.org, andy.gross@linaro.org, david.brown@linaro.org, wsa+renesas@sang-engineering.com, bjorn.andersson@linaro.org, linus.walleij@linaro.org, balbi@kernel.org, gregkh@linuxfoundation.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, jlhugo@gmail.com, linux-i2c@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-gpio@vger.kernel.org, linux-usb@vger.kernel.org, Lee Jones Subject: [PATCH v2 2/8] i2c: i2c-qcom-geni: Signify successful driver probe Date: Fri, 7 Jun 2019 09:28:55 +0100 Message-Id: <20190607082901.6491-2-lee.jones@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190607082901.6491-1-lee.jones@linaro.org> References: <20190607082901.6491-1-lee.jones@linaro.org> Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org 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 --- drivers/i2c/busses/i2c-qcom-geni.c | 2 ++ 1 file changed, 2 insertions(+) -- 2.17.1 diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c index 0fa93b448e8d..720131c40fe0 100644 --- a/drivers/i2c/busses/i2c-qcom-geni.c +++ b/drivers/i2c/busses/i2c-qcom-geni.c @@ -598,6 +598,8 @@ static int geni_i2c_probe(struct platform_device *pdev) return ret; } + dev_dbg(&pdev->dev, "Geni-I2C adaptor successfully added\n"); + return 0; } From patchwork Fri Jun 7 08:28:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 166064 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp346119ili; Fri, 7 Jun 2019 01:29:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqzauIEgY5HlswsLwSBJ+nQXWIl9BxCSyxjhn3IVoBBxeI9GRxDMy8bJ37SeiqmA91FfgvzT X-Received: by 2002:a63:5211:: with SMTP id g17mr1563844pgb.405.1559896148804; Fri, 07 Jun 2019 01:29:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559896148; cv=none; d=google.com; s=arc-20160816; b=rtM+1nhJzbjsJZqq2DtGq4+a6xARGSb19UEuWtJZggLwv5P+dduc81jCgMBrZL7DoQ h/5Ot+8rk0zS4oeU7xB+NbtKn+FmmhAqawcxwWi87jMWxpIL0yizl2Qs4fOq2JdnrFi+ hI8ehZ1yxxWVZYm+eDVmtrHuzkBTgO4GroRAfPb9D2w4njs6i50ZmutWQBtMqK6C4PCN S9MluQ45PJCXJPOHqYpUOtoopQqkDdU+o+o7MQ8mOyzVnMEXdzrNXRvh80vtKuSo/6fH QwW3zDznTao27jVMD49K1FZILE1OGPw5TV9BcA8tUW1FJjnnrZuatx4ZVnTrGxcD75sI vA9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=slZHnEyI/3MoxuWJDHsmJjpXD82N/IlcEekyL2S9VGE=; b=NnCC+DnrJXS55TOrio7tnDFKTLVU3gctiNsrIRzYoZ6lFYhXWeRNzP0NQ0HbvYl40K CsroQK4K6ocw5JdZOV1LHDl8kZI8bGEyCG2/A9mBTFZF4vTlQO/E0gh1uYaDZ57d7b7N u1rw5olGfRqVwnQhn2yftp7QMbDY2Rt7VHzftHooJjtfNCYG2J67uN8TYlvV8PKeObb9 zjd+A+7xRw4V0emVyeew550dzCE3diPYeVlHoMSH8iXESPLIygILN6FapBsif+cCPkW9 5TcwEkjYef8wdNFeJZ2gsK/gLsQF59NWL6l8noWpz0cbEpnogTPu00fri+HS4/UpUyRB Db4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=h368Vx+b; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f92si1397328plf.100.2019.06.07.01.29.08; Fri, 07 Jun 2019 01:29:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=h368Vx+b; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727922AbfFGI3H (ORCPT + 5 others); Fri, 7 Jun 2019 04:29:07 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:44033 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727263AbfFGI3H (ORCPT ); Fri, 7 Jun 2019 04:29:07 -0400 Received: by mail-wr1-f67.google.com with SMTP id b17so1213447wrq.11 for ; Fri, 07 Jun 2019 01:29:06 -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=slZHnEyI/3MoxuWJDHsmJjpXD82N/IlcEekyL2S9VGE=; b=h368Vx+bZLWr0EL6gvHppBTRSD6ciSTtbA08qgE1t4taX1ccezuX+R++aXgYdUyb8y xqoTAMMnzsmDvOSRVcoiqE2DFyL7TAalaemw43t6ANajvZ6wL8XrTBPrSPCTaI37JOuC C+5L9vX/X5BqHwAWrn/zEo5FE4WFb8KPgNsOOUzOOniHj63Dv+LyXOscl8dFK8OY1u1o E/HW76TPKlwVq8tS/VJKvSGDMVvLLxyzlkHBehpsvVoeNsfJs8g8ByEL/eJhJVNJIndQ NPfMFhvNB2TjUGWQBnh8Zme9lqz8vUpZd67SuV+J3hkfi1YClwo9647sqAdkVGU2KAHa w/Bg== 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=slZHnEyI/3MoxuWJDHsmJjpXD82N/IlcEekyL2S9VGE=; b=oHxDWcWtpgb4zuOx0wZcvpGjxcA0PCrw/n6iWp6jmDLq1tKRdieTE7V5UslYvF2sBD lMymOizaq08zPmB6N0wTpYhz2LvRjI/KZPYTB/L/+f1m1hzB92zj5RENr6mw9ZYcAO20 yz/nxnnz5xnsYkZLbW2yEsnhxgmpbVmUyfmf0lbTe1+uGcngwPW+ORzz9vTBS9jDWw25 sB7dpNfKmbLGsy3N2ywaAT5+EeLPSiAV6SJF+jkW8MZaFz0eabE3RlsMmEkF1ym7ZuSk DzHBpud9FB6JQYkR6mtBWnF4yLfXo8HefDA1oHV3NWuPBCWC2CMk9VEEMgNnca7b22si gzNA== X-Gm-Message-State: APjAAAW9K5TN86KR+QoADq7Bxz3MA40FYjb/w/ScHK5RagHWmEZSVCxO r1dEJI4pKn8HPTtezCIR4LmLnQ== X-Received: by 2002:a5d:5702:: with SMTP id a2mr370680wrv.89.1559896145359; Fri, 07 Jun 2019 01:29:05 -0700 (PDT) Received: from localhost.localdomain ([2.31.167.229]) by smtp.gmail.com with ESMTPSA id a3sm1092946wmb.35.2019.06.07.01.29.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Jun 2019 01:29:04 -0700 (PDT) From: Lee Jones To: alokc@codeaurora.org, andy.gross@linaro.org, david.brown@linaro.org, wsa+renesas@sang-engineering.com, bjorn.andersson@linaro.org, linus.walleij@linaro.org, balbi@kernel.org, gregkh@linuxfoundation.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, jlhugo@gmail.com, linux-i2c@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-gpio@vger.kernel.org, linux-usb@vger.kernel.org, Lee Jones Subject: [PATCH v2 3/8] pinctrl: msm: Add ability for drivers to supply a reserved GPIO list Date: Fri, 7 Jun 2019 09:28:56 +0100 Message-Id: <20190607082901.6491-3-lee.jones@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190607082901.6491-1-lee.jones@linaro.org> References: <20190607082901.6491-1-lee.jones@linaro.org> Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org 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 --- drivers/pinctrl/qcom/pinctrl-msm.c | 18 ++++++++++++++++++ drivers/pinctrl/qcom/pinctrl-msm.h | 1 + 2 files changed, 19 insertions(+) -- 2.17.1 diff --git a/drivers/pinctrl/qcom/pinctrl-msm.c b/drivers/pinctrl/qcom/pinctrl-msm.c index ee8119879c4c..3ac740b36508 100644 --- a/drivers/pinctrl/qcom/pinctrl-msm.c +++ b/drivers/pinctrl/qcom/pinctrl-msm.c @@ -607,8 +607,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); @@ -964,6 +979,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 c12048e54a6f..23b93ae92269 100644 --- a/drivers/pinctrl/qcom/pinctrl-msm.h +++ b/drivers/pinctrl/qcom/pinctrl-msm.h @@ -121,6 +121,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; From patchwork Fri Jun 7 08:29:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 166069 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp346289ili; Fri, 7 Jun 2019 01:29:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqxt8nXxzCqFHiQDZDeCSitidxQSqKLlZEWz1rZJ6PqpIxkzfHPJ5OZ8XyI8WMN4YFAKdaX/ X-Received: by 2002:a17:90a:f992:: with SMTP id cq18mr4121339pjb.54.1559896163193; Fri, 07 Jun 2019 01:29:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559896163; cv=none; d=google.com; s=arc-20160816; b=txa8p9VLEhyrLzZYGdINabh1WqI/OkdRFhvt0G8RvbEdQk+d1CqyZ91wGEwiXVzj9S ggxgAYE0ovtx3ZDsJzLj876cFGh89lNgBamfp+lP0Geve0a0G0coHD6g+uHFCc+Fmn0X MsJGGhnrRGei/XqpxzzfhIglLdRhkUeB8o0xzkoJQYztsDpgP39Tz5H39/LdaGp6sLN5 Y2zqguQXJ4ZsIeGmWFgC3NHRsbOQJehe25BEmDLKR/KGi1ESfCl2qaS1nWSUXMwu6n2M vDsqK1wfMvNGTORPlkbLOiSN289Uk8RPHxGUEbzfD6yWXy+IfqC8HM0uY3136T6ur8x5 VdSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=D1YI3KbYi08Gt53137zQUvYaTjAlj5pAkcVwiE+DyoM=; b=lLcDCN7PtlYnrxry5CPR32I3jL/KuRTfzXFxrvhVGLbfCqtS6w10RBdMBkrqtU30o6 s6A0PYYn6BJLPSqZiqafJ1+z/8iRC3Gh412rJvEuYSjl9oBpxNmd2pKjhCW3Yre1erPn 4ndSgiFpNsP/bnR1W+fIraghEKuArgyjXoY3BZ423xBGNyKq0s2PuGH00wPGsHmY84/V tuNXxgfcu7GMCdXxgQ59y2TILNO0aXTvxAi6QHL87Is/ztKMEwE4Tia7w/xjqKMniJyz GG8A2RvWgd05JQLMc0TX13x1I2f2N4PNA6d6eIx/jTX8gI2XdPbJiG1AjuyLJa7ZQ3Oh z//w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="onAIZ/TO"; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u13si1160643pgp.478.2019.06.07.01.29.22; Fri, 07 Jun 2019 01:29:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="onAIZ/TO"; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728042AbfFGI3O (ORCPT + 5 others); Fri, 7 Jun 2019 04:29:14 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:54123 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728011AbfFGI3M (ORCPT ); Fri, 7 Jun 2019 04:29:12 -0400 Received: by mail-wm1-f67.google.com with SMTP id x15so1083884wmj.3 for ; Fri, 07 Jun 2019 01:29: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=D1YI3KbYi08Gt53137zQUvYaTjAlj5pAkcVwiE+DyoM=; b=onAIZ/TOMn7vu8edA+Q0maMV3YC0CutOaiTQNG8U24Hc/kDK9jS/fHAe1a20UhN0fo 7cNBfiTEtfbcSLzpHgMkUSMC1YIVfogH4tTE/eLQukkLUqAGYI0rilKVlpKmsXpmHS+h 6IlLik8qVl5LgO9Vj0+ZcIBb3HCFhBAS05RmRB+Wb6MimlzNof589ejFsF2jCViPAMlp l6n4mF6y4W3R7NMRsous4rjXQC6Z/VnK87t4T7yzjnoxlLkj9oPQxofR4cn6zbLRpyeM OPYYEyhi3L76+sQ3G3maREXu+j/KZuaeQ79HK23oR43rcClTk7b235we0Bd9jZccRP8L PNBg== 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=D1YI3KbYi08Gt53137zQUvYaTjAlj5pAkcVwiE+DyoM=; b=H+svGX23AZTtj5THrtE5GG3rMZe3oWyHWCUNP5jGMFMqCyMYevLtfraIG2aJz25fbH RYJujNwBkz9LG2cX/cg1pbBD6v6Fex/PqIZgHb/BnNrIBbXSnLLYPasSWAx4HsjenDW0 ec4LVo72TmtmUX8HaPq3XUsYDl9lVznGlFdYjhzyovPrnTaK3IpTIaaJNYnZGu50I0GR isA8RGz9wtAmGIixZc/cH9uzodXHefXD9bEDvOrjEfRbCKSXdgiCHWgOlM26LG2V0Ess MnE7ozNc6kGp/WmHwCTLeHM6Ou+lkIyg7/d2FmuPKZd56osQh/V7VUkrmXlaXe6VwDEB GAng== X-Gm-Message-State: APjAAAW+q9qabOvf9IlIjZvbfdzTW+MjpSbuinJ9is+ZYqdcidfjxT// ZG4n+OGVBASJq8e68kODEQF6cg== X-Received: by 2002:a1c:b041:: with SMTP id z62mr2942302wme.113.1559896150318; Fri, 07 Jun 2019 01:29:10 -0700 (PDT) Received: from localhost.localdomain ([2.31.167.229]) by smtp.gmail.com with ESMTPSA id a3sm1092946wmb.35.2019.06.07.01.29.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Jun 2019 01:29:09 -0700 (PDT) From: Lee Jones To: alokc@codeaurora.org, andy.gross@linaro.org, david.brown@linaro.org, wsa+renesas@sang-engineering.com, bjorn.andersson@linaro.org, linus.walleij@linaro.org, balbi@kernel.org, gregkh@linuxfoundation.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, jlhugo@gmail.com, linux-i2c@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-gpio@vger.kernel.org, linux-usb@vger.kernel.org, Lee Jones Subject: [PATCH v2 7/8] usb: dwc3: qcom: Start USB in 'host mode' on the SDM845 Date: Fri, 7 Jun 2019 09:29:00 +0100 Message-Id: <20190607082901.6491-7-lee.jones@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190607082901.6491-1-lee.jones@linaro.org> References: <20190607082901.6491-1-lee.jones@linaro.org> Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org 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 --- drivers/usb/dwc3/dwc3-qcom.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) -- 2.17.1 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"); From patchwork Fri Jun 7 08:29:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 166066 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp346205ili; Fri, 7 Jun 2019 01:29:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqzzDeKlsn7YT7gL4zlIjo/QTblm92ABGcQZos+wzsSQUl/9ohEviNlK/P2cDCmCAaYDLeKE X-Received: by 2002:a17:902:24d:: with SMTP id 71mr55822687plc.166.1559896155054; Fri, 07 Jun 2019 01:29:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559896155; cv=none; d=google.com; s=arc-20160816; b=WKd56DJveCVcDwRhTxV9XeStkkcWfyyekYG+qzJluIA+znXlrgyAla27nUjzqAFt6g Zy5V/LaQJ7nOG/0tbIat2y+AMHczb9slpmcdvX68lh10xr5tTWVw0HvA34aXX8ijw3py eKaROVYZyKMWnj1lZprpdRspMWMoCktUECC2xGF0S2r+y9Gk/dwaVR4eKW6sNJwjzTBR vNA4NLSzHp6WBRNa0faBirh3SrYFBPyYqVY1uAGVCSh9C0Mxmh+Ao94Nje/1GY0x6Kr9 kqfhB6VrizIwQIY5r2rM+ofc/ICHTq+SvDDNB49MmxtRQKD2mh5HnD+YFBhzFEe+sXdg 4LBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=FalRLEADzMPtGyW8NIPAA0F5olxzxXGnPVoGFb+myak=; b=UezV+NHs2lEMvvXFMWRm8mc6vxFB3nNLxGXZYhbNrHIGoy5Q5K0MgtHXThROty+tg0 ldrEzXCqIV3T2/bgTmWSz+je8f9TMjFVSuMeboyXP/V7a6Q/hNoWX79O57yQipb8P7AG LpH2TY9/1yQjKiuCAjvbWtzpyoUraU2nkW5nbl2j630kJlWClp9DsOTI+pO8BdlG0Uhw yaQnI/eVcvr+N9ix4EUsVpRs0gqOHwUFed718jjS0COpLJZg7O8p/xxRjZpEWhxLHenG 7aIgV5vQWpPykQJlfAJ4J+gSfCKFe55lHXjiyDzFdka1Q4b028jub7sh293iv6UDUQ75 K/Bw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="qS6/gC3g"; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r18si1186838pgv.433.2019.06.07.01.29.14; Fri, 07 Jun 2019 01:29:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="qS6/gC3g"; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727941AbfFGI3N (ORCPT + 5 others); Fri, 7 Jun 2019 04:29:13 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:33503 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728042AbfFGI3N (ORCPT ); Fri, 7 Jun 2019 04:29:13 -0400 Received: by mail-wr1-f65.google.com with SMTP id n9so1261114wru.0 for ; Fri, 07 Jun 2019 01:29: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=FalRLEADzMPtGyW8NIPAA0F5olxzxXGnPVoGFb+myak=; b=qS6/gC3g0ivDxQeYTAyAXWuKblhoYJyrn1fhCTmRyYAb/dWfOeXaEtzpJDpgr4/keC y9YxUUGJsjTMzcLV0Xk+Gm3yNRHp+YTAA8eMqqZOxwkj8MByuQQdEKhqYlEO3weOrF7m Jm8HKR9UNUcaw6GVDTJe18vTDeIrxL/txUdpmREfkl/zV1qCJggDJ0qvOs0oFjXzfDhX QYmnCarRktfnHTYRBX9mOzCN0H8TbcO+skVCCW4zXhp9qmRFsbGuiOiABEgUZFpnmzsi uv5c8stevPakNzYje7bhOZlX4YXx0QxavvOfiqJC9mF+9fxItWO/Uh3ILMCG9Vx4dVGM pHYg== 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=FalRLEADzMPtGyW8NIPAA0F5olxzxXGnPVoGFb+myak=; b=qZQW1pIq16Sauk1KQKF278BU3tMjSwPmw/Z9Tb755vYScV6NxFA/lG0+YlG+/fW0cK 63mYsGpqKgb0JASahyp9ex5WTxoC9D+zxNgJoliNK13p4F5R3ict7TDB24zoApY+utSs 9hlQAUnpPR1qMX3IWRV6wHG8T+SPhKALqu9pugQNrkBBlVx6R/OldfjHMFDGmFXKhVLq XjUt2+aSA3EsU4C58mDjRYjPAFzgxzaBnv6tLEzaw2BAukpsiMkFNzgnDbelViQgSkIH oTExRM2L9np+/We3TKGkpWSWvD+HHsWZY2GirFdWKhI+RScce51uRqWr/NEcK8UDIHQe JyNg== X-Gm-Message-State: APjAAAWGP6sESjpBilmKDvd0KBjx98zKNSgqDIcp5lxCyOBYgwmKoiZh tPITBrWIRqX8scVIevdAZuWzDA== X-Received: by 2002:adf:ce8f:: with SMTP id r15mr21014523wrn.122.1559896151288; Fri, 07 Jun 2019 01:29:11 -0700 (PDT) Received: from localhost.localdomain ([2.31.167.229]) by smtp.gmail.com with ESMTPSA id a3sm1092946wmb.35.2019.06.07.01.29.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Jun 2019 01:29:10 -0700 (PDT) From: Lee Jones To: alokc@codeaurora.org, andy.gross@linaro.org, david.brown@linaro.org, wsa+renesas@sang-engineering.com, bjorn.andersson@linaro.org, linus.walleij@linaro.org, balbi@kernel.org, gregkh@linuxfoundation.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, jlhugo@gmail.com, linux-i2c@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-gpio@vger.kernel.org, linux-usb@vger.kernel.org, Lee Jones Subject: [PATCH v2 8/8] usb: dwc3: qcom: Improve error handling Date: Fri, 7 Jun 2019 09:29:01 +0100 Message-Id: <20190607082901.6491-8-lee.jones@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190607082901.6491-1-lee.jones@linaro.org> References: <20190607082901.6491-1-lee.jones@linaro.org> Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org 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 Reviewed-by: Bjorn Andersson --- drivers/usb/dwc3/dwc3-qcom.c | 3 +++ 1 file changed, 3 insertions(+) -- 2.17.1 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,