This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TDA4VM: CPSW2G RMII RX issue

Part Number: TDA4VM

Hi Experts:

        I using RTOS SDK 07.03 and evm board.

        We connect CPSW2G port1 and bcm89836 phy through RMII interface, and configure phy through mdio C45 protocol. Connect the TDA4 board directly to the PC, and find that the PC cannot be pinged. Through ifconifg, it is found that the problem is caused by the absence of rx on the mac. Set mac loopback, ifconfig only has tx, no rx, it should be a problem on the mac side
I turned on mac loopback, and after pinging the PC a few times, the ifconfig is as follows:


The register dump is as follows:

Looking forward to your reply

  • I will provide more files dts and main c files

    3733.am65-cpsw-nuss.c

    // SPDX-License-Identifier: GPL-2.0+
    /*
     * DaVinci MDIO Module driver
     *
     * Copyright (C) 2010 Texas Instruments.
     *
     * Shamelessly ripped out of davinci_emac.c, original copyrights follow:
     *
     * Copyright (C) 2009 Texas Instruments.
     *
     */
    #include <linux/module.h>
    #include <linux/kernel.h>
    #include <linux/platform_device.h>
    #include <linux/delay.h>
    #include <linux/sched.h>
    #include <linux/slab.h>
    #include <linux/phy.h>
    #include <linux/clk.h>
    #include <linux/err.h>
    #include <linux/io.h>
    #include <linux/iopoll.h>
    #include <linux/pm_runtime.h>
    #include <linux/davinci_emac.h>
    #include <linux/of.h>
    #include <linux/of_device.h>
    #include <linux/of_mdio.h>
    #include <linux/pinctrl/consumer.h>
    #include <linux/mdio-bitbang.h>
    #include <linux/sys_soc.h>
    
    /*
     * This timeout definition is a worst-case ultra defensive measure against
     * unexpected controller lock ups.  Ideally, we should never ever hit this
     * scenario in practice.
     */
    #define MDIO_TIMEOUT		100 /* msecs */
    
    #define PHY_REG_MASK		0x1f
    #define PHY_ID_MASK		0x1f
    
    #define DEF_OUT_FREQ		2200000		/* 2.2 MHz */
    
    struct davinci_mdio_of_param {
    	int autosuspend_delay_ms;
    	bool manual_mode;
    };
    
    struct davinci_mdio_regs {
    	u32	version;
    	u32	control;
    #define CONTROL_IDLE		BIT(31)
    #define CONTROL_ENABLE		BIT(30)
    #define CONTROL_MAX_DIV		(0xffff)
    #define CONTROL_CLKDIV		GENMASK(15, 0)
    
    #define MDIO_MAN_MDCLK_O	BIT(2)
    #define MDIO_MAN_OE		BIT(1)
    #define MDIO_MAN_PIN		BIT(0)
    #define MDIO_MANUALMODE		BIT(31)
    
    #define MDIO_PIN               0
    
    
    	u32	alive;
    	u32	link;
    	u32	linkintraw;
    	u32	linkintmasked;
    	u32	__reserved_0[2];
    	u32	userintraw;
    	u32	userintmasked;
    	u32	userintmaskset;
    	u32	userintmaskclr;
    	u32	manualif;
    	u32	poll;
    	u32	__reserved_1[18];
    
    	struct {
    		u32	access;
    #define USERACCESS_GO		BIT(31)
    #define USERACCESS_WRITE	BIT(30)
    #define USERACCESS_ACK		BIT(29)
    #define USERACCESS_READ		(0)
    #define USERACCESS_DATA		(0xffff)
    
    		u32	physel;
    	}	user[0];
    };
    
    static const struct mdio_platform_data default_pdata = {
    	.bus_freq = DEF_OUT_FREQ,
    };
    
    struct davinci_mdio_data {
    	struct mdio_platform_data pdata;
    	struct mdiobb_ctrl bb_ctrl;
    	struct davinci_mdio_regs __iomem *regs;
    	struct clk	*clk;
    	struct device	*dev;
    	struct mii_bus	*bus;
    	bool            active_in_suspend;
    	unsigned long	access_time; /* jiffies */
    	/* Indicates that driver shouldn't modify phy_mask in case
    	 * if MDIO bus is registered from DT.
    	 */
    	bool		skip_scan;
    	u32		clk_div;
    	bool		manual_mode;
    };
    
    static void davinci_mdio_init_clk(struct davinci_mdio_data *data)
    {
    	u32 mdio_in, div, mdio_out_khz, access_time;
    
    	mdio_in = clk_get_rate(data->clk);
    	div = (mdio_in / data->pdata.bus_freq) - 1;
    	if (div > CONTROL_MAX_DIV)
    		div = CONTROL_MAX_DIV;
    
    	data->clk_div = div;
    	/*
    	 * One mdio transaction consists of:
    	 *	32 bits of preamble
    	 *	32 bits of transferred data
    	 *	24 bits of bus yield (not needed unless shared?)
    	 */
    	mdio_out_khz = mdio_in / (1000 * (div + 1));
    	access_time  = (88 * 1000) / mdio_out_khz;
    
    	/*
    	 * In the worst case, we could be kicking off a user-access immediately
    	 * after the mdio bus scan state-machine triggered its own read.  If
    	 * so, our request could get deferred by one access cycle.  We
    	 * defensively allow for 4 access cycles.
    	 */
    	data->access_time = usecs_to_jiffies(access_time * 4);
    	if (!data->access_time)
    		data->access_time = 1;
    }
    
    static void davinci_mdio_enable(struct davinci_mdio_data *data)
    {
    	/* set enable and clock divider */
    	writel(data->clk_div | CONTROL_ENABLE, &data->regs->control);
    }
    
    static void davinci_mdio_disable(struct davinci_mdio_data *data)
    {
    	u32 reg;
    
    	/* Disable MDIO state machine */
    	reg = readl(&data->regs->control);
    
    	reg &= ~CONTROL_CLKDIV;
    	reg |= data->clk_div;
    
    	reg &= ~CONTROL_ENABLE;
    	writel(reg, &data->regs->control);
    }
    
    static void davinci_mdio_enable_manual_mode(struct davinci_mdio_data *data)
    {
    	u32 reg;
    	/* set manual mode */
    	reg = readl(&data->regs->poll);
    	reg |= MDIO_MANUALMODE;
    	writel(reg, &data->regs->poll);
    }
    
    static void davinci_set_mdc(struct mdiobb_ctrl *ctrl, int level)
    {
    	struct davinci_mdio_data *data;
    	u32 reg;
    
    	data = container_of(ctrl, struct davinci_mdio_data, bb_ctrl);
    	reg = readl(&data->regs->manualif);
    
    	if (level)
    		reg |= MDIO_MAN_MDCLK_O;
    	else
    		reg &= ~MDIO_MAN_MDCLK_O;
    
    	writel(reg, &data->regs->manualif);
    }
    
    static void davinci_set_mdio_dir(struct mdiobb_ctrl *ctrl, int output)
    {
    	struct davinci_mdio_data *data;
    	u32 reg;
    
    	data = container_of(ctrl, struct davinci_mdio_data, bb_ctrl);
    	reg = readl(&data->regs->manualif);
    
    	if (output)
    		reg |= MDIO_MAN_OE;
    	else
    		reg &= ~MDIO_MAN_OE;
    
    	writel(reg, &data->regs->manualif);
    }
    
    static void  davinci_set_mdio_data(struct mdiobb_ctrl *ctrl, int value)
    {
    	struct davinci_mdio_data *data;
    	u32 reg;
    
    	data = container_of(ctrl, struct davinci_mdio_data, bb_ctrl);
    	reg = readl(&data->regs->manualif);
    
    	if (value)
    		reg |= MDIO_MAN_PIN;
    	else
    		reg &= ~MDIO_MAN_PIN;
    
    	writel(reg, &data->regs->manualif);
    }
    
    static int davinci_get_mdio_data(struct mdiobb_ctrl *ctrl)
    {
    	struct davinci_mdio_data *data;
    	unsigned long reg;
    
    	data = container_of(ctrl, struct davinci_mdio_data, bb_ctrl);
    	reg = readl(&data->regs->manualif);
    	return test_bit(MDIO_PIN, &reg);
    }
    
    static int davinci_mdiobb_read(struct mii_bus *bus, int phy, int reg)
    {
    	int ret;
    
    	ret = pm_runtime_get_sync(bus->parent);
    	if (ret < 0) {
    		pm_runtime_put_noidle(bus->parent);
    		return ret;
    	}
    
    	ret = mdiobb_read(bus, phy, reg);
    
    	pm_runtime_mark_last_busy(bus->parent);
    	pm_runtime_put_autosuspend(bus->parent);
    
    	return ret;
    }
    
    static int davinci_mdiobb_write(struct mii_bus *bus, int phy, int reg,
    				u16 val)
    {
    	int ret;
    
    	ret = pm_runtime_get_sync(bus->parent);
    	if (ret < 0) {
    		pm_runtime_put_noidle(bus->parent);
    		return ret;
    	}
    
    	ret = mdiobb_write(bus, phy, reg, val);
    
    	pm_runtime_mark_last_busy(bus->parent);
    	pm_runtime_put_autosuspend(bus->parent);
    
    	return ret;
    }
    
    static int davinci_mdio_common_reset(struct davinci_mdio_data *data)
    {
    	u32 phy_mask, ver, link;
    	int ret;
    
    	ret = pm_runtime_get_sync(data->dev);
    	if (ret < 0) {
    		pm_runtime_put_noidle(data->dev);
    		return ret;
    	}
    
    	if (data->manual_mode) {
    		davinci_mdio_disable(data);
    		davinci_mdio_enable_manual_mode(data);
    	}
    
    	/* wait for scan logic to settle */
    	msleep(PHY_MAX_ADDR * data->access_time);
    
    	/* dump hardware version info */
    	ver = readl(&data->regs->version);
    	dev_info(data->dev,
    		 "davinci mdio revision %d.%d, bus freq %ld\n",
    		 (ver >> 8) & 0xff, ver & 0xff,
    		 data->pdata.bus_freq);
    
    	if (data->skip_scan)
    	    goto done;
    
    	link = readl(&data->regs->link);
    	/* get phy mask from the alive register */
    	phy_mask = readl(&data->regs->alive);
        phy_mask = 1;
    	if (phy_mask) {
    		/* restrict mdio bus to live phys only */
    		dev_info(data->dev, "detected phy mask %x\n", ~phy_mask);
    		phy_mask = ~phy_mask;
    	} else {
    		/* desperately scan all phys */
    		dev_warn(data->dev, "no live phy, scanning all\n");
    		phy_mask = 0;
    	}
    	data->bus->phy_mask = phy_mask;
    
    done:
    	pm_runtime_mark_last_busy(data->dev);
    	pm_runtime_put_autosuspend(data->dev);
    
    	return 0;
    }
    
    static int davinci_mdio_reset(struct mii_bus *bus)
    {
    	struct davinci_mdio_data *data = bus->priv;
    
    	return davinci_mdio_common_reset(data);
    }
    
    static int davinci_mdiobb_reset(struct mii_bus *bus)
    {
    	struct mdiobb_ctrl *ctrl = bus->priv;
    	struct davinci_mdio_data *data;
    
    	data = container_of(ctrl, struct davinci_mdio_data, bb_ctrl);
    
    	return davinci_mdio_common_reset(data);
    }
    
    /* wait until hardware is ready for another user access */
    static inline int wait_for_user_access(struct davinci_mdio_data *data)
    {
    	struct davinci_mdio_regs __iomem *regs = data->regs;
    	unsigned long timeout = jiffies + msecs_to_jiffies(MDIO_TIMEOUT);
    	u32 reg;
    
    	while (time_after(timeout, jiffies)) {
    		reg = readl(&regs->user[0].access);
    		if ((reg & USERACCESS_GO) == 0)
    			return 0;
    
    		reg = readl(&regs->control);
    		if ((reg & CONTROL_IDLE) == 0) {
    			usleep_range(100, 200);
    			continue;
    		}
    
    		/*
    		 * An emac soft_reset may have clobbered the mdio controller's
    		 * state machine.  We need to reset and retry the current
    		 * operation
    		 */
    		dev_warn(data->dev, "resetting idled controller\n");
    		davinci_mdio_enable(data);
    		return -EAGAIN;
    	}
    
    	reg = readl(&regs->user[0].access);
    	if ((reg & USERACCESS_GO) == 0)
    		return 0;
    
    	dev_err(data->dev, "timed out waiting for user access\n");
    	return -ETIMEDOUT;
    }
    
    /* wait until hardware state machine is idle */
    static inline int wait_for_idle(struct davinci_mdio_data *data)
    {
    	struct davinci_mdio_regs __iomem *regs = data->regs;
    	u32 val, ret;
    
    	ret = readl_poll_timeout(&regs->control, val, val & CONTROL_IDLE,
    				 0, MDIO_TIMEOUT * 1000);
    	if (ret)
    		dev_err(data->dev, "timed out waiting for idle\n");
    
    	return ret;
    }
    
    static int davinci_mdio_read(struct mii_bus *bus, int phy_id, int phy_reg)
    {
    	struct davinci_mdio_data *data = bus->priv;
    	u32 reg;
    	int ret;
    
    	if (phy_reg & ~PHY_REG_MASK || phy_id & ~PHY_ID_MASK)
    		return -EINVAL;
    
    	ret = pm_runtime_get_sync(data->dev);
    	if (ret < 0) {
    		pm_runtime_put_noidle(data->dev);
    		return ret;
    	}
    
    	reg = (USERACCESS_GO | USERACCESS_READ | (phy_reg << 21) |
    	       (phy_id << 16));
    
    	while (1) {
    		ret = wait_for_user_access(data);
    		if (ret == -EAGAIN)
    			continue;
    		if (ret < 0)
    			break;
    
    		writel(reg, &data->regs->user[0].access);
    
    		ret = wait_for_user_access(data);
    		if (ret == -EAGAIN)
    			continue;
    		if (ret < 0)
    			break;
    
    		reg = readl(&data->regs->user[0].access);
    		ret = (reg & USERACCESS_ACK) ? (reg & USERACCESS_DATA) : -EIO;
    		break;
    	}
    
    	pm_runtime_mark_last_busy(data->dev);
    	pm_runtime_put_autosuspend(data->dev);
    	return ret;
    }
    
    static int davinci_mdio_write(struct mii_bus *bus, int phy_id,
    			      int phy_reg, u16 phy_data)
    {
    	struct davinci_mdio_data *data = bus->priv;
    	u32 reg;
    	int ret;
    
    	if (phy_reg & ~PHY_REG_MASK || phy_id & ~PHY_ID_MASK)
    		return -EINVAL;
    
    	ret = pm_runtime_get_sync(data->dev);
    	if (ret < 0) {
    		pm_runtime_put_noidle(data->dev);
    		return ret;
    	}
    
    	reg = (USERACCESS_GO | USERACCESS_WRITE | (phy_reg << 21) |
    		   (phy_id << 16) | (phy_data & USERACCESS_DATA));
    
    	while (1) {
    		ret = wait_for_user_access(data);
    		if (ret == -EAGAIN)
    			continue;
    		if (ret < 0)
    			break;
    
    		writel(reg, &data->regs->user[0].access);
    
    		ret = wait_for_user_access(data);
    		if (ret == -EAGAIN)
    			continue;
    		break;
    	}
    
    	pm_runtime_mark_last_busy(data->dev);
    	pm_runtime_put_autosuspend(data->dev);
    
    	return ret;
    }
    
    static int davinci_mdio_probe_dt(struct mdio_platform_data *data,
    			 struct platform_device *pdev)
    {
    	struct device_node *node = pdev->dev.of_node;
    	u32 prop;
    
    	if (!node)
    		return -EINVAL;
    
    	if (of_property_read_u32(node, "bus_freq", &prop)) {
    		dev_err(&pdev->dev, "Missing bus_freq property in the DT.\n");
    		return -EINVAL;
    	}
    	data->bus_freq = prop;
    
    	return 0;
    }
    
    struct k3_mdio_soc_data {
    	bool manual_mode;
    };
    
    static const struct k3_mdio_soc_data am65_mdio_soc_data = {
    	.manual_mode = true,
    };
    
    static const struct soc_device_attribute k3_mdio_socinfo[] = {
    	{ .family = "AM62X", .revision = "SR1.0", .data = &am65_mdio_soc_data },
    	{ .family = "AM64X", .revision = "SR1.0", .data = &am65_mdio_soc_data },
    	{ .family = "AM64X", .revision = "SR2.0", .data = &am65_mdio_soc_data },
    	{ .family = "AM65X", .revision = "SR1.0", .data = &am65_mdio_soc_data },
    	{ .family = "AM65X", .revision = "SR2.0", .data = &am65_mdio_soc_data },
    	{ .family = "J7200", .revision = "SR1.0", .data = &am65_mdio_soc_data },
    	{ .family = "J7200", .revision = "SR2.0", .data = &am65_mdio_soc_data },
    	{ .family = "J721E", .revision = "SR1.0", .data = &am65_mdio_soc_data },
    	{ .family = "J721E", .revision = "SR2.0", .data = &am65_mdio_soc_data },
    	{ .family = "J721S2", .revision = "SR1.0", .data = &am65_mdio_soc_data},
    	{ /* sentinel */ },
    };
    
    #if IS_ENABLED(CONFIG_OF)
    static const struct davinci_mdio_of_param of_cpsw_mdio_data = {
    	.autosuspend_delay_ms = 100,
    };
    
    static const struct of_device_id davinci_mdio_of_mtable[] = {
    	{ .compatible = "ti,davinci_mdio", },
    	{ .compatible = "ti,cpsw-mdio", .data = &of_cpsw_mdio_data},
    	{ /* sentinel */ },
    };
    MODULE_DEVICE_TABLE(of, davinci_mdio_of_mtable);
    #endif
    
    static const struct mdiobb_ops davinci_mdiobb_ops = {
    	.owner = THIS_MODULE,
    	.set_mdc = davinci_set_mdc,
    	.set_mdio_dir = davinci_set_mdio_dir,
    	.set_mdio_data = davinci_set_mdio_data,
    	.get_mdio_data = davinci_get_mdio_data,
    };
    
    static int davinci_mdio_probe(struct platform_device *pdev)
    {
    	struct mdio_platform_data *pdata = dev_get_platdata(&pdev->dev);
    	struct device *dev = &pdev->dev;
    	struct davinci_mdio_data *data;
    	struct resource *res;
    	struct phy_device *phy;
    	int ret, addr;
    	int autosuspend_delay_ms = -1;
    
    	data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
    	if (!data)
    		return -ENOMEM;
    
    	data->manual_mode = false;
    	data->bb_ctrl.ops = &davinci_mdiobb_ops;
    
    	if (IS_ENABLED(CONFIG_OF) && dev->of_node) {
    		const struct soc_device_attribute *soc_match_data;
    
    		soc_match_data = soc_device_match(k3_mdio_socinfo);
    		if (soc_match_data && soc_match_data->data) {
    			const struct k3_mdio_soc_data *socdata =
    						soc_match_data->data;
    
    			data->manual_mode = socdata->manual_mode;
    		}
    	}
    
    	if (data->manual_mode)
    		data->bus = alloc_mdio_bitbang(&data->bb_ctrl);
    	else
    		data->bus = devm_mdiobus_alloc(dev);
    
    	if (!data->bus) {
    		dev_err(dev, "failed to alloc mii bus\n");
    		return -ENOMEM;
    	}
    
    	if (IS_ENABLED(CONFIG_OF) && dev->of_node) {
    		const struct davinci_mdio_of_param *of_mdio_data;
    
    		ret = davinci_mdio_probe_dt(&data->pdata, pdev);
    		if (ret)
    			return ret;
    		snprintf(data->bus->id, MII_BUS_ID_SIZE, "%s", pdev->name);
    
    		of_mdio_data = of_device_get_match_data(&pdev->dev);
    		if (of_mdio_data) {
    			autosuspend_delay_ms =
    					of_mdio_data->autosuspend_delay_ms;
    		}
    	} else {
    		data->pdata = pdata ? (*pdata) : default_pdata;
    		snprintf(data->bus->id, MII_BUS_ID_SIZE, "%s-%x",
    			 pdev->name, pdev->id);
    	}
    
    	data->bus->name		= dev_name(dev);
    
    	if (data->manual_mode) {
    		data->bus->read		= davinci_mdiobb_read;
    		data->bus->write	= davinci_mdiobb_write;
    		data->bus->reset	= davinci_mdiobb_reset;
    
    		dev_info(dev, "Configuring MDIO in manual mode\n");
    	} else {
    		data->bus->read		= davinci_mdio_read;
    		data->bus->write	= davinci_mdio_write;
    		data->bus->reset	= davinci_mdio_reset;
    		data->bus->priv		= data;
    	}
    	data->bus->parent	= dev;
    
    	data->clk = devm_clk_get(dev, "fck");
    	if (IS_ERR(data->clk)) {
    		dev_err(dev, "failed to get device clock\n");
    		return PTR_ERR(data->clk);
    	}
    
    	dev_set_drvdata(dev, data);
    	data->dev = dev;
    
    	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
    	if (!res)
    		return -EINVAL;
    	data->regs = devm_ioremap(dev, res->start, resource_size(res));
    	if (!data->regs)
    		return -ENOMEM;
    
    	davinci_mdio_init_clk(data);
    
    	pm_runtime_set_autosuspend_delay(&pdev->dev, autosuspend_delay_ms);
    	pm_runtime_use_autosuspend(&pdev->dev);
    	pm_runtime_enable(&pdev->dev);
    
    	/* register the mii bus
    	 * Create PHYs from DT only in case if PHY child nodes are explicitly
    	 * defined to support backward compatibility with DTs which assume that
    	 * Davinci MDIO will always scan the bus for PHYs detection.
    	 */
    	if (dev->of_node && of_get_child_count(dev->of_node))
    		data->skip_scan = true;
    
    	ret = of_mdiobus_register(data->bus, dev->of_node);
    	if (ret)
    		goto bail_out;
    
    	/* scan and dump the bus */
    	for (addr = 0; addr < PHY_MAX_ADDR; addr++) {
    		phy = mdiobus_get_phy(data->bus, addr);
    		if (phy) {
    			dev_info(dev, "phy[%d]: device %s, driver %s\n",
    				 phy->mdio.addr, phydev_name(phy),
    				 phy->drv ? phy->drv->name : "unknown");
    		}
    	}
    
    	return 0;
    
    bail_out:
    	pm_runtime_dont_use_autosuspend(&pdev->dev);
    	pm_runtime_disable(&pdev->dev);
    	return ret;
    }
    
    static int davinci_mdio_remove(struct platform_device *pdev)
    {
    	struct davinci_mdio_data *data = platform_get_drvdata(pdev);
    
    	if (data->bus) {
    		mdiobus_unregister(data->bus);
    
    		if (data->manual_mode)
    			free_mdio_bitbang(data->bus);
    	}
    
    	pm_runtime_dont_use_autosuspend(&pdev->dev);
    	pm_runtime_disable(&pdev->dev);
    
    	return 0;
    }
    
    #ifdef CONFIG_PM
    static int davinci_mdio_runtime_suspend(struct device *dev)
    {
    	struct davinci_mdio_data *data = dev_get_drvdata(dev);
    	u32 ctrl;
    
    	/* shutdown the scan state machine */
    	ctrl = readl(&data->regs->control);
    	ctrl &= ~CONTROL_ENABLE;
    	writel(ctrl, &data->regs->control);
    
    	if (!data->manual_mode)
    		wait_for_idle(data);
    
    	return 0;
    }
    
    static int davinci_mdio_runtime_resume(struct device *dev)
    {
    	struct davinci_mdio_data *data = dev_get_drvdata(dev);
    
    	if (data->manual_mode) {
    		davinci_mdio_disable(data);
    		davinci_mdio_enable_manual_mode(data);
    	} else {
    		davinci_mdio_enable(data);
    	}
    	return 0;
    }
    #endif
    
    #ifdef CONFIG_PM_SLEEP
    static int davinci_mdio_suspend(struct device *dev)
    {
    	struct davinci_mdio_data *data = dev_get_drvdata(dev);
    	int ret = 0;
    
    	data->active_in_suspend = !pm_runtime_status_suspended(dev);
    	if (data->active_in_suspend)
    		ret = pm_runtime_force_suspend(dev);
    	if (ret < 0)
    		return ret;
    
    	/* Select sleep pin state */
    	pinctrl_pm_select_sleep_state(dev);
    
    	return 0;
    }
    
    static int davinci_mdio_resume(struct device *dev)
    {
    	struct davinci_mdio_data *data = dev_get_drvdata(dev);
    
    	/* Select default pin state */
    	pinctrl_pm_select_default_state(dev);
    
    	if (data->active_in_suspend)
    		pm_runtime_force_resume(dev);
    
    	return 0;
    }
    #endif
    
    static const struct dev_pm_ops davinci_mdio_pm_ops = {
    	SET_RUNTIME_PM_OPS(davinci_mdio_runtime_suspend,
    			   davinci_mdio_runtime_resume, NULL)
    	SET_LATE_SYSTEM_SLEEP_PM_OPS(davinci_mdio_suspend, davinci_mdio_resume)
    };
    
    static struct platform_driver davinci_mdio_driver = {
    	.driver = {
    		.name	 = "davinci_mdio",
    		.pm	 = &davinci_mdio_pm_ops,
    		.of_match_table = of_match_ptr(davinci_mdio_of_mtable),
    	},
    	.probe = davinci_mdio_probe,
    	.remove = davinci_mdio_remove,
    };
    
    static int __init davinci_mdio_init(void)
    {
    	return platform_driver_register(&davinci_mdio_driver);
    }
    device_initcall(davinci_mdio_init);
    
    static void __exit davinci_mdio_exit(void)
    {
    	platform_driver_unregister(&davinci_mdio_driver);
    }
    module_exit(davinci_mdio_exit);
    
    MODULE_LICENSE("GPL");
    MODULE_DESCRIPTION("DaVinci MDIO driver");
    

    // SPDX-License-Identifier: GPL-2.0
    /*
     * Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/
     */
    
    /dts-v1/;
    
    #include "k3-j721e-som-p0.dtsi"
    #include <dt-bindings/gpio/gpio.h>
    #include <dt-bindings/input/input.h>
    #include <dt-bindings/sound/ti-mcasp.h>
    #include <dt-bindings/net/ti-dp83867.h>
    
    / {
    	chosen {
    		stdout-path = "serial2:115200n8";
    		bootargs = "console=ttyS2,115200n8 earlycon=ns16550a,mmio32,0x02800000 root=/dev/mmcblk0p2 rw rootfstype=ext4 rootwait";
    	};
    
    	evm_12v0: fixedregulator-evm12v0 {
    		/* main supply */
    		compatible = "regulator-fixed";
    		regulator-name = "evm_12v0";
    		regulator-min-microvolt = <12000000>;
    		regulator-max-microvolt = <12000000>;
    		regulator-always-on;
    		regulator-boot-on;
    	};
    
    	vsys_3v3: fixedregulator-vsys3v3 {
    		/* Output of LMS140 */
    		compatible = "regulator-fixed";
    		regulator-name = "vsys_3v3";
    		regulator-min-microvolt = <3300000>;
    		regulator-max-microvolt = <3300000>;
    		vin-supply = <&evm_12v0>;
    		regulator-always-on;
    		regulator-boot-on;
    	};
    
    	vsys_5v0: fixedregulator-vsys5v0 {
    		/* Output of LM5140 */
    		compatible = "regulator-fixed";
    		regulator-name = "vsys_5v0";
    		regulator-min-microvolt = <5000000>;
    		regulator-max-microvolt = <5000000>;
    		vin-supply = <&evm_12v0>;
    		regulator-always-on;
    		regulator-boot-on;
    	};
    
    	/* Used for 48KHz family */
    	pll4: pll4_fixed {
    		#clock-cells = <0>;
    		compatible = "fixed-clock";
    		clock-frequency = <1179648000>;
    	};
    
    	/* Used for 44.1KHz family */
    	pll15: pll15_fixed {
    		#clock-cells = <0>;
    		compatible = "fixed-clock";
    		clock-frequency = <1083801600>;
    	};
    
    	sound0: sound@0 {
    		compatible = "ti,j721e-cpb-audio";
    		ti,model = "j721e-cpb-analog";
                    status = "disabled";
    
    		//ti,cpb-mcasp = <&mcasp10>;
    		//ti,cpb-codec = <&pcm3168a_1>;
    
    		clocks = <&pll4>, <&pll15>,
    			 <&k3_clks 184 1>,
    			 <&k3_clks 184 2>, <&k3_clks 184 4>,
    			 <&k3_clks 157 371>,
    			 <&k3_clks 157 400>, <&k3_clks 157 401>;
    		clock-names = "pll4", "pll15",
    			      "cpb-mcasp",
    			      "cpb-mcasp-48000", "cpb-mcasp-44100",
    			      "audio-refclk2",
    			      "audio-refclk2-48000", "audio-refclk2-44100";
    	};
    
    	vdd_mmc1: fixedregulator-sd {
    		compatible = "regulator-fixed";
    		regulator-name = "vdd_mmc1";
    		regulator-min-microvolt = <3300000>;
    		regulator-max-microvolt = <3300000>;
    		regulator-boot-on;
    		enable-active-high;
    		vin-supply = <&vsys_3v3>;
    		//gpio = <&exp2 2 GPIO_ACTIVE_HIGH>;
    	};
    
    	vdd_sd_dv_alt: gpio-regulator-TLV71033 {
    		compatible = "regulator-gpio";
    		pinctrl-names = "default";
    		pinctrl-0 = <&vdd_sd_dv_alt_pins_idc>;
    		regulator-name = "tlv71033";
    		regulator-min-microvolt = <1800000>;
    		regulator-max-microvolt = <3300000>;
    		regulator-boot-on;
    		vin-supply = <&vsys_5v0>;
    		gpios = <&main_gpio0 5 GPIO_ACTIVE_HIGH>;
    		states = <1800000 0x0
    			  3300000 0x1>;
    	};
    
    	cpsw9g_virt_mac: main_r5fss_cpsw9g_virt_mac0 {
    		compatible = "ti,j721e-cpsw-virt-mac";
    		dma-coherent;
    		ti,psil-base = <0x4a00>;
    		ti,remote-name = "mpu_1_0_ethswitch-device-0";
    
    		dmas = <&main_udmap 0xca00>,
    		       <&main_udmap 0xca01>,
    		       <&main_udmap 0xca02>,
    		       <&main_udmap 0xca03>,
    		       <&main_udmap 0xca04>,
    		       <&main_udmap 0xca05>,
    		       <&main_udmap 0xca06>,
    		       <&main_udmap 0xca07>,
    		       <&main_udmap 0x4a00>;
    		dma-names = "tx0", "tx1", "tx2", "tx3",
    			    "tx4", "tx5", "tx6", "tx7",
    			    "rx";
    
    		virt_emac_port {
    			ti,label = "virt-port";
    			/* local-mac-address = [0 0 0 0 0 0]; */
    		};
    	};
    
    	dp0: connector {
    		compatible = "dp-connector";
    		label = "DP0";
    
    		port {
    			dp_connector_in: endpoint {
    				remote-endpoint = <&dp_bridge_output>;
    			};
    		};
    	};
    
    	clk_ov5640_fixed: ov5640-xclk {
    		compatible = "fixed-clock";
    		#clock-cells = <0>;
    		clock-frequency = <25000000>;
    	};
    };
    
    &main_pmx0 {
    	dp0_pins_default: dp0_pins_default {
    		pinctrl-single,pins = <
    			J721E_IOPAD(0x1c4, PIN_INPUT, 5) /* SPI0_CS1.DP0_HPD */
    		>;
    	};
    
    	main_i2c1_exp4_pins_default: main-i2c1-exp4-pins-default {
    		pinctrl-single,pins = <
    			J721E_IOPAD(0x230, PIN_INPUT, 7) /* (U2) ECAP0_IN_APWM_OUT.GPIO1_11 */
    		>;
    	};
    
    	main_i2c0_pins_default: main-i2c0-pins-default {
    		pinctrl-single,pins = <
    			J721E_IOPAD(0x220, PIN_INPUT_PULLUP, 0) /* (AC5) I2C0_SCL */
    			J721E_IOPAD(0x224, PIN_INPUT_PULLUP, 0) /* (AA5) I2C0_SDA */
    		>;
    	};
    
    	main_i2c1_pins_default: main-i2c1-pins-default {
    		pinctrl-single,pins = <
    			J721E_IOPAD(0x228, PIN_INPUT_PULLUP, 0) /* (Y6) I2C1_SCL */
    			J721E_IOPAD(0x22c, PIN_INPUT_PULLUP, 0) /* (AA6) I2C1_SDA */
    		>;
    	};
    
    	main_i2c3_pins_default: main-i2c3-pins-default {
    		pinctrl-single,pins = <
    			J721E_IOPAD(0x270, PIN_INPUT_PULLUP, 4) /* (T26) MMC2_CLK.I2C3_SCL */
    			J721E_IOPAD(0x274, PIN_INPUT_PULLUP, 4) /* (T25) MMC2_CMD.I2C3_SDA */
    		>;
    	};
    
    	main_i2c6_pins_default: main-i2c6-pins-default {
    		pinctrl-single,pins = <
    			J721E_IOPAD(0x1d0, PIN_INPUT_PULLUP, 2) /* (AA3) SPI0_D1.I2C6_SCL */
    			J721E_IOPAD(0x1e4, PIN_INPUT_PULLUP, 2) /* (Y2) SPI1_D1.I2C6_SDA */
    		>;
    	};
    
    	mcasp10_pins_default: mcasp10_pins_default {
    		pinctrl-single,pins = <
    			J721E_IOPAD(0x158, PIN_OUTPUT_PULLDOWN, 12) /* (U23) RGMII5_TX_CTL.MCASP10_ACLKX */
    			J721E_IOPAD(0x15c, PIN_OUTPUT_PULLDOWN, 12) /* (U26) RGMII5_RX_CTL.MCASP10_AFSX */
    			J721E_IOPAD(0x160, PIN_OUTPUT_PULLDOWN, 12) /* (V28) RGMII5_TD3.MCASP10_AXR0 */
    			J721E_IOPAD(0x164, PIN_OUTPUT_PULLDOWN, 12) /* (V29) RGMII5_TD2.MCASP10_AXR1 */
    			J721E_IOPAD(0x170, PIN_OUTPUT_PULLDOWN, 12) /* (U29) RGMII5_TXC.MCASP10_AXR2 */
    			J721E_IOPAD(0x174, PIN_OUTPUT_PULLDOWN, 12) /* (U25) RGMII5_RXC.MCASP10_AXR3 */
    			J721E_IOPAD(0x198, PIN_INPUT_PULLDOWN, 12) /* (V25) RGMII6_TD1.MCASP10_AXR4 */
    			J721E_IOPAD(0x19c, PIN_INPUT_PULLDOWN, 12) /* (W27) RGMII6_TD0.MCASP10_AXR5 */
    			J721E_IOPAD(0x1a0, PIN_INPUT_PULLDOWN, 12) /* (W29) RGMII6_TXC.MCASP10_AXR6 */
    		>;
    	};
    
    	audi_ext_refclk2_pins_default: audi_ext_refclk2_pins_default {
    		pinctrl-single,pins = <
    			J721E_IOPAD(0x1a4, PIN_OUTPUT, 3) /* (W26) RGMII6_RXC.AUDIO_EXT_REFCLK2 */
    		>;
    	};
    
    	main_mmc1_pins_default: main_mmc1_pins_default {
    		pinctrl-single,pins = <
    			J721E_IOPAD(0x254, PIN_INPUT, 0) /* (R29) MMC1_CMD */
    			J721E_IOPAD(0x250, PIN_INPUT, 0) /* (P25) MMC1_CLK */
    			J721E_IOPAD(0x2ac, PIN_INPUT, 0) /* (P25) MMC1_CLKLB */
    			J721E_IOPAD(0x24c, PIN_INPUT, 0) /* (R24) MMC1_DAT0 */
    			J721E_IOPAD(0x248, PIN_INPUT, 0) /* (P24) MMC1_DAT1 */
    			J721E_IOPAD(0x244, PIN_INPUT, 0) /* (R25) MMC1_DAT2 */
    			J721E_IOPAD(0x240, PIN_INPUT, 0) /* (R26) MMC1_DAT3 */
    			J721E_IOPAD(0x258, PIN_INPUT, 0) /* (P23) MMC1_SDCD */
    			J721E_IOPAD(0x25c, PIN_INPUT, 0) /* (R28) MMC1_SDWP */
    		>;
    	};
    
    	vdd_sd_dv_alt_pins_default: vdd_sd_dv_alt_pins_default {
    		pinctrl-single,pins = <
    			J721E_IOPAD(0x1d8, PIN_INPUT, 7) /* (W4) SPI1_CS1.GPIO0_117 */
    		>;
    	};
    
    	vdd_sd_dv_alt_pins_idc: vdd_sd_dv_alt_pins_idc {
    		pinctrl-single,pins = <
    			J721E_IOPAD(0x014, PIN_INPUT, 7) /* (AH23) GPIO0_5 */
    		>;
    	};
    
    	main_usbss0_pins_default: main_usbss0_pins_default {
    		pinctrl-single,pins = <
    			J721E_IOPAD(0x290, PIN_OUTPUT, 0) /* (U6) USB0_DRVVBUS */
    		>;
    	};
    
    	main_usbss1_pins_default: main_usbss1_pins_default {
    
    	};
    
    	// enable main_mcan0 in PT1 : Rader
    	main_mcan0_pins_default: main_mcan0_pins_default {
    		pinctrl-single,pins = <
    			J721E_IOPAD(0x208, PIN_INPUT, 0)  /* (W5) MCAN0_RX : GPIO1_1 */
    			J721E_IOPAD(0x20c, PIN_OUTPUT, 0)  /* (W6) MCAN0_TX : GPIO1_2 */
    		>;
    	};
    
    	// enable main_mcan1 in PT1 : IFC
    	main_mcan1_pins_default: main_mcan1_pins_default {
    		pinctrl-single,pins = <
    			J721E_IOPAD(0x210, PIN_INPUT, 0)   /* (W3) MCAN1_RX : GPIO1_3 */
    			J721E_IOPAD(0x214, PIN_OUTPUT, 0)   /* (V4) MCAN1_TX : GPIO1_4 */
    		>;
    	};
    
    	// enable main_mcan2 in PT1: Rader
    	main_mcan2_pins_default: main_mcan2_pins_default {
    		pinctrl-single,pins = <
    			J721E_IOPAD(0x1f0, PIN_INPUT, 3)  /* (AC2) MCAN2_RX : GPIO0_123 */
    			J721E_IOPAD(0x1f4, PIN_OUTPUT, 3)  /* (AB1) MCAN2_TX : GPIO0_124 */
    		>;
    	};
    };
    
    &wkup_pmx0 {
    	sw11_button_pins_default: sw11_button_pins_default {
    		pinctrl-single,pins = <
    			J721E_WKUP_IOPAD(0xcc, PIN_INPUT, 7) /* (G28) WKUP_GPIO0_7 */
    		>;
    	};
    
    	mcu_fss0_ospi1_pins_default: mcu-fss0-ospi1-pins-default {
    		pinctrl-single,pins = <
    			J721E_WKUP_IOPAD(0x34, PIN_OUTPUT, 0) /* (F22) MCU_OSPI1_CLK */
    			J721E_WKUP_IOPAD(0x50, PIN_OUTPUT, 0) /* (C22) MCU_OSPI1_CSn0 */
    			J721E_WKUP_IOPAD(0x40, PIN_INPUT, 0) /* (D22) MCU_OSPI1_D0 */
    			J721E_WKUP_IOPAD(0x44, PIN_INPUT, 0) /* (G22) MCU_OSPI1_D1 */
    			J721E_WKUP_IOPAD(0x48, PIN_INPUT, 0) /* (D23) MCU_OSPI1_D2 */
    			J721E_WKUP_IOPAD(0x4c, PIN_INPUT, 0) /* (C23) MCU_OSPI1_D3 */
    			J721E_WKUP_IOPAD(0x3c, PIN_INPUT, 0) /* (B23) MCU_OSPI1_DQS */
    			J721E_WKUP_IOPAD(0x38, PIN_INPUT, 0) /* (A23) MCU_OSPI1_LBCLKO */
    		>;
    	};
    };
    
    &wkup_pmx0 {
    	mcu_cpsw_pins_default: mcu_cpsw_pins_default {
    	pinctrl-single,pins = <
    		J721E_WKUP_IOPAD(0x58, PIN_INPUT, 1) /* (B27) MCU_RGMII1_TX_CTL.MCU_RMII1_CRS_DV */
    		J721E_WKUP_IOPAD(0x74, PIN_INPUT, 1) /* (C24) MCU_RGMII1_RXC.MCU_RMII1_REF_CLK */
    		J721E_WKUP_IOPAD(0x84, PIN_INPUT, 1) /* (B24) MCU_RGMII1_RD0.MCU_RMII1_RXD0 */
    		J721E_WKUP_IOPAD(0x80, PIN_INPUT, 1) /* (A24) MCU_RGMII1_RD1.MCU_RMII1_RXD1 */
    		J721E_WKUP_IOPAD(0x5c, PIN_INPUT, 1) /* (C25) MCU_RGMII1_RX_CTL.MCU_RMII1_RX_ER */
    		J721E_WKUP_IOPAD(0x6c, PIN_OUTPUT, 1) /* (B25) MCU_RGMII1_TD0.MCU_RMII1_TXD0 */
    		J721E_WKUP_IOPAD(0x68, PIN_OUTPUT, 1) /* (A26) MCU_RGMII1_TD1.MCU_RMII1_TXD1 */
    		J721E_WKUP_IOPAD(0x70, PIN_OUTPUT, 1) /* (B26) MCU_RGMII1_TXC.MCU_RMII1_TX_EN */
    	>;
    	};
    
    	mcu_mdio_pins_default: mcu_mdio1_pins_default {
    		pinctrl-single,pins = <
    			J721E_WKUP_IOPAD(0x008c, PIN_OUTPUT, 0) /* MCU_MDIO0_MDC */
    			J721E_WKUP_IOPAD(0x0088, PIN_INPUT, 0) /* MCU_MDIO0_MDIO */
    		>;
    	};
    
    	mcu_mcan0_pins_default: mcu-mcan0-pins-default {
    		pinctrl-single,pins = <
    			J721E_WKUP_IOPAD(0xac, PIN_INPUT, 0) /* (C29) MCU_MCAN0_RX */
    			J721E_WKUP_IOPAD(0xa8, PIN_OUTPUT, 0) /* (D29) MCU_MCAN0_TX */
    		>;
    	};
    
    	mcu_mcan0_gpio_pins_default: mcu-mcan0-gpio-pins-default {
    		pinctrl-single,pins = <
    			J721E_WKUP_IOPAD(0xb0, PIN_INPUT, 7) /* (F26) WKUP_GPIO0_0 */
    			J721E_WKUP_IOPAD(0x98, PIN_INPUT, 7) /* (E28) MCU_SPI0_D1.WKUP_GPIO0_54 */
    		>;
    	};
    
    	mcu_mcan1_pins_default: mcu-mcan1-pins-default {
    		pinctrl-single,pins = <
    			J721E_WKUP_IOPAD(0xc4, PIN_INPUT, 0) /* (G24) WKUP_GPIO0_5.MCU_MCAN1_RX */
    			J721E_WKUP_IOPAD(0xc0, PIN_OUTPUT, 0) /* (G25) WKUP_GPIO0_4.MCU_MCAN1_TX */
    		>;
    	};
    
    	mcu_mcan1_gpio_pins_default: mcu-mcan1-gpio-pins-default {
    		pinctrl-single,pins = <
    			J721E_WKUP_IOPAD(0xb8, PIN_INPUT, 7) /* (F28) WKUP_GPIO0_2 */
    		>;
    	};
    };
    
    &wkup_uart0 {
    	/* Wakeup UART is used by System firmware */
    	status = "disabled";
    };
    
    &main_uart0 {
    	power-domains = <&k3_pds 146 TI_SCI_PD_SHARED>;
    };
    
    &main_uart1 {
    	/* UART not brought out */
    	status = "disabled";
    };
    &main_uart3 {
    	/* UART not brought out */
    	status = "disabled";
    };
    
    &main_uart4 {
    	/* UART not brought out */
    	status = "disabled";
    };
    &main_uart5 {
    	/* UART not brought out */
    	status = "disabled";
    };
    
    &main_uart6 {
    	/* UART not brought out */
    	status = "disabled";
    };
    
    &main_uart7 {
    	/* UART not brought out */
    	status = "disabled";
    };
    
    &main_uart8 {
    	/* UART not brought out */
    	status = "disabled";
    };
    
    &main_uart9 {
    	/* UART not brought out */
    	status = "disabled";
    };
    
    &main_gpio2 {
    	status = "disabled";
    };
    
    &main_gpio3 {
    	status = "disabled";
    };
    
    &main_gpio4 {
    	status = "disabled";
    };
    
    &main_gpio5 {
    	status = "disabled";
    };
    
    &main_gpio6 {
    	status = "disabled";
    };
    
    &main_gpio7 {
    	status = "disabled";
    };
    
    &wkup_gpio1 {
    	status = "disabled";
    };
    
    &mailbox0_cluster0 {
    	interrupts = <436>;
    
    	mbox_mcu_r5fss0_core0: mbox-mcu-r5fss0-core0 {
    		ti,mbox-rx = <0 0 0>;
    		ti,mbox-tx = <1 0 0>;
    	};
    
    	mbox_mcu_r5fss0_core1: mbox-mcu-r5fss0-core1 {
    		ti,mbox-rx = <2 0 0>;
    		ti,mbox-tx = <3 0 0>;
    	};
    };
    
    &mailbox0_cluster1 {
    	interrupts = <432>;
    
    	mbox_main_r5fss0_core0: mbox-main-r5fss0-core0 {
    		ti,mbox-rx = <0 0 0>;
    		ti,mbox-tx = <1 0 0>;
    	};
    
    	mbox_main_r5fss0_core1: mbox-main-r5fss0-core1 {
    		ti,mbox-rx = <2 0 0>;
    		ti,mbox-tx = <3 0 0>;
    	};
    };
    
    &mailbox0_cluster2 {
    	interrupts = <428>;
    
    	mbox_main_r5fss1_core0: mbox-main-r5fss1-core0 {
    		ti,mbox-rx = <0 0 0>;
    		ti,mbox-tx = <1 0 0>;
    	};
    
    	mbox_main_r5fss1_core1: mbox-main-r5fss1-core1 {
    		ti,mbox-rx = <2 0 0>;
    		ti,mbox-tx = <3 0 0>;
    	};
    };
    
    &mailbox0_cluster3 {
    	interrupts = <424>;
    
    	mbox_c66_0: mbox-c66-0 {
    		ti,mbox-rx = <0 0 0>;
    		ti,mbox-tx = <1 0 0>;
    	};
    
    	mbox_c66_1: mbox-c66-1 {
    		ti,mbox-rx = <2 0 0>;
    		ti,mbox-tx = <3 0 0>;
    	};
    };
    
    &mailbox0_cluster4 {
    	interrupts = <420>;
    
    	mbox_c71_0: mbox-c71-0 {
    		ti,mbox-rx = <0 0 0>;
    		ti,mbox-tx = <1 0 0>;
    	};
    };
    
    &mailbox0_cluster5 {
    	status = "disabled";
    };
    
    &mailbox0_cluster6 {
    	status = "disabled";
    };
    
    &mailbox0_cluster7 {
    	status = "disabled";
    };
    
    &mailbox0_cluster8 {
    	status = "disabled";
    };
    
    &mailbox0_cluster9 {
    	status = "disabled";
    };
    
    &mailbox0_cluster10 {
    	status = "disabled";
    };
    
    &mailbox0_cluster11 {
    	status = "disabled";
    };
    
    &mcu_r5fss0_core0 {
    	mboxes = <&mailbox0_cluster0 &mbox_mcu_r5fss0_core0>;
    };
    
    &mcu_r5fss0_core1 {
    	mboxes = <&mailbox0_cluster0 &mbox_mcu_r5fss0_core1>;
    };
    
    &main_r5fss0_core0 {
    	mboxes = <&mailbox0_cluster1 &mbox_main_r5fss0_core0>;
    };
    
    &main_r5fss0_core1 {
    	mboxes = <&mailbox0_cluster1 &mbox_main_r5fss0_core1>;
    };
    
    &main_r5fss1_core0 {
    	mboxes = <&mailbox0_cluster2 &mbox_main_r5fss1_core0>;
    };
    
    &main_r5fss1_core1 {
    	mboxes = <&mailbox0_cluster2 &mbox_main_r5fss1_core1>;
    };
    
    &c66_0 {
    	mboxes = <&mailbox0_cluster3 &mbox_c66_0>;
    };
    
    &c66_1 {
    	mboxes = <&mailbox0_cluster3 &mbox_c66_1>;
    };
    
    &c71_0 {
    	mboxes = <&mailbox0_cluster4 &mbox_c71_0>;
    };
    
    &ospi1 {
    	pinctrl-names = "default";
    	pinctrl-0 = <&mcu_fss0_ospi1_pins_default>;
    
    	flash@0{
    		compatible = "jedec,spi-nor";
    		reg = <0x0>;
    		spi-tx-bus-width = <1>;
    		spi-rx-bus-width = <4>;
    		spi-max-frequency = <40000000>;
    		cdns,tshsl-ns = <60>;
    		cdns,tsd2d-ns = <60>;
    		cdns,tchsh-ns = <60>;
    		cdns,tslch-ns = <60>;
    		cdns,read-delay = <2>;
    		#address-cells = <1>;
    		#size-cells = <1>;
    	};
    };
    
    &tscadc0 {
        status = "disabled";
    	adc {
    		ti,adc-channels = <0 1 2 3 4 5 6 7>;
    	};
    };
    
    &tscadc1 {
        status = "disabled";
    	adc {
    		ti,adc-channels = <0 1 2 3 4 5 6 7>;
    	};
    };
    
    &dss {
    	status = "ok";
    };
    
    &dss_ports {
    	#address-cells = <1>;
    	#size-cells = <0>;
    
    	port@0 {
    		reg = <0>;
    
    		dpi_out_real0: endpoint {
    			remote-endpoint = <&dp_bridge_input>;
    		};
    	};
    };
    
    &mhdp {
    	status = "ok";
    	pinctrl-names = "default";
    	pinctrl-0 = <&dp0_pins_default>;
    };
    
    &dp0_ports {
    	#address-cells = <1>;
    	#size-cells = <0>;
    
    	port@0 {
    		reg = <0>;
    		dp_bridge_input: endpoint {
    			remote-endpoint = <&dpi_out_real0>;
    		};
    	};
    
    	port@1 {
    		reg = <1>;
    		dp_bridge_output: endpoint {
    			remote-endpoint = <&dp_connector_in>;
    		};
    	};
    };
    
    &k3_clks {
    	/* Confiure AUDIO_EXT_REFCLK2 pin as output */
    	pinctrl-names = "default";
    	pinctrl-0 = <&audi_ext_refclk2_pins_default>;
    };
    
    &mcu_cpsw {
    	pinctrl-names = "default";
    	pinctrl-0 = <&mcu_cpsw_pins_default &mcu_mdio_pins_default>;
    };
    
    &davinci_mdio {
    	phy0: ethernet-phy@0 {
    		compatible = "ethernet-phy-ieee802.3-c45";
    		reg = <0>;
    		ti,rx-internal-delay = <DP83867_RGMIIDCTL_2_00_NS>;
    		ti,fifo-depth = <DP83867_PHYCR_FIFO_DEPTH_4_B_NIB>;
    	};
    };
    
    &cpsw_port1 {
    	phy-mode = "rmii";
    	phy-handle = <&phy0>;
    };
    
    &main_sdhci0 {
    	/* eMMC */
    	non-removable;
    	ti,driver-strength-ohm = <50>;
    	disable-wp;
    };
    
    &main_sdhci1 {
    	/* SD/MMC */
    	//vmmc-supply = <&vdd_mmc1>;
            vmmc-supply = <&vsys_3v3>;
    	vqmmc-supply = <&vdd_sd_dv_alt>;
    	pinctrl-names = "default";
    	pinctrl-0 = <&main_mmc1_pins_default>;
    	disable-wp;
    };
    
    &main_sdhci2 {
    	/* Unused */
    	status = "disabled";
    };
    
    &serdes_wiz0 {
    	status = "disabled";
    };
    
    &serdes0 {
    	serdes0_pcie_link: link@0 {
    		reg = <0>;
    		cdns,num-lanes = <1>;
    		#phy-cells = <0>;
    		cdns,phy-type = <PHY_TYPE_PCIE>;
    		resets = <&serdes_wiz0 1>;
    		status = "disabled";
    	};
    };
    
    &serdes1 {
    	serdes1_pcie_link: link@0 {
    		reg = <0>;
    		cdns,num-lanes = <2>;
    		#phy-cells = <0>;
    		cdns,phy-type = <PHY_TYPE_PCIE>;
    		resets = <&serdes_wiz1 1>, <&serdes_wiz1 2>;
    	};
    };
    
    &serdes2 {
    	serdes2_pcie_link: link@0 {
    		reg = <0>;
    		cdns,num-lanes = <2>;
    		#phy-cells = <0>;
    		cdns,phy-type = <PHY_TYPE_PCIE>;
    		resets = <&serdes_wiz2 1>, <&serdes_wiz2 2>;
    	};
    };
    
    &pcie0_rc {
            status = "disabled";
    	//reset-gpios = <&exp1 6 GPIO_ACTIVE_HIGH>;
    	phys = <&serdes0_pcie_link>;
    	phy-names = "pcie_phy";
    	num-lanes = <1>;
    };
    
    &pcie1_rc {
            status = "disabled";
    	//reset-gpios = <&exp1 2 GPIO_ACTIVE_HIGH>;
    	phys = <&serdes1_pcie_link>;
    	phy-names = "pcie_phy";
    	num-lanes = <2>;
    };
    
    &pcie2_rc {
            status = "disabled";
    	//reset-gpios = <&exp2 20 GPIO_ACTIVE_HIGH>;
    	phys = <&serdes2_pcie_link>;
    	phy-names = "pcie_phy";
    	num-lanes = <2>;
    };
    
    &pcie0_ep {
    	phys = <&serdes0_pcie_link>;
    	phy-names = "pcie_phy";
    	num-lanes = <1>;
    	status = "disabled";
    };
    
    &pcie1_ep {
    	phys = <&serdes1_pcie_link>;
    	phy-names = "pcie_phy";
    	num-lanes = <2>;
    	status = "disabled";
    };
    
    &pcie2_ep {
    	phys = <&serdes2_pcie_link>;
    	phy-names = "pcie_phy";
    	num-lanes = <2>;
    	status = "disabled";
    };
    
    &pcie3_rc {
    	status = "disabled";
    };
    
    &pcie3_ep {
    	status = "disabled";
    };
    
    &usb_serdes_mux {
    	idle-states = <1>, <0>; /* USB0 to SERDES3, USB1 to SERDES1 */
    };
    
    &serdes_ln_ctrl {
    	idle-states = <SERDES0_LANE0_PCIE0_LANE0>, <SERDES0_LANE1_PCIE0_LANE1>,
    		      <SERDES1_LANE0_PCIE1_LANE0>, <SERDES1_LANE1_PCIE1_LANE1>,
    		      <SERDES2_LANE0_PCIE2_LANE0>, <SERDES2_LANE1_PCIE2_LANE1>,
    		      <SERDES3_LANE0_USB3_0_SWAP>, <SERDES3_LANE1_USB3_0>,
    		      <SERDES4_LANE0_EDP_LANE0>, <SERDES4_LANE1_EDP_LANE1>, <SERDES4_LANE2_EDP_LANE2>, <SERDES4_LANE3_EDP_LANE3>;
    };
    
    &serdes_wiz3 {
    	typec-dir-gpios = <&main_gpio1 3 GPIO_ACTIVE_LOW>;
    	typec-dir-debounce-ms = <700>;	/* TUSB321, tCCB_DEFAULT 133 ms */
    };
    
    &serdes3 {
    	serdes3_usb_link: link@0 {
    		reg = <0>;
    		cdns,num-lanes = <2>;
    		#phy-cells = <0>;
    		cdns,phy-type = <PHY_TYPE_USB3>;
    		resets = <&serdes_wiz3 1>, <&serdes_wiz3 2>;
    	};
    };
    
    &usbss0 {
            status = "disabled";
    	pinctrl-names = "default";
    	pinctrl-0 = <&main_usbss0_pins_default>;
    	ti,vbus-divider;
    };
    
    &usb0 {
            status = "disabled";
    	dr_mode = "otg";
    	maximum-speed = "super-speed";
    	phys = <&serdes3_usb_link>;
    	phy-names = "cdns3,usb3-phy";
    };
    
    &usbss1 {
            status = "disabled";
    	pinctrl-names = "default";
    	pinctrl-0 = <&main_usbss1_pins_default>;
    	ti,usb2-only;
    };
    
    &usb1 {
            status = "disabled";
    	dr_mode = "host";
    	maximum-speed = "high-speed";
    };
    
    /* uart2 assigned to cpsw9g eth-switch fw running on remote CPU core */
    &main_uart2 {
    	status = "disabled";
    };
    
    /*&mcu_mcan0 {
    	status = "disabled";
    	pinctrl-names = "default";
    	pinctrl-0 = <&mcu_mcan0_pins_default &mcu_mcan0_gpio_pins_default>;
    	stb-gpios = <&wkup_gpio0 54 GPIO_ACTIVE_HIGH>;
    	en-gpios = <&wkup_gpio0 0 GPIO_ACTIVE_HIGH>;
    	can-transceiver {
    		max-bitrate = <5000000>;
    	};
    };
    
    &mcu_mcan1 {
    	status = "disabled";
    	pinctrl-names = "default";
    	pinctrl-0 = <&mcu_mcan1_pins_default &mcu_mcan1_gpio_pins_default>;
    	stb-gpios = <&wkup_gpio0 2 GPIO_ACTIVE_LOW>;
    	can-transceiver {
    		max-bitrate = <5000000>;
    	};
    };
    */
    &main_mcan0 {
    	status = "okay";
    	pinctrl-names = "default";
    	pinctrl-0 = <&main_mcan0_pins_default>;
    	can-transceiver {
    		max-bitrate = <5000000>;
    	};
    };
    
    &main_mcan1 {
    	status = "okay";
    	pinctrl-names = "default";
    	pinctrl-0 = <&main_mcan1_pins_default>;
    	can-transceiver {
    		max-bitrate = <5000000>;
    	};
    };
    
    &main_mcan2 {
    	status = "okay";
    	pinctrl-names = "default";
    	pinctrl-0 = <&main_mcan2_pins_default>;
    	can-transceiver {
    		max-bitrate = <5000000>;
    	};
    };
    
    &main_mcan3 {
    	status = "disabled";
    };
    
    &main_mcan4 {
    	status = "disabled";
    };
    
    &main_mcan5 {
    	status = "disabled";
    };
    
    &main_mcan6 {
    	status = "disabled";
    };
    
    &main_mcan7 {
    	status = "disabled";
    };
    
    &main_mcan8 {
    	status = "disabled";
    };
    
    &main_mcan9 {
    	status = "disabled";
    };
    
    &main_mcan10 {
    	status = "disabled";
    };
    
    &main_mcan11 {
    	status = "disabled";
    };
    
    &main_mcan12 {
    	status = "disabled";
    };
    
    &main_mcan13 {
    	status = "disabled";
    };
    
    &csi2_0 {
    	csi2rx0_in_sensor: endpoint {
    	//	remote-endpoint = <&csi2_cam0>;
    		bus-type = <4>; /* CSI2 DPHY. */
    		clock-lanes = <0>;
    		data-lanes = <1 2>;
    	};
    };
    &main_i2c0 {
    	status = "disabled";
    };
    &main_i2c6 {
    	status = "disabled";
    };
    
    &serdes_wiz4 {
    	status = "disabled";
    };
    
    &mhdp {
    	status = "disabled";
    };
    
    &dss {
    	status = "disabled";
    };
    
    &main_i2c1 {
    	status = "disabled";
    };
    
    &ti_csi2rx0 {
    	status = "disabled";
    };
    
    &d5520 {
           status = "disabled";
    };
    
    &vxe384 {
           status = "disabled";
    };
    

    // SPDX-License-Identifier: GPL-2.0
    /*
     * Device Tree Source for J721E SoC Family MCU/WAKEUP Domain peripherals
     *
     * Copyright (C) 2016-2019 Texas Instruments Incorporated - http://www.ti.com/
     */
    
    &cbass_mcu_wakeup {
    	dmsc: dmsc@44083000 {
    		compatible = "ti,k2g-sci";
    		ti,host-id = <12>;
    
    		mbox-names = "rx", "tx";
    
    		mboxes= <&secure_proxy_main 11>,
    			<&secure_proxy_main 13>;
    
    		reg-names = "debug_messages";
    		reg = <0x00 0x44083000 0x0 0x1000>;
    
    		k3_pds: power-controller {
    			compatible = "ti,sci-pm-domain";
    			#power-domain-cells = <2>;
    		};
    
    		k3_clks: clocks {
    			compatible = "ti,k2g-sci-clk";
    			#clock-cells = <2>;
    		};
    
    		k3_reset: reset-controller {
    			compatible = "ti,sci-reset";
    			#reset-cells = <2>;
    		};
    	};
    
    	mcu_conf: scm_conf@40f00000 {
    		compatible = "syscon", "simple-mfd";
    		reg = <0x0 0x40f00000 0x0 0x20000>;
    		#address-cells = <1>;
    		#size-cells = <1>;
    		ranges = <0x0 0x0 0x40f00000 0x20000>;
    
    		phy_gmii_sel: phy@4040 {
    			compatible = "ti,am654-phy-gmii-sel";
    			reg = <0x4040 0x4>;
    			#phy-cells = <1>;
    		};
    	};
    
    	chipid@43000014 {
    		compatible = "ti,am654-chipid";
    		reg = <0x0 0x43000014 0x0 0x4>;
    	};
    
    	wkup_pmx0: pinmux@4301c000 {
    		compatible = "pinctrl-single";
    		/* Proxy 0 addressing */
    		reg = <0x00 0x4301c000 0x00 0x178>;
    		#pinctrl-cells = <1>;
    		pinctrl-single,register-width = <32>;
    		pinctrl-single,function-mask = <0xffffffff>;
    	};
    
    	mcu_ram: sram@41c00000 {
    		compatible = "mmio-sram";
    		reg = <0x00 0x41c00000 0x00 0x100000>;
    		ranges = <0x0 0x00 0x41c00000 0x100000>;
    		#address-cells = <1>;
    		#size-cells = <1>;
    	};
    
    	wkup_uart0: serial@42300000 {
    	    status = "disabled";
    		compatible = "ti,j721e-uart", "ti,am654-uart";
    		reg = <0x00 0x42300000 0x00 0x100>;
    		reg-shift = <2>;
    		reg-io-width = <4>;
    		interrupts = <GIC_SPI 897 IRQ_TYPE_LEVEL_HIGH>;
    		clock-frequency = <48000000>;
    		current-speed = <115200>;
    		power-domains = <&k3_pds 287 TI_SCI_PD_EXCLUSIVE>;
    		clocks = <&k3_clks 287 0>;
    		clock-names = "fclk";
    	};
    
    	mcu_uart0: serial@40a00000 {
    	    status = "disabled";
    		compatible = "ti,j721e-uart", "ti,am654-uart";
    		reg = <0x00 0x40a00000 0x00 0x100>;
    		reg-shift = <2>;
    		reg-io-width = <4>;
    		interrupts = <GIC_SPI 846 IRQ_TYPE_LEVEL_HIGH>;
    		clock-frequency = <96000000>;
    		current-speed = <115200>;
    		power-domains = <&k3_pds 149 TI_SCI_PD_EXCLUSIVE>;
    		clocks = <&k3_clks 149 0>;
    		clock-names = "fclk";
    	};
    
    	wkup_gpio_intr: interrupt-controller2 {
    		compatible = "ti,sci-intr";
    		ti,intr-trigger-type = <1>;
    		interrupt-controller;
    		interrupt-parent = <&gic500>;
    		#interrupt-cells = <1>;
    		ti,sci = <&dmsc>;
    		ti,sci-dev-id = <137>;
    		ti,interrupt-ranges = <16 960 16>;
    	};
    
    	wkup_gpio0: gpio@42110000 {
    		compatible = "ti,j721e-gpio", "ti,keystone-gpio";
    		reg = <0x0 0x42110000 0x0 0x100>;
    		gpio-controller;
    		#gpio-cells = <2>;
    		interrupt-parent = <&wkup_gpio_intr>;
    		interrupts = <103>, <104>, <105>, <106>, <107>, <108>;
    		interrupt-controller;
    		#interrupt-cells = <2>;
    		ti,ngpio = <84>;
    		ti,davinci-gpio-unbanked = <0>;
    		power-domains = <&k3_pds 113 TI_SCI_PD_EXCLUSIVE>;
    		clocks = <&k3_clks 113 0>;
    		clock-names = "gpio";
    	};
    
    	wkup_gpio1: gpio@42100000 {
    		compatible = "ti,j721e-gpio", "ti,keystone-gpio";
    		reg = <0x0 0x42100000 0x0 0x100>;
    		gpio-controller;
    		#gpio-cells = <2>;
    		interrupt-parent = <&wkup_gpio_intr>;
    		interrupts = <112>, <113>, <114>, <115>, <116>, <117>;
    		interrupt-controller;
    		#interrupt-cells = <2>;
    		ti,ngpio = <84>;
    		ti,davinci-gpio-unbanked = <0>;
    		power-domains = <&k3_pds 114 TI_SCI_PD_EXCLUSIVE>;
    		clocks = <&k3_clks 114 0>;
    		clock-names = "gpio";
    	};
    
    	mcu_i2c0: i2c@40b00000 {
    		status = "disabled";
    		compatible = "ti,j721e-i2c", "ti,omap4-i2c";
    		reg = <0x0 0x40b00000 0x0 0x100>;
    		interrupts = <GIC_SPI 852 IRQ_TYPE_LEVEL_HIGH>;
    		#address-cells = <1>;
    		#size-cells = <0>;
    		clock-names = "fck";
    		clocks = <&k3_clks 194 0>;
    		power-domains = <&k3_pds 194 TI_SCI_PD_EXCLUSIVE>;
    	};
    
    	fss: fss@47000000 {
    		compatible = "simple-bus";
    		reg = <0x0 0x47000000 0x0 0x100>;
    		#address-cells = <2>;
    		#size-cells = <2>;
    		ranges;
    
    		ospi0: spi@47040000 {
    		    status = "disabled";
    			compatible = "ti,am654-ospi";
    			reg = <0x0 0x47040000 0x0 0x100>,
    				<0x5 0x00000000 0x1 0x0000000>;
    			interrupts = <GIC_SPI 840 IRQ_TYPE_LEVEL_HIGH>;
    			cdns,fifo-depth = <256>;
    			cdns,fifo-width = <4>;
    			cdns,trigger-address = <0x0>;
    			clocks = <&k3_clks 103 0>;
    			assigned-clocks = <&k3_clks 103 0>;
    			assigned-clock-parents = <&k3_clks 103 2>;
    			assigned-clock-rates = <166666666>;
    			power-domains = <&k3_pds 103 TI_SCI_PD_EXCLUSIVE>;
    			#address-cells = <1>;
    			#size-cells = <0>;
    		};
    
    		ospi1: spi@47050000 {
    		    status = "disabled";
    			compatible = "ti,am654-ospi";
    			reg = <0x0 0x47050000 0x0 0x100>,
    				<0x7 0x00000000 0x1 0x00000000>;
    			interrupts = <GIC_SPI 841 IRQ_TYPE_LEVEL_HIGH>;
    			cdns,fifo-depth = <256>;
    			cdns,fifo-width = <4>;
    			cdns,trigger-address = <0x0>;
    			clocks = <&k3_clks 104 0>;
    			power-domains = <&k3_pds 104 TI_SCI_PD_EXCLUSIVE>;
    			#address-cells = <1>;
    			#size-cells = <0>;
    		};
    	};
    
    	tscadc0: tscadc@40200000 {
    		status = "disabled";
    		compatible = "ti,am3359-tscadc";
    		reg = <0x0 0x40200000 0x0 0x1000>;
    		interrupts = <GIC_SPI 860 IRQ_TYPE_LEVEL_HIGH>;
    		power-domains = <&k3_pds 0 TI_SCI_PD_EXCLUSIVE>;
    		clocks = <&k3_clks 0 1>;
    		assigned-clocks = <&k3_clks 0 3>;
    		assigned-clock-rates = <60000000>;
    		clock-names = "adc_tsc_fck";
    
    		adc {
    			#io-channel-cells = <1>;
    			compatible = "ti,am3359-adc";
    		};
    	};
    
    	tscadc1: tscadc@40210000 {
    		status = "disabled";
    		compatible = "ti,am3359-tscadc";
    		reg = <0x0 0x40210000 0x0 0x1000>;
    		interrupts = <GIC_SPI 861 IRQ_TYPE_LEVEL_HIGH>;
    		power-domains = <&k3_pds 1 TI_SCI_PD_EXCLUSIVE>;
    		clocks = <&k3_clks 1 1>;
    		assigned-clocks = <&k3_clks 1 3>;
    		assigned-clock-rates = <60000000>;
    		clock-names = "adc_tsc_fck";
    
    		adc {
    			#io-channel-cells = <1>;
    			compatible = "ti,am3359-adc";
    		};
    	};
    
    	cbass_mcu_navss: navss@28380000 {
    		compatible = "simple-mfd";
    		#address-cells = <2>;
    		#size-cells = <2>;
    		ranges;
    		dma-coherent;
    		dma-ranges;
    
    		ti,sci-dev-id = <232>;
    
    		mcu_ringacc: ringacc@2b800000 {
    			compatible = "ti,am654-navss-ringacc";
    			reg =	<0x0 0x2b800000 0x0 0x400000>,
    				<0x0 0x2b000000 0x0 0x400000>,
    				<0x0 0x28590000 0x0 0x100>,
    				<0x0 0x2a500000 0x0 0x40000>;
    			reg-names = "rt", "fifos", "proxy_gcfg", "proxy_target";
    			ti,num-rings = <286>;
    			ti,sci-rm-range-gp-rings = <0x1>; /* GP ring range */
    			ti,sci = <&dmsc>;
    			ti,sci-dev-id = <235>;
    			msi-parent = <&main_udmass_inta>;
    		};
    
    		mcu_udmap: dma-controller@285c0000 {
    			compatible = "ti,j721e-navss-mcu-udmap";
    			reg =	<0x0 0x285c0000 0x0 0x100>,
    				<0x0 0x2a800000 0x0 0x40000>,
    				<0x0 0x2aa00000 0x0 0x40000>;
    			reg-names = "gcfg", "rchanrt", "tchanrt";
    			msi-parent = <&main_udmass_inta>;
    			#dma-cells = <1>;
    
    			ti,sci = <&dmsc>;
    			ti,sci-dev-id = <236>;
    			ti,ringacc = <&mcu_ringacc>;
    
    			ti,sci-rm-range-tchan = <0x0d>, /* TX_CHAN */
    						<0x0f>; /* TX_HCHAN */
    			ti,sci-rm-range-rchan = <0x0a>, /* RX_CHAN */
    						<0x0b>; /* RX_HCHAN */
    			ti,sci-rm-range-rflow = <0x00>; /* GP RFLOW */
    		};
    	};
    
    	mcu_cpsw: ethernet@46000000 {
    		compatible = "ti,j721e-cpsw-nuss";
    		#address-cells = <2>;
    		#size-cells = <2>;
    		reg = <0x0 0x46000000 0x0 0x200000>;
    		reg-names = "cpsw_nuss";
    		ranges = <0x0 0x0 0x0 0x46000000 0x0 0x200000>;
    		dma-coherent;
    		clocks = <&k3_clks 18 22>;
    		clock-names = "fck";
    		power-domains = <&k3_pds 18 TI_SCI_PD_EXCLUSIVE>;
    
    		dmas = <&mcu_udmap 0xf000>,
    		       <&mcu_udmap 0xf001>,
    		       <&mcu_udmap 0xf002>,
    		       <&mcu_udmap 0xf003>,
    		       <&mcu_udmap 0xf004>,
    		       <&mcu_udmap 0xf005>,
    		       <&mcu_udmap 0xf006>,
    		       <&mcu_udmap 0xf007>,
    		       <&mcu_udmap 0x7000>;
    		dma-names = "tx0", "tx1", "tx2", "tx3",
    			    "tx4", "tx5", "tx6", "tx7",
    			    "rx";
    
    		ethernet-ports {
    			#address-cells = <1>;
    			#size-cells = <0>;
    
    			cpsw_port1: port@1 {
    				reg = <1>;
    				ti,mac-only;
    				label = "port1";
    				ti,syscon-efuse = <&mcu_conf 0x200>;
    				phys = <&phy_gmii_sel 1>;
    			};
    		};
    
    		davinci_mdio: mdio@f00 {
    			compatible = "ti,cpsw-mdio","ti,davinci_mdio";
    			reg = <0x0 0xf00 0x0 0x100>;
    			#address-cells = <1>;
    			#size-cells = <0>;
    			clocks = <&k3_clks 18 22>;
    			clock-names = "fck";
    			bus_freq = <1000000>;
    		};
    
    		cpts@3d000 {
    			compatible = "ti,am65-cpts";
    			reg = <0x0 0x3d000 0x0 0x400>;
    			clocks = <&k3_clks 18 2>;
    			clock-names = "cpts";
    			interrupts-extended = <&gic500 GIC_SPI 858 IRQ_TYPE_LEVEL_HIGH>;
    			interrupt-names = "cpts";
    			ti,cpts-ext-ts-inputs = <4>;
    			ti,cpts-periodic-outputs = <2>;
    		};
    	};
    
    	mcu_r5fss0: r5fss@41000000 {
    		compatible = "ti,j721e-r5fss";
    		status = "disabled";
    		ti,cluster-mode = <1>;
    		#address-cells = <1>;
    		#size-cells = <1>;
    		ranges = <0x41000000 0x00 0x41000000 0x20000>,
    			 <0x41400000 0x00 0x41400000 0x20000>;
    		power-domains = <&k3_pds 249 TI_SCI_PD_EXCLUSIVE>;
    
    		mcu_r5fss0_core0: r5f@41000000 {
    		        status = "disabled";
    			compatible = "ti,j721e-r5f";
    			reg = <0x41000000 0x00008000>,
    			      <0x41010000 0x00008000>;
    			reg-names = "atcm", "btcm";
    			ti,sci = <&dmsc>;
    			ti,sci-dev-id = <250>;
    			ti,sci-proc-ids = <0x01 0xFF>;
    			resets = <&k3_reset 250 1>;
    			firmware-name = "j7-mcu-r5f0_0-fw";
    			ti,atcm-enable = <1>;
    			ti,btcm-enable = <1>;
    			ti,loczrama = <1>;
    		};
    
    		mcu_r5fss0_core1: r5f@41400000 {
    		        status = "disabled";
    			compatible = "ti,j721e-r5f";
    			reg = <0x41400000 0x00008000>,
    			      <0x41410000 0x00008000>;
    			reg-names = "atcm", "btcm";
    			ti,sci = <&dmsc>;
    			ti,sci-dev-id = <251>;
    			ti,sci-proc-ids = <0x02 0xFF>;
    			resets = <&k3_reset 251 1>;
    			firmware-name = "j7-mcu-r5f0_1-fw";
    			ti,atcm-enable = <1>;
    			ti,btcm-enable = <1>;
    			ti,loczrama = <1>;
    		};
    	};
    
    	/*mcu_mcan0: can@40528000 {
    		status = "disabled";
    		compatible = "bosch,m_can";
    		reg = <0x00 0x40528000 0x00 0x200>,
    		      <0x00 0x40500000 0x00 0x8000>;
    		reg-names = "m_can", "message_ram";
    		power-domains = <&k3_pds 172 TI_SCI_PD_EXCLUSIVE>;
    		clocks = <&k3_clks 172 1>, <&k3_clks 172 0>;
    		clock-names = "cclk", "hclk";
    		interrupts = <GIC_SPI 832 IRQ_TYPE_LEVEL_HIGH>,
    			     <GIC_SPI 833 IRQ_TYPE_LEVEL_HIGH>;
    		interrupt-names = "int0", "int1";
    		bosch,mram-cfg = <0x0 0 0 32 0 0 1 1>;
    	};
    
    	mcu_mcan1: can@40568000 {
    		status = "disabled";
    		compatible = "bosch,m_can";
    		reg = <0x00 0x40568000 0x00 0x200>,
    		      <0x00 0x40540000 0x00 0x8000>;
    		reg-names = "m_can", "message_ram";
    		power-domains = <&k3_pds 173 TI_SCI_PD_EXCLUSIVE>;
    		clocks = <&k3_clks 173 1>, <&k3_clks 173 0>;
    		clock-names = "cclk", "hclk";
    		interrupts = <GIC_SPI 835 IRQ_TYPE_LEVEL_HIGH>,
    			     <GIC_SPI 836 IRQ_TYPE_LEVEL_HIGH>;
    		interrupt-names = "int0", "int1";
    		bosch,mram-cfg = <0x0 0 0 32 0 0 1 1>;
    	};*/
    };
    

  • Hi Gaston,

    Few clarification from my side first,

    The current davinci mdio driver does not support c45 clause yet. You will have to modify the phy read/write function to be compatible with c45 phys.

    Can you cross check the tx and rx delays set in the phy. "ti,rx-internal-delay" is a ti specific property and would not work with broadcom phys. Can you cross check the bootstrapped delays. By default, Mac expects the Rx delay to be configured in phy and Tx delay in mac.

    Edit: Also, can you let me know how are you setting MAC loopback?

    Regards,
    Tanmay

  • The current davinci mdio driver does not support c45 clause yet. You will have to modify the phy read/write function to be compatible with c45 phys.

    relay : I have ported the latest davinci_mdio.c, mdio read and write has been normal with c45 phys

    Can you cross check the tx and rx delays set in the phy. "ti,rx-internal-delay" is a ti specific property and would not work with broadcom phys

    relay : the code does not analyze this parameter. After measuring the waveform, RMTXD is ok, but RMRXD has no waveform at all. Regarding the delay, I will communicate with bcm fae as soon as possible

    can you let me know how are you setting MAC loopback?

    Please see the picture below

  • The waveform is as follows
    txd


    rxd

  • Hi  Tanmay Patil:

    latest rx waveform

    rxd0:

    rxd1

  • Hi  Tanmay Patil:

    Now the RXD has a waveform compared to before, but the problem still exists, the board pings the PC, the PC can receive the packet, and the PC can reply the packet, but the MAC still has no RX, please provide some debugging methods or give a solution

    The port stat data can be seen in the register dump picture posted above

  • ethtool -S eth0

    root@j7-evm:~# ethtool -S eth0
    NIC statistics:
         p0_rx_good_frames: 331
         p0_rx_broadcast_frames: 297
         p0_rx_multicast_frames: 34
         p0_rx_crc_errors: 0
         p0_rx_oversized_frames: 0
         p0_rx_undersized_frames: 0
         p0_ale_drop: 0
         p0_ale_overrun_drop: 0
         p0_rx_octets: 23054
         p0_tx_good_frames: 0
         p0_tx_broadcast_frames: 0
         p0_tx_multicast_frames: 0
         p0_tx_octets: 0
         p0_tx_64B_frames: 299
         p0_tx_65_to_127B_frames: 23
         p0_tx_128_to_255B_frames: 9
         p0_tx_256_to_511B_frames: 0
         p0_tx_512_to_1023B_frames: 0
         p0_tx_1024B_frames: 0
         p0_net_octets: 23054
         p0_rx_bottom_fifo_drop: 0
         p0_rx_port_mask_drop: 0
         p0_rx_top_fifo_drop: 0
         p0_ale_rate_limit_drop: 0
         p0_ale_vid_ingress_drop: 0
         p0_ale_da_eq_sa_drop: 0
         p0_ale_block_drop: 0
         p0_ale_secure_drop: 0
         p0_ale_auth_drop: 0
         p0_ale_unknown_ucast: 0
         p0_ale_unknown_ucast_bytes: 0
         p0_ale_unknown_mcast: 0
         p0_ale_unknown_mcast_bytes: 0
         p0_ale_unknown_bcast: 0
         p0_ale_unknown_bcast_bytes: 0
         p0_ale_pol_match: 0
         p0_ale_pol_match_red: 0
         p0_ale_pol_match_yellow: 0
         p0_ale_mcast_sa_drop: 0
         p0_ale_dual_vlan_drop: 0
         p0_ale_len_err_drop: 0
         p0_ale_ip_next_hdr_drop: 0
         p0_ale_ipv4_frag_drop: 0
         p0_tx_mem_protect_err: 0
         p0_tx_pri0: 0
         p0_tx_pri1: 0
         p0_tx_pri2: 0
         p0_tx_pri3: 0
         p0_tx_pri4: 0
         p0_tx_pri5: 0
         p0_tx_pri6: 0
         p0_tx_pri7: 0
         p0_tx_pri0_bcnt: 0
         p0_tx_pri1_bcnt: 0
         p0_tx_pri2_bcnt: 0
         p0_tx_pri3_bcnt: 0
         p0_tx_pri4_bcnt: 0
         p0_tx_pri5_bcnt: 0
         p0_tx_pri6_bcnt: 0
         p0_tx_pri7_bcnt: 0
         p0_tx_pri0_drop: 0
         p0_tx_pri1_drop: 0
         p0_tx_pri2_drop: 0
         p0_tx_pri3_drop: 0
         p0_tx_pri4_drop: 0
         p0_tx_pri5_drop: 0
         p0_tx_pri6_drop: 0
         p0_tx_pri7_drop: 0
         p0_tx_pri0_drop_bcnt: 0
         p0_tx_pri1_drop_bcnt: 0
         p0_tx_pri2_drop_bcnt: 0
         p0_tx_pri3_drop_bcnt: 0
         p0_tx_pri4_drop_bcnt: 0
         p0_tx_pri5_drop_bcnt: 0
         p0_tx_pri6_drop_bcnt: 0
         p0_tx_pri7_drop_bcnt: 0
         rx_good_frames: 0
         rx_broadcast_frames: 0
         rx_multicast_frames: 0
         rx_pause_frames: 0
         rx_crc_errors: 0
         rx_align_code_errors: 0
         rx_oversized_frames: 0
         rx_jabber_frames: 0
         rx_undersized_frames: 0
         rx_fragments: 0
         ale_drop: 0
         ale_overrun_drop: 0
         rx_octets: 0
         tx_good_frames: 331
         tx_broadcast_frames: 297
         tx_multicast_frames: 34
         tx_pause_frames: 0
         tx_deferred_frames: 0
         tx_collision_frames: 0
         tx_single_coll_frames: 0
         tx_mult_coll_frames: 0
         tx_excessive_collisions: 0
         tx_late_collisions: 0
         rx_ipg_error: 0
         tx_carrier_sense_errors: 0
         tx_octets: 23054
         tx_64B_frames: 299
         tx_65_to_127B_frames: 23
         tx_128_to_255B_frames: 9
         tx_256_to_511B_frames: 0
         tx_512_to_1023B_frames: 0
         tx_1024B_frames: 0
         net_octets: 23054
         rx_bottom_fifo_drop: 0
         rx_port_mask_drop: 0
         rx_top_fifo_drop: 0
         ale_rate_limit_drop: 0
         ale_vid_ingress_drop: 0
         ale_da_eq_sa_drop: 0
         ale_block_drop: 0
         ale_secure_drop: 0
         ale_auth_drop: 0
         ale_unknown_ucast: 0
         ale_unknown_ucast_bytes: 0
         ale_unknown_mcast: 0
         ale_unknown_mcast_bytes: 0
         ale_unknown_bcast: 0
         ale_unknown_bcast_bytes: 0
         ale_pol_match: 0
         ale_pol_match_red: 0
         ale_pol_match_yellow: 0
         ale_mcast_sa_drop: 0
         ale_dual_vlan_drop: 0
         ale_len_err_drop: 0
         ale_ip_next_hdr_drop: 0
         ale_ipv4_frag_drop: 0
         iet_rx_assembly_err: 0
         iet_rx_assembly_ok: 0
         iet_rx_smd_err: 355
         iet_rx_frag: 0
         iet_tx_hold: 0
         iet_tx_frag: 0
         tx_mem_protect_err: 0
         tx_pri0: 331
         tx_pri1: 0
         tx_pri2: 0
         tx_pri3: 0
         tx_pri4: 0
         tx_pri5: 0
         tx_pri6: 0
         tx_pri7: 0
         tx_pri0_bcnt: 23054
         tx_pri1_bcnt: 0
         tx_pri2_bcnt: 0
         tx_pri3_bcnt: 0
         tx_pri4_bcnt: 0
         tx_pri5_bcnt: 0
         tx_pri6_bcnt: 0
         tx_pri7_bcnt: 0
         tx_pri0_drop: 0
         tx_pri1_drop: 0
         tx_pri2_drop: 0
         tx_pri3_drop: 0
         tx_pri4_drop: 0
         tx_pri5_drop: 0
         tx_pri6_drop: 0
         tx_pri7_drop: 0
         tx_pri0_drop_bcnt: 0
         tx_pri1_drop_bcnt: 0
         tx_pri2_drop_bcnt: 0
         tx_pri3_drop_bcnt: 0
         tx_pri4_drop_bcnt: 0
         tx_pri5_drop_bcnt: 0
         tx_pri6_drop_bcnt: 0
         tx_pri7_drop_bcnt: 0
    

  • Hi Tanmay Patil:

    Let me provide the schematic diagram of our hardware circuit design. It looks very strange. We use the RMII interface, but RGMII TD2/3 and RGMII RX2/3 are all connected to the phy chip 1588 function. Please evaluate this, the hardware Is there a big problem? If there is a problem, how should the pins of RGMII TD2/3 and RGMII RX2/3 be configured so that it will not be affected. There is no resistor connected in the middle of our hardware, and it is directly connected to the mac. Please rate this question
    There is still a huge problem, our RMII1_RX ER is not connected, this must affect the MAC rx, can this behavior be changed through the configuration register to make the RX work normally?

     

  • Hi Gaston,

    The MAC does not have any receive traffic. Not even crc error frames. So the issue would be most likely in phy. What were the changes for RxD to get the waveform?

    The phy will also have some minimal stat register.  Can you check them see if the rx stat show any errors?

    I have looped in the hardware expert for the hardware issue.

    Regards,
    Tanmay

  • We found the problem, there is a problem with the connection。This can be closed, thanks tony, and thanks to Tanmay Patil。