b375cf750f5726c038d9f17ff339d9dc07f05cf6
[openwrt/staging/linusw.git] /
1 From 35efc0f34b56ca9d5fb5d080d5de0833ded7e3b8 Mon Sep 17 00:00:00 2001
2 From: Anji J <anji.jagarlmudi@freescale.com>
3 Date: Tue, 21 Jun 2016 13:25:12 +0530
4 Subject: [PATCH 66/93] armv8:pfe Enable UDP checksum for proper tftp
5 operation
6
7 1. Add CONFIG_UDP_CHECKSUM flag to perform UDP checksum in S/W
8 instead of hardware
9 2. Rx descriptor model changed back to original
10 removed strobe mode
11 3. Send more than one dummy packets to bring HIF BD to idle state
12
13 Signed-off-by: Anji J <anji.jagarlmudi@freescale.com>
14 ---
15 common/cmd_pfe_commands.c | 12 +++++++-----
16 drivers/net/pfe_eth/pfe_driver.c | 19 +++----------------
17 include/configs/ls1012a_common.h | 1 +
18 3 files changed, 11 insertions(+), 21 deletions(-)
19
20 diff --git a/common/cmd_pfe_commands.c b/common/cmd_pfe_commands.c
21 index 92917e0..3575ad4 100644
22 --- a/common/cmd_pfe_commands.c
23 +++ b/common/cmd_pfe_commands.c
24 @@ -929,7 +929,7 @@ static void send_dummy_pkt_to_hif(void)
25
26 static void pfe_command_stop(int argc, char * const argv[])
27 {
28 - int id;
29 + int id, hif_stop_loop = 10;
30 u32 rx_status;
31 printf("Stopping PFE... \n");
32
33 @@ -937,10 +937,12 @@ static void pfe_command_stop(int argc, char * const argv[])
34 hif_rx_desc_disable();
35
36 /*If HIF Rx BDP is busy send a dummy packet */
37 - rx_status = readl(HIF_RX_STATUS);
38 - if(rx_status & BDP_CSR_RX_DMA_ACTV)
39 - send_dummy_pkt_to_hif();
40 - udelay(10);
41 + do {
42 + rx_status = readl(HIF_RX_STATUS);
43 + if (rx_status & BDP_CSR_RX_DMA_ACTV)
44 + send_dummy_pkt_to_hif();
45 + udelay(10);
46 + } while (hif_stop_loop--);
47
48 if(readl(HIF_RX_STATUS) & BDP_CSR_RX_DMA_ACTV)
49 printf("Unable to stop HIF\n");
50 diff --git a/drivers/net/pfe_eth/pfe_driver.c b/drivers/net/pfe_eth/pfe_driver.c
51 index e252fcf..6774fb4 100644
52 --- a/drivers/net/pfe_eth/pfe_driver.c
53 +++ b/drivers/net/pfe_eth/pfe_driver.c
54 @@ -37,13 +37,8 @@ int pfe_recv(unsigned int *pkt_ptr, int *phy_port)
55
56 bd = rx_desc->rxBase + rx_desc->rxToRead;
57
58 - if (bd->ctrl & BD_CTRL_DESC_EN) {
59 - if(!(readl(HIF_RX_STATUS) & BDP_CSR_RX_DMA_ACTV)){
60 - /*If BDP is not active give write strobe */
61 - writel((readl(HIF_RX_CTRL) | HIF_CTRL_BDP_CH_START_WSTB), HIF_RX_CTRL);
62 - }
63 + if (bd->ctrl & BD_CTRL_DESC_EN)
64 return len; //No pending Rx packet
65 - }
66
67 /* this len include hif_header(8bytes) */
68 len = bd->ctrl & 0xFFFF;
69 @@ -72,15 +67,10 @@ int pfe_recv(unsigned int *pkt_ptr, int *phy_port)
70 *phy_port = hif_header->port_no;
71 len -= sizeof(struct hif_header_s);
72
73 -#if defined(PFE_LS1012A_RESET_WA)
74 - /* reset bd control field */
75 - ctrl = (MAX_FRAME_SIZE | BD_CTRL_LAST_BD | BD_CTRL_LIFM | BD_CTRL_DESC_EN | BD_CTRL_DIR);
76 -#else
77 /* reset bd control field */
78 ctrl = (MAX_FRAME_SIZE | BD_CTRL_LIFM | BD_CTRL_DESC_EN | BD_CTRL_DIR);
79 - /* If we use BD_CTRL_LAST_BD, rxToRead never changes */
80 rx_desc->rxToRead = (rx_desc->rxToRead + 1) & (rx_desc->rxRingSize - 1);
81 -#endif
82 +
83 bd->ctrl = ctrl;
84 bd->status = 0;
85
86 @@ -363,11 +353,8 @@ static int hif_rx_desc_init(struct pfe *pfe)
87
88 memset(bd_va, 0, sizeof(struct bufDesc) * rx_desc->rxRingSize);
89
90 -#if defined(PFE_LS1012A_RESET_WA)
91 - ctrl = (MAX_FRAME_SIZE | BD_CTRL_LAST_BD | BD_CTRL_DESC_EN | BD_CTRL_DIR | BD_CTRL_LIFM);
92 -#else
93 ctrl = (MAX_FRAME_SIZE | BD_CTRL_DESC_EN | BD_CTRL_DIR | BD_CTRL_LIFM);
94 -#endif
95 +
96 for (i=0; i < rx_desc->rxRingSize; i++) {
97 bd_va->next = (unsigned long)(bd_pa + 1);
98 bd_va->ctrl = ctrl;
99 diff --git a/include/configs/ls1012a_common.h b/include/configs/ls1012a_common.h
100 index 4c7c697..47b8ec3 100644
101 --- a/include/configs/ls1012a_common.h
102 +++ b/include/configs/ls1012a_common.h
103 @@ -116,6 +116,7 @@
104 #ifdef CONFIG_FSL_PPFE
105 #define CONFIG_CMD_PFE_COMMANDS
106 #define CONFIG_UTIL_PE_DISABLED
107 +#define CONFIG_UDP_CHECKSUM
108
109 #endif
110
111 --
112 1.7.9.5
113