Commit 8eceea41 authored by David S. Miller's avatar David S. Miller

Merge branch 'ipa-pm-irqs'

Alex Elder says:

====================
net: ipa: prepare GSI interrupts for runtime PM

The last patch in this series arranges for GSI interrupts to be
disabled when the IPA hardware is suspended.  This ensures the clock
is always operational when a GSI interrupt fires.  Leading up to
that are patches that rearrange the code a bit to allow this to
be done.

The first two patches aren't *directly* related.  They remove some
flag arguments to some GSI suspend/resume related functions, using
the version field now present in the GSI structure.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 93bbcfee 45a42a3c
This diff is collapsed.
...@@ -232,8 +232,35 @@ int gsi_channel_stop(struct gsi *gsi, u32 channel_id); ...@@ -232,8 +232,35 @@ int gsi_channel_stop(struct gsi *gsi, u32 channel_id);
*/ */
void gsi_channel_reset(struct gsi *gsi, u32 channel_id, bool doorbell); void gsi_channel_reset(struct gsi *gsi, u32 channel_id, bool doorbell);
int gsi_channel_suspend(struct gsi *gsi, u32 channel_id, bool stop); /**
int gsi_channel_resume(struct gsi *gsi, u32 channel_id, bool start); * gsi_suspend() - Prepare the GSI subsystem for suspend
* @gsi: GSI pointer
*/
void gsi_suspend(struct gsi *gsi);
/**
* gsi_resume() - Resume the GSI subsystem following suspend
* @gsi: GSI pointer
*/
void gsi_resume(struct gsi *gsi);
/**
* gsi_channel_suspend() - Suspend a GSI channel
* @gsi: GSI pointer
* @channel_id: Channel to suspend
*
* For IPA v4.0+, suspend is implemented by stopping the channel.
*/
int gsi_channel_suspend(struct gsi *gsi, u32 channel_id);
/**
* gsi_channel_resume() - Resume a suspended GSI channel
* @gsi: GSI pointer
* @channel_id: Channel to resume
*
* For IPA v4.0+, the stopped channel is started again.
*/
int gsi_channel_resume(struct gsi *gsi, u32 channel_id);
/** /**
* gsi_init() - Initialize the GSI subsystem * gsi_init() - Initialize the GSI subsystem
......
...@@ -1587,7 +1587,6 @@ void ipa_endpoint_suspend_one(struct ipa_endpoint *endpoint) ...@@ -1587,7 +1587,6 @@ void ipa_endpoint_suspend_one(struct ipa_endpoint *endpoint)
{ {
struct device *dev = &endpoint->ipa->pdev->dev; struct device *dev = &endpoint->ipa->pdev->dev;
struct gsi *gsi = &endpoint->ipa->gsi; struct gsi *gsi = &endpoint->ipa->gsi;
bool stop_channel;
int ret; int ret;
if (!(endpoint->ipa->enabled & BIT(endpoint->endpoint_id))) if (!(endpoint->ipa->enabled & BIT(endpoint->endpoint_id)))
...@@ -1598,11 +1597,7 @@ void ipa_endpoint_suspend_one(struct ipa_endpoint *endpoint) ...@@ -1598,11 +1597,7 @@ void ipa_endpoint_suspend_one(struct ipa_endpoint *endpoint)
(void)ipa_endpoint_program_suspend(endpoint, true); (void)ipa_endpoint_program_suspend(endpoint, true);
} }
/* Starting with IPA v4.0, endpoints are suspended by stopping the ret = gsi_channel_suspend(gsi, endpoint->channel_id);
* underlying GSI channel rather than using endpoint suspend mode.
*/
stop_channel = endpoint->ipa->version >= IPA_VERSION_4_0;
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,
endpoint->channel_id); endpoint->channel_id);
...@@ -1612,7 +1607,6 @@ void ipa_endpoint_resume_one(struct ipa_endpoint *endpoint) ...@@ -1612,7 +1607,6 @@ void ipa_endpoint_resume_one(struct ipa_endpoint *endpoint)
{ {
struct device *dev = &endpoint->ipa->pdev->dev; struct device *dev = &endpoint->ipa->pdev->dev;
struct gsi *gsi = &endpoint->ipa->gsi; struct gsi *gsi = &endpoint->ipa->gsi;
bool start_channel;
int ret; int ret;
if (!(endpoint->ipa->enabled & BIT(endpoint->endpoint_id))) if (!(endpoint->ipa->enabled & BIT(endpoint->endpoint_id)))
...@@ -1621,11 +1615,7 @@ void ipa_endpoint_resume_one(struct ipa_endpoint *endpoint) ...@@ -1621,11 +1615,7 @@ void ipa_endpoint_resume_one(struct ipa_endpoint *endpoint)
if (!endpoint->toward_ipa) if (!endpoint->toward_ipa)
(void)ipa_endpoint_program_suspend(endpoint, false); (void)ipa_endpoint_program_suspend(endpoint, false);
/* Starting with IPA v4.0, the underlying GSI channel must be ret = gsi_channel_resume(gsi, endpoint->channel_id);
* restarted for resume.
*/
start_channel = endpoint->ipa->version >= IPA_VERSION_4_0;
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,
endpoint->channel_id); endpoint->channel_id);
......
...@@ -892,6 +892,7 @@ static int ipa_suspend(struct device *dev) ...@@ -892,6 +892,7 @@ static int ipa_suspend(struct device *dev)
if (ipa->setup_complete) { if (ipa->setup_complete) {
__clear_bit(IPA_FLAG_RESUMED, ipa->flags); __clear_bit(IPA_FLAG_RESUMED, ipa->flags);
ipa_endpoint_suspend(ipa); ipa_endpoint_suspend(ipa);
gsi_suspend(&ipa->gsi);
} }
ipa_clock_put(ipa); ipa_clock_put(ipa);
...@@ -919,8 +920,10 @@ static int ipa_resume(struct device *dev) ...@@ -919,8 +920,10 @@ static int ipa_resume(struct device *dev)
ipa_clock_get(ipa); ipa_clock_get(ipa);
/* Endpoints aren't usable until setup is complete */ /* Endpoints aren't usable until setup is complete */
if (ipa->setup_complete) if (ipa->setup_complete) {
gsi_resume(&ipa->gsi);
ipa_endpoint_resume(ipa); ipa_endpoint_resume(ipa);
}
return 0; return 0;
} }
......
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