.. | .. |
---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ |
---|
1 | 2 | /* |
---|
2 | 3 | * include/linux/clk/at91_pmc.h |
---|
3 | 4 | * |
---|
.. | .. |
---|
6 | 7 | * |
---|
7 | 8 | * Power Management Controller (PMC) - System peripherals registers. |
---|
8 | 9 | * Based on AT91RM9200 datasheet revision E. |
---|
9 | | - * |
---|
10 | | - * This program is free software; you can redistribute it and/or modify |
---|
11 | | - * it under the terms of the GNU General Public License as published by |
---|
12 | | - * the Free Software Foundation; either version 2 of the License, or |
---|
13 | | - * (at your option) any later version. |
---|
14 | 10 | */ |
---|
15 | 11 | |
---|
16 | 12 | #ifndef AT91_PMC_H |
---|
17 | 13 | #define AT91_PMC_H |
---|
| 14 | + |
---|
| 15 | +#define AT91_PMC_V1 (1) /* PMC version 1 */ |
---|
| 16 | +#define AT91_PMC_V2 (2) /* PMC version 2 [SAM9X60] */ |
---|
18 | 17 | |
---|
19 | 18 | #define AT91_PMC_SCER 0x00 /* System Clock Enable Register */ |
---|
20 | 19 | #define AT91_PMC_SCDR 0x04 /* System Clock Disable Register */ |
---|
.. | .. |
---|
34 | 33 | #define AT91_PMC_HCK0 (1 << 16) /* AHB Clock (USB host) [AT91SAM9261 only] */ |
---|
35 | 34 | #define AT91_PMC_HCK1 (1 << 17) /* AHB Clock (LCD) [AT91SAM9261 only] */ |
---|
36 | 35 | |
---|
| 36 | +#define AT91_PMC_PLL_CTRL0 0x0C /* PLL Control Register 0 [for SAM9X60] */ |
---|
| 37 | +#define AT91_PMC_PLL_CTRL0_ENPLL (1 << 28) /* Enable PLL */ |
---|
| 38 | +#define AT91_PMC_PLL_CTRL0_ENPLLCK (1 << 29) /* Enable PLL clock for PMC */ |
---|
| 39 | +#define AT91_PMC_PLL_CTRL0_ENLOCK (1 << 31) /* Enable PLL lock */ |
---|
| 40 | + |
---|
| 41 | +#define AT91_PMC_PLL_CTRL1 0x10 /* PLL Control Register 1 [for SAM9X60] */ |
---|
| 42 | + |
---|
37 | 43 | #define AT91_PMC_PCER 0x10 /* Peripheral Clock Enable Register */ |
---|
38 | 44 | #define AT91_PMC_PCDR 0x14 /* Peripheral Clock Disable Register */ |
---|
39 | 45 | #define AT91_PMC_PCSR 0x18 /* Peripheral Clock Status Register */ |
---|
| 46 | + |
---|
| 47 | +#define AT91_PMC_PLL_ACR 0x18 /* PLL Analog Control Register [for SAM9X60] */ |
---|
| 48 | +#define AT91_PMC_PLL_ACR_DEFAULT_UPLL 0x12020010UL /* Default PLL ACR value for UPLL */ |
---|
| 49 | +#define AT91_PMC_PLL_ACR_DEFAULT_PLLA 0x00020010UL /* Default PLL ACR value for PLLA */ |
---|
| 50 | +#define AT91_PMC_PLL_ACR_UTMIVR (1 << 12) /* UPLL Voltage regulator Control */ |
---|
| 51 | +#define AT91_PMC_PLL_ACR_UTMIBG (1 << 13) /* UPLL Bandgap Control */ |
---|
40 | 52 | |
---|
41 | 53 | #define AT91_CKGR_UCKR 0x1C /* UTMI Clock Register [some SAM9] */ |
---|
42 | 54 | #define AT91_PMC_UPLLEN (1 << 16) /* UTMI PLL Enable */ |
---|
43 | 55 | #define AT91_PMC_UPLLCOUNT (0xf << 20) /* UTMI PLL Start-up Time */ |
---|
44 | 56 | #define AT91_PMC_BIASEN (1 << 24) /* UTMI BIAS Enable */ |
---|
45 | 57 | #define AT91_PMC_BIASCOUNT (0xf << 28) /* UTMI BIAS Start-up Time */ |
---|
| 58 | + |
---|
| 59 | +#define AT91_PMC_PLL_UPDT 0x1C /* PMC PLL update register [for SAM9X60] */ |
---|
| 60 | +#define AT91_PMC_PLL_UPDT_UPDATE (1 << 8) /* Update PLL settings */ |
---|
| 61 | +#define AT91_PMC_PLL_UPDT_ID (1 << 0) /* PLL ID */ |
---|
| 62 | +#define AT91_PMC_PLL_UPDT_ID_MSK (0xf) /* PLL ID mask */ |
---|
| 63 | +#define AT91_PMC_PLL_UPDT_STUPTIM (0xff << 16) /* Startup time */ |
---|
46 | 64 | |
---|
47 | 65 | #define AT91_CKGR_MOR 0x20 /* Main Oscillator Register [not on SAM9RL] */ |
---|
48 | 66 | #define AT91_PMC_MOSCEN (1 << 0) /* Main Oscillator Enable */ |
---|
.. | .. |
---|
73 | 91 | #define AT91_PMC_USBDIV_2 (1 << 28) |
---|
74 | 92 | #define AT91_PMC_USBDIV_4 (2 << 28) |
---|
75 | 93 | #define AT91_PMC_USB96M (1 << 28) /* Divider by 2 Enable (PLLB only) */ |
---|
| 94 | + |
---|
| 95 | +#define AT91_PMC_CPU_CKR 0x28 /* CPU Clock Register */ |
---|
76 | 96 | |
---|
77 | 97 | #define AT91_PMC_MCKR 0x30 /* Master Clock Register */ |
---|
78 | 98 | #define AT91_PMC_CSS (3 << 0) /* Master Clock Selection */ |
---|
.. | .. |
---|
117 | 137 | #define AT91_PMC_PLLADIV2_ON (1 << 12) |
---|
118 | 138 | #define AT91_PMC_H32MXDIV BIT(24) |
---|
119 | 139 | |
---|
| 140 | +#define AT91_PMC_XTALF 0x34 /* Main XTAL Frequency Register [SAMA7G5 only] */ |
---|
| 141 | + |
---|
120 | 142 | #define AT91_PMC_USB 0x38 /* USB Clock Register [some SAM9 only] */ |
---|
121 | 143 | #define AT91_PMC_USBS (0x1 << 0) /* USB OHCI Input clock selection */ |
---|
122 | 144 | #define AT91_PMC_USBS_PLLA (0 << 0) |
---|
.. | .. |
---|
155 | 177 | #define AT91_PMC_MOSCRCS (1 << 17) /* Main On-Chip RC [some SAM9] */ |
---|
156 | 178 | #define AT91_PMC_CFDEV (1 << 18) /* Clock Failure Detector Event [some SAM9] */ |
---|
157 | 179 | #define AT91_PMC_GCKRDY (1 << 24) /* Generated Clocks */ |
---|
| 180 | +#define AT91_PMC_MCKXRDY (1 << 26) /* Master Clock x [x=1..4] Ready Status */ |
---|
158 | 181 | #define AT91_PMC_IMR 0x6c /* Interrupt Mask Register */ |
---|
159 | 182 | |
---|
160 | 183 | #define AT91_PMC_FSMR 0x70 /* Fast Startup Mode Register */ |
---|
161 | 184 | #define AT91_PMC_FSTT(n) BIT(n) |
---|
| 185 | +#define AT91_PMC_RTTAL BIT(16) |
---|
162 | 186 | #define AT91_PMC_RTCAL BIT(17) /* RTC Alarm Enable */ |
---|
163 | 187 | #define AT91_PMC_USBAL BIT(18) /* USB Resume Enable */ |
---|
164 | 188 | #define AT91_PMC_SDMMC_CD BIT(19) /* SDMMC Card Detect Enable */ |
---|
.. | .. |
---|
181 | 205 | #define AT91_PMC_WPVS (0x1 << 0) /* Write Protect Violation Status */ |
---|
182 | 206 | #define AT91_PMC_WPVSRC (0xffff << 8) /* Write Protect Violation Source */ |
---|
183 | 207 | |
---|
| 208 | +#define AT91_PMC_PLL_ISR0 0xEC /* PLL Interrupt Status Register 0 [SAM9X60 only] */ |
---|
| 209 | + |
---|
184 | 210 | #define AT91_PMC_PCER1 0x100 /* Peripheral Clock Enable Register 1 [SAMA5 only]*/ |
---|
185 | 211 | #define AT91_PMC_PCDR1 0x104 /* Peripheral Clock Enable Register 1 */ |
---|
186 | 212 | #define AT91_PMC_PCSR1 0x108 /* Peripheral Clock Enable Register 1 */ |
---|
187 | 213 | |
---|
188 | 214 | #define AT91_PMC_PCR 0x10c /* Peripheral Control Register [some SAM9 and SAMA5] */ |
---|
189 | 215 | #define AT91_PMC_PCR_PID_MASK 0x3f |
---|
190 | | -#define AT91_PMC_PCR_GCKCSS_OFFSET 8 |
---|
191 | | -#define AT91_PMC_PCR_GCKCSS_MASK (0x7 << AT91_PMC_PCR_GCKCSS_OFFSET) |
---|
192 | | -#define AT91_PMC_PCR_GCKCSS(n) ((n) << AT91_PMC_PCR_GCKCSS_OFFSET) /* GCK Clock Source Selection */ |
---|
193 | 216 | #define AT91_PMC_PCR_CMD (0x1 << 12) /* Command (read=0, write=1) */ |
---|
194 | | -#define AT91_PMC_PCR_DIV_OFFSET 16 |
---|
195 | | -#define AT91_PMC_PCR_DIV_MASK (0x3 << AT91_PMC_PCR_DIV_OFFSET) |
---|
196 | | -#define AT91_PMC_PCR_DIV(n) ((n) << AT91_PMC_PCR_DIV_OFFSET) /* Divisor Value */ |
---|
197 | | -#define AT91_PMC_PCR_GCKDIV_OFFSET 20 |
---|
198 | | -#define AT91_PMC_PCR_GCKDIV_MASK (0xff << AT91_PMC_PCR_GCKDIV_OFFSET) |
---|
199 | | -#define AT91_PMC_PCR_GCKDIV(n) ((n) << AT91_PMC_PCR_GCKDIV_OFFSET) /* Generated Clock Divisor Value */ |
---|
| 217 | +#define AT91_PMC_PCR_GCKDIV_MASK GENMASK(27, 20) |
---|
200 | 218 | #define AT91_PMC_PCR_EN (0x1 << 28) /* Enable */ |
---|
201 | 219 | #define AT91_PMC_PCR_GCKEN (0x1 << 29) /* GCK Enable */ |
---|
202 | 220 | |
---|