Commit Graph

30 Commits

Author SHA1 Message Date
Simon Glass
f7ae49fc4f common: Drop log.h from common header
Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-05-18 21:19:18 -04:00
Marek Vasut
e7ab86d9b2 net: rtl8139: Fill in SPDX tag
The rtl8139 driver is derived from Etherboot driver, which is in
turn derived from Linux 8139too driver added in Linux 2.2.18pre14.
An undocumented change in Linux 2.4.10.2 added a new field to the
driver, MODULE_LICENSE("GPL"); . According to current Linux kernel
licensing rules, Documentation/process/license-rules.rst, quote:

	"GPL"	Module is licensed under GPL version 2. This
		does not express any distinction between
		GPL-2.0-only or GPL-2.0-or-later. The exact
		license information can only be determined
		via the license information in the
		corresponding source files.

And since the code does not contain any "future" clause, the tag
is therefore GPL-2.0 only.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
2020-05-01 12:35:21 +02:00
Marek Vasut
6ee6caaf03 net: rtl8139: Move functions around
Just move functions around in preparation for easy DM conversion,
rename rtl_bcast_addr() to rtl8139_bcast_addr(), no functional change.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
2020-05-01 12:35:21 +02:00
Marek Vasut
0e5a4117a5 net: rtl8139: Finish cleanup
Finish the checkpatch cleanup of the driver, fix the remaining issues
in probe and init function and in global variables, rename the probe
function to rtl8139_init(), no functional change.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
2020-05-01 12:35:21 +02:00
Marek Vasut
38b306db23 net: rtl8139: Factor out hardware reset
This hardware reset and reset-wait implementation was twice in the
driver, factor it out into a separate function. This really should
use wait_for_bit() eventually and return -ETIMEDOUT, but thus far,
handling of any of this is missing from the driver. This must be
added later. Thus far, no functional change.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
2020-05-01 12:35:21 +02:00
Marek Vasut
661479ffc1 net: rtl8139: Minor cleanup of rtl_disable()
Rename the function to rtl8139_stop(), clean up checkpatch errors in
the stop polling function. No functional change.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
2020-05-01 12:35:21 +02:00
Marek Vasut
468fd95562 net: rtl8139: Minor cleanup of rtl_poll()
Rename the function to rtl8139_recv(), clean up various checkpatch errors,
line-over-80 conditions, and malformed comments. No functional change.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
2020-05-01 12:35:21 +02:00
Marek Vasut
67fdbc06be net: rtl8139: Minor cleanup of rtl_transmit()
Rename the function to rtl8139_send(), clean up the TX polling, the TX
OK condition at the end, overuse of typecasts, and various line-over-80
problems. No functional change.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
2020-05-01 12:35:21 +02:00
Marek Vasut
c7a3e35d76 net: rtl8139: Minor cleanup of rtl_reset()
Rename the function to rtl8139_reset(), clean up the reset polling
and various line-over-80 problems. No functional change.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
2020-05-01 12:35:21 +02:00
Marek Vasut
89f3facffb net: rtl8139: Minor cleanup of set_rx_mode()
Rename the function to rtl8139_set_rx_mode(), use unsigned variables
where applicable and inline mc_filter[] values. No functional chanage.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
2020-05-01 12:35:21 +02:00
Marek Vasut
198e6b571b net: rtl8139: Consistently use rtl8139_rx_config
This string of macros is exactly the same thing as rtl8139_rx_config,
so just use rtl8139_rx_config. No functional change.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
2020-05-01 12:35:21 +02:00
Marek Vasut
17dc95e527 net: rtl8139: Minor cleanup of read_eeprom()
Rename the function to rtl8139_read_eeprom() to keep the naming
consistent, keep the variables sorted in reverse xmas tree. No
functional change.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
2020-05-01 12:35:21 +02:00
Marek Vasut
f80f4e4d72 net: rtl8139: Rework eeprom_delay() macro
The macro assumes ee_addr variable to be present when it's being
used. Rework the macro into a function instead and pass it an
argument specifying the register base address, to make it future
proof for DM conversion.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
2020-05-01 12:35:21 +02:00
Marek Vasut
a5e66e515b net: rtl8139: Register macro cleanup
Clean up the horrible register definitions in the RTL8139 driver.
This does create a couple of checkpatch errors, but the driver is
full of them anyway, and those will be cleaned up later.

No functional change.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
2020-05-01 12:35:21 +02:00
Simon Glass
1eb69ae498 common: Move ARM cache operations out of common.h
These functions are CPU-related and do not use driver model. Move them to
cpu_func.h

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
2019-12-02 18:24:58 -05:00
Chris Packham
67bb984249 net: remove CONFIG_MCAST_TFTP
No mainline board enables CONFIG_MCAST_TFTP and there have been
compilation issues with the code for some time. Additionally, it has a
potential buffer underrun issue (reported as a side note in
CVE-2018-18439).

