blob: ce419dfcaeabf9a9c17d83ec0837a500c342fadd [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
York Sune2b65ea2015-03-20 19:28:24 -07002/*
3 * Copyright 2015 Freescale Semiconductor
Alison Wanga7943fd2018-06-18 20:25:05 +08004 * Copyright 2017 NXP
York Sune2b65ea2015-03-20 19:28:24 -07005 */
6#include <common.h>
7#include <malloc.h>
8#include <errno.h>
9#include <netdev.h>
10#include <fsl_ifc.h>
11#include <fsl_ddr.h>
12#include <asm/io.h>
Yangbo Lu5a4d7442015-05-28 14:53:55 +053013#include <hwconfig.h>
York Sune2b65ea2015-03-20 19:28:24 -070014#include <fdt_support.h>
Masahiro Yamadab08c8c42018-03-05 01:20:11 +090015#include <linux/libfdt.h>
York Sune2b65ea2015-03-20 19:28:24 -070016#include <fsl-mc/fsl_mc.h>
17#include <environment.h>
Alexander Graf215b1fb2016-11-17 01:02:59 +010018#include <efi_loader.h>
York Sune2b65ea2015-03-20 19:28:24 -070019#include <i2c.h>
York Sun4961eaf2017-03-06 09:02:34 -080020#include <asm/arch/mmu.h>
Mingkai Hu9f3183d2015-10-26 19:47:50 +080021#include <asm/arch/soc.h>
Santan Kumar54ad7b52017-03-07 11:21:03 +053022#include <asm/arch/ppa.h>
Saksham Jainfcfdb6d2016-03-23 16:24:35 +053023#include <fsl_sec.h>
York Sune2b65ea2015-03-20 19:28:24 -070024
Priyanka Jaind1418c12017-04-28 10:41:34 +053025#ifdef CONFIG_FSL_QIXIS
York Sune2b65ea2015-03-20 19:28:24 -070026#include "../common/qixis.h"
Prabhakar Kushwaha44937212015-11-09 16:42:07 +053027#include "ls2080ardb_qixis.h"
Priyanka Jaind1418c12017-04-28 10:41:34 +053028#endif
Rai Harnindered2530d2016-03-23 17:04:38 +053029#include "../common/vid.h"
York Sune2b65ea2015-03-20 19:28:24 -070030
Yangbo Lu5a4d7442015-05-28 14:53:55 +053031#define PIN_MUX_SEL_SDHC 0x00
Haikun.Wang@freescale.com5989df72015-06-26 19:58:24 +080032#define PIN_MUX_SEL_DSPI 0x0a
Yangbo Lu5a4d7442015-05-28 14:53:55 +053033
34#define SET_SDHC_MUX_SEL(reg, value) ((reg & 0xf0) | value)
York Sune2b65ea2015-03-20 19:28:24 -070035DECLARE_GLOBAL_DATA_PTR;
36
Yangbo Lu5a4d7442015-05-28 14:53:55 +053037enum {
38 MUX_TYPE_SDHC,
Haikun.Wang@freescale.com5989df72015-06-26 19:58:24 +080039 MUX_TYPE_DSPI,
Yangbo Lu5a4d7442015-05-28 14:53:55 +053040};
41
York Sune2b65ea2015-03-20 19:28:24 -070042unsigned long long get_qixis_addr(void)
43{
44 unsigned long long addr;
45
46 if (gd->flags & GD_FLG_RELOC)
47 addr = QIXIS_BASE_PHYS;
48 else
49 addr = QIXIS_BASE_PHYS_EARLY;
50
51 /*
52 * IFC address under 256MB is mapped to 0x30000000, any address above
53 * is mapped to 0x5_10000000 up to 4GB.
54 */
55 addr = addr > 0x10000000 ? addr + 0x500000000ULL : addr + 0x30000000;
56
57 return addr;
58}
59
60int checkboard(void)
61{
Priyanka Jaind1418c12017-04-28 10:41:34 +053062#ifdef CONFIG_FSL_QIXIS
York Sune2b65ea2015-03-20 19:28:24 -070063 u8 sw;
Priyanka Jaind1418c12017-04-28 10:41:34 +053064#endif
Prabhakar Kushwahaff1b8e32015-05-28 14:54:07 +053065 char buf[15];
66
67 cpu_name(buf);
68 printf("Board: %s-RDB, ", buf);
York Sune2b65ea2015-03-20 19:28:24 -070069
Priyanka Jain3049a582017-04-27 15:08:07 +053070#ifdef CONFIG_TARGET_LS2081ARDB
71#ifdef CONFIG_FSL_QIXIS
72 sw = QIXIS_READ(arch);
Priyanka Jain3049a582017-04-27 15:08:07 +053073 printf("Board version: %c, ", (sw & 0xf) + 'A');
74
75 sw = QIXIS_READ(brdcfg[0]);
Priyanka Jainda28a032018-01-08 12:20:42 +053076 sw = (sw >> QIXIS_QMAP_SHIFT) & QIXIS_QMAP_MASK;
Priyanka Jain3049a582017-04-27 15:08:07 +053077 switch (sw) {
78 case 0:
79 puts("boot from QSPI DEV#0\n");
80 puts("QSPI_CSA_1 mapped to QSPI DEV#1\n");
81 break;
82 case 1:
83 puts("boot from QSPI DEV#1\n");
84 puts("QSPI_CSA_1 mapped to QSPI DEV#0\n");
85 break;
86 case 2:
87 puts("boot from QSPI EMU\n");
88 puts("QSPI_CSA_1 mapped to QSPI DEV#0\n");
89 break;
90 case 3:
91 puts("boot from QSPI EMU\n");
92 puts("QSPI_CSA_1 mapped to QSPI DEV#1\n");
93 break;
94 case 4:
95 puts("boot from QSPI DEV#0\n");
96 puts("QSPI_CSA_1 mapped to QSPI EMU\n");
97 break;
98 default:
99 printf("invalid setting of SW%u\n", sw);
100 break;
101 }
Priyanka Jainf436fbf2018-01-08 12:59:31 +0530102 printf("FPGA: v%d.%d\n", QIXIS_READ(scver), QIXIS_READ(tagdata));
Priyanka Jain3049a582017-04-27 15:08:07 +0530103#endif
104 puts("SERDES1 Reference : ");
105 printf("Clock1 = 100MHz ");
106 printf("Clock2 = 161.13MHz");
107#else
Priyanka Jaind1418c12017-04-28 10:41:34 +0530108#ifdef CONFIG_FSL_QIXIS
York Sune2b65ea2015-03-20 19:28:24 -0700109 sw = QIXIS_READ(arch);
York Sune2b65ea2015-03-20 19:28:24 -0700110 printf("Board Arch: V%d, ", sw >> 4);
Prabhakar Kushwaha27df54b2015-05-28 14:54:04 +0530111 printf("Board version: %c, boot from ", (sw & 0xf) + 'A');
York Sune2b65ea2015-03-20 19:28:24 -0700112
113 sw = QIXIS_READ(brdcfg[0]);
114 sw = (sw & QIXIS_LBMAP_MASK) >> QIXIS_LBMAP_SHIFT;
115
116 if (sw < 0x8)
117 printf("vBank: %d\n", sw);
118 else if (sw == 0x9)
119 puts("NAND\n");
120 else
121 printf("invalid setting of SW%u\n", QIXIS_LBMAP_SWITCH);
122
123 printf("FPGA: v%d.%d\n", QIXIS_READ(scver), QIXIS_READ(tagdata));
Priyanka Jaind1418c12017-04-28 10:41:34 +0530124#endif
York Sune2b65ea2015-03-20 19:28:24 -0700125 puts("SERDES1 Reference : ");
126 printf("Clock1 = 156.25MHz ");
127 printf("Clock2 = 156.25MHz");
Priyanka Jain3049a582017-04-27 15:08:07 +0530128#endif
York Sune2b65ea2015-03-20 19:28:24 -0700129
130 puts("\nSERDES2 Reference : ");
131 printf("Clock1 = 100MHz ");
132 printf("Clock2 = 100MHz\n");
133
134 return 0;
135}
136
137unsigned long get_board_sys_clk(void)
138{
Priyanka Jaind1418c12017-04-28 10:41:34 +0530139#ifdef CONFIG_FSL_QIXIS
York Sune2b65ea2015-03-20 19:28:24 -0700140 u8 sysclk_conf = QIXIS_READ(brdcfg[1]);
141
142 switch (sysclk_conf & 0x0F) {
143 case QIXIS_SYSCLK_83:
144 return 83333333;
145 case QIXIS_SYSCLK_100:
146 return 100000000;
147 case QIXIS_SYSCLK_125:
148 return 125000000;
149 case QIXIS_SYSCLK_133:
150 return 133333333;
151 case QIXIS_SYSCLK_150:
152 return 150000000;
153 case QIXIS_SYSCLK_160:
154 return 160000000;
155 case QIXIS_SYSCLK_166:
156 return 166666666;
157 }
Priyanka Jaind1418c12017-04-28 10:41:34 +0530158#endif
159 return 100000000;
York Sune2b65ea2015-03-20 19:28:24 -0700160}
161
162int select_i2c_ch_pca9547(u8 ch)
163{
164 int ret;
165
166 ret = i2c_write(I2C_MUX_PCA_ADDR_PRI, 0, 1, &ch, 1);
167 if (ret) {
168 puts("PCA: failed to select proper channel\n");
169 return ret;
170 }
171
172 return 0;
173}
174
Rai Harnindered2530d2016-03-23 17:04:38 +0530175int i2c_multiplexer_select_vid_channel(u8 channel)
176{
177 return select_i2c_ch_pca9547(channel);
178}
179
Haikun.Wang@freescale.com5989df72015-06-26 19:58:24 +0800180int config_board_mux(int ctrl_type)
181{
Priyanka Jaind1418c12017-04-28 10:41:34 +0530182#ifdef CONFIG_FSL_QIXIS
Haikun.Wang@freescale.com5989df72015-06-26 19:58:24 +0800183 u8 reg5;
184
185 reg5 = QIXIS_READ(brdcfg[5]);
186
187 switch (ctrl_type) {
188 case MUX_TYPE_SDHC:
189 reg5 = SET_SDHC_MUX_SEL(reg5, PIN_MUX_SEL_SDHC);
190 break;
191 case MUX_TYPE_DSPI:
192 reg5 = SET_SDHC_MUX_SEL(reg5, PIN_MUX_SEL_DSPI);
193 break;
194 default:
195 printf("Wrong mux interface type\n");
196 return -1;
197 }
198
199 QIXIS_WRITE(brdcfg[5], reg5);
Priyanka Jaind1418c12017-04-28 10:41:34 +0530200#endif
Haikun.Wang@freescale.com5989df72015-06-26 19:58:24 +0800201 return 0;
202}
203
York Sune2b65ea2015-03-20 19:28:24 -0700204int board_init(void)
205{
York Sun931e8752016-05-26 13:59:03 -0700206#ifdef CONFIG_FSL_MC_ENET
Shaohui Xieabc7d0f2016-01-28 15:38:15 +0800207 u32 __iomem *irq_ccsr = (u32 __iomem *)ISC_BASE;
York Sun931e8752016-05-26 13:59:03 -0700208#endif
Haikun.Wang@freescale.com5989df72015-06-26 19:58:24 +0800209
York Sune2b65ea2015-03-20 19:28:24 -0700210 init_final_memctl_regs();
211
212#ifdef CONFIG_ENV_IS_NOWHERE
213 gd->env_addr = (ulong)&default_environment[0];
214#endif
215 select_i2c_ch_pca9547(I2C_MUX_CH_DEFAULT);
216
Priyanka Jaind1418c12017-04-28 10:41:34 +0530217#ifdef CONFIG_FSL_QIXIS
York Sune2b65ea2015-03-20 19:28:24 -0700218 QIXIS_WRITE(rst_ctl, QIXIS_RST_CTL_RESET_EN);
Priyanka Jaind1418c12017-04-28 10:41:34 +0530219#endif
Udit Agarwal15e7c682017-08-16 07:13:29 -0400220
221#ifdef CONFIG_FSL_CAAM
222 sec_init();
223#endif
Santan Kumar54ad7b52017-03-07 11:21:03 +0530224#ifdef CONFIG_FSL_LS_PPA
225 ppa_init();
226#endif
227
York Sun931e8752016-05-26 13:59:03 -0700228#ifdef CONFIG_FSL_MC_ENET
Shaohui Xieabc7d0f2016-01-28 15:38:15 +0800229 /* invert AQR405 IRQ pins polarity */
230 out_le32(irq_ccsr + IRQCR_OFFSET / 4, AQR405_IRQ_MASK);
York Sun931e8752016-05-26 13:59:03 -0700231#endif
Udit Agarwala8c6fd42017-02-03 22:53:38 +0530232#ifdef CONFIG_FSL_CAAM
233 sec_init();
234#endif
Shaohui Xieabc7d0f2016-01-28 15:38:15 +0800235
York Sune2b65ea2015-03-20 19:28:24 -0700236 return 0;
237}
238
239int board_early_init_f(void)
240{
Priyanka Jain3049a582017-04-27 15:08:07 +0530241#ifdef CONFIG_SYS_I2C_EARLY_INIT
242 i2c_early_init_f();
243#endif
York Sune2b65ea2015-03-20 19:28:24 -0700244 fsl_lsch3_early_init_f();
245 return 0;
246}
247
Yangbo Lu5a4d7442015-05-28 14:53:55 +0530248int misc_init_r(void)
249{
Santan Kumar263536a2017-06-15 17:07:01 +0530250 char *env_hwconfig;
251 u32 __iomem *dcfg_ccsr = (u32 __iomem *)DCFG_BASE;
252 u32 val;
Priyanka Jainb5dfd472017-09-15 10:19:48 +0530253 struct ccsr_gur __iomem *gur = (void *)(CONFIG_SYS_FSL_GUTS_ADDR);
254 u32 svr = gur_in32(&gur->svr);
Santan Kumar263536a2017-06-15 17:07:01 +0530255
256 val = in_le32(dcfg_ccsr + DCFG_RCWSR13 / 4);
257
Simon Glass00caae62017-08-03 12:22:12 -0600258 env_hwconfig = env_get("hwconfig");
Santan Kumar263536a2017-06-15 17:07:01 +0530259
260 if (hwconfig_f("dspi", env_hwconfig) &&
261 DCFG_RCWSR13_DSPI == (val & (u32)(0xf << 8)))
262 config_board_mux(MUX_TYPE_DSPI);
263 else
264 config_board_mux(MUX_TYPE_SDHC);
265
Priyanka Jain3049a582017-04-27 15:08:07 +0530266 /*
Santan Kumar6cc914e2017-06-09 11:48:05 +0530267 * LS2081ARDB RevF board has smart voltage translator
Priyanka Jain51934052017-04-25 10:12:31 +0530268 * which needs to be programmed to enable high speed SD interface
269 * by setting GPIO4_10 output to zero
270 */
Santan Kumar6cc914e2017-06-09 11:48:05 +0530271#ifdef CONFIG_TARGET_LS2081ARDB
Priyanka Jain51934052017-04-25 10:12:31 +0530272 out_le32(GPIO4_GPDIR_ADDR, (1 << 21 |
273 in_le32(GPIO4_GPDIR_ADDR)));
274 out_le32(GPIO4_GPDAT_ADDR, (~(1 << 21) &
275 in_le32(GPIO4_GPDAT_ADDR)));
Priyanka Jain51934052017-04-25 10:12:31 +0530276#endif
Yangbo Lu5a4d7442015-05-28 14:53:55 +0530277 if (hwconfig("sdhc"))
278 config_board_mux(MUX_TYPE_SDHC);
279
Rai Harnindered2530d2016-03-23 17:04:38 +0530280 if (adjust_vdd(0))
281 printf("Warning: Adjusting core voltage failed.\n");
Priyanka Jainb5dfd472017-09-15 10:19:48 +0530282 /*
283 * Default value of board env is based on filename which is
284 * ls2080ardb. Modify board env for other supported SoCs
285 */
286 if ((SVR_SOC_VER(svr) == SVR_LS2088A) ||
287 (SVR_SOC_VER(svr) == SVR_LS2048A))
288 env_set("board", "ls2088ardb");
289 else if ((SVR_SOC_VER(svr) == SVR_LS2081A) ||
290 (SVR_SOC_VER(svr) == SVR_LS2041A))
291 env_set("board", "ls2081ardb");
Rai Harnindered2530d2016-03-23 17:04:38 +0530292
Yangbo Lu5a4d7442015-05-28 14:53:55 +0530293 return 0;
294}
295
York Sune2b65ea2015-03-20 19:28:24 -0700296void detail_board_ddr_info(void)
297{
298 puts("\nDDR ");
299 print_size(gd->bd->bi_dram[0].size + gd->bd->bi_dram[1].size, "");
300 print_ddr_info(0);
Prabhakar Kushwaha44937212015-11-09 16:42:07 +0530301#ifdef CONFIG_SYS_FSL_HAS_DP_DDR
York Sun3c1d2182016-04-04 11:41:26 -0700302 if (soc_has_dp_ddr() && gd->bd->bi_dram[2].size) {
York Sune2b65ea2015-03-20 19:28:24 -0700303 puts("\nDP-DDR ");
304 print_size(gd->bd->bi_dram[2].size, "");
305 print_ddr_info(CONFIG_DP_DDR_CTRL);
306 }
Prabhakar Kushwaha44937212015-11-09 16:42:07 +0530307#endif
York Sune2b65ea2015-03-20 19:28:24 -0700308}
309
York Sune2b65ea2015-03-20 19:28:24 -0700310#if defined(CONFIG_ARCH_MISC_INIT)
311int arch_misc_init(void)
312{
York Sune2b65ea2015-03-20 19:28:24 -0700313 return 0;
314}
315#endif
316
York Sune2b65ea2015-03-20 19:28:24 -0700317#ifdef CONFIG_FSL_MC_ENET
318void fdt_fixup_board_enet(void *fdt)
319{
320 int offset;
321
Stuart Yodere91f1de2016-03-02 16:37:13 -0600322 offset = fdt_path_offset(fdt, "/soc/fsl-mc");
York Sune2b65ea2015-03-20 19:28:24 -0700323
324 if (offset < 0)
Stuart Yodere91f1de2016-03-02 16:37:13 -0600325 offset = fdt_path_offset(fdt, "/fsl-mc");
York Sune2b65ea2015-03-20 19:28:24 -0700326
327 if (offset < 0) {
328 printf("%s: ERROR: fsl-mc node not found in device tree (error %d)\n",
329 __func__, offset);
330 return;
331 }
332
Mian Yousaf Kaukab7e968042018-12-18 14:01:17 +0100333 if (get_mc_boot_status() == 0 &&
334 (is_lazy_dpl_addr_valid() || get_dpl_apply_status() == 0))
York Sune2b65ea2015-03-20 19:28:24 -0700335 fdt_status_okay(fdt, offset);
336 else
337 fdt_status_fail(fdt, offset);
338}
Alexander Grafb7b84102016-11-17 01:02:57 +0100339
340void board_quiesce_devices(void)
341{
342 fsl_mc_ldpaa_exit(gd->bd);
343}
York Sune2b65ea2015-03-20 19:28:24 -0700344#endif
345
346#ifdef CONFIG_OF_BOARD_SETUP
Santan Kumar7794d9a2017-07-05 18:05:08 +0530347void fsl_fdt_fixup_flash(void *fdt)
348{
349 int offset;
Rajesh Bhagat9570df02018-12-27 04:37:59 +0000350#ifdef CONFIG_TFABOOT
351 u32 __iomem *dcfg_ccsr = (u32 __iomem *)DCFG_BASE;
352 u32 val;
353#endif
Santan Kumar7794d9a2017-07-05 18:05:08 +0530354
355/*
356 * IFC and QSPI are muxed on board.
357 * So disable IFC node in dts if QSPI is enabled or
358 * disable QSPI node in dts in case QSPI is not enabled.
359 */
Rajesh Bhagat9570df02018-12-27 04:37:59 +0000360#ifdef CONFIG_TFABOOT
361 enum boot_src src = get_boot_src();
362 bool disable_ifc = false;
363
364 switch (src) {
365 case BOOT_SOURCE_IFC_NOR:
366 disable_ifc = false;
367 break;
368 case BOOT_SOURCE_QSPI_NOR:
369 disable_ifc = true;
370 break;
371 default:
372 val = in_le32(dcfg_ccsr + DCFG_RCWSR15 / 4);
373 if (DCFG_RCWSR15_IFCGRPABASE_QSPI == (val & (u32)0x3))
374 disable_ifc = true;
375 break;
376 }
377
378 if (disable_ifc) {
379 offset = fdt_path_offset(fdt, "/soc/ifc");
380
381 if (offset < 0)
382 offset = fdt_path_offset(fdt, "/ifc");
383 } else {
384 offset = fdt_path_offset(fdt, "/soc/quadspi");
385
386 if (offset < 0)
387 offset = fdt_path_offset(fdt, "/quadspi");
388 }
389
390#else
Santan Kumar7794d9a2017-07-05 18:05:08 +0530391#ifdef CONFIG_FSL_QSPI
392 offset = fdt_path_offset(fdt, "/soc/ifc");
393
394 if (offset < 0)
395 offset = fdt_path_offset(fdt, "/ifc");
396#else
397 offset = fdt_path_offset(fdt, "/soc/quadspi");
398
399 if (offset < 0)
400 offset = fdt_path_offset(fdt, "/quadspi");
401#endif
Rajesh Bhagat9570df02018-12-27 04:37:59 +0000402#endif
403
Santan Kumar7794d9a2017-07-05 18:05:08 +0530404 if (offset < 0)
405 return;
406
407 fdt_status_disabled(fdt, offset);
408}
409
York Sune2b65ea2015-03-20 19:28:24 -0700410int ft_board_setup(void *blob, bd_t *bd)
411{
Bhupesh Sharmaa2dc8182015-05-28 14:54:10 +0530412 u64 base[CONFIG_NR_DRAM_BANKS];
413 u64 size[CONFIG_NR_DRAM_BANKS];
York Sune2b65ea2015-03-20 19:28:24 -0700414
415 ft_cpu_setup(blob, bd);
416
Bhupesh Sharmaa2dc8182015-05-28 14:54:10 +0530417 /* fixup DT for the two GPP DDR banks */
418 base[0] = gd->bd->bi_dram[0].start;
419 size[0] = gd->bd->bi_dram[0].size;
420 base[1] = gd->bd->bi_dram[1].start;
421 size[1] = gd->bd->bi_dram[1].size;
422
York Sun36cc0de2017-03-06 09:02:28 -0800423#ifdef CONFIG_RESV_RAM
424 /* reduce size if reserved memory is within this bank */
425 if (gd->arch.resv_ram >= base[0] &&
426 gd->arch.resv_ram < base[0] + size[0])
427 size[0] = gd->arch.resv_ram - base[0];
428 else if (gd->arch.resv_ram >= base[1] &&
429 gd->arch.resv_ram < base[1] + size[1])
430 size[1] = gd->arch.resv_ram - base[1];
431#endif
432
Bhupesh Sharmaa2dc8182015-05-28 14:54:10 +0530433 fdt_fixup_memory_banks(blob, base, size, 2);
York Sune2b65ea2015-03-20 19:28:24 -0700434
Nipun Guptaa78df402018-08-20 16:01:14 +0530435 fdt_fsl_mc_fixup_iommu_map_entry(blob);
436
Sriram Dasha5c289b2016-09-16 17:12:15 +0530437 fsl_fdt_fixup_dr_usb(blob, bd);
Sriram Dashef53b8c2016-06-13 09:58:36 +0530438
Santan Kumar7794d9a2017-07-05 18:05:08 +0530439 fsl_fdt_fixup_flash(blob);
440
York Sune2b65ea2015-03-20 19:28:24 -0700441#ifdef CONFIG_FSL_MC_ENET
442 fdt_fixup_board_enet(blob);
York Sune2b65ea2015-03-20 19:28:24 -0700443#endif
444
445 return 0;
446}
447#endif
448
449void qixis_dump_switch(void)
450{
Priyanka Jaind1418c12017-04-28 10:41:34 +0530451#ifdef CONFIG_FSL_QIXIS
York Sune2b65ea2015-03-20 19:28:24 -0700452 int i, nr_of_cfgsw;
453
454 QIXIS_WRITE(cms[0], 0x00);
455 nr_of_cfgsw = QIXIS_READ(cms[1]);
456
457 puts("DIP switch settings dump:\n");
458 for (i = 1; i <= nr_of_cfgsw; i++) {
459 QIXIS_WRITE(cms[0], i);
460 printf("SW%d = (0x%02x)\n", i, QIXIS_READ(cms[1]));
461 }
Priyanka Jaind1418c12017-04-28 10:41:34 +0530462#endif
York Sune2b65ea2015-03-20 19:28:24 -0700463}
York Sunfc7b3852015-05-28 14:54:09 +0530464
465/*
466 * Board rev C and earlier has duplicated I2C addresses for 2nd controller.
467 * Both slots has 0x54, resulting 2nd slot unusable.
468 */
469void update_spd_address(unsigned int ctrl_num,
470 unsigned int slot,
471 unsigned int *addr)
472{
Priyanka Jain3049a582017-04-27 15:08:07 +0530473#ifndef CONFIG_TARGET_LS2081ARDB
Priyanka Jaind1418c12017-04-28 10:41:34 +0530474#ifdef CONFIG_FSL_QIXIS
York Sunfc7b3852015-05-28 14:54:09 +0530475 u8 sw;
476
477 sw = QIXIS_READ(arch);
478 if ((sw & 0xf) < 0x3) {
479 if (ctrl_num == 1 && slot == 0)
480 *addr = SPD_EEPROM_ADDRESS4;
481 else if (ctrl_num == 1 && slot == 1)
482 *addr = SPD_EEPROM_ADDRESS3;
483 }
Priyanka Jaind1418c12017-04-28 10:41:34 +0530484#endif
Priyanka Jain3049a582017-04-27 15:08:07 +0530485#endif
York Sunfc7b3852015-05-28 14:54:09 +0530486}