net: ipa: use enumerated types for GSI field values
authorAlex Elder <elder@linaro.org>
Tue, 10 Nov 2020 21:59:22 +0000 (15:59 -0600)
committerJakub Kicinski <kuba@kernel.org>
Fri, 13 Nov 2020 23:13:41 +0000 (15:13 -0800)
Replace constants defined with an "_FVAL" suffix with values defined
in enumerated types, to be consistent with other usage in the driver.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ipa/gsi.c
drivers/net/ipa/gsi_reg.h

index 608f64712be3fa4416918eb320e7c6d1c03f0b69..55151960a69850862bf32521786b8be4b90e1359 100644 (file)
@@ -1077,7 +1077,7 @@ static void gsi_isr_gp_int1(struct gsi *gsi)
 
        val = ioread32(gsi->virt + GSI_CNTXT_SCRATCH_0_OFFSET);
        result = u32_get_bits(val, GENERIC_EE_RESULT_FMASK);
-       if (result != GENERIC_EE_SUCCESS_FVAL)
+       if (result != GENERIC_EE_SUCCESS)
                dev_err(gsi->dev, "global INT1 generic result %u\n", result);
 
        complete(&gsi->completion);
index de3d87d278a980a9c3d8fded7993921604c403d5..8e3a7ffd19479b0de1e054fc813042a94353ca7a 100644 (file)
@@ -263,11 +263,6 @@ enum gsi_generic_cmd_opcode {
 #define GSI_EE_N_GSI_HW_PARAM_2_OFFSET(ee) \
                        (0x0001f040 + 0x4000 * (ee))
 #define IRAM_SIZE_FMASK                        GENMASK(2, 0)
-#define IRAM_SIZE_ONE_KB_FVAL                  0
-#define IRAM_SIZE_TWO_KB_FVAL                  1
-/* The next two values are available for IPA v4.0 and above */
-#define IRAM_SIZE_TWO_N_HALF_KB_FVAL           2
-#define IRAM_SIZE_THREE_KB_FVAL                        3
 #define NUM_CH_PER_EE_FMASK            GENMASK(7, 3)
 #define NUM_EV_PER_EE_FMASK            GENMASK(12, 8)
 #define GSI_CH_PEND_TRANSLATE_FMASK    GENMASK(13, 13)
@@ -280,6 +275,14 @@ enum gsi_generic_cmd_opcode {
 /* Fields below are present for IPA v4.2 and above */
 #define GSI_USE_RD_WR_ENG_FMASK                GENMASK(30, 30)
 #define GSI_USE_INTER_EE_FMASK         GENMASK(31, 31)
+/** enum gsi_iram_size - IRAM_SIZE field values in HW_PARAM_2 */
+enum gsi_iram_size {
+       IRAM_SIZE_ONE_KB                        = 0x0,
+       IRAM_SIZE_TWO_KB                        = 0x1,
+/* The next two values are available for IPA v4.0 and above */
+       IRAM_SIZE_TWO_N_HALF_KB                 = 0x2,
+       IRAM_SIZE_THREE_KB                      = 0x3,
+};
 
 /* IRQ condition for each type is cleared by writing type-specific register */
 #define GSI_CNTXT_TYPE_IRQ_OFFSET \
@@ -432,10 +435,15 @@ enum gsi_err_type {
                        (0x0001f400 + 0x4000 * (ee))
 #define INTER_EE_RESULT_FMASK          GENMASK(2, 0)
 #define GENERIC_EE_RESULT_FMASK                GENMASK(7, 5)
-#define GENERIC_EE_SUCCESS_FVAL                        1
-#define GENERIC_EE_INCORRECT_DIRECTION_FVAL    3
-#define GENERIC_EE_INCORRECT_CHANNEL_FVAL      5
-#define GENERIC_EE_NO_RESOURCES_FVAL           7
+enum gsi_generic_ee_result {
+       GENERIC_EE_SUCCESS                      = 0x1,
+       GENERIC_EE_CHANNEL_NOT_RUNNING          = 0x2,
+       GENERIC_EE_INCORRECT_DIRECTION          = 0x3,
+       GENERIC_EE_INCORRECT_CHANNEL_TYPE       = 0x4,
+       GENERIC_EE_INCORRECT_CHANNEL            = 0x5,
+       GENERIC_EE_RETRY                        = 0x6,
+       GENERIC_EE_NO_RESOURCES                 = 0x7,
+};
 #define USB_MAX_PACKET_FMASK           GENMASK(15, 15) /* 0: HS; 1: SS */
 #define MHI_BASE_CHANNEL_FMASK         GENMASK(31, 24)