Skip to content

Commit

Permalink
net: ipa: set up the microcontroller earlier
Browse files Browse the repository at this point in the history
Initializing up the IPA-resident microcontroller requires the IPA
clock, and sets up two IPA interrupt handlers, but this does not
require GSI access.  The interrupt handlers also require the clock
to be enabled, and require the IPA memory regions to be configured,
but neither requires GSI access.  As a result, the microcontroller
can be initialized during the "config" rather than "setup" phase of
IPA initialization.

Initialize the microcontroller in ipa_config() rather than
ipa_setup(), and rename the called function ipa_uc_config().
Do the inverse in ipa_deconfig() rather than ipa_teardown(),
and rename the function for that case ipa_uc_deconfig().

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Alex Elder authored and David S. Miller committed Jul 26, 2021
1 parent 1118a14 commit dc8f7e3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
12 changes: 6 additions & 6 deletions drivers/net/ipa/ipa_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,9 @@ int ipa_setup(struct ipa *ipa)
ipa_interrupt_add(ipa->interrupt, IPA_IRQ_TX_SUSPEND,
ipa_suspend_handler);

ipa_uc_setup(ipa);

ret = device_init_wakeup(dev, true);
if (ret)
goto err_uc_teardown;
goto err_interrupt_remove;

ipa_endpoint_setup(ipa);

Expand Down Expand Up @@ -180,8 +178,7 @@ int ipa_setup(struct ipa *ipa)
err_endpoint_teardown:
ipa_endpoint_teardown(ipa);
(void)device_init_wakeup(dev, false);
err_uc_teardown:
ipa_uc_teardown(ipa);
err_interrupt_remove:
ipa_interrupt_remove(ipa->interrupt, IPA_IRQ_TX_SUSPEND);
gsi_teardown(&ipa->gsi);

Expand All @@ -205,7 +202,6 @@ static void ipa_teardown(struct ipa *ipa)
ipa_endpoint_disable_one(command_endpoint);
ipa_endpoint_teardown(ipa);
(void)device_init_wakeup(&ipa->pdev->dev, false);
ipa_uc_teardown(ipa);
ipa_interrupt_remove(ipa->interrupt, IPA_IRQ_TX_SUSPEND);
gsi_teardown(&ipa->gsi);
}
Expand Down Expand Up @@ -471,6 +467,8 @@ static int ipa_config(struct ipa *ipa, const struct ipa_data *data)
goto err_mem_deconfig;
}

ipa_uc_config(ipa);

ret = ipa_endpoint_config(ipa);
if (ret)
goto err_interrupt_deconfig;
Expand All @@ -491,6 +489,7 @@ static int ipa_config(struct ipa *ipa, const struct ipa_data *data)
err_endpoint_deconfig:
ipa_endpoint_deconfig(ipa);
err_interrupt_deconfig:
ipa_uc_deconfig(ipa);
ipa_interrupt_deconfig(ipa->interrupt);
ipa->interrupt = NULL;
err_mem_deconfig:
Expand All @@ -510,6 +509,7 @@ static void ipa_deconfig(struct ipa *ipa)
{
ipa_modem_deconfig(ipa);
ipa_endpoint_deconfig(ipa);
ipa_uc_deconfig(ipa);
ipa_interrupt_deconfig(ipa->interrupt);
ipa->interrupt = NULL;
ipa_mem_deconfig(ipa);
Expand Down
8 changes: 4 additions & 4 deletions drivers/net/ipa/ipa_uc.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ static void ipa_uc_response_hdlr(struct ipa *ipa, enum ipa_irq_id irq_id)
}
}

/* ipa_uc_setup() - Set up the microcontroller */
void ipa_uc_setup(struct ipa *ipa)
/* Configure the IPA microcontroller subsystem */
void ipa_uc_config(struct ipa *ipa)
{
/* The microcontroller needs the IPA clock running until it has
* completed its initialization. It signals this by sending an
Expand All @@ -180,8 +180,8 @@ void ipa_uc_setup(struct ipa *ipa)
ipa_interrupt_add(ipa->interrupt, IPA_IRQ_UC_1, ipa_uc_response_hdlr);
}

/* Inverse of ipa_uc_setup() */
void ipa_uc_teardown(struct ipa *ipa)
/* Inverse of ipa_uc_config() */
void ipa_uc_deconfig(struct ipa *ipa)
{
ipa_interrupt_remove(ipa->interrupt, IPA_IRQ_UC_1);
ipa_interrupt_remove(ipa->interrupt, IPA_IRQ_UC_0);
Expand Down
8 changes: 4 additions & 4 deletions drivers/net/ipa/ipa_uc.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@
struct ipa;

/**
* ipa_uc_setup() - set up the IPA microcontroller subsystem
* ipa_uc_config() - Configure the IPA microcontroller subsystem
* @ipa: IPA pointer
*/
void ipa_uc_setup(struct ipa *ipa);
void ipa_uc_config(struct ipa *ipa);

/**
* ipa_uc_teardown() - inverse of ipa_uc_setup()
* ipa_uc_deconfig() - Inverse of ipa_uc_config()
* @ipa: IPA pointer
*/
void ipa_uc_teardown(struct ipa *ipa);
void ipa_uc_deconfig(struct ipa *ipa);

/**
* ipa_uc_panic_notifier()
Expand Down

0 comments on commit dc8f7e3

Please sign in to comment.