aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/freescale/fec_main.c
diff options
context:
space:
mode:
authorNimrod Andy <B38611@freescale.com>2014-10-15 05:30:12 -0400
committerDavid S. Miller <davem@davemloft.net>2014-10-15 16:40:11 -0400
commit28b5f058cf1d268d965894ce42a614d13f853dd6 (patch)
tree279c57e8845b5024e5c9363989560fe3d079d2c6 /drivers/net/ethernet/freescale/fec_main.c
parent001586a737ee8c11a1198c352c5635f19fd090ed (diff)
net: fec: ptp: fix convergence issue to support LinuxPTP stack
iMX6SX IEEE 1588 module has one hw issue in capturing the ATVR register. The current SW flow is: ENET0->ATCR |= ENET_ATCR_CAPTURE_MASK; ts_counter_ns = ENET0->ATVR; The ATVR value is not expected value that cause LinuxPTP stack cannot be convergent. ENET Block Guide/ Chapter for the iMX6SX (PELE) address the issue: After set ENET_ATCR[Capture], there need some time cycles before the counter value is capture in the register clock domain. The wait-time-cycles is at least 6 clock cycles of the slower clock between the register clock and the 1588 clock. So need something like: ENET0->ATCR |= ENET_ATCR_CAPTURE_MASK; wait(); ts_counter_ns = ENET0->ATVR; For iMX6SX, the 1588 ts_clk is fixed to 25Mhz, register clock is 66Mhz, so the wait-time-cycles must be greater than 240ns (40ns * 6). The patch add 1us delay before cpu read ATVR register. Changes V2: Modify the commit/comments log to describe the issue clearly. Signed-off-by: Fugang Duan <B38611@freescale.com> Acked-by: Richard Cochran <richardcochran@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/freescale/fec_main.c')
-rw-r--r--drivers/net/ethernet/freescale/fec_main.c43
1 files changed, 1 insertions, 42 deletions
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index e364d1fc7bdc..81b96cf87574 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -78,47 +78,6 @@ static void fec_enet_itr_coal_init(struct net_device *ndev);
78#define FEC_ENET_RAFL_V 0x8 78#define FEC_ENET_RAFL_V 0x8
79#define FEC_ENET_OPD_V 0xFFF0 79#define FEC_ENET_OPD_V 0xFFF0
80 80
81/* Controller is ENET-MAC */
82#define FEC_QUIRK_ENET_MAC (1 << 0)
83/* Controller needs driver to swap frame */
84#define FEC_QUIRK_SWAP_FRAME (1 << 1)
85/* Controller uses gasket */
86#define FEC_QUIRK_USE_GASKET (1 << 2)
87/* Controller has GBIT support */
88#define FEC_QUIRK_HAS_GBIT (1 << 3)
89/* Controller has extend desc buffer */
90#define FEC_QUIRK_HAS_BUFDESC_EX (1 << 4)
91/* Controller has hardware checksum support */
92#define FEC_QUIRK_HAS_CSUM (1 << 5)
93/* Controller has hardware vlan support */
94#define FEC_QUIRK_HAS_VLAN (1 << 6)
95/* ENET IP errata ERR006358
96 *
97 * If the ready bit in the transmit buffer descriptor (TxBD[R]) is previously
98 * detected as not set during a prior frame transmission, then the
99 * ENET_TDAR[TDAR] bit is cleared at a later time, even if additional TxBDs
100 * were added to the ring and the ENET_TDAR[TDAR] bit is set. This results in
101 * frames not being transmitted until there is a 0-to-1 transition on
102 * ENET_TDAR[TDAR].
103 */
104#define FEC_QUIRK_ERR006358 (1 << 7)
105/* ENET IP hw AVB
106 *
107 * i.MX6SX ENET IP add Audio Video Bridging (AVB) feature support.
108 * - Two class indicators on receive with configurable priority
109 * - Two class indicators and line speed timer on transmit allowing
110 * implementation class credit based shapers externally
111 * - Additional DMA registers provisioned to allow managing up to 3
112 * independent rings
113 */
114#define FEC_QUIRK_HAS_AVB (1 << 8)
115/* There is a TDAR race condition for mutliQ when the software sets TDAR
116 * and the UDMA clears TDAR simultaneously or in a small window (2-4 cycles).
117 * This will cause the udma_tx and udma_tx_arbiter state machines to hang.
118 * The issue exist at i.MX6SX enet IP.
119 */
120#define FEC_QUIRK_ERR007885 (1 << 9)
121
122static struct platform_device_id fec_devtype[] = { 81static struct platform_device_id fec_devtype[] = {
123 { 82 {
124 /* keep it for coldfire */ 83 /* keep it for coldfire */
@@ -146,7 +105,7 @@ static struct platform_device_id fec_devtype[] = {
146 .driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_GBIT | 105 .driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_GBIT |
147 FEC_QUIRK_HAS_BUFDESC_EX | FEC_QUIRK_HAS_CSUM | 106 FEC_QUIRK_HAS_BUFDESC_EX | FEC_QUIRK_HAS_CSUM |
148 FEC_QUIRK_HAS_VLAN | FEC_QUIRK_HAS_AVB | 107 FEC_QUIRK_HAS_VLAN | FEC_QUIRK_HAS_AVB |
149 FEC_QUIRK_ERR007885, 108 FEC_QUIRK_ERR007885 | FEC_QUIRK_BUG_CAPTURE,
150 }, { 109 }, {
151 /* sentinel */ 110 /* sentinel */
152 } 111 }