Re: [PATCH v2 07/14] mfd: zl3073x: Add components versions register defs

Ivan Vecera
2025-04-11T11:19:52Z

On 10. 04. 25 7:50 odp., Andy Shevchenko wrote:
> On Wed, Apr 9, 2025 at 5:43 PM Ivan Vecera <ivecera@redhat.com> wrote:
>>
>> Add register definitions for components versions and report them
>> during probe.
>
> JFYI: disabling regmap lock (independently of having an additional one
> or not) is not recommended. With that you actually disable the useful
> debugging feature of regmap, your device will not be present in the
> (regmap) debugfs after that.
>

I will follow Andrew's recommendation:

1st regmap for direct registers (pages 0-9) with config like:

regmap_config {
...
.lock = mutex_lock,
.unlock = mutex_unlock,
.lock_arg = &zl3073x_dev->lock
...
};

2nd regmap for indirect registers (mailboxes) (pages 10-15) with
disabled locking:

regmap_config {
...
.disable_lock = true,
...
};

For direct registers the lock will be handled automatically by regmap 1.
For indirect registers the lock will be managed explicitly by the driver
to ensure atomic access to mailbox.

The range for regmap 1: (registers 0x000-0x4FF)
regmap_range_cfg {
.range_min = 0,
.range_max = 10 * 128 - 1, /* 10 pages, 128 registers each */
.selector_reg = 0x7f, /* page selector at each page */
.selector_shift = 0, /* no shift in page selector */
.selector_mask = GENMASK(3, 0), /* 4 bits for page sel */
.window_start = 0, /* 128 regs from 0x00-0x7f */
.window_len = 128,
};

The range for regmap 2: (registers 0x500-0x77F)
regmap_range_cfg {
.range_min = 10 * 128,
.range_max = 15 * 128 - 1, /* 5 pages, 128 registers each */
.selector_reg = 0x7f, /* page selector at each page */
.selector_shift = 0, /* no shift in page selector */
.selector_mask = GENMASK(3, 0), /* 4 bits for page sel */
.window_start = 0, /* 128 regs from 0x00-0x7f */
.window_len = 128,
};

Is it now OK?

Thanks,
Ivan