Re: [PATCH v3 net-next 5/8] mfd: zl3073x: Add functions to work with register mailboxes

From: Lee Jones
Date: Thu Apr 17 2025 - 12:14:30 EST


On Wed, 16 Apr 2025, Ivan Vecera wrote:

> Registers present in page 10 and higher are called mailbox type
> registers. Each page represents a mailbox and is used to read and write
> configuration of particular object (dpll, output, reference & synth).
>
> The mailbox page contains mask register that is used to select an index of
> requested object to work with and semaphore register to indicate what
> operation is requested.
>
> The rest of registers in the particular register page are latch
> registers that are filled by the firmware during read operation or by
> the driver prior write operation.
>
> For read operation the driver...
> 1) ... updates the mailbox mask register with index of particular object
> 2) ... sets the mailbox semaphore register read bit
> 3) ... waits for the semaphore register read bit to be cleared by FW
> 4) ... reads the configuration from latch registers
>
> For write operation the driver...
> 1) ... writes the requested configuration to latch registers
> 2) ... sets the mailbox mask register for the DPLL to be updated
> 3) ... sets the mailbox semaphore register bit for the write operation
> 4) ... waits for the semaphore register bit to be cleared by FW
>
> Add functions to read and write mailboxes for all supported object types.
>
> All these functions as well as functions accessing mailbox latch registers
> (zl3073x_mb_* functions) have to be called with zl3073x_dev->mailbox_lock
> held and a caller is responsible to take this lock.
>
> Signed-off-by: Ivan Vecera <ivecera@xxxxxxxxxx>
> v1->v3:
> * dropped ZL3073X_MB_OP macro usage
> ---
> drivers/mfd/zl3073x-core.c | 232 +++++++++++++++++++++++
> include/linux/mfd/zl3073x.h | 12 ++
> include/linux/mfd/zl3073x_regs.h | 304 +++++++++++++++++++++++++++++++
> 3 files changed, 548 insertions(+)

> +/*
> + * Mailbox operations
> + */
> +int zl3073x_mb_dpll_read(struct zl3073x_dev *zldev, u8 index);
> +int zl3073x_mb_dpll_write(struct zl3073x_dev *zldev, u8 index);
> +int zl3073x_mb_output_read(struct zl3073x_dev *zldev, u8 index);
> +int zl3073x_mb_output_write(struct zl3073x_dev *zldev, u8 index);
> +int zl3073x_mb_ref_read(struct zl3073x_dev *zldev, u8 index);
> +int zl3073x_mb_ref_write(struct zl3073x_dev *zldev, u8 index);
> +int zl3073x_mb_synth_read(struct zl3073x_dev *zldev, u8 index);
> +int zl3073x_mb_synth_write(struct zl3073x_dev *zldev, u8 index);

Why aren't these being placed into drivers/mailbox?

--
Lee Jones [李琼斯]