Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 592f934b authored by Furong Xu's avatar Furong Xu Committed by Greg Kroah-Hartman
Browse files

net: stmmac: xgmac: Enable support for multiple Flexible PPS outputs



[ Upstream commit db456d90a4c1b43b6251fa4348c8adc59b583274 ]

From XGMAC Core 3.20 and later, each Flexible PPS has individual PPSEN bit
to select Fixed mode or Flexible mode. The PPSEN must be set, or it stays
in Fixed PPS mode by default.
XGMAC Core prior 3.20, only PPSEN0(bit 4) is writable. PPSEN{1,2,3} are
read-only reserved, and they are already in Flexible mode by default, our
new code always set PPSEN{1,2,3} do not make things worse ;-)

Fixes: 95eaf3cd ("net: stmmac: dwxgmac: Add Flexible PPS support")
Reviewed-by: default avatarSerge Semin <fancer.lancer@gmail.com>
Reviewed-by: default avatarJacob Keller <jacob.e.keller@intel.com>
Signed-off-by: default avatarFurong Xu <0x1207@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 85513df5
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -212,7 +212,7 @@
	((val) << XGMAC_PPS_MINIDX(x))
#define XGMAC_PPSCMD_START		0x2
#define XGMAC_PPSCMD_STOP		0x5
#define XGMAC_PPSEN0			BIT(4)
#define XGMAC_PPSENx(x)			BIT(4 + (x) * 8)
#define XGMAC_PPSx_TARGET_TIME_SEC(x)	(0x00000d80 + (x) * 0x10)
#define XGMAC_PPSx_TARGET_TIME_NSEC(x)	(0x00000d84 + (x) * 0x10)
#define XGMAC_TRGTBUSY0			BIT(31)
+13 −1
Original line number Diff line number Diff line
@@ -1101,7 +1101,19 @@ static int dwxgmac2_flex_pps_config(void __iomem *ioaddr, int index,

	val |= XGMAC_PPSCMDx(index, XGMAC_PPSCMD_START);
	val |= XGMAC_TRGTMODSELx(index, XGMAC_PPSCMD_START);
	val |= XGMAC_PPSEN0;

	/* XGMAC Core has 4 PPS outputs at most.
	 *
	 * Prior XGMAC Core 3.20, Fixed mode or Flexible mode are selectable for
	 * PPS0 only via PPSEN0. PPS{1,2,3} are in Flexible mode by default,
	 * and can not be switched to Fixed mode, since PPSEN{1,2,3} are
	 * read-only reserved to 0.
	 * But we always set PPSEN{1,2,3} do not make things worse ;-)
	 *
	 * From XGMAC Core 3.20 and later, PPSEN{0,1,2,3} are writable and must
	 * be set, or the PPS outputs stay in Fixed PPS mode by default.
	 */
	val |= XGMAC_PPSENx(index);

	writel(cfg->start.tv_sec, ioaddr + XGMAC_PPSx_TARGET_TIME_SEC(index));