blob: 73e48a7d58ed6d12420a9e226d92d11b21072b27 [file] [log] [blame]
Scott Woodf64c98c2015-03-20 19:28:12 -07001/*
Mingkai Hu0e58b512015-10-26 19:47:50 +08002 * Copyright 2014-2015 Freescale Semiconductor
Scott Woodf64c98c2015-03-20 19:28:12 -07003 *
4 * SPDX-License-Identifier: GPL-2.0+
5 */
6
7#include <common.h>
8#include <fsl_ifc.h>
Mingkai Hu0e58b512015-10-26 19:47:50 +08009#include <asm/arch/soc.h>
Scott Woodae1df322015-03-20 19:28:13 -070010#include <asm/io.h>
Scott Wood8e728cd2015-03-24 13:25:02 -070011#include <asm/global_data.h>
12
13DECLARE_GLOBAL_DATA_PTR;
Scott Woodae1df322015-03-20 19:28:13 -070014
Mingkai Hu0e58b512015-10-26 19:47:50 +080015#ifdef CONFIG_LS2085A
Scott Woodae1df322015-03-20 19:28:13 -070016static void erratum_a008751(void)
17{
18#ifdef CONFIG_SYS_FSL_ERRATUM_A008751
19 u32 __iomem *scfg = (u32 __iomem *)SCFG_BASE;
20
21 writel(0x27672b2a, scfg + SCFG_USB3PRM1CR / 4);
22#endif
23}
Scott Woodf64c98c2015-03-20 19:28:12 -070024
Scott Wood8e728cd2015-03-24 13:25:02 -070025static void erratum_rcw_src(void)
26{
27#if defined(CONFIG_SPL)
28 u32 __iomem *dcfg_ccsr = (u32 __iomem *)DCFG_BASE;
29 u32 __iomem *dcfg_dcsr = (u32 __iomem *)DCFG_DCSR_BASE;
30 u32 val;
31
32 val = in_le32(dcfg_ccsr + DCFG_PORSR1 / 4);
33 val &= ~DCFG_PORSR1_RCW_SRC;
34 val |= DCFG_PORSR1_RCW_SRC_NOR;
35 out_le32(dcfg_dcsr + DCFG_DCSR_PORCR1 / 4, val);
36#endif
37}
38
York Sun0404a392015-03-23 10:41:35 -070039#define I2C_DEBUG_REG 0x6
40#define I2C_GLITCH_EN 0x8
41/*
42 * This erratum requires setting glitch_en bit to enable
43 * digital glitch filter to improve clock stability.
44 */
45static void erratum_a009203(void)
46{
47 u8 __iomem *ptr;
48#ifdef CONFIG_SYS_I2C
49#ifdef I2C1_BASE_ADDR
50 ptr = (u8 __iomem *)(I2C1_BASE_ADDR + I2C_DEBUG_REG);
51
52 writeb(I2C_GLITCH_EN, ptr);
53#endif
54#ifdef I2C2_BASE_ADDR
55 ptr = (u8 __iomem *)(I2C2_BASE_ADDR + I2C_DEBUG_REG);
56
57 writeb(I2C_GLITCH_EN, ptr);
58#endif
59#ifdef I2C3_BASE_ADDR
60 ptr = (u8 __iomem *)(I2C3_BASE_ADDR + I2C_DEBUG_REG);
61
62 writeb(I2C_GLITCH_EN, ptr);
63#endif
64#ifdef I2C4_BASE_ADDR
65 ptr = (u8 __iomem *)(I2C4_BASE_ADDR + I2C_DEBUG_REG);
66
67 writeb(I2C_GLITCH_EN, ptr);
68#endif
69#endif
70}
71
Scott Woodf64c98c2015-03-20 19:28:12 -070072void fsl_lsch3_early_init_f(void)
73{
Scott Woodae1df322015-03-20 19:28:13 -070074 erratum_a008751();
Scott Wood8e728cd2015-03-24 13:25:02 -070075 erratum_rcw_src();
Scott Woodf64c98c2015-03-20 19:28:12 -070076 init_early_memctl_regs(); /* tighten IFC timing */
York Sun0404a392015-03-23 10:41:35 -070077 erratum_a009203();
Scott Woodf64c98c2015-03-20 19:28:12 -070078}
Mingkai Hu0e58b512015-10-26 19:47:50 +080079#endif
Scott Wood8e728cd2015-03-24 13:25:02 -070080
Mingkai Hu0e58b512015-10-26 19:47:50 +080081#ifdef CONFIG_BOARD_LATE_INIT
82int board_late_init(void)
Scott Wood8e728cd2015-03-24 13:25:02 -070083{
Mingkai Hu0e58b512015-10-26 19:47:50 +080084 return 0;
Scott Wood8e728cd2015-03-24 13:25:02 -070085}
86#endif