summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2022-11-27 18:25:34 +0300
committerTom Rini <trini@konsulko.com>2022-12-08 00:04:17 +0300
commit2098a3b8fe1d228c445d64d9408ea14fafdc4091 (patch)
treec9c284943b45272199e8b65cf6ef30a2859f7573 /drivers
parentb8daa6e9ee079fea7f9772e40b56147274c5726b (diff)
downloadu-boot-2098a3b8fe1d228c445d64d9408ea14fafdc4091.tar.xz
usb: gadget: Remove non-DM_ETH code
As DM_ETH is required for all network drivers, it's now safe to remove the non-DM_ETH support code. Signed-off-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/gadget/ether.c97
-rw-r--r--drivers/usb/gadget/rndis.c9
-rw-r--r--drivers/usb/gadget/rndis.h11
3 files changed, 0 insertions, 117 deletions
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
index 43aec7ffa7..85c971e4c4 100644
--- a/drivers/usb/gadget/ether.c
+++ b/drivers/usb/gadget/ether.c
@@ -109,11 +109,7 @@ struct eth_dev {
struct usb_request *tx_req, *rx_req;
-#ifndef CONFIG_DM_ETH
- struct eth_device *net;
-#else
struct udevice *net;
-#endif
struct net_device_stats stats;
unsigned int tx_qlen;
@@ -140,11 +136,7 @@ struct eth_dev {
/*-------------------------------------------------------------------------*/
struct ether_priv {
struct eth_dev ethdev;
-#ifndef CONFIG_DM_ETH
- struct eth_device netdev;
-#else
struct udevice *netdev;
-#endif
struct usb_gadget_driver eth_driver;
};
@@ -1827,22 +1819,14 @@ static void rndis_control_ack_complete(struct usb_ep *ep,
static char rndis_resp_buf[8] __attribute__((aligned(sizeof(__le32))));
-#ifndef CONFIG_DM_ETH
-static int rndis_control_ack(struct eth_device *net)
-#else
static int rndis_control_ack(struct udevice *net)
-#endif
{
struct ether_priv *priv;
struct eth_dev *dev;
int length;
struct usb_request *resp;
-#ifndef CONFIG_DM_ETH
- priv = (struct ether_priv *)net->priv;
-#else
priv = dev_get_priv(net);
-#endif
dev = &priv->ethdev;
resp = dev->stat_req;
@@ -1989,9 +1973,7 @@ static int eth_bind(struct usb_gadget *gadget)
int status = -ENOMEM;
int gcnum;
u8 tmp[7];
-#ifdef CONFIG_DM_ETH
struct eth_pdata *pdata = dev_get_plat(l_priv->netdev);
-#endif
/* these flags are only ever cleared; compiler take note */
#ifndef CONFIG_USB_ETH_CDC
@@ -2168,11 +2150,7 @@ autoconf_fail:
/* network device setup */
-#ifndef CONFIG_DM_ETH
- dev->net = &l_priv->netdev;
-#else
dev->net = l_priv->netdev;
-#endif
dev->cdc = cdc;
dev->zlp = zlp;
@@ -2189,13 +2167,8 @@ autoconf_fail:
* host side code for the SAFE thing cares -- its original BLAN
* thing didn't, Sharp never assigned those addresses on Zaurii.
*/
-#ifndef CONFIG_DM_ETH
- get_ether_addr(dev_addr, dev->net->enetaddr);
- memcpy(tmp, dev->net->enetaddr, sizeof(dev->net->enetaddr));
-#else
get_ether_addr(dev_addr, pdata->enetaddr);
memcpy(tmp, pdata->enetaddr, sizeof(pdata->enetaddr));
-#endif
get_ether_addr(host_addr, dev->host_mac);
@@ -2256,11 +2229,7 @@ autoconf_fail:
status_ep ? " STATUS " : "",
status_ep ? status_ep->name : ""
);
-#ifndef CONFIG_DM_ETH
- printf("MAC %pM\n", dev->net->enetaddr);
-#else
printf("MAC %pM\n", pdata->enetaddr);
-#endif
if (cdc || rndis)
printf("HOST MAC %02x:%02x:%02x:%02x:%02x:%02x\n",
@@ -2490,71 +2459,6 @@ static void _usb_eth_halt(struct ether_priv *priv)
usb_gadget_release(0);
}
-#ifndef CONFIG_DM_ETH
-static int usb_eth_init(struct eth_device *netdev, struct bd_info *bd)
-{
- struct ether_priv *priv = (struct ether_priv *)netdev->priv;
-
- return _usb_eth_init(priv);
-}
-
-static int usb_eth_send(struct eth_device *netdev, void *packet, int length)
-{
- struct ether_priv *priv = (struct ether_priv *)netdev->priv;
-
- return _usb_eth_send(priv, packet, length);
-}
-
-static int usb_eth_recv(struct eth_device *netdev)
-{
- struct ether_priv *priv = (struct ether_priv *)netdev->priv;
- struct eth_dev *dev = &priv->ethdev;
- int ret;
-
- ret = _usb_eth_recv(priv);
- if (ret) {
- pr_err("error packet receive\n");
- return ret;
- }
-
- if (!packet_received)
- return 0;
-
- if (dev->rx_req) {
- net_process_received_packet(net_rx_packets[0],
- dev->rx_req->length);
- } else {
- pr_err("dev->rx_req invalid");
- }
- packet_received = 0;
- rx_submit(dev, dev->rx_req, 0);
-
- return 0;
-}
-
-void usb_eth_halt(struct eth_device *netdev)
-{
- struct ether_priv *priv = (struct ether_priv *)netdev->priv;
-
- _usb_eth_halt(priv);
-}
-
-int usb_eth_initialize(struct bd_info *bi)
-{
- struct eth_device *netdev = &l_priv->netdev;
-
- strlcpy(netdev->name, USB_NET_NAME, sizeof(netdev->name));
-
- netdev->init = usb_eth_init;
- netdev->send = usb_eth_send;
- netdev->recv = usb_eth_recv;
- netdev->halt = usb_eth_halt;
- netdev->priv = l_priv;
-
- eth_register(netdev);
- return 0;
-}
-#else
static int usb_eth_start(struct udevice *dev)
{
struct ether_priv *priv = dev_get_priv(dev);
@@ -2663,4 +2567,3 @@ U_BOOT_DRIVER(eth_usb) = {
.plat_auto = sizeof(struct eth_pdata),
.flags = DM_FLAG_ALLOC_PRIV_DMA,
};
-#endif /* CONFIG_DM_ETH */
diff --git a/drivers/usb/gadget/rndis.c b/drivers/usb/gadget/rndis.c
index 13c327ea38..d2a51829f9 100644
--- a/drivers/usb/gadget/rndis.c
+++ b/drivers/usb/gadget/rndis.c
@@ -1115,11 +1115,7 @@ int rndis_msg_parser(u8 configNr, u8 *buf)
return -ENOTSUPP;
}
-#ifndef CONFIG_DM_ETH
-int rndis_register(int (*rndis_control_ack)(struct eth_device *))
-#else
int rndis_register(int (*rndis_control_ack)(struct udevice *))
-#endif
{
u8 i;
@@ -1147,13 +1143,8 @@ void rndis_deregister(int configNr)
return;
}
-#ifndef CONFIG_DM_ETH
-int rndis_set_param_dev(u8 configNr, struct eth_device *dev, int mtu,
- struct net_device_stats *stats, u16 *cdc_filter)
-#else
int rndis_set_param_dev(u8 configNr, struct udevice *dev, int mtu,
struct net_device_stats *stats, u16 *cdc_filter)
-#endif
{
debug("%s: configNr = %d\n", __func__, configNr);
if (!dev || !stats)
diff --git a/drivers/usb/gadget/rndis.h b/drivers/usb/gadget/rndis.h
index e827af0be4..77db55a563 100644
--- a/drivers/usb/gadget/rndis.h
+++ b/drivers/usb/gadget/rndis.h
@@ -226,13 +226,8 @@ typedef struct rndis_params {
u32 vendorID;
const char *vendorDescr;
-#ifndef CONFIG_DM_ETH
- struct eth_device *dev;
- int (*ack)(struct eth_device *);
-#else
struct udevice *dev;
int (*ack)(struct udevice *);
-#endif
struct list_head resp_queue;
} rndis_params;
@@ -240,15 +235,9 @@ typedef struct rndis_params {
int rndis_msg_parser(u8 configNr, u8 *buf);
enum rndis_state rndis_get_state(int configNr);
void rndis_deregister(int configNr);
-#ifndef CONFIG_DM_ETH
-int rndis_register(int (*rndis_control_ack)(struct eth_device *));
-int rndis_set_param_dev(u8 configNr, struct eth_device *dev, int mtu,
- struct net_device_stats *stats, u16 *cdc_filter);
-#else
int rndis_register(int (*rndis_control_ack)(struct udevice *));
int rndis_set_param_dev(u8 configNr, struct udevice *dev, int mtu,
struct net_device_stats *stats, u16 *cdc_filter);
-#endif
int rndis_set_param_vendor(u8 configNr, u32 vendorID,
const char *vendorDescr);
int rndis_set_param_medium(u8 configNr, u32 medium, u32 speed);