18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * ddbridge-regs.h: Digital Devices PCIe bridge driver 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright (C) 2010-2017 Digital Devices GmbH 68c2ecf20Sopenharmony_ci * 78c2ecf20Sopenharmony_ci * This program is free software; you can redistribute it and/or 88c2ecf20Sopenharmony_ci * modify it under the terms of the GNU General Public License 98c2ecf20Sopenharmony_ci * version 2 only, as published by the Free Software Foundation. 108c2ecf20Sopenharmony_ci * 118c2ecf20Sopenharmony_ci * This program is distributed in the hope that it will be useful, 128c2ecf20Sopenharmony_ci * but WITHOUT ANY WARRANTY; without even the implied warranty of 138c2ecf20Sopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 148c2ecf20Sopenharmony_ci * GNU General Public License for more details. 158c2ecf20Sopenharmony_ci */ 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ci#ifndef __DDBRIDGE_REGS_H__ 188c2ecf20Sopenharmony_ci#define __DDBRIDGE_REGS_H__ 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci/* ------------------------------------------------------------------------- */ 218c2ecf20Sopenharmony_ci/* SPI Controller */ 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_ci#define SPI_CONTROL 0x10 248c2ecf20Sopenharmony_ci#define SPI_DATA 0x14 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ci/* ------------------------------------------------------------------------- */ 278c2ecf20Sopenharmony_ci/* GPIO */ 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ci#define GPIO_OUTPUT 0x20 308c2ecf20Sopenharmony_ci#define GPIO_INPUT 0x24 318c2ecf20Sopenharmony_ci#define GPIO_DIRECTION 0x28 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ci/* ------------------------------------------------------------------------- */ 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_ci#define BOARD_CONTROL 0x30 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ci/* ------------------------------------------------------------------------- */ 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_ci/* Interrupt controller 408c2ecf20Sopenharmony_ci * How many MSI's are available depends on HW (Min 2 max 8) 418c2ecf20Sopenharmony_ci * How many are usable also depends on Host platform 428c2ecf20Sopenharmony_ci */ 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_ci#define INTERRUPT_BASE (0x40) 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_ci#define INTERRUPT_ENABLE (INTERRUPT_BASE + 0x00) 478c2ecf20Sopenharmony_ci#define MSI1_ENABLE (INTERRUPT_BASE + 0x04) 488c2ecf20Sopenharmony_ci#define MSI2_ENABLE (INTERRUPT_BASE + 0x08) 498c2ecf20Sopenharmony_ci#define MSI3_ENABLE (INTERRUPT_BASE + 0x0C) 508c2ecf20Sopenharmony_ci#define MSI4_ENABLE (INTERRUPT_BASE + 0x10) 518c2ecf20Sopenharmony_ci#define MSI5_ENABLE (INTERRUPT_BASE + 0x14) 528c2ecf20Sopenharmony_ci#define MSI6_ENABLE (INTERRUPT_BASE + 0x18) 538c2ecf20Sopenharmony_ci#define MSI7_ENABLE (INTERRUPT_BASE + 0x1C) 548c2ecf20Sopenharmony_ci 558c2ecf20Sopenharmony_ci#define INTERRUPT_STATUS (INTERRUPT_BASE + 0x20) 568c2ecf20Sopenharmony_ci#define INTERRUPT_ACK (INTERRUPT_BASE + 0x20) 578c2ecf20Sopenharmony_ci 588c2ecf20Sopenharmony_ci/* Temperature Monitor ( 2x LM75A @ 0x90,0x92 I2c ) */ 598c2ecf20Sopenharmony_ci#define TEMPMON_BASE (0x1c0) 608c2ecf20Sopenharmony_ci#define TEMPMON_CONTROL (TEMPMON_BASE + 0x00) 618c2ecf20Sopenharmony_ci 628c2ecf20Sopenharmony_ci#define TEMPMON_CONTROL_AUTOSCAN (0x00000002) 638c2ecf20Sopenharmony_ci#define TEMPMON_CONTROL_INTENABLE (0x00000004) 648c2ecf20Sopenharmony_ci#define TEMPMON_CONTROL_OVERTEMP (0x00008000) 658c2ecf20Sopenharmony_ci 668c2ecf20Sopenharmony_ci/* SHORT Temperature in Celsius x 256 */ 678c2ecf20Sopenharmony_ci#define TEMPMON_SENSOR0 (TEMPMON_BASE + 0x04) 688c2ecf20Sopenharmony_ci#define TEMPMON_SENSOR1 (TEMPMON_BASE + 0x08) 698c2ecf20Sopenharmony_ci 708c2ecf20Sopenharmony_ci#define TEMPMON_FANCONTROL (TEMPMON_BASE + 0x10) 718c2ecf20Sopenharmony_ci 728c2ecf20Sopenharmony_ci/* ------------------------------------------------------------------------- */ 738c2ecf20Sopenharmony_ci/* I2C Master Controller */ 748c2ecf20Sopenharmony_ci 758c2ecf20Sopenharmony_ci#define I2C_COMMAND (0x00) 768c2ecf20Sopenharmony_ci#define I2C_TIMING (0x04) 778c2ecf20Sopenharmony_ci#define I2C_TASKLENGTH (0x08) /* High read, low write */ 788c2ecf20Sopenharmony_ci#define I2C_TASKADDRESS (0x0C) /* High read, low write */ 798c2ecf20Sopenharmony_ci#define I2C_MONITOR (0x1C) 808c2ecf20Sopenharmony_ci 818c2ecf20Sopenharmony_ci#define I2C_SPEED_400 (0x04030404) 828c2ecf20Sopenharmony_ci#define I2C_SPEED_100 (0x13121313) 838c2ecf20Sopenharmony_ci 848c2ecf20Sopenharmony_ci/* ------------------------------------------------------------------------- */ 858c2ecf20Sopenharmony_ci/* DMA Controller */ 868c2ecf20Sopenharmony_ci 878c2ecf20Sopenharmony_ci#define DMA_BASE_WRITE (0x100) 888c2ecf20Sopenharmony_ci#define DMA_BASE_READ (0x140) 898c2ecf20Sopenharmony_ci 908c2ecf20Sopenharmony_ci#define TS_CONTROL(_io) ((_io)->regs + 0x00) 918c2ecf20Sopenharmony_ci#define TS_CONTROL2(_io) ((_io)->regs + 0x04) 928c2ecf20Sopenharmony_ci 938c2ecf20Sopenharmony_ci/* ------------------------------------------------------------------------- */ 948c2ecf20Sopenharmony_ci/* DMA Buffer */ 958c2ecf20Sopenharmony_ci 968c2ecf20Sopenharmony_ci#define DMA_BUFFER_CONTROL(_dma) ((_dma)->regs + 0x00) 978c2ecf20Sopenharmony_ci#define DMA_BUFFER_ACK(_dma) ((_dma)->regs + 0x04) 988c2ecf20Sopenharmony_ci#define DMA_BUFFER_CURRENT(_dma) ((_dma)->regs + 0x08) 998c2ecf20Sopenharmony_ci#define DMA_BUFFER_SIZE(_dma) ((_dma)->regs + 0x0c) 1008c2ecf20Sopenharmony_ci 1018c2ecf20Sopenharmony_ci/* ------------------------------------------------------------------------- */ 1028c2ecf20Sopenharmony_ci/* CI Interface (only CI-Bridge) */ 1038c2ecf20Sopenharmony_ci 1048c2ecf20Sopenharmony_ci#define CI_BASE (0x400) 1058c2ecf20Sopenharmony_ci#define CI_CONTROL(i) (CI_BASE + (i) * 32 + 0x00) 1068c2ecf20Sopenharmony_ci 1078c2ecf20Sopenharmony_ci#define CI_DO_ATTRIBUTE_RW(i) (CI_BASE + (i) * 32 + 0x04) 1088c2ecf20Sopenharmony_ci#define CI_DO_IO_RW(i) (CI_BASE + (i) * 32 + 0x08) 1098c2ecf20Sopenharmony_ci#define CI_READDATA(i) (CI_BASE + (i) * 32 + 0x0c) 1108c2ecf20Sopenharmony_ci#define CI_DO_READ_ATTRIBUTES(i) (CI_BASE + (i) * 32 + 0x10) 1118c2ecf20Sopenharmony_ci 1128c2ecf20Sopenharmony_ci#define CI_RESET_CAM (0x00000001) 1138c2ecf20Sopenharmony_ci#define CI_POWER_ON (0x00000002) 1148c2ecf20Sopenharmony_ci#define CI_ENABLE (0x00000004) 1158c2ecf20Sopenharmony_ci#define CI_BYPASS_DISABLE (0x00000010) 1168c2ecf20Sopenharmony_ci 1178c2ecf20Sopenharmony_ci#define CI_CAM_READY (0x00010000) 1188c2ecf20Sopenharmony_ci#define CI_CAM_DETECT (0x00020000) 1198c2ecf20Sopenharmony_ci#define CI_READY (0x80000000) 1208c2ecf20Sopenharmony_ci 1218c2ecf20Sopenharmony_ci#define CI_READ_CMD (0x40000000) 1228c2ecf20Sopenharmony_ci#define CI_WRITE_CMD (0x80000000) 1238c2ecf20Sopenharmony_ci 1248c2ecf20Sopenharmony_ci#define CI_BUFFER_BASE (0x3000) 1258c2ecf20Sopenharmony_ci#define CI_BUFFER_SIZE (0x0800) 1268c2ecf20Sopenharmony_ci 1278c2ecf20Sopenharmony_ci#define CI_BUFFER(i) (CI_BUFFER_BASE + (i) * CI_BUFFER_SIZE) 1288c2ecf20Sopenharmony_ci 1298c2ecf20Sopenharmony_ci/* ------------------------------------------------------------------------- */ 1308c2ecf20Sopenharmony_ci/* LNB commands (mxl5xx / Max S8) */ 1318c2ecf20Sopenharmony_ci 1328c2ecf20Sopenharmony_ci#define LNB_BASE (0x400) 1338c2ecf20Sopenharmony_ci#define LNB_CONTROL(i) (LNB_BASE + (i) * 0x20 + 0x00) 1348c2ecf20Sopenharmony_ci 1358c2ecf20Sopenharmony_ci#define LNB_CMD (7ULL << 0) 1368c2ecf20Sopenharmony_ci#define LNB_CMD_NOP 0 1378c2ecf20Sopenharmony_ci#define LNB_CMD_INIT 1 1388c2ecf20Sopenharmony_ci#define LNB_CMD_LOW 3 1398c2ecf20Sopenharmony_ci#define LNB_CMD_HIGH 4 1408c2ecf20Sopenharmony_ci#define LNB_CMD_OFF 5 1418c2ecf20Sopenharmony_ci#define LNB_CMD_DISEQC 6 1428c2ecf20Sopenharmony_ci 1438c2ecf20Sopenharmony_ci#define LNB_BUSY BIT_ULL(4) 1448c2ecf20Sopenharmony_ci#define LNB_TONE BIT_ULL(15) 1458c2ecf20Sopenharmony_ci 1468c2ecf20Sopenharmony_ci#define LNB_BUF_LEVEL(i) (LNB_BASE + (i) * 0x20 + 0x10) 1478c2ecf20Sopenharmony_ci#define LNB_BUF_WRITE(i) (LNB_BASE + (i) * 0x20 + 0x14) 1488c2ecf20Sopenharmony_ci 1498c2ecf20Sopenharmony_ci#endif /* __DDBRIDGE_REGS_H__ */ 150