diff mbox series

[net-next,03/10] net: mscc: ocelot: get HSIO regmap from syscon

Message ID fc4e6c0effa84417bddb32b4a53c6021f0b9e546.1532954208.git-series.quentin.schulz@bootlin.com
State Changes Requested, archived
Delegated to: David Miller
Headers show
Series mscc: ocelot: add support for SerDes muxing configuration | expand

Commit Message

Quentin Schulz July 30, 2018, 12:43 p.m. UTC
HSIO address space was moved to a syscon, hence we need to get the
regmap of this address space from there and no more from the device
node.

Signed-off-by: Quentin Schulz <quentin.schulz@bootlin.com>
---
 drivers/net/ethernet/mscc/ocelot_board.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

Comments

Alexandre Belloni July 31, 2018, 7:53 a.m. UTC | #1
On 30/07/2018 14:43:48+0200, Quentin Schulz wrote:
> HSIO address space was moved to a syscon, hence we need to get the
> regmap of this address space from there and no more from the device
> node.
> 
> Signed-off-by: Quentin Schulz <quentin.schulz@bootlin.com>
Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com>

> ---
>  drivers/net/ethernet/mscc/ocelot_board.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/mscc/ocelot_board.c b/drivers/net/ethernet/mscc/ocelot_board.c
> index 26bb3b1..b7d755b 100644
> --- a/drivers/net/ethernet/mscc/ocelot_board.c
> +++ b/drivers/net/ethernet/mscc/ocelot_board.c
> @@ -9,6 +9,7 @@
>  #include <linux/netdevice.h>
>  #include <linux/of_mdio.h>
>  #include <linux/of_platform.h>
> +#include <linux/mfd/syscon.h>
>  #include <linux/skbuff.h>
>  
>  #include "ocelot.h"
> @@ -162,6 +163,7 @@ static int mscc_ocelot_probe(struct platform_device *pdev)
>  	struct device_node *np = pdev->dev.of_node;
>  	struct device_node *ports, *portnp;
>  	struct ocelot *ocelot;
> +	struct regmap *hsio;
>  	u32 val;
>  
>  	struct {
> @@ -173,7 +175,6 @@ static int mscc_ocelot_probe(struct platform_device *pdev)
>  		{ QSYS, "qsys" },
>  		{ ANA, "ana" },
>  		{ QS, "qs" },
> -		{ HSIO, "hsio" },
>  	};
>  
>  	if (!np && !pdev->dev.platform_data)
> @@ -196,6 +197,14 @@ static int mscc_ocelot_probe(struct platform_device *pdev)
>  		ocelot->targets[res[i].id] = target;
>  	}
>  
> +	hsio = syscon_regmap_lookup_by_compatible("mscc,ocelot-hsio");
> +	if (IS_ERR(hsio)) {
> +		dev_err(&pdev->dev, "missing hsio syscon\n");
> +		return PTR_ERR(hsio);
> +	}
> +
> +	ocelot->targets[HSIO] = hsio;
> +
>  	err = ocelot_chip_init(ocelot);
>  	if (err)
>  		return err;
> -- 
> git-series 0.9.1
diff mbox series

Patch

diff --git a/drivers/net/ethernet/mscc/ocelot_board.c b/drivers/net/ethernet/mscc/ocelot_board.c
index 26bb3b1..b7d755b 100644
--- a/drivers/net/ethernet/mscc/ocelot_board.c
+++ b/drivers/net/ethernet/mscc/ocelot_board.c
@@ -9,6 +9,7 @@ 
 #include <linux/netdevice.h>
 #include <linux/of_mdio.h>
 #include <linux/of_platform.h>
+#include <linux/mfd/syscon.h>
 #include <linux/skbuff.h>
 
 #include "ocelot.h"
@@ -162,6 +163,7 @@  static int mscc_ocelot_probe(struct platform_device *pdev)
 	struct device_node *np = pdev->dev.of_node;
 	struct device_node *ports, *portnp;
 	struct ocelot *ocelot;
+	struct regmap *hsio;
 	u32 val;
 
 	struct {
@@ -173,7 +175,6 @@  static int mscc_ocelot_probe(struct platform_device *pdev)
 		{ QSYS, "qsys" },
 		{ ANA, "ana" },
 		{ QS, "qs" },
-		{ HSIO, "hsio" },
 	};
 
 	if (!np && !pdev->dev.platform_data)
@@ -196,6 +197,14 @@  static int mscc_ocelot_probe(struct platform_device *pdev)
 		ocelot->targets[res[i].id] = target;
 	}
 
+	hsio = syscon_regmap_lookup_by_compatible("mscc,ocelot-hsio");
+	if (IS_ERR(hsio)) {
+		dev_err(&pdev->dev, "missing hsio syscon\n");
+		return PTR_ERR(hsio);
+	}
+
+	ocelot->targets[HSIO] = hsio;
+
 	err = ocelot_chip_init(ocelot);
 	if (err)
 		return err;