From patchwork Thu Apr 14 03:22:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 12812884 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4ED97C433EF for ; Thu, 14 Apr 2022 03:23:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=CJGpqVQFiJuG1FKnTMtXoLc8E6R44FL41Tek9BcaZX0=; b=xMjw6nGW9UzC45 9uuNPhuvTdNHmmdmbGp9tna1fMtXtGOF1JYeaLazPMuJpV7TNp9Jy2340XN2khNI/qQ1KVFg3C81e eyaeqAAEQmizy/MDWkXJRoUFYte+cfOLG50GIQMyB1wKzE+bPgMcxCHpV+8WQqgeCh3dwQS8QKVWX djQ2Y5qEXq/Ulp++GLGzl8rJbDv2i3MyRef4jNcsJtABYBjRG9QqfLXi07Ug2QMXKizyCVLk95tT7 67czZzWIY0nhJxZwxKOE5xDXslGc4llhmFyQu3xqt18wq1IwhXVTsrgtbyfWupFXNhnrcKYFt7w/h 0zwnKCpnDXhojE2PZquw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1neq5E-003gw3-Kz; Thu, 14 Apr 2022 03:23:48 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1neq4V-003gcj-F4; Thu, 14 Apr 2022 03:23:06 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id AEDEF5C0593; Wed, 13 Apr 2022 23:23:01 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Wed, 13 Apr 2022 23:23:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= cc:cc:content-transfer-encoding:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm2; t=1649906581; x=1649992981; bh=ch oSBkcVUXVApD971k8AjvM5Di3IKxbalXzWvZFEOsQ=; b=NErAcTQAq1I4MEV3Md WOIhg8i8iNaeIJp4L23O7hjX0YoIFdqmi4UaEZXzlBsgUrQhd5Mi4CWTxszNQ7fy tg3LOmNdLu47VJsAJRg6KPBFnvSNn73ikGgWaadAg8yQmtWk5tVOQettPc4gbvl4 o/RhL8NorcTeVFQoXTc3Xct9XnMRMJYhOWSkzo7evemRicfG2KW+yWOc3CLX2j3m ZOWxqztiDq+MfcM2TPmOXBYmqvLrjraUWTL8amAVUaGN+Sqe5aHqN+BtvgbHwz8Y 2eJYk8dqjWuzd4jaB0ZcuTgOSFvs6At6Ui+168euwn/g2eVBHexHCv81bQ0GQoKC ou9Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1649906581; x=1649992981; bh=choSBkcVUXVApD971k8AjvM5Di3IKxbalXz WvZFEOsQ=; b=TiNy7nmoKHrfFn7dLPXBts4WuuvknzXOGSuIFq2y1WlmR2B1gO7 rLEC8CqY+Ey8AaJzFYVej3p6/Fr3fq8cBVbiDfuQHDGzPjAkMEDUpQAY8OMo5EMH ML+114CNUkNeG7D7xSX7qw8dE/nWSiokOeyIlxfC8ndUYcvU7xZckC4pFIC/pEem +yGVakCLr2FAwQp7xgYmkVN7Dqz998f0tA8atWIoqPzn4HV7LAj4COAJ7RN/i+Gw cmLzQHEPGnVrfGmbBmV2G7oPu2B1M1vljwe5kIhFoQ09u/i+CZPQruFe0wTIahDt 1S+n6dF3KVP3dM5Bhf6PvRC7kQpbzTJQ4Vg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrudelvddgjedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefurghmuhgv lhcujfholhhlrghnugcuoehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhgqeenucggtf frrghtthgvrhhnpeduhfejfedvhffgfeehtefghfeiiefgfeehgfdvvdevfeegjeehjedv gfejheeuieenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 13 Apr 2022 23:23:01 -0400 (EDT) From: Samuel Holland To: Kishon Vijay Abraham I , Vinod Koul , Heiko Stuebner Cc: Peter Geis , Samuel Holland , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, linux-rockchip@lists.infradead.org Subject: [PATCH 1/6] phy: rockchip-inno-usb2: Fix muxed interrupt support Date: Wed, 13 Apr 2022 22:22:52 -0500 Message-Id: <20220414032258.40984-2-samuel@sholland.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220414032258.40984-1-samuel@sholland.org> References: <20220414032258.40984-1-samuel@sholland.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220413_202304_148593_91141501 X-CRM114-Status: GOOD ( 10.30 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org This commit fixes two issues with the muxed interrupt handler. First, the OTG port has the "bvalid" interrupt enabled, not "linestate". Since only the linestate interrupt was handled, and not the bvalid interrupt, plugging in a cable to the OTG port caused an interrupt storm. Second, the return values from the individual port IRQ handlers need to be OR-ed together. Otherwise, the lack of an interrupt from the last port would cause the handler to erroneously return IRQ_NONE. Fixes: ed2b5a8e6b98 ("phy: phy-rockchip-inno-usb2: support muxed interrupts") Signed-off-by: Samuel Holland --- drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c index eca77e44a4c1..cba5c32cbaee 100644 --- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c +++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c @@ -940,8 +940,14 @@ static irqreturn_t rockchip_usb2phy_irq(int irq, void *data) if (!rport->phy) continue; - /* Handle linestate irq for both otg port and host port */ - ret = rockchip_usb2phy_linestate_irq(irq, rport); + switch (rport->port_id) { + case USB2PHY_PORT_OTG: + ret |= rockchip_usb2phy_otg_mux_irq(irq, rport); + break; + case USB2PHY_PORT_HOST: + ret |= rockchip_usb2phy_linestate_irq(irq, rport); + break; + } } return ret; From patchwork Thu Apr 14 03:22:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 12812883 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 93394C4332F for ; Thu, 14 Apr 2022 03:23:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=X8+xXMNJziJLKSNKFVzozHtl9qvOL2zlp+STFK0A9Ns=; b=CDOEo3PTp/xs3X l/Xv90pO8B3OyKuSZzhDFxDJ7xf4eUWOho9XF92aToJ1WTS2sLiTNqY6f83FEEffIXZli3CKcgOPP Wku4CAZ751EtrfCKELh1AhHVzkFihPL+ZrUC0osY8wcSL2V3oF+60aMbSwFh/Mq751KN7gVd6rT6P ZMUOUXGOW0YieYZpg4EbnhNHzp+b9CJFHAj2DLI2t/xC5FNn8xc1fEdQyEhLOpTDd+oUet4yuREHm 3f+ujtUic+/fUNbReGOas2qJ3BqTGeq+WL9891P6ccMW5PL6TDEJ1dvly5zJNc8lkBveCuRlX9pC5 GkoEwXoOpJuBmjb3+iZA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1neq4r-003gl4-UL; Thu, 14 Apr 2022 03:23:25 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1neq4V-003gck-OG; Thu, 14 Apr 2022 03:23:05 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 2215F5C0595; Wed, 13 Apr 2022 23:23:03 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Wed, 13 Apr 2022 23:23:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= cc:cc:content-transfer-encoding:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm2; t=1649906583; x=1649992983; bh=h6 K0lYRCU0VpHfM5lfVwAdVPmK6VD/PuBmR2+Mxj8mU=; b=ZLmjNyaoM/AaTirGXk GTjzV5f0XtmBnvgYM5cB5VFMySP6qmR+v0YB9SOEZ3VwO381WqyZgxkHUKYKqRJq /DW+a7mhH4ZPBYcS5NGvcGuOaDUflRaAlJUoXjkNngEizV+vNWNTpipO6CvpzNCy cCMVmzTGPbZ1W3F1ewbvkvZW8bljingPijRmPmuqiKSUPOaJT5C76RwKsqGuHbQF heT022a7yvgDOyo2S9iea82p6JA+kt+GNPJquktBJ+rNaDAJ9lQKLwL+a7RSqFbh Z3+7xiUALBzj0n0ldvLVMUgh/ipmrXZXWv+mlVlwmDJ6s/lUIs1acke9Fx9N/Yoz 5SOg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1649906583; x=1649992983; bh=h6K0lYRCU0VpHfM5lfVwAdVPmK6VD/PuBmR 2+Mxj8mU=; b=cUMRe8qScTlSVddK1lQIOj+IgaaWe7VDQvClDey1dt1UzzzQKQG QcL6Ad5eBitgwOV1X76LQJ//Lrh+f4HIaRzb+yqJsGRdaSjqYBZORlKFsRrJPiBC 7jByPa3dsPUrsu361J8d1lPbGq9T7VyNl97y2rrWwrmT/OmAlE6yyK7BpEZ8cLnK iZCaRqNejy53I89DIzVXYoyaOoRPIFq4ziA/XODNQ1jkdQujM/cfmPvn+czoPzwb dubxqdW91amAorEajrELN2i4J2nCqYVM9F+tpgdx9ZatbUkXna/cWlMlYJny0azc EhDBQeGXFAYu/GRYevX1ozbagDEx17JtiPQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrudelvddgjedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefurghmuhgv lhcujfholhhlrghnugcuoehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhgqeenucggtf frrghtthgvrhhnpeduhfejfedvhffgfeehtefghfeiiefgfeehgfdvvdevfeegjeehjedv gfejheeuieenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhroh hmpehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 13 Apr 2022 23:23:02 -0400 (EDT) From: Samuel Holland To: Kishon Vijay Abraham I , Vinod Koul , Heiko Stuebner Cc: Peter Geis , Samuel Holland , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, linux-rockchip@lists.infradead.org Subject: [PATCH 2/6] phy: rockchip-inno-usb2: Do not check bvalid twice Date: Wed, 13 Apr 2022 22:22:53 -0500 Message-Id: <20220414032258.40984-3-samuel@sholland.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220414032258.40984-1-samuel@sholland.org> References: <20220414032258.40984-1-samuel@sholland.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220413_202304_150406_3E59739B X-CRM114-Status: UNSURE ( 8.33 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The bvalid interrupt handler already checks bvalid status. The muxed IRQ handler just needs to call the other handler (plus any other handlers that will be added). Signed-off-by: Samuel Holland --- drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c index cba5c32cbaee..29407b36f5fa 100644 --- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c +++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c @@ -919,13 +919,11 @@ static irqreturn_t rockchip_usb2phy_bvalid_irq(int irq, void *data) static irqreturn_t rockchip_usb2phy_otg_mux_irq(int irq, void *data) { - struct rockchip_usb2phy_port *rport = data; - struct rockchip_usb2phy *rphy = dev_get_drvdata(rport->phy->dev.parent); + irqreturn_t ret = IRQ_NONE; - if (property_enabled(rphy->grf, &rport->port_cfg->bvalid_det_st)) - return rockchip_usb2phy_bvalid_irq(irq, data); - else - return IRQ_NONE; + ret |= rockchip_usb2phy_bvalid_irq(irq, data); + + return ret; } static irqreturn_t rockchip_usb2phy_irq(int irq, void *data) From patchwork Thu Apr 14 03:22:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 12812885 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BBEDEC433FE for ; Thu, 14 Apr 2022 03:23:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=9oS0R9VNoJz8JL6cxBfkduLoOnmx9+316NlcS7gBUls=; b=TR01v5aVq6dhOc zyxoV4lTjlFcIbcwMbvfup98V28GqG9tMNyqoOaMC2z+6JjW80FhoXrHSiCb0PKo8ewNeYLaQNEak mrfp3CPCLyq5ctsGlLsxf1/0CENn4X7PslKiejUqmUQ70Gt7BkMWc+RAFR+SNZbApGta3PT+EDMKy oD/Kg9WgAaL/J2Vg0NGTuT74MztHUyKorFVwj+J83tNEEwH+HAxalA0N+pdFciwSvCjBATiWFIu7Y 8Pf8sh+JSv3zhc3YBhKFKP/qxc6bmqr65tu0xjNoZNZgW3+8UFhBLr4S9DAiiSWPbTWXZLSz0tAQ9 IEUPsfpI3kzE9Q5/wqMw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1neq5E-003gw8-Pd; Thu, 14 Apr 2022 03:23:48 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1neq4X-003gdO-7h; Thu, 14 Apr 2022 03:23:06 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 98FDC5C0599; Wed, 13 Apr 2022 23:23:04 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Wed, 13 Apr 2022 23:23:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= cc:cc:content-transfer-encoding:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm2; t=1649906584; x=1649992984; bh=Zx ce5/kMy/OOKoyZk0y1H+zbEfnzEMwAKLBLRkDpYTo=; b=gWIUGtDisH43Z1V5Aj Fkfz8gjlSTkvgnu6n/vdOVhXRGKjQQk26pdNeyMCMlp97bkKvPgZmYTykiftsY4T VO2vOT1OB4mH1DzIL+LZaoNVKLZruuKEeESt/yly6FNERKBsHTyRlbMUBlM2FQpm BSLlwgS+LR8YTkhIqHycj+on19azWQElnKx9eSPiFqAWfIsfXnPBLJRv8WFa3lW3 E6HI6fCG3u36aiADxlwoFGlFUp6IxXuOydNn+EplrLhwW1mZu0NDQec7LxtA4/oF 8SyDc3vFs/ba0SghT1MBwIjCU7AW20ZKlJ+EtQ/pWOtDUvPPuWlOY6gvTVC0A4vy 4z3A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1649906584; x=1649992984; bh=Zxce5/kMy/OOKoyZk0y1H+zbEfnzEMwAKLB LRkDpYTo=; b=fK5xWL6vqy8kwPYCMsYSnXm0WDAkqifrittZPyqJ3oFfYQ6MlG+ 7+8Vrh011hPj5rvYS61g4301ypL/2bWHRZUJajk2WEKgbRmZDLVD+ykSbzmv0ASV Rze6qXaw9j343bz1DF5nkipvBISJtnPYn/fGlMiAZIiI5VODtGf0Ck/Grpax8byK 98qpHwiOU+tzrK04m4gvkwgbGPjio0Lf7edx+MH6pSu8INSt+nOAKNHOV9iYP0qF brxKXihHKsu+im66LICdr0ywRteoXpoYIrtD7MhFKZdL227bh/1WWwtUexPBrx+C k4xmIvS/ICJnXWkIE9W1xTt1EO9P1EyHNNA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrudelvddgjedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefurghmuhgv lhcujfholhhlrghnugcuoehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhgqeenucggtf frrghtthgvrhhnpeduhfejfedvhffgfeehtefghfeiiefgfeehgfdvvdevfeegjeehjedv gfejheeuieenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 13 Apr 2022 23:23:03 -0400 (EDT) From: Samuel Holland To: Kishon Vijay Abraham I , Vinod Koul , Heiko Stuebner Cc: Peter Geis , Samuel Holland , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, linux-rockchip@lists.infradead.org Subject: [PATCH 3/6] phy: rockchip-inno-usb2: Do not lock in bvalid IRQ handler Date: Wed, 13 Apr 2022 22:22:54 -0500 Message-Id: <20220414032258.40984-4-samuel@sholland.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220414032258.40984-1-samuel@sholland.org> References: <20220414032258.40984-1-samuel@sholland.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220413_202305_389596_E70D261D X-CRM114-Status: UNSURE ( 7.42 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org Clearing the IRQ is atomic, so there is no need to hold the mutex. Signed-off-by: Samuel Holland --- drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c index 29407b36f5fa..3422db56be76 100644 --- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c +++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c @@ -905,13 +905,9 @@ static irqreturn_t rockchip_usb2phy_bvalid_irq(int irq, void *data) if (!property_enabled(rphy->grf, &rport->port_cfg->bvalid_det_st)) return IRQ_NONE; - mutex_lock(&rport->mutex); - /* clear bvalid detect irq pending status */ property_enable(rphy->grf, &rport->port_cfg->bvalid_det_clr, true); - mutex_unlock(&rport->mutex); - rockchip_usb2phy_otg_sm_work(&rport->otg_sm_work.work); return IRQ_HANDLED; From patchwork Thu Apr 14 03:22:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 12812886 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DCC91C433EF for ; Thu, 14 Apr 2022 03:24:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=AYczYebkdjN8vrq6ZOrgC7K5HKqnuJpNU0KoaaYpToo=; b=VUeM0GC8Irbq3T ZA0fFIJqcgBntGMov6mcj0hoSlkW5bSYuG+jRGXCyAdS3FoHMQOLI4IHB4XYH9UIc3sP3c1tv5ojZ Bpjz3e34t6iUOB98ViQGo9tasHsZXQoAK1SG0BHvgHg4GxRDbtB9s4sX0PMjhBtjHsmQTKCETLi+0 t8NSs72eW8j+K/rzI9kT7+Em+W1hH+GKRy6KyNCeTnvHWYEIqhSJ7lxjvqserWjjUM54GzmBs4q3d mZXvymmCLhwukqU1qcdp0+y2PWFQBCVKgMk3oz7V6LApe8MbVsFU+QBJHPlQELNc+kgtCBgFRfhrl YoX12/DUD8ioGDIxpV0Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1neq5Z-003h8m-At; Thu, 14 Apr 2022 03:24:09 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1neq4Y-003ge1-NG; Thu, 14 Apr 2022 03:23:08 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 182545C059B; Wed, 13 Apr 2022 23:23:06 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Wed, 13 Apr 2022 23:23:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= cc:cc:content-transfer-encoding:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm2; t=1649906586; x=1649992986; bh=JB SEPKc915xSzefZ0CTW6PeicSizTdW4KnF7s2wyqrw=; b=SmJ7IUBpwx3EqhSJY4 e/zpgcBX9Il00K34p5aXOFBfnpfQy/a6JvXxQ62nAWfoZnti5cBbv/l13dFdi3fp gNSnYGCnmyc2882xmIf6wRCNj6eRyXenfS7RbJDqk/NxxC+o/AJtyk1qITbCuSy1 3GomB3ipmkivnenGcMmqSi2/n4FA8RzbkMQGGgAGET6oraIVc2f6hiF6SKgRyCqA BqGEnREyPPKI3w2w9esjuXErgZ8A5I9VAdDRWe6GhN7jhEav+K1jgaTu4YDVCDIs Jokx2Tmnl+Lq03/lbKtEaoohQ48j3w7SiqPJT8RjcQRdvPLD3cCqjAgUsRHLGscC ypNw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1649906586; x=1649992986; bh=JBSEPKc915xSzefZ0CTW6PeicSizTdW4KnF 7s2wyqrw=; b=xrPsAt+QqBqT90qN6D+S4/Ub1LWKZoZGedhcntw3XPXdfkSiRXI MrhxmdpM8DZqrKrAcyoRyr9Q41+OYyI6sKXBufjM5LvW7dw8yG1orLn/Bg+zvbfF 5QVmUhIA9mX9ZIyFDW8XUQW9197Ns3agg0CVUr5rtwwNnPyxmZYW83jhwQJnDWUY XemtgbyzoXCSMSkPUkk1y1c2BdmqdH/nM4NArZo9LQrO9o+G4ItNlhtUc//SqhTn J3HEfcF3UNFv8y+RyHW7EmWr8w9+TNo0CdTRxdBnnMB0MItSrJzpoSL2FDvX8QOs EmPSSYmgJi4fgf4ExkRWUnldgrKypcwNr8Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrudelvddgjedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefurghmuhgv lhcujfholhhlrghnugcuoehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhgqeenucggtf frrghtthgvrhhnpeduhfejfedvhffgfeehtefghfeiiefgfeehgfdvvdevfeegjeehjedv gfejheeuieenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 13 Apr 2022 23:23:05 -0400 (EDT) From: Samuel Holland To: Kishon Vijay Abraham I , Vinod Koul , Heiko Stuebner Cc: Peter Geis , Samuel Holland , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, linux-rockchip@lists.infradead.org Subject: [PATCH 4/6] phy: rockchip-inno-usb2: Support multi-bit mask properties Date: Wed, 13 Apr 2022 22:22:55 -0500 Message-Id: <20220414032258.40984-5-samuel@sholland.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220414032258.40984-1-samuel@sholland.org> References: <20220414032258.40984-1-samuel@sholland.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220413_202306_948681_3B6A8BD8 X-CRM114-Status: UNSURE ( 8.94 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The "bvalid" and "id" interrupts can trigger on either the rising edge or the falling edge, so each interrupt has two enable bits and two status bits. This change allows using a single property for both bits, checking whether either bit is set. Signed-off-by: Samuel Holland --- drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c index 3422db56be76..c694517496f8 100644 --- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c +++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c @@ -253,7 +253,7 @@ static inline bool property_enabled(struct regmap *base, return false; tmp = (orig & mask) >> reg->bitstart; - return tmp == reg->enable; + return tmp != reg->disable; } static int rockchip_usb2phy_clk480m_prepare(struct clk_hw *hw) From patchwork Thu Apr 14 03:22:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 12812887 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C7EB1C433EF for ; Thu, 14 Apr 2022 03:24:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=CmlGSn6UCEuXf849SxeQ2jGmAxug0egkX0R/s6eJLW0=; b=xdAyQt9Dzhf2ZF Fd9YPonZ9ksS3BmgQMZSdlb+5Py1KpE5Vb6PvY+SOe3Hna1fR3keKRvNqTHDnixdp0R5SStAX1Vr4 yCrELCu3qe7EKPk+3Jh4UHYQDXGmtI90FWlGBbVz4b7rY57wjICCsp1NV2CCv3m61crKBiENqe2s5 eLwOEHj/21fkLLzI8Y5iJoIx/L9XgJbN9yxNSGahucuTwqwUR0KkDcImDf9d7p9VUVpXQxM9IO21W KODkY915JNgFzJklX94XlOnr4o2p+pTNduqgHzVtZjX8tT7/QSNj0elRvnPFg/i9OWNRKBCHikATn 08yaPFEyL5+e0M/MDEqA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1neq5u-003hKT-74; Thu, 14 Apr 2022 03:24:30 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1neq4a-003gf1-6S; Thu, 14 Apr 2022 03:23:10 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 8E1A05C059D; Wed, 13 Apr 2022 23:23:07 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Wed, 13 Apr 2022 23:23:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= cc:cc:content-transfer-encoding:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm2; t=1649906587; x=1649992987; bh=2c yAbw+mxipdsb5EEU66tvRgQBKhpd5IuKusyVkj874=; b=XhA3LcPh3lLoixI8By KPeESI1K8CIRU6LzaxuhxxpdHsCg1mlkij18LLftHN/jxp/7L4IwaavHbQ4fXOJx J7LJd5hJ6CgrZwb4AMQRaYY4oQzm28H0pfVxLWU3XKhCfWb2BKyPHkMn7S6iHGO+ CDniwfwMOSUd+NPd8vxYqomYatgRkx36sVDAqFwoC/TMlLH/t5E0w3oY/IovybNa thTPsYmprGhG77OubEhQe456t/WDboT1Blmy1dUSAtCFjLRTRMthN2Q1hKc3rkkR t2bPY+SC+mmGbmP5YFmPOwSkaXqe8fpULT8XIpES6nwG/J1Ce7+oVLcfNEUitnbM WcSg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1649906587; x=1649992987; bh=2cyAbw+mxipdsb5EEU66tvRgQBKhpd5IuKu syVkj874=; b=wxBVsRHPd5Jv5jy5SiqA2q32lXcafNFvG0H1ZkO8lk8lFc+yPXP WhR8kRwzrndJyLKkZmz65vz857eZexMxWe1G5TxYa5jeVUlUlKMt9tixJrNP3BCe FBwYfP2Rozt7VJjLiRB4Pw8jcgYgNX9KPL7gUBOkUnsYa2G3UczROmSOCYRSAbkK Gy+6RotiHwzRKK28oOVuLnTMkXkgZCBJoiOlwECdMg44fn1iReU11qrToGtGD7AW GoOSht/AUTmV9IbJwUzQk/CpukqLX5Aqs3SclkcJvWrdITlNblmufsf6Gfup/ThD 2F+akDUvB1rqHUbQNJWc8351A1czdb4vwvw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrudelvddgjedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefurghmuhgv lhcujfholhhlrghnugcuoehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhgqeenucggtf frrghtthgvrhhnpeduhfejfedvhffgfeehtefghfeiiefgfeehgfdvvdevfeegjeehjedv gfejheeuieenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 13 Apr 2022 23:23:06 -0400 (EDT) From: Samuel Holland To: Kishon Vijay Abraham I , Vinod Koul , Heiko Stuebner Cc: Peter Geis , Samuel Holland , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, linux-rockchip@lists.infradead.org Subject: [PATCH 5/6] phy: rockchip-inno-usb2: Handle bvalid falling Date: Wed, 13 Apr 2022 22:22:56 -0500 Message-Id: <20220414032258.40984-6-samuel@sholland.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220414032258.40984-1-samuel@sholland.org> References: <20220414032258.40984-1-samuel@sholland.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220413_202308_382882_D4331ED2 X-CRM114-Status: UNSURE ( 7.61 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org Some SoCs have a bvalid falling interrupt, in addition to bvalid rising. This interrupt can detect OTG cable plugout immediately, so it can avoid the delay until the next scheduled work. Signed-off-by: Samuel Holland --- drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c index c694517496f8..2b29f5dd8873 100644 --- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c +++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c @@ -1345,9 +1345,9 @@ static const struct rockchip_usb2phy_cfg rk3308_phy_cfgs[] = { .port_cfgs = { [USB2PHY_PORT_OTG] = { .phy_sus = { 0x0100, 8, 0, 0, 0x1d1 }, - .bvalid_det_en = { 0x3020, 2, 2, 0, 1 }, - .bvalid_det_st = { 0x3024, 2, 2, 0, 1 }, - .bvalid_det_clr = { 0x3028, 2, 2, 0, 1 }, + .bvalid_det_en = { 0x3020, 3, 2, 0, 3 }, + .bvalid_det_st = { 0x3024, 3, 2, 0, 3 }, + .bvalid_det_clr = { 0x3028, 3, 2, 0, 3 }, .ls_det_en = { 0x3020, 0, 0, 0, 1 }, .ls_det_st = { 0x3024, 0, 0, 0, 1 }, .ls_det_clr = { 0x3028, 0, 0, 0, 1 }, @@ -1388,9 +1388,9 @@ static const struct rockchip_usb2phy_cfg rk3328_phy_cfgs[] = { .port_cfgs = { [USB2PHY_PORT_OTG] = { .phy_sus = { 0x0100, 15, 0, 0, 0x1d1 }, - .bvalid_det_en = { 0x0110, 2, 2, 0, 1 }, - .bvalid_det_st = { 0x0114, 2, 2, 0, 1 }, - .bvalid_det_clr = { 0x0118, 2, 2, 0, 1 }, + .bvalid_det_en = { 0x0110, 3, 2, 0, 3 }, + .bvalid_det_st = { 0x0114, 3, 2, 0, 3 }, + .bvalid_det_clr = { 0x0118, 3, 2, 0, 3 }, .ls_det_en = { 0x0110, 0, 0, 0, 1 }, .ls_det_st = { 0x0114, 0, 0, 0, 1 }, .ls_det_clr = { 0x0118, 0, 0, 0, 1 }, @@ -1512,9 +1512,9 @@ static const struct rockchip_usb2phy_cfg rk3568_phy_cfgs[] = { .port_cfgs = { [USB2PHY_PORT_OTG] = { .phy_sus = { 0x0000, 8, 0, 0, 0x1d1 }, - .bvalid_det_en = { 0x0080, 2, 2, 0, 1 }, - .bvalid_det_st = { 0x0084, 2, 2, 0, 1 }, - .bvalid_det_clr = { 0x0088, 2, 2, 0, 1 }, + .bvalid_det_en = { 0x0080, 3, 2, 0, 3 }, + .bvalid_det_st = { 0x0084, 3, 2, 0, 3 }, + .bvalid_det_clr = { 0x0088, 3, 2, 0, 3 }, .utmi_avalid = { 0x00c0, 10, 10, 0, 1 }, .utmi_bvalid = { 0x00c0, 9, 9, 0, 1 }, }, From patchwork Thu Apr 14 03:22:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 12812888 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F317DC433EF for ; Thu, 14 Apr 2022 03:24:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=K01fEA8nFH+ADU4q8pgy1QuoxrzInMHZY7SPYe7tuOc=; b=uPCaXo4hvy9sBs /b+ZfkaahN9kKYZkVuuUbG52MCtR+Fvq75RkBojn1XvF6WhiPMjTZJsMQZ724Koh4PMKsMmKJjct1 FTCwemTBYCrMOMD8zwGVQtFE5UIgaKBAn6DsuLjxJ9rWtMl0jF3hMxcOkjuu1b8stdg58BEnSeZ9/ QHAQzNN04aSqzukP0awZLWCjabbdWVIvHHBcysTsviBwC8DKw/XIqMdMxWEbzeuMTdct2Y1o+S/QG qDqqabwLLNc1MZyAirFwIo6bJCRihFrF18k3GdghBYAF6HzkRI4PXy9xBYnOsnOsMz2XOP+iqTLnl 4A1XTxE4eQ2F0k/LZ/ng==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1neq6E-003hVN-6V; Thu, 14 Apr 2022 03:24:50 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1neq4b-003gfc-KL; Thu, 14 Apr 2022 03:23:11 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 03AA25C059F; Wed, 13 Apr 2022 23:23:09 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Wed, 13 Apr 2022 23:23:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= cc:cc:content-transfer-encoding:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm2; t=1649906588; x=1649992988; bh=oy Y0y0iDKvCprqGB7cUA56JPXS9meVq9Antz5/VLmEw=; b=PRhsrHf/KKEKGfwAht KhgQ62OpuPa9RENHhU+1ijtCcXsxDczA1T9Y7AYDuYJkUlmB7U4pe2u4ZZV67/CJ mr1yJAX+ufJHsQz5PIffjK5TA8YTe3cFrhoVKvZ3AePeVMQg43YKZ5UAePXZ28HL l78iVcz9pgKTLfi7157z3qYvqcKgrQrnsiYK3seJ2gb1UhaQVV6pIulLT5Um+QPA MD9KLET5FVsuFX5n9k9cIJ72gYCrpXmsM1747/jd9sII9X/zLMpWnoxPCqpCb/0Y RsbZH5li0tZXot6hOOkn/w5qZz94qsGh02lPxHSK5J6FTOH+WO2boFEUi5sy1fWV NWPA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1649906588; x=1649992988; bh=oyY0y0iDKvCprqGB7cUA56JPXS9meVq9Ant z5/VLmEw=; b=VsMYKYmnJF7QxbhfMPpV73nRpY0JNdWHQuM5dOm9hb1KcG30o5G ixXIpEs8qvHj0GHfUfFHNg3ImPSBeYW8i7TZB8fqw+lbpITjl23rmPPEG1z+yLt8 YEn8W7bAtznCxHUN4o7lCebH78anbIwsoRGNl0rX1Lyss4VHgnZpb97g1ZlmUa9U 3giTMXsZ2S8CjX9zZB1BrqfakqiziEYgDc69ziQ5QWdE2YSnyg9gAIxkKjCzczMv Abnq+JyTrvxoYjPdOsPCLagLtGCKLGlI48VaZoOy2CCbOxY808HFViZjbmFDwxsH bFauG+fY/6gab7Nm50gXTVhDdSHkbZ2WNow== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrudelvddgjedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefurghmuhgv lhcujfholhhlrghnugcuoehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhgqeenucggtf frrghtthgvrhhnpeduhfejfedvhffgfeehtefghfeiiefgfeehgfdvvdevfeegjeehjedv gfejheeuieenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 13 Apr 2022 23:23:08 -0400 (EDT) From: Samuel Holland To: Kishon Vijay Abraham I , Vinod Koul , Heiko Stuebner Cc: Peter Geis , Samuel Holland , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, linux-rockchip@lists.infradead.org Subject: [PATCH 6/6] phy: rockchip-inno-usb2: Handle ID IRQ Date: Wed, 13 Apr 2022 22:22:57 -0500 Message-Id: <20220414032258.40984-7-samuel@sholland.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220414032258.40984-1-samuel@sholland.org> References: <20220414032258.40984-1-samuel@sholland.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220413_202309_784682_F53E80FD X-CRM114-Status: GOOD ( 13.47 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org This supports detecting host mode for the OTG port without an extcon. The rv1108 properties are not updated due to lack of documentation. Signed-off-by: Samuel Holland --- drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 85 +++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c index 2b29f5dd8873..e377b958d9b6 100644 --- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c +++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c @@ -116,11 +116,15 @@ 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. + * @id_det_en: id detection enable register. + * @id_det_st: id detection state register. + * @id_det_clr: id detection clear register. * @ls_det_en: linestate detection enable register. * @ls_det_st: linestate detection state register. * @ls_det_clr: linestate detection clear register. * @utmi_avalid: utmi vbus avalid status register. * @utmi_bvalid: utmi vbus bvalid status register. + * @utmi_id: utmi id state register. * @utmi_ls: utmi linestate state register. * @utmi_hstdet: utmi host disconnect register. */ @@ -129,11 +133,15 @@ 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 id_det_en; + struct usb2phy_reg id_det_st; + struct usb2phy_reg id_det_clr; struct usb2phy_reg ls_det_en; struct usb2phy_reg ls_det_st; struct usb2phy_reg ls_det_clr; struct usb2phy_reg utmi_avalid; struct usb2phy_reg utmi_bvalid; + struct usb2phy_reg utmi_id; struct usb2phy_reg utmi_ls; struct usb2phy_reg utmi_hstdet; }; @@ -161,6 +169,7 @@ struct rockchip_usb2phy_cfg { * @suspended: phy suspended flag. * @vbus_attached: otg device vbus status. * @bvalid_irq: IRQ number assigned for vbus valid rise detection. + * @id_irq: IRQ number assigned for ID pin detection. * @ls_irq: IRQ number assigned for linestate detection. * @otg_mux_irq: IRQ number which multiplex otg-id/otg-bvalid/linestate * irqs to one irq in otg-port. @@ -179,6 +188,7 @@ struct rockchip_usb2phy_port { bool suspended; bool vbus_attached; int bvalid_irq; + int id_irq; int ls_irq; int otg_mux_irq; struct mutex mutex; @@ -419,6 +429,19 @@ static int rockchip_usb2phy_init(struct phy *phy) if (ret) goto out; + /* clear id status and enable id detect irq */ + ret = property_enable(rphy->grf, + &rport->port_cfg->id_det_clr, + true); + if (ret) + goto out; + + ret = property_enable(rphy->grf, + &rport->port_cfg->id_det_en, + true); + if (ret) + goto out; + schedule_delayed_work(&rport->otg_sm_work, OTG_SCHEDULE_DELAY * 3); } else { @@ -913,11 +936,30 @@ static irqreturn_t rockchip_usb2phy_bvalid_irq(int irq, void *data) return IRQ_HANDLED; } +static irqreturn_t rockchip_usb2phy_id_irq(int irq, void *data) +{ + struct rockchip_usb2phy_port *rport = data; + struct rockchip_usb2phy *rphy = dev_get_drvdata(rport->phy->dev.parent); + bool id; + + if (!property_enabled(rphy->grf, &rport->port_cfg->id_det_st)) + return IRQ_NONE; + + /* clear id detect irq pending status */ + property_enable(rphy->grf, &rport->port_cfg->id_det_clr, true); + + id = property_enabled(rphy->grf, &rport->port_cfg->utmi_id); + extcon_set_state_sync(rphy->edev, EXTCON_USB_HOST, !id); + + return IRQ_HANDLED; +} + static irqreturn_t rockchip_usb2phy_otg_mux_irq(int irq, void *data) { irqreturn_t ret = IRQ_NONE; ret |= rockchip_usb2phy_bvalid_irq(irq, data); + ret |= rockchip_usb2phy_id_irq(irq, data); return ret; } @@ -1015,6 +1057,25 @@ static int rockchip_usb2phy_port_irq_init(struct rockchip_usb2phy *rphy, "failed to request otg-bvalid irq handle\n"); return ret; } + + rport->id_irq = of_irq_get_byname(child_np, "otg-id"); + if (rport->id_irq < 0) { + dev_err(rphy->dev, "no otg-id irq provided\n"); + ret = rport->id_irq; + return ret; + } + + ret = devm_request_threaded_irq(rphy->dev, rport->id_irq, + NULL, + rockchip_usb2phy_id_irq, + IRQF_ONESHOT, + "rockchip_usb2phy_id", + rport); + if (ret) { + dev_err(rphy->dev, + "failed to request otg-id irq handle\n"); + return ret; + } } break; default: @@ -1289,10 +1350,14 @@ static const struct rockchip_usb2phy_cfg rk3228_phy_cfgs[] = { .bvalid_det_en = { 0x0680, 3, 3, 0, 1 }, .bvalid_det_st = { 0x0690, 3, 3, 0, 1 }, .bvalid_det_clr = { 0x06a0, 3, 3, 0, 1 }, + .id_det_en = { 0x0680, 6, 5, 0, 3 }, + .id_det_st = { 0x0690, 6, 5, 0, 3 }, + .id_det_clr = { 0x06a0, 6, 5, 0, 3 }, .ls_det_en = { 0x0680, 2, 2, 0, 1 }, .ls_det_st = { 0x0690, 2, 2, 0, 1 }, .ls_det_clr = { 0x06a0, 2, 2, 0, 1 }, .utmi_bvalid = { 0x0480, 4, 4, 0, 1 }, + .utmi_id = { 0x0480, 1, 1, 0, 1 }, .utmi_ls = { 0x0480, 3, 2, 0, 1 }, }, [USB2PHY_PORT_HOST] = { @@ -1348,11 +1413,15 @@ static const struct rockchip_usb2phy_cfg rk3308_phy_cfgs[] = { .bvalid_det_en = { 0x3020, 3, 2, 0, 3 }, .bvalid_det_st = { 0x3024, 3, 2, 0, 3 }, .bvalid_det_clr = { 0x3028, 3, 2, 0, 3 }, + .id_det_en = { 0x3020, 5, 4, 0, 3 }, + .id_det_st = { 0x3024, 5, 4, 0, 3 }, + .id_det_clr = { 0x3028, 5, 4, 0, 3 }, .ls_det_en = { 0x3020, 0, 0, 0, 1 }, .ls_det_st = { 0x3024, 0, 0, 0, 1 }, .ls_det_clr = { 0x3028, 0, 0, 0, 1 }, .utmi_avalid = { 0x0120, 10, 10, 0, 1 }, .utmi_bvalid = { 0x0120, 9, 9, 0, 1 }, + .utmi_id = { 0x0120, 6, 6, 0, 1 }, .utmi_ls = { 0x0120, 5, 4, 0, 1 }, }, [USB2PHY_PORT_HOST] = { @@ -1391,11 +1460,15 @@ static const struct rockchip_usb2phy_cfg rk3328_phy_cfgs[] = { .bvalid_det_en = { 0x0110, 3, 2, 0, 3 }, .bvalid_det_st = { 0x0114, 3, 2, 0, 3 }, .bvalid_det_clr = { 0x0118, 3, 2, 0, 3 }, + .id_det_en = { 0x0110, 5, 4, 0, 3 }, + .id_det_st = { 0x0114, 5, 4, 0, 3 }, + .id_det_clr = { 0x0118, 5, 4, 0, 3 }, .ls_det_en = { 0x0110, 0, 0, 0, 1 }, .ls_det_st = { 0x0114, 0, 0, 0, 1 }, .ls_det_clr = { 0x0118, 0, 0, 0, 1 }, .utmi_avalid = { 0x0120, 10, 10, 0, 1 }, .utmi_bvalid = { 0x0120, 9, 9, 0, 1 }, + .utmi_id = { 0x0120, 6, 6, 0, 1 }, .utmi_ls = { 0x0120, 5, 4, 0, 1 }, }, [USB2PHY_PORT_HOST] = { @@ -1453,8 +1526,12 @@ 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 }, + .id_det_en = { 0xe3c0, 5, 4, 0, 3 }, + .id_det_st = { 0xe3e0, 5, 4, 0, 3 }, + .id_det_clr = { 0xe3d0, 5, 4, 0, 3 }, .utmi_avalid = { 0xe2ac, 7, 7, 0, 1 }, .utmi_bvalid = { 0xe2ac, 12, 12, 0, 1 }, + .utmi_id = { 0xe2ac, 8, 8, 0, 1 }, }, [USB2PHY_PORT_HOST] = { .phy_sus = { 0xe458, 1, 0, 0x2, 0x1 }, @@ -1488,8 +1565,12 @@ 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 }, + .id_det_en = { 0xe3c0, 10, 9, 0, 3 }, + .id_det_st = { 0xe3e0, 10, 9, 0, 3 }, + .id_det_clr = { 0xe3d0, 10, 9, 0, 3 }, .utmi_avalid = { 0xe2ac, 10, 10, 0, 1 }, .utmi_bvalid = { 0xe2ac, 16, 16, 0, 1 }, + .utmi_id = { 0xe2ac, 11, 11, 0, 1 }, }, [USB2PHY_PORT_HOST] = { .phy_sus = { 0xe468, 1, 0, 0x2, 0x1 }, @@ -1515,8 +1596,12 @@ static const struct rockchip_usb2phy_cfg rk3568_phy_cfgs[] = { .bvalid_det_en = { 0x0080, 3, 2, 0, 3 }, .bvalid_det_st = { 0x0084, 3, 2, 0, 3 }, .bvalid_det_clr = { 0x0088, 3, 2, 0, 3 }, + .id_det_en = { 0x0080, 5, 4, 0, 3 }, + .id_det_st = { 0x0084, 5, 4, 0, 3 }, + .id_det_clr = { 0x0088, 5, 4, 0, 3 }, .utmi_avalid = { 0x00c0, 10, 10, 0, 1 }, .utmi_bvalid = { 0x00c0, 9, 9, 0, 1 }, + .utmi_id = { 0x00c0, 6, 6, 0, 1 }, }, [USB2PHY_PORT_HOST] = { /* Select suspend control from controller */