Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp1922500lqb; Mon, 27 May 2024 01:48:41 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUeljxjjvsXLc1YeLr7Dbz3ioHtfqIKPU0PVhsKCqXVYk6rblbz8YtHJfuzQXN+hKIiJ/1XcO2sPVaEat8YVtWRpqTG7KAEUuo3jZfzFg== X-Google-Smtp-Source: AGHT+IH7qk6LMwCIFFFYoGHFIeXq2PfVqA2vbG+I24L3i5ssDQCwIpAfJSr+JqZ2S0j7RsWZkKUh X-Received: by 2002:ac8:598b:0:b0:43e:34ea:80f8 with SMTP id d75a77b69052e-43fb0e05491mr98837051cf.39.1716799721225; Mon, 27 May 2024 01:48:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716799721; cv=pass; d=google.com; s=arc-20160816; b=mfLBuflCJFC1FF6cvXwnIk1g2pkS5tc9AGOQUey4i8TmmR2hIdLR7vUyJE5vf3ZwOF H4Q6JNrzJRS5mAdYUjYlJ0f0ttaG8xrw/RGJPTQtIk6smpytjnm6Ko7DSw+/jVFNEqAo TuWG0yFqQHWoR+XPxE+ZglKtqj/B4E0hrhhBY8hYLl6jpz7VtZOuUkbybracmt5SffI2 nNOqzUaFZefA0x3J0EKXjZbG7nY3RxD8sY+1oNbF6H5cuvqBKHvgTMLKzNCYGE0Ci0AI ucpTpGHHvnojiCBp9p78XsbPfc8pn3T/qOdCOShHWh5T26B2CXKjHR7JQPQmB4I+aibp Mn1Q== 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=TCW+HFtoeaierrg0K+2TVOUHq8VHzqfUi+kUPqpq30g=; fh=Yly6CHfEuZCVO+FbbeoHxbpoQ4Xw2FLBzr7A/sVPabs=; b=CmZgngI1q2trIgGEjeJdw+EQBuOGpt4K1X/ftToeexYgIUx9hzfQ/TMKn+GMRxieiK B0MChVuC+pqhiibr17BzAyvDO2H3ipWja3dqlp18MsV81gJSPAbmfZSS81KEhWHOarIE t2JleyEeHrGLRV/zI7YchYf/hZcSH4qs5BdZGZ7O9OYqqf6dqjFLpj5/fmNbUdLtMUQJ 9aFr/9C/Ov5PyCRz4n7C/I50ow5SDQSy0j8/bbSGIesAvfiAeHlpyqJMHM636rIMGWNJ M7htbA9TX5kYn+XXSp4JGKbsE3Hv1g9FZeGF7RhS1y+dUeja/fCgXCwWHwkozHJT+/eB NOdQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FRTSsGab; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-190259-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-190259-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d75a77b69052e-43fb18b1de1si76371691cf.409.2024.05.27.01.48.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 May 2024 01:48:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-190259-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FRTSsGab; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-190259-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-190259-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id DF7AF1C21D07 for ; Mon, 27 May 2024 08:48:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9A71A13A405; Mon, 27 May 2024 08:46:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="FRTSsGab" Received: from mail-lj1-f182.google.com (mail-lj1-f182.google.com [209.85.208.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F2A9113A3E7 for ; Mon, 27 May 2024 08:46:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716799594; cv=none; b=NN1ZwIEMKoLPi4H1JfM49SRvQJP20iQYXOEhzognYyMsk1RCYdAsLmQ42l6AxUxMGdjsFw08yK53X7siUFUMW8RMrA0aOHznaOQTALs0Pjrm6adK5aP2yS+xdzOZJHhFQ1MLOtbONdrUPkZxaOFg7ym3GWdL/TkeZyFVv+UCkfE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716799594; c=relaxed/simple; bh=70rY50aseYI64Qm8+oXFaZPxdIOsmiHvyjmjaE2BkRU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=VhViwlFLDZP86kOBloCAiQwHVSBkIMNlndw1vfzoy2Ls5/K4kuOI9svMeWY76MldblRq1z5xzcw/zRVHU+UPDd4IxKMkM0Jc5tGLVM1xqvNoyXqsPqmYWiXYU8STDn1fKeDvIVG6psgYiCK/iRzan7skbSl+Pe041OO9Pq3BrY0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=FRTSsGab; arc=none smtp.client-ip=209.85.208.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-lj1-f182.google.com with SMTP id 38308e7fff4ca-2e95afec7e6so23404721fa.0 for ; Mon, 27 May 2024 01:46:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716799591; x=1717404391; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=TCW+HFtoeaierrg0K+2TVOUHq8VHzqfUi+kUPqpq30g=; b=FRTSsGabWb+ngqdHMp3yhgqdJ+Tl21ir+gQNAsEqVuVyFsGJijN33MIIbgmCIbDXiT bTeMQP4z7G7ZL5HY8hQl2dZfEgbb//4j4RsLFfrQ/qldFkC+B68X7O4ZTeCgabCs5FMs 8N/Pz0XISOfops40CHRO8kw4pJxmTrMMeKR9bRtBIm/bZAtVnAe3AJHP2WupjpmKev5B QsX9H48FOzteC4BvvZnboWZ/OZvWAv0VE0wOyMIg7T3r8FNK1CYL+rwe+5+MDesZVgQZ Tgl1NpfeUPMjZ+dZCwcsWb6IT2ib+9gdSQCyrFhT05Qn1Bh+nK9U1tfsAkv6KKBckf18 nlsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716799591; x=1717404391; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=TCW+HFtoeaierrg0K+2TVOUHq8VHzqfUi+kUPqpq30g=; b=LL8phIfpheLX71OZm9sxUdOJDj97IMG+kcqPptrIz3O0KZXyguHuFR4Jcbabe7jFfU HIxjA8uS/LMxOPMzq22MM9J7Tb6OS3e8ZYAQ3cubGSceEPCA1lbqlb4Zhkht9c/WKZAL PP9Z7Ha6/w3hUszK0eCztEc/tQ/OSwTxKpjbrHDs+6/r5S16VpGKcMm12GL7hWnUq86B TX+H4Jjl+5nhFde7qYoUF2OM40JAUVmFa4BkYKR8Xzmai+oy/eDdVCfSahQjNz1X0aof Mn63/jrt8enmuDCoELagzS+qdqOiUgatzSMy13rIjHeI3nYjYA2asxmOqSnHPYxcWPDh BV4A== X-Forwarded-Encrypted: i=1; AJvYcCUKgofvGsz5rjQdy8i4xKJ6h8M+A7pBTvViIovAatcQ3Jo2o0CsKE3jhr8TJYdTe7gna+zg8H7JSZB/Bmbl8RwqC1wB/PZqr+TZpY0h X-Gm-Message-State: AOJu0Yz5OwlTo7ZL7xY6lqfmPq5yUXwscsOykeKMA90RtkzUYIynb50y MkL97ZfGbzRX9xNB2mX9MN2C3GJAyyRoU864HZ+NShns9kC9lAkvVkHqzHTOBac= X-Received: by 2002:a2e:2c19:0:b0:2e2:3761:2ef5 with SMTP id 38308e7fff4ca-2e951b82fdbmr37512241fa.14.1716799591109; Mon, 27 May 2024 01:46:31 -0700 (PDT) Received: from eriador.lumag.spb.ru (dzdbxzyyyyyyyyyyyykxt-3.rev.dnainternet.fi. [2001:14ba:a0c3:3a00::227]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2e95be2126esm18474141fa.119.2024.05.27.01.46.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 May 2024 01:46:30 -0700 (PDT) Date: Mon, 27 May 2024 11:46:29 +0300 From: Dmitry Baryshkov To: Neil Armstrong Cc: Vinod Koul , Kishon Vijay Abraham I , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Bjorn Andersson , Konrad Dybcio , Krzysztof Kozlowski , linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 3/7] phy: qcom: qmp-combo: introduce QPHY_MODE Message-ID: References: <20240527-topic-sm8x50-upstream-phy-combo-typec-mux-v2-0-a03e68d7b8fc@linaro.org> <20240527-topic-sm8x50-upstream-phy-combo-typec-mux-v2-3-a03e68d7b8fc@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: <20240527-topic-sm8x50-upstream-phy-combo-typec-mux-v2-3-a03e68d7b8fc@linaro.org> On Mon, May 27, 2024 at 10:42:35AM +0200, 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 183cd9cd1884..788e4c05eaf2 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 */ > @@ -1503,6 +1509,7 @@ struct qmp_combo { > > struct mutex phy_mutex; > int init_count; > + enum qphy_mode init_mode; > > struct phy *usb_phy; > enum phy_mode mode; > @@ -2589,12 +2596,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: > + 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); > @@ -3603,6 +3631,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; > + I see that COMBO mode is backwards compatible with existing code. But shouldn't the USB-only be a default mode? > 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 > -- With best wishes Dmitry