blob: 43f879a053c92baefa1bb50157a856512610e143 [file] [log] [blame]
Malcolm Priestley3dbbf822011-07-25 15:35:12 -03001/*
2 * Driver for it913x Frontend
3 *
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 *
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 IT913X_FE_H
22#define IT913X_FE_H
23
24#include <linux/dvb/frontend.h>
25#include "dvb_frontend.h"
Malcolm Priestleyb7d425d392011-10-31 12:02:08 -030026
27struct ite_config {
28 u8 chip_ver;
29 u16 chip_type;
30 u32 firmware;
31 u8 tuner_id_0;
32 u8 tuner_id_1;
33 u8 dual_mode;
34 u8 adf;
35};
36
Malcolm Priestley3dbbf822011-07-25 15:35:12 -030037#if defined(CONFIG_DVB_IT913X_FE) || (defined(CONFIG_DVB_IT913X_FE_MODULE) && \
38defined(MODULE))
39extern struct dvb_frontend *it913x_fe_attach(struct i2c_adapter *i2c_adap,
Malcolm Priestleyb7d425d392011-10-31 12:02:08 -030040 u8 i2c_addr, struct ite_config *config);
Malcolm Priestley3dbbf822011-07-25 15:35:12 -030041#else
42static inline struct dvb_frontend *it913x_fe_attach(
Malcolm Priestleyb7d425d392011-10-31 12:02:08 -030043 struct i2c_adapter *i2c_adap,
44 u8 i2c_addr, struct ite_config *config)
Malcolm Priestley3dbbf822011-07-25 15:35:12 -030045{
46 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
47 return NULL;
48}
49#endif /* CONFIG_IT913X_FE */
50#define I2C_BASE_ADDR 0x10
51#define DEV_0 0x0
52#define DEV_1 0x10
53#define PRO_LINK 0x0
54#define PRO_DMOD 0x1
55#define DEV_0_DMOD (PRO_DMOD << 0x7)
56#define DEV_1_DMOD (DEV_0_DMOD | DEV_1)
57#define CHIP2_I2C_ADDR 0x3a
58
59#define AFE_MEM0 0xfb24
60
61#define MP2_SW_RST 0xf99d
62#define MP2IF2_SW_RST 0xf9a4
63
64#define PADODPU 0xd827
65#define THIRDODPU 0xd828
66#define AGC_O_D 0xd829
67
68#define EP0_TX_EN 0xdd11
69#define EP0_TX_NAK 0xdd13
70#define EP4_TX_LEN_LSB 0xdd88
71#define EP4_TX_LEN_MSB 0xdd89
72#define EP4_MAX_PKT 0xdd0c
73#define EP5_TX_LEN_LSB 0xdd8a
74#define EP5_TX_LEN_MSB 0xdd8b
75#define EP5_MAX_PKT 0xdd0d
76
77#define IO_MUX_POWER_CLK 0xd800
78#define CLK_O_EN 0xd81a
79#define I2C_CLK 0xf103
80#define I2C_CLK_100 0x7
81#define I2C_CLK_400 0x1a
82
83#define D_TPSD_LOCK 0xf5a9
84#define MP2IF2_EN 0xf9a3
85#define MP2IF_SERIAL 0xf985
86#define TSIS_ENABLE 0xf9cd
87#define MP2IF2_HALF_PSB 0xf9a5
88#define MP2IF_STOP_EN 0xf9b5
89#define MPEG_FULL_SPEED 0xf990
90#define TOP_HOSTB_SER_MODE 0xd91c
91
92#define PID_RST 0xf992
93#define PID_EN 0xf993
94#define PID_INX_EN 0xf994
95#define PID_INX 0xf995
96#define PID_LSB 0xf996
97#define PID_MSB 0xf997
98
99#define MP2IF_MPEG_PAR_MODE 0xf986
100#define DCA_UPPER_CHIP 0xf731
101#define DCA_LOWER_CHIP 0xf732
102#define DCA_PLATCH 0xf730
103#define DCA_FPGA_LATCH 0xf778
104#define DCA_STAND_ALONE 0xf73c
105#define DCA_ENABLE 0xf776
106
107#define DVBT_INTEN 0xf41f
108#define DVBT_ENABLE 0xf41a
109#define HOSTB_DCA_LOWER 0xd91f
110#define HOSTB_MPEG_PAR_MODE 0xd91b
111#define HOSTB_MPEG_SER_MODE 0xd91c
112#define HOSTB_MPEG_SER_DO7 0xd91d
113#define HOSTB_DCA_UPPER 0xd91e
114#define PADMISCDR2 0xd830
115#define PADMISCDR4 0xd831
116#define PADMISCDR8 0xd832
117#define PADMISCDRSR 0xd833
118#define LOCK3_OUT 0xd8fd
119
120#define GPIOH1_O 0xd8af
121#define GPIOH1_EN 0xd8b0
122#define GPIOH1_ON 0xd8b1
123#define GPIOH3_O 0xd8b3
124#define GPIOH3_EN 0xd8b4
125#define GPIOH3_ON 0xd8b5
126#define GPIOH5_O 0xd8bb
127#define GPIOH5_EN 0xd8bc
128#define GPIOH5_ON 0xd8bd
129
130#define AFE_MEM0 0xfb24
131
132#define REG_TPSD_TX_MODE 0xf900
133#define REG_TPSD_GI 0xf901
134#define REG_TPSD_HIER 0xf902
135#define REG_TPSD_CONST 0xf903
136#define REG_BW 0xf904
137#define REG_PRIV 0xf905
138#define REG_TPSD_HP_CODE 0xf906
139#define REG_TPSD_LP_CODE 0xf907
140
141#define MP2IF_SYNC_LK 0xf999
142#define ADC_FREQ 0xf1cd
143
144#define TRIGGER_OFSM 0x0000
145/* COEFF Registers start at 0x0001 to 0x0020 */
146#define COEFF_1_2048 0x0001
147#define XTAL_CLK 0x0025
148#define BFS_FCW 0x0029
149#define TPSD_LOCK 0x003c
150#define TRAINING_MODE 0x0040
151#define ADC_X_2 0x0045
152#define TUNER_ID 0x0046
153#define EMPTY_CHANNEL_STATUS 0x0047
154#define SIGNAL_LEVEL 0x0048
155#define SIGNAL_QUALITY 0x0049
156#define EST_SIGNAL_LEVEL 0x004a
157#define FREE_BAND 0x004b
158#define SUSPEND_FLAG 0x004c
Malcolm Priestleyb7d425d392011-10-31 12:02:08 -0300159/* Build in tuner types */
Malcolm Priestley3dbbf822011-07-25 15:35:12 -0300160#define IT9137 0x38
Malcolm Priestleyb7d425d392011-10-31 12:02:08 -0300161#define IT9135_38 0x38
162#define IT9135_51 0x50
163#define IT9135_52 0x52
164#define IT9135_60 0x60
165#define IT9135_61 0x61
166#define IT9135_62 0x62
Malcolm Priestley3dbbf822011-07-25 15:35:12 -0300167
168enum {
169 CMD_DEMOD_READ = 0,
170 CMD_DEMOD_WRITE,
171 CMD_TUNER_READ,
172 CMD_TUNER_WRITE,
173 CMD_REG_EEPROM_READ,
174 CMD_REG_EEPROM_WRITE,
175 CMD_DATA_READ,
176 CMD_VAR_READ = 8,
177 CMD_VAR_WRITE,
178 CMD_PLATFORM_GET,
179 CMD_PLATFORM_SET,
180 CMD_IP_CACHE,
181 CMD_IP_ADD,
182 CMD_IP_REMOVE,
183 CMD_PID_ADD,
184 CMD_PID_REMOVE,
185 CMD_SIPSI_GET,
186 CMD_SIPSI_MPE_RESET,
187 CMD_H_PID_ADD = 0x15,
188 CMD_H_PID_REMOVE,
189 CMD_ABORT,
190 CMD_IR_GET,
191 CMD_IR_SET,
192 CMD_FW_DOWNLOAD = 0x21,
193 CMD_QUERYINFO,
194 CMD_BOOT,
195 CMD_FW_DOWNLOAD_BEGIN,
196 CMD_FW_DOWNLOAD_END,
197 CMD_RUN_CODE,
198 CMD_SCATTER_READ = 0x28,
199 CMD_SCATTER_WRITE,
200 CMD_GENERIC_READ,
201 CMD_GENERIC_WRITE
202};
203
204enum {
205 READ_LONG,
206 WRITE_LONG,
207 READ_SHORT,
208 WRITE_SHORT,
209 READ_DATA,
210 WRITE_DATA,
211 WRITE_CMD,
212};
213
214#endif /* IT913X_FE_H */