net: ipa: define GSI register fields differently
cover net: ipa: define GSI register fields differently
Now that we have "reg" definitions in place to define GSI register offsets, add the definitions for the fields of GSI registers that have them.
There aren't many differences between versions, but a few fields are present only in some versions of IPA, so additional "gsi_reg-vX.Y.c" files are created to capture such differences. As in the previous series, these files are created as near-copies of existing files just before they're needed to represent these differences. The first patch adds files for IPA v4.0, v4.5, and v4.9; the fifth patch adds a file for IPA v4.11.
Note that the first and fifth patch cause some checkpatch warnings because they align some continued lines with an open parenthesis that at the fourth column.
-Alex
Alex Elder (6):
net: ipa: populate more GSI register files
net: ipa: define GSI CH_C_QOS register fields
net: ipa: define more fields for GSI registers
net: ipa: define fields for event-ring related registers
net: ipa: add "gsi_v4.11.c"
net: ipa: define fields for remaining GSI registers
drivers/net/ipa/Makefile | 2 +-
drivers/net/ipa/gsi.c | 110 ++++++------
drivers/net/ipa/gsi_reg.c | 10 +-
drivers/net/ipa/gsi_reg.h | 156 ++++++++++--------
drivers/net/ipa/reg/gsi_reg-v3.1.c | 116 +++++++++++--
drivers/net/ipa/reg/gsi_reg-v3.5.1.c | 127 ++++++++++++--
.../reg/{gsi_reg-v3.5.1.c => gsi_reg-v4.0.c} | 134 +++++++++++++--
.../reg/{gsi_reg-v3.5.1.c => gsi_reg-v4.11.c} | 139 ++++++++++++++--
.../reg/{gsi_reg-v3.5.1.c => gsi_reg-v4.5.c} | 137 +++++++++++++--
.../reg/{gsi_reg-v3.5.1.c => gsi_reg-v4.9.c} | 138 ++++++++++++++--
10 files changed, 848 insertions(+), 221 deletions(-)
copy drivers/net/ipa/reg/{gsi_reg-v3.5.1.c => gsi_reg-v4.0.c} (62%)
copy drivers/net/ipa/reg/{gsi_reg-v3.5.1.c => gsi_reg-v4.11.c} (60%)
copy drivers/net/ipa/reg/{gsi_reg-v3.5.1.c => gsi_reg-v4.5.c} (61%)
copy drivers/net/ipa/reg/{gsi_reg-v3.5.1.c => gsi_reg-v4.9.c} (61%)Signature · 1 line
2.34.1
PATCH 1/6 net: ipa: populate more GSI register files
Create "gsi_v4.0.c", "gsi_v4.5.c", and "gsi_v4.9.c" as essentially identical copies of "gsi_v3.5.1.c". The only difference is the name of the exported "gsi_regs_vX_Y" structure. The next patch will start differentiating them.
--- drivers/net/ipa/Makefile | 2 +- drivers/net/ipa/gsi_reg.c | 8 +- drivers/net/ipa/gsi_reg.h | 3 + drivers/net/ipa/reg/gsi_reg-v4.0.c | 204 +++++++++++++++++++++++++++++ drivers/net/ipa/reg/gsi_reg-v4.5.c | 204 +++++++++++++++++++++++++++++ drivers/net/ipa/reg/gsi_reg-v4.9.c | 204 +++++++++++++++++++++++++++++ 6 files changed, 623 insertions(+), 2 deletions(-) create mode 100644 drivers/net/ipa/reg/gsi_reg-v4.0.c create mode 100644 drivers/net/ipa/reg/gsi_reg-v4.5.c create mode 100644 drivers/net/ipa/reg/gsi_reg-v4.9.c
drivers/net/ipa/Makefile +1 -1
@@ -5,7 +5,7 @@ IPA_VERSIONS := 3.1 3.5.1 4.2 4.5 4.7 4.9 4.11 # Some IPA versions can reuse another set of GSI register definitions. -GSI_IPA_VERSIONS := 3.1 3.5.1 +GSI_IPA_VERSIONS := 3.1 3.5.1 4.0 4.5 4.9 obj-$(CONFIG_QCOM_IPA) += ipa.o
drivers/net/ipa/gsi_reg.c +7 -1
@@ -101,12 +101,18 @@ static const struct regs *gsi_regs(struct gsi *gsi)return &gsi_regs_v3_1;case IPA_VERSION_3_5_1 : +return &gsi_regs_v3_5_1; +case IPA_VERSION_4_2 : +return &gsi_regs_v4_0; +case IPA_VERSION_4_5 :case IPA_VERSION_4_7 : +return &gsi_regs_v4_5; +case IPA_VERSION_4_9 :case IPA_VERSION_4_11 : -return &gsi_regs_v3_5_1; +return &gsi_regs_v4_9;default :return NULL ;
drivers/net/ipa/gsi_reg.h +3 -0
@@ -311,6 +311,9 @@ enum gsi_generic_ee_result {extern const struct regs gsi_regs_v3_1;extern const struct regs gsi_regs_v3_5_1; +extern const struct regs gsi_regs_v4_0; +extern const struct regs gsi_regs_v4_5; +extern const struct regs gsi_regs_v4_9;/** * gsi_reg() - Return the structure describing a GSI register
drivers/net/ipa/reg/gsi_reg-v4.0.c new file +204 -0
204 lines not on this page · raw message
drivers/net/ipa/reg/gsi_reg-v4.5.c new file +204 -0
204 lines not on this page · raw message
drivers/net/ipa/reg/gsi_reg-v4.9.c new file +204 -0
204 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH 2/6 net: ipa: define GSI CH_C_QOS register fields
In reply to Alex ElderDefine the fields within the CH_C_QOS GSI register using an array of field masks in that register's reg structure. Use the reg functions for encoding values in those fields.
One field in the register is present for IPA v4.0-4.2 only, two others are present starting at IPA v4.5, and one more is there starting at IPA v4.9.
Drop the "GSI_" prefix in symbols defined in the gsi_prefetch_mode enumerated type, and define their values using decimal rather than hexidecimal values.
--- drivers/net/ipa/gsi.c | 13 ++++++------- drivers/net/ipa/gsi_reg.h | 27 +++++++++++++-------------- drivers/net/ipa/reg/gsi_reg-v3.1.c | 10 +++++++++- drivers/net/ipa/reg/gsi_reg-v3.5.1.c | 10 +++++++++- drivers/net/ipa/reg/gsi_reg-v4.0.c | 11 ++++++++++- drivers/net/ipa/reg/gsi_reg-v4.5.c | 13 ++++++++++++- drivers/net/ipa/reg/gsi_reg-v4.9.c | 14 +++++++++++++- 7 files changed, 72 insertions(+), 26 deletions(-)
drivers/net/ipa/gsi.c +6 -7
@@ -889,14 +889,14 @@ static void gsi_channel_program(struct gsi_channel *channel, bool doorbell)/* Command channel gets low weighted round-robin priority */ if (channel->command) - wrr_weight =field_max (WRR_WEIGHT_FMASK ); - val =u32_encode_bits (wrr_weight,WRR_WEIGHT_FMASK ); + wrr_weight =reg_field_max (reg,WRR_WEIGHT ); + val =reg_encode (reg,WRR_WEIGHT , wrr_weight);/* Max prefetch is 1 segment (do not set MAX_PREFETCH_FMASK) */ /* No need to use the doorbell engine starting at IPA v4.0 */ if (gsi->version <IPA_VERSION_4_0 && doorbell) - val |=USE_DB_ENG_FMASK ; + val |=reg_bit (reg,USE_DB_ENG );/* v4.0 introduces an escape buffer for prefetch. We use it * on all but the AP command channel.
@@ -904,14 +904,13 @@ static void gsi_channel_program(struct gsi_channel *channel, bool doorbell)if (gsi->version >=IPA_VERSION_4_0 && !channel->command) {/* If not otherwise set, prefetch buffers are used */ if (gsi->version <IPA_VERSION_4_5 ) - val |=USE_ESCAPE_BUF_ONLY_FMASK ; + val |=reg_bit (reg,USE_ESCAPE_BUF_ONLY );else - val |=u32_encode_bits (GSI_ESCAPE_BUF_ONLY , -PREFETCH_MODE_FMASK ); + val |=reg_encode (reg,PREFETCH_MODE ,ESCAPE_BUF_ONLY ); }/* All channels set DB_IN_BYTES */ if (gsi->version >=IPA_VERSION_4_9 ) - val |=DB_IN_BYTES ; + val |=reg_bit (reg,DB_IN_BYTES );iowrite32 (val, gsi->virt +reg_n_offset (reg, channel_id));
drivers/net/ipa/gsi_reg.h +13 -14
@@ -121,23 +121,22 @@ enum gsi_channel_type { };/* CH_C_QOS register */ -#define WRR_WEIGHT_FMASK GENMASK(3, 0) -#define MAX_PREFETCH_FMASK GENMASK(8, 8) -#define USE_DB_ENG_FMASK GENMASK(9, 9) -/* The next field is only present for IPA v4.0, v4.1, and v4.2 */ -#define USE_ESCAPE_BUF_ONLY_FMASK GENMASK(10, 10) -/* The next two fields are present for IPA v4.5 and above */ -#define PREFETCH_MODE_FMASK GENMASK(13, 10) -#define EMPTY_LVL_THRSHOLD_FMASK GENMASK(23, 16) -/* The next field is present for IPA v4.9 and above */ -#define DB_IN_BYTES GENMASK(24, 24) +enum gsi_reg_ch_c_qos_field_id { +WRR_WEIGHT , +MAX_PREFETCH , +USE_DB_ENG , +USE_ESCAPE_BUF_ONLY ,/* IPA v4.0-4.2 */ +PREFETCH_MODE ,/* IPA v4.5+ */ +EMPTY_LVL_THRSHOLD ,/* IPA v4.5+ */ +DB_IN_BYTES ,/* IPA v4.9+ */ +};/** enum gsi_prefetch_mode - PREFETCH_MODE field in CH_C_QOS */ enum gsi_prefetch_mode { -GSI_USE_PREFETCH_BUFS =0x0 , -GSI_ESCAPE_BUF_ONLY =0x1 , -GSI_SMART_PREFETCH =0x2 , -GSI_FREE_PREFETCH =0x3 , +USE_PREFETCH_BUFS =0 , +ESCAPE_BUF_ONLY =1 , +SMART_PREFETCH =2 , +FREE_PREFETCH =3 , };/* EV_CH_E_CNTXT_0 register */
drivers/net/ipa/reg/gsi_reg-v3.1.c +9 -1
@@ -26,7 +26,15 @@ REG_STRIDE(CH_C_CNTXT_2, ch_c_cntxt_2, 0x0001c008 + 0x4000 * GSI_EE_AP, 0x80);REG_STRIDE (CH_C_CNTXT_3 , ch_c_cntxt_3,0x0001c00c +0x4000 *GSI_EE_AP ,0x80 ); -REG_STRIDE (CH_C_QOS , ch_c_qos,0x0001c05c +0x4000 *GSI_EE_AP ,0x80 ); +static const u32 reg_ch_c_qos_fmask[] = { + [WRR_WEIGHT ] =GENMASK (3 ,0 ), +/* Bits 4-7 reserved */ + [MAX_PREFETCH ] =BIT (8 ), + [USE_DB_ENG ] =BIT (9 ), +/* Bits 10-31 reserved */ +}; + +REG_STRIDE_FIELDS (CH_C_QOS , ch_c_qos,0x0001c05c +0x4000 *GSI_EE_AP ,0x80 );REG (ERROR_LOG , error_log,0x0001f200 +0x4000 *GSI_EE_AP );
drivers/net/ipa/reg/gsi_reg-v3.5.1.c +9 -1
@@ -26,7 +26,15 @@ REG_STRIDE(CH_C_CNTXT_2, ch_c_cntxt_2, 0x0001c008 + 0x4000 * GSI_EE_AP, 0x80);REG_STRIDE (CH_C_CNTXT_3 , ch_c_cntxt_3,0x0001c00c +0x4000 *GSI_EE_AP ,0x80 ); -REG_STRIDE (CH_C_QOS , ch_c_qos,0x0001c05c +0x4000 *GSI_EE_AP ,0x80 ); +static const u32 reg_ch_c_qos_fmask[] = { + [WRR_WEIGHT ] =GENMASK (3 ,0 ), +/* Bits 4-7 reserved */ + [MAX_PREFETCH ] =BIT (8 ), + [USE_DB_ENG ] =BIT (9 ), +/* Bits 10-31 reserved */ +}; + +REG_STRIDE_FIELDS (CH_C_QOS , ch_c_qos,0x0001c05c +0x4000 *GSI_EE_AP ,0x80 );REG (ERROR_LOG , error_log,0x0001f200 +0x4000 *GSI_EE_AP );
drivers/net/ipa/reg/gsi_reg-v4.0.c +10 -1
@@ -26,7 +26,16 @@ REG_STRIDE(CH_C_CNTXT_2, ch_c_cntxt_2, 0x0001c008 + 0x4000 * GSI_EE_AP, 0x80);REG_STRIDE (CH_C_CNTXT_3 , ch_c_cntxt_3,0x0001c00c +0x4000 *GSI_EE_AP ,0x80 ); -REG_STRIDE (CH_C_QOS , ch_c_qos,0x0001c05c +0x4000 *GSI_EE_AP ,0x80 ); +static const u32 reg_ch_c_qos_fmask[] = { + [WRR_WEIGHT ] =GENMASK (3 ,0 ), +/* Bits 4-7 reserved */ + [MAX_PREFETCH ] =BIT (8 ), + [USE_DB_ENG ] =BIT (9 ), + [USE_ESCAPE_BUF_ONLY ] =BIT (10 ), +/* Bits 11-31 reserved */ +}; + +REG_STRIDE_FIELDS (CH_C_QOS , ch_c_qos,0x0001c05c +0x4000 *GSI_EE_AP ,0x80 );REG (ERROR_LOG , error_log,0x0001f200 +0x4000 *GSI_EE_AP );
drivers/net/ipa/reg/gsi_reg-v4.5.c +12 -1
@@ -26,7 +26,18 @@ REG_STRIDE(CH_C_CNTXT_2, ch_c_cntxt_2, 0x0001c008 + 0x4000 * GSI_EE_AP, 0x80);REG_STRIDE (CH_C_CNTXT_3 , ch_c_cntxt_3,0x0001c00c +0x4000 *GSI_EE_AP ,0x80 ); -REG_STRIDE (CH_C_QOS , ch_c_qos,0x0001c05c +0x4000 *GSI_EE_AP ,0x80 ); +static const u32 reg_ch_c_qos_fmask[] = { + [WRR_WEIGHT ] =GENMASK (3 ,0 ), +/* Bits 4-7 reserved */ + [MAX_PREFETCH ] =BIT (8 ), + [USE_DB_ENG ] =BIT (9 ), + [PREFETCH_MODE ] =GENMASK (13 ,10 ), +/* Bits 14-15 reserved */ + [EMPTY_LVL_THRSHOLD ] =GENMASK (23 ,16 ), +/* Bits 24-31 reserved */ +}; + +REG_STRIDE_FIELDS (CH_C_QOS , ch_c_qos,0x0001c05c +0x4000 *GSI_EE_AP ,0x80 );REG (ERROR_LOG , error_log,0x0001f200 +0x4000 *GSI_EE_AP );
drivers/net/ipa/reg/gsi_reg-v4.9.c +13 -1
@@ -26,7 +26,19 @@ REG_STRIDE(CH_C_CNTXT_2, ch_c_cntxt_2, 0x0001c008 + 0x4000 * GSI_EE_AP, 0x80);REG_STRIDE (CH_C_CNTXT_3 , ch_c_cntxt_3,0x0001c00c +0x4000 *GSI_EE_AP ,0x80 ); -REG_STRIDE (CH_C_QOS , ch_c_qos,0x0001c05c +0x4000 *GSI_EE_AP ,0x80 ); +static const u32 reg_ch_c_qos_fmask[] = { + [WRR_WEIGHT ] =GENMASK (3 ,0 ), +/* Bits 4-7 reserved */ + [MAX_PREFETCH ] =BIT (8 ), + [USE_DB_ENG ] =BIT (9 ), + [PREFETCH_MODE ] =GENMASK (13 ,10 ), +/* Bits 14-15 reserved */ + [EMPTY_LVL_THRSHOLD ] =GENMASK (23 ,16 ), + [DB_IN_BYTES ] =BIT (24 ), +/* Bits 25-31 reserved */ +}; + +REG_STRIDE_FIELDS (CH_C_QOS , ch_c_qos,0x0001c05c +0x4000 *GSI_EE_AP ,0x80 );REG (ERROR_LOG , error_log,0x0001f200 +0x4000 *GSI_EE_AP );
Signature · 1 line
2.34.1
PATCH 3/6 net: ipa: define more fields for GSI registers
In reply to Alex ElderBeyond the CH_C_QOS register, two other registers whose offset is related to channel number have fields within them.
Define the fields within the CH_C_CNTXT_0 GSI register, using an enumerated type to identify the register's fields, and define an array of field masks to use for that register's reg structure.
For the CH_C_CNTXT_1 GSI register, ch_c_cntxt_1_length_encode() previously hid the difference in bit width in the channel ring length field. Instead, define a new field CH_R_LENGTH and encode the ring size with reg_encode().
--- drivers/net/ipa/gsi.c | 31 +++++++++------------------- drivers/net/ipa/gsi_reg.h | 24 +++++++++++++-------- drivers/net/ipa/reg/gsi_reg-v3.1.c | 23 +++++++++++++++++++-- drivers/net/ipa/reg/gsi_reg-v3.5.1.c | 23 +++++++++++++++++++-- drivers/net/ipa/reg/gsi_reg-v4.0.c | 23 +++++++++++++++++++-- drivers/net/ipa/reg/gsi_reg-v4.5.c | 23 +++++++++++++++++++-- drivers/net/ipa/reg/gsi_reg-v4.9.c | 23 +++++++++++++++++++-- 7 files changed, 130 insertions(+), 40 deletions(-)
drivers/net/ipa/gsi.c +10 -21
@@ -164,9 +164,6 @@ static void gsi_validate_build(void)*/ BUILD_BUG_ON (!is_power_of_2 (GSI_RING_ELEMENT_SIZE )); -/* The channel element size must fit in this field */ -BUILD_BUG_ON (GSI_RING_ELEMENT_SIZE >field_max (ELEMENT_SIZE_FMASK )); -/* The event ring element size must fit in this field */ BUILD_BUG_ON (GSI_RING_ELEMENT_SIZE >field_max (EV_ELEMENT_SIZE_FMASK )); }
@@ -185,26 +182,18 @@ static bool gsi_channel_initialized(struct gsi_channel *channel)/* Encode the channel protocol for the CH_C_CNTXT_0 register */ static u32 ch_c_cntxt_0_type_encode (enum ipa_version version, +const struct reg *reg,enum gsi_channel_type type) {u32 val; - val =u32_encode_bits (type,CHTYPE_PROTOCOL_FMASK ); + val =reg_encode (reg,CHTYPE_PROTOCOL , type);if (version <IPA_VERSION_4_5 )return val; - type >>=hweight32 (CHTYPE_PROTOCOL_FMASK ); + type >>=hweight32 (reg_fmask (reg,CHTYPE_PROTOCOL )); -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 )); +return val |reg_encode (reg,CHTYPE_PROTOCOL_MSB , type); }/* Encode the length of the event channel ring buffer for the
@@ -544,7 +533,7 @@ static enum gsi_channel_state gsi_channel_state(struct gsi_channel *channel) reg =gsi_reg (gsi,CH_C_CNTXT_0 ); val =ioread32 (virt +reg_n_offset (reg, channel_id)); -return u32_get_bits (val,CHSTATE_FMASK ); +return reg_decode (reg,CHSTATE , val); }/* Issue a channel command and wait for it to complete */
@@ -862,15 +851,15 @@ static void gsi_channel_program(struct gsi_channel *channel, bool doorbell) reg =gsi_reg (gsi,CH_C_CNTXT_0 );/* We program all channels as GPI type/protocol */ - val =ch_c_cntxt_0_type_encode (gsi->version,GSI_CHANNEL_TYPE_GPI ); + val =ch_c_cntxt_0_type_encode (gsi->version, reg,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 ); + val |=reg_bit (reg,CHTYPE_DIR ); + val |=reg_encode (reg,ERINDEX , channel->evt_ring_id); + val |=reg_encode (reg,ELEMENT_SIZE ,GSI_RING_ELEMENT_SIZE );iowrite32 (val, gsi->virt +reg_n_offset (reg, channel_id)); reg =gsi_reg (gsi,CH_C_CNTXT_1 ); - val =ch_c_cntxt_1_length_encode (gsi->version, size); + val =reg_encode (reg,CH_R_LENGTH , size);iowrite32 (val, gsi->virt +reg_n_offset (reg, channel_id));/* The context 2 and 3 registers store the low-order and
drivers/net/ipa/gsi_reg.h +15 -9
@@ -96,15 +96,16 @@ enum gsi_reg_id { };/* CH_C_CNTXT_0 register */ -#define CHTYPE_PROTOCOL_FMASK GENMASK(2, 0) -#define CHTYPE_DIR_FMASK GENMASK(3, 3) -#define EE_FMASK GENMASK(7, 4) -#define CHID_FMASK GENMASK(12, 8) -/* The next field is present for IPA v4.5 and above */ -#define CHTYPE_PROTOCOL_MSB_FMASK GENMASK(13, 13) -#define ERINDEX_FMASK GENMASK(18, 14) -#define CHSTATE_FMASK GENMASK(23, 20) -#define ELEMENT_SIZE_FMASK GENMASK(31, 24) +enum gsi_reg_ch_c_cntxt_0_field_id { +CHTYPE_PROTOCOL , +CHTYPE_DIR , +CH_EE , +CHID , +CHTYPE_PROTOCOL_MSB ,/* IPA v4.9+ */ +ERINDEX , +CHSTATE , +ELEMENT_SIZE , +};/** enum gsi_channel_type - CHTYPE_PROTOCOL field values in CH_C_CNTXT_0 */ enum gsi_channel_type {
@@ -120,6 +121,11 @@ enum gsi_channel_type { GSI_CHANNEL_TYPE_11AD = 0x9, }; +/* CH_C_CNTXT_1 register */ +enum gsi_reg_ch_c_cntxt_1_field_id { +CH_R_LENGTH , +}; +/* CH_C_QOS register */ enum gsi_reg_ch_c_qos_field_id {WRR_WEIGHT ,
drivers/net/ipa/reg/gsi_reg-v3.1.c +21 -2
@@ -18,9 +18,28 @@ REG(INTER_EE_SRC_EV_CH_IRQ_MSK, inter_ee_src_ev_ch_irq_msk,/* All other register offsets are relative to gsi->virt */ -REG_STRIDE (CH_C_CNTXT_0 , ch_c_cntxt_0,0x0001c000 +0x4000 *GSI_EE_AP ,0x80 ); +static const u32 reg_ch_c_cntxt_0_fmask[] = { + [CHTYPE_PROTOCOL ] =GENMASK (2 ,0 ), + [CHTYPE_DIR ] =BIT (3 ), + [CH_EE ] =GENMASK (7 ,4 ), + [CHID ] =GENMASK (12 ,8 ), +/* Bit 13 reserved */ + [ERINDEX ] =GENMASK (18 ,14 ), +/* Bit 19 reserved */ + [CHSTATE ] =GENMASK (23 ,20 ), + [ELEMENT_SIZE ] =GENMASK (31 ,24 ), +}; -REG_STRIDE (CH_C_CNTXT_1 , ch_c_cntxt_1,0x0001c004 +0x4000 *GSI_EE_AP ,0x80 ); +REG_STRIDE_FIELDS (CH_C_CNTXT_0 , ch_c_cntxt_0, +0x0001c000 +0x4000 *GSI_EE_AP ,0x80 ); + +static const u32 reg_ch_c_cntxt_1_fmask[] = { + [CH_R_LENGTH ] =GENMASK (15 ,0 ), +/* Bits 16-31 reserved */ +}; + +REG_STRIDE_FIELDS (CH_C_CNTXT_1 , ch_c_cntxt_1, +0x0001c004 +0x4000 *GSI_EE_AP ,0x80 );REG_STRIDE (CH_C_CNTXT_2 , ch_c_cntxt_2,0x0001c008 +0x4000 *GSI_EE_AP ,0x80 );
drivers/net/ipa/reg/gsi_reg-v3.5.1.c +21 -2
@@ -18,9 +18,28 @@ REG(INTER_EE_SRC_EV_CH_IRQ_MSK, inter_ee_src_ev_ch_irq_msk,/* All other register offsets are relative to gsi->virt */ -REG_STRIDE (CH_C_CNTXT_0 , ch_c_cntxt_0,0x0001c000 +0x4000 *GSI_EE_AP ,0x80 ); +static const u32 reg_ch_c_cntxt_0_fmask[] = { + [CHTYPE_PROTOCOL ] =GENMASK (2 ,0 ), + [CHTYPE_DIR ] =BIT (3 ), + [CH_EE ] =GENMASK (7 ,4 ), + [CHID ] =GENMASK (12 ,8 ), +/* Bit 13 reserved */ + [ERINDEX ] =GENMASK (18 ,14 ), +/* Bit 19 reserved */ + [CHSTATE ] =GENMASK (23 ,20 ), + [ELEMENT_SIZE ] =GENMASK (31 ,24 ), +}; -REG_STRIDE (CH_C_CNTXT_1 , ch_c_cntxt_1,0x0001c004 +0x4000 *GSI_EE_AP ,0x80 ); +REG_STRIDE_FIELDS (CH_C_CNTXT_0 , ch_c_cntxt_0, +0x0001c000 +0x4000 *GSI_EE_AP ,0x80 ); + +static const u32 reg_ch_c_cntxt_1_fmask[] = { + [CH_R_LENGTH ] =GENMASK (15 ,0 ), +/* Bits 16-31 reserved */ +}; + +REG_STRIDE_FIELDS (CH_C_CNTXT_1 , ch_c_cntxt_1, +0x0001c004 +0x4000 *GSI_EE_AP ,0x80 );REG_STRIDE (CH_C_CNTXT_2 , ch_c_cntxt_2,0x0001c008 +0x4000 *GSI_EE_AP ,0x80 );
drivers/net/ipa/reg/gsi_reg-v4.0.c +21 -2
@@ -18,9 +18,28 @@ REG(INTER_EE_SRC_EV_CH_IRQ_MSK, inter_ee_src_ev_ch_irq_msk,/* All other register offsets are relative to gsi->virt */ -REG_STRIDE (CH_C_CNTXT_0 , ch_c_cntxt_0,0x0001c000 +0x4000 *GSI_EE_AP ,0x80 ); +static const u32 reg_ch_c_cntxt_0_fmask[] = { + [CHTYPE_PROTOCOL ] =GENMASK (2 ,0 ), + [CHTYPE_DIR ] =BIT (3 ), + [CH_EE ] =GENMASK (7 ,4 ), + [CHID ] =GENMASK (12 ,8 ), +/* Bit 13 reserved */ + [ERINDEX ] =GENMASK (18 ,14 ), +/* Bit 19 reserved */ + [CHSTATE ] =GENMASK (23 ,20 ), + [ELEMENT_SIZE ] =GENMASK (31 ,24 ), +}; -REG_STRIDE (CH_C_CNTXT_1 , ch_c_cntxt_1,0x0001c004 +0x4000 *GSI_EE_AP ,0x80 ); +REG_STRIDE_FIELDS (CH_C_CNTXT_0 , ch_c_cntxt_0, +0x0001c000 +0x4000 *GSI_EE_AP ,0x80 ); + +static const u32 reg_ch_c_cntxt_1_fmask[] = { + [CH_R_LENGTH ] =GENMASK (15 ,0 ), +/* Bits 16-31 reserved */ +}; + +REG_STRIDE_FIELDS (CH_C_CNTXT_1 , ch_c_cntxt_1, +0x0001c004 +0x4000 *GSI_EE_AP ,0x80 );REG_STRIDE (CH_C_CNTXT_2 , ch_c_cntxt_2,0x0001c008 +0x4000 *GSI_EE_AP ,0x80 );
drivers/net/ipa/reg/gsi_reg-v4.5.c +21 -2
@@ -18,9 +18,28 @@ REG(INTER_EE_SRC_EV_CH_IRQ_MSK, inter_ee_src_ev_ch_irq_msk,/* All other register offsets are relative to gsi->virt */ -REG_STRIDE (CH_C_CNTXT_0 , ch_c_cntxt_0,0x0001c000 +0x4000 *GSI_EE_AP ,0x80 ); +static const u32 reg_ch_c_cntxt_0_fmask[] = { + [CHTYPE_PROTOCOL ] =GENMASK (2 ,0 ), + [CHTYPE_DIR ] =BIT (3 ), + [CH_EE ] =GENMASK (7 ,4 ), + [CHID ] =GENMASK (12 ,8 ), + [CHTYPE_PROTOCOL_MSB ] =BIT (13 ), + [ERINDEX ] =GENMASK (18 ,14 ), +/* Bit 19 reserved */ + [CHSTATE ] =GENMASK (23 ,20 ), + [ELEMENT_SIZE ] =GENMASK (31 ,24 ), +}; -REG_STRIDE (CH_C_CNTXT_1 , ch_c_cntxt_1,0x0001c004 +0x4000 *GSI_EE_AP ,0x80 ); +REG_STRIDE_FIELDS (CH_C_CNTXT_0 , ch_c_cntxt_0, +0x0001c000 +0x4000 *GSI_EE_AP ,0x80 ); + +static const u32 reg_ch_c_cntxt_1_fmask[] = { + [CH_R_LENGTH ] =GENMASK (15 ,0 ), +/* Bits 16-31 reserved */ +}; + +REG_STRIDE_FIELDS (CH_C_CNTXT_1 , ch_c_cntxt_1, +0x0001c004 +0x4000 *GSI_EE_AP ,0x80 );REG_STRIDE (CH_C_CNTXT_2 , ch_c_cntxt_2,0x0001c008 +0x4000 *GSI_EE_AP ,0x80 );
drivers/net/ipa/reg/gsi_reg-v4.9.c +21 -2
@@ -18,9 +18,28 @@ REG(INTER_EE_SRC_EV_CH_IRQ_MSK, inter_ee_src_ev_ch_irq_msk,/* All other register offsets are relative to gsi->virt */ -REG_STRIDE (CH_C_CNTXT_0 , ch_c_cntxt_0,0x0001c000 +0x4000 *GSI_EE_AP ,0x80 ); +static const u32 reg_ch_c_cntxt_0_fmask[] = { + [CHTYPE_PROTOCOL ] =GENMASK (2 ,0 ), + [CHTYPE_DIR ] =BIT (3 ), + [CH_EE ] =GENMASK (7 ,4 ), + [CHID ] =GENMASK (12 ,8 ), + [CHTYPE_PROTOCOL_MSB ] =BIT (13 ), + [ERINDEX ] =GENMASK (18 ,14 ), +/* Bit 19 reserved */ + [CHSTATE ] =GENMASK (23 ,20 ), + [ELEMENT_SIZE ] =GENMASK (31 ,24 ), +}; -REG_STRIDE (CH_C_CNTXT_1 , ch_c_cntxt_1,0x0001c004 +0x4000 *GSI_EE_AP ,0x80 ); +REG_STRIDE_FIELDS (CH_C_CNTXT_0 , ch_c_cntxt_0, +0x0001c000 +0x4000 *GSI_EE_AP ,0x80 ); + +static const u32 reg_ch_c_cntxt_1_fmask[] = { + [CH_R_LENGTH ] =GENMASK (19 ,0 ), +/* Bits 20-31 reserved */ +}; + +REG_STRIDE_FIELDS (CH_C_CNTXT_1 , ch_c_cntxt_1, +0x0001c004 +0x4000 *GSI_EE_AP ,0x80 );REG_STRIDE (CH_C_CNTXT_2 , ch_c_cntxt_2,0x0001c008 +0x4000 *GSI_EE_AP ,0x80 );
Signature · 1 line
2.34.1
PATCH 5/6 net: ipa: add "gsi_v4.11.c"
In reply to Alex ElderThe next patch adds a GSI register field that is only valid starting at IPA v4.11. Create "gsi_v4.11.c" from "gsi_v4.9.c", changing only the name of the public regs structure it defines.
--- drivers/net/ipa/Makefile | 2 +- drivers/net/ipa/gsi_reg.c | 4 +- drivers/net/ipa/gsi_reg.h | 1 + drivers/net/ipa/reg/gsi_reg-v4.11.c | 251 ++++++++++++++++++++++++++++ 4 files changed, 256 insertions(+), 2 deletions(-) create mode 100644 drivers/net/ipa/reg/gsi_reg-v4.11.c
drivers/net/ipa/Makefile +1 -1
@@ -5,7 +5,7 @@ IPA_VERSIONS := 3.1 3.5.1 4.2 4.5 4.7 4.9 4.11 # Some IPA versions can reuse another set of GSI register definitions. -GSI_IPA_VERSIONS := 3.1 3.5.1 4.0 4.5 4.9 +GSI_IPA_VERSIONS := 3.1 3.5.1 4.0 4.5 4.9 4.11 obj-$(CONFIG_QCOM_IPA) += ipa.o
drivers/net/ipa/gsi_reg.c +3 -1
@@ -111,9 +111,11 @@ static const struct regs *gsi_regs(struct gsi *gsi)return &gsi_regs_v4_5;case IPA_VERSION_4_9 : -case IPA_VERSION_4_11 :return &gsi_regs_v4_9; +case IPA_VERSION_4_11 : +return &gsi_regs_v4_11; +default :return NULL ; }
drivers/net/ipa/gsi_reg.h +1 -0
@@ -322,6 +322,7 @@ extern const struct regs gsi_regs_v3_5_1;extern const struct regs gsi_regs_v4_0;extern const struct regs gsi_regs_v4_5;extern const struct regs gsi_regs_v4_9; +extern const struct regs gsi_regs_v4_11;/** * gsi_reg() - Return the structure describing a GSI register
drivers/net/ipa/reg/gsi_reg-v4.11.c new file +251 -0
251 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH 4/6 net: ipa: define fields for event-ring related registers
In reply to Alex ElderDefine field IDs for the EV_CH_E_CNTXT_0 and EV_CH_E_CNTXT_8 GSI registers, and populate the register definition files accordingly. Use the reg_*() functions to access field values for those regiters, and get rid of the previous field definition constants.
The remaining EV_CH_E_CNTXT_* registers are written with full 32-bit values (and have no fields).
--- drivers/net/ipa/gsi.c | 19 +++++++++---------- drivers/net/ipa/gsi_reg.h | 23 +++++++++++++---------- drivers/net/ipa/reg/gsi_reg-v3.1.c | 24 ++++++++++++++++++++---- drivers/net/ipa/reg/gsi_reg-v3.5.1.c | 24 ++++++++++++++++++++---- drivers/net/ipa/reg/gsi_reg-v4.0.c | 24 ++++++++++++++++++++---- drivers/net/ipa/reg/gsi_reg-v4.5.c | 24 ++++++++++++++++++++---- drivers/net/ipa/reg/gsi_reg-v4.9.c | 24 ++++++++++++++++++++---- 7 files changed, 122 insertions(+), 40 deletions(-)
drivers/net/ipa/gsi.c +9 -10
@@ -163,9 +163,6 @@ static void gsi_validate_build(void)* ensure the elements themselves meet the requirement. */ BUILD_BUG_ON (!is_power_of_2 (GSI_RING_ELEMENT_SIZE )); - -/* The event ring element size must fit in this field */ -BUILD_BUG_ON (GSI_RING_ELEMENT_SIZE >field_max (EV_ELEMENT_SIZE_FMASK )); }/* Return the channel id associated with a given channel */
@@ -418,7 +415,7 @@ gsi_evt_ring_state(struct gsi *gsi, u32 evt_ring_id) val =ioread32 (gsi->virt +reg_n_offset (reg, evt_ring_id)); -return u32_get_bits (val,EV_CHSTATE_FMASK ); +return reg_decode (reg,EV_CHSTATE , val); }/* Issue an event ring command and wait for it to complete */
@@ -739,9 +736,10 @@ static void gsi_evt_ring_program(struct gsi *gsi, u32 evt_ring_id) reg =gsi_reg (gsi,EV_CH_E_CNTXT_0 );/* We program all event rings as GPI type/protocol */ - val =u32_encode_bits (GSI_CHANNEL_TYPE_GPI ,EV_CHTYPE_FMASK ); - val |=EV_INTYPE_FMASK ; - val |=u32_encode_bits (GSI_RING_ELEMENT_SIZE ,EV_ELEMENT_SIZE_FMASK ); + val =reg_encode (reg,EV_CHTYPE ,GSI_CHANNEL_TYPE_GPI ); +/* EV_EE field is 0 (GSI_EE_AP) */ + val |=reg_bit (reg,EV_INTYPE ); + val |=reg_encode (reg,EV_ELEMENT_SIZE ,GSI_RING_ELEMENT_SIZE );iowrite32 (val, gsi->virt +reg_n_offset (reg, evt_ring_id)); reg =gsi_reg (gsi,EV_CH_E_CNTXT_1 );
@@ -763,11 +761,12 @@ static void gsi_evt_ring_program(struct gsi *gsi, u32 evt_ring_id)/* Enable interrupt moderation by setting the moderation delay */ reg =gsi_reg (gsi,EV_CH_E_CNTXT_8 ); - val =u32_encode_bits (GSI_EVT_RING_INT_MODT ,MODT_FMASK ); - val |=u32_encode_bits (1 ,MODC_FMASK );/* comes from channel */ + val =reg_encode (reg,EV_MODT ,GSI_EVT_RING_INT_MODT ); + val =reg_encode (reg,EV_MODC ,1 );/* comes from channel */ +/* EV_MOD_CNT is 0 (no counter-based interrupt coalescing) */ iowrite32 (val, gsi->virt +reg_n_offset (reg, evt_ring_id)); -/* No MSI write data, and MSI address high and low address is 0 */ +/* No MSI write data, and MSI high and low address is 0 */ reg =gsi_reg (gsi,EV_CH_E_CNTXT_9 );iowrite32 (0 , gsi->virt +reg_n_offset (reg, evt_ring_id));
drivers/net/ipa/gsi_reg.h +13 -10
@@ -146,18 +146,21 @@ enum gsi_prefetch_mode { };/* EV_CH_E_CNTXT_0 register */ -/* enum gsi_channel_type defines EV_CHTYPE field values in EV_CH_E_CNTXT_0 */ -#define EV_CHTYPE_FMASK GENMASK(3, 0) -#define EV_EE_FMASK GENMASK(7, 4) -#define EV_EVCHID_FMASK GENMASK(15, 8) -#define EV_INTYPE_FMASK GENMASK(16, 16) -#define EV_CHSTATE_FMASK GENMASK(23, 20) -#define EV_ELEMENT_SIZE_FMASK GENMASK(31, 24) +enum gsi_reg_ch_c_ev_ch_e_cntxt_0_field_id { +EV_CHTYPE ,/* enum gsi_channel_type */ +EV_EE ,/* enum gsi_ee_id; always GSI_EE_AP for us */ +EV_EVCHID , +EV_INTYPE , +EV_CHSTATE , +EV_ELEMENT_SIZE , +};/* EV_CH_E_CNTXT_8 register */ -#define MODT_FMASK GENMASK(15, 0) -#define MODC_FMASK GENMASK(23, 16) -#define MOD_CNT_FMASK GENMASK(31, 24) +enum gsi_reg_ch_c_ev_ch_e_cntxt_8_field_id { +EV_MODT , +EV_MODC , +EV_MOD_CNT , +};/* GSI_STATUS register */ #define ENABLED_FMASK GENMASK(0, 0)
drivers/net/ipa/reg/gsi_reg-v3.1.c +20 -4
@@ -71,8 +71,18 @@ REG_STRIDE(CH_C_SCRATCH_2, ch_c_scratch_2,REG_STRIDE (CH_C_SCRATCH_3 , ch_c_scratch_3,0x0001c06c +0x4000 *GSI_EE_AP ,0x80 ); -REG_STRIDE (EV_CH_E_CNTXT_0 , ev_ch_e_cntxt_0, -0x0001d000 +0x4000 *GSI_EE_AP ,0x80 ); +static const u32 reg_ev_ch_e_cntxt_0_fmask[] = { + [EV_CHTYPE ] =GENMASK (3 ,0 ), + [EV_EE ] =GENMASK (7 ,4 ), + [EV_EVCHID ] =GENMASK (15 ,8 ), + [EV_INTYPE ] =BIT (16 ), +/* Bits 17-19 reserved */ + [EV_CHSTATE ] =GENMASK (23 ,20 ), + [EV_ELEMENT_SIZE ] =GENMASK (31 ,24 ), +}; + +REG_STRIDE_FIELDS (EV_CH_E_CNTXT_0 , ev_ch_e_cntxt_0, +0x0001d000 +0x4000 *GSI_EE_AP ,0x80 );REG_STRIDE (EV_CH_E_CNTXT_1 , ev_ch_e_cntxt_1,0x0001d004 +0x4000 *GSI_EE_AP ,0x80 );
@@ -86,8 +96,14 @@ REG_STRIDE(EV_CH_E_CNTXT_3, ev_ch_e_cntxt_3,REG_STRIDE (EV_CH_E_CNTXT_4 , ev_ch_e_cntxt_4,0x0001d010 +0x4000 *GSI_EE_AP ,0x80 ); -REG_STRIDE (EV_CH_E_CNTXT_8 , ev_ch_e_cntxt_8, -0x0001d020 +0x4000 *GSI_EE_AP ,0x80 ); +static const u32 reg_ev_ch_e_cntxt_8_fmask[] = { + [EV_MODT ] =GENMASK (15 ,0 ), + [EV_MODC ] =GENMASK (23 ,16 ), + [EV_MOD_CNT ] =GENMASK (31 ,24 ), +}; + +REG_STRIDE_FIELDS (EV_CH_E_CNTXT_8 , ev_ch_e_cntxt_8, +0x0001d020 +0x4000 *GSI_EE_AP ,0x80 );REG_STRIDE (EV_CH_E_CNTXT_9 , ev_ch_e_cntxt_9,0x0001d024 +0x4000 *GSI_EE_AP ,0x80 );
drivers/net/ipa/reg/gsi_reg-v3.5.1.c +20 -4
@@ -71,8 +71,18 @@ REG_STRIDE(CH_C_SCRATCH_2, ch_c_scratch_2,REG_STRIDE (CH_C_SCRATCH_3 , ch_c_scratch_3,0x0001c06c +0x4000 *GSI_EE_AP ,0x80 ); -REG_STRIDE (EV_CH_E_CNTXT_0 , ev_ch_e_cntxt_0, -0x0001d000 +0x4000 *GSI_EE_AP ,0x80 ); +static const u32 reg_ev_ch_e_cntxt_0_fmask[] = { + [EV_CHTYPE ] =GENMASK (3 ,0 ), + [EV_EE ] =GENMASK (7 ,4 ), + [EV_EVCHID ] =GENMASK (15 ,8 ), + [EV_INTYPE ] =BIT (16 ), +/* Bits 17-19 reserved */ + [EV_CHSTATE ] =GENMASK (23 ,20 ), + [EV_ELEMENT_SIZE ] =GENMASK (31 ,24 ), +}; + +REG_STRIDE_FIELDS (EV_CH_E_CNTXT_0 , ev_ch_e_cntxt_0, +0x0001d000 +0x4000 *GSI_EE_AP ,0x80 );REG_STRIDE (EV_CH_E_CNTXT_1 , ev_ch_e_cntxt_1,0x0001d004 +0x4000 *GSI_EE_AP ,0x80 );
@@ -86,8 +96,14 @@ REG_STRIDE(EV_CH_E_CNTXT_3, ev_ch_e_cntxt_3,REG_STRIDE (EV_CH_E_CNTXT_4 , ev_ch_e_cntxt_4,0x0001d010 +0x4000 *GSI_EE_AP ,0x80 ); -REG_STRIDE (EV_CH_E_CNTXT_8 , ev_ch_e_cntxt_8, -0x0001d020 +0x4000 *GSI_EE_AP ,0x80 ); +static const u32 reg_ev_ch_e_cntxt_8_fmask[] = { + [EV_MODT ] =GENMASK (15 ,0 ), + [EV_MODC ] =GENMASK (23 ,16 ), + [EV_MOD_CNT ] =GENMASK (31 ,24 ), +}; + +REG_STRIDE_FIELDS (EV_CH_E_CNTXT_8 , ev_ch_e_cntxt_8, +0x0001d020 +0x4000 *GSI_EE_AP ,0x80 );REG_STRIDE (EV_CH_E_CNTXT_9 , ev_ch_e_cntxt_9,0x0001d024 +0x4000 *GSI_EE_AP ,0x80 );
drivers/net/ipa/reg/gsi_reg-v4.0.c +20 -4
@@ -72,8 +72,18 @@ REG_STRIDE(CH_C_SCRATCH_2, ch_c_scratch_2,REG_STRIDE (CH_C_SCRATCH_3 , ch_c_scratch_3,0x0001c06c +0x4000 *GSI_EE_AP ,0x80 ); -REG_STRIDE (EV_CH_E_CNTXT_0 , ev_ch_e_cntxt_0, -0x0001d000 +0x4000 *GSI_EE_AP ,0x80 ); +static const u32 reg_ev_ch_e_cntxt_0_fmask[] = { + [EV_CHTYPE ] =GENMASK (3 ,0 ), + [EV_EE ] =GENMASK (7 ,4 ), + [EV_EVCHID ] =GENMASK (15 ,8 ), + [EV_INTYPE ] =BIT (16 ), +/* Bits 17-19 reserved */ + [EV_CHSTATE ] =GENMASK (23 ,20 ), + [EV_ELEMENT_SIZE ] =GENMASK (31 ,24 ), +}; + +REG_STRIDE_FIELDS (EV_CH_E_CNTXT_0 , ev_ch_e_cntxt_0, +0x0001d000 +0x4000 *GSI_EE_AP ,0x80 );REG_STRIDE (EV_CH_E_CNTXT_1 , ev_ch_e_cntxt_1,0x0001d004 +0x4000 *GSI_EE_AP ,0x80 );
@@ -87,8 +97,14 @@ REG_STRIDE(EV_CH_E_CNTXT_3, ev_ch_e_cntxt_3,REG_STRIDE (EV_CH_E_CNTXT_4 , ev_ch_e_cntxt_4,0x0001d010 +0x4000 *GSI_EE_AP ,0x80 ); -REG_STRIDE (EV_CH_E_CNTXT_8 , ev_ch_e_cntxt_8, -0x0001d020 +0x4000 *GSI_EE_AP ,0x80 ); +static const u32 reg_ev_ch_e_cntxt_8_fmask[] = { + [EV_MODT ] =GENMASK (15 ,0 ), + [EV_MODC ] =GENMASK (23 ,16 ), + [EV_MOD_CNT ] =GENMASK (31 ,24 ), +}; + +REG_STRIDE_FIELDS (EV_CH_E_CNTXT_8 , ev_ch_e_cntxt_8, +0x0001d020 +0x4000 *GSI_EE_AP ,0x80 );REG_STRIDE (EV_CH_E_CNTXT_9 , ev_ch_e_cntxt_9,0x0001d024 +0x4000 *GSI_EE_AP ,0x80 );
drivers/net/ipa/reg/gsi_reg-v4.5.c +20 -4
@@ -74,8 +74,18 @@ REG_STRIDE(CH_C_SCRATCH_2, ch_c_scratch_2,REG_STRIDE (CH_C_SCRATCH_3 , ch_c_scratch_3,0x0001c06c +0x4000 *GSI_EE_AP ,0x80 ); -REG_STRIDE (EV_CH_E_CNTXT_0 , ev_ch_e_cntxt_0, -0x0001d000 +0x4000 *GSI_EE_AP ,0x80 ); +static const u32 reg_ev_ch_e_cntxt_0_fmask[] = { + [EV_CHTYPE ] =GENMASK (3 ,0 ), + [EV_EE ] =GENMASK (7 ,4 ), + [EV_EVCHID ] =GENMASK (15 ,8 ), + [EV_INTYPE ] =BIT (16 ), +/* Bits 17-19 reserved */ + [EV_CHSTATE ] =GENMASK (23 ,20 ), + [EV_ELEMENT_SIZE ] =GENMASK (31 ,24 ), +}; + +REG_STRIDE_FIELDS (EV_CH_E_CNTXT_0 , ev_ch_e_cntxt_0, +0x0001d000 +0x4000 *GSI_EE_AP ,0x80 );REG_STRIDE (EV_CH_E_CNTXT_1 , ev_ch_e_cntxt_1,0x0001d004 +0x4000 *GSI_EE_AP ,0x80 );
@@ -89,8 +99,14 @@ REG_STRIDE(EV_CH_E_CNTXT_3, ev_ch_e_cntxt_3,REG_STRIDE (EV_CH_E_CNTXT_4 , ev_ch_e_cntxt_4,0x0001d010 +0x4000 *GSI_EE_AP ,0x80 ); -REG_STRIDE (EV_CH_E_CNTXT_8 , ev_ch_e_cntxt_8, -0x0001d020 +0x4000 *GSI_EE_AP ,0x80 ); +static const u32 reg_ev_ch_e_cntxt_8_fmask[] = { + [EV_MODT ] =GENMASK (15 ,0 ), + [EV_MODC ] =GENMASK (23 ,16 ), + [EV_MOD_CNT ] =GENMASK (31 ,24 ), +}; + +REG_STRIDE_FIELDS (EV_CH_E_CNTXT_8 , ev_ch_e_cntxt_8, +0x0001d020 +0x4000 *GSI_EE_AP ,0x80 );REG_STRIDE (EV_CH_E_CNTXT_9 , ev_ch_e_cntxt_9,0x0001d024 +0x4000 *GSI_EE_AP ,0x80 );
drivers/net/ipa/reg/gsi_reg-v4.9.c +20 -4
@@ -75,8 +75,18 @@ REG_STRIDE(CH_C_SCRATCH_2, ch_c_scratch_2,REG_STRIDE (CH_C_SCRATCH_3 , ch_c_scratch_3,0x0001c06c +0x4000 *GSI_EE_AP ,0x80 ); -REG_STRIDE (EV_CH_E_CNTXT_0 , ev_ch_e_cntxt_0, -0x0001d000 +0x4000 *GSI_EE_AP ,0x80 ); +static const u32 reg_ev_ch_e_cntxt_0_fmask[] = { + [EV_CHTYPE ] =GENMASK (3 ,0 ), + [EV_EE ] =GENMASK (7 ,4 ), + [EV_EVCHID ] =GENMASK (15 ,8 ), + [EV_INTYPE ] =BIT (16 ), +/* Bits 17-19 reserved */ + [EV_CHSTATE ] =GENMASK (23 ,20 ), + [EV_ELEMENT_SIZE ] =GENMASK (31 ,24 ), +}; + +REG_STRIDE_FIELDS (EV_CH_E_CNTXT_0 , ev_ch_e_cntxt_0, +0x0001d000 +0x4000 *GSI_EE_AP ,0x80 );REG_STRIDE (EV_CH_E_CNTXT_1 , ev_ch_e_cntxt_1,0x0001d004 +0x4000 *GSI_EE_AP ,0x80 );
@@ -90,8 +100,14 @@ REG_STRIDE(EV_CH_E_CNTXT_3, ev_ch_e_cntxt_3,REG_STRIDE (EV_CH_E_CNTXT_4 , ev_ch_e_cntxt_4,0x0001d010 +0x4000 *GSI_EE_AP ,0x80 ); -REG_STRIDE (EV_CH_E_CNTXT_8 , ev_ch_e_cntxt_8, -0x0001d020 +0x4000 *GSI_EE_AP ,0x80 ); +static const u32 reg_ev_ch_e_cntxt_8_fmask[] = { + [EV_MODT ] =GENMASK (15 ,0 ), + [EV_MODC ] =GENMASK (23 ,16 ), + [EV_MOD_CNT ] =GENMASK (31 ,24 ), +}; + +REG_STRIDE_FIELDS (EV_CH_E_CNTXT_8 , ev_ch_e_cntxt_8, +0x0001d020 +0x4000 *GSI_EE_AP ,0x80 );REG_STRIDE (EV_CH_E_CNTXT_9 , ev_ch_e_cntxt_9,0x0001d024 +0x4000 *GSI_EE_AP ,0x80 );
Signature · 1 line
2.34.1
PATCH 6/6 net: ipa: define fields for remaining GSI registers
In reply to Alex ElderDefine field IDs for the remaining GSI registers, and populate the register definition files accordingly. Use the reg_*() functions to access field values for those regiters, and get rid of the previous field definition constants.
--- drivers/net/ipa/gsi.c | 47 +++++++++-------- drivers/net/ipa/gsi_reg.h | 78 ++++++++++++++++------------ drivers/net/ipa/reg/gsi_reg-v3.1.c | 59 ++++++++++++++++++--- drivers/net/ipa/reg/gsi_reg-v3.5.1.c | 70 ++++++++++++++++++++++--- drivers/net/ipa/reg/gsi_reg-v4.0.c | 74 +++++++++++++++++++++++--- drivers/net/ipa/reg/gsi_reg-v4.11.c | 76 ++++++++++++++++++++++++--- drivers/net/ipa/reg/gsi_reg-v4.5.c | 75 +++++++++++++++++++++++--- drivers/net/ipa/reg/gsi_reg-v4.9.c | 75 +++++++++++++++++++++++--- 8 files changed, 452 insertions(+), 102 deletions(-)
drivers/net/ipa/gsi.c +24 -23
@@ -431,8 +431,8 @@ static void gsi_evt_ring_command(struct gsi *gsi, u32 evt_ring_id,gsi_irq_ev_ctrl_enable (gsi, evt_ring_id); reg =gsi_reg (gsi,EV_CH_CMD ); - val =u32_encode_bits (evt_ring_id,EV_CHID_FMASK ); - val |=u32_encode_bits (opcode,EV_OPCODE_FMASK ); + val =reg_encode (reg,EV_CHID , evt_ring_id); + val |=reg_encode (reg,EV_OPCODE , opcode); timeout = !gsi_command (gsi,reg_offset (reg), val);
@@ -548,8 +548,8 @@ gsi_channel_command(struct gsi_channel *channel, enum gsi_ch_cmd_opcode opcode)gsi_irq_ch_ctrl_enable (gsi, channel_id); reg =gsi_reg (gsi,CH_CMD ); - val =u32_encode_bits (channel_id,CH_CHID_FMASK ); - val |=u32_encode_bits (opcode,CH_OPCODE_FMASK ); + val =reg_encode (reg,CH_CHID , channel_id); + val |=reg_encode (reg,CH_OPCODE , opcode); timeout = !gsi_command (gsi,reg_offset (reg), val);
@@ -1220,28 +1220,29 @@ gsi_isr_glob_evt_err(struct gsi *gsi, u32 err_ee, u32 evt_ring_id, u32 code)/* Global error interrupt handler */ static void gsi_isr_glob_err (struct gsi *gsi) { +const struct reg *log_reg; +const struct reg *clr_reg;enum gsi_err_type type;enum gsi_err_code code; -const struct reg *reg;u32 offset;u32 which;u32 val;u32 ee;/* Get the logged error, then reinitialize the log */ - reg =gsi_reg (gsi,ERROR_LOG ); - offset =reg_offset (reg); + log_reg =gsi_reg (gsi,ERROR_LOG ); + offset =reg_offset (log_reg); val =ioread32 (gsi->virt + offset);iowrite32 (0 , gsi->virt + offset); - reg =gsi_reg (gsi,ERROR_LOG_CLR ); -iowrite32 (~0 , gsi->virt +reg_offset (reg)); + clr_reg =gsi_reg (gsi,ERROR_LOG_CLR ); +iowrite32 (~0 , gsi->virt +reg_offset (clr_reg));/* Parse the error value */ - ee =u32_get_bits (val,ERR_EE_FMASK ); - type =u32_get_bits (val,ERR_TYPE_FMASK ); - which =u32_get_bits (val,ERR_VIRT_IDX_FMASK ); - code =u32_get_bits (val,ERR_CODE_FMASK ); + ee =reg_decode (log_reg,ERR_EE , val); + type =reg_decode (log_reg,ERR_TYPE , val); + which =reg_decode (log_reg,ERR_VIRT_IDX , val); + code =reg_decode (log_reg,ERR_CODE , val);if (type ==GSI_ERR_TYPE_CHAN )gsi_isr_glob_chan_err (gsi, ee, which, code);
@@ -1279,7 +1280,7 @@ static void gsi_isr_gp_int1(struct gsi *gsi)*/ reg =gsi_reg (gsi,CNTXT_SCRATCH_0 ); val =ioread32 (gsi->virt +reg_offset (reg)); - result =u32_get_bits (val,GENERIC_EE_RESULT_FMASK ); + result =reg_decode (reg,GENERIC_EE_RESULT , val);switch (result) {case GENERIC_EE_SUCCESS :
@@ -1801,16 +1802,16 @@ static int gsi_generic_command(struct gsi *gsi, u32 channel_id, offset =reg_offset (reg); val =ioread32 (gsi->virt + offset); - val &= ~GENERIC_EE_RESULT_FMASK ; + val &= ~reg_fmask (reg,GENERIC_EE_RESULT );iowrite32 (val, gsi->virt + offset);/* Now issue the command */ reg =gsi_reg (gsi,GENERIC_CMD ); - 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 =reg_encode (reg,GENERIC_OPCODE , opcode); + val |=reg_encode (reg,GENERIC_CHID , channel_id); + val |=reg_encode (reg,GENERIC_EE ,GSI_EE_MODEM );if (gsi->version >=IPA_VERSION_4_11 ) - val |=u32_encode_bits (params,GENERIC_PARAMS_FMASK ); + val |=reg_encode (reg,GENERIC_PARAMS , params); timeout = !gsi_command (gsi,reg_offset (reg), val);
@@ -1978,7 +1979,7 @@ static int gsi_irq_setup(struct gsi *gsi)/* Writing 1 indicates IRQ interrupts; 0 would be MSI */ reg =gsi_reg (gsi,CNTXT_INTSET ); -iowrite32 (1 , gsi->virt +reg_offset (reg)); +iowrite32 (reg_bit (reg,INTYPE ), gsi->virt +reg_offset (reg));/* Disable all interrupt types */ gsi_irq_type_update (gsi,0 );
@@ -2040,7 +2041,7 @@ static int gsi_ring_setup(struct gsi *gsi) reg =gsi_reg (gsi,HW_PARAM_2 ); val =ioread32 (gsi->virt +reg_offset (reg)); - count =u32_get_bits (val,NUM_CH_PER_EE_FMASK ); + count =reg_decode (reg,NUM_CH_PER_EE , val);if (!count) {dev_err (dev,"GSI reports zero channels supported\n" );return -EINVAL ;
@@ -2052,7 +2053,7 @@ static int gsi_ring_setup(struct gsi *gsi) } gsi->channel_count = count; - count =u32_get_bits (val,NUM_EV_PER_EE_FMASK ); + count =reg_decode (reg,NUM_EV_PER_EE , val);if (!count) {dev_err (dev,"GSI reports zero event rings supported\n" );return -EINVAL ;
@@ -2078,7 +2079,7 @@ int gsi_setup(struct gsi *gsi)/* Here is where we first touch the GSI hardware */ reg =gsi_reg (gsi,GSI_STATUS ); val =ioread32 (gsi->virt +reg_offset (reg)); -if (!(val &ENABLED_FMASK )) { +if (!(val ®_bit (reg,ENABLED ))) {dev_err (gsi->dev,"GSI has not been enabled\n" );return -EIO ; }
drivers/net/ipa/gsi_reg.h +46 -32
118 lines not on this page · raw message
drivers/net/ipa/reg/gsi_reg-v3.1.c +52 -7
81 lines not on this page · raw message
drivers/net/ipa/reg/gsi_reg-v3.5.1.c +62 -8
93 lines not on this page · raw message
drivers/net/ipa/reg/gsi_reg-v4.0.c +66 -8
97 lines not on this page · raw message
drivers/net/ipa/reg/gsi_reg-v4.11.c +68 -8
99 lines not on this page · raw message
drivers/net/ipa/reg/gsi_reg-v4.5.c +67 -8
98 lines not on this page · raw message
drivers/net/ipa/reg/gsi_reg-v4.9.c +67 -8
98 lines not on this page · raw message
Signature · 1 line
2.34.1
This series was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:
Quoted 12 lines · On Mon, 13 Feb 2023 10:22:23 -0600 you wrote:
Now that we have "reg" definitions in place to define GSI register offsets, add the definitions for the fields of GSI registers that have them.
There aren't many differences between versions, but a few fields are present only in some versions of IPA, so additional "
gsi_reg-vX.Y.c" files are created to capture such differences. As in the previous series, these files are created as near-copies of existing files just before they're needed to represent these differences. The first patch adds files for IPA v4.0, v4.5, and v4.9; the fifth patch adds a file for IPA v4.11.
Quoted 1 line
[...]
Here is the summary with links:
- [net-next,1/6] net: ipa: populate more GSI register files
https://git.kernel.org/netdev/net-next/c/4a4270cff65f - [net-next,2/6] net: ipa: define GSI CH_C_QOS register fields https://git.kernel.org/netdev/net-next/c/f50ca7cef7c7 - [net-next,3/6] net: ipa: define more fields for GSI registers (no matching commit) - [net-next,4/6] net: ipa: define fields for event-ring related registers https://git.kernel.org/netdev/net-next/c/edc6158b18af - [net-next,5/6] net: ipa: add "gsi_v4.11.c" https://git.kernel.org/netdev/net-next/c/aa07fd4358f5
- [net-next,6/6] net: ipa: define fields for remaining GSI registers (no matching commit)
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html