History

Merge branch 'topic/xilinx' into for-linus

Vinod Koul committed 9 years ago

Commit b7b02012 parents 3378e7a db6a3d01 file · +35 −28Browse files

Unified · Split

drivers/dma/xilinx/xilinx_dma.c+35−28
@@ -331,6 +331,7 @@ struct xilinx_dma_tx_descriptor { · 330 unmodified lines
331331 * @seg_v: Statically allocated segments base
332332 * @cyclic_seg_v: Statically allocated segment base for cyclic transfers
333333 * @start_transfer: Differentiate b/w DMA IP's transfer
334+ * @stop_transfer: Differentiate b/w DMA IP's quiesce
334335 */
335336 struct xilinx_dma_chan {
336337 struct xilinx_dma_device *xdev;
@@ -361,6 +362,7 @@ struct xilinx_dma_chan { · 24 unmodified lines
361362 struct xilinx_axidma_tx_segment *seg_v;
362363 struct xilinx_axidma_tx_segment *cyclic_seg_v;
363364 void (*start_transfer)(struct xilinx_dma_chan *chan);
365+ int (*stop_transfer)(struct xilinx_dma_chan *chan);
364366 u16 tdest;
365367 };
366368
@@ -946,26 +948,32 @@ static bool xilinx_dma_is_idle(struct xilinx_dma_chan *chan) · 579 unmodified lines
946948 }
947949
948950 /**
949− * xilinx_dma_halt - Halt DMA channel
951+ * xilinx_dma_stop_transfer - Halt DMA channel
950952 * @chan: Driver specific DMA channel
951953 */
952−static void xilinx_dma_halt(struct xilinx_dma_chan *chan)
954+static int xilinx_dma_stop_transfer(struct xilinx_dma_chan *chan)
953955 {
954− int err;
955956 u32 val;
956957
957958 dma_ctrl_clr(chan, XILINX_DMA_REG_DMACR, XILINX_DMA_DMACR_RUNSTOP);
958959
959960 /* Wait for the hardware to halt */
960− err = xilinx_dma_poll_timeout(chan, XILINX_DMA_REG_DMASR, val,
961− (val & XILINX_DMA_DMASR_HALTED), 0,
962− XILINX_DMA_LOOP_COUNT);
961+ return xilinx_dma_poll_timeout(chan, XILINX_DMA_REG_DMASR, val,
962+ val & XILINX_DMA_DMASR_HALTED, 0,
963+ XILINX_DMA_LOOP_COUNT);
964+}
963965
964− if (err) {
965− dev_err(chan->dev, "Cannot stop channel %p: %x\n",
966− chan, dma_ctrl_read(chan, XILINX_DMA_REG_DMASR));
967− chan->err = true;
968− }
966+/**
967+ * xilinx_cdma_stop_transfer - Wait for the current transfer to complete
968+ * @chan: Driver specific DMA channel
969+ */
970+static int xilinx_cdma_stop_transfer(struct xilinx_dma_chan *chan)
971+{
972+ u32 val;
973+
974+ return xilinx_dma_poll_timeout(chan, XILINX_DMA_REG_DMASR, val,
975+ val & XILINX_DMA_DMASR_IDLE, 0,
976+ XILINX_DMA_LOOP_COUNT);
969977 }
970978
971979 /**
@@ -1653,7 +1661,7 @@ xilinx_cdma_prep_memcpy(struct dma_chan *dchan, dma_addr_t dma_dst, · 681 unmodified lines
16531661 {
16541662 struct xilinx_dma_chan *chan = to_xilinx_chan(dchan);
16551663 struct xilinx_dma_tx_descriptor *desc;
1656− struct xilinx_cdma_tx_segment *segment, *prev;
1664+ struct xilinx_cdma_tx_segment *segment;
16571665 struct xilinx_cdma_desc_hw *hw;
16581666
16591667 if (!len || len > XILINX_DMA_MAX_TRANS_LEN)
@@ -1680,21 +1688,11 @@ xilinx_cdma_prep_memcpy(struct dma_chan *dchan, dma_addr_t dma_dst, · 20 unmodified lines
16801688 hw->dest_addr_msb = upper_32_bits(dma_dst);
16811689 }
16821690
1683− /* Fill the previous next descriptor with current */
1684− prev = list_last_entry(&desc->segments,
1685− struct xilinx_cdma_tx_segment, node);
1686− prev->hw.next_desc = segment->phys;
1687−
16881691 /* Insert the segment into the descriptor segments list. */
16891692 list_add_tail(&segment->node, &desc->segments);
16901693
1691− prev = segment;
1692−
1693− /* Link the last hardware descriptor with the first. */
1694− segment = list_first_entry(&desc->segments,
1695− struct xilinx_cdma_tx_segment, node);
16961694 desc->async_tx.phys = segment->phys;
1697− prev->hw.next_desc = segment->phys;
1695+ hw->next_desc = segment->phys;
16981696
16991697 return &desc->async_tx;
17001698
@@ -2003,12 +2001,17 @@ static int xilinx_dma_terminate_all(struct dma_chan *dchan) · 302 unmodified lines
20032001 {
20042002 struct xilinx_dma_chan *chan = to_xilinx_chan(dchan);
20052003 u32 reg;
2004+ int err;
20062005
20072006 if (chan->cyclic)
20082007 xilinx_dma_chan_reset(chan);
20092008
2010− /* Halt the DMA engine */
2011− xilinx_dma_halt(chan);
2009+ err = chan->stop_transfer(chan);
2010+ if (err) {
2011+ dev_err(chan->dev, "Cannot stop channel %p: %x\n",
2012+ chan, dma_ctrl_read(chan, XILINX_DMA_REG_DMASR));
2013+ chan->err = true;
2014+ }
20122015
20132016 /* Remove and free all of the descriptors in the lists */
20142017 xilinx_dma_free_descriptors(chan);
@@ -2397,12 +2400,16 @@ static int xilinx_dma_chan_probe(struct xilinx_dma_device *xdev, · 382 unmodified lines
23972400 return err;
23982401 }
23992402
2400− if (xdev->dma_config->dmatype == XDMA_TYPE_AXIDMA)
2403+ if (xdev->dma_config->dmatype == XDMA_TYPE_AXIDMA) {
24012404 chan->start_transfer = xilinx_dma_start_transfer;
2402− else if (xdev->dma_config->dmatype == XDMA_TYPE_CDMA)
2405+ chan->stop_transfer = xilinx_dma_stop_transfer;
2406+ } else if (xdev->dma_config->dmatype == XDMA_TYPE_CDMA) {
24032407 chan->start_transfer = xilinx_cdma_start_transfer;
2404− else
2408+ chan->stop_transfer = xilinx_cdma_stop_transfer;
2409+ } else {
24052410 chan->start_transfer = xilinx_vdma_start_transfer;
2411+ chan->stop_transfer = xilinx_dma_stop_transfer;
2412+ }
24062413
24072414 /* Initialize the tasklet */
24082415 tasklet_init(&chan->tasklet, xilinx_dma_do_tasklet,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t