aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/amba
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /include/linux/amba
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'include/linux/amba')
-rw-r--r--include/linux/amba/bus.h31
-rw-r--r--include/linux/amba/clcd.h92
-rw-r--r--include/linux/amba/mmci.h19
-rw-r--r--include/linux/amba/pl022.h13
-rw-r--r--include/linux/amba/pl08x.h223
-rw-r--r--include/linux/amba/serial.h36
6 files changed, 379 insertions, 35 deletions
diff --git a/include/linux/amba/bus.h b/include/linux/amba/bus.h
index b0c174012436..fcbbe71a3cc1 100644
--- a/include/linux/amba/bus.h
+++ b/include/linux/amba/bus.h
@@ -18,8 +18,10 @@
18#include <linux/device.h> 18#include <linux/device.h>
19#include <linux/err.h> 19#include <linux/err.h>
20#include <linux/resource.h> 20#include <linux/resource.h>
21#include <linux/regulator/consumer.h>
21 22
22#define AMBA_NR_IRQS 2 23#define AMBA_NR_IRQS 2
24#define AMBA_CID 0xb105f00d
23 25
24struct clk; 26struct clk;
25 27
@@ -27,6 +29,7 @@ struct amba_device {
27 struct device dev; 29 struct device dev;
28 struct resource res; 30 struct resource res;
29 struct clk *pclk; 31 struct clk *pclk;
32 struct regulator *vcore;
30 u64 dma_mask; 33 u64 dma_mask;
31 unsigned int periphid; 34 unsigned int periphid;
32 unsigned int irq[AMBA_NR_IRQS]; 35 unsigned int irq[AMBA_NR_IRQS];
@@ -40,12 +43,12 @@ struct amba_id {
40 43
41struct amba_driver { 44struct amba_driver {
42 struct device_driver drv; 45 struct device_driver drv;
43 int (*probe)(struct amba_device *, struct amba_id *); 46 int (*probe)(struct amba_device *, const struct amba_id *);
44 int (*remove)(struct amba_device *); 47 int (*remove)(struct amba_device *);
45 void (*shutdown)(struct amba_device *); 48 void (*shutdown)(struct amba_device *);
46 int (*suspend)(struct amba_device *, pm_message_t); 49 int (*suspend)(struct amba_device *, pm_message_t);
47 int (*resume)(struct amba_device *); 50 int (*resume)(struct amba_device *);
48 struct amba_id *id_table; 51 const struct amba_id *id_table;
49}; 52};
50 53
51enum amba_vendor { 54enum amba_vendor {
@@ -53,6 +56,10 @@ enum amba_vendor {
53 AMBA_VENDOR_ST = 0x80, 56 AMBA_VENDOR_ST = 0x80,
54}; 57};
55 58
59extern struct bus_type amba_bustype;
60
61#define to_amba_device(d) container_of(d, struct amba_device, dev)
62
56#define amba_get_drvdata(d) dev_get_drvdata(&d->dev) 63#define amba_get_drvdata(d) dev_get_drvdata(&d->dev)
57#define amba_set_drvdata(d,p) dev_set_drvdata(&d->dev, p) 64#define amba_set_drvdata(d,p) dev_set_drvdata(&d->dev, p)
58 65
@@ -70,9 +77,21 @@ void amba_release_regions(struct amba_device *);
70#define amba_pclk_disable(d) \ 77#define amba_pclk_disable(d) \
71 do { if (!IS_ERR((d)->pclk)) clk_disable((d)->pclk); } while (0) 78 do { if (!IS_ERR((d)->pclk)) clk_disable((d)->pclk); } while (0)
72 79
73#define amba_config(d) (((d)->periphid >> 24) & 0xff) 80#define amba_vcore_enable(d) \
74#define amba_rev(d) (((d)->periphid >> 20) & 0x0f) 81 (IS_ERR((d)->vcore) ? 0 : regulator_enable((d)->vcore))
75#define amba_manf(d) (((d)->periphid >> 12) & 0xff) 82
76#define amba_part(d) ((d)->periphid & 0xfff) 83#define amba_vcore_disable(d) \
84 do { if (!IS_ERR((d)->vcore)) regulator_disable((d)->vcore); } while (0)
85
86/* Some drivers don't use the struct amba_device */
87#define AMBA_CONFIG_BITS(a) (((a) >> 24) & 0xff)
88#define AMBA_REV_BITS(a) (((a) >> 20) & 0x0f)
89#define AMBA_MANF_BITS(a) (((a) >> 12) & 0xff)
90#define AMBA_PART_BITS(a) ((a) & 0xfff)
91
92#define amba_config(d) AMBA_CONFIG_BITS((d)->periphid)
93#define amba_rev(d) AMBA_REV_BITS((d)->periphid)
94#define amba_manf(d) AMBA_MANF_BITS((d)->periphid)
95#define amba_part(d) AMBA_PART_BITS((d)->periphid)
77 96
78#endif 97#endif
diff --git a/include/linux/amba/clcd.h b/include/linux/amba/clcd.h
index be33b3affc8a..e82e3ee2c54a 100644
--- a/include/linux/amba/clcd.h
+++ b/include/linux/amba/clcd.h
@@ -53,6 +53,7 @@
53#define CNTL_LCDBPP8 (3 << 1) 53#define CNTL_LCDBPP8 (3 << 1)
54#define CNTL_LCDBPP16 (4 << 1) 54#define CNTL_LCDBPP16 (4 << 1)
55#define CNTL_LCDBPP16_565 (6 << 1) 55#define CNTL_LCDBPP16_565 (6 << 1)
56#define CNTL_LCDBPP16_444 (7 << 1)
56#define CNTL_LCDBPP24 (5 << 1) 57#define CNTL_LCDBPP24 (5 << 1)
57#define CNTL_LCDBW (1 << 4) 58#define CNTL_LCDBW (1 << 4)
58#define CNTL_LCDTFT (1 << 5) 59#define CNTL_LCDTFT (1 << 5)
@@ -66,6 +67,32 @@
66#define CNTL_LDMAFIFOTIME (1 << 15) 67#define CNTL_LDMAFIFOTIME (1 << 15)
67#define CNTL_WATERMARK (1 << 16) 68#define CNTL_WATERMARK (1 << 16)
68 69
70enum {
71 /* individual formats */
72 CLCD_CAP_RGB444 = (1 << 0),
73 CLCD_CAP_RGB5551 = (1 << 1),
74 CLCD_CAP_RGB565 = (1 << 2),
75 CLCD_CAP_RGB888 = (1 << 3),
76 CLCD_CAP_BGR444 = (1 << 4),
77 CLCD_CAP_BGR5551 = (1 << 5),
78 CLCD_CAP_BGR565 = (1 << 6),
79 CLCD_CAP_BGR888 = (1 << 7),
80
81 /* connection layouts */
82 CLCD_CAP_444 = CLCD_CAP_RGB444 | CLCD_CAP_BGR444,
83 CLCD_CAP_5551 = CLCD_CAP_RGB5551 | CLCD_CAP_BGR5551,
84 CLCD_CAP_565 = CLCD_CAP_RGB565 | CLCD_CAP_BGR565,
85 CLCD_CAP_888 = CLCD_CAP_RGB888 | CLCD_CAP_BGR888,
86
87 /* red/blue ordering */
88 CLCD_CAP_RGB = CLCD_CAP_RGB444 | CLCD_CAP_RGB5551 |
89 CLCD_CAP_RGB565 | CLCD_CAP_RGB888,
90 CLCD_CAP_BGR = CLCD_CAP_BGR444 | CLCD_CAP_BGR5551 |
91 CLCD_CAP_BGR565 | CLCD_CAP_BGR888,
92
93 CLCD_CAP_ALL = CLCD_CAP_BGR | CLCD_CAP_RGB,
94};
95
69struct clcd_panel { 96struct clcd_panel {
70 struct fb_videomode mode; 97 struct fb_videomode mode;
71 signed short width; /* width in mm */ 98 signed short width; /* width in mm */
@@ -73,6 +100,7 @@ struct clcd_panel {
73 u32 tim2; 100 u32 tim2;
74 u32 tim3; 101 u32 tim3;
75 u32 cntl; 102 u32 cntl;
103 u32 caps;
76 unsigned int bpp:8, 104 unsigned int bpp:8,
77 fixedtimings:1, 105 fixedtimings:1,
78 grayscale:1; 106 grayscale:1;
@@ -97,13 +125,18 @@ struct clcd_board {
97 const char *name; 125 const char *name;
98 126
99 /* 127 /*
128 * Optional. Hardware capability flags.
129 */
130 u32 caps;
131
132 /*
100 * Optional. Check whether the var structure is acceptable 133 * Optional. Check whether the var structure is acceptable
101 * for this display. 134 * for this display.
102 */ 135 */
103 int (*check)(struct clcd_fb *fb, struct fb_var_screeninfo *var); 136 int (*check)(struct clcd_fb *fb, struct fb_var_screeninfo *var);
104 137
105 /* 138 /*
106 * Compulsary. Decode fb->fb.var into regs->*. In the case of 139 * Compulsory. Decode fb->fb.var into regs->*. In the case of
107 * fixed timing, set regs->* to the register values required. 140 * fixed timing, set regs->* to the register values required.
108 */ 141 */
109 void (*decode)(struct clcd_fb *fb, struct clcd_regs *regs); 142 void (*decode)(struct clcd_fb *fb, struct clcd_regs *regs);
@@ -155,34 +188,35 @@ struct clcd_fb {
155 188
156static inline void clcdfb_decode(struct clcd_fb *fb, struct clcd_regs *regs) 189static inline void clcdfb_decode(struct clcd_fb *fb, struct clcd_regs *regs)
157{ 190{
191 struct fb_var_screeninfo *var = &fb->fb.var;
158 u32 val, cpl; 192 u32 val, cpl;
159 193
160 /* 194 /*
161 * Program the CLCD controller registers and start the CLCD 195 * Program the CLCD controller registers and start the CLCD
162 */ 196 */
163 val = ((fb->fb.var.xres / 16) - 1) << 2; 197 val = ((var->xres / 16) - 1) << 2;
164 val |= (fb->fb.var.hsync_len - 1) << 8; 198 val |= (var->hsync_len - 1) << 8;
165 val |= (fb->fb.var.right_margin - 1) << 16; 199 val |= (var->right_margin - 1) << 16;
166 val |= (fb->fb.var.left_margin - 1) << 24; 200 val |= (var->left_margin - 1) << 24;
167 regs->tim0 = val; 201 regs->tim0 = val;
168 202
169 val = fb->fb.var.yres; 203 val = var->yres;
170 if (fb->panel->cntl & CNTL_LCDDUAL) 204 if (fb->panel->cntl & CNTL_LCDDUAL)
171 val /= 2; 205 val /= 2;
172 val -= 1; 206 val -= 1;
173 val |= (fb->fb.var.vsync_len - 1) << 10; 207 val |= (var->vsync_len - 1) << 10;
174 val |= fb->fb.var.lower_margin << 16; 208 val |= var->lower_margin << 16;
175 val |= fb->fb.var.upper_margin << 24; 209 val |= var->upper_margin << 24;
176 regs->tim1 = val; 210 regs->tim1 = val;
177 211
178 val = fb->panel->tim2; 212 val = fb->panel->tim2;
179 val |= fb->fb.var.sync & FB_SYNC_HOR_HIGH_ACT ? 0 : TIM2_IHS; 213 val |= var->sync & FB_SYNC_HOR_HIGH_ACT ? 0 : TIM2_IHS;
180 val |= fb->fb.var.sync & FB_SYNC_VERT_HIGH_ACT ? 0 : TIM2_IVS; 214 val |= var->sync & FB_SYNC_VERT_HIGH_ACT ? 0 : TIM2_IVS;
181 215
182 cpl = fb->fb.var.xres_virtual; 216 cpl = var->xres_virtual;
183 if (fb->panel->cntl & CNTL_LCDTFT) /* TFT */ 217 if (fb->panel->cntl & CNTL_LCDTFT) /* TFT */
184 /* / 1 */; 218 /* / 1 */;
185 else if (!fb->fb.var.grayscale) /* STN color */ 219 else if (!var->grayscale) /* STN color */
186 cpl = cpl * 8 / 3; 220 cpl = cpl * 8 / 3;
187 else if (fb->panel->cntl & CNTL_LCDMONO8) /* STN monochrome, 8bit */ 221 else if (fb->panel->cntl & CNTL_LCDMONO8) /* STN monochrome, 8bit */
188 cpl /= 8; 222 cpl /= 8;
@@ -194,10 +228,22 @@ static inline void clcdfb_decode(struct clcd_fb *fb, struct clcd_regs *regs)
194 regs->tim3 = fb->panel->tim3; 228 regs->tim3 = fb->panel->tim3;
195 229
196 val = fb->panel->cntl; 230 val = fb->panel->cntl;
197 if (fb->fb.var.grayscale) 231 if (var->grayscale)
198 val |= CNTL_LCDBW; 232 val |= CNTL_LCDBW;
199 233
200 switch (fb->fb.var.bits_per_pixel) { 234 if (fb->panel->caps && fb->board->caps &&
235 var->bits_per_pixel >= 16) {
236 /*
237 * if board and panel supply capabilities, we can support
238 * changing BGR/RGB depending on supplied parameters
239 */
240 if (var->red.offset == 0)
241 val &= ~CNTL_BGR;
242 else
243 val |= CNTL_BGR;
244 }
245
246 switch (var->bits_per_pixel) {
201 case 1: 247 case 1:
202 val |= CNTL_LCDBPP1; 248 val |= CNTL_LCDBPP1;
203 break; 249 break;
@@ -212,15 +258,17 @@ static inline void clcdfb_decode(struct clcd_fb *fb, struct clcd_regs *regs)
212 break; 258 break;
213 case 16: 259 case 16:
214 /* 260 /*
215 * PL110 cannot choose between 5551 and 565 modes in 261 * PL110 cannot choose between 5551 and 565 modes in its
216 * its control register 262 * control register. It is possible to use 565 with
263 * custom external wiring.
217 */ 264 */
218 if ((fb->dev->periphid & 0x000fffff) == 0x00041110) 265 if (amba_part(fb->dev) == 0x110 ||
266 var->green.length == 5)
219 val |= CNTL_LCDBPP16; 267 val |= CNTL_LCDBPP16;
220 else if (fb->fb.var.green.length == 5) 268 else if (var->green.length == 6)
221 val |= CNTL_LCDBPP16;
222 else
223 val |= CNTL_LCDBPP16_565; 269 val |= CNTL_LCDBPP16_565;
270 else
271 val |= CNTL_LCDBPP16_444;
224 break; 272 break;
225 case 32: 273 case 32:
226 val |= CNTL_LCDBPP24; 274 val |= CNTL_LCDBPP24;
@@ -228,7 +276,7 @@ static inline void clcdfb_decode(struct clcd_fb *fb, struct clcd_regs *regs)
228 } 276 }
229 277
230 regs->cntl = val; 278 regs->cntl = val;
231 regs->pixclock = fb->fb.var.pixclock; 279 regs->pixclock = var->pixclock;
232} 280}
233 281
234static inline int clcdfb_check(struct clcd_fb *fb, struct fb_var_screeninfo *var) 282static inline int clcdfb_check(struct clcd_fb *fb, struct fb_var_screeninfo *var)
diff --git a/include/linux/amba/mmci.h b/include/linux/amba/mmci.h
index ca84ce70d5d5..21114810c7c0 100644
--- a/include/linux/amba/mmci.h
+++ b/include/linux/amba/mmci.h
@@ -6,6 +6,9 @@
6 6
7#include <linux/mmc/host.h> 7#include <linux/mmc/host.h>
8 8
9/* Just some dummy forwarding */
10struct dma_chan;
11
9/** 12/**
10 * struct mmci_platform_data - platform configuration for the MMCI 13 * struct mmci_platform_data - platform configuration for the MMCI
11 * (also known as PL180) block. 14 * (also known as PL180) block.
@@ -24,8 +27,20 @@
24 * whether a card is present in the MMC slot or not 27 * whether a card is present in the MMC slot or not
25 * @gpio_wp: read this GPIO pin to see if the card is write protected 28 * @gpio_wp: read this GPIO pin to see if the card is write protected
26 * @gpio_cd: read this GPIO pin to detect card insertion 29 * @gpio_cd: read this GPIO pin to detect card insertion
30 * @cd_invert: true if the gpio_cd pin value is active low
27 * @capabilities: the capabilities of the block as implemented in 31 * @capabilities: the capabilities of the block as implemented in
28 * this platform, signify anything MMC_CAP_* from mmc/host.h 32 * this platform, signify anything MMC_CAP_* from mmc/host.h
33 * @dma_filter: function used to select an appropriate RX and TX
34 * DMA channel to be used for DMA, if and only if you're deploying the
35 * generic DMA engine
36 * @dma_rx_param: parameter passed to the DMA allocation
37 * filter in order to select an appropriate RX channel. If
38 * there is a bidirectional RX+TX channel, then just specify
39 * this and leave dma_tx_param set to NULL
40 * @dma_tx_param: parameter passed to the DMA allocation
41 * filter in order to select an appropriate TX channel. If this
42 * is NULL the driver will attempt to use the RX channel as a
43 * bidirectional channel
29 */ 44 */
30struct mmci_platform_data { 45struct mmci_platform_data {
31 unsigned int f_max; 46 unsigned int f_max;
@@ -35,7 +50,11 @@ struct mmci_platform_data {
35 unsigned int (*status)(struct device *); 50 unsigned int (*status)(struct device *);
36 int gpio_wp; 51 int gpio_wp;
37 int gpio_cd; 52 int gpio_cd;
53 bool cd_invert;
38 unsigned long capabilities; 54 unsigned long capabilities;
55 bool (*dma_filter)(struct dma_chan *chan, void *filter_param);
56 void *dma_rx_param;
57 void *dma_tx_param;
39}; 58};
40 59
41#endif 60#endif
diff --git a/include/linux/amba/pl022.h b/include/linux/amba/pl022.h
index abf26cc47a2b..4ce98f54186b 100644
--- a/include/linux/amba/pl022.h
+++ b/include/linux/amba/pl022.h
@@ -228,6 +228,7 @@ enum ssp_chip_select {
228}; 228};
229 229
230 230
231struct dma_chan;
231/** 232/**
232 * struct pl022_ssp_master - device.platform_data for SPI controller devices. 233 * struct pl022_ssp_master - device.platform_data for SPI controller devices.
233 * @num_chipselect: chipselects are used to distinguish individual 234 * @num_chipselect: chipselects are used to distinguish individual
@@ -235,11 +236,16 @@ enum ssp_chip_select {
235 * each slave has a chipselect signal, but it's common that not 236 * each slave has a chipselect signal, but it's common that not
236 * every chipselect is connected to a slave. 237 * every chipselect is connected to a slave.
237 * @enable_dma: if true enables DMA driven transfers. 238 * @enable_dma: if true enables DMA driven transfers.
239 * @dma_rx_param: parameter to locate an RX DMA channel.
240 * @dma_tx_param: parameter to locate a TX DMA channel.
238 */ 241 */
239struct pl022_ssp_controller { 242struct pl022_ssp_controller {
240 u16 bus_id; 243 u16 bus_id;
241 u8 num_chipselect; 244 u8 num_chipselect;
242 u8 enable_dma:1; 245 u8 enable_dma:1;
246 bool (*dma_filter)(struct dma_chan *chan, void *filter_param);
247 void *dma_rx_param;
248 void *dma_tx_param;
243}; 249};
244 250
245/** 251/**
@@ -270,20 +276,13 @@ struct pl022_ssp_controller {
270 * @dma_config: DMA configuration for SSP controller and peripheral 276 * @dma_config: DMA configuration for SSP controller and peripheral
271 */ 277 */
272struct pl022_config_chip { 278struct pl022_config_chip {
273 struct device *dev;
274 enum ssp_loopback lbm;
275 enum ssp_interface iface; 279 enum ssp_interface iface;
276 enum ssp_hierarchy hierarchy; 280 enum ssp_hierarchy hierarchy;
277 bool slave_tx_disable; 281 bool slave_tx_disable;
278 struct ssp_clock_params clk_freq; 282 struct ssp_clock_params clk_freq;
279 enum ssp_rx_endian endian_rx;
280 enum ssp_tx_endian endian_tx;
281 enum ssp_data_size data_size;
282 enum ssp_mode com_mode; 283 enum ssp_mode com_mode;
283 enum ssp_rx_level_trig rx_lev_trig; 284 enum ssp_rx_level_trig rx_lev_trig;
284 enum ssp_tx_level_trig tx_lev_trig; 285 enum ssp_tx_level_trig tx_lev_trig;
285 enum ssp_spi_clk_phase clk_phase;
286 enum ssp_spi_clk_pol clk_pol;
287 enum ssp_microwire_ctrl_len ctrl_len; 286 enum ssp_microwire_ctrl_len ctrl_len;
288 enum ssp_microwire_wait_state wait_state; 287 enum ssp_microwire_wait_state wait_state;
289 enum ssp_duplex duplex; 288 enum ssp_duplex duplex;
diff --git a/include/linux/amba/pl08x.h b/include/linux/amba/pl08x.h
new file mode 100644
index 000000000000..3111385b8ca7
--- /dev/null
+++ b/include/linux/amba/pl08x.h
@@ -0,0 +1,223 @@
1/*
2 * linux/amba/pl08x.h - ARM PrimeCell DMA Controller driver
3 *
4 * Copyright (C) 2005 ARM Ltd
5 * Copyright (C) 2010 ST-Ericsson SA
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * pl08x information required by platform code
12 *
13 * Please credit ARM.com
14 * Documentation: ARM DDI 0196D
15 */
16
17#ifndef AMBA_PL08X_H
18#define AMBA_PL08X_H
19
20/* We need sizes of structs from this header */
21#include <linux/dmaengine.h>
22#include <linux/interrupt.h>
23
24struct pl08x_lli;
25struct pl08x_driver_data;
26
27/* Bitmasks for selecting AHB ports for DMA transfers */
28enum {
29 PL08X_AHB1 = (1 << 0),
30 PL08X_AHB2 = (1 << 1)
31};
32
33/**
34 * struct pl08x_channel_data - data structure to pass info between
35 * platform and PL08x driver regarding channel configuration
36 * @bus_id: name of this device channel, not just a device name since
37 * devices may have more than one channel e.g. "foo_tx"
38 * @min_signal: the minimum DMA signal number to be muxed in for this
39 * channel (for platforms supporting muxed signals). If you have
40 * static assignments, make sure this is set to the assigned signal
41 * number, PL08x have 16 possible signals in number 0 thru 15 so
42 * when these are not enough they often get muxed (in hardware)
43 * disabling simultaneous use of the same channel for two devices.
44 * @max_signal: the maximum DMA signal number to be muxed in for
45 * the channel. Set to the same as min_signal for
46 * devices with static assignments
47 * @muxval: a number usually used to poke into some mux regiser to
48 * mux in the signal to this channel
49 * @cctl_opt: default options for the channel control register
50 * @addr: source/target address in physical memory for this DMA channel,
51 * can be the address of a FIFO register for burst requests for example.
52 * This can be left undefined if the PrimeCell API is used for configuring
53 * this.
54 * @circular_buffer: whether the buffer passed in is circular and
55 * shall simply be looped round round (like a record baby round
56 * round round round)
57 * @single: the device connected to this channel will request single DMA
58 * transfers, not bursts. (Bursts are default.)
59 * @periph_buses: the device connected to this channel is accessible via
60 * these buses (use PL08X_AHB1 | PL08X_AHB2).
61 */
62struct pl08x_channel_data {
63 char *bus_id;
64 int min_signal;
65 int max_signal;
66 u32 muxval;
67 u32 cctl;
68 dma_addr_t addr;
69 bool circular_buffer;
70 bool single;
71 u8 periph_buses;
72};
73
74/**
75 * Struct pl08x_bus_data - information of source or destination
76 * busses for a transfer
77 * @addr: current address
78 * @maxwidth: the maximum width of a transfer on this bus
79 * @buswidth: the width of this bus in bytes: 1, 2 or 4
80 * @fill_bytes: bytes required to fill to the next bus memory boundary
81 */
82struct pl08x_bus_data {
83 dma_addr_t addr;
84 u8 maxwidth;
85 u8 buswidth;
86 size_t fill_bytes;
87};
88
89/**
90 * struct pl08x_phy_chan - holder for the physical channels
91 * @id: physical index to this channel
92 * @lock: a lock to use when altering an instance of this struct
93 * @signal: the physical signal (aka channel) serving this physical channel
94 * right now
95 * @serving: the virtual channel currently being served by this physical
96 * channel
97 */
98struct pl08x_phy_chan {
99 unsigned int id;
100 void __iomem *base;
101 spinlock_t lock;
102 int signal;
103 struct pl08x_dma_chan *serving;
104};
105
106/**
107 * struct pl08x_txd - wrapper for struct dma_async_tx_descriptor
108 * @llis_bus: DMA memory address (physical) start for the LLIs
109 * @llis_va: virtual memory address start for the LLIs
110 */
111struct pl08x_txd {
112 struct dma_async_tx_descriptor tx;
113 struct list_head node;
114 enum dma_data_direction direction;
115 dma_addr_t src_addr;
116 dma_addr_t dst_addr;
117 size_t len;
118 dma_addr_t llis_bus;
119 struct pl08x_lli *llis_va;
120 /* Default cctl value for LLIs */
121 u32 cctl;
122 /*
123 * Settings to be put into the physical channel when we
124 * trigger this txd. Other registers are in llis_va[0].
125 */
126 u32 ccfg;
127};
128
129/**
130 * struct pl08x_dma_chan_state - holds the PL08x specific virtual channel
131 * states
132 * @PL08X_CHAN_IDLE: the channel is idle
133 * @PL08X_CHAN_RUNNING: the channel has allocated a physical transport
134 * channel and is running a transfer on it
135 * @PL08X_CHAN_PAUSED: the channel has allocated a physical transport
136 * channel, but the transfer is currently paused
137 * @PL08X_CHAN_WAITING: the channel is waiting for a physical transport
138 * channel to become available (only pertains to memcpy channels)
139 */
140enum pl08x_dma_chan_state {
141 PL08X_CHAN_IDLE,
142 PL08X_CHAN_RUNNING,
143 PL08X_CHAN_PAUSED,
144 PL08X_CHAN_WAITING,
145};
146
147/**
148 * struct pl08x_dma_chan - this structure wraps a DMA ENGINE channel
149 * @chan: wrappped abstract channel
150 * @phychan: the physical channel utilized by this channel, if there is one
151 * @phychan_hold: if non-zero, hold on to the physical channel even if we
152 * have no pending entries
153 * @tasklet: tasklet scheduled by the IRQ to handle actual work etc
154 * @name: name of channel
155 * @cd: channel platform data
156 * @runtime_addr: address for RX/TX according to the runtime config
157 * @runtime_direction: current direction of this channel according to
158 * runtime config
159 * @lc: last completed transaction on this channel
160 * @pend_list: queued transactions pending on this channel
161 * @at: active transaction on this channel
162 * @lock: a lock for this channel data
163 * @host: a pointer to the host (internal use)
164 * @state: whether the channel is idle, paused, running etc
165 * @slave: whether this channel is a device (slave) or for memcpy
166 * @waiting: a TX descriptor on this channel which is waiting for a physical
167 * channel to become available
168 */
169struct pl08x_dma_chan {
170 struct dma_chan chan;
171 struct pl08x_phy_chan *phychan;
172 int phychan_hold;
173 struct tasklet_struct tasklet;
174 char *name;
175 struct pl08x_channel_data *cd;
176 dma_addr_t runtime_addr;
177 enum dma_data_direction runtime_direction;
178 dma_cookie_t lc;
179 struct list_head pend_list;
180 struct pl08x_txd *at;
181 spinlock_t lock;
182 struct pl08x_driver_data *host;
183 enum pl08x_dma_chan_state state;
184 bool slave;
185 struct pl08x_txd *waiting;
186};
187
188/**
189 * struct pl08x_platform_data - the platform configuration for the PL08x
190 * PrimeCells.
191 * @slave_channels: the channels defined for the different devices on the
192 * platform, all inclusive, including multiplexed channels. The available
193 * physical channels will be multiplexed around these signals as they are
194 * requested, just enumerate all possible channels.
195 * @get_signal: request a physical signal to be used for a DMA transfer
196 * immediately: if there is some multiplexing or similar blocking the use
197 * of the channel the transfer can be denied by returning less than zero,
198 * else it returns the allocated signal number
199 * @put_signal: indicate to the platform that this physical signal is not
200 * running any DMA transfer and multiplexing can be recycled
201 * @lli_buses: buses which LLIs can be fetched from: PL08X_AHB1 | PL08X_AHB2
202 * @mem_buses: buses which memory can be accessed from: PL08X_AHB1 | PL08X_AHB2
203 */
204struct pl08x_platform_data {
205 struct pl08x_channel_data *slave_channels;
206 unsigned int num_slave_channels;
207 struct pl08x_channel_data memcpy_channel;
208 int (*get_signal)(struct pl08x_dma_chan *);
209 void (*put_signal)(struct pl08x_dma_chan *);
210 u8 lli_buses;
211 u8 mem_buses;
212};
213
214#ifdef CONFIG_AMBA_PL08X
215bool pl08x_filter_id(struct dma_chan *chan, void *chan_id);
216#else
217static inline bool pl08x_filter_id(struct dma_chan *chan, void *chan_id)
218{
219 return false;
220}
221#endif
222
223#endif /* AMBA_PL08X_H */
diff --git a/include/linux/amba/serial.h b/include/linux/amba/serial.h
index e1b634b635f2..514ed45c462e 100644
--- a/include/linux/amba/serial.h
+++ b/include/linux/amba/serial.h
@@ -32,7 +32,9 @@
32#define UART01x_RSR 0x04 /* Receive status register (Read). */ 32#define UART01x_RSR 0x04 /* Receive status register (Read). */
33#define UART01x_ECR 0x04 /* Error clear register (Write). */ 33#define UART01x_ECR 0x04 /* Error clear register (Write). */
34#define UART010_LCRH 0x08 /* Line control register, high byte. */ 34#define UART010_LCRH 0x08 /* Line control register, high byte. */
35#define ST_UART011_DMAWM 0x08 /* DMA watermark configure register. */
35#define UART010_LCRM 0x0C /* Line control register, middle byte. */ 36#define UART010_LCRM 0x0C /* Line control register, middle byte. */
37#define ST_UART011_TIMEOUT 0x0C /* Timeout period register. */
36#define UART010_LCRL 0x10 /* Line control register, low byte. */ 38#define UART010_LCRL 0x10 /* Line control register, low byte. */
37#define UART010_CR 0x14 /* Control register. */ 39#define UART010_CR 0x14 /* Control register. */
38#define UART01x_FR 0x18 /* Flag register (Read only). */ 40#define UART01x_FR 0x18 /* Flag register (Read only). */
@@ -51,6 +53,15 @@
51#define UART011_MIS 0x40 /* Masked interrupt status. */ 53#define UART011_MIS 0x40 /* Masked interrupt status. */
52#define UART011_ICR 0x44 /* Interrupt clear register. */ 54#define UART011_ICR 0x44 /* Interrupt clear register. */
53#define UART011_DMACR 0x48 /* DMA control register. */ 55#define UART011_DMACR 0x48 /* DMA control register. */
56#define ST_UART011_XFCR 0x50 /* XON/XOFF control register. */
57#define ST_UART011_XON1 0x54 /* XON1 register. */
58#define ST_UART011_XON2 0x58 /* XON2 register. */
59#define ST_UART011_XOFF1 0x5C /* XON1 register. */
60#define ST_UART011_XOFF2 0x60 /* XON2 register. */
61#define ST_UART011_ITCR 0x80 /* Integration test control register. */
62#define ST_UART011_ITIP 0x84 /* Integration test input register. */
63#define ST_UART011_ABCR 0x100 /* Autobaud control register. */
64#define ST_UART011_ABIMSC 0x15C /* Autobaud interrupt mask/clear register. */
54 65
55#define UART011_DR_OE (1 << 11) 66#define UART011_DR_OE (1 << 11)
56#define UART011_DR_BE (1 << 10) 67#define UART011_DR_BE (1 << 10)
@@ -102,6 +113,21 @@
102#define UART01x_LCRH_PEN 0x02 113#define UART01x_LCRH_PEN 0x02
103#define UART01x_LCRH_BRK 0x01 114#define UART01x_LCRH_BRK 0x01
104 115
116#define ST_UART011_DMAWM_RX_1 (0 << 3)
117#define ST_UART011_DMAWM_RX_2 (1 << 3)
118#define ST_UART011_DMAWM_RX_4 (2 << 3)
119#define ST_UART011_DMAWM_RX_8 (3 << 3)
120#define ST_UART011_DMAWM_RX_16 (4 << 3)
121#define ST_UART011_DMAWM_RX_32 (5 << 3)
122#define ST_UART011_DMAWM_RX_48 (6 << 3)
123#define ST_UART011_DMAWM_TX_1 0
124#define ST_UART011_DMAWM_TX_2 1
125#define ST_UART011_DMAWM_TX_4 2
126#define ST_UART011_DMAWM_TX_8 3
127#define ST_UART011_DMAWM_TX_16 4
128#define ST_UART011_DMAWM_TX_32 5
129#define ST_UART011_DMAWM_TX_48 6
130
105#define UART010_IIR_RTIS 0x08 131#define UART010_IIR_RTIS 0x08
106#define UART010_IIR_TIS 0x04 132#define UART010_IIR_TIS 0x04
107#define UART010_IIR_RIS 0x02 133#define UART010_IIR_RIS 0x02
@@ -169,6 +195,16 @@ struct amba_device; /* in uncompress this is included but amba/bus.h is not */
169struct amba_pl010_data { 195struct amba_pl010_data {
170 void (*set_mctrl)(struct amba_device *dev, void __iomem *base, unsigned int mctrl); 196 void (*set_mctrl)(struct amba_device *dev, void __iomem *base, unsigned int mctrl);
171}; 197};
198
199struct dma_chan;
200struct amba_pl011_data {
201 bool (*dma_filter)(struct dma_chan *chan, void *filter_param);
202 void *dma_rx_param;
203 void *dma_tx_param;
204 void (*init) (void);
205 void (*exit) (void);
206 void (*reset) (void);
207};
172#endif 208#endif
173 209
174#endif 210#endif