From patchwork Wed Aug 15 09:59:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Enric Balletbo i Serra X-Patchwork-Id: 10566459 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 86DB81515 for ; Wed, 15 Aug 2018 10:09:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7465629E0C for ; Wed, 15 Aug 2018 10:09:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 67A1029E0A; Wed, 15 Aug 2018 10:09:55 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5D04D29E0A for ; Wed, 15 Aug 2018 10:09:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=T+01dWXF5y9TLvNqHNJPkIFu4BNf1BOgJDzHDz1b3bo=; b=gA7B450M+NLGskySg/I5eOVOs8 GJ8fept7LrLdodIWai8B7KFe/THdHaG8rr+de+Q3JRu+Qv75kcKKH4HfObw8SPVjwwfPBaAI0y0Q6 vP7dIpJVx4/Cc7Lwgi6l/ULAns712Dmap80nvarwWFq+dW1VhFj+RAB9YLaAZ4qFafhPxlVucQ1T1 lrL3cq3goLD33OK8dzYSjeMZkYT63ZEbGWR6//TbVrW+XYc+urrdZhb3LA33fie7aOFfTTkhNAuUl Fq8scxElLl9zOy/A1+UhPqbpb5WGUeLHzdwkFT6idPyzNwBwQrcwXf4D+tBXdI/PqhK5jrlHZkY0K SEBjIu2Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fpskQ-0008Qp-QZ; Wed, 15 Aug 2018 10:09:50 +0000 Received: from bhuna.collabora.co.uk ([46.235.227.227]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fpsat-0003pr-D4; Wed, 15 Aug 2018 10:00:07 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: eballetbo) with ESMTPSA id B4BFA27D9A6 From: Enric Balletbo i Serra To: linux-kernel@vger.kernel.org Subject: [PATCH 1/4] phy: rockchip-inno-usb2: fix misspelling and kernel-doc documentation. Date: Wed, 15 Aug 2018 11:59:31 +0200 Message-Id: <20180815095934.11205-2-enric.balletbo@collabora.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180815095934.11205-1-enric.balletbo@collabora.com> References: <20180815095934.11205-1-enric.balletbo@collabora.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180815_025959_721938_685A4C0F X-CRM114-Status: GOOD ( 10.13 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: heiko@sntech.de, groeck@google.com, kieran.bingham@ideasonboard.com, Kishon Vijay Abraham I , linux-rockchip@lists.infradead.org, kernel@collabora.com, bleung@chromium.org, linux-arm-kernel@lists.infradead.org, amstan@chromium.org MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Fix the typo flase -> false and clean up the kernel-doc documentation in phy-rockchip-inno.usb2.c and fix the following warnings when documentation is built. :58: warning: missing initial short description :69: warning: cannot understand function prototype: 'enum usb_chg_state ' :97: warning: missing initial short description :136: warning: cannot understand function prototype: 'struct rockchip_usb2phy_port_cfg ' :157: warning: cannot understand function prototype: 'struct rockchip_usb2phy_cfg ' :163: warning: Function parameter or member 'port_cfgs' not described in 'rockchip_usb2phy_cfg' :187: warning: cannot understand function prototype: 'struct rockchip_usb2phy_port ' :204: warning: Function parameter or member 'port_cfg' not described in 'rockchip_usb2phy_port' :207: warning: missing initial short description :234: warning: Function parameter or member 'dev' not described in 'rockchip_usb2phy' :234: warning: Function parameter or member 'clk480m_hw' not described in 'rockchip_usb2phy' Signed-off-by: Enric Balletbo i Serra Reviewed-by: Heiko Stuebner --- drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 35 ++++++++++--------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c index 5049dac79bd0..e1ef3e34163c 100644 --- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c +++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c @@ -55,16 +55,16 @@ enum rockchip_usb2phy_host_state { }; /** - * Different states involved in USB charger detection. - * USB_CHG_STATE_UNDEFINED USB charger is not connected or detection + * enum usb_chg_state - Different states involved in USB charger detection. + * @USB_CHG_STATE_UNDEFINED: USB charger is not connected or detection * process is not yet started. - * USB_CHG_STATE_WAIT_FOR_DCD Waiting for Data pins contact. - * USB_CHG_STATE_DCD_DONE Data pin contact is detected. - * USB_CHG_STATE_PRIMARY_DONE Primary detection is completed (Detects + * @USB_CHG_STATE_WAIT_FOR_DCD: Waiting for Data pins contact. + * @USB_CHG_STATE_DCD_DONE: Data pin contact is detected. + * @USB_CHG_STATE_PRIMARY_DONE: Primary detection is completed (Detects * between SDP and DCP/CDP). - * USB_CHG_STATE_SECONDARY_DONE Secondary detection is completed (Detects - * between DCP and CDP). - * USB_CHG_STATE_DETECTED USB charger type is determined. + * @USB_CHG_STATE_SECONDARY_DONE: Secondary detection is completed (Detects + * between DCP and CDP). + * @USB_CHG_STATE_DETECTED: USB charger type is determined. */ enum usb_chg_state { USB_CHG_STATE_UNDEFINED = 0, @@ -94,7 +94,7 @@ struct usb2phy_reg { }; /** - * struct rockchip_chg_det_reg: usb charger detect registers + * struct rockchip_chg_det_reg - usb charger detect registers * @cp_det: charging port detected successfully. * @dcp_det: dedicated charging port detected successfully. * @dp_det: assert data pin connect successfully. @@ -120,7 +120,7 @@ struct rockchip_chg_det_reg { }; /** - * struct rockchip_usb2phy_port_cfg: usb-phy port configuration. + * struct rockchip_usb2phy_port_cfg - usb-phy port configuration. * @phy_sus: phy suspend register. * @bvalid_det_en: vbus valid rise detection enable register. * @bvalid_det_st: vbus valid rise detection status register. @@ -148,10 +148,11 @@ struct rockchip_usb2phy_port_cfg { }; /** - * struct rockchip_usb2phy_cfg: usb-phy configuration. + * struct rockchip_usb2phy_cfg - usb-phy configuration. * @reg: the address offset of grf for usb-phy config. * @num_ports: specify how many ports that the phy has. * @clkout_ctl: keep on/turn off output clk of phy. + * @port_cfgs: usb-phy port configurations. * @chg_det: charger detection registers. */ struct rockchip_usb2phy_cfg { @@ -163,12 +164,13 @@ struct rockchip_usb2phy_cfg { }; /** - * struct rockchip_usb2phy_port: usb-phy port data. + * struct rockchip_usb2phy_port - usb-phy port data. + * @phy: generic phy. * @port_id: flag for otg port or host port. * @suspended: phy suspended flag. * @utmi_avalid: utmi avalid status usage flag. * true - use avalid to get vbus status - * flase - use bvalid to get vbus status + * false - use bvalid to get vbus status * @vbus_attached: otg device vbus status. * @bvalid_irq: IRQ number assigned for vbus valid rise detection. * @ls_irq: IRQ number assigned for linestate detection. @@ -178,7 +180,7 @@ struct rockchip_usb2phy_cfg { * @chg_work: charge detect work. * @otg_sm_work: OTG state machine work. * @sm_work: HOST state machine work. - * @phy_cfg: port register configuration, assigned by driver data. + * @port_cfg: port register configuration, assigned by driver data. * @event_nb: hold event notification callback. * @state: define OTG enumeration states before device reset. * @mode: the dr_mode of the controller. @@ -203,12 +205,13 @@ struct rockchip_usb2phy_port { }; /** - * struct rockchip_usb2phy: usb2.0 phy driver data. + * struct rockchip_usb2phy - usb2.0 phy driver data. + * @dev: pointer to device. * @grf: General Register Files regmap. * @usbgrf: USB General Register Files regmap. * @clk: clock struct of phy input clk. * @clk480m: clock struct of phy output clk. - * @clk_hw: clock struct of phy output clk management. + * @clk480m_hw: clock struct of phy output clk management. * @chg_state: states involved in USB charger detection. * @chg_type: USB charger types. * @dcd_retries: The retry count used to track Data contact From patchwork Wed Aug 15 09:59:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Enric Balletbo i Serra X-Patchwork-Id: 10566457 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 789C517E1 for ; Wed, 15 Aug 2018 10:09:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 647B029E07 for ; Wed, 15 Aug 2018 10:09:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 58E1829E0C; Wed, 15 Aug 2018 10:09:46 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0DD4729E07 for ; Wed, 15 Aug 2018 10:09:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=8iVwlzgDGpGPI21Lai1kNvPdEmZed8v98rKeO7n6Qqw=; b=uwNgEkpsZNzwCbEn3ZfnSV5pE7 o+H+2lXdl+rSHSlFJKXhrGa6Kx0jCUiETdSxg5aGgKacye5rQaPNBl05VEcsZyoGBCdhnjN5wbfv4 LicpIeZy0Amus70g6HNZh4yfPTEdTdkzAOiGOTNEQzA5tGDq4t1ze+zyIMsDAJ55ABoKH0F/y9B8b yVPsOdEVUCZI55OtnO3J8+Iz51ZBEjLHOLI8KC2+qep48XW6FyvhsCwwOI2D6q8KlIdiaTI3JZkee tCDzY13P9CLind3y0y38frUJadrHhEYD2k7YaR3peSyC17kpNzwumPPIaqF8Nh9sTBkIkwMZOYpLf d1Fn7XQA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fpskH-0008EU-2R; Wed, 15 Aug 2018 10:09:41 +0000 Received: from bhuna.collabora.co.uk ([46.235.227.227]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fpsat-0003pt-EE; Wed, 15 Aug 2018 10:00:02 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: eballetbo) with ESMTPSA id 8420D27D9AC From: Enric Balletbo i Serra To: linux-kernel@vger.kernel.org Subject: [PATCH 2/4] dt-bindings: phy-rockchip-inno-usb2: add documentation for extcon and utmi-avalid properties. Date: Wed, 15 Aug 2018 11:59:32 +0200 Message-Id: <20180815095934.11205-3-enric.balletbo@collabora.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180815095934.11205-1-enric.balletbo@collabora.com> References: <20180815095934.11205-1-enric.balletbo@collabora.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180815_025959_614276_4B312A10 X-CRM114-Status: GOOD ( 10.77 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , devicetree@vger.kernel.org, heiko@sntech.de, groeck@google.com, Frank Wang , kieran.bingham@ideasonboard.com, Kishon Vijay Abraham I , linux-rockchip@lists.infradead.org, Rob Herring , kernel@collabora.com, bleung@chromium.org, linux-arm-kernel@lists.infradead.org, amstan@chromium.org MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Commit 98898f3bc83c8 ("phy: rockchip-inno-usb2: support otg-port for rk3399") introduces two new properties. The extcon property is used to detect the cable-state, and the rockchip,utmi-avalid is used to indicate which register should be used to detect the vbus state. Document these properties in the documentation binding. Fixes: 98898f3bc83c8 ("phy: rockchip-inno-usb2: support otg-port for rk3399") Signed-off-by: Enric Balletbo i Serra --- .../devicetree/bindings/phy/phy-rockchip-inno-usb2.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.txt b/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.txt index 074a7b3b0425..2d4808d3920b 100644 --- a/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.txt +++ b/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.txt @@ -23,6 +23,7 @@ Optional properties: register files". When set driver will request its phandle as one companion-grf for some special SoCs (e.g RV1108). + - extcon : phandle to the extcon device for the otg phy. Required nodes : a sub-node is required for each port the phy provides. The sub-node name is used to identify host or otg port, @@ -45,6 +46,8 @@ Required properties (port (child) node): Optional properties: - phy-supply : phandle to a regulator that provides power to VBUS. See ./phy-bindings.txt for details. + - rockchip,utmi-avalid : boolean, use the avalid register to get vbus status. + Otherwise, use the bvalid register. Example: From patchwork Wed Aug 15 09:59:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Enric Balletbo i Serra X-Patchwork-Id: 10566453 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 EEA5D1515 for ; Wed, 15 Aug 2018 10:09:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DE31D29E07 for ; Wed, 15 Aug 2018 10:09:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D1BD529E0C; Wed, 15 Aug 2018 10:09:44 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6C5E829E07 for ; Wed, 15 Aug 2018 10:09:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=w9MlBU9ijO/rDzMf/N4tDv++uI4LkS8zH78ajXOCjQA=; b=GTRj8BBPOe/nK3qWnKLBt9aPfJ h10B4S7t9V94XkwgU3mbQl1svsR4i3vnQhqtVNeWFIUPIcFOpuc6Nvr0++m99OoYFb5HMIoGhmx5Z DQhv4nI4UBt/3427QyxIYgCgWH+k2r7VqbsnLk0w23Ey63KGavhlxeMtuH4XXhDxzhtIc3QmoQgSk QB7wwIgisA4a6+JxoBvLCae5WFdYoSVxr9AjXPktiuTBb9rhYlUqlatvndTPWaI3eiM712xXa2jrM 0uhXl7XtVQxKSgCq81dpO1vMh1a6jh7B/YhXSzWuvuX76lZgLrhYJB4VXGG5R4GRqSgXO097vqedl FahCvLYg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fpskG-0008De-97; Wed, 15 Aug 2018 10:09:40 +0000 Received: from bhuna.collabora.co.uk ([46.235.227.227]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fpsat-0003pu-EB; Wed, 15 Aug 2018 10:00:02 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: eballetbo) with ESMTPSA id 8746327C585 From: Enric Balletbo i Serra To: linux-kernel@vger.kernel.org Subject: [PATCH 3/4] phy: rockchip-inno-usb2: allow to force the B-Device Session Valid bit. Date: Wed, 15 Aug 2018 11:59:33 +0200 Message-Id: <20180815095934.11205-4-enric.balletbo@collabora.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180815095934.11205-1-enric.balletbo@collabora.com> References: <20180815095934.11205-1-enric.balletbo@collabora.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180815_025959_746432_6D45F7ED X-CRM114-Status: GOOD ( 13.37 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: heiko@sntech.de, groeck@google.com, kieran.bingham@ideasonboard.com, Kishon Vijay Abraham I , linux-rockchip@lists.infradead.org, kernel@collabora.com, bleung@chromium.org, linux-arm-kernel@lists.infradead.org, amstan@chromium.org MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The OTG disconnection event is generated after the presence/abscense of an ID connection, but some platforms doesn't have the ID pin connected, so the event is not generated. In such case, for detecting the disconnection event, we can get the cable state from an extcon driver. We need, though, to force to set the B-Device Session Valid bit on the PHY to have the device respond to setup address. Otherwise, the following error is shown: usb 2-2: Device not responding to setup address. usb 2-2: device not accepting address 14, error -71 usb usb2-port2: unable to enumerate USB device The patch allows to tell the PHY to force the B-Device Session Valid bit when the OTG role is device and clear that bit if the OTG role is host. Signed-off-by: Enric Balletbo i Serra --- drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c index e1ef3e34163c..e7337c60ff9d 100644 --- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c +++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c @@ -125,6 +125,7 @@ struct rockchip_chg_det_reg { * @bvalid_det_en: vbus valid rise detection enable register. * @bvalid_det_st: vbus valid rise detection status register. * @bvalid_det_clr: vbus valid rise detection clear register. + * @bvalid_session: force B-device session valid register. * @ls_det_en: linestate detection enable register. * @ls_det_st: linestate detection state register. * @ls_det_clr: linestate detection clear register. @@ -138,6 +139,7 @@ struct rockchip_usb2phy_port_cfg { struct usb2phy_reg bvalid_det_en; struct usb2phy_reg bvalid_det_st; struct usb2phy_reg bvalid_det_clr; + struct usb2phy_reg bvalid_session; struct usb2phy_reg ls_det_en; struct usb2phy_reg ls_det_st; struct usb2phy_reg ls_det_clr; @@ -172,6 +174,7 @@ struct rockchip_usb2phy_cfg { * true - use avalid to get vbus status * false - use bvalid to get vbus status * @vbus_attached: otg device vbus status. + * @force_bvalid: force the control of the B-device session valid bit. * @bvalid_irq: IRQ number assigned for vbus valid rise detection. * @ls_irq: IRQ number assigned for linestate detection. * @otg_mux_irq: IRQ number which multiplex otg-id/otg-bvalid/linestate @@ -191,6 +194,7 @@ struct rockchip_usb2phy_port { bool suspended; bool utmi_avalid; bool vbus_attached; + bool force_bvalid; int bvalid_irq; int ls_irq; int otg_mux_irq; @@ -561,6 +565,13 @@ static void rockchip_usb2phy_otg_sm_work(struct work_struct *work) switch (rport->state) { case OTG_STATE_UNDEFINED: rport->state = OTG_STATE_B_IDLE; + if (rport->force_bvalid) { + property_enable(rphy->grf, + &rport->port_cfg->bvalid_session, + true); + dev_dbg(&rport->phy->dev, + "set the B-Device Session Valid\n"); + } if (!vbus_attach) rockchip_usb2phy_power_off(rport->phy); /* fall through */ @@ -568,6 +579,14 @@ static void rockchip_usb2phy_otg_sm_work(struct work_struct *work) if (extcon_get_state(rphy->edev, EXTCON_USB_HOST) > 0) { dev_dbg(&rport->phy->dev, "usb otg host connect\n"); rport->state = OTG_STATE_A_HOST; + /* When leaving device mode force end the session */ + if (rport->force_bvalid) { + property_enable(rphy->grf, + &rport->port_cfg->bvalid_session, + false); + dev_dbg(&rport->phy->dev, + "clear the B-Device Session Valid\n"); + } rockchip_usb2phy_power_on(rport->phy); return; } else if (vbus_attach) { @@ -642,6 +661,14 @@ static void rockchip_usb2phy_otg_sm_work(struct work_struct *work) if (extcon_get_state(rphy->edev, EXTCON_USB_HOST) == 0) { dev_dbg(&rport->phy->dev, "usb otg host disconnect\n"); rport->state = OTG_STATE_B_IDLE; + /* When leaving host mode force start the session */ + if (rport->force_bvalid) { + property_enable(rphy->grf, + &rport->port_cfg->bvalid_session, + true); + dev_dbg(&rport->phy->dev, + "set the B-Device Session Valid\n"); + } rockchip_usb2phy_power_off(rport->phy); } break; @@ -1024,6 +1051,12 @@ static int rockchip_usb2phy_otg_port_init(struct rockchip_usb2phy *rphy, INIT_DELAYED_WORK(&rport->chg_work, rockchip_chg_detect_work); INIT_DELAYED_WORK(&rport->otg_sm_work, rockchip_usb2phy_otg_sm_work); + rport->force_bvalid = false; + if (of_device_is_compatible(rphy->dev->of_node, + "rockchip,rk3399-usb2phy")) + rport->force_bvalid = of_property_read_bool(child_np, + "rockchip,force-bvalid"); + rport->utmi_avalid = of_property_read_bool(child_np, "rockchip,utmi-avalid"); @@ -1349,6 +1382,7 @@ static const struct rockchip_usb2phy_cfg rk3399_phy_cfgs[] = { .bvalid_det_en = { 0xe3c0, 3, 3, 0, 1 }, .bvalid_det_st = { 0xe3e0, 3, 3, 0, 1 }, .bvalid_det_clr = { 0xe3d0, 3, 3, 0, 1 }, + .bvalid_session = { 0x4498, 4, 4, 0, 1 }, .utmi_avalid = { 0xe2ac, 7, 7, 0, 1 }, .utmi_bvalid = { 0xe2ac, 12, 12, 0, 1 }, }, @@ -1384,6 +1418,7 @@ static const struct rockchip_usb2phy_cfg rk3399_phy_cfgs[] = { .bvalid_det_en = { 0xe3c0, 8, 8, 0, 1 }, .bvalid_det_st = { 0xe3e0, 8, 8, 0, 1 }, .bvalid_det_clr = { 0xe3d0, 8, 8, 0, 1 }, + .bvalid_session = { 0x4518, 4, 4, 0, 1 }, .utmi_avalid = { 0xe2ac, 10, 10, 0, 1 }, .utmi_bvalid = { 0xe2ac, 16, 16, 0, 1 }, }, From patchwork Wed Aug 15 09:59:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Enric Balletbo i Serra X-Patchwork-Id: 10566441 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 5462F13B4 for ; Wed, 15 Aug 2018 10:00:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 439CC29D7B for ; Wed, 15 Aug 2018 10:00:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3621629D85; Wed, 15 Aug 2018 10:00:31 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E087329DA3 for ; Wed, 15 Aug 2018 10:00:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=hCknX5eZFgx35wostnpPCbIITrVpTu+xO2TIjYpPHqw=; b=bhqTRATNsQzgMLnaDxXGs/X6TT a2R1G3m0ktj1epjkXSdwGmyxHnhlZmS2RaWfJLOCkP894zl3+xU0BE69EYyPwIMJgheixTlchpRmG EfsMP9lkTVsUC+J1cMhFh3znpNvCmKX6j3QNMgtukYXPRhx6F93dIwLhe/Qm32raeh/mTrak5nxDK K82KrGe90fZ7xHUOCCcGrlpWEn5ldhNJRudD7LQOILuDD5wUt72h/CZZwMBRGJ423Pcw4ZHhpJ3iU xgCbJxoPcQbJdQ1fz7WeAnIA4gga7ipXFyY29Mw0on1ctVC9kYEZt5myMMp/bWx9PgtW3HW6QYHfW wwEf3tuA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fpsbJ-0004mz-RJ; Wed, 15 Aug 2018 10:00:25 +0000 Received: from bhuna.collabora.co.uk ([46.235.227.227]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fpsat-0003pw-DX; Wed, 15 Aug 2018 10:00:00 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: eballetbo) with ESMTPSA id 5F7BA27D9BA From: Enric Balletbo i Serra To: linux-kernel@vger.kernel.org Subject: [PATCH 4/4] dt-bindings: phy-rockchip-inno-usb2: add new rockchip, force-bvalid property. Date: Wed, 15 Aug 2018 11:59:34 +0200 Message-Id: <20180815095934.11205-5-enric.balletbo@collabora.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180815095934.11205-1-enric.balletbo@collabora.com> References: <20180815095934.11205-1-enric.balletbo@collabora.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180815_025959_591452_BC69727B X-CRM114-Status: GOOD ( 10.77 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , devicetree@vger.kernel.org, heiko@sntech.de, groeck@google.com, Frank Wang , kieran.bingham@ideasonboard.com, Kishon Vijay Abraham I , linux-rockchip@lists.infradead.org, Rob Herring , kernel@collabora.com, bleung@chromium.org, linux-arm-kernel@lists.infradead.org, amstan@chromium.org MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This property is used when the otg-id pin is not connected. When this property is set it forces to set the B-Device Session Valid bit when the port works as device and clears that bit when the port works as host. Signed-off-by: Enric Balletbo i Serra --- .../devicetree/bindings/phy/phy-rockchip-inno-usb2.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.txt b/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.txt index 2d4808d3920b..55761f466c41 100644 --- a/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.txt +++ b/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.txt @@ -48,6 +48,11 @@ Optional properties: See ./phy-bindings.txt for details. - rockchip,utmi-avalid : boolean, use the avalid register to get vbus status. Otherwise, use the bvalid register. + - rockchip,force-bvalid : boolean, set this to force the B-Device Session + Valid bit when the usb port is in device mode. This + is used when the otg-id pin is not connected. + Only supported in case of compatible being: + * "rockchip,rk3399-usb2phy" Example: