From: Alex Elder <elder@riscstar.com>
To: sboyd@kernel.org, bmasney+clk@redhat.com,
jbrunet+clk@baylibre.com, robh@kernel.org, krzk+dt@kernel.org,
conor+dt@kernel.org, p.zabel@pengutronix.de,
andersson@kernel.org, konradybcio@kernel.org,
abelvesa@kernel.org, arnd@arndb.de, gregkh@linuxfoundation.org
Cc: daniel@riscstar.com, mohd.anwar@oss.qualcomm.com,
lorenzo.bianconi@oss.qualcomm.com, fabrice.gasnier@foss.st.com,
alexandre.torgue@foss.st.com, marex@nabladev.com,
changhuang.liang@starfivetech.com, linux-clk@vger.kernel.org,
devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH v5 2/4] reset: toshiba: introduce a TC9564 reset driver
Date: Thu, 3 Dec 2026 14:09:45 -0600 [thread overview]
Message-ID: <20261203200948.1595470-3-elder@riscstar.com> (raw)
In-Reply-To: <20261203200948.1595470-1-elder@riscstar.com>
Define a new auxiliary device driver that manages resets implemented
by the Toshiba TC9564 SoC. The TC9564 clock driver will create the
reset device, which will bind to this driver.
The reset controller uses two registers to control a set of 13 resets
that can be asserted or deasserted. Only a subset of the resets can
currently be managed.
The MMIO region containing the two control registers is mapped by
the clock controller driver, and passed via the auxiliary device's
platform data.
Some common definitions are added to <linux/soc/qcom/tc9563.h> to
specify the interface between the clock and reset drivers.
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
Co-developed-by: Daniel Thompson <daniel@riscstar.com>
Signed-off-by: Daniel Thompson <daniel@riscstar.com>
Signed-off-by: Alex Elder <elder@riscstar.com>
---
v5: - Code related to the I2C and PCIE resets (including code that
warned if they were used) has been removed.
- The Kconfig now selects AUXILIARY_BUS
- Philipp's Reviewed-by tag has been added.
MAINTAINERS | 1 +
drivers/reset/Kconfig | 8 ++
drivers/reset/Makefile | 1 +
drivers/reset/reset-tc9564.c | 165 ++++++++++++++++++++++++++++++++
include/linux/soc/qcom/tc9563.h | 9 ++
5 files changed, 184 insertions(+)
create mode 100644 drivers/reset/reset-tc9564.c
diff --git a/MAINTAINERS b/MAINTAINERS
index 5d9fc5c5fbcd8..936d60a27dd3c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -28812,6 +28812,7 @@ M: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
M: Alex Elder <elder@kernel.org>
M: Daniel Thompson <danielt@kernel.org>
S: Maintained
+F: drivers/reset/reset-tc9564.c
F: include/dt-bindings/reset/toshiba,tc9564.h
TOSHIBA WMI HOTKEYS DRIVER
diff --git a/drivers/reset/Kconfig b/drivers/reset/Kconfig
index 673bca1e594e0..f8ef663ac5b79 100644
--- a/drivers/reset/Kconfig
+++ b/drivers/reset/Kconfig
@@ -369,6 +369,14 @@ config RESET_SUNXI
help
This enables the reset driver for Allwinner SoCs.
+config RESET_TC9564
+ tristate "Toshiba TC9564 reset controller driver"
+ select AUXILIARY_BUS
+ help
+ This enables support for the reset controller embedded in the
+ Toshiba TC9564 SoC. The device is created by the TC9564 clock
+ controller driver as an auxiliary device.
+
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 2fe527a7be8e1..2144095c14b3d 100644
--- a/drivers/reset/Makefile
+++ b/drivers/reset/Makefile
@@ -47,6 +47,7 @@ obj-$(CONFIG_RESET_SKY1_AUDSS) += reset-sky1-audss.o
obj-$(CONFIG_RESET_SOCFPGA) += reset-socfpga.o
obj-$(CONFIG_RESET_SUNPLUS) += reset-sunplus.o
obj-$(CONFIG_RESET_SUNXI) += reset-sunxi.o
+obj-$(CONFIG_RESET_TC9564) += reset-tc9564.o
obj-$(CONFIG_RESET_TENSTORRENT_ATLANTIS) += reset-tenstorrent-atlantis.o
obj-$(CONFIG_RESET_TH1520) += reset-th1520.o
obj-$(CONFIG_RESET_TI_SCI) += reset-ti-sci.o
diff --git a/drivers/reset/reset-tc9564.c b/drivers/reset/reset-tc9564.c
new file mode 100644
index 0000000000000..218be6dbbb2a3
--- /dev/null
+++ b/drivers/reset/reset-tc9564.c
@@ -0,0 +1,165 @@
+// SPDX-License-Identifier: GPL-2.0-only
+
+/*
+ * Copyright (C) 2026 by RISCstar Solutions Corporation. All rights reserved.
+ */
+
+#include <linux/auxiliary_bus.h>
+#include <linux/bits.h>
+#include <linux/io.h>
+#include <linux/module.h>
+#include <linux/reset-controller.h>
+#include <linux/slab.h>
+#include <linux/soc/qcom/tc9563.h>
+
+#include <dt-bindings/reset/toshiba,tc9564.h>
+
+/*
+ * Two registers implement the bits that control whether our resets are
+ * asserted. These offsets are relative to the mapped memory passed
+ * as platform data from the TC9564 clock driver.
+ */
+#define RESET0_OFFSET 0x4
+#define RESET1_OFFSET 0xc
+
+struct tc9564_reset {
+ void __iomem *regs; /* Mapped registers base address */
+ spinlock_t lock; /* Protects register updates */
+ struct reset_controller_dev rcdev;
+};
+
+struct reset_init {
+ u16 offset; /* Control register offset (0x4 or 0xc) */
+ u16 bit; /* Bit in the control register (0-31) */
+};
+
+static const struct reset_init reset_init[] = {
+ [TC9564_RST_MAC0_MAC] = {
+ .offset = RESET0_OFFSET,
+ .bit = 7,
+ },
+ [TC9564_RST_MSIGEN] = {
+ .offset = RESET0_OFFSET,
+ .bit = 18,
+ },
+ [TC9564_RST_MAC0_PMA] = {
+ .offset = RESET0_OFFSET,
+ .bit = 30,
+ },
+ [TC9564_RST_MAC0_XPCS] = {
+ .offset = RESET0_OFFSET,
+ .bit = 31,
+ },
+ [TC9564_RST_MAC1_MAC] = {
+ .offset = RESET1_OFFSET,
+ .bit = 7,
+ },
+ [TC9564_RST_MAC1_PMA] = {
+ .offset = RESET1_OFFSET,
+ .bit = 30,
+ },
+ [TC9564_RST_MAC1_XPCS] = {
+ .offset = RESET1_OFFSET,
+ .bit = 31,
+ },
+};
+#define RESET_COUNT ARRAY_SIZE(reset_init)
+
+static int reset_update(struct reset_controller_dev *rcdev,
+ unsigned long id, bool assert)
+{
+ struct tc9564_reset *reset = dev_get_drvdata(rcdev->dev);
+ const struct reset_init *init = &reset_init[id];
+ void __iomem *reg = reset->regs + init->offset;
+ u32 mask = BIT(init->bit);
+ u32 val;
+
+ guard(spinlock_irqsave)(&reset->lock);
+
+ val = readl(reg);
+ if (assert)
+ val |= mask;
+ else
+ val &= ~mask;
+ writel(val, reg);
+
+ return 0;
+}
+
+static int reset_assert(struct reset_controller_dev *rcdev, unsigned long id)
+{
+ return reset_update(rcdev, id, true);
+}
+
+static int reset_deassert(struct reset_controller_dev *rcdev, unsigned long id)
+{
+ return reset_update(rcdev, id, false);
+}
+
+static int reset_status(struct reset_controller_dev *rcdev, unsigned long id)
+{
+ struct tc9564_reset *reset = dev_get_drvdata(rcdev->dev);
+ const struct reset_init *init = &reset_init[id];
+ void __iomem *reg = reset->regs + init->offset;
+
+ return readl(reg) & BIT(init->bit) ? 1 : 0;
+}
+
+static const struct reset_control_ops reset_control_ops = {
+ .assert = reset_assert,
+ .deassert = reset_deassert,
+ .status = reset_status,
+};
+
+static int tc9564_reset_probe(struct auxiliary_device *adev,
+ const struct auxiliary_device_id *id)
+{
+ struct reset_controller_dev *rcdev;
+ struct tc9564_aux_data *aux_data;
+ struct device *dev = &adev->dev;
+ struct tc9564_reset *reset;
+ int ret;
+
+ aux_data = dev_get_platdata(dev);
+ if (!aux_data)
+ return dev_err_probe(dev, -EINVAL, "no register pointer\n");
+
+ reset = devm_kzalloc_obj(dev, *reset);
+ if (!reset)
+ return -ENOMEM;
+
+ reset->regs = aux_data->regs;
+ spin_lock_init(&reset->lock);
+
+ /* This needs to be set before registering */
+ dev_set_drvdata(dev, reset);
+
+ rcdev = &reset->rcdev;
+ rcdev->ops = &reset_control_ops;
+ rcdev->owner = THIS_MODULE;
+ rcdev->dev = dev;
+ rcdev->of_node = dev_of_node(dev);
+ rcdev->nr_resets = RESET_COUNT;
+
+ ret = devm_reset_controller_register(dev, rcdev);
+ if (ret)
+ return dev_err_probe(dev, ret,
+ "failed to register reset controller\n");
+ return 0;
+}
+
+static const struct auxiliary_device_id tc9564_reset_ids[] = {
+ { TC9564_CLK_MODNAME "." TC9564_RESET_DEV_NAME },
+ { }
+};
+MODULE_DEVICE_TABLE(auxiliary, tc9564_reset_ids);
+
+static struct auxiliary_driver tc9564_reset_driver = {
+ .name = KBUILD_MODNAME,
+ .probe = tc9564_reset_probe,
+ .id_table = tc9564_reset_ids,
+};
+module_auxiliary_driver(tc9564_reset_driver);
+
+MODULE_DESCRIPTION("Toshiba TC9564 Reset Driver");
+MODULE_LICENSE("GPL");
diff --git a/include/linux/soc/qcom/tc9563.h b/include/linux/soc/qcom/tc9563.h
index 086f37a40d801..f778ce9ae2e7c 100644
--- a/include/linux/soc/qcom/tc9563.h
+++ b/include/linux/soc/qcom/tc9563.h
@@ -16,4 +16,13 @@
#define TC9563_GPIO_CONFIG TC9563_GPIO_EN0_OFFSET
#define TC9563_RESET_GPIO TC9563_GPIO_OUT0_OFFSET
+/* Name of the clock driver and the reset auxiliary device it creates */
+#define TC9564_CLK_MODNAME "clk_tc9564"
+#define TC9564_RESET_DEV_NAME "tc9564-reset"
+
+/* Platform data passed to the TC9564 reset auxiliary driver */
+struct tc9564_aux_data {
+ void __iomem *regs;
+};
+
#endif /* __QCOM_TC9563_H */
--
2.53.0
next prev parent reply other threads:[~2026-12-03 20:09 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 20:09 [PATCH v5 0/4] clk: tc9564: introduce clock and reset drivers Alex Elder
2026-12-03 20:09 ` [PATCH v5 1/4] dt-bindings: toshiba: introduce toshiba,tc9564-clock.yaml Alex Elder
2026-12-03 20:09 ` Alex Elder [this message]
2026-12-03 20:09 ` [PATCH v5 3/4] clk: toshiba: introduce a TC9564 clock driver Alex Elder
2026-12-03 20:09 ` [PATCH v5 4/4] arm64: dts: qcom: qcs6490-rb3gen2: add TC9564 clock node Alex Elder
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261203200948.1595470-3-elder@riscstar.com \
--to=elder@riscstar.com \
--cc=abelvesa@kernel.org \
--cc=alexandre.torgue@foss.st.com \
--cc=andersson@kernel.org \
--cc=arnd@arndb.de \
--cc=bmasney+clk@redhat.com \
--cc=changhuang.liang@starfivetech.com \
--cc=conor+dt@kernel.org \
--cc=daniel@riscstar.com \
--cc=devicetree@vger.kernel.org \
--cc=fabrice.gasnier@foss.st.com \
--cc=gregkh@linuxfoundation.org \
--cc=jbrunet+clk@baylibre.com \
--cc=konradybcio@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lorenzo.bianconi@oss.qualcomm.com \
--cc=marex@nabladev.com \
--cc=mohd.anwar@oss.qualcomm.com \
--cc=p.zabel@pengutronix.de \
--cc=robh@kernel.org \
--cc=sboyd@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox