blob: 3721033c31000c05a84ff23d3dedc1512433e0cd [file] [log] [blame]
Jerome Forissier537d96a2024-10-16 11:56:24 +02001// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (c) 2015 National Instruments
4 *
5 * (C) Copyright 2015
6 * Joe Hershberger <joe.hershberger@ni.com>
7 */
8
9#include <dm.h>
10#include <log.h>
11#include <malloc.h>
12#include <net.h>
13#include <asm/eth.h>
14#include <asm/global_data.h>
15#include <asm/test.h>
16
17DECLARE_GLOBAL_DATA_PTR;
18
19static int sb_lwip_eth_start(struct udevice *dev)
20{
21 debug("eth_sandbox_lwip: Start\n");
22
23 return 0;
24}
25
26static int sb_lwip_eth_send(struct udevice *dev, void *packet, int length)
27{
28 debug("eth_sandbox_lwip: Send packet %d\n", length);
29
30 return -ENOTSUPP;
31}
32
33static int sb_lwip_eth_recv(struct udevice *dev, int flags, uchar **packetp)
34{
35 return -EAGAIN;
36}
37
38static int sb_lwip_eth_free_pkt(struct udevice *dev, uchar *packet, int length)
39{
40 return 0;
41}
42
43static void sb_lwip_eth_stop(struct udevice *dev)
44{
45}
46
47static int sb_lwip_eth_write_hwaddr(struct udevice *dev)
48{
49 return 0;
50}
51
52static const struct eth_ops sb_eth_ops = {
53 .start = sb_lwip_eth_start,
54 .send = sb_lwip_eth_send,
55 .recv = sb_lwip_eth_recv,
56 .free_pkt = sb_lwip_eth_free_pkt,
57 .stop = sb_lwip_eth_stop,
58 .write_hwaddr = sb_lwip_eth_write_hwaddr,
59};
60
61static int sb_lwip_eth_remove(struct udevice *dev)
62{
63 return 0;
64}
65
66static int sb_lwip_eth_of_to_plat(struct udevice *dev)
67{
68 return 0;
69}
70
71static const struct udevice_id sb_eth_ids[] = {
72 { .compatible = "sandbox,eth" },
73 { }
74};
75
76U_BOOT_DRIVER(eth_sandbox) = {
77 .name = "eth_lwip_sandbox",
78 .id = UCLASS_ETH,
79 .of_match = sb_eth_ids,
80 .of_to_plat = sb_lwip_eth_of_to_plat,
81 .remove = sb_lwip_eth_remove,
82 .ops = &sb_eth_ops,
83 .priv_auto = 0,
84 .plat_auto = sizeof(struct eth_pdata),
85};