net: ipa: introduce __gsi_channel_start()
Create a new function that does most of the work of starting a channel. What's different is that it takes a flag indicating whether the channel should really be started or not. Create another new function __gsi_channel_stop() that behaves similarly. IPA v3.5.1 implements suspend using a special SUSPEND endpoint setting. If the endpoint is suspended when an I/O completes on the underlying GSI channel, a SUSPEND interrupt is generated. Newer versions of IPA do not implement the SUSPEND endpoint mode. Instead, endpoint suspend is implemented by simply stopping the underlying GSI channel. In this case, a completing I/O on a *stopped* channel causes the SUSPEND interrupt condition. These new functions put all activity related to starting or stopping a channel (including "thawing/freezing" the channel) in one place, whether or not the channel is actually started or stopped. Signed-off-by: Alex Elder <elder@linaro.org> Acked-by: Willem de Bruijn <willemb@google.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Родитель
697e834e14
Коммит
893b838e73
|
@ -873,15 +873,14 @@ static void gsi_channel_deprogram(struct gsi_channel *channel)
|
||||||
/* Nothing to do */
|
/* Nothing to do */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Start an allocated GSI channel */
|
static int __gsi_channel_start(struct gsi_channel *channel, bool start)
|
||||||
int gsi_channel_start(struct gsi *gsi, u32 channel_id)
|
|
||||||
{
|
{
|
||||||
struct gsi_channel *channel = &gsi->channel[channel_id];
|
struct gsi *gsi = channel->gsi;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
mutex_lock(&gsi->mutex);
|
mutex_lock(&gsi->mutex);
|
||||||
|
|
||||||
ret = gsi_channel_start_command(channel);
|
ret = start ? gsi_channel_start_command(channel) : 0;
|
||||||
|
|
||||||
mutex_unlock(&gsi->mutex);
|
mutex_unlock(&gsi->mutex);
|
||||||
|
|
||||||
|
@ -892,6 +891,14 @@ int gsi_channel_start(struct gsi *gsi, u32 channel_id)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Start an allocated GSI channel */
|
||||||
|
int gsi_channel_start(struct gsi *gsi, u32 channel_id)
|
||||||
|
{
|
||||||
|
struct gsi_channel *channel = &gsi->channel[channel_id];
|
||||||
|
|
||||||
|
return __gsi_channel_start(channel, true);
|
||||||
|
}
|
||||||
|
|
||||||
static int gsi_channel_stop_retry(struct gsi_channel *channel)
|
static int gsi_channel_stop_retry(struct gsi_channel *channel)
|
||||||
{
|
{
|
||||||
u32 retries = GSI_CHANNEL_STOP_RETRIES;
|
u32 retries = GSI_CHANNEL_STOP_RETRIES;
|
||||||
|
@ -912,15 +919,13 @@ static int gsi_channel_stop_retry(struct gsi_channel *channel)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Stop a started channel */
|
static int __gsi_channel_stop(struct gsi_channel *channel, bool stop)
|
||||||
int gsi_channel_stop(struct gsi *gsi, u32 channel_id)
|
|
||||||
{
|
{
|
||||||
struct gsi_channel *channel = &gsi->channel[channel_id];
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
gsi_channel_freeze(channel);
|
gsi_channel_freeze(channel);
|
||||||
|
|
||||||
ret = gsi_channel_stop_retry(channel);
|
ret = stop ? gsi_channel_stop_retry(channel) : 0;
|
||||||
|
|
||||||
/* Re-thaw the channel if an error occurred while stopping */
|
/* Re-thaw the channel if an error occurred while stopping */
|
||||||
if (ret)
|
if (ret)
|
||||||
|
@ -929,6 +934,14 @@ int gsi_channel_stop(struct gsi *gsi, u32 channel_id)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Stop a started channel */
|
||||||
|
int gsi_channel_stop(struct gsi *gsi, u32 channel_id)
|
||||||
|
{
|
||||||
|
struct gsi_channel *channel = &gsi->channel[channel_id];
|
||||||
|
|
||||||
|
return __gsi_channel_stop(channel, true);
|
||||||
|
}
|
||||||
|
|
||||||
/* Reset and reconfigure a channel, (possibly) enabling the doorbell engine */
|
/* Reset and reconfigure a channel, (possibly) enabling the doorbell engine */
|
||||||
void gsi_channel_reset(struct gsi *gsi, u32 channel_id, bool doorbell)
|
void gsi_channel_reset(struct gsi *gsi, u32 channel_id, bool doorbell)
|
||||||
{
|
{
|
||||||
|
@ -952,12 +965,7 @@ int gsi_channel_suspend(struct gsi *gsi, u32 channel_id, bool stop)
|
||||||
{
|
{
|
||||||
struct gsi_channel *channel = &gsi->channel[channel_id];
|
struct gsi_channel *channel = &gsi->channel[channel_id];
|
||||||
|
|
||||||
if (stop)
|
return __gsi_channel_stop(channel, stop);
|
||||||
return gsi_channel_stop(gsi, channel_id);
|
|
||||||
|
|
||||||
gsi_channel_freeze(channel);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Resume a suspended channel (starting will be requested if STOPPED) */
|
/* Resume a suspended channel (starting will be requested if STOPPED) */
|
||||||
|
@ -965,12 +973,7 @@ int gsi_channel_resume(struct gsi *gsi, u32 channel_id, bool start)
|
||||||
{
|
{
|
||||||
struct gsi_channel *channel = &gsi->channel[channel_id];
|
struct gsi_channel *channel = &gsi->channel[channel_id];
|
||||||
|
|
||||||
if (start)
|
return __gsi_channel_start(channel, start);
|
||||||
return gsi_channel_start(gsi, channel_id);
|
|
||||||
|
|
||||||
gsi_channel_thaw(channel);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Загрузка…
Ссылка в новой задаче