Skip to content

Commit dd2b9ff

Browse files
author
Vinod Koul
committed
Merge branch 'topic/pl08x' into for-linus
2 parents f23514b + 417cb97 commit dd2b9ff

2 files changed

Lines changed: 32 additions & 38 deletions

File tree

‎drivers/dma/amba-pl08x.c‎

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ struct pl08x_driver_data;
106106

107107
/**
108108
* struct vendor_data - vendor-specific config parameters for PL08x derivatives
109+
* @config_offset: offset to the configuration register
109110
* @channels: the number of channels available in this variant
110111
* @signals: the number of request signals available from the hardware
111112
* @dualmaster: whether this version supports dual AHB masters or not.
@@ -145,6 +146,8 @@ struct pl08x_bus_data {
145146
/**
146147
* struct pl08x_phy_chan - holder for the physical channels
147148
* @id: physical index to this channel
149+
* @base: memory base address for this physical channel
150+
* @reg_config: configuration address for this physical channel
148151
* @lock: a lock to use when altering an instance of this struct
149152
* @serving: the virtual channel currently being served by this physical
150153
* channel
@@ -203,7 +206,7 @@ struct pl08x_txd {
203206
};
204207

205208
/**
206-
* struct pl08x_dma_chan_state - holds the PL08x specific virtual channel
209+
* enum pl08x_dma_chan_state - holds the PL08x specific virtual channel
207210
* states
208211
* @PL08X_CHAN_IDLE: the channel is idle
209212
* @PL08X_CHAN_RUNNING: the channel has allocated a physical transport
@@ -226,9 +229,8 @@ enum pl08x_dma_chan_state {
226229
* @phychan: the physical channel utilized by this channel, if there is one
227230
* @name: name of channel
228231
* @cd: channel platform data
229-
* @runtime_addr: address for RX/TX according to the runtime config
232+
* @cfg: slave configuration
230233
* @at: active transaction on this channel
231-
* @lock: a lock for this channel data
232234
* @host: a pointer to the host (internal use)
233235
* @state: whether the channel is idle, paused, running etc
234236
* @slave: whether this channel is a device (slave) or for memcpy
@@ -262,7 +264,7 @@ struct pl08x_dma_chan {
262264
* @lli_buses: bitmask to or in to LLI pointer selecting AHB port for LLI
263265
* fetches
264266
* @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
266268
*/
267269
struct pl08x_driver_data {
268270
struct dma_device slave;
@@ -417,7 +419,7 @@ static void pl08x_start_next_txd(struct pl08x_dma_chan *plchan)
417419

418420
/* Enable the DMA channel */
419421
/* 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))
421423
cpu_relax();
422424

423425
/* 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,
484486

485487
writel(val, ch->reg_config);
486488

487-
writel(1 << ch->id, pl08x->base + PL080_ERR_CLEAR);
488-
writel(1 << ch->id, pl08x->base + PL080_TC_CLEAR);
489+
writel(BIT(ch->id), pl08x->base + PL080_ERR_CLEAR);
490+
writel(BIT(ch->id), pl08x->base + PL080_TC_CLEAR);
489491
}
490492

491493
static inline u32 get_bytes_in_cctl(u32 cctl)
@@ -1834,7 +1836,7 @@ static irqreturn_t pl08x_irq(int irq, void *dev)
18341836
return IRQ_NONE;
18351837

18361838
for (i = 0; i < pl08x->vd->channels; i++) {
1837-
if (((1 << i) & err) || ((1 << i) & tc)) {
1839+
if ((BIT(i) & err) || (BIT(i) & tc)) {
18381840
/* Locate physical channel */
18391841
struct pl08x_phy_chan *phychan = &pl08x->phy_chans[i];
18401842
struct pl08x_dma_chan *plchan = phychan->serving;
@@ -1872,7 +1874,7 @@ static irqreturn_t pl08x_irq(int irq, void *dev)
18721874
}
18731875
spin_unlock(&plchan->vc.lock);
18741876

1875-
mask |= (1 << i);
1877+
mask |= BIT(i);
18761878
}
18771879
}
18781880

‎include/linux/amba/pl080.h‎

Lines changed: 21 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -38,24 +38,16 @@
3838
#define PL080_SOFT_LSREQ (0x2C)
3939

4040
#define PL080_CONFIG (0x30)
41-
#define PL080_CONFIG_M2_BE (1 << 2)
42-
#define PL080_CONFIG_M1_BE (1 << 1)
43-
#define PL080_CONFIG_ENABLE (1 << 0)
41+
#define PL080_CONFIG_M2_BE BIT(2)
42+
#define PL080_CONFIG_M1_BE BIT(1)
43+
#define PL080_CONFIG_ENABLE BIT(0)
4444

