summaryrefslogtreecommitdiffstats
path: root/net/eth.c
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'for-next/net'Sascha Hauer2015-08-061-0/+8
|\
| * net: make eth_register_ethaddr work on registered network devicesSascha Hauer2015-07-281-0/+8
| | | | | | | | | | | | | | When eth_register_ethaddr is called after the device has been registered it should work aswell. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | net: eth_send: Allow to use multiple network interfaces at onceAntony Pavlov2015-07-231-1/+1
|/ | | | | | | | | | | | | | | | | | | | The commit commit be0404c21f22da2d736168b2e56a9ae583cc3e95 Author: Sascha Hauer <s.hauer@pengutronix.de> Date: Wed May 14 16:08:04 2014 +0200 net: Allow to use multiple network interfaces at once changes the eth_send() function: - return eth_current->send(eth_current, packet, length); + return edev->send(eth_current, packet, length); But we have to change the both eth_current occurrences to edev here! Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: eth: Do not rely on CONFIG_PARAMETER to be enabledSascha Hauer2015-06-261-8/+19
| | | | | | | | | register_preset_mac_address only works when CONFIG_PARAMETER is enabled because otherwise dev_set_param is a no-op. Add a function to set the MAC address explicitly without the need of CONFIG_PARAMETER and use it where appropriate. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* eth: halt active ethernet device on unregisterSascha Hauer2015-04-281-0/+3
| | | | | | | When an active ethernet device is unregistered it should be halted to quiesce the device. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: Call edev->recv with correct eth_deviceSascha Hauer2014-09-171-1/+1
| | | | | | | | edev->recv has to be called with edev as argument, not eth_current. This fixes networking when multiple network devices are used and the current one is switched during runtime. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: take eth id from devicetree aliasSascha Hauer2014-05-151-2/+11
| | | | | | | If the devicetree has an alias for the ethernet device, then use it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: Allow to use multiple network interfaces at onceSascha Hauer2014-05-151-27/+31
| | | | | | | | | | | | | | | | In barebox network packets always go out at the current ethernet device and are expected to be received from the current interface. This has some side effects. When for example an NFS is mounted when one interface is active and the interface is changed afterwards the NFS packets leave the new interface, but the NFS server won't be reachable there. Instead of changing the whole network traffic to the current ethernet interface we now initialize a network connection with the current network interface, but then the connection will continue to use that interface even when the current interface is changed. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* param: Add dev_add_param_macSascha Hauer2014-04-041-11/+3
| | | | | | | This adds a convenience function to register a MAC address device parameter. The only current user is converted to use it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/nfs'Sascha Hauer2014-03-071-1/+1
|\ | | | | | | | | Conflicts: defaultenv/defaultenv-2-base/bin/ifup
| * net: constify eth_get_byname argumentSascha Hauer2014-03-071-1/+1
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/mtd'Sascha Hauer2014-03-071-2/+0
|\ \ | | | | | | | | | | | | | | | Conflicts: drivers/mtd/core.c net/eth.c
| * | device: remove parameters when unregistering a deviceSascha Hauer2014-02-131-2/+0
| |/ | | | | | | | | | | | | | | Otherwise we loose memory on each device_unregister. The ethernet code used to do this before calling unregister_device. This can now be removed. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / remove redundant NULL check on freeLucas Stach2014-02-101-1/+1
|/ | | | | | | | free() already checks the pointer to be non NULL. No need to do it again. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: Add missing includesSascha Hauer2013-11-081-0/+1
| | | | | | | | A lot of files rely on include/driver.h including include/of.h (and this including include/errno.h. include the files explicitly so we can eventually get rid of including of.h from driver.h Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: Add a context pointer to fixup functionsSascha Hauer2013-11-061-2/+2
| | | | | | | If drivers want to fixup their specific instance they need some context to know which instance they have to fixup. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net, of: fixup MAC address by aliasRenaud Barbier2013-09-051-10/+12
| | | | | | | | | If a network device has not been registered from the devicetree, we may still find it by its alias in the devicetree. This way also platform based network devices can obtain a valid MAC address in the devicetree. Signed-off-by: Renaud Barbier <renaud.barbier@ge.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: net: Use correct devicetree in eth_of_fixupSascha Hauer2013-07-271-1/+1
| | | | | | | | eth_of_fixup() is passed a devicetree, so use this one instead of the internal devicetree. This makes sure it also works when the tree to fixup is not the internal one. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next-manual/oftree-linux-sync'Sascha Hauer2013-07-021-1/+1
|\
* | net: Set mac-address propertySascha Hauer2013-06-051-0/+54
|/ | | | | | | | | | Linux normally has no idea how to retrieve MAC Addresses, but instead expects the MAC address in the devicetree. This patch adds the MAC address to the devicetree for Linux if we find a valid one in barebox. This mechanism is limited of course to devices barebox has a driver for and which are probed themselves from the devicetree. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: Add of_register_ethaddrSascha Hauer2013-05-211-12/+56
| | | | | | | | | | | | We already have a possibility to register a MAC address provider based on a ethernet device id. This adds a similar functionality for devices probed from devicetree. Code can register itself to be a MAC address provider for a certain devicetree node. This helps on i.MX to let the IIM unit provide a MAC address for the FEC. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: store ethernet device parameters in deviceSascha Hauer2013-04-111-33/+7
| | | | | | | | Rather than storing the parameters globally and trying to keep them in sync with the device parameters, store the parameters in the ethernet device directly. Also, update to dev_add_param_ip(). Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'pu/net-link'Sascha Hauer2012-12-131-0/+3
|\
| * net phylib: force to wait for linkSascha Hauer2012-12-121-0/+3
| | | | | | | | | | | | | | | | When starting a network device wait until the link is up. Otherwise autobooting does not work with little timeout and several attempts have to be made until the network is finally up. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | drivers/base: fix corrupt device treeSascha Hauer2012-12-121-1/+1
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dev_add_child is a very unsafe function. If called multiple times it allows setting the same device to different parents thus corrupting the siblings list. This happens regularly since: | commit c2e568d19c5c34a05a1002d25280bf113b72b752 | Author: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> | Date: Sat Nov 3 16:11:05 2012 +0100 | | bus: add bus device | | automatically add it as parent of any bus device if none already specified | | we have now a nice output per bus If for example a FATfs is mounted this nice output per bus often ends with: > `---- fat0 > `---- 0 > `---- 0x86f0000087020031-0x86f000410df27124: /dev/<NULL> > `---- sram00 > `---- 0x00000000-0xffffffffffffffff: /dev/<NULL> > `---- 0x00000000-0xffffffffffffffff: /dev/<NULL> > unable to handle NULL pointer dereference at address 0x0000000c > pc : [<87f08a20>] lr : [<87f08a04>] > sp : 86eff8c0 ip : 87f3fbde fp : ffffffff > r10: ffffffff r9 : 00000000 r8 : 00000003 > r7 : 86f075b8 r6 : 00000002 r5 : ffffffec r4 : 86f07544 > r3 : 00000000 r2 : 43f900b4 r1 : 00000020 r0 : 00000005 > Flags: Nzcv IRQs off FIQs off Mode SVC_32 > [<87f08a20>] (do_devinfo_subtree+0x90/0x130) from [<87f08a90>] (do_devinfo_subtree+0x100/0x130) > > [<87f3e070>] (unwind_backtrace+0x0/0x90) from [<87f28514>] (panic+0x28/0x3c) > [<87f28514>] (panic+0x28/0x3c) from [<87f3e4b8>] (do_exception+0x10/0x14) > [<87f3e4b8>] (do_exception+0x10/0x14) from [<87f3e544>] (do_data_abort+0x2c/0x38) > [<87f3e544>] (do_data_abort+0x2c/0x38) from [<87f3e268>] (data_abort+0x48/0x60) This patch fixes this by adding a device to its parents children list in register_device so that dev_add_child is no longer needed. This function is removed from the tree. Now callers of register_device have to clearly set the parent *before* registering a device. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reported-by: Jan Lübbe <jlu@pengutronix.de>
* net phylib: Call phy_update_status when no link is presentSascha Hauer2012-12-081-1/+2
| | | | | | | | | | | | We call phy_update_status only once in 5 seconds. This makes sure we do not have great overhead when using ethernet devices. However, if phylib tells us the link is down anyway, there won't be ethernet transfers, so it doesn't hurt to call phy_update_status in this case. This makes sure we can use the ethernet device when the link comes up and do not have an additional 5 second penalty in this case. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2012-11-161-1/+1
|\ | | | | | | | | | | | | Conflicts: commands/Makefile Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * eth: register device a pure deviceJean-Christophe PLAGNIOL-VILLARD2012-11-121-1/+1
| | | | | | | | | | | | | | as we do not need to probe them and they have no driver or bus attached Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | net eth: make edev->init optionalSascha Hauer2012-10-301-1/+2
|/ | | | | | | | | | edev->init is called at eth_register time unconditionally and is supposed to initialize the ethernet hardware. Since it's called unconditionally this could be done by the driver without having an additional hook. Some drivers need their initialization done earlier since they also register a mdiobus which does hardware accesses on registration time. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* switch all platform_bus device/driver registering to ↵Jean-Christophe PLAGNIOL-VILLARD2012-10-041-1/+1
| | | | | | | | platform_driver/device_register now register_driver and register_device are for bus only usage. Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* Merge branch 'for-next/remove-fsf-address'Sascha Hauer2012-10-031-4/+0
|\ | | | | | | | | | | Conflicts: drivers/net/miidev.c include/miidev.h
| * Treewide: remove address of the Free Software FoundationSascha Hauer2012-09-171-4/+0
| | | | | | | | | | | | | | The FSF address has changed in the past. Instead of updating it each time the address changes, just drop it completely treewide. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | net/eth: fix link handlingSascha Hauer2012-09-271-18/+57
| | | | | | | | | | | | | | Check link status on eth device open time and then periodically every 5 seconds. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | net: introduce phylibJean-Christophe PLAGNIOL-VILLARD2012-09-251-2/+6
|/ | | | | | | | | | | | | | | | Adapt phylib from linux switch all the driver to it reimplement mii bus This will allow to have - phy drivers - to only connect the phy at then opening of the device - if the phy is not ready or not up fail on open Same behaviour as in linux and will allow to share code and simplify porting. Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* Merge branch 'for-next/ethernet'Sascha Hauer2012-07-021-1/+1
|\
| * eth: eth MAC addresses are six bytesJohannes Stezenbach2012-06-301-1/+1
| | | | | | | | | | | | | | | | Reduce confusion by making clear six bytes are passed, not a string. Signed-off-by: Johannes Stezenbach <js@sig21.net> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | net: Use dev_name directlySascha Hauer2012-06-281-3/+1
|/ | | | | | eth_get_byname uses a selfmade dev_name, use dev_name directly instead. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* complete: eth typo fixJean-Christophe PLAGNIOL-VILLARD2012-05-021-1/+1
| | | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* complete: add eth interface complete supportJean-Christophe PLAGNIOL-VILLARD2012-04-301-0/+21
| | | | | | use it on ethact Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* Use DEVICE_ID_DYNAMIC where applicableSascha Hauer2012-04-161-1/+1
| | | | | | | We now have DEVICE_ID_DYNAMIC for dynamic allocation of device ids, Use it where applicable. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: eth: don't say that MAC comes from EEPROMWolfram Sang2012-04-051-1/+1
| | | | | | | Because it can also come in via other means. Signed-off-by: Wolfram Sang <w.sang@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: use container_of instead of dev->type_dataSascha Hauer2012-02-251-3/+2
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: fix eth device unregistrationSascha Hauer2012-02-141-1/+4
| | | | | | | | We register a device in eth_register, thus we have to unregister it in eth_unregister. Also, if the device we unregister is the current device, we have to set the current eth_device to NULL so that it isn't used anymore. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: make the ethernet device a child of the hardware deviceSascha Hauer2011-08-151-0/+4
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: Add a possibility for boards to give network devices a MAC addressSascha Hauer2011-07-291-1/+58
| | | | | | | | | MAC addresses are sometimes stored at unusual places. This patch makes it possible to give a MAC address to a ethernet device id. This is independent of the device actually being present. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* eth: check the result of edev->get_ethaddrSascha Hauer2011-04-121-2/+4
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: use dev_* for printing network related stuffSascha Hauer2011-03-031-2/+2
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* network: initialize new net device id with -1Sascha Hauer2011-02-181-0/+1
| | | | | | | This autoassigns a id to network devices and makes multiple network devices work again. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: fix printf compiler warningsSascha Hauer2011-01-071-1/+1
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* LED: Add LED trigger supportSascha Hauer2010-12-201-1/+7
| | | | | | | This patch allows to associate LEDs with certain triggers, such as heartbeat or network activity. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>