aboutsummaryrefslogtreecommitdiff
path: root/drivers/net/phy
AgeCommit message (Collapse)AuthorFilesLines
2008-10-08phylib: move to dynamic allocation of struct mii_busLennert Buytenhek4-17/+49
This patch introduces mdiobus_alloc() and mdiobus_free(), and makes all mdio bus drivers use these functions to allocate their struct mii_bus'es dynamically. Signed-off-by: Lennert Buytenhek <[email protected]> Signed-off-by: David S. Miller <[email protected]> Acked-by: Andy Fleming <[email protected]>
2008-10-08phylib: rename mii_bus::dev to mii_bus::parentLennert Buytenhek3-3/+3
In preparation of giving mii_bus objects a device tree presence of their own, rename struct mii_bus's ->dev argument to ->parent, since having a 'struct device *dev' that points to our parent device conflicts with introducing a 'struct device dev' representing our own device. Signed-off-by: Lennert Buytenhek <[email protected]> Signed-off-by: David S. Miller <[email protected]> Acked-by: Andy Fleming <[email protected]>
2008-10-08phylib: Wake PHY state machine on interruptTrent Piepho1-0/+6
This way the phy layer will respond to a change in phy state immediately, instead of up to one second later when the state machine timer runs. Signed-off-by: Trent Piepho <[email protected]> Acked-by: Andy Fleming <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2008-10-08PHY: Avoid unnecessary aneg restartsTrent Piepho1-19/+30
The PHY's aneg is configured and restarted whenever the link is brought up, e.g. when DHCP is started after the kernel has booted. This can take the link down for several seconds while auto-negotiation is redone. If the advertised features haven't changed, then it shouldn't be necessary to bring down the link and start auto-negotiation over again. genphy_config_advert() is enhanced to return 0 when the advertised features haven't been changed and >0 when they have been. genphy_config_aneg() then uses this information to not call genphy_restart_aneg() if there has been no change. Signed-off-by: Trent Piepho <[email protected]> Acked-by: Andy Fleming <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2008-10-08phylib: phy_mii_ioctl() fixesLennert Buytenhek1-2/+3
Make the SIOCGMIIPHY case fall through properly (it is supposed to not only return the ID of the default PHY but also to read from that PHY), and make phy_mii_ioctl() return the same error code as generic_mii_ioctl() in case of an unsupported operation. Signed-off-by: Lennert Buytenhek <[email protected]> Acked-by: Andy Fleming <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2008-09-19phylib: allow incremental scanning of an mii busLennert Buytenhek1-41/+48
This patch splits the bus scanning code in mdiobus_register() off into a separate function, and makes this function available for calling from external code. This allows incrementally scanning an mii bus, e.g. as information about which addresses are 'safe' to scan becomes available. Signed-off-by: Lennert Buytenhek <[email protected]> Acked-by: Andy Fleming <[email protected]>
2008-07-22net/phy: Fix 88e1111 copper/fiber selection in RGMII modeWang Jian1-4/+1
MII_M1111_HWCFG_FIBER_COPPER_RES is a bit of MII_M1111_PHY_EXT_SR, not MII_M1111_PHY_EXT_CR. Signed-off-by: Wang Jian <[email protected]> Signed-off-by: Jeff Garzik <[email protected]>
2008-07-22net/phy: Fix copper/fiber auto-selection for 88e1111Wang Jian1-1/+1
The 27.15 bit (MII_M1111_HWCFG_FIBER_COPPER_AUTO) is disable bit. When set to 1, copper/fiber auto selection is disabled. The current code to enable but actually disable auto selection. Signed-off-by: Wang Jian <[email protected]> Signed-off-by: Jeff Garzik <[email protected]>
2008-07-11Fix missing exports for net/phy/mdio-bitbang.cTakashi Iwai1-0/+2
{alloc,free}_mdio_bitbang() are not exported while they are used in mdio-ofgpio driver. Signed-off-by: Takashi Iwai <[email protected]> Signed-off-by: Jeff Garzik <[email protected]>
2008-05-30net: OpenFirmware GPIO based MDIO bitbang driverLaurent Pinchart3-0/+212
This patch adds an MDIO bitbang driver that uses the GPIO library and its OF bindings to access the bus I/Os. Signed-off-by: Laurent Pinchart <[email protected]> Signed-off-by: Jeff Garzik <[email protected]>
2008-05-29Merge branch 'upstream-next-davem' of ↵David S. Miller2-3/+201
master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6
2008-05-22phylib: do EXPORT_SYMBOL on get_phy_idPaul Gortmaker1-0/+1
Commit cac1f3c8 factored out the code for get_phy_id so that it could be reused in multiple places. Turns out that some of the users can be modular, so we need to export this symbol as well. Signed-off-by: Paul Gortmaker <[email protected]> Signed-off-by: Jeff Garzik <[email protected]>
2008-05-22PHYLIB: Kconfig: Complete the list of Broadcom PHYs supportedMaciej W. Rozycki1-1/+2
Add Broadcom PHYs supported missing from the description. Signed-off-by: Maciej W. Rozycki <[email protected]> Signed-off-by: Jeff Garzik <[email protected]>
2008-05-22PHYLIB: Add 1000Base-X support for Broadcom bcm5482Nate Case1-2/+199
Configure the BCM5482S secondary SerDes for 1000Base-X mode when the appropriate dev_flags are passed in to phy_connect(). This is needed when the PHY is used for fiber and backplane connections. Signed-off-by: Nate Case <[email protected]> Signed-off-by: Maciej W. Rozycki <[email protected]> Signed-off-by: Jeff Garzik <[email protected]>
2008-05-22PHYLIB: Kconfig: Fix the dependency on S390Maciej W. Rozycki1-1/+1
PHYLIB was first marked as BROKEN on S390, then the enclosing menu marked as non-S390, then the two dependencies merged with the conversion to menuconfig. Reduce to non-S390. Signed-off-by: Maciej W. Rozycki <[email protected]> Signed-off-by: Jeff Garzik <[email protected]>
2008-05-06phylib: Fix some sparse warningsAndy Fleming1-1/+1
Declared some things static, declared some things in the header. Signed-off-by: Andy Fleming <[email protected]> Signed-off-by: Jeff Garzik <[email protected]>
2008-04-29Add support for SMSC LAN8187 and LAN8700 PHYsSteve Glendinning2-2/+69
Add support for two additional SMSC PHY models with identical interrupt source and mask registers to the LAN83C185 Signed-off-by: Steve Glendinning <[email protected]> Signed-off-by: Jeff Garzik <[email protected]>
2008-04-29Rename SMSC phy functions to be more genericSteve Glendinning1-7/+7
Several models of SMSC PHY have the same interrupt status and mask registers as the LAN83C185, so these functions can service multiple different PHY drivers. Signed-off-by: Steve Glendinning <[email protected]> Signed-off-by: Jeff Garzik <[email protected]>
2008-04-29drivers/net/phy: fix kernel-doc notationRandy Dunlap1-1/+1
Fix kernel-doc warning: Warning(linux-2.6.25-git11//drivers/net/phy/phy_device.c:275): No description found for parameter 'bus_id' Signed-off-by: Randy Dunlap <[email protected]> Signed-off-by: Jeff Garzik <[email protected]>
2008-04-25phylib: Add support for board-level PHY fixupsAndy Fleming3-13/+123
Sometimes the specific interaction between the platform and the PHY requires special handling. For instance, to change where the PHY's clock input is, or to add a delay to account for latency issues in the data path. We add a mechanism for registering a callback with the PHY Lib to be called on matching PHYs when they are brought up, or reset. Signed-off-by: Andy Fleming <[email protected]> Signed-off-by: Jeff Garzik <[email protected]>
2008-04-17phylib: factor out get_phy_id from within get_phy_devicePaul Gortmaker1-9/+29
We were already doing what amounts to a get_phy_id from within get_phy_device, and rather than duplicate this for the TBIPA probing, we might as well just factor it out and make it available instead. Signed-off-by: Paul Gortmaker <[email protected]> Acked-by: Andy Fleming <[email protected]> Signed-off-by: Jeff Garzik <[email protected]>
2008-04-17PHY: add BCM5464 support to broadcom PHY driverPaul Gortmaker1-0/+20
The BCM5464 can be used with the current broadcom PHY driver by just adding the appropriate chip ID and using the existing support within. Signed-off-by: Paul Gortmaker <[email protected]> Signed-off-by: Jeff Garzik <[email protected]>
2008-04-16phy: Change mii_bus id field to a stringAndy Fleming1-1/+1
Having the id field be an int was making more complex bus topologies excessively difficult. For now, just convert it to a string, and change all instances of "bus->id = val" to snprintf(id, MII_BUS_ID_LEN, "%x", val). Signed-off-by: Andy Fleming <[email protected]> Signed-off-by: Jeff Garzik <[email protected]>
2008-04-14Merge branch 'master' of ↵David S. Miller1-2/+0
master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6 Conflicts: drivers/net/ehea/ehea_main.c drivers/net/wireless/iwlwifi/Kconfig drivers/net/wireless/rt2x00/rt61pci.c net/ipv4/inet_timewait_sock.c net/ipv6/raw.c net/mac80211/ieee80211_sta.c
2008-04-04net: marvell.c fix sparse shadowed variable warningHarvey Harrison1-2/+0
The other if blocks don't redeclare temp, remove the redeclaration in the final if() block. drivers/net/phy/marvell.c:214:7: warning: symbol 'temp' shadows an earlier one drivers/net/phy/marvell.c:160:6: originally declared here Signed-off-by: Harvey Harrison <[email protected]> Signed-off-by: Jeff Garzik <[email protected]>
2008-03-27Merge branch 'master' of ↵David S. Miller1-5/+124
git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6 Conflicts: drivers/net/usb/rndis_host.c drivers/net/wireless/b43/dma.c net/ipv6/ndisc.c
2008-03-26phy/broadcom: add support for BCM5481 PHYAnton Vorontsov1-1/+56
This patch adds support for BCM5481 PHY. Unfortunately it's hard to get specifications for this PHY, so its special register 0x18 isn't annotated properly (but we know it's used to set up the delays). I've kept the magic numbers, so we'll not forget to fix it at the first opportunity, and will name that register and its bits correctly. p.s. also fixed the line with broken indention, introduced by commit 03157ac31eb4a8883382a212b161d2e6c5059fbf PHYLIB: Add BCM5482 PHY support Signed-off-by: Anton Vorontsov <[email protected]> Signed-off-by: Jeff Garzik <[email protected]>
2008-03-25netxen, phy/marvell, skge: minor checkpatch fixesJeff Garzik1-1/+1
Signed-off-by: Jeff Garzik <[email protected]>
2008-03-25Marvell PHY m88e1111 driver fixAlexandr Smirnov1-5/+124
Marvell PHY m88e1111 (not sure about other models, but think they too) works in two modes: fiber and copper. In Marvell PHY driver (that we have in current community kernels) code supported only copper mode, and this is not configurable, bits for copper mode are simply written in registers during PHY initialization. This patch adds support for both modes. Signed-off-by: Alexandr Smirnov <[email protected]> Acked-by: Andy Fleming <[email protected]> Signed-off-by: Jeff Garzik <[email protected]>
2008-03-05FIXED_PHY must depend on PHYLIB=yAdrian Bunk1-0/+1
This patch fixes the following build error introduced by commit a79d8e93d300adb84cccc38ac396cfb118c238ad and reported by Olaf Hering: <-- snip --> ... LD .tmp_vmlinux1 arch/powerpc/sysdev/built-in.o: In function `of_add_fixed_phys': fsl_soc.c:(.init.text+0xd34): undefined reference to `fixed_phy_add' make: *** [.tmp_vmlinux1] Error 1 <-- snip --> Signed-off-by: Adrian Bunk <[email protected]> Signed-off-by: Jeff Garzik <[email protected]>
2008-03-05dm9161: add configuration for MII/RMIIfrederic Rodo1-3/+14
Signed-off-by: Frederic Rodo <[email protected]> Signed-off-by: Jeff Garzik <[email protected]>
2008-02-23net/phy/mdio_bus.c: fix a check-after-useAdrian Bunk1-2/+2
This patch fixes a check-after-use spotted by the Coverity checker. Signed-off-by: Adrian Bunk <[email protected]> Signed-off-by: Jeff Garzik <[email protected]>
2008-02-11net/phy/fixed.c: fix a use-after-freeAdrian Bunk1-2/+2
This patch fixes a use-after-free introduced by commit a79d8e93d300adb84cccc38ac396cfb118c238ad and spotted by the Coverity checker. Signed-off-by: Adrian Bunk <[email protected]> Signed-off-by: Jeff Garzik <[email protected]>
2008-02-03phylib: Add Realtek 821x eth PHY supportJohnson Leung3-0/+86
this PHY present on the MPC8315E and MPC837xE RDB boards. Signed-off-by: Johnson Leung <[email protected]> Signed-off-by: Kevin Lam <[email protected]> Signed-off-by: Joe D'Abbraccio <[email protected]> Signed-off-by: Kim Phillips <[email protected]> Signed-off-by: Jeff Garzik <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2008-02-03PHYLIB: Locking fixes for PHY I/O potentially sleepingNate Case3-29/+52
PHY read/write functions can potentially sleep (e.g., a PHY accessed via I2C). The following changes were made to account for this: * Change spin locks to mutex locks * Add a BUG_ON() to phy_read() phy_write() to warn against calling them from an interrupt context. * Use work queue for PHY state machine handling since it can potentially sleep * Change phydev lock from spinlock to mutex Signed-off-by: Nate Case <[email protected]> Acked-by: Andy Fleming <[email protected]> Signed-off-by: Jeff Garzik <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2008-02-03PHYLIB: Add BCM5482 PHY supportNate Case1-0/+20
This Broadcom PHY is similar to other bcm54xx devices. Signed-off-by: Nate Case <[email protected]> Signed-off-by: Jeff Garzik <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2008-01-23phy/fixed.c: rework to not duplicate PHY layer functionalityVitaly Bordug2-304/+173
With that patch fixed.c now fully emulates MDIO bus, thus no need to duplicate PHY layer functionality. That, in turn, drastically simplifies the code, and drops down line count. As an additional bonus, now there is no need to register MDIO bus for each PHY, all emulated PHYs placed on the platform fixed MDIO bus. There is also no more need to pre-allocate PHYs via .config option, this is all now handled dynamically. Signed-off-by: Anton Vorontsov <[email protected]> Signed-off-by: Vitaly Bordug <[email protected]> Acked-by: Jeff Garzik <[email protected]> Signed-off-by: Kumar Gala <[email protected]>
2007-12-04PHY: Add the phy_device_release device method.Anton Vorontsov2-4/+17
Lately I've got this nice badness on mdio bus removal: Device 'e0103120:06' does not have a release() function, it is broken and must be fixed. ------------[ cut here ]------------ Badness at drivers/base/core.c:107 NIP: c015c1a8 LR: c015c1a8 CTR: c0157488 REGS: c34bdcf0 TRAP: 0700 Not tainted (2.6.23-rc5-g9ebadfbb-dirty) MSR: 00029032 <EE,ME,IR,DR> CR: 24088422 XER: 00000000 ... [c34bdda0] [c015c1a8] device_release+0x78/0x80 (unreliable) [c34bddb0] [c01354cc] kobject_cleanup+0x80/0xbc [c34bddd0] [c01365f0] kref_put+0x54/0x6c [c34bdde0] [c013543c] kobject_put+0x24/0x34 [c34bddf0] [c015c384] put_device+0x1c/0x2c [c34bde00] [c0180e84] mdiobus_unregister+0x2c/0x58 ... Though actually there is nothing broken, it just device subsystem core expects another "pattern" of resource managment. This patch implement phy device's release function, thus we're getting rid of this badness. Also small hidden bug fixed, hope none other introduced. ;-) Signed-off-by: Anton Vorontsov <[email protected]> Acked-by: Andy Fleming <[email protected]> Signed-off-by: Jeff Garzik <[email protected]>
2007-12-01Stop phy code from returning success to unknown ioctls.David Woodhouse1-0/+3
This kind of sucks, and prevents the Fedora installer from using the device for network installs... [root@efika phy]# iwconfig eth0 Warning: Driver for device eth0 has been compiled with an ancient version of Wireless Extension, while this program support version 11 and later. Some things may be broken... eth0 ESSID:off/any Nickname:"" NWID:0 Channel:0 Access Point: 00:00:BF:81:14:E0 Bit Rate:-1.08206e+06 kb/s Sensitivity=0/0 RTS thr:off Fragment thr:off Encryption key:<too big> Power Management:off Signed-off-by: David Woodhouse <[email protected]> Signed-off-by: Jeff Garzik <[email protected]>
2007-12-01phylib: marvell: add support for TX-only and RX-only Internal DelayKim Phillips1-9/+17
Previously, Internal Delay specification implied the delay be applied to both TX and RX. This patch allows for separate TX/RX-only internal delay specification. Signed-off-by: Kim Phillips <[email protected]> Tested-by: Anton Vorontsov <[email protected]> Acked-by: Li Yang <[email protected]> Signed-off-by: Jeff Garzik <[email protected]>
2007-11-05phylib: Silence driver registrationOlof Johansson1-1/+1
It gets quite verbose to see every single PHY driver being registered by default. Signed-off-by: Olof Johansson <[email protected]> Signed-off-by: Jeff Garzik <[email protected]>
2007-11-05phylib: Add ID for Marvell 88E1240Olof Johansson1-5/+18
Add PHY IDs for Marvell 88E1240. It seems to have close enough programming models to 1111/1112 for basic support at least. Also clean up whitespace in the ID list a bit. Signed-off-by: Olof Johansson <[email protected]> Signed-off-by: Jeff Garzik <[email protected]>
2007-10-19phy/bitbang: missing MODULE_LICENSERandy Dunlap1-0/+2
Missing MODULE_LICENSE(), loading this module taints the kernel. Signed-off-by: Randy Dunlap <[email protected]> Signed-off-by: Jeff Garzik <[email protected]>
2007-10-10Generic bitbanged MDIO libraryScott Wood3-0/+197
Previously, bitbanged MDIO was only supported in individual hardware-specific drivers. This code factors out the higher level protocol implementation, reducing the hardware-specific portion to functions setting direction, data, and clock. Signed-off-by: Scott Wood <[email protected]> Signed-off-by: Jeff Garzik <[email protected]>
2007-10-10PHYLIB: fix an interrupt loop potential when haltingMaciej W. Rozycki1-2/+2
Ensure the PHY_HALTED state is not entered with the IRQ asserted as it could lead to an interrupt loop. There is a small window in phy_stop(), where the state of the PHY machine indicates it has been halted, but its interrupt output might still be unmasked. If an interrupt goes active right at this moment it will loop as the phy_interrupt() handler exits immediately with IRQ_NONE if the halted state is seen. It is unsafe to extend the phydev spinlock to cover phy_interrupt(). It is safe to swap the order of the actions though as all the competing places to unmask the interrupt output of the PHY, which are phy_change() and phy_timer() are already covered with the lock as is the sequence in question. Signed-off-by: Maciej W. Rozycki <[email protected]> Cc: Andy Fleming <[email protected]> Cc: Jeff Garzik <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Jeff Garzik <[email protected]>
2007-10-10PHYLIB: IRQ event workqueue handling fixesMaciej W. Rozycki1-5/+19
Keep track of disable_irq_nosync() invocations and call enable_irq() the right number of times if work has been cancelled that would include them. Now that the call to flush_work_keventd() (problematic because of rtnl_mutex being held) has been replaced by cancel_work_sync() another issue has arisen and been left unresolved. As the MDIO bus cannot be accessed from the interrupt context the PHY interrupt handler uses disable_irq_nosync() to prevent from looping and schedules some work to be done as a softirq, which, apart from handling the state change of the originating PHY, is responsible for reenabling the interrupt. Now if the interrupt line is shared by another device and a call to the softirq handler has been cancelled, that call to enable_irq() never happens and the other device cannot use its interrupt anymore as its stuck disabled. I decided to use a counter rather than a flag because there may be more than one call to phy_change() cancelled in the queue -- a real one and a fake one triggered by free_irq() if DEBUG_SHIRQ is used, if nothing else. Therefore because of its nesting property enable_irq() has to be called the right number of times to match the number disable_irq_nosync() was called and restore the original state. This DEBUG_SHIRQ feature is also the reason why free_irq() has to be called before cancel_work_sync(). While at it I updated the comment about phy_stop_interrupts() being called from `keventd' -- this is no longer relevant as the use of cancel_work_sync() makes such an approach unnecessary. OTOH a similar comment referring to flush_scheduled_work() in phy_stop() still applies as using cancel_work_sync() there would be dangerous. Checked with checkpatch.pl and at the run time (with and without DEBUG_SHIRQ). Signed-off-by: Maciej W. Rozycki <[email protected]> Cc: Andy Fleming <[email protected]> Cc: Jeff Garzik <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Jeff Garzik <[email protected]>
2007-10-10PHYLIB: Spinlock fixes for softirqsMaciej W. Rozycki2-14/+14
Use spin_lock_bh()/spin_unlock_bh() for the phydev lock throughout as it is used in phy_timer() that is called as a softirq and all the other operations may happen in the user context. There has been a change recently that did such a conversion for some of the operations on the lock, but some have been left intact. Many of them, perhaps all, may be called in the user context and I was able to trigger recursive spinlock acquisition indeed, so I think for the sake of long-term maintenance it is best to convert them all, even if unnecessarily for one or two -- better safe than sorry. Perhaps one in phy_timer() could actually be skipped as only called as a softirq -- I can send an update if that sounds like a good idea. Checked with checkpatch.pl and at the runtime. Signed-off-by: Maciej W. Rozycki <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Jeff Garzik <[email protected]>
2007-10-10PHY fixed driver: rework release path and update phy_id notationVitaly Bordug2-155/+169
device_bind_driver() error code returning has been fixed. release() function has been written, so that to free resources in correct way; the release path is now clean. Before the rework, it used to cause Device 'fixed@100:1' does not have a release() function, it is broken and must be fixed. BUG: at drivers/base/core.c:104 device_release() Call Trace: [<ffffffff802ec380>] kobject_cleanup+0x53/0x7e [<ffffffff802ec3ab>] kobject_release+0x0/0x9 [<ffffffff802ecf3f>] kref_put+0x74/0x81 [<ffffffff8035493b>] fixed_mdio_register_device+0x230/0x265 [<ffffffff80564d31>] fixed_init+0x1f/0x35 [<ffffffff802071a4>] init+0x147/0x2fb [<ffffffff80223b6e>] schedule_tail+0x36/0x92 [<ffffffff8020a678>] child_rip+0xa/0x12 [<ffffffff80311714>] acpi_ds_init_one_object+0x0/0x83 [<ffffffff8020705d>] init+0x0/0x2fb [<ffffffff8020a66e>] child_rip+0x0/0x12 Also changed the notation of the fixed phy definition on mdio bus to the form of <speed>+<duplex> to make it able to be used by gianfar and ucc_geth that define phy_id strictly as "%d:%d" and cleaned up the whitespace issues. Signed-off-by: Vitaly Bordug <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Jeff Garzik <[email protected]>
2007-10-10drivers/net/: all drivers/net/ cleanup with ARRAY_SIZEDenis Cheng1-1/+1
Signed-off-by: Denis Cheng <[email protected]> Signed-off-by: Jeff Garzik <[email protected]>
2007-09-20phy: export phy_mii_ioctlDomen Puncer1-0/+1
Export phy_mii_ioctl, so network drivers can use it when built as modules too. Signed-off-by: Domen Puncer <[email protected]> Signed-off-by: Jeff Garzik <[email protected]>