Skip to content

Commit a250cd4

Browse files
glneobebarino
authored andcommitted
clk: keystone: syscon-clk: Do not use syscon helper to build regmap
The syscon helper device_node_to_regmap() is used to fetch a regmap registered to a device node. It also currently creates this regmap if the node did not already have a regmap associated with it. This should only be used on "syscon" nodes. This driver is not such a device and instead uses device_node_to_regmap() on its own node as a hacky way to create a regmap for itself. This will not work going forward and so we should create our regmap the normal way by defining our regmap_config, fetching our memory resource, then using the normal regmap_init_mmio() function. Signed-off-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20250123181913.597304-1-afd@ti.com Tested-by: Nishanth Menon <nm@ti.com> [sboyd@kernel.org: Drop dev_err_probe() because the mapping function already does it] Signed-off-by: Stephen Boyd <sboyd@kernel.org>
1 parent 2014c95 commit a250cd4

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

drivers/clk/keystone/syscon-clk.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,12 @@ static struct clk_hw
105105
return &priv->hw;
106106
}
107107

108+
static const struct regmap_config ti_syscon_regmap_cfg = {
109+
.reg_bits = 32,
110+
.val_bits = 32,
111+
.reg_stride = 4,
112+
};
113+
108114
static int ti_syscon_gate_clk_probe(struct platform_device *pdev)
109115
{
110116
const struct ti_syscon_gate_clk_data *data, *p;
@@ -113,12 +119,17 @@ static int ti_syscon_gate_clk_probe(struct platform_device *pdev)
113119
int num_clks, num_parents, i;
114120
const char *parent_name;
115121
struct regmap *regmap;
122+
void __iomem *base;
116123

117124
data = device_get_match_data(dev);
118125
if (!data)
119126
return -EINVAL;
120127

121-
regmap = device_node_to_regmap(dev->of_node);
128+
base = devm_platform_ioremap_resource(pdev, 0);
129+
if (IS_ERR(base))
130+
return PTR_ERR(base);
131+
132+
regmap = regmap_init_mmio(dev, base, &ti_syscon_regmap_cfg);
122133
if (IS_ERR(regmap))
123134
return dev_err_probe(dev, PTR_ERR(regmap),
124135
"failed to get regmap\n");

0 commit comments

Comments
 (0)