diff options
author | Lars Povlsen <lars.povlsen@microchip.com> | 2018-12-20 09:56:05 +0100 |
---|---|---|
committer | Daniel Schwierzeck <daniel.schwierzeck@gmail.com> | 2019-01-16 13:56:43 +0100 |
commit | e9f1492bcac5127800a25a01e505e225956e2967 (patch) | |
tree | bc38d3a5c8b3e2310482b6e33ef0c5e384a96236 /board/mscc | |
parent | e39c6783d37fd9e0c66c0ace184734a4e9446e00 (diff) |
mips: mscc: luton+ocelot: Remove board config options, do probing
As we are moving to multi-dtb and board detection, remove static board
config options, and introduce board probing instead.
Luton: This add single-binary support for the two MSCC luton-based
reference boards - pcb090 and pcb091. The SoC chip ID is used to
determine the board type.
Ocelot: This add single-binary support for the two MSCC ocelot-based
reference boards - pcb120 and pcb123. The PHY ids on specific ports
are used to determine the board type.
Signed-off-by: Lars Povlsen <lars.povlsen@microchip.com>
Diffstat (limited to 'board/mscc')
-rw-r--r-- | board/mscc/luton/luton.c | 46 | ||||
-rw-r--r-- | board/mscc/ocelot/ocelot.c | 52 |
2 files changed, 88 insertions, 10 deletions
diff --git a/board/mscc/luton/luton.c b/board/mscc/luton/luton.c index 41fc6d56a7..b509b6beb3 100644 --- a/board/mscc/luton/luton.c +++ b/board/mscc/luton/luton.c @@ -6,15 +6,18 @@ #include <common.h> #include <asm/io.h> -#define MSCC_GPIO_ALT0 0x88 -#define MSCC_GPIO_ALT1 0x8C - DECLARE_GLOBAL_DATA_PTR; +enum { + BOARD_TYPE_PCB090 = 0xAABBCD00, + BOARD_TYPE_PCB091, +}; + void board_debug_uart_init(void) { /* too early for the pinctrl driver, so configure the UART pins here */ - setbits_le32(BASE_DEVCPU_GCB + MSCC_GPIO_ALT0, BIT(30) | BIT(31)); + mscc_gpio_set_alternate(30, 1); + mscc_gpio_set_alternate(31, 1); } int board_early_init_r(void) @@ -26,3 +29,38 @@ int board_early_init_r(void) gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE; return 0; } + +static void do_board_detect(void) +{ + u32 chipid = (readl(BASE_DEVCPU_GCB + CHIP_ID) >> 12) & 0xFFFF; + + if (chipid == 0x7428 || chipid == 0x7424) + gd->board_type = BOARD_TYPE_PCB091; // Lu10 + else + gd->board_type = BOARD_TYPE_PCB090; // Lu26 +} + +#if defined(CONFIG_MULTI_DTB_FIT) +int board_fit_config_name_match(const char *name) +{ + if (gd->board_type == BOARD_TYPE_PCB090 && + strcmp(name, "luton_pcb090") == 0) + return 0; + + if (gd->board_type == BOARD_TYPE_PCB091 && + strcmp(name, "luton_pcb091") == 0) + return 0; + + return -1; +} +#endif + +#if defined(CONFIG_DTB_RESELECT) +int embedded_dtb_select(void) +{ + do_board_detect(); + fdtdec_setup(); + + return 0; +} +#endif diff --git a/board/mscc/ocelot/ocelot.c b/board/mscc/ocelot/ocelot.c index d521a61957..a557cacd1b 100644 --- a/board/mscc/ocelot/ocelot.c +++ b/board/mscc/ocelot/ocelot.c @@ -12,16 +12,18 @@ DECLARE_GLOBAL_DATA_PTR; -#define MSCC_GPIO_ALT0 0x54 -#define MSCC_GPIO_ALT1 0x58 +enum { + BOARD_TYPE_PCB120 = 0xAABBCC00, + BOARD_TYPE_PCB123, +}; void external_cs_manage(struct udevice *dev, bool enable) { u32 cs = spi_chip_select(dev); /* IF_SI0_OWNER, select the owner of the SI interface * Encoding: 0: SI Slave - * 1: SI Boot Master - * 2: SI Master Controller + * 1: SI Boot Master + * 2: SI Master Controller */ if (!enable) { writel(ICPU_SW_MODE_SW_PIN_CTRL_MODE | @@ -40,8 +42,8 @@ void external_cs_manage(struct udevice *dev, bool enable) void board_debug_uart_init(void) { /* too early for the pinctrl driver, so configure the UART pins here */ - setbits_le32(BASE_DEVCPU_GCB + MSCC_GPIO_ALT0, BIT(6) | BIT(7)); - clrbits_le32(BASE_DEVCPU_GCB + MSCC_GPIO_ALT1, BIT(6) | BIT(7)); + mscc_gpio_set_alternate(6, 1); + mscc_gpio_set_alternate(7, 1); } int board_early_init_r(void) @@ -56,3 +58,41 @@ int board_early_init_r(void) gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE; return 0; } + +static void do_board_detect(void) +{ + u16 dummy = 0; + + /* Enable MIIM */ + mscc_gpio_set_alternate(14, 1); + mscc_gpio_set_alternate(15, 1); + if (mscc_phy_rd(1, 0, 0, &dummy) == 0) + gd->board_type = BOARD_TYPE_PCB120; + else + gd->board_type = BOARD_TYPE_PCB123; +} + +#if defined(CONFIG_MULTI_DTB_FIT) +int board_fit_config_name_match(const char *name) +{ + if (gd->board_type == BOARD_TYPE_PCB120 && + strcmp(name, "ocelot_pcb120") == 0) + return 0; + + if (gd->board_type == BOARD_TYPE_PCB123 && + strcmp(name, "ocelot_pcb123") == 0) + return 0; + + return -1; +} +#endif + +#if defined(CONFIG_DTB_RESELECT) +int embedded_dtb_select(void) +{ + do_board_detect(); + fdtdec_setup(); + + return 0; +} +#endif |