Commit 290e7cfdbfa288d26598c073186ab45e3fa711b3
Committed by
Stefano Babic
1 parent
5a6440cac7
Exists in
smarc_8mq_lf_v2020.04
and in
17 other branches
mx6ull: Handle the CONFIG_MX6ULL cases correctly
Since commit 051ba9e082f7 ("Kconfig: mx6ull: Deselect MX6UL from CONFIG_MX6ULL") CONFIG_MX6ULL does not select CONFIG_MX6UL anymore, so take this into consideration in all the checks for CONFIG_MX6UL. This fixes a boot regression. Reported-by: Stefan Agner <stefan@agner.ch> Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com> Reviewed-by: Stefan Agner <stefan@agner.ch> Tested-by: Breno Lima <breno.lima@nxp.com> Tested-by: Peng Fan <peng.fan@nxp.com> Reviewed-by: Stefano Babic <sbabic@denx.de> Tested-by: Jörg Krause <joerg.krause@embedded.rocks>
Showing 10 changed files with 40 additions and 28 deletions Inline Diff
- arch/arm/include/asm/arch-mx6/imx-regs.h
- arch/arm/include/asm/arch-mx6/mx6-ddr.h
- arch/arm/include/asm/arch-mx6/mx6ul-ddr.h
- arch/arm/include/asm/mach-imx/iomux-v3.h
- arch/arm/include/asm/mach-imx/regs-lcdif.h
- arch/arm/mach-imx/mx6/Kconfig
- arch/arm/mach-imx/mx6/ddr.c
- drivers/gpio/mxc_gpio.c
- include/configs/imx6_spl.h
- include/configs/mx6_common.h
arch/arm/include/asm/arch-mx6/imx-regs.h
1 | /* | 1 | /* |
2 | * Copyright (C) 2011 Freescale Semiconductor, Inc. All Rights Reserved. | 2 | * Copyright (C) 2011 Freescale Semiconductor, Inc. All Rights Reserved. |
3 | * | 3 | * |
4 | * SPDX-License-Identifier: GPL-2.0+ | 4 | * SPDX-License-Identifier: GPL-2.0+ |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #ifndef __ASM_ARCH_MX6_IMX_REGS_H__ | 7 | #ifndef __ASM_ARCH_MX6_IMX_REGS_H__ |
8 | #define __ASM_ARCH_MX6_IMX_REGS_H__ | 8 | #define __ASM_ARCH_MX6_IMX_REGS_H__ |
9 | 9 | ||
10 | #define ARCH_MXC | 10 | #define ARCH_MXC |
11 | 11 | ||
12 | #define ROMCP_ARB_BASE_ADDR 0x00000000 | 12 | #define ROMCP_ARB_BASE_ADDR 0x00000000 |
13 | #define ROMCP_ARB_END_ADDR 0x000FFFFF | 13 | #define ROMCP_ARB_END_ADDR 0x000FFFFF |
14 | 14 | ||
15 | #ifdef CONFIG_MX6SL | 15 | #ifdef CONFIG_MX6SL |
16 | #define GPU_2D_ARB_BASE_ADDR 0x02200000 | 16 | #define GPU_2D_ARB_BASE_ADDR 0x02200000 |
17 | #define GPU_2D_ARB_END_ADDR 0x02203FFF | 17 | #define GPU_2D_ARB_END_ADDR 0x02203FFF |
18 | #define OPENVG_ARB_BASE_ADDR 0x02204000 | 18 | #define OPENVG_ARB_BASE_ADDR 0x02204000 |
19 | #define OPENVG_ARB_END_ADDR 0x02207FFF | 19 | #define OPENVG_ARB_END_ADDR 0x02207FFF |
20 | #elif (defined(CONFIG_MX6SX) || defined(CONFIG_MX6UL)) | 20 | #elif (defined(CONFIG_MX6SX) || defined(CONFIG_MX6UL) || defined(CONFIG_MX6ULL)) |
21 | #define CAAM_ARB_BASE_ADDR 0x00100000 | 21 | #define CAAM_ARB_BASE_ADDR 0x00100000 |
22 | #define CAAM_ARB_END_ADDR 0x00107FFF | 22 | #define CAAM_ARB_END_ADDR 0x00107FFF |
23 | #define GPU_ARB_BASE_ADDR 0x01800000 | 23 | #define GPU_ARB_BASE_ADDR 0x01800000 |
24 | #define GPU_ARB_END_ADDR 0x01803FFF | 24 | #define GPU_ARB_END_ADDR 0x01803FFF |
25 | #define APBH_DMA_ARB_BASE_ADDR 0x01804000 | 25 | #define APBH_DMA_ARB_BASE_ADDR 0x01804000 |
26 | #define APBH_DMA_ARB_END_ADDR 0x0180BFFF | 26 | #define APBH_DMA_ARB_END_ADDR 0x0180BFFF |
27 | #define M4_BOOTROM_BASE_ADDR 0x007F8000 | 27 | #define M4_BOOTROM_BASE_ADDR 0x007F8000 |
28 | 28 | ||
29 | #elif !defined(CONFIG_MX6SLL) | 29 | #elif !defined(CONFIG_MX6SLL) |
30 | #define CAAM_ARB_BASE_ADDR 0x00100000 | 30 | #define CAAM_ARB_BASE_ADDR 0x00100000 |
31 | #define CAAM_ARB_END_ADDR 0x00103FFF | 31 | #define CAAM_ARB_END_ADDR 0x00103FFF |
32 | #define APBH_DMA_ARB_BASE_ADDR 0x00110000 | 32 | #define APBH_DMA_ARB_BASE_ADDR 0x00110000 |
33 | #define APBH_DMA_ARB_END_ADDR 0x00117FFF | 33 | #define APBH_DMA_ARB_END_ADDR 0x00117FFF |
34 | #define HDMI_ARB_BASE_ADDR 0x00120000 | 34 | #define HDMI_ARB_BASE_ADDR 0x00120000 |
35 | #define HDMI_ARB_END_ADDR 0x00128FFF | 35 | #define HDMI_ARB_END_ADDR 0x00128FFF |
36 | #define GPU_3D_ARB_BASE_ADDR 0x00130000 | 36 | #define GPU_3D_ARB_BASE_ADDR 0x00130000 |
37 | #define GPU_3D_ARB_END_ADDR 0x00133FFF | 37 | #define GPU_3D_ARB_END_ADDR 0x00133FFF |
38 | #define GPU_2D_ARB_BASE_ADDR 0x00134000 | 38 | #define GPU_2D_ARB_BASE_ADDR 0x00134000 |
39 | #define GPU_2D_ARB_END_ADDR 0x00137FFF | 39 | #define GPU_2D_ARB_END_ADDR 0x00137FFF |
40 | #define DTCP_ARB_BASE_ADDR 0x00138000 | 40 | #define DTCP_ARB_BASE_ADDR 0x00138000 |
41 | #define DTCP_ARB_END_ADDR 0x0013BFFF | 41 | #define DTCP_ARB_END_ADDR 0x0013BFFF |
42 | #endif /* CONFIG_MX6SL */ | 42 | #endif /* CONFIG_MX6SL */ |
43 | 43 | ||
44 | #define MXS_APBH_BASE APBH_DMA_ARB_BASE_ADDR | 44 | #define MXS_APBH_BASE APBH_DMA_ARB_BASE_ADDR |
45 | #define MXS_GPMI_BASE (APBH_DMA_ARB_BASE_ADDR + 0x02000) | 45 | #define MXS_GPMI_BASE (APBH_DMA_ARB_BASE_ADDR + 0x02000) |
46 | #define MXS_BCH_BASE (APBH_DMA_ARB_BASE_ADDR + 0x04000) | 46 | #define MXS_BCH_BASE (APBH_DMA_ARB_BASE_ADDR + 0x04000) |
47 | 47 | ||
48 | /* GPV - PL301 configuration ports */ | 48 | /* GPV - PL301 configuration ports */ |
49 | #if (defined(CONFIG_MX6SX) || defined(CONFIG_MX6UL) || \ | 49 | #if (defined(CONFIG_MX6SX) || \ |
50 | defined(CONFIG_MX6UL) || defined(CONFIG_MX6ULL) || \ | ||
50 | defined(CONFIG_MX6SL) || defined(CONFIG_MX6SLL)) | 51 | defined(CONFIG_MX6SL) || defined(CONFIG_MX6SLL)) |
51 | #define GPV2_BASE_ADDR 0x00D00000 | 52 | #define GPV2_BASE_ADDR 0x00D00000 |
52 | #define GPV3_BASE_ADDR 0x00E00000 | 53 | #define GPV3_BASE_ADDR 0x00E00000 |
53 | #define GPV4_BASE_ADDR 0x00F00000 | 54 | #define GPV4_BASE_ADDR 0x00F00000 |
54 | #define GPV5_BASE_ADDR 0x01000000 | 55 | #define GPV5_BASE_ADDR 0x01000000 |
55 | #define GPV6_BASE_ADDR 0x01100000 | 56 | #define GPV6_BASE_ADDR 0x01100000 |
56 | #define PCIE_ARB_BASE_ADDR 0x08000000 | 57 | #define PCIE_ARB_BASE_ADDR 0x08000000 |
57 | #define PCIE_ARB_END_ADDR 0x08FFFFFF | 58 | #define PCIE_ARB_END_ADDR 0x08FFFFFF |
58 | 59 | ||
59 | #else | 60 | #else |
60 | #define GPV2_BASE_ADDR 0x00200000 | 61 | #define GPV2_BASE_ADDR 0x00200000 |
61 | #define GPV3_BASE_ADDR 0x00300000 | 62 | #define GPV3_BASE_ADDR 0x00300000 |
62 | #define GPV4_BASE_ADDR 0x00800000 | 63 | #define GPV4_BASE_ADDR 0x00800000 |
63 | #define PCIE_ARB_BASE_ADDR 0x01000000 | 64 | #define PCIE_ARB_BASE_ADDR 0x01000000 |
64 | #define PCIE_ARB_END_ADDR 0x01FFFFFF | 65 | #define PCIE_ARB_END_ADDR 0x01FFFFFF |
65 | #endif | 66 | #endif |
66 | 67 | ||
67 | #define IRAM_BASE_ADDR 0x00900000 | 68 | #define IRAM_BASE_ADDR 0x00900000 |
68 | #define SCU_BASE_ADDR 0x00A00000 | 69 | #define SCU_BASE_ADDR 0x00A00000 |
69 | #define IC_INTERFACES_BASE_ADDR 0x00A00100 | 70 | #define IC_INTERFACES_BASE_ADDR 0x00A00100 |
70 | #define GLOBAL_TIMER_BASE_ADDR 0x00A00200 | 71 | #define GLOBAL_TIMER_BASE_ADDR 0x00A00200 |
71 | #define PRIVATE_TIMERS_WD_BASE_ADDR 0x00A00600 | 72 | #define PRIVATE_TIMERS_WD_BASE_ADDR 0x00A00600 |
72 | #define IC_DISTRIBUTOR_BASE_ADDR 0x00A01000 | 73 | #define IC_DISTRIBUTOR_BASE_ADDR 0x00A01000 |
73 | #define L2_PL310_BASE 0x00A02000 | 74 | #define L2_PL310_BASE 0x00A02000 |
74 | #define GPV0_BASE_ADDR 0x00B00000 | 75 | #define GPV0_BASE_ADDR 0x00B00000 |
75 | #define GPV1_BASE_ADDR 0x00C00000 | 76 | #define GPV1_BASE_ADDR 0x00C00000 |
76 | 77 | ||
77 | #define AIPS1_ARB_BASE_ADDR 0x02000000 | 78 | #define AIPS1_ARB_BASE_ADDR 0x02000000 |
78 | #define AIPS1_ARB_END_ADDR 0x020FFFFF | 79 | #define AIPS1_ARB_END_ADDR 0x020FFFFF |
79 | #define AIPS2_ARB_BASE_ADDR 0x02100000 | 80 | #define AIPS2_ARB_BASE_ADDR 0x02100000 |
80 | #define AIPS2_ARB_END_ADDR 0x021FFFFF | 81 | #define AIPS2_ARB_END_ADDR 0x021FFFFF |
81 | /* AIPS3 only on i.MX6SX */ | 82 | /* AIPS3 only on i.MX6SX */ |
82 | #define AIPS3_ARB_BASE_ADDR 0x02200000 | 83 | #define AIPS3_ARB_BASE_ADDR 0x02200000 |
83 | #define AIPS3_ARB_END_ADDR 0x022FFFFF | 84 | #define AIPS3_ARB_END_ADDR 0x022FFFFF |
84 | #ifdef CONFIG_MX6SX | 85 | #ifdef CONFIG_MX6SX |
85 | #define WEIM_ARB_BASE_ADDR 0x50000000 | 86 | #define WEIM_ARB_BASE_ADDR 0x50000000 |
86 | #define WEIM_ARB_END_ADDR 0x57FFFFFF | 87 | #define WEIM_ARB_END_ADDR 0x57FFFFFF |
87 | #define QSPI0_AMBA_BASE 0x60000000 | 88 | #define QSPI0_AMBA_BASE 0x60000000 |
88 | #define QSPI0_AMBA_END 0x6FFFFFFF | 89 | #define QSPI0_AMBA_END 0x6FFFFFFF |
89 | #define QSPI1_AMBA_BASE 0x70000000 | 90 | #define QSPI1_AMBA_BASE 0x70000000 |
90 | #define QSPI1_AMBA_END 0x7FFFFFFF | 91 | #define QSPI1_AMBA_END 0x7FFFFFFF |
91 | #elif defined(CONFIG_MX6UL) | 92 | #elif (defined(CONFIG_MX6UL) || defined(CONFIG_MX6ULL)) |
92 | #define WEIM_ARB_BASE_ADDR 0x50000000 | 93 | #define WEIM_ARB_BASE_ADDR 0x50000000 |
93 | #define WEIM_ARB_END_ADDR 0x57FFFFFF | 94 | #define WEIM_ARB_END_ADDR 0x57FFFFFF |
94 | #define QSPI0_AMBA_BASE 0x60000000 | 95 | #define QSPI0_AMBA_BASE 0x60000000 |
95 | #define QSPI0_AMBA_END 0x6FFFFFFF | 96 | #define QSPI0_AMBA_END 0x6FFFFFFF |
96 | #elif !defined(CONFIG_MX6SLL) | 97 | #elif !defined(CONFIG_MX6SLL) |
97 | #define SATA_ARB_BASE_ADDR 0x02200000 | 98 | #define SATA_ARB_BASE_ADDR 0x02200000 |
98 | #define SATA_ARB_END_ADDR 0x02203FFF | 99 | #define SATA_ARB_END_ADDR 0x02203FFF |
99 | #define OPENVG_ARB_BASE_ADDR 0x02204000 | 100 | #define OPENVG_ARB_BASE_ADDR 0x02204000 |
100 | #define OPENVG_ARB_END_ADDR 0x02207FFF | 101 | #define OPENVG_ARB_END_ADDR 0x02207FFF |
101 | #define HSI_ARB_BASE_ADDR 0x02208000 | 102 | #define HSI_ARB_BASE_ADDR 0x02208000 |
102 | #define HSI_ARB_END_ADDR 0x0220BFFF | 103 | #define HSI_ARB_END_ADDR 0x0220BFFF |
103 | #define IPU1_ARB_BASE_ADDR 0x02400000 | 104 | #define IPU1_ARB_BASE_ADDR 0x02400000 |
104 | #define IPU1_ARB_END_ADDR 0x027FFFFF | 105 | #define IPU1_ARB_END_ADDR 0x027FFFFF |
105 | #define IPU2_ARB_BASE_ADDR 0x02800000 | 106 | #define IPU2_ARB_BASE_ADDR 0x02800000 |
106 | #define IPU2_ARB_END_ADDR 0x02BFFFFF | 107 | #define IPU2_ARB_END_ADDR 0x02BFFFFF |
107 | #define WEIM_ARB_BASE_ADDR 0x08000000 | 108 | #define WEIM_ARB_BASE_ADDR 0x08000000 |
108 | #define WEIM_ARB_END_ADDR 0x0FFFFFFF | 109 | #define WEIM_ARB_END_ADDR 0x0FFFFFFF |
109 | #endif | 110 | #endif |
110 | 111 | ||
111 | #if (defined(CONFIG_MX6SLL) || defined(CONFIG_MX6SL) || \ | 112 | #if (defined(CONFIG_MX6SLL) || defined(CONFIG_MX6SL) || \ |
112 | defined(CONFIG_MX6SX) || defined(CONFIG_MX6UL)) | 113 | defined(CONFIG_MX6SX) || \ |
114 | defined(CONFIG_MX6UL) || defined(CONFIG_MX6ULL)) | ||
113 | #define MMDC0_ARB_BASE_ADDR 0x80000000 | 115 | #define MMDC0_ARB_BASE_ADDR 0x80000000 |
114 | #define MMDC0_ARB_END_ADDR 0xFFFFFFFF | 116 | #define MMDC0_ARB_END_ADDR 0xFFFFFFFF |
115 | #define MMDC1_ARB_BASE_ADDR 0xC0000000 | 117 | #define MMDC1_ARB_BASE_ADDR 0xC0000000 |
116 | #define MMDC1_ARB_END_ADDR 0xFFFFFFFF | 118 | #define MMDC1_ARB_END_ADDR 0xFFFFFFFF |
117 | #else | 119 | #else |
118 | #define MMDC0_ARB_BASE_ADDR 0x10000000 | 120 | #define MMDC0_ARB_BASE_ADDR 0x10000000 |
119 | #define MMDC0_ARB_END_ADDR 0x7FFFFFFF | 121 | #define MMDC0_ARB_END_ADDR 0x7FFFFFFF |
120 | #define MMDC1_ARB_BASE_ADDR 0x80000000 | 122 | #define MMDC1_ARB_BASE_ADDR 0x80000000 |
121 | #define MMDC1_ARB_END_ADDR 0xFFFFFFFF | 123 | #define MMDC1_ARB_END_ADDR 0xFFFFFFFF |
122 | #endif | 124 | #endif |
123 | 125 | ||
124 | #ifndef CONFIG_MX6SX | 126 | #ifndef CONFIG_MX6SX |
125 | #define IPU_SOC_BASE_ADDR IPU1_ARB_BASE_ADDR | 127 | #define IPU_SOC_BASE_ADDR IPU1_ARB_BASE_ADDR |
126 | #define IPU_SOC_OFFSET 0x00200000 | 128 | #define IPU_SOC_OFFSET 0x00200000 |
127 | #endif | 129 | #endif |
128 | 130 | ||
129 | /* Defines for Blocks connected via AIPS (SkyBlue) */ | 131 | /* Defines for Blocks connected via AIPS (SkyBlue) */ |
130 | #define ATZ1_BASE_ADDR AIPS1_ARB_BASE_ADDR | 132 | #define ATZ1_BASE_ADDR AIPS1_ARB_BASE_ADDR |
131 | #define ATZ2_BASE_ADDR AIPS2_ARB_BASE_ADDR | 133 | #define ATZ2_BASE_ADDR AIPS2_ARB_BASE_ADDR |
132 | #define ATZ3_BASE_ADDR AIPS3_ARB_BASE_ADDR | 134 | #define ATZ3_BASE_ADDR AIPS3_ARB_BASE_ADDR |
133 | #define AIPS1_BASE_ADDR AIPS1_ON_BASE_ADDR | 135 | #define AIPS1_BASE_ADDR AIPS1_ON_BASE_ADDR |
134 | #define AIPS2_BASE_ADDR AIPS2_ON_BASE_ADDR | 136 | #define AIPS2_BASE_ADDR AIPS2_ON_BASE_ADDR |
135 | #define AIPS3_BASE_ADDR AIPS3_ON_BASE_ADDR | 137 | #define AIPS3_BASE_ADDR AIPS3_ON_BASE_ADDR |
136 | 138 | ||
137 | #define SPDIF_BASE_ADDR (ATZ1_BASE_ADDR + 0x04000) | 139 | #define SPDIF_BASE_ADDR (ATZ1_BASE_ADDR + 0x04000) |
138 | #define ECSPI1_BASE_ADDR (ATZ1_BASE_ADDR + 0x08000) | 140 | #define ECSPI1_BASE_ADDR (ATZ1_BASE_ADDR + 0x08000) |
139 | #define ECSPI2_BASE_ADDR (ATZ1_BASE_ADDR + 0x0C000) | 141 | #define ECSPI2_BASE_ADDR (ATZ1_BASE_ADDR + 0x0C000) |
140 | #define ECSPI3_BASE_ADDR (ATZ1_BASE_ADDR + 0x10000) | 142 | #define ECSPI3_BASE_ADDR (ATZ1_BASE_ADDR + 0x10000) |
141 | #define ECSPI4_BASE_ADDR (ATZ1_BASE_ADDR + 0x14000) | 143 | #define ECSPI4_BASE_ADDR (ATZ1_BASE_ADDR + 0x14000) |
142 | 144 | ||
143 | #define MX6SL_UART5_BASE_ADDR (ATZ1_BASE_ADDR + 0x18000) | 145 | #define MX6SL_UART5_BASE_ADDR (ATZ1_BASE_ADDR + 0x18000) |
144 | #define MX6SLL_UART4_BASE_ADDR (ATZ1_BASE_ADDR + 0x18000) | 146 | #define MX6SLL_UART4_BASE_ADDR (ATZ1_BASE_ADDR + 0x18000) |
145 | #define MX6UL_UART7_BASE_ADDR (ATZ1_BASE_ADDR + 0x18000) | 147 | #define MX6UL_UART7_BASE_ADDR (ATZ1_BASE_ADDR + 0x18000) |
146 | #define MX6SL_UART2_BASE_ADDR (ATZ1_BASE_ADDR + 0x24000) | 148 | #define MX6SL_UART2_BASE_ADDR (ATZ1_BASE_ADDR + 0x24000) |
147 | #define MX6SLL_UART2_BASE_ADDR (ATZ1_BASE_ADDR + 0x24000) | 149 | #define MX6SLL_UART2_BASE_ADDR (ATZ1_BASE_ADDR + 0x24000) |
148 | #define MX6UL_UART8_BASE_ADDR (ATZ1_BASE_ADDR + 0x24000) | 150 | #define MX6UL_UART8_BASE_ADDR (ATZ1_BASE_ADDR + 0x24000) |
149 | #define MX6SL_UART3_BASE_ADDR (ATZ1_BASE_ADDR + 0x34000) | 151 | #define MX6SL_UART3_BASE_ADDR (ATZ1_BASE_ADDR + 0x34000) |
150 | #define MX6SLL_UART3_BASE_ADDR (ATZ1_BASE_ADDR + 0x34000) | 152 | #define MX6SLL_UART3_BASE_ADDR (ATZ1_BASE_ADDR + 0x34000) |
151 | #define MX6SL_UART4_BASE_ADDR (ATZ1_BASE_ADDR + 0x38000) | 153 | #define MX6SL_UART4_BASE_ADDR (ATZ1_BASE_ADDR + 0x38000) |
152 | 154 | ||
153 | #ifndef CONFIG_MX6SX | 155 | #ifndef CONFIG_MX6SX |
154 | #define ECSPI5_BASE_ADDR (ATZ1_BASE_ADDR + 0x18000) | 156 | #define ECSPI5_BASE_ADDR (ATZ1_BASE_ADDR + 0x18000) |
155 | #endif | 157 | #endif |
156 | #define UART1_IPS_BASE_ADDR (ATZ1_BASE_ADDR + 0x20000) | 158 | #define UART1_IPS_BASE_ADDR (ATZ1_BASE_ADDR + 0x20000) |
157 | #define UART1_BASE (ATZ1_BASE_ADDR + 0x20000) | 159 | #define UART1_BASE (ATZ1_BASE_ADDR + 0x20000) |
158 | #define ESAI1_BASE_ADDR (ATZ1_BASE_ADDR + 0x24000) | 160 | #define ESAI1_BASE_ADDR (ATZ1_BASE_ADDR + 0x24000) |
159 | #define UART8_BASE (ATZ1_BASE_ADDR + 0x24000) | 161 | #define UART8_BASE (ATZ1_BASE_ADDR + 0x24000) |
160 | #define SSI1_BASE_ADDR (ATZ1_BASE_ADDR + 0x28000) | 162 | #define SSI1_BASE_ADDR (ATZ1_BASE_ADDR + 0x28000) |
161 | #define SSI2_BASE_ADDR (ATZ1_BASE_ADDR + 0x2C000) | 163 | #define SSI2_BASE_ADDR (ATZ1_BASE_ADDR + 0x2C000) |
162 | #define SSI3_BASE_ADDR (ATZ1_BASE_ADDR + 0x30000) | 164 | #define SSI3_BASE_ADDR (ATZ1_BASE_ADDR + 0x30000) |
163 | #define ASRC_BASE_ADDR (ATZ1_BASE_ADDR + 0x34000) | 165 | #define ASRC_BASE_ADDR (ATZ1_BASE_ADDR + 0x34000) |
164 | 166 | ||
165 | #ifndef CONFIG_MX6SX | 167 | #ifndef CONFIG_MX6SX |
166 | #define SPBA_BASE_ADDR (ATZ1_BASE_ADDR + 0x3C000) | 168 | #define SPBA_BASE_ADDR (ATZ1_BASE_ADDR + 0x3C000) |
167 | #define VPU_BASE_ADDR (ATZ1_BASE_ADDR + 0x40000) | 169 | #define VPU_BASE_ADDR (ATZ1_BASE_ADDR + 0x40000) |
168 | #endif | 170 | #endif |
169 | #define AIPS1_ON_BASE_ADDR (ATZ1_BASE_ADDR + 0x7C000) | 171 | #define AIPS1_ON_BASE_ADDR (ATZ1_BASE_ADDR + 0x7C000) |
170 | 172 | ||
171 | #define AIPS1_OFF_BASE_ADDR (ATZ1_BASE_ADDR + 0x80000) | 173 | #define AIPS1_OFF_BASE_ADDR (ATZ1_BASE_ADDR + 0x80000) |
172 | #define PWM1_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x0000) | 174 | #define PWM1_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x0000) |
173 | #define PWM2_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x4000) | 175 | #define PWM2_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x4000) |
174 | #define PWM3_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x8000) | 176 | #define PWM3_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x8000) |
175 | #define PWM4_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0xC000) | 177 | #define PWM4_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0xC000) |
176 | #define CAN1_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x10000) | 178 | #define CAN1_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x10000) |
177 | #define CAN2_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x14000) | 179 | #define CAN2_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x14000) |
178 | /* QOSC on i.MX6SLL */ | 180 | /* QOSC on i.MX6SLL */ |
179 | #define QOSC_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x14000) | 181 | #define QOSC_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x14000) |
180 | #define GPT1_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x18000) | 182 | #define GPT1_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x18000) |
181 | #define GPIO1_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x1C000) | 183 | #define GPIO1_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x1C000) |
182 | #define GPIO2_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x20000) | 184 | #define GPIO2_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x20000) |
183 | #define GPIO3_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x24000) | 185 | #define GPIO3_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x24000) |
184 | #define GPIO4_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x28000) | 186 | #define GPIO4_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x28000) |
185 | #define GPIO5_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x2C000) | 187 | #define GPIO5_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x2C000) |
186 | #define MX6UL_SNVS_LP_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x30000) | 188 | #define MX6UL_SNVS_LP_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x30000) |
187 | #define GPIO6_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x30000) | 189 | #define GPIO6_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x30000) |
188 | #define GPIO7_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x34000) | 190 | #define GPIO7_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x34000) |
189 | #define KPP_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x38000) | 191 | #define KPP_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x38000) |
190 | #define WDOG1_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x3C000) | 192 | #define WDOG1_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x3C000) |
191 | #define WDOG2_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x40000) | 193 | #define WDOG2_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x40000) |
192 | #define ANATOP_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x48000) | 194 | #define ANATOP_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x48000) |
193 | #define USB_PHY0_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x49000) | 195 | #define USB_PHY0_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x49000) |
194 | #define USB_PHY1_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x4a000) | 196 | #define USB_PHY1_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x4a000) |
195 | #define CCM_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x44000) | 197 | #define CCM_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x44000) |
196 | #define SNVS_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x4C000) | 198 | #define SNVS_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x4C000) |
197 | #define EPIT1_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x50000) | 199 | #define EPIT1_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x50000) |
198 | #define EPIT2_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x54000) | 200 | #define EPIT2_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x54000) |
199 | #define SRC_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x58000) | 201 | #define SRC_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x58000) |
200 | #define GPC_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x5C000) | 202 | #define GPC_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x5C000) |
201 | #define IOMUXC_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x60000) | 203 | #define IOMUXC_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x60000) |
202 | #define IOMUXC_GPR_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x64000) | 204 | #define IOMUXC_GPR_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x64000) |
203 | #ifdef CONFIG_MX6SLL | 205 | #ifdef CONFIG_MX6SLL |
204 | #define CSI_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x68000) | 206 | #define CSI_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x68000) |
205 | #define SDMA_PORT_HOST_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x6C000) | 207 | #define SDMA_PORT_HOST_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x6C000) |
206 | #define PXP_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x70000) | 208 | #define PXP_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x70000) |
207 | #define EPDC_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x74000) | 209 | #define EPDC_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x74000) |
208 | #define DCP_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x7C000) | 210 | #define DCP_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x7C000) |
209 | #elif defined(CONFIG_MX6SL) | 211 | #elif defined(CONFIG_MX6SL) |
210 | #define CSI_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x64000) | 212 | #define CSI_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x64000) |
211 | #define SIPIX_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x68000) | 213 | #define SIPIX_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x68000) |
212 | #define SDMA_PORT_HOST_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x6C000) | 214 | #define SDMA_PORT_HOST_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x6C000) |
213 | #elif defined(CONFIG_MX6SX) | 215 | #elif defined(CONFIG_MX6SX) |
214 | #define CANFD1_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x68000) | 216 | #define CANFD1_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x68000) |
215 | #define SDMA_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x6C000) | 217 | #define SDMA_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x6C000) |
216 | #define CANFD2_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x70000) | 218 | #define CANFD2_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x70000) |
217 | #define SEMAPHORE1_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x74000) | 219 | #define SEMAPHORE1_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x74000) |
218 | #define SEMAPHORE2_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x78000) | 220 | #define SEMAPHORE2_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x78000) |
219 | #define RDC_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x7C000) | 221 | #define RDC_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x7C000) |
220 | #else | 222 | #else |
221 | #define DCIC1_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x64000) | 223 | #define DCIC1_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x64000) |
222 | #define DCIC2_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x68000) | 224 | #define DCIC2_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x68000) |
223 | #define DMA_REQ_PORT_HOST_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x6C000) | 225 | #define DMA_REQ_PORT_HOST_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x6C000) |
224 | #endif | 226 | #endif |
225 | 227 | ||
226 | #define MX6SL_LCDIF_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x78000) | 228 | #define MX6SL_LCDIF_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x78000) |
227 | #define MX6SLL_LCDIF_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x78000) | 229 | #define MX6SLL_LCDIF_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x78000) |
228 | 230 | ||
229 | #define AIPS2_ON_BASE_ADDR (ATZ2_BASE_ADDR + 0x7C000) | 231 | #define AIPS2_ON_BASE_ADDR (ATZ2_BASE_ADDR + 0x7C000) |
230 | #define AIPS2_OFF_BASE_ADDR (ATZ2_BASE_ADDR + 0x80000) | 232 | #define AIPS2_OFF_BASE_ADDR (ATZ2_BASE_ADDR + 0x80000) |
231 | #define AIPS3_ON_BASE_ADDR (ATZ3_BASE_ADDR + 0x7C000) | 233 | #define AIPS3_ON_BASE_ADDR (ATZ3_BASE_ADDR + 0x7C000) |
232 | #define AIPS3_OFF_BASE_ADDR (ATZ3_BASE_ADDR + 0x80000) | 234 | #define AIPS3_OFF_BASE_ADDR (ATZ3_BASE_ADDR + 0x80000) |
233 | #define CAAM_BASE_ADDR (ATZ2_BASE_ADDR) | 235 | #define CAAM_BASE_ADDR (ATZ2_BASE_ADDR) |
234 | #define ARM_BASE_ADDR (ATZ2_BASE_ADDR + 0x40000) | 236 | #define ARM_BASE_ADDR (ATZ2_BASE_ADDR + 0x40000) |
235 | 237 | ||
236 | #define CONFIG_SYS_FSL_SEC_OFFSET 0 | 238 | #define CONFIG_SYS_FSL_SEC_OFFSET 0 |
237 | #define CONFIG_SYS_FSL_SEC_ADDR (CAAM_BASE_ADDR + \ | 239 | #define CONFIG_SYS_FSL_SEC_ADDR (CAAM_BASE_ADDR + \ |
238 | CONFIG_SYS_FSL_SEC_OFFSET) | 240 | CONFIG_SYS_FSL_SEC_OFFSET) |
239 | #define CONFIG_SYS_FSL_JR0_OFFSET 0x1000 | 241 | #define CONFIG_SYS_FSL_JR0_OFFSET 0x1000 |
240 | #define CONFIG_SYS_FSL_JR0_ADDR (CAAM_BASE_ADDR + \ | 242 | #define CONFIG_SYS_FSL_JR0_ADDR (CAAM_BASE_ADDR + \ |
241 | CONFIG_SYS_FSL_JR0_OFFSET) | 243 | CONFIG_SYS_FSL_JR0_OFFSET) |
242 | #define CONFIG_SYS_FSL_MAX_NUM_OF_SEC 1 | 244 | #define CONFIG_SYS_FSL_MAX_NUM_OF_SEC 1 |
243 | 245 | ||
244 | #define USB_PL301_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x0000) | 246 | #define USB_PL301_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x0000) |
245 | #define USB_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x4000) | 247 | #define USB_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x4000) |
246 | 248 | ||
247 | #define ENET_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x8000) | 249 | #define ENET_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x8000) |
248 | #ifdef CONFIG_MX6SL | 250 | #ifdef CONFIG_MX6SL |
249 | #define MSHC_IPS_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0xC000) | 251 | #define MSHC_IPS_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0xC000) |
250 | #else | 252 | #else |
251 | #define MLB_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0xC000) | 253 | #define MLB_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0xC000) |
252 | #endif | 254 | #endif |
253 | 255 | ||
254 | #define USDHC1_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x10000) | 256 | #define USDHC1_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x10000) |
255 | #define USDHC2_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x14000) | 257 | #define USDHC2_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x14000) |
256 | #define USDHC3_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x18000) | 258 | #define USDHC3_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x18000) |
257 | #define USDHC4_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x1C000) | 259 | #define USDHC4_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x1C000) |
258 | #define I2C1_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x20000) | 260 | #define I2C1_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x20000) |
259 | #define I2C2_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x24000) | 261 | #define I2C2_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x24000) |
260 | #define I2C3_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x28000) | 262 | #define I2C3_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x28000) |
261 | #define ROMCP_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x2C000) | 263 | #define ROMCP_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x2C000) |
262 | #define MMDC_P0_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x30000) | 264 | #define MMDC_P0_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x30000) |
263 | /* i.MX6SL/SLL */ | 265 | /* i.MX6SL/SLL */ |
264 | #define RNGB_IPS_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x34000) | 266 | #define RNGB_IPS_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x34000) |
265 | #ifdef CONFIG_MX6UL | 267 | #if (defined(CONFIG_MX6UL) || defined(CONFIG_MX6ULL)) |
266 | #define ENET2_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x34000) | 268 | #define ENET2_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x34000) |
267 | #else | 269 | #else |
268 | /* i.MX6SX */ | 270 | /* i.MX6SX */ |
269 | #define ENET2_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x34000) | 271 | #define ENET2_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x34000) |
270 | #endif | 272 | #endif |
271 | /* i.MX6DQ/SDL */ | 273 | /* i.MX6DQ/SDL */ |
272 | #define MMDC_P1_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x34000) | 274 | #define MMDC_P1_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x34000) |
273 | 275 | ||
274 | #define WEIM_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x38000) | 276 | #define WEIM_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x38000) |
275 | #define OCOTP_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x3C000) | 277 | #define OCOTP_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x3C000) |
276 | #define CSU_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x40000) | 278 | #define CSU_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x40000) |
277 | #ifdef CONFIG_MX6SLL | 279 | #ifdef CONFIG_MX6SLL |
278 | #define IOMUXC_GPR_SNVS_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x44000) | 280 | #define IOMUXC_GPR_SNVS_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x44000) |
279 | #define IOMUXC_SNVS_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x48000) | 281 | #define IOMUXC_SNVS_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x48000) |
280 | #endif | 282 | #endif |
281 | #define IP2APB_PERFMON1_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x44000) | 283 | #define IP2APB_PERFMON1_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x44000) |
282 | #define IP2APB_PERFMON2_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x48000) | 284 | #define IP2APB_PERFMON2_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x48000) |
283 | #define MX6UL_LCDIF1_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x48000) | 285 | #define MX6UL_LCDIF1_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x48000) |
284 | #define MX6ULL_LCDIF1_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x48000) | 286 | #define MX6ULL_LCDIF1_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x48000) |
285 | #ifdef CONFIG_MX6SX | 287 | #ifdef CONFIG_MX6SX |
286 | #define DEBUG_MONITOR_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x4C000) | 288 | #define DEBUG_MONITOR_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x4C000) |
287 | #else | 289 | #else |
288 | #define IP2APB_PERFMON3_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x4C000) | 290 | #define IP2APB_PERFMON3_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x4C000) |
289 | #endif | 291 | #endif |
290 | #define IP2APB_TZASC1_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x50000) | 292 | #define IP2APB_TZASC1_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x50000) |
291 | #ifdef CONFIG_MX6UL | 293 | #if (defined(CONFIG_MX6UL) || defined(CONFIG_MX6ULL)) |
292 | #define QSPI0_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x60000) | 294 | #define QSPI0_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x60000) |
293 | #define UART6_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x7C000) | 295 | #define UART6_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x7C000) |
294 | #elif defined(CONFIG_MX6SX) | 296 | #elif defined(CONFIG_MX6SX) |
295 | #define SAI1_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x54000) | 297 | #define SAI1_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x54000) |
296 | #define AUDMUX_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x58000) | 298 | #define AUDMUX_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x58000) |
297 | #define SAI2_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x5C000) | 299 | #define SAI2_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x5C000) |
298 | #define QSPI0_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x60000) | 300 | #define QSPI0_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x60000) |
299 | #define QSPI1_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x64000) | 301 | #define QSPI1_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x64000) |
300 | #else | 302 | #else |
301 | #define IP2APB_TZASC2_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x54000) | 303 | #define IP2APB_TZASC2_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x54000) |
302 | #define MIPI_CSI2_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x5C000) | 304 | #define MIPI_CSI2_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x5C000) |
303 | #define MIPI_DSI_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x60000) | 305 | #define MIPI_DSI_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x60000) |
304 | #define VDOA_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x64000) | 306 | #define VDOA_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x64000) |
305 | #endif | 307 | #endif |
306 | #define MX6UL_WDOG3_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x64000) | 308 | #define MX6UL_WDOG3_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x64000) |
307 | #define UART2_BASE (AIPS2_OFF_BASE_ADDR + 0x68000) | 309 | #define UART2_BASE (AIPS2_OFF_BASE_ADDR + 0x68000) |
308 | #define UART3_BASE (AIPS2_OFF_BASE_ADDR + 0x6C000) | 310 | #define UART3_BASE (AIPS2_OFF_BASE_ADDR + 0x6C000) |
309 | #define UART4_BASE (AIPS2_OFF_BASE_ADDR + 0x70000) | 311 | #define UART4_BASE (AIPS2_OFF_BASE_ADDR + 0x70000) |
310 | #define UART5_BASE (AIPS2_OFF_BASE_ADDR + 0x74000) | 312 | #define UART5_BASE (AIPS2_OFF_BASE_ADDR + 0x74000) |
311 | #define I2C4_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x78000) | 313 | #define I2C4_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x78000) |
312 | #define IP2APB_USBPHY1_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x78000) | 314 | #define IP2APB_USBPHY1_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x78000) |
313 | #define IP2APB_USBPHY2_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x7C000) | 315 | #define IP2APB_USBPHY2_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x7C000) |
314 | /* i.MX6SLL */ | 316 | /* i.MX6SLL */ |
315 | #define MTR_MASTER_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x7C000) | 317 | #define MTR_MASTER_BASE_ADDR (AIPS2_OFF_BASE_ADDR + 0x7C000) |
316 | 318 | ||
317 | #ifdef CONFIG_MX6SX | 319 | #ifdef CONFIG_MX6SX |
318 | #define GIS_BASE_ADDR (AIPS3_ARB_BASE_ADDR + 0x04000) | 320 | #define GIS_BASE_ADDR (AIPS3_ARB_BASE_ADDR + 0x04000) |
319 | #define DCIC1_BASE_ADDR (AIPS3_ARB_BASE_ADDR + 0x0C000) | 321 | #define DCIC1_BASE_ADDR (AIPS3_ARB_BASE_ADDR + 0x0C000) |
320 | #define DCIC2_BASE_ADDR (AIPS3_ARB_BASE_ADDR + 0x10000) | 322 | #define DCIC2_BASE_ADDR (AIPS3_ARB_BASE_ADDR + 0x10000) |
321 | #define CSI1_BASE_ADDR (AIPS3_ARB_BASE_ADDR + 0x14000) | 323 | #define CSI1_BASE_ADDR (AIPS3_ARB_BASE_ADDR + 0x14000) |
322 | #define PXP_BASE_ADDR (AIPS3_ARB_BASE_ADDR + 0x18000) | 324 | #define PXP_BASE_ADDR (AIPS3_ARB_BASE_ADDR + 0x18000) |
323 | #define CSI2_BASE_ADDR (AIPS3_ARB_BASE_ADDR + 0x1C000) | 325 | #define CSI2_BASE_ADDR (AIPS3_ARB_BASE_ADDR + 0x1C000) |
324 | #define VADC_BASE_ADDR (AIPS3_ARB_BASE_ADDR + 0x28000) | 326 | #define VADC_BASE_ADDR (AIPS3_ARB_BASE_ADDR + 0x28000) |
325 | #define VDEC_BASE_ADDR (AIPS3_ARB_BASE_ADDR + 0x2C000) | 327 | #define VDEC_BASE_ADDR (AIPS3_ARB_BASE_ADDR + 0x2C000) |
326 | #define SPBA_BASE_ADDR (AIPS3_ARB_BASE_ADDR + 0x3C000) | 328 | #define SPBA_BASE_ADDR (AIPS3_ARB_BASE_ADDR + 0x3C000) |
327 | #define AIPS3_CONFIG_BASE_ADDR (AIPS3_ARB_BASE_ADDR + 0x7C000) | 329 | #define AIPS3_CONFIG_BASE_ADDR (AIPS3_ARB_BASE_ADDR + 0x7C000) |
328 | #define ADC1_BASE_ADDR (AIPS3_ARB_BASE_ADDR + 0x80000) | 330 | #define ADC1_BASE_ADDR (AIPS3_ARB_BASE_ADDR + 0x80000) |
329 | #define ADC2_BASE_ADDR (AIPS3_ARB_BASE_ADDR + 0x84000) | 331 | #define ADC2_BASE_ADDR (AIPS3_ARB_BASE_ADDR + 0x84000) |
330 | #define ECSPI5_BASE_ADDR (AIPS3_ARB_BASE_ADDR + 0x8C000) | 332 | #define ECSPI5_BASE_ADDR (AIPS3_ARB_BASE_ADDR + 0x8C000) |
331 | #define HS_BASE_ADDR (AIPS3_ARB_BASE_ADDR + 0x90000) | 333 | #define HS_BASE_ADDR (AIPS3_ARB_BASE_ADDR + 0x90000) |
332 | #define MU_MCU_BASE_ADDR (AIPS3_ARB_BASE_ADDR + 0x94000) | 334 | #define MU_MCU_BASE_ADDR (AIPS3_ARB_BASE_ADDR + 0x94000) |
333 | #define CANFD_BASE_ADDR (AIPS3_ARB_BASE_ADDR + 0x98000) | 335 | #define CANFD_BASE_ADDR (AIPS3_ARB_BASE_ADDR + 0x98000) |
334 | #define MU_DSP_BASE_ADDR (AIPS3_ARB_BASE_ADDR + 0x9C000) | 336 | #define MU_DSP_BASE_ADDR (AIPS3_ARB_BASE_ADDR + 0x9C000) |
335 | #define UART6_BASE_ADDR (AIPS3_ARB_BASE_ADDR + 0xA0000) | 337 | #define UART6_BASE_ADDR (AIPS3_ARB_BASE_ADDR + 0xA0000) |
336 | #define PWM5_BASE_ADDR (AIPS3_ARB_BASE_ADDR + 0xA4000) | 338 | #define PWM5_BASE_ADDR (AIPS3_ARB_BASE_ADDR + 0xA4000) |
337 | #define PWM6_BASE_ADDR (AIPS3_ARB_BASE_ADDR + 0xA8000) | 339 | #define PWM6_BASE_ADDR (AIPS3_ARB_BASE_ADDR + 0xA8000) |
338 | #define PWM7_BASE_ADDR (AIPS3_ARB_BASE_ADDR + 0xAC000) | 340 | #define PWM7_BASE_ADDR (AIPS3_ARB_BASE_ADDR + 0xAC000) |
339 | #define PWM8_BASE_ADDR (AIPS3_ARB_BASE_ADDR + 0xB0000) | 341 | #define PWM8_BASE_ADDR (AIPS3_ARB_BASE_ADDR + 0xB0000) |
340 | #elif defined(CONFIG_MX6ULL) | 342 | #elif (defined(CONFIG_MX6UL) || defined(CONFIG_MX6ULL)) |
341 | #define AIPS3_CONFIG_BASE_ADDR (AIPS3_ARB_BASE_ADDR + 0x7C000) | 343 | #define AIPS3_CONFIG_BASE_ADDR (AIPS3_ARB_BASE_ADDR + 0x7C000) |
342 | #define DCP_BASE_ADDR (AIPS3_ARB_BASE_ADDR + 0x80000) | 344 | #define DCP_BASE_ADDR (AIPS3_ARB_BASE_ADDR + 0x80000) |
343 | #define RNGB_BASE_ADDR (AIPS3_ARB_BASE_ADDR + 0x84000) | 345 | #define RNGB_BASE_ADDR (AIPS3_ARB_BASE_ADDR + 0x84000) |
344 | #define UART8_IPS_BASE_ADDR (AIPS3_ARB_BASE_ADDR + 0x88000) | 346 | #define UART8_IPS_BASE_ADDR (AIPS3_ARB_BASE_ADDR + 0x88000) |
345 | #define EPDC_BASE_ADDR (AIPS3_ARB_BASE_ADDR + 0x8C000) | 347 | #define EPDC_BASE_ADDR (AIPS3_ARB_BASE_ADDR + 0x8C000) |
346 | #define IOMUXC_SNVS_BASE_ADDR (AIPS3_ARB_BASE_ADDR + 0x90000) | 348 | #define IOMUXC_SNVS_BASE_ADDR (AIPS3_ARB_BASE_ADDR + 0x90000) |
347 | #define SNVS_GPR_BASE_ADDR (AIPS3_ARB_BASE_ADDR + 0x94000) | 349 | #define SNVS_GPR_BASE_ADDR (AIPS3_ARB_BASE_ADDR + 0x94000) |
348 | #endif | 350 | #endif |
349 | 351 | ||
350 | #define NOC_DDR_BASE_ADDR (GPV0_BASE_ADDR + 0xB0000) | 352 | #define NOC_DDR_BASE_ADDR (GPV0_BASE_ADDR + 0xB0000) |
351 | 353 | ||
352 | /* Only for i.MX6SX */ | 354 | /* Only for i.MX6SX */ |
353 | #define LCDIF2_BASE_ADDR (AIPS3_ARB_BASE_ADDR + 0x24000) | 355 | #define LCDIF2_BASE_ADDR (AIPS3_ARB_BASE_ADDR + 0x24000) |
354 | #define MX6SX_LCDIF1_BASE_ADDR (AIPS3_ARB_BASE_ADDR + 0x20000) | 356 | #define MX6SX_LCDIF1_BASE_ADDR (AIPS3_ARB_BASE_ADDR + 0x20000) |
355 | #define MX6SX_WDOG3_BASE_ADDR (AIPS3_ARB_BASE_ADDR + 0x88000) | 357 | #define MX6SX_WDOG3_BASE_ADDR (AIPS3_ARB_BASE_ADDR + 0x88000) |
356 | 358 | ||
357 | #if !(defined(CONFIG_MX6SX) || defined(CONFIG_MX6UL) || \ | 359 | #if !(defined(CONFIG_MX6SX) || \ |
360 | defined(CONFIG_MX6UL) || defined(CONFIG_MX6ULL) || \ | ||
358 | defined(CONFIG_MX6SLL) || defined(CONFIG_MX6SL)) | 361 | defined(CONFIG_MX6SLL) || defined(CONFIG_MX6SL)) |
359 | #define IRAM_SIZE 0x00040000 | 362 | #define IRAM_SIZE 0x00040000 |
360 | #else | 363 | #else |
361 | #define IRAM_SIZE 0x00020000 | 364 | #define IRAM_SIZE 0x00020000 |
362 | #endif | 365 | #endif |
363 | #define FEC_QUIRK_ENET_MAC | 366 | #define FEC_QUIRK_ENET_MAC |
364 | 367 | ||
365 | #include <asm/mach-imx/regs-lcdif.h> | 368 | #include <asm/mach-imx/regs-lcdif.h> |
366 | #if !(defined(__KERNEL_STRICT_NAMES) || defined(__ASSEMBLY__)) | 369 | #if !(defined(__KERNEL_STRICT_NAMES) || defined(__ASSEMBLY__)) |
367 | #include <asm/types.h> | 370 | #include <asm/types.h> |
368 | 371 | ||
369 | /* only for i.MX6SX/UL */ | 372 | /* only for i.MX6SX/UL */ |
370 | #define WDOG3_BASE_ADDR (((is_mx6ul() || is_mx6ull()) ? \ | 373 | #define WDOG3_BASE_ADDR (((is_mx6ul() || is_mx6ull()) ? \ |
371 | MX6UL_WDOG3_BASE_ADDR : MX6SX_WDOG3_BASE_ADDR)) | 374 | MX6UL_WDOG3_BASE_ADDR : MX6SX_WDOG3_BASE_ADDR)) |
372 | #define LCDIF1_BASE_ADDR ((is_cpu_type(MXC_CPU_MX6SLL)) ? \ | 375 | #define LCDIF1_BASE_ADDR ((is_cpu_type(MXC_CPU_MX6SLL)) ? \ |
373 | MX6SLL_LCDIF_BASE_ADDR : \ | 376 | MX6SLL_LCDIF_BASE_ADDR : \ |
374 | (is_cpu_type(MXC_CPU_MX6SL)) ? \ | 377 | (is_cpu_type(MXC_CPU_MX6SL)) ? \ |
375 | MX6SL_LCDIF_BASE_ADDR : \ | 378 | MX6SL_LCDIF_BASE_ADDR : \ |
376 | ((is_cpu_type(MXC_CPU_MX6UL)) ? \ | 379 | ((is_cpu_type(MXC_CPU_MX6UL)) ? \ |
377 | MX6UL_LCDIF1_BASE_ADDR : \ | 380 | MX6UL_LCDIF1_BASE_ADDR : \ |
378 | ((is_mx6ull()) ? \ | 381 | ((is_mx6ull()) ? \ |
379 | MX6ULL_LCDIF1_BASE_ADDR : MX6SX_LCDIF1_BASE_ADDR))) | 382 | MX6ULL_LCDIF1_BASE_ADDR : MX6SX_LCDIF1_BASE_ADDR))) |
380 | 383 | ||
381 | 384 | ||
382 | extern void imx_get_mac_from_fuse(int dev_id, unsigned char *mac); | 385 | extern void imx_get_mac_from_fuse(int dev_id, unsigned char *mac); |
383 | 386 | ||
384 | #define SRC_SCR_CORE_1_RESET_OFFSET 14 | 387 | #define SRC_SCR_CORE_1_RESET_OFFSET 14 |
385 | #define SRC_SCR_CORE_1_RESET_MASK (1<<SRC_SCR_CORE_1_RESET_OFFSET) | 388 | #define SRC_SCR_CORE_1_RESET_MASK (1<<SRC_SCR_CORE_1_RESET_OFFSET) |
386 | #define SRC_SCR_CORE_2_RESET_OFFSET 15 | 389 | #define SRC_SCR_CORE_2_RESET_OFFSET 15 |
387 | #define SRC_SCR_CORE_2_RESET_MASK (1<<SRC_SCR_CORE_2_RESET_OFFSET) | 390 | #define SRC_SCR_CORE_2_RESET_MASK (1<<SRC_SCR_CORE_2_RESET_OFFSET) |
388 | #define SRC_SCR_CORE_3_RESET_OFFSET 16 | 391 | #define SRC_SCR_CORE_3_RESET_OFFSET 16 |
389 | #define SRC_SCR_CORE_3_RESET_MASK (1<<SRC_SCR_CORE_3_RESET_OFFSET) | 392 | #define SRC_SCR_CORE_3_RESET_MASK (1<<SRC_SCR_CORE_3_RESET_OFFSET) |
390 | #define SRC_SCR_CORE_1_ENABLE_OFFSET 22 | 393 | #define SRC_SCR_CORE_1_ENABLE_OFFSET 22 |
391 | #define SRC_SCR_CORE_1_ENABLE_MASK (1<<SRC_SCR_CORE_1_ENABLE_OFFSET) | 394 | #define SRC_SCR_CORE_1_ENABLE_MASK (1<<SRC_SCR_CORE_1_ENABLE_OFFSET) |
392 | #define SRC_SCR_CORE_2_ENABLE_OFFSET 23 | 395 | #define SRC_SCR_CORE_2_ENABLE_OFFSET 23 |
393 | #define SRC_SCR_CORE_2_ENABLE_MASK (1<<SRC_SCR_CORE_2_ENABLE_OFFSET) | 396 | #define SRC_SCR_CORE_2_ENABLE_MASK (1<<SRC_SCR_CORE_2_ENABLE_OFFSET) |
394 | #define SRC_SCR_CORE_3_ENABLE_OFFSET 24 | 397 | #define SRC_SCR_CORE_3_ENABLE_OFFSET 24 |
395 | #define SRC_SCR_CORE_3_ENABLE_MASK (1<<SRC_SCR_CORE_3_ENABLE_OFFSET) | 398 | #define SRC_SCR_CORE_3_ENABLE_MASK (1<<SRC_SCR_CORE_3_ENABLE_OFFSET) |
396 | 399 | ||
397 | struct rdc_regs { | 400 | struct rdc_regs { |
398 | u32 vir; /* Version information */ | 401 | u32 vir; /* Version information */ |
399 | u32 reserved1[8]; | 402 | u32 reserved1[8]; |
400 | u32 stat; /* Status */ | 403 | u32 stat; /* Status */ |
401 | u32 intctrl; /* Interrupt and Control */ | 404 | u32 intctrl; /* Interrupt and Control */ |
402 | u32 intstat; /* Interrupt Status */ | 405 | u32 intstat; /* Interrupt Status */ |
403 | u32 reserved2[116]; | 406 | u32 reserved2[116]; |
404 | u32 mda[32]; /* Master Domain Assignment */ | 407 | u32 mda[32]; /* Master Domain Assignment */ |
405 | u32 reserved3[96]; | 408 | u32 reserved3[96]; |
406 | u32 pdap[104]; /* Peripheral Domain Access Permissions */ | 409 | u32 pdap[104]; /* Peripheral Domain Access Permissions */ |
407 | u32 reserved4[88]; | 410 | u32 reserved4[88]; |
408 | struct { | 411 | struct { |
409 | u32 mrsa; /* Memory Region Start Address */ | 412 | u32 mrsa; /* Memory Region Start Address */ |
410 | u32 mrea; /* Memory Region End Address */ | 413 | u32 mrea; /* Memory Region End Address */ |
411 | u32 mrc; /* Memory Region Control */ | 414 | u32 mrc; /* Memory Region Control */ |
412 | u32 mrvs; /* Memory Region Violation Status */ | 415 | u32 mrvs; /* Memory Region Violation Status */ |
413 | } mem_region[55]; | 416 | } mem_region[55]; |
414 | }; | 417 | }; |
415 | 418 | ||
416 | struct rdc_sema_regs { | 419 | struct rdc_sema_regs { |
417 | u8 gate[64]; /* Gate */ | 420 | u8 gate[64]; /* Gate */ |
418 | u16 rstgt; /* Reset Gate */ | 421 | u16 rstgt; /* Reset Gate */ |
419 | }; | 422 | }; |
420 | 423 | ||
421 | /* WEIM registers */ | 424 | /* WEIM registers */ |
422 | struct weim { | 425 | struct weim { |
423 | u32 cs0gcr1; | 426 | u32 cs0gcr1; |
424 | u32 cs0gcr2; | 427 | u32 cs0gcr2; |
425 | u32 cs0rcr1; | 428 | u32 cs0rcr1; |
426 | u32 cs0rcr2; | 429 | u32 cs0rcr2; |
427 | u32 cs0wcr1; | 430 | u32 cs0wcr1; |
428 | u32 cs0wcr2; | 431 | u32 cs0wcr2; |
429 | 432 | ||
430 | u32 cs1gcr1; | 433 | u32 cs1gcr1; |
431 | u32 cs1gcr2; | 434 | u32 cs1gcr2; |
432 | u32 cs1rcr1; | 435 | u32 cs1rcr1; |
433 | u32 cs1rcr2; | 436 | u32 cs1rcr2; |
434 | u32 cs1wcr1; | 437 | u32 cs1wcr1; |
435 | u32 cs1wcr2; | 438 | u32 cs1wcr2; |
436 | 439 | ||
437 | u32 cs2gcr1; | 440 | u32 cs2gcr1; |
438 | u32 cs2gcr2; | 441 | u32 cs2gcr2; |
439 | u32 cs2rcr1; | 442 | u32 cs2rcr1; |
440 | u32 cs2rcr2; | 443 | u32 cs2rcr2; |
441 | u32 cs2wcr1; | 444 | u32 cs2wcr1; |
442 | u32 cs2wcr2; | 445 | u32 cs2wcr2; |
443 | 446 | ||
444 | u32 cs3gcr1; | 447 | u32 cs3gcr1; |
445 | u32 cs3gcr2; | 448 | u32 cs3gcr2; |
446 | u32 cs3rcr1; | 449 | u32 cs3rcr1; |
447 | u32 cs3rcr2; | 450 | u32 cs3rcr2; |
448 | u32 cs3wcr1; | 451 | u32 cs3wcr1; |
449 | u32 cs3wcr2; | 452 | u32 cs3wcr2; |
450 | 453 | ||
451 | u32 unused[12]; | 454 | u32 unused[12]; |
452 | 455 | ||
453 | u32 wcr; | 456 | u32 wcr; |
454 | u32 wiar; | 457 | u32 wiar; |
455 | u32 ear; | 458 | u32 ear; |
456 | }; | 459 | }; |
457 | 460 | ||
458 | /* System Reset Controller (SRC) */ | 461 | /* System Reset Controller (SRC) */ |
459 | struct src { | 462 | struct src { |
460 | u32 scr; | 463 | u32 scr; |
461 | u32 sbmr1; | 464 | u32 sbmr1; |
462 | u32 srsr; | 465 | u32 srsr; |
463 | u32 reserved1[2]; | 466 | u32 reserved1[2]; |
464 | u32 sisr; | 467 | u32 sisr; |
465 | u32 simr; | 468 | u32 simr; |
466 | u32 sbmr2; | 469 | u32 sbmr2; |
467 | u32 gpr1; | 470 | u32 gpr1; |
468 | u32 gpr2; | 471 | u32 gpr2; |
469 | u32 gpr3; | 472 | u32 gpr3; |
470 | u32 gpr4; | 473 | u32 gpr4; |
471 | u32 gpr5; | 474 | u32 gpr5; |
472 | u32 gpr6; | 475 | u32 gpr6; |
473 | u32 gpr7; | 476 | u32 gpr7; |
474 | u32 gpr8; | 477 | u32 gpr8; |
475 | u32 gpr9; | 478 | u32 gpr9; |
476 | u32 gpr10; | 479 | u32 gpr10; |
477 | }; | 480 | }; |
478 | 481 | ||
479 | #define src_base ((struct src *)SRC_BASE_ADDR) | 482 | #define src_base ((struct src *)SRC_BASE_ADDR) |
480 | 483 | ||
481 | #define SRC_SCR_M4_ENABLE_OFFSET 22 | 484 | #define SRC_SCR_M4_ENABLE_OFFSET 22 |
482 | #define SRC_SCR_M4_ENABLE_MASK (1 << 22) | 485 | #define SRC_SCR_M4_ENABLE_MASK (1 << 22) |
483 | #define SRC_SCR_M4C_NON_SCLR_RST_OFFSET 4 | 486 | #define SRC_SCR_M4C_NON_SCLR_RST_OFFSET 4 |
484 | #define SRC_SCR_M4C_NON_SCLR_RST_MASK (1 << 4) | 487 | #define SRC_SCR_M4C_NON_SCLR_RST_MASK (1 << 4) |
485 | 488 | ||
486 | /* GPR1 bitfields */ | 489 | /* GPR1 bitfields */ |
487 | #define IOMUXC_GPR1_APP_CLK_REQ_N BIT(30) | 490 | #define IOMUXC_GPR1_APP_CLK_REQ_N BIT(30) |
488 | #define IOMUXC_GPR1_PCIE_EXIT_L1 BIT(28) | 491 | #define IOMUXC_GPR1_PCIE_EXIT_L1 BIT(28) |
489 | #define IOMUXC_GPR1_PCIE_RDY_L23 BIT(27) | 492 | #define IOMUXC_GPR1_PCIE_RDY_L23 BIT(27) |
490 | #define IOMUXC_GPR1_PCIE_ENTER_L1 BIT(26) | 493 | #define IOMUXC_GPR1_PCIE_ENTER_L1 BIT(26) |
491 | #define IOMUXC_GPR1_MIPI_COLOR_SW BIT(25) | 494 | #define IOMUXC_GPR1_MIPI_COLOR_SW BIT(25) |
492 | #define IOMUXC_GPR1_DPI_OFF BIT(24) | 495 | #define IOMUXC_GPR1_DPI_OFF BIT(24) |
493 | #define IOMUXC_GPR1_EXC_MON_SLVE BIT(22) | 496 | #define IOMUXC_GPR1_EXC_MON_SLVE BIT(22) |
494 | #define IOMUXC_GPR1_ENET_CLK_SEL_OFFSET 21 | 497 | #define IOMUXC_GPR1_ENET_CLK_SEL_OFFSET 21 |
495 | #define IOMUXC_GPR1_ENET_CLK_SEL_MASK (1 << IOMUXC_GPR1_ENET_CLK_SEL_OFFSET) | 498 | #define IOMUXC_GPR1_ENET_CLK_SEL_MASK (1 << IOMUXC_GPR1_ENET_CLK_SEL_OFFSET) |
496 | #define IOMUXC_GPR1_MIPI_IPU2_MUX_IOMUX BIT(20) | 499 | #define IOMUXC_GPR1_MIPI_IPU2_MUX_IOMUX BIT(20) |
497 | #define IOMUXC_GPR1_MIPI_IPU1_MUX_IOMUX BIT(19) | 500 | #define IOMUXC_GPR1_MIPI_IPU1_MUX_IOMUX BIT(19) |
498 | #define IOMUXC_GPR1_PCIE_TEST_PD BIT(18) | 501 | #define IOMUXC_GPR1_PCIE_TEST_PD BIT(18) |
499 | #define IOMUXC_GPR1_IPU_VPU_MUX_IPU2 BIT(17) | 502 | #define IOMUXC_GPR1_IPU_VPU_MUX_IPU2 BIT(17) |
500 | #define IOMUXC_GPR1_PCIE_REF_CLK_EN BIT(16) | 503 | #define IOMUXC_GPR1_PCIE_REF_CLK_EN BIT(16) |
501 | #define IOMUXC_GPR1_USB_EXP_MODE BIT(15) | 504 | #define IOMUXC_GPR1_USB_EXP_MODE BIT(15) |
502 | #define IOMUXC_GPR1_PCIE_INT BIT(14) | 505 | #define IOMUXC_GPR1_PCIE_INT BIT(14) |
503 | #define IOMUXC_GPR1_USB_OTG_ID_OFFSET 13 | 506 | #define IOMUXC_GPR1_USB_OTG_ID_OFFSET 13 |
504 | #define IOMUXC_GPR1_USB_OTG_ID_SEL_MASK (1 << IOMUXC_GPR1_USB_OTG_ID_OFFSET) | 507 | #define IOMUXC_GPR1_USB_OTG_ID_SEL_MASK (1 << IOMUXC_GPR1_USB_OTG_ID_OFFSET) |
505 | #define IOMUXC_GPR1_GINT BIT(12) | 508 | #define IOMUXC_GPR1_GINT BIT(12) |
506 | #define IOMUXC_GPR1_ADDRS3_MASK (0x3 << 10) | 509 | #define IOMUXC_GPR1_ADDRS3_MASK (0x3 << 10) |
507 | #define IOMUXC_GPR1_ADDRS3_32MB (0x0 << 10) | 510 | #define IOMUXC_GPR1_ADDRS3_32MB (0x0 << 10) |
508 | #define IOMUXC_GPR1_ADDRS3_64MB (0x1 << 10) | 511 | #define IOMUXC_GPR1_ADDRS3_64MB (0x1 << 10) |
509 | #define IOMUXC_GPR1_ADDRS3_128MB (0x2 << 10) | 512 | #define IOMUXC_GPR1_ADDRS3_128MB (0x2 << 10) |
510 | #define IOMUXC_GPR1_ACT_CS3 BIT(9) | 513 | #define IOMUXC_GPR1_ACT_CS3 BIT(9) |
511 | #define IOMUXC_GPR1_ADDRS2_MASK (0x3 << 7) | 514 | #define IOMUXC_GPR1_ADDRS2_MASK (0x3 << 7) |
512 | #define IOMUXC_GPR1_ACT_CS2 BIT(6) | 515 | #define IOMUXC_GPR1_ACT_CS2 BIT(6) |
513 | #define IOMUXC_GPR1_ADDRS1_MASK (0x3 << 4) | 516 | #define IOMUXC_GPR1_ADDRS1_MASK (0x3 << 4) |
514 | #define IOMUXC_GPR1_ACT_CS1 BIT(3) | 517 | #define IOMUXC_GPR1_ACT_CS1 BIT(3) |
515 | #define IOMUXC_GPR1_ADDRS0_OFFSET (1) | 518 | #define IOMUXC_GPR1_ADDRS0_OFFSET (1) |
516 | #define IOMUXC_GPR1_ADDRS0_MASK (0x3 << 1) | 519 | #define IOMUXC_GPR1_ADDRS0_MASK (0x3 << 1) |
517 | #define IOMUXC_GPR1_ACT_CS0 BIT(0) | 520 | #define IOMUXC_GPR1_ACT_CS0 BIT(0) |
518 | 521 | ||
519 | /* GPR3 bitfields */ | 522 | /* GPR3 bitfields */ |
520 | #define IOMUXC_GPR3_GPU_DBG_OFFSET 29 | 523 | #define IOMUXC_GPR3_GPU_DBG_OFFSET 29 |
521 | #define IOMUXC_GPR3_GPU_DBG_MASK (3<<IOMUXC_GPR3_GPU_DBG_OFFSET) | 524 | #define IOMUXC_GPR3_GPU_DBG_MASK (3<<IOMUXC_GPR3_GPU_DBG_OFFSET) |
522 | #define IOMUXC_GPR3_BCH_WR_CACHE_CTL_OFFSET 28 | 525 | #define IOMUXC_GPR3_BCH_WR_CACHE_CTL_OFFSET 28 |
523 | #define IOMUXC_GPR3_BCH_WR_CACHE_CTL_MASK (1<<IOMUXC_GPR3_BCH_WR_CACHE_CTL_OFFSET) | 526 | #define IOMUXC_GPR3_BCH_WR_CACHE_CTL_MASK (1<<IOMUXC_GPR3_BCH_WR_CACHE_CTL_OFFSET) |
524 | #define IOMUXC_GPR3_BCH_RD_CACHE_CTL_OFFSET 27 | 527 | #define IOMUXC_GPR3_BCH_RD_CACHE_CTL_OFFSET 27 |
525 | #define IOMUXC_GPR3_BCH_RD_CACHE_CTL_MASK (1<<IOMUXC_GPR3_BCH_RD_CACHE_CTL_OFFSET) | 528 | #define IOMUXC_GPR3_BCH_RD_CACHE_CTL_MASK (1<<IOMUXC_GPR3_BCH_RD_CACHE_CTL_OFFSET) |
526 | #define IOMUXC_GPR3_uSDHCx_WR_CACHE_CTL_OFFSET 26 | 529 | #define IOMUXC_GPR3_uSDHCx_WR_CACHE_CTL_OFFSET 26 |
527 | #define IOMUXC_GPR3_uSDHCx_WR_CACHE_CTL_MASK (1<<IOMUXC_GPR3_uSDHCx_WR_CACHE_CTL_OFFSET) | 530 | #define IOMUXC_GPR3_uSDHCx_WR_CACHE_CTL_MASK (1<<IOMUXC_GPR3_uSDHCx_WR_CACHE_CTL_OFFSET) |
528 | #define IOMUXC_GPR3_uSDHCx_RD_CACHE_CTL_OFFSET 25 | 531 | #define IOMUXC_GPR3_uSDHCx_RD_CACHE_CTL_OFFSET 25 |
529 | #define IOMUXC_GPR3_uSDHCx_RD_CACHE_CTL_MASK (1<<IOMUXC_GPR3_uSDHCx_RD_CACHE_CTL_OFFSET) | 532 | #define IOMUXC_GPR3_uSDHCx_RD_CACHE_CTL_MASK (1<<IOMUXC_GPR3_uSDHCx_RD_CACHE_CTL_OFFSET) |
530 | #define IOMUXC_GPR3_OCRAM_CTL_OFFSET 21 | 533 | #define IOMUXC_GPR3_OCRAM_CTL_OFFSET 21 |
531 | #define IOMUXC_GPR3_OCRAM_CTL_MASK (0xf<<IOMUXC_GPR3_OCRAM_CTL_OFFSET) | 534 | #define IOMUXC_GPR3_OCRAM_CTL_MASK (0xf<<IOMUXC_GPR3_OCRAM_CTL_OFFSET) |
532 | #define IOMUXC_GPR3_OCRAM_STATUS_OFFSET 17 | 535 | #define IOMUXC_GPR3_OCRAM_STATUS_OFFSET 17 |
533 | #define IOMUXC_GPR3_OCRAM_STATUS_MASK (0xf<<IOMUXC_GPR3_OCRAM_STATUS_OFFSET) | 536 | #define IOMUXC_GPR3_OCRAM_STATUS_MASK (0xf<<IOMUXC_GPR3_OCRAM_STATUS_OFFSET) |
534 | #define IOMUXC_GPR3_CORE3_DBG_ACK_EN_OFFSET 16 | 537 | #define IOMUXC_GPR3_CORE3_DBG_ACK_EN_OFFSET 16 |
535 | #define IOMUXC_GPR3_CORE3_DBG_ACK_EN_MASK (1<<IOMUXC_GPR3_CORE3_DBG_ACK_EN_OFFSET) | 538 | #define IOMUXC_GPR3_CORE3_DBG_ACK_EN_MASK (1<<IOMUXC_GPR3_CORE3_DBG_ACK_EN_OFFSET) |
536 | #define IOMUXC_GPR3_CORE2_DBG_ACK_EN_OFFSET 15 | 539 | #define IOMUXC_GPR3_CORE2_DBG_ACK_EN_OFFSET 15 |
537 | #define IOMUXC_GPR3_CORE2_DBG_ACK_EN_MASK (1<<IOMUXC_GPR3_CORE2_DBG_ACK_EN_OFFSET) | 540 | #define IOMUXC_GPR3_CORE2_DBG_ACK_EN_MASK (1<<IOMUXC_GPR3_CORE2_DBG_ACK_EN_OFFSET) |
538 | #define IOMUXC_GPR3_CORE1_DBG_ACK_EN_OFFSET 14 | 541 | #define IOMUXC_GPR3_CORE1_DBG_ACK_EN_OFFSET 14 |
539 | #define IOMUXC_GPR3_CORE1_DBG_ACK_EN_MASK (1<<IOMUXC_GPR3_CORE1_DBG_ACK_EN_OFFSET) | 542 | #define IOMUXC_GPR3_CORE1_DBG_ACK_EN_MASK (1<<IOMUXC_GPR3_CORE1_DBG_ACK_EN_OFFSET) |
540 | #define IOMUXC_GPR3_CORE0_DBG_ACK_EN_OFFSET 13 | 543 | #define IOMUXC_GPR3_CORE0_DBG_ACK_EN_OFFSET 13 |
541 | #define IOMUXC_GPR3_CORE0_DBG_ACK_EN_MASK (1<<IOMUXC_GPR3_CORE0_DBG_ACK_EN_OFFSET) | 544 | #define IOMUXC_GPR3_CORE0_DBG_ACK_EN_MASK (1<<IOMUXC_GPR3_CORE0_DBG_ACK_EN_OFFSET) |
542 | #define IOMUXC_GPR3_TZASC2_BOOT_LOCK_OFFSET 12 | 545 | #define IOMUXC_GPR3_TZASC2_BOOT_LOCK_OFFSET 12 |
543 | #define IOMUXC_GPR3_TZASC2_BOOT_LOCK_MASK (1<<IOMUXC_GPR3_TZASC2_BOOT_LOCK_OFFSET) | 546 | #define IOMUXC_GPR3_TZASC2_BOOT_LOCK_MASK (1<<IOMUXC_GPR3_TZASC2_BOOT_LOCK_OFFSET) |
544 | #define IOMUXC_GPR3_TZASC1_BOOT_LOCK_OFFSET 11 | 547 | #define IOMUXC_GPR3_TZASC1_BOOT_LOCK_OFFSET 11 |
545 | #define IOMUXC_GPR3_TZASC1_BOOT_LOCK_MASK (1<<IOMUXC_GPR3_TZASC1_BOOT_LOCK_OFFSET) | 548 | #define IOMUXC_GPR3_TZASC1_BOOT_LOCK_MASK (1<<IOMUXC_GPR3_TZASC1_BOOT_LOCK_OFFSET) |
546 | #define IOMUXC_GPR3_IPU_DIAG_OFFSET 10 | 549 | #define IOMUXC_GPR3_IPU_DIAG_OFFSET 10 |
547 | #define IOMUXC_GPR3_IPU_DIAG_MASK (1<<IOMUXC_GPR3_IPU_DIAG_OFFSET) | 550 | #define IOMUXC_GPR3_IPU_DIAG_MASK (1<<IOMUXC_GPR3_IPU_DIAG_OFFSET) |
548 | 551 | ||
549 | #define IOMUXC_GPR3_MUX_SRC_IPU1_DI0 0 | 552 | #define IOMUXC_GPR3_MUX_SRC_IPU1_DI0 0 |
550 | #define IOMUXC_GPR3_MUX_SRC_IPU1_DI1 1 | 553 | #define IOMUXC_GPR3_MUX_SRC_IPU1_DI1 1 |
551 | #define IOMUXC_GPR3_MUX_SRC_IPU2_DI0 2 | 554 | #define IOMUXC_GPR3_MUX_SRC_IPU2_DI0 2 |
552 | #define IOMUXC_GPR3_MUX_SRC_IPU2_DI1 3 | 555 | #define IOMUXC_GPR3_MUX_SRC_IPU2_DI1 3 |
553 | 556 | ||
554 | #define IOMUXC_GPR3_LVDS1_MUX_CTL_OFFSET 8 | 557 | #define IOMUXC_GPR3_LVDS1_MUX_CTL_OFFSET 8 |
555 | #define IOMUXC_GPR3_LVDS1_MUX_CTL_MASK (3<<IOMUXC_GPR3_LVDS1_MUX_CTL_OFFSET) | 558 | #define IOMUXC_GPR3_LVDS1_MUX_CTL_MASK (3<<IOMUXC_GPR3_LVDS1_MUX_CTL_OFFSET) |
556 | 559 | ||
557 | #define IOMUXC_GPR3_LVDS0_MUX_CTL_OFFSET 6 | 560 | #define IOMUXC_GPR3_LVDS0_MUX_CTL_OFFSET 6 |
558 | #define IOMUXC_GPR3_LVDS0_MUX_CTL_MASK (3<<IOMUXC_GPR3_LVDS0_MUX_CTL_OFFSET) | 561 | #define IOMUXC_GPR3_LVDS0_MUX_CTL_MASK (3<<IOMUXC_GPR3_LVDS0_MUX_CTL_OFFSET) |
559 | 562 | ||
560 | #define IOMUXC_GPR3_MIPI_MUX_CTL_OFFSET 4 | 563 | #define IOMUXC_GPR3_MIPI_MUX_CTL_OFFSET 4 |
561 | #define IOMUXC_GPR3_MIPI_MUX_CTL_MASK (3<<IOMUXC_GPR3_MIPI_MUX_CTL_OFFSET) | 564 | #define IOMUXC_GPR3_MIPI_MUX_CTL_MASK (3<<IOMUXC_GPR3_MIPI_MUX_CTL_OFFSET) |
562 | 565 | ||
563 | #define IOMUXC_GPR3_HDMI_MUX_CTL_OFFSET 2 | 566 | #define IOMUXC_GPR3_HDMI_MUX_CTL_OFFSET 2 |
564 | #define IOMUXC_GPR3_HDMI_MUX_CTL_MASK (3<<IOMUXC_GPR3_HDMI_MUX_CTL_OFFSET) | 567 | #define IOMUXC_GPR3_HDMI_MUX_CTL_MASK (3<<IOMUXC_GPR3_HDMI_MUX_CTL_OFFSET) |
565 | 568 | ||
566 | /* gpr12 bitfields */ | 569 | /* gpr12 bitfields */ |
567 | #define IOMUXC_GPR12_ARMP_IPG_CLK_EN BIT(27) | 570 | #define IOMUXC_GPR12_ARMP_IPG_CLK_EN BIT(27) |
568 | #define IOMUXC_GPR12_ARMP_AHB_CLK_EN BIT(26) | 571 | #define IOMUXC_GPR12_ARMP_AHB_CLK_EN BIT(26) |
569 | #define IOMUXC_GPR12_ARMP_ATB_CLK_EN BIT(25) | 572 | #define IOMUXC_GPR12_ARMP_ATB_CLK_EN BIT(25) |
570 | #define IOMUXC_GPR12_ARMP_APB_CLK_EN BIT(24) | 573 | #define IOMUXC_GPR12_ARMP_APB_CLK_EN BIT(24) |
571 | #define IOMUXC_GPR12_DEVICE_TYPE (0xf << 12) | 574 | #define IOMUXC_GPR12_DEVICE_TYPE (0xf << 12) |
572 | #define IOMUXC_GPR12_PCIE_CTL_2 BIT(10) | 575 | #define IOMUXC_GPR12_PCIE_CTL_2 BIT(10) |
573 | #define IOMUXC_GPR12_LOS_LEVEL (0x1f << 4) | 576 | #define IOMUXC_GPR12_LOS_LEVEL (0x1f << 4) |
574 | 577 | ||
575 | struct iomuxc { | 578 | struct iomuxc { |
576 | #if (defined(CONFIG_MX6SX) || defined(CONFIG_MX6UL)) | 579 | #if (defined(CONFIG_MX6SX) || defined(CONFIG_MX6UL) || defined(CONFIG_MX6ULL)) |
577 | u8 reserved[0x4000]; | 580 | u8 reserved[0x4000]; |
578 | #endif | 581 | #endif |
579 | u32 gpr[14]; | 582 | u32 gpr[14]; |
580 | }; | 583 | }; |
581 | 584 | ||
582 | struct gpc { | 585 | struct gpc { |
583 | u32 cntr; | 586 | u32 cntr; |
584 | u32 pgr; | 587 | u32 pgr; |
585 | u32 imr1; | 588 | u32 imr1; |
586 | u32 imr2; | 589 | u32 imr2; |
587 | u32 imr3; | 590 | u32 imr3; |
588 | u32 imr4; | 591 | u32 imr4; |
589 | u32 isr1; | 592 | u32 isr1; |
590 | u32 isr2; | 593 | u32 isr2; |
591 | u32 isr3; | 594 | u32 isr3; |
592 | u32 isr4; | 595 | u32 isr4; |
593 | }; | 596 | }; |
594 | 597 | ||
595 | #define IOMUXC_GPR2_COUNTER_RESET_VAL_OFFSET 20 | 598 | #define IOMUXC_GPR2_COUNTER_RESET_VAL_OFFSET 20 |
596 | #define IOMUXC_GPR2_COUNTER_RESET_VAL_MASK (3<<IOMUXC_GPR2_COUNTER_RESET_VAL_OFFSET) | 599 | #define IOMUXC_GPR2_COUNTER_RESET_VAL_MASK (3<<IOMUXC_GPR2_COUNTER_RESET_VAL_OFFSET) |
597 | #define IOMUXC_GPR2_LVDS_CLK_SHIFT_OFFSET 16 | 600 | #define IOMUXC_GPR2_LVDS_CLK_SHIFT_OFFSET 16 |
598 | #define IOMUXC_GPR2_LVDS_CLK_SHIFT_MASK (7<<IOMUXC_GPR2_LVDS_CLK_SHIFT_OFFSET) | 601 | #define IOMUXC_GPR2_LVDS_CLK_SHIFT_MASK (7<<IOMUXC_GPR2_LVDS_CLK_SHIFT_OFFSET) |
599 | 602 | ||
600 | #define IOMUXC_GPR2_BGREF_RRMODE_OFFSET 15 | 603 | #define IOMUXC_GPR2_BGREF_RRMODE_OFFSET 15 |
601 | #define IOMUXC_GPR2_BGREF_RRMODE_MASK (1<<IOMUXC_GPR2_BGREF_RRMODE_OFFSET) | 604 | #define IOMUXC_GPR2_BGREF_RRMODE_MASK (1<<IOMUXC_GPR2_BGREF_RRMODE_OFFSET) |
602 | #define IOMUXC_GPR2_BGREF_RRMODE_INTERNAL_RES (1<<IOMUXC_GPR2_BGREF_RRMODE_OFFSET) | 605 | #define IOMUXC_GPR2_BGREF_RRMODE_INTERNAL_RES (1<<IOMUXC_GPR2_BGREF_RRMODE_OFFSET) |
603 | #define IOMUXC_GPR2_BGREF_RRMODE_EXTERNAL_RES (0<<IOMUXC_GPR2_BGREF_RRMODE_OFFSET) | 606 | #define IOMUXC_GPR2_BGREF_RRMODE_EXTERNAL_RES (0<<IOMUXC_GPR2_BGREF_RRMODE_OFFSET) |
604 | #define IOMUXC_GPR2_VSYNC_ACTIVE_HIGH 0 | 607 | #define IOMUXC_GPR2_VSYNC_ACTIVE_HIGH 0 |
605 | #define IOMUXC_GPR2_VSYNC_ACTIVE_LOW 1 | 608 | #define IOMUXC_GPR2_VSYNC_ACTIVE_LOW 1 |
606 | 609 | ||
607 | #define IOMUXC_GPR2_DI1_VS_POLARITY_OFFSET 10 | 610 | #define IOMUXC_GPR2_DI1_VS_POLARITY_OFFSET 10 |
608 | #define IOMUXC_GPR2_DI1_VS_POLARITY_MASK (1<<IOMUXC_GPR2_DI1_VS_POLARITY_OFFSET) | 611 | #define IOMUXC_GPR2_DI1_VS_POLARITY_MASK (1<<IOMUXC_GPR2_DI1_VS_POLARITY_OFFSET) |
609 | #define IOMUXC_GPR2_DI1_VS_POLARITY_ACTIVE_HIGH (IOMUXC_GPR2_VSYNC_ACTIVE_HIGH<<IOMUXC_GPR2_DI1_VS_POLARITY_OFFSET) | 612 | #define IOMUXC_GPR2_DI1_VS_POLARITY_ACTIVE_HIGH (IOMUXC_GPR2_VSYNC_ACTIVE_HIGH<<IOMUXC_GPR2_DI1_VS_POLARITY_OFFSET) |
610 | #define IOMUXC_GPR2_DI1_VS_POLARITY_ACTIVE_LOW (IOMUXC_GPR2_VSYNC_ACTIVE_LOW<<IOMUXC_GPR2_DI1_VS_POLARITY_OFFSET) | 613 | #define IOMUXC_GPR2_DI1_VS_POLARITY_ACTIVE_LOW (IOMUXC_GPR2_VSYNC_ACTIVE_LOW<<IOMUXC_GPR2_DI1_VS_POLARITY_OFFSET) |
611 | 614 | ||
612 | #define IOMUXC_GPR2_DI0_VS_POLARITY_OFFSET 9 | 615 | #define IOMUXC_GPR2_DI0_VS_POLARITY_OFFSET 9 |
613 | #define IOMUXC_GPR2_DI0_VS_POLARITY_MASK (1<<IOMUXC_GPR2_DI0_VS_POLARITY_OFFSET) | 616 | #define IOMUXC_GPR2_DI0_VS_POLARITY_MASK (1<<IOMUXC_GPR2_DI0_VS_POLARITY_OFFSET) |
614 | #define IOMUXC_GPR2_DI0_VS_POLARITY_ACTIVE_HIGH (IOMUXC_GPR2_VSYNC_ACTIVE_HIGH<<IOMUXC_GPR2_DI0_VS_POLARITY_OFFSET) | 617 | #define IOMUXC_GPR2_DI0_VS_POLARITY_ACTIVE_HIGH (IOMUXC_GPR2_VSYNC_ACTIVE_HIGH<<IOMUXC_GPR2_DI0_VS_POLARITY_OFFSET) |
615 | #define IOMUXC_GPR2_DI0_VS_POLARITY_ACTIVE_LOW (IOMUXC_GPR2_VSYNC_ACTIVE_LOW<<IOMUXC_GPR2_DI0_VS_POLARITY_OFFSET) | 618 | #define IOMUXC_GPR2_DI0_VS_POLARITY_ACTIVE_LOW (IOMUXC_GPR2_VSYNC_ACTIVE_LOW<<IOMUXC_GPR2_DI0_VS_POLARITY_OFFSET) |
616 | 619 | ||
617 | #define IOMUXC_GPR2_BITMAP_SPWG 0 | 620 | #define IOMUXC_GPR2_BITMAP_SPWG 0 |
618 | #define IOMUXC_GPR2_BITMAP_JEIDA 1 | 621 | #define IOMUXC_GPR2_BITMAP_JEIDA 1 |
619 | 622 | ||
620 | #define IOMUXC_GPR2_BIT_MAPPING_CH1_OFFSET 8 | 623 | #define IOMUXC_GPR2_BIT_MAPPING_CH1_OFFSET 8 |
621 | #define IOMUXC_GPR2_BIT_MAPPING_CH1_MASK (1<<IOMUXC_GPR2_BIT_MAPPING_CH1_OFFSET) | 624 | #define IOMUXC_GPR2_BIT_MAPPING_CH1_MASK (1<<IOMUXC_GPR2_BIT_MAPPING_CH1_OFFSET) |
622 | #define IOMUXC_GPR2_BIT_MAPPING_CH1_JEIDA (IOMUXC_GPR2_BITMAP_JEIDA<<IOMUXC_GPR2_BIT_MAPPING_CH1_OFFSET) | 625 | #define IOMUXC_GPR2_BIT_MAPPING_CH1_JEIDA (IOMUXC_GPR2_BITMAP_JEIDA<<IOMUXC_GPR2_BIT_MAPPING_CH1_OFFSET) |
623 | #define IOMUXC_GPR2_BIT_MAPPING_CH1_SPWG (IOMUXC_GPR2_BITMAP_SPWG<<IOMUXC_GPR2_BIT_MAPPING_CH1_OFFSET) | 626 | #define IOMUXC_GPR2_BIT_MAPPING_CH1_SPWG (IOMUXC_GPR2_BITMAP_SPWG<<IOMUXC_GPR2_BIT_MAPPING_CH1_OFFSET) |
624 | 627 | ||
625 | #define IOMUXC_GPR2_DATA_WIDTH_18 0 | 628 | #define IOMUXC_GPR2_DATA_WIDTH_18 0 |
626 | #define IOMUXC_GPR2_DATA_WIDTH_24 1 | 629 | #define IOMUXC_GPR2_DATA_WIDTH_24 1 |
627 | 630 | ||
628 | #define IOMUXC_GPR2_DATA_WIDTH_CH1_OFFSET 7 | 631 | #define IOMUXC_GPR2_DATA_WIDTH_CH1_OFFSET 7 |
629 | #define IOMUXC_GPR2_DATA_WIDTH_CH1_MASK (1<<IOMUXC_GPR2_DATA_WIDTH_CH1_OFFSET) | 632 | #define IOMUXC_GPR2_DATA_WIDTH_CH1_MASK (1<<IOMUXC_GPR2_DATA_WIDTH_CH1_OFFSET) |
630 | #define IOMUXC_GPR2_DATA_WIDTH_CH1_18BIT (IOMUXC_GPR2_DATA_WIDTH_18<<IOMUXC_GPR2_DATA_WIDTH_CH1_OFFSET) | 633 | #define IOMUXC_GPR2_DATA_WIDTH_CH1_18BIT (IOMUXC_GPR2_DATA_WIDTH_18<<IOMUXC_GPR2_DATA_WIDTH_CH1_OFFSET) |
631 | #define IOMUXC_GPR2_DATA_WIDTH_CH1_24BIT (IOMUXC_GPR2_DATA_WIDTH_24<<IOMUXC_GPR2_DATA_WIDTH_CH1_OFFSET) | 634 | #define IOMUXC_GPR2_DATA_WIDTH_CH1_24BIT (IOMUXC_GPR2_DATA_WIDTH_24<<IOMUXC_GPR2_DATA_WIDTH_CH1_OFFSET) |
632 | 635 | ||
633 | #define IOMUXC_GPR2_BIT_MAPPING_CH0_OFFSET 6 | 636 | #define IOMUXC_GPR2_BIT_MAPPING_CH0_OFFSET 6 |
634 | #define IOMUXC_GPR2_BIT_MAPPING_CH0_MASK (1<<IOMUXC_GPR2_BIT_MAPPING_CH0_OFFSET) | 637 | #define IOMUXC_GPR2_BIT_MAPPING_CH0_MASK (1<<IOMUXC_GPR2_BIT_MAPPING_CH0_OFFSET) |
635 | #define IOMUXC_GPR2_BIT_MAPPING_CH0_JEIDA (IOMUXC_GPR2_BITMAP_JEIDA<<IOMUXC_GPR2_BIT_MAPPING_CH0_OFFSET) | 638 | #define IOMUXC_GPR2_BIT_MAPPING_CH0_JEIDA (IOMUXC_GPR2_BITMAP_JEIDA<<IOMUXC_GPR2_BIT_MAPPING_CH0_OFFSET) |
636 | #define IOMUXC_GPR2_BIT_MAPPING_CH0_SPWG (IOMUXC_GPR2_BITMAP_SPWG<<IOMUXC_GPR2_BIT_MAPPING_CH0_OFFSET) | 639 | #define IOMUXC_GPR2_BIT_MAPPING_CH0_SPWG (IOMUXC_GPR2_BITMAP_SPWG<<IOMUXC_GPR2_BIT_MAPPING_CH0_OFFSET) |
637 | 640 | ||
638 | #define IOMUXC_GPR2_DATA_WIDTH_CH0_OFFSET 5 | 641 | #define IOMUXC_GPR2_DATA_WIDTH_CH0_OFFSET 5 |
639 | #define IOMUXC_GPR2_DATA_WIDTH_CH0_MASK (1<<IOMUXC_GPR2_DATA_WIDTH_CH0_OFFSET) | 642 | #define IOMUXC_GPR2_DATA_WIDTH_CH0_MASK (1<<IOMUXC_GPR2_DATA_WIDTH_CH0_OFFSET) |
640 | #define IOMUXC_GPR2_DATA_WIDTH_CH0_18BIT (IOMUXC_GPR2_DATA_WIDTH_18<<IOMUXC_GPR2_DATA_WIDTH_CH0_OFFSET) | 643 | #define IOMUXC_GPR2_DATA_WIDTH_CH0_18BIT (IOMUXC_GPR2_DATA_WIDTH_18<<IOMUXC_GPR2_DATA_WIDTH_CH0_OFFSET) |
641 | #define IOMUXC_GPR2_DATA_WIDTH_CH0_24BIT (IOMUXC_GPR2_DATA_WIDTH_24<<IOMUXC_GPR2_DATA_WIDTH_CH0_OFFSET) | 644 | #define IOMUXC_GPR2_DATA_WIDTH_CH0_24BIT (IOMUXC_GPR2_DATA_WIDTH_24<<IOMUXC_GPR2_DATA_WIDTH_CH0_OFFSET) |
642 | 645 | ||
643 | #define IOMUXC_GPR2_SPLIT_MODE_EN_OFFSET 4 | 646 | #define IOMUXC_GPR2_SPLIT_MODE_EN_OFFSET 4 |
644 | #define IOMUXC_GPR2_SPLIT_MODE_EN_MASK (1<<IOMUXC_GPR2_SPLIT_MODE_EN_OFFSET) | 647 | #define IOMUXC_GPR2_SPLIT_MODE_EN_MASK (1<<IOMUXC_GPR2_SPLIT_MODE_EN_OFFSET) |
645 | 648 | ||
646 | #define IOMUXC_GPR2_MODE_DISABLED 0 | 649 | #define IOMUXC_GPR2_MODE_DISABLED 0 |
647 | #define IOMUXC_GPR2_MODE_ENABLED_DI0 1 | 650 | #define IOMUXC_GPR2_MODE_ENABLED_DI0 1 |
648 | #define IOMUXC_GPR2_MODE_ENABLED_DI1 3 | 651 | #define IOMUXC_GPR2_MODE_ENABLED_DI1 3 |
649 | 652 | ||
650 | #define IOMUXC_GPR2_LVDS_CH1_MODE_OFFSET 2 | 653 | #define IOMUXC_GPR2_LVDS_CH1_MODE_OFFSET 2 |
651 | #define IOMUXC_GPR2_LVDS_CH1_MODE_MASK (3<<IOMUXC_GPR2_LVDS_CH1_MODE_OFFSET) | 654 | #define IOMUXC_GPR2_LVDS_CH1_MODE_MASK (3<<IOMUXC_GPR2_LVDS_CH1_MODE_OFFSET) |
652 | #define IOMUXC_GPR2_LVDS_CH1_MODE_DISABLED (IOMUXC_GPR2_MODE_DISABLED<<IOMUXC_GPR2_LVDS_CH1_MODE_OFFSET) | 655 | #define IOMUXC_GPR2_LVDS_CH1_MODE_DISABLED (IOMUXC_GPR2_MODE_DISABLED<<IOMUXC_GPR2_LVDS_CH1_MODE_OFFSET) |
653 | #define IOMUXC_GPR2_LVDS_CH1_MODE_ENABLED_DI0 (IOMUXC_GPR2_MODE_ENABLED_DI0<<IOMUXC_GPR2_LVDS_CH1_MODE_OFFSET) | 656 | #define IOMUXC_GPR2_LVDS_CH1_MODE_ENABLED_DI0 (IOMUXC_GPR2_MODE_ENABLED_DI0<<IOMUXC_GPR2_LVDS_CH1_MODE_OFFSET) |
654 | #define IOMUXC_GPR2_LVDS_CH1_MODE_ENABLED_DI1 (IOMUXC_GPR2_MODE_ENABLED_DI1<<IOMUXC_GPR2_LVDS_CH1_MODE_OFFSET) | 657 | #define IOMUXC_GPR2_LVDS_CH1_MODE_ENABLED_DI1 (IOMUXC_GPR2_MODE_ENABLED_DI1<<IOMUXC_GPR2_LVDS_CH1_MODE_OFFSET) |
655 | 658 | ||
656 | #define IOMUXC_GPR2_LVDS_CH0_MODE_OFFSET 0 | 659 | #define IOMUXC_GPR2_LVDS_CH0_MODE_OFFSET 0 |
657 | #define IOMUXC_GPR2_LVDS_CH0_MODE_MASK (3<<IOMUXC_GPR2_LVDS_CH0_MODE_OFFSET) | 660 | #define IOMUXC_GPR2_LVDS_CH0_MODE_MASK (3<<IOMUXC_GPR2_LVDS_CH0_MODE_OFFSET) |
658 | #define IOMUXC_GPR2_LVDS_CH0_MODE_DISABLED (IOMUXC_GPR2_MODE_DISABLED<<IOMUXC_GPR2_LVDS_CH0_MODE_OFFSET) | 661 | #define IOMUXC_GPR2_LVDS_CH0_MODE_DISABLED (IOMUXC_GPR2_MODE_DISABLED<<IOMUXC_GPR2_LVDS_CH0_MODE_OFFSET) |
659 | #define IOMUXC_GPR2_LVDS_CH0_MODE_ENABLED_DI0 (IOMUXC_GPR2_MODE_ENABLED_DI0<<IOMUXC_GPR2_LVDS_CH0_MODE_OFFSET) | 662 | #define IOMUXC_GPR2_LVDS_CH0_MODE_ENABLED_DI0 (IOMUXC_GPR2_MODE_ENABLED_DI0<<IOMUXC_GPR2_LVDS_CH0_MODE_OFFSET) |
660 | #define IOMUXC_GPR2_LVDS_CH0_MODE_ENABLED_DI1 (IOMUXC_GPR2_MODE_ENABLED_DI1<<IOMUXC_GPR2_LVDS_CH0_MODE_OFFSET) | 663 | #define IOMUXC_GPR2_LVDS_CH0_MODE_ENABLED_DI1 (IOMUXC_GPR2_MODE_ENABLED_DI1<<IOMUXC_GPR2_LVDS_CH0_MODE_OFFSET) |
661 | 664 | ||
662 | /* ECSPI registers */ | 665 | /* ECSPI registers */ |
663 | struct cspi_regs { | 666 | struct cspi_regs { |
664 | u32 rxdata; | 667 | u32 rxdata; |
665 | u32 txdata; | 668 | u32 txdata; |
666 | u32 ctrl; | 669 | u32 ctrl; |
667 | u32 cfg; | 670 | u32 cfg; |
668 | u32 intr; | 671 | u32 intr; |
669 | u32 dma; | 672 | u32 dma; |
670 | u32 stat; | 673 | u32 stat; |
671 | u32 period; | 674 | u32 period; |
672 | }; | 675 | }; |
673 | 676 | ||
674 | /* | 677 | /* |
675 | * CSPI register definitions | 678 | * CSPI register definitions |
676 | */ | 679 | */ |
677 | #define MXC_ECSPI | 680 | #define MXC_ECSPI |
678 | #define MXC_CSPICTRL_EN (1 << 0) | 681 | #define MXC_CSPICTRL_EN (1 << 0) |
679 | #define MXC_CSPICTRL_MODE (1 << 1) | 682 | #define MXC_CSPICTRL_MODE (1 << 1) |
680 | #define MXC_CSPICTRL_XCH (1 << 2) | 683 | #define MXC_CSPICTRL_XCH (1 << 2) |
681 | #define MXC_CSPICTRL_MODE_MASK (0xf << 4) | 684 | #define MXC_CSPICTRL_MODE_MASK (0xf << 4) |
682 | #define MXC_CSPICTRL_CHIPSELECT(x) (((x) & 0x3) << 12) | 685 | #define MXC_CSPICTRL_CHIPSELECT(x) (((x) & 0x3) << 12) |
683 | #define MXC_CSPICTRL_BITCOUNT(x) (((x) & 0xfff) << 20) | 686 | #define MXC_CSPICTRL_BITCOUNT(x) (((x) & 0xfff) << 20) |
684 | #define MXC_CSPICTRL_PREDIV(x) (((x) & 0xF) << 12) | 687 | #define MXC_CSPICTRL_PREDIV(x) (((x) & 0xF) << 12) |
685 | #define MXC_CSPICTRL_POSTDIV(x) (((x) & 0xF) << 8) | 688 | #define MXC_CSPICTRL_POSTDIV(x) (((x) & 0xF) << 8) |
686 | #define MXC_CSPICTRL_SELCHAN(x) (((x) & 0x3) << 18) | 689 | #define MXC_CSPICTRL_SELCHAN(x) (((x) & 0x3) << 18) |
687 | #define MXC_CSPICTRL_MAXBITS 0xfff | 690 | #define MXC_CSPICTRL_MAXBITS 0xfff |
688 | #define MXC_CSPICTRL_TC (1 << 7) | 691 | #define MXC_CSPICTRL_TC (1 << 7) |
689 | #define MXC_CSPICTRL_RXOVF (1 << 6) | 692 | #define MXC_CSPICTRL_RXOVF (1 << 6) |
690 | #define MXC_CSPIPERIOD_32KHZ (1 << 15) | 693 | #define MXC_CSPIPERIOD_32KHZ (1 << 15) |
691 | #define MAX_SPI_BYTES 32 | 694 | #define MAX_SPI_BYTES 32 |
692 | #define SPI_MAX_NUM 4 | 695 | #define SPI_MAX_NUM 4 |
693 | 696 | ||
694 | /* Bit position inside CTRL register to be associated with SS */ | 697 | /* Bit position inside CTRL register to be associated with SS */ |
695 | #define MXC_CSPICTRL_CHAN 18 | 698 | #define MXC_CSPICTRL_CHAN 18 |
696 | 699 | ||
697 | /* Bit position inside CON register to be associated with SS */ | 700 | /* Bit position inside CON register to be associated with SS */ |
698 | #define MXC_CSPICON_PHA 0 /* SCLK phase control */ | 701 | #define MXC_CSPICON_PHA 0 /* SCLK phase control */ |
699 | #define MXC_CSPICON_POL 4 /* SCLK polarity */ | 702 | #define MXC_CSPICON_POL 4 /* SCLK polarity */ |
700 | #define MXC_CSPICON_SSPOL 12 /* SS polarity */ | 703 | #define MXC_CSPICON_SSPOL 12 /* SS polarity */ |
701 | #define MXC_CSPICON_CTL 20 /* inactive state of SCLK */ | 704 | #define MXC_CSPICON_CTL 20 /* inactive state of SCLK */ |
702 | #if defined(CONFIG_MX6SLL) || defined(CONFIG_MX6SL) || \ | 705 | #if defined(CONFIG_MX6SLL) || defined(CONFIG_MX6SL) || \ |
703 | defined(CONFIG_MX6DL) || defined(CONFIG_MX6UL) | 706 | defined(CONFIG_MX6DL) || defined(CONFIG_MX6UL) || defined(CONFIG_MX6ULL) |
704 | #define MXC_SPI_BASE_ADDRESSES \ | 707 | #define MXC_SPI_BASE_ADDRESSES \ |
705 | ECSPI1_BASE_ADDR, \ | 708 | ECSPI1_BASE_ADDR, \ |
706 | ECSPI2_BASE_ADDR, \ | 709 | ECSPI2_BASE_ADDR, \ |
707 | ECSPI3_BASE_ADDR, \ | 710 | ECSPI3_BASE_ADDR, \ |
708 | ECSPI4_BASE_ADDR | 711 | ECSPI4_BASE_ADDR |
709 | #else | 712 | #else |
710 | #define MXC_SPI_BASE_ADDRESSES \ | 713 | #define MXC_SPI_BASE_ADDRESSES \ |
711 | ECSPI1_BASE_ADDR, \ | 714 | ECSPI1_BASE_ADDR, \ |
712 | ECSPI2_BASE_ADDR, \ | 715 | ECSPI2_BASE_ADDR, \ |
713 | ECSPI3_BASE_ADDR, \ | 716 | ECSPI3_BASE_ADDR, \ |
714 | ECSPI4_BASE_ADDR, \ | 717 | ECSPI4_BASE_ADDR, \ |
715 | ECSPI5_BASE_ADDR | 718 | ECSPI5_BASE_ADDR |
716 | #endif | 719 | #endif |
717 | 720 | ||
718 | struct ocotp_regs { | 721 | struct ocotp_regs { |
719 | u32 ctrl; | 722 | u32 ctrl; |
720 | u32 ctrl_set; | 723 | u32 ctrl_set; |
721 | u32 ctrl_clr; | 724 | u32 ctrl_clr; |
722 | u32 ctrl_tog; | 725 | u32 ctrl_tog; |
723 | u32 timing; | 726 | u32 timing; |
724 | u32 rsvd0[3]; | 727 | u32 rsvd0[3]; |
725 | u32 data; | 728 | u32 data; |
726 | u32 rsvd1[3]; | 729 | u32 rsvd1[3]; |
727 | u32 read_ctrl; | 730 | u32 read_ctrl; |
728 | u32 rsvd2[3]; | 731 | u32 rsvd2[3]; |
729 | u32 read_fuse_data; | 732 | u32 read_fuse_data; |
730 | u32 rsvd3[3]; | 733 | u32 rsvd3[3]; |
731 | u32 sw_sticky; | 734 | u32 sw_sticky; |
732 | u32 rsvd4[3]; | 735 | u32 rsvd4[3]; |
733 | u32 scs; | 736 | u32 scs; |
734 | u32 scs_set; | 737 | u32 scs_set; |
735 | u32 scs_clr; | 738 | u32 scs_clr; |
736 | u32 scs_tog; | 739 | u32 scs_tog; |
737 | u32 crc_addr; | 740 | u32 crc_addr; |
738 | u32 rsvd5[3]; | 741 | u32 rsvd5[3]; |
739 | u32 crc_value; | 742 | u32 crc_value; |
740 | u32 rsvd6[3]; | 743 | u32 rsvd6[3]; |
741 | u32 version; | 744 | u32 version; |
742 | u32 rsvd7[0xdb]; | 745 | u32 rsvd7[0xdb]; |
743 | 746 | ||
744 | /* fuse banks */ | 747 | /* fuse banks */ |
745 | struct fuse_bank { | 748 | struct fuse_bank { |
746 | u32 fuse_regs[0x20]; | 749 | u32 fuse_regs[0x20]; |
747 | } bank[0]; | 750 | } bank[0]; |
748 | }; | 751 | }; |
749 | 752 | ||
750 | struct fuse_bank0_regs { | 753 | struct fuse_bank0_regs { |
751 | u32 lock; | 754 | u32 lock; |
752 | u32 rsvd0[3]; | 755 | u32 rsvd0[3]; |
753 | u32 uid_low; | 756 | u32 uid_low; |
754 | u32 rsvd1[3]; | 757 | u32 rsvd1[3]; |
755 | u32 uid_high; | 758 | u32 uid_high; |
756 | u32 rsvd2[3]; | 759 | u32 rsvd2[3]; |
757 | u32 cfg2; | 760 | u32 cfg2; |
758 | u32 rsvd3[3]; | 761 | u32 rsvd3[3]; |
759 | u32 cfg3; | 762 | u32 cfg3; |
760 | u32 rsvd4[3]; | 763 | u32 rsvd4[3]; |
761 | u32 cfg4; | 764 | u32 cfg4; |
762 | u32 rsvd5[3]; | 765 | u32 rsvd5[3]; |
763 | u32 cfg5; | 766 | u32 cfg5; |
764 | u32 rsvd6[3]; | 767 | u32 rsvd6[3]; |
765 | u32 cfg6; | 768 | u32 cfg6; |
766 | u32 rsvd7[3]; | 769 | u32 rsvd7[3]; |
767 | }; | 770 | }; |
768 | 771 | ||
769 | struct fuse_bank1_regs { | 772 | struct fuse_bank1_regs { |
770 | u32 mem0; | 773 | u32 mem0; |
771 | u32 rsvd0[3]; | 774 | u32 rsvd0[3]; |
772 | u32 mem1; | 775 | u32 mem1; |
773 | u32 rsvd1[3]; | 776 | u32 rsvd1[3]; |
774 | u32 mem2; | 777 | u32 mem2; |
775 | u32 rsvd2[3]; | 778 | u32 rsvd2[3]; |
776 | u32 mem3; | 779 | u32 mem3; |
777 | u32 rsvd3[3]; | 780 | u32 rsvd3[3]; |
778 | u32 mem4; | 781 | u32 mem4; |
779 | u32 rsvd4[3]; | 782 | u32 rsvd4[3]; |
780 | u32 ana0; | 783 | u32 ana0; |
781 | u32 rsvd5[3]; | 784 | u32 rsvd5[3]; |
782 | u32 ana1; | 785 | u32 ana1; |
783 | u32 rsvd6[3]; | 786 | u32 rsvd6[3]; |
784 | u32 ana2; | 787 | u32 ana2; |
785 | u32 rsvd7[3]; | 788 | u32 rsvd7[3]; |
786 | }; | 789 | }; |
787 | 790 | ||
788 | struct fuse_bank4_regs { | 791 | struct fuse_bank4_regs { |
789 | u32 sjc_resp_low; | 792 | u32 sjc_resp_low; |
790 | u32 rsvd0[3]; | 793 | u32 rsvd0[3]; |
791 | u32 sjc_resp_high; | 794 | u32 sjc_resp_high; |
792 | u32 rsvd1[3]; | 795 | u32 rsvd1[3]; |
793 | u32 mac_addr0; | 796 | u32 mac_addr0; |
794 | u32 rsvd2[3]; | 797 | u32 rsvd2[3]; |
795 | u32 mac_addr1; | 798 | u32 mac_addr1; |
796 | u32 rsvd3[3]; | 799 | u32 rsvd3[3]; |
797 | u32 mac_addr2; /*For i.MX6SX and i.MX6UL*/ | 800 | u32 mac_addr2; /*For i.MX6SX and i.MX6UL*/ |
798 | u32 rsvd4[7]; | 801 | u32 rsvd4[7]; |
799 | u32 gp1; | 802 | u32 gp1; |
800 | u32 rsvd5[3]; | 803 | u32 rsvd5[3]; |
801 | u32 gp2; | 804 | u32 gp2; |
802 | u32 rsvd6[3]; | 805 | u32 rsvd6[3]; |
803 | }; | 806 | }; |
804 | 807 | ||
805 | struct aipstz_regs { | 808 | struct aipstz_regs { |
806 | u32 mprot0; | 809 | u32 mprot0; |
807 | u32 mprot1; | 810 | u32 mprot1; |
808 | u32 rsvd[0xe]; | 811 | u32 rsvd[0xe]; |
809 | u32 opacr0; | 812 | u32 opacr0; |
810 | u32 opacr1; | 813 | u32 opacr1; |
811 | u32 opacr2; | 814 | u32 opacr2; |
812 | u32 opacr3; | 815 | u32 opacr3; |
813 | u32 opacr4; | 816 | u32 opacr4; |
814 | }; | 817 | }; |
815 | 818 | ||
816 | struct anatop_regs { | 819 | struct anatop_regs { |
817 | u32 pll_sys; /* 0x000 */ | 820 | u32 pll_sys; /* 0x000 */ |
818 | u32 pll_sys_set; /* 0x004 */ | 821 | u32 pll_sys_set; /* 0x004 */ |
819 | u32 pll_sys_clr; /* 0x008 */ | 822 | u32 pll_sys_clr; /* 0x008 */ |
820 | u32 pll_sys_tog; /* 0x00c */ | 823 | u32 pll_sys_tog; /* 0x00c */ |
821 | u32 usb1_pll_480_ctrl; /* 0x010 */ | 824 | u32 usb1_pll_480_ctrl; /* 0x010 */ |
822 | u32 usb1_pll_480_ctrl_set; /* 0x014 */ | 825 | u32 usb1_pll_480_ctrl_set; /* 0x014 */ |
823 | u32 usb1_pll_480_ctrl_clr; /* 0x018 */ | 826 | u32 usb1_pll_480_ctrl_clr; /* 0x018 */ |
824 | u32 usb1_pll_480_ctrl_tog; /* 0x01c */ | 827 | u32 usb1_pll_480_ctrl_tog; /* 0x01c */ |
825 | u32 usb2_pll_480_ctrl; /* 0x020 */ | 828 | u32 usb2_pll_480_ctrl; /* 0x020 */ |
826 | u32 usb2_pll_480_ctrl_set; /* 0x024 */ | 829 | u32 usb2_pll_480_ctrl_set; /* 0x024 */ |
827 | u32 usb2_pll_480_ctrl_clr; /* 0x028 */ | 830 | u32 usb2_pll_480_ctrl_clr; /* 0x028 */ |
828 | u32 usb2_pll_480_ctrl_tog; /* 0x02c */ | 831 | u32 usb2_pll_480_ctrl_tog; /* 0x02c */ |
829 | u32 pll_528; /* 0x030 */ | 832 | u32 pll_528; /* 0x030 */ |
830 | u32 pll_528_set; /* 0x034 */ | 833 | u32 pll_528_set; /* 0x034 */ |
831 | u32 pll_528_clr; /* 0x038 */ | 834 | u32 pll_528_clr; /* 0x038 */ |
832 | u32 pll_528_tog; /* 0x03c */ | 835 | u32 pll_528_tog; /* 0x03c */ |
833 | u32 pll_528_ss; /* 0x040 */ | 836 | u32 pll_528_ss; /* 0x040 */ |
834 | u32 rsvd0[3]; | 837 | u32 rsvd0[3]; |
835 | u32 pll_528_num; /* 0x050 */ | 838 | u32 pll_528_num; /* 0x050 */ |
836 | u32 rsvd1[3]; | 839 | u32 rsvd1[3]; |
837 | u32 pll_528_denom; /* 0x060 */ | 840 | u32 pll_528_denom; /* 0x060 */ |
838 | u32 rsvd2[3]; | 841 | u32 rsvd2[3]; |
839 | u32 pll_audio; /* 0x070 */ | 842 | u32 pll_audio; /* 0x070 */ |
840 | u32 pll_audio_set; /* 0x074 */ | 843 | u32 pll_audio_set; /* 0x074 */ |
841 | u32 pll_audio_clr; /* 0x078 */ | 844 | u32 pll_audio_clr; /* 0x078 */ |
842 | u32 pll_audio_tog; /* 0x07c */ | 845 | u32 pll_audio_tog; /* 0x07c */ |
843 | u32 pll_audio_num; /* 0x080 */ | 846 | u32 pll_audio_num; /* 0x080 */ |
844 | u32 rsvd3[3]; | 847 | u32 rsvd3[3]; |
845 | u32 pll_audio_denom; /* 0x090 */ | 848 | u32 pll_audio_denom; /* 0x090 */ |
846 | u32 rsvd4[3]; | 849 | u32 rsvd4[3]; |
847 | u32 pll_video; /* 0x0a0 */ | 850 | u32 pll_video; /* 0x0a0 */ |
848 | u32 pll_video_set; /* 0x0a4 */ | 851 | u32 pll_video_set; /* 0x0a4 */ |
849 | u32 pll_video_clr; /* 0x0a8 */ | 852 | u32 pll_video_clr; /* 0x0a8 */ |
850 | u32 pll_video_tog; /* 0x0ac */ | 853 | u32 pll_video_tog; /* 0x0ac */ |
851 | u32 pll_video_num; /* 0x0b0 */ | 854 | u32 pll_video_num; /* 0x0b0 */ |
852 | u32 rsvd5[3]; | 855 | u32 rsvd5[3]; |
853 | u32 pll_video_denom; /* 0x0c0 */ | 856 | u32 pll_video_denom; /* 0x0c0 */ |
854 | u32 rsvd6[3]; | 857 | u32 rsvd6[3]; |
855 | u32 pll_mlb; /* 0x0d0 */ | 858 | u32 pll_mlb; /* 0x0d0 */ |
856 | u32 pll_mlb_set; /* 0x0d4 */ | 859 | u32 pll_mlb_set; /* 0x0d4 */ |
857 | u32 pll_mlb_clr; /* 0x0d8 */ | 860 | u32 pll_mlb_clr; /* 0x0d8 */ |
858 | u32 pll_mlb_tog; /* 0x0dc */ | 861 | u32 pll_mlb_tog; /* 0x0dc */ |
859 | u32 pll_enet; /* 0x0e0 */ | 862 | u32 pll_enet; /* 0x0e0 */ |
860 | u32 pll_enet_set; /* 0x0e4 */ | 863 | u32 pll_enet_set; /* 0x0e4 */ |
861 | u32 pll_enet_clr; /* 0x0e8 */ | 864 | u32 pll_enet_clr; /* 0x0e8 */ |
862 | u32 pll_enet_tog; /* 0x0ec */ | 865 | u32 pll_enet_tog; /* 0x0ec */ |
863 | u32 pfd_480; /* 0x0f0 */ | 866 | u32 pfd_480; /* 0x0f0 */ |
864 | u32 pfd_480_set; /* 0x0f4 */ | 867 | u32 pfd_480_set; /* 0x0f4 */ |
865 | u32 pfd_480_clr; /* 0x0f8 */ | 868 | u32 pfd_480_clr; /* 0x0f8 */ |
866 | u32 pfd_480_tog; /* 0x0fc */ | 869 | u32 pfd_480_tog; /* 0x0fc */ |
867 | u32 pfd_528; /* 0x100 */ | 870 | u32 pfd_528; /* 0x100 */ |
868 | u32 pfd_528_set; /* 0x104 */ | 871 | u32 pfd_528_set; /* 0x104 */ |
869 | u32 pfd_528_clr; /* 0x108 */ | 872 | u32 pfd_528_clr; /* 0x108 */ |
870 | u32 pfd_528_tog; /* 0x10c */ | 873 | u32 pfd_528_tog; /* 0x10c */ |
871 | u32 reg_1p1; /* 0x110 */ | 874 | u32 reg_1p1; /* 0x110 */ |
872 | u32 reg_1p1_set; /* 0x114 */ | 875 | u32 reg_1p1_set; /* 0x114 */ |
873 | u32 reg_1p1_clr; /* 0x118 */ | 876 | u32 reg_1p1_clr; /* 0x118 */ |
874 | u32 reg_1p1_tog; /* 0x11c */ | 877 | u32 reg_1p1_tog; /* 0x11c */ |
875 | u32 reg_3p0; /* 0x120 */ | 878 | u32 reg_3p0; /* 0x120 */ |
876 | u32 reg_3p0_set; /* 0x124 */ | 879 | u32 reg_3p0_set; /* 0x124 */ |
877 | u32 reg_3p0_clr; /* 0x128 */ | 880 | u32 reg_3p0_clr; /* 0x128 */ |
878 | u32 reg_3p0_tog; /* 0x12c */ | 881 | u32 reg_3p0_tog; /* 0x12c */ |
879 | u32 reg_2p5; /* 0x130 */ | 882 | u32 reg_2p5; /* 0x130 */ |
880 | u32 reg_2p5_set; /* 0x134 */ | 883 | u32 reg_2p5_set; /* 0x134 */ |
881 | u32 reg_2p5_clr; /* 0x138 */ | 884 | u32 reg_2p5_clr; /* 0x138 */ |
882 | u32 reg_2p5_tog; /* 0x13c */ | 885 | u32 reg_2p5_tog; /* 0x13c */ |
883 | u32 reg_core; /* 0x140 */ | 886 | u32 reg_core; /* 0x140 */ |
884 | u32 reg_core_set; /* 0x144 */ | 887 | u32 reg_core_set; /* 0x144 */ |
885 | u32 reg_core_clr; /* 0x148 */ | 888 | u32 reg_core_clr; /* 0x148 */ |
886 | u32 reg_core_tog; /* 0x14c */ | 889 | u32 reg_core_tog; /* 0x14c */ |
887 | u32 ana_misc0; /* 0x150 */ | 890 | u32 ana_misc0; /* 0x150 */ |
888 | u32 ana_misc0_set; /* 0x154 */ | 891 | u32 ana_misc0_set; /* 0x154 */ |
889 | u32 ana_misc0_clr; /* 0x158 */ | 892 | u32 ana_misc0_clr; /* 0x158 */ |
890 | u32 ana_misc0_tog; /* 0x15c */ | 893 | u32 ana_misc0_tog; /* 0x15c */ |
891 | u32 ana_misc1; /* 0x160 */ | 894 | u32 ana_misc1; /* 0x160 */ |
892 | u32 ana_misc1_set; /* 0x164 */ | 895 | u32 ana_misc1_set; /* 0x164 */ |
893 | u32 ana_misc1_clr; /* 0x168 */ | 896 | u32 ana_misc1_clr; /* 0x168 */ |
894 | u32 ana_misc1_tog; /* 0x16c */ | 897 | u32 ana_misc1_tog; /* 0x16c */ |
895 | u32 ana_misc2; /* 0x170 */ | 898 | u32 ana_misc2; /* 0x170 */ |
896 | u32 ana_misc2_set; /* 0x174 */ | 899 | u32 ana_misc2_set; /* 0x174 */ |
897 | u32 ana_misc2_clr; /* 0x178 */ | 900 | u32 ana_misc2_clr; /* 0x178 */ |
898 | u32 ana_misc2_tog; /* 0x17c */ | 901 | u32 ana_misc2_tog; /* 0x17c */ |
899 | u32 tempsense0; /* 0x180 */ | 902 | u32 tempsense0; /* 0x180 */ |
900 | u32 tempsense0_set; /* 0x184 */ | 903 | u32 tempsense0_set; /* 0x184 */ |
901 | u32 tempsense0_clr; /* 0x188 */ | 904 | u32 tempsense0_clr; /* 0x188 */ |
902 | u32 tempsense0_tog; /* 0x18c */ | 905 | u32 tempsense0_tog; /* 0x18c */ |
903 | u32 tempsense1; /* 0x190 */ | 906 | u32 tempsense1; /* 0x190 */ |
904 | u32 tempsense1_set; /* 0x194 */ | 907 | u32 tempsense1_set; /* 0x194 */ |
905 | u32 tempsense1_clr; /* 0x198 */ | 908 | u32 tempsense1_clr; /* 0x198 */ |
906 | u32 tempsense1_tog; /* 0x19c */ | 909 | u32 tempsense1_tog; /* 0x19c */ |
907 | u32 usb1_vbus_detect; /* 0x1a0 */ | 910 | u32 usb1_vbus_detect; /* 0x1a0 */ |
908 | u32 usb1_vbus_detect_set; /* 0x1a4 */ | 911 | u32 usb1_vbus_detect_set; /* 0x1a4 */ |
909 | u32 usb1_vbus_detect_clr; /* 0x1a8 */ | 912 | u32 usb1_vbus_detect_clr; /* 0x1a8 */ |
910 | u32 usb1_vbus_detect_tog; /* 0x1ac */ | 913 | u32 usb1_vbus_detect_tog; /* 0x1ac */ |
911 | u32 usb1_chrg_detect; /* 0x1b0 */ | 914 | u32 usb1_chrg_detect; /* 0x1b0 */ |
912 | u32 usb1_chrg_detect_set; /* 0x1b4 */ | 915 | u32 usb1_chrg_detect_set; /* 0x1b4 */ |
913 | u32 usb1_chrg_detect_clr; /* 0x1b8 */ | 916 | u32 usb1_chrg_detect_clr; /* 0x1b8 */ |
914 | u32 usb1_chrg_detect_tog; /* 0x1bc */ | 917 | u32 usb1_chrg_detect_tog; /* 0x1bc */ |
915 | u32 usb1_vbus_det_stat; /* 0x1c0 */ | 918 | u32 usb1_vbus_det_stat; /* 0x1c0 */ |
916 | u32 usb1_vbus_det_stat_set; /* 0x1c4 */ | 919 | u32 usb1_vbus_det_stat_set; /* 0x1c4 */ |
917 | u32 usb1_vbus_det_stat_clr; /* 0x1c8 */ | 920 | u32 usb1_vbus_det_stat_clr; /* 0x1c8 */ |
918 | u32 usb1_vbus_det_stat_tog; /* 0x1cc */ | 921 | u32 usb1_vbus_det_stat_tog; /* 0x1cc */ |
919 | u32 usb1_chrg_det_stat; /* 0x1d0 */ | 922 | u32 usb1_chrg_det_stat; /* 0x1d0 */ |
920 | u32 usb1_chrg_det_stat_set; /* 0x1d4 */ | 923 | u32 usb1_chrg_det_stat_set; /* 0x1d4 */ |
921 | u32 usb1_chrg_det_stat_clr; /* 0x1d8 */ | 924 | u32 usb1_chrg_det_stat_clr; /* 0x1d8 */ |
922 | u32 usb1_chrg_det_stat_tog; /* 0x1dc */ | 925 | u32 usb1_chrg_det_stat_tog; /* 0x1dc */ |
923 | u32 usb1_loopback; /* 0x1e0 */ | 926 | u32 usb1_loopback; /* 0x1e0 */ |
924 | u32 usb1_loopback_set; /* 0x1e4 */ | 927 | u32 usb1_loopback_set; /* 0x1e4 */ |
925 | u32 usb1_loopback_clr; /* 0x1e8 */ | 928 | u32 usb1_loopback_clr; /* 0x1e8 */ |
926 | u32 usb1_loopback_tog; /* 0x1ec */ | 929 | u32 usb1_loopback_tog; /* 0x1ec */ |
927 | u32 usb1_misc; /* 0x1f0 */ | 930 | u32 usb1_misc; /* 0x1f0 */ |
928 | u32 usb1_misc_set; /* 0x1f4 */ | 931 | u32 usb1_misc_set; /* 0x1f4 */ |
929 | u32 usb1_misc_clr; /* 0x1f8 */ | 932 | u32 usb1_misc_clr; /* 0x1f8 */ |
930 | u32 usb1_misc_tog; /* 0x1fc */ | 933 | u32 usb1_misc_tog; /* 0x1fc */ |
931 | u32 usb2_vbus_detect; /* 0x200 */ | 934 | u32 usb2_vbus_detect; /* 0x200 */ |
932 | u32 usb2_vbus_detect_set; /* 0x204 */ | 935 | u32 usb2_vbus_detect_set; /* 0x204 */ |
933 | u32 usb2_vbus_detect_clr; /* 0x208 */ | 936 | u32 usb2_vbus_detect_clr; /* 0x208 */ |
934 | u32 usb2_vbus_detect_tog; /* 0x20c */ | 937 | u32 usb2_vbus_detect_tog; /* 0x20c */ |
935 | u32 usb2_chrg_detect; /* 0x210 */ | 938 | u32 usb2_chrg_detect; /* 0x210 */ |
936 | u32 usb2_chrg_detect_set; /* 0x214 */ | 939 | u32 usb2_chrg_detect_set; /* 0x214 */ |
937 | u32 usb2_chrg_detect_clr; /* 0x218 */ | 940 | u32 usb2_chrg_detect_clr; /* 0x218 */ |
938 | u32 usb2_chrg_detect_tog; /* 0x21c */ | 941 | u32 usb2_chrg_detect_tog; /* 0x21c */ |
939 | u32 usb2_vbus_det_stat; /* 0x220 */ | 942 | u32 usb2_vbus_det_stat; /* 0x220 */ |
940 | u32 usb2_vbus_det_stat_set; /* 0x224 */ | 943 | u32 usb2_vbus_det_stat_set; /* 0x224 */ |
941 | u32 usb2_vbus_det_stat_clr; /* 0x228 */ | 944 | u32 usb2_vbus_det_stat_clr; /* 0x228 */ |
942 | u32 usb2_vbus_det_stat_tog; /* 0x22c */ | 945 | u32 usb2_vbus_det_stat_tog; /* 0x22c */ |
943 | u32 usb2_chrg_det_stat; /* 0x230 */ | 946 | u32 usb2_chrg_det_stat; /* 0x230 */ |
944 | u32 usb2_chrg_det_stat_set; /* 0x234 */ | 947 | u32 usb2_chrg_det_stat_set; /* 0x234 */ |
945 | u32 usb2_chrg_det_stat_clr; /* 0x238 */ | 948 | u32 usb2_chrg_det_stat_clr; /* 0x238 */ |
946 | u32 usb2_chrg_det_stat_tog; /* 0x23c */ | 949 | u32 usb2_chrg_det_stat_tog; /* 0x23c */ |
947 | u32 usb2_loopback; /* 0x240 */ | 950 | u32 usb2_loopback; /* 0x240 */ |
948 | u32 usb2_loopback_set; /* 0x244 */ | 951 | u32 usb2_loopback_set; /* 0x244 */ |
949 | u32 usb2_loopback_clr; /* 0x248 */ | 952 | u32 usb2_loopback_clr; /* 0x248 */ |
950 | u32 usb2_loopback_tog; /* 0x24c */ | 953 | u32 usb2_loopback_tog; /* 0x24c */ |
951 | u32 usb2_misc; /* 0x250 */ | 954 | u32 usb2_misc; /* 0x250 */ |
952 | u32 usb2_misc_set; /* 0x254 */ | 955 | u32 usb2_misc_set; /* 0x254 */ |
953 | u32 usb2_misc_clr; /* 0x258 */ | 956 | u32 usb2_misc_clr; /* 0x258 */ |
954 | u32 usb2_misc_tog; /* 0x25c */ | 957 | u32 usb2_misc_tog; /* 0x25c */ |
955 | u32 digprog; /* 0x260 */ | 958 | u32 digprog; /* 0x260 */ |
956 | u32 reserved1[7]; | 959 | u32 reserved1[7]; |
957 | u32 digprog_sololite; /* 0x280 */ | 960 | u32 digprog_sololite; /* 0x280 */ |
958 | }; | 961 | }; |
959 | 962 | ||
960 | #define ANATOP_PFD_FRAC_SHIFT(n) ((n)*8) | 963 | #define ANATOP_PFD_FRAC_SHIFT(n) ((n)*8) |
961 | #define ANATOP_PFD_FRAC_MASK(n) (0x3f<<ANATOP_PFD_FRAC_SHIFT(n)) | 964 | #define ANATOP_PFD_FRAC_MASK(n) (0x3f<<ANATOP_PFD_FRAC_SHIFT(n)) |
962 | #define ANATOP_PFD_STABLE_SHIFT(n) (6+((n)*8)) | 965 | #define ANATOP_PFD_STABLE_SHIFT(n) (6+((n)*8)) |
963 | #define ANATOP_PFD_STABLE_MASK(n) (1<<ANATOP_PFD_STABLE_SHIFT(n)) | 966 | #define ANATOP_PFD_STABLE_MASK(n) (1<<ANATOP_PFD_STABLE_SHIFT(n)) |
964 | #define ANATOP_PFD_CLKGATE_SHIFT(n) (7+((n)*8)) | 967 | #define ANATOP_PFD_CLKGATE_SHIFT(n) (7+((n)*8)) |
965 | #define ANATOP_PFD_CLKGATE_MASK(n) (1<<ANATOP_PFD_CLKGATE_SHIFT(n)) | 968 | #define ANATOP_PFD_CLKGATE_MASK(n) (1<<ANATOP_PFD_CLKGATE_SHIFT(n)) |
966 | 969 | ||
967 | struct wdog_regs { | 970 | struct wdog_regs { |
968 | u16 wcr; /* Control */ | 971 | u16 wcr; /* Control */ |
969 | u16 wsr; /* Service */ | 972 | u16 wsr; /* Service */ |
970 | u16 wrsr; /* Reset Status */ | 973 | u16 wrsr; /* Reset Status */ |
971 | u16 wicr; /* Interrupt Control */ | 974 | u16 wicr; /* Interrupt Control */ |
972 | u16 wmcr; /* Miscellaneous Control */ | 975 | u16 wmcr; /* Miscellaneous Control */ |
973 | }; | 976 | }; |
974 | 977 | ||
975 | #define PWMCR_PRESCALER(x) (((x - 1) & 0xFFF) << 4) | 978 | #define PWMCR_PRESCALER(x) (((x - 1) & 0xFFF) << 4) |
976 | #define PWMCR_DOZEEN (1 << 24) | 979 | #define PWMCR_DOZEEN (1 << 24) |
977 | #define PWMCR_WAITEN (1 << 23) | 980 | #define PWMCR_WAITEN (1 << 23) |
978 | #define PWMCR_DBGEN (1 << 22) | 981 | #define PWMCR_DBGEN (1 << 22) |
979 | #define PWMCR_CLKSRC_IPG_HIGH (2 << 16) | 982 | #define PWMCR_CLKSRC_IPG_HIGH (2 << 16) |
980 | #define PWMCR_CLKSRC_IPG (1 << 16) | 983 | #define PWMCR_CLKSRC_IPG (1 << 16) |
981 | #define PWMCR_EN (1 << 0) | 984 | #define PWMCR_EN (1 << 0) |
982 | 985 | ||
983 | struct pwm_regs { | 986 | struct pwm_regs { |
984 | u32 cr; | 987 | u32 cr; |
985 | u32 sr; | 988 | u32 sr; |
986 | u32 ir; | 989 | u32 ir; |
987 | u32 sar; | 990 | u32 sar; |
988 | u32 pr; | 991 | u32 pr; |
989 | u32 cnr; | 992 | u32 cnr; |
990 | }; | 993 | }; |
991 | #endif /* __ASSEMBLER__*/ | 994 | #endif /* __ASSEMBLER__*/ |
992 | #endif /* __ASM_ARCH_MX6_IMX_REGS_H__ */ | 995 | #endif /* __ASM_ARCH_MX6_IMX_REGS_H__ */ |
993 | 996 |
arch/arm/include/asm/arch-mx6/mx6-ddr.h
1 | /* | 1 | /* |
2 | * Copyright (C) 2013 Boundary Devices Inc. | 2 | * Copyright (C) 2013 Boundary Devices Inc. |
3 | * | 3 | * |
4 | * SPDX-License-Identifier: GPL-2.0+ | 4 | * SPDX-License-Identifier: GPL-2.0+ |
5 | */ | 5 | */ |
6 | #ifndef __ASM_ARCH_MX6_DDR_H__ | 6 | #ifndef __ASM_ARCH_MX6_DDR_H__ |
7 | #define __ASM_ARCH_MX6_DDR_H__ | 7 | #define __ASM_ARCH_MX6_DDR_H__ |
8 | 8 | ||
9 | #ifndef CONFIG_SPL_BUILD | 9 | #ifndef CONFIG_SPL_BUILD |
10 | #ifdef CONFIG_MX6Q | 10 | #ifdef CONFIG_MX6Q |
11 | #include "mx6q-ddr.h" | 11 | #include "mx6q-ddr.h" |
12 | #else | 12 | #else |
13 | #if defined(CONFIG_MX6DL) || defined(CONFIG_MX6S) | 13 | #if defined(CONFIG_MX6DL) || defined(CONFIG_MX6S) |
14 | #include "mx6dl-ddr.h" | 14 | #include "mx6dl-ddr.h" |
15 | #else | 15 | #else |
16 | #ifdef CONFIG_MX6SX | 16 | #ifdef CONFIG_MX6SX |
17 | #include "mx6sx-ddr.h" | 17 | #include "mx6sx-ddr.h" |
18 | #else | 18 | #else |
19 | #ifdef CONFIG_MX6UL | 19 | #if defined(CONFIG_MX6UL) || defined(CONFIG_MX6ULL) |
20 | #include "mx6ul-ddr.h" | 20 | #include "mx6ul-ddr.h" |
21 | #else | 21 | #else |
22 | #ifdef CONFIG_MX6SL | 22 | #ifdef CONFIG_MX6SL |
23 | #include "mx6sl-ddr.h" | 23 | #include "mx6sl-ddr.h" |
24 | #else | 24 | #else |
25 | #error "Please select cpu" | 25 | #error "Please select cpu" |
26 | #endif /* CONFIG_MX6SL */ | 26 | #endif /* CONFIG_MX6SL */ |
27 | #endif /* CONFIG_MX6UL */ | 27 | #endif /* CONFIG_MX6UL */ |
28 | #endif /* CONFIG_MX6SX */ | 28 | #endif /* CONFIG_MX6SX */ |
29 | #endif /* CONFIG_MX6DL or CONFIG_MX6S */ | 29 | #endif /* CONFIG_MX6DL or CONFIG_MX6S */ |
30 | #endif /* CONFIG_MX6Q */ | 30 | #endif /* CONFIG_MX6Q */ |
31 | #else | 31 | #else |
32 | 32 | ||
33 | enum { | 33 | enum { |
34 | DDR_TYPE_DDR3, | 34 | DDR_TYPE_DDR3, |
35 | DDR_TYPE_LPDDR2, | 35 | DDR_TYPE_LPDDR2, |
36 | }; | 36 | }; |
37 | 37 | ||
38 | /* MMDC P0/P1 Registers */ | 38 | /* MMDC P0/P1 Registers */ |
39 | struct mmdc_p_regs { | 39 | struct mmdc_p_regs { |
40 | u32 mdctl; | 40 | u32 mdctl; |
41 | u32 mdpdc; | 41 | u32 mdpdc; |
42 | u32 mdotc; | 42 | u32 mdotc; |
43 | u32 mdcfg0; | 43 | u32 mdcfg0; |
44 | u32 mdcfg1; | 44 | u32 mdcfg1; |
45 | u32 mdcfg2; | 45 | u32 mdcfg2; |
46 | u32 mdmisc; | 46 | u32 mdmisc; |
47 | u32 mdscr; | 47 | u32 mdscr; |
48 | u32 mdref; | 48 | u32 mdref; |
49 | u32 res1[2]; | 49 | u32 res1[2]; |
50 | u32 mdrwd; | 50 | u32 mdrwd; |
51 | u32 mdor; | 51 | u32 mdor; |
52 | u32 mdmrr; | 52 | u32 mdmrr; |
53 | u32 mdcfg3lp; | 53 | u32 mdcfg3lp; |
54 | u32 mdmr4; | 54 | u32 mdmr4; |
55 | u32 mdasp; | 55 | u32 mdasp; |
56 | u32 res2[239]; | 56 | u32 res2[239]; |
57 | u32 maarcr; | 57 | u32 maarcr; |
58 | u32 mapsr; | 58 | u32 mapsr; |
59 | u32 maexidr0; | 59 | u32 maexidr0; |
60 | u32 maexidr1; | 60 | u32 maexidr1; |
61 | u32 madpcr0; | 61 | u32 madpcr0; |
62 | u32 madpcr1; | 62 | u32 madpcr1; |
63 | u32 madpsr0; | 63 | u32 madpsr0; |
64 | u32 madpsr1; | 64 | u32 madpsr1; |
65 | u32 madpsr2; | 65 | u32 madpsr2; |
66 | u32 madpsr3; | 66 | u32 madpsr3; |
67 | u32 madpsr4; | 67 | u32 madpsr4; |
68 | u32 madpsr5; | 68 | u32 madpsr5; |
69 | u32 masbs0; | 69 | u32 masbs0; |
70 | u32 masbs1; | 70 | u32 masbs1; |
71 | u32 res3[2]; | 71 | u32 res3[2]; |
72 | u32 magenp; | 72 | u32 magenp; |
73 | u32 res4[239]; | 73 | u32 res4[239]; |
74 | u32 mpzqhwctrl; | 74 | u32 mpzqhwctrl; |
75 | u32 mpzqswctrl; | 75 | u32 mpzqswctrl; |
76 | u32 mpwlgcr; | 76 | u32 mpwlgcr; |
77 | u32 mpwldectrl0; | 77 | u32 mpwldectrl0; |
78 | u32 mpwldectrl1; | 78 | u32 mpwldectrl1; |
79 | u32 mpwldlst; | 79 | u32 mpwldlst; |
80 | u32 mpodtctrl; | 80 | u32 mpodtctrl; |
81 | u32 mprddqby0dl; | 81 | u32 mprddqby0dl; |
82 | u32 mprddqby1dl; | 82 | u32 mprddqby1dl; |
83 | u32 mprddqby2dl; | 83 | u32 mprddqby2dl; |
84 | u32 mprddqby3dl; | 84 | u32 mprddqby3dl; |
85 | u32 mpwrdqby0dl; | 85 | u32 mpwrdqby0dl; |
86 | u32 mpwrdqby1dl; | 86 | u32 mpwrdqby1dl; |
87 | u32 mpwrdqby2dl; | 87 | u32 mpwrdqby2dl; |
88 | u32 mpwrdqby3dl; | 88 | u32 mpwrdqby3dl; |
89 | u32 mpdgctrl0; | 89 | u32 mpdgctrl0; |
90 | u32 mpdgctrl1; | 90 | u32 mpdgctrl1; |
91 | u32 mpdgdlst0; | 91 | u32 mpdgdlst0; |
92 | u32 mprddlctl; | 92 | u32 mprddlctl; |
93 | u32 mprddlst; | 93 | u32 mprddlst; |
94 | u32 mpwrdlctl; | 94 | u32 mpwrdlctl; |
95 | u32 mpwrdlst; | 95 | u32 mpwrdlst; |
96 | u32 mpsdctrl; | 96 | u32 mpsdctrl; |
97 | u32 mpzqlp2ctl; | 97 | u32 mpzqlp2ctl; |
98 | u32 mprddlhwctl; | 98 | u32 mprddlhwctl; |
99 | u32 mpwrdlhwctl; | 99 | u32 mpwrdlhwctl; |
100 | u32 mprddlhwst0; | 100 | u32 mprddlhwst0; |
101 | u32 mprddlhwst1; | 101 | u32 mprddlhwst1; |
102 | u32 mpwrdlhwst0; | 102 | u32 mpwrdlhwst0; |
103 | u32 mpwrdlhwst1; | 103 | u32 mpwrdlhwst1; |
104 | u32 mpwlhwerr; | 104 | u32 mpwlhwerr; |
105 | u32 mpdghwst0; | 105 | u32 mpdghwst0; |
106 | u32 mpdghwst1; | 106 | u32 mpdghwst1; |
107 | u32 mpdghwst2; | 107 | u32 mpdghwst2; |
108 | u32 mpdghwst3; | 108 | u32 mpdghwst3; |
109 | u32 mppdcmpr1; | 109 | u32 mppdcmpr1; |
110 | u32 mppdcmpr2; | 110 | u32 mppdcmpr2; |
111 | u32 mpswdar0; | 111 | u32 mpswdar0; |
112 | u32 mpswdrdr0; | 112 | u32 mpswdrdr0; |
113 | u32 mpswdrdr1; | 113 | u32 mpswdrdr1; |
114 | u32 mpswdrdr2; | 114 | u32 mpswdrdr2; |
115 | u32 mpswdrdr3; | 115 | u32 mpswdrdr3; |
116 | u32 mpswdrdr4; | 116 | u32 mpswdrdr4; |
117 | u32 mpswdrdr5; | 117 | u32 mpswdrdr5; |
118 | u32 mpswdrdr6; | 118 | u32 mpswdrdr6; |
119 | u32 mpswdrdr7; | 119 | u32 mpswdrdr7; |
120 | u32 mpmur0; | 120 | u32 mpmur0; |
121 | u32 mpwrcadl; | 121 | u32 mpwrcadl; |
122 | u32 mpdccr; | 122 | u32 mpdccr; |
123 | }; | 123 | }; |
124 | 124 | ||
125 | #define MX6SL_IOM_DDR_BASE 0x020e0300 | 125 | #define MX6SL_IOM_DDR_BASE 0x020e0300 |
126 | struct mx6sl_iomux_ddr_regs { | 126 | struct mx6sl_iomux_ddr_regs { |
127 | u32 dram_cas; | 127 | u32 dram_cas; |
128 | u32 dram_cs0_b; | 128 | u32 dram_cs0_b; |
129 | u32 dram_cs1_b; | 129 | u32 dram_cs1_b; |
130 | u32 dram_dqm0; | 130 | u32 dram_dqm0; |
131 | u32 dram_dqm1; | 131 | u32 dram_dqm1; |
132 | u32 dram_dqm2; | 132 | u32 dram_dqm2; |
133 | u32 dram_dqm3; | 133 | u32 dram_dqm3; |
134 | u32 dram_ras; | 134 | u32 dram_ras; |
135 | u32 dram_reset; | 135 | u32 dram_reset; |
136 | u32 dram_sdba0; | 136 | u32 dram_sdba0; |
137 | u32 dram_sdba1; | 137 | u32 dram_sdba1; |
138 | u32 dram_sdba2; | 138 | u32 dram_sdba2; |
139 | u32 dram_sdcke0; | 139 | u32 dram_sdcke0; |
140 | u32 dram_sdcke1; | 140 | u32 dram_sdcke1; |
141 | u32 dram_sdclk_0; | 141 | u32 dram_sdclk_0; |
142 | u32 dram_odt0; | 142 | u32 dram_odt0; |
143 | u32 dram_odt1; | 143 | u32 dram_odt1; |
144 | u32 dram_sdqs0; | 144 | u32 dram_sdqs0; |
145 | u32 dram_sdqs1; | 145 | u32 dram_sdqs1; |
146 | u32 dram_sdqs2; | 146 | u32 dram_sdqs2; |
147 | u32 dram_sdqs3; | 147 | u32 dram_sdqs3; |
148 | u32 dram_sdwe_b; | 148 | u32 dram_sdwe_b; |
149 | }; | 149 | }; |
150 | 150 | ||
151 | #define MX6SL_IOM_GRP_BASE 0x020e0500 | 151 | #define MX6SL_IOM_GRP_BASE 0x020e0500 |
152 | struct mx6sl_iomux_grp_regs { | 152 | struct mx6sl_iomux_grp_regs { |
153 | u32 res1[43]; | 153 | u32 res1[43]; |
154 | u32 grp_addds; | 154 | u32 grp_addds; |
155 | u32 grp_ddrmode_ctl; | 155 | u32 grp_ddrmode_ctl; |
156 | u32 grp_ddrpke; | 156 | u32 grp_ddrpke; |
157 | u32 grp_ddrpk; | 157 | u32 grp_ddrpk; |
158 | u32 grp_ddrhys; | 158 | u32 grp_ddrhys; |
159 | u32 grp_ddrmode; | 159 | u32 grp_ddrmode; |
160 | u32 grp_b0ds; | 160 | u32 grp_b0ds; |
161 | u32 grp_ctlds; | 161 | u32 grp_ctlds; |
162 | u32 grp_b1ds; | 162 | u32 grp_b1ds; |
163 | u32 grp_ddr_type; | 163 | u32 grp_ddr_type; |
164 | u32 grp_b2ds; | 164 | u32 grp_b2ds; |
165 | u32 grp_b3ds; | 165 | u32 grp_b3ds; |
166 | }; | 166 | }; |
167 | 167 | ||
168 | #define MX6UL_IOM_DDR_BASE 0x020e0200 | 168 | #define MX6UL_IOM_DDR_BASE 0x020e0200 |
169 | struct mx6ul_iomux_ddr_regs { | 169 | struct mx6ul_iomux_ddr_regs { |
170 | u32 res1[17]; | 170 | u32 res1[17]; |
171 | u32 dram_dqm0; | 171 | u32 dram_dqm0; |
172 | u32 dram_dqm1; | 172 | u32 dram_dqm1; |
173 | u32 dram_ras; | 173 | u32 dram_ras; |
174 | u32 dram_cas; | 174 | u32 dram_cas; |
175 | u32 dram_cs0; | 175 | u32 dram_cs0; |
176 | u32 dram_cs1; | 176 | u32 dram_cs1; |
177 | u32 dram_sdwe_b; | 177 | u32 dram_sdwe_b; |
178 | u32 dram_odt0; | 178 | u32 dram_odt0; |
179 | u32 dram_odt1; | 179 | u32 dram_odt1; |
180 | u32 dram_sdba0; | 180 | u32 dram_sdba0; |
181 | u32 dram_sdba1; | 181 | u32 dram_sdba1; |
182 | u32 dram_sdba2; | 182 | u32 dram_sdba2; |
183 | u32 dram_sdcke0; | 183 | u32 dram_sdcke0; |
184 | u32 dram_sdcke1; | 184 | u32 dram_sdcke1; |
185 | u32 dram_sdclk_0; | 185 | u32 dram_sdclk_0; |
186 | u32 dram_sdqs0; | 186 | u32 dram_sdqs0; |
187 | u32 dram_sdqs1; | 187 | u32 dram_sdqs1; |
188 | u32 dram_reset; | 188 | u32 dram_reset; |
189 | }; | 189 | }; |
190 | 190 | ||
191 | #define MX6UL_IOM_GRP_BASE 0x020e0400 | 191 | #define MX6UL_IOM_GRP_BASE 0x020e0400 |
192 | struct mx6ul_iomux_grp_regs { | 192 | struct mx6ul_iomux_grp_regs { |
193 | u32 res1[36]; | 193 | u32 res1[36]; |
194 | u32 grp_addds; | 194 | u32 grp_addds; |
195 | u32 grp_ddrmode_ctl; | 195 | u32 grp_ddrmode_ctl; |
196 | u32 grp_b0ds; | 196 | u32 grp_b0ds; |
197 | u32 grp_ddrpk; | 197 | u32 grp_ddrpk; |
198 | u32 grp_ctlds; | 198 | u32 grp_ctlds; |
199 | u32 grp_b1ds; | 199 | u32 grp_b1ds; |
200 | u32 grp_ddrhys; | 200 | u32 grp_ddrhys; |
201 | u32 grp_ddrpke; | 201 | u32 grp_ddrpke; |
202 | u32 grp_ddrmode; | 202 | u32 grp_ddrmode; |
203 | u32 grp_ddr_type; | 203 | u32 grp_ddr_type; |
204 | }; | 204 | }; |
205 | 205 | ||
206 | #define MX6SX_IOM_DDR_BASE 0x020e0200 | 206 | #define MX6SX_IOM_DDR_BASE 0x020e0200 |
207 | struct mx6sx_iomux_ddr_regs { | 207 | struct mx6sx_iomux_ddr_regs { |
208 | u32 res1[59]; | 208 | u32 res1[59]; |
209 | u32 dram_dqm0; | 209 | u32 dram_dqm0; |
210 | u32 dram_dqm1; | 210 | u32 dram_dqm1; |
211 | u32 dram_dqm2; | 211 | u32 dram_dqm2; |
212 | u32 dram_dqm3; | 212 | u32 dram_dqm3; |
213 | u32 dram_ras; | 213 | u32 dram_ras; |
214 | u32 dram_cas; | 214 | u32 dram_cas; |
215 | u32 res2[2]; | 215 | u32 res2[2]; |
216 | u32 dram_sdwe_b; | 216 | u32 dram_sdwe_b; |
217 | u32 dram_odt0; | 217 | u32 dram_odt0; |
218 | u32 dram_odt1; | 218 | u32 dram_odt1; |
219 | u32 dram_sdba0; | 219 | u32 dram_sdba0; |
220 | u32 dram_sdba1; | 220 | u32 dram_sdba1; |
221 | u32 dram_sdba2; | 221 | u32 dram_sdba2; |
222 | u32 dram_sdcke0; | 222 | u32 dram_sdcke0; |
223 | u32 dram_sdcke1; | 223 | u32 dram_sdcke1; |
224 | u32 dram_sdclk_0; | 224 | u32 dram_sdclk_0; |
225 | u32 dram_sdqs0; | 225 | u32 dram_sdqs0; |
226 | u32 dram_sdqs1; | 226 | u32 dram_sdqs1; |
227 | u32 dram_sdqs2; | 227 | u32 dram_sdqs2; |
228 | u32 dram_sdqs3; | 228 | u32 dram_sdqs3; |
229 | u32 dram_reset; | 229 | u32 dram_reset; |
230 | }; | 230 | }; |
231 | 231 | ||
232 | #define MX6SX_IOM_GRP_BASE 0x020e0500 | 232 | #define MX6SX_IOM_GRP_BASE 0x020e0500 |
233 | struct mx6sx_iomux_grp_regs { | 233 | struct mx6sx_iomux_grp_regs { |
234 | u32 res1[61]; | 234 | u32 res1[61]; |
235 | u32 grp_addds; | 235 | u32 grp_addds; |
236 | u32 grp_ddrmode_ctl; | 236 | u32 grp_ddrmode_ctl; |
237 | u32 grp_ddrpke; | 237 | u32 grp_ddrpke; |
238 | u32 grp_ddrpk; | 238 | u32 grp_ddrpk; |
239 | u32 grp_ddrhys; | 239 | u32 grp_ddrhys; |
240 | u32 grp_ddrmode; | 240 | u32 grp_ddrmode; |
241 | u32 grp_b0ds; | 241 | u32 grp_b0ds; |
242 | u32 grp_b1ds; | 242 | u32 grp_b1ds; |
243 | u32 grp_ctlds; | 243 | u32 grp_ctlds; |
244 | u32 grp_ddr_type; | 244 | u32 grp_ddr_type; |
245 | u32 grp_b2ds; | 245 | u32 grp_b2ds; |
246 | u32 grp_b3ds; | 246 | u32 grp_b3ds; |
247 | }; | 247 | }; |
248 | 248 | ||
249 | /* | 249 | /* |
250 | * MMDC iomux registers (pinctl/padctl) - (different for IMX6DQ vs IMX6SDL) | 250 | * MMDC iomux registers (pinctl/padctl) - (different for IMX6DQ vs IMX6SDL) |
251 | */ | 251 | */ |
252 | #define MX6DQ_IOM_DDR_BASE 0x020e0500 | 252 | #define MX6DQ_IOM_DDR_BASE 0x020e0500 |
253 | struct mx6dq_iomux_ddr_regs { | 253 | struct mx6dq_iomux_ddr_regs { |
254 | u32 res1[3]; | 254 | u32 res1[3]; |
255 | u32 dram_sdqs5; | 255 | u32 dram_sdqs5; |
256 | u32 dram_dqm5; | 256 | u32 dram_dqm5; |
257 | u32 dram_dqm4; | 257 | u32 dram_dqm4; |
258 | u32 dram_sdqs4; | 258 | u32 dram_sdqs4; |
259 | u32 dram_sdqs3; | 259 | u32 dram_sdqs3; |
260 | u32 dram_dqm3; | 260 | u32 dram_dqm3; |
261 | u32 dram_sdqs2; | 261 | u32 dram_sdqs2; |
262 | u32 dram_dqm2; | 262 | u32 dram_dqm2; |
263 | u32 res2[16]; | 263 | u32 res2[16]; |
264 | u32 dram_cas; | 264 | u32 dram_cas; |
265 | u32 res3[2]; | 265 | u32 res3[2]; |
266 | u32 dram_ras; | 266 | u32 dram_ras; |
267 | u32 dram_reset; | 267 | u32 dram_reset; |
268 | u32 res4[2]; | 268 | u32 res4[2]; |
269 | u32 dram_sdclk_0; | 269 | u32 dram_sdclk_0; |
270 | u32 dram_sdba2; | 270 | u32 dram_sdba2; |
271 | u32 dram_sdcke0; | 271 | u32 dram_sdcke0; |
272 | u32 dram_sdclk_1; | 272 | u32 dram_sdclk_1; |
273 | u32 dram_sdcke1; | 273 | u32 dram_sdcke1; |
274 | u32 dram_sdodt0; | 274 | u32 dram_sdodt0; |
275 | u32 dram_sdodt1; | 275 | u32 dram_sdodt1; |
276 | u32 res5; | 276 | u32 res5; |
277 | u32 dram_sdqs0; | 277 | u32 dram_sdqs0; |
278 | u32 dram_dqm0; | 278 | u32 dram_dqm0; |
279 | u32 dram_sdqs1; | 279 | u32 dram_sdqs1; |
280 | u32 dram_dqm1; | 280 | u32 dram_dqm1; |
281 | u32 dram_sdqs6; | 281 | u32 dram_sdqs6; |
282 | u32 dram_dqm6; | 282 | u32 dram_dqm6; |
283 | u32 dram_sdqs7; | 283 | u32 dram_sdqs7; |
284 | u32 dram_dqm7; | 284 | u32 dram_dqm7; |
285 | }; | 285 | }; |
286 | 286 | ||
287 | #define MX6DQ_IOM_GRP_BASE 0x020e0700 | 287 | #define MX6DQ_IOM_GRP_BASE 0x020e0700 |
288 | struct mx6dq_iomux_grp_regs { | 288 | struct mx6dq_iomux_grp_regs { |
289 | u32 res1[18]; | 289 | u32 res1[18]; |
290 | u32 grp_b7ds; | 290 | u32 grp_b7ds; |
291 | u32 grp_addds; | 291 | u32 grp_addds; |
292 | u32 grp_ddrmode_ctl; | 292 | u32 grp_ddrmode_ctl; |
293 | u32 res2; | 293 | u32 res2; |
294 | u32 grp_ddrpke; | 294 | u32 grp_ddrpke; |
295 | u32 res3[6]; | 295 | u32 res3[6]; |
296 | u32 grp_ddrmode; | 296 | u32 grp_ddrmode; |
297 | u32 res4[3]; | 297 | u32 res4[3]; |
298 | u32 grp_b0ds; | 298 | u32 grp_b0ds; |
299 | u32 grp_b1ds; | 299 | u32 grp_b1ds; |
300 | u32 grp_ctlds; | 300 | u32 grp_ctlds; |
301 | u32 res5; | 301 | u32 res5; |
302 | u32 grp_b2ds; | 302 | u32 grp_b2ds; |
303 | u32 grp_ddr_type; | 303 | u32 grp_ddr_type; |
304 | u32 grp_b3ds; | 304 | u32 grp_b3ds; |
305 | u32 grp_b4ds; | 305 | u32 grp_b4ds; |
306 | u32 grp_b5ds; | 306 | u32 grp_b5ds; |
307 | u32 grp_b6ds; | 307 | u32 grp_b6ds; |
308 | }; | 308 | }; |
309 | 309 | ||
310 | #define MX6SDL_IOM_DDR_BASE 0x020e0400 | 310 | #define MX6SDL_IOM_DDR_BASE 0x020e0400 |
311 | struct mx6sdl_iomux_ddr_regs { | 311 | struct mx6sdl_iomux_ddr_regs { |
312 | u32 res1[25]; | 312 | u32 res1[25]; |
313 | u32 dram_cas; | 313 | u32 dram_cas; |
314 | u32 res2[2]; | 314 | u32 res2[2]; |
315 | u32 dram_dqm0; | 315 | u32 dram_dqm0; |
316 | u32 dram_dqm1; | 316 | u32 dram_dqm1; |
317 | u32 dram_dqm2; | 317 | u32 dram_dqm2; |
318 | u32 dram_dqm3; | 318 | u32 dram_dqm3; |
319 | u32 dram_dqm4; | 319 | u32 dram_dqm4; |
320 | u32 dram_dqm5; | 320 | u32 dram_dqm5; |
321 | u32 dram_dqm6; | 321 | u32 dram_dqm6; |
322 | u32 dram_dqm7; | 322 | u32 dram_dqm7; |
323 | u32 dram_ras; | 323 | u32 dram_ras; |
324 | u32 dram_reset; | 324 | u32 dram_reset; |
325 | u32 res3[2]; | 325 | u32 res3[2]; |
326 | u32 dram_sdba2; | 326 | u32 dram_sdba2; |
327 | u32 dram_sdcke0; | 327 | u32 dram_sdcke0; |
328 | u32 dram_sdcke1; | 328 | u32 dram_sdcke1; |
329 | u32 dram_sdclk_0; | 329 | u32 dram_sdclk_0; |
330 | u32 dram_sdclk_1; | 330 | u32 dram_sdclk_1; |
331 | u32 dram_sdodt0; | 331 | u32 dram_sdodt0; |
332 | u32 dram_sdodt1; | 332 | u32 dram_sdodt1; |
333 | u32 dram_sdqs0; | 333 | u32 dram_sdqs0; |
334 | u32 dram_sdqs1; | 334 | u32 dram_sdqs1; |
335 | u32 dram_sdqs2; | 335 | u32 dram_sdqs2; |
336 | u32 dram_sdqs3; | 336 | u32 dram_sdqs3; |
337 | u32 dram_sdqs4; | 337 | u32 dram_sdqs4; |
338 | u32 dram_sdqs5; | 338 | u32 dram_sdqs5; |
339 | u32 dram_sdqs6; | 339 | u32 dram_sdqs6; |
340 | u32 dram_sdqs7; | 340 | u32 dram_sdqs7; |
341 | }; | 341 | }; |
342 | 342 | ||
343 | #define MX6SDL_IOM_GRP_BASE 0x020e0700 | 343 | #define MX6SDL_IOM_GRP_BASE 0x020e0700 |
344 | struct mx6sdl_iomux_grp_regs { | 344 | struct mx6sdl_iomux_grp_regs { |
345 | u32 res1[18]; | 345 | u32 res1[18]; |
346 | u32 grp_b7ds; | 346 | u32 grp_b7ds; |
347 | u32 grp_addds; | 347 | u32 grp_addds; |
348 | u32 grp_ddrmode_ctl; | 348 | u32 grp_ddrmode_ctl; |
349 | u32 grp_ddrpke; | 349 | u32 grp_ddrpke; |
350 | u32 res2[2]; | 350 | u32 res2[2]; |
351 | u32 grp_ddrmode; | 351 | u32 grp_ddrmode; |
352 | u32 grp_b0ds; | 352 | u32 grp_b0ds; |
353 | u32 res3; | 353 | u32 res3; |
354 | u32 grp_ctlds; | 354 | u32 grp_ctlds; |
355 | u32 grp_b1ds; | 355 | u32 grp_b1ds; |
356 | u32 grp_ddr_type; | 356 | u32 grp_ddr_type; |
357 | u32 grp_b2ds; | 357 | u32 grp_b2ds; |
358 | u32 grp_b3ds; | 358 | u32 grp_b3ds; |
359 | u32 grp_b4ds; | 359 | u32 grp_b4ds; |
360 | u32 grp_b5ds; | 360 | u32 grp_b5ds; |
361 | u32 res4; | 361 | u32 res4; |
362 | u32 grp_b6ds; | 362 | u32 grp_b6ds; |
363 | }; | 363 | }; |
364 | 364 | ||
365 | /* Device Information: Varies per DDR3 part number and speed grade */ | 365 | /* Device Information: Varies per DDR3 part number and speed grade */ |
366 | struct mx6_ddr3_cfg { | 366 | struct mx6_ddr3_cfg { |
367 | u16 mem_speed; /* ie 1600 for DDR3-1600 (800,1066,1333,1600) */ | 367 | u16 mem_speed; /* ie 1600 for DDR3-1600 (800,1066,1333,1600) */ |
368 | u8 density; /* chip density (Gb) (1,2,4,8) */ | 368 | u8 density; /* chip density (Gb) (1,2,4,8) */ |
369 | u8 width; /* bus width (bits) (4,8,16) */ | 369 | u8 width; /* bus width (bits) (4,8,16) */ |
370 | u8 banks; /* number of banks */ | 370 | u8 banks; /* number of banks */ |
371 | u8 rowaddr; /* row address bits (11-16)*/ | 371 | u8 rowaddr; /* row address bits (11-16)*/ |
372 | u8 coladdr; /* col address bits (9-12) */ | 372 | u8 coladdr; /* col address bits (9-12) */ |
373 | u8 pagesz; /* page size (K) (1-2) */ | 373 | u8 pagesz; /* page size (K) (1-2) */ |
374 | u16 trcd; /* tRCD=tRP=CL (ns*100) */ | 374 | u16 trcd; /* tRCD=tRP=CL (ns*100) */ |
375 | u16 trcmin; /* tRC min (ns*100) */ | 375 | u16 trcmin; /* tRC min (ns*100) */ |
376 | u16 trasmin; /* tRAS min (ns*100) */ | 376 | u16 trasmin; /* tRAS min (ns*100) */ |
377 | u8 SRT; /* self-refresh temperature: 0=normal, 1=extended */ | 377 | u8 SRT; /* self-refresh temperature: 0=normal, 1=extended */ |
378 | }; | 378 | }; |
379 | 379 | ||
380 | /* Device Information: Varies per LPDDR2 part number and speed grade */ | 380 | /* Device Information: Varies per LPDDR2 part number and speed grade */ |
381 | struct mx6_lpddr2_cfg { | 381 | struct mx6_lpddr2_cfg { |
382 | u16 mem_speed; /* ie 800 for LPDDR2-800 */ | 382 | u16 mem_speed; /* ie 800 for LPDDR2-800 */ |
383 | u8 density; /* chip density (Gb) (1,2,4,8) */ | 383 | u8 density; /* chip density (Gb) (1,2,4,8) */ |
384 | u8 width; /* bus width (bits) (4,8,16) */ | 384 | u8 width; /* bus width (bits) (4,8,16) */ |
385 | u8 banks; /* number of banks */ | 385 | u8 banks; /* number of banks */ |
386 | u8 rowaddr; /* row address bits (11-16)*/ | 386 | u8 rowaddr; /* row address bits (11-16)*/ |
387 | u8 coladdr; /* col address bits (9-12) */ | 387 | u8 coladdr; /* col address bits (9-12) */ |
388 | u16 trcd_lp; | 388 | u16 trcd_lp; |
389 | u16 trppb_lp; | 389 | u16 trppb_lp; |
390 | u16 trpab_lp; | 390 | u16 trpab_lp; |
391 | u16 trcmin; /* tRC min (ns*100) */ | 391 | u16 trcmin; /* tRC min (ns*100) */ |
392 | u16 trasmin; /* tRAS min (ns*100) */ | 392 | u16 trasmin; /* tRAS min (ns*100) */ |
393 | }; | 393 | }; |
394 | 394 | ||
395 | /* System Information: Varies per board design, layout, and term choices */ | 395 | /* System Information: Varies per board design, layout, and term choices */ |
396 | struct mx6_ddr_sysinfo { | 396 | struct mx6_ddr_sysinfo { |
397 | u8 dsize; /* size of bus (in dwords: 0=16bit,1=32bit,2=64bit) */ | 397 | u8 dsize; /* size of bus (in dwords: 0=16bit,1=32bit,2=64bit) */ |
398 | u8 cs_density; /* density per chip select (Gb) */ | 398 | u8 cs_density; /* density per chip select (Gb) */ |
399 | u8 ncs; /* number chip selects used (1|2) */ | 399 | u8 ncs; /* number chip selects used (1|2) */ |
400 | char cs1_mirror;/* enable address mirror (0|1) */ | 400 | char cs1_mirror;/* enable address mirror (0|1) */ |
401 | char bi_on; /* Bank interleaving enable */ | 401 | char bi_on; /* Bank interleaving enable */ |
402 | u8 rtt_nom; /* Rtt_Nom (DDR3_RTT_*) */ | 402 | u8 rtt_nom; /* Rtt_Nom (DDR3_RTT_*) */ |
403 | u8 rtt_wr; /* Rtt_Wr (DDR3_RTT_*) */ | 403 | u8 rtt_wr; /* Rtt_Wr (DDR3_RTT_*) */ |
404 | u8 ralat; /* Read Additional Latency (0-7) */ | 404 | u8 ralat; /* Read Additional Latency (0-7) */ |
405 | u8 walat; /* Write Additional Latency (0-3) */ | 405 | u8 walat; /* Write Additional Latency (0-3) */ |
406 | u8 mif3_mode; /* Command prediction working mode */ | 406 | u8 mif3_mode; /* Command prediction working mode */ |
407 | u8 rst_to_cke; /* Time from SDE enable to CKE rise */ | 407 | u8 rst_to_cke; /* Time from SDE enable to CKE rise */ |
408 | u8 sde_to_rst; /* Time from SDE enable until DDR reset# is high */ | 408 | u8 sde_to_rst; /* Time from SDE enable until DDR reset# is high */ |
409 | u8 pd_fast_exit;/* enable precharge powerdown fast-exit */ | 409 | u8 pd_fast_exit;/* enable precharge powerdown fast-exit */ |
410 | u8 ddr_type; /* DDR type: DDR3(0) or LPDDR2(1) */ | 410 | u8 ddr_type; /* DDR type: DDR3(0) or LPDDR2(1) */ |
411 | u8 refsel; /* REF_SEL field of register MDREF */ | 411 | u8 refsel; /* REF_SEL field of register MDREF */ |
412 | u8 refr; /* REFR field of register MDREF */ | 412 | u8 refr; /* REFR field of register MDREF */ |
413 | }; | 413 | }; |
414 | 414 | ||
415 | /* | 415 | /* |
416 | * Board specific calibration: | 416 | * Board specific calibration: |
417 | * This includes write leveling calibration values as well as DQS gating | 417 | * This includes write leveling calibration values as well as DQS gating |
418 | * and read/write delays. These values are board/layout/device specific. | 418 | * and read/write delays. These values are board/layout/device specific. |
419 | * Freescale recommends using the i.MX6 DDR Stress Test Tool V1.0.2 | 419 | * Freescale recommends using the i.MX6 DDR Stress Test Tool V1.0.2 |
420 | * (DOC-96412) to determine these values over a range of boards and | 420 | * (DOC-96412) to determine these values over a range of boards and |
421 | * temperatures. | 421 | * temperatures. |
422 | */ | 422 | */ |
423 | struct mx6_mmdc_calibration { | 423 | struct mx6_mmdc_calibration { |
424 | /* write leveling calibration */ | 424 | /* write leveling calibration */ |
425 | u32 p0_mpwldectrl0; | 425 | u32 p0_mpwldectrl0; |
426 | u32 p0_mpwldectrl1; | 426 | u32 p0_mpwldectrl1; |
427 | u32 p1_mpwldectrl0; | 427 | u32 p1_mpwldectrl0; |
428 | u32 p1_mpwldectrl1; | 428 | u32 p1_mpwldectrl1; |
429 | /* read DQS gating */ | 429 | /* read DQS gating */ |
430 | u32 p0_mpdgctrl0; | 430 | u32 p0_mpdgctrl0; |
431 | u32 p0_mpdgctrl1; | 431 | u32 p0_mpdgctrl1; |
432 | u32 p1_mpdgctrl0; | 432 | u32 p1_mpdgctrl0; |
433 | u32 p1_mpdgctrl1; | 433 | u32 p1_mpdgctrl1; |
434 | /* read delay */ | 434 | /* read delay */ |
435 | u32 p0_mprddlctl; | 435 | u32 p0_mprddlctl; |
436 | u32 p1_mprddlctl; | 436 | u32 p1_mprddlctl; |
437 | /* write delay */ | 437 | /* write delay */ |
438 | u32 p0_mpwrdlctl; | 438 | u32 p0_mpwrdlctl; |
439 | u32 p1_mpwrdlctl; | 439 | u32 p1_mpwrdlctl; |
440 | /* lpddr2 zq hw calibration */ | 440 | /* lpddr2 zq hw calibration */ |
441 | u32 mpzqlp2ctl; | 441 | u32 mpzqlp2ctl; |
442 | }; | 442 | }; |
443 | 443 | ||
444 | /* configure iomux (pinctl/padctl) */ | 444 | /* configure iomux (pinctl/padctl) */ |
445 | void mx6dq_dram_iocfg(unsigned width, | 445 | void mx6dq_dram_iocfg(unsigned width, |
446 | const struct mx6dq_iomux_ddr_regs *, | 446 | const struct mx6dq_iomux_ddr_regs *, |
447 | const struct mx6dq_iomux_grp_regs *); | 447 | const struct mx6dq_iomux_grp_regs *); |
448 | void mx6sdl_dram_iocfg(unsigned width, | 448 | void mx6sdl_dram_iocfg(unsigned width, |
449 | const struct mx6sdl_iomux_ddr_regs *, | 449 | const struct mx6sdl_iomux_ddr_regs *, |
450 | const struct mx6sdl_iomux_grp_regs *); | 450 | const struct mx6sdl_iomux_grp_regs *); |
451 | void mx6sx_dram_iocfg(unsigned width, | 451 | void mx6sx_dram_iocfg(unsigned width, |
452 | const struct mx6sx_iomux_ddr_regs *, | 452 | const struct mx6sx_iomux_ddr_regs *, |
453 | const struct mx6sx_iomux_grp_regs *); | 453 | const struct mx6sx_iomux_grp_regs *); |
454 | void mx6ul_dram_iocfg(unsigned width, | 454 | void mx6ul_dram_iocfg(unsigned width, |
455 | const struct mx6ul_iomux_ddr_regs *, | 455 | const struct mx6ul_iomux_ddr_regs *, |
456 | const struct mx6ul_iomux_grp_regs *); | 456 | const struct mx6ul_iomux_grp_regs *); |
457 | void mx6sl_dram_iocfg(unsigned width, | 457 | void mx6sl_dram_iocfg(unsigned width, |
458 | const struct mx6sl_iomux_ddr_regs *, | 458 | const struct mx6sl_iomux_ddr_regs *, |
459 | const struct mx6sl_iomux_grp_regs *); | 459 | const struct mx6sl_iomux_grp_regs *); |
460 | 460 | ||
461 | #if defined(CONFIG_MX6_DDRCAL) | 461 | #if defined(CONFIG_MX6_DDRCAL) |
462 | int mmdc_do_write_level_calibration(struct mx6_ddr_sysinfo const *sysinfo); | 462 | int mmdc_do_write_level_calibration(struct mx6_ddr_sysinfo const *sysinfo); |
463 | int mmdc_do_dqs_calibration(struct mx6_ddr_sysinfo const *sysinfo); | 463 | int mmdc_do_dqs_calibration(struct mx6_ddr_sysinfo const *sysinfo); |
464 | void mmdc_read_calibration(struct mx6_ddr_sysinfo const *sysinfo, | 464 | void mmdc_read_calibration(struct mx6_ddr_sysinfo const *sysinfo, |
465 | struct mx6_mmdc_calibration *calib); | 465 | struct mx6_mmdc_calibration *calib); |
466 | #endif | 466 | #endif |
467 | 467 | ||
468 | /* configure mx6 mmdc registers */ | 468 | /* configure mx6 mmdc registers */ |
469 | void mx6_dram_cfg(const struct mx6_ddr_sysinfo *, | 469 | void mx6_dram_cfg(const struct mx6_ddr_sysinfo *, |
470 | const struct mx6_mmdc_calibration *, | 470 | const struct mx6_mmdc_calibration *, |
471 | const void *); | 471 | const void *); |
472 | 472 | ||
473 | #endif /* CONFIG_SPL_BUILD */ | 473 | #endif /* CONFIG_SPL_BUILD */ |
474 | 474 | ||
475 | #define MX6_MMDC_P0_MDCTL 0x021b0000 | 475 | #define MX6_MMDC_P0_MDCTL 0x021b0000 |
476 | #define MX6_MMDC_P0_MDPDC 0x021b0004 | 476 | #define MX6_MMDC_P0_MDPDC 0x021b0004 |
477 | #define MX6_MMDC_P0_MDOTC 0x021b0008 | 477 | #define MX6_MMDC_P0_MDOTC 0x021b0008 |
478 | #define MX6_MMDC_P0_MDCFG0 0x021b000c | 478 | #define MX6_MMDC_P0_MDCFG0 0x021b000c |
479 | #define MX6_MMDC_P0_MDCFG1 0x021b0010 | 479 | #define MX6_MMDC_P0_MDCFG1 0x021b0010 |
480 | #define MX6_MMDC_P0_MDCFG2 0x021b0014 | 480 | #define MX6_MMDC_P0_MDCFG2 0x021b0014 |
481 | #define MX6_MMDC_P0_MDMISC 0x021b0018 | 481 | #define MX6_MMDC_P0_MDMISC 0x021b0018 |
482 | #define MX6_MMDC_P0_MDSCR 0x021b001c | 482 | #define MX6_MMDC_P0_MDSCR 0x021b001c |
483 | #define MX6_MMDC_P0_MDREF 0x021b0020 | 483 | #define MX6_MMDC_P0_MDREF 0x021b0020 |
484 | #define MX6_MMDC_P0_MDRWD 0x021b002c | 484 | #define MX6_MMDC_P0_MDRWD 0x021b002c |
485 | #define MX6_MMDC_P0_MDOR 0x021b0030 | 485 | #define MX6_MMDC_P0_MDOR 0x021b0030 |
486 | #define MX6_MMDC_P0_MDASP 0x021b0040 | 486 | #define MX6_MMDC_P0_MDASP 0x021b0040 |
487 | #define MX6_MMDC_P0_MAPSR 0x021b0404 | 487 | #define MX6_MMDC_P0_MAPSR 0x021b0404 |
488 | #define MX6_MMDC_P0_MPZQHWCTRL 0x021b0800 | 488 | #define MX6_MMDC_P0_MPZQHWCTRL 0x021b0800 |
489 | #define MX6_MMDC_P0_MPWLDECTRL0 0x021b080c | 489 | #define MX6_MMDC_P0_MPWLDECTRL0 0x021b080c |
490 | #define MX6_MMDC_P0_MPWLDECTRL1 0x021b0810 | 490 | #define MX6_MMDC_P0_MPWLDECTRL1 0x021b0810 |
491 | #define MX6_MMDC_P0_MPODTCTRL 0x021b0818 | 491 | #define MX6_MMDC_P0_MPODTCTRL 0x021b0818 |
492 | #define MX6_MMDC_P0_MPRDDQBY0DL 0x021b081c | 492 | #define MX6_MMDC_P0_MPRDDQBY0DL 0x021b081c |
493 | #define MX6_MMDC_P0_MPRDDQBY1DL 0x021b0820 | 493 | #define MX6_MMDC_P0_MPRDDQBY1DL 0x021b0820 |
494 | #define MX6_MMDC_P0_MPRDDQBY2DL 0x021b0824 | 494 | #define MX6_MMDC_P0_MPRDDQBY2DL 0x021b0824 |
495 | #define MX6_MMDC_P0_MPRDDQBY3DL 0x021b0828 | 495 | #define MX6_MMDC_P0_MPRDDQBY3DL 0x021b0828 |
496 | #define MX6_MMDC_P0_MPDGCTRL0 0x021b083c | 496 | #define MX6_MMDC_P0_MPDGCTRL0 0x021b083c |
497 | #define MX6_MMDC_P0_MPDGCTRL1 0x021b0840 | 497 | #define MX6_MMDC_P0_MPDGCTRL1 0x021b0840 |
498 | #define MX6_MMDC_P0_MPRDDLCTL 0x021b0848 | 498 | #define MX6_MMDC_P0_MPRDDLCTL 0x021b0848 |
499 | #define MX6_MMDC_P0_MPWRDLCTL 0x021b0850 | 499 | #define MX6_MMDC_P0_MPWRDLCTL 0x021b0850 |
500 | #define MX6_MMDC_P0_MPZQLP2CTL 0x021b085C | 500 | #define MX6_MMDC_P0_MPZQLP2CTL 0x021b085C |
501 | #define MX6_MMDC_P0_MPMUR0 0x021b08b8 | 501 | #define MX6_MMDC_P0_MPMUR0 0x021b08b8 |
502 | 502 | ||
503 | #define MX6_MMDC_P1_MDCTL 0x021b4000 | 503 | #define MX6_MMDC_P1_MDCTL 0x021b4000 |
504 | #define MX6_MMDC_P1_MDPDC 0x021b4004 | 504 | #define MX6_MMDC_P1_MDPDC 0x021b4004 |
505 | #define MX6_MMDC_P1_MDOTC 0x021b4008 | 505 | #define MX6_MMDC_P1_MDOTC 0x021b4008 |
506 | #define MX6_MMDC_P1_MDCFG0 0x021b400c | 506 | #define MX6_MMDC_P1_MDCFG0 0x021b400c |
507 | #define MX6_MMDC_P1_MDCFG1 0x021b4010 | 507 | #define MX6_MMDC_P1_MDCFG1 0x021b4010 |
508 | #define MX6_MMDC_P1_MDCFG2 0x021b4014 | 508 | #define MX6_MMDC_P1_MDCFG2 0x021b4014 |
509 | #define MX6_MMDC_P1_MDMISC 0x021b4018 | 509 | #define MX6_MMDC_P1_MDMISC 0x021b4018 |
510 | #define MX6_MMDC_P1_MDSCR 0x021b401c | 510 | #define MX6_MMDC_P1_MDSCR 0x021b401c |
511 | #define MX6_MMDC_P1_MDREF 0x021b4020 | 511 | #define MX6_MMDC_P1_MDREF 0x021b4020 |
512 | #define MX6_MMDC_P1_MDRWD 0x021b402c | 512 | #define MX6_MMDC_P1_MDRWD 0x021b402c |
513 | #define MX6_MMDC_P1_MDOR 0x021b4030 | 513 | #define MX6_MMDC_P1_MDOR 0x021b4030 |
514 | #define MX6_MMDC_P1_MDASP 0x021b4040 | 514 | #define MX6_MMDC_P1_MDASP 0x021b4040 |
515 | #define MX6_MMDC_P1_MAPSR 0x021b4404 | 515 | #define MX6_MMDC_P1_MAPSR 0x021b4404 |
516 | #define MX6_MMDC_P1_MPZQHWCTRL 0x021b4800 | 516 | #define MX6_MMDC_P1_MPZQHWCTRL 0x021b4800 |
517 | #define MX6_MMDC_P1_MPWLDECTRL0 0x021b480c | 517 | #define MX6_MMDC_P1_MPWLDECTRL0 0x021b480c |
518 | #define MX6_MMDC_P1_MPWLDECTRL1 0x021b4810 | 518 | #define MX6_MMDC_P1_MPWLDECTRL1 0x021b4810 |
519 | #define MX6_MMDC_P1_MPODTCTRL 0x021b4818 | 519 | #define MX6_MMDC_P1_MPODTCTRL 0x021b4818 |
520 | #define MX6_MMDC_P1_MPRDDQBY0DL 0x021b481c | 520 | #define MX6_MMDC_P1_MPRDDQBY0DL 0x021b481c |
521 | #define MX6_MMDC_P1_MPRDDQBY1DL 0x021b4820 | 521 | #define MX6_MMDC_P1_MPRDDQBY1DL 0x021b4820 |
522 | #define MX6_MMDC_P1_MPRDDQBY2DL 0x021b4824 | 522 | #define MX6_MMDC_P1_MPRDDQBY2DL 0x021b4824 |
523 | #define MX6_MMDC_P1_MPRDDQBY3DL 0x021b4828 | 523 | #define MX6_MMDC_P1_MPRDDQBY3DL 0x021b4828 |
524 | #define MX6_MMDC_P1_MPDGCTRL0 0x021b483c | 524 | #define MX6_MMDC_P1_MPDGCTRL0 0x021b483c |
525 | #define MX6_MMDC_P1_MPDGCTRL1 0x021b4840 | 525 | #define MX6_MMDC_P1_MPDGCTRL1 0x021b4840 |
526 | #define MX6_MMDC_P1_MPRDDLCTL 0x021b4848 | 526 | #define MX6_MMDC_P1_MPRDDLCTL 0x021b4848 |
527 | #define MX6_MMDC_P1_MPWRDLCTL 0x021b4850 | 527 | #define MX6_MMDC_P1_MPWRDLCTL 0x021b4850 |
528 | #define MX6_MMDC_P1_MPZQLP2CTL 0x021b485C | 528 | #define MX6_MMDC_P1_MPZQLP2CTL 0x021b485C |
529 | #define MX6_MMDC_P1_MPMUR0 0x021b48b8 | 529 | #define MX6_MMDC_P1_MPMUR0 0x021b48b8 |
530 | 530 | ||
531 | #endif /*__ASM_ARCH_MX6_DDR_H__ */ | 531 | #endif /*__ASM_ARCH_MX6_DDR_H__ */ |
532 | 532 |
arch/arm/include/asm/arch-mx6/mx6ul-ddr.h
1 | /* | 1 | /* |
2 | * Copyright (C) 2015 Freescale Semiconductor, Inc. | 2 | * Copyright (C) 2015 Freescale Semiconductor, Inc. |
3 | * | 3 | * |
4 | * SPDX-License-Identifier: GPL-2.0+ | 4 | * SPDX-License-Identifier: GPL-2.0+ |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #ifndef __ASM_ARCH_MX6UL_DDR_H__ | 7 | #ifndef __ASM_ARCH_MX6UL_DDR_H__ |
8 | #define __ASM_ARCH_MX6UL_DDR_H__ | 8 | #define __ASM_ARCH_MX6UL_DDR_H__ |
9 | 9 | ||
10 | #ifndef CONFIG_MX6UL | 10 | #if !(defined(CONFIG_MX6UL) || defined(CONFIG_MX6ULL)) |
11 | #error "wrong CPU" | 11 | #error "wrong CPU" |
12 | #endif | 12 | #endif |
13 | 13 | ||
14 | #define MX6_IOM_DRAM_DQM0 0x020e0244 | 14 | #define MX6_IOM_DRAM_DQM0 0x020e0244 |
15 | #define MX6_IOM_DRAM_DQM1 0x020e0248 | 15 | #define MX6_IOM_DRAM_DQM1 0x020e0248 |
16 | 16 | ||
17 | #define MX6_IOM_DRAM_RAS 0x020e024c | 17 | #define MX6_IOM_DRAM_RAS 0x020e024c |
18 | #define MX6_IOM_DRAM_CAS 0x020e0250 | 18 | #define MX6_IOM_DRAM_CAS 0x020e0250 |
19 | #define MX6_IOM_DRAM_CS0 0x020e0254 | 19 | #define MX6_IOM_DRAM_CS0 0x020e0254 |
20 | #define MX6_IOM_DRAM_CS1 0x020e0258 | 20 | #define MX6_IOM_DRAM_CS1 0x020e0258 |
21 | #define MX6_IOM_DRAM_SDWE_B 0x020e025c | 21 | #define MX6_IOM_DRAM_SDWE_B 0x020e025c |
22 | #define MX6_IOM_DRAM_SDODT0 0x020e0260 | 22 | #define MX6_IOM_DRAM_SDODT0 0x020e0260 |
23 | #define MX6_IOM_DRAM_SDODT1 0x020e0264 | 23 | #define MX6_IOM_DRAM_SDODT1 0x020e0264 |
24 | #define MX6_IOM_DRAM_SDBA0 0x020e0268 | 24 | #define MX6_IOM_DRAM_SDBA0 0x020e0268 |
25 | #define MX6_IOM_DRAM_SDBA1 0x020e026c | 25 | #define MX6_IOM_DRAM_SDBA1 0x020e026c |
26 | #define MX6_IOM_DRAM_SDBA2 0x020e0270 | 26 | #define MX6_IOM_DRAM_SDBA2 0x020e0270 |
27 | #define MX6_IOM_DRAM_SDCKE0 0x020e0274 | 27 | #define MX6_IOM_DRAM_SDCKE0 0x020e0274 |
28 | #define MX6_IOM_DRAM_SDCKE1 0x020e0278 | 28 | #define MX6_IOM_DRAM_SDCKE1 0x020e0278 |
29 | #define MX6_IOM_DRAM_SDCLK_0 0x020e027c | 29 | #define MX6_IOM_DRAM_SDCLK_0 0x020e027c |
30 | #define MX6_IOM_DRAM_SDQS0 0x020e0280 | 30 | #define MX6_IOM_DRAM_SDQS0 0x020e0280 |
31 | #define MX6_IOM_DRAM_SDQS1 0x020e0284 | 31 | #define MX6_IOM_DRAM_SDQS1 0x020e0284 |
32 | #define MX6_IOM_DRAM_RESET 0x020e0288 | 32 | #define MX6_IOM_DRAM_RESET 0x020e0288 |
33 | 33 | ||
34 | #define MX6_IOM_GRP_ADDDS 0x020e0490 | 34 | #define MX6_IOM_GRP_ADDDS 0x020e0490 |
35 | #define MX6_IOM_DDRMODE_CTL 0x020e0494 | 35 | #define MX6_IOM_DDRMODE_CTL 0x020e0494 |
36 | #define MX6_IOM_GRP_B0DS 0x020e0498 | 36 | #define MX6_IOM_GRP_B0DS 0x020e0498 |
37 | #define MX6_IOM_GRP_DDRPK 0x020e049c | 37 | #define MX6_IOM_GRP_DDRPK 0x020e049c |
38 | #define MX6_IOM_GRP_CTLDS 0x020e04a0 | 38 | #define MX6_IOM_GRP_CTLDS 0x020e04a0 |
39 | #define MX6_IOM_GRP_B1DS 0x020e04a4 | 39 | #define MX6_IOM_GRP_B1DS 0x020e04a4 |
40 | #define MX6_IOM_GRP_DDRHYS 0x020e04a8 | 40 | #define MX6_IOM_GRP_DDRHYS 0x020e04a8 |
41 | #define MX6_IOM_GRP_DDRPKE 0x020e04ac | 41 | #define MX6_IOM_GRP_DDRPKE 0x020e04ac |
42 | #define MX6_IOM_GRP_DDRMODE 0x020e04b0 | 42 | #define MX6_IOM_GRP_DDRMODE 0x020e04b0 |
43 | #define MX6_IOM_GRP_DDR_TYPE 0x020e04b4 | 43 | #define MX6_IOM_GRP_DDR_TYPE 0x020e04b4 |
44 | 44 | ||
45 | #endif /*__ASM_ARCH_MX6SX_DDR_H__ */ | 45 | #endif /*__ASM_ARCH_MX6SX_DDR_H__ */ |
46 | 46 |
arch/arm/include/asm/mach-imx/iomux-v3.h
1 | /* | 1 | /* |
2 | * Based on Linux i.MX iomux-v3.h file: | 2 | * Based on Linux i.MX iomux-v3.h file: |
3 | * Copyright (C) 2009 by Jan Weitzel Phytec Messtechnik GmbH, | 3 | * Copyright (C) 2009 by Jan Weitzel Phytec Messtechnik GmbH, |
4 | * <armlinux@phytec.de> | 4 | * <armlinux@phytec.de> |
5 | * | 5 | * |
6 | * Copyright (C) 2011 Freescale Semiconductor, Inc. | 6 | * Copyright (C) 2011 Freescale Semiconductor, Inc. |
7 | * | 7 | * |
8 | * SPDX-License-Identifier: GPL-2.0+ | 8 | * SPDX-License-Identifier: GPL-2.0+ |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #ifndef __MACH_IOMUX_V3_H__ | 11 | #ifndef __MACH_IOMUX_V3_H__ |
12 | #define __MACH_IOMUX_V3_H__ | 12 | #define __MACH_IOMUX_V3_H__ |
13 | 13 | ||
14 | #include <common.h> | 14 | #include <common.h> |
15 | 15 | ||
16 | /* | 16 | /* |
17 | * build IOMUX_PAD structure | 17 | * build IOMUX_PAD structure |
18 | * | 18 | * |
19 | * This iomux scheme is based around pads, which are the physical balls | 19 | * This iomux scheme is based around pads, which are the physical balls |
20 | * on the processor. | 20 | * on the processor. |
21 | * | 21 | * |
22 | * - Each pad has a pad control register (IOMUXC_SW_PAD_CTRL_x) which controls | 22 | * - Each pad has a pad control register (IOMUXC_SW_PAD_CTRL_x) which controls |
23 | * things like driving strength and pullup/pulldown. | 23 | * things like driving strength and pullup/pulldown. |
24 | * - Each pad can have but not necessarily does have an output routing register | 24 | * - Each pad can have but not necessarily does have an output routing register |
25 | * (IOMUXC_SW_MUX_CTL_PAD_x). | 25 | * (IOMUXC_SW_MUX_CTL_PAD_x). |
26 | * - Each pad can have but not necessarily does have an input routing register | 26 | * - Each pad can have but not necessarily does have an input routing register |
27 | * (IOMUXC_x_SELECT_INPUT) | 27 | * (IOMUXC_x_SELECT_INPUT) |
28 | * | 28 | * |
29 | * The three register sets do not have a fixed offset to each other, | 29 | * The three register sets do not have a fixed offset to each other, |
30 | * hence we order this table by pad control registers (which all pads | 30 | * hence we order this table by pad control registers (which all pads |
31 | * have) and put the optional i/o routing registers into additional | 31 | * have) and put the optional i/o routing registers into additional |
32 | * fields. | 32 | * fields. |
33 | * | 33 | * |
34 | * The naming convention for the pad modes is SOC_PAD_<padname>__<padmode> | 34 | * The naming convention for the pad modes is SOC_PAD_<padname>__<padmode> |
35 | * If <padname> or <padmode> refers to a GPIO, it is named GPIO_<unit>_<num> | 35 | * If <padname> or <padmode> refers to a GPIO, it is named GPIO_<unit>_<num> |
36 | * | 36 | * |
37 | * IOMUX/PAD Bit field definitions | 37 | * IOMUX/PAD Bit field definitions |
38 | * | 38 | * |
39 | * MUX_CTRL_OFS: 0..11 (12) | 39 | * MUX_CTRL_OFS: 0..11 (12) |
40 | * PAD_CTRL_OFS: 12..23 (12) | 40 | * PAD_CTRL_OFS: 12..23 (12) |
41 | * SEL_INPUT_OFS: 24..35 (12) | 41 | * SEL_INPUT_OFS: 24..35 (12) |
42 | * MUX_MODE + SION + LPSR: 36..41 (6) | 42 | * MUX_MODE + SION + LPSR: 36..41 (6) |
43 | * PAD_CTRL + NO_PAD_CTRL: 42..59 (18) | 43 | * PAD_CTRL + NO_PAD_CTRL: 42..59 (18) |
44 | * SEL_INP: 60..63 (4) | 44 | * SEL_INP: 60..63 (4) |
45 | */ | 45 | */ |
46 | 46 | ||
47 | typedef u64 iomux_v3_cfg_t; | 47 | typedef u64 iomux_v3_cfg_t; |
48 | 48 | ||
49 | #define MUX_CTRL_OFS_SHIFT 0 | 49 | #define MUX_CTRL_OFS_SHIFT 0 |
50 | #define MUX_CTRL_OFS_MASK ((iomux_v3_cfg_t)0xfff << MUX_CTRL_OFS_SHIFT) | 50 | #define MUX_CTRL_OFS_MASK ((iomux_v3_cfg_t)0xfff << MUX_CTRL_OFS_SHIFT) |
51 | #define MUX_PAD_CTRL_OFS_SHIFT 12 | 51 | #define MUX_PAD_CTRL_OFS_SHIFT 12 |
52 | #define MUX_PAD_CTRL_OFS_MASK ((iomux_v3_cfg_t)0xfff << \ | 52 | #define MUX_PAD_CTRL_OFS_MASK ((iomux_v3_cfg_t)0xfff << \ |
53 | MUX_PAD_CTRL_OFS_SHIFT) | 53 | MUX_PAD_CTRL_OFS_SHIFT) |
54 | #define MUX_SEL_INPUT_OFS_SHIFT 24 | 54 | #define MUX_SEL_INPUT_OFS_SHIFT 24 |
55 | #define MUX_SEL_INPUT_OFS_MASK ((iomux_v3_cfg_t)0xfff << \ | 55 | #define MUX_SEL_INPUT_OFS_MASK ((iomux_v3_cfg_t)0xfff << \ |
56 | MUX_SEL_INPUT_OFS_SHIFT) | 56 | MUX_SEL_INPUT_OFS_SHIFT) |
57 | 57 | ||
58 | #define MUX_MODE_SHIFT 36 | 58 | #define MUX_MODE_SHIFT 36 |
59 | #define MUX_MODE_MASK ((iomux_v3_cfg_t)0x3f << MUX_MODE_SHIFT) | 59 | #define MUX_MODE_MASK ((iomux_v3_cfg_t)0x3f << MUX_MODE_SHIFT) |
60 | #define MUX_PAD_CTRL_SHIFT 42 | 60 | #define MUX_PAD_CTRL_SHIFT 42 |
61 | #define MUX_PAD_CTRL_MASK ((iomux_v3_cfg_t)0x3ffff << MUX_PAD_CTRL_SHIFT) | 61 | #define MUX_PAD_CTRL_MASK ((iomux_v3_cfg_t)0x3ffff << MUX_PAD_CTRL_SHIFT) |
62 | #define MUX_SEL_INPUT_SHIFT 60 | 62 | #define MUX_SEL_INPUT_SHIFT 60 |
63 | #define MUX_SEL_INPUT_MASK ((iomux_v3_cfg_t)0xf << MUX_SEL_INPUT_SHIFT) | 63 | #define MUX_SEL_INPUT_MASK ((iomux_v3_cfg_t)0xf << MUX_SEL_INPUT_SHIFT) |
64 | 64 | ||
65 | #define MUX_MODE_SION ((iomux_v3_cfg_t)IOMUX_CONFIG_SION << \ | 65 | #define MUX_MODE_SION ((iomux_v3_cfg_t)IOMUX_CONFIG_SION << \ |
66 | MUX_MODE_SHIFT) | 66 | MUX_MODE_SHIFT) |
67 | #define MUX_PAD_CTRL(x) ((iomux_v3_cfg_t)(x) << MUX_PAD_CTRL_SHIFT) | 67 | #define MUX_PAD_CTRL(x) ((iomux_v3_cfg_t)(x) << MUX_PAD_CTRL_SHIFT) |
68 | 68 | ||
69 | #define IOMUX_PAD(pad_ctrl_ofs, mux_ctrl_ofs, mux_mode, sel_input_ofs, \ | 69 | #define IOMUX_PAD(pad_ctrl_ofs, mux_ctrl_ofs, mux_mode, sel_input_ofs, \ |
70 | sel_input, pad_ctrl) \ | 70 | sel_input, pad_ctrl) \ |
71 | (((iomux_v3_cfg_t)(mux_ctrl_ofs) << MUX_CTRL_OFS_SHIFT) | \ | 71 | (((iomux_v3_cfg_t)(mux_ctrl_ofs) << MUX_CTRL_OFS_SHIFT) | \ |
72 | ((iomux_v3_cfg_t)(mux_mode) << MUX_MODE_SHIFT) | \ | 72 | ((iomux_v3_cfg_t)(mux_mode) << MUX_MODE_SHIFT) | \ |
73 | ((iomux_v3_cfg_t)(pad_ctrl_ofs) << MUX_PAD_CTRL_OFS_SHIFT) | \ | 73 | ((iomux_v3_cfg_t)(pad_ctrl_ofs) << MUX_PAD_CTRL_OFS_SHIFT) | \ |
74 | ((iomux_v3_cfg_t)(pad_ctrl) << MUX_PAD_CTRL_SHIFT) | \ | 74 | ((iomux_v3_cfg_t)(pad_ctrl) << MUX_PAD_CTRL_SHIFT) | \ |
75 | ((iomux_v3_cfg_t)(sel_input_ofs) << MUX_SEL_INPUT_OFS_SHIFT)| \ | 75 | ((iomux_v3_cfg_t)(sel_input_ofs) << MUX_SEL_INPUT_OFS_SHIFT)| \ |
76 | ((iomux_v3_cfg_t)(sel_input) << MUX_SEL_INPUT_SHIFT)) | 76 | ((iomux_v3_cfg_t)(sel_input) << MUX_SEL_INPUT_SHIFT)) |
77 | 77 | ||
78 | #define NEW_PAD_CTRL(cfg, pad) (((cfg) & ~MUX_PAD_CTRL_MASK) | \ | 78 | #define NEW_PAD_CTRL(cfg, pad) (((cfg) & ~MUX_PAD_CTRL_MASK) | \ |
79 | MUX_PAD_CTRL(pad)) | 79 | MUX_PAD_CTRL(pad)) |
80 | 80 | ||
81 | #define __NA_ 0x000 | 81 | #define __NA_ 0x000 |
82 | #define NO_MUX_I 0 | 82 | #define NO_MUX_I 0 |
83 | #define NO_PAD_I 0 | 83 | #define NO_PAD_I 0 |
84 | 84 | ||
85 | #define NO_PAD_CTRL (1 << 17) | 85 | #define NO_PAD_CTRL (1 << 17) |
86 | 86 | ||
87 | #define IOMUX_CONFIG_LPSR 0x20 | 87 | #define IOMUX_CONFIG_LPSR 0x20 |
88 | #define MUX_MODE_LPSR ((iomux_v3_cfg_t)IOMUX_CONFIG_LPSR << \ | 88 | #define MUX_MODE_LPSR ((iomux_v3_cfg_t)IOMUX_CONFIG_LPSR << \ |
89 | MUX_MODE_SHIFT) | 89 | MUX_MODE_SHIFT) |
90 | #ifdef CONFIG_MX7 | 90 | #ifdef CONFIG_MX7 |
91 | 91 | ||
92 | #define IOMUX_LPSR_SEL_INPUT_OFS 0x70000 | 92 | #define IOMUX_LPSR_SEL_INPUT_OFS 0x70000 |
93 | 93 | ||
94 | #define PAD_CTL_DSE_1P8V_140OHM (0x0<<0) | 94 | #define PAD_CTL_DSE_1P8V_140OHM (0x0<<0) |
95 | #define PAD_CTL_DSE_1P8V_35OHM (0x1<<0) | 95 | #define PAD_CTL_DSE_1P8V_35OHM (0x1<<0) |
96 | #define PAD_CTL_DSE_1P8V_70OHM (0x2<<0) | 96 | #define PAD_CTL_DSE_1P8V_70OHM (0x2<<0) |
97 | #define PAD_CTL_DSE_1P8V_23OHM (0x3<<0) | 97 | #define PAD_CTL_DSE_1P8V_23OHM (0x3<<0) |
98 | 98 | ||
99 | #define PAD_CTL_DSE_3P3V_196OHM (0x0<<0) | 99 | #define PAD_CTL_DSE_3P3V_196OHM (0x0<<0) |
100 | #define PAD_CTL_DSE_3P3V_49OHM (0x1<<0) | 100 | #define PAD_CTL_DSE_3P3V_49OHM (0x1<<0) |
101 | #define PAD_CTL_DSE_3P3V_98OHM (0x2<<0) | 101 | #define PAD_CTL_DSE_3P3V_98OHM (0x2<<0) |
102 | #define PAD_CTL_DSE_3P3V_32OHM (0x3<<0) | 102 | #define PAD_CTL_DSE_3P3V_32OHM (0x3<<0) |
103 | 103 | ||
104 | #define PAD_CTL_SRE_FAST (0 << 2) | 104 | #define PAD_CTL_SRE_FAST (0 << 2) |
105 | #define PAD_CTL_SRE_SLOW (0x1 << 2) | 105 | #define PAD_CTL_SRE_SLOW (0x1 << 2) |
106 | 106 | ||
107 | #define PAD_CTL_HYS (0x1 << 3) | 107 | #define PAD_CTL_HYS (0x1 << 3) |
108 | #define PAD_CTL_PUE (0x1 << 4) | 108 | #define PAD_CTL_PUE (0x1 << 4) |
109 | 109 | ||
110 | #define PAD_CTL_PUS_PD100KOHM ((0x0 << 5) | PAD_CTL_PUE) | 110 | #define PAD_CTL_PUS_PD100KOHM ((0x0 << 5) | PAD_CTL_PUE) |
111 | #define PAD_CTL_PUS_PU5KOHM ((0x1 << 5) | PAD_CTL_PUE) | 111 | #define PAD_CTL_PUS_PU5KOHM ((0x1 << 5) | PAD_CTL_PUE) |
112 | #define PAD_CTL_PUS_PU47KOHM ((0x2 << 5) | PAD_CTL_PUE) | 112 | #define PAD_CTL_PUS_PU47KOHM ((0x2 << 5) | PAD_CTL_PUE) |
113 | #define PAD_CTL_PUS_PU100KOHM ((0x3 << 5) | PAD_CTL_PUE) | 113 | #define PAD_CTL_PUS_PU100KOHM ((0x3 << 5) | PAD_CTL_PUE) |
114 | 114 | ||
115 | #else | 115 | #else |
116 | 116 | ||
117 | #ifdef CONFIG_MX6 | 117 | #ifdef CONFIG_MX6 |
118 | 118 | ||
119 | #define PAD_CTL_HYS (1 << 16) | 119 | #define PAD_CTL_HYS (1 << 16) |
120 | 120 | ||
121 | #define PAD_CTL_PUS_100K_DOWN (0 << 14 | PAD_CTL_PUE) | 121 | #define PAD_CTL_PUS_100K_DOWN (0 << 14 | PAD_CTL_PUE) |
122 | #define PAD_CTL_PUS_47K_UP (1 << 14 | PAD_CTL_PUE) | 122 | #define PAD_CTL_PUS_47K_UP (1 << 14 | PAD_CTL_PUE) |
123 | #define PAD_CTL_PUS_100K_UP (2 << 14 | PAD_CTL_PUE) | 123 | #define PAD_CTL_PUS_100K_UP (2 << 14 | PAD_CTL_PUE) |
124 | #define PAD_CTL_PUS_22K_UP (3 << 14 | PAD_CTL_PUE) | 124 | #define PAD_CTL_PUS_22K_UP (3 << 14 | PAD_CTL_PUE) |
125 | #define PAD_CTL_PUE (1 << 13 | PAD_CTL_PKE) | 125 | #define PAD_CTL_PUE (1 << 13 | PAD_CTL_PKE) |
126 | #define PAD_CTL_PKE (1 << 12) | 126 | #define PAD_CTL_PKE (1 << 12) |
127 | 127 | ||
128 | #define PAD_CTL_ODE (1 << 11) | 128 | #define PAD_CTL_ODE (1 << 11) |
129 | 129 | ||
130 | #if defined(CONFIG_MX6SX) || defined(CONFIG_MX6UL) | 130 | #if defined(CONFIG_MX6SX) || defined(CONFIG_MX6UL) || defined(CONFIG_MX6ULL) |
131 | #define PAD_CTL_SPEED_LOW (0 << 6) | 131 | #define PAD_CTL_SPEED_LOW (0 << 6) |
132 | #else | 132 | #else |
133 | #define PAD_CTL_SPEED_LOW (1 << 6) | 133 | #define PAD_CTL_SPEED_LOW (1 << 6) |
134 | #endif | 134 | #endif |
135 | #define PAD_CTL_SPEED_MED (2 << 6) | 135 | #define PAD_CTL_SPEED_MED (2 << 6) |
136 | #define PAD_CTL_SPEED_HIGH (3 << 6) | 136 | #define PAD_CTL_SPEED_HIGH (3 << 6) |
137 | 137 | ||
138 | #define PAD_CTL_DSE_DISABLE (0 << 3) | 138 | #define PAD_CTL_DSE_DISABLE (0 << 3) |
139 | #define PAD_CTL_DSE_240ohm (1 << 3) | 139 | #define PAD_CTL_DSE_240ohm (1 << 3) |
140 | #define PAD_CTL_DSE_120ohm (2 << 3) | 140 | #define PAD_CTL_DSE_120ohm (2 << 3) |
141 | #define PAD_CTL_DSE_80ohm (3 << 3) | 141 | #define PAD_CTL_DSE_80ohm (3 << 3) |
142 | #define PAD_CTL_DSE_60ohm (4 << 3) | 142 | #define PAD_CTL_DSE_60ohm (4 << 3) |
143 | #define PAD_CTL_DSE_48ohm (5 << 3) | 143 | #define PAD_CTL_DSE_48ohm (5 << 3) |
144 | #define PAD_CTL_DSE_40ohm (6 << 3) | 144 | #define PAD_CTL_DSE_40ohm (6 << 3) |
145 | #define PAD_CTL_DSE_34ohm (7 << 3) | 145 | #define PAD_CTL_DSE_34ohm (7 << 3) |
146 | 146 | ||
147 | /* i.MX6SL/SLL */ | 147 | /* i.MX6SL/SLL */ |
148 | #define PAD_CTL_LVE (1 << 1) | 148 | #define PAD_CTL_LVE (1 << 1) |
149 | #define PAD_CTL_LVE_BIT (1 << 22) | 149 | #define PAD_CTL_LVE_BIT (1 << 22) |
150 | 150 | ||
151 | /* i.MX6SLL */ | 151 | /* i.MX6SLL */ |
152 | #define PAD_CTL_IPD_BIT (1 << 27) | 152 | #define PAD_CTL_IPD_BIT (1 << 27) |
153 | 153 | ||
154 | #elif defined(CONFIG_VF610) | 154 | #elif defined(CONFIG_VF610) |
155 | 155 | ||
156 | #define PAD_MUX_MODE_SHIFT 20 | 156 | #define PAD_MUX_MODE_SHIFT 20 |
157 | 157 | ||
158 | #define PAD_CTL_INPUT_DIFFERENTIAL (1 << 16) | 158 | #define PAD_CTL_INPUT_DIFFERENTIAL (1 << 16) |
159 | 159 | ||
160 | #define PAD_CTL_SPEED_MED (1 << 12) | 160 | #define PAD_CTL_SPEED_MED (1 << 12) |
161 | #define PAD_CTL_SPEED_HIGH (3 << 12) | 161 | #define PAD_CTL_SPEED_HIGH (3 << 12) |
162 | 162 | ||
163 | #define PAD_CTL_SRE (1 << 11) | 163 | #define PAD_CTL_SRE (1 << 11) |
164 | 164 | ||
165 | #define PAD_CTL_ODE (1 << 10) | 165 | #define PAD_CTL_ODE (1 << 10) |
166 | 166 | ||
167 | #define PAD_CTL_DSE_150ohm (1 << 6) | 167 | #define PAD_CTL_DSE_150ohm (1 << 6) |
168 | #define PAD_CTL_DSE_75ohm (2 << 6) | 168 | #define PAD_CTL_DSE_75ohm (2 << 6) |
169 | #define PAD_CTL_DSE_50ohm (3 << 6) | 169 | #define PAD_CTL_DSE_50ohm (3 << 6) |
170 | #define PAD_CTL_DSE_37ohm (4 << 6) | 170 | #define PAD_CTL_DSE_37ohm (4 << 6) |
171 | #define PAD_CTL_DSE_30ohm (5 << 6) | 171 | #define PAD_CTL_DSE_30ohm (5 << 6) |
172 | #define PAD_CTL_DSE_25ohm (6 << 6) | 172 | #define PAD_CTL_DSE_25ohm (6 << 6) |
173 | #define PAD_CTL_DSE_20ohm (7 << 6) | 173 | #define PAD_CTL_DSE_20ohm (7 << 6) |
174 | 174 | ||
175 | #define PAD_CTL_PUS_47K_UP (1 << 4 | PAD_CTL_PUE) | 175 | #define PAD_CTL_PUS_47K_UP (1 << 4 | PAD_CTL_PUE) |
176 | #define PAD_CTL_PUS_100K_UP (2 << 4 | PAD_CTL_PUE) | 176 | #define PAD_CTL_PUS_100K_UP (2 << 4 | PAD_CTL_PUE) |
177 | #define PAD_CTL_PUS_22K_UP (3 << 4 | PAD_CTL_PUE) | 177 | #define PAD_CTL_PUS_22K_UP (3 << 4 | PAD_CTL_PUE) |
178 | #define PAD_CTL_PKE (1 << 3) | 178 | #define PAD_CTL_PKE (1 << 3) |
179 | #define PAD_CTL_PUE (1 << 2 | PAD_CTL_PKE) | 179 | #define PAD_CTL_PUE (1 << 2 | PAD_CTL_PKE) |
180 | 180 | ||
181 | #define PAD_CTL_OBE_IBE_ENABLE (3 << 0) | 181 | #define PAD_CTL_OBE_IBE_ENABLE (3 << 0) |
182 | #define PAD_CTL_OBE_ENABLE (1 << 1) | 182 | #define PAD_CTL_OBE_ENABLE (1 << 1) |
183 | #define PAD_CTL_IBE_ENABLE (1 << 0) | 183 | #define PAD_CTL_IBE_ENABLE (1 << 0) |
184 | 184 | ||
185 | #else | 185 | #else |
186 | 186 | ||
187 | #define PAD_CTL_DVS (1 << 13) | 187 | #define PAD_CTL_DVS (1 << 13) |
188 | #define PAD_CTL_INPUT_DDR (1 << 9) | 188 | #define PAD_CTL_INPUT_DDR (1 << 9) |
189 | #define PAD_CTL_HYS (1 << 8) | 189 | #define PAD_CTL_HYS (1 << 8) |
190 | 190 | ||
191 | #define PAD_CTL_PKE (1 << 7) | 191 | #define PAD_CTL_PKE (1 << 7) |
192 | #define PAD_CTL_PUE (1 << 6 | PAD_CTL_PKE) | 192 | #define PAD_CTL_PUE (1 << 6 | PAD_CTL_PKE) |
193 | #define PAD_CTL_PUS_100K_DOWN (0 << 4 | PAD_CTL_PUE) | 193 | #define PAD_CTL_PUS_100K_DOWN (0 << 4 | PAD_CTL_PUE) |
194 | #define PAD_CTL_PUS_47K_UP (1 << 4 | PAD_CTL_PUE) | 194 | #define PAD_CTL_PUS_47K_UP (1 << 4 | PAD_CTL_PUE) |
195 | #define PAD_CTL_PUS_100K_UP (2 << 4 | PAD_CTL_PUE) | 195 | #define PAD_CTL_PUS_100K_UP (2 << 4 | PAD_CTL_PUE) |
196 | #define PAD_CTL_PUS_22K_UP (3 << 4 | PAD_CTL_PUE) | 196 | #define PAD_CTL_PUS_22K_UP (3 << 4 | PAD_CTL_PUE) |
197 | 197 | ||
198 | #define PAD_CTL_ODE (1 << 3) | 198 | #define PAD_CTL_ODE (1 << 3) |
199 | 199 | ||
200 | #define PAD_CTL_DSE_LOW (0 << 1) | 200 | #define PAD_CTL_DSE_LOW (0 << 1) |
201 | #define PAD_CTL_DSE_MED (1 << 1) | 201 | #define PAD_CTL_DSE_MED (1 << 1) |
202 | #define PAD_CTL_DSE_HIGH (2 << 1) | 202 | #define PAD_CTL_DSE_HIGH (2 << 1) |
203 | #define PAD_CTL_DSE_MAX (3 << 1) | 203 | #define PAD_CTL_DSE_MAX (3 << 1) |
204 | 204 | ||
205 | #endif | 205 | #endif |
206 | 206 | ||
207 | #define PAD_CTL_SRE_SLOW (0 << 0) | 207 | #define PAD_CTL_SRE_SLOW (0 << 0) |
208 | #define PAD_CTL_SRE_FAST (1 << 0) | 208 | #define PAD_CTL_SRE_FAST (1 << 0) |
209 | 209 | ||
210 | #endif | 210 | #endif |
211 | 211 | ||
212 | #define IOMUX_CONFIG_SION 0x10 | 212 | #define IOMUX_CONFIG_SION 0x10 |
213 | 213 | ||
214 | #define GPIO_PIN_MASK 0x1f | 214 | #define GPIO_PIN_MASK 0x1f |
215 | #define GPIO_PORT_SHIFT 5 | 215 | #define GPIO_PORT_SHIFT 5 |
216 | #define GPIO_PORT_MASK (0x7 << GPIO_PORT_SHIFT) | 216 | #define GPIO_PORT_MASK (0x7 << GPIO_PORT_SHIFT) |
217 | #define GPIO_PORTA (0 << GPIO_PORT_SHIFT) | 217 | #define GPIO_PORTA (0 << GPIO_PORT_SHIFT) |
218 | #define GPIO_PORTB (1 << GPIO_PORT_SHIFT) | 218 | #define GPIO_PORTB (1 << GPIO_PORT_SHIFT) |
219 | #define GPIO_PORTC (2 << GPIO_PORT_SHIFT) | 219 | #define GPIO_PORTC (2 << GPIO_PORT_SHIFT) |
220 | #define GPIO_PORTD (3 << GPIO_PORT_SHIFT) | 220 | #define GPIO_PORTD (3 << GPIO_PORT_SHIFT) |
221 | #define GPIO_PORTE (4 << GPIO_PORT_SHIFT) | 221 | #define GPIO_PORTE (4 << GPIO_PORT_SHIFT) |
222 | #define GPIO_PORTF (5 << GPIO_PORT_SHIFT) | 222 | #define GPIO_PORTF (5 << GPIO_PORT_SHIFT) |
223 | 223 | ||
224 | void imx_iomux_v3_setup_pad(iomux_v3_cfg_t pad); | 224 | void imx_iomux_v3_setup_pad(iomux_v3_cfg_t pad); |
225 | void imx_iomux_v3_setup_multiple_pads(iomux_v3_cfg_t const *pad_list, | 225 | void imx_iomux_v3_setup_multiple_pads(iomux_v3_cfg_t const *pad_list, |
226 | unsigned count); | 226 | unsigned count); |
227 | /* | 227 | /* |
228 | * Set bits for general purpose registers | 228 | * Set bits for general purpose registers |
229 | */ | 229 | */ |
230 | void imx_iomux_set_gpr_register(int group, int start_bit, | 230 | void imx_iomux_set_gpr_register(int group, int start_bit, |
231 | int num_bits, int value); | 231 | int num_bits, int value); |
232 | #ifdef CONFIG_IOMUX_SHARE_CONF_REG | 232 | #ifdef CONFIG_IOMUX_SHARE_CONF_REG |
233 | void imx_iomux_gpio_set_direction(unsigned int gpio, | 233 | void imx_iomux_gpio_set_direction(unsigned int gpio, |
234 | unsigned int direction); | 234 | unsigned int direction); |
235 | void imx_iomux_gpio_get_function(unsigned int gpio, | 235 | void imx_iomux_gpio_get_function(unsigned int gpio, |
236 | u32 *gpio_state); | 236 | u32 *gpio_state); |
237 | #endif | 237 | #endif |
238 | 238 | ||
239 | /* macros for declaring and using pinmux array */ | 239 | /* macros for declaring and using pinmux array */ |
240 | #if defined(CONFIG_MX6QDL) | 240 | #if defined(CONFIG_MX6QDL) |
241 | #define IOMUX_PADS(x) (MX6Q_##x), (MX6DL_##x) | 241 | #define IOMUX_PADS(x) (MX6Q_##x), (MX6DL_##x) |
242 | #define SETUP_IOMUX_PAD(def) \ | 242 | #define SETUP_IOMUX_PAD(def) \ |
243 | if (is_cpu_type(MXC_CPU_MX6Q) || is_cpu_type(MXC_CPU_MX6D)) { \ | 243 | if (is_cpu_type(MXC_CPU_MX6Q) || is_cpu_type(MXC_CPU_MX6D)) { \ |
244 | imx_iomux_v3_setup_pad(MX6Q_##def); \ | 244 | imx_iomux_v3_setup_pad(MX6Q_##def); \ |
245 | } else { \ | 245 | } else { \ |
246 | imx_iomux_v3_setup_pad(MX6DL_##def); \ | 246 | imx_iomux_v3_setup_pad(MX6DL_##def); \ |
247 | } | 247 | } |
248 | #define SETUP_IOMUX_PADS(x) \ | 248 | #define SETUP_IOMUX_PADS(x) \ |
249 | imx_iomux_v3_setup_multiple_pads(x, ARRAY_SIZE(x)/2) | 249 | imx_iomux_v3_setup_multiple_pads(x, ARRAY_SIZE(x)/2) |
250 | #elif defined(CONFIG_MX6Q) || defined(CONFIG_MX6D) | 250 | #elif defined(CONFIG_MX6Q) || defined(CONFIG_MX6D) |
251 | #define IOMUX_PADS(x) MX6Q_##x | 251 | #define IOMUX_PADS(x) MX6Q_##x |
252 | #define SETUP_IOMUX_PAD(def) \ | 252 | #define SETUP_IOMUX_PAD(def) \ |
253 | imx_iomux_v3_setup_pad(MX6Q_##def); | 253 | imx_iomux_v3_setup_pad(MX6Q_##def); |
254 | #define SETUP_IOMUX_PADS(x) \ | 254 | #define SETUP_IOMUX_PADS(x) \ |
255 | imx_iomux_v3_setup_multiple_pads(x, ARRAY_SIZE(x)) | 255 | imx_iomux_v3_setup_multiple_pads(x, ARRAY_SIZE(x)) |
256 | #elif defined(CONFIG_MX6UL) | 256 | #elif defined(CONFIG_MX6UL) || defined(CONFIG_MX6ULL) |
257 | #define IOMUX_PADS(x) MX6_##x | 257 | #define IOMUX_PADS(x) MX6_##x |
258 | #define SETUP_IOMUX_PAD(def) \ | 258 | #define SETUP_IOMUX_PAD(def) \ |
259 | imx_iomux_v3_setup_pad(MX6_##def); | 259 | imx_iomux_v3_setup_pad(MX6_##def); |
260 | #define SETUP_IOMUX_PADS(x) \ | 260 | #define SETUP_IOMUX_PADS(x) \ |
261 | imx_iomux_v3_setup_multiple_pads(x, ARRAY_SIZE(x)) | 261 | imx_iomux_v3_setup_multiple_pads(x, ARRAY_SIZE(x)) |
262 | #else | 262 | #else |
263 | #define IOMUX_PADS(x) MX6DL_##x | 263 | #define IOMUX_PADS(x) MX6DL_##x |
264 | #define SETUP_IOMUX_PAD(def) \ | 264 | #define SETUP_IOMUX_PAD(def) \ |
265 | imx_iomux_v3_setup_pad(MX6DL_##def); | 265 | imx_iomux_v3_setup_pad(MX6DL_##def); |
266 | #define SETUP_IOMUX_PADS(x) \ | 266 | #define SETUP_IOMUX_PADS(x) \ |
267 | imx_iomux_v3_setup_multiple_pads(x, ARRAY_SIZE(x)) | 267 | imx_iomux_v3_setup_multiple_pads(x, ARRAY_SIZE(x)) |
268 | #endif | 268 | #endif |
269 | 269 | ||
270 | #endif /* __MACH_IOMUX_V3_H__*/ | 270 | #endif /* __MACH_IOMUX_V3_H__*/ |
271 | 271 |
arch/arm/include/asm/mach-imx/regs-lcdif.h
1 | /* | 1 | /* |
2 | * Freescale i.MX28/6SX/6UL/7D LCDIF Register Definitions | 2 | * Freescale i.MX28/6SX/6UL/7D LCDIF Register Definitions |
3 | * | 3 | * |
4 | * Copyright (C) 2011 Marek Vasut <marek.vasut@gmail.com> | 4 | * Copyright (C) 2011 Marek Vasut <marek.vasut@gmail.com> |
5 | * on behalf of DENX Software Engineering GmbH | 5 | * on behalf of DENX Software Engineering GmbH |
6 | * | 6 | * |
7 | * Based on code from LTIB: | 7 | * Based on code from LTIB: |
8 | * Copyright 2008-2010 Freescale Semiconductor, Inc. All Rights Reserved. | 8 | * Copyright 2008-2010 Freescale Semiconductor, Inc. All Rights Reserved. |
9 | * | 9 | * |
10 | * SPDX-License-Identifier: GPL-2.0+ | 10 | * SPDX-License-Identifier: GPL-2.0+ |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #ifndef __IMX_REGS_LCDIF_H__ | 13 | #ifndef __IMX_REGS_LCDIF_H__ |
14 | #define __IMX_REGS_LCDIF_H__ | 14 | #define __IMX_REGS_LCDIF_H__ |
15 | 15 | ||
16 | #ifndef __ASSEMBLY__ | 16 | #ifndef __ASSEMBLY__ |
17 | #include <asm/mach-imx/regs-common.h> | 17 | #include <asm/mach-imx/regs-common.h> |
18 | 18 | ||
19 | struct mxs_lcdif_regs { | 19 | struct mxs_lcdif_regs { |
20 | mxs_reg_32(hw_lcdif_ctrl) /* 0x00 */ | 20 | mxs_reg_32(hw_lcdif_ctrl) /* 0x00 */ |
21 | mxs_reg_32(hw_lcdif_ctrl1) /* 0x10 */ | 21 | mxs_reg_32(hw_lcdif_ctrl1) /* 0x10 */ |
22 | #if defined(CONFIG_MX28) || defined(CONFIG_MX6SX) || defined(CONFIG_MX6UL) || \ | 22 | |
23 | defined(CONFIG_MX7) || defined(CONFIG_MX6SL) || defined(CONFIG_MX6SLL) | 23 | #if defined(CONFIG_MX28) || defined(CONFIG_MX6SX) || \ |
24 | defined(CONFIG_MX6SL) || defined(CONFIG_MX6SLL) || \ | ||
25 | defined(CONFIG_MX6UL) || defined(CONFIG_MX6ULL) || \ | ||
26 | defined(CONFIG_MX7) | ||
24 | mxs_reg_32(hw_lcdif_ctrl2) /* 0x20 */ | 27 | mxs_reg_32(hw_lcdif_ctrl2) /* 0x20 */ |
25 | #endif | 28 | #endif |
26 | mxs_reg_32(hw_lcdif_transfer_count) /* 0x20/0x30 */ | 29 | mxs_reg_32(hw_lcdif_transfer_count) /* 0x20/0x30 */ |
27 | mxs_reg_32(hw_lcdif_cur_buf) /* 0x30/0x40 */ | 30 | mxs_reg_32(hw_lcdif_cur_buf) /* 0x30/0x40 */ |
28 | mxs_reg_32(hw_lcdif_next_buf) /* 0x40/0x50 */ | 31 | mxs_reg_32(hw_lcdif_next_buf) /* 0x40/0x50 */ |
29 | 32 | ||
30 | #if defined(CONFIG_MX23) | 33 | #if defined(CONFIG_MX23) |
31 | uint32_t reserved1[4]; | 34 | uint32_t reserved1[4]; |
32 | #endif | 35 | #endif |
33 | 36 | ||
34 | mxs_reg_32(hw_lcdif_timing) /* 0x60 */ | 37 | mxs_reg_32(hw_lcdif_timing) /* 0x60 */ |
35 | mxs_reg_32(hw_lcdif_vdctrl0) /* 0x70 */ | 38 | mxs_reg_32(hw_lcdif_vdctrl0) /* 0x70 */ |
36 | mxs_reg_32(hw_lcdif_vdctrl1) /* 0x80 */ | 39 | mxs_reg_32(hw_lcdif_vdctrl1) /* 0x80 */ |
37 | mxs_reg_32(hw_lcdif_vdctrl2) /* 0x90 */ | 40 | mxs_reg_32(hw_lcdif_vdctrl2) /* 0x90 */ |
38 | mxs_reg_32(hw_lcdif_vdctrl3) /* 0xa0 */ | 41 | mxs_reg_32(hw_lcdif_vdctrl3) /* 0xa0 */ |
39 | mxs_reg_32(hw_lcdif_vdctrl4) /* 0xb0 */ | 42 | mxs_reg_32(hw_lcdif_vdctrl4) /* 0xb0 */ |
40 | mxs_reg_32(hw_lcdif_dvictrl0) /* 0xc0 */ | 43 | mxs_reg_32(hw_lcdif_dvictrl0) /* 0xc0 */ |
41 | mxs_reg_32(hw_lcdif_dvictrl1) /* 0xd0 */ | 44 | mxs_reg_32(hw_lcdif_dvictrl1) /* 0xd0 */ |
42 | mxs_reg_32(hw_lcdif_dvictrl2) /* 0xe0 */ | 45 | mxs_reg_32(hw_lcdif_dvictrl2) /* 0xe0 */ |
43 | mxs_reg_32(hw_lcdif_dvictrl3) /* 0xf0 */ | 46 | mxs_reg_32(hw_lcdif_dvictrl3) /* 0xf0 */ |
44 | mxs_reg_32(hw_lcdif_dvictrl4) /* 0x100 */ | 47 | mxs_reg_32(hw_lcdif_dvictrl4) /* 0x100 */ |
45 | mxs_reg_32(hw_lcdif_csc_coeffctrl0) /* 0x110 */ | 48 | mxs_reg_32(hw_lcdif_csc_coeffctrl0) /* 0x110 */ |
46 | mxs_reg_32(hw_lcdif_csc_coeffctrl1) /* 0x120 */ | 49 | mxs_reg_32(hw_lcdif_csc_coeffctrl1) /* 0x120 */ |
47 | mxs_reg_32(hw_lcdif_csc_coeffctrl2) /* 0x130 */ | 50 | mxs_reg_32(hw_lcdif_csc_coeffctrl2) /* 0x130 */ |
48 | mxs_reg_32(hw_lcdif_csc_coeffctrl3) /* 0x140 */ | 51 | mxs_reg_32(hw_lcdif_csc_coeffctrl3) /* 0x140 */ |
49 | mxs_reg_32(hw_lcdif_csc_coeffctrl4) /* 0x150 */ | 52 | mxs_reg_32(hw_lcdif_csc_coeffctrl4) /* 0x150 */ |
50 | mxs_reg_32(hw_lcdif_csc_offset) /* 0x160 */ | 53 | mxs_reg_32(hw_lcdif_csc_offset) /* 0x160 */ |
51 | mxs_reg_32(hw_lcdif_csc_limit) /* 0x170 */ | 54 | mxs_reg_32(hw_lcdif_csc_limit) /* 0x170 */ |
52 | 55 | ||
53 | #if defined(CONFIG_MX23) | 56 | #if defined(CONFIG_MX23) |
54 | uint32_t reserved2[12]; | 57 | uint32_t reserved2[12]; |
55 | #endif | 58 | #endif |
56 | mxs_reg_32(hw_lcdif_data) /* 0x1b0/0x180 */ | 59 | mxs_reg_32(hw_lcdif_data) /* 0x1b0/0x180 */ |
57 | mxs_reg_32(hw_lcdif_bm_error_stat) /* 0x1c0/0x190 */ | 60 | mxs_reg_32(hw_lcdif_bm_error_stat) /* 0x1c0/0x190 */ |
58 | #if defined(CONFIG_MX28) || defined(CONFIG_MX6SX) || defined(CONFIG_MX6UL) || \ | 61 | #if defined(CONFIG_MX28) || defined(CONFIG_MX6SX) || \ |
59 | defined(CONFIG_MX7) || defined(CONFIG_MX6SL) || defined(CONFIG_MX6SLL) | 62 | defined(CONFIG_MX6SL) || defined(CONFIG_MX6SLL) || \ |
63 | defined(CONFIG_MX6UL) || defined(CONFIG_MX6ULL) || \ | ||
64 | defined(CONFIG_MX7) | ||
60 | mxs_reg_32(hw_lcdif_crc_stat) /* 0x1a0 */ | 65 | mxs_reg_32(hw_lcdif_crc_stat) /* 0x1a0 */ |
61 | #endif | 66 | #endif |
62 | mxs_reg_32(hw_lcdif_lcdif_stat) /* 0x1d0/0x1b0 */ | 67 | mxs_reg_32(hw_lcdif_lcdif_stat) /* 0x1d0/0x1b0 */ |
63 | mxs_reg_32(hw_lcdif_version) /* 0x1e0/0x1c0 */ | 68 | mxs_reg_32(hw_lcdif_version) /* 0x1e0/0x1c0 */ |
64 | mxs_reg_32(hw_lcdif_debug0) /* 0x1f0/0x1d0 */ | 69 | mxs_reg_32(hw_lcdif_debug0) /* 0x1f0/0x1d0 */ |
65 | mxs_reg_32(hw_lcdif_debug1) /* 0x200/0x1e0 */ | 70 | mxs_reg_32(hw_lcdif_debug1) /* 0x200/0x1e0 */ |
66 | mxs_reg_32(hw_lcdif_debug2) /* 0x1f0 */ | 71 | mxs_reg_32(hw_lcdif_debug2) /* 0x1f0 */ |
67 | #if defined(CONFIG_MX6SX) || defined(CONFIG_MX6UL) || defined(CONFIG_MX7) || \ | 72 | #if defined(CONFIG_MX6SX) || \ |
68 | defined(CONFIG_MX6SL) || defined(CONFIG_MX6SLL) | 73 | defined(CONFIG_MX6SL) || defined(CONFIG_MX6SLL) || \ |
74 | defined(CONFIG_MX6UL) || defined(CONFIG_MX6ULL) || \ | ||
75 | defined(CONFIG_MX7) | ||
69 | mxs_reg_32(hw_lcdif_thres) | 76 | mxs_reg_32(hw_lcdif_thres) |
70 | mxs_reg_32(hw_lcdif_as_ctrl) | 77 | mxs_reg_32(hw_lcdif_as_ctrl) |
71 | mxs_reg_32(hw_lcdif_as_buf) | 78 | mxs_reg_32(hw_lcdif_as_buf) |
72 | mxs_reg_32(hw_lcdif_as_next_buf) | 79 | mxs_reg_32(hw_lcdif_as_next_buf) |
73 | mxs_reg_32(hw_lcdif_as_clrkeylow) | 80 | mxs_reg_32(hw_lcdif_as_clrkeylow) |
74 | mxs_reg_32(hw_lcdif_as_clrkeyhigh) | 81 | mxs_reg_32(hw_lcdif_as_clrkeyhigh) |
75 | mxs_reg_32(hw_lcdif_as_sync_delay) | 82 | mxs_reg_32(hw_lcdif_as_sync_delay) |
76 | mxs_reg_32(hw_lcdif_as_debug3) | 83 | mxs_reg_32(hw_lcdif_as_debug3) |
77 | mxs_reg_32(hw_lcdif_as_debug4) | 84 | mxs_reg_32(hw_lcdif_as_debug4) |
78 | mxs_reg_32(hw_lcdif_as_debug5) | 85 | mxs_reg_32(hw_lcdif_as_debug5) |
79 | #endif | 86 | #endif |
80 | }; | 87 | }; |
81 | #endif | 88 | #endif |
82 | 89 | ||
83 | #define LCDIF_CTRL_SFTRST (1 << 31) | 90 | #define LCDIF_CTRL_SFTRST (1 << 31) |
84 | #define LCDIF_CTRL_CLKGATE (1 << 30) | 91 | #define LCDIF_CTRL_CLKGATE (1 << 30) |
85 | #define LCDIF_CTRL_YCBCR422_INPUT (1 << 29) | 92 | #define LCDIF_CTRL_YCBCR422_INPUT (1 << 29) |
86 | #define LCDIF_CTRL_READ_WRITEB (1 << 28) | 93 | #define LCDIF_CTRL_READ_WRITEB (1 << 28) |
87 | #define LCDIF_CTRL_WAIT_FOR_VSYNC_EDGE (1 << 27) | 94 | #define LCDIF_CTRL_WAIT_FOR_VSYNC_EDGE (1 << 27) |
88 | #define LCDIF_CTRL_DATA_SHIFT_DIR (1 << 26) | 95 | #define LCDIF_CTRL_DATA_SHIFT_DIR (1 << 26) |
89 | #define LCDIF_CTRL_SHIFT_NUM_BITS_MASK (0x1f << 21) | 96 | #define LCDIF_CTRL_SHIFT_NUM_BITS_MASK (0x1f << 21) |
90 | #define LCDIF_CTRL_SHIFT_NUM_BITS_OFFSET 21 | 97 | #define LCDIF_CTRL_SHIFT_NUM_BITS_OFFSET 21 |
91 | #define LCDIF_CTRL_DVI_MODE (1 << 20) | 98 | #define LCDIF_CTRL_DVI_MODE (1 << 20) |
92 | #define LCDIF_CTRL_BYPASS_COUNT (1 << 19) | 99 | #define LCDIF_CTRL_BYPASS_COUNT (1 << 19) |
93 | #define LCDIF_CTRL_VSYNC_MODE (1 << 18) | 100 | #define LCDIF_CTRL_VSYNC_MODE (1 << 18) |
94 | #define LCDIF_CTRL_DOTCLK_MODE (1 << 17) | 101 | #define LCDIF_CTRL_DOTCLK_MODE (1 << 17) |
95 | #define LCDIF_CTRL_DATA_SELECT (1 << 16) | 102 | #define LCDIF_CTRL_DATA_SELECT (1 << 16) |
96 | #define LCDIF_CTRL_INPUT_DATA_SWIZZLE_MASK (0x3 << 14) | 103 | #define LCDIF_CTRL_INPUT_DATA_SWIZZLE_MASK (0x3 << 14) |
97 | #define LCDIF_CTRL_INPUT_DATA_SWIZZLE_OFFSET 14 | 104 | #define LCDIF_CTRL_INPUT_DATA_SWIZZLE_OFFSET 14 |
98 | #define LCDIF_CTRL_CSC_DATA_SWIZZLE_MASK (0x3 << 12) | 105 | #define LCDIF_CTRL_CSC_DATA_SWIZZLE_MASK (0x3 << 12) |
99 | #define LCDIF_CTRL_CSC_DATA_SWIZZLE_OFFSET 12 | 106 | #define LCDIF_CTRL_CSC_DATA_SWIZZLE_OFFSET 12 |
100 | #define LCDIF_CTRL_LCD_DATABUS_WIDTH_MASK (0x3 << 10) | 107 | #define LCDIF_CTRL_LCD_DATABUS_WIDTH_MASK (0x3 << 10) |
101 | #define LCDIF_CTRL_LCD_DATABUS_WIDTH_OFFSET 10 | 108 | #define LCDIF_CTRL_LCD_DATABUS_WIDTH_OFFSET 10 |
102 | #define LCDIF_CTRL_LCD_DATABUS_WIDTH_16BIT (0 << 10) | 109 | #define LCDIF_CTRL_LCD_DATABUS_WIDTH_16BIT (0 << 10) |
103 | #define LCDIF_CTRL_LCD_DATABUS_WIDTH_8BIT (1 << 10) | 110 | #define LCDIF_CTRL_LCD_DATABUS_WIDTH_8BIT (1 << 10) |
104 | #define LCDIF_CTRL_LCD_DATABUS_WIDTH_18BIT (2 << 10) | 111 | #define LCDIF_CTRL_LCD_DATABUS_WIDTH_18BIT (2 << 10) |
105 | #define LCDIF_CTRL_LCD_DATABUS_WIDTH_24BIT (3 << 10) | 112 | #define LCDIF_CTRL_LCD_DATABUS_WIDTH_24BIT (3 << 10) |
106 | #define LCDIF_CTRL_WORD_LENGTH_MASK (0x3 << 8) | 113 | #define LCDIF_CTRL_WORD_LENGTH_MASK (0x3 << 8) |
107 | #define LCDIF_CTRL_WORD_LENGTH_OFFSET 8 | 114 | #define LCDIF_CTRL_WORD_LENGTH_OFFSET 8 |
108 | #define LCDIF_CTRL_WORD_LENGTH_16BIT (0 << 8) | 115 | #define LCDIF_CTRL_WORD_LENGTH_16BIT (0 << 8) |
109 | #define LCDIF_CTRL_WORD_LENGTH_8BIT (1 << 8) | 116 | #define LCDIF_CTRL_WORD_LENGTH_8BIT (1 << 8) |
110 | #define LCDIF_CTRL_WORD_LENGTH_18BIT (2 << 8) | 117 | #define LCDIF_CTRL_WORD_LENGTH_18BIT (2 << 8) |
111 | #define LCDIF_CTRL_WORD_LENGTH_24BIT (3 << 8) | 118 | #define LCDIF_CTRL_WORD_LENGTH_24BIT (3 << 8) |
112 | #define LCDIF_CTRL_RGB_TO_YCBCR422_CSC (1 << 7) | 119 | #define LCDIF_CTRL_RGB_TO_YCBCR422_CSC (1 << 7) |
113 | #define LCDIF_CTRL_LCDIF_MASTER (1 << 5) | 120 | #define LCDIF_CTRL_LCDIF_MASTER (1 << 5) |
114 | #define LCDIF_CTRL_DATA_FORMAT_16_BIT (1 << 3) | 121 | #define LCDIF_CTRL_DATA_FORMAT_16_BIT (1 << 3) |
115 | #define LCDIF_CTRL_DATA_FORMAT_18_BIT (1 << 2) | 122 | #define LCDIF_CTRL_DATA_FORMAT_18_BIT (1 << 2) |
116 | #define LCDIF_CTRL_DATA_FORMAT_24_BIT (1 << 1) | 123 | #define LCDIF_CTRL_DATA_FORMAT_24_BIT (1 << 1) |
117 | #define LCDIF_CTRL_RUN (1 << 0) | 124 | #define LCDIF_CTRL_RUN (1 << 0) |
118 | 125 | ||
119 | #define LCDIF_CTRL1_COMBINE_MPU_WR_STRB (1 << 27) | 126 | #define LCDIF_CTRL1_COMBINE_MPU_WR_STRB (1 << 27) |
120 | #define LCDIF_CTRL1_BM_ERROR_IRQ_EN (1 << 26) | 127 | #define LCDIF_CTRL1_BM_ERROR_IRQ_EN (1 << 26) |
121 | #define LCDIF_CTRL1_BM_ERROR_IRQ (1 << 25) | 128 | #define LCDIF_CTRL1_BM_ERROR_IRQ (1 << 25) |
122 | #define LCDIF_CTRL1_RECOVER_ON_UNDERFLOW (1 << 24) | 129 | #define LCDIF_CTRL1_RECOVER_ON_UNDERFLOW (1 << 24) |
123 | #define LCDIF_CTRL1_INTERLACE_FIELDS (1 << 23) | 130 | #define LCDIF_CTRL1_INTERLACE_FIELDS (1 << 23) |
124 | #define LCDIF_CTRL1_START_INTERLACE_FROM_SECOND_FIELD (1 << 22) | 131 | #define LCDIF_CTRL1_START_INTERLACE_FROM_SECOND_FIELD (1 << 22) |
125 | #define LCDIF_CTRL1_FIFO_CLEAR (1 << 21) | 132 | #define LCDIF_CTRL1_FIFO_CLEAR (1 << 21) |
126 | #define LCDIF_CTRL1_IRQ_ON_ALTERNATE_FIELDS (1 << 20) | 133 | #define LCDIF_CTRL1_IRQ_ON_ALTERNATE_FIELDS (1 << 20) |
127 | #define LCDIF_CTRL1_BYTE_PACKING_FORMAT_MASK (0xf << 16) | 134 | #define LCDIF_CTRL1_BYTE_PACKING_FORMAT_MASK (0xf << 16) |
128 | #define LCDIF_CTRL1_BYTE_PACKING_FORMAT_OFFSET 16 | 135 | #define LCDIF_CTRL1_BYTE_PACKING_FORMAT_OFFSET 16 |
129 | #define LCDIF_CTRL1_OVERFLOW_IRQ_EN (1 << 15) | 136 | #define LCDIF_CTRL1_OVERFLOW_IRQ_EN (1 << 15) |
130 | #define LCDIF_CTRL1_UNDERFLOW_IRQ_EN (1 << 14) | 137 | #define LCDIF_CTRL1_UNDERFLOW_IRQ_EN (1 << 14) |
131 | #define LCDIF_CTRL1_CUR_FRAME_DONE_IRQ_EN (1 << 13) | 138 | #define LCDIF_CTRL1_CUR_FRAME_DONE_IRQ_EN (1 << 13) |
132 | #define LCDIF_CTRL1_VSYNC_EDGE_IRQ_EN (1 << 12) | 139 | #define LCDIF_CTRL1_VSYNC_EDGE_IRQ_EN (1 << 12) |
133 | #define LCDIF_CTRL1_OVERFLOW_IRQ (1 << 11) | 140 | #define LCDIF_CTRL1_OVERFLOW_IRQ (1 << 11) |
134 | #define LCDIF_CTRL1_UNDERFLOW_IRQ (1 << 10) | 141 | #define LCDIF_CTRL1_UNDERFLOW_IRQ (1 << 10) |
135 | #define LCDIF_CTRL1_CUR_FRAME_DONE_IRQ (1 << 9) | 142 | #define LCDIF_CTRL1_CUR_FRAME_DONE_IRQ (1 << 9) |
136 | #define LCDIF_CTRL1_VSYNC_EDGE_IRQ (1 << 8) | 143 | #define LCDIF_CTRL1_VSYNC_EDGE_IRQ (1 << 8) |
137 | #define LCDIF_CTRL1_BUSY_ENABLE (1 << 2) | 144 | #define LCDIF_CTRL1_BUSY_ENABLE (1 << 2) |
138 | #define LCDIF_CTRL1_MODE86 (1 << 1) | 145 | #define LCDIF_CTRL1_MODE86 (1 << 1) |
139 | #define LCDIF_CTRL1_RESET (1 << 0) | 146 | #define LCDIF_CTRL1_RESET (1 << 0) |
140 | 147 | ||
141 | #define LCDIF_CTRL2_OUTSTANDING_REQS_MASK (0x7 << 21) | 148 | #define LCDIF_CTRL2_OUTSTANDING_REQS_MASK (0x7 << 21) |
142 | #define LCDIF_CTRL2_OUTSTANDING_REQS_OFFSET 21 | 149 | #define LCDIF_CTRL2_OUTSTANDING_REQS_OFFSET 21 |
143 | #define LCDIF_CTRL2_OUTSTANDING_REQS_REQ_1 (0x0 << 21) | 150 | #define LCDIF_CTRL2_OUTSTANDING_REQS_REQ_1 (0x0 << 21) |
144 | #define LCDIF_CTRL2_OUTSTANDING_REQS_REQ_2 (0x1 << 21) | 151 | #define LCDIF_CTRL2_OUTSTANDING_REQS_REQ_2 (0x1 << 21) |
145 | #define LCDIF_CTRL2_OUTSTANDING_REQS_REQ_4 (0x2 << 21) | 152 | #define LCDIF_CTRL2_OUTSTANDING_REQS_REQ_4 (0x2 << 21) |
146 | #define LCDIF_CTRL2_OUTSTANDING_REQS_REQ_8 (0x3 << 21) | 153 | #define LCDIF_CTRL2_OUTSTANDING_REQS_REQ_8 (0x3 << 21) |
147 | #define LCDIF_CTRL2_OUTSTANDING_REQS_REQ_16 (0x4 << 21) | 154 | #define LCDIF_CTRL2_OUTSTANDING_REQS_REQ_16 (0x4 << 21) |
148 | #define LCDIF_CTRL2_BURST_LEN_8 (1 << 20) | 155 | #define LCDIF_CTRL2_BURST_LEN_8 (1 << 20) |
149 | #define LCDIF_CTRL2_ODD_LINE_PATTERN_MASK (0x7 << 16) | 156 | #define LCDIF_CTRL2_ODD_LINE_PATTERN_MASK (0x7 << 16) |
150 | #define LCDIF_CTRL2_ODD_LINE_PATTERN_OFFSET 16 | 157 | #define LCDIF_CTRL2_ODD_LINE_PATTERN_OFFSET 16 |
151 | #define LCDIF_CTRL2_ODD_LINE_PATTERN_RGB (0x0 << 16) | 158 | #define LCDIF_CTRL2_ODD_LINE_PATTERN_RGB (0x0 << 16) |
152 | #define LCDIF_CTRL2_ODD_LINE_PATTERN_RBG (0x1 << 16) | 159 | #define LCDIF_CTRL2_ODD_LINE_PATTERN_RBG (0x1 << 16) |
153 | #define LCDIF_CTRL2_ODD_LINE_PATTERN_GBR (0x2 << 16) | 160 | #define LCDIF_CTRL2_ODD_LINE_PATTERN_GBR (0x2 << 16) |
154 | #define LCDIF_CTRL2_ODD_LINE_PATTERN_GRB (0x3 << 16) | 161 | #define LCDIF_CTRL2_ODD_LINE_PATTERN_GRB (0x3 << 16) |
155 | #define LCDIF_CTRL2_ODD_LINE_PATTERN_BRG (0x4 << 16) | 162 | #define LCDIF_CTRL2_ODD_LINE_PATTERN_BRG (0x4 << 16) |
156 | #define LCDIF_CTRL2_ODD_LINE_PATTERN_BGR (0x5 << 16) | 163 | #define LCDIF_CTRL2_ODD_LINE_PATTERN_BGR (0x5 << 16) |
157 | #define LCDIF_CTRL2_EVEN_LINE_PATTERN_MASK (0x7 << 12) | 164 | #define LCDIF_CTRL2_EVEN_LINE_PATTERN_MASK (0x7 << 12) |
158 | #define LCDIF_CTRL2_EVEN_LINE_PATTERN_OFFSET 12 | 165 | #define LCDIF_CTRL2_EVEN_LINE_PATTERN_OFFSET 12 |
159 | #define LCDIF_CTRL2_EVEN_LINE_PATTERN_RGB (0x0 << 12) | 166 | #define LCDIF_CTRL2_EVEN_LINE_PATTERN_RGB (0x0 << 12) |
160 | #define LCDIF_CTRL2_EVEN_LINE_PATTERN_RBG (0x1 << 12) | 167 | #define LCDIF_CTRL2_EVEN_LINE_PATTERN_RBG (0x1 << 12) |
161 | #define LCDIF_CTRL2_EVEN_LINE_PATTERN_GBR (0x2 << 12) | 168 | #define LCDIF_CTRL2_EVEN_LINE_PATTERN_GBR (0x2 << 12) |
162 | #define LCDIF_CTRL2_EVEN_LINE_PATTERN_GRB (0x3 << 12) | 169 | #define LCDIF_CTRL2_EVEN_LINE_PATTERN_GRB (0x3 << 12) |
163 | #define LCDIF_CTRL2_EVEN_LINE_PATTERN_BRG (0x4 << 12) | 170 | #define LCDIF_CTRL2_EVEN_LINE_PATTERN_BRG (0x4 << 12) |
164 | #define LCDIF_CTRL2_EVEN_LINE_PATTERN_BGR (0x5 << 12) | 171 | #define LCDIF_CTRL2_EVEN_LINE_PATTERN_BGR (0x5 << 12) |
165 | #define LCDIF_CTRL2_READ_PACK_DIR (1 << 10) | 172 | #define LCDIF_CTRL2_READ_PACK_DIR (1 << 10) |
166 | #define LCDIF_CTRL2_READ_MODE_OUTPUT_IN_RGB_FORMAT (1 << 9) | 173 | #define LCDIF_CTRL2_READ_MODE_OUTPUT_IN_RGB_FORMAT (1 << 9) |
167 | #define LCDIF_CTRL2_READ_MODE_6_BIT_INPUT (1 << 8) | 174 | #define LCDIF_CTRL2_READ_MODE_6_BIT_INPUT (1 << 8) |
168 | #define LCDIF_CTRL2_READ_MODE_NUM_PACKED_SUBWORDS_MASK (0x7 << 4) | 175 | #define LCDIF_CTRL2_READ_MODE_NUM_PACKED_SUBWORDS_MASK (0x7 << 4) |
169 | #define LCDIF_CTRL2_READ_MODE_NUM_PACKED_SUBWORDS_OFFSET 4 | 176 | #define LCDIF_CTRL2_READ_MODE_NUM_PACKED_SUBWORDS_OFFSET 4 |
170 | #define LCDIF_CTRL2_INITIAL_DUMMY_READ_MASK (0x7 << 1) | 177 | #define LCDIF_CTRL2_INITIAL_DUMMY_READ_MASK (0x7 << 1) |
171 | #define LCDIF_CTRL2_INITIAL_DUMMY_READ_OFFSET 1 | 178 | #define LCDIF_CTRL2_INITIAL_DUMMY_READ_OFFSET 1 |
172 | 179 | ||
173 | #define LCDIF_TRANSFER_COUNT_V_COUNT_MASK (0xffff << 16) | 180 | #define LCDIF_TRANSFER_COUNT_V_COUNT_MASK (0xffff << 16) |
174 | #define LCDIF_TRANSFER_COUNT_V_COUNT_OFFSET 16 | 181 | #define LCDIF_TRANSFER_COUNT_V_COUNT_OFFSET 16 |
175 | #define LCDIF_TRANSFER_COUNT_H_COUNT_MASK (0xffff << 0) | 182 | #define LCDIF_TRANSFER_COUNT_H_COUNT_MASK (0xffff << 0) |
176 | #define LCDIF_TRANSFER_COUNT_H_COUNT_OFFSET 0 | 183 | #define LCDIF_TRANSFER_COUNT_H_COUNT_OFFSET 0 |
177 | 184 | ||
178 | #define LCDIF_CUR_BUF_ADDR_MASK 0xffffffff | 185 | #define LCDIF_CUR_BUF_ADDR_MASK 0xffffffff |
179 | #define LCDIF_CUR_BUF_ADDR_OFFSET 0 | 186 | #define LCDIF_CUR_BUF_ADDR_OFFSET 0 |
180 | 187 | ||
181 | #define LCDIF_NEXT_BUF_ADDR_MASK 0xffffffff | 188 | #define LCDIF_NEXT_BUF_ADDR_MASK 0xffffffff |
182 | #define LCDIF_NEXT_BUF_ADDR_OFFSET 0 | 189 | #define LCDIF_NEXT_BUF_ADDR_OFFSET 0 |
183 | 190 | ||
184 | #define LCDIF_TIMING_CMD_HOLD_MASK (0xff << 24) | 191 | #define LCDIF_TIMING_CMD_HOLD_MASK (0xff << 24) |
185 | #define LCDIF_TIMING_CMD_HOLD_OFFSET 24 | 192 | #define LCDIF_TIMING_CMD_HOLD_OFFSET 24 |
186 | #define LCDIF_TIMING_CMD_SETUP_MASK (0xff << 16) | 193 | #define LCDIF_TIMING_CMD_SETUP_MASK (0xff << 16) |
187 | #define LCDIF_TIMING_CMD_SETUP_OFFSET 16 | 194 | #define LCDIF_TIMING_CMD_SETUP_OFFSET 16 |
188 | #define LCDIF_TIMING_DATA_HOLD_MASK (0xff << 8) | 195 | #define LCDIF_TIMING_DATA_HOLD_MASK (0xff << 8) |
189 | #define LCDIF_TIMING_DATA_HOLD_OFFSET 8 | 196 | #define LCDIF_TIMING_DATA_HOLD_OFFSET 8 |
190 | #define LCDIF_TIMING_DATA_SETUP_MASK (0xff << 0) | 197 | #define LCDIF_TIMING_DATA_SETUP_MASK (0xff << 0) |
191 | #define LCDIF_TIMING_DATA_SETUP_OFFSET 0 | 198 | #define LCDIF_TIMING_DATA_SETUP_OFFSET 0 |
192 | 199 | ||
193 | #define LCDIF_VDCTRL0_VSYNC_OEB (1 << 29) | 200 | #define LCDIF_VDCTRL0_VSYNC_OEB (1 << 29) |
194 | #define LCDIF_VDCTRL0_ENABLE_PRESENT (1 << 28) | 201 | #define LCDIF_VDCTRL0_ENABLE_PRESENT (1 << 28) |
195 | #define LCDIF_VDCTRL0_VSYNC_POL (1 << 27) | 202 | #define LCDIF_VDCTRL0_VSYNC_POL (1 << 27) |
196 | #define LCDIF_VDCTRL0_HSYNC_POL (1 << 26) | 203 | #define LCDIF_VDCTRL0_HSYNC_POL (1 << 26) |
197 | #define LCDIF_VDCTRL0_DOTCLK_POL (1 << 25) | 204 | #define LCDIF_VDCTRL0_DOTCLK_POL (1 << 25) |
198 | #define LCDIF_VDCTRL0_ENABLE_POL (1 << 24) | 205 | #define LCDIF_VDCTRL0_ENABLE_POL (1 << 24) |
199 | #define LCDIF_VDCTRL0_VSYNC_PERIOD_UNIT (1 << 21) | 206 | #define LCDIF_VDCTRL0_VSYNC_PERIOD_UNIT (1 << 21) |
200 | #define LCDIF_VDCTRL0_VSYNC_PULSE_WIDTH_UNIT (1 << 20) | 207 | #define LCDIF_VDCTRL0_VSYNC_PULSE_WIDTH_UNIT (1 << 20) |
201 | #define LCDIF_VDCTRL0_HALF_LINE (1 << 19) | 208 | #define LCDIF_VDCTRL0_HALF_LINE (1 << 19) |
202 | #define LCDIF_VDCTRL0_HALF_LINE_MODE (1 << 18) | 209 | #define LCDIF_VDCTRL0_HALF_LINE_MODE (1 << 18) |
203 | #define LCDIF_VDCTRL0_VSYNC_PULSE_WIDTH_MASK 0x3ffff | 210 | #define LCDIF_VDCTRL0_VSYNC_PULSE_WIDTH_MASK 0x3ffff |
204 | #define LCDIF_VDCTRL0_VSYNC_PULSE_WIDTH_OFFSET 0 | 211 | #define LCDIF_VDCTRL0_VSYNC_PULSE_WIDTH_OFFSET 0 |
205 | 212 | ||
206 | #define LCDIF_VDCTRL1_VSYNC_PERIOD_MASK 0xffffffff | 213 | #define LCDIF_VDCTRL1_VSYNC_PERIOD_MASK 0xffffffff |
207 | #define LCDIF_VDCTRL1_VSYNC_PERIOD_OFFSET 0 | 214 | #define LCDIF_VDCTRL1_VSYNC_PERIOD_OFFSET 0 |
208 | 215 | ||
209 | #if defined(CONFIG_MX23) | 216 | #if defined(CONFIG_MX23) |
210 | #define LCDIF_VDCTRL2_HSYNC_PULSE_WIDTH_MASK (0xff << 24) | 217 | #define LCDIF_VDCTRL2_HSYNC_PULSE_WIDTH_MASK (0xff << 24) |
211 | #define LCDIF_VDCTRL2_HSYNC_PULSE_WIDTH_OFFSET 24 | 218 | #define LCDIF_VDCTRL2_HSYNC_PULSE_WIDTH_OFFSET 24 |
212 | #else | 219 | #else |
213 | #define LCDIF_VDCTRL2_HSYNC_PULSE_WIDTH_MASK (0x3fff << 18) | 220 | #define LCDIF_VDCTRL2_HSYNC_PULSE_WIDTH_MASK (0x3fff << 18) |
214 | #define LCDIF_VDCTRL2_HSYNC_PULSE_WIDTH_OFFSET 18 | 221 | #define LCDIF_VDCTRL2_HSYNC_PULSE_WIDTH_OFFSET 18 |
215 | #endif | 222 | #endif |
216 | #define LCDIF_VDCTRL2_HSYNC_PERIOD_MASK 0x3ffff | 223 | #define LCDIF_VDCTRL2_HSYNC_PERIOD_MASK 0x3ffff |
217 | #define LCDIF_VDCTRL2_HSYNC_PERIOD_OFFSET 0 | 224 | #define LCDIF_VDCTRL2_HSYNC_PERIOD_OFFSET 0 |
218 | 225 | ||
219 | #define LCDIF_VDCTRL3_MUX_SYNC_SIGNALS (1 << 29) | 226 | #define LCDIF_VDCTRL3_MUX_SYNC_SIGNALS (1 << 29) |
220 | #define LCDIF_VDCTRL3_VSYNC_ONLY (1 << 28) | 227 | #define LCDIF_VDCTRL3_VSYNC_ONLY (1 << 28) |
221 | #define LCDIF_VDCTRL3_HORIZONTAL_WAIT_CNT_MASK (0xfff << 16) | 228 | #define LCDIF_VDCTRL3_HORIZONTAL_WAIT_CNT_MASK (0xfff << 16) |
222 | #define LCDIF_VDCTRL3_HORIZONTAL_WAIT_CNT_OFFSET 16 | 229 | #define LCDIF_VDCTRL3_HORIZONTAL_WAIT_CNT_OFFSET 16 |
223 | #define LCDIF_VDCTRL3_VERTICAL_WAIT_CNT_MASK (0xffff << 0) | 230 | #define LCDIF_VDCTRL3_VERTICAL_WAIT_CNT_MASK (0xffff << 0) |
224 | #define LCDIF_VDCTRL3_VERTICAL_WAIT_CNT_OFFSET 0 | 231 | #define LCDIF_VDCTRL3_VERTICAL_WAIT_CNT_OFFSET 0 |
225 | 232 | ||
226 | #define LCDIF_VDCTRL4_DOTCLK_DLY_SEL_MASK (0x7 << 29) | 233 | #define LCDIF_VDCTRL4_DOTCLK_DLY_SEL_MASK (0x7 << 29) |
227 | #define LCDIF_VDCTRL4_DOTCLK_DLY_SEL_OFFSET 29 | 234 | #define LCDIF_VDCTRL4_DOTCLK_DLY_SEL_OFFSET 29 |
228 | #define LCDIF_VDCTRL4_SYNC_SIGNALS_ON (1 << 18) | 235 | #define LCDIF_VDCTRL4_SYNC_SIGNALS_ON (1 << 18) |
229 | #define LCDIF_VDCTRL4_DOTCLK_H_VALID_DATA_CNT_MASK 0x3ffff | 236 | #define LCDIF_VDCTRL4_DOTCLK_H_VALID_DATA_CNT_MASK 0x3ffff |
230 | #define LCDIF_VDCTRL4_DOTCLK_H_VALID_DATA_CNT_OFFSET 0 | 237 | #define LCDIF_VDCTRL4_DOTCLK_H_VALID_DATA_CNT_OFFSET 0 |
231 | 238 | ||
232 | #endif /* __IMX_REGS_LCDIF_H__ */ | 239 | #endif /* __IMX_REGS_LCDIF_H__ */ |
233 | 240 |
arch/arm/mach-imx/mx6/Kconfig
1 | if ARCH_MX6 | 1 | if ARCH_MX6 |
2 | 2 | ||
3 | config MX6_SMP | 3 | config MX6_SMP |
4 | select ARM_ERRATA_751472 | 4 | select ARM_ERRATA_751472 |
5 | select ARM_ERRATA_761320 | 5 | select ARM_ERRATA_761320 |
6 | select ARM_ERRATA_794072 | 6 | select ARM_ERRATA_794072 |
7 | select ARM_ERRATA_845369 | 7 | select ARM_ERRATA_845369 |
8 | bool | 8 | bool |
9 | 9 | ||
10 | config MX6 | 10 | config MX6 |
11 | select ARM_ERRATA_743622 if !MX6UL | 11 | select ARM_ERRATA_743622 if !MX6UL && !MX6ULL |
12 | bool | 12 | bool |
13 | default y | 13 | default y |
14 | imply CMD_FUSE | 14 | imply CMD_FUSE |
15 | 15 | ||
16 | config MX6D | 16 | config MX6D |
17 | select HAS_CAAM | 17 | select HAS_CAAM |
18 | select MX6_SMP | 18 | select MX6_SMP |
19 | bool | 19 | bool |
20 | 20 | ||
21 | config MX6DL | 21 | config MX6DL |
22 | select HAS_CAAM | 22 | select HAS_CAAM |
23 | select MX6_SMP | 23 | select MX6_SMP |
24 | bool | 24 | bool |
25 | 25 | ||
26 | config MX6Q | 26 | config MX6Q |
27 | select HAS_CAAM | 27 | select HAS_CAAM |
28 | select MX6_SMP | 28 | select MX6_SMP |
29 | bool | 29 | bool |
30 | 30 | ||
31 | config MX6QDL | 31 | config MX6QDL |
32 | select HAS_CAAM | 32 | select HAS_CAAM |
33 | select MX6_SMP | 33 | select MX6_SMP |
34 | bool | 34 | bool |
35 | 35 | ||
36 | config MX6S | 36 | config MX6S |
37 | select HAS_CAAM | 37 | select HAS_CAAM |
38 | bool | 38 | bool |
39 | 39 | ||
40 | config MX6SL | 40 | config MX6SL |
41 | bool | 41 | bool |
42 | 42 | ||
43 | config MX6SX | 43 | config MX6SX |
44 | select HAS_CAAM | 44 | select HAS_CAAM |
45 | select ROM_UNIFIED_SECTIONS | 45 | select ROM_UNIFIED_SECTIONS |
46 | bool | 46 | bool |
47 | 47 | ||
48 | config MX6SLL | 48 | config MX6SLL |
49 | select ROM_UNIFIED_SECTIONS | 49 | select ROM_UNIFIED_SECTIONS |
50 | bool | 50 | bool |
51 | 51 | ||
52 | config MX6UL | 52 | config MX6UL |
53 | select HAS_CAAM | 53 | select HAS_CAAM |
54 | select SYS_L2CACHE_OFF | 54 | select SYS_L2CACHE_OFF |
55 | select ROM_UNIFIED_SECTIONS | 55 | select ROM_UNIFIED_SECTIONS |
56 | bool | 56 | bool |
57 | 57 | ||
58 | config MX6UL_LITESOM | 58 | config MX6UL_LITESOM |
59 | bool | 59 | bool |
60 | select MX6UL | 60 | select MX6UL |
61 | select DM | 61 | select DM |
62 | select DM_THERMAL | 62 | select DM_THERMAL |
63 | select SUPPORT_SPL | 63 | select SUPPORT_SPL |
64 | 64 | ||
65 | config MX6UL_OPOS6UL | 65 | config MX6UL_OPOS6UL |
66 | bool | 66 | bool |
67 | select MX6UL | 67 | select MX6UL |
68 | select BOARD_LATE_INIT | 68 | select BOARD_LATE_INIT |
69 | select DM | 69 | select DM |
70 | select DM_GPIO | 70 | select DM_GPIO |
71 | select DM_MMC | 71 | select DM_MMC |
72 | select DM_THERMAL | 72 | select DM_THERMAL |
73 | select SUPPORT_SPL | 73 | select SUPPORT_SPL |
74 | 74 | ||
75 | config MX6ULL | 75 | config MX6ULL |
76 | select SYS_L2CACHE_OFF | 76 | select SYS_L2CACHE_OFF |
77 | select ROM_UNIFIED_SECTIONS | 77 | select ROM_UNIFIED_SECTIONS |
78 | bool | 78 | bool |
79 | 79 | ||
80 | config MX6_DDRCAL | 80 | config MX6_DDRCAL |
81 | bool "Include dynamic DDR calibration routines" | 81 | bool "Include dynamic DDR calibration routines" |
82 | depends on SPL | 82 | depends on SPL |
83 | default n | 83 | default n |
84 | help | 84 | help |
85 | Say "Y" if your board uses dynamic (per-boot) DDR calibration. | 85 | Say "Y" if your board uses dynamic (per-boot) DDR calibration. |
86 | If unsure, say N. | 86 | If unsure, say N. |
87 | 87 | ||
88 | choice | 88 | choice |
89 | prompt "MX6 board select" | 89 | prompt "MX6 board select" |
90 | optional | 90 | optional |
91 | 91 | ||
92 | config TARGET_ADVANTECH_DMS_BA16 | 92 | config TARGET_ADVANTECH_DMS_BA16 |
93 | bool "Advantech dms-ba16" | 93 | bool "Advantech dms-ba16" |
94 | select BOARD_LATE_INIT | 94 | select BOARD_LATE_INIT |
95 | select MX6Q | 95 | select MX6Q |
96 | imply CMD_SATA | 96 | imply CMD_SATA |
97 | 97 | ||
98 | config TARGET_APALIS_IMX6 | 98 | config TARGET_APALIS_IMX6 |
99 | bool "Toradex Apalis iMX6 board" | 99 | bool "Toradex Apalis iMX6 board" |
100 | select BOARD_LATE_INIT | 100 | select BOARD_LATE_INIT |
101 | select SUPPORT_SPL | 101 | select SUPPORT_SPL |
102 | select DM | 102 | select DM |
103 | select DM_SERIAL | 103 | select DM_SERIAL |
104 | select DM_THERMAL | 104 | select DM_THERMAL |
105 | imply CMD_SATA | 105 | imply CMD_SATA |
106 | 106 | ||
107 | config TARGET_ARISTAINETOS | 107 | config TARGET_ARISTAINETOS |
108 | bool "aristainetos" | 108 | bool "aristainetos" |
109 | 109 | ||
110 | config TARGET_ARISTAINETOS2 | 110 | config TARGET_ARISTAINETOS2 |
111 | bool "aristainetos2" | 111 | bool "aristainetos2" |
112 | select BOARD_LATE_INIT | 112 | select BOARD_LATE_INIT |
113 | 113 | ||
114 | config TARGET_ARISTAINETOS2B | 114 | config TARGET_ARISTAINETOS2B |
115 | bool "Support aristainetos2-revB" | 115 | bool "Support aristainetos2-revB" |
116 | select BOARD_LATE_INIT | 116 | select BOARD_LATE_INIT |
117 | 117 | ||
118 | config TARGET_CGTQMX6EVAL | 118 | config TARGET_CGTQMX6EVAL |
119 | bool "cgtqmx6eval" | 119 | bool "cgtqmx6eval" |
120 | select MX6QDL | 120 | select MX6QDL |
121 | select BOARD_LATE_INIT | 121 | select BOARD_LATE_INIT |
122 | select SUPPORT_SPL | 122 | select SUPPORT_SPL |
123 | select DM | 123 | select DM |
124 | select DM_THERMAL | 124 | select DM_THERMAL |
125 | 125 | ||
126 | config TARGET_CM_FX6 | 126 | config TARGET_CM_FX6 |
127 | bool "CM-FX6" | 127 | bool "CM-FX6" |
128 | select SUPPORT_SPL | 128 | select SUPPORT_SPL |
129 | select MX6QDL | 129 | select MX6QDL |
130 | select DM | 130 | select DM |
131 | select DM_SERIAL | 131 | select DM_SERIAL |
132 | select DM_GPIO | 132 | select DM_GPIO |
133 | 133 | ||
134 | config TARGET_COLIBRI_IMX6 | 134 | config TARGET_COLIBRI_IMX6 |
135 | bool "Toradex Colibri iMX6 board" | 135 | bool "Toradex Colibri iMX6 board" |
136 | select BOARD_LATE_INIT | 136 | select BOARD_LATE_INIT |
137 | select SUPPORT_SPL | 137 | select SUPPORT_SPL |
138 | select DM | 138 | select DM |
139 | select DM_SERIAL | 139 | select DM_SERIAL |
140 | select DM_THERMAL | 140 | select DM_THERMAL |
141 | 141 | ||
142 | config TARGET_DHCOMIMX6 | 142 | config TARGET_DHCOMIMX6 |
143 | bool "dh_imx6" | 143 | bool "dh_imx6" |
144 | select MX6QDL | 144 | select MX6QDL |
145 | select BOARD_LATE_INIT | 145 | select BOARD_LATE_INIT |
146 | select BOARD_EARLY_INIT_F | 146 | select BOARD_EARLY_INIT_F |
147 | select SUPPORT_SPL | 147 | select SUPPORT_SPL |
148 | select DM | 148 | select DM |
149 | select DM_THERMAL | 149 | select DM_THERMAL |
150 | imply CMD_SPL | 150 | imply CMD_SPL |
151 | 151 | ||
152 | config TARGET_DISPLAY5 | 152 | config TARGET_DISPLAY5 |
153 | bool "LWN DISPLAY5 board" | 153 | bool "LWN DISPLAY5 board" |
154 | select SUPPORT_SPL | 154 | select SUPPORT_SPL |
155 | select DM | 155 | select DM |
156 | select DM_SERIAL | 156 | select DM_SERIAL |
157 | 157 | ||
158 | config TARGET_EMBESTMX6BOARDS | 158 | config TARGET_EMBESTMX6BOARDS |
159 | bool "embestmx6boards" | 159 | bool "embestmx6boards" |
160 | select BOARD_LATE_INIT | 160 | select BOARD_LATE_INIT |
161 | 161 | ||
162 | config TARGET_GE_B450V3 | 162 | config TARGET_GE_B450V3 |
163 | bool "General Electric B450v3" | 163 | bool "General Electric B450v3" |
164 | select BOARD_LATE_INIT | 164 | select BOARD_LATE_INIT |
165 | select MX6Q | 165 | select MX6Q |
166 | 166 | ||
167 | config TARGET_GE_B650V3 | 167 | config TARGET_GE_B650V3 |
168 | bool "General Electric B650v3" | 168 | bool "General Electric B650v3" |
169 | select BOARD_LATE_INIT | 169 | select BOARD_LATE_INIT |
170 | select MX6Q | 170 | select MX6Q |
171 | 171 | ||
172 | config TARGET_GE_B850V3 | 172 | config TARGET_GE_B850V3 |
173 | bool "General Electric B850v3" | 173 | bool "General Electric B850v3" |
174 | select BOARD_LATE_INIT | 174 | select BOARD_LATE_INIT |
175 | select MX6Q | 175 | select MX6Q |
176 | 176 | ||
177 | config TARGET_GW_VENTANA | 177 | config TARGET_GW_VENTANA |
178 | bool "gw_ventana" | 178 | bool "gw_ventana" |
179 | select MX6QDL | 179 | select MX6QDL |
180 | select SUPPORT_SPL | 180 | select SUPPORT_SPL |
181 | imply CMD_SATA | 181 | imply CMD_SATA |
182 | imply CMD_SPL | 182 | imply CMD_SPL |
183 | 183 | ||
184 | config TARGET_KOSAGI_NOVENA | 184 | config TARGET_KOSAGI_NOVENA |
185 | bool "Kosagi Novena" | 185 | bool "Kosagi Novena" |
186 | select BOARD_LATE_INIT | 186 | select BOARD_LATE_INIT |
187 | select SUPPORT_SPL | 187 | select SUPPORT_SPL |
188 | 188 | ||
189 | config TARGET_MCCMON6 | 189 | config TARGET_MCCMON6 |
190 | bool "mccmon6" | 190 | bool "mccmon6" |
191 | select MX6QDL | 191 | select MX6QDL |
192 | select SUPPORT_SPL | 192 | select SUPPORT_SPL |
193 | 193 | ||
194 | config TARGET_MX6CUBOXI | 194 | config TARGET_MX6CUBOXI |
195 | bool "Solid-run mx6 boards" | 195 | bool "Solid-run mx6 boards" |
196 | select MX6QDL | 196 | select MX6QDL |
197 | select BOARD_LATE_INIT | 197 | select BOARD_LATE_INIT |
198 | select SUPPORT_SPL | 198 | select SUPPORT_SPL |
199 | 199 | ||
200 | config TARGET_MX6LOGICPD | 200 | config TARGET_MX6LOGICPD |
201 | bool "Logic PD i.MX6 SOM" | 201 | bool "Logic PD i.MX6 SOM" |
202 | select BOARD_EARLY_INIT_F | 202 | select BOARD_EARLY_INIT_F |
203 | select BOARD_LATE_INIT | 203 | select BOARD_LATE_INIT |
204 | select DM | 204 | select DM |
205 | select DM_ETH | 205 | select DM_ETH |
206 | select DM_GPIO | 206 | select DM_GPIO |
207 | select DM_I2C | 207 | select DM_I2C |
208 | select DM_MMC | 208 | select DM_MMC |
209 | select DM_PMIC | 209 | select DM_PMIC |
210 | select DM_REGULATOR | 210 | select DM_REGULATOR |
211 | select OF_CONTROL | 211 | select OF_CONTROL |
212 | 212 | ||
213 | config TARGET_MX6MEMCAL | 213 | config TARGET_MX6MEMCAL |
214 | bool "mx6memcal" | 214 | bool "mx6memcal" |
215 | select SUPPORT_SPL | 215 | select SUPPORT_SPL |
216 | help | 216 | help |
217 | The mx6memcal board is a virtual board that can be used to validate | 217 | The mx6memcal board is a virtual board that can be used to validate |
218 | and characterize the memory layout of a new design during the initial | 218 | and characterize the memory layout of a new design during the initial |
219 | development and pre-production stages. | 219 | development and pre-production stages. |
220 | 220 | ||
221 | config TARGET_MX6QARM2 | 221 | config TARGET_MX6QARM2 |
222 | bool "mx6qarm2" | 222 | bool "mx6qarm2" |
223 | 223 | ||
224 | config TARGET_MX6Q_ENGICAM | 224 | config TARGET_MX6Q_ENGICAM |
225 | bool "Support Engicam i.Core(RQS)" | 225 | bool "Support Engicam i.Core(RQS)" |
226 | select BOARD_LATE_INIT | 226 | select BOARD_LATE_INIT |
227 | select MX6QDL | 227 | select MX6QDL |
228 | select OF_CONTROL | 228 | select OF_CONTROL |
229 | select SPL_OF_LIBFDT | 229 | select SPL_OF_LIBFDT |
230 | select DM | 230 | select DM |
231 | select DM_ETH | 231 | select DM_ETH |
232 | select DM_GPIO | 232 | select DM_GPIO |
233 | select DM_I2C | 233 | select DM_I2C |
234 | select DM_MMC | 234 | select DM_MMC |
235 | select DM_THERMAL | 235 | select DM_THERMAL |
236 | select SUPPORT_SPL | 236 | select SUPPORT_SPL |
237 | select SPL_LOAD_FIT | 237 | select SPL_LOAD_FIT |
238 | select SPL_DM if SPL | 238 | select SPL_DM if SPL |
239 | select SPL_OF_CONTROL if SPL | 239 | select SPL_OF_CONTROL if SPL |
240 | select SPL_SEPARATE_BSS if SPL | 240 | select SPL_SEPARATE_BSS if SPL |
241 | select SPL_PINCTRL if SPL | 241 | select SPL_PINCTRL if SPL |
242 | 242 | ||
243 | config TARGET_MX6SABREAUTO | 243 | config TARGET_MX6SABREAUTO |
244 | bool "mx6sabreauto" | 244 | bool "mx6sabreauto" |
245 | select MX6QDL | 245 | select MX6QDL |
246 | select BOARD_LATE_INIT | 246 | select BOARD_LATE_INIT |
247 | select SUPPORT_SPL | 247 | select SUPPORT_SPL |
248 | select DM | 248 | select DM |
249 | select DM_THERMAL | 249 | select DM_THERMAL |
250 | select BOARD_EARLY_INIT_F | 250 | select BOARD_EARLY_INIT_F |
251 | 251 | ||
252 | config TARGET_MX6SABRESD | 252 | config TARGET_MX6SABRESD |
253 | bool "mx6sabresd" | 253 | bool "mx6sabresd" |
254 | select MX6QDL | 254 | select MX6QDL |
255 | select BOARD_LATE_INIT | 255 | select BOARD_LATE_INIT |
256 | select SUPPORT_SPL | 256 | select SUPPORT_SPL |
257 | select DM | 257 | select DM |
258 | select DM_THERMAL | 258 | select DM_THERMAL |
259 | select BOARD_EARLY_INIT_F | 259 | select BOARD_EARLY_INIT_F |
260 | 260 | ||
261 | config TARGET_MX6SLEVK | 261 | config TARGET_MX6SLEVK |
262 | bool "mx6slevk" | 262 | bool "mx6slevk" |
263 | select MX6SL | 263 | select MX6SL |
264 | select SUPPORT_SPL | 264 | select SUPPORT_SPL |
265 | 265 | ||
266 | config TARGET_MX6SLLEVK | 266 | config TARGET_MX6SLLEVK |
267 | bool "mx6sll evk" | 267 | bool "mx6sll evk" |
268 | select BOARD_LATE_INIT | 268 | select BOARD_LATE_INIT |
269 | select MX6SLL | 269 | select MX6SLL |
270 | select DM | 270 | select DM |
271 | select DM_THERMAL | 271 | select DM_THERMAL |
272 | 272 | ||
273 | config TARGET_MX6SXSABRESD | 273 | config TARGET_MX6SXSABRESD |
274 | bool "mx6sxsabresd" | 274 | bool "mx6sxsabresd" |
275 | select BOARD_LATE_INIT | 275 | select BOARD_LATE_INIT |
276 | select MX6SX | 276 | select MX6SX |
277 | select SUPPORT_SPL | 277 | select SUPPORT_SPL |
278 | select DM | 278 | select DM |
279 | select DM_THERMAL | 279 | select DM_THERMAL |
280 | select BOARD_EARLY_INIT_F | 280 | select BOARD_EARLY_INIT_F |
281 | 281 | ||
282 | config TARGET_MX6SXSABREAUTO | 282 | config TARGET_MX6SXSABREAUTO |
283 | bool "mx6sxsabreauto" | 283 | bool "mx6sxsabreauto" |
284 | select BOARD_LATE_INIT | 284 | select BOARD_LATE_INIT |
285 | select MX6SX | 285 | select MX6SX |
286 | select DM | 286 | select DM |
287 | select DM_THERMAL | 287 | select DM_THERMAL |
288 | select BOARD_EARLY_INIT_F | 288 | select BOARD_EARLY_INIT_F |
289 | 289 | ||
290 | config TARGET_MX6UL_9X9_EVK | 290 | config TARGET_MX6UL_9X9_EVK |
291 | bool "mx6ul_9x9_evk" | 291 | bool "mx6ul_9x9_evk" |
292 | select BOARD_LATE_INIT | 292 | select BOARD_LATE_INIT |
293 | select MX6UL | 293 | select MX6UL |
294 | select DM | 294 | select DM |
295 | select DM_THERMAL | 295 | select DM_THERMAL |
296 | select SUPPORT_SPL | 296 | select SUPPORT_SPL |
297 | 297 | ||
298 | config TARGET_MX6UL_14X14_EVK | 298 | config TARGET_MX6UL_14X14_EVK |
299 | select BOARD_LATE_INIT | 299 | select BOARD_LATE_INIT |
300 | bool "mx6ul_14x14_evk" | 300 | bool "mx6ul_14x14_evk" |
301 | select MX6UL | 301 | select MX6UL |
302 | select DM | 302 | select DM |
303 | select DM_THERMAL | 303 | select DM_THERMAL |
304 | select SUPPORT_SPL | 304 | select SUPPORT_SPL |
305 | 305 | ||
306 | config TARGET_MX6UL_ENGICAM | 306 | config TARGET_MX6UL_ENGICAM |
307 | bool "Support Engicam GEAM6UL/Is.IoT" | 307 | bool "Support Engicam GEAM6UL/Is.IoT" |
308 | select BOARD_LATE_INIT | 308 | select BOARD_LATE_INIT |
309 | select MX6UL | 309 | select MX6UL |
310 | select OF_CONTROL | 310 | select OF_CONTROL |
311 | select DM | 311 | select DM |
312 | select DM_ETH | 312 | select DM_ETH |
313 | select DM_GPIO | 313 | select DM_GPIO |
314 | select DM_I2C | 314 | select DM_I2C |
315 | select DM_MMC | 315 | select DM_MMC |
316 | select DM_THERMAL | 316 | select DM_THERMAL |
317 | select SUPPORT_SPL | 317 | select SUPPORT_SPL |
318 | select SPL_DM if SPL | 318 | select SPL_DM if SPL |
319 | select SPL_OF_CONTROL if SPL | 319 | select SPL_OF_CONTROL if SPL |
320 | select SPL_SEPARATE_BSS if SPL | 320 | select SPL_SEPARATE_BSS if SPL |
321 | select SPL_PINCTRL if SPL | 321 | select SPL_PINCTRL if SPL |
322 | 322 | ||
323 | config TARGET_MX6ULL_14X14_EVK | 323 | config TARGET_MX6ULL_14X14_EVK |
324 | bool "Support mx6ull_14x14_evk" | 324 | bool "Support mx6ull_14x14_evk" |
325 | select BOARD_LATE_INIT | 325 | select BOARD_LATE_INIT |
326 | select MX6ULL | 326 | select MX6ULL |
327 | select DM | 327 | select DM |
328 | select DM_THERMAL | 328 | select DM_THERMAL |
329 | 329 | ||
330 | config TARGET_NITROGEN6X | 330 | config TARGET_NITROGEN6X |
331 | bool "nitrogen6x" | 331 | bool "nitrogen6x" |
332 | imply USB_HOST_ETHER | 332 | imply USB_HOST_ETHER |
333 | imply USB_ETHER_ASIX | 333 | imply USB_ETHER_ASIX |
334 | imply USB_ETHER_SMSC95XX | 334 | imply USB_ETHER_SMSC95XX |
335 | imply USB_ETHER_MCS7830 | 335 | imply USB_ETHER_MCS7830 |
336 | 336 | ||
337 | config TARGET_OPOS6ULDEV | 337 | config TARGET_OPOS6ULDEV |
338 | bool "Armadeus OPOS6ULDev board" | 338 | bool "Armadeus OPOS6ULDev board" |
339 | select MX6UL_OPOS6UL | 339 | select MX6UL_OPOS6UL |
340 | 340 | ||
341 | config TARGET_OT1200 | 341 | config TARGET_OT1200 |
342 | bool "Bachmann OT1200" | 342 | bool "Bachmann OT1200" |
343 | select SUPPORT_SPL | 343 | select SUPPORT_SPL |
344 | imply CMD_SATA | 344 | imply CMD_SATA |
345 | 345 | ||
346 | config TARGET_PICO_IMX6UL | 346 | config TARGET_PICO_IMX6UL |
347 | bool "PICO-IMX6UL-EMMC" | 347 | bool "PICO-IMX6UL-EMMC" |
348 | select MX6UL | 348 | select MX6UL |
349 | 349 | ||
350 | config TARGET_LITEBOARD | 350 | config TARGET_LITEBOARD |
351 | bool "Grinn liteBoard (i.MX6UL)" | 351 | bool "Grinn liteBoard (i.MX6UL)" |
352 | select BOARD_LATE_INIT | 352 | select BOARD_LATE_INIT |
353 | select MX6UL_LITESOM | 353 | select MX6UL_LITESOM |
354 | 354 | ||
355 | config TARGET_PLATINUM_PICON | 355 | config TARGET_PLATINUM_PICON |
356 | bool "platinum-picon" | 356 | bool "platinum-picon" |
357 | select SUPPORT_SPL | 357 | select SUPPORT_SPL |
358 | 358 | ||
359 | config TARGET_PLATINUM_TITANIUM | 359 | config TARGET_PLATINUM_TITANIUM |
360 | bool "platinum-titanium" | 360 | bool "platinum-titanium" |
361 | select SUPPORT_SPL | 361 | select SUPPORT_SPL |
362 | 362 | ||
363 | config TARGET_PCM058 | 363 | config TARGET_PCM058 |
364 | bool "Phytec PCM058 i.MX6 Quad" | 364 | bool "Phytec PCM058 i.MX6 Quad" |
365 | select BOARD_LATE_INIT | 365 | select BOARD_LATE_INIT |
366 | select SUPPORT_SPL | 366 | select SUPPORT_SPL |
367 | 367 | ||
368 | config TARGET_PFLA02 | 368 | config TARGET_PFLA02 |
369 | bool "Phytec PFLA02 (PhyFlex) i.MX6 Quad" | 369 | bool "Phytec PFLA02 (PhyFlex) i.MX6 Quad" |
370 | select MX6QDL | 370 | select MX6QDL |
371 | select BOARD_LATE_INIT | 371 | select BOARD_LATE_INIT |
372 | select SUPPORT_SPL | 372 | select SUPPORT_SPL |
373 | 373 | ||
374 | config TARGET_SECOMX6 | 374 | config TARGET_SECOMX6 |
375 | bool "secomx6 boards" | 375 | bool "secomx6 boards" |
376 | 376 | ||
377 | config TARGET_TBS2910 | 377 | config TARGET_TBS2910 |
378 | bool "TBS2910 Matrix ARM mini PC" | 378 | bool "TBS2910 Matrix ARM mini PC" |
379 | 379 | ||
380 | config TARGET_TITANIUM | 380 | config TARGET_TITANIUM |
381 | bool "titanium" | 381 | bool "titanium" |
382 | 382 | ||
383 | config TARGET_TQMA6 | 383 | config TARGET_TQMA6 |
384 | bool "TQ Systems TQMa6 board" | 384 | bool "TQ Systems TQMa6 board" |
385 | select BOARD_LATE_INIT | 385 | select BOARD_LATE_INIT |
386 | 386 | ||
387 | config TARGET_UDOO | 387 | config TARGET_UDOO |
388 | bool "udoo" | 388 | bool "udoo" |
389 | select MX6QDL | 389 | select MX6QDL |
390 | select BOARD_LATE_INIT | 390 | select BOARD_LATE_INIT |
391 | select SUPPORT_SPL | 391 | select SUPPORT_SPL |
392 | 392 | ||
393 | config TARGET_UDOO_NEO | 393 | config TARGET_UDOO_NEO |
394 | bool "UDOO Neo" | 394 | bool "UDOO Neo" |
395 | select BOARD_LATE_INIT | 395 | select BOARD_LATE_INIT |
396 | select SUPPORT_SPL | 396 | select SUPPORT_SPL |
397 | select MX6SX | 397 | select MX6SX |
398 | select DM | 398 | select DM |
399 | select DM_THERMAL | 399 | select DM_THERMAL |
400 | 400 | ||
401 | config TARGET_SAMTEC_VINING_2000 | 401 | config TARGET_SAMTEC_VINING_2000 |
402 | bool "samtec VIN|ING 2000" | 402 | bool "samtec VIN|ING 2000" |
403 | select BOARD_LATE_INIT | 403 | select BOARD_LATE_INIT |
404 | select MX6SX | 404 | select MX6SX |
405 | select DM | 405 | select DM |
406 | select DM_THERMAL | 406 | select DM_THERMAL |
407 | 407 | ||
408 | config TARGET_WANDBOARD | 408 | config TARGET_WANDBOARD |
409 | bool "wandboard" | 409 | bool "wandboard" |
410 | select MX6QDL | 410 | select MX6QDL |
411 | select BOARD_LATE_INIT | 411 | select BOARD_LATE_INIT |
412 | select SUPPORT_SPL | 412 | select SUPPORT_SPL |
413 | 413 | ||
414 | config TARGET_WARP | 414 | config TARGET_WARP |
415 | bool "WaRP" | 415 | bool "WaRP" |
416 | select MX6SL | 416 | select MX6SL |
417 | select BOARD_LATE_INIT | 417 | select BOARD_LATE_INIT |
418 | 418 | ||
419 | config TARGET_XPRESS | 419 | config TARGET_XPRESS |
420 | bool "CCV xPress" | 420 | bool "CCV xPress" |
421 | select BOARD_LATE_INIT | 421 | select BOARD_LATE_INIT |
422 | select MX6UL | 422 | select MX6UL |
423 | select DM | 423 | select DM |
424 | select DM_THERMAL | 424 | select DM_THERMAL |
425 | select SUPPORT_SPL | 425 | select SUPPORT_SPL |
426 | 426 | ||
427 | config TARGET_ZC5202 | 427 | config TARGET_ZC5202 |
428 | bool "zc5202" | 428 | bool "zc5202" |
429 | select BOARD_LATE_INIT | 429 | select BOARD_LATE_INIT |
430 | select SUPPORT_SPL | 430 | select SUPPORT_SPL |
431 | select DM | 431 | select DM |
432 | select DM_THERMAL | 432 | select DM_THERMAL |
433 | 433 | ||
434 | config TARGET_ZC5601 | 434 | config TARGET_ZC5601 |
435 | bool "zc5601" | 435 | bool "zc5601" |
436 | select BOARD_LATE_INIT | 436 | select BOARD_LATE_INIT |
437 | select SUPPORT_SPL | 437 | select SUPPORT_SPL |
438 | select DM | 438 | select DM |
439 | select DM_THERMAL | 439 | select DM_THERMAL |
440 | 440 | ||
441 | endchoice | 441 | endchoice |
442 | 442 | ||
443 | config SYS_SOC | 443 | config SYS_SOC |
444 | default "mx6" | 444 | default "mx6" |
445 | 445 | ||
446 | source "board/ge/bx50v3/Kconfig" | 446 | source "board/ge/bx50v3/Kconfig" |
447 | source "board/advantech/dms-ba16/Kconfig" | 447 | source "board/advantech/dms-ba16/Kconfig" |
448 | source "board/aristainetos/Kconfig" | 448 | source "board/aristainetos/Kconfig" |
449 | source "board/armadeus/opos6uldev/Kconfig" | 449 | source "board/armadeus/opos6uldev/Kconfig" |
450 | source "board/bachmann/ot1200/Kconfig" | 450 | source "board/bachmann/ot1200/Kconfig" |
451 | source "board/barco/platinum/Kconfig" | 451 | source "board/barco/platinum/Kconfig" |
452 | source "board/barco/titanium/Kconfig" | 452 | source "board/barco/titanium/Kconfig" |
453 | source "board/boundary/nitrogen6x/Kconfig" | 453 | source "board/boundary/nitrogen6x/Kconfig" |
454 | source "board/ccv/xpress/Kconfig" | 454 | source "board/ccv/xpress/Kconfig" |
455 | source "board/compulab/cm_fx6/Kconfig" | 455 | source "board/compulab/cm_fx6/Kconfig" |
456 | source "board/congatec/cgtqmx6eval/Kconfig" | 456 | source "board/congatec/cgtqmx6eval/Kconfig" |
457 | source "board/dhelectronics/dh_imx6/Kconfig" | 457 | source "board/dhelectronics/dh_imx6/Kconfig" |
458 | source "board/el/el6x/Kconfig" | 458 | source "board/el/el6x/Kconfig" |
459 | source "board/embest/mx6boards/Kconfig" | 459 | source "board/embest/mx6boards/Kconfig" |
460 | source "board/engicam/imx6q/Kconfig" | 460 | source "board/engicam/imx6q/Kconfig" |
461 | source "board/engicam/imx6ul/Kconfig" | 461 | source "board/engicam/imx6ul/Kconfig" |
462 | source "board/freescale/mx6qarm2/Kconfig" | 462 | source "board/freescale/mx6qarm2/Kconfig" |
463 | source "board/freescale/mx6memcal/Kconfig" | 463 | source "board/freescale/mx6memcal/Kconfig" |
464 | source "board/freescale/mx6sabreauto/Kconfig" | 464 | source "board/freescale/mx6sabreauto/Kconfig" |
465 | source "board/freescale/mx6sabresd/Kconfig" | 465 | source "board/freescale/mx6sabresd/Kconfig" |
466 | source "board/freescale/mx6slevk/Kconfig" | 466 | source "board/freescale/mx6slevk/Kconfig" |
467 | source "board/freescale/mx6sllevk/Kconfig" | 467 | source "board/freescale/mx6sllevk/Kconfig" |
468 | source "board/freescale/mx6sxsabresd/Kconfig" | 468 | source "board/freescale/mx6sxsabresd/Kconfig" |
469 | source "board/freescale/mx6sxsabreauto/Kconfig" | 469 | source "board/freescale/mx6sxsabreauto/Kconfig" |
470 | source "board/freescale/mx6ul_14x14_evk/Kconfig" | 470 | source "board/freescale/mx6ul_14x14_evk/Kconfig" |
471 | source "board/freescale/mx6ullevk/Kconfig" | 471 | source "board/freescale/mx6ullevk/Kconfig" |
472 | source "board/grinn/liteboard/Kconfig" | 472 | source "board/grinn/liteboard/Kconfig" |
473 | source "board/phytec/pcm058/Kconfig" | 473 | source "board/phytec/pcm058/Kconfig" |
474 | source "board/phytec/pfla02/Kconfig" | 474 | source "board/phytec/pfla02/Kconfig" |
475 | source "board/gateworks/gw_ventana/Kconfig" | 475 | source "board/gateworks/gw_ventana/Kconfig" |
476 | source "board/kosagi/novena/Kconfig" | 476 | source "board/kosagi/novena/Kconfig" |
477 | source "board/samtec/vining_2000/Kconfig" | 477 | source "board/samtec/vining_2000/Kconfig" |
478 | source "board/liebherr/display5/Kconfig" | 478 | source "board/liebherr/display5/Kconfig" |
479 | source "board/liebherr/mccmon6/Kconfig" | 479 | source "board/liebherr/mccmon6/Kconfig" |
480 | source "board/logicpd/imx6/Kconfig" | 480 | source "board/logicpd/imx6/Kconfig" |
481 | source "board/seco/Kconfig" | 481 | source "board/seco/Kconfig" |
482 | source "board/solidrun/mx6cuboxi/Kconfig" | 482 | source "board/solidrun/mx6cuboxi/Kconfig" |
483 | source "board/technexion/pico-imx6ul/Kconfig" | 483 | source "board/technexion/pico-imx6ul/Kconfig" |
484 | source "board/tbs/tbs2910/Kconfig" | 484 | source "board/tbs/tbs2910/Kconfig" |
485 | source "board/tqc/tqma6/Kconfig" | 485 | source "board/tqc/tqma6/Kconfig" |
486 | source "board/toradex/apalis_imx6/Kconfig" | 486 | source "board/toradex/apalis_imx6/Kconfig" |
487 | source "board/toradex/colibri_imx6/Kconfig" | 487 | source "board/toradex/colibri_imx6/Kconfig" |
488 | source "board/udoo/Kconfig" | 488 | source "board/udoo/Kconfig" |
489 | source "board/udoo/neo/Kconfig" | 489 | source "board/udoo/neo/Kconfig" |
490 | source "board/wandboard/Kconfig" | 490 | source "board/wandboard/Kconfig" |
491 | source "board/warp/Kconfig" | 491 | source "board/warp/Kconfig" |
492 | 492 | ||
493 | endif | 493 | endif |
494 | 494 |
arch/arm/mach-imx/mx6/ddr.c
1 | /* | 1 | /* |
2 | * Copyright (C) 2014 Gateworks Corporation | 2 | * Copyright (C) 2014 Gateworks Corporation |
3 | * Author: Tim Harvey <tharvey@gateworks.com> | 3 | * Author: Tim Harvey <tharvey@gateworks.com> |
4 | * | 4 | * |
5 | * SPDX-License-Identifier: GPL-2.0+ | 5 | * SPDX-License-Identifier: GPL-2.0+ |
6 | */ | 6 | */ |
7 | 7 | ||
8 | #include <common.h> | 8 | #include <common.h> |
9 | #include <linux/types.h> | 9 | #include <linux/types.h> |
10 | #include <asm/arch/clock.h> | 10 | #include <asm/arch/clock.h> |
11 | #include <asm/arch/mx6-ddr.h> | 11 | #include <asm/arch/mx6-ddr.h> |
12 | #include <asm/arch/sys_proto.h> | 12 | #include <asm/arch/sys_proto.h> |
13 | #include <asm/io.h> | 13 | #include <asm/io.h> |
14 | #include <asm/types.h> | 14 | #include <asm/types.h> |
15 | #include <wait_bit.h> | 15 | #include <wait_bit.h> |
16 | 16 | ||
17 | #if defined(CONFIG_MX6_DDRCAL) | 17 | #if defined(CONFIG_MX6_DDRCAL) |
18 | static void reset_read_data_fifos(void) | 18 | static void reset_read_data_fifos(void) |
19 | { | 19 | { |
20 | struct mmdc_p_regs *mmdc0 = (struct mmdc_p_regs *)MMDC_P0_BASE_ADDR; | 20 | struct mmdc_p_regs *mmdc0 = (struct mmdc_p_regs *)MMDC_P0_BASE_ADDR; |
21 | 21 | ||
22 | /* Reset data FIFOs twice. */ | 22 | /* Reset data FIFOs twice. */ |
23 | setbits_le32(&mmdc0->mpdgctrl0, 1 << 31); | 23 | setbits_le32(&mmdc0->mpdgctrl0, 1 << 31); |
24 | wait_for_bit("MMDC", &mmdc0->mpdgctrl0, 1 << 31, 0, 100, 0); | 24 | wait_for_bit("MMDC", &mmdc0->mpdgctrl0, 1 << 31, 0, 100, 0); |
25 | 25 | ||
26 | setbits_le32(&mmdc0->mpdgctrl0, 1 << 31); | 26 | setbits_le32(&mmdc0->mpdgctrl0, 1 << 31); |
27 | wait_for_bit("MMDC", &mmdc0->mpdgctrl0, 1 << 31, 0, 100, 0); | 27 | wait_for_bit("MMDC", &mmdc0->mpdgctrl0, 1 << 31, 0, 100, 0); |
28 | } | 28 | } |
29 | 29 | ||
30 | static void precharge_all(const bool cs0_enable, const bool cs1_enable) | 30 | static void precharge_all(const bool cs0_enable, const bool cs1_enable) |
31 | { | 31 | { |
32 | struct mmdc_p_regs *mmdc0 = (struct mmdc_p_regs *)MMDC_P0_BASE_ADDR; | 32 | struct mmdc_p_regs *mmdc0 = (struct mmdc_p_regs *)MMDC_P0_BASE_ADDR; |
33 | 33 | ||
34 | /* | 34 | /* |
35 | * Issue the Precharge-All command to the DDR device for both | 35 | * Issue the Precharge-All command to the DDR device for both |
36 | * chip selects. Note, CON_REQ bit should also remain set. If | 36 | * chip selects. Note, CON_REQ bit should also remain set. If |
37 | * only using one chip select, then precharge only the desired | 37 | * only using one chip select, then precharge only the desired |
38 | * chip select. | 38 | * chip select. |
39 | */ | 39 | */ |
40 | if (cs0_enable) { /* CS0 */ | 40 | if (cs0_enable) { /* CS0 */ |
41 | writel(0x04008050, &mmdc0->mdscr); | 41 | writel(0x04008050, &mmdc0->mdscr); |
42 | wait_for_bit("MMDC", &mmdc0->mdscr, 1 << 14, 1, 100, 0); | 42 | wait_for_bit("MMDC", &mmdc0->mdscr, 1 << 14, 1, 100, 0); |
43 | } | 43 | } |
44 | 44 | ||
45 | if (cs1_enable) { /* CS1 */ | 45 | if (cs1_enable) { /* CS1 */ |
46 | writel(0x04008058, &mmdc0->mdscr); | 46 | writel(0x04008058, &mmdc0->mdscr); |
47 | wait_for_bit("MMDC", &mmdc0->mdscr, 1 << 14, 1, 100, 0); | 47 | wait_for_bit("MMDC", &mmdc0->mdscr, 1 << 14, 1, 100, 0); |
48 | } | 48 | } |
49 | } | 49 | } |
50 | 50 | ||
51 | static void force_delay_measurement(int bus_size) | 51 | static void force_delay_measurement(int bus_size) |
52 | { | 52 | { |
53 | struct mmdc_p_regs *mmdc0 = (struct mmdc_p_regs *)MMDC_P0_BASE_ADDR; | 53 | struct mmdc_p_regs *mmdc0 = (struct mmdc_p_regs *)MMDC_P0_BASE_ADDR; |
54 | struct mmdc_p_regs *mmdc1 = (struct mmdc_p_regs *)MMDC_P1_BASE_ADDR; | 54 | struct mmdc_p_regs *mmdc1 = (struct mmdc_p_regs *)MMDC_P1_BASE_ADDR; |
55 | 55 | ||
56 | writel(0x800, &mmdc0->mpmur0); | 56 | writel(0x800, &mmdc0->mpmur0); |
57 | if (bus_size == 0x2) | 57 | if (bus_size == 0x2) |
58 | writel(0x800, &mmdc1->mpmur0); | 58 | writel(0x800, &mmdc1->mpmur0); |
59 | } | 59 | } |
60 | 60 | ||
61 | static void modify_dg_result(u32 *reg_st0, u32 *reg_st1, u32 *reg_ctrl) | 61 | static void modify_dg_result(u32 *reg_st0, u32 *reg_st1, u32 *reg_ctrl) |
62 | { | 62 | { |
63 | u32 dg_tmp_val, dg_dl_abs_offset, dg_hc_del, val_ctrl; | 63 | u32 dg_tmp_val, dg_dl_abs_offset, dg_hc_del, val_ctrl; |
64 | 64 | ||
65 | /* | 65 | /* |
66 | * DQS gating absolute offset should be modified from reflecting | 66 | * DQS gating absolute offset should be modified from reflecting |
67 | * (HW_DG_LOWx + HW_DG_UPx)/2 to reflecting (HW_DG_UPx - 0x80) | 67 | * (HW_DG_LOWx + HW_DG_UPx)/2 to reflecting (HW_DG_UPx - 0x80) |
68 | */ | 68 | */ |
69 | 69 | ||
70 | val_ctrl = readl(reg_ctrl); | 70 | val_ctrl = readl(reg_ctrl); |
71 | val_ctrl &= 0xf0000000; | 71 | val_ctrl &= 0xf0000000; |
72 | 72 | ||
73 | dg_tmp_val = ((readl(reg_st0) & 0x07ff0000) >> 16) - 0xc0; | 73 | dg_tmp_val = ((readl(reg_st0) & 0x07ff0000) >> 16) - 0xc0; |
74 | dg_dl_abs_offset = dg_tmp_val & 0x7f; | 74 | dg_dl_abs_offset = dg_tmp_val & 0x7f; |
75 | dg_hc_del = (dg_tmp_val & 0x780) << 1; | 75 | dg_hc_del = (dg_tmp_val & 0x780) << 1; |
76 | 76 | ||
77 | val_ctrl |= dg_dl_abs_offset + dg_hc_del; | 77 | val_ctrl |= dg_dl_abs_offset + dg_hc_del; |
78 | 78 | ||
79 | dg_tmp_val = ((readl(reg_st1) & 0x07ff0000) >> 16) - 0xc0; | 79 | dg_tmp_val = ((readl(reg_st1) & 0x07ff0000) >> 16) - 0xc0; |
80 | dg_dl_abs_offset = dg_tmp_val & 0x7f; | 80 | dg_dl_abs_offset = dg_tmp_val & 0x7f; |
81 | dg_hc_del = (dg_tmp_val & 0x780) << 1; | 81 | dg_hc_del = (dg_tmp_val & 0x780) << 1; |
82 | 82 | ||
83 | val_ctrl |= (dg_dl_abs_offset + dg_hc_del) << 16; | 83 | val_ctrl |= (dg_dl_abs_offset + dg_hc_del) << 16; |
84 | 84 | ||
85 | writel(val_ctrl, reg_ctrl); | 85 | writel(val_ctrl, reg_ctrl); |
86 | } | 86 | } |
87 | 87 | ||
88 | int mmdc_do_write_level_calibration(struct mx6_ddr_sysinfo const *sysinfo) | 88 | int mmdc_do_write_level_calibration(struct mx6_ddr_sysinfo const *sysinfo) |
89 | { | 89 | { |
90 | struct mmdc_p_regs *mmdc0 = (struct mmdc_p_regs *)MMDC_P0_BASE_ADDR; | 90 | struct mmdc_p_regs *mmdc0 = (struct mmdc_p_regs *)MMDC_P0_BASE_ADDR; |
91 | struct mmdc_p_regs *mmdc1 = (struct mmdc_p_regs *)MMDC_P1_BASE_ADDR; | 91 | struct mmdc_p_regs *mmdc1 = (struct mmdc_p_regs *)MMDC_P1_BASE_ADDR; |
92 | u32 esdmisc_val, zq_val; | 92 | u32 esdmisc_val, zq_val; |
93 | u32 errors = 0; | 93 | u32 errors = 0; |
94 | u32 ldectrl[4] = {0}; | 94 | u32 ldectrl[4] = {0}; |
95 | u32 ddr_mr1 = 0x4; | 95 | u32 ddr_mr1 = 0x4; |
96 | u32 rwalat_max; | 96 | u32 rwalat_max; |
97 | 97 | ||
98 | /* | 98 | /* |
99 | * Stash old values in case calibration fails, | 99 | * Stash old values in case calibration fails, |
100 | * we need to restore them | 100 | * we need to restore them |
101 | */ | 101 | */ |
102 | ldectrl[0] = readl(&mmdc0->mpwldectrl0); | 102 | ldectrl[0] = readl(&mmdc0->mpwldectrl0); |
103 | ldectrl[1] = readl(&mmdc0->mpwldectrl1); | 103 | ldectrl[1] = readl(&mmdc0->mpwldectrl1); |
104 | if (sysinfo->dsize == 2) { | 104 | if (sysinfo->dsize == 2) { |
105 | ldectrl[2] = readl(&mmdc1->mpwldectrl0); | 105 | ldectrl[2] = readl(&mmdc1->mpwldectrl0); |
106 | ldectrl[3] = readl(&mmdc1->mpwldectrl1); | 106 | ldectrl[3] = readl(&mmdc1->mpwldectrl1); |
107 | } | 107 | } |
108 | 108 | ||
109 | /* disable DDR logic power down timer */ | 109 | /* disable DDR logic power down timer */ |
110 | clrbits_le32(&mmdc0->mdpdc, 0xff00); | 110 | clrbits_le32(&mmdc0->mdpdc, 0xff00); |
111 | 111 | ||
112 | /* disable Adopt power down timer */ | 112 | /* disable Adopt power down timer */ |
113 | setbits_le32(&mmdc0->mapsr, 0x1); | 113 | setbits_le32(&mmdc0->mapsr, 0x1); |
114 | 114 | ||
115 | debug("Starting write leveling calibration.\n"); | 115 | debug("Starting write leveling calibration.\n"); |
116 | 116 | ||
117 | /* | 117 | /* |
118 | * 2. disable auto refresh and ZQ calibration | 118 | * 2. disable auto refresh and ZQ calibration |
119 | * before proceeding with Write Leveling calibration | 119 | * before proceeding with Write Leveling calibration |
120 | */ | 120 | */ |
121 | esdmisc_val = readl(&mmdc0->mdref); | 121 | esdmisc_val = readl(&mmdc0->mdref); |
122 | writel(0x0000C000, &mmdc0->mdref); | 122 | writel(0x0000C000, &mmdc0->mdref); |
123 | zq_val = readl(&mmdc0->mpzqhwctrl); | 123 | zq_val = readl(&mmdc0->mpzqhwctrl); |
124 | writel(zq_val & ~0x3, &mmdc0->mpzqhwctrl); | 124 | writel(zq_val & ~0x3, &mmdc0->mpzqhwctrl); |
125 | 125 | ||
126 | /* 3. increase walat and ralat to maximum */ | 126 | /* 3. increase walat and ralat to maximum */ |
127 | rwalat_max = (1 << 6) | (1 << 7) | (1 << 8) | (1 << 16) | (1 << 17); | 127 | rwalat_max = (1 << 6) | (1 << 7) | (1 << 8) | (1 << 16) | (1 << 17); |
128 | setbits_le32(&mmdc0->mdmisc, rwalat_max); | 128 | setbits_le32(&mmdc0->mdmisc, rwalat_max); |
129 | if (sysinfo->dsize == 2) | 129 | if (sysinfo->dsize == 2) |
130 | setbits_le32(&mmdc1->mdmisc, rwalat_max); | 130 | setbits_le32(&mmdc1->mdmisc, rwalat_max); |
131 | /* | 131 | /* |
132 | * 4 & 5. Configure the external DDR device to enter write-leveling | 132 | * 4 & 5. Configure the external DDR device to enter write-leveling |
133 | * mode through Load Mode Register command. | 133 | * mode through Load Mode Register command. |
134 | * Register setting: | 134 | * Register setting: |
135 | * Bits[31:16] MR1 value (0x0080 write leveling enable) | 135 | * Bits[31:16] MR1 value (0x0080 write leveling enable) |
136 | * Bit[9] set WL_EN to enable MMDC DQS output | 136 | * Bit[9] set WL_EN to enable MMDC DQS output |
137 | * Bits[6:4] set CMD bits for Load Mode Register programming | 137 | * Bits[6:4] set CMD bits for Load Mode Register programming |
138 | * Bits[2:0] set CMD_BA to 0x1 for DDR MR1 programming | 138 | * Bits[2:0] set CMD_BA to 0x1 for DDR MR1 programming |
139 | */ | 139 | */ |
140 | writel(0x00808231, &mmdc0->mdscr); | 140 | writel(0x00808231, &mmdc0->mdscr); |
141 | 141 | ||
142 | /* 6. Activate automatic calibration by setting MPWLGCR[HW_WL_EN] */ | 142 | /* 6. Activate automatic calibration by setting MPWLGCR[HW_WL_EN] */ |
143 | writel(0x00000001, &mmdc0->mpwlgcr); | 143 | writel(0x00000001, &mmdc0->mpwlgcr); |
144 | 144 | ||
145 | /* | 145 | /* |
146 | * 7. Upon completion of this process the MMDC de-asserts | 146 | * 7. Upon completion of this process the MMDC de-asserts |
147 | * the MPWLGCR[HW_WL_EN] | 147 | * the MPWLGCR[HW_WL_EN] |
148 | */ | 148 | */ |
149 | wait_for_bit("MMDC", &mmdc0->mpwlgcr, 1 << 0, 0, 100, 0); | 149 | wait_for_bit("MMDC", &mmdc0->mpwlgcr, 1 << 0, 0, 100, 0); |
150 | 150 | ||
151 | /* | 151 | /* |
152 | * 8. check for any errors: check both PHYs for x64 configuration, | 152 | * 8. check for any errors: check both PHYs for x64 configuration, |
153 | * if x32, check only PHY0 | 153 | * if x32, check only PHY0 |
154 | */ | 154 | */ |
155 | if (readl(&mmdc0->mpwlgcr) & 0x00000F00) | 155 | if (readl(&mmdc0->mpwlgcr) & 0x00000F00) |
156 | errors |= 1; | 156 | errors |= 1; |
157 | if (sysinfo->dsize == 2) | 157 | if (sysinfo->dsize == 2) |
158 | if (readl(&mmdc1->mpwlgcr) & 0x00000F00) | 158 | if (readl(&mmdc1->mpwlgcr) & 0x00000F00) |
159 | errors |= 2; | 159 | errors |= 2; |
160 | 160 | ||
161 | debug("Ending write leveling calibration. Error mask: 0x%x\n", errors); | 161 | debug("Ending write leveling calibration. Error mask: 0x%x\n", errors); |
162 | 162 | ||
163 | /* check to see if cal failed */ | 163 | /* check to see if cal failed */ |
164 | if ((readl(&mmdc0->mpwldectrl0) == 0x001F001F) && | 164 | if ((readl(&mmdc0->mpwldectrl0) == 0x001F001F) && |
165 | (readl(&mmdc0->mpwldectrl1) == 0x001F001F) && | 165 | (readl(&mmdc0->mpwldectrl1) == 0x001F001F) && |
166 | ((sysinfo->dsize < 2) || | 166 | ((sysinfo->dsize < 2) || |
167 | ((readl(&mmdc1->mpwldectrl0) == 0x001F001F) && | 167 | ((readl(&mmdc1->mpwldectrl0) == 0x001F001F) && |
168 | (readl(&mmdc1->mpwldectrl1) == 0x001F001F)))) { | 168 | (readl(&mmdc1->mpwldectrl1) == 0x001F001F)))) { |
169 | debug("Cal seems to have soft-failed due to memory not supporting write leveling on all channels. Restoring original write leveling values.\n"); | 169 | debug("Cal seems to have soft-failed due to memory not supporting write leveling on all channels. Restoring original write leveling values.\n"); |
170 | writel(ldectrl[0], &mmdc0->mpwldectrl0); | 170 | writel(ldectrl[0], &mmdc0->mpwldectrl0); |
171 | writel(ldectrl[1], &mmdc0->mpwldectrl1); | 171 | writel(ldectrl[1], &mmdc0->mpwldectrl1); |
172 | if (sysinfo->dsize == 2) { | 172 | if (sysinfo->dsize == 2) { |
173 | writel(ldectrl[2], &mmdc1->mpwldectrl0); | 173 | writel(ldectrl[2], &mmdc1->mpwldectrl0); |
174 | writel(ldectrl[3], &mmdc1->mpwldectrl1); | 174 | writel(ldectrl[3], &mmdc1->mpwldectrl1); |
175 | } | 175 | } |
176 | errors |= 4; | 176 | errors |= 4; |
177 | } | 177 | } |
178 | 178 | ||
179 | /* | 179 | /* |
180 | * User should issue MRS command to exit write leveling mode | 180 | * User should issue MRS command to exit write leveling mode |
181 | * through Load Mode Register command | 181 | * through Load Mode Register command |
182 | * Register setting: | 182 | * Register setting: |
183 | * Bits[31:16] MR1 value "ddr_mr1" value from initialization | 183 | * Bits[31:16] MR1 value "ddr_mr1" value from initialization |
184 | * Bit[9] clear WL_EN to disable MMDC DQS output | 184 | * Bit[9] clear WL_EN to disable MMDC DQS output |
185 | * Bits[6:4] set CMD bits for Load Mode Register programming | 185 | * Bits[6:4] set CMD bits for Load Mode Register programming |
186 | * Bits[2:0] set CMD_BA to 0x1 for DDR MR1 programming | 186 | * Bits[2:0] set CMD_BA to 0x1 for DDR MR1 programming |
187 | */ | 187 | */ |
188 | writel((ddr_mr1 << 16) + 0x8031, &mmdc0->mdscr); | 188 | writel((ddr_mr1 << 16) + 0x8031, &mmdc0->mdscr); |
189 | 189 | ||
190 | /* re-enable auto refresh and zq cal */ | 190 | /* re-enable auto refresh and zq cal */ |
191 | writel(esdmisc_val, &mmdc0->mdref); | 191 | writel(esdmisc_val, &mmdc0->mdref); |
192 | writel(zq_val, &mmdc0->mpzqhwctrl); | 192 | writel(zq_val, &mmdc0->mpzqhwctrl); |
193 | 193 | ||
194 | debug("\tMMDC_MPWLDECTRL0 after write level cal: 0x%08X\n", | 194 | debug("\tMMDC_MPWLDECTRL0 after write level cal: 0x%08X\n", |
195 | readl(&mmdc0->mpwldectrl0)); | 195 | readl(&mmdc0->mpwldectrl0)); |
196 | debug("\tMMDC_MPWLDECTRL1 after write level cal: 0x%08X\n", | 196 | debug("\tMMDC_MPWLDECTRL1 after write level cal: 0x%08X\n", |
197 | readl(&mmdc0->mpwldectrl1)); | 197 | readl(&mmdc0->mpwldectrl1)); |
198 | if (sysinfo->dsize == 2) { | 198 | if (sysinfo->dsize == 2) { |
199 | debug("\tMMDC_MPWLDECTRL0 after write level cal: 0x%08X\n", | 199 | debug("\tMMDC_MPWLDECTRL0 after write level cal: 0x%08X\n", |
200 | readl(&mmdc1->mpwldectrl0)); | 200 | readl(&mmdc1->mpwldectrl0)); |
201 | debug("\tMMDC_MPWLDECTRL1 after write level cal: 0x%08X\n", | 201 | debug("\tMMDC_MPWLDECTRL1 after write level cal: 0x%08X\n", |
202 | readl(&mmdc1->mpwldectrl1)); | 202 | readl(&mmdc1->mpwldectrl1)); |
203 | } | 203 | } |
204 | 204 | ||
205 | /* We must force a readback of these values, to get them to stick */ | 205 | /* We must force a readback of these values, to get them to stick */ |
206 | readl(&mmdc0->mpwldectrl0); | 206 | readl(&mmdc0->mpwldectrl0); |
207 | readl(&mmdc0->mpwldectrl1); | 207 | readl(&mmdc0->mpwldectrl1); |
208 | if (sysinfo->dsize == 2) { | 208 | if (sysinfo->dsize == 2) { |
209 | readl(&mmdc1->mpwldectrl0); | 209 | readl(&mmdc1->mpwldectrl0); |
210 | readl(&mmdc1->mpwldectrl1); | 210 | readl(&mmdc1->mpwldectrl1); |
211 | } | 211 | } |
212 | 212 | ||
213 | /* enable DDR logic power down timer: */ | 213 | /* enable DDR logic power down timer: */ |
214 | setbits_le32(&mmdc0->mdpdc, 0x00005500); | 214 | setbits_le32(&mmdc0->mdpdc, 0x00005500); |
215 | 215 | ||
216 | /* Enable Adopt power down timer: */ | 216 | /* Enable Adopt power down timer: */ |
217 | clrbits_le32(&mmdc0->mapsr, 0x1); | 217 | clrbits_le32(&mmdc0->mapsr, 0x1); |
218 | 218 | ||
219 | /* Clear CON_REQ */ | 219 | /* Clear CON_REQ */ |
220 | writel(0, &mmdc0->mdscr); | 220 | writel(0, &mmdc0->mdscr); |
221 | 221 | ||
222 | return errors; | 222 | return errors; |
223 | } | 223 | } |
224 | 224 | ||
225 | int mmdc_do_dqs_calibration(struct mx6_ddr_sysinfo const *sysinfo) | 225 | int mmdc_do_dqs_calibration(struct mx6_ddr_sysinfo const *sysinfo) |
226 | { | 226 | { |
227 | struct mmdc_p_regs *mmdc0 = (struct mmdc_p_regs *)MMDC_P0_BASE_ADDR; | 227 | struct mmdc_p_regs *mmdc0 = (struct mmdc_p_regs *)MMDC_P0_BASE_ADDR; |
228 | struct mmdc_p_regs *mmdc1 = (struct mmdc_p_regs *)MMDC_P1_BASE_ADDR; | 228 | struct mmdc_p_regs *mmdc1 = (struct mmdc_p_regs *)MMDC_P1_BASE_ADDR; |
229 | struct mx6dq_iomux_ddr_regs *mx6_ddr_iomux = | 229 | struct mx6dq_iomux_ddr_regs *mx6_ddr_iomux = |
230 | (struct mx6dq_iomux_ddr_regs *)MX6DQ_IOM_DDR_BASE; | 230 | (struct mx6dq_iomux_ddr_regs *)MX6DQ_IOM_DDR_BASE; |
231 | bool cs0_enable; | 231 | bool cs0_enable; |
232 | bool cs1_enable; | 232 | bool cs1_enable; |
233 | bool cs0_enable_initial; | 233 | bool cs0_enable_initial; |
234 | bool cs1_enable_initial; | 234 | bool cs1_enable_initial; |
235 | u32 esdmisc_val; | 235 | u32 esdmisc_val; |
236 | u32 temp_ref; | 236 | u32 temp_ref; |
237 | u32 pddword = 0x00ffff00; /* best so far, place into MPPDCMPR1 */ | 237 | u32 pddword = 0x00ffff00; /* best so far, place into MPPDCMPR1 */ |
238 | u32 errors = 0; | 238 | u32 errors = 0; |
239 | u32 initdelay = 0x40404040; | 239 | u32 initdelay = 0x40404040; |
240 | 240 | ||
241 | /* check to see which chip selects are enabled */ | 241 | /* check to see which chip selects are enabled */ |
242 | cs0_enable_initial = readl(&mmdc0->mdctl) & 0x80000000; | 242 | cs0_enable_initial = readl(&mmdc0->mdctl) & 0x80000000; |
243 | cs1_enable_initial = readl(&mmdc0->mdctl) & 0x40000000; | 243 | cs1_enable_initial = readl(&mmdc0->mdctl) & 0x40000000; |
244 | 244 | ||
245 | /* disable DDR logic power down timer: */ | 245 | /* disable DDR logic power down timer: */ |
246 | clrbits_le32(&mmdc0->mdpdc, 0xff00); | 246 | clrbits_le32(&mmdc0->mdpdc, 0xff00); |
247 | 247 | ||
248 | /* disable Adopt power down timer: */ | 248 | /* disable Adopt power down timer: */ |
249 | setbits_le32(&mmdc0->mapsr, 0x1); | 249 | setbits_le32(&mmdc0->mapsr, 0x1); |
250 | 250 | ||
251 | /* set DQS pull ups */ | 251 | /* set DQS pull ups */ |
252 | setbits_le32(&mx6_ddr_iomux->dram_sdqs0, 0x7000); | 252 | setbits_le32(&mx6_ddr_iomux->dram_sdqs0, 0x7000); |
253 | setbits_le32(&mx6_ddr_iomux->dram_sdqs1, 0x7000); | 253 | setbits_le32(&mx6_ddr_iomux->dram_sdqs1, 0x7000); |
254 | setbits_le32(&mx6_ddr_iomux->dram_sdqs2, 0x7000); | 254 | setbits_le32(&mx6_ddr_iomux->dram_sdqs2, 0x7000); |
255 | setbits_le32(&mx6_ddr_iomux->dram_sdqs3, 0x7000); | 255 | setbits_le32(&mx6_ddr_iomux->dram_sdqs3, 0x7000); |
256 | setbits_le32(&mx6_ddr_iomux->dram_sdqs4, 0x7000); | 256 | setbits_le32(&mx6_ddr_iomux->dram_sdqs4, 0x7000); |
257 | setbits_le32(&mx6_ddr_iomux->dram_sdqs5, 0x7000); | 257 | setbits_le32(&mx6_ddr_iomux->dram_sdqs5, 0x7000); |
258 | setbits_le32(&mx6_ddr_iomux->dram_sdqs6, 0x7000); | 258 | setbits_le32(&mx6_ddr_iomux->dram_sdqs6, 0x7000); |
259 | setbits_le32(&mx6_ddr_iomux->dram_sdqs7, 0x7000); | 259 | setbits_le32(&mx6_ddr_iomux->dram_sdqs7, 0x7000); |
260 | 260 | ||
261 | /* Save old RALAT and WALAT values */ | 261 | /* Save old RALAT and WALAT values */ |
262 | esdmisc_val = readl(&mmdc0->mdmisc); | 262 | esdmisc_val = readl(&mmdc0->mdmisc); |
263 | 263 | ||
264 | setbits_le32(&mmdc0->mdmisc, | 264 | setbits_le32(&mmdc0->mdmisc, |
265 | (1 << 6) | (1 << 7) | (1 << 8) | (1 << 16) | (1 << 17)); | 265 | (1 << 6) | (1 << 7) | (1 << 8) | (1 << 16) | (1 << 17)); |
266 | 266 | ||
267 | /* Disable auto refresh before proceeding with calibration */ | 267 | /* Disable auto refresh before proceeding with calibration */ |
268 | temp_ref = readl(&mmdc0->mdref); | 268 | temp_ref = readl(&mmdc0->mdref); |
269 | writel(0x0000c000, &mmdc0->mdref); | 269 | writel(0x0000c000, &mmdc0->mdref); |
270 | 270 | ||
271 | /* | 271 | /* |
272 | * Per the ref manual, issue one refresh cycle MDSCR[CMD]= 0x2, | 272 | * Per the ref manual, issue one refresh cycle MDSCR[CMD]= 0x2, |
273 | * this also sets the CON_REQ bit. | 273 | * this also sets the CON_REQ bit. |
274 | */ | 274 | */ |
275 | if (cs0_enable_initial) | 275 | if (cs0_enable_initial) |
276 | writel(0x00008020, &mmdc0->mdscr); | 276 | writel(0x00008020, &mmdc0->mdscr); |
277 | if (cs1_enable_initial) | 277 | if (cs1_enable_initial) |
278 | writel(0x00008028, &mmdc0->mdscr); | 278 | writel(0x00008028, &mmdc0->mdscr); |
279 | 279 | ||
280 | /* poll to make sure the con_ack bit was asserted */ | 280 | /* poll to make sure the con_ack bit was asserted */ |
281 | wait_for_bit("MMDC", &mmdc0->mdscr, 1 << 14, 1, 100, 0); | 281 | wait_for_bit("MMDC", &mmdc0->mdscr, 1 << 14, 1, 100, 0); |
282 | 282 | ||
283 | /* | 283 | /* |
284 | * Check MDMISC register CALIB_PER_CS to see which CS calibration | 284 | * Check MDMISC register CALIB_PER_CS to see which CS calibration |
285 | * is targeted to (under normal cases, it should be cleared | 285 | * is targeted to (under normal cases, it should be cleared |
286 | * as this is the default value, indicating calibration is directed | 286 | * as this is the default value, indicating calibration is directed |
287 | * to CS0). | 287 | * to CS0). |
288 | * Disable the other chip select not being target for calibration | 288 | * Disable the other chip select not being target for calibration |
289 | * to avoid any potential issues. This will get re-enabled at end | 289 | * to avoid any potential issues. This will get re-enabled at end |
290 | * of calibration. | 290 | * of calibration. |
291 | */ | 291 | */ |
292 | if ((readl(&mmdc0->mdmisc) & 0x00100000) == 0) | 292 | if ((readl(&mmdc0->mdmisc) & 0x00100000) == 0) |
293 | clrbits_le32(&mmdc0->mdctl, 1 << 30); /* clear SDE_1 */ | 293 | clrbits_le32(&mmdc0->mdctl, 1 << 30); /* clear SDE_1 */ |
294 | else | 294 | else |
295 | clrbits_le32(&mmdc0->mdctl, 1 << 31); /* clear SDE_0 */ | 295 | clrbits_le32(&mmdc0->mdctl, 1 << 31); /* clear SDE_0 */ |
296 | 296 | ||
297 | /* | 297 | /* |
298 | * Check to see which chip selects are now enabled for | 298 | * Check to see which chip selects are now enabled for |
299 | * the remainder of the calibration. | 299 | * the remainder of the calibration. |
300 | */ | 300 | */ |
301 | cs0_enable = readl(&mmdc0->mdctl) & 0x80000000; | 301 | cs0_enable = readl(&mmdc0->mdctl) & 0x80000000; |
302 | cs1_enable = readl(&mmdc0->mdctl) & 0x40000000; | 302 | cs1_enable = readl(&mmdc0->mdctl) & 0x40000000; |
303 | 303 | ||
304 | precharge_all(cs0_enable, cs1_enable); | 304 | precharge_all(cs0_enable, cs1_enable); |
305 | 305 | ||
306 | /* Write the pre-defined value into MPPDCMPR1 */ | 306 | /* Write the pre-defined value into MPPDCMPR1 */ |
307 | writel(pddword, &mmdc0->mppdcmpr1); | 307 | writel(pddword, &mmdc0->mppdcmpr1); |
308 | 308 | ||
309 | /* | 309 | /* |
310 | * Issue a write access to the external DDR device by setting | 310 | * Issue a write access to the external DDR device by setting |
311 | * the bit SW_DUMMY_WR (bit 0) in the MPSWDAR0 and then poll | 311 | * the bit SW_DUMMY_WR (bit 0) in the MPSWDAR0 and then poll |
312 | * this bit until it clears to indicate completion of the write access. | 312 | * this bit until it clears to indicate completion of the write access. |
313 | */ | 313 | */ |
314 | setbits_le32(&mmdc0->mpswdar0, 1); | 314 | setbits_le32(&mmdc0->mpswdar0, 1); |
315 | wait_for_bit("MMDC", &mmdc0->mpswdar0, 1 << 0, 0, 100, 0); | 315 | wait_for_bit("MMDC", &mmdc0->mpswdar0, 1 << 0, 0, 100, 0); |
316 | 316 | ||
317 | /* Set the RD_DL_ABS# bits to their default values | 317 | /* Set the RD_DL_ABS# bits to their default values |
318 | * (will be calibrated later in the read delay-line calibration). | 318 | * (will be calibrated later in the read delay-line calibration). |
319 | * Both PHYs for x64 configuration, if x32, do only PHY0. | 319 | * Both PHYs for x64 configuration, if x32, do only PHY0. |
320 | */ | 320 | */ |
321 | writel(initdelay, &mmdc0->mprddlctl); | 321 | writel(initdelay, &mmdc0->mprddlctl); |
322 | if (sysinfo->dsize == 0x2) | 322 | if (sysinfo->dsize == 0x2) |
323 | writel(initdelay, &mmdc1->mprddlctl); | 323 | writel(initdelay, &mmdc1->mprddlctl); |
324 | 324 | ||
325 | /* Force a measurment, for previous delay setup to take effect. */ | 325 | /* Force a measurment, for previous delay setup to take effect. */ |
326 | force_delay_measurement(sysinfo->dsize); | 326 | force_delay_measurement(sysinfo->dsize); |
327 | 327 | ||
328 | /* | 328 | /* |
329 | * *************************** | 329 | * *************************** |
330 | * Read DQS Gating calibration | 330 | * Read DQS Gating calibration |
331 | * *************************** | 331 | * *************************** |
332 | */ | 332 | */ |
333 | debug("Starting Read DQS Gating calibration.\n"); | 333 | debug("Starting Read DQS Gating calibration.\n"); |
334 | 334 | ||
335 | /* | 335 | /* |
336 | * Reset the read data FIFOs (two resets); only need to issue reset | 336 | * Reset the read data FIFOs (two resets); only need to issue reset |
337 | * to PHY0 since in x64 mode, the reset will also go to PHY1. | 337 | * to PHY0 since in x64 mode, the reset will also go to PHY1. |
338 | */ | 338 | */ |
339 | reset_read_data_fifos(); | 339 | reset_read_data_fifos(); |
340 | 340 | ||
341 | /* | 341 | /* |
342 | * Start the automatic read DQS gating calibration process by | 342 | * Start the automatic read DQS gating calibration process by |
343 | * asserting MPDGCTRL0[HW_DG_EN] and MPDGCTRL0[DG_CMP_CYC] | 343 | * asserting MPDGCTRL0[HW_DG_EN] and MPDGCTRL0[DG_CMP_CYC] |
344 | * and then poll MPDGCTRL0[HW_DG_EN]] until this bit clears | 344 | * and then poll MPDGCTRL0[HW_DG_EN]] until this bit clears |
345 | * to indicate completion. | 345 | * to indicate completion. |
346 | * Also, ensure that MPDGCTRL0[HW_DG_ERR] is clear to indicate | 346 | * Also, ensure that MPDGCTRL0[HW_DG_ERR] is clear to indicate |
347 | * no errors were seen during calibration. | 347 | * no errors were seen during calibration. |
348 | */ | 348 | */ |
349 | 349 | ||
350 | /* | 350 | /* |
351 | * Set bit 30: chooses option to wait 32 cycles instead of | 351 | * Set bit 30: chooses option to wait 32 cycles instead of |
352 | * 16 before comparing read data. | 352 | * 16 before comparing read data. |
353 | */ | 353 | */ |
354 | setbits_le32(&mmdc0->mpdgctrl0, 1 << 30); | 354 | setbits_le32(&mmdc0->mpdgctrl0, 1 << 30); |
355 | if (sysinfo->dsize == 2) | 355 | if (sysinfo->dsize == 2) |
356 | setbits_le32(&mmdc1->mpdgctrl0, 1 << 30); | 356 | setbits_le32(&mmdc1->mpdgctrl0, 1 << 30); |
357 | 357 | ||
358 | /* Set bit 28 to start automatic read DQS gating calibration */ | 358 | /* Set bit 28 to start automatic read DQS gating calibration */ |
359 | setbits_le32(&mmdc0->mpdgctrl0, 5 << 28); | 359 | setbits_le32(&mmdc0->mpdgctrl0, 5 << 28); |
360 | 360 | ||
361 | /* Poll for completion. MPDGCTRL0[HW_DG_EN] should be 0 */ | 361 | /* Poll for completion. MPDGCTRL0[HW_DG_EN] should be 0 */ |
362 | wait_for_bit("MMDC", &mmdc0->mpdgctrl0, 1 << 28, 0, 100, 0); | 362 | wait_for_bit("MMDC", &mmdc0->mpdgctrl0, 1 << 28, 0, 100, 0); |
363 | 363 | ||
364 | /* | 364 | /* |
365 | * Check to see if any errors were encountered during calibration | 365 | * Check to see if any errors were encountered during calibration |
366 | * (check MPDGCTRL0[HW_DG_ERR]). | 366 | * (check MPDGCTRL0[HW_DG_ERR]). |
367 | * Check both PHYs for x64 configuration, if x32, check only PHY0. | 367 | * Check both PHYs for x64 configuration, if x32, check only PHY0. |
368 | */ | 368 | */ |
369 | if (readl(&mmdc0->mpdgctrl0) & 0x00001000) | 369 | if (readl(&mmdc0->mpdgctrl0) & 0x00001000) |
370 | errors |= 1; | 370 | errors |= 1; |
371 | 371 | ||
372 | if ((sysinfo->dsize == 0x2) && (readl(&mmdc1->mpdgctrl0) & 0x00001000)) | 372 | if ((sysinfo->dsize == 0x2) && (readl(&mmdc1->mpdgctrl0) & 0x00001000)) |
373 | errors |= 2; | 373 | errors |= 2; |
374 | 374 | ||
375 | /* now disable mpdgctrl0[DG_CMP_CYC] */ | 375 | /* now disable mpdgctrl0[DG_CMP_CYC] */ |
376 | clrbits_le32(&mmdc0->mpdgctrl0, 1 << 30); | 376 | clrbits_le32(&mmdc0->mpdgctrl0, 1 << 30); |
377 | if (sysinfo->dsize == 2) | 377 | if (sysinfo->dsize == 2) |
378 | clrbits_le32(&mmdc1->mpdgctrl0, 1 << 30); | 378 | clrbits_le32(&mmdc1->mpdgctrl0, 1 << 30); |
379 | 379 | ||
380 | /* | 380 | /* |
381 | * DQS gating absolute offset should be modified from | 381 | * DQS gating absolute offset should be modified from |
382 | * reflecting (HW_DG_LOWx + HW_DG_UPx)/2 to | 382 | * reflecting (HW_DG_LOWx + HW_DG_UPx)/2 to |
383 | * reflecting (HW_DG_UPx - 0x80) | 383 | * reflecting (HW_DG_UPx - 0x80) |
384 | */ | 384 | */ |
385 | modify_dg_result(&mmdc0->mpdghwst0, &mmdc0->mpdghwst1, | 385 | modify_dg_result(&mmdc0->mpdghwst0, &mmdc0->mpdghwst1, |
386 | &mmdc0->mpdgctrl0); | 386 | &mmdc0->mpdgctrl0); |
387 | modify_dg_result(&mmdc0->mpdghwst2, &mmdc0->mpdghwst3, | 387 | modify_dg_result(&mmdc0->mpdghwst2, &mmdc0->mpdghwst3, |
388 | &mmdc0->mpdgctrl1); | 388 | &mmdc0->mpdgctrl1); |
389 | if (sysinfo->dsize == 0x2) { | 389 | if (sysinfo->dsize == 0x2) { |
390 | modify_dg_result(&mmdc1->mpdghwst0, &mmdc1->mpdghwst1, | 390 | modify_dg_result(&mmdc1->mpdghwst0, &mmdc1->mpdghwst1, |
391 | &mmdc1->mpdgctrl0); | 391 | &mmdc1->mpdgctrl0); |
392 | modify_dg_result(&mmdc1->mpdghwst2, &mmdc1->mpdghwst3, | 392 | modify_dg_result(&mmdc1->mpdghwst2, &mmdc1->mpdghwst3, |
393 | &mmdc1->mpdgctrl1); | 393 | &mmdc1->mpdgctrl1); |
394 | } | 394 | } |
395 | debug("Ending Read DQS Gating calibration. Error mask: 0x%x\n", errors); | 395 | debug("Ending Read DQS Gating calibration. Error mask: 0x%x\n", errors); |
396 | 396 | ||
397 | /* | 397 | /* |
398 | * ********************** | 398 | * ********************** |
399 | * Read Delay calibration | 399 | * Read Delay calibration |
400 | * ********************** | 400 | * ********************** |
401 | */ | 401 | */ |
402 | debug("Starting Read Delay calibration.\n"); | 402 | debug("Starting Read Delay calibration.\n"); |
403 | 403 | ||
404 | reset_read_data_fifos(); | 404 | reset_read_data_fifos(); |
405 | 405 | ||
406 | /* | 406 | /* |
407 | * 4. Issue the Precharge-All command to the DDR device for both | 407 | * 4. Issue the Precharge-All command to the DDR device for both |
408 | * chip selects. If only using one chip select, then precharge | 408 | * chip selects. If only using one chip select, then precharge |
409 | * only the desired chip select. | 409 | * only the desired chip select. |
410 | */ | 410 | */ |
411 | precharge_all(cs0_enable, cs1_enable); | 411 | precharge_all(cs0_enable, cs1_enable); |
412 | 412 | ||
413 | /* | 413 | /* |
414 | * 9. Read delay-line calibration | 414 | * 9. Read delay-line calibration |
415 | * Start the automatic read calibration process by asserting | 415 | * Start the automatic read calibration process by asserting |
416 | * MPRDDLHWCTL[HW_RD_DL_EN]. | 416 | * MPRDDLHWCTL[HW_RD_DL_EN]. |
417 | */ | 417 | */ |
418 | writel(0x00000030, &mmdc0->mprddlhwctl); | 418 | writel(0x00000030, &mmdc0->mprddlhwctl); |
419 | 419 | ||
420 | /* | 420 | /* |
421 | * 10. poll for completion | 421 | * 10. poll for completion |
422 | * MMDC indicates that the write data calibration had finished by | 422 | * MMDC indicates that the write data calibration had finished by |
423 | * setting MPRDDLHWCTL[HW_RD_DL_EN] = 0. Also, ensure that | 423 | * setting MPRDDLHWCTL[HW_RD_DL_EN] = 0. Also, ensure that |
424 | * no error bits were set. | 424 | * no error bits were set. |
425 | */ | 425 | */ |
426 | wait_for_bit("MMDC", &mmdc0->mprddlhwctl, 1 << 4, 0, 100, 0); | 426 | wait_for_bit("MMDC", &mmdc0->mprddlhwctl, 1 << 4, 0, 100, 0); |
427 | 427 | ||
428 | /* check both PHYs for x64 configuration, if x32, check only PHY0 */ | 428 | /* check both PHYs for x64 configuration, if x32, check only PHY0 */ |
429 | if (readl(&mmdc0->mprddlhwctl) & 0x0000000f) | 429 | if (readl(&mmdc0->mprddlhwctl) & 0x0000000f) |
430 | errors |= 4; | 430 | errors |= 4; |
431 | 431 | ||
432 | if ((sysinfo->dsize == 0x2) && | 432 | if ((sysinfo->dsize == 0x2) && |
433 | (readl(&mmdc1->mprddlhwctl) & 0x0000000f)) | 433 | (readl(&mmdc1->mprddlhwctl) & 0x0000000f)) |
434 | errors |= 8; | 434 | errors |= 8; |
435 | 435 | ||
436 | debug("Ending Read Delay calibration. Error mask: 0x%x\n", errors); | 436 | debug("Ending Read Delay calibration. Error mask: 0x%x\n", errors); |
437 | 437 | ||
438 | /* | 438 | /* |
439 | * *********************** | 439 | * *********************** |
440 | * Write Delay Calibration | 440 | * Write Delay Calibration |
441 | * *********************** | 441 | * *********************** |
442 | */ | 442 | */ |
443 | debug("Starting Write Delay calibration.\n"); | 443 | debug("Starting Write Delay calibration.\n"); |
444 | 444 | ||
445 | reset_read_data_fifos(); | 445 | reset_read_data_fifos(); |
446 | 446 | ||
447 | /* | 447 | /* |
448 | * 4. Issue the Precharge-All command to the DDR device for both | 448 | * 4. Issue the Precharge-All command to the DDR device for both |
449 | * chip selects. If only using one chip select, then precharge | 449 | * chip selects. If only using one chip select, then precharge |
450 | * only the desired chip select. | 450 | * only the desired chip select. |
451 | */ | 451 | */ |
452 | precharge_all(cs0_enable, cs1_enable); | 452 | precharge_all(cs0_enable, cs1_enable); |
453 | 453 | ||
454 | /* | 454 | /* |
455 | * 8. Set the WR_DL_ABS# bits to their default values. | 455 | * 8. Set the WR_DL_ABS# bits to their default values. |
456 | * Both PHYs for x64 configuration, if x32, do only PHY0. | 456 | * Both PHYs for x64 configuration, if x32, do only PHY0. |
457 | */ | 457 | */ |
458 | writel(initdelay, &mmdc0->mpwrdlctl); | 458 | writel(initdelay, &mmdc0->mpwrdlctl); |
459 | if (sysinfo->dsize == 0x2) | 459 | if (sysinfo->dsize == 0x2) |
460 | writel(initdelay, &mmdc1->mpwrdlctl); | 460 | writel(initdelay, &mmdc1->mpwrdlctl); |
461 | 461 | ||
462 | /* | 462 | /* |
463 | * XXX This isn't in the manual. Force a measurement, | 463 | * XXX This isn't in the manual. Force a measurement, |
464 | * for previous delay setup to effect. | 464 | * for previous delay setup to effect. |
465 | */ | 465 | */ |
466 | force_delay_measurement(sysinfo->dsize); | 466 | force_delay_measurement(sysinfo->dsize); |
467 | 467 | ||
468 | /* | 468 | /* |
469 | * 9. 10. Start the automatic write calibration process | 469 | * 9. 10. Start the automatic write calibration process |
470 | * by asserting MPWRDLHWCTL0[HW_WR_DL_EN]. | 470 | * by asserting MPWRDLHWCTL0[HW_WR_DL_EN]. |
471 | */ | 471 | */ |
472 | writel(0x00000030, &mmdc0->mpwrdlhwctl); | 472 | writel(0x00000030, &mmdc0->mpwrdlhwctl); |
473 | 473 | ||
474 | /* | 474 | /* |
475 | * Poll for completion. | 475 | * Poll for completion. |
476 | * MMDC indicates that the write data calibration had finished | 476 | * MMDC indicates that the write data calibration had finished |
477 | * by setting MPWRDLHWCTL[HW_WR_DL_EN] = 0. | 477 | * by setting MPWRDLHWCTL[HW_WR_DL_EN] = 0. |
478 | * Also, ensure that no error bits were set. | 478 | * Also, ensure that no error bits were set. |
479 | */ | 479 | */ |
480 | wait_for_bit("MMDC", &mmdc0->mpwrdlhwctl, 1 << 4, 0, 100, 0); | 480 | wait_for_bit("MMDC", &mmdc0->mpwrdlhwctl, 1 << 4, 0, 100, 0); |
481 | 481 | ||
482 | /* Check both PHYs for x64 configuration, if x32, check only PHY0 */ | 482 | /* Check both PHYs for x64 configuration, if x32, check only PHY0 */ |
483 | if (readl(&mmdc0->mpwrdlhwctl) & 0x0000000f) | 483 | if (readl(&mmdc0->mpwrdlhwctl) & 0x0000000f) |
484 | errors |= 16; | 484 | errors |= 16; |
485 | 485 | ||
486 | if ((sysinfo->dsize == 0x2) && | 486 | if ((sysinfo->dsize == 0x2) && |
487 | (readl(&mmdc1->mpwrdlhwctl) & 0x0000000f)) | 487 | (readl(&mmdc1->mpwrdlhwctl) & 0x0000000f)) |
488 | errors |= 32; | 488 | errors |= 32; |
489 | 489 | ||
490 | debug("Ending Write Delay calibration. Error mask: 0x%x\n", errors); | 490 | debug("Ending Write Delay calibration. Error mask: 0x%x\n", errors); |
491 | 491 | ||
492 | reset_read_data_fifos(); | 492 | reset_read_data_fifos(); |
493 | 493 | ||
494 | /* Enable DDR logic power down timer */ | 494 | /* Enable DDR logic power down timer */ |
495 | setbits_le32(&mmdc0->mdpdc, 0x00005500); | 495 | setbits_le32(&mmdc0->mdpdc, 0x00005500); |
496 | 496 | ||
497 | /* Enable Adopt power down timer */ | 497 | /* Enable Adopt power down timer */ |
498 | clrbits_le32(&mmdc0->mapsr, 0x1); | 498 | clrbits_le32(&mmdc0->mapsr, 0x1); |
499 | 499 | ||
500 | /* Restore MDMISC value (RALAT, WALAT) to MMDCP1 */ | 500 | /* Restore MDMISC value (RALAT, WALAT) to MMDCP1 */ |
501 | writel(esdmisc_val, &mmdc0->mdmisc); | 501 | writel(esdmisc_val, &mmdc0->mdmisc); |
502 | 502 | ||
503 | /* Clear DQS pull ups */ | 503 | /* Clear DQS pull ups */ |
504 | clrbits_le32(&mx6_ddr_iomux->dram_sdqs0, 0x7000); | 504 | clrbits_le32(&mx6_ddr_iomux->dram_sdqs0, 0x7000); |
505 | clrbits_le32(&mx6_ddr_iomux->dram_sdqs1, 0x7000); | 505 | clrbits_le32(&mx6_ddr_iomux->dram_sdqs1, 0x7000); |
506 | clrbits_le32(&mx6_ddr_iomux->dram_sdqs2, 0x7000); | 506 | clrbits_le32(&mx6_ddr_iomux->dram_sdqs2, 0x7000); |
507 | clrbits_le32(&mx6_ddr_iomux->dram_sdqs3, 0x7000); | 507 | clrbits_le32(&mx6_ddr_iomux->dram_sdqs3, 0x7000); |
508 | clrbits_le32(&mx6_ddr_iomux->dram_sdqs4, 0x7000); | 508 | clrbits_le32(&mx6_ddr_iomux->dram_sdqs4, 0x7000); |
509 | clrbits_le32(&mx6_ddr_iomux->dram_sdqs5, 0x7000); | 509 | clrbits_le32(&mx6_ddr_iomux->dram_sdqs5, 0x7000); |
510 | clrbits_le32(&mx6_ddr_iomux->dram_sdqs6, 0x7000); | 510 | clrbits_le32(&mx6_ddr_iomux->dram_sdqs6, 0x7000); |
511 | clrbits_le32(&mx6_ddr_iomux->dram_sdqs7, 0x7000); | 511 | clrbits_le32(&mx6_ddr_iomux->dram_sdqs7, 0x7000); |
512 | 512 | ||
513 | /* Re-enable SDE (chip selects) if they were set initially */ | 513 | /* Re-enable SDE (chip selects) if they were set initially */ |
514 | if (cs1_enable_initial) | 514 | if (cs1_enable_initial) |
515 | /* Set SDE_1 */ | 515 | /* Set SDE_1 */ |
516 | setbits_le32(&mmdc0->mdctl, 1 << 30); | 516 | setbits_le32(&mmdc0->mdctl, 1 << 30); |
517 | 517 | ||
518 | if (cs0_enable_initial) | 518 | if (cs0_enable_initial) |
519 | /* Set SDE_0 */ | 519 | /* Set SDE_0 */ |
520 | setbits_le32(&mmdc0->mdctl, 1 << 31); | 520 | setbits_le32(&mmdc0->mdctl, 1 << 31); |
521 | 521 | ||
522 | /* Re-enable to auto refresh */ | 522 | /* Re-enable to auto refresh */ |
523 | writel(temp_ref, &mmdc0->mdref); | 523 | writel(temp_ref, &mmdc0->mdref); |
524 | 524 | ||
525 | /* Clear the MDSCR (including the con_req bit) */ | 525 | /* Clear the MDSCR (including the con_req bit) */ |
526 | writel(0x0, &mmdc0->mdscr); /* CS0 */ | 526 | writel(0x0, &mmdc0->mdscr); /* CS0 */ |
527 | 527 | ||
528 | /* Poll to make sure the con_ack bit is clear */ | 528 | /* Poll to make sure the con_ack bit is clear */ |
529 | wait_for_bit("MMDC", &mmdc0->mdscr, 1 << 14, 0, 100, 0); | 529 | wait_for_bit("MMDC", &mmdc0->mdscr, 1 << 14, 0, 100, 0); |
530 | 530 | ||
531 | /* | 531 | /* |
532 | * Print out the registers that were updated as a result | 532 | * Print out the registers that were updated as a result |
533 | * of the calibration process. | 533 | * of the calibration process. |
534 | */ | 534 | */ |
535 | debug("MMDC registers updated from calibration\n"); | 535 | debug("MMDC registers updated from calibration\n"); |
536 | debug("Read DQS gating calibration:\n"); | 536 | debug("Read DQS gating calibration:\n"); |
537 | debug("\tMPDGCTRL0 PHY0 = 0x%08X\n", readl(&mmdc0->mpdgctrl0)); | 537 | debug("\tMPDGCTRL0 PHY0 = 0x%08X\n", readl(&mmdc0->mpdgctrl0)); |
538 | debug("\tMPDGCTRL1 PHY0 = 0x%08X\n", readl(&mmdc0->mpdgctrl1)); | 538 | debug("\tMPDGCTRL1 PHY0 = 0x%08X\n", readl(&mmdc0->mpdgctrl1)); |
539 | if (sysinfo->dsize == 2) { | 539 | if (sysinfo->dsize == 2) { |
540 | debug("\tMPDGCTRL0 PHY1 = 0x%08X\n", readl(&mmdc1->mpdgctrl0)); | 540 | debug("\tMPDGCTRL0 PHY1 = 0x%08X\n", readl(&mmdc1->mpdgctrl0)); |
541 | debug("\tMPDGCTRL1 PHY1 = 0x%08X\n", readl(&mmdc1->mpdgctrl1)); | 541 | debug("\tMPDGCTRL1 PHY1 = 0x%08X\n", readl(&mmdc1->mpdgctrl1)); |
542 | } | 542 | } |
543 | debug("Read calibration:\n"); | 543 | debug("Read calibration:\n"); |
544 | debug("\tMPRDDLCTL PHY0 = 0x%08X\n", readl(&mmdc0->mprddlctl)); | 544 | debug("\tMPRDDLCTL PHY0 = 0x%08X\n", readl(&mmdc0->mprddlctl)); |
545 | if (sysinfo->dsize == 2) | 545 | if (sysinfo->dsize == 2) |
546 | debug("\tMPRDDLCTL PHY1 = 0x%08X\n", readl(&mmdc1->mprddlctl)); | 546 | debug("\tMPRDDLCTL PHY1 = 0x%08X\n", readl(&mmdc1->mprddlctl)); |
547 | debug("Write calibration:\n"); | 547 | debug("Write calibration:\n"); |
548 | debug("\tMPWRDLCTL PHY0 = 0x%08X\n", readl(&mmdc0->mpwrdlctl)); | 548 | debug("\tMPWRDLCTL PHY0 = 0x%08X\n", readl(&mmdc0->mpwrdlctl)); |
549 | if (sysinfo->dsize == 2) | 549 | if (sysinfo->dsize == 2) |
550 | debug("\tMPWRDLCTL PHY1 = 0x%08X\n", readl(&mmdc1->mpwrdlctl)); | 550 | debug("\tMPWRDLCTL PHY1 = 0x%08X\n", readl(&mmdc1->mpwrdlctl)); |
551 | 551 | ||
552 | /* | 552 | /* |
553 | * Registers below are for debugging purposes. These print out | 553 | * Registers below are for debugging purposes. These print out |
554 | * the upper and lower boundaries captured during | 554 | * the upper and lower boundaries captured during |
555 | * read DQS gating calibration. | 555 | * read DQS gating calibration. |
556 | */ | 556 | */ |
557 | debug("Status registers bounds for read DQS gating:\n"); | 557 | debug("Status registers bounds for read DQS gating:\n"); |
558 | debug("\tMPDGHWST0 PHY0 = 0x%08x\n", readl(&mmdc0->mpdghwst0)); | 558 | debug("\tMPDGHWST0 PHY0 = 0x%08x\n", readl(&mmdc0->mpdghwst0)); |
559 | debug("\tMPDGHWST1 PHY0 = 0x%08x\n", readl(&mmdc0->mpdghwst1)); | 559 | debug("\tMPDGHWST1 PHY0 = 0x%08x\n", readl(&mmdc0->mpdghwst1)); |
560 | debug("\tMPDGHWST2 PHY0 = 0x%08x\n", readl(&mmdc0->mpdghwst2)); | 560 | debug("\tMPDGHWST2 PHY0 = 0x%08x\n", readl(&mmdc0->mpdghwst2)); |
561 | debug("\tMPDGHWST3 PHY0 = 0x%08x\n", readl(&mmdc0->mpdghwst3)); | 561 | debug("\tMPDGHWST3 PHY0 = 0x%08x\n", readl(&mmdc0->mpdghwst3)); |
562 | if (sysinfo->dsize == 2) { | 562 | if (sysinfo->dsize == 2) { |
563 | debug("\tMPDGHWST0 PHY1 = 0x%08x\n", readl(&mmdc1->mpdghwst0)); | 563 | debug("\tMPDGHWST0 PHY1 = 0x%08x\n", readl(&mmdc1->mpdghwst0)); |
564 | debug("\tMPDGHWST1 PHY1 = 0x%08x\n", readl(&mmdc1->mpdghwst1)); | 564 | debug("\tMPDGHWST1 PHY1 = 0x%08x\n", readl(&mmdc1->mpdghwst1)); |
565 | debug("\tMPDGHWST2 PHY1 = 0x%08x\n", readl(&mmdc1->mpdghwst2)); | 565 | debug("\tMPDGHWST2 PHY1 = 0x%08x\n", readl(&mmdc1->mpdghwst2)); |
566 | debug("\tMPDGHWST3 PHY1 = 0x%08x\n", readl(&mmdc1->mpdghwst3)); | 566 | debug("\tMPDGHWST3 PHY1 = 0x%08x\n", readl(&mmdc1->mpdghwst3)); |
567 | } | 567 | } |
568 | 568 | ||
569 | debug("Final do_dqs_calibration error mask: 0x%x\n", errors); | 569 | debug("Final do_dqs_calibration error mask: 0x%x\n", errors); |
570 | 570 | ||
571 | return errors; | 571 | return errors; |
572 | } | 572 | } |
573 | #endif | 573 | #endif |
574 | 574 | ||
575 | #if defined(CONFIG_MX6SX) | 575 | #if defined(CONFIG_MX6SX) |
576 | /* Configure MX6SX mmdc iomux */ | 576 | /* Configure MX6SX mmdc iomux */ |
577 | void mx6sx_dram_iocfg(unsigned width, | 577 | void mx6sx_dram_iocfg(unsigned width, |
578 | const struct mx6sx_iomux_ddr_regs *ddr, | 578 | const struct mx6sx_iomux_ddr_regs *ddr, |
579 | const struct mx6sx_iomux_grp_regs *grp) | 579 | const struct mx6sx_iomux_grp_regs *grp) |
580 | { | 580 | { |
581 | struct mx6sx_iomux_ddr_regs *mx6_ddr_iomux; | 581 | struct mx6sx_iomux_ddr_regs *mx6_ddr_iomux; |
582 | struct mx6sx_iomux_grp_regs *mx6_grp_iomux; | 582 | struct mx6sx_iomux_grp_regs *mx6_grp_iomux; |
583 | 583 | ||
584 | mx6_ddr_iomux = (struct mx6sx_iomux_ddr_regs *)MX6SX_IOM_DDR_BASE; | 584 | mx6_ddr_iomux = (struct mx6sx_iomux_ddr_regs *)MX6SX_IOM_DDR_BASE; |
585 | mx6_grp_iomux = (struct mx6sx_iomux_grp_regs *)MX6SX_IOM_GRP_BASE; | 585 | mx6_grp_iomux = (struct mx6sx_iomux_grp_regs *)MX6SX_IOM_GRP_BASE; |
586 | 586 | ||
587 | /* DDR IO TYPE */ | 587 | /* DDR IO TYPE */ |
588 | writel(grp->grp_ddr_type, &mx6_grp_iomux->grp_ddr_type); | 588 | writel(grp->grp_ddr_type, &mx6_grp_iomux->grp_ddr_type); |
589 | writel(grp->grp_ddrpke, &mx6_grp_iomux->grp_ddrpke); | 589 | writel(grp->grp_ddrpke, &mx6_grp_iomux->grp_ddrpke); |
590 | 590 | ||
591 | /* CLOCK */ | 591 | /* CLOCK */ |
592 | writel(ddr->dram_sdclk_0, &mx6_ddr_iomux->dram_sdclk_0); | 592 | writel(ddr->dram_sdclk_0, &mx6_ddr_iomux->dram_sdclk_0); |
593 | 593 | ||
594 | /* ADDRESS */ | 594 | /* ADDRESS */ |
595 | writel(ddr->dram_cas, &mx6_ddr_iomux->dram_cas); | 595 | writel(ddr->dram_cas, &mx6_ddr_iomux->dram_cas); |
596 | writel(ddr->dram_ras, &mx6_ddr_iomux->dram_ras); | 596 | writel(ddr->dram_ras, &mx6_ddr_iomux->dram_ras); |
597 | writel(grp->grp_addds, &mx6_grp_iomux->grp_addds); | 597 | writel(grp->grp_addds, &mx6_grp_iomux->grp_addds); |
598 | 598 | ||
599 | /* Control */ | 599 | /* Control */ |
600 | writel(ddr->dram_reset, &mx6_ddr_iomux->dram_reset); | 600 | writel(ddr->dram_reset, &mx6_ddr_iomux->dram_reset); |
601 | writel(ddr->dram_sdba2, &mx6_ddr_iomux->dram_sdba2); | 601 | writel(ddr->dram_sdba2, &mx6_ddr_iomux->dram_sdba2); |
602 | writel(ddr->dram_sdcke0, &mx6_ddr_iomux->dram_sdcke0); | 602 | writel(ddr->dram_sdcke0, &mx6_ddr_iomux->dram_sdcke0); |
603 | writel(ddr->dram_sdcke1, &mx6_ddr_iomux->dram_sdcke1); | 603 | writel(ddr->dram_sdcke1, &mx6_ddr_iomux->dram_sdcke1); |
604 | writel(ddr->dram_odt0, &mx6_ddr_iomux->dram_odt0); | 604 | writel(ddr->dram_odt0, &mx6_ddr_iomux->dram_odt0); |
605 | writel(ddr->dram_odt1, &mx6_ddr_iomux->dram_odt1); | 605 | writel(ddr->dram_odt1, &mx6_ddr_iomux->dram_odt1); |
606 | writel(grp->grp_ctlds, &mx6_grp_iomux->grp_ctlds); | 606 | writel(grp->grp_ctlds, &mx6_grp_iomux->grp_ctlds); |
607 | 607 | ||
608 | /* Data Strobes */ | 608 | /* Data Strobes */ |
609 | writel(grp->grp_ddrmode_ctl, &mx6_grp_iomux->grp_ddrmode_ctl); | 609 | writel(grp->grp_ddrmode_ctl, &mx6_grp_iomux->grp_ddrmode_ctl); |
610 | writel(ddr->dram_sdqs0, &mx6_ddr_iomux->dram_sdqs0); | 610 | writel(ddr->dram_sdqs0, &mx6_ddr_iomux->dram_sdqs0); |
611 | writel(ddr->dram_sdqs1, &mx6_ddr_iomux->dram_sdqs1); | 611 | writel(ddr->dram_sdqs1, &mx6_ddr_iomux->dram_sdqs1); |
612 | if (width >= 32) { | 612 | if (width >= 32) { |
613 | writel(ddr->dram_sdqs2, &mx6_ddr_iomux->dram_sdqs2); | 613 | writel(ddr->dram_sdqs2, &mx6_ddr_iomux->dram_sdqs2); |
614 | writel(ddr->dram_sdqs3, &mx6_ddr_iomux->dram_sdqs3); | 614 | writel(ddr->dram_sdqs3, &mx6_ddr_iomux->dram_sdqs3); |
615 | } | 615 | } |
616 | 616 | ||
617 | /* Data */ | 617 | /* Data */ |
618 | writel(grp->grp_ddrmode, &mx6_grp_iomux->grp_ddrmode); | 618 | writel(grp->grp_ddrmode, &mx6_grp_iomux->grp_ddrmode); |
619 | writel(grp->grp_b0ds, &mx6_grp_iomux->grp_b0ds); | 619 | writel(grp->grp_b0ds, &mx6_grp_iomux->grp_b0ds); |
620 | writel(grp->grp_b1ds, &mx6_grp_iomux->grp_b1ds); | 620 | writel(grp->grp_b1ds, &mx6_grp_iomux->grp_b1ds); |
621 | if (width >= 32) { | 621 | if (width >= 32) { |
622 | writel(grp->grp_b2ds, &mx6_grp_iomux->grp_b2ds); | 622 | writel(grp->grp_b2ds, &mx6_grp_iomux->grp_b2ds); |
623 | writel(grp->grp_b3ds, &mx6_grp_iomux->grp_b3ds); | 623 | writel(grp->grp_b3ds, &mx6_grp_iomux->grp_b3ds); |
624 | } | 624 | } |
625 | writel(ddr->dram_dqm0, &mx6_ddr_iomux->dram_dqm0); | 625 | writel(ddr->dram_dqm0, &mx6_ddr_iomux->dram_dqm0); |
626 | writel(ddr->dram_dqm1, &mx6_ddr_iomux->dram_dqm1); | 626 | writel(ddr->dram_dqm1, &mx6_ddr_iomux->dram_dqm1); |
627 | if (width >= 32) { | 627 | if (width >= 32) { |
628 | writel(ddr->dram_dqm2, &mx6_ddr_iomux->dram_dqm2); | 628 | writel(ddr->dram_dqm2, &mx6_ddr_iomux->dram_dqm2); |
629 | writel(ddr->dram_dqm3, &mx6_ddr_iomux->dram_dqm3); | 629 | writel(ddr->dram_dqm3, &mx6_ddr_iomux->dram_dqm3); |
630 | } | 630 | } |
631 | } | 631 | } |
632 | #endif | 632 | #endif |
633 | 633 | ||
634 | #ifdef CONFIG_MX6UL | 634 | #if defined(CONFIG_MX6UL) || defined(CONFIG_MX6ULL) |
635 | void mx6ul_dram_iocfg(unsigned width, | 635 | void mx6ul_dram_iocfg(unsigned width, |
636 | const struct mx6ul_iomux_ddr_regs *ddr, | 636 | const struct mx6ul_iomux_ddr_regs *ddr, |
637 | const struct mx6ul_iomux_grp_regs *grp) | 637 | const struct mx6ul_iomux_grp_regs *grp) |
638 | { | 638 | { |
639 | struct mx6ul_iomux_ddr_regs *mx6_ddr_iomux; | 639 | struct mx6ul_iomux_ddr_regs *mx6_ddr_iomux; |
640 | struct mx6ul_iomux_grp_regs *mx6_grp_iomux; | 640 | struct mx6ul_iomux_grp_regs *mx6_grp_iomux; |
641 | 641 | ||
642 | mx6_ddr_iomux = (struct mx6ul_iomux_ddr_regs *)MX6UL_IOM_DDR_BASE; | 642 | mx6_ddr_iomux = (struct mx6ul_iomux_ddr_regs *)MX6UL_IOM_DDR_BASE; |
643 | mx6_grp_iomux = (struct mx6ul_iomux_grp_regs *)MX6UL_IOM_GRP_BASE; | 643 | mx6_grp_iomux = (struct mx6ul_iomux_grp_regs *)MX6UL_IOM_GRP_BASE; |
644 | 644 | ||
645 | /* DDR IO TYPE */ | 645 | /* DDR IO TYPE */ |
646 | writel(grp->grp_ddr_type, &mx6_grp_iomux->grp_ddr_type); | 646 | writel(grp->grp_ddr_type, &mx6_grp_iomux->grp_ddr_type); |
647 | writel(grp->grp_ddrpke, &mx6_grp_iomux->grp_ddrpke); | 647 | writel(grp->grp_ddrpke, &mx6_grp_iomux->grp_ddrpke); |
648 | 648 | ||
649 | /* CLOCK */ | 649 | /* CLOCK */ |
650 | writel(ddr->dram_sdclk_0, &mx6_ddr_iomux->dram_sdclk_0); | 650 | writel(ddr->dram_sdclk_0, &mx6_ddr_iomux->dram_sdclk_0); |
651 | 651 | ||
652 | /* ADDRESS */ | 652 | /* ADDRESS */ |
653 | writel(ddr->dram_cas, &mx6_ddr_iomux->dram_cas); | 653 | writel(ddr->dram_cas, &mx6_ddr_iomux->dram_cas); |
654 | writel(ddr->dram_ras, &mx6_ddr_iomux->dram_ras); | 654 | writel(ddr->dram_ras, &mx6_ddr_iomux->dram_ras); |
655 | writel(grp->grp_addds, &mx6_grp_iomux->grp_addds); | 655 | writel(grp->grp_addds, &mx6_grp_iomux->grp_addds); |
656 | 656 | ||
657 | /* Control */ | 657 | /* Control */ |
658 | writel(ddr->dram_reset, &mx6_ddr_iomux->dram_reset); | 658 | writel(ddr->dram_reset, &mx6_ddr_iomux->dram_reset); |
659 | writel(ddr->dram_sdba2, &mx6_ddr_iomux->dram_sdba2); | 659 | writel(ddr->dram_sdba2, &mx6_ddr_iomux->dram_sdba2); |
660 | writel(ddr->dram_odt0, &mx6_ddr_iomux->dram_odt0); | 660 | writel(ddr->dram_odt0, &mx6_ddr_iomux->dram_odt0); |
661 | writel(ddr->dram_odt1, &mx6_ddr_iomux->dram_odt1); | 661 | writel(ddr->dram_odt1, &mx6_ddr_iomux->dram_odt1); |
662 | writel(grp->grp_ctlds, &mx6_grp_iomux->grp_ctlds); | 662 | writel(grp->grp_ctlds, &mx6_grp_iomux->grp_ctlds); |
663 | 663 | ||
664 | /* Data Strobes */ | 664 | /* Data Strobes */ |
665 | writel(grp->grp_ddrmode_ctl, &mx6_grp_iomux->grp_ddrmode_ctl); | 665 | writel(grp->grp_ddrmode_ctl, &mx6_grp_iomux->grp_ddrmode_ctl); |
666 | writel(ddr->dram_sdqs0, &mx6_ddr_iomux->dram_sdqs0); | 666 | writel(ddr->dram_sdqs0, &mx6_ddr_iomux->dram_sdqs0); |
667 | writel(ddr->dram_sdqs1, &mx6_ddr_iomux->dram_sdqs1); | 667 | writel(ddr->dram_sdqs1, &mx6_ddr_iomux->dram_sdqs1); |
668 | 668 | ||
669 | /* Data */ | 669 | /* Data */ |
670 | writel(grp->grp_ddrmode, &mx6_grp_iomux->grp_ddrmode); | 670 | writel(grp->grp_ddrmode, &mx6_grp_iomux->grp_ddrmode); |
671 | writel(grp->grp_b0ds, &mx6_grp_iomux->grp_b0ds); | 671 | writel(grp->grp_b0ds, &mx6_grp_iomux->grp_b0ds); |
672 | writel(grp->grp_b1ds, &mx6_grp_iomux->grp_b1ds); | 672 | writel(grp->grp_b1ds, &mx6_grp_iomux->grp_b1ds); |
673 | writel(ddr->dram_dqm0, &mx6_ddr_iomux->dram_dqm0); | 673 | writel(ddr->dram_dqm0, &mx6_ddr_iomux->dram_dqm0); |
674 | writel(ddr->dram_dqm1, &mx6_ddr_iomux->dram_dqm1); | 674 | writel(ddr->dram_dqm1, &mx6_ddr_iomux->dram_dqm1); |
675 | } | 675 | } |
676 | #endif | 676 | #endif |
677 | 677 | ||
678 | #if defined(CONFIG_MX6SL) | 678 | #if defined(CONFIG_MX6SL) |
679 | void mx6sl_dram_iocfg(unsigned width, | 679 | void mx6sl_dram_iocfg(unsigned width, |
680 | const struct mx6sl_iomux_ddr_regs *ddr, | 680 | const struct mx6sl_iomux_ddr_regs *ddr, |
681 | const struct mx6sl_iomux_grp_regs *grp) | 681 | const struct mx6sl_iomux_grp_regs *grp) |
682 | { | 682 | { |
683 | struct mx6sl_iomux_ddr_regs *mx6_ddr_iomux; | 683 | struct mx6sl_iomux_ddr_regs *mx6_ddr_iomux; |
684 | struct mx6sl_iomux_grp_regs *mx6_grp_iomux; | 684 | struct mx6sl_iomux_grp_regs *mx6_grp_iomux; |
685 | 685 | ||
686 | mx6_ddr_iomux = (struct mx6sl_iomux_ddr_regs *)MX6SL_IOM_DDR_BASE; | 686 | mx6_ddr_iomux = (struct mx6sl_iomux_ddr_regs *)MX6SL_IOM_DDR_BASE; |
687 | mx6_grp_iomux = (struct mx6sl_iomux_grp_regs *)MX6SL_IOM_GRP_BASE; | 687 | mx6_grp_iomux = (struct mx6sl_iomux_grp_regs *)MX6SL_IOM_GRP_BASE; |
688 | 688 | ||
689 | /* DDR IO TYPE */ | 689 | /* DDR IO TYPE */ |
690 | mx6_grp_iomux->grp_ddr_type = grp->grp_ddr_type; | 690 | mx6_grp_iomux->grp_ddr_type = grp->grp_ddr_type; |
691 | mx6_grp_iomux->grp_ddrpke = grp->grp_ddrpke; | 691 | mx6_grp_iomux->grp_ddrpke = grp->grp_ddrpke; |
692 | 692 | ||
693 | /* CLOCK */ | 693 | /* CLOCK */ |
694 | mx6_ddr_iomux->dram_sdclk_0 = ddr->dram_sdclk_0; | 694 | mx6_ddr_iomux->dram_sdclk_0 = ddr->dram_sdclk_0; |
695 | 695 | ||
696 | /* ADDRESS */ | 696 | /* ADDRESS */ |
697 | mx6_ddr_iomux->dram_cas = ddr->dram_cas; | 697 | mx6_ddr_iomux->dram_cas = ddr->dram_cas; |
698 | mx6_ddr_iomux->dram_ras = ddr->dram_ras; | 698 | mx6_ddr_iomux->dram_ras = ddr->dram_ras; |
699 | mx6_grp_iomux->grp_addds = grp->grp_addds; | 699 | mx6_grp_iomux->grp_addds = grp->grp_addds; |
700 | 700 | ||
701 | /* Control */ | 701 | /* Control */ |
702 | mx6_ddr_iomux->dram_reset = ddr->dram_reset; | 702 | mx6_ddr_iomux->dram_reset = ddr->dram_reset; |
703 | mx6_ddr_iomux->dram_sdba2 = ddr->dram_sdba2; | 703 | mx6_ddr_iomux->dram_sdba2 = ddr->dram_sdba2; |
704 | mx6_grp_iomux->grp_ctlds = grp->grp_ctlds; | 704 | mx6_grp_iomux->grp_ctlds = grp->grp_ctlds; |
705 | 705 | ||
706 | /* Data Strobes */ | 706 | /* Data Strobes */ |
707 | mx6_grp_iomux->grp_ddrmode_ctl = grp->grp_ddrmode_ctl; | 707 | mx6_grp_iomux->grp_ddrmode_ctl = grp->grp_ddrmode_ctl; |
708 | mx6_ddr_iomux->dram_sdqs0 = ddr->dram_sdqs0; | 708 | mx6_ddr_iomux->dram_sdqs0 = ddr->dram_sdqs0; |
709 | mx6_ddr_iomux->dram_sdqs1 = ddr->dram_sdqs1; | 709 | mx6_ddr_iomux->dram_sdqs1 = ddr->dram_sdqs1; |
710 | if (width >= 32) { | 710 | if (width >= 32) { |
711 | mx6_ddr_iomux->dram_sdqs2 = ddr->dram_sdqs2; | 711 | mx6_ddr_iomux->dram_sdqs2 = ddr->dram_sdqs2; |
712 | mx6_ddr_iomux->dram_sdqs3 = ddr->dram_sdqs3; | 712 | mx6_ddr_iomux->dram_sdqs3 = ddr->dram_sdqs3; |
713 | } | 713 | } |
714 | 714 | ||
715 | /* Data */ | 715 | /* Data */ |
716 | mx6_grp_iomux->grp_ddrmode = grp->grp_ddrmode; | 716 | mx6_grp_iomux->grp_ddrmode = grp->grp_ddrmode; |
717 | mx6_grp_iomux->grp_b0ds = grp->grp_b0ds; | 717 | mx6_grp_iomux->grp_b0ds = grp->grp_b0ds; |
718 | mx6_grp_iomux->grp_b1ds = grp->grp_b1ds; | 718 | mx6_grp_iomux->grp_b1ds = grp->grp_b1ds; |
719 | if (width >= 32) { | 719 | if (width >= 32) { |
720 | mx6_grp_iomux->grp_b2ds = grp->grp_b2ds; | 720 | mx6_grp_iomux->grp_b2ds = grp->grp_b2ds; |
721 | mx6_grp_iomux->grp_b3ds = grp->grp_b3ds; | 721 | mx6_grp_iomux->grp_b3ds = grp->grp_b3ds; |
722 | } | 722 | } |
723 | 723 | ||
724 | mx6_ddr_iomux->dram_dqm0 = ddr->dram_dqm0; | 724 | mx6_ddr_iomux->dram_dqm0 = ddr->dram_dqm0; |
725 | mx6_ddr_iomux->dram_dqm1 = ddr->dram_dqm1; | 725 | mx6_ddr_iomux->dram_dqm1 = ddr->dram_dqm1; |
726 | if (width >= 32) { | 726 | if (width >= 32) { |
727 | mx6_ddr_iomux->dram_dqm2 = ddr->dram_dqm2; | 727 | mx6_ddr_iomux->dram_dqm2 = ddr->dram_dqm2; |
728 | mx6_ddr_iomux->dram_dqm3 = ddr->dram_dqm3; | 728 | mx6_ddr_iomux->dram_dqm3 = ddr->dram_dqm3; |
729 | } | 729 | } |
730 | } | 730 | } |
731 | #endif | 731 | #endif |
732 | 732 | ||
733 | #if defined(CONFIG_MX6QDL) || defined(CONFIG_MX6Q) || defined(CONFIG_MX6D) | 733 | #if defined(CONFIG_MX6QDL) || defined(CONFIG_MX6Q) || defined(CONFIG_MX6D) |
734 | /* Configure MX6DQ mmdc iomux */ | 734 | /* Configure MX6DQ mmdc iomux */ |
735 | void mx6dq_dram_iocfg(unsigned width, | 735 | void mx6dq_dram_iocfg(unsigned width, |
736 | const struct mx6dq_iomux_ddr_regs *ddr, | 736 | const struct mx6dq_iomux_ddr_regs *ddr, |
737 | const struct mx6dq_iomux_grp_regs *grp) | 737 | const struct mx6dq_iomux_grp_regs *grp) |
738 | { | 738 | { |
739 | volatile struct mx6dq_iomux_ddr_regs *mx6_ddr_iomux; | 739 | volatile struct mx6dq_iomux_ddr_regs *mx6_ddr_iomux; |
740 | volatile struct mx6dq_iomux_grp_regs *mx6_grp_iomux; | 740 | volatile struct mx6dq_iomux_grp_regs *mx6_grp_iomux; |
741 | 741 | ||
742 | mx6_ddr_iomux = (struct mx6dq_iomux_ddr_regs *)MX6DQ_IOM_DDR_BASE; | 742 | mx6_ddr_iomux = (struct mx6dq_iomux_ddr_regs *)MX6DQ_IOM_DDR_BASE; |
743 | mx6_grp_iomux = (struct mx6dq_iomux_grp_regs *)MX6DQ_IOM_GRP_BASE; | 743 | mx6_grp_iomux = (struct mx6dq_iomux_grp_regs *)MX6DQ_IOM_GRP_BASE; |
744 | 744 | ||
745 | /* DDR IO Type */ | 745 | /* DDR IO Type */ |
746 | mx6_grp_iomux->grp_ddr_type = grp->grp_ddr_type; | 746 | mx6_grp_iomux->grp_ddr_type = grp->grp_ddr_type; |
747 | mx6_grp_iomux->grp_ddrpke = grp->grp_ddrpke; | 747 | mx6_grp_iomux->grp_ddrpke = grp->grp_ddrpke; |
748 | 748 | ||
749 | /* Clock */ | 749 | /* Clock */ |
750 | mx6_ddr_iomux->dram_sdclk_0 = ddr->dram_sdclk_0; | 750 | mx6_ddr_iomux->dram_sdclk_0 = ddr->dram_sdclk_0; |
751 | mx6_ddr_iomux->dram_sdclk_1 = ddr->dram_sdclk_1; | 751 | mx6_ddr_iomux->dram_sdclk_1 = ddr->dram_sdclk_1; |
752 | 752 | ||
753 | /* Address */ | 753 | /* Address */ |
754 | mx6_ddr_iomux->dram_cas = ddr->dram_cas; | 754 | mx6_ddr_iomux->dram_cas = ddr->dram_cas; |
755 | mx6_ddr_iomux->dram_ras = ddr->dram_ras; | 755 | mx6_ddr_iomux->dram_ras = ddr->dram_ras; |
756 | mx6_grp_iomux->grp_addds = grp->grp_addds; | 756 | mx6_grp_iomux->grp_addds = grp->grp_addds; |
757 | 757 | ||
758 | /* Control */ | 758 | /* Control */ |
759 | mx6_ddr_iomux->dram_reset = ddr->dram_reset; | 759 | mx6_ddr_iomux->dram_reset = ddr->dram_reset; |
760 | mx6_ddr_iomux->dram_sdcke0 = ddr->dram_sdcke0; | 760 | mx6_ddr_iomux->dram_sdcke0 = ddr->dram_sdcke0; |
761 | mx6_ddr_iomux->dram_sdcke1 = ddr->dram_sdcke1; | 761 | mx6_ddr_iomux->dram_sdcke1 = ddr->dram_sdcke1; |
762 | mx6_ddr_iomux->dram_sdba2 = ddr->dram_sdba2; | 762 | mx6_ddr_iomux->dram_sdba2 = ddr->dram_sdba2; |
763 | mx6_ddr_iomux->dram_sdodt0 = ddr->dram_sdodt0; | 763 | mx6_ddr_iomux->dram_sdodt0 = ddr->dram_sdodt0; |
764 | mx6_ddr_iomux->dram_sdodt1 = ddr->dram_sdodt1; | 764 | mx6_ddr_iomux->dram_sdodt1 = ddr->dram_sdodt1; |
765 | mx6_grp_iomux->grp_ctlds = grp->grp_ctlds; | 765 | mx6_grp_iomux->grp_ctlds = grp->grp_ctlds; |
766 | 766 | ||
767 | /* Data Strobes */ | 767 | /* Data Strobes */ |
768 | mx6_grp_iomux->grp_ddrmode_ctl = grp->grp_ddrmode_ctl; | 768 | mx6_grp_iomux->grp_ddrmode_ctl = grp->grp_ddrmode_ctl; |
769 | mx6_ddr_iomux->dram_sdqs0 = ddr->dram_sdqs0; | 769 | mx6_ddr_iomux->dram_sdqs0 = ddr->dram_sdqs0; |
770 | mx6_ddr_iomux->dram_sdqs1 = ddr->dram_sdqs1; | 770 | mx6_ddr_iomux->dram_sdqs1 = ddr->dram_sdqs1; |
771 | if (width >= 32) { | 771 | if (width >= 32) { |
772 | mx6_ddr_iomux->dram_sdqs2 = ddr->dram_sdqs2; | 772 | mx6_ddr_iomux->dram_sdqs2 = ddr->dram_sdqs2; |
773 | mx6_ddr_iomux->dram_sdqs3 = ddr->dram_sdqs3; | 773 | mx6_ddr_iomux->dram_sdqs3 = ddr->dram_sdqs3; |
774 | } | 774 | } |
775 | if (width >= 64) { | 775 | if (width >= 64) { |
776 | mx6_ddr_iomux->dram_sdqs4 = ddr->dram_sdqs4; | 776 | mx6_ddr_iomux->dram_sdqs4 = ddr->dram_sdqs4; |
777 | mx6_ddr_iomux->dram_sdqs5 = ddr->dram_sdqs5; | 777 | mx6_ddr_iomux->dram_sdqs5 = ddr->dram_sdqs5; |
778 | mx6_ddr_iomux->dram_sdqs6 = ddr->dram_sdqs6; | 778 | mx6_ddr_iomux->dram_sdqs6 = ddr->dram_sdqs6; |
779 | mx6_ddr_iomux->dram_sdqs7 = ddr->dram_sdqs7; | 779 | mx6_ddr_iomux->dram_sdqs7 = ddr->dram_sdqs7; |
780 | } | 780 | } |
781 | 781 | ||
782 | /* Data */ | 782 | /* Data */ |
783 | mx6_grp_iomux->grp_ddrmode = grp->grp_ddrmode; | 783 | mx6_grp_iomux->grp_ddrmode = grp->grp_ddrmode; |
784 | mx6_grp_iomux->grp_b0ds = grp->grp_b0ds; | 784 | mx6_grp_iomux->grp_b0ds = grp->grp_b0ds; |
785 | mx6_grp_iomux->grp_b1ds = grp->grp_b1ds; | 785 | mx6_grp_iomux->grp_b1ds = grp->grp_b1ds; |
786 | if (width >= 32) { | 786 | if (width >= 32) { |
787 | mx6_grp_iomux->grp_b2ds = grp->grp_b2ds; | 787 | mx6_grp_iomux->grp_b2ds = grp->grp_b2ds; |
788 | mx6_grp_iomux->grp_b3ds = grp->grp_b3ds; | 788 | mx6_grp_iomux->grp_b3ds = grp->grp_b3ds; |
789 | } | 789 | } |
790 | if (width >= 64) { | 790 | if (width >= 64) { |
791 | mx6_grp_iomux->grp_b4ds = grp->grp_b4ds; | 791 | mx6_grp_iomux->grp_b4ds = grp->grp_b4ds; |
792 | mx6_grp_iomux->grp_b5ds = grp->grp_b5ds; | 792 | mx6_grp_iomux->grp_b5ds = grp->grp_b5ds; |
793 | mx6_grp_iomux->grp_b6ds = grp->grp_b6ds; | 793 | mx6_grp_iomux->grp_b6ds = grp->grp_b6ds; |
794 | mx6_grp_iomux->grp_b7ds = grp->grp_b7ds; | 794 | mx6_grp_iomux->grp_b7ds = grp->grp_b7ds; |
795 | } | 795 | } |
796 | mx6_ddr_iomux->dram_dqm0 = ddr->dram_dqm0; | 796 | mx6_ddr_iomux->dram_dqm0 = ddr->dram_dqm0; |
797 | mx6_ddr_iomux->dram_dqm1 = ddr->dram_dqm1; | 797 | mx6_ddr_iomux->dram_dqm1 = ddr->dram_dqm1; |
798 | if (width >= 32) { | 798 | if (width >= 32) { |
799 | mx6_ddr_iomux->dram_dqm2 = ddr->dram_dqm2; | 799 | mx6_ddr_iomux->dram_dqm2 = ddr->dram_dqm2; |
800 | mx6_ddr_iomux->dram_dqm3 = ddr->dram_dqm3; | 800 | mx6_ddr_iomux->dram_dqm3 = ddr->dram_dqm3; |
801 | } | 801 | } |
802 | if (width >= 64) { | 802 | if (width >= 64) { |
803 | mx6_ddr_iomux->dram_dqm4 = ddr->dram_dqm4; | 803 | mx6_ddr_iomux->dram_dqm4 = ddr->dram_dqm4; |
804 | mx6_ddr_iomux->dram_dqm5 = ddr->dram_dqm5; | 804 | mx6_ddr_iomux->dram_dqm5 = ddr->dram_dqm5; |
805 | mx6_ddr_iomux->dram_dqm6 = ddr->dram_dqm6; | 805 | mx6_ddr_iomux->dram_dqm6 = ddr->dram_dqm6; |
806 | mx6_ddr_iomux->dram_dqm7 = ddr->dram_dqm7; | 806 | mx6_ddr_iomux->dram_dqm7 = ddr->dram_dqm7; |
807 | } | 807 | } |
808 | } | 808 | } |
809 | #endif | 809 | #endif |
810 | 810 | ||
811 | #if defined(CONFIG_MX6QDL) || defined(CONFIG_MX6DL) || defined(CONFIG_MX6S) | 811 | #if defined(CONFIG_MX6QDL) || defined(CONFIG_MX6DL) || defined(CONFIG_MX6S) |
812 | /* Configure MX6SDL mmdc iomux */ | 812 | /* Configure MX6SDL mmdc iomux */ |
813 | void mx6sdl_dram_iocfg(unsigned width, | 813 | void mx6sdl_dram_iocfg(unsigned width, |
814 | const struct mx6sdl_iomux_ddr_regs *ddr, | 814 | const struct mx6sdl_iomux_ddr_regs *ddr, |
815 | const struct mx6sdl_iomux_grp_regs *grp) | 815 | const struct mx6sdl_iomux_grp_regs *grp) |
816 | { | 816 | { |
817 | volatile struct mx6sdl_iomux_ddr_regs *mx6_ddr_iomux; | 817 | volatile struct mx6sdl_iomux_ddr_regs *mx6_ddr_iomux; |
818 | volatile struct mx6sdl_iomux_grp_regs *mx6_grp_iomux; | 818 | volatile struct mx6sdl_iomux_grp_regs *mx6_grp_iomux; |
819 | 819 | ||
820 | mx6_ddr_iomux = (struct mx6sdl_iomux_ddr_regs *)MX6SDL_IOM_DDR_BASE; | 820 | mx6_ddr_iomux = (struct mx6sdl_iomux_ddr_regs *)MX6SDL_IOM_DDR_BASE; |
821 | mx6_grp_iomux = (struct mx6sdl_iomux_grp_regs *)MX6SDL_IOM_GRP_BASE; | 821 | mx6_grp_iomux = (struct mx6sdl_iomux_grp_regs *)MX6SDL_IOM_GRP_BASE; |
822 | 822 | ||
823 | /* DDR IO Type */ | 823 | /* DDR IO Type */ |
824 | mx6_grp_iomux->grp_ddr_type = grp->grp_ddr_type; | 824 | mx6_grp_iomux->grp_ddr_type = grp->grp_ddr_type; |
825 | mx6_grp_iomux->grp_ddrpke = grp->grp_ddrpke; | 825 | mx6_grp_iomux->grp_ddrpke = grp->grp_ddrpke; |
826 | 826 | ||
827 | /* Clock */ | 827 | /* Clock */ |
828 | mx6_ddr_iomux->dram_sdclk_0 = ddr->dram_sdclk_0; | 828 | mx6_ddr_iomux->dram_sdclk_0 = ddr->dram_sdclk_0; |
829 | mx6_ddr_iomux->dram_sdclk_1 = ddr->dram_sdclk_1; | 829 | mx6_ddr_iomux->dram_sdclk_1 = ddr->dram_sdclk_1; |
830 | 830 | ||
831 | /* Address */ | 831 | /* Address */ |
832 | mx6_ddr_iomux->dram_cas = ddr->dram_cas; | 832 | mx6_ddr_iomux->dram_cas = ddr->dram_cas; |
833 | mx6_ddr_iomux->dram_ras = ddr->dram_ras; | 833 | mx6_ddr_iomux->dram_ras = ddr->dram_ras; |
834 | mx6_grp_iomux->grp_addds = grp->grp_addds; | 834 | mx6_grp_iomux->grp_addds = grp->grp_addds; |
835 | 835 | ||
836 | /* Control */ | 836 | /* Control */ |
837 | mx6_ddr_iomux->dram_reset = ddr->dram_reset; | 837 | mx6_ddr_iomux->dram_reset = ddr->dram_reset; |
838 | mx6_ddr_iomux->dram_sdcke0 = ddr->dram_sdcke0; | 838 | mx6_ddr_iomux->dram_sdcke0 = ddr->dram_sdcke0; |
839 | mx6_ddr_iomux->dram_sdcke1 = ddr->dram_sdcke1; | 839 | mx6_ddr_iomux->dram_sdcke1 = ddr->dram_sdcke1; |
840 | mx6_ddr_iomux->dram_sdba2 = ddr->dram_sdba2; | 840 | mx6_ddr_iomux->dram_sdba2 = ddr->dram_sdba2; |
841 | mx6_ddr_iomux->dram_sdodt0 = ddr->dram_sdodt0; | 841 | mx6_ddr_iomux->dram_sdodt0 = ddr->dram_sdodt0; |
842 | mx6_ddr_iomux->dram_sdodt1 = ddr->dram_sdodt1; | 842 | mx6_ddr_iomux->dram_sdodt1 = ddr->dram_sdodt1; |
843 | mx6_grp_iomux->grp_ctlds = grp->grp_ctlds; | 843 | mx6_grp_iomux->grp_ctlds = grp->grp_ctlds; |
844 | 844 | ||
845 | /* Data Strobes */ | 845 | /* Data Strobes */ |
846 | mx6_grp_iomux->grp_ddrmode_ctl = grp->grp_ddrmode_ctl; | 846 | mx6_grp_iomux->grp_ddrmode_ctl = grp->grp_ddrmode_ctl; |
847 | mx6_ddr_iomux->dram_sdqs0 = ddr->dram_sdqs0; | 847 | mx6_ddr_iomux->dram_sdqs0 = ddr->dram_sdqs0; |
848 | mx6_ddr_iomux->dram_sdqs1 = ddr->dram_sdqs1; | 848 | mx6_ddr_iomux->dram_sdqs1 = ddr->dram_sdqs1; |
849 | if (width >= 32) { | 849 | if (width >= 32) { |
850 | mx6_ddr_iomux->dram_sdqs2 = ddr->dram_sdqs2; | 850 | mx6_ddr_iomux->dram_sdqs2 = ddr->dram_sdqs2; |
851 | mx6_ddr_iomux->dram_sdqs3 = ddr->dram_sdqs3; | 851 | mx6_ddr_iomux->dram_sdqs3 = ddr->dram_sdqs3; |
852 | } | 852 | } |
853 | if (width >= 64) { | 853 | if (width >= 64) { |
854 | mx6_ddr_iomux->dram_sdqs4 = ddr->dram_sdqs4; | 854 | mx6_ddr_iomux->dram_sdqs4 = ddr->dram_sdqs4; |
855 | mx6_ddr_iomux->dram_sdqs5 = ddr->dram_sdqs5; | 855 | mx6_ddr_iomux->dram_sdqs5 = ddr->dram_sdqs5; |
856 | mx6_ddr_iomux->dram_sdqs6 = ddr->dram_sdqs6; | 856 | mx6_ddr_iomux->dram_sdqs6 = ddr->dram_sdqs6; |
857 | mx6_ddr_iomux->dram_sdqs7 = ddr->dram_sdqs7; | 857 | mx6_ddr_iomux->dram_sdqs7 = ddr->dram_sdqs7; |
858 | } | 858 | } |
859 | 859 | ||
860 | /* Data */ | 860 | /* Data */ |
861 | mx6_grp_iomux->grp_ddrmode = grp->grp_ddrmode; | 861 | mx6_grp_iomux->grp_ddrmode = grp->grp_ddrmode; |
862 | mx6_grp_iomux->grp_b0ds = grp->grp_b0ds; | 862 | mx6_grp_iomux->grp_b0ds = grp->grp_b0ds; |
863 | mx6_grp_iomux->grp_b1ds = grp->grp_b1ds; | 863 | mx6_grp_iomux->grp_b1ds = grp->grp_b1ds; |
864 | if (width >= 32) { | 864 | if (width >= 32) { |
865 | mx6_grp_iomux->grp_b2ds = grp->grp_b2ds; | 865 | mx6_grp_iomux->grp_b2ds = grp->grp_b2ds; |
866 | mx6_grp_iomux->grp_b3ds = grp->grp_b3ds; | 866 | mx6_grp_iomux->grp_b3ds = grp->grp_b3ds; |
867 | } | 867 | } |
868 | if (width >= 64) { | 868 | if (width >= 64) { |
869 | mx6_grp_iomux->grp_b4ds = grp->grp_b4ds; | 869 | mx6_grp_iomux->grp_b4ds = grp->grp_b4ds; |
870 | mx6_grp_iomux->grp_b5ds = grp->grp_b5ds; | 870 | mx6_grp_iomux->grp_b5ds = grp->grp_b5ds; |
871 | mx6_grp_iomux->grp_b6ds = grp->grp_b6ds; | 871 | mx6_grp_iomux->grp_b6ds = grp->grp_b6ds; |
872 | mx6_grp_iomux->grp_b7ds = grp->grp_b7ds; | 872 | mx6_grp_iomux->grp_b7ds = grp->grp_b7ds; |
873 | } | 873 | } |
874 | mx6_ddr_iomux->dram_dqm0 = ddr->dram_dqm0; | 874 | mx6_ddr_iomux->dram_dqm0 = ddr->dram_dqm0; |
875 | mx6_ddr_iomux->dram_dqm1 = ddr->dram_dqm1; | 875 | mx6_ddr_iomux->dram_dqm1 = ddr->dram_dqm1; |
876 | if (width >= 32) { | 876 | if (width >= 32) { |
877 | mx6_ddr_iomux->dram_dqm2 = ddr->dram_dqm2; | 877 | mx6_ddr_iomux->dram_dqm2 = ddr->dram_dqm2; |
878 | mx6_ddr_iomux->dram_dqm3 = ddr->dram_dqm3; | 878 | mx6_ddr_iomux->dram_dqm3 = ddr->dram_dqm3; |
879 | } | 879 | } |
880 | if (width >= 64) { | 880 | if (width >= 64) { |
881 | mx6_ddr_iomux->dram_dqm4 = ddr->dram_dqm4; | 881 | mx6_ddr_iomux->dram_dqm4 = ddr->dram_dqm4; |
882 | mx6_ddr_iomux->dram_dqm5 = ddr->dram_dqm5; | 882 | mx6_ddr_iomux->dram_dqm5 = ddr->dram_dqm5; |
883 | mx6_ddr_iomux->dram_dqm6 = ddr->dram_dqm6; | 883 | mx6_ddr_iomux->dram_dqm6 = ddr->dram_dqm6; |
884 | mx6_ddr_iomux->dram_dqm7 = ddr->dram_dqm7; | 884 | mx6_ddr_iomux->dram_dqm7 = ddr->dram_dqm7; |
885 | } | 885 | } |
886 | } | 886 | } |
887 | #endif | 887 | #endif |
888 | 888 | ||
889 | /* | 889 | /* |
890 | * Configure mx6 mmdc registers based on: | 890 | * Configure mx6 mmdc registers based on: |
891 | * - board-specific memory configuration | 891 | * - board-specific memory configuration |
892 | * - board-specific calibration data | 892 | * - board-specific calibration data |
893 | * - ddr3/lpddr2 chip details | 893 | * - ddr3/lpddr2 chip details |
894 | * | 894 | * |
895 | * The various calculations here are derived from the Freescale | 895 | * The various calculations here are derived from the Freescale |
896 | * 1. i.Mx6DQSDL DDR3 Script Aid spreadsheet (DOC-94917) designed to generate | 896 | * 1. i.Mx6DQSDL DDR3 Script Aid spreadsheet (DOC-94917) designed to generate |
897 | * MMDC configuration registers based on memory system and memory chip | 897 | * MMDC configuration registers based on memory system and memory chip |
898 | * parameters. | 898 | * parameters. |
899 | * | 899 | * |
900 | * 2. i.Mx6SL LPDDR2 Script Aid spreadsheet V0.04 designed to generate MMDC | 900 | * 2. i.Mx6SL LPDDR2 Script Aid spreadsheet V0.04 designed to generate MMDC |
901 | * configuration registers based on memory system and memory chip | 901 | * configuration registers based on memory system and memory chip |
902 | * parameters. | 902 | * parameters. |
903 | * | 903 | * |
904 | * The defaults here are those which were specified in the spreadsheet. | 904 | * The defaults here are those which were specified in the spreadsheet. |
905 | * For details on each register, refer to the IMX6DQRM and/or IMX6SDLRM | 905 | * For details on each register, refer to the IMX6DQRM and/or IMX6SDLRM |
906 | * and/or IMX6SLRM section titled MMDC initialization. | 906 | * and/or IMX6SLRM section titled MMDC initialization. |
907 | */ | 907 | */ |
908 | #define MR(val, ba, cmd, cs1) \ | 908 | #define MR(val, ba, cmd, cs1) \ |
909 | ((val << 16) | (1 << 15) | (cmd << 4) | (cs1 << 3) | ba) | 909 | ((val << 16) | (1 << 15) | (cmd << 4) | (cs1 << 3) | ba) |
910 | #define MMDC1(entry, value) do { \ | 910 | #define MMDC1(entry, value) do { \ |
911 | if (!is_mx6sx() && !is_mx6ul() && !is_mx6sl()) \ | 911 | if (!is_mx6sx() && !is_mx6ul() && !is_mx6sl()) \ |
912 | mmdc1->entry = value; \ | 912 | mmdc1->entry = value; \ |
913 | } while (0) | 913 | } while (0) |
914 | 914 | ||
915 | /* | 915 | /* |
916 | * According JESD209-2B-LPDDR2: Table 103 | 916 | * According JESD209-2B-LPDDR2: Table 103 |
917 | * WL: write latency | 917 | * WL: write latency |
918 | */ | 918 | */ |
919 | static int lpddr2_wl(uint32_t mem_speed) | 919 | static int lpddr2_wl(uint32_t mem_speed) |
920 | { | 920 | { |
921 | switch (mem_speed) { | 921 | switch (mem_speed) { |
922 | case 1066: | 922 | case 1066: |
923 | case 933: | 923 | case 933: |
924 | return 4; | 924 | return 4; |
925 | case 800: | 925 | case 800: |
926 | return 3; | 926 | return 3; |
927 | case 677: | 927 | case 677: |
928 | case 533: | 928 | case 533: |
929 | return 2; | 929 | return 2; |
930 | case 400: | 930 | case 400: |
931 | case 333: | 931 | case 333: |
932 | return 1; | 932 | return 1; |
933 | default: | 933 | default: |
934 | puts("invalid memory speed\n"); | 934 | puts("invalid memory speed\n"); |
935 | hang(); | 935 | hang(); |
936 | } | 936 | } |
937 | 937 | ||
938 | return 0; | 938 | return 0; |
939 | } | 939 | } |
940 | 940 | ||
941 | /* | 941 | /* |
942 | * According JESD209-2B-LPDDR2: Table 103 | 942 | * According JESD209-2B-LPDDR2: Table 103 |
943 | * RL: read latency | 943 | * RL: read latency |
944 | */ | 944 | */ |
945 | static int lpddr2_rl(uint32_t mem_speed) | 945 | static int lpddr2_rl(uint32_t mem_speed) |
946 | { | 946 | { |
947 | switch (mem_speed) { | 947 | switch (mem_speed) { |
948 | case 1066: | 948 | case 1066: |
949 | return 8; | 949 | return 8; |
950 | case 933: | 950 | case 933: |
951 | return 7; | 951 | return 7; |
952 | case 800: | 952 | case 800: |
953 | return 6; | 953 | return 6; |
954 | case 677: | 954 | case 677: |
955 | return 5; | 955 | return 5; |
956 | case 533: | 956 | case 533: |
957 | return 4; | 957 | return 4; |
958 | case 400: | 958 | case 400: |
959 | case 333: | 959 | case 333: |
960 | return 3; | 960 | return 3; |
961 | default: | 961 | default: |
962 | puts("invalid memory speed\n"); | 962 | puts("invalid memory speed\n"); |
963 | hang(); | 963 | hang(); |
964 | } | 964 | } |
965 | 965 | ||
966 | return 0; | 966 | return 0; |
967 | } | 967 | } |
968 | 968 | ||
969 | void mx6_lpddr2_cfg(const struct mx6_ddr_sysinfo *sysinfo, | 969 | void mx6_lpddr2_cfg(const struct mx6_ddr_sysinfo *sysinfo, |
970 | const struct mx6_mmdc_calibration *calib, | 970 | const struct mx6_mmdc_calibration *calib, |
971 | const struct mx6_lpddr2_cfg *lpddr2_cfg) | 971 | const struct mx6_lpddr2_cfg *lpddr2_cfg) |
972 | { | 972 | { |
973 | volatile struct mmdc_p_regs *mmdc0; | 973 | volatile struct mmdc_p_regs *mmdc0; |
974 | u32 val; | 974 | u32 val; |
975 | u8 tcke, tcksrx, tcksre, trrd; | 975 | u8 tcke, tcksrx, tcksre, trrd; |
976 | u8 twl, txp, tfaw, tcl; | 976 | u8 twl, txp, tfaw, tcl; |
977 | u16 tras, twr, tmrd, trtp, twtr, trfc, txsr; | 977 | u16 tras, twr, tmrd, trtp, twtr, trfc, txsr; |
978 | u16 trcd_lp, trppb_lp, trpab_lp, trc_lp; | 978 | u16 trcd_lp, trppb_lp, trpab_lp, trc_lp; |
979 | u16 cs0_end; | 979 | u16 cs0_end; |
980 | u8 coladdr; | 980 | u8 coladdr; |
981 | int clkper; /* clock period in picoseconds */ | 981 | int clkper; /* clock period in picoseconds */ |
982 | int clock; /* clock freq in mHz */ | 982 | int clock; /* clock freq in mHz */ |
983 | int cs; | 983 | int cs; |
984 | 984 | ||
985 | /* only support 16/32 bits */ | 985 | /* only support 16/32 bits */ |
986 | if (sysinfo->dsize > 1) | 986 | if (sysinfo->dsize > 1) |
987 | hang(); | 987 | hang(); |
988 | 988 | ||
989 | mmdc0 = (struct mmdc_p_regs *)MMDC_P0_BASE_ADDR; | 989 | mmdc0 = (struct mmdc_p_regs *)MMDC_P0_BASE_ADDR; |
990 | 990 | ||
991 | clock = mxc_get_clock(MXC_DDR_CLK) / 1000000U; | 991 | clock = mxc_get_clock(MXC_DDR_CLK) / 1000000U; |
992 | clkper = (1000 * 1000) / clock; /* pico seconds */ | 992 | clkper = (1000 * 1000) / clock; /* pico seconds */ |
993 | 993 | ||
994 | twl = lpddr2_wl(lpddr2_cfg->mem_speed) - 1; | 994 | twl = lpddr2_wl(lpddr2_cfg->mem_speed) - 1; |
995 | 995 | ||
996 | /* LPDDR2-S2 and LPDDR2-S4 have the same tRFC value. */ | 996 | /* LPDDR2-S2 and LPDDR2-S4 have the same tRFC value. */ |
997 | switch (lpddr2_cfg->density) { | 997 | switch (lpddr2_cfg->density) { |
998 | case 1: | 998 | case 1: |
999 | case 2: | 999 | case 2: |
1000 | case 4: | 1000 | case 4: |
1001 | trfc = DIV_ROUND_UP(130000, clkper) - 1; | 1001 | trfc = DIV_ROUND_UP(130000, clkper) - 1; |
1002 | txsr = DIV_ROUND_UP(140000, clkper) - 1; | 1002 | txsr = DIV_ROUND_UP(140000, clkper) - 1; |
1003 | break; | 1003 | break; |
1004 | case 8: | 1004 | case 8: |
1005 | trfc = DIV_ROUND_UP(210000, clkper) - 1; | 1005 | trfc = DIV_ROUND_UP(210000, clkper) - 1; |
1006 | txsr = DIV_ROUND_UP(220000, clkper) - 1; | 1006 | txsr = DIV_ROUND_UP(220000, clkper) - 1; |
1007 | break; | 1007 | break; |
1008 | default: | 1008 | default: |
1009 | /* | 1009 | /* |
1010 | * 64Mb, 128Mb, 256Mb, 512Mb are not supported currently. | 1010 | * 64Mb, 128Mb, 256Mb, 512Mb are not supported currently. |
1011 | */ | 1011 | */ |
1012 | hang(); | 1012 | hang(); |
1013 | break; | 1013 | break; |
1014 | } | 1014 | } |
1015 | /* | 1015 | /* |
1016 | * txpdll, txpr, taonpd and taofpd are not relevant in LPDDR2 mode, | 1016 | * txpdll, txpr, taonpd and taofpd are not relevant in LPDDR2 mode, |
1017 | * set them to 0. */ | 1017 | * set them to 0. */ |
1018 | txp = DIV_ROUND_UP(7500, clkper) - 1; | 1018 | txp = DIV_ROUND_UP(7500, clkper) - 1; |
1019 | tcke = 3; | 1019 | tcke = 3; |
1020 | if (lpddr2_cfg->mem_speed == 333) | 1020 | if (lpddr2_cfg->mem_speed == 333) |
1021 | tfaw = DIV_ROUND_UP(60000, clkper) - 1; | 1021 | tfaw = DIV_ROUND_UP(60000, clkper) - 1; |
1022 | else | 1022 | else |
1023 | tfaw = DIV_ROUND_UP(50000, clkper) - 1; | 1023 | tfaw = DIV_ROUND_UP(50000, clkper) - 1; |
1024 | trrd = DIV_ROUND_UP(10000, clkper) - 1; | 1024 | trrd = DIV_ROUND_UP(10000, clkper) - 1; |
1025 | 1025 | ||
1026 | /* tckesr for LPDDR2 */ | 1026 | /* tckesr for LPDDR2 */ |
1027 | tcksre = DIV_ROUND_UP(15000, clkper); | 1027 | tcksre = DIV_ROUND_UP(15000, clkper); |
1028 | tcksrx = tcksre; | 1028 | tcksrx = tcksre; |
1029 | twr = DIV_ROUND_UP(15000, clkper) - 1; | 1029 | twr = DIV_ROUND_UP(15000, clkper) - 1; |
1030 | /* | 1030 | /* |
1031 | * tMRR: 2, tMRW: 5 | 1031 | * tMRR: 2, tMRW: 5 |
1032 | * tMRD should be set to max(tMRR, tMRW) | 1032 | * tMRD should be set to max(tMRR, tMRW) |
1033 | */ | 1033 | */ |
1034 | tmrd = 5; | 1034 | tmrd = 5; |
1035 | tras = DIV_ROUND_UP(lpddr2_cfg->trasmin, clkper / 10) - 1; | 1035 | tras = DIV_ROUND_UP(lpddr2_cfg->trasmin, clkper / 10) - 1; |
1036 | /* LPDDR2 mode use tRCD_LP filed in MDCFG3. */ | 1036 | /* LPDDR2 mode use tRCD_LP filed in MDCFG3. */ |
1037 | trcd_lp = DIV_ROUND_UP(lpddr2_cfg->trcd_lp, clkper / 10) - 1; | 1037 | trcd_lp = DIV_ROUND_UP(lpddr2_cfg->trcd_lp, clkper / 10) - 1; |
1038 | trc_lp = DIV_ROUND_UP(lpddr2_cfg->trasmin + lpddr2_cfg->trppb_lp, | 1038 | trc_lp = DIV_ROUND_UP(lpddr2_cfg->trasmin + lpddr2_cfg->trppb_lp, |
1039 | clkper / 10) - 1; | 1039 | clkper / 10) - 1; |
1040 | trppb_lp = DIV_ROUND_UP(lpddr2_cfg->trppb_lp, clkper / 10) - 1; | 1040 | trppb_lp = DIV_ROUND_UP(lpddr2_cfg->trppb_lp, clkper / 10) - 1; |
1041 | trpab_lp = DIV_ROUND_UP(lpddr2_cfg->trpab_lp, clkper / 10) - 1; | 1041 | trpab_lp = DIV_ROUND_UP(lpddr2_cfg->trpab_lp, clkper / 10) - 1; |
1042 | /* To LPDDR2, CL in MDCFG0 refers to RL */ | 1042 | /* To LPDDR2, CL in MDCFG0 refers to RL */ |
1043 | tcl = lpddr2_rl(lpddr2_cfg->mem_speed) - 3; | 1043 | tcl = lpddr2_rl(lpddr2_cfg->mem_speed) - 3; |
1044 | twtr = DIV_ROUND_UP(7500, clkper) - 1; | 1044 | twtr = DIV_ROUND_UP(7500, clkper) - 1; |
1045 | trtp = DIV_ROUND_UP(7500, clkper) - 1; | 1045 | trtp = DIV_ROUND_UP(7500, clkper) - 1; |
1046 | 1046 | ||
1047 | cs0_end = 4 * sysinfo->cs_density - 1; | 1047 | cs0_end = 4 * sysinfo->cs_density - 1; |
1048 | 1048 | ||
1049 | debug("density:%d Gb (%d Gb per chip)\n", | 1049 | debug("density:%d Gb (%d Gb per chip)\n", |
1050 | sysinfo->cs_density, lpddr2_cfg->density); | 1050 | sysinfo->cs_density, lpddr2_cfg->density); |
1051 | debug("clock: %dMHz (%d ps)\n", clock, clkper); | 1051 | debug("clock: %dMHz (%d ps)\n", clock, clkper); |
1052 | debug("memspd:%d\n", lpddr2_cfg->mem_speed); | 1052 | debug("memspd:%d\n", lpddr2_cfg->mem_speed); |
1053 | debug("trcd_lp=%d\n", trcd_lp); | 1053 | debug("trcd_lp=%d\n", trcd_lp); |
1054 | debug("trppb_lp=%d\n", trppb_lp); | 1054 | debug("trppb_lp=%d\n", trppb_lp); |
1055 | debug("trpab_lp=%d\n", trpab_lp); | 1055 | debug("trpab_lp=%d\n", trpab_lp); |
1056 | debug("trc_lp=%d\n", trc_lp); | 1056 | debug("trc_lp=%d\n", trc_lp); |
1057 | debug("tcke=%d\n", tcke); | 1057 | debug("tcke=%d\n", tcke); |
1058 | debug("tcksrx=%d\n", tcksrx); | 1058 | debug("tcksrx=%d\n", tcksrx); |
1059 | debug("tcksre=%d\n", tcksre); | 1059 | debug("tcksre=%d\n", tcksre); |
1060 | debug("trfc=%d\n", trfc); | 1060 | debug("trfc=%d\n", trfc); |
1061 | debug("txsr=%d\n", txsr); | 1061 | debug("txsr=%d\n", txsr); |
1062 | debug("txp=%d\n", txp); | 1062 | debug("txp=%d\n", txp); |
1063 | debug("tfaw=%d\n", tfaw); | 1063 | debug("tfaw=%d\n", tfaw); |
1064 | debug("tcl=%d\n", tcl); | 1064 | debug("tcl=%d\n", tcl); |
1065 | debug("tras=%d\n", tras); | 1065 | debug("tras=%d\n", tras); |
1066 | debug("twr=%d\n", twr); | 1066 | debug("twr=%d\n", twr); |
1067 | debug("tmrd=%d\n", tmrd); | 1067 | debug("tmrd=%d\n", tmrd); |
1068 | debug("twl=%d\n", twl); | 1068 | debug("twl=%d\n", twl); |
1069 | debug("trtp=%d\n", trtp); | 1069 | debug("trtp=%d\n", trtp); |
1070 | debug("twtr=%d\n", twtr); | 1070 | debug("twtr=%d\n", twtr); |
1071 | debug("trrd=%d\n", trrd); | 1071 | debug("trrd=%d\n", trrd); |
1072 | debug("cs0_end=%d\n", cs0_end); | 1072 | debug("cs0_end=%d\n", cs0_end); |
1073 | debug("ncs=%d\n", sysinfo->ncs); | 1073 | debug("ncs=%d\n", sysinfo->ncs); |
1074 | 1074 | ||
1075 | /* | 1075 | /* |
1076 | * board-specific configuration: | 1076 | * board-specific configuration: |
1077 | * These values are determined empirically and vary per board layout | 1077 | * These values are determined empirically and vary per board layout |
1078 | */ | 1078 | */ |
1079 | mmdc0->mpwldectrl0 = calib->p0_mpwldectrl0; | 1079 | mmdc0->mpwldectrl0 = calib->p0_mpwldectrl0; |
1080 | mmdc0->mpwldectrl1 = calib->p0_mpwldectrl1; | 1080 | mmdc0->mpwldectrl1 = calib->p0_mpwldectrl1; |
1081 | mmdc0->mpdgctrl0 = calib->p0_mpdgctrl0; | 1081 | mmdc0->mpdgctrl0 = calib->p0_mpdgctrl0; |
1082 | mmdc0->mpdgctrl1 = calib->p0_mpdgctrl1; | 1082 | mmdc0->mpdgctrl1 = calib->p0_mpdgctrl1; |
1083 | mmdc0->mprddlctl = calib->p0_mprddlctl; | 1083 | mmdc0->mprddlctl = calib->p0_mprddlctl; |
1084 | mmdc0->mpwrdlctl = calib->p0_mpwrdlctl; | 1084 | mmdc0->mpwrdlctl = calib->p0_mpwrdlctl; |
1085 | mmdc0->mpzqlp2ctl = calib->mpzqlp2ctl; | 1085 | mmdc0->mpzqlp2ctl = calib->mpzqlp2ctl; |
1086 | 1086 | ||
1087 | /* Read data DQ Byte0-3 delay */ | 1087 | /* Read data DQ Byte0-3 delay */ |
1088 | mmdc0->mprddqby0dl = 0x33333333; | 1088 | mmdc0->mprddqby0dl = 0x33333333; |
1089 | mmdc0->mprddqby1dl = 0x33333333; | 1089 | mmdc0->mprddqby1dl = 0x33333333; |
1090 | if (sysinfo->dsize > 0) { | 1090 | if (sysinfo->dsize > 0) { |
1091 | mmdc0->mprddqby2dl = 0x33333333; | 1091 | mmdc0->mprddqby2dl = 0x33333333; |
1092 | mmdc0->mprddqby3dl = 0x33333333; | 1092 | mmdc0->mprddqby3dl = 0x33333333; |
1093 | } | 1093 | } |
1094 | 1094 | ||
1095 | /* Write data DQ Byte0-3 delay */ | 1095 | /* Write data DQ Byte0-3 delay */ |
1096 | mmdc0->mpwrdqby0dl = 0xf3333333; | 1096 | mmdc0->mpwrdqby0dl = 0xf3333333; |
1097 | mmdc0->mpwrdqby1dl = 0xf3333333; | 1097 | mmdc0->mpwrdqby1dl = 0xf3333333; |
1098 | if (sysinfo->dsize > 0) { | 1098 | if (sysinfo->dsize > 0) { |
1099 | mmdc0->mpwrdqby2dl = 0xf3333333; | 1099 | mmdc0->mpwrdqby2dl = 0xf3333333; |
1100 | mmdc0->mpwrdqby3dl = 0xf3333333; | 1100 | mmdc0->mpwrdqby3dl = 0xf3333333; |
1101 | } | 1101 | } |
1102 | 1102 | ||
1103 | /* | 1103 | /* |
1104 | * In LPDDR2 mode this register should be cleared, | 1104 | * In LPDDR2 mode this register should be cleared, |
1105 | * so no termination will be activated. | 1105 | * so no termination will be activated. |
1106 | */ | 1106 | */ |
1107 | mmdc0->mpodtctrl = 0; | 1107 | mmdc0->mpodtctrl = 0; |
1108 | 1108 | ||
1109 | /* complete calibration */ | 1109 | /* complete calibration */ |
1110 | val = (1 << 11); /* Force measurement on delay-lines */ | 1110 | val = (1 << 11); /* Force measurement on delay-lines */ |
1111 | mmdc0->mpmur0 = val; | 1111 | mmdc0->mpmur0 = val; |
1112 | 1112 | ||
1113 | /* Step 1: configuration request */ | 1113 | /* Step 1: configuration request */ |
1114 | mmdc0->mdscr = (u32)(1 << 15); /* config request */ | 1114 | mmdc0->mdscr = (u32)(1 << 15); /* config request */ |
1115 | 1115 | ||
1116 | /* Step 2: Timing configuration */ | 1116 | /* Step 2: Timing configuration */ |
1117 | mmdc0->mdcfg0 = (trfc << 24) | (txsr << 16) | (txp << 13) | | 1117 | mmdc0->mdcfg0 = (trfc << 24) | (txsr << 16) | (txp << 13) | |
1118 | (tfaw << 4) | tcl; | 1118 | (tfaw << 4) | tcl; |
1119 | mmdc0->mdcfg1 = (tras << 16) | (twr << 9) | (tmrd << 5) | twl; | 1119 | mmdc0->mdcfg1 = (tras << 16) | (twr << 9) | (tmrd << 5) | twl; |
1120 | mmdc0->mdcfg2 = (trtp << 6) | (twtr << 3) | trrd; | 1120 | mmdc0->mdcfg2 = (trtp << 6) | (twtr << 3) | trrd; |
1121 | mmdc0->mdcfg3lp = (trc_lp << 16) | (trcd_lp << 8) | | 1121 | mmdc0->mdcfg3lp = (trc_lp << 16) | (trcd_lp << 8) | |
1122 | (trppb_lp << 4) | trpab_lp; | 1122 | (trppb_lp << 4) | trpab_lp; |
1123 | mmdc0->mdotc = 0; | 1123 | mmdc0->mdotc = 0; |
1124 | 1124 | ||
1125 | mmdc0->mdasp = cs0_end; /* CS addressing */ | 1125 | mmdc0->mdasp = cs0_end; /* CS addressing */ |
1126 | 1126 | ||
1127 | /* Step 3: Configure DDR type */ | 1127 | /* Step 3: Configure DDR type */ |
1128 | mmdc0->mdmisc = (sysinfo->cs1_mirror << 19) | (sysinfo->walat << 16) | | 1128 | mmdc0->mdmisc = (sysinfo->cs1_mirror << 19) | (sysinfo->walat << 16) | |
1129 | (sysinfo->bi_on << 12) | (sysinfo->mif3_mode << 9) | | 1129 | (sysinfo->bi_on << 12) | (sysinfo->mif3_mode << 9) | |
1130 | (sysinfo->ralat << 6) | (1 << 3); | 1130 | (sysinfo->ralat << 6) | (1 << 3); |
1131 | 1131 | ||
1132 | /* Step 4: Configure delay while leaving reset */ | 1132 | /* Step 4: Configure delay while leaving reset */ |
1133 | mmdc0->mdor = (sysinfo->sde_to_rst << 8) | | 1133 | mmdc0->mdor = (sysinfo->sde_to_rst << 8) | |
1134 | (sysinfo->rst_to_cke << 0); | 1134 | (sysinfo->rst_to_cke << 0); |
1135 | 1135 | ||
1136 | /* Step 5: Configure DDR physical parameters (density and burst len) */ | 1136 | /* Step 5: Configure DDR physical parameters (density and burst len) */ |
1137 | coladdr = lpddr2_cfg->coladdr; | 1137 | coladdr = lpddr2_cfg->coladdr; |
1138 | if (lpddr2_cfg->coladdr == 8) /* 8-bit COL is 0x3 */ | 1138 | if (lpddr2_cfg->coladdr == 8) /* 8-bit COL is 0x3 */ |
1139 | coladdr += 4; | 1139 | coladdr += 4; |
1140 | else if (lpddr2_cfg->coladdr == 12) /* 12-bit COL is 0x4 */ | 1140 | else if (lpddr2_cfg->coladdr == 12) /* 12-bit COL is 0x4 */ |
1141 | coladdr += 1; | 1141 | coladdr += 1; |
1142 | mmdc0->mdctl = (lpddr2_cfg->rowaddr - 11) << 24 | /* ROW */ | 1142 | mmdc0->mdctl = (lpddr2_cfg->rowaddr - 11) << 24 | /* ROW */ |
1143 | (coladdr - 9) << 20 | /* COL */ | 1143 | (coladdr - 9) << 20 | /* COL */ |
1144 | (0 << 19) | /* Burst Length = 4 for LPDDR2 */ | 1144 | (0 << 19) | /* Burst Length = 4 for LPDDR2 */ |
1145 | (sysinfo->dsize << 16); /* DDR data bus size */ | 1145 | (sysinfo->dsize << 16); /* DDR data bus size */ |
1146 | 1146 | ||
1147 | /* Step 6: Perform ZQ calibration */ | 1147 | /* Step 6: Perform ZQ calibration */ |
1148 | val = 0xa1390003; /* one-time HW ZQ calib */ | 1148 | val = 0xa1390003; /* one-time HW ZQ calib */ |
1149 | mmdc0->mpzqhwctrl = val; | 1149 | mmdc0->mpzqhwctrl = val; |
1150 | 1150 | ||
1151 | /* Step 7: Enable MMDC with desired chip select */ | 1151 | /* Step 7: Enable MMDC with desired chip select */ |
1152 | mmdc0->mdctl |= (1 << 31) | /* SDE_0 for CS0 */ | 1152 | mmdc0->mdctl |= (1 << 31) | /* SDE_0 for CS0 */ |
1153 | ((sysinfo->ncs == 2) ? 1 : 0) << 30; /* SDE_1 for CS1 */ | 1153 | ((sysinfo->ncs == 2) ? 1 : 0) << 30; /* SDE_1 for CS1 */ |
1154 | 1154 | ||
1155 | /* Step 8: Write Mode Registers to Init LPDDR2 devices */ | 1155 | /* Step 8: Write Mode Registers to Init LPDDR2 devices */ |
1156 | for (cs = 0; cs < sysinfo->ncs; cs++) { | 1156 | for (cs = 0; cs < sysinfo->ncs; cs++) { |
1157 | /* MR63: reset */ | 1157 | /* MR63: reset */ |
1158 | mmdc0->mdscr = MR(63, 0, 3, cs); | 1158 | mmdc0->mdscr = MR(63, 0, 3, cs); |
1159 | /* MR10: calibration, | 1159 | /* MR10: calibration, |
1160 | * 0xff is calibration command after intilization. | 1160 | * 0xff is calibration command after intilization. |
1161 | */ | 1161 | */ |
1162 | val = 0xA | (0xff << 8); | 1162 | val = 0xA | (0xff << 8); |
1163 | mmdc0->mdscr = MR(val, 0, 3, cs); | 1163 | mmdc0->mdscr = MR(val, 0, 3, cs); |
1164 | /* MR1 */ | 1164 | /* MR1 */ |
1165 | val = 0x1 | (0x82 << 8); | 1165 | val = 0x1 | (0x82 << 8); |
1166 | mmdc0->mdscr = MR(val, 0, 3, cs); | 1166 | mmdc0->mdscr = MR(val, 0, 3, cs); |
1167 | /* MR2 */ | 1167 | /* MR2 */ |
1168 | val = 0x2 | (0x04 << 8); | 1168 | val = 0x2 | (0x04 << 8); |
1169 | mmdc0->mdscr = MR(val, 0, 3, cs); | 1169 | mmdc0->mdscr = MR(val, 0, 3, cs); |
1170 | /* MR3 */ | 1170 | /* MR3 */ |
1171 | val = 0x3 | (0x02 << 8); | 1171 | val = 0x3 | (0x02 << 8); |
1172 | mmdc0->mdscr = MR(val, 0, 3, cs); | 1172 | mmdc0->mdscr = MR(val, 0, 3, cs); |
1173 | } | 1173 | } |
1174 | 1174 | ||
1175 | /* Step 10: Power down control and self-refresh */ | 1175 | /* Step 10: Power down control and self-refresh */ |
1176 | mmdc0->mdpdc = (tcke & 0x7) << 16 | | 1176 | mmdc0->mdpdc = (tcke & 0x7) << 16 | |
1177 | 5 << 12 | /* PWDT_1: 256 cycles */ | 1177 | 5 << 12 | /* PWDT_1: 256 cycles */ |
1178 | 5 << 8 | /* PWDT_0: 256 cycles */ | 1178 | 5 << 8 | /* PWDT_0: 256 cycles */ |
1179 | 1 << 6 | /* BOTH_CS_PD */ | 1179 | 1 << 6 | /* BOTH_CS_PD */ |
1180 | (tcksrx & 0x7) << 3 | | 1180 | (tcksrx & 0x7) << 3 | |
1181 | (tcksre & 0x7); | 1181 | (tcksre & 0x7); |
1182 | mmdc0->mapsr = 0x00001006; /* ADOPT power down enabled */ | 1182 | mmdc0->mapsr = 0x00001006; /* ADOPT power down enabled */ |
1183 | 1183 | ||
1184 | /* Step 11: Configure ZQ calibration: one-time and periodic 1ms */ | 1184 | /* Step 11: Configure ZQ calibration: one-time and periodic 1ms */ |
1185 | val = 0xa1310003; | 1185 | val = 0xa1310003; |
1186 | mmdc0->mpzqhwctrl = val; | 1186 | mmdc0->mpzqhwctrl = val; |
1187 | 1187 | ||
1188 | /* Step 12: Configure and activate periodic refresh */ | 1188 | /* Step 12: Configure and activate periodic refresh */ |
1189 | mmdc0->mdref = (sysinfo->refsel << 14) | (sysinfo->refr << 11); | 1189 | mmdc0->mdref = (sysinfo->refsel << 14) | (sysinfo->refr << 11); |
1190 | 1190 | ||
1191 | /* Step 13: Deassert config request - init complete */ | 1191 | /* Step 13: Deassert config request - init complete */ |
1192 | mmdc0->mdscr = 0x00000000; | 1192 | mmdc0->mdscr = 0x00000000; |
1193 | 1193 | ||
1194 | /* wait for auto-ZQ calibration to complete */ | 1194 | /* wait for auto-ZQ calibration to complete */ |
1195 | mdelay(1); | 1195 | mdelay(1); |
1196 | } | 1196 | } |
1197 | 1197 | ||
1198 | void mx6_ddr3_cfg(const struct mx6_ddr_sysinfo *sysinfo, | 1198 | void mx6_ddr3_cfg(const struct mx6_ddr_sysinfo *sysinfo, |
1199 | const struct mx6_mmdc_calibration *calib, | 1199 | const struct mx6_mmdc_calibration *calib, |
1200 | const struct mx6_ddr3_cfg *ddr3_cfg) | 1200 | const struct mx6_ddr3_cfg *ddr3_cfg) |
1201 | { | 1201 | { |
1202 | volatile struct mmdc_p_regs *mmdc0; | 1202 | volatile struct mmdc_p_regs *mmdc0; |
1203 | volatile struct mmdc_p_regs *mmdc1; | 1203 | volatile struct mmdc_p_regs *mmdc1; |
1204 | u32 val; | 1204 | u32 val; |
1205 | u8 tcke, tcksrx, tcksre, txpdll, taofpd, taonpd, trrd; | 1205 | u8 tcke, tcksrx, tcksre, txpdll, taofpd, taonpd, trrd; |
1206 | u8 todtlon, taxpd, tanpd, tcwl, txp, tfaw, tcl; | 1206 | u8 todtlon, taxpd, tanpd, tcwl, txp, tfaw, tcl; |
1207 | u8 todt_idle_off = 0x4; /* from DDR3 Script Aid spreadsheet */ | 1207 | u8 todt_idle_off = 0x4; /* from DDR3 Script Aid spreadsheet */ |
1208 | u16 trcd, trc, tras, twr, tmrd, trtp, trp, twtr, trfc, txs, txpr; | 1208 | u16 trcd, trc, tras, twr, tmrd, trtp, trp, twtr, trfc, txs, txpr; |
1209 | u16 cs0_end; | 1209 | u16 cs0_end; |
1210 | u16 tdllk = 0x1ff; /* DLL locking time: 512 cycles (JEDEC DDR3) */ | 1210 | u16 tdllk = 0x1ff; /* DLL locking time: 512 cycles (JEDEC DDR3) */ |
1211 | u8 coladdr; | 1211 | u8 coladdr; |
1212 | int clkper; /* clock period in picoseconds */ | 1212 | int clkper; /* clock period in picoseconds */ |
1213 | int clock; /* clock freq in MHz */ | 1213 | int clock; /* clock freq in MHz */ |
1214 | int cs; | 1214 | int cs; |
1215 | u16 mem_speed = ddr3_cfg->mem_speed; | 1215 | u16 mem_speed = ddr3_cfg->mem_speed; |
1216 | 1216 | ||
1217 | mmdc0 = (struct mmdc_p_regs *)MMDC_P0_BASE_ADDR; | 1217 | mmdc0 = (struct mmdc_p_regs *)MMDC_P0_BASE_ADDR; |
1218 | if (!is_mx6sx() && !is_mx6ul() && !is_mx6sl()) | 1218 | if (!is_mx6sx() && !is_mx6ul() && !is_mx6sl()) |
1219 | mmdc1 = (struct mmdc_p_regs *)MMDC_P1_BASE_ADDR; | 1219 | mmdc1 = (struct mmdc_p_regs *)MMDC_P1_BASE_ADDR; |
1220 | 1220 | ||
1221 | /* Limit mem_speed for MX6D/MX6Q */ | 1221 | /* Limit mem_speed for MX6D/MX6Q */ |
1222 | if (is_mx6dq() || is_mx6dqp()) { | 1222 | if (is_mx6dq() || is_mx6dqp()) { |
1223 | if (mem_speed > 1066) | 1223 | if (mem_speed > 1066) |
1224 | mem_speed = 1066; /* 1066 MT/s */ | 1224 | mem_speed = 1066; /* 1066 MT/s */ |
1225 | 1225 | ||
1226 | tcwl = 4; | 1226 | tcwl = 4; |
1227 | } | 1227 | } |
1228 | /* Limit mem_speed for MX6S/MX6DL */ | 1228 | /* Limit mem_speed for MX6S/MX6DL */ |
1229 | else { | 1229 | else { |
1230 | if (mem_speed > 800) | 1230 | if (mem_speed > 800) |
1231 | mem_speed = 800; /* 800 MT/s */ | 1231 | mem_speed = 800; /* 800 MT/s */ |
1232 | 1232 | ||
1233 | tcwl = 3; | 1233 | tcwl = 3; |
1234 | } | 1234 | } |
1235 | 1235 | ||
1236 | clock = mem_speed / 2; | 1236 | clock = mem_speed / 2; |
1237 | /* | 1237 | /* |
1238 | * Data rate of 1066 MT/s requires 533 MHz DDR3 clock, but MX6D/Q supports | 1238 | * Data rate of 1066 MT/s requires 533 MHz DDR3 clock, but MX6D/Q supports |
1239 | * up to 528 MHz, so reduce the clock to fit chip specs | 1239 | * up to 528 MHz, so reduce the clock to fit chip specs |
1240 | */ | 1240 | */ |
1241 | if (is_mx6dq() || is_mx6dqp()) { | 1241 | if (is_mx6dq() || is_mx6dqp()) { |
1242 | if (clock > 528) | 1242 | if (clock > 528) |
1243 | clock = 528; /* 528 MHz */ | 1243 | clock = 528; /* 528 MHz */ |
1244 | } | 1244 | } |
1245 | 1245 | ||
1246 | clkper = (1000 * 1000) / clock; /* pico seconds */ | 1246 | clkper = (1000 * 1000) / clock; /* pico seconds */ |
1247 | todtlon = tcwl; | 1247 | todtlon = tcwl; |
1248 | taxpd = tcwl; | 1248 | taxpd = tcwl; |
1249 | tanpd = tcwl; | 1249 | tanpd = tcwl; |
1250 | 1250 | ||
1251 | switch (ddr3_cfg->density) { | 1251 | switch (ddr3_cfg->density) { |
1252 | case 1: /* 1Gb per chip */ | 1252 | case 1: /* 1Gb per chip */ |
1253 | trfc = DIV_ROUND_UP(110000, clkper) - 1; | 1253 | trfc = DIV_ROUND_UP(110000, clkper) - 1; |
1254 | txs = DIV_ROUND_UP(120000, clkper) - 1; | 1254 | txs = DIV_ROUND_UP(120000, clkper) - 1; |
1255 | break; | 1255 | break; |
1256 | case 2: /* 2Gb per chip */ | 1256 | case 2: /* 2Gb per chip */ |
1257 | trfc = DIV_ROUND_UP(160000, clkper) - 1; | 1257 | trfc = DIV_ROUND_UP(160000, clkper) - 1; |
1258 | txs = DIV_ROUND_UP(170000, clkper) - 1; | 1258 | txs = DIV_ROUND_UP(170000, clkper) - 1; |
1259 | break; | 1259 | break; |
1260 | case 4: /* 4Gb per chip */ | 1260 | case 4: /* 4Gb per chip */ |
1261 | trfc = DIV_ROUND_UP(260000, clkper) - 1; | 1261 | trfc = DIV_ROUND_UP(260000, clkper) - 1; |
1262 | txs = DIV_ROUND_UP(270000, clkper) - 1; | 1262 | txs = DIV_ROUND_UP(270000, clkper) - 1; |
1263 | break; | 1263 | break; |
1264 | case 8: /* 8Gb per chip */ | 1264 | case 8: /* 8Gb per chip */ |
1265 | trfc = DIV_ROUND_UP(350000, clkper) - 1; | 1265 | trfc = DIV_ROUND_UP(350000, clkper) - 1; |
1266 | txs = DIV_ROUND_UP(360000, clkper) - 1; | 1266 | txs = DIV_ROUND_UP(360000, clkper) - 1; |
1267 | break; | 1267 | break; |
1268 | default: | 1268 | default: |
1269 | /* invalid density */ | 1269 | /* invalid density */ |
1270 | puts("invalid chip density\n"); | 1270 | puts("invalid chip density\n"); |
1271 | hang(); | 1271 | hang(); |
1272 | break; | 1272 | break; |
1273 | } | 1273 | } |
1274 | txpr = txs; | 1274 | txpr = txs; |
1275 | 1275 | ||
1276 | switch (mem_speed) { | 1276 | switch (mem_speed) { |
1277 | case 800: | 1277 | case 800: |
1278 | txp = DIV_ROUND_UP(max(3 * clkper, 7500), clkper) - 1; | 1278 | txp = DIV_ROUND_UP(max(3 * clkper, 7500), clkper) - 1; |
1279 | tcke = DIV_ROUND_UP(max(3 * clkper, 7500), clkper) - 1; | 1279 | tcke = DIV_ROUND_UP(max(3 * clkper, 7500), clkper) - 1; |
1280 | if (ddr3_cfg->pagesz == 1) { | 1280 | if (ddr3_cfg->pagesz == 1) { |
1281 | tfaw = DIV_ROUND_UP(40000, clkper) - 1; | 1281 | tfaw = DIV_ROUND_UP(40000, clkper) - 1; |
1282 | trrd = DIV_ROUND_UP(max(4 * clkper, 10000), clkper) - 1; | 1282 | trrd = DIV_ROUND_UP(max(4 * clkper, 10000), clkper) - 1; |
1283 | } else { | 1283 | } else { |
1284 | tfaw = DIV_ROUND_UP(50000, clkper) - 1; | 1284 | tfaw = DIV_ROUND_UP(50000, clkper) - 1; |
1285 | trrd = DIV_ROUND_UP(max(4 * clkper, 10000), clkper) - 1; | 1285 | trrd = DIV_ROUND_UP(max(4 * clkper, 10000), clkper) - 1; |
1286 | } | 1286 | } |
1287 | break; | 1287 | break; |
1288 | case 1066: | 1288 | case 1066: |
1289 | txp = DIV_ROUND_UP(max(3 * clkper, 7500), clkper) - 1; | 1289 | txp = DIV_ROUND_UP(max(3 * clkper, 7500), clkper) - 1; |
1290 | tcke = DIV_ROUND_UP(max(3 * clkper, 5625), clkper) - 1; | 1290 | tcke = DIV_ROUND_UP(max(3 * clkper, 5625), clkper) - 1; |
1291 | if (ddr3_cfg->pagesz == 1) { | 1291 | if (ddr3_cfg->pagesz == 1) { |
1292 | tfaw = DIV_ROUND_UP(37500, clkper) - 1; | 1292 | tfaw = DIV_ROUND_UP(37500, clkper) - 1; |
1293 | trrd = DIV_ROUND_UP(max(4 * clkper, 7500), clkper) - 1; | 1293 | trrd = DIV_ROUND_UP(max(4 * clkper, 7500), clkper) - 1; |
1294 | } else { | 1294 | } else { |
1295 | tfaw = DIV_ROUND_UP(50000, clkper) - 1; | 1295 | tfaw = DIV_ROUND_UP(50000, clkper) - 1; |
1296 | trrd = DIV_ROUND_UP(max(4 * clkper, 10000), clkper) - 1; | 1296 | trrd = DIV_ROUND_UP(max(4 * clkper, 10000), clkper) - 1; |
1297 | } | 1297 | } |
1298 | break; | 1298 | break; |
1299 | default: | 1299 | default: |
1300 | puts("invalid memory speed\n"); | 1300 | puts("invalid memory speed\n"); |
1301 | hang(); | 1301 | hang(); |
1302 | break; | 1302 | break; |
1303 | } | 1303 | } |
1304 | txpdll = DIV_ROUND_UP(max(10 * clkper, 24000), clkper) - 1; | 1304 | txpdll = DIV_ROUND_UP(max(10 * clkper, 24000), clkper) - 1; |
1305 | tcksre = DIV_ROUND_UP(max(5 * clkper, 10000), clkper); | 1305 | tcksre = DIV_ROUND_UP(max(5 * clkper, 10000), clkper); |
1306 | taonpd = DIV_ROUND_UP(2000, clkper) - 1; | 1306 | taonpd = DIV_ROUND_UP(2000, clkper) - 1; |
1307 | tcksrx = tcksre; | 1307 | tcksrx = tcksre; |
1308 | taofpd = taonpd; | 1308 | taofpd = taonpd; |
1309 | twr = DIV_ROUND_UP(15000, clkper) - 1; | 1309 | twr = DIV_ROUND_UP(15000, clkper) - 1; |
1310 | tmrd = DIV_ROUND_UP(max(12 * clkper, 15000), clkper) - 1; | 1310 | tmrd = DIV_ROUND_UP(max(12 * clkper, 15000), clkper) - 1; |
1311 | trc = DIV_ROUND_UP(ddr3_cfg->trcmin, clkper / 10) - 1; | 1311 | trc = DIV_ROUND_UP(ddr3_cfg->trcmin, clkper / 10) - 1; |
1312 | tras = DIV_ROUND_UP(ddr3_cfg->trasmin, clkper / 10) - 1; | 1312 | tras = DIV_ROUND_UP(ddr3_cfg->trasmin, clkper / 10) - 1; |
1313 | tcl = DIV_ROUND_UP(ddr3_cfg->trcd, clkper / 10) - 3; | 1313 | tcl = DIV_ROUND_UP(ddr3_cfg->trcd, clkper / 10) - 3; |
1314 | trp = DIV_ROUND_UP(ddr3_cfg->trcd, clkper / 10) - 1; | 1314 | trp = DIV_ROUND_UP(ddr3_cfg->trcd, clkper / 10) - 1; |
1315 | twtr = ROUND(max(4 * clkper, 7500) / clkper, 1) - 1; | 1315 | twtr = ROUND(max(4 * clkper, 7500) / clkper, 1) - 1; |
1316 | trcd = trp; | 1316 | trcd = trp; |
1317 | trtp = twtr; | 1317 | trtp = twtr; |
1318 | cs0_end = 4 * sysinfo->cs_density - 1; | 1318 | cs0_end = 4 * sysinfo->cs_density - 1; |
1319 | 1319 | ||
1320 | debug("density:%d Gb (%d Gb per chip)\n", | 1320 | debug("density:%d Gb (%d Gb per chip)\n", |
1321 | sysinfo->cs_density, ddr3_cfg->density); | 1321 | sysinfo->cs_density, ddr3_cfg->density); |
1322 | debug("clock: %dMHz (%d ps)\n", clock, clkper); | 1322 | debug("clock: %dMHz (%d ps)\n", clock, clkper); |
1323 | debug("memspd:%d\n", mem_speed); | 1323 | debug("memspd:%d\n", mem_speed); |
1324 | debug("tcke=%d\n", tcke); | 1324 | debug("tcke=%d\n", tcke); |
1325 | debug("tcksrx=%d\n", tcksrx); | 1325 | debug("tcksrx=%d\n", tcksrx); |
1326 | debug("tcksre=%d\n", tcksre); | 1326 | debug("tcksre=%d\n", tcksre); |
1327 | debug("taofpd=%d\n", taofpd); | 1327 | debug("taofpd=%d\n", taofpd); |
1328 | debug("taonpd=%d\n", taonpd); | 1328 | debug("taonpd=%d\n", taonpd); |
1329 | debug("todtlon=%d\n", todtlon); | 1329 | debug("todtlon=%d\n", todtlon); |
1330 | debug("tanpd=%d\n", tanpd); | 1330 | debug("tanpd=%d\n", tanpd); |
1331 | debug("taxpd=%d\n", taxpd); | 1331 | debug("taxpd=%d\n", taxpd); |
1332 | debug("trfc=%d\n", trfc); | 1332 | debug("trfc=%d\n", trfc); |
1333 | debug("txs=%d\n", txs); | 1333 | debug("txs=%d\n", txs); |
1334 | debug("txp=%d\n", txp); | 1334 | debug("txp=%d\n", txp); |
1335 | debug("txpdll=%d\n", txpdll); | 1335 | debug("txpdll=%d\n", txpdll); |
1336 | debug("tfaw=%d\n", tfaw); | 1336 | debug("tfaw=%d\n", tfaw); |
1337 | debug("tcl=%d\n", tcl); | 1337 | debug("tcl=%d\n", tcl); |
1338 | debug("trcd=%d\n", trcd); | 1338 | debug("trcd=%d\n", trcd); |
1339 | debug("trp=%d\n", trp); | 1339 | debug("trp=%d\n", trp); |
1340 | debug("trc=%d\n", trc); | 1340 | debug("trc=%d\n", trc); |
1341 | debug("tras=%d\n", tras); | 1341 | debug("tras=%d\n", tras); |
1342 | debug("twr=%d\n", twr); | 1342 | debug("twr=%d\n", twr); |
1343 | debug("tmrd=%d\n", tmrd); | 1343 | debug("tmrd=%d\n", tmrd); |
1344 | debug("tcwl=%d\n", tcwl); | 1344 | debug("tcwl=%d\n", tcwl); |
1345 | debug("tdllk=%d\n", tdllk); | 1345 | debug("tdllk=%d\n", tdllk); |
1346 | debug("trtp=%d\n", trtp); | 1346 | debug("trtp=%d\n", trtp); |
1347 | debug("twtr=%d\n", twtr); | 1347 | debug("twtr=%d\n", twtr); |
1348 | debug("trrd=%d\n", trrd); | 1348 | debug("trrd=%d\n", trrd); |
1349 | debug("txpr=%d\n", txpr); | 1349 | debug("txpr=%d\n", txpr); |
1350 | debug("cs0_end=%d\n", cs0_end); | 1350 | debug("cs0_end=%d\n", cs0_end); |
1351 | debug("ncs=%d\n", sysinfo->ncs); | 1351 | debug("ncs=%d\n", sysinfo->ncs); |
1352 | debug("Rtt_wr=%d\n", sysinfo->rtt_wr); | 1352 | debug("Rtt_wr=%d\n", sysinfo->rtt_wr); |
1353 | debug("Rtt_nom=%d\n", sysinfo->rtt_nom); | 1353 | debug("Rtt_nom=%d\n", sysinfo->rtt_nom); |
1354 | debug("SRT=%d\n", ddr3_cfg->SRT); | 1354 | debug("SRT=%d\n", ddr3_cfg->SRT); |
1355 | debug("twr=%d\n", twr); | 1355 | debug("twr=%d\n", twr); |
1356 | 1356 | ||
1357 | /* | 1357 | /* |
1358 | * board-specific configuration: | 1358 | * board-specific configuration: |
1359 | * These values are determined empirically and vary per board layout | 1359 | * These values are determined empirically and vary per board layout |
1360 | * see: | 1360 | * see: |
1361 | * appnote, ddr3 spreadsheet | 1361 | * appnote, ddr3 spreadsheet |
1362 | */ | 1362 | */ |
1363 | mmdc0->mpwldectrl0 = calib->p0_mpwldectrl0; | 1363 | mmdc0->mpwldectrl0 = calib->p0_mpwldectrl0; |
1364 | mmdc0->mpwldectrl1 = calib->p0_mpwldectrl1; | 1364 | mmdc0->mpwldectrl1 = calib->p0_mpwldectrl1; |
1365 | mmdc0->mpdgctrl0 = calib->p0_mpdgctrl0; | 1365 | mmdc0->mpdgctrl0 = calib->p0_mpdgctrl0; |
1366 | mmdc0->mpdgctrl1 = calib->p0_mpdgctrl1; | 1366 | mmdc0->mpdgctrl1 = calib->p0_mpdgctrl1; |
1367 | mmdc0->mprddlctl = calib->p0_mprddlctl; | 1367 | mmdc0->mprddlctl = calib->p0_mprddlctl; |
1368 | mmdc0->mpwrdlctl = calib->p0_mpwrdlctl; | 1368 | mmdc0->mpwrdlctl = calib->p0_mpwrdlctl; |
1369 | if (sysinfo->dsize > 1) { | 1369 | if (sysinfo->dsize > 1) { |
1370 | MMDC1(mpwldectrl0, calib->p1_mpwldectrl0); | 1370 | MMDC1(mpwldectrl0, calib->p1_mpwldectrl0); |
1371 | MMDC1(mpwldectrl1, calib->p1_mpwldectrl1); | 1371 | MMDC1(mpwldectrl1, calib->p1_mpwldectrl1); |
1372 | MMDC1(mpdgctrl0, calib->p1_mpdgctrl0); | 1372 | MMDC1(mpdgctrl0, calib->p1_mpdgctrl0); |
1373 | MMDC1(mpdgctrl1, calib->p1_mpdgctrl1); | 1373 | MMDC1(mpdgctrl1, calib->p1_mpdgctrl1); |
1374 | MMDC1(mprddlctl, calib->p1_mprddlctl); | 1374 | MMDC1(mprddlctl, calib->p1_mprddlctl); |
1375 | MMDC1(mpwrdlctl, calib->p1_mpwrdlctl); | 1375 | MMDC1(mpwrdlctl, calib->p1_mpwrdlctl); |
1376 | } | 1376 | } |
1377 | 1377 | ||
1378 | /* Read data DQ Byte0-3 delay */ | 1378 | /* Read data DQ Byte0-3 delay */ |
1379 | mmdc0->mprddqby0dl = 0x33333333; | 1379 | mmdc0->mprddqby0dl = 0x33333333; |
1380 | mmdc0->mprddqby1dl = 0x33333333; | 1380 | mmdc0->mprddqby1dl = 0x33333333; |
1381 | if (sysinfo->dsize > 0) { | 1381 | if (sysinfo->dsize > 0) { |
1382 | mmdc0->mprddqby2dl = 0x33333333; | 1382 | mmdc0->mprddqby2dl = 0x33333333; |
1383 | mmdc0->mprddqby3dl = 0x33333333; | 1383 | mmdc0->mprddqby3dl = 0x33333333; |
1384 | } | 1384 | } |
1385 | 1385 | ||
1386 | if (sysinfo->dsize > 1) { | 1386 | if (sysinfo->dsize > 1) { |
1387 | MMDC1(mprddqby0dl, 0x33333333); | 1387 | MMDC1(mprddqby0dl, 0x33333333); |
1388 | MMDC1(mprddqby1dl, 0x33333333); | 1388 | MMDC1(mprddqby1dl, 0x33333333); |
1389 | MMDC1(mprddqby2dl, 0x33333333); | 1389 | MMDC1(mprddqby2dl, 0x33333333); |
1390 | MMDC1(mprddqby3dl, 0x33333333); | 1390 | MMDC1(mprddqby3dl, 0x33333333); |
1391 | } | 1391 | } |
1392 | 1392 | ||
1393 | /* MMDC Termination: rtt_nom:2 RZQ/2(120ohm), rtt_nom:1 RZQ/4(60ohm) */ | 1393 | /* MMDC Termination: rtt_nom:2 RZQ/2(120ohm), rtt_nom:1 RZQ/4(60ohm) */ |
1394 | val = (sysinfo->rtt_nom == 2) ? 0x00011117 : 0x00022227; | 1394 | val = (sysinfo->rtt_nom == 2) ? 0x00011117 : 0x00022227; |
1395 | mmdc0->mpodtctrl = val; | 1395 | mmdc0->mpodtctrl = val; |
1396 | if (sysinfo->dsize > 1) | 1396 | if (sysinfo->dsize > 1) |
1397 | MMDC1(mpodtctrl, val); | 1397 | MMDC1(mpodtctrl, val); |
1398 | 1398 | ||
1399 | /* complete calibration */ | 1399 | /* complete calibration */ |
1400 | val = (1 << 11); /* Force measurement on delay-lines */ | 1400 | val = (1 << 11); /* Force measurement on delay-lines */ |
1401 | mmdc0->mpmur0 = val; | 1401 | mmdc0->mpmur0 = val; |
1402 | if (sysinfo->dsize > 1) | 1402 | if (sysinfo->dsize > 1) |
1403 | MMDC1(mpmur0, val); | 1403 | MMDC1(mpmur0, val); |
1404 | 1404 | ||
1405 | /* Step 1: configuration request */ | 1405 | /* Step 1: configuration request */ |
1406 | mmdc0->mdscr = (u32)(1 << 15); /* config request */ | 1406 | mmdc0->mdscr = (u32)(1 << 15); /* config request */ |
1407 | 1407 | ||
1408 | /* Step 2: Timing configuration */ | 1408 | /* Step 2: Timing configuration */ |
1409 | mmdc0->mdcfg0 = (trfc << 24) | (txs << 16) | (txp << 13) | | 1409 | mmdc0->mdcfg0 = (trfc << 24) | (txs << 16) | (txp << 13) | |
1410 | (txpdll << 9) | (tfaw << 4) | tcl; | 1410 | (txpdll << 9) | (tfaw << 4) | tcl; |
1411 | mmdc0->mdcfg1 = (trcd << 29) | (trp << 26) | (trc << 21) | | 1411 | mmdc0->mdcfg1 = (trcd << 29) | (trp << 26) | (trc << 21) | |
1412 | (tras << 16) | (1 << 15) /* trpa */ | | 1412 | (tras << 16) | (1 << 15) /* trpa */ | |
1413 | (twr << 9) | (tmrd << 5) | tcwl; | 1413 | (twr << 9) | (tmrd << 5) | tcwl; |
1414 | mmdc0->mdcfg2 = (tdllk << 16) | (trtp << 6) | (twtr << 3) | trrd; | 1414 | mmdc0->mdcfg2 = (tdllk << 16) | (trtp << 6) | (twtr << 3) | trrd; |
1415 | mmdc0->mdotc = (taofpd << 27) | (taonpd << 24) | (tanpd << 20) | | 1415 | mmdc0->mdotc = (taofpd << 27) | (taonpd << 24) | (tanpd << 20) | |
1416 | (taxpd << 16) | (todtlon << 12) | (todt_idle_off << 4); | 1416 | (taxpd << 16) | (todtlon << 12) | (todt_idle_off << 4); |
1417 | mmdc0->mdasp = cs0_end; /* CS addressing */ | 1417 | mmdc0->mdasp = cs0_end; /* CS addressing */ |
1418 | 1418 | ||
1419 | /* Step 3: Configure DDR type */ | 1419 | /* Step 3: Configure DDR type */ |
1420 | mmdc0->mdmisc = (sysinfo->cs1_mirror << 19) | (sysinfo->walat << 16) | | 1420 | mmdc0->mdmisc = (sysinfo->cs1_mirror << 19) | (sysinfo->walat << 16) | |
1421 | (sysinfo->bi_on << 12) | (sysinfo->mif3_mode << 9) | | 1421 | (sysinfo->bi_on << 12) | (sysinfo->mif3_mode << 9) | |
1422 | (sysinfo->ralat << 6); | 1422 | (sysinfo->ralat << 6); |
1423 | 1423 | ||
1424 | /* Step 4: Configure delay while leaving reset */ | 1424 | /* Step 4: Configure delay while leaving reset */ |
1425 | mmdc0->mdor = (txpr << 16) | (sysinfo->sde_to_rst << 8) | | 1425 | mmdc0->mdor = (txpr << 16) | (sysinfo->sde_to_rst << 8) | |
1426 | (sysinfo->rst_to_cke << 0); | 1426 | (sysinfo->rst_to_cke << 0); |
1427 | 1427 | ||
1428 | /* Step 5: Configure DDR physical parameters (density and burst len) */ | 1428 | /* Step 5: Configure DDR physical parameters (density and burst len) */ |
1429 | coladdr = ddr3_cfg->coladdr; | 1429 | coladdr = ddr3_cfg->coladdr; |
1430 | if (ddr3_cfg->coladdr == 8) /* 8-bit COL is 0x3 */ | 1430 | if (ddr3_cfg->coladdr == 8) /* 8-bit COL is 0x3 */ |
1431 | coladdr += 4; | 1431 | coladdr += 4; |
1432 | else if (ddr3_cfg->coladdr == 12) /* 12-bit COL is 0x4 */ | 1432 | else if (ddr3_cfg->coladdr == 12) /* 12-bit COL is 0x4 */ |
1433 | coladdr += 1; | 1433 | coladdr += 1; |
1434 | mmdc0->mdctl = (ddr3_cfg->rowaddr - 11) << 24 | /* ROW */ | 1434 | mmdc0->mdctl = (ddr3_cfg->rowaddr - 11) << 24 | /* ROW */ |
1435 | (coladdr - 9) << 20 | /* COL */ | 1435 | (coladdr - 9) << 20 | /* COL */ |
1436 | (1 << 19) | /* Burst Length = 8 for DDR3 */ | 1436 | (1 << 19) | /* Burst Length = 8 for DDR3 */ |
1437 | (sysinfo->dsize << 16); /* DDR data bus size */ | 1437 | (sysinfo->dsize << 16); /* DDR data bus size */ |
1438 | 1438 | ||
1439 | /* Step 6: Perform ZQ calibration */ | 1439 | /* Step 6: Perform ZQ calibration */ |
1440 | val = 0xa1390001; /* one-time HW ZQ calib */ | 1440 | val = 0xa1390001; /* one-time HW ZQ calib */ |
1441 | mmdc0->mpzqhwctrl = val; | 1441 | mmdc0->mpzqhwctrl = val; |
1442 | if (sysinfo->dsize > 1) | 1442 | if (sysinfo->dsize > 1) |
1443 | MMDC1(mpzqhwctrl, val); | 1443 | MMDC1(mpzqhwctrl, val); |
1444 | 1444 | ||
1445 | /* Step 7: Enable MMDC with desired chip select */ | 1445 | /* Step 7: Enable MMDC with desired chip select */ |
1446 | mmdc0->mdctl |= (1 << 31) | /* SDE_0 for CS0 */ | 1446 | mmdc0->mdctl |= (1 << 31) | /* SDE_0 for CS0 */ |
1447 | ((sysinfo->ncs == 2) ? 1 : 0) << 30; /* SDE_1 for CS1 */ | 1447 | ((sysinfo->ncs == 2) ? 1 : 0) << 30; /* SDE_1 for CS1 */ |
1448 | 1448 | ||
1449 | /* Step 8: Write Mode Registers to Init DDR3 devices */ | 1449 | /* Step 8: Write Mode Registers to Init DDR3 devices */ |
1450 | for (cs = 0; cs < sysinfo->ncs; cs++) { | 1450 | for (cs = 0; cs < sysinfo->ncs; cs++) { |
1451 | /* MR2 */ | 1451 | /* MR2 */ |
1452 | val = (sysinfo->rtt_wr & 3) << 9 | (ddr3_cfg->SRT & 1) << 7 | | 1452 | val = (sysinfo->rtt_wr & 3) << 9 | (ddr3_cfg->SRT & 1) << 7 | |
1453 | ((tcwl - 3) & 3) << 3; | 1453 | ((tcwl - 3) & 3) << 3; |
1454 | debug("MR2 CS%d: 0x%08x\n", cs, (u32)MR(val, 2, 3, cs)); | 1454 | debug("MR2 CS%d: 0x%08x\n", cs, (u32)MR(val, 2, 3, cs)); |
1455 | mmdc0->mdscr = MR(val, 2, 3, cs); | 1455 | mmdc0->mdscr = MR(val, 2, 3, cs); |
1456 | /* MR3 */ | 1456 | /* MR3 */ |
1457 | debug("MR3 CS%d: 0x%08x\n", cs, (u32)MR(0, 3, 3, cs)); | 1457 | debug("MR3 CS%d: 0x%08x\n", cs, (u32)MR(0, 3, 3, cs)); |
1458 | mmdc0->mdscr = MR(0, 3, 3, cs); | 1458 | mmdc0->mdscr = MR(0, 3, 3, cs); |
1459 | /* MR1 */ | 1459 | /* MR1 */ |
1460 | val = ((sysinfo->rtt_nom & 1) ? 1 : 0) << 2 | | 1460 | val = ((sysinfo->rtt_nom & 1) ? 1 : 0) << 2 | |
1461 | ((sysinfo->rtt_nom & 2) ? 1 : 0) << 6; | 1461 | ((sysinfo->rtt_nom & 2) ? 1 : 0) << 6; |
1462 | debug("MR1 CS%d: 0x%08x\n", cs, (u32)MR(val, 1, 3, cs)); | 1462 | debug("MR1 CS%d: 0x%08x\n", cs, (u32)MR(val, 1, 3, cs)); |
1463 | mmdc0->mdscr = MR(val, 1, 3, cs); | 1463 | mmdc0->mdscr = MR(val, 1, 3, cs); |
1464 | /* MR0 */ | 1464 | /* MR0 */ |
1465 | val = ((tcl - 1) << 4) | /* CAS */ | 1465 | val = ((tcl - 1) << 4) | /* CAS */ |
1466 | (1 << 8) | /* DLL Reset */ | 1466 | (1 << 8) | /* DLL Reset */ |
1467 | ((twr - 3) << 9) | /* Write Recovery */ | 1467 | ((twr - 3) << 9) | /* Write Recovery */ |
1468 | (sysinfo->pd_fast_exit << 12); /* Precharge PD PLL on */ | 1468 | (sysinfo->pd_fast_exit << 12); /* Precharge PD PLL on */ |
1469 | debug("MR0 CS%d: 0x%08x\n", cs, (u32)MR(val, 0, 3, cs)); | 1469 | debug("MR0 CS%d: 0x%08x\n", cs, (u32)MR(val, 0, 3, cs)); |
1470 | mmdc0->mdscr = MR(val, 0, 3, cs); | 1470 | mmdc0->mdscr = MR(val, 0, 3, cs); |
1471 | /* ZQ calibration */ | 1471 | /* ZQ calibration */ |
1472 | val = (1 << 10); | 1472 | val = (1 << 10); |
1473 | mmdc0->mdscr = MR(val, 0, 4, cs); | 1473 | mmdc0->mdscr = MR(val, 0, 4, cs); |
1474 | } | 1474 | } |
1475 | 1475 | ||
1476 | /* Step 10: Power down control and self-refresh */ | 1476 | /* Step 10: Power down control and self-refresh */ |
1477 | mmdc0->mdpdc = (tcke & 0x7) << 16 | | 1477 | mmdc0->mdpdc = (tcke & 0x7) << 16 | |
1478 | 5 << 12 | /* PWDT_1: 256 cycles */ | 1478 | 5 << 12 | /* PWDT_1: 256 cycles */ |
1479 | 5 << 8 | /* PWDT_0: 256 cycles */ | 1479 | 5 << 8 | /* PWDT_0: 256 cycles */ |
1480 | 1 << 6 | /* BOTH_CS_PD */ | 1480 | 1 << 6 | /* BOTH_CS_PD */ |
1481 | (tcksrx & 0x7) << 3 | | 1481 | (tcksrx & 0x7) << 3 | |
1482 | (tcksre & 0x7); | 1482 | (tcksre & 0x7); |
1483 | if (!sysinfo->pd_fast_exit) | 1483 | if (!sysinfo->pd_fast_exit) |
1484 | mmdc0->mdpdc |= (1 << 7); /* SLOW_PD */ | 1484 | mmdc0->mdpdc |= (1 << 7); /* SLOW_PD */ |
1485 | mmdc0->mapsr = 0x00001006; /* ADOPT power down enabled */ | 1485 | mmdc0->mapsr = 0x00001006; /* ADOPT power down enabled */ |
1486 | 1486 | ||
1487 | /* Step 11: Configure ZQ calibration: one-time and periodic 1ms */ | 1487 | /* Step 11: Configure ZQ calibration: one-time and periodic 1ms */ |
1488 | val = 0xa1390003; | 1488 | val = 0xa1390003; |
1489 | mmdc0->mpzqhwctrl = val; | 1489 | mmdc0->mpzqhwctrl = val; |
1490 | if (sysinfo->dsize > 1) | 1490 | if (sysinfo->dsize > 1) |
1491 | MMDC1(mpzqhwctrl, val); | 1491 | MMDC1(mpzqhwctrl, val); |
1492 | 1492 | ||
1493 | /* Step 12: Configure and activate periodic refresh */ | 1493 | /* Step 12: Configure and activate periodic refresh */ |
1494 | mmdc0->mdref = (sysinfo->refsel << 14) | (sysinfo->refr << 11); | 1494 | mmdc0->mdref = (sysinfo->refsel << 14) | (sysinfo->refr << 11); |
1495 | 1495 | ||
1496 | /* Step 13: Deassert config request - init complete */ | 1496 | /* Step 13: Deassert config request - init complete */ |
1497 | mmdc0->mdscr = 0x00000000; | 1497 | mmdc0->mdscr = 0x00000000; |
1498 | 1498 | ||
1499 | /* wait for auto-ZQ calibration to complete */ | 1499 | /* wait for auto-ZQ calibration to complete */ |
1500 | mdelay(1); | 1500 | mdelay(1); |
1501 | } | 1501 | } |
1502 | 1502 | ||
1503 | void mmdc_read_calibration(struct mx6_ddr_sysinfo const *sysinfo, | 1503 | void mmdc_read_calibration(struct mx6_ddr_sysinfo const *sysinfo, |
1504 | struct mx6_mmdc_calibration *calib) | 1504 | struct mx6_mmdc_calibration *calib) |
1505 | { | 1505 | { |
1506 | struct mmdc_p_regs *mmdc0 = (struct mmdc_p_regs *)MMDC_P0_BASE_ADDR; | 1506 | struct mmdc_p_regs *mmdc0 = (struct mmdc_p_regs *)MMDC_P0_BASE_ADDR; |
1507 | struct mmdc_p_regs *mmdc1 = (struct mmdc_p_regs *)MMDC_P1_BASE_ADDR; | 1507 | struct mmdc_p_regs *mmdc1 = (struct mmdc_p_regs *)MMDC_P1_BASE_ADDR; |
1508 | 1508 | ||
1509 | calib->p0_mpwldectrl0 = readl(&mmdc0->mpwldectrl0); | 1509 | calib->p0_mpwldectrl0 = readl(&mmdc0->mpwldectrl0); |
1510 | calib->p0_mpwldectrl1 = readl(&mmdc0->mpwldectrl1); | 1510 | calib->p0_mpwldectrl1 = readl(&mmdc0->mpwldectrl1); |
1511 | calib->p0_mpdgctrl0 = readl(&mmdc0->mpdgctrl0); | 1511 | calib->p0_mpdgctrl0 = readl(&mmdc0->mpdgctrl0); |
1512 | calib->p0_mpdgctrl1 = readl(&mmdc0->mpdgctrl1); | 1512 | calib->p0_mpdgctrl1 = readl(&mmdc0->mpdgctrl1); |
1513 | calib->p0_mprddlctl = readl(&mmdc0->mprddlctl); | 1513 | calib->p0_mprddlctl = readl(&mmdc0->mprddlctl); |
1514 | calib->p0_mpwrdlctl = readl(&mmdc0->mpwrdlctl); | 1514 | calib->p0_mpwrdlctl = readl(&mmdc0->mpwrdlctl); |
1515 | 1515 | ||
1516 | if (sysinfo->dsize == 2) { | 1516 | if (sysinfo->dsize == 2) { |
1517 | calib->p1_mpwldectrl0 = readl(&mmdc1->mpwldectrl0); | 1517 | calib->p1_mpwldectrl0 = readl(&mmdc1->mpwldectrl0); |
1518 | calib->p1_mpwldectrl1 = readl(&mmdc1->mpwldectrl1); | 1518 | calib->p1_mpwldectrl1 = readl(&mmdc1->mpwldectrl1); |
1519 | calib->p1_mpdgctrl0 = readl(&mmdc1->mpdgctrl0); | 1519 | calib->p1_mpdgctrl0 = readl(&mmdc1->mpdgctrl0); |
1520 | calib->p1_mpdgctrl1 = readl(&mmdc1->mpdgctrl1); | 1520 | calib->p1_mpdgctrl1 = readl(&mmdc1->mpdgctrl1); |
1521 | calib->p1_mprddlctl = readl(&mmdc1->mprddlctl); | 1521 | calib->p1_mprddlctl = readl(&mmdc1->mprddlctl); |
1522 | calib->p1_mpwrdlctl = readl(&mmdc1->mpwrdlctl); | 1522 | calib->p1_mpwrdlctl = readl(&mmdc1->mpwrdlctl); |
1523 | } | 1523 | } |
1524 | } | 1524 | } |
1525 | 1525 | ||
1526 | void mx6_dram_cfg(const struct mx6_ddr_sysinfo *sysinfo, | 1526 | void mx6_dram_cfg(const struct mx6_ddr_sysinfo *sysinfo, |
1527 | const struct mx6_mmdc_calibration *calib, | 1527 | const struct mx6_mmdc_calibration *calib, |
1528 | const void *ddr_cfg) | 1528 | const void *ddr_cfg) |
1529 | { | 1529 | { |
1530 | if (sysinfo->ddr_type == DDR_TYPE_DDR3) { | 1530 | if (sysinfo->ddr_type == DDR_TYPE_DDR3) { |
1531 | mx6_ddr3_cfg(sysinfo, calib, ddr_cfg); | 1531 | mx6_ddr3_cfg(sysinfo, calib, ddr_cfg); |
1532 | } else if (sysinfo->ddr_type == DDR_TYPE_LPDDR2) { | 1532 | } else if (sysinfo->ddr_type == DDR_TYPE_LPDDR2) { |
1533 | mx6_lpddr2_cfg(sysinfo, calib, ddr_cfg); | 1533 | mx6_lpddr2_cfg(sysinfo, calib, ddr_cfg); |
1534 | } else { | 1534 | } else { |
1535 | puts("Unsupported ddr type\n"); | 1535 | puts("Unsupported ddr type\n"); |
1536 | hang(); | 1536 | hang(); |
1537 | } | 1537 | } |
1538 | } | 1538 | } |
1539 | 1539 |
drivers/gpio/mxc_gpio.c
1 | /* | 1 | /* |
2 | * Copyright (C) 2009 | 2 | * Copyright (C) 2009 |
3 | * Guennadi Liakhovetski, DENX Software Engineering, <lg@denx.de> | 3 | * Guennadi Liakhovetski, DENX Software Engineering, <lg@denx.de> |
4 | * | 4 | * |
5 | * Copyright (C) 2011 | 5 | * Copyright (C) 2011 |
6 | * Stefano Babic, DENX Software Engineering, <sbabic@denx.de> | 6 | * Stefano Babic, DENX Software Engineering, <sbabic@denx.de> |
7 | * | 7 | * |
8 | * SPDX-License-Identifier: GPL-2.0+ | 8 | * SPDX-License-Identifier: GPL-2.0+ |
9 | */ | 9 | */ |
10 | #include <common.h> | 10 | #include <common.h> |
11 | #include <errno.h> | 11 | #include <errno.h> |
12 | #include <dm.h> | 12 | #include <dm.h> |
13 | #include <malloc.h> | 13 | #include <malloc.h> |
14 | #include <asm/arch/imx-regs.h> | 14 | #include <asm/arch/imx-regs.h> |
15 | #include <asm/gpio.h> | 15 | #include <asm/gpio.h> |
16 | #include <asm/io.h> | 16 | #include <asm/io.h> |
17 | 17 | ||
18 | enum mxc_gpio_direction { | 18 | enum mxc_gpio_direction { |
19 | MXC_GPIO_DIRECTION_IN, | 19 | MXC_GPIO_DIRECTION_IN, |
20 | MXC_GPIO_DIRECTION_OUT, | 20 | MXC_GPIO_DIRECTION_OUT, |
21 | }; | 21 | }; |
22 | 22 | ||
23 | #define GPIO_PER_BANK 32 | 23 | #define GPIO_PER_BANK 32 |
24 | 24 | ||
25 | struct mxc_gpio_plat { | 25 | struct mxc_gpio_plat { |
26 | int bank_index; | 26 | int bank_index; |
27 | struct gpio_regs *regs; | 27 | struct gpio_regs *regs; |
28 | }; | 28 | }; |
29 | 29 | ||
30 | struct mxc_bank_info { | 30 | struct mxc_bank_info { |
31 | struct gpio_regs *regs; | 31 | struct gpio_regs *regs; |
32 | }; | 32 | }; |
33 | 33 | ||
34 | #ifndef CONFIG_DM_GPIO | 34 | #ifndef CONFIG_DM_GPIO |
35 | #define GPIO_TO_PORT(n) (n / 32) | 35 | #define GPIO_TO_PORT(n) (n / 32) |
36 | 36 | ||
37 | /* GPIO port description */ | 37 | /* GPIO port description */ |
38 | static unsigned long gpio_ports[] = { | 38 | static unsigned long gpio_ports[] = { |
39 | [0] = GPIO1_BASE_ADDR, | 39 | [0] = GPIO1_BASE_ADDR, |
40 | [1] = GPIO2_BASE_ADDR, | 40 | [1] = GPIO2_BASE_ADDR, |
41 | [2] = GPIO3_BASE_ADDR, | 41 | [2] = GPIO3_BASE_ADDR, |
42 | #if defined(CONFIG_MX25) || defined(CONFIG_MX27) || defined(CONFIG_MX51) || \ | 42 | #if defined(CONFIG_MX25) || defined(CONFIG_MX27) || defined(CONFIG_MX51) || \ |
43 | defined(CONFIG_MX53) || defined(CONFIG_MX6) || \ | 43 | defined(CONFIG_MX53) || defined(CONFIG_MX6) || \ |
44 | defined(CONFIG_MX7) | 44 | defined(CONFIG_MX7) |
45 | [3] = GPIO4_BASE_ADDR, | 45 | [3] = GPIO4_BASE_ADDR, |
46 | #endif | 46 | #endif |
47 | #if defined(CONFIG_MX27) || defined(CONFIG_MX53) || defined(CONFIG_MX6) || \ | 47 | #if defined(CONFIG_MX27) || defined(CONFIG_MX53) || defined(CONFIG_MX6) || \ |
48 | defined(CONFIG_MX7) | 48 | defined(CONFIG_MX7) |
49 | [4] = GPIO5_BASE_ADDR, | 49 | [4] = GPIO5_BASE_ADDR, |
50 | #ifndef CONFIG_MX6UL | 50 | #if !(defined(CONFIG_MX6UL) || defined(CONFIG_MX6ULL)) |
51 | [5] = GPIO6_BASE_ADDR, | 51 | [5] = GPIO6_BASE_ADDR, |
52 | #endif | 52 | #endif |
53 | #endif | 53 | #endif |
54 | #if defined(CONFIG_MX53) || defined(CONFIG_MX6) || defined(CONFIG_MX7) | 54 | #if defined(CONFIG_MX53) || defined(CONFIG_MX6) || defined(CONFIG_MX7) |
55 | #ifndef CONFIG_MX6UL | 55 | #if !(defined(CONFIG_MX6UL) || defined(CONFIG_MX6ULL)) |
56 | [6] = GPIO7_BASE_ADDR, | 56 | [6] = GPIO7_BASE_ADDR, |
57 | #endif | 57 | #endif |
58 | #endif | 58 | #endif |
59 | }; | 59 | }; |
60 | 60 | ||
61 | static int mxc_gpio_direction(unsigned int gpio, | 61 | static int mxc_gpio_direction(unsigned int gpio, |
62 | enum mxc_gpio_direction direction) | 62 | enum mxc_gpio_direction direction) |
63 | { | 63 | { |
64 | unsigned int port = GPIO_TO_PORT(gpio); | 64 | unsigned int port = GPIO_TO_PORT(gpio); |
65 | struct gpio_regs *regs; | 65 | struct gpio_regs *regs; |
66 | u32 l; | 66 | u32 l; |
67 | 67 | ||
68 | if (port >= ARRAY_SIZE(gpio_ports)) | 68 | if (port >= ARRAY_SIZE(gpio_ports)) |
69 | return -1; | 69 | return -1; |
70 | 70 | ||
71 | gpio &= 0x1f; | 71 | gpio &= 0x1f; |
72 | 72 | ||
73 | regs = (struct gpio_regs *)gpio_ports[port]; | 73 | regs = (struct gpio_regs *)gpio_ports[port]; |
74 | 74 | ||
75 | l = readl(®s->gpio_dir); | 75 | l = readl(®s->gpio_dir); |
76 | 76 | ||
77 | switch (direction) { | 77 | switch (direction) { |
78 | case MXC_GPIO_DIRECTION_OUT: | 78 | case MXC_GPIO_DIRECTION_OUT: |
79 | l |= 1 << gpio; | 79 | l |= 1 << gpio; |
80 | break; | 80 | break; |
81 | case MXC_GPIO_DIRECTION_IN: | 81 | case MXC_GPIO_DIRECTION_IN: |
82 | l &= ~(1 << gpio); | 82 | l &= ~(1 << gpio); |
83 | } | 83 | } |
84 | writel(l, ®s->gpio_dir); | 84 | writel(l, ®s->gpio_dir); |
85 | 85 | ||
86 | return 0; | 86 | return 0; |
87 | } | 87 | } |
88 | 88 | ||
89 | int gpio_set_value(unsigned gpio, int value) | 89 | int gpio_set_value(unsigned gpio, int value) |
90 | { | 90 | { |
91 | unsigned int port = GPIO_TO_PORT(gpio); | 91 | unsigned int port = GPIO_TO_PORT(gpio); |
92 | struct gpio_regs *regs; | 92 | struct gpio_regs *regs; |
93 | u32 l; | 93 | u32 l; |
94 | 94 | ||
95 | if (port >= ARRAY_SIZE(gpio_ports)) | 95 | if (port >= ARRAY_SIZE(gpio_ports)) |
96 | return -1; | 96 | return -1; |
97 | 97 | ||
98 | gpio &= 0x1f; | 98 | gpio &= 0x1f; |
99 | 99 | ||
100 | regs = (struct gpio_regs *)gpio_ports[port]; | 100 | regs = (struct gpio_regs *)gpio_ports[port]; |
101 | 101 | ||
102 | l = readl(®s->gpio_dr); | 102 | l = readl(®s->gpio_dr); |
103 | if (value) | 103 | if (value) |
104 | l |= 1 << gpio; | 104 | l |= 1 << gpio; |
105 | else | 105 | else |
106 | l &= ~(1 << gpio); | 106 | l &= ~(1 << gpio); |
107 | writel(l, ®s->gpio_dr); | 107 | writel(l, ®s->gpio_dr); |
108 | 108 | ||
109 | return 0; | 109 | return 0; |
110 | } | 110 | } |
111 | 111 | ||
112 | int gpio_get_value(unsigned gpio) | 112 | int gpio_get_value(unsigned gpio) |
113 | { | 113 | { |
114 | unsigned int port = GPIO_TO_PORT(gpio); | 114 | unsigned int port = GPIO_TO_PORT(gpio); |
115 | struct gpio_regs *regs; | 115 | struct gpio_regs *regs; |
116 | u32 val; | 116 | u32 val; |
117 | 117 | ||
118 | if (port >= ARRAY_SIZE(gpio_ports)) | 118 | if (port >= ARRAY_SIZE(gpio_ports)) |
119 | return -1; | 119 | return -1; |
120 | 120 | ||
121 | gpio &= 0x1f; | 121 | gpio &= 0x1f; |
122 | 122 | ||
123 | regs = (struct gpio_regs *)gpio_ports[port]; | 123 | regs = (struct gpio_regs *)gpio_ports[port]; |
124 | 124 | ||
125 | val = (readl(®s->gpio_psr) >> gpio) & 0x01; | 125 | val = (readl(®s->gpio_psr) >> gpio) & 0x01; |
126 | 126 | ||
127 | return val; | 127 | return val; |
128 | } | 128 | } |
129 | 129 | ||
130 | int gpio_request(unsigned gpio, const char *label) | 130 | int gpio_request(unsigned gpio, const char *label) |
131 | { | 131 | { |
132 | unsigned int port = GPIO_TO_PORT(gpio); | 132 | unsigned int port = GPIO_TO_PORT(gpio); |
133 | if (port >= ARRAY_SIZE(gpio_ports)) | 133 | if (port >= ARRAY_SIZE(gpio_ports)) |
134 | return -1; | 134 | return -1; |
135 | return 0; | 135 | return 0; |
136 | } | 136 | } |
137 | 137 | ||
138 | int gpio_free(unsigned gpio) | 138 | int gpio_free(unsigned gpio) |
139 | { | 139 | { |
140 | return 0; | 140 | return 0; |
141 | } | 141 | } |
142 | 142 | ||
143 | int gpio_direction_input(unsigned gpio) | 143 | int gpio_direction_input(unsigned gpio) |
144 | { | 144 | { |
145 | return mxc_gpio_direction(gpio, MXC_GPIO_DIRECTION_IN); | 145 | return mxc_gpio_direction(gpio, MXC_GPIO_DIRECTION_IN); |
146 | } | 146 | } |
147 | 147 | ||
148 | int gpio_direction_output(unsigned gpio, int value) | 148 | int gpio_direction_output(unsigned gpio, int value) |
149 | { | 149 | { |
150 | int ret = gpio_set_value(gpio, value); | 150 | int ret = gpio_set_value(gpio, value); |
151 | 151 | ||
152 | if (ret < 0) | 152 | if (ret < 0) |
153 | return ret; | 153 | return ret; |
154 | 154 | ||
155 | return mxc_gpio_direction(gpio, MXC_GPIO_DIRECTION_OUT); | 155 | return mxc_gpio_direction(gpio, MXC_GPIO_DIRECTION_OUT); |
156 | } | 156 | } |
157 | #endif | 157 | #endif |
158 | 158 | ||
159 | #ifdef CONFIG_DM_GPIO | 159 | #ifdef CONFIG_DM_GPIO |
160 | #include <fdtdec.h> | 160 | #include <fdtdec.h> |
161 | DECLARE_GLOBAL_DATA_PTR; | 161 | DECLARE_GLOBAL_DATA_PTR; |
162 | 162 | ||
163 | static int mxc_gpio_is_output(struct gpio_regs *regs, int offset) | 163 | static int mxc_gpio_is_output(struct gpio_regs *regs, int offset) |
164 | { | 164 | { |
165 | u32 val; | 165 | u32 val; |
166 | 166 | ||
167 | val = readl(®s->gpio_dir); | 167 | val = readl(®s->gpio_dir); |
168 | 168 | ||
169 | return val & (1 << offset) ? 1 : 0; | 169 | return val & (1 << offset) ? 1 : 0; |
170 | } | 170 | } |
171 | 171 | ||
172 | static void mxc_gpio_bank_direction(struct gpio_regs *regs, int offset, | 172 | static void mxc_gpio_bank_direction(struct gpio_regs *regs, int offset, |
173 | enum mxc_gpio_direction direction) | 173 | enum mxc_gpio_direction direction) |
174 | { | 174 | { |
175 | u32 l; | 175 | u32 l; |
176 | 176 | ||
177 | l = readl(®s->gpio_dir); | 177 | l = readl(®s->gpio_dir); |
178 | 178 | ||
179 | switch (direction) { | 179 | switch (direction) { |
180 | case MXC_GPIO_DIRECTION_OUT: | 180 | case MXC_GPIO_DIRECTION_OUT: |
181 | l |= 1 << offset; | 181 | l |= 1 << offset; |
182 | break; | 182 | break; |
183 | case MXC_GPIO_DIRECTION_IN: | 183 | case MXC_GPIO_DIRECTION_IN: |
184 | l &= ~(1 << offset); | 184 | l &= ~(1 << offset); |
185 | } | 185 | } |
186 | writel(l, ®s->gpio_dir); | 186 | writel(l, ®s->gpio_dir); |
187 | } | 187 | } |
188 | 188 | ||
189 | static void mxc_gpio_bank_set_value(struct gpio_regs *regs, int offset, | 189 | static void mxc_gpio_bank_set_value(struct gpio_regs *regs, int offset, |
190 | int value) | 190 | int value) |
191 | { | 191 | { |
192 | u32 l; | 192 | u32 l; |
193 | 193 | ||
194 | l = readl(®s->gpio_dr); | 194 | l = readl(®s->gpio_dr); |
195 | if (value) | 195 | if (value) |
196 | l |= 1 << offset; | 196 | l |= 1 << offset; |
197 | else | 197 | else |
198 | l &= ~(1 << offset); | 198 | l &= ~(1 << offset); |
199 | writel(l, ®s->gpio_dr); | 199 | writel(l, ®s->gpio_dr); |
200 | } | 200 | } |
201 | 201 | ||
202 | static int mxc_gpio_bank_get_value(struct gpio_regs *regs, int offset) | 202 | static int mxc_gpio_bank_get_value(struct gpio_regs *regs, int offset) |
203 | { | 203 | { |
204 | return (readl(®s->gpio_psr) >> offset) & 0x01; | 204 | return (readl(®s->gpio_psr) >> offset) & 0x01; |
205 | } | 205 | } |
206 | 206 | ||
207 | /* set GPIO pin 'gpio' as an input */ | 207 | /* set GPIO pin 'gpio' as an input */ |
208 | static int mxc_gpio_direction_input(struct udevice *dev, unsigned offset) | 208 | static int mxc_gpio_direction_input(struct udevice *dev, unsigned offset) |
209 | { | 209 | { |
210 | struct mxc_bank_info *bank = dev_get_priv(dev); | 210 | struct mxc_bank_info *bank = dev_get_priv(dev); |
211 | 211 | ||
212 | /* Configure GPIO direction as input. */ | 212 | /* Configure GPIO direction as input. */ |
213 | mxc_gpio_bank_direction(bank->regs, offset, MXC_GPIO_DIRECTION_IN); | 213 | mxc_gpio_bank_direction(bank->regs, offset, MXC_GPIO_DIRECTION_IN); |
214 | 214 | ||
215 | return 0; | 215 | return 0; |
216 | } | 216 | } |
217 | 217 | ||
218 | /* set GPIO pin 'gpio' as an output, with polarity 'value' */ | 218 | /* set GPIO pin 'gpio' as an output, with polarity 'value' */ |
219 | static int mxc_gpio_direction_output(struct udevice *dev, unsigned offset, | 219 | static int mxc_gpio_direction_output(struct udevice *dev, unsigned offset, |
220 | int value) | 220 | int value) |
221 | { | 221 | { |
222 | struct mxc_bank_info *bank = dev_get_priv(dev); | 222 | struct mxc_bank_info *bank = dev_get_priv(dev); |
223 | 223 | ||
224 | /* Configure GPIO output value. */ | 224 | /* Configure GPIO output value. */ |
225 | mxc_gpio_bank_set_value(bank->regs, offset, value); | 225 | mxc_gpio_bank_set_value(bank->regs, offset, value); |
226 | 226 | ||
227 | /* Configure GPIO direction as output. */ | 227 | /* Configure GPIO direction as output. */ |
228 | mxc_gpio_bank_direction(bank->regs, offset, MXC_GPIO_DIRECTION_OUT); | 228 | mxc_gpio_bank_direction(bank->regs, offset, MXC_GPIO_DIRECTION_OUT); |
229 | 229 | ||
230 | return 0; | 230 | return 0; |
231 | } | 231 | } |
232 | 232 | ||
233 | /* read GPIO IN value of pin 'gpio' */ | 233 | /* read GPIO IN value of pin 'gpio' */ |
234 | static int mxc_gpio_get_value(struct udevice *dev, unsigned offset) | 234 | static int mxc_gpio_get_value(struct udevice *dev, unsigned offset) |
235 | { | 235 | { |
236 | struct mxc_bank_info *bank = dev_get_priv(dev); | 236 | struct mxc_bank_info *bank = dev_get_priv(dev); |
237 | 237 | ||
238 | return mxc_gpio_bank_get_value(bank->regs, offset); | 238 | return mxc_gpio_bank_get_value(bank->regs, offset); |
239 | } | 239 | } |
240 | 240 | ||
241 | /* write GPIO OUT value to pin 'gpio' */ | 241 | /* write GPIO OUT value to pin 'gpio' */ |
242 | static int mxc_gpio_set_value(struct udevice *dev, unsigned offset, | 242 | static int mxc_gpio_set_value(struct udevice *dev, unsigned offset, |
243 | int value) | 243 | int value) |
244 | { | 244 | { |
245 | struct mxc_bank_info *bank = dev_get_priv(dev); | 245 | struct mxc_bank_info *bank = dev_get_priv(dev); |
246 | 246 | ||
247 | mxc_gpio_bank_set_value(bank->regs, offset, value); | 247 | mxc_gpio_bank_set_value(bank->regs, offset, value); |
248 | 248 | ||
249 | return 0; | 249 | return 0; |
250 | } | 250 | } |
251 | 251 | ||
252 | static int mxc_gpio_get_function(struct udevice *dev, unsigned offset) | 252 | static int mxc_gpio_get_function(struct udevice *dev, unsigned offset) |
253 | { | 253 | { |
254 | struct mxc_bank_info *bank = dev_get_priv(dev); | 254 | struct mxc_bank_info *bank = dev_get_priv(dev); |
255 | 255 | ||
256 | /* GPIOF_FUNC is not implemented yet */ | 256 | /* GPIOF_FUNC is not implemented yet */ |
257 | if (mxc_gpio_is_output(bank->regs, offset)) | 257 | if (mxc_gpio_is_output(bank->regs, offset)) |
258 | return GPIOF_OUTPUT; | 258 | return GPIOF_OUTPUT; |
259 | else | 259 | else |
260 | return GPIOF_INPUT; | 260 | return GPIOF_INPUT; |
261 | } | 261 | } |
262 | 262 | ||
263 | static const struct dm_gpio_ops gpio_mxc_ops = { | 263 | static const struct dm_gpio_ops gpio_mxc_ops = { |
264 | .direction_input = mxc_gpio_direction_input, | 264 | .direction_input = mxc_gpio_direction_input, |
265 | .direction_output = mxc_gpio_direction_output, | 265 | .direction_output = mxc_gpio_direction_output, |
266 | .get_value = mxc_gpio_get_value, | 266 | .get_value = mxc_gpio_get_value, |
267 | .set_value = mxc_gpio_set_value, | 267 | .set_value = mxc_gpio_set_value, |
268 | .get_function = mxc_gpio_get_function, | 268 | .get_function = mxc_gpio_get_function, |
269 | }; | 269 | }; |
270 | 270 | ||
271 | static int mxc_gpio_probe(struct udevice *dev) | 271 | static int mxc_gpio_probe(struct udevice *dev) |
272 | { | 272 | { |
273 | struct mxc_bank_info *bank = dev_get_priv(dev); | 273 | struct mxc_bank_info *bank = dev_get_priv(dev); |
274 | struct mxc_gpio_plat *plat = dev_get_platdata(dev); | 274 | struct mxc_gpio_plat *plat = dev_get_platdata(dev); |
275 | struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev); | 275 | struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev); |
276 | int banknum; | 276 | int banknum; |
277 | char name[18], *str; | 277 | char name[18], *str; |
278 | 278 | ||
279 | banknum = plat->bank_index; | 279 | banknum = plat->bank_index; |
280 | sprintf(name, "GPIO%d_", banknum + 1); | 280 | sprintf(name, "GPIO%d_", banknum + 1); |
281 | str = strdup(name); | 281 | str = strdup(name); |
282 | if (!str) | 282 | if (!str) |
283 | return -ENOMEM; | 283 | return -ENOMEM; |
284 | uc_priv->bank_name = str; | 284 | uc_priv->bank_name = str; |
285 | uc_priv->gpio_count = GPIO_PER_BANK; | 285 | uc_priv->gpio_count = GPIO_PER_BANK; |
286 | bank->regs = plat->regs; | 286 | bank->regs = plat->regs; |
287 | 287 | ||
288 | return 0; | 288 | return 0; |
289 | } | 289 | } |
290 | 290 | ||
291 | static int mxc_gpio_bind(struct udevice *dev) | 291 | static int mxc_gpio_bind(struct udevice *dev) |
292 | { | 292 | { |
293 | struct mxc_gpio_plat *plat = dev->platdata; | 293 | struct mxc_gpio_plat *plat = dev->platdata; |
294 | fdt_addr_t addr; | 294 | fdt_addr_t addr; |
295 | 295 | ||
296 | /* | 296 | /* |
297 | * If platdata already exsits, directly return. | 297 | * If platdata already exsits, directly return. |
298 | * Actually only when DT is not supported, platdata | 298 | * Actually only when DT is not supported, platdata |
299 | * is statically initialized in U_BOOT_DEVICES.Here | 299 | * is statically initialized in U_BOOT_DEVICES.Here |
300 | * will return. | 300 | * will return. |
301 | */ | 301 | */ |
302 | if (plat) | 302 | if (plat) |
303 | return 0; | 303 | return 0; |
304 | 304 | ||
305 | addr = devfdt_get_addr(dev); | 305 | addr = devfdt_get_addr(dev); |
306 | if (addr == FDT_ADDR_T_NONE) | 306 | if (addr == FDT_ADDR_T_NONE) |
307 | return -EINVAL; | 307 | return -EINVAL; |
308 | 308 | ||
309 | /* | 309 | /* |
310 | * TODO: | 310 | * TODO: |
311 | * When every board is converted to driver model and DT is supported, | 311 | * When every board is converted to driver model and DT is supported, |
312 | * this can be done by auto-alloc feature, but not using calloc | 312 | * this can be done by auto-alloc feature, but not using calloc |
313 | * to alloc memory for platdata. | 313 | * to alloc memory for platdata. |
314 | * | 314 | * |
315 | * For example mxc_plat below uses platform data rather than device | 315 | * For example mxc_plat below uses platform data rather than device |
316 | * tree. | 316 | * tree. |
317 | * | 317 | * |
318 | * NOTE: DO NOT COPY this code if you are using device tree. | 318 | * NOTE: DO NOT COPY this code if you are using device tree. |
319 | */ | 319 | */ |
320 | plat = calloc(1, sizeof(*plat)); | 320 | plat = calloc(1, sizeof(*plat)); |
321 | if (!plat) | 321 | if (!plat) |
322 | return -ENOMEM; | 322 | return -ENOMEM; |
323 | 323 | ||
324 | plat->regs = (struct gpio_regs *)addr; | 324 | plat->regs = (struct gpio_regs *)addr; |
325 | plat->bank_index = dev->req_seq; | 325 | plat->bank_index = dev->req_seq; |
326 | dev->platdata = plat; | 326 | dev->platdata = plat; |
327 | 327 | ||
328 | return 0; | 328 | return 0; |
329 | } | 329 | } |
330 | 330 | ||
331 | static const struct udevice_id mxc_gpio_ids[] = { | 331 | static const struct udevice_id mxc_gpio_ids[] = { |
332 | { .compatible = "fsl,imx35-gpio" }, | 332 | { .compatible = "fsl,imx35-gpio" }, |
333 | { } | 333 | { } |
334 | }; | 334 | }; |
335 | 335 | ||
336 | U_BOOT_DRIVER(gpio_mxc) = { | 336 | U_BOOT_DRIVER(gpio_mxc) = { |
337 | .name = "gpio_mxc", | 337 | .name = "gpio_mxc", |
338 | .id = UCLASS_GPIO, | 338 | .id = UCLASS_GPIO, |
339 | .ops = &gpio_mxc_ops, | 339 | .ops = &gpio_mxc_ops, |
340 | .probe = mxc_gpio_probe, | 340 | .probe = mxc_gpio_probe, |
341 | .priv_auto_alloc_size = sizeof(struct mxc_bank_info), | 341 | .priv_auto_alloc_size = sizeof(struct mxc_bank_info), |
342 | .of_match = mxc_gpio_ids, | 342 | .of_match = mxc_gpio_ids, |
343 | .bind = mxc_gpio_bind, | 343 | .bind = mxc_gpio_bind, |
344 | }; | 344 | }; |
345 | 345 | ||
346 | #if !CONFIG_IS_ENABLED(OF_CONTROL) | 346 | #if !CONFIG_IS_ENABLED(OF_CONTROL) |
347 | static const struct mxc_gpio_plat mxc_plat[] = { | 347 | static const struct mxc_gpio_plat mxc_plat[] = { |
348 | { 0, (struct gpio_regs *)GPIO1_BASE_ADDR }, | 348 | { 0, (struct gpio_regs *)GPIO1_BASE_ADDR }, |
349 | { 1, (struct gpio_regs *)GPIO2_BASE_ADDR }, | 349 | { 1, (struct gpio_regs *)GPIO2_BASE_ADDR }, |
350 | { 2, (struct gpio_regs *)GPIO3_BASE_ADDR }, | 350 | { 2, (struct gpio_regs *)GPIO3_BASE_ADDR }, |
351 | #if defined(CONFIG_MX25) || defined(CONFIG_MX27) || defined(CONFIG_MX51) || \ | 351 | #if defined(CONFIG_MX25) || defined(CONFIG_MX27) || defined(CONFIG_MX51) || \ |
352 | defined(CONFIG_MX53) || defined(CONFIG_MX6) | 352 | defined(CONFIG_MX53) || defined(CONFIG_MX6) |
353 | { 3, (struct gpio_regs *)GPIO4_BASE_ADDR }, | 353 | { 3, (struct gpio_regs *)GPIO4_BASE_ADDR }, |
354 | #endif | 354 | #endif |
355 | #if defined(CONFIG_MX27) || defined(CONFIG_MX53) || defined(CONFIG_MX6) | 355 | #if defined(CONFIG_MX27) || defined(CONFIG_MX53) || defined(CONFIG_MX6) |
356 | { 4, (struct gpio_regs *)GPIO5_BASE_ADDR }, | 356 | { 4, (struct gpio_regs *)GPIO5_BASE_ADDR }, |
357 | { 5, (struct gpio_regs *)GPIO6_BASE_ADDR }, | 357 | { 5, (struct gpio_regs *)GPIO6_BASE_ADDR }, |
358 | #endif | 358 | #endif |
359 | #if defined(CONFIG_MX53) || defined(CONFIG_MX6) | 359 | #if defined(CONFIG_MX53) || defined(CONFIG_MX6) |
360 | { 6, (struct gpio_regs *)GPIO7_BASE_ADDR }, | 360 | { 6, (struct gpio_regs *)GPIO7_BASE_ADDR }, |
361 | #endif | 361 | #endif |
362 | }; | 362 | }; |
363 | 363 | ||
364 | U_BOOT_DEVICES(mxc_gpios) = { | 364 | U_BOOT_DEVICES(mxc_gpios) = { |
365 | { "gpio_mxc", &mxc_plat[0] }, | 365 | { "gpio_mxc", &mxc_plat[0] }, |
366 | { "gpio_mxc", &mxc_plat[1] }, | 366 | { "gpio_mxc", &mxc_plat[1] }, |
367 | { "gpio_mxc", &mxc_plat[2] }, | 367 | { "gpio_mxc", &mxc_plat[2] }, |
368 | #if defined(CONFIG_MX25) || defined(CONFIG_MX27) || defined(CONFIG_MX51) || \ | 368 | #if defined(CONFIG_MX25) || defined(CONFIG_MX27) || defined(CONFIG_MX51) || \ |
369 | defined(CONFIG_MX53) || defined(CONFIG_MX6) | 369 | defined(CONFIG_MX53) || defined(CONFIG_MX6) |
370 | { "gpio_mxc", &mxc_plat[3] }, | 370 | { "gpio_mxc", &mxc_plat[3] }, |
371 | #endif | 371 | #endif |
372 | #if defined(CONFIG_MX27) || defined(CONFIG_MX53) || defined(CONFIG_MX6) | 372 | #if defined(CONFIG_MX27) || defined(CONFIG_MX53) || defined(CONFIG_MX6) |
373 | { "gpio_mxc", &mxc_plat[4] }, | 373 | { "gpio_mxc", &mxc_plat[4] }, |
374 | { "gpio_mxc", &mxc_plat[5] }, | 374 | { "gpio_mxc", &mxc_plat[5] }, |
375 | #endif | 375 | #endif |
376 | #if defined(CONFIG_MX53) || defined(CONFIG_MX6) | 376 | #if defined(CONFIG_MX53) || defined(CONFIG_MX6) |
377 | { "gpio_mxc", &mxc_plat[6] }, | 377 | { "gpio_mxc", &mxc_plat[6] }, |
378 | #endif | 378 | #endif |
379 | }; | 379 | }; |
380 | #endif | 380 | #endif |
381 | #endif | 381 | #endif |
382 | 382 |
include/configs/imx6_spl.h
1 | /* | 1 | /* |
2 | * Copyright (C) 2014 Gateworks Corporation | 2 | * Copyright (C) 2014 Gateworks Corporation |
3 | * Author: Tim Harvey <tharvey@gateworks.com> | 3 | * Author: Tim Harvey <tharvey@gateworks.com> |
4 | * | 4 | * |
5 | * SPDX-License-Identifier: GPL-2.0+ | 5 | * SPDX-License-Identifier: GPL-2.0+ |
6 | */ | 6 | */ |
7 | #ifndef __IMX6_SPL_CONFIG_H | 7 | #ifndef __IMX6_SPL_CONFIG_H |
8 | #define __IMX6_SPL_CONFIG_H | 8 | #define __IMX6_SPL_CONFIG_H |
9 | 9 | ||
10 | #ifdef CONFIG_SPL | 10 | #ifdef CONFIG_SPL |
11 | 11 | ||
12 | #define CONFIG_SPL_FRAMEWORK | 12 | #define CONFIG_SPL_FRAMEWORK |
13 | 13 | ||
14 | /* | 14 | /* |
15 | * see Figure 8-3 in IMX6DQ/IMX6SDL Reference manuals: | 15 | * see Figure 8-3 in IMX6DQ/IMX6SDL Reference manuals: |
16 | * - IMX6SDL OCRAM (IRAM) is from 0x00907000 to 0x0091FFFF | 16 | * - IMX6SDL OCRAM (IRAM) is from 0x00907000 to 0x0091FFFF |
17 | * - IMX6DQ has 2x IRAM of IMX6SDL but we intend to support IMX6SDL as well | 17 | * - IMX6DQ has 2x IRAM of IMX6SDL but we intend to support IMX6SDL as well |
18 | * - BOOT ROM stack is at 0x0091FFB8 | 18 | * - BOOT ROM stack is at 0x0091FFB8 |
19 | * - if icache/dcache is enabled (eFuse/strapping controlled) then the | 19 | * - if icache/dcache is enabled (eFuse/strapping controlled) then the |
20 | * IMX BOOT ROM will setup MMU table at 0x00918000, therefore we need to | 20 | * IMX BOOT ROM will setup MMU table at 0x00918000, therefore we need to |
21 | * fit between 0x00907000 and 0x00918000. | 21 | * fit between 0x00907000 and 0x00918000. |
22 | * - Additionally the BOOT ROM loads what they consider the firmware image | 22 | * - Additionally the BOOT ROM loads what they consider the firmware image |
23 | * which consists of a 4K header in front of us that contains the IVT, DCD | 23 | * which consists of a 4K header in front of us that contains the IVT, DCD |
24 | * and some padding thus 'our' max size is really 0x00908000 - 0x00918000 | 24 | * and some padding thus 'our' max size is really 0x00908000 - 0x00918000 |
25 | * or 64KB | 25 | * or 64KB |
26 | */ | 26 | */ |
27 | #define CONFIG_SPL_TEXT_BASE 0x00908000 | 27 | #define CONFIG_SPL_TEXT_BASE 0x00908000 |
28 | #define CONFIG_SPL_MAX_SIZE 0x10000 | 28 | #define CONFIG_SPL_MAX_SIZE 0x10000 |
29 | #define CONFIG_SPL_STACK 0x0091FFB8 | 29 | #define CONFIG_SPL_STACK 0x0091FFB8 |
30 | /* | 30 | /* |
31 | * Pad SPL to 68KB (4KB header + 64KB max size). This allows to write the | 31 | * Pad SPL to 68KB (4KB header + 64KB max size). This allows to write the |
32 | * SPL/U-Boot combination generated with u-boot-with-spl.imx directly to a | 32 | * SPL/U-Boot combination generated with u-boot-with-spl.imx directly to a |
33 | * boot media (given that boot media specific offset is configured properly). | 33 | * boot media (given that boot media specific offset is configured properly). |
34 | */ | 34 | */ |
35 | #define CONFIG_SPL_PAD_TO 0x11000 | 35 | #define CONFIG_SPL_PAD_TO 0x11000 |
36 | 36 | ||
37 | /* MMC support */ | 37 | /* MMC support */ |
38 | #if defined(CONFIG_SPL_MMC_SUPPORT) | 38 | #if defined(CONFIG_SPL_MMC_SUPPORT) |
39 | #define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION 1 | 39 | #define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION 1 |
40 | #define CONFIG_SYS_MONITOR_LEN 409600 /* 400 KB */ | 40 | #define CONFIG_SYS_MONITOR_LEN 409600 /* 400 KB */ |
41 | #endif | 41 | #endif |
42 | 42 | ||
43 | /* SATA support */ | 43 | /* SATA support */ |
44 | #if defined(CONFIG_SPL_SATA_SUPPORT) | 44 | #if defined(CONFIG_SPL_SATA_SUPPORT) |
45 | #define CONFIG_SPL_SATA_BOOT_DEVICE 0 | 45 | #define CONFIG_SPL_SATA_BOOT_DEVICE 0 |
46 | #define CONFIG_SYS_SATA_FAT_BOOT_PARTITION 1 | 46 | #define CONFIG_SYS_SATA_FAT_BOOT_PARTITION 1 |
47 | #endif | 47 | #endif |
48 | 48 | ||
49 | /* Define the payload for FAT/EXT support */ | 49 | /* Define the payload for FAT/EXT support */ |
50 | #if defined(CONFIG_SPL_FAT_SUPPORT) || defined(CONFIG_SPL_EXT_SUPPORT) | 50 | #if defined(CONFIG_SPL_FAT_SUPPORT) || defined(CONFIG_SPL_EXT_SUPPORT) |
51 | # ifdef CONFIG_OF_CONTROL | 51 | # ifdef CONFIG_OF_CONTROL |
52 | # define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME "u-boot-dtb.img" | 52 | # define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME "u-boot-dtb.img" |
53 | # else | 53 | # else |
54 | # define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME "u-boot.img" | 54 | # define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME "u-boot.img" |
55 | # endif | 55 | # endif |
56 | #endif | 56 | #endif |
57 | 57 | ||
58 | #if defined(CONFIG_MX6SX) || defined(CONFIG_MX6UL) || defined(CONFIG_MX6SL) | 58 | #if defined(CONFIG_MX6SX) || defined(CONFIG_MX6SL) || \ |
59 | defined(CONFIG_MX6UL) || defined(CONFIG_MX6ULL) | ||
59 | #define CONFIG_SPL_BSS_START_ADDR 0x88200000 | 60 | #define CONFIG_SPL_BSS_START_ADDR 0x88200000 |
60 | #define CONFIG_SPL_BSS_MAX_SIZE 0x100000 /* 1 MB */ | 61 | #define CONFIG_SPL_BSS_MAX_SIZE 0x100000 /* 1 MB */ |
61 | #define CONFIG_SYS_SPL_MALLOC_START 0x88300000 | 62 | #define CONFIG_SYS_SPL_MALLOC_START 0x88300000 |
62 | #define CONFIG_SYS_SPL_MALLOC_SIZE 0x100000 /* 1 MB */ | 63 | #define CONFIG_SYS_SPL_MALLOC_SIZE 0x100000 /* 1 MB */ |
63 | #define CONFIG_SYS_TEXT_BASE 0x87800000 | 64 | #define CONFIG_SYS_TEXT_BASE 0x87800000 |
64 | #else | 65 | #else |
65 | #define CONFIG_SPL_BSS_START_ADDR 0x18200000 | 66 | #define CONFIG_SPL_BSS_START_ADDR 0x18200000 |
66 | #define CONFIG_SPL_BSS_MAX_SIZE 0x100000 /* 1 MB */ | 67 | #define CONFIG_SPL_BSS_MAX_SIZE 0x100000 /* 1 MB */ |
67 | #define CONFIG_SYS_SPL_MALLOC_START 0x18300000 | 68 | #define CONFIG_SYS_SPL_MALLOC_START 0x18300000 |
68 | #define CONFIG_SYS_SPL_MALLOC_SIZE 0x100000 /* 1 MB */ | 69 | #define CONFIG_SYS_SPL_MALLOC_SIZE 0x100000 /* 1 MB */ |
69 | #define CONFIG_SYS_TEXT_BASE 0x17800000 | 70 | #define CONFIG_SYS_TEXT_BASE 0x17800000 |
70 | #endif | 71 | #endif |
71 | #endif | 72 | #endif |
72 | 73 | ||
73 | #endif | 74 | #endif |
74 | 75 |
include/configs/mx6_common.h
1 | /* | 1 | /* |
2 | * Copyright (c) 2013, NVIDIA CORPORATION. All rights reserved. | 2 | * Copyright (c) 2013, NVIDIA CORPORATION. All rights reserved. |
3 | * | 3 | * |
4 | * SPDX-License-Identifier: GPL-2.0 | 4 | * SPDX-License-Identifier: GPL-2.0 |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #ifndef __MX6_COMMON_H | 7 | #ifndef __MX6_COMMON_H |
8 | #define __MX6_COMMON_H | 8 | #define __MX6_COMMON_H |
9 | 9 | ||
10 | #ifndef CONFIG_MX6UL | 10 | #if !(defined(CONFIG_MX6UL) || defined(CONFIG_MX6ULL)) |
11 | #ifndef CONFIG_SYS_L2CACHE_OFF | 11 | #ifndef CONFIG_SYS_L2CACHE_OFF |
12 | #define CONFIG_SYS_L2_PL310 | 12 | #define CONFIG_SYS_L2_PL310 |
13 | #define CONFIG_SYS_PL310_BASE L2_PL310_BASE | 13 | #define CONFIG_SYS_PL310_BASE L2_PL310_BASE |
14 | #endif | 14 | #endif |
15 | 15 | ||
16 | #define CONFIG_MP | 16 | #define CONFIG_MP |
17 | #endif | 17 | #endif |
18 | #define CONFIG_BOARD_POSTCLK_INIT | 18 | #define CONFIG_BOARD_POSTCLK_INIT |
19 | #define CONFIG_MXC_GPT_HCLK | 19 | #define CONFIG_MXC_GPT_HCLK |
20 | 20 | ||
21 | #define CONFIG_SYS_BOOTM_LEN 0x1000000 | 21 | #define CONFIG_SYS_BOOTM_LEN 0x1000000 |
22 | 22 | ||
23 | #include <linux/sizes.h> | 23 | #include <linux/sizes.h> |
24 | #include <asm/arch/imx-regs.h> | 24 | #include <asm/arch/imx-regs.h> |
25 | #include <asm/mach-imx/gpio.h> | 25 | #include <asm/mach-imx/gpio.h> |
26 | 26 | ||
27 | #ifndef CONFIG_MX6 | 27 | #ifndef CONFIG_MX6 |
28 | #define CONFIG_MX6 | 28 | #define CONFIG_MX6 |
29 | #endif | 29 | #endif |
30 | 30 | ||
31 | #define CONFIG_SYS_FSL_CLK | 31 | #define CONFIG_SYS_FSL_CLK |
32 | 32 | ||
33 | /* ATAGs */ | 33 | /* ATAGs */ |
34 | #define CONFIG_CMDLINE_TAG | 34 | #define CONFIG_CMDLINE_TAG |
35 | #define CONFIG_SETUP_MEMORY_TAGS | 35 | #define CONFIG_SETUP_MEMORY_TAGS |
36 | #define CONFIG_INITRD_TAG | 36 | #define CONFIG_INITRD_TAG |
37 | #define CONFIG_REVISION_TAG | 37 | #define CONFIG_REVISION_TAG |
38 | 38 | ||
39 | /* Boot options */ | 39 | /* Boot options */ |
40 | #if (defined(CONFIG_MX6SX) || defined(CONFIG_MX6SL) || \ | 40 | #if defined(CONFIG_MX6SL) || defined(CONFIG_MX6SLL) || \ |
41 | defined(CONFIG_MX6UL) || defined(CONFIG_MX6SLL)) | 41 | defined(CONFIG_MX6SX) || \ |
42 | defined(CONFIG_MX6UL) || defined(CONFIG_MX6ULL) | ||
42 | #define CONFIG_LOADADDR 0x82000000 | 43 | #define CONFIG_LOADADDR 0x82000000 |
43 | #ifndef CONFIG_SYS_TEXT_BASE | 44 | #ifndef CONFIG_SYS_TEXT_BASE |
44 | #define CONFIG_SYS_TEXT_BASE 0x87800000 | 45 | #define CONFIG_SYS_TEXT_BASE 0x87800000 |
45 | #endif | 46 | #endif |
46 | #else | 47 | #else |
47 | #define CONFIG_LOADADDR 0x12000000 | 48 | #define CONFIG_LOADADDR 0x12000000 |
48 | #ifndef CONFIG_SYS_TEXT_BASE | 49 | #ifndef CONFIG_SYS_TEXT_BASE |
49 | #define CONFIG_SYS_TEXT_BASE 0x17800000 | 50 | #define CONFIG_SYS_TEXT_BASE 0x17800000 |
50 | #endif | 51 | #endif |
51 | #endif | 52 | #endif |
52 | #define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR | 53 | #define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR |
53 | 54 | ||
54 | /* allow to overwrite serial and ethaddr */ | 55 | /* allow to overwrite serial and ethaddr */ |
55 | #define CONFIG_ENV_OVERWRITE | 56 | #define CONFIG_ENV_OVERWRITE |
56 | #define CONFIG_CONS_INDEX 1 | 57 | #define CONFIG_CONS_INDEX 1 |
57 | 58 | ||
58 | /* Filesystems and image support */ | 59 | /* Filesystems and image support */ |
59 | #define CONFIG_SUPPORT_RAW_INITRD | 60 | #define CONFIG_SUPPORT_RAW_INITRD |
60 | 61 | ||
61 | /* Miscellaneous configurable options */ | 62 | /* Miscellaneous configurable options */ |
62 | #define CONFIG_SYS_LONGHELP | 63 | #define CONFIG_SYS_LONGHELP |
63 | #define CONFIG_CMDLINE_EDITING | 64 | #define CONFIG_CMDLINE_EDITING |
64 | #define CONFIG_AUTO_COMPLETE | 65 | #define CONFIG_AUTO_COMPLETE |
65 | #define CONFIG_SYS_CBSIZE 512 | 66 | #define CONFIG_SYS_CBSIZE 512 |
66 | #define CONFIG_SYS_MAXARGS 32 | 67 | #define CONFIG_SYS_MAXARGS 32 |
67 | 68 | ||
68 | /* GPIO */ | 69 | /* GPIO */ |
69 | #define CONFIG_MXC_GPIO | 70 | #define CONFIG_MXC_GPIO |
70 | 71 | ||
71 | /* MMC */ | 72 | /* MMC */ |
72 | #define CONFIG_BOUNCE_BUFFER | 73 | #define CONFIG_BOUNCE_BUFFER |
73 | #define CONFIG_FSL_ESDHC | 74 | #define CONFIG_FSL_ESDHC |
74 | #define CONFIG_FSL_USDHC | 75 | #define CONFIG_FSL_USDHC |
75 | 76 | ||
76 | /* Fuses */ | 77 | /* Fuses */ |
77 | #define CONFIG_MXC_OCOTP | 78 | #define CONFIG_MXC_OCOTP |
78 | 79 | ||
79 | /* Secure boot (HAB) support */ | 80 | /* Secure boot (HAB) support */ |
80 | #ifdef CONFIG_SECURE_BOOT | 81 | #ifdef CONFIG_SECURE_BOOT |
81 | #define CONFIG_CSF_SIZE 0x2000 | 82 | #define CONFIG_CSF_SIZE 0x2000 |
82 | #ifdef CONFIG_SPL_BUILD | 83 | #ifdef CONFIG_SPL_BUILD |
83 | #define CONFIG_SPL_DRIVERS_MISC_SUPPORT | 84 | #define CONFIG_SPL_DRIVERS_MISC_SUPPORT |
84 | #endif | 85 | #endif |
85 | #endif | 86 | #endif |
86 | 87 | ||
87 | #endif | 88 | #endif |
88 | 89 |