From patchwork Wed Jan 10 13:31:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sia Jee Heng X-Patchwork-Id: 13516155 X-Patchwork-Delegate: mail@conchuod.ie 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 BE877C47422 for ; Wed, 10 Jan 2024 13:32:26 +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=xzAzh7Ib4HxEQq48o+GYazegw6qfqCyVQi/9LcMAo1Q=; b=uAMRgBagOOoESQ 9ZAxDJ+3Wc15WC/hgj1k2G68TSCYoxrzQrMNyG0z/ezmryvsn9YQeAnrpz8VTTjWkm/OhN26R0Crq Y0pf9SmkRbNUSyyTcEwFzSqlZYUDOHs60f8wxFwpAGGA9Ze4T+JcUy31iHZipuK2nV95soxjsBuTq SC29oENVMYmyyxBaQ6vQlELQQTo0/7NLG4jotFzE3WO3Q34UOwuV9SOFhLJH1Wv5e1CYVfKGpqc8V 2mJfkIJGCCPhmf/LzTl6oa/ofNB5JnAS/ffwX4A+miY1GcJJtGaK21G5m0hzWqxS3oJOB2v70Qk/v xCvcC2C5CEX9HwPaW7VQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rNYgs-00Bz1y-0I; Wed, 10 Jan 2024 13:32:18 +0000 Received: from mail-sh0chn02on20625.outbound.protection.partner.outlook.cn ([2406:e500:4420:2::625] helo=CHN02-SH0-obe.outbound.protection.partner.outlook.cn) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rNYgn-00Bywc-0y for linux-riscv@lists.infradead.org; Wed, 10 Jan 2024 13:32:15 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WCxl7NYo8C+K0tSb2jg/sZU3sg7OEex6Gh7U0cLso4XIlbKJnFINHgInugANXjLHeYBTcDMwnbWQl8yx00y9AK1+RBqTREG4WxwCWpm8E1PnI0BQII4WXsKqoikpeh0As5I9GbLU4gOA3GVxf3XxrW0UtAmUJxYYUHlQ6bLpqXudBQtyBrOKB5IIqxq8kT9N7DUMtdO22UG8UEr/D52P8qM7IRBn93qvkppCUUemsQKI6uRQNkeSmfRBRM0+MgCdMnMZ0I4L7m04eleKuoZC9FRORWznI1R5WlsNsO6aipUMFS9Nxr+UiAZvJra7lEevg+v6Jh0rPeeBimadEjoukQ== 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=bnUzbTB4OPn5JdcT7n9MVAEUnb18HGCBPr/Ne+F0Qrs=; b=SzoHVbGzWod5GYoItUNPrd7eYcnbjl8XpsjjuRGKDoFotpyqQTY78rAQPI7F31vJyPp9FeRrg0QLWAkOfHFY9z5jddDOVoAhP9IjPYkc7fY3ZhujmY9jLYhmBmK0trZ5d5oMW/2fdgwtZGJbXocPnSmeGp1+6vYS9PuJ+uScwgJcjvU/t07xOqR7kszzOaEieazHWL2z2CKNVikZSLnxQY/FAwVB1WBD0/tVPj5AHbwzL9QygDV79tHnoHn+EbxZ3/0rMuJI3iXzc4nngkSfB59txOU0IYwZ17dR5So1qOHFCsoYjjsdcYMRYnvvq3SouIE1rPj1OS5HdZ21GFgmdQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=starfivetech.com; dmarc=pass action=none header.from=starfivetech.com; dkim=pass header.d=starfivetech.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=starfivetech.com; Received: from BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:f::16) by BJSPR01MB0865.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:e::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.33; Wed, 10 Jan 2024 13:31:45 +0000 Received: from BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn ([fe80::3862:65b4:c857:c4a6]) by BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn ([fe80::3862:65b4:c857:c4a6%4]) with mapi id 15.20.7135.033; Wed, 10 Jan 2024 13:31:45 +0000 From: Sia Jee Heng To: kernel@esmil.dk, conor@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, mturquette@baylibre.com, sboyd@kernel.org, p.zabel@pengutronix.de, emil.renner.berthing@canonical.com, hal.feng@starfivetech.com, xingyu.wu@starfivetech.com Cc: linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, jeeheng.sia@starfivetech.com, leyfoon.tan@starfivetech.com Subject: [RFC v3 01/16] reset: starfive: Rename file name "jh71x0" to "common" Date: Wed, 10 Jan 2024 21:31:13 +0800 Message-Id: <20240110133128.286657-2-jeeheng.sia@starfivetech.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240110133128.286657-1-jeeheng.sia@starfivetech.com> References: <20240110133128.286657-1-jeeheng.sia@starfivetech.com> X-ClientProxiedBy: BJXPR01CA0067.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:12::34) To BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:f::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BJSPR01MB0561:EE_|BJSPR01MB0865:EE_ X-MS-Office365-Filtering-Correlation-Id: 128f2498-042a-4fdf-80ce-08dc11e07d65 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: M8gdmljNfmt5yBjxiGksPGDL/Dmb44sXLO0gYBLcQ9btHIPrpR3XpOHvCu/K2cno5I9+OnKZGKQ29PPWrsejTZWE7YyC1uBFLgAImWA65CMs1zRr+7+bNZXJhXtXNt7vMRg+ykJdIsCHqQYQAzRBgiGgQkStbQbxqn6xmcsudSz4Lso5vuEQBRGxh+nF4EaxTziF+pe9Kxk/qlH+FrgFYlkTetunbmZtqysm+CEPXQbdQ1M8KfiYALXPdRx/zuCkCNsRED86R/iMzV8wEA4MLgUTTfyQPrNueyGh1P4rTwQqlzDXj1yhaqQ2LFT8KQt6d6Vv8b3hZFGIGMGl58ZoF4DuNq4iA9xcMgxU6I/ywln6CNSweYjkNfXF2E4IiSMRIQB7MBpKxoHwFZFstovIsjHBO2LBH024fObLwv9iZXMS5dt/eRHAAqNIquYe8nn2gjnhxcQs4dBcwmk8DMnlKmyngUig+h6f7QZ7aIKwwwBS7sDwsF9zG7s1gwxLAcjJZtjL+nZ65oXq6gRnYuI3eoLsHSewQ6RB+pm/WjcynMgVX3KeH7Qr+K8z8UD7rhUJcUXFvHdwqTqA2Q8yLoKJCQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn;PTR:;CAT:NONE;SFS:(13230031)(136003)(396003)(39830400003)(346002)(366004)(230922051799003)(451199024)(186009)(1800799012)(64100799003)(41320700001)(6666004)(508600001)(55236004)(52116002)(2616005)(107886003)(1076003)(26005)(38100700002)(40160700002)(38350700005)(921011)(86362001)(40180700001)(36756003)(41300700001)(4326008)(7416002)(83380400001)(5660300002)(2906002)(8936002)(8676002)(66946007)(66556008)(66476007)(6636002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: PxBfKY1cdrE6AumunfIFJjQoKcQYzMbYknismlNjHMuC7cG6JcPdQzyqCP7PLaxWs5dVJyAnKkM2XPlkPGbAOY0H/qSJADzn7fkj/Fc67+rn1q8G8Vn9hvqeJyWYm4EbVv2RyohdO+AS0ulYIOB+jKGylboBZKd3jO5x5ygfIT+9DqJM/JqSHcBdY0I2Ar/GVjTDWHEERz93QHBJUHA4b5EJKGRsTpMXB4M3velEuENig5pc2U/v1fPH5WbDMzMGrJUfF5eIBjTCz8aUrGnWue4jzKhTGjXSkqJ1nu6Tpr3/h31+1DH6j5QDd6jzrTJ0X7bMERqcLdZacAl4RS3N53ABlg35jErLPFnmEobRJ9l1vIui+/fW7Fv8bEmc61XpxZyDcIkLC4JfGyf96P47DV7UYWljFpI6yXTb1sBr6AOBS+rmJ+E413utj6NYewvkLQEjvs9p1fiNykAmSNkdf8HNQ712a/EdxyUWkTiOguA9RLr9r4K4T8O7nfKU2JLlcvi/lX+7MTQip4sht0RCZNO1e5/Lpl4EtLOg6GSmUSOtoRQ6KqediPoQ4yRonsmjBwzrMLgM4wfJWbDsGSYB7cfLggTluf/194ios4a5sbUJMF7Pq5QQ//T256TeVO3sxp8YTFQT5f/L6wpwp/D8cwS3/k1WBWpc2XntMyoafkumVqMMZ0K1M332eRyIZjrjeYKg8qVtLK6IGc7KsLtwZfZOIjL/SCEOpLz+3f4511BYZqtXQokCMYBzY6SnMnS+wHpGAv5K5rEslqiOWME+PKdnlFkBbk5XfuPYmVpa84echl9uc6em346vcmBp0xEXZXGKQVzgDLlKDlemeuagbPyzCbEdKpVyzOwP8n+jLvqlJ/QfwNdBYArOhuU/GEvqta/NtasPQR6Tht/vnvTvszP7W4H0Z8STMUu7C2fZdTngUilFkCEfk3JsU/6JBdJIGIKKTg4c+InQZLToPs1+iBjpNi81cXuqFjmgaPk+Rj6dJ8RCgvpYJEeayHCEr3S5jSCL6/LJSBD4QPEwtfVCQPFTFVE5FVQhel5nhSA2kH1oB/Qdd/ro++eCnKnEgr/1NpD9CgkuUQCIczTasbf9l8NzjsUVnlq4b1XS+DfLSAOJSm6+2epa1rus+Kl5YFlqA2EwsjlVqqHS0lbRs388AA8X5hTuWkWaWA43gT149SZJi3Z/ZCgRBqQcRV6SflzMFhjrAgHqnQH9TF2BmG7dgSf4yiEUPH4iDbUfNkf2kN6LE3Vz01lyi4lg523iHdrVqDbhl3U+4lM5c6BT00IDB8T5Z9mrGOjnFQMhzzIA//9ewqwDwEvbUGe+tJOCU1HIQYpXxt0bzNXEamXeAXiNDaW6z7+m6BF5g7NKo4D/e7Fpqe4Getm0f36+dBt0xd8CxUc3xjDoWzYGZmDNH9f0FiH1q6cxZU2mPIV97C0jQ+U4Cu9Y4RYqflJlkumu/A889BXsLYrDPWQOEiPmOQ/ZBJ0CCJzeEHWgtZiZA0+3tZIgSh/tDqcughf3r+PmoOYFrEAE/x9h6B2oEU0HdNMbdqR+rtJo5Dal+pLwU+u+gHmXhGoqdY5iTOkMLGv6zTVcY3ivgBq5OQlZMtboVYdJ+Q== X-OriginatorOrg: starfivetech.com X-MS-Exchange-CrossTenant-Network-Message-Id: 128f2498-042a-4fdf-80ce-08dc11e07d65 X-MS-Exchange-CrossTenant-AuthSource: BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jan 2024 13:31:45.5670 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 06fe3fa3-1221-43d3-861b-5a4ee687a85c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: oYJZ3NLWCfLPEu0F6awUqO6fJxAUTy6feqXm2GYBXcAdqhJLbKcztgLYrRpxzedgwnLdBBlVrZvkzXGY2mNOGD0W7wUobkmCbxiYHJWr0fo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BJSPR01MB0865 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240110_053213_362689_BB5F53E8 X-CRM114-Status: GOOD ( 11.39 ) X-BeenThere: linux-riscv@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-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org StarFive JH8100 shares a similar clock and reset design with JH7110. To facilitate the reuse of the file and its functionalities, files containing the "jh71x0" naming convention are renamed to use the "common" wording. Signed-off-by: Sia Jee Heng Reviewed-by: Ley Foon Tan Reviewed-by: Emil Renner Berthing Reviewed-by: Hal Feng --- drivers/clk/starfive/clk-starfive-jh7110-sys.c | 2 +- drivers/reset/starfive/Kconfig | 6 +++--- drivers/reset/starfive/Makefile | 2 +- .../{reset-starfive-jh71x0.c => reset-starfive-common.c} | 4 ++-- .../{reset-starfive-jh71x0.h => reset-starfive-common.h} | 6 +++--- drivers/reset/starfive/reset-starfive-jh7100.c | 2 +- drivers/reset/starfive/reset-starfive-jh7110.c | 4 ++-- .../{reset-starfive-jh71x0.h => reset-starfive-common.h} | 4 ++-- 8 files changed, 15 insertions(+), 15 deletions(-) rename drivers/reset/starfive/{reset-starfive-jh71x0.c => reset-starfive-common.c} (97%) rename drivers/reset/starfive/{reset-starfive-jh71x0.h => reset-starfive-common.h} (75%) rename include/soc/starfive/{reset-starfive-jh71x0.h => reset-starfive-common.h} (81%) diff --git a/drivers/clk/starfive/clk-starfive-jh7110-sys.c b/drivers/clk/starfive/clk-starfive-jh7110-sys.c index 3884eff9fe93..6e45c580c9ba 100644 --- a/drivers/clk/starfive/clk-starfive-jh7110-sys.c +++ b/drivers/clk/starfive/clk-starfive-jh7110-sys.c @@ -14,7 +14,7 @@ #include #include -#include +#include #include diff --git a/drivers/reset/starfive/Kconfig b/drivers/reset/starfive/Kconfig index d832339f61bc..29fbcf1a7d83 100644 --- a/drivers/reset/starfive/Kconfig +++ b/drivers/reset/starfive/Kconfig @@ -1,12 +1,12 @@ # SPDX-License-Identifier: GPL-2.0-only -config RESET_STARFIVE_JH71X0 +config RESET_STARFIVE_COMMON bool config RESET_STARFIVE_JH7100 bool "StarFive JH7100 Reset Driver" depends on ARCH_STARFIVE || COMPILE_TEST - select RESET_STARFIVE_JH71X0 + select RESET_STARFIVE_COMMON default ARCH_STARFIVE help This enables the reset controller driver for the StarFive JH7100 SoC. @@ -15,7 +15,7 @@ config RESET_STARFIVE_JH7110 bool "StarFive JH7110 Reset Driver" depends on CLK_STARFIVE_JH7110_SYS select AUXILIARY_BUS - select RESET_STARFIVE_JH71X0 + select RESET_STARFIVE_COMMON default ARCH_STARFIVE help This enables the reset controller driver for the StarFive JH7110 SoC. diff --git a/drivers/reset/starfive/Makefile b/drivers/reset/starfive/Makefile index 7a44b66fb9d5..582e4c160bd4 100644 --- a/drivers/reset/starfive/Makefile +++ b/drivers/reset/starfive/Makefile @@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-2.0 -obj-$(CONFIG_RESET_STARFIVE_JH71X0) += reset-starfive-jh71x0.o +obj-$(CONFIG_RESET_STARFIVE_COMMON) += reset-starfive-common.o obj-$(CONFIG_RESET_STARFIVE_JH7100) += reset-starfive-jh7100.o obj-$(CONFIG_RESET_STARFIVE_JH7110) += reset-starfive-jh7110.o diff --git a/drivers/reset/starfive/reset-starfive-jh71x0.c b/drivers/reset/starfive/reset-starfive-common.c similarity index 97% rename from drivers/reset/starfive/reset-starfive-jh71x0.c rename to drivers/reset/starfive/reset-starfive-common.c index 55bbbd2de52c..dab454e46bbf 100644 --- a/drivers/reset/starfive/reset-starfive-jh71x0.c +++ b/drivers/reset/starfive/reset-starfive-common.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-or-later /* - * Reset driver for the StarFive JH71X0 SoCs + * Reset driver for the StarFive SoCs * * Copyright (C) 2021 Emil Renner Berthing */ @@ -12,7 +12,7 @@ #include #include -#include "reset-starfive-jh71x0.h" +#include "reset-starfive-common.h" struct jh71x0_reset { struct reset_controller_dev rcdev; diff --git a/drivers/reset/starfive/reset-starfive-jh71x0.h b/drivers/reset/starfive/reset-starfive-common.h similarity index 75% rename from drivers/reset/starfive/reset-starfive-jh71x0.h rename to drivers/reset/starfive/reset-starfive-common.h index db7d39a87f87..266acc4b2caf 100644 --- a/drivers/reset/starfive/reset-starfive-jh71x0.h +++ b/drivers/reset/starfive/reset-starfive-common.h @@ -3,12 +3,12 @@ * Copyright (C) 2021 Emil Renner Berthing */ -#ifndef __RESET_STARFIVE_JH71X0_H -#define __RESET_STARFIVE_JH71X0_H +#ifndef __RESET_STARFIVE_COMMON_H +#define __RESET_STARFIVE_COMMON_H int reset_starfive_jh71x0_register(struct device *dev, struct device_node *of_node, void __iomem *assert, void __iomem *status, const u32 *asserted, unsigned int nr_resets, struct module *owner); -#endif /* __RESET_STARFIVE_JH71X0_H */ +#endif /* __RESET_STARFIVE_COMMON_H */ diff --git a/drivers/reset/starfive/reset-starfive-jh7100.c b/drivers/reset/starfive/reset-starfive-jh7100.c index 2a56f7fd4ba7..546dea2e5811 100644 --- a/drivers/reset/starfive/reset-starfive-jh7100.c +++ b/drivers/reset/starfive/reset-starfive-jh7100.c @@ -8,7 +8,7 @@ #include #include -#include "reset-starfive-jh71x0.h" +#include "reset-starfive-common.h" #include diff --git a/drivers/reset/starfive/reset-starfive-jh7110.c b/drivers/reset/starfive/reset-starfive-jh7110.c index 29a43f0f2ad6..87dba01491ae 100644 --- a/drivers/reset/starfive/reset-starfive-jh7110.c +++ b/drivers/reset/starfive/reset-starfive-jh7110.c @@ -7,9 +7,9 @@ #include -#include +#include -#include "reset-starfive-jh71x0.h" +#include "reset-starfive-common.h" #include diff --git a/include/soc/starfive/reset-starfive-jh71x0.h b/include/soc/starfive/reset-starfive-common.h similarity index 81% rename from include/soc/starfive/reset-starfive-jh71x0.h rename to include/soc/starfive/reset-starfive-common.h index 47b486ececc5..56d8f413cf18 100644 --- a/include/soc/starfive/reset-starfive-jh71x0.h +++ b/include/soc/starfive/reset-starfive-common.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __SOC_STARFIVE_RESET_JH71X0_H -#define __SOC_STARFIVE_RESET_JH71X0_H +#ifndef __SOC_STARFIVE_RESET_COMMON_H +#define __SOC_STARFIVE_RESET_COMMON_H #include #include From patchwork Wed Jan 10 13:31:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sia Jee Heng X-Patchwork-Id: 13516152 X-Patchwork-Delegate: mail@conchuod.ie 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 D2668C4707C for ; Wed, 10 Jan 2024 13:32:20 +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=cZvDOYevu+y+J0R4PAMbb8yDN0b6nz1oEIWazfbpMZE=; b=LWY32cpWqhvCln ntxKR/kJPK5XFxfxTuAYTXQaYAeHVTY/meM3vhihLgffsb5ENCFLPaEDM1szsgMpDVCkGAKg4VApg KAg018igB6QRkwtY3AlgFTfKz+bZy1vHYJsKlIIgPvD3SpSnIO4LfUwdY95xZqyB5hcUKoXgaRRHr q4tMZhEJ09uVkpp3m6kCRjjYzxNZYYpQTBPAbP1Fpd+IkJENiIdZ9iMisvGyKB5UX14ZsFOL87CLX axiNSPXZ3q0M6gGVXZFu5Cdl2te4ibUBO/qE7wm3brBDcGTqn21fZWuZYbvrjhMyAUQDST3+rvcFP ZADM41BTShnk2cM9XsFg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rNYgl-00Bywv-16; Wed, 10 Jan 2024 13:32:11 +0000 Received: from mail-sh0chn02on20621.outbound.protection.partner.outlook.cn ([2406:e500:4420:2::621] helo=CHN02-SH0-obe.outbound.protection.partner.outlook.cn) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rNYgi-00Byri-24 for linux-riscv@lists.infradead.org; Wed, 10 Jan 2024 13:32:10 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gP2hzX9ymHbAzia5+Ol5an9lInAwUPBMAEmotz9QrCAtnbUuwOFnkyyGCEqpsI/oBj1f8mLQnvKgko+zpTMheFwCiJ/UgkzGSj0ED9cEpyiuq4ewGzLuK2tY0jSf86a35FtvBOEIstup3UJnaaaXbz8sHHCQqq6n0Ux7iKUZ0b+XwR9LinUpvgzSSbThjdXqF6Fw7crFyFgXVUy9xSRibeg7a/6PII55Ff6M5G8C/EPisaQ0SAJYsINCSXUv7oCBn76vRYiT8IsJrHTaBvab84OSXc+kwCZeW+0n7Wseex8Ju33rKGQ/Dst2p453lp9KmVn68Zz6lHdTfFyqxxj1Uw== 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=kF8zk8SysyBKwe0A4Yai6sY1nW9euDRfLL1DlkFZiME=; b=n8JoPvKcx76y0fe4nj7HLantqrkuR2yzZmzUZGR2oWwhx7vUKSFQp9FBFVJ+YKozcQ6TTrpCPUtXfUBMkdQT1ALzc7tjJM90+nonfxlgpuOXyiQ9w5a4bugN9TtMdH1YCE7y1SyyxUKv3UDDckOjarejEH63sXfEpUdWziVUQIvjBO3d0OnBG9jCnX0KV0xKEaHiNk00FDd3WFQ38FWW5GR4Zrjty4aXVp1ykA5ZISmqaXNkmnrCkcFNcese2YqTe+FNIVWUqD2NxSBMIlQP/8OMoLzamzUwxKhrkxg51b+b8OpiSqmNWoQxS/HO/z4Hc0w3MROqTqV0VHORz8RZGQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=starfivetech.com; dmarc=pass action=none header.from=starfivetech.com; dkim=pass header.d=starfivetech.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=starfivetech.com; Received: from BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:f::16) by BJSPR01MB0865.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:e::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.33; Wed, 10 Jan 2024 13:31:49 +0000 Received: from BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn ([fe80::3862:65b4:c857:c4a6]) by BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn ([fe80::3862:65b4:c857:c4a6%4]) with mapi id 15.20.7135.033; Wed, 10 Jan 2024 13:31:49 +0000 From: Sia Jee Heng To: kernel@esmil.dk, conor@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, mturquette@baylibre.com, sboyd@kernel.org, p.zabel@pengutronix.de, emil.renner.berthing@canonical.com, hal.feng@starfivetech.com, xingyu.wu@starfivetech.com Cc: linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, jeeheng.sia@starfivetech.com, leyfoon.tan@starfivetech.com Subject: [RFC v3 02/16] reset: starfive: Convert the word "jh71x0" to "starfive" Date: Wed, 10 Jan 2024 21:31:14 +0800 Message-Id: <20240110133128.286657-3-jeeheng.sia@starfivetech.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240110133128.286657-1-jeeheng.sia@starfivetech.com> References: <20240110133128.286657-1-jeeheng.sia@starfivetech.com> X-ClientProxiedBy: BJXPR01CA0067.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:12::34) To BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:f::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BJSPR01MB0561:EE_|BJSPR01MB0865:EE_ X-MS-Office365-Filtering-Correlation-Id: 4a960370-3c5b-4958-583e-08dc11e07fd1 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: u0wb+HqQlYJui5YK1RfiV6ENm8zUwTmeXUI5yeVSQz4xQJlko90/1bTT1IVF4ImbM/AGwPkn2///ztsbGjt3R97imk6MQafMmZtFi1KKsthxNl0QE2UfOy7bIkDHuVCw1v2yhTBBJ4DZBZPj2SVpdwjNVuLebc5+5jFoZ1JBqCsumcwwnNmcehoYhUYfn0BgOIf7tJQqr2T69JyKe3kRhTqFkfmg2XwjOJHPmEkMUHKs4Qo8fxUdnlk67TFUQP59ukcKyGke9/GrNpdSvRAa3gTDQ48XIwlU5AsE+lZ34ikgbkzf08vPUSSiyxh6afmVGWjModj2b3CxhBDlvMJ05tQ+8S7arsbcyMVsu88jvKxSm6SdSr453FL+1mSA6QZ/WXnQ/0tTBY4ZOHS9HZPNbnlKXGhI33LJ7IoT5CYWcVoN0sOoIsJxnvhCpPow28itnGLbq0xji7yy9n4JJQGzRDIiC7poFTVp5LbQ4N5FJlnup/zdx7cuP9rvPwo0tKtbmfXCApOryB2wtT3W2jaqZ3CPNxdXQZ5fRtN6d+WHHhiiY53Ypku75Fu57+M8DiItgRzHERCYPYMuvy+Vs5hIDQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn;PTR:;CAT:NONE;SFS:(13230031)(136003)(396003)(39830400003)(346002)(366004)(230922051799003)(451199024)(186009)(1800799012)(64100799003)(41320700001)(6666004)(508600001)(55236004)(52116002)(2616005)(107886003)(1076003)(26005)(38100700002)(40160700002)(38350700005)(921011)(86362001)(40180700001)(36756003)(41300700001)(4326008)(7416002)(83380400001)(5660300002)(2906002)(8936002)(8676002)(66946007)(66556008)(66476007)(6636002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: P3exgadEEYXC+28ag6d8QNzHmKXJCAvEGuOOpNUFAdxPm45nNULbvXfcfMF9vIuYLgakSvC7e1mUQmmthabBbVhvLtCp/eXki4lMIKMa9RrAr5cxNQh6bG6DJddbAfSHQEESMMVD0OW2nsBqOCcqYQN5HWsEnsRzlV5xSGpkyfyI1fKc+44MSlIxJYGIYftv/idO91xjVsWR8DYpIby/KAYOWweM8hi4dFWXfjIKWOO9ihqZv9dDWRZWvusFmY+X2C9qZm0GyNWRIObasnpT2doHOJX8slA01A3/ij2U6erLyjdNZjyvjv+9uhEctr4B+wXgPCOXhsdFYg4H3pbYl0NHIF9CjqWfzmR1GqoqV4YzjjuV05KpnihIqZvanbAaQm/kgVqFrIj22ZMm2Mdl63jHX1TGaQcc5XP3KZK5MNx6yTze13RQ+EfgM2e0TDFKqhNiKbXWLd2K2x/ZTKD4cUKOIXsFf9HRAJjpCcOtAnK4mYTO80FYGBVxwIU6pPxaItaZPpoWbEkgPbcUuuTN1ZwRL4mHza4eSgLYVnwDser81rgfvzJ6MOHcYW/bRkJ/BDWj9jGaMKm1hCOuGwWsdwWGzSQUb5VGyCb7LbuHDd0ark11MoYzSJvXNvNZYQirxc+4BxkkdbO0DZ2kIpfozePis160PMWwCPssvvN/JTRs6wS6U0poZRtS/nupqvBPd/RdVoN0AJQged3V7IoFvE8ioTLV7mFfnQvo06lU75JYD6ccvy0FZDzeqw9Qn3E11AxyCi8UnrHNOmjpCSTswIL8F4yMwEba0Ontu+Lf2rx5R0DD1LpxrXYFewD9wWl5+LK3SbIwL08EXk8FNGH5Zx/B7CFaYDZKp923RiDEJxfoNiBN5rAB3ghFcYNNQFN1u5wf3xsDTVhmWmKNEwiJjLkXjWypt6r9kLv2TJBdRUlwbTKJQlBxYexWjq5M8u6nwDsY7znua9kGEqbd/z4XD3zmCLsuTI2G6iM20z5nTNGM+svBZeSCelPqxwkISSnm7oHT9e+YfRRvK+YpMf9PEYCULbOUgluDHrQBZw51zWaqqEgM8w+SJls1GEaIuyYCluVOdB2Awh7dTBEvH6fJh4PIA+16HhYOVrNiTqHvpkorxCepUQZKUb53gT+PEr+uBf5X0iF/2iuuA1HeRXOl4Vk7apbuz2p2JzKSE5CSBFUuJAJBVMonj79/5836O9qGBd8YCJH9yW1PQ2gVqHw77jDpLkBWcQTjIFo6yzvBqIQGIQjRsealMAomAZ2phITmNxBkLL0TGN4QcDaLHpVhU1N8kyxxTYLq0Ypnq34KzmZtilv8yp+BiIeW2v4pe3llnnOQupXs3J30qW5cYKJ7krm388bcWpS90TqiGUg/VZGRBIKHXXyz+AXcvyd9LEejrPkNNL9FEDP4usGngSzu9XKYc6V023Y6BnHNbvah/JpHB73hU+7c5VJPQHLYScjL6RVZqC4UYQL+XnVJOY0KQEjh6J+1tJFuasnpxKyVPAxPkCUBWHxHkjl11yHsbsaxGE6o8UInMe7jOYUFas/ilYILOzfmiSJbJONsWX8MVklUkohg1prjs/Ldiy5ZALP7U2wCv+eIUjqar4zSD/LdJQ== X-OriginatorOrg: starfivetech.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4a960370-3c5b-4958-583e-08dc11e07fd1 X-MS-Exchange-CrossTenant-AuthSource: BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jan 2024 13:31:49.6409 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 06fe3fa3-1221-43d3-861b-5a4ee687a85c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: q7ioOh7b3LP76UHOTayai3dgBoyYOlmDzaO4LoXIu3sWPgvvrRUWXolj5AleRqMkbdRxbWlL33JiZD7uRiAf18e2XB5qWkS/iZT5y9F3A1c= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BJSPR01MB0865 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240110_053208_922732_F0205864 X-CRM114-Status: GOOD ( 15.05 ) X-BeenThere: linux-riscv@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-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Function names that consist of the 'jh71x0' naming convention are renamed to use the 'starfive' wording. Signed-off-by: Sia Jee Heng Reviewed-by: Ley Foon Tan Reviewed-by: Emil Renner Berthing Reviewed-by: Hal Feng --- .../clk/starfive/clk-starfive-jh7110-sys.c | 4 +- .../reset/starfive/reset-starfive-common.c | 64 +++++++++---------- .../reset/starfive/reset-starfive-common.h | 8 +-- .../reset/starfive/reset-starfive-jh7100.c | 2 +- .../reset/starfive/reset-starfive-jh7110.c | 4 +- include/soc/starfive/reset-starfive-common.h | 6 +- 6 files changed, 44 insertions(+), 44 deletions(-) diff --git a/drivers/clk/starfive/clk-starfive-jh7110-sys.c b/drivers/clk/starfive/clk-starfive-jh7110-sys.c index 6e45c580c9ba..e63353c70209 100644 --- a/drivers/clk/starfive/clk-starfive-jh7110-sys.c +++ b/drivers/clk/starfive/clk-starfive-jh7110-sys.c @@ -345,7 +345,7 @@ static void jh7110_reset_unregister_adev(void *_adev) static void jh7110_reset_adev_release(struct device *dev) { struct auxiliary_device *adev = to_auxiliary_dev(dev); - struct jh71x0_reset_adev *rdev = to_jh71x0_reset_adev(adev); + struct starfive_reset_adev *rdev = to_starfive_reset_adev(adev); kfree(rdev); } @@ -354,7 +354,7 @@ int jh7110_reset_controller_register(struct jh71x0_clk_priv *priv, const char *adev_name, u32 adev_id) { - struct jh71x0_reset_adev *rdev; + struct starfive_reset_adev *rdev; struct auxiliary_device *adev; int ret; diff --git a/drivers/reset/starfive/reset-starfive-common.c b/drivers/reset/starfive/reset-starfive-common.c index dab454e46bbf..8d8dec9e5d7a 100644 --- a/drivers/reset/starfive/reset-starfive-common.c +++ b/drivers/reset/starfive/reset-starfive-common.c @@ -14,7 +14,7 @@ #include "reset-starfive-common.h" -struct jh71x0_reset { +struct starfive_reset { struct reset_controller_dev rcdev; /* protect registers against concurrent read-modify-write */ spinlock_t lock; @@ -23,16 +23,16 @@ struct jh71x0_reset { const u32 *asserted; }; -static inline struct jh71x0_reset * -jh71x0_reset_from(struct reset_controller_dev *rcdev) +static inline struct starfive_reset * +starfive_reset_from(struct reset_controller_dev *rcdev) { - return container_of(rcdev, struct jh71x0_reset, rcdev); + return container_of(rcdev, struct starfive_reset, rcdev); } -static int jh71x0_reset_update(struct reset_controller_dev *rcdev, - unsigned long id, bool assert) +static int starfive_reset_update(struct reset_controller_dev *rcdev, + unsigned long id, bool assert) { - struct jh71x0_reset *data = jh71x0_reset_from(rcdev); + struct starfive_reset *data = starfive_reset_from(rcdev); unsigned long offset = id / 32; u32 mask = BIT(id % 32); void __iomem *reg_assert = data->assert + offset * sizeof(u32); @@ -61,34 +61,34 @@ static int jh71x0_reset_update(struct reset_controller_dev *rcdev, return ret; } -static int jh71x0_reset_assert(struct reset_controller_dev *rcdev, - unsigned long id) +static int starfive_reset_assert(struct reset_controller_dev *rcdev, + unsigned long id) { - return jh71x0_reset_update(rcdev, id, true); + return starfive_reset_update(rcdev, id, true); } -static int jh71x0_reset_deassert(struct reset_controller_dev *rcdev, - unsigned long id) +static int starfive_reset_deassert(struct reset_controller_dev *rcdev, + unsigned long id) { - return jh71x0_reset_update(rcdev, id, false); + return starfive_reset_update(rcdev, id, false); } -static int jh71x0_reset_reset(struct reset_controller_dev *rcdev, - unsigned long id) +static int starfive_reset_reset(struct reset_controller_dev *rcdev, + unsigned long id) { int ret; - ret = jh71x0_reset_assert(rcdev, id); + ret = starfive_reset_assert(rcdev, id); if (ret) return ret; - return jh71x0_reset_deassert(rcdev, id); + return starfive_reset_deassert(rcdev, id); } -static int jh71x0_reset_status(struct reset_controller_dev *rcdev, - unsigned long id) +static int starfive_reset_status(struct reset_controller_dev *rcdev, + unsigned long id) { - struct jh71x0_reset *data = jh71x0_reset_from(rcdev); + struct starfive_reset *data = starfive_reset_from(rcdev); unsigned long offset = id / 32; u32 mask = BIT(id % 32); void __iomem *reg_status = data->status + offset * sizeof(u32); @@ -97,25 +97,25 @@ static int jh71x0_reset_status(struct reset_controller_dev *rcdev, return !((value ^ data->asserted[offset]) & mask); } -static const struct reset_control_ops jh71x0_reset_ops = { - .assert = jh71x0_reset_assert, - .deassert = jh71x0_reset_deassert, - .reset = jh71x0_reset_reset, - .status = jh71x0_reset_status, +static const struct reset_control_ops starfive_reset_ops = { + .assert = starfive_reset_assert, + .deassert = starfive_reset_deassert, + .reset = starfive_reset_reset, + .status = starfive_reset_status, }; -int reset_starfive_jh71x0_register(struct device *dev, struct device_node *of_node, - void __iomem *assert, void __iomem *status, - const u32 *asserted, unsigned int nr_resets, - struct module *owner) +int reset_starfive_register(struct device *dev, struct device_node *of_node, + void __iomem *assert, void __iomem *status, + const u32 *asserted, unsigned int nr_resets, + struct module *owner) { - struct jh71x0_reset *data; + struct starfive_reset *data; data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); if (!data) return -ENOMEM; - data->rcdev.ops = &jh71x0_reset_ops; + data->rcdev.ops = &starfive_reset_ops; data->rcdev.owner = owner; data->rcdev.nr_resets = nr_resets; data->rcdev.dev = dev; @@ -128,4 +128,4 @@ int reset_starfive_jh71x0_register(struct device *dev, struct device_node *of_no return devm_reset_controller_register(dev, &data->rcdev); } -EXPORT_SYMBOL_GPL(reset_starfive_jh71x0_register); +EXPORT_SYMBOL_GPL(reset_starfive_register); diff --git a/drivers/reset/starfive/reset-starfive-common.h b/drivers/reset/starfive/reset-starfive-common.h index 266acc4b2caf..83461b22ee55 100644 --- a/drivers/reset/starfive/reset-starfive-common.h +++ b/drivers/reset/starfive/reset-starfive-common.h @@ -6,9 +6,9 @@ #ifndef __RESET_STARFIVE_COMMON_H #define __RESET_STARFIVE_COMMON_H -int reset_starfive_jh71x0_register(struct device *dev, struct device_node *of_node, - void __iomem *assert, void __iomem *status, - const u32 *asserted, unsigned int nr_resets, - struct module *owner); +int reset_starfive_register(struct device *dev, struct device_node *of_node, + void __iomem *assert, void __iomem *status, + const u32 *asserted, unsigned int nr_resets, + struct module *owner); #endif /* __RESET_STARFIVE_COMMON_H */ diff --git a/drivers/reset/starfive/reset-starfive-jh7100.c b/drivers/reset/starfive/reset-starfive-jh7100.c index 546dea2e5811..122ac6c3893b 100644 --- a/drivers/reset/starfive/reset-starfive-jh7100.c +++ b/drivers/reset/starfive/reset-starfive-jh7100.c @@ -51,7 +51,7 @@ static int __init jh7100_reset_probe(struct platform_device *pdev) if (IS_ERR(base)) return PTR_ERR(base); - return reset_starfive_jh71x0_register(&pdev->dev, pdev->dev.of_node, + return reset_starfive_register(&pdev->dev, pdev->dev.of_node, base + JH7100_RESET_ASSERT0, base + JH7100_RESET_STATUS0, jh7100_reset_asserted, diff --git a/drivers/reset/starfive/reset-starfive-jh7110.c b/drivers/reset/starfive/reset-starfive-jh7110.c index 87dba01491ae..c4dd21761e53 100644 --- a/drivers/reset/starfive/reset-starfive-jh7110.c +++ b/drivers/reset/starfive/reset-starfive-jh7110.c @@ -53,13 +53,13 @@ static int jh7110_reset_probe(struct auxiliary_device *adev, const struct auxiliary_device_id *id) { struct jh7110_reset_info *info = (struct jh7110_reset_info *)(id->driver_data); - struct jh71x0_reset_adev *rdev = to_jh71x0_reset_adev(adev); + struct starfive_reset_adev *rdev = to_starfive_reset_adev(adev); void __iomem *base = rdev->base; if (!info || !base) return -ENODEV; - return reset_starfive_jh71x0_register(&adev->dev, adev->dev.parent->of_node, + return reset_starfive_register(&adev->dev, adev->dev.parent->of_node, base + info->assert_offset, base + info->status_offset, NULL, diff --git a/include/soc/starfive/reset-starfive-common.h b/include/soc/starfive/reset-starfive-common.h index 56d8f413cf18..16df46a074bc 100644 --- a/include/soc/starfive/reset-starfive-common.h +++ b/include/soc/starfive/reset-starfive-common.h @@ -6,12 +6,12 @@ #include #include -struct jh71x0_reset_adev { +struct starfive_reset_adev { void __iomem *base; struct auxiliary_device adev; }; -#define to_jh71x0_reset_adev(_adev) \ - container_of((_adev), struct jh71x0_reset_adev, adev) +#define to_starfive_reset_adev(_adev) \ + container_of((_adev), struct starfive_reset_adev, adev) #endif From patchwork Wed Jan 10 13:31:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sia Jee Heng X-Patchwork-Id: 13516153 X-Patchwork-Delegate: mail@conchuod.ie 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 A5E4DC4725D for ; Wed, 10 Jan 2024 13:32:23 +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=8KX/WyzZYCl8STR2euhuBsncrNGefxlf+84WevNV9vw=; b=mdsHrQ6sm2OZ5X 3674Jj2ZFPI32S29Gi2sR/FRdiCPqB5nWxsGHuYhQczP8UdoP0NZ/HtgSqsksZ+/jGkRQcBOAy7tP H52CIJMRlyrIGLUllsBY3l9KtCioeyI8O6l+bzLrFTIu+3uLFniZwBzj5+zPb2zzphNAJlXpFQBKl 8tSRSEc/X5btxW0TNi/jrn/vB7aQeFuIhqPTyT4cYLDHcu2uhJAt2gn8KD2QPNIxhnFmJUhKJ3flr ezKgr4QQkr2jhE7dQFY3cFDyn+WQXFTArUgG/uJ8Ujew8lmgsdhQe2nNDYIemhAxyosFHf+eQtgWq dhFE7WhBN8MsiN6Ui0cA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rNYgo-00Byym-0e; Wed, 10 Jan 2024 13:32:14 +0000 Received: from mail-sh0chn02on20621.outbound.protection.partner.outlook.cn ([2406:e500:4420:2::621] helo=CHN02-SH0-obe.outbound.protection.partner.outlook.cn) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rNYgl-00Byri-0G for linux-riscv@lists.infradead.org; Wed, 10 Jan 2024 13:32:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iFIvD2c2qR9fRsyC1qPiFYPnk18hDMc/Sirr7dCsdF6UEntr7pU87QzIfW8sCFEZ+QYc9wqIyx3KKQp2wcv0jS2v5FewWqrT0QNUNWE1JTxdvCeqwo7Q32jpyGFzZqImiR8zSR9zfgyewJeBcM40Tkt2JtfMGBNHwPUa+sETxbax8DUzaftAJoFAwa7jGssiiL6lyGWtI2LfR/GNJYI68GA6JaqrVfZUGhWeMDfLrh733U7dhR4o9C9wRtrupTytVBSAJ9xmb5Sgl4cEyfy9zrBFiw8Jiqc7mMF2VSJNuM6RMAsvlysyNEFka9kkqRmCTx+3tuChF6OR7xfEoAO74A== 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=op7Qrxn5VO9xATtgrARle3pOBo+Q36v/LDJDpiobQKY=; b=d/uXdAG7RCAkXnXTf44nwBxHXqhAGKWc0CIiCcdMY4VNelB0p4/IxoMgsReX3VoyWgirCfgAnDLvgIUb/Q86eZTAYEVVK+1Br5+UYnAtUBZPDHBIPCJQoDAYlx1KNJmzLQgXTMFuFQL5u3ZyNrVnSzrxDKY9yRcaj7AWNfmdVwgSuVAdUfuFtqP0i+VE8iwZgBTDIR7LpzHOAvDH1LE7Y2h59UZX0OPmL9JvDvjfiJzQ7dpOBAz7N1rH/XyWw8emxucBGhOxhSK+iWSykWNtgp01cRlMu6leseXWx3zhgycyUKmztecqkeicMS5ADVll3mu6wXBQg+6LqwolIzbZDg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=starfivetech.com; dmarc=pass action=none header.from=starfivetech.com; dkim=pass header.d=starfivetech.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=starfivetech.com; Received: from BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:f::16) by BJSPR01MB0865.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:e::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.33; Wed, 10 Jan 2024 13:31:53 +0000 Received: from BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn ([fe80::3862:65b4:c857:c4a6]) by BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn ([fe80::3862:65b4:c857:c4a6%4]) with mapi id 15.20.7135.033; Wed, 10 Jan 2024 13:31:53 +0000 From: Sia Jee Heng To: kernel@esmil.dk, conor@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, mturquette@baylibre.com, sboyd@kernel.org, p.zabel@pengutronix.de, emil.renner.berthing@canonical.com, hal.feng@starfivetech.com, xingyu.wu@starfivetech.com Cc: linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, jeeheng.sia@starfivetech.com, leyfoon.tan@starfivetech.com Subject: [RFC v3 03/16] clk: starfive: Rename file name "jh71x0" to "common" Date: Wed, 10 Jan 2024 21:31:15 +0800 Message-Id: <20240110133128.286657-4-jeeheng.sia@starfivetech.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240110133128.286657-1-jeeheng.sia@starfivetech.com> References: <20240110133128.286657-1-jeeheng.sia@starfivetech.com> X-ClientProxiedBy: BJXPR01CA0067.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:12::34) To BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:f::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BJSPR01MB0561:EE_|BJSPR01MB0865:EE_ X-MS-Office365-Filtering-Correlation-Id: 83b7d0c7-0a2a-4d2c-817f-08dc11e0820d X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pujTy6BB+4wcQhQ2GT5cBG4G6Ol9Jlr9ZpQawV4wWdPY9mX99O7svSUcii+s5HLG/UFjwJT40Yh+GXNS42DD2y8pgWCxsAmCQhN28ni9tP2QyqbhsYfMUoxU+l8giW3Xkl6KgshdkN+UIF4tfsadYCnkVn0KLfjQFa6Z/ajW64/Q2HfIBdPxvCfodZSBwwGaS0vh4eIXhfWG7aZiHIiO+zmBHhbqa9Cv7963Ie7VlA2DUO6r+IYSxU2MzLtcE7KDYuJKRBu/1V8E3bcWiEQRdwvKBu3ow2fb1jMoE8pvmPqyXCYBb0LqF+++49+u/8Ea2vML1aXqqeFonCJFDJUiROEdgbGoaBw5HQmMN+71YkR9HFCGK364cakp/askcU2vn0N1zl3NdBHFii++qOsLHS+sIHZQWwOL9tH1nVcuo9QZAXnSVKTsy8XWN1C9/8dh/CZ5LO3iBy18BZvS3vJZuxITtpAZFJ+zX3pHoxWfgNua+PSfI5xQr5zASirzpqGmqBpZNn2DDb83zt6SpGYArsIWVhFdvFu31bEiYF3Nl8VFDjqa+e3V1SHz7iFBCBUSjJIn+V7LxhU2EACGjOJ62fzD0dJmJ3gzeZd5fhWZmUNBHNq7O+qvl04UsqiIZH5s X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn;PTR:;CAT:NONE;SFS:(13230031)(136003)(396003)(39830400003)(346002)(366004)(230922051799003)(230273577357003)(230173577357003)(451199024)(186009)(1800799012)(64100799003)(41320700001)(6666004)(508600001)(55236004)(52116002)(2616005)(107886003)(1076003)(26005)(38100700002)(40160700002)(38350700005)(921011)(86362001)(40180700001)(36756003)(41300700001)(4326008)(7416002)(83380400001)(5660300002)(2906002)(8936002)(8676002)(66946007)(66556008)(66476007)(6636002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 1chYZtbETLpkxKF9raj2r8I0Fs1WISnyRjp+ROwD0a4YbLCCUyPFvsZjbg59bwI1I6oAnl3jl3QgWYPfi075fGpmvNYZMinRpd3jfS05UC0FKdQz7coXzq1ZVTDffxgJBmpb8giMgrGk5beIzryLjL0z9ZH09ucPXEJ2QNNSjs44dqvZkyyzGm6nPQW3eTVXQm/99DydPPUwcdFEF46zGKitlCHfeC283bXrIM/KsVzEdmju30qNB8dfnFe7pdwO/olUu6Ge5BOHGuKXAeyh76TWUf5qNuQzkWBi/2AsQQvrmkTn1pcQaD9uIDC8XyBvIKiTehpWbviJ94px3R76YF/qai17ma3Ew+tkzHhkOswYSEIq+Z+iXQwxsI5Ty4yC6Fi/zyT78vmqGjWSmloxbafAZiwsQfh8FYa4M/OJtIJr3HxR+0yrM3iiUX9FaPdt7QXQch1FTMBZCxePNS3Sz+oRbEqB0ucqqq0NaYGgZ22uO9iV8wf1sDDlbmJHWJSKnK+vU/LLtSitbmxNVLnxPa6ZauFfquEtkg35zg/cODy5mCmj9XkDaAR6p7L3TBpO5f27deo+nsZcFhlwTPBCIc9gZoMrtNtDB0FhU9kjZGKdGFaSl2PGqi1qxZ1mbHb5uiXv6Y55VlwoIy/IXZfpSRlXunAtQ8EoxAYfQwMXaq8NY59rhZqwvq3oaueWoLXrPM4skP+IHx+h2Bgoq07EgWNSlAiUU7XPhS8WycNi3diazKGIEF7r+Tfr9ekCs3EKg6pHr/KTc6jlkw96aTdj4EUsZ5gzwcODzLzJzYi45PbJNspqss+WuwbILfH0Ja/PYMU1pR7BrPEioBZPvdmadOQosgFkCT5eYzCQRYnhMAfWLsuX6JvgEq21bUMj43BNoMU2IY5wazj0zWF0/QzSDwx2n3bxQp4xTDvTof7eDTtYuUvNcGdPdpkLiBrH9LcDv+57FcjuXgbTr+KwGofXMGFYKDblsdBvHwi+P2Q1JnuyfqwA36EXLf/O7ECO37LlFTYpz9O1rfMV6LMT1+bxkp4IdbvTxeLzKRl5dcgr38oIiZ57Q4h8kb74M4kcSL9G1rqyCX+bM/eflM374yy5nVaKIMRL83Y+VjMqmswwCMotT6RRBGUhWt2XKPtbUHXuIHshs2X1SfqfzfMH+Esz36X/yv+PnPWM2Me6mFSB59HLazdbiId8q8ssEwf7PiZH1PnDdCzIewPDdRsk7BDRAKg/bj6azI6IYylVO8jxnmjRnDxdD18Si+UdNTsD72ub0SkCWva0lWhEy+B3nMEHrEcRp7V3u6l4LrNxW/AOzCX6q5A6l96kMXcxZDB7Mkirp5Defa57Wx9WFYtNpMPnM2GchOEUrAiiub+PztPUK4GIkT/mIr/HPLp9m9ksZ009j/Xf4Bdq6DlBe8Sw+/QmHskljABkUyc2qI6uqWqF3+GtJYw92V6faNiKVpeKZyWdsSi1ll0vn4xh3l/GvRC+Cz7QLRgKitEJBBTToo2eWdzprj0kZdGPTl42uP9KvZlNFcfHQQ+Hw733y5wCKn/9LsE3Ysyh+d50nVur6awzsBW22uqTac6/jplSS3K9TFmwh38AV5Pgf7B9ou9YdqpzIPgSrf8fJAVGiYRrkQ5sMQ4= X-OriginatorOrg: starfivetech.com X-MS-Exchange-CrossTenant-Network-Message-Id: 83b7d0c7-0a2a-4d2c-817f-08dc11e0820d X-MS-Exchange-CrossTenant-AuthSource: BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jan 2024 13:31:53.3925 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 06fe3fa3-1221-43d3-861b-5a4ee687a85c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: +PUIAxRbZiDYBf3/1mMAgQvgre8aTzMyqP9nAsrY3wdeiDR7zK/g1S74DDt1SkVIPQvsu8iRQsswOvSfhen710BTnd7oe9Zq0KdYPnrGQAU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BJSPR01MB0865 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240110_053211_145880_23C31EEB X-CRM114-Status: GOOD ( 12.19 ) X-BeenThere: linux-riscv@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-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org StarFive JH8100 shares a similar clock and reset design with JH7110. To facilitate the reuse of the file and its functionalities, files containing the "jh71x0" naming convention are renamed to use the "common" wording. Signed-off-by: Sia Jee Heng Reviewed-by: Ley Foon Tan Reviewed-by: Emil Renner Berthing Reviewed-by: Hal Feng --- drivers/clk/starfive/Kconfig | 8 ++++---- drivers/clk/starfive/Makefile | 2 +- .../{clk-starfive-jh71x0.c => clk-starfive-common.c} | 4 ++-- .../{clk-starfive-jh71x0.h => clk-starfive-common.h} | 4 ++-- drivers/clk/starfive/clk-starfive-jh7100-audio.c | 2 +- drivers/clk/starfive/clk-starfive-jh7100.c | 2 +- drivers/clk/starfive/clk-starfive-jh7110.h | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) rename drivers/clk/starfive/{clk-starfive-jh71x0.c => clk-starfive-common.c} (99%) rename drivers/clk/starfive/{clk-starfive-jh71x0.h => clk-starfive-common.h} (97%) diff --git a/drivers/clk/starfive/Kconfig b/drivers/clk/starfive/Kconfig index bd29358ffeec..ff8eace36e64 100644 --- a/drivers/clk/starfive/Kconfig +++ b/drivers/clk/starfive/Kconfig @@ -1,12 +1,12 @@ # SPDX-License-Identifier: GPL-2.0 -config CLK_STARFIVE_JH71X0 +config CLK_STARFIVE_COMMON bool config CLK_STARFIVE_JH7100 bool "StarFive JH7100 clock support" depends on ARCH_STARFIVE || COMPILE_TEST - select CLK_STARFIVE_JH71X0 + select CLK_STARFIVE_COMMON default ARCH_STARFIVE help Say yes here to support the clock controller on the StarFive JH7100 @@ -15,7 +15,7 @@ config CLK_STARFIVE_JH7100 config CLK_STARFIVE_JH7100_AUDIO tristate "StarFive JH7100 audio clock support" depends on CLK_STARFIVE_JH7100 - select CLK_STARFIVE_JH71X0 + select CLK_STARFIVE_COMMON default m if ARCH_STARFIVE help Say Y or M here to support the audio clocks on the StarFive JH7100 @@ -33,7 +33,7 @@ config CLK_STARFIVE_JH7110_SYS bool "StarFive JH7110 system clock support" depends on ARCH_STARFIVE || COMPILE_TEST select AUXILIARY_BUS - select CLK_STARFIVE_JH71X0 + select CLK_STARFIVE_COMMON select RESET_STARFIVE_JH7110 if RESET_CONTROLLER select CLK_STARFIVE_JH7110_PLL default ARCH_STARFIVE diff --git a/drivers/clk/starfive/Makefile b/drivers/clk/starfive/Makefile index 199ac0f37a2f..012f7ee83f8e 100644 --- a/drivers/clk/starfive/Makefile +++ b/drivers/clk/starfive/Makefile @@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-2.0 -obj-$(CONFIG_CLK_STARFIVE_JH71X0) += clk-starfive-jh71x0.o +obj-$(CONFIG_CLK_STARFIVE_COMMON) += clk-starfive-common.o obj-$(CONFIG_CLK_STARFIVE_JH7100) += clk-starfive-jh7100.o obj-$(CONFIG_CLK_STARFIVE_JH7100_AUDIO) += clk-starfive-jh7100-audio.o diff --git a/drivers/clk/starfive/clk-starfive-jh71x0.c b/drivers/clk/starfive/clk-starfive-common.c similarity index 99% rename from drivers/clk/starfive/clk-starfive-jh71x0.c rename to drivers/clk/starfive/clk-starfive-common.c index aebc99264a0b..a12490c97957 100644 --- a/drivers/clk/starfive/clk-starfive-jh71x0.c +++ b/drivers/clk/starfive/clk-starfive-common.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 /* - * StarFive JH71X0 Clock Generator Driver + * StarFive Clock Generator Driver * * Copyright (C) 2021-2022 Emil Renner Berthing */ @@ -10,7 +10,7 @@ #include #include -#include "clk-starfive-jh71x0.h" +#include "clk-starfive-common.h" static struct jh71x0_clk *jh71x0_clk_from(struct clk_hw *hw) { diff --git a/drivers/clk/starfive/clk-starfive-jh71x0.h b/drivers/clk/starfive/clk-starfive-common.h similarity index 97% rename from drivers/clk/starfive/clk-starfive-jh71x0.h rename to drivers/clk/starfive/clk-starfive-common.h index 34bb11c72eb7..1f32f7024e9f 100644 --- a/drivers/clk/starfive/clk-starfive-jh71x0.h +++ b/drivers/clk/starfive/clk-starfive-common.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __CLK_STARFIVE_JH71X0_H -#define __CLK_STARFIVE_JH71X0_H +#ifndef __CLK_STARFIVE_COMMON_H +#define __CLK_STARFIVE_COMMON_H #include #include diff --git a/drivers/clk/starfive/clk-starfive-jh7100-audio.c b/drivers/clk/starfive/clk-starfive-jh7100-audio.c index ee4bda14a40e..dc4c278606d7 100644 --- a/drivers/clk/starfive/clk-starfive-jh7100-audio.c +++ b/drivers/clk/starfive/clk-starfive-jh7100-audio.c @@ -15,7 +15,7 @@ #include -#include "clk-starfive-jh71x0.h" +#include "clk-starfive-common.h" /* external clocks */ #define JH7100_AUDCLK_AUDIO_SRC (JH7100_AUDCLK_END + 0) diff --git a/drivers/clk/starfive/clk-starfive-jh7100.c b/drivers/clk/starfive/clk-starfive-jh7100.c index 69cc11ea7e33..6bb6a6af9f28 100644 --- a/drivers/clk/starfive/clk-starfive-jh7100.c +++ b/drivers/clk/starfive/clk-starfive-jh7100.c @@ -15,7 +15,7 @@ #include -#include "clk-starfive-jh71x0.h" +#include "clk-starfive-common.h" /* external clocks */ #define JH7100_CLK_OSC_SYS (JH7100_CLK_END + 0) diff --git a/drivers/clk/starfive/clk-starfive-jh7110.h b/drivers/clk/starfive/clk-starfive-jh7110.h index 0659adae4d76..6b1bdf860f00 100644 --- a/drivers/clk/starfive/clk-starfive-jh7110.h +++ b/drivers/clk/starfive/clk-starfive-jh7110.h @@ -2,7 +2,7 @@ #ifndef __CLK_STARFIVE_JH7110_H #define __CLK_STARFIVE_JH7110_H -#include "clk-starfive-jh71x0.h" +#include "clk-starfive-common.h" /* top clocks of ISP/VOUT domain from JH7110 SYSCRG */ struct jh7110_top_sysclk { From patchwork Wed Jan 10 13:31:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sia Jee Heng X-Patchwork-Id: 13517553 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 10AF1C47077 for ; Thu, 11 Jan 2024 15:35: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=HvPO/LNkpbIKC7/p1mswrLjVB9Xy+x6dPYgYXxheL0Y=; b=UOpOWsGEKvUC2/ 7vdRoBxxtBejCt1dhrnbXte/o/wEnn/R/C1/e3lYOkwo0PSXYdNVAQhF/h1EWY2godRKgZl92iz6M zlGGgScUY7Dsq7XS/+ldKPS7xUt7PUnc3Y1EMI5bajhdFm6U44C/1aIbq9fGJ5ZgDuP83S2bZiOTk lefwKUwD7SyYXpBJM2tqypGyyelh6jepLMk86+jc4dnxXssg6nTYtZDAQJil57M0fxWkMSS8woMag Wd8DkVKfFXd0yJyHayexXGIOuxqeDH/I5jUSCo8cm4o13BhbGxVYVahqnLcBLNgtrSxgXIDCXbuJj cyjZOJZFbSOoV9C43cxw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rNx5l-000SWz-2k; Thu, 11 Jan 2024 15:35:37 +0000 Received: from mail-sh0chn02on20621.outbound.protection.partner.outlook.cn ([2406:e500:4420:2::621] helo=CHN02-SH0-obe.outbound.protection.partner.outlook.cn) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rNYgn-00Byri-0O for linux-riscv@lists.infradead.org; Wed, 10 Jan 2024 13:32:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jIzptSpjss3sVuVGJI+wGDGTtmG4YJBcMell0VfgwA04iGBaNtg5VeqKAMOLeG2GFYwYd7tPqaoLquVSbWZNF84MFFBE12acqeEU/JGlf7YCI2r1TLg6ZBHaiSiHQ4HTaQqBkAUv3s8Sa8Dndgnc8CQdvb2ugTIrfCjnkukylN0NTYwfZNh4L/w9Rk21J4y7wkp67cPz7LAzHvH8CUtqf7yRt31OZ5/mwm6mdd81Om2BVrWhk4qZ2H0eOkfke1nFeM1O501wUvPsSEP15CVeI454/pXDIpaI4Gz52bP0HPsWtBYSRyCq+ncGprOm/aEAWzROm2bZYm75a15BL6khRA== 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=zw2lDYiuIHeyxxAgbYRC8FD7phPbyyQ37FL92GdvKsU=; b=YHO4LLyUrTkiFOsu4GOvNFXbrNkCA1BsP6Fy/fSPBO0ur6II2U6U3qY08W0qcwnclm3SzNCYGZMrWzcW5N432ueU9CNZ8BLIjPgzEGs+CBQHGR3fzddCDDasw1QKCyAX5KIpnZeowYUCmf9s4W/FvMgd6X+6xYHaAdLiMbiRgMpFJwpfyzLE2Zh4Q9io2U+hwbwWXLNTFPR8xVjz7laqkVw3wubTYZG1McaSA7AICYYHXqTyYxNQfMcarTthqTVkw2PNr1Y4aR88Jb6Hvd7syLsnisg96ce0AwY5VJsLbWMM5+Z/5vOYknMmP9ZRpZsZPlz0JN9cfMdvE2CQ+3lK8A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=starfivetech.com; dmarc=pass action=none header.from=starfivetech.com; dkim=pass header.d=starfivetech.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=starfivetech.com; Received: from BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:f::16) by BJSPR01MB0865.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:e::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.33; Wed, 10 Jan 2024 13:31:57 +0000 Received: from BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn ([fe80::3862:65b4:c857:c4a6]) by BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn ([fe80::3862:65b4:c857:c4a6%4]) with mapi id 15.20.7135.033; Wed, 10 Jan 2024 13:31:57 +0000 From: Sia Jee Heng To: kernel@esmil.dk, conor@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, mturquette@baylibre.com, sboyd@kernel.org, p.zabel@pengutronix.de, emil.renner.berthing@canonical.com, hal.feng@starfivetech.com, xingyu.wu@starfivetech.com Cc: linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, jeeheng.sia@starfivetech.com, leyfoon.tan@starfivetech.com Subject: [RFC v3 04/16] clk: starfive: Convert the word "jh71x0" to "starfive" Date: Wed, 10 Jan 2024 21:31:16 +0800 Message-Id: <20240110133128.286657-5-jeeheng.sia@starfivetech.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240110133128.286657-1-jeeheng.sia@starfivetech.com> References: <20240110133128.286657-1-jeeheng.sia@starfivetech.com> X-ClientProxiedBy: BJXPR01CA0067.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:12::34) To BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:f::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BJSPR01MB0561:EE_|BJSPR01MB0865:EE_ X-MS-Office365-Filtering-Correlation-Id: ed5a7e1d-a0af-4739-bf33-08dc11e0843d X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ah1/VMiPhnameV8UrrRu0qsNpQHbC6lM6S+rEDWeqX4NYv7K6ncIECJSWgtBTwKct9ztiDRQDujmoZcmZbW+UClXmdNXvv3953dF9zJfQsO22GfmCcDzdpx6pOsQAHmbAv0PzOE8ap4xzk021RshQ2LwQc/NOJQOpJhfcWB6jd541WTOKVpD/wsP+oD2BIh2Fn+IWle8tgeApzX3gBFc4LtgCQahbY+W1hFYHBd9eNU5aGsJYzj0+I7+u4XzQrQ6LUskAU5ZiBenUfuNMKYArhLu7TTPB1j2pLP0L5sIF2LwBJmeOE7EWGt6pMFeQQu8Zw+15HkuekEwPP9ILmZkryP8ztGhGLUs+FEmPMzbq2hpXDn6M7ecgfzrswSCmmVkbqmGrBgw1nNcOA6Qfj8HzyvxFXAn9156l95hm1gIy5gdbZEa2s+W4M+j6D3Aqv7mB631ExGOmcDQHImhy+BfYiRy9UPUEYyNJtEuqqHm49R1BgI1FLvoPAPRFpxjVC6Kis65o4kJUNO43uB2IFLBjjjq/hnpTeL+ubLqlz8koDjOkHPRXwjIGpfpHutZQMZv8uOlgUT9OQ2eGPpDyE+yVg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn;PTR:;CAT:NONE;SFS:(13230031)(136003)(396003)(39830400003)(346002)(366004)(230922051799003)(451199024)(186009)(1800799012)(64100799003)(41320700001)(6666004)(508600001)(55236004)(52116002)(2616005)(107886003)(1076003)(26005)(38100700002)(40160700002)(38350700005)(921011)(86362001)(40180700001)(36756003)(41300700001)(4326008)(7416002)(83380400001)(5660300002)(30864003)(2906002)(8936002)(8676002)(66946007)(66556008)(66476007)(6636002)(559001)(579004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ZULXRLxo0T7t05pU/pgDndukb+j0CSRVoFlfV6UVZKI9jeKyN2jiBygyTtnir8c5jxRL3+1zna+3HHlA4P0vN4f73/QAroK8A+zcQomIX8F388ZKhc3sEN0RcOpEPavY4OF3hBRzBfnf006tRaPXnlvPGnKL4GR7xniHmsgUVWso154X38RuuH6X+2/wOgzAGWHSpaZgbU92nsTfMhs/zUtB9t8OLvVrpvNcKHqqjYvxQkUU3klh5lwgmb0jLLRjjPD6xVkBaCrMNtFvJgmkZKsw+dm9Mvko8sE5caAoFmHca2FnJatLyk15gRezNtgrlsCKFvwW/8WgY701kQ2ZFi/4NVWnBccBelZ36i2p+YRBqGX1KTB0i2BnnI6GE8QeRHePUxZww6OgQbGzNiC+ltdlEUj7Py1+XmFPp1NeQxUKKPoDDopCwmzw0IAZLGWhORzULa7NG5cEcHcAbEO+g4gK5ADnSCZiPVHSa6ET3nPDbFp/pR7jibMme+Sl84YXCAd8dmWpBgkV9qSE5AiGQMtQ5uZBG8VWbVIfjs0lknIx39+s1iu/dWKunNThzkytVwLdHOAQbI+sOVQf0nvXdlz7n2q40kydX5W/sHNB+9CG4+G+A11MIiY4seZtIyjiZjwgbOVOoTMiYAQ8p9f6FT8fRIqALBoRn99q5ZpjRGFxjFc45lpbGICY/OlgXLQ4uWOdCcyci+DR05fcXNvjll+oxWMH5NzIMZCbs/LWXos7flp/yqdI7LnsH/suBLnxXMD03IuuxeR4r5DIpggVl+q7mGSE5uvNp8h9HP3eWnqEEJdbYMfgvv4bYMlWDoHXw/iT14ansFXBJCAFNoko9PxivCWqymILsoy8s+6FyKhE1BQmwiyiDswg/ZSnNNFVwjGz40tcC3iEA8M+8WpCuGl++SWzLG7JZ/KR4cCDaz8VNhi+qtcaX+B5+A5TFUBeSBUW4JV6ZBsWHKM3k0AKiiTMIpQD6m+Yl2TRvP89V6Dgm9Ngdqb0PlyNgBvq7TarEahXqPzhygYthO9Gmg90xs69jgUvxBl1YnJl9cAnznvdBju79PQheUWzevfjO8SogPlMHDJjDRrhujmYkUPUERq2Y1CHHmowDz2JLuUyD8FdapjepzLUvDkTiubRufSC0ohUETrRN+HIxrMT0T/vjoFTOi/3HR5+ntmufHznT9pOgrpuTsLWMiKeewoR0BUJUleOyND/2/5/wzqeqV8AOIE7tN4Yzrih2mCDZdzqIfI99OUxKf/8zRUpBnkt+Wt9QseixLdS/oEyw8ih8LuHPp1BvD4gQIpzV8MyauyDDZbWlTOe42sWw8gC2+z459mEUtqN+mLvJOUucGLZf6wIkT5n5Dna5zQTQ4v2e8Xn5EP+KhF7jJxmqMLmj2L8s8Ts9ebNbzJeKsrXWOI/kn4oYAdM/otmsE34ck7tvj2QlGT96NDo/Xf8fJTDHI0drMuM0eRasjjMIbPpfwDgSW0qOw+5Ea4qzXjQxdXdKpVqvpZqFEYQX5fNE6MCz/GX8+oX6leyCc4jemE22vbZmsanBaDEX/xjWIIGTr7A1ioDJHTWyD29mSneQQbduSk/WJxcCSbZuK9veuvm+z9iXisNDvgj77FNCls43pu+oVRPv34= X-OriginatorOrg: starfivetech.com X-MS-Exchange-CrossTenant-Network-Message-Id: ed5a7e1d-a0af-4739-bf33-08dc11e0843d X-MS-Exchange-CrossTenant-AuthSource: BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jan 2024 13:31:57.1196 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 06fe3fa3-1221-43d3-861b-5a4ee687a85c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: gEvZIOK6O1rUhyW0OjuTK/lE6/WvzuH2UTRXIXTKX7fHxDPOTeoRa46/yWUHrzND3jAoRsWD1EsItxF52YAlXYvjTTMAfilDAw/hgNT0MTg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BJSPR01MB0865 X-Mailman-Approved-At: Thu, 11 Jan 2024 07:35:36 -0800 X-BeenThere: linux-riscv@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-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Function names that consist of the 'jh71x0' naming convention are renamed to use the 'starfive' wording. Signed-off-by: Sia Jee Heng Reviewed-by: Ley Foon Tan Reviewed-by: Emil Renner Berthing Reviewed-by: Hal Feng --- drivers/clk/starfive/clk-starfive-common.c | 290 +++++----- drivers/clk/starfive/clk-starfive-common.h | 68 +-- .../clk/starfive/clk-starfive-jh7100-audio.c | 125 ++--- drivers/clk/starfive/clk-starfive-jh7100.c | 501 ++++++++--------- .../clk/starfive/clk-starfive-jh7110-aon.c | 62 +-- .../clk/starfive/clk-starfive-jh7110-isp.c | 72 +-- .../clk/starfive/clk-starfive-jh7110-stg.c | 94 ++-- .../clk/starfive/clk-starfive-jh7110-sys.c | 517 +++++++++--------- .../clk/starfive/clk-starfive-jh7110-vout.c | 74 +-- drivers/clk/starfive/clk-starfive-jh7110.h | 2 +- 10 files changed, 908 insertions(+), 897 deletions(-) diff --git a/drivers/clk/starfive/clk-starfive-common.c b/drivers/clk/starfive/clk-starfive-common.c index a12490c97957..fd608286ca13 100644 --- a/drivers/clk/starfive/clk-starfive-common.c +++ b/drivers/clk/starfive/clk-starfive-common.c @@ -12,27 +12,27 @@ #include "clk-starfive-common.h" -static struct jh71x0_clk *jh71x0_clk_from(struct clk_hw *hw) +static struct starfive_clk *starfive_clk_from(struct clk_hw *hw) { - return container_of(hw, struct jh71x0_clk, hw); + return container_of(hw, struct starfive_clk, hw); } -static struct jh71x0_clk_priv *jh71x0_priv_from(struct jh71x0_clk *clk) +static struct starfive_clk_priv *starfive_priv_from(struct starfive_clk *clk) { - return container_of(clk, struct jh71x0_clk_priv, reg[clk->idx]); + return container_of(clk, struct starfive_clk_priv, reg[clk->idx]); } -static u32 jh71x0_clk_reg_get(struct jh71x0_clk *clk) +static u32 starfive_clk_reg_get(struct starfive_clk *clk) { - struct jh71x0_clk_priv *priv = jh71x0_priv_from(clk); + struct starfive_clk_priv *priv = starfive_priv_from(clk); void __iomem *reg = priv->base + 4 * clk->idx; return readl_relaxed(reg); } -static void jh71x0_clk_reg_rmw(struct jh71x0_clk *clk, u32 mask, u32 value) +static void starfive_clk_reg_rmw(struct starfive_clk *clk, u32 mask, u32 value) { - struct jh71x0_clk_priv *priv = jh71x0_priv_from(clk); + struct starfive_clk_priv *priv = starfive_priv_from(clk); void __iomem *reg = priv->base + 4 * clk->idx; unsigned long flags; @@ -42,41 +42,41 @@ static void jh71x0_clk_reg_rmw(struct jh71x0_clk *clk, u32 mask, u32 value) spin_unlock_irqrestore(&priv->rmw_lock, flags); } -static int jh71x0_clk_enable(struct clk_hw *hw) +static int starfive_clk_enable(struct clk_hw *hw) { - struct jh71x0_clk *clk = jh71x0_clk_from(hw); + struct starfive_clk *clk = starfive_clk_from(hw); - jh71x0_clk_reg_rmw(clk, JH71X0_CLK_ENABLE, JH71X0_CLK_ENABLE); + starfive_clk_reg_rmw(clk, STARFIVE_CLK_ENABLE, STARFIVE_CLK_ENABLE); return 0; } -static void jh71x0_clk_disable(struct clk_hw *hw) +static void starfive_clk_disable(struct clk_hw *hw) { - struct jh71x0_clk *clk = jh71x0_clk_from(hw); + struct starfive_clk *clk = starfive_clk_from(hw); - jh71x0_clk_reg_rmw(clk, JH71X0_CLK_ENABLE, 0); + starfive_clk_reg_rmw(clk, STARFIVE_CLK_ENABLE, 0); } -static int jh71x0_clk_is_enabled(struct clk_hw *hw) +static int starfive_clk_is_enabled(struct clk_hw *hw) { - struct jh71x0_clk *clk = jh71x0_clk_from(hw); + struct starfive_clk *clk = starfive_clk_from(hw); - return !!(jh71x0_clk_reg_get(clk) & JH71X0_CLK_ENABLE); + return !!(starfive_clk_reg_get(clk) & STARFIVE_CLK_ENABLE); } -static unsigned long jh71x0_clk_recalc_rate(struct clk_hw *hw, - unsigned long parent_rate) +static unsigned long starfive_clk_recalc_rate(struct clk_hw *hw, + unsigned long parent_rate) { - struct jh71x0_clk *clk = jh71x0_clk_from(hw); - u32 div = jh71x0_clk_reg_get(clk) & JH71X0_CLK_DIV_MASK; + struct starfive_clk *clk = starfive_clk_from(hw); + u32 div = starfive_clk_reg_get(clk) & STARFIVE_CLK_DIV_MASK; return div ? parent_rate / div : 0; } -static int jh71x0_clk_determine_rate(struct clk_hw *hw, - struct clk_rate_request *req) +static int starfive_clk_determine_rate(struct clk_hw *hw, + struct clk_rate_request *req) { - struct jh71x0_clk *clk = jh71x0_clk_from(hw); + struct starfive_clk *clk = starfive_clk_from(hw); unsigned long parent = req->best_parent_rate; unsigned long rate = clamp(req->rate, req->min_rate, req->max_rate); unsigned long div = min_t(unsigned long, DIV_ROUND_UP(parent, rate), clk->max_div); @@ -102,226 +102,226 @@ static int jh71x0_clk_determine_rate(struct clk_hw *hw, return 0; } -static int jh71x0_clk_set_rate(struct clk_hw *hw, - unsigned long rate, - unsigned long parent_rate) +static int starfive_clk_set_rate(struct clk_hw *hw, + unsigned long rate, + unsigned long parent_rate) { - struct jh71x0_clk *clk = jh71x0_clk_from(hw); + struct starfive_clk *clk = starfive_clk_from(hw); unsigned long div = clamp(DIV_ROUND_CLOSEST(parent_rate, rate), 1UL, (unsigned long)clk->max_div); - jh71x0_clk_reg_rmw(clk, JH71X0_CLK_DIV_MASK, div); + starfive_clk_reg_rmw(clk, STARFIVE_CLK_DIV_MASK, div); return 0; } -static unsigned long jh71x0_clk_frac_recalc_rate(struct clk_hw *hw, - unsigned long parent_rate) +static unsigned long starfive_clk_frac_recalc_rate(struct clk_hw *hw, + unsigned long parent_rate) { - struct jh71x0_clk *clk = jh71x0_clk_from(hw); - u32 reg = jh71x0_clk_reg_get(clk); - unsigned long div100 = 100 * (reg & JH71X0_CLK_INT_MASK) + - ((reg & JH71X0_CLK_FRAC_MASK) >> JH71X0_CLK_FRAC_SHIFT); + struct starfive_clk *clk = starfive_clk_from(hw); + u32 reg = starfive_clk_reg_get(clk); + unsigned long div100 = 100 * (reg & STARFIVE_CLK_INT_MASK) + + ((reg & STARFIVE_CLK_FRAC_MASK) >> STARFIVE_CLK_FRAC_SHIFT); - return (div100 >= JH71X0_CLK_FRAC_MIN) ? 100 * parent_rate / div100 : 0; + return (div100 >= STARFIVE_CLK_FRAC_MIN) ? 100 * parent_rate / div100 : 0; } -static int jh71x0_clk_frac_determine_rate(struct clk_hw *hw, - struct clk_rate_request *req) +static int starfive_clk_frac_determine_rate(struct clk_hw *hw, + struct clk_rate_request *req) { unsigned long parent100 = 100 * req->best_parent_rate; unsigned long rate = clamp(req->rate, req->min_rate, req->max_rate); unsigned long div100 = clamp(DIV_ROUND_CLOSEST(parent100, rate), - JH71X0_CLK_FRAC_MIN, JH71X0_CLK_FRAC_MAX); + STARFIVE_CLK_FRAC_MIN, STARFIVE_CLK_FRAC_MAX); unsigned long result = parent100 / div100; - /* clamp the result as in jh71x0_clk_determine_rate() above */ - if (result > req->max_rate && div100 < JH71X0_CLK_FRAC_MAX) + /* clamp the result as in starfive_clk_determine_rate() above */ + if (result > req->max_rate && div100 < STARFIVE_CLK_FRAC_MAX) result = parent100 / (div100 + 1); - if (result < req->min_rate && div100 > JH71X0_CLK_FRAC_MIN) + if (result < req->min_rate && div100 > STARFIVE_CLK_FRAC_MIN) result = parent100 / (div100 - 1); req->rate = result; return 0; } -static int jh71x0_clk_frac_set_rate(struct clk_hw *hw, - unsigned long rate, - unsigned long parent_rate) +static int starfive_clk_frac_set_rate(struct clk_hw *hw, + unsigned long rate, + unsigned long parent_rate) { - struct jh71x0_clk *clk = jh71x0_clk_from(hw); + struct starfive_clk *clk = starfive_clk_from(hw); unsigned long div100 = clamp(DIV_ROUND_CLOSEST(100 * parent_rate, rate), - JH71X0_CLK_FRAC_MIN, JH71X0_CLK_FRAC_MAX); - u32 value = ((div100 % 100) << JH71X0_CLK_FRAC_SHIFT) | (div100 / 100); + STARFIVE_CLK_FRAC_MIN, STARFIVE_CLK_FRAC_MAX); + u32 value = ((div100 % 100) << STARFIVE_CLK_FRAC_SHIFT) | (div100 / 100); - jh71x0_clk_reg_rmw(clk, JH71X0_CLK_DIV_MASK, value); + starfive_clk_reg_rmw(clk, STARFIVE_CLK_DIV_MASK, value); return 0; } -static u8 jh71x0_clk_get_parent(struct clk_hw *hw) +static u8 starfive_clk_get_parent(struct clk_hw *hw) { - struct jh71x0_clk *clk = jh71x0_clk_from(hw); - u32 value = jh71x0_clk_reg_get(clk); + struct starfive_clk *clk = starfive_clk_from(hw); + u32 value = starfive_clk_reg_get(clk); - return (value & JH71X0_CLK_MUX_MASK) >> JH71X0_CLK_MUX_SHIFT; + return (value & STARFIVE_CLK_MUX_MASK) >> STARFIVE_CLK_MUX_SHIFT; } -static int jh71x0_clk_set_parent(struct clk_hw *hw, u8 index) +static int starfive_clk_set_parent(struct clk_hw *hw, u8 index) { - struct jh71x0_clk *clk = jh71x0_clk_from(hw); - u32 value = (u32)index << JH71X0_CLK_MUX_SHIFT; + struct starfive_clk *clk = starfive_clk_from(hw); + u32 value = (u32)index << STARFIVE_CLK_MUX_SHIFT; - jh71x0_clk_reg_rmw(clk, JH71X0_CLK_MUX_MASK, value); + starfive_clk_reg_rmw(clk, STARFIVE_CLK_MUX_MASK, value); return 0; } -static int jh71x0_clk_get_phase(struct clk_hw *hw) +static int starfive_clk_get_phase(struct clk_hw *hw) { - struct jh71x0_clk *clk = jh71x0_clk_from(hw); - u32 value = jh71x0_clk_reg_get(clk); + struct starfive_clk *clk = starfive_clk_from(hw); + u32 value = starfive_clk_reg_get(clk); - return (value & JH71X0_CLK_INVERT) ? 180 : 0; + return (value & STARFIVE_CLK_INVERT) ? 180 : 0; } -static int jh71x0_clk_set_phase(struct clk_hw *hw, int degrees) +static int starfive_clk_set_phase(struct clk_hw *hw, int degrees) { - struct jh71x0_clk *clk = jh71x0_clk_from(hw); + struct starfive_clk *clk = starfive_clk_from(hw); u32 value; if (degrees == 0) value = 0; else if (degrees == 180) - value = JH71X0_CLK_INVERT; + value = STARFIVE_CLK_INVERT; else return -EINVAL; - jh71x0_clk_reg_rmw(clk, JH71X0_CLK_INVERT, value); + starfive_clk_reg_rmw(clk, STARFIVE_CLK_INVERT, value); return 0; } #ifdef CONFIG_DEBUG_FS -static void jh71x0_clk_debug_init(struct clk_hw *hw, struct dentry *dentry) +static void starfive_clk_debug_init(struct clk_hw *hw, struct dentry *dentry) { - static const struct debugfs_reg32 jh71x0_clk_reg = { + static const struct debugfs_reg32 starfive_clk_reg = { .name = "CTRL", .offset = 0, }; - struct jh71x0_clk *clk = jh71x0_clk_from(hw); - struct jh71x0_clk_priv *priv = jh71x0_priv_from(clk); + struct starfive_clk *clk = starfive_clk_from(hw); + struct starfive_clk_priv *priv = starfive_priv_from(clk); struct debugfs_regset32 *regset; regset = devm_kzalloc(priv->dev, sizeof(*regset), GFP_KERNEL); if (!regset) return; - regset->regs = &jh71x0_clk_reg; + regset->regs = &starfive_clk_reg; regset->nregs = 1; regset->base = priv->base + 4 * clk->idx; debugfs_create_regset32("registers", 0400, dentry, regset); } #else -#define jh71x0_clk_debug_init NULL +#define starfive_clk_debug_init NULL #endif -static const struct clk_ops jh71x0_clk_gate_ops = { - .enable = jh71x0_clk_enable, - .disable = jh71x0_clk_disable, - .is_enabled = jh71x0_clk_is_enabled, - .debug_init = jh71x0_clk_debug_init, +static const struct clk_ops starfive_clk_gate_ops = { + .enable = starfive_clk_enable, + .disable = starfive_clk_disable, + .is_enabled = starfive_clk_is_enabled, + .debug_init = starfive_clk_debug_init, }; -static const struct clk_ops jh71x0_clk_div_ops = { - .recalc_rate = jh71x0_clk_recalc_rate, - .determine_rate = jh71x0_clk_determine_rate, - .set_rate = jh71x0_clk_set_rate, - .debug_init = jh71x0_clk_debug_init, +static const struct clk_ops starfive_clk_div_ops = { + .recalc_rate = starfive_clk_recalc_rate, + .determine_rate = starfive_clk_determine_rate, + .set_rate = starfive_clk_set_rate, + .debug_init = starfive_clk_debug_init, }; -static const struct clk_ops jh71x0_clk_fdiv_ops = { - .recalc_rate = jh71x0_clk_frac_recalc_rate, - .determine_rate = jh71x0_clk_frac_determine_rate, - .set_rate = jh71x0_clk_frac_set_rate, - .debug_init = jh71x0_clk_debug_init, +static const struct clk_ops starfive_clk_fdiv_ops = { + .recalc_rate = starfive_clk_frac_recalc_rate, + .determine_rate = starfive_clk_frac_determine_rate, + .set_rate = starfive_clk_frac_set_rate, + .debug_init = starfive_clk_debug_init, }; -static const struct clk_ops jh71x0_clk_gdiv_ops = { - .enable = jh71x0_clk_enable, - .disable = jh71x0_clk_disable, - .is_enabled = jh71x0_clk_is_enabled, - .recalc_rate = jh71x0_clk_recalc_rate, - .determine_rate = jh71x0_clk_determine_rate, - .set_rate = jh71x0_clk_set_rate, - .debug_init = jh71x0_clk_debug_init, +static const struct clk_ops starfive_clk_gdiv_ops = { + .enable = starfive_clk_enable, + .disable = starfive_clk_disable, + .is_enabled = starfive_clk_is_enabled, + .recalc_rate = starfive_clk_recalc_rate, + .determine_rate = starfive_clk_determine_rate, + .set_rate = starfive_clk_set_rate, + .debug_init = starfive_clk_debug_init, }; -static const struct clk_ops jh71x0_clk_mux_ops = { +static const struct clk_ops starfive_clk_mux_ops = { .determine_rate = __clk_mux_determine_rate, - .set_parent = jh71x0_clk_set_parent, - .get_parent = jh71x0_clk_get_parent, - .debug_init = jh71x0_clk_debug_init, + .set_parent = starfive_clk_set_parent, + .get_parent = starfive_clk_get_parent, + .debug_init = starfive_clk_debug_init, }; -static const struct clk_ops jh71x0_clk_gmux_ops = { - .enable = jh71x0_clk_enable, - .disable = jh71x0_clk_disable, - .is_enabled = jh71x0_clk_is_enabled, +static const struct clk_ops starfive_clk_gmux_ops = { + .enable = starfive_clk_enable, + .disable = starfive_clk_disable, + .is_enabled = starfive_clk_is_enabled, .determine_rate = __clk_mux_determine_rate, - .set_parent = jh71x0_clk_set_parent, - .get_parent = jh71x0_clk_get_parent, - .debug_init = jh71x0_clk_debug_init, + .set_parent = starfive_clk_set_parent, + .get_parent = starfive_clk_get_parent, + .debug_init = starfive_clk_debug_init, }; -static const struct clk_ops jh71x0_clk_mdiv_ops = { - .recalc_rate = jh71x0_clk_recalc_rate, - .determine_rate = jh71x0_clk_determine_rate, - .get_parent = jh71x0_clk_get_parent, - .set_parent = jh71x0_clk_set_parent, - .set_rate = jh71x0_clk_set_rate, - .debug_init = jh71x0_clk_debug_init, +static const struct clk_ops starfive_clk_mdiv_ops = { + .recalc_rate = starfive_clk_recalc_rate, + .determine_rate = starfive_clk_determine_rate, + .get_parent = starfive_clk_get_parent, + .set_parent = starfive_clk_set_parent, + .set_rate = starfive_clk_set_rate, + .debug_init = starfive_clk_debug_init, }; -static const struct clk_ops jh71x0_clk_gmd_ops = { - .enable = jh71x0_clk_enable, - .disable = jh71x0_clk_disable, - .is_enabled = jh71x0_clk_is_enabled, - .recalc_rate = jh71x0_clk_recalc_rate, - .determine_rate = jh71x0_clk_determine_rate, - .get_parent = jh71x0_clk_get_parent, - .set_parent = jh71x0_clk_set_parent, - .set_rate = jh71x0_clk_set_rate, - .debug_init = jh71x0_clk_debug_init, +static const struct clk_ops starfive_clk_gmd_ops = { + .enable = starfive_clk_enable, + .disable = starfive_clk_disable, + .is_enabled = starfive_clk_is_enabled, + .recalc_rate = starfive_clk_recalc_rate, + .determine_rate = starfive_clk_determine_rate, + .get_parent = starfive_clk_get_parent, + .set_parent = starfive_clk_set_parent, + .set_rate = starfive_clk_set_rate, + .debug_init = starfive_clk_debug_init, }; -static const struct clk_ops jh71x0_clk_inv_ops = { - .get_phase = jh71x0_clk_get_phase, - .set_phase = jh71x0_clk_set_phase, - .debug_init = jh71x0_clk_debug_init, +static const struct clk_ops starfive_clk_inv_ops = { + .get_phase = starfive_clk_get_phase, + .set_phase = starfive_clk_set_phase, + .debug_init = starfive_clk_debug_init, }; -const struct clk_ops *starfive_jh71x0_clk_ops(u32 max) +const struct clk_ops *starfive_clk_ops(u32 max) { - if (max & JH71X0_CLK_DIV_MASK) { - if (max & JH71X0_CLK_MUX_MASK) { - if (max & JH71X0_CLK_ENABLE) - return &jh71x0_clk_gmd_ops; - return &jh71x0_clk_mdiv_ops; + if (max & STARFIVE_CLK_DIV_MASK) { + if (max & STARFIVE_CLK_MUX_MASK) { + if (max & STARFIVE_CLK_ENABLE) + return &starfive_clk_gmd_ops; + return &starfive_clk_mdiv_ops; } - if (max & JH71X0_CLK_ENABLE) - return &jh71x0_clk_gdiv_ops; - if (max == JH71X0_CLK_FRAC_MAX) - return &jh71x0_clk_fdiv_ops; - return &jh71x0_clk_div_ops; + if (max & STARFIVE_CLK_ENABLE) + return &starfive_clk_gdiv_ops; + if (max == STARFIVE_CLK_FRAC_MAX) + return &starfive_clk_fdiv_ops; + return &starfive_clk_div_ops; } - if (max & JH71X0_CLK_MUX_MASK) { - if (max & JH71X0_CLK_ENABLE) - return &jh71x0_clk_gmux_ops; - return &jh71x0_clk_mux_ops; + if (max & STARFIVE_CLK_MUX_MASK) { + if (max & STARFIVE_CLK_ENABLE) + return &starfive_clk_gmux_ops; + return &starfive_clk_mux_ops; } - if (max & JH71X0_CLK_ENABLE) - return &jh71x0_clk_gate_ops; + if (max & STARFIVE_CLK_ENABLE) + return &starfive_clk_gate_ops; - return &jh71x0_clk_inv_ops; + return &starfive_clk_inv_ops; } -EXPORT_SYMBOL_GPL(starfive_jh71x0_clk_ops); +EXPORT_SYMBOL_GPL(starfive_clk_ops); diff --git a/drivers/clk/starfive/clk-starfive-common.h b/drivers/clk/starfive/clk-starfive-common.h index 1f32f7024e9f..fed45311360c 100644 --- a/drivers/clk/starfive/clk-starfive-common.h +++ b/drivers/clk/starfive/clk-starfive-common.h @@ -8,36 +8,36 @@ #include /* register fields */ -#define JH71X0_CLK_ENABLE BIT(31) -#define JH71X0_CLK_INVERT BIT(30) -#define JH71X0_CLK_MUX_MASK GENMASK(27, 24) -#define JH71X0_CLK_MUX_SHIFT 24 -#define JH71X0_CLK_DIV_MASK GENMASK(23, 0) -#define JH71X0_CLK_FRAC_MASK GENMASK(15, 8) -#define JH71X0_CLK_FRAC_SHIFT 8 -#define JH71X0_CLK_INT_MASK GENMASK(7, 0) +#define STARFIVE_CLK_ENABLE BIT(31) +#define STARFIVE_CLK_INVERT BIT(30) +#define STARFIVE_CLK_MUX_MASK GENMASK(27, 24) +#define STARFIVE_CLK_MUX_SHIFT 24 +#define STARFIVE_CLK_DIV_MASK GENMASK(23, 0) +#define STARFIVE_CLK_FRAC_MASK GENMASK(15, 8) +#define STARFIVE_CLK_FRAC_SHIFT 8 +#define STARFIVE_CLK_INT_MASK GENMASK(7, 0) /* fractional divider min/max */ -#define JH71X0_CLK_FRAC_MIN 100UL -#define JH71X0_CLK_FRAC_MAX 25599UL +#define STARFIVE_CLK_FRAC_MIN 100UL +#define STARFIVE_CLK_FRAC_MAX 25599UL /* clock data */ -struct jh71x0_clk_data { +struct starfive_clk_data { const char *name; unsigned long flags; u32 max; u8 parents[4]; }; -#define JH71X0_GATE(_idx, _name, _flags, _parent) \ +#define STARFIVE_GATE(_idx, _name, _flags, _parent) \ [_idx] = { \ .name = _name, \ .flags = CLK_SET_RATE_PARENT | (_flags), \ - .max = JH71X0_CLK_ENABLE, \ + .max = STARFIVE_CLK_ENABLE, \ .parents = { [0] = _parent }, \ } -#define JH71X0__DIV(_idx, _name, _max, _parent) \ +#define STARFIVE__DIV(_idx, _name, _max, _parent) \ [_idx] = { \ .name = _name, \ .flags = 0, \ @@ -45,79 +45,79 @@ struct jh71x0_clk_data { .parents = { [0] = _parent }, \ } -#define JH71X0_GDIV(_idx, _name, _flags, _max, _parent) \ +#define STARFIVE_GDIV(_idx, _name, _flags, _max, _parent) \ [_idx] = { \ .name = _name, \ .flags = _flags, \ - .max = JH71X0_CLK_ENABLE | (_max), \ + .max = STARFIVE_CLK_ENABLE | (_max), \ .parents = { [0] = _parent }, \ } -#define JH71X0_FDIV(_idx, _name, _parent) \ +#define STARFIVE_FDIV(_idx, _name, _parent) \ [_idx] = { \ .name = _name, \ .flags = 0, \ - .max = JH71X0_CLK_FRAC_MAX, \ + .max = STARFIVE_CLK_FRAC_MAX, \ .parents = { [0] = _parent }, \ } -#define JH71X0__MUX(_idx, _name, _nparents, ...) \ +#define STARFIVE__MUX(_idx, _name, _nparents, ...) \ [_idx] = { \ .name = _name, \ .flags = 0, \ - .max = ((_nparents) - 1) << JH71X0_CLK_MUX_SHIFT, \ + .max = ((_nparents) - 1) << STARFIVE_CLK_MUX_SHIFT, \ .parents = { __VA_ARGS__ }, \ } -#define JH71X0_GMUX(_idx, _name, _flags, _nparents, ...) \ +#define STARFIVE_GMUX(_idx, _name, _flags, _nparents, ...) \ [_idx] = { \ .name = _name, \ .flags = _flags, \ - .max = JH71X0_CLK_ENABLE | \ - (((_nparents) - 1) << JH71X0_CLK_MUX_SHIFT), \ + .max = STARFIVE_CLK_ENABLE | \ + (((_nparents) - 1) << STARFIVE_CLK_MUX_SHIFT), \ .parents = { __VA_ARGS__ }, \ } -#define JH71X0_MDIV(_idx, _name, _max, _nparents, ...) \ +#define STARFIVE_MDIV(_idx, _name, _max, _nparents, ...) \ [_idx] = { \ .name = _name, \ .flags = 0, \ - .max = (((_nparents) - 1) << JH71X0_CLK_MUX_SHIFT) | (_max), \ + .max = (((_nparents) - 1) << STARFIVE_CLK_MUX_SHIFT) | (_max), \ .parents = { __VA_ARGS__ }, \ } -#define JH71X0__GMD(_idx, _name, _flags, _max, _nparents, ...) \ +#define STARFIVE__GMD(_idx, _name, _flags, _max, _nparents, ...) \ [_idx] = { \ .name = _name, \ .flags = _flags, \ - .max = JH71X0_CLK_ENABLE | \ - (((_nparents) - 1) << JH71X0_CLK_MUX_SHIFT) | (_max), \ + .max = STARFIVE_CLK_ENABLE | \ + (((_nparents) - 1) << STARFIVE_CLK_MUX_SHIFT) | (_max), \ .parents = { __VA_ARGS__ }, \ } -#define JH71X0__INV(_idx, _name, _parent) \ +#define STARFIVE__INV(_idx, _name, _parent) \ [_idx] = { \ .name = _name, \ .flags = CLK_SET_RATE_PARENT, \ - .max = JH71X0_CLK_INVERT, \ + .max = STARFIVE_CLK_INVERT, \ .parents = { [0] = _parent }, \ } -struct jh71x0_clk { +struct starfive_clk { struct clk_hw hw; unsigned int idx; unsigned int max_div; }; -struct jh71x0_clk_priv { +struct starfive_clk_priv { /* protect clk enable and set rate/parent from happening at the same time */ spinlock_t rmw_lock; struct device *dev; void __iomem *base; struct clk_hw *pll[3]; - struct jh71x0_clk reg[]; + struct starfive_clk reg[]; }; -const struct clk_ops *starfive_jh71x0_clk_ops(u32 max); +const struct clk_ops *starfive_clk_ops(u32 max); #endif diff --git a/drivers/clk/starfive/clk-starfive-jh7100-audio.c b/drivers/clk/starfive/clk-starfive-jh7100-audio.c index dc4c278606d7..dfe2befddce5 100644 --- a/drivers/clk/starfive/clk-starfive-jh7100-audio.c +++ b/drivers/clk/starfive/clk-starfive-jh7100-audio.c @@ -27,66 +27,68 @@ #define JH7100_AUDCLK_I2SDAC_LRCLK_IOPAD (JH7100_AUDCLK_END + 6) #define JH7100_AUDCLK_VAD_INTMEM (JH7100_AUDCLK_END + 7) -static const struct jh71x0_clk_data jh7100_audclk_data[] = { - JH71X0__GMD(JH7100_AUDCLK_ADC_MCLK, "adc_mclk", 0, 15, 2, - JH7100_AUDCLK_AUDIO_SRC, - JH7100_AUDCLK_AUDIO_12288), - JH71X0__GMD(JH7100_AUDCLK_I2S1_MCLK, "i2s1_mclk", 0, 15, 2, - JH7100_AUDCLK_AUDIO_SRC, - JH7100_AUDCLK_AUDIO_12288), - JH71X0_GATE(JH7100_AUDCLK_I2SADC_APB, "i2sadc_apb", 0, JH7100_AUDCLK_APB0_BUS), - JH71X0_MDIV(JH7100_AUDCLK_I2SADC_BCLK, "i2sadc_bclk", 31, 2, - JH7100_AUDCLK_ADC_MCLK, - JH7100_AUDCLK_I2SADC_BCLK_IOPAD), - JH71X0__INV(JH7100_AUDCLK_I2SADC_BCLK_N, "i2sadc_bclk_n", JH7100_AUDCLK_I2SADC_BCLK), - JH71X0_MDIV(JH7100_AUDCLK_I2SADC_LRCLK, "i2sadc_lrclk", 63, 3, - JH7100_AUDCLK_I2SADC_BCLK_N, - JH7100_AUDCLK_I2SADC_LRCLK_IOPAD, - JH7100_AUDCLK_I2SADC_BCLK), - JH71X0_GATE(JH7100_AUDCLK_PDM_APB, "pdm_apb", 0, JH7100_AUDCLK_APB0_BUS), - JH71X0__GMD(JH7100_AUDCLK_PDM_MCLK, "pdm_mclk", 0, 15, 2, - JH7100_AUDCLK_AUDIO_SRC, - JH7100_AUDCLK_AUDIO_12288), - JH71X0_GATE(JH7100_AUDCLK_I2SVAD_APB, "i2svad_apb", 0, JH7100_AUDCLK_APB0_BUS), - JH71X0__GMD(JH7100_AUDCLK_SPDIF, "spdif", 0, 15, 2, - JH7100_AUDCLK_AUDIO_SRC, - JH7100_AUDCLK_AUDIO_12288), - JH71X0_GATE(JH7100_AUDCLK_SPDIF_APB, "spdif_apb", 0, JH7100_AUDCLK_APB0_BUS), - JH71X0_GATE(JH7100_AUDCLK_PWMDAC_APB, "pwmdac_apb", 0, JH7100_AUDCLK_APB0_BUS), - JH71X0__GMD(JH7100_AUDCLK_DAC_MCLK, "dac_mclk", 0, 15, 2, - JH7100_AUDCLK_AUDIO_SRC, - JH7100_AUDCLK_AUDIO_12288), - JH71X0_GATE(JH7100_AUDCLK_I2SDAC_APB, "i2sdac_apb", 0, JH7100_AUDCLK_APB0_BUS), - JH71X0_MDIV(JH7100_AUDCLK_I2SDAC_BCLK, "i2sdac_bclk", 31, 2, - JH7100_AUDCLK_DAC_MCLK, - JH7100_AUDCLK_I2SDAC_BCLK_IOPAD), - JH71X0__INV(JH7100_AUDCLK_I2SDAC_BCLK_N, "i2sdac_bclk_n", JH7100_AUDCLK_I2SDAC_BCLK), - JH71X0_MDIV(JH7100_AUDCLK_I2SDAC_LRCLK, "i2sdac_lrclk", 31, 2, - JH7100_AUDCLK_I2S1_MCLK, - JH7100_AUDCLK_I2SDAC_BCLK_IOPAD), - JH71X0_GATE(JH7100_AUDCLK_I2S1_APB, "i2s1_apb", 0, JH7100_AUDCLK_APB0_BUS), - JH71X0_MDIV(JH7100_AUDCLK_I2S1_BCLK, "i2s1_bclk", 31, 2, - JH7100_AUDCLK_I2S1_MCLK, - JH7100_AUDCLK_I2SDAC_BCLK_IOPAD), - JH71X0__INV(JH7100_AUDCLK_I2S1_BCLK_N, "i2s1_bclk_n", JH7100_AUDCLK_I2S1_BCLK), - JH71X0_MDIV(JH7100_AUDCLK_I2S1_LRCLK, "i2s1_lrclk", 63, 3, - JH7100_AUDCLK_I2S1_BCLK_N, - JH7100_AUDCLK_I2SDAC_LRCLK_IOPAD), - JH71X0_GATE(JH7100_AUDCLK_I2SDAC16K_APB, "i2s1dac16k_apb", 0, JH7100_AUDCLK_APB0_BUS), - JH71X0__DIV(JH7100_AUDCLK_APB0_BUS, "apb0_bus", 8, JH7100_AUDCLK_DOM7AHB_BUS), - JH71X0_GATE(JH7100_AUDCLK_DMA1P_AHB, "dma1p_ahb", 0, JH7100_AUDCLK_DOM7AHB_BUS), - JH71X0_GATE(JH7100_AUDCLK_USB_APB, "usb_apb", CLK_IGNORE_UNUSED, JH7100_AUDCLK_APB_EN), - JH71X0_GDIV(JH7100_AUDCLK_USB_LPM, "usb_lpm", CLK_IGNORE_UNUSED, 4, JH7100_AUDCLK_USB_APB), - JH71X0_GDIV(JH7100_AUDCLK_USB_STB, "usb_stb", CLK_IGNORE_UNUSED, 3, JH7100_AUDCLK_USB_APB), - JH71X0__DIV(JH7100_AUDCLK_APB_EN, "apb_en", 8, JH7100_AUDCLK_DOM7AHB_BUS), - JH71X0__MUX(JH7100_AUDCLK_VAD_MEM, "vad_mem", 2, - JH7100_AUDCLK_VAD_INTMEM, - JH7100_AUDCLK_AUDIO_12288), +static const struct starfive_clk_data jh7100_audclk_data[] = { + STARFIVE__GMD(JH7100_AUDCLK_ADC_MCLK, "adc_mclk", 0, 15, 2, + JH7100_AUDCLK_AUDIO_SRC, + JH7100_AUDCLK_AUDIO_12288), + STARFIVE__GMD(JH7100_AUDCLK_I2S1_MCLK, "i2s1_mclk", 0, 15, 2, + JH7100_AUDCLK_AUDIO_SRC, + JH7100_AUDCLK_AUDIO_12288), + STARFIVE_GATE(JH7100_AUDCLK_I2SADC_APB, "i2sadc_apb", 0, JH7100_AUDCLK_APB0_BUS), + STARFIVE_MDIV(JH7100_AUDCLK_I2SADC_BCLK, "i2sadc_bclk", 31, 2, + JH7100_AUDCLK_ADC_MCLK, + JH7100_AUDCLK_I2SADC_BCLK_IOPAD), + STARFIVE__INV(JH7100_AUDCLK_I2SADC_BCLK_N, "i2sadc_bclk_n", JH7100_AUDCLK_I2SADC_BCLK), + STARFIVE_MDIV(JH7100_AUDCLK_I2SADC_LRCLK, "i2sadc_lrclk", 63, 3, + JH7100_AUDCLK_I2SADC_BCLK_N, + JH7100_AUDCLK_I2SADC_LRCLK_IOPAD, + JH7100_AUDCLK_I2SADC_BCLK), + STARFIVE_GATE(JH7100_AUDCLK_PDM_APB, "pdm_apb", 0, JH7100_AUDCLK_APB0_BUS), + STARFIVE__GMD(JH7100_AUDCLK_PDM_MCLK, "pdm_mclk", 0, 15, 2, + JH7100_AUDCLK_AUDIO_SRC, + JH7100_AUDCLK_AUDIO_12288), + STARFIVE_GATE(JH7100_AUDCLK_I2SVAD_APB, "i2svad_apb", 0, JH7100_AUDCLK_APB0_BUS), + STARFIVE__GMD(JH7100_AUDCLK_SPDIF, "spdif", 0, 15, 2, + JH7100_AUDCLK_AUDIO_SRC, + JH7100_AUDCLK_AUDIO_12288), + STARFIVE_GATE(JH7100_AUDCLK_SPDIF_APB, "spdif_apb", 0, JH7100_AUDCLK_APB0_BUS), + STARFIVE_GATE(JH7100_AUDCLK_PWMDAC_APB, "pwmdac_apb", 0, JH7100_AUDCLK_APB0_BUS), + STARFIVE__GMD(JH7100_AUDCLK_DAC_MCLK, "dac_mclk", 0, 15, 2, + JH7100_AUDCLK_AUDIO_SRC, + JH7100_AUDCLK_AUDIO_12288), + STARFIVE_GATE(JH7100_AUDCLK_I2SDAC_APB, "i2sdac_apb", 0, JH7100_AUDCLK_APB0_BUS), + STARFIVE_MDIV(JH7100_AUDCLK_I2SDAC_BCLK, "i2sdac_bclk", 31, 2, + JH7100_AUDCLK_DAC_MCLK, + JH7100_AUDCLK_I2SDAC_BCLK_IOPAD), + STARFIVE__INV(JH7100_AUDCLK_I2SDAC_BCLK_N, "i2sdac_bclk_n", JH7100_AUDCLK_I2SDAC_BCLK), + STARFIVE_MDIV(JH7100_AUDCLK_I2SDAC_LRCLK, "i2sdac_lrclk", 31, 2, + JH7100_AUDCLK_I2S1_MCLK, + JH7100_AUDCLK_I2SDAC_BCLK_IOPAD), + STARFIVE_GATE(JH7100_AUDCLK_I2S1_APB, "i2s1_apb", 0, JH7100_AUDCLK_APB0_BUS), + STARFIVE_MDIV(JH7100_AUDCLK_I2S1_BCLK, "i2s1_bclk", 31, 2, + JH7100_AUDCLK_I2S1_MCLK, + JH7100_AUDCLK_I2SDAC_BCLK_IOPAD), + STARFIVE__INV(JH7100_AUDCLK_I2S1_BCLK_N, "i2s1_bclk_n", JH7100_AUDCLK_I2S1_BCLK), + STARFIVE_MDIV(JH7100_AUDCLK_I2S1_LRCLK, "i2s1_lrclk", 63, 3, + JH7100_AUDCLK_I2S1_BCLK_N, + JH7100_AUDCLK_I2SDAC_LRCLK_IOPAD), + STARFIVE_GATE(JH7100_AUDCLK_I2SDAC16K_APB, "i2s1dac16k_apb", 0, JH7100_AUDCLK_APB0_BUS), + STARFIVE__DIV(JH7100_AUDCLK_APB0_BUS, "apb0_bus", 8, JH7100_AUDCLK_DOM7AHB_BUS), + STARFIVE_GATE(JH7100_AUDCLK_DMA1P_AHB, "dma1p_ahb", 0, JH7100_AUDCLK_DOM7AHB_BUS), + STARFIVE_GATE(JH7100_AUDCLK_USB_APB, "usb_apb", CLK_IGNORE_UNUSED, JH7100_AUDCLK_APB_EN), + STARFIVE_GDIV(JH7100_AUDCLK_USB_LPM, "usb_lpm", CLK_IGNORE_UNUSED, 4, + JH7100_AUDCLK_USB_APB), + STARFIVE_GDIV(JH7100_AUDCLK_USB_STB, "usb_stb", CLK_IGNORE_UNUSED, 3, + JH7100_AUDCLK_USB_APB), + STARFIVE__DIV(JH7100_AUDCLK_APB_EN, "apb_en", 8, JH7100_AUDCLK_DOM7AHB_BUS), + STARFIVE__MUX(JH7100_AUDCLK_VAD_MEM, "vad_mem", 2, + JH7100_AUDCLK_VAD_INTMEM, + JH7100_AUDCLK_AUDIO_12288), }; static struct clk_hw *jh7100_audclk_get(struct of_phandle_args *clkspec, void *data) { - struct jh71x0_clk_priv *priv = data; + struct starfive_clk_priv *priv = data; unsigned int idx = clkspec->args[0]; if (idx < JH7100_AUDCLK_END) @@ -97,7 +99,7 @@ static struct clk_hw *jh7100_audclk_get(struct of_phandle_args *clkspec, void *d static int jh7100_audclk_probe(struct platform_device *pdev) { - struct jh71x0_clk_priv *priv; + struct starfive_clk_priv *priv; unsigned int idx; int ret; @@ -116,12 +118,13 @@ static int jh7100_audclk_probe(struct platform_device *pdev) struct clk_parent_data parents[4] = {}; struct clk_init_data init = { .name = jh7100_audclk_data[idx].name, - .ops = starfive_jh71x0_clk_ops(max), + .ops = starfive_clk_ops(max), .parent_data = parents, - .num_parents = ((max & JH71X0_CLK_MUX_MASK) >> JH71X0_CLK_MUX_SHIFT) + 1, + .num_parents = ((max & STARFIVE_CLK_MUX_MASK) + >> STARFIVE_CLK_MUX_SHIFT) + 1, .flags = jh7100_audclk_data[idx].flags, }; - struct jh71x0_clk *clk = &priv->reg[idx]; + struct starfive_clk *clk = &priv->reg[idx]; unsigned int i; for (i = 0; i < init.num_parents; i++) { @@ -139,7 +142,7 @@ static int jh7100_audclk_probe(struct platform_device *pdev) clk->hw.init = &init; clk->idx = idx; - clk->max_div = max & JH71X0_CLK_DIV_MASK; + clk->max_div = max & STARFIVE_CLK_DIV_MASK; ret = devm_clk_hw_register(priv->dev, &clk->hw); if (ret) diff --git a/drivers/clk/starfive/clk-starfive-jh7100.c b/drivers/clk/starfive/clk-starfive-jh7100.c index 6bb6a6af9f28..946a437f534b 100644 --- a/drivers/clk/starfive/clk-starfive-jh7100.c +++ b/drivers/clk/starfive/clk-starfive-jh7100.c @@ -23,253 +23,257 @@ #define JH7100_CLK_GMAC_RMII_REF (JH7100_CLK_END + 2) #define JH7100_CLK_GMAC_GR_MII_RX (JH7100_CLK_END + 3) -static const struct jh71x0_clk_data jh7100_clk_data[] __initconst = { - JH71X0__MUX(JH7100_CLK_CPUNDBUS_ROOT, "cpundbus_root", 4, - JH7100_CLK_OSC_SYS, - JH7100_CLK_PLL0_OUT, - JH7100_CLK_PLL1_OUT, - JH7100_CLK_PLL2_OUT), - JH71X0__MUX(JH7100_CLK_DLA_ROOT, "dla_root", 3, - JH7100_CLK_OSC_SYS, - JH7100_CLK_PLL1_OUT, - JH7100_CLK_PLL2_OUT), - JH71X0__MUX(JH7100_CLK_DSP_ROOT, "dsp_root", 4, - JH7100_CLK_OSC_SYS, - JH7100_CLK_PLL0_OUT, - JH7100_CLK_PLL1_OUT, - JH7100_CLK_PLL2_OUT), - JH71X0__MUX(JH7100_CLK_GMACUSB_ROOT, "gmacusb_root", 3, - JH7100_CLK_OSC_SYS, - JH7100_CLK_PLL0_OUT, - JH7100_CLK_PLL2_OUT), - JH71X0__MUX(JH7100_CLK_PERH0_ROOT, "perh0_root", 2, - JH7100_CLK_OSC_SYS, - JH7100_CLK_PLL0_OUT), - JH71X0__MUX(JH7100_CLK_PERH1_ROOT, "perh1_root", 2, - JH7100_CLK_OSC_SYS, - JH7100_CLK_PLL2_OUT), - JH71X0__MUX(JH7100_CLK_VIN_ROOT, "vin_root", 3, - JH7100_CLK_OSC_SYS, - JH7100_CLK_PLL1_OUT, - JH7100_CLK_PLL2_OUT), - JH71X0__MUX(JH7100_CLK_VOUT_ROOT, "vout_root", 3, - JH7100_CLK_OSC_AUD, - JH7100_CLK_PLL0_OUT, - JH7100_CLK_PLL2_OUT), - JH71X0_GDIV(JH7100_CLK_AUDIO_ROOT, "audio_root", 0, 8, JH7100_CLK_PLL0_OUT), - JH71X0__MUX(JH7100_CLK_CDECHIFI4_ROOT, "cdechifi4_root", 3, - JH7100_CLK_OSC_SYS, - JH7100_CLK_PLL1_OUT, - JH7100_CLK_PLL2_OUT), - JH71X0__MUX(JH7100_CLK_CDEC_ROOT, "cdec_root", 3, - JH7100_CLK_OSC_SYS, - JH7100_CLK_PLL0_OUT, - JH7100_CLK_PLL1_OUT), - JH71X0__MUX(JH7100_CLK_VOUTBUS_ROOT, "voutbus_root", 3, - JH7100_CLK_OSC_AUD, - JH7100_CLK_PLL0_OUT, - JH7100_CLK_PLL2_OUT), - JH71X0__DIV(JH7100_CLK_CPUNBUS_ROOT_DIV, "cpunbus_root_div", 2, JH7100_CLK_CPUNDBUS_ROOT), - JH71X0__DIV(JH7100_CLK_DSP_ROOT_DIV, "dsp_root_div", 4, JH7100_CLK_DSP_ROOT), - JH71X0__DIV(JH7100_CLK_PERH0_SRC, "perh0_src", 4, JH7100_CLK_PERH0_ROOT), - JH71X0__DIV(JH7100_CLK_PERH1_SRC, "perh1_src", 4, JH7100_CLK_PERH1_ROOT), - JH71X0_GDIV(JH7100_CLK_PLL0_TESTOUT, "pll0_testout", 0, 31, JH7100_CLK_PERH0_SRC), - JH71X0_GDIV(JH7100_CLK_PLL1_TESTOUT, "pll1_testout", 0, 31, JH7100_CLK_DLA_ROOT), - JH71X0_GDIV(JH7100_CLK_PLL2_TESTOUT, "pll2_testout", 0, 31, JH7100_CLK_PERH1_SRC), - JH71X0__MUX(JH7100_CLK_PLL2_REF, "pll2_refclk", 2, - JH7100_CLK_OSC_SYS, - JH7100_CLK_OSC_AUD), - JH71X0__DIV(JH7100_CLK_CPU_CORE, "cpu_core", 8, JH7100_CLK_CPUNBUS_ROOT_DIV), - JH71X0__DIV(JH7100_CLK_CPU_AXI, "cpu_axi", 8, JH7100_CLK_CPU_CORE), - JH71X0__DIV(JH7100_CLK_AHB_BUS, "ahb_bus", 8, JH7100_CLK_CPUNBUS_ROOT_DIV), - JH71X0__DIV(JH7100_CLK_APB1_BUS, "apb1_bus", 8, JH7100_CLK_AHB_BUS), - JH71X0__DIV(JH7100_CLK_APB2_BUS, "apb2_bus", 8, JH7100_CLK_AHB_BUS), - JH71X0_GATE(JH7100_CLK_DOM3AHB_BUS, "dom3ahb_bus", CLK_IS_CRITICAL, JH7100_CLK_AHB_BUS), - JH71X0_GATE(JH7100_CLK_DOM7AHB_BUS, "dom7ahb_bus", CLK_IS_CRITICAL, JH7100_CLK_AHB_BUS), - JH71X0_GATE(JH7100_CLK_U74_CORE0, "u74_core0", CLK_IS_CRITICAL, JH7100_CLK_CPU_CORE), - JH71X0_GDIV(JH7100_CLK_U74_CORE1, "u74_core1", CLK_IS_CRITICAL, 8, JH7100_CLK_CPU_CORE), - JH71X0_GATE(JH7100_CLK_U74_AXI, "u74_axi", CLK_IS_CRITICAL, JH7100_CLK_CPU_AXI), - JH71X0_GATE(JH7100_CLK_U74RTC_TOGGLE, "u74rtc_toggle", CLK_IS_CRITICAL, JH7100_CLK_OSC_SYS), - JH71X0_GATE(JH7100_CLK_SGDMA2P_AXI, "sgdma2p_axi", 0, JH7100_CLK_CPU_AXI), - JH71X0_GATE(JH7100_CLK_DMA2PNOC_AXI, "dma2pnoc_axi", 0, JH7100_CLK_CPU_AXI), - JH71X0_GATE(JH7100_CLK_SGDMA2P_AHB, "sgdma2p_ahb", 0, JH7100_CLK_AHB_BUS), - JH71X0__DIV(JH7100_CLK_DLA_BUS, "dla_bus", 4, JH7100_CLK_DLA_ROOT), - JH71X0_GATE(JH7100_CLK_DLA_AXI, "dla_axi", 0, JH7100_CLK_DLA_BUS), - JH71X0_GATE(JH7100_CLK_DLANOC_AXI, "dlanoc_axi", 0, JH7100_CLK_DLA_BUS), - JH71X0_GATE(JH7100_CLK_DLA_APB, "dla_apb", 0, JH7100_CLK_APB1_BUS), - JH71X0_GDIV(JH7100_CLK_VP6_CORE, "vp6_core", 0, 4, JH7100_CLK_DSP_ROOT_DIV), - JH71X0__DIV(JH7100_CLK_VP6BUS_SRC, "vp6bus_src", 4, JH7100_CLK_DSP_ROOT), - JH71X0_GDIV(JH7100_CLK_VP6_AXI, "vp6_axi", 0, 4, JH7100_CLK_VP6BUS_SRC), - JH71X0__DIV(JH7100_CLK_VCDECBUS_SRC, "vcdecbus_src", 4, JH7100_CLK_CDECHIFI4_ROOT), - JH71X0__DIV(JH7100_CLK_VDEC_BUS, "vdec_bus", 8, JH7100_CLK_VCDECBUS_SRC), - JH71X0_GATE(JH7100_CLK_VDEC_AXI, "vdec_axi", 0, JH7100_CLK_VDEC_BUS), - JH71X0_GATE(JH7100_CLK_VDECBRG_MAIN, "vdecbrg_mainclk", 0, JH7100_CLK_VDEC_BUS), - JH71X0_GDIV(JH7100_CLK_VDEC_BCLK, "vdec_bclk", 0, 8, JH7100_CLK_VCDECBUS_SRC), - JH71X0_GDIV(JH7100_CLK_VDEC_CCLK, "vdec_cclk", 0, 8, JH7100_CLK_CDEC_ROOT), - JH71X0_GATE(JH7100_CLK_VDEC_APB, "vdec_apb", 0, JH7100_CLK_APB1_BUS), - JH71X0_GDIV(JH7100_CLK_JPEG_AXI, "jpeg_axi", 0, 8, JH7100_CLK_CPUNBUS_ROOT_DIV), - JH71X0_GDIV(JH7100_CLK_JPEG_CCLK, "jpeg_cclk", 0, 8, JH7100_CLK_CPUNBUS_ROOT_DIV), - JH71X0_GATE(JH7100_CLK_JPEG_APB, "jpeg_apb", 0, JH7100_CLK_APB1_BUS), - JH71X0_GDIV(JH7100_CLK_GC300_2X, "gc300_2x", 0, 8, JH7100_CLK_CDECHIFI4_ROOT), - JH71X0_GATE(JH7100_CLK_GC300_AHB, "gc300_ahb", 0, JH7100_CLK_AHB_BUS), - JH71X0__DIV(JH7100_CLK_JPCGC300_AXIBUS, "jpcgc300_axibus", 8, JH7100_CLK_VCDECBUS_SRC), - JH71X0_GATE(JH7100_CLK_GC300_AXI, "gc300_axi", 0, JH7100_CLK_JPCGC300_AXIBUS), - JH71X0_GATE(JH7100_CLK_JPCGC300_MAIN, "jpcgc300_mainclk", 0, JH7100_CLK_JPCGC300_AXIBUS), - JH71X0__DIV(JH7100_CLK_VENC_BUS, "venc_bus", 8, JH7100_CLK_VCDECBUS_SRC), - JH71X0_GATE(JH7100_CLK_VENC_AXI, "venc_axi", 0, JH7100_CLK_VENC_BUS), - JH71X0_GATE(JH7100_CLK_VENCBRG_MAIN, "vencbrg_mainclk", 0, JH7100_CLK_VENC_BUS), - JH71X0_GDIV(JH7100_CLK_VENC_BCLK, "venc_bclk", 0, 8, JH7100_CLK_VCDECBUS_SRC), - JH71X0_GDIV(JH7100_CLK_VENC_CCLK, "venc_cclk", 0, 8, JH7100_CLK_CDEC_ROOT), - JH71X0_GATE(JH7100_CLK_VENC_APB, "venc_apb", 0, JH7100_CLK_APB1_BUS), - JH71X0_GDIV(JH7100_CLK_DDRPLL_DIV2, "ddrpll_div2", CLK_IS_CRITICAL, 2, JH7100_CLK_PLL1_OUT), - JH71X0_GDIV(JH7100_CLK_DDRPLL_DIV4, "ddrpll_div4", CLK_IS_CRITICAL, 2, - JH7100_CLK_DDRPLL_DIV2), - JH71X0_GDIV(JH7100_CLK_DDRPLL_DIV8, "ddrpll_div8", CLK_IS_CRITICAL, 2, - JH7100_CLK_DDRPLL_DIV4), - JH71X0_GDIV(JH7100_CLK_DDROSC_DIV2, "ddrosc_div2", CLK_IS_CRITICAL, 2, JH7100_CLK_OSC_SYS), - JH71X0_GMUX(JH7100_CLK_DDRC0, "ddrc0", CLK_IS_CRITICAL, 4, - JH7100_CLK_DDROSC_DIV2, - JH7100_CLK_DDRPLL_DIV2, - JH7100_CLK_DDRPLL_DIV4, - JH7100_CLK_DDRPLL_DIV8), - JH71X0_GMUX(JH7100_CLK_DDRC1, "ddrc1", CLK_IS_CRITICAL, 4, - JH7100_CLK_DDROSC_DIV2, - JH7100_CLK_DDRPLL_DIV2, - JH7100_CLK_DDRPLL_DIV4, - JH7100_CLK_DDRPLL_DIV8), - JH71X0_GATE(JH7100_CLK_DDRPHY_APB, "ddrphy_apb", 0, JH7100_CLK_APB1_BUS), - JH71X0__DIV(JH7100_CLK_NOC_ROB, "noc_rob", 8, JH7100_CLK_CPUNBUS_ROOT_DIV), - JH71X0__DIV(JH7100_CLK_NOC_COG, "noc_cog", 8, JH7100_CLK_DLA_ROOT), - JH71X0_GATE(JH7100_CLK_NNE_AHB, "nne_ahb", 0, JH7100_CLK_AHB_BUS), - JH71X0__DIV(JH7100_CLK_NNEBUS_SRC1, "nnebus_src1", 4, JH7100_CLK_DSP_ROOT), - JH71X0__MUX(JH7100_CLK_NNE_BUS, "nne_bus", 2, - JH7100_CLK_CPU_AXI, - JH7100_CLK_NNEBUS_SRC1), - JH71X0_GATE(JH7100_CLK_NNE_AXI, "nne_axi", 0, JH7100_CLK_NNE_BUS), - JH71X0_GATE(JH7100_CLK_NNENOC_AXI, "nnenoc_axi", 0, JH7100_CLK_NNE_BUS), - JH71X0_GATE(JH7100_CLK_DLASLV_AXI, "dlaslv_axi", 0, JH7100_CLK_NNE_BUS), - JH71X0_GATE(JH7100_CLK_DSPX2C_AXI, "dspx2c_axi", CLK_IS_CRITICAL, JH7100_CLK_NNE_BUS), - JH71X0__DIV(JH7100_CLK_HIFI4_SRC, "hifi4_src", 4, JH7100_CLK_CDECHIFI4_ROOT), - JH71X0__DIV(JH7100_CLK_HIFI4_COREFREE, "hifi4_corefree", 8, JH7100_CLK_HIFI4_SRC), - JH71X0_GATE(JH7100_CLK_HIFI4_CORE, "hifi4_core", 0, JH7100_CLK_HIFI4_COREFREE), - JH71X0__DIV(JH7100_CLK_HIFI4_BUS, "hifi4_bus", 8, JH7100_CLK_HIFI4_COREFREE), - JH71X0_GATE(JH7100_CLK_HIFI4_AXI, "hifi4_axi", 0, JH7100_CLK_HIFI4_BUS), - JH71X0_GATE(JH7100_CLK_HIFI4NOC_AXI, "hifi4noc_axi", 0, JH7100_CLK_HIFI4_BUS), - JH71X0__DIV(JH7100_CLK_SGDMA1P_BUS, "sgdma1p_bus", 8, JH7100_CLK_CPUNBUS_ROOT_DIV), - JH71X0_GATE(JH7100_CLK_SGDMA1P_AXI, "sgdma1p_axi", 0, JH7100_CLK_SGDMA1P_BUS), - JH71X0_GATE(JH7100_CLK_DMA1P_AXI, "dma1p_axi", 0, JH7100_CLK_SGDMA1P_BUS), - JH71X0_GDIV(JH7100_CLK_X2C_AXI, "x2c_axi", CLK_IS_CRITICAL, 8, JH7100_CLK_CPUNBUS_ROOT_DIV), - JH71X0__DIV(JH7100_CLK_USB_BUS, "usb_bus", 8, JH7100_CLK_CPUNBUS_ROOT_DIV), - JH71X0_GATE(JH7100_CLK_USB_AXI, "usb_axi", 0, JH7100_CLK_USB_BUS), - JH71X0_GATE(JH7100_CLK_USBNOC_AXI, "usbnoc_axi", 0, JH7100_CLK_USB_BUS), - JH71X0__DIV(JH7100_CLK_USBPHY_ROOTDIV, "usbphy_rootdiv", 4, JH7100_CLK_GMACUSB_ROOT), - JH71X0_GDIV(JH7100_CLK_USBPHY_125M, "usbphy_125m", 0, 8, JH7100_CLK_USBPHY_ROOTDIV), - JH71X0_GDIV(JH7100_CLK_USBPHY_PLLDIV25M, "usbphy_plldiv25m", 0, 32, - JH7100_CLK_USBPHY_ROOTDIV), - JH71X0__MUX(JH7100_CLK_USBPHY_25M, "usbphy_25m", 2, - JH7100_CLK_OSC_SYS, - JH7100_CLK_USBPHY_PLLDIV25M), - JH71X0_FDIV(JH7100_CLK_AUDIO_DIV, "audio_div", JH7100_CLK_AUDIO_ROOT), - JH71X0_GATE(JH7100_CLK_AUDIO_SRC, "audio_src", 0, JH7100_CLK_AUDIO_DIV), - JH71X0_GATE(JH7100_CLK_AUDIO_12288, "audio_12288", 0, JH7100_CLK_OSC_AUD), - JH71X0_GDIV(JH7100_CLK_VIN_SRC, "vin_src", 0, 4, JH7100_CLK_VIN_ROOT), - JH71X0__DIV(JH7100_CLK_ISP0_BUS, "isp0_bus", 8, JH7100_CLK_VIN_SRC), - JH71X0_GATE(JH7100_CLK_ISP0_AXI, "isp0_axi", 0, JH7100_CLK_ISP0_BUS), - JH71X0_GATE(JH7100_CLK_ISP0NOC_AXI, "isp0noc_axi", 0, JH7100_CLK_ISP0_BUS), - JH71X0_GATE(JH7100_CLK_ISPSLV_AXI, "ispslv_axi", 0, JH7100_CLK_ISP0_BUS), - JH71X0__DIV(JH7100_CLK_ISP1_BUS, "isp1_bus", 8, JH7100_CLK_VIN_SRC), - JH71X0_GATE(JH7100_CLK_ISP1_AXI, "isp1_axi", 0, JH7100_CLK_ISP1_BUS), - JH71X0_GATE(JH7100_CLK_ISP1NOC_AXI, "isp1noc_axi", 0, JH7100_CLK_ISP1_BUS), - JH71X0__DIV(JH7100_CLK_VIN_BUS, "vin_bus", 8, JH7100_CLK_VIN_SRC), - JH71X0_GATE(JH7100_CLK_VIN_AXI, "vin_axi", 0, JH7100_CLK_VIN_BUS), - JH71X0_GATE(JH7100_CLK_VINNOC_AXI, "vinnoc_axi", 0, JH7100_CLK_VIN_BUS), - JH71X0_GDIV(JH7100_CLK_VOUT_SRC, "vout_src", 0, 4, JH7100_CLK_VOUT_ROOT), - JH71X0__DIV(JH7100_CLK_DISPBUS_SRC, "dispbus_src", 4, JH7100_CLK_VOUTBUS_ROOT), - JH71X0__DIV(JH7100_CLK_DISP_BUS, "disp_bus", 4, JH7100_CLK_DISPBUS_SRC), - JH71X0_GATE(JH7100_CLK_DISP_AXI, "disp_axi", 0, JH7100_CLK_DISP_BUS), - JH71X0_GATE(JH7100_CLK_DISPNOC_AXI, "dispnoc_axi", 0, JH7100_CLK_DISP_BUS), - JH71X0_GATE(JH7100_CLK_SDIO0_AHB, "sdio0_ahb", 0, JH7100_CLK_AHB_BUS), - JH71X0_GDIV(JH7100_CLK_SDIO0_CCLKINT, "sdio0_cclkint", 0, 24, JH7100_CLK_PERH0_SRC), - JH71X0__INV(JH7100_CLK_SDIO0_CCLKINT_INV, "sdio0_cclkint_inv", JH7100_CLK_SDIO0_CCLKINT), - JH71X0_GATE(JH7100_CLK_SDIO1_AHB, "sdio1_ahb", 0, JH7100_CLK_AHB_BUS), - JH71X0_GDIV(JH7100_CLK_SDIO1_CCLKINT, "sdio1_cclkint", 0, 24, JH7100_CLK_PERH1_SRC), - JH71X0__INV(JH7100_CLK_SDIO1_CCLKINT_INV, "sdio1_cclkint_inv", JH7100_CLK_SDIO1_CCLKINT), - JH71X0_GATE(JH7100_CLK_GMAC_AHB, "gmac_ahb", 0, JH7100_CLK_AHB_BUS), - JH71X0__DIV(JH7100_CLK_GMAC_ROOT_DIV, "gmac_root_div", 8, JH7100_CLK_GMACUSB_ROOT), - JH71X0_GDIV(JH7100_CLK_GMAC_PTP_REF, "gmac_ptp_refclk", 0, 31, JH7100_CLK_GMAC_ROOT_DIV), - JH71X0_GDIV(JH7100_CLK_GMAC_GTX, "gmac_gtxclk", 0, 255, JH7100_CLK_GMAC_ROOT_DIV), - JH71X0_GDIV(JH7100_CLK_GMAC_RMII_TX, "gmac_rmii_txclk", 0, 8, JH7100_CLK_GMAC_RMII_REF), - JH71X0_GDIV(JH7100_CLK_GMAC_RMII_RX, "gmac_rmii_rxclk", 0, 8, JH7100_CLK_GMAC_RMII_REF), - JH71X0__MUX(JH7100_CLK_GMAC_TX, "gmac_tx", 3, - JH7100_CLK_GMAC_GTX, - JH7100_CLK_GMAC_TX_INV, - JH7100_CLK_GMAC_RMII_TX), - JH71X0__INV(JH7100_CLK_GMAC_TX_INV, "gmac_tx_inv", JH7100_CLK_GMAC_TX), - JH71X0__MUX(JH7100_CLK_GMAC_RX_PRE, "gmac_rx_pre", 2, - JH7100_CLK_GMAC_GR_MII_RX, - JH7100_CLK_GMAC_RMII_RX), - JH71X0__INV(JH7100_CLK_GMAC_RX_INV, "gmac_rx_inv", JH7100_CLK_GMAC_RX_PRE), - JH71X0_GATE(JH7100_CLK_GMAC_RMII, "gmac_rmii", 0, JH7100_CLK_GMAC_RMII_REF), - JH71X0_GDIV(JH7100_CLK_GMAC_TOPHYREF, "gmac_tophyref", 0, 127, JH7100_CLK_GMAC_ROOT_DIV), - JH71X0_GATE(JH7100_CLK_SPI2AHB_AHB, "spi2ahb_ahb", 0, JH7100_CLK_AHB_BUS), - JH71X0_GDIV(JH7100_CLK_SPI2AHB_CORE, "spi2ahb_core", 0, 31, JH7100_CLK_PERH0_SRC), - JH71X0_GATE(JH7100_CLK_EZMASTER_AHB, "ezmaster_ahb", 0, JH7100_CLK_AHB_BUS), - JH71X0_GATE(JH7100_CLK_E24_AHB, "e24_ahb", 0, JH7100_CLK_AHB_BUS), - JH71X0_GATE(JH7100_CLK_E24RTC_TOGGLE, "e24rtc_toggle", 0, JH7100_CLK_OSC_SYS), - JH71X0_GATE(JH7100_CLK_QSPI_AHB, "qspi_ahb", 0, JH7100_CLK_AHB_BUS), - JH71X0_GATE(JH7100_CLK_QSPI_APB, "qspi_apb", 0, JH7100_CLK_APB1_BUS), - JH71X0_GDIV(JH7100_CLK_QSPI_REF, "qspi_refclk", 0, 31, JH7100_CLK_PERH0_SRC), - JH71X0_GATE(JH7100_CLK_SEC_AHB, "sec_ahb", 0, JH7100_CLK_AHB_BUS), - JH71X0_GATE(JH7100_CLK_AES, "aes_clk", 0, JH7100_CLK_SEC_AHB), - JH71X0_GATE(JH7100_CLK_SHA, "sha_clk", 0, JH7100_CLK_SEC_AHB), - JH71X0_GATE(JH7100_CLK_PKA, "pka_clk", 0, JH7100_CLK_SEC_AHB), - JH71X0_GATE(JH7100_CLK_TRNG_APB, "trng_apb", 0, JH7100_CLK_APB1_BUS), - JH71X0_GATE(JH7100_CLK_OTP_APB, "otp_apb", 0, JH7100_CLK_APB1_BUS), - JH71X0_GATE(JH7100_CLK_UART0_APB, "uart0_apb", 0, JH7100_CLK_APB1_BUS), - JH71X0_GDIV(JH7100_CLK_UART0_CORE, "uart0_core", 0, 63, JH7100_CLK_PERH1_SRC), - JH71X0_GATE(JH7100_CLK_UART1_APB, "uart1_apb", 0, JH7100_CLK_APB1_BUS), - JH71X0_GDIV(JH7100_CLK_UART1_CORE, "uart1_core", 0, 63, JH7100_CLK_PERH1_SRC), - JH71X0_GATE(JH7100_CLK_SPI0_APB, "spi0_apb", 0, JH7100_CLK_APB1_BUS), - JH71X0_GDIV(JH7100_CLK_SPI0_CORE, "spi0_core", 0, 63, JH7100_CLK_PERH1_SRC), - JH71X0_GATE(JH7100_CLK_SPI1_APB, "spi1_apb", 0, JH7100_CLK_APB1_BUS), - JH71X0_GDIV(JH7100_CLK_SPI1_CORE, "spi1_core", 0, 63, JH7100_CLK_PERH1_SRC), - JH71X0_GATE(JH7100_CLK_I2C0_APB, "i2c0_apb", 0, JH7100_CLK_APB1_BUS), - JH71X0_GDIV(JH7100_CLK_I2C0_CORE, "i2c0_core", 0, 63, JH7100_CLK_PERH1_SRC), - JH71X0_GATE(JH7100_CLK_I2C1_APB, "i2c1_apb", 0, JH7100_CLK_APB1_BUS), - JH71X0_GDIV(JH7100_CLK_I2C1_CORE, "i2c1_core", 0, 63, JH7100_CLK_PERH1_SRC), - JH71X0_GATE(JH7100_CLK_GPIO_APB, "gpio_apb", 0, JH7100_CLK_APB1_BUS), - JH71X0_GATE(JH7100_CLK_UART2_APB, "uart2_apb", 0, JH7100_CLK_APB2_BUS), - JH71X0_GDIV(JH7100_CLK_UART2_CORE, "uart2_core", 0, 63, JH7100_CLK_PERH0_SRC), - JH71X0_GATE(JH7100_CLK_UART3_APB, "uart3_apb", 0, JH7100_CLK_APB2_BUS), - JH71X0_GDIV(JH7100_CLK_UART3_CORE, "uart3_core", 0, 63, JH7100_CLK_PERH0_SRC), - JH71X0_GATE(JH7100_CLK_SPI2_APB, "spi2_apb", 0, JH7100_CLK_APB2_BUS), - JH71X0_GDIV(JH7100_CLK_SPI2_CORE, "spi2_core", 0, 63, JH7100_CLK_PERH0_SRC), - JH71X0_GATE(JH7100_CLK_SPI3_APB, "spi3_apb", 0, JH7100_CLK_APB2_BUS), - JH71X0_GDIV(JH7100_CLK_SPI3_CORE, "spi3_core", 0, 63, JH7100_CLK_PERH0_SRC), - JH71X0_GATE(JH7100_CLK_I2C2_APB, "i2c2_apb", 0, JH7100_CLK_APB2_BUS), - JH71X0_GDIV(JH7100_CLK_I2C2_CORE, "i2c2_core", 0, 63, JH7100_CLK_PERH0_SRC), - JH71X0_GATE(JH7100_CLK_I2C3_APB, "i2c3_apb", 0, JH7100_CLK_APB2_BUS), - JH71X0_GDIV(JH7100_CLK_I2C3_CORE, "i2c3_core", 0, 63, JH7100_CLK_PERH0_SRC), - JH71X0_GATE(JH7100_CLK_WDTIMER_APB, "wdtimer_apb", 0, JH7100_CLK_APB2_BUS), - JH71X0_GDIV(JH7100_CLK_WDT_CORE, "wdt_coreclk", 0, 63, JH7100_CLK_PERH0_SRC), - JH71X0_GDIV(JH7100_CLK_TIMER0_CORE, "timer0_coreclk", 0, 63, JH7100_CLK_PERH0_SRC), - JH71X0_GDIV(JH7100_CLK_TIMER1_CORE, "timer1_coreclk", 0, 63, JH7100_CLK_PERH0_SRC), - JH71X0_GDIV(JH7100_CLK_TIMER2_CORE, "timer2_coreclk", 0, 63, JH7100_CLK_PERH0_SRC), - JH71X0_GDIV(JH7100_CLK_TIMER3_CORE, "timer3_coreclk", 0, 63, JH7100_CLK_PERH0_SRC), - JH71X0_GDIV(JH7100_CLK_TIMER4_CORE, "timer4_coreclk", 0, 63, JH7100_CLK_PERH0_SRC), - JH71X0_GDIV(JH7100_CLK_TIMER5_CORE, "timer5_coreclk", 0, 63, JH7100_CLK_PERH0_SRC), - JH71X0_GDIV(JH7100_CLK_TIMER6_CORE, "timer6_coreclk", 0, 63, JH7100_CLK_PERH0_SRC), - JH71X0_GATE(JH7100_CLK_VP6INTC_APB, "vp6intc_apb", 0, JH7100_CLK_APB2_BUS), - JH71X0_GATE(JH7100_CLK_PWM_APB, "pwm_apb", 0, JH7100_CLK_APB2_BUS), - JH71X0_GATE(JH7100_CLK_MSI_APB, "msi_apb", 0, JH7100_CLK_APB2_BUS), - JH71X0_GATE(JH7100_CLK_TEMP_APB, "temp_apb", 0, JH7100_CLK_APB2_BUS), - JH71X0_GDIV(JH7100_CLK_TEMP_SENSE, "temp_sense", 0, 31, JH7100_CLK_OSC_SYS), - JH71X0_GATE(JH7100_CLK_SYSERR_APB, "syserr_apb", 0, JH7100_CLK_APB2_BUS), +static const struct starfive_clk_data jh7100_clk_data[] __initconst = { + STARFIVE__MUX(JH7100_CLK_CPUNDBUS_ROOT, "cpundbus_root", 4, + JH7100_CLK_OSC_SYS, + JH7100_CLK_PLL0_OUT, + JH7100_CLK_PLL1_OUT, + JH7100_CLK_PLL2_OUT), + STARFIVE__MUX(JH7100_CLK_DLA_ROOT, "dla_root", 3, + JH7100_CLK_OSC_SYS, + JH7100_CLK_PLL1_OUT, + JH7100_CLK_PLL2_OUT), + STARFIVE__MUX(JH7100_CLK_DSP_ROOT, "dsp_root", 4, + JH7100_CLK_OSC_SYS, + JH7100_CLK_PLL0_OUT, + JH7100_CLK_PLL1_OUT, + JH7100_CLK_PLL2_OUT), + STARFIVE__MUX(JH7100_CLK_GMACUSB_ROOT, "gmacusb_root", 3, + JH7100_CLK_OSC_SYS, + JH7100_CLK_PLL0_OUT, + JH7100_CLK_PLL2_OUT), + STARFIVE__MUX(JH7100_CLK_PERH0_ROOT, "perh0_root", 2, + JH7100_CLK_OSC_SYS, + JH7100_CLK_PLL0_OUT), + STARFIVE__MUX(JH7100_CLK_PERH1_ROOT, "perh1_root", 2, + JH7100_CLK_OSC_SYS, + JH7100_CLK_PLL2_OUT), + STARFIVE__MUX(JH7100_CLK_VIN_ROOT, "vin_root", 3, + JH7100_CLK_OSC_SYS, + JH7100_CLK_PLL1_OUT, + JH7100_CLK_PLL2_OUT), + STARFIVE__MUX(JH7100_CLK_VOUT_ROOT, "vout_root", 3, + JH7100_CLK_OSC_AUD, + JH7100_CLK_PLL0_OUT, + JH7100_CLK_PLL2_OUT), + STARFIVE_GDIV(JH7100_CLK_AUDIO_ROOT, "audio_root", 0, 8, JH7100_CLK_PLL0_OUT), + STARFIVE__MUX(JH7100_CLK_CDECHIFI4_ROOT, "cdechifi4_root", 3, + JH7100_CLK_OSC_SYS, + JH7100_CLK_PLL1_OUT, + JH7100_CLK_PLL2_OUT), + STARFIVE__MUX(JH7100_CLK_CDEC_ROOT, "cdec_root", 3, + JH7100_CLK_OSC_SYS, + JH7100_CLK_PLL0_OUT, + JH7100_CLK_PLL1_OUT), + STARFIVE__MUX(JH7100_CLK_VOUTBUS_ROOT, "voutbus_root", 3, + JH7100_CLK_OSC_AUD, + JH7100_CLK_PLL0_OUT, + JH7100_CLK_PLL2_OUT), + STARFIVE__DIV(JH7100_CLK_CPUNBUS_ROOT_DIV, "cpunbus_root_div", 2, JH7100_CLK_CPUNDBUS_ROOT), + STARFIVE__DIV(JH7100_CLK_DSP_ROOT_DIV, "dsp_root_div", 4, JH7100_CLK_DSP_ROOT), + STARFIVE__DIV(JH7100_CLK_PERH0_SRC, "perh0_src", 4, JH7100_CLK_PERH0_ROOT), + STARFIVE__DIV(JH7100_CLK_PERH1_SRC, "perh1_src", 4, JH7100_CLK_PERH1_ROOT), + STARFIVE_GDIV(JH7100_CLK_PLL0_TESTOUT, "pll0_testout", 0, 31, JH7100_CLK_PERH0_SRC), + STARFIVE_GDIV(JH7100_CLK_PLL1_TESTOUT, "pll1_testout", 0, 31, JH7100_CLK_DLA_ROOT), + STARFIVE_GDIV(JH7100_CLK_PLL2_TESTOUT, "pll2_testout", 0, 31, JH7100_CLK_PERH1_SRC), + STARFIVE__MUX(JH7100_CLK_PLL2_REF, "pll2_refclk", 2, + JH7100_CLK_OSC_SYS, + JH7100_CLK_OSC_AUD), + STARFIVE__DIV(JH7100_CLK_CPU_CORE, "cpu_core", 8, JH7100_CLK_CPUNBUS_ROOT_DIV), + STARFIVE__DIV(JH7100_CLK_CPU_AXI, "cpu_axi", 8, JH7100_CLK_CPU_CORE), + STARFIVE__DIV(JH7100_CLK_AHB_BUS, "ahb_bus", 8, JH7100_CLK_CPUNBUS_ROOT_DIV), + STARFIVE__DIV(JH7100_CLK_APB1_BUS, "apb1_bus", 8, JH7100_CLK_AHB_BUS), + STARFIVE__DIV(JH7100_CLK_APB2_BUS, "apb2_bus", 8, JH7100_CLK_AHB_BUS), + STARFIVE_GATE(JH7100_CLK_DOM3AHB_BUS, "dom3ahb_bus", CLK_IS_CRITICAL, JH7100_CLK_AHB_BUS), + STARFIVE_GATE(JH7100_CLK_DOM7AHB_BUS, "dom7ahb_bus", CLK_IS_CRITICAL, JH7100_CLK_AHB_BUS), + STARFIVE_GATE(JH7100_CLK_U74_CORE0, "u74_core0", CLK_IS_CRITICAL, JH7100_CLK_CPU_CORE), + STARFIVE_GDIV(JH7100_CLK_U74_CORE1, "u74_core1", CLK_IS_CRITICAL, 8, JH7100_CLK_CPU_CORE), + STARFIVE_GATE(JH7100_CLK_U74_AXI, "u74_axi", CLK_IS_CRITICAL, JH7100_CLK_CPU_AXI), + STARFIVE_GATE(JH7100_CLK_U74RTC_TOGGLE, "u74rtc_toggle", CLK_IS_CRITICAL, + JH7100_CLK_OSC_SYS), + STARFIVE_GATE(JH7100_CLK_SGDMA2P_AXI, "sgdma2p_axi", 0, JH7100_CLK_CPU_AXI), + STARFIVE_GATE(JH7100_CLK_DMA2PNOC_AXI, "dma2pnoc_axi", 0, JH7100_CLK_CPU_AXI), + STARFIVE_GATE(JH7100_CLK_SGDMA2P_AHB, "sgdma2p_ahb", 0, JH7100_CLK_AHB_BUS), + STARFIVE__DIV(JH7100_CLK_DLA_BUS, "dla_bus", 4, JH7100_CLK_DLA_ROOT), + STARFIVE_GATE(JH7100_CLK_DLA_AXI, "dla_axi", 0, JH7100_CLK_DLA_BUS), + STARFIVE_GATE(JH7100_CLK_DLANOC_AXI, "dlanoc_axi", 0, JH7100_CLK_DLA_BUS), + STARFIVE_GATE(JH7100_CLK_DLA_APB, "dla_apb", 0, JH7100_CLK_APB1_BUS), + STARFIVE_GDIV(JH7100_CLK_VP6_CORE, "vp6_core", 0, 4, JH7100_CLK_DSP_ROOT_DIV), + STARFIVE__DIV(JH7100_CLK_VP6BUS_SRC, "vp6bus_src", 4, JH7100_CLK_DSP_ROOT), + STARFIVE_GDIV(JH7100_CLK_VP6_AXI, "vp6_axi", 0, 4, JH7100_CLK_VP6BUS_SRC), + STARFIVE__DIV(JH7100_CLK_VCDECBUS_SRC, "vcdecbus_src", 4, JH7100_CLK_CDECHIFI4_ROOT), + STARFIVE__DIV(JH7100_CLK_VDEC_BUS, "vdec_bus", 8, JH7100_CLK_VCDECBUS_SRC), + STARFIVE_GATE(JH7100_CLK_VDEC_AXI, "vdec_axi", 0, JH7100_CLK_VDEC_BUS), + STARFIVE_GATE(JH7100_CLK_VDECBRG_MAIN, "vdecbrg_mainclk", 0, JH7100_CLK_VDEC_BUS), + STARFIVE_GDIV(JH7100_CLK_VDEC_BCLK, "vdec_bclk", 0, 8, JH7100_CLK_VCDECBUS_SRC), + STARFIVE_GDIV(JH7100_CLK_VDEC_CCLK, "vdec_cclk", 0, 8, JH7100_CLK_CDEC_ROOT), + STARFIVE_GATE(JH7100_CLK_VDEC_APB, "vdec_apb", 0, JH7100_CLK_APB1_BUS), + STARFIVE_GDIV(JH7100_CLK_JPEG_AXI, "jpeg_axi", 0, 8, JH7100_CLK_CPUNBUS_ROOT_DIV), + STARFIVE_GDIV(JH7100_CLK_JPEG_CCLK, "jpeg_cclk", 0, 8, JH7100_CLK_CPUNBUS_ROOT_DIV), + STARFIVE_GATE(JH7100_CLK_JPEG_APB, "jpeg_apb", 0, JH7100_CLK_APB1_BUS), + STARFIVE_GDIV(JH7100_CLK_GC300_2X, "gc300_2x", 0, 8, JH7100_CLK_CDECHIFI4_ROOT), + STARFIVE_GATE(JH7100_CLK_GC300_AHB, "gc300_ahb", 0, JH7100_CLK_AHB_BUS), + STARFIVE__DIV(JH7100_CLK_JPCGC300_AXIBUS, "jpcgc300_axibus", 8, JH7100_CLK_VCDECBUS_SRC), + STARFIVE_GATE(JH7100_CLK_GC300_AXI, "gc300_axi", 0, JH7100_CLK_JPCGC300_AXIBUS), + STARFIVE_GATE(JH7100_CLK_JPCGC300_MAIN, "jpcgc300_mainclk", 0, JH7100_CLK_JPCGC300_AXIBUS), + STARFIVE__DIV(JH7100_CLK_VENC_BUS, "venc_bus", 8, JH7100_CLK_VCDECBUS_SRC), + STARFIVE_GATE(JH7100_CLK_VENC_AXI, "venc_axi", 0, JH7100_CLK_VENC_BUS), + STARFIVE_GATE(JH7100_CLK_VENCBRG_MAIN, "vencbrg_mainclk", 0, JH7100_CLK_VENC_BUS), + STARFIVE_GDIV(JH7100_CLK_VENC_BCLK, "venc_bclk", 0, 8, JH7100_CLK_VCDECBUS_SRC), + STARFIVE_GDIV(JH7100_CLK_VENC_CCLK, "venc_cclk", 0, 8, JH7100_CLK_CDEC_ROOT), + STARFIVE_GATE(JH7100_CLK_VENC_APB, "venc_apb", 0, JH7100_CLK_APB1_BUS), + STARFIVE_GDIV(JH7100_CLK_DDRPLL_DIV2, "ddrpll_div2", CLK_IS_CRITICAL, 2, + JH7100_CLK_PLL1_OUT), + STARFIVE_GDIV(JH7100_CLK_DDRPLL_DIV4, "ddrpll_div4", CLK_IS_CRITICAL, 2, + JH7100_CLK_DDRPLL_DIV2), + STARFIVE_GDIV(JH7100_CLK_DDRPLL_DIV8, "ddrpll_div8", CLK_IS_CRITICAL, 2, + JH7100_CLK_DDRPLL_DIV4), + STARFIVE_GDIV(JH7100_CLK_DDROSC_DIV2, "ddrosc_div2", CLK_IS_CRITICAL, 2, + JH7100_CLK_OSC_SYS), + STARFIVE_GMUX(JH7100_CLK_DDRC0, "ddrc0", CLK_IS_CRITICAL, 4, + JH7100_CLK_DDROSC_DIV2, + JH7100_CLK_DDRPLL_DIV2, + JH7100_CLK_DDRPLL_DIV4, + JH7100_CLK_DDRPLL_DIV8), + STARFIVE_GMUX(JH7100_CLK_DDRC1, "ddrc1", CLK_IS_CRITICAL, 4, + JH7100_CLK_DDROSC_DIV2, + JH7100_CLK_DDRPLL_DIV2, + JH7100_CLK_DDRPLL_DIV4, + JH7100_CLK_DDRPLL_DIV8), + STARFIVE_GATE(JH7100_CLK_DDRPHY_APB, "ddrphy_apb", 0, JH7100_CLK_APB1_BUS), + STARFIVE__DIV(JH7100_CLK_NOC_ROB, "noc_rob", 8, JH7100_CLK_CPUNBUS_ROOT_DIV), + STARFIVE__DIV(JH7100_CLK_NOC_COG, "noc_cog", 8, JH7100_CLK_DLA_ROOT), + STARFIVE_GATE(JH7100_CLK_NNE_AHB, "nne_ahb", 0, JH7100_CLK_AHB_BUS), + STARFIVE__DIV(JH7100_CLK_NNEBUS_SRC1, "nnebus_src1", 4, JH7100_CLK_DSP_ROOT), + STARFIVE__MUX(JH7100_CLK_NNE_BUS, "nne_bus", 2, + JH7100_CLK_CPU_AXI, + JH7100_CLK_NNEBUS_SRC1), + STARFIVE_GATE(JH7100_CLK_NNE_AXI, "nne_axi", 0, JH7100_CLK_NNE_BUS), + STARFIVE_GATE(JH7100_CLK_NNENOC_AXI, "nnenoc_axi", 0, JH7100_CLK_NNE_BUS), + STARFIVE_GATE(JH7100_CLK_DLASLV_AXI, "dlaslv_axi", 0, JH7100_CLK_NNE_BUS), + STARFIVE_GATE(JH7100_CLK_DSPX2C_AXI, "dspx2c_axi", CLK_IS_CRITICAL, JH7100_CLK_NNE_BUS), + STARFIVE__DIV(JH7100_CLK_HIFI4_SRC, "hifi4_src", 4, JH7100_CLK_CDECHIFI4_ROOT), + STARFIVE__DIV(JH7100_CLK_HIFI4_COREFREE, "hifi4_corefree", 8, JH7100_CLK_HIFI4_SRC), + STARFIVE_GATE(JH7100_CLK_HIFI4_CORE, "hifi4_core", 0, JH7100_CLK_HIFI4_COREFREE), + STARFIVE__DIV(JH7100_CLK_HIFI4_BUS, "hifi4_bus", 8, JH7100_CLK_HIFI4_COREFREE), + STARFIVE_GATE(JH7100_CLK_HIFI4_AXI, "hifi4_axi", 0, JH7100_CLK_HIFI4_BUS), + STARFIVE_GATE(JH7100_CLK_HIFI4NOC_AXI, "hifi4noc_axi", 0, JH7100_CLK_HIFI4_BUS), + STARFIVE__DIV(JH7100_CLK_SGDMA1P_BUS, "sgdma1p_bus", 8, JH7100_CLK_CPUNBUS_ROOT_DIV), + STARFIVE_GATE(JH7100_CLK_SGDMA1P_AXI, "sgdma1p_axi", 0, JH7100_CLK_SGDMA1P_BUS), + STARFIVE_GATE(JH7100_CLK_DMA1P_AXI, "dma1p_axi", 0, JH7100_CLK_SGDMA1P_BUS), + STARFIVE_GDIV(JH7100_CLK_X2C_AXI, "x2c_axi", CLK_IS_CRITICAL, 8, + JH7100_CLK_CPUNBUS_ROOT_DIV), + STARFIVE__DIV(JH7100_CLK_USB_BUS, "usb_bus", 8, JH7100_CLK_CPUNBUS_ROOT_DIV), + STARFIVE_GATE(JH7100_CLK_USB_AXI, "usb_axi", 0, JH7100_CLK_USB_BUS), + STARFIVE_GATE(JH7100_CLK_USBNOC_AXI, "usbnoc_axi", 0, JH7100_CLK_USB_BUS), + STARFIVE__DIV(JH7100_CLK_USBPHY_ROOTDIV, "usbphy_rootdiv", 4, JH7100_CLK_GMACUSB_ROOT), + STARFIVE_GDIV(JH7100_CLK_USBPHY_125M, "usbphy_125m", 0, 8, JH7100_CLK_USBPHY_ROOTDIV), + STARFIVE_GDIV(JH7100_CLK_USBPHY_PLLDIV25M, "usbphy_plldiv25m", 0, 32, + JH7100_CLK_USBPHY_ROOTDIV), + STARFIVE__MUX(JH7100_CLK_USBPHY_25M, "usbphy_25m", 2, + JH7100_CLK_OSC_SYS, + JH7100_CLK_USBPHY_PLLDIV25M), + STARFIVE_FDIV(JH7100_CLK_AUDIO_DIV, "audio_div", JH7100_CLK_AUDIO_ROOT), + STARFIVE_GATE(JH7100_CLK_AUDIO_SRC, "audio_src", 0, JH7100_CLK_AUDIO_DIV), + STARFIVE_GATE(JH7100_CLK_AUDIO_12288, "audio_12288", 0, JH7100_CLK_OSC_AUD), + STARFIVE_GDIV(JH7100_CLK_VIN_SRC, "vin_src", 0, 4, JH7100_CLK_VIN_ROOT), + STARFIVE__DIV(JH7100_CLK_ISP0_BUS, "isp0_bus", 8, JH7100_CLK_VIN_SRC), + STARFIVE_GATE(JH7100_CLK_ISP0_AXI, "isp0_axi", 0, JH7100_CLK_ISP0_BUS), + STARFIVE_GATE(JH7100_CLK_ISP0NOC_AXI, "isp0noc_axi", 0, JH7100_CLK_ISP0_BUS), + STARFIVE_GATE(JH7100_CLK_ISPSLV_AXI, "ispslv_axi", 0, JH7100_CLK_ISP0_BUS), + STARFIVE__DIV(JH7100_CLK_ISP1_BUS, "isp1_bus", 8, JH7100_CLK_VIN_SRC), + STARFIVE_GATE(JH7100_CLK_ISP1_AXI, "isp1_axi", 0, JH7100_CLK_ISP1_BUS), + STARFIVE_GATE(JH7100_CLK_ISP1NOC_AXI, "isp1noc_axi", 0, JH7100_CLK_ISP1_BUS), + STARFIVE__DIV(JH7100_CLK_VIN_BUS, "vin_bus", 8, JH7100_CLK_VIN_SRC), + STARFIVE_GATE(JH7100_CLK_VIN_AXI, "vin_axi", 0, JH7100_CLK_VIN_BUS), + STARFIVE_GATE(JH7100_CLK_VINNOC_AXI, "vinnoc_axi", 0, JH7100_CLK_VIN_BUS), + STARFIVE_GDIV(JH7100_CLK_VOUT_SRC, "vout_src", 0, 4, JH7100_CLK_VOUT_ROOT), + STARFIVE__DIV(JH7100_CLK_DISPBUS_SRC, "dispbus_src", 4, JH7100_CLK_VOUTBUS_ROOT), + STARFIVE__DIV(JH7100_CLK_DISP_BUS, "disp_bus", 4, JH7100_CLK_DISPBUS_SRC), + STARFIVE_GATE(JH7100_CLK_DISP_AXI, "disp_axi", 0, JH7100_CLK_DISP_BUS), + STARFIVE_GATE(JH7100_CLK_DISPNOC_AXI, "dispnoc_axi", 0, JH7100_CLK_DISP_BUS), + STARFIVE_GATE(JH7100_CLK_SDIO0_AHB, "sdio0_ahb", 0, JH7100_CLK_AHB_BUS), + STARFIVE_GDIV(JH7100_CLK_SDIO0_CCLKINT, "sdio0_cclkint", 0, 24, JH7100_CLK_PERH0_SRC), + STARFIVE__INV(JH7100_CLK_SDIO0_CCLKINT_INV, "sdio0_cclkint_inv", JH7100_CLK_SDIO0_CCLKINT), + STARFIVE_GATE(JH7100_CLK_SDIO1_AHB, "sdio1_ahb", 0, JH7100_CLK_AHB_BUS), + STARFIVE_GDIV(JH7100_CLK_SDIO1_CCLKINT, "sdio1_cclkint", 0, 24, JH7100_CLK_PERH1_SRC), + STARFIVE__INV(JH7100_CLK_SDIO1_CCLKINT_INV, "sdio1_cclkint_inv", JH7100_CLK_SDIO1_CCLKINT), + STARFIVE_GATE(JH7100_CLK_GMAC_AHB, "gmac_ahb", 0, JH7100_CLK_AHB_BUS), + STARFIVE__DIV(JH7100_CLK_GMAC_ROOT_DIV, "gmac_root_div", 8, JH7100_CLK_GMACUSB_ROOT), + STARFIVE_GDIV(JH7100_CLK_GMAC_PTP_REF, "gmac_ptp_refclk", 0, 31, JH7100_CLK_GMAC_ROOT_DIV), + STARFIVE_GDIV(JH7100_CLK_GMAC_GTX, "gmac_gtxclk", 0, 255, JH7100_CLK_GMAC_ROOT_DIV), + STARFIVE_GDIV(JH7100_CLK_GMAC_RMII_TX, "gmac_rmii_txclk", 0, 8, JH7100_CLK_GMAC_RMII_REF), + STARFIVE_GDIV(JH7100_CLK_GMAC_RMII_RX, "gmac_rmii_rxclk", 0, 8, JH7100_CLK_GMAC_RMII_REF), + STARFIVE__MUX(JH7100_CLK_GMAC_TX, "gmac_tx", 3, + JH7100_CLK_GMAC_GTX, + JH7100_CLK_GMAC_TX_INV, + JH7100_CLK_GMAC_RMII_TX), + STARFIVE__INV(JH7100_CLK_GMAC_TX_INV, "gmac_tx_inv", JH7100_CLK_GMAC_TX), + STARFIVE__MUX(JH7100_CLK_GMAC_RX_PRE, "gmac_rx_pre", 2, + JH7100_CLK_GMAC_GR_MII_RX, + JH7100_CLK_GMAC_RMII_RX), + STARFIVE__INV(JH7100_CLK_GMAC_RX_INV, "gmac_rx_inv", JH7100_CLK_GMAC_RX_PRE), + STARFIVE_GATE(JH7100_CLK_GMAC_RMII, "gmac_rmii", 0, JH7100_CLK_GMAC_RMII_REF), + STARFIVE_GDIV(JH7100_CLK_GMAC_TOPHYREF, "gmac_tophyref", 0, 127, JH7100_CLK_GMAC_ROOT_DIV), + STARFIVE_GATE(JH7100_CLK_SPI2AHB_AHB, "spi2ahb_ahb", 0, JH7100_CLK_AHB_BUS), + STARFIVE_GDIV(JH7100_CLK_SPI2AHB_CORE, "spi2ahb_core", 0, 31, JH7100_CLK_PERH0_SRC), + STARFIVE_GATE(JH7100_CLK_EZMASTER_AHB, "ezmaster_ahb", 0, JH7100_CLK_AHB_BUS), + STARFIVE_GATE(JH7100_CLK_E24_AHB, "e24_ahb", 0, JH7100_CLK_AHB_BUS), + STARFIVE_GATE(JH7100_CLK_E24RTC_TOGGLE, "e24rtc_toggle", 0, JH7100_CLK_OSC_SYS), + STARFIVE_GATE(JH7100_CLK_QSPI_AHB, "qspi_ahb", 0, JH7100_CLK_AHB_BUS), + STARFIVE_GATE(JH7100_CLK_QSPI_APB, "qspi_apb", 0, JH7100_CLK_APB1_BUS), + STARFIVE_GDIV(JH7100_CLK_QSPI_REF, "qspi_refclk", 0, 31, JH7100_CLK_PERH0_SRC), + STARFIVE_GATE(JH7100_CLK_SEC_AHB, "sec_ahb", 0, JH7100_CLK_AHB_BUS), + STARFIVE_GATE(JH7100_CLK_AES, "aes_clk", 0, JH7100_CLK_SEC_AHB), + STARFIVE_GATE(JH7100_CLK_SHA, "sha_clk", 0, JH7100_CLK_SEC_AHB), + STARFIVE_GATE(JH7100_CLK_PKA, "pka_clk", 0, JH7100_CLK_SEC_AHB), + STARFIVE_GATE(JH7100_CLK_TRNG_APB, "trng_apb", 0, JH7100_CLK_APB1_BUS), + STARFIVE_GATE(JH7100_CLK_OTP_APB, "otp_apb", 0, JH7100_CLK_APB1_BUS), + STARFIVE_GATE(JH7100_CLK_UART0_APB, "uart0_apb", 0, JH7100_CLK_APB1_BUS), + STARFIVE_GDIV(JH7100_CLK_UART0_CORE, "uart0_core", 0, 63, JH7100_CLK_PERH1_SRC), + STARFIVE_GATE(JH7100_CLK_UART1_APB, "uart1_apb", 0, JH7100_CLK_APB1_BUS), + STARFIVE_GDIV(JH7100_CLK_UART1_CORE, "uart1_core", 0, 63, JH7100_CLK_PERH1_SRC), + STARFIVE_GATE(JH7100_CLK_SPI0_APB, "spi0_apb", 0, JH7100_CLK_APB1_BUS), + STARFIVE_GDIV(JH7100_CLK_SPI0_CORE, "spi0_core", 0, 63, JH7100_CLK_PERH1_SRC), + STARFIVE_GATE(JH7100_CLK_SPI1_APB, "spi1_apb", 0, JH7100_CLK_APB1_BUS), + STARFIVE_GDIV(JH7100_CLK_SPI1_CORE, "spi1_core", 0, 63, JH7100_CLK_PERH1_SRC), + STARFIVE_GATE(JH7100_CLK_I2C0_APB, "i2c0_apb", 0, JH7100_CLK_APB1_BUS), + STARFIVE_GDIV(JH7100_CLK_I2C0_CORE, "i2c0_core", 0, 63, JH7100_CLK_PERH1_SRC), + STARFIVE_GATE(JH7100_CLK_I2C1_APB, "i2c1_apb", 0, JH7100_CLK_APB1_BUS), + STARFIVE_GDIV(JH7100_CLK_I2C1_CORE, "i2c1_core", 0, 63, JH7100_CLK_PERH1_SRC), + STARFIVE_GATE(JH7100_CLK_GPIO_APB, "gpio_apb", 0, JH7100_CLK_APB1_BUS), + STARFIVE_GATE(JH7100_CLK_UART2_APB, "uart2_apb", 0, JH7100_CLK_APB2_BUS), + STARFIVE_GDIV(JH7100_CLK_UART2_CORE, "uart2_core", 0, 63, JH7100_CLK_PERH0_SRC), + STARFIVE_GATE(JH7100_CLK_UART3_APB, "uart3_apb", 0, JH7100_CLK_APB2_BUS), + STARFIVE_GDIV(JH7100_CLK_UART3_CORE, "uart3_core", 0, 63, JH7100_CLK_PERH0_SRC), + STARFIVE_GATE(JH7100_CLK_SPI2_APB, "spi2_apb", 0, JH7100_CLK_APB2_BUS), + STARFIVE_GDIV(JH7100_CLK_SPI2_CORE, "spi2_core", 0, 63, JH7100_CLK_PERH0_SRC), + STARFIVE_GATE(JH7100_CLK_SPI3_APB, "spi3_apb", 0, JH7100_CLK_APB2_BUS), + STARFIVE_GDIV(JH7100_CLK_SPI3_CORE, "spi3_core", 0, 63, JH7100_CLK_PERH0_SRC), + STARFIVE_GATE(JH7100_CLK_I2C2_APB, "i2c2_apb", 0, JH7100_CLK_APB2_BUS), + STARFIVE_GDIV(JH7100_CLK_I2C2_CORE, "i2c2_core", 0, 63, JH7100_CLK_PERH0_SRC), + STARFIVE_GATE(JH7100_CLK_I2C3_APB, "i2c3_apb", 0, JH7100_CLK_APB2_BUS), + STARFIVE_GDIV(JH7100_CLK_I2C3_CORE, "i2c3_core", 0, 63, JH7100_CLK_PERH0_SRC), + STARFIVE_GATE(JH7100_CLK_WDTIMER_APB, "wdtimer_apb", 0, JH7100_CLK_APB2_BUS), + STARFIVE_GDIV(JH7100_CLK_WDT_CORE, "wdt_coreclk", 0, 63, JH7100_CLK_PERH0_SRC), + STARFIVE_GDIV(JH7100_CLK_TIMER0_CORE, "timer0_coreclk", 0, 63, JH7100_CLK_PERH0_SRC), + STARFIVE_GDIV(JH7100_CLK_TIMER1_CORE, "timer1_coreclk", 0, 63, JH7100_CLK_PERH0_SRC), + STARFIVE_GDIV(JH7100_CLK_TIMER2_CORE, "timer2_coreclk", 0, 63, JH7100_CLK_PERH0_SRC), + STARFIVE_GDIV(JH7100_CLK_TIMER3_CORE, "timer3_coreclk", 0, 63, JH7100_CLK_PERH0_SRC), + STARFIVE_GDIV(JH7100_CLK_TIMER4_CORE, "timer4_coreclk", 0, 63, JH7100_CLK_PERH0_SRC), + STARFIVE_GDIV(JH7100_CLK_TIMER5_CORE, "timer5_coreclk", 0, 63, JH7100_CLK_PERH0_SRC), + STARFIVE_GDIV(JH7100_CLK_TIMER6_CORE, "timer6_coreclk", 0, 63, JH7100_CLK_PERH0_SRC), + STARFIVE_GATE(JH7100_CLK_VP6INTC_APB, "vp6intc_apb", 0, JH7100_CLK_APB2_BUS), + STARFIVE_GATE(JH7100_CLK_PWM_APB, "pwm_apb", 0, JH7100_CLK_APB2_BUS), + STARFIVE_GATE(JH7100_CLK_MSI_APB, "msi_apb", 0, JH7100_CLK_APB2_BUS), + STARFIVE_GATE(JH7100_CLK_TEMP_APB, "temp_apb", 0, JH7100_CLK_APB2_BUS), + STARFIVE_GDIV(JH7100_CLK_TEMP_SENSE, "temp_sense", 0, 31, JH7100_CLK_OSC_SYS), + STARFIVE_GATE(JH7100_CLK_SYSERR_APB, "syserr_apb", 0, JH7100_CLK_APB2_BUS), }; static struct clk_hw *jh7100_clk_get(struct of_phandle_args *clkspec, void *data) { - struct jh71x0_clk_priv *priv = data; + struct starfive_clk_priv *priv = data; unsigned int idx = clkspec->args[0]; if (idx < JH7100_CLK_PLL0_OUT) @@ -283,7 +287,7 @@ static struct clk_hw *jh7100_clk_get(struct of_phandle_args *clkspec, void *data static int __init clk_starfive_jh7100_probe(struct platform_device *pdev) { - struct jh71x0_clk_priv *priv; + struct starfive_clk_priv *priv; unsigned int idx; int ret; @@ -317,12 +321,13 @@ static int __init clk_starfive_jh7100_probe(struct platform_device *pdev) struct clk_parent_data parents[4] = {}; struct clk_init_data init = { .name = jh7100_clk_data[idx].name, - .ops = starfive_jh71x0_clk_ops(max), + .ops = starfive_clk_ops(max), .parent_data = parents, - .num_parents = ((max & JH71X0_CLK_MUX_MASK) >> JH71X0_CLK_MUX_SHIFT) + 1, + .num_parents = ((max & STARFIVE_CLK_MUX_MASK) + >> STARFIVE_CLK_MUX_SHIFT) + 1, .flags = jh7100_clk_data[idx].flags, }; - struct jh71x0_clk *clk = &priv->reg[idx]; + struct starfive_clk *clk = &priv->reg[idx]; unsigned int i; for (i = 0; i < init.num_parents; i++) { @@ -344,7 +349,7 @@ static int __init clk_starfive_jh7100_probe(struct platform_device *pdev) clk->hw.init = &init; clk->idx = idx; - clk->max_div = max & JH71X0_CLK_DIV_MASK; + clk->max_div = max & STARFIVE_CLK_DIV_MASK; ret = devm_clk_hw_register(priv->dev, &clk->hw); if (ret) diff --git a/drivers/clk/starfive/clk-starfive-jh7110-aon.c b/drivers/clk/starfive/clk-starfive-jh7110-aon.c index 62954eb7b50a..a7ce89b566eb 100644 --- a/drivers/clk/starfive/clk-starfive-jh7110-aon.c +++ b/drivers/clk/starfive/clk-starfive-jh7110-aon.c @@ -23,40 +23,40 @@ #define JH7110_AONCLK_GMAC0_GTXCLK (JH7110_AONCLK_END + 5) #define JH7110_AONCLK_RTC_OSC (JH7110_AONCLK_END + 6) -static const struct jh71x0_clk_data jh7110_aonclk_data[] = { +static const struct starfive_clk_data jh7110_aonclk_data[] = { /* source */ - JH71X0__DIV(JH7110_AONCLK_OSC_DIV4, "osc_div4", 4, JH7110_AONCLK_OSC), - JH71X0__MUX(JH7110_AONCLK_APB_FUNC, "apb_func", 2, - JH7110_AONCLK_OSC_DIV4, - JH7110_AONCLK_OSC), + STARFIVE__DIV(JH7110_AONCLK_OSC_DIV4, "osc_div4", 4, JH7110_AONCLK_OSC), + STARFIVE__MUX(JH7110_AONCLK_APB_FUNC, "apb_func", 2, + JH7110_AONCLK_OSC_DIV4, + JH7110_AONCLK_OSC), /* gmac0 */ - JH71X0_GATE(JH7110_AONCLK_GMAC0_AHB, "gmac0_ahb", 0, JH7110_AONCLK_STG_AXIAHB), - JH71X0_GATE(JH7110_AONCLK_GMAC0_AXI, "gmac0_axi", 0, JH7110_AONCLK_STG_AXIAHB), - JH71X0__DIV(JH7110_AONCLK_GMAC0_RMII_RTX, "gmac0_rmii_rtx", 30, - JH7110_AONCLK_GMAC0_RMII_REFIN), - JH71X0_GMUX(JH7110_AONCLK_GMAC0_TX, "gmac0_tx", - CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT, 2, - JH7110_AONCLK_GMAC0_GTXCLK, - JH7110_AONCLK_GMAC0_RMII_RTX), - JH71X0__INV(JH7110_AONCLK_GMAC0_TX_INV, "gmac0_tx_inv", JH7110_AONCLK_GMAC0_TX), - JH71X0__MUX(JH7110_AONCLK_GMAC0_RX, "gmac0_rx", 2, - JH7110_AONCLK_GMAC0_RGMII_RXIN, - JH7110_AONCLK_GMAC0_RMII_RTX), - JH71X0__INV(JH7110_AONCLK_GMAC0_RX_INV, "gmac0_rx_inv", JH7110_AONCLK_GMAC0_RX), + STARFIVE_GATE(JH7110_AONCLK_GMAC0_AHB, "gmac0_ahb", 0, JH7110_AONCLK_STG_AXIAHB), + STARFIVE_GATE(JH7110_AONCLK_GMAC0_AXI, "gmac0_axi", 0, JH7110_AONCLK_STG_AXIAHB), + STARFIVE__DIV(JH7110_AONCLK_GMAC0_RMII_RTX, "gmac0_rmii_rtx", 30, + JH7110_AONCLK_GMAC0_RMII_REFIN), + STARFIVE_GMUX(JH7110_AONCLK_GMAC0_TX, "gmac0_tx", + CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT, 2, + JH7110_AONCLK_GMAC0_GTXCLK, + JH7110_AONCLK_GMAC0_RMII_RTX), + STARFIVE__INV(JH7110_AONCLK_GMAC0_TX_INV, "gmac0_tx_inv", JH7110_AONCLK_GMAC0_TX), + STARFIVE__MUX(JH7110_AONCLK_GMAC0_RX, "gmac0_rx", 2, + JH7110_AONCLK_GMAC0_RGMII_RXIN, + JH7110_AONCLK_GMAC0_RMII_RTX), + STARFIVE__INV(JH7110_AONCLK_GMAC0_RX_INV, "gmac0_rx_inv", JH7110_AONCLK_GMAC0_RX), /* otpc */ - JH71X0_GATE(JH7110_AONCLK_OTPC_APB, "otpc_apb", 0, JH7110_AONCLK_APB_BUS), + STARFIVE_GATE(JH7110_AONCLK_OTPC_APB, "otpc_apb", 0, JH7110_AONCLK_APB_BUS), /* rtc */ - JH71X0_GATE(JH7110_AONCLK_RTC_APB, "rtc_apb", 0, JH7110_AONCLK_APB_BUS), - JH71X0__DIV(JH7110_AONCLK_RTC_INTERNAL, "rtc_internal", 1022, JH7110_AONCLK_OSC), - JH71X0__MUX(JH7110_AONCLK_RTC_32K, "rtc_32k", 2, - JH7110_AONCLK_RTC_OSC, - JH7110_AONCLK_RTC_INTERNAL), - JH71X0_GATE(JH7110_AONCLK_RTC_CAL, "rtc_cal", 0, JH7110_AONCLK_OSC), + STARFIVE_GATE(JH7110_AONCLK_RTC_APB, "rtc_apb", 0, JH7110_AONCLK_APB_BUS), + STARFIVE__DIV(JH7110_AONCLK_RTC_INTERNAL, "rtc_internal", 1022, JH7110_AONCLK_OSC), + STARFIVE__MUX(JH7110_AONCLK_RTC_32K, "rtc_32k", 2, + JH7110_AONCLK_RTC_OSC, + JH7110_AONCLK_RTC_INTERNAL), + STARFIVE_GATE(JH7110_AONCLK_RTC_CAL, "rtc_cal", 0, JH7110_AONCLK_OSC), }; static struct clk_hw *jh7110_aonclk_get(struct of_phandle_args *clkspec, void *data) { - struct jh71x0_clk_priv *priv = data; + struct starfive_clk_priv *priv = data; unsigned int idx = clkspec->args[0]; if (idx < JH7110_AONCLK_END) @@ -67,7 +67,7 @@ static struct clk_hw *jh7110_aonclk_get(struct of_phandle_args *clkspec, void *d static int jh7110_aoncrg_probe(struct platform_device *pdev) { - struct jh71x0_clk_priv *priv; + struct starfive_clk_priv *priv; unsigned int idx; int ret; @@ -88,13 +88,13 @@ static int jh7110_aoncrg_probe(struct platform_device *pdev) struct clk_parent_data parents[4] = {}; struct clk_init_data init = { .name = jh7110_aonclk_data[idx].name, - .ops = starfive_jh71x0_clk_ops(max), + .ops = starfive_clk_ops(max), .parent_data = parents, .num_parents = - ((max & JH71X0_CLK_MUX_MASK) >> JH71X0_CLK_MUX_SHIFT) + 1, + ((max & STARFIVE_CLK_MUX_MASK) >> STARFIVE_CLK_MUX_SHIFT) + 1, .flags = jh7110_aonclk_data[idx].flags, }; - struct jh71x0_clk *clk = &priv->reg[idx]; + struct starfive_clk *clk = &priv->reg[idx]; unsigned int i; for (i = 0; i < init.num_parents; i++) { @@ -120,7 +120,7 @@ static int jh7110_aoncrg_probe(struct platform_device *pdev) clk->hw.init = &init; clk->idx = idx; - clk->max_div = max & JH71X0_CLK_DIV_MASK; + clk->max_div = max & STARFIVE_CLK_DIV_MASK; ret = devm_clk_hw_register(&pdev->dev, &clk->hw); if (ret) diff --git a/drivers/clk/starfive/clk-starfive-jh7110-isp.c b/drivers/clk/starfive/clk-starfive-jh7110-isp.c index ce034ed28532..be6040f718c0 100644 --- a/drivers/clk/starfive/clk-starfive-jh7110-isp.c +++ b/drivers/clk/starfive/clk-starfive-jh7110-isp.c @@ -28,41 +28,41 @@ static struct clk_bulk_data jh7110_isp_top_clks[] = { { .id = "isp_top_axi" } }; -static const struct jh71x0_clk_data jh7110_ispclk_data[] = { +static const struct starfive_clk_data jh7110_ispclk_data[] = { /* syscon */ - JH71X0__DIV(JH7110_ISPCLK_DOM4_APB_FUNC, "dom4_apb_func", 15, - JH7110_ISPCLK_ISP_TOP_AXI), - JH71X0__DIV(JH7110_ISPCLK_MIPI_RX0_PXL, "mipi_rx0_pxl", 8, - JH7110_ISPCLK_ISP_TOP_CORE), - JH71X0__INV(JH7110_ISPCLK_DVP_INV, "dvp_inv", JH7110_ISPCLK_DVP_CLK), + STARFIVE__DIV(JH7110_ISPCLK_DOM4_APB_FUNC, "dom4_apb_func", 15, + JH7110_ISPCLK_ISP_TOP_AXI), + STARFIVE__DIV(JH7110_ISPCLK_MIPI_RX0_PXL, "mipi_rx0_pxl", 8, + JH7110_ISPCLK_ISP_TOP_CORE), + STARFIVE__INV(JH7110_ISPCLK_DVP_INV, "dvp_inv", JH7110_ISPCLK_DVP_CLK), /* vin */ - JH71X0__DIV(JH7110_ISPCLK_M31DPHY_CFG_IN, "m31dphy_cfg_in", 16, - JH7110_ISPCLK_ISP_TOP_CORE), - JH71X0__DIV(JH7110_ISPCLK_M31DPHY_REF_IN, "m31dphy_ref_in", 16, - JH7110_ISPCLK_ISP_TOP_CORE), - JH71X0__DIV(JH7110_ISPCLK_M31DPHY_TX_ESC_LAN0, "m31dphy_tx_esc_lan0", 60, - JH7110_ISPCLK_ISP_TOP_CORE), - JH71X0_GATE(JH7110_ISPCLK_VIN_APB, "vin_apb", 0, - JH7110_ISPCLK_DOM4_APB_FUNC), - JH71X0__DIV(JH7110_ISPCLK_VIN_SYS, "vin_sys", 8, JH7110_ISPCLK_ISP_TOP_CORE), - JH71X0_GATE(JH7110_ISPCLK_VIN_PIXEL_IF0, "vin_pixel_if0", 0, - JH7110_ISPCLK_MIPI_RX0_PXL), - JH71X0_GATE(JH7110_ISPCLK_VIN_PIXEL_IF1, "vin_pixel_if1", 0, - JH7110_ISPCLK_MIPI_RX0_PXL), - JH71X0_GATE(JH7110_ISPCLK_VIN_PIXEL_IF2, "vin_pixel_if2", 0, - JH7110_ISPCLK_MIPI_RX0_PXL), - JH71X0_GATE(JH7110_ISPCLK_VIN_PIXEL_IF3, "vin_pixel_if3", 0, - JH7110_ISPCLK_MIPI_RX0_PXL), - JH71X0__MUX(JH7110_ISPCLK_VIN_P_AXI_WR, "vin_p_axi_wr", 2, - JH7110_ISPCLK_MIPI_RX0_PXL, - JH7110_ISPCLK_DVP_INV), + STARFIVE__DIV(JH7110_ISPCLK_M31DPHY_CFG_IN, "m31dphy_cfg_in", 16, + JH7110_ISPCLK_ISP_TOP_CORE), + STARFIVE__DIV(JH7110_ISPCLK_M31DPHY_REF_IN, "m31dphy_ref_in", 16, + JH7110_ISPCLK_ISP_TOP_CORE), + STARFIVE__DIV(JH7110_ISPCLK_M31DPHY_TX_ESC_LAN0, "m31dphy_tx_esc_lan0", 60, + JH7110_ISPCLK_ISP_TOP_CORE), + STARFIVE_GATE(JH7110_ISPCLK_VIN_APB, "vin_apb", 0, + JH7110_ISPCLK_DOM4_APB_FUNC), + STARFIVE__DIV(JH7110_ISPCLK_VIN_SYS, "vin_sys", 8, JH7110_ISPCLK_ISP_TOP_CORE), + STARFIVE_GATE(JH7110_ISPCLK_VIN_PIXEL_IF0, "vin_pixel_if0", 0, + JH7110_ISPCLK_MIPI_RX0_PXL), + STARFIVE_GATE(JH7110_ISPCLK_VIN_PIXEL_IF1, "vin_pixel_if1", 0, + JH7110_ISPCLK_MIPI_RX0_PXL), + STARFIVE_GATE(JH7110_ISPCLK_VIN_PIXEL_IF2, "vin_pixel_if2", 0, + JH7110_ISPCLK_MIPI_RX0_PXL), + STARFIVE_GATE(JH7110_ISPCLK_VIN_PIXEL_IF3, "vin_pixel_if3", 0, + JH7110_ISPCLK_MIPI_RX0_PXL), + STARFIVE__MUX(JH7110_ISPCLK_VIN_P_AXI_WR, "vin_p_axi_wr", 2, + JH7110_ISPCLK_MIPI_RX0_PXL, + JH7110_ISPCLK_DVP_INV), /* ispv2_top_wrapper */ - JH71X0_GMUX(JH7110_ISPCLK_ISPV2_TOP_WRAPPER_C, "ispv2_top_wrapper_c", 0, 2, - JH7110_ISPCLK_MIPI_RX0_PXL, - JH7110_ISPCLK_DVP_INV), + STARFIVE_GMUX(JH7110_ISPCLK_ISPV2_TOP_WRAPPER_C, "ispv2_top_wrapper_c", 0, 2, + JH7110_ISPCLK_MIPI_RX0_PXL, + JH7110_ISPCLK_DVP_INV), }; -static inline int jh7110_isp_top_rst_init(struct jh71x0_clk_priv *priv) +static inline int jh7110_isp_top_rst_init(struct starfive_clk_priv *priv) { struct reset_control *top_rsts; @@ -77,7 +77,7 @@ static inline int jh7110_isp_top_rst_init(struct jh71x0_clk_priv *priv) static struct clk_hw *jh7110_ispclk_get(struct of_phandle_args *clkspec, void *data) { - struct jh71x0_clk_priv *priv = data; + struct starfive_clk_priv *priv = data; unsigned int idx = clkspec->args[0]; if (idx < JH7110_ISPCLK_END) @@ -110,7 +110,7 @@ static const struct dev_pm_ops jh7110_ispcrg_pm_ops = { static int jh7110_ispcrg_probe(struct platform_device *pdev) { - struct jh71x0_clk_priv *priv; + struct starfive_clk_priv *priv; struct jh7110_top_sysclk *top; unsigned int idx; int ret; @@ -153,13 +153,13 @@ static int jh7110_ispcrg_probe(struct platform_device *pdev) struct clk_parent_data parents[4] = {}; struct clk_init_data init = { .name = jh7110_ispclk_data[idx].name, - .ops = starfive_jh71x0_clk_ops(max), + .ops = starfive_clk_ops(max), .parent_data = parents, .num_parents = - ((max & JH71X0_CLK_MUX_MASK) >> JH71X0_CLK_MUX_SHIFT) + 1, + ((max & STARFIVE_CLK_MUX_MASK) >> STARFIVE_CLK_MUX_SHIFT) + 1, .flags = jh7110_ispclk_data[idx].flags, }; - struct jh71x0_clk *clk = &priv->reg[idx]; + struct starfive_clk *clk = &priv->reg[idx]; unsigned int i; const char *fw_name[JH7110_ISPCLK_EXT_END - JH7110_ISPCLK_END] = { "isp_top_core", @@ -179,7 +179,7 @@ static int jh7110_ispcrg_probe(struct platform_device *pdev) clk->hw.init = &init; clk->idx = idx; - clk->max_div = max & JH71X0_CLK_DIV_MASK; + clk->max_div = max & STARFIVE_CLK_DIV_MASK; ret = devm_clk_hw_register(&pdev->dev, &clk->hw); if (ret) diff --git a/drivers/clk/starfive/clk-starfive-jh7110-stg.c b/drivers/clk/starfive/clk-starfive-jh7110-stg.c index dafcb7190592..2d6ee0ad343a 100644 --- a/drivers/clk/starfive/clk-starfive-jh7110-stg.c +++ b/drivers/clk/starfive/clk-starfive-jh7110-stg.c @@ -25,59 +25,59 @@ #define JH7110_STGCLK_APB_BUS (JH7110_STGCLK_END + 7) #define JH7110_STGCLK_EXT_END (JH7110_STGCLK_END + 8) -static const struct jh71x0_clk_data jh7110_stgclk_data[] = { +static const struct starfive_clk_data jh7110_stgclk_data[] = { /* hifi4 */ - JH71X0_GATE(JH7110_STGCLK_HIFI4_CLK_CORE, "hifi4_clk_core", 0, - JH7110_STGCLK_HIFI4_CORE), + STARFIVE_GATE(JH7110_STGCLK_HIFI4_CLK_CORE, "hifi4_clk_core", 0, + JH7110_STGCLK_HIFI4_CORE), /* usb */ - JH71X0_GATE(JH7110_STGCLK_USB0_APB, "usb0_apb", 0, JH7110_STGCLK_APB_BUS), - JH71X0_GATE(JH7110_STGCLK_USB0_UTMI_APB, "usb0_utmi_apb", 0, JH7110_STGCLK_APB_BUS), - JH71X0_GATE(JH7110_STGCLK_USB0_AXI, "usb0_axi", 0, JH7110_STGCLK_STG_AXIAHB), - JH71X0_GDIV(JH7110_STGCLK_USB0_LPM, "usb0_lpm", 0, 2, JH7110_STGCLK_OSC), - JH71X0_GDIV(JH7110_STGCLK_USB0_STB, "usb0_stb", 0, 4, JH7110_STGCLK_OSC), - JH71X0_GATE(JH7110_STGCLK_USB0_APP_125, "usb0_app_125", 0, JH7110_STGCLK_USB_125M), - JH71X0__DIV(JH7110_STGCLK_USB0_REFCLK, "usb0_refclk", 2, JH7110_STGCLK_OSC), + STARFIVE_GATE(JH7110_STGCLK_USB0_APB, "usb0_apb", 0, JH7110_STGCLK_APB_BUS), + STARFIVE_GATE(JH7110_STGCLK_USB0_UTMI_APB, "usb0_utmi_apb", 0, JH7110_STGCLK_APB_BUS), + STARFIVE_GATE(JH7110_STGCLK_USB0_AXI, "usb0_axi", 0, JH7110_STGCLK_STG_AXIAHB), + STARFIVE_GDIV(JH7110_STGCLK_USB0_LPM, "usb0_lpm", 0, 2, JH7110_STGCLK_OSC), + STARFIVE_GDIV(JH7110_STGCLK_USB0_STB, "usb0_stb", 0, 4, JH7110_STGCLK_OSC), + STARFIVE_GATE(JH7110_STGCLK_USB0_APP_125, "usb0_app_125", 0, JH7110_STGCLK_USB_125M), + STARFIVE__DIV(JH7110_STGCLK_USB0_REFCLK, "usb0_refclk", 2, JH7110_STGCLK_OSC), /* pci-e */ - JH71X0_GATE(JH7110_STGCLK_PCIE0_AXI_MST0, "pcie0_axi_mst0", 0, - JH7110_STGCLK_STG_AXIAHB), - JH71X0_GATE(JH7110_STGCLK_PCIE0_APB, "pcie0_apb", 0, JH7110_STGCLK_APB_BUS), - JH71X0_GATE(JH7110_STGCLK_PCIE0_TL, "pcie0_tl", 0, JH7110_STGCLK_STG_AXIAHB), - JH71X0_GATE(JH7110_STGCLK_PCIE1_AXI_MST0, "pcie1_axi_mst0", 0, - JH7110_STGCLK_STG_AXIAHB), - JH71X0_GATE(JH7110_STGCLK_PCIE1_APB, "pcie1_apb", 0, JH7110_STGCLK_APB_BUS), - JH71X0_GATE(JH7110_STGCLK_PCIE1_TL, "pcie1_tl", 0, JH7110_STGCLK_STG_AXIAHB), - JH71X0_GATE(JH7110_STGCLK_PCIE_SLV_MAIN, "pcie_slv_main", CLK_IS_CRITICAL, - JH7110_STGCLK_STG_AXIAHB), + STARFIVE_GATE(JH7110_STGCLK_PCIE0_AXI_MST0, "pcie0_axi_mst0", 0, + JH7110_STGCLK_STG_AXIAHB), + STARFIVE_GATE(JH7110_STGCLK_PCIE0_APB, "pcie0_apb", 0, JH7110_STGCLK_APB_BUS), + STARFIVE_GATE(JH7110_STGCLK_PCIE0_TL, "pcie0_tl", 0, JH7110_STGCLK_STG_AXIAHB), + STARFIVE_GATE(JH7110_STGCLK_PCIE1_AXI_MST0, "pcie1_axi_mst0", 0, + JH7110_STGCLK_STG_AXIAHB), + STARFIVE_GATE(JH7110_STGCLK_PCIE1_APB, "pcie1_apb", 0, JH7110_STGCLK_APB_BUS), + STARFIVE_GATE(JH7110_STGCLK_PCIE1_TL, "pcie1_tl", 0, JH7110_STGCLK_STG_AXIAHB), + STARFIVE_GATE(JH7110_STGCLK_PCIE_SLV_MAIN, "pcie_slv_main", CLK_IS_CRITICAL, + JH7110_STGCLK_STG_AXIAHB), /* security */ - JH71X0_GATE(JH7110_STGCLK_SEC_AHB, "sec_ahb", 0, JH7110_STGCLK_STG_AXIAHB), - JH71X0_GATE(JH7110_STGCLK_SEC_MISC_AHB, "sec_misc_ahb", 0, JH7110_STGCLK_STG_AXIAHB), + STARFIVE_GATE(JH7110_STGCLK_SEC_AHB, "sec_ahb", 0, JH7110_STGCLK_STG_AXIAHB), + STARFIVE_GATE(JH7110_STGCLK_SEC_MISC_AHB, "sec_misc_ahb", 0, JH7110_STGCLK_STG_AXIAHB), /* stg mtrx */ - JH71X0_GATE(JH7110_STGCLK_GRP0_MAIN, "mtrx_grp0_main", CLK_IS_CRITICAL, - JH7110_STGCLK_CPU_BUS), - JH71X0_GATE(JH7110_STGCLK_GRP0_BUS, "mtrx_grp0_bus", CLK_IS_CRITICAL, - JH7110_STGCLK_NOCSTG_BUS), - JH71X0_GATE(JH7110_STGCLK_GRP0_STG, "mtrx_grp0_stg", CLK_IS_CRITICAL, - JH7110_STGCLK_STG_AXIAHB), - JH71X0_GATE(JH7110_STGCLK_GRP1_MAIN, "mtrx_grp1_main", CLK_IS_CRITICAL, - JH7110_STGCLK_CPU_BUS), - JH71X0_GATE(JH7110_STGCLK_GRP1_BUS, "mtrx_grp1_bus", CLK_IS_CRITICAL, - JH7110_STGCLK_NOCSTG_BUS), - JH71X0_GATE(JH7110_STGCLK_GRP1_STG, "mtrx_grp1_stg", CLK_IS_CRITICAL, - JH7110_STGCLK_STG_AXIAHB), - JH71X0_GATE(JH7110_STGCLK_GRP1_HIFI, "mtrx_grp1_hifi", CLK_IS_CRITICAL, - JH7110_STGCLK_HIFI4_AXI), + STARFIVE_GATE(JH7110_STGCLK_GRP0_MAIN, "mtrx_grp0_main", CLK_IS_CRITICAL, + JH7110_STGCLK_CPU_BUS), + STARFIVE_GATE(JH7110_STGCLK_GRP0_BUS, "mtrx_grp0_bus", CLK_IS_CRITICAL, + JH7110_STGCLK_NOCSTG_BUS), + STARFIVE_GATE(JH7110_STGCLK_GRP0_STG, "mtrx_grp0_stg", CLK_IS_CRITICAL, + JH7110_STGCLK_STG_AXIAHB), + STARFIVE_GATE(JH7110_STGCLK_GRP1_MAIN, "mtrx_grp1_main", CLK_IS_CRITICAL, + JH7110_STGCLK_CPU_BUS), + STARFIVE_GATE(JH7110_STGCLK_GRP1_BUS, "mtrx_grp1_bus", CLK_IS_CRITICAL, + JH7110_STGCLK_NOCSTG_BUS), + STARFIVE_GATE(JH7110_STGCLK_GRP1_STG, "mtrx_grp1_stg", CLK_IS_CRITICAL, + JH7110_STGCLK_STG_AXIAHB), + STARFIVE_GATE(JH7110_STGCLK_GRP1_HIFI, "mtrx_grp1_hifi", CLK_IS_CRITICAL, + JH7110_STGCLK_HIFI4_AXI), /* e24_rvpi */ - JH71X0_GDIV(JH7110_STGCLK_E2_RTC, "e2_rtc", 0, 24, JH7110_STGCLK_OSC), - JH71X0_GATE(JH7110_STGCLK_E2_CORE, "e2_core", 0, JH7110_STGCLK_STG_AXIAHB), - JH71X0_GATE(JH7110_STGCLK_E2_DBG, "e2_dbg", 0, JH7110_STGCLK_STG_AXIAHB), + STARFIVE_GDIV(JH7110_STGCLK_E2_RTC, "e2_rtc", 0, 24, JH7110_STGCLK_OSC), + STARFIVE_GATE(JH7110_STGCLK_E2_CORE, "e2_core", 0, JH7110_STGCLK_STG_AXIAHB), + STARFIVE_GATE(JH7110_STGCLK_E2_DBG, "e2_dbg", 0, JH7110_STGCLK_STG_AXIAHB), /* dw_sgdma1p */ - JH71X0_GATE(JH7110_STGCLK_DMA1P_AXI, "dma1p_axi", 0, JH7110_STGCLK_STG_AXIAHB), - JH71X0_GATE(JH7110_STGCLK_DMA1P_AHB, "dma1p_ahb", 0, JH7110_STGCLK_STG_AXIAHB), + STARFIVE_GATE(JH7110_STGCLK_DMA1P_AXI, "dma1p_axi", 0, JH7110_STGCLK_STG_AXIAHB), + STARFIVE_GATE(JH7110_STGCLK_DMA1P_AHB, "dma1p_ahb", 0, JH7110_STGCLK_STG_AXIAHB), }; static struct clk_hw *jh7110_stgclk_get(struct of_phandle_args *clkspec, void *data) { - struct jh71x0_clk_priv *priv = data; + struct starfive_clk_priv *priv = data; unsigned int idx = clkspec->args[0]; if (idx < JH7110_STGCLK_END) @@ -88,7 +88,7 @@ static struct clk_hw *jh7110_stgclk_get(struct of_phandle_args *clkspec, void *d static int jh7110_stgcrg_probe(struct platform_device *pdev) { - struct jh71x0_clk_priv *priv; + struct starfive_clk_priv *priv; unsigned int idx; int ret; @@ -108,13 +108,13 @@ static int jh7110_stgcrg_probe(struct platform_device *pdev) struct clk_parent_data parents[4] = {}; struct clk_init_data init = { .name = jh7110_stgclk_data[idx].name, - .ops = starfive_jh71x0_clk_ops(max), + .ops = starfive_clk_ops(max), .parent_data = parents, .num_parents = - ((max & JH71X0_CLK_MUX_MASK) >> JH71X0_CLK_MUX_SHIFT) + 1, + ((max & STARFIVE_CLK_MUX_MASK) >> STARFIVE_CLK_MUX_SHIFT) + 1, .flags = jh7110_stgclk_data[idx].flags, }; - struct jh71x0_clk *clk = &priv->reg[idx]; + struct starfive_clk *clk = &priv->reg[idx]; const char *fw_name[JH7110_STGCLK_EXT_END - JH7110_STGCLK_END] = { "osc", "hifi4_core", @@ -138,7 +138,7 @@ static int jh7110_stgcrg_probe(struct platform_device *pdev) clk->hw.init = &init; clk->idx = idx; - clk->max_div = max & JH71X0_CLK_DIV_MASK; + clk->max_div = max & STARFIVE_CLK_DIV_MASK; ret = devm_clk_hw_register(&pdev->dev, &clk->hw); if (ret) diff --git a/drivers/clk/starfive/clk-starfive-jh7110-sys.c b/drivers/clk/starfive/clk-starfive-jh7110-sys.c index e63353c70209..00ef88d9c2fd 100644 --- a/drivers/clk/starfive/clk-starfive-jh7110-sys.c +++ b/drivers/clk/starfive/clk-starfive-jh7110-sys.c @@ -34,298 +34,301 @@ #define JH7110_SYSCLK_PLL1_OUT (JH7110_SYSCLK_END + 10) #define JH7110_SYSCLK_PLL2_OUT (JH7110_SYSCLK_END + 11) -static const struct jh71x0_clk_data jh7110_sysclk_data[] __initconst = { +static const struct starfive_clk_data jh7110_sysclk_data[] __initconst = { /* root */ - JH71X0__MUX(JH7110_SYSCLK_CPU_ROOT, "cpu_root", 2, - JH7110_SYSCLK_OSC, - JH7110_SYSCLK_PLL0_OUT), - JH71X0__DIV(JH7110_SYSCLK_CPU_CORE, "cpu_core", 7, JH7110_SYSCLK_CPU_ROOT), - JH71X0__DIV(JH7110_SYSCLK_CPU_BUS, "cpu_bus", 2, JH7110_SYSCLK_CPU_CORE), - JH71X0__MUX(JH7110_SYSCLK_GPU_ROOT, "gpu_root", 2, - JH7110_SYSCLK_PLL2_OUT, - JH7110_SYSCLK_PLL1_OUT), - JH71X0_MDIV(JH7110_SYSCLK_PERH_ROOT, "perh_root", 2, 2, - JH7110_SYSCLK_PLL0_OUT, - JH7110_SYSCLK_PLL2_OUT), - JH71X0__MUX(JH7110_SYSCLK_BUS_ROOT, "bus_root", 2, - JH7110_SYSCLK_OSC, - JH7110_SYSCLK_PLL2_OUT), - JH71X0__DIV(JH7110_SYSCLK_NOCSTG_BUS, "nocstg_bus", 3, JH7110_SYSCLK_BUS_ROOT), - JH71X0__DIV(JH7110_SYSCLK_AXI_CFG0, "axi_cfg0", 3, JH7110_SYSCLK_BUS_ROOT), - JH71X0__DIV(JH7110_SYSCLK_STG_AXIAHB, "stg_axiahb", 2, JH7110_SYSCLK_AXI_CFG0), - JH71X0_GATE(JH7110_SYSCLK_AHB0, "ahb0", CLK_IS_CRITICAL, JH7110_SYSCLK_STG_AXIAHB), - JH71X0_GATE(JH7110_SYSCLK_AHB1, "ahb1", CLK_IS_CRITICAL, JH7110_SYSCLK_STG_AXIAHB), - JH71X0__DIV(JH7110_SYSCLK_APB_BUS, "apb_bus", 8, JH7110_SYSCLK_STG_AXIAHB), - JH71X0_GATE(JH7110_SYSCLK_APB0, "apb0", CLK_IS_CRITICAL, JH7110_SYSCLK_APB_BUS), - JH71X0__DIV(JH7110_SYSCLK_PLL0_DIV2, "pll0_div2", 2, JH7110_SYSCLK_PLL0_OUT), - JH71X0__DIV(JH7110_SYSCLK_PLL1_DIV2, "pll1_div2", 2, JH7110_SYSCLK_PLL1_OUT), - JH71X0__DIV(JH7110_SYSCLK_PLL2_DIV2, "pll2_div2", 2, JH7110_SYSCLK_PLL2_OUT), - JH71X0__DIV(JH7110_SYSCLK_AUDIO_ROOT, "audio_root", 8, JH7110_SYSCLK_PLL2_OUT), - JH71X0__DIV(JH7110_SYSCLK_MCLK_INNER, "mclk_inner", 64, JH7110_SYSCLK_AUDIO_ROOT), - JH71X0__MUX(JH7110_SYSCLK_MCLK, "mclk", 2, - JH7110_SYSCLK_MCLK_INNER, - JH7110_SYSCLK_MCLK_EXT), - JH71X0_GATE(JH7110_SYSCLK_MCLK_OUT, "mclk_out", 0, JH7110_SYSCLK_MCLK_INNER), - JH71X0_MDIV(JH7110_SYSCLK_ISP_2X, "isp_2x", 8, 2, - JH7110_SYSCLK_PLL2_OUT, - JH7110_SYSCLK_PLL1_OUT), - JH71X0__DIV(JH7110_SYSCLK_ISP_AXI, "isp_axi", 4, JH7110_SYSCLK_ISP_2X), - JH71X0_GDIV(JH7110_SYSCLK_GCLK0, "gclk0", 0, 62, JH7110_SYSCLK_PLL0_DIV2), - JH71X0_GDIV(JH7110_SYSCLK_GCLK1, "gclk1", 0, 62, JH7110_SYSCLK_PLL1_DIV2), - JH71X0_GDIV(JH7110_SYSCLK_GCLK2, "gclk2", 0, 62, JH7110_SYSCLK_PLL2_DIV2), + STARFIVE__MUX(JH7110_SYSCLK_CPU_ROOT, "cpu_root", 2, + JH7110_SYSCLK_OSC, + JH7110_SYSCLK_PLL0_OUT), + STARFIVE__DIV(JH7110_SYSCLK_CPU_CORE, "cpu_core", 7, JH7110_SYSCLK_CPU_ROOT), + STARFIVE__DIV(JH7110_SYSCLK_CPU_BUS, "cpu_bus", 2, JH7110_SYSCLK_CPU_CORE), + STARFIVE__MUX(JH7110_SYSCLK_GPU_ROOT, "gpu_root", 2, + JH7110_SYSCLK_PLL2_OUT, + JH7110_SYSCLK_PLL1_OUT), + STARFIVE_MDIV(JH7110_SYSCLK_PERH_ROOT, "perh_root", 2, 2, + JH7110_SYSCLK_PLL0_OUT, + JH7110_SYSCLK_PLL2_OUT), + STARFIVE__MUX(JH7110_SYSCLK_BUS_ROOT, "bus_root", 2, + JH7110_SYSCLK_OSC, + JH7110_SYSCLK_PLL2_OUT), + STARFIVE__DIV(JH7110_SYSCLK_NOCSTG_BUS, "nocstg_bus", 3, JH7110_SYSCLK_BUS_ROOT), + STARFIVE__DIV(JH7110_SYSCLK_AXI_CFG0, "axi_cfg0", 3, JH7110_SYSCLK_BUS_ROOT), + STARFIVE__DIV(JH7110_SYSCLK_STG_AXIAHB, "stg_axiahb", 2, JH7110_SYSCLK_AXI_CFG0), + STARFIVE_GATE(JH7110_SYSCLK_AHB0, "ahb0", CLK_IS_CRITICAL, JH7110_SYSCLK_STG_AXIAHB), + STARFIVE_GATE(JH7110_SYSCLK_AHB1, "ahb1", CLK_IS_CRITICAL, JH7110_SYSCLK_STG_AXIAHB), + STARFIVE__DIV(JH7110_SYSCLK_APB_BUS, "apb_bus", 8, JH7110_SYSCLK_STG_AXIAHB), + STARFIVE_GATE(JH7110_SYSCLK_APB0, "apb0", CLK_IS_CRITICAL, JH7110_SYSCLK_APB_BUS), + STARFIVE__DIV(JH7110_SYSCLK_PLL0_DIV2, "pll0_div2", 2, JH7110_SYSCLK_PLL0_OUT), + STARFIVE__DIV(JH7110_SYSCLK_PLL1_DIV2, "pll1_div2", 2, JH7110_SYSCLK_PLL1_OUT), + STARFIVE__DIV(JH7110_SYSCLK_PLL2_DIV2, "pll2_div2", 2, JH7110_SYSCLK_PLL2_OUT), + STARFIVE__DIV(JH7110_SYSCLK_AUDIO_ROOT, "audio_root", 8, JH7110_SYSCLK_PLL2_OUT), + STARFIVE__DIV(JH7110_SYSCLK_MCLK_INNER, "mclk_inner", 64, JH7110_SYSCLK_AUDIO_ROOT), + STARFIVE__MUX(JH7110_SYSCLK_MCLK, "mclk", 2, + JH7110_SYSCLK_MCLK_INNER, + JH7110_SYSCLK_MCLK_EXT), + STARFIVE_GATE(JH7110_SYSCLK_MCLK_OUT, "mclk_out", 0, JH7110_SYSCLK_MCLK_INNER), + STARFIVE_MDIV(JH7110_SYSCLK_ISP_2X, "isp_2x", 8, 2, + JH7110_SYSCLK_PLL2_OUT, + JH7110_SYSCLK_PLL1_OUT), + STARFIVE__DIV(JH7110_SYSCLK_ISP_AXI, "isp_axi", 4, JH7110_SYSCLK_ISP_2X), + STARFIVE_GDIV(JH7110_SYSCLK_GCLK0, "gclk0", 0, 62, JH7110_SYSCLK_PLL0_DIV2), + STARFIVE_GDIV(JH7110_SYSCLK_GCLK1, "gclk1", 0, 62, JH7110_SYSCLK_PLL1_DIV2), + STARFIVE_GDIV(JH7110_SYSCLK_GCLK2, "gclk2", 0, 62, JH7110_SYSCLK_PLL2_DIV2), /* cores */ - JH71X0_GATE(JH7110_SYSCLK_CORE, "core", CLK_IS_CRITICAL, JH7110_SYSCLK_CPU_CORE), - JH71X0_GATE(JH7110_SYSCLK_CORE1, "core1", CLK_IS_CRITICAL, JH7110_SYSCLK_CPU_CORE), - JH71X0_GATE(JH7110_SYSCLK_CORE2, "core2", CLK_IS_CRITICAL, JH7110_SYSCLK_CPU_CORE), - JH71X0_GATE(JH7110_SYSCLK_CORE3, "core3", CLK_IS_CRITICAL, JH7110_SYSCLK_CPU_CORE), - JH71X0_GATE(JH7110_SYSCLK_CORE4, "core4", CLK_IS_CRITICAL, JH7110_SYSCLK_CPU_CORE), - JH71X0_GATE(JH7110_SYSCLK_DEBUG, "debug", 0, JH7110_SYSCLK_CPU_BUS), - JH71X0__DIV(JH7110_SYSCLK_RTC_TOGGLE, "rtc_toggle", 6, JH7110_SYSCLK_OSC), - JH71X0_GATE(JH7110_SYSCLK_TRACE0, "trace0", 0, JH7110_SYSCLK_CPU_CORE), - JH71X0_GATE(JH7110_SYSCLK_TRACE1, "trace1", 0, JH7110_SYSCLK_CPU_CORE), - JH71X0_GATE(JH7110_SYSCLK_TRACE2, "trace2", 0, JH7110_SYSCLK_CPU_CORE), - JH71X0_GATE(JH7110_SYSCLK_TRACE3, "trace3", 0, JH7110_SYSCLK_CPU_CORE), - JH71X0_GATE(JH7110_SYSCLK_TRACE4, "trace4", 0, JH7110_SYSCLK_CPU_CORE), - JH71X0_GATE(JH7110_SYSCLK_TRACE_COM, "trace_com", 0, JH7110_SYSCLK_CPU_BUS), + STARFIVE_GATE(JH7110_SYSCLK_CORE, "core", CLK_IS_CRITICAL, JH7110_SYSCLK_CPU_CORE), + STARFIVE_GATE(JH7110_SYSCLK_CORE1, "core1", CLK_IS_CRITICAL, JH7110_SYSCLK_CPU_CORE), + STARFIVE_GATE(JH7110_SYSCLK_CORE2, "core2", CLK_IS_CRITICAL, JH7110_SYSCLK_CPU_CORE), + STARFIVE_GATE(JH7110_SYSCLK_CORE3, "core3", CLK_IS_CRITICAL, JH7110_SYSCLK_CPU_CORE), + STARFIVE_GATE(JH7110_SYSCLK_CORE4, "core4", CLK_IS_CRITICAL, JH7110_SYSCLK_CPU_CORE), + STARFIVE_GATE(JH7110_SYSCLK_DEBUG, "debug", 0, JH7110_SYSCLK_CPU_BUS), + STARFIVE__DIV(JH7110_SYSCLK_RTC_TOGGLE, "rtc_toggle", 6, JH7110_SYSCLK_OSC), + STARFIVE_GATE(JH7110_SYSCLK_TRACE0, "trace0", 0, JH7110_SYSCLK_CPU_CORE), + STARFIVE_GATE(JH7110_SYSCLK_TRACE1, "trace1", 0, JH7110_SYSCLK_CPU_CORE), + STARFIVE_GATE(JH7110_SYSCLK_TRACE2, "trace2", 0, JH7110_SYSCLK_CPU_CORE), + STARFIVE_GATE(JH7110_SYSCLK_TRACE3, "trace3", 0, JH7110_SYSCLK_CPU_CORE), + STARFIVE_GATE(JH7110_SYSCLK_TRACE4, "trace4", 0, JH7110_SYSCLK_CPU_CORE), + STARFIVE_GATE(JH7110_SYSCLK_TRACE_COM, "trace_com", 0, JH7110_SYSCLK_CPU_BUS), /* noc */ - JH71X0_GATE(JH7110_SYSCLK_NOC_BUS_CPU_AXI, "noc_bus_cpu_axi", CLK_IS_CRITICAL, - JH7110_SYSCLK_CPU_BUS), - JH71X0_GATE(JH7110_SYSCLK_NOC_BUS_AXICFG0_AXI, "noc_bus_axicfg0_axi", CLK_IS_CRITICAL, - JH7110_SYSCLK_AXI_CFG0), + STARFIVE_GATE(JH7110_SYSCLK_NOC_BUS_CPU_AXI, "noc_bus_cpu_axi", CLK_IS_CRITICAL, + JH7110_SYSCLK_CPU_BUS), + STARFIVE_GATE(JH7110_SYSCLK_NOC_BUS_AXICFG0_AXI, "noc_bus_axicfg0_axi", CLK_IS_CRITICAL, + JH7110_SYSCLK_AXI_CFG0), /* ddr */ - JH71X0__DIV(JH7110_SYSCLK_OSC_DIV2, "osc_div2", 2, JH7110_SYSCLK_OSC), - JH71X0__DIV(JH7110_SYSCLK_PLL1_DIV4, "pll1_div4", 2, JH7110_SYSCLK_PLL1_DIV2), - JH71X0__DIV(JH7110_SYSCLK_PLL1_DIV8, "pll1_div8", 2, JH7110_SYSCLK_PLL1_DIV4), - JH71X0__MUX(JH7110_SYSCLK_DDR_BUS, "ddr_bus", 4, - JH7110_SYSCLK_OSC_DIV2, - JH7110_SYSCLK_PLL1_DIV2, - JH7110_SYSCLK_PLL1_DIV4, - JH7110_SYSCLK_PLL1_DIV8), - JH71X0_GATE(JH7110_SYSCLK_DDR_AXI, "ddr_axi", CLK_IS_CRITICAL, JH7110_SYSCLK_DDR_BUS), + STARFIVE__DIV(JH7110_SYSCLK_OSC_DIV2, "osc_div2", 2, JH7110_SYSCLK_OSC), + STARFIVE__DIV(JH7110_SYSCLK_PLL1_DIV4, "pll1_div4", 2, JH7110_SYSCLK_PLL1_DIV2), + STARFIVE__DIV(JH7110_SYSCLK_PLL1_DIV8, "pll1_div8", 2, JH7110_SYSCLK_PLL1_DIV4), + STARFIVE__MUX(JH7110_SYSCLK_DDR_BUS, "ddr_bus", 4, + JH7110_SYSCLK_OSC_DIV2, + JH7110_SYSCLK_PLL1_DIV2, + JH7110_SYSCLK_PLL1_DIV4, + JH7110_SYSCLK_PLL1_DIV8), + STARFIVE_GATE(JH7110_SYSCLK_DDR_AXI, "ddr_axi", CLK_IS_CRITICAL, JH7110_SYSCLK_DDR_BUS), /* gpu */ - JH71X0__DIV(JH7110_SYSCLK_GPU_CORE, "gpu_core", 7, JH7110_SYSCLK_GPU_ROOT), - JH71X0_GATE(JH7110_SYSCLK_GPU_CORE_CLK, "gpu_core_clk", 0, JH7110_SYSCLK_GPU_CORE), - JH71X0_GATE(JH7110_SYSCLK_GPU_SYS_CLK, "gpu_sys_clk", 0, JH7110_SYSCLK_ISP_AXI), - JH71X0_GATE(JH7110_SYSCLK_GPU_APB, "gpu_apb", 0, JH7110_SYSCLK_APB_BUS), - JH71X0_GDIV(JH7110_SYSCLK_GPU_RTC_TOGGLE, "gpu_rtc_toggle", 0, 12, JH7110_SYSCLK_OSC), - JH71X0_GATE(JH7110_SYSCLK_NOC_BUS_GPU_AXI, "noc_bus_gpu_axi", 0, JH7110_SYSCLK_GPU_CORE), + STARFIVE__DIV(JH7110_SYSCLK_GPU_CORE, "gpu_core", 7, JH7110_SYSCLK_GPU_ROOT), + STARFIVE_GATE(JH7110_SYSCLK_GPU_CORE_CLK, "gpu_core_clk", 0, JH7110_SYSCLK_GPU_CORE), + STARFIVE_GATE(JH7110_SYSCLK_GPU_SYS_CLK, "gpu_sys_clk", 0, JH7110_SYSCLK_ISP_AXI), + STARFIVE_GATE(JH7110_SYSCLK_GPU_APB, "gpu_apb", 0, JH7110_SYSCLK_APB_BUS), + STARFIVE_GDIV(JH7110_SYSCLK_GPU_RTC_TOGGLE, "gpu_rtc_toggle", 0, 12, JH7110_SYSCLK_OSC), + STARFIVE_GATE(JH7110_SYSCLK_NOC_BUS_GPU_AXI, "noc_bus_gpu_axi", 0, JH7110_SYSCLK_GPU_CORE), /* isp */ - JH71X0_GATE(JH7110_SYSCLK_ISP_TOP_CORE, "isp_top_core", 0, JH7110_SYSCLK_ISP_2X), - JH71X0_GATE(JH7110_SYSCLK_ISP_TOP_AXI, "isp_top_axi", 0, JH7110_SYSCLK_ISP_AXI), - JH71X0_GATE(JH7110_SYSCLK_NOC_BUS_ISP_AXI, "noc_bus_isp_axi", CLK_IS_CRITICAL, - JH7110_SYSCLK_ISP_AXI), + STARFIVE_GATE(JH7110_SYSCLK_ISP_TOP_CORE, "isp_top_core", 0, JH7110_SYSCLK_ISP_2X), + STARFIVE_GATE(JH7110_SYSCLK_ISP_TOP_AXI, "isp_top_axi", 0, JH7110_SYSCLK_ISP_AXI), + STARFIVE_GATE(JH7110_SYSCLK_NOC_BUS_ISP_AXI, "noc_bus_isp_axi", CLK_IS_CRITICAL, + JH7110_SYSCLK_ISP_AXI), /* hifi4 */ - JH71X0__DIV(JH7110_SYSCLK_HIFI4_CORE, "hifi4_core", 15, JH7110_SYSCLK_BUS_ROOT), - JH71X0__DIV(JH7110_SYSCLK_HIFI4_AXI, "hifi4_axi", 2, JH7110_SYSCLK_HIFI4_CORE), + STARFIVE__DIV(JH7110_SYSCLK_HIFI4_CORE, "hifi4_core", 15, JH7110_SYSCLK_BUS_ROOT), + STARFIVE__DIV(JH7110_SYSCLK_HIFI4_AXI, "hifi4_axi", 2, JH7110_SYSCLK_HIFI4_CORE), /* axi_cfg1 */ - JH71X0_GATE(JH7110_SYSCLK_AXI_CFG1_MAIN, "axi_cfg1_main", CLK_IS_CRITICAL, - JH7110_SYSCLK_ISP_AXI), - JH71X0_GATE(JH7110_SYSCLK_AXI_CFG1_AHB, "axi_cfg1_ahb", CLK_IS_CRITICAL, - JH7110_SYSCLK_AHB0), + STARFIVE_GATE(JH7110_SYSCLK_AXI_CFG1_MAIN, "axi_cfg1_main", CLK_IS_CRITICAL, + JH7110_SYSCLK_ISP_AXI), + STARFIVE_GATE(JH7110_SYSCLK_AXI_CFG1_AHB, "axi_cfg1_ahb", CLK_IS_CRITICAL, + JH7110_SYSCLK_AHB0), /* vout */ - JH71X0_GATE(JH7110_SYSCLK_VOUT_SRC, "vout_src", 0, JH7110_SYSCLK_PLL2_OUT), - JH71X0__DIV(JH7110_SYSCLK_VOUT_AXI, "vout_axi", 7, JH7110_SYSCLK_PLL2_OUT), - JH71X0_GATE(JH7110_SYSCLK_NOC_BUS_DISP_AXI, "noc_bus_disp_axi", 0, JH7110_SYSCLK_VOUT_AXI), - JH71X0_GATE(JH7110_SYSCLK_VOUT_TOP_AHB, "vout_top_ahb", 0, JH7110_SYSCLK_AHB1), - JH71X0_GATE(JH7110_SYSCLK_VOUT_TOP_AXI, "vout_top_axi", 0, JH7110_SYSCLK_VOUT_AXI), - JH71X0_GATE(JH7110_SYSCLK_VOUT_TOP_HDMITX0_MCLK, "vout_top_hdmitx0_mclk", 0, - JH7110_SYSCLK_MCLK), - JH71X0__DIV(JH7110_SYSCLK_VOUT_TOP_MIPIPHY_REF, "vout_top_mipiphy_ref", 2, - JH7110_SYSCLK_OSC), + STARFIVE_GATE(JH7110_SYSCLK_VOUT_SRC, "vout_src", 0, JH7110_SYSCLK_PLL2_OUT), + STARFIVE__DIV(JH7110_SYSCLK_VOUT_AXI, "vout_axi", 7, JH7110_SYSCLK_PLL2_OUT), + STARFIVE_GATE(JH7110_SYSCLK_NOC_BUS_DISP_AXI, "noc_bus_disp_axi", 0, + JH7110_SYSCLK_VOUT_AXI), + STARFIVE_GATE(JH7110_SYSCLK_VOUT_TOP_AHB, "vout_top_ahb", 0, JH7110_SYSCLK_AHB1), + STARFIVE_GATE(JH7110_SYSCLK_VOUT_TOP_AXI, "vout_top_axi", 0, JH7110_SYSCLK_VOUT_AXI), + STARFIVE_GATE(JH7110_SYSCLK_VOUT_TOP_HDMITX0_MCLK, "vout_top_hdmitx0_mclk", 0, + JH7110_SYSCLK_MCLK), + STARFIVE__DIV(JH7110_SYSCLK_VOUT_TOP_MIPIPHY_REF, "vout_top_mipiphy_ref", 2, + JH7110_SYSCLK_OSC), /* jpegc */ - JH71X0__DIV(JH7110_SYSCLK_JPEGC_AXI, "jpegc_axi", 16, JH7110_SYSCLK_PLL2_OUT), - JH71X0_GATE(JH7110_SYSCLK_CODAJ12_AXI, "codaj12_axi", 0, JH7110_SYSCLK_JPEGC_AXI), - JH71X0_GDIV(JH7110_SYSCLK_CODAJ12_CORE, "codaj12_core", 0, 16, JH7110_SYSCLK_PLL2_OUT), - JH71X0_GATE(JH7110_SYSCLK_CODAJ12_APB, "codaj12_apb", 0, JH7110_SYSCLK_APB_BUS), + STARFIVE__DIV(JH7110_SYSCLK_JPEGC_AXI, "jpegc_axi", 16, JH7110_SYSCLK_PLL2_OUT), + STARFIVE_GATE(JH7110_SYSCLK_CODAJ12_AXI, "codaj12_axi", 0, JH7110_SYSCLK_JPEGC_AXI), + STARFIVE_GDIV(JH7110_SYSCLK_CODAJ12_CORE, "codaj12_core", 0, 16, JH7110_SYSCLK_PLL2_OUT), + STARFIVE_GATE(JH7110_SYSCLK_CODAJ12_APB, "codaj12_apb", 0, JH7110_SYSCLK_APB_BUS), /* vdec */ - JH71X0__DIV(JH7110_SYSCLK_VDEC_AXI, "vdec_axi", 7, JH7110_SYSCLK_BUS_ROOT), - JH71X0_GATE(JH7110_SYSCLK_WAVE511_AXI, "wave511_axi", 0, JH7110_SYSCLK_VDEC_AXI), - JH71X0_GDIV(JH7110_SYSCLK_WAVE511_BPU, "wave511_bpu", 0, 7, JH7110_SYSCLK_BUS_ROOT), - JH71X0_GDIV(JH7110_SYSCLK_WAVE511_VCE, "wave511_vce", 0, 7, JH7110_SYSCLK_PLL0_OUT), - JH71X0_GATE(JH7110_SYSCLK_WAVE511_APB, "wave511_apb", 0, JH7110_SYSCLK_APB_BUS), - JH71X0_GATE(JH7110_SYSCLK_VDEC_JPG, "vdec_jpg", 0, JH7110_SYSCLK_JPEGC_AXI), - JH71X0_GATE(JH7110_SYSCLK_VDEC_MAIN, "vdec_main", 0, JH7110_SYSCLK_VDEC_AXI), - JH71X0_GATE(JH7110_SYSCLK_NOC_BUS_VDEC_AXI, "noc_bus_vdec_axi", 0, JH7110_SYSCLK_VDEC_AXI), + STARFIVE__DIV(JH7110_SYSCLK_VDEC_AXI, "vdec_axi", 7, JH7110_SYSCLK_BUS_ROOT), + STARFIVE_GATE(JH7110_SYSCLK_WAVE511_AXI, "wave511_axi", 0, JH7110_SYSCLK_VDEC_AXI), + STARFIVE_GDIV(JH7110_SYSCLK_WAVE511_BPU, "wave511_bpu", 0, 7, JH7110_SYSCLK_BUS_ROOT), + STARFIVE_GDIV(JH7110_SYSCLK_WAVE511_VCE, "wave511_vce", 0, 7, JH7110_SYSCLK_PLL0_OUT), + STARFIVE_GATE(JH7110_SYSCLK_WAVE511_APB, "wave511_apb", 0, JH7110_SYSCLK_APB_BUS), + STARFIVE_GATE(JH7110_SYSCLK_VDEC_JPG, "vdec_jpg", 0, JH7110_SYSCLK_JPEGC_AXI), + STARFIVE_GATE(JH7110_SYSCLK_VDEC_MAIN, "vdec_main", 0, JH7110_SYSCLK_VDEC_AXI), + STARFIVE_GATE(JH7110_SYSCLK_NOC_BUS_VDEC_AXI, "noc_bus_vdec_axi", 0, + JH7110_SYSCLK_VDEC_AXI), /* venc */ - JH71X0__DIV(JH7110_SYSCLK_VENC_AXI, "venc_axi", 15, JH7110_SYSCLK_PLL2_OUT), - JH71X0_GATE(JH7110_SYSCLK_WAVE420L_AXI, "wave420l_axi", 0, JH7110_SYSCLK_VENC_AXI), - JH71X0_GDIV(JH7110_SYSCLK_WAVE420L_BPU, "wave420l_bpu", 0, 15, JH7110_SYSCLK_PLL2_OUT), - JH71X0_GDIV(JH7110_SYSCLK_WAVE420L_VCE, "wave420l_vce", 0, 15, JH7110_SYSCLK_PLL2_OUT), - JH71X0_GATE(JH7110_SYSCLK_WAVE420L_APB, "wave420l_apb", 0, JH7110_SYSCLK_APB_BUS), - JH71X0_GATE(JH7110_SYSCLK_NOC_BUS_VENC_AXI, "noc_bus_venc_axi", 0, JH7110_SYSCLK_VENC_AXI), + STARFIVE__DIV(JH7110_SYSCLK_VENC_AXI, "venc_axi", 15, JH7110_SYSCLK_PLL2_OUT), + STARFIVE_GATE(JH7110_SYSCLK_WAVE420L_AXI, "wave420l_axi", 0, JH7110_SYSCLK_VENC_AXI), + STARFIVE_GDIV(JH7110_SYSCLK_WAVE420L_BPU, "wave420l_bpu", 0, 15, JH7110_SYSCLK_PLL2_OUT), + STARFIVE_GDIV(JH7110_SYSCLK_WAVE420L_VCE, "wave420l_vce", 0, 15, JH7110_SYSCLK_PLL2_OUT), + STARFIVE_GATE(JH7110_SYSCLK_WAVE420L_APB, "wave420l_apb", 0, JH7110_SYSCLK_APB_BUS), + STARFIVE_GATE(JH7110_SYSCLK_NOC_BUS_VENC_AXI, "noc_bus_venc_axi", 0, + JH7110_SYSCLK_VENC_AXI), /* axi_cfg0 */ - JH71X0_GATE(JH7110_SYSCLK_AXI_CFG0_MAIN_DIV, "axi_cfg0_main_div", CLK_IS_CRITICAL, - JH7110_SYSCLK_AHB1), - JH71X0_GATE(JH7110_SYSCLK_AXI_CFG0_MAIN, "axi_cfg0_main", CLK_IS_CRITICAL, - JH7110_SYSCLK_AXI_CFG0), - JH71X0_GATE(JH7110_SYSCLK_AXI_CFG0_HIFI4, "axi_cfg0_hifi4", CLK_IS_CRITICAL, - JH7110_SYSCLK_HIFI4_AXI), + STARFIVE_GATE(JH7110_SYSCLK_AXI_CFG0_MAIN_DIV, "axi_cfg0_main_div", CLK_IS_CRITICAL, + JH7110_SYSCLK_AHB1), + STARFIVE_GATE(JH7110_SYSCLK_AXI_CFG0_MAIN, "axi_cfg0_main", CLK_IS_CRITICAL, + JH7110_SYSCLK_AXI_CFG0), + STARFIVE_GATE(JH7110_SYSCLK_AXI_CFG0_HIFI4, "axi_cfg0_hifi4", CLK_IS_CRITICAL, + JH7110_SYSCLK_HIFI4_AXI), /* intmem */ - JH71X0_GATE(JH7110_SYSCLK_AXIMEM2_AXI, "aximem2_axi", 0, JH7110_SYSCLK_AXI_CFG0), + STARFIVE_GATE(JH7110_SYSCLK_AXIMEM2_AXI, "aximem2_axi", 0, JH7110_SYSCLK_AXI_CFG0), /* qspi */ - JH71X0_GATE(JH7110_SYSCLK_QSPI_AHB, "qspi_ahb", 0, JH7110_SYSCLK_AHB1), - JH71X0_GATE(JH7110_SYSCLK_QSPI_APB, "qspi_apb", 0, JH7110_SYSCLK_APB_BUS), - JH71X0__DIV(JH7110_SYSCLK_QSPI_REF_SRC, "qspi_ref_src", 16, JH7110_SYSCLK_PLL0_OUT), - JH71X0_GMUX(JH7110_SYSCLK_QSPI_REF, "qspi_ref", 0, 2, - JH7110_SYSCLK_OSC, - JH7110_SYSCLK_QSPI_REF_SRC), + STARFIVE_GATE(JH7110_SYSCLK_QSPI_AHB, "qspi_ahb", 0, JH7110_SYSCLK_AHB1), + STARFIVE_GATE(JH7110_SYSCLK_QSPI_APB, "qspi_apb", 0, JH7110_SYSCLK_APB_BUS), + STARFIVE__DIV(JH7110_SYSCLK_QSPI_REF_SRC, "qspi_ref_src", 16, JH7110_SYSCLK_PLL0_OUT), + STARFIVE_GMUX(JH7110_SYSCLK_QSPI_REF, "qspi_ref", 0, 2, + JH7110_SYSCLK_OSC, + JH7110_SYSCLK_QSPI_REF_SRC), /* sdio */ - JH71X0_GATE(JH7110_SYSCLK_SDIO0_AHB, "sdio0_ahb", 0, JH7110_SYSCLK_AHB0), - JH71X0_GATE(JH7110_SYSCLK_SDIO1_AHB, "sdio1_ahb", 0, JH7110_SYSCLK_AHB0), - JH71X0_GDIV(JH7110_SYSCLK_SDIO0_SDCARD, "sdio0_sdcard", 0, 15, JH7110_SYSCLK_AXI_CFG0), - JH71X0_GDIV(JH7110_SYSCLK_SDIO1_SDCARD, "sdio1_sdcard", 0, 15, JH7110_SYSCLK_AXI_CFG0), + STARFIVE_GATE(JH7110_SYSCLK_SDIO0_AHB, "sdio0_ahb", 0, JH7110_SYSCLK_AHB0), + STARFIVE_GATE(JH7110_SYSCLK_SDIO1_AHB, "sdio1_ahb", 0, JH7110_SYSCLK_AHB0), + STARFIVE_GDIV(JH7110_SYSCLK_SDIO0_SDCARD, "sdio0_sdcard", 0, 15, JH7110_SYSCLK_AXI_CFG0), + STARFIVE_GDIV(JH7110_SYSCLK_SDIO1_SDCARD, "sdio1_sdcard", 0, 15, JH7110_SYSCLK_AXI_CFG0), /* stg */ - JH71X0__DIV(JH7110_SYSCLK_USB_125M, "usb_125m", 15, JH7110_SYSCLK_PLL0_OUT), - JH71X0_GATE(JH7110_SYSCLK_NOC_BUS_STG_AXI, "noc_bus_stg_axi", CLK_IS_CRITICAL, - JH7110_SYSCLK_NOCSTG_BUS), + STARFIVE__DIV(JH7110_SYSCLK_USB_125M, "usb_125m", 15, JH7110_SYSCLK_PLL0_OUT), + STARFIVE_GATE(JH7110_SYSCLK_NOC_BUS_STG_AXI, "noc_bus_stg_axi", CLK_IS_CRITICAL, + JH7110_SYSCLK_NOCSTG_BUS), /* gmac1 */ - JH71X0_GATE(JH7110_SYSCLK_GMAC1_AHB, "gmac1_ahb", 0, JH7110_SYSCLK_AHB0), - JH71X0_GATE(JH7110_SYSCLK_GMAC1_AXI, "gmac1_axi", 0, JH7110_SYSCLK_STG_AXIAHB), - JH71X0__DIV(JH7110_SYSCLK_GMAC_SRC, "gmac_src", 7, JH7110_SYSCLK_PLL0_OUT), - JH71X0__DIV(JH7110_SYSCLK_GMAC1_GTXCLK, "gmac1_gtxclk", 15, JH7110_SYSCLK_PLL0_OUT), - JH71X0__DIV(JH7110_SYSCLK_GMAC1_RMII_RTX, "gmac1_rmii_rtx", 30, - JH7110_SYSCLK_GMAC1_RMII_REFIN), - JH71X0_GDIV(JH7110_SYSCLK_GMAC1_PTP, "gmac1_ptp", 0, 31, JH7110_SYSCLK_GMAC_SRC), - JH71X0__MUX(JH7110_SYSCLK_GMAC1_RX, "gmac1_rx", 2, - JH7110_SYSCLK_GMAC1_RGMII_RXIN, - JH7110_SYSCLK_GMAC1_RMII_RTX), - JH71X0__INV(JH7110_SYSCLK_GMAC1_RX_INV, "gmac1_rx_inv", JH7110_SYSCLK_GMAC1_RX), - JH71X0_GMUX(JH7110_SYSCLK_GMAC1_TX, "gmac1_tx", - CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT, 2, - JH7110_SYSCLK_GMAC1_GTXCLK, - JH7110_SYSCLK_GMAC1_RMII_RTX), - JH71X0__INV(JH7110_SYSCLK_GMAC1_TX_INV, "gmac1_tx_inv", JH7110_SYSCLK_GMAC1_TX), - JH71X0_GATE(JH7110_SYSCLK_GMAC1_GTXC, "gmac1_gtxc", 0, JH7110_SYSCLK_GMAC1_GTXCLK), + STARFIVE_GATE(JH7110_SYSCLK_GMAC1_AHB, "gmac1_ahb", 0, JH7110_SYSCLK_AHB0), + STARFIVE_GATE(JH7110_SYSCLK_GMAC1_AXI, "gmac1_axi", 0, JH7110_SYSCLK_STG_AXIAHB), + STARFIVE__DIV(JH7110_SYSCLK_GMAC_SRC, "gmac_src", 7, JH7110_SYSCLK_PLL0_OUT), + STARFIVE__DIV(JH7110_SYSCLK_GMAC1_GTXCLK, "gmac1_gtxclk", 15, JH7110_SYSCLK_PLL0_OUT), + STARFIVE__DIV(JH7110_SYSCLK_GMAC1_RMII_RTX, "gmac1_rmii_rtx", 30, + JH7110_SYSCLK_GMAC1_RMII_REFIN), + STARFIVE_GDIV(JH7110_SYSCLK_GMAC1_PTP, "gmac1_ptp", 0, 31, JH7110_SYSCLK_GMAC_SRC), + STARFIVE__MUX(JH7110_SYSCLK_GMAC1_RX, "gmac1_rx", 2, + JH7110_SYSCLK_GMAC1_RGMII_RXIN, + JH7110_SYSCLK_GMAC1_RMII_RTX), + STARFIVE__INV(JH7110_SYSCLK_GMAC1_RX_INV, "gmac1_rx_inv", JH7110_SYSCLK_GMAC1_RX), + STARFIVE_GMUX(JH7110_SYSCLK_GMAC1_TX, "gmac1_tx", + CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT, 2, + JH7110_SYSCLK_GMAC1_GTXCLK, + JH7110_SYSCLK_GMAC1_RMII_RTX), + STARFIVE__INV(JH7110_SYSCLK_GMAC1_TX_INV, "gmac1_tx_inv", JH7110_SYSCLK_GMAC1_TX), + STARFIVE_GATE(JH7110_SYSCLK_GMAC1_GTXC, "gmac1_gtxc", 0, JH7110_SYSCLK_GMAC1_GTXCLK), /* gmac0 */ - JH71X0_GDIV(JH7110_SYSCLK_GMAC0_GTXCLK, "gmac0_gtxclk", 0, 15, JH7110_SYSCLK_PLL0_OUT), - JH71X0_GDIV(JH7110_SYSCLK_GMAC0_PTP, "gmac0_ptp", 0, 31, JH7110_SYSCLK_GMAC_SRC), - JH71X0_GDIV(JH7110_SYSCLK_GMAC_PHY, "gmac_phy", 0, 31, JH7110_SYSCLK_GMAC_SRC), - JH71X0_GATE(JH7110_SYSCLK_GMAC0_GTXC, "gmac0_gtxc", 0, JH7110_SYSCLK_GMAC0_GTXCLK), + STARFIVE_GDIV(JH7110_SYSCLK_GMAC0_GTXCLK, "gmac0_gtxclk", 0, 15, JH7110_SYSCLK_PLL0_OUT), + STARFIVE_GDIV(JH7110_SYSCLK_GMAC0_PTP, "gmac0_ptp", 0, 31, JH7110_SYSCLK_GMAC_SRC), + STARFIVE_GDIV(JH7110_SYSCLK_GMAC_PHY, "gmac_phy", 0, 31, JH7110_SYSCLK_GMAC_SRC), + STARFIVE_GATE(JH7110_SYSCLK_GMAC0_GTXC, "gmac0_gtxc", 0, JH7110_SYSCLK_GMAC0_GTXCLK), /* apb misc */ - JH71X0_GATE(JH7110_SYSCLK_IOMUX_APB, "iomux_apb", 0, JH7110_SYSCLK_APB_BUS), - JH71X0_GATE(JH7110_SYSCLK_MAILBOX_APB, "mailbox_apb", 0, JH7110_SYSCLK_APB_BUS), - JH71X0_GATE(JH7110_SYSCLK_INT_CTRL_APB, "int_ctrl_apb", 0, JH7110_SYSCLK_APB_BUS), + STARFIVE_GATE(JH7110_SYSCLK_IOMUX_APB, "iomux_apb", 0, JH7110_SYSCLK_APB_BUS), + STARFIVE_GATE(JH7110_SYSCLK_MAILBOX_APB, "mailbox_apb", 0, JH7110_SYSCLK_APB_BUS), + STARFIVE_GATE(JH7110_SYSCLK_INT_CTRL_APB, "int_ctrl_apb", 0, JH7110_SYSCLK_APB_BUS), /* can0 */ - JH71X0_GATE(JH7110_SYSCLK_CAN0_APB, "can0_apb", 0, JH7110_SYSCLK_APB_BUS), - JH71X0_GDIV(JH7110_SYSCLK_CAN0_TIMER, "can0_timer", 0, 24, JH7110_SYSCLK_OSC), - JH71X0_GDIV(JH7110_SYSCLK_CAN0_CAN, "can0_can", 0, 63, JH7110_SYSCLK_PERH_ROOT), + STARFIVE_GATE(JH7110_SYSCLK_CAN0_APB, "can0_apb", 0, JH7110_SYSCLK_APB_BUS), + STARFIVE_GDIV(JH7110_SYSCLK_CAN0_TIMER, "can0_timer", 0, 24, JH7110_SYSCLK_OSC), + STARFIVE_GDIV(JH7110_SYSCLK_CAN0_CAN, "can0_can", 0, 63, JH7110_SYSCLK_PERH_ROOT), /* can1 */ - JH71X0_GATE(JH7110_SYSCLK_CAN1_APB, "can1_apb", 0, JH7110_SYSCLK_APB_BUS), - JH71X0_GDIV(JH7110_SYSCLK_CAN1_TIMER, "can1_timer", 0, 24, JH7110_SYSCLK_OSC), - JH71X0_GDIV(JH7110_SYSCLK_CAN1_CAN, "can1_can", 0, 63, JH7110_SYSCLK_PERH_ROOT), + STARFIVE_GATE(JH7110_SYSCLK_CAN1_APB, "can1_apb", 0, JH7110_SYSCLK_APB_BUS), + STARFIVE_GDIV(JH7110_SYSCLK_CAN1_TIMER, "can1_timer", 0, 24, JH7110_SYSCLK_OSC), + STARFIVE_GDIV(JH7110_SYSCLK_CAN1_CAN, "can1_can", 0, 63, JH7110_SYSCLK_PERH_ROOT), /* pwm */ - JH71X0_GATE(JH7110_SYSCLK_PWM_APB, "pwm_apb", 0, JH7110_SYSCLK_APB_BUS), + STARFIVE_GATE(JH7110_SYSCLK_PWM_APB, "pwm_apb", 0, JH7110_SYSCLK_APB_BUS), /* wdt */ - JH71X0_GATE(JH7110_SYSCLK_WDT_APB, "wdt_apb", 0, JH7110_SYSCLK_APB_BUS), - JH71X0_GATE(JH7110_SYSCLK_WDT_CORE, "wdt_core", 0, JH7110_SYSCLK_OSC), + STARFIVE_GATE(JH7110_SYSCLK_WDT_APB, "wdt_apb", 0, JH7110_SYSCLK_APB_BUS), + STARFIVE_GATE(JH7110_SYSCLK_WDT_CORE, "wdt_core", 0, JH7110_SYSCLK_OSC), /* timer */ - JH71X0_GATE(JH7110_SYSCLK_TIMER_APB, "timer_apb", 0, JH7110_SYSCLK_APB_BUS), - JH71X0_GATE(JH7110_SYSCLK_TIMER0, "timer0", 0, JH7110_SYSCLK_OSC), - JH71X0_GATE(JH7110_SYSCLK_TIMER1, "timer1", 0, JH7110_SYSCLK_OSC), - JH71X0_GATE(JH7110_SYSCLK_TIMER2, "timer2", 0, JH7110_SYSCLK_OSC), - JH71X0_GATE(JH7110_SYSCLK_TIMER3, "timer3", 0, JH7110_SYSCLK_OSC), + STARFIVE_GATE(JH7110_SYSCLK_TIMER_APB, "timer_apb", 0, JH7110_SYSCLK_APB_BUS), + STARFIVE_GATE(JH7110_SYSCLK_TIMER0, "timer0", 0, JH7110_SYSCLK_OSC), + STARFIVE_GATE(JH7110_SYSCLK_TIMER1, "timer1", 0, JH7110_SYSCLK_OSC), + STARFIVE_GATE(JH7110_SYSCLK_TIMER2, "timer2", 0, JH7110_SYSCLK_OSC), + STARFIVE_GATE(JH7110_SYSCLK_TIMER3, "timer3", 0, JH7110_SYSCLK_OSC), /* temp sensor */ - JH71X0_GATE(JH7110_SYSCLK_TEMP_APB, "temp_apb", 0, JH7110_SYSCLK_APB_BUS), - JH71X0_GDIV(JH7110_SYSCLK_TEMP_CORE, "temp_core", 0, 24, JH7110_SYSCLK_OSC), + STARFIVE_GATE(JH7110_SYSCLK_TEMP_APB, "temp_apb", 0, JH7110_SYSCLK_APB_BUS), + STARFIVE_GDIV(JH7110_SYSCLK_TEMP_CORE, "temp_core", 0, 24, JH7110_SYSCLK_OSC), /* spi */ - JH71X0_GATE(JH7110_SYSCLK_SPI0_APB, "spi0_apb", 0, JH7110_SYSCLK_APB0), - JH71X0_GATE(JH7110_SYSCLK_SPI1_APB, "spi1_apb", 0, JH7110_SYSCLK_APB0), - JH71X0_GATE(JH7110_SYSCLK_SPI2_APB, "spi2_apb", 0, JH7110_SYSCLK_APB0), - JH71X0_GATE(JH7110_SYSCLK_SPI3_APB, "spi3_apb", 0, JH7110_SYSCLK_APB_BUS), - JH71X0_GATE(JH7110_SYSCLK_SPI4_APB, "spi4_apb", 0, JH7110_SYSCLK_APB_BUS), - JH71X0_GATE(JH7110_SYSCLK_SPI5_APB, "spi5_apb", 0, JH7110_SYSCLK_APB_BUS), - JH71X0_GATE(JH7110_SYSCLK_SPI6_APB, "spi6_apb", 0, JH7110_SYSCLK_APB_BUS), + STARFIVE_GATE(JH7110_SYSCLK_SPI0_APB, "spi0_apb", 0, JH7110_SYSCLK_APB0), + STARFIVE_GATE(JH7110_SYSCLK_SPI1_APB, "spi1_apb", 0, JH7110_SYSCLK_APB0), + STARFIVE_GATE(JH7110_SYSCLK_SPI2_APB, "spi2_apb", 0, JH7110_SYSCLK_APB0), + STARFIVE_GATE(JH7110_SYSCLK_SPI3_APB, "spi3_apb", 0, JH7110_SYSCLK_APB_BUS), + STARFIVE_GATE(JH7110_SYSCLK_SPI4_APB, "spi4_apb", 0, JH7110_SYSCLK_APB_BUS), + STARFIVE_GATE(JH7110_SYSCLK_SPI5_APB, "spi5_apb", 0, JH7110_SYSCLK_APB_BUS), + STARFIVE_GATE(JH7110_SYSCLK_SPI6_APB, "spi6_apb", 0, JH7110_SYSCLK_APB_BUS), /* i2c */ - JH71X0_GATE(JH7110_SYSCLK_I2C0_APB, "i2c0_apb", 0, JH7110_SYSCLK_APB0), - JH71X0_GATE(JH7110_SYSCLK_I2C1_APB, "i2c1_apb", 0, JH7110_SYSCLK_APB0), - JH71X0_GATE(JH7110_SYSCLK_I2C2_APB, "i2c2_apb", 0, JH7110_SYSCLK_APB0), - JH71X0_GATE(JH7110_SYSCLK_I2C3_APB, "i2c3_apb", 0, JH7110_SYSCLK_APB_BUS), - JH71X0_GATE(JH7110_SYSCLK_I2C4_APB, "i2c4_apb", 0, JH7110_SYSCLK_APB_BUS), - JH71X0_GATE(JH7110_SYSCLK_I2C5_APB, "i2c5_apb", 0, JH7110_SYSCLK_APB_BUS), - JH71X0_GATE(JH7110_SYSCLK_I2C6_APB, "i2c6_apb", 0, JH7110_SYSCLK_APB_BUS), + STARFIVE_GATE(JH7110_SYSCLK_I2C0_APB, "i2c0_apb", 0, JH7110_SYSCLK_APB0), + STARFIVE_GATE(JH7110_SYSCLK_I2C1_APB, "i2c1_apb", 0, JH7110_SYSCLK_APB0), + STARFIVE_GATE(JH7110_SYSCLK_I2C2_APB, "i2c2_apb", 0, JH7110_SYSCLK_APB0), + STARFIVE_GATE(JH7110_SYSCLK_I2C3_APB, "i2c3_apb", 0, JH7110_SYSCLK_APB_BUS), + STARFIVE_GATE(JH7110_SYSCLK_I2C4_APB, "i2c4_apb", 0, JH7110_SYSCLK_APB_BUS), + STARFIVE_GATE(JH7110_SYSCLK_I2C5_APB, "i2c5_apb", 0, JH7110_SYSCLK_APB_BUS), + STARFIVE_GATE(JH7110_SYSCLK_I2C6_APB, "i2c6_apb", 0, JH7110_SYSCLK_APB_BUS), /* uart */ - JH71X0_GATE(JH7110_SYSCLK_UART0_APB, "uart0_apb", 0, JH7110_SYSCLK_APB0), - JH71X0_GATE(JH7110_SYSCLK_UART0_CORE, "uart0_core", 0, JH7110_SYSCLK_OSC), - JH71X0_GATE(JH7110_SYSCLK_UART1_APB, "uart1_apb", 0, JH7110_SYSCLK_APB0), - JH71X0_GATE(JH7110_SYSCLK_UART1_CORE, "uart1_core", 0, JH7110_SYSCLK_OSC), - JH71X0_GATE(JH7110_SYSCLK_UART2_APB, "uart2_apb", 0, JH7110_SYSCLK_APB0), - JH71X0_GATE(JH7110_SYSCLK_UART2_CORE, "uart2_core", 0, JH7110_SYSCLK_OSC), - JH71X0_GATE(JH7110_SYSCLK_UART3_APB, "uart3_apb", 0, JH7110_SYSCLK_APB0), - JH71X0_GDIV(JH7110_SYSCLK_UART3_CORE, "uart3_core", 0, 10, JH7110_SYSCLK_PERH_ROOT), - JH71X0_GATE(JH7110_SYSCLK_UART4_APB, "uart4_apb", 0, JH7110_SYSCLK_APB0), - JH71X0_GDIV(JH7110_SYSCLK_UART4_CORE, "uart4_core", 0, 10, JH7110_SYSCLK_PERH_ROOT), - JH71X0_GATE(JH7110_SYSCLK_UART5_APB, "uart5_apb", 0, JH7110_SYSCLK_APB0), - JH71X0_GDIV(JH7110_SYSCLK_UART5_CORE, "uart5_core", 0, 10, JH7110_SYSCLK_PERH_ROOT), + STARFIVE_GATE(JH7110_SYSCLK_UART0_APB, "uart0_apb", 0, JH7110_SYSCLK_APB0), + STARFIVE_GATE(JH7110_SYSCLK_UART0_CORE, "uart0_core", 0, JH7110_SYSCLK_OSC), + STARFIVE_GATE(JH7110_SYSCLK_UART1_APB, "uart1_apb", 0, JH7110_SYSCLK_APB0), + STARFIVE_GATE(JH7110_SYSCLK_UART1_CORE, "uart1_core", 0, JH7110_SYSCLK_OSC), + STARFIVE_GATE(JH7110_SYSCLK_UART2_APB, "uart2_apb", 0, JH7110_SYSCLK_APB0), + STARFIVE_GATE(JH7110_SYSCLK_UART2_CORE, "uart2_core", 0, JH7110_SYSCLK_OSC), + STARFIVE_GATE(JH7110_SYSCLK_UART3_APB, "uart3_apb", 0, JH7110_SYSCLK_APB0), + STARFIVE_GDIV(JH7110_SYSCLK_UART3_CORE, "uart3_core", 0, 10, JH7110_SYSCLK_PERH_ROOT), + STARFIVE_GATE(JH7110_SYSCLK_UART4_APB, "uart4_apb", 0, JH7110_SYSCLK_APB0), + STARFIVE_GDIV(JH7110_SYSCLK_UART4_CORE, "uart4_core", 0, 10, JH7110_SYSCLK_PERH_ROOT), + STARFIVE_GATE(JH7110_SYSCLK_UART5_APB, "uart5_apb", 0, JH7110_SYSCLK_APB0), + STARFIVE_GDIV(JH7110_SYSCLK_UART5_CORE, "uart5_core", 0, 10, JH7110_SYSCLK_PERH_ROOT), /* pwmdac */ - JH71X0_GATE(JH7110_SYSCLK_PWMDAC_APB, "pwmdac_apb", 0, JH7110_SYSCLK_APB0), - JH71X0_GDIV(JH7110_SYSCLK_PWMDAC_CORE, "pwmdac_core", 0, 256, JH7110_SYSCLK_AUDIO_ROOT), + STARFIVE_GATE(JH7110_SYSCLK_PWMDAC_APB, "pwmdac_apb", 0, JH7110_SYSCLK_APB0), + STARFIVE_GDIV(JH7110_SYSCLK_PWMDAC_CORE, "pwmdac_core", 0, 256, JH7110_SYSCLK_AUDIO_ROOT), /* spdif */ - JH71X0_GATE(JH7110_SYSCLK_SPDIF_APB, "spdif_apb", 0, JH7110_SYSCLK_APB0), - JH71X0_GATE(JH7110_SYSCLK_SPDIF_CORE, "spdif_core", 0, JH7110_SYSCLK_MCLK), + STARFIVE_GATE(JH7110_SYSCLK_SPDIF_APB, "spdif_apb", 0, JH7110_SYSCLK_APB0), + STARFIVE_GATE(JH7110_SYSCLK_SPDIF_CORE, "spdif_core", 0, JH7110_SYSCLK_MCLK), /* i2stx0 */ - JH71X0_GATE(JH7110_SYSCLK_I2STX0_APB, "i2stx0_apb", 0, JH7110_SYSCLK_APB0), - JH71X0_GDIV(JH7110_SYSCLK_I2STX0_BCLK_MST, "i2stx0_bclk_mst", 0, 32, JH7110_SYSCLK_MCLK), - JH71X0__INV(JH7110_SYSCLK_I2STX0_BCLK_MST_INV, "i2stx0_bclk_mst_inv", - JH7110_SYSCLK_I2STX0_BCLK_MST), - JH71X0_MDIV(JH7110_SYSCLK_I2STX0_LRCK_MST, "i2stx0_lrck_mst", 64, 2, - JH7110_SYSCLK_I2STX0_BCLK_MST_INV, - JH7110_SYSCLK_I2STX0_BCLK_MST), - JH71X0__MUX(JH7110_SYSCLK_I2STX0_BCLK, "i2stx0_bclk", 2, - JH7110_SYSCLK_I2STX0_BCLK_MST, - JH7110_SYSCLK_I2STX_BCLK_EXT), - JH71X0__INV(JH7110_SYSCLK_I2STX0_BCLK_INV, "i2stx0_bclk_inv", JH7110_SYSCLK_I2STX0_BCLK), - JH71X0__MUX(JH7110_SYSCLK_I2STX0_LRCK, "i2stx0_lrck", 2, - JH7110_SYSCLK_I2STX0_LRCK_MST, - JH7110_SYSCLK_I2STX_LRCK_EXT), + STARFIVE_GATE(JH7110_SYSCLK_I2STX0_APB, "i2stx0_apb", 0, JH7110_SYSCLK_APB0), + STARFIVE_GDIV(JH7110_SYSCLK_I2STX0_BCLK_MST, "i2stx0_bclk_mst", 0, 32, JH7110_SYSCLK_MCLK), + STARFIVE__INV(JH7110_SYSCLK_I2STX0_BCLK_MST_INV, "i2stx0_bclk_mst_inv", + JH7110_SYSCLK_I2STX0_BCLK_MST), + STARFIVE_MDIV(JH7110_SYSCLK_I2STX0_LRCK_MST, "i2stx0_lrck_mst", 64, 2, + JH7110_SYSCLK_I2STX0_BCLK_MST_INV, + JH7110_SYSCLK_I2STX0_BCLK_MST), + STARFIVE__MUX(JH7110_SYSCLK_I2STX0_BCLK, "i2stx0_bclk", 2, + JH7110_SYSCLK_I2STX0_BCLK_MST, + JH7110_SYSCLK_I2STX_BCLK_EXT), + STARFIVE__INV(JH7110_SYSCLK_I2STX0_BCLK_INV, "i2stx0_bclk_inv", JH7110_SYSCLK_I2STX0_BCLK), + STARFIVE__MUX(JH7110_SYSCLK_I2STX0_LRCK, "i2stx0_lrck", 2, + JH7110_SYSCLK_I2STX0_LRCK_MST, + JH7110_SYSCLK_I2STX_LRCK_EXT), /* i2stx1 */ - JH71X0_GATE(JH7110_SYSCLK_I2STX1_APB, "i2stx1_apb", 0, JH7110_SYSCLK_APB0), - JH71X0_GDIV(JH7110_SYSCLK_I2STX1_BCLK_MST, "i2stx1_bclk_mst", 0, 32, JH7110_SYSCLK_MCLK), - JH71X0__INV(JH7110_SYSCLK_I2STX1_BCLK_MST_INV, "i2stx1_bclk_mst_inv", - JH7110_SYSCLK_I2STX1_BCLK_MST), - JH71X0_MDIV(JH7110_SYSCLK_I2STX1_LRCK_MST, "i2stx1_lrck_mst", 64, 2, - JH7110_SYSCLK_I2STX1_BCLK_MST_INV, - JH7110_SYSCLK_I2STX1_BCLK_MST), - JH71X0__MUX(JH7110_SYSCLK_I2STX1_BCLK, "i2stx1_bclk", 2, - JH7110_SYSCLK_I2STX1_BCLK_MST, - JH7110_SYSCLK_I2STX_BCLK_EXT), - JH71X0__INV(JH7110_SYSCLK_I2STX1_BCLK_INV, "i2stx1_bclk_inv", JH7110_SYSCLK_I2STX1_BCLK), - JH71X0__MUX(JH7110_SYSCLK_I2STX1_LRCK, "i2stx1_lrck", 2, - JH7110_SYSCLK_I2STX1_LRCK_MST, - JH7110_SYSCLK_I2STX_LRCK_EXT), + STARFIVE_GATE(JH7110_SYSCLK_I2STX1_APB, "i2stx1_apb", 0, JH7110_SYSCLK_APB0), + STARFIVE_GDIV(JH7110_SYSCLK_I2STX1_BCLK_MST, "i2stx1_bclk_mst", 0, 32, JH7110_SYSCLK_MCLK), + STARFIVE__INV(JH7110_SYSCLK_I2STX1_BCLK_MST_INV, "i2stx1_bclk_mst_inv", + JH7110_SYSCLK_I2STX1_BCLK_MST), + STARFIVE_MDIV(JH7110_SYSCLK_I2STX1_LRCK_MST, "i2stx1_lrck_mst", 64, 2, + JH7110_SYSCLK_I2STX1_BCLK_MST_INV, + JH7110_SYSCLK_I2STX1_BCLK_MST), + STARFIVE__MUX(JH7110_SYSCLK_I2STX1_BCLK, "i2stx1_bclk", 2, + JH7110_SYSCLK_I2STX1_BCLK_MST, + JH7110_SYSCLK_I2STX_BCLK_EXT), + STARFIVE__INV(JH7110_SYSCLK_I2STX1_BCLK_INV, "i2stx1_bclk_inv", JH7110_SYSCLK_I2STX1_BCLK), + STARFIVE__MUX(JH7110_SYSCLK_I2STX1_LRCK, "i2stx1_lrck", 2, + JH7110_SYSCLK_I2STX1_LRCK_MST, + JH7110_SYSCLK_I2STX_LRCK_EXT), /* i2srx */ - JH71X0_GATE(JH7110_SYSCLK_I2SRX_APB, "i2srx_apb", 0, JH7110_SYSCLK_APB0), - JH71X0_GDIV(JH7110_SYSCLK_I2SRX_BCLK_MST, "i2srx_bclk_mst", 0, 32, JH7110_SYSCLK_MCLK), - JH71X0__INV(JH7110_SYSCLK_I2SRX_BCLK_MST_INV, "i2srx_bclk_mst_inv", - JH7110_SYSCLK_I2SRX_BCLK_MST), - JH71X0_MDIV(JH7110_SYSCLK_I2SRX_LRCK_MST, "i2srx_lrck_mst", 64, 2, - JH7110_SYSCLK_I2SRX_BCLK_MST_INV, - JH7110_SYSCLK_I2SRX_BCLK_MST), - JH71X0__MUX(JH7110_SYSCLK_I2SRX_BCLK, "i2srx_bclk", 2, - JH7110_SYSCLK_I2SRX_BCLK_MST, - JH7110_SYSCLK_I2SRX_BCLK_EXT), - JH71X0__INV(JH7110_SYSCLK_I2SRX_BCLK_INV, "i2srx_bclk_inv", JH7110_SYSCLK_I2SRX_BCLK), - JH71X0__MUX(JH7110_SYSCLK_I2SRX_LRCK, "i2srx_lrck", 2, - JH7110_SYSCLK_I2SRX_LRCK_MST, - JH7110_SYSCLK_I2SRX_LRCK_EXT), + STARFIVE_GATE(JH7110_SYSCLK_I2SRX_APB, "i2srx_apb", 0, JH7110_SYSCLK_APB0), + STARFIVE_GDIV(JH7110_SYSCLK_I2SRX_BCLK_MST, "i2srx_bclk_mst", 0, 32, JH7110_SYSCLK_MCLK), + STARFIVE__INV(JH7110_SYSCLK_I2SRX_BCLK_MST_INV, "i2srx_bclk_mst_inv", + JH7110_SYSCLK_I2SRX_BCLK_MST), + STARFIVE_MDIV(JH7110_SYSCLK_I2SRX_LRCK_MST, "i2srx_lrck_mst", 64, 2, + JH7110_SYSCLK_I2SRX_BCLK_MST_INV, + JH7110_SYSCLK_I2SRX_BCLK_MST), + STARFIVE__MUX(JH7110_SYSCLK_I2SRX_BCLK, "i2srx_bclk", 2, + JH7110_SYSCLK_I2SRX_BCLK_MST, + JH7110_SYSCLK_I2SRX_BCLK_EXT), + STARFIVE__INV(JH7110_SYSCLK_I2SRX_BCLK_INV, "i2srx_bclk_inv", JH7110_SYSCLK_I2SRX_BCLK), + STARFIVE__MUX(JH7110_SYSCLK_I2SRX_LRCK, "i2srx_lrck", 2, + JH7110_SYSCLK_I2SRX_LRCK_MST, + JH7110_SYSCLK_I2SRX_LRCK_EXT), /* pdm */ - JH71X0_GDIV(JH7110_SYSCLK_PDM_DMIC, "pdm_dmic", 0, 64, JH7110_SYSCLK_MCLK), - JH71X0_GATE(JH7110_SYSCLK_PDM_APB, "pdm_apb", 0, JH7110_SYSCLK_APB0), + STARFIVE_GDIV(JH7110_SYSCLK_PDM_DMIC, "pdm_dmic", 0, 64, JH7110_SYSCLK_MCLK), + STARFIVE_GATE(JH7110_SYSCLK_PDM_APB, "pdm_apb", 0, JH7110_SYSCLK_APB0), /* tdm */ - JH71X0_GATE(JH7110_SYSCLK_TDM_AHB, "tdm_ahb", 0, JH7110_SYSCLK_AHB0), - JH71X0_GATE(JH7110_SYSCLK_TDM_APB, "tdm_apb", 0, JH7110_SYSCLK_APB0), - JH71X0_GDIV(JH7110_SYSCLK_TDM_INTERNAL, "tdm_internal", 0, 64, JH7110_SYSCLK_MCLK), - JH71X0__MUX(JH7110_SYSCLK_TDM_TDM, "tdm_tdm", 2, - JH7110_SYSCLK_TDM_INTERNAL, - JH7110_SYSCLK_TDM_EXT), - JH71X0__INV(JH7110_SYSCLK_TDM_TDM_INV, "tdm_tdm_inv", JH7110_SYSCLK_TDM_TDM), + STARFIVE_GATE(JH7110_SYSCLK_TDM_AHB, "tdm_ahb", 0, JH7110_SYSCLK_AHB0), + STARFIVE_GATE(JH7110_SYSCLK_TDM_APB, "tdm_apb", 0, JH7110_SYSCLK_APB0), + STARFIVE_GDIV(JH7110_SYSCLK_TDM_INTERNAL, "tdm_internal", 0, 64, JH7110_SYSCLK_MCLK), + STARFIVE__MUX(JH7110_SYSCLK_TDM_TDM, "tdm_tdm", 2, + JH7110_SYSCLK_TDM_INTERNAL, + JH7110_SYSCLK_TDM_EXT), + STARFIVE__INV(JH7110_SYSCLK_TDM_TDM_INV, "tdm_tdm_inv", JH7110_SYSCLK_TDM_TDM), /* jtag */ - JH71X0__DIV(JH7110_SYSCLK_JTAG_CERTIFICATION_TRNG, "jtag_certification_trng", 4, - JH7110_SYSCLK_OSC), + STARFIVE__DIV(JH7110_SYSCLK_JTAG_CERTIFICATION_TRNG, "jtag_certification_trng", 4, + JH7110_SYSCLK_OSC), }; static struct clk_hw *jh7110_sysclk_get(struct of_phandle_args *clkspec, void *data) { - struct jh71x0_clk_priv *priv = data; + struct starfive_clk_priv *priv = data; unsigned int idx = clkspec->args[0]; if (idx < JH7110_SYSCLK_END) @@ -350,7 +353,7 @@ static void jh7110_reset_adev_release(struct device *dev) kfree(rdev); } -int jh7110_reset_controller_register(struct jh71x0_clk_priv *priv, +int jh7110_reset_controller_register(struct starfive_clk_priv *priv, const char *adev_name, u32 adev_id) { @@ -387,7 +390,7 @@ EXPORT_SYMBOL_GPL(jh7110_reset_controller_register); static int __init jh7110_syscrg_probe(struct platform_device *pdev) { - struct jh71x0_clk_priv *priv; + struct starfive_clk_priv *priv; unsigned int idx; int ret; struct clk *pllclk; @@ -446,13 +449,13 @@ static int __init jh7110_syscrg_probe(struct platform_device *pdev) struct clk_parent_data parents[4] = {}; struct clk_init_data init = { .name = jh7110_sysclk_data[idx].name, - .ops = starfive_jh71x0_clk_ops(max), + .ops = starfive_clk_ops(max), .parent_data = parents, .num_parents = - ((max & JH71X0_CLK_MUX_MASK) >> JH71X0_CLK_MUX_SHIFT) + 1, + ((max & STARFIVE_CLK_MUX_MASK) >> STARFIVE_CLK_MUX_SHIFT) + 1, .flags = jh7110_sysclk_data[idx].flags, }; - struct jh71x0_clk *clk = &priv->reg[idx]; + struct starfive_clk *clk = &priv->reg[idx]; unsigned int i; for (i = 0; i < init.num_parents; i++) { @@ -490,7 +493,7 @@ static int __init jh7110_syscrg_probe(struct platform_device *pdev) clk->hw.init = &init; clk->idx = idx; - clk->max_div = max & JH71X0_CLK_DIV_MASK; + clk->max_div = max & STARFIVE_CLK_DIV_MASK; ret = devm_clk_hw_register(&pdev->dev, &clk->hw); if (ret) diff --git a/drivers/clk/starfive/clk-starfive-jh7110-vout.c b/drivers/clk/starfive/clk-starfive-jh7110-vout.c index 10cc1ec43925..aca93c370bce 100644 --- a/drivers/clk/starfive/clk-starfive-jh7110-vout.c +++ b/drivers/clk/starfive/clk-starfive-jh7110-vout.c @@ -30,45 +30,45 @@ static struct clk_bulk_data jh7110_vout_top_clks[] = { { .id = "vout_top_ahb" } }; -static const struct jh71x0_clk_data jh7110_voutclk_data[] = { +static const struct starfive_clk_data jh7110_voutclk_data[] = { /* divider */ - JH71X0__DIV(JH7110_VOUTCLK_APB, "apb", 8, JH7110_VOUTCLK_VOUT_TOP_AHB), - JH71X0__DIV(JH7110_VOUTCLK_DC8200_PIX, "dc8200_pix", 63, JH7110_VOUTCLK_VOUT_SRC), - JH71X0__DIV(JH7110_VOUTCLK_DSI_SYS, "dsi_sys", 31, JH7110_VOUTCLK_VOUT_SRC), - JH71X0__DIV(JH7110_VOUTCLK_TX_ESC, "tx_esc", 31, JH7110_VOUTCLK_VOUT_TOP_AHB), + STARFIVE__DIV(JH7110_VOUTCLK_APB, "apb", 8, JH7110_VOUTCLK_VOUT_TOP_AHB), + STARFIVE__DIV(JH7110_VOUTCLK_DC8200_PIX, "dc8200_pix", 63, JH7110_VOUTCLK_VOUT_SRC), + STARFIVE__DIV(JH7110_VOUTCLK_DSI_SYS, "dsi_sys", 31, JH7110_VOUTCLK_VOUT_SRC), + STARFIVE__DIV(JH7110_VOUTCLK_TX_ESC, "tx_esc", 31, JH7110_VOUTCLK_VOUT_TOP_AHB), /* dc8200 */ - JH71X0_GATE(JH7110_VOUTCLK_DC8200_AXI, "dc8200_axi", 0, JH7110_VOUTCLK_VOUT_TOP_AXI), - JH71X0_GATE(JH7110_VOUTCLK_DC8200_CORE, "dc8200_core", 0, JH7110_VOUTCLK_VOUT_TOP_AXI), - JH71X0_GATE(JH7110_VOUTCLK_DC8200_AHB, "dc8200_ahb", 0, JH7110_VOUTCLK_VOUT_TOP_AHB), - JH71X0_GMUX(JH7110_VOUTCLK_DC8200_PIX0, "dc8200_pix0", 0, 2, - JH7110_VOUTCLK_DC8200_PIX, - JH7110_VOUTCLK_HDMITX0_PIXELCLK), - JH71X0_GMUX(JH7110_VOUTCLK_DC8200_PIX1, "dc8200_pix1", 0, 2, - JH7110_VOUTCLK_DC8200_PIX, - JH7110_VOUTCLK_HDMITX0_PIXELCLK), + STARFIVE_GATE(JH7110_VOUTCLK_DC8200_AXI, "dc8200_axi", 0, JH7110_VOUTCLK_VOUT_TOP_AXI), + STARFIVE_GATE(JH7110_VOUTCLK_DC8200_CORE, "dc8200_core", 0, JH7110_VOUTCLK_VOUT_TOP_AXI), + STARFIVE_GATE(JH7110_VOUTCLK_DC8200_AHB, "dc8200_ahb", 0, JH7110_VOUTCLK_VOUT_TOP_AHB), + STARFIVE_GMUX(JH7110_VOUTCLK_DC8200_PIX0, "dc8200_pix0", 0, 2, + JH7110_VOUTCLK_DC8200_PIX, + JH7110_VOUTCLK_HDMITX0_PIXELCLK), + STARFIVE_GMUX(JH7110_VOUTCLK_DC8200_PIX1, "dc8200_pix1", 0, 2, + JH7110_VOUTCLK_DC8200_PIX, + JH7110_VOUTCLK_HDMITX0_PIXELCLK), /* LCD */ - JH71X0_GMUX(JH7110_VOUTCLK_DOM_VOUT_TOP_LCD, "dom_vout_top_lcd", 0, 2, - JH7110_VOUTCLK_DC8200_PIX0, - JH7110_VOUTCLK_DC8200_PIX1), + STARFIVE_GMUX(JH7110_VOUTCLK_DOM_VOUT_TOP_LCD, "dom_vout_top_lcd", 0, 2, + JH7110_VOUTCLK_DC8200_PIX0, + JH7110_VOUTCLK_DC8200_PIX1), /* dsiTx */ - JH71X0_GATE(JH7110_VOUTCLK_DSITX_APB, "dsiTx_apb", 0, JH7110_VOUTCLK_DSI_SYS), - JH71X0_GATE(JH7110_VOUTCLK_DSITX_SYS, "dsiTx_sys", 0, JH7110_VOUTCLK_DSI_SYS), - JH71X0_GMUX(JH7110_VOUTCLK_DSITX_DPI, "dsiTx_dpi", 0, 2, - JH7110_VOUTCLK_DC8200_PIX, - JH7110_VOUTCLK_HDMITX0_PIXELCLK), - JH71X0_GATE(JH7110_VOUTCLK_DSITX_TXESC, "dsiTx_txesc", 0, JH7110_VOUTCLK_TX_ESC), + STARFIVE_GATE(JH7110_VOUTCLK_DSITX_APB, "dsiTx_apb", 0, JH7110_VOUTCLK_DSI_SYS), + STARFIVE_GATE(JH7110_VOUTCLK_DSITX_SYS, "dsiTx_sys", 0, JH7110_VOUTCLK_DSI_SYS), + STARFIVE_GMUX(JH7110_VOUTCLK_DSITX_DPI, "dsiTx_dpi", 0, 2, + JH7110_VOUTCLK_DC8200_PIX, + JH7110_VOUTCLK_HDMITX0_PIXELCLK), + STARFIVE_GATE(JH7110_VOUTCLK_DSITX_TXESC, "dsiTx_txesc", 0, JH7110_VOUTCLK_TX_ESC), /* mipitx DPHY */ - JH71X0_GATE(JH7110_VOUTCLK_MIPITX_DPHY_TXESC, "mipitx_dphy_txesc", 0, - JH7110_VOUTCLK_TX_ESC), + STARFIVE_GATE(JH7110_VOUTCLK_MIPITX_DPHY_TXESC, "mipitx_dphy_txesc", 0, + JH7110_VOUTCLK_TX_ESC), /* hdmi */ - JH71X0_GATE(JH7110_VOUTCLK_HDMI_TX_MCLK, "hdmi_tx_mclk", 0, - JH7110_VOUTCLK_VOUT_TOP_HDMITX0_MCLK), - JH71X0_GATE(JH7110_VOUTCLK_HDMI_TX_BCLK, "hdmi_tx_bclk", 0, - JH7110_VOUTCLK_I2STX0_BCLK), - JH71X0_GATE(JH7110_VOUTCLK_HDMI_TX_SYS, "hdmi_tx_sys", 0, JH7110_VOUTCLK_APB), + STARFIVE_GATE(JH7110_VOUTCLK_HDMI_TX_MCLK, "hdmi_tx_mclk", 0, + JH7110_VOUTCLK_VOUT_TOP_HDMITX0_MCLK), + STARFIVE_GATE(JH7110_VOUTCLK_HDMI_TX_BCLK, "hdmi_tx_bclk", 0, + JH7110_VOUTCLK_I2STX0_BCLK), + STARFIVE_GATE(JH7110_VOUTCLK_HDMI_TX_SYS, "hdmi_tx_sys", 0, JH7110_VOUTCLK_APB), }; -static int jh7110_vout_top_rst_init(struct jh71x0_clk_priv *priv) +static int jh7110_vout_top_rst_init(struct starfive_clk_priv *priv) { struct reset_control *top_rst; @@ -82,7 +82,7 @@ static int jh7110_vout_top_rst_init(struct jh71x0_clk_priv *priv) static struct clk_hw *jh7110_voutclk_get(struct of_phandle_args *clkspec, void *data) { - struct jh71x0_clk_priv *priv = data; + struct starfive_clk_priv *priv = data; unsigned int idx = clkspec->args[0]; if (idx < JH7110_VOUTCLK_END) @@ -115,7 +115,7 @@ static const struct dev_pm_ops jh7110_voutcrg_pm_ops = { static int jh7110_voutcrg_probe(struct platform_device *pdev) { - struct jh71x0_clk_priv *priv; + struct starfive_clk_priv *priv; struct jh7110_top_sysclk *top; unsigned int idx; int ret; @@ -158,13 +158,13 @@ static int jh7110_voutcrg_probe(struct platform_device *pdev) struct clk_parent_data parents[4] = {}; struct clk_init_data init = { .name = jh7110_voutclk_data[idx].name, - .ops = starfive_jh71x0_clk_ops(max), + .ops = starfive_clk_ops(max), .parent_data = parents, .num_parents = - ((max & JH71X0_CLK_MUX_MASK) >> JH71X0_CLK_MUX_SHIFT) + 1, + ((max & STARFIVE_CLK_MUX_MASK) >> STARFIVE_CLK_MUX_SHIFT) + 1, .flags = jh7110_voutclk_data[idx].flags, }; - struct jh71x0_clk *clk = &priv->reg[idx]; + struct starfive_clk *clk = &priv->reg[idx]; unsigned int i; const char *fw_name[JH7110_VOUTCLK_EXT_END - JH7110_VOUTCLK_END] = { "vout_src", @@ -186,7 +186,7 @@ static int jh7110_voutcrg_probe(struct platform_device *pdev) clk->hw.init = &init; clk->idx = idx; - clk->max_div = max & JH71X0_CLK_DIV_MASK; + clk->max_div = max & STARFIVE_CLK_DIV_MASK; ret = devm_clk_hw_register(&pdev->dev, &clk->hw); if (ret) diff --git a/drivers/clk/starfive/clk-starfive-jh7110.h b/drivers/clk/starfive/clk-starfive-jh7110.h index 6b1bdf860f00..4a6dfd8d8636 100644 --- a/drivers/clk/starfive/clk-starfive-jh7110.h +++ b/drivers/clk/starfive/clk-starfive-jh7110.h @@ -10,7 +10,7 @@ struct jh7110_top_sysclk { int top_clks_num; }; -int jh7110_reset_controller_register(struct jh71x0_clk_priv *priv, +int jh7110_reset_controller_register(struct starfive_clk_priv *priv, const char *adev_name, u32 adev_id); From patchwork Wed Jan 10 13:31:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sia Jee Heng X-Patchwork-Id: 13516157 X-Patchwork-Delegate: mail@conchuod.ie 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 D2BC1C4707C for ; Wed, 10 Jan 2024 13:32:30 +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=x/pCvlRCbS4yTNDUhUya5fn0v9qJVGmmhtM1nBOx7sQ=; b=fIFJED3Onc/dVL vMg2/YEfht7/Ye5OKwOJOFvs4TOhP5Whf5IGV7YzeQcCJH1lBZs5d3zN9SgU2+7TphfVVTVR+gjzZ 2L0bnAdd3XJP7Yg8KLVeOb4+VzURmpS4NQgf7E/48s1WAfXxHP1pSLrn/Vx+KoJGt6ToQdcGtGoMh I8mtJpuCK9ftPVEQx9rM3IAkcWJxnlk1TwoTKNBRG22MbEIDFA7Rgi74sLVGEHE+9VhpGMSNnWE00 98iemJL9H1zPzngk+P/r/cZo/vZQieqs2OfNXGHsbSYYyQcmIPz76Z0xuTmHMjgs/xb2rlaFTovHU cdAg0uesOHUWiHDDkoyg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rNYgw-00Bz5k-1R; Wed, 10 Jan 2024 13:32:22 +0000 Received: from mail-sh0chn02on20625.outbound.protection.partner.outlook.cn ([2406:e500:4420:2::625] helo=CHN02-SH0-obe.outbound.protection.partner.outlook.cn) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rNYgp-00Bywc-2A for linux-riscv@lists.infradead.org; Wed, 10 Jan 2024 13:32:19 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iY3XDaWRJdERTcp42u7fsNpqfG0ZTkW8o1mPHUbqBih3S3/ZfoMfmpqdpAO+rXKMrGuFis6VC6QiaVLOFL3Kcb9oTXPYdDU42NcKSFAgzbWjyLr4DeLngrx3yovzkj3/Si/N2cVwB7kQ/59aLLxvceG6jGYpCFOaGtq5xB2KcPG3X7N62SM6ILLea/NnDbjgcp2gtKnBBldeNGVaq0Xs+M0VrTukyBXADDs/jKjA7xFFkPcmaOmG2jzimNfY+n7Z1jJ6EWjpkTrs3lpBwudwbFg47GPftHmmpoMJAmQUh+uhX1wnKJxdx860koi6pCEWn60U2ybCuXRUZpI5WI9ogg== 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=7WyGV8ahj0x/vxVMNnEUAKwcahD0k1AJxANJSALOwRo=; b=ccLHqEKWeG3s0Lfd7kz+TDplISiJ6paDjGfdoc6CSS2umU57KZ5eddxaAQFvRnjrJdh1zJq6p9ZfiJogjFIVzPxxN7IfJJzqrkeXY7SNjqjRus+Z1Im2hPxKBHWD9gilQPKZUI4D2BDkiaemBdifrZYKczqkxm1BZLd04e2WtFd6cU4jzV/0zL0lUbPtzW+Dj/cfYbaZ2z2FJF22YvPtmOEr1WXkMGAswEEWsjyz3RotaByo3fGlUdM4QO4Ge2DLLvS7jAdoPmTZ81TfmTElbSEbTMmAflJqKQGo7Ii+ZFhTWhzCQFg5GmF4dRUDE+8lAjjYgRR+0desZM3XUsZCcg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=starfivetech.com; dmarc=pass action=none header.from=starfivetech.com; dkim=pass header.d=starfivetech.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=starfivetech.com; Received: from BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:f::16) by BJSPR01MB0865.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:e::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.33; Wed, 10 Jan 2024 13:32:01 +0000 Received: from BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn ([fe80::3862:65b4:c857:c4a6]) by BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn ([fe80::3862:65b4:c857:c4a6%4]) with mapi id 15.20.7135.033; Wed, 10 Jan 2024 13:32:01 +0000 From: Sia Jee Heng To: kernel@esmil.dk, conor@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, mturquette@baylibre.com, sboyd@kernel.org, p.zabel@pengutronix.de, emil.renner.berthing@canonical.com, hal.feng@starfivetech.com, xingyu.wu@starfivetech.com Cc: linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, jeeheng.sia@starfivetech.com, leyfoon.tan@starfivetech.com, Krzysztof Kozlowski Subject: [RFC v3 05/16] dt-bindings: clock: Add StarFive JH8100 System clock and reset generator Date: Wed, 10 Jan 2024 21:31:17 +0800 Message-Id: <20240110133128.286657-6-jeeheng.sia@starfivetech.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240110133128.286657-1-jeeheng.sia@starfivetech.com> References: <20240110133128.286657-1-jeeheng.sia@starfivetech.com> X-ClientProxiedBy: BJXPR01CA0067.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:12::34) To BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:f::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BJSPR01MB0561:EE_|BJSPR01MB0865:EE_ X-MS-Office365-Filtering-Correlation-Id: 7f887381-ff0c-41c8-48c7-08dc11e0869b X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kW3Wp0rXG7mcRD4aNovlwIlgVDvEF82yuwHgvIVS5xYEoA9nHd+nQ5zLfcW0kS1gA+NjzrzicuCA/iYBBfGeRQcDBrg62h0YRxwmf0bl1YLBQpUMccUtM/2E6nVTjnwqIxLxf+BGMJZZtQyj7dE1Qy5Vv8IZLWx2kXt8mH62kK/bYqfJAmpdus2IqYPw6FfzazFutN3yLAREOa+rQVKo7fVnszRKggc2fMDr8VT1NbnTPwinTZz4oz/gQCfEgLMGTvQVR3JMU4VJQpSLV2vkTI9WLWEvYihChDvi9DftQQE+H+B2E+noplhSDs7sJvVO/hTULfFsFu7zfTLpvfX8vQGIz61UG0i2MIu1uiz7ypCWt8XDPGM8IDuGVXlGZL9tDczQ51ZoqI6vpq8kn5pTdAy7/tbG1TuMA31yPzNXT9QmxxTKu36qtJu9RuXKCFXiyXgT4UbcS1/1LmOMW9xtebkuiO36UvFKZe7q3p0X9tKUKkNlfO20Rpf21gLU/FxoB1AW2RsbZS9aw6kGA+YxVbZt9bIML/S0NPR9yELzJfljkb5noQNjERR3BJKSnHQ4kk1qnbfyZS5uDCEGGYT6/8fPHjBsy76wzzvpsu76n4m8e9/34zUkZvbuofxOM6MJ X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn;PTR:;CAT:NONE;SFS:(13230031)(136003)(396003)(39830400003)(346002)(366004)(230922051799003)(230273577357003)(230173577357003)(451199024)(186009)(1800799012)(64100799003)(41320700001)(6666004)(966005)(508600001)(55236004)(52116002)(2616005)(1076003)(26005)(38100700002)(40160700002)(38350700005)(921011)(86362001)(40180700001)(36756003)(41300700001)(4326008)(7416002)(83380400001)(5660300002)(2906002)(8936002)(8676002)(66946007)(66556008)(66476007)(6636002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Ez/ZZ1SWLXdAy8AVhbvGTGj53IMyG0+QC+zGajRn/bdS/THMv0SRKOqwmTS8f3FoqaQoHbLOf5pbP6RZLt8+7DpG8A7k5lMPGQChyS0+ymB9DoFHfSfsNzKCpGA8SDI+9B7szL4vLzi2+Be3t3zKE0gLKsarC/5ER/oo0UKg3zPtCP+WfkV7xzpCFTmpDv10SJagjR8Pm7AexPJ/llOAlLPHMqfjXUpfKJZUg7nvuby4fKKt8NpyvHieHzHjK7C0b4nIQrrjX9JDzJ1A0L/it7jQty8d2TOtejRtL7TK3t4Ul2CFIHsWV5mS5wfT6ReTDE05dz4Aaixj+XiUvg/IMOQ8eEygdXHSFXDDszb/+4gdUNxXkrZNa7PfN9PBJl3+w8CNd1feqGAHGoyXZc+zuJA2OxTMR9kpyyXesUuQnkQE3JFeIzThMCWrpo5PPeMG9wvURB3u0ImFOdTrpRdMEt3Z6doDTENV4Usd07p37nlE1DI9ktOecazjBSP8CygwagRHG7Hfvm1Uen+tiH4eKLULHIHQPowfN5cQVrN64FY0iCK+0NscNJTjKQVXjWuFE3KTRekX+EnaehC4HVR+aDzvaMPlDiShoVNVJVIlbloQYL2HEUXvkcYL9zJAk3vC4air3USEejN3MZmbHYIbO17ZXw4WMAom4pwo9g8f5zfaa/mHo23kooNb7yUDJ1wuNYXBd0XkbxTRtRyPMKxoO7u/K28qBK0NFJNtnXStPdTNQk+89GjAOQ7nJaCsG1JbAvNFSU2Fvm2EiNGvoWHIps3ODHJ4y/LSo8skUwk2jF9Cei8df9QOOJql+b+UvfdmMFRqUNAiBa4zmlWzdgUDVpMczXpR73LGPxuEpOB2V/AUF/XBLTu8S0iUUMT7FgootmqoN6lHr5f8JG2NBsAto8hQRYIiQJvwgXVDqsxEoeobSck8z8BNp5/Zqq4102f2PYOwuxiecOBEgkCwapU9C1um2aWrtQ5xcjcPoslK1waz3H2CwL6SqhvV54yPI3fyv2il9244GlRWw9jk5Fl68b+G+9WPC9q8aXA6E3PyPWkThKSOY+b7M02I+KrgOyrvlkqmjvzKqTUVPWxElDF1RzHZNLqH0GFg0Mv7je8gxrV6gJGEkAgPoWReVohmc8F79xTTw5a22LnjwxOVghZOGWi5vV8IlPmCmteDNbEpL+lHKKMcDPPNoQ9a8mQhbhnheSWZzGV7/Z1W3k4qW7T1TdNhJNd5jpXTQm7hpqPGTS7e3vCbaeUI6RyHyfB+gbGtXIwdnY/8otCnnhu1btN2/IwWZPCUzS4LMjN24ueVlSL7pMCJCW9LeI5y3V15DQb5PPVLXiERWuTD/oRiPQVS+OenJGm8bTHUfJdEgirqUZI5meX7iZC3yLRAzhq+T+JBAzvLyH0qQ+g9ObzbEnblkBJgGpCS6NxibDwfwgYIIPlAWKNb0CIAOXi/gKdKshBK+r9bchHOObxuZuwf4ytGM0ctXah8tcQKKEN4gRe0sawjpTMT5h4Te0CclN7dBOMT3s0JQ/Gk5rfJ8SqGTJpmcp/f3gHJbZL0+AQgqrTpXknZrFNXDHfhAUfssQ3JJd3Yvnt1m8VcSeOc+lcLdrwKVW+KhQj2zayT6lLBeCJys/4= X-OriginatorOrg: starfivetech.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7f887381-ff0c-41c8-48c7-08dc11e0869b X-MS-Exchange-CrossTenant-AuthSource: BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jan 2024 13:32:01.0263 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 06fe3fa3-1221-43d3-861b-5a4ee687a85c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 4d3bYqtAwicgm5HHd8DnFLPOKduY18WpFUvQgVw5xz0zSoVbKa2CCP95zJ66uYgz4rvkbELAeS98ksOB+wTBBKGNmpuTQhvt2QBZXUww0Yo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BJSPR01MB0865 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240110_053215_887852_DC0BBF2C X-CRM114-Status: GOOD ( 11.99 ) X-BeenThere: linux-riscv@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-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Add bindings for the System clocks and reset generator (SYSCRG) on JH8100 SoC. Signed-off-by: Sia Jee Heng Reviewed-by: Ley Foon Tan Reviewed-by: Krzysztof Kozlowski --- .../clock/starfive,jh8100-syscrg.yaml | 77 +++++++++++ .../dt-bindings/clock/starfive,jh8100-crg.h | 122 ++++++++++++++++++ .../dt-bindings/reset/starfive,jh8100-crg.h | 21 +++ 3 files changed, 220 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/starfive,jh8100-syscrg.yaml create mode 100644 include/dt-bindings/clock/starfive,jh8100-crg.h create mode 100644 include/dt-bindings/reset/starfive,jh8100-crg.h diff --git a/Documentation/devicetree/bindings/clock/starfive,jh8100-syscrg.yaml b/Documentation/devicetree/bindings/clock/starfive,jh8100-syscrg.yaml new file mode 100644 index 000000000000..853b13ce5562 --- /dev/null +++ b/Documentation/devicetree/bindings/clock/starfive,jh8100-syscrg.yaml @@ -0,0 +1,77 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/clock/starfive,jh8100-syscrg.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: StarFive JH8100 System Clock and Reset Generator + +maintainers: + - Sia Jee Heng + +properties: + compatible: + const: starfive,jh8100-syscrg + + reg: + maxItems: 1 + + clocks: + items: + - description: Main Oscillator (24 MHz) + - description: External MCLK clock + - description: PLL0 + - description: PLL1 + - description: PLL2 + - description: PLL3 + - description: PLL4 + - description: PLL6 + - description: PLL7 + + clock-names: + items: + - const: osc + - const: mclk-ext + - const: pll0 + - const: pll1 + - const: pll2 + - const: pll3 + - const: pll4 + - const: pll6 + - const: pll7 + + '#clock-cells': + const: 1 + description: + See for valid indices. + + '#reset-cells': + const: 1 + description: + See for valid indices. + +required: + - compatible + - reg + - clocks + - clock-names + - '#clock-cells' + - '#reset-cells' + +additionalProperties: false + +examples: + - | + #include + + clock-controller@126d0000 { + compatible = "starfive,jh8100-syscrg"; + reg = <0x126d0000 0x10000>; + clocks = <&osc>, <&mclk_ext>, <&pll0>, <&pll1>, + <&pll2>, <&pll3>, <&pll4>, <&pll6>, <&pll7>; + clock-names = "osc", "mclk-ext", "pll0", "pll1", + "pll2", "pll3", "pll4", + "pll6", "pll7"; + #clock-cells = <1>; + #reset-cells = <1>; + }; diff --git a/include/dt-bindings/clock/starfive,jh8100-crg.h b/include/dt-bindings/clock/starfive,jh8100-crg.h new file mode 100644 index 000000000000..611613961e17 --- /dev/null +++ b/include/dt-bindings/clock/starfive,jh8100-crg.h @@ -0,0 +1,122 @@ +/* SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause */ +/* + * Copyright (C) 2023 StarFive Technology Co., Ltd. + * Sia Jee Heng + * + */ + +#ifndef __DT_BINDINGS_CLOCK_STARFIVE_JH8100_H__ +#define __DT_BINDINGS_CLOCK_STARFIVE_JH8100_H__ + +/* SYSCRG clocks */ +#define JH8100_SYSCLK_VDEC_ROOT_PREOSC 0 +#define JH8100_SYSCLK_VDEC_ROOT 1 +#define JH8100_SYSCLK_VENC_ROOT_PREOSC 2 +#define JH8100_SYSCLK_VENC_ROOT 3 +#define JH8100_SYSCLK_GPU_ROOT 4 +#define JH8100_SYSCLK_GPU_CORE 5 +#define JH8100_SYSCLK_VOUT_ROOT0_PREOSC 6 +#define JH8100_SYSCLK_VOUT_ROOT0 7 +#define JH8100_SYSCLK_VOUT_ROOT1_PREOSC 8 +#define JH8100_SYSCLK_VOUT_ROOT1 9 +#define JH8100_SYSCLK_VOUT_SCAN_ATS 10 +#define JH8100_SYSCLK_PERH_ROOT_PREOSC 11 +#define JH8100_SYSCLK_PERH_ROOT 12 +#define JH8100_SYSCLK_AXI_200_PREOSC 13 +#define JH8100_SYSCLK_AXI_200 14 +#define JH8100_SYSCLK_AXI_200_GMAC 15 +#define JH8100_SYSCLK_AXI_500_PREOSC 16 +#define JH8100_SYSCLK_AXI_500 17 +#define JH8100_SYSCLK_AXI_500_PCIEX1A 18 +#define JH8100_SYSCLK_AXI_500_PCIEX1B 19 +#define JH8100_SYSCLK_AXI_500_PCIEX2 20 +#define JH8100_SYSCLK_AXI_500_PCIEX8 21 +#define JH8100_SYSCLK_AXI_400_PREOSC 22 +#define JH8100_SYSCLK_AXI_400 23 +#define JH8100_SYSCLK_AXI_400_APBOOTRAM 24 +#define JH8100_SYSCLK_AXI_125_PREOSC 25 +#define JH8100_SYSCLK_AXI_125 26 +#define JH8100_SYSCLK_AHB0_PREOSC 27 +#define JH8100_SYSCLK_AHB0 28 +#define JH8100_SYSCLK_APB_BUS_FUNC 29 +#define JH8100_SYSCLK_APB_BUS 30 +#define JH8100_SYSCLK_APB_BUS_PER0 31 +#define JH8100_SYSCLK_APB_BUS_PER1 32 +#define JH8100_SYSCLK_APB_BUS_PER2 33 +#define JH8100_SYSCLK_APB_BUS_PER3 34 +#define JH8100_SYSCLK_APB_BUS_PER4 35 +#define JH8100_SYSCLK_APB_BUS_PER5 36 +#define JH8100_SYSCLK_APB_BUS_PER6 37 +#define JH8100_SYSCLK_APB_BUS_PER7 38 +#define JH8100_SYSCLK_APB_BUS_PER8 39 +#define JH8100_SYSCLK_APB_BUS_PER9 40 +#define JH8100_SYSCLK_APB_BUS_PER10 41 +#define JH8100_SYSCLK_SPI_CORE_100 42 +#define JH8100_SYSCLK_PLL1_DIV2 43 +#define JH8100_SYSCLK_PLL2_DIV2 44 +#define JH8100_SYSCLK_PLL3_DIV2 45 +#define JH8100_SYSCLK_PLL4_DIV2 46 +#define JH8100_SYSCLK_PLL6_DIV2 47 +#define JH8100_SYSCLK_PLL7_DIV2 48 +#define JH8100_SYSCLK_AUDIO_ROOT 49 +#define JH8100_SYSCLK_MCLK_INNER 50 +#define JH8100_SYSCLK_MCLK 51 +#define JH8100_SYSCLK_MCLK_OUT 52 +#define JH8100_SYSCLK_ISP_2X_PREOSC 53 +#define JH8100_SYSCLK_ISP_2X 54 +#define JH8100_SYSCLK_ISP_AXI 55 +#define JH8100_SYSCLK_GCLK1 56 +#define JH8100_SYSCLK_GCLK2 57 +#define JH8100_SYSCLK_GCLK3 58 +#define JH8100_SYSCLK_GCLK4 59 +#define JH8100_SYSCLK_GCLK6 60 +#define JH8100_SYSCLK_GCLK7 61 +#define JH8100_SYSCLK_FLEXNOC0_PREOSC 62 +#define JH8100_SYSCLK_FLEXNOC0 63 +#define JH8100_SYSCLK_FLEXNOC1_PREOSC 64 +#define JH8100_SYSCLK_FLEXNOC1 65 +#define JH8100_SYSCLK_FLEXNOC2_PREOSC 66 +#define JH8100_SYSCLK_FLEXNOC2 67 +#define JH8100_SYSCLK_VDEC_CORE 68 +#define JH8100_SYSCLK_GPU_CORE_ICG 69 +#define JH8100_SYSCLK_IMG_GPU_CLK_APB 70 +#define JH8100_SYSCLK_IMG_GPU_RTC_TOGGLE 71 +#define JH8100_SYSCLK_IMG_GPU_TIMER_USC 72 +#define JH8100_SYSCLK_HIFI4_CORE_PREOSC 73 +#define JH8100_SYSCLK_HIFI4_CORE 74 +#define JH8100_SYSCLK_E_200_PREOSC 75 +#define JH8100_SYSCLK_E_200 76 +#define JH8100_SYSCLK_HD_AUDIO_48M 77 +#define JH8100_SYSCLK_VOUT_DC_CORE 78 +#define JH8100_SYSCLK_VOUT_AXI 79 +#define JH8100_SYSCLK_USB_WRAP_625 80 +#define JH8100_SYSCLK_USB_WRAP_480 81 +#define JH8100_SYSCLK_USB_WRAP_240 82 +#define JH8100_SYSCLK_USB_WRAP_60 83 +#define JH8100_SYSCLK_USB_WRAP_156P25 84 +#define JH8100_SYSCLK_USB_WRAP_312P5 85 +#define JH8100_SYSCLK_USB_125M 86 +#define JH8100_SYSCLK_FLEXNOC_APBOOTRAM 87 +#define JH8100_SYSCLK_FLEXNOC_PCIEX1AMST 88 +#define JH8100_SYSCLK_FLEXNOC_PCIEX1ASLV 89 +#define JH8100_SYSCLK_FLEXNOC_PCIEX1BMST 90 +#define JH8100_SYSCLK_FLEXNOC_PCIEX1BSLV 91 +#define JH8100_SYSCLK_FLEXNOC_PCIEX2MST 92 +#define JH8100_SYSCLK_FLEXNOC_PCIEX2SLV 93 +#define JH8100_SYSCLK_FLEXNOC_PCIEX8MST 94 +#define JH8100_SYSCLK_FLEXNOC_PCIEX8SLV 95 +#define JH8100_SYSCLK_FLEXNOC_GMACSYSSLV 96 +#define JH8100_SYSCLK_GMAC_SRC 97 +#define JH8100_SYSCLK_GMAC1_GTXCLK_TOP 98 +#define JH8100_SYSCLK_GMAC1_PTP 99 +#define JH8100_SYSCLK_HD_AUDIO_SYSTEM_CLOCK 100 +#define JH8100_SYSCLK_HD_AUDIO_CLOCK_48 101 +#define JH8100_SYSCLK_HD_AUDIO_BCLK_POST_OCC_IN 102 +#define JH8100_SYSCLK_NNE_VIP_ACLK 103 +#define JH8100_SYSCLK_NNE_VIP_HCLK 104 +#define JH8100_SYSCLK_NNE_VIP_CLKCORE 105 +#define JH8100_SYSCLK_GPU_ICG_EN 106 +#define JH8100_SYSCLK_HD_AUDIO_ICG_EN 107 +#define JH8100_SYSCLK_NNE_ICG_EN 108 + +#endif /* __DT_BINDINGS_CLOCK_STARFIVE_JH8100_H__ */ diff --git a/include/dt-bindings/reset/starfive,jh8100-crg.h b/include/dt-bindings/reset/starfive,jh8100-crg.h new file mode 100644 index 000000000000..c4e2501491ab --- /dev/null +++ b/include/dt-bindings/reset/starfive,jh8100-crg.h @@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause */ +/* + * Copyright (c) 2022-2023 StarFive Technology Co., Ltd. + */ + +#ifndef __DT_BINDINGS_RESET_STARFIVE_JH8100_H__ +#define __DT_BINDINGS_RESET_STARFIVE_JH8100_H__ + +/* + * SYSCRG resets: assert0 + */ +#define JH8100_SYSRST_SYS_SYSCON 0 +#define JH8100_SYSRST_CLK_MOD 1 +#define JH8100_SYSRST_GPU 2 +#define JH8100_SYSRST_GPU_SPU 3 +#define JH8100_SYSRST_GPU_TVSENSOR 4 +#define JH8100_SYSRST_PPU_OP_NORET_GPU_RESET 5 +#define JH8100_SYSRST_NNE 6 +#define JH8100_SYSRST_HD_AUDIO 7 + +#endif /* __DT_BINDINGS_RESET_STARFIVE_JH8100_H__ */ From patchwork Wed Jan 10 13:31:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sia Jee Heng X-Patchwork-Id: 13516158 X-Patchwork-Delegate: mail@conchuod.ie 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 D1715C4725D for ; Wed, 10 Jan 2024 13:32:32 +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=KKGCTM57/nUTiuRZF10mPN4brI7RmT4QDfcXxMjBap0=; b=hGG3lOeDyqpg09 3mWuz5bgm4lLA6wd7YYFV765nds41vm01ofGrfVXdnF+8Huks7unTu4JXLHMkbptbyZjT6YSz/V7X 0syi4Npaj+FZ9kDONQKihgL9cBDq0mSqRAkOw88btRHyio2wFqkayHt2QQpXbxP0BilCI3LM2/Rqw EzPs60Kp2V6xsUmon2YmRKS4ceFBe0dvI07pPB+E48bZMvn4fB7bgVkATBFgT8FTzKOlKu+QsWBBK BtsKPV3Nrhq226ayPK0+dt3bgZSTQi1Yo1vT4vplWmECmKO9SvKcIKf4LLu4nl+0i6qNli758Elm+ ToYuJ+spdxajpKm+FTBw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rNYgy-00Bz7N-37; Wed, 10 Jan 2024 13:32:24 +0000 Received: from mail-sh0chn02on20621.outbound.protection.partner.outlook.cn ([2406:e500:4420:2::621] helo=CHN02-SH0-obe.outbound.protection.partner.outlook.cn) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rNYgt-00Byri-0I for linux-riscv@lists.infradead.org; Wed, 10 Jan 2024 13:32:22 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=V0ujGktmQkPSY2I3+KGW1mQXt7jXk7UqdLiVavZV19Q1W9jVBJANrloxvrGLUR/ek6UcKKxzOre6mqOE89rIOh/KIDXF3oU63PiL2ej1elkWaEUqRXkWAGTRHuc3lscfO5k/r4AvujaYxQXgd5RBn1vCbKMVYyQp1CcVuCV9mdvwl52VxyVABiwP4g1eBNNhz6RNK0yjTsZ8EfAx5+ZjR9kmQ9qfolkagoSU92AEh8Pda4hUMSvu1U+ujLmFb+BOa2a2MjUNSkvjAW4Zac7p3fWvYpHkcXEHZTOlf5QuXiJ3k/cC+R/kCA63zAzvibt3UWQchF9ewFfMqO50cnafyA== 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=qkT1U6B4T9lveexxN2Xk/76AuS1PVR99s+TkNOSUKZU=; b=WhVQ63DkOjU4IRXGToEaYearLjD3YEYAAYmP6ss9g1/hC4/eeseEhcekIdPUpQXw3Vkw913tQJy27Vpw2j3eXcY0oe+xSnbcvg/kOPUKU6dvWXgcYc10ic3lGQzRxYCuT9V0lRvdE4gmkViHuB2cyVwbXnw/hAxDhdqYv48kiwSYBZBWiRaOAe5cKDEzY6RKwohag2PZqaM5XyLUFoRW+eGGzkacjGHFljldr8U9W6Jm2bfQMyDyg6g22fgd+fbwsapmPmny/eBl6uYQTYdGGlUxLAoNzhKpbr3CeGVw6KmP1wGy3xp7xAPp6KViFwprODAnijyoCI8x3WKw2P9weg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=starfivetech.com; dmarc=pass action=none header.from=starfivetech.com; dkim=pass header.d=starfivetech.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=starfivetech.com; Received: from BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:f::16) by BJSPR01MB0865.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:e::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.33; Wed, 10 Jan 2024 13:32:04 +0000 Received: from BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn ([fe80::3862:65b4:c857:c4a6]) by BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn ([fe80::3862:65b4:c857:c4a6%4]) with mapi id 15.20.7135.033; Wed, 10 Jan 2024 13:32:04 +0000 From: Sia Jee Heng To: kernel@esmil.dk, conor@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, mturquette@baylibre.com, sboyd@kernel.org, p.zabel@pengutronix.de, emil.renner.berthing@canonical.com, hal.feng@starfivetech.com, xingyu.wu@starfivetech.com Cc: linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, jeeheng.sia@starfivetech.com, leyfoon.tan@starfivetech.com Subject: [RFC v3 06/16] clk: starfive: Add JH8100 System clock generator driver Date: Wed, 10 Jan 2024 21:31:18 +0800 Message-Id: <20240110133128.286657-7-jeeheng.sia@starfivetech.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240110133128.286657-1-jeeheng.sia@starfivetech.com> References: <20240110133128.286657-1-jeeheng.sia@starfivetech.com> X-ClientProxiedBy: BJXPR01CA0067.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:12::34) To BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:f::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BJSPR01MB0561:EE_|BJSPR01MB0865:EE_ X-MS-Office365-Filtering-Correlation-Id: a6f3f8de-0cc8-418d-c1e5-08dc11e088c6 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TnoP+X+5vf/r5+7Eb6FktG/NpjN2N1wXp3CDlCSqDT1U7hIqgemt/BMLadjiGSwm5ph1C6+5G0gUWh2Up3Qbxt1ymwz7uTExnn9aNhBbSeKZTXQBeLmLd8MiaGRmyTH5Riebw52cNIIovlDgDa4htXacT49myac67S7iSv/v8bxE86YIG9JOnDhmkqNBqLim9RnwZgcK9psF93KYDHeU0EadepH3F90ViXNxUIpy/MeR8wrWRRZJFNX8mW6htdutrQgdQEeUCPWukKfkq6GTGGijB+U8HoG2O7aVHBOwl77R12r8sJr1FD9jHARNRg8U6HgN/NTxWdBErpThriY6+Uk0dnfTYTigbnbnLAVwXKW60Mwxezy2CaJYge1iyyKFeJa8xuAmbEp5BtZNvTRcpnNtCC175+7edVd1KuZt0mQKhf1uuuEJF6LrLkG3cmmKa8pgqoWieAdlpnJwRGBf0nBByc5Cvp1V/whHE1l+c241/vJcfoPfFgYQuLnCBQWFW0up+fywrDJB79JICIQ5ltKBAAcKXF0NaVyVRkUOwRIhJ40LDCu6fgS2d9c+KzfPexmuuuxSPtoj+mZwEHAfbOIiDsn7VOYwSZ9MitiEqNUCOQ9bSUuh9sGc1PovozeU X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn;PTR:;CAT:NONE;SFS:(13230031)(366004)(346002)(39830400003)(396003)(136003)(230273577357003)(230173577357003)(230922051799003)(64100799003)(1800799012)(186009)(451199024)(6666004)(2616005)(1076003)(107886003)(26005)(508600001)(52116002)(55236004)(83380400001)(5660300002)(30864003)(2906002)(41300700001)(7416002)(4326008)(66946007)(8676002)(8936002)(6636002)(66476007)(66556008)(921011)(40160700002)(38100700002)(38350700005)(36756003)(40180700001)(86362001)(41320700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: tQ53TS5ZquLPbU0vIBigF6ZVz1j6PyU4Pm54ZsW+sqR/c98rBdDomwqg7j+jCatYolmptZG7sRN2MQgkclesfCmXqVxJW7ZpuPFlYJLAeIHQLI+XBx7La0Bmql5sB1eo0/3r3hfo9YPvHJiiiWQ8ltIEsCPWITZWvJxEIBHY00pGsA8JPPJ0hoPbrZJMYNPKKE9RxqmZqfigKjhARr2entZvmvfGmxBdZitav96vAMI4JXSEwxuWbnI5PCh2ElF/Q36dTlYjIIBHDp8Gp67AAJJ2SxW8VGiUzBjSaO5P6x/J2E0QgjykIUI/rMUaIsH4t/D1SwZik6Fgbw5kyCBkEpB4wCi2N0v/X4t2mPOzU79Y57cN0nlaSDZlXfjh+Msg9Xo0+5amc2KXTBUe5q8DFADG7/Y42hWxoMPnr9AzOl+hdn4xvb3qqGt87gSOtG7u4DaSGjyNQwwCPwOJLI2JRVbmciLza0tRLRdhx6Qh8JlBBKimDYTCvGgSLNiBaDKWQSRjoCUG/VeT43emPWSgKfNhGy+nzAitLZZsdHzsX9ykHmoCaC+KOINMYAue2Ny6VbcuaDcsvfZxzx83VoGM9WFN/2po0SBvJKxfM6OqeV9KLuZMwKJ/cpw9JI5pRLsIwXgMGK7mZgD/NvPeaxsuxdoqJ7sSdeEzVCt+NTOz2Vco/JivC2jcmctLjZrTcLNocJEQAkq96j3cfiVZ1KcBszrqyMyw9gvsulvombquMowVxRAJP0fOfGFcL1DnG/TZ5RgLDx+zoF6d/s+iehgCn9H+410y6or3wG+V6YCSZoEGxiykf/D2OZQ2EeXdM8u0WAPwcnayFXYsmIy3XuNuobRnkxGMau4+2OpswF7TJV0fcrYJe7PL0RvDlXY4XoT++0V+G1ewLpMp297CqXvdWpw6WZRz2LmY6K2bZfDQ8Hgn1mhLAK1vkEmDFXcKs2Smxhwc1+ObEfXw4sJo3SRVG4AzabixwMmHZcb8QWmESLRUSbRUlhTXfcZLXgl92P0Ddmf8/TAopCkhQ+bqfICelrwVSBuqSw+AGiscT3v/M9VpviIGa8Q6eGSM45XupOamEN9z2iLG/blcvmkeh/sZDKQlVWoIuTSgxbALP247eXhBdyuIzCgbdArRVg5VJ3JPq0cI2yKG+wMX+IyXTcapjPV5p/Dv25ZrermYVrRg99DtnuQZyqJKQHPNLUlIwlfS3LT/YQvrluUJUAyJEhUbgqxQVe6zvGlzOv08MQzU5MjLlTPDRCR2Ew9d3bnfbgwhNiPvi9lrFqaaUjckFf8tN7XKRFZOIonU2XSrQhZLKQ0UDrJ1EBbTPxrgr1SIcjzLAf1v93hx1uDnpHm9ZH4iM4B9KRKLYdmKwIm/9ZXFtZwrzBfG1LC6Strn38wFbdp+cENUKoUjRB//4bxiJQXVTxaqu5T7KEBAi7Ht6JW8PnlOmcvexqUFXQZYan47lv/MrPS1pA5wjBhPAz6IblgtRIRZt1T1Oo44w5Du9Arh4UiwQl6tsQa7JKO0oxINurPja7IgqYZzGmrmRIAdixdimTdkC7jQlIaR7zqGYs/7RC+dbjc17dnzy+oNoWmkHOMwYeVnN3rsiD69pVjXSSQiopHDn7zb/OYYOLs3JWOiilU= X-OriginatorOrg: starfivetech.com X-MS-Exchange-CrossTenant-Network-Message-Id: a6f3f8de-0cc8-418d-c1e5-08dc11e088c6 X-MS-Exchange-CrossTenant-AuthSource: BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jan 2024 13:32:04.6648 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 06fe3fa3-1221-43d3-861b-5a4ee687a85c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 6NH0D6baMINybR3wz5S//k18G6qZ0L+xcq4qdwwli7/qipE099HuXVSP1Wi3NOTbtHSpsahI/STqceA8RJxBJCKsbzChnyeuCZjch5qM/RI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BJSPR01MB0865 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240110_053219_139955_0077895B X-CRM114-Status: GOOD ( 14.31 ) X-BeenThere: linux-riscv@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-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Add support for JH8100 System clock generator (SYSCRG). Signed-off-by: Sia Jee Heng Reviewed-by: Ley Foon Tan --- MAINTAINERS | 8 + drivers/clk/starfive/Kconfig | 10 + drivers/clk/starfive/Makefile | 2 + .../clk/starfive/clk-starfive-jh8100-sys.c | 415 ++++++++++++++++++ drivers/clk/starfive/clk-starfive-jh8100.h | 11 + 5 files changed, 446 insertions(+) create mode 100644 drivers/clk/starfive/clk-starfive-jh8100-sys.c create mode 100644 drivers/clk/starfive/clk-starfive-jh8100.h diff --git a/MAINTAINERS b/MAINTAINERS index 40c754b4c39c..c5d563594e34 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -20730,6 +20730,14 @@ F: Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml F: drivers/phy/starfive/phy-jh7110-pcie.c F: drivers/phy/starfive/phy-jh7110-usb.c +STARFIVE JH8100 CLOCK DRIVERS +M: Sia Jee Heng +M: Ley Foon Tan +S: Maintained +F: Documentation/devicetree/bindings/clock/starfive,jh81*.yaml +F: drivers/clk/starfive/clk-starfive-jh81* +F: include/dt-bindings/clock/starfive?jh81*.h + STATIC BRANCH/CALL M: Peter Zijlstra M: Josh Poimboeuf diff --git a/drivers/clk/starfive/Kconfig b/drivers/clk/starfive/Kconfig index ff8eace36e64..1dddf1415360 100644 --- a/drivers/clk/starfive/Kconfig +++ b/drivers/clk/starfive/Kconfig @@ -72,3 +72,13 @@ config CLK_STARFIVE_JH7110_VOUT help Say yes here to support the Video-Output clock controller on the StarFive JH7110 SoC. + +config CLK_STARFIVE_JH8100_SYS + bool "StarFive JH8100 System clock support" + depends on SOC_STARFIVE || COMPILE_TEST + select AUXILIARY_BUS + select CLK_STARFIVE_COMMON + default ARCH_STARFIVE + help + Say yes here to support the System clock controller on the StarFive JH8100 SoC. + diff --git a/drivers/clk/starfive/Makefile b/drivers/clk/starfive/Makefile index 012f7ee83f8e..af6903c4f987 100644 --- a/drivers/clk/starfive/Makefile +++ b/drivers/clk/starfive/Makefile @@ -10,3 +10,5 @@ obj-$(CONFIG_CLK_STARFIVE_JH7110_AON) += clk-starfive-jh7110-aon.o obj-$(CONFIG_CLK_STARFIVE_JH7110_STG) += clk-starfive-jh7110-stg.o obj-$(CONFIG_CLK_STARFIVE_JH7110_ISP) += clk-starfive-jh7110-isp.o obj-$(CONFIG_CLK_STARFIVE_JH7110_VOUT) += clk-starfive-jh7110-vout.o + +obj-$(CONFIG_CLK_STARFIVE_JH8100_SYS) += clk-starfive-jh8100-sys.o diff --git a/drivers/clk/starfive/clk-starfive-jh8100-sys.c b/drivers/clk/starfive/clk-starfive-jh8100-sys.c new file mode 100644 index 000000000000..6d7e750dce82 --- /dev/null +++ b/drivers/clk/starfive/clk-starfive-jh8100-sys.c @@ -0,0 +1,415 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * StarFive JH8100 System Clock Driver + * + * Copyright (C) 2023 StarFive Technology Co., Ltd. + * + * Author: Jee Heng Sia + * + */ + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include "clk-starfive-jh8100.h" + +#define JH8100_SYSCLK_NUM_CLKS (JH8100_SYSCLK_NNE_ICG_EN + 1) + +/* external clocks */ +#define JH8100_SYSCLK_OSC (JH8100_SYSCLK_NUM_CLKS + 0) +#define JH8100_SYSCLK_MCLK_EXT (JH8100_SYSCLK_NUM_CLKS + 1) +#define JH8100_SYSCLK_PLL0_OUT (JH8100_SYSCLK_NUM_CLKS + 2) +#define JH8100_SYSCLK_PLL1_OUT (JH8100_SYSCLK_NUM_CLKS + 3) +#define JH8100_SYSCLK_PLL2_OUT (JH8100_SYSCLK_NUM_CLKS + 4) +#define JH8100_SYSCLK_PLL3_OUT (JH8100_SYSCLK_NUM_CLKS + 5) +#define JH8100_SYSCLK_PLL4_OUT (JH8100_SYSCLK_NUM_CLKS + 6) +#define JH8100_SYSCLK_PLL6_OUT (JH8100_SYSCLK_NUM_CLKS + 7) +#define JH8100_SYSCLK_PLL7_OUT (JH8100_SYSCLK_NUM_CLKS + 8) + +static const struct starfive_clk_data jh8100_syscrg_clk_data[] __initconst = { + /* root */ + STARFIVE__DIV(JH8100_SYSCLK_VDEC_ROOT_PREOSC, "vdec_root_preosc", 10, + JH8100_SYSCLK_PLL7_OUT), + STARFIVE__MUX(JH8100_SYSCLK_VDEC_ROOT, "vdec_root", 2, + JH8100_SYSCLK_OSC, JH8100_SYSCLK_VDEC_ROOT_PREOSC), + STARFIVE__DIV(JH8100_SYSCLK_VENC_ROOT_PREOSC, "venc_root_preosc", 10, + JH8100_SYSCLK_PLL7_OUT), + STARFIVE__MUX(JH8100_SYSCLK_VENC_ROOT, "venc_root", 2, + JH8100_SYSCLK_OSC, JH8100_SYSCLK_VENC_ROOT_PREOSC), + STARFIVE__DIV(JH8100_SYSCLK_GPU_ROOT, "gpu_root", 7, + JH8100_SYSCLK_PLL0_OUT), + STARFIVE__MUX(JH8100_SYSCLK_GPU_CORE, "gpu_core", 2, + JH8100_SYSCLK_OSC, JH8100_SYSCLK_GPU_ROOT), + STARFIVE__DIV(JH8100_SYSCLK_VOUT_ROOT0_PREOSC, "vout_root0_preosc", 127, + JH8100_SYSCLK_PLL1_OUT), + STARFIVE__MUX(JH8100_SYSCLK_VOUT_ROOT0, "vout_root0", 2, + JH8100_SYSCLK_OSC, JH8100_SYSCLK_VOUT_ROOT0_PREOSC), + STARFIVE__DIV(JH8100_SYSCLK_VOUT_ROOT1_PREOSC, "vout_root1_preosc", 127, + JH8100_SYSCLK_PLL6_OUT), + STARFIVE__MUX(JH8100_SYSCLK_VOUT_ROOT1, "vout_root1", 2, + JH8100_SYSCLK_OSC, JH8100_SYSCLK_VOUT_ROOT1_PREOSC), + STARFIVE__DIV(JH8100_SYSCLK_VOUT_SCAN_ATS, "vout_scan_ats", 6, + JH8100_SYSCLK_PLL3_OUT), + STARFIVE__DIV(JH8100_SYSCLK_PERH_ROOT_PREOSC, "perh_root_preosc", 4, + JH8100_SYSCLK_PLL0_OUT), + STARFIVE__MUX(JH8100_SYSCLK_PERH_ROOT, "perh_root", 2, + JH8100_SYSCLK_OSC, JH8100_SYSCLK_PERH_ROOT_PREOSC), + STARFIVE__DIV(JH8100_SYSCLK_AXI_200_PREOSC, "axi_200_preosc", 4, + JH8100_SYSCLK_PLL0_OUT), + STARFIVE__MUX(JH8100_SYSCLK_AXI_200, "axi_200", 2, + JH8100_SYSCLK_OSC, JH8100_SYSCLK_AXI_200_PREOSC), + STARFIVE__MUX(JH8100_SYSCLK_AXI_200_GMAC, "axi_200_gmac", 2, + JH8100_SYSCLK_OSC, JH8100_SYSCLK_AXI_200_PREOSC), + STARFIVE__DIV(JH8100_SYSCLK_AXI_500_PREOSC, "axi_500_preosc", 10, + JH8100_SYSCLK_PLL0_OUT), + STARFIVE__MUX(JH8100_SYSCLK_AXI_500, "axi_500", 2, + JH8100_SYSCLK_OSC, JH8100_SYSCLK_AXI_500_PREOSC), + STARFIVE__MUX(JH8100_SYSCLK_AXI_500_PCIEX1A, "axi_500_pciex1a", 2, + JH8100_SYSCLK_OSC, JH8100_SYSCLK_AXI_500_PREOSC), + STARFIVE__MUX(JH8100_SYSCLK_AXI_500_PCIEX1B, "axi_500_pciex1b", 2, + JH8100_SYSCLK_OSC, JH8100_SYSCLK_AXI_500_PREOSC), + STARFIVE__MUX(JH8100_SYSCLK_AXI_500_PCIEX2, "axi_500_pciex2", 2, + JH8100_SYSCLK_OSC, JH8100_SYSCLK_AXI_500_PREOSC), + STARFIVE__MUX(JH8100_SYSCLK_AXI_500_PCIEX8, "axi_500_pciex8", 2, + JH8100_SYSCLK_OSC, JH8100_SYSCLK_AXI_500_PREOSC), + STARFIVE__DIV(JH8100_SYSCLK_AXI_400_PREOSC, "axi_400_preosc", 10, + JH8100_SYSCLK_PLL0_OUT), + STARFIVE__MUX(JH8100_SYSCLK_AXI_400, "axi_400", 2, + JH8100_SYSCLK_OSC, JH8100_SYSCLK_AXI_400_PREOSC), + STARFIVE__MUX(JH8100_SYSCLK_AXI_400_APBOOTRAM, "axi_400_apbootram", 2, + JH8100_SYSCLK_OSC, JH8100_SYSCLK_AXI_400_PREOSC), + STARFIVE__DIV(JH8100_SYSCLK_AXI_125_PREOSC, "axi_125_preosc", 32, + JH8100_SYSCLK_PLL0_OUT), + STARFIVE__MUX(JH8100_SYSCLK_AXI_125, "axi_125", 2, + JH8100_SYSCLK_OSC, JH8100_SYSCLK_AXI_125_PREOSC), + STARFIVE__DIV(JH8100_SYSCLK_AHB0_PREOSC, "ahb0_preosc", 15, + JH8100_SYSCLK_PLL0_OUT), + STARFIVE__MUX(JH8100_SYSCLK_AHB0, "ahb0", 2, + JH8100_SYSCLK_OSC, JH8100_SYSCLK_AHB0_PREOSC), + STARFIVE__DIV(JH8100_SYSCLK_APB_BUS_FUNC, "apb_bus_func", 30, + JH8100_SYSCLK_PLL0_OUT), + STARFIVE__MUX(JH8100_SYSCLK_APB_BUS, "apb_bus", 2, + JH8100_SYSCLK_OSC, JH8100_SYSCLK_APB_BUS_FUNC), + STARFIVE__MUX(JH8100_SYSCLK_APB_BUS_PER0, "apb_bus_per0", 2, + JH8100_SYSCLK_OSC, JH8100_SYSCLK_APB_BUS_FUNC), + STARFIVE__MUX(JH8100_SYSCLK_APB_BUS_PER1, "apb_bus_per1", 2, + JH8100_SYSCLK_OSC, JH8100_SYSCLK_APB_BUS_FUNC), + STARFIVE__MUX(JH8100_SYSCLK_APB_BUS_PER2, "apb_bus_per2", 2, + JH8100_SYSCLK_OSC, JH8100_SYSCLK_APB_BUS_FUNC), + STARFIVE__MUX(JH8100_SYSCLK_APB_BUS_PER3, "apb_bus_per3", 2, + JH8100_SYSCLK_OSC, JH8100_SYSCLK_APB_BUS_FUNC), + STARFIVE__MUX(JH8100_SYSCLK_APB_BUS_PER4, "apb_bus_per4", 2, + JH8100_SYSCLK_OSC, JH8100_SYSCLK_APB_BUS_FUNC), + STARFIVE__MUX(JH8100_SYSCLK_APB_BUS_PER5, "apb_bus_per5", 2, + JH8100_SYSCLK_OSC, JH8100_SYSCLK_APB_BUS_FUNC), + STARFIVE__MUX(JH8100_SYSCLK_APB_BUS_PER6, "apb_bus_per6", 2, + JH8100_SYSCLK_OSC, JH8100_SYSCLK_APB_BUS_FUNC), + STARFIVE__MUX(JH8100_SYSCLK_APB_BUS_PER7, "apb_bus_per7", 2, + JH8100_SYSCLK_OSC, JH8100_SYSCLK_APB_BUS_FUNC), + STARFIVE__MUX(JH8100_SYSCLK_APB_BUS_PER8, "apb_bus_per8", 2, + JH8100_SYSCLK_OSC, JH8100_SYSCLK_APB_BUS_FUNC), + STARFIVE__MUX(JH8100_SYSCLK_APB_BUS_PER9, "apb_bus_per9", 2, + JH8100_SYSCLK_OSC, JH8100_SYSCLK_APB_BUS_FUNC), + STARFIVE__MUX(JH8100_SYSCLK_APB_BUS_PER10, "apb_bus_per10", 2, + JH8100_SYSCLK_OSC, JH8100_SYSCLK_APB_BUS_FUNC), + STARFIVE__MUX(JH8100_SYSCLK_SPI_CORE_100, "spi_core_100", 2, + JH8100_SYSCLK_OSC, JH8100_SYSCLK_APB_BUS_FUNC), + STARFIVE__DIV(JH8100_SYSCLK_PLL1_DIV2, "pll1_div2", 2, + JH8100_SYSCLK_PLL1_OUT), + STARFIVE__DIV(JH8100_SYSCLK_PLL2_DIV2, "pll2_div2", 2, + JH8100_SYSCLK_PLL2_OUT), + STARFIVE__DIV(JH8100_SYSCLK_PLL3_DIV2, "pll3_div2", 2, + JH8100_SYSCLK_PLL3_OUT), + STARFIVE__DIV(JH8100_SYSCLK_PLL4_DIV2, "pll4_div2", 2, + JH8100_SYSCLK_PLL4_OUT), + STARFIVE__DIV(JH8100_SYSCLK_PLL6_DIV2, "pll6_div2", 2, + JH8100_SYSCLK_PLL6_OUT), + STARFIVE__DIV(JH8100_SYSCLK_PLL7_DIV2, "pll7_div2", 2, + JH8100_SYSCLK_PLL7_OUT), + STARFIVE__DIV(JH8100_SYSCLK_AUDIO_ROOT, "audio_root", 8, + JH8100_SYSCLK_PLL2_OUT), + STARFIVE__DIV(JH8100_SYSCLK_MCLK_INNER, "mclk_inner", 64, + JH8100_SYSCLK_AUDIO_ROOT), + STARFIVE__MUX(JH8100_SYSCLK_MCLK, "mclk", 2, + JH8100_SYSCLK_MCLK_INNER, JH8100_SYSCLK_MCLK_EXT), + STARFIVE_GATE(JH8100_SYSCLK_MCLK_OUT, "mclk_out", 0, + JH8100_SYSCLK_MCLK_INNER), + STARFIVE_MDIV(JH8100_SYSCLK_ISP_2X_PREOSC, "isp_2x_preosc", 8, 2, + JH8100_SYSCLK_PLL7_OUT, JH8100_SYSCLK_PLL0_OUT), + STARFIVE__MUX(JH8100_SYSCLK_ISP_2X, "isp_2x", 2, + JH8100_SYSCLK_OSC, JH8100_SYSCLK_ISP_2X_PREOSC), + STARFIVE__DIV(JH8100_SYSCLK_ISP_AXI, "isp_axi", 4, + JH8100_SYSCLK_ISP_2X), + STARFIVE_GDIV(JH8100_SYSCLK_GCLK1, "gclk1", CLK_IS_CRITICAL, 120, + JH8100_SYSCLK_PLL1_DIV2), + STARFIVE_GDIV(JH8100_SYSCLK_GCLK2, "gclk2", CLK_IS_CRITICAL, 120, + JH8100_SYSCLK_PLL2_DIV2), + STARFIVE_GDIV(JH8100_SYSCLK_GCLK3, "gclk3", CLK_IS_CRITICAL, 120, + JH8100_SYSCLK_PLL3_DIV2), + STARFIVE_GDIV(JH8100_SYSCLK_GCLK4, "gclk4", CLK_IS_CRITICAL, 120, + JH8100_SYSCLK_PLL4_DIV2), + STARFIVE_GDIV(JH8100_SYSCLK_GCLK6, "gclk6", CLK_IS_CRITICAL, 120, + JH8100_SYSCLK_PLL6_DIV2), + STARFIVE_GDIV(JH8100_SYSCLK_GCLK7, "gclk7", CLK_IS_CRITICAL, 120, + JH8100_SYSCLK_PLL7_DIV2), + /* flexnoc (se) */ + STARFIVE__DIV(JH8100_SYSCLK_FLEXNOC0_PREOSC, "flexnoc0_preosc", 8, + JH8100_SYSCLK_PLL0_OUT), + STARFIVE__MUX(JH8100_SYSCLK_FLEXNOC0, "flexnoc0", 2, + JH8100_SYSCLK_OSC, JH8100_SYSCLK_FLEXNOC0_PREOSC), + STARFIVE__DIV(JH8100_SYSCLK_FLEXNOC1_PREOSC, "flexnoc1_preosc", 8, + JH8100_SYSCLK_PLL0_OUT), + STARFIVE__MUX(JH8100_SYSCLK_FLEXNOC1, "flexnoc1", 2, + JH8100_SYSCLK_OSC, JH8100_SYSCLK_FLEXNOC1_PREOSC), + STARFIVE__DIV(JH8100_SYSCLK_FLEXNOC2_PREOSC, "flexnoc2_preosc", 12, + JH8100_SYSCLK_PLL0_OUT), + STARFIVE__MUX(JH8100_SYSCLK_FLEXNOC2, "flexnoc2", 2, + JH8100_SYSCLK_OSC, JH8100_SYSCLK_FLEXNOC2_PREOSC), + STARFIVE__MUX(JH8100_SYSCLK_VDEC_CORE, "vdec_core", 2, + JH8100_SYSCLK_OSC, JH8100_SYSCLK_FLEXNOC1_PREOSC), + /* img_gpu (se) */ + STARFIVE_GATE(JH8100_SYSCLK_GPU_CORE_ICG, "gpu_core_icg", 0, + JH8100_SYSCLK_GPU_CORE), + STARFIVE_GATE(JH8100_SYSCLK_IMG_GPU_CLK_APB, "img_gpu_clk_apb", 0, + JH8100_SYSCLK_APB_BUS_PER7), + STARFIVE_GATE(JH8100_SYSCLK_IMG_GPU_RTC_TOGGLE, "img_gpu_rtc_toggle", 0, + JH8100_SYSCLK_OSC), + STARFIVE_GATE(JH8100_SYSCLK_IMG_GPU_TIMER_USC, "img_gpu_timer_usc", 0, + JH8100_SYSCLK_OSC), + /* hifi4 (se) */ + STARFIVE__DIV(JH8100_SYSCLK_HIFI4_CORE_PREOSC, "hifi4_core_preosc", 15, + JH8100_SYSCLK_PLL0_OUT), + STARFIVE__MUX(JH8100_SYSCLK_HIFI4_CORE, "hifi4_core", 2, + JH8100_SYSCLK_OSC, JH8100_SYSCLK_HIFI4_CORE_PREOSC), + STARFIVE__DIV(JH8100_SYSCLK_E_200_PREOSC, "e_200_preosc", 2, + JH8100_SYSCLK_PLL0_OUT), + STARFIVE__MUX(JH8100_SYSCLK_E_200, "e_200", 2, JH8100_SYSCLK_OSC, + JH8100_SYSCLK_E_200_PREOSC), + /* hd audio */ + STARFIVE__DIV(JH8100_SYSCLK_HD_AUDIO_48M, "hd_audio_48m", 80, + JH8100_SYSCLK_PLL7_OUT), + /* dom vout */ + STARFIVE__DIV(JH8100_SYSCLK_VOUT_DC_CORE, "vout_dc_core", 10, + JH8100_SYSCLK_PLL7_OUT), + STARFIVE__DIV(JH8100_SYSCLK_VOUT_AXI, "vout_axi", 10, + JH8100_SYSCLK_PLL7_OUT), + /* stg2_usb_wrap (se) */ + STARFIVE__DIV(JH8100_SYSCLK_USB_WRAP_625, "usb_wrap_625", 6, + JH8100_SYSCLK_PLL0_OUT), + STARFIVE__DIV(JH8100_SYSCLK_USB_WRAP_480, "usb_wrap_480", 8, + JH8100_SYSCLK_PLL0_OUT), + STARFIVE__DIV(JH8100_SYSCLK_USB_WRAP_240, "usb_wrap_240", 2, + JH8100_SYSCLK_USB_WRAP_480), + STARFIVE__DIV(JH8100_SYSCLK_USB_WRAP_60, "usb_wrap_60", 10, + JH8100_SYSCLK_USB_WRAP_480), + STARFIVE__DIV(JH8100_SYSCLK_USB_WRAP_156P25, "usb_wrap_156p25", 4, + JH8100_SYSCLK_USB_WRAP_625), + STARFIVE__DIV(JH8100_SYSCLK_USB_WRAP_312P5, "usb_wrap_312p5", 2, + JH8100_SYSCLK_USB_WRAP_625), + /* stg */ + STARFIVE__DIV(JH8100_SYSCLK_USB_125M, "usb_125m", 32, + JH8100_SYSCLK_PLL0_OUT), + /* Flexnoc (se) */ + STARFIVE_GATE(JH8100_SYSCLK_FLEXNOC_APBOOTRAM, "flexnoc_apbootram", CLK_IS_CRITICAL, + JH8100_SYSCLK_AXI_400_APBOOTRAM), + STARFIVE_GATE(JH8100_SYSCLK_FLEXNOC_PCIEX1AMST, "flexnoc_pciex1amst", CLK_IS_CRITICAL, + JH8100_SYSCLK_AXI_500_PCIEX1A), + STARFIVE_GATE(JH8100_SYSCLK_FLEXNOC_PCIEX1ASLV, "flexnoc_pciex1aslv", CLK_IS_CRITICAL, + JH8100_SYSCLK_AXI_500_PCIEX1A), + STARFIVE_GATE(JH8100_SYSCLK_FLEXNOC_PCIEX1BMST, "flexnoc_pciex1bmst", CLK_IS_CRITICAL, + JH8100_SYSCLK_AXI_500_PCIEX1B), + STARFIVE_GATE(JH8100_SYSCLK_FLEXNOC_PCIEX1BSLV, "flexnoc_pciex1bslv", CLK_IS_CRITICAL, + JH8100_SYSCLK_AXI_500_PCIEX1B), + STARFIVE_GATE(JH8100_SYSCLK_FLEXNOC_PCIEX2MST, "flexnoc_pciex2mst", CLK_IS_CRITICAL, + JH8100_SYSCLK_AXI_500_PCIEX2), + STARFIVE_GATE(JH8100_SYSCLK_FLEXNOC_PCIEX2SLV, "flexnoc_pciex2slv", CLK_IS_CRITICAL, + JH8100_SYSCLK_AXI_500_PCIEX2), + STARFIVE_GATE(JH8100_SYSCLK_FLEXNOC_PCIEX8MST, "flexnoc_pciex8mst", CLK_IS_CRITICAL, + JH8100_SYSCLK_AXI_500_PCIEX8), + STARFIVE_GATE(JH8100_SYSCLK_FLEXNOC_PCIEX8SLV, "flexnoc_pciex8slv", CLK_IS_CRITICAL, + JH8100_SYSCLK_AXI_500_PCIEX8), + STARFIVE_GATE(JH8100_SYSCLK_FLEXNOC_GMACSYSSLV, "flexnoc_gmacsysslv", CLK_IS_CRITICAL, + JH8100_SYSCLK_AXI_200_GMAC), + /* gmac1 (se) */ + STARFIVE__DIV(JH8100_SYSCLK_GMAC_SRC, "gmac_src", 7, + JH8100_SYSCLK_PLL0_OUT), + STARFIVE__DIV(JH8100_SYSCLK_GMAC1_GTXCLK_TOP, "gmac1_gtxclk_top", 400, + JH8100_SYSCLK_PLL0_OUT), + STARFIVE__DIV(JH8100_SYSCLK_GMAC1_PTP, "gmac1_ptp", 31, + JH8100_SYSCLK_GMAC_SRC), + /* hd audio */ + STARFIVE_GATE(JH8100_SYSCLK_HD_AUDIO_SYSTEM_CLOCK, "hd_audio_system_clock", 0, + JH8100_SYSCLK_APB_BUS_PER7), + STARFIVE_GATE(JH8100_SYSCLK_HD_AUDIO_CLOCK_48, "hd_audio_clock_48", 0, + JH8100_SYSCLK_HD_AUDIO_48M), + STARFIVE_GATE(JH8100_SYSCLK_HD_AUDIO_BCLK_POST_OCC_IN, "hd_audio_bclk_post_occ_in", 0, + JH8100_SYSCLK_HD_AUDIO_48M), + /* nne_vip (se) */ + STARFIVE_GATE(JH8100_SYSCLK_NNE_VIP_ACLK, "nne_vip_aclk", 0, JH8100_SYSCLK_AXI_500), + STARFIVE_GATE(JH8100_SYSCLK_NNE_VIP_HCLK, "nne_vip_hclk", 0, JH8100_SYSCLK_AXI_200), + STARFIVE_GMUX(JH8100_SYSCLK_NNE_VIP_CLKCORE, "nne_vip_clkcore", 0, 2, + JH8100_SYSCLK_PLL2_OUT, JH8100_SYSCLK_PLL0_OUT), + /* icg_en */ + STARFIVE_GATE(JH8100_SYSCLK_GPU_ICG_EN, "gpu_en", 0, JH8100_SYSCLK_GPU_CORE), + STARFIVE_GATE(JH8100_SYSCLK_HD_AUDIO_ICG_EN, "hd_audio_en", 0, JH8100_SYSCLK_APB_BUS), + STARFIVE_GATE(JH8100_SYSCLK_NNE_ICG_EN, "nne_en", CLK_IGNORE_UNUSED, + JH8100_SYSCLK_PLL2_OUT), +}; + +static struct clk_hw *jh8100_sysclk_get(struct of_phandle_args *clkspec, void *data) +{ + struct starfive_clk_priv *priv = data; + unsigned int idx = clkspec->args[0]; + + if (idx < JH8100_SYSCLK_NUM_CLKS) + return &priv->reg[idx].hw; + + return ERR_PTR(-EINVAL); +} + +static void jh8100_reset_unregister_adev(void *_adev) +{ + struct auxiliary_device *adev = _adev; + + auxiliary_device_delete(adev); + auxiliary_device_uninit(adev); +} + +static void jh8100_reset_adev_release(struct device *dev) +{ + struct auxiliary_device *adev = to_auxiliary_dev(dev); + struct starfive_reset_adev *rdev = to_starfive_reset_adev(adev); + + kfree(rdev); +} + +int jh8100_reset_controller_register(struct starfive_clk_priv *priv, + const char *adev_name, + u32 adev_id) +{ + struct starfive_reset_adev *rdev; + struct auxiliary_device *adev; + int ret; + + rdev = kzalloc(sizeof(*rdev), GFP_KERNEL); + if (!rdev) + return -ENOMEM; + + rdev->base = priv->base; + + adev = &rdev->adev; + adev->name = adev_name; + adev->dev.parent = priv->dev; + adev->dev.release = jh8100_reset_adev_release; + adev->id = adev_id; + + ret = auxiliary_device_init(adev); + if (ret) + return ret; + + ret = auxiliary_device_add(adev); + if (ret) { + auxiliary_device_uninit(adev); + return ret; + } + + return devm_add_action_or_reset(priv->dev, + jh8100_reset_unregister_adev, adev); +} +EXPORT_SYMBOL_GPL(jh8100_reset_controller_register); + +static int __init jh8100_syscrg_probe(struct platform_device *pdev) +{ + struct starfive_clk_priv *priv; + unsigned int idx; + int ret; + + priv = devm_kzalloc(&pdev->dev, + struct_size(priv, reg, JH8100_SYSCLK_NUM_CLKS), + GFP_KERNEL); + if (!priv) + return -ENOMEM; + + spin_lock_init(&priv->rmw_lock); + priv->dev = &pdev->dev; + priv->base = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(priv->base)) + return PTR_ERR(priv->base); + + for (idx = 0; idx < JH8100_SYSCLK_NUM_CLKS; idx++) { + u32 max = jh8100_syscrg_clk_data[idx].max; + struct clk_parent_data parents[4] = {}; + struct clk_init_data init = { + .name = jh8100_syscrg_clk_data[idx].name, + .ops = starfive_clk_ops(max), + .parent_data = parents, + .num_parents = + ((max & STARFIVE_CLK_MUX_MASK) >> STARFIVE_CLK_MUX_SHIFT) + 1, + .flags = jh8100_syscrg_clk_data[idx].flags, + }; + struct starfive_clk *clk = &priv->reg[idx]; + unsigned int i; + + for (i = 0; i < init.num_parents; i++) { + unsigned int pidx = jh8100_syscrg_clk_data[idx].parents[i]; + + if (pidx < JH8100_SYSCLK_NUM_CLKS) + parents[i].hw = &priv->reg[pidx].hw; + else if (pidx == JH8100_SYSCLK_OSC) + parents[i].fw_name = "osc"; + else if (pidx == JH8100_SYSCLK_MCLK_EXT) + parents[i].fw_name = "mclk-ext"; + else if (pidx == JH8100_SYSCLK_PLL0_OUT) + parents[i].fw_name = "pll0"; + else if (pidx == JH8100_SYSCLK_PLL1_OUT) + parents[i].fw_name = "pll1"; + else if (pidx == JH8100_SYSCLK_PLL2_OUT) + parents[i].fw_name = "pll2"; + else if (pidx == JH8100_SYSCLK_PLL3_OUT) + parents[i].fw_name = "pll3"; + else if (pidx == JH8100_SYSCLK_PLL4_OUT) + parents[i].fw_name = "pll4"; + else if (pidx == JH8100_SYSCLK_PLL6_OUT) + parents[i].fw_name = "pll6"; + else + parents[i].fw_name = "pll7"; + } + + clk->hw.init = &init; + clk->idx = idx; + clk->max_div = max & STARFIVE_CLK_DIV_MASK; + + ret = devm_clk_hw_register(&pdev->dev, &clk->hw); + if (ret) + return ret; + } + + ret = devm_of_clk_add_hw_provider(&pdev->dev, jh8100_sysclk_get, priv); + if (ret) + return ret; + + return jh8100_reset_controller_register(priv, "rst-sys", 0); +} + +static const struct of_device_id jh8100_syscrg_match[] = { + { .compatible = "starfive,jh8100-syscrg" }, + { /* sentinel */ } +}; + +static struct platform_driver jh8100_syscrg_driver = { + .driver = { + .name = "clk-starfive-jh8100-sys", + .of_match_table = jh8100_syscrg_match, + .suppress_bind_attrs = true, + }, +}; +builtin_platform_driver_probe(jh8100_syscrg_driver, jh8100_syscrg_probe); diff --git a/drivers/clk/starfive/clk-starfive-jh8100.h b/drivers/clk/starfive/clk-starfive-jh8100.h new file mode 100644 index 000000000000..9b69a56fe5fc --- /dev/null +++ b/drivers/clk/starfive/clk-starfive-jh8100.h @@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __CLK_STARFIVE_JH8100_H +#define __CLK_STARFIVE_JH8100_H + +#include "clk-starfive-common.h" + +int jh8100_reset_controller_register(struct starfive_clk_priv *priv, + const char *adev_name, + u32 adev_id); + +#endif From patchwork Wed Jan 10 13:31:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sia Jee Heng X-Patchwork-Id: 13516154 X-Patchwork-Delegate: mail@conchuod.ie 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 B601AC4707B for ; Wed, 10 Jan 2024 13:32:24 +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=kGMWUuTnLKx/UVz+/bTeSu/D9fXgajt1ohnplIvD/eo=; b=uwA0Lfu/Nt9xuZ TDbJA6Dw9i1rwzZOHpMqN3IOWPwadGguq5Nq0UyCJp/bPUknc75j/nQdDtOqIbmwTQx7Az2tA3lXl pH8Lx04qg6MSJUIE1TudWvjIB+whH9EIPjhY3+heVH9PQYZ0pK0K6fepjpXX9COxYujvrEdNTcXgc qjBXwK6Xv58jL4F4nOikmLv9ZsUpG0qDDi7RezwgxT56SGoVcbpL718iJKluplD2ZIxdNZp6JFV6C DItnk+xCcTYnruZpl/ZAGR1kPLmw6IWj+Vwo7c9tvqgBblziSiccICM6aWMWoAHicy68qbcYeoZ6t 7YfVoeAuQMM/vqFIwItQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rNYgr-00Bz10-04; Wed, 10 Jan 2024 13:32:17 +0000 Received: from mail-sh0chn02on20614.outbound.protection.partner.outlook.cn ([2406:e500:4420:2::614] helo=CHN02-SH0-obe.outbound.protection.partner.outlook.cn) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rNYgn-00BywR-01 for linux-riscv@lists.infradead.org; Wed, 10 Jan 2024 13:32:15 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CqrK3H0DGc4ASFng5Q9t1CUUBY8kLEz+0djvFFX5biOcVYF8dxio8OAo51h8R/p/QtOTNG2MEiXG/779JJY0PvP0ZhCrRwEYroWBQavuIeAOasyN0Izy6sVNgJ6vJXP0CjopslUX1odrB4PHXhA1ygn4YMg1Ul69M5C2aCWUSt5tJUZp7wUUr85FlHXCdEOoaNDLj+QBxbBMWp86/iz/P8SMkR3CXAX/ki4TMxmnqBoCuGM1yx1X814ejb+OmSI1sTvQcuVCgIkMgeUNkPZGe4RNpjLhoIotkbnCs5EZFeS80NcLZIyMMhbXkvNQFD3mqg6ySizcDcgkPVgfTJlFDg== 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=WGTdrvMf3V+j6XKfQX8+cel+jy9nwGvJoJXk7ZIf5/U=; b=efloWJQLRJjkTvW+FlyvI+TBZf4mudDhCYGP2X9h/QdPaw+ShdIRVln7Hk3DSJbC/aUSx39JkqPKVA48e/wYOv/2J/ueL/+yjX22o/NHGB094p628mR4LAJVL0sFQuPRp5tkAcgCH2o6ZuCve0nEZ8H7ojiglaxS7movgLAj1pk0iXXo9TmU6h2ARatQytHESUAIdC8w7laSqTx+wPI8pFDN+TY4xMzQgUC2nvxHVIfUUMLNNv0cYUCvm7/QhiW36RDy9zbJy8xZaJGHU1pO2+RAQO6hNZcVz19VpkFDK5aSAwb+jt/xkH0T7caIrKetd2tyFy4KxZle+agp70AtXg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=starfivetech.com; dmarc=pass action=none header.from=starfivetech.com; dkim=pass header.d=starfivetech.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=starfivetech.com; Received: from BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:f::16) by BJSPR01MB0626.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:10::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.33; Wed, 10 Jan 2024 13:32:08 +0000 Received: from BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn ([fe80::3862:65b4:c857:c4a6]) by BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn ([fe80::3862:65b4:c857:c4a6%4]) with mapi id 15.20.7135.033; Wed, 10 Jan 2024 13:32:08 +0000 From: Sia Jee Heng To: kernel@esmil.dk, conor@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, mturquette@baylibre.com, sboyd@kernel.org, p.zabel@pengutronix.de, emil.renner.berthing@canonical.com, hal.feng@starfivetech.com, xingyu.wu@starfivetech.com Cc: linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, jeeheng.sia@starfivetech.com, leyfoon.tan@starfivetech.com, Krzysztof Kozlowski Subject: [RFC v3 07/16] dt-bindings: clock: Add StarFive JH8100 North-West clock and reset generator Date: Wed, 10 Jan 2024 21:31:19 +0800 Message-Id: <20240110133128.286657-8-jeeheng.sia@starfivetech.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240110133128.286657-1-jeeheng.sia@starfivetech.com> References: <20240110133128.286657-1-jeeheng.sia@starfivetech.com> X-ClientProxiedBy: BJXPR01CA0067.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:12::34) To BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:f::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BJSPR01MB0561:EE_|BJSPR01MB0626:EE_ X-MS-Office365-Filtering-Correlation-Id: 8630f33a-9d50-4c7d-c237-08dc11e08b1a X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +um0bp0235BtF9LaGvx/92Ce3Sg9ISbnfKrbVhZCuBaUoq9SSFVUX9cDpahm3Wl8DCLLoJmHH789suHjdaA9EZVSpV5AlPPLKIVT5yI6HhWGNrCkPktH1hvFTsIjfluMr/KDfUWx4jyjXN8qt2G3wXmsRW62DtMtlvwt9BXWdOOqvQG/eGdKbZZ6Ws+gdsL4HY0/F1qmdYHczywaEx/83VnL10MBXmHscW8LOPMIjONFI2BebAMP8RoNz0O1MijaJyfP0UPoLFYv4oNkrXw7rG4+8heAsDtzL7oUdN48jUNnwiufTHaCh9pGsUeFZpe+FDVj0jUTWTV5WAJbzz2283iDHazCWMT56hfecl6+FoYd18v7ArlKc30xPMvnvfEcORV7rzKWyqCgS3dwB719EFjJ0CgxV8yF1f9IZFvz7rtcaxeRCg/SWyCil+Oi0lBGadJl78kuxQovrNmU9BHXDQxuLUxKPxz5rgAqk79gmjVr7s6clIeJLZdNgC2XY/GMWLgpGSrvtCeqmEhdLnX3Zqsx4FnweqwnT6v4ASXx5MP3CtdZ5/NWodqe14suWTgyDjsG7Ly+TToXPJY3JlWOP0K+9oML+7z1DiNZr+7UjdtIRh0IcfejD+UQxkId3M2x X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn;PTR:;CAT:NONE;SFS:(13230031)(39830400003)(136003)(346002)(396003)(366004)(230273577357003)(230922051799003)(230173577357003)(186009)(64100799003)(451199024)(1800799012)(921011)(26005)(52116002)(2616005)(41320700001)(6666004)(83380400001)(1076003)(86362001)(40160700002)(40180700001)(38100700002)(36756003)(38350700005)(5660300002)(7416002)(4326008)(55236004)(6636002)(66556008)(66476007)(66946007)(41300700001)(2906002)(8936002)(8676002)(966005)(508600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: v6Vwz7tOq2fJhCOwmwAuvqFQ4EHEyUr+XGL2NbPQ6bvGR3Rm+cV8KKUEdNhxalT+0RHKyMGfog2ifzs0rYx70xdtEvqUW9kAMBfeVfQldoCdE58zXTuVj8cg4VJADs7fTyDiV9cUsLIQImG3POoOIzF1NwSBBsaD/jbS0+oU6zyhmbsQllhRevj9BH96Z34+VmRXd5LIqfDUdNpGRjZOhzQqf76HnUxitMSpvqOcp3HliYEfo6jiBCtoHKxT0YMiWGLl6dls/8dkytmQqyDKb4riIxwykTD2Y1aggwVD7pnS8FEukrNVnBXDXDetuXyX7HJpzFbu3fhliAQSnfPfR+lK0pSl/pXkSccF2ZJ341Z0ubUX43IvacaFV/gvbmd1D9mH5BKCNkOWNqgmGl/UWyLjOR850EJtSb1MntqQ/rW4LgkacXxk3v5vTwPyWldvmDjJQaEfFEq8x/6bySNMPxON9vJZyUmfOP57DboDjP8+RAKCuce2E0ZJcrisDT5AQdaiU4sDbid2qcrUJKnwmDO207r3WtuGleMvL6lp5g6UHF1uTRS0LScLwOfp9X32kWJ38S+nMnUTFjgOsx/FFK4zy3focZG9Q7KjgFbJSgKeiB3YLTzMTlpmRGIQ851HeqrhF3WpodpIVt2Gt+S5gtBJEj4owTsJMdkNH2m8t3QrFgdSDDP6MrMkT3yDiJmiW5OIu31zS2PjhK3xqdPhjut+toUB1UMRNd17pdJLjX0yib+n5A8X/UBDkIsP+ULvWphhUyvEIYpzRnrSU7dmzcNZZMtT7dL5p7i4Nbb1Qlejws4W0SILy41HfB8LQoJlfI9ljplY+5c67Rkl6YvsH9g5ZneguK84SdhWZ45NKZ+g91OS+GUP0KpyytwOahGbaddfRvQx4cwTkNTGYXcc7u5+Ht5BgHxGeRrqMGjXH6XLmQmy3GFBs+rRbCK6xYcYU4sJaEChfH2UkOagNgsjA2fMLvbiA66iPaNwy3do2OJwNhE2Y07zhfKoaStF66uic2KNRjMClLok7A3yql75shd+SnfUIoKOmkhLHap7oe1GvTOAywW0px3kgokoOo6tfwOeansW27HW+D7RyWBYsrA88zu9Gh0iwnuZnLYMnYzNqa5UWOgbO7R4jBPBRCes5AOAmFxCXc/SojQ8k4vZ74p0rWuxHQrCOuPUs4LIAJu+GQl1zIw6hpnVlWkWcRHP/2Lb++9rlxoeBuuquA2Q5hgsU9MJEZTbsJp2iX1P9jvAJFhvTn5myIKvqMAhGUhB0xw4RF+1EbYjXScH+fYHNsrqPdBxFr9y4T+xWs4rYLZ2DaWhznornmRa0IjCJL1mzKc+V31OLi2Ezq8H2T/0fUwQAkNPSvpODcIO+acZgR0uAuiyhyhtecEytKRSP55zObn8GeFrZHB8BtyKP+BP4xAAPVOS4203m8heD1jdVFZonecmvMdjbRtBT2LN8J7EXaeqfapMgVDI7Hvj7UAqkaIjiaQ7H/YLAEWwQKo/CVgMqyFPgVWzDEHKZMlldQ1FAyKYDDY//YzLa5KvDMRDokb7NsnvsJJ6vQPA6yrrFp4Y80OGIwW4wixh5jpvfXlRRy3VAoqEvdpk4LqWe7RpanxlXbIDqHyorY5frmoWO2g= X-OriginatorOrg: starfivetech.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8630f33a-9d50-4c7d-c237-08dc11e08b1a X-MS-Exchange-CrossTenant-AuthSource: BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jan 2024 13:32:08.5934 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 06fe3fa3-1221-43d3-861b-5a4ee687a85c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: aYoEwLvyOsJmHvK15nA+NpGq/ba/BmIZCWSmW3fHh4g80+uIodNDh93E4zD2GFfifhCqQPtaBplwA6t0u3s4p4tSf0E4l7fssmmjTq5ilGM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BJSPR01MB0626 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240110_053213_182305_2DAACE8A X-CRM114-Status: GOOD ( 12.78 ) X-BeenThere: linux-riscv@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-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Add bindings for the North-West clock and reset generator (NWCRG) on JH8100 SoC. Signed-off-by: Sia Jee Heng Reviewed-by: Ley Foon Tan Reviewed-by: Krzysztof Kozlowski --- .../bindings/clock/starfive,jh8100-nwcrg.yaml | 119 ++++++++++++++++++ .../dt-bindings/clock/starfive,jh8100-crg.h | 43 +++++++ .../dt-bindings/reset/starfive,jh8100-crg.h | 14 +++ 3 files changed, 176 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/starfive,jh8100-nwcrg.yaml diff --git a/Documentation/devicetree/bindings/clock/starfive,jh8100-nwcrg.yaml b/Documentation/devicetree/bindings/clock/starfive,jh8100-nwcrg.yaml new file mode 100644 index 000000000000..be0f94e64e6a --- /dev/null +++ b/Documentation/devicetree/bindings/clock/starfive,jh8100-nwcrg.yaml @@ -0,0 +1,119 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/clock/starfive,jh8100-nwcrg.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: StarFive JH8100 North-West Clock and Reset Generator + +maintainers: + - Sia Jee Heng + +properties: + compatible: + const: starfive,jh8100-nwcrg + + reg: + maxItems: 1 + + clocks: + items: + - description: Main Oscillator (24 MHz) + - description: APB_BUS clock from SYSCRG + - description: APB_BUS_PER4 clock from SYSCRG + - description: SPI_CORE_100 clock from SYSCRG + - description: ISP_2X clock from SYSCRG + - description: ISP_AXI clock from SYSCRG + - description: VOUT_ROOT0 clock from SYSCRG + - description: VOUT_ROOT1 clock from SYSCRG + - description: VOUT_SCAN_ATS clock from SYSCRG + - description: VOUT_DC_CORE clock from SYSCRG + - description: VOUT_AXI clock from SYSCRG + - description: AXI_400 clock from SYSCRG + - description: AHB0 clock from SYSCRG + - description: PERH_ROOT_PREOSC from SYSCRG + - description: External DVP clock + - description: External ISP DPHY TAP TCK clock + - description: External golbal clock + - description: External VOUT MIPI DPHY TAP TCK + - description: External VOUT eDP TAP TCK + - description: External SPI In2 clock + - description: PLL5 + + clock-names: + items: + - const: osc + - const: apb_bus + - const: apb_bus_per4 + - const: spi_core_100 + - const: isp_2x + - const: isp_axi + - const: vout_root0 + - const: vout_root1 + - const: vout_scan_ats + - const: vout_dc_core + - const: vout_axi + - const: axi_400 + - const: ahb0 + - const: perh_root_preosc + - const: dvp-ext + - const: isp-dphy-tap-tck-ext + - const: glb-ext-clk + - const: vout-mipi-dphy-tap-tck-ext + - const: vout-edp-tap-tck-ext + - const: spi-in2-ext + - const: pll5 + + '#clock-cells': + const: 1 + description: + See for valid indices. + + '#reset-cells': + const: 1 + description: + See for valid indices. + +required: + - compatible + - reg + - clocks + - clock-names + - '#clock-cells' + - '#reset-cells' + +additionalProperties: false + +examples: + - | + #include + + clock-controller@123c0000 { + compatible = "starfive,jh8100-nwcrg"; + reg = <0x123c0000 0x10000>; + clocks = <&osc>, <&syscrg JH8100_SYSCLK_APB_BUS>, + <&syscrg JH8100_SYSCLK_APB_BUS_PER4>, + <&syscrh JH8100_SYSCLK_SPI_CORE_100>, + <&syscrg JH8100_SYSCLK_ISP_2X>, + <&syscrg JH8100_SYSCLK_ISP_AXI>, + <&syscrg JH8100_SYSCLK_VOUT_ROOT0>, + <&syscrg JH8100_SYSCLK_VOUT_ROOT1>, + <&syscrg JH8100_SYSCLK_VOUT_SCAN_ATS>, + <&syscrg JH8100_SYSCLK_VOUT_DC_CORE>, + <&syscrg JH8100_SYSCLK_VOUT_AXI>, + <&syscrg JH8100_SYSCLK_AXI_400>, + <&syscrg JH8100_SYSCLK_AHB0>, + <&syscrg JH8100_SYSCLK_PERH_ROOT_PREOSC>, + <&dvp_ext>, <&isp_dphy_tap_tck_ext>, + <&glb_ext_clk>, <&vout_mipi_dphy_tap_tck_ext>, + <&vout_edp_tap_tck_ext>, <&spi_in2_ext>, <&pll5>; + clock-names = "osc", "apb_bus", "apb_bus_per4", "spi_core_100", + "isp_2x", "isp_axi", "vout_root0", "vout_root1", + "vout_scan_ats", "vout_dc_core", "vout_axi", + "axi_400", "ahb0", "perh_root_preosc", "dvp-ext", + "isp-dphy-tap-tck-ext", "glb-ext-clk", + "vout-mipi-dphy-tap-tck-ext", "vout-edp-tap-tck-ext", + "spi-in2-ext", "pll5"; + #clock-cells = <1>; + #reset-cells = <1>; + }; diff --git a/include/dt-bindings/clock/starfive,jh8100-crg.h b/include/dt-bindings/clock/starfive,jh8100-crg.h index 611613961e17..626173e14940 100644 --- a/include/dt-bindings/clock/starfive,jh8100-crg.h +++ b/include/dt-bindings/clock/starfive,jh8100-crg.h @@ -119,4 +119,47 @@ #define JH8100_SYSCLK_HD_AUDIO_ICG_EN 107 #define JH8100_SYSCLK_NNE_ICG_EN 108 +/* NWCRG clocks */ +#define JH8100_NWCLK_PLL5_DIV2 0 +#define JH8100_NWCLK_GCLK5 1 +#define JH8100_NWCLK_GPIO_100 2 +#define JH8100_NWCLK_GPIO_50 3 +#define JH8100_NWCLK_GPIO_150 4 +#define JH8100_NWCLK_GPIO_60 5 +#define JH8100_NWCLK_IOMUX_WEST_PCLK 6 +#define JH8100_NWCLK_I2C6_APB 7 +#define JH8100_NWCLK_I2C7_APB 8 +#define JH8100_NWCLK_SPI2_APB 9 +#define JH8100_NWCLK_SPI2_CORE 10 +#define JH8100_NWCLK_SPI2_SCLK_IN 11 +#define JH8100_NWCLK_SMBUS1_APB 12 +#define JH8100_NWCLK_SMBUS1_CORE 13 +#define JH8100_NWCLK_ISP_DVP 14 +#define JH8100_NWCLK_ISP_CORE_2X 15 +#define JH8100_NWCLK_ISP_AXI 16 +#define JH8100_NWCLK_ISP_DPHY_TAP_TCK 17 +#define JH8100_NWCLK_FLEXNOC_ISPSLV 18 +#define JH8100_NWCLK_VOUT_PIX0 19 +#define JH8100_NWCLK_VOUT_PIX1 20 +#define JH8100_NWCLK_VOUT_SCAN_ATS 21 +#define JH8100_NWCLK_VOUT_DC_CORE 22 +#define JH8100_NWCLK_VOUT_APB 23 +#define JH8100_NWCLK_VOUT_DSI 24 +#define JH8100_NWCLK_VOUT_AHB 25 +#define JH8100_NWCLK_VOUT_AXI 26 +#define JH8100_NWCLK_VOUT_MIPI_DPHY_TAP_TCK 27 +#define JH8100_NWCLK_VOUT_EDP_PHY_TAP_TCK 28 +#define JH8100_NWCLK_UART5_CORE_PREOSC 29 +#define JH8100_NWCLK_UART5_APB 30 +#define JH8100_NWCLK_UART5_CORE 31 +#define JH8100_NWCLK_UART6_CORE_PREOSC 32 +#define JH8100_NWCLK_UART6_APB 33 +#define JH8100_NWCLK_UART6_CORE 34 +#define JH8100_NWCLK_SPI2_ICG_EN 35 +#define JH8100_NWCLK_SMBUS1_ICG_EN 36 +#define JH8100_NWCLK_ISP_ICG_EN 37 +#define JH8100_NWCLK_VOUT_ICG_EN 38 +#define JH8100_NWCLK_UART5_ICG_EN 39 +#define JH8100_NWCLK_UART6_ICG_EN 40 + #endif /* __DT_BINDINGS_CLOCK_STARFIVE_JH8100_H__ */ diff --git a/include/dt-bindings/reset/starfive,jh8100-crg.h b/include/dt-bindings/reset/starfive,jh8100-crg.h index c4e2501491ab..b25f6522f3d4 100644 --- a/include/dt-bindings/reset/starfive,jh8100-crg.h +++ b/include/dt-bindings/reset/starfive,jh8100-crg.h @@ -18,4 +18,18 @@ #define JH8100_SYSRST_NNE 6 #define JH8100_SYSRST_HD_AUDIO 7 +/* + * NWCRG resets: assert0 + */ +#define JH8100_NWRST_PRESETN 0 +#define JH8100_NWRST_SYS_IOMUX_W 1 +#define JH8100_NWRST_I2C6 2 +#define JH8100_NWRST_I2C7 3 +#define JH8100_NWRST_SPI2 4 +#define JH8100_NWRST_SMBUS1 5 +#define JH8100_NWRST_UART5 6 +#define JH8100_NWRST_UART6 7 +#define JH8100_NWRST_MERAK0_TVSENSOR 8 +#define JH8100_NWRST_MERAK1_TVSENSOR 9 + #endif /* __DT_BINDINGS_RESET_STARFIVE_JH8100_H__ */ From patchwork Wed Jan 10 13:31:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sia Jee Heng X-Patchwork-Id: 13516156 X-Patchwork-Delegate: mail@conchuod.ie 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 B165AC4707C for ; Wed, 10 Jan 2024 13:32:27 +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=ouBmlVlGXseUefp9yQJkuMcKLM96sjPdCknKr6rvHlA=; b=4wB0zExOzOLpJb Ju2pp3Ly8s5jxlYT4aF6q/veHhVI7rR8A3ImdLTDkyJFfBAUlvy9l512+gOO9L/1Z7f9mCeyS/MhL czxSDpTeNoLOng6GpS9IkV1t+QbjN6w22iUE8qO5NOl/VIWhMHYUMGuChXKO/2Q+UTy2BJx0OSAqm XCH+6z+n0F9Drvm9FazxqAmTk/dFtw0TjlYqN1Y3pUEG4trH7/3Bu4gHvjwC/TQ3P8H+xX/LLvcBB p0899kcGK94v9mMUtMVI9Hhy2gUDs1pCg/alIBdYFvWIdgagAUhsvwSgnGWoRGVtl37IlNZ03viOj jI3yYPN3HjC+tC+Wb7Qg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rNYgt-00Bz31-0B; Wed, 10 Jan 2024 13:32:19 +0000 Received: from mail-sh0chn02on20614.outbound.protection.partner.outlook.cn ([2406:e500:4420:2::614] helo=CHN02-SH0-obe.outbound.protection.partner.outlook.cn) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rNYgp-00BywR-1j for linux-riscv@lists.infradead.org; Wed, 10 Jan 2024 13:32:17 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lZVMNFLisAoAp73CJXvy534SiwuQTRbNvd/s9AtBXJPgc1DSs8KCngx1tilmomoWOB0FPpyoYeHxH089mFByyP5C5niaZJCpHf3D41whVEEEYsIfuem6E1+LeIce/03XRcwyB3lv16g7IJA5ZAiK6ruq/dUngnAaZEYJL/VodpFbBz1zejAkcb90tl4l0G8bNx8U1uOPb2+32/XhmZ+pQpnnggR80Ty+DB24pmQrGLq1RbrOM9TecLjJUxZNnqd/V2VOT9btWSgDBM6IASSN4ersSQBeMPl6amX7pX6Nf8JwqHjp+8N9e33KXXFN7NXdMMjGG3mMMEB9S0UcEtdQeQ== 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=qnXNwJcBmYMxpU2vI+F/w4D2rbSa27tu39q2yXTnC0s=; b=oP+4SNEDorZWtBLkXgzZrmkPgqNzzb2T21ZW9hOY8EBIDPEoaq0Wd76VjM6v565froOHBAMoguINWLyMz8wMEFsmwcz8fY3JjdPuD8YFNRkc/kb1z1cB7RRxyPsTN6y0jBqeP0haRgL29gb2vFW8tlzsPK2eTgg7dD63SPC+Tzrq4DBBEBhbtwrfoBey1a/h8mkPacP/84kO0BTnUwYlTE9PyxwEH6aL8Ukgr2M13MqJdKowoxY5L8Xa7u0vtT5M7b4VgDURgRSbMeojsbdjxD3J7RZsh775txhkZkFIQic8s8GeGMxz3zStnl7U+UZ0cnlJgwxv7/lLRP5Evh7G6g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=starfivetech.com; dmarc=pass action=none header.from=starfivetech.com; dkim=pass header.d=starfivetech.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=starfivetech.com; Received: from BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:f::16) by BJSPR01MB0626.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:10::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.33; Wed, 10 Jan 2024 13:32:12 +0000 Received: from BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn ([fe80::3862:65b4:c857:c4a6]) by BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn ([fe80::3862:65b4:c857:c4a6%4]) with mapi id 15.20.7135.033; Wed, 10 Jan 2024 13:32:12 +0000 From: Sia Jee Heng To: kernel@esmil.dk, conor@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, mturquette@baylibre.com, sboyd@kernel.org, p.zabel@pengutronix.de, emil.renner.berthing@canonical.com, hal.feng@starfivetech.com, xingyu.wu@starfivetech.com Cc: linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, jeeheng.sia@starfivetech.com, leyfoon.tan@starfivetech.com Subject: [RFC v3 08/16] clk: starfive: Add JH8100 North-West clock generator driver Date: Wed, 10 Jan 2024 21:31:20 +0800 Message-Id: <20240110133128.286657-9-jeeheng.sia@starfivetech.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240110133128.286657-1-jeeheng.sia@starfivetech.com> References: <20240110133128.286657-1-jeeheng.sia@starfivetech.com> X-ClientProxiedBy: BJXPR01CA0067.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:12::34) To BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:f::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BJSPR01MB0561:EE_|BJSPR01MB0626:EE_ X-MS-Office365-Filtering-Correlation-Id: aed82801-5393-4652-9daa-08dc11e08d48 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jlz4cYJXwIBE1eEd9vV1xgBEkIksbQRbyLWFtXECbBUe3bzmfhIeKFYAHNaoGgcWPzGhI0rLL4tnkrLLBFrvd5FaplKNs00xP6QI7u66uG6AJqH6gqzX1eYkFPUuwKFyiBnb4ybUGqa+TkHaI0vsCf5nKMiPEiTmb2C111MjSj+ia9y+S/w3J5LwdD6P1c+fm/UhLTSBLbCGYp1vvKOSRFMVtSeHWyRZNUa8QeqNb/uaeWjMvmhWkLvbKgd3vtdeLZv/ElZL35g2nLBab7Kqw5txGe8Kh/9Ppox9JHP7tbUSbhziImWNey0KwgHyp+iPNRRMNqYyqkV4iOKE0hz8mc+yycqk/aZ389nIg5WVopWXn+y4EOkrhwWLvekll7OugE18GZRjRuYmHBWAqdehYbx+212dE2yxJaGFz4ASl+CoutIWCzc8V5X0uJvFCEsgNxzvUC+pzAGBwTyVWQ1yz+XXhEe61LGCo+9ubd0npwKhPInl8anxwHWVaou/GFGEwN2CE1aC04hHDy5VWTmdXfSzHpt/OPHtHerV5nqIvI4beciI5kSoZPNeYKTzK43vAAhxz3yZp34hIfo2LzC3qHcvT9IoOVwIIJBGQWa0+N3HgRM4IkbSVmqybRJc8FC+ X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn;PTR:;CAT:NONE;SFS:(13230031)(39830400003)(136003)(346002)(396003)(366004)(230273577357003)(230922051799003)(230173577357003)(186009)(64100799003)(451199024)(1800799012)(921011)(26005)(107886003)(52116002)(2616005)(41320700001)(6666004)(83380400001)(1076003)(86362001)(40160700002)(40180700001)(38100700002)(36756003)(38350700005)(5660300002)(30864003)(7416002)(4326008)(55236004)(6636002)(66556008)(66476007)(66946007)(41300700001)(2906002)(8936002)(8676002)(508600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: oxKUvg0NIZzGBzqruTqgGIo5rDAzCUmrtEZLNHFUCOkOp9tCwzOoCcYIY/7U8FeJgNrg1M0Kir53g7GpIxZTrlZ0tBJeoKxJOp/r0F4eTU+p7WpWxnJr4+tflgj9fhOuwSMMBqSWEC1gN8OGYZ0NKnqtNRzO0YT8bE4E72NiIJG0KTFmZf3f4KF9808l9A6+6hKKNLSVeDtwuFnE7/OufiI06UWwttkwyl+1IESnAMPtyDh2zzvV9ad8uEnxnJkCOoxao+skqRnWKFiWRxJJ4Yv6DKKGQX3juHTxlIW9xnxEkCp6rYOSNfW8IbwMlxyQLW0FnlS5CcxBJHtKSRHY9AVDt1h2Ds/wr6y0sd+BRwpCxTo2VcKvwfff2TnSQqRUqHPvC3s8Os+toOIbobzNyTcoWm+/PDQFw/gETzCfM9YSl6a65A+GtlQ7AEh8qOAmv0S5gBJUdm7uZUyOGaPRCWS7sBISEbXtifNzb8FKyLKmAtUQErw02SIDzILzatU2CnWPwe+jmEafcX/uyeoS5Pxt4eNnzEr/D72fzkAakVRvEd69rF6k6OjWXnRitIZxQh8UJhoBZLS+mwuznOFsMIm/Fc9MAMn6FDY/dc31PrJYvLCQ/obGA8Z8SUGQo1EJRnrLA3kPGnPeFu6hADSl0W5bEKQd3RXlrWBFIHMBrc+3QZE5O+zTgMWYjuUA2cpYx9tOyO8La6JZbGT15fA6DN9oORJHvsU+zurgVIsXg1KGMLSIqPuGlDjp7jlan0bSIaH8JGHtLNAUPbv3rZEHYF9iHMzYOh1FzSmZm85b6f7qaMDSz30vliTDaB7C4VniVcKxUImEh9Hw1MTGsah8m6quysPyENTkd5YvSDzsWaGxYct/vSkt2e52kd9tCIoIsY1LW9JTFPPfvCv8uJkIFrT84nyY+zVCMJBp2AnHibjv3qFivAJmSLkNpzav0++CMQlxCNXZ+dNEXUcdqNwKrEp9fO7BCkAbRswkLcLFleRnJRF+GhYoA1cDQ5O32TjURxtScVe//52+7EGwjCm+kOTA9kqOA5k64/dez1qPyenr99YkYWWk/49MJxLSFx9jjgsXt976KkImsa6jA863IQWEsLYBPu/jMFpwEMbKKoBtZZo9FgLFNCvcCKMrYsbduVC8k/hxk5bYcJv9fionbUkufDjpXVQF0tYU+1IeMawkymQ9zKZoKayI2bUnuEKsgydUVWtUYMc6IRgtXM3UghZ2gm8AeMKUoMic3ZAiptxH5B7Wj67NkarGa6DdcwVbyQrNyR+uHtF68XggTBd74NtI0XbN6k1ftnZT4JTI1XPo/mfkBMJsXwqEqWELMCK9rg2CWlXkMFZM5hVzpMHK4XySlZRCkqCocRv7Ropk/VEVgOgqHci9/SGgpQgY1E7yc9PBdho/rocb743N5OAqQVLt1PZxu0PWNo2Vo5b4YOc/PwvD5cO5V6A6VU6Tgan0AnrfBS04oAFVvEupU6eRgOVc06rCtyjS6yaIrlYYIY+GfVbRKlR9GcHtfCVhXA+COzUK8Sm47fYPBR1dnGs15xhzL+GYq6nqQDGEl5y1QzYhDmlVSMh3I66z/VQsMKoi/px+WUz+wd9FwOcVevVGLkPHwqe7PpMxrR741f42X38= X-OriginatorOrg: starfivetech.com X-MS-Exchange-CrossTenant-Network-Message-Id: aed82801-5393-4652-9daa-08dc11e08d48 X-MS-Exchange-CrossTenant-AuthSource: BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jan 2024 13:32:12.3020 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 06fe3fa3-1221-43d3-861b-5a4ee687a85c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: yEUWv1jhqe9/DCfUEki90Fxf6n9qylxkB7k+FeYoicT0OXioG7RgkHllmtNvpCILXizbX8r3uHM9mn/IFx7woaGlkdutHDH3qaur/Kd8uG0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BJSPR01MB0626 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240110_053215_597106_A2424221 X-CRM114-Status: GOOD ( 14.47 ) X-BeenThere: linux-riscv@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-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Add support for JH8100 North-West (NWCRG) clock generator. Signed-off-by: Sia Jee Heng Reviewed-by: Ley Foon Tan --- drivers/clk/starfive/Makefile | 1 + drivers/clk/starfive/clk-starfive-jh8100-nw.c | 237 ++++++++++++++++++ 3 files changed, 245 insertions(+) create mode 100644 drivers/clk/starfive/clk-starfive-jh8100-nw.c diff --git a/drivers/clk/starfive/Makefile b/drivers/clk/starfive/Makefile index af6903c4f987..2ba07d3398f0 100644 --- a/drivers/clk/starfive/Makefile +++ b/drivers/clk/starfive/Makefile @@ -12,3 +12,4 @@ obj-$(CONFIG_CLK_STARFIVE_JH7110_ISP) += clk-starfive-jh7110-isp.o obj-$(CONFIG_CLK_STARFIVE_JH7110_VOUT) += clk-starfive-jh7110-vout.o obj-$(CONFIG_CLK_STARFIVE_JH8100_SYS) += clk-starfive-jh8100-sys.o +obj-$(CONFIG_CLK_STARFIVE_JH8100_NW) += clk-starfive-jh8100-nw.o diff --git a/drivers/clk/starfive/clk-starfive-jh8100-nw.c b/drivers/clk/starfive/clk-starfive-jh8100-nw.c new file mode 100644 index 000000000000..018f5af6c777 --- /dev/null +++ b/drivers/clk/starfive/clk-starfive-jh8100-nw.c @@ -0,0 +1,237 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * StarFive JH8100 North-West Clock Driver + * + * Copyright (C) 2023 StarFive Technology Co., Ltd. + * + * Author: Jee Heng Sia + * + */ + +#include +#include +#include +#include +#include + +#include + +#include "clk-starfive-jh8100.h" + +#define JH8100_NWCLK_NUM_CLKS (JH8100_NWCLK_UART6_ICG_EN + 1) + +/* external clocks */ +#define JH8100_NWCLK_OSC (JH8100_NWCLK_NUM_CLKS + 0) +#define JH8100_NWCLK_APB_BUS (JH8100_NWCLK_NUM_CLKS + 1) +#define JH8100_NWCLK_APB_BUS_PER4 (JH8100_NWCLK_NUM_CLKS + 2) +#define JH8100_NWCLK_SPI_CORE_100 (JH8100_NWCLK_NUM_CLKS + 3) +#define JH8100_NWCLK_ISP_2X (JH8100_NWCLK_NUM_CLKS + 4) +#define JH8100_NWCLK_ISP__AXI (JH8100_NWCLK_NUM_CLKS + 5) +#define JH8100_NWCLK_VOUT_ROOT0 (JH8100_NWCLK_NUM_CLKS + 6) +#define JH8100_NWCLK_VOUT_ROOT1 (JH8100_NWCLK_NUM_CLKS + 7) +#define JH8100_NWCLK_VOUT_SCAN__ATS (JH8100_NWCLK_NUM_CLKS + 8) +#define JH8100_NWCLK_VOUT_DC__CORE (JH8100_NWCLK_NUM_CLKS + 9) +#define JH8100_NWCLK_VOUT__AXI (JH8100_NWCLK_NUM_CLKS + 10) +#define JH8100_NWCLK_AXI_400 (JH8100_NWCLK_NUM_CLKS + 11) +#define JH8100_NWCLK_DVP_EXT (JH8100_NWCLK_NUM_CLKS + 12) +#define JH8100_NWCLK_ISP_DPHY_TAP_TCK_EXT (JH8100_NWCLK_NUM_CLKS + 13) +#define JH8100_NWCLK_GLB_EXT (JH8100_NWCLK_NUM_CLKS + 14) +#define JH8100_NWCLK_VOUT_MIPI_DPHY_TAP_TCK_EXT (JH8100_NWCLK_NUM_CLKS + 15) +#define JH8100_NWCLK_VOUT_EDP_TAP_TCK_EXT (JH8100_NWCLK_NUM_CLKS + 16) +#define JH8100_NWCLK_SPI_IN2_EXT (JH8100_NWCLK_NUM_CLKS + 17) +#define JH8100_NWCLK_PERH_ROOT_PREOSC (JH8100_NWCLK_NUM_CLKS + 18) +#define JH8100_NWCLK_AHB_VOUT (JH8100_NWCLK_NUM_CLKS + 19) +#define JH8100_NWCLK_PLL5_OUT (JH8100_NWCLK_NUM_CLKS + 20) + +static const struct starfive_clk_data jh8100_nwcrg_clk_data[] = { + /* root */ + STARFIVE__DIV(JH8100_NWCLK_PLL5_DIV2, "pll5_div2", 2, JH8100_NWCLK_PLL5_OUT), + STARFIVE_GDIV(JH8100_NWCLK_GCLK5, "gclk5", CLK_IS_CRITICAL, 120, JH8100_NWCLK_PLL5_DIV2), + /* gpio */ + STARFIVE_GATE(JH8100_NWCLK_GPIO_100, "gpio_100", CLK_IS_CRITICAL, JH8100_NWCLK_PLL5_OUT), + STARFIVE_GATE(JH8100_NWCLK_GPIO_50, "gpio_50", CLK_IS_CRITICAL, JH8100_NWCLK_PLL5_OUT), + STARFIVE_GATE(JH8100_NWCLK_GPIO_150, "gpio_150", CLK_IS_CRITICAL, JH8100_NWCLK_PLL5_OUT), + STARFIVE_GDIV(JH8100_NWCLK_GPIO_60, "gpio_60", CLK_IS_CRITICAL, 30, JH8100_NWCLK_PLL5_OUT), + /* iomux */ + STARFIVE_GATE(JH8100_NWCLK_IOMUX_WEST_PCLK, "iomux_west_pclk", 0, + JH8100_NWCLK_APB_BUS_PER4), + /* i2c */ + STARFIVE_GATE(JH8100_NWCLK_I2C6_APB, "i2c6_apb", 0, JH8100_NWCLK_APB_BUS_PER4), + STARFIVE_GATE(JH8100_NWCLK_I2C7_APB, "i2c7_apb", 0, JH8100_NWCLK_APB_BUS_PER4), + /* spi */ + STARFIVE_GATE(JH8100_NWCLK_SPI2_APB, "spi2_apb", 0, JH8100_NWCLK_APB_BUS_PER4), + STARFIVE_GATE(JH8100_NWCLK_SPI2_CORE, "spi2_core", 0, JH8100_NWCLK_SPI_CORE_100), + STARFIVE__MUX(JH8100_NWCLK_SPI2_SCLK_IN, "spi2_sclk_in", 2, + JH8100_NWCLK_SPI_IN2_EXT, JH8100_NWCLK_GPIO_100), + /* smbus */ + STARFIVE_GATE(JH8100_NWCLK_SMBUS1_APB, "smbus1_apb", CLK_IGNORE_UNUSED, + JH8100_NWCLK_APB_BUS_PER4), + STARFIVE_GDIV(JH8100_NWCLK_SMBUS1_CORE, "smbus1_core", CLK_IGNORE_UNUSED, 120, + JH8100_NWCLK_PERH_ROOT_PREOSC), + /* isp */ + STARFIVE__MUX(JH8100_NWCLK_ISP_DVP, "isp_dvp", 2, JH8100_NWCLK_DVP_EXT, + JH8100_NWCLK_GPIO_150), + STARFIVE_GATE(JH8100_NWCLK_ISP_CORE_2X, "isp_core_2x", 0, JH8100_NWCLK_ISP_2X), + STARFIVE_GATE(JH8100_NWCLK_ISP_AXI, "isp_axi_nw", 0, JH8100_NWCLK_ISP__AXI), + STARFIVE__MUX(JH8100_NWCLK_ISP_DPHY_TAP_TCK, "isp_dphy_tap_tck", 2, + JH8100_NWCLK_ISP_DPHY_TAP_TCK_EXT, JH8100_NWCLK_GLB_EXT), + STARFIVE_GATE(JH8100_NWCLK_FLEXNOC_ISPSLV, "flexnoc_ispslv", 0, JH8100_NWCLK_ISP__AXI), + /* vout */ + STARFIVE_GATE(JH8100_NWCLK_VOUT_PIX0, "vout_pix0", CLK_IGNORE_UNUSED, + JH8100_NWCLK_VOUT_ROOT0), + STARFIVE_GATE(JH8100_NWCLK_VOUT_PIX1, "vout_pix1", CLK_IGNORE_UNUSED, + JH8100_NWCLK_VOUT_ROOT1), + STARFIVE_GATE(JH8100_NWCLK_VOUT_SCAN_ATS, "vout_scan_ats_nw", + CLK_IGNORE_UNUSED, JH8100_NWCLK_VOUT_SCAN__ATS), + STARFIVE_GATE(JH8100_NWCLK_VOUT_DC_CORE, "vout_dc_core_nw", + CLK_IGNORE_UNUSED, JH8100_NWCLK_VOUT_DC__CORE), + STARFIVE_GATE(JH8100_NWCLK_VOUT_APB, "vout_apb", CLK_IGNORE_UNUSED, JH8100_NWCLK_APB_BUS), + STARFIVE_GATE(JH8100_NWCLK_VOUT_DSI, "vout_dsi", CLK_IGNORE_UNUSED, JH8100_NWCLK_AXI_400), + STARFIVE_GATE(JH8100_NWCLK_VOUT_AHB, "vout_ahb", CLK_IGNORE_UNUSED, JH8100_NWCLK_AHB_VOUT), + STARFIVE_GATE(JH8100_NWCLK_VOUT_AXI, "vout_axi_nw", CLK_IGNORE_UNUSED, + JH8100_NWCLK_VOUT__AXI), + STARFIVE__MUX(JH8100_NWCLK_VOUT_MIPI_DPHY_TAP_TCK, "vout_mipi_dphy_tap_tck", 2, + JH8100_NWCLK_VOUT_MIPI_DPHY_TAP_TCK_EXT, JH8100_NWCLK_GLB_EXT), + STARFIVE__MUX(JH8100_NWCLK_VOUT_EDP_PHY_TAP_TCK, "vout_edp_phy_tap_tck", 2, + JH8100_NWCLK_VOUT_EDP_TAP_TCK_EXT, JH8100_NWCLK_GLB_EXT), + /* uart */ + STARFIVE__DIV(JH8100_NWCLK_UART5_CORE_PREOSC, "uart5_core_preosc", 131071, + JH8100_NWCLK_PERH_ROOT_PREOSC), + STARFIVE_GATE(JH8100_NWCLK_UART5_APB, "uart5_apb", 0, JH8100_NWCLK_APB_BUS_PER4), + STARFIVE_GMUX(JH8100_NWCLK_UART5_CORE, "uart5_core", 0, 2, + JH8100_NWCLK_OSC, JH8100_NWCLK_UART5_CORE_PREOSC), + STARFIVE__DIV(JH8100_NWCLK_UART6_CORE_PREOSC, "uart6_core_preosc", 131071, + JH8100_NWCLK_PERH_ROOT_PREOSC), + STARFIVE_GATE(JH8100_NWCLK_UART6_APB, "uart6_apb", 0, JH8100_NWCLK_APB_BUS_PER4), + STARFIVE_GMUX(JH8100_NWCLK_UART6_CORE, "uart6_core", 0, 2, + JH8100_NWCLK_OSC, JH8100_NWCLK_UART6_CORE_PREOSC), + /* icg_en */ + STARFIVE_GATE(JH8100_NWCLK_SPI2_ICG_EN, "spi2_en", 0, JH8100_NWCLK_APB_BUS_PER4), + STARFIVE_GATE(JH8100_NWCLK_SMBUS1_ICG_EN, "smbus1_en", 0, JH8100_NWCLK_APB_BUS_PER4), + STARFIVE_GATE(JH8100_NWCLK_ISP_ICG_EN, "isp_en", 0, JH8100_NWCLK_ISP__AXI), + STARFIVE_GATE(JH8100_NWCLK_VOUT_ICG_EN, "vout_en", 0, JH8100_NWCLK_VOUT_ROOT0), + STARFIVE_GATE(JH8100_NWCLK_UART5_ICG_EN, "uart5_en", 0, JH8100_NWCLK_APB_BUS_PER4), + STARFIVE_GATE(JH8100_NWCLK_UART6_ICG_EN, "uart6_en", 0, JH8100_NWCLK_APB_BUS_PER4), +}; + +static struct clk_hw *jh8100_nwcrg_clk_get(struct of_phandle_args *clkspec, void *data) +{ + struct starfive_clk_priv *priv = data; + unsigned int idx = clkspec->args[0]; + + if (idx < JH8100_NWCLK_NUM_CLKS) + return &priv->reg[idx].hw; + + return ERR_PTR(-EINVAL); +} + +static int jh8100_nwcrg_probe(struct platform_device *pdev) +{ + struct starfive_clk_priv *priv; + unsigned int idx; + int ret; + + priv = devm_kzalloc(&pdev->dev, + struct_size(priv, reg, JH8100_NWCLK_NUM_CLKS), + GFP_KERNEL); + if (!priv) + return -ENOMEM; + + spin_lock_init(&priv->rmw_lock); + priv->dev = &pdev->dev; + priv->base = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(priv->base)) + return PTR_ERR(priv->base); + + for (idx = 0; idx < JH8100_NWCLK_NUM_CLKS; idx++) { + u32 max = jh8100_nwcrg_clk_data[idx].max; + struct clk_parent_data parents[4] = {}; + struct clk_init_data init = { + .name = jh8100_nwcrg_clk_data[idx].name, + .ops = starfive_clk_ops(max), + .parent_data = parents, + .num_parents = + ((max & STARFIVE_CLK_MUX_MASK) >> STARFIVE_CLK_MUX_SHIFT) + 1, + .flags = jh8100_nwcrg_clk_data[idx].flags, + }; + struct starfive_clk *clk = &priv->reg[idx]; + unsigned int i; + + for (i = 0; i < init.num_parents; i++) { + unsigned int pidx = jh8100_nwcrg_clk_data[idx].parents[i]; + + if (pidx < JH8100_NWCLK_NUM_CLKS) + parents[i].hw = &priv->reg[pidx].hw; + else if (pidx == JH8100_NWCLK_OSC) + parents[i].fw_name = "osc"; + else if (pidx == JH8100_NWCLK_APB_BUS) + parents[i].fw_name = "apb_bus"; + else if (pidx == JH8100_NWCLK_APB_BUS_PER4) + parents[i].fw_name = "apb_bus_per4"; + else if (pidx == JH8100_NWCLK_SPI_CORE_100) + parents[i].fw_name = "spi_core_100"; + else if (pidx == JH8100_NWCLK_ISP_2X) + parents[i].fw_name = "isp_2x"; + else if (pidx == JH8100_NWCLK_ISP__AXI) + parents[i].fw_name = "isp_axi"; + else if (pidx == JH8100_NWCLK_VOUT_ROOT0) + parents[i].fw_name = "vout_root0"; + else if (pidx == JH8100_NWCLK_VOUT_ROOT1) + parents[i].fw_name = "vout_root1"; + else if (pidx == JH8100_NWCLK_VOUT_SCAN__ATS) + parents[i].fw_name = "vout_scan_ats"; + else if (pidx == JH8100_NWCLK_VOUT_DC__CORE) + parents[i].fw_name = "vout_dc_core"; + else if (pidx == JH8100_NWCLK_VOUT__AXI) + parents[i].fw_name = "vout_axi"; + else if (pidx == JH8100_NWCLK_AXI_400) + parents[i].fw_name = "axi_400"; + else if (pidx == JH8100_NWCLK_DVP_EXT) + parents[i].fw_name = "dvp-ext"; + else if (pidx == JH8100_NWCLK_ISP_DPHY_TAP_TCK_EXT) + parents[i].fw_name = "isp-dphy-tap-tck-ext"; + else if (pidx == JH8100_NWCLK_GLB_EXT) + parents[i].fw_name = "glb-ext-clk"; + else if (pidx == JH8100_NWCLK_VOUT_MIPI_DPHY_TAP_TCK_EXT) + parents[i].fw_name = "vout-mipi-dphy-tap-tck-ext"; + else if (pidx == JH8100_NWCLK_VOUT_EDP_TAP_TCK_EXT) + parents[i].fw_name = "vout-edp-tap-tck-ext"; + else if (pidx == JH8100_NWCLK_SPI_IN2_EXT) + parents[i].fw_name = "spi-in2-ext"; + else if (pidx == JH8100_NWCLK_PERH_ROOT_PREOSC) + parents[i].fw_name = "perh_root_preosc"; + else if (pidx == JH8100_NWCLK_AHB_VOUT) + parents[i].fw_name = "ahb0"; + else + parents[i].fw_name = "pll5"; + } + + clk->hw.init = &init; + clk->idx = idx; + clk->max_div = max & STARFIVE_CLK_DIV_MASK; + + ret = devm_clk_hw_register(&pdev->dev, &clk->hw); + if (ret) + return ret; + } + + ret = devm_of_clk_add_hw_provider(&pdev->dev, jh8100_nwcrg_clk_get, priv); + if (ret) + return ret; + + return jh8100_reset_controller_register(priv, "rst-nw", 1); +} + +static const struct of_device_id jh8100_nwcrg_match[] = { + { .compatible = "starfive,jh8100-nwcrg" }, + { /* sentinel */ } +}; + +static struct platform_driver jh8100_nwcrg_driver = { + .driver = { + .name = "clk-starfive-jh8100-nw", + .of_match_table = jh8100_nwcrg_match, + .suppress_bind_attrs = true, + }, +}; +builtin_platform_driver_probe(jh8100_nwcrg_driver, jh8100_nwcrg_probe); From patchwork Wed Jan 10 13:31:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sia Jee Heng X-Patchwork-Id: 13516160 X-Patchwork-Delegate: mail@conchuod.ie 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 6644CC4707B for ; Wed, 10 Jan 2024 13:32:37 +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=aYMv1cZMQQwENcYTEAea0JncWxUvL3fWaFzxBMZBcLI=; b=2plW0lB3JpQPv/ m2gu0LLwCULTONIfqoZCrlgyP32pxycPE6id2JHKdkLXkkKzcAGUIB0YN3KqfAyeRZBFoaEbA1CL8 WcD45olRk0bWyGloLNeoA2Uzpl7tDBm75oYL100TIs4KB/LAPY1FTWJj0VVq0+lcd/gzirsRuE/q1 4PMx3CkyJU8zs949iwLSW3KiXjO6i+jAyExeoSJMdCEdQM3nK4vL9ArBy87ufe5DoA17aVLdE7wmW gDNoRZJHhLGwRmRRCI8DeZm0GWdHGuDy6fpKicgiwT+ZgR4heuFdpW/oOniEVleBmqlu2zwf6aMXE 0Nqp5vY1k+KVwBXYRRkg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rNYgy-00Bz6Z-0B; Wed, 10 Jan 2024 13:32:24 +0000 Received: from mail-sh0chn02on20614.outbound.protection.partner.outlook.cn ([2406:e500:4420:2::614] helo=CHN02-SH0-obe.outbound.protection.partner.outlook.cn) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rNYgs-00BywR-05 for linux-riscv@lists.infradead.org; Wed, 10 Jan 2024 13:32:21 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WW02hHSqnk0yBRcLfEvQBuyTyiwiWggH50WwQU3ibWMhxJykrRr1WZrigCCsP0hOWXuGDa6QjoC5UxBs82pQ76sqsfbFcZlec0sFIsQCKZXFnlKMgmGZDdVQV6R45bUZjNGOKo3O6uQ1GM017FNcJ+E9B1gkIBvNKUJm9MnBD0bW2rKrWhRY/lgd21Loza250njE9H4A7+M/twuXNrzKt8GjF7zhXrYCu6lqEBgtWEMwVrVZHxaed6kLXLfprQXDWGMJjZQmj8I9RFzBy8FUa47L/HU9pcoiJEbnDpSI1VOaW1ccLUxp//uNF98pcUHVnGv5s85KNoEY1sYvCq74IA== 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=Eri7qDQ5Xr4knoEOeX0QzfbwHPtJCgnsbkXb2xcfC2Y=; b=Uowht90lOy+9AD9+p5bpQxtFyIiJ40puWnkDPHDw9ywpXwiE5xNuWGk8p4yngDxO2VoJjK55JX6L8yopLiCbVnASMXzHKJLpa/q3O8KNnDYUUAlskhFPTirFJwscJO9dO7kLXnB/wt8fV2z/lSoYHjFk65fUmZ1QnTiVqXZtLnRmA+P1yh1Ci+Veoh247+yK99r58dMTwMlW8lw3GbccCZ5YCN5zZfqTw9XP0GtAwvvM7MofhxtAa1Iy3TfbZ/A5ivPiH7k4AzcliliuWF4g9/Rox3/JHUUfS4FpFGqiRCEK9sMTBOa/zws2YH1v+PaI8zGrM/jiNRkZFAtZJgshXQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=starfivetech.com; dmarc=pass action=none header.from=starfivetech.com; dkim=pass header.d=starfivetech.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=starfivetech.com; Received: from BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:f::16) by BJSPR01MB0626.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:10::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.33; Wed, 10 Jan 2024 13:32:16 +0000 Received: from BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn ([fe80::3862:65b4:c857:c4a6]) by BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn ([fe80::3862:65b4:c857:c4a6%4]) with mapi id 15.20.7135.033; Wed, 10 Jan 2024 13:32:16 +0000 From: Sia Jee Heng To: kernel@esmil.dk, conor@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, mturquette@baylibre.com, sboyd@kernel.org, p.zabel@pengutronix.de, emil.renner.berthing@canonical.com, hal.feng@starfivetech.com, xingyu.wu@starfivetech.com Cc: linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, jeeheng.sia@starfivetech.com, leyfoon.tan@starfivetech.com, Krzysztof Kozlowski Subject: [RFC v3 09/16] dt-bindings: clock: Add StarFive JH8100 North-East clock and reset generator Date: Wed, 10 Jan 2024 21:31:21 +0800 Message-Id: <20240110133128.286657-10-jeeheng.sia@starfivetech.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240110133128.286657-1-jeeheng.sia@starfivetech.com> References: <20240110133128.286657-1-jeeheng.sia@starfivetech.com> X-ClientProxiedBy: BJXPR01CA0067.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:12::34) To BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:f::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BJSPR01MB0561:EE_|BJSPR01MB0626:EE_ X-MS-Office365-Filtering-Correlation-Id: 7706d732-1d8b-47ee-3bad-08dc11e08f9a X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RYpK0pclWH5ozU3Ek35UXnFtG4DbNp8jbM+aT+WiPt7z3YnkSLCJv2nnT+ArU5Nx6ZqtzI/gH2+q74lZrBt9rQtJBxwrliajH2iXEtHAdiPNuQT9UXteby80wEr20Qm2ED6U0cea6m5KFDEp585iCDu7LurorGVj5AjkCueknEQFuEEoCbZAIDKiFA+i1ZDUC1ylnkTfAkGhBDPX3Ojgb96daIlOyr+PotFc59JPkROpHahqzm27RFw0dYPiDuCx438TdYXDhOqXcwwPc/Q5wXvyTNOvQPtXw9xInyab57QqOKA7zoFJApbFj+W0+P+RECc0oeieG3wma4MHVCzAu3m6XVZTz6G8ynWC5XbmtQuQ3bO/t2dFJSEk0o1rOVlRmee2Jhb0Zb0BZ5VR1Bn/crWl691f8ns5UAfedUpSGXTRNZxxbEw9M195Hah5z2nyfLHo8F4247gEPi8kpWhliZVw/gjsUyHRnCET/RnirSyJHGuSkDrWYzsI+UqM5W27pcRUOh8PtOFnlVzQAmX9etGp2SvgRkooqGjMtDB25LFdXRzN1UrZtLWbPxlSSBHD5fJ1rslQNjrkB/YkHxAGv36XqB2k9dWFxNiHMzXTkyNBgFe9h633v+ZD1MWSJ2cb X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn;PTR:;CAT:NONE;SFS:(13230031)(39830400003)(136003)(346002)(396003)(366004)(230273577357003)(230922051799003)(230173577357003)(186009)(64100799003)(451199024)(1800799012)(921011)(26005)(52116002)(2616005)(41320700001)(6666004)(83380400001)(1076003)(86362001)(40160700002)(40180700001)(38100700002)(36756003)(38350700005)(5660300002)(30864003)(7416002)(4326008)(55236004)(6636002)(66556008)(66476007)(66946007)(41300700001)(2906002)(8936002)(8676002)(966005)(508600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: OwoHGJF6T7iu3vrYteWmO2rATczbrv2oZMfNlD/nXEiqYMq00wURBs89SD/DYiY406gMLI/eNxSRyfgLfw3FiRMDDq+FRFbl0qyqq8uCw/qCTg0PZ/X/IyR2b/boLmWWURuCs88vfC5tuOUpg0kwadAsmNLPGpUHS+IzBZK/ljuodSzaEtMytPsF2p1V3wi10QMJcgkPb8V9zAy3a7iIt/KvyR/I7MRiv0gcaRyYATE+Aaf7dZ2AfC0pzkKIE0Neml/Zc5GcUqoBxEbY6c3j7waeUKfmWxT75fwVzyGEDB/b7d836D3K3FS4urePYa6BVvD2UyP/VRp5w0EhLIKdO+OmIymLFEjhYwylE+2laHudNpQOoiEr9hPeIVbX+wz5cujO+7vakx/xajryYXWGp/XWTDJnRLlSKkURgsi6npRoBlYQOtf5QPm57aeKHH+jwulSJzo/O8v3QwfeoFbDbja1nMgmSfI2qmbbp818KsxwzGrrC+/I+B5uW5YiwSk8WsyMmIvLkrL34/2bCzzp/dOiKXxeBHN9D+3oNijjiaAPu9sfW/73COb/oJpPyaKRD5B4RMpV86Nw0zVFxJsm6BzWkeL4dJ1yczRmcmc3UTWhZv+zlMTrNfX8o6YdXOjwL5By1TOsBRqqVIGZ4qUycf3WlOvFWSiCCCs/A/ishipXLc5dZ3151YypiL/9U24130/FNpa8vUVMTNkuwJAa73HZOABEM+JFvj9iMOuVvRhBHjRocbwzgguN9aP4ZesHBU42aM3USc3riB1NjZBD/9jimrLu6dHtf6Ji8F25MbeYDSAFhuePgmte9ZzERDLyl3QT/4MAx4CnIZ4hY8TvdejujvCehVgIVU6LRTeUSyvDTEz0M9vw6tr4zZrb156E5mDMj2CNVgBIiPIMEts4MTh63UE/2wfecg+nDOBDobpqvXKpiQVjVei7ytpDAWdq6TvARdPzGAaOgGKdgvEjSxKeiWjk8YzXTace4Ildcqw6HuNLNHvjiAE57WxrDa77qOWdhXSWHgBAhk1v+7k/ARYlk3Ozusvwp56PDLMcxex+7lWNmKsCjOdxYmrzAF/Jf009A6YlO3RJdymOhwtBeFilNvuMYCuamSbbZid8cmZeTJpBkIrxESz+6ipHqYoZNhPkIiZ1s9664NQQAWzExDfUUNm0HnNo6pzomrPA54erEUN3yfRzbJD+p353J8qZHhLGanjMFJ43N+a9ukFcDm8wg6HSrt5vPKepdegTg4Eckt4WCae3cMAwmPQc90PitAUJAB6qMvBxIBY8uwlsY4VSanOOCjBmUqcVv5Mxa87Iy/A2N1DIXkBsQLv25uxhT8RgGp7baoc+C2IISrlUV7oiyr/yGpLza2SSWMup3BUhjNVheDiZP0pp0sV0o8rnvYmk9Vdcg5M4cvNtd+EfbqwL254iS1hwRUXHaUrJxiZvUXA8fWTb0/YYvHi6lsy+lNMkDoDPWWxaDQkfdeGfb1oUzFepqN7Iy1wMMIWbc6KqS3WbKPbZ8zIr5P/RGMg/7nafNp7yTlwdkZe+FHO72cvTSmyUxGhlxx40SXeBtQQkSeKArBeVkpVbdy5TQUKPBmZZdJWUADMUxfW6qmVlmULYcXBd6dPDoF3rtpew6CI= X-OriginatorOrg: starfivetech.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7706d732-1d8b-47ee-3bad-08dc11e08f9a X-MS-Exchange-CrossTenant-AuthSource: BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jan 2024 13:32:16.1295 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 06fe3fa3-1221-43d3-861b-5a4ee687a85c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: +RvZMnKGlbAKrgEjR/L1g6ApHZ078PFNzaUgbsV8WO8nPB1JTxAUkyYtMUkjjrAKRDMytFBT/SPEtKebTFkfJ55nEKxwrT+S6vfO+0nHFsc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BJSPR01MB0626 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240110_053218_092399_8904BF11 X-CRM114-Status: GOOD ( 11.74 ) X-BeenThere: linux-riscv@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-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Add bindings for the North-East clock and reset generator (NECRG) on JH8100 SoC. Signed-off-by: Sia Jee Heng Reviewed-by: Ley Foon Tan Reviewed-by: Krzysztof Kozlowski --- .../bindings/clock/starfive,jh8100-necrg.yaml | 153 +++++++++++++++ .../dt-bindings/clock/starfive,jh8100-crg.h | 177 ++++++++++++++++++ .../dt-bindings/reset/starfive,jh8100-crg.h | 59 ++++++ 3 files changed, 389 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/starfive,jh8100-necrg.yaml diff --git a/Documentation/devicetree/bindings/clock/starfive,jh8100-necrg.yaml b/Documentation/devicetree/bindings/clock/starfive,jh8100-necrg.yaml new file mode 100644 index 000000000000..f747b85fa457 --- /dev/null +++ b/Documentation/devicetree/bindings/clock/starfive,jh8100-necrg.yaml @@ -0,0 +1,153 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/clock/starfive,jh8100-necrg.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: StarFive JH8100 North-East Clock and Reset Generator + +maintainers: + - Sia Jee Heng + +properties: + compatible: + const: starfive,jh8100-necrg + + reg: + maxItems: 1 + + clocks: + items: + - description: Main Oscillator (24 MHz) + - description: AXI_400 clock from SYSCRG + - description: VOUT_ROOT0 clock from SYSCRG + - description: VOUT_ROOT1 clock from SYSCRG + - description: USB_WRAP_480 clock from SYSCRG + - description: USB_WRAP_625 clock from SYSCRG + - description: USB_WRAP_240 clock from SYSCRG + - description: USB_WRAP_60 clock from SYSCRG + - description: USB_WRAP_156P25 clock from SYSCRG + - description: USB_WRAP_312P5 clock from SYSCRG + - description: USB_125M clock from SYSCRG + - description: GPIO_100 clock from NWCRG + - description: PERH_ROOT clock from SYSCRG + - description: Master clock from SYSCRG + - description: PERH_ROOT_PREOSC clock from SYSCRG + - description: AHB0 clock from SYSCRG + - description: APB_BUS_PER1 clock from SYSCRG + - description: APB_BUS PER2 clock from SYSCRG + - description: APB_BUS_PER3 clock from SYSCRG + - description: APB_BUS_PER5 clock from SYSCRG + - description: VENC_ROOT clock from SYSCRG + - description: SPI_CORE_100 clock from SYSCRG + - description: External global clock + - description: External USB3_TAP_TCK clock + - description: External USB1_TAP_TCK clock + - description: External USB2_TAP_TCK clock + - description: External TYPEC_TAP_TCK clock + - description: External SPI_IN0 clock + - description: External SPI_IN1 clock + - description: External I2STX_BCLK clock + - description: External I2STX_LRCK clock + + clock-names: + items: + - const: osc + - const: axi_400 + - const: vout_root0 + - const: vout_root1 + - const: usb_wrap_480 + - const: usb_wrap_625 + - const: usb_wrap_240 + - const: usb_wrap_60 + - const: usb_wrap_156p25 + - const: usb_wrap_312p5 + - const: usb_125m + - const: gpio_100 + - const: perh_root + - const: mclk + - const: perh_root_preosc + - const: ahb0 + - const: apb_bus_per1 + - const: apb_bus_per2 + - const: apb_bus_per3 + - const: apb_bus_per5 + - const: venc_root + - const: spi_core_100 + - const: glb-ext-clk + - const: usb3-tap-tck-ext + - const: usb1-tap-tck-ext + - const: usb2-tap-tck-ext + - const: typec-tap-tck-ext + - const: spi-in0-ext + - const: spi-in1-ext + - const: i2stx-bclk-ext + - const: i2stx-lrck-ext + + '#clock-cells': + const: 1 + description: + See for valid indices. + + '#reset-cells': + const: 1 + description: + See for valid indices. + +required: + - compatible + - reg + - clocks + - clock-names + - '#clock-cells' + - '#reset-cells' + +additionalProperties: false + +examples: + - | + #include + + clock-controller@12320000 { + compatible = "starfive,jh8100-necrg"; + reg = <0x12320000 0x10000>; + clocks = <&osc>, <&syscrg JH8100_SYSCLK_AXI_400>, + <&syscrg JH8100_SYSCLK_VOUT_ROOT0>, + <&syscrg JH8100_SYSCLK_VOUT_ROOT1>, + <&syscrg JH8100_SYSCLK_USB_WRAP_480>, + <&syscrg JH8100_SYSCLK_USB_WRAP_625>, + <&syscrg JH8100_SYSCLK_USB_WRAP_240>, + <&syscrg JH8100_SYSCLK_USB_WRAP_60>, + <&syscrg JH8100_SYSCLK_USB_WRAP_156P25>, + <&syscrg JH8100_SYSCLK_USB_WRAP_312P5>, + <&syscrg JH8100_SYSCLK_USB_125M>, + <&nwcrg JH8100_NWCLK_GPIO_100>, + <&syscrg JH8100_SYSCLK_PERH_ROOT>, + <&syscrg JH8100_SYSCLK_MCLK>, + <&syscrg JH8100_SYSCLK_PERH_ROOT_PREOSC>, + <&syscrg JH8100_SYSCLK_AHB0>, + <&syscrg JH8100_SYSCLK_APB_BUS_PER1>, + <&syscrg JH8100_SYSCLK_APB_BUS_PER2>, + <&syscrg JH8100_SYSCLK_APB_BUS_PER3>, + <&syscrg JH8100_SYSCLK_APB_BUS_PER5>, + <&syscrg JH8100_SYSCLK_VENC_ROOT>, + <&syscrg JH8100_SYSCLK_SPI_CORE_100>, + <&glb_ext_clk>, <&usb3_tap_tck_ext>, + <&usb1_tap_tck_ext>, <&usb2_tap_tck_ext>, + <&typec_tap_tck_ext>, <&spi_in0_ext>, + <&spi_in1_ext>, <&i2stx_bclk_ext>, + <&i2stx_lrck_ext>; + clock-names = "osc", "axi_400", "vout_root0", "vout_root1", + "usb_wrap_480", "usb_wrap_625", "usb_wrap_240", + "usb_wrap_60", "usb_wrap_156p25", "usb_wrap_312p5", + "usb_125m", "gpio_100", "perh_root", "mclk", + "perh_root_preosc", "ahb0", "apb_bus_per1", + "apb_bus_per2", "apb_bus_per3", "apb_bus_per5", + "venc_root", "spi_core_100", "glb-ext-clk", + "usb3-tap-tck-ext", "usb1-tap-tck-ext", + "usb2-tap-tck-ext", "typec-tap-tck-ext", + "spi-in0-ext", "spi-in1-ext", "i2stx-bclk-ext", + "i2stx-lrck-ext"; + #clock-cells = <1>; + #reset-cells = <1>; + }; diff --git a/include/dt-bindings/clock/starfive,jh8100-crg.h b/include/dt-bindings/clock/starfive,jh8100-crg.h index 626173e14940..c37b42f3eacd 100644 --- a/include/dt-bindings/clock/starfive,jh8100-crg.h +++ b/include/dt-bindings/clock/starfive,jh8100-crg.h @@ -162,4 +162,181 @@ #define JH8100_NWCLK_UART5_ICG_EN 39 #define JH8100_NWCLK_UART6_ICG_EN 40 +/* NECRG clocks */ +#define JH8100_NECLK_FLEXNOC_DMASLV 0 +#define JH8100_NECLK_MAILBOX_APB 1 +#define JH8100_NECLK_SR5_TIMER0_APB 2 +#define JH8100_NECLK_SR5_TIMER0_CH0 3 +#define JH8100_NECLK_SR5_TIMER0_CH1 4 +#define JH8100_NECLK_SR5_TIMER0_CH2 5 +#define JH8100_NECLK_SR5_TIMER0_CH3 6 +#define JH8100_NECLK_SR5_TIMER1_APB 7 +#define JH8100_NECLK_SR5_TIMER1_CH0 8 +#define JH8100_NECLK_SR5_TIMER1_CH1 9 +#define JH8100_NECLK_SR5_TIMER1_CH2 10 +#define JH8100_NECLK_SR5_TIMER1_CH3 11 +#define JH8100_NECLK_USB3_CMN_SCAN_PLL 12 +#define JH8100_NECLK_USB3_CMN_SCAN_SER 13 +#define JH8100_NECLK_USB3_PIPE_IN_SCAN 14 +#define JH8100_NECLK_USB3_SCAN_PIPE 15 +#define JH8100_NECLK_USB3_SCAN_PSM 16 +#define JH8100_NECLK_USB3_SCAN_REF 17 +#define JH8100_NECLK_USB3_USB2_SCAN 18 +#define JH8100_NECLK_USB3_HSCLK 19 +#define JH8100_NECLK_USB3_HSSICLK 20 +#define JH8100_NECLK_USB3_SIECLK 21 +#define JH8100_NECLK_USB3_XCVR_SCAN_PLL 22 +#define JH8100_NECLK_USB3_XCVR_SCAN_SER 23 +#define JH8100_NECLK_USB3_TAP_TCK 24 +#define JH8100_NECLK_USB1_CMN_SCAN_PLL 25 +#define JH8100_NECLK_USB1_CMN_SCAN_SER 26 +#define JH8100_NECLK_USB1_PIPE_IN_SCAN 27 +#define JH8100_NECLK_USB1_SCAN_PIPE 28 +#define JH8100_NECLK_USB1_SCAN_PSM 29 +#define JH8100_NECLK_USB1_SCAN_REF 30 +#define JH8100_NECLK_USB1_USB2_SCAN 31 +#define JH8100_NECLK_USB1_HSCLK 32 +#define JH8100_NECLK_USB1_HSSICLK 33 +#define JH8100_NECLK_USB1_SIECLK 34 +#define JH8100_NECLK_USB1_XCVR_SCAN_PLL 35 +#define JH8100_NECLK_USB1_XCVR_SCAN_SER 36 +#define JH8100_NECLK_USB1_TAP_TCK 37 +#define JH8100_NECLK_USB2_CMN_SCAN_PLL 38 +#define JH8100_NECLK_USB2_CMN_SCAN_SER 39 +#define JH8100_NECLK_USB2_PIPE_IN_SCAN 40 +#define JH8100_NECLK_USB2_SCAN_PIPE 41 +#define JH8100_NECLK_USB2_SCAN_PSM 42 +#define JH8100_NECLK_USB2_SCAN_REF 43 +#define JH8100_NECLK_USB2_USB2_SCAN 44 +#define JH8100_NECLK_USB2_HSCLK 45 +#define JH8100_NECLK_USB2_HSSICLK 46 +#define JH8100_NECLK_USB2_SIECLK 47 +#define JH8100_NECLK_USB2_XCVR_SCAN_PLL 48 +#define JH8100_NECLK_USB2_XCVR_SCAN_SER 49 +#define JH8100_NECLK_USB2_TAP_TCK 50 +#define JH8100_NECLK_TYPEC_PIPE_DIV_SCAN 51 +#define JH8100_NECLK_TYPEC_CMN_SCAN_PLL 52 +#define JH8100_NECLK_TYPEC_CMN_SCAN_SER 53 +#define JH8100_NECLK_TYPEC_SCAN_PIPE 54 +#define JH8100_NECLK_TYPEC_SCAN_PSM 55 +#define JH8100_NECLK_TYPEC_SCAN_REF 56 +#define JH8100_NECLK_TYPEC_USB2_SCAN 57 +#define JH8100_NECLK_TYPEC_HSCLK 58 +#define JH8100_NECLK_TYPEC_HSSICLK 59 +#define JH8100_NECLK_TYPEC_SIECLK 60 +#define JH8100_NECLK_TYPEC_VID0 61 +#define JH8100_NECLK_TYPEC_VID1 62 +#define JH8100_NECLK_TYPEC_XCVR_SCAN_PLL0 63 +#define JH8100_NECLK_TYPEC_XCVR_SCAN_PLL1 64 +#define JH8100_NECLK_TYPEC_XCVR_SCAN_PLL2 65 +#define JH8100_NECLK_TYPEC_XCVR_SCAN_PLL3 66 +#define JH8100_NECLK_TYPEC_XCVR_SCAN_SER0 67 +#define JH8100_NECLK_TYPEC_XCVR_SCAN_SER1 68 +#define JH8100_NECLK_TYPEC_XCVR_SCAN_SER2 69 +#define JH8100_NECLK_TYPEC_XCVR_SCAN_SER3 70 +#define JH8100_NECLK_TYPEC_TAP_TCK 71 +#define JH8100_NECLK_VENC_AXI 72 +#define JH8100_NECLK_VC9000LE_AXI 73 +#define JH8100_NECLK_VC9000LE_APB 74 +#define JH8100_NECLK_VC9000LE_CORECLK 75 +#define JH8100_NECLK_INT_CTRL_APB 76 +#define JH8100_NECLK_PWM_8CH_APB 77 +#define JH8100_NECLK_WDT_APB 78 +#define JH8100_NECLK_WDT 79 +#define JH8100_NECLK_SPI0_APB 80 +#define JH8100_NECLK_SPI0_CORE 81 +#define JH8100_NECLK_SPI0_SCLK_IN 82 +#define JH8100_NECLK_SPI1_APB 83 +#define JH8100_NECLK_SPI1_CORE 84 +#define JH8100_NECLK_SPI1_SCLK_IN 85 +#define JH8100_NECLK_I2C0_APB 86 +#define JH8100_NECLK_I2C1_APB 87 +#define JH8100_NECLK_I2C2_APB 88 +#define JH8100_NECLK_I2C3_APB 89 +#define JH8100_NECLK_I2C4_APB 90 +#define JH8100_NECLK_I2C5_APB 91 +#define JH8100_NECLK_UART0_APB 92 +#define JH8100_NECLK_UART0_CORE 93 +#define JH8100_NECLK_UART1_CORE_PREOSC 94 +#define JH8100_NECLK_UART1_APB 95 +#define JH8100_NECLK_UART1_CORE 96 +#define JH8100_NECLK_UART2_CORE_PREOSC 97 +#define JH8100_NECLK_UART2_APB 98 +#define JH8100_NECLK_UART2_CORE 99 +#define JH8100_NECLK_UART3_CORE_PREOSC 100 +#define JH8100_NECLK_UART3_APB 101 +#define JH8100_NECLK_UART3_CORE 102 +#define JH8100_NECLK_UART4_CORE_PREOSC 103 +#define JH8100_NECLK_UART4_APB 104 +#define JH8100_NECLK_UART4_CORE 105 +#define JH8100_NECLK_I2S0_BCLK 106 +#define JH8100_NECLK_I2S0_LRCK 107 +#define JH8100_NECLK_I2S0_APB 108 +#define JH8100_NECLK_I2S0 109 +#define JH8100_NECLK_I2S0_N 110 +#define JH8100_NECLK_I2S0_BCLK_TX 111 +#define JH8100_NECLK_I2S0_LRCK_TX 112 +#define JH8100_NECLK_I2S0_BCLK_RX 113 +#define JH8100_NECLK_I2S0_LRCK_RX 114 +#define JH8100_NECLK_I2S1_BCLK 115 +#define JH8100_NECLK_I2S1_LRCK 116 +#define JH8100_NECLK_I2S1_APB 117 +#define JH8100_NECLK_I2S1 118 +#define JH8100_NECLK_I2S1_N 119 +#define JH8100_NECLK_I2S1_BCLK_TX 120 +#define JH8100_NECLK_I2S1_LRCK_TX 121 +#define JH8100_NECLK_I2S1_BCLK_RX 122 +#define JH8100_NECLK_I2S1_LRCK_RX 123 +#define JH8100_NECLK_I2S2_BCLK 124 +#define JH8100_NECLK_I2S2_LRCK 125 +#define JH8100_NECLK_I2S2_APB 126 +#define JH8100_NECLK_I2S2 127 +#define JH8100_NECLK_I2S2_N 128 +#define JH8100_NECLK_I2S2_BCLK_TX 129 +#define JH8100_NECLK_I2S2_LRCK_TX 130 +#define JH8100_NECLK_I2S2_BCLK_RX 131 +#define JH8100_NECLK_I2S2_LRCK_RX 132 +#define JH8100_NECLK_I2S3_BCLK 133 +#define JH8100_NECLK_I2S3_LRCK 134 +#define JH8100_NECLK_I2S0_STEREO_APB 135 +#define JH8100_NECLK_I2S0_STEREO 136 +#define JH8100_NECLK_I2S0_STEREO_N 137 +#define JH8100_NECLK_I2S0_STEREO_BCLK_TX 138 +#define JH8100_NECLK_I2S0_STEREO_LRCK_TX 139 +#define JH8100_NECLK_I2S0_STEREO_BCLK_RX_ICG 140 +#define JH8100_NECLK_I2S0_STEREO_LRCK_RX 141 +#define JH8100_NECLK_PDM_4MIC_DMIC 142 +#define JH8100_NECLK_PDM_4MIC_APB 143 +#define JH8100_NECLK_PDM_4MIC_SCAN 144 +#define JH8100_NECLK_CAN0_CTRL_PCLK 145 +#define JH8100_NECLK_CAN0_CTRL 146 +#define JH8100_NECLK_CAN0_CTRL_TIMER 147 +#define JH8100_NECLK_CAN1_CTRL_PCLK 148 +#define JH8100_NECLK_CAN1_CTRL 149 +#define JH8100_NECLK_CAN1_CTRL_TIMER 150 +#define JH8100_NECLK_SMBUS0_APB 151 +#define JH8100_NECLK_SMBUS0_CORE 152 +#define JH8100_NECLK_IOMUX_EAST_PCLK 153 +#define JH8100_NECLK_USB3_ICG_EN 154 +#define JH8100_NECLK_USB1_ICG_EN 155 +#define JH8100_NECLK_USB2_ICG_EN 156 +#define JH8100_NECLK_USBC_ICG_EN 157 +#define JH8100_NECLK_VENC_ICG_EN 158 +#define JH8100_NECLK_WDT0_ICG_EN 159 +#define JH8100_NECLK_SPI0_ICG_EN 160 +#define JH8100_NECLK_SPI1_ICG_EN 161 +#define JH8100_NECLK_UART0_ICG_EN 162 +#define JH8100_NECLK_UART1_ICG_EN 163 +#define JH8100_NECLK_UART2_ICG_EN 164 +#define JH8100_NECLK_UART3_ICG_EN 165 +#define JH8100_NECLK_UART4_ICG_EN 166 +#define JH8100_NECLK_I2S0_ICG_EN 167 +#define JH8100_NECLK_I2S1_ICG_EN 168 +#define JH8100_NECLK_I2S2_ICG_EN 169 +#define JH8100_NECLK_I2S_STEREO_ICG_EN 170 +#define JH8100_NECLK_PDM_4MIC_ICG_EN 171 +#define JH8100_NECLK_CAN0_ICG_EN 172 +#define JH8100_NECLK_CAN1_ICG_EN 173 +#define JH8100_NECLK_SMBUS0_ICG_EN 174 + #endif /* __DT_BINDINGS_CLOCK_STARFIVE_JH8100_H__ */ diff --git a/include/dt-bindings/reset/starfive,jh8100-crg.h b/include/dt-bindings/reset/starfive,jh8100-crg.h index b25f6522f3d4..30a99c78341a 100644 --- a/include/dt-bindings/reset/starfive,jh8100-crg.h +++ b/include/dt-bindings/reset/starfive,jh8100-crg.h @@ -32,4 +32,63 @@ #define JH8100_NWRST_MERAK0_TVSENSOR 8 #define JH8100_NWRST_MERAK1_TVSENSOR 9 +/* + * NECRG resets: assert0 + */ +#define JH8100_NERST_PRESETN 0 +#define JH8100_NERST_USB3_APB 1 +#define JH8100_NERST_USB3_TORR_PHY 2 +#define JH8100_NERST_USB3_CONFIG 3 +#define JH8100_NERST_USB1_APB 4 +#define JH8100_NERST_USB1_TORRENT_PHY 5 +#define JH8100_NERST_USB1_CONFIG 6 +#define JH8100_NERST_USB2_APB 7 +#define JH8100_NERST_USB2_TORRENT_PHY 8 +#define JH8100_NERST_USB2_CONFIG 9 +#define JH8100_NERST_USBC_APB 10 +#define JH8100_NERST_USBC_CONFIG 11 +#define JH8100_NERST_VC9000LE 12 +#define JH8100_NERST_INT_CTRL_APB 13 +#define JH8100_NERST_PWM_8CH_APB 14 +#define JH8100_NERST_WDT0 15 +#define JH8100_NERST_SPI0 16 +#define JH8100_NERST_SPI1 17 +#define JH8100_NERST_I2C0 18 +#define JH8100_NERST_I2C1 19 +#define JH8100_NERST_I2C2 20 +#define JH8100_NERST_I2C3 21 +#define JH8100_NERST_I2C4 22 +#define JH8100_NERST_I2C5 23 +#define JH8100_NERST_UART0 24 +#define JH8100_NERST_UART1 25 +#define JH8100_NERST_UART2 26 +#define JH8100_NERST_UART3 27 +#define JH8100_NERST_UART4 28 +#define JH8100_NERST_MAILBOX_PRESETN 29 +#define JH8100_NERST_TIMER0_APB 30 +#define JH8100_NERST_TIMER0_CH0 31 + +/* + * NECRG resets: assert1 + */ + +#define JH8100_NERST_TIMER0_CH1 32 +#define JH8100_NERST_TIMER0_CH2 33 +#define JH8100_NERST_TIMER0_CH3 34 +#define JH8100_NERST_TIMER1_APB 35 +#define JH8100_NERST_TIMER1_CH0 36 +#define JH8100_NERST_TIMER1_CH1 37 +#define JH8100_NERST_TIMER1_CH2 38 +#define JH8100_NERST_TIMER1_CH3 39 +#define JH8100_NERST_I2S0_RSTN_APB 40 +#define JH8100_NERST_I2S1_RSTN_APB 41 +#define JH8100_NERST_I2S2_RSTN_APB 42 +#define JH8100_NERST_I2S0_STEREO_APB 43 +#define JH8100_NERST_PDM 44 +#define JH8100_NERST_CAN0 45 +#define JH8100_NERST_CAN1 46 +#define JH8100_NERST_SMBUS0 47 +#define JH8100_NERST_SYS_IOMUX_E 48 +#define JH8100_NERST_DUBHE_TVSENSOR 49 + #endif /* __DT_BINDINGS_RESET_STARFIVE_JH8100_H__ */ From patchwork Wed Jan 10 13:31:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sia Jee Heng X-Patchwork-Id: 13516185 X-Patchwork-Delegate: mail@conchuod.ie 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 F0475C4707C for ; Wed, 10 Jan 2024 13:48:24 +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=efdEn1yzq0j2VJ9f3AJLGfYkQ0NG1MTqemv1ywwSvfY=; b=AdnnHsWVQKbFKd aXG0m0fFcvlpkw6LY/Nv9/fah0qSaSqF+UM45FoMXd/LizX877NuWuukdavV2SF1NrmjbAWr2wxwH IZ4Eu4V9bSAyN82+ACKtG9pRpV7APogpPz4Pa4ID9GklkskwdQ+GE0/Ffuf+NBJWKGL+BuWdgKdIW 4ka89OAzszlwn6Us7Qas0LsAMoWNIbEADzHjLbzOC/RUBT8zhNDXDsVOq7lytULfIjyaFGIwwq0p+ AKnPN9gtJqHL4eodlUtZJPRRNuS7y1TEUCNhgttC7QftRfXD4IuaPq6ieT0kggym0bpBk16ZhCGnO gap6Uv1vR6LLYjnDeT1g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rNYwD-00C5QU-0t; Wed, 10 Jan 2024 13:48:09 +0000 Received: from mail-bjschn02on20618.outbound.protection.partner.outlook.cn ([2406:e500:4440:2::618] helo=CHN02-BJS-obe.outbound.protection.partner.outlook.cn) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rNYw7-00C5Kb-25 for linux-riscv@lists.infradead.org; Wed, 10 Jan 2024 13:48:07 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jxtt7EcPJzsH9QPP/LG8CtTcBHzm87CG7UMDs4uJGZwPGAdXYA5D5ZVUBpPTqPSZ29/LmOpw5PdRcC39LApHJ+sOXGFFqF9z7ISBmjDulOtSRIho/iFRIapXdfsezQPm2SQFKih2ZUyOAZiimhcgxwD98oR+YbYdeFTTPm2Qhj+kp+JaLsWHvMLSf9dPTkTzIzFIYpDJ61HStKszPRJOXojajKDar7KGEQ/o9jyMPoNeKWejEkzXDtm60x2o0qVnds9s+fB1xfFI+wangThFCrFSzWu/JsoJATJfXb/MYlb00ME6jJ+UYOm2GVq9lvqSricLU+uq3f2p590WP+cuAg== 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=8MeRBurMDRRxHW7JRlW6v8YQ2xZ95FeFgCvcQ/32BNo=; b=A02/Fjk0qwwinKAxXGYqyvge3DnmWpkUXxV54cqqDeGNmYQs69k/CNFvne0nLx01oopel4VyxbrBD77eF3scqc8oRusZFAOhUS9A32DqquIwxJXkTYxs0FSVbkLkkETXwideWLOBC9fTR+KQmpn0jtqAjS5+/ZYNnr3wvhYZTZ9SGylJSCmdKY9SlO3ue25EcqfNbDGHgS97UqVIXUJM2hUtNvMsQRktguu1ZD1ghXH0skOAUAkHdvBqPGG2wgtjkbMloBwu19MYUPSF1POuZn7MXOIOOxs2SjMI8zOjp/zFPhMi7TcS73G0PGE0VkVp27QA313TmIPrTYMKMuo5WQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=starfivetech.com; dmarc=pass action=none header.from=starfivetech.com; dkim=pass header.d=starfivetech.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=starfivetech.com; Received: from BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:f::16) by BJSPR01MB0626.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:10::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.33; Wed, 10 Jan 2024 13:32:19 +0000 Received: from BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn ([fe80::3862:65b4:c857:c4a6]) by BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn ([fe80::3862:65b4:c857:c4a6%4]) with mapi id 15.20.7135.033; Wed, 10 Jan 2024 13:32:19 +0000 From: Sia Jee Heng To: kernel@esmil.dk, conor@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, mturquette@baylibre.com, sboyd@kernel.org, p.zabel@pengutronix.de, emil.renner.berthing@canonical.com, hal.feng@starfivetech.com, xingyu.wu@starfivetech.com Cc: linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, jeeheng.sia@starfivetech.com, leyfoon.tan@starfivetech.com Subject: [RFC v3 10/16] clk: starfive: Add JH8100 North-East clock generator driver Date: Wed, 10 Jan 2024 21:31:22 +0800 Message-Id: <20240110133128.286657-11-jeeheng.sia@starfivetech.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240110133128.286657-1-jeeheng.sia@starfivetech.com> References: <20240110133128.286657-1-jeeheng.sia@starfivetech.com> X-ClientProxiedBy: BJXPR01CA0067.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:12::34) To BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:f::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BJSPR01MB0561:EE_|BJSPR01MB0626:EE_ X-MS-Office365-Filtering-Correlation-Id: 5b53b887-9460-4892-a051-08dc11e091d1 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /+kaaxZXRr+VxlnN4fDwRq/+kqoAS+gXkaNvfNh/1gaQTrGndLf+Rkq+ALRsBV3xYdrp0dVGfDr28sFzR8t6qE68skHmVPW/x0EUyjrO9ehLE3mahpC6qyXz2OeAkTY5tuY7rT6afQd7/xrT37Rqjwso6k1Eb6PeAtBqgw4w8ShjWmdxJ55GadmPU8BwF+jat5S+GYKF7YA07iJ7gkx8JQrzv0VGBBirph5Xq8zPl5EXDoxU5/kPCJHwVSYt6oA1rxKaZpxyULTKyQELUc/mCooyHFOklOUWLfVmmaT0KOLQ/cVzaa+EmwFvT/pIBSUBD+OJn0RY/tHu/tNZ0lLjLPtAtkWX9jh/xGUYPQzakbEceBix01yX6hYHj5mbnkJRdTR1qqRb9oCVkeB11568scpaXHmFPOupZZbtRMJTw34YKZCaMpEwNY92nvI26G7rBumPcNKMI1U2flvgX8GhAN5dmmPhmdLnrD5SuprLeQIJ3dOrULNeXEdBklBt/GZzf8/Bbxxv+eWjl+xBKHLvoXq7BNBiS/ArG5KIFBfmOFtWTWTpIFiREYf7Mvna0qJNHuhUIx0pVTdFf/gTb1Zoi/8DE/XGEIR8DfKXsylEFjDVfK2raLi07zvZODMntO8f X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn;PTR:;CAT:NONE;SFS:(13230031)(39830400003)(136003)(346002)(396003)(366004)(230273577357003)(230922051799003)(230173577357003)(186009)(64100799003)(451199024)(1800799012)(921011)(26005)(107886003)(52116002)(2616005)(41320700001)(6666004)(83380400001)(1076003)(86362001)(40160700002)(40180700001)(38100700002)(36756003)(38350700005)(5660300002)(30864003)(7416002)(4326008)(55236004)(6636002)(66556008)(66476007)(66946007)(41300700001)(2906002)(8936002)(8676002)(508600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: MHF3XMwGfUGfn06hKeTO+ul+tVVnMhVigviJZFVO18rTs0bLmCJxKcqSvJ2OZQA5qf1By1/8iUnI05Lg8ENUdarJ7q6iKMxbkRFW/i1lGbbJTP8Kp2rkLhFxukxetcziDhWjcQIySDEe5wa5gD1AWAuMR5AwqHKblz6DU/rTlaA6E9tXsDGsz4L6bcpfnVhHv60pMxKOtVT1fFGcvGRuVRCgyH+ubR5bagwp8kCRqi7QTWLiwdqGcOfsSXG9XStyXHUzwCOAiI4rQ01ikS94oXJmCSFqCpJjJLM/DTM/bOvJ9Ejj9r/fQ2sdnoDWU/yO1cm8TaiHxg5f3Vjoem7yNm3bl2DXf3cUXHCXQxIc2e75gPP0dC4m9WafmDJD0LxS62QOxtmaVIwmirWcBS9RioWzAAQJoX2gBTw1H10hXa3JWi2mWY04RgNZvzIO4T5Jf8A5S9HeNpjPJqAVhFgX2zg22C4fVzWfTJBjBe6Jgs/DQlE+W/fc4WHYmhzD3mLn5hqgPyDIjHpfSRj1UW3zImqtsIcFmt9KcUL7z7pWKeMroJyQ+KufiKr3DKIwSNZwExn6YNZdM6OJCpMEDrXvRxuoveMCrJmmlNL69yFQ25yGAwxc5C/TFm4dBqVoEFy2Thjm8cu8+GZuSf5ugBTYD/EDZEocZoPkBmVVIIOFMrplQR0IgaAGavcP3RnPzMBXt3nS88MGIYnqBwnVPu/4QFS590p2FEV8kcXhzcE++k4c6h6RRDFs6GA6cK5SKSV2u7057aigIetqxoYUQactj0dVy3sPI9xuW/PuABjKjXp0tCCIq8970FKXm//vXTIKOrT2RRLV1ZTIGBXgNcC1itgGRIj0PfgpDk7xDCr5UTQHuzq6Kil/UoDIITSKIzGoTw19xFOaxcnlnxyB1PJNiZkwmTIH/sJ+SXlRnWxhmd2hGmMq8VhXX1sxZsY0LFF9JLaZrOdf4c0hx4pl6eNKmX9hnaBTfW53hAMuhZmLUBX3I1uZ61ZsHiiEM/tz/T1ZuPtkY/BNajObaikD7tq3wxen/oTFuqJUBlyCnhbqwXfWohLB/deDqEzAqqMzlk+DPjwX3JMpK+ZSE619n+kt6KV8ecJRZHeA7lQRxH5bu7IijQUo2OzBtGOoZuFW/mlKzNjQhJPiYCi47Pzqap3OUslWn4VOBqqmAcz6eY+7ZyV9ghDLm21VP5cycR0FH87G0S6Llf2I30CURSzHoM0zc9DGBXHPpL4y1oHwNic7vqcENjfxoJe6FVuBOsupqUTGASThCB40+CXT2SNJeqj6OSDPXQIUF4caJQBJ6aO2g4YL/IM1ptgJWTXpRNOUI2Z05aH/0zbeHB7ky3Ubpkue/X44T+hLxnRYt5AQiC8QmKk0u2EZhjpjqFE8aBzMGkHZJMgpE0fNRpZYHGXo/dP9wlKe5Q4cp513JfFhpNLYjDKaeC1y2qz8/eTsVvHgE3wo39D5rMESVvAIrDXp9ZLpyliqvPOiIpr/SFGeQlIfVmuEJoVk3/iqDlHqh3JxPzL13vcpu1n2oftVx1J8wo6BSRIbfBMDJcYSdBqO/43dKV9dMAI2izRCo6NjUsNiIEsDa+69A1LsICjfp2XG5hpm9C/2SyhcnT/JSmm3bx8LGPU= X-OriginatorOrg: starfivetech.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5b53b887-9460-4892-a051-08dc11e091d1 X-MS-Exchange-CrossTenant-AuthSource: BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jan 2024 13:32:19.7643 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 06fe3fa3-1221-43d3-861b-5a4ee687a85c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: legvUvwdB4Hf2pY8BhhRG8B4RqjB/6N6zmc3uNRx5p2YURvM7GAWRq/dV4/o8u3fMrb9g94PBxuDel68tj1Ple6hz1sZsiRQj/KMbxJgg0E= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BJSPR01MB0626 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240110_054803_878326_0F102181 X-CRM114-Status: GOOD ( 13.97 ) X-BeenThere: linux-riscv@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-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Add support for JH8100 North-East (NECRG) clock generator. Signed-off-by: Sia Jee Heng Reviewed-by: Ley Foon Tan --- drivers/clk/starfive/Makefile | 1 + drivers/clk/starfive/clk-starfive-common.h | 7 + drivers/clk/starfive/clk-starfive-jh8100-ne.c | 499 ++++++++++++++++++ 4 files changed, 513 insertions(+) create mode 100644 drivers/clk/starfive/clk-starfive-jh8100-ne.c diff --git a/drivers/clk/starfive/Makefile b/drivers/clk/starfive/Makefile index 2ba07d3398f0..cecce3655600 100644 --- a/drivers/clk/starfive/Makefile +++ b/drivers/clk/starfive/Makefile @@ -13,3 +13,4 @@ obj-$(CONFIG_CLK_STARFIVE_JH7110_VOUT) += clk-starfive-jh7110-vout.o obj-$(CONFIG_CLK_STARFIVE_JH8100_SYS) += clk-starfive-jh8100-sys.o obj-$(CONFIG_CLK_STARFIVE_JH8100_NW) += clk-starfive-jh8100-nw.o +obj-$(CONFIG_CLK_STARFIVE_JH8100_NE) += clk-starfive-jh8100-ne.o diff --git a/drivers/clk/starfive/clk-starfive-common.h b/drivers/clk/starfive/clk-starfive-common.h index fed45311360c..23c8236873a4 100644 --- a/drivers/clk/starfive/clk-starfive-common.h +++ b/drivers/clk/starfive/clk-starfive-common.h @@ -103,6 +103,13 @@ struct starfive_clk_data { .parents = { [0] = _parent }, \ } +#define STARFIVE_GINV(_idx, _name, _flags, _parent)[_idx] = { \ + .name = _name, \ + .flags = _flags, \ + .max = STARFIVE_CLK_ENABLE | STARFIVE_CLK_INVERT, \ + .parents = { [0] = _parent }, \ +} + struct starfive_clk { struct clk_hw hw; unsigned int idx; diff --git a/drivers/clk/starfive/clk-starfive-jh8100-ne.c b/drivers/clk/starfive/clk-starfive-jh8100-ne.c new file mode 100644 index 000000000000..84b2b4411b0c --- /dev/null +++ b/drivers/clk/starfive/clk-starfive-jh8100-ne.c @@ -0,0 +1,499 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * StarFive JH8100 North-East Clock Driver + * + * Copyright (C) 2023 StarFive Technology Co., Ltd. + * + * Author: Jee Heng Sia + * + */ + +#include +#include +#include +#include +#include + +#include + +#include "clk-starfive-jh8100.h" + +#define JH8100_NECLK_NUM_CLKS (JH8100_NECLK_SMBUS0_ICG_EN + 1) + +/* external clocks */ +#define JH8100_NECLK_OSC (JH8100_NECLK_NUM_CLKS + 0) +#define JH8100_NECLK_APB_BUS (JH8100_NECLK_NUM_CLKS + 1) +#define JH8100_NECLK_AXI_400 (JH8100_NECLK_NUM_CLKS + 2) +#define JH8100_NECLK_VOUT_ROOT0 (JH8100_NECLK_NUM_CLKS + 3) +#define JH8100_NECLK_VOUT_ROOT1 (JH8100_NECLK_NUM_CLKS + 4) +#define JH8100_NECLK_USB_WRAP_480 (JH8100_NECLK_NUM_CLKS + 5) +#define JH8100_NECLK_USB_WRAP_625 (JH8100_NECLK_NUM_CLKS + 6) +#define JH8100_NECLK_USB_WRAP_240 (JH8100_NECLK_NUM_CLKS + 7) +#define JH8100_NECLK_USB_WRAP_60 (JH8100_NECLK_NUM_CLKS + 8) +#define JH8100_NECLK_USB_WRAP_156P25 (JH8100_NECLK_NUM_CLKS + 9) +#define JH8100_NECLK_USB_WRAP_312P5 (JH8100_NECLK_NUM_CLKS + 10) +#define JH8100_NECLK_USB_125M (JH8100_NECLK_NUM_CLKS + 11) +#define JH8100_NECLK_GPIO_100 (JH8100_NECLK_NUM_CLKS + 12) +#define JH8100_NECLK_PERH_ROOT (JH8100_NECLK_NUM_CLKS + 13) +#define JH8100_NECLK_MCLK (JH8100_NECLK_NUM_CLKS + 14) +#define JH8100_NECLK_USB3_TAP_TCK_EXT (JH8100_NECLK_NUM_CLKS + 15) +#define JH8100_NECLK_GLB_EXT (JH8100_NECLK_NUM_CLKS + 16) +#define JH8100_NECLK_USB1_TAP_TCK_EXT (JH8100_NECLK_NUM_CLKS + 17) +#define JH8100_NECLK_USB2_TAP_TCK_EXT (JH8100_NECLK_NUM_CLKS + 18) +#define JH8100_NECLK_TYPEC_TAP_TCK_EXT (JH8100_NECLK_NUM_CLKS + 19) +#define JH8100_NECLK_SPI_IN0_EXT (JH8100_NECLK_NUM_CLKS + 20) +#define JH8100_NECLK_SPI_IN1_EXT (JH8100_NECLK_NUM_CLKS + 21) +#define JH8100_NECLK_I2STX_BCLK_EXT (JH8100_NECLK_NUM_CLKS + 22) +#define JH8100_NECLK_I2STX_LRCK_EXT (JH8100_NECLK_NUM_CLKS + 23) +#define JH8100_NECLK_PERH_ROOT_PREOSC (JH8100_NECLK_NUM_CLKS + 24) +#define JH8100_NECLK_AHB_DMA (JH8100_NECLK_NUM_CLKS + 25) +#define JH8100_NECLK_APB_BUS_PER1 (JH8100_NECLK_NUM_CLKS + 26) +#define JH8100_NECLK_APB_BUS_PER2 (JH8100_NECLK_NUM_CLKS + 27) +#define JH8100_NECLK_APB_BUS_PER3 (JH8100_NECLK_NUM_CLKS + 28) +#define JH8100_NECLK_APB_BUS_PER5 (JH8100_NECLK_NUM_CLKS + 29) +#define JH8100_NECLK_VENC_ROOT (JH8100_NECLK_NUM_CLKS + 30) +#define JH8100_NECLK_SPI_CORE_100 (JH8100_NECLK_NUM_CLKS + 31) + +static const struct starfive_clk_data jh8100_necrg_clk_data[] = { + /* flexnoc */ + STARFIVE_GATE(JH8100_NECLK_FLEXNOC_DMASLV, "flexnoc_dmaslv", CLK_IS_CRITICAL, + JH8100_NECLK_AHB_DMA), + /* mailbox */ + STARFIVE_GATE(JH8100_NECLK_MAILBOX_APB, "mailbox_apb", CLK_IS_CRITICAL, + JH8100_NECLK_APB_BUS_PER1), + /* timer */ + STARFIVE_GATE(JH8100_NECLK_SR5_TIMER0_APB, "timer0_apb", 0, JH8100_NECLK_APB_BUS_PER1), + STARFIVE_GATE(JH8100_NECLK_SR5_TIMER0_CH0, "timer0_ch0", 0, JH8100_NECLK_OSC), + STARFIVE_GATE(JH8100_NECLK_SR5_TIMER0_CH1, "timer0_ch1", 0, JH8100_NECLK_OSC), + STARFIVE_GATE(JH8100_NECLK_SR5_TIMER0_CH2, "timer0_ch2", 0, JH8100_NECLK_OSC), + STARFIVE_GATE(JH8100_NECLK_SR5_TIMER0_CH3, "timer0_ch3", 0, JH8100_NECLK_OSC), + STARFIVE_GATE(JH8100_NECLK_SR5_TIMER1_APB, "timer1_apb", 0, JH8100_NECLK_APB_BUS_PER1), + STARFIVE_GATE(JH8100_NECLK_SR5_TIMER1_CH0, "timer1_ch0", 0, JH8100_NECLK_OSC), + STARFIVE_GATE(JH8100_NECLK_SR5_TIMER1_CH1, "timer1_ch1", 0, JH8100_NECLK_OSC), + STARFIVE_GATE(JH8100_NECLK_SR5_TIMER1_CH2, "timer1_ch2", 0, JH8100_NECLK_OSC), + STARFIVE_GATE(JH8100_NECLK_SR5_TIMER1_CH3, "timer1_ch3", 0, JH8100_NECLK_OSC), + /* usb3 */ + STARFIVE_GATE(JH8100_NECLK_USB3_CMN_SCAN_PLL, "usb3_scan_pll", CLK_IGNORE_UNUSED, + JH8100_NECLK_USB_WRAP_625), + STARFIVE_GATE(JH8100_NECLK_USB3_CMN_SCAN_SER, "usb3_scan_ser", CLK_IGNORE_UNUSED, + JH8100_NECLK_USB_WRAP_625), + STARFIVE_GATE(JH8100_NECLK_USB3_PIPE_IN_SCAN, "usb3_pipe_in_scan", CLK_IGNORE_UNUSED, + JH8100_NECLK_USB_125M), + STARFIVE_GATE(JH8100_NECLK_USB3_SCAN_PIPE, "usb3_scan_pipe", CLK_IGNORE_UNUSED, + JH8100_NECLK_USB_125M), + STARFIVE_GATE(JH8100_NECLK_USB3_SCAN_PSM, "usb3_scan_psm", CLK_IGNORE_UNUSED, + JH8100_NECLK_USB_125M), + STARFIVE_GATE(JH8100_NECLK_USB3_SCAN_REF, "usb3_scan_ref", CLK_IGNORE_UNUSED, + JH8100_NECLK_OSC), + STARFIVE_GATE(JH8100_NECLK_USB3_USB2_SCAN, "usb3_usb2_scan", CLK_IGNORE_UNUSED, + JH8100_NECLK_APB_BUS_PER3), + STARFIVE_GATE(JH8100_NECLK_USB3_HSCLK, "usb3_hsclk", CLK_IGNORE_UNUSED, + JH8100_NECLK_USB_WRAP_480), + STARFIVE_GATE(JH8100_NECLK_USB3_HSSICLK, "usb3_hssiclk", CLK_IGNORE_UNUSED, + JH8100_NECLK_USB_WRAP_240), + STARFIVE_GATE(JH8100_NECLK_USB3_SIECLK, "usb3_sieclk", CLK_IGNORE_UNUSED, + JH8100_NECLK_USB_WRAP_60), + STARFIVE_GATE(JH8100_NECLK_USB3_XCVR_SCAN_PLL, "usb3_xcvr_scan_pll", CLK_IGNORE_UNUSED, + JH8100_NECLK_USB_WRAP_625), + STARFIVE_GATE(JH8100_NECLK_USB3_XCVR_SCAN_SER, "usb3_xcvr_scan_ser", CLK_IGNORE_UNUSED, + JH8100_NECLK_USB_WRAP_625), + STARFIVE__MUX(JH8100_NECLK_USB3_TAP_TCK, "usb3_tap_tck", 2, + JH8100_NECLK_USB3_TAP_TCK_EXT, JH8100_NECLK_GLB_EXT), + /* usb1 */ + STARFIVE_GATE(JH8100_NECLK_USB1_CMN_SCAN_PLL, "usb1_scan_pll", CLK_IGNORE_UNUSED, + JH8100_NECLK_USB_WRAP_625), + STARFIVE_GATE(JH8100_NECLK_USB1_CMN_SCAN_SER, "usb1_scan_ser", CLK_IGNORE_UNUSED, + JH8100_NECLK_USB_WRAP_625), + STARFIVE_GATE(JH8100_NECLK_USB1_PIPE_IN_SCAN, "usb1_pipe_in_scan", CLK_IGNORE_UNUSED, + JH8100_NECLK_USB_125M), + STARFIVE_GATE(JH8100_NECLK_USB1_SCAN_PIPE, "usb1_scan_pipe", CLK_IGNORE_UNUSED, + JH8100_NECLK_USB_125M), + STARFIVE_GATE(JH8100_NECLK_USB1_SCAN_PSM, "usb1_scan_psm", CLK_IGNORE_UNUSED, + JH8100_NECLK_USB_125M), + STARFIVE_GATE(JH8100_NECLK_USB1_SCAN_REF, "usb1_scan_ref", CLK_IGNORE_UNUSED, + JH8100_NECLK_OSC), + STARFIVE_GATE(JH8100_NECLK_USB1_USB2_SCAN, "usb1_usb2_scan", CLK_IGNORE_UNUSED, + JH8100_NECLK_APB_BUS_PER3), + STARFIVE_GATE(JH8100_NECLK_USB1_HSCLK, "usb1_hsclk", CLK_IGNORE_UNUSED, + JH8100_NECLK_USB_WRAP_480), + STARFIVE_GATE(JH8100_NECLK_USB1_HSSICLK, "usb1_hssiclk", CLK_IGNORE_UNUSED, + JH8100_NECLK_USB_WRAP_240), + STARFIVE_GATE(JH8100_NECLK_USB1_SIECLK, "usb1_sieclk", CLK_IGNORE_UNUSED, + JH8100_NECLK_USB_WRAP_60), + STARFIVE_GATE(JH8100_NECLK_USB1_XCVR_SCAN_PLL, "usb1_xcvr_scan_pll", CLK_IGNORE_UNUSED, + JH8100_NECLK_USB_WRAP_625), + STARFIVE_GATE(JH8100_NECLK_USB1_XCVR_SCAN_SER, "usb1_xcvr_scan_ser", CLK_IGNORE_UNUSED, + JH8100_NECLK_USB_WRAP_625), + STARFIVE__MUX(JH8100_NECLK_USB1_TAP_TCK, "usb1_tap_tck", 2, + JH8100_NECLK_USB1_TAP_TCK_EXT, JH8100_NECLK_GLB_EXT), + /* usb2 */ + STARFIVE_GATE(JH8100_NECLK_USB2_CMN_SCAN_PLL, "usb2_scan_pll", CLK_IGNORE_UNUSED, + JH8100_NECLK_USB_WRAP_625), + STARFIVE_GATE(JH8100_NECLK_USB2_CMN_SCAN_SER, "usb2_scan_ser", CLK_IGNORE_UNUSED, + JH8100_NECLK_USB_WRAP_625), + STARFIVE_GATE(JH8100_NECLK_USB2_PIPE_IN_SCAN, "usb2_pipe_in_scan", CLK_IGNORE_UNUSED, + JH8100_NECLK_USB_125M), + STARFIVE_GATE(JH8100_NECLK_USB2_SCAN_PIPE, "usb2_scan_pipe", CLK_IGNORE_UNUSED, + JH8100_NECLK_USB_125M), + STARFIVE_GATE(JH8100_NECLK_USB2_SCAN_PSM, "usb2_scan_psm", CLK_IGNORE_UNUSED, + JH8100_NECLK_USB_125M), + STARFIVE_GATE(JH8100_NECLK_USB2_SCAN_REF, "usb2_scan_ref", CLK_IGNORE_UNUSED, + JH8100_NECLK_OSC), + STARFIVE_GATE(JH8100_NECLK_USB2_USB2_SCAN, "usb2_usb2_scan", CLK_IGNORE_UNUSED, + JH8100_NECLK_APB_BUS_PER3), + STARFIVE_GATE(JH8100_NECLK_USB2_HSCLK, "usb2_hsclk", CLK_IGNORE_UNUSED, + JH8100_NECLK_USB_WRAP_480), + STARFIVE_GATE(JH8100_NECLK_USB2_HSSICLK, "usb2_hssiclk", CLK_IGNORE_UNUSED, + JH8100_NECLK_USB_WRAP_240), + STARFIVE_GATE(JH8100_NECLK_USB2_SIECLK, "usb2_sieclk", CLK_IGNORE_UNUSED, + JH8100_NECLK_USB_WRAP_60), + STARFIVE_GATE(JH8100_NECLK_USB2_XCVR_SCAN_PLL, "usb2_xcvr_scan_pll", CLK_IGNORE_UNUSED, + JH8100_NECLK_USB_WRAP_625), + STARFIVE_GATE(JH8100_NECLK_USB2_XCVR_SCAN_SER, "usb2_xcvr_scan_ser", CLK_IGNORE_UNUSED, + JH8100_NECLK_USB_WRAP_625), + STARFIVE__MUX(JH8100_NECLK_USB2_TAP_TCK, "usb2_tap_tck", 2, JH8100_NECLK_USB2_TAP_TCK_EXT, + JH8100_NECLK_GLB_EXT), + /* usb typec */ + STARFIVE_GATE(JH8100_NECLK_TYPEC_PIPE_DIV_SCAN, "typec_pipe_div_scan", CLK_IGNORE_UNUSED, + JH8100_NECLK_USB_WRAP_156P25), + STARFIVE_GATE(JH8100_NECLK_TYPEC_CMN_SCAN_PLL, "typec_scan_pll", CLK_IGNORE_UNUSED, + JH8100_NECLK_USB_WRAP_625), + STARFIVE_GATE(JH8100_NECLK_TYPEC_CMN_SCAN_SER, "typec_scan_ser", CLK_IGNORE_UNUSED, + JH8100_NECLK_USB_WRAP_625), + STARFIVE_GATE(JH8100_NECLK_TYPEC_SCAN_PIPE, "typec_scan_pipe", CLK_IGNORE_UNUSED, + JH8100_NECLK_USB_WRAP_312P5), + STARFIVE_GATE(JH8100_NECLK_TYPEC_SCAN_PSM, "typec_scan_psm", CLK_IGNORE_UNUSED, + JH8100_NECLK_USB_125M), + STARFIVE_GATE(JH8100_NECLK_TYPEC_SCAN_REF, "typec_scan_ref", CLK_IGNORE_UNUSED, + JH8100_NECLK_OSC), + STARFIVE_GATE(JH8100_NECLK_TYPEC_USB2_SCAN, "typec_usb2_scan", CLK_IGNORE_UNUSED, + JH8100_NECLK_APB_BUS_PER5), + STARFIVE_GATE(JH8100_NECLK_TYPEC_HSCLK, "typec_hsclk", CLK_IGNORE_UNUSED, + JH8100_NECLK_USB_WRAP_480), + STARFIVE_GATE(JH8100_NECLK_TYPEC_HSSICLK, "typec_hssiclk", CLK_IGNORE_UNUSED, + JH8100_NECLK_USB_WRAP_240), + STARFIVE_GATE(JH8100_NECLK_TYPEC_SIECLK, "typec_sieclk", CLK_IGNORE_UNUSED, + JH8100_NECLK_USB_WRAP_60), + STARFIVE_GMUX(JH8100_NECLK_TYPEC_VID0, "typec_vid0", CLK_IGNORE_UNUSED, 2, + JH8100_NECLK_VOUT_ROOT0, JH8100_NECLK_VOUT_ROOT1), + STARFIVE_GMUX(JH8100_NECLK_TYPEC_VID1, "typec_vid1", CLK_IGNORE_UNUSED, 2, + JH8100_NECLK_VOUT_ROOT0, JH8100_NECLK_VOUT_ROOT1), + STARFIVE_GATE(JH8100_NECLK_TYPEC_XCVR_SCAN_PLL0, "typec_xcvr_scan_pll0", CLK_IGNORE_UNUSED, + JH8100_NECLK_USB_WRAP_625), + STARFIVE_GATE(JH8100_NECLK_TYPEC_XCVR_SCAN_PLL1, "typec_xcvr_scan_pll1", CLK_IGNORE_UNUSED, + JH8100_NECLK_USB_WRAP_625), + STARFIVE_GATE(JH8100_NECLK_TYPEC_XCVR_SCAN_PLL2, "typec_xcvr_scan_pll2", CLK_IGNORE_UNUSED, + JH8100_NECLK_USB_WRAP_625), + STARFIVE_GATE(JH8100_NECLK_TYPEC_XCVR_SCAN_PLL3, "typec_xcvr_scan_pll3", CLK_IGNORE_UNUSED, + JH8100_NECLK_USB_WRAP_625), + STARFIVE_GATE(JH8100_NECLK_TYPEC_XCVR_SCAN_SER0, "typec_xcvr_scan_ser0", CLK_IGNORE_UNUSED, + JH8100_NECLK_USB_WRAP_625), + STARFIVE_GATE(JH8100_NECLK_TYPEC_XCVR_SCAN_SER1, "typec_xcvr_scan_ser1", CLK_IGNORE_UNUSED, + JH8100_NECLK_USB_WRAP_625), + STARFIVE_GATE(JH8100_NECLK_TYPEC_XCVR_SCAN_SER2, "typec_xcvr_scan_ser2", CLK_IGNORE_UNUSED, + JH8100_NECLK_USB_WRAP_625), + STARFIVE_GATE(JH8100_NECLK_TYPEC_XCVR_SCAN_SER3, "typec_xcvr_scan_ser3", CLK_IGNORE_UNUSED, + JH8100_NECLK_USB_WRAP_625), + STARFIVE__MUX(JH8100_NECLK_TYPEC_TAP_TCK, "typec_tap_tck", 2, + JH8100_NECLK_TYPEC_TAP_TCK_EXT, JH8100_NECLK_GLB_EXT), + /* video enc */ + STARFIVE__DIV(JH8100_NECLK_VENC_AXI, "venc_axi", 20, JH8100_NECLK_VENC_ROOT), + STARFIVE_GATE(JH8100_NECLK_VC9000LE_AXI, "vc9000le_axi", CLK_IGNORE_UNUSED, + JH8100_NECLK_VENC_AXI), + STARFIVE_GATE(JH8100_NECLK_VC9000LE_APB, "vc9000le_apb", CLK_IGNORE_UNUSED, + JH8100_NECLK_APB_BUS_PER5), + STARFIVE_GDIV(JH8100_NECLK_VC9000LE_CORECLK, "vc9000le_coreclk", 0, 40, + JH8100_NECLK_VENC_ROOT), + /* intc */ + STARFIVE_GATE(JH8100_NECLK_INT_CTRL_APB, "int_ctrl_apb", 0, JH8100_NECLK_APB_BUS_PER2), + /* pwm */ + STARFIVE_GATE(JH8100_NECLK_PWM_8CH_APB, "pwm_8ch_apb", 0, JH8100_NECLK_APB_BUS_PER2), + /* wdt */ + STARFIVE_GATE(JH8100_NECLK_WDT_APB, "wdt_apb", CLK_IGNORE_UNUSED, + JH8100_NECLK_APB_BUS_PER2), + STARFIVE_GATE(JH8100_NECLK_WDT, "wdt", CLK_IGNORE_UNUSED, JH8100_NECLK_OSC), + /* SPI */ + STARFIVE_GATE(JH8100_NECLK_SPI0_APB, "spi0_apb", 0, JH8100_NECLK_APB_BUS_PER2), + STARFIVE_GATE(JH8100_NECLK_SPI0_CORE, "spi0_core", 0, JH8100_NECLK_SPI_CORE_100), + STARFIVE__MUX(JH8100_NECLK_SPI0_SCLK_IN, "spi0_sclk_in", 2, JH8100_NECLK_SPI_IN0_EXT, + JH8100_NECLK_GPIO_100), + STARFIVE_GATE(JH8100_NECLK_SPI1_APB, "spi1_apb", 0, JH8100_NECLK_APB_BUS_PER2), + STARFIVE_GATE(JH8100_NECLK_SPI1_CORE, "spi1_core", 0, JH8100_NECLK_SPI_CORE_100), + STARFIVE__MUX(JH8100_NECLK_SPI1_SCLK_IN, "spi1_sclk_in", 2, JH8100_NECLK_SPI_IN1_EXT, + JH8100_NECLK_GPIO_100), + /* i2c */ + STARFIVE_GATE(JH8100_NECLK_I2C0_APB, "i2c0_apb", 0, JH8100_NECLK_APB_BUS_PER1), + STARFIVE_GATE(JH8100_NECLK_I2C1_APB, "i2c1_apb", 0, JH8100_NECLK_APB_BUS_PER1), + STARFIVE_GATE(JH8100_NECLK_I2C2_APB, "i2c2_apb", 0, JH8100_NECLK_APB_BUS_PER1), + STARFIVE_GATE(JH8100_NECLK_I2C3_APB, "i2c3_apb", 0, JH8100_NECLK_APB_BUS_PER1), + STARFIVE_GATE(JH8100_NECLK_I2C4_APB, "i2c4_apb", 0, JH8100_NECLK_APB_BUS_PER1), + STARFIVE_GATE(JH8100_NECLK_I2C5_APB, "i2c5_apb", 0, JH8100_NECLK_APB_BUS_PER1), + /* uart */ + STARFIVE_GATE(JH8100_NECLK_UART0_APB, "uart0_apb", 0, JH8100_NECLK_APB_BUS_PER1), + STARFIVE_GATE(JH8100_NECLK_UART0_CORE, "uart0_core", 0, JH8100_NECLK_OSC), + STARFIVE__DIV(JH8100_NECLK_UART1_CORE_PREOSC, "uart1_core_preosc", 131071, + JH8100_NECLK_PERH_ROOT_PREOSC), + STARFIVE_GATE(JH8100_NECLK_UART1_APB, "uart1_apb", 0, JH8100_NECLK_APB_BUS_PER1), + STARFIVE_GMUX(JH8100_NECLK_UART1_CORE, "uart1_core", 0, 2, JH8100_NECLK_OSC, + JH8100_NECLK_UART1_CORE_PREOSC), + STARFIVE__DIV(JH8100_NECLK_UART2_CORE_PREOSC, "uart2_core_preosc", 131071, + JH8100_NECLK_PERH_ROOT_PREOSC), + STARFIVE_GATE(JH8100_NECLK_UART2_APB, "uart2_apb", 0, JH8100_NECLK_APB_BUS_PER1), + STARFIVE_GMUX(JH8100_NECLK_UART2_CORE, "uart2_core", 0, 2, JH8100_NECLK_OSC, + JH8100_NECLK_UART2_CORE_PREOSC), + STARFIVE__DIV(JH8100_NECLK_UART3_CORE_PREOSC, "uart3_core_preosc", 131071, + JH8100_NECLK_PERH_ROOT_PREOSC), + STARFIVE_GATE(JH8100_NECLK_UART3_APB, "uart3_apb", 0, JH8100_NECLK_APB_BUS_PER1), + STARFIVE_GMUX(JH8100_NECLK_UART3_CORE, "uart3_core", 0, 2, JH8100_NECLK_OSC, + JH8100_NECLK_UART3_CORE_PREOSC), + STARFIVE__DIV(JH8100_NECLK_UART4_CORE_PREOSC, "uart4_core_preosc", 131071, + JH8100_NECLK_PERH_ROOT_PREOSC), + STARFIVE_GATE(JH8100_NECLK_UART4_APB, "uart4_apb", 0, JH8100_NECLK_APB_BUS_PER1), + STARFIVE_GMUX(JH8100_NECLK_UART4_CORE, "uart4_core", 0, 2, JH8100_NECLK_OSC, + JH8100_NECLK_UART4_CORE_PREOSC), + /* i2s */ + STARFIVE__DIV(JH8100_NECLK_I2S0_BCLK, "i2s0_bclk", 32, JH8100_NECLK_MCLK), + STARFIVE__DIV(JH8100_NECLK_I2S0_LRCK, "i2s0_lrck", 128, JH8100_NECLK_I2S0_BCLK), + STARFIVE_GATE(JH8100_NECLK_I2S0_APB, "i2s0_apb", CLK_IGNORE_UNUSED, + JH8100_NECLK_APB_BUS_PER2), + STARFIVE_GATE(JH8100_NECLK_I2S0, "i2s0", CLK_IGNORE_UNUSED, JH8100_NECLK_MCLK), + STARFIVE_GINV(JH8100_NECLK_I2S0_N, "i2s0_n", CLK_IGNORE_UNUSED, JH8100_NECLK_MCLK), + STARFIVE__MUX(JH8100_NECLK_I2S0_BCLK_TX, "i2s0_bclk_tx", 2, JH8100_NECLK_I2S0_BCLK, + JH8100_NECLK_I2STX_BCLK_EXT), + STARFIVE__MUX(JH8100_NECLK_I2S0_LRCK_TX, "i2s0_lrck_tx", 2, JH8100_NECLK_I2S0_LRCK, + JH8100_NECLK_I2STX_LRCK_EXT), + STARFIVE__MUX(JH8100_NECLK_I2S0_BCLK_RX, "i2s0_bclk_rx", 2, JH8100_NECLK_I2S0_BCLK, + JH8100_NECLK_I2STX_BCLK_EXT), + STARFIVE__MUX(JH8100_NECLK_I2S0_LRCK_RX, "i2s0_lrck_rx", 2, JH8100_NECLK_I2S0_LRCK, + JH8100_NECLK_I2STX_LRCK_EXT), + STARFIVE__DIV(JH8100_NECLK_I2S1_BCLK, "i2s1_bclk", 32, JH8100_NECLK_MCLK), + STARFIVE__DIV(JH8100_NECLK_I2S1_LRCK, "i2s1_lrck", 128, JH8100_NECLK_I2S1_BCLK), + STARFIVE_GATE(JH8100_NECLK_I2S1_APB, "i2s1_apb", CLK_IGNORE_UNUSED, + JH8100_NECLK_APB_BUS_PER2), + STARFIVE_GATE(JH8100_NECLK_I2S1, "i2s1", CLK_IGNORE_UNUSED, JH8100_NECLK_MCLK), + STARFIVE_GINV(JH8100_NECLK_I2S1_N, "i2s1_n", CLK_IGNORE_UNUSED, JH8100_NECLK_MCLK), + STARFIVE__MUX(JH8100_NECLK_I2S1_BCLK_TX, "i2s1_bclk_tx", 2, JH8100_NECLK_I2S1_BCLK, + JH8100_NECLK_I2STX_BCLK_EXT), + STARFIVE__MUX(JH8100_NECLK_I2S1_LRCK_TX, "i2s1_lrck_tx", 2, JH8100_NECLK_I2S1_LRCK, + JH8100_NECLK_I2STX_LRCK_EXT), + STARFIVE__MUX(JH8100_NECLK_I2S1_BCLK_RX, "i2s1_bclk_rx", 2, JH8100_NECLK_I2S1_BCLK, + JH8100_NECLK_I2STX_BCLK_EXT), + STARFIVE__MUX(JH8100_NECLK_I2S1_LRCK_RX, "i2s1_lrck_rx", 2, JH8100_NECLK_I2S1_LRCK, + JH8100_NECLK_I2STX_LRCK_EXT), + STARFIVE__DIV(JH8100_NECLK_I2S2_BCLK, "i2s2_bclk", 32, JH8100_NECLK_MCLK), + STARFIVE__DIV(JH8100_NECLK_I2S2_LRCK, "i2s2_lrck", 128, JH8100_NECLK_I2S2_BCLK), + STARFIVE_GATE(JH8100_NECLK_I2S2_APB, "i2s2_apb", CLK_IGNORE_UNUSED, + JH8100_NECLK_APB_BUS_PER2), + STARFIVE_GATE(JH8100_NECLK_I2S2, "i2s2", CLK_IGNORE_UNUSED, JH8100_NECLK_MCLK), + STARFIVE_GINV(JH8100_NECLK_I2S2_N, "i2s2_n", CLK_IGNORE_UNUSED, JH8100_NECLK_MCLK), + STARFIVE__MUX(JH8100_NECLK_I2S2_BCLK_TX, "i2s2_bclk_tx", 2, JH8100_NECLK_I2S2_BCLK, + JH8100_NECLK_I2STX_BCLK_EXT), + STARFIVE__MUX(JH8100_NECLK_I2S2_LRCK_TX, "i2s2_lrck_tx", 2, JH8100_NECLK_I2S2_LRCK, + JH8100_NECLK_I2STX_LRCK_EXT), + STARFIVE__MUX(JH8100_NECLK_I2S2_BCLK_RX, "i2s2_bclk_rx", 2, JH8100_NECLK_I2S2_BCLK, + JH8100_NECLK_I2STX_BCLK_EXT), + STARFIVE__MUX(JH8100_NECLK_I2S2_LRCK_RX, "i2s2_lrck_rx", 2, JH8100_NECLK_I2S2_LRCK, + JH8100_NECLK_I2STX_LRCK_EXT), + STARFIVE__DIV(JH8100_NECLK_I2S3_BCLK, "i2s3_bclk", 32, JH8100_NECLK_MCLK), + STARFIVE__DIV(JH8100_NECLK_I2S3_LRCK, "i2s3_lrck", 128, JH8100_NECLK_I2S3_BCLK), + STARFIVE_GATE(JH8100_NECLK_I2S0_STEREO_APB, "i2s0_stereo_apb", CLK_IGNORE_UNUSED, + JH8100_NECLK_APB_BUS_PER2), + STARFIVE_GATE(JH8100_NECLK_I2S0_STEREO, "i2s0_stereo", CLK_IGNORE_UNUSED, + JH8100_NECLK_MCLK), + STARFIVE_GINV(JH8100_NECLK_I2S0_STEREO_N, "i2s0_stereo_n", CLK_IGNORE_UNUSED, + JH8100_NECLK_MCLK), + STARFIVE__MUX(JH8100_NECLK_I2S0_STEREO_BCLK_TX, "i2s0_stereo_bclk_tx", 2, + JH8100_NECLK_I2S3_BCLK, JH8100_NECLK_I2STX_BCLK_EXT), + STARFIVE__MUX(JH8100_NECLK_I2S0_STEREO_LRCK_TX, "i2s0_stereo_lrck_tx", 2, + JH8100_NECLK_I2S3_LRCK, JH8100_NECLK_I2STX_LRCK_EXT), + STARFIVE__MUX(JH8100_NECLK_I2S0_STEREO_BCLK_RX_ICG, "i2s0_stereo_bclk_rx_icg", 2, + JH8100_NECLK_I2S3_BCLK, JH8100_NECLK_I2STX_BCLK_EXT), + STARFIVE__MUX(JH8100_NECLK_I2S0_STEREO_LRCK_RX, "i2s0_stereo_lrck_rx", 2, + JH8100_NECLK_I2S3_LRCK, JH8100_NECLK_I2STX_LRCK_EXT), + STARFIVE_GDIV(JH8100_NECLK_PDM_4MIC_DMIC, "pdm_4mic_dmic", 0, 64, JH8100_NECLK_MCLK), + STARFIVE_GATE(JH8100_NECLK_PDM_4MIC_APB, "pdm_4mic_apb", 0, JH8100_NECLK_APB_BUS_PER2), + STARFIVE_GATE(JH8100_NECLK_PDM_4MIC_SCAN, "pdm_4mic_scan", 0, JH8100_NECLK_I2S3_BCLK), + STARFIVE_GATE(JH8100_NECLK_CAN0_CTRL_PCLK, "can0_ctrl_pclk", CLK_IGNORE_UNUSED, + JH8100_NECLK_APB_BUS_PER2), + STARFIVE_GDIV(JH8100_NECLK_CAN0_CTRL, "can0_ctrl", CLK_IGNORE_UNUSED, 50, + JH8100_NECLK_AXI_400), + STARFIVE_GATE(JH8100_NECLK_CAN0_CTRL_TIMER, "can0_ctrl_timer", CLK_IGNORE_UNUSED, + JH8100_NECLK_OSC), + STARFIVE_GATE(JH8100_NECLK_CAN1_CTRL_PCLK, "can1_ctrl_pclk", CLK_IGNORE_UNUSED, + JH8100_NECLK_APB_BUS_PER2), + STARFIVE_GDIV(JH8100_NECLK_CAN1_CTRL, "can1_ctrl", CLK_IGNORE_UNUSED, 50, + JH8100_NECLK_AXI_400), + STARFIVE_GATE(JH8100_NECLK_CAN1_CTRL_TIMER, "can1_ctrl_timer", CLK_IGNORE_UNUSED, + JH8100_NECLK_OSC), + /* smbus */ + STARFIVE_GATE(JH8100_NECLK_SMBUS0_APB, "smbus0_apb", 0, JH8100_NECLK_APB_BUS_PER2), + STARFIVE_GDIV(JH8100_NECLK_SMBUS0_CORE, "smbus0_core", 0, 120, + JH8100_NECLK_PERH_ROOT_PREOSC), + /* iomux */ + STARFIVE_GATE(JH8100_NECLK_IOMUX_EAST_PCLK, "iomux_east_pclk", 0, + JH8100_NECLK_APB_BUS_PER2), + /* icg_en */ + STARFIVE_GATE(JH8100_NECLK_USB3_ICG_EN, "usb3_en", 0, JH8100_NECLK_USB_WRAP_625), + STARFIVE_GATE(JH8100_NECLK_USB1_ICG_EN, "usb1_en", 0, JH8100_NECLK_USB_WRAP_625), + STARFIVE_GATE(JH8100_NECLK_USB2_ICG_EN, "usb2_en", 0, JH8100_NECLK_USB_WRAP_625), + STARFIVE_GATE(JH8100_NECLK_USBC_ICG_EN, "usbc_en", 0, JH8100_NECLK_USB_WRAP_625), + STARFIVE_GATE(JH8100_NECLK_VENC_ICG_EN, "venc_en", 0, JH8100_NECLK_AXI_400), + STARFIVE_GATE(JH8100_NECLK_WDT0_ICG_EN, "wdt0_en", 0, JH8100_NECLK_APB_BUS_PER2), + STARFIVE_GATE(JH8100_NECLK_SPI0_ICG_EN, "spi0_en", 0, JH8100_NECLK_APB_BUS_PER2), + STARFIVE_GATE(JH8100_NECLK_SPI1_ICG_EN, "spi1_en", 0, JH8100_NECLK_APB_BUS_PER2), + STARFIVE_GATE(JH8100_NECLK_UART0_ICG_EN, "uart0_en", 0, JH8100_NECLK_APB_BUS_PER1), + STARFIVE_GATE(JH8100_NECLK_UART1_ICG_EN, "uart1_en", 0, JH8100_NECLK_APB_BUS_PER1), + STARFIVE_GATE(JH8100_NECLK_UART2_ICG_EN, "uart2_en", 0, JH8100_NECLK_APB_BUS_PER1), + STARFIVE_GATE(JH8100_NECLK_UART3_ICG_EN, "uart3_en", 0, JH8100_NECLK_APB_BUS_PER1), + STARFIVE_GATE(JH8100_NECLK_UART4_ICG_EN, "uart4_en", 0, JH8100_NECLK_APB_BUS_PER1), + STARFIVE_GATE(JH8100_NECLK_I2S0_ICG_EN, "i2s0_en", 0, JH8100_NECLK_MCLK), + STARFIVE_GATE(JH8100_NECLK_I2S1_ICG_EN, "i2s1_en", 0, JH8100_NECLK_MCLK), + STARFIVE_GATE(JH8100_NECLK_I2S2_ICG_EN, "i2s2_en", 0, JH8100_NECLK_MCLK), + STARFIVE_GATE(JH8100_NECLK_I2S_STEREO_ICG_EN, "i2s_stereo_en", 0, JH8100_NECLK_MCLK), + STARFIVE_GATE(JH8100_NECLK_PDM_4MIC_ICG_EN, "pdm_4mic_en", 0, JH8100_NECLK_MCLK), + STARFIVE_GATE(JH8100_NECLK_CAN0_ICG_EN, "can0_en", 0, JH8100_NECLK_AXI_400), + STARFIVE_GATE(JH8100_NECLK_CAN1_ICG_EN, "can1_en", 0, JH8100_NECLK_AXI_400), + STARFIVE_GATE(JH8100_NECLK_SMBUS0_ICG_EN, "smbus0_en", 0, JH8100_NECLK_PERH_ROOT_PREOSC), +}; + +static struct clk_hw *jh8100_necrg_clk_get(struct of_phandle_args *clkspec, void *data) +{ + struct starfive_clk_priv *priv = data; + unsigned int idx = clkspec->args[0]; + + if (idx < JH8100_NECLK_NUM_CLKS) + return &priv->reg[idx].hw; + + return ERR_PTR(-EINVAL); +} + +static int jh8100_necrg_probe(struct platform_device *pdev) +{ + struct starfive_clk_priv *priv; + unsigned int idx; + int ret; + + priv = devm_kzalloc(&pdev->dev, + struct_size(priv, reg, JH8100_NECLK_NUM_CLKS), + GFP_KERNEL); + if (!priv) + return -ENOMEM; + + spin_lock_init(&priv->rmw_lock); + priv->dev = &pdev->dev; + priv->base = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(priv->base)) + return PTR_ERR(priv->base); + + for (idx = 0; idx < JH8100_NECLK_NUM_CLKS; idx++) { + u32 max = jh8100_necrg_clk_data[idx].max; + struct clk_parent_data parents[4] = {}; + struct clk_init_data init = { + .name = jh8100_necrg_clk_data[idx].name, + .ops = starfive_clk_ops(max), + .parent_data = parents, + .num_parents = + ((max & STARFIVE_CLK_MUX_MASK) >> STARFIVE_CLK_MUX_SHIFT) + 1, + .flags = jh8100_necrg_clk_data[idx].flags, + }; + struct starfive_clk *clk = &priv->reg[idx]; + unsigned int i; + + for (i = 0; i < init.num_parents; i++) { + unsigned int pidx = jh8100_necrg_clk_data[idx].parents[i]; + + if (pidx < JH8100_NECLK_NUM_CLKS) + parents[i].hw = &priv->reg[pidx].hw; + else if (pidx == JH8100_NECLK_OSC) + parents[i].fw_name = "osc"; + else if (pidx == JH8100_NECLK_AXI_400) + parents[i].fw_name = "axi_400"; + else if (pidx == JH8100_NECLK_VOUT_ROOT0) + parents[i].fw_name = "vout_root0"; + else if (pidx == JH8100_NECLK_VOUT_ROOT1) + parents[i].fw_name = "vout_root1"; + else if (pidx == JH8100_NECLK_USB_WRAP_480) + parents[i].fw_name = "usb_wrap_480"; + else if (pidx == JH8100_NECLK_USB_WRAP_625) + parents[i].fw_name = "usb_wrap_625"; + else if (pidx == JH8100_NECLK_USB_WRAP_240) + parents[i].fw_name = "usb_wrap_240"; + else if (pidx == JH8100_NECLK_USB_WRAP_60) + parents[i].fw_name = "usb_wrap_60"; + else if (pidx == JH8100_NECLK_USB_WRAP_156P25) + parents[i].fw_name = "usb_wrap_156p25"; + else if (pidx == JH8100_NECLK_USB_WRAP_312P5) + parents[i].fw_name = "usb_wrap_312p5"; + else if (pidx == JH8100_NECLK_USB_125M) + parents[i].fw_name = "usb_125m"; + else if (pidx == JH8100_NECLK_GPIO_100) + parents[i].fw_name = "gpio_100"; + else if (pidx == JH8100_NECLK_PERH_ROOT) + parents[i].fw_name = "perh_root"; + else if (pidx == JH8100_NECLK_MCLK) + parents[i].fw_name = "mclk"; + else if (pidx == JH8100_NECLK_USB3_TAP_TCK_EXT) + parents[i].fw_name = "usb3-tap-tck-ext"; + else if (pidx == JH8100_NECLK_GLB_EXT) + parents[i].fw_name = "glb-ext-clk"; + else if (pidx == JH8100_NECLK_USB1_TAP_TCK_EXT) + parents[i].fw_name = "usb1-tap-tck-ext"; + else if (pidx == JH8100_NECLK_USB2_TAP_TCK_EXT) + parents[i].fw_name = "usb2-tap-tck-ext"; + else if (pidx == JH8100_NECLK_TYPEC_TAP_TCK_EXT) + parents[i].fw_name = "typec-tap-tck-ext"; + else if (pidx == JH8100_NECLK_SPI_IN0_EXT) + parents[i].fw_name = "spi-in0-ext"; + else if (pidx == JH8100_NECLK_SPI_IN1_EXT) + parents[i].fw_name = "spi-in1-ext"; + else if (pidx == JH8100_NECLK_I2STX_BCLK_EXT) + parents[i].fw_name = "i2stx-bclk-ext"; + else if (pidx == JH8100_NECLK_I2STX_LRCK_EXT) + parents[i].fw_name = "i2stx-lrck-ext"; + else if (pidx == JH8100_NECLK_PERH_ROOT_PREOSC) + parents[i].fw_name = "perh_root_preosc"; + else if (pidx == JH8100_NECLK_AHB_DMA) + parents[i].fw_name = "ahb0"; + else if (pidx == JH8100_NECLK_APB_BUS_PER1) + parents[i].fw_name = "apb_bus_per1"; + else if (pidx == JH8100_NECLK_APB_BUS_PER2) + parents[i].fw_name = "apb_bus_per2"; + else if (pidx == JH8100_NECLK_APB_BUS_PER3) + parents[i].fw_name = "apb_bus_per3"; + else if (pidx == JH8100_NECLK_APB_BUS_PER5) + parents[i].fw_name = "apb_bus_per5"; + else if (pidx == JH8100_NECLK_VENC_ROOT) + parents[i].fw_name = "venc_root"; + else if (pidx == JH8100_NECLK_SPI_CORE_100) + parents[i].fw_name = "spi_core_100"; + } + + clk->hw.init = &init; + clk->idx = idx; + clk->max_div = max & STARFIVE_CLK_DIV_MASK; + + ret = devm_clk_hw_register(&pdev->dev, &clk->hw); + if (ret) + return ret; + } + + ret = devm_of_clk_add_hw_provider(&pdev->dev, jh8100_necrg_clk_get, priv); + if (ret) + return ret; + + return jh8100_reset_controller_register(priv, "rst-ne", 2); +} + +static const struct of_device_id jh8100_necrg_match[] = { + { .compatible = "starfive,jh8100-necrg" }, + { /* sentinel */ } +}; + +static struct platform_driver jh8100_necrg_driver = { + .driver = { + .name = "clk-starfive-jh8100-ne", + .of_match_table = jh8100_necrg_match, + .suppress_bind_attrs = true, + }, +}; +builtin_platform_driver_probe(jh8100_necrg_driver, jh8100_necrg_probe); From patchwork Wed Jan 10 13:31:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sia Jee Heng X-Patchwork-Id: 13516159 X-Patchwork-Delegate: mail@conchuod.ie 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 EB177C4707C for ; Wed, 10 Jan 2024 13:32:35 +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=nwiWnAptW2jWyR1rj4bhW4XFda2P8wZqVmQntsQ70os=; b=MatSXSJyUmY9H5 mXHNNxcS5heZQOjFnP0NJA7HdD0r1kHAwuTtZEQ0DVruqJC9gAEWxk5DQ3eCQJnv9bkTs5hMm1xjX nDHo1b4sXOOJwODdlSWUg/r/EsXz6/5habq8KUfFCXV6Euz4B7gjofEDpQ9kwns2agLs9F4eyauXE XoFRxqquG5L+F6td0c+qPj10b6MkM4vBjRLX04Cs6uHNedG7Qyw+Aj3ptur2XphgNNK00Ua7RExZ+ sh6OMGV0WGmA20HaDFkRyuAejICBT3tGcdgmaAbtloQtATxnxb979dCaJVobXC3RI1qMIUG2DoNmz 10cf9FnIdOqfk+5+Iv/w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rNYh2-00BzAD-0j; Wed, 10 Jan 2024 13:32:28 +0000 Received: from mail-sh0chn02on20614.outbound.protection.partner.outlook.cn ([2406:e500:4420:2::614] helo=CHN02-SH0-obe.outbound.protection.partner.outlook.cn) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rNYgz-00BywR-1i for linux-riscv@lists.infradead.org; Wed, 10 Jan 2024 13:32:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=b9Dhd/RI8nQt3DqPdZrW3hPyipZNmcQSM5gXanyow4H5fpE0um/Tsgf/bqkurGnoTGKDE6SZzrtDAC4Rrq861ZHeJVcLN7xZL+TpZU4Wa890jUAHdxKEFFM2iwebuMAKUMAXrlX8lBILClBE0e42L3Z/4kIyObuL6xlumzd4tS/2wMmnRhIw+F/G5StcuCocEx/Ky6ifDoHPERYcLi9Ib+DXe3nlnLRhQbD3BrRSwqbUPyfOrhKGiW1XLQ028npBPHpqxKkdaxHLvtyy5NnHnTVkpyzg0kD0z5ThdQUdAdpwhQsHruf3lRLo0bcvWatsjcE2GxMZjxZzILroJhxwuQ== 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=sU9LGUodSYF8HlW85O3jMRxtjW3fOMhLWffvuLaN/5s=; b=CqACe1ayTJbCHUtikSvTMdmP1/t9BcYBsa+tx27vWGDMpm0CwW9oOuQ0MvyqQ/9jsNqB/CASiM7IIDK3AewWfzD44sK4dBye8yrPQ5Se0golEEoAvla3lVKdlK3kxUq+GekklFBMg8/3sV8PCm+Uo/N2GvokZ7bHk1xWV6/lIyEKuAjFSvH6hsf15n37kfXwmQRVHGmwtYX2AqsPg1I72C35jfarjFq1ZUIRrL0Sr7iI1vNkOqoIxfxQyjZe7CsafZAq7Ni/6vmMrHgzz85wrI7m8H1nbiL08o9nt8YHYabtG0wDVVzixiPMPAQWNGaPsDgoAVoXy5ZXprsBPROdcg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=starfivetech.com; dmarc=pass action=none header.from=starfivetech.com; dkim=pass header.d=starfivetech.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=starfivetech.com; Received: from BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:f::16) by BJSPR01MB0626.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:10::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.33; Wed, 10 Jan 2024 13:32:23 +0000 Received: from BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn ([fe80::3862:65b4:c857:c4a6]) by BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn ([fe80::3862:65b4:c857:c4a6%4]) with mapi id 15.20.7135.033; Wed, 10 Jan 2024 13:32:23 +0000 From: Sia Jee Heng To: kernel@esmil.dk, conor@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, mturquette@baylibre.com, sboyd@kernel.org, p.zabel@pengutronix.de, emil.renner.berthing@canonical.com, hal.feng@starfivetech.com, xingyu.wu@starfivetech.com Cc: linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, jeeheng.sia@starfivetech.com, leyfoon.tan@starfivetech.com, Krzysztof Kozlowski Subject: [RFC v3 11/16] dt-bindings: clock: Add StarFive JH8100 South-West clock and reset generator Date: Wed, 10 Jan 2024 21:31:23 +0800 Message-Id: <20240110133128.286657-12-jeeheng.sia@starfivetech.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240110133128.286657-1-jeeheng.sia@starfivetech.com> References: <20240110133128.286657-1-jeeheng.sia@starfivetech.com> X-ClientProxiedBy: BJXPR01CA0067.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:12::34) To BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:f::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BJSPR01MB0561:EE_|BJSPR01MB0626:EE_ X-MS-Office365-Filtering-Correlation-Id: 004116c4-307d-422c-197c-08dc11e093fd X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +BzRyYS/whqGOfR8sjmardiJ9+LYHzwhO3ITNa7KP7Gh8iUzKE3WjYE8KfhzuiRy/RSNDL8pLPdkM8prImixsKzf2xRMmhsmuh/QpM61/A1yAWAQ0Ct0aMe93rAiOJKosE0CXLih8j007KhIEbmd/nKQLfyPpjE22J0jkjtBDv1Txeafbq+P4AgLwag3bj/9KIJGCECGYWc146ZLU9Ru1V7R3iEcdyOwhhz7adkD7TT5J+jYuW/rA9TWtCyR3oGMdszfqtsKMWIWfg2FGeKjvA9WgO3vNpNPStjMV2Bg0BnvZhBjW0TCx1JWHYG6WXMTWje0TTz49sjk17le2nHKBpu+Tk9m8wPw7g8R239u7JC4tSRtIi9iPtuGUgsRM6t4UsyJ1lWPnBLQTZok1F0X3WAEhDUzDjJQcK2NsJmB7+3DTmJuj/4AVt74qZuvwo9HvpmXSU3JRn/rRdeEZj6MjewjJFo9v40rA9AbQnL7X/0M4O8wKujB9tiEvYqE8tN9T9q3XFIS9hegTU81C4ipsedGftqabOHAu5QKdQrLjBa9x8bgCXu8sCxGlYXKqPnX6jKISY+DWy695fFGqT+WHQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn;PTR:;CAT:NONE;SFS:(13230031)(39830400003)(136003)(346002)(396003)(366004)(230922051799003)(186009)(64100799003)(451199024)(1800799012)(921011)(26005)(52116002)(2616005)(41320700001)(83380400001)(1076003)(86362001)(40160700002)(40180700001)(38100700002)(36756003)(38350700005)(5660300002)(7416002)(4326008)(55236004)(6636002)(66556008)(66476007)(66946007)(41300700001)(2906002)(8936002)(8676002)(966005)(508600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: vaFNxaqH13U1H9C+6ns4QeLFVkza7IOKNOxq8kKa0oGQ68WMMt3uH224Rq1UpRp2181b1PZs3dzWLO96wiMjKX9Mt6qvfVoapDsY524vDtizY4xCOyWMTC2FbYbGsBroTNU1t9sd5Kzw/sMvELTlF4U2CQkWxl5B0gxRxci7XDxXd64IYmhpLQYDNqPWP/KRM/Z2pPgSGVf0Bj4CyRreaQmM4Jv7Grgze2Ym6MCr6O0pAV6hBEPL/XAD1YWcEm9CR8QfM1BEpgpP6uNUwLJPQ43l4NvQefsogBYobjEcVXNVuiETibp+ogi5WqtcgMDKG3/EKgl3EKroXXJJ7o0/3GgVHvgMSv7GhmDQtUmkVJ322sx1rwGs7xRCoC2nFVlUFMT///TY9sIyePR72lCwcDtLYzm5GQkihzJS5Mvb4WofrZXQAha8EvJ3twj4p3m1VsqFodTdJmanVeykS4SVVc1gsixhY5dZmkeQgQ4BQBrpojM9U5jmeNgbJpit5uZPVFEDIpRKWzXV3u5DAYz9blK22F2w6wGe4seUhYDB3E3rF/zHY4ptblkMajp6oQoTPw0hACQsBnlVfq0Zv7jl1zyilWEq8sPOLtE4stiU0FdvE72tfao+FzFmuFjFFHdMJNnjCA2SFZIqy9jMYZsVjP0fUW15xoKNjUvNmrJ9DlakEHcTJndj2LIqOQTSRP96P2T442PfGXxnAIV4fMcNjiQ0uZFQmMGp07moGgoPwCs0DYxT/fC7q9GXrd9Vlzl+Y05NYDvEjA3bkcT4u61ZPLoYmMN69kmGwJiP8u7nDpxOLsZ8Ru/Pk8nL7W+yVPePg4DRp8L02LWfyjBn3rcQPj0A2ZLjH8sCHHZWDsue9Wh+t3+vjk8zXgYPkIS/9Jp96z+fU0A5paYZCqGBFQOH5W1SMgisJ8TtOZntE7UofwozvBpMQ/iT6saCGEai6WfWoulCoUj5y1EB/FLQRYwSnQZe6tylBD1U16XkEgvHZwyWv0LigRvv8tZM7fn6fy+8h4XPzASR8LPm81lvHAKTihoz0frtSEftEZpbzm1AIBdvpoeeTAbLD61tmnHfdcwu9obYi/yxPFckyCM1FEZ4kcSv0ExFZqAUcMDqpN4cjf81neZpOukDyUw/q8ZqxN9gFSjRfEu73iskXL14EQanK4ScmAQevPnkX+Nw7Hem7DMY3dzJqsOsIZaFlzhknklUAMIx6PB/aConw0Vy4rvPMMhfDISQBKRIG8CxyzDf0Muw0TocHF+NINR3TkyjG1MSCHLla04I+KrLpGm9T4aIR/PHL32QlsracifIHQZqDApZDMNkIXXC6NlYCixUw3L8UmNmeZtSfqXW0G42FlUuD1U9pcUY7rB4vJ48bYOphsGhmiXCj/EgXv0e3QqQRG++nAfiIq8WHYoWG0MWdn1NWTxzrfmEsrjwAovXJlG75z4ku1xa6t/Z4kGpv8JmyK5exVlxpSaPzHJoXrLqD1N/375tss88SJOcsBI3gM4ZpQeiVI3Rs9KbZSrFzM7Hf4usG31o/B6vU7AZCkzCdTwquNKf05y1QPLe2kSWbSGa9ZzrheVRXPcdrBD4WiNKCdrqPBTirsBXszGC01XSKWO0N2Ify6dVJkBQegOInKCNieM= X-OriginatorOrg: starfivetech.com X-MS-Exchange-CrossTenant-Network-Message-Id: 004116c4-307d-422c-197c-08dc11e093fd X-MS-Exchange-CrossTenant-AuthSource: BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jan 2024 13:32:23.4757 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 06fe3fa3-1221-43d3-861b-5a4ee687a85c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: OuXB0g0EY/684ohXJ6xvPu1DYNeawsMN9P6+zhKDwfHWHuPWG5tov/u/XTxnI9ubhBAQnPnkZFtsMGsk1c5g8hpDfz8xicHl4qz8lah3PBY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BJSPR01MB0626 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240110_053225_595038_05CF3F23 X-CRM114-Status: GOOD ( 13.47 ) X-BeenThere: linux-riscv@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-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Add bindings for the South-West clock and reset generator (SWCRG) on JH8100 SoC. Signed-off-by: Sia Jee Heng Reviewed-by: Ley Foon Tan Reviewed-by: Krzysztof Kozlowski --- .../bindings/clock/starfive,jh8100-swcrg.yaml | 64 +++++++++++++++++++ .../dt-bindings/clock/starfive,jh8100-crg.h | 12 ++++ .../dt-bindings/reset/starfive,jh8100-crg.h | 8 +++ 3 files changed, 84 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/starfive,jh8100-swcrg.yaml diff --git a/Documentation/devicetree/bindings/clock/starfive,jh8100-swcrg.yaml b/Documentation/devicetree/bindings/clock/starfive,jh8100-swcrg.yaml new file mode 100644 index 000000000000..287dff7e91e3 --- /dev/null +++ b/Documentation/devicetree/bindings/clock/starfive,jh8100-swcrg.yaml @@ -0,0 +1,64 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/clock/starfive,jh8100-swcrg.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: StarFive JH8100 South-West Clock And Reset Generator + +maintainers: + - Sia Jee Heng + +properties: + compatible: + const: starfive,jh8100-swcrg + + reg: + maxItems: 1 + + clocks: + items: + - description: APB_BUS clock from SYSCRG + - description: VDEC_ROOT clock from SYSCRG + - description: FLEXNOC1 clock from SYSCRG + + clock-names: + items: + - const: apb_bus + - const: vdec_root + - const: flexnoc1 + + '#clock-cells': + const: 1 + description: + See for valid indices. + + '#reset-cells': + const: 1 + description: + See for valid indices. + +required: + - compatible + - reg + - clocks + - clock-names + - '#clock-cells' + - '#reset-cells' + +additionalProperties: false + +examples: + - | + #include + + clock-controller@12720000 { + compatible = "starfive,jh8100-swcrg"; + reg = <0x12720000 0x10000>; + clocks = <&syscrg JH8100_SYSCLK_APB_BUS>, + <&syscrg JH8100_SYSCLK_VDEC_ROOT>, + <&syscrg JH8100_SYSCLK_FLEXNOC1>; + clock-names = "apb_bus", "vdec_root", "flexnoc1"; + #clock-cells = <1>; + #reset-cells = <1>; + }; diff --git a/include/dt-bindings/clock/starfive,jh8100-crg.h b/include/dt-bindings/clock/starfive,jh8100-crg.h index c37b42f3eacd..7b337c1495be 100644 --- a/include/dt-bindings/clock/starfive,jh8100-crg.h +++ b/include/dt-bindings/clock/starfive,jh8100-crg.h @@ -339,4 +339,16 @@ #define JH8100_NECLK_CAN1_ICG_EN 173 #define JH8100_NECLK_SMBUS0_ICG_EN 174 +/* SWCRG clocks */ +#define JH8100_SWCLK_JPEG_AXI 0 +#define JH8100_SWCLK_VC9000DJ_AXI 1 +#define JH8100_SWCLK_VC9000DJ_VDEC 2 +#define JH8100_SWCLK_VC9000DJ_APB 3 +#define JH8100_SWCLK_VDEC_AXI 4 +#define JH8100_SWCLK_VC9000D_AXI 5 +#define JH8100_SWCLK_VC9000D_VDEC 6 +#define JH8100_SWCLK_VC9000D_APB 7 +#define JH8100_SWCLK_JPEG_ICG_EN 8 +#define JH8100_SWCLK_VDEC_ICG_EN 9 + #endif /* __DT_BINDINGS_CLOCK_STARFIVE_JH8100_H__ */ diff --git a/include/dt-bindings/reset/starfive,jh8100-crg.h b/include/dt-bindings/reset/starfive,jh8100-crg.h index 30a99c78341a..de4f25dc301d 100644 --- a/include/dt-bindings/reset/starfive,jh8100-crg.h +++ b/include/dt-bindings/reset/starfive,jh8100-crg.h @@ -91,4 +91,12 @@ #define JH8100_NERST_SYS_IOMUX_E 48 #define JH8100_NERST_DUBHE_TVSENSOR 49 +/* + * SWCRG resets: assert0 + */ +#define JH8100_SWRST_PRESETN 0 +#define JH8100_SWRST_VC9000DJ 1 +#define JH8100_SWRST_VC9000D 2 +#define JH8100_SWRST_DDR_TVSENSOR 3 + #endif /* __DT_BINDINGS_RESET_STARFIVE_JH8100_H__ */ From patchwork Wed Jan 10 13:31:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sia Jee Heng X-Patchwork-Id: 13516161 X-Patchwork-Delegate: mail@conchuod.ie 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 CD52AC4707B for ; Wed, 10 Jan 2024 13:32:49 +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=wZEaapnMJb+UN7YTCqn2kwOS4xFLuDXw8d1yG1G/7+E=; b=3yzpSK8jhB4Idm C1VR5Ml8jCsNt78r1O3oGcJcnKhPxTIJmDB3wtD6quLUwD3rsIloGYquv7KK5rIA+OdwkRgsW4Lxj dqEMAwSe8Wtipnrye8F2jDPWaWs3cMDBDNNODvLJoumHaVLnzV9xWZMPw5gbsvNMeKe1JbPIHc1MW WhrM7C8hNUNAxGdup+g18qstvtBeWK4N9KMPMx2ccCzLELm3zUpwzmb+Hvx6oj3EBx5dhmGEX4WaK XNXBxvDHpoNkHDkLZq62gCsn2AuW46GMfL+j1BFf6W5YYXMsCOX+g8dJPUn6tsECdqk0iLPTOeWML Iw+awyeT1Ym7KNRJ2Eew==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rNYhC-00BzKy-35; Wed, 10 Jan 2024 13:32:39 +0000 Received: from mail-sh0chn02on2062a.outbound.protection.partner.outlook.cn ([2406:e500:4420:2::62a] helo=CHN02-SH0-obe.outbound.protection.partner.outlook.cn) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rNYh9-00BzCn-1O for linux-riscv@lists.infradead.org; Wed, 10 Jan 2024 13:32:37 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iMq5FN8ebFbr/dqY9vwLDrxD9bchv2P7Yfkj27VHbvNl58hgwNeIwCh9xhwoFPtqvbbONEku+6zumI+YQE7Dcb51c+bdlvJAU261uqcwTU0ZiCWHIocgwfv1nW7v8j7DeBRAeRYIH5M1ab7rvuNvj7Vfms3tJ1uPSB1GWx7t52TfslQwTpIC4Jqn2AJ3Ls8dYLdI0HoGGW/6oe65uJQylRB/iJQaV0klgwByUL8VulCTCA+7TdNiV2h5GG1C85jl4gbyIRPPVokKp20FoYXg1zsogIHwzaV0Pl/Tkyt9V2wBAV1aKxbY2j5ltFwovNy/ywTM/7DwQ57xGG18Xs4wGQ== 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=lSRkXU9BfabriSMC3ca8IBms3ZqZ3OTXIxVD5Z5+odk=; b=WWxUlZOvsS/jAObbtrVUNZ+XuL2xrNwCGdveheOWoMAIQOse7cDfMHQiPyIdj2e3zqKnYIrGJIDGK8zwcInCJCzYZp1yyCEXWz8BPuty0r5uggmX377m/WdHip/UTRa1ow9mLl0DKrhLv7moDfcfg2pf9gU3v9kfpE5HZ6n3RDX/FwXIChFx0LW1KWrENwqZeHW9NJv7fUdr9duRPPaf/wbnzcMMxCLsWeMrM6vJ/OBJNSqcx0W6iMEmDsFcGuAe9IxVIr1QL9WXp1jc7E6ftAssMjdHeU4dh3J7MbrFkrpgRjvTf86r4xVZq3wYX3xIRamP7/bvpZ/j+8zfSmh5pA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=starfivetech.com; dmarc=pass action=none header.from=starfivetech.com; dkim=pass header.d=starfivetech.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=starfivetech.com; Received: from BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:f::16) by BJSPR01MB0626.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:10::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.33; Wed, 10 Jan 2024 13:32:27 +0000 Received: from BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn ([fe80::3862:65b4:c857:c4a6]) by BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn ([fe80::3862:65b4:c857:c4a6%4]) with mapi id 15.20.7135.033; Wed, 10 Jan 2024 13:32:27 +0000 From: Sia Jee Heng To: kernel@esmil.dk, conor@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, mturquette@baylibre.com, sboyd@kernel.org, p.zabel@pengutronix.de, emil.renner.berthing@canonical.com, hal.feng@starfivetech.com, xingyu.wu@starfivetech.com Cc: linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, jeeheng.sia@starfivetech.com, leyfoon.tan@starfivetech.com Subject: [RFC v3 12/16] clk: starfive: Add JH8100 South-West clock generator driver Date: Wed, 10 Jan 2024 21:31:24 +0800 Message-Id: <20240110133128.286657-13-jeeheng.sia@starfivetech.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240110133128.286657-1-jeeheng.sia@starfivetech.com> References: <20240110133128.286657-1-jeeheng.sia@starfivetech.com> X-ClientProxiedBy: BJXPR01CA0067.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:12::34) To BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:f::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BJSPR01MB0561:EE_|BJSPR01MB0626:EE_ X-MS-Office365-Filtering-Correlation-Id: 8433f7ae-58e4-472d-a711-08dc11e0961c X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Lm3cc2vKNR88UHi5pXXaXMagNMOczNEu8MIP7DefQIAuxRSHj6g5UBxqbwHY2KsihnojoeA15f1tqO4uY9biY2yApX10qH5y+TnJwzgdetrFm8j72HriOJ1E0BTkPZ2fmqPkFD4ZEDGRh6StYDMnmWtTodcU6H/tHX97kEiotwt/N0pm9fr0vDum2HS1y4o5lR9rMwH2w7CNyRnIOe+3oBK+rQrnRKPQRinMhfSf1uvLxaoJ5ngmmSoNtwWAm0uhhT4tczgG3ZifHU9vXNmmJr0wF67oxS3jZk8xR22ECQVckcnYSVZH3a40lncISD8gv5TKgxhHS28Xc+JirjdfKsCT3WyldXvkCeEy4tueT3rByLdrIpEsUhZuw5HsImatdg/co+ERQ5Ea62GB6Z63C16lmGsykbzInezRlwRAy3GmefDtHbgrNeD8LYbqbp6/6oAHfHejY941+mRAauiRFfiuRPJwqp2LuXI3DJ1mY4J01s2Dc1uGr5KfVQn20c18llG0t7uO6Ode0w/QKQ5wc1X6iaEYAxr0EWW8EhHgLhzRpMzxRk7q0VlfG0XkQzzQX0xagSIDSTNPmibpB7T60kk370rZPTnKbHfH3ROpIGqcb3F/ABY6QeqDQ9e8h3mb X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn;PTR:;CAT:NONE;SFS:(13230031)(39830400003)(136003)(346002)(396003)(366004)(230273577357003)(230922051799003)(230173577357003)(186009)(64100799003)(451199024)(1800799012)(921011)(26005)(107886003)(52116002)(2616005)(41320700001)(6666004)(83380400001)(1076003)(86362001)(40160700002)(40180700001)(38100700002)(36756003)(38350700005)(5660300002)(7416002)(4326008)(55236004)(6636002)(66556008)(66476007)(66946007)(41300700001)(2906002)(8936002)(8676002)(508600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: wOBBZYHV4rkJ6+aPZQWAfKDPMPz/zirmEJqdNwzuSNzAMSRWmvMmQ3pao0Dx338pZYQy8wMaTZaiRMbDRrAen4mrjvruaIbC4OaUDQdrMVK8yIM57NhzPXe1hxzvVbTqtDA54fBRsKNeVFgKhzIJ/g7zZ1cnhrWzPbo2g1xHFH/pFsqqeuavVPK+tREWs3loiOsUWafPbRgEoJtAKnY2BdgDzNpoZDIXkbbN3ytdxd2Lb5xzkKxkxMspUJM0QHKhgmIFu4judne+ojbWrz1xrHApT/9+6CboJnaMD5Loqwz6jC/zqz7Hi6lVQPbP9GRnB4tz4KQoNiXZqvnLu0sNEWdorFE7XUZTBShquCE+KzV9FqRgWk7+85zXu3okoHehvvQGNnSFhfTS35qNEHkjxfEG1JiKQ71D4S2kQo8Bzrk2UMCLXff9Mw/Fc6Z+SXuRcYeWTvTePQG+HbJcqiB1xodHj6BvHYwuCE+QKEjiwmQ+MIeQAywfrM2q1XwLarg2cR4l3Oj8AW3fQqaGAodTakm/Ei7olvaRFn3+7Yn0YXw982isbbFJqk80pYgE2KJD4APEOZFQDuI++ViLjVRS/fsSoyYvzf/0nef7GdMmUa1GzBeyMgidvtIBtg6wYwH15F4+7rYqCuE4e7DRn7j4RSDuwA/xyy88Q5VTDk0Pp5cIL7hcCRhmiMaZfbij+EiU60BoiouL1Z1om3w+M9pqCxOfSyxqSDZm/YwZIKCItkOtu0JzCYmanIXY4TzZ7ErYZo+oTUbz9eFJU8JRPy8vZO8c99EUYuwu7FXMu3JBCqDY90WxGwHRoMp23thbsxguhsGuVTfiHB2AKMtT0WLA2In2W0+za+XHeIEgfkIA18OnRQ6N80q1Ovx0PwUtViqMtTwS3l6QqR2/O6pZhhEFs2OoSV+PrUCMv7VGDMYmxiqf/pZfXtXQeGXQQLNKnRL9nYcIQwCJf/PsVMhBDnQ2aLf5UWpJv6MKyyI8/ZG6gx6zaKHCXnWNLAmYYP81cUgnpF45u1wecEnLeZWCrz2KYulEyG8bm0nPIRgC4o9nOwy7YSmQJ81r/s1wvLtovTYQRAEK8HIWA9b3Lv3t+evv1gZwL1eEdWwIIn5bVj6WrIdWNrIvC9nwlH0Ee02PRBCEjYbrQs1Gn75n030W5HMz/hs4raSiliD55V0w6NzA03oQj/sjRCi2AgcqHdd1VmkvYn4xOrAEYd635xGYmLBuaxbzSdymGKNg0UASn+WlcdWC7omucilfcD6F3Mb6ZUXog0FfM0KQphDC54HV4UeFwYAlLfSnPdJggEOz/XV+oza5sZV4FhqOKmfWCwDq9o6TKLqgq/1ivvOymLaZmX58ZDe8HOjLo/e1q+CSD6nbtQeXVlBtXNtDE5MxxiJ1wEZe4cTfMkl4f3GUMjmVYE5Q50yTG45LQgha6iEppTmXq+6mNJjIKoLUKv387glhgDwp8hruJ+6p1J2Fed6AYHPKe9IrFs1tF8JgsAqbjoq0s3tjv/o7e4RWcHU7SXLw6fLS+up584FdmfKUCZzmGONl7O14xYZZzNBFhJFsDBxy8QulHvi3Xym2IhgjHMGjJISewoVnwKM6Hocu3/nGodeDtoD/np2078bQq3DbPMinK/w= X-OriginatorOrg: starfivetech.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8433f7ae-58e4-472d-a711-08dc11e0961c X-MS-Exchange-CrossTenant-AuthSource: BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jan 2024 13:32:27.0506 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 06fe3fa3-1221-43d3-861b-5a4ee687a85c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: yYRQ3ZIN5CHunGCZPXlJo1fdilGAXkkym3BunxwJoJaS/6CHmUlzhbadJT+OjSr/6C0xm/zqA8vEYnuGnd9+jlljxCtfBQ0VJKFCigJwPmY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BJSPR01MB0626 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240110_053235_472575_93A190CA X-CRM114-Status: GOOD ( 19.40 ) X-BeenThere: linux-riscv@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-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Add support for JH8100 South-West (SWCRG) clock generator. Signed-off-by: Sia Jee Heng Reviewed-by: Ley Foon Tan --- drivers/clk/starfive/Kconfig | 7 + drivers/clk/starfive/Makefile | 1 + drivers/clk/starfive/clk-starfive-jh8100-sw.c | 134 ++++++++++++++++++ 3 files changed, 142 insertions(+) create mode 100644 drivers/clk/starfive/clk-starfive-jh8100-sw.c diff --git a/drivers/clk/starfive/Kconfig b/drivers/clk/starfive/Kconfig index 23968e97969b..23ae894fedb9 100644 --- a/drivers/clk/starfive/Kconfig +++ b/drivers/clk/starfive/Kconfig @@ -95,3 +95,10 @@ config CLK_STARFIVE_JH8100_NE default ARCH_STARFIVE help Say yes here to support the North-East clock controller on the StarFive JH8100 SoC. + +config CLK_STARFIVE_JH8100_SW + bool "StarFive JH8100 South-West clock support" + depends on CLK_STARFIVE_JH8100_SYS + default ARCH_STARFIVE + help + Say yes here to support the South-West clock controller on the StarFive JH8100 SoC. diff --git a/drivers/clk/starfive/Makefile b/drivers/clk/starfive/Makefile index cecce3655600..242e2e75dadb 100644 --- a/drivers/clk/starfive/Makefile +++ b/drivers/clk/starfive/Makefile @@ -14,3 +14,4 @@ obj-$(CONFIG_CLK_STARFIVE_JH7110_VOUT) += clk-starfive-jh7110-vout.o obj-$(CONFIG_CLK_STARFIVE_JH8100_SYS) += clk-starfive-jh8100-sys.o obj-$(CONFIG_CLK_STARFIVE_JH8100_NW) += clk-starfive-jh8100-nw.o obj-$(CONFIG_CLK_STARFIVE_JH8100_NE) += clk-starfive-jh8100-ne.o +obj-$(CONFIG_CLK_STARFIVE_JH8100_SW) += clk-starfive-jh8100-sw.o diff --git a/drivers/clk/starfive/clk-starfive-jh8100-sw.c b/drivers/clk/starfive/clk-starfive-jh8100-sw.c new file mode 100644 index 000000000000..f583f7d984ed --- /dev/null +++ b/drivers/clk/starfive/clk-starfive-jh8100-sw.c @@ -0,0 +1,134 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * StarFive JH8100 South-West Clock Driver + * + * Copyright (C) 2023 StarFive Technology Co., Ltd. + * + * Author: Jee Heng Sia + * + */ + +#include +#include +#include +#include +#include + +#include + +#include "clk-starfive-jh8100.h" + +#define JH8100_SWCLK_NUM_CLKS (JH8100_SWCLK_VDEC_ICG_EN + 1) + +/* external clocks */ +#define JH8100_SWCLK_APB_BUS (JH8100_SWCLK_NUM_CLKS + 0) +#define JH8100_SWCLK_VDEC_ROOT (JH8100_SWCLK_NUM_CLKS + 1) +#define JH8100_SWCLK_FLEXNOC1 (JH8100_SWCLK_NUM_CLKS + 2) + +static const struct starfive_clk_data jh8100_swcrg_clk_data[] = { + /* jpeg */ + STARFIVE__DIV(JH8100_SWCLK_JPEG_AXI, "jpeg_axi", 20, JH8100_SWCLK_VDEC_ROOT), + STARFIVE_GATE(JH8100_SWCLK_VC9000DJ_AXI, "vc9000dj_axi", CLK_IGNORE_UNUSED, + JH8100_SWCLK_JPEG_AXI), + STARFIVE_GDIV(JH8100_SWCLK_VC9000DJ_VDEC, "vc9000dj_vdec", CLK_IGNORE_UNUSED, 40, + JH8100_SWCLK_VDEC_ROOT), + STARFIVE_GATE(JH8100_SWCLK_VC9000DJ_APB, "vc9000dj_apb", CLK_IGNORE_UNUSED, + JH8100_SWCLK_APB_BUS), + /* video dec */ + STARFIVE__DIV(JH8100_SWCLK_VDEC_AXI, "vdec_axi", 20, JH8100_SWCLK_VDEC_ROOT), + STARFIVE_GATE(JH8100_SWCLK_VC9000D_AXI, "vc9000d_axi", CLK_IGNORE_UNUSED, + JH8100_SWCLK_VDEC_AXI), + STARFIVE_GDIV(JH8100_SWCLK_VC9000D_VDEC, "vc9000d_vdec", CLK_IGNORE_UNUSED, 40, + JH8100_SWCLK_FLEXNOC1), + STARFIVE_GATE(JH8100_SWCLK_VC9000D_APB, "vc9000d_apb", CLK_IGNORE_UNUSED, + JH8100_SWCLK_APB_BUS), + /* icg_en */ + STARFIVE_GATE(JH8100_SWCLK_JPEG_ICG_EN, "jpeg_en", 0, JH8100_SWCLK_VDEC_ROOT), + STARFIVE_GATE(JH8100_SWCLK_VDEC_ICG_EN, "vdec_en", 0, JH8100_SWCLK_VDEC_AXI), +}; + +static struct clk_hw *jh8100_swcrg_clk_get(struct of_phandle_args *clkspec, void *data) +{ + struct starfive_clk_priv *priv = data; + unsigned int idx = clkspec->args[0]; + + if (idx < JH8100_SWCLK_NUM_CLKS) + return &priv->reg[idx].hw; + + return ERR_PTR(-EINVAL); +} + +static int jh8100_swcrg_probe(struct platform_device *pdev) +{ + struct starfive_clk_priv *priv; + unsigned int idx; + int ret; + + priv = devm_kzalloc(&pdev->dev, + struct_size(priv, reg, JH8100_SWCLK_NUM_CLKS), + GFP_KERNEL); + if (!priv) + return -ENOMEM; + + spin_lock_init(&priv->rmw_lock); + priv->dev = &pdev->dev; + priv->base = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(priv->base)) + return PTR_ERR(priv->base); + + for (idx = 0; idx < JH8100_SWCLK_NUM_CLKS; idx++) { + u32 max = jh8100_swcrg_clk_data[idx].max; + struct clk_parent_data parents[4] = {}; + struct clk_init_data init = { + .name = jh8100_swcrg_clk_data[idx].name, + .ops = starfive_clk_ops(max), + .parent_data = parents, + .num_parents = + ((max & STARFIVE_CLK_MUX_MASK) >> STARFIVE_CLK_MUX_SHIFT) + 1, + .flags = jh8100_swcrg_clk_data[idx].flags, + }; + struct starfive_clk *clk = &priv->reg[idx]; + unsigned int i; + + for (i = 0; i < init.num_parents; i++) { + unsigned int pidx = jh8100_swcrg_clk_data[idx].parents[i]; + + if (pidx < JH8100_SWCLK_NUM_CLKS) + parents[i].hw = &priv->reg[pidx].hw; + else if (pidx == JH8100_SWCLK_APB_BUS) + parents[i].fw_name = "apb_bus"; + else if (pidx == JH8100_SWCLK_VDEC_ROOT) + parents[i].fw_name = "vdec_root"; + else if (pidx == JH8100_SWCLK_FLEXNOC1) + parents[i].fw_name = "flexnoc1"; + } + + clk->hw.init = &init; + clk->idx = idx; + clk->max_div = max & STARFIVE_CLK_DIV_MASK; + + ret = devm_clk_hw_register(&pdev->dev, &clk->hw); + if (ret) + return ret; + } + + ret = devm_of_clk_add_hw_provider(&pdev->dev, jh8100_swcrg_clk_get, priv); + if (ret) + return ret; + + return jh8100_reset_controller_register(priv, "rst-sw", 3); +} + +static const struct of_device_id jh8100_swcrg_match[] = { + { .compatible = "starfive,jh8100-swcrg" }, + { /* sentinel */ } +}; + +static struct platform_driver jh8100_swcrg_driver = { + .driver = { + .name = "clk-starfive-jh8100-sw", + .of_match_table = jh8100_swcrg_match, + .suppress_bind_attrs = true, + }, +}; +builtin_platform_driver_probe(jh8100_swcrg_driver, jh8100_swcrg_probe); From patchwork Wed Jan 10 13:31:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sia Jee Heng X-Patchwork-Id: 13516162 X-Patchwork-Delegate: mail@conchuod.ie 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 CFB23C4707C for ; Wed, 10 Jan 2024 13:32:50 +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=RGdF+nQAZeM+7/AlXZBDw5EV9oj6PnWrNYLtIKVsfZQ=; b=ekW/GmtLLO4x6p HowlDI+4GNkkDfRi3UBUouqOlbpDf9KkSNhDe/NUN9LoqQlAgicYW9StFDpt+5RKn9/s+rQc0k2W4 uWZHLhiuNO2kri4ZW30PdM8U1xA5QVrIHlSiLlfzB+XSfGFra+Q6H+FxtnvzzB5qhN+1u/qgt68Bz o77zNqj/2cim/4ufn6w8V1HdlOX9b1h3JVRPALVOdPWV/eNtE25GseP9zKQVHlWfZZzmbR2SomOg/ jTI7r+3vYPgyK8kzGOlvGad1rauY9PyepCFoMy3lW0ymksEEqN7iNYKiU1Jc9Ok4sHjkVeFh2pPNA Az4dg21JKWHWQHZ0pFpA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rNYhG-00BzP9-03; Wed, 10 Jan 2024 13:32:42 +0000 Received: from mail-sh0chn02on2062a.outbound.protection.partner.outlook.cn ([2406:e500:4420:2::62a] helo=CHN02-SH0-obe.outbound.protection.partner.outlook.cn) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rNYhB-00BzCn-2Z for linux-riscv@lists.infradead.org; Wed, 10 Jan 2024 13:32:39 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JPtrEEdrFwLPB+ZtK6YWa3nSgfsLiEoB8nAif0uCS6iiAsz3YDbZvEENjwjkSw5eSNd9jKQdF6wBQXzUjKMQS0G5WYGBI8lqatu3LJvGSGNt5UmcRC07R3M6BCGrsSMIEZ51pm5nwE+54Co9G+f0jzPntsVkJRm32b4ACJ/Zo3c5hy86naoOUpqfuXZTmLljx2Lh9NPHeJfAXudi164h9wKTKChY7ROrooW/o1NXE9YZsHQo64CVTXKzlIR5mOkkNnwYAAK3HK9zQcsNeWdyiBYzPoHCO4Zn5FslZfpjAa5F6To+TxbCRal888H5d+VwH2biAOSFVB9e5/vKxqn4Jg== 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=/AYcpDZUu1D3OVsJJN37tZ+6we1npeB3N3ndEhOmXLs=; b=jYRI0zNyG6VFyLtN2KuwqibCyEUxYuztX12Whc+SfzbHbVdWwlESK+RDV+L/RTwkgUb4FtX+rvnO89rc6XYZLL6tmt/7ctxRgxJ6cHJ8cavBTAXZwzgqIjJh6JmbXUZ8iOnHL3IQBjhdIXl0HEOejXcA7QKVbZU/GFxjrondFe+6I3APM4S+ji6w3a5ynmZPDT6UeD322BD5H3P7rPYsLnU17v943ra2IqJ4cPQQXTSB4VHr2KkUlKrKGOfjpGQvmQbcNW7Vt7ruHXZocKtDNGZXc4+RKQiH4aKp+C1yfpD8XXKGE7i5bx8kinYh/OSBY8ag5VbQdEjiz2eAQ5GWwQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=starfivetech.com; dmarc=pass action=none header.from=starfivetech.com; dkim=pass header.d=starfivetech.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=starfivetech.com; Received: from BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:f::16) by BJSPR01MB0626.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:10::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.33; Wed, 10 Jan 2024 13:32:30 +0000 Received: from BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn ([fe80::3862:65b4:c857:c4a6]) by BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn ([fe80::3862:65b4:c857:c4a6%4]) with mapi id 15.20.7135.033; Wed, 10 Jan 2024 13:32:30 +0000 From: Sia Jee Heng To: kernel@esmil.dk, conor@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, mturquette@baylibre.com, sboyd@kernel.org, p.zabel@pengutronix.de, emil.renner.berthing@canonical.com, hal.feng@starfivetech.com, xingyu.wu@starfivetech.com Cc: linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, jeeheng.sia@starfivetech.com, leyfoon.tan@starfivetech.com, Krzysztof Kozlowski Subject: [RFC v3 13/16] dt-bindings: clock: Add StarFive JH8100 Always-On clock and reset generator Date: Wed, 10 Jan 2024 21:31:25 +0800 Message-Id: <20240110133128.286657-14-jeeheng.sia@starfivetech.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240110133128.286657-1-jeeheng.sia@starfivetech.com> References: <20240110133128.286657-1-jeeheng.sia@starfivetech.com> X-ClientProxiedBy: BJXPR01CA0067.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:12::34) To BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:f::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BJSPR01MB0561:EE_|BJSPR01MB0626:EE_ X-MS-Office365-Filtering-Correlation-Id: 57cb3b5d-0511-481d-d05a-08dc11e09858 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mRds0sP/d70rTNftt02g44N7/qOAsi0wvP65EdZx7B3LzkKm3erLfvLLz0s1Qm9CCJBNJZZl7CmfZfUCIDIh2pCXR4oM5X/aCXKi0MR98gxkUsiR0jN7J702ZCBdDlGRmW4pZx+9haRFK9Us88nP2parb5x3UaJ4uKmB+ucDf6xR7T2mbH5n/PKC5sqBis60n7y2/Ky7imL3A0F96FePkiTXNax3jc1ugeJ+1S9mkuj0O/1OMKHgfHzpgZQB+edhtjSnPILwfmfiAjulJBQ9kRXjwCVV9NG/fQgXMInpojlugarNqT6AhZ8m5rQ9XRkKTysGvyPRrb0VDt5g7uhBNIfIemzU/j5Xu2s4Agzu4XKmAR+jEDb7uDddKJ49F9WmRR8FOJgBk5mU2gs6Za2NwysfsPACAwe28P9dWsI5r+oMEQaH3Ush8jDDfN6Z5C7oLpuokIIiwShp9eh23CF/bOa6CHhUVsoIf+NwmeldX5sOZd3+krJjB2vASz9PgjcDD8cKUwOfL4jKmoR9nYQz4I+vcMHe8dtZUQXOncvAKN7/Nn2X+LH0XR2Yu9Q65UZP/CKida0EXaj8OvEmpxLgGg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn;PTR:;CAT:NONE;SFS:(13230031)(39830400003)(136003)(346002)(396003)(366004)(230922051799003)(186009)(64100799003)(451199024)(1800799012)(921011)(26005)(52116002)(2616005)(41320700001)(6666004)(83380400001)(1076003)(86362001)(40160700002)(40180700001)(38100700002)(36756003)(38350700005)(5660300002)(7416002)(4326008)(55236004)(6636002)(66556008)(66476007)(66946007)(41300700001)(2906002)(8936002)(8676002)(966005)(508600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: +amrCg5e5ccY0jARzpMSATp+bU9haiZI1boxMXg1Ho1DT2RNZJ+ip97O+L53rqB+kiVarP1XLqGWBxRdQ3XOUiu9zJBb4QXz6WZOyVJJSe2eFtZC/R9UGKmxQM7f6QR7MlsFVSSDGgHxSqaigMrJF8CM0Ot1PqnSseexsP16Ca4PPAW83nmFzfKb7f4S9G42G//mIU2gSV4yZ+uDbXriKcuTDOUg7R7/deQAMTgFZIyUzTKT/CmTnX0TDdZkZUJX1AiW/WBOBPdPyThFlYR66uQ+DligmVC9dx+bAY5g1L8bQz6rqU19lG9RlViC2yep0oHmlM2Mn+FXdaTtFvInqmcX603M47KVrr2/GhEXEzHEROLlo24gcYN60BdKV90pyzb0OqVM+vEKUaLR/lN7S/QMYnKOjM5Ugz6WeEVLnIPj7tgkyKVCQIGPB9+uJpAys82el/jUHsGnFzRrWEti7zorEm5q1aPSSMlGTAAXNrqgoc5luar+5QIIf2uDAZVBo5K+3XyRscSnQ4Tof+AUY6KjxfymwfwwMs7d+tIY9eXz4n/dotEt9lZJu4gk42WQuq5kF5jNYpluS1VWXUARkbGW4TjzzrYlf80JQhZL1WhzCOqFV47uXsDyjpDrnoE7VvrkB9Txp6BvghjwlVNmN/DPBBI1wbyzFnOdtnVGixs6xW0Fz/TRPZ6proPBxV4dNhpxmoSSGJRhgPnvzSgrEqRFCL+xEbl4C+Uwd7gwhJdCoSy2my+tV5h1bZMpznbAENNNO06Cr2H/rJ32heE2li5ZyPnZ+rPnZ51doDXgdYcm5/zhbilHirzUH1iU4arSp1SMRL9yqd0X6B+fQfIjiLimBo8+v+7qFXSq5I1IFJjV0fyHskalZEsRCAzHDjzIkuAqwQiBnb7q2zku5I+GBP/QZXKAJCzcXEBf1D4z1WXdeCHVeau74hE3WOmqBjOs+vYoAdN4VpbiSSwIQ2P56aFFBvHUGPC8aTyCx8ECOSj9O5C+ZHsRGUkOn1l3do70sq95NeSvkXnxp7k//3wtP2/ALgcBWY/qdL8Jl+FGQBofqZq+hJ7nOU1rgTs/JUKdYrZSUSjpJovkiJiUsaXZiSmRxBO5pGfx/vYkwH9R+3zoj3uYbsdWwuxAKru7nIvPUahFpw8BMNpNXoRwS1uhiNsOyBDFS7wyFj/tyQnoeGReV0mbK3VN2LKG5QAkwVKhOM4wLya1r2WC7fDpuxHRFOQ+dXhs6T46jpjf/rhgib9rBlw9Ym8017vIfdc7SzLGFi9g9UIp7q+doo7Vw2BlhqdG61GCH4rdUR88FnQTZbCiXBLIqpJCGgjaPdeXZsGOhwoQ7/YxDnkFIDiWr2vXEBNaKutVai1AvcvEyQVtWdebzs2poae4R1lkVa0VvmhUZrDq8fIgBkcDxrwNkIesLkfg4SZUwb+TH3kS9bs+K3p+PwfQlpERg3jI3rAm5V0fol89oMIvDquUJJ5geNlqDMX02mfkwBji1KOFMWB4laV7tz5lV+BZX5EvHY8tapl6oaj8LmYcd/gJnBFGFV7N/sgTpJ5xRrLPowmRJq6hGzhl6DCsEPQXa4RlhZ0gG+uvxBs8qxmvoWmR8sUhVmCa343vUCliX8WuDwNtjm8ZUgk= X-OriginatorOrg: starfivetech.com X-MS-Exchange-CrossTenant-Network-Message-Id: 57cb3b5d-0511-481d-d05a-08dc11e09858 X-MS-Exchange-CrossTenant-AuthSource: BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jan 2024 13:32:30.7860 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 06fe3fa3-1221-43d3-861b-5a4ee687a85c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: BlY7QjgkEdkRrEboVRw5Y7sAE6CJzRbbS+uqkSo8B42aawIP2mwt/vhZc3ziCklVJIuAXY7Tt7GbLO+oTFvsTbfbQlTg9aBN02l4/S4uLKk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BJSPR01MB0626 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240110_053237_852125_81EB0C59 X-CRM114-Status: GOOD ( 12.72 ) X-BeenThere: linux-riscv@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-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Add bindings for the Always-On clock and reset generator (AONCRG) on JH8100 SoC. Signed-off-by: Sia Jee Heng Reviewed-by: Ley Foon Tan Reviewed-by: Krzysztof Kozlowski --- .../clock/starfive,jh8100-aoncrg.yaml | 74 +++++++++++++++++++ .../dt-bindings/clock/starfive,jh8100-crg.h | 67 +++++++++++++++++ .../dt-bindings/reset/starfive,jh8100-crg.h | 16 ++++ 3 files changed, 157 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/starfive,jh8100-aoncrg.yaml diff --git a/Documentation/devicetree/bindings/clock/starfive,jh8100-aoncrg.yaml b/Documentation/devicetree/bindings/clock/starfive,jh8100-aoncrg.yaml new file mode 100644 index 000000000000..4ae1ef827fc9 --- /dev/null +++ b/Documentation/devicetree/bindings/clock/starfive,jh8100-aoncrg.yaml @@ -0,0 +1,74 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/clock/starfive,jh8100-aoncrg.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: StarFive JH8100 Always-On Clock and Reset Generator + +maintainers: + - Sia Jee Heng + +properties: + compatible: + const: starfive,jh8100-aoncrg + + reg: + maxItems: 1 + + clocks: + items: + - description: Main Oscillator (24 MHz) + - description: GMAC0 RMII func + - description: GMAC0 RGMII func + - description: AON 125MHz clock + - description: AON 2000MHz clock + - description: AON 200MHz clock + - description: AON 667MHz clock + - description: RTC clock + + clock-names: + items: + - const: osc + - const: gmac0-rmii-func + - const: gmac0-rgmii-func + - const: aon125 + - const: aon2000 + - const: aon200 + - const: aon667 + - const: rtc + + '#clock-cells': + const: 1 + description: + See for valid indices. + + '#reset-cells': + const: 1 + description: + See for valid indices. + +required: + - compatible + - reg + - clocks + - clock-names + - '#clock-cells' + - '#reset-cells' + +additionalProperties: false + +examples: + - | + #include + + clock-controller@1f310000 { + compatible = "starfive,jh8100-aoncrg"; + reg = <0x1f310000 0x10000>; + clocks = <&osc>, <&gmac0_rmii_func>, <&gmac0_rgmii_func>, <&aon125>, + <&aon2000>, <&aon200>, <&aon667>, <&rtc>; + clock-names = "osc", "gmac0-rmii-func", "gmac0-rgmii-func", "aon125", + "aon2000", "aon200", "aon667", "rtc"; + #clock-cells = <1>; + #reset-cells = <1>; + }; diff --git a/include/dt-bindings/clock/starfive,jh8100-crg.h b/include/dt-bindings/clock/starfive,jh8100-crg.h index 7b337c1495be..8207d5a2f4b3 100644 --- a/include/dt-bindings/clock/starfive,jh8100-crg.h +++ b/include/dt-bindings/clock/starfive,jh8100-crg.h @@ -351,4 +351,71 @@ #define JH8100_SWCLK_JPEG_ICG_EN 8 #define JH8100_SWCLK_VDEC_ICG_EN 9 +/* AONCRG clocks */ +#define JH8100_AONCLK_GMAC0_RMII_REFIN 0 +#define JH8100_AONCLK_GMAC0_RGMII_RXIN 1 +#define JH8100_AONCLK_GMAC0_GTXCLK 2 +#define JH8100_AONCLK_AON_1000 3 +#define JH8100_AONCLK_AON_400 4 +#define JH8100_AONCLK_AON_400_POSTOSC 5 +#define JH8100_AONCLK_AON_500 6 +#define JH8100_AONCLK_AON_500_POSTOSC 7 +#define JH8100_AONCLK_XSPI_PHY 8 +#define JH8100_AONCLK_AON_100 9 +#define JH8100_AONCLK_AON_100_POSTOSC 10 +#define JH8100_AONCLK_AON_50_POSTOSC 11 +#define JH8100_AONCLK_DDR50_POSTOCC_ICG 12 +#define JH8100_AONCLK_DDR100_POSTOCC_ICG 13 +#define JH8100_AONCLK_PUFRT_APB 14 +#define JH8100_AONCLK_RTC_HMS_APB 15 +#define JH8100_AONCLK_RTC_INTERNAL 16 +#define JH8100_AONCLK_RTC_HMS_OSC32K 17 +#define JH8100_AONCLK_RTC_HMS_CAL 18 +#define JH8100_AONCLK_GMAC0_AXI128_AHB 19 +#define JH8100_AONCLK_GMAC0_AXI128_MSTRCLK 20 +#define JH8100_AONCLK_GMAC0_AXI128_AXI 21 +#define JH8100_AONCLK_GMAC0_RMII_RTX 22 +#define JH8100_AONCLK_GMAC0_AXI128_TX 23 +#define JH8100_AONCLK_GMAC0_AXI128_TX_INV 24 +#define JH8100_AONCLK_GMAC0_AXI128_RX 25 +#define JH8100_AONCLK_GMAC0_AXI128_RX_INV 26 +#define JH8100_AONCLK_GMAC0_GTXC 27 +#define JH8100_AONCLK_XSPI_AXI 28 +#define JH8100_AONCLK_XSPI_APB 29 +#define JH8100_AONCLK_XSPI_XSPI_PHY 30 +#define JH8100_AONCLK_TVSENSOR_PCLK 31 +#define JH8100_AONCLK_TVSENSOR_TSADC 32 +#define JH8100_AONCLK_TVSENSOR_BG 33 +#define JH8100_AONCLK_MEU_PCLK_AP 34 +#define JH8100_AONCLK_MEU_PCLK_SCP 35 +#define JH8100_AONCLK_MEU_MEM_AXI 36 +#define JH8100_AONCLK_AXIMEM_128B_ACLK 37 +#define JH8100_AONCLK_APB2BISR_APB 38 +#define JH8100_AONCLK_APB2BISR_BISR 39 +#define JH8100_AONCLK_EMMC_S_PCLK 40 +#define JH8100_AONCLK_EMMC_MSTRCLK 41 +#define JH8100_AONCLK_EMMC 42 +#define JH8100_AONCLK_EMMC_SDMCLK 43 +#define JH8100_AONCLK_EMMC_SDPHY_PCLK 44 +#define JH8100_AONCLK_SDIO0_PCLK 45 +#define JH8100_AONCLK_SDIO0_MSTRCLK 46 +#define JH8100_AONCLK_SDIO0 47 +#define JH8100_AONCLK_SDIO0_SDMCLK 48 +#define JH8100_AONCLK_SDIO0_SDPHY_PCLK 49 +#define JH8100_AONCLK_HCLK 50 +#define JH8100_AONCLK_ACLK 51 +#define JH8100_AONCLK_PERF_MSTRCLK 52 +#define JH8100_AONCLK_PERF_SLVCLK 53 +#define JH8100_AONCLK_GCLK0 54 +#define JH8100_AONCLK_GCLK_OSC 55 +#define JH8100_AONCLK_RTC_ICG_EN 56 +#define JH8100_AONCLK_GMAC0_ICG_EN 57 +#define JH8100_AONCLK_XSPI_ICG_EN 58 +#define JH8100_AONCLK_TVSENSOR0_ICG_EN 59 +#define JH8100_AONCLK_MEU_ICG_EN 60 +#define JH8100_AONCLK_APB2BISR_ICG_EN 61 +#define JH8100_AONCLK_EMMC_ICG_EN 62 +#define JH8100_AONCLK_SDIO0_ICG_EN 63 +#define JH8100_AONCLK_TOP_ICG_EN 64 + #endif /* __DT_BINDINGS_CLOCK_STARFIVE_JH8100_H__ */ diff --git a/include/dt-bindings/reset/starfive,jh8100-crg.h b/include/dt-bindings/reset/starfive,jh8100-crg.h index de4f25dc301d..23f15d4be22f 100644 --- a/include/dt-bindings/reset/starfive,jh8100-crg.h +++ b/include/dt-bindings/reset/starfive,jh8100-crg.h @@ -99,4 +99,20 @@ #define JH8100_SWRST_VC9000D 2 #define JH8100_SWRST_DDR_TVSENSOR 3 +/* + * AONCRG resets: assert0 + */ +#define JH8100_AONRST_AON_IOMUX_PRESETN 0 +#define JH8100_AONRST_RTC 1 +#define JH8100_AONRST_GMAC0 2 +#define JH8100_AONRST_XSPI 3 +#define JH8100_AONRST_TVSENSOR 4 +#define JH8100_AONRST_MEU 5 +#define JH8100_AONRST_AXIMEM_128B_ARESET 6 +#define JH8100_AONRST_DFT_APB2BISR_APB 7 +#define JH8100_AONRST_SDIO0 8 +#define JH8100_AONRST_EMMC 9 +#define JH8100_AONRST_TOP 10 +#define JH8100_AONRST_IRQ_CTRL 11 + #endif /* __DT_BINDINGS_RESET_STARFIVE_JH8100_H__ */ From patchwork Wed Jan 10 13:31:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sia Jee Heng X-Patchwork-Id: 13516163 X-Patchwork-Delegate: mail@conchuod.ie 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 0B797C4707B for ; Wed, 10 Jan 2024 13:32:53 +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=EmJZ61Xig7vQnCN1bdWJne8AGzZBh5Yfhq/oTnnp/VA=; b=tiSil19d87QHkq ImFVxtQqonOBrE0iBI6hlxCP34US+GFrDDOmbCLEM31tYu1NTgKODtsLkKPiiwwvGZogdFy2NA7wJ ld52Yrj4PdAz074LdGhfmTFq7SZSVOn59ydafsijBOZaVB2Mp5msDpjm7lZxEAFY9dgBMy1mrVDcr mt3UhKQjCrp6+bOdTfDEv9193LeBgbYtXXyJbOhfOfRWIPK3hzAe1V98I0iZ7EGnXhfRwU1+fdGqt VOluSDwdBrHmPmJ+1AHl6mZH7PT0oeT23msTMQ8TTYSthYn4fiZ80jSHYZxYJAW2uJ5FaOl4A+g4K EBfOQxQ/LID7wOs7kCUQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rNYhI-00BzS2-0z; Wed, 10 Jan 2024 13:32:44 +0000 Received: from mail-sh0chn02on2062a.outbound.protection.partner.outlook.cn ([2406:e500:4420:2::62a] helo=CHN02-SH0-obe.outbound.protection.partner.outlook.cn) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rNYhE-00BzCn-1L for linux-riscv@lists.infradead.org; Wed, 10 Jan 2024 13:32:42 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BSAVJzfEWpRdnWNq4nhHzLWRTi4n4DuuyWWHt09BcM8B84zKKypH+SM6fxJdrZeQVXnikfOs820W051Yx0S6VWhumWxwGuS+ChRcCBKiub8Yhz8nzzLM9Z17iYHV5aAHkQNnlm5fY8Puis6qKMndZRtpwtddBzbsIreWmIZbr9lCLS7N8qcDFyYKHlxe7lbhRCB0SVBsq7e6s7Yy8mF9caHUYex7S47yEZ3ydhVVfieBKaGIuRnoILGkbSvQPggiPIYuGlywY9JqmklknaIJ9RndTPSL69hnhz5pC8PrOSbzYaZhTBvplqTKW9wW1Oqed3xcNr3GWxT0T8XCGeY3bQ== 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=T/CveWqH6dj0kaGQ76WGcyUdtzX7u/fuiu1IbOBqVNI=; b=MiWYdcJlfYbouZ0M7668zJLCsmY5F2lMb45vajxunZW6Tr16b8ZqGJk+AWsbFMJ1SNWoLx3dKI9d2JZLFp9gY7nI3CBw/CY/BaSLEHIQZOSlFv4eDcgPYSTMTMmT3aT5J5fLr9bdRjJqvsbA0adHLHc/2xbQ1QkzyA0BjJbSScCpFZmX7pV2KAD8XY/ZyAZ9YIZSHfAvE6BNPb3cTelfQwqNI6bqeqV4Qh0g3XFw0LJ4U4pv8yavUhkV9q2pMCQoNmDAnQd4t3DkBCqoQtPFujQT9ofzPGz86AeROwHsjeJ+a8EH6O41Mewk7uIxsbHxdXBBfK1IQznRDpKrYLfvjA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=starfivetech.com; dmarc=pass action=none header.from=starfivetech.com; dkim=pass header.d=starfivetech.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=starfivetech.com; Received: from BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:f::16) by BJSPR01MB0626.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:10::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.33; Wed, 10 Jan 2024 13:32:34 +0000 Received: from BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn ([fe80::3862:65b4:c857:c4a6]) by BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn ([fe80::3862:65b4:c857:c4a6%4]) with mapi id 15.20.7135.033; Wed, 10 Jan 2024 13:32:34 +0000 From: Sia Jee Heng To: kernel@esmil.dk, conor@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, mturquette@baylibre.com, sboyd@kernel.org, p.zabel@pengutronix.de, emil.renner.berthing@canonical.com, hal.feng@starfivetech.com, xingyu.wu@starfivetech.com Cc: linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, jeeheng.sia@starfivetech.com, leyfoon.tan@starfivetech.com Subject: [RFC v3 14/16] clk: starfive: Add JH8100 Always-On clock generator driver Date: Wed, 10 Jan 2024 21:31:26 +0800 Message-Id: <20240110133128.286657-15-jeeheng.sia@starfivetech.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240110133128.286657-1-jeeheng.sia@starfivetech.com> References: <20240110133128.286657-1-jeeheng.sia@starfivetech.com> X-ClientProxiedBy: BJXPR01CA0067.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:12::34) To BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:f::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BJSPR01MB0561:EE_|BJSPR01MB0626:EE_ X-MS-Office365-Filtering-Correlation-Id: e38f0f7e-1dae-4ed0-add5-08dc11e09a67 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CNqh0N12Hnp2mOcl07EQjUt++Z7tYmdnWPhLzZNYu8G74UVw1Kg9MLmNjodERCiSRpMyizxbnJZXu/N+HuD/bubDoXrP93drS6PWyOVGaiT21OSl0XH+nrbmUCT7hFGtPXGq0PopKBe47ejt0XnAMY6Dpxf8WK+buwe8QGONB8iHq6j3gYX9WOncdCNdOKvZqByxwdcxFHb3vH3YqVBrGhY0oUgATgqbe9Cig8faKP/LOxSlLy4uTqpHEbOZrZo7nTFNTcWhE7dMbOEwTaXyBkCTDJ289WWBu+4QuTD5YEAgee2vcZROndZ/4EhB+HJjVbrZtVw9lp5rIw/7BUx24CgkXopv2DENEJa3kCpEOIAoDM6tej75WCuPx1YiOluz/exgNMJydEe3edP0hy60SlwbXo4kG/37PUkiedYXXFc5VURQZ2MyLrFbFMLUv2fd8r6ZnT7rqOqTJPkoTdfOp5bdzIAni1Jd+CPircRDL9+hQ7F/mnNlC9qmZNRRBtiSaxLTgVHP3MPPzI2YhdXWaKpU68OGL7oqmRQU59vCSUR7v5f0hbADP95pgsUq22ukw73D3txGp6cBRAnF0YA1ibzPExExyz8Eqc5Q3ej3JwP+uxOqPmjxYK6CdwiEG2bb X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn;PTR:;CAT:NONE;SFS:(13230031)(39830400003)(136003)(346002)(396003)(366004)(230273577357003)(230922051799003)(230173577357003)(186009)(64100799003)(451199024)(1800799012)(921011)(26005)(107886003)(52116002)(2616005)(41320700001)(6666004)(83380400001)(1076003)(86362001)(40160700002)(40180700001)(38100700002)(36756003)(38350700005)(5660300002)(30864003)(7416002)(4326008)(55236004)(6636002)(66556008)(66476007)(66946007)(41300700001)(2906002)(8936002)(8676002)(508600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 7CRYnZT2DGbY0wVb6PL4qLUn/YzcfLSesaiydSX5tDy5xyG5BdAo36kgJ/1cv2gLmM4p8R5AgUkF6puUM16w6K+H9VwGXgEMeQCJgf/I0MzabUgmxP0VrlnuOtRVv2t50dj7YOmj88nJUOA+xJAzbQZEDYWR5XFDJEb/Onb5jNAmwXScpeaIAjw4gt9To3007AXj32+hplLAWXZKIvlTrbsMsCI/1EQ/AY9QLP0MzZE2awSgQOshrcfutXzjDUo1CBt2kWQdiD0NlZUgMFF9jzjuJV0KP8sqK0MoJNdJ1fUUo/QgXh1IOHB0T5AKvi98mZ9TxSbjwBEL992g+wzneAsdpL/Vu10pGkoHxopk5n0g3o7QgqA9POxRhijuz+YfstbO/a7T+EEBOtjdgGPnWSx3ltyLReLCPrLZ0e5MXO91wjGsiiq6bUsP8Cqjw2BmXExZzDbHhBUYeuv4SV9axBGtdeyrHS52YLqoxdDSWhHFDYitDrgT/V8OiOvz8cVpBDa28ZaW4+HMJlG5yZiwm4BR9JkMtf/smKgdaQWPWBUQIBBEoqB/1btXOkA8wuVS1c3RsnpX9z3TD+rNxzUyXmTz+8jc8fLW0T9C9c2qiKrGnEl72nyalyJzSLehWbJNXEOatTG15OFECKLH0yn+f/kUQaxwoqrsrFJgD+oU6Xirmjx3xxARQQDgIytiFh24Gkwg+jlxTqRnjj7Pb2l872XQDRITs4IV6TnwnCJA12Vi2JEL2AXJVBKx8HvcO0dEOI8IWNGWMfdVOZopwwNoVwUv3bf2WleviH4uy4nL1f7Sa6MdYQmrcRuwIhO9WOeQiBGhNOSrW34JYcZlE20/RCeTKDqxusZi+5fIBIwIyacmTmRWfnVVFbUo1qMrGEWXym4tM47WBM2a2D7g9Z7d7Ecr43bh36TKVFb/tgNMArFXxrvFLG5o7xBW1F9H1BOyhQZhrV4/03w0z6zArXQt2GnM49n1xEjA8FIJXTItsPFOf+EHptwDKf7kRtdQWEzey6QnOevpJI/JJuGEtzcFbFKIXjHaeT7SkmAlJ3lzlRQv+xilRwnfyBck8FNGGQ3b63PUy8v0uhDV0cEa/IVuPSqeFD/BnVjOfm0i8W7NrvOd6ODmGJYdkLkI1na/RivJCTSsx+j+rXZTcQAXmve8QiI3iia/1YjhD8qnFkPkpePGUi8PgEjkOOR+YPYdTAihJ293+ySez9SdHjI277yPYwIeFfRXtXCiZ1zYPAYmiaKlokc+IaVN+EtmV4qykGcYXZO054UyFAUiYxb7jOywvlz7/54w357BCyDRLPILBGnFZywYVOYcp2M5OOtfsY9UbjgdOphOTHMYgUn4I/Xa/35fRZRffPhtidc6nTXmIJ0n9tigK1M/cImg0TF4NmRJ6VQlBr2I4L0LIKuOsfconF/gNvBz8el/BwbvtGz/ZxxEGm4S9GIIJeprL3vRhZR543XBnowqYZuIEuZF2tYK2dFKJQN3kjZKLjt/7HY+yO1NYYP3bhpHuZUo+VQMEJ3rZsXfXdvvTZif1FlkB8cry3dGTOv0Zvrxn2XvHU49fQRTUzh8VS1DWGs1CuQG4sMo+aTdCN/qvHpq0sqetziQBM/HbHE1R7GgFTPLbDcgdAo= X-OriginatorOrg: starfivetech.com X-MS-Exchange-CrossTenant-Network-Message-Id: e38f0f7e-1dae-4ed0-add5-08dc11e09a67 X-MS-Exchange-CrossTenant-AuthSource: BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jan 2024 13:32:34.1681 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 06fe3fa3-1221-43d3-861b-5a4ee687a85c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: l8fni7zA4KxqD75bWa8gU8DzCp7QpZvSysh7Cffsm0laqKVXhLK8siCKfd8XIQunttgS4PTxz3Eno25+2W77hlxqaZHtOOriZHhurEQ5418= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BJSPR01MB0626 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240110_053240_506616_9E9340EA X-CRM114-Status: GOOD ( 13.01 ) X-BeenThere: linux-riscv@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-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Add support for JH8100 Always-On (AONCRG) clock generator. Signed-off-by: Sia Jee Heng --- drivers/clk/starfive/Kconfig | 7 + drivers/clk/starfive/Makefile | 1 + .../clk/starfive/clk-starfive-jh8100-aon.c | 256 ++++++++++++++++++ 3 files changed, 264 insertions(+) create mode 100644 drivers/clk/starfive/clk-starfive-jh8100-aon.c diff --git a/drivers/clk/starfive/Kconfig b/drivers/clk/starfive/Kconfig index 23ae894fedb9..3b1fbc795879 100644 --- a/drivers/clk/starfive/Kconfig +++ b/drivers/clk/starfive/Kconfig @@ -102,3 +102,10 @@ config CLK_STARFIVE_JH8100_SW default ARCH_STARFIVE help Say yes here to support the South-West clock controller on the StarFive JH8100 SoC. + +config CLK_STARFIVE_JH8100_AON + bool "StarFive JH8100 Always-On clock support" + depends on CLK_STARFIVE_JH8100_SYS + default ARCH_STARFIVE + help + Say yes here to support the Always-On clock controller on the StarFive JH8100 SoC. diff --git a/drivers/clk/starfive/Makefile b/drivers/clk/starfive/Makefile index 242e2e75dadb..e498f1761c2d 100644 --- a/drivers/clk/starfive/Makefile +++ b/drivers/clk/starfive/Makefile @@ -15,3 +15,4 @@ obj-$(CONFIG_CLK_STARFIVE_JH8100_SYS) += clk-starfive-jh8100-sys.o obj-$(CONFIG_CLK_STARFIVE_JH8100_NW) += clk-starfive-jh8100-nw.o obj-$(CONFIG_CLK_STARFIVE_JH8100_NE) += clk-starfive-jh8100-ne.o obj-$(CONFIG_CLK_STARFIVE_JH8100_SW) += clk-starfive-jh8100-sw.o +obj-$(CONFIG_CLK_STARFIVE_JH8100_AON) += clk-starfive-jh8100-aon.o diff --git a/drivers/clk/starfive/clk-starfive-jh8100-aon.c b/drivers/clk/starfive/clk-starfive-jh8100-aon.c new file mode 100644 index 000000000000..ea547fbab6c7 --- /dev/null +++ b/drivers/clk/starfive/clk-starfive-jh8100-aon.c @@ -0,0 +1,256 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * StarFive JH8100 Always-On Clock Driver + * + * Copyright (C) 2023 StarFive Technology Co., Ltd. + * + * Author: Jee Heng Sia + * + */ + +#include +#include +#include +#include +#include + +#include + +#include "clk-starfive-jh8100.h" + +#define JH8100_AONCLK_NUM_CLKS (JH8100_AONCLK_TOP_ICG_EN + 1) + +/* external clocks */ +#define JH8100_AONCLK_OSC (JH8100_AONCLK_NUM_CLKS + 0) +#define JH8100_AONCLK_GMAC0_RMII_FUNC (JH8100_AONCLK_NUM_CLKS + 1) +#define JH8100_AONCLK_AON_50 (JH8100_AONCLK_NUM_CLKS + 2) +#define JH8100_AONCLK_GMAC0_RGMII_FUNC (JH8100_AONCLK_NUM_CLKS + 3) +#define JH8100_AONCLK_AON_125 (JH8100_AONCLK_NUM_CLKS + 4) +#define JH8100_AONCLK_AON_2000 (JH8100_AONCLK_NUM_CLKS + 5) +#define JH8100_AONCLK_AON_200 (JH8100_AONCLK_NUM_CLKS + 6) +#define JH8100_AONCLK_AON_667 (JH8100_AONCLK_NUM_CLKS + 7) +#define JH8100_AONCLK_RTC (JH8100_AONCLK_NUM_CLKS + 8) + +static const struct starfive_clk_data jh8100_aoncrg_clk_data[] = { + /* source */ + STARFIVE__MUX(JH8100_AONCLK_GMAC0_RMII_REFIN, "gmac0_rmii_refin", 2, + JH8100_AONCLK_GMAC0_RMII_FUNC, JH8100_AONCLK_AON_50), + STARFIVE__MUX(JH8100_AONCLK_GMAC0_RGMII_RXIN, "gmac0_rgmii_rxin", 2, + JH8100_AONCLK_GMAC0_RGMII_FUNC, JH8100_AONCLK_AON_125), + STARFIVE__DIV(JH8100_AONCLK_GMAC0_GTXCLK, "gmac0_gtxclk", 50, JH8100_AONCLK_AON_125), + STARFIVE__DIV(JH8100_AONCLK_AON_1000, "aon_1000", 2, JH8100_AONCLK_AON_2000), + STARFIVE__DIV(JH8100_AONCLK_AON_400, "aon_400", 5, JH8100_AONCLK_AON_2000), + STARFIVE__MUX(JH8100_AONCLK_AON_400_POSTOSC, "aon_400_postosc", 2, + JH8100_AONCLK_OSC, JH8100_AONCLK_AON_400), + STARFIVE__DIV(JH8100_AONCLK_AON_500, "aon_500", 4, JH8100_AONCLK_AON_2000), + STARFIVE__MUX(JH8100_AONCLK_AON_500_POSTOSC, "aon_500_postosc", 2, + JH8100_AONCLK_OSC, JH8100_AONCLK_AON_500), + STARFIVE__DIV(JH8100_AONCLK_XSPI_PHY, "xspi_phy", 4, JH8100_AONCLK_AON_200), + STARFIVE__DIV(JH8100_AONCLK_AON_100, "aon_100", 2, JH8100_AONCLK_AON_200), + STARFIVE__MUX(JH8100_AONCLK_AON_100_POSTOSC, "aon_100_postosc", 2, + JH8100_AONCLK_OSC, JH8100_AONCLK_AON_100), + STARFIVE__MUX(JH8100_AONCLK_AON_50_POSTOSC, "aon_50_postosc", 2, + JH8100_AONCLK_OSC, JH8100_AONCLK_AON_50), + STARFIVE_GATE(JH8100_AONCLK_DDR50_POSTOCC_ICG, "ddr50_postocc", CLK_IS_CRITICAL, + JH8100_AONCLK_AON_50_POSTOSC), + STARFIVE_GATE(JH8100_AONCLK_DDR100_POSTOCC_ICG, "ddr100_postocc", CLK_IS_CRITICAL, + JH8100_AONCLK_AON_100), + /* pufrt */ + STARFIVE_GATE(JH8100_AONCLK_PUFRT_APB, "pufrt_apb", CLK_IS_CRITICAL, + JH8100_AONCLK_OSC), + /* rtc hms */ + STARFIVE_GATE(JH8100_AONCLK_RTC_HMS_APB, "rtc_hms_apb", 0, JH8100_AONCLK_OSC), + STARFIVE__DIV(JH8100_AONCLK_RTC_INTERNAL, "rtc_internal", 1020, JH8100_AONCLK_OSC), + STARFIVE__MUX(JH8100_AONCLK_RTC_HMS_OSC32K, "rtc_hms_osc32k", 2, + JH8100_AONCLK_RTC, JH8100_AONCLK_RTC_INTERNAL), + STARFIVE_GATE(JH8100_AONCLK_RTC_HMS_CAL, "rtc_hms_cal", 0, JH8100_AONCLK_OSC), + /* gmac5_axi128 */ + STARFIVE_GATE(JH8100_AONCLK_GMAC0_AXI128_AHB, "gmac0_axi128_ahb", CLK_IGNORE_UNUSED, + JH8100_AONCLK_AON_200), + STARFIVE_GATE(JH8100_AONCLK_GMAC0_AXI128_MSTRCLK, "gmac0_axi128_mstrclk", CLK_IGNORE_UNUSED, + JH8100_AONCLK_AON_667), + STARFIVE_GATE(JH8100_AONCLK_GMAC0_AXI128_AXI, "gmac0_axi128_axi", CLK_IGNORE_UNUSED, + JH8100_AONCLK_AON_400_POSTOSC), + STARFIVE__DIV(JH8100_AONCLK_GMAC0_RMII_RTX, "gmac0_rmii_rtx", 30, + JH8100_AONCLK_GMAC0_RMII_REFIN), + STARFIVE_GMUX(JH8100_AONCLK_GMAC0_AXI128_TX, "gmac0_axi128_tx", CLK_IGNORE_UNUSED, 2, + JH8100_AONCLK_GMAC0_GTXCLK, + JH8100_AONCLK_GMAC0_RMII_RTX), + STARFIVE_GINV(JH8100_AONCLK_GMAC0_AXI128_TX_INV, "gmac0_axi128_tx_inv", CLK_IGNORE_UNUSED, + JH8100_AONCLK_GMAC0_AXI128_TX), + STARFIVE__MUX(JH8100_AONCLK_GMAC0_AXI128_RX, "gmac0_axi128_rx", 2, + JH8100_AONCLK_GMAC0_RGMII_RXIN, JH8100_AONCLK_GMAC0_RMII_RTX), + STARFIVE__INV(JH8100_AONCLK_GMAC0_AXI128_RX_INV, "gmac0_axi128_rx_inv", + JH8100_AONCLK_GMAC0_AXI128_RX), + STARFIVE_GATE(JH8100_AONCLK_GMAC0_GTXC, "gmac0_gtxc", CLK_IGNORE_UNUSED, + JH8100_AONCLK_GMAC0_GTXCLK), + /* xspi */ + STARFIVE_GATE(JH8100_AONCLK_XSPI_AXI, "xspi_axi", CLK_IGNORE_UNUSED, + JH8100_AONCLK_AON_200), + STARFIVE_GATE(JH8100_AONCLK_XSPI_APB, "xspi_apb", CLK_IGNORE_UNUSED, + JH8100_AONCLK_OSC), + STARFIVE_GMUX(JH8100_AONCLK_XSPI_XSPI_PHY, "xspi_xspi_phy", CLK_IGNORE_UNUSED, 2, + JH8100_AONCLK_OSC, JH8100_AONCLK_XSPI_PHY), + /* tvsensor */ + STARFIVE_GATE(JH8100_AONCLK_TVSENSOR_PCLK, "tvsensor_pclk", CLK_IGNORE_UNUSED, + JH8100_AONCLK_OSC), + STARFIVE_GATE(JH8100_AONCLK_TVSENSOR_TSADC, "tvsensor_tsadc", CLK_IGNORE_UNUSED, + JH8100_AONCLK_OSC), + STARFIVE_GDIV(JH8100_AONCLK_TVSENSOR_BG, "tvsensor_bg", CLK_IGNORE_UNUSED, 3, + JH8100_AONCLK_OSC), + /* meu */ + STARFIVE_GATE(JH8100_AONCLK_MEU_PCLK_AP, "meu_pclk_ap", CLK_IGNORE_UNUSED, + JH8100_AONCLK_OSC), + STARFIVE_GATE(JH8100_AONCLK_MEU_PCLK_SCP, "meu_pclk_scp", CLK_IGNORE_UNUSED, + JH8100_AONCLK_OSC), + STARFIVE_GATE(JH8100_AONCLK_MEU_MEM_AXI, "meu_mem_axi", CLK_IGNORE_UNUSED, + JH8100_AONCLK_AON_200), + /* aximem_128b */ + STARFIVE_GATE(JH8100_AONCLK_AXIMEM_128B_ACLK, "aximem_128b_aclk", CLK_IS_CRITICAL, + JH8100_AONCLK_AON_200), + /* apb2bisr */ + STARFIVE_GATE(JH8100_AONCLK_APB2BISR_APB, "apb2bisr_apb", CLK_IGNORE_UNUSED, + JH8100_AONCLK_OSC), + STARFIVE_GATE(JH8100_AONCLK_APB2BISR_BISR, "apb2bisr_bisr", CLK_IGNORE_UNUSED, + JH8100_AONCLK_OSC), + /* emmc */ + STARFIVE_GATE(JH8100_AONCLK_EMMC_S_PCLK, "emmc_s_pclk", CLK_IGNORE_UNUSED, + JH8100_AONCLK_AON_50_POSTOSC), + STARFIVE_GATE(JH8100_AONCLK_EMMC_MSTRCLK, "emmc_mstrclk", CLK_IGNORE_UNUSED, + JH8100_AONCLK_AON_667), + STARFIVE_GATE(JH8100_AONCLK_EMMC, "emmc", CLK_IGNORE_UNUSED, JH8100_AONCLK_AON_200), + STARFIVE_GATE(JH8100_AONCLK_EMMC_SDMCLK, "emmc_sdmclk", CLK_IGNORE_UNUSED, + JH8100_AONCLK_AON_200), + STARFIVE_GATE(JH8100_AONCLK_EMMC_SDPHY_PCLK, "emmc_sdphy_pclk", CLK_IGNORE_UNUSED, + JH8100_AONCLK_AON_50_POSTOSC), + /* sdio */ + STARFIVE_GATE(JH8100_AONCLK_SDIO0_PCLK, "sdio0_pclk", CLK_IGNORE_UNUSED, + JH8100_AONCLK_AON_50_POSTOSC), + STARFIVE_GATE(JH8100_AONCLK_SDIO0_MSTRCLK, "sdio0_mstrclk", CLK_IGNORE_UNUSED, + JH8100_AONCLK_AON_667), + STARFIVE_GATE(JH8100_AONCLK_SDIO0, "sdio0", CLK_IGNORE_UNUSED, JH8100_AONCLK_AON_200), + STARFIVE_GATE(JH8100_AONCLK_SDIO0_SDMCLK, "sdio0_sdmclk", CLK_IGNORE_UNUSED, + JH8100_AONCLK_AON_200), + STARFIVE_GATE(JH8100_AONCLK_SDIO0_SDPHY_PCLK, "sdio0_sdphy_pclk", CLK_IGNORE_UNUSED, + JH8100_AONCLK_AON_50_POSTOSC), + /* top */ + STARFIVE_GATE(JH8100_AONCLK_HCLK, "hclk", CLK_IS_CRITICAL, JH8100_AONCLK_AON_200), + STARFIVE_GATE(JH8100_AONCLK_ACLK, "aclk", CLK_IS_CRITICAL, JH8100_AONCLK_AON_500_POSTOSC), + STARFIVE_GATE(JH8100_AONCLK_PERF_MSTRCLK, "perf_mstrclk", CLK_IS_CRITICAL, + JH8100_AONCLK_AON_667), + STARFIVE_GATE(JH8100_AONCLK_PERF_SLVCLK, "perf_slvclk", CLK_IS_CRITICAL, + JH8100_AONCLK_AON_500_POSTOSC), + STARFIVE_GDIV(JH8100_AONCLK_GCLK0, "gclk0", CLK_IS_CRITICAL, 100, JH8100_AONCLK_AON_1000), + STARFIVE_GATE(JH8100_AONCLK_GCLK_OSC, "gclk_osc", CLK_IS_CRITICAL, JH8100_AONCLK_OSC), + /* icg_en */ + STARFIVE_GATE(JH8100_AONCLK_RTC_ICG_EN, "rtc_en", CLK_IGNORE_UNUSED, + JH8100_AONCLK_OSC), + STARFIVE_GATE(JH8100_AONCLK_GMAC0_ICG_EN, "gmac0_en", 0, JH8100_AONCLK_GMAC0_GTXCLK), + STARFIVE_GATE(JH8100_AONCLK_XSPI_ICG_EN, "xspi_en", 0, JH8100_AONCLK_OSC), + STARFIVE_GATE(JH8100_AONCLK_TVSENSOR0_ICG_EN, "tvsensor0_en", 0, JH8100_AONCLK_OSC), + STARFIVE_GATE(JH8100_AONCLK_MEU_ICG_EN, "meu_en", CLK_IGNORE_UNUSED, JH8100_AONCLK_OSC), + STARFIVE_GATE(JH8100_AONCLK_APB2BISR_ICG_EN, "apb2bisr_en", CLK_IGNORE_UNUSED, + JH8100_AONCLK_OSC), + STARFIVE_GATE(JH8100_AONCLK_EMMC_ICG_EN, "emmc_en", 0, JH8100_AONCLK_AON_50_POSTOSC), + STARFIVE_GATE(JH8100_AONCLK_SDIO0_ICG_EN, "sdio0_en", 0, JH8100_AONCLK_AON_50_POSTOSC), + STARFIVE_GATE(JH8100_AONCLK_TOP_ICG_EN, "top_en", CLK_IGNORE_UNUSED, + JH8100_AONCLK_AON_500_POSTOSC), +}; + +static struct clk_hw *jh8100_aoncrg_clk_get(struct of_phandle_args *clkspec, void *data) +{ + struct starfive_clk_priv *priv = data; + unsigned int idx = clkspec->args[0]; + + if (idx < JH8100_AONCLK_NUM_CLKS) + return &priv->reg[idx].hw; + + return ERR_PTR(-EINVAL); +} + +static int __init jh8100_aoncrg_probe(struct platform_device *pdev) +{ + struct starfive_clk_priv *priv; + unsigned int idx; + int ret; + + priv = devm_kzalloc(&pdev->dev, + struct_size(priv, reg, JH8100_AONCLK_NUM_CLKS), + GFP_KERNEL); + if (!priv) + return -ENOMEM; + + spin_lock_init(&priv->rmw_lock); + priv->dev = &pdev->dev; + priv->base = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(priv->base)) + return PTR_ERR(priv->base); + + for (idx = 0; idx < JH8100_AONCLK_NUM_CLKS; idx++) { + u32 max = jh8100_aoncrg_clk_data[idx].max; + struct clk_parent_data parents[4] = {}; + struct clk_init_data init = { + .name = jh8100_aoncrg_clk_data[idx].name, + .ops = starfive_clk_ops(max), + .parent_data = parents, + .num_parents = + ((max & STARFIVE_CLK_MUX_MASK) >> STARFIVE_CLK_MUX_SHIFT) + 1, + .flags = jh8100_aoncrg_clk_data[idx].flags, + }; + struct starfive_clk *clk = &priv->reg[idx]; + unsigned int i; + + for (i = 0; i < init.num_parents; i++) { + unsigned int pidx = jh8100_aoncrg_clk_data[idx].parents[i]; + + if (pidx < JH8100_AONCLK_NUM_CLKS) + parents[i].hw = &priv->reg[pidx].hw; + else if (pidx == JH8100_AONCLK_OSC) + parents[i].fw_name = "osc"; + else if (pidx == JH8100_AONCLK_GMAC0_RMII_FUNC) + parents[i].fw_name = "gmac0-rmii-func"; + else if (pidx == JH8100_AONCLK_AON_50) + parents[i].fw_name = "aon50"; + else if (pidx == JH8100_AONCLK_GMAC0_RGMII_FUNC) + parents[i].fw_name = "gmac0-rgmii-func"; + else if (pidx == JH8100_AONCLK_AON_125) + parents[i].fw_name = "aon125"; + else if (pidx == JH8100_AONCLK_AON_2000) + parents[i].fw_name = "aon2000"; + else if (pidx == JH8100_AONCLK_AON_200) + parents[i].fw_name = "aon200"; + else if (pidx == JH8100_AONCLK_AON_667) + parents[i].fw_name = "aon667"; + else if (pidx == JH8100_AONCLK_RTC) + parents[i].fw_name = "rtc"; + } + + clk->hw.init = &init; + clk->idx = idx; + clk->max_div = max & STARFIVE_CLK_DIV_MASK; + + ret = devm_clk_hw_register(&pdev->dev, &clk->hw); + if (ret) + return ret; + } + + ret = devm_of_clk_add_hw_provider(&pdev->dev, jh8100_aoncrg_clk_get, priv); + if (ret) + return ret; + + return jh8100_reset_controller_register(priv, "rst-aon", 4); +} + +static const struct of_device_id jh8100_aoncrg_match[] = { + { .compatible = "starfive,jh8100-aoncrg" }, + { /* sentinel */ } +}; + +static struct platform_driver jh8100_aoncrg_driver = { + .driver = { + .name = "clk-starfive-jh8100-aon", + .of_match_table = jh8100_aoncrg_match, + .suppress_bind_attrs = true, + }, +}; +builtin_platform_driver_probe(jh8100_aoncrg_driver, jh8100_aoncrg_probe); From patchwork Wed Jan 10 13:31:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sia Jee Heng X-Patchwork-Id: 13516164 X-Patchwork-Delegate: mail@conchuod.ie 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 B53FCC4707C for ; Wed, 10 Jan 2024 13:32:57 +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=tz6fU1D0RcSXlHxEgRvEvGcKp/vBHYjWzZHnmdEjhWg=; b=ElirIzX/R2CuYP uowuGe6eiYjwREKg2Spe4NO5ShCKYfXSF825f/iEvbQjgtbOZrp2A7mk8gXtyqtSbDcPjjR6fBzW2 5a+mZnWdzwSlir3JRjb9G4+nkRmVtAPt22HvvDkLolQq/DWGMSzWcBWGu3boQ9P0VJZ1ITxQiDBKp RpafTWvL8N4rSKwP0Js0YGPSmsaikY3xCKKlNtX0MhL8jOG+3ZJ2PCgqrcX5mLQYZ4kKMzE0ih0mk Cm/EQcOzvWwi90pZWkh/yVudDIyLGmL71aQbVrqwEM530Y3nwHK3d2ZFNbAs8h5SaKOgCRbrK646B tjTgWj/p/x6PVVUceXHQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rNYhK-00BzUb-2m; Wed, 10 Jan 2024 13:32:47 +0000 Received: from mail-sh0chn02on2062a.outbound.protection.partner.outlook.cn ([2406:e500:4420:2::62a] helo=CHN02-SH0-obe.outbound.protection.partner.outlook.cn) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rNYhH-00BzCn-1T for linux-riscv@lists.infradead.org; Wed, 10 Jan 2024 13:32:45 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=n3WuTMMhk9YXFux5EoMxZoZY1HP/PvX9QDaNPjwp291DnPBeX5MHiJ5AzCHl2GGRMfEMaM6EXfoCPcK6DfC0jMTrvVMYlL4CXpcFkfNMgoZ6g2XMjwf+hCa6FmQZTBmD4JQxdH79vqGQl6Y5L5IEhO9O3InUIh1O/W5KE1vJAHJZ9WGpGLHWqKH073QBWawWCnxvJOtTxdCaMtgj8whXVtDh1g7Va8uyq4gObubVGvQCYhEVXKt0KFIB39MaP0a6oelZiWpI/YNtqW1MkkPEC5IukHGDjIXUiokQqQTbnOTkLnQRez5EPu4cQsgER7VWGwcJVJM/Q9J263QJCMGdYg== 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=YO8QgPB0DL3mNzO74IYllMWQSIgnCbvtWOpkstTomR8=; b=bj4RHGcE7oZBCErxpHWhZ1CFb5Q6T9WrqS+NcpsSq3oE6+e84lW6f+UdL0iK5xwmD9L0Ne/NRCCHNb1LYG7XlO0rSflNvegGsEP6JX4Gpwv2UJ71sD7HYy0sbdvAis9KHc+fSdrC32IcoNPmkUnxSHdGM9UOU0s+I94eISYoIbm/lJJ77bMG17aoJfT17mLnw0HsNXXmMUafRsOurp5dzVqGLK2X2nZDvI3NQgW30NvbErFethKZ8uDfwU6ePgXMHa7DiMZ9/w3m62UEwoDj/eOuAGhZVZH7N0I3BWtxfNK9bI96KRh3QUaDRFuOQUW1w/JoePOSXMwGvAOl7nkYfw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=starfivetech.com; dmarc=pass action=none header.from=starfivetech.com; dkim=pass header.d=starfivetech.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=starfivetech.com; Received: from BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:f::16) by BJSPR01MB0626.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:10::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.33; Wed, 10 Jan 2024 13:32:38 +0000 Received: from BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn ([fe80::3862:65b4:c857:c4a6]) by BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn ([fe80::3862:65b4:c857:c4a6%4]) with mapi id 15.20.7135.033; Wed, 10 Jan 2024 13:32:38 +0000 From: Sia Jee Heng To: kernel@esmil.dk, conor@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, mturquette@baylibre.com, sboyd@kernel.org, p.zabel@pengutronix.de, emil.renner.berthing@canonical.com, hal.feng@starfivetech.com, xingyu.wu@starfivetech.com Cc: linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, jeeheng.sia@starfivetech.com, leyfoon.tan@starfivetech.com, Joshua Yeong Subject: [RFC v3 15/16] reset: starfive: Add StarFive JH8100 reset driver Date: Wed, 10 Jan 2024 21:31:27 +0800 Message-Id: <20240110133128.286657-16-jeeheng.sia@starfivetech.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240110133128.286657-1-jeeheng.sia@starfivetech.com> References: <20240110133128.286657-1-jeeheng.sia@starfivetech.com> X-ClientProxiedBy: BJXPR01CA0067.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:12::34) To BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:f::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BJSPR01MB0561:EE_|BJSPR01MB0626:EE_ X-MS-Office365-Filtering-Correlation-Id: 25f06df8-1f59-4d99-1072-08dc11e09cbe X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IK/FKAHbPXIfDEbw2o0H6fxY0JwJ83+UJ/xjdV8eixfbxy/HLriAMWRcHaz7fiSW57IpUO+/kH6PLNRvx+wnHSi20jGMgK0lbDCN4+Aa3q2l+7WZOLGtJyMAGUlHrXZhZH9wrOsWHdJAdhbZYDgmG934Weg6NAPa1FqbHMA6XcGuYoJyAk2Zh8ZSV0SQjhFcKMz5Ftt9aX0xhyMaQkqdrPGNN6yUnizWe9w2sA4+Q7V5J0hfjIYcvyfZPTfsNo2hrEwGe2S4QbchJE23C64SfWsHzZ8pJnSEGBhighr2SIpRoNdqKNSRNPgPWipjBCmf4VpJIHYlG8u1QxgebidQz/ZBWhWmVNTheeP9CPJitepk6AULYlCVeM3VSikkIgcC0vc5q4eMumHniDytRbKos+KsNmQuJZlVLEpHtK4n5GDRFBnxAEOCoqCr9uqXCZysQFf/FGwqsCDy6l1oTF9Zphh++dHl8Oc4nEsz0kNXgE+iR3QpRjXEJMmynwsXjDtDKEcy4qE7cRawQ+xSR6NPTL6xM4CuVrr7iCZ+bQFoBULUzbeiXXjh78SElABtQ28g0cEuoRGIp7uz5POWaCGlDQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn;PTR:;CAT:NONE;SFS:(13230031)(39830400003)(136003)(346002)(396003)(366004)(230922051799003)(186009)(64100799003)(451199024)(1800799012)(921011)(26005)(107886003)(52116002)(2616005)(41320700001)(6666004)(83380400001)(1076003)(86362001)(40160700002)(40180700001)(38100700002)(36756003)(38350700005)(5660300002)(7416002)(4326008)(55236004)(6636002)(66556008)(66476007)(66946007)(41300700001)(2906002)(8936002)(8676002)(508600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: jrbUYTYvpKMo2+TttEdIKIZOtnvXAYbhv+wduPONwx+wgVH+o524Kbay68tus5GS8A471VzSf/SXQ5BQCxBu5pDbS+x3hwdReKAsJBPtwh5xHQwZjNh9TNMLV1DZz60a8MHgyrqk9+zet9Dh0zSkchHdc0IQAJ/WwtAwqh0SBcJBH/LRf9f+VROuiNB6lU29Bk3sg70bIat3W5ivgtE9alUwqiOjftOiD/oxkm9gcipK2EKhlYlLokYiVfecixL1RlJgEtH2rtioy079Co38YJy2NhIdZZ41eYetZecvg9Q9tQuw6mSdQ9Vpm4DxAnna7agUfYnAShjVsmW94LXm/U33kAssYn5A1qG9KrVjZo+h4TzIBFvnia9dCr3TDWuhryhQckeSW/WupmIho0cl0VdLmwSA9cmMSHNXGUrY7ieHTQn3ylYLBR8sVUsLv9OenbnpmBneF3EVX7NeoPNLT7sk98eKjwyodlOf/yQVF4NRSYlfCsaW/KAsbesPVThUi4xiXAFS8CrD0i8I2XefF1c/vbPz50Tt7Af659CyucQY85jcieT/sZ9PPFSBR91Nr2ML0ul4P2DPY6BrH+a5tV1/YgMsVlR/Duj0zab7nvlsIPKAVlrU7cQc3A76HTJUu3B8e1Tc7eCwQMOMPUYSLcSqHTAQGDLjvPgG8V4CkrgwWr0o4EqhL+IERo3h5vnFVU0igpPhBc5UA/RN/FDJWztIgKEk40bBpEQ3AgFhQ4uOAP6J5Uf1hL6x/mv+JFU1UdMs70V5q94N4V9ruRsyhLUlkp4V3oOuiO3DdVCR6FdsKXNt/Bh0lL+PuuhhB7g+jqKSrpeegs2MdhrF7MCNHGRVCSgh/lBFydq5Q0SM+IFkxmPxOWTwGB33b0UuBkkWqRb+1efdFHdGLBtfK6bWM9u2WeXQJP7sEGgBrF9P4QS1qJm0sSxzu+pZtxuxAb5owKERzPCyDrZM0vrcSjJFg1zggOQzkLBVdr93BHDFmn89mHYonMxfnYYcKvuh+1JtWTq7hM8UoIahlSTpsq5AQks7ApFyDPdBybzzt6H7j1vG0uK9NLMB7b4cGmN/Y5gR8ywifyovo16I/DtsgIu77BzJwSY6PwWEeACUqlNX+iJTkNALXE+kaJefKECeTjoR8q/3Q1M8O13p/JhvHw7l0zbzdlhrmsSARySotEitCiJleEP6+r3zI9C/KMXQTNWNuKMmX9Wx8dBhwPajmemsWSopThdz6LfUl6SNdyWamBz74JF5I9rqtTrdrJFG6vn3P0Q7c29kRXf+GPwq8Q1UoYd7TUZZYa9LikwH/Qp8kGDQtFrcpoT5cf1Mz5MHISLlmNbuobafxkFqa3lG7u4fZ/EoobAR+x1VIptxI0cZD+bvQQNn1WfA8TeDGqtUfKw8u7FXXrg0ODVV/HohNJZgJ2lBf6XEoWmBb2hHNbzryz95TMtdFQnpOsImspu2JoUrTEPPNFnceNMJYnFTZnIsmCCDtfqu7Bg9osYrLtMP12+D5DM7fPHkdYZPrHJmDDbRe7S98XtmNUAkoA4EK474S5dCWU9hR7JqBvMNCod7rsZJgKN2nTh/SIayG7PXpKid09hHYG99jw3HYocyc8pygPfS2D/tj8v8NB2v/r4AUf0= X-OriginatorOrg: starfivetech.com X-MS-Exchange-CrossTenant-Network-Message-Id: 25f06df8-1f59-4d99-1072-08dc11e09cbe X-MS-Exchange-CrossTenant-AuthSource: BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jan 2024 13:32:38.1633 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 06fe3fa3-1221-43d3-861b-5a4ee687a85c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: riynAunmpxO78lkCC2f00nG9127gQC23hyCnUm6KAmrzRD9FZWo5UlvHZyBfnTWOMJUxUzAIVeqSqpMeKMVafsS1Td2/RQQrfTagsp88j2g= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BJSPR01MB0626 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240110_053243_599150_F8514D88 X-CRM114-Status: GOOD ( 16.41 ) X-BeenThere: linux-riscv@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-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Add auxiliary reset driver to support StarFive JH8100 SoC. Co-developed-by: Joshua Yeong Signed-off-by: Joshua Yeong Signed-off-by: Sia Jee Heng Reviewed-by: Ley Foon Tan --- MAINTAINERS | 7 ++ drivers/reset/starfive/Kconfig | 8 ++ drivers/reset/starfive/Makefile | 2 + .../reset/starfive/reset-starfive-jh8100.c | 108 ++++++++++++++++++ 4 files changed, 125 insertions(+) create mode 100644 drivers/reset/starfive/reset-starfive-jh8100.c diff --git a/MAINTAINERS b/MAINTAINERS index c5d563594e34..d74cb78cbb90 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -20738,6 +20738,13 @@ F: Documentation/devicetree/bindings/clock/starfive,jh81*.yaml F: drivers/clk/starfive/clk-starfive-jh81* F: include/dt-bindings/clock/starfive?jh81*.h +STARFIVE JH8100 RESET CONTROLLER DRIVERS +M: Sia Jee Heng +M: Ley Foon Tan +S: Maintained +F: drivers/reset/starfive/reset-starfive-jh81* +F: include/dt-bindings/reset/starfive?jh81*.h + STATIC BRANCH/CALL M: Peter Zijlstra M: Josh Poimboeuf diff --git a/drivers/reset/starfive/Kconfig b/drivers/reset/starfive/Kconfig index 29fbcf1a7d83..88d050044d52 100644 --- a/drivers/reset/starfive/Kconfig +++ b/drivers/reset/starfive/Kconfig @@ -19,3 +19,11 @@ config RESET_STARFIVE_JH7110 default ARCH_STARFIVE help This enables the reset controller driver for the StarFive JH7110 SoC. + +config RESET_STARFIVE_JH8100 + bool "StarFive JH8100 Reset Driver" + depends on AUXILIARY_BUS && CLK_STARFIVE_JH8100_SYS + select RESET_STARFIVE_COMMON + default ARCH_STARFIVE + help + This enables the reset controller driver for the StarFive JH8100 SoC. diff --git a/drivers/reset/starfive/Makefile b/drivers/reset/starfive/Makefile index 582e4c160bd4..ede1fc1c9601 100644 --- a/drivers/reset/starfive/Makefile +++ b/drivers/reset/starfive/Makefile @@ -3,3 +3,5 @@ obj-$(CONFIG_RESET_STARFIVE_COMMON) += reset-starfive-common.o obj-$(CONFIG_RESET_STARFIVE_JH7100) += reset-starfive-jh7100.o obj-$(CONFIG_RESET_STARFIVE_JH7110) += reset-starfive-jh7110.o + +obj-$(CONFIG_RESET_STARFIVE_JH8100) += reset-starfive-jh8100.o diff --git a/drivers/reset/starfive/reset-starfive-jh8100.c b/drivers/reset/starfive/reset-starfive-jh8100.c new file mode 100644 index 000000000000..a14418653608 --- /dev/null +++ b/drivers/reset/starfive/reset-starfive-jh8100.c @@ -0,0 +1,108 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Reset driver for the StarFive JH8100 SoC + * + * Copyright (C) 2023 StarFive Technology Co., Ltd. + */ + +#include +#include +#include + +#include "reset-starfive-common.h" + +#define JH8100_SYSRST_NUM_RESETS (JH8100_SYSRST_HD_AUDIO + 1) +#define JH8100_NWRST_NUM_RESETS (JH8100_NWRST_MERAK1_TVSENSOR + 1) +#define JH8100_NERST_NUM_RESETS (JH8100_NERST_DUBHE_TVSENSOR + 1) +#define JH8100_SWRST_NUM_RESETS (JH8100_SWRST_DDR_TVSENSOR + 1) +#define JH8100_AONRST_NUM_RESETS (JH8100_AONRST_IRQ_CTRL + 1) + +struct jh8100_reset_info { + unsigned int nr_resets; + unsigned int assert_offset; + unsigned int status_offset; +}; + +static const struct jh8100_reset_info jh8100_sys_info = { + .nr_resets = JH8100_SYSRST_NUM_RESETS, + .assert_offset = 0x1B4, + .status_offset = 0x1B8, +}; + +static const struct jh8100_reset_info jh8100_sys_nw_info = { + .nr_resets = JH8100_NWRST_NUM_RESETS, + .assert_offset = 0xA4, + .status_offset = 0xA8, +}; + +static const struct jh8100_reset_info jh8100_sys_ne_info = { + .nr_resets = JH8100_NERST_NUM_RESETS, + .assert_offset = 0x2BC, + .status_offset = 0x2C4, +}; + +static const struct jh8100_reset_info jh8100_sys_sw_info = { + .nr_resets = JH8100_SWRST_NUM_RESETS, + .assert_offset = 0x28, + .status_offset = 0x2C, +}; + +static const struct jh8100_reset_info jh8100_aon_info = { + .nr_resets = JH8100_AONRST_NUM_RESETS, + .assert_offset = 0x104, + .status_offset = 0x108, +}; + +static int jh8100_reset_probe(struct auxiliary_device *adev, + const struct auxiliary_device_id *id) +{ + struct jh8100_reset_info *info = (struct jh8100_reset_info *) + (id->driver_data); + struct starfive_reset_adev *rdev = to_starfive_reset_adev(adev); + void __iomem *base = rdev->base; + + if (!info || !base) + return -ENODEV; + + return reset_starfive_register(&adev->dev, + adev->dev.parent->of_node, + base + info->assert_offset, + base + info->status_offset, NULL, + info->nr_resets, NULL); +} + +static const struct auxiliary_device_id jh8100_reset_ids[] = { + { + .name = "clk_starfive_jh8100_sys.rst-sys", + .driver_data = (kernel_ulong_t)&jh8100_sys_info, + }, + { + .name = "clk_starfive_jh8100_sys.rst-nw", + .driver_data = (kernel_ulong_t)&jh8100_sys_nw_info, + }, + { + .name = "clk_starfive_jh8100_sys.rst-ne", + .driver_data = (kernel_ulong_t)&jh8100_sys_ne_info, + }, + { + .name = "clk_starfive_jh8100_sys.rst-sw", + .driver_data = (kernel_ulong_t)&jh8100_sys_sw_info, + }, + { + .name = "clk_starfive_jh8100_sys.rst-aon", + .driver_data = (kernel_ulong_t)&jh8100_aon_info, + }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(auxiliary, jh8100_reset_ids); + +static struct auxiliary_driver jh8100_reset_driver = { + .probe = jh8100_reset_probe, + .id_table = jh8100_reset_ids, +}; +module_auxiliary_driver(jh8100_reset_driver); + +MODULE_AUTHOR("Joshua Yeong "); +MODULE_AUTHOR("Sia Jee Heng "); +MODULE_DESCRIPTION("StarFive JH8100 reset driver"); +MODULE_LICENSE("GPL"); From patchwork Wed Jan 10 13:31:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sia Jee Heng X-Patchwork-Id: 13516165 X-Patchwork-Delegate: mail@conchuod.ie 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 A567CC4707B for ; Wed, 10 Jan 2024 13:32:58 +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=PLlUjd0Cn2ajTP1LpWwJyHiQH90zAhu9rw6YTJ9IrWk=; b=IBP0yCl942aOTQ yPCmfLrmkWOQFxomcRUsUAE3fFwTlBq/Hui0JrJ0JfJQipdN0lp3EE2M6YfAotkSBuzsyqOium5rv pnpTreoSVChzTyClT8Zv4dnDGFc5eIM3vZwcLoXcL8y5YIrmmjPbrwqpiXT2B5SIRlBHKln0fww+e tukIAoxBTtNoklo/Lxe9IaI6ajNIZyJ4ieEk8AttUmrLjriSjJ0wedI80VsuQWeHR296ZFQ9ibtm6 6OmjwWjFmBvkAUvqgi4xPzj5KFQl+YFF9pdrSB/PKlI2su4h+KICciDo4xwbfV2FYZap3ERbJ94SZ KOybpE6WIlYj1vs9TJTQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rNYhO-00BzWZ-0G; Wed, 10 Jan 2024 13:32:50 +0000 Received: from mail-sh0chn02on2062a.outbound.protection.partner.outlook.cn ([2406:e500:4420:2::62a] helo=CHN02-SH0-obe.outbound.protection.partner.outlook.cn) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rNYhJ-00BzCn-2e for linux-riscv@lists.infradead.org; Wed, 10 Jan 2024 13:32:48 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z5R1flFFzrEjiVSbfLv83qEwCzxPVjlRM45DVfZVzeVLNGW1N2qP5HVKJl7NpLwv6OqmTSNK4wb9uwUpL26B6U1A3k0T0Vcp2yDvibrnGQ8q6U82A9auXoZ8Xy4M6e88xCpjvIh2iMRwJrAwtLxNrl35XXgPzuX5eYBWkiAr5WZiriRvitRx0CfWe7p5df7B7lCABV2jjly9gribE29jNlgJW1bV33ORN7t1mZfFn7slpZd76kf1ZXdIWf7Zbf2SDUMkKczZZJbXeMEM1KZBi76lTwIJ0eIDrRq+lvp5A0cE3/aAIFoOmrxgDNUs5HLW5Q2nKJMw0SA0FAre7TZK2A== 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=mZ4mvyrT6i9c2vFdoxJNtLD2ewK3tmwEKiOMAJbdP2c=; b=ekNXtRWkK7e7NxVWAXixBysuYlbSLqXetr5VGp9M/oUdZHltSHcE6ROy6sVpZ8wE2aM573301kZZKXoO8+IMrGBUP1nmJB7U4XGC4MxYWmdw08fWBrqjsvCJhtEZs3WactE8mLrrjEKB6ZvuzuRawJX3wexgMjm0DjwSQ4Dy1DyV0YxpJjQ26UJwDj0THiGOXyt16hzZf+kNvTSAavVsyFv98VM+2ZSsfuMhf6o71NSf0PNpzzAXUQvp3g7M/bt6nObBCHKwqgt7/MRyNsDJPgbtizs3EpTKUAe9Ftne8QFCl+ool2cdjxBRSzzyjQ16t/jpwp5/TPesY5hemrOODQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=starfivetech.com; dmarc=pass action=none header.from=starfivetech.com; dkim=pass header.d=starfivetech.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=starfivetech.com; Received: from BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:f::16) by BJSPR01MB0626.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:10::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.33; Wed, 10 Jan 2024 13:32:42 +0000 Received: from BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn ([fe80::3862:65b4:c857:c4a6]) by BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn ([fe80::3862:65b4:c857:c4a6%4]) with mapi id 15.20.7135.033; Wed, 10 Jan 2024 13:32:42 +0000 From: Sia Jee Heng To: kernel@esmil.dk, conor@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, mturquette@baylibre.com, sboyd@kernel.org, p.zabel@pengutronix.de, emil.renner.berthing@canonical.com, hal.feng@starfivetech.com, xingyu.wu@starfivetech.com Cc: linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, jeeheng.sia@starfivetech.com, leyfoon.tan@starfivetech.com Subject: [RFC v3 16/16] riscv: dts: starfive: jh8100: Add clocks and resets nodes Date: Wed, 10 Jan 2024 21:31:28 +0800 Message-Id: <20240110133128.286657-17-jeeheng.sia@starfivetech.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240110133128.286657-1-jeeheng.sia@starfivetech.com> References: <20240110133128.286657-1-jeeheng.sia@starfivetech.com> X-ClientProxiedBy: BJXPR01CA0067.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:12::34) To BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:f::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BJSPR01MB0561:EE_|BJSPR01MB0626:EE_ X-MS-Office365-Filtering-Correlation-Id: 94b13b7a-04ff-48f3-731c-08dc11e09f14 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qtlDHrn5DU5NirGFrgM4Usm3w/MWRK7AhKdsePy09sFUJrJ3/cQ3UVu4tzKqUsKGKiBIOk3Idt0QvkzFTraTB5hnruv+1zl2AZDmG5zIXeDgppoKNyziGICRQuJbpXt/1NxLqN9em7bbqO/d66uK0FusKrC3xhY9RfXvLIVI+ZFm+SpsS0pga4CD3SzbPdYwAYE8J7Xs1gEX4KZYxRpVD0l9zbEAIvoOd5/ukoaAIFJhlIzu09L/HYrPoYYfokCdSkqDRwjkFBjlp6rhBJ8I3RwrviWm275aED/UMVtSKA2A296kvpVG2QKdV7KjOWVWbTkXlWdbOQDSLLmwZiuZWbss93S40WwEInteSYW9hiGdtXQmtM/cxZ/c7dKYKAyf2EK/XyQRE1BwG+vCLudL86fwutTPQfY35jPdZ7SUeuNPD6QlfJCLLZu5EJVCLsW74MxWcbymMsxfUt7TAIU4DBVM9tcogvw1516vTaRXHNDvQ55B9QiUMisD9XCJRKUt1Kkt1K5b+JKkXscBSBjqSukPNsn7Kvk8m88GqNbBF20ZYcxLZiFoakM/YQ48fGj0msGcJyIuAgKaJyC4u94MDg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn;PTR:;CAT:NONE;SFS:(13230031)(39830400003)(136003)(346002)(396003)(366004)(230922051799003)(186009)(64100799003)(451199024)(1800799012)(921011)(26005)(107886003)(52116002)(2616005)(41320700001)(6666004)(83380400001)(1076003)(86362001)(40160700002)(40180700001)(38100700002)(36756003)(38350700005)(5660300002)(7416002)(4326008)(55236004)(6636002)(66556008)(66476007)(66946007)(41300700001)(2906002)(8936002)(8676002)(508600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: erRgXhahq7a/kKrSyi7Ws/mUO/b3tMOPENzVOaks3SgdwokI5p6p0eOTCa5k5OuZA05ip1rmFIKxwLuOsgiq8Y10IVlmm9r1UBqF7FSNS4Bjbw0RWI0cHpFNUfRAnG11Wl51A64G+czEG1FBDWCuIiajNemTYj7LrE1nxI9audzJZ+rI+hVgsQMSFqr0ZIH1pUzYhgbyxRHMQrEdHffCUFdMp9YrovFuRssFfs5utneEYsaa/JuXUkqbwVdhCRNVbfNJL9dUohI6YJWU/xAMMNDX23RT5yShlq1K5orE2WRNILa2WDvZz5e4/W9jrfZcaYLT7gDPYeCfnkdOibqeBFPopORmo9TRb13HU/W51XWKL92VawzrVfBdxh7Eyvn1bScrn4MTNLqHm46oRmP3jbJSWQKIPXvx3gz+ZF7ZaVBCKmMM0xwCvz+mpygWLIlPj6cf421/U770jKYd88MOXxvrfBsWakBz9v3u0NLwViNss+QihN3lH10DMLpEq5Xtxf3IJPzw59dr2YECcU6Ny5eTtRaLtxQHAuh8jHyoPs3dbUD/tWUeORYcsNuWKLeLjFD+orOHNkYsoO8iFTHmi2J7Is5TbcK8dc1jhA+eowGXCBnuHuSiwccQjblHf9k2alUra4IMDkgVZNY2lAzXICIrTegnXXU5lKD5uGz9f8p2LH3XlBF1cycKvh2+Ww0/FejDOnFLi6yJqO8rbBjQ9i8Pz9ccvoi6K37vUqMHsl+q7LzDhdyB1dJjWEoE/YmOxu18J9Z40wC/ZEvUpgkCfMjo6849+n72+enQ+jep1LNnXbPODcYMLQWpCtRyahEs39HzU3q1hiGmSgtovdLJv45ZAbr9jCX60ZtkhA2r+Y6QhHdXp3maoZ2hC6HrV+LXMotIDrvxwwSna2Hwo3y9fIH981O7p63TqjASS+oAryMPoTBEa5kY4wbIO2EK4th3ekXYTm3T4CjN0adjFG0RbduZFwUO/ulVLKpVPP/O3qC4BspcFmAfHEGPvVZu01oZrnyWqAsYy7wlqHmJMxcTXh+bQxZktvRYibIl4p9QMsLQ+LSMn211jAJtzWcuLbGJJqYOQXQu0FhW1obxBakPyY1v6qLFGH0bRkOEyqaHBJ+ZJ39M5k3pqMmYHlfRYYgvQu1b42ybAyKuek/CKf1qD8WfgXg5UOehmiB7kW3dfmNlwjxNJFOcD0ytTNB6F8n1HbGicedDCx/87Bhew5R4qEcba+9zEffTWHwbTsqhLrDT+FWTUB72GzZLAx49cY7wFjqfbilZ7phmN5FvbAXshv/WxewSPxZxgheU2q4eGztSLiF+cI0cKtuCzjY1qBRhXdgpfrMrAH1+ASj4YS9p43WRhlj09o/CqQFGEYTqDW3i5Co97JvogniY/ew6SWywcfUniF0857SxlMSsR/s8cCuLG0GoShSHWI3Jjqu38WMqnuCG7rNxBCRawD009hFxHIj06enzpPJIWuvegZM7J2CXtyvZLvtHsul0iG4A9y7hE1+wp2MpeikUdH0DbwP6JQci7OsoAlNitpOfWTlyy2z/QpaE3c2ZwON/8IC3ePxAp6OU0N709FAoC9NyPB0VnoKkG6WqKdQJYx7XtcMKE6p6OX/+uybniNqI3mtmHiU= X-OriginatorOrg: starfivetech.com X-MS-Exchange-CrossTenant-Network-Message-Id: 94b13b7a-04ff-48f3-731c-08dc11e09f14 X-MS-Exchange-CrossTenant-AuthSource: BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jan 2024 13:32:42.0823 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 06fe3fa3-1221-43d3-861b-5a4ee687a85c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: lCa3lBUCLhp5bc3CVPulu59GXzxE11rPETiZ6SiiXMkhMLLL8cbX1NH8OxI5i0oaoNsig9+bbJRmFu/fUpcHcHicPZUu0jahztBe7lBGWb8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BJSPR01MB0626 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240110_053246_049370_C8877175 X-CRM114-Status: UNSURE ( 7.68 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@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-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Add SYSCRG/SYSCRG-NE/SYSCRG-NW/SYSCRG-SW/AONCRG clock and reset nodes for JH8100 RISC-V SoC. Signed-off-by: Sia Jee Heng Reviewed-by: Ley Foon Tan --- arch/riscv/boot/dts/starfive/jh8100.dtsi | 313 +++++++++++++++++++++++ 1 file changed, 313 insertions(+) diff --git a/arch/riscv/boot/dts/starfive/jh8100.dtsi b/arch/riscv/boot/dts/starfive/jh8100.dtsi index f26aff5c1ddf..5ba826e38ead 100644 --- a/arch/riscv/boot/dts/starfive/jh8100.dtsi +++ b/arch/riscv/boot/dts/starfive/jh8100.dtsi @@ -4,6 +4,8 @@ */ /dts-v1/; +#include +#include / { compatible = "starfive,jh8100"; @@ -279,6 +281,210 @@ clk_uart: clk-uart { clock-frequency = <24000000>; }; + osc: osc { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <24000000>; + }; + + i2srx_bclk_ext: i2srx-bclk-ext { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <12288000>; + }; + + i2srx_lrck_ext: i2srx-lrck-ext { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <192000>; + }; + + mclk_ext: mclk-ext { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <49152000>; + }; + + usb3_tap_tck_ext: usb3-tap-tck-ext { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <100000000>; + }; + + glb_ext_clk: glb-ext-clk { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <30000000>; + }; + + usb1_tap_tck_ext: usb1-tap-tck-ext { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <100000000>; + }; + + usb2_tap_tck_ext: usb2-tap-tck-ext { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <100000000>; + }; + + typec_tap_tck_ext: typec-tap-tck-ext { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <100000000>; + }; + + spi_in0_ext: spi-in0-ext { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <100000000>; + }; + + spi_in1_ext: spi-in1-ext { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <100000000>; + }; + + spi_in2_ext: spi-in2-ext { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <100000000>; + }; + + i2stx_bclk_ext: i2stx-bclk-ext { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <12288000>; + }; + + i2stx_lrck_ext: i2stx-lrck-ext { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <192000>; + }; + + dvp_ext: dvp-ext { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <150000000>; + }; + + isp_dphy_tap_tck_ext: isp-dphy-tap-tck-ext { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <100000000>; + }; + + vout_mipi_dphy_tap_tck_ext: vout-mipi-dphy-tap-tck-ext { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <100000000>; + }; + + vout_edp_tap_tck_ext: vout-edp-tap-tck-ext { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <100000000>; + }; + + rtc: rtc { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <32768>; + }; + + gmac0_rmii_func: gmac0-rmii-func { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <50000000>; + }; + + gmac0_rgmii_func: gmac0-rgmii-func { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <125000000>; + }; + + aon50: aon50 { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <50000000>; + }; + + aon125: aon125 { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <125000000>; + }; + + aon2000: aon2000 { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <2000000000>; + }; + + aon200: aon200 { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <200000000>; + }; + + aon667: aon667 { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <667000000>; + }; + + pll0: pll0 { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <2000000000>; + }; + + pll1: pll1 { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <1782000000>; + }; + + pll2: pll2 { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <1843200000>; + }; + + pll3: pll3 { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <1866000000>; + }; + + pll4: pll4 { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <2000000000>; + }; + + pll5: pll5 { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <1500000000>; + }; + + pll6: pll6 { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <1782000000>; + }; + + pll7: pll7 { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <2400000000>; + }; + soc { compatible = "simple-bus"; interrupt-parent = <&plic>; @@ -357,6 +563,99 @@ uart4: serial@121a0000 { status = "disabled"; }; + necrg: clock-controller@12320000 { + compatible = "starfive,jh8100-necrg"; + reg = <0x0 0x12320000 0x0 0x10000>; + clocks = <&osc>, <&syscrg JH8100_SYSCLK_AXI_400>, + <&syscrg JH8100_SYSCLK_VOUT_ROOT0>, + <&syscrg JH8100_SYSCLK_VOUT_ROOT1>, + <&syscrg JH8100_SYSCLK_USB_WRAP_480>, + <&syscrg JH8100_SYSCLK_USB_WRAP_625>, + <&syscrg JH8100_SYSCLK_USB_WRAP_240>, + <&syscrg JH8100_SYSCLK_USB_WRAP_60>, + <&syscrg JH8100_SYSCLK_USB_WRAP_156P25>, + <&syscrg JH8100_SYSCLK_USB_WRAP_312P5>, + <&syscrg JH8100_SYSCLK_USB_125M>, + <&nwcrg JH8100_NWCLK_GPIO_100>, + <&syscrg JH8100_SYSCLK_PERH_ROOT>, + <&syscrg JH8100_SYSCLK_MCLK>, + <&syscrg JH8100_SYSCLK_PERH_ROOT_PREOSC>, + <&syscrg JH8100_SYSCLK_AHB0>, + <&syscrg JH8100_SYSCLK_APB_BUS_PER1>, + <&syscrg JH8100_SYSCLK_APB_BUS_PER2>, + <&syscrg JH8100_SYSCLK_APB_BUS_PER3>, + <&syscrg JH8100_SYSCLK_APB_BUS_PER5>, + <&syscrg JH8100_SYSCLK_VENC_ROOT>, + <&syscrg JH8100_SYSCLK_SPI_CORE_100>, + <&glb_ext_clk>, <&usb3_tap_tck_ext>, + <&usb1_tap_tck_ext>, <&usb2_tap_tck_ext>, + <&typec_tap_tck_ext>, <&spi_in0_ext>, + <&spi_in1_ext>, <&i2stx_bclk_ext>, <&i2stx_lrck_ext>; + clock-names = "osc", "axi_400", "vout_root0", "vout_root1", + "usb_wrap_480", "usb_wrap_625", "usb_wrap_240", + "usb_wrap_60", "usb_wrap_156p25", "usb_wrap_312p5", + "usb_125m", "gpio_100", "perh_root", "mclk", + "perh_root_preosc", "ahb0", "apb_bus_per1", + "apb_bus_per2", "apb_bus_per3", "apb_bus_per5", + "venc_root", "spi_core_100", "glb-ext-clk", + "usb3-tap-tck-ext", "usb1-tap-tck-ext", + "usb2-tap-tck-ext", "typec-tap-tck-ext", "spi-in0-ext", + "spi-in1-ext", "i2stx-bclk-ext", "i2stx-lrck-ext"; + #clock-cells = <1>; + #reset-cells = <1>; + }; + + nwcrg: clock-controller@123c0000 { + compatible = "starfive,jh8100-nwcrg"; + reg = <0x0 0x123c0000 0x0 0x10000>; + clocks = <&osc>, <&syscrg JH8100_SYSCLK_APB_BUS>, + <&syscrg JH8100_SYSCLK_APB_BUS_PER4>, + <&syscrg JH8100_SYSCLK_SPI_CORE_100>, + <&syscrg JH8100_SYSCLK_ISP_2X>, + <&syscrg JH8100_SYSCLK_ISP_AXI>, + <&syscrg JH8100_SYSCLK_VOUT_ROOT0>, + <&syscrg JH8100_SYSCLK_VOUT_ROOT1>, + <&syscrg JH8100_SYSCLK_VOUT_SCAN_ATS>, + <&syscrg JH8100_SYSCLK_VOUT_DC_CORE>, + <&syscrg JH8100_SYSCLK_VOUT_AXI>, + <&syscrg JH8100_SYSCLK_AXI_400>, <&syscrg JH8100_SYSCLK_AHB0>, + <&syscrg JH8100_SYSCLK_PERH_ROOT_PREOSC>, + <&dvp_ext>, <&isp_dphy_tap_tck_ext>, <&glb_ext_clk>, + <&vout_mipi_dphy_tap_tck_ext>, <&vout_edp_tap_tck_ext>, + <&spi_in2_ext>, <&pll5>; + clock-names = "osc", "apb_bus", "apb_bus_per4", "spi_core_100", + "isp_2x", "isp_axi", "vout_root0", "vout_root1", + "vout_scan_ats", "vout_dc_core", "vout_axi", "axi_400", + "ahb0", "perh_root_preosc", "dvp-ext", + "isp-dphy-tap-tck-ext", "glb-ext-clk", + "vout-mipi-dphy-tap-tck-ext", "vout-edp-tap-tck-ext", + "spi-in2-ext", "pll5"; + #clock-cells = <1>; + #reset-cells = <1>; + }; + + syscrg: clock-controller@126d0000 { + compatible = "starfive,jh8100-syscrg"; + reg = <0x0 0x126d0000 0x0 0x10000>; + clocks = <&osc>, <&mclk_ext>, <&pll0>, <&pll1>, + <&pll2>, <&pll3>, <&pll4>, <&pll6>, <&pll7>; + clock-names = "osc", "mclk-ext", "pll0", "pll1", "pll2", + "pll3", "pll4", "pll6", "pll7"; + #clock-cells = <1>; + #reset-cells = <1>; + }; + + swcrg: clock-controller@12720000 { + compatible = "starfive,jh8100-swcrg"; + reg = <0x0 0x12720000 0x0 0x10000>; + clocks = <&syscrg JH8100_SYSCLK_APB_BUS>, + <&syscrg JH8100_SYSCLK_VDEC_ROOT>, + <&syscrg JH8100_SYSCLK_FLEXNOC1>; + clock-names = "apb_bus", "vdec_root", "flexnoc1"; + #clock-cells = <1>; + #reset-cells = <1>; + }; + uart5: serial@127d0000 { compatible = "starfive,jh8100-uart", "cdns,uart-r1p8"; reg = <0x0 0x127d0000 0x0 0x10000>; @@ -374,5 +673,19 @@ uart6: serial@127e0000 { interrupts = <73>; status = "disabled"; }; + + aoncrg: clock-controller@1f310000 { + compatible = "starfive,jh8100-aoncrg"; + reg = <0x0 0x1f310000 0x0 0x10000>; + clocks = <&osc>, <&gmac0_rmii_func>, + <&gmac0_rgmii_func>, <&aon125>, + <&aon2000>, <&aon200>, + <&aon667>, <&rtc>; + clock-names = "osc", "gmac0-rmii-func", "gmac0-rgmii-func", + "aon125", "aon2000", "aon200", + "aon667", "rtc"; + #clock-cells = <1>; + #reset-cells = <1>; + }; }; };