diff options
Diffstat (limited to 'include/linux/amba')
-rw-r--r-- | include/linux/amba/bus.h | 8 | ||||
-rw-r--r-- | include/linux/amba/clcd.h | 92 | ||||
-rw-r--r-- | include/linux/amba/mmci.h | 17 | ||||
-rw-r--r-- | include/linux/amba/pl08x.h | 99 |
4 files changed, 143 insertions, 73 deletions
diff --git a/include/linux/amba/bus.h b/include/linux/amba/bus.h index 9e7f259346e1..fcbbe71a3cc1 100644 --- a/include/linux/amba/bus.h +++ b/include/linux/amba/bus.h | |||
@@ -43,12 +43,12 @@ struct amba_id { | |||
43 | 43 | ||
44 | struct amba_driver { | 44 | struct amba_driver { |
45 | struct device_driver drv; | 45 | struct device_driver drv; |
46 | int (*probe)(struct amba_device *, struct amba_id *); | 46 | int (*probe)(struct amba_device *, const struct amba_id *); |
47 | int (*remove)(struct amba_device *); | 47 | int (*remove)(struct amba_device *); |
48 | void (*shutdown)(struct amba_device *); | 48 | void (*shutdown)(struct amba_device *); |
49 | int (*suspend)(struct amba_device *, pm_message_t); | 49 | int (*suspend)(struct amba_device *, pm_message_t); |
50 | int (*resume)(struct amba_device *); | 50 | int (*resume)(struct amba_device *); |
51 | struct amba_id *id_table; | 51 | const struct amba_id *id_table; |
52 | }; | 52 | }; |
53 | 53 | ||
54 | enum amba_vendor { | 54 | enum amba_vendor { |
@@ -56,6 +56,10 @@ enum amba_vendor { | |||
56 | AMBA_VENDOR_ST = 0x80, | 56 | AMBA_VENDOR_ST = 0x80, |
57 | }; | 57 | }; |
58 | 58 | ||
59 | extern struct bus_type amba_bustype; | ||
60 | |||
61 | #define to_amba_device(d) container_of(d, struct amba_device, dev) | ||
62 | |||
59 | #define amba_get_drvdata(d) dev_get_drvdata(&d->dev) | 63 | #define amba_get_drvdata(d) dev_get_drvdata(&d->dev) |
60 | #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) |
61 | 65 | ||
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 | ||
70 | enum { | ||
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 | |||
69 | struct clcd_panel { | 96 | struct 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 | ||
156 | static inline void clcdfb_decode(struct clcd_fb *fb, struct clcd_regs *regs) | 189 | static 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 | ||
234 | static inline int clcdfb_check(struct clcd_fb *fb, struct fb_var_screeninfo *var) | 282 | static 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 f4ee9acc9721..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 */ | ||
10 | struct 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. |
@@ -27,6 +30,17 @@ | |||
27 | * @cd_invert: true if the gpio_cd pin value is active low | 30 | * @cd_invert: true if the gpio_cd pin value is active low |
28 | * @capabilities: the capabilities of the block as implemented in | 31 | * @capabilities: the capabilities of the block as implemented in |
29 | * 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 | ||
30 | */ | 44 | */ |
31 | struct mmci_platform_data { | 45 | struct mmci_platform_data { |
32 | unsigned int f_max; | 46 | unsigned int f_max; |
@@ -38,6 +52,9 @@ struct mmci_platform_data { | |||
38 | int gpio_cd; | 52 | int gpio_cd; |
39 | bool cd_invert; | 53 | bool cd_invert; |
40 | 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; | ||
41 | }; | 58 | }; |
42 | 59 | ||
43 | #endif | 60 | #endif |
diff --git a/include/linux/amba/pl08x.h b/include/linux/amba/pl08x.h index 521a0f8974ac..3111385b8ca7 100644 --- a/include/linux/amba/pl08x.h +++ b/include/linux/amba/pl08x.h | |||
@@ -12,7 +12,6 @@ | |||
12 | * | 12 | * |
13 | * Please credit ARM.com | 13 | * Please credit ARM.com |
14 | * Documentation: ARM DDI 0196D | 14 | * Documentation: ARM DDI 0196D |
15 | * | ||
16 | */ | 15 | */ |
17 | 16 | ||
18 | #ifndef AMBA_PL08X_H | 17 | #ifndef AMBA_PL08X_H |
@@ -22,6 +21,15 @@ | |||
22 | #include <linux/dmaengine.h> | 21 | #include <linux/dmaengine.h> |
23 | #include <linux/interrupt.h> | 22 | #include <linux/interrupt.h> |
24 | 23 | ||
24 | struct pl08x_lli; | ||
25 | struct pl08x_driver_data; | ||
26 | |||
27 | /* Bitmasks for selecting AHB ports for DMA transfers */ | ||
28 | enum { | ||
29 | PL08X_AHB1 = (1 << 0), | ||
30 | PL08X_AHB2 = (1 << 1) | ||
31 | }; | ||
32 | |||
25 | /** | 33 | /** |
26 | * struct pl08x_channel_data - data structure to pass info between | 34 | * struct pl08x_channel_data - data structure to pass info between |
27 | * platform and PL08x driver regarding channel configuration | 35 | * platform and PL08x driver regarding channel configuration |
@@ -46,8 +54,10 @@ | |||
46 | * @circular_buffer: whether the buffer passed in is circular and | 54 | * @circular_buffer: whether the buffer passed in is circular and |
47 | * shall simply be looped round round (like a record baby round | 55 | * shall simply be looped round round (like a record baby round |
48 | * round round round) | 56 | * round round round) |
49 | * @single: the device connected to this channel will request single | 57 | * @single: the device connected to this channel will request single DMA |
50 | * DMA transfers, not bursts. (Bursts are default.) | 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). | ||
51 | */ | 61 | */ |
52 | struct pl08x_channel_data { | 62 | struct pl08x_channel_data { |
53 | char *bus_id; | 63 | char *bus_id; |
@@ -55,10 +65,10 @@ struct pl08x_channel_data { | |||
55 | int max_signal; | 65 | int max_signal; |
56 | u32 muxval; | 66 | u32 muxval; |
57 | u32 cctl; | 67 | u32 cctl; |
58 | u32 ccfg; | ||
59 | dma_addr_t addr; | 68 | dma_addr_t addr; |
60 | bool circular_buffer; | 69 | bool circular_buffer; |
61 | bool single; | 70 | bool single; |
71 | u8 periph_buses; | ||
62 | }; | 72 | }; |
63 | 73 | ||
64 | /** | 74 | /** |
@@ -67,24 +77,23 @@ struct pl08x_channel_data { | |||
67 | * @addr: current address | 77 | * @addr: current address |
68 | * @maxwidth: the maximum width of a transfer on this bus | 78 | * @maxwidth: the maximum width of a transfer on this bus |
69 | * @buswidth: the width of this bus in bytes: 1, 2 or 4 | 79 | * @buswidth: the width of this bus in bytes: 1, 2 or 4 |
70 | * @fill_bytes: bytes required to fill to the next bus memory | 80 | * @fill_bytes: bytes required to fill to the next bus memory boundary |
71 | * boundary | ||
72 | */ | 81 | */ |
73 | struct pl08x_bus_data { | 82 | struct pl08x_bus_data { |
74 | dma_addr_t addr; | 83 | dma_addr_t addr; |
75 | u8 maxwidth; | 84 | u8 maxwidth; |
76 | u8 buswidth; | 85 | u8 buswidth; |
77 | u32 fill_bytes; | 86 | size_t fill_bytes; |
78 | }; | 87 | }; |
79 | 88 | ||
80 | /** | 89 | /** |
81 | * struct pl08x_phy_chan - holder for the physical channels | 90 | * struct pl08x_phy_chan - holder for the physical channels |
82 | * @id: physical index to this channel | 91 | * @id: physical index to this channel |
83 | * @lock: a lock to use when altering an instance of this struct | 92 | * @lock: a lock to use when altering an instance of this struct |
84 | * @signal: the physical signal (aka channel) serving this | 93 | * @signal: the physical signal (aka channel) serving this physical channel |
85 | * physical channel right now | 94 | * right now |
86 | * @serving: the virtual channel currently being served by this | 95 | * @serving: the virtual channel currently being served by this physical |
87 | * physical channel | 96 | * channel |
88 | */ | 97 | */ |
89 | struct pl08x_phy_chan { | 98 | struct pl08x_phy_chan { |
90 | unsigned int id; | 99 | unsigned int id; |
@@ -92,11 +101,6 @@ struct pl08x_phy_chan { | |||
92 | spinlock_t lock; | 101 | spinlock_t lock; |
93 | int signal; | 102 | int signal; |
94 | struct pl08x_dma_chan *serving; | 103 | struct pl08x_dma_chan *serving; |
95 | u32 csrc; | ||
96 | u32 cdst; | ||
97 | u32 clli; | ||
98 | u32 cctl; | ||
99 | u32 ccfg; | ||
100 | }; | 104 | }; |
101 | 105 | ||
102 | /** | 106 | /** |
@@ -108,26 +112,23 @@ struct pl08x_txd { | |||
108 | struct dma_async_tx_descriptor tx; | 112 | struct dma_async_tx_descriptor tx; |
109 | struct list_head node; | 113 | struct list_head node; |
110 | enum dma_data_direction direction; | 114 | enum dma_data_direction direction; |
111 | struct pl08x_bus_data srcbus; | 115 | dma_addr_t src_addr; |
112 | struct pl08x_bus_data dstbus; | 116 | dma_addr_t dst_addr; |
113 | int len; | 117 | size_t len; |
114 | dma_addr_t llis_bus; | 118 | dma_addr_t llis_bus; |
115 | void *llis_va; | 119 | struct pl08x_lli *llis_va; |
116 | struct pl08x_channel_data *cd; | 120 | /* Default cctl value for LLIs */ |
117 | bool active; | 121 | u32 cctl; |
118 | /* | 122 | /* |
119 | * Settings to be put into the physical channel when we | 123 | * Settings to be put into the physical channel when we |
120 | * trigger this txd | 124 | * trigger this txd. Other registers are in llis_va[0]. |
121 | */ | 125 | */ |
122 | u32 csrc; | 126 | u32 ccfg; |
123 | u32 cdst; | ||
124 | u32 clli; | ||
125 | u32 cctl; | ||
126 | }; | 127 | }; |
127 | 128 | ||
128 | /** | 129 | /** |
129 | * struct pl08x_dma_chan_state - holds the PL08x specific virtual | 130 | * struct pl08x_dma_chan_state - holds the PL08x specific virtual channel |
130 | * channel states | 131 | * states |
131 | * @PL08X_CHAN_IDLE: the channel is idle | 132 | * @PL08X_CHAN_IDLE: the channel is idle |
132 | * @PL08X_CHAN_RUNNING: the channel has allocated a physical transport | 133 | * @PL08X_CHAN_RUNNING: the channel has allocated a physical transport |
133 | * channel and is running a transfer on it | 134 | * channel and is running a transfer on it |
@@ -147,6 +148,8 @@ enum pl08x_dma_chan_state { | |||
147 | * struct pl08x_dma_chan - this structure wraps a DMA ENGINE channel | 148 | * struct pl08x_dma_chan - this structure wraps a DMA ENGINE channel |
148 | * @chan: wrappped abstract channel | 149 | * @chan: wrappped abstract channel |
149 | * @phychan: the physical channel utilized by this channel, if there is one | 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 | ||
150 | * @tasklet: tasklet scheduled by the IRQ to handle actual work etc | 153 | * @tasklet: tasklet scheduled by the IRQ to handle actual work etc |
151 | * @name: name of channel | 154 | * @name: name of channel |
152 | * @cd: channel platform data | 155 | * @cd: channel platform data |
@@ -154,53 +157,49 @@ enum pl08x_dma_chan_state { | |||
154 | * @runtime_direction: current direction of this channel according to | 157 | * @runtime_direction: current direction of this channel according to |
155 | * runtime config | 158 | * runtime config |
156 | * @lc: last completed transaction on this channel | 159 | * @lc: last completed transaction on this channel |
157 | * @desc_list: queued transactions pending on this channel | 160 | * @pend_list: queued transactions pending on this channel |
158 | * @at: active transaction on this channel | 161 | * @at: active transaction on this channel |
159 | * @lockflags: sometimes we let a lock last between two function calls, | ||
160 | * especially prep/submit, and then we need to store the IRQ flags | ||
161 | * in the channel state, here | ||
162 | * @lock: a lock for this channel data | 162 | * @lock: a lock for this channel data |
163 | * @host: a pointer to the host (internal use) | 163 | * @host: a pointer to the host (internal use) |
164 | * @state: whether the channel is idle, paused, running etc | 164 | * @state: whether the channel is idle, paused, running etc |
165 | * @slave: whether this channel is a device (slave) or for memcpy | 165 | * @slave: whether this channel is a device (slave) or for memcpy |
166 | * @waiting: a TX descriptor on this channel which is waiting for | 166 | * @waiting: a TX descriptor on this channel which is waiting for a physical |
167 | * a physical channel to become available | 167 | * channel to become available |
168 | */ | 168 | */ |
169 | struct pl08x_dma_chan { | 169 | struct pl08x_dma_chan { |
170 | struct dma_chan chan; | 170 | struct dma_chan chan; |
171 | struct pl08x_phy_chan *phychan; | 171 | struct pl08x_phy_chan *phychan; |
172 | int phychan_hold; | ||
172 | struct tasklet_struct tasklet; | 173 | struct tasklet_struct tasklet; |
173 | char *name; | 174 | char *name; |
174 | struct pl08x_channel_data *cd; | 175 | struct pl08x_channel_data *cd; |
175 | dma_addr_t runtime_addr; | 176 | dma_addr_t runtime_addr; |
176 | enum dma_data_direction runtime_direction; | 177 | enum dma_data_direction runtime_direction; |
177 | atomic_t last_issued; | ||
178 | dma_cookie_t lc; | 178 | dma_cookie_t lc; |
179 | struct list_head desc_list; | 179 | struct list_head pend_list; |
180 | struct pl08x_txd *at; | 180 | struct pl08x_txd *at; |
181 | unsigned long lockflags; | ||
182 | spinlock_t lock; | 181 | spinlock_t lock; |
183 | void *host; | 182 | struct pl08x_driver_data *host; |
184 | enum pl08x_dma_chan_state state; | 183 | enum pl08x_dma_chan_state state; |
185 | bool slave; | 184 | bool slave; |
186 | struct pl08x_txd *waiting; | 185 | struct pl08x_txd *waiting; |
187 | }; | 186 | }; |
188 | 187 | ||
189 | /** | 188 | /** |
190 | * struct pl08x_platform_data - the platform configuration for the | 189 | * struct pl08x_platform_data - the platform configuration for the PL08x |
191 | * PL08x PrimeCells. | 190 | * PrimeCells. |
192 | * @slave_channels: the channels defined for the different devices on the | 191 | * @slave_channels: the channels defined for the different devices on the |
193 | * platform, all inclusive, including multiplexed channels. The available | 192 | * platform, all inclusive, including multiplexed channels. The available |
194 | * physical channels will be multiplexed around these signals as they | 193 | * physical channels will be multiplexed around these signals as they are |
195 | * are requested, just enumerate all possible channels. | 194 | * requested, just enumerate all possible channels. |
196 | * @get_signal: request a physical signal to be used for a DMA | 195 | * @get_signal: request a physical signal to be used for a DMA transfer |
197 | * transfer immediately: if there is some multiplexing or similar blocking | 196 | * immediately: if there is some multiplexing or similar blocking the use |
198 | * the use of the channel the transfer can be denied by returning | 197 | * of the channel the transfer can be denied by returning less than zero, |
199 | * less than zero, else it returns the allocated signal number | 198 | * else it returns the allocated signal number |
200 | * @put_signal: indicate to the platform that this physical signal is not | 199 | * @put_signal: indicate to the platform that this physical signal is not |
201 | * running any DMA transfer and multiplexing can be recycled | 200 | * running any DMA transfer and multiplexing can be recycled |
202 | * @bus_bit_lli: Bit[0] of the address indicated which AHB bus master the | 201 | * @lli_buses: buses which LLIs can be fetched from: PL08X_AHB1 | PL08X_AHB2 |
203 | * LLI addresses are on 0/1 Master 1/2. | 202 | * @mem_buses: buses which memory can be accessed from: PL08X_AHB1 | PL08X_AHB2 |
204 | */ | 203 | */ |
205 | struct pl08x_platform_data { | 204 | struct pl08x_platform_data { |
206 | struct pl08x_channel_data *slave_channels; | 205 | struct pl08x_channel_data *slave_channels; |
@@ -208,6 +207,8 @@ struct pl08x_platform_data { | |||
208 | struct pl08x_channel_data memcpy_channel; | 207 | struct pl08x_channel_data memcpy_channel; |
209 | int (*get_signal)(struct pl08x_dma_chan *); | 208 | int (*get_signal)(struct pl08x_dma_chan *); |
210 | void (*put_signal)(struct pl08x_dma_chan *); | 209 | void (*put_signal)(struct pl08x_dma_chan *); |
210 | u8 lli_buses; | ||
211 | u8 mem_buses; | ||
211 | }; | 212 | }; |
212 | 213 | ||
213 | #ifdef CONFIG_AMBA_PL08X | 214 | #ifdef CONFIG_AMBA_PL08X |