aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/stmicro/stmmac/chain_mode.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ethernet/stmicro/stmmac/chain_mode.c')
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/chain_mode.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/chain_mode.c b/drivers/net/ethernet/stmicro/stmmac/chain_mode.c
index 08ff51e9c791..688c3f4f1781 100644
--- a/drivers/net/ethernet/stmicro/stmmac/chain_mode.c
+++ b/drivers/net/ethernet/stmicro/stmmac/chain_mode.c
@@ -89,27 +89,38 @@ static unsigned int stmmac_is_jumbo_frm(int len, int enh_desc)
89 return ret; 89 return ret;
90} 90}
91 91
92static void stmmac_init_dma_chain(struct dma_desc *des, dma_addr_t phy_addr, 92static void stmmac_init_dma_chain(void *des, dma_addr_t phy_addr,
93 unsigned int size) 93 unsigned int size, unsigned int extend_desc)
94{ 94{
95 /* 95 /*
96 * In chained mode the des3 points to the next element in the ring. 96 * In chained mode the des3 points to the next element in the ring.
97 * The latest element has to point to the head. 97 * The latest element has to point to the head.
98 */ 98 */
99 int i; 99 int i;
100 struct dma_desc *p = des;
101 dma_addr_t dma_phy = phy_addr; 100 dma_addr_t dma_phy = phy_addr;
102 101
103 for (i = 0; i < (size - 1); i++) { 102 if (extend_desc) {
104 dma_phy += sizeof(struct dma_desc); 103 struct dma_extended_desc *p = (struct dma_extended_desc *) des;
105 p->des3 = (unsigned int)dma_phy; 104 for (i = 0; i < (size - 1); i++) {
106 p++; 105 dma_phy += sizeof(struct dma_extended_desc);
106 p->basic.des3 = (unsigned int)dma_phy;
107 p++;
108 }
109 p->basic.des3 = (unsigned int)phy_addr;
110
111 } else {
112 struct dma_desc *p = (struct dma_desc *) des;
113 for (i = 0; i < (size - 1); i++) {
114 dma_phy += sizeof(struct dma_desc);
115 p->des3 = (unsigned int)dma_phy;
116 p++;
117 }
118 p->des3 = (unsigned int)phy_addr;
107 } 119 }
108 p->des3 = (unsigned int)phy_addr;
109} 120}
110 121
111const struct stmmac_chain_mode_ops chain_mode_ops = { 122const struct stmmac_chain_mode_ops chain_mode_ops = {
123 .init = stmmac_init_dma_chain,
112 .is_jumbo_frm = stmmac_is_jumbo_frm, 124 .is_jumbo_frm = stmmac_is_jumbo_frm,
113 .jumbo_frm = stmmac_jumbo_frm, 125 .jumbo_frm = stmmac_jumbo_frm,
114 .init_dma_chain = stmmac_init_dma_chain,
115}; 126};