Commit 46dda53e authored by Alex Elder's avatar Alex Elder Committed by Jakub Kicinski

net: ipa: use common value for channel type and protocol

The numeric values that represent the event ring channel type are
identical to the values that represent the matching protocol used
for a channel.  Use a new gsi_channel_type enumerated type to
represent the values programmed for both cases, using "CHANNEL_TYPE"
in member names in place of "EVT_CHTYPE" and "CHANNEL_PROTOCOL".
Signed-off-by: default avatarAlex Elder <elder@linaro.org>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 6c6358cc
...@@ -127,20 +127,12 @@ enum gsi_err_type { ...@@ -127,20 +127,12 @@ enum gsi_err_type {
GSI_ERR_TYPE_EVT = 0x3, GSI_ERR_TYPE_EVT = 0x3,
}; };
/* Hardware values used when programming an event ring */ /* Hardware values used when programming a channel or event ring type */
enum gsi_evt_chtype { enum gsi_channel_type {
GSI_EVT_CHTYPE_MHI_EV = 0x0, GSI_CHANNEL_TYPE_MHI = 0x0,
GSI_EVT_CHTYPE_XHCI_EV = 0x1, GSI_CHANNEL_TYPE_XHCI = 0x1,
GSI_EVT_CHTYPE_GPI_EV = 0x2, GSI_CHANNEL_TYPE_GPI = 0x2,
GSI_EVT_CHTYPE_XDCI_EV = 0x3, GSI_CHANNEL_TYPE_XDCI = 0x3,
};
/* Hardware values used when programming a channel */
enum gsi_channel_protocol {
GSI_CHANNEL_PROTOCOL_MHI = 0x0,
GSI_CHANNEL_PROTOCOL_XHCI = 0x1,
GSI_CHANNEL_PROTOCOL_GPI = 0x2,
GSI_CHANNEL_PROTOCOL_XDCI = 0x3,
}; };
/* Hardware values representing an event ring immediate command opcode */ /* Hardware values representing an event ring immediate command opcode */
...@@ -684,7 +676,8 @@ static void gsi_evt_ring_program(struct gsi *gsi, u32 evt_ring_id) ...@@ -684,7 +676,8 @@ static void gsi_evt_ring_program(struct gsi *gsi, u32 evt_ring_id)
size_t size = evt_ring->ring.count * GSI_RING_ELEMENT_SIZE; size_t size = evt_ring->ring.count * GSI_RING_ELEMENT_SIZE;
u32 val; u32 val;
val = u32_encode_bits(GSI_EVT_CHTYPE_GPI_EV, EV_CHTYPE_FMASK); /* 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 |= EV_INTYPE_FMASK;
val |= u32_encode_bits(GSI_RING_ELEMENT_SIZE, EV_ELEMENT_SIZE_FMASK); val |= u32_encode_bits(GSI_RING_ELEMENT_SIZE, EV_ELEMENT_SIZE_FMASK);
iowrite32(val, gsi->virt + GSI_EV_CH_E_CNTXT_0_OFFSET(evt_ring_id)); iowrite32(val, gsi->virt + GSI_EV_CH_E_CNTXT_0_OFFSET(evt_ring_id));
...@@ -791,8 +784,8 @@ static void gsi_channel_program(struct gsi_channel *channel, bool doorbell) ...@@ -791,8 +784,8 @@ static void gsi_channel_program(struct gsi_channel *channel, bool doorbell)
/* Arbitrarily pick TRE 0 as the first channel element to use */ /* Arbitrarily pick TRE 0 as the first channel element to use */
channel->tre_ring.index = 0; channel->tre_ring.index = 0;
/* We program all channels to use GPI protocol */ /* We program all channels as GPI type/protocol */
val = u32_encode_bits(GSI_CHANNEL_PROTOCOL_GPI, CHTYPE_PROTOCOL_FMASK); val = u32_encode_bits(GSI_CHANNEL_TYPE_GPI, CHTYPE_PROTOCOL_FMASK);
if (channel->toward_ipa) if (channel->toward_ipa)
val |= CHTYPE_DIR_FMASK; val |= CHTYPE_DIR_FMASK;
val |= u32_encode_bits(channel->evt_ring_id, ERINDEX_FMASK); val |= u32_encode_bits(channel->evt_ring_id, ERINDEX_FMASK);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment