blob: 2a5f64a11b77aee8d56100d60df81a7600511a6e [file] [log] [blame]
Linus Walleije8689e62010-09-28 15:57:37 +02001/*
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 Walleije8689e62010-09-28 15:57:37 +020015 */
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 Linux7cb72ad2011-01-03 22:35:28 +000024struct pl08x_driver_data;
Russell Kingb23f2042012-05-16 10:48:44 +010025struct pl08x_phy_chan;
26struct pl08x_txd;
Russell King - ARM Linux7cb72ad2011-01-03 22:35:28 +000027
Russell King - ARM Linux30749cb2011-01-03 22:41:13 +000028/* Bitmasks for selecting AHB ports for DMA transfers */
29enum {
30 PL08X_AHB1 = (1 << 0),
31 PL08X_AHB2 = (1 << 1)
32};
33
Linus Walleije8689e62010-09-28 15:57:37 +020034/**
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
Russell Kingdc8d5f82012-05-16 12:20:55 +010050 * @cctl_memcpy: options for the channel control register for memcpy
51 * *** not used for slave channels ***
Linus Walleije8689e62010-09-28 15:57:37 +020052 * @addr: source/target address in physical memory for this DMA channel,
53 * can be the address of a FIFO register for burst requests for example.
54 * This can be left undefined if the PrimeCell API is used for configuring
55 * this.
Russell King - ARM Linux94ae8522011-01-16 20:18:05 +000056 * @single: the device connected to this channel will request single DMA
57 * transfers, not bursts. (Bursts are default.)
Russell King - ARM Linux30749cb2011-01-03 22:41:13 +000058 * @periph_buses: the device connected to this channel is accessible via
59 * these buses (use PL08X_AHB1 | PL08X_AHB2).
Linus Walleije8689e62010-09-28 15:57:37 +020060 */
61struct pl08x_channel_data {
Russell King550ec362012-05-28 10:18:55 +010062 const char *bus_id;
Linus Walleije8689e62010-09-28 15:57:37 +020063 int min_signal;
64 int max_signal;
65 u32 muxval;
Russell Kingdc8d5f82012-05-16 12:20:55 +010066 u32 cctl_memcpy;
Linus Walleije8689e62010-09-28 15:57:37 +020067 dma_addr_t addr;
Linus Walleije8689e62010-09-28 15:57:37 +020068 bool single;
Russell King - ARM Linux30749cb2011-01-03 22:41:13 +000069 u8 periph_buses;
Linus Walleije8689e62010-09-28 15:57:37 +020070};
71
72/**
Russell King - ARM Linux94ae8522011-01-16 20:18:05 +000073 * struct pl08x_platform_data - the platform configuration for the PL08x
74 * PrimeCells.
Linus Walleije8689e62010-09-28 15:57:37 +020075 * @slave_channels: the channels defined for the different devices on the
76 * platform, all inclusive, including multiplexed channels. The available
Russell King - ARM Linux94ae8522011-01-16 20:18:05 +000077 * physical channels will be multiplexed around these signals as they are
78 * requested, just enumerate all possible channels.
79 * @get_signal: request a physical signal to be used for a DMA transfer
80 * immediately: if there is some multiplexing or similar blocking the use
81 * of the channel the transfer can be denied by returning less than zero,
82 * else it returns the allocated signal number
Linus Walleije8689e62010-09-28 15:57:37 +020083 * @put_signal: indicate to the platform that this physical signal is not
84 * running any DMA transfer and multiplexing can be recycled
Russell King - ARM Linux30749cb2011-01-03 22:41:13 +000085 * @lli_buses: buses which LLIs can be fetched from: PL08X_AHB1 | PL08X_AHB2
86 * @mem_buses: buses which memory can be accessed from: PL08X_AHB1 | PL08X_AHB2
Linus Walleije8689e62010-09-28 15:57:37 +020087 */
88struct pl08x_platform_data {
Russell King - ARM Linuxfa020e72011-07-21 17:13:07 +010089 const struct pl08x_channel_data *slave_channels;
Linus Walleije8689e62010-09-28 15:57:37 +020090 unsigned int num_slave_channels;
91 struct pl08x_channel_data memcpy_channel;
Russell Kingaeea1802012-05-17 15:01:28 +010092 int (*get_signal)(const struct pl08x_channel_data *);
93 void (*put_signal)(const struct pl08x_channel_data *, int);
Russell King - ARM Linux30749cb2011-01-03 22:41:13 +000094 u8 lli_buses;
95 u8 mem_buses;
Linus Walleije8689e62010-09-28 15:57:37 +020096};
97
98#ifdef CONFIG_AMBA_PL08X
99bool pl08x_filter_id(struct dma_chan *chan, void *chan_id);
100#else
101static inline bool pl08x_filter_id(struct dma_chan *chan, void *chan_id)
102{
103 return false;
104}
105#endif
106
107#endif /* AMBA_PL08X_H */