summaryrefslogtreecommitdiffstats
path: root/drivers/net/phy/phy.c
Commit message (Collapse)AuthorAgeFilesLines
...
* net: phy: Fix crash when no phy is foundSascha Hauer2014-01-201-0/+5
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net/phy/phy.c: fix whitespaceAntony Pavlov2014-01-061-1/+1
| | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: phy: implement detect callback for miibus devicesSascha Hauer2013-12-111-1/+1
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: phy: move phy_init_hw to phy_device_connectSascha Hauer2013-12-111-0/+9
| | | | | | | This is needed when a phy gets registered outsize of phy_device_connect but has to be attached to an ethernet device later. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: phy: track registered state of a phy deviceSascha Hauer2013-12-111-4/+17
| | | | | | | | | With this phy_device_connect only registers a phy device if it wasn't registered already. This allows us to register phy devices outside of ethernet drivers. phy_device_connect will now pick up an already registered phy given that it's not attached to another ethernet device. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: phy: check if a phy already has an ethernet deviceSascha Hauer2013-12-111-0/+3
| | | | | | | | If during a phy_device_connect a phy already has an ehternet device this can only mean it's already attached to another device. return -EBUSY in this case. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: phy: move duplicated code out of if/elseSascha Hauer2013-12-111-18/+9
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: phy: bail out early in phy_device_connectSascha Hauer2013-12-111-29/+37
| | | | | | | | | If an ethernet device already has a phy in phy_device_connect all we have to do is to start autonegotiation. Do this early and bail out so that for the rest of the code it's clear that we have to search for a phy device. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: phy: cleanup attached device handlingSascha Hauer2013-12-111-11/+3
| | | | | | | | | | | phy_register_device() currently requires an attached ethernet device. This is not needed, a phy device can equally well be registered as a standalone device without an ethernet device. Remove the need for an attached ethernet device in phy_register_device. Also, make the edev <-> phy connection on a registered device which simplifies the code. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: phy: Fix get_phy_device return valueSascha Hauer2013-11-251-4/+4
| | | | | | | | A function should either return an ERR_PTR or NULL on failure, but not both. Let get_phy_device() return an ERR_PTR and fix the return checks in mdiobus_scan and phy_device_connect. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net/phy: support of mmd register read and writeJan Weitzel2013-08-311-0/+63
| | | | | | | | | | | Add function for indirect access of the mmd registers, based on linux. phy_read_mmd_indirect phy_write_mmd_indirect Also clean some private mmd functions Signed-off-by: Jan Weitzel <j.weitzel@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net/phy: convert to pr_infoJean-Christophe PLAGNIOL-VILLARD2013-03-091-1/+1
| | | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* phy: fix force modeJean-Christophe PLAGNIOL-VILLARD2013-02-251-0/+4
| | | | | | | | do not try to read the status in force mode the link is up Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'pu/net-link'Sascha Hauer2012-12-131-2/+5
|\
| * net phylib: force to wait for linkSascha Hauer2012-12-121-2/+5
| | | | | | | | | | | | | | | | 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/+2
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Clear BMCR_PDOWN bitSascha Hauer2012-12-081-0/+3
| | | | | | | | Some phys come up with this bit set, clear it so that these phys can work. This has been observed with a ASIX compatible USB ethernet adapter. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/phylib'Sascha Hauer2012-12-071-2/+128
|\ | | | | | | | | Conflicts: drivers/net/phy/phy.c
| * phylib: add fixup supportJean-Christophe PLAGNIOL-VILLARD2012-11-201-0/+96
| | | | | | | | | | | | | | | | if board need specific phy fixup they can register it and then the code will executed only if needed Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * phylib: fix generic phy driver probeJean-Christophe PLAGNIOL-VILLARD2012-11-201-2/+32
| | | | | | | | | | | | | | the generic phy driver is used if no driver are found Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | phylib: fix compiler warningAntony Pavlov2012-11-261-1/+1
|/ | | | | | | | fixes: drivers/net/phy/phy.c:57: warning: no previous prototype for ‘phy_device_create’ Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/phylib'Sascha Hauer2012-11-161-2/+6
|\
| * mdiobus: unbreak phy_device_connect(): honor masked out PHYsAndreas Pretzsch2012-11-121-0/+4
| | | | | | | | | | | | | | | | | | | | commit 89dfe2d2af87f1b803f611d986d4ef383b6ad964 "mdiobus: do not scan the bus at registration time" dropped the check for struct mii_bus element phy_mask while scanning through all addresses. Re-add this check. Signed-off-by: Andreas Pretzsch <apr@cn-eng.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mdiobus: do not scan the bus at registration timeSascha Hauer2012-11-071-2/+2
| | | | | | | | | | | | | | | | | | | | | | Scanning the bus can take some time. If we do not need the ethernet device, this is unnecessary, so delay the scan until the phy device iactually is needed. Andread Pretzsch: Fixup bug in scanning for all devices. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Andreas Pretzsch <apr@cn-eng.de>
* | phy: add phy_drivers_registerJean-Christophe PLAGNIOL-VILLARD2012-11-151-0/+12
|/ | | | | | | to allow to register an array of drivers Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net/eth: fix link handlingSascha Hauer2012-09-271-10/+25
| | | | | | | 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-0/+568
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>