All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 1/2] ARM: i.MX8MM: split barebox dts into dtsi file
@ 2023-01-19 15:56 Marco Felsch
  2023-01-19 15:56 ` [PATCH v3 2/2] ARM: i.MX8MM: add support for 8MMINILPD4-CPU2 board Marco Felsch
  2023-01-25  8:05 ` [PATCH v3 1/2] ARM: i.MX8MM: split barebox dts into dtsi file Sascha Hauer
  0 siblings, 2 replies; 3+ messages in thread
From: Marco Felsch @ 2023-01-19 15:56 UTC (permalink / raw)
  To: barebox, johannes.schneider

Move the dts file into a dtsi file. This is in preparation for the
imx8mm-evkb support which will reuse the config. No functional change.

Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
v3:
- new in this series

 arch/arm/dts/imx8mm-evk.dts  | 54 +--------------------------------
 arch/arm/dts/imx8mm-evk.dtsi | 58 ++++++++++++++++++++++++++++++++++++
 2 files changed, 59 insertions(+), 53 deletions(-)
 create mode 100644 arch/arm/dts/imx8mm-evk.dtsi

diff --git a/arch/arm/dts/imx8mm-evk.dts b/arch/arm/dts/imx8mm-evk.dts
index 3ced5a934c..abe0a2e450 100644
--- a/arch/arm/dts/imx8mm-evk.dts
+++ b/arch/arm/dts/imx8mm-evk.dts
@@ -8,56 +8,4 @@
 
 #include <arm64/freescale/imx8mm-evk.dts>
 #include "imx8mm.dtsi"
-
-/ {
-	chosen {
-		environment-sd {
-			compatible = "barebox,environment";
-			device-path = &env_sd2;
-			status = "disabled";
-		};
-		environment-emmc {
-			compatible = "barebox,environment";
-			device-path = &env_sd3;
-			status = "disabled";
-		};
-	};
-};
-
-&reg_usdhc2_vmmc {
-	off-on-delay-us = <20000>;
-};
-
-&usdhc2 {
-	#address-cells = <1>;
-	#size-cells = <1>;
-
-	partition@0 {
-		label = "barebox";
-		reg = <0x0 0xe0000>;
-	};
-
-	env_sd2: partition@e0000 {
-		label = "barebox-environment";
-		reg = <0xe0000 0x20000>;
-	};
-};
-
-&usdhc3 {
-	#address-cells = <1>;
-	#size-cells = <1>;
-
-	partition@0 {
-		label = "barebox";
-		reg = <0x0 0xe0000>;
-	};
-
-	env_sd3: partition@e0000 {
-		label = "barebox-environment";
-		reg = <0xe0000 0x20000>;
-	};
-};
-
-&ocotp {
-	barebox,provide-mac-address = <&fec1 0x640>;
-};
+#include "imx8mm-evk.dtsi"
diff --git a/arch/arm/dts/imx8mm-evk.dtsi b/arch/arm/dts/imx8mm-evk.dtsi
new file mode 100644
index 0000000000..4d64dcad1c
--- /dev/null
+++ b/arch/arm/dts/imx8mm-evk.dtsi
@@ -0,0 +1,58 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright 2017 NXP
+ * Copyright (C) 2017 Pengutronix, Lucas Stach <kernel@pengutronix.de>
+ */
+
+/ {
+	chosen {
+		environment-sd {
+			compatible = "barebox,environment";
+			device-path = &env_sd2;
+			status = "disabled";
+		};
+		environment-emmc {
+			compatible = "barebox,environment";
+			device-path = &env_sd3;
+			status = "disabled";
+		};
+	};
+};
+
+&reg_usdhc2_vmmc {
+	off-on-delay-us = <20000>;
+};
+
+&usdhc2 {
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	partition@0 {
+		label = "barebox";
+		reg = <0x0 0xe0000>;
+	};
+
+	env_sd2: partition@e0000 {
+		label = "barebox-environment";
+		reg = <0xe0000 0x20000>;
+	};
+};
+
+&usdhc3 {
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	partition@0 {
+		label = "barebox";
+		reg = <0x0 0xe0000>;
+	};
+
+	env_sd3: partition@e0000 {
+		label = "barebox-environment";
+		reg = <0xe0000 0x20000>;
+	};
+};
+
+&ocotp {
+	barebox,provide-mac-address = <&fec1 0x640>;
+};
-- 
2.30.2




