From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 037D5606A31A for ; Wed, 2 Dec 2026 14:53:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=U77mhsRU; dkim=fail reason="signature verification failed" (2048-bit key, unprotected) header.d=Nvidia.com header.i=@Nvidia.com header.a=rsa-sha256 header.s=selector2 header.b=L/FmatOz DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:CC:To:In-Reply-To:References:Message-ID :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Unsubscribe-Post:List-Owner; bh=QjFxsj9B4ssFmv761lw4GZXJe24n6sjQdsvjww2h4SY=; b=U77mhsRUkzEJCgY3uK3OT6D/Mn 7a6U7lGR3uZu9KM+02KYjvtorGQBdF7QdXUXfaPtmWiohc9sN6yhDMp3RSDQpMCE6SNb6mv+75PX2 KREAJHL4ej9PnH8HhUjttP96ERQv9BtR8QJhxXo7Ep3Yspppw/qA0J10CJZHrDYWRZhqQ1nJJr9va Ml4h7yXv1P/lJUt/qyC3gdzra7P6m+xeM/UVpttHClwR3JBj1hJRNvUg/n1GBJLExByJxfdv7qSYS FIATWGBZXfNFBwjzvJlvDBBLeUagfAhGgtzxUh45eql3pJDkmznai7/JmXcQlCnzCEZziq6OuchC/ /4jztbDA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYlhz-0000000Bocw-35Hc; Wed, 02 Dec 2026 14:53:23 +0000 Received: from mail-westusazlp170120002.outbound.protection.outlook.com ([2a01:111:f403:c001::2] helo=SJ2PR03CU001.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYlhv-0000000Boa6-2JgA for linux-phy@lists.infradead.org; Wed, 02 Dec 2026 14:53:22 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=lIt1qIjdB7AxULxjT1n5+gXcjci45EJmiKd85aS/CHcDEV8XgyiKr0F4BNFVoXYs45EY5NzXOa2beZ6tp46O4TypgFY0y1q/686eqCgZLlkaee+wEWHWltzGYDlm/TQ/VRzQ98G6OBQVQoFA+ylaiY1Rs1wtlJ7hPouCci6hU/YV6uQo5vB9+aSQgOEREbxdAyH4Na4p2gThcQ6VcAeHihiwp8j+IoJH5RUUbfMQIw7Nu5hZ9hYAlCV1AgQC7zRsNC6dEqnyTe8H6uNm1GfaRnCR7ewqoSAYhDPYfEOaVKBw+nyfgF+J5/lJRVgQsQa7uCkVbZ5dcX0sHeZXjA3CSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=kB0Nika2/e11AnyEHb3i2El/monqidxxwgApIL30nfc=; b=x+7IKIrSWDQS1ubFpwg1wgaY8thsWU+ziqHU56SMIItuE/CErOJXKpy9ru0Q2L77FI7mK/K+LZkei0FUj4lI++2DBEQnXa54jJ+Gbv/2L2dN829Wm7oS4v1rSiGutirMiUJZWwvYtzr2McpjMAtnrNt4u9YD9MFQ2VxRtHDWoLJKf1PQvvQSYAkmNaQ98zxULLKoivcYpJYZGRXh6Uv6+Ex9XsFJGkEn6IFrn8fxc+aKgg/s7xYYT8op7ri+ygmt/OkLqrdTSRuYnoQNK4EPlZ+TIG87KS1ASM5gSDN9tsh9Wr0e8Or8zqJw21wblidfj/n6YJCwDFVUgQ5o6Q0Y/w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=lists.infradead.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kB0Nika2/e11AnyEHb3i2El/monqidxxwgApIL30nfc=; b=L/FmatOzJ1WgyyHkv0xhc2D0AEivUR1ciTsOppmWOuJMy79Nsf5TSVoMIfciWQ+HxsLbL5arAOKb6yzvILS0HdgsVO37eRw2k/3xqEUUk3DtSr8Gfw7m/J7J7r0+BgdFlaqR5YXinVn/OsuCr8umOYheVkYtURW9IBI1mya5pB2HYqBhKoCXFYhGTmGdBMRi2umAyp7zxsISBlEO+EWjVc07V9jDPYlRPNhN5DgrgbS6FtO8Jm7pNTxgcPSeVJ25qn22pLHTIfKJTLO0rJTD3YooEroiMht9otMwIbg1q3Z5bUVxMohw3qI9JIp7a5x2G30zS8mZeTGEPc70WQSkzA== Received: from BL1PR13CA0417.namprd13.prod.outlook.com (2603:10b6:208:2c2::32) by MW4PR12MB7432.namprd12.prod.outlook.com (2603:10b6:303:22d::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.688.11; Wed, 2 Dec 2026 14:53:07 +0000 Received: from BN6PEPF00000072.namprd03.prod.outlook.com (2603:10b6:208:2c2:cafe::34) by BL1PR13CA0417.outlook.office365.com (2603:10b6:208:2c2::32) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.688.11 via Frontend Transport; Wed, 2 Dec 2026 14:53:07 +0000 X-MS-Exchange-Authentication-Results: mx.microsoft.com 1; spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by BN6PEPF00000072.mail.protection.outlook.com (10.167.248.199) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.688.5 via Frontend Transport; Wed, 2 Dec 2026 14:53:06 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57; Wed, 2 Dec 2026 06:52:44 -0800 Received: from [127.0.1.1] (10.126.231.37) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57; Wed, 2 Dec 2026 06:52:42 -0800 From: Jon Hunter Date: Wed, 2 Dec 2026 14:52:18 +0000 Subject: [PATCH v2 2/2] phy: tegra: xusb-tegra186: Extend Tegra264 fuse calibration X-Archived-By: MIME-Version: 1.0 Message-ID: <20261202-tegra-phy-tegra264-v2-2-2ef15ed73f2c@nvidia.com> References: <20261202-tegra-phy-tegra264-v2-0-2ef15ed73f2c@nvidia.com> In-Reply-To: <20261202-tegra-phy-tegra264-v2-0-2ef15ed73f2c@nvidia.com> To: Thierry Reding , JC Kuo , Vinod Koul , Neil Armstrong , Manivannan Sadhasivam CC: , , Jon Hunter , Wayne Chang X-Mailer: b4 0.16.1-dev X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN6PEPF00000072:EE_|MW4PR12MB7432:EE_ X-MS-Office365-Filtering-Correlation-Id: 776271d7-de39-4e85-67ac-08df5083f9b8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|376014|36860700016|1800799024|23010399003|11063799006|261009223027099003|22082099003|18002099003|56012099006|10067099003|261102130727099003|261102123227099003|261028144727099003|261026140227099003|261026121527099003|261021123027099003|261022075727099003|261022105027099003|261022113327099003|261021121427099003; X-Microsoft-Antispam-Message-Info: S+MxdawF//Fsm/ahqO4vmvZROA09cjDJo6rqq8qX0yYRs5Q6YQqkzMhGRrMFqySuxRtqBncjQDTY6Ev3PjUG5oE/06DXpuoUgjh35Eh/FMLAROXqJ18ZdnoTftlqBygqncoFsML1NQu3OqUiZo9E7boZIwgI9HvUK474/BiFXxInSOyQejIj66bPENbjThSZLK8bYMMNmd1zIgThHPMWcheXO8i6IsgrflWp6Pmf1DUBtC1gS1cGaHwdORf1ZPH/eSnl7avCvwicU0ClDd9Laqp8eyZ3jA3h18RS7Ewowc++lEWuj90HKU3s2e0yq+1G8FKG9jXY/eKhvIbySw6DM7bIUMgISfNTlfnOaRe+gZ8BLOlO8Uz6sXIl0fawOc9cEqICsApirXEiRr/iyI/KtlZ/seWY2XyRAFuCghTuNfbKIoTNnuPh3Y45hEEQZOjcHymcVibFa9/on1Io2yeE4w0koD56AQGDfmyOY4mT8MqCyWPtbknwKAs6rsgZ5aIqNt63i4pEM7lKpX64Cjjchi1XCAG0TbxbyvWhnAKst5m4/Rof2fUQ09KQY44cDymxcDibPJzm4JWwV593C7P4QU+GmqphB9N/ZJw53SDDKPz5Pil+xYtvgBsJYKN+y6ZkRfniE+3LpR1zJaJHzzQH5GsR1SmmNhqJKvJFunIdds2mpY25tq+IVtaLc1XxAvRqFh9qXVhp9FeVu9WU037pWQ== X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230040)(82310400026)(376014)(36860700016)(1800799024)(23010399003)(11063799006)(261009223027099003)(22082099003)(18002099003)(56012099006)(10067099003)(261102130727099003)(261102123227099003)(261028144727099003)(261026140227099003)(261026121527099003)(261021123027099003)(261022075727099003)(261022105027099003)(261022113327099003)(261021121427099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: MakPkY0SqV/i3b/DfEnR286ygbXESSRa1sCViqpHbmBJzSBNFdkq6HpNkWfwPGLtXzXj3ZQtuPsu83TN28DCTnCJCl86CcMOM4l+mAJqinv7nhEpNEcR1RXuCqyX+N0e77mpi/6Og/JlYhekRLUpbqJoZhI8jeb0yi1Dw6+/W1+bhvzq79NI8/Esf/kkkS/tis3L6Oo2AueB0U8WRPh2lP7mj+XPXS4rlp6xe10AGkaSNUEWwObnCJWrdbT2W+bJHOpb09DUK0f06kYl8kLRiCChPpcqC8jLu3s4/8yARQuk8+bqj31c6K31uLwqI+d4++rRbxTrgpHLwqB7b5yb+bDE1zHn3ivah6z+ra25vQhzig9wtPzdOfjEMe60vNMx4k0ExfuoUqfCsEd1ZF0xDZksoG3WZSojYePZLrKfpXp2QStIeKh1FFVM316Gfxg7 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Dec 2026 14:53:06.8786 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 776271d7-de39-4e85-67ac-08df5083f9b8 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN6PEPF00000072.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB7432 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261202_065319_605756_5FE6B44C X-CRM114-Status: GOOD ( 17.67 ) X-Spam-Score: -2.1 (--) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-phy" X-Spam-Status: No, score=-16.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 From: Wayne Chang Add support for receiver offset and squelch offset calibration on Tegra264 to compensate for manufacturing variation in the USB2 receivers. The receiver offset calibrates the receiver differential offset between D+ and D-, while squelch offset calibrates the squelch detector differential offset used to distinguish valid high-speed signaling from low-amplitude noise or idle. Each USB2 port has a 4-bit REC_OS (receiver offset) value and an 8-bit SQ_OS (squelch offset) value stored in fuses. Add a SoC data variable 'has_rec_sq_offsets' to indicate if the USB PHY supports the REC_OS and SQ_OS register fields. If the USB PHY supports these fields, then read REC_OS for ports 0-2 from FUSE_USB_CALIB_EXT_0 and for port 3 from FUSE_USB_CALIB_EXT3_0 and read SQ_OS for all four ports from FUSE_USB_CALIB_EXT2_0. Apply these values to the corresponding fields in each port's USB2 pad-control register when powering on the PHY. Signed-off-by: Wayne Chang Signed-off-by: Jon Hunter --- drivers/phy/tegra/xusb-tegra186.c | 57 +++++++++++++++++++++++++++++++++++++++ drivers/phy/tegra/xusb.h | 1 + 2 files changed, 58 insertions(+) diff --git a/drivers/phy/tegra/xusb-tegra186.c b/drivers/phy/tegra/xusb-tegra186.c index 82f5c6c8f6a8..9b1df22451e6 100644 --- a/drivers/phy/tegra/xusb-tegra186.c +++ b/drivers/phy/tegra/xusb-tegra186.c @@ -3,6 +3,8 @@ * Copyright (c) 2016-2022, NVIDIA CORPORATION. All rights reserved. */ +#include +#include #include #include #include @@ -27,6 +29,9 @@ #define RPD_CTRL_SHIFT 0 #define RPD_CTRL_MASK 0x1f +#define REC_OS_PAD_MASK GENMASK(20, 17) +#define REC_OS_PAD3_MASK GENMASK(3, 0) +#define SQ_OS_PAD_MASK GENMASK(7, 0) /* XUSB PADCTL registers */ #define XUSB_PADCTL_USB2_PAD_MUX 0x4 @@ -81,6 +86,10 @@ #define TERM_RANGE_ADJ(x) (((x) & 0xf) << 3) #define RPD_CTRL(x) (((x) & 0x1f) << 26) +#define XUSB_PADCTL_USB2_OTG_PADX_CTL3(x) (0x94 + (x) * 0x40) +#define REC_OS GENMASK(12, 9) +#define SQ_OS GENMASK(21, 14) + #define XUSB_PADCTL_USB2_BIAS_PAD_CTL0 0x284 #define BIAS_PAD_PD BIT(11) #define HS_SQUELCH_LEVEL(x) (((x) & 0x7) << 0) @@ -255,6 +264,8 @@ struct tegra_xusb_fuse_calibration { u32 hs_squelch; u32 *hs_term_range_adj; u32 rpd_ctrl; + u32 *sq_os; + u32 *rec_os; }; struct tegra186_xusb_padctl_context { @@ -935,6 +946,14 @@ static int tegra186_utmi_phy_power_on(struct phy *phy) value |= RPD_CTRL(priv->calib.rpd_ctrl); padctl_writel(padctl, value, XUSB_PADCTL_USB2_OTG_PADX_CTL1(index)); + if (padctl->soc->has_rec_sq_offsets) { + value = padctl_readl(padctl, XUSB_PADCTL_USB2_OTG_PADX_CTL3(index)); + value &= ~(REC_OS | SQ_OS); + value |= FIELD_PREP(REC_OS, priv->calib.rec_os[index]); + value |= FIELD_PREP(SQ_OS, priv->calib.sq_os[index]); + padctl_writel(padctl, value, XUSB_PADCTL_USB2_OTG_PADX_CTL3(index)); + } + tegra186_utmi_pad_power_on(phy); return 0; @@ -1520,6 +1539,43 @@ tegra186_xusb_read_fuse_calibration(struct tegra186_xusb_padctl *padctl) padctl->calib.hs_term_range_adj = hs_term_range_adj; + if (soc->has_rec_sq_offsets) { + u32 *sq_os, *rec_os; + + sq_os = devm_kzalloc_objs(dev, u32, count); + if (!sq_os) + return -ENOMEM; + + rec_os = devm_kzalloc_objs(dev, u32, count); + if (!rec_os) + return -ENOMEM; + + for (i = 0; i < 3; i++) + rec_os[i] = FIELD_GET(REC_OS_PAD_MASK, value >> (i * 4)); + + err = tegra_fuse_readl(TEGRA_FUSE_USB_CALIB_EXT3_0, &value); + if (err) + return dev_err_probe(dev, err, + "failed to read EXT3 calibration fuse\n"); + + dev_dbg(dev, "FUSE_USB_CALIB_EXT3_0 %#x\n", value); + + rec_os[3] = FIELD_GET(REC_OS_PAD3_MASK, value); + + err = tegra_fuse_readl(TEGRA_FUSE_USB_CALIB_EXT2_0, &value); + if (err) + return dev_err_probe(dev, err, + "failed to read EXT2 calibration fuse\n"); + + dev_dbg(dev, "FUSE_USB_CALIB_EXT2_0 %#x\n", value); + + for (i = 0; i < count; i++) + sq_os[i] = FIELD_GET(SQ_OS_PAD_MASK, value >> (i * 8)); + + padctl->calib.rec_os = rec_os; + padctl->calib.sq_os = sq_os; + } + return 0; } @@ -1794,6 +1850,7 @@ const struct tegra_xusb_padctl_soc tegra264_xusb_padctl_soc = { .trk_hw_mode = true, .supports_lp_cfg_en = true, .has_per_pad_term = true, + .has_rec_sq_offsets = true, }; EXPORT_SYMBOL_GPL(tegra264_xusb_padctl_soc); diff --git a/drivers/phy/tegra/xusb.h b/drivers/phy/tegra/xusb.h index 086bb2d09bda..61df37d79ca3 100644 --- a/drivers/phy/tegra/xusb.h +++ b/drivers/phy/tegra/xusb.h @@ -436,6 +436,7 @@ struct tegra_xusb_padctl_soc { bool trk_update_on_idle; bool supports_lp_cfg_en; bool has_per_pad_term; + bool has_rec_sq_offsets; }; struct tegra_xusb_padctl { -- 2.43.0 -- linux-phy mailing list linux-phy@lists.infradead.org https://lists.infradead.org/mailman/listinfo/linux-phy