From patchwork Thu Jun 27 02:00:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Changhuang Liang X-Patchwork-Id: 13713737 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E4974C27C4F for ; Thu, 27 Jun 2024 02:01:39 +0000 (UTC) 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:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=VXXR6Z1ZlKVgncRv1WaJET3t9IxHZQooUdU+0PtL0NI=; b=xW+G719pdItIKf 3gF5uR66R5fRVS1FZXq2ZrWwKM7A05tOEdszWSCvxy30Y0pV/6UrpmH5auRibv1zUP1NL2JECgaL8 eMHwdk0+BE/nsPlqUQRWqbUESIi4HroC+AlF2r86X3J2vRzZZOHd7mc0/9gBgRTcDThG4j/qQAqCT O7vPrcCekrzj/f7ni5/dCO3UqTNf7vAR51UyEef7Y3TObUaH9nzXrqZenzwdGtPtRKRUBhamCuYsL OLW+OH400NV+RwzslEfhjUtu8eTLu9zpm5RGYAEGfTgZzMT709vkFX93ZGiQ/Gwll3uRkh8Pk4SxX jdfpuTjSOYxN56sVu/Kg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sMeSB-00000008wmm-0Ne7; Thu, 27 Jun 2024 02:01:39 +0000 Received: from mail-sh0chn02on2072a.outbound.protection.partner.outlook.cn ([2406:e500:4420:2::72a] helo=CHN02-SH0-obe.outbound.protection.partner.outlook.cn) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sMeS7-00000008wkp-23oL for linux-phy@lists.infradead.org; Thu, 27 Jun 2024 02:01:37 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RhVr/R7sDsRXwHVoV6QE4/5l8pWmTi65ZwtTiDChu2eurCCuSL8eyCQgAAZSq3K0fKYUcVyYXiaxvbTxAjBl+1LInZG8jOq74OTE4yZcQG9xkUGLax7LGa1FBx8KisZ93uSQQRigXoyHFQk8n9zTMNa/IEaJZ0tqrwGPb28bOsrlmNGiGTaUcczKhrM0oVL0AvKU4K3Z68ncP+lI50rbiiKxL0Fxr2OSyWC1ERsaD07EvjkldlML67WG4Dh3Bp42mZo+mmFVIjkHfA2v7g/14outNbJKQHVdwLGS0zgXwjEzIr583e+XqYFJgPhKFS5fq/xD6hmsc8OKj1/bXZDzTw== 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=nxjW1CWO7fLo2XgqLohNwC5foM/4mxUtXXe7ntLAJxc=; b=J1jKV/vs1SxKw0hKS9MdB53MApGJf+o4FlDnqmatcDpKD2aZYVM57i1qHK6Mrt+hvEZaqyZ3iT7WtIszZ96SGln8/cnvU+1dBaTdrNlNjNJdbmzdXtGS7CWJWHJ92TsLJdTxYgixcRCUjV6Pt7N9KDYBYHx6+AAE3thcvV8xgVGn2OdJL8+uFozzw9VTUFCF9pPXs2nwAcjqrJxOVRyLonRkbbLOjZr6pofcknIfLlYVJP3sM54unDmkRnbFHPH+c//2Q0nUsPcaRwE2JaSgYEg2gK9rJglE9wqKsWTpmoaNZX0EgqaYfjh/XYq6WeXOqUWnzTDEXdr4NtImiuCp4Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=starfivetech.com; dmarc=pass action=none header.from=starfivetech.com; dkim=pass header.d=starfivetech.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=starfivetech.com; Received: from ZQ0PR01MB1302.CHNPR01.prod.partner.outlook.cn (2406:e500:c550:1b::9) by ZQ0PR01MB1208.CHNPR01.prod.partner.outlook.cn (2406:e500:c550:19::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.32; Thu, 27 Jun 2024 02:01:07 +0000 Received: from ZQ0PR01MB1302.CHNPR01.prod.partner.outlook.cn ([fe80::4d66:ac5e:3903:cdf5]) by ZQ0PR01MB1302.CHNPR01.prod.partner.outlook.cn ([fe80::4d66:ac5e:3903:cdf5%4]) with mapi id 15.20.7698.025; Thu, 27 Jun 2024 02:01:07 +0000 From: Changhuang Liang To: Vinod Koul , Kishon Vijay Abraham I Cc: Keith Zhao , Shengyang Chen , Changhuang Liang , linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] phy: starfive: Correct the dphy configure process Date: Wed, 26 Jun 2024 19:00:59 -0700 Message-Id: <20240627020059.163535-1-changhuang.liang@starfivetech.com> X-Mailer: git-send-email 2.25.1 X-ClientProxiedBy: ZQ0PR01CA0034.CHNPR01.prod.partner.outlook.cn (2406:e500:c550:2::12) To ZQ0PR01MB1302.CHNPR01.prod.partner.outlook.cn (2406:e500:c550:1b::9) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: ZQ0PR01MB1302:EE_|ZQ0PR01MB1208:EE_ X-MS-Office365-Filtering-Correlation-Id: e5f67420-c752-4980-5f7b-08dc964d0201 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|41320700013|52116014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: W9Z+xZnTawrVwS5HUfzMzXykUPA7o3Mq2hUQH5Tp+nPm3Xj2Xel1eGLWDcylD/MlL9g65kNYfskEmD4aOZ253bI0ZWGOFDgaauEN7CKQDiOB9CNjGXRBOHWRtqOt6DlVfvYLmrWQgNDlSlp8JSwuNw9BYMJED9h2Kkn3owMAbydjSTNP1cnrHy/a7lzY6mMCHLFihCo5EwmvnPp2G7kA7ydOW8Nb78AzsC3bhkblS2zBG8r/vTn1waMXIeMC5Q1dRyJsXwUEf81yejyZUIs36AeR7C+AIwUhlstg2XZa6Imq325/GxYKKTes9gaiunglmg5kmo1zFb7c2YMC/dAPKjzedgKhNpg/NyqPZnblHvU1gvxXRB4cEKel14m9oym7cK+RO0wR7INhv4aGOcyokDbVXoTgRBRtcdhbrVsAfi6lgKeEwRZ5sVsF++CFycldPDjOuS1+R+ZufjaIpCQi0dVNzXw+jBzxsZUrJb13x7kcihg9jrrO9oDlEnaVZXCib9nQyycWJog1LgRIGgLYzjUCW35TGeLvQgSpuZ7izL9rbn2ljlq9Cf0YAV6B4q2XMdsjaP5ItYwQcsxHOQ7aLvR5G1r4vijO7H+9k2bH782VFn/ThIv07ih0+DfLKlFx X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:ZQ0PR01MB1302.CHNPR01.prod.partner.outlook.cn;PTR:;CAT:NONE;SFS:(13230040)(366016)(41320700013)(52116014)(1800799024)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: +lvv911r1qtpzmkcmJ5xe0KH7Da4XfP5qjr4rp3ns5a3k5snYJDvhMvsufgZ0/AYUk96gs/N3TXgLVa0yTyqFiCzpdOzKAyf5oFl6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c34VJKwzJhih6ThraPbaZrNR6kDiul/fzDc9xQO8XQUmXKOyIvXG3ETD05d6tNoPg0sSJLkX+JMjVytPaQA/3cnyCfbGItp6atcrafHAlSHnyMxK/1/sA+Z4urnjiY0H1f66Cu9IwInY5qzvvfe4+rFnf3sHQjtsZ+Yax7+6+nZFwvPVa/G7keL+0uxXKMCA/bji8Sm1UobcG8xVxJdE4xos/rqIhmsVpl8A/3Mk4E6fB1tSP7aVK2g6pmULumxm1SprMwAGaGSQWnWiZ58VSiG6Jg0xxTpDhf30YQVMQP9qPjWV3KEOI//EXx/R2TIkW+/tDLwgqBZsqjlDUmVlU00DfFr5qAkd6clpxxCfoQe+irW0W5xtdnvYPiCJElG+TO140Q5c/9hAv+JxsJzFeC2LA8WgmlrWIX66yRqrdZCD1n3QM4hx1PBY0Nw5u5M= X-OriginatorOrg: starfivetech.com X-MS-Exchange-CrossTenant-Network-Message-Id: e5f67420-c752-4980-5f7b-08dc964d0201 X-MS-Exchange-CrossTenant-AuthSource: ZQ0PR01MB1302.CHNPR01.prod.partner.outlook.cn X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jun 2024 02:01:07.1616 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 06fe3fa3-1221-43d3-861b-5a4ee687a85c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: R92aJZU24wbc2jtuaAWT73/GCVqnbzsUJxWcW+y9hirj7MS4YfUIGTDoCYba7XaGOmoc07kn5tFxd2xkBMzIeAW7qZYfgWPyT3haltvr+pbaKCpX23FlxEvjhHPo8/vr X-MS-Exchange-Transport-CrossTenantHeadersStamped: ZQ0PR01MB1208 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240626_190135_578708_7AB87719 X-CRM114-Status: UNSURE ( 8.46 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org We actually want to calculate the alignment values first, then use the alignment value to look up the data from reg_configs[]. Fixes: d3ab79553308 ("phy: starfive: Add mipi dphy tx support") Reviewed-by: Shengyang Chen Signed-off-by: Changhuang Liang --- drivers/phy/starfive/phy-jh7110-dphy-tx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/phy/starfive/phy-jh7110-dphy-tx.c b/drivers/phy/starfive/phy-jh7110-dphy-tx.c index 61b0da6096e5..c64d1c91b130 100644 --- a/drivers/phy/starfive/phy-jh7110-dphy-tx.c +++ b/drivers/phy/starfive/phy-jh7110-dphy-tx.c @@ -235,12 +235,14 @@ static int stf_dphy_configure(struct phy *phy, union phy_configure_opts *opts) const struct stf_dphy_config *p = reg_configs; unsigned long alignment = STF_DPHY_BITRATE_ALIGN; u32 bitrate = opts->mipi_dphy.hs_clk_rate; - u32 i = stf_dphy_get_config_index(bitrate); u32 tmp; + u32 i; if (bitrate % alignment) bitrate += alignment - (bitrate % alignment); + i = stf_dphy_get_config_index(bitrate); + tmp = readl(dphy->topsys + STF_DPHY_APBIFSAIF_SYSCFG(100)); tmp &= ~STF_DPHY_REFCLK_IN_SEL; tmp |= FIELD_PREP(STF_DPHY_REFCLK_IN_SEL, STF_DPHY_REFCLK_12M);