From patchwork Wed May 17 16:16:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 683566 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5BBE4C77B7D for ; Wed, 17 May 2023 16:17:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229669AbjEQQRc (ORCPT ); Wed, 17 May 2023 12:17:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229611AbjEQQRa (ORCPT ); Wed, 17 May 2023 12:17:30 -0400 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2062.outbound.protection.outlook.com [40.107.6.62]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E9BFA5D1; Wed, 17 May 2023 09:17:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=f+Gd8gxS1WJVIRh0ViPpcsd+g7AkgC9aWR78quKCZuH8YKrgsDwihHDG5PPR+4BZ0PYnFsp5rZc21rU20DQBcRsXv9LQMf7BGilzRUfCZS1D280QZWAoa0xlmGUmdaS/uoSs3huHaje2GCvlGD7TF4206w/rEZGMFD8uvBRb1qt7gL6nGxDNd4CCTBEKkQ8De78OxXCF2nnvrLHvgwHsehPLVg2hFD3x7v2/kr7WP2cBt/UlajlKwTe3Fe01ATOVhQA4doNdyx2bF5N3LYSh4MzVXvPgRUaw69rjo2VKzHEVTX0cL8Al5uSYlaus/3jIk+6Wjcw7p/bPwxMAnrMjoQ== 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=8f+b6cXeWjgCVkuK08UozeofpLH0pNg35r0cKFO4gSw=; b=Fdyrts62xNqWd5NrThZVOtckM7O4SYTta1dHNlUc6Nk4wS1VKDH7+OBxGYobN44wHZTjxpsxUsef5g8cclwGduxzMkinQcgWPvi4jgCkiYUN0pgVE6KZUdj7SN0BgP6/p5RB7l8r9KS+ODWCz6op5IKdKrPkTBtGgzyWG22fqxwcxmxHWMpH/g83UtXbXTd38JVcD2XVJIqxfXX619OTJiAfnsO+AnIOnp4XLvAa8dtff2SNonoImXB2856Ip4chFtRHXrFUYjWGanu+SohiJCXom+sGSNTrYY0g9I17B8Y8QeIP8XRImMzLPqDmlI4slavDFe6Z2FSs/9AzrLcz0w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8f+b6cXeWjgCVkuK08UozeofpLH0pNg35r0cKFO4gSw=; b=YiQoJnhI2/J98wFY8z5uQVuHjwbIjI4us0QKflETNx8t2YycDP3NIEq9mzWDlMqqX7Yj7aNw8xiEprR+H0nQukMm2OQeVfmjKB5ObHd+ivtxSsBYrWCAky+HczAVVs2M/IWvcT45xJiBJScSS+EIKIbuVmjeukqhN2Ryd8hlISQ= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) by DB9PR04MB9962.eurprd04.prod.outlook.com (2603:10a6:10:4c4::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.34; Wed, 17 May 2023 16:17:14 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::25d3:de2:ef1:3884]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::25d3:de2:ef1:3884%4]) with mapi id 15.20.6387.033; Wed, 17 May 2023 16:17:14 +0000 From: Frank Li To: vkoul@kernel.org Cc: Frank.Li@nxp.com, devicetree@vger.kernel.org, fushi.peng@nxp.com, imx@lists.linux.dev, kernel@pengutronix.de, kishon@kernel.org, krzysztof.kozlowski+dt@linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, robh+dt@kernel.org, s.hauer@pengutronix.de, shawnguo@kernel.org Subject: [PATCH v5 2/6] phy: cadence: salvo: decrease delay value to zero for txvalid Date: Wed, 17 May 2023 12:16:42 -0400 Message-Id: <20230517161646.3418250-3-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230517161646.3418250-1-Frank.Li@nxp.com> References: <20230517161646.3418250-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR03CA0041.namprd03.prod.outlook.com (2603:10b6:a03:33e::16) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|DB9PR04MB9962:EE_ X-MS-Office365-Filtering-Correlation-Id: bc523e6e-c651-4331-6a7d-08db56f22cfd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TYaH0m4tckogfYSuvIa2a02Rkmk36KdsQLbbzYBeJNqSUrcA5sEi2HC+MA85kRN9wJ3+sSKUaU8cC059M6ikkWaDpPphpG99sdVPoooAZEHjuYb0pAidU+SFYs8aq7s6uY/d1CrGYzTDu7BkOJSYjD5LsPjxxxX0UCIzJsWiKUKiIVtoCGossg14h8veTmsRizR2+Xma9q2x5fwGlPyUe84Ag3I9YoWHjNnPli6O0zAsOQiFT6et8Fa7SPs5I1QZgfcnZZ6c4oXOe3oZ8st0paXXsEKKGlpqTyi8OKY4HYmNke2CeJdJo7SfWy/Oa+Xs3i+pQuf7DRAg1WYPILIpcQF8PujDQyQsL9AyLz/PGwg95P3i4vUFeZgIF8XxhY81W7sAHMmtR16DVToQEiQc8JpkQTo1qiGJBs8VSPTlHuxA3Qt0Lz/g2ymBNSpqERGznFZs5sWi9uhJGtOhSku0sDW2VFc/WKq8QsbOkcehb6aCvzG8/rsyAn7cnYufUkxJe0eG+koUSytuF6gKqLA9vVPGBWwof7oZTQBUn6WCf1KXfIAIBgwk2XfeiBz4ilMPXRvjf6myvGk/JnLfd7eSfGOjFXaDDPgcXRDLktVCq+/W4qRoT0Kk/cO/jb7pmLQc X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR04MB4838.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(396003)(39860400002)(136003)(366004)(346002)(376002)(451199021)(6916009)(316002)(66946007)(66476007)(8936002)(66556008)(4326008)(8676002)(2906002)(478600001)(6486002)(41300700001)(5660300002)(6666004)(7416002)(52116002)(26005)(1076003)(6512007)(6506007)(186003)(2616005)(36756003)(38350700002)(38100700002)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Y/a267PRgOjtBC9XOnJFAzXXTBjTQeHMrUf4lwNCTYY+cVjN4nCdrl85bnYPcYRn80n8CjTkoHkkb+ARlFEvWz2Stm5TjetvsHy9YgrOVHQkcaipJMFN6qGswK/X3fMQg42xj+NEAUASZojjwgNBd0TvD3d+w6fonXJjwOl9j/d/5yJGGy4otb93YFZEssS+cCVHZk/QI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Rl+WD02J+fonFrVVjLe5i3k4IJ/+LwabX/SLOxYxKQfvdBU5S8MgZrLXSMsFzXfoOKvTSYNAGenMnkzuCs923dz7icX4yhz/pfpARsH/eyJskOXp7GJOmQ9YUgSaJuf0gVqzoBrnSoeHjjJlGk/uuXvhygD2P7Tl0QuQNxSqi6a1vIA/fObFEhL6zWERdG7rq4xq3JtCCi6wga6zLIeg//aEhp7M1U3hcAnnF5f/f/Y6JhFXdLvMFNPSVT9/BDenIk3lTT/3fiQPkRz8sRx+Mug4s7eXBk9fTa64WmP10r0S2LsgLuo= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: bc523e6e-c651-4331-6a7d-08db56f22cfd X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 May 2023 16:17:14.1323 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: VrA+YBdfx5oiUquRVuUZdJr60DZlZiWI2DYCLfucPiUzDnilmWi1TeJiZya5VWkSWRZEG/T8XRSFJzdo20zbgg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB9962 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org From: Peter Chen For USB2 L1 use cases, some hosts may start transferring less than 20us after End of Resume, it causes the host seeing corrupt packet from the device side. The reason is the delay time between PHY powers up and txvalid is 20us. To fix it, we change the delay value as 0us. Signed-off-by: Peter Chen Signed-off-by: Frank Li --- drivers/phy/cadence/phy-cadence-salvo.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/phy/cadence/phy-cadence-salvo.c b/drivers/phy/cadence/phy-cadence-salvo.c index 06c5dbdb700e..2e3d4d8fb8eb 100644 --- a/drivers/phy/cadence/phy-cadence-salvo.c +++ b/drivers/phy/cadence/phy-cadence-salvo.c @@ -89,8 +89,20 @@ #define TB_ADDR_XCVR_DIAG_LANE_FCM_EN_MGN_TMR 0x40f2 #define TB_ADDR_TX_RCVDETSC_CTRL 0x4124 +/* USB2 PHY register definition */ +#define UTMI_REG15 0xaf + /* TB_ADDR_TX_RCVDETSC_CTRL */ #define RXDET_IN_P3_32KHZ BIT(0) +/* + * UTMI_REG15 + * + * Gate how many us for the txvalid signal until analog + * HS/FS transmitters have powered up + */ +#define TXVALID_GATE_THRESHOLD_HS_MASK (BIT(4) | BIT(5)) +/* 0us, txvalid is ready just after HS/FS transmitters have powered up */ +#define TXVALID_GATE_THRESHOLD_HS_0US (BIT(4) | BIT(5)) struct cdns_reg_pairs { u16 val; @@ -230,6 +242,11 @@ static int cdns_salvo_phy_init(struct phy *phy) cdns_salvo_write(salvo_phy, USB3_PHY_OFFSET, TB_ADDR_TX_RCVDETSC_CTRL, RXDET_IN_P3_32KHZ); + value = cdns_salvo_read(salvo_phy, USB2_PHY_OFFSET, UTMI_REG15); + value &= ~TXVALID_GATE_THRESHOLD_HS_MASK; + cdns_salvo_write(salvo_phy, USB2_PHY_OFFSET, UTMI_REG15, + value | TXVALID_GATE_THRESHOLD_HS_0US); + udelay(10); clk_disable_unprepare(salvo_phy->clk); From patchwork Wed May 17 16:16:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 683565 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE341C77B7F for ; Wed, 17 May 2023 16:17:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229780AbjEQQRs (ORCPT ); Wed, 17 May 2023 12:17:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229705AbjEQQRd (ORCPT ); Wed, 17 May 2023 12:17:33 -0400 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2081.outbound.protection.outlook.com [40.107.6.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77B3DA26F; Wed, 17 May 2023 09:17:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GxesHcjRr+cXf+8zvao5RwiZLexP4R6ZaC5b4Jjf00OMhApYHXxLDR1byU1IJ1qT/28YQ/8iodumG2tVqZ4yqv7/D/Criq/tZ7nfatEwUT4vP/RroS+X0h18rfH4adIP4te8QtOosXj5O1hHgUA3yKDvSdABP5oD4xlIEbTa7MLKBydJG/Pzhth8dGgt+yDXrL2aRVpiYXOsgXA55/+SqcZAzPTwINYjKfEOBh0j1UEWN7cUsuBfc6ABUWXw6NS50ITtF/E2UzCrTgCfiyf2o64j7j2aeVzlsnlWOo11hEZjTpwFmN1auXLRaiPxnYYMmEQbOT/91qrAyT1fWZ8iqQ== 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=DVm17g7uRevK5sYQoI5+K/wE4ULpyAFhfUnYx0zKro4=; b=SdFOJerBc2/L86LAH0lZbVJnqQ/i7GCW8vPfGqAierlSDdCkuHjuKwPNM/gxKGTLPqMvJdYexoCdWKmwE5AfP9V8K8qmywsWCpD7ZRfemSdDh5fdzN8GZa0VXMatSW0Vbz7TlhyRm6NLtUIHlkyZ2CRhDDjaTQmiuUjuYm0SMXTDLa07CCXfLyJTJ8EcmhDwSK0r/ds5xyJIpBztnicqGNwrOi9G2r6iQdgAd/TRCJ1QT8/tnkxhuKAKnjEb4PcgphE0jBzHi9DurmTTSOBM0FPhPsrNCZuVs7/FS8TCwSVbkQoJX6xz1ihaNALP5sTSC3EDmGIjxfkXCseWUiv9Xw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DVm17g7uRevK5sYQoI5+K/wE4ULpyAFhfUnYx0zKro4=; b=pddG+D9E3cJDmKT+XQv7FQ7siC/sxns3VHPMZii60s0BGAmZX+P7A3a8Ec0MxncXeu4fBzdomZJynGQU534C5QqMHNvC3LlAbhwiBzK6G2RYQYUYRSmOR5GlIi2360m42PZa1FuG0hn+Cf6NrcKE4IXP8d6brh8Muitm+aLZ6io= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) by DB9PR04MB9962.eurprd04.prod.outlook.com (2603:10a6:10:4c4::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.34; Wed, 17 May 2023 16:17:22 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::25d3:de2:ef1:3884]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::25d3:de2:ef1:3884%4]) with mapi id 15.20.6387.033; Wed, 17 May 2023 16:17:22 +0000 From: Frank Li To: vkoul@kernel.org Cc: Frank.Li@nxp.com, devicetree@vger.kernel.org, fushi.peng@nxp.com, imx@lists.linux.dev, kernel@pengutronix.de, kishon@kernel.org, krzysztof.kozlowski+dt@linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, robh+dt@kernel.org, s.hauer@pengutronix.de, shawnguo@kernel.org Subject: [PATCH v5 4/6] phy: cadence: salvo: add .set_mode API Date: Wed, 17 May 2023 12:16:44 -0400 Message-Id: <20230517161646.3418250-5-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230517161646.3418250-1-Frank.Li@nxp.com> References: <20230517161646.3418250-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR03CA0041.namprd03.prod.outlook.com (2603:10b6:a03:33e::16) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|DB9PR04MB9962:EE_ X-MS-Office365-Filtering-Correlation-Id: 5d3c4282-611e-446f-1e31-08db56f23197 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +nXpxxbrCPSb8jYD+3QJQa+6KkyJJOk6dMdvj1bP4K2o0J5Codbo9MjUBAx274Tt6zGs+/jjyIzgmJ/i6M7K0bLTnXj86Gq/A6C03Ql8XkpT0kZBvJIR7GVTHhKnEFg6R8MeK35hLEiU831hrwH3ZLWb/AkjxIWyodUTmNBLIJuVAKjrdJFxTjXR3MIl+fIpuKOjgaQAFycpZUiTwlXD2sbt7pHda4h9JUvwnyun+Gd+O7jXN/w3JN69Qjk9fNDxtdYc8Oh6mQKGFdXPZiVBdWM6akc12zlzgTjsg7jKPI5KfG9RpnwJ9tlLYRambP2meaFDadNKwArd98TGXoIFtCGUR8O8Jz21ITaXTP//whrWI8FpBImBdxqYYGdW9K6fNzOwmCStstWdznoqDLpBTdX+iGSaG71vEEyH6zljELpgEcrpjffXPIxM7dNwOFltDuH1DQM7GzM9OHR4/w4YFRmSyngSFMjl7rFjk7I8P97/GL7EcZocAJeWMZJn9lDqkctGgM02xxn99VBEgbjYTXKKUmbzApudwiY3HCzSJMUJEfBOlcxTrrUoO3WCeVhQFtZhGkcmoSKJhx9PChv+5E8a9xNQVB7fPwxDjBgnH6qICtvN0c4p+S83G5EkKbSV62QRH3BYX7U5MyUqu4xquw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR04MB4838.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(396003)(39860400002)(136003)(366004)(346002)(376002)(451199021)(6916009)(316002)(66946007)(66476007)(8936002)(66556008)(4326008)(8676002)(2906002)(478600001)(6486002)(41300700001)(5660300002)(6666004)(7416002)(52116002)(26005)(1076003)(6512007)(6506007)(186003)(2616005)(36756003)(38350700002)(38100700002)(86362001)(142923001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Z0voyrvW7DhPOtKJ4SmCzN4/nqWu+TPVtBVFnSmy4c3lVyME/z+UVyPoNGXfzBiVDr1D8aSNr6dzY5YL0WWM/COFf7NwX2SIg8LO8SO9FERvQMQj7iTsj8A/SP28gaJ6BPhsr0cZ5WigX1YAcCA6APGweyOQlhMqo3/gS9ZbAHykN1iI5INDGgA0f+E6N2m37+U7Sk8l6Aqmt+yxqf2vfsZ8g/Ctkp9Tpd+YcW8KbZehuU9NDe5DLH9qfFQMMlaFs2n9iwFtymYmo7o/BMRgaa+jDbzYL+vY5fgGg8BLzRx1lfTIb1YOHolvcNrmalFeLN37BxZTCz/5bKJL8hYzttlT+DNsr6BMpJ58SMY6rMoDGtIn7ebV0heLjIWWRBtyRnNkG9sy7u3aBZGFc9Q9sZhZXappiRiesnx0dKneWE15nBifRhTiHGDKiboEvMcT14jMfM3A54Wuq4mQJMJnYE4SXhOmjZUSNFAVIqJorLs0+RB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-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5d3c4282-611e-446f-1e31-08db56f23197 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 May 2023 16:17:21.9625 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: oCAMZtbsDM0nFNgHls9PU8FiIaHxq64t+J7ZqrDkhAodZZBbob/xPO1GKjh1je9TefMXp4NZ/M2zkaaYUWr5Kg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB9962 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org From: Peter Chen For NXP platform design, the PHY can't know VBUS well, it causes the FSM in controller seeing the disconnection at L1 use case. With .set_mode API introduced, the controller driver could force PHY seeing B Session VALID when it is at the device mode (VBUS is there), and keep FSM working well. Signed-off-by: Peter Chen Signed-off-by: Frank Li --- drivers/phy/cadence/phy-cadence-salvo.c | 29 +++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/drivers/phy/cadence/phy-cadence-salvo.c b/drivers/phy/cadence/phy-cadence-salvo.c index 5633fd21ae7d..083de7190819 100644 --- a/drivers/phy/cadence/phy-cadence-salvo.c +++ b/drivers/phy/cadence/phy-cadence-salvo.c @@ -92,6 +92,7 @@ /* USB2 PHY register definition */ #define UTMI_REG15 0xaf #define UTMI_AFE_RX_REG5 0x12 +#define UTMI_AFE_BC_REG4 0x29 /* TB_ADDR_TX_RCVDETSC_CTRL */ #define RXDET_IN_P3_32KHZ BIT(0) @@ -105,6 +106,9 @@ /* 0us, txvalid is ready just after HS/FS transmitters have powered up */ #define TXVALID_GATE_THRESHOLD_HS_0US (BIT(4) | BIT(5)) +#define SET_B_SESSION_VALID (BIT(6) | BIT(5)) +#define CLR_B_SESSION_VALID (BIT(6)) + struct cdns_reg_pairs { u16 val; u32 off; @@ -124,6 +128,13 @@ struct cdns_salvo_phy { }; static const struct of_device_id cdns_salvo_phy_of_match[]; +static const struct cdns_salvo_data cdns_nxp_salvo_data; + +static bool cdns_is_nxp_phy(struct cdns_salvo_phy *salvo_phy) +{ + return salvo_phy->data == &cdns_nxp_salvo_data; +} + static u16 cdns_salvo_read(struct cdns_salvo_phy *salvo_phy, u32 offset, u32 reg) { return (u16)readl(salvo_phy->base + offset + @@ -272,11 +283,29 @@ static int cdns_salvo_phy_power_off(struct phy *phy) return 0; } +static int cdns_salvo_set_mode(struct phy *phy, enum phy_mode mode, int submode) +{ + struct cdns_salvo_phy *salvo_phy = phy_get_drvdata(phy); + + if (!cdns_is_nxp_phy(salvo_phy)) + return 0; + + if (mode == PHY_MODE_USB_DEVICE) + cdns_salvo_write(salvo_phy, USB2_PHY_OFFSET, UTMI_AFE_BC_REG4, + SET_B_SESSION_VALID); + else + cdns_salvo_write(salvo_phy, USB2_PHY_OFFSET, UTMI_AFE_BC_REG4, + CLR_B_SESSION_VALID); + + return 0; +} + static const struct phy_ops cdns_salvo_phy_ops = { .init = cdns_salvo_phy_init, .power_on = cdns_salvo_phy_power_on, .power_off = cdns_salvo_phy_power_off, .owner = THIS_MODULE, + .set_mode = cdns_salvo_set_mode, }; static int cdns_salvo_phy_probe(struct platform_device *pdev) From patchwork Wed May 17 16:16:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 683564 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3E276C77B75 for ; Wed, 17 May 2023 16:18:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229514AbjEQQSU (ORCPT ); Wed, 17 May 2023 12:18:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229509AbjEQQSN (ORCPT ); Wed, 17 May 2023 12:18:13 -0400 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2081.outbound.protection.outlook.com [40.107.6.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02610DC67; Wed, 17 May 2023 09:17:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gcyKvMF0PryWZIxJJ8qufcw5qvuCUHPJ8g3jMdaf67DRRIFRwpXwiWaxTeMxyeOYRcOcWFPunZLGiqBo6B21urgI/QkkXCqoizkIiTZYfc5qQDLqT+B/LvSnGJ4ZLF9+IbKpKkBnLDKn+O9fslKz9lBJ5QTVQvCdfqVbfSurK/iHTdE6cUMP8VUUw3VNadGxuMsFkxe23pRcbxlYHv2RjCE5qkULhcbsmvSpi29J81RWMFUnH4PQkw5vPao5LVfYH9kVIEvJGtVcLLy40o9QBOMhvzVIgRlN3XmRgITGnTNQha2qvweUgUkr3lL5KDt79uxVvHd30OtPdGEN3C/3wg== 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=qRD3I70Nhgh5KFb8QvDbjFiZdXp5lgtUoKw+8YSgtAs=; b=lEgoMX5EeK3kiN80CSLJKSX/Mn3OeLzKyLR7T6hiBghzDVmUOKhQNDdcbJD/UIcatIdE4xKGPqqk7npmXIoXIDjb1c0/Er8e7FfND7VK/4Kxo714R0w/4ZYkHx0UdT7RcELE9r1/bhIYNZTMkADmBiQH/X8u9wUjHrWUY3MpCXh9UErdMI3VWKGbgf1aCVnhCFIBlNr3mFDS0LjRiv7So6Jh7cugZ88/QOTp6X7kIDjtxvZ0Uwhsk0nxWmidtjlvrgymubJNSGD+6AstV/fzifIlg2FQUGCmGj8B0Gt3Pbd1aU/llGzp3ucvket2PKgW9x66JGq5wDOOZKJourveQQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qRD3I70Nhgh5KFb8QvDbjFiZdXp5lgtUoKw+8YSgtAs=; b=lQnDDlGmZm9ZPjDsDs9nResl4gavPxzkntPuvI8THQlgf/wuZIk6zSjjqhs2e4qXSVDhkLqOQxbZgHsCAdQBZRr+julg28tyE3zp6iPpr918+IhcTNSs/z7UyAzQ26J/Gw8Ya0LdcYUoG6OEUFQh62a0Wa5KyJNLRbJ2nUdnn+4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) by DB9PR04MB9962.eurprd04.prod.outlook.com (2603:10a6:10:4c4::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.34; Wed, 17 May 2023 16:17:29 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::25d3:de2:ef1:3884]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::25d3:de2:ef1:3884%4]) with mapi id 15.20.6387.033; Wed, 17 May 2023 16:17:29 +0000 From: Frank Li To: vkoul@kernel.org Cc: Frank.Li@nxp.com, devicetree@vger.kernel.org, fushi.peng@nxp.com, imx@lists.linux.dev, kernel@pengutronix.de, kishon@kernel.org, krzysztof.kozlowski+dt@linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, robh+dt@kernel.org, s.hauer@pengutronix.de, shawnguo@kernel.org Subject: [PATCH v5 6/6] dt-bindings: phy: cdns,salvo: add property cdns,usb2-disconnect-threshold-microvolt Date: Wed, 17 May 2023 12:16:46 -0400 Message-Id: <20230517161646.3418250-7-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230517161646.3418250-1-Frank.Li@nxp.com> References: <20230517161646.3418250-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR03CA0041.namprd03.prod.outlook.com (2603:10b6:a03:33e::16) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|DB9PR04MB9962:EE_ X-MS-Office365-Filtering-Correlation-Id: c62beac5-4d9e-4c03-87ff-08db56f235e4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: H7aEbNDrMs2+D6zsdaAtQM/X+D/sO0Dz293ihy96qhVYpk0SNFZkvxmiTGYPQkynMHmESiAsaMiMsR4wp1J6nNvuSLHCIqEy9wZOK0RY0RMNkYbNmx269HXIBitE4MyClIIPVSptExNyjm0VNieouJRRrHhSj1xtXiUs/vG4X4168pwfMJVxzwKVJLMQyRJOjY0aWCud5YHdKVPSwnk/B+OMnHv9yrP7FWTs6hR5ujK/AxSzYxuQqfK6pKS4JczZlAD/pfpzuenTvq5kxYF3JQcba+X/1z0C5eqgastg81ADt4QhJTndSGZBYLecu9PvdZDXPY95vynPxO0GjnaxCZ2IqZJNysj7MQssjgw01dxqr51+xgw/2UEhTahi1qnpItG6LKnwNDVMEElJBdOGEx2oXcm96DllKsGu2TeoqboUNOS7riufD3wPilPpeTOVrDYGfQytMRaMTXIA5vKc1R2DgQKtsVN73u2PsgwEhXQZGwXaqBIXQ+SQua9xOJZxHbHu+YbFoPn7CAuhcaVBQcpoQsAdx7+jiu1x1QeXKoSbQGimA9LrzCTNpJQqd7/92HWbAd62vNWD+eEgEEKUeiLompRaYQufiCt0pFnG+0enPovDJjpG3ddjGHeVO1/o X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR04MB4838.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(396003)(39860400002)(136003)(366004)(346002)(376002)(451199021)(6916009)(316002)(66946007)(66476007)(8936002)(66556008)(4326008)(8676002)(2906002)(478600001)(4744005)(6486002)(41300700001)(5660300002)(6666004)(7416002)(52116002)(26005)(1076003)(6512007)(6506007)(186003)(2616005)(83380400001)(36756003)(38350700002)(38100700002)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: QwWyqBR7kmsUtMD1IWQnR/oUaADza0Nl18OKY0IvOOW+1Kdl1hkwIa+Z/yHPNt8ZVgvyDytysS8b3wIUDGhATMgDe4M9rBt0jUQuTCUgvmwCMyO82XG2POTUtA7TtYyy+D3SC7rxHd37PAzslWvx1AbmPRPBOML/BjzRoXo/T/kwTROpi7yTqgaY3ujPqtTguE5365PtGsX7KPy1R+LaMTSmTTRwhQBmierM5COjs+9R5Kkof5cLpUZRqB+XZBE0QUc3hPBtLvlOvst5YqAi+dBCWv8vjJszzus+IH2OLSqBMlXxEr9ssD6TwSmADzQ8zBNv5GIB+xv3rUdJoYpFw504JyAOJpp7OFL34l9U/k3CWcBf7pr5+nskk3wz9tm5UWDkSqH/pGP6BM1czPOOUjhs3LCGk/L6BTbfNepIxXnJfXrMfXrDa8KbRf/8R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VIw+okKmbssRJFRV/kwC9eobzedjguYES6Um2VRB+ssThiTMGFXOmikFruk= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c62beac5-4d9e-4c03-87ff-08db56f235e4 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 May 2023 16:17:29.2577 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: BMjuGoQ7+3Z3IKPkrubocHUGPLlUG3jxQXw1WxiIbbBZ+oqgityiDrEl27JyFQm7+GwXKfyb+bbQcEoc19558w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB9962 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Add cdns,usb2-disconnect-threshold-microvolt property to address fake USB disconnection issue during enumeration or suspend state for difference platform. Reviewed-by: Krzysztof Kozlowski Signed-off-by: Frank Li --- Documentation/devicetree/bindings/phy/cdns,salvo-phy.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Documentation/devicetree/bindings/phy/cdns,salvo-phy.yaml b/Documentation/devicetree/bindings/phy/cdns,salvo-phy.yaml index c9e65a2facd5..c7281a7c8244 100644 --- a/Documentation/devicetree/bindings/phy/cdns,salvo-phy.yaml +++ b/Documentation/devicetree/bindings/phy/cdns,salvo-phy.yaml @@ -31,6 +31,12 @@ properties: "#phy-cells": const: 0 + cdns,usb2-disconnect-threshold-microvolt: + description: The microvolt threshold value utilized for detecting + USB disconnection event. + enum: [575, 610, 645] + default: 575 + required: - compatible - reg