]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
mips: mscc: luton+ocelot: Remove board config options, do probing
authorLars Povlsen <lars.povlsen@microchip.com>
Thu, 20 Dec 2018 08:56:05 +0000 (09:56 +0100)
committerDaniel Schwierzeck <daniel.schwierzeck@gmail.com>
Wed, 16 Jan 2019 12:56:43 +0000 (13:56 +0100)
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>
arch/mips/dts/Makefile
arch/mips/mach-mscc/Kconfig
arch/mips/mach-mscc/include/mach/luton/luton_devcpu_gcb.h
board/mscc/luton/luton.c
board/mscc/ocelot/ocelot.c
configs/mscc_luton_defconfig
configs/mscc_ocelot_defconfig
configs/mscc_ocelot_pcb120_defconfig [deleted file]
include/configs/vcoreiii.h

index 647d2bf0d53bedfd67e15981c672cf4687dd8809..b61afe6504b092c93b1308373c17a9d4cd7fbdce 100644 (file)
@@ -17,6 +17,8 @@ dtb-$(CONFIG_BOARD_NETGEAR_DGND3700V2) += netgear,dgnd3700v2.dtb
 dtb-$(CONFIG_BOARD_SAGEM_FAST1704) += sagem,f@st1704.dtb
 dtb-$(CONFIG_BOARD_TPLINK_WDR4300) += tplink_wdr4300.dtb
 dtb-$(CONFIG_TARGET_JZ4780_CI20) += ci20.dtb
+dtb-$(CONFIG_SOC_LUTON) += luton_pcb090.dtb luton_pcb091.dtb
+dtb-$(CONFIG_SOC_OCELOT) += ocelot_pcb120.dtb ocelot_pcb123.dtb
 
 targets += $(dtb-y)
 
index 0e35b77c9db9c24a2bd9a39ef2f601ee35da76b4..37ef432e48f850967fa0afbc84f2a97cd8eefa11 100644 (file)
@@ -15,47 +15,29 @@ config SOC_VCOREIII
 config SYS_SOC
        default "mscc"
 
+choice
+
+       prompt "SOC Family Variant"
+
 config SOC_OCELOT
-       bool
+       bool "Ocelot SOC Family"
        select SOC_VCOREIII
+       select DESIGNWARE_SPI
        help
          This supports MSCC Ocelot family of SOCs.
 
 config SOC_LUTON
-       bool
+       bool "Luton SOC Family"
        select SOC_VCOREIII
+       select MSCC_BITBANG_SPI_GPIO
        help
          This supports MSCC Luton family of SOCs.
 
+endchoice
+
 config SYS_CONFIG_NAME
        default "vcoreiii"
 
-choice
-       prompt "Board select"
-
-config TARGET_OCELOT_PCB120
-       bool "MSCC PCB120 Reference Board (aka VSC5635EV)"
-       select SOC_OCELOT
-       help
-         When selected, CONFIG_DEFAULT_DEVICE_TREE should be set to
-         ocelot_pcb120
-
-config TARGET_OCELOT_PCB123
-       bool "MSCC PCB123 Reference Board (aka VSC7514EV))"
-       select SOC_OCELOT
-       help
-         When selected, CONFIG_DEFAULT_DEVICE_TREE should be set to
-         ocelot_pcb123
-
-config TARGET_LUTON_PCB091
-       bool "MSCC PCB091 Reference Board"
-       select SOC_LUTON
-       select MSCC_BITBANG_SPI_GPIO
-       help
-         When selected, CONFIG_DEFAULT_DEVICE_TREE should be set to
-         luton_pcb091
-endchoice
-
 choice
        prompt "DDR type"
 
index a06cf819b092bad58c64b6ecffe10a31e599ffb2..a74a68593d27e7fca68938257bedebe14b5855d7 100644 (file)
@@ -13,4 +13,6 @@
 
 #define GPIO_ALT(x)                            (0x88 + 4 * (x))
 
+#define CHIP_ID                                        (0x08)
+
 #endif
index 41fc6d56a7dbc0788ccc13bae0fdb8389118623f..b509b6beb3381cc56f48884804ab43dc6f7f9b57 100644 (file)
@@ -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
index d521a619576641ad2d084ffeec3a02bb6d0c54e2..a557cacd1b8dd250fd25db64ea235afceaef7e1a 100644 (file)
 
 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
index d7476c48633ed98d516bbcd9ceff65767cc8331d..03922f537992c080bb1cc5f409b2a9797f69b72b 100644 (file)
@@ -5,7 +5,7 @@ CONFIG_DEBUG_UART_BOARD_INIT=y
 CONFIG_DEBUG_UART_BASE=0x70100000
 CONFIG_DEBUG_UART_CLOCK=208333333
 CONFIG_ARCH_MSCC=y
-CONFIG_TARGET_LUTON_PCB091=y
+CONFIG_SOC_LUTON=y
 CONFIG_DDRTYPE_MT47H128M8HQ=y
 CONFIG_SYS_LITTLE_ENDIAN=y
 CONFIG_MIPS_BOOT_FDT=y
@@ -16,7 +16,7 @@ CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="console=ttyS0,115200"
 CONFIG_LOGLEVEL=7
 CONFIG_DISPLAY_CPUINFO=y
