Dipen Dudhat | 00c4294 | 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 | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 5 | * SPDX-License-Identifier: GPL-2.0+ |
Dipen Dudhat | 00c4294 | 2011-01-20 16:29:35 +0530 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #include <common.h> |
| 9 | #include <asm/fsl_ifc.h> |
| 10 | |
| 11 | void print_ifc_regs(void) |
| 12 | { |
| 13 | int i, j; |
| 14 | |
| 15 | printf("IFC Controller Registers\n"); |
Mingkai Hu | 6f024c9 | 2013-05-16 10:18:13 +0800 | [diff] [blame] | 16 | for (i = 0; i < CONFIG_SYS_FSL_IFC_BANK_COUNT; i++) { |
Dipen Dudhat | 00c4294 | 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 | 00c4294 | 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 | f020e6c | 2011-04-08 16:04:51 +0530 | [diff] [blame] | 32 | |
Prabhakar Kushwaha | d324f47 | 2013-04-16 13:27:44 +0530 | [diff] [blame] | 33 | #ifndef CONFIG_A003399_NOR_WORKAROUND |
Kumar Gala | 7bc4f62 | 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 |
Dipen Dudhat | f020e6c | 2011-04-08 16:04:51 +0530 | [diff] [blame] | 37 | set_ifc_cspr(IFC_CS0, CONFIG_SYS_CSPR0); |
| 38 | set_ifc_amask(IFC_CS0, CONFIG_SYS_AMASK0); |
| 39 | set_ifc_csor(IFC_CS0, CONFIG_SYS_CSOR0); |
Dipen Dudhat | 00c4294 | 2011-01-20 16:29:35 +0530 | [diff] [blame] | 40 | #endif |
Poonam Aggrwal | 46b86ca | 2011-07-07 20:36:47 +0530 | [diff] [blame] | 41 | #endif |
Dipen Dudhat | 00c4294 | 2011-01-20 16:29:35 +0530 | [diff] [blame] | 42 | |
Kumar Gala | 7bc4f62 | 2012-08-17 08:20:25 +0000 | [diff] [blame] | 43 | #ifdef CONFIG_SYS_CSPR1_EXT |
| 44 | set_ifc_cspr_ext(IFC_CS1, CONFIG_SYS_CSPR1_EXT); |
| 45 | #endif |
Dipen Dudhat | 00c4294 | 2011-01-20 16:29:35 +0530 | [diff] [blame] | 46 | #if defined(CONFIG_SYS_CSPR1) && defined(CONFIG_SYS_CSOR1) |
Dipen Dudhat | 00c4294 | 2011-01-20 16:29:35 +0530 | [diff] [blame] | 47 | set_ifc_ftim(IFC_CS1, IFC_FTIM0, CONFIG_SYS_CS1_FTIM0); |
| 48 | set_ifc_ftim(IFC_CS1, IFC_FTIM1, CONFIG_SYS_CS1_FTIM1); |
| 49 | set_ifc_ftim(IFC_CS1, IFC_FTIM2, CONFIG_SYS_CS1_FTIM2); |
| 50 | set_ifc_ftim(IFC_CS1, IFC_FTIM3, CONFIG_SYS_CS1_FTIM3); |
Dipen Dudhat | f020e6c | 2011-04-08 16:04:51 +0530 | [diff] [blame] | 51 | |
| 52 | set_ifc_csor(IFC_CS1, CONFIG_SYS_CSOR1); |
| 53 | set_ifc_amask(IFC_CS1, CONFIG_SYS_AMASK1); |
| 54 | set_ifc_cspr(IFC_CS1, CONFIG_SYS_CSPR1); |
Dipen Dudhat | 00c4294 | 2011-01-20 16:29:35 +0530 | [diff] [blame] | 55 | #endif |
| 56 | |
Kumar Gala | 7bc4f62 | 2012-08-17 08:20:25 +0000 | [diff] [blame] | 57 | #ifdef CONFIG_SYS_CSPR2_EXT |
| 58 | set_ifc_cspr_ext(IFC_CS2, CONFIG_SYS_CSPR2_EXT); |
| 59 | #endif |
Dipen Dudhat | 00c4294 | 2011-01-20 16:29:35 +0530 | [diff] [blame] | 60 | #if defined(CONFIG_SYS_CSPR2) && defined(CONFIG_SYS_CSOR2) |
Dipen Dudhat | 00c4294 | 2011-01-20 16:29:35 +0530 | [diff] [blame] | 61 | set_ifc_ftim(IFC_CS2, IFC_FTIM0, CONFIG_SYS_CS2_FTIM0); |
| 62 | set_ifc_ftim(IFC_CS2, IFC_FTIM1, CONFIG_SYS_CS2_FTIM1); |
| 63 | set_ifc_ftim(IFC_CS2, IFC_FTIM2, CONFIG_SYS_CS2_FTIM2); |
| 64 | set_ifc_ftim(IFC_CS2, IFC_FTIM3, CONFIG_SYS_CS2_FTIM3); |
| 65 | |
Dipen Dudhat | f020e6c | 2011-04-08 16:04:51 +0530 | [diff] [blame] | 66 | set_ifc_csor(IFC_CS2, CONFIG_SYS_CSOR2); |
| 67 | set_ifc_amask(IFC_CS2, CONFIG_SYS_AMASK2); |
| 68 | set_ifc_cspr(IFC_CS2, CONFIG_SYS_CSPR2); |
Dipen Dudhat | 00c4294 | 2011-01-20 16:29:35 +0530 | [diff] [blame] | 69 | #endif |
| 70 | |
Kumar Gala | 7bc4f62 | 2012-08-17 08:20:25 +0000 | [diff] [blame] | 71 | #ifdef CONFIG_SYS_CSPR3_EXT |
| 72 | set_ifc_cspr_ext(IFC_CS3, CONFIG_SYS_CSPR3_EXT); |
| 73 | #endif |
Dipen Dudhat | 00c4294 | 2011-01-20 16:29:35 +0530 | [diff] [blame] | 74 | #if defined(CONFIG_SYS_CSPR3) && defined(CONFIG_SYS_CSOR3) |
Dipen Dudhat | 00c4294 | 2011-01-20 16:29:35 +0530 | [diff] [blame] | 75 | set_ifc_ftim(IFC_CS3, IFC_FTIM0, CONFIG_SYS_CS3_FTIM0); |
| 76 | set_ifc_ftim(IFC_CS3, IFC_FTIM1, CONFIG_SYS_CS3_FTIM1); |
| 77 | set_ifc_ftim(IFC_CS3, IFC_FTIM2, CONFIG_SYS_CS3_FTIM2); |
| 78 | set_ifc_ftim(IFC_CS3, IFC_FTIM3, CONFIG_SYS_CS3_FTIM3); |
Dipen Dudhat | f020e6c | 2011-04-08 16:04:51 +0530 | [diff] [blame] | 79 | |
| 80 | set_ifc_cspr(IFC_CS3, CONFIG_SYS_CSPR3); |
| 81 | set_ifc_amask(IFC_CS3, CONFIG_SYS_AMASK3); |
| 82 | set_ifc_csor(IFC_CS3, CONFIG_SYS_CSOR3); |
Dipen Dudhat | 00c4294 | 2011-01-20 16:29:35 +0530 | [diff] [blame] | 83 | #endif |
Mingkai Hu | 6f024c9 | 2013-05-16 10:18:13 +0800 | [diff] [blame] | 84 | |
| 85 | #ifdef CONFIG_SYS_CSPR4_EXT |
| 86 | set_ifc_cspr_ext(IFC_CS4, CONFIG_SYS_CSPR4_EXT); |
| 87 | #endif |
| 88 | #if defined(CONFIG_SYS_CSPR4) && defined(CONFIG_SYS_CSOR4) |
| 89 | set_ifc_ftim(IFC_CS4, IFC_FTIM0, CONFIG_SYS_CS4_FTIM0); |
| 90 | set_ifc_ftim(IFC_CS4, IFC_FTIM1, CONFIG_SYS_CS4_FTIM1); |
| 91 | set_ifc_ftim(IFC_CS4, IFC_FTIM2, CONFIG_SYS_CS4_FTIM2); |
| 92 | set_ifc_ftim(IFC_CS4, IFC_FTIM3, CONFIG_SYS_CS4_FTIM3); |
| 93 | |
| 94 | set_ifc_cspr(IFC_CS4, CONFIG_SYS_CSPR4); |
| 95 | set_ifc_amask(IFC_CS4, CONFIG_SYS_AMASK4); |
| 96 | set_ifc_csor(IFC_CS4, CONFIG_SYS_CSOR4); |
| 97 | #endif |
| 98 | |
| 99 | #ifdef CONFIG_SYS_CSPR5_EXT |
| 100 | set_ifc_cspr_ext(IFC_CS5, CONFIG_SYS_CSPR5_EXT); |
| 101 | #endif |
| 102 | #if defined(CONFIG_SYS_CSPR5) && defined(CONFIG_SYS_CSOR5) |
| 103 | set_ifc_ftim(IFC_CS5, IFC_FTIM0, CONFIG_SYS_CS5_FTIM0); |
| 104 | set_ifc_ftim(IFC_CS5, IFC_FTIM1, CONFIG_SYS_CS5_FTIM1); |
| 105 | set_ifc_ftim(IFC_CS5, IFC_FTIM2, CONFIG_SYS_CS5_FTIM2); |
| 106 | set_ifc_ftim(IFC_CS5, IFC_FTIM3, CONFIG_SYS_CS5_FTIM3); |
| 107 | |
| 108 | set_ifc_cspr(IFC_CS5, CONFIG_SYS_CSPR5); |
| 109 | set_ifc_amask(IFC_CS5, CONFIG_SYS_AMASK5); |
| 110 | set_ifc_csor(IFC_CS5, CONFIG_SYS_CSOR5); |
| 111 | #endif |
| 112 | |
| 113 | #ifdef CONFIG_SYS_CSPR6_EXT |
| 114 | set_ifc_cspr_ext(IFC_CS6, CONFIG_SYS_CSPR6_EXT); |
| 115 | #endif |
| 116 | #if defined(CONFIG_SYS_CSPR6) && defined(CONFIG_SYS_CSOR6) |
| 117 | set_ifc_ftim(IFC_CS6, IFC_FTIM0, CONFIG_SYS_CS6_FTIM0); |
| 118 | set_ifc_ftim(IFC_CS6, IFC_FTIM1, CONFIG_SYS_CS6_FTIM1); |
| 119 | set_ifc_ftim(IFC_CS6, IFC_FTIM2, CONFIG_SYS_CS6_FTIM2); |
| 120 | set_ifc_ftim(IFC_CS6, IFC_FTIM3, CONFIG_SYS_CS6_FTIM3); |
| 121 | |
| 122 | set_ifc_cspr(IFC_CS6, CONFIG_SYS_CSPR6); |
| 123 | set_ifc_amask(IFC_CS6, CONFIG_SYS_AMASK6); |
| 124 | set_ifc_csor(IFC_CS6, CONFIG_SYS_CSOR6); |
| 125 | #endif |
| 126 | |
| 127 | #ifdef CONFIG_SYS_CSPR7_EXT |
| 128 | set_ifc_cspr_ext(IFC_CS7, CONFIG_SYS_CSPR7_EXT); |
| 129 | #endif |
| 130 | #if defined(CONFIG_SYS_CSPR7) && defined(CONFIG_SYS_CSOR7) |
| 131 | set_ifc_ftim(IFC_CS7, IFC_FTIM0, CONFIG_SYS_CS7_FTIM0); |
| 132 | set_ifc_ftim(IFC_CS7, IFC_FTIM1, CONFIG_SYS_CS7_FTIM1); |
| 133 | set_ifc_ftim(IFC_CS7, IFC_FTIM2, CONFIG_SYS_CS7_FTIM2); |
| 134 | set_ifc_ftim(IFC_CS7, IFC_FTIM3, CONFIG_SYS_CS7_FTIM3); |
| 135 | |
| 136 | set_ifc_cspr(IFC_CS7, CONFIG_SYS_CSPR7); |
| 137 | set_ifc_amask(IFC_CS7, CONFIG_SYS_AMASK7); |
| 138 | set_ifc_csor(IFC_CS7, CONFIG_SYS_CSOR7); |
| 139 | #endif |
Dipen Dudhat | 00c4294 | 2011-01-20 16:29:35 +0530 | [diff] [blame] | 140 | } |