From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796059484; b=VrJdcB4ld30dCF+ZCrRbG6T9gTuhqqY5zIIDeF3L99qCVn2P8A80VYfDTOp3iKU3Hwgp WksrsLmSnr86xlOGW5Tkee37qg/C76pzhTnl8xAKE5fe6JIGLOYk18h48a2yJw3Dua4Dx 5gsaFTqB+RBKHLLNHH/G24gsqw1Y/dsovqZ5+jAVc/VKBLJd7h1GY74ZRfSlDm69twsw/ gxIVMqyrh4PYl45xLTWCgFoJzTNTz/OIp50Eq24tF/pNpD8Uo1Hk2EYwu8u8C+gDl9mFx MRNd5ALJ9zeZNcYQVnDieXxsu0lWqsiLdlirpSFNyXpA7Wp9T165DzICfZrE/Zt06mg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796059484; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Transfer-Encoding; bh=VX0JmqeSqUQyzHyVQrOXsklDT316LQXII+V0D/Hc2Zg=; b=q1wxKp3FiARsZKoyR79XaZEVelIWxtevZAXbUtQCiyV/NMVcEGQNq2EMZyh+tvxJsRIL 49/8zeFdHW+elYsYmLJ+1p0WcCU7/CI78LYoeplM4eyxIadjbWVgRB4knWDJrQesG7gSJ SCoze5O1uqeEtJcWCJ4S+AQpkOmCEX9vTsGiCat7SS1oHeTl02vy4+PXdWN694nN9r+7w GJZ61BuzycqFnZGT8MNZWg4d2wgWM4zXWfWOP3KhJINKgE/Euo2nErD9FsSTv7NLew40v 2qhiYDzfEP2oxTpNmiZ+kHsfNsbxmJwW/AiIN79N4r+h4Qv+PFF0aF7ZFznrzBIo26A== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=bSLvgdYh; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3EE1F606A32D; Mon, 30 Nov 2026 17:24:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=bSLvgdYh Received: by smtp.kernel.org (Postfix) with ESMTPSA id CEDE31F00930; Mon, 30 Nov 2026 17:24:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796059484; bh=VX0JmqeSqUQyzHyVQrOXsklDT316LQXII+V0D/Hc2Zg=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=bSLvgdYhQDhNJ98QRnl4kmY1x0IbvT63gKUuCD+ifHyov8iTuS3tlQEDh1x0a5oOc HoVXxZ7K0DysQwmRP8j5jebqrcATG+8HBlLaNtRaSoU8jpT0o09HnQ//XwTayMcUBP PvY6VLkysax+ixOJD10dJfx8dtW/fa8zOefJ2Ziaplt2lSlvrDSs6PkrjoN+3KlTag j/OaJj1h2Yqip2Z5+3FMt4gy3D2tdgFArohxHW+syv9pGHPM2h56uJLGm21zlhyZn+ v4SHrlUhofmVZS160lqOcjTEtxcNxOI8uwbQVCjROjfkxOgJCVWDein34ToMCbE2h0 mCmfOHjqinOQA== From: Jisheng Zhang To: Rob Herring , Conor Dooley , Krzysztof Kozlowski , Catalin Marinas , Will Deacon , Mark Rutland , Sebastian Hesselbarth , Stephen Boyd , Brian Masney , Jerome Brunet , Linus Walleij , Philipp Zabel Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-gpio@vger.kernel.org Subject: [PATCH v3 07/13] reset: add Synaptics SL2610 reset controller support Date: Tue, 1 Dec 2026 01:03:40 +0800 Message-ID: <20261130170352.12853-8-jszhang@kernel.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20261130170352.12853-1-jszhang@kernel.org> References: <20261130170352.12853-1-jszhang@kernel.org> X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Support the SoC and MCU reset controls exposed by the SL2610 system controllers. Match the MFD-created platform devices, use the parent syscon regmap and register each reset provider against the parent DT node. Handle both pulse resets and sticky resets with assert/deassert controls. Signed-off-by: Jisheng Zhang --- drivers/reset/Kconfig | 13 ++ drivers/reset/Makefile | 1 + drivers/reset/reset-sl2610.c | 224 +++++++++++++++++++++++++++++++++++ 3 files changed, 238 insertions(+) create mode 100644 drivers/reset/reset-sl2610.c diff --git a/drivers/reset/Kconfig b/drivers/reset/Kconfig index eda9c698a95f..981d3ec29595 100644 --- a/drivers/reset/Kconfig +++ b/drivers/reset/Kconfig @@ -358,6 +358,19 @@ config RESET_SUNXI help This enables the reset driver for Allwinner SoCs. +config RESET_SL2610 + tristate "Synaptics SL2610 Reset Driver" + depends on ARCH_BERLIN || COMPILE_TEST + depends on OF && HAS_IOMEM + depends on MFD_SL2610_SYSCON + help + Support the reset controllers in the SoC and MCU system control + blocks of Synaptics SL2610 SoCs. Both pulse and sticky reset lines + are supported. + + To compile this driver as a module, choose M here. The module will + be called reset-sl2610. + config RESET_TENSTORRENT_ATLANTIS tristate "Tenstorrent atlantis reset driver" depends on ARCH_TENSTORRENT || COMPILE_TEST diff --git a/drivers/reset/Makefile b/drivers/reset/Makefile index 489fafd6bbe3..d28276a4f2ea 100644 --- a/drivers/reset/Makefile +++ b/drivers/reset/Makefile @@ -42,6 +42,7 @@ obj-$(CONFIG_RESET_SCMI) += reset-scmi.o obj-$(CONFIG_RESET_SIMPLE) += reset-simple.o obj-$(CONFIG_RESET_SKY1) += reset-sky1.o obj-$(CONFIG_RESET_SKY1_AUDSS) += reset-sky1-audss.o +obj-$(CONFIG_RESET_SL2610) += reset-sl2610.o obj-$(CONFIG_RESET_SOCFPGA) += reset-socfpga.o obj-$(CONFIG_RESET_SUNPLUS) += reset-sunplus.o obj-$(CONFIG_RESET_SUNXI) += reset-sunxi.o diff --git a/drivers/reset/reset-sl2610.c b/drivers/reset/reset-sl2610.c new file mode 100644 index 000000000000..dc55a05d29d8 --- /dev/null +++ b/drivers/reset/reset-sl2610.c @@ -0,0 +1,224 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2026 Synaptics Incorporated + * + * Synaptics SL2610 reset driver + * + * Author: Jisheng Zhang + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* SL2610 ACPU subsystem */ +#define SL2610_GBL_PERIFRESET 0x350 +#define SL2610_GBL_PERIFSTICKYRESET 0x360 +#define SL2610_GBL_APBPERIFRESET 0x370 +#define SL2610_GBL_TOPSTICKYRESET 0x378 +#define SL2610_GBL_AVIOSTICKYRESET 0x37c + +/* SL2610 system subsystem */ +#define SL2610_SMGBL_STICKYRST0 0x400 + +#define SL2610_RESET(id, reg, bit, sticky)[id] = { reg, BIT(bit), sticky } + +struct sl2610_reset_cfg { + u32 reg; + u32 bit; + bool sticky; +}; + +struct sl2610_reset_data { + const struct sl2610_reset_cfg *cfgs; + size_t num; +}; + +struct sl2610_reset_priv { + struct regmap *regmap; + const struct sl2610_reset_cfg *cfgs; + struct reset_controller_dev rcdev; +}; + +static inline struct sl2610_reset_priv * +to_sl2610_reset_priv(struct reset_controller_dev *rcdev) +{ + return container_of(rcdev, struct sl2610_reset_priv, rcdev); +} + +static const struct sl2610_reset_cfg sl2610_reset_cfgs[] = { + SL2610_RESET(RST_SOC_SDIO0, SL2610_GBL_PERIFRESET, 2, false), + SL2610_RESET(RST_SOC_USB0, SL2610_GBL_PERIFRESET, 4, false), + SL2610_RESET(RST_SOC_EMMC, SL2610_GBL_PERIFRESET, 5, false), + SL2610_RESET(RST_SOC_GETH0, SL2610_GBL_PERIFRESET, 6, false), + SL2610_RESET(RST_SOC_SDIO1, SL2610_GBL_PERIFRESET, 7, false), + SL2610_RESET(RST_SOC_USB1, SL2610_GBL_PERIFRESET, 8, false), + SL2610_RESET(RST_SOC_GETH1, SL2610_GBL_PERIFRESET, 9, false), + SL2610_RESET(RST_SOC_USB0PHY, SL2610_GBL_PERIFSTICKYRESET, 0, true), + SL2610_RESET(RST_SOC_USB0CORE, SL2610_GBL_PERIFSTICKYRESET, 1, true), + SL2610_RESET(RST_SOC_USB0MAHB, SL2610_GBL_PERIFSTICKYRESET, 2, true), + SL2610_RESET(RST_SOC_USB1PHY, SL2610_GBL_PERIFSTICKYRESET, 3, true), + SL2610_RESET(RST_SOC_USB1CORE, SL2610_GBL_PERIFSTICKYRESET, 4, true), + SL2610_RESET(RST_SOC_USB1MAHB, SL2610_GBL_PERIFSTICKYRESET, 5, true), + SL2610_RESET(RST_SOC_UART0, SL2610_GBL_APBPERIFRESET, 0, false), + SL2610_RESET(RST_SOC_UART1, SL2610_GBL_APBPERIFRESET, 1, false), + SL2610_RESET(RST_SOC_UART2, SL2610_GBL_APBPERIFRESET, 2, false), + SL2610_RESET(RST_SOC_UART3, SL2610_GBL_APBPERIFRESET, 3, false), + SL2610_RESET(RST_SOC_I2C0, SL2610_GBL_APBPERIFRESET, 4, false), + SL2610_RESET(RST_SOC_I2C1, SL2610_GBL_APBPERIFRESET, 5, false), + SL2610_RESET(RST_SOC_SPI0, SL2610_GBL_APBPERIFRESET, 6, false), + SL2610_RESET(RST_SOC_SPI1, SL2610_GBL_APBPERIFRESET, 7, false), + SL2610_RESET(RST_SOC_SPI2, SL2610_GBL_APBPERIFRESET, 8, false), + SL2610_RESET(RST_SOC_SPI3, SL2610_GBL_APBPERIFRESET, 9, false), + SL2610_RESET(RST_SOC_APBTIMERS, SL2610_GBL_APBPERIFRESET, 10, false), + SL2610_RESET(RST_SOC_APBSYSCNT, SL2610_GBL_APBPERIFRESET, 11, false), + SL2610_RESET(RST_SOC_APBWDT, SL2610_GBL_APBPERIFRESET, 12, false), + SL2610_RESET(RST_SOC_APBGPIO, SL2610_GBL_APBPERIFRESET, 13, false), + SL2610_RESET(RST_SOC_APBDMA, SL2610_GBL_APBPERIFRESET, 14, false), + SL2610_RESET(RST_SOC_GPUCORE, SL2610_GBL_TOPSTICKYRESET, 0, true), + SL2610_RESET(RST_SOC_NPUCORE, SL2610_GBL_TOPSTICKYRESET, 1, true), + SL2610_RESET(RST_SOC_AVIOAIOG, SL2610_GBL_AVIOSTICKYRESET, 0, true), + SL2610_RESET(RST_SOC_AVIOVPPG, SL2610_GBL_AVIOSTICKYRESET, 1, true), + SL2610_RESET(RST_SOC_AVIOVIPG, SL2610_GBL_AVIOSTICKYRESET, 2, true), +}; + +static const struct sl2610_reset_cfg sl2610_system_reset_cfgs[] = { + SL2610_RESET(RST_SM_ADCCORE, SL2610_SMGBL_STICKYRST0, 0, true), + SL2610_RESET(RST_SM_ADCPRST, SL2610_SMGBL_STICKYRST0, 1, true), + SL2610_RESET(RST_SM_CAN0PRST, SL2610_SMGBL_STICKYRST0, 2, true), + SL2610_RESET(RST_SM_CAN0SRST, SL2610_SMGBL_STICKYRST0, 3, true), + SL2610_RESET(RST_SM_CAN1PRST, SL2610_SMGBL_STICKYRST0, 4, true), + SL2610_RESET(RST_SM_CAN1SRST, SL2610_SMGBL_STICKYRST0, 5, true), + SL2610_RESET(RST_SM_GPIOPRST, SL2610_SMGBL_STICKYRST0, 6, true), + SL2610_RESET(RST_SM_GPIOSRST, SL2610_SMGBL_STICKYRST0, 7, true), + SL2610_RESET(RST_SM_I2CM0PRST, SL2610_SMGBL_STICKYRST0, 8, true), + SL2610_RESET(RST_SM_I2CM0SRST, SL2610_SMGBL_STICKYRST0, 9, true), + SL2610_RESET(RST_SM_I2CM1PRST, SL2610_SMGBL_STICKYRST0, 10, true), + SL2610_RESET(RST_SM_I2CM1SRST, SL2610_SMGBL_STICKYRST0, 11, true), + SL2610_RESET(RST_SM_I3CPRST, SL2610_SMGBL_STICKYRST0, 12, true), + SL2610_RESET(RST_SM_I3CSRST, SL2610_SMGBL_STICKYRST0, 13, true), + SL2610_RESET(RST_SM_PDMPRST, SL2610_SMGBL_STICKYRST0, 14, true), + SL2610_RESET(RST_SM_PDMSRST, SL2610_SMGBL_STICKYRST0, 15, true), + SL2610_RESET(RST_SM_PVTHSRST, SL2610_SMGBL_STICKYRST0, 16, true), + SL2610_RESET(RST_SM_PVTPRST, SL2610_SMGBL_STICKYRST0, 17, true), + SL2610_RESET(RST_SM_PWMPERIRST, SL2610_SMGBL_STICKYRST0, 18, true), + SL2610_RESET(RST_SM_PWMPRST, SL2610_SMGBL_STICKYRST0, 19, true), + SL2610_RESET(RST_SM_SPIMPRST, SL2610_SMGBL_STICKYRST0, 20, true), + SL2610_RESET(RST_SM_SPIMSRST, SL2610_SMGBL_STICKYRST0, 21, true), + SL2610_RESET(RST_SM_SPISPRST, SL2610_SMGBL_STICKYRST0, 22, true), + SL2610_RESET(RST_SM_SPISSRST, SL2610_SMGBL_STICKYRST0, 23, true), + SL2610_RESET(RST_SM_UART0PRST, SL2610_SMGBL_STICKYRST0, 24, true), + SL2610_RESET(RST_SM_UART0SRST, SL2610_SMGBL_STICKYRST0, 25, true), + SL2610_RESET(RST_SM_UART1PRST, SL2610_SMGBL_STICKYRST0, 26, true), + SL2610_RESET(RST_SM_UART1SRST, SL2610_SMGBL_STICKYRST0, 27, true), + SL2610_RESET(RST_SM_UART2PRST, SL2610_SMGBL_STICKYRST0, 28, true), + SL2610_RESET(RST_SM_UART2SRST, SL2610_SMGBL_STICKYRST0, 29, true), + SL2610_RESET(RST_SM_UART3PRST, SL2610_SMGBL_STICKYRST0, 30, true), + SL2610_RESET(RST_SM_UART3SRST, SL2610_SMGBL_STICKYRST0, 31, true), +}; + +static const struct sl2610_reset_data sl2610_reset_data = { + .cfgs = sl2610_reset_cfgs, + .num = ARRAY_SIZE(sl2610_reset_cfgs), +}; + +static const struct sl2610_reset_data sl2610_system_reset_data = { + .cfgs = sl2610_system_reset_cfgs, + .num = ARRAY_SIZE(sl2610_system_reset_cfgs), +}; + +static int sl2610_reset_assert(struct reset_controller_dev *rcdev, + unsigned long id) +{ + struct sl2610_reset_priv *priv = to_sl2610_reset_priv(rcdev); + const struct sl2610_reset_cfg *cfg = &priv->cfgs[id]; + + if (!cfg->sticky) + return -ENOTSUPP; + + return regmap_clear_bits(priv->regmap, cfg->reg, cfg->bit); +} + +static int sl2610_reset_deassert(struct reset_controller_dev *rcdev, + unsigned long id) +{ + struct sl2610_reset_priv *priv = to_sl2610_reset_priv(rcdev); + const struct sl2610_reset_cfg *cfg = &priv->cfgs[id]; + + if (!cfg->sticky) + return 0; + + return regmap_set_bits(priv->regmap, cfg->reg, cfg->bit); +} + +static int sl2610_reset_reset(struct reset_controller_dev *rcdev, + unsigned long id) +{ + struct sl2610_reset_priv *priv = to_sl2610_reset_priv(rcdev); + const struct sl2610_reset_cfg *cfg = &priv->cfgs[id]; + + if (cfg->sticky) + return -ENOTSUPP; + + return regmap_set_bits(priv->regmap, cfg->reg, cfg->bit); +} + +static const struct reset_control_ops sl2610_reset_ops = { + .reset = sl2610_reset_reset, + .assert = sl2610_reset_assert, + .deassert = sl2610_reset_deassert, +}; + +static int sl2610_reset_probe(struct platform_device *pdev) +{ + struct device_node *parent_np = pdev->dev.parent->of_node; + struct sl2610_reset_priv *priv; + const struct sl2610_reset_data *data = + (void *)platform_get_device_id(pdev)->driver_data; + + priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + + priv->regmap = syscon_node_to_regmap(parent_np); + if (IS_ERR(priv->regmap)) + return PTR_ERR(priv->regmap); + + priv->rcdev.owner = THIS_MODULE; + priv->rcdev.ops = &sl2610_reset_ops; + priv->rcdev.dev = &pdev->dev; + priv->rcdev.of_node = parent_np; + priv->rcdev.nr_resets = data->num; + priv->cfgs = data->cfgs; + + return devm_reset_controller_register(&pdev->dev, &priv->rcdev); +} + +static const struct platform_device_id sl2610_reset_ids[] = { + { "sl2610-soc-reset", (kernel_ulong_t)&sl2610_reset_data }, + { "sl2610-mcu-reset", (kernel_ulong_t)&sl2610_system_reset_data }, + { } +}; +MODULE_DEVICE_TABLE(platform, sl2610_reset_ids); + +static struct platform_driver sl2610_reset_driver = { + .probe = sl2610_reset_probe, + .id_table = sl2610_reset_ids, + .driver = { + .name = "sl2610-reset", + }, +}; +module_platform_driver(sl2610_reset_driver); + +MODULE_AUTHOR("Jisheng Zhang "); +MODULE_DESCRIPTION("Synaptics SL2610 reset controller"); +MODULE_LICENSE("GPL"); -- 2.55.0