Commit Graph

152 Commits

Author SHA1 Message Date
Mike Frysinger
e2a53458a7 net: drop !NET_MULTI code
This is long over due.  All but two net drivers have been converted, but
those have now been dropped.

The only thing left to do is actually delete all references to NET_MULTI
and code that is compiled when that is not defined.  So here we scrub the
core code.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-10-05 22:22:16 +02:00
Mike Frysinger
d90f0c107b net: drop !NET_MULTI ns7520 driver
This driver was never converted to NET_MULTI, and no board uses it.
So punt it and be done.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-10-05 22:22:15 +02:00
Philip Balister
a9a730e0bc net: Add \n before warning message so it prints on a new line.
Signed-off-by: Philip Balister <philip@opensdr.com>
2011-10-01 21:55:42 +02:00
Mike Frysinger
ff25d32c25 net: turn name len check into an assert
The new sanity check introduces a printf warning for some systems:
	eth.c:233: warning: format '%zu' expects type 'size_t', but argument 3 has type 'int'

Rather than tweak the format string, use the new assert() helper instead.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-09-21 23:04:34 +02:00
Helmut Raiger
7e7f903fcd net/eth.c: throw BUG for eth_get_dev_by_name(NULL)
eth_get_dev_by_name() is not safe to use for devname being NULL
as it uses strcmp. This patch makes it fail with a BUG().

Signed-off-by: Helmut Raiger <helmut.raiger@hale.at>
Acked-by: Mike Frysinger <vapier@gentoo.org>
2011-09-09 23:58:47 +02:00
Simon Glass
019fd6d45b Correct call to eth_write_hwaddr()
This fixes "Warning: failed to set MAC address" on platforms which rely on
an 'ethaddr' environment variable to set the MAC address.

This bug was introduced by this commit:

7616e785 Add Ethernet hardware MAC address framework to usbnet

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Kumar Gala <galak@kernel.crashing.org>
Tested-by: Michal Simek <monstr@monstr.eu>
Tested-by: Heiko Schocher <hs@denx.de>
2011-09-05 16:06:06 +02:00
Michal Simek
58c583b6c2 net: Check network device driver name
If name is longer than allocated space NAMESIZE
mac address is rewritten which show error
message like:

Error message:
Warning: Xlltemac.87000000 MAC addresses don't match:
Address in SROM is         30:00:00:00:00:00
Address in environment is  00:0a:35:00:6a:04

NAMESIZE contains Driver name + zero terminated character.

Signed-off-by: Michal Simek <monstr@monstr.eu>
2011-09-04 23:29:39 +02:00
Simon Glass
7616e78508 Add Ethernet hardware MAC address framework to usbnet
Built-in Ethernet adapters support setting the mac address by means of a
ethaddr environment variable for each interface (ethaddr, eth1addr, eth2addr).

This adds similar support to the USB network side, using the names
usbethaddr, usbeth1addr, etc. They are kept separate since we don't want
a USB device taking the MAC address of a built-in device or vice versa.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Eric Bénard <eric@eukrea.com>
2011-08-08 21:05:23 +02:00
Andreas Bießmann
d1228ea900 net/eth.c: drop obsolete at91rm9200 support
All available at91rm9200 boards have migrated to ar920t/at91 and
therefore to CONFIG_NET_MULTI.
The obsolete at91rm9200_miiphy_initialize() was removed in "ARM: remove
obsolete at91rm9200".

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
2011-08-03 13:00:56 +02:00
Andy Fleming
5f184715ec Create PHY Lib for U-Boot
Extends the mii_dev structure to participate in a full-blown MDIO and
PHY driver scheme.  The mii_dev structure and miiphy calls are modified
in such a way to allow the original mii command and miiphy
infrastructure to work as before, but also to support a new set of APIs
which allow (among other things) sharing of PHY driver code and 10G support

The mii command will continue to support normal PHY management functions
(Clause 22 of 802.3), but will not be changed to support 10G
(Clause 45).

The basic design is similar to PHY Lib from Linux, but simplified for
U-Boot's network and driver infrastructure.

We now have MDIO drivers and PHY drivers

An MDIO driver provides:
read
write
reset

A PHY driver provides:
(optionally): probe
config - initial setup, starting of auto-negotiation
startup - waiting for AN, and reading link state
shutdown - any cleanup needed

The ethernet drivers interact with the PHY Lib using these functions:
phy_connect()
phy_config()
phy_startup()
phy_shutdown()

Each PHY driver can be configured separately, or all at once using
config_phylib_all_drivers.h (added in the patch which adds the drivers)