^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH v3 2/2] ARM: i.MX8MM: add support for 8MMINILPD4-CPU2 board
  2023-01-19 15:56 [PATCH v3 1/2] ARM: i.MX8MM: split barebox dts into dtsi file Marco Felsch
@ 2023-01-19 15:56 ` Marco Felsch
  2023-01-25  8:05 ` [PATCH v3 1/2] ARM: i.MX8MM: split barebox dts into dtsi file Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Marco Felsch @ 2023-01-19 15:56 UTC (permalink / raw)
  To: barebox, johannes.schneider

From: Johannes Schneider <johannes.schneider@leica-geosystems.com>

This commit adds support for the 8MMINILPD4-CPU2 board. This board
replaced the ROHM BD71847 by the NXP PCA9450. The pbl PMIC configuration
is taken from upstream u-boot v2023.01.

Signed-off-by: Johannes Schneider <johannes.schneider@leica-geosystems.com>
[m.felsch@penugtronix.de: Adapt commit message]
[m.felsch@pengutronix.de: Fix pmic configuration settings to align with u-boot]
[m.felsch@pengutronix.de: Add dedicated dts support]
[m.felsch@pengutronix.de: Include Ahmad's review feedback]
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
Hi,

I pocked Johannes v2 [1] and added the review feedback from Ahmad.

[1] <20230111100111.677018-1-johannes.schneider@leica-geosystems.com>.

 arch/arm/boards/nxp-imx8mm-evk/board.c    |   5 +-
 arch/arm/boards/nxp-imx8mm-evk/lowlevel.c |  50 ++++++++-
 arch/arm/dts/Makefile                     |   2 +-
 arch/arm/dts/imx8mm-evkb.dts              | 122 ++++++++++++++++++++++
 4 files changed, 170 insertions(+), 9 deletions(-)
 create mode 100644 arch/arm/dts/imx8mm-evkb.dts

diff --git a/arch/arm/boards/nxp-imx8mm-evk/board.c b/arch/arm/boards/nxp-imx8mm-evk/board.c
index db694943e5..76d669f1a7 100644
--- a/arch/arm/boards/nxp-imx8mm-evk/board.c
+++ b/arch/arm/boards/nxp-imx8mm-evk/board.c
@@ -60,9 +60,8 @@ static int imx8mm_evk_probe(struct device_d *dev)
 }
 
 static const struct of_device_id imx8mm_evk_of_match[] = {
-	{
-		.compatible = "fsl,imx8mm-evk",
-	},
+	{ .compatible = "fsl,imx8mm-evk", },
+	{ .compatible = "fsl,imx8mm-evkb", },
 	{ /* sentinel */ }
 };
 
diff --git a/arch/arm/boards/nxp-imx8mm-evk/lowlevel.c b/arch/arm/boards/nxp-imx8mm-evk/lowlevel.c
index 6132df53ec..5861d8d8be 100644
--- a/arch/arm/boards/nxp-imx8mm-evk/lowlevel.c
+++ b/arch/arm/boards/nxp-imx8mm-evk/lowlevel.c
@@ -16,12 +16,11 @@
 #include <mach/iomux-mx8mm.h>
 #include <mach/imx8m-ccm-regs.h>
 #include <mfd/bd71837.h>
+#include <mfd/pca9450.h>
 #include <mach/xload.h>
 #include <soc/imx8m/ddr.h>
 #include <image-metadata.h>
 
-extern char __dtb_z_imx8mm_evk_start[];
-
 #define UART_PAD_CTRL	MUX_PAD_CTRL(PAD_CTL_DSE_3P3V_45_OHM)
 
 static void setup_uart(void)
@@ -38,6 +37,32 @@ static void setup_uart(void)
 	putc_ll('>');
 }
 
