Commit ef1ae470 authored by Stephen Boyd's avatar Stephen Boyd
Browse files

Merge branches 'clk-imx7d', 'clk-hisi-stub', 'clk-mvebu', 'clk-imx6-epit' and...

Merge branches 'clk-imx7d', 'clk-hisi-stub', 'clk-mvebu', 'clk-imx6-epit' and 'clk-debugfs-simple' into clk-next

* clk-imx7d:
  clk: imx7d: reset parent for mipi csi root
  clk: imx7d: fix mipi dphy div parent

* clk-hisi-stub:
  clk/driver/hisi: Consolidate the Kconfig for the CLOCK_STUB

* clk-mvebu:
  clk: mvebu: use correct bit for 98DX3236 NAND

* clk-imx6-epit:
  clk: imx6: add EPIT clock support

* clk-debugfs-simple:
  clk: Return void from debug_init op
  clk: remove clk_debugfs_add_file()
  clk: tegra: no need to check return value of debugfs_create functions
  clk: davinci: no need to check return value of debugfs_create functions
  clk: bcm2835: no need to check return value of debugfs_create functions
  clk: no need to check return value of debugfs_create functions
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -96,7 +96,7 @@ the operations defined in clk-provider.h::
		int		(*get_phase)(struct clk_hw *hw);
		int		(*set_phase)(struct clk_hw *hw, int degrees);
		void		(*init)(struct clk_hw *hw);
		int		(*debug_init)(struct clk_hw *hw,
		void		(*debug_init)(struct clk_hw *hw,
					      struct dentry *dentry);
	};

+12 −17
Original line number Diff line number Diff line
@@ -394,25 +394,21 @@ out:
	return count * 1000;
}

