Quoting Greg Ungerer <g...@kernel.org>:
<snip>
/* Reset whole chip through gpio pin or memory-mapped
registers for @@ -1326,9 +1335,17 @@ static const struct
dsa_switch_ops mt7530_switch_ops = {
.port_vlan_del = mt7530_port_vlan_del,
};
+static const struct of_device_id mt7530_of_match[] = {
+ { .compatible = "mediatek,mt7621", .data = (void *)ID_MT7621, },
+ { .compatible = "mediatek,mt7530", .data = (void *)ID_MT7530, },
+ { /* sentinel */ },
+};
+MODULE_DEVICE_TABLE(of, mt7530_of_match);
+
static int
mt7530_probe(struct mdio_device *mdiodev) {
+ const struct of_device_id *of_id;
struct mt7530_priv *priv;
struct device_node *dn;
@@ -1356,13 +1373,21 @@ mt7530_probe(struct mdio_device *mdiodev)
}
}
- priv->core_pwr = devm_regulator_get(&mdiodev->dev, "core");
- if (IS_ERR(priv->core_pwr))
- return PTR_ERR(priv->core_pwr);
+ /* Get the hardware identifier from the devicetree node.
+ * We will need it for some of the clock and regulator setup.
+ */
+ of_id = of_match_node(mt7530_of_match, dn);
+ priv->id = (unsigned int)of_id->data;
We could use of_device_get_match_data instead of the above two lines.
Yep, good idea. Will change. I will add in some extra
casting to take care of the kbuild warning too.
and could you help Cc linux-media...@lists.infradead.org if you have the
next version for the series ?
Yep, sure thing.
Regards
Greg
Hi Greg,
What about enabling mips mt7621/arm mt7623 code at compile time?
Same binary can't be used on both platforms so it saves some space.
This also solved/eliminates the need for CPU detection which was also
needed if we want to support trgmii mode.
Device tree bindings are now similar between the two platforms, no
extra compatible id.
I think it should look something like this:
https://github.com/vDorst/linux-1/commit/93dc90ce56baeb3e71cae0f5339b811bbda57a97
Greats,
René