From patchwork Sun Jan 21 12:42:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ziyang Huang X-Patchwork-Id: 13524558 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 3144AC47422 for ; Sun, 21 Jan 2024 12:43:29 +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:References:In-Reply-To: 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: List-Owner; bh=KmPza8rmsbJrqXGiBYEDBT4YPtKt4UEPEL8vpcXQywo=; b=TF7oafT9V8dZJf XkfJwIP9csWQKNlsRfUIx6pvkMpMORCRYj04/pUtr98TEKcGHG8JnsDszxRx/SDD+O8nfcmWC0DvV bFZYlEltl7GxYI59kkuaDrrzy0KxZIkFtz1RfxbPwpT4EbkO+3rcs0Tk8Qw06/sNjxtvqBC1oDG/t Q417YpONbv0o+HSAr9KQ+y0GnxXP0s8ElzlokB86xBU7f9fUgFFllSPZTlkTpKWAdOsF+K7qQZvnJ HzdxfzzfUIz317zDb76SGUiA7Xo2RE8EF2JMOpUgLl503dpGJm2segNGjJZRbFuKapAguWjCsLhzb O6Hs+mX03zsYlshpXxGQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rRXAF-009WaP-27; Sun, 21 Jan 2024 12:43:03 +0000 Received: from mail-tyzapc01olkn20800.outbound.protection.outlook.com ([2a01:111:f403:280c::800] helo=APC01-TYZ-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rRXAB-009WZl-30; Sun, 21 Jan 2024 12:43:01 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FlX6zIOnbg3G2pFJVl7iUPuB6jICbsZpJoJj/rEgxyR99/V7FgfcpZ+9O2igxYycrV48/0DhRUNO7puDRYi7vXvrekqdd0g1uNNnaaJgmbOgHtB/9SS+c4EfymPIIZeF8uNR8HRcALHwPsUGh7mmBuvgN02Efl5BGlhvniu9lxjF4YqzDSmuWALjcmh7SQf5PlKwAIq2fLPwHSD8y/oBap4ilDIe/leAF5/Xm69BZJ8atiBqtj0q0H7qtrDj6F4RWKRhNElCSQOSHZcT0iWFBaJ5pf+AVxUp9yxfrMWK459JjJ2zTDuYDoJUSD2PI27W3GsAq+wbeA8TU0aB011MSQ== 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=dYYNimcnF3YqLTTNLWhrZAnb9da3v1uk3csr6SEAqU8=; b=cfrLDaPlSWH0dBLoRM7fV2zeVwqezkeW6pD2Bw1zQQpJTGXtLEIWNjSMgPnRRkq4oiS/fOuNAl6xHG6d/+H6i+WE7ft1+G6GkfAXSybpJk10+RJxhOZVQSOX80H8j9LgmU/+191W0lmaiDrMKFgKAD6LAPvmbCa5C15SG4hfh4tZNAxisiB/eSUYgAsA3Hvkw6hwi4sNJRhyT6TQ5v7+4nmEXlBV4+rPS4hhDKwMdq+YVgHk8vgvTglh13cye4DUWzdbubP4o+H2spUMQ8YEjKPLFDxwgCnMALjVg20yEIBFc1Hd6NqCUsrsErmZ48WSMhobKPkusAYyHdvI3NQjhw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dYYNimcnF3YqLTTNLWhrZAnb9da3v1uk3csr6SEAqU8=; b=dFInY6Zg+AoAU750VowerFeTyk/1IA/bCtVWr7wBa63pxmsyg72LEZUYe3CwWPdbMGe8r/B545CZKtE5U9a0m8Phabk6doMtnai73OEIhF3wvngLdkqcXvv6kNez3ITAs/uYrl+kc627obGlNBsfERlPco3Gc8aGrpXEdCJzGQXDAHcblX4/oqhQchsJMNa433ZY5sfRr3eqWQQmj35T/b98l2Zd040Al1K0yWJ6JmxLKkW7f6iS4bnQv1edN4WXm4uGJud4d53akGjY77MNPcbEDXIGOHuegPjOruyRFpamfvM2OU3Hf/c1yN+iDUWlJeliEMTrd3abUKDi6l/wPg== Received: from TYZPR01MB5556.apcprd01.prod.exchangelabs.com (2603:1096:400:363::9) by OSQPR01MB6119.apcprd01.prod.exchangelabs.com (2603:1096:604:27b::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.30; Sun, 21 Jan 2024 12:42:55 +0000 Received: from TYZPR01MB5556.apcprd01.prod.exchangelabs.com ([fe80::bcb7:50f4:7a16:4ec0]) by TYZPR01MB5556.apcprd01.prod.exchangelabs.com ([fe80::bcb7:50f4:7a16:4ec0%7]) with mapi id 15.20.7181.019; Sun, 21 Jan 2024 12:42:55 +0000 From: Ziyang Huang To: mcoquelin.stm32@gmail.com Cc: alexandre.torgue@foss.st.com, richardcochran@gmail.com, p.zabel@pengutronix.de, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org, linux-mediatek@lists.infradead.org, Ziyang Huang Subject: [PATCH 1/8] net: phy: Introduce Qualcomm IPQ5018 internal PHY driver Date: Sun, 21 Jan 2024 20:42:30 +0800 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [nfEoGlwwp8/ShSyGEZ809gEznySqDSjYDALQWyLowDbaoJai5WxIrw==] X-ClientProxiedBy: PH8PR21CA0009.namprd21.prod.outlook.com (2603:10b6:510:2ce::26) To TYZPR01MB5556.apcprd01.prod.exchangelabs.com (2603:1096:400:363::9) X-Microsoft-Original-Message-ID: <20240121124237.3328702-1-hzyitc@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYZPR01MB5556:EE_|OSQPR01MB6119:EE_ X-MS-Office365-Filtering-Correlation-Id: 980c753f-cf0a-4d35-0300-08dc1a7e7d91 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7Tcyqn8+gLjyoBqrZ8vnSkt/uFUACjcMSbgl/O2VTDiQj1z3ToG61wycj2N87BbWqJV8TwLr6L9PU86OYQcDLStIA1D0JRJpDwT36sG5t4ciVnmn6t9ev8/B+OSAFc8p+GWMssuORSOmXrNiDeMPmbEWSFitK/qfouGUAmO744Ol2Pu8wJB7i6HwrgNFZUpolszCx5DL9yzDP1KVsksMs1hbrLoazp2jwvtGLYa/qnyQvAgXgKJ4Pa5XYTe8hXescof49ezuHjgScwG3sXX7iHHhm8LEzUCjDEu4bguSWv0XwbRuRijEHCobJKYimJUc+cy0SukYhLbfQYBuixg48D6eHOAhvz5mIwDnEPRsoNkrBhRsdoLKMSMMFnWh24CK6trY2P/qezlmbvtYTDIQNa5AJfBXaNgn/DXnUA8S8M5OI4r6t56Xx80P47PqOVy2vmL2pGJT7Lj1ZlwNWq1y0o4LUaM5IBhCWniHKOSQ3cQ3FnOq9C+449RZ88cSNxKiugUCzUF7Lk5bwaJj8/KrWLPZHh1ehFBhAYyMeg/b0MxmBdunlQkYRLUVVBbf27OsloKHrbsEwMgnFby7gzA0ZcYnTaRkNWACqDp5cmsnFksbjpHhJHSIG/ey0V3myglk X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: SA5czwzNvszwxRjUHPn0nLeZuLBn9wOwl2/Q3uPEJ4qH3f4dfRFwEmnL7d86Rf+9JzRXCmivzCweCA0fzPWeRW9/BzvTVAXD6rLDcuiubNca8xTP17GnUrU4oWWdb6X7cS1jHhl09B3gx7A9e+IcxPoljvzSxMXjz+oiJG3iq/hQEKpbgUmgrCCYGsW4zOAdk0goljP8Tg5AMkbDlqZu3amG90AzFaZIA8Jxugp2HWL6Bv6zgyaSNvgNWLBF4FFZFvAbjzJHW4/BIyj4u9pcUxwnVONzZCCFbei0a63yNro/RtrZ/JaIZZZwcZg8WBkkMp6KgEZgkZtyCYQpjv0+YQb82OslXnBt8vIosT0NlFWkuQTvVqJ1SG9bwMzcKY3EadkvVs7aUdFYSC1YC4NLVWk8mSQ0jtKDW5QgG658k2Zwzjy0zejqAl7shzsdrWbZz13nZjbFCG7whZT7/32Bl5NH/mk/JBD7vEGDek0OKSh2eRvBYqb+JxFRsCTFkRFYzLgs8wXPESzVZtKQKS/lkeZ+mMwdSLyiLl/miSxvnF0l1IEY2BnoRuGzBIXA6NffyTWiFiimIKSg1ELeyWry6ShPyQ+NhLcrAT4XGfOClLbjerAzVCF4FIGLWsD7VtiNslWfliS+Be2dGoGHN2f0/gHB+lpXaie9prEgdyfEb5nm//8f/ixFfWk7fCbpE7RjKHx0RhS/Hg8nxDq9oFwHmAqGNEEMJdCIcHaKw5mu4Ipb2HoUI+uLYBoEKnF1VQEg65XxOiMopt/H0nXq+CxFZ32ZtKKeVA4THIy8CAXTRKwBAEftugtYkYh6cUxR4R2gUCZKhC8dKRYS1auT6uhJL4955ckVBvC9QfQWQXBXYWawSSia9bg4CQ4bhGD/ri6t1v7RWIQbgmCRbcyfaXbH8ILTX22OIUF6LiuAIKDM/zPYGOh1wEIAc61w6WTtJH47zGu9qYAYwDDsTGkXa+1On0vMFrUANwPvYl5fdtc+PgB7Mq4AFTsLhMdZjVAU5/HWuusdTd21EBtFv7kqQxVPHBIx1C5JXWub+Grw5u0IsO+M/bKgOZU74F8Y5hC+1hZ2IENERWH0SH4RSnA4SUj+C0Zen/qat4ZaYqqWGmIUYqVjNLbq9vaZM0ofXbD4Rvcavb16BhTh8li7FJwXztrJXaSl7FBhjPRYFLoaL5DsC5boi49nZSbNleR61vzb+F5fEwqwM12slwqlOhpgwcvR9qdwpgE2G7/tojXyxKMnWrC28MhlJlX0mHxn3ESP5ZdE X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 980c753f-cf0a-4d35-0300-08dc1a7e7d91 X-MS-Exchange-CrossTenant-AuthSource: TYZPR01MB5556.apcprd01.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jan 2024 12:42:55.7643 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: OSQPR01MB6119 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240121_044259_976846_03F6208B X-CRM114-Status: GOOD ( 15.51 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Signed-off-by: Ziyang Huang --- drivers/net/phy/Kconfig | 5 ++ drivers/net/phy/Makefile | 1 + drivers/net/phy/ipq5018-internal.c | 125 +++++++++++++++++++++++++++++ 3 files changed, 131 insertions(+) create mode 100644 drivers/net/phy/ipq5018-internal.c diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig index 107880d13d21..2d068fea7008 100644 --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig @@ -202,6 +202,11 @@ config INTEL_XWAY_PHY PEF 7061, PEF 7071 and PEF 7072 or integrated into the Intel SoCs xRX200, xRX300, xRX330, xRX350 and xRX550. +config IPQ5018_INTERNAL_PHY + tristate "Qualcomm IPQ5018 internal PHY" + help + Supports for the Qualcomm IPQ5018 internal PHY. + config LSI_ET1011C_PHY tristate "LSI ET1011C PHY" help diff --git a/drivers/net/phy/Makefile b/drivers/net/phy/Makefile index c945ed9bd14b..16d65378ae34 100644 --- a/drivers/net/phy/Makefile +++ b/drivers/net/phy/Makefile @@ -64,6 +64,7 @@ obj-$(CONFIG_DP83TD510_PHY) += dp83td510.o obj-$(CONFIG_FIXED_PHY) += fixed_phy.o obj-$(CONFIG_ICPLUS_PHY) += icplus.o obj-$(CONFIG_INTEL_XWAY_PHY) += intel-xway.o +obj-$(CONFIG_IPQ5018_INTERNAL_PHY) += ipq5018-internal.o obj-$(CONFIG_LSI_ET1011C_PHY) += et1011c.o obj-$(CONFIG_LXT_PHY) += lxt.o obj-$(CONFIG_MARVELL_10G_PHY) += marvell10g.o diff --git a/drivers/net/phy/ipq5018-internal.c b/drivers/net/phy/ipq5018-internal.c new file mode 100644 index 000000000000..d1331951b4d8 --- /dev/null +++ b/drivers/net/phy/ipq5018-internal.c @@ -0,0 +1,125 @@ +#include +#include +#include +#include +#include + +#define IPQ5018_PHY_ID 0x004dd0c0 + +#define TX_RX_CLK_RATE 125000000 /* 125M */ + +#define IPQ5018_PHY_FIFO_CONTROL 0x19 +#define IPQ5018_PHY_FIFO_RESET GENMASK(1, 0) + +struct ipq5018_phy { + int num_clks; + struct clk_bulk_data *clks; + struct reset_control *rst; + + struct clk_hw *clk_rx, *clk_tx; + struct clk_hw_onecell_data *clk_data; +}; + +static int ipq5018_probe(struct phy_device *phydev) +{ + struct ipq5018_phy *priv; + struct device *dev = &phydev->mdio.dev; + char name[64]; + int ret; + + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + if (!priv) + return dev_err_probe(dev, -ENOMEM, + "failed to allocate priv\n"); + + priv->num_clks = devm_clk_bulk_get_all(dev, &priv->clks); + if (priv->num_clks < 0) + return dev_err_probe(dev, priv->num_clks, + "failed to acquire clocks\n"); + + ret = clk_bulk_prepare_enable(priv->num_clks, priv->clks); + if (ret) + return dev_err_probe(dev, ret, + "failed to enable clocks\n"); + + priv->rst = devm_reset_control_array_get_exclusive(dev); + if (IS_ERR_OR_NULL(priv->rst)) + return dev_err_probe(dev, PTR_ERR(priv->rst), + "failed to acquire reset\n"); + + ret = reset_control_reset(priv->rst); + if (ret) + return dev_err_probe(dev, ret, + "failed to reset\n"); + + snprintf(name, sizeof(name), "%s#rx", dev_name(dev)); + priv->clk_rx = clk_hw_register_fixed_rate(dev, name, NULL, 0, + TX_RX_CLK_RATE); + if (IS_ERR_OR_NULL(priv->clk_rx)) + return dev_err_probe(dev, PTR_ERR(priv->clk_rx), + "failed to register rx clock\n"); + + snprintf(name, sizeof(name), "%s#tx", dev_name(dev)); + priv->clk_tx = clk_hw_register_fixed_rate(dev, name, NULL, 0, + TX_RX_CLK_RATE); + if (IS_ERR_OR_NULL(priv->clk_tx)) + return dev_err_probe(dev, PTR_ERR(priv->clk_tx), + "failed to register tx clock\n"); + + priv->clk_data = devm_kzalloc(dev, + struct_size(priv->clk_data, hws, 2), + GFP_KERNEL); + if (!priv->clk_data) + return dev_err_probe(dev, -ENOMEM, + "failed to allocate clk_data\n"); + + priv->clk_data->num = 2; + priv->clk_data->hws[0] = priv->clk_rx; + priv->clk_data->hws[1] = priv->clk_tx; + ret = of_clk_add_hw_provider(dev->of_node, of_clk_hw_onecell_get, + priv->clk_data); + if (ret) + return dev_err_probe(dev, ret, + "fail to register clock provider\n"); + + return 0; +} + +static int ipq5018_soft_reset(struct phy_device *phydev) +{ + int ret; + + ret = phy_modify(phydev, IPQ5018_PHY_FIFO_CONTROL, + IPQ5018_PHY_FIFO_RESET, 0); + if (ret < 0) + return ret; + + msleep(50); + + ret = phy_modify(phydev, IPQ5018_PHY_FIFO_CONTROL, + IPQ5018_PHY_FIFO_RESET, IPQ5018_PHY_FIFO_RESET); + if (ret < 0) + return ret; + + return 0; +} + +static struct phy_driver ipq5018_internal_phy_driver[] = { + { + PHY_ID_MATCH_EXACT(IPQ5018_PHY_ID), + .name = "Qualcomm IPQ5018 internal PHY", + .flags = PHY_IS_INTERNAL, + .probe = ipq5018_probe, + .soft_reset = ipq5018_soft_reset, + }, +}; +module_phy_driver(ipq5018_internal_phy_driver); + +static struct mdio_device_id __maybe_unused ipq5018_internal_phy_ids[] = { + { PHY_ID_MATCH_EXACT(IPQ5018_PHY_ID) }, + { } +}; +MODULE_DEVICE_TABLE(mdio, ipq5018_internal_phy_ids); + +MODULE_DESCRIPTION("Qualcomm IPQ5018 internal PHY driver"); +MODULE_AUTHOR("Ziyang Huang "); From patchwork Sun Jan 21 12:42:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ziyang Huang X-Patchwork-Id: 13524572 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 CF0D2C47DAF for ; Sun, 21 Jan 2024 12:43: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:References:In-Reply-To: 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: List-Owner; bh=+TMithOHkfC4HmHWyA6eK7ZEF4CQNq73HyVgTEmTFAI=; b=QUtOPDEPndiWdX 8+0DVGk3uw4k69yLiRPDvSGZSVrwuR/nZdJ8orZuI2CxFwi2A+rjCaD9ZJu1iWN/8/OZbfcN/MAjv O+kLvf6I3jIgAflzPE0bYbfrSbf0at94JC1W+BdIE0L1Aij0jCBYnwtJvCihaeLOylgXrzOMyc5v8 nZhIFwL8xUyMpprWXMAAfKxZBNUm1iar6pdOPK4m2in/y2v6KoR2OwskinZRrABht4gA4tiK7DGHT P5vbdLX578eN7hwg2JYwYY2tVJu88XG29w6GfgnrJe6b6b2XlnADPe6SYjo8yKcocsjsukY/vJCHP Hwb0cvfNrEb9f2wFb3AA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rRXAP-009Wco-1U; Sun, 21 Jan 2024 12:43:13 +0000 Received: from mail-tyzapc01olkn20801.outbound.protection.outlook.com ([2a01:111:f403:280c::801] helo=APC01-TYZ-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rRXAL-009WbI-1u; Sun, 21 Jan 2024 12:43:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BStRVttU4ppTUFqAhW63spEewwdGdKf4SrNP2A8icFp3ceMS1W8FGnPSp637IJJF8U93B4uP3p9NBq6jf9v75v+nf1kGadtp0wV5upPKJTNtX2Y55NSw0XQbjHTQs2H35aSQ+3FGubSFBuf6jh2x0B53uXcmo0nQVUgZKluDWR8n4oUI5CrcmGeVKsJqu+4ZRqo4tMQo5YZli1gLmwxKKkhKRCUg6EmToxytY3RrVK9c+RJfD6NF7/6a75LElwEHKpU5oTcFS2/Sb/n0x8Z3uUL2HT6qQgc0x+L0A1+5wwTBBlCxGXPH0KyQ3oGZzMLQe7bwf3EashaeBi/7QULJUw== 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=VqNPKD9cf2LOffkkH2VUh4R55yCvW8u1H6kgOvRNP7s=; b=VGZbqn1aR7uUErEzzN3Eo2OquBigzDFOlUwvtyywMG3QGnbfxjUmfvcci2A7nYy3TKecsac7tBNXwnda0nlXdtIjGsw6CWwkH1vObbtq0C6Q9tF63vS2bPoB1DW50u399ZR4m+IF+89g0Yw4/rmqdllgXUBQCOaWl4kdtWMdySinY3c4ViqMwMjK3DO5DF0C0IxGN5690bewugDuSHv9C07RUGQ+j7hATc34muKCJeJ5t1rRPETiRKeJITObOmMIgu0IhrumsYk8oKKzv3ZZio5TUIxz1oDqgVjsDai4ag7q+CITDOFKzBYLqlpPxlePX4dxl8+zzs3iaFNCeWU4IA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VqNPKD9cf2LOffkkH2VUh4R55yCvW8u1H6kgOvRNP7s=; b=Ew7vzy9WKCc33NgPSUPcB+qK7M3rGTY3UHkjS6zudIQb4wHCiY7OA3EkHcCuRRRtAUoq3d5tdDYihMyQe9Kw5rKtNedMqYptBwzqSBgrjM5vfNGoKKSinCACGiORFiyEpckz129BKfADCj+By1xe/yUVNXecsU9UrjCkqDgubF8nFY5Y3EfsIhxj5IAx5qKf2lzO1Yl4hBIH1BCRoFdUMmk+jZMwTE4JaxmMJmlEXBhJ4KpboHM0GKANjtcXnr5BV4KDJLNjRJ4eo0Eg1iqi0q5ZUYWYjnNBjkFPBGxNsQULNf1Gqq/P074lFiKzascPIsDKgMildx+qXeqK6ztl4w== Received: from TYZPR01MB5556.apcprd01.prod.exchangelabs.com (2603:1096:400:363::9) by OSQPR01MB6119.apcprd01.prod.exchangelabs.com (2603:1096:604:27b::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.30; Sun, 21 Jan 2024 12:43:04 +0000 Received: from TYZPR01MB5556.apcprd01.prod.exchangelabs.com ([fe80::bcb7:50f4:7a16:4ec0]) by TYZPR01MB5556.apcprd01.prod.exchangelabs.com ([fe80::bcb7:50f4:7a16:4ec0%7]) with mapi id 15.20.7181.019; Sun, 21 Jan 2024 12:43:04 +0000 From: Ziyang Huang To: mcoquelin.stm32@gmail.com Cc: alexandre.torgue@foss.st.com, richardcochran@gmail.com, p.zabel@pengutronix.de, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org, linux-mediatek@lists.infradead.org, Ziyang Huang Subject: [PATCH 2/8] phy: Introduce Qualcomm ethernet uniphy driver Date: Sun, 21 Jan 2024 20:42:31 +0800 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [kV5Ly6/5oO4AGfwD/o4AHprlfetwjX3LAlGd2heNgymp5Zj+imTcnA==] X-ClientProxiedBy: PH8PR21CA0009.namprd21.prod.outlook.com (2603:10b6:510:2ce::26) To TYZPR01MB5556.apcprd01.prod.exchangelabs.com (2603:1096:400:363::9) X-Microsoft-Original-Message-ID: <20240121124237.3328702-2-hzyitc@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYZPR01MB5556:EE_|OSQPR01MB6119:EE_ X-MS-Office365-Filtering-Correlation-Id: 0a83ba4c-b354-4fba-3f06-08dc1a7e82bc X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YlO+NvKVBYRtbUvvAcPXv5r8yyj9e5mNrH1d44C45NEVyXEt2jHhpsv90mvoUdj6KzOGFzWax8o31GwP5JK3oF50/BHf7adqQ6AQSySWSmiuVsoms5fZT+/jT8Bj4OU8xXX30NPegtZCy1+yl32URF5Q/lYIeMfzeSbaC505VkI6X64jwDjdJeNJpXU6tIY2vhP9DYLJ2eP3gQVix4SQ1m7EDIdBOHe5oxYMfSjcf3pGTsCmSIC0Q06t87XSQxUqPB2CyX1ffzLO3MeZGSM3wijD0i+sWmfMmCb2PJRbjY4IkwCTzFbz2NtuuAsdPcP6l30ZDPULiTuXWtxMwhAyJiDYy58Rf4iNnb6nFjobaZy+D9HR1vnK0bWd9IBkpV8Y1oEwm1DnUaJ5u1C4aAjx1wupAlMZlousjBngbZ3sPzpJono3FWaVQ/59hZHl8tQxNinYxFCx/37tJL9L0kVedjqYZs1KlEFUunOZkJf/Lnizp6ELgDpUL73FvqC+ukuwfMS5+//Z99QBd8sv8i3NV/WxobR0npcsfv493ukzMgf/hNAPV0wythSIyS9AKNwYWHAKx4/VEuwFDD9buYHu17xwFUCLhGm8qFG+mMgbJPUB6IMyZcAMFbCunsf+jmoG X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: +PKxZ9ifMc3p4joF8x+dxcbvALzRH7sKzgzO/lk2W1RcO08tARhAPIFh0H32o3JKN03WlLu9p4w9betsSn5d8mqk4Qx0rXXgsFYwSp9cfJ/EuIl2VMzjccKhw9omiLqy1zHQ0SV3SLiOdDNTYZSk3aYsdxqi7bmoERrE4DzELIZJJ+8ztSVlVpeNScRGVgdpv4ly7X3V+EpZVWCF93mwK48xWGias/BjdF7YBEyhAi6fkFCuelBoimmoeE+ucazdt2CWkjCOcNZBJ8w5N88/Csvf7wcC7qPzwlHs2jNXAmW38BolR5uVbt2xC7+zJ13603iN6syVTPGnbzZeaCfuXLW13u6ig0uS5V5B+gBwaSIMdFAXsB+2BAx6XhD3/gsLesLJCH8BsYsEBgCLvL/Rhm00xwlIWHY/Ua0gi34Wdxd/HXWqeYG+kbx7JSWsfvr2WR8eSZVxqSOpOLmri9q5fgqQcOWOguf1rqCkluf6uSbY1W5byqSHAxgAdTdUs/9PvcLLvSJxqdsqilsnzTCc+VecNgiL0WFttYdzhLc5BezUP1IoL5E/lhGVkVS+zd83obcihw8001vgBbz8/AWP9d1OLSyXVqXiTt1HAazXExcESTcDEs5A82/2LWJieSdQkAPvlCJcL1Engs5OoNpnHBAh1yLy76e/GefmbWWeBhPWD14gnHxx+Lz8ZbWNg6uIBVTqxED9EN4TOq94n78+39GrNFbyTU22h14rDe7DkrIU1H6sqewrvn+vwGlB/I4FhuEjths771E0bNDQDpnQ+E2FRHQ3orGVCM1jImBdmppVpetx4rvrOKoitleHTyPWDce7O2jvKE0mAhDTtELuyOHD9WLVFfIjdw7GhPhI2WwhZzlZbJkr8NAXNNZ5lvdP/k7yabl9S3gRtVWg+2el2Pm3to7ED9G7PTPdECwLRE9mIQhfdhDIHoMGHvkmJ8P7Kp+Xz8mqIcxWvb1yI+irGlnSt5cWsCaHxvPhVifnDF2qM9qIfnBx4fANskovFcsVTN47vq5bmKn6l57wdESNTSEC9zcuq8WFwhPZKRbDtwlqbbzvdOlzWzKSw7JN6kpQNUUQDtTX0nvVZgCFzbhd/377CbT/Rty+OK0QKj/RPHVu7xsehlHbnUr6N+yf3o4PLrT99zG7KQYE9GFroa3a5vB+snqCEZFfFktpAhBS4655WUhl+/wNhT+ljqWuk4HVXZPV2PWnrOCLAEsEJZ4YfC1wE7q9kw2MdVkQ1WJ9XlIatiYX4XOzpu0fq12ulN0n X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0a83ba4c-b354-4fba-3f06-08dc1a7e82bc X-MS-Exchange-CrossTenant-AuthSource: TYZPR01MB5556.apcprd01.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jan 2024 12:43:04.6066 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: OSQPR01MB6119 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240121_044309_743920_8262145C X-CRM114-Status: GOOD ( 14.06 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Signed-off-by: Ziyang Huang --- drivers/phy/qualcomm/Kconfig | 7 + drivers/phy/qualcomm/Makefile | 2 + drivers/phy/qualcomm/phy-qcom-eth-uniphy.c | 494 +++++++++++++++++++++ include/dt-bindings/phy/qcom-eth-uniphy.h | 15 + 4 files changed, 518 insertions(+) create mode 100644 drivers/phy/qualcomm/phy-qcom-eth-uniphy.c create mode 100644 include/dt-bindings/phy/qcom-eth-uniphy.h diff --git a/drivers/phy/qualcomm/Kconfig b/drivers/phy/qualcomm/Kconfig index 97ca5952e34e..1cbbfd196115 100644 --- a/drivers/phy/qualcomm/Kconfig +++ b/drivers/phy/qualcomm/Kconfig @@ -28,6 +28,13 @@ config PHY_QCOM_EDP Enable this driver to support the Qualcomm eDP PHY found in various Qualcomm chipsets. +config PHY_QCOM_ETH_UNIPHY + tristate "Qualcomm ethernet uniphy driver" + depends on OF && COMMON_CLK && (ARCH_QCOM || COMPILE_TEST) + select GENERIC_PHY + help + Support for the Qualcomm ethernet uniphy. + config PHY_QCOM_IPQ4019_USB tristate "Qualcomm IPQ4019 USB PHY driver" depends on OF && (ARCH_QCOM || COMPILE_TEST) diff --git a/drivers/phy/qualcomm/Makefile b/drivers/phy/qualcomm/Makefile index b030858e0f8d..a9f01e688553 100644 --- a/drivers/phy/qualcomm/Makefile +++ b/drivers/phy/qualcomm/Makefile @@ -21,4 +21,6 @@ obj-$(CONFIG_PHY_QCOM_USB_HS_28NM) += phy-qcom-usb-hs-28nm.o obj-$(CONFIG_PHY_QCOM_USB_SS) += phy-qcom-usb-ss.o obj-$(CONFIG_PHY_QCOM_USB_SNPS_FEMTO_V2)+= phy-qcom-snps-femto-v2.o obj-$(CONFIG_PHY_QCOM_IPQ806X_USB) += phy-qcom-ipq806x-usb.o + +obj-$(CONFIG_PHY_QCOM_ETH_UNIPHY) += phy-qcom-eth-uniphy.o obj-$(CONFIG_PHY_QCOM_SGMII_ETH) += phy-qcom-sgmii-eth.o diff --git a/drivers/phy/qualcomm/phy-qcom-eth-uniphy.c b/drivers/phy/qualcomm/phy-qcom-eth-uniphy.c new file mode 100644 index 000000000000..71d4cefb8adb --- /dev/null +++ b/drivers/phy/qualcomm/phy-qcom-eth-uniphy.c @@ -0,0 +1,494 @@ +/* + * UNIPHY is the PCS between MAC and PHY which controls the mode of + * physical ports. Depends on different SoC, it can support + * SGMII/SGMII+/USXGMII. What's more, in some SoC it also support + * QSGMII/PSGMII which combine multi SGMII line into single physical port. + * + * ======================================================================= + * ________________________________ + * | _______ IPQ807x | + * | | GMAC0 |__ | + * | |_______| \ | _________ + * | _______ \ | ____| GPHY | + * | | GMAC1 |__ \ _________ | / | /Switch | + * | |_______| \ \___| | | SGMII(+) |_________| + * | _______ \_____| | | P0 / + * | | GMAC2 |_________| UNIPHY0 |--|-----or + * | |_______| _____| | | \ + * | _______ / __| | | (Q/P)SGMII __________ + * | | GMAC3 |__/ / |_________| | \____| (Q/P)PHY | + * | |_______| / | |__________| + * | _______ / | + * | | GMAC4 |--or | _________ + * | |_______| \ _________ | P1 | (X)GPHY | + * | ________ or--| UNIPHY1 |--|----SGMII(+)--| /Switch | + * | | XGMAC0 |___/ |_________| | /USXGMII |_________| + * | |________| | + * | ________ | + * | | GMAC5 |___ | _________ + * | |________| \ _________ | P2 | (X)GPHY | + * | ________ or--| UNIPHY2 |--|----SGMII(+)--| /Switch | + * | | XGMAC1 |___/ |_________| | /USXGMII |_________| + * | |________| | + * |________________________________| + * + * ======================================================================= + * _________________________________ + * | _______ IPQ50xx ______ | P0 ______ + * | | GMAC0 |___________| GPHY |---|------UTP------| RJ45 | + * | |_______| |______| | |______| + * | _______ _________ | _________ + * | | GMAC1 |_________| UNIPHY0 | | P1 | GPHY | + * | |_______| |_________|--|----SGMII(+)--| /Switch | + * |________________________________| |_________| + * + * ======================================================================= + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#define TCSR_ETH_CMN 0x0 +#define TCSR_ETH_CMN_ENABLE BIT(0) + + +#define CMN_PLL_REFCLK_SRC 0x28 +#define CMN_PLL_REFCLK_SRC_FROM_MASK GENMASK(9, 8) +#define CMN_PLL_REFCLK_SRC_FROM(x) FIELD_PREP(CMN_PLL_REFCLK_SRC_FROM_MASK, (x)) +#define CMN_PLL_REFCLK_SRC_FROM_REG CMN_PLL_REFCLK_SRC_FROM(0) +#define CMN_PLL_REFCLK_SRC_FROM_LOGIC CMN_PLL_REFCLK_SRC_FROM(1) +#define CMN_PLL_REFCLK_SRC_FROM_PCS CMN_PLL_REFCLK_SRC_FROM(2) + +#define CMN_PLL_REFCLK 0x784 +#define CMN_PLL_REFCLK_EXTERNAL BIT(9) +#define CMN_PLL_REFCLK_DIV_MASK GENMASK(8, 4) +#define CMN_PLL_REFCLK_DIV(x) FIELD_PREP(CMN_PLL_REFCLK_DIV_MASK, (x)) +#define CMN_PLL_REFCLK_FREQ_MASK GENMASK(3, 0) +#define CMN_PLL_REFCLK_FREQ(x) FIELD_PREP(CMN_PLL_REFCLK_FREQ_MASK, (x)) +#define CMN_PLL_REFCLK_FREQ_25M CMN_PLL_REFCLK_FREQ(3) +#define CMN_PLL_REFCLK_FREQ_31250K CMN_PLL_REFCLK_FREQ(4) +#define CMN_PLL_REFCLK_FREQ_40M CMN_PLL_REFCLK_FREQ(6) +#define CMN_PLL_REFCLK_FREQ_48M CMN_PLL_REFCLK_FREQ(7) +#define CMN_PLL_REFCLK_FREQ_50M CMN_PLL_REFCLK_FREQ(8) + +#define CMN_PLL_CTRL 0x780 +#define CMN_PLL_CTRL_RST_N BIT(6) + +#define CMN_PLL_STATUS 0x64 +#define CMN_PLL_STATUS_LOCKED BIT(2) + + +#define IPQ50XX_UNIPHY_CLKOUT 0x74 +#define IPQ50XX_UNIPHY_CLKOUT_DS_MASK GENMASK(3, 2) +#define IPQ50XX_UNIPHY_CLKOUT_DS(x) FIELD_PREP(IPQ50XX_UNIPHY_CLKOUT_DS_MASK, (x)) +#define IPQ50XX_UNIPHY_CLKOUT_DS_2_8V IPQ50XX_UNIPHY_CLKOUT_DS(0) +#define IPQ50XX_UNIPHY_CLKOUT_DS_1_5V IPQ50XX_UNIPHY_CLKOUT_DS(1) +#define IPQ50XX_UNIPHY_CLKOUT_DIV_MASK GENMASK(1, 1) +#define IPQ50XX_UNIPHY_CLKOUT_DIV(x) FIELD_PREP(IPQ50XX_UNIPHY_CLKOUT_DIV_MASK, (x)) +#define IPQ50XX_UNIPHY_CLKOUT_DIV_50M IPQ50XX_UNIPHY_CLKOUT_DIV(0) +#define IPQ50XX_UNIPHY_CLKOUT_DIV_25M IPQ50XX_UNIPHY_CLKOUT_DIV(1) +#define IPQ50XX_UNIPHY_CLKOUT_ENABLE BIT(0) + +#define IPQ53XX_UNIPHY_CLKOUT 0x610 +#define IPQ53XX_UNIPHY_CLKOUT_LDO_LEVEL_MASK GENMASK(10, 8) +#define IPQ53XX_UNIPHY_CLKOUT_DIV_MASK GENMASK(5, 5) +#define IPQ53XX_UNIPHY_CLKOUT_DIV(x) FIELD_PREP(IPQ53XX_UNIPHY_CLKOUT_DIV_MASK, (x)) +#define IPQ53XX_UNIPHY_CLKOUT_DIV_50M IPQ53XX_UNIPHY_CLKOUT_DIV(0) +#define IPQ53XX_UNIPHY_CLKOUT_DIV_25M IPQ53XX_UNIPHY_CLKOUT_DIV(1) +#define IPQ53XX_UNIPHY_CLKOUT_PULLDOWN BIT(3) +#define IPQ53XX_UNIPHY_CLKOUT_DS_MASK GENMASK(2, 1) +#define IPQ53XX_UNIPHY_CLKOUT_DS(x) FIELD_PREP(IPQ53XX_UNIPHY_CLKOUT_DS_MASK, (x)) +#define IPQ53XX_UNIPHY_CLKOUT_DS_2_8V IPQ53XX_UNIPHY_CLKOUT_DS(0) +#define IPQ53XX_UNIPHY_CLKOUT_DS_1_5V IPQ53XX_UNIPHY_CLKOUT_DS(1) +#define IPQ53XX_UNIPHY_CLKOUT_ENABLE BIT(0) + + +#define UNIPHY_MODE 0x46c +#define UNIPHY_MODE_USXG BIT(13) +#define UNIPHY_MODE_XPCS BIT(12) +#define UNIPHY_MODE_SGMIIPLUS BIT(11) +#define UNIPHY_MODE_SGMII BIT(10) +#define UNIPHY_MODE_PSGMII BIT(9) +#define UNIPHY_MODE_QSGMII BIT(8) +#define UNIPHY_MODE_CH0_MODE_MASK GENMASK(6, 4) +#define UNIPHY_MODE_CH0_MODE(x) FIELD_PREP(UNIPHY_MODE_CH0_MODE_MASK, (x)) +#define UNIPHY_MODE_CH0_MODE_1000BASEX UNIPHY_MODE_CH0_MODE(0) +#define UNIPHY_MODE_CH0_MODE_MAC UNIPHY_MODE_CH0_MODE(2) +#define UNIPHY_MODE_SGMII_CHANNEL_MASK GENMASK(2, 1) +#define UNIPHY_MODE_SGMII_CHANNEL(x) FIELD_PREP(UNIPHY_MODE_SGMII_CHANNEL_MASK, (x)) +#define UNIPHY_MODE_SGMII_CHANNEL_0 UNIPHY_MODE_SGMII_CHANNEL(0) +#define UNIPHY_MODE_SGMII_CHANNEL_1 UNIPHY_MODE_SGMII_CHANNEL(1) +#define UNIPHY_MODE_SGMII_CHANNEL_4 UNIPHY_MODE_SGMII_CHANNEL(2) +#define UNIPHY_MODE_AN_MODE_MASK BIT(0) +#define UNIPHY_MODE_AN_MODE(x) FIELD_PREP(UNIPHY_MODE_AN_MODE_MASK, (x)) +#define UNIPHY_MODE_AN_MODE_ATHEROS UNIPHY_MODE_AN_MODE(0) +#define UNIPHY_MODE_AN_MODE_STANDARD UNIPHY_MODE_AN_MODE(1) + +#define UNIPHY_PLL_CTRL 0x780 +#define UNIPHY_PLL_CTRL_RST_N BIT(6) + +#define UNIPHY_CALIBRATION 0x1E0 +#define UNIPHY_CALIBRATION_DONE BIT(7) + + +#define UNIPHY_CHANNEL(x) (0x480 + 0x18 * (x)) +#define UNIPHY_CHANNEL_RSTN BIT(11) +#define UNIPHY_CHANNEL_FORCE_SPEED_25M BIT(3) + +#define UNIPHY_SGMII 0x218 +#define UNIPHY_SGMII_MODE_MASK GENMASK(6, 4) +#define UNIPHY_SGMII_MODE(x) FIELD_PREP(UNIPHY_SGMII_MODE_MASK, (x)) +#define UNIPHY_SGMII_MODE_SGMII UNIPHY_SGMII_MODE(3) +#define UNIPHY_SGMII_MODE_SGMIIPLUS UNIPHY_SGMII_MODE(5) +#define UNIPHY_SGMII_MODE_USXGMII UNIPHY_SGMII_MODE(7) +#define UNIPHY_SGMII_RATE_MASK GENMASK(1, 0) +#define UNIPHY_SGMII_RATE(x) FIELD_PREP(UNIPHY_SGMII_RATE_MASK, (x)) + + +#define SGMII_CLK_RATE 125000000 /* 125M */ +#define SGMII_PLUS_CLK_RATE 312500000 /* 312.5M */ + + +struct qcom_eth_uniphy { + struct device *dev; + void __iomem *base; + int num_clks; + struct clk_bulk_data *clks; + struct reset_control *rst; + + int mode; + + struct clk_hw *clk_rx, *clk_tx; + struct clk_hw_onecell_data *clk_data; +}; + + +#define rmwl(addr, mask, val) \ + writel(((readl(addr) & ~(mask)) | ((val) & (mask))), addr) + +static int cmn_init(struct platform_device *pdev) +{ + struct resource *res; + void __iomem *cmn_base; + void __iomem *tcsr_base; + u32 val; + + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cmn"); + if (!res) + return 0; + + cmn_base = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR_OR_NULL(cmn_base)) + return PTR_ERR(cmn_base); + + /* For IPQ50xx, tcsr is necessary to enable cmn block */ + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "tcsr"); + if (res) { + tcsr_base = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR_OR_NULL(tcsr_base)) + return PTR_ERR(tcsr_base); + + rmwl((tcsr_base + TCSR_ETH_CMN), TCSR_ETH_CMN_ENABLE, + TCSR_ETH_CMN_ENABLE); + } + + rmwl((cmn_base + CMN_PLL_REFCLK_SRC), + CMN_PLL_REFCLK_SRC_FROM_MASK, + CMN_PLL_REFCLK_SRC_FROM_REG); + rmwl((cmn_base + CMN_PLL_REFCLK), + (CMN_PLL_REFCLK_EXTERNAL | CMN_PLL_REFCLK_FREQ_MASK + | CMN_PLL_REFCLK_DIV_MASK), + (CMN_PLL_REFCLK_FREQ_48M | CMN_PLL_REFCLK_DIV(2))); + + rmwl((cmn_base + CMN_PLL_CTRL), CMN_PLL_CTRL_RST_N, 0); + msleep(1); + rmwl((cmn_base + CMN_PLL_CTRL), CMN_PLL_CTRL_RST_N, + CMN_PLL_CTRL_RST_N); + msleep(1); + + return read_poll_timeout(readl, val, + (val & CMN_PLL_STATUS_LOCKED), + 100, 200000, false, + (cmn_base + CMN_PLL_STATUS)); +} + + +static void uniphy_write(struct qcom_eth_uniphy *uniphy, int addr, u32 val) +{ + writel(val, (uniphy->base + addr)); +} + +static u32 uniphy_read(struct qcom_eth_uniphy *uniphy, int addr) +{ + return readl((uniphy->base + addr)); +} + +static void uniphy_rmw(struct qcom_eth_uniphy *uniphy, int addr, u32 mask, u32 val) +{ + u32 v = uniphy_read(uniphy, addr); + v &= ~mask; + v |= val & mask; + uniphy_write(uniphy, addr, v); +} + +static int uniphy_clkout_init(struct qcom_eth_uniphy *uniphy) +{ + u32 val; + int ret; + + ret = of_property_read_u32(uniphy->dev->of_node, "clkout-frequency", &val); + if (ret == -EINVAL) + return 0; + else if (ret < 0) + return ret; + + switch(val) { + case QCOM_ETH_UNIPHY_CLKOUT_FREQ_25M: + uniphy_rmw(uniphy, IPQ50XX_UNIPHY_CLKOUT, + IPQ50XX_UNIPHY_CLKOUT_DIV_MASK, + IPQ50XX_UNIPHY_CLKOUT_DIV_25M); + break; + case QCOM_ETH_UNIPHY_CLKOUT_FREQ_50M: + uniphy_rmw(uniphy, IPQ50XX_UNIPHY_CLKOUT, + IPQ50XX_UNIPHY_CLKOUT_DIV_MASK, + IPQ50XX_UNIPHY_CLKOUT_DIV_50M); + break; + default: + dev_err(uniphy->dev, "Unsupported clkout-frequency: %d\n", val); + return -EINVAL; + } + + ret = of_property_read_u32(uniphy->dev->of_node, "clkout-drive-strength", &val); + if (ret != -EINVAL) { + if (ret < 0) + return ret; + + switch(val) { + case QCOM_ETH_UNIPHY_CLKOUT_DS_1_5V: + uniphy_rmw(uniphy, IPQ50XX_UNIPHY_CLKOUT, + IPQ50XX_UNIPHY_CLKOUT_DS_MASK, + IPQ50XX_UNIPHY_CLKOUT_DS_1_5V); + break; + case QCOM_ETH_UNIPHY_CLKOUT_DS_2_8V: + uniphy_rmw(uniphy, IPQ50XX_UNIPHY_CLKOUT, + IPQ50XX_UNIPHY_CLKOUT_DS_MASK, + IPQ50XX_UNIPHY_CLKOUT_DS_2_8V); + break; + default: + dev_err(uniphy->dev, "Unsupported clkout-drive-strength: %d\n", val); + return -EINVAL; + } + + } + + uniphy_rmw(uniphy, IPQ50XX_UNIPHY_CLKOUT, + IPQ50XX_UNIPHY_CLKOUT_ENABLE, + IPQ50XX_UNIPHY_CLKOUT_ENABLE); + + return 0; +} + +static int uniphy_mode_set(struct qcom_eth_uniphy *uniphy) +{ + int ret; + + ret = of_property_read_u32(uniphy->dev->of_node, "mode", + &uniphy->mode); + if (ret < 0) + return ret; + + switch(uniphy->mode) { + case QCOM_ETH_UNIPHY_MODE_SGMII: + uniphy_write(uniphy, UNIPHY_MODE, + UNIPHY_MODE_SGMII); + uniphy_rmw(uniphy, UNIPHY_SGMII, + UNIPHY_SGMII_MODE_MASK, + UNIPHY_SGMII_MODE_SGMII); + break; + default: + dev_err(uniphy->dev, "Unsupported mode: %d\n", + uniphy->mode); + return -EINVAL; + } + + return 0; +} + +static int uniphy_calibrate(struct qcom_eth_uniphy *uniphy) +{ + u32 val; + + uniphy_rmw(uniphy, UNIPHY_PLL_CTRL, UNIPHY_PLL_CTRL_RST_N, 0); + msleep(1); + uniphy_rmw(uniphy, UNIPHY_PLL_CTRL, UNIPHY_PLL_CTRL_RST_N, + UNIPHY_PLL_CTRL_RST_N); + msleep(1); + + return read_poll_timeout(uniphy_read, val, + (val & UNIPHY_CALIBRATION_DONE), + 100, 200000, false, + uniphy, UNIPHY_CALIBRATION); +} + +static int uniphy_clk_register(struct qcom_eth_uniphy *uniphy) +{ + unsigned long rate; + char name[64]; + int ret; + + switch (uniphy->mode) { + case QCOM_ETH_UNIPHY_MODE_SGMII: + rate = SGMII_CLK_RATE; + break; + } + + snprintf(name, sizeof(name), "%s#rx", dev_name(uniphy->dev)); + uniphy->clk_rx = clk_hw_register_fixed_rate(uniphy->dev, name, + NULL, 0, rate); + if (IS_ERR_OR_NULL(uniphy->clk_rx)) + return dev_err_probe(uniphy->dev, PTR_ERR(uniphy->clk_rx), + "failed to register rx clock\n"); + + snprintf(name, sizeof(name), "%s#tx", dev_name(uniphy->dev)); + uniphy->clk_tx = clk_hw_register_fixed_rate(uniphy->dev, name, + NULL, 0, rate); + if (IS_ERR_OR_NULL(uniphy->clk_tx)) + return dev_err_probe(uniphy->dev, PTR_ERR(uniphy->clk_tx), + "failed to register rx clock\n"); + + uniphy->clk_data = devm_kzalloc(uniphy->dev, + struct_size(uniphy->clk_data, hws, 2), + GFP_KERNEL); + if (!uniphy->clk_data) + return dev_err_probe(uniphy->dev, -ENOMEM, + "failed to allocate clk_data\n"); + + uniphy->clk_data->num = 2; + uniphy->clk_data->hws[0] = uniphy->clk_rx; + uniphy->clk_data->hws[1] = uniphy->clk_tx; + ret = of_clk_add_hw_provider(uniphy->dev->of_node, + of_clk_hw_onecell_get, + uniphy->clk_data); + if (ret) + return dev_err_probe(uniphy->dev, ret, + "fail to register clock provider\n"); + + return 0; +} + +static int qcom_eth_uniphy_calibrate(struct phy *phy) +{ + struct qcom_eth_uniphy *uniphy = phy_get_drvdata(phy); + dev_info(uniphy->dev, "calibrating\n"); + return uniphy_calibrate(uniphy); +} + +static const struct phy_ops qcom_eth_uniphy_ops = { + .calibrate = qcom_eth_uniphy_calibrate, + .owner = THIS_MODULE, +}; + +static int qcom_eth_uniphy_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct qcom_eth_uniphy *uniphy; + struct phy *phy; + struct phy_provider *phy_provider; + int ret; + + ret = cmn_init(pdev); + if (ret) + return dev_err_probe(dev, ret, + "failed to init cmn block\n"); + + uniphy = devm_kzalloc(dev, sizeof(*uniphy), GFP_KERNEL); + if (!uniphy) + return dev_err_probe(dev, -ENOMEM, + "failed to allocate priv\n"); + + uniphy->dev = dev; + uniphy->base = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(uniphy->base)) + return dev_err_probe(dev, PTR_ERR(uniphy->base), + "failed to ioremap base\n"); + + uniphy->num_clks = devm_clk_bulk_get_all(uniphy->dev, &uniphy->clks); + if (uniphy->num_clks < 0) + return dev_err_probe(uniphy->dev, uniphy->num_clks, + "failed to acquire clocks\n"); + + ret = clk_bulk_prepare_enable(uniphy->num_clks, uniphy->clks); + if (ret) + return dev_err_probe(uniphy->dev, ret, + "failed to enable clocks\n"); + + uniphy->rst = devm_reset_control_array_get_exclusive(uniphy->dev); + if (IS_ERR_OR_NULL(uniphy->rst)) + return dev_err_probe(uniphy->dev, PTR_ERR(uniphy->rst), + "failed to acquire reset\n"); + + ret = reset_control_reset(uniphy->rst); + if (ret) + return dev_err_probe(uniphy->dev, ret, + "failed to reset\n"); + + ret = uniphy_clkout_init(uniphy); + if (ret) + return dev_err_probe(dev, ret, + "failed to init clkout\n"); + + ret = uniphy_mode_set(uniphy); + if (ret) + return dev_err_probe(dev, ret, + "failed to set mode\n"); + + ret = uniphy_calibrate(uniphy); + if (ret) + return dev_err_probe(dev, ret, + "failed to calibrate\n"); + + ret = uniphy_clk_register(uniphy); + if (ret) + return dev_err_probe(dev, ret, + "failed to register clocks\n"); + + phy = devm_phy_create(dev, dev->of_node, &qcom_eth_uniphy_ops); + if (IS_ERR(phy)) + return dev_err_probe(dev, PTR_ERR(phy), + "failed to register phy\n"); + + phy_set_drvdata(phy, uniphy); + + phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); + if (IS_ERR(phy_provider)) + return dev_err_probe(dev, PTR_ERR(phy_provider), + "failed to register phy provider\n"); + + return 0; +} + +static const struct of_device_id qcom_eth_uniphy_of_match[] = { + { .compatible = "qcom,ipq5018-eth-uniphy" }, + {} +}; +MODULE_DEVICE_TABLE(of, qcom_eth_uniphy_of_match); + +static struct platform_driver qcom_eth_uniphy_driver = { + .probe = qcom_eth_uniphy_probe, + .driver = { + .name = "qcom-eth-uniphy", + .of_match_table = qcom_eth_uniphy_of_match, + }, +}; +module_platform_driver(qcom_eth_uniphy_driver); + +MODULE_DESCRIPTION("Qualcomm ethernet uniphy driver"); +MODULE_AUTHOR("Ziyang Huang "); diff --git a/include/dt-bindings/phy/qcom-eth-uniphy.h b/include/dt-bindings/phy/qcom-eth-uniphy.h new file mode 100644 index 000000000000..038f82522ccd --- /dev/null +++ b/include/dt-bindings/phy/qcom-eth-uniphy.h @@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +#ifndef _DT_BINDINGS_PHY_QCOM_ETH_UNIPHY +#define _DT_BINDINGS_PHY_QCOM_ETH_UNIPHY + +#define QCOM_ETH_UNIPHY_MODE_SGMII 0 +#define QCOM_ETH_UNIPHY_MODE_SGMII_PLUS 1 + +#define QCOM_ETH_UNIPHY_CLKOUT_FREQ_25M 25000000 +#define QCOM_ETH_UNIPHY_CLKOUT_FREQ_50M 50000000 + +#define QCOM_ETH_UNIPHY_CLKOUT_DS_1_5V 1500 +#define QCOM_ETH_UNIPHY_CLKOUT_DS_2_8V 2800 + +#endif From patchwork Sun Jan 21 12:42:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ziyang Huang X-Patchwork-Id: 13524573 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 20375C47DAF for ; Sun, 21 Jan 2024 12:43:51 +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:References:In-Reply-To: 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: List-Owner; bh=12z0c33XgZ4cHcwfTpotYaELaDioKcTK2W9EljRYhck=; b=baqzJbPwBAWD10 AD4dL/rdnlagXWqkCoO6gld2bt82DKD3F7mB+1hHPv5aZuEEsYhT5G2ZZak84YOoJIVnSh7lhWhJf s5+gn0P4a0DV1ndCK6D5kYQLlGzNAe3M40p/rzzHXkIVXP3Wu7n8ze3yKjRRfKbP3Hmtyvsv63SNd AckorsLbgUSjfZooyx/7V+0UVLDhj+mnsA3RdKmOu+YKv3Mbiv7uI6u0qP+Ay1iNM9Yz3ji+mIPq2 XjIuNZMCymH1AXLUKmZHBVbww389llgmIaz7lHitOOb4pV+8U7+eWUUAST/0dBCB85bTupQ1BK1Do eSv2G0nUjPBq3gzsqo0g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rRXAb-009WkC-0k; Sun, 21 Jan 2024 12:43:25 +0000 Received: from mail-tyzapc01olkn20801.outbound.protection.outlook.com ([2a01:111:f403:280c::801] helo=APC01-TYZ-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rRXAW-009WgJ-00; Sun, 21 Jan 2024 12:43:23 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hibBk8iisnmc3Usum+U4LJSottmV2RmykDa6t3oIZeRmgDok24DUmW7D37BqKdurafXPH/kJHmfK6vma5xxsRxzjTdlAtwZygfDARKBvirzxXcQkeCHypc/ISWeBGQE5+OC4lHCNryyrqJHyy3LoaZ2cxZGJweVbALI8x9ji38Nsriz7FSvPVJ3O9X75KHccLwnV9T49/Pogyq8soHq+iPAocarnLJa6AiETT/TzBm7/+Z8/tZh89VyAO09p8ItxdXOy2ZyCn2RdFmLIey+eRoS+xXDrxjiuvnH6sxOtHkqbGq1nqmkPZCgEoHnjWI3B3Xiw/qoaPnNJRhXrrpmXbA== 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=Ls5iZk9+6AOKEwoiGEMApJrlGG7kLp4Iq7ZOGLzRpTA=; b=XG1PqwC17gDZzOU/1QoPLgfsaFEyGmHjVrjTRL6f0PevNAvqi5agI0jJWoROfCMqHP1cR/oBRaxvUh08uBNRNQ8W1TeFrhSAEPASJqa6wI5tF8kTznt+b0rW8ps1CsozKtcLF9tpgDqSKuRti5AlLTUXA8XuRnbQmvSmtZxhGKkvJoOZk29GRCCUOBlKpBEIL4gcztuk49VPNc4+ln1a5ya06yLPe+m+hDQl6A+VfPqyF/1/1VWN7fKMebee4jePHeffbKPBuKg/0ltghaAeAS4UvB4spx6FNCNQxkSwvznuwsjEcjPj/JB7hrl/iDTliIX9hyyy94bstV8kOEWsxw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Ls5iZk9+6AOKEwoiGEMApJrlGG7kLp4Iq7ZOGLzRpTA=; b=HL8piWul2F72faocLghHTwQHlpRqGt4wrnv6NlCCLPTTYMOcFC+f6EUOmCaj9AMEoNusubr9mjx3eL7Y8kTnbteLEcM4qqfKEHVDbPZ2ps99apDGxcq0Xk8y2ENVvdlpKXLbWwI08RQmT7f+ANtopA1IIOwabg4bbxBHf66fNgq27e+2uNGbne5pdmH10Y92iIPe6+a+cd8zK3qOIOJuHlFMrfce5YG0wGRHPI3JTHYOQwqQqbPCRwCHFIgu2hFYqiCi2R9z/v5WHx9ay14B3CDLeWirV339Bke9SV3EV94btb3ET87NV+MqglGXR/BDVI2KJ9I+l3NWEHLTymhH/w== Received: from TYZPR01MB5556.apcprd01.prod.exchangelabs.com (2603:1096:400:363::9) by OSQPR01MB6119.apcprd01.prod.exchangelabs.com (2603:1096:604:27b::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.30; Sun, 21 Jan 2024 12:43:13 +0000 Received: from TYZPR01MB5556.apcprd01.prod.exchangelabs.com ([fe80::bcb7:50f4:7a16:4ec0]) by TYZPR01MB5556.apcprd01.prod.exchangelabs.com ([fe80::bcb7:50f4:7a16:4ec0%7]) with mapi id 15.20.7181.019; Sun, 21 Jan 2024 12:43:13 +0000 From: Ziyang Huang To: mcoquelin.stm32@gmail.com Cc: alexandre.torgue@foss.st.com, richardcochran@gmail.com, p.zabel@pengutronix.de, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org, linux-mediatek@lists.infradead.org, Ziyang Huang Subject: [PATCH 3/8] net: stmmac: Introduce Qualcomm IPQ50xx DWMAC driver Date: Sun, 21 Jan 2024 20:42:32 +0800 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [TWmxGVjBcn4YOFc3SDNoL+zyIrEoNbHonA/dHyOJ6qeYK5wOx8if/w==] X-ClientProxiedBy: PH8PR21CA0009.namprd21.prod.outlook.com (2603:10b6:510:2ce::26) To TYZPR01MB5556.apcprd01.prod.exchangelabs.com (2603:1096:400:363::9) X-Microsoft-Original-Message-ID: <20240121124237.3328702-3-hzyitc@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYZPR01MB5556:EE_|OSQPR01MB6119:EE_ X-MS-Office365-Filtering-Correlation-Id: abab521f-d649-48f3-f2f6-08dc1a7e87fc X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rd50zM/Gwtvp5byiDmAvgjydkmjjWpmxkJi5uPS5Lh44CChrt57o/tWwOBklerMpHAQQLssR34YBSQcnMyKSaAqXNLxDcTyrD2TmK3TW9ry7xQEjua9Fy/iZ8MaB6irmhw+tBCQ9tJnhr1IZMAQ227P5reDCgNF8666uwEn9FGF7n1aksr0Vxi/P6AiBsdmkLzGImr0fIDAer1OXWBFt1TXTqc3XjEFgNwuJ8vWvVqjUEugdzFHBoUiCiHRCxf3UQeBW2dSq+vNU2XrOSixc8QS7y0h7mtNdgBjMLa3pYpCOBk0fFYV+JxV+atNTjqwcgJJfhwxR1TQ9myn4C6Y855NnwgEldqjPesT8pB0sVkhWcwjuAmevvKXMFZaeNlsX9W7kY1futxx6+kWJYY+VXLZ4bb3Sc5/J8XmU3DgmRl0aWp0zo1IVD81FTC8kUJE/dEnabufBV7X27HvOYLSJaWPv6eZNt7Vu6MCQRBYNCSN99wyo8SGHCk0Fbmuqlv+ULJxn/+rGbRJ0muR8Caw/hIAS9OMJ7rPmS6/0RU/Hf5OiwTBjbIdtbFTOSHWHCKkHp0+tAXurK8beUYuYfbn9OvEbPanjPwyegoYlzYzbV30= X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: j+4enaxO3PM6PIQWpgkjQKzkMN8wAnEbI1sQVow2JEX8dZAwbQg5zEkhPi5869EKs5CLCrOWrsoxSoW3pMNxMEpbBAAQgzj8REOe33VgiiLQ7xa1iZS3OxVPBswgYPPya6Q2mlqU50+OyCjyhiI/YDGDzNaikf57wjV1DHtYodRHeLXIGGJFmRS2c3nuMR+G/05K+tDwFifjsTwwmjG/ZPtAfhtrNVwZb2TyLJ7VtAzLc8KFp0Vu238Ipd6Wn74HiZw1EusVlHYeJA50811jbj97Dk/nOiuknRTAW2kdZKqllcoGuHOy854lUcx4HGEL9rrzBIaWuffi3YuZiM3d4MIoefAHXM49bpQHpOkShMK4GRG95hvLgF8CB4OCq48hOoukfXUCtEDOif9fO0qN2gFMFeED3pReX1M6mkT2BoIeZiRKbOHdsXr1W6nUiebHkXrFkkt3x6zNB2+2a4oFK2WLDwZhx4wacxxeFmeoq9DP5e5i99CtRNuT29ZVHiDsNHO1DSW1/zG56Dcv1hXCIwwTzkYXTLFCoAD4l0hHRNpBH4Nerc98dNeB6vptwXt0Uxim0rT67CA5+edsqRl+j1s4v+SQEszTKGyl5nXfXj+Odc9C6P3fzMSzX2myGKWVdWWA53/AcZv/7qSNH5gMbGbP839Umj9AHJ9FjDcEMNhJOoVJIIg3tGRdyg90Pn6SPN6aZwCu5iIiRzZA6ZerWO6cLOaoxd5aBGTjJ5QavQKn5VSDgS6RqFIEvNhp6Rcjaqubskd/rLEHQIpW7f1FAfljBBCxZDkJ8ZfDSzqwAe+kOFKezAPN6FtyyLooFAraot1iM3p8mzcIxI3pEBURVD+xVv2HiyVEj26Ocmf5M6cyUU/WJG3umwr3J1V7OCWO1s6Bbdz8h4VyCNa5PAD9jATprZ7MGLVVtSTB+Xd4NC7ZnVwUijlNlxVJ7AxCl1SDaMh6bFLwwbwiCeuicbtyyisJjADKmDv5q3XMpnDOVOTyi3HwK6FMXCnjzk2CMuoLY25P3CP2i9SXtHSC6yc2wqG+Irt04jIIAidJMjNRcqcVxSR3bIisTSPpSVGeEheRIuTcZILRBLBPUwlsvMDnCPn8A6BK+v/9qOGPitpsUd4Bm2eaJB3+qoI6Y3CqeAj77bhOst01em8Xm7Onz6ixtotDStVlixc9pv4fjqBQeZ7l5S/AVXXUd+bQAOfhKjxIvfwk1hlIYNKu2TBCi6OrSdwqRkGIs0u/0oyS7f1G9WNeqwOyTt4X4gdIAD3vTSfW X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: abab521f-d649-48f3-f2f6-08dc1a7e87fc X-MS-Exchange-CrossTenant-AuthSource: TYZPR01MB5556.apcprd01.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jan 2024 12:43:13.2554 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: OSQPR01MB6119 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240121_044320_066283_F4B64608 X-CRM114-Status: GOOD ( 18.29 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Signed-off-by: Ziyang Huang --- drivers/net/ethernet/stmicro/stmmac/Kconfig | 7 + drivers/net/ethernet/stmicro/stmmac/Makefile | 1 + .../ethernet/stmicro/stmmac/dwmac-ipq50xx.c | 155 ++++++++++++++++++ 3 files changed, 163 insertions(+) create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-ipq50xx.c diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig index 06c6871f8788..baf6601d759c 100644 --- a/drivers/net/ethernet/stmicro/stmmac/Kconfig +++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig @@ -78,6 +78,13 @@ config DWMAC_INGENIC device driver. This driver is used on for the Ingenic SoCs MAC ethernet controller. +config DWMAC_IPQ50XX + tristate "Qualcomm IPQ50xx DWMAC driver" + default ARCH_QCOM + depends on OF && (ARCH_QCOM || COMPILE_TEST) + help + Support for the Qualcomm IPQ50xx DWMAC. + config DWMAC_IPQ806X tristate "QCA IPQ806x DWMAC support" default ARCH_QCOM diff --git a/drivers/net/ethernet/stmicro/stmmac/Makefile b/drivers/net/ethernet/stmicro/stmmac/Makefile index 5b57aee19267..eec4405d76d2 100644 --- a/drivers/net/ethernet/stmicro/stmmac/Makefile +++ b/drivers/net/ethernet/stmicro/stmmac/Makefile @@ -15,6 +15,7 @@ stmmac-$(CONFIG_STMMAC_SELFTESTS) += stmmac_selftests.o obj-$(CONFIG_STMMAC_PLATFORM) += stmmac-platform.o obj-$(CONFIG_DWMAC_ANARION) += dwmac-anarion.o obj-$(CONFIG_DWMAC_INGENIC) += dwmac-ingenic.o +obj-$(CONFIG_DWMAC_IPQ50XX) += dwmac-ipq50xx.o obj-$(CONFIG_DWMAC_IPQ806X) += dwmac-ipq806x.o obj-$(CONFIG_DWMAC_LPC18XX) += dwmac-lpc18xx.o obj-$(CONFIG_DWMAC_MEDIATEK) += dwmac-mediatek.o diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq50xx.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq50xx.c new file mode 100644 index 000000000000..de8e9a0b2cb6 --- /dev/null +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq50xx.c @@ -0,0 +1,155 @@ +#include +#include +#include +#include +#include + +#include "stmmac_platform.h" + +enum { + IPQ50XX_GMAC_CLK_SYS, + IPQ50XX_GMAC_CLK_CFG, + IPQ50XX_GMAC_CLK_AHB, + IPQ50XX_GMAC_CLK_AXI, + IPQ50XX_GMAC_CLK_RX, + IPQ50XX_GMAC_CLK_TX, + IPQ50XX_GMAC_CLK_PTP, +}; + +static const struct clk_bulk_data ipq50xx_gmac_clks[] = { + [IPQ50XX_GMAC_CLK_SYS] = { .id = "sys" }, + [IPQ50XX_GMAC_CLK_CFG] = { .id = "cfg" }, + [IPQ50XX_GMAC_CLK_AHB] = { .id = "ahb" }, + [IPQ50XX_GMAC_CLK_AXI] = { .id = "axi" }, + [IPQ50XX_GMAC_CLK_RX] = { .id = "rx" }, + [IPQ50XX_GMAC_CLK_TX] = { .id = "tx" }, + [IPQ50XX_GMAC_CLK_PTP] = { .id = "ptp" }, +}; + +struct ipq50xx_gmac { + struct device *dev; + struct clk_bulk_data clks[ARRAY_SIZE(ipq50xx_gmac_clks)]; + struct reset_control *rst; + struct phy *uniphy; +}; + +static int ipq50xx_gmac_powerup(struct net_device *ndev, void *priv) +{ + struct ipq50xx_gmac *gmac = priv; + int ret; + + ret = phy_init(gmac->uniphy); + if (ret) + return ret; + + ret = phy_power_on(gmac->uniphy); + if (ret) + return ret; + + return 0; +} + +static void ipq50xx_gmac_fix_speed(void *priv, unsigned int speed, unsigned int mode) +{ + struct ipq50xx_gmac *gmac = priv; + unsigned long rate; + + switch(speed) { + case SPEED_10: + rate = 2500000; + break; + case SPEED_100: + rate = 25000000; + break; + case SPEED_1000: + rate = 125000000; + break; + case SPEED_2500: + rate = 312500000; + break; + default: + dev_err(gmac->dev, "Unsupported speed: %d\n", speed); + rate = 125000000; + break; + } + + clk_set_rate(gmac->clks[IPQ50XX_GMAC_CLK_RX].clk, rate); + clk_set_rate(gmac->clks[IPQ50XX_GMAC_CLK_TX].clk, rate); + phy_calibrate(gmac->uniphy); +} + +static int ipq50xx_gmac_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct stmmac_resources stmmac_res; + struct plat_stmmacenet_data *plat_dat; + struct ipq50xx_gmac *gmac; + int ret; + + ret = stmmac_get_platform_resources(pdev, &stmmac_res); + if (ret) + return dev_err_probe(dev, ret, + "failed to get stmmac platform resources\n"); + + plat_dat = stmmac_probe_config_dt(pdev, stmmac_res.mac); + if (IS_ERR_OR_NULL(plat_dat)) + return dev_err_probe(dev, PTR_ERR(plat_dat), + "failed to parse stmmac dt parameters\n"); + + gmac = devm_kzalloc(dev, sizeof(*gmac), GFP_KERNEL); + if (!gmac) + return dev_err_probe(dev, -ENOMEM, + "failed to allocate priv\n"); + + gmac->dev = dev; + + memcpy(gmac->clks, ipq50xx_gmac_clks, sizeof(gmac->clks)); + ret = devm_clk_bulk_get_optional(dev, ARRAY_SIZE(gmac->clks), gmac->clks); + if (ret) + return dev_err_probe(dev, ret, + "failed to acquire clocks\n"); + + ret = clk_bulk_prepare_enable(ARRAY_SIZE(gmac->clks), gmac->clks); + if (ret) + return dev_err_probe(dev, ret, + "failed to enable clocks\n"); + + gmac->rst = devm_reset_control_array_get_exclusive(dev); + if (IS_ERR_OR_NULL(gmac->rst)) + return dev_err_probe(dev, PTR_ERR(gmac->rst), + "failed to acquire reset\n"); + + ret = reset_control_reset(gmac->rst); + if (ret) + return dev_err_probe(dev, ret, + "failed to reset\n"); + + gmac->uniphy = devm_phy_optional_get(dev, "uniphy"); + if (IS_ERR(gmac->uniphy)) + return dev_err_probe(dev, PTR_ERR(gmac->uniphy), + "failed to acquire uniphy\n"); + + plat_dat->bsp_priv = gmac; + plat_dat->serdes_powerup = ipq50xx_gmac_powerup; + plat_dat->fix_mac_speed = ipq50xx_gmac_fix_speed; + + return stmmac_dvr_probe(dev, plat_dat, &stmmac_res); +} + +static const struct of_device_id ipq50xx_gmac_dwmac_match[] = { + { .compatible = "qcom,ipq50xx-gmac" }, + { } +}; +MODULE_DEVICE_TABLE(of, ipq50xx_gmac_dwmac_match); + +static struct platform_driver ipq50xx_gmac_dwmac_driver = { + .probe = ipq50xx_gmac_probe, + .driver = { + .name = "ipq50xx-gmac-dwmac", + .of_match_table = ipq50xx_gmac_dwmac_match, + }, +}; +module_platform_driver(ipq50xx_gmac_dwmac_driver); + +MODULE_DESCRIPTION("Qualcomm IPQ50xx DWMAC driver"); +MODULE_AUTHOR("Ziyang Huang "); From patchwork Sun Jan 21 12:42:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ziyang Huang X-Patchwork-Id: 13524574 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 E7FE9C47422 for ; Sun, 21 Jan 2024 12:43:54 +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:References:In-Reply-To: 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: List-Owner; bh=faawdzQNrgGB0l1y66CSBgiZPZlLc3p/zbJ5bCuBQe8=; b=Uwy3lsJwYXgUm1 Wsfekz9oLtNj1ft5Tjpt0ut054f7wpM9Ya7EqZ6EQYj0Zs3JKZlDdcY3wAdDR4pNpHCNTn8wOXNzD jfE7SVfWDlYY45f5YPlXvfhqn5nbXuvD1+RTF9zcq3WX0tKjCxsxZwos12JRXKI35kXwCZPIFJkyR UG5SRONRciKvHYgiBAkR77SZmg0GSY3wQ41ot5M7X0izAV4QD0ito1+l9fydNzgAFkLaJZSkOZqRJ FAMEXFhNmLIMGY0KBzb58LnLfiE1/YoMT/pXbSxuukOTedgPKvY+qlmBai9bGjbimyrRrSY1zqlVb NjTFURnlaMPFkgosXhPg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rRXAh-009WnT-2J; Sun, 21 Jan 2024 12:43:31 +0000 Received: from mail-tyzapc01olkn20801.outbound.protection.outlook.com ([2a01:111:f403:280c::801] helo=APC01-TYZ-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rRXAZ-009WgJ-2f; Sun, 21 Jan 2024 12:43:25 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hv0iS+rlatgYifFRt4zSf1EFcbMgghUjky/uMAdUn1pC0QoEF9PDKUJAxibVnKjsD6nIgCYOVQiuUMounu/1dIf2zlwdq/l/9BYh6MSCIzsy6mKugcyWGN6FNv29OOXMRMY2AsqoYWoav6ZSYKlUqLzyOPZZE5oXWx5KR/Y7IDngIbuexRQOJF8CLIoUaTKe/hVvnRecZMwXdwzFGlP9OIy/cXYaNgjJBlnnmLBYTGHMGV/SX4nWZGHcXSLMT1vrIt0UwQvUITcfY6gu8dMNDJBzcnWs69p9G73VqtVShcOos3kzuR6fycMiMPB6I3sKaQj2ORX6ebhYWLMC2t15eQ== 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=x1jb92RmIt0dCPXHHflbc6kEI6Sa9rqMx59OPWcJtfg=; b=OQgoQXaixtpgncgi6lnclHR944jvzGogRN+sw6Zy/rp29V1fs4EYTKw3MFVQEOZzclH5cgrKeR/mwuLT091xz1aOEjmxI+myvrRUMqY3t6wWAku0F4idHM9T9P6MmuDfaDfLo0GHYGEaPbEfTwTgIf/Kl1irILuWqr2Y7hOMB75uCfBsziE52mb3VtPXwEo92An+h2PE4iVDCi1vFnXStNCdLG3crCdibLWhEz04AHziAhycf3aekagfffH/BIE9bhivit9C1RXO/TlaOS664G0FFmRrB/jNCrXklnK6i6BEF0+BXluM2q76UvHs+9BacGeGXCnJrmBT2l7lH2pTYA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=x1jb92RmIt0dCPXHHflbc6kEI6Sa9rqMx59OPWcJtfg=; b=QeEclU/dJ17aBOQJAUObnKVBCV2RXMOz1T6ODBYKdbJBToYhPGmJBbYuCgtyP+tesOroncYZN+4sZWn0BqivzbtH99+XQOobb+Fzdskd/1xHisFC1F0e+X3I7aZR118a7PBJeJejJWkcfjxaAXD1rooGeodZVyoVpYimA6bliehAgszz4U+6Gng4eSiXrWjhdZ7pxKOyE30R5BGCB49p1qRmjY5yxlU3VVg7SZPIj/M/u/X0MAohDrpcxxw7gmTE6E1PSvTrggpeMOPchcXCfDh1DrWiGUM98+VHxCRagAPGqxvqruxuNJlQBrDY4Vj+Rvu1huacFNtlPCna3AsD0A== Received: from TYZPR01MB5556.apcprd01.prod.exchangelabs.com (2603:1096:400:363::9) by OSQPR01MB6119.apcprd01.prod.exchangelabs.com (2603:1096:604:27b::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.30; Sun, 21 Jan 2024 12:43:20 +0000 Received: from TYZPR01MB5556.apcprd01.prod.exchangelabs.com ([fe80::bcb7:50f4:7a16:4ec0]) by TYZPR01MB5556.apcprd01.prod.exchangelabs.com ([fe80::bcb7:50f4:7a16:4ec0%7]) with mapi id 15.20.7181.019; Sun, 21 Jan 2024 12:43:20 +0000 From: Ziyang Huang To: mcoquelin.stm32@gmail.com Cc: alexandre.torgue@foss.st.com, richardcochran@gmail.com, p.zabel@pengutronix.de, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org, linux-mediatek@lists.infradead.org, Ziyang Huang Subject: [PATCH 4/8] clk: qcom: gcc-ipq5018: correct gcc_gmac0_sys_clk reg Date: Sun, 21 Jan 2024 20:42:33 +0800 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [ww+btxZZBQOC2wakAs5+sapyWmbpq5X6IyU85vlcnhJasKmaU1aNdw==] X-ClientProxiedBy: PH8PR21CA0009.namprd21.prod.outlook.com (2603:10b6:510:2ce::26) To TYZPR01MB5556.apcprd01.prod.exchangelabs.com (2603:1096:400:363::9) X-Microsoft-Original-Message-ID: <20240121124237.3328702-4-hzyitc@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYZPR01MB5556:EE_|OSQPR01MB6119:EE_ X-MS-Office365-Filtering-Correlation-Id: 0b4a16b5-8d74-4bac-8578-08dc1a7e8c1f X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tHsYmrrJYKUXHcO8vMQtk366rZo0YRfSemU+NcvIf1HNhdu/7l2xKMpV4DqZ9mkonCYzyoirabBBjDPe9zYtu+pkE9EvU7mwRcs9mwmo4ptF1LHWtCOWaxp3da+NHrImdsEMzgrAN8gnGP5DmrV1TOSl82bhz9f4RcoNKu7FWVddUeS1l9to/BamJVjMJqx+Tm0rqWLtRk49IaKveRYHeIt5qX2cqSLZvFSV4Ox5mO6f9dvUU7pxNw8eQK8GAq5Va6aB5SoWCfZAn0hN2fiiWSWdXBrZ4d9BT04Rxkwb8JH4VJ1EtGweIDa+ECY2xlaMg9leHRxBbq6iOMFbV3nKs9QY4k+SoaKco1RtLdB6ej1X2EhQFftRYAojVOimk0cOoXjvIXCgbEmEPeEmwBngZeMIH8dbfg539CO/zmICUmMrk3xS/lSV+gPhHQj46g7oeAQTUgiMMimyzDdgZkIMQF/lNJwots9ISlK/CSY+jSFmqGEyuAYWwMGs2XsaiHVuJor/yGzBvX0eQQjGLR7PZ55OcAlx2FijylUny4P3M+lZoMzpYBCKpmcKLCwxKuprMXywSjEX3HeWf9tQcrQKEdkmBdqvUY64YwqCOfF66JsflFK6TbUxxreXpPI0uV1X X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: lYNIfRswU0knkZ26ZjGOsumM7pb0W1MEu8YFdu3TNE2LCze5IStpK9cgldYUatTIP8wactALuNtI6qmvvzVkX0bd7Vn3hIc2euq9Z9N+cMo+eZ42ubPxfkEOd36endhQ5YWkIbkcQ+ZJjJV78M0AQAG3cdpqQyXsY3X1lXjfpay4pkS1mTA6v1pwOq6HB+Qn2zS+OE/flDyTbXJoa2cO8NnVzz9dEVMOTIn8apoZcDVVdqngRClDD2Sze8X79xxXOx42GmxYX1HYc22m65XjjJCjNF+FJF5rVX4uDVUeJwD2/GM45e8l9ND0oS+vxP6ZhDmImjV0I8gQ++ziP0SoSdhw+U27pAOYwcoqZ5xa31VhvnHsAlNKiESJV4JQkp6yHvHlzcvafvaPmJprKbpaGP4TkCDdiF7qgVC6GGgP4G/lHxzhm35Pu6i8KjEvbW/9eVJQN5t69cMJFzg5Ieq3/NEAP75euulMRlA61Z89eJmCF+9z2Xd95GJxdXTvo8M+0ZHJ47GfBbBxM78yopp/RiesKM6t+gVvP0Kw5b0nQ4vnks9WamAkyTfWiXcekeS7uiDJsOIECpkR4UfAMDroxgYTDckULLI/7RBl6uWjUbey4aAjiQCDPNNX8p7kHyDR7uNZf42gLs5Ole3CoAfUM0mF6gYgbiMsiGL77ckR89Y6qMyegu6B2TUgeY9mKh9X38Ag7PGBQSKMELBQYdlh8JAxV5Mcv5mKv+qJOGUQNajJmDTb1dmwdhhhvsOJuRn55LffVXT84wOuuQhVYf09Xzkb60GcIdCO7RL3F45H4cRyzTehIZ5Px7QB3mwf00eraRFcEn9Husl2Ou4RiJE7v+RLUtDdfD/q5RVr0xI40GbkemFEkgumVfbe0WsqMM14dHI+ky5CgCs6cDdwYDLoBsEPN0WFzs/1bX1knrUgHT+zbrbJ02rjWl7qGTsatsBGxL9dsyH1GOlAylpIYL+RdOP89IYIIhkIu1luSHP4M5h0O45SWM0tq52Z1zJZoZOez4lAVTY4mWq3GaDwj+8lGZylhbuYd5UrQD/3SlFyElchId93fUUvNTC6L4c8UcHD//Op8e08u7T2hoUR4gIGQDixKJctmtMGgpCf3hRXz7XXiUPIQb7IvCXDqZl0Hz/Y2CBdHEOCjLFMBFE8P1Un/0oP7OPQXYO37QSmzjvoC9pf1yPzmUQkc9I/zu9nf/SEhtOHGp6mnpYrKR+nR9XtpEH+/7b0DwZGR73t7Rg/Wi9wHJCzjxS2rlT/fpxd/2I/ X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0b4a16b5-8d74-4bac-8578-08dc1a7e8c1f X-MS-Exchange-CrossTenant-AuthSource: TYZPR01MB5556.apcprd01.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jan 2024 12:43:20.3138 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: OSQPR01MB6119 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240121_044323_888078_0B72D0DA X-CRM114-Status: UNSURE ( 9.46 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Signed-off-by: Ziyang Huang --- drivers/clk/qcom/gcc-ipq5018.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/qcom/gcc-ipq5018.c b/drivers/clk/qcom/gcc-ipq5018.c index 19dc2b71cacf..3ba2fd53262d 100644 --- a/drivers/clk/qcom/gcc-ipq5018.c +++ b/drivers/clk/qcom/gcc-ipq5018.c @@ -1756,7 +1756,7 @@ static struct clk_branch gcc_gmac0_sys_clk = { .halt_check = BRANCH_HALT_DELAY, .halt_bit = 31, .clkr = { - .enable_reg = 0x683190, + .enable_reg = 0x68190, .enable_mask = BIT(0), .hw.init = &(struct clk_init_data) { .name = "gcc_gmac0_sys_clk", From patchwork Sun Jan 21 12:42:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ziyang Huang X-Patchwork-Id: 13524575 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 920ABC47DAF for ; Sun, 21 Jan 2024 12:44:10 +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:References:In-Reply-To: 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: List-Owner; bh=93tzD9mk+17Ik1093K4i+ewnm80OvSIxth/E/wjjL2U=; b=dnL63aGTM7Qwvk 0oBrSk2ODwI4XD308gfiuOYI+OJtiov7tA1Htef8BvzVBonz4sVavFMfE5miRN/bvuMFJt0RBBruZ j26CoujCSCBechqbGQdujqpkOoR41IBHIzFRwvwjGUtekzKHRUpUxgNbMYB0lpk/VdZIqC48kFwLt 2OZ6wDWGe2yGridemQoNzo+iikI4QvoR6+kSsPoBle5rPe1qTUCp6NObmw/owGktPVseQLrEqikos rMH0HFLGl8/QvJVE/Gx8qsbyvMv+5h+/DhQfvTFluqStTu1znbxRo/8npz9B3QZenOYshKrYA9TR6 urlnXw5qmyOODz4RlJAw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rRXAv-009Wuz-0c; Sun, 21 Jan 2024 12:43:45 +0000 Received: from mail-tyzapc01olkn20800.outbound.protection.outlook.com ([2a01:111:f403:280c::800] helo=APC01-TYZ-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rRXAo-009WqY-1C; Sun, 21 Jan 2024 12:43:43 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Hk0MmBk4V5MW/HOIUdkrFcfQtLzg1JPZCNYT1I94l/yzyRaNAzxbpsFUAtbnia0zBSE2JujWBTb/B7Yi9jmDZ2jQf6DwCBb2HwYANVeQL7oDTi8IknwA+VB0HxhhoQCtij/CjxQUJcr8wbBFCs7+pASm2m/LLITy5GvWcQRPuAqiHMxyXYFNgPOieTNwjaKo9BgVgHFQFyDvLHbZxn5BJXKEtcoJZQy4KqHUvU5B/r2X8e7xQkkWiCVM6KXZIp6RHp/iFInlOggIoMdOIkHTBZrlAwf2GMPJXbCdP9nM9nqg+EQerdYNdKoCadkdwr/ECWRG2bAZ/4l4qYcF8B7zHA== 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=TnRRuLNvK/g8gaz8gX6Cg8mwYr7wdgAjVPAAoZnD8zw=; b=dGvDfpJCkA5oKeqtBuM3GHzlUOhM9JVjzQvpTV/rTKt/IxV9XamlAjcXcvNDbW+NYwEBja/Z6KGGgpNh/cQoYmNXSXF0sS87zv/JQ2mz5ktfNbJ51gb2iXDP/pHUDcUshIViolx1eTZ1jIS+0APs/BejodGvfwMfX6hcgw5dDKMFqPdquriZTp76TDpga1BxHSH6s5KXe/22U7lZs8MLcRuvzRQ67U6slsiv9z3sGcV/4xazNSFZ2K8j+ChDjGi7K6ePnm/tNidUSD01Ywiu0ZkUeZOBcB2Esc2bfrTJAUwh1IGWP0AbRk1VhFuWQD6hVB1VMITXPil4dKX/2QzlSQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TnRRuLNvK/g8gaz8gX6Cg8mwYr7wdgAjVPAAoZnD8zw=; b=qNo3AAnaYvXgWxwJZnKq8Qw1mMFofK2HkUSvCbfXtES6Iu4KyKK9jRIFzOaaBygKOMYftmS+jsz3XgufExjiri4MMJndiwEInMlG6m/GX8cJ5/ZDMTjLdwyn5x0iBxOBta2pG8vwz7PFktfzTfWBhTmN+7oTk9tHMuh1EnHnhz8A1f96LVnQmYhjte322FhWDGhQtX1QytkYQ+DdY5D9ngqgbQ9NHx3dWSbOG/pyZjP4irdPtlsUd16jb8HneteEHv3J2aidgxB8knVm7xy5Fss4hZ3Qi1A5PEB7DDbxq7TB3Jn5Bnh3e2Ni9YF0Tkahl3p3xhF7jhTif6v8NCIAJA== Received: from TYZPR01MB5556.apcprd01.prod.exchangelabs.com (2603:1096:400:363::9) by OSQPR01MB6119.apcprd01.prod.exchangelabs.com (2603:1096:604:27b::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.30; Sun, 21 Jan 2024 12:43:30 +0000 Received: from TYZPR01MB5556.apcprd01.prod.exchangelabs.com ([fe80::bcb7:50f4:7a16:4ec0]) by TYZPR01MB5556.apcprd01.prod.exchangelabs.com ([fe80::bcb7:50f4:7a16:4ec0%7]) with mapi id 15.20.7181.019; Sun, 21 Jan 2024 12:43:30 +0000 From: Ziyang Huang To: mcoquelin.stm32@gmail.com Cc: alexandre.torgue@foss.st.com, richardcochran@gmail.com, p.zabel@pengutronix.de, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org, linux-mediatek@lists.infradead.org, Praveenkumar I , Abhishek Sahu , Ziyang Huang Subject: [PATCH 5/8] clk: qcom: support for duplicate freq in RCG2 freq table Date: Sun, 21 Jan 2024 20:42:34 +0800 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [eYikeWM2GM7qK/WtHoB+cI/jJ5r4GrkIov4uetos/j1E8TsBXaboEw==] X-ClientProxiedBy: PH8PR21CA0009.namprd21.prod.outlook.com (2603:10b6:510:2ce::26) To TYZPR01MB5556.apcprd01.prod.exchangelabs.com (2603:1096:400:363::9) X-Microsoft-Original-Message-ID: <20240121124237.3328702-5-hzyitc@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYZPR01MB5556:EE_|OSQPR01MB6119:EE_ X-MS-Office365-Filtering-Correlation-Id: 1605bcff-1402-43c9-7ccb-08dc1a7e9247 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gDACqTU4RL2Oukh1rNPZerDsRxyS9zGyWZesrSWoxEUke1Ezh2etJtFy4uEGL+N7E9TInuEy2KeZIzmhO+ar2NYJoOfODyoC05NI5OKXRZszacoEQ0KZHI9jMPradhnuzd0pLQnE4is2xroru4BxGDtFtsFN3sZisaujC83QucEUXOdCeCj7b1lAZU9fFIH6kO1KGDmyMX4TutazE8AT35YqLXgoFzWH/A8xgnSrGKKyptEQvYoyh7tuTGLwA4iws15SFVpKpsfC7rO6i/5JU8qkbQIRcUx6xmnshmz672ntDWtwUDGa+5xk+0OVJa+Ew1mb33l+J0RGe0yHAKssdS4XZfUZ93xCpsOPYyOdk0L3VtXaNULvR2x+1t0gmj6tpakBF1beITf4RF7lapRXuoFuu12UArPB3OVO6aZ6pcXKjv17zuptD4bgfTzp0jrU+YR5DRK1oq4imzGK8IUtDjqgDAILUMomnN5wihvlUQ49KyMGGRbqW4L3SgHz+yeIB04LDveDumozTlyZz7K+rWAdBRTBWwL2V1rNh1FvW1GbwskBxkz7t2drTiFeKBLdrfiZQPRmTbcxkb6sJZ78c9q6IrtyaQXtxhOaeYVIQSY94bEhVIRfNF2eVCHUWDM5 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?IiOaBobZHMhdjxoQf+3AI9HR8aOF?= =?utf-8?q?Y56L962z1ypmX9lf6fP4dXIpQkOUNaOiT8RUbBq+uRxNZ2fX7BN/hc7rnWXbu7UHf?= =?utf-8?q?9cYelC2fN6xo0IaLAq55eVsnd+fxumD7SabVyktCMNvmRdS9DNNSJGtJUOqL6EyJo?= =?utf-8?q?xiKSr2K17nRtYAZFZMljbk2tbDD6201Rp65/bmEj+QsovUTUWLnsmEO5+4sphir9O?= =?utf-8?q?ZiPKkuKwtzFEgYjMZ0Ro6fTfR8GbhPU0OcAgoimZ7Wc/UfSfkEpBWq46DkYI8sZsQ?= =?utf-8?q?sZVl1OExf/pHFBHmnYjg41UNdGQBReMvtff7kaYq1i/1tX5Kodop5ZTFFoI8e/+ZL?= =?utf-8?q?mZqQLvPyr5JWsYyWhVvtGlsemOyaXkgt5oNyZjZtuKdxyclDLgAVD9A4Ed+q2XaHU?= =?utf-8?q?rCVmJ1UFv6Z1t/o72Yg+Idz9pK0Ei1rCnPHHdFnJ76oLemje/ua6dzZFhq3pgk8a6?= =?utf-8?q?j2dajsBfMzkxpuf8FKpY9uBFWvtLVXQPuWAVT+iGOM53bJL+S5t/OxUgFcefXNGYR?= =?utf-8?q?6/zANhzEowhhcMAxtedvzl/7KRyipGir2JnPGiPU5Rinf9mUd37gQCHWAqeen2XD9?= =?utf-8?q?TTOOaqC80Wje9buhIgbwLoKKXDXXDJC1M8UVsosg2EUY6AwXFmBj/Xe68SiQZ/wKv?= =?utf-8?q?hRoF/Zxivep34L+boMDwW3xHL9RgescsOqIKJgL2Syt//pMjXm2pvO7FyGTwsUVrW?= =?utf-8?q?9SF+zqDOvCez8XzWrApclLrV9vHhh6aJUkJuZAVeJj1bsmzG1FSUdUQe+2KyaL/Mp?= =?utf-8?q?BOtreQkhp055rq3fO0vP0dXPs0qQ9wB9tBReGA+gKlb5YuGDfUcEtzMDAIEGfVj+C?= =?utf-8?q?yZsqNpyihvSnbsxaRSBE5rcLbLIorSMkgY0td9PlwPrSfu1Idf7lnWhUrV3H5z0vI?= =?utf-8?q?M0QUbw/kBn2G9cKIa2vUSGTXIa7bRfQBmZUcu5191dpIjF3hxrVe0ntBrju4CGdEE?= =?utf-8?q?EQdjI64K1p0ImyXIETwiW9/cLNhbwI9r8T0S87hOiSX9+JhFX3sQdG9onir0EJWG+?= =?utf-8?q?OXpsxA0u08s1EG6KfWL84DIDZIU1PjL+Oy8byDYmbS7trmkI0IfSEQt8W0aftztEH?= =?utf-8?q?sBwD6+wP3bYXz6VQXoj/N/1LvKT2cNGtHMopYlUbKuVtgJOZdfVJOkzVfuK67nwrf?= =?utf-8?q?pGMkycN6BfSrXV2U/rFnhBS1fxkxT9Tq4ATt4oOp/weHuiGwFIoQ3RIOHzJNoJsiM?= =?utf-8?q?01/vooJdD3R78MyQu?= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1605bcff-1402-43c9-7ccb-08dc1a7e9247 X-MS-Exchange-CrossTenant-AuthSource: TYZPR01MB5556.apcprd01.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jan 2024 12:43:30.5979 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: OSQPR01MB6119 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240121_044338_430223_56FC314C X-CRM114-Status: GOOD ( 18.88 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Praveenkumar I Currently RCG code looks up the frequency table during set rate and return the first available frequency greater than requested rate. If CLK_SET_RATE_PARENT flag is set then the set_rate request will go to its parent otherwise the clock framework will configure pre-div, m and n according to the returned frequency table entry. In this case, it is assuming that parent clock will run in the same frequency with which pre-div, m and n has been derived. But it may be possible that the parent clock supports multiple frequency and the same frequency can be derived with different pre-div, m and n values depending upon current frequency. Also, the same frequency can be derived from different parent sources and currently there is no option for having duplicate frequencies in frequency table and choosing the best one according to current rate. Now this patch adds the support for having duplicate frequencies in frequency table. During set rate, it will compare the actual rate for each entry with requested rate and will select the best entry in which the difference will be less. The existing functionality won’t be affected with this code change since this code change will hit only if frequency table has duplicate values. Change-Id: I97d9e1b55d8f3ee095f6f01729af527ba90e50e5 Signed-off-by: Abhishek Sahu (cherry picked from commit 775e7d3b69ffc97afb5bd5a6c9c423f2f4d8a0b2) Signed-off-by: Praveenkumar I Change-Id: If10193fc79a3c1375ab73597813745ff1f4df0ad Pick from https://git.codelinaro.org/clo/qsdk/oss/kernel/linux-ipq-5.4/-/commit/6dfb368bae130bee58e00ddf8330b55066e1c8c5 Signed-off-by: Ziyang Huang --- drivers/clk/qcom/clk-rcg2.c | 86 ++++++++++++++++++++++++++++--------- 1 file changed, 66 insertions(+), 20 deletions(-) diff --git a/drivers/clk/qcom/clk-rcg2.c b/drivers/clk/qcom/clk-rcg2.c index e22baf3a7112..6141e4991fbc 100644 --- a/drivers/clk/qcom/clk-rcg2.c +++ b/drivers/clk/qcom/clk-rcg2.c @@ -209,26 +209,82 @@ clk_rcg2_recalc_rate(struct clk_hw *hw, unsigned long parent_rate) return __clk_rcg2_recalc_rate(hw, parent_rate, cfg); } -static int _freq_tbl_determine_rate(struct clk_hw *hw, const struct freq_tbl *f, - struct clk_rate_request *req, - enum freq_policy policy) +static const struct freq_tbl * +clk_rcg2_find_best_freq(struct clk_hw *hw, const struct freq_tbl *f, + unsigned long rate, enum freq_policy policy) { - unsigned long clk_flags, rate = req->rate; - struct clk_hw *p; + unsigned long req_rate = rate, best = 0, freq; struct clk_rcg2 *rcg = to_clk_rcg2(hw); int index; + u64 tmp; + const struct freq_tbl *best_ftable = NULL; switch (policy) { case FLOOR: - f = qcom_find_freq_floor(f, rate); + f = qcom_find_freq_floor(rcg->freq_tbl, rate); break; case CEIL: - f = qcom_find_freq(f, rate); + f = qcom_find_freq(rcg->freq_tbl, rate); break; default: - return -EINVAL; + return best_ftable; } + /* + * Check for duplicate frequencies in frequency table if + * CLK_SET_RATE_PARENT flag is not set + */ + if (!f || (clk_hw_get_flags(hw) & CLK_SET_RATE_PARENT) || + ((f->freq && (f + 1)->freq != f->freq))) + return f; + + /* + * Check for all the duplicate entries in frequency table and + * calculate the actual rate from current parent rate with each + * entries pre_div, m and n values. The entry, which gives the + * minimum difference in requested rate and actual rate, will be + * selected as the best one. + */ + for (freq = f->freq; freq == f->freq; f++) { + index = qcom_find_src_index(hw, rcg->parent_map, f->src); + if (index < 0) + continue; + + rate = clk_hw_get_rate(clk_hw_get_parent_by_index(hw, index)); + if (rcg->hid_width && f->pre_div) { + rate *= 2; + rate /= f->pre_div + 1; + } + + if (rcg->mnd_width && f->n) { + tmp = rate; + tmp = tmp * f->n; + do_div(tmp, f->m); + rate = tmp; + } + + if (abs(req_rate - rate) < abs(best - rate)) { + best_ftable = f; + best = rate; + + if (req_rate == rate) + break; + } + } + + return best_ftable; +} + +static int _freq_tbl_determine_rate(struct clk_hw *hw, const struct freq_tbl *f, + struct clk_rate_request *req, + enum freq_policy policy) +{ + unsigned long clk_flags, rate = req->rate; + struct clk_hw *p; + struct clk_rcg2 *rcg = to_clk_rcg2(hw); + int index; + + f = clk_rcg2_find_best_freq(hw, f, rate, policy); if (!f) return -EINVAL; @@ -360,17 +416,7 @@ static int __clk_rcg2_set_rate(struct clk_hw *hw, unsigned long rate, struct clk_rcg2 *rcg = to_clk_rcg2(hw); const struct freq_tbl *f; - switch (policy) { - case FLOOR: - f = qcom_find_freq_floor(rcg->freq_tbl, rate); - break; - case CEIL: - f = qcom_find_freq(rcg->freq_tbl, rate); - break; - default: - return -EINVAL; - } - + f = clk_rcg2_find_best_freq(hw, rcg->freq_tbl, rate, policy); if (!f) return -EINVAL; @@ -1032,7 +1078,7 @@ static int clk_rcg2_shared_set_rate(struct clk_hw *hw, unsigned long rate, struct clk_rcg2 *rcg = to_clk_rcg2(hw); const struct freq_tbl *f; - f = qcom_find_freq(rcg->freq_tbl, rate); + f = clk_rcg2_find_best_freq(hw, rcg->freq_tbl, rate, CEIL); if (!f) return -EINVAL; From patchwork Sun Jan 21 12:42:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ziyang Huang X-Patchwork-Id: 13524576 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 922DEC47DAF for ; Sun, 21 Jan 2024 12:44:16 +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:References:In-Reply-To: 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: List-Owner; bh=bHgxEF2C5CWaowVhLGrViCwBOGFbI6QC7mqlcgCDHAo=; b=ffTG8rF7Z/eQsD 3UoYqoONlvoZvgziANCa4LTYSmUpcIduswRh4+OdaZWY5fKqrYmSv5bVezVUa3hB0sDhPWuZM6gMr xY207BxXnb7+zxfIFrVPd+U0JJnA/2XmMNekFppOus1KNwQLGqc6DG1DtCaKMujOQGry1COiK501N FV15eea7a7RAKuz2L/vGwSiWSVDYZoBUpzLwqZY+bIMvz++6/dqhrCsQHeQZ3/j8NK/P9I3exzDZd ZiEfPL4YkocAPKXf86U6zJQvD6ubXSBA9cxxLb5ZrnC8DCY+aOvyi1bibZVwufgbi15hUKAlpRtkN yMXSYx00QH8eVtBEcmWQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rRXB3-009X05-1Q; Sun, 21 Jan 2024 12:43:53 +0000 Received: from mail-tyzapc01olkn20800.outbound.protection.outlook.com ([2a01:111:f403:280c::800] helo=APC01-TYZ-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rRXAt-009WqY-2l; Sun, 21 Jan 2024 12:43:47 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CZZnQashbBdTY91tUp5wZJwGiEqaPOkkgNEPKjsKcGetu7W5TOe/wN0DjefMAMRnY479pc75MTBAPxuwxn4pLXQyKOkMecfiLcgiOQDM5iY1Npk/AGnRULuIvlCwos91MYjezbJz0R7gVE7l7RzYLpicNii2yZ7f4HOgalIExYqoskI1iMQYb9jeMcNOY5LDHc0OuDMzgc4tcgB2Hnze1EnEnbnMG/jmv/Yz0+NkSZb2s8/ajz34vlhLuVUU5ucnmqmjRwoqHPvCx7nxyOvNWlBpLHMlG/rkzNeuJoFCgpamqe5h/xVzqgp1q+NjNEhPbT9eiOzlYEqHSJ49FWRZ6g== 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=CeF/Np6r3wx5dMVJ4z8gk42WxkpVi8rIybYiu1roWII=; b=JE1dcNOcZOYsb+fZoiLugcAgKI1miA9aByBFhXt0RvYMtBumBgo7jU5Je78b8XgzyH0Q1Sk3rch9Vm7GvNhPaRDsgk3nlG1jTFS9zt4s8dypp7M4fidvZcMOnhFA/oS5kwwKGi5P72qOmfKHdzNKoxIbxejp/jp7C2OhFxQmoaTfUT93VPEHEBP5awCQrDuvVGkmcuLHHrZ8PtOvt4e80kJJWeT6/V1xZBlGRC5UDXcZRxTeZfsLKJHl7gGTB81lZNZGymewR5W/ogE5o73+vMYaKuPQVD7JhjJsvd/WTPauEIrMBeGdpHzFLCaw3+KH8BYmTWMNlz68+TkzPCIQ5g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CeF/Np6r3wx5dMVJ4z8gk42WxkpVi8rIybYiu1roWII=; b=TaKEfFnnBYW/pnO2zI8PizUvSmp5B9x1e0BQ2LuARhqNndSp4/b7f6aiB7cn8sqNN1hAfV/ZLOcSKWEyFl74tQXOLpnZR/czUb6waCduR0h1mhYPoTxw3Qv3+GTuvDsPAA4iuymgOx17edL1JKNkV+ybeSulu2UHfisETvlbXgSghhNy3DCYTeFY1b2khXTcvbxmJyTx4Z4S6opx5WNV175dy8QoW8u9XYVT+kOFfGfTLP3SEBAeqKCIOTynyZ1Wcl3TwkQ3Tb5WwYhDrDOVsNOpJfhasaD4/oRNLh2EiHYSS0ftYQgMApVn/V87Y8frJNiByaEnF9cxHsSNW7P0ug== Received: from TYZPR01MB5556.apcprd01.prod.exchangelabs.com (2603:1096:400:363::9) by OSQPR01MB6119.apcprd01.prod.exchangelabs.com (2603:1096:604:27b::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.30; Sun, 21 Jan 2024 12:43:36 +0000 Received: from TYZPR01MB5556.apcprd01.prod.exchangelabs.com ([fe80::bcb7:50f4:7a16:4ec0]) by TYZPR01MB5556.apcprd01.prod.exchangelabs.com ([fe80::bcb7:50f4:7a16:4ec0%7]) with mapi id 15.20.7181.019; Sun, 21 Jan 2024 12:43:36 +0000 From: Ziyang Huang To: mcoquelin.stm32@gmail.com Cc: alexandre.torgue@foss.st.com, richardcochran@gmail.com, p.zabel@pengutronix.de, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org, linux-mediatek@lists.infradead.org, Ziyang Huang Subject: [PATCH 6/8] net: mdio: ipq4019: support reset control Date: Sun, 21 Jan 2024 20:42:35 +0800 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [6eQm7VelkNsE2KT1NBJq/W242KG1dVYWwqvIXC+ZwKZnQo77a+eDuw==] X-ClientProxiedBy: PH8PR21CA0009.namprd21.prod.outlook.com (2603:10b6:510:2ce::26) To TYZPR01MB5556.apcprd01.prod.exchangelabs.com (2603:1096:400:363::9) X-Microsoft-Original-Message-ID: <20240121124237.3328702-6-hzyitc@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYZPR01MB5556:EE_|OSQPR01MB6119:EE_ X-MS-Office365-Filtering-Correlation-Id: 9af9ed1d-9519-4440-ef77-08dc1a7e95e6 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: g1lKhGeYf37neibm5/CFAXSAjsas+WKF3Vih7Ut6qxMjpdliQwGdju2leiNvl1BY5J3HXydxAHfBIsv+Nqifxh5YOboh4S2lN3XGyJ4XbIWrGOHrd9gXSgP4d7XSe8UFiZhchyuScbVfN8IUsy/2PJ2K+0eTM04XZHZ1IqADgRlQ5ts9/uCkoWoq3xQNk++MH0Qtp3IwHibCJxyrNdC71Mh54jGzRpSLjAcMUICGdDTg8bKQ/Daz9nFl68RI2cwwZOIy0sH1TEdCh/tzi7WQoKsIbh/6++FG7CEtdym8vDQPD2qKugsGsIXIG95t97YuG4L1j5uMJ+CLTGhZRi0FF1/J9ZtYGEyIXqCcj3xKxUZTTZQgssK/NuYEjeg3vJwoe5tQdGIUDbSfccMonjJTexmLT3G4c+Bp7R25XGun/BbFAiC++3TtqQ6VfLznLf8x69rdrFzz/Fh5RuWp3GIiQuJDN/12CYSvMrHVK1UcSh8xoRTE7Z3iXSFj6aIh42X+miK76cW7bP0RQAdEH7K34og8c6PNp4XRrEJSDRx/mLck4IGue2dsPT1Wex67NgPkmyvcdLH9l0DrB55P3VloiMGjep40Z4nONI688GhVmd0mimPB9al4jDG504VqME/S X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: RJHehYWzhK/vGFTqjyK+gW51WGFcaRqSxdFWnLzK7okowacFhIfslGcv+xf/UYf7rqSlPO2MntZ1uvQP22vZ3YHQdk0ezrQVlzkLVL3870++D1en5sREZlDxZ+qGqVnLydMDU6eeIayVxpXQCvZIZAgHbks15DZbnThXZS2H/GV1u6XSVm8WB47w+tfHpdlsOCP6aWvg2mOhpz5AgbprTjpnvGuzpWHmWD126Ed0W3xD3NcApTzFzsT8y9bY8ysmlcXotaqD9hcIac+mUJISmlzD32MWaU+tSG3lXBcYuG7SrmGxuHONqtz2bRHCXcbNBxOZljpQIlx8FNGFmcetLZrTdVSJnGjwLpocZzK4xlYB878DEgvgKHEcSYU7sUpy25keuADomz+XEYOJwLZ7fqwKPuJ7hfO5yvOoW1qX0f54UIUIGXe2WBM02bR0ZSCIij4k/+hKlzpGPdihXmvXMOm/7XjUUkixF5ziphz3Dq77xV9aWePW+GOqP28xgIMYy5RBYhP2N6M0ugalyYjyJJlGXdAgwLhAsovfyjr04kbElNcztdt82v1VmiS+0WC9oDrR5Q0QnFZAiJtpigwNfSGjr8DgfZKb0ohWAOMOVLjWzAPuRG6KwoZIaWOA8BniPPVCRb4h5fvU4hMKC3BhlUVBZUpct6wKoLJlnAR5TXc5BFpNsBmHAtZbaEy93LjpIYNmmKikcpX52tjrDED5WApnsRpazbiljyHSIVi80sVJyqwwN/sEgGOkyefyKEfuBtKh/K2nwW8WBi96HMi1/nEStMC+/RSVw+r+Pf3BLazrdu2wkwo5aftwFKsh7SClcpb//2ecgX+XxXU+gqgaUds3QlB8qcssLvWf5EW7bAm//X1DMsM59VmUAYaM8bOXyvBlGhOnQbEuXtLI03EbskVgUWD/ZygU2UKKC5o+Oyq0CXvAsAb5JuEQYDACpwsY/nlsUkFHB2iLEyiW7V9LqsT66+xuiLPkoF56vzU3hvaM5EGtPgfo4JnE9EcQTXqq0K13eAnX6LoDWIJajen6/6LHJeLEPIt4A9Qf+up+ww/RMCShDevrDPC/jAtabuqipnakM/gkHG8lfJGzVKAs5eigg50oQb3/nkry6QXk7H0XwuLsXEGNHPcIQtrPwVwQTD7dnBYHZo7XvyW4Z7b2530n4CUN29494GuOuyjFsUwX18DOtZHV/26Skb/7s7ndUPS1Soa3CDy/G0oQkwMMJ/7lo1NM0W70BinioOngUdc2TB74xnGyRoZrItckuxeE X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9af9ed1d-9519-4440-ef77-08dc1a7e95e6 X-MS-Exchange-CrossTenant-AuthSource: TYZPR01MB5556.apcprd01.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jan 2024 12:43:36.6943 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: OSQPR01MB6119 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240121_044343_910415_CD51ECD4 X-CRM114-Status: GOOD ( 11.06 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Signed-off-by: Ziyang Huang --- drivers/net/mdio/mdio-ipq4019.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/net/mdio/mdio-ipq4019.c b/drivers/net/mdio/mdio-ipq4019.c index 78b93de636f5..b52c5e1fb99b 100644 --- a/drivers/net/mdio/mdio-ipq4019.c +++ b/drivers/net/mdio/mdio-ipq4019.c @@ -12,6 +12,7 @@ #include #include #include +#include #define MDIO_MODE_REG 0x40 #define MDIO_ADDR_REG 0x44 @@ -40,6 +41,7 @@ struct ipq4019_mdio_data { void __iomem *membase; void __iomem *eth_ldo_rdy; + struct reset_control *rst; struct clk *mdio_clk; }; @@ -219,6 +221,10 @@ static int ipq_mdio_reset(struct mii_bus *bus) fsleep(IPQ_PHY_SET_DELAY_US); } + ret = reset_control_reset(priv->rst); + if (ret) + return ret; + /* Configure MDIO clock source frequency if clock is specified in the device tree */ ret = clk_set_rate(priv->mdio_clk, IPQ_MDIO_CLK_RATE); if (ret) @@ -248,6 +254,10 @@ static int ipq4019_mdio_probe(struct platform_device *pdev) if (IS_ERR(priv->membase)) return PTR_ERR(priv->membase); + priv->rst = devm_reset_control_array_get_optional_exclusive(&pdev->dev); + if (IS_ERR(priv->rst)) + return PTR_ERR(priv->rst); + priv->mdio_clk = devm_clk_get_optional(&pdev->dev, "gcc_mdio_ahb_clk"); if (IS_ERR(priv->mdio_clk)) return PTR_ERR(priv->mdio_clk); From patchwork Sun Jan 21 12:42:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ziyang Huang X-Patchwork-Id: 13524577 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 4BC1CC47DAF for ; Sun, 21 Jan 2024 12:44:19 +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:References:In-Reply-To: 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: List-Owner; bh=Fcao/8jxLgusSeRjKN4Z93IziN/VCc+99tGJgOrScIk=; b=DSKs7t1He/RH06 QzPL4brTvwbrAmSPBgG3LM7ZTFyjeEhX6DlbK9yV7i8lDlE1EgqnrHRIenxbaGB2RI0dR8nGGsJEy 1HCIv7eGpvU/5ZOwEcoFOdSJ6g8TZrcj7ThLBOe5CnjKWnaXLRZLAyGLyXJBnyUiAi8Ol6vg1fDKp zbLDCA83iMYI1GmjveNR0HoIz+7yxV/WkIkMa979zNk6MCrRvneldkG/2v0n5+iVpCblKKBB/AQGl A4nJj/SlmmDJuIGRCXoMTfWI8hyaggx0PeQpQlpErp9DnEC8CfnwKTvNqqWUoPzVwYHGkTAZCRPYY aaEDSOrkob4wo0YvnpGA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rRXB4-009X0t-1H; Sun, 21 Jan 2024 12:43:54 +0000 Received: from mail-tyzapc01olkn20800.outbound.protection.outlook.com ([2a01:111:f403:280c::800] helo=APC01-TYZ-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rRXAx-009WqY-2y; Sun, 21 Jan 2024 12:43:50 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dTQxLiGFDNU5e6P0Iu7phS4SVZGeUN1hga6TjfG8Vhv9/yHPaAfNMFsGQYQB2QjQqpjQDskTJVFXCdxVzB/tJT157uruIftJ1eSvXpI68z5U0pmC3SBnoMoh8Fn1BpxIZbVZSHXRktIvKt9Boya/8K566BU+371skh1xMw9HWlNtu/hY+UXWvOXeCaeIvuJYkyA+hTcGWOtj1onO+Pf3D4FFlRYX4uEzZmiT5wLCR2VkOagWITaI9NA1DbW3XiUvYAFd/fdDIIxK70zSBnpUo0ImFBK3CWWOXLMwIYAGsHlgqxU2zphNcZWj5J/Rq03L/tf3kNGbZhoSM8eaiwGcEw== 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=HtCpQ2wOQyssAl/xdemcEv2tYHR8pnJwrmmCj4EIIvo=; b=lQHeLRZW4mX7uOgghO93n0N7jyvsZJKzgFft6kGZPYCNSOn5UpVOCTvCNt6czgPFi+52tn70UtZyv3m4Zd+PkB7GkxWKrh09vITlFNT9/kvPprWpqffFvHu8HvY+x7WnBLcluOatSNqU8uI1PxzxO2s6zXTtTB9zi4bdBniEkYY7S6t24b696YbDcr0tORYBJnu4L5ZU0RrUhGjQOYgy+3MYg3vMBrsM1tdYOCJOaJbgqXu+QWL5Nb/VYDfy2ml9P0R7SuRrORDRHr/ouwl+CjhBKXAS3nd7Bmt+cs+WG0El1vbbXH6UGwke+RwVGWuuFFmB/55P1hmT+wI5cUdsIQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HtCpQ2wOQyssAl/xdemcEv2tYHR8pnJwrmmCj4EIIvo=; b=RRN+kwsvQRbW0VLpcOdA4jL5QnocNrWjaXekYgHuCriYMiELpxrf06kcn8fEoQNYfH8lYFOj2QaSy2t8P9Bld+0P/iHOpwLw/wSeHstg8V2xTrKTAypeiiNxwLCYfUIL9fWu5pBlAso464SvY+3nvyggKyFi3FulHMlDi/i+DqNQTQmSJazq+mdV/UeY+bM9vqS5S+t2GBBSOBAAtv12Jq+KScKUuIdyTrkBSm2RXV5g+k13nzAjy+Pg+Wc7axTvDL+GIi5JV1w+ZKmE5yPTuEzEP3nl4BkjEGS4VN0/L1k8MBgZAcTbIJVYUw87Kxlobz3A5GJ6UWvhW3i7LopZLg== Received: from TYZPR01MB5556.apcprd01.prod.exchangelabs.com (2603:1096:400:363::9) by OSQPR01MB6119.apcprd01.prod.exchangelabs.com (2603:1096:604:27b::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.30; Sun, 21 Jan 2024 12:43:43 +0000 Received: from TYZPR01MB5556.apcprd01.prod.exchangelabs.com ([fe80::bcb7:50f4:7a16:4ec0]) by TYZPR01MB5556.apcprd01.prod.exchangelabs.com ([fe80::bcb7:50f4:7a16:4ec0%7]) with mapi id 15.20.7181.019; Sun, 21 Jan 2024 12:43:43 +0000 From: Ziyang Huang To: mcoquelin.stm32@gmail.com Cc: alexandre.torgue@foss.st.com, richardcochran@gmail.com, p.zabel@pengutronix.de, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org, linux-mediatek@lists.infradead.org, Ziyang Huang Subject: [PATCH 7/8] arm64: dts: qcom: ipq5018: enable ethernet support Date: Sun, 21 Jan 2024 20:42:36 +0800 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [j/rJpshu8XuHjzADFwqZnDgqFi3SMIZtImm5+DszXLha21n1C+HflQ==] X-ClientProxiedBy: PH8PR21CA0009.namprd21.prod.outlook.com (2603:10b6:510:2ce::26) To TYZPR01MB5556.apcprd01.prod.exchangelabs.com (2603:1096:400:363::9) X-Microsoft-Original-Message-ID: <20240121124237.3328702-7-hzyitc@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYZPR01MB5556:EE_|OSQPR01MB6119:EE_ X-MS-Office365-Filtering-Correlation-Id: d6b8f15b-1670-40af-73f4-08dc1a7e9a15 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lVfkN+fTFs00yzvi4gQMFmFOXCew8Rq0GmOk/zsnXxnsujJdQ1Scu2wlAI56AZx79Jy1VQjG92Dz5FPoqEodx+3+REAnMojJk8FbjSeiNNz+1Zdc1qICGxyfdHdQBjJMH73q6HfLrPVfuOF8KQ7VaReUhCsytOa74C5nJReMUkRApcp/IKWMpp0tpHD6PdYlIg67s1BepICu593xw8Q4ACct4OvsQL0YsxOBtjITJ/MdEFxROopt5nQHyBl+Dd0lwowwDLmShcdp2LfqLXGpJo2/sDw/xmtoEHq0Q1uqFsDU1CFFoio3bM8xEqcZNye43iq6EPiQO+39p0z53ewlrDDuFMFP1dOVn+PSI62/pV3wIJgNlSd6meq1cish5Db7fKgTGgq8Dco6eIvqjR1nommv9BqR/nmlMJLp3sAAhcsHHyhI48r9KqoZ4OxHaYEGJIhiRhVJ77t0xGm2yzzJU95Bs3d+WcNjiR101exC++ecIjFgReWeV5H9SXmzfq4L9qMTyXV6wZPMAa1Cd0Fm5kkRlH53zbmNIikdGl7FUWvurd/xwVjxov/AgWebno6HfaChG8ly2jFcjK3UZsN69RthPGTO/QTBT5YBRNtPgqGTv4D8lOhgJbrU9eRzBOxx X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Q5A08U9v8pxHEHr7jd69B/d3r64/IRCe2ZXtKoQbqABJj2LryhNFwRZZCXAIsBNhghZ8ElUU2wGbIf2VfS9EeV0JQlGR+dNVSJCaQxwPSAA2i6KU+t8pgtHCrKL69jcs7J2wiWHDUlRuazWreIrUJaSuWlnLbQhQ2vqjx5QXOPrODM6WfsNOCWktq7zMwUjiL6LZENE1MuhY0X/da+NMmp/KKV3sh3lhySOXCTlmavW21RPZWSAtpMgJhIhRIwDlncmp9FMeT4pMGVpAJ2hs+nrUw20H9FUJ7O1DPVjoMAzGZevM1RGD9r6Cph11WqLY5P0Uxo2Ro2Cfbuq5EFhRHhx3ZJ065bBR39azbzfZn24k1od7UqOe7+uFGrLq76djR4ltcDc+Ao6/jEW0jlx5kAZzTyMBewnl9eTSi/3Il/jXSi21RaA9NcoAl1IupcBrSNw+iOwulS2CZ/K2r03BlP5zUowVDd/V288YAKihvYaC0RRDtBxaq7l1PC6j2ysZlBqZWYhwLJrHyWMbAQvCY/MJ3UUaohqhPNKSGtkVrgTpdYqAQBSsZdV4B6OEruzl8RSK/IsVQd/xuecAtcQQtBmj1IwgrAr1gk5Z+zTWwN4MIWAPepWNHhtArUWeEwK+pSx4mFOVlJozzkDhYolmiq1kPbhlY+QuRr/ZRNuuec/CrbpUVRyLu9md05Gr+v4UduiWn0hA1g3lkGvYAhbRJrmKCVVYZS/p+U+2nxDBxyfef8X5ZCvfYnI+TorAJrBC8nIwtSGcGnflmELfnsYhuZgBmW2f2JWno7Flse98perUJB4llv4zH6ToU94cdmi3Y7gm+vcQun6QtKVyF/Cgx8L+5YkqklmWF2qFrf9MzjQaq3dt6je+VDyG+QukbWW+DK01h0vLaA5/CwPCHkRpOupzRQF9P4c1y6O4hBW6Ym/CeE40lONTD8adfZKPBN2JkxbCQjqY/aDiLqmNLymSvSJluUDjfXWE/n1eqL9nMjgUB0dTgCgwnadahlWWHcYcxyX8jN0+7HX0Nq2fbW05naRfFXUFbPooh9rjiNGaDwYE74C+vOQu3rFQDJZ/jWBKzc2OFZhYV9oEsNYiz29fGXHbBlktIiXNKYJDypsCQg0xrt7RH+g9Ze5QhBqOgvMS9286aDPe3ypPjNKpqydM1vR2y7euSEWzrKd1yPLXrI8vqIsMj8p05ZS9gRDQvjFufXmqf9hNvPi8cOVznvN32HCB+OPlodmnbIPFgz9yvoyW1pdB2VGey8M20HDDFcP8 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d6b8f15b-1670-40af-73f4-08dc1a7e9a15 X-MS-Exchange-CrossTenant-AuthSource: TYZPR01MB5556.apcprd01.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jan 2024 12:43:43.6975 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: OSQPR01MB6119 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240121_044348_263918_D34DBD60 X-CRM114-Status: UNSURE ( 8.28 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Signed-off-by: Ziyang Huang --- arch/arm64/boot/dts/qcom/ipq5018.dtsi | 120 +++++++++++++++++++++++++- 1 file changed, 116 insertions(+), 4 deletions(-) diff --git a/arch/arm64/boot/dts/qcom/ipq5018.dtsi b/arch/arm64/boot/dts/qcom/ipq5018.dtsi index e502a3ecf4b7..b36e5c2136b7 100644 --- a/arch/arm64/boot/dts/qcom/ipq5018.dtsi +++ b/arch/arm64/boot/dts/qcom/ipq5018.dtsi @@ -94,6 +94,63 @@ soc: soc@0 { #size-cells = <1>; ranges = <0 0 0 0xffffffff>; + mdio0: mdio@88000 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "qcom,ipq5018-mdio", "qcom,qca-mdio"; + reg = <0x88000 0x64>; + resets = <&gcc GCC_GEPHY_MDC_SW_ARES>, + <&gcc GCC_GEPHY_DSP_HW_ARES>; + clocks = <&gcc GCC_MDIO0_AHB_CLK>; + clock-names = "gcc_mdio_ahb_clk"; + status = "disabled"; + + gephy: ethernet-phy@7 { + #clock-cells = <1>; + reg = <7>; + resets = <&gcc GCC_GEPHY_BCR>, + <&gcc GCC_GEPHY_RX_ARES>, + <&gcc GCC_GEPHY_TX_ARES>; + clocks = <&gcc GCC_GEPHY_RX_CLK>, + <&gcc GCC_GEPHY_TX_CLK>; + }; + }; + + mdio1: mdio@90000 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "qcom,ipq5018-mdio"; + reg = <0x90000 0x64>; + clocks = <&gcc GCC_MDIO1_AHB_CLK>; + clock-names = "gcc_mdio_ahb_clk"; + status = "disabled"; + }; + + uniphy0: eth-uniphy@98000 { + compatible = "qcom,ipq5018-eth-uniphy"; + #clock-cells = <1>; + #phy-cells = <0>; + reg = <0x98000 0x800>, + <0x9b000 0x800>, + <0x19475c4 0x4>; + reg-names = "uniphy", + "cmn", + "tcsr"; + clocks = <&gcc GCC_CMN_BLK_AHB_CLK>, + <&gcc GCC_CMN_BLK_SYS_CLK>, + <&gcc GCC_UNIPHY_AHB_CLK>, + <&gcc GCC_UNIPHY_SYS_CLK>, + <&gcc GCC_UNIPHY_RX_CLK>, + <&gcc GCC_UNIPHY_TX_CLK>; + resets = <&gcc GCC_UNIPHY_BCR>, + <&gcc GCC_UNIPHY_AHB_ARES>, + <&gcc GCC_UNIPHY_SYS_ARES>, + <&gcc GCC_UNIPHY_RX_ARES>, + <&gcc GCC_UNIPHY_TX_ARES>; + + status = "disabled"; + }; + tlmm: pinctrl@1000000 { compatible = "qcom,ipq5018-tlmm"; reg = <0x01000000 0x300000>; @@ -120,10 +177,10 @@ gcc: clock-controller@1800000 { <0>, <0>, <0>, - <0>, - <0>, - <0>, - <0>; + <&gephy 0>, + <&gephy 1>, + <&uniphy0 0>, + <&uniphy0 1>; #clock-cells = <1>; #reset-cells = <1>; #power-domain-cells = <1>; @@ -244,6 +301,61 @@ frame@b128000 { status = "disabled"; }; }; + + gmac0: ethernet@39c00000 { + compatible = "qcom,ipq50xx-gmac", "snps,dwmac"; + reg = <0x39C00000 0x10000>; + clocks = <&gcc GCC_GMAC0_SYS_CLK>, + <&gcc GCC_GMAC0_CFG_CLK>, + <&gcc GCC_SNOC_GMAC0_AHB_CLK>, + <&gcc GCC_SNOC_GMAC0_AXI_CLK>, + <&gcc GCC_GMAC0_RX_CLK>, + <&gcc GCC_GMAC0_TX_CLK>, + <&gcc GCC_GMAC0_PTP_CLK>; + clock-names = "sys", + "cfg", + "ahb", + "axi", + "rx", + "tx", + "ptp"; + resets = <&gcc GCC_GMAC0_BCR>; + interrupts = ; + interrupt-names = "macirq"; + + phy-handle = <&gephy>; + phy-mode = "sgmii"; + + status = "disabled"; + }; + + gmac1: ethernet@39d00000 { + compatible = "qcom,ipq50xx-gmac", "snps,dwmac"; + reg = <0x39D00000 0x10000>; + reg-names = "stmmaceth"; + clocks = <&gcc GCC_GMAC1_SYS_CLK>, + <&gcc GCC_GMAC1_CFG_CLK>, + <&gcc GCC_SNOC_GMAC1_AHB_CLK>, + <&gcc GCC_SNOC_GMAC1_AXI_CLK>, + <&gcc GCC_GMAC1_RX_CLK>, + <&gcc GCC_GMAC1_TX_CLK>, + <&gcc GCC_GMAC1_PTP_CLK>; + clock-names = "sys", + "cfg", + "ahb", + "axi", + "rx", + "tx", + "ptp"; + resets = <&gcc GCC_GMAC1_BCR>; + interrupts = ; + interrupt-names = "macirq"; + + phys = <&uniphy0>; + phy-names = "uniphy"; + + status = "disabled"; + }; }; timer { From patchwork Sun Jan 21 12:42:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ziyang Huang X-Patchwork-Id: 13524578 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 E84B6C47DAF for ; Sun, 21 Jan 2024 12:44:25 +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:References:In-Reply-To: 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: List-Owner; bh=jVU+I0UN36eAGg2JuzeZoGjBRqokpNg6DpOUM1uV790=; b=TGw+gfFhFxCLPW 20u+JTn71V02KUAF49qJbPB5JN6ZZiZGjyAV2CCKRwK0LtPUNWViqT4fdIHSjHEChkkuD/8Wx/0bp 9ntond0a6tXirXC+A97AaeI3k+kPjUiOyKXn11crjex3iY3QZ8ywmy3J/jVU7FBh7pTnjlMrFE5vG WRt8Bf0Bqo5haSeiDbspjLvYRYhfz43a0k5I3owB+S7PPnwtgC8JKlwwIk5ntBW8jiP6Le8v92TS/ l4d4ZR9+ElPxdzKWIak2g8BpXEmgWJxo8AtxBHmN4/j2HN3oFHovsT8n/3zesi+vbLp3+8Xy/VPT9 xmdb5JLhh+3SA0TGVbMA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rRXBE-009X7W-0Z; Sun, 21 Jan 2024 12:44:04 +0000 Received: from mail-tyzapc01olkn20800.outbound.protection.outlook.com ([2a01:111:f403:280c::800] helo=APC01-TYZ-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rRXB5-009X0u-2r; Sun, 21 Jan 2024 12:43:57 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=C2/oBJ3Me3CwmzfXNQ+VQBfYXBWHggBcbF+79VgoqRHmFU1jE30bX/xJ0DZEVwUew6eW14u1mzVznkLunhP2Is6iBCCKsG9GXkhHdWgKgYXRcSCGOAiN8fAgYshO9kM7hemWKwNJTN5olvQcLj61icN7S2QIZu0nWNSQrM6wZxVZR/d+EJ5xHgNNh0eWN7HmGG0T7lQ84c3+yktyeMhfrOa/HzaonU7HXzfdVtXIgh8lnkv12O6/e7cU5nJ4Ztamameaap2SyUyxBKfq6KdetCb7urxIlzPm3P23S6wA8xO3CgyDv8Qi+x/arAR4mf4dGR9qjw+B1mVQxF1d31FZoA== 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=1CPMIzkdmf50QazUC/wEjqlzQtV064B5Hgfgo7BjzRE=; b=obIZjz+m3nPY2iAM9M1S08rlqXalt8AH8A1uu5vYNLF3U6pKB2ydLpE21XqaK41Cxr79zV6iOnQBzn2zci0CHmoe9o42mubQ7v56VlwpnYxioUzoPQtHI9cNNvrqFb6fx49IikKdQAJY2Guz+uqWpCC8iK6EbId79zVry/v8YUWxpBL+znxnJjE6Gg7F+ZufZyiiI4dn6MBxGrlvDtYNbniWtFKdwWxbXrTMsusZ804ThqEeHP2KzlURWJu+xBxJFW4CrEbf7jUIPbpxVkZ9egY+xOJdzIo/8M7AOfP2R0qYvYUPyGGaEbdIMgfq2SQVJbX4m2xkk6A54r3y65SPnw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1CPMIzkdmf50QazUC/wEjqlzQtV064B5Hgfgo7BjzRE=; b=Dp9QC2hpQNy+7YcGbLx9UHSAlgL1TxZF0yff6u5gO3A8mMnf+QpfYh2qlV8hDpNdz4M5lD+0KBiEQRvNYufqkEo62yMQcx5Fyp+EprwvzDSFJ561Box5tDDze8IECS6DX9Vh4+iH+Su4uSha/YA4mJKZkNK7PVWdKo6YzSa5+UvrPxktfkzArAwqGOZqQ4WwaMno3qViAUMRvux++0zm5vUS+IM1ZSoccMZTi32DaF+kpQnHpHII0tY4iDZlamrDky+7uxvnYNK2YuDnZUv171ZHBVCmeO5aLuOAUv9bCy0FQJsTGctl57WO/fFLW4ZOGALjT6DkaHl3XXhMf4eBIw== Received: from TYZPR01MB5556.apcprd01.prod.exchangelabs.com (2603:1096:400:363::9) by OSQPR01MB6119.apcprd01.prod.exchangelabs.com (2603:1096:604:27b::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.30; Sun, 21 Jan 2024 12:43:49 +0000 Received: from TYZPR01MB5556.apcprd01.prod.exchangelabs.com ([fe80::bcb7:50f4:7a16:4ec0]) by TYZPR01MB5556.apcprd01.prod.exchangelabs.com ([fe80::bcb7:50f4:7a16:4ec0%7]) with mapi id 15.20.7181.019; Sun, 21 Jan 2024 12:43:49 +0000 From: Ziyang Huang To: mcoquelin.stm32@gmail.com Cc: alexandre.torgue@foss.st.com, richardcochran@gmail.com, p.zabel@pengutronix.de, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org, linux-mediatek@lists.infradead.org, Ziyang Huang Subject: [PATCH 8/8] arm64: dts: qcom: ipq5018-rdp432-c2: enable ethernet support Date: Sun, 21 Jan 2024 20:42:37 +0800 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [2qElDWZdksYkyOHEY7OFc81AJPO6++sP9sL6QwoTbGpWTEt6sYOgLg==] X-ClientProxiedBy: PH8PR21CA0009.namprd21.prod.outlook.com (2603:10b6:510:2ce::26) To TYZPR01MB5556.apcprd01.prod.exchangelabs.com (2603:1096:400:363::9) X-Microsoft-Original-Message-ID: <20240121124237.3328702-8-hzyitc@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYZPR01MB5556:EE_|OSQPR01MB6119:EE_ X-MS-Office365-Filtering-Correlation-Id: 5de4b3fd-4367-43b9-74b8-08dc1a7e9d42 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 89AleL4TQzsaGy5w+smUi1gHMQ1XHYqcKyQQOF6xsdRI4npKm9i0WOVw2Rrunl0uGmPaKQPxIfUP28rua2ZPQRkd6hcp79p716QP/VtOO62gnivd8wwpEAPQ7jzuTC9Jz9Yjg14FzetKRpWpfo4nU8sptIzgkc53INmprTeQcOw+mBTZjjf0yF5l83RTGzVD+A8tLLcSA1K/vvD0IwYLcpJsL4aGsArBj/dUPMQNfNq4pp8DqQ+6keU3f9Nlt95Qfl0MmbdOKMX4UBBgpUE7j8OP5/UK0UtjN6X2vkIsXQp1BGcBLxhirDCX4IyNAfq9+jqVyrDis41yj0NkOH9W6mP/vm8KDdRIqC1yXJHy55ZbGzur0PvBb42hOZm/nKM63or7OTPUpdQELLhOtyL7oAIA4nyHg974EpTaJ1XlFYy4j9ngvqYF0oeKf/UAPAjd2SzrtLojAeyBp1VMobdlBs4KQ6dzA3j1fLbuzo/DxGgH3rsc12IjITWaOZwbu9mUrlRpMK/8CJrXNWg9WGNmKRIj7xTbEuCRLMSKIXA53Zy7TB5rLJLgB8POYRLMDuNYAxsHWC7qB560DN0zCZjme4XEDvwkjMRrkJyPacSKFPzHGuIqKvCQdrQHnx7hZ4r0 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: qBErEdBP8zmN2Hp9yXcLqMGfLEolfkJlkEUDDzL7UNxzYWLD8mNxwbVnULav2xW6oc7Fj7xPnpJu7Q4yFjONwpVjGHkpo/EKf39AV17G1H+MU6494lKG8JM5sTVCeQ+o/q3vim3WT4wAk6YE/QWGDh9fCRzvfo3dDxVcKx31X4ZPaH8Uc2nSW7ydiT17Dedn7FzhAVfFSrYs+HnmE8JfIXlRi8E8PYsKLoSDbJBXlsLVDNKRQwQo5QfXNiqxZw7xhBtES9DbFO9d14HM+QuVwgL2g2UEtjdMz+5wOE1njOnI8XssP8aRopJgbGOq+bsiZe2K7CdxpU4m7do6TravzrLT8g9f5YnyKkCRJUH+FlCcQSQWS/mV4W4R+5ng+0ReJDW0x1X/ooVuXOe7oEwbvGPmtNh8dG8vn6flCd7CHpy8CChGigH0DLpsIyp6C1lZTk9239kRT/nGAhmfTamtDilYtbLM5MyNE4/C9WTW18y3lDjLlZkwSmuTaGVoKAbC6x0H9d2zKPawmrveTA/tK6h/sV/iQ1Pc64jhEQUPr0GRTAybKweYXsy1iJTWjo1RPnu3HfXuEzU1xn6aJ4e6HH0HWepI3lRoKsKWdcmmSayn07tamIe563VPjMMS1yYh8UUP55WGFn1dI7eizKBgRlxtkxoL/GevzCOpiRKk6DQmiVZIrkfN1jT+cx0LvNFJIhmkI8kK4kr24mZdnY+XjlvZ2BenGHAELMqtwT2W+oMexFQ/g3ZmhU/ah1zvFH2/e7WeLbOOgGjmuo19PkyrseQ1Q2H3m8N0ROHQ/bCL1Q9zfD9fkkr7ezsus0VV2sGIVRQduwiHfRfxYOIoQHyik14xrptLnNEpwIXaGv35Gd04piQxVw5goac5Yv8FSyegV7/4cqbwAaAlB8uW6z1LNN6LWLUL1OKfg9eYxgyoYrgYIySM2tj2Bcz4vZESr0GfofJ9km1fG3be401d2uplU09mYLmpMecsaMGlxOPE2U3vIPgPrrqx9Mg3nrXyDeF2uKywW7et/zkOTHVwDGptNqOkLczedCWkpqM6DAonCjUTnUq5NhHRIg3yOZ5r/1FL/ADeUkC4DYIstIdS4Ft7B37DpZs9swJ/jzgXjCfvSEmYwDswbFVH4g22rqDtV0mOwp4xhvdQRky1iKWNI6a0ta9zXRdjSbFC3hgNJ98H5N+8Ug017y9I5BpPlqyEpA18Zr2tZH/tkqwJjJRDHs9sKX6q0/C4faIr5xfOHKhfab1wSdWMYAYs18msDN9XtJLN X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5de4b3fd-4367-43b9-74b8-08dc1a7e9d42 X-MS-Exchange-CrossTenant-AuthSource: TYZPR01MB5556.apcprd01.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jan 2024 12:43:49.0312 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: OSQPR01MB6119 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240121_044355_938394_4653FB15 X-CRM114-Status: UNSURE ( 7.82 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Signed-off-by: Ziyang Huang --- .../arm64/boot/dts/qcom/ipq5018-rdp432-c2.dts | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/ipq5018-rdp432-c2.dts b/arch/arm64/boot/dts/qcom/ipq5018-rdp432-c2.dts index e636a1cb9b77..074b78d7939c 100644 --- a/arch/arm64/boot/dts/qcom/ipq5018-rdp432-c2.dts +++ b/arch/arm64/boot/dts/qcom/ipq5018-rdp432-c2.dts @@ -15,6 +15,9 @@ / { aliases { serial0 = &blsp1_uart1; + + ethernet0 = &gmac0; + ethernet1 = &gmac1; }; chosen { @@ -43,6 +46,22 @@ &sleep_clk { }; &tlmm { + mdio1_pins: mdio1_pins { + mdc { + pins = "gpio36"; + function = "mdc"; + drive-strength = <8>; + bias-pull-up; + }; + + mdio { + pins = "gpio37"; + function = "mdio"; + drive-strength = <8>; + bias-pull-up; + }; + }; + sdc_default_state: sdc-default-state { clk-pins { pins = "gpio9"; @@ -70,3 +89,36 @@ data-pins { &xo_board_clk { clock-frequency = <24000000>; }; + +&mdio0 { + status = "ok"; +}; + +&mdio1 { + pinctrl-0 = <&mdio1_pins>; + pinctrl-names = "default"; + status = "ok"; + + reset-gpios = <&tlmm 39 GPIO_ACTIVE_LOW>; + + qca8081: ethernet-phy@28 { + reg = <28>; + }; +}; + +&uniphy0 { + mode = ; + clkout-frequency = ; + clkout-drive-strength = ; + status = "ok"; +}; + +&gmac0 { + status = "ok"; +}; + +&gmac1 { + phy-handle = <&qca8081>; + phy-mode = "sgmii"; + status = "ok"; +};