]>
Commit | Line | Data |
---|---|---|
83d290c5 | 1 | // SPDX-License-Identifier: GPL-2.0+ |
43486e4c SR |
2 | /* |
3 | * Copyright 2013 Broadcom Corporation. | |
43486e4c SR |
4 | */ |
5 | ||
6 | #include <common.h> | |
7 | #include <asm/io.h> | |
8 | #include <asm/mach-types.h> | |
9 | #include <mmc.h> | |
10 | #include <asm/kona-common/kona_sdhci.h> | |
11 | #include <asm/kona-common/clk.h> | |
12 | #include <asm/arch/sysmap.h> | |
13 | ||
14 | #include <usb.h> | |
15 | #include <usb/dwc2_udc.h> | |
16 | #include <g_dnl.h> | |
17 | ||
18 | #define SECWATCHDOG_SDOGCR_OFFSET 0x00000000 | |
19 | #define SECWATCHDOG_SDOGCR_EN_SHIFT 27 | |
20 | #define SECWATCHDOG_SDOGCR_SRSTEN_SHIFT 26 | |
21 | #define SECWATCHDOG_SDOGCR_CLKS_SHIFT 20 | |
22 | #define SECWATCHDOG_SDOGCR_LD_SHIFT 0 | |
23 | ||
24 | #ifndef CONFIG_USB_SERIALNO | |
25 | #define CONFIG_USB_SERIALNO "1234567890" | |
26 | #endif | |
27 | ||
28 | DECLARE_GLOBAL_DATA_PTR; | |
29 | ||
30 | /* | |
31 | * board_init - early hardware init | |
32 | */ | |
33 | int board_init(void) | |
34 | { | |
35 | printf("Relocation Offset is: %08lx\n", gd->reloc_off); | |
36 | ||
37 | /* adress of boot parameters */ | |
38 | gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100; | |
39 | ||
40 | clk_init(); | |
41 | ||
42 | return 0; | |
43 | } | |
44 | ||
45 | /* | |
46 | * misc_init_r - miscellaneous platform dependent initializations | |
47 | */ | |
48 | int misc_init_r(void) | |
49 | { | |
50 | return 0; | |
51 | } | |
52 | ||
53 | /* | |
54 | * dram_init - sets uboots idea of sdram size | |
55 | */ | |
56 | int dram_init(void) | |
57 | { | |
58 | gd->ram_size = get_ram_size((long *)CONFIG_SYS_SDRAM_BASE, | |
59 | CONFIG_SYS_SDRAM_SIZE); | |
60 | return 0; | |
61 | } | |
62 | ||
63 | /* This is called after dram_init() so use get_ram_size result */ | |
76b00aca | 64 | int dram_init_banksize(void) |
43486e4c SR |
65 | { |
66 | gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE; | |
67 | gd->bd->bi_dram[0].size = gd->ram_size; | |
76b00aca SG |
68 | |
69 | return 0; | |
43486e4c SR |
70 | } |
71 | ||
45a68fe2 | 72 | #ifdef CONFIG_MMC_SDHCI_KONA |
43486e4c SR |
73 | /* |
74 | * mmc_init - Initializes mmc | |
75 | */ | |
76 | int board_mmc_init(bd_t *bis) | |
77 | { | |
78 | int ret = 0; | |
79 | ||
80 | /* Register eMMC - SDIO2 */ | |
81 | ret = kona_sdhci_init(1, 400000, 0); | |
82 | if (ret) | |
83 | return ret; | |
84 | ||
85 | /* Register SD Card - SDIO4 kona_mmc_init assumes 0 based index */ | |
86 | ret = kona_sdhci_init(3, 400000, 0); | |
87 | return ret; | |
88 | } | |
89 | #endif | |
90 | ||
91 | #ifdef CONFIG_USB_GADGET | |
92 | static struct dwc2_plat_otg_data bcm_otg_data = { | |
93 | .regs_otg = HSOTG_BASE_ADDR | |
94 | }; | |
95 | ||
96 | int board_usb_init(int index, enum usb_init_type init) | |
97 | { | |
98 | debug("%s: performing dwc2_udc_probe\n", __func__); | |
99 | return dwc2_udc_probe(&bcm_otg_data); | |
100 | } | |
101 | ||
102 | int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name) | |
103 | { | |
104 | debug("%s\n", __func__); | |
00caae6d | 105 | if (!env_get("serial#")) |
43486e4c SR |
106 | g_dnl_set_serialnumber(CONFIG_USB_SERIALNO); |
107 | return 0; | |
108 | } | |
109 | ||
110 | int g_dnl_get_board_bcd_device_number(int gcnum) | |
111 | { | |
112 | debug("%s\n", __func__); | |
113 | return 1; | |
114 | } | |
115 | ||
116 | int board_usb_cleanup(int index, enum usb_init_type init) | |
117 | { | |
118 | debug("%s\n", __func__); | |
119 | return 0; | |
120 | } | |
121 | #endif |