i2c-eg20t: change timeout value 50msec to 1000msec
[zen-stable.git] / drivers / staging / sep / sep_dev.h
blob696ab0dd2b79805e0e7670637271207a6ef0ab98
1 #ifndef __SEP_DEV_H__
2 #define __SEP_DEV_H__
4 /*
6 * sep_dev.h - Security Processor Device Structures
8 * Copyright(c) 2009,2010 Intel Corporation. All rights reserved.
9 * Contributions(c) 2009,2010 Discretix. All rights reserved.
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the Free
13 * Software Foundation; version 2 of the License.
15 * This program is distributed in the hope that it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
18 * more details.
20 * You should have received a copy of the GNU General Public License along with
21 * this program; if not, write to the Free Software Foundation, Inc., 59
22 * Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 * CONTACTS:
26 * Mark Allyn mark.a.allyn@intel.com
27 * Jayant Mangalampalli jayant.mangalampalli@intel.com
29 * CHANGES
30 * 2010.09.14 upgrade to Medfield
33 struct sep_device {
34 /* pointer to pci dev */
35 struct pci_dev *pdev;
37 /* character device file */
38 struct cdev sep_cdev;
39 struct cdev sep_daemon_cdev;
40 struct cdev sep_singleton_cdev;
42 /* devices (using misc dev) */
43 struct miscdevice miscdev_sep;
44 struct miscdevice miscdev_singleton;
45 struct miscdevice miscdev_daemon;
47 /* major / minor numbers of device */
48 dev_t sep_devno;
49 dev_t sep_daemon_devno;
50 dev_t sep_singleton_devno;
52 struct mutex sep_mutex;
53 struct mutex ioctl_mutex;
54 spinlock_t snd_rply_lck;
56 /* flags to indicate use and lock status of sep */
57 u32 pid_doing_transaction;
58 unsigned long in_use_flags;
60 /* request daemon alread open */
61 unsigned long request_daemon_open;
63 /* 1 = Moorestown; 0 = Medfield */
64 int mrst;
66 /* address of the shared memory allocated during init for SEP driver
67 (coherent alloc) */
68 dma_addr_t shared_bus;
69 size_t shared_size;
70 void *shared_addr;
72 /* start address of the access to the SEP registers from driver */
73 dma_addr_t reg_physical_addr;
74 dma_addr_t reg_physical_end;
75 void __iomem *reg_addr;
77 /* wait queue head (event) of the driver */
78 wait_queue_head_t event;
79 wait_queue_head_t event_request_daemon;
80 wait_queue_head_t event_mmap;
82 struct sep_caller_id_entry
83 caller_id_table[SEP_CALLER_ID_TABLE_NUM_ENTRIES];
85 /* access flag for singleton device */
86 unsigned long singleton_access_flag;
88 /* transaction counter that coordinates the
89 transactions between SEP and HOST */
90 unsigned long send_ct;
91 /* counter for the messages from sep */
92 unsigned long reply_ct;
93 /* counter for the number of bytes allocated in the pool for the
94 current transaction */
95 long data_pool_bytes_allocated;
97 u32 num_of_data_allocations;
99 /* number of the lli tables created in the current transaction */
100 u32 num_lli_tables_created;
102 /* number of data control blocks */
103 u32 nr_dcb_creat;
105 struct sep_dma_resource dma_res_arr[SEP_MAX_NUM_SYNC_DMA_OPS];
109 static inline void sep_write_reg(struct sep_device *dev, int reg, u32 value)
111 void __iomem *addr = dev->reg_addr + reg;
112 writel(value, addr);
115 static inline u32 sep_read_reg(struct sep_device *dev, int reg)
117 void __iomem *addr = dev->reg_addr + reg;
118 return readl(addr);
121 /* wait for SRAM write complete(indirect write */
122 static inline void sep_wait_sram_write(struct sep_device *dev)
124 u32 reg_val;
125 do {
126 reg_val = sep_read_reg(dev, HW_SRAM_DATA_READY_REG_ADDR);
127 } while (!(reg_val & 1));
131 #endif