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

Conor.Dooley at microchip.com Conor.Dooley at microchip.com
Sat Nov 19 13:55:44 PST 2022


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 at microchip.com>
> 
> 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 at microchip.com>
> ---
>  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 at microchip.com>
>   *
> @@ -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.



More information about the linux-riscv mailing list