mdio bus isn't a standalone device on ar7240. (and maybe older SoCs?)
Use simple-mfd for ar7241 and later SoCs to get mdio1 ready before gmac0
For ar7240 and older chips, manually create platform device after
ag71xx_hw_init() in ag71xx_probe()to get mdio0 ready between
ag71xx_hw_init() and ag71xx_phy_connect().
Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
#include <linux/sizes.h>
#include <linux/of_net.h>
#include <linux/of_address.h>
#include <linux/sizes.h>
#include <linux/of_net.h>
#include <linux/of_address.h>
+#include <linux/of_platform.h>
#include "ag71xx.h"
#define AG71XX_DEFAULT_MSG_ENABLE \
#include "ag71xx.h"
#define AG71XX_DEFAULT_MSG_ENABLE \
static int ag71xx_probe(struct platform_device *pdev)
{
struct device_node *np = pdev->dev.of_node;
static int ag71xx_probe(struct platform_device *pdev)
{
struct device_node *np = pdev->dev.of_node;
+ struct device_node *mdio_node;
struct net_device *dev;
struct resource *res;
struct ag71xx *ag;
struct net_device *dev;
struct resource *res;
struct ag71xx *ag;
ag71xx_wr(ag, AG71XX_REG_MAC_CFG1, 0);
ag71xx_hw_init(ag);
ag71xx_wr(ag, AG71XX_REG_MAC_CFG1, 0);
ag71xx_hw_init(ag);
+ if(!of_device_is_compatible(np, "simple-mfd")) {
+ mdio_node = of_get_child_by_name(np, "mdio-bus");
+ if(!IS_ERR(mdio_node))
+ of_platform_device_create(mdio_node, NULL, NULL);
+ }
+
err = ag71xx_phy_connect(ag);
if (err)
goto err_free;
err = ag71xx_phy_connect(ag);
if (err)
goto err_free;