hc
2024-01-05 071106ecf68c401173c58808b1cf5f68cc50d390
kernel/include/linux/clk/at91_pmc.h
....@@ -1,3 +1,4 @@
1
+/* SPDX-License-Identifier: GPL-2.0-or-later */
12 /*
23 * include/linux/clk/at91_pmc.h
34 *
....@@ -6,15 +7,13 @@
67 *
78 * Power Management Controller (PMC) - System peripherals registers.
89 * 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.
1410 */
1511
1612 #ifndef AT91_PMC_H
1713 #define AT91_PMC_H
14
+
15
+#define AT91_PMC_V1 (1) /* PMC version 1 */
16
+#define AT91_PMC_V2 (2) /* PMC version 2 [SAM9X60] */
1817
1918 #define AT91_PMC_SCER 0x00 /* System Clock Enable Register */
2019 #define AT91_PMC_SCDR 0x04 /* System Clock Disable Register */
....@@ -34,15 +33,34 @@
3433 #define AT91_PMC_HCK0 (1 << 16) /* AHB Clock (USB host) [AT91SAM9261 only] */
3534 #define AT91_PMC_HCK1 (1 << 17) /* AHB Clock (LCD) [AT91SAM9261 only] */
3635
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
+
3743 #define AT91_PMC_PCER 0x10 /* Peripheral Clock Enable Register */
3844 #define AT91_PMC_PCDR 0x14 /* Peripheral Clock Disable Register */
3945 #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 */
4052
4153 #define AT91_CKGR_UCKR 0x1C /* UTMI Clock Register [some SAM9] */
4254 #define AT91_PMC_UPLLEN (1 << 16) /* UTMI PLL Enable */
4355 #define AT91_PMC_UPLLCOUNT (0xf << 20) /* UTMI PLL Start-up Time */
4456 #define AT91_PMC_BIASEN (1 << 24) /* UTMI BIAS Enable */
4557 #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 */
4664
4765 #define AT91_CKGR_MOR 0x20 /* Main Oscillator Register [not on SAM9RL] */
4866 #define AT91_PMC_MOSCEN (1 << 0) /* Main Oscillator Enable */
....@@ -73,6 +91,8 @@
7391 #define AT91_PMC_USBDIV_2 (1 << 28)
7492 #define AT91_PMC_USBDIV_4 (2 << 28)
7593 #define AT91_PMC_USB96M (1 << 28) /* Divider by 2 Enable (PLLB only) */
94
+
95
+#define AT91_PMC_CPU_CKR 0x28 /* CPU Clock Register */
7696
7797 #define AT91_PMC_MCKR 0x30 /* Master Clock Register */
7898 #define AT91_PMC_CSS (3 << 0) /* Master Clock Selection */
....@@ -117,6 +137,8 @@
117137 #define AT91_PMC_PLLADIV2_ON (1 << 12)
118138 #define AT91_PMC_H32MXDIV BIT(24)
119139
140
+#define AT91_PMC_XTALF 0x34 /* Main XTAL Frequency Register [SAMA7G5 only] */
141
+
120142 #define AT91_PMC_USB 0x38 /* USB Clock Register [some SAM9 only] */
121143 #define AT91_PMC_USBS (0x1 << 0) /* USB OHCI Input clock selection */
122144 #define AT91_PMC_USBS_PLLA (0 << 0)
....@@ -155,10 +177,12 @@
155177 #define AT91_PMC_MOSCRCS (1 << 17) /* Main On-Chip RC [some SAM9] */
156178 #define AT91_PMC_CFDEV (1 << 18) /* Clock Failure Detector Event [some SAM9] */
157179 #define AT91_PMC_GCKRDY (1 << 24) /* Generated Clocks */
180
+#define AT91_PMC_MCKXRDY (1 << 26) /* Master Clock x [x=1..4] Ready Status */
158181 #define AT91_PMC_IMR 0x6c /* Interrupt Mask Register */
159182
160183 #define AT91_PMC_FSMR 0x70 /* Fast Startup Mode Register */
161184 #define AT91_PMC_FSTT(n) BIT(n)
185
+#define AT91_PMC_RTTAL BIT(16)
162186 #define AT91_PMC_RTCAL BIT(17) /* RTC Alarm Enable */
163187 #define AT91_PMC_USBAL BIT(18) /* USB Resume Enable */
164188 #define AT91_PMC_SDMMC_CD BIT(19) /* SDMMC Card Detect Enable */
....@@ -181,22 +205,16 @@
181205 #define AT91_PMC_WPVS (0x1 << 0) /* Write Protect Violation Status */
182206 #define AT91_PMC_WPVSRC (0xffff << 8) /* Write Protect Violation Source */
183207
208
+#define AT91_PMC_PLL_ISR0 0xEC /* PLL Interrupt Status Register 0 [SAM9X60 only] */
209
+
184210 #define AT91_PMC_PCER1 0x100 /* Peripheral Clock Enable Register 1 [SAMA5 only]*/
185211 #define AT91_PMC_PCDR1 0x104 /* Peripheral Clock Enable Register 1 */
186212 #define AT91_PMC_PCSR1 0x108 /* Peripheral Clock Enable Register 1 */
187213
188214 #define AT91_PMC_PCR 0x10c /* Peripheral Control Register [some SAM9 and SAMA5] */
189215 #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 */
193216 #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)
200218 #define AT91_PMC_PCR_EN (0x1 << 28) /* Enable */
201219 #define AT91_PMC_PCR_GCKEN (0x1 << 29) /* GCK Enable */
202220