* [PATCH v7 1/4] reset: imx8mp-audiomix: Drop unneeded macros
2026-01-26 16:21 [PATCH v7 0/4] Add support for i.MX8ULP's SIM LPAV Laurentiu Mihalcea
@ 2026-01-26 16:22 ` Laurentiu Mihalcea
2026-01-26 16:22 ` [PATCH v7 2/4] reset: imx8mp-audiomix: Switch to using regmap API Laurentiu Mihalcea
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Laurentiu Mihalcea @ 2026-01-26 16:22 UTC (permalink / raw)
To: Philipp Zabel, Shawn Guo, Fabio Estevam, Daniel Baluta, Frank Li
Cc: imx, linux-arm-kernel, linux-kernel, Pengutronix Kernel Team
From: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
The macros defining the mask values for the EARC, EARC PHY resets,
and the DSP RUN_STALL signal can be dropped as they are not and will
not be used anywhere else except to set the value of the "mask" field
from "struct imx8mp_reset_map". In this particular case, based on the
name of the "mask" field, you can already deduce what these values are
for, which is why defining macros for them doesn't offer any new
information, nor does it help with the code readability.
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
---
drivers/reset/reset-imx8mp-audiomix.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/drivers/reset/reset-imx8mp-audiomix.c b/drivers/reset/reset-imx8mp-audiomix.c
index eceb37ff5dc5..acfa92b15329 100644
--- a/drivers/reset/reset-imx8mp-audiomix.c
+++ b/drivers/reset/reset-imx8mp-audiomix.c
@@ -6,6 +6,7 @@
#include <dt-bindings/reset/imx8mp-reset-audiomix.h>
#include <linux/auxiliary_bus.h>
+#include <linux/bits.h>
#include <linux/device.h>
#include <linux/io.h>
#include <linux/module.h>
@@ -14,11 +15,7 @@
#include <linux/reset-controller.h>
#define IMX8MP_AUDIOMIX_EARC_RESET_OFFSET 0x200
-#define IMX8MP_AUDIOMIX_EARC_RESET_MASK BIT(0)
-#define IMX8MP_AUDIOMIX_EARC_PHY_RESET_MASK BIT(1)
-
#define IMX8MP_AUDIOMIX_DSP_RUNSTALL_OFFSET 0x108
-#define IMX8MP_AUDIOMIX_DSP_RUNSTALL_MASK BIT(5)
struct imx8mp_reset_map {
unsigned int offset;
@@ -29,17 +26,17 @@ struct imx8mp_reset_map {
static const struct imx8mp_reset_map reset_map[] = {
[IMX8MP_AUDIOMIX_EARC_RESET] = {
.offset = IMX8MP_AUDIOMIX_EARC_RESET_OFFSET,
- .mask = IMX8MP_AUDIOMIX_EARC_RESET_MASK,
+ .mask = BIT(0),
.active_low = true,
},
[IMX8MP_AUDIOMIX_EARC_PHY_RESET] = {
.offset = IMX8MP_AUDIOMIX_EARC_RESET_OFFSET,
- .mask = IMX8MP_AUDIOMIX_EARC_PHY_RESET_MASK,
+ .mask = BIT(1),
.active_low = true,
},
[IMX8MP_AUDIOMIX_DSP_RUNSTALL] = {
.offset = IMX8MP_AUDIOMIX_DSP_RUNSTALL_OFFSET,
- .mask = IMX8MP_AUDIOMIX_DSP_RUNSTALL_MASK,
+ .mask = BIT(5),
.active_low = false,
},
};
--
2.43.0
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH v7 2/4] reset: imx8mp-audiomix: Switch to using regmap API
2026-01-26 16:21 [PATCH v7 0/4] Add support for i.MX8ULP's SIM LPAV Laurentiu Mihalcea
2026-01-26 16:22 ` [PATCH v7 1/4] reset: imx8mp-audiomix: Drop unneeded macros Laurentiu Mihalcea
@ 2026-01-26 16:22 ` Laurentiu Mihalcea
2026-01-27 7:25 ` Daniel Baluta
2026-01-26 16:22 ` [PATCH v7 3/4] reset: imx8mp-audiomix: Extend the driver usage Laurentiu Mihalcea
2026-01-26 16:22 ` [PATCH v7 4/4] reset: imx8mp-audiomix: Support i.MX8ULP SIM LPAV Laurentiu Mihalcea
3 siblings, 1 reply; 6+ messages in thread
From: Laurentiu Mihalcea @ 2026-01-26 16:22 UTC (permalink / raw)
To: Philipp Zabel, Shawn Guo, Fabio Estevam, Daniel Baluta, Frank Li
Cc: imx, linux-arm-kernel, linux-kernel, Pengutronix Kernel Team
From: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
Switch to using the regmap API to allow performing register operations
under the same lock. This is needed for cases such as i.MX8ULP's SIM LPAV
where clock gating, reset control and MUX-ing is performed via the same
register (i.e. SYSCTRL0) and different subsystem APIs.
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
---
drivers/reset/reset-imx8mp-audiomix.c | 92 +++++++++++++++++----------
1 file changed, 57 insertions(+), 35 deletions(-)
diff --git a/drivers/reset/reset-imx8mp-audiomix.c b/drivers/reset/reset-imx8mp-audiomix.c
index acfa92b15329..f6152c0cc5ff 100644
--- a/drivers/reset/reset-imx8mp-audiomix.c
+++ b/drivers/reset/reset-imx8mp-audiomix.c
@@ -12,6 +12,7 @@
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_address.h>
+#include <linux/regmap.h>
#include <linux/reset-controller.h>
#define IMX8MP_AUDIOMIX_EARC_RESET_OFFSET 0x200
@@ -43,8 +44,7 @@ static const struct imx8mp_reset_map reset_map[] = {
struct imx8mp_audiomix_reset {
struct reset_controller_dev rcdev;
- spinlock_t lock; /* protect register read-modify-write cycle */
- void __iomem *base;
+ struct regmap *regmap;
};
static struct imx8mp_audiomix_reset *to_imx8mp_audiomix_reset(struct reset_controller_dev *rcdev)
@@ -56,26 +56,14 @@ static int imx8mp_audiomix_update(struct reset_controller_dev *rcdev,
unsigned long id, bool assert)
{
struct imx8mp_audiomix_reset *priv = to_imx8mp_audiomix_reset(rcdev);
- void __iomem *reg_addr = priv->base;
- unsigned int mask, offset, active_low;
- unsigned long reg, flags;
+ unsigned int mask, offset, active_low, val;
mask = reset_map[id].mask;
offset = reset_map[id].offset;
active_low = reset_map[id].active_low;
+ val = (active_low ^ assert) ? mask : ~mask;
- spin_lock_irqsave(&priv->lock, flags);
-
- reg = readl(reg_addr + offset);
- if (active_low ^ assert)
- reg |= mask;
- else
- reg &= ~mask;
- writel(reg, reg_addr + offset);
-
- spin_unlock_irqrestore(&priv->lock, flags);
-
- return 0;
+ return regmap_update_bits(priv->regmap, offset, mask, val);
}
static int imx8mp_audiomix_reset_assert(struct reset_controller_dev *rcdev,
@@ -95,6 +83,52 @@ static const struct reset_control_ops imx8mp_audiomix_reset_ops = {
.deassert = imx8mp_audiomix_reset_deassert,
};
+static const struct regmap_config regmap_config = {
+ .reg_bits = 32,
+ .val_bits = 32,
+ .reg_stride = 4,
+};
+
+/* assumption: registered only if not using parent regmap */
+static void imx8mp_audiomix_reset_iounmap(void *data)
+{
+ void __iomem *base = (void __iomem *)data;
+
+ iounmap(base);
+}
+
+static int imx8mp_audiomix_reset_get_regmap(struct imx8mp_audiomix_reset *priv)
+{
+ void __iomem *base;
+ struct device *dev;
+ int ret;
+
+ dev = priv->rcdev.dev;
+
+ /* try to use the parent's regmap */
+ priv->regmap = dev_get_regmap(dev->parent, NULL);
+ if (priv->regmap)
+ return 0;
+
+ /* ... if that's not possible then initialize the regmap right now */
+ base = of_iomap(dev->parent->of_node, 0);
+ if (!base)
+ return dev_err_probe(dev, -ENOMEM, "failed to iomap address space\n");
+
+ ret = devm_add_action_or_reset(dev,
+ imx8mp_audiomix_reset_iounmap,
+ (void __force *)base);
+ if (ret)
+ return dev_err_probe(dev, ret, "failed to register action\n");
+
+ priv->regmap = devm_regmap_init_mmio(dev, base, ®map_config);
+ if (IS_ERR(priv->regmap))
+ return dev_err_probe(dev, PTR_ERR(priv->regmap),
+ "failed to initialize regmap\n");
+
+ return 0;
+}
+
static int imx8mp_audiomix_reset_probe(struct auxiliary_device *adev,
const struct auxiliary_device_id *id)
{
@@ -106,36 +140,25 @@ static int imx8mp_audiomix_reset_probe(struct auxiliary_device *adev,
if (!priv)
return -ENOMEM;
- spin_lock_init(&priv->lock);
-
priv->rcdev.owner = THIS_MODULE;
priv->rcdev.nr_resets = ARRAY_SIZE(reset_map);
priv->rcdev.ops = &imx8mp_audiomix_reset_ops;
priv->rcdev.of_node = dev->parent->of_node;
priv->rcdev.dev = dev;
priv->rcdev.of_reset_n_cells = 1;
- priv->base = of_iomap(dev->parent->of_node, 0);
- if (!priv->base)
- return -ENOMEM;
dev_set_drvdata(dev, priv);
+ ret = imx8mp_audiomix_reset_get_regmap(priv);
+ if (ret)
+ return dev_err_probe(dev, ret, "failed to get regmap\n");
+
ret = devm_reset_controller_register(dev, &priv->rcdev);
if (ret)
- goto out_unmap;
+ return dev_err_probe(dev, ret,
+ "failed to register reset controller\n");
return 0;
-
-out_unmap:
- iounmap(priv->base);
- return ret;
-}
-
-static void imx8mp_audiomix_reset_remove(struct auxiliary_device *adev)
-{
- struct imx8mp_audiomix_reset *priv = dev_get_drvdata(&adev->dev);
-
- iounmap(priv->base);
}
static const struct auxiliary_device_id imx8mp_audiomix_reset_ids[] = {
@@ -148,7 +171,6 @@ MODULE_DEVICE_TABLE(auxiliary, imx8mp_audiomix_reset_ids);
static struct auxiliary_driver imx8mp_audiomix_reset_driver = {
.probe = imx8mp_audiomix_reset_probe,
- .remove = imx8mp_audiomix_reset_remove,
.id_table = imx8mp_audiomix_reset_ids,
};
--
2.43.0
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH v7 2/4] reset: imx8mp-audiomix: Switch to using regmap API
2026-01-26 16:22 ` [PATCH v7 2/4] reset: imx8mp-audiomix: Switch to using regmap API Laurentiu Mihalcea
@ 2026-01-27 7:25 ` Daniel Baluta
0 siblings, 0 replies; 6+ messages in thread
From: Daniel Baluta @ 2026-01-27 7:25 UTC (permalink / raw)
To: Laurentiu Mihalcea
Cc: Philipp Zabel, Shawn Guo, Fabio Estevam, Daniel Baluta, Frank Li,
imx, linux-arm-kernel, linux-kernel, Pengutronix Kernel Team
On Mon, Jan 26, 2026 at 6:23 PM Laurentiu Mihalcea
<laurentiumihalcea111@gmail.com> wrote:
>
> From: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
>
> Switch to using the regmap API to allow performing register operations
> under the same lock. This is needed for cases such as i.MX8ULP's SIM LPAV
> where clock gating, reset control and MUX-ing is performed via the same
> register (i.e. SYSCTRL0) and different subsystem APIs.
>
> Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
> Reviewed-by: Frank Li <Frank.Li@nxp.com>
> Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v7 3/4] reset: imx8mp-audiomix: Extend the driver usage
2026-01-26 16:21 [PATCH v7 0/4] Add support for i.MX8ULP's SIM LPAV Laurentiu Mihalcea
2026-01-26 16:22 ` [PATCH v7 1/4] reset: imx8mp-audiomix: Drop unneeded macros Laurentiu Mihalcea
2026-01-26 16:22 ` [PATCH v7 2/4] reset: imx8mp-audiomix: Switch to using regmap API Laurentiu Mihalcea
@ 2026-01-26 16:22 ` Laurentiu Mihalcea
2026-01-26 16:22 ` [PATCH v7 4/4] reset: imx8mp-audiomix: Support i.MX8ULP SIM LPAV Laurentiu Mihalcea
3 siblings, 0 replies; 6+ messages in thread
From: Laurentiu Mihalcea @ 2026-01-26 16:22 UTC (permalink / raw)
To: Philipp Zabel, Shawn Guo, Fabio Estevam, Daniel Baluta, Frank Li
Cc: imx, linux-arm-kernel, linux-kernel, Pengutronix Kernel Team
From: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
Switch to per-device reset map to allow reusing the driver for other NXP
block control IPs.
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
---
drivers/reset/reset-imx8mp-audiomix.c | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
diff --git a/drivers/reset/reset-imx8mp-audiomix.c b/drivers/reset/reset-imx8mp-audiomix.c
index f6152c0cc5ff..00eee528a2d2 100644
--- a/drivers/reset/reset-imx8mp-audiomix.c
+++ b/drivers/reset/reset-imx8mp-audiomix.c
@@ -24,7 +24,12 @@ struct imx8mp_reset_map {
bool active_low;
};
-static const struct imx8mp_reset_map reset_map[] = {
+struct imx8mp_reset_info {
+ const struct imx8mp_reset_map *map;
+ int num_lines;
+};
+
+static const struct imx8mp_reset_map imx8mp_reset_map[] = {
[IMX8MP_AUDIOMIX_EARC_RESET] = {
.offset = IMX8MP_AUDIOMIX_EARC_RESET_OFFSET,
.mask = BIT(0),
@@ -42,9 +47,15 @@ static const struct imx8mp_reset_map reset_map[] = {
},
};
+static const struct imx8mp_reset_info imx8mp_reset_info = {
+ .map = imx8mp_reset_map,
+ .num_lines = ARRAY_SIZE(imx8mp_reset_map),
+};
+
struct imx8mp_audiomix_reset {
struct reset_controller_dev rcdev;
struct regmap *regmap;
+ const struct imx8mp_reset_map *map;
};
static struct imx8mp_audiomix_reset *to_imx8mp_audiomix_reset(struct reset_controller_dev *rcdev)
@@ -56,6 +67,7 @@ static int imx8mp_audiomix_update(struct reset_controller_dev *rcdev,
unsigned long id, bool assert)
{
struct imx8mp_audiomix_reset *priv = to_imx8mp_audiomix_reset(rcdev);
+ const struct imx8mp_reset_map *reset_map = priv->map;
unsigned int mask, offset, active_low, val;
mask = reset_map[id].mask;
@@ -132,16 +144,20 @@ static int imx8mp_audiomix_reset_get_regmap(struct imx8mp_audiomix_reset *priv)
static int imx8mp_audiomix_reset_probe(struct auxiliary_device *adev,
const struct auxiliary_device_id *id)
{
+ const struct imx8mp_reset_info *rinfo;
struct imx8mp_audiomix_reset *priv;
struct device *dev = &adev->dev;
int ret;
+ rinfo = (void *)id->driver_data;
+
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
return -ENOMEM;
priv->rcdev.owner = THIS_MODULE;
- priv->rcdev.nr_resets = ARRAY_SIZE(reset_map);
+ priv->map = rinfo->map;
+ priv->rcdev.nr_resets = rinfo->num_lines;
priv->rcdev.ops = &imx8mp_audiomix_reset_ops;
priv->rcdev.of_node = dev->parent->of_node;
priv->rcdev.dev = dev;
@@ -164,6 +180,7 @@ static int imx8mp_audiomix_reset_probe(struct auxiliary_device *adev,
static const struct auxiliary_device_id imx8mp_audiomix_reset_ids[] = {
{
.name = "clk_imx8mp_audiomix.reset",
+ .driver_data = (kernel_ulong_t)&imx8mp_reset_info,
},
{ }
};
--
2.43.0
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH v7 4/4] reset: imx8mp-audiomix: Support i.MX8ULP SIM LPAV
2026-01-26 16:21 [PATCH v7 0/4] Add support for i.MX8ULP's SIM LPAV Laurentiu Mihalcea
` (2 preceding siblings ...)
2026-01-26 16:22 ` [PATCH v7 3/4] reset: imx8mp-audiomix: Extend the driver usage Laurentiu Mihalcea
@ 2026-01-26 16:22 ` Laurentiu Mihalcea
3 siblings, 0 replies; 6+ messages in thread
From: Laurentiu Mihalcea @ 2026-01-26 16:22 UTC (permalink / raw)
To: Philipp Zabel, Shawn Guo, Fabio Estevam, Daniel Baluta, Frank Li
Cc: imx, linux-arm-kernel, linux-kernel, Pengutronix Kernel Team
From: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
Support i.MX8ULP's SIM LPAV by adding its reset map definition.
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
---
drivers/reset/reset-imx8mp-audiomix.c | 45 +++++++++++++++++++++++++++
1 file changed, 45 insertions(+)
diff --git a/drivers/reset/reset-imx8mp-audiomix.c b/drivers/reset/reset-imx8mp-audiomix.c
index 00eee528a2d2..b7fa3110f282 100644
--- a/drivers/reset/reset-imx8mp-audiomix.c
+++ b/drivers/reset/reset-imx8mp-audiomix.c
@@ -3,6 +3,7 @@
* Copyright 2024 NXP
*/
+#include <dt-bindings/reset/fsl,imx8ulp-sim-lpav.h>
#include <dt-bindings/reset/imx8mp-reset-audiomix.h>
#include <linux/auxiliary_bus.h>
@@ -18,6 +19,8 @@
#define IMX8MP_AUDIOMIX_EARC_RESET_OFFSET 0x200
#define IMX8MP_AUDIOMIX_DSP_RUNSTALL_OFFSET 0x108
+#define IMX8ULP_SIM_LPAV_SYSCTRL0_OFFSET 0x8
+
struct imx8mp_reset_map {
unsigned int offset;
unsigned int mask;
@@ -52,6 +55,44 @@ static const struct imx8mp_reset_info imx8mp_reset_info = {
.num_lines = ARRAY_SIZE(imx8mp_reset_map),
};
+static const struct imx8mp_reset_map imx8ulp_reset_map[] = {
+ [IMX8ULP_SIM_LPAV_HIFI4_DSP_DBG_RST] = {
+ .offset = IMX8ULP_SIM_LPAV_SYSCTRL0_OFFSET,
+ .mask = BIT(25),
+ .active_low = false,
+ },
+ [IMX8ULP_SIM_LPAV_HIFI4_DSP_RST] = {
+ .offset = IMX8ULP_SIM_LPAV_SYSCTRL0_OFFSET,
+ .mask = BIT(16),
+ .active_low = false,
+ },
+ [IMX8ULP_SIM_LPAV_HIFI4_DSP_STALL] = {
+ .offset = IMX8ULP_SIM_LPAV_SYSCTRL0_OFFSET,
+ .mask = BIT(13),
+ .active_low = false,
+ },
+ [IMX8ULP_SIM_LPAV_DSI_RST_BYTE_N] = {
+ .offset = IMX8ULP_SIM_LPAV_SYSCTRL0_OFFSET,
+ .mask = BIT(5),
+ .active_low = true,
+ },
+ [IMX8ULP_SIM_LPAV_DSI_RST_ESC_N] = {
+ .offset = IMX8ULP_SIM_LPAV_SYSCTRL0_OFFSET,
+ .mask = BIT(4),
+ .active_low = true,
+ },
+ [IMX8ULP_SIM_LPAV_DSI_RST_DPI_N] = {
+ .offset = IMX8ULP_SIM_LPAV_SYSCTRL0_OFFSET,
+ .mask = BIT(3),
+ .active_low = true,
+ },
+};
+
+static const struct imx8mp_reset_info imx8ulp_reset_info = {
+ .map = imx8ulp_reset_map,
+ .num_lines = ARRAY_SIZE(imx8ulp_reset_map),
+};
+
struct imx8mp_audiomix_reset {
struct reset_controller_dev rcdev;
struct regmap *regmap;
@@ -182,6 +223,10 @@ static const struct auxiliary_device_id imx8mp_audiomix_reset_ids[] = {
.name = "clk_imx8mp_audiomix.reset",
.driver_data = (kernel_ulong_t)&imx8mp_reset_info,
},
+ {
+ .name = "clk_imx8ulp_sim_lpav.reset",
+ .driver_data = (kernel_ulong_t)&imx8ulp_reset_info,
+ },
{ }
};
MODULE_DEVICE_TABLE(auxiliary, imx8mp_audiomix_reset_ids);
--
2.43.0
^ permalink raw reply [flat|nested] 6+ messages in thread