From patchwork Fri Mar 28 21:02:26 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 14032455 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 9BB2AC28B20 for ; Fri, 28 Mar 2025 21:02: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=SbwccY5qNapEl9MD6hFIT/rOm6TuuTsgx79v67R4iRk=; b=fdnKISK0zT1L9b tFtMNOY2KCW9kOpg9mgXXCIE6vRI73Fa2xlvbr440Km8Py2s41WA/4Jiy8nmTa/0aEozPR2d/89bl rFv+NPCvJfPIUzrvkVYO1KGwyru2zf5A7ZmtbbKQJ2GviMMvG0O1sAV5qkjVoUfi/P3ktQE7iUBPv 3vmlDQipcsnQwIqk5pCEyGwh7qRdzX5vHVPnqiHQRtk7jeA/KA5wIWZzb9Gcywq4BR96DhHw7O8jl 0G/SJYXg2A8wa/vrzj/RXgnurBSPGIwye5QtRvh0Q644Gns5prk6OZMZwwSfMkZn6oweHNibmaSWq REFLQVljUAGlGljLhhcQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.1 #2 (Red Hat Linux)) id 1tyGqh-0000000EJ4c-3zt0; Fri, 28 Mar 2025 21:02:43 +0000 Received: from mail-il1-x129.google.com ([2607:f8b0:4864:20::129]) by bombadil.infradead.org with esmtps (Exim 4.98.1 #2 (Red Hat Linux)) id 1tyGqd-0000000EJ3B-3Gtv for linux-riscv@lists.infradead.org; Fri, 28 Mar 2025 21:02:40 +0000 Received: by mail-il1-x129.google.com with SMTP id e9e14a558f8ab-3d46ef71b6cso20382245ab.3 for ; Fri, 28 Mar 2025 14:02:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=riscstar-com.20230601.gappssmtp.com; s=20230601; t=1743195759; x=1743800559; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=D+I4R8hFY8nbTjxThMP1fCn2I0A92HjRa+9lI35yvdA=; b=L8vi4sM+LmhFU91nAtBPArZvaP/FqBwNBj5KJFOOyljAUVtGfSBvPgSuQhszc54Zpb 4TmOWWuY+n1ar04IS/j1DVcLgjwcceGMNudEoGJnlHk0lH6JsyypaEihhBtPdlwfE4Jk kr+FBrlxJqOYZSUBu2Hz0Mq7Ynn5AcFnzNzj7G+hwXj6ADC7jiuQf9NPWn+9Tbln0iXQ LIocY6wHs4Q79OmssbXRREtCbbuYYSUDAgcvk1nxWzsjd/DJ3fLIe3pkzD6fLOBgmLwl 2rF7FhPAyQVQGqkWkHgoeGmUKAGTEinuq0EUiMYlrg4jBggu/C2l5DZ8Krs8OnFFvHHH x9yQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743195759; x=1743800559; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=D+I4R8hFY8nbTjxThMP1fCn2I0A92HjRa+9lI35yvdA=; b=VKBOEXUlbhYtO+7mpb0PjmARb7bO+YJozA2owbWisWZ5O8eAd5KxMwMHhrMIU7oh92 rlRk/xNhwV5B6kvd+yLLAchQFx4UTSiDSb4qFs5SelL6xwd8pTGMSKtdFaF+sC2Abf/R rnpte79iLGPRUfiCAOuZi/yi3Ezyb3CWEiFVu0nnYRmSELBAWnFZDimZCCuatfcdyA7b NKYVATGd0gSDbld+N9tUfvkvJlXtjSMWqc8NsMepO/LZwQGnj+H6lbOvQ/g8QWql7qbw Qk8i2ndLucAeHAiVKOwY3UQ6WAWPoxHGsPA0OShxxoVJ2II2P5MB9Sjj5jIEw0aD6AaR DSqA== X-Forwarded-Encrypted: i=1; AJvYcCVNyMFx9PRRlq0B9TNF2Gw7YLJ/YNve/KdyRCp4U57qUc3hwoeJ6UzdLKOKgvQ1R3Ren8W/QTxkglYwhA==@lists.infradead.org X-Gm-Message-State: AOJu0Yx6DkkUjabLUsNZNJ+8Z95n3e/pbO63p1k8iU0AC9L9DLToIKq0 jOn+N2wyf7GiUnJLKU3wTgxF/XnlvEQjn5BTGPAb51BYXTWAGOYCTnZ0wnLmoxw= X-Gm-Gg: ASbGncv6xYMOQhELAOPlVBMc3783s6Zwu2yKBbOMo7Smkf2k85Ye5C/P9+lmSOX1996 StuY+32HZIb5uDpXBNTGne8qob1hLd3/nKHuLl4kP5VlPYfa8nfA9xdEEMDZg4Q8HVxT4EjjwzN FOug8WkLWyDDvRCBZZsG2kuvEfuC2+wqDbo1O4xlEcSnnZAAxdRMSEqyxBA35LpM76wNf6yeqxG tzBBBabQngbnMooGE7jUG6nhpXv5VOoiDZvD3p/WXmJhvpAJS+5aIfq2wINwUTDMrSAOSU+aqIj ve27rZtuN8v5AUGdn/nNI0jUVVDkIC5++gbPXdciooxhfGvzTYIBijptpGmqZ+cBnalB9YqS3+u MBqZpf8OxNRLP04anV6vX1XmmhIMJ X-Google-Smtp-Source: AGHT+IGrCkE4ALBvVvYXuJ5uIYIbMnM60Ht0P6jdptpmfqvQjmweZFQXjhwRhsQczTG2B1yYskoZYw== X-Received: by 2002:a05:6e02:3c85:b0:3d3:f7ed:c907 with SMTP id e9e14a558f8ab-3d5e09e4ad6mr11092245ab.15.1743195758716; Fri, 28 Mar 2025 14:02:38 -0700 (PDT) Received: from localhost.localdomain (c-73-228-159-35.hsd1.mn.comcast.net. [73.228.159.35]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-3d5d5a74286sm6769405ab.39.2025.03.28.14.02.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Mar 2025 14:02:38 -0700 (PDT) From: Alex Elder To: robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, p.zabel@pengutronix.de, mturquette@baylibre.com, sboyd@kernel.org, dlan@gentoo.org Cc: heylenay@4d2.org, guodong@riscstar.com, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, spacemit@lists.linux.dev, devicetree@vger.kernel.org, linux-clk@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/7] dt-bindings: soc: spacemit: define spacemit,k1-ccu resets Date: Fri, 28 Mar 2025 16:02:26 -0500 Message-ID: <20250328210233.1077035-2-elder@riscstar.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250328210233.1077035-1-elder@riscstar.com> References: <20250328210233.1077035-1-elder@riscstar.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250328_140239_817996_D4EBB379 X-CRM114-Status: GOOD ( 10.62 ) 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 There are additional SpacemiT syscon CCUs whose registers control both clocks and resets: RCPU, RCPU2, and APBC2. Unlike those defined previously, these will initially support only resets. They do not incorporate power domain functionality. Define the index values for resets associated with all SpacemiT K1 syscon nodes, including those with clocks already defined, as well as the new ones (without clocks). Signed-off-by: Alex Elder Reviewed-by: Rob Herring (Arm) --- v2: - Names are now RESET_* rather than RST_* - Added Rob's Reviewed-by tag .../soc/spacemit/spacemit,k1-syscon.yaml | 13 +- include/dt-bindings/clock/spacemit,k1-ccu.h | 128 ++++++++++++++++++ 2 files changed, 137 insertions(+), 4 deletions(-) diff --git a/Documentation/devicetree/bindings/soc/spacemit/spacemit,k1-syscon.yaml b/Documentation/devicetree/bindings/soc/spacemit/spacemit,k1-syscon.yaml index 07a6728e6f864..333c28e075b6c 100644 --- a/Documentation/devicetree/bindings/soc/spacemit/spacemit,k1-syscon.yaml +++ b/Documentation/devicetree/bindings/soc/spacemit/spacemit,k1-syscon.yaml @@ -19,6 +19,9 @@ properties: - spacemit,k1-syscon-apbc - spacemit,k1-syscon-apmu - spacemit,k1-syscon-mpmu + - spacemit,k1-syscon-rcpu + - spacemit,k1-syscon-rcpu2 + - spacemit,k1-syscon-apbc2 reg: maxItems: 1 @@ -57,13 +60,15 @@ allOf: properties: compatible: contains: - const: spacemit,k1-syscon-apbc + enum: + - spacemit,k1-syscon-apmu + - spacemit,k1-syscon-mpmu then: - properties: - "#power-domain-cells": false - else: required: - "#power-domain-cells" + else: + properties: + "#power-domain-cells": false additionalProperties: false diff --git a/include/dt-bindings/clock/spacemit,k1-ccu.h b/include/dt-bindings/clock/spacemit,k1-ccu.h index 4a0c7163257e3..a4f68cba44d1b 100644 --- a/include/dt-bindings/clock/spacemit,k1-ccu.h +++ b/include/dt-bindings/clock/spacemit,k1-ccu.h @@ -78,6 +78,9 @@ #define CLK_APB 31 #define CLK_WDT_BUS 32 +/* MPMU resets */ +#define RESET_WDT 0 + /* APBC clocks */ #define CLK_UART0 0 #define CLK_UART2 1 @@ -180,6 +183,59 @@ #define CLK_TSEN_BUS 98 #define CLK_IPC_AP2AUD_BUS 99 +/* APBC resets */ +#define RESET_UART0 0 +#define RESET_UART2 1 +#define RESET_UART3 2 +#define RESET_UART4 3 +#define RESET_UART5 4 +#define RESET_UART6 5 +#define RESET_UART7 6 +#define RESET_UART8 7 +#define RESET_UART9 8 +#define RESET_GPIO 9 +#define RESET_PWM0 10 +#define RESET_PWM1 11 +#define RESET_PWM2 12 +#define RESET_PWM3 13 +#define RESET_PWM4 14 +#define RESET_PWM5 15 +#define RESET_PWM6 16 +#define RESET_PWM7 17 +#define RESET_PWM8 18 +#define RESET_PWM9 19 +#define RESET_PWM10 20 +#define RESET_PWM11 21 +#define RESET_PWM12 22 +#define RESET_PWM13 23 +#define RESET_PWM14 24 +#define RESET_PWM15 25 +#define RESET_PWM16 26 +#define RESET_PWM17 27 +#define RESET_PWM18 28 +#define RESET_PWM19 29 +#define RESET_SSP3 30 +#define RESET_RTC 31 +#define RESET_TWSI0 32 +#define RESET_TWSI1 33 +#define RESET_TWSI2 34 +#define RESET_TWSI4 35 +#define RESET_TWSI5 36 +#define RESET_TWSI6 37 +#define RESET_TWSI7 38 +#define RESET_TWSI8 39 +#define RESET_TIMERS1 40 +#define RESET_TIMERS2 41 +#define RESET_AIB 42 +#define RESET_ONEWIRE 43 +#define RESET_SSPA0 44 +#define RESET_SSPA1 45 +#define RESET_DRO 46 +#define RESET_IR 47 +#define RESET_TSEN 48 +#define RESET_IPC_AP2AUD 49 +#define RESET_CAN0 50 + /* APMU clocks */ #define CLK_CCI550 0 #define CLK_CPU_C0_HI 1 @@ -244,4 +300,76 @@ #define CLK_V2D 60 #define CLK_EMMC_BUS 61 +/* APMU resets */ +#define RESET_CCIC_4X 0 +#define RESET_CCIC1_PHY 1 +#define RESET_SDH_AXI 2 +#define RESET_SDH0 3 +#define RESET_SDH1 4 +#define RESET_SDH2 5 +#define RESET_USBP1_AXI 6 +#define RESET_USB_AXI 7 +#define RESET_USB3_0 8 +#define RESET_QSPI 9 +#define RESET_QSPI_BUS 10 +#define RESET_DMA 11 +#define RESET_AES 12 +#define RESET_VPU 13 +#define RESET_GPU 14 +#define RESET_EMMC 15 +#define RESET_EMMC_X 16 +#define RESET_AUDIO 17 +#define RESET_HDMI 18 +#define RESET_PCIE0 19 +#define RESET_PCIE1 20 +#define RESET_PCIE2 21 +#define RESET_EMAC0 22 +#define RESET_EMAC1 23 +#define RESET_JPG 24 +#define RESET_CCIC2PHY 25 +#define RESET_CCIC3PHY 26 +#define RESET_CSI 27 +#define RESET_ISP_CPP 28 +#define RESET_ISP_BUS 29 +#define RESET_ISP 30 +#define RESET_ISP_CI 31 +#define RESET_DPU_MCLK 32 +#define RESET_DPU_ESC 33 +#define RESET_DPU_HCLK 34 +#define RESET_DPU_SPIBUS 35 +#define RESET_DPU_SPI_HBUS 36 +#define RESET_V2D 37 +#define RESET_MIPI 38 +#define RESET_MC 39 + +/* RCPU resets */ +#define RESET_RCPU_SSP0 0 +#define RESET_RCPU_I2C0 1 +#define RESET_RCPU_UART1 2 +#define RESET_RCPU_IR 3 +#define RESET_RCPU_CAN 4 +#define RESET_RCPU_UART0 5 +#define RESET_RCPU_HDMI_AUDIO 6 + +/* RCPU2 resets */ +#define RESET_RCPU2_PWM0 0 +#define RESET_RCPU2_PWM1 1 +#define RESET_RCPU2_PWM2 2 +#define RESET_RCPU2_PWM3 3 +#define RESET_RCPU2_PWM4 4 +#define RESET_RCPU2_PWM5 5 +#define RESET_RCPU2_PWM6 6 +#define RESET_RCPU2_PWM7 7 +#define RESET_RCPU2_PWM8 8 +#define RESET_RCPU2_PWM9 9 + +/* APBC2 resets */ +#define RESET_APBC2_UART1 0 +#define RESET_APBC2_SSP2 1 +#define RESET_APBC2_TWSI3 2 +#define RESET_APBC2_RTC 3 +#define RESET_APBC2_TIMERS0 4 +#define RESET_APBC2_KPC 5 +#define RESET_APBC2_GPIO 6 + #endif /* _DT_BINDINGS_SPACEMIT_CCU_H_ */ From patchwork Fri Mar 28 21:02:27 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 14032462 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 5131EC28B20 for ; Fri, 28 Mar 2025 21:02: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=rftJBSLF9Bv0wi16R846lC6ztDq50D4PudjCLdrqXGw=; b=dP8ezLEENP4kHd hLOm7JmE4NX7ljbSLHal563u3oE2MRLd/Itk7ZtJHhsJetHKyJhPsnRXEs0LvrKvTuHFTEfAGY3RM 0cdU2xK/2ErymnmJSl7AUwvVLxdC/ZN84d6FJI2c96Q0mjJ5f5SLt/10YDsXOpZP0eVCMcgchaeMl d3Yes62D+o3KWCFnjzGeDVwD42ivrkA/RjDNF6Dh1gyKQiwe0M+Eko0dP9RLpt7/yd9rx7ViigOV2 zt/HRkKK3cr7lPPRyPuMIe2IMcN7/ZKuojj3yGAy8AzqGRIDfoyqnDQpfEL9zIzhmNe1fzlJhvYGh dYiD/4qJspeC2WvUfjMg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.1 #2 (Red Hat Linux)) id 1tyGqi-0000000EJ53-2LlR; Fri, 28 Mar 2025 21:02:44 +0000 Received: from mail-il1-x12c.google.com ([2607:f8b0:4864:20::12c]) by bombadil.infradead.org with esmtps (Exim 4.98.1 #2 (Red Hat Linux)) id 1tyGqf-0000000EJ3X-1Ag0 for linux-riscv@lists.infradead.org; Fri, 28 Mar 2025 21:02:42 +0000 Received: by mail-il1-x12c.google.com with SMTP id e9e14a558f8ab-3cfeff44d94so9002825ab.0 for ; Fri, 28 Mar 2025 14:02:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=riscstar-com.20230601.gappssmtp.com; s=20230601; t=1743195760; x=1743800560; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=4EIFREDKUdAp5cmkKXroBOp9ZjEFUNtcVcLKCQaMF1U=; b=1jdAPqxKFeCXAd11o9zxe7LljOUuwgBD996SsS7hSisOQ1NQcWUY6PAoG7EexiRSrj r8EFJX6Mswd7npD6VqbFI6jRuvvYnHLjMycOVCX9RgUWR8vEAzLEQd8nyGbeWgDUfgL4 oo7EH+or8CBNhdHuE+fMKGDvLA+zp3sWEh8bmFZWnaC70drk/vcj7j154x+C0P6YBFw4 7i13bUQI1gSHKYfkrhN7wJ2XswWXTPSTmWMRD1NuuhFdI9YUik/VEU8JPmq91TbPAKHf 4NegACU5j4+WgcSHJIc76PxtkIj1oo2uU9DQOQDiQN9IsMpQGfx0SrJAqCdbeEFdnXGL 7i5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743195760; x=1743800560; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4EIFREDKUdAp5cmkKXroBOp9ZjEFUNtcVcLKCQaMF1U=; b=N1VFz+8eLsDc6Bpq/WOSa5fQCQtdFGOEe/Vb7C9QlA3zlKHD8C9Y2R+mvURMdJRDmQ km4oVX3AzaVWyDsj7kSYODF1w120ez8vNdfYMdF+hlASGhd9ibR6LNdWjLBU2c1r4G1o FsXsrj1wjvQP7Taa9ISctpLF86R3jzVf2f4lEZJB5NYlouLC7qcLKQFpVyxXY94HefGw Shz/Wf15QyHZKk9Deenvq8VYXqWt7rbu2mMIrhHtq5OQulpds3UlymW/ZXgQLI8jocsl drTeZCAkOF51vvmWxx41evdQewsTPruG2SrM5MNM/2MSeyHOZZ5S2SJSpkbqtLpoy/X8 hbqw== X-Forwarded-Encrypted: i=1; AJvYcCXLo/azLan6MXOKvEndkD8+/9hpjS7xlQaIQWgP0YwgubYQwJIcAfs8lv+R279D5G3T5YxZu2YvQlcdMw==@lists.infradead.org X-Gm-Message-State: AOJu0YzU5corCr+OmNv14R9Vg3O1gmxXjzOWHnlJVKkgrmuSqj/S2jau P5JKb5fwqbi/4IS0PT/G5GrbA/GoqcC6QWY7XBfi50Ct/IpyB1ib3YQUlZXJ5uQ= X-Gm-Gg: ASbGnctlBx7sTBxGuf6D2qnhFBoTWOOeprmz2IC1dFuyGEyTpdQNTXv1swssl5yOfFW xhJcSLMnCrfBnz6iACG7MjDe+L56+nHTrA72Q+sivmV/1awjSzZMq4D4jLF3ryBLKmRf0B1UluL qEWa6kv0Qued/UUnFiLIFufAEnOTM1+v7Rkc09JHiiwXnvpTmjezTELMzioFbqu+ePHKOjRl+S7 Qo2k/ijjbTx9+A8GYq37m9+Ef3u5hWbuTkmjT+Rbp3aSnOHxAcOUEZdoMH/4b6lfs3+4NepG8UP JTvPq7+nQu9ktRlqfAOpjlpA2epsjPVe5r8Ro9+gWfiVN7zGU9QHVDeK8HR4lyZDLgYqFIK5JgC OcHtIpAyNn8S7km6f6g== X-Google-Smtp-Source: AGHT+IGv/tQ9yOo+nSa2AdmuIJoHsAcKRHvpATkGTYnJegSwl7f8akCnzw41qA7R6W+uGcKVHvpvvQ== X-Received: by 2002:a05:6e02:3906:b0:3d3:eeec:8a0b with SMTP id e9e14a558f8ab-3d5e091406dmr8990475ab.10.1743195760197; Fri, 28 Mar 2025 14:02:40 -0700 (PDT) Received: from localhost.localdomain (c-73-228-159-35.hsd1.mn.comcast.net. [73.228.159.35]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-3d5d5a74286sm6769405ab.39.2025.03.28.14.02.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Mar 2025 14:02:39 -0700 (PDT) From: Alex Elder To: p.zabel@pengutronix.de, mturquette@baylibre.com, sboyd@kernel.org, dlan@gentoo.org Cc: robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, heylenay@4d2.org, guodong@riscstar.com, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, spacemit@lists.linux.dev, devicetree@vger.kernel.org, linux-clk@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/7] clk: spacemit: define struct spacemit_ccu_data Date: Fri, 28 Mar 2025 16:02:27 -0500 Message-ID: <20250328210233.1077035-3-elder@riscstar.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250328210233.1077035-1-elder@riscstar.com> References: <20250328210233.1077035-1-elder@riscstar.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250328_140241_318604_B4980933 X-CRM114-Status: GOOD ( 20.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 Define a new structure type to be used for describing the OF match data. Rather than using the array of spacemit_ccu_clk structures for match data, we use this structure instead. Move the definition of the spacemit_ccu_clk structure closer to the top of the source file, and add the new structure definition below it. Signed-off-by: Alex Elder --- v2: - New structure is called spacemit_ccu_data, not k1_ccu_data - Don't check for a null match data pointer; add a comment instead drivers/clk/spacemit/ccu-k1.c | 55 ++++++++++++++++++++++++++--------- 1 file changed, 41 insertions(+), 14 deletions(-) diff --git a/drivers/clk/spacemit/ccu-k1.c b/drivers/clk/spacemit/ccu-k1.c index 44db48ae71313..5cadb395a7dd6 100644 --- a/drivers/clk/spacemit/ccu-k1.c +++ b/drivers/clk/spacemit/ccu-k1.c @@ -129,6 +129,15 @@ #define APMU_EMAC0_CLK_RES_CTRL 0x3e4 #define APMU_EMAC1_CLK_RES_CTRL 0x3ec +struct spacemit_ccu_clk { + int id; + struct clk_hw *hw; +}; + +struct spacemit_ccu_data { + struct spacemit_ccu_clk *clk; /* array with sentinel */ +}; + /* APBS clocks start */ /* Frequency of pll{1,2} should not be updated at runtime */ @@ -1359,11 +1368,6 @@ static CCU_GATE_DEFINE(emmc_bus_clk, CCU_PARENT_HW(pmua_aclk), 0); /* APMU clocks end */ -struct spacemit_ccu_clk { - int id; - struct clk_hw *hw; -}; - static struct spacemit_ccu_clk k1_ccu_apbs_clks[] = { { CLK_PLL1, &pll1.common.hw }, { CLK_PLL2, &pll2.common.hw }, @@ -1403,6 +1407,10 @@ static struct spacemit_ccu_clk k1_ccu_apbs_clks[] = { { 0, NULL }, }; +static const struct spacemit_ccu_data k1_ccu_apbs_data = { + .clk = k1_ccu_apbs_clks, +}; + static struct spacemit_ccu_clk k1_ccu_mpmu_clks[] = { { CLK_PLL1_307P2, &pll1_d8_307p2.common.hw }, { CLK_PLL1_76P8, &pll1_d32_76p8.common.hw }, @@ -1440,6 +1448,10 @@ static struct spacemit_ccu_clk k1_ccu_mpmu_clks[] = { { 0, NULL }, }; +static const struct spacemit_ccu_data k1_ccu_mpmu_data = { + .clk = k1_ccu_mpmu_clks, +}; + static struct spacemit_ccu_clk k1_ccu_apbc_clks[] = { { CLK_UART0, &uart0_clk.common.hw }, { CLK_UART2, &uart2_clk.common.hw }, @@ -1544,6 +1556,10 @@ static struct spacemit_ccu_clk k1_ccu_apbc_clks[] = { { 0, NULL }, }; +static const struct spacemit_ccu_data k1_ccu_apbc_data = { + .clk = k1_ccu_apbc_clks, +}; + static struct spacemit_ccu_clk k1_ccu_apmu_clks[] = { { CLK_CCI550, &cci550_clk.common.hw }, { CLK_CPU_C0_HI, &cpu_c0_hi_clk.common.hw }, @@ -1610,9 +1626,13 @@ static struct spacemit_ccu_clk k1_ccu_apmu_clks[] = { { 0, NULL }, }; +static const struct spacemit_ccu_data k1_ccu_apmu_data = { + .clk = k1_ccu_apmu_clks, +}; + static int spacemit_ccu_register(struct device *dev, struct regmap *regmap, struct regmap *lock_regmap, - const struct spacemit_ccu_clk *clks) + struct spacemit_ccu_clk *clks) { const struct spacemit_ccu_clk *clk; int i, ret, max_id = 0; @@ -1648,15 +1668,22 @@ static int spacemit_ccu_register(struct device *dev, clk_data->num = max_id + 1; - return devm_of_clk_add_hw_provider(dev, of_clk_hw_onecell_get, clk_data); + ret = devm_of_clk_add_hw_provider(dev, of_clk_hw_onecell_get, clk_data); + if (ret) + dev_err(dev, "error %d adding clock hardware provider\n", ret); + + return ret; } static int k1_ccu_probe(struct platform_device *pdev) { struct regmap *base_regmap, *lock_regmap = NULL; + const struct spacemit_ccu_data *data; struct device *dev = &pdev->dev; int ret; + data = of_device_get_match_data(dev); + base_regmap = device_node_to_regmap(dev->of_node); if (IS_ERR(base_regmap)) return dev_err_probe(dev, PTR_ERR(base_regmap), @@ -1677,32 +1704,32 @@ static int k1_ccu_probe(struct platform_device *pdev) "failed to get lock regmap\n"); } - ret = spacemit_ccu_register(dev, base_regmap, lock_regmap, - of_device_get_match_data(dev)); + ret = spacemit_ccu_register(dev, base_regmap, lock_regmap, data->clk); if (ret) return dev_err_probe(dev, ret, "failed to register clocks\n"); return 0; } +/* The match data is required to be non-null, and have a non-null clk pointer */ static const struct of_device_id of_k1_ccu_match[] = { { .compatible = "spacemit,k1-pll", - .data = k1_ccu_apbs_clks, + .data = &k1_ccu_apbs_data, }, { .compatible = "spacemit,k1-syscon-mpmu", - .data = k1_ccu_mpmu_clks, + .data = &k1_ccu_mpmu_data, }, { .compatible = "spacemit,k1-syscon-apbc", - .data = k1_ccu_apbc_clks, + .data = &k1_ccu_apbc_data, }, { .compatible = "spacemit,k1-syscon-apmu", - .data = k1_ccu_apmu_clks, + .data = &k1_ccu_apmu_data, }, - { } + { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, of_k1_ccu_match); From patchwork Fri Mar 28 21:02:28 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 14032459 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 EFF22C36013 for ; Fri, 28 Mar 2025 21:02: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=Vry836bBFYJwxDdxC+lYm3rc5uvTQWaRHSUT2EdG7IA=; b=2qZYDTK+U5TXmg ig53JEPYUu0zEMbZEdA/cbmCiJ2zOEpVcs7lQjXteHPpXk6V6vWNblAeafFCp8s37akO8t9uw16Kq LR6yPupo/IL8HaS9YRCqrXHmyDkcRdj8ub2ck5qW7VXEFO0GPRpciZEqQ0xK46Ze4/poFE2ps09kc 4FwCrLrQD7RbKlSXyZQj7ju0ktNmK7SbYVjhcDXqhPc6SwqpKMnNY4sAZmv9pQm2bhQoxGrke2UYP dNEijk9zJuwa9QLiHodrWmFR7HCyRH1S+d0fkXdxkeyERcH7F9D0mr4iQvC85VJTUeVBS7zMv2fRg GjgEBFIz7XclmsCoUwrw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.1 #2 (Red Hat Linux)) id 1tyGqk-0000000EJ6C-0g6a; Fri, 28 Mar 2025 21:02:46 +0000 Received: from mail-il1-x12e.google.com ([2607:f8b0:4864:20::12e]) by bombadil.infradead.org with esmtps (Exim 4.98.1 #2 (Red Hat Linux)) id 1tyGqg-0000000EJ3y-3emd for linux-riscv@lists.infradead.org; Fri, 28 Mar 2025 21:02:45 +0000 Received: by mail-il1-x12e.google.com with SMTP id e9e14a558f8ab-3d439dc0548so6900275ab.3 for ; Fri, 28 Mar 2025 14:02:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=riscstar-com.20230601.gappssmtp.com; s=20230601; t=1743195762; x=1743800562; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=FIUpk1T7UnnKdNmxEWfla8NigtjlAU2jHuPthzllD9o=; b=iRN4qjO339DmLE03Kcs9v7YA91n3FY0Zhi4ZeuFdjok7Ew4ZZPje2J9TcGyIMHPfZq 6VFaYs18izK57uH+Y5AjQTD+m4hLpD/HeLsN4W16tEWYioD6rt86eOjcxUKLQ2qRZ9wk pag/PtvdUeWhz1J4mXT3051GVdIWOM+B5w/IAyP37W2BCWHqVOfPpgT6uqRWoYgbHyGW F1LNFn0pbd+d3Mm6V1IL+1HdODZvy9Ci2J6uvKGcpUv5qzTBtajo0tu9+UNamQNoh0GI J3uitbXHDNYPS1oYwiFSdvPTYHxmjUdlFmJIfQq9tHRuUgZxXseK4NhDP3WH79yzRj4H PbLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743195762; x=1743800562; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FIUpk1T7UnnKdNmxEWfla8NigtjlAU2jHuPthzllD9o=; b=wa1lfHXKc0bIJhjSaSiCsRb4pfK9uhui2uxyI94TeGcxOoWs8gttHK1XxCsh4GZIts 7SISCVeOhdnxZFr1kUKY/R3lBiukXnm/wUz8OptghGmEuV+xdkF6aihPAvqzliYLH99e UeBbWxHpc4UT8q959vAJcIWily+wpqxNmzAoicmLa0N2yeaefRXKpxmyf3FEnKRaLvjG yoa+Ur40xrj9LnVEVOjLWKGJHs/5mSHnxK+nD/rbSydzxQfqlHHypSrnq1sPwtZwM1IO g40Bzr6ect+guFA7JpGHOcKvX8TziC0W3nj+zLmv4b6qWgBZOpFIJ6Q9SWLTjI7WHqiJ G6ug== X-Forwarded-Encrypted: i=1; AJvYcCX4HDA6Wag9S4YsDtm+ZyM1XORw5Ac8KfFP6ja3fhv1MPxrM1o/1CG0AWIZL0HsYynMuVWp/+Ub7gltSg==@lists.infradead.org X-Gm-Message-State: AOJu0YynJ6NPQM6uTUTe9yBQf1cdXeF/0lxBeaX8L8E2WmAypmM1wuMl ogN35T1JQp7cG6JwI98Ahqx/WRNm7GCRjFWmfPBMn/TRjZdnYeJjs/qhwNhOpjg= X-Gm-Gg: ASbGncskWkJaWnzEfuQGkRkv+Gwf4C/bNe+rUUiz8cLBNgyeBpkMijZBDm1oJGsmitp s2RYrBoRh4nEf7yTGoGY+tZztsJAcQyK6yaolwv+WTnz+XmdnPKrYtn83pWDYZBMnkWjjOaqLYq LuydlLqCD0AVHmupDsWFPpmLCxy/jAyJir755gKQCrn5V01M6/VoqP/jyRCU92qd974T8ufZb9f KEdpSDmoHSJWeLaAh+3UJ3E2u/e7SpiqOMgXFh4jJ+hllkJUPMqFL7b+CxU93seObcTgpx7I9NZ uoqV4+kBvccEK6V25MoFSBo8oHjF84t0fy3F9+VZHJTlNleVwLDNHAzy5+gEdyAhoQP7fi8yI9a Fb3M6mPDjhVQ3DsUgSIbuUYbLkUbZ X-Google-Smtp-Source: AGHT+IECKvdnGHV+2dD/S9BOB5FzsYtTtuEs5MGoEBeKOGx5i4Vk45Sjo1VplD8ywIkPbA8ikLjZxg== X-Received: by 2002:a05:6e02:3d04:b0:3d0:4e2b:9bbb with SMTP id e9e14a558f8ab-3d5e0a0063cmr13188765ab.21.1743195761696; Fri, 28 Mar 2025 14:02:41 -0700 (PDT) Received: from localhost.localdomain (c-73-228-159-35.hsd1.mn.comcast.net. [73.228.159.35]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-3d5d5a74286sm6769405ab.39.2025.03.28.14.02.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Mar 2025 14:02:41 -0700 (PDT) From: Alex Elder To: p.zabel@pengutronix.de, mturquette@baylibre.com, sboyd@kernel.org, dlan@gentoo.org Cc: robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, heylenay@4d2.org, guodong@riscstar.com, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, spacemit@lists.linux.dev, devicetree@vger.kernel.org, linux-clk@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 3/7] clk: spacemit: add reset controller support Date: Fri, 28 Mar 2025 16:02:28 -0500 Message-ID: <20250328210233.1077035-4-elder@riscstar.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250328210233.1077035-1-elder@riscstar.com> References: <20250328210233.1077035-1-elder@riscstar.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250328_140242_909330_F0B1C26B X-CRM114-Status: GOOD ( 21.53 ) 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 Define ccu_reset_data as a structure that contains the constant register offset and bitmasks used to assert and deassert a reset control on a SpacemiT K1 CCU. Define ccu_reset_controller_data as a structure that contains the address of an array of those structures and a count of the number of elements in the array. Add a pointer to a ccu_reset_controller_data structure to the spacemit_ccu_data structure. Reset support is optional for SpacemiT CCUs; the new pointer field will be null for CCUs without any resets. Finally, define a new ccu_reset_controller structure, which (for a CCU with resets) contains a pointer to the constant reset data, the regmap to be used for the controller, and an embedded a reset controller structure. Each reset control is asserted or deasserted by updating bits in a register. The bits used are defined by an assert mask and a deassert mask. In some cases, one (non-zero) mask asserts reset and a different (non-zero) mask deasserts it. Otherwise one mask is nonzero, and the other is zero. Either way, the bits in both masks are cleared, then either the assert mask or the deassert mask is set in a register to affect the state of a reset control. Signed-off-by: Alex Elder --- v2: - Use regmap_update_bits() to safely update a register - Symbols are named RESET* and reset* rather than RST* and rst* - Reordered some assignments in the registration function - Allowed some longs to exceed 80 column width drivers/clk/spacemit/ccu-k1.c | 83 +++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) diff --git a/drivers/clk/spacemit/ccu-k1.c b/drivers/clk/spacemit/ccu-k1.c index 5cadb395a7dd6..9c7c7108cfe38 100644 --- a/drivers/clk/spacemit/ccu-k1.c +++ b/drivers/clk/spacemit/ccu-k1.c @@ -10,6 +10,7 @@ #include #include #include +#include #include "ccu_common.h" #include "ccu_pll.h" @@ -134,8 +135,26 @@ struct spacemit_ccu_clk { struct clk_hw *hw; }; +struct ccu_reset_data { + u32 offset; + u32 assert_mask; + u32 deassert_mask; +}; + +struct ccu_reset_controller_data { + u32 count; + const struct ccu_reset_data *data; /* array */ +}; + struct spacemit_ccu_data { struct spacemit_ccu_clk *clk; /* array with sentinel */ + const struct ccu_reset_controller_data *reset_data; +}; + +struct ccu_reset_controller { + struct regmap *regmap; + const struct ccu_reset_controller_data *data; + struct reset_controller_dev rcdev; }; /* APBS clocks start */ @@ -1630,6 +1649,39 @@ static const struct spacemit_ccu_data k1_ccu_apmu_data = { .clk = k1_ccu_apmu_clks, }; +static int spacemit_reset_update(struct reset_controller_dev *rcdev, + unsigned long id, bool assert) +{ + struct ccu_reset_controller *controller; + const struct ccu_reset_data *data; + u32 mask; + u32 val; + + controller = container_of(rcdev, struct ccu_reset_controller, rcdev); + data = &controller->data->data[id]; + mask = data->assert_mask | data->deassert_mask; + val = assert ? data->assert_mask : data->deassert_mask; + + return regmap_update_bits(controller->regmap, data->offset, mask, val); +} + +static int spacemit_reset_assert(struct reset_controller_dev *rcdev, + unsigned long id) +{ + return spacemit_reset_update(rcdev, id, true); +} + +static int spacemit_reset_deassert(struct reset_controller_dev *rcdev, + unsigned long id) +{ + return spacemit_reset_update(rcdev, id, false); +} + +static const struct reset_control_ops spacemit_reset_control_ops = { + .assert = spacemit_reset_assert, + .deassert = spacemit_reset_deassert, +}; + static int spacemit_ccu_register(struct device *dev, struct regmap *regmap, struct regmap *lock_regmap, struct spacemit_ccu_clk *clks) @@ -1675,6 +1727,33 @@ static int spacemit_ccu_register(struct device *dev, return ret; } +static int spacemit_reset_controller_register(struct device *dev, + struct regmap *regmap, + const struct ccu_reset_controller_data *data) +{ + struct ccu_reset_controller *controller; + struct reset_controller_dev *rcdev; + + /* Resets are optional */ + if (!data) + return 0; + + controller = devm_kzalloc(dev, sizeof(*controller), GFP_KERNEL); + if (!controller) + return -ENOMEM; + + controller->regmap = regmap; + controller->data = data; + + rcdev = &controller->rcdev; + rcdev->ops = &spacemit_reset_control_ops; + rcdev->owner = THIS_MODULE; + rcdev->of_node = dev->of_node; + rcdev->nr_resets = data->count; + + return devm_reset_controller_register(dev, rcdev); +} + static int k1_ccu_probe(struct platform_device *pdev) { struct regmap *base_regmap, *lock_regmap = NULL; @@ -1708,6 +1787,10 @@ static int k1_ccu_probe(struct platform_device *pdev) if (ret) return dev_err_probe(dev, ret, "failed to register clocks\n"); + ret = spacemit_reset_controller_register(dev, base_regmap, data->reset_data); + if (ret) + return dev_err_probe(dev, ret, "failed to register reset controller\n"); + return 0; } From patchwork Fri Mar 28 21:02:29 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 14032456 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 C9C98C3600C for ; Fri, 28 Mar 2025 21:02: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=ne+pxgXstz3aP0L3W141goRyW7S3zMBDGqVgWiriFK8=; b=XWA5p8fZKaibxS +UWF0ggtmNdoyTix8XBJj5DaM0RMVRfce+fGKhnp96ED1+WeiZtbO36qGLebylGSet1za6wrHl7vk z6TFB2Yb/3bDHu0KxBFlpBgmUCVGg+q0EOSngv1G1ohgkA+r4FEpFEpBOYx2mv+MOmZ3yMQoaed9z N9ix0v6l3tLPEJ771zwJJyK7BxEFwYLkvafibG9oFj9E5upv4IXdr4+P+MMacbGASxjaaQIcrf2Qy rS2VglCK/LcnBkKNG9EpniSXMdZ+HlzYAx6qF1UhJ7OLdEBkF66smkBloq1N/4NyKugUGFys8Hc/v 80o6tzmYy0OMcZoWWUAw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.1 #2 (Red Hat Linux)) id 1tyGqk-0000000EJ6l-3DZd; Fri, 28 Mar 2025 21:02:46 +0000 Received: from mail-il1-x134.google.com ([2607:f8b0:4864:20::134]) by bombadil.infradead.org with esmtps (Exim 4.98.1 #2 (Red Hat Linux)) id 1tyGqi-0000000EJ4U-0ypj for linux-riscv@lists.infradead.org; Fri, 28 Mar 2025 21:02:45 +0000 Received: by mail-il1-x134.google.com with SMTP id e9e14a558f8ab-3d03d2bd7d2so27135065ab.0 for ; Fri, 28 Mar 2025 14:02:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=riscstar-com.20230601.gappssmtp.com; s=20230601; t=1743195763; x=1743800563; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ndQqR2MnSXfwHsDu2XmXqV7CwtML+mkAPgKOSkm6+Z8=; b=KyvssJGLRVJyDYM93e+2JjnbdY12s14b6l/SKvramH9tg16FjqIienf1hwK1kPSiBE paqxBUe1BM4/QxkZBifGlXzZc1bEWntjHzJW+1h+M37vdEp8RbJ5SBCDQsJ+r2YdFCCO fVjVNQGdIxNe7JbJ6leXPjISLzjeqGV87m0IjtOOfdHNHmEYl0DMXwFBUuiU0Oe9opnU kU2IK1EMqwql+xhiz82OJmIVCB1txyJYUQvW+2eUnHz6MA2odCAa+LjDMeLMMYBZXIh5 O7GqMlngs7l+5lq8MJN9guhfR5t5a6qV3xkOVrUnoXc2/5bvqKI7g5U+q7RGtKHMU/Ze sd0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743195763; x=1743800563; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ndQqR2MnSXfwHsDu2XmXqV7CwtML+mkAPgKOSkm6+Z8=; b=fcM1e+1iG2frsimUDArNf0fzSoZdsytsGi21nms1LJQbiknQ1DttDH6WATt7RkzaNn bEA/MbFxOqaThc4pGZxQzqDCnqRskgp1anwZGBsybpCB07o/Nb/gQ8G7l/d4m9mIDQk8 EQ7LNkEao+nEbDAMQil1L89R98NLZNJmUxID/mubiUnQfzlyix3ZHzusitnXM1mbNujD UU7nXqum+VFMVaXzxeiOj2xbs3HDIDj+0jNm/RVSM5CnyYByUljwGYhVUo59NNV1l9GT 0BWDrfyiCGsuxnMFsivJScMr8OaQDUTjNA7b6HQNzQOM1ndC0Pr1nHfOLbUihpBw6sEb x6xg== X-Forwarded-Encrypted: i=1; AJvYcCX1d7ITWqRYj0PQXh6kcRDQPdfaj9MQLOXZEhaHODBd8ikUihHwiFpx9m86EjbGTkTB0hHLQIjtnxbmfw==@lists.infradead.org X-Gm-Message-State: AOJu0Yz88rqLXrRXZeHt+raSIZk43q8uoFVu1Q6dPBkr81pdF4pxTWVR G8voCFu1K5mgLioI63QOxAlDoIMyTjATzL4JhLGsHMkc43I73Yn5JBaaiGjq5A4= X-Gm-Gg: ASbGncuKZq9PStMCReb0wUtxIagdA3p6rKQu56LpR88UF841XqiekXbqRUiHY9czVP2 /eawETtJuRR2m736qByoW1E8Y1jXYtl53fy9ZYECkO6emAWZdHG6OfQyeVhLcQCcP4y6OgU/BQy Lbr+7Up8d9WfVkmpXyQqUGRtoSSWM7onJAlJPir6wltELHSRIxFoG+sBvt7D8QmbLUR5vcZvELm AcfeHWZD4nLDeXEPCDN0ezDIjuIDiqGFa42ygZMACJ+Y2S2oQ8Zi9j4pfgS49gDfdZwnP1MKDGi 5DcMpa2aKeQjbyWC8sakQayRMbqeQWUucnL1fl3GZ535lfLE+amWRTsls8lkpNvuRFMQtl/zYJB oyuJf2bl8N8ha7KxeVA== X-Google-Smtp-Source: AGHT+IGYNBFx2dcGbCxvROlSnCzW59gk5DbZ/q57cPod8CZTD46n3GkkkCO+ZAW+eAHPbibdDHNAZA== X-Received: by 2002:a05:6e02:184e:b0:3d4:35d3:87d3 with SMTP id e9e14a558f8ab-3d5e08e994fmr12120515ab.4.1743195763096; Fri, 28 Mar 2025 14:02:43 -0700 (PDT) Received: from localhost.localdomain (c-73-228-159-35.hsd1.mn.comcast.net. [73.228.159.35]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-3d5d5a74286sm6769405ab.39.2025.03.28.14.02.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Mar 2025 14:02:42 -0700 (PDT) From: Alex Elder To: p.zabel@pengutronix.de, mturquette@baylibre.com, sboyd@kernel.org, dlan@gentoo.org Cc: robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, heylenay@4d2.org, guodong@riscstar.com, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, spacemit@lists.linux.dev, devicetree@vger.kernel.org, linux-clk@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 4/7] clk: spacemit: define existing syscon resets Date: Fri, 28 Mar 2025 16:02:29 -0500 Message-ID: <20250328210233.1077035-5-elder@riscstar.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250328210233.1077035-1-elder@riscstar.com> References: <20250328210233.1077035-1-elder@riscstar.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250328_140244_296069_56F996E9 X-CRM114-Status: GOOD ( 12.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 Define reset controls associated with the MPMU, APBC, and APMU SpacemiT K1 CCUs. These already have clocks associated with them. Signed-off-by: Alex Elder --- v2: - Symbols are named RESET* and reset* rather than RST* and rst* drivers/clk/spacemit/ccu-k1.c | 132 ++++++++++++++++++++++++++++++++++ 1 file changed, 132 insertions(+) diff --git a/drivers/clk/spacemit/ccu-k1.c b/drivers/clk/spacemit/ccu-k1.c index 9c7c7108cfe38..f837d2c2f31fc 100644 --- a/drivers/clk/spacemit/ccu-k1.c +++ b/drivers/clk/spacemit/ccu-k1.c @@ -151,6 +151,13 @@ struct spacemit_ccu_data { const struct ccu_reset_controller_data *reset_data; }; +#define RESET_DATA(_offset, _assert_mask, _deassert_mask) \ + { \ + .offset = (_offset), \ + .assert_mask = (_assert_mask), \ + .deassert_mask = (_deassert_mask), \ + } + struct ccu_reset_controller { struct regmap *regmap; const struct ccu_reset_controller_data *data; @@ -1428,6 +1435,7 @@ static struct spacemit_ccu_clk k1_ccu_apbs_clks[] = { static const struct spacemit_ccu_data k1_ccu_apbs_data = { .clk = k1_ccu_apbs_clks, + /* No resets in the APBS CCU */ }; static struct spacemit_ccu_clk k1_ccu_mpmu_clks[] = { @@ -1467,8 +1475,18 @@ static struct spacemit_ccu_clk k1_ccu_mpmu_clks[] = { { 0, NULL }, }; +static const struct ccu_reset_data mpmu_reset_data[] = { + [RESET_WDT] = RESET_DATA(MPMU_WDTPCR, BIT(2), 0), +}; + +static const struct ccu_reset_controller_data mpmu_reset_controller_data = { + .count = ARRAY_SIZE(mpmu_reset_data), + .data = mpmu_reset_data, +}; + static const struct spacemit_ccu_data k1_ccu_mpmu_data = { .clk = k1_ccu_mpmu_clks, + .reset_data = &mpmu_reset_controller_data, }; static struct spacemit_ccu_clk k1_ccu_apbc_clks[] = { @@ -1575,8 +1593,68 @@ static struct spacemit_ccu_clk k1_ccu_apbc_clks[] = { { 0, NULL }, }; +static const struct ccu_reset_data apbc_reset_data[] = { + [RESET_UART0] = RESET_DATA(APBC_UART1_CLK_RST, BIT(2), 0), + [RESET_UART2] = RESET_DATA(APBC_UART2_CLK_RST, BIT(2), 0), + [RESET_GPIO] = RESET_DATA(APBC_GPIO_CLK_RST, BIT(2), 0), + [RESET_PWM0] = RESET_DATA(APBC_PWM0_CLK_RST, BIT(2), BIT(0)), + [RESET_PWM1] = RESET_DATA(APBC_PWM1_CLK_RST, BIT(2), BIT(0)), + [RESET_PWM2] = RESET_DATA(APBC_PWM2_CLK_RST, BIT(2), BIT(0)), + [RESET_PWM3] = RESET_DATA(APBC_PWM3_CLK_RST, BIT(2), BIT(0)), + [RESET_PWM4] = RESET_DATA(APBC_PWM4_CLK_RST, BIT(2), BIT(0)), + [RESET_PWM5] = RESET_DATA(APBC_PWM5_CLK_RST, BIT(2), BIT(0)), + [RESET_PWM6] = RESET_DATA(APBC_PWM6_CLK_RST, BIT(2), BIT(0)), + [RESET_PWM7] = RESET_DATA(APBC_PWM7_CLK_RST, BIT(2), BIT(0)), + [RESET_PWM8] = RESET_DATA(APBC_PWM8_CLK_RST, BIT(2), BIT(0)), + [RESET_PWM9] = RESET_DATA(APBC_PWM9_CLK_RST, BIT(2), BIT(0)), + [RESET_PWM10] = RESET_DATA(APBC_PWM10_CLK_RST, BIT(2), BIT(0)), + [RESET_PWM11] = RESET_DATA(APBC_PWM11_CLK_RST, BIT(2), BIT(0)), + [RESET_PWM12] = RESET_DATA(APBC_PWM12_CLK_RST, BIT(2), BIT(0)), + [RESET_PWM13] = RESET_DATA(APBC_PWM13_CLK_RST, BIT(2), BIT(0)), + [RESET_PWM14] = RESET_DATA(APBC_PWM14_CLK_RST, BIT(2), BIT(0)), + [RESET_PWM15] = RESET_DATA(APBC_PWM15_CLK_RST, BIT(2), BIT(0)), + [RESET_PWM16] = RESET_DATA(APBC_PWM16_CLK_RST, BIT(2), BIT(0)), + [RESET_PWM17] = RESET_DATA(APBC_PWM17_CLK_RST, BIT(2), BIT(0)), + [RESET_PWM18] = RESET_DATA(APBC_PWM18_CLK_RST, BIT(2), BIT(0)), + [RESET_PWM19] = RESET_DATA(APBC_PWM19_CLK_RST, BIT(2), BIT(0)), + [RESET_SSP3] = RESET_DATA(APBC_SSP3_CLK_RST, BIT(2), 0), + [RESET_UART3] = RESET_DATA(APBC_UART3_CLK_RST, BIT(2), 0), + [RESET_RTC] = RESET_DATA(APBC_RTC_CLK_RST, BIT(2), 0), + [RESET_TWSI0] = RESET_DATA(APBC_TWSI0_CLK_RST, BIT(2), 0), + [RESET_TIMERS1] = RESET_DATA(APBC_TIMERS1_CLK_RST, BIT(2), 0), + [RESET_AIB] = RESET_DATA(APBC_AIB_CLK_RST, BIT(2), 0), + [RESET_TIMERS2] = RESET_DATA(APBC_TIMERS2_CLK_RST, BIT(2), 0), + [RESET_ONEWIRE] = RESET_DATA(APBC_ONEWIRE_CLK_RST, BIT(2), 0), + [RESET_SSPA0] = RESET_DATA(APBC_SSPA0_CLK_RST, BIT(2), 0), + [RESET_SSPA1] = RESET_DATA(APBC_SSPA1_CLK_RST, BIT(2), 0), + [RESET_DRO] = RESET_DATA(APBC_DRO_CLK_RST, BIT(2), 0), + [RESET_IR] = RESET_DATA(APBC_IR_CLK_RST, BIT(2), 0), + [RESET_TWSI1] = RESET_DATA(APBC_TWSI1_CLK_RST, BIT(2), 0), + [RESET_TSEN] = RESET_DATA(APBC_TSEN_CLK_RST, BIT(2), 0), + [RESET_TWSI2] = RESET_DATA(APBC_TWSI2_CLK_RST, BIT(2), 0), + [RESET_TWSI4] = RESET_DATA(APBC_TWSI4_CLK_RST, BIT(2), 0), + [RESET_TWSI5] = RESET_DATA(APBC_TWSI5_CLK_RST, BIT(2), 0), + [RESET_TWSI6] = RESET_DATA(APBC_TWSI6_CLK_RST, BIT(2), 0), + [RESET_TWSI7] = RESET_DATA(APBC_TWSI7_CLK_RST, BIT(2), 0), + [RESET_TWSI8] = RESET_DATA(APBC_TWSI8_CLK_RST, BIT(2), 0), + [RESET_IPC_AP2AUD] = RESET_DATA(APBC_IPC_AP2AUD_CLK_RST, BIT(2), 0), + [RESET_UART4] = RESET_DATA(APBC_UART4_CLK_RST, BIT(2), 0), + [RESET_UART5] = RESET_DATA(APBC_UART5_CLK_RST, BIT(2), 0), + [RESET_UART6] = RESET_DATA(APBC_UART6_CLK_RST, BIT(2), 0), + [RESET_UART7] = RESET_DATA(APBC_UART7_CLK_RST, BIT(2), 0), + [RESET_UART8] = RESET_DATA(APBC_UART8_CLK_RST, BIT(2), 0), + [RESET_UART9] = RESET_DATA(APBC_UART9_CLK_RST, BIT(2), 0), + [RESET_CAN0] = RESET_DATA(APBC_CAN0_CLK_RST, BIT(2), 0), +}; + +static const struct ccu_reset_controller_data apbc_reset_controller_data = { + .count = ARRAY_SIZE(apbc_reset_data), + .data = apbc_reset_data, +}; + static const struct spacemit_ccu_data k1_ccu_apbc_data = { .clk = k1_ccu_apbc_clks, + .reset_data = &apbc_reset_controller_data, }; static struct spacemit_ccu_clk k1_ccu_apmu_clks[] = { @@ -1645,8 +1723,62 @@ static struct spacemit_ccu_clk k1_ccu_apmu_clks[] = { { 0, NULL }, }; +static const struct ccu_reset_data apmu_reset_data[] = { + [RESET_CCIC_4X] = RESET_DATA(APMU_CCIC_CLK_RES_CTRL, 0, BIT(1)), + [RESET_CCIC1_PHY] = RESET_DATA(APMU_CCIC_CLK_RES_CTRL, 0, BIT(2)), + [RESET_SDH_AXI] = RESET_DATA(APMU_SDH0_CLK_RES_CTRL, 0, BIT(0)), + [RESET_SDH0] = RESET_DATA(APMU_SDH0_CLK_RES_CTRL, 0, BIT(1)), + [RESET_SDH1] = RESET_DATA(APMU_SDH1_CLK_RES_CTRL, 0, BIT(1)), + [RESET_SDH2] = RESET_DATA(APMU_SDH2_CLK_RES_CTRL, 0, BIT(1)), + [RESET_USBP1_AXI] = RESET_DATA(APMU_USB_CLK_RES_CTRL, 0, BIT(4)), + [RESET_USB_AXI] = RESET_DATA(APMU_USB_CLK_RES_CTRL, 0, BIT(0)), + [RESET_USB3_0] = RESET_DATA(APMU_USB_CLK_RES_CTRL, 0, + BIT(11) | BIT(10) | BIT(9)), + [RESET_QSPI] = RESET_DATA(APMU_QSPI_CLK_RES_CTRL, 0, BIT(1)), + [RESET_QSPI_BUS] = RESET_DATA(APMU_QSPI_CLK_RES_CTRL, 0, BIT(0)), + [RESET_DMA] = RESET_DATA(APMU_DMA_CLK_RES_CTRL, 0, BIT(0)), + [RESET_AES] = RESET_DATA(APMU_AES_CLK_RES_CTRL, 0, BIT(4)), + [RESET_VPU] = RESET_DATA(APMU_VPU_CLK_RES_CTRL, 0, BIT(0)), + [RESET_GPU] = RESET_DATA(APMU_GPU_CLK_RES_CTRL, 0, BIT(1)), + [RESET_EMMC] = RESET_DATA(APMU_PMUA_EM_CLK_RES_CTRL, 0, BIT(1)), + [RESET_EMMC_X] = RESET_DATA(APMU_PMUA_EM_CLK_RES_CTRL, 0, BIT(0)), + [RESET_AUDIO] = RESET_DATA(APMU_AUDIO_CLK_RES_CTRL, 0, + BIT(3) | BIT(2) | BIT(0)), + [RESET_HDMI] = RESET_DATA(APMU_HDMI_CLK_RES_CTRL, 0, BIT(9)), + [RESET_PCIE0] = RESET_DATA(APMU_PCIE_CLK_RES_CTRL_0, BIT(8), + BIT(5) | BIT(4) | BIT(3)), + [RESET_PCIE1] = RESET_DATA(APMU_PCIE_CLK_RES_CTRL_1, BIT(8), + BIT(5) | BIT(4) | BIT(3)), + [RESET_PCIE2] = RESET_DATA(APMU_PCIE_CLK_RES_CTRL_2, BIT(8), + BIT(5) | BIT(4) | BIT(3)), + [RESET_EMAC0] = RESET_DATA(APMU_EMAC0_CLK_RES_CTRL, 0, BIT(1)), + [RESET_EMAC1] = RESET_DATA(APMU_EMAC1_CLK_RES_CTRL, 0, BIT(1)), + [RESET_JPG] = RESET_DATA(APMU_JPG_CLK_RES_CTRL, 0, BIT(0)), + [RESET_CCIC2PHY] = RESET_DATA(APMU_CSI_CCIC2_CLK_RES_CTRL, 0, BIT(2)), + [RESET_CCIC3PHY] = RESET_DATA(APMU_CSI_CCIC2_CLK_RES_CTRL, 0, BIT(29)), + [RESET_CSI] = RESET_DATA(APMU_CSI_CCIC2_CLK_RES_CTRL, 0, BIT(1)), + [RESET_ISP] = RESET_DATA(APMU_ISP_CLK_RES_CTRL, 0, BIT(0)), + [RESET_ISP_CPP] = RESET_DATA(APMU_ISP_CLK_RES_CTRL, 0, BIT(27)), + [RESET_ISP_BUS] = RESET_DATA(APMU_ISP_CLK_RES_CTRL, 0, BIT(3)), + [RESET_ISP_CI] = RESET_DATA(APMU_ISP_CLK_RES_CTRL, 0, BIT(16)), + [RESET_DPU_MCLK] = RESET_DATA(APMU_LCD_CLK_RES_CTRL2, 0, BIT(9)), + [RESET_DPU_ESC] = RESET_DATA(APMU_LCD_CLK_RES_CTRL1, 0, BIT(3)), + [RESET_DPU_HCLK] = RESET_DATA(APMU_LCD_CLK_RES_CTRL1, 0, BIT(4)), + [RESET_DPU_SPIBUS] = RESET_DATA(APMU_LCD_SPI_CLK_RES_CTRL, 0, BIT(4)), + [RESET_DPU_SPI_HBUS] = RESET_DATA(APMU_LCD_SPI_CLK_RES_CTRL, 0, BIT(2)), + [RESET_V2D] = RESET_DATA(APMU_LCD_CLK_RES_CTRL1, 0, BIT(27)), + [RESET_MIPI] = RESET_DATA(APMU_LCD_CLK_RES_CTRL1, 0, BIT(15)), + [RESET_MC] = RESET_DATA(APMU_PMUA_MC_CTRL, 0, BIT(0)), +}; + +static const struct ccu_reset_controller_data apmu_reset_controller_data = { + .count = ARRAY_SIZE(apmu_reset_data), + .data = apmu_reset_data, +}; + static const struct spacemit_ccu_data k1_ccu_apmu_data = { .clk = k1_ccu_apmu_clks, + .reset_data = &apmu_reset_controller_data, }; static int spacemit_reset_update(struct reset_controller_dev *rcdev, From patchwork Fri Mar 28 21:02:30 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 14032457 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 6860BC36016 for ; Fri, 28 Mar 2025 21:02:52 +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=ZxJ1OMlReK111nsEJZpnNb2I48v1h6B1RtYT0Ztv6Qg=; b=SCSrt0bxVidv01 ZEaGm11We8IshgCqnmER8BaaXoc19M/GiDIw12SGSCZQcfDjP2B2fWXKbhl20g8KyKMO4pXfdBDLB 2A2YpgVmTsSx4Y+N9g0kgMIf2XKhjMymPSuuYInkQq1CIDV6MsQf6Y7QXzVV5R/ogKE+nPresfhQR CAfXdAlVNYck5ZVIC1w3SO5urupG6xtb6RVw2JUwanNG7CDOvOK6m73aBqTN0YL38KG7kEIx0z8vE Lmc6+fUVI254qwK4+ynpc/FKujnLU8CS/TWCA9HH7lklYQFo2w3KmOOdvSTTx53ewmOcwOH8EYSJB 0c44Uml9QkkRraBgQHBA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.1 #2 (Red Hat Linux)) id 1tyGqm-0000000EJ7Y-1knO; Fri, 28 Mar 2025 21:02:48 +0000 Received: from mail-io1-xd2f.google.com ([2607:f8b0:4864:20::d2f]) by bombadil.infradead.org with esmtps (Exim 4.98.1 #2 (Red Hat Linux)) id 1tyGqj-0000000EJ5E-3dRb for linux-riscv@lists.infradead.org; Fri, 28 Mar 2025 21:02:47 +0000 Received: by mail-io1-xd2f.google.com with SMTP id ca18e2360f4ac-85dac9728cdso50419639f.0 for ; Fri, 28 Mar 2025 14:02:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=riscstar-com.20230601.gappssmtp.com; s=20230601; t=1743195765; x=1743800565; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rerGx2TveORsLjDrW3hkWd+yAs+YmYyP0wNHZuEm2gw=; b=WJde+pYueJJyUnTdaXifmoNX+dT3xvVkGLpBLv7dUrZBPOsIopnumF1y+8RMGdOPu/ 8ohHQMeAbhtiWE4M3KYnVresL+RUlVn4M8x3BV1/QTSKxh3XM3wiNuyQOeoYiS/lH00+ pTtInWSC/mxk4/7J9UGGOevF1q89skcrLu3qV/xV5/+sf+NiPao8gXcxc/HbPis3sjxf gXWIA/d1x/DC9eQySoTJtAEspJSCKj0kjQg279/3ci+EbJ2MBUBFb1b0R9B1YwvKb98L dpL0M4+wwzrDFLp/PZ6ltJpz6z5QxRAGHsPPFB7sO6WiGnGt3m+LNaAfuRh4Zvsdd1ZC Jc1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743195765; x=1743800565; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rerGx2TveORsLjDrW3hkWd+yAs+YmYyP0wNHZuEm2gw=; b=kZsqSu2X1xaO2A7wdwtlZYiUBwL1tK+bSyya/jMjtw4HMi3BdqMzf2el3bSVN/vIvu zuCCOz4y5gTjf4V5221Esfvzhqmo7WdqCus/y+iT/IzBKLpWyb20uiH5y5zLhfawGW3w 3a/ucc30wSKBGxo6bj4RN8h0un2n0PeIqj2MKcOL+ZPJDus6u3lXRtJD4yK9O4Qu97lS Zz1slO5rofW0vRWPKH9NrngV9/0N2BxU/XcvL1ABb3E46gArbjWSYnoCgLXzWBG002xQ 5eJdBcPCrjzN7LgoYk47zcXlzoTJIV0zC3o9CR4UnDU9MuCBBMxSn6AWWvS9zeoidfwJ Uj3Q== X-Forwarded-Encrypted: i=1; AJvYcCVWcqX3YYLNKZcG5be+hqM9tg2kgqcszQSCa8HFD7Nz64h5hzY8OEfzvbeOiflfC7InbwgqRi3EpWrcbw==@lists.infradead.org X-Gm-Message-State: AOJu0YwMoIx5NoyARGlYfjfwb+nn9eYWu+N5RdmdgXcKp0vedxYMoCwi crCnFXpMLO3nsywd1BPe6l7grfwKTmjHRl3HZ5xP9YcfXcgLHWbDX4334UjGFu0= X-Gm-Gg: ASbGnctEonWkybX7rNArCvs4i2URrumK0F7Bi7/5Z4SPQhs3FLxop4p/wUN+xRQpM6w ypd+x+2YFCBzlw0iiFHNz9d/vQk3yYO6QUDvHTixOu+P65KmJCMEwC/fpWAGwrAv5TDRWjiGfCk rd31pdGlcM+TKVfM/v5q8CDBYZUHJ0YNWcCa4Xo70sD/Ixrt7bhYmukH77WBJSW2mHSahXd6g8J fkf/rJlfvFrwOygcRWrXgjlNRAHwdgFg8ip8xpeDOHRS4AyhcT5zOvC4IpbKxlpdBmJCDm9iW9R KDVk6CjUt2hVxXa0ErKRoP5vRQTpt8ZUVMT7B6EpygQw14KfHcaT85fs4U3qlbBSAJfBAI2aIJ/ pwqLAOaM7dKq8XQZsfw== X-Google-Smtp-Source: AGHT+IEkrPw2Xf+zBd0lVIv6FoNOsOZlQH+aK8mKUSksTkEV25RH9WtQ+nDLN/BB4g7AYZH94fGGSA== X-Received: by 2002:a05:6e02:152e:b0:3d2:6768:c4fa with SMTP id e9e14a558f8ab-3d5e09fdbf6mr10526775ab.21.1743195764543; Fri, 28 Mar 2025 14:02:44 -0700 (PDT) Received: from localhost.localdomain (c-73-228-159-35.hsd1.mn.comcast.net. [73.228.159.35]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-3d5d5a74286sm6769405ab.39.2025.03.28.14.02.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Mar 2025 14:02:44 -0700 (PDT) From: Alex Elder To: p.zabel@pengutronix.de, mturquette@baylibre.com, sboyd@kernel.org, dlan@gentoo.org Cc: robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, heylenay@4d2.org, guodong@riscstar.com, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, spacemit@lists.linux.dev, devicetree@vger.kernel.org, linux-clk@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 5/7] clk: spacemit: make clocks optional Date: Fri, 28 Mar 2025 16:02:30 -0500 Message-ID: <20250328210233.1077035-6-elder@riscstar.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250328210233.1077035-1-elder@riscstar.com> References: <20250328210233.1077035-1-elder@riscstar.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250328_140245_905462_BF0B420C X-CRM114-Status: GOOD ( 12.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 There are some syscon devices that support both clocks and resets, but for now only their reset functionality is required. Make defining clocks optional for a SpacemiT CCU, though at least one clock or at least one reset controller must be defined. Signed-off-by: Alex Elder --- v2: - Comment explains constraints on match data drivers/clk/spacemit/ccu-k1.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/clk/spacemit/ccu-k1.c b/drivers/clk/spacemit/ccu-k1.c index f837d2c2f31fc..6885fea81f6f3 100644 --- a/drivers/clk/spacemit/ccu-k1.c +++ b/drivers/clk/spacemit/ccu-k1.c @@ -1821,6 +1821,10 @@ static int spacemit_ccu_register(struct device *dev, const struct spacemit_ccu_clk *clk; int i, ret, max_id = 0; + /* Clocks are optional */ + if (!clks) + return 0; + for (clk = clks; clk->hw; clk++) max_id = max(max_id, clk->id); @@ -1926,7 +1930,7 @@ static int k1_ccu_probe(struct platform_device *pdev) return 0; } -/* The match data is required to be non-null, and have a non-null clk pointer */ +/* The match data is required, and its clk or reset_data field must not be null */ static const struct of_device_id of_k1_ccu_match[] = { { .compatible = "spacemit,k1-pll", From patchwork Fri Mar 28 21:02:31 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 14032460 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 DA077C28B20 for ; Fri, 28 Mar 2025 21:02:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=cbI+IhxYX8gy+B9tgPHWEqIRLALWnNhwYZlMFfGThQI=; b=UXAbCJuAjt4tFn FF+q2+DOQOS6aHmp/fjdrGauI0vptpC0napoXrhFRdkRyPBC+54jppSPbcZJzDSBEAx7T6cUNRM1w 63NmG6ahZzZvpxzjiTfJ1qc2tcMsK7EdO+r3ZEh08PE1dxFUQ+vwEBwfPcoBQTn22YWghbe93aYzA cNN5tGolPT/JKdB5YK6Vk1VTBb0vPUnDINmTrBKH4i1M3BVAX5yemfH8daFaTwtJBDkuTlMSo/dg7 Au3/kqcwsNAcdo6GLQgNSrbsHDpJxNfvIZJk+C+iGES8XXVMEGYgWmlsgtav6eRN4dQA4csqUz+dI TMsorrnvrAuVdNRcjtaA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.1 #2 (Red Hat Linux)) id 1tyGqo-0000000EJ8j-0RBL; Fri, 28 Mar 2025 21:02:50 +0000 Received: from mail-il1-x135.google.com ([2607:f8b0:4864:20::135]) by bombadil.infradead.org with esmtps (Exim 4.98.1 #2 (Red Hat Linux)) id 1tyGql-0000000EJ6k-0vPK for linux-riscv@lists.infradead.org; Fri, 28 Mar 2025 21:02:48 +0000 Received: by mail-il1-x135.google.com with SMTP id e9e14a558f8ab-3ce87d31480so13571315ab.2 for ; Fri, 28 Mar 2025 14:02:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=riscstar-com.20230601.gappssmtp.com; s=20230601; t=1743195766; x=1743800566; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=eKcJi20RveZcqY3Kh6Lr5ErkuA50pYogrDTUhueBa/I=; b=T+WBecAMG1IIXd73u5d/ds03uxNG7rsFlO6rQTEtIvz6AvMHVz0yn0B/3fD5lEj4g3 bkuDpR0tnoX464TQm/0UhEwzC6+C2I7uKLfjnd2xtwSxFDHfxJPrPgKTWA1oTyw/G6UG qmKIkj46lRVXJy/dKNUo0pySyhG0KJrajyZYbR6vd4nXpa3XLdW+KbmFuGrXREeXv3mh NvcxQVBNeiFnuZZymSP+FbgoqUS0XVNHQWdc1pM917lthe+Oqbi3mL7u58wrRPEvvkSV n2iSFVtbhTjBv69mHQlrSox9pEzSNEZMFsxYGuf292b7s8eSGBOIC4vHwzA4Xbbbt2LW udKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743195766; x=1743800566; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eKcJi20RveZcqY3Kh6Lr5ErkuA50pYogrDTUhueBa/I=; b=ECFQm+ExKPBMkf3C9BvRoPUgw8CSAtT8gLI7C+5lnNr+j7NsCeQFbD6gI+ySYKLICw A+Tb4wvoGvCHTcgaAWRd4glVvjVj8j6DzSBDA4vEqXxrNs3gxsrLCDAqEz4kFHXdd0UO aC/q5BLKE8Ac45EokplZzIagNHShxl2U7z4DzHseV9WOs3A1PVnOfrVxO3TigYGz+453 bZ+MWActBUnuXgAAVBJSYBOIY8h5292UX1uX851aUnVuIaY4OfGfuD2JRgLm+oGN9Skh 4PNRqE8HsedOjavEDiea6DVfzCr0RFcyinaewSUwqk07wbWm4yCeDeRqHlryfy3nKB+O 33Zg== X-Forwarded-Encrypted: i=1; AJvYcCVHcIimw9ZiQt0SJ8bRiFvSI3BXesm67gKCOB2gQoEMA25luhKiw2fMIb7n4nDu3T7c4NYauvCVdYVWFg==@lists.infradead.org X-Gm-Message-State: AOJu0YwRq7ySiXeVyAt5Or/O7aDSgRwU9SRCNGqPJBmYCRvFpIlciZ9K GKX//VQwR173UwX8POaAyCidahLDC9XQ2yf8/yKgTlB+MheWywEqNy7+IaGuz8I= X-Gm-Gg: ASbGncvlx9k09WUg7xFc5bzHJSdl9hwoI3cQWXCBmeQS11FNP857VwOSNn6ah8IlBSg JgnSVLxAMCu3OfgPNIpBWW+93b4lNzI2Rwocs5vUE3O2wByyIUS6R/EI+oZqdwynAUTSiXTDuLl E2PQfllbR7VkRm4OxniNyZ0JbO+BneGz2obcpzB93g9LdVxvtKYpPz62wiXUeLK45NL5EbQ8fKs GahcKmxNUlYKrNOxvZCVJQJOgcc6ZHOhDnzk5fiNj9fnumm2U9IhMUsy8Ut7yagCcIzguDKPkzO /7eoBforFZWCQ14MsA7NasQNi/+LorPxTvIdYPgNW/y1xAaA0dXMSKCxFGfF+NfZCKpHiLDCQCe VKL0L3jBJhUNFGVFcjQ== X-Google-Smtp-Source: AGHT+IG/x8CaSThai0eN9WMQXnI7Dn45SQl59K26R/GIHq+6R5kvoqka5yknMLoNMvorh3QxtBN6Vg== X-Received: by 2002:a05:6e02:1d13:b0:3d3:dfc2:912c with SMTP id e9e14a558f8ab-3d5e09da039mr7944305ab.17.1743195766037; Fri, 28 Mar 2025 14:02:46 -0700 (PDT) Received: from localhost.localdomain (c-73-228-159-35.hsd1.mn.comcast.net. [73.228.159.35]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-3d5d5a74286sm6769405ab.39.2025.03.28.14.02.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Mar 2025 14:02:45 -0700 (PDT) From: Alex Elder To: p.zabel@pengutronix.de, mturquette@baylibre.com, sboyd@kernel.org, dlan@gentoo.org Cc: robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, heylenay@4d2.org, guodong@riscstar.com, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, spacemit@lists.linux.dev, devicetree@vger.kernel.org, linux-clk@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 6/7] clk: spacemit: define new syscons with only resets Date: Fri, 28 Mar 2025 16:02:31 -0500 Message-ID: <20250328210233.1077035-7-elder@riscstar.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250328210233.1077035-1-elder@riscstar.com> References: <20250328210233.1077035-1-elder@riscstar.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250328_140247_270626_61C88CE9 X-CRM114-Status: GOOD ( 11.80 ) 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 Enable support for three additional syscon CCUs which support reset controls but no clocks: ARCPU, RCPU2, and APBC2. Signed-off-by: Alex Elder --- v2: - Symbols are named RESET* and reset* rather than RST* and rst* drivers/clk/spacemit/ccu-k1.c | 106 ++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) diff --git a/drivers/clk/spacemit/ccu-k1.c b/drivers/clk/spacemit/ccu-k1.c index 6885fea81f6f3..c7c9580eab90b 100644 --- a/drivers/clk/spacemit/ccu-k1.c +++ b/drivers/clk/spacemit/ccu-k1.c @@ -130,6 +130,37 @@ #define APMU_EMAC0_CLK_RES_CTRL 0x3e4 #define APMU_EMAC1_CLK_RES_CTRL 0x3ec +/* RCPU register offsets */ +#define RCPU_SSP0_CLK_RST 0x0028 +#define RCPU_I2C0_CLK_RST 0x0030 +#define RCPU_UART1_CLK_RST 0x003c +#define RCPU_CAN_CLK_RST 0x0048 +#define RCPU_IR_CLK_RST 0x004c +#define RCPU_UART0_CLK_RST 0x00d8 +/* XXX Next one is part of the AUD_AUDCLOCK region @ 0xc0882000 */ +#define AUDIO_HDMI_CLK_CTRL 0x2044 + +/* RCPU2 register offsets */ +#define RCPU2_PWM0_CLK_RST 0x0000 +#define RCPU2_PWM1_CLK_RST 0x0004 +#define RCPU2_PWM2_CLK_RST 0x0008 +#define RCPU2_PWM3_CLK_RST 0x000c +#define RCPU2_PWM4_CLK_RST 0x0010 +#define RCPU2_PWM5_CLK_RST 0x0014 +#define RCPU2_PWM6_CLK_RST 0x0018 +#define RCPU2_PWM7_CLK_RST 0x001c +#define RCPU2_PWM8_CLK_RST 0x0020 +#define RCPU2_PWM9_CLK_RST 0x0024 + +/* APBC2 register offsets */ +#define APBC2_UART1_CLK_RST 0x0000 +#define APBC2_SSP2_CLK_RST 0x0004 +#define APBC2_TWSI3_CLK_RST 0x0008 +#define APBC2_RTC_CLK_RST 0x000c +#define APBC2_TIMERS0_CLK_RST 0x0010 +#define APBC2_KPC_CLK_RST 0x0014 +#define APBC2_GPIO_CLK_RST 0x001c + struct spacemit_ccu_clk { int id; struct clk_hw *hw; @@ -1781,6 +1812,69 @@ static const struct spacemit_ccu_data k1_ccu_apmu_data = { .reset_data = &apmu_reset_controller_data, }; +static const struct ccu_reset_data rcpu_reset_data[] = { + [RESET_RCPU_SSP0] = RESET_DATA(RCPU_SSP0_CLK_RST, 0, BIT(0)), + [RESET_RCPU_I2C0] = RESET_DATA(RCPU_I2C0_CLK_RST, 0, BIT(0)), + [RESET_RCPU_UART1] = RESET_DATA(RCPU_UART1_CLK_RST, 0, BIT(0)), + [RESET_RCPU_IR] = RESET_DATA(RCPU_CAN_CLK_RST, 0, BIT(0)), + [RESET_RCPU_CAN] = RESET_DATA(RCPU_IR_CLK_RST, 0, BIT(0)), + [RESET_RCPU_UART0] = RESET_DATA(RCPU_UART0_CLK_RST, 0, BIT(0)), + [RESET_RCPU_HDMI_AUDIO] = RESET_DATA(AUDIO_HDMI_CLK_CTRL, 0, BIT(0)), +}; + +static const struct ccu_reset_controller_data rcpu_reset_controller_data = { + .count = ARRAY_SIZE(rcpu_reset_data), + .data = rcpu_reset_data, +}; + +static struct spacemit_ccu_data k1_ccu_rcpu_data = { + /* No clocks in the RCPU CCU */ + .reset_data = &rcpu_reset_controller_data, +}; + +static const struct ccu_reset_data rcpu2_reset_data[] = { + [RESET_RCPU2_PWM0] = RESET_DATA(RCPU2_PWM9_CLK_RST, BIT(2), BIT(0)), + [RESET_RCPU2_PWM1] = RESET_DATA(RCPU2_PWM9_CLK_RST, BIT(2), BIT(0)), + [RESET_RCPU2_PWM2] = RESET_DATA(RCPU2_PWM9_CLK_RST, BIT(2), BIT(0)), + [RESET_RCPU2_PWM3] = RESET_DATA(RCPU2_PWM9_CLK_RST, BIT(2), BIT(0)), + [RESET_RCPU2_PWM4] = RESET_DATA(RCPU2_PWM9_CLK_RST, BIT(2), BIT(0)), + [RESET_RCPU2_PWM5] = RESET_DATA(RCPU2_PWM9_CLK_RST, BIT(2), BIT(0)), + [RESET_RCPU2_PWM6] = RESET_DATA(RCPU2_PWM9_CLK_RST, BIT(2), BIT(0)), + [RESET_RCPU2_PWM7] = RESET_DATA(RCPU2_PWM9_CLK_RST, BIT(2), BIT(0)), + [RESET_RCPU2_PWM8] = RESET_DATA(RCPU2_PWM9_CLK_RST, BIT(2), BIT(0)), + [RESET_RCPU2_PWM9] = RESET_DATA(RCPU2_PWM9_CLK_RST, BIT(2), BIT(0)), +}; + +static const struct ccu_reset_controller_data rcpu2_reset_controller_data = { + .count = ARRAY_SIZE(rcpu2_reset_data), + .data = rcpu2_reset_data, +}; + +static struct spacemit_ccu_data k1_ccu_rcpu2_data = { + /* No clocks in the RCPU2 CCU */ + .reset_data = &rcpu2_reset_controller_data, +}; + +static const struct ccu_reset_data apbc2_reset_data[] = { + [RESET_APBC2_UART1] = RESET_DATA(APBC2_UART1_CLK_RST, BIT(2), (0)), + [RESET_APBC2_SSP2] = RESET_DATA(APBC2_SSP2_CLK_RST, BIT(2), (0)), + [RESET_APBC2_TWSI3] = RESET_DATA(APBC2_TWSI3_CLK_RST, BIT(2), (0)), + [RESET_APBC2_RTC] = RESET_DATA(APBC2_RTC_CLK_RST, BIT(2), (0)), + [RESET_APBC2_TIMERS0] = RESET_DATA(APBC2_TIMERS0_CLK_RST, BIT(2), (0)), + [RESET_APBC2_KPC] = RESET_DATA(APBC2_KPC_CLK_RST, BIT(2), (0)), + [RESET_APBC2_GPIO] = RESET_DATA(APBC2_GPIO_CLK_RST, BIT(2), (0)), +}; + +static const struct ccu_reset_controller_data apbc2_reset_controller_data = { + .count = ARRAY_SIZE(apbc2_reset_data), + .data = apbc2_reset_data, +}; + +static struct spacemit_ccu_data k1_ccu_apbc2_data = { + /* No clocks in the APBC2 CCU */ + .reset_data = &apbc2_reset_controller_data, +}; + static int spacemit_reset_update(struct reset_controller_dev *rcdev, unsigned long id, bool assert) { @@ -1948,6 +2042,18 @@ static const struct of_device_id of_k1_ccu_match[] = { .compatible = "spacemit,k1-syscon-apmu", .data = &k1_ccu_apmu_data, }, + { + .compatible = "spacemit,k1-syscon-rcpu", + .data = &k1_ccu_rcpu_data, + }, + { + .compatible = "spacemit,k1-syscon-rcpu2", + .data = &k1_ccu_rcpu2_data, + }, + { + .compatible = "spacemit,k1-syscon-apbc2", + .data = &k1_ccu_apbc2_data, + }, { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, of_k1_ccu_match); From patchwork Fri Mar 28 21:02:32 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 14032461 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 2C5EBC3600C for ; Fri, 28 Mar 2025 21:02: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=hphFE57rBDPqK2sJ8CtQHuCenTS6i/4vAy/3hXCnlhk=; b=fcF8Pm8wFM9veF dPFz69uWZi3hmAYkUjaBoqMW06Pw860QAoh3F7TP6OE4nhcsXnmtLrZbt4U4WlnCj81JXJozQaya4 rmnz+VBXu7aYE1wQdwJHr2RxVDzUF3FspeLFGw3co+UkpFftTbutKubVEuPnv7OWaFRiJRAlX5LyF h17a5wB6hxVqov6lmcdWUZfGbe/BRgdzdd6yBUepnbNxlJH+Vyu8kR8lFlwGmoD7Hh0Yw678CCKXm qDEXdNN49fwIB7z8Ee8Ky4MH3+8mTHQMKsConGZ59LXdokoF0M44WkLDW38T4+UR0T6dxh/zzOjF0 biOaBAb8EHn5a9bN2moA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.1 #2 (Red Hat Linux)) id 1tyGqq-0000000EJ9w-2wO0; Fri, 28 Mar 2025 21:02:52 +0000 Received: from mail-io1-xd33.google.com ([2607:f8b0:4864:20::d33]) by bombadil.infradead.org with esmtps (Exim 4.98.1 #2 (Red Hat Linux)) id 1tyGqm-0000000EJ7V-2ZRe for linux-riscv@lists.infradead.org; Fri, 28 Mar 2025 21:02:49 +0000 Received: by mail-io1-xd33.google.com with SMTP id ca18e2360f4ac-85dac9729c3so192122739f.2 for ; Fri, 28 Mar 2025 14:02:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=riscstar-com.20230601.gappssmtp.com; s=20230601; t=1743195767; x=1743800567; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Up6UVO27Yn/XqWtQdUwLGOA59Ljhuzuee1Xv/FAc+zk=; b=HODKPis+y7goSmwTlktxUlOlUOivS13Xd8UGP8UWMG1byRsmuef6qohkyq9DlnIQG5 iuC/bfiaE1jey+O+MwWMcqB2OiMJMMHE7yU75rNxLfrabyW0imr9k/xM+Kp/DcKHuo1z PyKTe8Jc93tym2CJAz/yOOvl1rc+VfH9U7uS7XYniinqXCDgGAyysRUfrkeMG0n0TtUA HrUmg8CQH2LdwHMfA0caeaGEPjfuH7lETOitraRweaBTUXzRjTq+eziEVLd84KH3pAN1 ViQxQHEM9PJeugP7xzN0n/9MX/UaXJVjHLyCQFmKxk4AWVLSrDMGGtd1eBPzUYxNjbRW hMAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743195767; x=1743800567; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Up6UVO27Yn/XqWtQdUwLGOA59Ljhuzuee1Xv/FAc+zk=; b=h6wTJhDVDFS+8/O8a7c054n903OwntUevxcxYBKsdRyqar4S41/EBk30FUG5QhGGh2 Ao0nQHla0JQw1PeW7zG4zJ4qYDtTPpSY1Rsd5PRhyu2Bjvn528uYKeZozWxHuzykVGHq /tsv/BGfnpmnjWTFwOtzE3fEOLFjQwFpQUleqknHKgnbnMnfe4i7IB0giPMuZCxqySsh WVT+wWhq7jA/rJGkgWUqXND8+bVvvZ2yr/IYZhajIxsD7er3bp9nj3GYqV5TIDjZBbnW 9dv3gIDVPkzRipwcCFby2wdWWNJYh0NtGE1YIkByG6VlcT/20mlzJt9eD1+Z/vTASMLa kcMw== X-Forwarded-Encrypted: i=1; AJvYcCVWrQYNnVLIlqRjcrdxRlWjCuAYFQpASNrTBgcbkFlmHdSfn+uPeG/Iy/vncUzVkLvNFSGTRDmqXJhOGw==@lists.infradead.org X-Gm-Message-State: AOJu0YxiqmGzVAVD9M3qTRjdQ/xAqYhce67Jmo+7BOG1WmWZUvcmc9Yt PCkU3OuPpXNrv6i/CDRssWEvDlMU9PvnuP5bjOxlaMVesZ6uribLHCT4MdovspI= X-Gm-Gg: ASbGncuqF4NjzO5D8D1H+x5zUNAp++KbLDidPHbmzXZLQIIFsPd6kWnQ8FunTTyq849 jjHhdfW0ae+2xeRZc2qCBdAlKHIB3QRvcuwJ8brQyqUhoEEYfaowo6eYS4QdbToVeNhvLBNjICG GAPQZR8Wc8UXpx2ZrYiA06qmjlEVgD/n6Ue5P0nvWIlrZbd+a9t6uaCszz+WnHJ5PfTJ/zfU/zR yvfhTxs78mTlybKi9gn5kn2hTJuEJzl+cD579pdW9poDEbadeLMbH2ADikUbtlD5Iyg9zwQINgA GOKohdEF32GlKBG7qxs2tjWz87RvJIyxnBij+hhGqWuhyGDEGM7kSrlbs/kwJ2HecNdTpY4Btg6 dVmsGtLkr9y68GSFqqQ== X-Google-Smtp-Source: AGHT+IGycY5TIkiYNgkSFBznHFQkpXRLd390tmdbEA+ih3++uzphzN5QAmfZxFmfAoPvrq6k/CN1+Q== X-Received: by 2002:a05:6e02:23ca:b0:3d3:e296:1c1c with SMTP id e9e14a558f8ab-3d5e090e3e0mr11364365ab.9.1743195767546; Fri, 28 Mar 2025 14:02:47 -0700 (PDT) Received: from localhost.localdomain (c-73-228-159-35.hsd1.mn.comcast.net. [73.228.159.35]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-3d5d5a74286sm6769405ab.39.2025.03.28.14.02.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Mar 2025 14:02:47 -0700 (PDT) From: Alex Elder To: p.zabel@pengutronix.de, mturquette@baylibre.com, sboyd@kernel.org, dlan@gentoo.org Cc: robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, heylenay@4d2.org, guodong@riscstar.com, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, spacemit@lists.linux.dev, devicetree@vger.kernel.org, linux-clk@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 7/7] riscv: dts: spacemit: add reset support for the K1 SoC Date: Fri, 28 Mar 2025 16:02:32 -0500 Message-ID: <20250328210233.1077035-8-elder@riscstar.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250328210233.1077035-1-elder@riscstar.com> References: <20250328210233.1077035-1-elder@riscstar.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250328_140248_653198_F44F33BF X-CRM114-Status: UNSURE ( 9.12 ) 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 Define syscon nodes for the RCPU, RCPU2, and APBC2 SpacemiT CCUS, which currently support resets but not clocks in the SpacemiT K1. Signed-off-by: Alex Elder --- arch/riscv/boot/dts/spacemit/k1.dtsi | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/arch/riscv/boot/dts/spacemit/k1.dtsi b/arch/riscv/boot/dts/spacemit/k1.dtsi index 09a9100986b19..f86d1b58c6d35 100644 --- a/arch/riscv/boot/dts/spacemit/k1.dtsi +++ b/arch/riscv/boot/dts/spacemit/k1.dtsi @@ -350,6 +350,18 @@ soc { dma-noncoherent; ranges; + syscon_rcpu: system-controller@c0880000 { + compatible = "spacemit,k1-syscon-rcpu"; + reg = <0x0 0xc0880000 0x0 0x2048>; + #reset-cells = <1>; + }; + + syscon_rcpu2: system-controller@c0888000 { + compatible = "spacemit,k1-syscon-rcpu2"; + reg = <0x0 0xc0888000 0x0 0x28>; + #reset-cells = <1>; + }; + syscon_apbc: system-control@d4015000 { compatible = "spacemit,k1-syscon-apbc"; reg = <0x0 0xd4015000 0x0 0x1000>; @@ -518,6 +530,12 @@ clint: timer@e4000000 { <&cpu7_intc 3>, <&cpu7_intc 7>; }; + syscon_apbc2: system-controller@f0610000 { + compatible = "spacemit,k1-syscon-apbc2"; + reg = <0x0 0xf0610000 0x0 0x20>; + #reset-cells = <1>; + }; + sec_uart1: serial@f0612000 { compatible = "spacemit,k1-uart", "intel,xscale-uart"; reg = <0x0 0xf0612000 0x0 0x100>;