Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp106118lqz; Fri, 29 Mar 2024 09:57:00 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVIcBKaz+w6oVDl5OdT9aalx+KBFTHlDr58MHeiU0nY3dzZXbzWsqDj4jQxbbKYjkhoajLaA8jtX+/zzJMpDF7Tl8kmlb8qNHDvwyyfgw== X-Google-Smtp-Source: AGHT+IFsykfi4dUOVbDWvkeKD5EPo+5baWSsgAiubJfhvvk7nKHO+oky8b2goQI5fwnN5txKEtaU X-Received: by 2002:a05:6a20:4306:b0:1a7:1f8:8c14 with SMTP id h6-20020a056a20430600b001a701f88c14mr937609pzk.0.1711731420016; Fri, 29 Mar 2024 09:57:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711731420; cv=pass; d=google.com; s=arc-20160816; b=TTGGFIGR2Q0ifQRFEnl47sYa0t2ZpLa6X8wvgAC1a74b2W5al5aGYvZ3jWZIowd5QV maNWW/3M4D/zEidP616S1ijV0gx8DmGx76K5lE2o9N2BoTmK0Wd48xz7jD6uAPXUkjL0 SOUhItq+Ez5KQNpaU/EQjkK2jRQFqqyrvxrNeiqXfFWLb0TPqngJIQIg1i8q51/iIcbn xtgPIAR1Gv7fnBGtMrymJouuGGGx549LDdgZ7dGKhEhowEUZJiOm3gtfniBUMjCzBrBY Y7q55x5cpECxNpo/WVg8I/5EIoVzCPk3Kj8skzo2jjSnx0M37J/GXjOc9x8KJGi3yvmi hnMA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=St9D/LLkAyJfbh5qOoexnHPMwHrcrv3RygtBhzhutLc=; fh=np5hNu9Uluo/mKvCPuKC/bo/i5BPdASYmDVaeaoxPE8=; b=n4+Gl/H5AZREVC7b5W4bgwaIbQiQZlt5R5wLFZqAL6SMPJ17ts7LfBdTdGkzPVPtfC ioSTIne8EwnwMTvAguepg6P78CbMVMDbVnyB+4OXAfA+JqN5Bu6cS66qbNEuLog60o2G SZt+AvEtlUq7K8UudE7kfB7ZnbqjGg55fSWH4dKstrhZFNf1HCXvllrDUfQia4n+MqCM CX23prbyM7i+7+ughXZZ+lB745m7Y/8pby8n+ZjhMaLqFWCb/XKmHCk6UmQ4PCgX5I+6 z4UQnQlci+I50mIHnOiHqfqOuR4W30kHc50WhG/H5mk5Mb5D//CTlnQ6hftJYp/bsbqp Ptfw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="cJ5kh/eF"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-125196-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-125196-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id q17-20020a63bc11000000b005eb04490853si3944387pge.742.2024.03.29.09.56.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Mar 2024 09:56:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-125196-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="cJ5kh/eF"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-125196-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-125196-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 865D42857DC for ; Fri, 29 Mar 2024 16:56:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 74799137767; Fri, 29 Mar 2024 16:56:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="cJ5kh/eF" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 94DAC136E01; Fri, 29 Mar 2024 16:56:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711731369; cv=none; b=qsFs/zd/S9xfVw8F+TV9LgwTxba6E96bWDuZxBaS5Qj1ubplY3PADA5WE+qEqzhvcFkQtRYXh7ShCTea/lfkGkLYnSDs6wQsNBmbWqNVj96kLKla3iraa6hYnxS/UZhFfqbtH2rr0OJzB/L56dZxrQk8MB0DrC3jYsSoPJMw8LE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711731369; c=relaxed/simple; bh=isBCBT3seLZHai1OgzPx3zwWr4nR668ZJ3SMftDDp6g=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=e9JA8JdPw6KqBrpIY9pXMYvbEQs3MUKMrqQskz/eiEXcg0mutRw53ntwlvEemGzCVsjT32CCCr3ecEO7UCrQWREdnLCeJpNdP25y3br4CQk5URtGVRfLEsLKuh0b9KCri0WwLX11FrH8g82zF36jVJak4hszoinLR9V0DA97oeA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=cJ5kh/eF; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id A6422C433C7; Fri, 29 Mar 2024 16:56:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711731369; bh=isBCBT3seLZHai1OgzPx3zwWr4nR668ZJ3SMftDDp6g=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=cJ5kh/eFxvCB7x0HP9o7GJ025aeWR+BDUKfpEeIIYigLiXrGXi/gyZYGwm1M0wIw5 RZ7k6YyugQtGNOCHPSI/Q4LFhlBCbcdGgTklkcpMx2V6f1IKOTHs3ZB7QZp5eTIoi3 u69yhID5We6VtYO8ucXLvNOvfoHL49CS+sepNyKzW/J+NZiNXTMRZZ5eCqZ31Td+68 NorqtgqaNH6A+ShOFysLPth9FfYCFQRw+4Ee/lBwRRpg+k7tLDNIGmNb8Tw1HHP4OY JF+SGtwvPX0HWLRAzSBautwu9NJ3voJxFVUp7Q4aSyekrr0TY8y9HkKV0JlF4BXBmG VMUerY5p90Fgw== Date: Fri, 29 Mar 2024 22:26:05 +0530 From: Vinod Koul To: Neil Armstrong Cc: Bjorn Andersson , Konrad Dybcio , Kishon Vijay Abraham I , Rob Herring , Krzysztof Kozlowski , Conor Dooley , linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH RFT 3/7] phy: qcom: qmp-combo: introduce QPHY_MODE Message-ID: References: <20240229-topic-sm8x50-upstream-phy-combo-typec-mux-v1-0-07e24a231840@linaro.org> <20240229-topic-sm8x50-upstream-phy-combo-typec-mux-v1-3-07e24a231840@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240229-topic-sm8x50-upstream-phy-combo-typec-mux-v1-3-07e24a231840@linaro.org> On 29-02-24, 14:07, Neil Armstrong wrote: > Introduce an enum for the QMP Combo PHY modes, use it in the > QMP commmon phy init function and default to COMBO mode. > > Signed-off-by: Neil Armstrong > --- > drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 41 +++++++++++++++++++++++++++---- > 1 file changed, 36 insertions(+), 5 deletions(-) > > diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c > index 3721bbea9eae..ac5d528fd7a1 100644 > --- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c > +++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c > @@ -61,6 +61,12 @@ > > #define PHY_INIT_COMPLETE_TIMEOUT 10000 > > +enum qphy_mode { > + QPHY_MODE_COMBO = 0, > + QPHY_MODE_DP_ONLY, > + QPHY_MODE_USB_ONLY, > +}; > + > /* set of registers with offsets different per-PHY */ > enum qphy_reg_layout { > /* PCS registers */ > @@ -1491,6 +1497,7 @@ struct qmp_combo { > > struct mutex phy_mutex; > int init_count; > + enum qphy_mode init_mode; > > struct phy *usb_phy; > enum phy_mode mode; > @@ -2531,12 +2538,33 @@ static int qmp_combo_com_init(struct qmp_combo *qmp, bool force) > if (qmp->orientation == TYPEC_ORIENTATION_REVERSE) > val |= SW_PORTSELECT_VAL; > writel(val, com + QPHY_V3_DP_COM_TYPEC_CTRL); > - writel(USB3_MODE | DP_MODE, com + QPHY_V3_DP_COM_PHY_MODE_CTRL); > > - /* bring both QMP USB and QMP DP PHYs PCS block out of reset */ > - qphy_clrbits(com, QPHY_V3_DP_COM_RESET_OVRD_CTRL, > - SW_DPPHY_RESET_MUX | SW_DPPHY_RESET | > - SW_USB3PHY_RESET_MUX | SW_USB3PHY_RESET); > + switch (qmp->init_mode) { > + case QPHY_MODE_COMBO: Case should be at same indent as switch :-) coding style 101 > + writel(USB3_MODE | DP_MODE, com + QPHY_V3_DP_COM_PHY_MODE_CTRL); > + > + /* bring both QMP USB and QMP DP PHYs PCS block out of reset */ > + qphy_clrbits(com, QPHY_V3_DP_COM_RESET_OVRD_CTRL, > + SW_DPPHY_RESET_MUX | SW_DPPHY_RESET | > + SW_USB3PHY_RESET_MUX | SW_USB3PHY_RESET); > + break; > + > + case QPHY_MODE_DP_ONLY: > + writel(DP_MODE, com + QPHY_V3_DP_COM_PHY_MODE_CTRL); > + > + /* bring QMP DP PHY PCS block out of reset */ > + qphy_clrbits(com, QPHY_V3_DP_COM_RESET_OVRD_CTRL, > + SW_DPPHY_RESET_MUX | SW_DPPHY_RESET); > + break; > + > + case QPHY_MODE_USB_ONLY: > + writel(USB3_MODE, com + QPHY_V3_DP_COM_PHY_MODE_CTRL); > + > + /* bring QMP USB PHY PCS block out of reset */ > + qphy_clrbits(com, QPHY_V3_DP_COM_RESET_OVRD_CTRL, > + SW_USB3PHY_RESET_MUX | SW_USB3PHY_RESET); > + break; > + } > > qphy_clrbits(com, QPHY_V3_DP_COM_SWI_CTRL, 0x03); > qphy_clrbits(com, QPHY_V3_DP_COM_SW_RESET, SW_RESET); > @@ -3545,6 +3573,9 @@ static int qmp_combo_probe(struct platform_device *pdev) > if (ret) > goto err_node_put; > > + /* Set PHY_MODE as combo by default */ > + qmp->init_mode = QPHY_MODE_COMBO; > + > qmp->usb_phy = devm_phy_create(dev, usb_np, &qmp_combo_usb_phy_ops); > if (IS_ERR(qmp->usb_phy)) { > ret = PTR_ERR(qmp->usb_phy); > > -- > 2.34.1 -- ~Vinod