+static struct pmic_config pca9450_cfg[] = {
+	/* BUCKxOUT_DVS0/1 control BUCK123 output */
+	{ PCA9450_BUCK123_DVS, 0x29 },
+
+	/* Buck 1 DVS control through PMIC_STBY_REQ */
+	{ PCA9450_BUCK1CTRL, 0x59 },
+
+	/* Set DVS1 to 0.8v for suspend */
+	{ PCA9450_BUCK1OUT_DVS1, 0x10 },
+
+	/* increase VDD_DRAM to 0.95v for 3Ghz DDR */
+	{ PCA9450_BUCK3OUT_DVS0, 0x1c },
+
+	/*
+	 * VDD_DRAM needs off in suspend, set B1_ENMODE=10
+	 * (ON by PMIC_ON_REQ = H && PMIC_STBY_REQ = L)
+	 */
+	{ PCA9450_BUCK3CTRL, 0x4a },
+
+	/* set VDD_SNVS_0V8 from default 0.85V */
+	{ PCA9450_LDO2CTRL, 0xc0 },
+
+	/* set WDOG_B_CFG to cold reset */
+	{ PCA9450_RESET_CTRL, 0xa1 },
+};
+
 static struct pmic_config bd71837_cfg[] = {
 	/* decrease RESET key long push time from the default 10s to 10ms */
 	{ BD718XX_PWRONCONFIG1, 0x0 },
@@ -63,7 +88,10 @@ static void power_init_board(void)
 
 	i2c = imx8m_i2c_early_init(IOMEM(MX8MQ_I2C1_BASE_ADDR));
 
-	pmic_configure(i2c, 0x4b, bd71837_cfg, ARRAY_SIZE(bd71837_cfg));
+	if (i2c_dev_probe(i2c, 0x25, true) == 0)
+		pmic_configure(i2c, 0x25, pca9450_cfg, ARRAY_SIZE(pca9450_cfg));
+	else
+		pmic_configure(i2c, 0x4b, bd71837_cfg, ARRAY_SIZE(bd71837_cfg));
 }
 
 extern struct dram_timing_info imx8mm_evk_dram_timing;
@@ -102,14 +130,26 @@ static void start_atf(void)
  */
 static __noreturn noinline void nxp_imx8mm_evk_start(void)
 {
+	extern char __dtb_z_imx8mm_evk_start[], __dtb_z_imx8mm_evkb_start[];
+	struct pbl_i2c *i2c;
+	void *fdt;
+
 	setup_uart();
 
 	start_atf();
 
 	/*
-	 * Standard entry we hit once we initialized both DDR and ATF
+	 * Standard entry we hit once we initialized both DDR and ATF. I2C pad
+	 * and clock setup already done during power_init_board().
 	 */
-	imx8mm_barebox_entry(__dtb_z_imx8mm_evk_start);
+	i2c = imx8m_i2c_early_init(IOMEM(MX8MQ_I2C1_BASE_ADDR));
+
+	if (i2c_dev_probe(i2c, 0x25, true) == 0)
+		fdt = __dtb_z_imx8mm_evkb_start;
+	else
+		fdt = __dtb_z_imx8mm_evk_start;
+
+	imx8mm_barebox_entry(fdt);
 }
 
 ENTRY_FUNCTION(start_nxp_imx8mm_evk, r0, r1, r2)
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 5ceb97129f..b6131bf072 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -141,7 +141,7 @@ 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
 lwl-$(CONFIG_MACH_NXP_IMX6ULL_EVK) += imx6ull-14x14-evk.dtb.o
-lwl-$(CONFIG_MACH_NXP_IMX8MM_EVK) += imx8mm-evk.dtb.o
+lwl-$(CONFIG_MACH_NXP_IMX8MM_EVK) += imx8mm-evk.dtb.o imx8mm-evkb.dtb.o
 lwl-$(CONFIG_MACH_NXP_IMX8MN_EVK) += imx8mn-evk.dtb.o imx8mn-ddr4-evk.dtb.o
 lwl-$(CONFIG_MACH_NXP_IMX8MP_EVK) += imx8mp-evk.dtb.o
 lwl-$(CONFIG_MACH_NXP_IMX8MQ_EVK) += imx8mq-evk.dtb.o
