aboutsummaryrefslogtreecommitdiff
path: root/net/eth.c
AgeCommit message (Collapse)Author
2012-04-25net: allow setting env enetaddr from net device settingRob Herring
If the net driver has setup a valid ethernet address and an ethernet address is not set in the environment already, then set the environment variables from the net driver setting This enables pxe booting on boards which don't set ethaddr env variable. Signed-off-by: Rob Herring <rob.herring@calxeda.com>
2012-04-03net/eth.c: fix eth_write_hwaddr() to use dev->enetaddr as fall backEric Miao
Ignore the return value of eth_getenv_enetaddr_by_index(), and if it fails, fall back to use dev->enetaddr, which could be filled up by the ethernet device driver: With the current code, introduced with below commit, eth_write_hwaddr() will fail immediately if there is no eth<n>addr in the environment variables. However, e.g. for an overo based product that uses the SMSC911x ethernet chip (with the MAC address set via EEPROM connected to the SMSC911x chip), the MAC address is still OK. On mx28 boards that are depending on the OCOTP bits to set the MAC address (like the Denx m28 board), the OCOTP bits should be used instead of failing on the environment variables. Actually, this was the original behavior, and was later changed by commit 7616e7850804c7c69e0a22c179dfcba9e8f3f587. Signed-off-by: Eric Miao <eric.miao@linaro.org> Acked-by: Simon Glass <sjg@chromium.org> Acked-by: Dirk Behme <dirk.behme@de.bosch.com> CC: Stefan Roese <sr@denx.de> CC: Eric Miao <eric.miao@linaro.org> CC: Wolfgang Denk <wd@denx.de> CC: Philip Balister <philip@balister.org> CC: Zach Sadecki <zach@itwatchdogs.com>
2012-03-18bootstage: Replace show_boot_progress/error() with bootstage_...()Simon Glass
These calls should not be made directly any more, since bootstage will call the show_boot_...() functions as needed. Signed-off-by: Simon Glass <sjg@chromium.org>
2012-03-18bootstage: Convert net progress numbers to enumsSimon Glass
This changes over the network-related progress numbers to use enums from bootstage.h. Signed-off-by: Simon Glass <sjg@chromium.org>
2012-03-18bootstage: Use show_boot_error() for -ve progress numbersSimon Glass
Rather than the caller negating our progress numbers to indicate an error has occurred, which seems hacky, add a function to indicate this. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Mike Frysinger <vapier@gentoo.org>
2012-03-18net/miiphy/serial: drop duplicate "NAMESIZE" defineMike Frysinger
A few subsystems are using the same define "NAMESIZE". This has been working so far because they define it to the same number. However, I want to change the size of eth_device's NAMESIZE, so rather than tweak the define names, simply drop references to it. Almost no one does, and the handful that do can easily be changed to a sizeof(). Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-03-06PPC: Drop mv6446x_eth_initialize() from net/eth.cMarek Vasut
This function was defined as an extern in net/eth.c, drop that and use standard means of calling it. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Stefan Roese <sr@denx.de>
2012-03-06PPC: Drop mv6436x_eth_initialize() from net/eth.cMarek Vasut
This function was defined as an extern in net/eth.c, drop that and use standard means of calling it. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Reinhard Arlt <reinhard.arlt@esd-electronics.com>
2012-03-03eth: remove usb-ethernet devices before re-enumerating themVincent Palatin
Fix the crash when running several times usb_init() with a USB ethernet device plugged. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> Tested-by: Wolfgang Grandegger <wg@denx.de>
2011-12-20net: introduce per device indexMichael Walle
Instead of counting the device index everytime a functions needs it, store it in the eth_device struct. eth_register() keeps track of the indices and updates the device's index number. This simplifies some functions in net/eth.c. Additionally, a network driver can now query its index, eg. to get the correct environment ethaddr name. Signed-off-by: Michael Walle <michael@walle.cc> Cc: Prafulla Wadaskar <prafulla@marvell.com> Cc: Mike Frysinger <vapier@gentoo.com> Cc: Wolfgang Denk <wd@denx.de> Acked-by: Mike Frysinger <vapier@gentoo.org>
2011-10-05net: drop !NET_MULTI codeMike Frysinger
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-05net: drop !NET_MULTI ns7520 driverMike Frysinger
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-01net: Add \n before warning message so it prints on a new line.Philip Balister
Signed-off-by: Philip Balister <philip@opensdr.com>
2011-09-21net: turn name len check into an assertMike Frysinger
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-09net/eth.c: throw BUG for eth_get_dev_by_name(NULL)Helmut Raiger
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-05Correct call to eth_write_hwaddr()Simon Glass
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-04net: Check network device driver nameMichal Simek
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-08-08Add Ethernet hardware MAC address framework to usbnetSimon Glass
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-03net/eth.c: drop obsolete at91rm9200 supportAndreas Bießmann
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-04-20Create PHY Lib for U-BootAndy Fleming
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-02-19Fix compile warning in net/eth.cRemy Bohmer
Signed-off-by: Remy Bohmer <linux@bohmer.net>
2011-02-19Add USB host ethernet adapter supportSimon Glass
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>
2010-11-15Net: clarify board/cpu_eth_init callsBen Warren
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-10-11Net: Remove redundant CONFIG_NET_MULTI directivesBen Warren
All are within an #ifdef CONFIG_NET_MULTI block already Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2010-08-09Fix compile warnings for const correctnessBen Warren
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-07-12net: warn about spaces in device namesMike Frysinger
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-06-20net/eth.c: eth_mac_skip() is only needed when CONFIG_NET_MULTI is setWolfgang Denk
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-05-03Program net device MAC addresses after initializingBen Warren
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-03net: Trivial coding style issue with empty for statementDetlev Zundel
Signed-off-by: Detlev Zundel <dzu@denx.de> Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2009-12-13net: pull CONFIG checks out of source and into makefileMike Frysinger
Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2009-08-07net: sync env ethaddr to device enetaddr in eth_init()Mike Frysinger
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-07minor debug cleanups in ./netRobin Getz
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-07-22Add warning about upcoming removal of old Ethernet APIBen Warren
Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2009-06-15Remove support for non-CONFIG_NET_MULTI on PPC4xx EMACBen Warren
Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2009-06-15Switched davinci_emac Ethernet driver to use newer APIBen Warren
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-05-15netloop: updates for NetLoopHeiko Schocher
Fix some issues introduced from commit: 2f70c49e5b9813635ad73666aa30f304c7fdeda9 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-04-28Replace __attribute references with __attribute__Peter Tyser
__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-03-20net: new utility functions for working with enetaddr'sMike Frysinger
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-02-22netloop: speed up NetLoopHeiko Schocher
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-16Add eth_get_dev_by_indexAndy Fleming
This allows code to iterate through the ethernet devices Signed-off-by: Andy Fleming <afleming@freescale.com>
2008-11-09Moved initialization of PPC4xx EMAC to cpu_eth_init()Ben Warren
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-09Changed PPC4xx EMAC driver to require CONFIG_PPC4xx_EMACBen Warren
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-09Moved initialization of MPC8XX SCC to cpu_eth_init()Ben Warren
Removed initialization of the driver from net/eth.c Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2008-11-09Moved initialization of MPC8220 FEC to cpu_eth_init()Ben Warren
Removed initialization of the driver from net/eth.c Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2008-11-09Moved initialization of QE Ethernet controller to cpu_eth_init()Ben Warren
Removed initialization of the driver from net/eth.c Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2008-11-09Moved initialization of FCC Ethernet controller to cpu_eth_initBen Warren
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-09net: Move initialization of Au1x00 SoC ethernet MAC to cpu_eth_initShinya Kuribayashi
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-09Moved initialization of IXP4XX_NPE Ethernet controller to cpu_eth_init()Ben Warren
Also, removed the driver initialization from net/eth.c Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2008-10-18Adds two more ethernet interface to 83xxrichardretanubun
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-09-02Moved initialization of EEPRO100 Ethernet controller to board_eth_init()Ben Warren
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>