Remove the multicast TFTP code but keep the driver API for the future
addition of IPv6.

Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Signed-off-by: Chris Packham <judge.packham@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2019-01-24 11:35:30 -06:00
Bin Meng
dda5251037 net.h: Include linux/if_ether.h to avoid duplication
There are plenty of existing drivers that have macros like ETH_ALEN
defined in their own source files. Now that we imported the kernel's
if_ether.h to U-Boot we can reduce some duplication.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2018-10-10 12:28:52 -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
Claudiu Manoil
9c4cffacec net: Fix mcast function pointer prototype
This fixes the following compiler warnings when activating
CONFIG_MCAST_TFTP:

tsec.c: In function 'tsec_mcast_addr':
tsec.c:130:2: warning: passing argument 2 of 'ether_crc' makes pointer
from integer without a cast [enabled by default]
In file included from /work/u-boot-net/include/common.h:874:0,
                 from tsec.c:15:
/work/u-boot-net/include/net.h:189:5: note: expected 'const unsigned
char *' but argument is of type 'u8'
tsec.c: In function 'tsec_initialize':
tsec.c:646:13: warning: assignment from incompatible pointer type
[enabled by default]
eth.c: In function 'eth_mcast_join':
eth.c:358:2: warning: passing argument 2 of 'eth_current->mcast' makes
integer from pointer without a cast [enabled by default]
eth.c:358:2: note: expected 'u32' but argument is of type 'u8 *'

In the eth_mcast_join() implementation, eth_current->mcast()
takes a u8 pointer to the multicast mac address and not a ip
address value as implied by its prototype.

Fix parameter type mismatch for tsec_macst_addr() (tsec.c):
ether_crc() takes a u8 pointer not a u8 value.
mcast() is given a u8 pointer to the multicats mac address.
Update parameter type for the rest of mcast() instances.

Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com>
Patch: 278989
2013-11-22 16:57:13 -06:00
Joe Hershberger
86f3cded06 drivers/net/rtl8139.c: Fix compile warning
Fix this:
rtl8139.c: In function 'rtl8139_initialize':
rtl8139.c:234:13: warning: assignment from incompatible pointer type

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2012-05-22 13:41:47 -05:00
Wolfgang Denk
ecc6aa8cf3 drivers/net/rtl8139.c: Fix GCC 4.6 build warnings
Fix:
rtl8139.c: In function 'rtl8139_probe':
rtl8139.c:256:15: warning: variable 'fullduplex' set but not used
[-Wunused-but-set-variable]
rtl8139.c:256:6: warning: variable 'speed10' set but not used
[-Wunused-but-set-variable]
rtl8139.c: In function 'rtl_transmit':
rtl8139.c:419:16: warning: variable 'txstatus' set but not used
[-Wunused-but-set-variable]

Change code to use new debug macros; also fix the new errors and
warnigns popping up now, like "error: 'to' undeclared" and some
"warning: format '%X' expects argument of type 'unsigned int', but
argument X has type 'long unsigned int'"

Signed-off-by: Wolfgang Denk <wd@denx.de>
2011-11-07 22:47:37 +01:00
Nobuhiro Iwamatsu
986f72789d net: rtl8139: Add initialized eth_device structure
rtl8139 driver 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:39 +01:00
Wolfgang Denk
8ed44d91c8 Cleanup: fix "MHz" spelling
Signed-off-by: Wolfgang Denk <wd@denx.de>
2008-10-21 11:25:39 +02:00
Ben Warren
0b252f50ae Moved initialization of RTL8139 Ethernet controller to board_eth_init()
Affected boards:
	hidden_dragon
	MPC8544DS
	MPC8610HPCN
	R2DPLUS
	TB0229

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
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
Shinya Kuribayashi
c2f896b8fc drivers/net/rtl8139.c: rx_status should be le32_to_cpu(rx_status).
rx_status on the memory is basically in LE, but needs to be handled in CPU
endian. le32_to_cpu() takes up this mission. Even if on the sane hardware,
it'll work fine.

Signed-off-by: Shinya Kuribayashi <shinya.kuribayashi@necel.com>
Cc: Masami Komiya <mkomiya@sonare.it>
Cc: Lucas Jin <lucasjin@gmail.com>
Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2008-01-16 17:37:35 -05:00
Shinya Kuribayashi
96a236746f drivers/net/rtl8139.c: Fix cache coherency issues
Current driver is meant for cache coherent systems. This patch adds
flush_cache() routines to support cache non-coherent systems.

Signed-off-by: Shinya Kuribayashi <shinya.kuribayashi@necel.com>
Cc: Masami Komiya <mkomiya@sonare.it>
Cc: Lucas Jin <lucasjin@gmail.com>
Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2008-01-16 17:37:35 -05:00
Shinya Kuribayashi
d1276c76c1 drivers/net/rtl8139.c: Fix tx timeout
"to = (currticks() + RTL_TIMEOUT)" has possibilities to wrap around. If it
does, the condition "(currticks() < to)" becomes invalid and immediately
leads to tx timeout error. This patch introduces the fine-graded udely(10)
loops to ease the impact of wrapping around.

Signed-off-by: Shinya Kuribayashi <shinya.kuribayashi@necel.com>
Cc: Masami Komiya <mkomiya@sonare.it>
Cc: Lucas Jin <lucasjin@gmail.com>
Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2008-01-16 17:37:35 -05: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
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