Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
mantis_common.h
Go to the documentation of this file.
1 /*
2  Mantis PCI bridge driver
3 
4  Copyright (C) Manu Abraham ([email protected])
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program; if not, write to the Free Software
18  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20 
21 #ifndef __MANTIS_COMMON_H
22 #define __MANTIS_COMMON_H
23 
24 #include <linux/interrupt.h>
25 #include <linux/mutex.h>
26 #include <linux/workqueue.h>
27 
28 #include "mantis_uart.h"
29 
30 #include "mantis_link.h"
31 
32 #define MANTIS_ERROR 0
33 #define MANTIS_NOTICE 1
34 #define MANTIS_INFO 2
35 #define MANTIS_DEBUG 3
36 #define MANTIS_TMG 9
37 
38 #define dprintk(y, z, format, arg...) do { \
39  if (z) { \
40  if ((mantis->verbose > MANTIS_ERROR) && (mantis->verbose > y)) \
41  printk(KERN_ERR "%s (%d): " format "\n" , __func__ , mantis->num , ##arg); \
42  else if ((mantis->verbose > MANTIS_NOTICE) && (mantis->verbose > y)) \
43  printk(KERN_NOTICE "%s (%d): " format "\n" , __func__ , mantis->num , ##arg); \
44  else if ((mantis->verbose > MANTIS_INFO) && (mantis->verbose > y)) \
45  printk(KERN_INFO "%s (%d): " format "\n" , __func__ , mantis->num , ##arg); \
46  else if ((mantis->verbose > MANTIS_DEBUG) && (mantis->verbose > y)) \
47  printk(KERN_DEBUG "%s (%d): " format "\n" , __func__ , mantis->num , ##arg); \
48  else if ((mantis->verbose > MANTIS_TMG) && (mantis->verbose > y)) \
49  printk(KERN_DEBUG "%s (%d): " format "\n" , __func__ , mantis->num , ##arg); \
50  } else { \
51  if (mantis->verbose > y) \
52  printk(format , ##arg); \
53  } \
54 } while(0)
55 
56 #define mwrite(dat, addr) writel((dat), addr)
57 #define mread(addr) readl(addr)
58 
59 #define mmwrite(dat, addr) mwrite((dat), (mantis->mmio + (addr)))
60 #define mmread(addr) mread(mantis->mmio + (addr))
61 
62 #define MANTIS_TS_188 0
63 #define MANTIS_TS_204 1
64 
65 #define TWINHAN_TECHNOLOGIES 0x1822
66 #define MANTIS 0x4e35
67 
68 #define TECHNISAT 0x1ae4
69 #define TERRATEC 0x153b
70 
71 #define MAKE_ENTRY(__subven, __subdev, __configptr) { \
72  .vendor = TWINHAN_TECHNOLOGIES, \
73  .device = MANTIS, \
74  .subvendor = (__subven), \
75  .subdevice = (__subdev), \
76  .driver_data = (unsigned long) (__configptr) \
77 }
78 
82 };
83 
84 struct mantis_pci;
85 
87  char *model_name;
88  char *dev_type;
90 
94 
96  int (*frontend_init)(struct mantis_pci *mantis, struct dvb_frontend *fe);
97 
100 
102 };
103 
104 struct mantis_pci {
105  unsigned int verbose;
106 
107  /* PCI stuff */
112 
114 
115  struct pci_dev *pdev;
116 
117  unsigned long mantis_addr;
118  void __iomem *mmio;
119 
122 
123  unsigned int num;
124 
125  /* RISC Core */
132 
134 
136  int i2c_rc;
138  struct mutex i2c_lock;
139 
140  /* DVB stuff */
142  struct dvb_frontend *fe;
143  struct dvb_demux demux;
144  struct dmxdev dmxdev;
147  struct dvb_net dvbnet;
148 
150 
152 
155 
156  /* board specific */
160 
161  /* A12 A13 A14 */
163 
165 
167 
171 
172  struct rc_dev *rc;
173  char input_name[80];
174  char input_phys[80];
175 };
176 
177 #define MANTIS_HIF_STATUS (mantis->gpio_status)
178 
179 #endif /* __MANTIS_COMMON_H */