Commit 0a6d7f82 authored by Stephen Boyd's avatar Stephen Boyd
Browse files

Merge branch 'clk-cleanup' into clk-next

* clk-cleanup:
  clk: si521xx: Increase stack based print buffer size in probe
  clk: Use device_get_match_data()
  clk: cdce925: Extend match support for OF tables
  clk: si570: Simplify probe
  clk: si5351: Simplify probe
  clk: rs9: Use i2c_get_match_data() instead of device_get_match_data()
  clk: clk-si544: Simplify probe() and is_valid_frequency()
  clk: si521xx: Use i2c_get_match_data() instead of device_get_match_data()
  clk: npcm7xx: Fix incorrect kfree
  clk: at91: remove unnecessary conditions
  clk: ti: fix double free in of_ti_divider_clk_setup()
  clk: keystone: pll: fix a couple NULL vs IS_ERR() checks
  clk: ralink: mtmips: quiet unused variable warning
  clk: gate: fix comment typo and grammar
  clk: asm9620: Remove 'hw' local variable that isn't checked
parents 720e4a4a 7e52b116
Loading
Loading
Loading
Loading
+5 −7
Original line number Diff line number Diff line
@@ -161,13 +161,11 @@ at91_clk_register_utmi_internal(struct regmap *regmap_pmc,

	init.name = name;
	init.ops = ops;
	if (parent_hw) {
		init.parent_hws = parent_hw ? (const struct clk_hw **)&parent_hw : NULL;
		init.num_parents = parent_hw ? 1 : 0;
	} else {
		init.parent_names = parent_name ? &parent_name : NULL;
		init.num_parents = parent_name ? 1 : 0;
	}
	if (parent_hw)
		init.parent_hws = (const struct clk_hw **)&parent_hw;
	else
		init.parent_names = &parent_name;
	init.num_parents = 1;
	init.flags = flags;

	utmi->hw.init = &init;
+3 −3
Original line number Diff line number Diff line
@@ -255,7 +255,7 @@ static struct asm9260_mux_clock asm9260_mux_clks[] __initdata = {

static void __init asm9260_acc_init(struct device_node *np)
{
	struct clk_hw *hw, *pll_hw;
	struct clk_hw *pll_hw;
	struct clk_hw **hws;
	const char *pll_clk = "pll";
	struct clk_parent_data pll_parent_data = { .index = 0 };
@@ -283,7 +283,7 @@ static void __init asm9260_acc_init(struct device_node *np)
	for (n = 0; n < ARRAY_SIZE(asm9260_mux_clks); n++) {
		const struct asm9260_mux_clock *mc = &asm9260_mux_clks[n];

		hw = clk_hw_register_mux_table_parent_data(NULL, mc->name, mc->parent_data,
		clk_hw_register_mux_table_parent_data(NULL, mc->name, mc->parent_data,
				mc->num_parents, mc->flags, base + mc->offset,
				0, mc->mask, 0, mc->table, &asm9260_clk_lock);
	}
@@ -292,7 +292,7 @@ static void __init asm9260_acc_init(struct device_node *np)
	for (n = 0; n < ARRAY_SIZE(asm9260_mux_gates); n++) {
		const struct asm9260_gate_data *gd = &asm9260_mux_gates[n];

		hw = clk_hw_register_gate(NULL, gd->name,
		clk_hw_register_gate(NULL, gd->name,
			gd->parent_name, gd->flags | CLK_SET_RATE_PARENT,
			base + gd->reg, gd->bit_idx, 0, &asm9260_clk_lock);
	}
+35 −30
Original line number Diff line number Diff line
@@ -25,25 +25,11 @@
 * Model this as 2 PLL clocks which are parents to the outputs.
 */

enum {
	CDCE913,
	CDCE925,
	CDCE937,
	CDCE949,
};

struct clk_cdce925_chip_info {
	int num_plls;
	int num_outputs;
};

static const struct clk_cdce925_chip_info clk_cdce925_chip_info_tbl[] = {
	[CDCE913] = { .num_plls = 1, .num_outputs = 3 },
	[CDCE925] = { .num_plls = 2, .num_outputs = 5 },
	[CDCE937] = { .num_plls = 3, .num_outputs = 7 },
	[CDCE949] = { .num_plls = 4, .num_outputs = 9 },
};

#define MAX_NUMBER_OF_PLLS	4
#define MAX_NUMBER_OF_OUTPUTS	9

@@ -621,20 +607,10 @@ static struct regmap_bus regmap_cdce925_bus = {
	.read = cdce925_regmap_i2c_read,
};

static const struct i2c_device_id cdce925_id[] = {
	{ "cdce913", CDCE913 },
	{ "cdce925", CDCE925 },
	{ "cdce937", CDCE937 },
	{ "cdce949", CDCE949 },
	{ }
};
MODULE_DEVICE_TABLE(i2c, cdce925_id);

static int cdce925_probe(struct i2c_client *client)
{
	struct clk_cdce925_chip *data;
	struct device_node *node = client->dev.of_node;
	const struct i2c_device_id *id = i2c_match_id(cdce925_id, client);
	const char *parent_name;
	const char *pll_clk_name[MAX_NUMBER_OF_PLLS] = {NULL,};
	struct clk_init_data init;
@@ -665,7 +641,7 @@ static int cdce925_probe(struct i2c_client *client)
		return -ENOMEM;

	data->i2c_client = client;
	data->chip_info = &clk_cdce925_chip_info_tbl[id->driver_data];
	data->chip_info = i2c_get_match_data(client);
	config.max_register = CDCE925_OFFSET_PLL +
		data->chip_info->num_plls * 0x10 - 1;
	data->regmap = devm_regmap_init(&client->dev, &regmap_cdce925_bus,
@@ -822,12 +798,41 @@ static int cdce925_probe(struct i2c_client *client)
	return err;
}

static const struct clk_cdce925_chip_info clk_cdce913_info = {
	.num_plls = 1,
	.num_outputs = 3,
};

static const struct clk_cdce925_chip_info clk_cdce925_info = {
	.num_plls = 2,
	.num_outputs = 5,
};

static const struct clk_cdce925_chip_info clk_cdce937_info = {
	.num_plls = 3,
	.num_outputs = 7,
};

static const struct clk_cdce925_chip_info clk_cdce949_info = {
	.num_plls = 4,
	.num_outputs = 9,
};

static const struct i2c_device_id cdce925_id[] = {
	{ "cdce913", (kernel_ulong_t)&clk_cdce913_info },
	{ "cdce925", (kernel_ulong_t)&clk_cdce925_info },
	{ "cdce937", (kernel_ulong_t)&clk_cdce937_info },
	{ "cdce949", (kernel_ulong_t)&clk_cdce949_info },
	{ }
};
MODULE_DEVICE_TABLE(i2c, cdce925_id);

static const struct of_device_id clk_cdce925_of_match[] = {
	{ .compatible = "ti,cdce913" },
	{ .compatible = "ti,cdce925" },
	{ .compatible = "ti,cdce937" },
	{ .compatible = "ti,cdce949" },
	{ },
	{ .compatible = "ti,cdce913", .data = &clk_cdce913_info },
	{ .compatible = "ti,cdce925", .data = &clk_cdce925_info },
	{ .compatible = "ti,cdce937", .data = &clk_cdce937_info },
	{ .compatible = "ti,cdce949", .data = &clk_cdce949_info },
	{ }
};
MODULE_DEVICE_TABLE(of, clk_cdce925_of_match);

+1 −1
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@
#include <linux/string.h>

/**
 * DOC: basic gatable clock which can gate and ungate it's ouput
 * DOC: basic gatable clock which can gate and ungate its output
 *
 * Traits of this clock:
 * prepare - clk_(un)prepare only ensures parent is (un)prepared
+2 −7
Original line number Diff line number Diff line
@@ -12,8 +12,8 @@
#include <linux/device.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/regmap.h>

#include <linux/mfd/lochnagar1_regs.h>
@@ -242,22 +242,17 @@ static int lochnagar_clk_probe(struct platform_device *pdev)
	};
	struct device *dev = &pdev->dev;
	struct lochnagar_clk_priv *priv;
	const struct of_device_id *of_id;
	struct lochnagar_clk *lclk;
	struct lochnagar_config *conf;
	int ret, i;

	of_id = of_match_device(lochnagar_of_match, dev);
	if (!of_id)
		return -EINVAL;

	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
	if (!priv)
		return -ENOMEM;

	priv->dev = dev;
	priv->regmap = dev_get_regmap(dev->parent, NULL);
	conf = (struct lochnagar_config *)of_id->data;
	conf = (struct lochnagar_config *)device_get_match_data(dev);

	memcpy(priv->lclks, conf->clks, sizeof(priv->lclks));

Loading