Jason Liu | 18936ee | 2011-11-25 00:18:01 +0000 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2007 |
| 3 | * Sascha Hauer, Pengutronix |
| 4 | * |
| 5 | * (C) Copyright 2009 Freescale Semiconductor, Inc. |
| 6 | * |
Wolfgang Denk | 1a45966 | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 7 | * SPDX-License-Identifier: GPL-2.0+ |
Jason Liu | 18936ee | 2011-11-25 00:18:01 +0000 | [diff] [blame] | 8 | */ |
| 9 | |
Jeroen Hofstee | 5624c6b | 2014-10-08 22:57:52 +0200 | [diff] [blame] | 10 | #include <bootm.h> |
Jason Liu | 18936ee | 2011-11-25 00:18:01 +0000 | [diff] [blame] | 11 | #include <common.h> |
Jeroen Hofstee | 5624c6b | 2014-10-08 22:57:52 +0200 | [diff] [blame] | 12 | #include <netdev.h> |
Masahiro Yamada | 1221ce4 | 2016-09-21 11:28:55 +0900 | [diff] [blame] | 13 | #include <linux/errno.h> |
Jason Liu | 18936ee | 2011-11-25 00:18:01 +0000 | [diff] [blame] | 14 | #include <asm/io.h> |
| 15 | #include <asm/arch/imx-regs.h> |
| 16 | #include <asm/arch/clock.h> |
| 17 | #include <asm/arch/sys_proto.h> |
Fabio Estevam | 6a37604 | 2012-04-29 08:11:13 +0000 | [diff] [blame] | 18 | #include <asm/arch/crm_regs.h> |
Tim Harvey | 70caa8e | 2015-05-18 06:56:46 -0700 | [diff] [blame] | 19 | #include <imx_thermal.h> |
Eric Nelson | e1eb75b | 2012-09-23 07:30:55 +0000 | [diff] [blame] | 20 | #include <ipu_pixfmt.h> |
Ye.Li | 7a26416 | 2014-11-20 21:14:14 +0800 | [diff] [blame] | 21 | #include <thermal.h> |
Nikita Kiryanov | 44b9841 | 2014-11-21 12:47:26 +0200 | [diff] [blame] | 22 | #include <sata.h> |
Jason Liu | 18936ee | 2011-11-25 00:18:01 +0000 | [diff] [blame] | 23 | |
| 24 | #ifdef CONFIG_FSL_ESDHC |
| 25 | #include <fsl_esdhc.h> |
| 26 | #endif |
| 27 | |
Prabhakar Kushwaha | 28420e7 | 2015-05-18 17:13:52 +0530 | [diff] [blame] | 28 | #if defined(CONFIG_DISPLAY_CPUINFO) |
Eric Nelson | 11c2e50 | 2015-02-15 14:37:21 -0700 | [diff] [blame] | 29 | static u32 reset_cause = -1; |
| 30 | |
| 31 | static char *get_reset_cause(void) |
Jason Liu | 18936ee | 2011-11-25 00:18:01 +0000 | [diff] [blame] | 32 | { |
| 33 | u32 cause; |
| 34 | struct src *src_regs = (struct src *)SRC_BASE_ADDR; |
| 35 | |
| 36 | cause = readl(&src_regs->srsr); |
| 37 | writel(cause, &src_regs->srsr); |
Eric Nelson | 11c2e50 | 2015-02-15 14:37:21 -0700 | [diff] [blame] | 38 | reset_cause = cause; |
Jason Liu | 18936ee | 2011-11-25 00:18:01 +0000 | [diff] [blame] | 39 | |
| 40 | switch (cause) { |
| 41 | case 0x00001: |
Fabio Estevam | cece262 | 2012-03-13 07:26:48 +0000 | [diff] [blame] | 42 | case 0x00011: |
Jason Liu | 18936ee | 2011-11-25 00:18:01 +0000 | [diff] [blame] | 43 | return "POR"; |
| 44 | case 0x00004: |
| 45 | return "CSU"; |
| 46 | case 0x00008: |
| 47 | return "IPP USER"; |
| 48 | case 0x00010: |
Adrian Alonso | cd562c8 | 2015-09-02 13:54:23 -0500 | [diff] [blame] | 49 | #ifdef CONFIG_MX7 |
| 50 | return "WDOG1"; |
| 51 | #else |
Jason Liu | 18936ee | 2011-11-25 00:18:01 +0000 | [diff] [blame] | 52 | return "WDOG"; |
Adrian Alonso | cd562c8 | 2015-09-02 13:54:23 -0500 | [diff] [blame] | 53 | #endif |
Jason Liu | 18936ee | 2011-11-25 00:18:01 +0000 | [diff] [blame] | 54 | case 0x00020: |
| 55 | return "JTAG HIGH-Z"; |
| 56 | case 0x00040: |
| 57 | return "JTAG SW"; |
Adrian Alonso | cd562c8 | 2015-09-02 13:54:23 -0500 | [diff] [blame] | 58 | case 0x00080: |
| 59 | return "WDOG3"; |
| 60 | #ifdef CONFIG_MX7 |
| 61 | case 0x00100: |
| 62 | return "WDOG4"; |
| 63 | case 0x00200: |
| 64 | return "TEMPSENSE"; |
| 65 | #else |
| 66 | case 0x00100: |
| 67 | return "TEMPSENSE"; |
Jason Liu | 18936ee | 2011-11-25 00:18:01 +0000 | [diff] [blame] | 68 | case 0x10000: |
| 69 | return "WARM BOOT"; |
Adrian Alonso | cd562c8 | 2015-09-02 13:54:23 -0500 | [diff] [blame] | 70 | #endif |
Jason Liu | 18936ee | 2011-11-25 00:18:01 +0000 | [diff] [blame] | 71 | default: |
| 72 | return "unknown reset"; |
| 73 | } |
| 74 | } |
| 75 | |
Eric Nelson | 11c2e50 | 2015-02-15 14:37:21 -0700 | [diff] [blame] | 76 | u32 get_imx_reset_cause(void) |
| 77 | { |
| 78 | return reset_cause; |
| 79 | } |
Prabhakar Kushwaha | 28420e7 | 2015-05-18 17:13:52 +0530 | [diff] [blame] | 80 | #endif |
Eric Nelson | 11c2e50 | 2015-02-15 14:37:21 -0700 | [diff] [blame] | 81 | |
Troy Kisky | eb0344d | 2012-10-23 10:57:48 +0000 | [diff] [blame] | 82 | #if defined(CONFIG_MX53) || defined(CONFIG_MX6) |
| 83 | #if defined(CONFIG_MX53) |
Eric Nelson | 3e9cbbb | 2013-11-08 16:50:53 -0700 | [diff] [blame] | 84 | #define MEMCTL_BASE ESDCTL_BASE_ADDR |
Troy Kisky | eb0344d | 2012-10-23 10:57:48 +0000 | [diff] [blame] | 85 | #else |
Eric Nelson | 3e9cbbb | 2013-11-08 16:50:53 -0700 | [diff] [blame] | 86 | #define MEMCTL_BASE MMDC_P0_BASE_ADDR |
Troy Kisky | eb0344d | 2012-10-23 10:57:48 +0000 | [diff] [blame] | 87 | #endif |
| 88 | static const unsigned char col_lookup[] = {9, 10, 11, 8, 12, 9, 9, 9}; |
| 89 | static const unsigned char bank_lookup[] = {3, 2}; |
| 90 | |
Tim Harvey | b07161c | 2014-06-02 16:13:21 -0700 | [diff] [blame] | 91 | /* these MMDC registers are common to the IMX53 and IMX6 */ |
Troy Kisky | eb0344d | 2012-10-23 10:57:48 +0000 | [diff] [blame] | 92 | struct esd_mmdc_regs { |
| 93 | uint32_t ctl; |
| 94 | uint32_t pdc; |
| 95 | uint32_t otc; |
| 96 | uint32_t cfg0; |
| 97 | uint32_t cfg1; |
| 98 | uint32_t cfg2; |
| 99 | uint32_t misc; |
Troy Kisky | eb0344d | 2012-10-23 10:57:48 +0000 | [diff] [blame] | 100 | }; |
| 101 | |
| 102 | #define ESD_MMDC_CTL_GET_ROW(mdctl) ((ctl >> 24) & 7) |
| 103 | #define ESD_MMDC_CTL_GET_COLUMN(mdctl) ((ctl >> 20) & 7) |
| 104 | #define ESD_MMDC_CTL_GET_WIDTH(mdctl) ((ctl >> 16) & 3) |
| 105 | #define ESD_MMDC_CTL_GET_CS1(mdctl) ((ctl >> 30) & 1) |
| 106 | #define ESD_MMDC_MISC_GET_BANK(mdmisc) ((misc >> 5) & 1) |
| 107 | |
Tim Harvey | b07161c | 2014-06-02 16:13:21 -0700 | [diff] [blame] | 108 | /* |
| 109 | * imx_ddr_size - return size in bytes of DRAM according MMDC config |
| 110 | * The MMDC MDCTL register holds the number of bits for row, col, and data |
| 111 | * width and the MMDC MDMISC register holds the number of banks. Combine |
| 112 | * all these bits to determine the meme size the MMDC has been configured for |
| 113 | */ |
Troy Kisky | eb0344d | 2012-10-23 10:57:48 +0000 | [diff] [blame] | 114 | unsigned imx_ddr_size(void) |
| 115 | { |
| 116 | struct esd_mmdc_regs *mem = (struct esd_mmdc_regs *)MEMCTL_BASE; |
| 117 | unsigned ctl = readl(&mem->ctl); |
| 118 | unsigned misc = readl(&mem->misc); |
| 119 | int bits = 11 + 0 + 0 + 1; /* row + col + bank + width */ |
| 120 | |
| 121 | bits += ESD_MMDC_CTL_GET_ROW(ctl); |
| 122 | bits += col_lookup[ESD_MMDC_CTL_GET_COLUMN(ctl)]; |
| 123 | bits += bank_lookup[ESD_MMDC_MISC_GET_BANK(misc)]; |
| 124 | bits += ESD_MMDC_CTL_GET_WIDTH(ctl); |
| 125 | bits += ESD_MMDC_CTL_GET_CS1(ctl); |
Marek Vasut | fcfdfdd | 2014-08-04 01:47:09 +0200 | [diff] [blame] | 126 | |
| 127 | /* The MX6 can do only 3840 MiB of DRAM */ |
| 128 | if (bits == 32) |
| 129 | return 0xf0000000; |
| 130 | |
Troy Kisky | eb0344d | 2012-10-23 10:57:48 +0000 | [diff] [blame] | 131 | return 1 << bits; |
| 132 | } |
| 133 | #endif |
| 134 | |
Jason Liu | 18936ee | 2011-11-25 00:18:01 +0000 | [diff] [blame] | 135 | #if defined(CONFIG_DISPLAY_CPUINFO) |
Fabio Estevam | a768386 | 2012-03-20 04:21:45 +0000 | [diff] [blame] | 136 | |
Troy Kisky | 20332a0 | 2012-10-23 10:57:46 +0000 | [diff] [blame] | 137 | const char *get_imx_type(u32 imxtype) |
Fabio Estevam | a768386 | 2012-03-20 04:21:45 +0000 | [diff] [blame] | 138 | { |
| 139 | switch (imxtype) { |
Fabio Estevam | e25a065 | 2016-02-28 12:33:17 -0300 | [diff] [blame] | 140 | case MXC_CPU_MX7S: |
Stefan Agner | 249092f | 2016-05-06 11:21:50 -0700 | [diff] [blame] | 141 | return "7S"; /* Single-core version of the mx7 */ |
Adrian Alonso | cd562c8 | 2015-09-02 13:54:23 -0500 | [diff] [blame] | 142 | case MXC_CPU_MX7D: |
| 143 | return "7D"; /* Dual-core version of the mx7 */ |
Peng Fan | d0acd99 | 2015-07-11 11:38:42 +0800 | [diff] [blame] | 144 | case MXC_CPU_MX6QP: |
| 145 | return "6QP"; /* Quad-Plus version of the mx6 */ |
| 146 | case MXC_CPU_MX6DP: |
| 147 | return "6DP"; /* Dual-Plus version of the mx6 */ |
Troy Kisky | 20332a0 | 2012-10-23 10:57:46 +0000 | [diff] [blame] | 148 | case MXC_CPU_MX6Q: |
Fabio Estevam | a768386 | 2012-03-20 04:21:45 +0000 | [diff] [blame] | 149 | return "6Q"; /* Quad-core version of the mx6 */ |
Fabio Estevam | 94db665 | 2014-01-26 15:06:41 -0200 | [diff] [blame] | 150 | case MXC_CPU_MX6D: |
| 151 | return "6D"; /* Dual-core version of the mx6 */ |
Troy Kisky | 20332a0 | 2012-10-23 10:57:46 +0000 | [diff] [blame] | 152 | case MXC_CPU_MX6DL: |
| 153 | return "6DL"; /* Dual Lite version of the mx6 */ |
| 154 | case MXC_CPU_MX6SOLO: |
| 155 | return "6SOLO"; /* Solo version of the mx6 */ |
| 156 | case MXC_CPU_MX6SL: |
Fabio Estevam | a768386 | 2012-03-20 04:21:45 +0000 | [diff] [blame] | 157 | return "6SL"; /* Solo-Lite version of the mx6 */ |
Fabio Estevam | 05d54b8 | 2014-06-24 17:40:58 -0300 | [diff] [blame] | 158 | case MXC_CPU_MX6SX: |
| 159 | return "6SX"; /* SoloX version of the mx6 */ |
Peng Fan | 8631c06 | 2015-07-20 19:28:21 +0800 | [diff] [blame] | 160 | case MXC_CPU_MX6UL: |
| 161 | return "6UL"; /* Ultra-Lite version of the mx6 */ |
Peng Fan | 65ce54b | 2016-08-11 14:02:38 +0800 | [diff] [blame] | 162 | case MXC_CPU_MX6ULL: |
| 163 | return "6ULL"; /* ULL version of the mx6 */ |
Troy Kisky | 20332a0 | 2012-10-23 10:57:46 +0000 | [diff] [blame] | 164 | case MXC_CPU_MX51: |
Fabio Estevam | a768386 | 2012-03-20 04:21:45 +0000 | [diff] [blame] | 165 | return "51"; |
Troy Kisky | 20332a0 | 2012-10-23 10:57:46 +0000 | [diff] [blame] | 166 | case MXC_CPU_MX53: |
Fabio Estevam | a768386 | 2012-03-20 04:21:45 +0000 | [diff] [blame] | 167 | return "53"; |
| 168 | default: |
Otavio Salvador | e972d72 | 2012-06-30 05:07:32 +0000 | [diff] [blame] | 169 | return "??"; |
Fabio Estevam | a768386 | 2012-03-20 04:21:45 +0000 | [diff] [blame] | 170 | } |
| 171 | } |
| 172 | |
Jason Liu | 18936ee | 2011-11-25 00:18:01 +0000 | [diff] [blame] | 173 | int print_cpuinfo(void) |
| 174 | { |
Stefano Babic | 943a3f2 | 2015-05-26 19:53:41 +0200 | [diff] [blame] | 175 | u32 cpurev; |
| 176 | __maybe_unused u32 max_freq; |
Jason Liu | 18936ee | 2011-11-25 00:18:01 +0000 | [diff] [blame] | 177 | |
| 178 | cpurev = get_cpu_rev(); |
Fabio Estevam | a768386 | 2012-03-20 04:21:45 +0000 | [diff] [blame] | 179 | |
Adrian Alonso | 1368f99 | 2015-09-02 13:54:13 -0500 | [diff] [blame] | 180 | #if defined(CONFIG_IMX_THERMAL) |
| 181 | struct udevice *thermal_dev; |
| 182 | int cpu_tmp, minc, maxc, ret; |
| 183 | |
Tim Harvey | b83ddac | 2015-05-18 07:02:25 -0700 | [diff] [blame] | 184 | printf("CPU: Freescale i.MX%s rev%d.%d", |
| 185 | get_imx_type((cpurev & 0xFF000) >> 12), |
| 186 | (cpurev & 0x000F0) >> 4, |
| 187 | (cpurev & 0x0000F) >> 0); |
| 188 | max_freq = get_cpu_speed_grade_hz(); |
| 189 | if (!max_freq || max_freq == mxc_get_clock(MXC_ARM_CLK)) { |
| 190 | printf(" at %dMHz\n", mxc_get_clock(MXC_ARM_CLK) / 1000000); |
| 191 | } else { |
| 192 | printf(" %d MHz (running at %d MHz)\n", max_freq / 1000000, |
| 193 | mxc_get_clock(MXC_ARM_CLK) / 1000000); |
| 194 | } |
| 195 | #else |
Fabio Estevam | a768386 | 2012-03-20 04:21:45 +0000 | [diff] [blame] | 196 | printf("CPU: Freescale i.MX%s rev%d.%d at %d MHz\n", |
| 197 | get_imx_type((cpurev & 0xFF000) >> 12), |
Jason Liu | 18936ee | 2011-11-25 00:18:01 +0000 | [diff] [blame] | 198 | (cpurev & 0x000F0) >> 4, |
| 199 | (cpurev & 0x0000F) >> 0, |
| 200 | mxc_get_clock(MXC_ARM_CLK) / 1000000); |
Tim Harvey | b83ddac | 2015-05-18 07:02:25 -0700 | [diff] [blame] | 201 | #endif |
Ye.Li | 7a26416 | 2014-11-20 21:14:14 +0800 | [diff] [blame] | 202 | |
Adrian Alonso | 1368f99 | 2015-09-02 13:54:13 -0500 | [diff] [blame] | 203 | #if defined(CONFIG_IMX_THERMAL) |
Tim Harvey | 70caa8e | 2015-05-18 06:56:46 -0700 | [diff] [blame] | 204 | puts("CPU: "); |
| 205 | switch (get_cpu_temp_grade(&minc, &maxc)) { |
| 206 | case TEMP_AUTOMOTIVE: |
| 207 | puts("Automotive temperature grade "); |
| 208 | break; |
| 209 | case TEMP_INDUSTRIAL: |
| 210 | puts("Industrial temperature grade "); |
| 211 | break; |
| 212 | case TEMP_EXTCOMMERCIAL: |
| 213 | puts("Extended Commercial temperature grade "); |
| 214 | break; |
| 215 | default: |
| 216 | puts("Commercial temperature grade "); |
| 217 | break; |
| 218 | } |
| 219 | printf("(%dC to %dC)", minc, maxc); |
Ye.Li | 7a26416 | 2014-11-20 21:14:14 +0800 | [diff] [blame] | 220 | ret = uclass_get_device(UCLASS_THERMAL, 0, &thermal_dev); |
| 221 | if (!ret) { |
| 222 | ret = thermal_get_temp(thermal_dev, &cpu_tmp); |
| 223 | |
| 224 | if (!ret) |
Tim Harvey | 70caa8e | 2015-05-18 06:56:46 -0700 | [diff] [blame] | 225 | printf(" at %dC\n", cpu_tmp); |
Ye.Li | 7a26416 | 2014-11-20 21:14:14 +0800 | [diff] [blame] | 226 | else |
Fabio Estevam | 3a384b4 | 2015-09-08 14:43:10 -0300 | [diff] [blame] | 227 | debug(" - invalid sensor data\n"); |
Ye.Li | 7a26416 | 2014-11-20 21:14:14 +0800 | [diff] [blame] | 228 | } else { |
Fabio Estevam | 3a384b4 | 2015-09-08 14:43:10 -0300 | [diff] [blame] | 229 | debug(" - invalid sensor device\n"); |
Ye.Li | 7a26416 | 2014-11-20 21:14:14 +0800 | [diff] [blame] | 230 | } |
| 231 | #endif |
| 232 | |
Jason Liu | 18936ee | 2011-11-25 00:18:01 +0000 | [diff] [blame] | 233 | printf("Reset cause: %s\n", get_reset_cause()); |
| 234 | return 0; |
| 235 | } |
| 236 | #endif |
| 237 | |
| 238 | int cpu_eth_init(bd_t *bis) |
| 239 | { |
| 240 | int rc = -ENODEV; |
| 241 | |
| 242 | #if defined(CONFIG_FEC_MXC) |
| 243 | rc = fecmxc_initialize(bis); |
| 244 | #endif |
| 245 | |
| 246 | return rc; |
| 247 | } |
| 248 | |
Benoît Thébaudeau | ecb0f31 | 2012-08-17 10:42:55 +0000 | [diff] [blame] | 249 | #ifdef CONFIG_FSL_ESDHC |
Jason Liu | 18936ee | 2011-11-25 00:18:01 +0000 | [diff] [blame] | 250 | /* |
| 251 | * Initializes on-chip MMC controllers. |
| 252 | * to override, implement board_mmc_init() |
| 253 | */ |
| 254 | int cpu_mmc_init(bd_t *bis) |
| 255 | { |
Jason Liu | 18936ee | 2011-11-25 00:18:01 +0000 | [diff] [blame] | 256 | return fsl_esdhc_mmc_init(bis); |
Jason Liu | 18936ee | 2011-11-25 00:18:01 +0000 | [diff] [blame] | 257 | } |
Benoît Thébaudeau | ecb0f31 | 2012-08-17 10:42:55 +0000 | [diff] [blame] | 258 | #endif |
Jason Liu | 18936ee | 2011-11-25 00:18:01 +0000 | [diff] [blame] | 259 | |
Adrian Alonso | cd562c8 | 2015-09-02 13:54:23 -0500 | [diff] [blame] | 260 | #ifndef CONFIG_MX7 |
Fabio Estevam | 6a37604 | 2012-04-29 08:11:13 +0000 | [diff] [blame] | 261 | u32 get_ahb_clk(void) |
| 262 | { |
| 263 | struct mxc_ccm_reg *imx_ccm = (struct mxc_ccm_reg *)CCM_BASE_ADDR; |
| 264 | u32 reg, ahb_podf; |
| 265 | |
| 266 | reg = __raw_readl(&imx_ccm->cbcdr); |
| 267 | reg &= MXC_CCM_CBCDR_AHB_PODF_MASK; |
| 268 | ahb_podf = reg >> MXC_CCM_CBCDR_AHB_PODF_OFFSET; |
| 269 | |
| 270 | return get_periph_clk() / (ahb_podf + 1); |
| 271 | } |
Adrian Alonso | cd562c8 | 2015-09-02 13:54:23 -0500 | [diff] [blame] | 272 | #endif |
Eric Nelson | e1eb75b | 2012-09-23 07:30:55 +0000 | [diff] [blame] | 273 | |
Eric Nelson | e1eb75b | 2012-09-23 07:30:55 +0000 | [diff] [blame] | 274 | void arch_preboot_os(void) |
| 275 | { |
Nikita Kiryanov | 44b9841 | 2014-11-21 12:47:26 +0200 | [diff] [blame] | 276 | #if defined(CONFIG_CMD_SATA) |
| 277 | sata_stop(); |
Soeren Moch | dd1c8f1 | 2014-11-27 10:11:41 +0100 | [diff] [blame] | 278 | #if defined(CONFIG_MX6) |
| 279 | disable_sata_clock(); |
| 280 | #endif |
Nikita Kiryanov | 44b9841 | 2014-11-21 12:47:26 +0200 | [diff] [blame] | 281 | #endif |
| 282 | #if defined(CONFIG_VIDEO_IPUV3) |
Eric Nelson | e1eb75b | 2012-09-23 07:30:55 +0000 | [diff] [blame] | 283 | /* disable video before launching O/S */ |
| 284 | ipuv3_fb_shutdown(); |
Eric Nelson | e1eb75b | 2012-09-23 07:30:55 +0000 | [diff] [blame] | 285 | #endif |
Peng Fan | 623787f | 2015-10-29 15:54:51 +0800 | [diff] [blame] | 286 | #if defined(CONFIG_VIDEO_MXS) |
| 287 | lcdif_power_down(); |
| 288 | #endif |
Nikita Kiryanov | 44b9841 | 2014-11-21 12:47:26 +0200 | [diff] [blame] | 289 | } |
Fabio Estevam | 32c81ea | 2014-11-14 11:27:21 -0200 | [diff] [blame] | 290 | |
| 291 | void set_chipselect_size(int const cs_size) |
| 292 | { |
| 293 | unsigned int reg; |
| 294 | struct iomuxc *iomuxc_regs = (struct iomuxc *)IOMUXC_BASE_ADDR; |
| 295 | reg = readl(&iomuxc_regs->gpr[1]); |
| 296 | |
| 297 | switch (cs_size) { |
| 298 | case CS0_128: |
| 299 | reg &= ~0x7; /* CS0=128MB, CS1=0, CS2=0, CS3=0 */ |
| 300 | reg |= 0x5; |
| 301 | break; |
| 302 | case CS0_64M_CS1_64M: |
| 303 | reg &= ~0x3F; /* CS0=64MB, CS1=64MB, CS2=0, CS3=0 */ |
| 304 | reg |= 0x1B; |
| 305 | break; |
| 306 | case CS0_64M_CS1_32M_CS2_32M: |
| 307 | reg &= ~0x1FF; /* CS0=64MB, CS1=32MB, CS2=32MB, CS3=0 */ |
| 308 | reg |= 0x4B; |
| 309 | break; |
| 310 | case CS0_32M_CS1_32M_CS2_32M_CS3_32M: |
| 311 | reg &= ~0xFFF; /* CS0=32MB, CS1=32MB, CS2=32MB, CS3=32MB */ |
| 312 | reg |= 0x249; |
| 313 | break; |
| 314 | default: |
| 315 | printf("Unknown chip select size: %d\n", cs_size); |
| 316 | break; |
| 317 | } |
| 318 | |
| 319 | writel(reg, &iomuxc_regs->gpr[1]); |
| 320 | } |