aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/intel/e1000e/phy.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2018-04-27net: intel: Cleanup the copyright/license headersJeff Kirsher1-20/+1
After many years of having a ~30 line copyright and license header to our source files, we are finally able to reduce that to one line with the advent of the SPDX identifier. Also caught a few files missing the SPDX license identifier, so fixed them up. Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Acked-by: Shannon Nelson <shannon.nelson@oracle.com> Acked-by: Richard Cochran <richardcochran@gmail.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2018-03-23intel: add SPDX identifiers to all the Intel driversJeff Kirsher1-0/+1
Add the SPDX identifiers to all the Intel wired LAN driver files, as outlined in Documentation/process/license-rules.rst. Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2017-10-10e1000e: Fix error path in link detectionBenjamin Poirier1-3/+4
In case of error from e1e_rphy(), the loop will exit early and "success" will be set to true erroneously. Signed-off-by: Benjamin Poirier <bpoirier@suse.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2016-05-13e1000e: use BIT() macro for bit definesJacob Keller1-2/+2
This prevents signed bitshift issues when the shift would overwrite the signed bit, and prevents making this mistake in the future when copying and modifying code. Use GENMASK or the unsigned postfix for cases which aren't suitable for BIT() macro. Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2015-06-03e1000e: Bump the version to 3.2.5Yanir Lubetkin1-1/+1
Bump the version to reflect the driver changes and bug fixes for i219. Also update the copyright, while we are at it. Signed-off-by: Yanir Lubetkin <yanirx.lubetkin@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2014-04-23e1000e: Cleanup to fix checkpatch missing blank linesDavid Ertman1-0/+1
Fixing "WARNING:SPACING: networking uses a blank line after declarations" Signed-off-by: Dave Ertman <davidx.m.ertman@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2014-03-07e1000e: Cleanup - Update GPL header and CopyrightDavid Ertman1-27/+20
This patch is to update the GPL header by removing the portion that refers to the Free Software Foundation address. Change the copyright date for 2014. Reformat the header comments to conform to kernel networking coding norms Signed-off-by: Dave Ertman <davidx.m.ertman@intel.com> Tested-by: Jeff Pieper <jeffrey.e.pieper@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2013-12-17e1000e: fix compiler warningsDavid Ertman1-3/+7
This patch is to fix a compiler warning of __bad_udelay due to a value of >999 being passed as a parameter to udelay() in the function e1000e_phy_has_link_generic(). This affects the gcc compiler when it is given a flag of -O3 and the icc compiler. This patch is also making the change from mdelay() to msleep() in the same function, since it was determined though code inspection that this function is never called in atomic context. Signed-off-by: David Ertman <davidx.m.ertman@intel.com> Acked-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2013-05-21e1000e: cleanup whitespaceBruce Allan1-11/+11
Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2013-03-28e1000e: fix scheduling while atomic bugsBruce Allan1-4/+4
The previous commit ce43a2168c59bc47b5f0c1825fd5f9a2a9e3b447 (e1000e: cleanup USLEEP_RANGE checkpatch checks) converted a number of delays and sleeps as recommended in ./Documentation/timers/timers-howto.txt. Unfortunately, a few of the udelay() to usleep_range() conversions are in code paths that are in an atomic context in which usleep_range() should not be used. Revert those specific changes. Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Jeff Pieper <jeffrey.e.pieper@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2013-03-27e1000e: additional error handling on PHY register accessesBruce Allan1-0/+12
PHY reads/writes via the MDIC register could potentially return results from a previous PHY register access. If that happens, the offset in the returned results will be that of the previous access and if that is different from the expected offset, log a debug message and error out. Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2013-03-08e1000e: cleanup USLEEP_RANGE checkpatch checksBruce Allan1-6/+6
Resolve strict checkpatch USLEEP_RANGE checks by converting delays and sleeps as described in ./Documentation/timers/timers-howto.txt. Three other violations of the text have also been fixed. CHECK:USLEEP_RANGE: usleep_range is preferred over udelay; see Documentation/timers/timers-howto.txt Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2013-03-08e1000e: cleanup unnecessary line breaksBruce Allan1-4/+2
Cuddle broken lines where appropriate. Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2013-03-08e1000e: cleanup formatting of static structsBruce Allan1-2/+4
Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2013-03-08e1000e: cleanup (add/remove) blank lines where appropriateBruce Allan1-0/+2
Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2013-03-08e1000e: cleanup SPACING checkpatch checksBruce Allan1-1/+1
CHECK:SPACING: No space is necessary after a cast CHECK:SPACING: space prohibited before semicolon Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2013-03-08e1000e: cleanup PARENTHESIS_ALIGNMENT checkpatch checksBruce Allan1-5/+4
CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2013-03-08e1000e: cleanup LEADING_SPACE checkpatch warningsBruce Allan1-5/+5
WARNING:LEADING_SPACE: please, no spaces at the start of a line Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2013-03-08e1000e: cleanup SPACING checkpatch errors and warningsBruce Allan1-1/+1
ERROR:SPACING: spaces prohibited around that ':' (ctx:WxV) ERROR:SPACING: need consistent spacing around '-' (ctx:WxV) ERROR:SPACING: space required after that ',' (ctx:VxV) ERROR:SPACING: spaces required around that '=' (ctx:VxV) WARNING:SPACING: missing space after enum definition and some similar spacing issues not reported by checkpatch. Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2013-03-08e1000e: cleanup CODE_INDENT checkpatch errorsBruce Allan1-41/+40
ERROR:CODE_INDENT: code indent should use tabs where possible Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2013-02-05e1000e: cleanup checkpatch braces checksBruce Allan1-1/+0
Resolve the following strict checkpatch checks: CHECK:BRACES: Blank lines aren't necessary after an open brace '{' CHECK:BRACES: Blank lines aren't necessary before a close brace '}' CHECK:BRACES: braces {} should be used on all arms of this statement Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2013-02-04e1000e: cosmetic move of #defines and function prototypes to the new phy.hBruce Allan1-38/+0
Move #defines and function prototypes which are applicable to all/most devices supported by the driver and are specific to the PHY component of each device to the new phy.h header file. These function prototypes can be used by other files in the driver and moving them to the PHY-specific file makes it clearer to which component they are applicable. Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2013-02-04e1000e: cosmetic move of #defines and prototypes to the new ich8lan.hBruce Allan1-4/+0
Move #defines and function prototypes specific to the ICH/PCH family of devices (ICH8/82562, ICH8/82566, ICH8/82567, ICH9/82562, ICH9/82566, ICH9/82567, ICH10/82567, 82577, 82578, 82579, I217, I218) to the new ich8lan.h header file (the convention for Intel wired ethernet drivers is to use the name of the first device in the family for related file and function names). These defines and function prototypes can be used by other files in the driver and moving them to the ICH/PCH-family-specific file makes it clearer to which devices they are applicable. Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2013-01-31e1000e: use generic IEEE MII definitionsBruce Allan1-92/+87
For standard IEEE MII-compatible transceivers, the kernel has generic register and bit definitions. Use those instead of redundant local defines. Do not replace references of MII_CR_SPEED_10 with BMCR_SPEED10 (0x0000) when it is not necessary (i.e. when it is bitwise OR'ed with another value). Some whitespace issues in the surrounding context of the above changes are also cleaned up. Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2013-01-31e1000e: resolve -Wunused-parameter compile warningsBruce Allan1-1/+1
Remove the unused parameter when possible, otherwise use __always_unused attribute. Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2013-01-31e1000e: cleanup: group OR'ed bit settings with parensBruce Allan1-2/+3
For clarity, wrap OR'ed bit settings with parentheses. Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2013-01-27e1000e: cleanup: remove e1000e_commit_phy()Bruce Allan1-23/+12
Remove the function e1000e_commit_phy() and replace the few calls to it with the same function pointer that it would call. The function pointer is almost always set for the devices that access these code paths so there is no risk of a NULL pointer dereference; for the few instances where the function pointer might not be set (i.e. can be called for the few devices which do not have this function pointer set), check for a valid function pointer. Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Jeff Pieper <jeffrey.e.pieper@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2013-01-27e1000e: cleanup: remove e1000_get_cable_length()Bruce Allan1-2/+2
Remove the function e1000_get_cable_length() and replace the two calls to it with the same function pointer that it would call. Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2013-01-27e1000e: cleanup: remove e1000_get_phy_cfg_done()Bruce Allan1-19/+1
Remove the function e1000_get_phy_cfg_done() and replace the single call to it with the same function pointer that it would call. The function pointer is always set so there is no risk of a NULL pointer dereference. Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2013-01-27e1000e: cleanup: rename e1000_get_cfg_done()Bruce Allan1-2/+2
In keeping with the e1000e driver function naming convention, the subject function is renamed to indicate it is generic, i.e. it is applicable to more than just a single MAC family (e.g. 80003es2lan, 82571, ich8lan). Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2013-01-27e1000e: cleanup: remove e1000_force_speed_duplex()Bruce Allan1-17/+1
Remove the function e1000_force_speed_duplex() and replace the single call to it with the same function pointer that it would call. The function pointer is always set so there is no risk of a NULL pointer dereference. Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2013-01-27e1000e: cleanup: remove e1000_set_d0_lplu_state()Bruce Allan1-27/+6
Replace the function e1000_set_d0_lplu_state() with the contents of it coded in place of the single call to the function. Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2013-01-27e1000e: cleanup: do not assign a variable a value when not necessaryBruce Allan1-3/+3
Static analysis with cppcheck has shown a few instances of a variable being reassigned a value before the old one has been used. None of these ever require the old value to be used so remove the old values. Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2013-01-27e1000e: do not ignore variables which get set a valueBruce Allan1-1/+1
Static analysis with cppcheck has shown a few instances of a variable which is assigned a value that is never used. A number of these are the return status of various driver function calls which should be passed back to the caller of the current function. Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2013-01-27e1000e: cleanup: remove unnecessary function prototypesBruce Allan1-2/+1
...and cleanup some whitespace in other prototypes. Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2013-01-27e1000e: update copyright dateBruce Allan1-1/+1
Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2012-12-01e1000e: cosmetic cleanup of commentsBruce Allan1-94/+47
Update comments to conform to the preferred style for networking code as described in ./Documentation/CodingStyle and checked for in the recently added checkpatch NETWORKING_BLOCK_COMMENT_STYLE test. Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2012-08-21e1000e: implement 82577/579 MDI setting supportBruce W Allan1-2/+29
In order for e1000e to support MDI setting support via ethtool this code is needed to allow setting the MDI state via software. This is in regards to the related ethtool patch and fixes bugzilla.kernel.org bug 11998 Signed-off-by: Bruce W Allan <bruce.w.allan@intel.com> Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com> Tested-by: Aaron Brown aaron.f.brown@intel.com Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2012-06-05e1000e: test for valid check_reset_block function pointerBruce Allan1-3/+5
commit 44abd5c12767a8c567dc4e45fd9aec3b13ca85e0 introduced NULL pointer dereferences when attempting to access the check_reset_block function pointer on 8257x and 80003es2lan non-copper devices. This fix should be applied back through 3.4. Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Jeff Pieper <jeffrey.e.pieper@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2012-05-05e1000e: enable forced master/slave on 82577Bruce Allan1-26/+45
Like other supported (igp) PHYs, the driver needs to be able to force the master/slave mode on 82577. Since the code is the same as what already exists in the code flow for igp PHYs, move it to a new function to be called for both flows. Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Jeff Pieper <jeffrey.e.pieper@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2012-05-04e1000e: initial support for i217Bruce Allan1-0/+3
i217 is the next-generation LOM that will be available on systems with the Lynx Point Platform Controller Hub (PCH) chipset from Intel. This patch provides the initial support for the device. Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Jeff Pieper <jeffrey.e.pieper@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2012-05-03e1000e: Resolve intermittent negotiation issue on 82574/82583.Matthew Vick1-1/+17
For 82574 and 82583 devices, resolve an intermittent link issue where the link negotiates to 100Mbps rather than 1Gbps when powering off the PHY and powering on the PHY after several seconds. Signed-off-by: Matthew Vick <matthew.vick@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2012-04-14e1000e: cleanup boolean logicBruce Allan1-12/+11
Replace occurrences of 'if (<bool expr> == <1|0>)' with 'if ([!]<bool expr>)' Replace occurrences of '<bool var> = (<non-bool expr>) ? true : false' with '<bool var> = <non-bool expr>'. Replace occurrence of '<bool var> = <non-bool expr>' with '<bool var> = !!<non-bool expr>' While the latter replacement is not really necessary, it is done here for consistency and clarity. No functional changes. Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2012-02-29e1000e: use msleep instead of mdelayBruce Allan1-3/+1
The e1000_link_stall_workaround_lv() function is always called in non- atomic context so it should use msleep instead of mdelay. Also, remove unnecessary #include <linux/delay.h>. Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2012-02-29e1000e: cleanup whitespace and indentationBruce Allan1-37/+22
Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2012-02-24e1000e: rename e1000e_config_collision_dist() and call as function pointerBruce Allan1-2/+2
Rename e1000e_config_collision_dist() to e1000e_config_collision_dist_generic() to signify the function is used for more than one MAC-family type, and set and use it as a MAC ops function pointer to be consistent with the driver design. Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2012-02-24e1000e: cleanup use of check_reset_block function pointerBruce Allan1-1/+1
Replace e1000_check_reset_block() inline function with calls to the PHY ops check_reset_block function pointer. Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2012-02-13e1000e: cleanup goto statements to exit points without common workBruce Allan1-122/+88
Per ./Documentation/CodingStyle, goto statements are acceptable for the centralized exiting of functions when there are multiple exit points which share common work such as cleanup. When no common work is required for multiple exit points, the function should just return at these exit points instead of doing an unnecessary jump to a centralized return. This patch cleans up the inappropriate use of goto statements, and removes unnecessary variables (or move to a smaller scope) where possible as a result of the cleanups. Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2012-02-13e1000e: cleanup: remove unnecessary test and returnBruce Allan1-2/+0
Fall-through to a return statement that effectively does the same. Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2012-02-13e1000e: cleanup: always return 0Bruce Allan1-1/+1
These are a few instances of returning a value that can only be 0 so just use a 'return 0' to make it more obvious. Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>