From nobody Tue Feb 10 17:30:57 2026 Received: from mail-yx1-f51.google.com (mail-yx1-f51.google.com [74.125.224.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 071F934C808 for ; Fri, 30 Jan 2026 17:50:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.224.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769795437; cv=none; b=Qq1bHS353Rp4OXoYJ6t3xENyfVbw9j/vMdT35SMSD/cRmgMnLAHIuz1lw8ulQE+num4DmUto/hU4cDJvJNqTbv6IKuOzD/AvuRa8S+NOaH8xIsI1f8xYCE96zEnvs1Fa3slXWDfqA03UG3GfR5UqbZdSzDqdF5gfPEDSNjoyvhQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769795437; c=relaxed/simple; bh=MAiv0fduuWkme5u2DYpSYMKrpbzI/a1tGOAyMy7f51E=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Y8a66/aS4RDwbbjFKIZqOdR6nUzXkUDuzMh5kHKo0l/A63nWLVT1ZYr2yIi6uu2RR0hJre9X/csNtdCN736Pw49x1WHk2yar69bvXOOwqYlD9PyKipckW+XlAIJoe3WAmGGghlgOfX92a7Lb1sjmHb9vjLIRWJ9zze4lfk+OuvI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=oss.tenstorrent.com; spf=pass smtp.mailfrom=tenstorrent.com; dkim=pass (2048-bit key) header.d=tenstorrent.com header.i=@tenstorrent.com header.b=Gd43cvRI; arc=none smtp.client-ip=74.125.224.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=oss.tenstorrent.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tenstorrent.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tenstorrent.com header.i=@tenstorrent.com header.b="Gd43cvRI" Received: by mail-yx1-f51.google.com with SMTP id 956f58d0204a3-649ae700ba0so585987d50.1 for ; Fri, 30 Jan 2026 09:50:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tenstorrent.com; s=google; t=1769795434; x=1770400234; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=UZMMTz+zEnEaVc0tT9uLbJMYSdAwAyWPF8xhmiLxTpo=; b=Gd43cvRI/p8sLbzTxc//Lf1C+MkIFgu2385eOIrOZQxLw61KFg6gesIXexw7zw64sW xxfniKHanDxme4JePpi9d035aOM3zRgwvWAAujb8LjNondgGVjKi/9NGfG/nCmbPar9m T6nGXoMa/UMcw5wGRe3Spg5skakjIGffAzh79yFQo/TdT3+xB+tvuXQaSKuegyzo0yy3 hFYsR9lcPmU+eVOoHcSLBgSCCZHIX6MctCRHep6A4YFFiy4bEfkooKpVqgROTcmbwubQ yywfJBazjLNFTtGjyYLBSqN4tXcPWQHXmuF/rILtrVuw8JXQMECwqneNk8xRO0PTxJQl Xz5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769795434; x=1770400234; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=UZMMTz+zEnEaVc0tT9uLbJMYSdAwAyWPF8xhmiLxTpo=; b=djTTKx+m6L0rcvUrVXb6Mcw4qcITFu4QZI9UmQr9he/eyHL4ZtayWyS5hRc0YUuhPd CT5Pk8zHnI9k1KfMXUfcoQ0tKNSxMB1wDjP1J6SwPIXLjIQS3vNRktYPvqhyxdj5ovU4 ueVB7u3QqTkCPdjGrb2VyLC2ev53y0pIzb0nl5jiU8nwIGgpPsJg2Gu/fcpMHlfB2vUQ 1Ruc/aD6nD2FN/Jsn+mvDnOgOYv/Rz7qRtrtFtyC5ESVLKjq2jfJcOg6vBC3IZEcljD4 Z9GRxDT6d9wpa1eCAFJpiY2D8itaONDKl0cZDaH/E9jPCR/TkN8shS1h95v8kwej/tzw tiDA== X-Forwarded-Encrypted: i=1; AJvYcCUqa+AeXYN3diDt0XIsWgLaGA+D83VbBfcqhCJRUWfyehUK0m1rOyhmmJ4dQWCgrnXvFphSjVIgVFM/x/A=@vger.kernel.org X-Gm-Message-State: AOJu0YxpPvdfxhq6BLxyULPUApavKd4cze8DJZA4ERkzstr/giD4HCU/ bPP5C7H1E/qbESVBSc8kuNeITPKUJQ5Z2AqVe3obeDPSSA4DbV5A1rTRYRV3YRprsjk= X-Gm-Gg: AZuq6aLydeQU0jCfOgmyA3M8mslBxuFwNOynXjOSoo1BNQ/46QCuC+20ecPh5Zpxbpr WxwyzjTvyMfS8OXm/ll/zPxo26mQPPoDrR6ZMhoCi5gL+5oBkWfy+jLzZLz3Ul8WIFsEYG9Ebk8 8JgVSThGuvIn5G3NAV+uw/iTUFWDfKStdyBrFSamwPYlIw2NwIWk0UT5B5s838SYT72aNqL2EC+ S6vvj8WtTO+ZdtDifrdk9MIxO0SwlNURccV6Yxsdm0KXXmPn8pCe0mNNovr/JLqXq8k7fH/otLQ 9GrOsTFL9yYvptrrduacs29rP1x+xZosHExC7abqfqmHWZ66os85UEUBg5Htou8p97Cue1bkjUA JzklfwX84LUOJuAjT/KJnO01IRkXtsIfPfxXIIXW0g2ZiGI1uGTG/6ZHip/dcf3oEI/ZSvF626B rR953Y11P0Zeugn+gFoM+TpEtDRgT7YnNSP1eNT7zYv6RSJ17tvS+FamjoOT+s1k+x+tLTyRcNG Z+NDn+/YPcxAzQ= X-Received: by 2002:a05:690c:c513:b0:794:25c:2cc4 with SMTP id 00721157ae682-7949df4f9d2mr69480157b3.31.1769795434000; Fri, 30 Jan 2026 09:50:34 -0800 (PST) Received: from [192.168.5.15] ([68.95.197.245]) by smtp.gmail.com with ESMTPSA id 956f58d0204a3-649960e0965sm3939108d50.13.2026.01.30.09.50.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Jan 2026 09:50:33 -0800 (PST) From: Anirudh Srinivasan Date: Fri, 30 Jan 2026 11:50:22 -0600 Subject: [PATCH v4 2/3] reset: tenstorrent: Add reset controller for Atlantis Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260130-atlantis-clocks-v4-2-46de52d52924@oss.tenstorrent.com> References: <20260130-atlantis-clocks-v4-0-46de52d52924@oss.tenstorrent.com> In-Reply-To: <20260130-atlantis-clocks-v4-0-46de52d52924@oss.tenstorrent.com> To: Drew Fustini , Joel Stanley , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Michael Turquette , Stephen Boyd , Anirudh Srinivasan , Philipp Zabel Cc: linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, joel@jms.id.au, fustini@kernel.org, mpe@kernel.org, mpe@oss.tenstorrent.com, npiggin@oss.tenstorrent.com, agross@kernel.org, agross@oss.tenstorrent.com, bmasney@redhat.com X-Mailer: b4 0.14.3 Adds Atlantis Reset Controller and auxiliary device definitions for reset to share same regmap interface as prcm (clock controller). This version of the reset controller driver covers resets from the RCPU prcm. Signed-off-by: Anirudh Srinivasan Reviewed-by: Philipp Zabel --- MAINTAINERS | 2 + drivers/reset/Kconfig | 11 ++ drivers/reset/Makefile | 1 + drivers/reset/reset-tenstorrent-atlantis.c | 160 +++++++++++++++++++++++++= ++++ include/soc/tenstorrent/atlantis-prcm.h | 31 ++++++ 5 files changed, 205 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 0fc7bc6d0458..0cde1774567d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -22537,7 +22537,9 @@ T: git https://github.com/tenstorrent/linux.git F: Documentation/devicetree/bindings/clock/tenstorrent,atlantis-prcm.yaml F: Documentation/devicetree/bindings/riscv/tenstorrent.yaml F: arch/riscv/boot/dts/tenstorrent/ +F: drivers/reset/reset-tenstorrent-atlantis.c F: include/dt-bindings/clock/tenstorrent,atlantis-prcm.h +F: include/soc/tenstorrent/ =20 RISC-V THEAD SoC SUPPORT M: Drew Fustini diff --git a/drivers/reset/Kconfig b/drivers/reset/Kconfig index 6e5d6deffa7d..cade77717492 100644 --- a/drivers/reset/Kconfig +++ b/drivers/reset/Kconfig @@ -324,6 +324,17 @@ config RESET_SUNXI help This enables the reset driver for Allwinner SoCs. =20 +config RESET_TENSTORRENT_ATLANTIS + tristate "Tenstorrent atlantis reset driver" + depends on ARCH_TENSTORRENT || COMPILE_TEST + select AUXILIARY_BUS + default ARCH_TENSTORRENT + help + This enables the driver for the reset controller + present in the Tenstorrent Atlantis SoC. + Enable this option to be able to use hardware + resets on Atalantis based systems. + config RESET_TH1520 tristate "T-HEAD TH1520 reset controller" depends on ARCH_THEAD || COMPILE_TEST diff --git a/drivers/reset/Makefile b/drivers/reset/Makefile index 9c3e484dfd81..a31959da0a88 100644 --- a/drivers/reset/Makefile +++ b/drivers/reset/Makefile @@ -41,6 +41,7 @@ obj-$(CONFIG_RESET_SOCFPGA) +=3D reset-socfpga.o obj-$(CONFIG_RESET_SPACEMIT) +=3D reset-spacemit.o obj-$(CONFIG_RESET_SUNPLUS) +=3D reset-sunplus.o obj-$(CONFIG_RESET_SUNXI) +=3D reset-sunxi.o +obj-$(CONFIG_RESET_TENSTORRENT_ATLANTIS) +=3D reset-tenstorrent-atlantis.o obj-$(CONFIG_RESET_TH1520) +=3D reset-th1520.o obj-$(CONFIG_RESET_TI_SCI) +=3D reset-ti-sci.o obj-$(CONFIG_RESET_TI_SYSCON) +=3D reset-ti-syscon.o diff --git a/drivers/reset/reset-tenstorrent-atlantis.c b/drivers/reset/res= et-tenstorrent-atlantis.c new file mode 100644 index 000000000000..6fe9143ad76c --- /dev/null +++ b/drivers/reset/reset-tenstorrent-atlantis.c @@ -0,0 +1,160 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Tenstorrent Atlantis PRCM Reset Driver + * + * Copyright (c) 2026 Tenstorrent + */ + +#include +#include +#include +#include +#include + +struct atlantis_reset_data { + u8 bit; + u16 reg; + bool active_low; +}; + +struct atlantis_reset_controller_data { + const struct atlantis_reset_data *reset_data; + size_t count; +}; + +struct atlantis_reset_controller { + struct reset_controller_dev rcdev; + const struct atlantis_reset_controller_data *data; + struct regmap *regmap; +}; + +#define to_atlantis_reset_controller(_rcdev) \ + container_of((_rcdev), struct atlantis_reset_controller, rcdev) + +#define RESET_DATA(_reg, _bit, _active_low) \ + { \ + .bit =3D _bit, .reg =3D _reg, .active_low =3D _active_low, \ + } + +static const struct atlantis_reset_data atlantis_rcpu_resets[] =3D { + [RST_SMNDMA0] =3D RESET_DATA(RCPU_BLK_RST_REG, 0, true), + [RST_SMNDMA1] =3D RESET_DATA(RCPU_BLK_RST_REG, 1, true), + [RST_WDT0] =3D RESET_DATA(RCPU_BLK_RST_REG, 2, true), + [RST_WDT1] =3D RESET_DATA(RCPU_BLK_RST_REG, 3, true), + [RST_TMR] =3D RESET_DATA(RCPU_BLK_RST_REG, 4, true), + [RST_PVTC] =3D RESET_DATA(RCPU_BLK_RST_REG, 12, true), + [RST_PMU] =3D RESET_DATA(RCPU_BLK_RST_REG, 13, true), + [RST_MAILBOX] =3D RESET_DATA(RCPU_BLK_RST_REG, 14, true), + [RST_SPACC] =3D RESET_DATA(RCPU_BLK_RST_REG, 26, true), + [RST_OTP] =3D RESET_DATA(RCPU_BLK_RST_REG, 28, true), + [RST_TRNG] =3D RESET_DATA(RCPU_BLK_RST_REG, 29, true), + [RST_CRC] =3D RESET_DATA(RCPU_BLK_RST_REG, 30, true), + [RST_QSPI] =3D RESET_DATA(LSIO_BLK_RST_REG, 0, true), + [RST_I2C0] =3D RESET_DATA(LSIO_BLK_RST_REG, 1, true), + [RST_I2C1] =3D RESET_DATA(LSIO_BLK_RST_REG, 2, true), + [RST_I2C2] =3D RESET_DATA(LSIO_BLK_RST_REG, 3, true), + [RST_I2C3] =3D RESET_DATA(LSIO_BLK_RST_REG, 4, true), + [RST_I2C4] =3D RESET_DATA(LSIO_BLK_RST_REG, 5, true), + [RST_UART0] =3D RESET_DATA(LSIO_BLK_RST_REG, 6, true), + [RST_UART1] =3D RESET_DATA(LSIO_BLK_RST_REG, 7, true), + [RST_UART2] =3D RESET_DATA(LSIO_BLK_RST_REG, 8, true), + [RST_UART3] =3D RESET_DATA(LSIO_BLK_RST_REG, 9, true), + [RST_UART4] =3D RESET_DATA(LSIO_BLK_RST_REG, 10, true), + [RST_SPI0] =3D RESET_DATA(LSIO_BLK_RST_REG, 11, true), + [RST_SPI1] =3D RESET_DATA(LSIO_BLK_RST_REG, 12, true), + [RST_SPI2] =3D RESET_DATA(LSIO_BLK_RST_REG, 13, true), + [RST_SPI3] =3D RESET_DATA(LSIO_BLK_RST_REG, 14, true), + [RST_GPIO] =3D RESET_DATA(LSIO_BLK_RST_REG, 15, true), + [RST_CAN0] =3D RESET_DATA(LSIO_BLK_RST_REG, 17, true), + [RST_CAN1] =3D RESET_DATA(LSIO_BLK_RST_REG, 18, true), + [RST_I2S0] =3D RESET_DATA(LSIO_BLK_RST_REG, 19, true), + [RST_I2S1] =3D RESET_DATA(LSIO_BLK_RST_REG, 20, true), + +}; + +static const struct atlantis_reset_controller_data atlantis_rcpu_reset_dat= a =3D { + .reset_data =3D atlantis_rcpu_resets, + .count =3D ARRAY_SIZE(atlantis_rcpu_resets), +}; + +static int atlantis_reset_update(struct reset_controller_dev *rcdev, + unsigned long id, bool assert) +{ + unsigned int val; + struct atlantis_reset_controller *rst =3D + to_atlantis_reset_controller(rcdev); + const struct atlantis_reset_data *data =3D &rst->data->reset_data[id]; + unsigned int mask =3D BIT(data->bit); + struct regmap *regmap =3D rst->regmap; + + if (data->active_low ^ assert) + val =3D mask; + else + val =3D 0; + + return regmap_update_bits(regmap, data->reg, mask, val); +} + +static int atlantis_reset_assert(struct reset_controller_dev *rcdev, + unsigned long id) +{ + return atlantis_reset_update(rcdev, id, true); +} + +static int atlantis_reset_deassert(struct reset_controller_dev *rcdev, + unsigned long id) +{ + return atlantis_reset_update(rcdev, id, false); +} + +static const struct reset_control_ops atlantis_reset_control_ops =3D { + .assert =3D atlantis_reset_assert, + .deassert =3D atlantis_reset_deassert, +}; + +static int +atlantis_reset_controller_register(struct device *dev, + struct atlantis_reset_controller *controller) +{ + struct reset_controller_dev *rcdev =3D &controller->rcdev; + + rcdev->ops =3D &atlantis_reset_control_ops; + rcdev->owner =3D THIS_MODULE; + rcdev->of_node =3D dev->of_node; + rcdev->nr_resets =3D controller->data->count; + + return devm_reset_controller_register(dev, &controller->rcdev); +} +static int atlantis_reset_probe(struct auxiliary_device *adev, + const struct auxiliary_device_id *id) +{ + struct atlantis_prcm_adev *rdev =3D to_atlantis_prcm_adev(adev); + struct atlantis_reset_controller *controller; + struct device *dev =3D &adev->dev; + + controller =3D devm_kzalloc(dev, sizeof(*controller), GFP_KERNEL); + if (!controller) + return -ENOMEM; + controller->data =3D + (const struct atlantis_reset_controller_data *)id->driver_data; + controller->regmap =3D rdev->regmap; + + return atlantis_reset_controller_register(dev, controller); +} + +static const struct auxiliary_device_id atlantis_reset_ids[] =3D { + { .name =3D "atlantis_prcm.rcpu-reset", + .driver_data =3D (kernel_ulong_t)&atlantis_rcpu_reset_data }, + {}, +}; +MODULE_DEVICE_TABLE(auxiliary, atlantis_reset_ids); + +static struct auxiliary_driver atlantis_reset_driver =3D { + .probe =3D atlantis_reset_probe, + .id_table =3D atlantis_reset_ids, +}; +module_auxiliary_driver(atlantis_reset_driver); + +MODULE_AUTHOR("Anirudh Srinivasan "); +MODULE_DESCRIPTION("Atlantis PRCM reset controller driver"); +MODULE_LICENSE("GPL"); diff --git a/include/soc/tenstorrent/atlantis-prcm.h b/include/soc/tenstorr= ent/atlantis-prcm.h new file mode 100644 index 000000000000..841516cbefd9 --- /dev/null +++ b/include/soc/tenstorrent/atlantis-prcm.h @@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */ +/* + * Shared definitions for Atlantis PRCM Clock and Reset Drivers + * + * Copyright (c) 2026 Tenstorrent + */ +#ifndef __SOC_ATLANTIS_PRCM_H__ +#define __SOC_ATLANTIS_PRCM_H__ + +#include +#include + +struct atlantis_prcm_adev { + struct auxiliary_device adev; + struct regmap *regmap; +}; + +static inline struct atlantis_prcm_adev * +to_atlantis_prcm_adev(struct auxiliary_device *adev) +{ + return container_of(adev, struct atlantis_prcm_adev, adev); +} + +/* RCPU Reset Register Offsets */ +#define RCPU_BLK_RST_REG 0x001c +#define LSIO_BLK_RST_REG 0x0020 +#define HSIO_BLK_RST_REG 0x000c +#define PCIE_SUBS_RST_REG 0x0000 +#define MM_RSTN_REG 0x0014 + +#endif --=20 2.43.0