4545
#define PL080_SYNC (0x34)
4646

4747
/* Per channel configuration registers */
4848

49-
#define PL080_Cx_STRIDE (0x20)
49+
/* Per channel configuration registers */
5050
#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-
5951
#define PL080_CH_SRC_ADDR (0x00)
6052
#define PL080_CH_DST_ADDR (0x04)
6153
#define PL080_CH_LLI (0x08)
@@ -66,18 +58,18 @@
6658

6759
#define PL080_LLI_ADDR_MASK (0x3fffffff << 2)
6860
#define PL080_LLI_ADDR_SHIFT (2)
69-
#define PL080_LLI_LM_AHB2 (1 << 0)
61+
#define PL080_LLI_LM_AHB2 BIT(0)
7062

71-
#define PL080_CONTROL_TC_IRQ_EN (1 << 31)
63+
#define PL080_CONTROL_TC_IRQ_EN BIT(31)
7264
#define PL080_CONTROL_PROT_MASK (0x7 << 28)
7365
#define PL080_CONTROL_PROT_SHIFT (28)
74-
#define PL080_CONTROL_PROT_CACHE (1 << 30)
75-
#define PL080_CONTROL_PROT_BUFF (1 << 29)
76-
#define PL080_CONTROL_PROT_SYS (1 << 28)
77-
#define PL080_CONTROL_DST_INCR (1 << 27)
78-
#define PL080_CONTROL_SRC_INCR (1 << 26)
79-
#define PL080_CONTROL_DST_AHB2 (1 << 25)
80-
#define PL080_CONTROL_SRC_AHB2 (1 << 24)
66+
#define PL080_CONTROL_PROT_CACHE BIT(30)
67+
#define PL080_CONTROL_PROT_BUFF BIT(29)
68+
#define PL080_CONTROL_PROT_SYS BIT(28)
69+
#define PL080_CONTROL_DST_INCR BIT(27)
70+
#define PL080_CONTROL_SRC_INCR BIT(26)
71+
#define PL080_CONTROL_DST_AHB2 BIT(25)
72+
#define PL080_CONTROL_SRC_AHB2 BIT(24)
8173
#define PL080_CONTROL_DWIDTH_MASK (0x7 << 21)
8274
#define PL080_CONTROL_DWIDTH_SHIFT (21)
8375
#define PL080_CONTROL_SWIDTH_MASK (0x7 << 18)
@@ -103,20 +95,20 @@
10395
#define PL080_WIDTH_16BIT (0x1)
10496
#define PL080_WIDTH_32BIT (0x2)
10597

106-
#define PL080N_CONFIG_ITPROT (1 << 20)
107-
#define PL080N_CONFIG_SECPROT (1 << 19)
108-
#define PL080_CONFIG_HALT (1 << 18)
109-
#define PL080_CONFIG_ACTIVE (1 << 17) /* RO */
110-
#define PL080_CONFIG_LOCK (1 << 16)
111-
#define PL080_CONFIG_TC_IRQ_MASK (1 << 15)
112-
#define PL080_CONFIG_ERR_IRQ_MASK (1 << 14)
98+
#define PL080N_CONFIG_ITPROT BIT(20)
99+
#define PL080N_CONFIG_SECPROT BIT(19)
100+
#define PL080_CONFIG_HALT BIT(18)
101+
#define PL080_CONFIG_ACTIVE BIT(17) /* RO */
102+
#define PL080_CONFIG_LOCK BIT(16)
103+
#define PL080_CONFIG_TC_IRQ_MASK BIT(15)
104+
#define PL080_CONFIG_ERR_IRQ_MASK BIT(14)
113105
#define PL080_CONFIG_FLOW_CONTROL_MASK (0x7 << 11)
114106
#define PL080_CONFIG_FLOW_CONTROL_SHIFT (11)
115107
#define PL080_CONFIG_DST_SEL_MASK (0xf << 6)
116108
#define PL080_CONFIG_DST_SEL_SHIFT (6)
117109
#define PL080_CONFIG_SRC_SEL_MASK (0xf << 1)
118110
#define PL080_CONFIG_SRC_SEL_SHIFT (1)
119-
#define PL080_CONFIG_ENABLE (1 << 0)
111+
#define PL080_CONFIG_ENABLE BIT(0)
120112

121113
#define PL080_FLOW_MEM2MEM (0x0)
122114
#define PL080_FLOW_MEM2PER (0x1)

0 commit comments

Comments
 (0)