diff options
-rw-r--r-- | drivers/dma/amba-pl08x.c | 20 | ||||
-rw-r--r-- | include/linux/amba/pl080.h | 50 |
2 files changed, 32 insertions, 38 deletions
diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c index 0b7c6ce629a6..6bb8813ca275 100644 --- a/drivers/dma/amba-pl08x.c +++ b/drivers/dma/amba-pl08x.c | |||
@@ -106,6 +106,7 @@ struct pl08x_driver_data; | |||
106 | 106 | ||
107 | /** | 107 | /** |
108 | * struct vendor_data - vendor-specific config parameters for PL08x derivatives | 108 | * struct vendor_data - vendor-specific config parameters for PL08x derivatives |
109 | * @config_offset: offset to the configuration register | ||
109 | * @channels: the number of channels available in this variant | 110 | * @channels: the number of channels available in this variant |
110 | * @signals: the number of request signals available from the hardware | 111 | * @signals: the number of request signals available from the hardware |
111 | * @dualmaster: whether this version supports dual AHB masters or not. | 112 | * @dualmaster: whether this version supports dual AHB masters or not. |
@@ -145,6 +146,8 @@ struct pl08x_bus_data { | |||
145 | /** | 146 | /** |
146 | * struct pl08x_phy_chan - holder for the physical channels | 147 | * struct pl08x_phy_chan - holder for the physical channels |
147 | * @id: physical index to this channel | 148 | * @id: physical index to this channel |
149 | * @base: memory base address for this physical channel | ||
150 | * @reg_config: configuration address for this physical channel | ||
148 | * @lock: a lock to use when altering an instance of this struct | 151 | * @lock: a lock to use when altering an instance of this struct |
149 | * @serving: the virtual channel currently being served by this physical | 152 | * @serving: the virtual channel currently being served by this physical |
150 | * channel | 153 | * channel |
@@ -203,7 +206,7 @@ struct pl08x_txd { | |||
203 | }; | 206 | }; |
204 | 207 | ||
205 | /** | 208 | /** |
206 | * struct pl08x_dma_chan_state - holds the PL08x specific virtual channel | 209 | * enum pl08x_dma_chan_state - holds the PL08x specific virtual channel |
207 | * states | 210 | * states |
208 | * @PL08X_CHAN_IDLE: the channel is idle | 211 | * @PL08X_CHAN_IDLE: the channel is idle |
209 | * @PL08X_CHAN_RUNNING: the channel has allocated a physical transport | 212 | * @PL08X_CHAN_RUNNING: the channel has allocated a physical transport |
@@ -226,9 +229,8 @@ enum pl08x_dma_chan_state { | |||
226 | * @phychan: the physical channel utilized by this channel, if there is one | 229 | * @phychan: the physical channel utilized by this channel, if there is one |
227 | * @name: name of channel | 230 | * @name: name of channel |
228 | * @cd: channel platform data | 231 | * @cd: channel platform data |
229 | * @runtime_addr: address for RX/TX according to the runtime config | 232 | * @cfg: slave configuration |
230 | * @at: active transaction on this channel | 233 | * @at: active transaction on this channel |
231 | * @lock: a lock for this channel data | ||
232 | * @host: a pointer to the host (internal use) | 234 | * @host: a pointer to the host (internal use) |
233 | * @state: whether the channel is idle, paused, running etc | 235 | * @state: whether the channel is idle, paused, running etc |
234 | * @slave: whether this channel is a device (slave) or for memcpy | 236 | * @slave: whether this channel is a device (slave) or for memcpy |
@@ -262,7 +264,7 @@ struct pl08x_dma_chan { | |||
262 | * @lli_buses: bitmask to or in to LLI pointer selecting AHB port for LLI | 264 | * @lli_buses: bitmask to or in to LLI pointer selecting AHB port for LLI |
263 | * fetches | 265 | * fetches |
264 | * @mem_buses: set to indicate memory transfers on AHB2. | 266 | * @mem_buses: set to indicate memory transfers on AHB2. |
265 | * @lock: a spinlock for this struct | 267 | * @lli_words: how many words are used in each LLI item for this variant |
266 | */ | 268 | */ |
267 | struct pl08x_driver_data { | 269 | struct pl08x_driver_data { |
268 | struct dma_device slave; | 270 | struct dma_device slave; |
@@ -417,7 +419,7 @@ static void pl08x_start_next_txd(struct pl08x_dma_chan *plchan) | |||
417 | 419 | ||
418 | /* Enable the DMA channel */ | 420 | /* Enable the DMA channel */ |
419 | /* Do not access config register until channel shows as disabled */ | 421 | /* Do not access config register until channel shows as disabled */ |
420 | while (readl(pl08x->base + PL080_EN_CHAN) & (1 << phychan->id)) | 422 | while (readl(pl08x->base + PL080_EN_CHAN) & BIT(phychan->id)) |
421 | cpu_relax(); | 423 | cpu_relax(); |
422 | 424 | ||
423 | /* Do not access config register until channel shows as inactive */ | 425 | /* Do not access config register until channel shows as inactive */ |
@@ -484,8 +486,8 @@ static void pl08x_terminate_phy_chan(struct pl08x_driver_data *pl08x, | |||
484 | 486 | ||
485 | writel(val, ch->reg_config); | 487 | writel(val, ch->reg_config); |
486 | 488 | ||
487 | writel(1 << ch->id, pl08x->base + PL080_ERR_CLEAR); | 489 | writel(BIT(ch->id), pl08x->base + PL080_ERR_CLEAR); |
488 | writel(1 << ch->id, pl08x->base + PL080_TC_CLEAR); | 490 | writel(BIT(ch->id), pl08x->base + PL080_TC_CLEAR); |
489 | } | 491 | } |
490 | 492 | ||
491 | static inline u32 get_bytes_in_cctl(u32 cctl) | 493 | static inline u32 get_bytes_in_cctl(u32 cctl) |
@@ -1834,7 +1836,7 @@ static irqreturn_t pl08x_irq(int irq, void *dev) | |||
1834 | return IRQ_NONE; | 1836 | return IRQ_NONE; |
1835 | 1837 | ||
1836 | for (i = 0; i < pl08x->vd->channels; i++) { | 1838 | for (i = 0; i < pl08x->vd->channels; i++) { |
1837 | if (((1 << i) & err) || ((1 << i) & tc)) { | 1839 | if ((BIT(i) & err) || (BIT(i) & tc)) { |
1838 | /* Locate physical channel */ | 1840 | /* Locate physical channel */ |
1839 | struct pl08x_phy_chan *phychan = &pl08x->phy_chans[i]; | 1841 | struct pl08x_phy_chan *phychan = &pl08x->phy_chans[i]; |
1840 | struct pl08x_dma_chan *plchan = phychan->serving; | 1842 | struct pl08x_dma_chan *plchan = phychan->serving; |
@@ -1872,7 +1874,7 @@ static irqreturn_t pl08x_irq(int irq, void *dev) | |||
1872 | } | 1874 | } |
1873 | spin_unlock(&plchan->vc.lock); | 1875 | spin_unlock(&plchan->vc.lock); |
1874 | 1876 | ||
1875 | mask |= (1 << i); | 1877 | mask |= BIT(i); |
1876 | } | 1878 | } |
1877 | } | 1879 | } |
1878 | 1880 | ||
diff --git a/include/linux/amba/pl080.h b/include/linux/amba/pl080.h index 91b84a7f0539..580b5323a717 100644 --- a/include/linux/amba/pl080.h +++ b/include/linux/amba/pl080.h | |||
@@ -38,24 +38,16 @@ | |||
38 | #define PL080_SOFT_LSREQ (0x2C) | 38 | #define PL080_SOFT_LSREQ (0x2C) |
39 | 39 | ||
40 | #define PL080_CONFIG (0x30) | 40 | #define PL080_CONFIG (0x30) |
41 | #define PL080_CONFIG_M2_BE (1 << 2) | 41 | #define PL080_CONFIG_M2_BE BIT(2) |
42 | #define PL080_CONFIG_M1_BE (1 << 1) | 42 | #define PL080_CONFIG_M1_BE BIT(1) |
43 | #define PL080_CONFIG_ENABLE (1 << 0) | 43 | #define PL080_CONFIG_ENABLE BIT(0) |
44 | 44 | ||
45 | #define PL080_SYNC (0x34) | 45 | #define PL080_SYNC (0x34) |
46 | 46 | ||
47 | /* Per channel configuration registers */ | 47 | /* Per channel configuration registers */ |
48 | 48 | ||
49 | #define PL080_Cx_STRIDE (0x20) | 49 | /* Per channel configuration registers */ |
50 | #define PL080_Cx_BASE(x) ((0x100 + (x * 0x20))) | 50 | #define PL080_Cx_BASE(x) ((0x100 + (x * 0x20))) |
51 | #define PL080_Cx_SRC_ADDR(x) ((0x100 + (x * 0x20))) | ||
52 | #define PL080_Cx_DST_ADDR(x) ((0x104 + (x * 0x20))) | ||
53 | #define PL080_Cx_LLI(x) ((0x108 + (x * 0x20))) | ||
54 | #define PL080_Cx_CONTROL(x) ((0x10C + (x * 0x20))) | ||
55 | #define PL080_Cx_CONFIG(x) ((0x110 + (x * 0x20))) | ||
56 | #define PL080S_Cx_CONTROL2(x) ((0x110 + (x * 0x20))) | ||
57 | #define PL080S_Cx_CONFIG(x) ((0x114 + (x * 0x20))) | ||
58 | |||
59 | #define PL080_CH_SRC_ADDR (0x00) | 51 | #define PL080_CH_SRC_ADDR (0x00) |
60 | #define PL080_CH_DST_ADDR (0x04) | 52 | #define PL080_CH_DST_ADDR (0x04) |
61 | #define PL080_CH_LLI (0x08) | 53 | #define PL080_CH_LLI (0x08) |
@@ -66,18 +58,18 @@ | |||
66 | 58 | ||
67 | #define PL080_LLI_ADDR_MASK (0x3fffffff << 2) | 59 | #define PL080_LLI_ADDR_MASK (0x3fffffff << 2) |
68 | #define PL080_LLI_ADDR_SHIFT (2) | 60 | #define PL080_LLI_ADDR_SHIFT (2) |
69 | #define PL080_LLI_LM_AHB2 (1 << 0) | 61 | #define PL080_LLI_LM_AHB2 BIT(0) |
70 | 62 | ||
71 | #define PL080_CONTROL_TC_IRQ_EN (1 << 31) | 63 | #define PL080_CONTROL_TC_IRQ_EN BIT(31) |
72 | #define PL080_CONTROL_PROT_MASK (0x7 << 28) | 64 | #define PL080_CONTROL_PROT_MASK (0x7 << 28) |
73 | #define PL080_CONTROL_PROT_SHIFT (28) | 65 | #define PL080_CONTROL_PROT_SHIFT (28) |
74 | #define PL080_CONTROL_PROT_CACHE (1 << 30) | 66 | #define PL080_CONTROL_PROT_CACHE BIT(30) |
75 | #define PL080_CONTROL_PROT_BUFF (1 << 29) | 67 | #define PL080_CONTROL_PROT_BUFF BIT(29) |
76 | #define PL080_CONTROL_PROT_SYS (1 << 28) | 68 | #define PL080_CONTROL_PROT_SYS BIT(28) |
77 | #define PL080_CONTROL_DST_INCR (1 << 27) | 69 | #define PL080_CONTROL_DST_INCR BIT(27) |
78 | #define PL080_CONTROL_SRC_INCR (1 << 26) | 70 | #define PL080_CONTROL_SRC_INCR BIT(26) |
79 | #define PL080_CONTROL_DST_AHB2 (1 << 25) | 71 | #define PL080_CONTROL_DST_AHB2 BIT(25) |
80 | #define PL080_CONTROL_SRC_AHB2 (1 << 24) | 72 | #define PL080_CONTROL_SRC_AHB2 BIT(24) |
81 | #define PL080_CONTROL_DWIDTH_MASK (0x7 << 21) | 73 | #define PL080_CONTROL_DWIDTH_MASK (0x7 << 21) |
82 | #define PL080_CONTROL_DWIDTH_SHIFT (21) | 74 | #define PL080_CONTROL_DWIDTH_SHIFT (21) |
83 | #define PL080_CONTROL_SWIDTH_MASK (0x7 << 18) | 75 | #define PL080_CONTROL_SWIDTH_MASK (0x7 << 18) |
@@ -103,20 +95,20 @@ | |||
103 | #define PL080_WIDTH_16BIT (0x1) | 95 | #define PL080_WIDTH_16BIT (0x1) |
104 | #define PL080_WIDTH_32BIT (0x2) | 96 | #define PL080_WIDTH_32BIT (0x2) |
105 | 97 | ||
106 | #define PL080N_CONFIG_ITPROT (1 << 20) | 98 | #define PL080N_CONFIG_ITPROT BIT(20) |
107 | #define PL080N_CONFIG_SECPROT (1 << 19) | 99 | #define PL080N_CONFIG_SECPROT BIT(19) |
108 | #define PL080_CONFIG_HALT (1 << 18) | 100 | #define PL080_CONFIG_HALT BIT(18) |
109 | #define PL080_CONFIG_ACTIVE (1 << 17) /* RO */ | 101 | #define PL080_CONFIG_ACTIVE BIT(17) /* RO */ |
110 | #define PL080_CONFIG_LOCK (1 << 16) | 102 | #define PL080_CONFIG_LOCK BIT(16) |
111 | #define PL080_CONFIG_TC_IRQ_MASK (1 << 15) | 103 | #define PL080_CONFIG_TC_IRQ_MASK BIT(15) |
112 | #define PL080_CONFIG_ERR_IRQ_MASK (1 << 14) | 104 | #define PL080_CONFIG_ERR_IRQ_MASK BIT(14) |
113 | #define PL080_CONFIG_FLOW_CONTROL_MASK (0x7 << 11) | 105 | #define PL080_CONFIG_FLOW_CONTROL_MASK (0x7 << 11) |
114 | #define PL080_CONFIG_FLOW_CONTROL_SHIFT (11) | 106 | #define PL080_CONFIG_FLOW_CONTROL_SHIFT (11) |
115 | #define PL080_CONFIG_DST_SEL_MASK (0xf << 6) | 107 | #define PL080_CONFIG_DST_SEL_MASK (0xf << 6) |
116 | #define PL080_CONFIG_DST_SEL_SHIFT (6) | 108 | #define PL080_CONFIG_DST_SEL_SHIFT (6) |
117 | #define PL080_CONFIG_SRC_SEL_MASK (0xf << 1) | 109 | #define PL080_CONFIG_SRC_SEL_MASK (0xf << 1) |
118 | #define PL080_CONFIG_SRC_SEL_SHIFT (1) | 110 | #define PL080_CONFIG_SRC_SEL_SHIFT (1) |
119 | #define PL080_CONFIG_ENABLE (1 << 0) | 111 | #define PL080_CONFIG_ENABLE BIT(0) |
120 | 112 | ||
121 | #define PL080_FLOW_MEM2MEM (0x0) | 113 | #define PL080_FLOW_MEM2MEM (0x0) |
122 | #define PL080_FLOW_MEM2PER (0x1) | 114 | #define PL080_FLOW_MEM2PER (0x1) |