diff mbox series

[U-Boot,v1,1/4] arm: socfpga: stratix10: Add macros for mailbox's arguments

Message ID 1538759539-3646-2-git-send-email-chee.hong.ang@intel.com
State Superseded
Delegated to: Marek Vasut
Headers show
Series Stratix10 FPGA reconfiguration support | expand

Commit Message

Ang, Chee Hong Oct. 5, 2018, 5:12 p.m. UTC
From: "Ang, Chee Hong" <chee.hong.ang@intel.com>

Add macros for specifying number of arguments in mailbox command.

Signed-off-by: Ang, Chee Hong <chee.hong.ang@intel.com>
---
 arch/arm/mach-socfpga/include/mach/mailbox_s10.h | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Marek Vasut Oct. 5, 2018, 9:21 p.m. UTC | #1
On 10/05/2018 07:12 PM, chee.hong.ang@intel.com wrote:
> From: "Ang, Chee Hong" <chee.hong.ang@intel.com>
> 
> Add macros for specifying number of arguments in mailbox command.
> 
> Signed-off-by: Ang, Chee Hong <chee.hong.ang@intel.com>
> ---
>  arch/arm/mach-socfpga/include/mach/mailbox_s10.h | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/arch/arm/mach-socfpga/include/mach/mailbox_s10.h b/arch/arm/mach-socfpga/include/mach/mailbox_s10.h
> index 660df35..94f60aa 100644
> --- a/arch/arm/mach-socfpga/include/mach/mailbox_s10.h
> +++ b/arch/arm/mach-socfpga/include/mach/mailbox_s10.h
> @@ -107,6 +107,12 @@ enum ALT_SDM_MBOX_RESP_CODE {
>  #define RECONFIG_STATUS_PIN_STATUS			2
>  #define RECONFIG_STATUS_SOFTFUNC_STATUS			3
>  
> +/* Macros for specifying number of arguments in mailbox command */
> +#define MBOX_NUM_ARGS(n, b)				((n & 0xFF) << b)

(n) and (b)

> +#define MBOX_DIRECT_COUNT(n)				MBOX_NUM_ARGS(n, 0)

(n) , fix globally

> +#define MBOX_ARG_DESC_COUNT(n)				MBOX_NUM_ARGS(n, 8)
> +#define MBOX_RESP_DESC_COUNT(n)				MBOX_NUM_ARGS(n, 16)
> +
>  #define MBOX_CFGSTAT_STATE_IDLE				0x00000000
>  #define MBOX_CFGSTAT_STATE_CONFIG			0x10000000
>  #define MBOX_CFGSTAT_STATE_FAILACK			0x08000000
>
diff mbox series

Patch

diff --git a/arch/arm/mach-socfpga/include/mach/mailbox_s10.h b/arch/arm/mach-socfpga/include/mach/mailbox_s10.h
index 660df35..94f60aa 100644
--- a/arch/arm/mach-socfpga/include/mach/mailbox_s10.h
+++ b/arch/arm/mach-socfpga/include/mach/mailbox_s10.h
@@ -107,6 +107,12 @@  enum ALT_SDM_MBOX_RESP_CODE {
 #define RECONFIG_STATUS_PIN_STATUS			2
 #define RECONFIG_STATUS_SOFTFUNC_STATUS			3
 
+/* Macros for specifying number of arguments in mailbox command */
+#define MBOX_NUM_ARGS(n, b)				((n & 0xFF) << b)
+#define MBOX_DIRECT_COUNT(n)				MBOX_NUM_ARGS(n, 0)
+#define MBOX_ARG_DESC_COUNT(n)				MBOX_NUM_ARGS(n, 8)
+#define MBOX_RESP_DESC_COUNT(n)				MBOX_NUM_ARGS(n, 16)
+
 #define MBOX_CFGSTAT_STATE_IDLE				0x00000000
 #define MBOX_CFGSTAT_STATE_CONFIG			0x10000000
 #define MBOX_CFGSTAT_STATE_FAILACK			0x08000000