Commit 7956a031 authored by Michael Turquette's avatar Michael Turquette

Merge tag 'omap-for-v4.16/clk-omap3-legacy-signed' of...

Merge tag 'omap-for-v4.16/clk-omap3-legacy-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap into clk-omap

Drop unused omap3 clock data

We have been booting omap3 in device tree only mode for a while now,
so this is all unused now.
parents 4fbd8d19 7558562a
...@@ -19,10 +19,6 @@ obj-$(CONFIG_SOC_DRA7XX) += $(clk-common) clk-7xx.o \ ...@@ -19,10 +19,6 @@ obj-$(CONFIG_SOC_DRA7XX) += $(clk-common) clk-7xx.o \
clk-dra7-atl.o dpll3xxx.o dpll44xx.o clk-dra7-atl.o dpll3xxx.o dpll44xx.o
obj-$(CONFIG_SOC_AM43XX) += $(clk-common) dpll3xxx.o clk-43xx.o obj-$(CONFIG_SOC_AM43XX) += $(clk-common) dpll3xxx.o clk-43xx.o
ifdef CONFIG_ATAGS
obj-$(CONFIG_ARCH_OMAP3) += clk-3xxx-legacy.o
endif
endif # CONFIG_ARCH_OMAP2PLUS endif # CONFIG_ARCH_OMAP2PLUS
obj-$(CONFIG_COMMON_CLK_TI_ADPLL) += adpll.o obj-$(CONFIG_COMMON_CLK_TI_ADPLL) += adpll.o
...@@ -133,9 +133,10 @@ static const struct clk_ops apll_ck_ops = { ...@@ -133,9 +133,10 @@ static const struct clk_ops apll_ck_ops = {
.get_parent = &dra7_init_apll_parent, .get_parent = &dra7_init_apll_parent,
}; };
static void __init omap_clk_register_apll(struct clk_hw *hw, static void __init omap_clk_register_apll(void *user,
struct device_node *node) struct device_node *node)
{ {
struct clk_hw *hw = user;
struct clk_hw_omap *clk_hw = to_clk_hw_omap(hw); struct clk_hw_omap *clk_hw = to_clk_hw_omap(hw);
struct dpll_data *ad = clk_hw->dpll_data; struct dpll_data *ad = clk_hw->dpll_data;
struct clk *clk; struct clk *clk;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -108,25 +108,77 @@ void __init ti_dt_clocks_register(struct ti_dt_clk oclks[]) ...@@ -108,25 +108,77 @@ void __init ti_dt_clocks_register(struct ti_dt_clk oclks[])
struct device_node *node; struct device_node *node;
struct clk *clk; struct clk *clk;
struct of_phandle_args clkspec; struct of_phandle_args clkspec;
char buf[64];
char *ptr;
char *tags[2];
int i;
int num_args;
int ret;
static bool clkctrl_nodes_missing;
static bool has_clkctrl_data;
for (c = oclks; c->node_name != NULL; c++) { for (c = oclks; c->node_name != NULL; c++) {
node = of_find_node_by_name(NULL, c->node_name); strcpy(buf, c->node_name);
ptr = buf;
for (i = 0; i < 2; i++)
tags[i] = NULL;
num_args = 0;
while (*ptr) {
if (*ptr == ':') {
if (num_args >= 2) {
pr_warn("Bad number of tags on %s\n",
c->node_name);
return;
}
tags[num_args++] = ptr + 1;
*ptr = 0;
}
ptr++;
}
if (num_args && clkctrl_nodes_missing)
continue;
node = of_find_node_by_name(NULL, buf);
if (num_args)
node = of_find_node_by_name(node, "clk");
clkspec.np = node; clkspec.np = node;
clkspec.args_count = num_args;
for (i = 0; i < num_args; i++) {
ret = kstrtoint(tags[i], i ? 10 : 16, clkspec.args + i);
if (ret) {
pr_warn("Bad tag in %s at %d: %s\n",
c->node_name, i, tags[i]);
return;
}
}
clk = of_clk_get_from_provider(&clkspec); clk = of_clk_get_from_provider(&clkspec);
if (!IS_ERR(clk)) { if (!IS_ERR(clk)) {
c->lk.clk = clk; c->lk.clk = clk;
clkdev_add(&c->lk); clkdev_add(&c->lk);
} else { } else {
pr_warn("failed to lookup clock node %s\n", if (num_args && !has_clkctrl_data) {
c->node_name); if (of_find_compatible_node(NULL, NULL,
"ti,clkctrl")) {
has_clkctrl_data = true;
} else {
clkctrl_nodes_missing = true;
pr_warn("missing clkctrl nodes, please update your dts.\n");
continue;
}
}
pr_warn("failed to lookup clock node %s, ret=%ld\n",
c->node_name, PTR_ERR(clk));
} }
} }
} }
struct clk_init_item { struct clk_init_item {
struct device_node *node; struct device_node *node;
struct clk_hw *hw; void *user;
ti_of_clk_init_cb_t func; ti_of_clk_init_cb_t func;
struct list_head link; struct list_head link;
}; };
...@@ -136,14 +188,14 @@ static LIST_HEAD(retry_list); ...@@ -136,14 +188,14 @@ static LIST_HEAD(retry_list);
/** /**
* ti_clk_retry_init - retries a failed clock init at later phase * ti_clk_retry_init - retries a failed clock init at later phase
* @node: device not for the clock * @node: device not for the clock
* @hw: partially initialized clk_hw struct for the clock * @user: user data pointer
* @func: init function to be called for the clock * @func: init function to be called for the clock
* *
* Adds a failed clock init to the retry list. The retry list is parsed * Adds a failed clock init to the retry list. The retry list is parsed
* once all the other clocks have been initialized. * once all the other clocks have been initialized.
*/ */
int __init ti_clk_retry_init(struct device_node *node, struct clk_hw *hw, int __init ti_clk_retry_init(struct device_node *node, void *user,
ti_of_clk_init_cb_t func) ti_of_clk_init_cb_t func)
{ {
struct clk_init_item *retry; struct clk_init_item *retry;
...@@ -154,7 +206,7 @@ int __init ti_clk_retry_init(struct device_node *node, struct clk_hw *hw, ...@@ -154,7 +206,7 @@ int __init ti_clk_retry_init(struct device_node *node, struct clk_hw *hw,
retry->node = node; retry->node = node;
retry->func = func; retry->func = func;
retry->hw = hw; retry->user = user;
list_add(&retry->link, &retry_list); list_add(&retry->link, &retry_list);
return 0; return 0;
...@@ -276,7 +328,7 @@ void ti_dt_clk_init_retry_clks(void) ...@@ -276,7 +328,7 @@ void ti_dt_clk_init_retry_clks(void)
while (!list_empty(&retry_list) && retries) { while (!list_empty(&retry_list) && retries) {
list_for_each_entry_safe(retry, tmp, &retry_list, link) { list_for_each_entry_safe(retry, tmp, &retry_list, link) {
pr_debug("retry-init: %s\n", retry->node->name); pr_debug("retry-init: %s\n", retry->node->name);
retry->func(retry->hw, retry->node); retry->func(retry->user, retry->node);
list_del(&retry->link); list_del(&retry->link);
kfree(retry); kfree(retry);
} }
...@@ -284,141 +336,6 @@ void ti_dt_clk_init_retry_clks(void) ...@@ -284,141 +336,6 @@ void ti_dt_clk_init_retry_clks(void)
} }
} }
#if defined(CONFIG_ARCH_OMAP3) && defined(CONFIG_ATAGS)
void __init ti_clk_patch_legacy_clks(struct ti_clk **patch)
{
while (*patch) {
memcpy((*patch)->patch, *patch, sizeof(**patch));
patch++;
}
}
struct clk __init *ti_clk_register_clk(struct ti_clk *setup)
{
struct clk *clk;
struct ti_clk_fixed *fixed;
struct ti_clk_fixed_factor *fixed_factor;
struct clk_hw *clk_hw;
int ret;
if (setup->clk)
return setup->clk;
switch (setup->type) {
case TI_CLK_FIXED:
fixed = setup->data;
clk = clk_register_fixed_rate(NULL, setup->name, NULL, 0,
fixed->frequency);
if (!IS_ERR(clk)) {
ret = ti_clk_add_alias(NULL, clk, setup->name);
if (ret) {
clk_unregister(clk);
clk = ERR_PTR(ret);
}
}
break;
case TI_CLK_MUX:
clk = ti_clk_register_mux(setup);
break;
case TI_CLK_DIVIDER:
clk = ti_clk_register_divider(setup);
break;
case TI_CLK_COMPOSITE:
clk = ti_clk_register_composite(setup);
break;
case TI_CLK_FIXED_FACTOR:
fixed_factor = setup->data;
clk = clk_register_fixed_factor(NULL, setup->name,
fixed_factor->parent,
0, fixed_factor->mult,
fixed_factor->div);
if (!IS_ERR(clk)) {
ret = ti_clk_add_alias(NULL, clk, setup->name);
if (ret) {
clk_unregister(clk);
clk = ERR_PTR(ret);
}
}
break;
case TI_CLK_GATE:
clk = ti_clk_register_gate(setup);
break;
case TI_CLK_DPLL:
clk = ti_clk_register_dpll(setup);
break;
default:
pr_err("bad type for %s!\n", setup->name);
clk = ERR_PTR(-EINVAL);
}
if (!IS_ERR(clk)) {
setup->clk = clk;
if (setup->clkdm_name) {
clk_hw = __clk_get_hw(clk);
if (clk_hw_get_flags(clk_hw) & CLK_IS_BASIC) {
pr_warn("can't setup clkdm for basic clk %s\n",
setup->name);
} else {
to_clk_hw_omap(clk_hw)->clkdm_name =
setup->clkdm_name;
omap2_init_clk_clkdm(clk_hw);
}
}
}
return clk;
}
int __init ti_clk_register_legacy_clks(struct ti_clk_alias *clks)
{
struct clk *clk;
bool retry;
struct ti_clk_alias *retry_clk;
struct ti_clk_alias *tmp;
while (clks->clk) {
clk = ti_clk_register_clk(clks->clk);
if (IS_ERR(clk)) {
if (PTR_ERR(clk) == -EAGAIN) {
list_add(&clks->link, &retry_list);
} else {
pr_err("register for %s failed: %ld\n",
clks->clk->name, PTR_ERR(clk));
return PTR_ERR(clk);
}
}
clks++;
}
retry = true;
while (!list_empty(&retry_list) && retry) {
retry = false;
list_for_each_entry_safe(retry_clk, tmp, &retry_list, link) {
pr_debug("retry-init: %s\n", retry_clk->clk->name);
clk = ti_clk_register_clk(retry_clk->clk);
if (IS_ERR(clk)) {
if (PTR_ERR(clk) == -EAGAIN) {
continue;
} else {
pr_err("register for %s failed: %ld\n",
retry_clk->clk->name,
PTR_ERR(clk));
return PTR_ERR(clk);
}
} else {
retry = true;
list_del(&retry_clk->link);
}
}
}
return 0;
}
#endif
static const struct of_device_id simple_clk_match_table[] __initconst = { static const struct of_device_id simple_clk_match_table[] __initconst = {
{ .compatible = "fixed-clock" }, { .compatible = "fixed-clock" },
{ .compatible = "fixed-factor-clock" }, { .compatible = "fixed-factor-clock" },
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <linux/of_address.h> #include <linux/of_address.h>
#include <linux/clk/ti.h> #include <linux/clk/ti.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/timekeeping.h>
#include "clock.h" #include "clock.h"
#define NO_IDLEST 0x1 #define NO_IDLEST 0x1
...@@ -46,6 +47,7 @@ static bool _early_timeout = true; ...@@ -46,6 +47,7 @@ static bool _early_timeout = true;
struct omap_clkctrl_provider { struct omap_clkctrl_provider {
void __iomem *base; void __iomem *base;
struct list_head clocks; struct list_head clocks;
char *clkdm_name;
}; };
struct omap_clkctrl_clk { struct omap_clkctrl_clk {
...@@ -89,7 +91,18 @@ static bool _omap4_is_ready(u32 val) ...@@ -89,7 +91,18 @@ static bool _omap4_is_ready(u32 val)
static bool _omap4_is_timeout(union omap4_timeout *time, u32 timeout) static bool _omap4_is_timeout(union omap4_timeout *time, u32 timeout)
{ {
if (unlikely(_early_timeout)) { /*
* There are two special cases where ktime_to_ns() can't be
* used to track the timeouts. First one is during early boot
* when the timers haven't been initialized yet. The second
* one is during suspend-resume cycle while timekeeping is
* being suspended / resumed. Clocksource for the system
* can be from a timer that requires pm_runtime access, which
* will eventually bring us here with timekeeping_suspended,
* during both suspend entry and resume paths. This happens
* at least on am43xx platform.
*/
if (unlikely(_early_timeout || timekeeping_suspended)) {
if (time->cycles++ < timeout) { if (time->cycles++ < timeout) {
udelay(1); udelay(1);
return false; return false;
...@@ -208,6 +221,7 @@ static const struct clk_ops omap4_clkctrl_clk_ops = { ...@@ -208,6 +221,7 @@ static const struct clk_ops omap4_clkctrl_clk_ops = {
.enable = _omap4_clkctrl_clk_enable, .enable = _omap4_clkctrl_clk_enable,
.disable = _omap4_clkctrl_clk_disable, .disable = _omap4_clkctrl_clk_disable,
.is_enabled = _omap4_clkctrl_clk_is_enabled, .is_enabled = _omap4_clkctrl_clk_is_enabled,
.init = omap2_init_clk_clkdm,
}; };
static struct clk_hw *_ti_omap4_clkctrl_xlate(struct of_phandle_args *clkspec, static struct clk_hw *_ti_omap4_clkctrl_xlate(struct of_phandle_args *clkspec,
...@@ -351,8 +365,8 @@ _ti_clkctrl_setup_div(struct omap_clkctrl_provider *provider, ...@@ -351,8 +365,8 @@ _ti_clkctrl_setup_div(struct omap_clkctrl_provider *provider,
if (ti_clk_parse_divider_data((int *)div_data->dividers, if (ti_clk_parse_divider_data((int *)div_data->dividers,
div_data->max_div, 0, 0, div_data->max_div, 0, 0,
&div->width, &div->table)) { &div->width, &div->table)) {
pr_err("%s: Data parsing for %s:%04x:%d failed\n", __func__, pr_err("%s: Data parsing for %pOF:%04x:%d failed\n", __func__,
node->name, offset, data->bit); node, offset, data->bit);
kfree(div); kfree(div);
return; return;
} }
...@@ -428,7 +442,7 @@ static void __init _ti_omap4_clkctrl_setup(struct device_node *node) ...@@ -428,7 +442,7 @@ static void __init _ti_omap4_clkctrl_setup(struct device_node *node)
} }
if (!data->addr) { if (!data->addr) {
pr_err("%s not found from clkctrl data.\n", node->name); pr_err("%pOF not found from clkctrl data.\n", node);
return; return;
} }
...@@ -438,6 +452,21 @@ static void __init _ti_omap4_clkctrl_setup(struct device_node *node) ...@@ -438,6 +452,21 @@ static void __init _ti_omap4_clkctrl_setup(struct device_node *node)
provider->base = of_iomap(node, 0); provider->base = of_iomap(node, 0);
provider->clkdm_name = kmalloc(strlen(node->parent->name) + 3,
GFP_KERNEL);
if (!provider->clkdm_name) {
kfree(provider);
return;
}
/*
* Create default clkdm name, replace _cm from end of parent node
* name with _clkdm
*/
strcpy(provider->clkdm_name, node->parent->name);
provider->clkdm_name[strlen(provider->clkdm_name) - 2] = 0;
strcat(provider->clkdm_name, "clkdm");
INIT_LIST_HEAD(&provider->clocks); INIT_LIST_HEAD(&provider->clocks);
/* Generate clocks */ /* Generate clocks */
...@@ -460,6 +489,11 @@ static void __init _ti_omap4_clkctrl_setup(struct device_node *node) ...@@ -460,6 +489,11 @@ static void __init _ti_omap4_clkctrl_setup(struct device_node *node)
if (reg_data->flags & CLKF_NO_IDLEST) if (reg_data->flags & CLKF_NO_IDLEST)
hw->flags |= NO_IDLEST; hw->flags |= NO_IDLEST;
if (reg_data->clkdm_name)
hw->clkdm_name = reg_data->clkdm_name;
else
hw->clkdm_name = provider->clkdm_name;
init.parent_names = &reg_data->parent; init.parent_names = &reg_data->parent;
init.num_parents = 1; init.num_parents = 1;
init.flags = 0; init.flags = 0;
......
...@@ -92,17 +92,6 @@ struct ti_clk { ...@@ -92,17 +92,6 @@ struct ti_clk {
struct clk *clk; struct clk *clk;
}; };
struct ti_clk_alias {
struct ti_clk *clk;
struct clk_lookup lk;
struct list_head link;
};
struct ti_clk_fixed {
u32 frequency;
u16 flags;
};
struct ti_clk_mux { struct ti_clk_mux {
u8 bit_shift; u8 bit_shift;
int num_parents; int num_parents;
...@@ -123,13 +112,6 @@ struct ti_clk_divider { ...@@ -123,13 +112,6 @@ struct ti_clk_divider {
u16 flags; u16 flags;
}; };
struct ti_clk_fixed_factor {
const char *parent;
u16 div;
u16 mult;
u16 flags;
};
struct ti_clk_gate { struct ti_clk_gate {
const char *parent; const char *parent;
u8 bit_shift; u8 bit_shift;
...@@ -138,44 +120,6 @@ struct ti_clk_gate { ...@@ -138,44 +120,6 @@ struct ti_clk_gate {
u16 flags; u16 flags;
}; };
struct ti_clk_composite {
struct ti_clk_divider *divider;
struct ti_clk_mux *mux;
struct ti_clk_gate *gate;
u16 flags;
};
struct ti_clk_clkdm_gate {
const char *parent;
u16 flags;
};
struct ti_clk_dpll {
int num_parents;
u16 control_reg;
u16 idlest_reg;
u16 autoidle_reg;
u16 mult_div1_reg;
u8 module;
const char **parents;
u16 flags;
u8 modes;
u32 mult_mask;
u32 div1_mask;
u32 enable_mask;
u32 autoidle_mask;
u32 freqsel_mask;
u32 idlest_mask;
u32 dco_mask;
u32 sddiv_mask;
u16 max_multiplier;
u16 max_divider;
u8 min_divider;
u8 auto_recal_bit;
u8 recal_en_bit;
u8 recal_st_bit;
};
/* Composite clock component types */ /* Composite clock component types */
enum { enum {
CLK_COMPONENT_TYPE_GATE = 0, CLK_COMPONENT_TYPE_GATE = 0,
...@@ -221,6 +165,7 @@ struct omap_clkctrl_reg_data { ...@@ -221,6 +165,7 @@ struct omap_clkctrl_reg_data {
const struct omap_clkctrl_bit_data *bit_data; const struct omap_clkctrl_bit_data *bit_data;
u16 flags; u16 flags;
const char *parent; const char *parent;
const char *clkdm_name;
}; };
struct omap_clkctrl_data { struct omap_clkctrl_data {
...@@ -234,35 +179,23 @@ extern const struct omap_clkctrl_data omap4_clkctrl_data[]; ...@@ -234,35 +179,23 @@ extern const struct omap_clkctrl_data omap4_clkctrl_data[];
#define CLKF_HW_SUP BIT(1) #define CLKF_HW_SUP BIT(1)
#define CLKF_NO_IDLEST BIT(2) #define CLKF_NO_IDLEST BIT(2)
typedef void (*ti_of_clk_init_cb_t)(struct clk_hw *, struct device_node *); typedef void (*ti_of_clk_init_cb_t)(void *, struct device_node *);
struct clk *ti_clk_register_gate(struct ti_clk *setup);
struct clk *ti_clk_register_interface(struct ti_clk *setup);
struct clk *ti_clk_register_mux(struct ti_clk *setup);
struct clk *ti_clk_register_divider(struct ti_clk *setup);
struct clk *ti_clk_register_composite(struct ti_clk *setup);
struct clk *ti_clk_register_dpll(struct ti_clk *setup);
struct clk *ti_clk_register(struct device *dev, struct clk_hw *hw, struct clk *ti_clk_register(struct device *dev, struct clk_hw *hw,
const char *con); const char *con);
int ti_clk_add_alias(struct device *dev, struct clk *clk, const char *con); int ti_clk_add_alias(struct device *dev, struct clk *clk, const char *con);
void ti_clk_add_aliases(void); void ti_clk_add_aliases(void);
struct clk_hw *ti_clk_build_component_div(struct ti_clk_divider *setup);
struct clk_hw *ti_clk_build_component_gate(struct ti_clk_gate *setup);
struct clk_hw *ti_clk_build_component_mux(struct ti_clk_mux *setup); struct clk_hw *ti_clk_build_component_mux(struct ti_clk_mux *setup);
int ti_clk_parse_divider_data(int *div_table, int num_dividers, int max_div, int ti_clk_parse_divider_data(int *div_table, int num_dividers, int max_div,
u8 flags, u8 *width, u8 flags, u8 *width,
const struct clk_div_table **table); const struct clk_div_table **table);
void ti_clk_patch_legacy_clks(struct ti_clk **patch);
struct clk *ti_clk_register_clk(struct ti_clk *setup);
int ti_clk_register_legacy_clks(struct ti_clk_alias *clks);
int ti_clk_get_reg_addr(struct device_node *node, int index, int ti_clk_get_reg_addr(struct device_node *node, int index,
struct clk_omap_reg *reg); struct clk_omap_reg *reg);
void ti_dt_clocks_register(struct ti_dt_clk *oclks); void ti_dt_clocks_register(struct ti_dt_clk *oclks);
int ti_clk_retry_init(struct device_node *node, struct clk_hw *hw, int ti_clk_retry_init(struct device_node *node, void *user,
ti_of_clk_init_cb_t func); ti_of_clk_init_cb_t func);
int ti_clk_add_component(struct device_node *node, struct clk_hw *hw, int type); int ti_clk_add_component(struct device_node *node, struct clk_hw *hw, int type);
......
...@@ -116,54 +116,10 @@ static inline struct clk_hw *_get_hw(struct clk_hw_omap_comp *clk, int idx) ...@@ -116,54 +116,10 @@ static inline struct clk_hw *_get_hw(struct clk_hw_omap_comp *clk, int idx)
#define to_clk_hw_comp(_hw) container_of(_hw, struct clk_hw_omap_comp, hw) #define to_clk_hw_comp(_hw) container_of(_hw, struct clk_hw_omap_comp, hw)
#if defined(CONFIG_ARCH_OMAP3) && defined(CONFIG_ATAGS) static void __init _register_composite(void *user,
struct clk *ti_clk_register_composite(struct ti_clk *setup)
{
struct ti_clk_composite *comp;
struct clk_hw *gate;
struct clk_hw *mux;
struct clk_hw *div;
int num_parents = 1;
const char * const *parent_names = NULL;
struct clk *clk;
int ret;
comp = setup->data;
div = ti_clk_build_component_div(comp->divider);
gate = ti_clk_build_component_gate(comp->gate);
mux = ti_clk_build_component_mux(comp->mux);
if (div)
parent_names = &comp->divider->parent;
if (gate)
parent_names = &comp->gate->parent;
if (mux) {
num_parents = comp->mux->num_parents;
parent_names = comp->mux->parents;
}
clk = clk_register_composite(NULL, setup->name,
parent_names, num_parents, mux,
&ti_clk_mux_ops, div,
&ti_composite_divider_ops, gate,
&ti_composite_gate_ops, 0);
ret = ti_clk_add_alias(NULL, clk, setup->name);
if (ret) {
clk_unregister(clk);
return ERR_PTR(ret);
}
return clk;
}
#endif
static void __init _register_composite(struct clk_hw *hw,
struct device_node *node) struct device_node *node)
{ {
struct clk_hw *hw = user;
struct clk *clk; struct clk *clk;
struct clk_hw_omap_comp *cclk = to_clk_hw_comp(hw); struct clk_hw_omap_comp *cclk = to_clk_hw_comp(hw);
struct component_clk *comp; struct component_clk *comp;
......
...@@ -152,9 +152,10 @@ static const struct clk_ops dpll_x2_ck_ops = { ...@@ -152,9 +152,10 @@ static const struct clk_ops dpll_x2_ck_ops = {
* clk-bypass is missing), the clock is added to retry list and * clk-bypass is missing), the clock is added to retry list and
* the initialization is retried on later stage. * the initialization is retried on later stage.
*/ */
static void __init _register_dpll(struct clk_hw *hw, static void __init _register_dpll(void *user,
struct device_node *node) struct device_node *node)
{ {
struct clk_hw *hw = user;
struct clk_hw_omap *clk_hw = to_clk_hw_omap(hw); struct clk_hw_omap *clk_hw = to_clk_hw_omap(hw);
struct dpll_data *dd = clk_hw->dpll_data; struct dpll_data *dd = clk_hw->dpll_data;
struct clk *clk; struct clk *clk;
...@@ -202,96 +203,6 @@ static void __init _register_dpll(struct clk_hw *hw, ...@@ -202,96 +203,6 @@ static void __init _register_dpll(struct clk_hw *hw,
kfree(clk_hw); kfree(clk_hw);
} }
#if defined(CONFIG_ARCH_OMAP3) && defined(CONFIG_ATAGS)
void _get_reg(u8 module, u16 offset, struct clk_omap_reg *reg)
{
reg->index = module;
reg->offset = offset;
}
struct clk *ti_clk_register_dpll(struct ti_clk *setup)
{
struct clk_hw_omap *clk_hw;
struct clk_init_data init = { NULL };
struct dpll_data *dd;
struct clk *clk;
struct ti_clk_dpll *dpll;
const struct clk_ops *ops = &omap3_dpll_ck_ops;
struct clk *clk_ref;
struct clk *clk_bypass;
dpll = setup->data;
if (dpll->num_parents < 2)
return ERR_PTR(-EINVAL);
clk_ref = clk_get_sys(NULL, dpll->parents[0]);
clk_bypass = clk_get_sys(NULL, dpll->parents[1]);
if (IS_ERR_OR_NULL(clk_ref) || IS_ERR_OR_NULL(clk_bypass))
return ERR_PTR(-EAGAIN);
dd = kzalloc(sizeof(*dd), GFP_KERNEL);
clk_hw = kzalloc(sizeof(*clk_hw), GFP_KERNEL);
if (!dd || !clk_hw) {
clk = ERR_PTR(-ENOMEM);
goto cleanup;
}
clk_hw->dpll_data = dd;
clk_hw->ops = &clkhwops_omap3_dpll;
clk_hw->hw.init = &init;
init.name = setup->name;
init.ops = ops;
init.num_parents = dpll->num_parents;
init.parent_names = dpll->parents;
_get_reg(dpll->module, dpll->control_reg, &dd->control_reg);
_get_reg(dpll->module, dpll->idlest_reg, &dd->idlest_reg);
_get_reg(dpll->module, dpll->mult_div1_reg, &dd->mult_div1_reg);
_get_reg(dpll->module, dpll->autoidle_reg, &dd->autoidle_reg);
dd->modes = dpll->modes;
dd->div1_mask = dpll->div1_mask;
dd->idlest_mask = dpll->idlest_mask;
dd->mult_mask = dpll->mult_mask;
dd->autoidle_mask = dpll->autoidle_mask;
dd->enable_mask = dpll->enable_mask;
dd->sddiv_mask = dpll->sddiv_mask;
dd->dco_mask = dpll->dco_mask;
dd->max_divider = dpll->max_divider;
dd->min_divider = dpll->min_divider;
dd->max_multiplier = dpll->max_multiplier;
dd->auto_recal_bit = dpll->auto_recal_bit;
dd->recal_en_bit = dpll->recal_en_bit;
dd->recal_st_bit = dpll->recal_st_bit;
dd->clk_ref = __clk_get_hw(clk_ref);
dd->clk_bypass = __clk_get_hw(clk_bypass);
if (dpll->flags & CLKF_CORE)
ops = &omap3_dpll_core_ck_ops;
if (dpll->flags & CLKF_PER)
ops = &omap3_dpll_per_ck_ops;
if (dpll->flags & CLKF_J_TYPE)
dd->flags |= DPLL_J_TYPE;
clk = ti_clk_register(NULL, &clk_hw->hw, setup->name);
if (!IS_ERR(clk))
return clk;
cleanup:
kfree(dd);
kfree(clk_hw);
return clk;
}
#endif
#if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5) || \ #if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5) || \
defined(CONFIG_SOC_DRA7XX) || defined(CONFIG_SOC_AM33XX) || \ defined(CONFIG_SOC_DRA7XX) || defined(CONFIG_SOC_AM33XX) || \
defined(CONFIG_SOC_AM43XX) defined(CONFIG_SOC_AM43XX)
......
...@@ -128,53 +128,6 @@ static struct clk *_register_gate(struct device *dev, const char *name, ...@@ -128,53 +128,6 @@ static struct clk *_register_gate(struct device *dev, const char *name,
return clk; return clk;
} }
#if defined(CONFIG_ARCH_OMAP3) && defined(CONFIG_ATAGS)
struct clk *ti_clk_register_gate(struct ti_clk *setup)
{
const struct clk_ops *ops = &omap_gate_clk_ops;
const struct clk_hw_omap_ops *hw_ops = NULL;
struct clk_omap_reg reg;
u32 flags = 0;
u8 clk_gate_flags = 0;
struct ti_clk_gate *gate;
gate = setup->data;
if (gate->flags & CLKF_INTERFACE)
return ti_clk_register_interface(setup);
if (gate->flags & CLKF_SET_RATE_PARENT)
flags |= CLK_SET_RATE_PARENT;
if (gate->flags & CLKF_SET_BIT_TO_DISABLE)
clk_gate_flags |= INVERT_ENABLE;
if (gate->flags & CLKF_HSDIV) {
ops = &omap_gate_clk_hsdiv_restore_ops;
hw_ops = &clkhwops_wait;
}
if (gate->flags & CLKF_DSS)
hw_ops = &clkhwops_omap3430es2_dss_usbhost_wait;
if (gate->flags & CLKF_WAIT)
hw_ops = &clkhwops_wait;
if (gate->flags & CLKF_CLKDM)
ops = &omap_gate_clkdm_clk_ops;
if (gate->flags & CLKF_AM35XX)
hw_ops = &clkhwops_am35xx_ipss_module_wait;
reg.index = gate->module;
reg.offset = gate->reg;
reg.ptr = NULL;
return _register_gate(NULL, setup->name, gate->parent, flags,
&reg, gate->bit_shift,
clk_gate_flags, ops, hw_ops);
}
struct clk_hw *ti_clk_build_component_gate(struct ti_clk_gate *setup) struct clk_hw *ti_clk_build_component_gate(struct ti_clk_gate *setup)
{ {
struct clk_hw_omap *gate; struct clk_hw_omap *gate;
...@@ -204,7 +157,6 @@ struct clk_hw *ti_clk_build_component_gate(struct ti_clk_gate *setup) ...@@ -204,7 +157,6 @@ struct clk_hw *ti_clk_build_component_gate(struct ti_clk_gate *setup)
return &gate->hw; return &gate->hw;
} }
#endif
static void __init _of_ti_gate_clk_setup(struct device_node *node, static void __init _of_ti_gate_clk_setup(struct device_node *node,
const struct clk_ops *ops, const struct clk_ops *ops,
......
...@@ -67,38 +67,6 @@ static struct clk *_register_interface(struct device *dev, const char *name, ...@@ -67,38 +67,6 @@ static struct clk *_register_interface(struct device *dev, const char *name,
return clk; return clk;
} }
#if defined(CONFIG_ARCH_OMAP3) && defined(CONFIG_ATAGS)
struct clk *ti_clk_register_interface(struct ti_clk *setup)
{
const struct clk_hw_omap_ops *ops = &clkhwops_iclk_wait;
struct clk_omap_reg reg;
struct ti_clk_gate *gate;
gate = setup->data;
reg.index = gate->module;
reg.offset = gate->reg;
reg.ptr = NULL;
if (gate->flags & CLKF_NO_WAIT)
ops = &clkhwops_iclk;
if (gate->flags & CLKF_HSOTGUSB)
ops = &clkhwops_omap3430es2_iclk_hsotgusb_wait;
if (gate->flags & CLKF_DSS)
ops = &clkhwops_omap3430es2_iclk_dss_usbhost_wait;
if (gate->flags & CLKF_SSI)
ops = &clkhwops_omap3430es2_iclk_ssi_wait;
if (gate->flags & CLKF_AM35XX)
ops = &clkhwops_am35xx_ipss_wait;
return _register_interface(NULL, setup->name, gate->parent,
&reg, gate->bit_shift, ops);
}
#endif
static void __init _of_ti_interface_clk_setup(struct device_node *node, static void __init _of_ti_interface_clk_setup(struct device_node *node,
const struct clk_hw_omap_ops *ops) const struct clk_hw_omap_ops *ops)
{ {
......
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