From patchwork Wed Jun 5 11:43: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: 165869 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp7217046ili; Wed, 5 Jun 2019 04:43:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqz1PaEJKpi1YXpYEqaB/6531HJRuOJSLF8vhYnvWN9/ecPGF5v4OzchuyTpSY6/Pa1tQTk8 X-Received: by 2002:a17:90a:a415:: with SMTP id y21mr30235411pjp.75.1559734998876; Wed, 05 Jun 2019 04:43:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559734998; cv=none; d=google.com; s=arc-20160816; b=ucZ8mxlupdaoEZkkvvq4Vzly2s++Tm31BcaWXXkEshqbflDRAIJF3L37AJ/qnclw2h V/HkRba+nQiEoIgDRINSjUH+FjlsD33B/0U55gmy+0N6mxo4PCgrm8lx2MsTt/ofW2lu eBdJ8bjpOXZKN0KPgHMqzQsG2OmfjpbXDLXBM4++suMa0ANpLUsr7nRh1dntc3nBmEnw GjvN45S0UjkNe3MpeUVqa2yC/deU7GlWasiZxD/ugWlrd82zf4Re4AWDHtmp2IqBb3Vf SvoVdjPU2MRbOQCIwIDsn+EOE+/Ar4FqahMxglNI7YBLNqLVq+5GfEPIVy/0ZlLbSya0 nh7w== 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=z/QS9APB3f0tOtz3OBlD465368gQgSranvS5WczfcW5EJuA0rsaC68X8BS6Wx8GBsB Y4o+22i0p7sBmGa3Ep00/HiYubUgspRG/acQ+NecGm7M3ZvD98rRqtQq8sYcUvt0F/VL pCxJZe5jgB1t6jgicra6ODXo8uDSGn4wk7KllS6o4aDoWD8zJ4HLqUl4oXpXyoj/oWWl iwBDdUbO8n0iS00qBanANqEoZNQ4S8EE9xevv02OzRZnDzk6Ynf7nI29RMLMmey0VZB0 dIW6YeGuQn3ri8GHXlRtn2ilbf9lXrcwY6lxPCDDHRGD7W5TMugqx8X1u0ksrPHJaU2h +BVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VJ9UZTvA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; 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 b5si27804637pfi.205.2019.06.05.04.43.18; Wed, 05 Jun 2019 04:43:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VJ9UZTvA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727581AbfFELnR (ORCPT + 30 others); Wed, 5 Jun 2019 07:43:17 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:39030 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727574AbfFELnP (ORCPT ); Wed, 5 Jun 2019 07:43:15 -0400 Received: by mail-wr1-f68.google.com with SMTP id x4so19129204wrt.6 for ; Wed, 05 Jun 2019 04:43:14 -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=VJ9UZTvA3X5aVsLc1syf0WgRbb9hveDRMQ0o4bi7e3TWI3hu59qIVIWzNCnCLFPvcV BkmcBpcged+/ot/AjzaUn3vAPGguN1YUdBFOzAr9oExAYw7Ep1MDcXzgyTSVLD+1X0rx dxbz6b7aPBKYIzI6Q1tMn3Dff1B4Exaufc7li5HGHTsp16jBRrpm1KtLBM7Ot+Khe9ek OmNNy9J2Aw++vb6P1uGKXA9fGZfpgpj3ZXvK+9jGl6YEkkQB52v5yTZQzOdLLxO7ZoSu 0K8ZIZ5JaRhv8PVqmLoQ8VfacQZ9B5Xr/NDf4obTBbtgpXFwiD8d097j0nFr2ss+TE6B pv5Q== 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=M5ykgmnjCbWrNhHb1M/ODu8EaO/1LjXLrI9aWzfNuYiIjvMJZYhBDZajnZgXDhccTA 0rKDFEskxKvlrGpfGKa4y+QXxt8C+wcZVa4e+6AadDmhuXkZx+cxPyU23Q5iMpo+r25m 1P0D6wDlieOf5kzkqarSsdQtZwYjSyCfg1vIJTrT8FlU5xhdoV0d6uqRcUQeWX010MHX 03+Ou95lmgVVtM7kAOr8PJ1X7gicPNZrpdkd2J30uGHJekjra3MomACx0h/2q6Nb+AmY N689ZBsFVPLbkOL47ULPKtNjQKoRAZhoQVdESnwOK80F9QJf/boWB8l92LmEWXV24toH f5Dw== X-Gm-Message-State: APjAAAWbAMYkiuCHWC8nWtq/IKslV0yOa4t4Dwn/MsvjzF/dnH2631k4 aToyZee2BCVGHnUaNrKuoNk+2A== X-Received: by 2002:a5d:684c:: with SMTP id o12mr11703656wrw.305.1559734993874; Wed, 05 Jun 2019 04:43:13 -0700 (PDT) Received: from localhost.localdomain ([2.27.167.43]) by smtp.gmail.com with ESMTPSA id 34sm27718740wre.32.2019.06.05.04.43.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Jun 2019 04:43:13 -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 7/8] usb: dwc3: qcom: Start USB in 'host mode' on the SDM845 Date: Wed, 5 Jun 2019 12:43:01 +0100 Message-Id: <20190605114302.22509-7-lee.jones@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190605114302.22509-1-lee.jones@linaro.org> References: <20190605114302.22509-1-lee.jones@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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");