* [PATCH 0/1] net: stmmac: socfgpa: Ensure emac bit set in System Manger for PTP
@ 2016-04-07 7:55 Phil Reid
2016-04-07 7:55 ` [PATCH 1/1] " Phil Reid
0 siblings, 1 reply; 3+ messages in thread
From: Phil Reid @ 2016-04-07 7:55 UTC (permalink / raw)
To: peppe.cavallaro, netdev; +Cc: Phil Reid
Enable PTP FPGA clock, pps and ext trig connections to stmmac.
Note: This hardware configuration is not offically support by Altera.
Phil Reid (1):
net: stmmac: socfgpa: Ensure emac bit set in System Manger for PTP
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
--
1.8.3.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/1] net: stmmac: socfgpa: Ensure emac bit set in System Manger for PTP
2016-04-07 7:55 [PATCH 0/1] net: stmmac: socfgpa: Ensure emac bit set in System Manger for PTP Phil Reid
@ 2016-04-07 7:55 ` Phil Reid
2016-04-11 3:44 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Phil Reid @ 2016-04-07 7:55 UTC (permalink / raw)
To: peppe.cavallaro, netdev; +Cc: Phil Reid
When using the PTP fpga to hps clock source for the stmmac module
the appropriate bit in the System Manager FPGA Interface Group register
needs to be set. This is not set by the bootloader setup when the
HPS emac pins are being for this emac module.
This allows the PTP clock to be sourced from the FPGA and also connects
the PTP pps and ext trig signals to the stmmac PTP hardware.
Patch proposed by Phil Collins.
Signed-off-by: Phil Reid <preid@electromag.com.au>
---
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
index f0d797a..44022b1 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
@@ -34,6 +34,9 @@
#define SYSMGR_EMACGRP_CTRL_PHYSEL_MASK 0x00000003
#define SYSMGR_EMACGRP_CTRL_PTP_REF_CLK_MASK 0x00000010
+#define SYSMGR_FPGAGRP_MODULE_REG 0x00000028
+#define SYSMGR_FPGAGRP_MODULE_EMAC 0x00000004
+
#define EMAC_SPLITTER_CTRL_REG 0x0
#define EMAC_SPLITTER_CTRL_SPEED_MASK 0x3
#define EMAC_SPLITTER_CTRL_SPEED_10 0x2
@@ -148,7 +151,7 @@ static int socfpga_dwmac_setup(struct socfpga_dwmac *dwmac)
int phymode = dwmac->interface;
u32 reg_offset = dwmac->reg_offset;
u32 reg_shift = dwmac->reg_shift;
- u32 ctrl, val;
+ u32 ctrl, val, module;
switch (phymode) {
case PHY_INTERFACE_MODE_RGMII:
@@ -175,12 +178,19 @@ static int socfpga_dwmac_setup(struct socfpga_dwmac *dwmac)
ctrl &= ~(SYSMGR_EMACGRP_CTRL_PHYSEL_MASK << reg_shift);
ctrl |= val << reg_shift;
- if (dwmac->f2h_ptp_ref_clk)
+ if (dwmac->f2h_ptp_ref_clk) {
ctrl |= SYSMGR_EMACGRP_CTRL_PTP_REF_CLK_MASK << (reg_shift / 2);
- else
+ regmap_read(sys_mgr_base_addr, SYSMGR_FPGAGRP_MODULE_REG,
+ &module);
+ module |= (SYSMGR_FPGAGRP_MODULE_EMAC << (reg_shift / 2));
+ regmap_write(sys_mgr_base_addr, SYSMGR_FPGAGRP_MODULE_REG,
+ module);
+ } else {
ctrl &= ~(SYSMGR_EMACGRP_CTRL_PTP_REF_CLK_MASK << (reg_shift / 2));
+ }
regmap_write(sys_mgr_base_addr, reg_offset, ctrl);
+
return 0;
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] net: stmmac: socfgpa: Ensure emac bit set in System Manger for PTP
2016-04-07 7:55 ` [PATCH 1/1] " Phil Reid
@ 2016-04-11 3:44 ` David Miller
0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2016-04-11 3:44 UTC (permalink / raw)
To: preid; +Cc: peppe.cavallaro, netdev
From: Phil Reid <preid@electromag.com.au>
Date: Thu, 7 Apr 2016 15:55:35 +0800
> When using the PTP fpga to hps clock source for the stmmac module
> the appropriate bit in the System Manager FPGA Interface Group register
> needs to be set. This is not set by the bootloader setup when the
> HPS emac pins are being for this emac module.
>
> This allows the PTP clock to be sourced from the FPGA and also connects
> the PTP pps and ext trig signals to the stmmac PTP hardware.
>
> Patch proposed by Phil Collins.
>
> Signed-off-by: Phil Reid <preid@electromag.com.au>
Applied, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-04-11 3:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-07 7:55 [PATCH 0/1] net: stmmac: socfgpa: Ensure emac bit set in System Manger for PTP Phil Reid
2016-04-07 7:55 ` [PATCH 1/1] " Phil Reid
2016-04-11 3:44 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).