static int bcm2835_debugfs_regset(struct bcm2835_cprman *cprman, u32 base,
static void bcm2835_debugfs_regset(struct bcm2835_cprman *cprman, u32 base,
				  struct debugfs_reg32 *regs, size_t nregs,
				  struct dentry *dentry)
{
	struct dentry *regdump;
	struct debugfs_regset32 *regset;

	regset = devm_kzalloc(cprman->dev, sizeof(*regset), GFP_KERNEL);
	if (!regset)
		return -ENOMEM;
		return;

	regset->regs = regs;
	regset->nregs = nregs;
	regset->base = cprman->regs + base;

	regdump = debugfs_create_regset32("regdump", S_IRUGO, dentry,
					  regset);

	return regdump ? 0 : -ENOMEM;
	debugfs_create_regset32("regdump", S_IRUGO, dentry, regset);
}

struct bcm2835_pll_data {
@@ -730,7 +726,7 @@ static int bcm2835_pll_set_rate(struct clk_hw *hw,
	return 0;
}

static int bcm2835_pll_debug_init(struct clk_hw *hw,
static void bcm2835_pll_debug_init(struct clk_hw *hw,
				  struct dentry *dentry)
{
	struct bcm2835_pll *pll = container_of(hw, struct bcm2835_pll, hw);
@@ -740,7 +736,7 @@ static int bcm2835_pll_debug_init(struct clk_hw *hw,

	regs = devm_kzalloc(cprman->dev, 7 * sizeof(*regs), GFP_KERNEL);
	if (!regs)
		return -ENOMEM;
		return;

	regs[0].name = "cm_ctrl";
	regs[0].offset = data->cm_ctrl_reg;
@@ -757,7 +753,7 @@ static int bcm2835_pll_debug_init(struct clk_hw *hw,
	regs[6].name = "ana3";
	regs[6].offset = data->ana_reg_base + 3 * 4;

	return bcm2835_debugfs_regset(cprman, 0, regs, 7, dentry);
	bcm2835_debugfs_regset(cprman, 0, regs, 7, dentry);
}

static const struct clk_ops bcm2835_pll_clk_ops = {
@@ -861,7 +857,7 @@ static int bcm2835_pll_divider_set_rate(struct clk_hw *hw,
	return 0;
}

static int bcm2835_pll_divider_debug_init(struct clk_hw *hw,
static void bcm2835_pll_divider_debug_init(struct clk_hw *hw,
					   struct dentry *dentry)
{
	struct bcm2835_pll_divider *divider = bcm2835_pll_divider_from_hw(hw);
@@ -871,14 +867,14 @@ static int bcm2835_pll_divider_debug_init(struct clk_hw *hw,

	regs = devm_kzalloc(cprman->dev, 7 * sizeof(*regs), GFP_KERNEL);
	if (!regs)
		return -ENOMEM;
		return;

	regs[0].name = "cm";
	regs[0].offset = data->cm_reg;
	regs[1].name = "a2w";
	regs[1].offset = data->a2w_reg;

	return bcm2835_debugfs_regset(cprman, 0, regs, 2, dentry);
	bcm2835_debugfs_regset(cprman, 0, regs, 2, dentry);
}

static const struct clk_ops bcm2835_pll_divider_clk_ops = {
@@ -1254,15 +1250,14 @@ static struct debugfs_reg32 bcm2835_debugfs_clock_reg32[] = {
	},
};

static int bcm2835_clock_debug_init(struct clk_hw *hw,
static void bcm2835_clock_debug_init(struct clk_hw *hw,
				    struct dentry *dentry)
{
	struct bcm2835_clock *clock = bcm2835_clock_from_hw(hw);
	struct bcm2835_cprman *cprman = clock->cprman;
	const struct bcm2835_clock_data *data = clock->data;

	return bcm2835_debugfs_regset(
		cprman, data->ctl_reg,
	bcm2835_debugfs_regset(cprman, data->ctl_reg,
		bcm2835_debugfs_clock_reg32,
		ARRAY_SIZE(bcm2835_debugfs_clock_reg32),
		dentry);
+30 −112
Original line number Diff line number Diff line
@@ -2613,81 +2613,31 @@ static int possible_parents_show(struct seq_file *s, void *data)
}
DEFINE_SHOW_ATTRIBUTE(possible_parents);

static int clk_debug_create_one(struct clk_core *core, struct dentry *pdentry)
static void clk_debug_create_one(struct clk_core *core, struct dentry *pdentry)
{
	struct dentry *d;
	int ret = -ENOMEM;

	if (!core || !pdentry) {
		ret = -EINVAL;
		goto out;
	}

	d = debugfs_create_dir(core->name, pdentry);
	if (!d)
		goto out;

	core->dentry = d;

	d = debugfs_create_ulong("clk_rate", 0444, core->dentry, &core->rate);
	if (!d)
		goto err_out;

	d = debugfs_create_ulong("clk_accuracy", 0444, core->dentry,
				 &core->accuracy);
	if (!d)
		goto err_out;

	d = debugfs_create_u32("clk_phase", 0444, core->dentry, &core->phase);
	if (!d)
		goto err_out;

	d = debugfs_create_file("clk_flags", 0444, core->dentry, core,
				&clk_flags_fops);
	if (!d)
		goto err_out;
	struct dentry *root;

	d = debugfs_create_u32("clk_prepare_count", 0444, core->dentry,
			       &core->prepare_count);
	if (!d)
		goto err_out;

	d = debugfs_create_u32("clk_enable_count", 0444, core->dentry,
			       &core->enable_count);
	if (!d)
		goto err_out;

	d = debugfs_create_u32("clk_protect_count", 0444, core->dentry,
			       &core->protect_count);
	if (!d)
		goto err_out;
	if (!core || !pdentry)
		return;

	d = debugfs_create_u32("clk_notifier_count", 0444, core->dentry,
			       &core->notifier_count);
	if (!d)
		goto err_out;
	root = debugfs_create_dir(core->name, pdentry);
	core->dentry = root;

	if (core->num_parents > 1) {
		d = debugfs_create_file("clk_possible_parents", 0444,
				core->dentry, core, &possible_parents_fops);
		if (!d)
			goto err_out;
	}
	debugfs_create_ulong("clk_rate", 0444, root, &core->rate);
	debugfs_create_ulong("clk_accuracy", 0444, root, &core->accuracy);
	debugfs_create_u32("clk_phase", 0444, root, &core->phase);
	debugfs_create_file("clk_flags", 0444, root, core, &clk_flags_fops);
	debugfs_create_u32("clk_prepare_count", 0444, root, &core->prepare_count);
	debugfs_create_u32("clk_enable_count", 0444, root, &core->enable_count);
	debugfs_create_u32("clk_protect_count", 0444, root, &core->protect_count);
	debugfs_create_u32("clk_notifier_count", 0444, root, &core->notifier_count);

	if (core->ops->debug_init) {
		ret = core->ops->debug_init(core->hw, core->dentry);
		if (ret)
			goto err_out;
	}
	if (core->num_parents > 1)
		debugfs_create_file("clk_possible_parents", 0444, root, core,
				    &possible_parents_fops);

	ret = 0;
	goto out;

err_out:
	debugfs_remove_recursive(core->dentry);
	core->dentry = NULL;
out:
	return ret;
	if (core->ops->debug_init)
		core->ops->debug_init(core->hw, core->dentry);
}

/**
@@ -2698,17 +2648,13 @@ out:
 * initialized.  Otherwise it bails out early since the debugfs clk directory
 * will be created lazily by clk_debug_init as part of a late_initcall.
 */
static int clk_debug_register(struct clk_core *core)
static void clk_debug_register(struct clk_core *core)
{
	int ret = 0;

	mutex_lock(&clk_debug_lock);
	hlist_add_head(&core->debug_node, &clk_debug_list);
	if (inited)
		ret = clk_debug_create_one(core, rootdir);
		clk_debug_create_one(core, rootdir);
	mutex_unlock(&clk_debug_lock);

	return ret;
}

 /**
@@ -2728,19 +2674,6 @@ static void clk_debug_unregister(struct clk_core *core)
	mutex_unlock(&clk_debug_lock);
}

struct dentry *clk_debugfs_add_file(struct clk_hw *hw, char *name, umode_t mode,
				void *data, const struct file_operations *fops)
{
	struct dentry *d = NULL;

	if (hw->core->dentry)
		d = debugfs_create_file(name, mode, hw->core->dentry, data,
					fops);

	return d;
}
EXPORT_SYMBOL_GPL(clk_debugfs_add_file);

/**
 * clk_debug_init - lazily populate the debugfs clk directory
 *
@@ -2753,32 +2686,17 @@ EXPORT_SYMBOL_GPL(clk_debugfs_add_file);
static int __init clk_debug_init(void)
{
	struct clk_core *core;
	struct dentry *d;

	rootdir = debugfs_create_dir("clk", NULL);

	if (!rootdir)
		return -ENOMEM;

	d = debugfs_create_file("clk_summary", 0444, rootdir, &all_lists,
	debugfs_create_file("clk_summary", 0444, rootdir, &all_lists,
			    &clk_summary_fops);
	if (!d)
		return -ENOMEM;

	d = debugfs_create_file("clk_dump", 0444, rootdir, &all_lists,
	debugfs_create_file("clk_dump", 0444, rootdir, &all_lists,
			    &clk_dump_fops);
	debugfs_create_file("clk_orphan_summary", 0444, rootdir, &orphan_list,
			    &clk_summary_fops);
	debugfs_create_file("clk_orphan_dump", 0444, rootdir, &orphan_list,
			    &clk_dump_fops);
	if (!d)
		return -ENOMEM;

	d = debugfs_create_file("clk_orphan_summary", 0444, rootdir,
				&orphan_list, &clk_summary_fops);
	if (!d)
		return -ENOMEM;

	d = debugfs_create_file("clk_orphan_dump", 0444, rootdir,
				&orphan_list, &clk_dump_fops);
	if (!d)
		return -ENOMEM;

	mutex_lock(&clk_debug_lock);
	hlist_for_each_entry(core, &clk_debug_list, debug_node)
@@ -2791,7 +2709,7 @@ static int __init clk_debug_init(void)
}
late_initcall(clk_debug_init);
#else
static inline int clk_debug_register(struct clk_core *core) { return 0; }
static inline void clk_debug_register(struct clk_core *core) { }
static inline void clk_debug_reparent(struct clk_core *core,
				      struct clk_core *new_parent)
{
+4 −11
Original line number Diff line number Diff line
@@ -190,7 +190,7 @@ static int davinci_pll_set_rate(struct clk_hw *hw, unsigned long rate,
}

#ifdef CONFIG_DEBUG_FS
static int davinci_pll_debug_init(struct clk_hw *hw, struct dentry *dentry);
static void davinci_pll_debug_init(struct clk_hw *hw, struct dentry *dentry);
#else
#define davinci_pll_debug_init NULL
#endif
@@ -874,26 +874,19 @@ static const struct debugfs_reg32 davinci_pll_regs[] = {
	DEBUG_REG(PLLDIV9),
};

static int davinci_pll_debug_init(struct clk_hw *hw, struct dentry *dentry)
static void davinci_pll_debug_init(struct clk_hw *hw, struct dentry *dentry)
{
	struct davinci_pll_clk *pll = to_davinci_pll_clk(hw);
	struct debugfs_regset32 *regset;
	struct dentry *d;

	regset = kzalloc(sizeof(*regset), GFP_KERNEL);
	if (!regset)
		return -ENOMEM;
		return;

	regset->regs = davinci_pll_regs;
	regset->nregs = ARRAY_SIZE(davinci_pll_regs);
	regset->base = pll->base;

	d = debugfs_create_regset32("registers", 0400, dentry, regset);
	if (IS_ERR(d)) {
		kfree(regset);
		return PTR_ERR(d);
	}

	return 0;
	debugfs_create_regset32("registers", 0400, dentry, regset);
}
#endif
+8 −5
Original line number Diff line number Diff line
@@ -44,14 +44,17 @@ config RESET_HISI
	  Build reset controller driver for HiSilicon device chipsets.

config STUB_CLK_HI6220
	bool "Hi6220 Stub Clock Driver"
	depends on COMMON_CLK_HI6220 && MAILBOX
	default ARCH_HISI
	bool "Hi6220 Stub Clock Driver" if EXPERT
	depends on (COMMON_CLK_HI6220 || COMPILE_TEST)
	depends on MAILBOX
	default COMMON_CLK_HI6220
	help
	  Build the Hisilicon Hi6220 stub clock driver.

config STUB_CLK_HI3660
	bool "Hi3660 Stub Clock Driver"
	depends on COMMON_CLK_HI3660 && MAILBOX
	bool "Hi3660 Stub Clock Driver" if EXPERT
	depends on (COMMON_CLK_HI3660 || COMPILE_TEST)
	depends on MAILBOX
	default COMMON_CLK_HI3660
	help
	  Build the Hisilicon Hi3660 stub clock driver.
Loading