Linus Walleij | e8689e6 | 2010-09-28 15:57:37 +0200 | [diff] [blame] | 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 |
Linus Walleij | e8689e6 | 2010-09-28 15:57:37 +0200 | [diff] [blame] | 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 | |
Russell King - ARM Linux | 7cb72ad | 2011-01-03 22:35:28 +0000 | [diff] [blame] | 24 | struct pl08x_driver_data; |
Russell King | b23f204 | 2012-05-16 10:48:44 +0100 | [diff] [blame] | 25 | struct pl08x_phy_chan; |
| 26 | struct pl08x_txd; |
Russell King - ARM Linux | 7cb72ad | 2011-01-03 22:35:28 +0000 | [diff] [blame] | 27 | |
Russell King - ARM Linux | 30749cb | 2011-01-03 22:41:13 +0000 | [diff] [blame] | 28 | /* Bitmasks for selecting AHB ports for DMA transfers */ |
| 29 | enum { |
| 30 | PL08X_AHB1 = (1 << 0), |
| 31 | PL08X_AHB2 = (1 << 1) |
| 32 | }; |
| 33 | |
Linus Walleij | e8689e6 | 2010-09-28 15:57:37 +0200 | [diff] [blame] | 34 | /** |
| 35 | * struct pl08x_channel_data - data structure to pass info between |
| 36 | * platform and PL08x driver regarding channel configuration |
| 37 | * @bus_id: name of this device channel, not just a device name since |
| 38 | * devices may have more than one channel e.g. "foo_tx" |
| 39 | * @min_signal: the minimum DMA signal number to be muxed in for this |
| 40 | * channel (for platforms supporting muxed signals). If you have |
| 41 | * static assignments, make sure this is set to the assigned signal |
| 42 | * number, PL08x have 16 possible signals in number 0 thru 15 so |
| 43 | * when these are not enough they often get muxed (in hardware) |
| 44 | * disabling simultaneous use of the same channel for two devices. |
| 45 | * @max_signal: the maximum DMA signal number to be muxed in for |
| 46 | * the channel. Set to the same as min_signal for |
| 47 | * devices with static assignments |
| 48 | * @muxval: a number usually used to poke into some mux regiser to |
| 49 | * mux in the signal to this channel |
Linus Walleij | e8689e6 | 2010-09-28 15:57:37 +0200 | [diff] [blame] | 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. |
Russell King - ARM Linux | 94ae852 | 2011-01-16 20:18:05 +0000 | [diff] [blame] | 54 | * @single: the device connected to this channel will request single DMA |
| 55 | * transfers, not bursts. (Bursts are default.) |
Russell King - ARM Linux | 30749cb | 2011-01-03 22:41:13 +0000 | [diff] [blame] | 56 | * @periph_buses: the device connected to this channel is accessible via |
| 57 | * these buses (use PL08X_AHB1 | PL08X_AHB2). |
Linus Walleij | e8689e6 | 2010-09-28 15:57:37 +0200 | [diff] [blame] | 58 | */ |
| 59 | struct pl08x_channel_data { |
Russell King | 550ec36 | 2012-05-28 10:18:55 +0100 | [diff] [blame] | 60 | const char *bus_id; |
Linus Walleij | e8689e6 | 2010-09-28 15:57:37 +0200 | [diff] [blame] | 61 | int min_signal; |
| 62 | int max_signal; |
| 63 | u32 muxval; |
Linus Walleij | e8689e6 | 2010-09-28 15:57:37 +0200 | [diff] [blame] | 64 | dma_addr_t addr; |
Linus Walleij | e8689e6 | 2010-09-28 15:57:37 +0200 | [diff] [blame] | 65 | bool single; |
Russell King - ARM Linux | 30749cb | 2011-01-03 22:41:13 +0000 | [diff] [blame] | 66 | u8 periph_buses; |
Linus Walleij | e8689e6 | 2010-09-28 15:57:37 +0200 | [diff] [blame] | 67 | }; |
| 68 | |
Linus Walleij | 4166a56 | 2017-05-20 23:42:50 +0200 | [diff] [blame] | 69 | enum pl08x_burst_size { |
| 70 | PL08X_BURST_SZ_1, |
| 71 | PL08X_BURST_SZ_4, |
| 72 | PL08X_BURST_SZ_8, |
| 73 | PL08X_BURST_SZ_16, |
| 74 | PL08X_BURST_SZ_32, |
| 75 | PL08X_BURST_SZ_64, |
| 76 | PL08X_BURST_SZ_128, |
| 77 | PL08X_BURST_SZ_256, |
| 78 | }; |
| 79 | |
| 80 | enum pl08x_bus_width { |
| 81 | PL08X_BUS_WIDTH_8_BITS, |
| 82 | PL08X_BUS_WIDTH_16_BITS, |
| 83 | PL08X_BUS_WIDTH_32_BITS, |
| 84 | }; |
| 85 | |
Linus Walleij | e8689e6 | 2010-09-28 15:57:37 +0200 | [diff] [blame] | 86 | /** |
Russell King - ARM Linux | 94ae852 | 2011-01-16 20:18:05 +0000 | [diff] [blame] | 87 | * struct pl08x_platform_data - the platform configuration for the PL08x |
| 88 | * PrimeCells. |
Linus Walleij | e8689e6 | 2010-09-28 15:57:37 +0200 | [diff] [blame] | 89 | * @slave_channels: the channels defined for the different devices on the |
| 90 | * platform, all inclusive, including multiplexed channels. The available |
Russell King - ARM Linux | 94ae852 | 2011-01-16 20:18:05 +0000 | [diff] [blame] | 91 | * physical channels will be multiplexed around these signals as they are |
| 92 | * requested, just enumerate all possible channels. |
Linus Walleij | 4166a56 | 2017-05-20 23:42:50 +0200 | [diff] [blame] | 93 | * @num_slave_channels: number of elements in the slave channel array |
| 94 | * @memcpy_burst_size: the appropriate burst size for memcpy operations |
| 95 | * @memcpy_bus_width: memory bus width |
| 96 | * @memcpy_prot_buff: whether memcpy DMA is bufferable |
| 97 | * @memcpy_prot_cache: whether memcpy DMA is cacheable |
Mark Brown | d7cabee | 2013-06-19 20:38:28 +0100 | [diff] [blame] | 98 | * @get_xfer_signal: request a physical signal to be used for a DMA transfer |
Russell King - ARM Linux | 94ae852 | 2011-01-16 20:18:05 +0000 | [diff] [blame] | 99 | * immediately: if there is some multiplexing or similar blocking the use |
| 100 | * of the channel the transfer can be denied by returning less than zero, |
| 101 | * else it returns the allocated signal number |
Mark Brown | d7cabee | 2013-06-19 20:38:28 +0100 | [diff] [blame] | 102 | * @put_xfer_signal: indicate to the platform that this physical signal is not |
Linus Walleij | e8689e6 | 2010-09-28 15:57:37 +0200 | [diff] [blame] | 103 | * running any DMA transfer and multiplexing can be recycled |
Russell King - ARM Linux | 30749cb | 2011-01-03 22:41:13 +0000 | [diff] [blame] | 104 | * @lli_buses: buses which LLIs can be fetched from: PL08X_AHB1 | PL08X_AHB2 |
| 105 | * @mem_buses: buses which memory can be accessed from: PL08X_AHB1 | PL08X_AHB2 |
Sylwester Nawrocki | da6f8ca | 2016-11-10 16:17:49 +0100 | [diff] [blame] | 106 | * @slave_map: DMA slave matching table |
| 107 | * @slave_map_len: number of elements in @slave_map |
Linus Walleij | e8689e6 | 2010-09-28 15:57:37 +0200 | [diff] [blame] | 108 | */ |
| 109 | struct pl08x_platform_data { |
Linus Walleij | f9cd476 | 2016-04-04 22:44:59 +0200 | [diff] [blame] | 110 | struct pl08x_channel_data *slave_channels; |
Linus Walleij | e8689e6 | 2010-09-28 15:57:37 +0200 | [diff] [blame] | 111 | unsigned int num_slave_channels; |
Linus Walleij | 4166a56 | 2017-05-20 23:42:50 +0200 | [diff] [blame] | 112 | enum pl08x_burst_size memcpy_burst_size; |
| 113 | enum pl08x_bus_width memcpy_bus_width; |
| 114 | bool memcpy_prot_buff; |
| 115 | bool memcpy_prot_cache; |
Mark Brown | d7cabee | 2013-06-19 20:38:28 +0100 | [diff] [blame] | 116 | int (*get_xfer_signal)(const struct pl08x_channel_data *); |
| 117 | void (*put_xfer_signal)(const struct pl08x_channel_data *, int); |
Russell King - ARM Linux | 30749cb | 2011-01-03 22:41:13 +0000 | [diff] [blame] | 118 | u8 lli_buses; |
| 119 | u8 mem_buses; |
Sylwester Nawrocki | da6f8ca | 2016-11-10 16:17:49 +0100 | [diff] [blame] | 120 | const struct dma_slave_map *slave_map; |
| 121 | int slave_map_len; |
Linus Walleij | e8689e6 | 2010-09-28 15:57:37 +0200 | [diff] [blame] | 122 | }; |
| 123 | |
| 124 | #ifdef CONFIG_AMBA_PL08X |
| 125 | bool pl08x_filter_id(struct dma_chan *chan, void *chan_id); |
| 126 | #else |
| 127 | static inline bool pl08x_filter_id(struct dma_chan *chan, void *chan_id) |
| 128 | { |
| 129 | return false; |
| 130 | } |
| 131 | #endif |
| 132 | |
| 133 | #endif /* AMBA_PL08X_H */ |