-CONFIG_SYS_PROMPT="pcb091 # "
+CONFIG_SYS_PROMPT="luton # "
 # CONFIG_CMD_BDI is not set
 # CONFIG_CMD_CONSOLE is not set
 # CONFIG_CMD_ELF is not set
@@ -39,6 +39,9 @@ CONFIG_MTDIDS_DEFAULT="nor0=spi_flash"
 CONFIG_MTDPARTS_DEFAULT="mtdparts=spi_flash:512k(UBoot),256k(Env),256k(conf),6m@1m(linux)"
 # CONFIG_ISO_PARTITION is not set
 CONFIG_DEFAULT_DEVICE_TREE="luton_pcb091"
+CONFIG_OF_LIST="luton_pcb090 luton_pcb091"
+CONFIG_DTB_RESELECT=y
+CONFIG_MULTI_DTB_FIT=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_CLK=y
index 5fa74db2ff5e2364c0c964de0b1971d3833d3859..66451000d9a990f3ddd0ac3dc0f31c8fba040ab2 100644 (file)
@@ -5,7 +5,6 @@ CONFIG_DEBUG_UART_BOARD_INIT=y
 CONFIG_DEBUG_UART_BASE=0x70100000
 CONFIG_DEBUG_UART_CLOCK=250000000
 CONFIG_ARCH_MSCC=y
-CONFIG_TARGET_OCELOT_PCB123=y
 CONFIG_SYS_LITTLE_ENDIAN=y
 CONFIG_DEBUG_UART=y
 CONFIG_FIT=y
@@ -14,7 +13,7 @@ CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="console=ttyS0,115200"
 CONFIG_LOGLEVEL=7
 CONFIG_DISPLAY_CPUINFO=y
-CONFIG_SYS_PROMPT="pcb123 # "
+CONFIG_SYS_PROMPT="ocelot # "
 # CONFIG_CMD_BDI is not set
 # CONFIG_CMD_CONSOLE is not set
 # CONFIG_CMD_ELF is not set
@@ -40,6 +39,9 @@ CONFIG_CMD_UBI=y
 # CONFIG_CMD_UBIFS is not set
 # CONFIG_ISO_PARTITION is not set
 CONFIG_DEFAULT_DEVICE_TREE="ocelot_pcb123"
+CONFIG_OF_LIST="ocelot_pcb120 ocelot_pcb123"
+CONFIG_DTB_RESELECT=y
+CONFIG_MULTI_DTB_FIT=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_CLK=y
@@ -63,5 +65,4 @@ CONFIG_DEBUG_UART_ANNOUNCE=y
 CONFIG_SYS_NS16550=y
 CONFIG_SPI=y
 CONFIG_DM_SPI=y
-CONFIG_DESIGNWARE_SPI=y
 CONFIG_LZMA=y
diff --git a/configs/mscc_ocelot_pcb120_defconfig b/configs/mscc_ocelot_pcb120_defconfig
deleted file mode 100644 (file)
index c5a9f96..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-CONFIG_MIPS=y
-CONFIG_SYS_TEXT_BASE=0x40000000
-CONFIG_SYS_MALLOC_F_LEN=0x2000
-CONFIG_ARCH_MSCC=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="pcb120 # "
-# 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_MTD=y
-CONFIG_CMD_SF=y
-CONFIG_CMD_SPI=y
-CONFIG_CMD_DHCP=y
-# CONFIG_NET_TFTP_VARS is not set
-# CONFIG_CMD_NFS is not set
-CONFIG_CMD_PING=y
-CONFIG_CMD_MTDPARTS=y
-CONFIG_MTDIDS_DEFAULT="nor0=spi_flash"
-CONFIG_MTDPARTS_DEFAULT="mtdparts=spi_flash:512k(UBoot),256k(Env),256k(conf),15m(linux),15m(linux.bk)"
-CONFIG_CMD_UBI=y
-# CONFIG_CMD_UBIFS is not set
-# CONFIG_ISO_PARTITION is not set
-CONFIG_DEFAULT_DEVICE_TREE="ocelot_pcb120"
-CONFIG_ENV_IS_IN_SPI_FLASH=y
-CONFIG_NET_RANDOM_ETHADDR=y
-CONFIG_CLK=y
-CONFIG_DM_GPIO=y
-CONFIG_MTD=y
-CONFIG_MTD_SPI_NAND=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_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_DESIGNWARE_SPI=y
-CONFIG_LZMA=y
index df89cdaebf180c386ab474f52993fe1cf7f44525..4ea5f40ec5f2144af55e867b91dc898af7ad1278 100644 (file)
@@ -22,6 +22,8 @@
 #endif
 #define CONFIG_SYS_NS16550_CLK         CONFIG_SYS_MIPS_TIMER_FREQ
 
+#define CONFIG_BOARD_TYPES
+
 #if defined(CONFIG_ENV_IS_IN_SPI_FLASH) && !defined(CONFIG_ENV_OFFSET)
 #define CONFIG_ENV_OFFSET              (1024 * 1024)
 #define CONFIG_ENV_SIZE                        (256 * 1024)