drivers: ipm: set IPM_STM32_HSEM default from the device tree

Change IPM_STM32_HSEM Kconfig definition so that it picks the correct
default automatically depending on which cpu node is enabled in the
device tree, rather than relying on board specific Kconfig overrides.

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
diff --git a/boards/arm/stm32h747i_disco/Kconfig.defconfig b/boards/arm/stm32h747i_disco/Kconfig.defconfig
index f87aa3d..c8fa55a 100644
--- a/boards/arm/stm32h747i_disco/Kconfig.defconfig
+++ b/boards/arm/stm32h747i_disco/Kconfig.defconfig
@@ -12,14 +12,6 @@
 config STM32H7_DUAL_CORE
 	default y
 
-if IPM_STM32_HSEM
-
-config IPM_STM32_HSEM_CPU
-	default 1 if BOARD_STM32H747I_DISCO_M7
-	default 2 if BOARD_STM32H747I_DISCO_M4
-
-endif # IPM_STM32_HSEM
-
 if NETWORKING
 
 config NET_L2_ETHERNET
diff --git a/drivers/ipm/Kconfig b/drivers/ipm/Kconfig
index dc4b619..fe47738 100644
--- a/drivers/ipm/Kconfig
+++ b/drivers/ipm/Kconfig
@@ -120,7 +120,8 @@
 
 config IPM_STM32_HSEM_CPU
 	int "HSEM CPU ID"
-	default 1
+	default 1 if "$(dt_nodelabel_enabled,cpu0)"
+	default 2 if "$(dt_nodelabel_enabled,cpu1)"
 	range 1 2
 	depends on IPM_STM32_HSEM
 	help
diff --git a/dts/arm/st/h7/stm32h7.dtsi b/dts/arm/st/h7/stm32h7.dtsi
index 59023f2..e09c32a 100644
--- a/dts/arm/st/h7/stm32h7.dtsi
+++ b/dts/arm/st/h7/stm32h7.dtsi
@@ -24,7 +24,7 @@
 		#address-cells = <1>;
 		#size-cells = <0>;
 
-		cpu@0 {
+		cpu0: cpu@0 {
 			device_type = "cpu";
 			compatible = "arm,cortex-m7";
 			reg = <0>;
diff --git a/dts/arm/st/h7/stm32h7_dualcore.dtsi b/dts/arm/st/h7/stm32h7_dualcore.dtsi
index 3e52b93..941abf1 100644
--- a/dts/arm/st/h7/stm32h7_dualcore.dtsi
+++ b/dts/arm/st/h7/stm32h7_dualcore.dtsi
@@ -8,7 +8,7 @@
 
 / {
 	cpus {
-		cpu@1 {
+		cpu1: cpu@1 {
 			device_type = "cpu";
 			compatible = "arm,cortex-m4f";
 			reg = <1>;