blob: 137b9f3b5981a2731eac938c73c1ba86b038dc8a [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Peng Faneae4de22018-01-10 13:20:37 +08002/*
Ye Li325cd012020-05-03 22:19:52 +08003 * Copyright 2017-2019 NXP
Peng Faneae4de22018-01-10 13:20:37 +08004 *
5 * Peng Fan <peng.fan@nxp.com>
Peng Faneae4de22018-01-10 13:20:37 +08006 */
7
8#include <common.h>
Simon Glass1d91ba72019-11-14 12:57:37 -07009#include <cpu_func.h>
Simon Glass97589732020-05-10 11:40:02 -060010#include <init.h>
Simon Glass0f2af882020-05-10 11:40:05 -060011#include <log.h>
Peng Faneae4de22018-01-10 13:20:37 +080012#include <asm/arch/imx-regs.h>
13#include <asm/io.h>
14#include <asm/arch/clock.h>
15#include <asm/arch/sys_proto.h>
16#include <asm/mach-imx/hab.h>
17#include <asm/mach-imx/boot_mode.h>
18#include <asm/mach-imx/syscounter.h>
19#include <asm/armv8/mmu.h>
Peng Fanc98e0322019-08-27 06:25:58 +000020#include <dm/uclass.h>
Peng Faneae4de22018-01-10 13:20:37 +080021#include <errno.h>
22#include <fdt_support.h>
23#include <fsl_wdog.h>
24#include <imx_sip.h>
25
26DECLARE_GLOBAL_DATA_PTR;
27
Stefano Babicf8b509b2019-09-20 08:47:53 +020028#if defined(CONFIG_IMX_HAB)
Peng Faneae4de22018-01-10 13:20:37 +080029struct imx_sec_config_fuse_t const imx_sec_config_fuse = {
30 .bank = 1,
31 .word = 3,
32};
33#endif
34
35int timer_init(void)
36{
37#ifdef CONFIG_SPL_BUILD
38 struct sctr_regs *sctr = (struct sctr_regs *)SYSCNT_CTRL_BASE_ADDR;
39 unsigned long freq = readl(&sctr->cntfid0);
40
41 /* Update with accurate clock frequency */
42 asm volatile("msr cntfrq_el0, %0" : : "r" (freq) : "memory");
43
44 clrsetbits_le32(&sctr->cntcr, SC_CNTCR_FREQ0 | SC_CNTCR_FREQ1,
45 SC_CNTCR_FREQ0 | SC_CNTCR_ENABLE | SC_CNTCR_HDBG);
46#endif
47
48 gd->arch.tbl = 0;
49 gd->arch.tbu = 0;
50
51 return 0;
52}
53
54void enable_tzc380(void)
55{
56 struct iomuxc_gpr_base_regs *gpr =
57 (struct iomuxc_gpr_base_regs *)IOMUXC_GPR_BASE_ADDR;
58
59 /* Enable TZASC and lock setting */
60 setbits_le32(&gpr->gpr[10], GPR_TZASC_EN);
61 setbits_le32(&gpr->gpr[10], GPR_TZASC_EN_LOCK);
Peng Fanc0e47fc2019-12-27 10:19:42 +080062 if (is_imx8mm() || is_imx8mn() || is_imx8mp())
Peng Fan99047fc2019-08-27 06:25:30 +000063 setbits_le32(&gpr->gpr[10], BIT(1));
Ye Li4c97c462019-08-27 06:25:34 +000064 /*
65 * set Region 0 attribute to allow secure and non-secure
66 * read/write permission. Found some masters like usb dwc3
67 * controllers can't work with secure memory.
68 */
69 writel(0xf0000000, TZASC_BASE_ADDR + 0x108);
Peng Faneae4de22018-01-10 13:20:37 +080070}
71
72void set_wdog_reset(struct wdog_regs *wdog)
73{
74 /*
75 * Output WDOG_B signal to reset external pmic or POR_B decided by
76 * the board design. Without external reset, the peripherals/DDR/
77 * PMIC are not reset, that may cause system working abnormal.
78 * WDZST bit is write-once only bit. Align this bit in kernel,
79 * otherwise kernel code will have no chance to set this bit.
80 */
81 setbits_le16(&wdog->wcr, WDOG_WDT_MASK | WDOG_WDZST_MASK);
82}
83
84static struct mm_region imx8m_mem_map[] = {
85 {
86 /* ROM */
87 .virt = 0x0UL,
88 .phys = 0x0UL,
89 .size = 0x100000UL,
90 .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
91 PTE_BLOCK_OUTER_SHARE
92 }, {
Gary Bisson5c72a452018-11-14 17:55:28 +010093 /* CAAM */
94 .virt = 0x100000UL,
95 .phys = 0x100000UL,
96 .size = 0x8000UL,
97 .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
98 PTE_BLOCK_NON_SHARE |
99 PTE_BLOCK_PXN | PTE_BLOCK_UXN
100 }, {
101 /* TCM */
102 .virt = 0x7C0000UL,
103 .phys = 0x7C0000UL,
104 .size = 0x80000UL,
105 .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
106 PTE_BLOCK_NON_SHARE |
107 PTE_BLOCK_PXN | PTE_BLOCK_UXN
108 }, {
Peng Faneae4de22018-01-10 13:20:37 +0800109 /* OCRAM */
110 .virt = 0x900000UL,
111 .phys = 0x900000UL,
112 .size = 0x200000UL,
113 .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
114 PTE_BLOCK_OUTER_SHARE
115 }, {
116 /* AIPS */
117 .virt = 0xB00000UL,
118 .phys = 0xB00000UL,
119 .size = 0x3f500000UL,
120 .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
121 PTE_BLOCK_NON_SHARE |
122 PTE_BLOCK_PXN | PTE_BLOCK_UXN
123 }, {
124 /* DRAM1 */
125 .virt = 0x40000000UL,
126 .phys = 0x40000000UL,
Peng Fanb749b5e2019-08-27 06:25:27 +0000127 .size = PHYS_SDRAM_SIZE,
Peng Faneae4de22018-01-10 13:20:37 +0800128 .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
129 PTE_BLOCK_OUTER_SHARE
Peng Fanb749b5e2019-08-27 06:25:27 +0000130#ifdef PHYS_SDRAM_2_SIZE
Peng Faneae4de22018-01-10 13:20:37 +0800131 }, {
132 /* DRAM2 */
133 .virt = 0x100000000UL,
134 .phys = 0x100000000UL,
Peng Fanb749b5e2019-08-27 06:25:27 +0000135 .size = PHYS_SDRAM_2_SIZE,
Peng Faneae4de22018-01-10 13:20:37 +0800136 .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
137 PTE_BLOCK_OUTER_SHARE
Peng Fanb749b5e2019-08-27 06:25:27 +0000138#endif
Peng Faneae4de22018-01-10 13:20:37 +0800139 }, {
140 /* List terminator */
141 0,
142 }
143};
144
145struct mm_region *mem_map = imx8m_mem_map;
146
Peng Fanb749b5e2019-08-27 06:25:27 +0000147void enable_caches(void)
148{
149 /*
150 * If OPTEE runs, remove OPTEE memory from MMU table to
151 * avoid speculative prefetch. OPTEE runs at the top of
152 * the first memory bank
153 */
154 if (rom_pointer[1])
155 imx8m_mem_map[5].size -= rom_pointer[1];
156
157 icache_enable();
158 dcache_enable();
159}
160
Peng Fan1caffdf2019-08-27 06:25:17 +0000161static u32 get_cpu_variant_type(u32 type)
162{
163 struct ocotp_regs *ocotp = (struct ocotp_regs *)OCOTP_BASE_ADDR;
164 struct fuse_bank *bank = &ocotp->bank[1];
165 struct fuse_bank1_regs *fuse =
166 (struct fuse_bank1_regs *)bank->fuse_regs;
167
168 u32 value = readl(&fuse->tester4);
169
Peng Fan67815082020-02-05 17:34:54 +0800170 if (type == MXC_CPU_IMX8MQ) {
171 if ((value & 0x3) == 0x2)
172 return MXC_CPU_IMX8MD;
173 else if (value & 0x200000)
174 return MXC_CPU_IMX8MQL;
175
176 } else if (type == MXC_CPU_IMX8MM) {
Peng Fan1caffdf2019-08-27 06:25:17 +0000177 switch (value & 0x3) {
178 case 2:
179 if (value & 0x1c0000)
180 return MXC_CPU_IMX8MMDL;
181 else
182 return MXC_CPU_IMX8MMD;
183 case 3:
184 if (value & 0x1c0000)
185 return MXC_CPU_IMX8MMSL;
186 else
187 return MXC_CPU_IMX8MMS;
188 default:
189 if (value & 0x1c0000)
190 return MXC_CPU_IMX8MML;
191 break;
192 }
Peng Fan1a07d912020-02-05 17:39:27 +0800193 } else if (type == MXC_CPU_IMX8MN) {
194 switch (value & 0x3) {
195 case 2:
196 if (value & 0x1000000)
197 return MXC_CPU_IMX8MNDL;
198 else
199 return MXC_CPU_IMX8MND;
200 case 3:
201 if (value & 0x1000000)
202 return MXC_CPU_IMX8MNSL;
203 else
204 return MXC_CPU_IMX8MNS;
205 default:
206 if (value & 0x1000000)
207 return MXC_CPU_IMX8MNL;
208 break;
209 }
Peng Fan1caffdf2019-08-27 06:25:17 +0000210 }
211
212 return type;
213}
214
Peng Faneae4de22018-01-10 13:20:37 +0800215u32 get_cpu_rev(void)
216{
217 struct anamix_pll *ana_pll = (struct anamix_pll *)ANATOP_BASE_ADDR;
218 u32 reg = readl(&ana_pll->digprog);
219 u32 type = (reg >> 16) & 0xff;
Peng Fan1caffdf2019-08-27 06:25:17 +0000220 u32 major_low = (reg >> 8) & 0xff;
Peng Faneae4de22018-01-10 13:20:37 +0800221 u32 rom_version;
222
223 reg &= 0xff;
224
Peng Fan69cec072019-12-27 10:14:02 +0800225 /* iMX8MP */
226 if (major_low == 0x43) {
227 return (MXC_CPU_IMX8MP << 12) | reg;
228 } else if (major_low == 0x42) {
229 /* iMX8MN */
Peng Fan1a07d912020-02-05 17:39:27 +0800230 type = get_cpu_variant_type(MXC_CPU_IMX8MN);
Peng Fan5d2f2062019-06-27 17:23:49 +0800231 } else if (major_low == 0x41) {
Peng Fan1caffdf2019-08-27 06:25:17 +0000232 type = get_cpu_variant_type(MXC_CPU_IMX8MM);
233 } else {
234 if (reg == CHIP_REV_1_0) {
235 /*
Peng Fanc23fbdd2019-10-16 10:24:17 +0000236 * For B0 chip, the DIGPROG is not updated,
237 * it is still TO1.0. we have to check ROM
238 * version or OCOTP_READ_FUSE_DATA.
239 * 0xff0055aa is magic number for B1.
Peng Fan1caffdf2019-08-27 06:25:17 +0000240 */
Peng Fanc23fbdd2019-10-16 10:24:17 +0000241 if (readl((void __iomem *)(OCOTP_BASE_ADDR + 0x40)) == 0xff0055aa) {
242 reg = CHIP_REV_2_1;
243 } else {
244 rom_version =
245 readl((void __iomem *)ROM_VERSION_A0);
246 if (rom_version != CHIP_REV_1_0) {
247 rom_version = readl((void __iomem *)ROM_VERSION_B0);
Patrick Wildtd4a78b92019-11-19 09:42:06 +0100248 rom_version &= 0xff;
Peng Fanc23fbdd2019-10-16 10:24:17 +0000249 if (rom_version == CHIP_REV_2_0)
250 reg = CHIP_REV_2_0;
251 }
Peng Fan1caffdf2019-08-27 06:25:17 +0000252 }
Peng Faneae4de22018-01-10 13:20:37 +0800253 }
Peng Fan67815082020-02-05 17:34:54 +0800254
255 type = get_cpu_variant_type(type);
Peng Faneae4de22018-01-10 13:20:37 +0800256 }
257
258 return (type << 12) | reg;
259}
260
261static void imx_set_wdog_powerdown(bool enable)
262{
263 struct wdog_regs *wdog1 = (struct wdog_regs *)WDOG1_BASE_ADDR;
264 struct wdog_regs *wdog2 = (struct wdog_regs *)WDOG2_BASE_ADDR;
265 struct wdog_regs *wdog3 = (struct wdog_regs *)WDOG3_BASE_ADDR;
266
267 /* Write to the PDE (Power Down Enable) bit */
268 writew(enable, &wdog1->wmcr);
269 writew(enable, &wdog2->wmcr);
270 writew(enable, &wdog3->wmcr);
271}
272
Peng Fanc98e0322019-08-27 06:25:58 +0000273int arch_cpu_init_dm(void)
274{
275 struct udevice *dev;
276 int ret;
277
Peng Fan3c073342019-10-16 03:01:51 +0000278 if (CONFIG_IS_ENABLED(CLK)) {
279 ret = uclass_get_device_by_name(UCLASS_CLK,
280 "clock-controller@30380000",
281 &dev);
282 if (ret < 0) {
283 printf("Failed to find clock node. Check device tree\n");
284 return ret;
285 }
Peng Fanc98e0322019-08-27 06:25:58 +0000286 }
287
288 return 0;
289}
290
Peng Faneae4de22018-01-10 13:20:37 +0800291int arch_cpu_init(void)
292{
Peng Fanc0b30d72019-04-17 09:41:16 +0000293 struct ocotp_regs *ocotp = (struct ocotp_regs *)OCOTP_BASE_ADDR;
Peng Faneae4de22018-01-10 13:20:37 +0800294 /*
Peng Fand0ca2892019-08-27 06:25:37 +0000295 * ROM might disable clock for SCTR,
296 * enable the clock before timer_init.
297 */
298 if (IS_ENABLED(CONFIG_SPL_BUILD))
299 clock_enable(CCGR_SCTR, 1);
300 /*
Peng Faneae4de22018-01-10 13:20:37 +0800301 * Init timer at very early state, because sscg pll setting
302 * will use it
303 */
304 timer_init();
305
306 if (IS_ENABLED(CONFIG_SPL_BUILD)) {
307 clock_init();
308 imx_set_wdog_powerdown(false);
309 }
310
Peng Fanc0b30d72019-04-17 09:41:16 +0000311 if (is_imx8mq()) {
312 clock_enable(CCGR_OCOTP, 1);
313 if (readl(&ocotp->ctrl) & 0x200)
314 writel(0x200, &ocotp->ctrl_clr);
315 }
316
Peng Faneae4de22018-01-10 13:20:37 +0800317 return 0;
318}
319
Peng Fanc9823b02019-09-16 03:09:36 +0000320#if defined(CONFIG_IMX8MN) || defined(CONFIG_IMX8MP)
321struct rom_api *g_rom_api = (struct rom_api *)0x980;
322
323enum boot_device get_boot_device(void)
324{
325 volatile gd_t *pgd = gd;
326 int ret;
327 u32 boot;
328 u16 boot_type;
329 u8 boot_instance;
330 enum boot_device boot_dev = SD1_BOOT;
331
332 ret = g_rom_api->query_boot_infor(QUERY_BT_DEV, &boot,
333 ((uintptr_t)&boot) ^ QUERY_BT_DEV);
334 gd = pgd;
335
336 if (ret != ROM_API_OKAY) {
337 puts("ROMAPI: failure at query_boot_info\n");
338 return -1;
339 }
340
341 boot_type = boot >> 16;
342 boot_instance = (boot >> 8) & 0xff;
343
344 switch (boot_type) {
345 case BT_DEV_TYPE_SD:
346 boot_dev = boot_instance + SD1_BOOT;
347 break;
348 case BT_DEV_TYPE_MMC:
349 boot_dev = boot_instance + MMC1_BOOT;
350 break;
351 case BT_DEV_TYPE_NAND:
352 boot_dev = NAND_BOOT;
353 break;
354 case BT_DEV_TYPE_FLEXSPINOR:
355 boot_dev = QSPI_BOOT;
356 break;
357 case BT_DEV_TYPE_USB:
358 boot_dev = USB_BOOT;
359 break;
360 default:
361 break;
362 }
363
364 return boot_dev;
365}
366#endif
367
Peng Faneae4de22018-01-10 13:20:37 +0800368bool is_usb_boot(void)
369{
370 return get_boot_device() == USB_BOOT;
371}
372
373#ifdef CONFIG_OF_SYSTEM_SETUP
374int ft_system_setup(void *blob, bd_t *bd)
375{
376 int i = 0;
377 int rc;
378 int nodeoff;
379
380 /* Disable the CPU idle for A0 chip since the HW does not support it */
381 if (is_soc_rev(CHIP_REV_1_0)) {
382 static const char * const nodes_path[] = {
383 "/cpus/cpu@0",
384 "/cpus/cpu@1",
385 "/cpus/cpu@2",
386 "/cpus/cpu@3",
387 };
388
389 for (i = 0; i < ARRAY_SIZE(nodes_path); i++) {
390 nodeoff = fdt_path_offset(blob, nodes_path[i]);
391 if (nodeoff < 0)
392 continue; /* Not found, skip it */
393
Marek Vasute2e7a772020-04-24 21:37:33 +0200394 debug("Found %s node\n", nodes_path[i]);
Peng Faneae4de22018-01-10 13:20:37 +0800395
396 rc = fdt_delprop(blob, nodeoff, "cpu-idle-states");
Marek Vasute2e7a772020-04-24 21:37:33 +0200397 if (rc == -FDT_ERR_NOTFOUND)
398 continue;
Peng Faneae4de22018-01-10 13:20:37 +0800399 if (rc) {
400 printf("Unable to update property %s:%s, err=%s\n",
401 nodes_path[i], "status", fdt_strerror(rc));
402 return rc;
403 }
404
Marek Vasute2e7a772020-04-24 21:37:33 +0200405 debug("Remove %s:%s\n", nodes_path[i],
Peng Faneae4de22018-01-10 13:20:37 +0800406 "cpu-idle-states");
407 }
408 }
409
410 return 0;
411}
412#endif
413
Marek Vasut64dc4de2020-04-29 15:04:21 +0200414#if !CONFIG_IS_ENABLED(SYSRESET)
Peng Faneae4de22018-01-10 13:20:37 +0800415void reset_cpu(ulong addr)
416{
Claudius Heinee73f3942020-04-29 15:04:23 +0200417 struct watchdog_regs *wdog = (struct watchdog_regs *)WDOG1_BASE_ADDR;
Peng Faneae4de22018-01-10 13:20:37 +0800418
Ye Li54a915a2019-12-09 00:47:18 -0800419 /* Clear WDA to trigger WDOG_B immediately */
420 writew((SET_WCR_WT(1) | WCR_WDT | WCR_WDE | WCR_SRS), &wdog->wcr);
Peng Fan24290d92019-08-27 06:25:41 +0000421
Ye Li54a915a2019-12-09 00:47:18 -0800422 while (1) {
423 /*
Harald Seilerec0c4472020-04-29 15:04:22 +0200424 * spin for .5 seconds before reset
Ye Li54a915a2019-12-09 00:47:18 -0800425 */
426 }
Peng Faneae4de22018-01-10 13:20:37 +0800427}
Peng Fan24290d92019-08-27 06:25:41 +0000428#endif
Peng Fan5760d8d2020-04-22 10:51:13 +0800429
430#if defined(CONFIG_ARCH_MISC_INIT)
431static void acquire_buildinfo(void)
432{
433 u64 atf_commit = 0;
434
435 /* Get ARM Trusted Firmware commit id */
436 atf_commit = call_imx_sip(IMX_SIP_BUILDINFO,
437 IMX_SIP_BUILDINFO_GET_COMMITHASH, 0, 0, 0);
438 if (atf_commit == 0xffffffff) {
439 debug("ATF does not support build info\n");
440 atf_commit = 0x30; /* Display 0, 0 ascii is 0x30 */
441 }
442
443 printf("\n BuildInfo:\n - ATF %s\n\n", (char *)&atf_commit);
444}
445
446int arch_misc_init(void)
447{
448 acquire_buildinfo();
449
450 return 0;
451}
452#endif
Ye Li325cd012020-05-03 22:19:52 +0800453
454void imx_tmu_arch_init(void *reg_base)
455{
Ye Lia00f2f02020-05-03 22:19:53 +0800456 if (is_imx8mm() || is_imx8mn()) {
Ye Li325cd012020-05-03 22:19:52 +0800457 /* Load TCALIV and TASR from fuses */
458 struct ocotp_regs *ocotp =
459 (struct ocotp_regs *)OCOTP_BASE_ADDR;
460 struct fuse_bank *bank = &ocotp->bank[3];
461 struct fuse_bank3_regs *fuse =
462 (struct fuse_bank3_regs *)bank->fuse_regs;
463
464 u32 tca_rt, tca_hr, tca_en;
465 u32 buf_vref, buf_slope;
466
467 tca_rt = fuse->ana0 & 0xFF;
468 tca_hr = (fuse->ana0 & 0xFF00) >> 8;
469 tca_en = (fuse->ana0 & 0x2000000) >> 25;
470
471 buf_vref = (fuse->ana0 & 0x1F00000) >> 20;
472 buf_slope = (fuse->ana0 & 0xF0000) >> 16;
473
474 writel(buf_vref | (buf_slope << 16), (ulong)reg_base + 0x28);
475 writel((tca_en << 31) | (tca_hr << 16) | tca_rt,
476 (ulong)reg_base + 0x30);
477 }
Ye Li41a20252020-05-03 22:19:54 +0800478#ifdef CONFIG_IMX8MP
479 /* Load TCALIV0/1/m40 and TRIM from fuses */
480 struct ocotp_regs *ocotp = (struct ocotp_regs *)OCOTP_BASE_ADDR;
481 struct fuse_bank *bank = &ocotp->bank[38];
482 struct fuse_bank38_regs *fuse =
483 (struct fuse_bank38_regs *)bank->fuse_regs;
484 struct fuse_bank *bank2 = &ocotp->bank[39];
485 struct fuse_bank39_regs *fuse2 =
486 (struct fuse_bank39_regs *)bank2->fuse_regs;
487 u32 buf_vref, buf_slope, bjt_cur, vlsb, bgr;
488 u32 reg;
489 u32 tca40[2], tca25[2], tca105[2];
490
491 /* For blank sample */
492 if (!fuse->ana_trim2 && !fuse->ana_trim3 &&
493 !fuse->ana_trim4 && !fuse2->ana_trim5) {
494 /* Use a default 25C binary codes */
495 tca25[0] = 1596;
Ye Lid756ca02020-05-03 22:19:55 +0800496 tca25[1] = 1596;
Ye Li41a20252020-05-03 22:19:54 +0800497 writel(tca25[0], (ulong)reg_base + 0x30);
Ye Lid756ca02020-05-03 22:19:55 +0800498 writel(tca25[1], (ulong)reg_base + 0x34);
Ye Li41a20252020-05-03 22:19:54 +0800499 return;
500 }
501
502 buf_vref = (fuse->ana_trim2 & 0xc0) >> 6;
503 buf_slope = (fuse->ana_trim2 & 0xF00) >> 8;
504 bjt_cur = (fuse->ana_trim2 & 0xF000) >> 12;
505 bgr = (fuse->ana_trim2 & 0xF0000) >> 16;
506 vlsb = (fuse->ana_trim2 & 0xF00000) >> 20;
507 writel(buf_vref | (buf_slope << 16), (ulong)reg_base + 0x28);
508
509 reg = (bgr << 28) | (bjt_cur << 20) | (vlsb << 12) | (1 << 7);
510 writel(reg, (ulong)reg_base + 0x3c);
511
512 tca40[0] = (fuse->ana_trim3 & 0xFFF0000) >> 16;
513 tca25[0] = (fuse->ana_trim3 & 0xF0000000) >> 28;
514 tca25[0] |= ((fuse->ana_trim4 & 0xFF) << 4);
515 tca105[0] = (fuse->ana_trim4 & 0xFFF00) >> 8;
516 tca40[1] = (fuse->ana_trim4 & 0xFFF00000) >> 20;
517 tca25[1] = fuse2->ana_trim5 & 0xFFF;
518 tca105[1] = (fuse2->ana_trim5 & 0xFFF000) >> 12;
519
520 /* use 25c for 1p calibration */
521 writel(tca25[0] | (tca105[0] << 16), (ulong)reg_base + 0x30);
522 writel(tca25[1] | (tca105[1] << 16), (ulong)reg_base + 0x34);
523 writel(tca40[0] | (tca40[1] << 16), (ulong)reg_base + 0x38);
524#endif
Ye Li325cd012020-05-03 22:19:52 +0800525}