[PATCH v3 5/7] reset: Add BCMBCA block resets through the PMB

Philipp Zabel p.zabel at pengutronix.de
Fri Nov 6 03:59:13 PST 2026


On Fr, 2026-11-06 at 09:26 +0100, Linus Walleij wrote:
> Implement the BCM6846 XRDP reset group through the shared PMB regmap.
> Assert all blocks before releasing any of them, preserving the vendor
> reset masks and ordering. Provide the independent PVTMON acquisition
> reset as well. Serialize complete sequences and hold blocks in reset
> on failure.
> 
> Power domain consumers must enable their domains before requesting a
> reset.

Before requesting or before (de)asserting?

> Zone transitions belong to the PMB power domain subdriver.

Why mention it here?

> Signed-off-by: Linus Walleij <linusw at kernel.org>
> ---
>  MAINTAINERS                      |   1 +
>  drivers/reset/Kconfig            |  13 +++
>  drivers/reset/Makefile           |   1 +
>  drivers/reset/reset-bcmbca-pmb.c | 243 +++++++++++++++++++++++++++++++++++++++
>  4 files changed, 258 insertions(+)
> 
[...]
> diff --git a/drivers/reset/reset-bcmbca-pmb.c b/drivers/reset/reset-bcmbca-pmb.c
> new file mode 100644
> index 000000000000..e8e079c9ccb5
> --- /dev/null
> +++ b/drivers/reset/reset-bcmbca-pmb.c
> @@ -0,0 +1,243 @@
[...]
> +struct bcmbca_pmb_reset_group {
> +	const char *name;
> +	int (*reset)(struct bcmbca_pmb_reset *rst,
> +		     const struct bcmbca_pmb_reset_group *group);

This is again an unnecessary indirection.

[...]
> +static int bcmbca_pmb_reset_sequence(struct bcmbca_pmb_reset *rst,
> +				     const struct bcmbca_pmb_reset_group *group)
> +{
> +	const struct bcmbca_pmb_reset_block *block;
> +	enum {
> +		PASS_ASSERT,
> +		PASS_DEASSERT,
> +	} pass;
> +	unsigned int i;
> +	int ret;
> +
> +	if (!group->num_blocks)
> +		return -EINVAL;
> +
> +	/* Assert every block before releasing any of them. */
> +	for (pass = PASS_ASSERT; pass <= PASS_DEASSERT; pass++) {
> +		for (i = 0; i < group->num_blocks; i++) {
> +			block = &group->blocks[i];
> +			ret = regmap_update_bits(rst->regmap,
> +						 BCMBCA_PMB_REG(block->bus, block->device,
> +								block->offset), block->mask,
> +						 pass == PASS_DEASSERT ? block->deassert_value :
> +						 block->assert_value);
> +			if (ret)
> +				goto cleanup;
> +		}
> +		if (pass == PASS_ASSERT && group->assert_hold_us)
> +			usleep_range(group->assert_hold_us, group->assert_hold_us * 2);
> +	}
> +cleanup:
> +	if (ret) {
> +		dev_err(rst->rcdev.dev, "%s %s failed at PMB bus %u device %u: %d\n",
> +			group->name, str_assert_deassert(pass == PASS_ASSERT),
> +			block->bus, block->device, ret);
> +		bcmbca_pmb_reset_cleanup(rst, group);
> +	}
> +	return ret;
> +}
> +
> +static int bcmbca_pmb_reset(struct reset_controller_dev *rcdev, unsigned long id)
> +{
> +	struct bcmbca_pmb_reset *rst = container_of(rcdev, struct bcmbca_pmb_reset, rcdev);
> +	const struct bcmbca_pmb_reset_group *group;
> +
> +	if (id >= rst->variant->num_groups)
> +		return -EINVAL;

Since .nr_resets is set to rst->variant->num_groups, this was already
checked by fwnode_reset_simple_xlate() before the reset controller was
created.

> +	group = &rst->variant->groups[id];
> +	if (!group->reset)
> +		return -EINVAL;
> +
> +	guard(mutex)(&rst->lock);
> +	return group->reset(rst, group);

Call bcmbca_pmb_reset_sequence() directly or fold it in here.

> +}
> +
> +static const struct reset_control_ops bcmbca_pmb_reset_ops = {
> +	.reset = bcmbca_pmb_reset,
> +};
> +
> +static int bcmbca_pmb_reset_probe(struct platform_device *pdev)
> +{
> +	struct device *dev = &pdev->dev;
> +	struct regmap *regmap = dev_get_regmap(dev->parent, NULL);
> +	struct bcmbca_pmb_reset *rst;
> +
> +	if (!regmap)
> +		return -ENODEV;
> +
> +	rst = devm_kzalloc(dev, sizeof(*rst), GFP_KERNEL);
> +	if (!rst)
> +		return -ENOMEM;
> +	rst->variant = device_get_match_data(dev);
> +	if (!rst->variant)
> +		return -ENODEV;
> +	rst->regmap = regmap;
> +	mutex_init(&rst->lock);
> +	rst->rcdev.owner = THIS_MODULE;
> +	rst->rcdev.dev = dev;
> +	rst->rcdev.ops = &bcmbca_pmb_reset_ops;
> +	rst->rcdev.of_node = dev->of_node;
> +	rst->rcdev.of_reset_n_cells = 1;

Do not set of_reset_n_cells, .of_xlate isn't set either.

reset_controller_register() sets .fwnode_xlate =
fwnode_reset_simple_xlate() and fwnode_reset_n_cells = 1 by default,
of_reset_n_cells will be ignored in this case.

> +	rst->rcdev.nr_resets = rst->variant->num_groups;
> +	return devm_reset_controller_register(dev, &rst->rcdev);
> +}
> +
> +static const struct of_device_id bcmbca_pmb_reset_of_match[] = {
> +	{ .compatible = "brcm,bcm6846-pmb-reset", .data = &bcm6846_pmb_variant },
> +	{ }
> +};
> +MODULE_DEVICE_TABLE(of, bcmbca_pmb_reset_of_match);
> +
> +static struct platform_driver bcmbca_pmb_reset_driver = {
> +	.probe = bcmbca_pmb_reset_probe,
> +	.driver = {
> +		.name = "brcm-pmb-reset",
> +		.of_match_table = bcmbca_pmb_reset_of_match,
> +		.suppress_bind_attrs = true,

This is new. Why?

regards
Philipp



More information about the linux-arm-kernel mailing list