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