Jacob Chen | afca4fd | 2016-03-14 11:20:16 +0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016 Rockchip Inc. |
| 3 | * |
| 4 | * SPDX-License-Identifier: GPL-2.0+ |
| 5 | */ |
| 6 | |
| 7 | #ifndef _ASM_ARCH_LVDS_RK3288_H |
| 8 | #define _ASM_ARCH_LVDS_RK3288_H |
| 9 | |
| 10 | #define RK3288_LVDS_CH0_REG0 0x00 |
| 11 | #define RK3288_LVDS_CH0_REG0_LVDS_EN BIT(7) |
| 12 | #define RK3288_LVDS_CH0_REG0_TTL_EN BIT(6) |
| 13 | #define RK3288_LVDS_CH0_REG0_LANECK_EN BIT(5) |
| 14 | #define RK3288_LVDS_CH0_REG0_LANE4_EN BIT(4) |
| 15 | #define RK3288_LVDS_CH0_REG0_LANE3_EN BIT(3) |
| 16 | #define RK3288_LVDS_CH0_REG0_LANE2_EN BIT(2) |
| 17 | #define RK3288_LVDS_CH0_REG0_LANE1_EN BIT(1) |
| 18 | #define RK3288_LVDS_CH0_REG0_LANE0_EN BIT(0) |
| 19 | |
| 20 | #define RK3288_LVDS_CH0_REG1 0x04 |
| 21 | #define RK3288_LVDS_CH0_REG1_LANECK_BIAS BIT(5) |
| 22 | #define RK3288_LVDS_CH0_REG1_LANE4_BIAS BIT(4) |
| 23 | #define RK3288_LVDS_CH0_REG1_LANE3_BIAS BIT(3) |
| 24 | #define RK3288_LVDS_CH0_REG1_LANE2_BIAS BIT(2) |
| 25 | #define RK3288_LVDS_CH0_REG1_LANE1_BIAS BIT(1) |
| 26 | #define RK3288_LVDS_CH0_REG1_LANE0_BIAS BIT(0) |
| 27 | |
| 28 | #define RK3288_LVDS_CH0_REG2 0x08 |
| 29 | #define RK3288_LVDS_CH0_REG2_RESERVE_ON BIT(7) |
| 30 | #define RK3288_LVDS_CH0_REG2_LANECK_LVDS_MODE BIT(6) |
| 31 | #define RK3288_LVDS_CH0_REG2_LANE4_LVDS_MODE BIT(5) |
| 32 | #define RK3288_LVDS_CH0_REG2_LANE3_LVDS_MODE BIT(4) |
| 33 | #define RK3288_LVDS_CH0_REG2_LANE2_LVDS_MODE BIT(3) |
| 34 | #define RK3288_LVDS_CH0_REG2_LANE1_LVDS_MODE BIT(2) |
| 35 | #define RK3288_LVDS_CH0_REG2_LANE0_LVDS_MODE BIT(1) |
| 36 | #define RK3288_LVDS_CH0_REG2_PLL_FBDIV8 BIT(0) |
| 37 | |
| 38 | #define RK3288_LVDS_CH0_REG3 0x0c |
| 39 | #define RK3288_LVDS_CH0_REG3_PLL_FBDIV_MASK 0xff |
| 40 | |
| 41 | #define RK3288_LVDS_CH0_REG4 0x10 |
| 42 | #define RK3288_LVDS_CH0_REG4_LANECK_TTL_MODE BIT(5) |
| 43 | #define RK3288_LVDS_CH0_REG4_LANE4_TTL_MODE BIT(4) |
| 44 | #define RK3288_LVDS_CH0_REG4_LANE3_TTL_MODE BIT(3) |
| 45 | #define RK3288_LVDS_CH0_REG4_LANE2_TTL_MODE BIT(2) |
| 46 | #define RK3288_LVDS_CH0_REG4_LANE1_TTL_MODE BIT(1) |
| 47 | #define RK3288_LVDS_CH0_REG4_LANE0_TTL_MODE BIT(0) |
| 48 | |
| 49 | #define RK3288_LVDS_CH0_REG5 0x14 |
| 50 | #define RK3288_LVDS_CH0_REG5_LANECK_TTL_DATA BIT(5) |
| 51 | #define RK3288_LVDS_CH0_REG5_LANE4_TTL_DATA BIT(4) |
| 52 | #define RK3288_LVDS_CH0_REG5_LANE3_TTL_DATA BIT(3) |
| 53 | #define RK3288_LVDS_CH0_REG5_LANE2_TTL_DATA BIT(2) |
| 54 | #define RK3288_LVDS_CH0_REG5_LANE1_TTL_DATA BIT(1) |
| 55 | #define RK3288_LVDS_CH0_REG5_LANE0_TTL_DATA BIT(0) |
| 56 | |
| 57 | #define RK3288_LVDS_CFG_REGC 0x30 |
| 58 | #define RK3288_LVDS_CFG_REGC_PLL_ENABLE 0x00 |
| 59 | #define RK3288_LVDS_CFG_REGC_PLL_DISABLE 0xff |
| 60 | |
| 61 | #define RK3288_LVDS_CH0_REGD 0x34 |
| 62 | #define RK3288_LVDS_CH0_REGD_PLL_PREDIV_MASK 0x1f |
| 63 | |
| 64 | #define RK3288_LVDS_CH0_REG20 0x80 |
| 65 | #define RK3288_LVDS_CH0_REG20_MSB 0x45 |
| 66 | #define RK3288_LVDS_CH0_REG20_LSB 0x44 |
| 67 | |
| 68 | #define RK3288_LVDS_CFG_REG21 0x84 |
| 69 | #define RK3288_LVDS_CFG_REG21_TX_ENABLE 0x92 |
| 70 | #define RK3288_LVDS_CFG_REG21_TX_DISABLE 0x00 |
| 71 | |
| 72 | /* fbdiv value is split over 2 registers, with bit8 in reg2 */ |
| 73 | #define RK3288_LVDS_PLL_FBDIV_REG2(_fbd) \ |
| 74 | (_fbd & BIT(8) ? RK3288_LVDS_CH0_REG2_PLL_FBDIV8 : 0) |
| 75 | #define RK3288_LVDS_PLL_FBDIV_REG3(_fbd) \ |
| 76 | (_fbd & RK3288_LVDS_CH0_REG3_PLL_FBDIV_MASK) |
| 77 | #define RK3288_LVDS_PLL_PREDIV_REGD(_pd) \ |
| 78 | (_pd & RK3288_LVDS_CH0_REGD_PLL_PREDIV_MASK) |
| 79 | |
| 80 | #define RK3288_LVDS_SOC_CON6_SEL_VOP_LIT BIT(3) |
| 81 | |
| 82 | #define LVDS_FMT_MASK (7 << 16) |
| 83 | #define LVDS_MSB (1 << 3) |
| 84 | #define LVDS_DUAL (1 << 4) |
| 85 | #define LVDS_FMT_1 (1 << 5) |
| 86 | #define LVDS_TTL_EN (1 << 6) |
| 87 | #define LVDS_START_PHASE_RST_1 (1 << 7) |
| 88 | #define LVDS_DCLK_INV (1 << 8) |
| 89 | #define LVDS_CH0_EN (1 << 11) |
| 90 | #define LVDS_CH1_EN (1 << 12) |
| 91 | #define LVDS_PWRDN (1 << 15) |
| 92 | |
| 93 | #define LVDS_24BIT (0 << 1) |
| 94 | #define LVDS_18BIT (1 << 1) |
| 95 | |
| 96 | |
| 97 | #endif |