hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/arch/arm/mach-imx/anatop.c
....@@ -1,13 +1,7 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Copyright (C) 2013-2015 Freescale Semiconductor, Inc.
34 * Copyright 2017-2018 NXP.
4
- *
5
- * The code contained herein is licensed under the GNU General Public
6
- * License. You may obtain a copy of the GNU General Public License
7
- * Version 2 or later at the following locations:
8
- *
9
- * http://www.opensource.org/licenses/gpl-license.html
10
- * http://www.gnu.org/copyleft/gpl.html
115 */
126
137 #include <linux/err.h>
....@@ -25,11 +19,11 @@
2519 #define ANADIG_REG_2P5 0x130
2620 #define ANADIG_REG_CORE 0x140
2721 #define ANADIG_ANA_MISC0 0x150
28
-#define ANADIG_USB1_CHRG_DETECT 0x1b0
29
-#define ANADIG_USB2_CHRG_DETECT 0x210
3022 #define ANADIG_DIGPROG 0x260
3123 #define ANADIG_DIGPROG_IMX6SL 0x280
3224 #define ANADIG_DIGPROG_IMX7D 0x800
25
+
26
+#define SRC_SBMR2 0x1c
3327
3428 #define BM_ANADIG_REG_2P5_ENABLE_WEAK_LINREG 0x40000
3529 #define BM_ANADIG_REG_2P5_ENABLE_PULLDOWN 0x8
....@@ -37,8 +31,6 @@
3731 #define BM_ANADIG_ANA_MISC0_STOP_MODE_CONFIG 0x1000
3832 /* Below MISC0_DISCON_HIGH_SNVS is only for i.MX6SL */
3933 #define BM_ANADIG_ANA_MISC0_DISCON_HIGH_SNVS 0x2000
40
-#define BM_ANADIG_USB_CHRG_DETECT_CHK_CHRG_B 0x80000
41
-#define BM_ANADIG_USB_CHRG_DETECT_EN_B 0x100000
4234
4335 static struct regmap *anatop;
4436
....@@ -97,22 +89,11 @@
9789
9890 if (cpu_is_imx6sl())
9991 imx_anatop_disconnect_high_snvs(false);
100
-
101
-}
102
-
103
-static void imx_anatop_usb_chrg_detect_disable(void)
104
-{
105
- regmap_write(anatop, ANADIG_USB1_CHRG_DETECT,
106
- BM_ANADIG_USB_CHRG_DETECT_EN_B
107
- | BM_ANADIG_USB_CHRG_DETECT_CHK_CHRG_B);
108
- regmap_write(anatop, ANADIG_USB2_CHRG_DETECT,
109
- BM_ANADIG_USB_CHRG_DETECT_EN_B |
110
- BM_ANADIG_USB_CHRG_DETECT_CHK_CHRG_B);
11192 }
11293
11394 void __init imx_init_revision_from_anatop(void)
11495 {
115
- struct device_node *np;
96
+ struct device_node *np, *src_np;
11697 void __iomem *anatop_base;
11798 unsigned int revision;
11899 u32 digprog;
....@@ -148,7 +129,27 @@
148129 major_part = (digprog >> 8) & 0xf;
149130 minor_part = digprog & 0xf;
150131 revision = ((major_part + 1) << 4) | minor_part;
132
+
133
+ if ((digprog >> 16) == MXC_CPU_IMX6ULL) {
134
+ void __iomem *src_base;
135
+ u32 sbmr2;
136
+
137
+ src_np = of_find_compatible_node(NULL, NULL,
138
+ "fsl,imx6ul-src");
139
+ src_base = of_iomap(src_np, 0);
140
+ of_node_put(src_np);
141
+ WARN_ON(!src_base);
142
+ sbmr2 = readl_relaxed(src_base + SRC_SBMR2);
143
+ iounmap(src_base);
144
+
145
+ /* src_sbmr2 bit 6 is to identify if it is i.MX6ULZ */
146
+ if (sbmr2 & (1 << 6)) {
147
+ digprog &= ~(0xff << 16);
148
+ digprog |= (MXC_CPU_IMX6ULZ << 16);
149
+ }
150
+ }
151151 }
152
+ of_node_put(np);
152153
153154 mxc_set_cpu_type(digprog >> 16 & 0xff);
154155 imx_set_soc_revision(revision);
....@@ -157,10 +158,6 @@
157158 void __init imx_anatop_init(void)
158159 {
159160 anatop = syscon_regmap_lookup_by_compatible("fsl,imx6q-anatop");
160
- if (IS_ERR(anatop)) {
161
+ if (IS_ERR(anatop))
161162 pr_err("%s: failed to find imx6q-anatop regmap!\n", __func__);
162
- return;
163
- }
164
-
165
- imx_anatop_usb_chrg_detect_disable();
166163 }