diff --git a/arch/arm/dts/imx8mm-evkb.dts b/arch/arm/dts/imx8mm-evkb.dts
new file mode 100644
index 0000000000..b7d3be7a84
--- /dev/null
+++ b/arch/arm/dts/imx8mm-evkb.dts
@@ -0,0 +1,122 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright 2017 NXP
+ * Copyright (C) 2017 Pengutronix, Lucas Stach <kernel@pengutronix.de>
+ * Copyright (C) 2023 Pengutronix, Marco Felsch <kernel@pengutronix.de>
+ */
+
+/dts-v1/;
+
+#include <arm64/freescale/imx8mm-evk.dts>
+#include "imx8mm.dtsi"
+#include "imx8mm-evk.dtsi"
+
+/ {
+	model = "FSL i.MX8MM EVKB";
+	compatible = "fsl,imx8mm-evkb", "fsl,imx8mm";
+};
+
+&i2c1 {
+	/delete-node/ pmic@4b;
+
+	pmic@25 {
+		compatible = "nxp,pca9450a";
+		reg = <0x25>;
+		pinctrl-0 = <&pinctrl_pmic>;
+		pinctrl-names = "default";
+		interrupt-parent = <&gpio1>;
+		interrupts = <3 IRQ_TYPE_LEVEL_LOW>;
+
+		regulators {
+			buck1_reg: BUCK1 {
+				regulator-name = "BUCK1";
+				regulator-min-microvolt = <600000>;
+				regulator-max-microvolt = <2187500>;
+				regulator-boot-on;
+				regulator-always-on;
+				regulator-ramp-delay = <3125>;
+				nxp,dvs-run-voltage = <820000>;
+				nxp,dvs-standby-voltage = <800000>;
+			};
+
+			buck2_reg: BUCK2 {
+				regulator-name = "BUCK2";
+				regulator-min-microvolt = <600000>;
+				regulator-max-microvolt = <2187500>;
+				regulator-boot-on;
+				regulator-always-on;
+				regulator-ramp-delay = <3125>;
+			};
+
+			buck3_reg: BUCK3 {
+				regulator-name = "BUCK3";
+				regulator-min-microvolt = <600000>;
+				regulator-max-microvolt = <2187500>;
+				regulator-boot-on;
+				regulator-always-on;
+			};
+
+			buck4_reg: BUCK4 {
+				regulator-name = "BUCK4";
+				regulator-min-microvolt = <600000>;
+				regulator-max-microvolt = <3400000>;
+				regulator-boot-on;
+				regulator-always-on;
+			};
+
+			buck5_reg: BUCK5 {
+				regulator-name = "BUCK5";
+				regulator-min-microvolt = <600000>;
+				regulator-max-microvolt = <3400000>;
+				regulator-boot-on;
+				regulator-always-on;
+			};
+
+			buck6_reg: BUCK6 {
+				regulator-name = "BUCK6";
+				regulator-min-microvolt = <600000>;
+				regulator-max-microvolt = <3400000>;
+				regulator-boot-on;
+				regulator-always-on;
+			};
+
+			ldo1_reg: LDO1 {
+				regulator-name = "LDO1";
+				regulator-min-microvolt = <1600000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-boot-on;
+				regulator-always-on;
+			};
+
+			ldo2_reg: LDO2 {
+				regulator-name = "LDO2";
+				regulator-min-microvolt = <800000>;
+				regulator-max-microvolt = <1150000>;
+				regulator-boot-on;
+				regulator-always-on;
+			};
+
+			ldo3_reg: LDO3 {
+				regulator-name = "LDO3";
+				regulator-min-microvolt = <800000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-boot-on;
+				regulator-always-on;
+			};
+
+			ldo4_reg: LDO4 {
+				regulator-name = "LDO4";
+				regulator-min-microvolt = <800000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-boot-on;
+				regulator-always-on;
+			};
+
+			ldo5_reg: LDO5 {
+				regulator-name = "LDO5";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <3300000>;
+			};
+		};
+	};
+};
-- 
2.30.2




