From 0cf19c29a325c5d31fcb6984106ec3d4c75c0af9 Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum Date: Tue, 16 Mar 2021 09:59:04 +0100 Subject: ARM: stm32mp: add support for STM32MP157-EV1 board MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The STM32MP157A-EV1 and STM32MP157C-EV1 Evaluation boards are the full-feature demonstration and development platforms for STMicroelectronics Arm®-based dual Cortex®-A7 32 bits and Cortex®-M4 32 bits MPUs in the STM32MP1 Series. Add support for running barebox as SSBL on either of them. Signed-off-by: Ahmad Fatoum Signed-off-by: Sascha Hauer --- arch/arm/boards/Makefile | 1 + arch/arm/boards/stm32mp15x-ev1/Makefile | 2 ++ arch/arm/boards/stm32mp15x-ev1/board.c | 39 +++++++++++++++++++++++++++++++ arch/arm/boards/stm32mp15x-ev1/lowlevel.c | 26 +++++++++++++++++++++ arch/arm/configs/stm32mp_defconfig | 1 + arch/arm/dts/Makefile | 1 + arch/arm/dts/stm32mp157c-ev1.dts | 20 ++++++++++++++++ arch/arm/mach-stm32mp/Kconfig | 8 +++++++ 8 files changed, 98 insertions(+) create mode 100644 arch/arm/boards/stm32mp15x-ev1/Makefile create mode 100644 arch/arm/boards/stm32mp15x-ev1/board.c create mode 100644 arch/arm/boards/stm32mp15x-ev1/lowlevel.c create mode 100644 arch/arm/dts/stm32mp157c-ev1.dts (limited to 'arch') diff --git a/arch/arm/boards/Makefile b/arch/arm/boards/Makefile index f8cdd90ed6..732936bad6 100644 --- a/arch/arm/boards/Makefile +++ b/arch/arm/boards/Makefile @@ -134,6 +134,7 @@ obj-$(CONFIG_MACH_SOLIDRUN_CUBOX) += solidrun-cubox/ obj-$(CONFIG_MACH_SOLIDRUN_MICROSOM) += solidrun-microsom/ obj-$(CONFIG_MACH_STM32MP15XX_DKX) += stm32mp15xx-dkx/ obj-$(CONFIG_MACH_LXA_MC1) += lxa-mc1/ +obj-$(CONFIG_MACH_STM32MP15X_EV1) += stm32mp15x-ev1/ obj-$(CONFIG_MACH_TECHNEXION_PICO_HOBBIT) += technexion-pico-hobbit/ obj-$(CONFIG_MACH_TECHNEXION_WANDBOARD) += technexion-wandboard/ obj-$(CONFIG_MACH_TNY_A9260) += tny-a926x/ diff --git a/arch/arm/boards/stm32mp15x-ev1/Makefile b/arch/arm/boards/stm32mp15x-ev1/Makefile new file mode 100644 index 0000000000..092c31d6b2 --- /dev/null +++ b/arch/arm/boards/stm32mp15x-ev1/Makefile @@ -0,0 +1,2 @@ +lwl-y += lowlevel.o +obj-y += board.o diff --git a/arch/arm/boards/stm32mp15x-ev1/board.c b/arch/arm/boards/stm32mp15x-ev1/board.c new file mode 100644 index 0000000000..b8e26cd37b --- /dev/null +++ b/arch/arm/boards/stm32mp15x-ev1/board.c @@ -0,0 +1,39 @@ +// SPDX-License-Identifier: GPL-2.0+ + +#include +#include +#include +#include + +static int ed1_probe(struct device_d *dev) +{ + int flags; + + flags = bootsource_get_instance() == 0 ? BBU_HANDLER_FLAG_DEFAULT : 0; + stm32mp_bbu_mmc_register_handler("sd", "/dev/mmc0.ssbl", flags); + + flags = bootsource_get_instance() == 1 ? BBU_HANDLER_FLAG_DEFAULT : 0; + stm32mp_bbu_mmc_register_handler("emmc", "/dev/mmc1.ssbl", flags); + + if (bootsource_get_instance() == 0) + of_device_enable_path("/chosen/environment-sd"); + else + of_device_enable_path("/chosen/environment-emmc"); + + barebox_set_model("STM32MP157C-ED1"); + + return 0; +} + +/* ED1 is the SoM on top of the EV1 */ +static const struct of_device_id ed1_of_match[] = { + { .compatible = "st,stm32mp157c-ed1" }, + { /* sentinel */ }, +}; + +static struct driver_d ed1_board_driver = { + .name = "board-stm32mp15x-ed1", + .probe = ed1_probe, + .of_compatible = ed1_of_match, +}; +postcore_platform_driver(ed1_board_driver); diff --git a/arch/arm/boards/stm32mp15x-ev1/lowlevel.c b/arch/arm/boards/stm32mp15x-ev1/lowlevel.c new file mode 100644 index 0000000000..06ff6291b8 --- /dev/null +++ b/arch/arm/boards/stm32mp15x-ev1/lowlevel.c @@ -0,0 +1,26 @@ +// SPDX-License-Identifier: GPL-2.0+ +#include +#include +#include + +extern char __dtb_z_stm32mp157c_ev1_start[]; + +static void setup_uart(void) +{ + /* first stage has set up the UART, so nothing to do here */ + putc_ll('>'); +} + +ENTRY_FUNCTION(start_stm32mp15x_ev1, r0, r1, r2) +{ + void *fdt; + + stm32mp_cpu_lowlevel_init(); + + if (IS_ENABLED(CONFIG_DEBUG_LL)) + setup_uart(); + + fdt = __dtb_z_stm32mp157c_ev1_start + get_runtime_offset(); + + stm32mp1_barebox_entry(fdt); +} diff --git a/arch/arm/configs/stm32mp_defconfig b/arch/arm/configs/stm32mp_defconfig index e1ee4ec082..7b90002f87 100644 --- a/arch/arm/configs/stm32mp_defconfig +++ b/arch/arm/configs/stm32mp_defconfig @@ -2,6 +2,7 @@ CONFIG_ARCH_STM32MP=y CONFIG_MACH_STM32MP15XX_DKX=y CONFIG_MACH_LXA_MC1=y CONFIG_MACH_SEEED_ODYSSEY=y +CONFIG_MACH_STM32MP15X_EV1=y CONFIG_THUMB2_BAREBOX=y CONFIG_ARM_BOARD_APPEND_ATAG=y CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index 63bd73dfaa..d5f61768a5 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -113,6 +113,7 @@ lwl-$(CONFIG_MACH_SOLIDRUN_MICROSOM) += imx6dl-hummingboard.dtb.o imx6q-hummingb lwl-$(CONFIG_MACH_SEEED_ODYSSEY) += stm32mp157c-odyssey.dtb.o lwl-$(CONFIG_MACH_STM32MP15XX_DKX) += stm32mp157c-dk2.dtb.o stm32mp157a-dk1.dtb.o lwl-$(CONFIG_MACH_LXA_MC1) += stm32mp157c-lxa-mc1.dtb.o +lwl-$(CONFIG_MACH_STM32MP15X_EV1) += stm32mp157c-ev1.dtb.o lwl-$(CONFIG_MACH_SCB9328) += imx1-scb9328.dtb.o lwl-$(CONFIG_MACH_TECHNEXION_WANDBOARD) += imx6q-wandboard.dtb.o imx6dl-wandboard.dtb.o lwl-$(CONFIG_MACH_TECHNEXION_PICO_HOBBIT) += imx6ul-pico-hobbit.dtb.o diff --git a/arch/arm/dts/stm32mp157c-ev1.dts b/arch/arm/dts/stm32mp157c-ev1.dts new file mode 100644 index 0000000000..742eca7a33 --- /dev/null +++ b/arch/arm/dts/stm32mp157c-ev1.dts @@ -0,0 +1,20 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR X11) + +#include +#include "stm32mp151.dtsi" + +/ { + chosen { + environment-sd { + compatible = "barebox,environment"; + device-path = &sdmmc1, "partname:barebox-environment"; + status = "disabled"; + }; + + environment-emmc { + compatible = "barebox,environment"; + device-path = &sdmmc2, "partname:barebox-environment"; + status = "disabled"; + }; + }; +}; diff --git a/arch/arm/mach-stm32mp/Kconfig b/arch/arm/mach-stm32mp/Kconfig index b8ccbaab67..95d3dc510d 100644 --- a/arch/arm/mach-stm32mp/Kconfig +++ b/arch/arm/mach-stm32mp/Kconfig @@ -23,4 +23,12 @@ config MACH_SEEED_ODYSSEY select ARCH_STM32MP157 bool "Seeed Studio Odyssey" +config MACH_STM32MP15X_EV1 + select ARCH_STM32MP157 + bool "STM32MP15X-EV1 board" + help + builds a single barebox-stm32mp15x-ev1.img that can be deployed + as SSBL on any STM32MP15X-EVAL platform, like the + STM32MP157C-EV1 + endif -- cgit v1.2.3