]> git.karo-electronics.de Git - karo-tx-linux.git/blob - include/linux/pxp_device.h
ENGR00293323 PXP: add WC and cacheable dma buffer support for PXP device
[karo-tx-linux.git] / include / linux / pxp_device.h
1 /*
2  * Copyright (C) 2013-2014 Freescale Semiconductor, Inc. All Rights Reserved.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17  *
18  */
19 #ifndef _PXP_DEVICE
20 #define _PXP_DEVICE
21
22 #include <linux/idr.h>
23 #include <linux/hash.h>
24 #include <uapi/linux/pxp_device.h>
25
26 struct pxp_irq_info {
27         wait_queue_head_t waitq;
28         atomic_t irq_pending;
29         int hist_status;
30 };
31
32 struct pxp_buffer_hash {
33         struct hlist_head *hash_table;
34         u32 order;
35         spinlock_t hash_lock;
36 };
37
38 struct pxp_buf_obj {
39         uint32_t handle;
40
41         uint32_t size;
42         uint32_t mem_type;
43
44         unsigned long offset;
45         void *virtual;
46
47         struct hlist_node item;
48 };
49
50 struct pxp_chan_obj {
51         uint32_t handle;
52         struct dma_chan *chan;
53 };
54
55 /* File private data */
56 struct pxp_file {
57         struct file *filp;
58
59         /* record allocated dma buffer */
60         struct idr buffer_idr;
61         spinlock_t buffer_lock;
62
63         /* record allocated dma channel */
64         struct idr channel_idr;
65         spinlock_t channel_lock;
66 };
67
68 #endif