Re: [PATCH v2 2/2] mailbox: mpfs: read the system controller's status

From: Conor.Dooley
Date: Sat Nov 19 2022 - 16:56:00 EST


On 18/11/2022 22:20, Conor Dooley wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>
> From: Conor Dooley <conor.dooley@xxxxxxxxxxxxx>
>
> Some services explicitly return an error code in their response, but
> others rely on the system controller to set a status in its status
> register. The meaning of the bits varies based on what service is
> requested, so pass it back up to the driver that requested the service
> in the first place. The field in the message struct already existed, but
> was unused until now.
>
> If the system controller is busy, in which case we should never actually
> be in the interrupt handler, or if the service fails the mailbox itself
> should not be read. Callers should check the status before operating on
> the response.
>
> Fixes: 83d7b1560810 ("mbox: add polarfire soc system controller mailbox")
> Signed-off-by: Conor Dooley <conor.dooley@xxxxxxxxxxxxx>
> ---
> drivers/mailbox/mailbox-mpfs.c | 31 +++++++++++++++++++++++++++++--
> 1 file changed, 29 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mailbox/mailbox-mpfs.c b/drivers/mailbox/mailbox-mpfs.c
> index cfacb3f320a6..6b99abac0b11 100644
> --- a/drivers/mailbox/mailbox-mpfs.c
> +++ b/drivers/mailbox/mailbox-mpfs.c
> @@ -2,7 +2,7 @@
> /*
> * Microchip PolarFire SoC (MPFS) system controller/mailbox controller driver
> *
> - * Copyright (c) 2020 Microchip Corporation. All rights reserved.
> + * Copyright (c) 2020-2022 Microchip Corporation. All rights reserved.
> *
> * Author: Conor Dooley <conor.dooley@xxxxxxxxxxxxx>
> *
> @@ -23,6 +23,8 @@
> #define MAILBOX_REG_OFFSET 0x800u
> #define MSS_SYS_MAILBOX_DATA_OFFSET 0u
> #define SCB_MASK_WIDTH 16u
> +#define SCB_STATUS_SHIFT 16u
> +#define SCB_STATUS_MASK GENMASK(31, SCB_STATUS_SHIFT)

*sigh* these macros aren't needed & generate some -Wmacro-redefined issues.
I'll do a v3 in a few days.