From: Tom Rini Date: Sun, 27 Nov 2022 15:25:22 +0000 (-0500) Subject: net: rtl8169: Remove non-DM_ETH code X-Git-Tag: v2023.07~207^2~12^2~14 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f1ee1e1ef199fe4aaaf5423885d4fa7ef79c9147;p=platform%2Fkernel%2Fu-boot.git net: rtl8169: 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 --- diff --git a/drivers/net/rtl8169.c b/drivers/net/rtl8169.c index da2cfb7..c9c07a5 100644 --- a/drivers/net/rtl8169.c +++ b/drivers/net/rtl8169.c @@ -47,9 +47,6 @@ #include #include #include -#ifndef CONFIG_DM_ETH -#include -#endif #include #include #include @@ -514,13 +511,8 @@ static void rtl_flush_buffer(void *buf, size_t size) /************************************************************************** RECV - Receive a frame ***************************************************************************/ -#ifdef CONFIG_DM_ETH static int rtl_recv_common(struct udevice *dev, unsigned long dev_iobase, uchar **packetp) -#else -static int rtl_recv_common(pci_dev_t dev, unsigned long dev_iobase, - uchar **packetp) -#endif { /* return true if there's an ethernet packet ready to read */ /* nic->packet should contain data on return */ @@ -551,22 +543,12 @@ static int rtl_recv_common(pci_dev_t dev, unsigned long dev_iobase, else tpc->RxDescArray[cur_rx].status = cpu_to_le32(OWNbit + RX_BUF_SIZE); -#ifdef CONFIG_DM_ETH tpc->RxDescArray[cur_rx].buf_addr = cpu_to_le32( dm_pci_mem_to_phys(dev, (pci_addr_t)(unsigned long) tpc->RxBufferRing[cur_rx])); -#else - tpc->RxDescArray[cur_rx].buf_addr = cpu_to_le32( - pci_mem_to_phys(dev, (pci_addr_t)(unsigned long) - tpc->RxBufferRing[cur_rx])); -#endif rtl_flush_rx_desc(&tpc->RxDescArray[cur_rx]); -#ifdef CONFIG_DM_ETH *packetp = rxdata; -#else - net_process_received_packet(rxdata, length); -#endif } else { puts("Error Rx"); length = -EIO; @@ -584,32 +566,19 @@ static int rtl_recv_common(pci_dev_t dev, unsigned long dev_iobase, return (0); /* initially as this is called to flush the input */ } -#ifdef CONFIG_DM_ETH int rtl8169_eth_recv(struct udevice *dev, int flags, uchar **packetp) { struct rtl8169_private *priv = dev_get_priv(dev); return rtl_recv_common(dev, priv->iobase, packetp); } -#else -static int rtl_recv(struct eth_device *dev) -{ - return rtl_recv_common((pci_dev_t)(unsigned long)dev->priv, - dev->iobase, NULL); -} -#endif /* nCONFIG_DM_ETH */ #define HZ 1000 /************************************************************************** SEND - Transmit a frame ***************************************************************************/ -#ifdef CONFIG_DM_ETH static int rtl_send_common(struct udevice *dev, unsigned long dev_iobase, void *packet, int length) -#else -static int rtl_send_common(pci_dev_t dev, unsigned long dev_iobase, - void *packet, int length) -#endif { /* send the packet to destination */ @@ -637,13 +606,8 @@ static int rtl_send_common(pci_dev_t dev, unsigned long dev_iobase, rtl_flush_buffer(ptxb, ALIGN(len, RTL8169_ALIGN)); tpc->TxDescArray[entry].buf_Haddr = 0; -#ifdef CONFIG_DM_ETH tpc->TxDescArray[entry].buf_addr = cpu_to_le32( dm_pci_mem_to_phys(dev, (pci_addr_t)(unsigned long)ptxb)); -#else - tpc->TxDescArray[entry].buf_addr = cpu_to_le32( - pci_mem_to_phys(dev, (pci_addr_t)(unsigned long)ptxb)); -#endif if (entry != (NUM_TX_DESC - 1)) { tpc->TxDescArray[entry].status = cpu_to_le32((OWNbit | FSbit | LSbit) | @@ -680,7 +644,6 @@ static int rtl_send_common(pci_dev_t dev, unsigned long dev_iobase, return ret; } -#ifdef CONFIG_DM_ETH int rtl8169_eth_send(struct udevice *dev, void *packet, int length) { struct rtl8169_private *priv = dev_get_priv(dev); @@ -688,14 +651,6 @@ int rtl8169_eth_send(struct udevice *dev, void *packet, int length) return rtl_send_common(dev, priv->iobase, packet, length); } -#else -static int rtl_send(struct eth_device *dev, void *packet, int length) -{ - return rtl_send_common((pci_dev_t)(unsigned long)dev->priv, - dev->iobase, packet, length); -} -#endif - static void rtl8169_set_rx_mode(void) { u32 mc_filter[2]; /* Multicast hash filter */ @@ -719,11 +674,7 @@ static void rtl8169_set_rx_mode(void) RTL_W32(MAR0 + 4, mc_filter[1]); } -#ifdef CONFIG_DM_ETH static void rtl8169_hw_start(struct udevice *dev) -#else -static void rtl8169_hw_start(pci_dev_t dev) -#endif { u32 i; @@ -768,21 +719,11 @@ static void rtl8169_hw_start(pci_dev_t dev) tpc->cur_rx = 0; -#ifdef CONFIG_DM_ETH RTL_W32(TxDescStartAddrLow, dm_pci_mem_to_phys(dev, (pci_addr_t)(unsigned long)tpc->TxDescArray)); -#else - RTL_W32(TxDescStartAddrLow, pci_mem_to_phys(dev, - (pci_addr_t)(unsigned long)tpc->TxDescArray)); -#endif RTL_W32(TxDescStartAddrHigh, (unsigned long)0); -#ifdef CONFIG_DM_ETH RTL_W32(RxDescStartAddrLow, dm_pci_mem_to_phys( dev, (pci_addr_t)(unsigned long)tpc->RxDescArray)); -#else - RTL_W32(RxDescStartAddrLow, pci_mem_to_phys( - dev, (pci_addr_t)(unsigned long)tpc->RxDescArray)); -#endif RTL_W32(RxDescStartAddrHigh, (unsigned long)0); /* RTL-8169sc/8110sc or later version */ @@ -804,11 +745,7 @@ static void rtl8169_hw_start(pci_dev_t dev) #endif } -#ifdef CONFIG_DM_ETH static void rtl8169_init_ring(struct udevice *dev) -#else -static void rtl8169_init_ring(pci_dev_t dev) -#endif { int i; @@ -836,13 +773,8 @@ static void rtl8169_init_ring(pci_dev_t dev) cpu_to_le32(OWNbit + RX_BUF_SIZE); tpc->RxBufferRing[i] = &rxb[i * RX_BUF_SIZE]; -#ifdef CONFIG_DM_ETH tpc->RxDescArray[i].buf_addr = cpu_to_le32(dm_pci_mem_to_phys( dev, (pci_addr_t)(unsigned long)tpc->RxBufferRing[i])); -#else - tpc->RxDescArray[i].buf_addr = cpu_to_le32(pci_mem_to_phys( - dev, (pci_addr_t)(unsigned long)tpc->RxBufferRing[i])); -#endif rtl_flush_rx_desc(&tpc->RxDescArray[i]); } @@ -851,13 +783,8 @@ static void rtl8169_init_ring(pci_dev_t dev) #endif } -#ifdef CONFIG_DM_ETH static void rtl8169_common_start(struct udevice *dev, unsigned char *enetaddr, unsigned long dev_iobase) -#else -static void rtl8169_common_start(pci_dev_t dev, unsigned char *enetaddr, - unsigned long dev_iobase) -#endif { int i; @@ -887,7 +814,6 @@ static void rtl8169_common_start(pci_dev_t dev, unsigned char *enetaddr, #endif } -#ifdef CONFIG_DM_ETH static int rtl8169_eth_start(struct udevice *dev) { struct eth_pdata *plat = dev_get_plat(dev); @@ -897,18 +823,6 @@ static int rtl8169_eth_start(struct udevice *dev) return 0; } -#else -/************************************************************************** -RESET - Finish setting up the ethernet interface -***************************************************************************/ -static int rtl_reset(struct eth_device *dev, struct bd_info *bis) -{ - rtl8169_common_start((pci_dev_t)(unsigned long)dev->priv, - dev->enetaddr, dev->iobase); - - return 0; -} -#endif /* nCONFIG_DM_ETH */ static void rtl_halt_common(unsigned long dev_iobase) { @@ -933,24 +847,13 @@ static void rtl_halt_common(unsigned long dev_iobase) } } -#ifdef CONFIG_DM_ETH void rtl8169_eth_stop(struct udevice *dev) { struct rtl8169_private *priv = dev_get_priv(dev); rtl_halt_common(priv->iobase); } -#else -/************************************************************************** -HALT - Turn off ethernet interface -***************************************************************************/ -static void rtl_halt(struct eth_device *dev) -{ - rtl_halt_common(dev->iobase); -} -#endif -#ifdef CONFIG_DM_ETH static int rtl8169_write_hwaddr(struct udevice *dev) { struct eth_pdata *plat = dev_get_plat(dev); @@ -965,7 +868,6 @@ static int rtl8169_write_hwaddr(struct udevice *dev) return 0; } -#endif /************************************************************************** INIT - Look for an adapter, this routine's visible to the outside @@ -1118,73 +1020,6 @@ static int rtl_init(unsigned long dev_ioaddr, const char *name, return 0; } -#ifndef CONFIG_DM_ETH -int rtl8169_initialize(struct bd_info *bis) -{ - pci_dev_t devno; - int card_number = 0; - struct eth_device *dev; - u32 iobase; - int idx=0; - - while(1){ - unsigned int region; - u16 device; - int err; - - /* Find RTL8169 */ - if ((devno = pci_find_devices(supported, idx++)) < 0) - break; - - pci_read_config_word(devno, PCI_DEVICE_ID, &device); - switch (device) { - case 0x8168: - region = 2; - break; - - default: - region = 1; - break; - } - - pci_read_config_dword(devno, PCI_BASE_ADDRESS_0 + (region * 4), &iobase); - iobase &= ~0xf; - - debug ("rtl8169: REALTEK RTL8169 @0x%x\n", iobase); - - dev = (struct eth_device *)malloc(sizeof *dev); - if (!dev) { - printf("Can not allocate memory of rtl8169\n"); - break; - } - - memset(dev, 0, sizeof(*dev)); - sprintf (dev->name, "RTL8169#%d", card_number); - - dev->priv = (void *)(unsigned long)devno; - dev->iobase = (int)pci_mem_to_phys(devno, iobase); - - dev->init = rtl_reset; - dev->halt = rtl_halt; - dev->send = rtl_send; - dev->recv = rtl_recv; - - err = rtl_init(dev->iobase, dev->name, dev->enetaddr); - if (err < 0) { - printf(pr_fmt("failed to initialize card: %d\n"), err); - free(dev); - continue; - } - - eth_register (dev); - - card_number++; - } - return card_number; -} -#endif - -#ifdef CONFIG_DM_ETH static int rtl8169_eth_probe(struct udevice *dev) { struct pci_child_plat *pplat = dev_get_parent_plat(dev); @@ -1253,4 +1088,3 @@ U_BOOT_DRIVER(eth_rtl8169) = { }; U_BOOT_PCI_DEVICE(eth_rtl8169, supported); -#endif