net: ipa: prepare for GSI register updtaes
cover net: ipa: prepare for GSI register updtaes
An upcoming series (or two) will convert the definitions of GSI registers used by IPA so they use the "IPA reg" mechanism to specify register offsets and their fields. This will simplify implementing the fairly large number of changes required in GSI registers to support more than 32 GSI channels (introduced in IPA v5.0).
A few minor problems and inconsistencies were found, and they're fixed here. The last three patches in this series change the "ipa_reg" code to separate the IPA-specific part (the base virtual address, basically) from the generic register part, and the now- generic code is renamed to use just "reg_" or "REG_" as a prefix rather than "ipa_reg" or "IPA_REG_".
-Alex
Alex Elder (9):
net: ipa: generic command param fix
net: ipa: get rid of ipa->reg_addr
net: ipa: add some new IPA versions
net: ipa: tighten up IPA register validity checking
net: ipa: use bitmasks for GSI IRQ values
net: ipa: GSI register cleanup
net: ipa: start generalizing "ipa_reg"
net: ipa: generalize register offset functions
net: ipa: generalize register field functions
drivers/net/ipa/gsi.c | 82 +++++--- drivers/net/ipa/gsi_reg.h | 109 +++++------ drivers/net/ipa/ipa.h | 4 +- drivers/net/ipa/ipa_cmd.c | 6 +- drivers/net/ipa/ipa_endpoint.c | 205 ++++++++++--------- drivers/net/ipa/ipa_interrupt.c | 29 ++- drivers/net/ipa/ipa_main.c | 114 +++++------ drivers/net/ipa/ipa_mem.c | 14 +- drivers/net/ipa/ipa_reg.c | 90 +++++---- drivers/net/ipa/ipa_reg.h | 139 ++----------- drivers/net/ipa/ipa_resource.c | 16 +- drivers/net/ipa/ipa_table.c | 35 ++-- drivers/net/ipa/ipa_uc.c | 6 +- drivers/net/ipa/ipa_version.h | 6 +- drivers/net/ipa/reg.h | 133 +++++++++++++ drivers/net/ipa/reg/ipa_reg-v3.1.c | 277 +++++++++++++------------- drivers/net/ipa/reg/ipa_reg-v3.5.1.c | 263 +++++++++++++------------ drivers/net/ipa/reg/ipa_reg-v4.11.c | 265 +++++++++++++------------ drivers/net/ipa/reg/ipa_reg-v4.2.c | 249 ++++++++++++------------ drivers/net/ipa/reg/ipa_reg-v4.5.c | 281 +++++++++++++-------------- drivers/net/ipa/reg/ipa_reg-v4.7.c | 265 +++++++++++++------------ drivers/net/ipa/reg/ipa_reg-v4.9.c | 265 +++++++++++++------------ 22 files changed, 1451 insertions(+), 1402 deletions(-) create mode 100644 drivers/net/ipa/reg.h
Signature · 1 line
2.34.1
PATCH 1/9 net: ipa: generic command param fix
Starting at IPA v4.11, the GSI_GENERIC_COMMAND GSI register got a new PARAMS field. The code that encodes a value into that field sets it unconditionally, which is wrong.
We currently only provide 0 as the field's value, so this error has no real effect. Still, it's a bug, so let's fix it.
Fix an (unrelated) incorrect comment as well. Fields in the ERROR_LOG GSI register actually *are* defined for IPA versions prior to v3.5.1.
---
Note: This is sort of a non-bug, so I submitted it to net-next.
drivers/net/ipa/gsi.c | 3 ++- drivers/net/ipa/gsi_reg.h | 1 - 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/ipa/gsi.c +2 -1
@@ -1666,7 +1666,8 @@ static int gsi_generic_command(struct gsi *gsi, u32 channel_id, val =u32_encode_bits (opcode,GENERIC_OPCODE_FMASK ); val |=u32_encode_bits (channel_id,GENERIC_CHID_FMASK ); val |=u32_encode_bits (GSI_EE_MODEM ,GENERIC_EE_FMASK ); - val |=u32_encode_bits (params,GENERIC_PARAMS_FMASK ); +if (gsi->version >=IPA_VERSION_4_11 ) + val |=u32_encode_bits (params,GENERIC_PARAMS_FMASK ); timeout = !gsi_command (gsi,GSI_GENERIC_CMD_OFFSET , val);
drivers/net/ipa/gsi_reg.h +0 -1
@@ -372,7 +372,6 @@ enum gsi_general_id {#define GSI_ERROR_LOG_OFFSET \ (0x0001f200 + 0x4000 * GSI_EE_AP) -/* Fields below are present for IPA v3.5.1 and above */ #define ERR_ARG3_FMASK GENMASK(3, 0)#define ERR_ARG2_FMASK GENMASK(7, 4)#define ERR_ARG1_FMASK GENMASK(11, 8)
Signature · 1 line
2.34.1
PATCH 2/9 net: ipa: get rid of ipa->reg_addr
In reply to Alex ElderThe reg_addr field in the IPA structure is set but never used. Get rid of it.
--- drivers/net/ipa/ipa.h | 2 -- drivers/net/ipa/ipa_reg.c | 1 - 2 files changed, 3 deletions(-)
drivers/net/ipa/ipa.h +0 -2
@@ -45,7 +45,6 @@ struct ipa_interrupt;* @interrupt: IPA Interrupt information * @uc_powered: true if power is active by proxy for microcontroller * @uc_loaded: true after microcontroller has reported it's ready -* @reg_addr: DMA address used for IPA register access * @reg_virt: Virtual address used for IPA register access * @regs: IPA register definitions * @mem_addr: DMA address of IPA-local memory space
@@ -97,7 +96,6 @@ struct ipa {bool uc_powered;bool uc_loaded; -dma_addr_t reg_addr;void __iomem *reg_virt;const struct ipa_regs *regs;
drivers/net/ipa/ipa_reg.c +0 -1
@@ -123,7 +123,6 @@ int ipa_reg_init(struct ipa *ipa)dev_err (dev,"unable to remap \"ipa-reg\" memory\n" );return -ENOMEM ; } - ipa->reg_addr = res->start; ipa->regs = regs;return 0 ;
Signature · 1 line
2.34.1
PATCH 3/9 net: ipa: add some new IPA versions
In reply to Alex ElderSoon IPA v5.0+ will be supported, and when that happens we will be able to enable support for the SDX65 (IPA v5.0), SM8450 (IPA v5.1), and SM8550 (IPA v5.5).
Fix the comment about the GSI version used for IPA v3.1.
--- drivers/net/ipa/ipa_version.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/ipa/ipa_version.h +5 -1
@@ -9,7 +9,7 @@/** * enum ipa_version * @IPA_VERSION_3_0: IPA version 3.0/GSI version 1.0 -* @IPA_VERSION_3_1: IPA version 3.1/GSI version 1.1 +* @IPA_VERSION_3_1: IPA version 3.1/GSI version 1.0 * @IPA_VERSION_3_5: IPA version 3.5/GSI version 1.2 * @IPA_VERSION_3_5_1: IPA version 3.5.1/GSI version 1.3 * @IPA_VERSION_4_0: IPA version 4.0/GSI version 2.0
@@ -20,6 +20,8 @@* @IPA_VERSION_4_9: IPA version 4.9/GSI version 2.9 * @IPA_VERSION_4_11: IPA version 4.11/GSI version 2.11 (2.1.1) * @IPA_VERSION_5_0: IPA version 5.0/GSI version 3.0 +* @IPA_VERSION_5_1: IPA version 5.1/GSI version 3.0 +* @IPA_VERSION_5_5: IPA version 5.5/GSI version 5.5 * @IPA_VERSION_COUNT: Number of defined IPA versions * * Defines the version of IPA (and GSI) hardware present on the platform.
@@ -38,6 +40,8 @@ enum ipa_version {IPA_VERSION_4_9 ,IPA_VERSION_4_11 ,IPA_VERSION_5_0 , +IPA_VERSION_5_1 , +IPA_VERSION_5_5 , IPA_VERSION_COUNT, /* Last; not a version */ };
Signature · 1 line
2.34.1
PATCH 4/9 net: ipa: tighten up IPA register validity checking
In reply to Alex ElderWhen checking the validity of an IPA register ID, compare it against all possible ipa_reg_id values.
Rename the function ipa_reg_id_valid() to be specific about what's being checked.
--- drivers/net/ipa/ipa_reg.c | 49 +++++++++++++++++++++++++++++++++++---- 1 file changed, 45 insertions(+), 4 deletions(-)
drivers/net/ipa/ipa_reg.c +45 -4
@@ -9,8 +9,8 @@#include "ipa.h" #include "ipa_reg.h" -/* Is this register valid and defined for the current IPA version? */ -static bool ipa_reg_valid (struct ipa *ipa,enum ipa_reg_id reg_id) +/* Is this register ID valid for the current IPA version? */ +static bool ipa_reg_id_valid (struct ipa *ipa,enum ipa_reg_id reg_id) {enum ipa_version version = ipa->version;bool valid;
@@ -57,8 +57,49 @@ static bool ipa_reg_valid(struct ipa *ipa, enum ipa_reg_id reg_id) valid = version >=IPA_VERSION_3_1 ;break ; +case COMP_CFG : +case CLKON_CFG : +case ROUTE : +case SHARED_MEM_SIZE : +case QSB_MAX_WRITES : +case QSB_MAX_READS : +case FILT_ROUT_HASH_EN : +case FILT_ROUT_CACHE_CFG : +case FILT_ROUT_HASH_FLUSH : +case FILT_ROUT_CACHE_FLUSH : +case STATE_AGGR_ACTIVE : +case LOCAL_PKT_PROC_CNTXT : +case AGGR_FORCE_CLOSE : +case SRC_RSRC_GRP_01_RSRC_TYPE : +case SRC_RSRC_GRP_23_RSRC_TYPE : +case DST_RSRC_GRP_01_RSRC_TYPE : +case DST_RSRC_GRP_23_RSRC_TYPE : +case ENDP_INIT_CTRL : +case ENDP_INIT_CFG : +case ENDP_INIT_NAT : +case ENDP_INIT_HDR : +case ENDP_INIT_HDR_EXT : +case ENDP_INIT_HDR_METADATA_MASK : +case ENDP_INIT_MODE : +case ENDP_INIT_AGGR : +case ENDP_INIT_HOL_BLOCK_EN : +case ENDP_INIT_HOL_BLOCK_TIMER : +case ENDP_INIT_DEAGGR : +case ENDP_INIT_RSRC_GRP : +case ENDP_INIT_SEQ : +case ENDP_STATUS : +case ENDP_FILTER_CACHE_CFG : +case ENDP_ROUTER_CACHE_CFG : +case IPA_IRQ_STTS : +case IPA_IRQ_EN : +case IPA_IRQ_CLR : +case IPA_IRQ_UC : +case IRQ_SUSPEND_INFO : + valid = true;/* These should be defined for all versions */ +break ; +default : - valid = true;/* Others should be defined for all versions */ + valid = false;break ; }
@@ -69,7 +110,7 @@ static bool ipa_reg_valid(struct ipa *ipa, enum ipa_reg_id reg_id)const struct ipa_reg *ipa_reg (struct ipa *ipa,enum ipa_reg_id reg_id) { -if (WARN_ON (!ipa_reg_valid (ipa, reg_id))) +if (WARN_ON (!ipa_reg_id_valid (ipa, reg_id)))return NULL ;return ipa->regs->reg[reg_id];
Signature · 1 line
2.34.1
PATCH 5/9 net: ipa: use bitmasks for GSI IRQ values
In reply to Alex ElderThere are seven GSI interrupt types that can be signaled by a single GSI IRQ. These are represented in a bitmask, and the gsi_irq_type_id enumerated type defines what each bit position represents.
Similarly, the global and general GSI interrupt types each has a set of conditions it signals, and both types have an enumerated type that defines which bit that represents each condition.
When used, these enumerated values are passed as an argument to BIT() in *all* cases. So clean up the code a little bit by defining the enumerated type values as one-bit masks rather than bit positions.
Rename gsi_general_id to be gsi_general_irq_id for consistency.
--- drivers/net/ipa/gsi.c | 38 ++++++++++++++-------------- drivers/net/ipa/gsi_reg.h | 52 +++++++++++++++++++++++++-------------- 2 files changed, 52 insertions(+), 38 deletions(-)
drivers/net/ipa/gsi.c +19 -19
@@ -191,12 +191,12 @@ static void gsi_irq_type_update(struct gsi *gsi, u32 val)static void gsi_irq_type_enable (struct gsi *gsi,enum gsi_irq_type_id type_id) { -gsi_irq_type_update (gsi, gsi->type_enabled_bitmap |BIT (type_id)); +gsi_irq_type_update (gsi, gsi->type_enabled_bitmap | type_id); }static void gsi_irq_type_disable (struct gsi *gsi,enum gsi_irq_type_id type_id) { -gsi_irq_type_update (gsi, gsi->type_enabled_bitmap & ~BIT (type_id)); +gsi_irq_type_update (gsi, gsi->type_enabled_bitmap & ~type_id); }/* Event ring commands are performed one at a time. Their completion
@@ -292,19 +292,19 @@ static void gsi_irq_enable(struct gsi *gsi)/* Global interrupts include hardware error reports. Enable * that so we can at least report the error should it occur. */ -iowrite32 (BIT (ERROR_INT ), gsi->virt +GSI_CNTXT_GLOB_IRQ_EN_OFFSET ); -gsi_irq_type_update (gsi, gsi->type_enabled_bitmap |BIT (GSI_GLOB_EE )); +iowrite32 (ERROR_INT , gsi->virt +GSI_CNTXT_GLOB_IRQ_EN_OFFSET ); +gsi_irq_type_update (gsi, gsi->type_enabled_bitmap |GSI_GLOB_EE );/* General GSI interrupts are reported to all EEs; if they occur * they are unrecoverable (without reset). A breakpoint interrupt * also exists, but we don't support that. We want to be notified * of errors so we can report them, even if they can't be handled. */ - val =BIT (BUS_ERROR ); - val |=BIT (CMD_FIFO_OVRFLOW ); - val |=BIT (MCS_STACK_OVRFLOW ); + val =BUS_ERROR ; + val |=CMD_FIFO_OVRFLOW ; + val |=MCS_STACK_OVRFLOW ;iowrite32 (val, gsi->virt +GSI_CNTXT_GSI_IRQ_EN_OFFSET ); -gsi_irq_type_update (gsi, gsi->type_enabled_bitmap |BIT (GSI_GENERAL )); +gsi_irq_type_update (gsi, gsi->type_enabled_bitmap |GSI_GENERAL ); }/* Disable all GSI interrupt types */
@@ -1195,15 +1195,15 @@ static void gsi_isr_glob_ee(struct gsi *gsi) val =ioread32 (gsi->virt +GSI_CNTXT_GLOB_IRQ_STTS_OFFSET ); -if (val &BIT (ERROR_INT )) +if (val &ERROR_INT )gsi_isr_glob_err (gsi);iowrite32 (val, gsi->virt +GSI_CNTXT_GLOB_IRQ_CLR_OFFSET ); - val &= ~BIT (ERROR_INT ); + val &= ~ERROR_INT ; -if (val &BIT (GP_INT1 )) { - val ^=BIT (GP_INT1 ); +if (val &GP_INT1 ) { + val ^=GP_INT1 ;gsi_isr_gp_int1 (gsi); }
@@ -1264,19 +1264,19 @@ static irqreturn_t gsi_isr(int irq, void *dev_id) intr_mask ^= gsi_intr;switch (gsi_intr) { -case BIT (GSI_CH_CTRL ): +case GSI_CH_CTRL :gsi_isr_chan_ctrl (gsi);break ; -case BIT (GSI_EV_CTRL ): +case GSI_EV_CTRL :gsi_isr_evt_ctrl (gsi);break ; -case BIT (GSI_GLOB_EE ): +case GSI_GLOB_EE :gsi_isr_glob_ee (gsi);break ; -case BIT (GSI_IEOB ): +case GSI_IEOB :gsi_isr_ieob (gsi);break ; -case BIT (GSI_GENERAL ): +case GSI_GENERAL :gsi_isr_general (gsi);break ;default :
@@ -1654,7 +1654,7 @@ static int gsi_generic_command(struct gsi *gsi, u32 channel_id,* channel), and only from this function. So we enable the GP_INT1 * IRQ type here, and disable it again after the command completes. */ - val =BIT (ERROR_INT ) |BIT (GP_INT1 ); + val =ERROR_INT |GP_INT1 ;iowrite32 (val, gsi->virt +GSI_CNTXT_GLOB_IRQ_EN_OFFSET );/* First zero the result code field */
@@ -1672,7 +1672,7 @@ static int gsi_generic_command(struct gsi *gsi, u32 channel_id, timeout = !gsi_command (gsi,GSI_GENERIC_CMD_OFFSET , val);/* Disable the GP_INT1 IRQ type again */ -iowrite32 (BIT (ERROR_INT ), gsi->virt +GSI_CNTXT_GLOB_IRQ_EN_OFFSET ); +iowrite32 (ERROR_INT , gsi->virt +GSI_CNTXT_GLOB_IRQ_EN_OFFSET );if (!timeout)return gsi->result;
drivers/net/ipa/gsi_reg.h +33 -19
72 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH 6/9 net: ipa: GSI register cleanup
In reply to Alex ElderMove some static inline function definitions out of "gsi_reg.h" and into "gsi.c", which is the only place they're used. Rename them so their names identify the register they're associated with.
Move the gsi_channel_type enumerated type definition below the offset and field definitions for the CH_C_CNTXT_0 register where it's used.
--- drivers/net/ipa/gsi.c | 41 +++++++++++++++++++++++++--- drivers/net/ipa/gsi_reg.h | 56 +++++++++------------------------------ 2 files changed, 50 insertions(+), 47 deletions(-)
drivers/net/ipa/gsi.c +38 -3
@@ -182,6 +182,41 @@ static bool gsi_channel_initialized(struct gsi_channel *channel)return !!channel->gsi; } +/* Encode the channel protocol for the CH_C_CNTXT_0 register */ +static u32 ch_c_cntxt_0_type_encode (enum ipa_version version, +enum gsi_channel_type type) +{ +u32 val; + + val =u32_encode_bits (type,CHTYPE_PROTOCOL_FMASK ); +if (version <IPA_VERSION_4_5 ) +return val; + + type >>=hweight32 (CHTYPE_PROTOCOL_FMASK ); + +return val |u32_encode_bits (type,CHTYPE_PROTOCOL_MSB_FMASK ); +} + +/* Encode a channel ring buffer length for the CH_C_CNTXT_1 register */ +static u32 ch_c_cntxt_1_length_encode (enum ipa_version version,u32 length) +{ +if (version <IPA_VERSION_4_9 ) +return u32_encode_bits (length,GENMASK (15 ,0 )); + +return u32_encode_bits (length,GENMASK (19 ,0 )); +} + +/* Encode the length of the event channel ring buffer for the +* EV_CH_E_CNTXT_1 register. +*/ +static u32 ev_ch_e_cntxt_1_length_encode (enum ipa_version version,u32 length) +{ +if (version <IPA_VERSION_4_9 ) +return u32_encode_bits (length,GENMASK (15 ,0 )); + +return u32_encode_bits (length,GENMASK (19 ,0 )); +} +/* Update the GSI IRQ type register with the cached value */ static void gsi_irq_type_update (struct gsi *gsi,u32 val) {
@@ -676,7 +711,7 @@ static void gsi_evt_ring_program(struct gsi *gsi, u32 evt_ring_id)iowrite32 (val, gsi->virt +GSI_EV_CH_E_CNTXT_0_OFFSET (evt_ring_id)); size = ring->count *GSI_RING_ELEMENT_SIZE ; - val =ev_r_length_encoded (gsi->version, size); + val =ev_ch_e_cntxt_1_length_encode (gsi->version, size);iowrite32 (val, gsi->virt +GSI_EV_CH_E_CNTXT_1_OFFSET (evt_ring_id));/* The context 2 and 3 registers store the low-order and
@@ -765,14 +800,14 @@ static void gsi_channel_program(struct gsi_channel *channel, bool doorbell)u32 val;/* We program all channels as GPI type/protocol */ - val =chtype_protocol_encoded (gsi->version,GSI_CHANNEL_TYPE_GPI ); + val =ch_c_cntxt_0_type_encode (gsi->version,GSI_CHANNEL_TYPE_GPI );if (channel->toward_ipa) val |=CHTYPE_DIR_FMASK ; val |=u32_encode_bits (channel->evt_ring_id,ERINDEX_FMASK ); val |=u32_encode_bits (GSI_RING_ELEMENT_SIZE ,ELEMENT_SIZE_FMASK );iowrite32 (val, gsi->virt +GSI_CH_C_CNTXT_0_OFFSET (channel_id)); - val =r_length_encoded (gsi->version, size); + val =ch_c_cntxt_1_length_encode (gsi->version, size);iowrite32 (val, gsi->virt +GSI_CH_C_CNTXT_1_OFFSET (channel_id));/* The context 2 and 3 registers store the low-order and
drivers/net/ipa/gsi_reg.h +12 -44
77 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH 8/9 net: ipa: generalize register offset functions
In reply to Alex ElderRename ipa_reg_offset() to be reg_offset() and move its definition to "reg.h". Rename ipa_reg_n_offset() to be reg_n_offset() also.
--- drivers/net/ipa/ipa_cmd.c | 4 ++-- drivers/net/ipa/ipa_endpoint.c | 38 ++++++++++++++++----------------- drivers/net/ipa/ipa_interrupt.c | 17 +++++++-------- drivers/net/ipa/ipa_main.c | 28 +++++++++++++----------- drivers/net/ipa/ipa_mem.c | 4 ++-- drivers/net/ipa/ipa_reg.h | 14 +----------- drivers/net/ipa/ipa_resource.c | 2 +- drivers/net/ipa/ipa_table.c | 13 +++++------ drivers/net/ipa/ipa_uc.c | 2 +- drivers/net/ipa/reg.h | 12 +++++++++++ 10 files changed, 66 insertions(+), 68 deletions(-)
drivers/net/ipa/ipa_cmd.c +2 -2
@@ -300,7 +300,7 @@ static bool ipa_cmd_register_write_valid(struct ipa *ipa)else reg =ipa_reg (ipa,FILT_ROUT_CACHE_FLUSH ); - offset =ipa_reg_offset (reg); + offset =reg_offset (reg); name ="filter/route hash flush" ;if (!ipa_cmd_register_write_offset_valid (ipa, name, offset))return false;
@@ -314,7 +314,7 @@ static bool ipa_cmd_register_write_valid(struct ipa *ipa)* fits in the register write command field(s) that must hold it. */ reg =ipa_reg (ipa,ENDP_STATUS ); - offset =ipa_reg_n_offset (reg,IPA_ENDPOINT_COUNT -1 ); + offset =reg_n_offset (reg,IPA_ENDPOINT_COUNT -1 ); name ="maximal endpoint status" ;if (!ipa_cmd_register_write_offset_valid (ipa, name, offset))return false;
drivers/net/ipa/ipa_endpoint.c +19 -19
@@ -460,7 +460,7 @@ ipa_endpoint_init_ctrl(struct ipa_endpoint *endpoint, bool suspend_delay)WARN_ON (ipa->version >=IPA_VERSION_4_0 ); reg =ipa_reg (ipa,ENDP_INIT_CTRL ); - offset =ipa_reg_n_offset (reg, endpoint->endpoint_id); + offset =reg_n_offset (reg, endpoint->endpoint_id); val =ioread32 (ipa->reg_virt + offset); field_id = endpoint->toward_ipa ?ENDP_DELAY :ENDP_SUSPEND ;
@@ -499,7 +499,7 @@ static bool ipa_endpoint_aggr_active(struct ipa_endpoint *endpoint)WARN_ON (!test_bit (endpoint_id, ipa->available)); reg =ipa_reg (ipa,STATE_AGGR_ACTIVE ); - val =ioread32 (ipa->reg_virt +ipa_reg_n_offset (reg, unit)); + val =ioread32 (ipa->reg_virt +reg_n_offset (reg, unit));return !!(val &BIT (endpoint_id %32 )); }
@@ -515,7 +515,7 @@ static void ipa_endpoint_force_close(struct ipa_endpoint *endpoint)WARN_ON (!test_bit (endpoint_id, ipa->available)); reg =ipa_reg (ipa,AGGR_FORCE_CLOSE ); -iowrite32 (mask, ipa->reg_virt +ipa_reg_n_offset (reg, unit)); +iowrite32 (mask, ipa->reg_virt +reg_n_offset (reg, unit)); }/**
@@ -622,7 +622,7 @@ int ipa_endpoint_modem_exception_reset_all(struct ipa *ipa)continue ; reg =ipa_reg (ipa,ENDP_STATUS ); - offset =ipa_reg_n_offset (reg, endpoint_id); + offset =reg_n_offset (reg, endpoint_id);/* Value written is 0, and all bits are updated. That * means status is disabled on the endpoint, and as a
@@ -674,7 +674,7 @@ static void ipa_endpoint_init_cfg(struct ipa_endpoint *endpoint) val |=ipa_reg_encode (reg,CS_OFFLOAD_EN , enabled);/* CS_GEN_QMB_MASTER_SEL is 0 */ -iowrite32 (val, ipa->reg_virt +ipa_reg_n_offset (reg, endpoint_id)); +iowrite32 (val, ipa->reg_virt +reg_n_offset (reg, endpoint_id)); }static void ipa_endpoint_init_nat (struct ipa_endpoint *endpoint)
@@ -690,7 +690,7 @@ static void ipa_endpoint_init_nat(struct ipa_endpoint *endpoint) reg =ipa_reg (ipa,ENDP_INIT_NAT ); val =ipa_reg_encode (reg,NAT_EN ,IPA_NAT_TYPE_BYPASS ); -iowrite32 (val, ipa->reg_virt +ipa_reg_n_offset (reg, endpoint_id)); +iowrite32 (val, ipa->reg_virt +reg_n_offset (reg, endpoint_id)); } static u32
@@ -820,7 +820,7 @@ static void ipa_endpoint_init_hdr(struct ipa_endpoint *endpoint)/* HDR_METADATA_REG_VALID is 0 (TX only, version < v4.5) */ } -iowrite32 (val, ipa->reg_virt +ipa_reg_n_offset (reg, endpoint_id)); +iowrite32 (val, ipa->reg_virt +reg_n_offset (reg, endpoint_id)); }static void ipa_endpoint_init_hdr_ext (struct ipa_endpoint *endpoint)
@@ -872,7 +872,7 @@ static void ipa_endpoint_init_hdr_ext(struct ipa_endpoint *endpoint) } } -iowrite32 (val, ipa->reg_virt +ipa_reg_n_offset (reg, endpoint_id)); +iowrite32 (val, ipa->reg_virt +reg_n_offset (reg, endpoint_id)); }static void ipa_endpoint_init_hdr_metadata_mask (struct ipa_endpoint *endpoint)
@@ -887,7 +887,7 @@ static void ipa_endpoint_init_hdr_metadata_mask(struct ipa_endpoint *endpoint)return ;/* Register not valid for TX endpoints */ reg =ipa_reg (ipa,ENDP_INIT_HDR_METADATA_MASK ); - offset =ipa_reg_n_offset (reg, endpoint_id); + offset =reg_n_offset (reg, endpoint_id);/* Note that HDR_ENDIANNESS indicates big endian header fields */ if (endpoint->config.qmap)
@@ -918,7 +918,7 @@ static void ipa_endpoint_init_mode(struct ipa_endpoint *endpoint) }/* All other bits unspecified (and 0) */ - offset =ipa_reg_n_offset (reg, endpoint->endpoint_id); + offset =reg_n_offset (reg, endpoint->endpoint_id);iowrite32 (val, ipa->reg_virt + offset); }
@@ -1032,7 +1032,7 @@ static void ipa_endpoint_init_aggr(struct ipa_endpoint *endpoint)/* other fields ignored */ } -iowrite32 (val, ipa->reg_virt +ipa_reg_n_offset (reg, endpoint_id)); +iowrite32 (val, ipa->reg_virt +reg_n_offset (reg, endpoint_id)); }/* The head-of-line blocking timer is defined as a tick count. For
@@ -1116,7 +1116,7 @@ static void ipa_endpoint_init_hol_block_timer(struct ipa_endpoint *endpoint, reg =ipa_reg (ipa,ENDP_INIT_HOL_BLOCK_TIMER ); val =hol_block_timer_encode (ipa, reg, microseconds); -iowrite32 (val, ipa->reg_virt +ipa_reg_n_offset (reg, endpoint_id)); +iowrite32 (val, ipa->reg_virt +reg_n_offset (reg, endpoint_id)); } static void
@@ -1129,7 +1129,7 @@ ipa_endpoint_init_hol_block_en(struct ipa_endpoint *endpoint, bool enable)u32 val; reg =ipa_reg (ipa,ENDP_INIT_HOL_BLOCK_EN ); - offset =ipa_reg_n_offset (reg, endpoint_id); + offset =reg_n_offset (reg, endpoint_id); val = enable ?ipa_reg_bit (reg,HOL_BLOCK_EN ) :0 ;iowrite32 (val, ipa->reg_virt + offset);
@@ -1183,7 +1183,7 @@ static void ipa_endpoint_init_deaggr(struct ipa_endpoint *endpoint)/* PACKET_OFFSET_LOCATION is ignored (not valid) */ /* MAX_PACKET_LEN is 0 (not enforced) */ -iowrite32 (val, ipa->reg_virt +ipa_reg_n_offset (reg, endpoint_id)); +iowrite32 (val, ipa->reg_virt +reg_n_offset (reg, endpoint_id)); }static void ipa_endpoint_init_rsrc_grp (struct ipa_endpoint *endpoint)
@@ -1197,7 +1197,7 @@ static void ipa_endpoint_init_rsrc_grp(struct ipa_endpoint *endpoint) reg =ipa_reg (ipa,ENDP_INIT_RSRC_GRP ); val =ipa_reg_encode (reg,ENDP_RSRC_GRP , resource_group); -iowrite32 (val, ipa->reg_virt +ipa_reg_n_offset (reg, endpoint_id)); +iowrite32 (val, ipa->reg_virt +reg_n_offset (reg, endpoint_id)); }static void ipa_endpoint_init_seq (struct ipa_endpoint *endpoint)
@@ -1220,7 +1220,7 @@ static void ipa_endpoint_init_seq(struct ipa_endpoint *endpoint) val |=ipa_reg_encode (reg,SEQ_REP_TYPE , endpoint->config.tx.seq_rep_type); -iowrite32 (val, ipa->reg_virt +ipa_reg_n_offset (reg, endpoint_id)); +iowrite32 (val, ipa->reg_virt +reg_n_offset (reg, endpoint_id)); }/**
@@ -1292,7 +1292,7 @@ static void ipa_endpoint_status(struct ipa_endpoint *endpoint)/* STATUS_PKT_SUPPRESS_FMASK is 0 (not present for v4.0+) */ } -iowrite32 (val, ipa->reg_virt +ipa_reg_n_offset (reg, endpoint_id)); +iowrite32 (val, ipa->reg_virt +reg_n_offset (reg, endpoint_id)); } static int ipa_endpoint_replenish_one(struct ipa_endpoint *endpoint,
@@ -1647,7 +1647,7 @@ void ipa_endpoint_default_route_set(struct ipa *ipa, u32 endpoint_id) val |=ipa_reg_encode (reg,ROUTE_FRAG_DEF_PIPE , endpoint_id); val |=ipa_reg_bit (reg,ROUTE_DEF_RETAIN_HDR ); -iowrite32 (val, ipa->reg_virt +ipa_reg_offset (reg)); +iowrite32 (val, ipa->reg_virt +reg_offset (reg)); }void ipa_endpoint_default_route_clear (struct ipa *ipa)
@@ -2019,7 +2019,7 @@ int ipa_endpoint_config(struct ipa *ipa)* the highest one doesn't exceed the number supported by software. */ reg =ipa_reg (ipa,FLAVOR_0 ); - val =ioread32 (ipa->reg_virt +ipa_reg_offset (reg)); + val =ioread32 (ipa->reg_virt +reg_offset (reg));/* Our RX is an IPA producer; our TX is an IPA consumer. */ tx_count =ipa_reg_decode (reg,MAX_CONS_PIPES , val);
drivers/net/ipa/ipa_interrupt.c +8 -9
@@ -52,7 +52,7 @@ static void ipa_interrupt_process(struct ipa_interrupt *interrupt, u32 irq_id)u32 offset; reg =ipa_reg (ipa,IPA_IRQ_CLR ); - offset =ipa_reg_offset (reg); + offset =reg_offset (reg);switch (irq_id) {case IPA_IRQ_UC_0 :
@@ -102,7 +102,7 @@ static irqreturn_t ipa_isr_thread(int irq, void *dev_id)* only the enabled ones. */ reg =ipa_reg (ipa,IPA_IRQ_STTS ); - offset =ipa_reg_offset (reg); + offset =reg_offset (reg); pending =ioread32 (ipa->reg_virt + offset);while ((mask = pending & enabled)) { do {
@@ -120,8 +120,7 @@ static irqreturn_t ipa_isr_thread(int irq, void *dev_id)dev_dbg (dev,"clearing disabled IPA interrupts 0x%08x\n" , pending); reg =ipa_reg (ipa,IPA_IRQ_CLR ); - offset =ipa_reg_offset (reg); -iowrite32 (pending, ipa->reg_virt + offset); +iowrite32 (pending, ipa->reg_virt +reg_offset (reg)); } out_power_put:pm_runtime_mark_last_busy (dev);
@@ -134,7 +133,7 @@ static void ipa_interrupt_enabled_update(struct ipa *ipa) {const struct reg *reg =ipa_reg (ipa,IPA_IRQ_EN ); -iowrite32 (ipa->interrupt->enabled, ipa->reg_virt +ipa_reg_offset (reg)); +iowrite32 (ipa->interrupt->enabled, ipa->reg_virt +reg_offset (reg)); }/* Enable an IPA interrupt type */
@@ -181,7 +180,7 @@ static void ipa_interrupt_suspend_control(struct ipa_interrupt *interrupt,return ; reg =ipa_reg (ipa,IRQ_SUSPEND_EN ); - offset =ipa_reg_n_offset (reg, unit); + offset =reg_n_offset (reg, unit); val =ioread32 (ipa->reg_virt + offset);if (enable)
@@ -219,14 +218,14 @@ void ipa_interrupt_suspend_clear_all(struct ipa_interrupt *interrupt)u32 val; reg =ipa_reg (ipa,IRQ_SUSPEND_INFO ); - val =ioread32 (ipa->reg_virt +ipa_reg_n_offset (reg, unit)); + val =ioread32 (ipa->reg_virt +reg_n_offset (reg, unit));/* SUSPEND interrupt status isn't cleared on IPA version 3.0 */ if (ipa->version ==IPA_VERSION_3_0 )continue ; reg =ipa_reg (ipa,IRQ_SUSPEND_CLR ); -iowrite32 (val, ipa->reg_virt +ipa_reg_n_offset (reg, unit)); +iowrite32 (val, ipa->reg_virt +reg_n_offset (reg, unit)); } }
@@ -261,7 +260,7 @@ struct ipa_interrupt *ipa_interrupt_config(struct ipa *ipa)/* Start with all IPA interrupts disabled */ reg =ipa_reg (ipa,IPA_IRQ_EN ); -iowrite32 (0 , ipa->reg_virt +ipa_reg_offset (reg)); +iowrite32 (0 , ipa->reg_virt +reg_offset (reg)); ret =request_threaded_irq (irq,NULL , ipa_isr_thread,IRQF_ONESHOT ,"ipa" , interrupt);
drivers/net/ipa/ipa_main.c +15 -13
@@ -212,7 +212,7 @@ ipa_hardware_config_bcr(struct ipa *ipa, const struct ipa_data *data) reg =ipa_reg (ipa,IPA_BCR ); val = data->backward_compat; -iowrite32 (val, ipa->reg_virt +ipa_reg_offset (reg)); +iowrite32 (val, ipa->reg_virt +reg_offset (reg)); }static void ipa_hardware_config_tx (struct ipa *ipa)
@@ -227,7 +227,7 @@ static void ipa_hardware_config_tx(struct ipa *ipa)/* Disable PA mask to allow HOLB drop */ reg =ipa_reg (ipa,IPA_TX_CFG ); - offset =ipa_reg_offset (reg); + offset =reg_offset (reg); val =ioread32 (ipa->reg_virt + offset);
@@ -259,7 +259,7 @@ static void ipa_hardware_config_clkon(struct ipa *ipa) val |=ipa_reg_bit (reg,GLOBAL_2X_CLK ); } -iowrite32 (val, ipa->reg_virt +ipa_reg_offset (reg)); +iowrite32 (val, ipa->reg_virt +reg_offset (reg)); }/* Configure bus access behavior for IPA components */
@@ -274,7 +274,8 @@ static void ipa_hardware_config_comp(struct ipa *ipa)return ; reg =ipa_reg (ipa,COMP_CFG ); - offset =ipa_reg_offset (reg); + offset =reg_offset (reg); + val =ioread32 (ipa->reg_virt + offset);if (ipa->version ==IPA_VERSION_4_0 ) {
@@ -315,7 +316,7 @@ ipa_hardware_config_qsb(struct ipa *ipa, const struct ipa_data *data) val |=ipa_reg_encode (reg,GEN_QMB_1_MAX_WRITES , data1->max_writes); -iowrite32 (val, ipa->reg_virt +ipa_reg_offset (reg)); +iowrite32 (val, ipa->reg_virt +reg_offset (reg));/* Max outstanding read accesses for QSB masters */ reg =ipa_reg (ipa,QSB_MAX_READS );
@@ -332,7 +333,7 @@ ipa_hardware_config_qsb(struct ipa *ipa, const struct ipa_data *data) data1->max_reads_beats); } -iowrite32 (val, ipa->reg_virt +ipa_reg_offset (reg)); +iowrite32 (val, ipa->reg_virt +reg_offset (reg)); }/* The internal inactivity timer clock is used for the aggregation timer */
@@ -374,7 +375,7 @@ static void ipa_qtime_config(struct ipa *ipa)/* Timer clock divider must be disabled when we change the rate */ reg =ipa_reg (ipa,TIMERS_XO_CLK_DIV_CFG ); -iowrite32 (0 , ipa->reg_virt +ipa_reg_offset (reg)); +iowrite32 (0 , ipa->reg_virt +reg_offset (reg)); reg =ipa_reg (ipa,QTIME_TIMESTAMP_CFG );/* Set DPL time stamp resolution to use Qtime (instead of 1 msec) */
@@ -384,7 +385,7 @@ static void ipa_qtime_config(struct ipa *ipa) val =ipa_reg_encode (reg,TAG_TIMESTAMP_LSB ,TAG_TIMESTAMP_SHIFT ); val =ipa_reg_encode (reg,NAT_TIMESTAMP_LSB ,NAT_TIMESTAMP_SHIFT ); -iowrite32 (val, ipa->reg_virt +ipa_reg_offset (reg)); +iowrite32 (val, ipa->reg_virt +reg_offset (reg));/* Set granularity of pulse generators used for other timers */ reg =ipa_reg (ipa,TIMERS_PULSE_GRAN_CFG );
@@ -397,11 +398,12 @@ static void ipa_qtime_config(struct ipa *ipa) val |=ipa_reg_encode (reg,PULSE_GRAN_2 ,IPA_GRAN_1_MS ); } -iowrite32 (val, ipa->reg_virt +ipa_reg_offset (reg)); +iowrite32 (val, ipa->reg_virt +reg_offset (reg));/* Actual divider is 1 more than value supplied here */ reg =ipa_reg (ipa,TIMERS_XO_CLK_DIV_CFG ); - offset =ipa_reg_offset (reg); + offset =reg_offset (reg); + val =ipa_reg_encode (reg,DIV_VALUE ,IPA_XO_CLOCK_DIVIDER -1 );iowrite32 (val, ipa->reg_virt + offset);
@@ -422,7 +424,7 @@ static void ipa_hardware_config_counter(struct ipa *ipa) reg =ipa_reg (ipa,COUNTER_CFG );/* If defined, EOT_COAL_GRANULARITY is 0 */ val =ipa_reg_encode (reg,AGGR_GRANULARITY , granularity); -iowrite32 (val, ipa->reg_virt +ipa_reg_offset (reg)); +iowrite32 (val, ipa->reg_virt +reg_offset (reg)); }static void ipa_hardware_config_timing (struct ipa *ipa)
@@ -451,7 +453,7 @@ static void ipa_hardware_config_hashing(struct ipa *ipa)/* IPV6_ROUTER_HASH, IPV6_FILTER_HASH, IPV4_ROUTER_HASH, * IPV4_FILTER_HASH are all zero. */ -iowrite32 (0 , ipa->reg_virt +ipa_reg_offset (reg)); +iowrite32 (0 , ipa->reg_virt +reg_offset (reg)); } static void ipa_idle_indication_cfg(struct ipa *ipa,
@@ -470,7 +472,7 @@ static void ipa_idle_indication_cfg(struct ipa *ipa,if (const_non_idle_enable) val |=ipa_reg_bit (reg,CONST_NON_IDLE_ENABLE ); -iowrite32 (val, ipa->reg_virt +ipa_reg_offset (reg)); +iowrite32 (val, ipa->reg_virt +reg_offset (reg)); }/**
drivers/net/ipa/ipa_mem.c +2 -2
@@ -116,7 +116,7 @@ int ipa_mem_setup(struct ipa *ipa) reg =ipa_reg (ipa,LOCAL_PKT_PROC_CNTXT ); val =ipa_reg_encode (reg,IPA_BASE_ADDR , offset); -iowrite32 (val, ipa->reg_virt +ipa_reg_offset (reg)); +iowrite32 (val, ipa->reg_virt +reg_offset (reg));return 0 ; }
@@ -328,7 +328,7 @@ int ipa_mem_config(struct ipa *ipa)/* Check the advertised location and size of the shared memory area */ reg =ipa_reg (ipa,SHARED_MEM_SIZE ); - val =ioread32 (ipa->reg_virt +ipa_reg_offset (reg)); + val =ioread32 (ipa->reg_virt +reg_offset (reg));/* The fields in the register are in 8 byte units */ ipa->mem_offset =8 *ipa_reg_decode (reg,MEM_BADDR , val);
drivers/net/ipa/ipa_reg.h +1 -13
@@ -36,7 +36,7 @@ struct ipa;* by register ID. Each entry in the array specifies the base offset and * (for parameterized registers) a non-zero stride value. Not all versions * of IPA define all registers. The offset for a register is returned by -* ipa_reg_offset() when the register's ipa_reg structure is supplied; +* reg_offset() when the register's ipa_reg structure is supplied; * zero is returned for an undefined register (this should never happen). * * Some registers encode multiple fields within them. Each field in
@@ -700,18 +700,6 @@ static inline u32 ipa_reg_field_max(const struct reg *reg, u32 field_id)const struct reg *ipa_reg (struct ipa *ipa,enum ipa_reg_id reg_id); -/* Returns 0 for NULL reg; warning will have already been issued */ -static inline u32 ipa_reg_offset (const struct reg *reg) -{ -return reg ? reg->offset :0 ; -} - -/* Returns 0 for NULL reg; warning will have already been issued */ -static inline u32 ipa_reg_n_offset (const struct reg *reg,u32 n) -{ -return reg ? reg->offset + n * reg->stride :0 ; -} -int ipa_reg_init (struct ipa *ipa);void ipa_reg_exit (struct ipa *ipa);
drivers/net/ipa/ipa_resource.c +1 -1
@@ -83,7 +83,7 @@ ipa_resource_config_common(struct ipa *ipa, u32 resource_type, val |=ipa_reg_encode (reg,Y_MAX_LIM , ylimits->max); } -iowrite32 (val, ipa->reg_virt +ipa_reg_n_offset (reg, resource_type)); +iowrite32 (val, ipa->reg_virt +reg_n_offset (reg, resource_type)); } static void ipa_resource_config_src(struct ipa *ipa, u32 resource_type,
drivers/net/ipa/ipa_table.c +5 -8
@@ -347,7 +347,6 @@ int ipa_table_hash_flush(struct ipa *ipa) {struct gsi_trans *trans;const struct reg *reg; -u32 offset;u32 val;if (!ipa_table_hash_support (ipa))
@@ -361,7 +360,6 @@ int ipa_table_hash_flush(struct ipa *ipa)if (ipa->version <IPA_VERSION_5_0 ) { reg =ipa_reg (ipa,FILT_ROUT_HASH_FLUSH ); - offset =ipa_reg_offset (reg); val =ipa_reg_bit (reg,IPV6_ROUTER_HASH ); val |=ipa_reg_bit (reg,IPV6_FILTER_HASH );
@@ -369,14 +367,13 @@ int ipa_table_hash_flush(struct ipa *ipa) val |=ipa_reg_bit (reg,IPV4_FILTER_HASH ); }else { reg =ipa_reg (ipa,FILT_ROUT_CACHE_FLUSH ); - offset =ipa_reg_offset (reg);/* IPA v5.0+ uses a unified cache (both IPv4 and IPv6) */ val =ipa_reg_bit (reg,ROUTER_CACHE ); val |=ipa_reg_bit (reg,FILTER_CACHE ); } -ipa_cmd_register_write_add (trans, offset, val, val, false); +ipa_cmd_register_write_add (trans,reg_offset (reg), val, val, false);gsi_trans_commit_wait (trans);
@@ -502,7 +499,7 @@ static void ipa_filter_tuple_zero(struct ipa_endpoint *endpoint)if (ipa->version <IPA_VERSION_5_0 ) { reg =ipa_reg (ipa,ENDP_FILTER_ROUTER_HSH_CFG ); - offset =ipa_reg_n_offset (reg, endpoint_id); + offset =reg_n_offset (reg, endpoint_id); val =ioread32 (endpoint->ipa->reg_virt + offset);/* Zero all filter-related fields, preserving the rest */
@@ -510,7 +507,7 @@ static void ipa_filter_tuple_zero(struct ipa_endpoint *endpoint) }else {/* IPA v5.0 separates filter and router cache configuration */ reg =ipa_reg (ipa,ENDP_FILTER_CACHE_CFG ); - offset =ipa_reg_n_offset (reg, endpoint_id); + offset =reg_n_offset (reg, endpoint_id);/* Zero all filter-related fields */ val =0 ;
@@ -560,7 +557,7 @@ static void ipa_route_tuple_zero(struct ipa *ipa, u32 route_id)if (ipa->version <IPA_VERSION_5_0 ) { reg =ipa_reg (ipa,ENDP_FILTER_ROUTER_HSH_CFG ); - offset =ipa_reg_n_offset (reg, route_id); + offset =reg_n_offset (reg, route_id); val =ioread32 (ipa->reg_virt + offset);
@@ -569,7 +566,7 @@ static void ipa_route_tuple_zero(struct ipa *ipa, u32 route_id) }else {/* IPA v5.0 separates filter and router cache configuration */ reg =ipa_reg (ipa,ENDP_ROUTER_CACHE_CFG ); - offset =ipa_reg_n_offset (reg, route_id); + offset =reg_n_offset (reg, route_id);/* Zero all route-related fields */ val =0 ;
drivers/net/ipa/ipa_uc.c +1 -1
@@ -245,7 +245,7 @@ static void send_uc_command(struct ipa *ipa, u32 command, u32 command_param) reg =ipa_reg (ipa,IPA_IRQ_UC ); val =ipa_reg_bit (reg,UC_INTR ); -iowrite32 (val, ipa->reg_virt +ipa_reg_offset (reg)); +iowrite32 (val, ipa->reg_virt +reg_offset (reg)); }/* Tell the microcontroller the AP is shutting down */
drivers/net/ipa/reg.h +12 -0
@@ -67,4 +67,16 @@ static inline const struct reg *reg(const struct regs *regs, u32 reg_id) return regs->reg[reg_id]; } +/* Returns 0 for NULL reg; warning should have already been issued */ +static inline u32 reg_offset (const struct reg *reg) +{ +return reg ? reg->offset :0 ; +} + +/* Returns 0 for NULL reg; warning should have already been issued */ +static inline u32 reg_n_offset (const struct reg *reg,u32 n) +{ +return reg ? reg->offset + n * reg->stride :0 ; +} +#endif /* _REG_H_ */
Signature · 1 line
2.34.1
PATCH 7/9 net: ipa: start generalizing "ipa_reg"
In reply to Alex ElderIPA register definitions have evolved with each new version. The changes required to support more than 32 endpoints in IPA v5.0 made it best to define a unified mechanism for defining registers and their fields.
GSI register definitions, meanwhile, have remained fairly stable. And even as the total number of IPA endpoints goes beyond 32, the number of GSI channels on a given EE that underly endpoints still remains 32 or less.
Despite that, GSI v3.0 (which is used with IPA v5.0) extends the number of channels (and events) it supports to be about 256, and as a result, many GSI register definitions must change significantly. To address this, we'll use the same "ipa_reg" mechanism to define the GSI registers.
As a first step in generalizing the "ipa_reg" to also support GSI registers, isolate the definitions of the "ipa_reg" and "ipa_regs" structure types (and some supporting macros) into a new header file, and remove the "ipa_" and "IPA_" from symbol names.
Separate the IPA register ID validity checking from the generic check that a register ID is in range. Aside from that, this is intended to have no functional effect on the code.
---
Note: The reg() function generates a spurious checkpatch warning.
drivers/net/ipa/ipa.h | 2 +- drivers/net/ipa/ipa_cmd.c | 2 +- drivers/net/ipa/ipa_endpoint.c | 48 ++--- drivers/net/ipa/ipa_interrupt.c | 12 +- drivers/net/ipa/ipa_main.c | 18 +- drivers/net/ipa/ipa_mem.c | 4 +- drivers/net/ipa/ipa_reg.c | 48 ++--- drivers/net/ipa/ipa_reg.h | 81 ++------ drivers/net/ipa/ipa_resource.c | 6 +- drivers/net/ipa/ipa_table.c | 6 +- drivers/net/ipa/ipa_uc.c | 2 +- drivers/net/ipa/reg.h | 70 +++++++ drivers/net/ipa/reg/ipa_reg-v3.1.c | 277 +++++++++++++------------- drivers/net/ipa/reg/ipa_reg-v3.5.1.c | 263 +++++++++++++------------ drivers/net/ipa/reg/ipa_reg-v4.11.c | 265 +++++++++++++------------ drivers/net/ipa/reg/ipa_reg-v4.2.c | 249 ++++++++++++------------ drivers/net/ipa/reg/ipa_reg-v4.5.c | 281 +++++++++++++-------------- drivers/net/ipa/reg/ipa_reg-v4.7.c | 265 +++++++++++++------------ drivers/net/ipa/reg/ipa_reg-v4.9.c | 265 +++++++++++++------------ 19 files changed, 1080 insertions(+), 1084 deletions(-) create mode 100644 drivers/net/ipa/reg.h
drivers/net/ipa/ipa.h +1 -1
@@ -97,7 +97,7 @@ struct ipa {bool uc_loaded;void __iomem *reg_virt; -const struct ipa_regs *regs; +const struct regs *regs;dma_addr_t mem_addr;void *mem_virt;
drivers/net/ipa/ipa_cmd.c +1 -1
@@ -287,7 +287,7 @@ static bool ipa_cmd_register_write_offset_valid(struct ipa *ipa,/* Check whether offsets passed to register_write are valid */ static bool ipa_cmd_register_write_valid (struct ipa *ipa) { -const struct ipa_reg *reg; +const struct reg *reg;const char *name;u32 offset;
drivers/net/ipa/ipa_endpoint.c +24 -24
192 lines not on this page · raw message
drivers/net/ipa/ipa_interrupt.c +6 -6
@@ -47,7 +47,7 @@ struct ipa_interrupt {static void ipa_interrupt_process (struct ipa_interrupt *interrupt,u32 irq_id) {struct ipa *ipa = interrupt->ipa; -const struct ipa_reg *reg; +const struct reg *reg;u32 mask =BIT (irq_id);u32 offset;
@@ -85,7 +85,7 @@ static irqreturn_t ipa_isr_thread(int irq, void *dev_id)struct ipa_interrupt *interrupt = dev_id;struct ipa *ipa = interrupt->ipa;u32 enabled = interrupt->enabled; -const struct ipa_reg *reg; +const struct reg *reg;struct device *dev;u32 pending;u32 offset;
@@ -132,7 +132,7 @@ static irqreturn_t ipa_isr_thread(int irq, void *dev_id)static void ipa_interrupt_enabled_update (struct ipa *ipa) { -const struct ipa_reg *reg =ipa_reg (ipa,IPA_IRQ_EN ); +const struct reg *reg =ipa_reg (ipa,IPA_IRQ_EN );iowrite32 (ipa->interrupt->enabled, ipa->reg_virt +ipa_reg_offset (reg)); }
@@ -170,7 +170,7 @@ static void ipa_interrupt_suspend_control(struct ipa_interrupt *interrupt,struct ipa *ipa = interrupt->ipa;u32 mask =BIT (endpoint_id %32 );u32 unit = endpoint_id /32 ; -const struct ipa_reg *reg; +const struct reg *reg;u32 offset;u32 val;
@@ -215,7 +215,7 @@ void ipa_interrupt_suspend_clear_all(struct ipa_interrupt *interrupt) unit_count =roundup (ipa->endpoint_count,32 );for (unit =0 ; unit < unit_count; unit++) { -const struct ipa_reg *reg; +const struct reg *reg;u32 val; reg =ipa_reg (ipa,IRQ_SUSPEND_INFO );
@@ -241,7 +241,7 @@ struct ipa_interrupt *ipa_interrupt_config(struct ipa *ipa) {struct device *dev = &ipa->pdev->dev;struct ipa_interrupt *interrupt; -const struct ipa_reg *reg; +const struct reg *reg;unsigned int irq;int ret;
drivers/net/ipa/ipa_main.c +9 -9
@@ -203,7 +203,7 @@ static void ipa_teardown(struct ipa *ipa)static void ipa_hardware_config_bcr (struct ipa *ipa,const struct ipa_data *data) { -const struct ipa_reg *reg; +const struct reg *reg;u32 val;/* IPA v4.5+ has no backward compatibility register */
@@ -218,7 +218,7 @@ ipa_hardware_config_bcr(struct ipa *ipa, const struct ipa_data *data)static void ipa_hardware_config_tx (struct ipa *ipa) {enum ipa_version version = ipa->version; -const struct ipa_reg *reg; +const struct reg *reg;u32 offset;u32 val;
@@ -239,7 +239,7 @@ static void ipa_hardware_config_tx(struct ipa *ipa)static void ipa_hardware_config_clkon (struct ipa *ipa) {enum ipa_version version = ipa->version; -const struct ipa_reg *reg; +const struct reg *reg;u32 val;if (version >=IPA_VERSION_4_5 )
@@ -265,7 +265,7 @@ static void ipa_hardware_config_clkon(struct ipa *ipa)/* Configure bus access behavior for IPA components */ static void ipa_hardware_config_comp (struct ipa *ipa) { -const struct ipa_reg *reg; +const struct reg *reg;u32 offset;u32 val;
@@ -299,7 +299,7 @@ ipa_hardware_config_qsb(struct ipa *ipa, const struct ipa_data *data) {const struct ipa_qsb_data *data0;const struct ipa_qsb_data *data1; -const struct ipa_reg *reg; +const struct reg *reg;u32 val;/* QMB 0 represents DDR; QMB 1 (if present) represents PCIe */
@@ -368,7 +368,7 @@ static __always_inline u32 ipa_aggr_granularity_val(u32 usec)*/ static void ipa_qtime_config (struct ipa *ipa) { -const struct ipa_reg *reg; +const struct reg *reg;u32 offset;u32 val;
@@ -416,7 +416,7 @@ static void ipa_qtime_config(struct ipa *ipa)static void ipa_hardware_config_counter (struct ipa *ipa) {u32 granularity =ipa_aggr_granularity_val (IPA_AGGR_GRANULARITY ); -const struct ipa_reg *reg; +const struct reg *reg;u32 val; reg =ipa_reg (ipa,COUNTER_CFG );
@@ -435,7 +435,7 @@ static void ipa_hardware_config_timing(struct ipa *ipa)static void ipa_hardware_config_hashing (struct ipa *ipa) { -const struct ipa_reg *reg; +const struct reg *reg;/* Other than IPA v4.2, all versions enable "hashing". Starting * with IPA v5.0, the filter and router tables are implemented
@@ -458,7 +458,7 @@ static void ipa_idle_indication_cfg(struct ipa *ipa, u32 enter_idle_debounce_thresh, bool const_non_idle_enable) { -const struct ipa_reg *reg; +const struct reg *reg;u32 val;if (ipa->version <IPA_VERSION_3_5_1 )
drivers/net/ipa/ipa_mem.c +2 -2
@@ -75,7 +75,7 @@ ipa_mem_zero_region_add(struct gsi_trans *trans, enum ipa_mem_id mem_id)int ipa_mem_setup (struct ipa *ipa) {dma_addr_t addr = ipa->zero_addr; -const struct ipa_reg *reg; +const struct reg *reg;const struct ipa_mem *mem;struct gsi_trans *trans;u32 offset;
@@ -318,8 +318,8 @@ static bool ipa_mem_size_valid(struct ipa *ipa)int ipa_mem_config (struct ipa *ipa) {struct device *dev = &ipa->pdev->dev; -const struct ipa_reg *reg;const struct ipa_mem *mem; +const struct reg *reg;dma_addr_t addr;u32 mem_size;void *virt;
drivers/net/ipa/ipa_reg.c +15 -33
99 lines not on this page · raw message
drivers/net/ipa/ipa_reg.h +16 -65
138 lines not on this page · raw message
drivers/net/ipa/ipa_resource.c +3 -3
@@ -70,7 +70,7 @@ static bool ipa_resource_limits_valid(struct ipa *ipa,static void ipa_resource_config_common (struct ipa *ipa,u32 resource_type, -const struct ipa_reg *reg, +const struct reg *reg,const struct ipa_resource_limits *xlimits,const struct ipa_resource_limits *ylimits) {
@@ -92,7 +92,7 @@ static void ipa_resource_config_src(struct ipa *ipa, u32 resource_type,u32 group_count = data->rsrc_group_src_count;const struct ipa_resource_limits *ylimits;const struct ipa_resource *resource; -const struct ipa_reg *reg; +const struct reg *reg; resource = &data->resource_src[resource_type];
@@ -129,7 +129,7 @@ static void ipa_resource_config_dst(struct ipa *ipa, u32 resource_type,u32 group_count = data->rsrc_group_dst_count;const struct ipa_resource_limits *ylimits;const struct ipa_resource *resource; -const struct ipa_reg *reg; +const struct reg *reg; resource = &data->resource_dst[resource_type];
drivers/net/ipa/ipa_table.c +3 -3
@@ -345,8 +345,8 @@ void ipa_table_reset(struct ipa *ipa, bool modem)int ipa_table_hash_flush (struct ipa *ipa) { -const struct ipa_reg *reg;struct gsi_trans *trans; +const struct reg *reg;u32 offset;u32 val;
@@ -495,7 +495,7 @@ static void ipa_filter_tuple_zero(struct ipa_endpoint *endpoint) {u32 endpoint_id = endpoint->endpoint_id;struct ipa *ipa = endpoint->ipa; -const struct ipa_reg *reg; +const struct reg *reg;u32 offset;u32 val;
@@ -554,7 +554,7 @@ static bool ipa_route_id_modem(struct ipa *ipa, u32 route_id)*/ static void ipa_route_tuple_zero (struct ipa *ipa,u32 route_id) { -const struct ipa_reg *reg; +const struct reg *reg;u32 offset;u32 val;
drivers/net/ipa/ipa_uc.c +1 -1
@@ -231,7 +231,7 @@ void ipa_uc_power(struct ipa *ipa)static void send_uc_command (struct ipa *ipa,u32 command,u32 command_param) {struct ipa_uc_mem_area *shared =ipa_uc_shared (ipa); -const struct ipa_reg *reg; +const struct reg *reg;u32 val;/* Fill in the command data */
drivers/net/ipa/reg.h new file +70 -0
70 lines not on this page · raw message
drivers/net/ipa/reg/ipa_reg-v3.1.c +138 -139
513 lines not on this page · raw message
drivers/net/ipa/reg/ipa_reg-v3.5.1.c +131 -132
491 lines not on this page · raw message
drivers/net/ipa/reg/ipa_reg-v4.11.c +132 -133
503 lines not on this page · raw message
drivers/net/ipa/reg/ipa_reg-v4.2.c +124 -125
468 lines not on this page · raw message
drivers/net/ipa/reg/ipa_reg-v4.5.c +140 -141
316 lines not on this page · raw message
drivers/net/ipa/reg/ipa_reg-v4.7.c +132 -133
265 lines not on this page · raw message
drivers/net/ipa/reg/ipa_reg-v4.9.c +132 -133
265 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.34.1
Part of the diff is not shown here. View the raw message.
PATCH 9/9 net: ipa: generalize register field functions
In reply to Alex ElderRename functions related to register fields so they don't appear to be IPA-specific, and move their definitions into "reg.h":
ipa_reg_fmask() -> reg_fmask()
ipa_reg_bit() -> reg_bit()
ipa_reg_field_max() -> reg_field_max()
ipa_reg_encode() -> reg_encode()
ipa_reg_decode() -> reg_decode()--- drivers/net/ipa/ipa_endpoint.c | 119 ++++++++++++++++----------------- drivers/net/ipa/ipa_main.c | 68 +++++++++---------- drivers/net/ipa/ipa_mem.c | 6 +- drivers/net/ipa/ipa_reg.h | 56 +--------------- drivers/net/ipa/ipa_resource.c | 8 +-- drivers/net/ipa/ipa_table.c | 16 ++--- drivers/net/ipa/ipa_uc.c | 2 +- drivers/net/ipa/reg.h | 51 ++++++++++++++ 8 files changed, 161 insertions(+), 165 deletions(-)
drivers/net/ipa/ipa_endpoint.c +59 -60
@@ -304,7 +304,7 @@ static bool ipa_endpoint_data_valid_one(struct ipa *ipa, u32 count, rx_config->aggr_hard_limit); reg =ipa_reg (ipa,ENDP_INIT_AGGR ); - limit =ipa_reg_field_max (reg,BYTE_LIMIT ); + limit =reg_field_max (reg,BYTE_LIMIT );if (aggr_size > limit) {dev_err (dev,"aggregated size too large for RX endpoint %u (%u KB > %u KB)\n" , data->endpoint_id, aggr_size, limit);
@@ -464,7 +464,7 @@ ipa_endpoint_init_ctrl(struct ipa_endpoint *endpoint, bool suspend_delay) val =ioread32 (ipa->reg_virt + offset); field_id = endpoint->toward_ipa ?ENDP_DELAY :ENDP_SUSPEND ; - mask =ipa_reg_bit (reg, field_id); + mask =reg_bit (reg, field_id); state = !!(val & mask);
@@ -658,7 +658,7 @@ static void ipa_endpoint_init_cfg(struct ipa_endpoint *endpoint)/* Checksum header offset is in 4-byte units */ off =sizeof (struct rmnet_map_header ) /sizeof (u32); - val |=ipa_reg_encode (reg,CS_METADATA_HDR_OFFSET , off); + val |=reg_encode (reg,CS_METADATA_HDR_OFFSET , off); enabled = version <IPA_VERSION_4_5 ? IPA_CS_OFFLOAD_UL
@@ -671,7 +671,7 @@ static void ipa_endpoint_init_cfg(struct ipa_endpoint *endpoint) }else { enabled =IPA_CS_OFFLOAD_NONE ; } - val |=ipa_reg_encode (reg,CS_OFFLOAD_EN , enabled); + val |=reg_encode (reg,CS_OFFLOAD_EN , enabled);/* CS_GEN_QMB_MASTER_SEL is 0 */ iowrite32 (val, ipa->reg_virt +reg_n_offset (reg, endpoint_id));
@@ -688,7 +688,7 @@ static void ipa_endpoint_init_nat(struct ipa_endpoint *endpoint)return ; reg =ipa_reg (ipa,ENDP_INIT_NAT ); - val =ipa_reg_encode (reg,NAT_EN ,IPA_NAT_TYPE_BYPASS ); + val =reg_encode (reg,NAT_EN ,IPA_NAT_TYPE_BYPASS );iowrite32 (val, ipa->reg_virt +reg_n_offset (reg, endpoint_id)); }
@@ -718,11 +718,11 @@ ipa_qmap_header_size(enum ipa_version version, struct ipa_endpoint *endpoint)static u32 ipa_header_size_encode (enum ipa_version version,const struct reg *reg,u32 header_size) { -u32 field_max =ipa_reg_field_max (reg,HDR_LEN ); +u32 field_max =reg_field_max (reg,HDR_LEN );u32 val;/* We know field_max can be used as a mask (2^n - 1) */ - val =ipa_reg_encode (reg,HDR_LEN , header_size & field_max); + val =reg_encode (reg,HDR_LEN , header_size & field_max);if (version <IPA_VERSION_4_5 ) {WARN_ON (header_size > field_max);return val;
@@ -730,8 +730,8 @@ static u32 ipa_header_size_encode(enum ipa_version version,/* IPA v4.5 adds a few more most-significant bits */ header_size >>=hweight32 (field_max); -WARN_ON (header_size >ipa_reg_field_max (reg,HDR_LEN_MSB )); - val |=ipa_reg_encode (reg,HDR_LEN_MSB , header_size); +WARN_ON (header_size >reg_field_max (reg,HDR_LEN_MSB )); + val |=reg_encode (reg,HDR_LEN_MSB , header_size);return val; }
@@ -740,11 +740,11 @@ static u32 ipa_header_size_encode(enum ipa_version version,static u32 ipa_metadata_offset_encode (enum ipa_version version,const struct reg *reg,u32 offset) { -u32 field_max =ipa_reg_field_max (reg,HDR_OFST_METADATA ); +u32 field_max =reg_field_max (reg,HDR_OFST_METADATA );u32 val;/* We know field_max can be used as a mask (2^n - 1) */ - val =ipa_reg_encode (reg,HDR_OFST_METADATA , offset); + val =reg_encode (reg,HDR_OFST_METADATA , offset);if (version <IPA_VERSION_4_5 ) {WARN_ON (offset > field_max);return val;
@@ -752,8 +752,8 @@ static u32 ipa_metadata_offset_encode(enum ipa_version version,/* IPA v4.5 adds a few more most-significant bits */ offset >>=hweight32 (field_max); -WARN_ON (offset >ipa_reg_field_max (reg,HDR_OFST_METADATA_MSB )); - val |=ipa_reg_encode (reg,HDR_OFST_METADATA_MSB , offset); +WARN_ON (offset >reg_field_max (reg,HDR_OFST_METADATA_MSB )); + val |=reg_encode (reg,HDR_OFST_METADATA_MSB , offset);return val; }
@@ -806,13 +806,13 @@ static void ipa_endpoint_init_hdr(struct ipa_endpoint *endpoint) off = offsetof(struct rmnet_map_header , pkt_len);/* Upper bits are stored in HDR_EXT with IPA v4.5 */ if (version >=IPA_VERSION_4_5 ) - off &=ipa_reg_field_max (reg,HDR_OFST_PKT_SIZE ); + off &=reg_field_max (reg,HDR_OFST_PKT_SIZE ); - val |=ipa_reg_bit (reg,HDR_OFST_PKT_SIZE_VALID ); - val |=ipa_reg_encode (reg,HDR_OFST_PKT_SIZE , off); + val |=reg_bit (reg,HDR_OFST_PKT_SIZE_VALID ); + val |=reg_encode (reg,HDR_OFST_PKT_SIZE , off); }/* For QMAP TX, metadata offset is 0 (modem assumes this) */ - val |=ipa_reg_bit (reg,HDR_OFST_METADATA_VALID ); + val |=reg_bit (reg,HDR_OFST_METADATA_VALID );/* HDR_ADDITIONAL_CONST_LEN is 0; (RX only) */ /* HDR_A5_MUX is 0 */
@@ -834,7 +834,7 @@ static void ipa_endpoint_init_hdr_ext(struct ipa_endpoint *endpoint) reg =ipa_reg (ipa,ENDP_INIT_HDR_EXT );if (endpoint->config.qmap) {/* We have a header, so we must specify its endianness */ - val |=ipa_reg_bit (reg,HDR_ENDIANNESS );/* big endian */ + val |=reg_bit (reg,HDR_ENDIANNESS );/* big endian */ /* A QMAP header contains a 6 bit pad field at offset 0. * The RMNet driver assumes this field is meaningful in
@@ -844,16 +844,16 @@ static void ipa_endpoint_init_hdr_ext(struct ipa_endpoint *endpoint)* (although 0) should be ignored. */ if (!endpoint->toward_ipa) { - val |=ipa_reg_bit (reg,HDR_TOTAL_LEN_OR_PAD_VALID ); + val |=reg_bit (reg,HDR_TOTAL_LEN_OR_PAD_VALID );/* HDR_TOTAL_LEN_OR_PAD is 0 (pad, not total_len) */ - val |=ipa_reg_bit (reg,HDR_PAYLOAD_LEN_INC_PADDING ); + val |=reg_bit (reg,HDR_PAYLOAD_LEN_INC_PADDING );/* HDR_TOTAL_LEN_OR_PAD_OFFSET is 0 */ } }/* HDR_PAYLOAD_LEN_INC_PADDING is 0 */ if (!endpoint->toward_ipa) - val |=ipa_reg_encode (reg,HDR_PAD_TO_ALIGNMENT , pad_align); + val |=reg_encode (reg,HDR_PAD_TO_ALIGNMENT , pad_align);/* IPA v4.5 adds some most-significant bits to a few fields, * two of which are defined in the HDR (not HDR_EXT) register.
@@ -861,13 +861,13 @@ static void ipa_endpoint_init_hdr_ext(struct ipa_endpoint *endpoint)if (ipa->version >=IPA_VERSION_4_5 ) {/* HDR_TOTAL_LEN_OR_PAD_OFFSET is 0, so MSB is 0 */ if (endpoint->config.qmap && !endpoint->toward_ipa) { -u32 mask =ipa_reg_field_max (reg,HDR_OFST_PKT_SIZE ); +u32 mask =reg_field_max (reg,HDR_OFST_PKT_SIZE );u32 off;/* Field offset within header */ off = offsetof(struct rmnet_map_header , pkt_len);/* Low bits are in the ENDP_INIT_HDR register */ off >>=hweight32 (mask); - val |=ipa_reg_encode (reg,HDR_OFST_PKT_SIZE_MSB , off); + val |=reg_encode (reg,HDR_OFST_PKT_SIZE_MSB , off);/* HDR_ADDITIONAL_CONST_LEN is 0 so MSB is 0 */ } }
@@ -911,10 +911,10 @@ static void ipa_endpoint_init_mode(struct ipa_endpoint *endpoint)enum ipa_endpoint_name name = endpoint->config.dma_endpoint;u32 dma_endpoint_id = ipa->name_map[name]->endpoint_id; - val =ipa_reg_encode (reg,ENDP_MODE ,IPA_DMA ); - val |=ipa_reg_encode (reg,DEST_PIPE_INDEX , dma_endpoint_id); + val =reg_encode (reg,ENDP_MODE ,IPA_DMA ); + val |=reg_encode (reg,DEST_PIPE_INDEX , dma_endpoint_id); }else { - val =ipa_reg_encode (reg,ENDP_MODE ,IPA_BASIC ); + val =reg_encode (reg,ENDP_MODE ,IPA_BASIC ); }/* All other bits unspecified (and 0) */
@@ -972,14 +972,14 @@ static u32 aggr_time_limit_encode(struct ipa *ipa, const struct reg *reg,if (!microseconds)return 0 ;/* Nothing to compute if time limit is 0 */ - max =ipa_reg_field_max (reg,TIME_LIMIT ); + max =reg_field_max (reg,TIME_LIMIT );if (ipa->version >=IPA_VERSION_4_5 ) {u32 select; ticks =ipa_qtime_val (ipa, microseconds, max, &select); -return ipa_reg_encode (reg,AGGR_GRAN_SEL , select) | -ipa_reg_encode (reg,TIME_LIMIT , ticks); +return reg_encode (reg,AGGR_GRAN_SEL , select) | +reg_encode (reg,TIME_LIMIT , ticks); }/* We program aggregation granularity in ipa_hardware_config() */
@@ -987,7 +987,7 @@ static u32 aggr_time_limit_encode(struct ipa *ipa, const struct reg *reg,WARN (ticks > max,"aggr_time_limit too large (%u > %u usec)\n" , microseconds, max *IPA_AGGR_GRANULARITY ); -return ipa_reg_encode (reg,TIME_LIMIT , ticks); +return reg_encode (reg,TIME_LIMIT , ticks); }static void ipa_endpoint_init_aggr (struct ipa_endpoint *endpoint)
@@ -1005,13 +1005,13 @@ static void ipa_endpoint_init_aggr(struct ipa_endpoint *endpoint)u32 limit; rx_config = &endpoint->config.rx; - val |=ipa_reg_encode (reg,AGGR_EN ,IPA_ENABLE_AGGR ); - val |=ipa_reg_encode (reg,AGGR_TYPE ,IPA_GENERIC ); + val |=reg_encode (reg,AGGR_EN ,IPA_ENABLE_AGGR ); + val |=reg_encode (reg,AGGR_TYPE ,IPA_GENERIC ); buffer_size = rx_config->buffer_size; limit =ipa_aggr_size_kb (buffer_size -NET_SKB_PAD , rx_config->aggr_hard_limit); - val |=ipa_reg_encode (reg,BYTE_LIMIT , limit); + val |=reg_encode (reg,BYTE_LIMIT , limit); limit = rx_config->aggr_time_limit; val |=aggr_time_limit_encode (ipa, reg, limit);
@@ -1019,16 +1019,16 @@ static void ipa_endpoint_init_aggr(struct ipa_endpoint *endpoint)/* AGGR_PKT_LIMIT is 0 (unlimited) */ if (rx_config->aggr_close_eof) - val |=ipa_reg_bit (reg,SW_EOF_ACTIVE ); + val |=reg_bit (reg,SW_EOF_ACTIVE ); }else { - val |=ipa_reg_encode (reg,AGGR_EN ,IPA_ENABLE_DEAGGR ); - val |=ipa_reg_encode (reg,AGGR_TYPE ,IPA_QCMAP ); + val |=reg_encode (reg,AGGR_EN ,IPA_ENABLE_DEAGGR ); + val |=reg_encode (reg,AGGR_TYPE ,IPA_QCMAP );/* other fields ignored */ }/* AGGR_FORCE_CLOSE is 0 */ /* AGGR_GRAN_SEL is 0 for IPA v4.5 */ }else { - val |=ipa_reg_encode (reg,AGGR_EN ,IPA_BYPASS_AGGR ); + val |=reg_encode (reg,AGGR_EN ,IPA_BYPASS_AGGR );/* other fields ignored */ }
@@ -1057,14 +1057,14 @@ static u32 hol_block_timer_encode(struct ipa *ipa, const struct reg *reg,return 0 ;/* Nothing to compute if timer period is 0 */ if (ipa->version >=IPA_VERSION_4_5 ) { -u32 max =ipa_reg_field_max (reg,TIMER_LIMIT ); +u32 max =reg_field_max (reg,TIMER_LIMIT );u32 select;u32 ticks; ticks =ipa_qtime_val (ipa, microseconds, max, &select); -return ipa_reg_encode (reg,TIMER_GRAN_SEL ,1 ) | -ipa_reg_encode (reg,TIMER_LIMIT , ticks); +return reg_encode (reg,TIMER_GRAN_SEL ,1 ) | +reg_encode (reg,TIMER_LIMIT , ticks); }/* Use 64 bit arithmetic to avoid overflow */
@@ -1072,11 +1072,11 @@ static u32 hol_block_timer_encode(struct ipa *ipa, const struct reg *reg, ticks =DIV_ROUND_CLOSEST (microseconds * rate,128 *USEC_PER_SEC );/* We still need the result to fit into the field */ -WARN_ON (ticks >ipa_reg_field_max (reg,TIMER_BASE_VALUE )); +WARN_ON (ticks >reg_field_max (reg,TIMER_BASE_VALUE ));/* IPA v3.5.1 through v4.1 just record the tick count */ if (ipa->version <IPA_VERSION_4_2 ) -return ipa_reg_encode (reg,TIMER_BASE_VALUE , (u32 )ticks); +return reg_encode (reg,TIMER_BASE_VALUE , (u32 )ticks);/* For IPA v4.2, the tick count is represented by base and * scale fields within the 32-bit timer register, where:
@@ -1087,7 +1087,7 @@ static u32 hol_block_timer_encode(struct ipa *ipa, const struct reg *reg,* such that high bit is included. */ high =fls (ticks);/* 1..32 (or warning above) */ - width =hweight32 (ipa_reg_fmask (reg,TIMER_BASE_VALUE )); + width =hweight32 (reg_fmask (reg,TIMER_BASE_VALUE )); scale = high > width ? high - width :0 ;if (scale) {/* If we're scaling, round up to get a closer result */
@@ -1097,8 +1097,8 @@ static u32 hol_block_timer_encode(struct ipa *ipa, const struct reg *reg, scale++; } - val =ipa_reg_encode (reg,TIMER_SCALE , scale); - val |=ipa_reg_encode (reg,TIMER_BASE_VALUE , (u32 )ticks >> scale); + val =reg_encode (reg,TIMER_SCALE , scale); + val |=reg_encode (reg,TIMER_BASE_VALUE , (u32 )ticks >> scale);return val; }
@@ -1130,7 +1130,7 @@ ipa_endpoint_init_hol_block_en(struct ipa_endpoint *endpoint, bool enable) reg =ipa_reg (ipa,ENDP_INIT_HOL_BLOCK_EN ); offset =reg_n_offset (reg, endpoint_id); - val = enable ?ipa_reg_bit (reg,HOL_BLOCK_EN ) :0 ; + val = enable ?reg_bit (reg,HOL_BLOCK_EN ) :0 ;iowrite32 (val, ipa->reg_virt + offset);
@@ -1195,7 +1195,7 @@ static void ipa_endpoint_init_rsrc_grp(struct ipa_endpoint *endpoint)u32 val; reg =ipa_reg (ipa,ENDP_INIT_RSRC_GRP ); - val =ipa_reg_encode (reg,ENDP_RSRC_GRP , resource_group); + val =reg_encode (reg,ENDP_RSRC_GRP , resource_group);iowrite32 (val, ipa->reg_virt +reg_n_offset (reg, endpoint_id)); }
@@ -1213,12 +1213,12 @@ static void ipa_endpoint_init_seq(struct ipa_endpoint *endpoint) reg =ipa_reg (ipa,ENDP_INIT_SEQ );/* Low-order byte configures primary packet processing */ - val =ipa_reg_encode (reg,SEQ_TYPE , endpoint->config.tx.seq_type); + val =reg_encode (reg,SEQ_TYPE , endpoint->config.tx.seq_type);/* Second byte (if supported) configures replicated packet processing */ if (ipa->version <IPA_VERSION_4_5 ) - val |=ipa_reg_encode (reg,SEQ_REP_TYPE , - endpoint->config.tx.seq_rep_type); + val |=reg_encode (reg,SEQ_REP_TYPE , + endpoint->config.tx.seq_rep_type);iowrite32 (val, ipa->reg_virt +reg_n_offset (reg, endpoint_id)); }
@@ -1275,7 +1275,7 @@ static void ipa_endpoint_status(struct ipa_endpoint *endpoint) reg =ipa_reg (ipa,ENDP_STATUS );if (endpoint->config.status_enable) { - val |=ipa_reg_bit (reg,STATUS_EN ); + val |=reg_bit (reg,STATUS_EN );if (endpoint->toward_ipa) {enum ipa_endpoint_name name;u32 status_endpoint_id;
@@ -1283,8 +1283,7 @@ static void ipa_endpoint_status(struct ipa_endpoint *endpoint) name = endpoint->config.tx.status_endpoint; status_endpoint_id = ipa->name_map[name]->endpoint_id; - val |=ipa_reg_encode (reg,STATUS_ENDP , - status_endpoint_id); + val |=reg_encode (reg,STATUS_ENDP , status_endpoint_id); }/* STATUS_LOCATION is 0, meaning IPA packet status * precedes the packet (not present for IPA v4.5+)
@@ -1641,11 +1640,11 @@ void ipa_endpoint_default_route_set(struct ipa *ipa, u32 endpoint_id) reg =ipa_reg (ipa,ROUTE );/* ROUTE_DIS is 0 */ - val =ipa_reg_encode (reg,ROUTE_DEF_PIPE , endpoint_id); - val |=ipa_reg_bit (reg,ROUTE_DEF_HDR_TABLE ); + val =reg_encode (reg,ROUTE_DEF_PIPE , endpoint_id); + val |=reg_bit (reg,ROUTE_DEF_HDR_TABLE );/* ROUTE_DEF_HDR_OFST is 0 */ - val |=ipa_reg_encode (reg,ROUTE_FRAG_DEF_PIPE , endpoint_id); - val |=ipa_reg_bit (reg,ROUTE_DEF_RETAIN_HDR ); + val |=reg_encode (reg,ROUTE_FRAG_DEF_PIPE , endpoint_id); + val |=reg_bit (reg,ROUTE_DEF_RETAIN_HDR );iowrite32 (val, ipa->reg_virt +reg_offset (reg)); }
@@ -2022,9 +2021,9 @@ int ipa_endpoint_config(struct ipa *ipa) val =ioread32 (ipa->reg_virt +reg_offset (reg));/* Our RX is an IPA producer; our TX is an IPA consumer. */ - tx_count =ipa_reg_decode (reg,MAX_CONS_PIPES , val); - rx_count =ipa_reg_decode (reg,MAX_PROD_PIPES , val); - rx_base =ipa_reg_decode (reg,PROD_LOWEST , val); + tx_count =reg_decode (reg,MAX_CONS_PIPES , val); + rx_count =reg_decode (reg,MAX_PROD_PIPES , val); + rx_base =reg_decode (reg,PROD_LOWEST , val); limit = rx_base + rx_count;if (limit >IPA_ENDPOINT_MAX ) {
drivers/net/ipa/ipa_main.c +33 -35
146 lines not on this page · raw message
drivers/net/ipa/ipa_mem.c +3 -3
@@ -115,7 +115,7 @@ int ipa_mem_setup(struct ipa *ipa) offset = ipa->mem_offset + mem->offset; reg =ipa_reg (ipa,LOCAL_PKT_PROC_CNTXT ); - val =ipa_reg_encode (reg,IPA_BASE_ADDR , offset); + val =reg_encode (reg,IPA_BASE_ADDR , offset);iowrite32 (val, ipa->reg_virt +reg_offset (reg));return 0 ;
@@ -331,10 +331,10 @@ int ipa_mem_config(struct ipa *ipa) val =ioread32 (ipa->reg_virt +reg_offset (reg));/* The fields in the register are in 8 byte units */ - ipa->mem_offset =8 *ipa_reg_decode (reg,MEM_BADDR , val); + ipa->mem_offset =8 *reg_decode (reg,MEM_BADDR , val);/* Make sure the end is within the region's mapped space */ - mem_size =8 *ipa_reg_decode (reg,MEM_SIZE , val); + mem_size =8 *reg_decode (reg,MEM_SIZE , val);/* If the sizes don't match, issue a warning */ if (ipa->mem_offset + mem_size < ipa->mem_size) {
drivers/net/ipa/ipa_reg.h +2 -54
69 lines not on this page · raw message
drivers/net/ipa/ipa_resource.c +4 -4
@@ -76,11 +76,11 @@ ipa_resource_config_common(struct ipa *ipa, u32 resource_type, {u32 val; - val =ipa_reg_encode (reg,X_MIN_LIM , xlimits->min); - val |=ipa_reg_encode (reg,X_MAX_LIM , xlimits->max); + val =reg_encode (reg,X_MIN_LIM , xlimits->min); + val |=reg_encode (reg,X_MAX_LIM , xlimits->max);if (ylimits) { - val |=ipa_reg_encode (reg,Y_MIN_LIM , ylimits->min); - val |=ipa_reg_encode (reg,Y_MAX_LIM , ylimits->max); + val |=reg_encode (reg,Y_MIN_LIM , ylimits->min); + val |=reg_encode (reg,Y_MAX_LIM , ylimits->max); }iowrite32 (val, ipa->reg_virt +reg_n_offset (reg, resource_type));
drivers/net/ipa/ipa_table.c +8 -8
@@ -361,16 +361,16 @@ int ipa_table_hash_flush(struct ipa *ipa)if (ipa->version <IPA_VERSION_5_0 ) { reg =ipa_reg (ipa,FILT_ROUT_HASH_FLUSH ); - val =ipa_reg_bit (reg,IPV6_ROUTER_HASH ); - val |=ipa_reg_bit (reg,IPV6_FILTER_HASH ); - val |=ipa_reg_bit (reg,IPV4_ROUTER_HASH ); - val |=ipa_reg_bit (reg,IPV4_FILTER_HASH ); + val =reg_bit (reg,IPV6_ROUTER_HASH ); + val |=reg_bit (reg,IPV6_FILTER_HASH ); + val |=reg_bit (reg,IPV4_ROUTER_HASH ); + val |=reg_bit (reg,IPV4_FILTER_HASH ); }else { reg =ipa_reg (ipa,FILT_ROUT_CACHE_FLUSH );/* IPA v5.0+ uses a unified cache (both IPv4 and IPv6) */ - val =ipa_reg_bit (reg,ROUTER_CACHE ); - val |=ipa_reg_bit (reg,FILTER_CACHE ); + val =reg_bit (reg,ROUTER_CACHE ); + val |=reg_bit (reg,FILTER_CACHE ); }ipa_cmd_register_write_add (trans,reg_offset (reg), val, val, false);
@@ -503,7 +503,7 @@ static void ipa_filter_tuple_zero(struct ipa_endpoint *endpoint) val =ioread32 (endpoint->ipa->reg_virt + offset);/* Zero all filter-related fields, preserving the rest */ - val &= ~ipa_reg_fmask (reg,FILTER_HASH_MSK_ALL ); + val &= ~reg_fmask (reg,FILTER_HASH_MSK_ALL ); }else {/* IPA v5.0 separates filter and router cache configuration */ reg =ipa_reg (ipa,ENDP_FILTER_CACHE_CFG );
@@ -562,7 +562,7 @@ static void ipa_route_tuple_zero(struct ipa *ipa, u32 route_id) val =ioread32 (ipa->reg_virt + offset);/* Zero all route-related fields, preserving the rest */ - val &= ~ipa_reg_fmask (reg,ROUTER_HASH_MSK_ALL ); + val &= ~reg_fmask (reg,ROUTER_HASH_MSK_ALL ); }else {/* IPA v5.0 separates filter and router cache configuration */ reg =ipa_reg (ipa,ENDP_ROUTER_CACHE_CFG );
drivers/net/ipa/ipa_uc.c +1 -1
@@ -243,7 +243,7 @@ static void send_uc_command(struct ipa *ipa, u32 command, u32 command_param)/* Use an interrupt to tell the microcontroller the command is ready */ reg =ipa_reg (ipa,IPA_IRQ_UC ); - val =ipa_reg_bit (reg,UC_INTR ); + val =reg_bit (reg,UC_INTR );iowrite32 (val, ipa->reg_virt +reg_offset (reg)); }
drivers/net/ipa/reg.h +51 -0
57 lines not on this page · raw message
Signature · 1 line
2.34.1
This series was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:
Quoted 6 lines · On Wed, 8 Feb 2023 14:56:44 -0600 you wrote:
An upcoming series (or two) will convert the definitions of GSI registers used by IPA so they use the "IPA reg" mechanism to specify register offsets and their fields. This will simplify implementing the fairly large number of changes required in GSI registers to support more than 32 GSI channels (introduced in IPA v5.0).
Quoted 8 lines
A few minor problems and inconsistencies were found, and they're fixed here. The last three patches in this series change the "
ipa_reg" code to separate the IPA-specific part (the base virtual address, basically) from the generic register part, and the now- generic code is renamed to use just "reg_" or "REG_" as a prefix rather than "ipa_reg" or "IPA_REG_".[...]
Here is the summary with links:
- [net-next,1/9] net: ipa: generic command param fix
https://git.kernel.org/netdev/net-next/c/2df181f09c96 - [net-next,2/9] net: ipa: get rid of ipa->reg_addr https://git.kernel.org/netdev/net-next/c/38028e6f3923 - [net-next,3/9] net: ipa: add some new IPA versions https://git.kernel.org/netdev/net-next/c/3aac8ec1c028 - [net-next,4/9] net: ipa: tighten up IPA register validity checking https://git.kernel.org/netdev/net-next/c/d86603e940ae - [net-next,5/9] net: ipa: use bitmasks for GSI IRQ values https://git.kernel.org/netdev/net-next/c/c5ebba75c762 - [net-next,6/9] net: ipa: GSI register cleanup https://git.kernel.org/netdev/net-next/c/0ec573ef2a1b - [net-next,7/9] net: ipa: start generalizing "ipa_reg" (no matching commit) - [net-next,8/9] net: ipa: generalize register offset functions https://git.kernel.org/netdev/net-next/c/fc4cecf70675 - [net-next,9/9] net: ipa: generalize register field functions https://git.kernel.org/netdev/net-next/c/f1470fd790b0
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html