#
07f23d90 |
| 13-Nov-2019 |
Colin Ian King <colin.king@canonical.com> |
net: sfp: fix spelling mistake "requies" -> "requires"
There is a spelling mistake in a dev_warn message. Fix it.
Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: David S. Mi
net: sfp: fix spelling mistake "requies" -> "requires"
There is a spelling mistake in a dev_warn message. Fix it.
Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: David S. Miller <davem@davemloft.net>
show more ...
|
Revision tags: v5.3.11 |
|
#
139d3a21 |
| 10-Nov-2019 |
Russell King <rmk+kernel@armlinux.org.uk> |
net: sfp: allow modules with slow diagnostics to probe
When a module is inserted, we attempt to read read the ID from address 0x50. Once we are able to read the ID, we immediately attempt to initia
net: sfp: allow modules with slow diagnostics to probe
When a module is inserted, we attempt to read read the ID from address 0x50. Once we are able to read the ID, we immediately attempt to initialise the hwmon support by reading from address 0x51. If this fails, then we fall into error state, and assume that the module is not usable.
Modules such as the ALCATELLUCENT 3FE46541AA use a real EEPROM for I2C address 0x50, which responds immediately. However, address 0x51 is an emulated, which only becomes available once the on-board firmware has booted. This prompts us to fall into the error state.
Since the module may be usable without diagnostics, arrange for the hwmon probe independent of the rest of the SFP itself, retrying every 5s for up to about 60s for the monitoring to become available, and print an error message if it doesn't become available.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
show more ...
|
#
e117be74 |
| 10-Nov-2019 |
Russell King <rmk+kernel@armlinux.org.uk> |
net: sfp: allow sfp to probe slow to initialise GPON modules
Some GPON modules (e.g. Huawei MA5671A) take a significant amount of time to start responding on the I2C bus, contary to the SFF specific
net: sfp: allow sfp to probe slow to initialise GPON modules
Some GPON modules (e.g. Huawei MA5671A) take a significant amount of time to start responding on the I2C bus, contary to the SFF specifications.
Work around this by implementing a two-level timeout strategy, where we initially quickly retry for the module, and then use a slower retry after we exceed a maximum number of quick attempts.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
show more ...
|
#
73f5e847 |
| 10-Nov-2019 |
Russell King <rmk+kernel@armlinux.org.uk> |
net: sfp: move module insert reporting out of probe
Move the module insertion reporting out of the probe handling, but after we have detected that the upstream has attached (since that is whom we ar
net: sfp: move module insert reporting out of probe
Move the module insertion reporting out of the probe handling, but after we have detected that the upstream has attached (since that is whom we are reporting insertion to.)
Only report module removal if we had previously reported a module insertion.
This gives cleaner semantics, and means we can probe the module before we have an upstream attached.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
show more ...
|
#
b036a554 |
| 10-Nov-2019 |
Russell King <rmk+kernel@armlinux.org.uk> |
net: sfp: split power mode switching from probe
Switch the power mode switching from the probe, so that we don't repeatedly re-probe the SFP device if there is a problem accessing the registers at I
net: sfp: split power mode switching from probe
Switch the power mode switching from the probe, so that we don't repeatedly re-probe the SFP device if there is a problem accessing the registers at I2C address 0x51.
In splitting this out, we can also fix a bug where we leave the module in high-power mode when the upstream device is detached but the module is still inserted.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
show more ...
|
#
6b0da5c9 |
| 10-Nov-2019 |
Russell King <rmk+kernel@armlinux.org.uk> |
net: sfp: track upstream's attachment state in state machine
Track the upstream's attachment state in the state machine rather than maintaining a boolean, which ensures that we have a strict order o
net: sfp: track upstream's attachment state in state machine
Track the upstream's attachment state in the state machine rather than maintaining a boolean, which ensures that we have a strict order of ATTACH followed by an UP event - we can never believe that a newly attached upstream will be anything but down.
Rearrange the order of state machines so we run the module state machine after the upstream device's state machine, so the module state machine can check the current state of the device and take action to e.g. reset back to empty state when the upstream is detached.
This is to allow the module detection to run independently of the network device becoming available.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
show more ...
|
#
d23751a0 |
| 10-Nov-2019 |
Russell King <rmk+kernel@armlinux.org.uk> |
net: sfp: ensure TX_FAULT has deasserted before probing the PHY
TX_FAULT should be deasserted to indicate that the module has completed its initialisation. This may include the on-board PHY, so wai
net: sfp: ensure TX_FAULT has deasserted before probing the PHY
TX_FAULT should be deasserted to indicate that the module has completed its initialisation. This may include the on-board PHY, so wait until the module has deasserted TX_FAULT before probing the PHY.
This means that we need an extra state to handle a TX_FAULT that remains set for longer than t_init, since using the existing handling state would bypass the PHY probe.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
show more ...
|
#
63ec1c7c |
| 10-Nov-2019 |
Russell King <rmk+kernel@armlinux.org.uk> |
net: sfp: allow fault processing to transition to other states
Add the next state to sfp_sm_fault() so that it can branch to other states. This will be necessary to improve the initialisation path.
net: sfp: allow fault processing to transition to other states
Add the next state to sfp_sm_fault() so that it can branch to other states. This will be necessary to improve the initialisation path.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
show more ...
|
#
eefa6f1f |
| 10-Nov-2019 |
Russell King <rmk+kernel@armlinux.org.uk> |
net: sfp: eliminate mdelay() from PHY probe
Rather than using mdelay() to wait before probing the PHY (which holds several locks, including the rtnl lock), add an extra wait state to the state machi
net: sfp: eliminate mdelay() from PHY probe
Rather than using mdelay() to wait before probing the PHY (which holds several locks, including the rtnl lock), add an extra wait state to the state machine to introduce the 50ms delay without holding any locks.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
show more ...
|
#
181f29da |
| 10-Nov-2019 |
Russell King <rmk+kernel@armlinux.org.uk> |
net: sfp: split the PHY probe from sfp_sm_mod_init()
Move the PHY probe into a separate function, splitting it from sfp_sm_mod_init(). This will allow us to eliminate the 50ms mdelay() inside the s
net: sfp: split the PHY probe from sfp_sm_mod_init()
Move the PHY probe into a separate function, splitting it from sfp_sm_mod_init(). This will allow us to eliminate the 50ms mdelay() inside the state machine.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
show more ...
|
#
8e210b6b |
| 10-Nov-2019 |
Russell King <rmk+kernel@armlinux.org.uk> |
net: sfp: control TX_DISABLE and phy only from main state machine
We initialise TX_DISABLE when the sfp cage is probed, and then maintain its state in the main state machine. However, the module st
net: sfp: control TX_DISABLE and phy only from main state machine
We initialise TX_DISABLE when the sfp cage is probed, and then maintain its state in the main state machine. However, the module state machine: - negates it when detecting a newly inserted module when it's already guaranteed to be negated. - negates it when the module is removed, but the main state machine will do this anyway.
Make TX_DISABLE entirely controlled by the main state machine.
The main state machine also probes the module for a PHY, and removes the PHY when the the module is removed. Hence, removing the PHY in sfp_sm_module_remove() is also redundant, and is a left-over from when we tried to probe for the PHY from the module state machine.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
show more ...
|
#
7cfa9c92 |
| 10-Nov-2019 |
Russell King <rmk+kernel@armlinux.org.uk> |
net: sfp: avoid power switch on address-change modules
If the module indicates that it requires an address change sequence to switch between address 0x50 and 0x51, which we don't support, we can't w
net: sfp: avoid power switch on address-change modules
If the module indicates that it requires an address change sequence to switch between address 0x50 and 0x51, which we don't support, we can't write to the register that controls the power mode to switch to high power mode. Warn the user that the module may not be functional in this case, and don't try to change the power mode.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
show more ...
|
#
ed32abb1 |
| 10-Nov-2019 |
Russell King <rmk+kernel@armlinux.org.uk> |
net: sfp: parse SFP power requirement earlier
Parse the SFP power requirement earlier, in preparation for moving the power level setup code.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
net: sfp: parse SFP power requirement earlier
Parse the SFP power requirement earlier, in preparation for moving the power level setup code.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
show more ...
|
#
d900954f |
| 10-Nov-2019 |
Russell King <rmk+kernel@armlinux.org.uk> |
net: sfp: rename T_PROBE_WAIT to T_SERIAL
SFF-8472 rev 12.2 defines the time for the serial bus to become ready using t_serial. Use this as our identifier for this timeout to make it clear what we
net: sfp: rename T_PROBE_WAIT to T_SERIAL
SFF-8472 rev 12.2 defines the time for the serial bus to become ready using t_serial. Use this as our identifier for this timeout to make it clear what we are referring to.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
show more ...
|
#
d2e816c0 |
| 10-Nov-2019 |
Russell King <rmk+kernel@armlinux.org.uk> |
net: sfp: handle module remove outside state machine
Removing a module resets the module state machine back to its initial state. Rather than explicitly handling this in every state, handle it earl
net: sfp: handle module remove outside state machine
Removing a module resets the module state machine back to its initial state. Rather than explicitly handling this in every state, handle it early on outside of the state machine.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
show more ...
|
#
0936ebc4 |
| 10-Nov-2019 |
Russell King <rmk+kernel@armlinux.org.uk> |
net: sfp: rename sfp_sm_ins_next() as sfp_sm_mod_next()
sfp_sm_ins_next() modifies the module state machine. Change it's name to reflect this.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.
net: sfp: rename sfp_sm_ins_next() as sfp_sm_mod_next()
sfp_sm_ins_next() modifies the module state machine. Change it's name to reflect this.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
show more ...
|
#
1539e0d3 |
| 10-Nov-2019 |
Russell King <rmk+kernel@armlinux.org.uk> |
net: sfp: move tx disable on device down to main state machine
Move the tx disable assertion on device down to the main state machine.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Revie
net: sfp: move tx disable on device down to main state machine
Move the tx disable assertion on device down to the main state machine.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
show more ...
|
#
e85d81a1 |
| 10-Nov-2019 |
Russell King <rmk+kernel@armlinux.org.uk> |
net: sfp: move sfp sub-state machines into separate functions
Move the SFP sub-state machines out of the main state machine function, in preparation for it doing a bit more with the device state. B
net: sfp: move sfp sub-state machines into separate functions
Move the SFP sub-state machines out of the main state machine function, in preparation for it doing a bit more with the device state. By doing so, we ensure that our debug after the main state machine is always printed.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
show more ...
|
Revision tags: v5.3.10, v5.3.9, v5.3.8, v5.3.7, v5.3.6, v5.3.5, v5.3.4, v5.3.3, v5.3.2, v5.3.1, v5.3, v5.2.14, v5.3-rc8, v5.2.13, v5.2.12, v5.2.11, v5.2.10 |
|
#
c1236979 |
| 24-Aug-2019 |
Andrew Lunn <andrew@lunn.ch> |
net: phy: sfp: Add labels to hwmon sensors
SFPs can report two different power values, the transmit power and the receive power. Add labels to make it clear which is which. Also add labels to the ot
net: phy: sfp: Add labels to hwmon sensors
SFPs can report two different power values, the transmit power and the receive power. Add labels to make it clear which is which. Also add labels to the other sensors, VCC power supply, bias and module temperature.
sensors(1) now shows:
sff2-isa-0000 Adapter: ISA adapter VCC: +3.23 V temperature: +33.4 C TX_power: 276.00 uW RX_power: 20.00 uW bias: +0.01 A
Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
show more ...
|
Revision tags: v5.2.9, v5.2.8, v5.2.7, v5.2.6, v5.2.5, v5.2.4, v5.2.3 |
|
#
0cea0e11 |
| 21-Jul-2019 |
Andrew Lunn <andrew@lunn.ch> |
net: phy: sfp: hwmon: Fix scaling of RX power
The RX power read from the SFP uses units of 0.1uW. This must be scaled to units of uW for HWMON. This requires a divide by 10, not the current 100.
Wi
net: phy: sfp: hwmon: Fix scaling of RX power
The RX power read from the SFP uses units of 0.1uW. This must be scaled to units of uW for HWMON. This requires a divide by 10, not the current 100.
With this change in place, sensors(1) and ethtool -m agree:
sff2-isa-0000 Adapter: ISA adapter in0: +3.23 V temp1: +33.1 C power1: 270.00 uW power2: 200.00 uW curr1: +0.01 A
Laser output power : 0.2743 mW / -5.62 dBm Receiver signal average optical power : 0.2014 mW / -6.96 dBm
Reported-by: chris.healy@zii.aero Signed-off-by: Andrew Lunn <andrew@lunn.ch> Fixes: 1323061a018a ("net: phy: sfp: Add HWMON support for module sensors") Signed-off-by: David S. Miller <davem@davemloft.net>
show more ...
|
Revision tags: v5.2.2, v5.2.1, v5.2, v5.1.16, v5.1.15, v5.1.14, v5.1.13, v5.1.12, v5.1.11, v5.1.10 |
|
#
1086ca3a |
| 13-Jun-2019 |
Dan Carpenter <dan.carpenter@oracle.com> |
net: phy: sfp: clean up a condition
The acpi_node_get_property_reference() doesn't return ACPI error codes, it just returns regular negative kernel error codes. This patch doesn't affect run time,
net: phy: sfp: clean up a condition
The acpi_node_get_property_reference() doesn't return ACPI error codes, it just returns regular negative kernel error codes. This patch doesn't affect run time, it's just a clean up.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Ruslan Babayev <ruslan@babayev.com> Signed-off-by: David S. Miller <davem@davemloft.net>
show more ...
|
Revision tags: v5.1.9, v5.1.8 |
|
#
2158e856 |
| 07-Jun-2019 |
Robert Hancock <hancock@sedsystems.ca> |
net: sfp: add mutex to prevent concurrent state checks
sfp_check_state can potentially be called by both a threaded IRQ handler and delayed work. If it is concurrently called, it could result in inc
net: sfp: add mutex to prevent concurrent state checks
sfp_check_state can potentially be called by both a threaded IRQ handler and delayed work. If it is concurrently called, it could result in incorrect state management. Add a st_mutex to protect the state - this lock gets taken outside of code that checks and handle state changes, and the existing sm_mutex nests inside of it.
Suggested-by: Russell King <rmk+kernel@armlinux.org.uk> Signed-off-by: Robert Hancock <hancock@sedsystems.ca> Signed-off-by: David S. Miller <davem@davemloft.net>
show more ...
|
#
257c2559 |
| 07-Jun-2019 |
Robert Hancock <hancock@sedsystems.ca> |
net: sfp: Stop SFP polling and interrupt handling during shutdown
SFP device polling can cause problems during the shutdown process if the parent devices of the network controller have been shut dow
net: sfp: Stop SFP polling and interrupt handling during shutdown
SFP device polling can cause problems during the shutdown process if the parent devices of the network controller have been shut down already. This problem was seen on the iMX6 platform with PCIe devices, where accessing the device after the bus is shut down causes a hang.
Free any acquired GPIO interrupts and stop all delayed work in the SFP driver during the shutdown process, so that we ensure that no pending operations are still occurring after the SFP shutdown completes.
Signed-off-by: Robert Hancock <hancock@sedsystems.ca> Signed-off-by: David S. Miller <davem@davemloft.net>
show more ...
|
Revision tags: v5.1.7 |
|
#
28e74a7c |
| 02-Jun-2019 |
Russell King <rmk+kernel@armlinux.org.uk> |
net: sfp: read eeprom in maximum 16 byte increments
Some SFP modules do not like reads longer than 16 bytes, so read the EEPROM in chunks of 16 bytes at a time. This behaviour is not specified in t
net: sfp: read eeprom in maximum 16 byte increments
Some SFP modules do not like reads longer than 16 bytes, so read the EEPROM in chunks of 16 bytes at a time. This behaviour is not specified in the SFP MSAs, which specifies:
"The serial interface uses the 2-wire serial CMOS E2PROM protocol defined for the ATMEL AT24C01A/02/04 family of components."
and
"As long as the SFP+ receives an acknowledge, it shall serially clock out sequential data words. The sequence is terminated when the host responds with a NACK and a STOP instead of an acknowledge."
We must avoid breaking a read across a 16-bit quantity in the diagnostic page, thankfully all 16-bit quantities in that page are naturally aligned.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
show more ...
|
Revision tags: v5.1.6 |
|
#
7ce236fa |
| 28-May-2019 |
Ruslan Babayev <ruslan@babayev.com> |
net: phy: sfp: enable i2c-bus detection on ACPI based systems
Lookup I2C adapter using the "i2c-bus" device property on ACPI based systems similar to how it's done with DT.
An example DSD describin
net: phy: sfp: enable i2c-bus detection on ACPI based systems
Lookup I2C adapter using the "i2c-bus" device property on ACPI based systems similar to how it's done with DT.
An example DSD describing an SFP on an ACPI based system:
Device (SFP0) { Name (_HID, "PRP0001") Name (_CRS, ResourceTemplate() { GpioIo(Exclusive, PullDefault, 0, 0, IoRestrictionNone, "\\_SB.PCI0.RP01.GPIO", 0, ResourceConsumer) { 0, 1, 2, 3, 4 } }) Name (_DSD, Package () { ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), Package () { Package () { "compatible", "sff,sfp" }, Package () { "i2c-bus", \_SB.PCI0.RP01.I2C.MUX.CH0 }, Package () { "maximum-power-milliwatt", 1000 }, Package () { "tx-disable-gpios", Package () { ^SFP0, 0, 0, 1} }, Package () { "reset-gpio", Package () { ^SFP0, 0, 1, 1} }, Package () { "mod-def0-gpios", Package () { ^SFP0, 0, 2, 1} }, Package () { "tx-fault-gpios", Package () { ^SFP0, 0, 3, 0} }, Package () { "los-gpios", Package () { ^SFP0, 0, 4, 1} }, }, }) }
Device (PHY0) { Name (_HID, "PRP0001") Name (_DSD, Package () { ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), Package () { Package () { "compatible", "ethernet-phy-ieee802.3-c45" }, Package () { "sfp", \_SB.PCI0.RP01.SFP0 }, Package () { "managed", "in-band-status" }, Package () { "phy-mode", "sgmii" }, }, }) }
Signed-off-by: Ruslan Babayev <ruslan@babayev.com> Cc: xe-linux-external@cisco.com Acked-by: Russell King <rmk+kernel@armlinux.org.uk> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
show more ...
|