clk: sunxi: Give sunxi_factors_register a registers parameter
Before this commit sunxi_factors_register uses of_iomap(node, 0) to get the clk registers. The sun6i prcm has factor clocks, for which we want to use sunxi_factors_register, but of_iomap(node, 0) does not work for the prcm factor clocks, because the prcm uses the mfd framework, so the registers are not part of the dt-node, instead they are added to the platform_device, as platform_device resources. This commit makes getting the registers the callers duty, so that sunxi_factors_register can be used with mfd instantiated platform device too. While at it also add error checking to the of_iomap calls. This commit also drops the __init function from sunxi_factors_register since platform driver probe functions are not __init. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
このコミットが含まれているのは:
@@ -79,7 +79,17 @@ static DEFINE_SPINLOCK(sun4i_a10_mod0_lock);
|
||||
|
||||
static void __init sun4i_a10_mod0_setup(struct device_node *node)
|
||||
{
|
||||
sunxi_factors_register(node, &sun4i_a10_mod0_data, &sun4i_a10_mod0_lock);
|
||||
void __iomem *reg;
|
||||
|
||||
reg = of_iomap(node, 0);
|
||||
if (!reg) {
|
||||
pr_err("Could not get registers for mod0-clk: %s\n",
|
||||
node->name);
|
||||
return;
|
||||
}
|
||||
|
||||
sunxi_factors_register(node, &sun4i_a10_mod0_data,
|
||||
&sun4i_a10_mod0_lock, reg);
|
||||
}
|
||||
CLK_OF_DECLARE(sun4i_a10_mod0, "allwinner,sun4i-a10-mod0-clk", sun4i_a10_mod0_setup);
|
||||
|
||||
@@ -87,7 +97,17 @@ static DEFINE_SPINLOCK(sun5i_a13_mbus_lock);
|
||||
|
||||
static void __init sun5i_a13_mbus_setup(struct device_node *node)
|
||||
{
|
||||
struct clk *mbus = sunxi_factors_register(node, &sun4i_a10_mod0_data, &sun5i_a13_mbus_lock);
|
||||
struct clk *mbus;
|
||||
void __iomem *reg;
|
||||
|
||||
reg = of_iomap(node, 0);
|
||||
if (!reg) {
|
||||
pr_err("Could not get registers for a13-mbus-clk\n");
|
||||
return;
|
||||
}
|
||||
|
||||
mbus = sunxi_factors_register(node, &sun4i_a10_mod0_data,
|
||||
&sun5i_a13_mbus_lock, reg);
|
||||
|
||||
/* The MBUS clocks needs to be always enabled */
|
||||
__clk_get(mbus);
|
||||
|
新しいイシューから参照
ユーザーをブロックする