diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/ethernet/ti/cpsw.c | 6 | ||||
-rw-r--r-- | drivers/net/ethernet/ti/davinci_cpdma.c | 17 | ||||
-rw-r--r-- | drivers/net/ethernet/ti/davinci_cpdma.h | 4 | ||||
-rw-r--r-- | drivers/net/ethernet/ti/davinci_emac.c | 6 |
4 files changed, 24 insertions, 9 deletions
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index 888708ceb13c..8ac60c7a2a23 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c | |||
@@ -424,7 +424,7 @@ void cpsw_rx_handler(void *token, int len, int status) | |||
424 | return; | 424 | return; |
425 | 425 | ||
426 | ret = cpdma_chan_submit(priv->rxch, skb, skb->data, | 426 | ret = cpdma_chan_submit(priv->rxch, skb, skb->data, |
427 | skb_tailroom(skb), GFP_KERNEL); | 427 | skb_tailroom(skb), 0, GFP_KERNEL); |
428 | } | 428 | } |
429 | WARN_ON(ret < 0); | 429 | WARN_ON(ret < 0); |
430 | } | 430 | } |
@@ -705,7 +705,7 @@ static int cpsw_ndo_open(struct net_device *ndev) | |||
705 | if (!skb) | 705 | if (!skb) |
706 | break; | 706 | break; |
707 | ret = cpdma_chan_submit(priv->rxch, skb, skb->data, | 707 | ret = cpdma_chan_submit(priv->rxch, skb, skb->data, |
708 | skb_tailroom(skb), GFP_KERNEL); | 708 | skb_tailroom(skb), 0, GFP_KERNEL); |
709 | if (WARN_ON(ret < 0)) | 709 | if (WARN_ON(ret < 0)) |
710 | break; | 710 | break; |
711 | } | 711 | } |
@@ -766,7 +766,7 @@ static netdev_tx_t cpsw_ndo_start_xmit(struct sk_buff *skb, | |||
766 | skb_tx_timestamp(skb); | 766 | skb_tx_timestamp(skb); |
767 | 767 | ||
768 | ret = cpdma_chan_submit(priv->txch, skb, skb->data, | 768 | ret = cpdma_chan_submit(priv->txch, skb, skb->data, |
769 | skb->len, GFP_KERNEL); | 769 | skb->len, 0, GFP_KERNEL); |
770 | if (unlikely(ret != 0)) { | 770 | if (unlikely(ret != 0)) { |
771 | cpsw_err(priv, tx_err, "desc submit failed\n"); | 771 | cpsw_err(priv, tx_err, "desc submit failed\n"); |
772 | goto fail; | 772 | goto fail; |
diff --git a/drivers/net/ethernet/ti/davinci_cpdma.c b/drivers/net/ethernet/ti/davinci_cpdma.c index f8629186afbe..198cf18dc7fc 100644 --- a/drivers/net/ethernet/ti/davinci_cpdma.c +++ b/drivers/net/ethernet/ti/davinci_cpdma.c | |||
@@ -60,6 +60,9 @@ | |||
60 | #define CPDMA_DESC_EOQ BIT(28) | 60 | #define CPDMA_DESC_EOQ BIT(28) |
61 | #define CPDMA_DESC_TD_COMPLETE BIT(27) | 61 | #define CPDMA_DESC_TD_COMPLETE BIT(27) |
62 | #define CPDMA_DESC_PASS_CRC BIT(26) | 62 | #define CPDMA_DESC_PASS_CRC BIT(26) |
63 | #define CPDMA_DESC_TO_PORT_EN BIT(20) | ||
64 | #define CPDMA_TO_PORT_SHIFT 16 | ||
65 | #define CPDMA_DESC_PORT_MASK (BIT(18) | BIT(17) | BIT(16)) | ||
63 | 66 | ||
64 | #define CPDMA_TEARDOWN_VALUE 0xfffffffc | 67 | #define CPDMA_TEARDOWN_VALUE 0xfffffffc |
65 | 68 | ||
@@ -132,6 +135,14 @@ struct cpdma_chan { | |||
132 | #define chan_write(chan, fld, v) __raw_writel(v, (chan)->fld) | 135 | #define chan_write(chan, fld, v) __raw_writel(v, (chan)->fld) |
133 | #define desc_write(desc, fld, v) __raw_writel((u32)(v), &(desc)->fld) | 136 | #define desc_write(desc, fld, v) __raw_writel((u32)(v), &(desc)->fld) |
134 | 137 | ||
138 | #define cpdma_desc_to_port(chan, mode, directed) \ | ||
139 | do { \ | ||
140 | if (!is_rx_chan(chan) && ((directed == 1) || \ | ||
141 | (directed == 2))) \ | ||
142 | mode |= (CPDMA_DESC_TO_PORT_EN | \ | ||
143 | (directed << CPDMA_TO_PORT_SHIFT)); \ | ||
144 | } while (0) | ||
145 | |||
135 | /* | 146 | /* |
136 | * Utility constructs for a cpdma descriptor pool. Some devices (e.g. davinci | 147 | * Utility constructs for a cpdma descriptor pool. Some devices (e.g. davinci |
137 | * emac) have dedicated on-chip memory for these descriptors. Some other | 148 | * emac) have dedicated on-chip memory for these descriptors. Some other |
@@ -662,7 +673,7 @@ static void __cpdma_chan_submit(struct cpdma_chan *chan, | |||
662 | } | 673 | } |
663 | 674 | ||
664 | int cpdma_chan_submit(struct cpdma_chan *chan, void *token, void *data, | 675 | int cpdma_chan_submit(struct cpdma_chan *chan, void *token, void *data, |
665 | int len, gfp_t gfp_mask) | 676 | int len, int directed, gfp_t gfp_mask) |
666 | { | 677 | { |
667 | struct cpdma_ctlr *ctlr = chan->ctlr; | 678 | struct cpdma_ctlr *ctlr = chan->ctlr; |
668 | struct cpdma_desc __iomem *desc; | 679 | struct cpdma_desc __iomem *desc; |
@@ -692,6 +703,7 @@ int cpdma_chan_submit(struct cpdma_chan *chan, void *token, void *data, | |||
692 | 703 | ||
693 | buffer = dma_map_single(ctlr->dev, data, len, chan->dir); | 704 | buffer = dma_map_single(ctlr->dev, data, len, chan->dir); |
694 | mode = CPDMA_DESC_OWNER | CPDMA_DESC_SOP | CPDMA_DESC_EOP; | 705 | mode = CPDMA_DESC_OWNER | CPDMA_DESC_SOP | CPDMA_DESC_EOP; |
706 | cpdma_desc_to_port(chan, mode, directed); | ||
695 | 707 | ||
696 | desc_write(desc, hw_next, 0); | 708 | desc_write(desc, hw_next, 0); |
697 | desc_write(desc, hw_buffer, buffer); | 709 | desc_write(desc, hw_buffer, buffer); |
@@ -782,7 +794,8 @@ static int __cpdma_chan_process(struct cpdma_chan *chan) | |||
782 | status = -EBUSY; | 794 | status = -EBUSY; |
783 | goto unlock_ret; | 795 | goto unlock_ret; |
784 | } | 796 | } |
785 | status = status & (CPDMA_DESC_EOQ | CPDMA_DESC_TD_COMPLETE); | 797 | status = status & (CPDMA_DESC_EOQ | CPDMA_DESC_TD_COMPLETE | |
798 | CPDMA_DESC_PORT_MASK); | ||
786 | 799 | ||
787 | chan->head = desc_from_phys(pool, desc_read(desc, hw_next)); | 800 | chan->head = desc_from_phys(pool, desc_read(desc, hw_next)); |
788 | chan_write(chan, cp, desc_dma); | 801 | chan_write(chan, cp, desc_dma); |
diff --git a/drivers/net/ethernet/ti/davinci_cpdma.h b/drivers/net/ethernet/ti/davinci_cpdma.h index 8d2aeb2096ac..a97d6ab30941 100644 --- a/drivers/net/ethernet/ti/davinci_cpdma.h +++ b/drivers/net/ethernet/ti/davinci_cpdma.h | |||
@@ -24,6 +24,8 @@ | |||
24 | #define __chan_linear(chan_num) ((chan_num) & (CPDMA_MAX_CHANNELS - 1)) | 24 | #define __chan_linear(chan_num) ((chan_num) & (CPDMA_MAX_CHANNELS - 1)) |
25 | #define chan_linear(chan) __chan_linear((chan)->chan_num) | 25 | #define chan_linear(chan) __chan_linear((chan)->chan_num) |
26 | 26 | ||
27 | #define CPDMA_RX_SOURCE_PORT(__status__) ((__status__ >> 16) & 0x7) | ||
28 | |||
27 | struct cpdma_params { | 29 | struct cpdma_params { |
28 | struct device *dev; | 30 | struct device *dev; |
29 | void __iomem *dmaregs; | 31 | void __iomem *dmaregs; |
@@ -82,7 +84,7 @@ int cpdma_chan_dump(struct cpdma_chan *chan); | |||
82 | int cpdma_chan_get_stats(struct cpdma_chan *chan, | 84 | int cpdma_chan_get_stats(struct cpdma_chan *chan, |
83 | struct cpdma_chan_stats *stats); | 85 | struct cpdma_chan_stats *stats); |
84 | int cpdma_chan_submit(struct cpdma_chan *chan, void *token, void *data, | 86 | int cpdma_chan_submit(struct cpdma_chan *chan, void *token, void *data, |
85 | int len, gfp_t gfp_mask); | 87 | int len, int directed, gfp_t gfp_mask); |
86 | int cpdma_chan_process(struct cpdma_chan *chan, int quota); | 88 | int cpdma_chan_process(struct cpdma_chan *chan, int quota); |
87 | 89 | ||
88 | int cpdma_ctlr_int_ctrl(struct cpdma_ctlr *ctlr, bool enable); | 90 | int cpdma_ctlr_int_ctrl(struct cpdma_ctlr *ctlr, bool enable); |
diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c index 242ec55110d2..52c05366599a 100644 --- a/drivers/net/ethernet/ti/davinci_emac.c +++ b/drivers/net/ethernet/ti/davinci_emac.c | |||
@@ -1037,7 +1037,7 @@ static void emac_rx_handler(void *token, int len, int status) | |||
1037 | 1037 | ||
1038 | recycle: | 1038 | recycle: |
1039 | ret = cpdma_chan_submit(priv->rxchan, skb, skb->data, | 1039 | ret = cpdma_chan_submit(priv->rxchan, skb, skb->data, |
1040 | skb_tailroom(skb), GFP_KERNEL); | 1040 | skb_tailroom(skb), 0, GFP_KERNEL); |
1041 | 1041 | ||
1042 | WARN_ON(ret == -ENOMEM); | 1042 | WARN_ON(ret == -ENOMEM); |
1043 | if (unlikely(ret < 0)) | 1043 | if (unlikely(ret < 0)) |
@@ -1092,7 +1092,7 @@ static int emac_dev_xmit(struct sk_buff *skb, struct net_device *ndev) | |||
1092 | skb_tx_timestamp(skb); | 1092 | skb_tx_timestamp(skb); |
1093 | 1093 | ||
1094 | ret_code = cpdma_chan_submit(priv->txchan, skb, skb->data, skb->len, | 1094 | ret_code = cpdma_chan_submit(priv->txchan, skb, skb->data, skb->len, |
1095 | GFP_KERNEL); | 1095 | 0, GFP_KERNEL); |
1096 | if (unlikely(ret_code != 0)) { | 1096 | if (unlikely(ret_code != 0)) { |
1097 | if (netif_msg_tx_err(priv) && net_ratelimit()) | 1097 | if (netif_msg_tx_err(priv) && net_ratelimit()) |
1098 | dev_err(emac_dev, "DaVinci EMAC: desc submit failed"); | 1098 | dev_err(emac_dev, "DaVinci EMAC: desc submit failed"); |
@@ -1558,7 +1558,7 @@ static int emac_dev_open(struct net_device *ndev) | |||
1558 | break; | 1558 | break; |
1559 | 1559 | ||
1560 | ret = cpdma_chan_submit(priv->rxchan, skb, skb->data, | 1560 | ret = cpdma_chan_submit(priv->rxchan, skb, skb->data, |
1561 | skb_tailroom(skb), GFP_KERNEL); | 1561 | skb_tailroom(skb), 0, GFP_KERNEL); |
1562 | if (WARN_ON(ret < 0)) | 1562 | if (WARN_ON(ret < 0)) |
1563 | break; | 1563 | break; |
1564 | } | 1564 | } |