net: ipa: move version test inside ipa_endpoint_program_suspend()
IPA version 4.0+ does not support endpoint suspend. Put a test at the top of ipa_endpoint_program_suspend() that returns immediately if suspend is not supported rather than making that check in the caller. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
fff899716f
commit
b07f283ef3
|
@ -378,6 +378,9 @@ ipa_endpoint_program_suspend(struct ipa_endpoint *endpoint, bool enable)
|
||||||
{
|
{
|
||||||
bool suspended;
|
bool suspended;
|
||||||
|
|
||||||
|
if (endpoint->ipa->version != IPA_VERSION_3_5_1)
|
||||||
|
return enable; /* For IPA v4.0+, no change made */
|
||||||
|
|
||||||
/* assert(!endpoint->toward_ipa); */
|
/* assert(!endpoint->toward_ipa); */
|
||||||
|
|
||||||
suspended = ipa_endpoint_init_ctrl(endpoint, enable);
|
suspended = ipa_endpoint_init_ctrl(endpoint, enable);
|
||||||
|
@ -395,26 +398,22 @@ ipa_endpoint_program_suspend(struct ipa_endpoint *endpoint, bool enable)
|
||||||
/* Enable or disable delay or suspend mode on all modem endpoints */
|
/* Enable or disable delay or suspend mode on all modem endpoints */
|
||||||
void ipa_endpoint_modem_pause_all(struct ipa *ipa, bool enable)
|
void ipa_endpoint_modem_pause_all(struct ipa *ipa, bool enable)
|
||||||
{
|
{
|
||||||
bool support_suspend;
|
|
||||||
u32 endpoint_id;
|
u32 endpoint_id;
|
||||||
|
|
||||||
/* DELAY mode doesn't work correctly on IPA v4.2 */
|
/* DELAY mode doesn't work correctly on IPA v4.2 */
|
||||||
if (ipa->version == IPA_VERSION_4_2)
|
if (ipa->version == IPA_VERSION_4_2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Only IPA v3.5.1 supports SUSPEND mode on RX endpoints */
|
|
||||||
support_suspend = ipa->version == IPA_VERSION_3_5_1;
|
|
||||||
|
|
||||||
for (endpoint_id = 0; endpoint_id < IPA_ENDPOINT_MAX; endpoint_id++) {
|
for (endpoint_id = 0; endpoint_id < IPA_ENDPOINT_MAX; endpoint_id++) {
|
||||||
struct ipa_endpoint *endpoint = &ipa->endpoint[endpoint_id];
|
struct ipa_endpoint *endpoint = &ipa->endpoint[endpoint_id];
|
||||||
|
|
||||||
if (endpoint->ee_id != GSI_EE_MODEM)
|
if (endpoint->ee_id != GSI_EE_MODEM)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Set TX delay mode, or for IPA v3.5.1 RX suspend mode */
|
/* Set TX delay mode or RX suspend mode */
|
||||||
if (endpoint->toward_ipa)
|
if (endpoint->toward_ipa)
|
||||||
ipa_endpoint_program_delay(endpoint, enable);
|
ipa_endpoint_program_delay(endpoint, enable);
|
||||||
else if (support_suspend)
|
else
|
||||||
(void)ipa_endpoint_program_suspend(endpoint, enable);
|
(void)ipa_endpoint_program_suspend(endpoint, enable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1248,8 +1247,7 @@ static int ipa_endpoint_reset_rx_aggr(struct ipa_endpoint *endpoint)
|
||||||
gsi_channel_reset(gsi, endpoint->channel_id, false);
|
gsi_channel_reset(gsi, endpoint->channel_id, false);
|
||||||
|
|
||||||
/* Make sure the channel isn't suspended */
|
/* Make sure the channel isn't suspended */
|
||||||
if (endpoint->ipa->version == IPA_VERSION_3_5_1)
|
suspended = ipa_endpoint_program_suspend(endpoint, false);
|
||||||
suspended = ipa_endpoint_program_suspend(endpoint, false);
|
|
||||||
|
|
||||||
/* Start channel and do a 1 byte read */
|
/* Start channel and do a 1 byte read */
|
||||||
ret = gsi_channel_start(gsi, endpoint->channel_id);
|
ret = gsi_channel_start(gsi, endpoint->channel_id);
|
||||||
|
@ -1340,8 +1338,7 @@ static void ipa_endpoint_program(struct ipa_endpoint *endpoint)
|
||||||
ipa_endpoint_init_seq(endpoint);
|
ipa_endpoint_init_seq(endpoint);
|
||||||
ipa_endpoint_init_mode(endpoint);
|
ipa_endpoint_init_mode(endpoint);
|
||||||
} else {
|
} else {
|
||||||
if (endpoint->ipa->version == IPA_VERSION_3_5_1)
|
(void)ipa_endpoint_program_suspend(endpoint, false);
|
||||||
(void)ipa_endpoint_program_suspend(endpoint, false);
|
|
||||||
ipa_endpoint_init_hdr_ext(endpoint);
|
ipa_endpoint_init_hdr_ext(endpoint);
|
||||||
ipa_endpoint_init_aggr(endpoint);
|
ipa_endpoint_init_aggr(endpoint);
|
||||||
ipa_endpoint_init_hdr_metadata_mask(endpoint);
|
ipa_endpoint_init_hdr_metadata_mask(endpoint);
|
||||||
|
@ -1416,11 +1413,11 @@ void ipa_endpoint_suspend_one(struct ipa_endpoint *endpoint)
|
||||||
if (!endpoint->toward_ipa)
|
if (!endpoint->toward_ipa)
|
||||||
ipa_endpoint_replenish_disable(endpoint);
|
ipa_endpoint_replenish_disable(endpoint);
|
||||||
|
|
||||||
/* IPA v3.5.1 doesn't use channel stop for suspend */
|
if (!endpoint->toward_ipa)
|
||||||
stop_channel = endpoint->ipa->version != IPA_VERSION_3_5_1;
|
|
||||||
if (!endpoint->toward_ipa && !stop_channel)
|
|
||||||
(void)ipa_endpoint_program_suspend(endpoint, true);
|
(void)ipa_endpoint_program_suspend(endpoint, true);
|
||||||
|
|
||||||
|
/* IPA v3.5.1 doesn't use channel stop for suspend */
|
||||||
|
stop_channel = endpoint->ipa->version != IPA_VERSION_3_5_1;
|
||||||
ret = gsi_channel_suspend(gsi, endpoint->channel_id, stop_channel);
|
ret = gsi_channel_suspend(gsi, endpoint->channel_id, stop_channel);
|
||||||
if (ret)
|
if (ret)
|
||||||
dev_err(dev, "error %d suspending channel %u\n", ret,
|
dev_err(dev, "error %d suspending channel %u\n", ret,
|
||||||
|
@ -1437,11 +1434,11 @@ void ipa_endpoint_resume_one(struct ipa_endpoint *endpoint)
|
||||||
if (!(endpoint->ipa->enabled & BIT(endpoint->endpoint_id)))
|
if (!(endpoint->ipa->enabled & BIT(endpoint->endpoint_id)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* IPA v3.5.1 doesn't use channel start for resume */
|
if (!endpoint->toward_ipa)
|
||||||
start_channel = endpoint->ipa->version != IPA_VERSION_3_5_1;
|
|
||||||
if (!endpoint->toward_ipa && !start_channel)
|
|
||||||
(void)ipa_endpoint_program_suspend(endpoint, false);
|
(void)ipa_endpoint_program_suspend(endpoint, false);
|
||||||
|
|
||||||
|
/* IPA v3.5.1 doesn't use channel start for resume */
|
||||||
|
start_channel = endpoint->ipa->version != IPA_VERSION_3_5_1;
|
||||||
ret = gsi_channel_resume(gsi, endpoint->channel_id, start_channel);
|
ret = gsi_channel_resume(gsi, endpoint->channel_id, start_channel);
|
||||||
if (ret)
|
if (ret)
|
||||||
dev_err(dev, "error %d resuming channel %u\n", ret,
|
dev_err(dev, "error %d resuming channel %u\n", ret,
|
||||||
|
|
Loading…
Reference in New Issue