From patchwork Sun Nov 27 15:25:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Rini X-Patchwork-Id: 1709412 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=konsulko.com header.i=@konsulko.com header.a=rsa-sha256 header.s=google header.b=Vo7lVCuU; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NKsz404CZz23nJ for ; Mon, 28 Nov 2022 02:32:00 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9995B8527A; Sun, 27 Nov 2022 16:27:23 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=konsulko.com header.i=@konsulko.com header.b="Vo7lVCuU"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 51C698516C; Sun, 27 Nov 2022 16:26:22 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [IPv6:2a00:1450:4864:20::636]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 944D984EC2 for ; Sun, 27 Nov 2022 16:26:17 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-ej1-x636.google.com with SMTP id bj12so20266521ejb.13 for ; Sun, 27 Nov 2022 07:26:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=YZ/AVJd4LPx8l+rjeMjX+ZZbLa1z/r/Ihk2ytuRXvkg=; b=Vo7lVCuUWEmuhgKTFh1jsQy+57C9QhiHQWAlhoOAncD5TPLTB4oyilOrs5ndYZuVZh bqZqDGw2215vJPCus9vlvJ35+zZRqT36owwsWSR7/SDwpGWx2D+VbUUWQSaYzs6ZlWdY IciOzfiDwLo13aJlu8MICXPgr+mArSbyHvf2I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YZ/AVJd4LPx8l+rjeMjX+ZZbLa1z/r/Ihk2ytuRXvkg=; b=77klYPa4/XFhqYT79fwQbc+N/Z00gQJ2HY+pJnRHE8Vu2Jgwv/WXdHKLmZmZ1JXm5i h4S0xcMNj49TPywHWiYObYhoSpcHK3SuqIBOCthrPQQX5+8ot2NlDgJxvaDOb7qIlQ2g ps1tA1vmY5iq6fmt6v8anutVZsmwOc1rn8q7mN2lVWmULAm8YrMg7a5kVXbVgCtxvMjW 0oDWUu0pE/0LD2l6oePIKPMnYk3keKo2iINhU/Ok2bTEX6FvTbB2LYWsWq4ZDAh8JPTF AiXYM+ltek2tZM7ywYC81PfRfevd/v1Bln37gObM/SluOZWrVF28zz0PxHh9TBmHI7MW cZvg== X-Gm-Message-State: ANoB5pkNhXYIwh9yGqmZhhHtF0Inhk/FfR7P30SW2qBRqRKEXKMlrSsP ObWvqoZTO1oXRO27eiPcwVIKsdNHf3V0uA== X-Google-Smtp-Source: AA0mqf5PGZo6rxsg3icL9jDmnkrrhk7l0ikfLfNPFatA9RfgaBip9hoJf/O6hOJmIkEECiFVMJ3iFg== X-Received: by 2002:a17:906:c052:b0:79a:101a:7e57 with SMTP id bm18-20020a170906c05200b0079a101a7e57mr39817641ejb.368.1669562776813; Sun, 27 Nov 2022 07:26:16 -0800 (PST) Received: from bill-the-cat.lan (2603-6081-7b00-6400-dc2c-1c0a-ea3e-04dc.res6.spectrum.com. [2603:6081:7b00:6400:dc2c:1c0a:ea3e:4dc]) by smtp.gmail.com with ESMTPSA id tb6-20020a1709078b8600b007b47749838asm3853036ejc.45.2022.11.27.07.26.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Nov 2022 07:26:16 -0800 (PST) From: Tom Rini To: u-boot@lists.denx.de Subject: [PATCH 35/41] usb: eth: msc7830: Remove non-DM_ETH code Date: Sun, 27 Nov 2022 10:25:30 -0500 Message-Id: <20221127152536.1556469-35-trini@konsulko.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221127152536.1556469-1-trini@konsulko.com> References: <20221119234545.404563-38-trini@konsulko.com> <20221127152536.1556469-1-trini@konsulko.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean 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 --- drivers/usb/eth/mcs7830.c | 276 -------------------------------------- 1 file changed, 276 deletions(-) diff --git a/drivers/usb/eth/mcs7830.c b/drivers/usb/eth/mcs7830.c index 783ab62f6b7a..8a256b3e3469 100644 --- a/drivers/usb/eth/mcs7830.c +++ b/drivers/usb/eth/mcs7830.c @@ -86,10 +86,8 @@ struct mcs7830_regs { * @mchash: shadow for the network adapter's multicast hash registers */ struct mcs7830_private { -#ifdef CONFIG_DM_ETH uint8_t rx_buf[MCS7830_RX_URB_SIZE]; struct ueth_data ueth; -#endif uint8_t config; uint8_t mchash[8]; }; @@ -575,279 +573,6 @@ static int mcs7830_recv_common(struct ueth_data *ueth, uint8_t *buf) return -EIO; } -#ifndef CONFIG_DM_ETH -/* - * mcs7830_init() - network interface's init callback - * @udev: network device to initialize - * @bd: board information - * Return: zero upon success, negative upon error - * - * after initial setup during probe() and get_info(), this init() callback - * ensures that the link is up and subsequent send() and recv() calls can - * exchange ethernet frames - */ -static int mcs7830_init(struct eth_device *eth, struct bd_info *bd) -{ - struct ueth_data *dev = eth->priv; - - return mcs7830_init_common(dev->pusb_dev); -} - -/* - * mcs7830_send() - network interface's send callback - * @eth: network device to send the frame from - * @packet: ethernet frame content - * @length: ethernet frame length - * Return: zero upon success, negative upon error - * - * this routine send an ethernet frame out of the network interface - */ -static int mcs7830_send(struct eth_device *eth, void *packet, int length) -{ - struct ueth_data *dev = eth->priv; - - return mcs7830_send_common(dev, packet, length); -} - -/* - * mcs7830_recv() - network interface's recv callback - * @eth: network device to receive frames from - * Return: zero upon success, negative upon error - * - * this routine checks for available ethernet frames that the network - * interface might have received, and notifies the network stack - */ -static int mcs7830_recv(struct eth_device *eth) -{ - ALLOC_CACHE_ALIGN_BUFFER(uint8_t, buf, MCS7830_RX_URB_SIZE); - struct ueth_data *ueth = eth->priv; - int len; - - len = mcs7830_recv_common(ueth, buf); - if (len >= 0) { - net_process_received_packet(buf, len); - return 0; - } - - return len; -} - -/* - * mcs7830_halt() - network interface's halt callback - * @eth: network device to cease operation of - * Return: none - * - * this routine is supposed to undo the effect of previous initialization and - * ethernet frames exchange; in this implementation it's a NOP - */ -static void mcs7830_halt(struct eth_device *eth) -{ - debug("%s()\n", __func__); -} - -/* - * mcs7830_write_mac() - write an ethernet adapter's MAC address - * @eth: network device to write to - * Return: zero upon success, negative upon error - * - * this routine takes the MAC address from the ethernet interface's data - * structure, and writes it into the ethernet adapter such that subsequent - * exchange of ethernet frames uses this address - */ -static int mcs7830_write_mac(struct eth_device *eth) -{ - struct ueth_data *ueth = eth->priv; - - return mcs7830_write_mac_common(ueth->pusb_dev, eth->enetaddr); -} - -/* - * mcs7830_iface_idx - index of detected network interfaces - * - * this counter keeps track of identified supported interfaces, - * to assign unique names as more interfaces are found - */ -static int mcs7830_iface_idx; - -/* - * mcs7830_eth_before_probe() - network driver's before_probe callback - * Return: none - * - * this routine initializes driver's internal data in preparation of - * subsequent probe callbacks - */ -void mcs7830_eth_before_probe(void) -{ - mcs7830_iface_idx = 0; -} - -/* - * struct mcs7830_dongle - description of a supported Moschip ethernet dongle - * @vendor: 16bit USB vendor identification - * @product: 16bit USB product identification - * - * this structure describes a supported USB ethernet dongle by means of the - * vendor and product codes found during USB enumeration; no flags are held - * here since all supported dongles have identical behaviour, and required - * fixups get determined at runtime, such that no manual configuration is - * needed - */ -struct mcs7830_dongle { - uint16_t vendor; - uint16_t product; -}; - -/* - * mcs7830_dongles - the list of supported Moschip based USB ethernet dongles - */ -static const struct mcs7830_dongle mcs7830_dongles[] = { - { 0x9710, 0x7832, }, /* Moschip 7832 */ - { 0x9710, 0x7830, }, /* Moschip 7830 */ - { 0x9710, 0x7730, }, /* Moschip 7730 */ - { 0x0df6, 0x0021, }, /* Sitecom LN 30 */ -}; - -/* - * mcs7830_eth_probe() - network driver's probe callback - * @dev: detected USB device to check - * @ifnum: detected USB interface to check - * @ss: USB ethernet data structure to fill in upon match - * Return: #1 upon match, #0 upon mismatch or error - * - * this routine checks whether the found USB device is supported by - * this ethernet driver, and upon match fills in the USB ethernet - * data structure which later is passed to the get_info callback - */ -int mcs7830_eth_probe(struct usb_device *dev, unsigned int ifnum, - struct ueth_data *ss) -{ - struct usb_interface *iface; - struct usb_interface_descriptor *iface_desc; - int i; - struct mcs7830_private *priv; - int ep_in_found, ep_out_found, ep_intr_found; - - debug("%s()\n", __func__); - - /* iterate the list of supported dongles */ - iface = &dev->config.if_desc[ifnum]; - iface_desc = &iface->desc; - for (i = 0; i < ARRAY_SIZE(mcs7830_dongles); i++) { - if (dev->descriptor.idVendor == mcs7830_dongles[i].vendor && - dev->descriptor.idProduct == mcs7830_dongles[i].product) - break; - } - if (i == ARRAY_SIZE(mcs7830_dongles)) - return 0; - debug("detected USB ethernet device: %04X:%04X\n", - dev->descriptor.idVendor, dev->descriptor.idProduct); - - /* fill in driver private data */ - priv = calloc(1, sizeof(*priv)); - if (!priv) - return 0; - - /* fill in the ueth_data structure, attach private data */ - memset(ss, 0, sizeof(*ss)); - ss->ifnum = ifnum; - ss->pusb_dev = dev; - ss->subclass = iface_desc->bInterfaceSubClass; - ss->protocol = iface_desc->bInterfaceProtocol; - ss->dev_priv = priv; - - /* - * a minimum of three endpoints is expected: in (bulk), - * out (bulk), and interrupt; ignore all others - */ - ep_in_found = ep_out_found = ep_intr_found = 0; - for (i = 0; i < iface_desc->bNumEndpoints; i++) { - uint8_t eptype, epaddr; - bool is_input; - - eptype = iface->ep_desc[i].bmAttributes; - eptype &= USB_ENDPOINT_XFERTYPE_MASK; - - epaddr = iface->ep_desc[i].bEndpointAddress; - is_input = epaddr & USB_DIR_IN; - epaddr &= USB_ENDPOINT_NUMBER_MASK; - - if (eptype == USB_ENDPOINT_XFER_BULK) { - if (is_input && !ep_in_found) { - ss->ep_in = epaddr; - ep_in_found++; - } - if (!is_input && !ep_out_found) { - ss->ep_out = epaddr; - ep_out_found++; - } - } - - if (eptype == USB_ENDPOINT_XFER_INT) { - if (is_input && !ep_intr_found) { - ss->ep_int = epaddr; - ss->irqinterval = iface->ep_desc[i].bInterval; - ep_intr_found++; - } - } - } - debug("endpoints: in %d, out %d, intr %d\n", - ss->ep_in, ss->ep_out, ss->ep_int); - - /* apply basic sanity checks */ - if (usb_set_interface(dev, iface_desc->bInterfaceNumber, 0) || - !ss->ep_in || !ss->ep_out || !ss->ep_int) { - debug("device probe incomplete\n"); - return 0; - } - - dev->privptr = ss; - return 1; -} - -/* - * mcs7830_eth_get_info() - network driver's get_info callback - * @dev: detected USB device - * @ss: USB ethernet data structure filled in at probe() - * @eth: ethernet interface data structure to fill in - * Return: #1 upon success, #0 upon error - * - * this routine registers the mandatory init(), send(), recv(), and - * halt() callbacks with the ethernet interface, can register the - * optional write_hwaddr() callback with the ethernet interface, - * and initiates configuration of the interface such that subsequent - * calls to those callbacks results in network communication - */ -int mcs7830_eth_get_info(struct usb_device *dev, struct ueth_data *ss, - struct eth_device *eth) -{ - debug("%s()\n", __func__); - if (!eth) { - debug("%s: missing parameter.\n", __func__); - return 0; - } - - snprintf(eth->name, sizeof(eth->name), "%s%d", - MCS7830_BASE_NAME, mcs7830_iface_idx++); - eth->init = mcs7830_init; - eth->send = mcs7830_send; - eth->recv = mcs7830_recv; - eth->halt = mcs7830_halt; - eth->write_hwaddr = mcs7830_write_mac; - eth->priv = ss; - - if (mcs7830_basic_reset(ss->pusb_dev, ss->dev_priv)) - return 0; - - if (mcs7830_read_mac(ss->pusb_dev, eth->enetaddr)) - return 0; - debug("MAC %pM\n", eth->enetaddr); - - return 1; -} -#endif - - -#ifdef CONFIG_DM_ETH static int mcs7830_eth_start(struct udevice *dev) { struct usb_device *udev = dev_get_parent_priv(dev); @@ -942,4 +667,3 @@ static const struct usb_device_id mcs7830_eth_id_table[] = { }; U_BOOT_USB_DEVICE(mcs7830_eth, mcs7830_eth_id_table); -#endif