Commit aea3dee8 authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'Peer-to-Peer-One-Step-time-stamping'



Richard Cochran says:

====================
Peer to Peer One-Step time stamping

This series adds support for PTP (IEEE 1588) P2P one-step time
stamping along with a driver for a hardware device that supports this.

If the hardware supports p2p one-step, it subtracts the ingress time
stamp value from the Pdelay_Request correction field.  The user space
software stack then simply copies the correction field into the
Pdelay_Response, and on transmission the hardware adds the egress time
stamp into the correction field.

This new functionality extends CONFIG_NETWORK_PHY_TIMESTAMPING to
cover MII snooping devices, but it still depends on phylib, just as
that option does.  Expanding beyond phylib is not within the scope of
the this series.

User space support is available in the current linuxptp master branch.

- Patch 1 adds phy_device methods for existing time stamping fields.
- Patches 2-5 convert the stack and drivers to the new methods.
- Patch 6 moves code around the dp83640 driver.
- Patches 7-10 add support for MII time stamping in non-PHY devices.
- Patch 11 adds the new P2P 1-step option.
- Patch 12 adds a driver implementing the new option.

Thanks,
Richard

Changed in v9:
~~~~~~~~~~~~~~

- Fix two more drivers' switch/case blocks WRT the new HWTSTAMP ioctl.
- Picked up two more review tags from Andrew.

Changed in v8:
~~~~~~~~~~~~~~

- Avoided adding forward functional declarations in the dp83640 driver.
- Picked up Florian's new review tags and another one from Andrew.

Changed in v7:
~~~~~~~~~~~~~~

- Converted pr_debug|err to dev_ variants in new driver.
- Fixed device tree documentation per Rob's v6 review.
- Picked up Andrew's and Rob's review tags.
- Silenced sparse warnings in new driver.

Changed in v6:
~~~~~~~~~~~~~~

- Added methods for accessing the phy_device time stamping fields.
- Adjust the device tree documentation per Rob's v5 review.
- Fixed the build failures due to missing exports.

Changed in v5:
~~~~~~~~~~~~~~

- Fixed build failure in macvlan.
- Fixed latent bug with its gcc warning in the driver.

Changed in v4:
~~~~~~~~~~~~~~

- Correct error paths and PTR_ERR return values in the framework.
- Expanded KernelDoc comments WRT PHY locking.
- Pick up Andrew's review tag.

Changed in v3:
~~~~~~~~~~~~~~

- Simplify the device tree binding and document the time stamping
  phandle by itself.

Changed in v2:
~~~~~~~~~~~~~~

- Per the v1 review, changed the modeling of MII time stamping
  devices.  They are no longer a kind of mdio device.
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 9f6cff99 bad1eaa6
Loading
Loading
Loading
Loading
+35 −0
Original line number Diff line number Diff line
ZHAW InES PTP time stamping IP core

The IP core needs two different kinds of nodes.  The control node
lives somewhere in the memory map and specifies the address of the
control registers.  There can be up to three port handles placed as
attributes of PHY nodes.  These associate a particular MII bus with a
port index within the IP core.

Required properties of the control node:

- compatible:		"ines,ptp-ctrl"
- reg:			physical address and size of the register bank

Required format of the port handle within the PHY node:

- timestamper:		provides control node reference and
			the port channel within the IP core

Example:

	tstamper: timestamper@60000000 {
		compatible = "ines,ptp-ctrl";
		reg = <0x60000000 0x80>;
	};

	ethernet@80000000 {
		...
		mdio {
			...
			ethernet-phy@3 {
				...
				timestamper = <&tstamper 0>;
			};
		};
	};
+42 −0
Original line number Diff line number Diff line
Time stamps from MII bus snooping devices

This binding supports non-PHY devices that snoop the MII bus and
provide time stamps.  In contrast to PHY time stamping drivers (which
can simply attach their interface directly to the PHY instance), stand
alone MII time stamping drivers use this binding to specify the
connection between the snooping device and a given network interface.

Non-PHY MII time stamping drivers typically talk to the control
interface over another bus like I2C, SPI, UART, or via a memory mapped
peripheral.  This controller device is associated with one or more
time stamping channels, each of which snoops on a MII bus.

The "timestamper" property lives in a phy node and links a time
stamping channel from the controller device to that phy's MII bus.

Example:

	tstamper: timestamper@10000000 {
		compatible = "ines,ptp-ctrl";
		reg = <0x10000000 0x80>;
	};

	ethernet@20000000 {
		mdio {
			ethernet-phy@1 {
				timestamper = <&tstamper 0>;
			};
		};
	};

	ethernet@30000000 {
		mdio {
			ethernet-phy@2 {
				timestamper = <&tstamper 1>;
			};
		};
	};

In this example, time stamps from the MII bus attached to phy@1 will
appear on time stamp channel 0 (zero), and those from phy@2 appear on
channel 1.
+1 −0
Original line number Diff line number Diff line
@@ -15410,6 +15410,7 @@ int bnx2x_configure_ptp_filters(struct bnx2x *bp)
		REG_WR(bp, rule, BNX2X_PTP_TX_ON_RULE_MASK);
		break;
	case HWTSTAMP_TX_ONESTEP_SYNC:
	case HWTSTAMP_TX_ONESTEP_P2P:
		BNX2X_ERR("One-step timestamping is not supported\n");
		return -ERANGE;
	}
+1 −0
Original line number Diff line number Diff line
@@ -920,6 +920,7 @@ static int mlxsw_sp_ptp_get_message_types(const struct hwtstamp_config *config,
		egr_types = 0xff;
		break;
	case HWTSTAMP_TX_ONESTEP_SYNC:
	case HWTSTAMP_TX_ONESTEP_P2P:
		return -ERANGE;
	}

+3 −0
Original line number Diff line number Diff line
@@ -1265,6 +1265,9 @@ int lan743x_ptp_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)

		lan743x_ptp_set_sync_ts_insert(adapter, true);
		break;
	case HWTSTAMP_TX_ONESTEP_P2P:
		ret = -ERANGE;
		break;
	default:
		netif_warn(adapter, drv, adapter->netdev,
			   "  tx_type = %d, UNKNOWN\n", config.tx_type);
Loading