Skip to contentSkip to conversation

net: sxgbe: Added condition for non fix_burst mode

PATCH In review Byungho An 2 participants 3 messages May 7, 2014 – May 8, 2014

Subsystems (4)
lore
Share & tools
lore

Byungho An

author maintainer
#0 lore raw

PATCH 1/1 net: sxgbe: Added condition for non fix_burst mode

This patch adds the condition for non fixed burst mode and separates into two conditions depending on pbl value.

---
 drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.c  |   32 ++++++++++++++++++++---
 drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.h  |    2 +-
 drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c |    3 ++-
 3 files changed, 32 insertions(+), 5 deletions(-)
drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.c +29 -3
index bb9b5b8..49240c9 100644
@@ -45,7 +45,8 @@ static int sxgbe_dma_init(void __iomem *ioaddr, int fix_burst, int burst_map)
 
 static void sxgbe_dma_channel_init(void __iomem *ioaddr, int cha_num,
 				   int fix_burst, int pbl, dma_addr_t dma_tx,
-				   dma_addr_t dma_rx, int t_rsize, int r_rsize)
+				   dma_addr_t dma_rx, int t_rsize, int r_rsize,
+				   int buf_size)
 {
 	u32 reg_val;
 	dma_addr_t dma_addr;
@@ -57,12 +58,37 @@ static void sxgbe_dma_channel_init(void __iomem *ioaddr, int cha_num,
 		writel(reg_val, ioaddr + SXGBE_DMA_CHA_CTL_REG(cha_num));
 		/* program the TX pbl */
 		reg_val = readl(ioaddr + SXGBE_DMA_CHA_TXCTL_REG(cha_num));
-		reg_val |= (pbl << SXGBE_DMA_TXPBL_LSHIFT);
+		reg_val |= pbl << SXGBE_DMA_TXPBL_LSHIFT;
 		writel(reg_val, ioaddr + SXGBE_DMA_CHA_TXCTL_REG(cha_num));
 		/* program the RX pbl */
 		reg_val = readl(ioaddr + SXGBE_DMA_CHA_RXCTL_REG(cha_num));
-		reg_val |= (pbl << SXGBE_DMA_RXPBL_LSHIFT);
+		reg_val |= pbl << SXGBE_DMA_RXPBL_LSHIFT;
 		writel(reg_val, ioaddr + SXGBE_DMA_CHA_RXCTL_REG(cha_num));
+	} else {
+		if (pbl > 32) {
+			/* program the pblx8  */
+			reg_val |= SXGBE_DMA_PBL_X8MODE;
+			writel(reg_val, ioaddr + SXGBE_DMA_CHA_CTL_REG(cha_num));
+			/* program the TX pbl */
+			reg_val = readl(ioaddr + SXGBE_DMA_CHA_TXCTL_REG(cha_num));
+			reg_val |= (pbl >> 3) << SXGBE_DMA_TXPBL_LSHIFT;
+			writel(reg_val, ioaddr + SXGBE_DMA_CHA_TXCTL_REG(cha_num));
+			/* program the RX pbl */
+			reg_val = readl(ioaddr + SXGBE_DMA_CHA_RXCTL_REG(cha_num));
+			reg_val |= (pbl >> 3) << SXGBE_DMA_RXPBL_LSHIFT |
+				   buf_size << SXGBE_DMA_BLENMAP_LSHIFT;
+			writel(reg_val, ioaddr + SXGBE_DMA_CHA_RXCTL_REG(cha_num));
+		} else {
+			/* program the TX pbl */
+			reg_val = readl(ioaddr + SXGBE_DMA_CHA_TXCTL_REG(cha_num));
+			reg_val |= pbl << SXGBE_DMA_TXPBL_LSHIFT;
+			writel(reg_val, ioaddr + SXGBE_DMA_CHA_TXCTL_REG(cha_num));
+			/* program the RX pbl */
+			reg_val = readl(ioaddr + SXGBE_DMA_CHA_RXCTL_REG(cha_num));
+			reg_val |= pbl << SXGBE_DMA_RXPBL_LSHIFT |
+				   buf_size << SXGBE_DMA_BLENMAP_LSHIFT;
+			writel(reg_val, ioaddr + SXGBE_DMA_CHA_RXCTL_REG(cha_num));
+		}
 	}
 
 	/* program desc registers */
drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.h +1 -1
index 1607b54..843fa9b 100644
@@ -25,7 +25,7 @@ struct sxgbe_dma_ops {
 	int (*init)(void __iomem *ioaddr, int fix_burst, int burst_map);
 	void (*cha_init)(void __iomem *ioaddr, int cha_num, int fix_burst,
 			 int pbl, dma_addr_t dma_tx, dma_addr_t dma_rx,
-			 int t_rzie, int r_rsize);
+			 int t_rzie, int r_rsize, int buf_size);
 	void (*enable_dma_transmission)(void __iomem *ioaddr, int dma_cnum);
 	void (*enable_dma_irq)(void __iomem *ioaddr, int dma_cnum);
 	void (*disable_dma_irq)(void __iomem *ioaddr, int dma_cnum);
drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c +2 -1
index 82a9a98..93bf151 100644
@@ -944,7 +944,8 @@ static int sxgbe_init_dma_engine(struct sxgbe_priv_data *priv)
 					fixed_burst, pbl,
 					(priv->txq[queue_num])->dma_tx_phy,
 					(priv->rxq[queue_num])->dma_rx_phy,
-					priv->dma_tx_size, priv->dma_rx_size);
+					priv->dma_tx_size, priv->dma_rx_size,
+					priv->dma_buf_sz);
 
 	return priv->hw->dma->init(priv->ioaddr, fixed_burst, burst_map);
 }
Signature · 1 line
1.7.10.4
maintainer
#1 lore raw

Please start numbering your patches and submit patch sets properly.

You need to provide:

1) A header posting with subject "[PATCH 0/${N}] blah blah blah" that describes at a high level what the patch series does.

2) The patches, in the correct order, numbered in the subject line in the format "[PATCH X/${N}] ..."

Otherwise I have no idea what order the patches are supposed to be applied, whether the patches depend upon eachother, and if so in what way.

I'm not applying these sxgbe patches until you start posting them properly, thank you.

author maintainer
#2 lore raw
Quoted 10 lines · David Miller

Please start numbering your patches and submit patch sets properly.

You need to provide:

1) A header posting with subject "[PATCH 0/${N}] blah blah blah" that describes at a high level what the patch series does.

2) The patches, in the correct order, numbered in the subject line in the format "[PATCH X/${N}] ..."

Quoted 6 lines

Otherwise I have no idea what order the patches are supposed to be applied, whether the patches depend upon eachother, and if so in what way.

I'm not applying these sxgbe patches until you start posting them properly, thank you.

Ok, I'll repost patches