162306a36Sopenharmony_ci/*
262306a36Sopenharmony_ci * Copyright 2011 Advanced Micro Devices, Inc.
362306a36Sopenharmony_ci *
462306a36Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a
562306a36Sopenharmony_ci * copy of this software and associated documentation files (the "Software"),
662306a36Sopenharmony_ci * to deal in the Software without restriction, including without limitation
762306a36Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense,
862306a36Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the
962306a36Sopenharmony_ci * Software is furnished to do so, subject to the following conditions:
1062306a36Sopenharmony_ci *
1162306a36Sopenharmony_ci * The above copyright notice and this permission notice shall be included in
1262306a36Sopenharmony_ci * all copies or substantial portions of the Software.
1362306a36Sopenharmony_ci *
1462306a36Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1562306a36Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1662306a36Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1762306a36Sopenharmony_ci * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
1862306a36Sopenharmony_ci * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
1962306a36Sopenharmony_ci * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2062306a36Sopenharmony_ci * OTHER DEALINGS IN THE SOFTWARE.
2162306a36Sopenharmony_ci *
2262306a36Sopenharmony_ci */
2362306a36Sopenharmony_ci#ifndef __RS780D_H__
2462306a36Sopenharmony_ci#define __RS780D_H__
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ci#define CG_SPLL_FUNC_CNTL                                 0x600
2762306a36Sopenharmony_ci#       define SPLL_RESET                                (1 << 0)
2862306a36Sopenharmony_ci#       define SPLL_SLEEP                                (1 << 1)
2962306a36Sopenharmony_ci#       define SPLL_REF_DIV(x)                           ((x) << 2)
3062306a36Sopenharmony_ci#       define SPLL_REF_DIV_MASK                         (7 << 2)
3162306a36Sopenharmony_ci#       define SPLL_REF_DIV_SHIFT                        2
3262306a36Sopenharmony_ci#       define SPLL_FB_DIV(x)                            ((x) << 5)
3362306a36Sopenharmony_ci#       define SPLL_FB_DIV_MASK                          (0xff << 2)
3462306a36Sopenharmony_ci#       define SPLL_FB_DIV_SHIFT                         2
3562306a36Sopenharmony_ci#       define SPLL_PULSEEN                              (1 << 13)
3662306a36Sopenharmony_ci#       define SPLL_PULSENUM(x)                          ((x) << 14)
3762306a36Sopenharmony_ci#       define SPLL_PULSENUM_MASK                        (3 << 14)
3862306a36Sopenharmony_ci#       define SPLL_SW_HILEN(x)                          ((x) << 16)
3962306a36Sopenharmony_ci#       define SPLL_SW_HILEN_MASK                        (0xf << 16)
4062306a36Sopenharmony_ci#       define SPLL_SW_HILEN_SHIFT                       16
4162306a36Sopenharmony_ci#       define SPLL_SW_LOLEN(x)                          ((x) << 20)
4262306a36Sopenharmony_ci#       define SPLL_SW_LOLEN_MASK                        (0xf << 20)
4362306a36Sopenharmony_ci#       define SPLL_SW_LOLEN_SHIFT                       20
4462306a36Sopenharmony_ci#       define SPLL_DIVEN                                (1 << 24)
4562306a36Sopenharmony_ci#       define SPLL_BYPASS_EN                            (1 << 25)
4662306a36Sopenharmony_ci#       define SPLL_CHG_STATUS                           (1 << 29)
4762306a36Sopenharmony_ci#       define SPLL_CTLREQ                               (1 << 30)
4862306a36Sopenharmony_ci#       define SPLL_CTLACK                               (1 << 31)
4962306a36Sopenharmony_ci
5062306a36Sopenharmony_ci/* RS780/RS880 PM */
5162306a36Sopenharmony_ci#define	FVTHROT_CNTRL_REG				0x3000
5262306a36Sopenharmony_ci#define		DONT_WAIT_FOR_FBDIV_WRAP		(1 << 0)
5362306a36Sopenharmony_ci#define		MINIMUM_CIP(x)				((x) << 1)
5462306a36Sopenharmony_ci#define		MINIMUM_CIP_SHIFT			1
5562306a36Sopenharmony_ci#define		MINIMUM_CIP_MASK			0x1fffffe
5662306a36Sopenharmony_ci#define		REFRESH_RATE_DIVISOR(x)			((x) << 25)
5762306a36Sopenharmony_ci#define		REFRESH_RATE_DIVISOR_SHIFT		25
5862306a36Sopenharmony_ci#define		REFRESH_RATE_DIVISOR_MASK		(0x3 << 25)
5962306a36Sopenharmony_ci#define		ENABLE_FV_THROT				(1 << 27)
6062306a36Sopenharmony_ci#define		ENABLE_FV_UPDATE			(1 << 28)
6162306a36Sopenharmony_ci#define		TREND_SEL_MODE				(1 << 29)
6262306a36Sopenharmony_ci#define		FORCE_TREND_SEL				(1 << 30)
6362306a36Sopenharmony_ci#define		ENABLE_FV_THROT_IO			(1 << 31)
6462306a36Sopenharmony_ci#define	FVTHROT_TARGET_REG				0x3004
6562306a36Sopenharmony_ci#define		TARGET_IDLE_COUNT(x)			((x) << 0)
6662306a36Sopenharmony_ci#define		TARGET_IDLE_COUNT_MASK			0xffffff
6762306a36Sopenharmony_ci#define		TARGET_IDLE_COUNT_SHIFT			0
6862306a36Sopenharmony_ci#define	FVTHROT_CB1					0x3008
6962306a36Sopenharmony_ci#define	FVTHROT_CB2					0x300c
7062306a36Sopenharmony_ci#define	FVTHROT_CB3					0x3010
7162306a36Sopenharmony_ci#define	FVTHROT_CB4					0x3014
7262306a36Sopenharmony_ci#define	FVTHROT_UTC0					0x3018
7362306a36Sopenharmony_ci#define	FVTHROT_UTC1					0x301c
7462306a36Sopenharmony_ci#define	FVTHROT_UTC2					0x3020
7562306a36Sopenharmony_ci#define	FVTHROT_UTC3					0x3024
7662306a36Sopenharmony_ci#define	FVTHROT_UTC4					0x3028
7762306a36Sopenharmony_ci#define	FVTHROT_DTC0					0x302c
7862306a36Sopenharmony_ci#define	FVTHROT_DTC1					0x3030
7962306a36Sopenharmony_ci#define	FVTHROT_DTC2					0x3034
8062306a36Sopenharmony_ci#define	FVTHROT_DTC3					0x3038
8162306a36Sopenharmony_ci#define	FVTHROT_DTC4					0x303c
8262306a36Sopenharmony_ci#define	FVTHROT_FBDIV_REG0				0x3040
8362306a36Sopenharmony_ci#define		MIN_FEEDBACK_DIV(x)			((x) << 0)
8462306a36Sopenharmony_ci#define		MIN_FEEDBACK_DIV_MASK			0xfff
8562306a36Sopenharmony_ci#define		MIN_FEEDBACK_DIV_SHIFT			0
8662306a36Sopenharmony_ci#define		MAX_FEEDBACK_DIV(x)			((x) << 12)
8762306a36Sopenharmony_ci#define		MAX_FEEDBACK_DIV_MASK			(0xfff << 12)
8862306a36Sopenharmony_ci#define		MAX_FEEDBACK_DIV_SHIFT			12
8962306a36Sopenharmony_ci#define	FVTHROT_FBDIV_REG1				0x3044
9062306a36Sopenharmony_ci#define		MAX_FEEDBACK_STEP(x)			((x) << 0)
9162306a36Sopenharmony_ci#define		MAX_FEEDBACK_STEP_MASK			0xfff
9262306a36Sopenharmony_ci#define		MAX_FEEDBACK_STEP_SHIFT			0
9362306a36Sopenharmony_ci#define		STARTING_FEEDBACK_DIV(x)		((x) << 12)
9462306a36Sopenharmony_ci#define		STARTING_FEEDBACK_DIV_MASK		(0xfff << 12)
9562306a36Sopenharmony_ci#define		STARTING_FEEDBACK_DIV_SHIFT		12
9662306a36Sopenharmony_ci#define		FORCE_FEEDBACK_DIV			(1 << 24)
9762306a36Sopenharmony_ci#define	FVTHROT_FBDIV_REG2				0x3048
9862306a36Sopenharmony_ci#define		FORCED_FEEDBACK_DIV(x)			((x) << 0)
9962306a36Sopenharmony_ci#define		FORCED_FEEDBACK_DIV_MASK		0xfff
10062306a36Sopenharmony_ci#define		FORCED_FEEDBACK_DIV_SHIFT		0
10162306a36Sopenharmony_ci#define		FB_DIV_TIMER_VAL(x)			((x) << 12)
10262306a36Sopenharmony_ci#define		FB_DIV_TIMER_VAL_MASK			(0xffff << 12)
10362306a36Sopenharmony_ci#define		FB_DIV_TIMER_VAL_SHIFT			12
10462306a36Sopenharmony_ci#define	FVTHROT_FB_US_REG0				0x304c
10562306a36Sopenharmony_ci#define	FVTHROT_FB_US_REG1				0x3050
10662306a36Sopenharmony_ci#define	FVTHROT_FB_DS_REG0				0x3054
10762306a36Sopenharmony_ci#define	FVTHROT_FB_DS_REG1				0x3058
10862306a36Sopenharmony_ci#define	FVTHROT_PWM_CTRL_REG0				0x305c
10962306a36Sopenharmony_ci#define		STARTING_PWM_HIGHTIME(x)		((x) << 0)
11062306a36Sopenharmony_ci#define		STARTING_PWM_HIGHTIME_MASK		0xfff
11162306a36Sopenharmony_ci#define		STARTING_PWM_HIGHTIME_SHIFT		0
11262306a36Sopenharmony_ci#define		NUMBER_OF_CYCLES_IN_PERIOD(x)		((x) << 12)
11362306a36Sopenharmony_ci#define		NUMBER_OF_CYCLES_IN_PERIOD_MASK		(0xfff << 12)
11462306a36Sopenharmony_ci#define		NUMBER_OF_CYCLES_IN_PERIOD_SHIFT	12
11562306a36Sopenharmony_ci#define		FORCE_STARTING_PWM_HIGHTIME		(1 << 24)
11662306a36Sopenharmony_ci#define		INVERT_PWM_WAVEFORM			(1 << 25)
11762306a36Sopenharmony_ci#define	FVTHROT_PWM_CTRL_REG1				0x3060
11862306a36Sopenharmony_ci#define		MIN_PWM_HIGHTIME(x)			((x) << 0)
11962306a36Sopenharmony_ci#define		MIN_PWM_HIGHTIME_MASK			0xfff
12062306a36Sopenharmony_ci#define		MIN_PWM_HIGHTIME_SHIFT			0
12162306a36Sopenharmony_ci#define		MAX_PWM_HIGHTIME(x)			((x) << 12)
12262306a36Sopenharmony_ci#define		MAX_PWM_HIGHTIME_MASK			(0xfff << 12)
12362306a36Sopenharmony_ci#define		MAX_PWM_HIGHTIME_SHIFT			12
12462306a36Sopenharmony_ci#define	FVTHROT_PWM_US_REG0				0x3064
12562306a36Sopenharmony_ci#define	FVTHROT_PWM_US_REG1				0x3068
12662306a36Sopenharmony_ci#define	FVTHROT_PWM_DS_REG0				0x306c
12762306a36Sopenharmony_ci#define	FVTHROT_PWM_DS_REG1				0x3070
12862306a36Sopenharmony_ci#define	FVTHROT_STATUS_REG0				0x3074
12962306a36Sopenharmony_ci#define		CURRENT_FEEDBACK_DIV_MASK		0xfff
13062306a36Sopenharmony_ci#define		CURRENT_FEEDBACK_DIV_SHIFT		0
13162306a36Sopenharmony_ci#define	FVTHROT_STATUS_REG1				0x3078
13262306a36Sopenharmony_ci#define	FVTHROT_STATUS_REG2				0x307c
13362306a36Sopenharmony_ci#define	CG_INTGFX_MISC					0x3080
13462306a36Sopenharmony_ci#define		FVTHROT_VBLANK_SEL			(1 << 9)
13562306a36Sopenharmony_ci#define	FVTHROT_PWM_FEEDBACK_DIV_REG1			0x308c
13662306a36Sopenharmony_ci#define		RANGE0_PWM_FEEDBACK_DIV(x)		((x) << 0)
13762306a36Sopenharmony_ci#define		RANGE0_PWM_FEEDBACK_DIV_MASK		0xfff
13862306a36Sopenharmony_ci#define		RANGE0_PWM_FEEDBACK_DIV_SHIFT		0
13962306a36Sopenharmony_ci#define		RANGE_PWM_FEEDBACK_DIV_EN		(1 << 12)
14062306a36Sopenharmony_ci#define	FVTHROT_PWM_FEEDBACK_DIV_REG2			0x3090
14162306a36Sopenharmony_ci#define		RANGE1_PWM_FEEDBACK_DIV(x)		((x) << 0)
14262306a36Sopenharmony_ci#define		RANGE1_PWM_FEEDBACK_DIV_MASK		0xfff
14362306a36Sopenharmony_ci#define		RANGE1_PWM_FEEDBACK_DIV_SHIFT		0
14462306a36Sopenharmony_ci#define		RANGE2_PWM_FEEDBACK_DIV(x)		((x) << 12)
14562306a36Sopenharmony_ci#define		RANGE2_PWM_FEEDBACK_DIV_MASK		(0xfff << 12)
14662306a36Sopenharmony_ci#define		RANGE2_PWM_FEEDBACK_DIV_SHIFT		12
14762306a36Sopenharmony_ci#define	FVTHROT_PWM_FEEDBACK_DIV_REG3			0x3094
14862306a36Sopenharmony_ci#define		RANGE0_PWM(x)				((x) << 0)
14962306a36Sopenharmony_ci#define		RANGE0_PWM_MASK				0xfff
15062306a36Sopenharmony_ci#define		RANGE0_PWM_SHIFT			0
15162306a36Sopenharmony_ci#define		RANGE1_PWM(x)				((x) << 12)
15262306a36Sopenharmony_ci#define		RANGE1_PWM_MASK				(0xfff << 12)
15362306a36Sopenharmony_ci#define		RANGE1_PWM_SHIFT			12
15462306a36Sopenharmony_ci#define	FVTHROT_PWM_FEEDBACK_DIV_REG4			0x3098
15562306a36Sopenharmony_ci#define		RANGE2_PWM(x)				((x) << 0)
15662306a36Sopenharmony_ci#define		RANGE2_PWM_MASK				0xfff
15762306a36Sopenharmony_ci#define		RANGE2_PWM_SHIFT			0
15862306a36Sopenharmony_ci#define		RANGE3_PWM(x)				((x) << 12)
15962306a36Sopenharmony_ci#define		RANGE3_PWM_MASK				(0xfff << 12)
16062306a36Sopenharmony_ci#define		RANGE3_PWM_SHIFT			12
16162306a36Sopenharmony_ci#define	FVTHROT_SLOW_CLK_FEEDBACK_DIV_REG1		0x30ac
16262306a36Sopenharmony_ci#define		RANGE0_SLOW_CLK_FEEDBACK_DIV(x)		((x) << 0)
16362306a36Sopenharmony_ci#define		RANGE0_SLOW_CLK_FEEDBACK_DIV_MASK	0xfff
16462306a36Sopenharmony_ci#define		RANGE0_SLOW_CLK_FEEDBACK_DIV_SHIFT	0
16562306a36Sopenharmony_ci#define		RANGE_SLOW_CLK_FEEDBACK_DIV_EN		(1 << 12)
16662306a36Sopenharmony_ci
16762306a36Sopenharmony_ci#define	GFX_MACRO_BYPASS_CNTL				0x30c0
16862306a36Sopenharmony_ci#define		SPLL_BYPASS_CNTL			(1 << 0)
16962306a36Sopenharmony_ci#define		UPLL_BYPASS_CNTL			(1 << 1)
17062306a36Sopenharmony_ci
17162306a36Sopenharmony_ci#endif
172