Skip to content

Commit

Permalink
MSCC: Add board support for Serval SoC family.
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Daniel Schwierzeck <[email protected]>
  • Loading branch information
HoratiuVultur authored and danielschwierzeck committed Jan 23, 2019
1 parent 6621288 commit a834cb8
Show file tree
Hide file tree
Showing 6 changed files with 155 additions and 0 deletions.
1 change: 1 addition & 0 deletions arch/mips/dts/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ dtb-$(CONFIG_SOC_LUTON) += luton_pcb090.dtb luton_pcb091.dtb
dtb-$(CONFIG_SOC_OCELOT) += ocelot_pcb120.dtb ocelot_pcb123.dtb
dtb-$(CONFIG_SOC_JR2) += jr2_pcb110.dtb jr2_pcb111.dtb serval2_pcb112.dtb
dtb-$(CONFIG_SOC_SERVALT) += servalt_pcb116.dtb
dtb-$(CONFIG_SOC_SERVAL) += serval_pcb105.dtb serval_pcb106.dtb

targets += $(dtb-y)

Expand Down
1 change: 1 addition & 0 deletions arch/mips/mach-mscc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ CFLAGS_cpu.o += -finline-limit=64000
obj-y += cpu.o dram.o reset.o phy.o lowlevel_init.o
obj-$(CONFIG_SOC_LUTON) += lowlevel_init_luton.o gpio.o
obj-$(CONFIG_SOC_OCELOT) += gpio.o
obj-$(CONFIG_SOC_SERVAL) += gpio.o
14 changes: 14 additions & 0 deletions board/mscc/serval/Kconfig
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions board/mscc/serval/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# SPDX-License-Identifier: (GPL-2.0+ OR MIT)

obj-$(CONFIG_SOC_SERVAL) := serval.o
74 changes: 74 additions & 0 deletions board/mscc/serval/serval.c
Original file line number Diff line number Diff line change
@@ -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
62 changes: 62 additions & 0 deletions configs/mscc_serval_defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
CONFIG_MIPS=y
CONFIG_SYS_TEXT_BASE=0x40000000
CONFIG_SYS_MALLOC_F_LEN=0x2000
CONFIG_ARCH_MSCC=y
CONFIG_SOC_SERVAL=y
CONFIG_DDRTYPE_H5TQ1G63BFA=y
CONFIG_SYS_LITTLE_ENDIAN=y
CONFIG_FIT=y
CONFIG_BOOTDELAY=3
CONFIG_USE_BOOTARGS=y
CONFIG_BOOTARGS="console=ttyS0,115200"
CONFIG_LOGLEVEL=7
CONFIG_DISPLAY_CPUINFO=y
CONFIG_SYS_PROMPT="serval # "
# CONFIG_CMD_BDI is not set
# CONFIG_CMD_CONSOLE is not set
# CONFIG_CMD_ELF is not set
# CONFIG_CMD_EXPORTENV is not set
# CONFIG_CMD_IMPORTENV is not set
# CONFIG_CMD_CRC32 is not set
CONFIG_CMD_MD5SUM=y
CONFIG_CMD_MEMINFO=y
CONFIG_CMD_MEMTEST=y
# CONFIG_CMD_FLASH is not set
CONFIG_CMD_GPIO=y
CONFIG_CMD_SF=y
CONFIG_CMD_SPI=y
# CONFIG_CMD_NFS is not set
CONFIG_CMD_MTDPARTS=y
CONFIG_MTDIDS_DEFAULT="nor0=spi_flash"
CONFIG_MTDPARTS_DEFAULT="mtdparts=spi_flash:1m(UBoot),256k(Env),256k(Env.bk)"
# CONFIG_ISO_PARTITION is not set
CONFIG_DEFAULT_DEVICE_TREE="serval_pcb106"
CONFIG_OF_LIST="serval_pcb106 serval_pcb105"
CONFIG_DTB_RESELECT=y
CONFIG_MULTI_DTB_FIT=y
CONFIG_ENV_IS_IN_SPI_FLASH=y
CONFIG_NET_RANDOM_ETHADDR=y
CONFIG_CLK=y
CONFIG_DM_GPIO=y
CONFIG_MSCC_SGPIO=y
CONFIG_LED=y
CONFIG_LED_GPIO=y
CONFIG_DM_SPI_FLASH=y
CONFIG_SPI_FLASH=y
CONFIG_SPI_FLASH_BAR=y
CONFIG_SPI_FLASH_GIGADEVICE=y
CONFIG_SPI_FLASH_MACRONIX=y
CONFIG_SPI_FLASH_SPANSION=y
CONFIG_SPI_FLASH_STMICRO=y
CONFIG_SPI_FLASH_WINBOND=y
CONFIG_SPI_FLASH_MTD=y
CONFIG_DM_ETH=y
CONFIG_PINCTRL=y
CONFIG_PINCONF=y
CONFIG_DM_SERIAL=y
CONFIG_SYS_NS16550=y
CONFIG_SPI=y
CONFIG_DM_SPI=y
CONFIG_MSCC_BB_SPI=y
CONFIG_LZMA=y
CONFIG_XZ=y

0 comments on commit a834cb8

Please sign in to comment.