We also provide generic drivers for Clause 22 (10/100/1000), and
Clause 45 (10G) PHYs.

We also implement phy_reset(), and call it in phy_connect(). Because
phy_reset() is essentially the same as miiphy_reset, but:
a) must support 10G PHYs, and
b) should use the phylib primitives,

we implement miiphy_reset, using phy_reset(), but only when
CONFIG_PHYLIB is set. Otherwise, we just use the old version. In this
way, we save on compile size, even if we don't manage to save code size.

Pulled ethtool.h and mdio.h from:
git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6
782d640afd15af7a1faf01cfe566ca4ac511319d
With many, many deletions so as to enable compilation under u-boot

Signed-off-by: Andy Fleming <afleming@freescale.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Acked-by: Detlev Zundel <dzu@denx.de>
2011-04-20 15:09:19 -05:00
Remy Bohmer
c650e1be41 Fix compile warning in net/eth.c
Signed-off-by: Remy Bohmer <linux@bohmer.net>
2011-02-19 20:32:38 +01:00
Simon Glass
89d48367ed Add USB host ethernet adapter support
This adds support for using USB Ethernet dongles in host mode. This is just
the framework - drivers will come later. A new config option called
CONFIG_USB_HOST_ETHER can be defined in board config files to switch this
on.

The was originally written by NVIDIA and was cleaned up for release by the
Chromium authors.

Signed-off-by: Simon Glass <sjg@chromium.org>
2011-02-19 20:32:36 +01:00
Ben Warren
8ad25bf8d9 Net: clarify board/cpu_eth_init calls
This has always been confusing, and the idea of these functions returning the
number of interfaces initialized was half-baked and ultimately pointless.
Instead, act more like regular functions and return < 0 on failure, >= 0 on
success.

This change shouldn't break anything.

Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2010-11-15 00:01:15 +01:00
Ben Warren
68e1ede88a Net: Remove redundant CONFIG_NET_MULTI directives
All are within an #ifdef CONFIG_NET_MULTI block already

Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2010-10-11 22:47:48 -07:00
Ben Warren
d7fb9bcfb2 Fix compile warnings for const correctness
Commit 6e37b1a3a25004d3df5867de49fff6b3fc9c4f04 modifies several net calls
to take a (const char *) parameter instead of (char *), but in some cases
the modified functions call other functions taking (char *).  The end result
is warnings about discarding the const qualifier.

This patch fixes these other function signatures.

Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2010-08-09 11:52:30 -07:00
Mike Frysinger
1384f3bb8a net: warn about spaces in device names
Some commands operate on eth device names (like 'mii'), but those cannot
be passed on the command line as one argument.  So detect devices like
these and warn about them so someone will fix it.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2010-07-12 00:14:28 -07:00
Wolfgang Denk
9c00b2f0a3 net/eth.c: eth_mac_skip() is only needed when CONFIG_NET_MULTI is set
Move it inside the #ifdef CONFIG_NET_MULTI to avoid

	eth.c:64: warning: 'eth_mac_skip' defined but not used

messages from anumber of old, non-CONFIG_NET_MULTI boards.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Ben Warren <biggerbadderben@gmail.com>
2010-06-20 12:30:22 +02:00
Ben Warren
ecee9324d7 Program net device MAC addresses after initializing
Add a new function to the eth_device struct for programming a network
controller's hardware address.

After all network devices have been initialized and the proper MAC address
for each has been determined, make a device driver call to program the
address into the device.  Only device instances with valid unicast addresses
will be programmed.

Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
Acked-by: Detlev Zundel <dzu@denx.de>
Tested-by: Prafulla Wadaskar <prafulla@marvell.com>
Tested-by: Heiko Schocher <hs@denx.de>
Tested-by: Thomas Chou <thomas@wytron.com.tw>
2010-05-03 14:52:49 -07:00
Detlev Zundel
aba4b69d01 net: Trivial coding style issue with empty for statement
Signed-off-by: Detlev Zundel <dzu@denx.de>
Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2010-05-03 14:52:47 -07:00
Mike Frysinger
6ac59c5518 net: pull CONFIG checks out of source and into makefile
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2009-12-13 21:31:26 -08:00
Mike Frysinger
86848a74c3 net: sync env ethaddr to device enetaddr in eth_init()
In the previous enetaddr refactoring, the assumption with commit 56b555a644
was that the eth layer would handle the env -> device enetaddr syncing.
This was not the case as eth_initialize() is called only once and the sync
occurs there.  So make sure the eth_init() function does the env -> device
sync with every network init.

