Skip to contentSkip to conversation

dts: import stm32mp1 device tree from linux kernel

PATCH New Patrick Delaunay 2 participants 12 messages Jul 9, 2018 – Jul 20, 2018

Subsystems (9)
lore
Share & tools
lore
#0 lore raw

PATCH 1/6 dts: import stm32mp1 device tree from linux kernel

This patch rebase the stm32mp1 device tree source from linux kernel v4.18-rc1.

---

 arch/arm/dts/stm32mp15-ddr.dtsi                    |  12 +-
 arch/arm/dts/stm32mp157-pinctrl.dtsi               | 359 ++++++++
 arch/arm/dts/stm32mp157-u-boot.dtsi                |  20 +-
 arch/arm/dts/stm32mp157.dtsi                       | 380 ---------
 arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi           |   2 +-
 arch/arm/dts/stm32mp157c-ed1.dts                   | 156 +---
 arch/arm/dts/stm32mp157c.dtsi                      | 935 +++++++++++++++++++++
 include/dt-bindings/clock/stm32mp1-clks.h          | 445 +++++-----
 include/dt-bindings/pinctrl/stm32-pinfunc.h        |   6 +
 .../dt-bindings/reset-controller/stm32mp1-resets.h |  97 ---
 include/dt-bindings/reset/stm32mp1-resets.h        | 108 +++
 11 files changed, 1676 insertions(+), 844 deletions(-)
 create mode 100644 arch/arm/dts/stm32mp157-pinctrl.dtsi
 delete mode 100644 arch/arm/dts/stm32mp157.dtsi
 create mode 100644 arch/arm/dts/stm32mp157c.dtsi
 delete mode 100644 include/dt-bindings/reset-controller/stm32mp1-resets.h
 create mode 100644 include/dt-bindings/reset/stm32mp1-resets.h
arch/arm/dts/stm32mp15-ddr.dtsi +6 -6
index 094f842..4172c02 100644
@@ -13,12 +13,12 @@
 			reg = <0x5A003000 0x550
 			       0x5A004000 0x234>;
 
-			clocks = <&rcc_clk AXIDCG>,
-				 <&rcc_clk DDRC1>,
-				 <&rcc_clk DDRC2>,
-				 <&rcc_clk DDRPHYC>,
-				 <&rcc_clk DDRCAPB>,
-				 <&rcc_clk DDRPHYCAPB>;
+			clocks = <&rcc AXIDCG>,
+				 <&rcc DDRC1>,
+				 <&rcc DDRC2>,
+				 <&rcc DDRPHYC>,
+				 <&rcc DDRCAPB>,
+				 <&rcc DDRPHYCAPB>;
 
 			clock-names = "axidcg",
 				      "ddrc1",
arch/arm/dts/stm32mp157-pinctrl.dtsi new file +359 -0

359 lines not on this page · raw message

arch/arm/dts/stm32mp157-u-boot.dtsi +6 -14
index fa9fd29..90d13f3 100644
@@ -29,13 +29,13 @@
 
 	soc {
 		u-boot,dm-pre-reloc;
-	};
 
-	stgen: stgen at 5C008000 {
-		compatible = "st,stm32-stgen";
-		reg = <0x5C008000 0x1000>;
-		status = "okay";
-		u-boot,dm-pre-reloc;
+		stgen: stgen at 5C008000 {
+			compatible = "st,stm32-stgen";
+			reg = <0x5C008000 0x1000>;
+			status = "okay";
+			u-boot,dm-pre-reloc;
+		};
 	};
 };
 
@@ -63,14 +63,6 @@
 	u-boot,dm-pre-reloc;
 };
 
-&rcc_clk {
-	u-boot,dm-pre-reloc;
-};
-
-&rcc_rst {
-	u-boot,dm-pre-reloc;
-};
-
 &rcc_reboot {
 	u-boot,dm-pre-reloc;
 };
arch/arm/dts/stm32mp157.dtsi deleted +0 -380

380 lines not on this page · raw message

arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi +1 -1
index 5b8be93..f6d1528 100644
@@ -45,7 +45,7 @@
 };
 
 /* CLOCK init */
