1 /*
2  * Copyright 2013 Freescale Semiconductor, Inc.
3  *
4  * See file CREDITS for list of people who contributed to this
5  * project.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License as
9  * published by the Free Software Foundation; either version 2 of
10  * the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
20  * MA 02111-1307 USA
21  */
22 
23 #include <common.h>
24 #include <command.h>
25 #include <i2c.h>
26 #include <netdev.h>
27 #include <linux/compiler.h>
28 #include <asm/mmu.h>
29 #include <asm/processor.h>
30 #include <asm/cache.h>
31 #include <asm/immap_85xx.h>
32 #include <asm/fsl_law.h>
33 #include <asm/fsl_serdes.h>
34 #include <asm/fsl_portals.h>
35 #include <asm/fsl_liodn.h>
36 
37 DECLARE_GLOBAL_DATA_PTR;
38 
39 int checkboard(void)
40 {
41 	struct cpu_type *cpu = gd->arch.cpu;
42 
43 	printf("Board: %sEMU\n", cpu->name);
44 
45 	return 0;
46 }
47 
48 int board_early_init_r(void)
49 {
50 	const unsigned int flashbase = CONFIG_SYS_FLASH_BASE;
51 	const u8 flash_esel = find_tlb_idx((void *)flashbase, 1);
52 
53 	/*
54 	 * Remap Boot flash + PROMJET region to caching-inhibited
55 	 * so that flash can be erased properly.
56 	 */
57 
58 	/* Flush d-cache and invalidate i-cache of any FLASH data */
59 	flush_dcache();
60 	invalidate_icache();
61 
62 	/* invalidate existing TLB entry for flash */
63 	disable_tlb(flash_esel);
64 
65 	set_tlb(1, flashbase, CONFIG_SYS_FLASH_BASE_PHYS,
66 		MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
67 		0, flash_esel, BOOKE_PAGESZ_256M, 1);
68 
69 	set_liodns();
70 #ifdef CONFIG_SYS_DPAA_QBMAN
71 	setup_portals();
72 #endif
73 
74 	return 0;
75 }
76 
77 int misc_init_r(void)
78 {
79 	return 0;
80 }
81 
82 void ft_board_setup(void *blob, bd_t *bd)
83 {
84 	phys_addr_t base;
85 	phys_size_t size;
86 
87 	ft_cpu_setup(blob, bd);
88 
89 	base = getenv_bootm_low();
90 	size = getenv_bootm_size();
91 
92 	fdt_fixup_memory(blob, (u64)base, (u64)size);
93 
94 	fdt_fixup_liodn(blob);
95 	fdt_fixup_dr_usb(blob, bd);
96 }
97