clk: tegra: Implement Tegra210 EMC clock

The EMC clock needs to carefully coordinate with the EMC controller
programming to make sure external memory can be properly clocked. Do so
by hooking up the EMC clock with an EMC provider that will specify which
rates are supported by the EMC and provide a callback to use for setting
the clock rate at the EMC.

Based on work by Peter De Schrijver <pdeschrijver@nvidia.com>.

Signed-off-by: Joseph Lo <josephl@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
This commit is contained in:
Joseph Lo
2019-05-29 16:21:35 +08:00
committed by Thierry Reding
parent a3cba697a2
commit 0ac65fc946
4 changed files with 397 additions and 0 deletions

View File

@@ -146,4 +146,28 @@ void tegra20_clk_set_emc_round_callback(tegra20_clk_emc_round_cb *round_cb,
void *cb_arg);
int tegra20_clk_prepare_emc_mc_same_freq(struct clk *emc_clk, bool same);
struct tegra210_clk_emc_config {
unsigned long rate;
bool same_freq;
u32 value;
unsigned long parent_rate;
u8 parent;
};
struct tegra210_clk_emc_provider {
struct module *owner;
struct device *dev;
struct tegra210_clk_emc_config *configs;
unsigned int num_configs;
int (*set_rate)(struct device *dev,
const struct tegra210_clk_emc_config *config);
};
int tegra210_clk_emc_attach(struct clk *clk,
struct tegra210_clk_emc_provider *provider);
void tegra210_clk_emc_detach(struct clk *clk);
#endif /* __LINUX_CLK_TEGRA_H_ */