From patchwork Mon Jun 26 09:29:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xu Yang X-Patchwork-Id: 697895 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 C902CEB64DC for ; Mon, 26 Jun 2023 09:28:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230351AbjFZJ2R (ORCPT ); Mon, 26 Jun 2023 05:28:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230025AbjFZJ1e (ORCPT ); Mon, 26 Jun 2023 05:27:34 -0400 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2079.outbound.protection.outlook.com [40.107.8.79]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E47431BD2; Mon, 26 Jun 2023 02:26:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Glv525ezYAPf+5XjpT05rxSKf1aQUmP7aWterE3sOpjkd5XruSGPORg5pz5A7LqeQR1MJALhnuDHchOqPHSnVi1KvkjXh8ZYCQxH1ATakaS2dtLYYcsyDp48lxzyK09bdM0fY+wWcvREXV1Fo5u+3ZebZvQiI14mX84wkgjK0XU0c0tig1hBLIqocMHlztraAJ3GjZJz6NS/cxqStN1/rrytbRPpKxN3wdLupUf0zXabGtmkMEgwt4Rw5rxPEn9rC37H8dZNt6X9Sj0B+2FME263X8BJL4IIxs99S6zTIKfarOULTk1HxxzurveeMxQ2NsIg/X1IOZ0ZaKZatUtAuw== 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=72dMijjcpkoe/7UWH6FMl3zE66rWMX2rbGyx3gi3b8w=; b=WFreBV5qQTbF9PfFPHfXe2PSn6evgO4vms6uCXCxpu1eSEJbyKv5QGS3/6q0aiuA1DZPgEdZUnerzdGiJ2rIy5Dr9u8Cu5VU0Pazl1q6mhPSglF+t5YzZReTnGqwPMk8TdxpMq1hqyGdqMA6mQVmmpA51fNjJppoHszpYMZIWGXEn/NTGO8vSy5Q+/8fyz7R4xSCbyKgXmmivadIZzxgyy2u5WRNdqsaMBiUCkHL3yveBNu3ELO28muI/nviNANxas3EUACv8TTO2cBW5Pho9CGv/DwjMJvh1IaEsXLg9ea5PLL6BhXqn9Ray1tzJVwlRvN9LO3fnSSBe0HoXtjJ1A== 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=72dMijjcpkoe/7UWH6FMl3zE66rWMX2rbGyx3gi3b8w=; b=RB9pfjoU1XxF4ptivED7slNk5UvdgSKi9uFDv4vPeoRe3nursGN3bGtK/CbM+19XUFkP7tyJhhWa93KLrG8q2cBxdTL6lm5+xB3SiDzn50yJUBp2p6QC5WK3sLeGNA2MvpL3iFrWVWbKxpjctmwp3rcwPbLi/T6RLglZWj4EOYI= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from DB7PR04MB4505.eurprd04.prod.outlook.com (2603:10a6:5:39::26) by VI1PR04MB7150.eurprd04.prod.outlook.com (2603:10a6:800:12a::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.24; Mon, 26 Jun 2023 09:26:24 +0000 Received: from DB7PR04MB4505.eurprd04.prod.outlook.com ([fe80::f9b0:8c34:e57:92a4]) by DB7PR04MB4505.eurprd04.prod.outlook.com ([fe80::f9b0:8c34:e57:92a4%7]) with mapi id 15.20.6521.024; Mon, 26 Jun 2023 09:26:24 +0000 From: Xu Yang To: peter.chen@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, gregkh@linuxfoundation.org Cc: conor+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, linux-imx@nxp.com, peng.fan@nxp.com, linux-usb@vger.kernel.org, devicetree@vger.kernel.org, jun.li@nxp.com, xu.yang_2@nxp.com Subject: [PATCH 1/3] usb: chipidea: imx: improve logic if samsung,picophy-* parameter is 0 Date: Mon, 26 Jun 2023 17:29:50 +0800 Message-Id: <20230626092952.1115834-1-xu.yang_2@nxp.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: SG2PR06CA0246.apcprd06.prod.outlook.com (2603:1096:4:ac::30) To DB7PR04MB4505.eurprd04.prod.outlook.com (2603:10a6:5:39::26) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB7PR04MB4505:EE_|VI1PR04MB7150:EE_ X-MS-Office365-Filtering-Correlation-Id: be628ff7-ba3d-44e4-215b-08db7627693d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2da2PTa3WYyVx+2PvSTCWAJDXUy9ViDTaufDSYVR/lOoT7LvZK19zo/7eLkLfCyo2rzw/mvKYDAgww2HNSvG4sli6fmY9GjM0Vu4D7XX/iIPbx1PPUW183XTVMbQe2KafZkilav99rnugkj4QyH8th6tI2POEHjQb0Dw7dQLRMKQaWVanRdoRq5ldbElNwTWoC+qDma6pMtPJkLlgLhHXxXJ9p2ip+zH4XZkTKXouvVYoD86CUxPplyLR2MXIAP6canYfDCKy+g4o6NqOiuJmbHzIuDgUQ/dhMp4t4jAp2OfF8W/8LjAelPeTBk+ew2CvQb6vPnQ7AN0XJfDgww0E9tAJxSmZXEmB113m4DpISJL0SjkfCzycecmZ54Lzm3XejrGaJA+c6IIvQLMUTIyLcBh4VUyMeJ1/wtbNMSXL7RU7SBqY2xpqrQMyRtQdIfIZQ+zZs93Cnpmza4xxyrHxvV6zIdh+wVzrSWTNy8IvOG+x4fooN08xdSLCtl0EGngM0OIfoyxUj8/4yGSO/x3H46YzERQ20e3BXKdHXEtMm+6G+OjBkBhoNhNsg8NHMqjdRZRVE1eTbP/oUoXjb7NxR5XUetEoHaD3CsWrhRNuBGN68uqgeakCcm0X0b96Byx X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB7PR04MB4505.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(396003)(136003)(376002)(39860400002)(366004)(346002)(451199021)(26005)(478600001)(6666004)(52116002)(83380400001)(2616005)(6512007)(1076003)(6506007)(186003)(2906002)(6486002)(5660300002)(36756003)(38350700002)(38100700002)(316002)(66946007)(8936002)(8676002)(41300700001)(86362001)(4326008)(66476007)(66556008); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: b2pFQUh+ze3FO8DIURh4ITbNlVyKFVzZWqNRPG9pFr6mGhtVHLvdNYiT6pGzN/rnc4dHSY4TtYEsnjgnXb5rQkC2Q968fJkMtZv3bGvKQm6A3b9Rnlqin74hc7iy30aZL3KcL/Qii5UlJiqL9Gn0zSXcmsl1Jz0GFN5SwuqOh7FTKpccNKmxC/BBIfFOR7mlVpr9iqX6AwGrDF1KpBTTriZY8e7b/HbnAE0OjKS9JyBiR/vv34NFOvMzyfaPnVWzBrJjW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LjN5Vzj9zESLCgzj4uBgaRT0BHfwXythB8uz/x+Opp+28z0GEPHL+DoyfkWxyaLgr4X4RYItLZp2rW6qm0euxTGv+5s5QY4eLO3KMMd3PLwNKDDof2necvx1r91hFqT+ZlBkmYsVN19gSOVVZdxjEWrFucinuS3GU2EcbhQXyzTrbY95BtkSV28TRT9OIKgWNlaKcyDRp9Ebdi8NjOBj7GgywjRmYVVnz6tLIul1snT9ucjbIUW5uK X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: be628ff7-ba3d-44e4-215b-08db7627693d X-MS-Exchange-CrossTenant-AuthSource: DB7PR04MB4505.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jun 2023 09:26:24.7531 (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: +kTYlX9ewciMu43K4n/VZRUgjxfsUnAhaKZqxICduDiy8Zy21hBEhTsYtaYGV5pLqH9yDXrkh4vRP6z2p+ZjZQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB7150 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org In current driver, the value of tuning parameter will not take effect if samsung,picophy-* is assigned as 0. Because 0 is also a valid value acccording to the description of USB_PHY_CFG1 register, this will improve the logic to let it work. Fixes: 58a3cefb3840 ("usb: chipidea: imx: add two samsung picophy parameters tuning implementation") cc: Signed-off-by: Xu Yang --- drivers/usb/chipidea/ci_hdrc_imx.c | 10 ++++++---- drivers/usb/chipidea/usbmisc_imx.c | 6 ++++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c index 336ef6dd8e7d..873539f9a2c0 100644 --- a/drivers/usb/chipidea/ci_hdrc_imx.c +++ b/drivers/usb/chipidea/ci_hdrc_imx.c @@ -175,10 +175,12 @@ static struct imx_usbmisc_data *usbmisc_get_init_data(struct device *dev) if (of_usb_get_phy_mode(np) == USBPHY_INTERFACE_MODE_ULPI) data->ulpi = 1; - of_property_read_u32(np, "samsung,picophy-pre-emp-curr-control", - &data->emp_curr_control); - of_property_read_u32(np, "samsung,picophy-dc-vol-level-adjust", - &data->dc_vol_level_adjust); + if (of_property_read_u32(np, "samsung,picophy-pre-emp-curr-control", + &data->emp_curr_control)) + data->emp_curr_control = -1; + if (of_property_read_u32(np, "samsung,picophy-dc-vol-level-adjust", + &data->dc_vol_level_adjust)) + data->dc_vol_level_adjust = -1; return data; } diff --git a/drivers/usb/chipidea/usbmisc_imx.c b/drivers/usb/chipidea/usbmisc_imx.c index 9ee9621e2ccc..1c7932f22218 100644 --- a/drivers/usb/chipidea/usbmisc_imx.c +++ b/drivers/usb/chipidea/usbmisc_imx.c @@ -659,13 +659,15 @@ static int usbmisc_imx7d_init(struct imx_usbmisc_data *data) usbmisc->base + MX7D_USBNC_USB_CTRL2); /* PHY tuning for signal quality */ reg = readl(usbmisc->base + MX7D_USB_OTG_PHY_CFG1); - if (data->emp_curr_control && data->emp_curr_control <= + if (data->emp_curr_control >= 0 && + data->emp_curr_control <= (TXPREEMPAMPTUNE0_MASK >> TXPREEMPAMPTUNE0_BIT)) { reg &= ~TXPREEMPAMPTUNE0_MASK; reg |= (data->emp_curr_control << TXPREEMPAMPTUNE0_BIT); } - if (data->dc_vol_level_adjust && data->dc_vol_level_adjust <= + if (data->dc_vol_level_adjust >= 0 && + data->dc_vol_level_adjust <= (TXVREFTUNE0_MASK >> TXVREFTUNE0_BIT)) { reg &= ~TXVREFTUNE0_MASK; reg |= (data->dc_vol_level_adjust << TXVREFTUNE0_BIT); From patchwork Mon Jun 26 09:29:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xu Yang X-Patchwork-Id: 697894 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 13E5DEB64DA for ; Mon, 26 Jun 2023 09:28:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230373AbjFZJ2U (ORCPT ); Mon, 26 Jun 2023 05:28:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230079AbjFZJ1e (ORCPT ); Mon, 26 Jun 2023 05:27:34 -0400 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2044.outbound.protection.outlook.com [40.107.104.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 326DD1BDF; Mon, 26 Jun 2023 02:26:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GxVWzZ6STpciekRf9zeu+LA+VCMAqy0uLD1RS7RsBcqzNSECGrqC44ODr0ckuZZwOjdUyq9eQEDYsSUK3jYVzVNWxkLxw3yrWpTP8t86dnSvqsHzbRJAOtCZFqUJQYG9vgAe1YsuzirjtiPBCYYKes33nF/Nca1ZmGXCZvTCUAaIbO7vC+WGrxtwUz3xC7hcuR3WYXPI1TFb/181y+4l2fS6dY2NVnhoVQ+3daPAyY6+B8QNCuMpP3Hei3OOHKVZ+h5htaSW4i3DpuHtEkLYaOyXSBzaK78MDpKb7qeS3G669XIu+yhC1MDO23F1xpdQHwecp2y4za+1nBHrINBpgQ== 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=YWfa+FnS5Ot71PQgqfhzfr5ZR2DfDbGFBV67ZZ34WKU=; b=b1Bv++eOXa85MbtFK/Ci+ofKPhrhEJwHQOGFoDv0HnM6lLIL9sMbHy46F/y0k6T36eorJ+MwOZqoXxpQ5VVcDcwPh+kaYwe0Q7P3TPNcn4veGo9kHq/75K6SSq41DB9lr5P5ipzVRPCGjhykogmdGxGYqZIPZw3NgGZz00HiLwhaj/mX7lfnDsqaUnopUsGUNRr0vQCWqLalZSQN2A5C/jvfzYwF1VhTVbHRxaOJqry6i3XPk5VVwxTpa4EbN2Bp7j93Qh+ZMaglNNqEhd3FtfYxTcVyiDrAWBczBl/mIe3/4CKBOqWTdTLLT+0Scu+A4XGbtapoK7Jvm3brMTXmZg== 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=YWfa+FnS5Ot71PQgqfhzfr5ZR2DfDbGFBV67ZZ34WKU=; b=EhSPccRKDMsGXMiQxtlD8d1SBCAZJNtIPw4+QIWpipH1XYWTQ1g+tJ8xE/6mDutUsqWWtiPZfYvMeohmmIGyT4WSefg6avdiqWEsGDwn7GosTQfjpw+Nyi40EUCjZdrnPVe5lcKO70EwEtDjeqSJF70V2L8LvZ3Yv1f9HnrBxN4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from DB7PR04MB4505.eurprd04.prod.outlook.com (2603:10a6:5:39::26) by AM0PR04MB7156.eurprd04.prod.outlook.com (2603:10a6:208:19b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.26; Mon, 26 Jun 2023 09:26:33 +0000 Received: from DB7PR04MB4505.eurprd04.prod.outlook.com ([fe80::f9b0:8c34:e57:92a4]) by DB7PR04MB4505.eurprd04.prod.outlook.com ([fe80::f9b0:8c34:e57:92a4%7]) with mapi id 15.20.6521.024; Mon, 26 Jun 2023 09:26:33 +0000 From: Xu Yang To: peter.chen@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, gregkh@linuxfoundation.org Cc: conor+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, linux-imx@nxp.com, peng.fan@nxp.com, linux-usb@vger.kernel.org, devicetree@vger.kernel.org, jun.li@nxp.com, xu.yang_2@nxp.com Subject: [PATCH 3/3] usb: chipidea: imx: add one samsung picophy parameter tuning implementation Date: Mon, 26 Jun 2023 17:29:52 +0800 Message-Id: <20230626092952.1115834-3-xu.yang_2@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230626092952.1115834-1-xu.yang_2@nxp.com> References: <20230626092952.1115834-1-xu.yang_2@nxp.com> X-ClientProxiedBy: SG2PR06CA0246.apcprd06.prod.outlook.com (2603:1096:4:ac::30) To DB7PR04MB4505.eurprd04.prod.outlook.com (2603:10a6:5:39::26) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB7PR04MB4505:EE_|AM0PR04MB7156:EE_ X-MS-Office365-Filtering-Correlation-Id: ce1a8cc5-e9a1-433b-ba24-08db76276e3f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: EvI4Ddm1lq2Y1E2ME98J3OOhSEB/5OOJgb9tHmHORJi3OZWY1MO6GRUeO2rwJjsQOWYhmFPjzTo7NNeHjLgKnfUxH4p6IHO7Q9m3I+hHpAVninb290lBKtt5X0bNKgf1Ape5J6NGojBcqW6GDpasmnyjmgL58uDH0nYaFOYsNVJAJOzYvGBXXrpSJJ5FiU4fBG/XHiupgPBJPNc93KV02WEsRYQH/s9yuGUOdxORhBLKDaWWiZfI4VrYqrDkt9b28VjCB7i8pfPTPelpC1HWXAItJtz2jfAojbgUEd+45o1CX22lN7eBkMUSffQTWIZW4anScMqs/BrEUHAYDBcWchQb45EVrc3FpGlawiR1zHoGvUbZBdJz2m1qUBc5D9lfU23NapwpOyRJPdxdAmUFe8t5T64h/BiZ5q5uydOfAqpyQCw2yJb6ONI8KESTzIY4xrqmHeu67Ez1qxYCymZnUP07KD1Z1TKAUXCEfwBY0YqBay4aZVuGamd8u9+zPoIpKu/erBlMjIdgI9pPsR220AEezpPTvW1ZP17Acz3H8y5lEDF7HZllQiBeWEDi/RZydIXpmekvB19CevZb0PwpBJMCRl6V0ggNYvftQTs5kJwQ9MbnL1H/pxfxkgUB6+IH X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB7PR04MB4505.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(346002)(376002)(39860400002)(396003)(136003)(366004)(451199021)(478600001)(6666004)(6486002)(52116002)(2616005)(26005)(186003)(1076003)(6506007)(2906002)(5660300002)(36756003)(38350700002)(38100700002)(4326008)(66946007)(316002)(66556008)(8936002)(8676002)(41300700001)(86362001)(66476007)(6512007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: X8TmJZnFt1f7QQKRpVDIPYcXAu0g4jb+UDB+yEVvw9yKZ0WTi3mzlWWHdp+3VsoPjghtmG3sc2n74fbZgf1LzV7bj+9QMB3dzjHtpc+I8qRcXjnxkZcn7V89lwqrKNckeXVNK4Fe3MZNra+OG65/8sfbeUg/VT5cyd7z4UBDFCzIJM5DECOoiH3L2+hW3zpodboi9JZ0vVxKPFpw+bHqnN9EiqaTZpF4J9pJff6JC7jkGQXr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Gcx8t0FGUblsmU3Z8k5yA/6Azn/VqUxUvYYJQRenG6kdiTTUsX2casVapA2uwyPTyWp7WyAjWKQMxwwya3TJB0QQYNh/pNoO/bncX7lCWrqcmknIFO8cJUAiPrcqV09nzn7FeqgIkbfSclEqCx/O4DrSbJH2+YGb3WnagGa2DSC1fmbEIWej11+CKM6RKV/J0R5TzoAejP39LJv6XqZWGfsn9CqgUwJBnSZUDpnfJx4Mcteoa2Gu7sqghKSKgX/JvevL98WxG9lZOGVJx/tJ0RDbVU4Bh X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ce1a8cc5-e9a1-433b-ba24-08db76276e3f X-MS-Exchange-CrossTenant-AuthSource: DB7PR04MB4505.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jun 2023 09:26:33.1095 (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: UdVQdpiaJ9OoeDzeCeO4PGYDD3v72cUF8EDyOUJkdipajRQkKH0gFF+MgeBOCqTt7kQqgQlvXURi/xKkJPXfaQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB7156 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org In some cases, the user may need to tune the rise/fall time of the high-speed transmitter waveform for USB Certification. This will add a parameter for this purpose. The value will be fetched from dtb and finally written to the register. Signed-off-by: Xu Yang --- drivers/usb/chipidea/ci_hdrc_imx.c | 3 +++ drivers/usb/chipidea/ci_hdrc_imx.h | 1 + drivers/usb/chipidea/usbmisc_imx.c | 9 +++++++++ 3 files changed, 13 insertions(+) diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c index 873539f9a2c0..140fbb8dc320 100644 --- a/drivers/usb/chipidea/ci_hdrc_imx.c +++ b/drivers/usb/chipidea/ci_hdrc_imx.c @@ -181,6 +181,9 @@ static struct imx_usbmisc_data *usbmisc_get_init_data(struct device *dev) if (of_property_read_u32(np, "samsung,picophy-dc-vol-level-adjust", &data->dc_vol_level_adjust)) data->dc_vol_level_adjust = -1; + if (of_property_read_u32(np, "samsung,picophy-rise-fall-time-adjust", + &data->rise_fall_time_adjust)) + data->rise_fall_time_adjust = -1; return data; } diff --git a/drivers/usb/chipidea/ci_hdrc_imx.h b/drivers/usb/chipidea/ci_hdrc_imx.h index 7135b9a5d913..88b8da79d518 100644 --- a/drivers/usb/chipidea/ci_hdrc_imx.h +++ b/drivers/usb/chipidea/ci_hdrc_imx.h @@ -28,6 +28,7 @@ struct imx_usbmisc_data { enum usb_dr_mode available_role; /* runtime usb dr mode */ int emp_curr_control; int dc_vol_level_adjust; + int rise_fall_time_adjust; }; int imx_usbmisc_init(struct imx_usbmisc_data *data); diff --git a/drivers/usb/chipidea/usbmisc_imx.c b/drivers/usb/chipidea/usbmisc_imx.c index 1c7932f22218..56570100ffb8 100644 --- a/drivers/usb/chipidea/usbmisc_imx.c +++ b/drivers/usb/chipidea/usbmisc_imx.c @@ -130,6 +130,8 @@ #define MX7D_USB_OTG_PHY_CFG1 0x30 #define TXPREEMPAMPTUNE0_BIT 28 #define TXPREEMPAMPTUNE0_MASK (3 << 28) +#define TXRISETUNE0_BIT 24 +#define TXRISETUNE0_MASK (3 << 24) #define TXVREFTUNE0_BIT 20 #define TXVREFTUNE0_MASK (0xf << 20) @@ -673,6 +675,13 @@ static int usbmisc_imx7d_init(struct imx_usbmisc_data *data) reg |= (data->dc_vol_level_adjust << TXVREFTUNE0_BIT); } + if (data->rise_fall_time_adjust >= 0 && + data->rise_fall_time_adjust <= + (TXRISETUNE0_MASK >> TXRISETUNE0_BIT)) { + reg &= ~TXRISETUNE0_MASK; + reg |= (data->rise_fall_time_adjust << TXRISETUNE0_BIT); + } + writel(reg, usbmisc->base + MX7D_USB_OTG_PHY_CFG1); }