From patchwork Tue Sep 4 15:18:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Poulain X-Patchwork-Id: 145931 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp3791513ljw; Tue, 4 Sep 2018 08:19:09 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYRBcj++6AB+xrPMxVpFQ5Prozjz7y50/hDmZgptiGEa929t5MuernRwyAlE94Z8SgcRlMl X-Received: by 2002:a63:d443:: with SMTP id i3-v6mr30895181pgj.216.1536074349080; Tue, 04 Sep 2018 08:19:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536074349; cv=none; d=google.com; s=arc-20160816; b=kXl6Xqv/SUeTu3lWK6/yhlLCavGJF59JufvkVyFCleVl8P1fWakiVQhU89BQ5Sb6zE NW3+4VrCRtHrUndkA3ST6xVlZdJL3fzyUHBSfxcUQz0zy3kzOU8LAJir9oyilTtKa6QJ g3yTd+MlhE8du8SUU7ld/CQtAyq4tjKchOBAbllA0dNxkW177AEfJUfTJBY0DuRe4+WK ufoBzFbcen5DmBr8oicegVVVgKxo8DxM8pzIiLM99SYUHO18+QMitw2hzEBVPIEu5luy ycUAQuuUexsg5j29yBldeu06ca/pwarwSPDGdS/Z1S/br7EX8iIxlFp4+n67c458fheq uhxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=BZCgv7ZnNziCVwocxEfa9B5JEWHWfgm+orGzJkzoN1U=; b=XZe10WejtltZ8/cfdDRgFGLew1jOMHZf82fyidR3DTj7JcwrzP9VzcGZJQTobP9RIy 8LixEEvhf0ZKxpiXJXN3FsOSJKxG50xmHNMIqnIGwKga/sKe/bxxJXzdw0Djx6+B3uFL JQd1CsZb91SvQW+9rr1QQxRuQpiv5qXqEJKnhlqMRIDrkVLOl9kFr7MXfjnXSnZLO/Tg ck+urdY6hvKBDjtxW/vzuaA4dswXtrniRu0RjFpesFjaWgRMnXAzKjzR+ZLWQqAJZEH2 Ewpjl3PGPn1CxWS6EMmqThzXsaTb+wfFyIhERLFzE9AcymtwDeprZXNYRshG/l6807GJ uB8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GuPutQlk; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-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 n15-v6si23319017pgc.309.2018.09.04.08.19.08; Tue, 04 Sep 2018 08:19:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-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=GuPutQlk; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-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 S1726015AbeIDToi (ORCPT + 13 others); Tue, 4 Sep 2018 15:44:38 -0400 Received: from mail-wm0-f44.google.com ([74.125.82.44]:51510 "EHLO mail-wm0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727388AbeIDToh (ORCPT ); Tue, 4 Sep 2018 15:44:37 -0400 Received: by mail-wm0-f44.google.com with SMTP id y2-v6so4872133wma.1 for ; Tue, 04 Sep 2018 08:19:04 -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; bh=BZCgv7ZnNziCVwocxEfa9B5JEWHWfgm+orGzJkzoN1U=; b=GuPutQlk/s7bEGKqGuFigDaEuJwClH4ZX+lkyJHNAeRDhEUtsMnFUYPEzNFs2qxsr4 9Ai3XhCa4Ee7k/L052IR0vkhUXZNckDewQvoqMQk4sMKgAutoQdY5qYApebzx3+UDbZw /zM7yt4VgSOe6+dq9IQ7OnU+jZeGSV9BA6Alc= 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; bh=BZCgv7ZnNziCVwocxEfa9B5JEWHWfgm+orGzJkzoN1U=; b=gwzNUasJCOI3H0WcMBxAVXQPDB4HVI6xPOWK1iXdRQDaN1IKfcXKkTn4XtNGoMuLJr XvVAG3R1saMLKlm29Rm3icDL4KCDeyhBLs6Y2J/EBYRd2kjUsT0aWpQeGZHhHsRw5w0s aGe/aq8ux8ZaVZBHwGLl/n9Akct+yB72UBC+LUtiPXkmdSzYL69Xm+ANJRZ4mDHrwyJS vNzxMiY5Ymy3zSHC3nnbmtqSfyEqpXKPzp4OSUBwf2yQJhHLtOn10nB+WAqXpt6lqtwJ ROM3M4I1o7y2uZ+T64zoRpByvmdnH/AK4iFnfcgsLAXhbfk0Gamw4Z/syVea5tuvjvt0 o8dw== X-Gm-Message-State: APzg51AlBqwHrD/SbxyNHz3Xxm/5xfoW70SQBijYLdGvAeIUw1S2u0h2 wgWXkpIk39AcznkMGieqSoeSqA== X-Received: by 2002:a1c:a745:: with SMTP id q66-v6mr8152425wme.49.1536074343417; Tue, 04 Sep 2018 08:19:03 -0700 (PDT) Received: from lpoulain-ThinkPad-T470p.home (AToulouse-654-1-394-222.w90-55.abo.wanadoo.fr. [90.55.193.222]) by smtp.gmail.com with ESMTPSA id l24-v6sm40255033wrb.65.2018.09.04.08.19.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 04 Sep 2018 08:19:02 -0700 (PDT) From: Loic Poulain To: Peter.Chen@nxp.com Cc: linux-usb@vger.kernel.org, linux-arm-msm@vger.kernel.org, david.brown@linaro.org, robh+dt@kernel.org, bjorn.andersson@linaro.org, andy.gross@linaro.org, andy.shevchenko@gmail.com, Loic Poulain Subject: [PATCH v3 1/6] usb: chipidea: Add dynamic pinctrl selection Date: Tue, 4 Sep 2018 17:18:55 +0200 Message-Id: <1536074340-14840-1-git-send-email-loic.poulain@linaro.org> X-Mailer: git-send-email 2.7.4 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Some hardware implementations require to configure pins differently according to the USB role (host/device), this can be an update of the pins routing or a simple GPIO value change. This patch introduces new optional "host" and "device" pinctrls. If these pinctrls are defined by the device, they are respectively selected on host/device role start. If a default pinctrl exist, it is restored on host/device role stop. Signed-off-by: Loic Poulain --- v2: includes ordering v3: no change drivers/usb/chipidea/core.c | 19 +++++++++++++++++++ drivers/usb/chipidea/host.c | 9 +++++++++ drivers/usb/chipidea/udc.c | 9 +++++++++ include/linux/usb/chipidea.h | 6 ++++++ 4 files changed, 43 insertions(+) -- 2.7.4 diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 85fc6db..7bfcbb2 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -53,6 +53,7 @@ #include #include #include +#include #include #include #include @@ -723,6 +724,24 @@ static int ci_get_platdata(struct device *dev, else cable->connected = false; } + + platdata->pctl = devm_pinctrl_get(dev); + if (!IS_ERR(platdata->pctl)) { + struct pinctrl_state *p; + + p = pinctrl_lookup_state(platdata->pctl, "default"); + if (!IS_ERR(p)) + platdata->pins_default = p; + + p = pinctrl_lookup_state(platdata->pctl, "host"); + if (!IS_ERR(p)) + platdata->pins_host = p; + + p = pinctrl_lookup_state(platdata->pctl, "device"); + if (!IS_ERR(p)) + platdata->pins_device = p; + } + return 0; } diff --git a/drivers/usb/chipidea/host.c b/drivers/usb/chipidea/host.c index 4638d9b..d858a82 100644 --- a/drivers/usb/chipidea/host.c +++ b/drivers/usb/chipidea/host.c @@ -13,6 +13,7 @@ #include #include #include +#include #include "../host/ehci.h" @@ -153,6 +154,10 @@ static int host_start(struct ci_hdrc *ci) } } + if (ci->platdata->pins_host) + pinctrl_select_state(ci->platdata->pctl, + ci->platdata->pins_host); + ret = usb_add_hcd(hcd, 0, 0); if (ret) { goto disable_reg; @@ -197,6 +202,10 @@ static void host_stop(struct ci_hdrc *ci) } ci->hcd = NULL; ci->otg.host = NULL; + + if (ci->platdata->pins_host && ci->platdata->pins_default) + pinctrl_select_state(ci->platdata->pctl, + ci->platdata->pins_default); } diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index 9852ec5..829e947 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -1965,6 +1966,10 @@ void ci_hdrc_gadget_destroy(struct ci_hdrc *ci) static int udc_id_switch_for_device(struct ci_hdrc *ci) { + if (ci->platdata->pins_device) + pinctrl_select_state(ci->platdata->pctl, + ci->platdata->pins_device); + if (ci->is_otg) /* Clear and enable BSV irq */ hw_write_otgsc(ci, OTGSC_BSVIS | OTGSC_BSVIE, @@ -1983,6 +1988,10 @@ static void udc_id_switch_for_host(struct ci_hdrc *ci) hw_write_otgsc(ci, OTGSC_BSVIE | OTGSC_BSVIS, OTGSC_BSVIS); ci->vbus_active = 0; + + if (ci->platdata->pins_device && ci->platdata->pins_default) + pinctrl_select_state(ci->platdata->pctl, + ci->platdata->pins_default); } /** diff --git a/include/linux/usb/chipidea.h b/include/linux/usb/chipidea.h index 07f9936..63758c3 100644 --- a/include/linux/usb/chipidea.h +++ b/include/linux/usb/chipidea.h @@ -77,6 +77,12 @@ struct ci_hdrc_platform_data { struct ci_hdrc_cable vbus_extcon; struct ci_hdrc_cable id_extcon; u32 phy_clkgate_delay_us; + + /* pins */ + struct pinctrl *pctl; + struct pinctrl_state *pins_default; + struct pinctrl_state *pins_host; + struct pinctrl_state *pins_device; }; /* Default offset of capability registers */ From patchwork Tue Sep 4 15:18:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Poulain X-Patchwork-Id: 145933 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp3791556ljw; Tue, 4 Sep 2018 08:19:10 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbmtLTu5offIYhXEtrHej7UwcCXglhdQy2crc4RgJUd3tNbGymUqvYhoa5WUt4aoPMLcMrk X-Received: by 2002:a63:6746:: with SMTP id b67-v6mr11372126pgc.330.1536074350802; Tue, 04 Sep 2018 08:19:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536074350; cv=none; d=google.com; s=arc-20160816; b=xmFBznamPAk8H7b6mnZYHkd/BCaficOJfq4fI6/l3HWWDPAI36IVRg1ezAhZv1VJYR WKTBqu4/wiv2wtu8xNoWqJwOPhsvKYPol0sEjrjzAqTXr7KZ6sJjx6WqXoXCVNmGrUt4 ZuQRx1Df6+KtC61UV++dfypuZh/2ODW9zwcqZUh6IzlS4Ks9pf2uKGtX+mdOePrXkLq8 53Me7wt1d72eX1tu1+2jqqZaWx3eA2mRfD+jhiSSlqWPNkjfFoADTm2+jVV3MvCPfZJB cdfoFGm7rGE2N+EK0JhxFQjnCE1vgTOnIJ4zikg8PJlg9LPAsWXMwMssZw6hXKrIm4qt y5PQ== 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:arc-authentication-results; bh=jJ1U4kKx8193jG9tQkZcIBV20/yBv7/sRbP/e4dOMNo=; b=PHJgaSAjtUpVFSnmvLajDovjekFMPWbD+GUjPlwnlAYxnily6pEfCq/yJcEuylja1K ShBveyJSUh1fjcwwPaPDirPoKU3edBAWTnc9yxkyP1YWBgoSRaFlqxan//YU8n6ne4eh Fd+saMc/iU3px89v0U4dPvua9wF9DAtmaQlpEABMdgRoZCrcStq1Y7JcuW68xRmCI4aF 8aytGXTi+0w7S6r19hk3QRQljt/c0/PcvSugfsjbaz1hOlV8H/An0cZwe0HKBP8/5o1H tk8F38yr9aoqz1dFvrDw1rpU8wcs5H2arNbEEbbG2TJxNDQItVsq0c65mCO/MG9BkQxg SHtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=b9touJj3; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-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 n15-v6si23319017pgc.309.2018.09.04.08.19.10; Tue, 04 Sep 2018 08:19:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-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=b9touJj3; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-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 S1727186AbeIDTol (ORCPT + 13 others); Tue, 4 Sep 2018 15:44:41 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:51893 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727388AbeIDToj (ORCPT ); Tue, 4 Sep 2018 15:44:39 -0400 Received: by mail-wm0-f66.google.com with SMTP id y2-v6so4872255wma.1 for ; Tue, 04 Sep 2018 08:19: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=jJ1U4kKx8193jG9tQkZcIBV20/yBv7/sRbP/e4dOMNo=; b=b9touJj3MiUmzSKoxvjisezPgsU3C5H0wSy7lfOqvv9Q74U+Z/gUKMyexrVuiQw4UH WmBROPhbnrKKnkfFKxZrf4ELH8B2Xoy3SoZCZ9heBKRTU57ep03fcJLrLGGOMNpiM0bh Veb16dMqI7pPx/6e79REJsa81mv80TAlyCVP8= 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=jJ1U4kKx8193jG9tQkZcIBV20/yBv7/sRbP/e4dOMNo=; b=B8lZJ0lyhG2ni1lTwL/2fjzgLqgxShf1t8tnPtyO/A94MCQDZwghNjAuudgWUI0FLh NCnjVnQmmyDofFvDg1SEbHJQzknBHgY2Fzfor6M1lMl3WO1oWXAqEjLEPyvTOLsLtQB3 SHyTLg56lnvt95Fo9VrSwBBKnieKnX/JcDBjZsgI8nLqf2VNVtXQITtipLSV9v7VM1h0 ByFcFVcaMsjDe+ooABcdMJjepcdhUPPsH+PYEdEI1q1MYnA1y1hwMN4RNYKg9rqS1FNi KlOZ4HJoYg4HajSgkieIH4Hl5OZYGPbTIaDEXw1Clf6Gpp8VfEfbDpoUGlH5wQgg8WwM 57VA== X-Gm-Message-State: APzg51BtqD2/qyjxWBY+0pJ1WY5SJbQQ0tdaPxAVaHOsiYScEWrGjr0N p6p9tGFgioyLEF7N7Roh1qZNRg== X-Received: by 2002:a1c:b157:: with SMTP id a84-v6mr2873018wmf.18.1536074345443; Tue, 04 Sep 2018 08:19:05 -0700 (PDT) Received: from lpoulain-ThinkPad-T470p.home (AToulouse-654-1-394-222.w90-55.abo.wanadoo.fr. [90.55.193.222]) by smtp.gmail.com with ESMTPSA id l24-v6sm40255033wrb.65.2018.09.04.08.19.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 04 Sep 2018 08:19:04 -0700 (PDT) From: Loic Poulain To: Peter.Chen@nxp.com Cc: linux-usb@vger.kernel.org, linux-arm-msm@vger.kernel.org, david.brown@linaro.org, robh+dt@kernel.org, bjorn.andersson@linaro.org, andy.gross@linaro.org, andy.shevchenko@gmail.com, Loic Poulain Subject: [PATCH v3 2/6] doc: usb: ci-hdrc-usb2: Add pinctrl properties definition Date: Tue, 4 Sep 2018 17:18:56 +0200 Message-Id: <1536074340-14840-2-git-send-email-loic.poulain@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1536074340-14840-1-git-send-email-loic.poulain@linaro.org> References: <1536074340-14840-1-git-send-email-loic.poulain@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Some hardware implementations require to configure pins differently according to the USB role (host/device), this can be an update of the pins routing or a simple GPIO value change. This patch introduces new optional "host" and "device" pinctrls. If these pinctrls are defined by the device, they are respectively selected on host/device role start. Signed-off-by: Loic Poulain --- v2: Add new pin modes documentation (host, device) v3: rebase on usb-next Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt | 2 ++ 1 file changed, 2 insertions(+) -- 2.7.4 diff --git a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt index 2e93181..529e518 100644 --- a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt +++ b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt @@ -80,6 +80,8 @@ Optional properties: controller. It's expected that a mux state of 0 indicates device mode and a mux state of 1 indicates host mode. - mux-control-names: Shall be "usb_switch" if mux-controls is specified. +- pinctrl-names: Names for optional pin modes in "default", "host", "device" +- pinctrl-n: alternate pin modes i.mx specific properties - fsl,usbmisc: phandler of non-core register device, with one From patchwork Tue Sep 4 15:18:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Poulain X-Patchwork-Id: 145934 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp3791578ljw; Tue, 4 Sep 2018 08:19:12 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYWMIEd0tXUKGooQ957rwtUDK7Gwe+dJjl1iNwRF8aPg9ZPrZS5t/vc9WUSQIWbv/UJcZ3z X-Received: by 2002:a63:3dc6:: with SMTP id k189-v6mr17102573pga.191.1536074351588; Tue, 04 Sep 2018 08:19:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536074351; cv=none; d=google.com; s=arc-20160816; b=sR/tWF5+Qs8EtIFhp916GsdSWvO8fDEbghdoLCE8g1XYqEWeqSm9hRc7OX2YIxnCiW 48FUrPVDWztjsqiFyJbTw4M8g0Bv6INAioWsRoAsluzcH5EUbOZT2BdPYXgTkgt5p8nJ LmR7G4VFcYP6MUZbFfzr87KVecD1oup63KklUptSv+MfR8DAPC7E+lQxS3ct3ncmmwvi hM6Z9l2XsoEVzP9cE5i3AvFihMXqLSs1NCtpkvOVVgJ2dAHBMdrzFCDjLVpyiXNA0Spx OTicmpnq3OSL8plpHXi27enZudggRzt4qpkl+oui/JTIgLoTaaA/GYNZdQ5guF9rqBo+ A/iQ== 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:arc-authentication-results; bh=DaoitWn4N4E8MxKe6c9On/izFsNnJ18tWXmCQk3yml4=; b=l2Q3nS8qUSjxWOSbYQn7S5RNWNhfbAngdzUoXqxXh52dpiEsLI8X17VlTGi6up7wP2 C94+zocsGxqD1EwYHpcchiLptiiLoeRGU3KeqBpLw6J3di5IIbAG8aIhDtNHwPhyMveQ iJxeeZrlUpOcKK+2f5hLNZekG/QGkUq7fDAdL9bnypKgikmjmXNw6L2Ng8M8HnsNDDFp +rlO6yKitsA2giX4wDnS5sqaxu01aak07BMPqg9vQpoJXCn1vphpe5O3HdBLaQ/lbGiP awm9mjYB9GnBD5S4dSoV1DB1SIg6VJnfGzmdZmzNHr0wqr2OnuwW1aDvfrWSd5Aoq7EK i+qA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fa1LNNpX; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-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 n15-v6si23319017pgc.309.2018.09.04.08.19.11; Tue, 04 Sep 2018 08:19:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-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=fa1LNNpX; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-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 S1727613AbeIDTom (ORCPT + 13 others); Tue, 4 Sep 2018 15:44:42 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:36572 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727615AbeIDTom (ORCPT ); Tue, 4 Sep 2018 15:44:42 -0400 Received: by mail-wr1-f67.google.com with SMTP id m27-v6so4420447wrf.3 for ; Tue, 04 Sep 2018 08:19:09 -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=DaoitWn4N4E8MxKe6c9On/izFsNnJ18tWXmCQk3yml4=; b=fa1LNNpXRiUjwIDuNA5uLZ6TgYcZTxhpgDq4ZIE7lYKoik1y+ZYlTXjdgEwblpAiVN 6cAmmsIejoGUQyqAI/6NlFIuccnQ/8ndhU51CkHkyl0rDpqN64cWY/mK/HNDw8z7B2J3 cYFbIT4PeXZCjTnNtIyo4joLyYLfb9RS1obsw= 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=DaoitWn4N4E8MxKe6c9On/izFsNnJ18tWXmCQk3yml4=; b=sEV+G8smbZCV2rRXwoWFwsqxRWG+sWVuu2mKNjutf9SJwp0cgp3d8mcix58Gf40IeK mON6N6jImpP43YDH2j5/SOZ8ylEa7eM7dRf+PG0bezHeTsPR6uOyWUYJDokHzctVvY53 IAnd/mRZf/hxy1G3lrxwUjP55pydfYW+kS4Ay9RhpcEu/xRuyREBAMxTWLHzJH8bcHfZ sTKm5QWDnHRIQGmDxTT7LfP6DsIUKeny/Uvqq35A9SmSdvhR7w+Ql1ri38iXdvmUHsqS DUO40BU56qJ7vhApvqPp61Rm3XyPVi36m4Bv3RYndSPoJCxtnjHYphuDoZegYk9glyRX 9A8w== X-Gm-Message-State: APzg51D5COVp3LntWA+lJAWO7JPKIbeXR8IxpHRaDdjW8xkitz6iGP9G d5BRDSpmG5zwdPuQNbbW3r6OYQ== X-Received: by 2002:adf:be81:: with SMTP id i1-v6mr21422160wrh.235.1536074348497; Tue, 04 Sep 2018 08:19:08 -0700 (PDT) Received: from lpoulain-ThinkPad-T470p.home (AToulouse-654-1-394-222.w90-55.abo.wanadoo.fr. [90.55.193.222]) by smtp.gmail.com with ESMTPSA id l24-v6sm40255033wrb.65.2018.09.04.08.19.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 04 Sep 2018 08:19:07 -0700 (PDT) From: Loic Poulain To: Peter.Chen@nxp.com Cc: linux-usb@vger.kernel.org, linux-arm-msm@vger.kernel.org, david.brown@linaro.org, robh+dt@kernel.org, bjorn.andersson@linaro.org, andy.gross@linaro.org, andy.shevchenko@gmail.com, Loic Poulain Subject: [PATCH v3 4/6] usb: chipidea: Fix otg event handler Date: Tue, 4 Sep 2018 17:18:58 +0200 Message-Id: <1536074340-14840-4-git-send-email-loic.poulain@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1536074340-14840-1-git-send-email-loic.poulain@linaro.org> References: <1536074340-14840-1-git-send-email-loic.poulain@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org At OTG work running time, it's possible that several events need to be addressed (e.g. ID and VBUS events). The current implementation handles only one event at a time which leads to ignoring the other one. Fix it. Signed-off-by: Loic Poulain --- v2: v3: no change drivers/usb/chipidea/otg.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) -- 2.7.4 diff --git a/drivers/usb/chipidea/otg.c b/drivers/usb/chipidea/otg.c index db4ceff..f25d482 100644 --- a/drivers/usb/chipidea/otg.c +++ b/drivers/usb/chipidea/otg.c @@ -203,14 +203,17 @@ static void ci_otg_work(struct work_struct *work) } pm_runtime_get_sync(ci->dev); + if (ci->id_event) { ci->id_event = false; ci_handle_id_switch(ci); - } else if (ci->b_sess_valid_event) { + } + + if (ci->b_sess_valid_event) { ci->b_sess_valid_event = false; ci_handle_vbus_change(ci); - } else - dev_err(ci->dev, "unexpected event occurs at %s\n", __func__); + } + pm_runtime_put_sync(ci->dev); enable_irq(ci->irq); From patchwork Tue Sep 4 15:18:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Poulain X-Patchwork-Id: 145935 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp3791624ljw; Tue, 4 Sep 2018 08:19:13 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYzmy1IbhYCY/dcEHnewnvBwNfDDzJ4W9bnZI0NADvJIyYCtp2qblOe9ePDCBq/gfBPqdv8 X-Received: by 2002:a63:1a61:: with SMTP id a33-v6mr31871884pgm.9.1536074353604; Tue, 04 Sep 2018 08:19:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536074353; cv=none; d=google.com; s=arc-20160816; b=cCxzihE584CmKRxe30amArMHWIS/FGDOMMDIiBVG9f8J4STXNvkteruQGXErM5PUH0 I8LeGU2E+jjT/oxwQn+hfOmeRIJ9r6fSwTEYNvrC9WSFOmcolHHVWEexoy24F8CFmcVC BTHrfwUVN4dXHE9nEYp+Y6eneRl8/tLtOpsD2e9ASiQyCfTCONWG1aBp/7c9XsUU6c0j VnX2fNN8tgsepxVIhEndjrdZZvWnha1NXee5b6F+Fuc+jpKFwrBs5SSflWx4CfGBvmi9 mNPgT5wJGthZ3pq95I+Sx4e0yxTDK27yOoddVwIunaO1I4ojDnPtTznoT24eXKLJlOJR mJIg== 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:arc-authentication-results; bh=JUgb9vugJT+6B6QjtpmWBvMX+Wq5UlUI1pzbqQTz2N0=; b=tnbrvAwhP2m5DuwS0kNm7I5zHQ8Nn3H+UDVxSFXde14bWWgkcdcm4eWIvaozBH+SWw /QuD7DThwt+byDWiWSzcaW9ldxocZL6c1CYKqhhtaNVg7qh3FeMxKFzGyShCgYwGd4QX lwoQYp8yZxnv6uWTKJ+7IecUK/5Xv55eEF1Veurs+Qhf+y465obNNAZvSou6bkbkxSeM 58axIBwOwyJdDE8MDvHJqmH7NBwwH1jvNuXuKt56FhB1JUNbYyMVDR/JMpMI0YaCPdug NyWu8hHB32Dl5NfNL9E0DDA3UNJC1hlSDswOWZyuUSRF+xSy8v/H3kKM6Gmj5654bjo5 OxWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PycRToe0; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-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 n15-v6si23319017pgc.309.2018.09.04.08.19.13; Tue, 04 Sep 2018 08:19:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-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=PycRToe0; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-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 S1727388AbeIDToo (ORCPT + 13 others); Tue, 4 Sep 2018 15:44:44 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:37564 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727627AbeIDToo (ORCPT ); Tue, 4 Sep 2018 15:44:44 -0400 Received: by mail-wm0-f68.google.com with SMTP id n11-v6so4667237wmc.2 for ; Tue, 04 Sep 2018 08:19: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=JUgb9vugJT+6B6QjtpmWBvMX+Wq5UlUI1pzbqQTz2N0=; b=PycRToe0oOvXjpgTCn7Ysl2ixJnrbemOp0tYouNO48u176Tn+sTEERxCOPgOcpvrK3 Khr0qj2AP9ZIJjI9K6PezWog8YLCSg7PG+d5i83AEwl3I13lGmvrWKTWYqe9TEdjBPtP y2FSme9twOy5JvrsclQGPg79UrblxbMYtAKOM= 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=JUgb9vugJT+6B6QjtpmWBvMX+Wq5UlUI1pzbqQTz2N0=; b=jtv2DrLsJQvZigraGep6lZtIEwYe6n7HOB13xA1b1z2DaALFXxp8SSBfLVXdfDIECf GA2JcgvxP7CwmNSdOiAYq07dfrapY7THHZXmGeWj9D/VKCE6x5hzQSfW01oxIJco+8Nk ia3EqN7cwQoJnbIkood/1PxQX8F1NYW1+XrSu3vujwcR6N9bK8S149dryakoF5F4karS q+mohm5ByF/GhD8MjdLnRXzbBLjojMO7SaWmz8S9s9ETncWabd71T0LfqwzCNwgXGGW9 zmol+CRDbdKV2EkQ91PmLBOP1/diW033nq0Ac07qwCpfOUNjeva1MV7zvXE8tMGz/QYw Ps9Q== X-Gm-Message-State: APzg51DbyZWa+sQqeMUnOD6cpp4R9W9zEGOaBntfxq6muq8ZUh2xiTzN F5o6BzatnpSNZG/0edM6fYA8Fw== X-Received: by 2002:a1c:a386:: with SMTP id m128-v6mr2626711wme.139.1536074349982; Tue, 04 Sep 2018 08:19:09 -0700 (PDT) Received: from lpoulain-ThinkPad-T470p.home (AToulouse-654-1-394-222.w90-55.abo.wanadoo.fr. [90.55.193.222]) by smtp.gmail.com with ESMTPSA id l24-v6sm40255033wrb.65.2018.09.04.08.19.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 04 Sep 2018 08:19:09 -0700 (PDT) From: Loic Poulain To: Peter.Chen@nxp.com Cc: linux-usb@vger.kernel.org, linux-arm-msm@vger.kernel.org, david.brown@linaro.org, robh+dt@kernel.org, bjorn.andersson@linaro.org, andy.gross@linaro.org, andy.shevchenko@gmail.com, Loic Poulain Subject: [PATCH v3 5/6] phy: qcom-usb-hs: Fix unbalanced notifier registration Date: Tue, 4 Sep 2018 17:18:59 +0200 Message-Id: <1536074340-14840-5-git-send-email-loic.poulain@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1536074340-14840-1-git-send-email-loic.poulain@linaro.org> References: <1536074340-14840-1-git-send-email-loic.poulain@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Phy power on/off cycle can happen several times during device life. We then need to balance the extcon notifier registration accordingly. Fixes: f0b5c2c96370 ("phy: qcom-usb-hs: Replace the extcon API") Signed-off-by: Loic Poulain --- v2: don't use devres version (power-on always followed by power-off) v3: no change drivers/phy/qualcomm/phy-qcom-usb-hs.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) -- 2.7.4 diff --git a/drivers/phy/qualcomm/phy-qcom-usb-hs.c b/drivers/phy/qualcomm/phy-qcom-usb-hs.c index abbbe75..7153dde 100644 --- a/drivers/phy/qualcomm/phy-qcom-usb-hs.c +++ b/drivers/phy/qualcomm/phy-qcom-usb-hs.c @@ -160,8 +160,8 @@ static int qcom_usb_hs_phy_power_on(struct phy *phy) /* setup initial state */ qcom_usb_hs_phy_vbus_notifier(&uphy->vbus_notify, state, uphy->vbus_edev); - ret = devm_extcon_register_notifier(&ulpi->dev, uphy->vbus_edev, - EXTCON_USB, &uphy->vbus_notify); + ret = extcon_register_notifier(uphy->vbus_edev, EXTCON_USB, + &uphy->vbus_notify); if (ret) goto err_ulpi; } @@ -182,6 +182,11 @@ static int qcom_usb_hs_phy_power_off(struct phy *phy) { struct qcom_usb_hs_phy *uphy = phy_get_drvdata(phy); + if (uphy->vbus_edev) { + extcon_unregister_notifier(uphy->vbus_edev, EXTCON_USB, + &uphy->vbus_notify); + } + regulator_disable(uphy->v3p3); regulator_disable(uphy->v1p8); clk_disable_unprepare(uphy->sleep_clk); From patchwork Tue Sep 4 15:19:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Poulain X-Patchwork-Id: 145936 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp3791667ljw; Tue, 4 Sep 2018 08:19:15 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbpWHTtHfm6IMaGc03bbqJoSnIxd7H3qmxkIDzS29iMzafAZAFgtDSIPkBciQtMEE2pQHJ6 X-Received: by 2002:a17:902:585:: with SMTP id f5-v6mr18808699plf.7.1536074355724; Tue, 04 Sep 2018 08:19:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536074355; cv=none; d=google.com; s=arc-20160816; b=pwG6MrszosLMWEiIUWtTfVPtugbHrMmjr4FBI4I7pj2PClBucEi5u+USnSJAdIizwM UaVKcSw1I06gkJ90Vaf3ssrkpbyD6TWF9mujQQtW+TtEs9DIVNq/3gmxRI12uBBAU9/f qaj2yFGIkzdUxlZLB/M6Z+qKH61ujeJ1q7CHJALbvI1gEkzWbbX7P6w/gttIty6UUMcM JuavoqAm62SKOPAnBnxxKV71RqdUjBSacrYVS1TKEIbZpgz/UovvurMYm5Bm7MNsf78u 4r6JgnMHnZGOvb/8yd946FgJxNIkXKUvHIszAuJ7FiysUiTcHqOqsnQ1MefuzrIlBnPv zC6A== 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:arc-authentication-results; bh=+R5QIWV4I37qJVQpK/g9sdwS0+lLRSmTw9qWsWuijTI=; b=eK10vupMxe/5PgEQz8x7rj9uAWWK1HNPe61NJDyLhfZsfferPVUgB7raLHM//fxbR9 2POAhzRwMqoFeQKbQ1cT0UCgaM1qp4Xfiwg5ZDxklALuOA7zN6+/xZXFSEl9uu4CLT06 RZO6iNVFDLie9IJ1MvzxgsRiU0aEQ0yWoDLOhRvSuzpr3JKqwHTqX+djxlo19yyGNXyg CYOZyxSCZEJUkLpe1PdUuRdidHEsPNKDQ8FA1h7nvgpkR5Ok1M+niUtBCmDx2lCad2S1 j9tQuBxxGpe94rJHPIp+vJo5VVPbyiPaiFzJpp747dJ44HUtvkJCM7FKaniFg4EmKq2B Pu0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Aj1dR6y4; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-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 n15-v6si23319017pgc.309.2018.09.04.08.19.15; Tue, 04 Sep 2018 08:19:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-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=Aj1dR6y4; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-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 S1727650AbeIDToq (ORCPT + 13 others); Tue, 4 Sep 2018 15:44:46 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:36588 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727627AbeIDToq (ORCPT ); Tue, 4 Sep 2018 15:44:46 -0400 Received: by mail-wm0-f68.google.com with SMTP id j192-v6so4713616wmj.1 for ; Tue, 04 Sep 2018 08:19: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=+R5QIWV4I37qJVQpK/g9sdwS0+lLRSmTw9qWsWuijTI=; b=Aj1dR6y494zykVkkv+wTaasZgL8QCi+5eAnjdfP3nFd6Z5EoYrSt1CApGQm0hXDf/l Kon8Clo17O3sv5vDN0ycD5Z8RQaKj84Vz8J+irhq3ThsaFYnocZ05NSgWIwz40FVgRfk GJ71kTzxHZTSdCHgr1q3zonfjCmS/zgA1pKf4= 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=+R5QIWV4I37qJVQpK/g9sdwS0+lLRSmTw9qWsWuijTI=; b=m3q0vOuBMk085u3IB8EdqpqgvX15u7wWiCqvakXa0jKthmIuSlQfE6Z8hsqUTOq2l1 hU1H4eHgtPEmqSzdvBfWUIX9FdiLdi2EQmm3WzzzBR6wW4TFjB2JBgHAwS7EzI4ZQBDA dC5w1mapGU/HkOsw2NcfwhhkfHpwleOuN0D2+gl8XklSbrvUG22peSbdkYpqIORHoUI7 kR6SEOFy0p/s0Rg1P5C9bZTq4O/S7EowFkCQkkGD5q/+Dj8iuvB5I8aZOLUm6WRTEkIQ xDuDYZKWQIdnf5FwpvlMlVzCzbdPB2U22rHvRMqCZCWJWgGydqZUpaRLcWwCBVb0gHzD JrGQ== X-Gm-Message-State: APzg51BKxCjP0AFB+2tPnpIv8bTfPaRyHREUfKM3bIYk852bNv/2qZgl Mwa5Q8pQ5C8tsb0HCt0ykjQDUg== X-Received: by 2002:a1c:1252:: with SMTP id 79-v6mr8386529wms.70.1536074351937; Tue, 04 Sep 2018 08:19:11 -0700 (PDT) Received: from lpoulain-ThinkPad-T470p.home (AToulouse-654-1-394-222.w90-55.abo.wanadoo.fr. [90.55.193.222]) by smtp.gmail.com with ESMTPSA id l24-v6sm40255033wrb.65.2018.09.04.08.19.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 04 Sep 2018 08:19:11 -0700 (PDT) From: Loic Poulain To: Peter.Chen@nxp.com Cc: linux-usb@vger.kernel.org, linux-arm-msm@vger.kernel.org, david.brown@linaro.org, robh+dt@kernel.org, bjorn.andersson@linaro.org, andy.gross@linaro.org, andy.shevchenko@gmail.com, Loic Poulain Subject: [PATCH v3 6/6] arm: dts: qcom: db410c: Enable USB OTG support Date: Tue, 4 Sep 2018 17:19:00 +0200 Message-Id: <1536074340-14840-6-git-send-email-loic.poulain@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1536074340-14840-1-git-send-email-loic.poulain@linaro.org> References: <1536074340-14840-1-git-send-email-loic.poulain@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The Dragonboard-410c is able to act either as USB Host or Device. The role can be determined at runtime via the USB_HS_ID pin which is derived from the micro-usb port VBUS pin. In Host role, SoC USB D+/D- are routed to the onboard USB 2.0 HUB. In Device role, SoC USB D+/D- are routed to the USB 2.0 micro B port. Routing is selected via USB_SW_SEL_PM gpio. In device role USB HUB can be held in reset. chipidea driver expects two extcon device pointers, one for the EXTCON_USB event and one for the EXTCON_USB_HOST event. Since the extcon-usb-gpio device is capable of generating both these events, point two times to this extcon device. Signed-off-by: Loic Poulain --- v2: no change v3: Point two times to the same extcon-usb-device arch/arm64/boot/dts/qcom/apq8016-sbc-pmic-pins.dtsi | 20 ++++++++++++++++++++ arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi | 11 ++++++----- 2 files changed, 26 insertions(+), 5 deletions(-) -- 2.7.4 diff --git a/arch/arm64/boot/dts/qcom/apq8016-sbc-pmic-pins.dtsi b/arch/arm64/boot/dts/qcom/apq8016-sbc-pmic-pins.dtsi index ec2f0de..99787cc 100644 --- a/arch/arm64/boot/dts/qcom/apq8016-sbc-pmic-pins.dtsi +++ b/arch/arm64/boot/dts/qcom/apq8016-sbc-pmic-pins.dtsi @@ -8,6 +8,16 @@ pinconf { pins = "gpio3"; function = PMIC_GPIO_FUNC_NORMAL; + input-disable; + output-high; + }; + }; + + usb_hub_reset_pm_device: usb_hub_reset_pm_device { + pinconf { + pins = "gpio3"; + function = PMIC_GPIO_FUNC_NORMAL; + input-disable; output-low; }; }; @@ -22,6 +32,16 @@ }; }; + usb_sw_sel_pm_device: usb_sw_sel_pm_device { + pinconf { + pins = "gpio4"; + function = PMIC_GPIO_FUNC_NORMAL; + power-source = ; + input-disable; + output-low; + }; + }; + pm8916_gpios_leds: pm8916_gpios_leds { pinconf { pins = "gpio1", "gpio2"; diff --git a/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi b/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi index 78ce397..1f7dc1c 100644 --- a/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi +++ b/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi @@ -366,14 +366,15 @@ }; usb@78d9000 { - extcon = <&usb_id>; + extcon = <&usb_id>, <&usb_id>; status = "okay"; adp-disable; hnp-disable; srp-disable; - dr_mode = "host"; - pinctrl-names = "default"; - pinctrl-0 = <&usb_sw_sel_pm>; + dr_mode = "otg"; + pinctrl-names = "default", "device"; + pinctrl-0 = <&usb_sw_sel_pm &usb_hub_reset_pm>; + pinctrl-1 = <&usb_sw_sel_pm_device &usb_hub_reset_pm_device>; ulpi { phy { v1p8-supply = <&pm8916_l7>; @@ -512,7 +513,7 @@ usb_id: usb-id { compatible = "linux,extcon-usb-gpio"; - vbus-gpio = <&msmgpio 121 GPIO_ACTIVE_HIGH>; + id-gpio = <&msmgpio 121 GPIO_ACTIVE_HIGH>; pinctrl-names = "default"; pinctrl-0 = <&usb_id_default>; };