Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Dipen Dudhat | d789b5f | 2011-01-20 16:29:35 +0530 | [diff] [blame] | 2 | /* |
| 3 | * Copyright 2010-2011 Freescale Semiconductor, Inc. |
| 4 | * Author: Dipen Dudhat <dipen.dudhat@freescale.com> |
Dipen Dudhat | d789b5f | 2011-01-20 16:29:35 +0530 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #include <common.h> |
York Sun | 0b66513 | 2013-10-22 12:39:02 -0700 | [diff] [blame] | 8 | #include <fsl_ifc.h> |
Dipen Dudhat | d789b5f | 2011-01-20 16:29:35 +0530 | [diff] [blame] | 9 | |
| 10 | void print_ifc_regs(void) |
| 11 | { |
| 12 | int i, j; |
| 13 | |
| 14 | printf("IFC Controller Registers\n"); |
Mingkai Hu | 362ee04 | 2013-05-16 10:18:13 +0800 | [diff] [blame] | 15 | for (i = 0; i < CONFIG_SYS_FSL_IFC_BANK_COUNT; i++) { |
Dipen Dudhat | d789b5f | 2011-01-20 16:29:35 +0530 | [diff] [blame] | 16 | printf("CSPR%d:0x%08X\tAMASK%d:0x%08X\tCSOR%d:0x%08X\n", |
| 17 | i, get_ifc_cspr(i), i, get_ifc_amask(i), |
| 18 | i, get_ifc_csor(i)); |
| 19 | for (j = 0; j < 4; j++) |
| 20 | printf("IFC_FTIM%d:0x%08X\n", j, get_ifc_ftim(i, j)); |
| 21 | } |
| 22 | } |
| 23 | |
| 24 | void init_early_memctl_regs(void) |
| 25 | { |
| 26 | #if defined(CONFIG_SYS_CSPR0) && defined(CONFIG_SYS_CSOR0) |
Dipen Dudhat | d789b5f | 2011-01-20 16:29:35 +0530 | [diff] [blame] | 27 | set_ifc_ftim(IFC_CS0, IFC_FTIM0, CONFIG_SYS_CS0_FTIM0); |
| 28 | set_ifc_ftim(IFC_CS0, IFC_FTIM1, CONFIG_SYS_CS0_FTIM1); |
| 29 | set_ifc_ftim(IFC_CS0, IFC_FTIM2, CONFIG_SYS_CS0_FTIM2); |
| 30 | set_ifc_ftim(IFC_CS0, IFC_FTIM3, CONFIG_SYS_CS0_FTIM3); |
Dipen Dudhat | d7da148 | 2011-04-08 16:04:51 +0530 | [diff] [blame] | 31 | |
Prabhakar Kushwaha | 74fa22e | 2013-04-16 13:27:44 +0530 | [diff] [blame] | 32 | #ifndef CONFIG_A003399_NOR_WORKAROUND |
Kumar Gala | ffdf889 | 2012-08-17 08:20:25 +0000 | [diff] [blame] | 33 | #ifdef CONFIG_SYS_CSPR0_EXT |
| 34 | set_ifc_cspr_ext(IFC_CS0, CONFIG_SYS_CSPR0_EXT); |
| 35 | #endif |
Prabhakar Kushwaha | 71220f8 | 2013-10-04 10:05:36 +0530 | [diff] [blame] | 36 | #ifdef CONFIG_SYS_CSOR0_EXT |
| 37 | set_ifc_csor_ext(IFC_CS0, CONFIG_SYS_CSOR0_EXT); |
| 38 | #endif |
Dipen Dudhat | d7da148 | 2011-04-08 16:04:51 +0530 | [diff] [blame] | 39 | set_ifc_cspr(IFC_CS0, CONFIG_SYS_CSPR0); |
| 40 | set_ifc_amask(IFC_CS0, CONFIG_SYS_AMASK0); |
| 41 | set_ifc_csor(IFC_CS0, CONFIG_SYS_CSOR0); |
Dipen Dudhat | d789b5f | 2011-01-20 16:29:35 +0530 | [diff] [blame] | 42 | #endif |
Poonam Aggrwal | bc6bbd6 | 2011-07-07 20:36:47 +0530 | [diff] [blame] | 43 | #endif |
Dipen Dudhat | d789b5f | 2011-01-20 16:29:35 +0530 | [diff] [blame] | 44 | |
Kumar Gala | ffdf889 | 2012-08-17 08:20:25 +0000 | [diff] [blame] | 45 | #ifdef CONFIG_SYS_CSPR1_EXT |
| 46 | set_ifc_cspr_ext(IFC_CS1, CONFIG_SYS_CSPR1_EXT); |
| 47 | #endif |
Prabhakar Kushwaha | 71220f8 | 2013-10-04 10:05:36 +0530 | [diff] [blame] | 48 | #ifdef CONFIG_SYS_CSOR1_EXT |
| 49 | set_ifc_csor_ext(IFC_CS1, CONFIG_SYS_CSOR1_EXT); |
| 50 | #endif |
Dipen Dudhat | d789b5f | 2011-01-20 16:29:35 +0530 | [diff] [blame] | 51 | #if defined(CONFIG_SYS_CSPR1) && defined(CONFIG_SYS_CSOR1) |
Dipen Dudhat | d789b5f | 2011-01-20 16:29:35 +0530 | [diff] [blame] | 52 | set_ifc_ftim(IFC_CS1, IFC_FTIM0, CONFIG_SYS_CS1_FTIM0); |
| 53 | set_ifc_ftim(IFC_CS1, IFC_FTIM1, CONFIG_SYS_CS1_FTIM1); |
| 54 | set_ifc_ftim(IFC_CS1, IFC_FTIM2, CONFIG_SYS_CS1_FTIM2); |
| 55 | set_ifc_ftim(IFC_CS1, IFC_FTIM3, CONFIG_SYS_CS1_FTIM3); |
Dipen Dudhat | d7da148 | 2011-04-08 16:04:51 +0530 | [diff] [blame] | 56 | |
| 57 | set_ifc_csor(IFC_CS1, CONFIG_SYS_CSOR1); |
| 58 | set_ifc_amask(IFC_CS1, CONFIG_SYS_AMASK1); |
| 59 | set_ifc_cspr(IFC_CS1, CONFIG_SYS_CSPR1); |
Dipen Dudhat | d789b5f | 2011-01-20 16:29:35 +0530 | [diff] [blame] | 60 | #endif |
| 61 | |
Kumar Gala | ffdf889 | 2012-08-17 08:20:25 +0000 | [diff] [blame] | 62 | #ifdef CONFIG_SYS_CSPR2_EXT |
| 63 | set_ifc_cspr_ext(IFC_CS2, CONFIG_SYS_CSPR2_EXT); |
| 64 | #endif |
Prabhakar Kushwaha | 71220f8 | 2013-10-04 10:05:36 +0530 | [diff] [blame] | 65 | #ifdef CONFIG_SYS_CSOR2_EXT |
| 66 | set_ifc_csor_ext(IFC_CS2, CONFIG_SYS_CSOR2_EXT); |
| 67 | #endif |
Dipen Dudhat | d789b5f | 2011-01-20 16:29:35 +0530 | [diff] [blame] | 68 | #if defined(CONFIG_SYS_CSPR2) && defined(CONFIG_SYS_CSOR2) |
Dipen Dudhat | d789b5f | 2011-01-20 16:29:35 +0530 | [diff] [blame] | 69 | set_ifc_ftim(IFC_CS2, IFC_FTIM0, CONFIG_SYS_CS2_FTIM0); |
| 70 | set_ifc_ftim(IFC_CS2, IFC_FTIM1, CONFIG_SYS_CS2_FTIM1); |
| 71 | set_ifc_ftim(IFC_CS2, IFC_FTIM2, CONFIG_SYS_CS2_FTIM2); |
| 72 | set_ifc_ftim(IFC_CS2, IFC_FTIM3, CONFIG_SYS_CS2_FTIM3); |
| 73 | |
Dipen Dudhat | d7da148 | 2011-04-08 16:04:51 +0530 | [diff] [blame] | 74 | set_ifc_csor(IFC_CS2, CONFIG_SYS_CSOR2); |
| 75 | set_ifc_amask(IFC_CS2, CONFIG_SYS_AMASK2); |
| 76 | set_ifc_cspr(IFC_CS2, CONFIG_SYS_CSPR2); |
Dipen Dudhat | d789b5f | 2011-01-20 16:29:35 +0530 | [diff] [blame] | 77 | #endif |
| 78 | |
Kumar Gala | ffdf889 | 2012-08-17 08:20:25 +0000 | [diff] [blame] | 79 | #ifdef CONFIG_SYS_CSPR3_EXT |
| 80 | set_ifc_cspr_ext(IFC_CS3, CONFIG_SYS_CSPR3_EXT); |
| 81 | #endif |
Prabhakar Kushwaha | 71220f8 | 2013-10-04 10:05:36 +0530 | [diff] [blame] | 82 | #ifdef CONFIG_SYS_CSOR3_EXT |
| 83 | set_ifc_csor_ext(IFC_CS3, CONFIG_SYS_CSOR3_EXT); |
| 84 | #endif |
Dipen Dudhat | d789b5f | 2011-01-20 16:29:35 +0530 | [diff] [blame] | 85 | #if defined(CONFIG_SYS_CSPR3) && defined(CONFIG_SYS_CSOR3) |
Dipen Dudhat | d789b5f | 2011-01-20 16:29:35 +0530 | [diff] [blame] | 86 | set_ifc_ftim(IFC_CS3, IFC_FTIM0, CONFIG_SYS_CS3_FTIM0); |
| 87 | set_ifc_ftim(IFC_CS3, IFC_FTIM1, CONFIG_SYS_CS3_FTIM1); |
| 88 | set_ifc_ftim(IFC_CS3, IFC_FTIM2, CONFIG_SYS_CS3_FTIM2); |
| 89 | set_ifc_ftim(IFC_CS3, IFC_FTIM3, CONFIG_SYS_CS3_FTIM3); |
Dipen Dudhat | d7da148 | 2011-04-08 16:04:51 +0530 | [diff] [blame] | 90 | |
| 91 | set_ifc_cspr(IFC_CS3, CONFIG_SYS_CSPR3); |
| 92 | set_ifc_amask(IFC_CS3, CONFIG_SYS_AMASK3); |
| 93 | set_ifc_csor(IFC_CS3, CONFIG_SYS_CSOR3); |
Dipen Dudhat | d789b5f | 2011-01-20 16:29:35 +0530 | [diff] [blame] | 94 | #endif |
Mingkai Hu | 362ee04 | 2013-05-16 10:18:13 +0800 | [diff] [blame] | 95 | |
| 96 | #ifdef CONFIG_SYS_CSPR4_EXT |
| 97 | set_ifc_cspr_ext(IFC_CS4, CONFIG_SYS_CSPR4_EXT); |
| 98 | #endif |
Prabhakar Kushwaha | 71220f8 | 2013-10-04 10:05:36 +0530 | [diff] [blame] | 99 | #ifdef CONFIG_SYS_CSOR4_EXT |
| 100 | set_ifc_csor_ext(IFC_CS4, CONFIG_SYS_CSOR4_EXT); |
| 101 | #endif |
Mingkai Hu | 362ee04 | 2013-05-16 10:18:13 +0800 | [diff] [blame] | 102 | #if defined(CONFIG_SYS_CSPR4) && defined(CONFIG_SYS_CSOR4) |
| 103 | set_ifc_ftim(IFC_CS4, IFC_FTIM0, CONFIG_SYS_CS4_FTIM0); |
| 104 | set_ifc_ftim(IFC_CS4, IFC_FTIM1, CONFIG_SYS_CS4_FTIM1); |
| 105 | set_ifc_ftim(IFC_CS4, IFC_FTIM2, CONFIG_SYS_CS4_FTIM2); |
| 106 | set_ifc_ftim(IFC_CS4, IFC_FTIM3, CONFIG_SYS_CS4_FTIM3); |
| 107 | |
| 108 | set_ifc_cspr(IFC_CS4, CONFIG_SYS_CSPR4); |
| 109 | set_ifc_amask(IFC_CS4, CONFIG_SYS_AMASK4); |
| 110 | set_ifc_csor(IFC_CS4, CONFIG_SYS_CSOR4); |
| 111 | #endif |
| 112 | |
| 113 | #ifdef CONFIG_SYS_CSPR5_EXT |
| 114 | set_ifc_cspr_ext(IFC_CS5, CONFIG_SYS_CSPR5_EXT); |
| 115 | #endif |
Prabhakar Kushwaha | 71220f8 | 2013-10-04 10:05:36 +0530 | [diff] [blame] | 116 | #ifdef CONFIG_SYS_CSOR5_EXT |
| 117 | set_ifc_csor_ext(IFC_CS5, CONFIG_SYS_CSOR5_EXT); |
| 118 | #endif |
Mingkai Hu | 362ee04 | 2013-05-16 10:18:13 +0800 | [diff] [blame] | 119 | #if defined(CONFIG_SYS_CSPR5) && defined(CONFIG_SYS_CSOR5) |
| 120 | set_ifc_ftim(IFC_CS5, IFC_FTIM0, CONFIG_SYS_CS5_FTIM0); |
| 121 | set_ifc_ftim(IFC_CS5, IFC_FTIM1, CONFIG_SYS_CS5_FTIM1); |
| 122 | set_ifc_ftim(IFC_CS5, IFC_FTIM2, CONFIG_SYS_CS5_FTIM2); |
| 123 | set_ifc_ftim(IFC_CS5, IFC_FTIM3, CONFIG_SYS_CS5_FTIM3); |
| 124 | |
| 125 | set_ifc_cspr(IFC_CS5, CONFIG_SYS_CSPR5); |
| 126 | set_ifc_amask(IFC_CS5, CONFIG_SYS_AMASK5); |
| 127 | set_ifc_csor(IFC_CS5, CONFIG_SYS_CSOR5); |
| 128 | #endif |
| 129 | |
| 130 | #ifdef CONFIG_SYS_CSPR6_EXT |
| 131 | set_ifc_cspr_ext(IFC_CS6, CONFIG_SYS_CSPR6_EXT); |
| 132 | #endif |
Prabhakar Kushwaha | 71220f8 | 2013-10-04 10:05:36 +0530 | [diff] [blame] | 133 | #ifdef CONFIG_SYS_CSOR6_EXT |
| 134 | set_ifc_csor_ext(IFC_CS6, CONFIG_SYS_CSOR6_EXT); |
| 135 | #endif |
Mingkai Hu | 362ee04 | 2013-05-16 10:18:13 +0800 | [diff] [blame] | 136 | #if defined(CONFIG_SYS_CSPR6) && defined(CONFIG_SYS_CSOR6) |
| 137 | set_ifc_ftim(IFC_CS6, IFC_FTIM0, CONFIG_SYS_CS6_FTIM0); |
| 138 | set_ifc_ftim(IFC_CS6, IFC_FTIM1, CONFIG_SYS_CS6_FTIM1); |
| 139 | set_ifc_ftim(IFC_CS6, IFC_FTIM2, CONFIG_SYS_CS6_FTIM2); |
| 140 | set_ifc_ftim(IFC_CS6, IFC_FTIM3, CONFIG_SYS_CS6_FTIM3); |
| 141 | |
| 142 | set_ifc_cspr(IFC_CS6, CONFIG_SYS_CSPR6); |
| 143 | set_ifc_amask(IFC_CS6, CONFIG_SYS_AMASK6); |
| 144 | set_ifc_csor(IFC_CS6, CONFIG_SYS_CSOR6); |
| 145 | #endif |
| 146 | |
| 147 | #ifdef CONFIG_SYS_CSPR7_EXT |
| 148 | set_ifc_cspr_ext(IFC_CS7, CONFIG_SYS_CSPR7_EXT); |
| 149 | #endif |
Prabhakar Kushwaha | 71220f8 | 2013-10-04 10:05:36 +0530 | [diff] [blame] | 150 | #ifdef CONFIG_SYS_CSOR7_EXT |
| 151 | set_ifc_csor_ext(IFC_CS7, CONFIG_SYS_CSOR7_EXT); |
| 152 | #endif |
Mingkai Hu | 362ee04 | 2013-05-16 10:18:13 +0800 | [diff] [blame] | 153 | #if defined(CONFIG_SYS_CSPR7) && defined(CONFIG_SYS_CSOR7) |
| 154 | set_ifc_ftim(IFC_CS7, IFC_FTIM0, CONFIG_SYS_CS7_FTIM0); |
| 155 | set_ifc_ftim(IFC_CS7, IFC_FTIM1, CONFIG_SYS_CS7_FTIM1); |
| 156 | set_ifc_ftim(IFC_CS7, IFC_FTIM2, CONFIG_SYS_CS7_FTIM2); |
| 157 | set_ifc_ftim(IFC_CS7, IFC_FTIM3, CONFIG_SYS_CS7_FTIM3); |
| 158 | |
| 159 | set_ifc_cspr(IFC_CS7, CONFIG_SYS_CSPR7); |
| 160 | set_ifc_amask(IFC_CS7, CONFIG_SYS_AMASK7); |
| 161 | set_ifc_csor(IFC_CS7, CONFIG_SYS_CSOR7); |
| 162 | #endif |
Dipen Dudhat | d789b5f | 2011-01-20 16:29:35 +0530 | [diff] [blame] | 163 | } |
York Sun | e77224e | 2014-03-19 13:52:34 -0700 | [diff] [blame] | 164 | |
| 165 | void init_final_memctl_regs(void) |
| 166 | { |
| 167 | #ifdef CONFIG_SYS_CSPR0_FINAL |
| 168 | set_ifc_cspr(IFC_CS0, CONFIG_SYS_CSPR0_FINAL); |
| 169 | #endif |
Scott Wood | b2d5ac5 | 2015-03-24 13:25:02 -0700 | [diff] [blame] | 170 | #ifdef CONFIG_SYS_AMASK0_FINAL |
| 171 | set_ifc_amask(IFC_CS0, CONFIG_SYS_AMASK0); |
| 172 | #endif |
Prabhakar Kushwaha | 45bc6fd | 2015-03-19 09:20:48 -0700 | [diff] [blame] | 173 | #ifdef CONFIG_SYS_CSPR1_FINAL |
| 174 | set_ifc_cspr(IFC_CS1, CONFIG_SYS_CSPR1_FINAL); |
| 175 | #endif |
| 176 | #ifdef CONFIG_SYS_AMASK1_FINAL |
| 177 | set_ifc_amask(IFC_CS1, CONFIG_SYS_AMASK1_FINAL); |
| 178 | #endif |
Scott Wood | b2d5ac5 | 2015-03-24 13:25:02 -0700 | [diff] [blame] | 179 | #ifdef CONFIG_SYS_CSPR2_FINAL |
| 180 | set_ifc_cspr(IFC_CS2, CONFIG_SYS_CSPR2_FINAL); |
| 181 | #endif |
| 182 | #ifdef CONFIG_SYS_AMASK2_FINAL |
| 183 | set_ifc_amask(IFC_CS2, CONFIG_SYS_AMASK2); |
| 184 | #endif |
Prabhakar Kushwaha | 45bc6fd | 2015-03-19 09:20:48 -0700 | [diff] [blame] | 185 | #ifdef CONFIG_SYS_CSPR3_FINAL |
| 186 | set_ifc_cspr(IFC_CS3, CONFIG_SYS_CSPR3_FINAL); |
| 187 | #endif |
Scott Wood | b2d5ac5 | 2015-03-24 13:25:02 -0700 | [diff] [blame] | 188 | #ifdef CONFIG_SYS_AMASK3_FINAL |
| 189 | set_ifc_amask(IFC_CS3, CONFIG_SYS_AMASK3); |
| 190 | #endif |
York Sun | e77224e | 2014-03-19 13:52:34 -0700 | [diff] [blame] | 191 | } |