1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright 2014 Freescale Semiconductor, Inc.
9 #include <fdt_support.h>
14 #include <asm/global_data.h>
15 #include <linux/compiler.h>
17 #include <asm/processor.h>
18 #include <asm/cache.h>
19 #include <asm/immap_85xx.h>
20 #include <asm/fsl_law.h>
21 #include <asm/fsl_serdes.h>
22 #include <asm/fsl_liodn.h>
27 #include "../common/vid.h"
29 DECLARE_GLOBAL_DATA_PTR;
33 struct cpu_type *cpu = gd->arch.cpu;
36 printf("Board: %sRDB, ", cpu->name);
37 printf("Board rev: 0x%02x CPLD ver: 0x%02x%02x, ",
38 CPLD_READ(hw_ver), CPLD_READ(sw_maj_ver), CPLD_READ(sw_min_ver));
40 sw = CPLD_READ(vbank);
41 sw = sw & CPLD_BANK_SEL_MASK;
44 printf("vBank: %d\n", sw);
46 printf("Unsupported Bank=%x\n", sw);
48 puts("SERDES Reference Clocks:\n");
49 printf(" SERDES1=100MHz SERDES2=156.25MHz\n"
50 " SERDES3=100MHz SERDES4=100MHz\n");
55 int board_early_init_r(void)
57 const unsigned int flashbase = CONFIG_SYS_FLASH_BASE;
58 int flash_esel = find_tlb_idx((void *)flashbase, 1);
61 * Remap Boot flash + PROMJET region to caching-inhibited
62 * so that flash can be erased properly.
65 /* Flush d-cache and invalidate i-cache of any FLASH data */
69 if (flash_esel == -1) {
70 /* very unlikely unless something is messed up */
71 puts("Error: Could not find TLB for FLASH BASE\n");
72 flash_esel = 2; /* give our best effort to continue */
74 /* invalidate existing TLB entry for flash + promjet */
75 disable_tlb(flash_esel);
78 set_tlb(1, flashbase, CONFIG_SYS_FLASH_BASE_PHYS,
79 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
80 0, flash_esel, BOOKE_PAGESZ_256M, 1);
83 * Adjust core voltage according to voltage ID
84 * This function changes I2C mux to channel 2.
87 printf("Warning: Adjusting core voltage failed.\n");
97 int ft_board_setup(void *blob, struct bd_info *bd)
102 ft_cpu_setup(blob, bd);
104 base = env_get_bootm_low();
105 size = env_get_bootm_size();
107 fdt_fixup_memory(blob, (u64)base, (u64)size);
110 pci_of_setup(blob, bd);
113 fdt_fixup_liodn(blob);
114 fsl_fdt_fixup_dr_usb(blob, bd);
116 #ifdef CONFIG_SYS_DPAA_FMAN
117 #ifndef CONFIG_DM_ETH
118 fdt_fixup_fman_ethernet(blob);
120 fdt_fixup_board_enet(blob);
127 * This function is called by bdinfo to print detail board information.
128 * As an exmaple for future board, we organize the messages into
129 * several sections. If applicable, the message is in the format of
131 * It should aligned with normal output of bdinfo command.
133 * Voltage: Core, DDR and another configurable voltages
134 * Clock : Critical clocks which are not printed already
135 * RCW : RCW source if not printed already
136 * Misc : Other important information not in above catagories
138 void board_detail(void)
142 /* RCW section SW3[4] */
144 puts("RCW source = ");
145 switch (rcwsrc & 0x1) {
150 puts("I2C normal addressing\n");
155 ulong *cs4340_get_fw_addr(void)
157 ulong cortina_fw_addr = CONFIG_CORTINA_FW_ADDR;
159 #ifdef CONFIG_SYS_CORTINA_FW_IN_NOR
162 sw = CPLD_READ(vbank);
163 sw = sw & CPLD_BANK_SEL_MASK;
166 cortina_fw_addr = CORTINA_FW_ADDR_IFCNOR;
168 cortina_fw_addr = CORTINA_FW_ADDR_IFCNOR_ALTBANK;
171 return (ulong *)cortina_fw_addr;