diff options
author | Horatiu Vultur <horatiu.vultur@microchip.com> | 2019-01-23 16:39:45 +0100 |
---|---|---|
committer | Daniel Schwierzeck <daniel.schwierzeck@gmail.com> | 2019-01-23 18:28:09 +0100 |
commit | a834cb817fb1a11607ea8e6394235843be079fdd (patch) | |
tree | 1c98306ac2c12c2654bf37e65f19de77faaab28f /board | |
parent | 66212888381219dc5203bf00aa950ba5e59653df (diff) |
MSCC: Add board support for Serval SoC family.
Add board support and configuration for Jaguar2 SoC family.
The detection of the board type is based on the phy ids.
Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Diffstat (limited to 'board')
-rw-r--r-- | board/mscc/serval/Kconfig | 14 | ||||
-rw-r--r-- | board/mscc/serval/Makefile | 3 | ||||
-rw-r--r-- | board/mscc/serval/serval.c | 74 |
3 files changed, 91 insertions, 0 deletions
diff --git a/board/mscc/serval/Kconfig b/board/mscc/serval/Kconfig new file mode 100644 index 00000000000..64f1c683e44 --- /dev/null +++ b/board/mscc/serval/Kconfig @@ -0,0 +1,14 @@ +# SPDX-License-Identifier: (GPL-2.0+ OR MIT) + +config SYS_VENDOR + default "mscc" + +if SOC_SERVAL + +config SYS_BOARD + default "serval" + +config SYS_CONFIG_NAME + default "serval" + +endif diff --git a/board/mscc/serval/Makefile b/board/mscc/serval/Makefile new file mode 100644 index 00000000000..c7ba56e951b --- /dev/null +++ b/board/mscc/serval/Makefile @@ -0,0 +1,3 @@ +# SPDX-License-Identifier: (GPL-2.0+ OR MIT) + +obj-$(CONFIG_SOC_SERVAL) := serval.o diff --git a/board/mscc/serval/serval.c b/board/mscc/serval/serval.c new file mode 100644 index 00000000000..24ee5e528d9 --- /dev/null +++ b/board/mscc/serval/serval.c @@ -0,0 +1,74 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2018 Microsemi Corporation + */ + +#include <common.h> +#include <asm/io.h> +#include <led.h> + +enum { + BOARD_TYPE_PCB106 = 0xAABBCD00, + BOARD_TYPE_PCB105, +}; + +int board_early_init_r(void) +{ + /* Prepare SPI controller to be used in master mode */ + writel(0, BASE_CFG + ICPU_SW_MODE); + + /* Address of boot parameters */ + gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE; + + /* LED setup */ + if (IS_ENABLED(CONFIG_LED)) + led_default_state(); + + return 0; +} + +static void do_board_detect(void) +{ + u16 gpio_in_reg; + + /* Set MDIO and MDC */ + mscc_gpio_set_alternate(9, 2); + mscc_gpio_set_alternate(10, 2); + + /* Set GPIO page */ + mscc_phy_wr(1, 16, 31, 0x10); + if (!mscc_phy_rd(1, 16, 15, &gpio_in_reg)) { + if (gpio_in_reg & 0x200) + gd->board_type = BOARD_TYPE_PCB106; + else + gd->board_type = BOARD_TYPE_PCB105; + mscc_phy_wr(1, 16, 15, 0); + } else { + gd->board_type = BOARD_TYPE_PCB105; + } +} + +#if defined(CONFIG_MULTI_DTB_FIT) +int board_fit_config_name_match(const char *name) +{ + if (gd->board_type == BOARD_TYPE_PCB106 && + strcmp(name, "serval_pcb106") == 0) + return 0; + + if (gd->board_type == BOARD_TYPE_PCB105 && + strcmp(name, "serval_pcb105") == 0) + return 0; + + return -1; +} +#endif + +#if defined(CONFIG_DTB_RESELECT) +int embedded_dtb_select(void) +{ + do_board_detect(); + fdtdec_setup(); + + return 0; +} +#endif |