【已发布】r2s和r2c统一固件

jjm2473】 在 https://github.com/istoreos/istoreos/issues/566 发布:
r2s和r2c使用的phy芯片不一致,并且mdio的addr不一样,按其他固件的方案是使用dtb来区分,但是需要各自生成固件。

根据这段代码

展开代码
  /* Loop over the child nodes and register a phy_device for each phy */
  for_each_available_child_of_node(np, child) {
  	addr = of_mdio_parse_addr(&mdio->dev, child);
  	if (addr < 0) {
  		scanphys = true;
  		continue;
  	}

  	if (of_mdiobus_child_is_phy(child))
  		rc = of_mdiobus_register_phy(mdio, child, addr);
  	else
  		rc = of_mdiobus_register_device(mdio, child, addr);

  	if (rc == -ENODEV)
  		dev_err(&mdio->dev,
  			"MDIO device at address %d is missing.\n",
  			addr);
  	else if (rc)
  		goto unregister;
  }

  if (!scanphys)
  	return 0;

  /* auto scan for PHYs with empty reg property */
  for_each_available_child_of_node(np, child) {
  	/* Skip PHYs with reg property set */
  	if (of_find_property(child, "reg", NULL))
  		continue;

  	for (addr = 0; addr < PHY_MAX_ADDR; addr++) {
  		/* skip already registered PHYs */
  		if (mdiobus_is_registered_device(mdio, addr))
  			continue;

  		/* be noisy to encourage people to set reg property */
  		dev_info(&mdio->dev, "scan phy %pOFn at address %i\n",
  			 child, addr);

  		if (of_mdiobus_child_is_phy(child)) {
  			/* -ENODEV is the return code that PHYLIB has
  			 * standardized on to indicate that bus
  			 * scanning should continue.
  			 */
  			rc = of_mdiobus_register_phy(mdio, child, addr);
  			if (!rc)
  				break;
  			if (rc != -ENODEV)
  				goto unregister;
  		}
  	}
  }

  return 0;
将dtb节点的`compatible`改成 `compatible = "ethernet-phy-ieee802.3-c22";` (也就是去掉ethernet-phy-id*),并且删掉`reg`字段,应该就可以让内核自动配置phy了。

相关文档:
https://www.kernel.org/doc/Documentation/devicetree/bindings/net/ethernet-phy.yaml