Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3953313rwa; Tue, 23 Aug 2022 13:13:54 -0700 (PDT) X-Google-Smtp-Source: AA6agR60jnLoLMLH9xAVMkksMxBO5jVVc1sCxL1oJlgeOvsyjguzhDEIjavAPggZc2LznvUtJ2mT X-Received: by 2002:a05:6a00:1741:b0:536:baed:52ee with SMTP id j1-20020a056a00174100b00536baed52eemr9274178pfc.68.1661285634489; Tue, 23 Aug 2022 13:13:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661285634; cv=none; d=google.com; s=arc-20160816; b=xFnSCbYOIMRX06Qqy8KKyHyUOGZPS4eE77JPzvbMJFcwPq21jXhUMgWsgLXshB0Msh XO6J9C/eOzgw9tdHc5fbWIlh4BCanimnkVQ9gYcmKaeKmPRK6CfPPc3fvVt2LZjmBeql bCfr3x0lZGG07RnvgfRuqr8lQaoYpWMOQ4HB7f/Zr1wJq24t/+iIRgTFjg+lbId27JUn nHKJyKevqBh0L+5TC6RdZLijoRkJLor47lnnIOMHeTgBnwKATFl+aEJlG9F/xdJTqaf2 s7FeSoG4XjDlruRZfqTVfxt87vRTuljcG6wJQWGOYX+rz6JWBQxrJAgf555U7s6O0n++ ZG0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=36xdlCzVunG+zKQHP9+6mIXe8vPUy5DI1DjfJi/QjMM=; b=exU8Jnxoqw7Ry6WoTXVnDR9hmdlZuma7matt1bu+cZrdYd+97jzcYm/OHoCqKkS2nv Z4t3Th4+c2HaRyqEBXMZz4wV1oEY4XF0N5r1kAMbHynCiikAmcHVrd+o1GmnyOiL/75/ FGI0vi96Npby1tAFtnDxIuFl2lHKEx7/cAaCehjxOs2CA2gdJPe6dKbl6kc96C/6S3X9 21EgSjrMOaQpB8FENlwK9/ZIV2LiNX71MQk3pjen+L/f2TXd6Yubu7WfwpOxLCWrsMrk y0py7XT9g2MywFHjog13FU6etZ/6A9PMUGBzp/6t/KnhiDrjeSzPutEU1/G4CO1j3DY0 pgRA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=sntech.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d4-20020a633604000000b0041dd0c35c54si14621604pga.47.2022.08.23.13.13.40; Tue, 23 Aug 2022 13:13:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=sntech.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232559AbiHWTqb (ORCPT + 99 others); Tue, 23 Aug 2022 15:46:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232079AbiHWTqN (ORCPT ); Tue, 23 Aug 2022 15:46:13 -0400 Received: from gloria.sntech.de (gloria.sntech.de [185.11.138.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C65FDC12F6 for ; Tue, 23 Aug 2022 11:49:06 -0700 (PDT) Received: from ip5b412258.dynamic.kabel-deutschland.de ([91.65.34.88] helo=diego.localnet) by gloria.sntech.de with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1oQYxM-0006cy-NL; Tue, 23 Aug 2022 20:48:56 +0200 From: Heiko =?ISO-8859-1?Q?St=FCbner?= To: Kishon Vijay Abraham I , Vinod Koul , Peter Geis , Samuel Holland , Peter Geis Cc: Markus Reichl , Michael Riesch , linux-phy@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] phy: rockchip-inno-usb2: Return zero after otg sync Date: Tue, 23 Aug 2022 20:48:55 +0200 Message-ID: <2872516.OBFZWjSADL@diego> In-Reply-To: <20220823144728.47068-1-pgwipeout@gmail.com> References: <20220823144728.47068-1-pgwipeout@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_PASS, T_SCC_BODY_TEXT_LINE,T_SPF_HELO_TEMPERROR autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am Dienstag, 23. August 2022, 16:47:28 CEST schrieb Peter Geis: > The otg sync state patch reuses the ret variable, but fails to set it to > zero after use. This leads to a situation when the otg port is in > peripheral mode where the otg phy aborts halfway through setup. It also > fails to account for a failure to register the extcon notifier. Fix this > by using our own variable and skipping otg sync in case of failure. > > Fixes: 8dc60f8da22f ("phy: rockchip-inno-usb2: Sync initial otg state") > > Reported-by: Markus Reichl > Reported-by: Michael Riesch > Signed-off-by: Peter Geis > Tested-by: Michael Riesch > Tested-by: Markus Reichl Reviewed-by: Heiko Stuebner Tested-by: Heiko Stuebner > --- > drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c > index 0b1e9337ee8e..d579a22c61df 100644 > --- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c > +++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c > @@ -1124,7 +1124,7 @@ static int rockchip_usb2phy_otg_port_init(struct rockchip_usb2phy *rphy, > struct rockchip_usb2phy_port *rport, > struct device_node *child_np) > { > - int ret; > + int ret, id; > > rport->port_id = USB2PHY_PORT_OTG; > rport->port_cfg = &rphy->phy_cfg->port_cfgs[USB2PHY_PORT_OTG]; > @@ -1164,11 +1164,12 @@ static int rockchip_usb2phy_otg_port_init(struct rockchip_usb2phy *rphy, > EXTCON_USB_HOST, &rport->event_nb); > if (ret) > dev_err(rphy->dev, "register USB HOST notifier failed\n"); > + goto out; > > if (!of_property_read_bool(rphy->dev->of_node, "extcon")) { > /* do initial sync of usb state */ > - ret = property_enabled(rphy->grf, &rport->port_cfg->utmi_id); > - extcon_set_state_sync(rphy->edev, EXTCON_USB_HOST, !ret); > + id = property_enabled(rphy->grf, &rport->port_cfg->utmi_id); > + extcon_set_state_sync(rphy->edev, EXTCON_USB_HOST, !id); > } > } > >