diff options
-rw-r--r-- | arch/arm/mach-socfpga/include/mach/rsu.h | 13 | ||||
-rw-r--r-- | arch/arm/mach-socfpga/mailbox_s10.c | 10 | ||||
-rw-r--r-- | arch/arm/mach-socfpga/rsu.c | 13 | ||||
-rw-r--r-- | arch/arm/mach-socfpga/rsu_s10.c | 3 |
4 files changed, 22 insertions, 17 deletions
diff --git a/arch/arm/mach-socfpga/include/mach/rsu.h b/arch/arm/mach-socfpga/include/mach/rsu.h index 98f3234a92..4a55ae2c3b 100644 --- a/arch/arm/mach-socfpga/include/mach/rsu.h +++ b/arch/arm/mach-socfpga/include/mach/rsu.h @@ -7,6 +7,8 @@ #define __RSU_H__ #include <asm/types.h> +#include <linux/bitops.h> +#include <linux/bitfield.h> /* RSU Error Codes */ #define EINTF 1 @@ -24,15 +26,16 @@ #define EWRPROT 13 #define EARGS 14 -/* RSU Notify Bitmasks */ -#define RSU_NOTIFY_IGNORE_STAGE (1 << 18) -#define RSU_NOTIFY_CLEAR_ERROR_STATUS (1 << 17) -#define RSU_NOTIFY_RESET_RETRY_COUNTER (1 << 16) - /* RSU Version Bitmasks */ +#define RSU_VERSION_ERR_MASK GENMASK(31, 16) #define RSU_VERSION_DCMF_MASK GENMASK(7, 0) #define RSU_VERSION_ACMF_MASK GENMASK(15, 8) +/* Macros for extracting RSU version fields */ +#define RSU_VERSION_ERROR_SOURCE(v) FIELD_GET(RSU_VERSION_ERR_MASK, (v)) +#define RSU_VERSION_ACMF_VERSION(v) FIELD_GET(RSU_VERSION_ACMF_MASK, (v)) +#define RSU_VERSION_DCMF_VERSION(v) FIELD_GET(RSU_VERSION_DCMF_MASK, (v)) + /** * struct rsu_status_info - firmware status log info structure * @current_image:address of image currently running in flash diff --git a/arch/arm/mach-socfpga/mailbox_s10.c b/arch/arm/mach-socfpga/mailbox_s10.c index fe1cc50100..add2952ee8 100644 --- a/arch/arm/mach-socfpga/mailbox_s10.c +++ b/arch/arm/mach-socfpga/mailbox_s10.c @@ -26,8 +26,6 @@ DECLARE_GLOBAL_DATA_PTR; #define MBOX_WRITE_CMD_BUF(data, cin) \ MBOX_WRITEL(data, MBOX_CMD_BUF + ((cin) * sizeof(u32))) -#define RSU_VERSION_ACMF_ONE 0x00000100 - static __always_inline int mbox_polling_resp(u32 rout) { u32 rin; @@ -366,8 +364,8 @@ int mbox_rsu_status(u32 *resp_buf, u32 resp_buf_len) return ret; if (info->retry_counter != -1) - if (!(info->version & RSU_VERSION_ACMF_MASK)) - info->version |= RSU_VERSION_ACMF_ONE; + if (!RSU_VERSION_ACMF_VERSION(info->version)) + info->version |= FIELD_PREP(RSU_VERSION_ACMF_MASK, 1); return ret; } @@ -392,8 +390,8 @@ int __secure mbox_rsu_status_psci(u32 *resp_buf, u32 resp_buf_len) return ret; if (info->retry_counter != -1) - if (!(info->version & RSU_VERSION_ACMF_MASK)) - info->version |= RSU_VERSION_ACMF_ONE; + if (!RSU_VERSION_ACMF_VERSION(info->version)) + info->version |= FIELD_PREP(RSU_VERSION_ACMF_MASK, 1); return ret; } diff --git a/arch/arm/mach-socfpga/rsu.c b/arch/arm/mach-socfpga/rsu.c index 63f8e9a2a7..b481baf434 100644 --- a/arch/arm/mach-socfpga/rsu.c +++ b/arch/arm/mach-socfpga/rsu.c @@ -9,6 +9,11 @@ #include <asm/arch/rsu.h> #include <asm/arch/rsu_misc.h> +/* RSU Notify Bitmasks */ +#define RSU_NOTIFY_IGNORE_STAGE BIT(18) +#define RSU_NOTIFY_CLEAR_ERROR_STATUS BIT(17) +#define RSU_NOTIFY_RESET_RETRY_COUNTER BIT(16) + struct rsu_ll_intf *ll_intf; /** @@ -620,7 +625,7 @@ int rsu_clear_error_status(void) if (ret < 0) return ret; - if (!(info.version & RSU_VERSION_ACMF_MASK)) + if (!RSU_VERSION_ACMF_VERSION(info.version)) return -ELOWLEVEL; arg = RSU_NOTIFY_IGNORE_STAGE | RSU_NOTIFY_CLEAR_ERROR_STATUS; @@ -648,10 +653,8 @@ int rsu_reset_retry_counter(void) if (ret < 0) return ret; - if (!(info.version & RSU_VERSION_DCMF_MASK)) - return -ELOWLEVEL; - - if (!(info.version & RSU_VERSION_ACMF_MASK)) + if (!RSU_VERSION_ACMF_VERSION(info.version) || + !RSU_VERSION_DCMF_VERSION(info.version)) return -ELOWLEVEL; arg = RSU_NOTIFY_IGNORE_STAGE | RSU_NOTIFY_RESET_RETRY_COUNTER; diff --git a/arch/arm/mach-socfpga/rsu_s10.c b/arch/arm/mach-socfpga/rsu_s10.c index 5ba57d656e..ebb3e52ab1 100644 --- a/arch/arm/mach-socfpga/rsu_s10.c +++ b/arch/arm/mach-socfpga/rsu_s10.c @@ -35,7 +35,8 @@ static int rsu_print_status(void) printf("Version\t\t: 0x%08x\n", status_info.version); printf("Error location\t: 0x%08x\n", status_info.error_location); printf("Error details\t: 0x%08x\n", status_info.error_details); - if (status_info.version) + if (RSU_VERSION_ACMF_VERSION(status_info.version) && + RSU_VERSION_DCMF_VERSION(status_info.version)) printf("Retry counter\t: 0x%08x\n", status_info.retry_counter); return 0; |