1 // SPDX-License-Identifier: (GPL-2.0+ OR MIT) 2 /* 3 * Copyright (c) 2018 Microsemi Corporation 4 */ 5 6 #include <common.h> 7 #include <asm/io.h> 8 9 DECLARE_GLOBAL_DATA_PTR; 10 11 enum { 12 BOARD_TYPE_PCB090 = 0xAABBCD00, 13 BOARD_TYPE_PCB091, 14 }; 15 16 void board_debug_uart_init(void) 17 { 18 /* too early for the pinctrl driver, so configure the UART pins here */ 19 mscc_gpio_set_alternate(30, 1); 20 mscc_gpio_set_alternate(31, 1); 21 } 22 23 int board_early_init_r(void) 24 { 25 /* Prepare SPI controller to be used in master mode */ 26 writel(0, BASE_CFG + ICPU_SW_MODE); 27 28 /* Address of boot parameters */ 29 gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE; 30 return 0; 31 } 32 33 static void do_board_detect(void) 34 { 35 u32 chipid = (readl(BASE_DEVCPU_GCB + CHIP_ID) >> 12) & 0xFFFF; 36 37 if (chipid == 0x7428 || chipid == 0x7424) 38 gd->board_type = BOARD_TYPE_PCB091; // Lu10 39 else 40 gd->board_type = BOARD_TYPE_PCB090; // Lu26 41 } 42 43 #if defined(CONFIG_MULTI_DTB_FIT) 44 int board_fit_config_name_match(const char *name) 45 { 46 if (gd->board_type == BOARD_TYPE_PCB090 && 47 strcmp(name, "luton_pcb090") == 0) 48 return 0; 49 50 if (gd->board_type == BOARD_TYPE_PCB091 && 51 strcmp(name, "luton_pcb091") == 0) 52 return 0; 53 54 return -1; 55 } 56 #endif 57 58 #if defined(CONFIG_DTB_RESELECT) 59 int embedded_dtb_select(void) 60 { 61 do_board_detect(); 62 fdtdec_setup(); 63 64 return 0; 65 } 66 #endif 67