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");