18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * SMI PCIe driver for DVBSky cards. 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright (C) 2014 Max nibble <nibble.max@gmail.com> 68c2ecf20Sopenharmony_ci */ 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci#ifndef _SMI_PCIE_H_ 98c2ecf20Sopenharmony_ci#define _SMI_PCIE_H_ 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci#include <linux/i2c.h> 128c2ecf20Sopenharmony_ci#include <linux/i2c-algo-bit.h> 138c2ecf20Sopenharmony_ci#include <linux/init.h> 148c2ecf20Sopenharmony_ci#include <linux/interrupt.h> 158c2ecf20Sopenharmony_ci#include <linux/kernel.h> 168c2ecf20Sopenharmony_ci#include <linux/module.h> 178c2ecf20Sopenharmony_ci#include <linux/pci.h> 188c2ecf20Sopenharmony_ci#include <linux/dma-mapping.h> 198c2ecf20Sopenharmony_ci#include <linux/slab.h> 208c2ecf20Sopenharmony_ci#include <media/rc-core.h> 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ci#include <media/demux.h> 238c2ecf20Sopenharmony_ci#include <media/dmxdev.h> 248c2ecf20Sopenharmony_ci#include <media/dvb_demux.h> 258c2ecf20Sopenharmony_ci#include <media/dvb_frontend.h> 268c2ecf20Sopenharmony_ci#include <media/dvb_net.h> 278c2ecf20Sopenharmony_ci#include <media/dvbdev.h> 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ci/* -------- Register Base -------- */ 308c2ecf20Sopenharmony_ci#define MSI_CONTROL_REG_BASE 0x0800 318c2ecf20Sopenharmony_ci#define SYSTEM_CONTROL_REG_BASE 0x0880 328c2ecf20Sopenharmony_ci#define PCIE_EP_DEBUG_REG_BASE 0x08C0 338c2ecf20Sopenharmony_ci#define IR_CONTROL_REG_BASE 0x0900 348c2ecf20Sopenharmony_ci#define I2C_A_CONTROL_REG_BASE 0x0940 358c2ecf20Sopenharmony_ci#define I2C_B_CONTROL_REG_BASE 0x0980 368c2ecf20Sopenharmony_ci#define ATV_PORTA_CONTROL_REG_BASE 0x09C0 378c2ecf20Sopenharmony_ci#define DTV_PORTA_CONTROL_REG_BASE 0x0A00 388c2ecf20Sopenharmony_ci#define AES_PORTA_CONTROL_REG_BASE 0x0A80 398c2ecf20Sopenharmony_ci#define DMA_PORTA_CONTROL_REG_BASE 0x0AC0 408c2ecf20Sopenharmony_ci#define ATV_PORTB_CONTROL_REG_BASE 0x0B00 418c2ecf20Sopenharmony_ci#define DTV_PORTB_CONTROL_REG_BASE 0x0B40 428c2ecf20Sopenharmony_ci#define AES_PORTB_CONTROL_REG_BASE 0x0BC0 438c2ecf20Sopenharmony_ci#define DMA_PORTB_CONTROL_REG_BASE 0x0C00 448c2ecf20Sopenharmony_ci#define UART_A_REGISTER_BASE 0x0C40 458c2ecf20Sopenharmony_ci#define UART_B_REGISTER_BASE 0x0C80 468c2ecf20Sopenharmony_ci#define GPS_CONTROL_REG_BASE 0x0CC0 478c2ecf20Sopenharmony_ci#define DMA_PORTC_CONTROL_REG_BASE 0x0D00 488c2ecf20Sopenharmony_ci#define DMA_PORTD_CONTROL_REG_BASE 0x0D00 498c2ecf20Sopenharmony_ci#define AES_RANDOM_DATA_BASE 0x0D80 508c2ecf20Sopenharmony_ci#define AES_KEY_IN_BASE 0x0D90 518c2ecf20Sopenharmony_ci#define RANDOM_DATA_LIB_BASE 0x0E00 528c2ecf20Sopenharmony_ci#define IR_DATA_BUFFER_BASE 0x0F00 538c2ecf20Sopenharmony_ci#define PORTA_TS_BUFFER_BASE 0x1000 548c2ecf20Sopenharmony_ci#define PORTA_I2S_BUFFER_BASE 0x1400 558c2ecf20Sopenharmony_ci#define PORTB_TS_BUFFER_BASE 0x1800 568c2ecf20Sopenharmony_ci#define PORTB_I2S_BUFFER_BASE 0x1C00 578c2ecf20Sopenharmony_ci 588c2ecf20Sopenharmony_ci/* -------- MSI control and state register -------- */ 598c2ecf20Sopenharmony_ci#define MSI_DELAY_TIMER (MSI_CONTROL_REG_BASE + 0x00) 608c2ecf20Sopenharmony_ci#define MSI_INT_STATUS (MSI_CONTROL_REG_BASE + 0x08) 618c2ecf20Sopenharmony_ci#define MSI_INT_STATUS_CLR (MSI_CONTROL_REG_BASE + 0x0C) 628c2ecf20Sopenharmony_ci#define MSI_INT_STATUS_SET (MSI_CONTROL_REG_BASE + 0x10) 638c2ecf20Sopenharmony_ci#define MSI_INT_ENA (MSI_CONTROL_REG_BASE + 0x14) 648c2ecf20Sopenharmony_ci#define MSI_INT_ENA_CLR (MSI_CONTROL_REG_BASE + 0x18) 658c2ecf20Sopenharmony_ci#define MSI_INT_ENA_SET (MSI_CONTROL_REG_BASE + 0x1C) 668c2ecf20Sopenharmony_ci#define MSI_SOFT_RESET (MSI_CONTROL_REG_BASE + 0x20) 678c2ecf20Sopenharmony_ci#define MSI_CFG_SRC0 (MSI_CONTROL_REG_BASE + 0x24) 688c2ecf20Sopenharmony_ci 698c2ecf20Sopenharmony_ci/* -------- Hybird Controller System Control register -------- */ 708c2ecf20Sopenharmony_ci#define MUX_MODE_CTRL (SYSTEM_CONTROL_REG_BASE + 0x00) 718c2ecf20Sopenharmony_ci #define rbPaMSMask 0x07 728c2ecf20Sopenharmony_ci #define rbPaMSDtvNoGpio 0x00 /*[2:0], DTV Simple mode */ 738c2ecf20Sopenharmony_ci #define rbPaMSDtv4bitGpio 0x01 /*[2:0], DTV TS2 Serial mode)*/ 748c2ecf20Sopenharmony_ci #define rbPaMSDtv7bitGpio 0x02 /*[2:0], DTV TS0 Serial mode*/ 758c2ecf20Sopenharmony_ci #define rbPaMS8bitGpio 0x03 /*[2:0], GPIO mode selected;(8bit GPIO)*/ 768c2ecf20Sopenharmony_ci #define rbPaMSAtv 0x04 /*[2:0], 3'b1xx: ATV mode select*/ 778c2ecf20Sopenharmony_ci #define rbPbMSMask 0x38 788c2ecf20Sopenharmony_ci #define rbPbMSDtvNoGpio 0x00 /*[5:3], DTV Simple mode */ 798c2ecf20Sopenharmony_ci #define rbPbMSDtv4bitGpio 0x08 /*[5:3], DTV TS2 Serial mode*/ 808c2ecf20Sopenharmony_ci #define rbPbMSDtv7bitGpio 0x10 /*[5:3], DTV TS0 Serial mode*/ 818c2ecf20Sopenharmony_ci #define rbPbMS8bitGpio 0x18 /*[5:3], GPIO mode selected;(8bit GPIO)*/ 828c2ecf20Sopenharmony_ci #define rbPbMSAtv 0x20 /*[5:3], 3'b1xx: ATV mode select*/ 838c2ecf20Sopenharmony_ci #define rbPaAESEN 0x40 /*[6], port A AES enable bit*/ 848c2ecf20Sopenharmony_ci #define rbPbAESEN 0x80 /*[7], port B AES enable bit*/ 858c2ecf20Sopenharmony_ci 868c2ecf20Sopenharmony_ci#define INTERNAL_RST (SYSTEM_CONTROL_REG_BASE + 0x04) 878c2ecf20Sopenharmony_ci#define PERIPHERAL_CTRL (SYSTEM_CONTROL_REG_BASE + 0x08) 888c2ecf20Sopenharmony_ci#define GPIO_0to7_CTRL (SYSTEM_CONTROL_REG_BASE + 0x0C) 898c2ecf20Sopenharmony_ci#define GPIO_8to15_CTRL (SYSTEM_CONTROL_REG_BASE + 0x10) 908c2ecf20Sopenharmony_ci#define GPIO_16to24_CTRL (SYSTEM_CONTROL_REG_BASE + 0x14) 918c2ecf20Sopenharmony_ci#define GPIO_INT_SRC_CFG (SYSTEM_CONTROL_REG_BASE + 0x18) 928c2ecf20Sopenharmony_ci#define SYS_BUF_STATUS (SYSTEM_CONTROL_REG_BASE + 0x1C) 938c2ecf20Sopenharmony_ci#define PCIE_IP_REG_ACS (SYSTEM_CONTROL_REG_BASE + 0x20) 948c2ecf20Sopenharmony_ci#define PCIE_IP_REG_ACS_ADDR (SYSTEM_CONTROL_REG_BASE + 0x24) 958c2ecf20Sopenharmony_ci#define PCIE_IP_REG_ACS_DATA (SYSTEM_CONTROL_REG_BASE + 0x28) 968c2ecf20Sopenharmony_ci 978c2ecf20Sopenharmony_ci/* -------- IR Control register -------- */ 988c2ecf20Sopenharmony_ci#define IR_Init_Reg (IR_CONTROL_REG_BASE + 0x00) 998c2ecf20Sopenharmony_ci#define IR_Idle_Cnt_Low (IR_CONTROL_REG_BASE + 0x04) 1008c2ecf20Sopenharmony_ci#define IR_Idle_Cnt_High (IR_CONTROL_REG_BASE + 0x05) 1018c2ecf20Sopenharmony_ci#define IR_Unit_Cnt_Low (IR_CONTROL_REG_BASE + 0x06) 1028c2ecf20Sopenharmony_ci#define IR_Unit_Cnt_High (IR_CONTROL_REG_BASE + 0x07) 1038c2ecf20Sopenharmony_ci#define IR_Data_Cnt (IR_CONTROL_REG_BASE + 0x08) 1048c2ecf20Sopenharmony_ci#define rbIRen 0x80 1058c2ecf20Sopenharmony_ci#define rbIRhighidle 0x10 1068c2ecf20Sopenharmony_ci#define rbIRlowidle 0x00 1078c2ecf20Sopenharmony_ci#define rbIRVld 0x04 1088c2ecf20Sopenharmony_ci 1098c2ecf20Sopenharmony_ci/* -------- I2C A control and state register -------- */ 1108c2ecf20Sopenharmony_ci#define I2C_A_CTL_STATUS (I2C_A_CONTROL_REG_BASE + 0x00) 1118c2ecf20Sopenharmony_ci#define I2C_A_ADDR (I2C_A_CONTROL_REG_BASE + 0x04) 1128c2ecf20Sopenharmony_ci#define I2C_A_SW_CTL (I2C_A_CONTROL_REG_BASE + 0x08) 1138c2ecf20Sopenharmony_ci#define I2C_A_TIME_OUT_CNT (I2C_A_CONTROL_REG_BASE + 0x0C) 1148c2ecf20Sopenharmony_ci#define I2C_A_FIFO_STATUS (I2C_A_CONTROL_REG_BASE + 0x10) 1158c2ecf20Sopenharmony_ci#define I2C_A_FS_EN (I2C_A_CONTROL_REG_BASE + 0x14) 1168c2ecf20Sopenharmony_ci#define I2C_A_FIFO_DATA (I2C_A_CONTROL_REG_BASE + 0x20) 1178c2ecf20Sopenharmony_ci 1188c2ecf20Sopenharmony_ci/* -------- I2C B control and state register -------- */ 1198c2ecf20Sopenharmony_ci#define I2C_B_CTL_STATUS (I2C_B_CONTROL_REG_BASE + 0x00) 1208c2ecf20Sopenharmony_ci#define I2C_B_ADDR (I2C_B_CONTROL_REG_BASE + 0x04) 1218c2ecf20Sopenharmony_ci#define I2C_B_SW_CTL (I2C_B_CONTROL_REG_BASE + 0x08) 1228c2ecf20Sopenharmony_ci#define I2C_B_TIME_OUT_CNT (I2C_B_CONTROL_REG_BASE + 0x0C) 1238c2ecf20Sopenharmony_ci#define I2C_B_FIFO_STATUS (I2C_B_CONTROL_REG_BASE + 0x10) 1248c2ecf20Sopenharmony_ci#define I2C_B_FS_EN (I2C_B_CONTROL_REG_BASE + 0x14) 1258c2ecf20Sopenharmony_ci#define I2C_B_FIFO_DATA (I2C_B_CONTROL_REG_BASE + 0x20) 1268c2ecf20Sopenharmony_ci 1278c2ecf20Sopenharmony_ci#define VIDEO_CTRL_STATUS_A (ATV_PORTA_CONTROL_REG_BASE + 0x04) 1288c2ecf20Sopenharmony_ci 1298c2ecf20Sopenharmony_ci/* -------- Digital TV control register, Port A -------- */ 1308c2ecf20Sopenharmony_ci#define MPEG2_CTRL_A (DTV_PORTA_CONTROL_REG_BASE + 0x00) 1318c2ecf20Sopenharmony_ci#define SERIAL_IN_ADDR_A (DTV_PORTA_CONTROL_REG_BASE + 0x4C) 1328c2ecf20Sopenharmony_ci#define VLD_CNT_ADDR_A (DTV_PORTA_CONTROL_REG_BASE + 0x60) 1338c2ecf20Sopenharmony_ci#define ERR_CNT_ADDR_A (DTV_PORTA_CONTROL_REG_BASE + 0x64) 1348c2ecf20Sopenharmony_ci#define BRD_CNT_ADDR_A (DTV_PORTA_CONTROL_REG_BASE + 0x68) 1358c2ecf20Sopenharmony_ci 1368c2ecf20Sopenharmony_ci/* -------- DMA Control Register, Port A -------- */ 1378c2ecf20Sopenharmony_ci#define DMA_PORTA_CHAN0_ADDR_LOW (DMA_PORTA_CONTROL_REG_BASE + 0x00) 1388c2ecf20Sopenharmony_ci#define DMA_PORTA_CHAN0_ADDR_HI (DMA_PORTA_CONTROL_REG_BASE + 0x04) 1398c2ecf20Sopenharmony_ci#define DMA_PORTA_CHAN0_TRANS_STATE (DMA_PORTA_CONTROL_REG_BASE + 0x08) 1408c2ecf20Sopenharmony_ci#define DMA_PORTA_CHAN0_CONTROL (DMA_PORTA_CONTROL_REG_BASE + 0x0C) 1418c2ecf20Sopenharmony_ci#define DMA_PORTA_CHAN1_ADDR_LOW (DMA_PORTA_CONTROL_REG_BASE + 0x10) 1428c2ecf20Sopenharmony_ci#define DMA_PORTA_CHAN1_ADDR_HI (DMA_PORTA_CONTROL_REG_BASE + 0x14) 1438c2ecf20Sopenharmony_ci#define DMA_PORTA_CHAN1_TRANS_STATE (DMA_PORTA_CONTROL_REG_BASE + 0x18) 1448c2ecf20Sopenharmony_ci#define DMA_PORTA_CHAN1_CONTROL (DMA_PORTA_CONTROL_REG_BASE + 0x1C) 1458c2ecf20Sopenharmony_ci#define DMA_PORTA_MANAGEMENT (DMA_PORTA_CONTROL_REG_BASE + 0x20) 1468c2ecf20Sopenharmony_ci#define VIDEO_CTRL_STATUS_B (ATV_PORTB_CONTROL_REG_BASE + 0x04) 1478c2ecf20Sopenharmony_ci 1488c2ecf20Sopenharmony_ci/* -------- Digital TV control register, Port B -------- */ 1498c2ecf20Sopenharmony_ci#define MPEG2_CTRL_B (DTV_PORTB_CONTROL_REG_BASE + 0x00) 1508c2ecf20Sopenharmony_ci#define SERIAL_IN_ADDR_B (DTV_PORTB_CONTROL_REG_BASE + 0x4C) 1518c2ecf20Sopenharmony_ci#define VLD_CNT_ADDR_B (DTV_PORTB_CONTROL_REG_BASE + 0x60) 1528c2ecf20Sopenharmony_ci#define ERR_CNT_ADDR_B (DTV_PORTB_CONTROL_REG_BASE + 0x64) 1538c2ecf20Sopenharmony_ci#define BRD_CNT_ADDR_B (DTV_PORTB_CONTROL_REG_BASE + 0x68) 1548c2ecf20Sopenharmony_ci 1558c2ecf20Sopenharmony_ci/* -------- AES control register, Port B -------- */ 1568c2ecf20Sopenharmony_ci#define AES_CTRL_B (AES_PORTB_CONTROL_REG_BASE + 0x00) 1578c2ecf20Sopenharmony_ci#define AES_KEY_BASE_B (AES_PORTB_CONTROL_REG_BASE + 0x04) 1588c2ecf20Sopenharmony_ci 1598c2ecf20Sopenharmony_ci/* -------- DMA Control Register, Port B -------- */ 1608c2ecf20Sopenharmony_ci#define DMA_PORTB_CHAN0_ADDR_LOW (DMA_PORTB_CONTROL_REG_BASE + 0x00) 1618c2ecf20Sopenharmony_ci#define DMA_PORTB_CHAN0_ADDR_HI (DMA_PORTB_CONTROL_REG_BASE + 0x04) 1628c2ecf20Sopenharmony_ci#define DMA_PORTB_CHAN0_TRANS_STATE (DMA_PORTB_CONTROL_REG_BASE + 0x08) 1638c2ecf20Sopenharmony_ci#define DMA_PORTB_CHAN0_CONTROL (DMA_PORTB_CONTROL_REG_BASE + 0x0C) 1648c2ecf20Sopenharmony_ci#define DMA_PORTB_CHAN1_ADDR_LOW (DMA_PORTB_CONTROL_REG_BASE + 0x10) 1658c2ecf20Sopenharmony_ci#define DMA_PORTB_CHAN1_ADDR_HI (DMA_PORTB_CONTROL_REG_BASE + 0x14) 1668c2ecf20Sopenharmony_ci#define DMA_PORTB_CHAN1_TRANS_STATE (DMA_PORTB_CONTROL_REG_BASE + 0x18) 1678c2ecf20Sopenharmony_ci#define DMA_PORTB_CHAN1_CONTROL (DMA_PORTB_CONTROL_REG_BASE + 0x1C) 1688c2ecf20Sopenharmony_ci#define DMA_PORTB_MANAGEMENT (DMA_PORTB_CONTROL_REG_BASE + 0x20) 1698c2ecf20Sopenharmony_ci 1708c2ecf20Sopenharmony_ci#define DMA_TRANS_UNIT_188 (0x00000007) 1718c2ecf20Sopenharmony_ci 1728c2ecf20Sopenharmony_ci/* -------- Macro define of 24 interrupt resource --------*/ 1738c2ecf20Sopenharmony_ci#define DMA_A_CHAN0_DONE_INT (0x00000001) 1748c2ecf20Sopenharmony_ci#define DMA_A_CHAN1_DONE_INT (0x00000002) 1758c2ecf20Sopenharmony_ci#define DMA_B_CHAN0_DONE_INT (0x00000004) 1768c2ecf20Sopenharmony_ci#define DMA_B_CHAN1_DONE_INT (0x00000008) 1778c2ecf20Sopenharmony_ci#define DMA_C_CHAN0_DONE_INT (0x00000010) 1788c2ecf20Sopenharmony_ci#define DMA_C_CHAN1_DONE_INT (0x00000020) 1798c2ecf20Sopenharmony_ci#define DMA_D_CHAN0_DONE_INT (0x00000040) 1808c2ecf20Sopenharmony_ci#define DMA_D_CHAN1_DONE_INT (0x00000080) 1818c2ecf20Sopenharmony_ci#define DATA_BUF_OVERFLOW_INT (0x00000100) 1828c2ecf20Sopenharmony_ci#define UART_0_X_INT (0x00000200) 1838c2ecf20Sopenharmony_ci#define UART_1_X_INT (0x00000400) 1848c2ecf20Sopenharmony_ci#define IR_X_INT (0x00000800) 1858c2ecf20Sopenharmony_ci#define GPIO_0_INT (0x00001000) 1868c2ecf20Sopenharmony_ci#define GPIO_1_INT (0x00002000) 1878c2ecf20Sopenharmony_ci#define GPIO_2_INT (0x00004000) 1888c2ecf20Sopenharmony_ci#define GPIO_3_INT (0x00008000) 1898c2ecf20Sopenharmony_ci#define ALL_INT (0x0000FFFF) 1908c2ecf20Sopenharmony_ci 1918c2ecf20Sopenharmony_ci/* software I2C bit mask */ 1928c2ecf20Sopenharmony_ci#define SW_I2C_MSK_MODE 0x01 1938c2ecf20Sopenharmony_ci#define SW_I2C_MSK_CLK_OUT 0x02 1948c2ecf20Sopenharmony_ci#define SW_I2C_MSK_DAT_OUT 0x04 1958c2ecf20Sopenharmony_ci#define SW_I2C_MSK_CLK_EN 0x08 1968c2ecf20Sopenharmony_ci#define SW_I2C_MSK_DAT_EN 0x10 1978c2ecf20Sopenharmony_ci#define SW_I2C_MSK_DAT_IN 0x40 1988c2ecf20Sopenharmony_ci#define SW_I2C_MSK_CLK_IN 0x80 1998c2ecf20Sopenharmony_ci 2008c2ecf20Sopenharmony_ci#define SMI_VID 0x1ADE 2018c2ecf20Sopenharmony_ci#define SMI_PID 0x3038 2028c2ecf20Sopenharmony_ci#define SMI_TS_DMA_BUF_SIZE (1024 * 188) 2038c2ecf20Sopenharmony_ci 2048c2ecf20Sopenharmony_cistruct smi_cfg_info { 2058c2ecf20Sopenharmony_ci#define SMI_DVBSKY_S952 0 2068c2ecf20Sopenharmony_ci#define SMI_DVBSKY_S950 1 2078c2ecf20Sopenharmony_ci#define SMI_DVBSKY_T9580 2 2088c2ecf20Sopenharmony_ci#define SMI_DVBSKY_T982 3 2098c2ecf20Sopenharmony_ci#define SMI_TECHNOTREND_S2_4200 4 2108c2ecf20Sopenharmony_ci int type; 2118c2ecf20Sopenharmony_ci char *name; 2128c2ecf20Sopenharmony_ci#define SMI_TS_NULL 0 2138c2ecf20Sopenharmony_ci#define SMI_TS_DMA_SINGLE 1 2148c2ecf20Sopenharmony_ci#define SMI_TS_DMA_BOTH 3 2158c2ecf20Sopenharmony_ci/* SMI_TS_NULL: not use; 2168c2ecf20Sopenharmony_ci * SMI_TS_DMA_SINGLE: use DMA 0 only; 2178c2ecf20Sopenharmony_ci * SMI_TS_DMA_BOTH:use DMA 0 and 1.*/ 2188c2ecf20Sopenharmony_ci int ts_0; 2198c2ecf20Sopenharmony_ci int ts_1; 2208c2ecf20Sopenharmony_ci#define DVBSKY_FE_NULL 0 2218c2ecf20Sopenharmony_ci#define DVBSKY_FE_M88RS6000 1 2228c2ecf20Sopenharmony_ci#define DVBSKY_FE_M88DS3103 2 2238c2ecf20Sopenharmony_ci#define DVBSKY_FE_SIT2 3 2248c2ecf20Sopenharmony_ci int fe_0; 2258c2ecf20Sopenharmony_ci int fe_1; 2268c2ecf20Sopenharmony_ci char *rc_map; 2278c2ecf20Sopenharmony_ci}; 2288c2ecf20Sopenharmony_ci 2298c2ecf20Sopenharmony_cistruct smi_rc { 2308c2ecf20Sopenharmony_ci struct smi_dev *dev; 2318c2ecf20Sopenharmony_ci struct rc_dev *rc_dev; 2328c2ecf20Sopenharmony_ci char input_phys[64]; 2338c2ecf20Sopenharmony_ci char device_name[64]; 2348c2ecf20Sopenharmony_ci u8 irData[256]; 2358c2ecf20Sopenharmony_ci 2368c2ecf20Sopenharmony_ci int users; 2378c2ecf20Sopenharmony_ci}; 2388c2ecf20Sopenharmony_ci 2398c2ecf20Sopenharmony_cistruct smi_port { 2408c2ecf20Sopenharmony_ci struct smi_dev *dev; 2418c2ecf20Sopenharmony_ci int idx; 2428c2ecf20Sopenharmony_ci int enable; 2438c2ecf20Sopenharmony_ci int fe_type; 2448c2ecf20Sopenharmony_ci /* regs */ 2458c2ecf20Sopenharmony_ci u32 DMA_CHAN0_ADDR_LOW; 2468c2ecf20Sopenharmony_ci u32 DMA_CHAN0_ADDR_HI; 2478c2ecf20Sopenharmony_ci u32 DMA_CHAN0_TRANS_STATE; 2488c2ecf20Sopenharmony_ci u32 DMA_CHAN0_CONTROL; 2498c2ecf20Sopenharmony_ci u32 DMA_CHAN1_ADDR_LOW; 2508c2ecf20Sopenharmony_ci u32 DMA_CHAN1_ADDR_HI; 2518c2ecf20Sopenharmony_ci u32 DMA_CHAN1_TRANS_STATE; 2528c2ecf20Sopenharmony_ci u32 DMA_CHAN1_CONTROL; 2538c2ecf20Sopenharmony_ci u32 DMA_MANAGEMENT; 2548c2ecf20Sopenharmony_ci /* dma */ 2558c2ecf20Sopenharmony_ci dma_addr_t dma_addr[2]; 2568c2ecf20Sopenharmony_ci u8 *cpu_addr[2]; 2578c2ecf20Sopenharmony_ci u32 _dmaInterruptCH0; 2588c2ecf20Sopenharmony_ci u32 _dmaInterruptCH1; 2598c2ecf20Sopenharmony_ci u32 _int_status; 2608c2ecf20Sopenharmony_ci struct tasklet_struct tasklet; 2618c2ecf20Sopenharmony_ci /* dvb */ 2628c2ecf20Sopenharmony_ci struct dmx_frontend hw_frontend; 2638c2ecf20Sopenharmony_ci struct dmx_frontend mem_frontend; 2648c2ecf20Sopenharmony_ci struct dmxdev dmxdev; 2658c2ecf20Sopenharmony_ci struct dvb_adapter dvb_adapter; 2668c2ecf20Sopenharmony_ci struct dvb_demux demux; 2678c2ecf20Sopenharmony_ci struct dvb_net dvbnet; 2688c2ecf20Sopenharmony_ci int users; 2698c2ecf20Sopenharmony_ci struct dvb_frontend *fe; 2708c2ecf20Sopenharmony_ci /* frontend i2c module */ 2718c2ecf20Sopenharmony_ci struct i2c_client *i2c_client_demod; 2728c2ecf20Sopenharmony_ci struct i2c_client *i2c_client_tuner; 2738c2ecf20Sopenharmony_ci}; 2748c2ecf20Sopenharmony_ci 2758c2ecf20Sopenharmony_cistruct smi_dev { 2768c2ecf20Sopenharmony_ci int nr; 2778c2ecf20Sopenharmony_ci struct smi_cfg_info *info; 2788c2ecf20Sopenharmony_ci 2798c2ecf20Sopenharmony_ci /* pcie */ 2808c2ecf20Sopenharmony_ci struct pci_dev *pci_dev; 2818c2ecf20Sopenharmony_ci u32 __iomem *lmmio; 2828c2ecf20Sopenharmony_ci 2838c2ecf20Sopenharmony_ci /* ts port */ 2848c2ecf20Sopenharmony_ci struct smi_port ts_port[2]; 2858c2ecf20Sopenharmony_ci 2868c2ecf20Sopenharmony_ci /* i2c */ 2878c2ecf20Sopenharmony_ci struct i2c_adapter i2c_bus[2]; 2888c2ecf20Sopenharmony_ci struct i2c_algo_bit_data i2c_bit[2]; 2898c2ecf20Sopenharmony_ci 2908c2ecf20Sopenharmony_ci /* ir */ 2918c2ecf20Sopenharmony_ci struct smi_rc ir; 2928c2ecf20Sopenharmony_ci}; 2938c2ecf20Sopenharmony_ci 2948c2ecf20Sopenharmony_ci#define smi_read(reg) readl(dev->lmmio + ((reg)>>2)) 2958c2ecf20Sopenharmony_ci#define smi_write(reg, value) writel((value), dev->lmmio + ((reg)>>2)) 2968c2ecf20Sopenharmony_ci 2978c2ecf20Sopenharmony_ci#define smi_andor(reg, mask, value) \ 2988c2ecf20Sopenharmony_ci writel((readl(dev->lmmio+((reg)>>2)) & ~(mask)) |\ 2998c2ecf20Sopenharmony_ci ((value) & (mask)), dev->lmmio+((reg)>>2)) 3008c2ecf20Sopenharmony_ci 3018c2ecf20Sopenharmony_ci#define smi_set(reg, bit) smi_andor((reg), (bit), (bit)) 3028c2ecf20Sopenharmony_ci#define smi_clear(reg, bit) smi_andor((reg), (bit), 0) 3038c2ecf20Sopenharmony_ci 3048c2ecf20Sopenharmony_ciint smi_ir_irq(struct smi_rc *ir, u32 int_status); 3058c2ecf20Sopenharmony_civoid smi_ir_start(struct smi_rc *ir); 3068c2ecf20Sopenharmony_civoid smi_ir_exit(struct smi_dev *dev); 3078c2ecf20Sopenharmony_ciint smi_ir_init(struct smi_dev *dev); 3088c2ecf20Sopenharmony_ci 3098c2ecf20Sopenharmony_ci#endif /* #ifndef _SMI_PCIE_H_ */ 310