Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp9176069rwl; Wed, 11 Jan 2023 02:25:43 -0800 (PST) X-Google-Smtp-Source: AMrXdXsLJ5IMOGnwTXYosbfBUdKkyJsOyT/hKEDkOPe/sVqKnqVWWXHZLx/axBOz+Aq9CuLvn6/i X-Received: by 2002:a17:906:36ce:b0:838:1b80:9a7a with SMTP id b14-20020a17090636ce00b008381b809a7amr59876227ejc.12.1673432743170; Wed, 11 Jan 2023 02:25:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673432743; cv=none; d=google.com; s=arc-20160816; b=TcjeQNQWlbxFGdkx7BM4XXrT+MaypS/IVA+H4T5JFS51n6MERPdIhE0F7TipAswwNa 356MzpHKDY0y6SGLhH/WO6JzMc91V/2HWjWFUlbV50V/vxuZkFbpufjEiMnt2z4Q62+d 6rkllonbf0SYdjGqY4XSyzPiIqK7iTgjFkoZuZf+YqXf49AGfIptO024I1slc0vvFkOP IEM3MlZvaX5d/nd/rDwgUiD87bJfCW+5Wsllo364DiSImj/H+RWw7OEwWrmKqqGQlrFJ bKEC8OnPnT+5o+QuSH2UFN78ILwOCbabVpFZL5IK8sgDjDpUkCRyY7fAoCw8C1KuQe3q wgCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=wX40k5OB2E/jml9pHWf0V47ULQTKciO1+Fdvt+AGygg=; b=OhIAbQInOS6Q9hlZAtFkYoCHmqiOuAAmmPfbJeBfIIETPi/XRt+ZlWoRMFbUd2DD4w k3AAySLIOghVwiKr+aKJh0xgi3aCVMAejzcfKS+3c2Jk5Q9lrjrGUXejVPuOUH76qtQF uBkX9frPBZIQ8+r5xlpUXEZhzh/7/budYQoQuNSdstYh+dtUL5usJf8Qs4kcEXanDbJU RF/ao1d4IcMJkU7osbcK+PpAZgsY3+uMHSCRxBrPITX26D4wDsPdSxeuoECjJl0uI9f/ 3CF6U5LiEvQ6TYQpAFkoMFPFv14UahZEAU7RrHFGNaf++ONnaTruUMVUC4mFFauVNOf4 TIwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BQoovrkz; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sa11-20020a1709076d0b00b007c841b8fa31si16170024ejc.629.2023.01.11.02.25.30; Wed, 11 Jan 2023 02:25:43 -0800 (PST) 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=BQoovrkz; 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 S238717AbjAKJ6K (ORCPT + 53 others); Wed, 11 Jan 2023 04:58:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238696AbjAKJ5M (ORCPT ); Wed, 11 Jan 2023 04:57:12 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E1542000 for ; Wed, 11 Jan 2023 01:54:54 -0800 (PST) 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 53B6FB81B79 for ; Wed, 11 Jan 2023 09:54:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 428EBC433D2; Wed, 11 Jan 2023 09:54:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673430892; bh=kbawuu+G4uhdhk6Z3iHZybE1MSwuvuLFahb8EbDh9VM=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=BQoovrkzqShYA5ElXnNFPZZMv8OCDbzkP7k+/fTO0DWODS9jAXrtliuh3qjaSkwpu 65apxuUgPGLr/gj7eW/qE0qAsCwasphkV//btWgaOOK8z3Uner+mpVXULd7Md+Pjet U7cu8oWMPawGFJAD/sJH9xWMwqJqZczd79EVKm7E9tianfU/cyl6Pf9YSjlG3Br0RE Ngqy4ejUdsJKC6JO1LQD3NxK6E7592v9u57Q97gEszAHVR3srbDEcGDQxiT3NMV1+t 3ToMATiJX9TQSauuDlN0+RginTu5NVmCryA37cBZtG6SQA4BzTAjMNNgqh5C17yW0R xXca0N8L9iwJg== Message-ID: Date: Wed, 11 Jan 2023 11:54:47 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: [PATCH V2 2/2] phy: ti: j721e-wiz: Add support to enable LN23 Type-C swap Content-Language: en-US To: Sinthu Raja , Vinod Koul , Ravi Gunasekaran , Siddharth Vadapalli Cc: Vignesh Raghavendra , linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org, Sinthu Raja References: <20230106071714.30562-1-sinthu.raja@ti.com> <20230106071714.30562-3-sinthu.raja@ti.com> From: Roger Quadros In-Reply-To: <20230106071714.30562-3-sinthu.raja@ti.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, 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 Hi Sinthu, On 06/01/2023 09:17, Sinthu Raja wrote: > From: Sinthu Raja > > The WIZ acts as a wrapper for SerDes and has Lanes 0 and 2 reserved > for USB for type-C lane swap if Lane 1 and Lane 3 are linked to the > USB PHY that is integrated into the SerDes IP. The WIZ control register > has to be configured to support this lane swap feature. > > The support for swapping lanes 2 and 3 is missing and therefore > add support to configure the control register to swap between > lanes 2 and 3 if PHY type is USB. > > Signed-off-by: Sinthu Raja > --- > > Changes in V2: > ============= > Address review comments: > - Update commit description. > - Rename enum variable name from wiz_lane_typec_swap_mode to wiz_typec_master_lane. > - Rename enumerators name specific to list of master lanes used for lane swapping. > - Add inline comments. > > V1: https://lore.kernel.org/lkml/20221213124854.3779-2-sinthu.raja@ti.com/T/#m5e2d1a15d647f5df9dd28ed2dedc4b0812d6466f > > drivers/phy/ti/phy-j721e-wiz.c | 33 ++++++++++++++++++++++++++++++--- > 1 file changed, 30 insertions(+), 3 deletions(-) > > diff --git a/drivers/phy/ti/phy-j721e-wiz.c b/drivers/phy/ti/phy-j721e-wiz.c > index 571f0ca18874..815e8124b94a 100644 > --- a/drivers/phy/ti/phy-j721e-wiz.c > +++ b/drivers/phy/ti/phy-j721e-wiz.c > @@ -58,6 +58,14 @@ enum wiz_lane_standard_mode { > LANE_MODE_GEN4, > }; > > +/* > + * List of master lanes used for lane swapping > + */ > +enum wiz_typec_master_lane { > + LANE0 = 0, > + LANE2 = 2, > +}; > + > enum wiz_refclk_mux_sel { > PLL0_REFCLK, > PLL1_REFCLK, > @@ -194,6 +202,9 @@ static const struct reg_field p_mac_div_sel1[WIZ_MAX_LANES] = { > static const struct reg_field typec_ln10_swap = > REG_FIELD(WIZ_SERDES_TYPEC, 30, 30); > > +static const struct reg_field typec_ln23_swap = > + REG_FIELD(WIZ_SERDES_TYPEC, 31, 31); > + > struct wiz_clk_mux { > struct clk_hw hw; > struct regmap_field *field; > @@ -367,6 +378,7 @@ struct wiz { > struct regmap_field *mux_sel_field[WIZ_MUX_NUM_CLOCKS]; > struct regmap_field *div_sel_field[WIZ_DIV_NUM_CLOCKS_16G]; > struct regmap_field *typec_ln10_swap; > + struct regmap_field *typec_ln23_swap; > struct regmap_field *sup_legacy_clk_override; > > struct device *dev; > @@ -676,6 +688,13 @@ static int wiz_regfield_init(struct wiz *wiz) > return PTR_ERR(wiz->typec_ln10_swap); > } > > + wiz->typec_ln23_swap = devm_regmap_field_alloc(dev, regmap, > + typec_ln23_swap); > + if (IS_ERR(wiz->typec_ln23_swap)) { > + dev_err(dev, "LN23_SWAP reg field init failed\n"); > + return PTR_ERR(wiz->typec_ln23_swap); > + } > + > wiz->phy_en_refclk = devm_regmap_field_alloc(dev, regmap, phy_en_refclk); > if (IS_ERR(wiz->phy_en_refclk)) { > dev_err(dev, "PHY_EN_REFCLK reg field init failed\n"); > @@ -1254,9 +1273,17 @@ static int wiz_phy_reset_deassert(struct reset_controller_dev *rcdev, > int i; > Don't you have to update the below comment you added in patch 1 to mention about LN23 as well? + /* if no typec-dir gpio was specified and PHY type is + * USB3 with master lane number is '0', set LN10 SWAP + * bit to '1' + */ > for (i = 0; i < num_lanes; i++) { > - if ((wiz->lane_phy_type[i] == PHY_TYPE_USB3) > - && wiz->master_lane_num[i] == 0) { > - regmap_field_write(wiz->typec_ln10_swap, 1); > + if (wiz->lane_phy_type[i] == PHY_TYPE_USB3) { > + switch (wiz->master_lane_num[i]) { > + case LANE0: > + regmap_field_write(wiz->typec_ln10_swap, 1); > + break; > + case LANE2: > + regmap_field_write(wiz->typec_ln23_swap, 1); > + break; > + default: > + break; > + } > } > } > } Otherwise looks good. cheers, -roger