#endif
-#ifdef CONFIG_DM_ETH
-
static int ethoc_write_hwaddr(struct udevice *dev)
{
struct ethoc_eth_pdata *pdata = dev_get_plat(dev);
.priv_auto = sizeof(struct ethoc),
.plat_auto = sizeof(struct ethoc_eth_pdata),
};
-
-#else
-
-static int ethoc_init(struct eth_device *dev, struct bd_info *bd)
-{
- struct ethoc *priv = (struct ethoc *)dev->priv;
-
- return ethoc_init_common(priv);
-}
-
-static int ethoc_write_hwaddr(struct eth_device *dev)
-{
- struct ethoc *priv = (struct ethoc *)dev->priv;
- u8 *mac = dev->enetaddr;
-
- return ethoc_write_hwaddr_common(priv, mac);
-}
-
-static int ethoc_send(struct eth_device *dev, void *packet, int length)
-{
- return ethoc_send_common(dev->priv, packet, length);
-}
-
-static void ethoc_halt(struct eth_device *dev)
-{
- ethoc_disable_rx_and_tx(dev->priv);
-}
-
-static int ethoc_recv(struct eth_device *dev)
-{
- struct ethoc *priv = (struct ethoc *)dev->priv;
- int count;
-
- if (!ethoc_is_new_packet_received(priv))
- return 0;
-
- for (count = 0; count < PKTBUFSRX; ++count) {
- uchar *packetp;
- int size = ethoc_rx_common(priv, &packetp);
-
- if (size < 0)
- break;
- if (size > 0)
- net_process_received_packet(packetp, size);
- ethoc_free_pkt_common(priv);
- }
- return 0;
-}
-
-int ethoc_initialize(u8 dev_num, int base_addr)
-{
- struct ethoc *priv;
- struct eth_device *dev;
-
- priv = malloc(sizeof(*priv));
- if (!priv)
- return 0;
- dev = malloc(sizeof(*dev));
- if (!dev) {
- free(priv);
- return 0;
- }
-
- memset(dev, 0, sizeof(*dev));
- dev->priv = priv;
- dev->iobase = base_addr;
- dev->init = ethoc_init;
- dev->halt = ethoc_halt;
- dev->send = ethoc_send;
- dev->recv = ethoc_recv;
- dev->write_hwaddr = ethoc_write_hwaddr;
- sprintf(dev->name, "%s-%hu", "ETHOC", dev_num);
- priv->iobase = ioremap(dev->iobase, ETHOC_IOSIZE);
-
- eth_register(dev);
-
- ethoc_mdio_init(dev->name, priv);
- ethoc_phy_init(priv, dev);
-
- return 1;
-}
-
-#endif