f873b70d0f917b819d30c2a2ba519ba6d8730cbd
[openwrt/staging/rmilecki.git] /
1 From 36b8af12f424e7a7f60a935c60a0fd4aa0822378 Mon Sep 17 00:00:00 2001
2 From: Ansuel Smith <ansuelsmth@gmail.com>
3 Date: Mon, 22 Nov 2021 16:23:43 +0100
4 Subject: net: dsa: qca8k: move regmap init in probe and set it mandatory
5
6 In preparation for regmap conversion, move regmap init in the probe
7 function and make it mandatory as any read/write/rmw operation will be
8 converted to regmap API.
9
10 Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
11 Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
12 Signed-off-by: David S. Miller <davem@davemloft.net>
13 ---
14 drivers/net/dsa/qca8k.c | 14 ++++++++------
15 1 file changed, 8 insertions(+), 6 deletions(-)
16
17 --- a/drivers/net/dsa/qca8k.c
18 +++ b/drivers/net/dsa/qca8k.c
19 @@ -1086,12 +1086,6 @@ qca8k_setup(struct dsa_switch *ds)
20 if (ret)
21 return ret;
22
23 - /* Start by setting up the register mapping */
24 - priv->regmap = devm_regmap_init(ds->dev, NULL, priv,
25 - &qca8k_regmap_config);
26 - if (IS_ERR(priv->regmap))
27 - dev_warn(priv->dev, "regmap initialization failed");
28 -
29 ret = qca8k_setup_mdio_bus(priv);
30 if (ret)
31 return ret;
32 @@ -2077,6 +2071,14 @@ qca8k_sw_probe(struct mdio_device *mdiod
33 gpiod_set_value_cansleep(priv->reset_gpio, 0);
34 }
35
36 + /* Start by setting up the register mapping */
37 + priv->regmap = devm_regmap_init(&mdiodev->dev, NULL, priv,
38 + &qca8k_regmap_config);
39 + if (IS_ERR(priv->regmap)) {
40 + dev_err(priv->dev, "regmap initialization failed");
41 + return PTR_ERR(priv->regmap);
42 + }
43 +
44 /* Check the detected switch id */
45 ret = qca8k_read_switch_id(priv);
46 if (ret)