net: designware: rockchip: improve support for multiple gmac instances
Subsystems (2)
PATCH 1/1 net: designware: rockchip: improve support for multiple gmac instances
Do not rely on (board-specific) aliases to distinguish between multiple (SoC-specific) GMAC instances. Instead, use the base address of the controllers as is done in the Linux kernel.
Signed-off-by Michael Riesch <[email protected]>
--- drivers/net/designware_rockchip.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)
drivers/net/designware_rockchip.c +16 -2
@@ -21,6 +21,7 @@ struct rk_gmac_ops {void (*set_rmii_speed)(struct eqos *eqos,int speed);void (*set_rgmii_speed)(struct eqos *eqos,int speed);void (*integrated_phy_powerup)(struct eqos *eqos); +u32 regs[]; };struct eqos_rk_gmac {
@@ -174,6 +175,11 @@ static const struct rk_gmac_ops rk3568_ops = { .set_to_rmii = rk3568_set_to_rmii, .set_rmii_speed = rk3568_set_gmac_speed, .set_rgmii_speed = rk3568_set_gmac_speed, + .regs = { +0xfe2a0000 ,/* gmac0 */ +0xfe010000 ,/* gmac1 */ + 0x0, /* sentinel */ + }, };static int rk_gmac_powerup (struct eqos *eqos)
@@ -228,7 +234,7 @@ static int eqos_init_rk_gmac(struct device_d *dev, struct eqos *eqos) {struct device_node *np = dev->device_node;struct eqos_rk_gmac *priv =to_rk_gmac (eqos); -int ret; +int i =0 , ret;const char *strings; priv->dev = dev;
@@ -247,7 +253,15 @@ static int eqos_init_rk_gmac(struct device_d *dev, struct eqos *eqos) priv->ops =device_get_match_data (dev); - priv->bus_id =of_alias_get_id (np,"ethernet" ); +if (dev->num_resources >0 ) { +while (priv->ops->regs[i]) { +if (priv->ops->regs[i] == dev->resource[0 ].start) { + priv->bus_id = i; +break ; + } + i++; + } + } priv->grf =syscon_regmap_lookup_by_phandle (np,"rockchip,grf" );if (IS_ERR (priv->grf)) {
Signature · 7 lines
2.30.2 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Sascha Hauer
AppliedQuoted 8 lines · Michael Riesch
Do not rely on (board-specific) aliases to distinguish between multiple (SoC-specific) GMAC instances. Instead, use the base address of the controllers as is done in the Linux kernel.
Signed-off-by Michael Riesch <[email protected]>--- drivers/net/designware_rockchip.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)
Applied, thanks
Sascha
Quoted 60 lines
drivers/net/designware_rockchip.c +16
-2@@ -21,6 +21,7 @@ struct rk_gmac_ops {void (*set_rmii_speed)(struct eqos *eqos,int speed);void (*set_rgmii_speed)(struct eqos *eqos,int speed);void (*integrated_phy_powerup)(struct eqos *eqos); +u32 regs[]; };struct eqos_rk_gmac {@@ -174,6 +175,11 @@ static const struct rk_gmac_ops rk3568_ops = { .set_to_rmii = rk3568_set_to_rmii, .set_rmii_speed = rk3568_set_gmac_speed, .set_rgmii_speed = rk3568_set_gmac_speed, + .regs = { +0xfe2a0000 ,/* gmac0 */ +0xfe010000 ,/* gmac1 */ + 0x0, /* sentinel */ + }, };static int rk_gmac_powerup (struct eqos *eqos)@@ -228,7 +234,7 @@ static int eqos_init_rk_gmac(struct device_d *dev, struct eqos *eqos) {struct device_node *np = dev->device_node;struct eqos_rk_gmac *priv =to_rk_gmac (eqos); -int ret; +int i =0 , ret;const char *strings; priv->dev = dev;@@ -247,7 +253,15 @@ static int eqos_init_rk_gmac(struct device_d *dev, struct eqos *eqos) priv->ops =device_get_match_data (dev); - priv->bus_id =of_alias_get_id (np,"ethernet" ); +if (dev->num_resources >0 ) { +while (priv->ops->regs[i]) { +if (priv->ops->regs[i] == dev->resource[0 ].start) { + priv->bus_id = i; +break ; + } + i++; + } + } priv->grf =syscon_regmap_lookup_by_phandle (np,"rockchip,grf" );if (IS_ERR (priv->grf)) {Signature · 7 lines
2.30.2 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Signature · 9 lines
Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox