mirror of
https://github.com/torvalds/linux
synced 2024-10-19 17:58:44 +00:00
net: dsa: lantiq: verify compatible strings against hardware
Verify compatible string against hardware. Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl> Acked-by: Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
a09d042b08
commit
204c761473
|
@ -1907,7 +1907,7 @@ static int gswip_gphy_fw_list(struct gswip_priv *priv,
|
||||||
static int gswip_probe(struct platform_device *pdev)
|
static int gswip_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct gswip_priv *priv;
|
struct gswip_priv *priv;
|
||||||
struct device_node *mdio_np, *gphy_fw_np;
|
struct device_node *np, *mdio_np, *gphy_fw_np;
|
||||||
struct device *dev = &pdev->dev;
|
struct device *dev = &pdev->dev;
|
||||||
int err;
|
int err;
|
||||||
int i;
|
int i;
|
||||||
|
@ -1944,6 +1944,24 @@ static int gswip_probe(struct platform_device *pdev)
|
||||||
priv->dev = dev;
|
priv->dev = dev;
|
||||||
version = gswip_switch_r(priv, GSWIP_VERSION);
|
version = gswip_switch_r(priv, GSWIP_VERSION);
|
||||||
|
|
||||||
|
np = dev->of_node;
|
||||||
|
switch (version) {
|
||||||
|
case GSWIP_VERSION_2_0:
|
||||||
|
case GSWIP_VERSION_2_1:
|
||||||
|
if (!of_device_is_compatible(np, "lantiq,xrx200-gswip"))
|
||||||
|
return -EINVAL;
|
||||||
|
break;
|
||||||
|
case GSWIP_VERSION_2_2:
|
||||||
|
case GSWIP_VERSION_2_2_ETC:
|
||||||
|
if (!of_device_is_compatible(np, "lantiq,xrx300-gswip") &&
|
||||||
|
!of_device_is_compatible(np, "lantiq,xrx330-gswip"))
|
||||||
|
return -EINVAL;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
dev_err(dev, "unknown GSWIP version: 0x%x", version);
|
||||||
|
return -ENOENT;
|
||||||
|
}
|
||||||
|
|
||||||
/* bring up the mdio bus */
|
/* bring up the mdio bus */
|
||||||
gphy_fw_np = of_get_compatible_child(dev->of_node, "lantiq,gphy-fw");
|
gphy_fw_np = of_get_compatible_child(dev->of_node, "lantiq,gphy-fw");
|
||||||
if (gphy_fw_np) {
|
if (gphy_fw_np) {
|
||||||
|
|
Loading…
Reference in a new issue