Reported-by: Andrzej Wolski <awolski@poczta.fm>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2009-08-07 17:39:23 -07:00
Robin Getz
0ebf04c607 minor debug cleanups in ./net
Minor ./net cleanups - no functional changes
  - change #ifdef DEBUG printf(); #endif to just debug()
  - changed __FUNCTION__ to __func__
  - got rid of extra whitespace between function and opening brace
  - removed unnecessary braces on if statements

 gcc dead code elimination should make this functionally/size equivalent
 when DEBUG is not defined. (confirmed on Blackfin, with gcc 4.3.3).

 Signed-off-by: Robin Getz <rgetz@blackfin.uclinux.org>

Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2009-08-07 17:32:16 -07:00
Ben Warren
3bd0a877b7 Add warning about upcoming removal of old Ethernet API
Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2009-07-22 22:53:44 -07:00
Ben Warren
6e0d2fc7fe Remove support for non-CONFIG_NET_MULTI on PPC4xx EMAC
Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2009-06-15 00:13:54 -07:00
Ben Warren
8453587ef9 Switched davinci_emac Ethernet driver to use newer API
Added CONFIG_NET_MULTI to all Davinci boards
Removed all calls to Davinci network driver from board code
Added cpu_eth_init() to cpu/arm926ejs/cpu.c

Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2009-06-15 00:13:54 -07:00
Heiko Schocher
da95427ce4 netloop: updates for NetLoop
Fix some issues introduced from commit:
2f70c49e5b
suggested by Mike Frysinger.

- added some comment for the env_id variable in common_cmd_nvedit.c
- moved some variables in fn scope instead of file scope
- NetInitLoop now static void

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Ben Warren <biggerbadderben@gmail.com>
2009-05-15 21:19:02 +02:00
Peter Tyser
f9a109b3ad Replace __attribute references with __attribute__
__attribute__ follows gcc's documented syntax and is generally more
common than __attribute.  This change is only asthetic and should not
affect functionality.

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
2009-04-28 01:01:39 +02:00
Mike Frysinger
3f6e6993e9 net: new utility functions for working with enetaddr's
Declare new utility functions for converting between the environment
variables (eth*addr) and the binary MAC address representation.  This way
we can unify all the random places that already do this kind of thing.

The functions in question:
	eth_parse_enetaddr - "..." -> {...}
	eth_getenv_enetaddr - env -> {...}
	eth_setenv_enetaddr - {...} -> env

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
CC: Ben Warren <biggerbadderben@gmail.com>
2009-03-20 22:39:09 +01:00
Heiko Schocher
2f70c49e5b netloop: speed up NetLoop
NetLoop polls every cycle with getenv some environment variables.
This is horribly slow, especially when the environment is big.

This patch reads only the environment variables in NetLoop,
when they were changed.

Also moved the init part of the NetLoop function in a seperate
function.

Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2009-02-22 23:49:33 -08:00
Andy Fleming
9e56986a2b Add eth_get_dev_by_index
This allows code to iterate through the ethernet devices

Signed-off-by: Andy Fleming <afleming@freescale.com>
2009-02-16 18:05:53 -06:00
Ben Warren
25a859066b Moved initialization of PPC4xx EMAC to cpu_eth_init()
Removed initialization of the driver from net/eth.c

Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
Acked-by: Stefan Roese <sr@denx.de>
2008-11-09 21:38:05 -08:00
Ben Warren
96e21f86e8 Changed PPC4xx EMAC driver to require CONFIG_PPC4xx_EMAC
All in-tree IBM/AMCC PPC4xx boards using the EMAC get this new CONFIG

Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
Acked-by: Stefan Roese <sr@denx.de>
2008-11-09 21:38:04 -08:00
Ben Warren
9eb79bd885 Moved initialization of MPC8XX SCC to cpu_eth_init()
Removed initialization of the driver from net/eth.c

Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2008-11-09 21:38:03 -08:00
Ben Warren
a9bec96d63 Moved initialization of MPC8220 FEC to cpu_eth_init()
Removed initialization of the driver from net/eth.c

Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2008-11-09 21:38:03 -08:00
Ben Warren
0e8454e990 Moved initialization of QE Ethernet controller to cpu_eth_init()
Removed initialization of the driver from net/eth.c

Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2008-11-09 21:38:03 -08:00
Ben Warren
3456a14827 Moved initialization of FCC Ethernet controller to cpu_eth_init
Affected boards:
    Several MPC8xx boards
    Several MPC8260/MPC8272 boards
    Several MPC85xx boards

