From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 238A3C43217 for ; Sun, 27 Nov 2022 15:31:37 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9C81285258; Sun, 27 Nov 2022 16:27:21 +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="Mgkef6zg"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CEB6085175; Sun, 27 Nov 2022 16:26:21 +0100 (CET) Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) (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 6816D8510C for ; Sun, 27 Nov 2022 16:26:18 +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-ed1-x52d.google.com with SMTP id z20so12367350edc.13 for ; Sun, 27 Nov 2022 07:26:18 -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=OKXfYGQz5OFltD1GVVm68u7Gf6y20hxlW8UNYEJFo3c=; b=Mgkef6zgc5z45n+rplAOJUpT+TJG9T+Ab8iC1MlO0/wNSNzW0lUXZufXKzmkx3F2Zq 2XhFknFQ5srCeEUT7f9ez//kPbDJxowcbpqk8RU9yda94Dk6aVhB8QijT5EfXvl3sbNe bWJdE9rZ5VRNOkg33mP5feohRrd8ve2/AhlA4= 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=OKXfYGQz5OFltD1GVVm68u7Gf6y20hxlW8UNYEJFo3c=; b=JMC0fvJWfO9ySqtqbEtKrZwh7rWJMfcFsyF6iP8taR+yWQDgIBeyaqYsMz+CcjUR0f I2Ywg108EIPd1VhL/VPPx/IZpU+5j81lX6FsOxa+AdEyOilXTxGOFxvTPjwn7w8CaVRz RwbIprZur1wfEjE86W0lSEpOKu0LdzGNKkaFsZTfmIW9hyF1K19KYwZ8iKzO09S/I5Ei xkBF3MBkjDdZYMg1/BcpIr+P1SW6j2CEgYCNuY5DT16XtUOZl9uCDJwIwibo0iYvvhyC BdZihMmbKWTCrDxwSz4J7Hc+TmEninxISWty4+wY7Dhzi0IwgOTG026H2mlikuBLxmva Q26A== X-Gm-Message-State: ANoB5pm7yf/k2W75dc+rOaynASUcec3k2E3kyZ1oZqvNLX93Og0SNtpQ sz5vTwLAVjsIMPthcQYxSaPzo4lCa8kxVw== X-Google-Smtp-Source: AA0mqf77oOsNhYYiM0ccui3NbqmuitCyzWrsWmX4eFnvB1aaYlyAKXxGwitHBJu0is/SCAoTxDTQMA== X-Received: by 2002:a05:6402:528d:b0:468:dc9:ec08 with SMTP id en13-20020a056402528d00b004680dc9ec08mr29061488edb.17.1669562777884; Sun, 27 Nov 2022 07:26:17 -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.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Nov 2022 07:26:17 -0800 (PST) From: Tom Rini To: u-boot@lists.denx.de Subject: [PATCH 36/41] usb: eth: r8152: Remove non-DM_ETH code Date: Sun, 27 Nov 2022 10:25:31 -0500 Message-Id: <20221127152536.1556469-36-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 Content-Transfer-Encoding: 8bit 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/r8152.c | 275 ---------------------------------------- drivers/usb/eth/r8152.h | 2 - 2 files changed, 277 deletions(-) diff --git a/drivers/usb/eth/r8152.c b/drivers/usb/eth/r8152.c index 1aaa5a79b3f6..3c866f4f1e2d 100644 --- a/drivers/usb/eth/r8152.c +++ b/drivers/usb/eth/r8152.c @@ -18,43 +18,6 @@ #include "usb_ether.h" #include "r8152.h" -#ifndef CONFIG_DM_ETH -/* local vars */ -static int curr_eth_dev; /* index for name of next device detected */ - -struct r8152_dongle { - unsigned short vendor; - unsigned short product; -}; - -static const struct r8152_dongle r8152_dongles[] = { - /* Realtek */ - { 0x0bda, 0x8050 }, - { 0x0bda, 0x8152 }, - { 0x0bda, 0x8153 }, - - /* Samsung */ - { 0x04e8, 0xa101 }, - - /* Lenovo */ - { 0x17ef, 0x304f }, - { 0x17ef, 0x3052 }, - { 0x17ef, 0x3054 }, - { 0x17ef, 0x3057 }, - { 0x17ef, 0x7205 }, - { 0x17ef, 0x720a }, - { 0x17ef, 0x720b }, - { 0x17ef, 0x720c }, - - /* TP-LINK */ - { 0x2357, 0x0601 }, - { 0x2357, 0x0602 }, - - /* Nvidia */ - { 0x0955, 0x09ff }, -}; -#endif - struct r8152_version { unsigned short tcr; unsigned short version; @@ -1479,243 +1442,6 @@ static int r8152_send_common(struct ueth_data *ueth, void *packet, int length) return err; } -#ifndef CONFIG_DM_ETH -static int r8152_init(struct eth_device *eth, struct bd_info *bd) -{ - struct ueth_data *dev = (struct ueth_data *)eth->priv; - struct r8152 *tp = (struct r8152 *)dev->dev_priv; - - return r8152_init_common(tp); -} - -static int r8152_send(struct eth_device *eth, void *packet, int length) -{ - struct ueth_data *dev = (struct ueth_data *)eth->priv; - - return r8152_send_common(dev, packet, length); -} - -static int r8152_recv(struct eth_device *eth) -{ - struct ueth_data *dev = (struct ueth_data *)eth->priv; - - ALLOC_CACHE_ALIGN_BUFFER(uint8_t, recv_buf, RTL8152_AGG_BUF_SZ); - unsigned char *pkt_ptr; - int err; - int actual_len; - u16 packet_len; - - u32 bytes_process = 0; - struct rx_desc *rx_desc; - - debug("** %s()\n", __func__); - - err = usb_bulk_msg(dev->pusb_dev, - usb_rcvbulkpipe(dev->pusb_dev, dev->ep_in), - (void *)recv_buf, - RTL8152_AGG_BUF_SZ, - &actual_len, - USB_BULK_RECV_TIMEOUT); - debug("Rx: len = %u, actual = %u, err = %d\n", RTL8152_AGG_BUF_SZ, - actual_len, err); - if (err != 0) { - debug("Rx: failed to receive\n"); - return -1; - } - if (actual_len > RTL8152_AGG_BUF_SZ) { - debug("Rx: received too many bytes %d\n", actual_len); - return -1; - } - - while (bytes_process < actual_len) { - rx_desc = (struct rx_desc *)(recv_buf + bytes_process); - pkt_ptr = recv_buf + sizeof(struct rx_desc) + bytes_process; - - packet_len = le32_to_cpu(rx_desc->opts1) & RX_LEN_MASK; - packet_len -= CRC_SIZE; - - net_process_received_packet(pkt_ptr, packet_len); - - bytes_process += - (packet_len + sizeof(struct rx_desc) + CRC_SIZE); - - if (bytes_process % 8) - bytes_process = bytes_process + 8 - (bytes_process % 8); - } - - return 0; -} - -static void r8152_halt(struct eth_device *eth) -{ - struct ueth_data *dev = (struct ueth_data *)eth->priv; - struct r8152 *tp = (struct r8152 *)dev->dev_priv; - - debug("** %s()\n", __func__); - - tp->rtl_ops.disable(tp); -} - -static int r8152_write_hwaddr(struct eth_device *eth) -{ - struct ueth_data *dev = (struct ueth_data *)eth->priv; - struct r8152 *tp = (struct r8152 *)dev->dev_priv; - - unsigned char enetaddr[8] = {0}; - - memcpy(enetaddr, eth->enetaddr, ETH_ALEN); - - ocp_write_byte(tp, MCU_TYPE_PLA, PLA_CRWECR, CRWECR_CONFIG); - pla_ocp_write(tp, PLA_IDR, BYTE_EN_SIX_BYTES, 8, enetaddr); - ocp_write_byte(tp, MCU_TYPE_PLA, PLA_CRWECR, CRWECR_NORAML); - - debug("MAC %pM\n", eth->enetaddr); - return 0; -} - -void r8152_eth_before_probe(void) -{ - curr_eth_dev = 0; -} - -/* Probe to see if a new device is actually an realtek device */ -int r8152_eth_probe(struct usb_device *dev, unsigned int ifnum, - struct ueth_data *ss) -{ - struct usb_interface *iface; - struct usb_interface_descriptor *iface_desc; - int ep_in_found = 0, ep_out_found = 0; - struct r8152 *tp; - int i; - - /* let's examine the device now */ - iface = &dev->config.if_desc[ifnum]; - iface_desc = &dev->config.if_desc[ifnum].desc; - - for (i = 0; i < ARRAY_SIZE(r8152_dongles); i++) { - if (dev->descriptor.idVendor == r8152_dongles[i].vendor && - dev->descriptor.idProduct == r8152_dongles[i].product) - /* Found a supported dongle */ - break; - } - - if (i == ARRAY_SIZE(r8152_dongles)) - return 0; - - memset(ss, 0, sizeof(struct ueth_data)); - - /* At this point, we know we've got a live one */ - debug("\n\nUSB Ethernet device detected: %#04x:%#04x\n", - dev->descriptor.idVendor, dev->descriptor.idProduct); - - /* Initialize the ueth_data structure with some useful info */ - ss->ifnum = ifnum; - ss->pusb_dev = dev; - ss->subclass = iface_desc->bInterfaceSubClass; - ss->protocol = iface_desc->bInterfaceProtocol; - - /* alloc driver private */ - ss->dev_priv = calloc(1, sizeof(struct r8152)); - - if (!ss->dev_priv) - return 0; - - /* - * We are expecting a minimum of 3 endpoints - in, out (bulk), and - * int. We will ignore any others. - */ - for (i = 0; i < iface_desc->bNumEndpoints; i++) { - /* is it an BULK endpoint? */ - if ((iface->ep_desc[i].bmAttributes & - USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_BULK) { - u8 ep_addr = iface->ep_desc[i].bEndpointAddress; - - if (ep_addr & USB_DIR_IN) { - if (!ep_in_found) { - ss->ep_in = ep_addr & - USB_ENDPOINT_NUMBER_MASK; - ep_in_found = 1; - } - } else { - if (!ep_out_found) { - ss->ep_out = ep_addr & - USB_ENDPOINT_NUMBER_MASK; - ep_out_found = 1; - } - } - } - - /* is it an interrupt endpoint? */ - if ((iface->ep_desc[i].bmAttributes & - USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_INT) { - ss->ep_int = iface->ep_desc[i].bEndpointAddress & - USB_ENDPOINT_NUMBER_MASK; - ss->irqinterval = iface->ep_desc[i].bInterval; - } - } - - debug("Endpoints In %d Out %d Int %d\n", - ss->ep_in, ss->ep_out, ss->ep_int); - - /* Do some basic sanity checks, and bail if we find a problem */ - if (usb_set_interface(dev, iface_desc->bInterfaceNumber, 0) || - !ss->ep_in || !ss->ep_out || !ss->ep_int) { - debug("Problems with device\n"); - goto error; - } - - dev->privptr = (void *)ss; - - tp = ss->dev_priv; - tp->udev = dev; - tp->intf = iface; - - r8152b_get_version(tp); - - if (rtl_ops_init(tp)) - goto error; - - tp->rtl_ops.init(tp); - tp->rtl_ops.up(tp); - - rtl8152_set_speed(tp, AUTONEG_ENABLE, - tp->supports_gmii ? SPEED_1000 : SPEED_100, - DUPLEX_FULL); - - return 1; - -error: - cfree(ss->dev_priv); - ss->dev_priv = 0; - return 0; -} - -int r8152_eth_get_info(struct usb_device *dev, struct ueth_data *ss, - struct eth_device *eth) -{ - if (!eth) { - debug("%s: missing parameter.\n", __func__); - return 0; - } - - sprintf(eth->name, "%s#%d", R8152_BASE_NAME, curr_eth_dev++); - eth->init = r8152_init; - eth->send = r8152_send; - eth->recv = r8152_recv; - eth->halt = r8152_halt; - eth->write_hwaddr = r8152_write_hwaddr; - eth->priv = ss; - - /* Get the MAC address */ - if (r8152_read_mac(ss->dev_priv, eth->enetaddr) < 0) - return 0; - - debug("MAC %pM\n", eth->enetaddr); - return 1; -} -#endif /* !CONFIG_DM_ETH */ - -#ifdef CONFIG_DM_ETH static int r8152_eth_start(struct udevice *dev) { struct r8152 *tp = dev_get_priv(dev); @@ -1895,4 +1621,3 @@ static const struct usb_device_id r8152_eth_id_table[] = { }; U_BOOT_USB_DEVICE(r8152_eth, r8152_eth_id_table); -#endif /* CONFIG_DM_ETH */ diff --git a/drivers/usb/eth/r8152.h b/drivers/usb/eth/r8152.h index 45172c055f42..7b128b1934b6 100644 --- a/drivers/usb/eth/r8152.h +++ b/drivers/usb/eth/r8152.h @@ -642,9 +642,7 @@ struct r8152 { u8 version; -#ifdef CONFIG_DM_ETH struct ueth_data ueth; -#endif }; int generic_ocp_write(struct r8152 *tp, u16 index, u16 byteen, -- 2.25.1