^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v3 1/2] ARM: i.MX8MM: split barebox dts into dtsi file
  2023-01-19 15:56 [PATCH v3 1/2] ARM: i.MX8MM: split barebox dts into dtsi file Marco Felsch
  2023-01-19 15:56 ` [PATCH v3 2/2] ARM: i.MX8MM: add support for 8MMINILPD4-CPU2 board Marco Felsch
@ 2023-01-25  8:05 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2023-01-25  8:05 UTC (permalink / raw)
  To: Marco Felsch; +Cc: barebox, johannes.schneider

On Thu, Jan 19, 2023 at 04:56:01PM +0100, Marco Felsch wrote:
> Move the dts file into a dtsi file. This is in preparation for the
> imx8mm-evkb support which will reuse the config. No functional change.
> 
> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> ---
> v3:
> - new in this series
> 
>  arch/arm/dts/imx8mm-evk.dts  | 54 +--------------------------------
>  arch/arm/dts/imx8mm-evk.dtsi | 58 ++++++++++++++++++++++++++++++++++++
>  2 files changed, 59 insertions(+), 53 deletions(-)
>  create mode 100644 arch/arm/dts/imx8mm-evk.dtsi

Applied, thanks

Sascha

> 
> diff --git a/arch/arm/dts/imx8mm-evk.dts b/arch/arm/dts/imx8mm-evk.dts
> index 3ced5a934c..abe0a2e450 100644
> --- a/arch/arm/dts/imx8mm-evk.dts
> +++ b/arch/arm/dts/imx8mm-evk.dts
> @@ -8,56 +8,4 @@
>  
>  #include <arm64/freescale/imx8mm-evk.dts>
>  #include "imx8mm.dtsi"
> -
> -/ {
> -	chosen {
> -		environment-sd {
> -			compatible = "barebox,environment";
> -			device-path = &env_sd2;
> -			status = "disabled";
> -		};
> -		environment-emmc {
> -			compatible = "barebox,environment";
> -			device-path = &env_sd3;
> -			status = "disabled";
> -		};
> -	};
> -};
> -
> -&reg_usdhc2_vmmc {
> -	off-on-delay-us = <20000>;
> -};
> -
> -&usdhc2 {
> -	#address-cells = <1>;
> -	#size-cells = <1>;
> -
> -	partition@0 {
> -		label = "barebox";
> -		reg = <0x0 0xe0000>;
> -	};
> -
> -	env_sd2: partition@e0000 {
> -		label = "barebox-environment";
> -		reg = <0xe0000 0x20000>;
> -	};
> -};
> -
> -&usdhc3 {
> -	#address-cells = <1>;
> -	#size-cells = <1>;
> -
> -	partition@0 {
> -		label = "barebox";
> -		reg = <0x0 0xe0000>;
> -	};
> -
> -	env_sd3: partition@e0000 {
> -		label = "barebox-environment";
> -		reg = <0xe0000 0x20000>;
> -	};
> -};
> -
> -&ocotp {
> -	barebox,provide-mac-address = <&fec1 0x640>;
> -};
> +#include "imx8mm-evk.dtsi"
> diff --git a/arch/arm/dts/imx8mm-evk.dtsi b/arch/arm/dts/imx8mm-evk.dtsi
> new file mode 100644
> index 0000000000..4d64dcad1c
> --- /dev/null
> +++ b/arch/arm/dts/imx8mm-evk.dtsi
> @@ -0,0 +1,58 @@
> +// SPDX-License-Identifier: (GPL-2.0 OR MIT)
> +/*
> + * Copyright 2017 NXP
> + * Copyright (C) 2017 Pengutronix, Lucas Stach <kernel@pengutronix.de>
> + */
> +
> +/ {
> +	chosen {
> +		environment-sd {
> +			compatible = "barebox,environment";
> +			device-path = &env_sd2;
> +			status = "disabled";
> +		};
> +		environment-emmc {
> +			compatible = "barebox,environment";
> +			device-path = &env_sd3;
> +			status = "disabled";
> +		};
> +	};
> +};
> +
> +&reg_usdhc2_vmmc {
> +	off-on-delay-us = <20000>;
> +};
> +
> +&usdhc2 {
> +	#address-cells = <1>;
> +	#size-cells = <1>;
> +
> +	partition@0 {
> +		label = "barebox";
> +		reg = <0x0 0xe0000>;
> +	};
> +
> +	env_sd2: partition@e0000 {
> +		label = "barebox-environment";
> +		reg = <0xe0000 0x20000>;
> +	};
> +};
> +
> +&usdhc3 {
> +	#address-cells = <1>;
> +	#size-cells = <1>;
> +
> +	partition@0 {
> +		label = "barebox";
> +		reg = <0x0 0xe0000>;
> +	};
> +
> +	env_sd3: partition@e0000 {
> +		label = "barebox-environment";
> +		reg = <0xe0000 0x20000>;
> +	};
> +};
> +
> +&ocotp {
> +	barebox,provide-mac-address = <&fec1 0x640>;
> +};
> -- 
> 2.30.2
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-01-25  8:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-19 15:56 [PATCH v3 1/2] ARM: i.MX8MM: split barebox dts into dtsi file Marco Felsch
2023-01-19 15:56 ` [PATCH v3 2/2] ARM: i.MX8MM: add support for 8MMINILPD4-CPU2 board Marco Felsch
2023-01-25  8:05 ` [PATCH v3 1/2] ARM: i.MX8MM: split barebox dts into dtsi file Sascha Hauer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.