From patchwork Mon Oct 17 06:50:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 3229 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp1303441wrs; Sun, 16 Oct 2022 23:52:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4+e7uEi4Ck0/G1fUh272o7UJkFAH+/o/2Odx56RPf+Nwc1UcVYBjiyOHAZhNniNaBPEl3t X-Received: by 2002:a17:90a:c90c:b0:20a:7179:b14f with SMTP id v12-20020a17090ac90c00b0020a7179b14fmr11906054pjt.58.1665989524763; Sun, 16 Oct 2022 23:52:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665989524; cv=none; d=google.com; s=arc-20160816; b=KWXBu4GE4iLqTyDKNH4uVFBKmBjBOwspDmUdac91pEF6RJQfFIqX2f0MXk8c5yNZvv Wc9GTqreFHND+f/UzXMg9afX8Mk374KMZ+3vcS8V6Wk3Ox3J94L5TJyG6O1ZnC03t4GG IeCKZi1U8juvE/byezvgLICB8V8N2Zed8qVfuJUWg2Fun546CEH++uhCJpzJO68o9aNk sacFfrMU2eUlgympVqzYWfSEZnNXtWHTyru2XHYrkkPob0VhAXkvafc/DHeXqI1n5c36 2HcC/damhIV2sYoYS3Twf7oC8icLxhuj3XxjiRRFpDMhPvVDxCjwDjR5VJEz07ARhg9T 7POw== 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 :dkim-signature; bh=1IsFbsP4C3lSDzjR/XY1xkR5U91lJBvVKnQzyKLiGPc=; b=BZO3fr3ejaCCh+WmpYgTF8Atvomx288Pf9rQrxCth1btucBF0eR+mW20Szh9EDI5pD MxxC58O3UoeLUXTB5JSqxIUVDq5Km4ovpt3mzfljFj0yBsZrzexA4hkpvyzaTW1E0BWR scWrSYIwcJoNemJsOSdd0YOPKNtsDBjcFYr4lNC8L51C14O75tfY8s4YdZAu4aU09VFe BRjbj1jvZ2r8IbWdXqO871IwVYOw7Bp9/VynGYodyfxP/yqEzEE2aU6/SfHcgx8XOpB/ wEM0dg3vtneSIFjYuXLRHb3FiSaweKHw5y45TCjeM0+LHw8Vn/Ib1BoWJGUgWSPdqkZh 9+4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="euto/nuJ"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z11-20020a056a001d8b00b00564f6be1218si10615292pfw.71.2022.10.16.23.51.51; Sun, 16 Oct 2022 23:52:04 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="euto/nuJ"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230081AbiJQGvU (ORCPT + 99 others); Mon, 17 Oct 2022 02:51:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229911AbiJQGuq (ORCPT ); Mon, 17 Oct 2022 02:50:46 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D3D84D4DB; Sun, 16 Oct 2022 23:50:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 408C8B80EBD; Mon, 17 Oct 2022 06:50:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4EC3EC4FEB6; Mon, 17 Oct 2022 06:50:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1665989441; bh=h9t3f2jv70g3Xg8Fuz/cy6pNfgf+gjH5E7JH0Z7sUPI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=euto/nuJP40pIQNp7AbjSENl7GIMh212CJCFmG8aGOmWQ8EvGiKRVl2R8Xm4i5f9+ UPF6gTNikWVC+yJ1PGab9ioyAQzYN08l6uqmtpFjiwFbDpW3Fm9NbggRwwwIdWv7Pc 0pL2TQRlCw0i6t5/Y75aFbM5USQGf9OZQYoTzbPMEzZkpp2sY1zlqKNfK9yOnV17rK 0IMUT3yRM/Q+2HlwiSP0+kYXhZpXLms/fSzZh0cdqkrLKoahOypbSJhD5V3iNAiqU2 2zpNUsTBiUVSfztm50SFE3kEZJxm7Nv5NjQrxqh6aTCuSJeLGrR36samuJWNIH3DSJ TY3aG8O96UH9g== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1okJxG-00057s-Uu; Mon, 17 Oct 2022 08:50:30 +0200 From: Johan Hovold To: Vinod Koul Cc: Andy Gross , Bjorn Andersson , Konrad Dybcio , Dmitry Baryshkov , linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH v3 09/11] phy: qcom-qmp-usb: clean up power-down handling Date: Mon, 17 Oct 2022 08:50:11 +0200 Message-Id: <20221017065013.19647-10-johan+linaro@kernel.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221017065013.19647-1-johan+linaro@kernel.org> References: <20221017065013.19647-1-johan+linaro@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1746916632058903768?= X-GMAIL-MSGID: =?utf-8?q?1746916632058903768?= Always define the POWER_DOWN_CONTROL register instead of falling back to the v2 (and v3) offset during power on and power off. Reviewed-by: Dmitry Baryshkov Signed-off-by: Johan Hovold --- drivers/phy/qualcomm/phy-qcom-qmp-usb.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-usb.c b/drivers/phy/qualcomm/phy-qcom-qmp-usb.c index 965e486ab87d..b0b13fb6cb59 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-usb.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-usb.c @@ -126,6 +126,7 @@ static const unsigned int usb3phy_regs_layout[QPHY_LAYOUT_SIZE] = { [QPHY_PCS_AUTONOMOUS_MODE_CTRL] = 0x0d4, [QPHY_PCS_LFPS_RXTERM_IRQ_CLEAR] = 0x0d8, [QPHY_PCS_LFPS_RXTERM_IRQ_STATUS] = 0x178, + [QPHY_PCS_POWER_DOWN_CONTROL] = 0x04, }; static const unsigned int qmp_v3_usb3phy_regs_layout[QPHY_LAYOUT_SIZE] = { @@ -135,6 +136,7 @@ static const unsigned int qmp_v3_usb3phy_regs_layout[QPHY_LAYOUT_SIZE] = { [QPHY_PCS_AUTONOMOUS_MODE_CTRL] = 0x0d8, [QPHY_PCS_LFPS_RXTERM_IRQ_CLEAR] = 0x0dc, [QPHY_PCS_LFPS_RXTERM_IRQ_STATUS] = 0x170, + [QPHY_PCS_POWER_DOWN_CONTROL] = 0x04, }; static const unsigned int qmp_v4_usb3phy_regs_layout[QPHY_LAYOUT_SIZE] = { @@ -2164,13 +2166,8 @@ static int qmp_usb_init(struct phy *phy) qphy_clrbits(dp_com, QPHY_V3_DP_COM_SW_RESET, SW_RESET); } - if (cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL]) - qphy_setbits(pcs, - cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL], - cfg->pwrdn_ctrl); - else - qphy_setbits(pcs, QPHY_V2_PCS_POWER_DOWN_CONTROL, - cfg->pwrdn_ctrl); + qphy_setbits(pcs, cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL], + cfg->pwrdn_ctrl); return 0; @@ -2277,13 +2274,8 @@ static int qmp_usb_power_off(struct phy *phy) qphy_clrbits(qphy->pcs, cfg->regs[QPHY_START_CTRL], cfg->start_ctrl); /* Put PHY into POWER DOWN state: active low */ - if (cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL]) { - qphy_clrbits(qphy->pcs, cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL], - cfg->pwrdn_ctrl); - } else { - qphy_clrbits(qphy->pcs, QPHY_V2_PCS_POWER_DOWN_CONTROL, - cfg->pwrdn_ctrl); - } + qphy_clrbits(qphy->pcs, cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL], + cfg->pwrdn_ctrl); return 0; }