-&rcc_clk {
+&rcc {
 	st,clksrc = <
 		CLK_MPU_PLL1P
 		CLK_AXI_PLL2P
arch/arm/dts/stm32mp157c-ed1.dts +27 -129

207 lines not on this page · raw message

arch/arm/dts/stm32mp157c.dtsi new file +935 -0

935 lines not on this page · raw message

include/dt-bindings/clock/stm32mp1-clks.h +228 -217

471 lines not on this page · raw message

include/dt-bindings/pinctrl/stm32-pinfunc.h +6 -0
index b8dfe31..b5a2174 100644
@@ -1,3 +1,9 @@
+/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
+/*
+ * Copyright (C) STMicroelectronics 2017 - All Rights Reserved
+ * Author: Torgue Alexandre <[email protected]> for STMicroelectronics.
+ */
+
 #ifndef _DT_BINDINGS_STM32_PINFUNC_H
 #define _DT_BINDINGS_STM32_PINFUNC_H
 
include/dt-bindings/reset-controller/stm32mp1-resets.h deleted +0 -97

97 lines not on this page · raw message

include/dt-bindings/reset/stm32mp1-resets.h new file +108 -0

108 lines not on this page · raw message

Signature · 1 line
2.7.4
#1 lore raw

PATCH 2/6 misc: stm32: Add STM32MP1 support

Following next kernel rcc bindings, we must use a MFD RCC driver which is able to bind both clock and reset drivers.

We can reuse and adapt RCC MFD driver already available for MCU SoCs (F4/F7/H7).

---

 arch/arm/mach-stm32mp/Kconfig |  1 +
 drivers/clk/clk_stm32mp1.c    |  6 ------
 drivers/misc/Kconfig          |  2 +-
 drivers/misc/stm32_rcc.c      | 19 +++++++++++++++----
 drivers/reset/stm32-reset.c   | 16 +++-------------
 include/stm32_rcc.h           |  1 +
 6 files changed, 21 insertions(+), 24 deletions(-)
arch/arm/mach-stm32mp/Kconfig +1 -0
index abceede..aa26999 100644
@@ -29,6 +29,7 @@ config TARGET_STM32MP1
 	select CPU_V7_HAS_NONSEC
 	select CPU_V7_HAS_VIRT
 	select PINCTRL_STM32
+	select STM32_RCC
 	select STM32_RESET
 	select SYS_ARCH_TIMER
 	select SYSRESET_SYSCON
drivers/clk/clk_stm32mp1.c +0 -6
index 1a77eba..af7d05f 100644
@@ -1764,15 +1764,9 @@ static const struct clk_ops stm32mp1_clk_ops = {
 	.get_rate = stm32mp1_clk_get_rate,
 };
 
-static const struct udevice_id stm32mp1_clk_ids[] = {
-	{ .compatible = "st,stm32mp1-rcc-clk" },
-	{ }
-};
-
 U_BOOT_DRIVER(stm32mp1_clock) = {
 	.name = "stm32mp1_clk",
 	.id = UCLASS_CLK,
-	.of_match = stm32mp1_clk_ids,
 	.ops = &stm32mp1_clk_ops,
 	.priv_auto_alloc_size = sizeof(struct stm32mp1_clk_priv),
 	.probe = stm32mp1_clk_probe,
drivers/misc/Kconfig +1 -1
index 17b3a80..c031dfd 100644
@@ -169,7 +169,7 @@ config STM32MP_FUSE
 
 config STM32_RCC
 	bool "Enable RCC driver for the STM32 SoC's family"
-	depends on STM32 && MISC
+	depends on (STM32 || ARCH_STM32MP) && MISC
 	help
 	  Enable the STM32 RCC driver. The RCC block (Reset and Clock Control
 	  block) is responsible of the management of the clock and reset
drivers/misc/stm32_rcc.c +15 -4
index 980b3a5..13d7069 100644
@@ -30,6 +30,11 @@ struct stm32_rcc_clk stm32_rcc_clk_h7 = {
 	.drv_name = "stm32h7_rcc_clock",
 };
 
+struct stm32_rcc_clk stm32_rcc_clk_mp1 = {
+	.drv_name = "stm32mp1_clk",
+	.soc = STM32MP1,
+};
+
 static int stm32_rcc_bind(struct udevice *dev)
 {
 	struct udevice *child;
@@ -39,7 +44,6 @@ static int stm32_rcc_bind(struct udevice *dev)
 	int ret;
 
 	debug("%s(dev=%p)\n", __func__, dev);
-
 	drv = lists_driver_lookup_name(rcc_clk->drv_name);
 	if (!drv) {
 		debug("Cannot find driver '%s'\n", rcc_clk->drv_name);
@@ -53,9 +57,15 @@ static int stm32_rcc_bind(struct udevice *dev)
 	if (ret)
 		return ret;
 
-	return device_bind_driver_to_node(dev, "stm32_rcc_reset",
-					  "stm32_rcc_reset",
-					  dev_ofnode(dev), &child);
+	drv = lists_driver_lookup_name("stm32_rcc_reset");
+	if (!drv) {
+		dev_err(dev, "Cannot find driver stm32_rcc_reset'\n");
+		return -ENOENT;
+	}
+
+	return device_bind_with_driver_data(dev, drv, "stm32_rcc_reset",
+					    rcc_clk->soc,
+					    dev_ofnode(dev), &child);
 }
 
 static const struct misc_ops stm32_rcc_ops = {
@@ -66,6 +76,7 @@ static const struct udevice_id stm32_rcc_ids[] = {
 	{.compatible = "st,stm32f469-rcc", .data = (ulong)&stm32_rcc_clk_f469 },
 	{.compatible = "st,stm32f746-rcc", .data = (ulong)&stm32_rcc_clk_f7 },
 	{.compatible = "st,stm32h743-rcc", .data = (ulong)&stm32_rcc_clk_h7 },
+	{.compatible = "st,stm32mp1-rcc", .data = (ulong)&stm32_rcc_clk_mp1 },
 	{ }
 };
 
drivers/reset/stm32-reset.c +3 -13
index c21ede2..16d3dba 100644
@@ -8,16 +8,12 @@
 #include <dm.h>
 #include <errno.h>
 #include <reset-uclass.h>
+#include <stm32_rcc.h>
 #include <asm/io.h>
 
 /* reset clear offset for STM32MP RCC */
 #define RCC_CL 0x4
 
-enum rcc_type {
-	RCC_STM32 = 0,
-	RCC_STM32MP,
-};
-
 struct stm32_reset_priv {
 	fdt_addr_t base;
 };
@@ -40,7 +36,7 @@ static int stm32_reset_assert(struct reset_ctl *reset_ctl)
 	debug("%s: reset id = %ld bank = %d offset = %d)\n", __func__,
 	      reset_ctl->id, bank, offset);
 
-	if (dev_get_driver_data(reset_ctl->dev) == RCC_STM32MP)
+	if (dev_get_driver_data(reset_ctl->dev) == STM32MP1)
 		/* reset assert is done in rcc set register */
 		writel(BIT(offset), priv->base + bank);
 	else
@@ -57,7 +53,7 @@ static int stm32_reset_deassert(struct reset_ctl *reset_ctl)
 	debug("%s: reset id = %ld bank = %d offset = %d)\n", __func__,
 	      reset_ctl->id, bank, offset);
 
-	if (dev_get_driver_data(reset_ctl->dev) == RCC_STM32MP)
+	if (dev_get_driver_data(reset_ctl->dev) == STM32MP1)
 		/* reset deassert is done in rcc clr register */
 		writel(BIT(offset), priv->base + bank + RCC_CL);
 	else
@@ -88,15 +84,9 @@ static int stm32_reset_probe(struct udevice *dev)
 	return 0;
 }
 
-static const struct udevice_id stm32_reset_ids[] = {
-	{ .compatible = "st,stm32mp1-rcc-rst", .data = RCC_STM32MP },
-	{ }
-};
-
 U_BOOT_DRIVER(stm32_rcc_reset) = {
 	.name			= "stm32_rcc_reset",
 	.id			= UCLASS_RESET,
-	.of_match		= stm32_reset_ids,
 	.probe			= stm32_reset_probe,
 	.priv_auto_alloc_size	= sizeof(struct stm32_reset_priv),
 	.ops			= &stm32_reset_ops,
include/stm32_rcc.h +1 -0
index 71da3c1..a09a09f 100644
@@ -43,6 +43,7 @@ enum soc_family {
 	STM32F42X,
 	STM32F469,
 	STM32F7,
+	STM32MP1,
 };
 
 enum apb {
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/6 misc: stm32: Add STM32MP1 support

Quoted 9 lines · Patrick Delaunay

Following next kernel rcc bindings, we must use a MFD RCC driver which is able to bind both clock and reset drivers.

We can reuse and adapt RCC MFD driver already available for MCU SoCs (F4/F7/H7).

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180720/d03c0b1b/attachment.sig>
#3 lore raw

PATCH 3/6 stm32mp1: activate MISC support in SPL

In reply to Patrick Delaunay

needed for RCC MISC driver and sysreset with syscon in SPL

---

 arch/arm/mach-stm32mp/Kconfig | 1 +
 1 file changed, 1 insertion(+)
arch/arm/mach-stm32mp/Kconfig +1 -0
index aa26999..5b24235 100644
@@ -5,6 +5,7 @@ config SPL
 	select SPL_CLK
 	select SPL_DM
 	select SPL_DM_SEQ_ALIAS
+	select SPL_DRIVERS_MISC_SUPPORT
 	select SPL_FRAMEWORK
 	select SPL_GPIO_SUPPORT
 	select SPL_LIBCOMMON_SUPPORT
Signature · 1 line
2.7.4
#4 lore raw

PATCH 3/6 stm32mp1: activate MISC support in SPL

Quoted 4 lines · Patrick Delaunay

needed for RCC MISC driver and sysreset with syscon in SPL

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180720/c14e926c/attachment.sig>
#5 lore raw

PATCH 4/6 stm32mp1: add support for stm32mp157c-ev1 board

In reply to Patrick Delaunay

Add support of stm32mp157c-ev1, the evaluation board with pmic stpmu1 (ev1 = mother board + daughter ed1) with device tree.
EV1 is the selected board by default in basic defconfig.

PS: CONFIG_PINCTRL_FULL activation avoid to increase
SYS_MALLOC_F_LEN (Early malloc usage: 2034)

---

 arch/arm/dts/Makefile                    |   3 +-
 arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi |  62 +++++++++++++++++++
 arch/arm/dts/stm32mp157c-ev1.dts         | 101 +++++++++++++++++++++++++++++++
 board/st/stm32mp1/README                 |  53 ++++++++++++++--
 configs/stm32mp15_basic_defconfig        |   3 +-
 5 files changed, 215 insertions(+), 7 deletions(-)
 create mode 100644 arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi
 create mode 100644 arch/arm/dts/stm32mp157c-ev1.dts
arch/arm/dts/Makefile +2 -1
index 64f6d21..2d74d3a 100644
@@ -533,7 +533,8 @@ dtb-$(CONFIG_ARCH_ASPEED) += ast2500-evb.dtb
 dtb-$(CONFIG_ARCH_STI) += stih410-b2260.dtb
 
 dtb-$(CONFIG_TARGET_STM32MP1) += \
-	stm32mp157c-ed1.dtb
+	stm32mp157c-ed1.dtb \
+	stm32mp157c-ev1.dtb
 
 targets += $(dtb-y)
 
arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi new file +62 -0

62 lines not on this page · raw message

arch/arm/dts/stm32mp157c-ev1.dts new file +101 -0

101 lines not on this page · raw message

board/st/stm32mp1/README +48 -5

94 lines not on this page · raw message

configs/stm32mp15_basic_defconfig +2 -1
index 3a94db5..87f60be 100644
@@ -4,7 +4,7 @@ CONFIG_SYS_MALLOC_F_LEN=0x2000
 CONFIG_SPL_MMC_SUPPORT=y
 CONFIG_SPL=y
 CONFIG_TARGET_STM32MP1=y
-CONFIG_DEFAULT_DEVICE_TREE="stm32mp157c-ed1"
+CONFIG_DEFAULT_DEVICE_TREE="stm32mp157c-ev1"
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION=3
@@ -31,6 +31,7 @@ CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_STM32F7=y
 CONFIG_DM_MMC=y
 CONFIG_STM32_SDMMC2=y
+# CONFIG_PINCTRL_FULL is not set
 # CONFIG_SPL_PINCTRL_FULL is not set
 CONFIG_DM_PMIC=y
 # CONFIG_SPL_PMIC_CHILDREN is not set
Signature · 1 line
2.7.4
#6 lore raw

PATCH 4/6 stm32mp1: add support for stm32mp157c-ev1 board

Quoted 8 lines · Patrick Delaunay

Add support of stm32mp157c-ev1, the evaluation board with pmic stpmu1 (ev1 = mother board + daughter ed1) with device tree.
EV1 is the selected board by default in basic defconfig.

PS: CONFIG_PINCTRL_FULL activation avoid to increase
SYS_MALLOC_F_LEN (Early malloc usage: 2034)

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180720/4a0ac544/attachment.sig>
#7 lore raw

PATCH 5/6 stm32mp1: activate FIXED regulator

In reply to Patrick Delaunay

---

 configs/stm32mp15_basic_defconfig | 1 +
 1 file changed, 1 insertion(+)
configs/stm32mp15_basic_defconfig +1 -0
index 87f60be..c72a440 100644
@@ -37,6 +37,7 @@ CONFIG_DM_PMIC=y
 # CONFIG_SPL_PMIC_CHILDREN is not set
 CONFIG_PMIC_STPMU1=y
 CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_FIXED=y
 CONFIG_DM_REGULATOR_GPIO=y
 CONFIG_DM_REGULATOR_STM32_VREFBUF=y
 CONFIG_DM_REGULATOR_STPMU1=y
Signature · 1 line
2.7.4
#8 lore raw

PATCH 5/6 stm32mp1: activate FIXED regulator

Quoted 1 line · Patrick Delaunay

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180720/c5925683/attachment.sig>
#9 lore raw

PATCH 6/6 stm32mp1: clock tree update

In reply to Patrick Delaunay

Configure clock tree for all the devices.

---

 arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi | 46 ++++++++++++++++++++++++--------
 1 file changed, 35 insertions(+), 11 deletions(-)
arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi +35 -11
index f6d1528..39a0ebc 100644
@@ -73,18 +73,41 @@
 	>;
 
 	st,pkcs = <
-		CLK_CKPER_DISABLED
+		CLK_CKPER_HSE
+		CLK_FMC_ACLK
+		CLK_QSPI_ACLK
+		CLK_ETH_DISABLED
 		CLK_SDMMC12_PLL3R
+		CLK_DSI_DSIPLL
 		CLK_STGEN_HSE
-		CLK_I2C46_PCLK5
-		CLK_I2C12_PCLK1
+		CLK_USBPHY_HSE
+		CLK_SPI2S1_PLL3Q
+		CLK_SPI2S23_PLL3Q
+		CLK_SPI45_HSI
+		CLK_SPI6_HSI
+		CLK_I2C46_HSI
 		CLK_SDMMC3_PLL3R
-		CLK_I2C35_PCLK1
-		CLK_UART1_PCLK5
-		CLK_UART24_PCLK1
-		CLK_UART35_PCLK1
-		CLK_UART6_PCLK2
-		CLK_UART78_PCLK1
+		CLK_USBO_USBPHY
+		CLK_ADC_CKPER
+		CLK_CEC_LSE
+		CLK_I2C12_HSI
+		CLK_I2C35_HSI
+		CLK_UART1_HSI
+		CLK_UART24_HSI
+		CLK_UART35_HSI
+		CLK_UART6_HSI
+		CLK_UART78_HSI
+		CLK_SPDIF_PLL3Q
+		CLK_FDCAN_PLL4Q
+		CLK_SAI1_PLL3Q
+		CLK_SAI2_PLL3Q
+		CLK_SAI3_PLL3Q
+		CLK_SAI4_PLL3Q
+		CLK_RNG1_CSI
+		CLK_RNG2_CSI
+		CLK_LPTIM1_PCLK1
+		CLK_LPTIM23_PCLK3
+		CLK_LPTIM45_PCLK3
 	>;
 
 	/* VCO = 1300.0 MHz => P = 650 (CPU) */
@@ -101,9 +124,10 @@
 		u-boot,dm-pre-reloc;
 	};
 
-	/* VCO = 774.0 MHz => P = 194, Q = 37, R = 97 */
+	/* VCO = 786.4 MHz => P = 197, Q = 49, R = 98 */
 	pll3: st,pll at 2 {
-		cfg = < 3 128 3 20 7 PQR(1,1,1) >;
+		cfg = < 2 97 3 15 7 PQR(1,1,1) >;
+		frac = < 0x9ba >;
 		u-boot,dm-pre-reloc;
 	};
 
Signature · 1 line
2.7.4
#10 lore raw

PATCH 6/6 stm32mp1: clock tree update

Quoted 3 lines · Patrick Delaunay

Configure clock tree for all the devices.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180720/bcea1bc2/attachment.sig>
#11 lore raw

PATCH 1/6 dts: import stm32mp1 device tree from linux kernel

In reply to Patrick Delaunay
Quoted 4 lines · Patrick Delaunay

This patch rebase the stm32mp1 device tree source from linux kernel v4.18-rc1.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180720/1d8a80f5/attachment.sig>