]>
Commit | Line | Data |
---|---|---|
f8c8cedd GC |
1 | // SPDX-License-Identifier: (GPL-2.0+ OR MIT) |
2 | /* | |
3 | * Copyright (c) 2018 Microsemi Corporation | |
4 | */ | |
5 | ||
d678a59d | 6 | #include <common.h> |
4d72caa5 | 7 | #include <image.h> |
5255932f | 8 | #include <init.h> |
401d1c4f | 9 | #include <asm/global_data.h> |
f8c8cedd | 10 | #include <asm/io.h> |
711f2dc0 | 11 | #include <led.h> |
bd9216e2 | 12 | #include <miiphy.h> |
f8c8cedd | 13 | |
e9f1492b LP |
14 | enum { |
15 | BOARD_TYPE_PCB090 = 0xAABBCD00, | |
16 | BOARD_TYPE_PCB091, | |
17 | }; | |
18 | ||
f8c8cedd GC |
19 | void board_debug_uart_init(void) |
20 | { | |
21 | /* too early for the pinctrl driver, so configure the UART pins here */ | |
e9f1492b LP |
22 | mscc_gpio_set_alternate(30, 1); |
23 | mscc_gpio_set_alternate(31, 1); | |
f8c8cedd GC |
24 | } |
25 | ||
26 | int board_early_init_r(void) | |
27 | { | |
28 | /* Prepare SPI controller to be used in master mode */ | |
29 | writel(0, BASE_CFG + ICPU_SW_MODE); | |
30 | ||
31 | /* Address of boot parameters */ | |
aa6e94de | 32 | gd->bd->bi_boot_params = CFG_SYS_SDRAM_BASE; |
711f2dc0 | 33 | |
f8c8cedd GC |
34 | return 0; |
35 | } | |
e9f1492b | 36 | |
bd9216e2 HV |
37 | int board_phy_config(struct phy_device *phydev) |
38 | { | |
39 | phy_write(phydev, 0, 31, 0x10); | |
40 | phy_write(phydev, 0, 18, 0x80A0); | |
41 | while (phy_read(phydev, 0, 18) & 0x8000) | |
42 | ; | |
43 | phy_write(phydev, 0, 31, 0); | |
44 | return 0; | |
45 | } | |
46 | ||
e9f1492b LP |
47 | static void do_board_detect(void) |
48 | { | |
49 | u32 chipid = (readl(BASE_DEVCPU_GCB + CHIP_ID) >> 12) & 0xFFFF; | |
50 | ||
51 | if (chipid == 0x7428 || chipid == 0x7424) | |
52 | gd->board_type = BOARD_TYPE_PCB091; // Lu10 | |
53 | else | |
54 | gd->board_type = BOARD_TYPE_PCB090; // Lu26 | |
55 | } | |
56 | ||
57 | #if defined(CONFIG_MULTI_DTB_FIT) | |
58 | int board_fit_config_name_match(const char *name) | |
59 | { | |
60 | if (gd->board_type == BOARD_TYPE_PCB090 && | |
61 | strcmp(name, "luton_pcb090") == 0) | |
62 | return 0; | |
63 | ||
64 | if (gd->board_type == BOARD_TYPE_PCB091 && | |
65 | strcmp(name, "luton_pcb091") == 0) | |
66 | return 0; | |
67 | ||
68 | return -1; | |
69 | } | |
70 | #endif | |
71 | ||
72 | #if defined(CONFIG_DTB_RESELECT) | |
73 | int embedded_dtb_select(void) | |
74 | { | |
75 | do_board_detect(); | |
76 | fdtdec_setup(); | |
77 | ||
78 | return 0; | |
79 | } | |
80 | #endif |