summaryrefslogtreecommitdiffstats
path: root/drivers/net/rtl8169.c
Commit message (Collapse)AuthorAgeFilesLines
* net: rtl8169: Fix return value for rtl_send_commonOleksandr Tymoshenko2016-07-061-2/+2
| | | | | | | | | | | | | | | | | Return value of rtl_send_common propogates unmodified all the way up to eth_send and further to API consumer if CONFIG_API is enabled. Previously rtl_send_common returned number of bytes sent on success which was erroneouly detected as error condition by API consumers that checked for operation success by comparing return value with 0. Switch rtl_send_common to use common convention: return 0 on success and negative value for failure. Cc: Stephen Warren <swarren@nvidia.com> Cc: Joe Hershberger <joe.hershberger@ni.com> Signed-off-by: Oleksandr Tymoshenko <gonzo@bluezbox.com> Reviewed-by: Simon Glass <sjg@chromium.org> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* net: rtl8169: fix switching between adaptersStephen Warren2016-06-211-4/+9
| | | | | | | | | | | | | | | | | | | | | | | | The rtl8169 driver uses a global variable to store the register address of the adapter being operated upon. This is updated to point at the correct adapter when sending or receiving a packet, or shutting down the adapter, but not when initializing the adapter. Consequently, switching between different adapters within the same U-Boot runtime does not work correctly since the driver programs the wrong registers during rtl8169_eth_start() -> rtl8169_common_start() -> rtl8169_hw_start(). Note that since rtl8169_eth_stop() does set the global variable, the second consecutive attempt to use the "new" adapter did work even before this patch, because each time network usage is shut down, the network core calls stop, which sets the variable so that the next start does actually initialize the hardware, and the adapter works. Equally, rtl8169_eth_probe() calls rtl_init() which sets the global, so if using only a single device, or if picking the "right" device (based on probe order) when multiple devices are present, ioaddr will already be set correctly from the get-go, so the issue does not occur. Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* net: rtl8169: Fix build error when DEBUG is onBin Meng2016-03-271-5/+5
| | | | | | | | | When DEBUG_RTL8169 is on, a build error occurs in function 'rtl_init': error: 'dev' undeclared. Fix this. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Tom Rini <trini@konsulko.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* dm: net: Convert rtl8169 to use DM PCI APISimon Glass2016-01-121-19/+66
| | | | | | | | Update this driver to use the proper driver-model PCI API functions. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* dm: pci: Add a dm_ prefix to pci_get_bdf()Simon Glass2016-01-121-5/+6
| | | | | | | | | | | | Most driver model PCI functions have a dm_ prefix. At some point, when the old code is converted to driver model and the old functions are removed, we will drop that prefix. For consistency, we should use the dm_ prefix for all driver model functions. Update pci_get_bdf() accordingly. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* net: rtl8169: Build warning fixes for 64-bitStephen Warren2015-10-291-4/+6
| | | | | | | | | | | | | Casting from dev->priv to pci_dev_t changes the value's size on a 64-bit system. This causes the compiler to complain about casting a pointer to an integer of a different (smaller) size. To avoid this, cast to an integer of matching size first, then perform an int->int cast to perform the size change. This signals explicitly that we do want to change the size, and avoids the compiler warning. This is legitimate since we know the pointer actually stores a small integer, not a pointer value. Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* Move ALLOC_CACHE_ALIGN_BUFFER() to the new memalign.h headerSimon Glass2015-09-111-0/+1
| | | | | | | Now that we have a new header file for cache-aligned allocation, we should move the stack-based allocation macro there also. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: eth: Add driver-model support to the rtl8169 driverSimon Glass2015-07-211-49/+187
| | | | | | | This driver is used by the Intel Minnowmax board. Convert it to driver model so it can use the new Ethernet implementation. Signed-off-by: Simon Glass <sjg@chromium.org>
* net: rtl8169: Build warning fixes for 64-bitThierry Reding2015-04-201-11/+13
| | | | | | | | | | | Turn ioaddr into an unsigned long rather than a sized 32-bit variable. While at it, fix a couple of pointer to integer cast size mismatch warnings by casting through unsigned long going from pointers to integers and vice versa. Cc: Joe Hershberger <joe.hershberger@gmail.com> Signed-off-by: Thierry Reding <treding@nvidia.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* net: cosmetic: Fix var naming net <-> eth driversJoe Hershberger2015-04-181-1/+1
| | | | | | | | | | | | | | | Update the naming convention used in the network stack functions and variables that Ethernet drivers use to interact with it. This cleans up the temporary hacks that were added to this interface along with the DM support. This patch has a few remaining checkpatch.pl failures that would be out of the scope of this patch to fix (drivers that are in gross violation of checkpatch.pl). Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
* net: rtl8169: Add support for RTL-8168/8111gThierry Reding2014-12-181-0/+1
| | | | | | | | This network interface card is found on the NVIDIA Jetson TK1. Signed-off-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Warren <twarren@nvidia.com>
* net: rtl8169: Use non-cached memory if availableThierry Reding2014-12-181-11/+60
| | | | | | | | | | To work around potential issues with explicit cache maintenance of the RX and TX descriptor rings, allocate them from a pool of uncached memory if the architecture supports it. Signed-off-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Warren <twarren@nvidia.com>
* net: rtl8169: Properly align buffersThierry Reding2014-12-181-29/+34
| | | | | | | | | | | | | | | | RX and TX descriptor rings should be aligned to 256 byte boundaries. Use the DEFINE_ALIGN_BUFFER() macro to define the buffers so that they don't have to be manually aligned later on. Also make sure that the buffers do align to cache-line boundaries in case the cache-line is higher than the 256 byte alignment requirements of the NIC. Also add a warning if the cache-line size is larger than the descriptor size, because the driver may discard changes to descriptors made by the hardware when requeuing RX buffers. Signed-off-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Warren <twarren@nvidia.com>
* net: rtl8169: Honor CONFIG_SYS_RX_ETH_BUFFERThierry Reding2014-12-181-1/+5
| | | | | | | | | | According to the top-level README file, this configuration setting can be used to override the number of receive buffers that an ethernet NIC uses. Signed-off-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Warren <twarren@nvidia.com>
* rtl8169: Defer network packet processingThierry Reding2014-09-161-1/+2
| | | | | | | | | | | | | | | | | | When network protocol errors occur (such as a file not being found on a TFTP server), the processing done by the NetReceive() function will end up calling the driver's .halt() implementation. However, after that the device no longer has access to the memory buffers and will cause errors such as this in the rtl_recv() function when trying to hand descriptors back to the device: pci_hose_bus_to_phys: invalid physical address This can be fixed by deferring processing of network packets until the descriptors have been handed back. That way rtl_halt() tearing down network buffers is not going to prevent access to the buffers. Reported-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Thierry Reding <treding@nvidia.com>
* net: rtl8169: Add support for RTL8168d/8111dThierry Reding2013-11-221-1/+17
| | | | | | | | | | This chip is compatible with the existing driver, except that it uses BAR2 instead of BAR1 for the I/O memory region. Using this patch I can use the PCIe ethernet interface on the CompuLab Trimslice to boot from the network. Signed-off-by: Thierry Reding <treding@nvidia.com> Patch: 276477
* net: rtl8169: Improve cache maintenanceThierry Reding2013-11-221-8/+53
| | | | | | | | | | | | | | Instead of directly calling the low-level invalidate_dcache_range() and flush_cache() functions, provide thin wrappers that take into account alignment requirements. While at it, fix a case where the cache was flushed but should have been invalidated, two cases where the buffer data was flushed instead of the descriptor and a missing cache invalidation before reading the packet data that the NIC just wrote to memory. Signed-off-by: Thierry Reding <treding@nvidia.com> Patch: 276474
* net: rtl8169: Add support for RTL8168evl/8111evlThierry Reding2013-11-221-0/+1
| | | | | | | | This chip is compatible with other RTL8168 chips and can be found on the NVIDIA Cardhu and Beaver boards. Signed-off-by: Thierry Reding <treding@nvidia.com> Patch: 276475
* net: rtl8169: Fix format stringThierry Reding2013-11-221-5/+5
| | | | | | | | currticks() is defined as get_timer(0), which returns an unsigned long, so use %lu instead of %d to print the result. Signed-off-by: Thierry Reding <treding@nvidia.com> Patch: 276473
* Add GPL-2.0+ SPDX-License-Identifier to source filesWolfgang Denk2013-07-241-13/+1
| | | | | | Signed-off-by: Wolfgang Denk <wd@denx.de> [trini: Fixup common/cmd_io.c] Signed-off-by: Tom Rini <trini@ti.com>
* drivers/net/rtl8169.c: Fix compile warningJoe Hershberger2012-05-221-1/+1
| | | | | | | | Fix this: rtl8169.c: In function 'rtl8169_initialize': rtl8169.c:907:13: warning: assignment from incompatible pointer type Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* drivers/net/rtl8169.c: Fix GCC 4.6 build warningWolfgang Denk2011-11-071-3/+0
| | | | | | | | | Fix: rtl8169.c: In function 'rtl_init': rtl8169.c:742:13: warning: variable 'printed_version' set but not used [-Wunused-but-set-variable] Signed-off-by: Wolfgang Denk <wd@denx.de>
* net: rtl8169: Add initialized eth_device structureNobuhiro Iwamatsu2010-11-141-0/+5
| | | | | | | | | rtl8169 does not have write_hwaddr function. However, eth stuff executes write_hwaddr function because eth_device structure has not been initialized. Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org> CC: Ben Warren <biggerbadderben@gmail.com>
* rtl8169: fix PCI system memory addressYoshihiro Shimoda2009-06-081-5/+8
| | | | | | | | When PCI device use system memory, some PCI host controller should be set physical memory address. Signed-off-by: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com> Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
* rtl8169: fix cache coherency problemYoshihiro Shimoda2009-04-281-1/+10
| | | | | | | | Fix the problem that cannot access actual data when CPU data cache enabled. Signed-off-by: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com> Tested-by: Nobuhiro Iwamatsu <iwamatsu.nobuhiro@renesas.com> Acked-by: Ben Warren <biggerbadderben@gmail.com>
* drivers/net/: get mac address from environmentMike Frysinger2009-03-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The environment is the canonical storage location of the mac address, so we're killing off the global data location and moving everything to querying the env directly. The drivers that get converted here: 3c589 4xx_enet dc2114x dm9000x enc28j60 fsl_mcdmafec ks8695eth mcffec rtl8019 rtl8169 s3c4510b_eth xilinx_emac xilinx_emaclite Signed-off-by: Mike Frysinger <vapier@gentoo.org> CC: Ben Warren <biggerbadderben@gmail.com> CC: Rolf Offermanns <rof@sysgo.de> CC: Stefan Roese <sr@denx.de> CC: Sascha Hauer <saschahauer@web.de> CC: TsiChung Liew <Tsi-Chung.Liew@freescale.com> CC: Greg Ungerer <greg.ungerer@opengear.com> CC: Xue Ligong <lgxue@hotmail.com> CC: Masami Komiya <mkomiya@sonare.it> CC: Curt Brune <curt@cucy.com> CC: Michal SIMEK <monstr@monstr.eu>
* Moved initialization of RTL8169 Ethernet controller to board_eth_init()Ben Warren2008-09-021-0/+1
| | | | | | | | | | Affected boards: linkstation r7780mp Removed initialization of the driver from net/eth.c Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
* rtl8169: add support for RTL8110SCLYoshihiro Shimoda2008-08-181-6/+22
| | | | | | | | This patch fixes a problem that RTL8110SCL started transfer with an incorrect memory address. Signed-off-by: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com> Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
* Fix some more print() format errors.Wolfgang Denk2008-07-101-1/+1
| | | | Signed-off-by: Wolfgang Denk <wd@denx.de>
* net: Conditional COBJS inclusion of network driversShinya Kuribayashi2008-06-091-5/+0
| | | | | | | Replace COBJS-y with appropriate driver config names. Signed-off-by: Shinya Kuribayashi <skuribay@ruby.dti.ne.jp> Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
* rtl8169: fix compiler warningsGuennadi Liakhovetski2008-04-281-5/+5
| | | | | | Fix multiple compiler warnings related to argument type mismatch. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
* net: rtl8169: Add processing when OWNbit did't enable in rtl_recv()Nobuhiro Iwamatsu2008-03-081-0/+14
| | | | | | | | | | When rtl_recv() of rtl8169 is called, OWNbit of status register is not enable occasionally. rtl_recv() doesn't work normally when the driver doesn't do appropriate processing. This patch fix this problem. Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
* Remove duplicate defines for ARRAY_SIZEKumar Gala2008-02-141-2/+0
| | | | Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
* Fix Ethernet init() return codesBen Warren2008-01-101-1/+2
| | | | | | | | | | | | | | | | | | Change return values of init() functions in all Ethernet drivers to conform to the following: >=0: Success <0: Failure All drivers going forward should return 0 on success. Current drivers that return 1 on success were left as-is to minimize changes. Signed-off-by: Ben Warren <biggerbadderben@gmail.com> Acked-by: Stefan Roese <sr@denx.de> Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Acked-by: Kim Phillips <kim.phillips@freescale.com> Acked-by: Haavard Skinnemoen <hskinnemoen@atmel.com> Acked-By: Timur Tabi <timur@freescale.com>
* Fix endianness conversions in rtl8169 driverGuennadi Liakhovetski2008-01-091-55/+45
| | | | | | | | | | It is unclear on what platforms this driver has been tested, since noone up to now defines CONFIG_RTL8169 in the board configuration header. Now it has been fixed for a big-endian mpc8241 based linkstation platform. This patch presents the necessary endianness conversion fixes. Signed-off-by: Guennadi Liakhovetski <lg@denx.de>
* drivers/net : move net drivers to drivers/netJean-Christophe PLAGNIOL-VILLARD2007-11-251-0/+888
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
OpenPOWER on IntegriCloud