+ _macb_eth_initialize(macb);
+
+ eth_register(netdev);
+
+#if defined(CONFIG_CMD_MII) || defined(CONFIG_PHYLIB)
+ int retval;
+ struct mii_dev *mdiodev = mdio_alloc();
+ if (!mdiodev)
+ return -ENOMEM;
+ strncpy(mdiodev->name, netdev->name, MDIO_NAME_LEN);
+ mdiodev->read = macb_miiphy_read;
+ mdiodev->write = macb_miiphy_write;
+
+ retval = mdio_register(mdiodev);
+ if (retval < 0)
+ return retval;
+ macb->bus = miiphy_get_dev_by_name(netdev->name);
+#endif
+ return 0;
+}
+#endif /* !CONFIG_DM_ETH */
+
+#ifdef CONFIG_DM_ETH
+
+static int macb_start(struct udevice *dev)
+{
+ return _macb_init(dev, dev->name);
+}
+
+static int macb_send(struct udevice *dev, void *packet, int length)
+{
+ struct macb_device *macb = dev_get_priv(dev);
+
+ return _macb_send(macb, dev->name, packet, length);
+}
+
+static int macb_recv(struct udevice *dev, int flags, uchar **packetp)
+{
+ struct macb_device *macb = dev_get_priv(dev);
+
+ macb->next_rx_tail = macb->rx_tail;
+ macb->wrapped = false;
+
+ return _macb_recv(macb, packetp);
+}
+
+static int macb_free_pkt(struct udevice *dev, uchar *packet, int length)
+{
+ struct macb_device *macb = dev_get_priv(dev);
+
+ reclaim_rx_buffers(macb, macb->next_rx_tail);
+
+ return 0;
+}
+
+static void macb_stop(struct udevice *dev)
+{
+ struct macb_device *macb = dev_get_priv(dev);
+
+ _macb_halt(macb);
+}
+
+static int macb_write_hwaddr(struct udevice *dev)
+{
+ struct eth_pdata *plat = dev_get_platdata(dev);
+ struct macb_device *macb = dev_get_priv(dev);
+
+ return _macb_write_hwaddr(macb, plat->enetaddr);
+}
+
+static const struct eth_ops macb_eth_ops = {
+ .start = macb_start,
+ .send = macb_send,
+ .recv = macb_recv,
+ .stop = macb_stop,
+ .free_pkt = macb_free_pkt,
+ .write_hwaddr = macb_write_hwaddr,
+};
+
+#ifdef CONFIG_CLK
+static int macb_enable_clk(struct udevice *dev)
+{
+ struct macb_device *macb = dev_get_priv(dev);
+ struct clk clk;
+ ulong clk_rate;
+ int ret;
+
+ ret = clk_get_by_index(dev, 0, &clk);
+ if (ret)
+ return -EINVAL;
+