stm32mp1: update package information in device tree
authorPatrick Delaunay <patrick.delaunay@st.com>
Fri, 5 Jul 2019 15:20:14 +0000 (17:20 +0200)
committerPatrick Delaunay <patrick.delaunay@st.com>
Fri, 12 Jul 2019 09:18:53 +0000 (11:18 +0200)
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
arch/arm/Kconfig
arch/arm/mach-stm32mp/Makefile
arch/arm/mach-stm32mp/fdt.c [new file with mode: 0644]

index f5a7630e4f99e62f33b4f4f2cbe37bb14eaf2d8a..6f9c2010ba839af95db4ce57c5371041e8840baf 100644 (file)
@@ -1488,6 +1488,7 @@ config ARCH_STM32MP
        select MISC
        select OF_CONTROL
        select OF_LIBFDT
+       select OF_SYSTEM_SETUP
        select PINCTRL
        select REGMAP
        select SUPPORT_SPL
index 1493914a110d3cc8be870017cc71521383a68dc8..e59bd819006f6d5cc7485ae957ec64fe58cdb9ea 100644 (file)
@@ -17,3 +17,4 @@ endif
 endif
 obj-$(CONFIG_ARMV7_PSCI) += psci.o
 obj-$(CONFIG_$(SPL_)DM_REGULATOR) += pwr_regulator.o
+obj-$(CONFIG_OF_SYSTEM_SETUP) += fdt.o
diff --git a/arch/arm/mach-stm32mp/fdt.c b/arch/arm/mach-stm32mp/fdt.c
new file mode 100644 (file)
index 0000000..c635353
--- /dev/null
@@ -0,0 +1,45 @@
+// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
+/*
+ * Copyright (C) 2019, STMicroelectronics - All Rights Reserved
+ */
+
+#include <common.h>
+#include <fdt_support.h>
+#include <asm/arch/sys_proto.h>
+#include <dt-bindings/pinctrl/stm32-pinfunc.h>
+
+/*
+ * This function is called right before the kernel is booted. "blob" is the
+ * device tree that will be passed to the kernel.
+ */
+int ft_system_setup(void *blob, bd_t *bd)
+{
+       int ret = 0;
+       u32 pkg;
+
+       switch (get_cpu_package()) {
+       case PKG_AA_LBGA448:
+               pkg = STM32MP_PKG_AA;
+               break;
+       case PKG_AB_LBGA354:
+               pkg = STM32MP_PKG_AB;
+               break;
+       case PKG_AC_TFBGA361:
+               pkg = STM32MP_PKG_AC;
+               break;
+       case PKG_AD_TFBGA257:
+               pkg = STM32MP_PKG_AD;
+               break;
+       default:
+               pkg = 0;
+               break;
+       }
+       if (pkg) {
+               do_fixup_by_compat_u32(blob, "st,stm32mp157-pinctrl",
+                                      "st,package", pkg, false);
+               do_fixup_by_compat_u32(blob, "st,stm32mp157-z-pinctrl",
+                                      "st,package", pkg, false);
+       }
+
+       return ret;
+}