2 * Copyright (c) 2015 National Instruments
5 * Joe Hershberger <joe.hershberger@ni.com>
7 * SPDX-License-Identifier: GPL-2.0
15 DECLARE_GLOBAL_DATA_PTR;
17 static int sb_eth_start(struct udevice *dev)
19 debug("eth_sandbox: Start\n");
24 static int sb_eth_send(struct udevice *dev, void *packet, int length)
26 debug("eth_sandbox: Send packet %d\n", length);
31 static int sb_eth_recv(struct udevice *dev, uchar **packetp)
36 static void sb_eth_stop(struct udevice *dev)
38 debug("eth_sandbox: Stop\n");
41 static int sb_eth_write_hwaddr(struct udevice *dev)
43 struct eth_pdata *pdata = dev_get_platdata(dev);
45 debug("eth_sandbox %s: Write HW ADDR - %pM\n", dev->name,
50 static const struct eth_ops sb_eth_ops = {
51 .start = sb_eth_start,
55 .write_hwaddr = sb_eth_write_hwaddr,
58 static int sb_eth_remove(struct udevice *dev)
63 static int sb_eth_ofdata_to_platdata(struct udevice *dev)
65 struct eth_pdata *pdata = dev_get_platdata(dev);
67 pdata->iobase = dev_get_addr(dev);
71 static const struct udevice_id sb_eth_ids[] = {
72 { .compatible = "sandbox,eth" },
76 U_BOOT_DRIVER(eth_sandbox) = {
77 .name = "eth_sandbox",
79 .of_match = sb_eth_ids,
80 .ofdata_to_platdata = sb_eth_ofdata_to_platdata,
81 .remove = sb_eth_remove,
83 .platdata_auto_alloc_size = sizeof(struct eth_pdata),