Skip to content

Commit 40d7394

Browse files
glneojfvogel
authored andcommitted
soc: ti: k3-socinfo: Do not use syscon helper to build regmap
[ Upstream commit a5caf03188e44388e8c618dcbe5fffad1a249385 ] 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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Nishanth Menon <[email protected]> Signed-off-by: Sasha Levin <[email protected]> (cherry picked from commit 06100e642f4b83ec758744e5f992d7a2039ec98f) Signed-off-by: Jack Vogel <[email protected]>
1 parent 2d555b8 commit 40d7394

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

drivers/soc/ti/k3-socinfo.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,20 +105,31 @@ k3_chipinfo_variant_to_sr(unsigned int partno, unsigned int variant,
105105
return -ENODEV;
106106
}
107107

108+
static const struct regmap_config k3_chipinfo_regmap_cfg = {
109+
.reg_bits = 32,
110+
.val_bits = 32,
111+
.reg_stride = 4,
112+
};
113+
108114
static int k3_chipinfo_probe(struct platform_device *pdev)
109115
{
110116
struct device_node *node = pdev->dev.of_node;
111117
struct soc_device_attribute *soc_dev_attr;
112118
struct device *dev = &pdev->dev;
113119
struct soc_device *soc_dev;
114120
struct regmap *regmap;
121+
void __iomem *base;
115122
u32 partno_id;
116123
u32 variant;
117124
u32 jtag_id;
118125
u32 mfg;
119126
int ret;
120127

121-
regmap = device_node_to_regmap(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, &k3_chipinfo_regmap_cfg);
122133
if (IS_ERR(regmap))
123134
return PTR_ERR(regmap);
124135

0 commit comments

Comments
 (0)