From patchwork Fri Aug 7 11:45:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Swapnil Jakhade X-Patchwork-Id: 254018 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 39ACEC433DF for ; Fri, 7 Aug 2020 11:46:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0D5AC2075D for ; Fri, 7 Aug 2020 11:46:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=cadence.com header.i=@cadence.com header.b="sbomRFhu"; dkim=pass (1024-bit key) header.d=cadence.com header.i=@cadence.com header.b="iLOIwr4d" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728385AbgHGLqe (ORCPT ); Fri, 7 Aug 2020 07:46:34 -0400 Received: from mx0b-0014ca01.pphosted.com ([208.86.201.193]:55270 "EHLO mx0a-0014ca01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726338AbgHGLqa (ORCPT ); Fri, 7 Aug 2020 07:46:30 -0400 Received: from pps.filterd (m0042333.ppops.net [127.0.0.1]) by mx0b-0014ca01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 077BjPvO031439; Fri, 7 Aug 2020 04:46:17 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cadence.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=proofpoint; bh=5v8KvxhJ189cJlCi+3m1BK5hJ3AGtgkJTawfCwl+Wm0=; b=sbomRFhujlbB+2KdcK7aIH6j5wa/50lMOyjVdWQLe4nrQmNGjJrOr3QnuxmC2hrATyx6 +Oop86FVa7Vbd3MWx7BOVIZ/qLAUTMqYqL6dstb+D4QwgnVr6Dl8cn/96WBqoAU1wCGe il0Cwk+xTDRwddZ1aPIG2u8H7Ex8B/QA3OudobvRuC9DMrkcqxfIRytv++CoPLENmRF2 AaDQXWz+HBPUiOlq9eFNksrD8oXJL4gOs7fRHQ7em/I2oRbmUERZswrJYKqdit8ECkSi eo66RkMzFUVC8R2fp+/fXrpUvfJ1fojiCkW36M7+g2GU/i83W6LspUsWolTkPU+e/dnb IA== Received: from nam02-cy1-obe.outbound.protection.outlook.com (mail-cys01nam02lp2057.outbound.protection.outlook.com [104.47.37.57]) by mx0b-0014ca01.pphosted.com with ESMTP id 32n8gy61cg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 07 Aug 2020 04:46:16 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ggk9sVn0MvsKSmrsLvYQAdhRQJCrRHMygERNnJVcKH6S+Sf2mI1Qtv81UjzwXZgcmofpf82Hul+ucwLM4pcnKdrovLs4y3VM5Xo1mUOtCJ1/EHs0VaRrgAk57y3G6ntZpnmNl02xtHrXQFVZqjVvJ4a55ioNWg8TJmfaHhMM0X7DEKDKA+KzNzhjS8cvYm21S3P7qWnDMYwg4gewDl8qVmjMPj1CuuzxLNE+j7BcPaZNKUk/iqeuq+wzbfvC6fhFCfWDN7yRwCMiiJ+cCRtik9shqQnRbSwEsyRqn/1dlSlB+x188wqr+YbrVgVWlOaS2ePY2C5Z9VGlK5dJzdINKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5v8KvxhJ189cJlCi+3m1BK5hJ3AGtgkJTawfCwl+Wm0=; b=hK7DPCx78S4cvx+N1JKRzpy7IHwZ7zrbFEoDMP/pBUSFrxL0sZLfzkz4yEYqL/8w/y4L3lP/l7V2AJXCiwjxCRz9L5XpMh3tPMJF/C4VUoszUsDKnpseRJHfm5Okiz2ny6ad/Nw/8/5NP+vDTt8PjMLkZVNaSWAGOZ+JvjKvDh18LOSNt4rid4ubIQQ+s2ckGIK/bT6A5f+o+x6ME26a4ZUS18qQ+kNV+Xz6VlA8UATkEvvpeLdpHH0vEaY1p1T2157BL9VIfGM3QWk8FXIyxauUP8BtTJfRXrGhPB6lgZ9b4y+mhi9iU40vlVdAOWbh94u2fVUtfVkuTbmW9785gQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 199.43.4.23) smtp.rcpttodomain=kernel.org smtp.mailfrom=cadence.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=cadence.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cadence.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5v8KvxhJ189cJlCi+3m1BK5hJ3AGtgkJTawfCwl+Wm0=; b=iLOIwr4drb/p5rGltga4Vi9IzI0nHoj1sCxx0u6Rc7AcXzfCwHpI+a4E1anQePKGLAC3uU8UUBTB5I2teBRs/yczzTq6Rm1EIEjiJzJ5X7NdjF7Fh+7l4gBy3yw6OFCj5+PYJ2ON9Nsv/aqVNpotN7Jtrwq+lbpIykT2MWxBKEY= Received: from DM5PR06CA0028.namprd06.prod.outlook.com (2603:10b6:3:5d::14) by MWHPR07MB3102.namprd07.prod.outlook.com (2603:10b6:300:de::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.19; Fri, 7 Aug 2020 11:46:14 +0000 Received: from DM6NAM12FT020.eop-nam12.prod.protection.outlook.com (2603:10b6:3:5d:cafe::35) by DM5PR06CA0028.outlook.office365.com (2603:10b6:3:5d::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.19 via Frontend Transport; Fri, 7 Aug 2020 11:46:14 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 199.43.4.23) smtp.mailfrom=cadence.com; kernel.org; dkim=none (message not signed) header.d=none; kernel.org; dmarc=pass action=none header.from=cadence.com; Received-SPF: Pass (protection.outlook.com: domain of cadence.com designates 199.43.4.23 as permitted sender) receiver=protection.outlook.com; client-ip=199.43.4.23; helo=rmmaillnx1.cadence.com; Received: from rmmaillnx1.cadence.com (199.43.4.23) by DM6NAM12FT020.mail.protection.outlook.com (10.13.179.221) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.10 via Frontend Transport; Fri, 7 Aug 2020 11:46:13 +0000 Received: from maileu3.global.cadence.com (maileu3.cadence.com [10.160.88.99]) by rmmaillnx1.cadence.com (8.14.4/8.14.4) with ESMTP id 077Bk9P5029785 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=OK); Fri, 7 Aug 2020 07:46:11 -0400 X-CrossPremisesHeadersFilteredBySendConnector: maileu3.global.cadence.com Received: from maileu3.global.cadence.com (10.160.88.99) by maileu3.global.cadence.com (10.160.88.99) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Fri, 7 Aug 2020 13:46:08 +0200 Received: from vleu-orange.cadence.com (10.160.88.83) by maileu3.global.cadence.com (10.160.88.99) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Fri, 7 Aug 2020 13:46:08 +0200 Received: from vleu-orange.cadence.com (localhost.localdomain [127.0.0.1]) by vleu-orange.cadence.com (8.14.4/8.14.4) with ESMTP id 077Bk8I6000828; Fri, 7 Aug 2020 13:46:08 +0200 Received: (from sjakhade@localhost) by vleu-orange.cadence.com (8.14.4/8.14.4/Submit) id 077Bk8rv000827; Fri, 7 Aug 2020 13:46:08 +0200 From: Swapnil Jakhade To: , , , , , CC: , , , , , Subject: [PATCH v1 01/13] phy: cadence-torrent: Add single link PCIe support Date: Fri, 7 Aug 2020 13:45:55 +0200 Message-ID: <1596800767-784-2-git-send-email-sjakhade@cadence.com> X-Mailer: git-send-email 2.4.5 In-Reply-To: <1596800767-784-1-git-send-email-sjakhade@cadence.com> References: <1596800767-784-1-git-send-email-sjakhade@cadence.com> MIME-Version: 1.0 X-OrganizationHeadersPreserved: maileu3.global.cadence.com X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: db8a614a-153e-476e-06fd-08d83ac77c9d X-MS-TrafficTypeDiagnostic: MWHPR07MB3102: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:74; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: icahYpOqbqr4cHEEKOI1OjV9yfKc9KG3PcXZFYSmQ/YLRJk/bbEypUDIAO15GWpNanvZ1aBoq1JnV4vnjMcAzMMJA7eh13oa/Y2e/1TsuMWa5tHdpQiGkOGiupoTloIkmSgOjUhf8sSNbUQmUZgkyqEqfzJ05zpwXWpbGu/9dpe9QUeJ0iMBxRsjmDfE2xCM4Afp0r292K3CuXoVJevRkEW1lDt7LNtrv3HoHnDN5SJGTdqr+TkqjLuCoMFbXLjv2XOqfBZLQ6ljNzbJoIsf5OiNhN1YuuX2XOot5iRFHRLFJUMNBZh3TN48uHdC1Xsz8KNRJWhKgne0hoBMq7OA1SfTq9yK61HTlPMwwCarBk27r45bRDbG0Xfh7z+VBDFm7eHFwbWNg4vIvrANV0GO7OOS3HjZ1AdQYntJ6UNtWp4= X-Forefront-Antispam-Report: CIP:199.43.4.23; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:rmmaillnx1.cadence.com; PTR:InfoDomainNonexistent; CAT:NONE; SFTY:; SFS:(4636009)(396003)(39860400002)(376002)(136003)(346002)(36092001)(46966005)(356005)(6666004)(81166007)(5660300002)(426003)(82310400002)(54906003)(82740400003)(4326008)(47076004)(26005)(42186006)(83380400001)(8676002)(70586007)(186003)(8936002)(2616005)(30864003)(36906005)(316002)(2906002)(336012)(86362001)(70206006)(110136005)(36756003)(478600001); DIR:OUT; SFP:1101; X-OriginatorOrg: cadence.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2020 11:46:13.5514 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: db8a614a-153e-476e-06fd-08d83ac77c9d X-MS-Exchange-CrossTenant-Id: d36035c5-6ce6-4662-a3dc-e762e61ae4c9 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=d36035c5-6ce6-4662-a3dc-e762e61ae4c9; Ip=[199.43.4.23]; Helo=[rmmaillnx1.cadence.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM12FT020.eop-nam12.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR07MB3102 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-08-07_08:2020-08-06,2020-08-07 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_check_notspam policy=outbound_check score=0 malwarescore=0 phishscore=0 mlxlogscore=999 impostorscore=0 priorityscore=1501 bulkscore=0 suspectscore=0 spamscore=0 mlxscore=0 clxscore=1011 adultscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2008070085 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Add single link PCIe register sequences in Torrent PHY driver. Also, add support for getting SSC type from DT. Signed-off-by: Swapnil Jakhade --- drivers/phy/cadence/phy-cadence-torrent.c | 296 +++++++++++++++++++--- 1 file changed, 266 insertions(+), 30 deletions(-) diff --git a/drivers/phy/cadence/phy-cadence-torrent.c b/drivers/phy/cadence/phy-cadence-torrent.c index 82f48ca5dcc6..a703fcb355a8 100644 --- a/drivers/phy/cadence/phy-cadence-torrent.c +++ b/drivers/phy/cadence/phy-cadence-torrent.c @@ -28,6 +28,9 @@ #define MAX_NUM_LANES 4 #define DEFAULT_MAX_BIT_RATE 8100 /* in Mbps */ +#define NUM_SSC_MODE 3 +#define NUM_PHY_TYPE 2 + #define POLL_TIMEOUT_US 5000 #define TORRENT_COMMON_CDB_OFFSET 0x0 @@ -98,6 +101,14 @@ #define CMN_PLL0_LOCK_REFCNT_START 0x009CU #define CMN_PLL0_LOCK_PLLCNT_START 0x009EU #define CMN_PLL0_LOCK_PLLCNT_THR 0x009FU +#define CMN_PLL0_INTDIV_M1 0x00A0U +#define CMN_PLL0_FRACDIVH_M1 0x00A2U +#define CMN_PLL0_HIGH_THR_M1 0x00A3U +#define CMN_PLL0_DSM_DIAG_M1 0x00A4U +#define CMN_PLL0_SS_CTRL1_M1 0x00A8U +#define CMN_PLL0_SS_CTRL2_M1 0x00A9U +#define CMN_PLL0_SS_CTRL3_M1 0x00AAU +#define CMN_PLL0_SS_CTRL4_M1 0x00ABU #define CMN_PLL1_VCOCAL_TCTRL 0x00C2U #define CMN_PLL1_VCOCAL_INIT_TMR 0x00C4U #define CMN_PLL1_VCOCAL_ITER_TMR 0x00C5U @@ -130,8 +141,10 @@ #define CMN_PDIAG_PLL0_CP_PADJ_M0 0x01A4U #define CMN_PDIAG_PLL0_CP_IADJ_M0 0x01A5U #define CMN_PDIAG_PLL0_FILT_PADJ_M0 0x01A6U +#define CMN_PDIAG_PLL0_CTRL_M1 0x01B0U #define CMN_PDIAG_PLL0_CP_PADJ_M1 0x01B4U #define CMN_PDIAG_PLL0_CP_IADJ_M1 0x01B5U +#define CMN_PDIAG_PLL0_FILT_PADJ_M1 0x01B6U #define CMN_PDIAG_PLL1_CTRL_M0 0x01C0U #define CMN_PDIAG_PLL1_CLK_SEL_M0 0x01C1U #define CMN_PDIAG_PLL1_CP_PADJ_M0 0x01C4U @@ -162,6 +175,9 @@ #define RX_REE_GCSM1_CTRL 0x0108U #define RX_REE_GCSM2_CTRL 0x0110U #define RX_REE_PERGCSM_CTRL 0x0118U +#define RX_REE_TAP1_CLIP 0x0171U +#define RX_REE_TAP2TON_CLIP 0x0172U +#define RX_DIAG_ACYA 0x01FFU /* PHY PCS common registers */ #define PHY_PLL_CFG 0x000EU @@ -182,12 +198,24 @@ static const struct reg_field phy_pma_pll_raw_ctrl = static const struct reg_field phy_reset_ctrl = REG_FIELD(PHY_RESET, 8, 8); +enum cdns_torrent_phy_type { + TYPE_DP, + TYPE_PCIE +}; + +enum cdns_torrent_ssc_mode { + NO_SSC, + EXTERNAL_SSC, + INTERNAL_SSC +}; + struct cdns_torrent_inst { struct phy *phy; u32 mlane; - u32 phy_type; + enum cdns_torrent_phy_type phy_type; u32 num_lanes; struct reset_control *lnk_rst; + enum cdns_torrent_ssc_mode ssc_mode; }; struct cdns_torrent_phy { @@ -221,8 +249,9 @@ enum phy_powerstate { POWERSTATE_A3 = 3, }; +static int cdns_torrent_phy_init(struct phy *phy); +static int cdns_torrent_phy_exit(struct phy *phy); static int cdns_torrent_dp_init(struct phy *phy); -static int cdns_torrent_dp_exit(struct phy *phy); static int cdns_torrent_dp_run(struct cdns_torrent_phy *cdns_phy, u32 num_lanes); static @@ -252,17 +281,30 @@ static int cdns_torrent_phy_on(struct phy *phy); static int cdns_torrent_phy_off(struct phy *phy); static const struct phy_ops cdns_torrent_phy_ops = { - .init = cdns_torrent_dp_init, - .exit = cdns_torrent_dp_exit, + .init = cdns_torrent_phy_init, + .exit = cdns_torrent_phy_exit, .configure = cdns_torrent_dp_configure, .power_on = cdns_torrent_phy_on, .power_off = cdns_torrent_phy_off, .owner = THIS_MODULE, }; +struct cdns_reg_pairs { + u32 val; + u32 off; +}; + +struct cdns_torrent_vals { + struct cdns_reg_pairs *reg_pairs; + u32 num_regs; +}; + struct cdns_torrent_data { - u8 block_offset_shift; - u8 reg_offset_shift; + u8 block_offset_shift; + u8 reg_offset_shift; + struct cdns_torrent_vals *cmn_vals[NUM_PHY_TYPE][NUM_SSC_MODE]; + struct cdns_torrent_vals *tx_ln_vals[NUM_PHY_TYPE][NUM_SSC_MODE]; + struct cdns_torrent_vals *rx_ln_vals[NUM_PHY_TYPE][NUM_SSC_MODE]; }; struct cdns_regmap_cdb_context { @@ -846,19 +888,6 @@ static int cdns_torrent_dp_init(struct phy *phy) struct cdns_torrent_phy *cdns_phy = dev_get_drvdata(phy->dev.parent); struct regmap *regmap = cdns_phy->regmap_dptx_phy_reg; - ret = clk_prepare_enable(cdns_phy->clk); - if (ret) { - dev_err(cdns_phy->dev, "Failed to prepare ref clock\n"); - return ret; - } - - cdns_phy->ref_clk_rate = clk_get_rate(cdns_phy->clk); - if (!(cdns_phy->ref_clk_rate)) { - dev_err(cdns_phy->dev, "Failed to get ref clock rate\n"); - clk_disable_unprepare(cdns_phy->clk); - return -EINVAL; - } - switch (cdns_phy->ref_clk_rate) { case REF_CLK_19_2MHz: case REF_CLK_25MHz: @@ -918,7 +947,7 @@ static int cdns_torrent_dp_init(struct phy *phy) return ret; } -static int cdns_torrent_dp_exit(struct phy *phy) +static int cdns_torrent_phy_exit(struct phy *phy) { struct cdns_torrent_phy *cdns_phy = dev_get_drvdata(phy->dev.parent); @@ -1725,6 +1754,74 @@ static int cdns_torrent_regmap_init(struct cdns_torrent_phy *cdns_phy) return 0; } +static int cdns_torrent_phy_init(struct phy *phy) +{ + struct cdns_torrent_phy *cdns_phy = dev_get_drvdata(phy->dev.parent); + struct cdns_torrent_vals *cmn_vals, *tx_ln_vals, *rx_ln_vals; + struct cdns_torrent_inst *inst = phy_get_drvdata(phy); + enum cdns_torrent_phy_type phy_type = inst->phy_type; + enum cdns_torrent_ssc_mode ssc = inst->ssc_mode; + struct cdns_reg_pairs *reg_pairs; + struct regmap *regmap; + u32 num_regs; + int ret, i, j; + + ret = clk_prepare_enable(cdns_phy->clk); + if (ret) { + dev_err(cdns_phy->dev, "Failed to prepare ref clock\n"); + return ret; + } + + cdns_phy->ref_clk_rate = clk_get_rate(cdns_phy->clk); + if (!(cdns_phy->ref_clk_rate)) { + dev_err(cdns_phy->dev, "Failed to get ref clock rate\n"); + clk_disable_unprepare(cdns_phy->clk); + return -EINVAL; + } + + if (phy_type == TYPE_DP) + return cdns_torrent_dp_init(phy); + + /* PMA common registers configurations */ + cmn_vals = cdns_phy->init_data->cmn_vals[phy_type][ssc]; + if (cmn_vals) { + reg_pairs = cmn_vals->reg_pairs; + num_regs = cmn_vals->num_regs; + regmap = cdns_phy->regmap_common_cdb; + for (i = 0; i < num_regs; i++) + regmap_write(regmap, reg_pairs[i].off, + reg_pairs[i].val); + } + + /* PMA TX lane registers configurations */ + tx_ln_vals = cdns_phy->init_data->tx_ln_vals[phy_type][ssc]; + if (tx_ln_vals) { + reg_pairs = tx_ln_vals->reg_pairs; + num_regs = tx_ln_vals->num_regs; + for (i = 0; i < inst->num_lanes; i++) { + regmap = cdns_phy->regmap_tx_lane_cdb[i + inst->mlane]; + for (j = 0; j < num_regs; j++) + regmap_write(regmap, reg_pairs[j].off, + reg_pairs[j].val); + } + } + + /* PMA RX lane registers configurations */ + rx_ln_vals = cdns_phy->init_data->rx_ln_vals[phy_type][ssc]; + if (rx_ln_vals) { + reg_pairs = rx_ln_vals->reg_pairs; + num_regs = rx_ln_vals->num_regs; + for (i = 0; i < inst->num_lanes; i++) { + regmap = cdns_phy->regmap_rx_lane_cdb[i + inst->mlane]; + for (j = 0; j < num_regs; j++) + regmap_write(regmap, reg_pairs[j].off, + reg_pairs[j].val); + } + } + + return 0; +} + static int cdns_torrent_phy_probe(struct platform_device *pdev) { struct cdns_torrent_phy *cdns_phy; @@ -1736,6 +1833,7 @@ static int cdns_torrent_phy_probe(struct platform_device *pdev) int ret, subnodes, node = 0, i; u32 total_num_lanes = 0; u8 init_dp_regmap = 0; + u32 phy_type; /* Get init data for this PHY */ data = of_device_get_match_data(dev); @@ -1801,14 +1899,26 @@ static int cdns_torrent_phy_probe(struct platform_device *pdev) goto put_child; } - if (of_property_read_u32(child, "cdns,phy-type", - &cdns_phy->phys[node].phy_type)) { + if (of_property_read_u32(child, "cdns,phy-type", &phy_type)) { dev_err(dev, "%s: No \"cdns,phy-type\"-property.\n", child->full_name); ret = -EINVAL; goto put_child; } + switch (phy_type) { + case PHY_TYPE_PCIE: + cdns_phy->phys[node].phy_type = TYPE_PCIE; + break; + case PHY_TYPE_DP: + cdns_phy->phys[node].phy_type = TYPE_DP; + break; + default: + dev_err(dev, "Unsupported protocol\n"); + ret = -EINVAL; + goto put_child; + } + if (of_property_read_u32(child, "cdns,num-lanes", &cdns_phy->phys[node].num_lanes)) { dev_err(dev, "%s: No \"cdns,num-lanes\"-property.\n", @@ -1819,7 +1929,18 @@ static int cdns_torrent_phy_probe(struct platform_device *pdev) total_num_lanes += cdns_phy->phys[node].num_lanes; - if (cdns_phy->phys[node].phy_type == PHY_TYPE_DP) { + /* Get SSC mode */ + cdns_phy->phys[node].ssc_mode = NO_SSC; + of_property_read_u32(child, "cdns,ssc-mode", + &cdns_phy->phys[node].ssc_mode); + + gphy = devm_phy_create(dev, child, &cdns_torrent_phy_ops); + if (IS_ERR(gphy)) { + ret = PTR_ERR(gphy); + goto put_child; + } + + if (cdns_phy->phys[node].phy_type == TYPE_DP) { switch (cdns_phy->phys[node].num_lanes) { case 1: case 2: @@ -1862,13 +1983,6 @@ static int cdns_torrent_phy_probe(struct platform_device *pdev) goto put_child; } - gphy = devm_phy_create(dev, child, - &cdns_torrent_phy_ops); - if (IS_ERR(gphy)) { - ret = PTR_ERR(gphy); - goto put_child; - } - if (!init_dp_regmap) { ret = cdns_torrent_dp_regmap_init(cdns_phy); if (ret) @@ -1892,6 +2006,7 @@ static int cdns_torrent_phy_probe(struct platform_device *pdev) phy_set_attrs(gphy, torrent_attr); } + cdns_phy->phys[node].phy = gphy; phy_set_drvdata(gphy, &cdns_phy->phys[node]); @@ -1935,14 +2050,135 @@ static int cdns_torrent_phy_remove(struct platform_device *pdev) return 0; } +/* Single link PCIe, 100 MHz Ref clk, internal SSC */ +static struct cdns_reg_pairs sl_pcie_100_int_ssc_cmn_regs[] = { + {0x0004, CMN_PLL0_DSM_DIAG_M0}, + {0x0004, CMN_PLL0_DSM_DIAG_M1}, + {0x0004, CMN_PLL1_DSM_DIAG_M0}, + {0x0509, CMN_PDIAG_PLL0_CP_PADJ_M0}, + {0x0509, CMN_PDIAG_PLL0_CP_PADJ_M1}, + {0x0509, CMN_PDIAG_PLL1_CP_PADJ_M0}, + {0x0F00, CMN_PDIAG_PLL0_CP_IADJ_M0}, + {0x0F00, CMN_PDIAG_PLL0_CP_IADJ_M1}, + {0x0F00, CMN_PDIAG_PLL1_CP_IADJ_M0}, + {0x0F08, CMN_PDIAG_PLL0_FILT_PADJ_M0}, + {0x0F08, CMN_PDIAG_PLL0_FILT_PADJ_M1}, + {0x0F08, CMN_PDIAG_PLL1_FILT_PADJ_M0}, + {0x0064, CMN_PLL0_INTDIV_M0}, + {0x0050, CMN_PLL0_INTDIV_M1}, + {0x0050, CMN_PLL1_INTDIV_M0}, + {0x0002, CMN_PLL0_FRACDIVH_M0}, + {0x0002, CMN_PLL0_FRACDIVH_M1}, + {0x0002, CMN_PLL1_FRACDIVH_M0}, + {0x0044, CMN_PLL0_HIGH_THR_M0}, + {0x0036, CMN_PLL0_HIGH_THR_M1}, + {0x0036, CMN_PLL1_HIGH_THR_M0}, + {0x0002, CMN_PDIAG_PLL0_CTRL_M0}, + {0x0002, CMN_PDIAG_PLL0_CTRL_M1}, + {0x0002, CMN_PDIAG_PLL1_CTRL_M0}, + {0x0001, CMN_PLL0_SS_CTRL1_M0}, + {0x0001, CMN_PLL0_SS_CTRL1_M1}, + {0x0001, CMN_PLL1_SS_CTRL1_M0}, + {0x011B, CMN_PLL0_SS_CTRL2_M0}, + {0x011B, CMN_PLL0_SS_CTRL2_M1}, + {0x011B, CMN_PLL1_SS_CTRL2_M0}, + {0x006E, CMN_PLL0_SS_CTRL3_M0}, + {0x0058, CMN_PLL0_SS_CTRL3_M1}, + {0x0058, CMN_PLL1_SS_CTRL3_M0}, + {0x000E, CMN_PLL0_SS_CTRL4_M0}, + {0x0012, CMN_PLL0_SS_CTRL4_M1}, + {0x0012, CMN_PLL1_SS_CTRL4_M0}, + {0x0C5E, CMN_PLL0_VCOCAL_REFTIM_START}, + {0x0C5E, CMN_PLL1_VCOCAL_REFTIM_START}, + {0x0C56, CMN_PLL0_VCOCAL_PLLCNT_START}, + {0x0C56, CMN_PLL1_VCOCAL_PLLCNT_START}, + {0x0003, CMN_PLL0_VCOCAL_TCTRL}, + {0x0003, CMN_PLL1_VCOCAL_TCTRL}, + {0x00C7, CMN_PLL0_LOCK_REFCNT_START}, + {0x00C7, CMN_PLL1_LOCK_REFCNT_START}, + {0x00C7, CMN_PLL0_LOCK_PLLCNT_START}, + {0x00C7, CMN_PLL1_LOCK_PLLCNT_START}, + {0x0005, CMN_PLL0_LOCK_PLLCNT_THR}, + {0x0005, CMN_PLL1_LOCK_PLLCNT_THR} +}; + +static struct cdns_torrent_vals sl_pcie_100_int_ssc_cmn_vals = { + .reg_pairs = sl_pcie_100_int_ssc_cmn_regs, + .num_regs = ARRAY_SIZE(sl_pcie_100_int_ssc_cmn_regs), +}; + +/* PCIe, 100 MHz Ref clk, no SSC & external SSC */ +static struct cdns_reg_pairs pcie_100_ext_no_ssc_cmn_regs[] = { + {0x0003, CMN_PLL0_VCOCAL_TCTRL}, + {0x0003, CMN_PLL1_VCOCAL_TCTRL} +}; + +static struct cdns_reg_pairs pcie_100_ext_no_ssc_rx_ln_regs[] = { + {0x0019, RX_REE_TAP1_CLIP}, + {0x0019, RX_REE_TAP2TON_CLIP}, + {0x0001, RX_DIAG_ACYA} +}; + +static struct cdns_torrent_vals pcie_100_no_ssc_cmn_vals = { + .reg_pairs = pcie_100_ext_no_ssc_cmn_regs, + .num_regs = ARRAY_SIZE(pcie_100_ext_no_ssc_cmn_regs), +}; + +static struct cdns_torrent_vals pcie_100_no_ssc_rx_ln_vals = { + .reg_pairs = pcie_100_ext_no_ssc_rx_ln_regs, + .num_regs = ARRAY_SIZE(pcie_100_ext_no_ssc_rx_ln_regs), +}; + static const struct cdns_torrent_data cdns_map_torrent = { .block_offset_shift = 0x2, .reg_offset_shift = 0x2, + .cmn_vals = { + [TYPE_PCIE] = { + [NO_SSC] = &pcie_100_no_ssc_cmn_vals, + [EXTERNAL_SSC] = &pcie_100_no_ssc_cmn_vals, + [INTERNAL_SSC] = &sl_pcie_100_int_ssc_cmn_vals, + }, + }, + .tx_ln_vals = { + [TYPE_PCIE] = { + [NO_SSC] = NULL, + [EXTERNAL_SSC] = NULL, + [INTERNAL_SSC] = NULL, + }, + }, + .rx_ln_vals = { + [TYPE_PCIE] = { + [NO_SSC] = &pcie_100_no_ssc_rx_ln_vals, + [EXTERNAL_SSC] = &pcie_100_no_ssc_rx_ln_vals, + [INTERNAL_SSC] = &pcie_100_no_ssc_rx_ln_vals, + }, + }, }; static const struct cdns_torrent_data ti_j721e_map_torrent = { .block_offset_shift = 0x0, .reg_offset_shift = 0x1, + .cmn_vals = { + [TYPE_PCIE] = { + [NO_SSC] = &pcie_100_no_ssc_cmn_vals, + [EXTERNAL_SSC] = &pcie_100_no_ssc_cmn_vals, + [INTERNAL_SSC] = &sl_pcie_100_int_ssc_cmn_vals, + }, + }, + .tx_ln_vals = { + [TYPE_PCIE] = { + [NO_SSC] = NULL, + [EXTERNAL_SSC] = NULL, + [INTERNAL_SSC] = NULL, + }, + }, + .rx_ln_vals = { + [TYPE_PCIE] = { + [NO_SSC] = &pcie_100_no_ssc_rx_ln_vals, + [EXTERNAL_SSC] = &pcie_100_no_ssc_rx_ln_vals, + [INTERNAL_SSC] = &pcie_100_no_ssc_rx_ln_vals, + }, + }, }; static const struct of_device_id cdns_torrent_phy_of_match[] = { From patchwork Fri Aug 7 11:45:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Swapnil Jakhade X-Patchwork-Id: 254017 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D7257C433E0 for ; Fri, 7 Aug 2020 11:46:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B5E7822D0B for ; Fri, 7 Aug 2020 11:46:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=cadence.com header.i=@cadence.com header.b="SJmoXo4t"; dkim=pass (1024-bit key) header.d=cadence.com header.i=@cadence.com header.b="4wBZoAZk" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728400AbgHGLqg (ORCPT ); Fri, 7 Aug 2020 07:46:36 -0400 Received: from mx0a-0014ca01.pphosted.com ([208.84.65.235]:9000 "EHLO mx0a-0014ca01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726466AbgHGLq3 (ORCPT ); Fri, 7 Aug 2020 07:46:29 -0400 Received: from pps.filterd (m0042385.ppops.net [127.0.0.1]) by mx0a-0014ca01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 077BhO1U011150; Fri, 7 Aug 2020 04:46:19 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cadence.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=proofpoint; bh=IisfoUh2UY4asdzSZ/pyaVfg4dS3qDinUXZkK781fas=; b=SJmoXo4tFYlx6ahGX2dZthnW7h5KhP7HlMRdT6bx6iZUO7qKuerBZV8lOpSNIs7jj36X 25Z5gmyqkpF47/QOMwmztJifPnVHMIyW2zS5yimT/abhtoM/iywCty4yhGF7HbFxyb3X kIUa6dAvtHJtEzZb8i76EYT82OCZm9boe+87mviGAhaJHjAybGI5Tz85mqLIelIpQpgR IcDvt8d8VUbO3qpD4OKkodJddndI4gpQ+NpnZsaTJYsrK4H0g7e2Yf2niVQrutS7BUSz B4P9tGWVHRElSt7mfScdbznkf70MaHqArHDEj6HAzhp+barEuTQmWNQvMloesk5esXy5 Iw== Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2171.outbound.protection.outlook.com [104.47.56.171]) by mx0a-0014ca01.pphosted.com with ESMTP id 32nme0mc3a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 07 Aug 2020 04:46:19 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DYvN5EYp59UZY/kyUZEfAQTATXgM+5G6b3j53IOJIW9PWqFV6u/PxsIZnFUupOY/+n65IlDiHRFoB2bcRKea5IvT/Y9nLz3JyaJw0ezU7gC9tPDHBN/863QOwRNyMck//m8ZxSe8j+xCDjI3EPTRmZdhZV+0itFrSoAUZcCloH/j1f7EZxbSgA9X3cQASnQ6uK6sLzurz1K78xMcMG2a34sTrePLydm2EIF/sWeF1IXXzZY5unDw50Cr88RmuVzLhuQTJpSilVNqo2INe8SEmpsD/JpviOqJo5tUz/x1JyrvhLIpSlPXsj3tcL/3x5w79wGvAQIqQPLDlceEvzteeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=IisfoUh2UY4asdzSZ/pyaVfg4dS3qDinUXZkK781fas=; b=DOqfWTRuVFBV4UhdKWlfJDJoJj6f7HqnZm1lQ1vJPYtZc+AWJys20Q1LpO4ilbOhPq9CYz2aUF98LmA1yjArhFSiT10HjV5uQeF46JVCwoqKgNkFD4HkjoKjl98jj9IuzcXtEUkj0//O7tgZdMhCFXs+4aYh7at1zxNJ6lfxo6pW3Omg2WtTot1KTJozg+0jLNa0sUICPRr9xA0AFZQzhy4DcDMdk7U/RHDAYrNn0X/zy+oJt2b1Z08T3RVBtFHJTRuQjbtFgDdAK2ZHRTU6NPpvawD+U0m8FOZSR71K9yqK4Id4TxOWY9Zmddk1rlmSbB+AL/zXbpvQ4FO5lFSx0g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 199.43.4.23) smtp.rcpttodomain=kernel.org smtp.mailfrom=cadence.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=cadence.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cadence.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=IisfoUh2UY4asdzSZ/pyaVfg4dS3qDinUXZkK781fas=; b=4wBZoAZkNb8+NYTFg7bHYjal/z0T1Dm0jauQRW2U+YAyFO/BGNrnDylRcWokQZgWrXxu/JVzBTPp2fPqjUTM9LgxcsaHphtinKnSldad3rljqhmx1nVV622uUtDeXZQp/aIqpKqCSyZk0/6hPK8lxeWbmYLUxxxg/gGscEQRztw= Received: from DM5PR21CA0067.namprd21.prod.outlook.com (2603:10b6:3:129::29) by BN7PR07MB4225.namprd07.prod.outlook.com (2603:10b6:406:b6::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.17; Fri, 7 Aug 2020 11:46:15 +0000 Received: from DM6NAM12FT030.eop-nam12.prod.protection.outlook.com (2603:10b6:3:129:cafe::bf) by DM5PR21CA0067.outlook.office365.com (2603:10b6:3:129::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3283.2 via Frontend Transport; Fri, 7 Aug 2020 11:46:15 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 199.43.4.23) smtp.mailfrom=cadence.com; kernel.org; dkim=none (message not signed) header.d=none; kernel.org; dmarc=pass action=none header.from=cadence.com; Received-SPF: Pass (protection.outlook.com: domain of cadence.com designates 199.43.4.23 as permitted sender) receiver=protection.outlook.com; client-ip=199.43.4.23; helo=rmmaillnx1.cadence.com; Received: from rmmaillnx1.cadence.com (199.43.4.23) by DM6NAM12FT030.mail.protection.outlook.com (10.13.178.167) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.10 via Frontend Transport; Fri, 7 Aug 2020 11:46:15 +0000 Received: from maileu3.global.cadence.com (maileu3.cadence.com [10.160.88.99]) by rmmaillnx1.cadence.com (8.14.4/8.14.4) with ESMTP id 077Bk9P7029785 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=OK); Fri, 7 Aug 2020 07:46:14 -0400 X-CrossPremisesHeadersFilteredBySendConnector: maileu3.global.cadence.com Received: from maileu3.global.cadence.com (10.160.88.99) by maileu3.global.cadence.com (10.160.88.99) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Fri, 7 Aug 2020 13:46:08 +0200 Received: from vleu-orange.cadence.com (10.160.88.83) by maileu3.global.cadence.com (10.160.88.99) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Fri, 7 Aug 2020 13:46:08 +0200 Received: from vleu-orange.cadence.com (localhost.localdomain [127.0.0.1]) by vleu-orange.cadence.com (8.14.4/8.14.4) with ESMTP id 077Bk8VQ000832; Fri, 7 Aug 2020 13:46:08 +0200 Received: (from sjakhade@localhost) by vleu-orange.cadence.com (8.14.4/8.14.4/Submit) id 077Bk8vC000831; Fri, 7 Aug 2020 13:46:08 +0200 From: Swapnil Jakhade To: , , , , , CC: , , , , , Subject: [PATCH v1 02/13] phy: cadence-torrent: Check cmn_ready assertion during PHY power on Date: Fri, 7 Aug 2020 13:45:56 +0200 Message-ID: <1596800767-784-3-git-send-email-sjakhade@cadence.com> X-Mailer: git-send-email 2.4.5 In-Reply-To: <1596800767-784-1-git-send-email-sjakhade@cadence.com> References: <1596800767-784-1-git-send-email-sjakhade@cadence.com> MIME-Version: 1.0 X-OrganizationHeadersPreserved: maileu3.global.cadence.com X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d3acea74-343c-45ee-bca4-08d83ac77db0 X-MS-TrafficTypeDiagnostic: BN7PR07MB4225: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:826; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yXjfMOxVMDc6dADXM/2zaIbgOU2in0Oyg9i6ajMc4ZClzElAcUmoo7r3ioA0QggiqYlTToUhXvIc/KndDlyzxAci1/kDESfnlji3X9X3JlwLQEkmSwwz8u4bm3rrzZMrjV/kEuBd7hKg1cBPkFwWWjR9QEQbDIvsaH8z64lxn/oBtizst9ANv1reF5hA92ISvWB5UKHxe/QZczUZVih+ROAJ3pi0TLSk0tUlwG6PlfBKvU4pj9uFafT0u/9k9AbqBLTOO6WaT+rOiYOgBpavlxb8gG0P9P7kjzY76cNyNBxMVDIdroEdQDNvWkBbjZQGHg0DTBOlGJ/jkB7ZJLuSY73z9kbE4MT17+O5EkkG7G+LKWXgSriXG3vBlQLcaV3cyYr7bOFL3kP3CFZGKI7dtAKAOXqKP99dj6OXGtRHPUA= X-Forefront-Antispam-Report: CIP:199.43.4.23; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:rmmaillnx1.cadence.com; PTR:InfoDomainNonexistent; CAT:NONE; SFTY:; SFS:(4636009)(396003)(39860400002)(346002)(376002)(136003)(36092001)(46966005)(8936002)(54906003)(81166007)(316002)(36906005)(478600001)(2616005)(336012)(110136005)(2906002)(42186006)(4326008)(36756003)(83380400001)(70586007)(186003)(356005)(8676002)(82740400003)(70206006)(6666004)(26005)(47076004)(86362001)(5660300002)(82310400002)(426003); DIR:OUT; SFP:1101; X-OriginatorOrg: cadence.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2020 11:46:15.3893 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d3acea74-343c-45ee-bca4-08d83ac77db0 X-MS-Exchange-CrossTenant-Id: d36035c5-6ce6-4662-a3dc-e762e61ae4c9 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=d36035c5-6ce6-4662-a3dc-e762e61ae4c9; Ip=[199.43.4.23]; Helo=[rmmaillnx1.cadence.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM12FT030.eop-nam12.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7PR07MB4225 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-08-07_08:2020-08-06,2020-08-07 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_check_notspam policy=outbound_check score=0 spamscore=0 phishscore=0 mlxlogscore=999 mlxscore=0 malwarescore=0 adultscore=0 lowpriorityscore=0 suspectscore=0 impostorscore=0 priorityscore=1501 bulkscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2008070085 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Check if cmn_ready is set after both PLL0 and PLL1 are locked. Signed-off-by: Swapnil Jakhade --- drivers/phy/cadence/phy-cadence-torrent.c | 31 ++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/drivers/phy/cadence/phy-cadence-torrent.c b/drivers/phy/cadence/phy-cadence-torrent.c index a703fcb355a8..8c6e1aa93b64 100644 --- a/drivers/phy/cadence/phy-cadence-torrent.c +++ b/drivers/phy/cadence/phy-cadence-torrent.c @@ -32,6 +32,7 @@ #define NUM_PHY_TYPE 2 #define POLL_TIMEOUT_US 5000 +#define PLL_LOCK_TIMEOUT 100000 #define TORRENT_COMMON_CDB_OFFSET 0x0 @@ -183,12 +184,16 @@ #define PHY_PLL_CFG 0x000EU /* PHY PMA common registers */ +#define PHY_PMA_CMN_CTRL1 0x0000U #define PHY_PMA_CMN_CTRL2 0x0001U #define PHY_PMA_PLL_RAW_CTRL 0x0003U static const struct reg_field phy_pll_cfg = REG_FIELD(PHY_PLL_CFG, 0, 1); +static const struct reg_field phy_pma_cmn_ctrl_1 = + REG_FIELD(PHY_PMA_CMN_CTRL1, 0, 0); + static const struct reg_field phy_pma_cmn_ctrl_2 = REG_FIELD(PHY_PMA_CMN_CTRL2, 0, 7); @@ -237,6 +242,7 @@ struct cdns_torrent_phy { struct regmap *regmap_rx_lane_cdb[MAX_NUM_LANES]; struct regmap *regmap_dptx_phy_reg; struct regmap_field *phy_pll_cfg; + struct regmap_field *phy_pma_cmn_ctrl_1; struct regmap_field *phy_pma_cmn_ctrl_2; struct regmap_field *phy_pma_pll_raw_ctrl; struct regmap_field *phy_reset_ctrl; @@ -1570,6 +1576,7 @@ static int cdns_torrent_phy_on(struct phy *phy) { struct cdns_torrent_inst *inst = phy_get_drvdata(phy); struct cdns_torrent_phy *cdns_phy = dev_get_drvdata(phy->dev.parent); + u32 read_val; int ret; /* Take the PHY out of reset */ @@ -1578,7 +1585,21 @@ static int cdns_torrent_phy_on(struct phy *phy) return ret; /* Take the PHY lane group out of reset */ - return reset_control_deassert(inst->lnk_rst); + reset_control_deassert(inst->lnk_rst); + + /* + * Wait for cmn_ready assertion + * PHY_PMA_CMN_CTRL1[0] == 1 + */ + ret = regmap_field_read_poll_timeout(cdns_phy->phy_pma_cmn_ctrl_1, + read_val, read_val, 1000, + PLL_LOCK_TIMEOUT); + if (ret) { + dev_err(cdns_phy->dev, "Timeout waiting for CMN ready\n"); + return ret; + } + + return 0; } static int cdns_torrent_phy_off(struct phy *phy) @@ -1643,6 +1664,14 @@ static int cdns_torrent_regfield_init(struct cdns_torrent_phy *cdns_phy) } cdns_phy->phy_pll_cfg = field; + regmap = cdns_phy->regmap_phy_pma_common_cdb; + field = devm_regmap_field_alloc(dev, regmap, phy_pma_cmn_ctrl_1); + if (IS_ERR(field)) { + dev_err(dev, "PHY_PMA_CMN_CTRL1 reg field init failed\n"); + return PTR_ERR(field); + } + cdns_phy->phy_pma_cmn_ctrl_1 = field; + regmap = cdns_phy->regmap_phy_pma_common_cdb; field = devm_regmap_field_alloc(dev, regmap, phy_pma_cmn_ctrl_2); if (IS_ERR(field)) { From patchwork Fri Aug 7 11:46:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Swapnil Jakhade X-Patchwork-Id: 254019 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E83EAC433E0 for ; Fri, 7 Aug 2020 11:46:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C3A072075D for ; Fri, 7 Aug 2020 11:46:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=cadence.com header.i=@cadence.com header.b="lJFK3Nuz"; dkim=pass (1024-bit key) header.d=cadence.com header.i=@cadence.com header.b="j6mbo8Da" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728370AbgHGLqd (ORCPT ); Fri, 7 Aug 2020 07:46:33 -0400 Received: from mx0a-0014ca01.pphosted.com ([208.84.65.235]:17664 "EHLO mx0a-0014ca01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728270AbgHGLqa (ORCPT ); Fri, 7 Aug 2020 07:46:30 -0400 Received: from pps.filterd (m0042385.ppops.net [127.0.0.1]) by mx0a-0014ca01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 077BhS1n011307; Fri, 7 Aug 2020 04:46:24 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cadence.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=proofpoint; bh=lYwxFwD+6VnVhVsqN4SVGapslaZqo8urWEB95Y29uW0=; b=lJFK3NuzA2hhoGBn5sv+So1N2Fo6qrcqNNCOnYtpFp9fOsX7yiFfMpgfrtE16H5I7dRr s9stsLimD+YFGlcNTga2lbWPtEfWcp+QNgK1K+Z/4YR0U9FQ+V7MeS+XQacu90bFeGlq JjR5TEI4ZQUAO3CeHjTWEPYqX0hvCb82JpaCj7vO4BS2oKZ6bJbmiiws/dwmvMagl2PY 3I54gHR66p7DB2EMYAhSElVPCFGHYJNXoSGDM6BbhzOZRthRbiKjhVsZs4QYNlBHBK7r Jos0fg7Gw4dr9vO26XgEqV7PR98Rwl4prjc+nSBmMoNzQruLhqlGzKBVTlGv4IM5k6CZ fw== Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2175.outbound.protection.outlook.com [104.47.55.175]) by mx0a-0014ca01.pphosted.com with ESMTP id 32nme0mc3n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 07 Aug 2020 04:46:24 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PaVbtK9rN4a89Kx1/BPXs7miyI25D2uN2IZBVuEZgJ7Rkf5QFiuu/RE4XmDkYVLoQ9N9lg6zaJvPl2i1ftFdRd7MBthP6zWJAAW3vwfPK5VxkPSq6Mnp1NM0RGGhfm3L3ykrcl7yk10P381zczj48icyy+xwVjZwdXVIwtHLZW40s0AAmUNvzckYqv/MUqcr32MyYPMIIl48t6QEGQ/J8T6CwqEajEsy/Dqev9rlmx2yrZ6930FLEWamo6bfLcgaxKQz93E9FQdsoxJXrpY24Foz75rQk+ArHxV6+OXtkmvgKShNZExzbuIw9F31bGWWBeOveosQe/i+4X3oHSj16Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lYwxFwD+6VnVhVsqN4SVGapslaZqo8urWEB95Y29uW0=; b=cSpcI+wxHEE6GKHDDPEE17RANUVaOPcAao3cA/eslJPl3LZnI/uUwyFpmg+UPU2/VTceUbng2eWStgvJnp5dnFP8aGTgcdM6iQf5dnPbrrE/ziKL6A+o4b0Au1qvB4LmVk4FenB7LWumu/VD3pTVg3ebwKCOLYRJom0+ws4V3YW6PnYYRJArIMQ7nmiWMrwDMFKe8FB9gnqdbsrVN/xvVapzeC0VqbVk1j4ve8ayr2ueGf+166F+ZtCMgFlU1zJIdYaF9r4BvZmerrC5Toiqtk7TzJXBp4tGUwQm+ewXpQJSqkC3Ew5SQnXZ7Ta5BhYvofdaqhjEXdTbmNwbHMm1uw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 199.43.4.23) smtp.rcpttodomain=kernel.org smtp.mailfrom=cadence.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=cadence.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cadence.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lYwxFwD+6VnVhVsqN4SVGapslaZqo8urWEB95Y29uW0=; b=j6mbo8Da7LH49a6qHPNzgaLROH78mVcwf85/wMM7tg5NF3beKxx7Z4DJyGue9aG/E+wpO1o6OyMRF7DKnOQKgMbS5IoYXZnocXdIjh1WaNVl1nVaBIQIAWovYtKatlJ/57fRFMF8jnVcYHh6IxraJZOLtQpcojCeacAQUcI6UfM= Received: from DM5PR04CA0033.namprd04.prod.outlook.com (2603:10b6:3:12b::19) by DM6PR07MB6220.namprd07.prod.outlook.com (2603:10b6:5:155::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.18; Fri, 7 Aug 2020 11:46:19 +0000 Received: from DM6NAM12FT050.eop-nam12.prod.protection.outlook.com (2603:10b6:3:12b:cafe::57) by DM5PR04CA0033.outlook.office365.com (2603:10b6:3:12b::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.19 via Frontend Transport; Fri, 7 Aug 2020 11:46:19 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 199.43.4.23) smtp.mailfrom=cadence.com; kernel.org; dkim=none (message not signed) header.d=none; kernel.org; dmarc=pass action=none header.from=cadence.com; Received-SPF: Pass (protection.outlook.com: domain of cadence.com designates 199.43.4.23 as permitted sender) receiver=protection.outlook.com; client-ip=199.43.4.23; helo=rmmaillnx1.cadence.com; Received: from rmmaillnx1.cadence.com (199.43.4.23) by DM6NAM12FT050.mail.protection.outlook.com (10.13.178.215) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.10 via Frontend Transport; Fri, 7 Aug 2020 11:46:19 +0000 Received: from maileu3.global.cadence.com (maileu3.cadence.com [10.160.88.99]) by rmmaillnx1.cadence.com (8.14.4/8.14.4) with ESMTP id 077Bk9PB029785 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=OK); Fri, 7 Aug 2020 07:46:18 -0400 X-CrossPremisesHeadersFilteredBySendConnector: maileu3.global.cadence.com Received: from maileu3.global.cadence.com (10.160.88.99) by maileu3.global.cadence.com (10.160.88.99) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Fri, 7 Aug 2020 13:46:09 +0200 Received: from vleu-orange.cadence.com (10.160.88.83) by maileu3.global.cadence.com (10.160.88.99) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Fri, 7 Aug 2020 13:46:09 +0200 Received: from vleu-orange.cadence.com (localhost.localdomain [127.0.0.1]) by vleu-orange.cadence.com (8.14.4/8.14.4) with ESMTP id 077Bk9Pf000848; Fri, 7 Aug 2020 13:46:09 +0200 Received: (from sjakhade@localhost) by vleu-orange.cadence.com (8.14.4/8.14.4/Submit) id 077Bk9x6000847; Fri, 7 Aug 2020 13:46:09 +0200 From: Swapnil Jakhade To: , , , , , CC: , , , , , Subject: [PATCH v1 06/13] phy: cadence-torrent: Update PHY reset for multilink configuration Date: Fri, 7 Aug 2020 13:46:00 +0200 Message-ID: <1596800767-784-7-git-send-email-sjakhade@cadence.com> X-Mailer: git-send-email 2.4.5 In-Reply-To: <1596800767-784-1-git-send-email-sjakhade@cadence.com> References: <1596800767-784-1-git-send-email-sjakhade@cadence.com> MIME-Version: 1.0 X-OrganizationHeadersPreserved: maileu3.global.cadence.com X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 78c09b79-bf2e-4547-c17c-08d83ac78026 X-MS-TrafficTypeDiagnostic: DM6PR07MB6220: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3513; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5fJQuEUt/GRUA3rHhPuBkg7YOVijcBAGKtsJL0ZahDyc0fdH23fQjm3NLTpf+HnrCzIPwkgT9WtMpzVJtG+zD9GRoZu1F3uIK98GV7Uuwtf6nm5AOrfDZJ6G5cZ85YTZy3MjBmmXlX1SiFV1K9G2CGzu6rKLGoIDSDIfIek2ogfp689YLA3uoTeIjWIQdmnc9lcJOsvKzIBW58Q3GxE8+98Exlc9RJV5i+N3RD9IzDMdP2xG0Bab3ondLYFTYTimvQEHS+nHRU+OEQg84rAF08VBEcW8Zn5wpDsxTicj6cSPpVk4JOOkUWGwJGYrG3VgB9JTrHo8ErK6TAI1fEbGpC9jlf0waKo2FEeomRNccvc8JXfuDVoPT6bR2PRKRszNkcDmfsuKkZlC/4byCD6lIO5Y/26ejeAQSEOF5Yctfi8= X-Forefront-Antispam-Report: CIP:199.43.4.23; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:rmmaillnx1.cadence.com; PTR:InfoDomainNonexistent; CAT:NONE; SFTY:; SFS:(4636009)(346002)(136003)(396003)(39860400002)(376002)(36092001)(46966005)(82310400002)(36906005)(356005)(42186006)(86362001)(36756003)(426003)(316002)(26005)(82740400003)(5660300002)(54906003)(81166007)(110136005)(8936002)(186003)(2906002)(70586007)(47076004)(478600001)(2616005)(70206006)(4326008)(8676002)(83380400001)(336012)(6666004); DIR:OUT; SFP:1101; X-OriginatorOrg: cadence.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2020 11:46:19.5192 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 78c09b79-bf2e-4547-c17c-08d83ac78026 X-MS-Exchange-CrossTenant-Id: d36035c5-6ce6-4662-a3dc-e762e61ae4c9 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=d36035c5-6ce6-4662-a3dc-e762e61ae4c9; Ip=[199.43.4.23]; Helo=[rmmaillnx1.cadence.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM12FT050.eop-nam12.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR07MB6220 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-08-07_08:2020-08-06,2020-08-07 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_check_notspam policy=outbound_check score=0 spamscore=0 phishscore=0 mlxlogscore=999 mlxscore=0 malwarescore=0 adultscore=0 lowpriorityscore=0 suspectscore=0 impostorscore=0 priorityscore=1501 bulkscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2008070085 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org For multilink configuration, deassert PHY and link reset after PHY registers are configured in probe and only check link status in power_on callback. Signed-off-by: Swapnil Jakhade --- drivers/phy/cadence/phy-cadence-torrent.c | 28 +++++++++++++++++------ 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/drivers/phy/cadence/phy-cadence-torrent.c b/drivers/phy/cadence/phy-cadence-torrent.c index c55f8bde52f1..fc5720845ec7 100644 --- a/drivers/phy/cadence/phy-cadence-torrent.c +++ b/drivers/phy/cadence/phy-cadence-torrent.c @@ -1603,13 +1603,15 @@ static int cdns_torrent_phy_on(struct phy *phy) u32 read_val; int ret; - /* Take the PHY out of reset */ - ret = reset_control_deassert(cdns_phy->phy_rst); - if (ret) - return ret; + if (cdns_phy->nsubnodes == 1) { + /* Take the PHY lane group out of reset */ + reset_control_deassert(inst->lnk_rst); - /* Take the PHY lane group out of reset */ - reset_control_deassert(inst->lnk_rst); + /* Take the PHY out of reset */ + ret = reset_control_deassert(cdns_phy->phy_rst); + if (ret) + return ret; + } /* * Wait for cmn_ready assertion @@ -1623,6 +1625,8 @@ static int cdns_torrent_phy_on(struct phy *phy) return ret; } + mdelay(10); + return 0; } @@ -1632,6 +1636,9 @@ static int cdns_torrent_phy_off(struct phy *phy) struct cdns_torrent_phy *cdns_phy = dev_get_drvdata(phy->dev.parent); int ret; + if (cdns_phy->nsubnodes != 1) + return 0; + ret = reset_control_assert(cdns_phy->phy_rst); if (ret) return ret; @@ -1886,7 +1893,7 @@ int cdns_torrent_phy_configure_multilink(struct cdns_torrent_phy *cdns_phy) struct cdns_torrent_vals *cmn_vals, *tx_ln_vals, *rx_ln_vals; struct cdns_torrent_vals *link_cmn_vals, *xcvr_diag_vals; enum cdns_torrent_phy_type phy_t1, phy_t2, tmp_phy_type; - int i, j, node, mlane, num_lanes; + int i, j, node, mlane, num_lanes, ret; struct cdns_reg_pairs *reg_pairs; enum cdns_torrent_ssc_mode ssc; struct regmap *regmap; @@ -1989,8 +1996,15 @@ int cdns_torrent_phy_configure_multilink(struct cdns_torrent_phy *cdns_phy) reg_pairs[j].val); } } + + reset_control_deassert(cdns_phy->phys[node].lnk_rst); } + /* Take the PHY out of reset */ + ret = reset_control_deassert(cdns_phy->phy_rst); + if (ret) + return ret; + return 0; } From patchwork Fri Aug 7 11:46:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Swapnil Jakhade X-Patchwork-Id: 254014 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0905EC433DF for ; Fri, 7 Aug 2020 11:47:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D4B8B2075D for ; Fri, 7 Aug 2020 11:47:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=cadence.com header.i=@cadence.com header.b="DFGo86yn"; dkim=pass (1024-bit key) header.d=cadence.com header.i=@cadence.com header.b="drtepdnC" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728368AbgHGLrT (ORCPT ); Fri, 7 Aug 2020 07:47:19 -0400 Received: from mx0a-0014ca01.pphosted.com ([208.84.65.235]:50050 "EHLO mx0a-0014ca01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727783AbgHGLqd (ORCPT ); Fri, 7 Aug 2020 07:46:33 -0400 Received: from pps.filterd (m0042385.ppops.net [127.0.0.1]) by mx0a-0014ca01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 077BhUFP011316; Fri, 7 Aug 2020 04:46:26 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cadence.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=proofpoint; bh=15yUdAu50eDeu+mcbDg/IWsbJ81BZ4cZee1j/SFb/Vw=; b=DFGo86ynyOLRX8zHlQb5p5sftd5KI6goICAIy/WuVjh4bFRwcal+Gnyc3xlCuhkxV0S8 1cLFAts4UyspyAuoro9QNwCQ5zyiecGgc+jy4Of55353uytkwqAaRvuy7ijLgpEAlSdm +OiOI3KQIfRzwT4xj36MM/yDxqiI233A/ep3wtUKwi1mVRZ9Z57TLJncE6h6j3NigJKb dTWpPaHNSVuhbZ1FuulqgoO9nHcrYWiyBpDcWYiXURDQg8ADbKGvgAk/oP5yTKt4Iln0 IsgtsdyuEkbgrpKhKiO+FsgPQKKQOrtKS7WjkcWaWJIOk7fMnga5sAW4EMiyqMVb/7MZ xA== Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2171.outbound.protection.outlook.com [104.47.55.171]) by mx0a-0014ca01.pphosted.com with ESMTP id 32nme0mc3u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 07 Aug 2020 04:46:25 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jYISVvUg3yDcnb1aPOgLpaJV9UXgQqTX5SATWmso2+IYLIoE1+HI0Z71lYDIg07MMLr0vOP/k+Hp9lnJZo4lemR3DIU2V56AXfNRVNyqaWuozAJyVpY/ZqHnmTStIFzTJ9nThFHwOtNyZdkbJRY/AhuZLFBUq/bIO1eZLsSoUkK2f03xmncyO6Mx8S5S0H2NUJ/FsSNS5p0wyfdXq2+dRllc90PR7yNb5t+V4d2YiVEdzMw0lAxVPn7lgX+4oYJkqYR1bknW+lQ3LwaFTS5c5rFUoiyq0LON6KDbKb0KrCFKi5WIiGLlUECMPbCMxavJudxwhpHM26G1hhuQbbJc/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=15yUdAu50eDeu+mcbDg/IWsbJ81BZ4cZee1j/SFb/Vw=; b=BbxKL26WMp8LUznQPwV+iVqV3njSTQaVyBYpii1+sWbKsxlI6FQ6nTjqLKKQi0m4y2LZSDwFJyoMUnFrkYkXEcx6uRo51zEq5MO0HB1XxoVmZa5fiZoepwkSQmTNRsgRJLa9+E0Efqzho53RRpPEx7hL/oZ1jrb7oSikxsPsysSzA3ACe8dW7IGP1Iyyd/526McmnWvU9Y0U0Iia32bTMGzyNOk1XvWF5wdg626N8pvXfPPDHSwQ0pSICV3wCa3SNQoLaKlDthw+D5JLmb7bkBhkXLCKUnZ0xULkafdMwKK/HM+vuztfurZHx5qlNbgjyMoR9sJ9r48fpTCuZQaTqg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 199.43.4.23) smtp.rcpttodomain=kernel.org smtp.mailfrom=cadence.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=cadence.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cadence.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=15yUdAu50eDeu+mcbDg/IWsbJ81BZ4cZee1j/SFb/Vw=; b=drtepdnCSVgFlaB/QWAykUiIs/T0/QweQ6Am4Ih6YV9xkd6GMogfRDqWr9gygGtmoDr/f66KioxJiAOECNXvTWiSskULxPR91G5JIg69+AFAoRB6q+Gj44eD3U+ZaxRyCz0HoC8YpWMyY9OdiV/0Gx1RKkiTluOPwDDD2PFwz+8= Received: from DM5PR11CA0010.namprd11.prod.outlook.com (2603:10b6:3:115::20) by BYAPR07MB4359.namprd07.prod.outlook.com (2603:10b6:a02:c0::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.16; Fri, 7 Aug 2020 11:46:23 +0000 Received: from DM6NAM12FT027.eop-nam12.prod.protection.outlook.com (2603:10b6:3:115:cafe::5e) by DM5PR11CA0010.outlook.office365.com (2603:10b6:3:115::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.18 via Frontend Transport; Fri, 7 Aug 2020 11:46:22 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 199.43.4.23) smtp.mailfrom=cadence.com; kernel.org; dkim=none (message not signed) header.d=none; kernel.org; dmarc=pass action=none header.from=cadence.com; Received-SPF: Pass (protection.outlook.com: domain of cadence.com designates 199.43.4.23 as permitted sender) receiver=protection.outlook.com; client-ip=199.43.4.23; helo=rmmaillnx1.cadence.com; Received: from rmmaillnx1.cadence.com (199.43.4.23) by DM6NAM12FT027.mail.protection.outlook.com (10.13.178.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.10 via Frontend Transport; Fri, 7 Aug 2020 11:46:22 +0000 Received: from maileu3.global.cadence.com (maileu3.cadence.com [10.160.88.99]) by rmmaillnx1.cadence.com (8.14.4/8.14.4) with ESMTP id 077Bk9PE029785 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=OK); Fri, 7 Aug 2020 07:46:21 -0400 X-CrossPremisesHeadersFilteredBySendConnector: maileu3.global.cadence.com Received: from maileu3.global.cadence.com (10.160.88.99) by maileu3.global.cadence.com (10.160.88.99) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Fri, 7 Aug 2020 13:46:09 +0200 Received: from vleu-orange.cadence.com (10.160.88.83) by maileu3.global.cadence.com (10.160.88.99) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Fri, 7 Aug 2020 13:46:09 +0200 Received: from vleu-orange.cadence.com (localhost.localdomain [127.0.0.1]) by vleu-orange.cadence.com (8.14.4/8.14.4) with ESMTP id 077Bk9fY000852; Fri, 7 Aug 2020 13:46:09 +0200 Received: (from sjakhade@localhost) by vleu-orange.cadence.com (8.14.4/8.14.4/Submit) id 077Bk99s000851; Fri, 7 Aug 2020 13:46:09 +0200 From: Swapnil Jakhade To: , , , , , CC: , , , , , Subject: [PATCH v1 07/13] phy: cadence-torrent: Add clk changes for multilink configuration Date: Fri, 7 Aug 2020 13:46:01 +0200 Message-ID: <1596800767-784-8-git-send-email-sjakhade@cadence.com> X-Mailer: git-send-email 2.4.5 In-Reply-To: <1596800767-784-1-git-send-email-sjakhade@cadence.com> References: <1596800767-784-1-git-send-email-sjakhade@cadence.com> MIME-Version: 1.0 X-OrganizationHeadersPreserved: maileu3.global.cadence.com X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: dff46143-336d-4f41-ca35-08d83ac78209 X-MS-TrafficTypeDiagnostic: BYAPR07MB4359: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:475; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rXeDCzYa4KvENpApdGrU7Dt4fc5j4F1Gl1Ov8QwX6HIfQ2/1ToVvglWO3Le736DWvA6BmfkHt7o+HCMt6zRMHRPPVA3cQRWW+yQc5CemNaF1jNRtis958d620VWzY5fiCVoqJQEpx0/EmkSyH7Q4xHQeh9nPB3FoycBETYoZLr2EbmygryPz+4RuRZCE7UtQLn5QaQv6WZGcusoj4TK500oBp+Uz+BZoYiB8CBmPx6PM9GgZfr2+G5vv1IjUZHvjTBAFdFNIwlVYbdBGNUchC5etYJ6T3CSO6PEeHRnQ9gw9+aaTqQdgNH7FTkbCHMBoEyWYPy2T4FMhxALhcJrQPjIUJSjME6LbyawAOscrGAZXFJ1MNUdbrbeDLOYG8R7A5xypFMqHRy3a1J3Umo34l/3oixg/2/LoDg7Sa7o4EwM= X-Forefront-Antispam-Report: CIP:199.43.4.23; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:rmmaillnx1.cadence.com; PTR:InfoDomainNonexistent; CAT:NONE; SFTY:; SFS:(4636009)(346002)(136003)(376002)(39860400002)(396003)(36092001)(46966005)(8936002)(8676002)(82310400002)(186003)(83380400001)(70206006)(2616005)(26005)(70586007)(356005)(6666004)(336012)(426003)(42186006)(81166007)(110136005)(54906003)(36906005)(316002)(478600001)(2906002)(4326008)(86362001)(36756003)(5660300002)(82740400003)(47076004); DIR:OUT; SFP:1101; X-OriginatorOrg: cadence.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2020 11:46:22.6828 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dff46143-336d-4f41-ca35-08d83ac78209 X-MS-Exchange-CrossTenant-Id: d36035c5-6ce6-4662-a3dc-e762e61ae4c9 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=d36035c5-6ce6-4662-a3dc-e762e61ae4c9; Ip=[199.43.4.23]; Helo=[rmmaillnx1.cadence.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM12FT027.eop-nam12.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR07MB4359 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-08-07_08:2020-08-06,2020-08-07 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_check_notspam policy=outbound_check score=0 spamscore=0 phishscore=0 mlxlogscore=999 mlxscore=0 malwarescore=0 adultscore=0 lowpriorityscore=0 suspectscore=0 impostorscore=0 priorityscore=1501 bulkscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2008070085 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Prepare and enable clock in probe instead of phy_init. Also, remove phy_exit callback. Signed-off-by: Swapnil Jakhade --- drivers/phy/cadence/phy-cadence-torrent.c | 41 ++++++++++------------- 1 file changed, 17 insertions(+), 24 deletions(-) diff --git a/drivers/phy/cadence/phy-cadence-torrent.c b/drivers/phy/cadence/phy-cadence-torrent.c index fc5720845ec7..691d4aa5b2ed 100644 --- a/drivers/phy/cadence/phy-cadence-torrent.c +++ b/drivers/phy/cadence/phy-cadence-torrent.c @@ -273,7 +273,6 @@ enum phy_powerstate { }; static int cdns_torrent_phy_init(struct phy *phy); -static int cdns_torrent_phy_exit(struct phy *phy); static int cdns_torrent_dp_init(struct phy *phy); static int cdns_torrent_dp_run(struct cdns_torrent_phy *cdns_phy, u32 num_lanes); @@ -305,7 +304,6 @@ static int cdns_torrent_phy_off(struct phy *phy); static const struct phy_ops cdns_torrent_phy_ops = { .init = cdns_torrent_phy_init, - .exit = cdns_torrent_phy_exit, .configure = cdns_torrent_dp_configure, .power_on = cdns_torrent_phy_on, .power_off = cdns_torrent_phy_off, @@ -977,14 +975,6 @@ static int cdns_torrent_dp_init(struct phy *phy) return ret; } -static int cdns_torrent_phy_exit(struct phy *phy) -{ - struct cdns_torrent_phy *cdns_phy = dev_get_drvdata(phy->dev.parent); - - clk_disable_unprepare(cdns_phy->clk); - return 0; -} - static int cdns_torrent_dp_wait_pma_cmn_ready(struct cdns_torrent_phy *cdns_phy) { @@ -1825,20 +1815,7 @@ static int cdns_torrent_phy_init(struct phy *phy) struct cdns_reg_pairs *reg_pairs; struct regmap *regmap; u32 num_regs; - int ret, i, j; - - ret = clk_prepare_enable(cdns_phy->clk); - if (ret) { - dev_err(cdns_phy->dev, "Failed to prepare ref clock\n"); - return ret; - } - - cdns_phy->ref_clk_rate = clk_get_rate(cdns_phy->clk); - if (!(cdns_phy->ref_clk_rate)) { - dev_err(cdns_phy->dev, "Failed to get ref clock rate\n"); - clk_disable_unprepare(cdns_phy->clk); - return -EINVAL; - } + int i, j; if (cdns_phy->nsubnodes > 1) return 0; @@ -2072,6 +2049,19 @@ static int cdns_torrent_phy_probe(struct platform_device *pdev) if (ret) return ret; + ret = clk_prepare_enable(cdns_phy->clk); + if (ret) { + dev_err(cdns_phy->dev, "Failed to prepare ref clock\n"); + return ret; + } + + cdns_phy->ref_clk_rate = clk_get_rate(cdns_phy->clk); + if (!(cdns_phy->ref_clk_rate)) { + dev_err(cdns_phy->dev, "Failed to get ref clock rate\n"); + clk_disable_unprepare(cdns_phy->clk); + return -EINVAL; + } + /* Enable APB */ reset_control_deassert(cdns_phy->apb_rst); @@ -2246,6 +2236,7 @@ static int cdns_torrent_phy_probe(struct platform_device *pdev) reset_control_put(cdns_phy->phys[i].lnk_rst); of_node_put(child); reset_control_assert(cdns_phy->apb_rst); + clk_disable_unprepare(cdns_phy->clk); return ret; } @@ -2261,6 +2252,8 @@ static int cdns_torrent_phy_remove(struct platform_device *pdev) reset_control_put(cdns_phy->phys[i].lnk_rst); } + clk_disable_unprepare(cdns_phy->clk); + return 0; } From patchwork Fri Aug 7 11:46:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Swapnil Jakhade X-Patchwork-Id: 254013 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21BBFC433DF for ; Fri, 7 Aug 2020 11:47:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E05B72075D for ; Fri, 7 Aug 2020 11:47:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=cadence.com header.i=@cadence.com header.b="Lh9MZOcB"; dkim=pass (1024-bit key) header.d=cadence.com header.i=@cadence.com header.b="wcz7GKK9" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728502AbgHGLrT (ORCPT ); Fri, 7 Aug 2020 07:47:19 -0400 Received: from mx0b-0014ca01.pphosted.com ([208.86.201.193]:63234 "EHLO mx0a-0014ca01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728354AbgHGLqc (ORCPT ); Fri, 7 Aug 2020 07:46:32 -0400 Received: from pps.filterd (m0042333.ppops.net [127.0.0.1]) by mx0b-0014ca01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 077BjYuW031928; Fri, 7 Aug 2020 04:46:25 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cadence.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=proofpoint; bh=wPmHxgzsU5J7eD21bj3DszuJIiEfZu0auvsqlDYhq8c=; b=Lh9MZOcBqhhVejjeRawMrfSOngmtjZz6ZNkXH/eIoUw8TLVzx36+lTcwe5C08bVSD6Dp /wHRZC1wAz9V+v3ckcWgLlUPkiBj9juJ3M3e14UUy14CM3DQ0AgmmKr6A7MXszQBK08C jh1rb44s+9MKSFC3mEiMA9/n26CiIHqkzc/1ijFo3K9IAzRIxGhFOSjV466FpgYYLdbv lPVPkfx6q8H09klhkKgD9foc0tBDDXGSPzlUcDlUfKQ/1yG+otIz5Wg/ZIzd8XHhQ/AA D05U4iDzXXw9JJHJYwyxQIdPscML2FYFNoCvbVr9YkWsWiQ7Rs1v5Cm3LKjab/fh3IsI jw== Received: from nam04-dm6-obe.outbound.protection.outlook.com (mail-dm6nam08lp2045.outbound.protection.outlook.com [104.47.73.45]) by mx0b-0014ca01.pphosted.com with ESMTP id 32n8gy61cw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 07 Aug 2020 04:46:24 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=L8a9n6cYoe27YaC6Ihki5MI1AP99beHc/N8Id2GguhIi79rWoo4Y4bNDQe8xkOjO/MhJljVYxAiAItskqocz+dk6167JwYwQtLV5s8VPhtZJ0D2MtabejnsDOyOgAszIH2zw3Pal3E+pte7+5/86yJEWvU7Vfm5hU/ypJn+xEBRepejsgx4hb7TELFFNJ79ec7jDEq0lUtK++0hvL2lWsk12YxIyngiQKla3DW9LK2nLCnpeTRrPgp84D7Q8pLax19PtpGLhhd8wFOttUBbvy4NlpqKfnl0h2WHMLv/6auHGBKwyQ/wfkhNqFisdpeRikITbRhL3ZqmUfTcEi5qj7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wPmHxgzsU5J7eD21bj3DszuJIiEfZu0auvsqlDYhq8c=; b=lPkIHmbyysI6wXhTpGqRF4topw6dNHJZhUlPZI4OI7ZmHCykO6NiabEOWETM+y7szUFkP00JZrpM22fEJLBdzAYg6RTIZ1QTFfNAKWNQ4oI0EfBM5VrVc32yrdMDm49F+apzQipqXgixBwvSksCYWJ/2BRTgAEDsUoUaW5KWFRuActHRJiEkuFIX2uAZfJQcewCgGBVRwA8cBnlsm7myKJj+sspiyUFOrQSlInCwZcwuw1nFq95i2g4hXRB8sx3fmlIoecUVjARF+QQk7+wNyYqtlHGb5lfWqkq8FXsevQhmcpkN164ous2vPZxQJ9zVInXBgI8SbNqRt7bAjnBvEQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 199.43.4.23) smtp.rcpttodomain=kernel.org smtp.mailfrom=cadence.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=cadence.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cadence.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wPmHxgzsU5J7eD21bj3DszuJIiEfZu0auvsqlDYhq8c=; b=wcz7GKK9Edf/j4Q9q/gKH50Wyvm58j1LqXgAQRMhFtAst7hwaouGKs/xQMuq+cDD8rP1SvKfDQRvvNukQE+22RxXLd/e4SRssoGnonYP4G8Yy62xw7N9fa9D0rCM4M4/NVroHZm5XimDD/yqYC/WbKmNtlksJl/SX63vCdsl3k0= Received: from BN6PR13CA0054.namprd13.prod.outlook.com (2603:10b6:404:11::16) by SN6PR07MB5742.namprd07.prod.outlook.com (2603:10b6:805:f0::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3239.19; Fri, 7 Aug 2020 11:46:21 +0000 Received: from BN8NAM12FT003.eop-nam12.prod.protection.outlook.com (2603:10b6:404:11:cafe::94) by BN6PR13CA0054.outlook.office365.com (2603:10b6:404:11::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.13 via Frontend Transport; Fri, 7 Aug 2020 11:46:21 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 199.43.4.23) smtp.mailfrom=cadence.com; kernel.org; dkim=none (message not signed) header.d=none; kernel.org; dmarc=pass action=none header.from=cadence.com; Received-SPF: Pass (protection.outlook.com: domain of cadence.com designates 199.43.4.23 as permitted sender) receiver=protection.outlook.com; client-ip=199.43.4.23; helo=rmmaillnx1.cadence.com; Received: from rmmaillnx1.cadence.com (199.43.4.23) by BN8NAM12FT003.mail.protection.outlook.com (10.13.182.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.10 via Frontend Transport; Fri, 7 Aug 2020 11:46:21 +0000 Received: from maileu3.global.cadence.com (maileu3.cadence.com [10.160.88.99]) by rmmaillnx1.cadence.com (8.14.4/8.14.4) with ESMTP id 077Bk9PD029785 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=OK); Fri, 7 Aug 2020 07:46:20 -0400 X-CrossPremisesHeadersFilteredBySendConnector: maileu3.global.cadence.com Received: from maileu3.global.cadence.com (10.160.88.99) by maileu3.global.cadence.com (10.160.88.99) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Fri, 7 Aug 2020 13:46:09 +0200 Received: from vleu-orange.cadence.com (10.160.88.83) by maileu3.global.cadence.com (10.160.88.99) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Fri, 7 Aug 2020 13:46:09 +0200 Received: from vleu-orange.cadence.com (localhost.localdomain [127.0.0.1]) by vleu-orange.cadence.com (8.14.4/8.14.4) with ESMTP id 077Bk9td000861; Fri, 7 Aug 2020 13:46:09 +0200 Received: (from sjakhade@localhost) by vleu-orange.cadence.com (8.14.4/8.14.4/Submit) id 077Bk96n000860; Fri, 7 Aug 2020 13:46:09 +0200 From: Swapnil Jakhade To: , , , , , CC: , , , , , Subject: [PATCH v1 09/13] phy: cadence-torrent: Configure PHY_PLL_CFG as part of link_cmn_vals Date: Fri, 7 Aug 2020 13:46:03 +0200 Message-ID: <1596800767-784-10-git-send-email-sjakhade@cadence.com> X-Mailer: git-send-email 2.4.5 In-Reply-To: <1596800767-784-1-git-send-email-sjakhade@cadence.com> References: <1596800767-784-1-git-send-email-sjakhade@cadence.com> MIME-Version: 1.0 X-OrganizationHeadersPreserved: maileu3.global.cadence.com X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e95bdc6b-b92d-4cee-e9dd-08d83ac7813f X-MS-TrafficTypeDiagnostic: SN6PR07MB5742: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1091; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: W+k1t/aMqAfHK/C9UDjrf6dmdcSoEr2+VlNzJ9dPMmnag+2yQQkSF7h88fd1XFvM+LlolQ2fCaqIKRS4gDv+0a4g6GhcZ+UL0O/HcNyULBErst34c8zl6WESeHeTsA9YzU3AciJ3xy8ibMcuZ+BDNs0pfl6JAqj1FjA7g1eEkeqRwpuv9eMcqDLtW3Zm7VwmV6Av/FyxHkxVZTgsUb7coD7VeVYQDPmYwGx2vZVijV6200qzkDwwhICKXBwNLUPSRFEtEpOOfokbcehO5diQM9+F+hKYvYMsvWiFxni+oobpFPoqnLk64kIb/LKQiJJWktw6OUvC+m7uQJ6eQAH8lZPiZBjhtlDub1dGInrEsXBWQOtC2IaHz3eheVEHUuL4r3+Htg1+/J8tNKL7QXygqReFnR/smYQ7sTEpVNtQIdc= X-Forefront-Antispam-Report: CIP:199.43.4.23; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:rmmaillnx1.cadence.com; PTR:InfoDomainNonexistent; CAT:NONE; SFTY:; SFS:(4636009)(346002)(376002)(396003)(136003)(39860400002)(36092001)(46966005)(8936002)(4326008)(478600001)(36756003)(82310400002)(70586007)(5660300002)(2906002)(6666004)(83380400001)(70206006)(86362001)(81166007)(356005)(42186006)(82740400003)(26005)(36906005)(316002)(2616005)(186003)(110136005)(47076004)(336012)(54906003)(8676002)(426003); DIR:OUT; SFP:1101; X-OriginatorOrg: cadence.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2020 11:46:21.4007 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e95bdc6b-b92d-4cee-e9dd-08d83ac7813f X-MS-Exchange-CrossTenant-Id: d36035c5-6ce6-4662-a3dc-e762e61ae4c9 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=d36035c5-6ce6-4662-a3dc-e762e61ae4c9; Ip=[199.43.4.23]; Helo=[rmmaillnx1.cadence.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM12FT003.eop-nam12.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR07MB5742 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-08-07_08:2020-08-06,2020-08-07 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_check_notspam policy=outbound_check score=0 malwarescore=0 phishscore=0 mlxlogscore=856 impostorscore=0 priorityscore=1501 bulkscore=0 suspectscore=0 spamscore=0 mlxscore=0 clxscore=1015 adultscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2008070085 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Include PHY_PLL_CFG as a first register value to configure in link_cmn_vals array values. Signed-off-by: Swapnil Jakhade --- drivers/phy/cadence/phy-cadence-torrent.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/drivers/phy/cadence/phy-cadence-torrent.c b/drivers/phy/cadence/phy-cadence-torrent.c index d01a44b93e99..216b25512a08 100644 --- a/drivers/phy/cadence/phy-cadence-torrent.c +++ b/drivers/phy/cadence/phy-cadence-torrent.c @@ -1830,7 +1830,14 @@ static int cdns_torrent_phy_init(struct phy *phy) reg_pairs = link_cmn_vals->reg_pairs; num_regs = link_cmn_vals->num_regs; regmap = cdns_phy->regmap_common_cdb; - for (i = 0; i < num_regs; i++) + + /** + * First array value in link_cmn_vals must be of + * PHY_PLL_CFG register + */ + regmap_field_write(cdns_phy->phy_pll_cfg, reg_pairs[0].val); + + for (i = 1; i < num_regs; i++) regmap_write(regmap, reg_pairs[i].off, reg_pairs[i].val); } @@ -1907,8 +1914,6 @@ int cdns_torrent_phy_configure_multilink(struct cdns_torrent_phy *cdns_phy) phy_t1 = cdns_phy->phys[0].phy_type; phy_t2 = cdns_phy->phys[1].phy_type; - regmap_field_write(cdns_phy->phy_pll_cfg, 0x0003); - /** * First configure the PHY for first link with phy_t1. Get the array * values as [phy_t1][phy_t2][ssc]. @@ -1944,7 +1949,15 @@ int cdns_torrent_phy_configure_multilink(struct cdns_torrent_phy *cdns_phy) reg_pairs = link_cmn_vals->reg_pairs; num_regs = link_cmn_vals->num_regs; regmap = cdns_phy->regmap_common_cdb; - for (i = 0; i < num_regs; i++) + + /** + * First array value in link_cmn_vals must be of + * PHY_PLL_CFG register + */ + regmap_field_write(cdns_phy->phy_pll_cfg, + reg_pairs[0].val); + + for (i = 1; i < num_regs; i++) regmap_write(regmap, reg_pairs[i].off, reg_pairs[i].val); } @@ -2283,6 +2296,7 @@ static int cdns_torrent_phy_remove(struct platform_device *pdev) /* PCIe and SGMII/QSGMII Unique SSC link configuration */ static struct cdns_reg_pairs pcie_sgmii_link_cmn_regs[] = { + {0x0003, PHY_PLL_CFG}, {0x0601, CMN_PDIAG_PLL0_CLK_SEL_M0}, {0x0400, CMN_PDIAG_PLL0_CLK_SEL_M1}, {0x0601, CMN_PDIAG_PLL1_CLK_SEL_M0} From patchwork Fri Aug 7 11:46:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Swapnil Jakhade X-Patchwork-Id: 254016 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DF3DCC433E0 for ; Fri, 7 Aug 2020 11:46:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A9AA92075D for ; Fri, 7 Aug 2020 11:46:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=cadence.com header.i=@cadence.com header.b="mA8tdtDc"; dkim=pass (1024-bit key) header.d=cadence.com header.i=@cadence.com header.b="mx99qd++" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728433AbgHGLqs (ORCPT ); Fri, 7 Aug 2020 07:46:48 -0400 Received: from mx0b-0014ca01.pphosted.com ([208.86.201.193]:51172 "EHLO mx0a-0014ca01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728408AbgHGLqn (ORCPT ); Fri, 7 Aug 2020 07:46:43 -0400 Received: from pps.filterd (m0042333.ppops.net [127.0.0.1]) by mx0b-0014ca01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 077BjPvU031439; Fri, 7 Aug 2020 04:46:31 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cadence.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=proofpoint; bh=90C7THb0gvJ3YxTErY2NvXP0pa1QNssNKm4Y6moWSJQ=; b=mA8tdtDc3pKfaNmdPS9SnlbiEzDtgozhSfLD2oMo3kFfvi5u9+wg0a0cpjNUJ/aQw/0F MXV2aUS48UKB0kSDKYhmNfSRjtTiwm0IwmygGfhdpt9512ZKaVrDzWcdHV3N0tF1th02 n20V7HRPnKfHiFuacCaCId4onnNAB0no62GYyRBjVftgy/B7OgPuXYIQNtCrJiAVoTDO kVdESuf5uhFiUm9cARWenlJwtriVqbLa3hTUu3eId3rENhsoQIOh/+dy0Psf5cmIX0Z/ 5O7q/QxSPRb9+n48+urUKr9FrwbgXyigJ50SN/xCNUfSwpWakRAWTuxhiZMdeLXmi0lU 7g== Received: from nam04-co1-obe.outbound.protection.outlook.com (mail-co1nam04lp2055.outbound.protection.outlook.com [104.47.45.55]) by mx0b-0014ca01.pphosted.com with ESMTP id 32n8gy61d6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 07 Aug 2020 04:46:31 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=K1G5ZzTAQyeKKDT1X1OwvbUduHMpDxD/9hjOcMgxUqRhMmfyWQwjjxL/KFLD/8yAobcbQit7/hX2F5ewt91dAaIeLYNPtTGsg5lV6+1hVrsTRr4JGUp2YLhzADmrBqxfcMgLhj9uTVTN/3ma4GkLb81z4SuVWEvz/VFUMfcPUtxsOvcK7HSg4xk4Y8ZBGNyxwlKyEHF15emXJnVpiysvAP7RsTQ20AAiOvycr3QgsN0Cevm2zJ02xEHbGZYD1YGyM++af4yS55JkcriIaWKBmAwnu5+7DDXzg3ap1exasgUGSqlgPzbc8M+m7SE83PcbedJA5swI8p+9d3VDqUJXDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=90C7THb0gvJ3YxTErY2NvXP0pa1QNssNKm4Y6moWSJQ=; b=WfA/oCdmKURBxy9jSxVC1wHvQZgk4YHjNuEmRSLFUg2J6Tc8iSQEy7S4+CVFsswq7GIoyXqHjaZ2U2KyRsCsh3ynY3l1RcAqPV+7UqQsDxTdcsHMrrkl2O0YcXP2XQDReaoFAmvyRPGzssWSQSjmKCmOCy5U1jDesPcRHrXjGW4at6ehe13IEk0IhQFAoCrlGZL5PmNTc3TDMTEJ7wSMIjl/FFtdgmo0NT2pd+iAHf7FBqqPFowmopUNAbqOsVELJP4OIUI8O1qT5Wnnzeexj69LhVe/8aNpFG8155sadNc9dwyqu4twLZT/Swj2dotSwSBIo7jSNVEA4yoeiQTfLQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 199.43.4.23) smtp.rcpttodomain=kernel.org smtp.mailfrom=cadence.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=cadence.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cadence.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=90C7THb0gvJ3YxTErY2NvXP0pa1QNssNKm4Y6moWSJQ=; b=mx99qd++nC04H3VIXzMWYS6Xb5jB8iTEQ4sLofPVTl64rZmuMswAPjuNgiA+Hs1M6gRIyvFYrF6eBE9UyeDRTjPcCM62dI0/i7AHC4syCG6tnHyYaOKoIzGtXMI3vsIAk5KA1np2aV64cC5URarqzOgqe1qpnnADyyvnL1pidtw= Received: from BN0PR02CA0025.namprd02.prod.outlook.com (2603:10b6:408:e4::30) by SN4PR0701MB3741.namprd07.prod.outlook.com (2603:10b6:803:46::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3239.18; Fri, 7 Aug 2020 11:46:27 +0000 Received: from BN8NAM12FT025.eop-nam12.prod.protection.outlook.com (2603:10b6:408:e4:cafe::71) by BN0PR02CA0025.outlook.office365.com (2603:10b6:408:e4::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.18 via Frontend Transport; Fri, 7 Aug 2020 11:46:27 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 199.43.4.23) smtp.mailfrom=cadence.com; kernel.org; dkim=none (message not signed) header.d=none; kernel.org; dmarc=pass action=none header.from=cadence.com; Received-SPF: Pass (protection.outlook.com: domain of cadence.com designates 199.43.4.23 as permitted sender) receiver=protection.outlook.com; client-ip=199.43.4.23; helo=rmmaillnx1.cadence.com; Received: from rmmaillnx1.cadence.com (199.43.4.23) by BN8NAM12FT025.mail.protection.outlook.com (10.13.183.228) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.10 via Frontend Transport; Fri, 7 Aug 2020 11:46:26 +0000 Received: from maileu3.global.cadence.com (maileu3.cadence.com [10.160.88.99]) by rmmaillnx1.cadence.com (8.14.4/8.14.4) with ESMTP id 077Bk9PI029785 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=OK); Fri, 7 Aug 2020 07:46:25 -0400 X-CrossPremisesHeadersFilteredBySendConnector: maileu3.global.cadence.com Received: from maileu3.global.cadence.com (10.160.88.99) by maileu3.global.cadence.com (10.160.88.99) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Fri, 7 Aug 2020 13:46:10 +0200 Received: from vleu-orange.cadence.com (10.160.88.83) by maileu3.global.cadence.com (10.160.88.99) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Fri, 7 Aug 2020 13:46:10 +0200 Received: from vleu-orange.cadence.com (localhost.localdomain [127.0.0.1]) by vleu-orange.cadence.com (8.14.4/8.14.4) with ESMTP id 077Bk9hV000877; Fri, 7 Aug 2020 13:46:09 +0200 Received: (from sjakhade@localhost) by vleu-orange.cadence.com (8.14.4/8.14.4/Submit) id 077Bk93d000876; Fri, 7 Aug 2020 13:46:09 +0200 From: Swapnil Jakhade To: , , , , , CC: , , , , , Subject: [PATCH v1 13/13] phy: cadence-torrent: Add USB + SGMII/QSGMII multilink configuration Date: Fri, 7 Aug 2020 13:46:07 +0200 Message-ID: <1596800767-784-14-git-send-email-sjakhade@cadence.com> X-Mailer: git-send-email 2.4.5 In-Reply-To: <1596800767-784-1-git-send-email-sjakhade@cadence.com> References: <1596800767-784-1-git-send-email-sjakhade@cadence.com> MIME-Version: 1.0 X-OrganizationHeadersPreserved: maileu3.global.cadence.com X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9a9b9233-00c3-498b-d8bb-08d83ac7847c X-MS-TrafficTypeDiagnostic: SN4PR0701MB3741: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:296; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VJ2FtPxn6hDOpPHVYhpJYlnsty7VwXcfTfhYLbwOkJqJQXsYd27Nc6A4V8sJHIcfPCWoAFKsswevKCNSaupamf/zzNB/PmdB4JRu5umkOLZ+s/IGPh9toVx//OKVtEUiTBGQ+bUQTODfNUIFnyGfOFM+ETc8mwHpWswB/JhyhTgL4wH51xAg+OQcUmSAdZEbBwLysDYtrMuH7TsKuoh86wArZQyuQKdL5+34ehbyvKYlcksTbteYkvit38AncWvvCfzqTmOh7cdj6PTVcdr6nEDGz3uVCP9k1gCZs3JNmu8EOVRZWm+I3K6Grxf+8swzvy6qVC16THVUTNMjRDMXNghWDnjWb1GhDW19P/ghtg5qS6ZJ12+aIvDGlpx19dhvBqaWl2X5Eb2wuUT9DH1G+RYaRujJ1UKv6OEkBU1VoFk= X-Forefront-Antispam-Report: CIP:199.43.4.23; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:rmmaillnx1.cadence.com; PTR:InfoDomainNonexistent; CAT:NONE; SFTY:; SFS:(4636009)(39860400002)(396003)(136003)(346002)(376002)(36092001)(46966005)(54906003)(70586007)(110136005)(86362001)(8936002)(426003)(70206006)(36906005)(42186006)(316002)(336012)(2616005)(36756003)(4326008)(81166007)(356005)(2906002)(82310400002)(26005)(478600001)(82740400003)(30864003)(186003)(47076004)(5660300002)(8676002); DIR:OUT; SFP:1101; X-OriginatorOrg: cadence.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2020 11:46:26.8232 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9a9b9233-00c3-498b-d8bb-08d83ac7847c X-MS-Exchange-CrossTenant-Id: d36035c5-6ce6-4662-a3dc-e762e61ae4c9 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=d36035c5-6ce6-4662-a3dc-e762e61ae4c9; Ip=[199.43.4.23]; Helo=[rmmaillnx1.cadence.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM12FT025.eop-nam12.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN4PR0701MB3741 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-08-07_08:2020-08-06,2020-08-07 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_check_notspam policy=outbound_check score=0 malwarescore=0 phishscore=0 mlxlogscore=831 impostorscore=0 priorityscore=1501 bulkscore=0 suspectscore=0 spamscore=0 mlxscore=0 clxscore=1015 adultscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2008070085 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Add USB + SGMII/QSGMII multilink configuration sequences. Signed-off-by: Swapnil Jakhade --- drivers/phy/cadence/phy-cadence-torrent.c | 254 ++++++++++++++++++++++ 1 file changed, 254 insertions(+) diff --git a/drivers/phy/cadence/phy-cadence-torrent.c b/drivers/phy/cadence/phy-cadence-torrent.c index 3eafb72014fa..124d00e07f85 100644 --- a/drivers/phy/cadence/phy-cadence-torrent.c +++ b/drivers/phy/cadence/phy-cadence-torrent.c @@ -2346,6 +2346,40 @@ static int cdns_torrent_phy_remove(struct platform_device *pdev) return 0; } +/* USB and SGMII/QSGMII link configuration */ +static struct cdns_reg_pairs usb_sgmii_link_cmn_regs[] = { + {0x0002, PHY_PLL_CFG}, + {0x8600, CMN_PDIAG_PLL0_CLK_SEL_M0}, + {0x0601, CMN_PDIAG_PLL1_CLK_SEL_M0} +}; + +static struct cdns_reg_pairs usb_sgmii_xcvr_diag_ln_regs[] = { + {0x0000, XCVR_DIAG_HSCLK_SEL}, + {0x0001, XCVR_DIAG_HSCLK_DIV}, + {0x0041, XCVR_DIAG_PLLDRC_CTRL} +}; + +static struct cdns_reg_pairs sgmii_usb_xcvr_diag_ln_regs[] = { + {0x0011, XCVR_DIAG_HSCLK_SEL}, + {0x0003, XCVR_DIAG_HSCLK_DIV}, + {0x009B, XCVR_DIAG_PLLDRC_CTRL} +}; + +static struct cdns_torrent_vals usb_sgmii_link_cmn_vals = { + .reg_pairs = usb_sgmii_link_cmn_regs, + .num_regs = ARRAY_SIZE(usb_sgmii_link_cmn_regs), +}; + +static struct cdns_torrent_vals usb_sgmii_xcvr_diag_ln_vals = { + .reg_pairs = usb_sgmii_xcvr_diag_ln_regs, + .num_regs = ARRAY_SIZE(usb_sgmii_xcvr_diag_ln_regs), +}; + +static struct cdns_torrent_vals sgmii_usb_xcvr_diag_ln_vals = { + .reg_pairs = sgmii_usb_xcvr_diag_ln_regs, + .num_regs = ARRAY_SIZE(sgmii_usb_xcvr_diag_ln_regs), +}; + /* PCIe and USB Unique SSC link configuration */ static struct cdns_reg_pairs pcie_usb_link_cmn_regs[] = { {0x0003, PHY_PLL_CFG}, @@ -3019,6 +3053,11 @@ static const struct cdns_torrent_data cdns_map_torrent = { [EXTERNAL_SSC] = &pcie_sgmii_link_cmn_vals, [INTERNAL_SSC] = &pcie_sgmii_link_cmn_vals, }, + [TYPE_USB] = { + [NO_SSC] = &usb_sgmii_link_cmn_vals, + [EXTERNAL_SSC] = &usb_sgmii_link_cmn_vals, + [INTERNAL_SSC] = &usb_sgmii_link_cmn_vals, + }, }, [TYPE_QSGMII] = { [TYPE_NONE] = { @@ -3029,6 +3068,11 @@ static const struct cdns_torrent_data cdns_map_torrent = { [EXTERNAL_SSC] = &pcie_sgmii_link_cmn_vals, [INTERNAL_SSC] = &pcie_sgmii_link_cmn_vals, }, + [TYPE_USB] = { + [NO_SSC] = &usb_sgmii_link_cmn_vals, + [EXTERNAL_SSC] = &usb_sgmii_link_cmn_vals, + [INTERNAL_SSC] = &usb_sgmii_link_cmn_vals, + }, }, [TYPE_USB] = { [TYPE_NONE] = { @@ -3041,6 +3085,16 @@ static const struct cdns_torrent_data cdns_map_torrent = { [EXTERNAL_SSC] = &pcie_usb_link_cmn_vals, [INTERNAL_SSC] = &pcie_usb_link_cmn_vals, }, + [TYPE_SGMII] = { + [NO_SSC] = &usb_sgmii_link_cmn_vals, + [EXTERNAL_SSC] = &usb_sgmii_link_cmn_vals, + [INTERNAL_SSC] = &usb_sgmii_link_cmn_vals, + }, + [TYPE_QSGMII] = { + [NO_SSC] = &usb_sgmii_link_cmn_vals, + [EXTERNAL_SSC] = &usb_sgmii_link_cmn_vals, + [INTERNAL_SSC] = &usb_sgmii_link_cmn_vals, + }, }, }, .xcvr_diag_vals = { @@ -3075,6 +3129,11 @@ static const struct cdns_torrent_data cdns_map_torrent = { [EXTERNAL_SSC] = &sgmii_pcie_xcvr_diag_ln_vals, [INTERNAL_SSC] = &sgmii_pcie_xcvr_diag_ln_vals, }, + [TYPE_USB] = { + [NO_SSC] = &sgmii_usb_xcvr_diag_ln_vals, + [EXTERNAL_SSC] = &sgmii_usb_xcvr_diag_ln_vals, + [INTERNAL_SSC] = &sgmii_usb_xcvr_diag_ln_vals, + }, }, [TYPE_QSGMII] = { [TYPE_NONE] = { @@ -3085,6 +3144,11 @@ static const struct cdns_torrent_data cdns_map_torrent = { [EXTERNAL_SSC] = &sgmii_pcie_xcvr_diag_ln_vals, [INTERNAL_SSC] = &sgmii_pcie_xcvr_diag_ln_vals, }, + [TYPE_USB] = { + [NO_SSC] = &sgmii_usb_xcvr_diag_ln_vals, + [EXTERNAL_SSC] = &sgmii_usb_xcvr_diag_ln_vals, + [INTERNAL_SSC] = &sgmii_usb_xcvr_diag_ln_vals, + }, }, [TYPE_USB] = { [TYPE_NONE] = { @@ -3097,6 +3161,16 @@ static const struct cdns_torrent_data cdns_map_torrent = { [EXTERNAL_SSC] = &usb_pcie_xcvr_diag_ln_vals, [INTERNAL_SSC] = &usb_pcie_xcvr_diag_ln_vals, }, + [TYPE_SGMII] = { + [NO_SSC] = &usb_sgmii_xcvr_diag_ln_vals, + [EXTERNAL_SSC] = &usb_sgmii_xcvr_diag_ln_vals, + [INTERNAL_SSC] = &usb_sgmii_xcvr_diag_ln_vals, + }, + [TYPE_QSGMII] = { + [NO_SSC] = &usb_sgmii_xcvr_diag_ln_vals, + [EXTERNAL_SSC] = &usb_sgmii_xcvr_diag_ln_vals, + [INTERNAL_SSC] = &usb_sgmii_xcvr_diag_ln_vals, + }, }, }, .pcs_cmn_vals = { @@ -3111,6 +3185,16 @@ static const struct cdns_torrent_data cdns_map_torrent = { [EXTERNAL_SSC] = &usb_phy_pcs_cmn_vals, [INTERNAL_SSC] = &usb_phy_pcs_cmn_vals, }, + [TYPE_SGMII] = { + [NO_SSC] = &usb_phy_pcs_cmn_vals, + [EXTERNAL_SSC] = &usb_phy_pcs_cmn_vals, + [INTERNAL_SSC] = &usb_phy_pcs_cmn_vals, + }, + [TYPE_QSGMII] = { + [NO_SSC] = &usb_phy_pcs_cmn_vals, + [EXTERNAL_SSC] = &usb_phy_pcs_cmn_vals, + [INTERNAL_SSC] = &usb_phy_pcs_cmn_vals, + }, }, }, .cmn_vals = { @@ -3145,6 +3229,11 @@ static const struct cdns_torrent_data cdns_map_torrent = { [EXTERNAL_SSC] = &sgmii_100_no_ssc_cmn_vals, [INTERNAL_SSC] = &sgmii_100_int_ssc_cmn_vals, }, + [TYPE_USB] = { + [NO_SSC] = &sgmii_100_no_ssc_cmn_vals, + [EXTERNAL_SSC] = &sgmii_100_no_ssc_cmn_vals, + [INTERNAL_SSC] = &sgmii_100_no_ssc_cmn_vals, + }, }, [TYPE_QSGMII] = { [TYPE_NONE] = { @@ -3155,6 +3244,11 @@ static const struct cdns_torrent_data cdns_map_torrent = { [EXTERNAL_SSC] = &qsgmii_100_no_ssc_cmn_vals, [INTERNAL_SSC] = &qsgmii_100_int_ssc_cmn_vals, }, + [TYPE_USB] = { + [NO_SSC] = &qsgmii_100_no_ssc_cmn_vals, + [EXTERNAL_SSC] = &qsgmii_100_no_ssc_cmn_vals, + [INTERNAL_SSC] = &qsgmii_100_no_ssc_cmn_vals, + }, }, [TYPE_USB] = { [TYPE_NONE] = { @@ -3167,6 +3261,16 @@ static const struct cdns_torrent_data cdns_map_torrent = { [EXTERNAL_SSC] = &usb_100_no_ssc_cmn_vals, [INTERNAL_SSC] = &usb_100_int_ssc_cmn_vals, }, + [TYPE_SGMII] = { + [NO_SSC] = &usb_100_no_ssc_cmn_vals, + [EXTERNAL_SSC] = &usb_100_no_ssc_cmn_vals, + [INTERNAL_SSC] = &sl_usb_100_int_ssc_cmn_vals, + }, + [TYPE_QSGMII] = { + [NO_SSC] = &usb_100_no_ssc_cmn_vals, + [EXTERNAL_SSC] = &usb_100_no_ssc_cmn_vals, + [INTERNAL_SSC] = &sl_usb_100_int_ssc_cmn_vals, + }, }, }, .tx_ln_vals = { @@ -3201,6 +3305,11 @@ static const struct cdns_torrent_data cdns_map_torrent = { [EXTERNAL_SSC] = &sgmii_100_no_ssc_tx_ln_vals, [INTERNAL_SSC] = &sgmii_100_no_ssc_tx_ln_vals, }, + [TYPE_USB] = { + [NO_SSC] = &sgmii_100_no_ssc_tx_ln_vals, + [EXTERNAL_SSC] = &sgmii_100_no_ssc_tx_ln_vals, + [INTERNAL_SSC] = &sgmii_100_no_ssc_tx_ln_vals, + }, }, [TYPE_QSGMII] = { [TYPE_NONE] = { @@ -3211,6 +3320,11 @@ static const struct cdns_torrent_data cdns_map_torrent = { [EXTERNAL_SSC] = &qsgmii_100_no_ssc_tx_ln_vals, [INTERNAL_SSC] = &qsgmii_100_no_ssc_tx_ln_vals, }, + [TYPE_USB] = { + [NO_SSC] = &qsgmii_100_no_ssc_tx_ln_vals, + [EXTERNAL_SSC] = &qsgmii_100_no_ssc_tx_ln_vals, + [INTERNAL_SSC] = &qsgmii_100_no_ssc_tx_ln_vals, + }, }, [TYPE_USB] = { [TYPE_NONE] = { @@ -3223,6 +3337,16 @@ static const struct cdns_torrent_data cdns_map_torrent = { [EXTERNAL_SSC] = &usb_100_no_ssc_tx_ln_vals, [INTERNAL_SSC] = &usb_100_no_ssc_tx_ln_vals, }, + [TYPE_SGMII] = { + [NO_SSC] = &usb_100_no_ssc_tx_ln_vals, + [EXTERNAL_SSC] = &usb_100_no_ssc_tx_ln_vals, + [INTERNAL_SSC] = &usb_100_no_ssc_tx_ln_vals, + }, + [TYPE_QSGMII] = { + [NO_SSC] = &usb_100_no_ssc_tx_ln_vals, + [EXTERNAL_SSC] = &usb_100_no_ssc_tx_ln_vals, + [INTERNAL_SSC] = &usb_100_no_ssc_tx_ln_vals, + }, }, }, .rx_ln_vals = { @@ -3257,6 +3381,11 @@ static const struct cdns_torrent_data cdns_map_torrent = { [EXTERNAL_SSC] = &sgmii_100_no_ssc_rx_ln_vals, [INTERNAL_SSC] = &sgmii_100_no_ssc_rx_ln_vals, }, + [TYPE_USB] = { + [NO_SSC] = &sgmii_100_no_ssc_rx_ln_vals, + [EXTERNAL_SSC] = &sgmii_100_no_ssc_rx_ln_vals, + [INTERNAL_SSC] = &sgmii_100_no_ssc_rx_ln_vals, + }, }, [TYPE_QSGMII] = { [TYPE_NONE] = { @@ -3267,6 +3396,11 @@ static const struct cdns_torrent_data cdns_map_torrent = { [EXTERNAL_SSC] = &qsgmii_100_no_ssc_rx_ln_vals, [INTERNAL_SSC] = &qsgmii_100_no_ssc_rx_ln_vals, }, + [TYPE_USB] = { + [NO_SSC] = &qsgmii_100_no_ssc_rx_ln_vals, + [EXTERNAL_SSC] = &qsgmii_100_no_ssc_rx_ln_vals, + [INTERNAL_SSC] = &qsgmii_100_no_ssc_rx_ln_vals, + }, }, [TYPE_USB] = { [TYPE_NONE] = { @@ -3279,6 +3413,16 @@ static const struct cdns_torrent_data cdns_map_torrent = { [EXTERNAL_SSC] = &usb_100_no_ssc_rx_ln_vals, [INTERNAL_SSC] = &usb_100_no_ssc_rx_ln_vals, }, + [TYPE_SGMII] = { + [NO_SSC] = &usb_100_no_ssc_rx_ln_vals, + [EXTERNAL_SSC] = &usb_100_no_ssc_rx_ln_vals, + [INTERNAL_SSC] = &usb_100_no_ssc_rx_ln_vals, + }, + [TYPE_QSGMII] = { + [NO_SSC] = &usb_100_no_ssc_rx_ln_vals, + [EXTERNAL_SSC] = &usb_100_no_ssc_rx_ln_vals, + [INTERNAL_SSC] = &usb_100_no_ssc_rx_ln_vals, + }, }, }, }; @@ -3318,6 +3462,11 @@ static const struct cdns_torrent_data ti_j721e_map_torrent = { [EXTERNAL_SSC] = &pcie_sgmii_link_cmn_vals, [INTERNAL_SSC] = &pcie_sgmii_link_cmn_vals, }, + [TYPE_USB] = { + [NO_SSC] = &usb_sgmii_link_cmn_vals, + [EXTERNAL_SSC] = &usb_sgmii_link_cmn_vals, + [INTERNAL_SSC] = &usb_sgmii_link_cmn_vals, + }, }, [TYPE_QSGMII] = { [TYPE_NONE] = { @@ -3328,6 +3477,11 @@ static const struct cdns_torrent_data ti_j721e_map_torrent = { [EXTERNAL_SSC] = &pcie_sgmii_link_cmn_vals, [INTERNAL_SSC] = &pcie_sgmii_link_cmn_vals, }, + [TYPE_USB] = { + [NO_SSC] = &usb_sgmii_link_cmn_vals, + [EXTERNAL_SSC] = &usb_sgmii_link_cmn_vals, + [INTERNAL_SSC] = &usb_sgmii_link_cmn_vals, + }, }, [TYPE_USB] = { [TYPE_NONE] = { @@ -3340,6 +3494,16 @@ static const struct cdns_torrent_data ti_j721e_map_torrent = { [EXTERNAL_SSC] = &pcie_usb_link_cmn_vals, [INTERNAL_SSC] = &pcie_usb_link_cmn_vals, }, + [TYPE_SGMII] = { + [NO_SSC] = &usb_sgmii_link_cmn_vals, + [EXTERNAL_SSC] = &usb_sgmii_link_cmn_vals, + [INTERNAL_SSC] = &usb_sgmii_link_cmn_vals, + }, + [TYPE_QSGMII] = { + [NO_SSC] = &usb_sgmii_link_cmn_vals, + [EXTERNAL_SSC] = &usb_sgmii_link_cmn_vals, + [INTERNAL_SSC] = &usb_sgmii_link_cmn_vals, + }, }, }, .xcvr_diag_vals = { @@ -3374,6 +3538,11 @@ static const struct cdns_torrent_data ti_j721e_map_torrent = { [EXTERNAL_SSC] = &sgmii_pcie_xcvr_diag_ln_vals, [INTERNAL_SSC] = &sgmii_pcie_xcvr_diag_ln_vals, }, + [TYPE_USB] = { + [NO_SSC] = &sgmii_usb_xcvr_diag_ln_vals, + [EXTERNAL_SSC] = &sgmii_usb_xcvr_diag_ln_vals, + [INTERNAL_SSC] = &sgmii_usb_xcvr_diag_ln_vals, + }, }, [TYPE_QSGMII] = { [TYPE_NONE] = { @@ -3384,6 +3553,11 @@ static const struct cdns_torrent_data ti_j721e_map_torrent = { [EXTERNAL_SSC] = &sgmii_pcie_xcvr_diag_ln_vals, [INTERNAL_SSC] = &sgmii_pcie_xcvr_diag_ln_vals, }, + [TYPE_USB] = { + [NO_SSC] = &sgmii_usb_xcvr_diag_ln_vals, + [EXTERNAL_SSC] = &sgmii_usb_xcvr_diag_ln_vals, + [INTERNAL_SSC] = &sgmii_usb_xcvr_diag_ln_vals, + }, }, [TYPE_USB] = { [TYPE_NONE] = { @@ -3396,6 +3570,16 @@ static const struct cdns_torrent_data ti_j721e_map_torrent = { [EXTERNAL_SSC] = &usb_pcie_xcvr_diag_ln_vals, [INTERNAL_SSC] = &usb_pcie_xcvr_diag_ln_vals, }, + [TYPE_SGMII] = { + [NO_SSC] = &usb_sgmii_xcvr_diag_ln_vals, + [EXTERNAL_SSC] = &usb_sgmii_xcvr_diag_ln_vals, + [INTERNAL_SSC] = &usb_sgmii_xcvr_diag_ln_vals, + }, + [TYPE_QSGMII] = { + [NO_SSC] = &usb_sgmii_xcvr_diag_ln_vals, + [EXTERNAL_SSC] = &usb_sgmii_xcvr_diag_ln_vals, + [INTERNAL_SSC] = &usb_sgmii_xcvr_diag_ln_vals, + }, }, }, .pcs_cmn_vals = { @@ -3410,6 +3594,16 @@ static const struct cdns_torrent_data ti_j721e_map_torrent = { [EXTERNAL_SSC] = &usb_phy_pcs_cmn_vals, [INTERNAL_SSC] = &usb_phy_pcs_cmn_vals, }, + [TYPE_SGMII] = { + [NO_SSC] = &usb_phy_pcs_cmn_vals, + [EXTERNAL_SSC] = &usb_phy_pcs_cmn_vals, + [INTERNAL_SSC] = &usb_phy_pcs_cmn_vals, + }, + [TYPE_QSGMII] = { + [NO_SSC] = &usb_phy_pcs_cmn_vals, + [EXTERNAL_SSC] = &usb_phy_pcs_cmn_vals, + [INTERNAL_SSC] = &usb_phy_pcs_cmn_vals, + }, }, }, .cmn_vals = { @@ -3444,6 +3638,11 @@ static const struct cdns_torrent_data ti_j721e_map_torrent = { [EXTERNAL_SSC] = &sgmii_100_no_ssc_cmn_vals, [INTERNAL_SSC] = &sgmii_100_int_ssc_cmn_vals, }, + [TYPE_USB] = { + [NO_SSC] = &sgmii_100_no_ssc_cmn_vals, + [EXTERNAL_SSC] = &sgmii_100_no_ssc_cmn_vals, + [INTERNAL_SSC] = &sgmii_100_no_ssc_cmn_vals, + }, }, [TYPE_QSGMII] = { [TYPE_NONE] = { @@ -3454,6 +3653,11 @@ static const struct cdns_torrent_data ti_j721e_map_torrent = { [EXTERNAL_SSC] = &qsgmii_100_no_ssc_cmn_vals, [INTERNAL_SSC] = &qsgmii_100_int_ssc_cmn_vals, }, + [TYPE_USB] = { + [NO_SSC] = &qsgmii_100_no_ssc_cmn_vals, + [EXTERNAL_SSC] = &qsgmii_100_no_ssc_cmn_vals, + [INTERNAL_SSC] = &qsgmii_100_no_ssc_cmn_vals, + }, }, [TYPE_USB] = { [TYPE_NONE] = { @@ -3466,6 +3670,16 @@ static const struct cdns_torrent_data ti_j721e_map_torrent = { [EXTERNAL_SSC] = &usb_100_no_ssc_cmn_vals, [INTERNAL_SSC] = &usb_100_int_ssc_cmn_vals, }, + [TYPE_SGMII] = { + [NO_SSC] = &usb_100_no_ssc_cmn_vals, + [EXTERNAL_SSC] = &usb_100_no_ssc_cmn_vals, + [INTERNAL_SSC] = &sl_usb_100_int_ssc_cmn_vals, + }, + [TYPE_QSGMII] = { + [NO_SSC] = &usb_100_no_ssc_cmn_vals, + [EXTERNAL_SSC] = &usb_100_no_ssc_cmn_vals, + [INTERNAL_SSC] = &sl_usb_100_int_ssc_cmn_vals, + }, }, }, .tx_ln_vals = { @@ -3500,6 +3714,11 @@ static const struct cdns_torrent_data ti_j721e_map_torrent = { [EXTERNAL_SSC] = &sgmii_100_no_ssc_tx_ln_vals, [INTERNAL_SSC] = &sgmii_100_no_ssc_tx_ln_vals, }, + [TYPE_USB] = { + [NO_SSC] = &sgmii_100_no_ssc_tx_ln_vals, + [EXTERNAL_SSC] = &sgmii_100_no_ssc_tx_ln_vals, + [INTERNAL_SSC] = &sgmii_100_no_ssc_tx_ln_vals, + }, }, [TYPE_QSGMII] = { [TYPE_NONE] = { @@ -3510,6 +3729,11 @@ static const struct cdns_torrent_data ti_j721e_map_torrent = { [EXTERNAL_SSC] = &qsgmii_100_no_ssc_tx_ln_vals, [INTERNAL_SSC] = &qsgmii_100_no_ssc_tx_ln_vals, }, + [TYPE_USB] = { + [NO_SSC] = &qsgmii_100_no_ssc_tx_ln_vals, + [EXTERNAL_SSC] = &qsgmii_100_no_ssc_tx_ln_vals, + [INTERNAL_SSC] = &qsgmii_100_no_ssc_tx_ln_vals, + }, }, [TYPE_USB] = { [TYPE_NONE] = { @@ -3522,6 +3746,16 @@ static const struct cdns_torrent_data ti_j721e_map_torrent = { [EXTERNAL_SSC] = &usb_100_no_ssc_tx_ln_vals, [INTERNAL_SSC] = &usb_100_no_ssc_tx_ln_vals, }, + [TYPE_SGMII] = { + [NO_SSC] = &usb_100_no_ssc_tx_ln_vals, + [EXTERNAL_SSC] = &usb_100_no_ssc_tx_ln_vals, + [INTERNAL_SSC] = &usb_100_no_ssc_tx_ln_vals, + }, + [TYPE_QSGMII] = { + [NO_SSC] = &usb_100_no_ssc_tx_ln_vals, + [EXTERNAL_SSC] = &usb_100_no_ssc_tx_ln_vals, + [INTERNAL_SSC] = &usb_100_no_ssc_tx_ln_vals, + }, }, }, .rx_ln_vals = { @@ -3556,6 +3790,11 @@ static const struct cdns_torrent_data ti_j721e_map_torrent = { [EXTERNAL_SSC] = &sgmii_100_no_ssc_rx_ln_vals, [INTERNAL_SSC] = &sgmii_100_no_ssc_rx_ln_vals, }, + [TYPE_USB] = { + [NO_SSC] = &sgmii_100_no_ssc_rx_ln_vals, + [EXTERNAL_SSC] = &sgmii_100_no_ssc_rx_ln_vals, + [INTERNAL_SSC] = &sgmii_100_no_ssc_rx_ln_vals, + }, }, [TYPE_QSGMII] = { [TYPE_NONE] = { @@ -3566,6 +3805,11 @@ static const struct cdns_torrent_data ti_j721e_map_torrent = { [EXTERNAL_SSC] = &qsgmii_100_no_ssc_rx_ln_vals, [INTERNAL_SSC] = &qsgmii_100_no_ssc_rx_ln_vals, }, + [TYPE_USB] = { + [NO_SSC] = &qsgmii_100_no_ssc_rx_ln_vals, + [EXTERNAL_SSC] = &qsgmii_100_no_ssc_rx_ln_vals, + [INTERNAL_SSC] = &qsgmii_100_no_ssc_rx_ln_vals, + }, }, [TYPE_USB] = { [TYPE_NONE] = { @@ -3578,6 +3822,16 @@ static const struct cdns_torrent_data ti_j721e_map_torrent = { [EXTERNAL_SSC] = &usb_100_no_ssc_rx_ln_vals, [INTERNAL_SSC] = &usb_100_no_ssc_rx_ln_vals, }, + [TYPE_SGMII] = { + [NO_SSC] = &usb_100_no_ssc_rx_ln_vals, + [EXTERNAL_SSC] = &usb_100_no_ssc_rx_ln_vals, + [INTERNAL_SSC] = &usb_100_no_ssc_rx_ln_vals, + }, + [TYPE_QSGMII] = { + [NO_SSC] = &usb_100_no_ssc_rx_ln_vals, + [EXTERNAL_SSC] = &usb_100_no_ssc_rx_ln_vals, + [INTERNAL_SSC] = &usb_100_no_ssc_rx_ln_vals, + }, }, }, };