diff options
author | Russell King - ARM Linux <linux@arm.linux.org.uk> | 2011-01-03 17:39:13 -0500 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2011-01-04 22:16:12 -0500 |
commit | 19524d77ec34faf58d313ba34fb755ef6e159216 (patch) | |
tree | 63b24d5a82de3ee5fd8e07a311eb8d573cd21f76 | |
parent | c885bee4f10323a1ff3f19e1aa2aa6f4e7f89dd8 (diff) |
ARM: PL08x: avoid duplicating registers in txd and phychan structures
As we now have all the code accessing the phychan {csrc,cdst,clli,cctl,
ccfg} members in one function, there's no point storing the data into
the struct. Get rid of the struct members. Re-order the register dump
in the dev_dbg() to reflect the order we write the registers to the DMA
device.
The txd {csrc,cdst,clli,cctl} values are duplicates of the lli[0]
values, so there's no point duplicating these either. Program the DMAC
registers directly from the lli[0] values.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Acked-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
-rw-r--r-- | drivers/dma/amba-pl08x.c | 57 | ||||
-rw-r--r-- | include/linux/amba/pl08x.h | 13 |
2 files changed, 19 insertions, 51 deletions
diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c index c025a4b4bae4..a1a18bde6b7f 100644 --- a/drivers/dma/amba-pl08x.c +++ b/drivers/dma/amba-pl08x.c | |||
@@ -193,33 +193,25 @@ static void pl08x_start_txd(struct pl08x_dma_chan *plchan, | |||
193 | { | 193 | { |
194 | struct pl08x_driver_data *pl08x = plchan->host; | 194 | struct pl08x_driver_data *pl08x = plchan->host; |
195 | struct pl08x_phy_chan *phychan = plchan->phychan; | 195 | struct pl08x_phy_chan *phychan = plchan->phychan; |
196 | u32 val; | 196 | struct pl08x_lli *lli = &txd->llis_va[0]; |
197 | u32 val, ccfg; | ||
197 | 198 | ||
198 | plchan->at = txd; | 199 | plchan->at = txd; |
199 | 200 | ||
200 | /* Copy the basic control register calculated at transfer config */ | ||
201 | phychan->csrc = txd->csrc; | ||
202 | phychan->cdst = txd->cdst; | ||
203 | phychan->clli = txd->clli; | ||
204 | phychan->cctl = txd->cctl; | ||
205 | |||
206 | /* Assign the signal to the proper control registers */ | 201 | /* Assign the signal to the proper control registers */ |
207 | phychan->ccfg = plchan->cd->ccfg; | 202 | ccfg = plchan->cd->ccfg; |
208 | phychan->ccfg &= ~PL080_CONFIG_SRC_SEL_MASK; | 203 | ccfg &= ~(PL080_CONFIG_SRC_SEL_MASK | PL080_CONFIG_DST_SEL_MASK); |
209 | phychan->ccfg &= ~PL080_CONFIG_DST_SEL_MASK; | 204 | |
210 | /* If it wasn't set from AMBA, ignore it */ | 205 | /* If it wasn't set from AMBA, ignore it */ |
211 | if (txd->direction == DMA_TO_DEVICE) | 206 | if (txd->direction == DMA_TO_DEVICE) |
212 | /* Select signal as destination */ | 207 | /* Select signal as destination */ |
213 | phychan->ccfg |= | 208 | ccfg |= phychan->signal << PL080_CONFIG_DST_SEL_SHIFT; |
214 | (phychan->signal << PL080_CONFIG_DST_SEL_SHIFT); | ||
215 | else if (txd->direction == DMA_FROM_DEVICE) | 209 | else if (txd->direction == DMA_FROM_DEVICE) |
216 | /* Select signal as source */ | 210 | /* Select signal as source */ |
217 | phychan->ccfg |= | 211 | ccfg |= phychan->signal << PL080_CONFIG_SRC_SEL_SHIFT; |
218 | (phychan->signal << PL080_CONFIG_SRC_SEL_SHIFT); | 212 | |
219 | /* Always enable error interrupts */ | 213 | /* Always enable error and terminal interrupts */ |
220 | phychan->ccfg |= PL080_CONFIG_ERR_IRQ_MASK; | 214 | ccfg |= PL080_CONFIG_ERR_IRQ_MASK | PL080_CONFIG_TC_IRQ_MASK; |
221 | /* Always enable terminal interrupts */ | ||
222 | phychan->ccfg |= PL080_CONFIG_TC_IRQ_MASK; | ||
223 | 215 | ||
224 | /* Wait for channel inactive */ | 216 | /* Wait for channel inactive */ |
225 | while (pl08x_phy_channel_busy(phychan)) | 217 | while (pl08x_phy_channel_busy(phychan)) |
@@ -227,19 +219,15 @@ static void pl08x_start_txd(struct pl08x_dma_chan *plchan, | |||
227 | 219 | ||
228 | dev_vdbg(&pl08x->adev->dev, | 220 | dev_vdbg(&pl08x->adev->dev, |
229 | "WRITE channel %d: csrc=0x%08x, cdst=0x%08x, " | 221 | "WRITE channel %d: csrc=0x%08x, cdst=0x%08x, " |
230 | "cctl=0x%08x, clli=0x%08x, ccfg=0x%08x\n", | 222 | "clli=0x%08x, cctl=0x%08x, ccfg=0x%08x\n", |
231 | phychan->id, | 223 | phychan->id, lli->src, lli->dst, lli->lli, lli->cctl, |
232 | phychan->csrc, | 224 | ccfg); |
233 | phychan->cdst, | 225 | |
234 | phychan->cctl, | 226 | writel(lli->src, phychan->base + PL080_CH_SRC_ADDR); |
235 | phychan->clli, | 227 | writel(lli->dst, phychan->base + PL080_CH_DST_ADDR); |
236 | phychan->ccfg); | 228 | writel(lli->lli, phychan->base + PL080_CH_LLI); |
237 | 229 | writel(lli->cctl, phychan->base + PL080_CH_CONTROL); | |
238 | writel(phychan->csrc, phychan->base + PL080_CH_SRC_ADDR); | 230 | writel(ccfg, phychan->base + PL080_CH_CONFIG); |
239 | writel(phychan->cdst, phychan->base + PL080_CH_DST_ADDR); | ||
240 | writel(phychan->clli, phychan->base + PL080_CH_LLI); | ||
241 | writel(phychan->cctl, phychan->base + PL080_CH_CONTROL); | ||
242 | writel(phychan->ccfg, phychan->base + PL080_CH_CONFIG); | ||
243 | 231 | ||
244 | /* Enable the DMA channel */ | 232 | /* Enable the DMA channel */ |
245 | /* Do not access config register until channel shows as disabled */ | 233 | /* Do not access config register until channel shows as disabled */ |
@@ -920,13 +908,6 @@ static int pl08x_fill_llis_for_desc(struct pl08x_driver_data *pl08x, | |||
920 | */ | 908 | */ |
921 | llis_va[num_llis - 1].cctl |= PL080_CONTROL_TC_IRQ_EN; | 909 | llis_va[num_llis - 1].cctl |= PL080_CONTROL_TC_IRQ_EN; |
922 | 910 | ||
923 | /* Now store the channel register values */ | ||
924 | txd->csrc = llis_va[0].src; | ||
925 | txd->cdst = llis_va[0].dst; | ||
926 | txd->clli = llis_va[0].lli; | ||
927 | txd->cctl = llis_va[0].cctl; | ||
928 | /* ccfg will be set at physical channel allocation time */ | ||
929 | |||
930 | #ifdef VERBOSE_DEBUG | 911 | #ifdef VERBOSE_DEBUG |
931 | { | 912 | { |
932 | int i; | 913 | int i; |
diff --git a/include/linux/amba/pl08x.h b/include/linux/amba/pl08x.h index 2c834ed5f41f..29d974562df9 100644 --- a/include/linux/amba/pl08x.h +++ b/include/linux/amba/pl08x.h | |||
@@ -95,11 +95,6 @@ struct pl08x_phy_chan { | |||
95 | spinlock_t lock; | 95 | spinlock_t lock; |
96 | int signal; | 96 | int signal; |
97 | struct pl08x_dma_chan *serving; | 97 | struct pl08x_dma_chan *serving; |
98 | u32 csrc; | ||
99 | u32 cdst; | ||
100 | u32 clli; | ||
101 | u32 cctl; | ||
102 | u32 ccfg; | ||
103 | }; | 98 | }; |
104 | 99 | ||
105 | /** | 100 | /** |
@@ -118,14 +113,6 @@ struct pl08x_txd { | |||
118 | void *llis_va; | 113 | void *llis_va; |
119 | struct pl08x_channel_data *cd; | 114 | struct pl08x_channel_data *cd; |
120 | bool active; | 115 | bool active; |
121 | /* | ||
122 | * Settings to be put into the physical channel when we | ||
123 | * trigger this txd | ||
124 | */ | ||
125 | u32 csrc; | ||
126 | u32 cdst; | ||
127 | u32 clli; | ||
128 | u32 cctl; | ||
129 | }; | 116 | }; |
130 | 117 | ||
131 | /** | 118 | /** |