ARM: dts: meson-sm1-odroid-c4: add ethernet PHY reset
[platform/kernel/u-boot.git] / board / freescale / t4qds / t4240emu.c
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * Copyright 2013 Freescale Semiconductor, Inc.
4  */
5
6 #include <common.h>
7 #include <command.h>
8 #include <env.h>
9 #include <fdt_support.h>
10 #include <i2c.h>
11 #include <image.h>
12 #include <init.h>
13 #include <netdev.h>
14 #include <linux/compiler.h>
15 #include <asm/mmu.h>
16 #include <asm/processor.h>
17 #include <asm/cache.h>
18 #include <asm/immap_85xx.h>
19 #include <asm/fsl_law.h>
20 #include <asm/fsl_serdes.h>
21 #include <asm/fsl_liodn.h>
22
23 DECLARE_GLOBAL_DATA_PTR;
24
25 int checkboard(void)
26 {
27         struct cpu_type *cpu = gd->arch.cpu;
28
29         printf("Board: %sEMU\n", cpu->name);
30
31         return 0;
32 }
33
34 int board_early_init_r(void)
35 {
36         const unsigned int flashbase = CONFIG_SYS_FLASH_BASE;
37         int flash_esel = find_tlb_idx((void *)flashbase, 1);
38
39         /*
40          * Remap Boot flash + PROMJET region to caching-inhibited
41          * so that flash can be erased properly.
42          */
43
44         /* Flush d-cache and invalidate i-cache of any FLASH data */
45         flush_dcache();
46         invalidate_icache();
47
48         if (flash_esel == -1) {
49                 /* very unlikely unless something is messed up */
50                 puts("Error: Could not find TLB for FLASH BASE\n");
51                 flash_esel = 2; /* give our best effort to continue */
52         } else {
53                 /* invalidate existing TLB entry for flash */
54                 disable_tlb(flash_esel);
55         }
56
57         set_tlb(1, flashbase, CONFIG_SYS_FLASH_BASE_PHYS,
58                 MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
59                 0, flash_esel, BOOKE_PAGESZ_256M, 1);
60
61         return 0;
62 }
63
64 int misc_init_r(void)
65 {
66         return 0;
67 }
68
69 int ft_board_setup(void *blob, bd_t *bd)
70 {
71         phys_addr_t base;
72         phys_size_t size;
73
74         ft_cpu_setup(blob, bd);
75
76         base = env_get_bootm_low();
77         size = env_get_bootm_size();
78
79         fdt_fixup_memory(blob, (u64)base, (u64)size);
80
81         fdt_fixup_liodn(blob);
82         fsl_fdt_fixup_dr_usb(blob, bd);
83
84         return 0;
85 }