net: Make netconsole src and dest ports configurable

It is desirable to use different port numbers for sending and receiving
packets with netconsole in the case where you have more than one device
on the local subnet with netconsole enabled for broadcast.  When they
use the same port for both, any output from one will look like input to
the other.  This is typlically not desirable.

This patch allows the input and output ports to be specified separately
in the environment.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Cc: Mike Frysinger <vapier@gentoo.org>
Acked-by: Mike Frysinger <vapier@gentoo.org>
api: net: fix length check in eth_receive()

If the requested length is too small to hold the received packet,
eth_receive() will return -1 and will leave the packet in the receive
buffers. Instead of returning an error in this case, we return the first
portion of the received packet and remove it from the receive buffers.

This fixes FreeBSD's ubldr. Without this patch it will just stop receiving
packets if the NIC receives more than PKTBUFSRX too large packets.

Signed-off-by: Michael Walle <michael@walle.cc>
Cc: Joe Hershberger <joe.hershberger@gmail.com>
Cc: Rafal Jaworowski <raj@semihalf.com>
Cc: Piotr Kruszynski <ppk@semihalf.com>
net: bugfix: NetSetTimeout assumes CONFIG_SYS_HZ=1000

NetSetTimeout sets incorrect value to timeDelta when CONFIG_SYS_HZ != 1000.

Signed-off-by: Tetsuyuki Kobayashi <koba@kmckk.co.jp>
dm: net: Move IXP NPE to drivers/net/

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Bryan Hundven <bryanhundven@gmail.com>
Cc: Michael Schwingen <rincewind@discworld.dascon.de>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: U-Boot DM <u-boot-dm@lists.denx.de>
Cc: Joe Hershberger <joe.hershberger@ni.com>
net: emaclite: Support OF initialization

Support new CONFIG_OF_CONTROL option where device
probing is done based on device tree description.

Signed-off-by: Michal Simek <monstr@monstr.eu>
CC: Joe Hershberger <joe.hershberger@gmail.com>
dm: net: Fixup the armada100 FEC driver

Apply the following questionable adjustment to silence GCC.

armada100_fec.c: In function ‘armdfec_send’:
armada100_fec.c:589:2: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Prafulla Wadaskar <prafulla@marvell.com>
net: sh_eth: Add support R8A7740 of rmobile (arm core)

R8A7740 of rmobile has ethernet device, and this is same IP of
sh-ether. This support R8A7740 of rmobile.

Signed-off-by: Hideyuki Sano <hideyuki.sano.dn@renesas.com>
Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
net: Make the netconsole buffer size configurable

Allow a board to configure a larger buffer for netconsole, but leave
the default.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Cc: Mike Frysinger <vapier@gentoo.org>
Acked-by: Mike Frysinger <vapier@gentoo.org>
net: Improve the speed of netconsole

Previously u-boot would initialize the network interface for every
network operation and then shut it down again.  This makes sense for
most operations where the network in not known to be needed soon after
the operation is complete.  In the case of netconsole, it will use the
network for every interaction with the shell or every printf.  This
means that the network is being reinitialized very often.  On many
devices, this intialization is very slow.

This patch checks for consecutive netconsole actions and leaves the
ethernet hardware initialized between them.  It will still behave the
same old way for all other network operations and any time another
network operation happens between netconsole operations.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Cc: Stefano Babic <sbabic@denx.de>
Acked-by: Stefano Babic <sbabic@denx.de>
net: Allow netconsole settings to change after nc_start

Refresh the netconsole settings from the env before each packet instead
of only on netconsole init.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
net: Filter incoming netconsole packets by IP

Check the incoming packets' source IP address... if ncip isn't set to a
broadcast address, only listen to the client at ncip.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
net: introduce transparent driver private in ueth_data

Avoid clutter in ueth_data. Individual drivers should not mess
with structures belonging to the core like this.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Reviewed-by: Marek Vasut <marex@denx.de>
Acked-by: Marek Vasut <marex@denx.de>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
net: asix: split out basic reset function

The basic device reset ensures that the device is ready to
service commands and does not need to get redone before each
network operation.

Split out the basic reset from asix_init() and instead call it
from asix_eth_get_info(), so that it only gets called once.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
net: asix: add write_hwaddr function

All ASIX chipsets aside from AX88172 are able to set the MAC
address on the hardware level. Add a function to expose this
ability.

To differentiate between chip types we now carry flags as driver
private data. Also while touching the asix_dongles array
constify this.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
net: asix: add read_mac function

Initial device MAC should be read while getting info about the
device, so it's wrong to only read it in asix_init().

Add a dedicated function to read the initial MAC, which is also
able to handle devices that have their initial MAC stored in
EEPROM. Call this function inasix_eth_get_info().

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Reviewed-by: Marek Vasut <marex@denx.de>
Acked-by: Marek Vasut <marex@denx.de>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
net: asix: add AX88772B support

Add AX88772B ID together with two fixes needed to make this work.

1. The packet length check has to be adjusted, as all ASIX chips
only use 11 bits to indicate the length. AX88772B uses the other
bits to indicate unrelated things, which cause the check to fail.
This fix is based on a fix for the Linux kernel by Marek Vasut.
Linux upstream commit: bca0beb9363f8487ac902931a50eb00180a2d14a

2. AX88772B provides several bulk endpoints. Only the first
IN/OUT endpoints work in the default configuration. So stop
enumeration after we found them to avoid overwriting the
endpoint config with a non-working one.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Reviewed-by: Marek Vasut <marex@denx.de>
Acked-by: Marek Vasut <marex@denx.de>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
net: Add driver for Zynq Gem IP

Device driver for Zynq Gem IP.

Signed-off-by: Michal Simek <monstr@monstr.eu>
CC: Joe Hershberger <joe.hershberger@gmail.com>
CC: Marek Vasut <marex@denx.de>
Acked-by: Marek Vasut <marex@denx.de>
malloc: remove extern declarations of malloc_bin_reloc() in board.c files

Declare malloc_bin_reloc() in malloc.h and remove all extern declarations
in various board.c files to get rid of one checkpatch.pl warning.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@googlemail.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Andreas Bießmann <andreas.devel@gmail.com>
Cc: Jason Jin <Jason.jin@freescale.com>
Cc: Macpaul Lin <macpaul@andestech.com>
Cc: Daniel Hellstrom <daniel@gaisler.com>
Acked-by: Andreas Bießmann <andreas.devel@gmail.com>
patman: Use reverse order for changelog

Specially when many revisions are need for a patchset, the most
interesting information is about the last set of changes so we output
the changelog in reverse order to easy identification of most recent
change set.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Acked-by: Simon Glass <sjg@chromium.org>
README.commands: Document what UNDEF_SYM does

Changes in v2:
- Reword a bit more

Signed-off-by: Tom Rini <trini@ti.com>