Commit Graph

29 Commits

Author SHA1 Message Date
Simon Glass
d0a5a0b2d8 dm: eth: Add driver-model support to the rtl8169 driver
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>
2015-07-21 17:39:39 -06:00
Thierry Reding
744152f8cf net: rtl8169: Build warning fixes for 64-bit
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>
2015-04-20 17:57:11 -05:00
Joe Hershberger
1fd92db83d net: cosmetic: Fix var naming net <-> eth drivers
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>
2015-04-18 11:11:33 -06:00
Thierry Reding
cc0856cd14 net: rtl8169: Add support for RTL-8168/8111g
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>
2014-12-18 13:21:41 -07:00
Thierry Reding
d58acdcbfb net: rtl8169: Use non-cached memory if available
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>
2014-12-18 13:21:41 -07:00
Thierry Reding
dad3ba0f0b net: rtl8169: Properly align buffers
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>
2014-12-18 13:21:41 -07:00
Thierry Reding
c94bbfdf51 net: rtl8169: Honor CONFIG_SYS_RX_ETH_BUFFER
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>
2014-12-18 13:21:41 -07:00
Thierry Reding
5d9f423ddb rtl8169: Defer network packet processing
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>
2014-09-16 12:23:45 -04:00
Thierry Reding
2287286be4 net: rtl8169: Add support for RTL8168d/8111d
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
2013-11-22 17:03:21 -06:00
Thierry Reding
22ece0e2e2 net: rtl8169: Improve cache maintenance
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
2013-11-22 17:03:21 -06:00
Thierry Reding
65a6691ed3 net: rtl8169: Add support for RTL8168evl/8111evl
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
2013-11-22 16:50:53 -06:00
Thierry Reding
7a36b9c1ac net: rtl8169: Fix format string
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
2013-11-22 16:50:53 -06:00
Wolfgang Denk
1a4596601f Add GPL-2.0+ SPDX-License-Identifier to source files
Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>
2013-07-24 09:44:38 -04:00
Joe Hershberger
d1527b55f5 drivers/net/rtl8169.c: Fix compile warning
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>
2012-05-22 23:17:52 -05:00
Wolfgang Denk
afb92010b2 drivers/net/rtl8169.c: Fix GCC 4.6 build warning
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>
2011-11-07 22:18:17 +01:00
Nobuhiro Iwamatsu
f4eaef7b2e net: rtl8169: Add initialized eth_device structure
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>
2010-11-14 23:17:37 +01:00
Yoshihiro Shimoda
d65e34d125 rtl8169: fix PCI system memory address
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>
2009-06-08 22:57:21 -07:00
Yoshihiro Shimoda
d4c02e6f5d rtl8169: fix cache coherency problem
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>
2009-04-28 00:18:10 +02:00
Mike Frysinger
d3f871482f drivers/net/: get mac address from environment
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>
2009-03-20 22:39:10 +01:00
Ben Warren
02d69891d9 Moved initialization of RTL8169 Ethernet controller to board_eth_init()
Affected boards:
	linkstation
	r7780mp

Removed initialization of the driver from net/eth.c

Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2008-09-02 21:18:16 -07:00
Yoshihiro Shimoda
db70b84329 rtl8169: add support for RTL8110SCL
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>
2008-08-18 23:11:07 -07:00
Wolfgang Denk
06c53beae1 Fix some more print() format errors.
Signed-off-by: Wolfgang Denk <wd@denx.de>
2008-07-10 13:16:09 +02:00
Shinya Kuribayashi
3b904ccb93 net: Conditional COBJS inclusion of network drivers
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>
2008-06-09 23:21:05 -07:00
Guennadi Liakhovetski
dd5748bcd6 rtl8169: fix compiler warnings
Fix multiple compiler warnings related to argument type mismatch.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
2008-04-28 20:42:55 +02:00
Nobuhiro Iwamatsu
d75469d48c net: rtl8169: Add processing when OWNbit did't enable in rtl_recv()
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>
2008-03-08 10:59:27 +01:00
Kumar Gala
3cfb0c51b2 Remove duplicate defines for ARRAY_SIZE
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
2008-02-14 00:43:02 +01:00
Ben Warren
422b1a0160 Fix Ethernet init() return codes
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>
2008-01-10 01:06:02 +01:00
Guennadi Liakhovetski
6a5e1d75bf Fix endianness conversions in rtl8169 driver
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>
2008-01-09 14:37:01 +01:00
Jean-Christophe PLAGNIOL-VILLARD
2439e4bfa1 drivers/net : move net drivers to drivers/net
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2007-11-25 18:35:17 +01:00