xref: /linux/drivers/media/pci/ddbridge/ddbridge-regs.h (revision 4f2c0a4acffbec01079c28f839422e64ddeff004)
1*4771d831SDaniel Scheller /* SPDX-License-Identifier: GPL-2.0 */
225aee3deSMauro Carvalho Chehab /*
325aee3deSMauro Carvalho Chehab  * ddbridge-regs.h: Digital Devices PCIe bridge driver
425aee3deSMauro Carvalho Chehab  *
522e74389SDaniel Scheller  * Copyright (C) 2010-2017 Digital Devices GmbH
625aee3deSMauro Carvalho Chehab  */
725aee3deSMauro Carvalho Chehab 
82dc3e050SDaniel Scheller #ifndef __DDBRIDGE_REGS_H__
92dc3e050SDaniel Scheller #define __DDBRIDGE_REGS_H__
102dc3e050SDaniel Scheller 
1125aee3deSMauro Carvalho Chehab /* ------------------------------------------------------------------------- */
1225aee3deSMauro Carvalho Chehab /* SPI Controller */
1325aee3deSMauro Carvalho Chehab 
1425aee3deSMauro Carvalho Chehab #define SPI_CONTROL     0x10
1525aee3deSMauro Carvalho Chehab #define SPI_DATA        0x14
1625aee3deSMauro Carvalho Chehab 
1725aee3deSMauro Carvalho Chehab /* ------------------------------------------------------------------------- */
1822e74389SDaniel Scheller /* GPIO */
1922e74389SDaniel Scheller 
2022e74389SDaniel Scheller #define GPIO_OUTPUT      0x20
2122e74389SDaniel Scheller #define GPIO_INPUT       0x24
2222e74389SDaniel Scheller #define GPIO_DIRECTION   0x28
2322e74389SDaniel Scheller 
2422e74389SDaniel Scheller /* ------------------------------------------------------------------------- */
2525aee3deSMauro Carvalho Chehab 
261b58a5a4SDaniel Scheller #define BOARD_CONTROL    0x30
271b58a5a4SDaniel Scheller 
281b58a5a4SDaniel Scheller /* ------------------------------------------------------------------------- */
291b58a5a4SDaniel Scheller 
3022e74389SDaniel Scheller /* Interrupt controller
3122e74389SDaniel Scheller  * How many MSI's are available depends on HW (Min 2 max 8)
3222e74389SDaniel Scheller  * How many are usable also depends on Host platform
3322e74389SDaniel Scheller  */
3425aee3deSMauro Carvalho Chehab 
3525aee3deSMauro Carvalho Chehab #define INTERRUPT_BASE   (0x40)
3625aee3deSMauro Carvalho Chehab 
3725aee3deSMauro Carvalho Chehab #define INTERRUPT_ENABLE (INTERRUPT_BASE + 0x00)
3825aee3deSMauro Carvalho Chehab #define MSI1_ENABLE      (INTERRUPT_BASE + 0x04)
3925aee3deSMauro Carvalho Chehab #define MSI2_ENABLE      (INTERRUPT_BASE + 0x08)
4025aee3deSMauro Carvalho Chehab #define MSI3_ENABLE      (INTERRUPT_BASE + 0x0C)
4125aee3deSMauro Carvalho Chehab #define MSI4_ENABLE      (INTERRUPT_BASE + 0x10)
4225aee3deSMauro Carvalho Chehab #define MSI5_ENABLE      (INTERRUPT_BASE + 0x14)
4325aee3deSMauro Carvalho Chehab #define MSI6_ENABLE      (INTERRUPT_BASE + 0x18)
4425aee3deSMauro Carvalho Chehab #define MSI7_ENABLE      (INTERRUPT_BASE + 0x1C)
4525aee3deSMauro Carvalho Chehab 
4625aee3deSMauro Carvalho Chehab #define INTERRUPT_STATUS (INTERRUPT_BASE + 0x20)
4725aee3deSMauro Carvalho Chehab #define INTERRUPT_ACK    (INTERRUPT_BASE + 0x20)
4825aee3deSMauro Carvalho Chehab 
4922e74389SDaniel Scheller /* Temperature Monitor ( 2x LM75A @ 0x90,0x92 I2c ) */
5022e74389SDaniel Scheller #define TEMPMON_BASE			(0x1c0)
5122e74389SDaniel Scheller #define TEMPMON_CONTROL			(TEMPMON_BASE + 0x00)
5225aee3deSMauro Carvalho Chehab 
5322e74389SDaniel Scheller #define TEMPMON_CONTROL_AUTOSCAN	(0x00000002)
5422e74389SDaniel Scheller #define TEMPMON_CONTROL_INTENABLE	(0x00000004)
5522e74389SDaniel Scheller #define TEMPMON_CONTROL_OVERTEMP	(0x00008000)
5625aee3deSMauro Carvalho Chehab 
5722e74389SDaniel Scheller /* SHORT Temperature in Celsius x 256 */
5822e74389SDaniel Scheller #define TEMPMON_SENSOR0			(TEMPMON_BASE + 0x04)
5922e74389SDaniel Scheller #define TEMPMON_SENSOR1			(TEMPMON_BASE + 0x08)
6025aee3deSMauro Carvalho Chehab 
6122e74389SDaniel Scheller #define TEMPMON_FANCONTROL		(TEMPMON_BASE + 0x10)
6225aee3deSMauro Carvalho Chehab 
6325aee3deSMauro Carvalho Chehab /* ------------------------------------------------------------------------- */
6425aee3deSMauro Carvalho Chehab /* I2C Master Controller */
6525aee3deSMauro Carvalho Chehab 
6625aee3deSMauro Carvalho Chehab #define I2C_COMMAND     (0x00)
6725aee3deSMauro Carvalho Chehab #define I2C_TIMING      (0x04)
6825aee3deSMauro Carvalho Chehab #define I2C_TASKLENGTH  (0x08)     /* High read, low write */
6925aee3deSMauro Carvalho Chehab #define I2C_TASKADDRESS (0x0C)     /* High read, low write */
7025aee3deSMauro Carvalho Chehab #define I2C_MONITOR     (0x1C)
7125aee3deSMauro Carvalho Chehab 
7225aee3deSMauro Carvalho Chehab #define I2C_SPEED_400   (0x04030404)
7325aee3deSMauro Carvalho Chehab #define I2C_SPEED_100   (0x13121313)
7425aee3deSMauro Carvalho Chehab 
7525aee3deSMauro Carvalho Chehab /* ------------------------------------------------------------------------- */
7625aee3deSMauro Carvalho Chehab /* DMA  Controller */
7725aee3deSMauro Carvalho Chehab 
7825aee3deSMauro Carvalho Chehab #define DMA_BASE_WRITE        (0x100)
7925aee3deSMauro Carvalho Chehab #define DMA_BASE_READ         (0x140)
8025aee3deSMauro Carvalho Chehab 
81757d78d3SDaniel Scheller #define TS_CONTROL(_io)         ((_io)->regs + 0x00)
82757d78d3SDaniel Scheller #define TS_CONTROL2(_io)        ((_io)->regs + 0x04)
8325aee3deSMauro Carvalho Chehab 
8425aee3deSMauro Carvalho Chehab /* ------------------------------------------------------------------------- */
8525aee3deSMauro Carvalho Chehab /* DMA  Buffer */
8625aee3deSMauro Carvalho Chehab 
87757d78d3SDaniel Scheller #define DMA_BUFFER_CONTROL(_dma)       ((_dma)->regs + 0x00)
88757d78d3SDaniel Scheller #define DMA_BUFFER_ACK(_dma)           ((_dma)->regs + 0x04)
89757d78d3SDaniel Scheller #define DMA_BUFFER_CURRENT(_dma)       ((_dma)->regs + 0x08)
90757d78d3SDaniel Scheller #define DMA_BUFFER_SIZE(_dma)          ((_dma)->regs + 0x0c)
9125aee3deSMauro Carvalho Chehab 
9222e74389SDaniel Scheller /* ------------------------------------------------------------------------- */
9322e74389SDaniel Scheller /* CI Interface (only CI-Bridge) */
9425aee3deSMauro Carvalho Chehab 
9522e74389SDaniel Scheller #define CI_BASE                         (0x400)
9622e74389SDaniel Scheller #define CI_CONTROL(i)                   (CI_BASE + (i) * 32 + 0x00)
9725aee3deSMauro Carvalho Chehab 
9822e74389SDaniel Scheller #define CI_DO_ATTRIBUTE_RW(i)           (CI_BASE + (i) * 32 + 0x04)
9922e74389SDaniel Scheller #define CI_DO_IO_RW(i)                  (CI_BASE + (i) * 32 + 0x08)
10022e74389SDaniel Scheller #define CI_READDATA(i)                  (CI_BASE + (i) * 32 + 0x0c)
10122e74389SDaniel Scheller #define CI_DO_READ_ATTRIBUTES(i)        (CI_BASE + (i) * 32 + 0x10)
10225aee3deSMauro Carvalho Chehab 
10322e74389SDaniel Scheller #define CI_RESET_CAM                    (0x00000001)
10422e74389SDaniel Scheller #define CI_POWER_ON                     (0x00000002)
10522e74389SDaniel Scheller #define CI_ENABLE                       (0x00000004)
10622e74389SDaniel Scheller #define CI_BYPASS_DISABLE               (0x00000010)
10725aee3deSMauro Carvalho Chehab 
10822e74389SDaniel Scheller #define CI_CAM_READY                    (0x00010000)
10922e74389SDaniel Scheller #define CI_CAM_DETECT                   (0x00020000)
11022e74389SDaniel Scheller #define CI_READY                        (0x80000000)
11122e74389SDaniel Scheller 
11222e74389SDaniel Scheller #define CI_READ_CMD                     (0x40000000)
11322e74389SDaniel Scheller #define CI_WRITE_CMD                    (0x80000000)
11422e74389SDaniel Scheller 
11522e74389SDaniel Scheller #define CI_BUFFER_BASE                  (0x3000)
11622e74389SDaniel Scheller #define CI_BUFFER_SIZE                  (0x0800)
11722e74389SDaniel Scheller 
11822e74389SDaniel Scheller #define CI_BUFFER(i)                    (CI_BUFFER_BASE + (i) * CI_BUFFER_SIZE)
119bb4cec96SDaniel Scheller 
120bb4cec96SDaniel Scheller /* ------------------------------------------------------------------------- */
121bb4cec96SDaniel Scheller /* LNB commands (mxl5xx / Max S8) */
122bb4cec96SDaniel Scheller 
123bb4cec96SDaniel Scheller #define LNB_BASE			(0x400)
124bb4cec96SDaniel Scheller #define LNB_CONTROL(i)			(LNB_BASE + (i) * 0x20 + 0x00)
125bb4cec96SDaniel Scheller 
126bb4cec96SDaniel Scheller #define LNB_CMD				(7ULL << 0)
127bb4cec96SDaniel Scheller #define LNB_CMD_NOP			0
128bb4cec96SDaniel Scheller #define LNB_CMD_INIT			1
129bb4cec96SDaniel Scheller #define LNB_CMD_LOW			3
130bb4cec96SDaniel Scheller #define LNB_CMD_HIGH			4
131bb4cec96SDaniel Scheller #define LNB_CMD_OFF			5
132bb4cec96SDaniel Scheller #define LNB_CMD_DISEQC			6
133bb4cec96SDaniel Scheller 
134757d78d3SDaniel Scheller #define LNB_BUSY			BIT_ULL(4)
135757d78d3SDaniel Scheller #define LNB_TONE			BIT_ULL(15)
136bb4cec96SDaniel Scheller 
137bb4cec96SDaniel Scheller #define LNB_BUF_LEVEL(i)		(LNB_BASE + (i) * 0x20 + 0x10)
138bb4cec96SDaniel Scheller #define LNB_BUF_WRITE(i)		(LNB_BASE + (i) * 0x20 + 0x14)
139bb4cec96SDaniel Scheller 
1402dc3e050SDaniel Scheller #endif /* __DDBRIDGE_REGS_H__ */
141