162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved.
462306a36Sopenharmony_ci * Copyright (C) 2008 by Sascha Hauer <kernel@pengutronix.de>
562306a36Sopenharmony_ci */
662306a36Sopenharmony_ci
762306a36Sopenharmony_ci#ifndef __ARCH_ARM_MACH_MX3_CRM_REGS_H__
862306a36Sopenharmony_ci#define __ARCH_ARM_MACH_MX3_CRM_REGS_H__
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ci#define CKIH_CLK_FREQ           26000000
1162306a36Sopenharmony_ci#define CKIH_CLK_FREQ_27MHZ     27000000
1262306a36Sopenharmony_ci#define CKIL_CLK_FREQ           32768
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ciextern void __iomem *mx3_ccm_base;
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ci/* Register addresses */
1762306a36Sopenharmony_ci#define MXC_CCM_CCMR		0x00
1862306a36Sopenharmony_ci#define MXC_CCM_PDR0		0x04
1962306a36Sopenharmony_ci#define MXC_CCM_PDR1		0x08
2062306a36Sopenharmony_ci#define MX35_CCM_PDR2		0x0C
2162306a36Sopenharmony_ci#define MXC_CCM_RCSR		0x0C
2262306a36Sopenharmony_ci#define MX35_CCM_PDR3		0x10
2362306a36Sopenharmony_ci#define MXC_CCM_MPCTL		0x10
2462306a36Sopenharmony_ci#define MX35_CCM_PDR4		0x14
2562306a36Sopenharmony_ci#define MXC_CCM_UPCTL		0x14
2662306a36Sopenharmony_ci#define MX35_CCM_RCSR		0x18
2762306a36Sopenharmony_ci#define MXC_CCM_SRPCTL		0x18
2862306a36Sopenharmony_ci#define MX35_CCM_MPCTL		0x1C
2962306a36Sopenharmony_ci#define MXC_CCM_COSR		0x1C
3062306a36Sopenharmony_ci#define MX35_CCM_PPCTL		0x20
3162306a36Sopenharmony_ci#define MXC_CCM_CGR0		0x20
3262306a36Sopenharmony_ci#define MX35_CCM_ACMR		0x24
3362306a36Sopenharmony_ci#define MXC_CCM_CGR1		0x24
3462306a36Sopenharmony_ci#define MX35_CCM_COSR		0x28
3562306a36Sopenharmony_ci#define MXC_CCM_CGR2		0x28
3662306a36Sopenharmony_ci#define MX35_CCM_CGR0		0x2C
3762306a36Sopenharmony_ci#define MXC_CCM_WIMR		0x2C
3862306a36Sopenharmony_ci#define MX35_CCM_CGR1		0x30
3962306a36Sopenharmony_ci#define MXC_CCM_LDC		0x30
4062306a36Sopenharmony_ci#define MX35_CCM_CGR2		0x34
4162306a36Sopenharmony_ci#define MXC_CCM_DCVR0		0x34
4262306a36Sopenharmony_ci#define MX35_CCM_CGR3		0x38
4362306a36Sopenharmony_ci#define MXC_CCM_DCVR1		0x38
4462306a36Sopenharmony_ci#define MXC_CCM_DCVR2		0x3C
4562306a36Sopenharmony_ci#define MXC_CCM_DCVR3		0x40
4662306a36Sopenharmony_ci#define MXC_CCM_LTR0		0x44
4762306a36Sopenharmony_ci#define MXC_CCM_LTR1		0x48
4862306a36Sopenharmony_ci#define MXC_CCM_LTR2		0x4C
4962306a36Sopenharmony_ci#define MXC_CCM_LTR3		0x50
5062306a36Sopenharmony_ci#define MXC_CCM_LTBR0		0x54
5162306a36Sopenharmony_ci#define MXC_CCM_LTBR1		0x58
5262306a36Sopenharmony_ci#define MXC_CCM_PMCR0		0x5C
5362306a36Sopenharmony_ci#define MXC_CCM_PMCR1		0x60
5462306a36Sopenharmony_ci#define MXC_CCM_PDR2		0x64
5562306a36Sopenharmony_ci
5662306a36Sopenharmony_ci/* Register bit definitions */
5762306a36Sopenharmony_ci#define MXC_CCM_CCMR_WBEN                       (1 << 27)
5862306a36Sopenharmony_ci#define MXC_CCM_CCMR_CSCS                       (1 << 25)
5962306a36Sopenharmony_ci#define MXC_CCM_CCMR_PERCS                      (1 << 24)
6062306a36Sopenharmony_ci#define MXC_CCM_CCMR_SSI1S_OFFSET               18
6162306a36Sopenharmony_ci#define MXC_CCM_CCMR_SSI1S_MASK                 (0x3 << 18)
6262306a36Sopenharmony_ci#define MXC_CCM_CCMR_SSI2S_OFFSET               21
6362306a36Sopenharmony_ci#define MXC_CCM_CCMR_SSI2S_MASK                 (0x3 << 21)
6462306a36Sopenharmony_ci#define MXC_CCM_CCMR_LPM_OFFSET                 14
6562306a36Sopenharmony_ci#define MXC_CCM_CCMR_LPM_MASK                   (0x3 << 14)
6662306a36Sopenharmony_ci#define MXC_CCM_CCMR_LPM_WAIT_MX35		(0x1 << 14)
6762306a36Sopenharmony_ci#define MXC_CCM_CCMR_FIRS_OFFSET                11
6862306a36Sopenharmony_ci#define MXC_CCM_CCMR_FIRS_MASK                  (0x3 << 11)
6962306a36Sopenharmony_ci#define MXC_CCM_CCMR_UPE                        (1 << 9)
7062306a36Sopenharmony_ci#define MXC_CCM_CCMR_SPE                        (1 << 8)
7162306a36Sopenharmony_ci#define MXC_CCM_CCMR_MDS                        (1 << 7)
7262306a36Sopenharmony_ci#define MXC_CCM_CCMR_SBYCS                      (1 << 4)
7362306a36Sopenharmony_ci#define MXC_CCM_CCMR_MPE                        (1 << 3)
7462306a36Sopenharmony_ci#define MXC_CCM_CCMR_PRCS_OFFSET                1
7562306a36Sopenharmony_ci#define MXC_CCM_CCMR_PRCS_MASK                  (0x3 << 1)
7662306a36Sopenharmony_ci
7762306a36Sopenharmony_ci#define MXC_CCM_PDR0_CSI_PODF_OFFSET            26
7862306a36Sopenharmony_ci#define MXC_CCM_PDR0_CSI_PODF_MASK              (0x3F << 26)
7962306a36Sopenharmony_ci#define MXC_CCM_PDR0_CSI_PRDF_OFFSET            23
8062306a36Sopenharmony_ci#define MXC_CCM_PDR0_CSI_PRDF_MASK              (0x7 << 23)
8162306a36Sopenharmony_ci#define MXC_CCM_PDR0_PER_PODF_OFFSET            16
8262306a36Sopenharmony_ci#define MXC_CCM_PDR0_PER_PODF_MASK              (0x1F << 16)
8362306a36Sopenharmony_ci#define MXC_CCM_PDR0_HSP_PODF_OFFSET            11
8462306a36Sopenharmony_ci#define MXC_CCM_PDR0_HSP_PODF_MASK              (0x7 << 11)
8562306a36Sopenharmony_ci#define MXC_CCM_PDR0_NFC_PODF_OFFSET            8
8662306a36Sopenharmony_ci#define MXC_CCM_PDR0_NFC_PODF_MASK              (0x7 << 8)
8762306a36Sopenharmony_ci#define MXC_CCM_PDR0_IPG_PODF_OFFSET            6
8862306a36Sopenharmony_ci#define MXC_CCM_PDR0_IPG_PODF_MASK              (0x3 << 6)
8962306a36Sopenharmony_ci#define MXC_CCM_PDR0_MAX_PODF_OFFSET            3
9062306a36Sopenharmony_ci#define MXC_CCM_PDR0_MAX_PODF_MASK              (0x7 << 3)
9162306a36Sopenharmony_ci#define MXC_CCM_PDR0_MCU_PODF_OFFSET            0
9262306a36Sopenharmony_ci#define MXC_CCM_PDR0_MCU_PODF_MASK              0x7
9362306a36Sopenharmony_ci
9462306a36Sopenharmony_ci#define MXC_CCM_PDR1_USB_PRDF_OFFSET            30
9562306a36Sopenharmony_ci#define MXC_CCM_PDR1_USB_PRDF_MASK              (0x3 << 30)
9662306a36Sopenharmony_ci#define MXC_CCM_PDR1_USB_PODF_OFFSET            27
9762306a36Sopenharmony_ci#define MXC_CCM_PDR1_USB_PODF_MASK              (0x7 << 27)
9862306a36Sopenharmony_ci#define MXC_CCM_PDR1_FIRI_PRE_PODF_OFFSET       24
9962306a36Sopenharmony_ci#define MXC_CCM_PDR1_FIRI_PRE_PODF_MASK         (0x7 << 24)
10062306a36Sopenharmony_ci#define MXC_CCM_PDR1_FIRI_PODF_OFFSET           18
10162306a36Sopenharmony_ci#define MXC_CCM_PDR1_FIRI_PODF_MASK             (0x3F << 18)
10262306a36Sopenharmony_ci#define MXC_CCM_PDR1_SSI2_PRE_PODF_OFFSET       15
10362306a36Sopenharmony_ci#define MXC_CCM_PDR1_SSI2_PRE_PODF_MASK         (0x7 << 15)
10462306a36Sopenharmony_ci#define MXC_CCM_PDR1_SSI2_PODF_OFFSET           9
10562306a36Sopenharmony_ci#define MXC_CCM_PDR1_SSI2_PODF_MASK             (0x3F << 9)
10662306a36Sopenharmony_ci#define MXC_CCM_PDR1_SSI1_PRE_PODF_OFFSET       6
10762306a36Sopenharmony_ci#define MXC_CCM_PDR1_SSI1_PRE_PODF_MASK         (0x7 << 6)
10862306a36Sopenharmony_ci#define MXC_CCM_PDR1_SSI1_PODF_OFFSET           0
10962306a36Sopenharmony_ci#define MXC_CCM_PDR1_SSI1_PODF_MASK             0x3F
11062306a36Sopenharmony_ci
11162306a36Sopenharmony_ci/* Bit definitions for RCSR */
11262306a36Sopenharmony_ci#define MXC_CCM_RCSR_NF16B			0x80000000
11362306a36Sopenharmony_ci
11462306a36Sopenharmony_ci/*
11562306a36Sopenharmony_ci * LTR0 register offsets
11662306a36Sopenharmony_ci */
11762306a36Sopenharmony_ci#define MXC_CCM_LTR0_DIV3CK_OFFSET              1
11862306a36Sopenharmony_ci#define MXC_CCM_LTR0_DIV3CK_MASK                (0x3 << 1)
11962306a36Sopenharmony_ci#define MXC_CCM_LTR0_DNTHR_OFFSET               16
12062306a36Sopenharmony_ci#define MXC_CCM_LTR0_DNTHR_MASK                 (0x3F << 16)
12162306a36Sopenharmony_ci#define MXC_CCM_LTR0_UPTHR_OFFSET               22
12262306a36Sopenharmony_ci#define MXC_CCM_LTR0_UPTHR_MASK                 (0x3F << 22)
12362306a36Sopenharmony_ci
12462306a36Sopenharmony_ci/*
12562306a36Sopenharmony_ci * LTR1 register offsets
12662306a36Sopenharmony_ci */
12762306a36Sopenharmony_ci#define MXC_CCM_LTR1_PNCTHR_OFFSET              0
12862306a36Sopenharmony_ci#define MXC_CCM_LTR1_PNCTHR_MASK                0x3F
12962306a36Sopenharmony_ci#define MXC_CCM_LTR1_UPCNT_OFFSET               6
13062306a36Sopenharmony_ci#define MXC_CCM_LTR1_UPCNT_MASK                 (0xFF << 6)
13162306a36Sopenharmony_ci#define MXC_CCM_LTR1_DNCNT_OFFSET               14
13262306a36Sopenharmony_ci#define MXC_CCM_LTR1_DNCNT_MASK                 (0xFF << 14)
13362306a36Sopenharmony_ci#define MXC_CCM_LTR1_LTBRSR_MASK                0x400000
13462306a36Sopenharmony_ci#define MXC_CCM_LTR1_LTBRSR_OFFSET              22
13562306a36Sopenharmony_ci#define MXC_CCM_LTR1_LTBRSR                     0x400000
13662306a36Sopenharmony_ci#define MXC_CCM_LTR1_LTBRSH                     0x800000
13762306a36Sopenharmony_ci
13862306a36Sopenharmony_ci/*
13962306a36Sopenharmony_ci * LTR2 bit definitions. x ranges from 0 for WSW9 to 6 for WSW15
14062306a36Sopenharmony_ci */
14162306a36Sopenharmony_ci#define MXC_CCM_LTR2_WSW_OFFSET(x)              (11 + (x) * 3)
14262306a36Sopenharmony_ci#define MXC_CCM_LTR2_WSW_MASK(x)                (0x7 << \
14362306a36Sopenharmony_ci					MXC_CCM_LTR2_WSW_OFFSET((x)))
14462306a36Sopenharmony_ci#define MXC_CCM_LTR2_EMAC_OFFSET                0
14562306a36Sopenharmony_ci#define MXC_CCM_LTR2_EMAC_MASK                  0x1FF
14662306a36Sopenharmony_ci
14762306a36Sopenharmony_ci/*
14862306a36Sopenharmony_ci * LTR3 bit definitions. x ranges from 0 for WSW0 to 8 for WSW8
14962306a36Sopenharmony_ci */
15062306a36Sopenharmony_ci#define MXC_CCM_LTR3_WSW_OFFSET(x)              (5 + (x) * 3)
15162306a36Sopenharmony_ci#define MXC_CCM_LTR3_WSW_MASK(x)                (0x7 << \
15262306a36Sopenharmony_ci					MXC_CCM_LTR3_WSW_OFFSET((x)))
15362306a36Sopenharmony_ci
15462306a36Sopenharmony_ci#define MXC_CCM_PMCR0_DFSUP1                    0x80000000
15562306a36Sopenharmony_ci#define MXC_CCM_PMCR0_DFSUP1_SPLL               (0 << 31)
15662306a36Sopenharmony_ci#define MXC_CCM_PMCR0_DFSUP1_MPLL               (1 << 31)
15762306a36Sopenharmony_ci#define MXC_CCM_PMCR0_DFSUP0                    0x40000000
15862306a36Sopenharmony_ci#define MXC_CCM_PMCR0_DFSUP0_PLL                (0 << 30)
15962306a36Sopenharmony_ci#define MXC_CCM_PMCR0_DFSUP0_PDR                (1 << 30)
16062306a36Sopenharmony_ci#define MXC_CCM_PMCR0_DFSUP_MASK                (0x3 << 30)
16162306a36Sopenharmony_ci
16262306a36Sopenharmony_ci#define DVSUP_TURBO				0
16362306a36Sopenharmony_ci#define DVSUP_HIGH				1
16462306a36Sopenharmony_ci#define DVSUP_MEDIUM				2
16562306a36Sopenharmony_ci#define DVSUP_LOW				3
16662306a36Sopenharmony_ci#define MXC_CCM_PMCR0_DVSUP_TURBO               (DVSUP_TURBO << 28)
16762306a36Sopenharmony_ci#define MXC_CCM_PMCR0_DVSUP_HIGH                (DVSUP_HIGH << 28)
16862306a36Sopenharmony_ci#define MXC_CCM_PMCR0_DVSUP_MEDIUM              (DVSUP_MEDIUM << 28)
16962306a36Sopenharmony_ci#define MXC_CCM_PMCR0_DVSUP_LOW                 (DVSUP_LOW << 28)
17062306a36Sopenharmony_ci#define MXC_CCM_PMCR0_DVSUP_OFFSET              28
17162306a36Sopenharmony_ci#define MXC_CCM_PMCR0_DVSUP_MASK                (0x3 << 28)
17262306a36Sopenharmony_ci#define MXC_CCM_PMCR0_UDSC                      0x08000000
17362306a36Sopenharmony_ci#define MXC_CCM_PMCR0_UDSC_MASK                 (1 << 27)
17462306a36Sopenharmony_ci#define MXC_CCM_PMCR0_UDSC_UP                   (1 << 27)
17562306a36Sopenharmony_ci#define MXC_CCM_PMCR0_UDSC_DOWN                 (0 << 27)
17662306a36Sopenharmony_ci
17762306a36Sopenharmony_ci#define MXC_CCM_PMCR0_VSCNT_1                   (0x0 << 24)
17862306a36Sopenharmony_ci#define MXC_CCM_PMCR0_VSCNT_2                   (0x1 << 24)
17962306a36Sopenharmony_ci#define MXC_CCM_PMCR0_VSCNT_3                   (0x2 << 24)
18062306a36Sopenharmony_ci#define MXC_CCM_PMCR0_VSCNT_4                   (0x3 << 24)
18162306a36Sopenharmony_ci#define MXC_CCM_PMCR0_VSCNT_5                   (0x4 << 24)
18262306a36Sopenharmony_ci#define MXC_CCM_PMCR0_VSCNT_6                   (0x5 << 24)
18362306a36Sopenharmony_ci#define MXC_CCM_PMCR0_VSCNT_7                   (0x6 << 24)
18462306a36Sopenharmony_ci#define MXC_CCM_PMCR0_VSCNT_8                   (0x7 << 24)
18562306a36Sopenharmony_ci#define MXC_CCM_PMCR0_VSCNT_OFFSET              24
18662306a36Sopenharmony_ci#define MXC_CCM_PMCR0_VSCNT_MASK                (0x7 << 24)
18762306a36Sopenharmony_ci#define MXC_CCM_PMCR0_DVFEV                     0x00800000
18862306a36Sopenharmony_ci#define MXC_CCM_PMCR0_DVFIS                     0x00400000
18962306a36Sopenharmony_ci#define MXC_CCM_PMCR0_LBMI                      0x00200000
19062306a36Sopenharmony_ci#define MXC_CCM_PMCR0_LBFL                      0x00100000
19162306a36Sopenharmony_ci#define MXC_CCM_PMCR0_LBCF_4                    (0x0 << 18)
19262306a36Sopenharmony_ci#define MXC_CCM_PMCR0_LBCF_8                    (0x1 << 18)
19362306a36Sopenharmony_ci#define MXC_CCM_PMCR0_LBCF_12                   (0x2 << 18)
19462306a36Sopenharmony_ci#define MXC_CCM_PMCR0_LBCF_16                   (0x3 << 18)
19562306a36Sopenharmony_ci#define MXC_CCM_PMCR0_LBCF_OFFSET               18
19662306a36Sopenharmony_ci#define MXC_CCM_PMCR0_LBCF_MASK                 (0x3 << 18)
19762306a36Sopenharmony_ci#define MXC_CCM_PMCR0_PTVIS                     0x00020000
19862306a36Sopenharmony_ci#define MXC_CCM_PMCR0_UPDTEN                    0x00010000
19962306a36Sopenharmony_ci#define MXC_CCM_PMCR0_UPDTEN_MASK               (0x1 << 16)
20062306a36Sopenharmony_ci#define MXC_CCM_PMCR0_FSVAIM                    0x00008000
20162306a36Sopenharmony_ci#define MXC_CCM_PMCR0_FSVAI_OFFSET              13
20262306a36Sopenharmony_ci#define MXC_CCM_PMCR0_FSVAI_MASK                (0x3 << 13)
20362306a36Sopenharmony_ci#define MXC_CCM_PMCR0_DPVCR                     0x00001000
20462306a36Sopenharmony_ci#define MXC_CCM_PMCR0_DPVV                      0x00000800
20562306a36Sopenharmony_ci#define MXC_CCM_PMCR0_WFIM                      0x00000400
20662306a36Sopenharmony_ci#define MXC_CCM_PMCR0_DRCE3                     0x00000200
20762306a36Sopenharmony_ci#define MXC_CCM_PMCR0_DRCE2                     0x00000100
20862306a36Sopenharmony_ci#define MXC_CCM_PMCR0_DRCE1                     0x00000080
20962306a36Sopenharmony_ci#define MXC_CCM_PMCR0_DRCE0                     0x00000040
21062306a36Sopenharmony_ci#define MXC_CCM_PMCR0_DCR                       0x00000020
21162306a36Sopenharmony_ci#define MXC_CCM_PMCR0_DVFEN                     0x00000010
21262306a36Sopenharmony_ci#define MXC_CCM_PMCR0_PTVAIM                    0x00000008
21362306a36Sopenharmony_ci#define MXC_CCM_PMCR0_PTVAI_OFFSET              1
21462306a36Sopenharmony_ci#define MXC_CCM_PMCR0_PTVAI_MASK                (0x3 << 1)
21562306a36Sopenharmony_ci#define MXC_CCM_PMCR0_DPTEN                     0x00000001
21662306a36Sopenharmony_ci
21762306a36Sopenharmony_ci#define MXC_CCM_PMCR1_DVGP_OFFSET               0
21862306a36Sopenharmony_ci#define MXC_CCM_PMCR1_DVGP_MASK                 (0xF)
21962306a36Sopenharmony_ci
22062306a36Sopenharmony_ci#define MXC_CCM_PMCR1_PLLRDIS                      (0x1 << 7)
22162306a36Sopenharmony_ci#define MXC_CCM_PMCR1_EMIRQ_EN                      (0x1 << 8)
22262306a36Sopenharmony_ci
22362306a36Sopenharmony_ci#define MXC_CCM_DCVR_ULV_MASK                   (0x3FF << 22)
22462306a36Sopenharmony_ci#define MXC_CCM_DCVR_ULV_OFFSET                 22
22562306a36Sopenharmony_ci#define MXC_CCM_DCVR_LLV_MASK                   (0x3FF << 12)
22662306a36Sopenharmony_ci#define MXC_CCM_DCVR_LLV_OFFSET                 12
22762306a36Sopenharmony_ci#define MXC_CCM_DCVR_ELV_MASK                   (0x3FF << 2)
22862306a36Sopenharmony_ci#define MXC_CCM_DCVR_ELV_OFFSET                 2
22962306a36Sopenharmony_ci
23062306a36Sopenharmony_ci#define MXC_CCM_PDR2_MST2_PDF_MASK              (0x3F << 7)
23162306a36Sopenharmony_ci#define MXC_CCM_PDR2_MST2_PDF_OFFSET            7
23262306a36Sopenharmony_ci#define MXC_CCM_PDR2_MST1_PDF_MASK              0x3F
23362306a36Sopenharmony_ci#define MXC_CCM_PDR2_MST1_PDF_OFFSET            0
23462306a36Sopenharmony_ci
23562306a36Sopenharmony_ci#define MXC_CCM_COSR_CLKOSEL_MASK               0x0F
23662306a36Sopenharmony_ci#define MXC_CCM_COSR_CLKOSEL_OFFSET             0
23762306a36Sopenharmony_ci#define MXC_CCM_COSR_CLKOUTDIV_MASK             (0x07 << 6)
23862306a36Sopenharmony_ci#define MXC_CCM_COSR_CLKOUTDIV_OFFSET           6
23962306a36Sopenharmony_ci#define MXC_CCM_COSR_CLKOEN                     (1 << 9)
24062306a36Sopenharmony_ci
24162306a36Sopenharmony_ci/*
24262306a36Sopenharmony_ci * PMCR0 register offsets
24362306a36Sopenharmony_ci */
24462306a36Sopenharmony_ci#define MXC_CCM_PMCR0_LBFL_OFFSET   20
24562306a36Sopenharmony_ci#define MXC_CCM_PMCR0_DFSUP0_OFFSET 30
24662306a36Sopenharmony_ci#define MXC_CCM_PMCR0_DFSUP1_OFFSET 31
24762306a36Sopenharmony_ci
24862306a36Sopenharmony_ci#endif				/* __ARCH_ARM_MACH_MX3_CRM_REGS_H__ */
249