Removed initialization of the driver from net/eth.c

Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2008-11-09 21:38:02 -08:00
Shinya Kuribayashi
5dfb3ee3f5 net: Move initialization of Au1x00 SoC ethernet MAC to cpu_eth_init
This patch will move au1x00_eth_initialize from net/eth.c to cpu_eth_init
as a part of ongoing eth_initialize cleanup work.  The function ret value
is also fixed as it should be negative on fail.

Signed-off-by: Shinya Kuribayashi <skuribay@ruby.dti.ne.jp>
Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2008-11-09 21:38:02 -08:00
Ben Warren
cc94074eca Moved initialization of IXP4XX_NPE Ethernet controller to cpu_eth_init()
Also, removed the driver initialization from net/eth.c

Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2008-11-09 21:38:02 -08:00
richardretanubun
c68a05feeb Adds two more ethernet interface to 83xx
Added as a convenience for other platforms that uses MPC8360 (has 8 UCC).
Six eth interface is chosen because the platform I am using combines
UCC1&2 and UCC3&4 as 1000 Eth and the other four UCCs as 10/100 Eth.

Signed-off-by: Richard Retanubun <RichardRetanubun@RugggedCom.com>
Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2008-10-18 21:54:00 +02:00
Ben Warren
10efa024b8 Moved initialization of EEPRO100 Ethernet controller to board_eth_init()
Affected boards:
	db64360
	db64460
	katmai
	taihu
	taishan
	yucca
	cpc45
	cpu87
	eXalion
	elppc
	debris
	kvme080
	mpc8315erdb
	integratorap
	ixdp425
	oxc
	pm826
	pm828
	pm854
	pm856
	ppmc7xx
	sc3
	sc520_spunk
	sorcery
	tqm8272
	tqm85xx
	utx8245

Removed initialization of the driver from net/eth.c
Also, wrapped contents of pci_eth_init() by CONFIG_PCI.

Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2008-09-02 21:18:19 -07:00
Ben Warren
8ca0b3f99c Moved initialization of TULIP Ethernet controller to board_eth_init()
Affected boards:
	cu824
	bab7xx
	adciop
	dasa_sim
	mousse
	mpc8540eval
	musenki
	mvblue
	pcippc2/pcippc6
	sbc8240
	stxssa

Removed initialization of the driver from net/eth.c

Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2008-09-02 21:18:18 -07:00
Ben Warren
ad3381cf41 Moved initialization of E1000 Ethernet controller to board_eth_init()
Affected boards:
	ap1000
	mvbc_p
	PM854

Removed initialization of the driver from net/eth.c

Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2008-09-02 21:18:18 -07:00
Ben Warren
4fce2aceaf Moved initialization of plb2800 Ethernet driver to board_eth_init
Affected boards:
	purple

Removed initialization of controller from net/eth.c

Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2008-09-02 21:18:18 -07:00
Ben Warren
e1d7480b5d Moved initialization of MPC5xxx_FEC Ethernet driver to CPU directory
Modified board_eth_init() functions of boards that have this FEC in addition
to other Ethernet controllers.

Affected boards:
	bc3450
	icecube
	mvbc_p
	o2dnt
	pm520
	total5200
	tq5200

Removed initialization of controller from net/eth.c

Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2008-09-02 21:18:18 -07:00
Ben Warren
a0aad08f94 Moved initialization of MPC512x_FEC Ethernet driver to CPU directory
Added a cpu_eth_init() function to MPC512x CPU directory and
removed code from net/eth.c

Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2008-09-02 21:18:17 -07:00
Ben Warren
8218bd2aa6 Moved initialization of IncaIP Ethernet controller to board_eth_init
Affected boards:
	IncaIP

Removed initialization of the driver from net/eth.c

Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2008-09-02 21:18:17 -07:00
Ben Warren
164846eeb2 Moved initialization of 3COM Ethernet controller (AmigaOne) to board_eth_init()
Affected boards:
        AmigaOneG3SE

    Removed initialization of the driver from net/eth.c

Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2008-09-02 21:18:17 -07:00
Ben Warren
6aca145e06 Moved initialization of GT6426x Ethernet controller to board_eth_init()
Affected boards:
	EVB64260
	P3G4
	ZUMA

Removed initialization of the driver from net/eth.c

Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2008-09-02 21:18:17 -07:00
Ben Warren
e3090534d6 Moved initialization of PCNET Ethernet controller to board_eth_init()
Affected boards:
	PN62
	sc520_cdp

Removed initialization of the driver from net/eth.c

Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2008-09-02 21:18:17 -07:00
Ben Warren
b902b8dda5 Moved initialization of NATSEMI Ethernet controller to board_eth_init()
Affected boards:
	a3000

Removed initialization of the driver from net/eth.c

Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2008-09-02 21:18:17 -07:00