xref: /linux/drivers/media/pci/ddbridge/ddbridge-regs.h (revision 4771d831e2f9a6f580fc0873102c0364e9349947)
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  * This program is free software; you can redistribute it and/or
825aee3deSMauro Carvalho Chehab  * modify it under the terms of the GNU General Public License
925aee3deSMauro Carvalho Chehab  * version 2 only, as published by the Free Software Foundation.
1025aee3deSMauro Carvalho Chehab  *
1125aee3deSMauro Carvalho Chehab  *
1225aee3deSMauro Carvalho Chehab  * This program is distributed in the hope that it will be useful,
1325aee3deSMauro Carvalho Chehab  * but WITHOUT ANY WARRANTY; without even the implied warranty of
1425aee3deSMauro Carvalho Chehab  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1525aee3deSMauro Carvalho Chehab  * GNU General Public License for more details.
1625aee3deSMauro Carvalho Chehab  *
17bcb63314SSakari Ailus  * To obtain the license, point your browser to
18bcb63314SSakari Ailus  * http://www.gnu.org/copyleft/gpl.html
1925aee3deSMauro Carvalho Chehab  */
2025aee3deSMauro Carvalho Chehab 
212dc3e050SDaniel Scheller #ifndef __DDBRIDGE_REGS_H__
222dc3e050SDaniel Scheller #define __DDBRIDGE_REGS_H__
232dc3e050SDaniel Scheller 
2425aee3deSMauro Carvalho Chehab /* ------------------------------------------------------------------------- */
2525aee3deSMauro Carvalho Chehab /* SPI Controller */
2625aee3deSMauro Carvalho Chehab 
2725aee3deSMauro Carvalho Chehab #define SPI_CONTROL     0x10
2825aee3deSMauro Carvalho Chehab #define SPI_DATA        0x14
2925aee3deSMauro Carvalho Chehab 
3025aee3deSMauro Carvalho Chehab /* ------------------------------------------------------------------------- */
3122e74389SDaniel Scheller /* GPIO */
3222e74389SDaniel Scheller 
3322e74389SDaniel Scheller #define GPIO_OUTPUT      0x20
3422e74389SDaniel Scheller #define GPIO_INPUT       0x24
3522e74389SDaniel Scheller #define GPIO_DIRECTION   0x28
3622e74389SDaniel Scheller 
3722e74389SDaniel Scheller /* ------------------------------------------------------------------------- */
3825aee3deSMauro Carvalho Chehab 
391b58a5a4SDaniel Scheller #define BOARD_CONTROL    0x30
401b58a5a4SDaniel Scheller 
411b58a5a4SDaniel Scheller /* ------------------------------------------------------------------------- */
421b58a5a4SDaniel Scheller 
4322e74389SDaniel Scheller /* Interrupt controller
4422e74389SDaniel Scheller  * How many MSI's are available depends on HW (Min 2 max 8)
4522e74389SDaniel Scheller  * How many are usable also depends on Host platform
4622e74389SDaniel Scheller  */
4725aee3deSMauro Carvalho Chehab 
4825aee3deSMauro Carvalho Chehab #define INTERRUPT_BASE   (0x40)
4925aee3deSMauro Carvalho Chehab 
5025aee3deSMauro Carvalho Chehab #define INTERRUPT_ENABLE (INTERRUPT_BASE + 0x00)
5125aee3deSMauro Carvalho Chehab #define MSI1_ENABLE      (INTERRUPT_BASE + 0x04)
5225aee3deSMauro Carvalho Chehab #define MSI2_ENABLE      (INTERRUPT_BASE + 0x08)
5325aee3deSMauro Carvalho Chehab #define MSI3_ENABLE      (INTERRUPT_BASE + 0x0C)
5425aee3deSMauro Carvalho Chehab #define MSI4_ENABLE      (INTERRUPT_BASE + 0x10)
5525aee3deSMauro Carvalho Chehab #define MSI5_ENABLE      (INTERRUPT_BASE + 0x14)
5625aee3deSMauro Carvalho Chehab #define MSI6_ENABLE      (INTERRUPT_BASE + 0x18)
5725aee3deSMauro Carvalho Chehab #define MSI7_ENABLE      (INTERRUPT_BASE + 0x1C)
5825aee3deSMauro Carvalho Chehab 
5925aee3deSMauro Carvalho Chehab #define INTERRUPT_STATUS (INTERRUPT_BASE + 0x20)
6025aee3deSMauro Carvalho Chehab #define INTERRUPT_ACK    (INTERRUPT_BASE + 0x20)
6125aee3deSMauro Carvalho Chehab 
6222e74389SDaniel Scheller /* Temperature Monitor ( 2x LM75A @ 0x90,0x92 I2c ) */
6322e74389SDaniel Scheller #define TEMPMON_BASE			(0x1c0)
6422e74389SDaniel Scheller #define TEMPMON_CONTROL			(TEMPMON_BASE + 0x00)
6525aee3deSMauro Carvalho Chehab 
6622e74389SDaniel Scheller #define TEMPMON_CONTROL_AUTOSCAN	(0x00000002)
6722e74389SDaniel Scheller #define TEMPMON_CONTROL_INTENABLE	(0x00000004)
6822e74389SDaniel Scheller #define TEMPMON_CONTROL_OVERTEMP	(0x00008000)
6925aee3deSMauro Carvalho Chehab 
7022e74389SDaniel Scheller /* SHORT Temperature in Celsius x 256 */
7122e74389SDaniel Scheller #define TEMPMON_SENSOR0			(TEMPMON_BASE + 0x04)
7222e74389SDaniel Scheller #define TEMPMON_SENSOR1			(TEMPMON_BASE + 0x08)
7325aee3deSMauro Carvalho Chehab 
7422e74389SDaniel Scheller #define TEMPMON_FANCONTROL		(TEMPMON_BASE + 0x10)
7525aee3deSMauro Carvalho Chehab 
7625aee3deSMauro Carvalho Chehab /* ------------------------------------------------------------------------- */
7725aee3deSMauro Carvalho Chehab /* I2C Master Controller */
7825aee3deSMauro Carvalho Chehab 
7925aee3deSMauro Carvalho Chehab #define I2C_COMMAND     (0x00)
8025aee3deSMauro Carvalho Chehab #define I2C_TIMING      (0x04)
8125aee3deSMauro Carvalho Chehab #define I2C_TASKLENGTH  (0x08)     /* High read, low write */
8225aee3deSMauro Carvalho Chehab #define I2C_TASKADDRESS (0x0C)     /* High read, low write */
8325aee3deSMauro Carvalho Chehab #define I2C_MONITOR     (0x1C)
8425aee3deSMauro Carvalho Chehab 
8525aee3deSMauro Carvalho Chehab #define I2C_SPEED_400   (0x04030404)
8625aee3deSMauro Carvalho Chehab #define I2C_SPEED_100   (0x13121313)
8725aee3deSMauro Carvalho Chehab 
8825aee3deSMauro Carvalho Chehab /* ------------------------------------------------------------------------- */
8925aee3deSMauro Carvalho Chehab /* DMA  Controller */
9025aee3deSMauro Carvalho Chehab 
9125aee3deSMauro Carvalho Chehab #define DMA_BASE_WRITE        (0x100)
9225aee3deSMauro Carvalho Chehab #define DMA_BASE_READ         (0x140)
9325aee3deSMauro Carvalho Chehab 
94757d78d3SDaniel Scheller #define TS_CONTROL(_io)         ((_io)->regs + 0x00)
95757d78d3SDaniel Scheller #define TS_CONTROL2(_io)        ((_io)->regs + 0x04)
9625aee3deSMauro Carvalho Chehab 
9725aee3deSMauro Carvalho Chehab /* ------------------------------------------------------------------------- */
9825aee3deSMauro Carvalho Chehab /* DMA  Buffer */
9925aee3deSMauro Carvalho Chehab 
100757d78d3SDaniel Scheller #define DMA_BUFFER_CONTROL(_dma)       ((_dma)->regs + 0x00)
101757d78d3SDaniel Scheller #define DMA_BUFFER_ACK(_dma)           ((_dma)->regs + 0x04)
102757d78d3SDaniel Scheller #define DMA_BUFFER_CURRENT(_dma)       ((_dma)->regs + 0x08)
103757d78d3SDaniel Scheller #define DMA_BUFFER_SIZE(_dma)          ((_dma)->regs + 0x0c)
10425aee3deSMauro Carvalho Chehab 
10522e74389SDaniel Scheller /* ------------------------------------------------------------------------- */
10622e74389SDaniel Scheller /* CI Interface (only CI-Bridge) */
10725aee3deSMauro Carvalho Chehab 
10822e74389SDaniel Scheller #define CI_BASE                         (0x400)
10922e74389SDaniel Scheller #define CI_CONTROL(i)                   (CI_BASE + (i) * 32 + 0x00)
11025aee3deSMauro Carvalho Chehab 
11122e74389SDaniel Scheller #define CI_DO_ATTRIBUTE_RW(i)           (CI_BASE + (i) * 32 + 0x04)
11222e74389SDaniel Scheller #define CI_DO_IO_RW(i)                  (CI_BASE + (i) * 32 + 0x08)
11322e74389SDaniel Scheller #define CI_READDATA(i)                  (CI_BASE + (i) * 32 + 0x0c)
11422e74389SDaniel Scheller #define CI_DO_READ_ATTRIBUTES(i)        (CI_BASE + (i) * 32 + 0x10)
11525aee3deSMauro Carvalho Chehab 
11622e74389SDaniel Scheller #define CI_RESET_CAM                    (0x00000001)
11722e74389SDaniel Scheller #define CI_POWER_ON                     (0x00000002)
11822e74389SDaniel Scheller #define CI_ENABLE                       (0x00000004)
11922e74389SDaniel Scheller #define CI_BYPASS_DISABLE               (0x00000010)
12025aee3deSMauro Carvalho Chehab 
12122e74389SDaniel Scheller #define CI_CAM_READY                    (0x00010000)
12222e74389SDaniel Scheller #define CI_CAM_DETECT                   (0x00020000)
12322e74389SDaniel Scheller #define CI_READY                        (0x80000000)
12422e74389SDaniel Scheller 
12522e74389SDaniel Scheller #define CI_READ_CMD                     (0x40000000)
12622e74389SDaniel Scheller #define CI_WRITE_CMD                    (0x80000000)
12722e74389SDaniel Scheller 
12822e74389SDaniel Scheller #define CI_BUFFER_BASE                  (0x3000)
12922e74389SDaniel Scheller #define CI_BUFFER_SIZE                  (0x0800)
13022e74389SDaniel Scheller 
13122e74389SDaniel Scheller #define CI_BUFFER(i)                    (CI_BUFFER_BASE + (i) * CI_BUFFER_SIZE)
132bb4cec96SDaniel Scheller 
133bb4cec96SDaniel Scheller /* ------------------------------------------------------------------------- */
134bb4cec96SDaniel Scheller /* LNB commands (mxl5xx / Max S8) */
135bb4cec96SDaniel Scheller 
136bb4cec96SDaniel Scheller #define LNB_BASE			(0x400)
137bb4cec96SDaniel Scheller #define LNB_CONTROL(i)			(LNB_BASE + (i) * 0x20 + 0x00)
138bb4cec96SDaniel Scheller 
139bb4cec96SDaniel Scheller #define LNB_CMD				(7ULL << 0)
140bb4cec96SDaniel Scheller #define LNB_CMD_NOP			0
141bb4cec96SDaniel Scheller #define LNB_CMD_INIT			1
142bb4cec96SDaniel Scheller #define LNB_CMD_LOW			3
143bb4cec96SDaniel Scheller #define LNB_CMD_HIGH			4
144bb4cec96SDaniel Scheller #define LNB_CMD_OFF			5
145bb4cec96SDaniel Scheller #define LNB_CMD_DISEQC			6
146bb4cec96SDaniel Scheller 
147757d78d3SDaniel Scheller #define LNB_BUSY			BIT_ULL(4)
148757d78d3SDaniel Scheller #define LNB_TONE			BIT_ULL(15)
149bb4cec96SDaniel Scheller 
150bb4cec96SDaniel Scheller #define LNB_BUF_LEVEL(i)		(LNB_BASE + (i) * 0x20 + 0x10)
151bb4cec96SDaniel Scheller #define LNB_BUF_WRITE(i)		(LNB_BASE + (i) * 0x20 + 0x14)
152bb4cec96SDaniel Scheller 
1532dc3e050SDaniel Scheller #endif /* __DDBRIDGE_REGS_H__ */
154