Commit 7aa0e8b8 authored by Alex Elder's avatar Alex Elder Committed by David S. Miller

net: ipa: rename ipa_clock_* symbols

Rename a number of functions to clarify that there is no longer a
notion of an "IPA clock," but rather that the functions are more
generally related to IPA power management.

  ipa_clock_enable() -> ipa_power_enable()
  ipa_clock_disable() -> ipa_power_disable()
  ipa_clock_rate() -> ipa_core_clock_rate()
  ipa_clock_init() -> ipa_power_init()
  ipa_clock_exit() -> ipa_power_exit()

Rename the ipa_clock structure to be ipa_power.  Rename all
variables and fields using that structure type "power" rather
than "clock".

Rename the ipa_clock_data structure to be ipa_power_data, and more
broadly, just substitute "power" for "clock" in places that
previously represented things related to the "IPA clock".

Update comments throughout.
Signed-off-by: default avatarAlex Elder <elder@linaro.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1aac309d
...@@ -23,7 +23,7 @@ struct icc_path; ...@@ -23,7 +23,7 @@ struct icc_path;
struct net_device; struct net_device;
struct platform_device; struct platform_device;
struct ipa_clock; struct ipa_power;
struct ipa_smp2p; struct ipa_smp2p;
struct ipa_interrupt; struct ipa_interrupt;
...@@ -36,11 +36,11 @@ struct ipa_interrupt; ...@@ -36,11 +36,11 @@ struct ipa_interrupt;
* @nb: Notifier block used for remoteproc SSR * @nb: Notifier block used for remoteproc SSR
* @notifier: Remoteproc SSR notifier * @notifier: Remoteproc SSR notifier
* @smp2p: SMP2P information * @smp2p: SMP2P information
* @clock: IPA clocking information * @power: IPA power information
* @table_addr: DMA address of filter/route table content * @table_addr: DMA address of filter/route table content
* @table_virt: Virtual address of filter/route table content * @table_virt: Virtual address of filter/route table content
* @interrupt: IPA Interrupt information * @interrupt: IPA Interrupt information
* @uc_clocked: true if clock is active by proxy for microcontroller * @uc_powered: true if power is active by proxy for microcontroller
* @uc_loaded: true after microcontroller has reported it's ready * @uc_loaded: true after microcontroller has reported it's ready
* @reg_addr: DMA address used for IPA register access * @reg_addr: DMA address used for IPA register access
* @reg_virt: Virtual address used for IPA register access * @reg_virt: Virtual address used for IPA register access
...@@ -78,13 +78,13 @@ struct ipa { ...@@ -78,13 +78,13 @@ struct ipa {
struct notifier_block nb; struct notifier_block nb;
void *notifier; void *notifier;
struct ipa_smp2p *smp2p; struct ipa_smp2p *smp2p;
struct ipa_clock *clock; struct ipa_power *power;
dma_addr_t table_addr; dma_addr_t table_addr;
__le64 *table_virt; __le64 *table_virt;
struct ipa_interrupt *interrupt; struct ipa_interrupt *interrupt;
bool uc_clocked; bool uc_powered;
bool uc_loaded; bool uc_loaded;
dma_addr_t reg_addr; dma_addr_t reg_addr;
...@@ -134,11 +134,11 @@ struct ipa { ...@@ -134,11 +134,11 @@ struct ipa {
* *
* Activities performed at the init stage can be done without requiring * Activities performed at the init stage can be done without requiring
* any access to IPA hardware. Activities performed at the config stage * any access to IPA hardware. Activities performed at the config stage
* require the IPA clock to be running, because they involve access * require IPA power, because they involve access to IPA registers.
* to IPA registers. The setup stage is performed only after the GSI * The setup stage is performed only after the GSI hardware is ready
* hardware is ready (more on this below). The setup stage allows * (more on this below). The setup stage allows the AP to perform
* the AP to perform more complex initialization by issuing "immediate * more complex initialization by issuing "immediate commands" using
* commands" using a special interface to the IPA. * a special interface to the IPA.
* *
* This function, @ipa_setup(), starts the setup stage. * This function, @ipa_setup(), starts the setup stage.
* *
......
This diff is collapsed.
...@@ -9,18 +9,18 @@ ...@@ -9,18 +9,18 @@
struct device; struct device;
struct ipa; struct ipa;
struct ipa_clock_data; struct ipa_power_data;
/* IPA device power management function block */ /* IPA device power management function block */
extern const struct dev_pm_ops ipa_pm_ops; extern const struct dev_pm_ops ipa_pm_ops;
/** /**
* ipa_clock_rate() - Return the current IPA core clock rate * ipa_core_clock_rate() - Return the current IPA core clock rate
* @ipa: IPA structure * @ipa: IPA structure
* *
* Return: The current clock rate (in Hz), or 0. * Return: The current clock rate (in Hz), or 0.
*/ */
u32 ipa_clock_rate(struct ipa *ipa); u32 ipa_core_clock_rate(struct ipa *ipa);
/** /**
* ipa_power_modem_queue_stop() - Possibly stop the modem netdev TX queue * ipa_power_modem_queue_stop() - Possibly stop the modem netdev TX queue
...@@ -55,19 +55,19 @@ int ipa_power_setup(struct ipa *ipa); ...@@ -55,19 +55,19 @@ int ipa_power_setup(struct ipa *ipa);
void ipa_power_teardown(struct ipa *ipa); void ipa_power_teardown(struct ipa *ipa);
/** /**
* ipa_clock_init() - Initialize IPA clocking * ipa_power_init() - Initialize IPA power management
* @dev: IPA device * @dev: IPA device
* @data: Clock configuration data * @data: Clock configuration data
* *
* Return: A pointer to an ipa_clock structure, or a pointer-coded error * Return: A pointer to an ipa_power structure, or a pointer-coded error
*/ */
struct ipa_clock *ipa_clock_init(struct device *dev, struct ipa_power *ipa_power_init(struct device *dev,
const struct ipa_clock_data *data); const struct ipa_power_data *data);
/** /**
* ipa_clock_exit() - Inverse of ipa_clock_init() * ipa_power_exit() - Inverse of ipa_power_init()
* @clock: IPA clock pointer * @power: IPA power pointer
*/ */
void ipa_clock_exit(struct ipa_clock *clock); void ipa_power_exit(struct ipa_power *power);
#endif /* _IPA_CLOCK_H_ */ #endif /* _IPA_CLOCK_H_ */
...@@ -513,7 +513,7 @@ static const struct ipa_interconnect_data ipa_interconnect_data[] = { ...@@ -513,7 +513,7 @@ static const struct ipa_interconnect_data ipa_interconnect_data[] = {
}; };
/* Clock and interconnect configuration data for an SoC having IPA v3.1 */ /* Clock and interconnect configuration data for an SoC having IPA v3.1 */
static const struct ipa_clock_data ipa_clock_data = { static const struct ipa_power_data ipa_power_data = {
.core_clock_rate = 16 * 1000 * 1000, /* Hz */ .core_clock_rate = 16 * 1000 * 1000, /* Hz */
.interconnect_count = ARRAY_SIZE(ipa_interconnect_data), .interconnect_count = ARRAY_SIZE(ipa_interconnect_data),
.interconnect_data = ipa_interconnect_data, .interconnect_data = ipa_interconnect_data,
...@@ -529,5 +529,5 @@ const struct ipa_data ipa_data_v3_1 = { ...@@ -529,5 +529,5 @@ const struct ipa_data ipa_data_v3_1 = {
.endpoint_data = ipa_gsi_endpoint_data, .endpoint_data = ipa_gsi_endpoint_data,
.resource_data = &ipa_resource_data, .resource_data = &ipa_resource_data,
.mem_data = &ipa_mem_data, .mem_data = &ipa_mem_data,
.clock_data = &ipa_clock_data, .power_data = &ipa_power_data,
}; };
...@@ -394,7 +394,7 @@ static const struct ipa_interconnect_data ipa_interconnect_data[] = { ...@@ -394,7 +394,7 @@ static const struct ipa_interconnect_data ipa_interconnect_data[] = {
}; };
/* Clock and interconnect configuration data for an SoC having IPA v3.5.1 */ /* Clock and interconnect configuration data for an SoC having IPA v3.5.1 */
static const struct ipa_clock_data ipa_clock_data = { static const struct ipa_power_data ipa_power_data = {
.core_clock_rate = 75 * 1000 * 1000, /* Hz */ .core_clock_rate = 75 * 1000 * 1000, /* Hz */
.interconnect_count = ARRAY_SIZE(ipa_interconnect_data), .interconnect_count = ARRAY_SIZE(ipa_interconnect_data),
.interconnect_data = ipa_interconnect_data, .interconnect_data = ipa_interconnect_data,
...@@ -414,5 +414,5 @@ const struct ipa_data ipa_data_v3_5_1 = { ...@@ -414,5 +414,5 @@ const struct ipa_data ipa_data_v3_5_1 = {
.endpoint_data = ipa_gsi_endpoint_data, .endpoint_data = ipa_gsi_endpoint_data,
.resource_data = &ipa_resource_data, .resource_data = &ipa_resource_data,
.mem_data = &ipa_mem_data, .mem_data = &ipa_mem_data,
.clock_data = &ipa_clock_data, .power_data = &ipa_power_data,
}; };
...@@ -382,7 +382,7 @@ static const struct ipa_interconnect_data ipa_interconnect_data[] = { ...@@ -382,7 +382,7 @@ static const struct ipa_interconnect_data ipa_interconnect_data[] = {
}; };
/* Clock and interconnect configuration data for an SoC having IPA v4.11 */ /* Clock and interconnect configuration data for an SoC having IPA v4.11 */
static const struct ipa_clock_data ipa_clock_data = { static const struct ipa_power_data ipa_power_data = {
.core_clock_rate = 60 * 1000 * 1000, /* Hz */ .core_clock_rate = 60 * 1000 * 1000, /* Hz */
.interconnect_count = ARRAY_SIZE(ipa_interconnect_data), .interconnect_count = ARRAY_SIZE(ipa_interconnect_data),
.interconnect_data = ipa_interconnect_data, .interconnect_data = ipa_interconnect_data,
...@@ -397,5 +397,5 @@ const struct ipa_data ipa_data_v4_11 = { ...@@ -397,5 +397,5 @@ const struct ipa_data ipa_data_v4_11 = {
.endpoint_data = ipa_gsi_endpoint_data, .endpoint_data = ipa_gsi_endpoint_data,
.resource_data = &ipa_resource_data, .resource_data = &ipa_resource_data,
.mem_data = &ipa_mem_data, .mem_data = &ipa_mem_data,
.clock_data = &ipa_clock_data, .power_data = &ipa_power_data,
}; };
...@@ -360,7 +360,7 @@ static const struct ipa_interconnect_data ipa_interconnect_data[] = { ...@@ -360,7 +360,7 @@ static const struct ipa_interconnect_data ipa_interconnect_data[] = {
}; };
/* Clock and interconnect configuration data for an SoC having IPA v4.2 */ /* Clock and interconnect configuration data for an SoC having IPA v4.2 */
static const struct ipa_clock_data ipa_clock_data = { static const struct ipa_power_data ipa_power_data = {
.core_clock_rate = 100 * 1000 * 1000, /* Hz */ .core_clock_rate = 100 * 1000 * 1000, /* Hz */
.interconnect_count = ARRAY_SIZE(ipa_interconnect_data), .interconnect_count = ARRAY_SIZE(ipa_interconnect_data),
.interconnect_data = ipa_interconnect_data, .interconnect_data = ipa_interconnect_data,
...@@ -376,5 +376,5 @@ const struct ipa_data ipa_data_v4_2 = { ...@@ -376,5 +376,5 @@ const struct ipa_data ipa_data_v4_2 = {
.endpoint_data = ipa_gsi_endpoint_data, .endpoint_data = ipa_gsi_endpoint_data,
.resource_data = &ipa_resource_data, .resource_data = &ipa_resource_data,
.mem_data = &ipa_mem_data, .mem_data = &ipa_mem_data,
.clock_data = &ipa_clock_data, .power_data = &ipa_power_data,
}; };
...@@ -443,7 +443,7 @@ static const struct ipa_interconnect_data ipa_interconnect_data[] = { ...@@ -443,7 +443,7 @@ static const struct ipa_interconnect_data ipa_interconnect_data[] = {
}; };
/* Clock and interconnect configuration data for an SoC having IPA v4.5 */ /* Clock and interconnect configuration data for an SoC having IPA v4.5 */
static const struct ipa_clock_data ipa_clock_data = { static const struct ipa_power_data ipa_power_data = {
.core_clock_rate = 150 * 1000 * 1000, /* Hz (150? 60?) */ .core_clock_rate = 150 * 1000 * 1000, /* Hz (150? 60?) */
.interconnect_count = ARRAY_SIZE(ipa_interconnect_data), .interconnect_count = ARRAY_SIZE(ipa_interconnect_data),
.interconnect_data = ipa_interconnect_data, .interconnect_data = ipa_interconnect_data,
...@@ -458,5 +458,5 @@ const struct ipa_data ipa_data_v4_5 = { ...@@ -458,5 +458,5 @@ const struct ipa_data ipa_data_v4_5 = {
.endpoint_data = ipa_gsi_endpoint_data, .endpoint_data = ipa_gsi_endpoint_data,
.resource_data = &ipa_resource_data, .resource_data = &ipa_resource_data,
.mem_data = &ipa_mem_data, .mem_data = &ipa_mem_data,
.clock_data = &ipa_clock_data, .power_data = &ipa_power_data,
}; };
...@@ -432,7 +432,7 @@ static const struct ipa_interconnect_data ipa_interconnect_data[] = { ...@@ -432,7 +432,7 @@ static const struct ipa_interconnect_data ipa_interconnect_data[] = {
}; };
/* Clock and interconnect configuration data for an SoC having IPA v4.9 */ /* Clock and interconnect configuration data for an SoC having IPA v4.9 */
static const struct ipa_clock_data ipa_clock_data = { static const struct ipa_power_data ipa_power_data = {
.core_clock_rate = 60 * 1000 * 1000, /* Hz */ .core_clock_rate = 60 * 1000 * 1000, /* Hz */
.interconnect_count = ARRAY_SIZE(ipa_interconnect_data), .interconnect_count = ARRAY_SIZE(ipa_interconnect_data),
.interconnect_data = ipa_interconnect_data, .interconnect_data = ipa_interconnect_data,
...@@ -447,5 +447,5 @@ const struct ipa_data ipa_data_v4_9 = { ...@@ -447,5 +447,5 @@ const struct ipa_data ipa_data_v4_9 = {
.endpoint_data = ipa_gsi_endpoint_data, .endpoint_data = ipa_gsi_endpoint_data,
.resource_data = &ipa_resource_data, .resource_data = &ipa_resource_data,
.mem_data = &ipa_mem_data, .mem_data = &ipa_mem_data,
.clock_data = &ipa_clock_data, .power_data = &ipa_power_data,
}; };
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
* IPA and GSI resources to use for a given platform. This data is supplied * IPA and GSI resources to use for a given platform. This data is supplied
* via the Device Tree match table, associated with a particular compatible * via the Device Tree match table, associated with a particular compatible
* string. The data defines information about how resources, endpoints and * string. The data defines information about how resources, endpoints and
* channels, memory, clocking and so on are allocated and used for the * channels, memory, power and so on are allocated and used for the
* platform. * platform.
* *
* Resources are data structures used internally by the IPA hardware. The * Resources are data structures used internally by the IPA hardware. The
...@@ -265,12 +265,12 @@ struct ipa_interconnect_data { ...@@ -265,12 +265,12 @@ struct ipa_interconnect_data {
}; };
/** /**
* struct ipa_clock_data - description of IPA clock and interconnect rates * struct ipa_power_data - description of IPA power configuration data
* @core_clock_rate: Core clock rate (Hz) * @core_clock_rate: Core clock rate (Hz)
* @interconnect_count: Number of entries in the interconnect_data array * @interconnect_count: Number of entries in the interconnect_data array
* @interconnect_data: IPA interconnect configuration data * @interconnect_data: IPA interconnect configuration data
*/ */
struct ipa_clock_data { struct ipa_power_data {
u32 core_clock_rate; u32 core_clock_rate;
u32 interconnect_count; /* # entries in interconnect_data[] */ u32 interconnect_count; /* # entries in interconnect_data[] */
const struct ipa_interconnect_data *interconnect_data; const struct ipa_interconnect_data *interconnect_data;
...@@ -286,7 +286,7 @@ struct ipa_clock_data { ...@@ -286,7 +286,7 @@ struct ipa_clock_data {
* @endpoint_data: IPA endpoint/GSI channel data * @endpoint_data: IPA endpoint/GSI channel data
* @resource_data: IPA resource configuration data * @resource_data: IPA resource configuration data
* @mem_data: IPA memory region data * @mem_data: IPA memory region data
* @clock_data: IPA clock and interconnect data * @power_data: IPA power data
*/ */
struct ipa_data { struct ipa_data {
enum ipa_version version; enum ipa_version version;
...@@ -297,7 +297,7 @@ struct ipa_data { ...@@ -297,7 +297,7 @@ struct ipa_data {
const struct ipa_gsi_endpoint_data *endpoint_data; const struct ipa_gsi_endpoint_data *endpoint_data;
const struct ipa_resource_data *resource_data; const struct ipa_resource_data *resource_data;
const struct ipa_mem_data *mem_data; const struct ipa_mem_data *mem_data;
const struct ipa_clock_data *clock_data; const struct ipa_power_data *power_data;
}; };
extern const struct ipa_data ipa_data_v3_1; extern const struct ipa_data ipa_data_v3_1;
......
...@@ -810,7 +810,7 @@ static u32 hol_block_timer_val(struct ipa *ipa, u32 microseconds) ...@@ -810,7 +810,7 @@ static u32 hol_block_timer_val(struct ipa *ipa, u32 microseconds)
return hol_block_timer_qtime_val(ipa, microseconds); return hol_block_timer_qtime_val(ipa, microseconds);
/* Use 64 bit arithmetic to avoid overflow... */ /* Use 64 bit arithmetic to avoid overflow... */
rate = ipa_clock_rate(ipa); rate = ipa_core_clock_rate(ipa);
ticks = DIV_ROUND_CLOSEST(microseconds * rate, 128 * USEC_PER_SEC); ticks = DIV_ROUND_CLOSEST(microseconds * rate, 128 * USEC_PER_SEC);
/* ...but we still need to fit into a 32-bit register */ /* ...but we still need to fit into a 32-bit register */
WARN_ON(ticks > U32_MAX); WARN_ON(ticks > U32_MAX);
......
...@@ -326,8 +326,8 @@ static void ipa_idle_indication_cfg(struct ipa *ipa, ...@@ -326,8 +326,8 @@ static void ipa_idle_indication_cfg(struct ipa *ipa,
* @ipa: IPA pointer * @ipa: IPA pointer
* *
* Configures when the IPA signals it is idle to the global clock * Configures when the IPA signals it is idle to the global clock
* controller, which can respond by scalling down the clock to * controller, which can respond by scaling down the clock to save
* save power. * power.
*/ */
static void ipa_hardware_dcd_config(struct ipa *ipa) static void ipa_hardware_dcd_config(struct ipa *ipa)
{ {
...@@ -417,7 +417,7 @@ static void ipa_hardware_deconfig(struct ipa *ipa) ...@@ -417,7 +417,7 @@ static void ipa_hardware_deconfig(struct ipa *ipa)
* @ipa: IPA pointer * @ipa: IPA pointer
* @data: IPA configuration data * @data: IPA configuration data
* *
* Perform initialization requiring IPA clock to be enabled. * Perform initialization requiring IPA power to be enabled.
*/ */
static int ipa_config(struct ipa *ipa, const struct ipa_data *data) static int ipa_config(struct ipa *ipa, const struct ipa_data *data)
{ {
...@@ -647,7 +647,7 @@ static bool ipa_version_valid(enum ipa_version version) ...@@ -647,7 +647,7 @@ static bool ipa_version_valid(enum ipa_version version)
* in several stages: * in several stages:
* - The "init" stage involves activities that can be initialized without * - The "init" stage involves activities that can be initialized without
* access to the IPA hardware. * access to the IPA hardware.
* - The "config" stage requires the IPA clock to be active so IPA registers * - The "config" stage requires IPA power to be active so IPA registers
* can be accessed, but does not require the use of IPA immediate commands. * can be accessed, but does not require the use of IPA immediate commands.
* - The "setup" stage uses IPA immediate commands, and so requires the GSI * - The "setup" stage uses IPA immediate commands, and so requires the GSI
* layer to be initialized. * layer to be initialized.
...@@ -663,14 +663,14 @@ static int ipa_probe(struct platform_device *pdev) ...@@ -663,14 +663,14 @@ static int ipa_probe(struct platform_device *pdev)
{ {
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
const struct ipa_data *data; const struct ipa_data *data;
struct ipa_clock *clock; struct ipa_power *power;
bool modem_init; bool modem_init;
struct ipa *ipa; struct ipa *ipa;
int ret; int ret;
ipa_validate_build(); ipa_validate_build();
/* Get configuration data early; needed for clock initialization */ /* Get configuration data early; needed for power initialization */
data = of_device_get_match_data(dev); data = of_device_get_match_data(dev);
if (!data) { if (!data) {
dev_err(dev, "matched hardware not supported\n"); dev_err(dev, "matched hardware not supported\n");
...@@ -691,20 +691,20 @@ static int ipa_probe(struct platform_device *pdev) ...@@ -691,20 +691,20 @@ static int ipa_probe(struct platform_device *pdev)
/* The clock and interconnects might not be ready when we're /* The clock and interconnects might not be ready when we're
* probed, so might return -EPROBE_DEFER. * probed, so might return -EPROBE_DEFER.
*/ */
clock = ipa_clock_init(dev, data->clock_data); power = ipa_power_init(dev, data->power_data);
if (IS_ERR(clock)) if (IS_ERR(power))
return PTR_ERR(clock); return PTR_ERR(power);
/* No more EPROBE_DEFER. Allocate and initialize the IPA structure */ /* No more EPROBE_DEFER. Allocate and initialize the IPA structure */
ipa = kzalloc(sizeof(*ipa), GFP_KERNEL); ipa = kzalloc(sizeof(*ipa), GFP_KERNEL);
if (!ipa) { if (!ipa) {
ret = -ENOMEM; ret = -ENOMEM;
goto err_clock_exit; goto err_power_exit;
} }
ipa->pdev = pdev; ipa->pdev = pdev;
dev_set_drvdata(dev, ipa); dev_set_drvdata(dev, ipa);
ipa->clock = clock; ipa->power = power;
ipa->version = data->version; ipa->version = data->version;
init_completion(&ipa->completion); init_completion(&ipa->completion);
...@@ -737,7 +737,7 @@ static int ipa_probe(struct platform_device *pdev) ...@@ -737,7 +737,7 @@ static int ipa_probe(struct platform_device *pdev)
if (ret) if (ret)
goto err_table_exit; goto err_table_exit;
/* The clock needs to be active for config and setup */ /* Power needs to be active for config and setup */
ret = pm_runtime_get_sync(dev); ret = pm_runtime_get_sync(dev);
if (WARN_ON(ret < 0)) if (WARN_ON(ret < 0))
goto err_power_put; goto err_power_put;
...@@ -788,8 +788,8 @@ static int ipa_probe(struct platform_device *pdev) ...@@ -788,8 +788,8 @@ static int ipa_probe(struct platform_device *pdev)
ipa_reg_exit(ipa); ipa_reg_exit(ipa);
err_kfree_ipa: err_kfree_ipa:
kfree(ipa); kfree(ipa);
err_clock_exit: err_power_exit:
ipa_clock_exit(clock); ipa_power_exit(power);
return ret; return ret;
} }
...@@ -797,7 +797,7 @@ static int ipa_probe(struct platform_device *pdev) ...@@ -797,7 +797,7 @@ static int ipa_probe(struct platform_device *pdev)
static int ipa_remove(struct platform_device *pdev) static int ipa_remove(struct platform_device *pdev)
{ {
struct ipa *ipa = dev_get_drvdata(&pdev->dev); struct ipa *ipa = dev_get_drvdata(&pdev->dev);
struct ipa_clock *clock = ipa->clock; struct ipa_power *power = ipa->power;
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
int ret; int ret;
...@@ -828,7 +828,7 @@ static int ipa_remove(struct platform_device *pdev) ...@@ -828,7 +828,7 @@ static int ipa_remove(struct platform_device *pdev)
ipa_mem_exit(ipa); ipa_mem_exit(ipa);
ipa_reg_exit(ipa); ipa_reg_exit(ipa);
kfree(ipa); kfree(ipa);
ipa_clock_exit(clock); ipa_power_exit(power);
return 0; return 0;
} }
......
...@@ -415,7 +415,7 @@ static int ipa_modem_notify(struct notifier_block *nb, unsigned long action, ...@@ -415,7 +415,7 @@ static int ipa_modem_notify(struct notifier_block *nb, unsigned long action,
switch (action) { switch (action) {
case QCOM_SSR_BEFORE_POWERUP: case QCOM_SSR_BEFORE_POWERUP:
dev_info(dev, "received modem starting event\n"); dev_info(dev, "received modem starting event\n");
ipa_uc_clock(ipa); ipa_uc_power(ipa);
ipa_smp2p_notify_reset(ipa); ipa_smp2p_notify_reset(ipa);
break; break;
......
...@@ -23,19 +23,19 @@ ...@@ -23,19 +23,19 @@
* SMP2P is a primitive communication mechanism available between the AP and * SMP2P is a primitive communication mechanism available between the AP and
* the modem. The IPA driver uses this for two purposes: to enable the modem * the modem. The IPA driver uses this for two purposes: to enable the modem
* to state that the GSI hardware is ready to use; and to communicate the * to state that the GSI hardware is ready to use; and to communicate the
* state of the IPA clock in the event of a crash. * state of IPA power in the event of a crash.
* *
* GSI needs to have early initialization completed before it can be used. * GSI needs to have early initialization completed before it can be used.
* This initialization is done either by Trust Zone or by the modem. In the * This initialization is done either by Trust Zone or by the modem. In the
* latter case, the modem uses an SMP2P interrupt to tell the AP IPA driver * latter case, the modem uses an SMP2P interrupt to tell the AP IPA driver
* when the GSI is ready to use. * when the GSI is ready to use.
* *
* The modem is also able to inquire about the current state of the IPA * The modem is also able to inquire about the current state of IPA
* clock by trigging another SMP2P interrupt to the AP. We communicate * power by trigging another SMP2P interrupt to the AP. We communicate
* whether the clock is enabled using two SMP2P state bits--one to * whether power is enabled using two SMP2P state bits--one to indicate
* indicate the clock state (on or off), and a second to indicate the * the power state (on or off), and a second to indicate the power state
* clock state bit is valid. The modem will poll the valid bit until it * bit is valid. The modem will poll the valid bit until it is set, and
* is set, and at that time records whether the AP has the IPA clock enabled. * at that time records whether the AP has IPA power enabled.
* *
* Finally, if the AP kernel panics, we update the SMP2P state bits even if * Finally, if the AP kernel panics, we update the SMP2P state bits even if
* we never receive an interrupt from the modem requesting this. * we never receive an interrupt from the modem requesting this.
...@@ -45,14 +45,14 @@ ...@@ -45,14 +45,14 @@
* struct ipa_smp2p - IPA SMP2P information * struct ipa_smp2p - IPA SMP2P information
* @ipa: IPA pointer * @ipa: IPA pointer
* @valid_state: SMEM state indicating enabled state is valid * @valid_state: SMEM state indicating enabled state is valid
* @enabled_state: SMEM state to indicate clock is enabled * @enabled_state: SMEM state to indicate power is enabled
* @valid_bit: Valid bit in 32-bit SMEM state mask * @valid_bit: Valid bit in 32-bit SMEM state mask
* @enabled_bit: Enabled bit in 32-bit SMEM state mask * @enabled_bit: Enabled bit in 32-bit SMEM state mask
* @enabled_bit: Enabled bit in 32-bit SMEM state mask * @enabled_bit: Enabled bit in 32-bit SMEM state mask
* @clock_query_irq: IPA interrupt triggered by modem for clock query * @clock_query_irq: IPA interrupt triggered by modem for power query
* @setup_ready_irq: IPA interrupt triggered by modem to signal GSI ready * @setup_ready_irq: IPA interrupt triggered by modem to signal GSI ready
* @clock_on: Whether IPA clock is on * @power_on: Whether IPA power is on
* @notified: Whether modem has been notified of clock state * @notified: Whether modem has been notified of power state
* @disabled: Whether setup ready interrupt handling is disabled * @disabled: Whether setup ready interrupt handling is disabled
* @mutex: Mutex protecting ready-interrupt/shutdown interlock * @mutex: Mutex protecting ready-interrupt/shutdown interlock
* @panic_notifier: Panic notifier structure * @panic_notifier: Panic notifier structure
...@@ -65,7 +65,7 @@ struct ipa_smp2p { ...@@ -65,7 +65,7 @@ struct ipa_smp2p {
u32 enabled_bit; u32 enabled_bit;
u32 clock_query_irq; u32 clock_query_irq;
u32 setup_ready_irq; u32 setup_ready_irq;
bool clock_on; bool power_on;
bool notified; bool notified;
bool disabled; bool disabled;
struct mutex mutex; struct mutex mutex;
...@@ -73,13 +73,13 @@ struct ipa_smp2p { ...@@ -73,13 +73,13 @@ struct ipa_smp2p {
}; };
/** /**
* ipa_smp2p_notify() - use SMP2P to tell modem about IPA clock state * ipa_smp2p_notify() - use SMP2P to tell modem about IPA power state
* @smp2p: SMP2P information * @smp2p: SMP2P information
* *
* This is called either when the modem has requested it (by triggering * This is called either when the modem has requested it (by triggering
* the modem clock query IPA interrupt) or whenever the AP is shutting down * the modem power query IPA interrupt) or whenever the AP is shutting down
* (via a panic notifier). It sets the two SMP2P state bits--one saying * (via a panic notifier). It sets the two SMP2P state bits--one saying
* whether the IPA clock is running, and the other indicating the first bit * whether the IPA power is on, and the other indicating the first bit
* is valid. * is valid.
*/ */
static void ipa_smp2p_notify(struct ipa_smp2p *smp2p) static void ipa_smp2p_notify(struct ipa_smp2p *smp2p)
...@@ -92,11 +92,11 @@ static void ipa_smp2p_notify(struct ipa_smp2p *smp2p) ...@@ -92,11 +92,11 @@ static void ipa_smp2p_notify(struct ipa_smp2p *smp2p)
return; return;
dev = &smp2p->ipa->pdev->dev; dev = &smp2p->ipa->pdev->dev;
smp2p->clock_on = pm_runtime_get_if_active(dev, true) > 0; smp2p->power_on = pm_runtime_get_if_active(dev, true) > 0;
/* Signal whether the clock is enabled */ /* Signal whether the IPA power is enabled */
mask = BIT(smp2p->enabled_bit); mask = BIT(smp2p->enabled_bit);
value = smp2p->clock_on ? mask : 0; value = smp2p->power_on ? mask : 0;
qcom_smem_state_update_bits(smp2p->enabled_state, mask, value); qcom_smem_state_update_bits(smp2p->enabled_state, mask, value);
/* Now indicate that the enabled flag is valid */ /* Now indicate that the enabled flag is valid */
...@@ -126,7 +126,7 @@ static int ipa_smp2p_panic_notifier(struct notifier_block *nb, ...@@ -126,7 +126,7 @@ static int ipa_smp2p_panic_notifier(struct notifier_block *nb,
ipa_smp2p_notify(smp2p); ipa_smp2p_notify(smp2p);
if (smp2p->clock_on) if (smp2p->power_on)
ipa_uc_panic_notifier(smp2p->ipa); ipa_uc_panic_notifier(smp2p->ipa);
return NOTIFY_DONE; return NOTIFY_DONE;
...@@ -209,17 +209,17 @@ static void ipa_smp2p_irq_exit(struct ipa_smp2p *smp2p, u32 irq) ...@@ -209,17 +209,17 @@ static void ipa_smp2p_irq_exit(struct ipa_smp2p *smp2p, u32 irq)
free_irq(irq, smp2p); free_irq(irq, smp2p);
} }
/* Drop the clock reference if it was taken in ipa_smp2p_notify() */ /* Drop the power reference if it was taken in ipa_smp2p_notify() */
static void ipa_smp2p_clock_release(struct ipa *ipa) static void ipa_smp2p_power_release(struct ipa *ipa)
{ {
struct device *dev = &ipa->pdev->dev; struct device *dev = &ipa->pdev->dev;
if (!ipa->smp2p->clock_on) if (!ipa->smp2p->power_on)
return; return;
pm_runtime_mark_last_busy(dev); pm_runtime_mark_last_busy(dev);
(void)pm_runtime_put_autosuspend(dev); (void)pm_runtime_put_autosuspend(dev);
ipa->smp2p->clock_on = false; ipa->smp2p->power_on = false;
} }
/* Initialize the IPA SMP2P subsystem */ /* Initialize the IPA SMP2P subsystem */
...@@ -253,7 +253,7 @@ int ipa_smp2p_init(struct ipa *ipa, bool modem_init) ...@@ -253,7 +253,7 @@ int ipa_smp2p_init(struct ipa *ipa, bool modem_init)
smp2p->ipa = ipa; smp2p->ipa = ipa;
/* These fields are needed by the clock query interrupt /* These fields are needed by the power query interrupt
* handler, so initialize them now. * handler, so initialize them now.
*/ */
mutex_init(&smp2p->mutex); mutex_init(&smp2p->mutex);
...@@ -306,8 +306,8 @@ void ipa_smp2p_exit(struct ipa *ipa) ...@@ -306,8 +306,8 @@ void ipa_smp2p_exit(struct ipa *ipa)
ipa_smp2p_irq_exit(smp2p, smp2p->setup_ready_irq); ipa_smp2p_irq_exit(smp2p, smp2p->setup_ready_irq);
ipa_smp2p_panic_notifier_unregister(smp2p); ipa_smp2p_panic_notifier_unregister(smp2p);
ipa_smp2p_irq_exit(smp2p, smp2p->clock_query_irq); ipa_smp2p_irq_exit(smp2p, smp2p->clock_query_irq);
/* We won't get notified any more; drop clock reference (if any) */ /* We won't get notified any more; drop power reference (if any) */
ipa_smp2p_clock_release(ipa); ipa_smp2p_power_release(ipa);
ipa->smp2p = NULL; ipa->smp2p = NULL;
mutex_destroy(&smp2p->mutex); mutex_destroy(&smp2p->mutex);
kfree(smp2p); kfree(smp2p);
...@@ -336,13 +336,13 @@ void ipa_smp2p_notify_reset(struct ipa *ipa) ...@@ -336,13 +336,13 @@ void ipa_smp2p_notify_reset(struct ipa *ipa)
if (!smp2p->notified) if (!smp2p->notified)
return; return;
ipa_smp2p_clock_release(ipa); ipa_smp2p_power_release(ipa);
/* Reset the clock enabled valid flag */ /* Reset the power enabled valid flag */
mask = BIT(smp2p->valid_bit); mask = BIT(smp2p->valid_bit);
qcom_smem_state_update_bits(smp2p->valid_state, mask, 0); qcom_smem_state_update_bits(smp2p->valid_state, mask, 0);
/* Mark the clock disabled for good measure... */ /* Mark the power disabled for good measure... */
mask = BIT(smp2p->enabled_bit); mask = BIT(smp2p->enabled_bit);
qcom_smem_state_update_bits(smp2p->enabled_state, mask, 0); qcom_smem_state_update_bits(smp2p->enabled_state, mask, 0);
......
...@@ -39,7 +39,7 @@ void ipa_smp2p_disable(struct ipa *ipa); ...@@ -39,7 +39,7 @@ void ipa_smp2p_disable(struct ipa *ipa);
* ipa_smp2p_notify_reset() - Reset modem notification state * ipa_smp2p_notify_reset() - Reset modem notification state
* @ipa: IPA pointer * @ipa: IPA pointer
* *
* If the modem crashes it queries the IPA clock state. In cleaning * If the modem crashes it queries the IPA power state. In cleaning
* up after such a crash this is used to reset some state maintained * up after such a crash this is used to reset some state maintained
* for managing this notification. * for managing this notification.
*/ */
......
...@@ -147,16 +147,16 @@ static void ipa_uc_response_hdlr(struct ipa *ipa, enum ipa_irq_id irq_id) ...@@ -147,16 +147,16 @@ static void ipa_uc_response_hdlr(struct ipa *ipa, enum ipa_irq_id irq_id)
* should only receive responses from the microcontroller when it has * should only receive responses from the microcontroller when it has
* sent it a request message. * sent it a request message.
* *
* We can drop the clock reference taken in ipa_uc_clock() once we * We can drop the power reference taken in ipa_uc_power() once we
* know the microcontroller has finished its initialization. * know the microcontroller has finished its initialization.
*/ */
switch (shared->response) { switch (shared->response) {
case IPA_UC_RESPONSE_INIT_COMPLETED: case IPA_UC_RESPONSE_INIT_COMPLETED:
if (ipa->uc_clocked) { if (ipa->uc_powered) {
ipa->uc_loaded = true; ipa->uc_loaded = true;
pm_runtime_mark_last_busy(dev); pm_runtime_mark_last_busy(dev);
(void)pm_runtime_put_autosuspend(dev); (void)pm_runtime_put_autosuspend(dev);
ipa->uc_clocked = false; ipa->uc_powered = false;
} else { } else {
dev_warn(dev, "unexpected init_completed response\n"); dev_warn(dev, "unexpected init_completed response\n");
} }
...@@ -171,7 +171,7 @@ static void ipa_uc_response_hdlr(struct ipa *ipa, enum ipa_irq_id irq_id) ...@@ -171,7 +171,7 @@ static void ipa_uc_response_hdlr(struct ipa *ipa, enum ipa_irq_id irq_id)
/* Configure the IPA microcontroller subsystem */ /* Configure the IPA microcontroller subsystem */
void ipa_uc_config(struct ipa *ipa) void ipa_uc_config(struct ipa *ipa)
{ {
ipa->uc_clocked = false; ipa->uc_powered = false;
ipa->uc_loaded = false; ipa->uc_loaded = false;
ipa_interrupt_add(ipa->interrupt, IPA_IRQ_UC_0, ipa_uc_event_handler); ipa_interrupt_add(ipa->interrupt, IPA_IRQ_UC_0, ipa_uc_event_handler);
ipa_interrupt_add(ipa->interrupt, IPA_IRQ_UC_1, ipa_uc_response_hdlr); ipa_interrupt_add(ipa->interrupt, IPA_IRQ_UC_1, ipa_uc_response_hdlr);
...@@ -184,15 +184,15 @@ void ipa_uc_deconfig(struct ipa *ipa) ...@@ -184,15 +184,15 @@ void ipa_uc_deconfig(struct ipa *ipa)
ipa_interrupt_remove(ipa->interrupt, IPA_IRQ_UC_1); ipa_interrupt_remove(ipa->interrupt, IPA_IRQ_UC_1);
ipa_interrupt_remove(ipa->interrupt, IPA_IRQ_UC_0); ipa_interrupt_remove(ipa->interrupt, IPA_IRQ_UC_0);
if (!ipa->uc_clocked) if (!ipa->uc_powered)
return; return;
pm_runtime_mark_last_busy(dev); pm_runtime_mark_last_busy(dev);
(void)pm_runtime_put_autosuspend(dev); (void)pm_runtime_put_autosuspend(dev);
} }
/* Take a proxy clock reference for the microcontroller */ /* Take a proxy power reference for the microcontroller */
void ipa_uc_clock(struct ipa *ipa) void ipa_uc_power(struct ipa *ipa)
{ {
static bool already; static bool already;
struct device *dev; struct device *dev;
...@@ -209,7 +209,7 @@ void ipa_uc_clock(struct ipa *ipa) ...@@ -209,7 +209,7 @@ void ipa_uc_clock(struct ipa *ipa)
pm_runtime_put_noidle(dev); pm_runtime_put_noidle(dev);
dev_err(dev, "error %d getting proxy power\n", ret); dev_err(dev, "error %d getting proxy power\n", ret);
} else { } else {
ipa->uc_clocked = true; ipa->uc_powered = true;
} }
} }
......
...@@ -21,18 +21,18 @@ void ipa_uc_config(struct ipa *ipa); ...@@ -21,18 +21,18 @@ void ipa_uc_config(struct ipa *ipa);
void ipa_uc_deconfig(struct ipa *ipa); void ipa_uc_deconfig(struct ipa *ipa);
/** /**
* ipa_uc_clock() - Take a proxy clock reference for the microcontroller * ipa_uc_power() - Take a proxy power reference for the microcontroller
* @ipa: IPA pointer * @ipa: IPA pointer
* *
* The first time the modem boots, it loads firmware for and starts the * The first time the modem boots, it loads firmware for and starts the
* IPA-resident microcontroller. The microcontroller signals that it * IPA-resident microcontroller. The microcontroller signals that it
* has completed its initialization by sending an INIT_COMPLETED response * has completed its initialization by sending an INIT_COMPLETED response
* message to the AP. The AP must ensure the IPA core clock is operating * message to the AP. The AP must ensure the IPA is powered until
* until it receives this message, and to do so we take a "proxy" clock * it receives this message, and to do so we take a "proxy" clock
* reference on its behalf here. Once we receive the INIT_COMPLETED * reference on its behalf here. Once we receive the INIT_COMPLETED
* message (in ipa_uc_response_hdlr()) we drop this clock reference. * message (in ipa_uc_response_hdlr()) we drop this power reference.
*/ */
void ipa_uc_clock(struct ipa *ipa); void ipa_uc_power(struct ipa *ipa);
/** /**
* ipa_uc_panic_notifier() * ipa_uc_panic_notifier()
......
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