York Sun | e12abcb | 2015-03-20 19:28:24 -0700 | [diff] [blame] | 1 | /* |
Priyanka Jain | d158718 | 2017-04-25 10:12:31 +0530 | [diff] [blame] | 2 | * Copyright (C) 2017 NXP Semiconductors |
York Sun | e12abcb | 2015-03-20 19:28:24 -0700 | [diff] [blame] | 3 | * Copyright 2015 Freescale Semiconductor |
| 4 | * |
| 5 | * SPDX-License-Identifier: GPL-2.0+ |
| 6 | */ |
| 7 | #include <common.h> |
| 8 | #include <malloc.h> |
| 9 | #include <errno.h> |
| 10 | #include <netdev.h> |
| 11 | #include <fsl_ifc.h> |
| 12 | #include <fsl_ddr.h> |
| 13 | #include <asm/io.h> |
Yangbo Lu | cf00555 | 2015-05-28 14:53:55 +0530 | [diff] [blame] | 14 | #include <hwconfig.h> |
York Sun | e12abcb | 2015-03-20 19:28:24 -0700 | [diff] [blame] | 15 | #include <fdt_support.h> |
| 16 | #include <libfdt.h> |
York Sun | e12abcb | 2015-03-20 19:28:24 -0700 | [diff] [blame] | 17 | #include <fsl-mc/fsl_mc.h> |
| 18 | #include <environment.h> |
Alexander Graf | 34f8e97 | 2016-11-17 01:02:59 +0100 | [diff] [blame] | 19 | #include <efi_loader.h> |
York Sun | e12abcb | 2015-03-20 19:28:24 -0700 | [diff] [blame] | 20 | #include <i2c.h> |
York Sun | 729f2d1 | 2017-03-06 09:02:34 -0800 | [diff] [blame] | 21 | #include <asm/arch/mmu.h> |
Mingkai Hu | 0e58b51 | 2015-10-26 19:47:50 +0800 | [diff] [blame] | 22 | #include <asm/arch/soc.h> |
Santan Kumar | c61c699 | 2017-03-07 11:21:03 +0530 | [diff] [blame] | 23 | #include <asm/arch/ppa.h> |
Saksham Jain | c0c38d2 | 2016-03-23 16:24:35 +0530 | [diff] [blame] | 24 | #include <fsl_sec.h> |
York Sun | e12abcb | 2015-03-20 19:28:24 -0700 | [diff] [blame] | 25 | |
Priyanka Jain | 6720d0a | 2017-04-28 10:41:34 +0530 | [diff] [blame] | 26 | #ifdef CONFIG_FSL_QIXIS |
York Sun | e12abcb | 2015-03-20 19:28:24 -0700 | [diff] [blame] | 27 | #include "../common/qixis.h" |
Prabhakar Kushwaha | 122bcfd | 2015-11-09 16:42:07 +0530 | [diff] [blame] | 28 | #include "ls2080ardb_qixis.h" |
Priyanka Jain | 6720d0a | 2017-04-28 10:41:34 +0530 | [diff] [blame] | 29 | #endif |
Rai Harninder | 6aa1f3b | 2016-03-23 17:04:38 +0530 | [diff] [blame] | 30 | #include "../common/vid.h" |
York Sun | e12abcb | 2015-03-20 19:28:24 -0700 | [diff] [blame] | 31 | |
Yangbo Lu | cf00555 | 2015-05-28 14:53:55 +0530 | [diff] [blame] | 32 | #define PIN_MUX_SEL_SDHC 0x00 |
Haikun.Wang@freescale.com | b8a258c | 2015-06-26 19:58:24 +0800 | [diff] [blame] | 33 | #define PIN_MUX_SEL_DSPI 0x0a |
Yangbo Lu | cf00555 | 2015-05-28 14:53:55 +0530 | [diff] [blame] | 34 | |
| 35 | #define SET_SDHC_MUX_SEL(reg, value) ((reg & 0xf0) | value) |
York Sun | e12abcb | 2015-03-20 19:28:24 -0700 | [diff] [blame] | 36 | DECLARE_GLOBAL_DATA_PTR; |
| 37 | |
Yangbo Lu | cf00555 | 2015-05-28 14:53:55 +0530 | [diff] [blame] | 38 | enum { |
| 39 | MUX_TYPE_SDHC, |
Haikun.Wang@freescale.com | b8a258c | 2015-06-26 19:58:24 +0800 | [diff] [blame] | 40 | MUX_TYPE_DSPI, |
Yangbo Lu | cf00555 | 2015-05-28 14:53:55 +0530 | [diff] [blame] | 41 | }; |
| 42 | |
York Sun | e12abcb | 2015-03-20 19:28:24 -0700 | [diff] [blame] | 43 | unsigned long long get_qixis_addr(void) |
| 44 | { |
| 45 | unsigned long long addr; |
| 46 | |
| 47 | if (gd->flags & GD_FLG_RELOC) |
| 48 | addr = QIXIS_BASE_PHYS; |
| 49 | else |
| 50 | addr = QIXIS_BASE_PHYS_EARLY; |
| 51 | |
| 52 | /* |
| 53 | * IFC address under 256MB is mapped to 0x30000000, any address above |
| 54 | * is mapped to 0x5_10000000 up to 4GB. |
| 55 | */ |
| 56 | addr = addr > 0x10000000 ? addr + 0x500000000ULL : addr + 0x30000000; |
| 57 | |
| 58 | return addr; |
| 59 | } |
| 60 | |
| 61 | int checkboard(void) |
| 62 | { |
Priyanka Jain | 6720d0a | 2017-04-28 10:41:34 +0530 | [diff] [blame] | 63 | #ifdef CONFIG_FSL_QIXIS |
York Sun | e12abcb | 2015-03-20 19:28:24 -0700 | [diff] [blame] | 64 | u8 sw; |
Priyanka Jain | 6720d0a | 2017-04-28 10:41:34 +0530 | [diff] [blame] | 65 | #endif |
Prabhakar Kushwaha | 67f2e9c | 2015-05-28 14:54:07 +0530 | [diff] [blame] | 66 | char buf[15]; |
| 67 | |
| 68 | cpu_name(buf); |
| 69 | printf("Board: %s-RDB, ", buf); |
York Sun | e12abcb | 2015-03-20 19:28:24 -0700 | [diff] [blame] | 70 | |
Priyanka Jain | 75cd67f | 2017-04-27 15:08:07 +0530 | [diff] [blame] | 71 | #ifdef CONFIG_TARGET_LS2081ARDB |
Priyanka Jain | 6720d0a | 2017-04-28 10:41:34 +0530 | [diff] [blame] | 72 | #ifdef CONFIG_FSL_QIXIS |
York Sun | e12abcb | 2015-03-20 19:28:24 -0700 | [diff] [blame] | 73 | sw = QIXIS_READ(arch); |
York Sun | e12abcb | 2015-03-20 19:28:24 -0700 | [diff] [blame] | 74 | printf("Board Arch: V%d, ", sw >> 4); |
Priyanka Jain | 75cd67f | 2017-04-27 15:08:07 +0530 | [diff] [blame] | 75 | printf("Board version: %c, ", (sw & 0xf) + 'A'); |
| 76 | |
| 77 | sw = QIXIS_READ(brdcfg[0]); |
| 78 | sw = (sw & QIXIS_QMAP_MASK) >> QIXIS_QMAP_SHIFT; |
| 79 | switch (sw) { |
| 80 | case 0: |
| 81 | puts("boot from QSPI DEV#0\n"); |
| 82 | puts("QSPI_CSA_1 mapped to QSPI DEV#1\n"); |
| 83 | break; |
| 84 | case 1: |
| 85 | puts("boot from QSPI DEV#1\n"); |
| 86 | puts("QSPI_CSA_1 mapped to QSPI DEV#0\n"); |
| 87 | break; |
| 88 | case 2: |
| 89 | puts("boot from QSPI EMU\n"); |
| 90 | puts("QSPI_CSA_1 mapped to QSPI DEV#0\n"); |
| 91 | break; |
| 92 | case 3: |
| 93 | puts("boot from QSPI EMU\n"); |
| 94 | puts("QSPI_CSA_1 mapped to QSPI DEV#1\n"); |
| 95 | break; |
| 96 | case 4: |
| 97 | puts("boot from QSPI DEV#0\n"); |
| 98 | puts("QSPI_CSA_1 mapped to QSPI EMU\n"); |
| 99 | break; |
| 100 | default: |
| 101 | printf("invalid setting of SW%u\n", sw); |
| 102 | break; |
| 103 | } |
| 104 | #endif |
| 105 | puts("SERDES1 Reference : "); |
| 106 | printf("Clock1 = 100MHz "); |
| 107 | printf("Clock2 = 161.13MHz"); |
| 108 | #else |
| 109 | #ifdef CONFIG_FSL_QIXIS |
| 110 | sw = QIXIS_READ(arch); |
| 111 | printf("Board Arch: V%d, ", sw >> 4); |
Prabhakar Kushwaha | 8368a59 | 2015-05-28 14:54:04 +0530 | [diff] [blame] | 112 | printf("Board version: %c, boot from ", (sw & 0xf) + 'A'); |
York Sun | e12abcb | 2015-03-20 19:28:24 -0700 | [diff] [blame] | 113 | |
| 114 | sw = QIXIS_READ(brdcfg[0]); |
| 115 | sw = (sw & QIXIS_LBMAP_MASK) >> QIXIS_LBMAP_SHIFT; |
| 116 | |
| 117 | if (sw < 0x8) |
| 118 | printf("vBank: %d\n", sw); |
| 119 | else if (sw == 0x9) |
| 120 | puts("NAND\n"); |
| 121 | else |
| 122 | printf("invalid setting of SW%u\n", QIXIS_LBMAP_SWITCH); |
| 123 | |
| 124 | printf("FPGA: v%d.%d\n", QIXIS_READ(scver), QIXIS_READ(tagdata)); |
Priyanka Jain | 6720d0a | 2017-04-28 10:41:34 +0530 | [diff] [blame] | 125 | #endif |
York Sun | e12abcb | 2015-03-20 19:28:24 -0700 | [diff] [blame] | 126 | puts("SERDES1 Reference : "); |
| 127 | printf("Clock1 = 156.25MHz "); |
| 128 | printf("Clock2 = 156.25MHz"); |
Priyanka Jain | 75cd67f | 2017-04-27 15:08:07 +0530 | [diff] [blame] | 129 | #endif |
York Sun | e12abcb | 2015-03-20 19:28:24 -0700 | [diff] [blame] | 130 | |
| 131 | puts("\nSERDES2 Reference : "); |
| 132 | printf("Clock1 = 100MHz "); |
| 133 | printf("Clock2 = 100MHz\n"); |
| 134 | |
| 135 | return 0; |
| 136 | } |
| 137 | |
| 138 | unsigned long get_board_sys_clk(void) |
| 139 | { |
Priyanka Jain | 6720d0a | 2017-04-28 10:41:34 +0530 | [diff] [blame] | 140 | #ifdef CONFIG_FSL_QIXIS |
York Sun | e12abcb | 2015-03-20 19:28:24 -0700 | [diff] [blame] | 141 | u8 sysclk_conf = QIXIS_READ(brdcfg[1]); |
| 142 | |
| 143 | switch (sysclk_conf & 0x0F) { |
| 144 | case QIXIS_SYSCLK_83: |
| 145 | return 83333333; |
| 146 | case QIXIS_SYSCLK_100: |
| 147 | return 100000000; |
| 148 | case QIXIS_SYSCLK_125: |
| 149 | return 125000000; |
| 150 | case QIXIS_SYSCLK_133: |
| 151 | return 133333333; |
| 152 | case QIXIS_SYSCLK_150: |
| 153 | return 150000000; |
| 154 | case QIXIS_SYSCLK_160: |
| 155 | return 160000000; |
| 156 | case QIXIS_SYSCLK_166: |
| 157 | return 166666666; |
| 158 | } |
Priyanka Jain | 6720d0a | 2017-04-28 10:41:34 +0530 | [diff] [blame] | 159 | #endif |
| 160 | return 100000000; |
York Sun | e12abcb | 2015-03-20 19:28:24 -0700 | [diff] [blame] | 161 | } |
| 162 | |
| 163 | int select_i2c_ch_pca9547(u8 ch) |
| 164 | { |
| 165 | int ret; |
| 166 | |
| 167 | ret = i2c_write(I2C_MUX_PCA_ADDR_PRI, 0, 1, &ch, 1); |
| 168 | if (ret) { |
| 169 | puts("PCA: failed to select proper channel\n"); |
| 170 | return ret; |
| 171 | } |
| 172 | |
| 173 | return 0; |
| 174 | } |
| 175 | |
Rai Harninder | 6aa1f3b | 2016-03-23 17:04:38 +0530 | [diff] [blame] | 176 | int i2c_multiplexer_select_vid_channel(u8 channel) |
| 177 | { |
| 178 | return select_i2c_ch_pca9547(channel); |
| 179 | } |
| 180 | |
Yangbo Lu | cf00555 | 2015-05-28 14:53:55 +0530 | [diff] [blame] | 181 | int config_board_mux(int ctrl_type) |
| 182 | { |
Priyanka Jain | 6720d0a | 2017-04-28 10:41:34 +0530 | [diff] [blame] | 183 | #ifdef CONFIG_FSL_QIXIS |
Yangbo Lu | cf00555 | 2015-05-28 14:53:55 +0530 | [diff] [blame] | 184 | u8 reg5; |
| 185 | |
| 186 | reg5 = QIXIS_READ(brdcfg[5]); |
| 187 | |
| 188 | switch (ctrl_type) { |
| 189 | case MUX_TYPE_SDHC: |
| 190 | reg5 = SET_SDHC_MUX_SEL(reg5, PIN_MUX_SEL_SDHC); |
| 191 | break; |
Haikun.Wang@freescale.com | b8a258c | 2015-06-26 19:58:24 +0800 | [diff] [blame] | 192 | case MUX_TYPE_DSPI: |
| 193 | reg5 = SET_SDHC_MUX_SEL(reg5, PIN_MUX_SEL_DSPI); |
| 194 | break; |
Yangbo Lu | cf00555 | 2015-05-28 14:53:55 +0530 | [diff] [blame] | 195 | default: |
| 196 | printf("Wrong mux interface type\n"); |
| 197 | return -1; |
| 198 | } |
| 199 | |
| 200 | QIXIS_WRITE(brdcfg[5], reg5); |
Priyanka Jain | 6720d0a | 2017-04-28 10:41:34 +0530 | [diff] [blame] | 201 | #endif |
Haikun.Wang@freescale.com | b8a258c | 2015-06-26 19:58:24 +0800 | [diff] [blame] | 202 | return 0; |
| 203 | } |
| 204 | |
| 205 | int board_init(void) |
| 206 | { |
| 207 | char *env_hwconfig; |
| 208 | u32 __iomem *dcfg_ccsr = (u32 __iomem *)DCFG_BASE; |
York Sun | 8cbc195 | 2016-05-26 13:59:03 -0700 | [diff] [blame] | 209 | #ifdef CONFIG_FSL_MC_ENET |
Shaohui Xie | 8c7ce82 | 2016-01-28 15:38:15 +0800 | [diff] [blame] | 210 | u32 __iomem *irq_ccsr = (u32 __iomem *)ISC_BASE; |
York Sun | 8cbc195 | 2016-05-26 13:59:03 -0700 | [diff] [blame] | 211 | #endif |
Haikun.Wang@freescale.com | b8a258c | 2015-06-26 19:58:24 +0800 | [diff] [blame] | 212 | u32 val; |
| 213 | |
| 214 | init_final_memctl_regs(); |
| 215 | |
| 216 | val = in_le32(dcfg_ccsr + DCFG_RCWSR13 / 4); |
| 217 | |
| 218 | env_hwconfig = getenv("hwconfig"); |
| 219 | |
| 220 | if (hwconfig_f("dspi", env_hwconfig) && |
| 221 | DCFG_RCWSR13_DSPI == (val & (u32)(0xf << 8))) |
| 222 | config_board_mux(MUX_TYPE_DSPI); |
| 223 | else |
| 224 | config_board_mux(MUX_TYPE_SDHC); |
| 225 | |
| 226 | #ifdef CONFIG_ENV_IS_NOWHERE |
| 227 | gd->env_addr = (ulong)&default_environment[0]; |
| 228 | #endif |
| 229 | select_i2c_ch_pca9547(I2C_MUX_CH_DEFAULT); |
| 230 | |
Priyanka Jain | 6720d0a | 2017-04-28 10:41:34 +0530 | [diff] [blame] | 231 | #ifdef CONFIG_FSL_QIXIS |
Haikun.Wang@freescale.com | b8a258c | 2015-06-26 19:58:24 +0800 | [diff] [blame] | 232 | QIXIS_WRITE(rst_ctl, QIXIS_RST_CTL_RESET_EN); |
Priyanka Jain | 6720d0a | 2017-04-28 10:41:34 +0530 | [diff] [blame] | 233 | #endif |
Santan Kumar | c61c699 | 2017-03-07 11:21:03 +0530 | [diff] [blame] | 234 | #ifdef CONFIG_FSL_LS_PPA |
| 235 | ppa_init(); |
| 236 | #endif |
| 237 | |
York Sun | 8cbc195 | 2016-05-26 13:59:03 -0700 | [diff] [blame] | 238 | #ifdef CONFIG_FSL_MC_ENET |
Shaohui Xie | 8c7ce82 | 2016-01-28 15:38:15 +0800 | [diff] [blame] | 239 | /* invert AQR405 IRQ pins polarity */ |
| 240 | out_le32(irq_ccsr + IRQCR_OFFSET / 4, AQR405_IRQ_MASK); |
York Sun | 8cbc195 | 2016-05-26 13:59:03 -0700 | [diff] [blame] | 241 | #endif |
Udit Agarwal | 62ed9a8 | 2017-02-03 22:53:38 +0530 | [diff] [blame] | 242 | #ifdef CONFIG_FSL_CAAM |
| 243 | sec_init(); |
| 244 | #endif |
Shaohui Xie | 8c7ce82 | 2016-01-28 15:38:15 +0800 | [diff] [blame] | 245 | |
Haikun.Wang@freescale.com | b8a258c | 2015-06-26 19:58:24 +0800 | [diff] [blame] | 246 | return 0; |
| 247 | } |
| 248 | |
| 249 | int board_early_init_f(void) |
| 250 | { |
Priyanka Jain | 75cd67f | 2017-04-27 15:08:07 +0530 | [diff] [blame] | 251 | #ifdef CONFIG_SYS_I2C_EARLY_INIT |
| 252 | i2c_early_init_f(); |
| 253 | #endif |
Haikun.Wang@freescale.com | b8a258c | 2015-06-26 19:58:24 +0800 | [diff] [blame] | 254 | fsl_lsch3_early_init_f(); |
Yangbo Lu | cf00555 | 2015-05-28 14:53:55 +0530 | [diff] [blame] | 255 | return 0; |
| 256 | } |
| 257 | |
| 258 | int misc_init_r(void) |
| 259 | { |
Priyanka Jain | d158718 | 2017-04-25 10:12:31 +0530 | [diff] [blame] | 260 | #ifdef CONFIG_FSL_QIXIS |
Priyanka Jain | 75cd67f | 2017-04-27 15:08:07 +0530 | [diff] [blame] | 261 | /* |
| 262 | * LS2081ARDB has smart voltage translator which needs |
| 263 | * to be programmed as below |
| 264 | */ |
| 265 | #ifndef CONFIG_TARGET_LS2081ARDB |
Priyanka Jain | d158718 | 2017-04-25 10:12:31 +0530 | [diff] [blame] | 266 | u8 sw; |
| 267 | |
| 268 | sw = QIXIS_READ(arch); |
| 269 | /* |
| 270 | * LS2080ARDB/LS2088ARDB RevF board has smart voltage translator |
| 271 | * which needs to be programmed to enable high speed SD interface |
| 272 | * by setting GPIO4_10 output to zero |
| 273 | */ |
| 274 | if ((sw & 0xf) == 0x5) { |
Priyanka Jain | 75cd67f | 2017-04-27 15:08:07 +0530 | [diff] [blame] | 275 | #endif |
Priyanka Jain | d158718 | 2017-04-25 10:12:31 +0530 | [diff] [blame] | 276 | out_le32(GPIO4_GPDIR_ADDR, (1 << 21 | |
| 277 | in_le32(GPIO4_GPDIR_ADDR))); |
| 278 | out_le32(GPIO4_GPDAT_ADDR, (~(1 << 21) & |
| 279 | in_le32(GPIO4_GPDAT_ADDR))); |
Priyanka Jain | 75cd67f | 2017-04-27 15:08:07 +0530 | [diff] [blame] | 280 | #ifndef CONFIG_TARGET_LS2081ARDB |
Priyanka Jain | d158718 | 2017-04-25 10:12:31 +0530 | [diff] [blame] | 281 | } |
| 282 | #endif |
Priyanka Jain | 75cd67f | 2017-04-27 15:08:07 +0530 | [diff] [blame] | 283 | #endif |
Priyanka Jain | d158718 | 2017-04-25 10:12:31 +0530 | [diff] [blame] | 284 | |
Yangbo Lu | cf00555 | 2015-05-28 14:53:55 +0530 | [diff] [blame] | 285 | if (hwconfig("sdhc")) |
| 286 | config_board_mux(MUX_TYPE_SDHC); |
| 287 | |
Rai Harninder | 6aa1f3b | 2016-03-23 17:04:38 +0530 | [diff] [blame] | 288 | if (adjust_vdd(0)) |
| 289 | printf("Warning: Adjusting core voltage failed.\n"); |
| 290 | |
Yangbo Lu | cf00555 | 2015-05-28 14:53:55 +0530 | [diff] [blame] | 291 | return 0; |
| 292 | } |
| 293 | |
York Sun | e12abcb | 2015-03-20 19:28:24 -0700 | [diff] [blame] | 294 | void detail_board_ddr_info(void) |
| 295 | { |
| 296 | puts("\nDDR "); |
| 297 | print_size(gd->bd->bi_dram[0].size + gd->bd->bi_dram[1].size, ""); |
| 298 | print_ddr_info(0); |
Prabhakar Kushwaha | 122bcfd | 2015-11-09 16:42:07 +0530 | [diff] [blame] | 299 | #ifdef CONFIG_SYS_FSL_HAS_DP_DDR |
York Sun | cbe8e1c | 2016-04-04 11:41:26 -0700 | [diff] [blame] | 300 | if (soc_has_dp_ddr() && gd->bd->bi_dram[2].size) { |
York Sun | e12abcb | 2015-03-20 19:28:24 -0700 | [diff] [blame] | 301 | puts("\nDP-DDR "); |
| 302 | print_size(gd->bd->bi_dram[2].size, ""); |
| 303 | print_ddr_info(CONFIG_DP_DDR_CTRL); |
| 304 | } |
Prabhakar Kushwaha | 122bcfd | 2015-11-09 16:42:07 +0530 | [diff] [blame] | 305 | #endif |
York Sun | e12abcb | 2015-03-20 19:28:24 -0700 | [diff] [blame] | 306 | } |
| 307 | |
York Sun | e12abcb | 2015-03-20 19:28:24 -0700 | [diff] [blame] | 308 | #if defined(CONFIG_ARCH_MISC_INIT) |
| 309 | int arch_misc_init(void) |
| 310 | { |
York Sun | e12abcb | 2015-03-20 19:28:24 -0700 | [diff] [blame] | 311 | return 0; |
| 312 | } |
| 313 | #endif |
| 314 | |
York Sun | e12abcb | 2015-03-20 19:28:24 -0700 | [diff] [blame] | 315 | #ifdef CONFIG_FSL_MC_ENET |
| 316 | void fdt_fixup_board_enet(void *fdt) |
| 317 | { |
| 318 | int offset; |
| 319 | |
Stuart Yoder | a346615 | 2016-03-02 16:37:13 -0600 | [diff] [blame] | 320 | offset = fdt_path_offset(fdt, "/soc/fsl-mc"); |
York Sun | e12abcb | 2015-03-20 19:28:24 -0700 | [diff] [blame] | 321 | |
| 322 | if (offset < 0) |
Stuart Yoder | a346615 | 2016-03-02 16:37:13 -0600 | [diff] [blame] | 323 | offset = fdt_path_offset(fdt, "/fsl-mc"); |
York Sun | e12abcb | 2015-03-20 19:28:24 -0700 | [diff] [blame] | 324 | |
| 325 | if (offset < 0) { |
| 326 | printf("%s: ERROR: fsl-mc node not found in device tree (error %d)\n", |
| 327 | __func__, offset); |
| 328 | return; |
| 329 | } |
| 330 | |
| 331 | if (get_mc_boot_status() == 0) |
| 332 | fdt_status_okay(fdt, offset); |
| 333 | else |
| 334 | fdt_status_fail(fdt, offset); |
| 335 | } |
Alexander Graf | 2ebeb44 | 2016-11-17 01:02:57 +0100 | [diff] [blame] | 336 | |
| 337 | void board_quiesce_devices(void) |
| 338 | { |
| 339 | fsl_mc_ldpaa_exit(gd->bd); |
| 340 | } |
York Sun | e12abcb | 2015-03-20 19:28:24 -0700 | [diff] [blame] | 341 | #endif |
| 342 | |
| 343 | #ifdef CONFIG_OF_BOARD_SETUP |
| 344 | int ft_board_setup(void *blob, bd_t *bd) |
| 345 | { |
Bhupesh Sharma | 0b10a1a | 2015-05-28 14:54:10 +0530 | [diff] [blame] | 346 | u64 base[CONFIG_NR_DRAM_BANKS]; |
| 347 | u64 size[CONFIG_NR_DRAM_BANKS]; |
York Sun | e12abcb | 2015-03-20 19:28:24 -0700 | [diff] [blame] | 348 | |
| 349 | ft_cpu_setup(blob, bd); |
| 350 | |
Bhupesh Sharma | 0b10a1a | 2015-05-28 14:54:10 +0530 | [diff] [blame] | 351 | /* fixup DT for the two GPP DDR banks */ |
| 352 | base[0] = gd->bd->bi_dram[0].start; |
| 353 | size[0] = gd->bd->bi_dram[0].size; |
| 354 | base[1] = gd->bd->bi_dram[1].start; |
| 355 | size[1] = gd->bd->bi_dram[1].size; |
| 356 | |
York Sun | 4de24ef | 2017-03-06 09:02:28 -0800 | [diff] [blame] | 357 | #ifdef CONFIG_RESV_RAM |
| 358 | /* reduce size if reserved memory is within this bank */ |
| 359 | if (gd->arch.resv_ram >= base[0] && |
| 360 | gd->arch.resv_ram < base[0] + size[0]) |
| 361 | size[0] = gd->arch.resv_ram - base[0]; |
| 362 | else if (gd->arch.resv_ram >= base[1] && |
| 363 | gd->arch.resv_ram < base[1] + size[1]) |
| 364 | size[1] = gd->arch.resv_ram - base[1]; |
| 365 | #endif |
| 366 | |
Bhupesh Sharma | 0b10a1a | 2015-05-28 14:54:10 +0530 | [diff] [blame] | 367 | fdt_fixup_memory_banks(blob, base, size, 2); |
York Sun | e12abcb | 2015-03-20 19:28:24 -0700 | [diff] [blame] | 368 | |
Sriram Dash | 9fd465c | 2016-09-16 17:12:15 +0530 | [diff] [blame] | 369 | fsl_fdt_fixup_dr_usb(blob, bd); |
Sriram Dash | 0182095 | 2016-06-13 09:58:36 +0530 | [diff] [blame] | 370 | |
York Sun | e12abcb | 2015-03-20 19:28:24 -0700 | [diff] [blame] | 371 | #ifdef CONFIG_FSL_MC_ENET |
| 372 | fdt_fixup_board_enet(blob); |
York Sun | e12abcb | 2015-03-20 19:28:24 -0700 | [diff] [blame] | 373 | #endif |
| 374 | |
| 375 | return 0; |
| 376 | } |
| 377 | #endif |
| 378 | |
| 379 | void qixis_dump_switch(void) |
| 380 | { |
Priyanka Jain | 6720d0a | 2017-04-28 10:41:34 +0530 | [diff] [blame] | 381 | #ifdef CONFIG_FSL_QIXIS |
York Sun | e12abcb | 2015-03-20 19:28:24 -0700 | [diff] [blame] | 382 | int i, nr_of_cfgsw; |
| 383 | |
| 384 | QIXIS_WRITE(cms[0], 0x00); |
| 385 | nr_of_cfgsw = QIXIS_READ(cms[1]); |
| 386 | |
| 387 | puts("DIP switch settings dump:\n"); |
| 388 | for (i = 1; i <= nr_of_cfgsw; i++) { |
| 389 | QIXIS_WRITE(cms[0], i); |
| 390 | printf("SW%d = (0x%02x)\n", i, QIXIS_READ(cms[1])); |
| 391 | } |
Priyanka Jain | 6720d0a | 2017-04-28 10:41:34 +0530 | [diff] [blame] | 392 | #endif |
York Sun | e12abcb | 2015-03-20 19:28:24 -0700 | [diff] [blame] | 393 | } |
York Sun | ac192a9 | 2015-05-28 14:54:09 +0530 | [diff] [blame] | 394 | |
| 395 | /* |
| 396 | * Board rev C and earlier has duplicated I2C addresses for 2nd controller. |
| 397 | * Both slots has 0x54, resulting 2nd slot unusable. |
| 398 | */ |
| 399 | void update_spd_address(unsigned int ctrl_num, |
| 400 | unsigned int slot, |
| 401 | unsigned int *addr) |
| 402 | { |
Priyanka Jain | 75cd67f | 2017-04-27 15:08:07 +0530 | [diff] [blame] | 403 | #ifndef CONFIG_TARGET_LS2081ARDB |
Priyanka Jain | 6720d0a | 2017-04-28 10:41:34 +0530 | [diff] [blame] | 404 | #ifdef CONFIG_FSL_QIXIS |
York Sun | ac192a9 | 2015-05-28 14:54:09 +0530 | [diff] [blame] | 405 | u8 sw; |
| 406 | |
| 407 | sw = QIXIS_READ(arch); |
| 408 | if ((sw & 0xf) < 0x3) { |
| 409 | if (ctrl_num == 1 && slot == 0) |
| 410 | *addr = SPD_EEPROM_ADDRESS4; |
| 411 | else if (ctrl_num == 1 && slot == 1) |
| 412 | *addr = SPD_EEPROM_ADDRESS3; |
| 413 | } |
Priyanka Jain | 6720d0a | 2017-04-28 10:41:34 +0530 | [diff] [blame] | 414 | #endif |
Priyanka Jain | 75cd67f | 2017-04-27 15:08:07 +0530 | [diff] [blame] | 415 | #endif |
York Sun | ac192a9 | 2015-05-28 14:54:09 +0530 | [diff] [blame] | 416 | } |