From patchwork Mon Aug 27 09:33:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Poulain X-Patchwork-Id: 10576763 X-Patchwork-Delegate: agross@codeaurora.org Return-Path: 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 B0A3213B8 for ; Mon, 27 Aug 2018 09:33:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A46BC2847D for ; Mon, 27 Aug 2018 09:33:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 97E13297A9; Mon, 27 Aug 2018 09:33:41 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 355692977F for ; Mon, 27 Aug 2018 09:33:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726802AbeH0NTd (ORCPT ); Mon, 27 Aug 2018 09:19:33 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:45332 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726887AbeH0NTd (ORCPT ); Mon, 27 Aug 2018 09:19:33 -0400 Received: by mail-wr1-f67.google.com with SMTP id 20-v6so12943913wrb.12 for ; Mon, 27 Aug 2018 02:33:38 -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=7hwg7iwuKZ5uZKb4tYvRSPSR6S8BEdgvJekXN1LZzwU=; b=JUmNnzQYtWiz+OXI7+9YhO+w5W+FvkLgS3LtVxAhDeU2smXne7xvSoABHWKmehZNY9 WL7elFaE2jGUsV3fB+q+tRdvqNJkty3BJHI3h5APRbTGm1bneVoWdo5/KAN1yuLaJuUR WwtV/wsl4qoJL+WBmHzjO6yd1l9k6S2o3mx8Y= 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=7hwg7iwuKZ5uZKb4tYvRSPSR6S8BEdgvJekXN1LZzwU=; b=sjUi6EwmB83/T+4bMbB5rSuu83cNt6f2uY+MWdJTdxKuSIOw24vDXbkePYvLzeyBmY OPIH4XfX3tAFjkijEibndt2LeyZOlarBc/ABZscmZ+TSmWVQQ3l8WPojMX0ZQcGjq4bm fjJO3uZB9O504IKLIxC5JYQffthmRjceA2y8LmDBQLDB/VO//Ah/hERjiUoHxF4xzkFs Ws1DqnnrtpswTOtTMDT0DMwVJ7NZR4+IF4MsEYdMvfPbOCtWUi3JVD3JUQiMpA4ytdyw FHkBqPQN/SjAxxgGOIFqwgZzDajYHYrXwVQdv/QbbO4bCwOcT4hfQWGnpxJcbOrzhcKO spFw== X-Gm-Message-State: APzg51B//8GhpXFwCPR+gqpcKRAJlZhLZ+8k20fL2Ezd7sT69xyughCT DTrqGDiVCKjSzZfhrU2mqkAMtg== X-Google-Smtp-Source: ANB0VdYLeM6W6C6SRYlUeBjdv8vs5H/a68LCrNKuBq1bz0roQJbCbr+crAW9TT6HgDk/Rznu5G7DRA== X-Received: by 2002:adf:9d1c:: with SMTP id k28-v6mr8539539wre.104.1535362417759; Mon, 27 Aug 2018 02:33:37 -0700 (PDT) Received: from lpoulain-ThinkPad-T470p.home (AToulouse-655-1-762-165.w109-220.abo.wanadoo.fr. [109.220.142.165]) by smtp.gmail.com with ESMTPSA id y203-v6sm8022828wmd.1.2018.08.27.02.33.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 27 Aug 2018 02:33:37 -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 v2 1/7] usb: chipidea: Add dynamic pinctrl selection Date: Mon, 27 Aug 2018 11:33:29 +0200 Message-Id: <1535362415-16559-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 X-Virus-Scanned: ClamAV using ClamSMTP 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 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(+) diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 43ea5fb..cdac778 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -56,6 +56,7 @@ #include #include #include +#include #include #include #include @@ -726,6 +727,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 18cb8e4..3729672 100644 --- a/drivers/usb/chipidea/host.c +++ b/drivers/usb/chipidea/host.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "../host/ehci.h" @@ -164,6 +165,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; @@ -208,6 +213,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 fe8a905..3f09a0d 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -1964,6 +1965,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, @@ -1982,6 +1987,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 Mon Aug 27 09:33:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Poulain X-Patchwork-Id: 10576767 X-Patchwork-Delegate: agross@codeaurora.org Return-Path: 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 67E231803 for ; Mon, 27 Aug 2018 09:33:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 599C62847D for ; Mon, 27 Aug 2018 09:33:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4D525297A9; Mon, 27 Aug 2018 09:33:43 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 002172847D for ; Mon, 27 Aug 2018 09:33:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726887AbeH0NTe (ORCPT ); Mon, 27 Aug 2018 09:19:34 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:43223 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726947AbeH0NTe (ORCPT ); Mon, 27 Aug 2018 09:19:34 -0400 Received: by mail-wr1-f65.google.com with SMTP id k5-v6so12961111wre.10 for ; Mon, 27 Aug 2018 02:33:40 -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=5K0e0i3GZ/tcRJJZ2Jk9vcHhwL11OJhvOLLUvTWJ+w0=; b=edaPMFRHdvZwnO2D8O6iyp+rJa5sikogJqM77L6yfZ1n4wvsVM09aueY3xqgL9YeD9 fXQV8SPEGb/HvRnX+fxfIZvt05KjuMEcoehfnKpZZ+b/MOpWvVCF6Iu2NlZXBMh0LTL2 4Li5gt2OpAN/IGZXtVVnTBfk4eOD+3S3uLDeY= 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=5K0e0i3GZ/tcRJJZ2Jk9vcHhwL11OJhvOLLUvTWJ+w0=; b=JVI8Mq7FToej8TrkNSs2W5lIY7wax5UoDSnJrn43ncaLn928GFafaCUObkfUQvtRyn dUBsHltW5YuKFp0OGCEBJFi5JDDlI4Ryk2aonKUIAPUCBnXIDm/YhjvUCOXkU8jj/xl+ TfND9F4pxQwtAM8p7QiLWlUSYKL2nVZJG2m9ZDRrwOFXye8FqLLZGVf/qWBBZI99gQmg aQgdBmZj7ZARfYdSpiPMbx9GsLtHsVXW8lMW8Egi4KqFDe3Hg9OV0QrbIlQ7mjb9DwYc P4UnJ3+zLwHD2oTwGs2odG+RjncLnv0tNBc/zL3JCaq5IB4tiGOcej7Cet3uJcPomfna fRzQ== X-Gm-Message-State: APzg51BEKVssoOZLAS78le2VoN4BXhC05UpZVlG2+lnYTisX9/Kem0Oa qsOdlvr7ZvBR8h+iRvN/F2Ja9A== X-Google-Smtp-Source: ANB0Vdalr8ZZTzS1tPqs24subm4EZIiZMlxJ0I0hvfAXmyxRStNe2bFABu2oE3PTBpLpgZqAgKeJTA== X-Received: by 2002:adf:9142:: with SMTP id j60-v6mr8112818wrj.180.1535362419962; Mon, 27 Aug 2018 02:33:39 -0700 (PDT) Received: from lpoulain-ThinkPad-T470p.home (AToulouse-655-1-762-165.w109-220.abo.wanadoo.fr. [109.220.142.165]) by smtp.gmail.com with ESMTPSA id y203-v6sm8022828wmd.1.2018.08.27.02.33.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 27 Aug 2018 02:33:39 -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 v2 2/7] doc: usb: ci-hdrc-usb2: Add pinctrl properties definition Date: Mon, 27 Aug 2018 11:33:30 +0200 Message-Id: <1535362415-16559-2-git-send-email-loic.poulain@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1535362415-16559-1-git-send-email-loic.poulain@linaro.org> References: <1535362415-16559-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 X-Virus-Scanned: ClamAV using ClamSMTP 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) Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt index 0e03344..ea7033c 100644 --- a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt +++ b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt @@ -76,6 +76,8 @@ Optional properties: needs to make sure it does not send more than 90% maximum_periodic_data_per_frame. The use case is multiple transactions, but less frame rate. +- 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 Mon Aug 27 09:33:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Poulain X-Patchwork-Id: 10576771 X-Patchwork-Delegate: agross@codeaurora.org Return-Path: 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 0126113B8 for ; Mon, 27 Aug 2018 09:33:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E77A92847D for ; Mon, 27 Aug 2018 09:33:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DB8CC297A9; Mon, 27 Aug 2018 09:33:45 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9AB9A2847D for ; Mon, 27 Aug 2018 09:33:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727360AbeH0NTg (ORCPT ); Mon, 27 Aug 2018 09:19:36 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:55057 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726947AbeH0NTf (ORCPT ); Mon, 27 Aug 2018 09:19:35 -0400 Received: by mail-wm0-f66.google.com with SMTP id c14-v6so7418408wmb.4 for ; Mon, 27 Aug 2018 02:33:42 -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=eKBz1fhih9+3Kb3HMlACxUt1yzcIHKdIj++GVtqzNHI=; b=FpcjuVkWQCKnlcVVTJPQS/UQsJBpsOsTaKqKsQ+VnzG2lQzPDLV8HxZfhIrdLGU2fL e8kRY/mazjWRd9STVwc/PkqfBCn7ukmog7jb3k6J7fMbg3U+hcJMft8AhmfheZDwl5Gw isXvVnSN2JAMFGLwZwy/UWqUeEKbJSEFOXpNM= 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=eKBz1fhih9+3Kb3HMlACxUt1yzcIHKdIj++GVtqzNHI=; b=mJAdd9gZPil+EbiaE+I7xKMlhHpR47sFr8AaUk/Yzzg8Jtsq3XfPpx+/x8it/mWJWi q8IePZ4CHwZxOUQZUQHmgCAD/sN6kkRx2L7g5Wc8OOd7r+ENftX+H/eD4C/4gP8h+qY8 tk02+FsQ1c2eZHxiC9z79kuel1pAYDv3lUGh8a6yK1fwQEdYJawekA9e8OG26x4BDmx2 WdMBhgowvJNkRjtqAjrlrSoa0dF9k9jDAQw/eN+muMWEIbCIadro3o40BEw6A0JSMrlk Qz8yig5CIUjWSq7oVB5mLOyG0KrYBZvvJqo/guaz/X1IaiLTrS3KcyQ7zc/nUQ7YiS60 VZQA== X-Gm-Message-State: APzg51BBkBJ6yriUTZyZ4qPaFjVm8zyiLT0eEd2cS9nRARU3B3W/mccN QFxo6OUvjFPy0EJtfXZl0aFiPw== X-Google-Smtp-Source: ANB0VdaW5qAyrZbPemYsKUKtCPpZ+IHK1589hr6tcddfm3WWZINkfX/nsdyS5l1WWcwKRKV1LRjlUA== X-Received: by 2002:a1c:b54b:: with SMTP id e72-v6mr2024624wmf.117.1535362421510; Mon, 27 Aug 2018 02:33:41 -0700 (PDT) Received: from lpoulain-ThinkPad-T470p.home (AToulouse-655-1-762-165.w109-220.abo.wanadoo.fr. [109.220.142.165]) by smtp.gmail.com with ESMTPSA id y203-v6sm8022828wmd.1.2018.08.27.02.33.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 27 Aug 2018 02:33:40 -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 v2 3/7] usb: chipidea: Support generic usb extcon Date: Mon, 27 Aug 2018 11:33:31 +0200 Message-Id: <1535362415-16559-3-git-send-email-loic.poulain@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1535362415-16559-1-git-send-email-loic.poulain@linaro.org> References: <1535362415-16559-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 X-Virus-Scanned: ClamAV using ClamSMTP Add compatibility for extcon-usb-gpio which can handle more than one cable per instance, allowing coherency of USB cable states (USB/USB-HOST). These states can be generated from ID or/and VBUS pins. In case only one extcon device is associated to the USB device, and this device supports USB and USB-HOST cable states, we now use it for both VBUS (USB) and ID (USB-HOST) notifier. Signed-off-by: Loic Poulain --- v2: no change drivers/usb/chipidea/core.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index cdac778..afe85e2 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -702,6 +702,17 @@ static int ci_get_platdata(struct device *dev, ext_id = extcon_get_edev_by_phandle(dev, 1); if (IS_ERR(ext_id) && PTR_ERR(ext_id) != -ENODEV) return PTR_ERR(ext_id); + + /* + * Some extcon devices like extcon-usb-gpio have only one + * instance for both USB and USB-HOST cable states. + */ + if (!IS_ERR(ext_vbus) && IS_ERR(ext_id)) { + if (extcon_get_state(ext_vbus, EXTCON_USB) >= 0 && + extcon_get_state(ext_vbus, EXTCON_USB_HOST) >= 0) { + ext_id = ext_vbus; + } + } } cable = &platdata->vbus_extcon; From patchwork Mon Aug 27 09:33:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Poulain X-Patchwork-Id: 10576789 X-Patchwork-Delegate: agross@codeaurora.org Return-Path: 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 9940313B8 for ; Mon, 27 Aug 2018 09:33:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8CE022847D for ; Mon, 27 Aug 2018 09:33:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 80A06297A9; Mon, 27 Aug 2018 09:33:56 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 320112847D for ; Mon, 27 Aug 2018 09:33:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727273AbeH0NTr (ORCPT ); Mon, 27 Aug 2018 09:19:47 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:44584 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727098AbeH0NTh (ORCPT ); Mon, 27 Aug 2018 09:19:37 -0400 Received: by mail-wr1-f67.google.com with SMTP id v16-v6so12953690wro.11 for ; Mon, 27 Aug 2018 02:33:43 -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=w0SISw5b9iFA4GoR2xVxw/w2+Ij5SPyf9tqQwIA9cgc=; b=Nngwsn0WRiyiamsxTbhvVfQ5snPb8IwluoRd3vFNjb8/bUSXQ81DnSznEQFo5Afeug NGlpq7oacOrz4R695noRyoAYgDlvl0kQVfm4KBDVA3YKTzL9A63C0Sb+Yaak0zQxl6f4 RgXs+ItSn6+L47Z4XDk23wdhKtz1M+A/49Y2Y= 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=w0SISw5b9iFA4GoR2xVxw/w2+Ij5SPyf9tqQwIA9cgc=; b=nQ7Mh5EZnEb5IxqJYVDzWYDWldujIQjP4gbnf4wUAThgyM6uKR5enbsmn6kVMDDjAG kAHSFkeBelDIMQfIYsqTVr+nCl/GaPAxTbmVeSu5TXPnwIjSeGCx+NC5kfuP6eRy13Sy Rht1hvFqFRIBcKO8LMLodEM4nka5IkMxpp5L0EvvVC3WuTzpJeEG7so7k6iJ11gHGKKF mEKLd4AA/LPAwD44dDlVX+nLLJ4WCTPdc/Kwfsre71HTwY8z7FUtka10xQkgBybC0toc yCGcYF1C6G2dpdk64gzV3z90ruarykZE3kFEqFrnqR9djthcGFvSEvxp2oOlW3Nm6auW QSUA== X-Gm-Message-State: APzg51AifrUI47qtvHHw0UGu8znznhNFs+ZPQdx1a1nn+yhMEMEQnByv xOQSAXpJn8CV0m32042okGqkYg== X-Google-Smtp-Source: ANB0VdapV8vz0YBbwvoaycNfLIxkWoER6FHQnOzOt8g+na1h3GgNTV/5CMulm1W1plZ6nil6QbjVYQ== X-Received: by 2002:adf:c38e:: with SMTP id p14-v6mr8516615wrf.68.1535362422994; Mon, 27 Aug 2018 02:33:42 -0700 (PDT) Received: from lpoulain-ThinkPad-T470p.home (AToulouse-655-1-762-165.w109-220.abo.wanadoo.fr. [109.220.142.165]) by smtp.gmail.com with ESMTPSA id y203-v6sm8022828wmd.1.2018.08.27.02.33.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 27 Aug 2018 02:33:42 -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 v2 4/7] usb: chipidea: Prevent unbalanced IRQ disable Date: Mon, 27 Aug 2018 11:33:32 +0200 Message-Id: <1535362415-16559-4-git-send-email-loic.poulain@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1535362415-16559-1-git-send-email-loic.poulain@linaro.org> References: <1535362415-16559-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 X-Virus-Scanned: ClamAV using ClamSMTP The ChipIdea IRQ is disabled before scheduling the otg work and re-enabled on otg work completion. However if the job is already scheduled we have to undo the effect of disable_irq int order to balance the IRQ disable-depth value. Fixes: be6b0c1bd0be ("usb: chipidea: using one inline function to cover queue work operations") Signed-off-by: Loic Poulain --- v2: no change drivers/usb/chipidea/otg.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/chipidea/otg.h b/drivers/usb/chipidea/otg.h index 9ecb598..a5557c7 100644 --- a/drivers/usb/chipidea/otg.h +++ b/drivers/usb/chipidea/otg.h @@ -20,7 +20,8 @@ void ci_handle_vbus_change(struct ci_hdrc *ci); static inline void ci_otg_queue_work(struct ci_hdrc *ci) { disable_irq_nosync(ci->irq); - queue_work(ci->wq, &ci->work); + if (queue_work(ci->wq, &ci->work) == false) + enable_irq(ci->irq); } #endif /* __DRIVERS_USB_CHIPIDEA_OTG_H */ From patchwork Mon Aug 27 09:33:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Poulain X-Patchwork-Id: 10576777 X-Patchwork-Delegate: agross@codeaurora.org Return-Path: 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 5770913B8 for ; Mon, 27 Aug 2018 09:33:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 459212847D for ; Mon, 27 Aug 2018 09:33:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3973A297B8; Mon, 27 Aug 2018 09:33:49 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DCF4E2977F for ; Mon, 27 Aug 2018 09:33:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727498AbeH0NTj (ORCPT ); Mon, 27 Aug 2018 09:19:39 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:33245 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726953AbeH0NTj (ORCPT ); Mon, 27 Aug 2018 09:19:39 -0400 Received: by mail-wr1-f68.google.com with SMTP id v90-v6so12980834wrc.0 for ; Mon, 27 Aug 2018 02:33:45 -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=KMRezuJX1BEb4nHpMgT72/6xOEnl//0HUPcftOfNpT4=; b=VO4gYZbF0n56KnRRrOfwAZ8emcMueAUtiSaEVbCr9UGPCGuMWD57jn1jqfDoI+tHCj E+jYlPGgkOWNekyvunmrK3ggQE8nBLTPeqgE3Vs3dV35bpEG1MK/rEJyuBdNvWlW0n4B SxLjrHq30tBvCxkx+iC8fUhHY7rQY2UauxFnM= 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=KMRezuJX1BEb4nHpMgT72/6xOEnl//0HUPcftOfNpT4=; b=pFQ+3UxrFxBTCPiIh7tzVFsVSyDAdz/HpQ++l6YdY/1bnO1nMSg/3XHdL96KkL28ce EfEmPigwi+AaOrs5r/fjAju3STH2eRlMwISzO+mdA9l+Yn/T0QACLYgX+VX298hjHUP2 rc3Hl0MYA/jhwIe2kx9VCf6p5pFcQp6Go0BBDx/EEEuAzRpFT/0NUoR52qhy5QMZwWW6 EGTEOLLi3H96hv/wA6MxuYi88rlMOHplB64AywDERyGkeN70fnX+ONVw5U7KYdHzzsgp QH/RWNoBAtt7jZ3dTs+BDHGdawocr8NFCwMNFFHqrSJ+4KWYOjTR4+QNBBHsr5N95Vci eczA== X-Gm-Message-State: APzg51AFb9okRBZX/kYrMOWpHP0nfNw8dZZfD+QD4/rIi050EqZBFFZh q9ct4iZfOHHQ9dZYtokPpOE5XQ== X-Google-Smtp-Source: ANB0VdYfpnGniBjmdQ2QohOldJ/TbQxIgg5L5XScJui0m5aFZk4t487I1TnLCfUVwvBgsEssag4UYA== X-Received: by 2002:adf:db11:: with SMTP id s17-v6mr8488372wri.221.1535362424564; Mon, 27 Aug 2018 02:33:44 -0700 (PDT) Received: from lpoulain-ThinkPad-T470p.home (AToulouse-655-1-762-165.w109-220.abo.wanadoo.fr. [109.220.142.165]) by smtp.gmail.com with ESMTPSA id y203-v6sm8022828wmd.1.2018.08.27.02.33.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 27 Aug 2018 02:33:43 -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 v2 5/7] usb: chipidea: Fix otg event handler Date: Mon, 27 Aug 2018 11:33:33 +0200 Message-Id: <1535362415-16559-5-git-send-email-loic.poulain@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1535362415-16559-1-git-send-email-loic.poulain@linaro.org> References: <1535362415-16559-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 X-Virus-Scanned: ClamAV using ClamSMTP 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: no change drivers/usb/chipidea/otg.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/usb/chipidea/otg.c b/drivers/usb/chipidea/otg.c index 10236fe..8bf4032 100644 --- a/drivers/usb/chipidea/otg.c +++ b/drivers/usb/chipidea/otg.c @@ -206,14 +206,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 Mon Aug 27 09:33:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Poulain X-Patchwork-Id: 10576783 X-Patchwork-Delegate: agross@codeaurora.org Return-Path: 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 01FD91803 for ; Mon, 27 Aug 2018 09:33:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E8F332847D for ; Mon, 27 Aug 2018 09:33:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DD698297A9; Mon, 27 Aug 2018 09:33:50 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9C5252847D for ; Mon, 27 Aug 2018 09:33:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727507AbeH0NTl (ORCPT ); Mon, 27 Aug 2018 09:19:41 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:51167 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726953AbeH0NTl (ORCPT ); Mon, 27 Aug 2018 09:19:41 -0400 Received: by mail-wm0-f66.google.com with SMTP id s12-v6so7431712wmc.0 for ; Mon, 27 Aug 2018 02:33:47 -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=kNnuvVHNDO72JJfSiBNDsx5kesLdzgcvxXm8Qay3N2o=; b=XeEUV6lf6MjQOt1Fb5KG8H5r9UoDYS/z86+YbL/omuzZwWSJ9SWhkxU3/HGj1A5Jfq inJoBXiIfKKhYO/ucxYwh7A7r7OIxVBg3msglBGh0Rgmcqf5CdXZFgv61bFZvUljZtVs FGEQcjiD7xo4VBPhoud3TTxFwfluVZVDz7v08= 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=kNnuvVHNDO72JJfSiBNDsx5kesLdzgcvxXm8Qay3N2o=; b=iIE51ExBtKlINhhcQ9JA928H4pFRNjam0biiemN0fPmShijbMeWQRZWKTaw6pWhzLt dEIUC4lRo2vM73Z76WYMFnGehgYHG2s1qM+4M8bX78iKqB81BR3TicxvnJDeKIxK7vKr HtQI0hVakLMHgeH5Qw+NCZ4xWl47Wc8nDiWM0BVxpQp6PBaH39Ku69OCgVbJ/R38fr24 nx2VHk/m1a4b9W2GR1jCwIia8qjk+t785bDpE8bKLj+XuS7LwCU8f0w+AFhVAd7sZh8Z 1RGUO2Ydrxk7qtsMkkbkcNjeGLRSYr2ypt/lIp/LNPvGqQfc1cBsreUQrz0i3HIDbrdw 3OQw== X-Gm-Message-State: APzg51B1v8N4PgzXhLwyKPDcZNB6ksN43NJ04dfF3296EsK2KJcc6HuB OBUy04qP31GNZ2hjO28M21YrhQ== X-Google-Smtp-Source: ANB0VdYYjgLAsdeQqgLHZ7r2TBWd/APLGiab4PpbrwGtRCzaNuL9p8inAIOE0VmjdorwuvQBV2usJA== X-Received: by 2002:a1c:d1c3:: with SMTP id i186-v6mr5183018wmg.5.1535362426017; Mon, 27 Aug 2018 02:33:46 -0700 (PDT) Received: from lpoulain-ThinkPad-T470p.home (AToulouse-655-1-762-165.w109-220.abo.wanadoo.fr. [109.220.142.165]) by smtp.gmail.com with ESMTPSA id y203-v6sm8022828wmd.1.2018.08.27.02.33.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 27 Aug 2018 02:33:45 -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 v2 6/7] phy: qcom-usb-hs: Fix unbalanced notifier registration Date: Mon, 27 Aug 2018 11:33:34 +0200 Message-Id: <1535362415-16559-6-git-send-email-loic.poulain@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1535362415-16559-1-git-send-email-loic.poulain@linaro.org> References: <1535362415-16559-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 X-Virus-Scanned: ClamAV using ClamSMTP 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) drivers/phy/qualcomm/phy-qcom-usb-hs.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-usb-hs.c b/drivers/phy/qualcomm/phy-qcom-usb-hs.c index 2d0c70b..18da6e2 100644 --- a/drivers/phy/qualcomm/phy-qcom-usb-hs.c +++ b/drivers/phy/qualcomm/phy-qcom-usb-hs.c @@ -159,8 +159,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; } @@ -181,6 +181,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 Mon Aug 27 09:33:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Poulain X-Patchwork-Id: 10576785 X-Patchwork-Delegate: agross@codeaurora.org Return-Path: 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 CB2F6174A for ; Mon, 27 Aug 2018 09:33:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BD2152847D for ; Mon, 27 Aug 2018 09:33:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B1980297B8; Mon, 27 Aug 2018 09:33:51 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 53FA02847D for ; Mon, 27 Aug 2018 09:33:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727506AbeH0NTm (ORCPT ); Mon, 27 Aug 2018 09:19:42 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:40921 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727495AbeH0NTm (ORCPT ); Mon, 27 Aug 2018 09:19:42 -0400 Received: by mail-wm0-f65.google.com with SMTP id 207-v6so7607305wme.5 for ; Mon, 27 Aug 2018 02:33:48 -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=JeJb7DryKO3XusEPSjpyjqH1xykE5CUKjBZfRbD7nh4=; b=ITEaBBjfpEl6SzPahRyug8ws0RXeGSkccLg000IE56Lipcn1Xbt3HIjXZ1gKi4f5GN 1OZ98giQPLdeBNqVk36IRdD48hbXWDhbjEPGh7fLSHsHrC5usKnUb0qbrjwALFAJvJMa tcIr8C1yaeTUu/h3yq91XyfMWxqsK9Ro8fLqQ= 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=JeJb7DryKO3XusEPSjpyjqH1xykE5CUKjBZfRbD7nh4=; b=mM4DRhqX2Bl1Tpws6oviHrj6ipZAb9bngp1zjC4U49jzeRg7O7ANQdkwBNfhKn7rdE BW7yuDqqVrIpwT8DmRSoN36TmDQXvEL/d/ftnfFmWb4LEr+iL2F7FCcUmYQvjgKS0KAK C21+bObYz4/5/HxyrrsG3q0s+UZzWIw42wmbAv+TMzYV1fyZzM1/vuxpmYLy5Yv60pyc QHU1ahgHO69RyvddlCDq8xntCMZwPHvDIwF0bKe8aXqaLXOxZaKHWc5JCK2K0YDo/Tq3 nWu/pRiGM0kcbdEZ5M1jEg2VtokJRaFN8s/MxbvtskpcjiSLT+8T1cdRmmzna6a0L8RJ FpUw== X-Gm-Message-State: APzg51DRODtxtIhuxT5Dt9kYLGMazdRJwlAtFjYneUNoa6dj/2UbmqoV UPCeh7u13Zu2SEs3cA4SjkuyjfpIyVA= X-Google-Smtp-Source: ANB0Vdbmg+CuETmDbEoJaZ+rTELLLi32cd0WfnqEZTQjVTC7Vi7fQSg5JGAZypOYh5MXbtPxHkTjfQ== X-Received: by 2002:a1c:dc41:: with SMTP id t62-v6mr5535879wmg.137.1535362427604; Mon, 27 Aug 2018 02:33:47 -0700 (PDT) Received: from lpoulain-ThinkPad-T470p.home (AToulouse-655-1-762-165.w109-220.abo.wanadoo.fr. [109.220.142.165]) by smtp.gmail.com with ESMTPSA id y203-v6sm8022828wmd.1.2018.08.27.02.33.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 27 Aug 2018 02:33:46 -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 v2 7/7] arm: dts: qcom: db410c: Enable USB OTG support Date: Mon, 27 Aug 2018 11:33:35 +0200 Message-Id: <1535362415-16559-7-git-send-email-loic.poulain@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1535362415-16559-1-git-send-email-loic.poulain@linaro.org> References: <1535362415-16559-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 X-Virus-Scanned: ClamAV using ClamSMTP 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. Signed-off-by: Loic Poulain --- v2: no change arch/arm64/boot/dts/qcom/apq8016-sbc-pmic-pins.dtsi | 20 ++++++++++++++++++++ arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi | 9 +++++---- 2 files changed, 25 insertions(+), 4 deletions(-) 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 16c1f1b..7229ad9 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 4c3dda5..c619dea 100644 --- a/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi +++ b/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi @@ -221,9 +221,10 @@ 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>; @@ -464,7 +465,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>; };