Commit 91d02f95 authored by Alex Elder's avatar Alex Elder Committed by Jakub Kicinski

net: ipa: use config data for clocking

Stop assuming a fixed IPA core clock rate and interconnect
bandwidths.  Use the configuration data defined for these
things instead.  Get rid of the previously-used constants.
Signed-off-by: default avatarAlex Elder <elder@linaro.org>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent f08c9922
...@@ -30,18 +30,6 @@ ...@@ -30,18 +30,6 @@
* An IPA clock reference must be held for any access to IPA hardware. * An IPA clock reference must be held for any access to IPA hardware.
*/ */
#define IPA_CORE_CLOCK_RATE (75UL * 1000 * 1000) /* Hz */
/* Interconnect path bandwidths (each times 1000 bytes per second) */
#define IPA_MEMORY_AVG (80 * 1000) /* 80 MBps */
#define IPA_MEMORY_PEAK (600 * 1000)
#define IPA_IMEM_AVG (80 * 1000)
#define IPA_IMEM_PEAK (350 * 1000)
#define IPA_CONFIG_AVG (40 * 1000)
#define IPA_CONFIG_PEAK (40 * 1000)
/** /**
* struct ipa_clock - IPA clocking information * struct ipa_clock - IPA clocking information
* @count: Clocking reference count * @count: Clocking reference count
...@@ -116,18 +104,25 @@ static void ipa_interconnect_exit(struct ipa_clock *clock) ...@@ -116,18 +104,25 @@ static void ipa_interconnect_exit(struct ipa_clock *clock)
/* Currently we only use one bandwidth level, so just "enable" interconnects */ /* Currently we only use one bandwidth level, so just "enable" interconnects */
static int ipa_interconnect_enable(struct ipa *ipa) static int ipa_interconnect_enable(struct ipa *ipa)
{ {
const struct ipa_interconnect_data *data;
struct ipa_clock *clock = ipa->clock; struct ipa_clock *clock = ipa->clock;
int ret; int ret;
ret = icc_set_bw(clock->memory_path, IPA_MEMORY_AVG, IPA_MEMORY_PEAK); data = &clock->interconnect_data[IPA_INTERCONNECT_MEMORY];
ret = icc_set_bw(clock->memory_path, data->average_rate,
data->peak_rate);
if (ret) if (ret)
return ret; return ret;
ret = icc_set_bw(clock->imem_path, IPA_IMEM_AVG, IPA_IMEM_PEAK); data = &clock->interconnect_data[IPA_INTERCONNECT_IMEM];
ret = icc_set_bw(clock->memory_path, data->average_rate,
data->peak_rate);
if (ret) if (ret)
goto err_memory_path_disable; goto err_memory_path_disable;
ret = icc_set_bw(clock->config_path, IPA_CONFIG_AVG, IPA_CONFIG_PEAK); data = &clock->interconnect_data[IPA_INTERCONNECT_CONFIG];
ret = icc_set_bw(clock->memory_path, data->average_rate,
data->peak_rate);
if (ret) if (ret)
goto err_imem_path_disable; goto err_imem_path_disable;
...@@ -144,6 +139,7 @@ static int ipa_interconnect_enable(struct ipa *ipa) ...@@ -144,6 +139,7 @@ static int ipa_interconnect_enable(struct ipa *ipa)
/* To disable an interconnect, we just its bandwidth to 0 */ /* To disable an interconnect, we just its bandwidth to 0 */
static int ipa_interconnect_disable(struct ipa *ipa) static int ipa_interconnect_disable(struct ipa *ipa)
{ {
const struct ipa_interconnect_data *data;
struct ipa_clock *clock = ipa->clock; struct ipa_clock *clock = ipa->clock;
int ret; int ret;
...@@ -162,9 +158,13 @@ static int ipa_interconnect_disable(struct ipa *ipa) ...@@ -162,9 +158,13 @@ static int ipa_interconnect_disable(struct ipa *ipa)
return 0; return 0;
err_imem_path_reenable: err_imem_path_reenable:
(void)icc_set_bw(clock->imem_path, IPA_IMEM_AVG, IPA_IMEM_PEAK); data = &clock->interconnect_data[IPA_INTERCONNECT_IMEM];
(void)icc_set_bw(clock->imem_path, data->average_rate,
data->peak_rate);
err_memory_path_reenable: err_memory_path_reenable:
(void)icc_set_bw(clock->memory_path, IPA_MEMORY_AVG, IPA_MEMORY_PEAK); data = &clock->interconnect_data[IPA_INTERCONNECT_MEMORY];
(void)icc_set_bw(clock->memory_path, data->average_rate,
data->peak_rate);
return ret; return ret;
} }
...@@ -273,10 +273,10 @@ ipa_clock_init(struct device *dev, const struct ipa_clock_data *data) ...@@ -273,10 +273,10 @@ ipa_clock_init(struct device *dev, const struct ipa_clock_data *data)
return ERR_CAST(clk); return ERR_CAST(clk);
} }
ret = clk_set_rate(clk, IPA_CORE_CLOCK_RATE); ret = clk_set_rate(clk, data->core_clock_rate);
if (ret) { if (ret) {
dev_err(dev, "error %d setting core clock rate to %lu\n", dev_err(dev, "error %d setting core clock rate to %u\n",
ret, IPA_CORE_CLOCK_RATE); ret, data->core_clock_rate);
goto err_clk_put; goto err_clk_put;
} }
......
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