xref: /openbmc/linux/drivers/media/cec/platform/tegra/tegra_cec.h (revision 4b4193256c8d3bc3a5397b5cd9494c2ad386317d)
1*4be5e864SMauro Carvalho Chehab /* SPDX-License-Identifier: GPL-2.0-only */
2*4be5e864SMauro Carvalho Chehab /*
3*4be5e864SMauro Carvalho Chehab  * Tegra CEC register definitions
4*4be5e864SMauro Carvalho Chehab  *
5*4be5e864SMauro Carvalho Chehab  * The original 3.10 CEC driver using a custom API:
6*4be5e864SMauro Carvalho Chehab  *
7*4be5e864SMauro Carvalho Chehab  * Copyright (c) 2012-2015, NVIDIA CORPORATION.  All rights reserved.
8*4be5e864SMauro Carvalho Chehab  *
9*4be5e864SMauro Carvalho Chehab  * Conversion to the CEC framework and to the mainline kernel:
10*4be5e864SMauro Carvalho Chehab  *
11*4be5e864SMauro Carvalho Chehab  * Copyright 2016-2017 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
12*4be5e864SMauro Carvalho Chehab  */
13*4be5e864SMauro Carvalho Chehab 
14*4be5e864SMauro Carvalho Chehab #ifndef TEGRA_CEC_H
15*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_H
16*4be5e864SMauro Carvalho Chehab 
17*4be5e864SMauro Carvalho Chehab /* CEC registers */
18*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_SW_CONTROL	0x000
19*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_HW_CONTROL	0x004
20*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_INPUT_FILTER	0x008
21*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_TX_REGISTER	0x010
22*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_RX_REGISTER	0x014
23*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_RX_TIMING_0	0x018
24*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_RX_TIMING_1	0x01c
25*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_RX_TIMING_2	0x020
26*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_TX_TIMING_0	0x024
27*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_TX_TIMING_1	0x028
28*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_TX_TIMING_2	0x02c
29*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_INT_STAT	0x030
30*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_INT_MASK	0x034
31*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_HW_DEBUG_RX	0x038
32*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_HW_DEBUG_TX	0x03c
33*4be5e864SMauro Carvalho Chehab 
34*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_HWCTRL_RX_LADDR_MASK				0x7fff
35*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_HWCTRL_RX_LADDR(x)	\
36*4be5e864SMauro Carvalho Chehab 	((x) & TEGRA_CEC_HWCTRL_RX_LADDR_MASK)
37*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_HWCTRL_RX_SNOOP				BIT(15)
38*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_HWCTRL_RX_NAK_MODE				BIT(16)
39*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_HWCTRL_TX_NAK_MODE				BIT(24)
40*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_HWCTRL_FAST_SIM_MODE				BIT(30)
41*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_HWCTRL_TX_RX_MODE				BIT(31)
42*4be5e864SMauro Carvalho Chehab 
43*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_INPUT_FILTER_MODE				BIT(31)
44*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_INPUT_FILTER_FIFO_LENGTH_SHIFT		0
45*4be5e864SMauro Carvalho Chehab 
46*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_TX_REG_DATA_SHIFT				0
47*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_TX_REG_EOM					BIT(8)
48*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_TX_REG_BCAST					BIT(12)
49*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_TX_REG_START_BIT				BIT(16)
50*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_TX_REG_RETRY					BIT(17)
51*4be5e864SMauro Carvalho Chehab 
52*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_RX_REGISTER_SHIFT				0
53*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_RX_REGISTER_EOM				BIT(8)
54*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_RX_REGISTER_ACK				BIT(9)
55*4be5e864SMauro Carvalho Chehab 
56*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_RX_TIM0_START_BIT_MAX_LO_TIME_SHIFT		0
57*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_RX_TIM0_START_BIT_MIN_LO_TIME_SHIFT		8
58*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_RX_TIM0_START_BIT_MAX_DURATION_SHIFT		16
59*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_RX_TIM0_START_BIT_MIN_DURATION_SHIFT		24
60*4be5e864SMauro Carvalho Chehab 
61*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_RX_TIM1_DATA_BIT_MAX_LO_TIME_SHIFT		0
62*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_RX_TIM1_DATA_BIT_SAMPLE_TIME_SHIFT		8
63*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_RX_TIM1_DATA_BIT_MAX_DURATION_SHIFT		16
64*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_RX_TIM1_DATA_BIT_MIN_DURATION_SHIFT		24
65*4be5e864SMauro Carvalho Chehab 
66*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_RX_TIM2_END_OF_BLOCK_TIME_SHIFT		0
67*4be5e864SMauro Carvalho Chehab 
68*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_TX_TIM0_START_BIT_LO_TIME_SHIFT		0
69*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_TX_TIM0_START_BIT_DURATION_SHIFT		8
70*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_TX_TIM0_BUS_XITION_TIME_SHIFT			16
71*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_TX_TIM0_BUS_ERROR_LO_TIME_SHIFT		24
72*4be5e864SMauro Carvalho Chehab 
73*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_TX_TIM1_LO_DATA_BIT_LO_TIME_SHIFT		0
74*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_TX_TIM1_HI_DATA_BIT_LO_TIME_SHIFT		8
75*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_TX_TIM1_DATA_BIT_DURATION_SHIFT		16
76*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_TX_TIM1_ACK_NAK_BIT_SAMPLE_TIME_SHIFT		24
77*4be5e864SMauro Carvalho Chehab 
78*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_TX_TIM2_BUS_IDLE_TIME_ADDITIONAL_FRAME_SHIFT	0
79*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_TX_TIM2_BUS_IDLE_TIME_NEW_FRAME_SHIFT		4
80*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_TX_TIM2_BUS_IDLE_TIME_RETRY_FRAME_SHIFT	8
81*4be5e864SMauro Carvalho Chehab 
82*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_INT_STAT_TX_REGISTER_EMPTY			BIT(0)
83*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_INT_STAT_TX_REGISTER_UNDERRUN			BIT(1)
84*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_INT_STAT_TX_FRAME_OR_BLOCK_NAKD		BIT(2)
85*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_INT_STAT_TX_ARBITRATION_FAILED		BIT(3)
86*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_INT_STAT_TX_BUS_ANOMALY_DETECTED		BIT(4)
87*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_INT_STAT_TX_FRAME_TRANSMITTED			BIT(5)
88*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_INT_STAT_RX_REGISTER_FULL			BIT(8)
89*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_INT_STAT_RX_REGISTER_OVERRUN			BIT(9)
90*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_INT_STAT_RX_START_BIT_DETECTED		BIT(10)
91*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_INT_STAT_RX_BUS_ANOMALY_DETECTED		BIT(11)
92*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_INT_STAT_RX_BUS_ERROR_DETECTED		BIT(12)
93*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_INT_STAT_FILTERED_RX_DATA_PIN_TRANSITION_H2L	BIT(13)
94*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_INT_STAT_FILTERED_RX_DATA_PIN_TRANSITION_L2H	BIT(14)
95*4be5e864SMauro Carvalho Chehab 
96*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_INT_MASK_TX_REGISTER_EMPTY			BIT(0)
97*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_INT_MASK_TX_REGISTER_UNDERRUN			BIT(1)
98*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_INT_MASK_TX_FRAME_OR_BLOCK_NAKD		BIT(2)
99*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_INT_MASK_TX_ARBITRATION_FAILED		BIT(3)
100*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_INT_MASK_TX_BUS_ANOMALY_DETECTED		BIT(4)
101*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_INT_MASK_TX_FRAME_TRANSMITTED			BIT(5)
102*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_INT_MASK_RX_REGISTER_FULL			BIT(8)
103*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_INT_MASK_RX_REGISTER_OVERRUN			BIT(9)
104*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_INT_MASK_RX_START_BIT_DETECTED		BIT(10)
105*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_INT_MASK_RX_BUS_ANOMALY_DETECTED		BIT(11)
106*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_INT_MASK_RX_BUS_ERROR_DETECTED		BIT(12)
107*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_INT_MASK_FILTERED_RX_DATA_PIN_TRANSITION_H2L	BIT(13)
108*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_INT_MASK_FILTERED_RX_DATA_PIN_TRANSITION_L2H	BIT(14)
109*4be5e864SMauro Carvalho Chehab 
110*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_HW_DEBUG_TX_DURATION_COUNT_SHIFT		0
111*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_HW_DEBUG_TX_TXBIT_COUNT_SHIFT			17
112*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_HW_DEBUG_TX_STATE_SHIFT			21
113*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_HW_DEBUG_TX_FORCELOOUT			BIT(25)
114*4be5e864SMauro Carvalho Chehab #define TEGRA_CEC_HW_DEBUG_TX_TXDATABIT_SAMPLE_TIMER		BIT(26)
115*4be5e864SMauro Carvalho Chehab 
116*4be5e864SMauro Carvalho Chehab #endif /* TEGRA_CEC_H */
117