blob: 5448c86c48237150dcfcb8ff7109f1bd9a9bda7e [file] [log] [blame]
Chunhe Lan8e4f3ff2014-04-14 18:42:06 +08001/*
2 * Copyright 2014 Freescale Semiconductor, Inc.
3 *
4 * SPDX-License-Identifier: GPL-2.0+
5 */
6
7#include <common.h>
8#include <command.h>
9#include <i2c.h>
10#include <netdev.h>
11#include <linux/compiler.h>
12#include <asm/mmu.h>
13#include <asm/processor.h>
14#include <asm/cache.h>
15#include <asm/immap_85xx.h>
16#include <asm/fsl_law.h>
17#include <asm/fsl_serdes.h>
18#include <asm/fsl_portals.h>
19#include <asm/fsl_liodn.h>
20#include <fm_eth.h>
21
22#include "t4rdb.h"
23
24DECLARE_GLOBAL_DATA_PTR;
25
26int checkboard(void)
27{
28 struct cpu_type *cpu = gd->arch.cpu;
29
30 printf("Board: %sRDB, ", cpu->name);
31
32 puts("SERDES Reference Clocks:\n");
33 printf(" SERDES1=100MHz SERDES2=156.25MHz\n"
34 " SERDES3=100MHz SERDES4=100MHz\n");
35
36 return 0;
37}
38
39int board_early_init_r(void)
40{
41 const unsigned int flashbase = CONFIG_SYS_FLASH_BASE;
42 const u8 flash_esel = find_tlb_idx((void *)flashbase, 1);
43
44 /*
45 * Remap Boot flash + PROMJET region to caching-inhibited
46 * so that flash can be erased properly.
47 */
48
49 /* Flush d-cache and invalidate i-cache of any FLASH data */
50 flush_dcache();
51 invalidate_icache();
52
53 /* invalidate existing TLB entry for flash + promjet */
54 disable_tlb(flash_esel);
55
56 set_tlb(1, flashbase, CONFIG_SYS_FLASH_BASE_PHYS,
57 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
58 0, flash_esel, BOOKE_PAGESZ_256M, 1);
59
60 set_liodns();
61#ifdef CONFIG_SYS_DPAA_QBMAN
62 setup_portals();
63#endif
64
65 return 0;
66}
67
68int misc_init_r(void)
69{
70 return 0;
71}
72
73void ft_board_setup(void *blob, bd_t *bd)
74{
75 phys_addr_t base;
76 phys_size_t size;
77
78 ft_cpu_setup(blob, bd);
79
80 base = getenv_bootm_low();
81 size = getenv_bootm_size();
82
83 fdt_fixup_memory(blob, (u64)base, (u64)size);
84
85#ifdef CONFIG_PCI
86 pci_of_setup(blob, bd);
87#endif
88
89 fdt_fixup_liodn(blob);
90 fdt_fixup_dr_usb(blob, bd);
91
92#ifdef CONFIG_SYS_DPAA_FMAN
93 fdt_fixup_fman_ethernet(blob);
94 fdt_fixup_board_enet(blob);
95#endif
96}
97
98/*
99 * This function is called by bdinfo to print detail board information.
100 * As an exmaple for future board, we organize the messages into
101 * several sections. If applicable, the message is in the format of
102 * <name> = <value>
103 * It should aligned with normal output of bdinfo command.
104 *
105 * Voltage: Core, DDR and another configurable voltages
106 * Clock : Critical clocks which are not printed already
107 * RCW : RCW source if not printed already
108 * Misc : Other important information not in above catagories
109 */
110void board_detail(void)
111{
112 int rcwsrc;
113
114 /* RCW section SW3[4] */
115 rcwsrc = 0x0;
116 puts("RCW source = ");
117 switch (rcwsrc & 0x1) {
118 case 0x1:
119 puts("SDHC/eMMC\n");
120 break;
121 default:
122 puts("I2C normal addressing\n");
123 break;
124 }
125}