reset: spacemit: add K1 reset support
Subsystems (5)
v11 cover reset: spacemit: add K1 reset support
This series adds reset controller support for the SpacemiT K1 SoC. A SpacemiT reset controller is implemented as an auxiliary device associated with a clock controller (CCU). A new header file holds definitions used by both the clock and reset drivers.
In this version several "multi-bit" resets have been redefined as individual ones. For example, RESET_AUDIO had a mask that included 3 bits. Now there are 3 separate resets (one for each bit):RESET_AUDIO_SYS; RESET_AUDIO_MCU_CORE; and RESET_AUDIO_APMU.
The reset symbols affected (their previous names) are:
RESET_USB3_0 ->
RESET_USB30_AHB, RESET_USB30_VCC, RESET_USB30_PHY
RESET_AUDIO ->
RESET_AUDIO_SYS, RESET_AUDIO_MCU, RESET_AUDIO_APMU
RESET_PCIE0 ->
RESET_PCI0_DBI, RESET_PCI0_SLV, RESET_PCI0_MSTR, RESET_PCI0_GLB
RESET_PCIE1 ->
RESET_PCI1_DBI, RESET_PCI1_SLV, RESET_PCI1_MSTR, RESET_PCI1_GLB
RESET_PCIE2 ->
RESET_PCI2_DBI, RESET_PCI2_SLV, RESET_PCI2_MSTR, RESET_PCI2_GLBNo other code has changed since v10.
All of these patches are available here:
https://github.com/riscstar/linux/tree/outgoing/reset-v11
-Alex
Between version 10 and version 11:
- Rebased onto Linux v6.16-rc1
- Redefined several "multi-bit" resets as individual ones.
Here is version 10 of this series.
https://lore.kernel.org/lkml/[email protected]/
All other history is available via that link, so I won't reproduce it again here.
Alex Elder (6):
dt-bindings: soc: spacemit: define spacemit,k1-ccu resets
soc: spacemit: create a header for clock/reset registers
clk: spacemit: set up reset auxiliary devices
clk: spacemit: define three reset-only CCUs
reset: spacemit: add support for SpacemiT CCU resets
riscv: dts: spacemit: add reset support for the K1 SoC
.../soc/spacemit/spacemit,k1-syscon.yaml | 29 +- arch/riscv/boot/dts/spacemit/k1.dtsi | 18 ++ drivers/clk/spacemit/Kconfig | 1 + drivers/clk/spacemit/ccu-k1.c | 239 +++++++------- drivers/reset/Kconfig | 9 + drivers/reset/Makefile | 1 + drivers/reset/reset-spacemit.c | 304 ++++++++++++++++++ .../dt-bindings/clock/spacemit,k1-syscon.h | 141 ++++++++ include/soc/spacemit/k1-syscon.h | 160 +++++++++ 9 files changed, 775 insertions(+), 127 deletions(-) create mode 100644 drivers/reset/reset-spacemit.c create mode 100644 include/soc/spacemit/k1-syscon.h
base-commit: 19272b37aa4f83ca52bdf9c16d5d81bdd1354494
Signature · 1 line
2.45.2
PATCH v11 1/6 dt-bindings: soc: spacemit: define spacemit,k1-ccu resets
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.
Previously the clock properties were required for all compatible nodes. Make that requirement only apply to the three existing CCUs (APBC, APMU, and MPMU), so that the new reset-only CCUs can go without specifying them.
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).
---
v11: Expanded combined reset index values into individual ones,
e.g. AUDIO (3 bits) is now AUDIO_SYS, AUDIO_MCU, AUDIO_APMU
.../soc/spacemit/spacemit,k1-syscon.yaml | 29 +++- .../dt-bindings/clock/spacemit,k1-syscon.h | 141 ++++++++++++++++++ 2 files changed, 163 insertions(+), 7 deletions(-)
Documentation/devicetree/bindings/soc/spacemit/spacemit,k1-syscon.yaml +22 -7
@@ -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
@@ -47,9 +50,6 @@ properties: required: - compatible - reg - - clocks - - clock-names - - "#clock-cells" - "#reset-cells" allOf:
@@ -57,13 +57,28 @@ 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 + - if: + properties: + compatible: + contains: + enum: + - spacemit,k1-syscon-apbc + - spacemit,k1-syscon-apmu + - spacemit,k1-syscon-mpmu + then: + required: + - clocks + - clock-names + - "#clock-cells" additionalProperties: false
include/dt-bindings/clock/spacemit,k1-syscon.h +141 -0
157 lines not on this page · raw message
Signature · 1 line
2.45.2
PATCH v11 2/6 soc: spacemit: create a header for clock/reset registers
In reply to Alex ElderMove the definitions of register offsets and fields used by the SpacemiT K1 SoC CCUs into a separate header file, so that they can be shared by the reset driver that will be found under drivers/reset.
--- drivers/clk/spacemit/ccu-k1.c | 111 +---------------------------- include/soc/spacemit/k1-syscon.h | 118 +++++++++++++++++++++++++++++++ 2 files changed, 119 insertions(+), 110 deletions(-) create mode 100644 include/soc/spacemit/k1-syscon.h
drivers/clk/spacemit/ccu-k1.c +1 -110
@@ -11,6 +11,7 @@#include <linux/minmax.h> #include <linux/module.h> #include <linux/platform_device.h> +#include <soc/spacemit/k1-syscon.h> #include "ccu_common.h" #include "ccu_pll.h"
@@ -19,116 +20,6 @@#include <dt-bindings/clock/spacemit,k1-syscon.h> -/* APBS register offset */ -#define APBS_PLL1_SWCR1 0x100 -#define APBS_PLL1_SWCR2 0x104 -#define APBS_PLL1_SWCR3 0x108 -#define APBS_PLL2_SWCR1 0x118 -#define APBS_PLL2_SWCR2 0x11c -#define APBS_PLL2_SWCR3 0x120 -#define APBS_PLL3_SWCR1 0x124 -#define APBS_PLL3_SWCR2 0x128 -#define APBS_PLL3_SWCR3 0x12c - -/* MPMU register offset */ -#define MPMU_POSR 0x0010 -#define POSR_PLL1_LOCK BIT(27) -#define POSR_PLL2_LOCK BIT(28) -#define POSR_PLL3_LOCK BIT(29) -#define MPMU_SUCCR 0x0014 -#define MPMU_ISCCR 0x0044 -#define MPMU_WDTPCR 0x0200 -#define MPMU_RIPCCR 0x0210 -#define MPMU_ACGR 0x1024 -#define MPMU_APBCSCR 0x1050 -#define MPMU_SUCCR_1 0x10b0 - -/* APBC register offset */ -#define APBC_UART1_CLK_RST 0x00 -#define APBC_UART2_CLK_RST 0x04 -#define APBC_GPIO_CLK_RST 0x08 -#define APBC_PWM0_CLK_RST 0x0c -#define APBC_PWM1_CLK_RST 0x10 -#define APBC_PWM2_CLK_RST 0x14 -#define APBC_PWM3_CLK_RST 0x18 -#define APBC_TWSI8_CLK_RST 0x20 -#define APBC_UART3_CLK_RST 0x24 -#define APBC_RTC_CLK_RST 0x28 -#define APBC_TWSI0_CLK_RST 0x2c -#define APBC_TWSI1_CLK_RST 0x30 -#define APBC_TIMERS1_CLK_RST 0x34 -#define APBC_TWSI2_CLK_RST 0x38 -#define APBC_AIB_CLK_RST 0x3c -#define APBC_TWSI4_CLK_RST 0x40 -#define APBC_TIMERS2_CLK_RST 0x44 -#define APBC_ONEWIRE_CLK_RST 0x48 -#define APBC_TWSI5_CLK_RST 0x4c -#define APBC_DRO_CLK_RST 0x58 -#define APBC_IR_CLK_RST 0x5c -#define APBC_TWSI6_CLK_RST 0x60 -#define APBC_COUNTER_CLK_SEL 0x64 -#define APBC_TWSI7_CLK_RST 0x68 -#define APBC_TSEN_CLK_RST 0x6c -#define APBC_UART4_CLK_RST 0x70 -#define APBC_UART5_CLK_RST 0x74 -#define APBC_UART6_CLK_RST 0x78 -#define APBC_SSP3_CLK_RST 0x7c -#define APBC_SSPA0_CLK_RST 0x80 -#define APBC_SSPA1_CLK_RST 0x84 -#define APBC_IPC_AP2AUD_CLK_RST 0x90 -#define APBC_UART7_CLK_RST 0x94 -#define APBC_UART8_CLK_RST 0x98 -#define APBC_UART9_CLK_RST 0x9c -#define APBC_CAN0_CLK_RST 0xa0 -#define APBC_PWM4_CLK_RST 0xa8 -#define APBC_PWM5_CLK_RST 0xac -#define APBC_PWM6_CLK_RST 0xb0 -#define APBC_PWM7_CLK_RST 0xb4 -#define APBC_PWM8_CLK_RST 0xb8 -#define APBC_PWM9_CLK_RST 0xbc -#define APBC_PWM10_CLK_RST 0xc0 -#define APBC_PWM11_CLK_RST 0xc4 -#define APBC_PWM12_CLK_RST 0xc8 -#define APBC_PWM13_CLK_RST 0xcc -#define APBC_PWM14_CLK_RST 0xd0 -#define APBC_PWM15_CLK_RST 0xd4 -#define APBC_PWM16_CLK_RST 0xd8 -#define APBC_PWM17_CLK_RST 0xdc -#define APBC_PWM18_CLK_RST 0xe0 -#define APBC_PWM19_CLK_RST 0xe4 - -/* APMU register offset */ -#define APMU_JPG_CLK_RES_CTRL 0x020 -#define APMU_CSI_CCIC2_CLK_RES_CTRL 0x024 -#define APMU_ISP_CLK_RES_CTRL 0x038 -#define APMU_LCD_CLK_RES_CTRL1 0x044 -#define APMU_LCD_SPI_CLK_RES_CTRL 0x048 -#define APMU_LCD_CLK_RES_CTRL2 0x04c -#define APMU_CCIC_CLK_RES_CTRL 0x050 -#define APMU_SDH0_CLK_RES_CTRL 0x054 -#define APMU_SDH1_CLK_RES_CTRL 0x058 -#define APMU_USB_CLK_RES_CTRL 0x05c -#define APMU_QSPI_CLK_RES_CTRL 0x060 -#define APMU_DMA_CLK_RES_CTRL 0x064 -#define APMU_AES_CLK_RES_CTRL 0x068 -#define APMU_VPU_CLK_RES_CTRL 0x0a4 -#define APMU_GPU_CLK_RES_CTRL 0x0cc -#define APMU_SDH2_CLK_RES_CTRL 0x0e0 -#define APMU_PMUA_MC_CTRL 0x0e8 -#define APMU_PMU_CC2_AP 0x100 -#define APMU_PMUA_EM_CLK_RES_CTRL 0x104 -#define APMU_AUDIO_CLK_RES_CTRL 0x14c -#define APMU_HDMI_CLK_RES_CTRL 0x1b8 -#define APMU_CCI550_CLK_CTRL 0x300 -#define APMU_ACLK_CLK_CTRL 0x388 -#define APMU_CPU_C0_CLK_CTRL 0x38C -#define APMU_CPU_C1_CLK_CTRL 0x390 -#define APMU_PCIE_CLK_RES_CTRL_0 0x3cc -#define APMU_PCIE_CLK_RES_CTRL_1 0x3d4 -#define APMU_PCIE_CLK_RES_CTRL_2 0x3dc -#define APMU_EMAC0_CLK_RES_CTRL 0x3e4 -#define APMU_EMAC1_CLK_RES_CTRL 0x3ec -struct spacemit_ccu_data {struct clk_hw **hws;size_t num;
include/soc/spacemit/k1-syscon.h new file +118 -0
118 lines not on this page · raw message
Signature · 1 line
2.45.2
PATCH v11 3/6 clk: spacemit: set up reset auxiliary devices
In reply to Alex ElderAdd a new reset_name field to the spacemit_ccu_data structure. If it is non-null, the CCU implements a reset controller, and the name will be used in the name for the auxiliary device that implements it.
Define a new type to hold an auxiliary device as well as the regmap pointer that will be needed by CCU reset controllers. Set up code to initialize and add an auxiliary device for any CCU that implements reset functionality.
Make it optional for a CCU to implement a clock controller. This doesn't apply to any of the existing CCUs but will for some new ones that will be added soon.
--- drivers/clk/spacemit/Kconfig | 1 + drivers/clk/spacemit/ccu-k1.c | 104 ++++++++++++++++++++++++++++--- include/soc/spacemit/k1-syscon.h | 12 ++++ 3 files changed, 107 insertions(+), 10 deletions(-)
drivers/clk/spacemit/Kconfig +1 -0
@@ -3,6 +3,7 @@ config SPACEMIT_CCU tristate "Clock support for SpacemiT SoCs" depends on ARCH_SPACEMIT || COMPILE_TEST + select AUXILIARY_BUS select MFD_SYSCON help Say Y to enable clock controller unit support for SpacemiT SoCs.
drivers/clk/spacemit/ccu-k1.c +94 -10
174 lines not on this page · raw message
include/soc/spacemit/k1-syscon.h +12 -0
@@ -5,6 +5,18 @@#ifndef __SOC_K1_SYSCON_H__#define __SOC_K1_SYSCON_H__ +/* Auxiliary device used to represent a CCU reset controller */ +struct spacemit_ccu_adev { +struct auxiliary_device adev; +struct regmap *regmap; +}; + +static inline struct spacemit_ccu_adev * +to_spacemit_ccu_adev (struct auxiliary_device *adev) +{ + return container_of(adev, struct spacemit_ccu_adev, adev); +} +/* APBS register offset */ #define APBS_PLL1_SWCR1 0x100#define APBS_PLL1_SWCR2 0x104
Signature · 1 line
2.45.2
PATCH v11 4/6 clk: spacemit: define three reset-only CCUs
In reply to Alex ElderThree CCUs on the SpacemiT K1 SoC implement only resets, not clocks. Define the CCU data for these resets so their auxiliary devices get created.
--- drivers/clk/spacemit/ccu-k1.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
drivers/clk/spacemit/ccu-k1.c +24 -0
@@ -943,6 +943,18 @@ static const struct spacemit_ccu_data k1_ccu_apmu_data = { .num = ARRAY_SIZE(k1_ccu_apmu_hws), }; +static const struct spacemit_ccu_data k1_ccu_rcpu_data = { + .reset_name ="rcpu-reset" , +}; + +static const struct spacemit_ccu_data k1_ccu_rcpu2_data = { + .reset_name ="rcpu2-reset" , +}; + +static const struct spacemit_ccu_data k1_ccu_apbc2_data = { + .reset_name ="apbc2-reset" , +}; + static int spacemit_ccu_register(struct device *dev, struct regmap *regmap, struct regmap *lock_regmap,
@@ -1121,6 +1133,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, + }, { } }; MODULE_DEVICE_TABLE(of, of_k1_ccu_match);
Signature · 1 line
2.45.2
PATCH v11 5/6 reset: spacemit: add support for SpacemiT CCU resets
In reply to Alex ElderImplement reset support for SpacemiT CCUs. A SpacemiT reset controller device is an auxiliary device associated with a clock controller (CCU).
This patch defines the reset controllers for the MPMU, APBC, and MPMU CCUs, which already define clock controllers. It also adds RCPU, RCPU2, and ACPB2 CCUs, which only define resets.
---
v11: Redefined combined reset definitions into individual ones
drivers/reset/Kconfig | 9 + drivers/reset/Makefile | 1 + drivers/reset/reset-spacemit.c | 304 +++++++++++++++++++++++++++++++ include/soc/spacemit/k1-syscon.h | 30 +++ 4 files changed, 344 insertions(+) create mode 100644 drivers/reset/reset-spacemit.c
drivers/reset/Kconfig +9 -0
@@ -270,6 +270,15 @@ config RESET_SOCFPGA This enables the reset driver for the SoCFPGA ARMv7 platforms. This driver gets initialized early during platform init calls. +config RESET_SPACEMIT + tristate "SpacemiT reset driver" + depends on ARCH_SPACEMIT || COMPILE_TEST + select AUXILIARY_BUS + default ARCH_SPACEMIT + help + This enables the reset controller driver for SpacemiT SoCs, + including the K1. + config RESET_SUNPLUS bool "Sunplus SoCs Reset Driver" if COMPILE_TEST default ARCH_SUNPLUS
drivers/reset/Makefile +1 -0
@@ -35,6 +35,7 @@ obj-$(CONFIG_RESET_RZV2H_USB2PHY) += reset-rzv2h-usb2phy.o obj-$(CONFIG_RESET_SCMI) += reset-scmi.o obj-$(CONFIG_RESET_SIMPLE) += reset-simple.o obj-$(CONFIG_RESET_SOCFPGA) += reset-socfpga.o +obj-$(CONFIG_RESET_SPACEMIT) += reset-spacemit.o obj-$(CONFIG_RESET_SUNPLUS) += reset-sunplus.o obj-$(CONFIG_RESET_SUNXI) += reset-sunxi.o obj-$(CONFIG_RESET_TH1520) += reset-th1520.o
drivers/reset/reset-spacemit.c new file +304 -0
304 lines not on this page · raw message
include/soc/spacemit/k1-syscon.h +30 -0
@@ -127,4 +127,34 @@ to_spacemit_ccu_adev(struct auxiliary_device *adev)#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 +#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 +#endif /* __SOC_K1_SYSCON_H__ */
Signature · 1 line
2.45.2
Re: [PATCH v11 5/6] reset: spacemit: add support for SpacemiT CCU resets
Quoted 7 lines · Alex Elder
Implement reset support for SpacemiT CCUs. A SpacemiT reset controller device is an auxiliary device associated with a clock controller (CCU).
This patch defines the reset controllers for the MPMU, APBC, and MPMU CCUs, which already define clock controllers. It also adds RCPU, RCPU2, and ACPB2 CCUs, which only define resets.
Quoted 5 lines
Signed-off-by Alex Elder <[email protected]>Reviewed-by Philipp Zabel <[email protected]>Reviewed-by Yixun Lan <[email protected]>---
v11: Redefined combined reset definitions into individual ones
After I sent this, I realized the clocks use a different naming convention for two of the PCIe symbols. I think reset should follow the same convention.
Yixun if you accept this series, would you mind updating these?
RESET_PCIE0_SLV -> RESET_PCIE0_SLAVE
RESET_PCIE0_MSTR -> RESET_PCIE_MASTER
(And similar changes for PCIE1 and PCIE2.)
Thank you.
-Alex
Quoted 389 lines
drivers/reset/Kconfig | 9 + drivers/reset/Makefile | 1 + drivers/reset/reset-spacemit.c | 304 +++++++++++++++++++++++++++++++ include/soc/spacemit/k1-syscon.h | 30 +++ 4 files changed, 344 insertions(+)create mode 100644
drivers/reset/reset-spacemit.cdrivers/reset/Kconfig +9
-0@@ -270,6 +270,15 @@ config RESET_SOCFPGA This enables the reset driver for the SoCFPGA ARMv7 platforms. This driver gets initialized early during platform init calls. +config RESET_SPACEMIT + tristate "SpacemiT reset driver" + depends on ARCH_SPACEMIT || COMPILE_TEST + select AUXILIARY_BUS + default ARCH_SPACEMIT + help + This enables the reset controller driver for SpacemiT SoCs, + including the K1. + config RESET_SUNPLUS bool "Sunplus SoCs Reset Driver" if COMPILE_TEST default ARCH_SUNPLUSdrivers/reset/Makefile +1
-0@@ -35,6 +35,7 @@ obj-$(CONFIG_RESET_RZV2H_USB2PHY) += reset-rzv2h-usb2phy.o obj-$(CONFIG_RESET_SCMI) += reset-scmi.o obj-$(CONFIG_RESET_SIMPLE) += reset-simple.o obj-$(CONFIG_RESET_SOCFPGA) += reset-socfpga.o +obj-$(CONFIG_RESET_SPACEMIT) += reset-spacemit.o obj-$(CONFIG_RESET_SUNPLUS) += reset-sunplus.o obj-$(CONFIG_RESET_SUNXI) += reset-sunxi.o obj-$(CONFIG_RESET_TH1520) += reset-th1520.odrivers/reset/reset-spacemit.c new file +304
-0@@ -0,0 +1,304 @@ +// SPDX-License-Identifier: GPL-2.0-only + +/* SpacemiT reset controller driver */ + +#include <linux/auxiliary_bus.h> +#include <linux/container_of.h> +#include <linux/device.h> +#include <linux/module.h> +#include <linux/regmap.h> +#include <linux/reset-controller.h> +#include <linux/types.h> + +#include <soc/spacemit/k1-syscon.h> +#include <dt-bindings/clock/spacemit,k1-syscon.h> + +struct ccu_reset_data { +u32 offset; +u32 assert_mask; +u32 deassert_mask; +}; + +struct ccu_reset_controller_data { +const struct ccu_reset_data *reset_data;/* array */ +size_t count; +}; + +struct ccu_reset_controller { +struct reset_controller_dev rcdev; +const struct ccu_reset_controller_data *data; +struct regmap *regmap; +}; + +#define RESET_DATA (_offset, _assert_mask, _deassert_mask) \ + { \ + .offset = (_offset), \ + .assert_mask = (_assert_mask), \ + .deassert_mask = (_deassert_mask), \ + } + +static const struct ccu_reset_data k1_mpmu_resets[] = { + [RESET_WDT ] =RESET_DATA (MPMU_WDTPCR ,BIT (2 ),0 ), +}; + +static const struct ccu_reset_controller_data k1_mpmu_reset_data = { + .reset_data = k1_mpmu_resets, + .count =ARRAY_SIZE (k1_mpmu_resets), +}; + +static const struct ccu_reset_data k1_apbc_resets[] = { + [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 k1_apbc_reset_data = { + .reset_data = k1_apbc_resets, + .count =ARRAY_SIZE (k1_apbc_resets), +}; + +static const struct ccu_reset_data k1_apmu_resets[] = { + [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_USB30_AHB ] =RESET_DATA (APMU_USB_CLK_RES_CTRL ,0 ,BIT (9 )), + [RESET_USB30_VCC ] =RESET_DATA (APMU_USB_CLK_RES_CTRL ,0 ,BIT (10 )), + [RESET_USB30_PHY ] =RESET_DATA (APMU_USB_CLK_RES_CTRL ,0 ,BIT (11 )), + [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_SYS ] =RESET_DATA (APMU_AUDIO_CLK_RES_CTRL ,0 ,BIT (0 )), + [RESET_AUDIO_MCU ] =RESET_DATA (APMU_AUDIO_CLK_RES_CTRL ,0 ,BIT (2 )), + [RESET_AUDIO_APMU ] =RESET_DATA (APMU_AUDIO_CLK_RES_CTRL ,0 ,BIT (3 )), + [RESET_HDMI ] =RESET_DATA (APMU_HDMI_CLK_RES_CTRL ,0 ,BIT (9 )), + [RESET_PCIE0_DBI ] =RESET_DATA (APMU_PCIE_CLK_RES_CTRL_0 ,0 ,BIT (3 )), + [RESET_PCIE0_SLV ] =RESET_DATA (APMU_PCIE_CLK_RES_CTRL_0 ,0 ,BIT (4 )), + [RESET_PCIE0_MSTR ] =RESET_DATA (APMU_PCIE_CLK_RES_CTRL_0 ,0 ,BIT (5 )), + [RESET_PCIE0_GLB ] =RESET_DATA (APMU_PCIE_CLK_RES_CTRL_0 ,BIT (8 ),0 ), + [RESET_PCIE1_DBI ] =RESET_DATA (APMU_PCIE_CLK_RES_CTRL_1 ,0 ,BIT (3 )), + [RESET_PCIE1_SLV ] =RESET_DATA (APMU_PCIE_CLK_RES_CTRL_1 ,0 ,BIT (4 )), + [RESET_PCIE1_MSTR ] =RESET_DATA (APMU_PCIE_CLK_RES_CTRL_1 ,0 ,BIT (5 )), + [RESET_PCIE1_GLB ] =RESET_DATA (APMU_PCIE_CLK_RES_CTRL_1 ,BIT (8 ),0 ), + [RESET_PCIE2_DBI ] =RESET_DATA (APMU_PCIE_CLK_RES_CTRL_2 ,0 ,BIT (3 )), + [RESET_PCIE2_SLV ] =RESET_DATA (APMU_PCIE_CLK_RES_CTRL_2 ,0 ,BIT (4 )), + [RESET_PCIE2_MSTR ] =RESET_DATA (APMU_PCIE_CLK_RES_CTRL_2 ,0 ,BIT (5 )), + [RESET_PCIE2_GLB ] =RESET_DATA (APMU_PCIE_CLK_RES_CTRL_2 ,BIT (8 ),0 ), + [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 k1_apmu_reset_data = { + .reset_data = k1_apmu_resets, + .count =ARRAY_SIZE (k1_apmu_resets), +}; + +static const struct ccu_reset_data k1_rcpu_resets[] = { + [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 k1_rcpu_reset_data = { + .reset_data = k1_rcpu_resets, + .count =ARRAY_SIZE (k1_rcpu_resets), +}; + +static const struct ccu_reset_data k1_rcpu2_resets[] = { + [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 k1_rcpu2_reset_data = { + .reset_data = k1_rcpu2_resets, + .count =ARRAY_SIZE (k1_rcpu2_resets), +}; + +static const struct ccu_reset_data k1_apbc2_resets[] = { + [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 k1_apbc2_reset_data = { + .reset_data = k1_apbc2_resets, + .count =ARRAY_SIZE (k1_apbc2_resets), +}; + +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->reset_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_reset_controller_register (struct device *dev, +struct ccu_reset_controller *controller) +{ +struct reset_controller_dev *rcdev = &controller->rcdev; + + rcdev->ops = &spacemit_reset_control_ops; + rcdev->owner =THIS_MODULE ; + rcdev->of_node = dev->of_node; + rcdev->nr_resets = controller->data->count; + +return devm_reset_controller_register (dev, &controller->rcdev); +} + +static int spacemit_reset_probe (struct auxiliary_device *adev, +const struct auxiliary_device_id *id) +{ +struct spacemit_ccu_adev *rdev =to_spacemit_ccu_adev (adev); +struct ccu_reset_controller *controller; +struct device *dev = &adev->dev; + + controller =devm_kzalloc (dev,sizeof (*controller),GFP_KERNEL ); +if (!controller) +return -ENOMEM ; + controller->data = (const struct ccu_reset_controller_data *)id->driver_data; + controller->regmap = rdev->regmap; + +return spacemit_reset_controller_register (dev, controller); +} + +#define K1_AUX_DEV_ID (_unit) \ + { \ + .name = "spacemit_ccu_k1." #_unit "-reset", \ + .driver_data = (kernel_ulong_t)&k1_ ## _unit ## _reset_data, \ + } + +static const struct auxiliary_device_id spacemit_reset_ids[] = { +K1_AUX_DEV_ID (mpmu), +K1_AUX_DEV_ID (apbc), +K1_AUX_DEV_ID (apmu), +K1_AUX_DEV_ID (rcpu), +K1_AUX_DEV_ID (rcpu2), +K1_AUX_DEV_ID (apbc2), + { }, +}; +MODULE_DEVICE_TABLE (auxiliary, spacemit_reset_ids); + +static struct auxiliary_driver spacemit_k1_reset_driver = { + .probe = spacemit_reset_probe, + .id_table = spacemit_reset_ids, +}; +module_auxiliary_driver (spacemit_k1_reset_driver); + +MODULE_AUTHOR ("Alex Elder <[email protected]>" ); +MODULE_DESCRIPTION ("SpacemiT reset controller driver" ); +MODULE_LICENSE ("GPL" );include/soc/spacemit/k1-syscon.h +30
-0@@ -127,4 +127,34 @@ to_spacemit_ccu_adev(struct auxiliary_device *adev)#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 +#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 +#endif /* __SOC_K1_SYSCON_H__ */
Re: [PATCH v11 5/6] reset: spacemit: add support for SpacemiT CCU resets
Hi Alex,
Quoted 18 lines · Alex Elder
Quoted 7 lines · Alex Elder
Implement reset support for SpacemiT CCUs. A SpacemiT reset controller device is an auxiliary device associated with a clock controller (CCU).
This patch defines the reset controllers for the MPMU, APBC, and MPMU CCUs, which already define clock controllers. It also adds RCPU, RCPU2, and ACPB2 CCUs, which only define resets.
Quoted 5 lines
Signed-off-by Alex Elder <[email protected]>Reviewed-by Philipp Zabel <[email protected]>Reviewed-by Yixun Lan <[email protected]>---
v11: Redefined combined reset definitions into individual onesAfter I sent this, I realized the clocks use a different naming convention for two of the PCIe symbols. I think reset should follow the same convention.
Quoted 8 lines
Yixun if you accept this series, would you mind updating these?
RESET_PCIE0_SLV -> RESET_PCIE0_SLAVE RESET_PCIE0_MSTR -> RESET_PCIE_MASTER(And similar changes for PCIE1 and PCIE2.)
sure, done, check here (let me know if I did wrong)
https://github.com/spacemit-com/linux/releases/tag/spacemit-reset-drv-for-6.17
Quoted 3 lines
Thank you.
-Alex
Signature · 1 line
Yixun Lan (dlan)
Re: [PATCH v11 5/6] reset: spacemit: add support for SpacemiT CCU resets
Quoted 24 lines · Yixun Lan
Hi Alex,
Quoted 21 lines · Alex Elder
Quoted 7 lines · Alex Elder
Implement reset support for SpacemiT CCUs. A SpacemiT reset controller device is an auxiliary device associated with a clock controller (CCU).
This patch defines the reset controllers for the MPMU, APBC, and MPMU CCUs, which already define clock controllers. It also adds RCPU, RCPU2, and ACPB2 CCUs, which only define resets.
Quoted 5 lines
Signed-off-by Alex Elder <[email protected]>Reviewed-by Philipp Zabel <[email protected]>Reviewed-by Yixun Lan <[email protected]>---
v11: Redefined combined reset definitions into individual onesAfter I sent this, I realized the clocks use a different naming convention for two of the PCIe symbols. I think reset should follow the same convention.
Yixun if you accept this series, would you mind updating these?
Quoted 7 lines
Quoted 5 lines
RESET_PCIE0_SLV -> RESET_PCIE0_SLAVE RESET_PCIE0_MSTR -> RESET_PCIE_MASTER(And similar changes for PCIE1 and PCIE2.)
sure, done, check here (let me know if I did wrong)
https://github.com/spacemit-com/linux/releases/tag/spacemit-reset-drv-for-6.17
Looks good to me. Thank you. -Alex
Quoted 4 lines
Quoted 4 lines
Thank you.
-Alex
PATCH v11 6/6 riscv: dts: spacemit: add reset support for the K1 SoC
In reply to Alex ElderDefine syscon nodes for the RCPU, RCPU2, and APBC2 SpacemiT CCUS, which currently support resets but not clocks in the SpacemiT K1.
--- arch/riscv/boot/dts/spacemit/k1.dtsi | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
arch/riscv/boot/dts/spacemit/k1.dtsi +18 -0
@@ -346,6 +346,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-controller@d4015000 { compatible = "spacemit,k1-syscon-apbc"; reg = <0x0 0xd4015000 0x0 0x1000>;
@@ -553,6 +565,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>;
Signature · 1 line
2.45.2
Hi ALL,
As the reset driver going through several review cycles,
it becomes quite calm down now, I'd like to request to merge it into v6.17, because various drivers (pwm, emac..) will depend on it, even in the worst case if there is problem, I believe Alex will help to address..
Hi Philipp,
I'd like to query if you willing to take the reset driver -
patch [5/6] through the reset tree? It sounds more intuitive, which also will avoid potential conflicts with Kconfig/Makefile..
I've created a prerequisite immutable tag which could be
shared between clock and reset subsytem. It's tag - spacemit-reset-deps-for-6.17 at SpacemiT's SoC tree [1], which effectively are patches [1-4] of this series.
But, to make your life easy, I've also applied patch [5/6] at tag spacemit-reset-drv-for-6.17 [2] which has a small macro adjustment requested by Alex at [3]
Let me know what you think of this, thanks
Quoted 65 lines · Alex Elder
This series adds reset controller support for the SpacemiT K1 SoC. A SpacemiT reset controller is implemented as an auxiliary device associated with a clock controller (CCU). A new header file holds definitions used by both the clock and reset drivers.
In this version several "multi-bit" resets have been redefined as individual ones. For example,
RESET_AUDIOhad a mask that included 3 bits. Now there are 3 separate resets (one for each bit):RESET_AUDIO_SYS;RESET_AUDIO_MCU_CORE; andRESET_AUDIO_APMU.The reset symbols affected (their previous names) are:
RESET_USB3_0 -> RESET_USB30_AHB, RESET_USB30_VCC, RESET_USB30_PHY RESET_AUDIO -> RESET_AUDIO_SYS, RESET_AUDIO_MCU, RESET_AUDIO_APMU RESET_PCIE0 -> RESET_PCI0_DBI, RESET_PCI0_SLV, RESET_PCI0_MSTR, RESET_PCI0_GLB RESET_PCIE1 -> RESET_PCI1_DBI, RESET_PCI1_SLV, RESET_PCI1_MSTR, RESET_PCI1_GLB RESET_PCIE2 -> RESET_PCI2_DBI, RESET_PCI2_SLV, RESET_PCI2_MSTR, RESET_PCI2_GLBNo other code has changed since v10.
All of these patches are available here:
https://github.com/riscstar/linux/tree/outgoing/reset-v11-Alex
Between version 10 and version 11:
- Rebased onto Linux v6.16-rc1
- Redefined several "multi-bit" resets as individual ones.Here is version 10 of this series.
https://lore.kernel.org/lkml/[email protected]/All other history is available via that link, so I won't reproduce it again here.
Alex Elder (6):
dt-bindings: soc: spacemit: define spacemit,k1-ccu resets
soc: spacemit: create a header for clock/reset registers
clk: spacemit: set up reset auxiliary devices
clk: spacemit: define three reset-only CCUs
reset: spacemit: add support for SpacemiT CCU resets
riscv: dts: spacemit: add reset support for the K1 SoC.../soc/spacemit/spacemit,k1-syscon.yaml | 29 +- arch/riscv/boot/dts/spacemit/k1.dtsi | 18 ++ drivers/clk/spacemit/Kconfig | 1 + drivers/clk/spacemit/ccu-k1.c | 239 +++++++------- drivers/reset/Kconfig | 9 + drivers/reset/Makefile | 1 + drivers/reset/reset-spacemit.c | 304 ++++++++++++++++++ .../dt-bindings/clock/spacemit,k1-syscon.h | 141 ++++++++ include/soc/spacemit/k1-syscon.h | 160 +++++++++ 9 files changed, 775 insertions(+), 127 deletions(-) create mode 100644 drivers/reset/reset-spacemit.c create mode 100644 include/soc/spacemit/k1-syscon.hbase-commit:
19272b37aa4f83ca52bdf9c16d5d81bdd1354494Signature · 1 line
2.45.2
Signature · 1 line
Yixun Lan (dlan)
Hi Philipp,
Quoted 7 lines · Yixun Lan
Hi ALL,
As the reset driver going through several review cycles,
it becomes quite calm down now, I'd like to request to merge it into v6.17, because various drivers (pwm, emac..) will depend on it, even in the worst case if there is problem, I believe Alex will help to address..
Quoted 13 lines
Hi Philipp,
I'd like to query if you willing to take the reset driver -
patch [5/6] through the reset tree? It sounds more intuitive, which also will avoid potential conflicts with Kconfig/Makefile..
I've created a prerequisite immutable tag which could be
shared between clock and reset subsytem. It's tag - spacemit-reset-deps-for-6.17 at SpacemiT's SoC tree [1], which effectively are patches [1-4] of this series.
But, to make your life easy, I've also applied patch [5/6] at tag spacemit-reset-drv-for-6.17 [2] which has a small macro adjustment requested by Alex at [3]
Let me know what you think of this, thanks
Just want to ping this, what do you want from my side to proceed?
or do you want me to send a more formal Pull-Request for [1], then you can apply patch [5/6] (still need to fix the macro of [3])
Quoted 74 lines
Quoted 65 lines · Alex Elder
This series adds reset controller support for the SpacemiT K1 SoC. A SpacemiT reset controller is implemented as an auxiliary device associated with a clock controller (CCU). A new header file holds definitions used by both the clock and reset drivers.
In this version several "multi-bit" resets have been redefined as individual ones. For example,
RESET_AUDIOhad a mask that included 3 bits. Now there are 3 separate resets (one for each bit):RESET_AUDIO_SYS;RESET_AUDIO_MCU_CORE; andRESET_AUDIO_APMU.The reset symbols affected (their previous names) are:
RESET_USB3_0 -> RESET_USB30_AHB, RESET_USB30_VCC, RESET_USB30_PHY RESET_AUDIO -> RESET_AUDIO_SYS, RESET_AUDIO_MCU, RESET_AUDIO_APMU RESET_PCIE0 -> RESET_PCI0_DBI, RESET_PCI0_SLV, RESET_PCI0_MSTR, RESET_PCI0_GLB RESET_PCIE1 -> RESET_PCI1_DBI, RESET_PCI1_SLV, RESET_PCI1_MSTR, RESET_PCI1_GLB RESET_PCIE2 -> RESET_PCI2_DBI, RESET_PCI2_SLV, RESET_PCI2_MSTR, RESET_PCI2_GLBNo other code has changed since v10.
All of these patches are available here:
https://github.com/riscstar/linux/tree/outgoing/reset-v11-Alex
Between version 10 and version 11:
- Rebased onto Linux v6.16-rc1
- Redefined several "multi-bit" resets as individual ones.Here is version 10 of this series.
https://lore.kernel.org/lkml/[email protected]/All other history is available via that link, so I won't reproduce it again here.
Alex Elder (6):
dt-bindings: soc: spacemit: define spacemit,k1-ccu resets
soc: spacemit: create a header for clock/reset registers
clk: spacemit: set up reset auxiliary devices
clk: spacemit: define three reset-only CCUs
reset: spacemit: add support for SpacemiT CCU resets
riscv: dts: spacemit: add reset support for the K1 SoC.../soc/spacemit/spacemit,k1-syscon.yaml | 29 +- arch/riscv/boot/dts/spacemit/k1.dtsi | 18 ++ drivers/clk/spacemit/Kconfig | 1 + drivers/clk/spacemit/ccu-k1.c | 239 +++++++------- drivers/reset/Kconfig | 9 + drivers/reset/Makefile | 1 + drivers/reset/reset-spacemit.c | 304 ++++++++++++++++++ .../dt-bindings/clock/spacemit,k1-syscon.h | 141 ++++++++ include/soc/spacemit/k1-syscon.h | 160 +++++++++ 9 files changed, 775 insertions(+), 127 deletions(-) create mode 100644 drivers/reset/reset-spacemit.c create mode 100644 include/soc/spacemit/k1-syscon.hbase-commit:
19272b37aa4f83ca52bdf9c16d5d81bdd1354494Signature · 1 line
2.45.2Signature · 1 line
Yixun Lan (dlan)
Signature · 1 line
Yixun Lan (dlan)
Philipp Zabel
maintainerQuoted 23 lines · Yixun Lan
Hi Philipp,
Quoted 7 lines · Yixun Lan
Hi ALL,
As the reset driver going through several review cycles,
it becomes quite calm down now, I'd like to request to merge it into v6.17, because various drivers (pwm, emac..) will depend on it, even in the worst case if there is problem, I believe Alex will help to address..Quoted 13 lines
Hi Philipp,
I'd like to query if you willing to take the reset driver -
patch [5/6] through the reset tree? It sounds more intuitive, which also will avoid potential conflicts with Kconfig/Makefile..
I've created a prerequisite immutable tag which could be
shared between clock and reset subsytem. It's tag - spacemit-reset-deps-for-6.17 at SpacemiT's SoC tree [1], which effectively are patches [1-4] of this series.
But, to make your life easy, I've also applied patch [5/6] at tag spacemit-reset-drv-for-6.17 [2] which has a small macro adjustment requested by Alex at [3]
Let me know what you think of this, thanks
Quoted 4 lines
Just want to ping this, what do you want from my side to proceed?
or do you want me to send a more formal Pull-Request for [1], then you can apply patch [5/6] (still need to fix the macro of [3])
Please send a v12, so that the latest modifications are on the list.
I'd prefer to either pick patches 1 and 5 from the list, or, if you provide a tag with only patch 1 to be pulled into both clk and reset trees, to merge that and then pick patch 5.
regards
Philipp
Quoted 26 lines · Philipp Zabel
Quoted 25 lines · Yixun Lan
Hi Philipp,
Quoted 7 lines · Yixun Lan
Hi ALL,
As the reset driver going through several review cycles,
it becomes quite calm down now, I'd like to request to merge it into v6.17, because various drivers (pwm, emac..) will depend on it, even in the worst case if there is problem, I believe Alex will help to address..Quoted 13 lines
Hi Philipp,
I'd like to query if you willing to take the reset driver -
patch [5/6] through the reset tree? It sounds more intuitive, which also will avoid potential conflicts with Kconfig/Makefile..
I've created a prerequisite immutable tag which could be
shared between clock and reset subsytem. It's tag - spacemit-reset-deps-for-6.17 at SpacemiT's SoC tree [1], which effectively are patches [1-4] of this series.
But, to make your life easy, I've also applied patch [5/6] at tag spacemit-reset-drv-for-6.17 [2] which has a small macro adjustment requested by Alex at [3]
Let me know what you think of this, thanksJust want to ping this, what do you want from my side to proceed?
Quoted 8 lines
Quoted 2 lines
or do you want me to send a more formal Pull-Request for [1], then you can apply patch [5/6] (still need to fix the macro of [3])
Please send a v12, so that the latest modifications are on the list.
I'd prefer to either pick patches 1 and 5 from the list, or, if you provide a tag with only patch 1 to be pulled into both clk and reset trees, to merge that and then pick patch 5.
I will send v12 this morning. -Alex
Quoted 2 lines
regards
Philipp
Hi Philipp,
Quoted 26 lines · Philipp Zabel
Quoted 25 lines · Yixun Lan
Hi Philipp,
Quoted 7 lines · Yixun Lan
Hi ALL,
As the reset driver going through several review cycles,
it becomes quite calm down now, I'd like to request to merge it into v6.17, because various drivers (pwm, emac..) will depend on it, even in the worst case if there is problem, I believe Alex will help to address..Quoted 13 lines
Hi Philipp,
I'd like to query if you willing to take the reset driver -
patch [5/6] through the reset tree? It sounds more intuitive, which also will avoid potential conflicts with Kconfig/Makefile..
I've created a prerequisite immutable tag which could be
shared between clock and reset subsytem. It's tag - spacemit-reset-deps-for-6.17 at SpacemiT's SoC tree [1], which effectively are patches [1-4] of this series.
But, to make your life easy, I've also applied patch [5/6] at tag spacemit-reset-drv-for-6.17 [2] which has a small macro adjustment requested by Alex at [3]
Let me know what you think of this, thanksJust want to ping this, what do you want from my side to proceed?
Quoted 9 lines
Quoted 2 lines
or do you want me to send a more formal Pull-Request for [1], then you can apply patch [5/6] (still need to fix the macro of [3])
Please send a v12, so that the latest modifications are on the list.
I'd prefer to either pick patches 1 and 5 from the list, or, if you provide a tag with only patch 1 to be pulled into both clk and reset trees, to merge that and then pick patch 5.
I will prepare a tag of only patch 1, and leave you to pick patch 5.
So in this way, I can handle the reset - take patch 2-4 via clk tree, and patch 6 via SoC tree..
I've sent a PR here
https://lore.kernel.org/all/20250703151823-GYA312602@gentoo/
Signature · 1 line
Yixun Lan (dlan)