From patchwork Fri Nov 11 10:15:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wayne Chang X-Patchwork-Id: 18655 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp656854wru; Fri, 11 Nov 2022 02:20:17 -0800 (PST) X-Google-Smtp-Source: AA0mqf6+6hxKsQ7kXNsomNqr5I6/9VYoh7k7jRZpWwro7NvqTBpdz0KYWjnKh8k0SwLONOG8fim1 X-Received: by 2002:a05:6402:17d0:b0:458:d064:a8c2 with SMTP id s16-20020a05640217d000b00458d064a8c2mr834506edy.346.1668162017430; Fri, 11 Nov 2022 02:20:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1668162017; cv=pass; d=google.com; s=arc-20160816; b=GTlEJ+h1MwFPOdiW4FpOQY2zkltyn14KVvE2LM8vV0Fpo0HkcOP8lc++qBsjMu5fJz TCctGNaah+VHBNQ5koOSPYnEzei9Fn5n9S5OE69ylPKQlMNEfKAuBEIZzmzuNRsJmM+r CiZeTTXnh/bt84G0JJgm8ndO3p3A7YTedSp6kWwC5U0fEOVz0xLZTDXJp3rszYcYwCGF yZIcrJTWsMGxwixK3tkeqjilVcv29GOqPD8B/hYahZbOgE7Ifpng7KZ13UwejUai+rej i4D4oLQ+qOGTkujGpFWx7wtwezqFjlEd1YyB6FqrcfbFRkrcSil5kpoTOlHKgdyKbM8D oLAw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=1AF7aVigZwouxWVql2MnK0MSpcIZN0ezQ3PFXN5glmg=; b=ApPUpqa8qhfdcRI7u+dJdEvXTq207WsjF5Ds1FP+CzkcPVHWKkduO5OhQOwHZb9OEV S2N8ZVh02kodjdODv1L1DhmJAbPMsIzOjAg025cUdFwxfAePgZIeDE/qaMTkwh+uM3do BpgQEIQgTuDtM1t8wa3SGW1xeAdM+iIIF6+U7vNyjLDc7bDfLDsT1bqeh9JVXD992MjW Zgt4ZTr1e30KbUhnJ9inap6Ans+vXHOaSDmQUIA+kv5FHwbLHJCqlV6ymtPMfOfpSjcz wHXYUBZle3V4e8QpzhwZ9+Y85TKriVW3EC7kCba2vzejG5H7RXLL8ODBcWkHs2QhD2X9 Gh1w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b="rtb6k3/0"; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q11-20020a1709060f8b00b0078261fd56efsi1308801ejj.571.2022.11.11.02.19.52; Fri, 11 Nov 2022 02:20:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b="rtb6k3/0"; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233745AbiKKKRa (ORCPT + 99 others); Fri, 11 Nov 2022 05:17:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233446AbiKKKQt (ORCPT ); Fri, 11 Nov 2022 05:16:49 -0500 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2055.outbound.protection.outlook.com [40.107.94.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2891E87B2E; Fri, 11 Nov 2022 02:16:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TBSpZu2EVS3jh5L+pcYGfAn+O9QP+9Dptl4KiMgPoOIKhb8OIKKy4WhNAQKomneWm64lH3iPdwAh4MdZC6EAEmqw66vJHY1vvbZG5o8MVGiznY3ZAxm8+iqPm7kXkRhZFwxb85SEfIXvBEKIe27WHMrlEigo+6jRTFKW77R9LnGFU3Imz4u/VF/SIWYDd7/9wBLemIHwGQOq26/ugLbZuIJ1YZD9sd/RXs0bgPmFp0333PqwftbH1U4UwQ/fMIPOm7GB9RvwEl1FJMqppR9P+H5JZfpFeOeAez0ESHWQpwzCEVgU92jbLnFXpeu8zo0VDFAcHc+mjTpCV3WMfD717A== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=1AF7aVigZwouxWVql2MnK0MSpcIZN0ezQ3PFXN5glmg=; b=Dx4YWxiyY5joANrVFLu/9Tf2ZCex6Ce/hboXGUoecyotnWwlOYGddBMDFyvQ/9erPpUysQPTxSEkqK7jiXGa1YX0NWpYG4UbkKrj1BmiUkTmvPa6Jgf8q751X5YVeV+Xs92WBXOiW5hxeLZax+R7WfWKH8kY9MpjyiA6uh9yyZdKbwvou/06F6u0HF3Ngwxqv+f7I4XKHhUphZXIHOndyKPZnrKo1P3xIWb6kdjlDtjiXaeFX0KqUDxXLTInZURF+r2+akYqMZ9ZmhkKV2QjFFRhySPUOt/3aUdhY3PsIuN2d9Qx9fXnpiz9VAehGNcidN5MqrxF3LCJ5pKXnB012Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=linuxfoundation.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 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=1AF7aVigZwouxWVql2MnK0MSpcIZN0ezQ3PFXN5glmg=; b=rtb6k3/0hPJDfRjFp8koF9yNGSZLylTENY3XymxDPhm3JKmfpOd+kiVVKB2vgOsrLde975FxmzCTGlIGUlWOYxWivUf9VZhkVuFh+rG4EOP1FVi45chND9fWEmYeyipZd1DhKD+rcSOW5PY6LGQ6kbXjPX/gOVWF2QO7qKs9dNZN8a1NlQmLm9s2VvXh8a4rFvG1t+eOO3O5t7Ri6JGVsqyviVg3Rdmcc69QvY3jlLhW3o1f8l5dawblaVKXcKwg4bHaDQ0AcRuRdo7p1qJ18Quo839kS2P8UlhY1NSoczegH/EXgjscSOC3owhu51RWWyh2aqY5sOO4crzALa3BNA== Received: from DS7PR03CA0175.namprd03.prod.outlook.com (2603:10b6:5:3b2::30) by BN9PR12MB5195.namprd12.prod.outlook.com (2603:10b6:408:11c::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5813.14; Fri, 11 Nov 2022 10:16:39 +0000 Received: from CY4PEPF0000B8EE.namprd05.prod.outlook.com (2603:10b6:5:3b2:cafe::16) by DS7PR03CA0175.outlook.office365.com (2603:10b6:5:3b2::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5813.14 via Frontend Transport; Fri, 11 Nov 2022 10:16:39 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) 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.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by CY4PEPF0000B8EE.mail.protection.outlook.com (10.167.241.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5813.11 via Frontend Transport; Fri, 11 Nov 2022 10:16:38 +0000 Received: from rnnvmail204.nvidia.com (10.129.68.6) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.26; Fri, 11 Nov 2022 02:16:28 -0800 Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail204.nvidia.com (10.129.68.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Fri, 11 Nov 2022 02:16:28 -0800 Received: from waynec-Precision-5760.nvidia.com (10.127.8.13) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.986.36 via Frontend Transport; Fri, 11 Nov 2022 02:16:24 -0800 From: Wayne Chang To: , , , , , , , , , , , , CC: , , , , , , , Subject: [PATCH v2 11/13] phy: tegra: xusb: Add Tegra234 support Date: Fri, 11 Nov 2022 18:15:07 +0800 Message-ID: <20221111101509.999589-12-waynec@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221111101509.999589-1-waynec@nvidia.com> References: <20221111101509.999589-1-waynec@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000B8EE:EE_|BN9PR12MB5195:EE_ X-MS-Office365-Filtering-Correlation-Id: 2913a553-fb5e-4d59-106b-08dac3cdd250 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tzIY1k/QRafb/SWgvE/3uxI+Zb4C6PlOTgX6L7t8rnqlZy8Ag1xRtB0Zbparcp3Tz6Ig7I502UWKFinkegILustdTUpQQ/NZwZrJa8fziPxN8lDeqjAh7KvV4oiUHTMUjvZtG4qYBh+c1eD2aph3MSKID6pBzB/3a4En/hXoYApDau2QfmhIKid2oBkuoxTmn0SRy4vjHifOFAIGfeiYuDCv6+Frnxuox4NT5lMV+lwVh4AyWNXVNFpmBlDj6JhGt58Y+b1ifOhZSnPljlKYJuiECC/eFw+ogrczUyCltZFRxuGhb8vmDldciqfCPSMjsQmRhP6fQbJJxh4A4mqcVauhO9G8qhZXXtz9afniDdDRjY8iEQIzQr/fpugf+bjQQHAobG1IumfL/Z71H0M/DBZDB+I9pJ+c/A3OlZHj8eP4LUiE+HcSqf4Ub1R+L+vwb/FR73rSctmwvoTNmcc/caIKKi6MWSB5X52HzN3afA1mOJ6kwdoXaV26C8h+vUrmygcuq/lsK7GEbnMcPVLOi86P1W9hR3F+WxkkBlBKMljRDOSzhwVGADm/aVZgymgZGxd/Dg1W/sDNmlcJ4KWvBOkaJv2bkPRS14m6nLDETjOnT9VJLwjFakkH+12G1BdY7fy2fAJd9RZfuOQjuWdSMf1+EBqoWbN6ic/nMHz4ed1jn9ENW4oO0uWbyEwYWE0i0lRLOnvKeJZqalyh0+Gj2YFvnup2j9gsmYrffqNmw95PKmM/21q9cOh6C9dHv0w7X0oo5Zgbgu0bLoxRYfghPe3c2JR7EFGXEzix48fysW8= X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230022)(4636009)(396003)(136003)(39860400002)(346002)(376002)(451199015)(36840700001)(40470700004)(46966006)(4326008)(478600001)(70206006)(70586007)(26005)(86362001)(83380400001)(6666004)(41300700001)(426003)(82310400005)(8676002)(2906002)(47076005)(6636002)(36860700001)(8936002)(82740400003)(316002)(186003)(2616005)(54906003)(7696005)(921005)(1076003)(356005)(7636003)(40480700001)(336012)(110136005)(36756003)(7416002)(5660300002)(40460700003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Nov 2022 10:16:38.9114 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2913a553-fb5e-4d59-106b-08dac3cdd250 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.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000B8EE.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR12MB5195 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749194655709498448?= X-GMAIL-MSGID: =?utf-8?q?1749194655709498448?= From: Sing-Han Chen Add support for the XUSB pad controller found on Tegra234 SoCs. It is mostly similar to the same IP found on Tegra194, because most of the Tegra234 XUSB PADCTL registers definition and programming sequence are the same as Tegra194, Tegra234 XUSB PADCTL can share the same driver with Tegra186 and Tegra194 XUSB PADCTL. Introduce a new feature, USB2 HW tracking, for Tegra234. The feature is to enable HW periodical PAD tracking which measure and capture the electric parameters of USB2.0 PAD. Signed-off-by: Sing-Han Chen Co-developed-by: Wayne Chang Signed-off-by: Wayne Chang --- V1 -> V2:remove atomic and the helper in padctl_readl_poll func. drivers/phy/tegra/Makefile | 1 + drivers/phy/tegra/xusb-tegra186.c | 64 +++++++++++++++++++++++++++++-- drivers/phy/tegra/xusb.c | 6 +++ drivers/phy/tegra/xusb.h | 22 +++++++++++ 4 files changed, 90 insertions(+), 3 deletions(-) diff --git a/drivers/phy/tegra/Makefile b/drivers/phy/tegra/Makefile index 89b84067cb4c..eeeea72de117 100644 --- a/drivers/phy/tegra/Makefile +++ b/drivers/phy/tegra/Makefile @@ -7,4 +7,5 @@ phy-tegra-xusb-$(CONFIG_ARCH_TEGRA_132_SOC) += xusb-tegra124.o phy-tegra-xusb-$(CONFIG_ARCH_TEGRA_210_SOC) += xusb-tegra210.o phy-tegra-xusb-$(CONFIG_ARCH_TEGRA_186_SOC) += xusb-tegra186.o phy-tegra-xusb-$(CONFIG_ARCH_TEGRA_194_SOC) += xusb-tegra186.o +phy-tegra-xusb-$(CONFIG_ARCH_TEGRA_234_SOC) += xusb-tegra186.o obj-$(CONFIG_PHY_TEGRA194_P2U) += phy-tegra194-p2u.o diff --git a/drivers/phy/tegra/xusb-tegra186.c b/drivers/phy/tegra/xusb-tegra186.c index f121b4ffbbfd..5ae3cea19c84 100644 --- a/drivers/phy/tegra/xusb-tegra186.c +++ b/drivers/phy/tegra/xusb-tegra186.c @@ -89,6 +89,11 @@ #define USB2_TRK_START_TIMER(x) (((x) & 0x7f) << 12) #define USB2_TRK_DONE_RESET_TIMER(x) (((x) & 0x7f) << 19) #define USB2_PD_TRK BIT(26) +#define USB2_TRK_COMPLETED BIT(31) + +#define XUSB_PADCTL_USB2_BIAS_PAD_CTL2 0x28c +#define USB2_TRK_HW_MODE BIT(0) +#define CYA_TRK_CODE_UPDATE_ON_IDLE BIT(31) #define XUSB_PADCTL_HSIC_PADX_CTL0(x) (0x300 + (x) * 0x20) #define HSIC_PD_TX_DATA0 BIT(1) @@ -609,9 +614,31 @@ static void tegra186_utmi_bias_pad_power_on(struct tegra_xusb_padctl *padctl) value &= ~USB2_PD_TRK; padctl_writel(padctl, value, XUSB_PADCTL_USB2_BIAS_PAD_CTL1); - udelay(100); + if (padctl->soc->poll_trk_completed) { + err = padctl_readl_poll(padctl, XUSB_PADCTL_USB2_BIAS_PAD_CTL1, + USB2_TRK_COMPLETED, USB2_TRK_COMPLETED, 100); + if (err) { + /* The failure with polling on trk complete will not + * cause the failure of powering on the bias pad. + */ + dev_warn(dev, "failed to poll USB2 trk completed: %d\n", err); + } - clk_disable_unprepare(priv->usb2_trk_clk); + value = padctl_readl(padctl, XUSB_PADCTL_USB2_BIAS_PAD_CTL1); + value |= USB2_TRK_COMPLETED; + padctl_writel(padctl, value, XUSB_PADCTL_USB2_BIAS_PAD_CTL1); + } else { + udelay(100); + } + + if (padctl->soc->trk_hw_mode) { + value = padctl_readl(padctl, XUSB_PADCTL_USB2_BIAS_PAD_CTL2); + value |= USB2_TRK_HW_MODE; + value &= ~CYA_TRK_CODE_UPDATE_ON_IDLE; + padctl_writel(padctl, value, XUSB_PADCTL_USB2_BIAS_PAD_CTL2); + } else { + clk_disable_unprepare(priv->usb2_trk_clk); + } mutex_unlock(&padctl->lock); } @@ -637,6 +664,13 @@ static void tegra186_utmi_bias_pad_power_off(struct tegra_xusb_padctl *padctl) value |= USB2_PD_TRK; padctl_writel(padctl, value, XUSB_PADCTL_USB2_BIAS_PAD_CTL1); + if (padctl->soc->trk_hw_mode) { + value = padctl_readl(padctl, XUSB_PADCTL_USB2_BIAS_PAD_CTL2); + value &= ~USB2_TRK_HW_MODE; + padctl_writel(padctl, value, XUSB_PADCTL_USB2_BIAS_PAD_CTL2); + clk_disable_unprepare(priv->usb2_trk_clk); + } + mutex_unlock(&padctl->lock); } @@ -1560,7 +1594,8 @@ const struct tegra_xusb_padctl_soc tegra186_xusb_padctl_soc = { EXPORT_SYMBOL_GPL(tegra186_xusb_padctl_soc); #endif -#if IS_ENABLED(CONFIG_ARCH_TEGRA_194_SOC) +#if IS_ENABLED(CONFIG_ARCH_TEGRA_194_SOC) || \ + IS_ENABLED(CONFIG_ARCH_TEGRA_234_SOC) static const char * const tegra194_xusb_padctl_supply_names[] = { "avdd-usb", "vclamp-usb", @@ -1616,8 +1651,31 @@ const struct tegra_xusb_padctl_soc tegra194_xusb_padctl_soc = { .supply_names = tegra194_xusb_padctl_supply_names, .num_supplies = ARRAY_SIZE(tegra194_xusb_padctl_supply_names), .supports_gen2 = true, + .poll_trk_completed = true, }; EXPORT_SYMBOL_GPL(tegra194_xusb_padctl_soc); + +const struct tegra_xusb_padctl_soc tegra234_xusb_padctl_soc = { + .num_pads = ARRAY_SIZE(tegra194_pads), + .pads = tegra194_pads, + .ports = { + .usb2 = { + .ops = &tegra186_usb2_port_ops, + .count = 4, + }, + .usb3 = { + .ops = &tegra186_usb3_port_ops, + .count = 4, + }, + }, + .ops = &tegra186_xusb_padctl_ops, + .supply_names = tegra194_xusb_padctl_supply_names, + .num_supplies = ARRAY_SIZE(tegra194_xusb_padctl_supply_names), + .supports_gen2 = true, + .poll_trk_completed = true, + .trk_hw_mode = true, +}; +EXPORT_SYMBOL_GPL(tegra234_xusb_padctl_soc); #endif MODULE_AUTHOR("JC Kuo "); diff --git a/drivers/phy/tegra/xusb.c b/drivers/phy/tegra/xusb.c index 95091876c422..23d179b1a5b5 100644 --- a/drivers/phy/tegra/xusb.c +++ b/drivers/phy/tegra/xusb.c @@ -71,6 +71,12 @@ static const struct of_device_id tegra_xusb_padctl_of_match[] = { .compatible = "nvidia,tegra194-xusb-padctl", .data = &tegra194_xusb_padctl_soc, }, +#endif +#if defined(CONFIG_ARCH_TEGRA_234_SOC) + { + .compatible = "nvidia,tegra234-xusb-padctl", + .data = &tegra234_xusb_padctl_soc, + }, #endif { } }; diff --git a/drivers/phy/tegra/xusb.h b/drivers/phy/tegra/xusb.h index 8cfbbdbd6e0c..a21826c730d7 100644 --- a/drivers/phy/tegra/xusb.h +++ b/drivers/phy/tegra/xusb.h @@ -8,6 +8,7 @@ #define __PHY_TEGRA_XUSB_H #include +#include #include #include @@ -433,6 +434,8 @@ struct tegra_xusb_padctl_soc { unsigned int num_supplies; bool supports_gen2; bool need_fake_usb3_port; + bool poll_trk_completed; + bool trk_hw_mode; }; struct tegra_xusb_padctl { @@ -475,6 +478,22 @@ static inline u32 padctl_readl(struct tegra_xusb_padctl *padctl, return value; } +static inline u32 padctl_readl_poll(struct tegra_xusb_padctl *padctl, + unsigned long offset, u32 val, u32 mask, int us) +{ + u32 regval; + int err; + + err = readl_poll_timeout(padctl->regs + offset, regval, + (regval & mask) == val, 1, us); + if (err) { + dev_err(padctl->dev, "%08lx poll timeout > %08x\n", offset, + regval); + } + + return err; +} + struct tegra_xusb_lane *tegra_xusb_find_lane(struct tegra_xusb_padctl *padctl, const char *name, unsigned int index); @@ -491,5 +510,8 @@ extern const struct tegra_xusb_padctl_soc tegra186_xusb_padctl_soc; #if defined(CONFIG_ARCH_TEGRA_194_SOC) extern const struct tegra_xusb_padctl_soc tegra194_xusb_padctl_soc; #endif +#if defined(CONFIG_ARCH_TEGRA_234_SOC) +extern const struct tegra_xusb_padctl_soc tegra234_xusb_padctl_soc; +#endif #endif /* __PHY_TEGRA_XUSB_H */