Skip to content

Commit

Permalink
Merge branch 'net-ipa-three-bug-fixes'
Browse files Browse the repository at this point in the history
Alex Elder says:

====================
net: ipa: three bug fixes

This series fixes three bugs in the Qualcomm IPA code.  The third
adds a missing error code initialization step.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed May 1, 2020
2 parents de04604 + 0b1ba18 commit c778980
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
11 changes: 9 additions & 2 deletions drivers/net/ipa/gsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1041,6 +1041,7 @@ static void gsi_isr_gp_int1(struct gsi *gsi)

complete(&gsi->completion);
}

/* Inter-EE interrupt handler */
static void gsi_isr_glob_ee(struct gsi *gsi)
{
Expand Down Expand Up @@ -1493,6 +1494,12 @@ static int gsi_generic_command(struct gsi *gsi, u32 channel_id,
struct completion *completion = &gsi->completion;
u32 val;

/* First zero the result code field */
val = ioread32(gsi->virt + GSI_CNTXT_SCRATCH_0_OFFSET);
val &= ~GENERIC_EE_RESULT_FMASK;
iowrite32(val, gsi->virt + GSI_CNTXT_SCRATCH_0_OFFSET);

/* Now issue the command */
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);
Expand Down Expand Up @@ -1798,9 +1805,9 @@ static int gsi_channel_init_one(struct gsi *gsi,

/* Worst case we need an event for every outstanding TRE */
if (data->channel.tre_count > data->channel.event_count) {
dev_warn(gsi->dev, "channel %u limited to %u TREs\n",
data->channel_id, data->channel.tre_count);
tre_count = data->channel.event_count;
dev_warn(gsi->dev, "channel %u limited to %u TREs\n",
data->channel_id, tre_count);
} else {
tre_count = data->channel.tre_count;
}
Expand Down
2 changes: 2 additions & 0 deletions drivers/net/ipa/gsi_reg.h
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,8 @@
#define INTER_EE_RESULT_FMASK GENMASK(2, 0)
#define GENERIC_EE_RESULT_FMASK GENMASK(7, 5)
#define GENERIC_EE_SUCCESS_FVAL 1
#define GENERIC_EE_INCORRECT_DIRECTION_FVAL 3
#define GENERIC_EE_INCORRECT_CHANNEL_FVAL 5
#define GENERIC_EE_NO_RESOURCES_FVAL 7
#define USB_MAX_PACKET_FMASK GENMASK(15, 15) /* 0: HS; 1: SS */
#define MHI_BASE_CHANNEL_FMASK GENMASK(31, 24)
Expand Down
7 changes: 2 additions & 5 deletions drivers/net/ipa/ipa_endpoint.c
Original file line number Diff line number Diff line change
Expand Up @@ -1283,20 +1283,17 @@ static int ipa_endpoint_stop_rx_dma(struct ipa *ipa)
*/
int ipa_endpoint_stop(struct ipa_endpoint *endpoint)
{
u32 retries = endpoint->toward_ipa ? 0 : IPA_ENDPOINT_STOP_RX_RETRIES;
u32 retries = IPA_ENDPOINT_STOP_RX_RETRIES;
int ret;

do {
struct ipa *ipa = endpoint->ipa;
struct gsi *gsi = &ipa->gsi;

ret = gsi_channel_stop(gsi, endpoint->channel_id);
if (ret != -EAGAIN)
if (ret != -EAGAIN || endpoint->toward_ipa)
break;

if (endpoint->toward_ipa)
continue;

/* For IPA v3.5.1, send a DMA read task and check again */
if (ipa->version == IPA_VERSION_3_5_1) {
ret = ipa_endpoint_stop_rx_dma(ipa);
Expand Down

0 comments on commit c778980

Please sign in to comment.