aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/ti/davinci_cpdma.c
diff options
context:
space:
mode:
authorMugunthan V N <mugunthanvnm@ti.com>2013-02-11 04:52:18 -0500
committerDavid S. Miller <davem@davemloft.net>2013-02-12 16:15:09 -0500
commitf6e135c81eeb648c6addc6aeff2ee80f28ea413b (patch)
treee8efd6732b75fab7cba75d8e68b4bf2fd31acb25 /drivers/net/ethernet/ti/davinci_cpdma.c
parent570617e79c3ab31ce426efe9024af84efca862eb (diff)
driver: net: ethernet: davinci_cpdma: add support for directed packet and source port detection
* Introduced parameter to add port number for directed packet in cpdma_chan_submit * Source port detection macro with DMA descriptor status Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/ti/davinci_cpdma.c')
-rw-r--r--drivers/net/ethernet/ti/davinci_cpdma.c17
1 files changed, 15 insertions, 2 deletions
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
664int cpdma_chan_submit(struct cpdma_chan *chan, void *token, void *data, 675int 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);