[U-Boot] [PATCH v2 12/13] drivers: net: add Microchip PIC32 ethernet controller driver.

Purna Chandra Mandal
2016-01-07T05:14:45Z

On 01/07/2016 12:11 AM, Joe Hershberger wrote:

> [...]
> +static int pic32_eth_probe(struct udevice *dev)
> +{
> + struct eth_pdata *pdata = dev_get_platdata(dev);
> + struct pic32eth_device *priv = dev_get_priv(dev);
> + void __iomem *iobase;
> + int phy_addr = 0;
> +
> +#if defined(CONFIG_PHY_ADDR)
> + phy_addr = CONFIG_PHY_ADDR;
>>> Doesn't this usually come from the device tree these days?
>> Yes, device-tree option is more meaningful. Could you please point me some reference for this?
> Eg:
> drivers/net/zynq_gem.c:682: priv->phyaddr =
> fdtdec_get_int(gd->fdt_blob, offset, "reg", -1);

Thanks. Will incorporate phy_addr into device-tree.

>>>> +#endif
>>>> + iobase = pic32_ioremap((ulong)pdata->iobase);
>>>> +
>>>> + /* initialize */
>>>> + priv->phy_addr = phy_addr;
>>>> + priv->phyif = pdata->phy_interface;
>>>> + priv->ectl_regs = (struct pic32_ectl_regs *)(iobase);
>>>> + priv->emac_regs = (struct pic32_emac_regs *)(iobase + PIC32_EMAC1CFG1);
>>>> +
>>>> + gpio_request_by_name_nodev(gd->fdt_blob, dev->of_offset,
>>>> + "reset-gpios", 0,
>>>> + &priv->rst_gpio, GPIOD_IS_OUT);
>>>> + _mdio_init(priv);
>>>> +
>>>> + return _phy_init(priv, dev);
>>>> +}
>>>> …