Merge tag 'efi-2020-07-rc6' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi
[oweals/u-boot.git] / board / freescale / bsc9131rdb / bsc9131rdb.c
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * Copyright 2011-2012 Freescale Semiconductor, Inc.
4  */
5
6 #include <common.h>
7 #include <image.h>
8 #include <init.h>
9 #include <asm/processor.h>
10 #include <asm/mmu.h>
11 #include <asm/cache.h>
12 #include <asm/immap_85xx.h>
13 #include <asm/io.h>
14 #include <env.h>
15 #include <miiphy.h>
16 #include <linux/libfdt.h>
17 #include <fdt_support.h>
18 #include <fsl_mdio.h>
19 #include <tsec.h>
20 #include <jffs2/load_kernel.h>
21 #include <mtd_node.h>
22 #include <flash.h>
23 #include <netdev.h>
24
25
26 DECLARE_GLOBAL_DATA_PTR;
27
28 int board_early_init_f(void)
29 {
30         ccsr_gur_t *gur = (void *)CONFIG_SYS_MPC85xx_GUTS_ADDR;
31
32         clrbits_be32(&gur->pmuxcr2, MPC85xx_PMUXCR2_UART_CTS_B0_GPIO42);
33         setbits_be32(&gur->pmuxcr2, MPC85xx_PMUXCR2_UART_CTS_B0_DSP_TMS);
34
35         clrbits_be32(&gur->pmuxcr2, MPC85xx_PMUXCR2_UART_RTS_B0_GPIO43);
36         setbits_be32(&gur->pmuxcr2, MPC85xx_PMUXCR2_UART_RTS_B0_DSP_TCK |
37                         MPC85xx_PMUXCR2_UART_CTS_B1_SIM_PD);
38         setbits_be32(&gur->halt_req_mask, HALTED_TO_HALT_REQ_MASK_0);
39         clrsetbits_be32(&gur->pmuxcr, MPC85xx_PMUXCR_IFC_AD_GPIO_MASK |
40                         MPC85xx_PMUXCR_IFC_AD17_GPO_MASK,
41                         MPC85xx_PMUXCR_IFC_AD_GPIO |
42                         MPC85xx_PMUXCR_IFC_AD17_GPO | MPC85xx_PMUXCR_SDHC_USIM);
43
44         return 0;
45 }
46
47 int checkboard(void)
48 {
49         struct cpu_type *cpu;
50
51         cpu = gd->arch.cpu;
52         printf("Board: %sRDB\n", cpu->name);
53
54         return 0;
55 }
56
57 #if defined(CONFIG_OF_BOARD_SETUP)
58 #ifdef CONFIG_FDT_FIXUP_PARTITIONS
59 static const struct node_info nodes[] = {
60         { "fsl,ifc-nand",               MTD_DEV_TYPE_NAND, },
61 };
62 #endif
63 int ft_board_setup(void *blob, bd_t *bd)
64 {
65         phys_addr_t base;
66         phys_size_t size;
67
68         ft_cpu_setup(blob, bd);
69
70         base = env_get_bootm_low();
71         size = env_get_bootm_size();
72
73         fdt_fixup_memory(blob, (u64)base, (u64)size);
74 #ifdef CONFIG_FDT_FIXUP_PARTITIONS
75         fdt_fixup_mtdparts(blob, nodes, ARRAY_SIZE(nodes));
76 #endif
77
78         fsl_fdt_fixup_dr_usb(blob, bd);
79
80         return 0;
81 }
82 #endif