mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/3] ARM: stm32mp: add Linux Automation MC-1 support
@ 2020-04-24 16:01 Ahmad Fatoum
  2020-04-24 16:01 ` [PATCH 2/3] ARM: stm32mp: lxa-mc1: break reg_3v3 dependency on PMIC Ahmad Fatoum
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Ahmad Fatoum @ 2020-04-24 16:01 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

This adds support for the Linux Automation GmbH MC-1 board built around
the Octavo Systems OSD32MP157C-512M SiP.

The device tree is based on the one in linux-stm32/stm32-next, which
will probably be merged for Linux v5.8-rc1. Instead of waiting that
long, we import it here with some stuff removed/changed, so it's usable
for both barebox and Linux, without the prerequisite patches.

The non-barebox specific parts have been moved into separate DTSIs
(arch/arm/dts/stm32mp{157c-lxa-mc1,15xx-osd32}.dtsi), so both can be
dropped after the v5.8-rc1 sync with only include path change necessary
in arch/arm/dts/stm32mp157c-lxa-mc1.dts.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/boards/Makefile              |   1 +
 arch/arm/boards/lxa-mc1/Makefile      |   2 +
 arch/arm/boards/lxa-mc1/board.c       |  31 +++
 arch/arm/boards/lxa-mc1/lowlevel.c    |  26 ++
 arch/arm/dts/Makefile                 |   1 +
 arch/arm/dts/stm32mp157c-lxa-mc1.dts  |  42 +++
 arch/arm/dts/stm32mp157c-lxa-mc1.dtsi | 362 ++++++++++++++++++++++++++
 arch/arm/dts/stm32mp15xx-osd32.dtsi   | 229 ++++++++++++++++
 arch/arm/mach-stm32mp/Kconfig         |   4 +
 images/Makefile.stm32mp               |   5 +
 10 files changed, 703 insertions(+)
 create mode 100644 arch/arm/boards/lxa-mc1/Makefile
 create mode 100644 arch/arm/boards/lxa-mc1/board.c
 create mode 100644 arch/arm/boards/lxa-mc1/lowlevel.c
 create mode 100644 arch/arm/dts/stm32mp157c-lxa-mc1.dts
 create mode 100644 arch/arm/dts/stm32mp157c-lxa-mc1.dtsi
 create mode 100644 arch/arm/dts/stm32mp15xx-osd32.dtsi

diff --git a/arch/arm/boards/Makefile b/arch/arm/boards/Makefile
index 9fe458e0a390..e9e9163d589b 100644
--- a/arch/arm/boards/Makefile
+++ b/arch/arm/boards/Makefile
@@ -129,6 +129,7 @@ obj-$(CONFIG_MACH_SOCFPGA_TERASIC_SOCKIT)	+= terasic-sockit/
 obj-$(CONFIG_MACH_SOLIDRUN_CUBOX)		+= solidrun-cubox/
 obj-$(CONFIG_MACH_SOLIDRUN_MICROSOM)		+= solidrun-microsom/
 obj-$(CONFIG_MACH_STM32MP157C_DK2)		+= stm32mp157c-dk2/
+obj-$(CONFIG_MACH_LXA_MC1)			+= lxa-mc1/
 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/lxa-mc1/Makefile b/arch/arm/boards/lxa-mc1/Makefile
new file mode 100644
index 000000000000..092c31d6b28d
--- /dev/null
+++ b/arch/arm/boards/lxa-mc1/Makefile
@@ -0,0 +1,2 @@
+lwl-y += lowlevel.o
+obj-y += board.o
diff --git a/arch/arm/boards/lxa-mc1/board.c b/arch/arm/boards/lxa-mc1/board.c
new file mode 100644
index 000000000000..d36924fc2793
--- /dev/null
+++ b/arch/arm/boards/lxa-mc1/board.c
@@ -0,0 +1,31 @@
+// SPDX-License-Identifier: GPL-2.0+
+#include <common.h>
+#include <linux/sizes.h>
+#include <init.h>
+#include <asm/memory.h>
+#include <mach/bbu.h>
+#include <bootsource.h>
+
+static int mc1_device_init(void)
+{
+	int flags;
+	if (!of_machine_is_compatible("lxa,stm32mp157c-mc1"))
+		return 0;
+
+	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_hostname("lxa-mc1");
+
+	return 0;
+}
+device_initcall(mc1_device_init);
diff --git a/arch/arm/boards/lxa-mc1/lowlevel.c b/arch/arm/boards/lxa-mc1/lowlevel.c
new file mode 100644
index 000000000000..274f824a1662
--- /dev/null
+++ b/arch/arm/boards/lxa-mc1/lowlevel.c
@@ -0,0 +1,26 @@
+// SPDX-License-Identifier: GPL-2.0+
+#include <common.h>
+#include <mach/entry.h>
+#include <debug_ll.h>
+
+extern char __dtb_z_stm32mp157c_lxa_mc1_start[];
+
+static void setup_uart(void)
+{
+	/* first stage has set up the UART, so nothing to do here */
+	putc_ll('>');
+}
+
+ENTRY_FUNCTION(start_stm32mp157c_lxa_mc1, r0, r1, r2)
+{
+	void *fdt;
+
+	stm32mp_cpu_lowlevel_init();
+
+	if (IS_ENABLED(CONFIG_DEBUG_LL))
+		setup_uart();
+
+	fdt = __dtb_z_stm32mp157c_lxa_mc1_start + get_runtime_offset();
+
+	stm32mp1_barebox_entry(fdt);
+}
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index ddfe64e83bdf..1aeaa61e017e 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -94,6 +94,7 @@ lwl-dtb-$(CONFIG_MACH_SOLIDRUN_MICROSOM) += imx6dl-hummingboard.dtb.o imx6q-humm
 				imx6dl-hummingboard2.dtb.o imx6q-hummingboard2.dtb.o \
 				imx6q-h100.dtb.o
 lwl-dtb-$(CONFIG_MACH_STM32MP157C_DK2) += stm32mp157c-dk2.dtb.o
+lwl-dtb-$(CONFIG_MACH_LXA_MC1) += stm32mp157c-lxa-mc1.dtb.o
 lwl-dtb-$(CONFIG_MACH_SCB9328) += imx1-scb9328.dtb.o
 lwl-dtb-$(CONFIG_MACH_TECHNEXION_WANDBOARD) += imx6q-wandboard.dtb.o imx6dl-wandboard.dtb.o
 lwl-dtb-$(CONFIG_MACH_TECHNEXION_PICO_HOBBIT) += imx6ul-pico-hobbit.dtb.o
diff --git a/arch/arm/dts/stm32mp157c-lxa-mc1.dts b/arch/arm/dts/stm32mp157c-lxa-mc1.dts
new file mode 100644
index 000000000000..742739424ea7
--- /dev/null
+++ b/arch/arm/dts/stm32mp157c-lxa-mc1.dts
@@ -0,0 +1,42 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
+/*
+ * Copyright (C) 2020 Ahmad Fatoum, Pengutronix
+ */
+
+#include "stm32mp157c-lxa-mc1.dtsi"
+#include "stm32mp151.dtsi"
+
+/ {
+	chosen {
+		environment-sd {
+			compatible = "barebox,environment";
+			device-path = &sdmmc1, "partname:barebox-environment";
+		};
+
+		environment-emmc {
+			compatible = "barebox,environment";
+			device-path = &sdmmc2, "partname:barebox-environment";
+		};
+	};
+
+};
+
+&panel {
+	display-timings {
+		timing { /* edt,etm0700g0dh6 */
+			clock-frequency = <33260000>;
+			hactive = <800>;
+			vactive = <480>;
+			hfront-porch = <40>;
+			hsync-len = <128>;
+			hback-porch = <88>;
+			vfront-porch = <10>;
+			vsync-len = <2>;
+			vback-porch = <33>;
+			hsync-active = <0>;
+			vsync-active = <0>;
+			de-active = <1>;
+			pixelclk-active = <0>;
+		};
+	};
+};
diff --git a/arch/arm/dts/stm32mp157c-lxa-mc1.dtsi b/arch/arm/dts/stm32mp157c-lxa-mc1.dtsi
new file mode 100644
index 000000000000..6603cf280eb2
--- /dev/null
+++ b/arch/arm/dts/stm32mp157c-lxa-mc1.dtsi
@@ -0,0 +1,362 @@
+/* SPDX-License-Identifier: (GPL-2.0-or-later OR BSD-3-Clause) */
+/*
+ * Copyright (C) 2020 STMicroelectronics - All Rights Reserved
+ * Copyright (C) 2020 Ahmad Fatoum, Pengutronix
+ */
+
+/dts-v1/;
+
+#include <arm/stm32mp157.dtsi>
+#include "stm32mp15xx-osd32.dtsi"
+#include <arm/stm32mp15xxac-pinctrl.dtsi>
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/pwm/pwm.h>
+
+/ {
+	model = "Linux Automation MC-1 board";
+	compatible = "lxa,stm32mp157c-mc1", "st,stm32mp157";
+
+	aliases {
+		ethernet0 = &ethernet0;
+		mmc0 = &sdmmc1;
+		mmc1 = &sdmmc2;
+		serial0 = &uart4;
+	};
+
+	backlight: backlight {
+		compatible = "pwm-backlight";
+		pwms = <&backlight_pwm 1 100000 PWM_POLARITY_INVERTED>;
+		brightness-levels = <0 31 63 95 127 159 191 223 255>;
+		default-brightness-level = <7>;
+		power-supply = <&reg_5v2>; /* 3V3_BACKLIGHT */
+	};
+
+	chosen {
+		stdout-path = &uart4;
+	};
+
+	led-act {
+		compatible = "gpio-leds";
+
+		led-green {
+			label = "mc1:green:act";
+			gpios = <&gpioa 13 GPIO_ACTIVE_LOW>;
+			linux,default-trigger = "heartbeat";
+		};
+	};
+
+	led-rgb {
+		compatible = "pwm-leds";
+
+		led-red {
+			label = "mc1:red:rgb";
+			pwms = <&leds_pwm 1 1000000 0>;
+			max-brightness = <255>;
+			active-low;
+		};
+
+		led-green {
+			label = "mc1:green:rgb";
+			pwms = <&leds_pwm 2 1000000 0>;
+			max-brightness = <255>;
+			active-low;
+		};
+
+		led-blue {
+			label = "mc1:blue:rgb";
+			pwms = <&leds_pwm 3 1000000 0>;
+			max-brightness = <255>;
+			active-low;
+		};
+	};
+
+	panel: panel {
+		compatible = "edt,etm0700g0edh6", "simple-panel";
+		backlight = <&backlight>;
+		enable-gpios = <&gpiod 4 GPIO_ACTIVE_HIGH>;
+		power-supply = <&reg_3v3>;
+
+		port {
+			panel_input: endpoint {
+				remote-endpoint = <&ltdc_ep0_out>;
+			};
+		};
+	};
+
+	reg_3v3: regulator_3v3 {
+		compatible = "regulator-fixed";
+		regulator-name = "3V3";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		regulator-always-on;
+		vin-supply = <&v3v3>;
+	};
+
+	/* supplied by either debug board or PoE */
+	reg_5v2: regulator_5v2 {
+		compatible = "regulator-fixed";
+		regulator-name = "5V2";
+		regulator-min-microvolt = <5200000>;
+		regulator-max-microvolt = <5200000>;
+		regulator-always-on;
+	};
+};
+
+&ethernet0 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&ethernet0_rgmii_mc1pins_b>;
+	phy-mode = "rgmii-id";
+	phy-handle = <&ethphy>;
+	status = "okay";
+
+	mdio0 {
+		compatible = "snps,dwmac-mdio";
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		ethphy: ethernet-phy@3 { /* KSZ9031RN */
+			reg = <3>;
+			reset-gpios = <&gpiog 0 GPIO_ACTIVE_LOW>; /* ETH_RST# */
+			interrupt-parent = <&gpioa>;
+			interrupts = <6 IRQ_TYPE_EDGE_FALLING>; /* ETH_MDINT# */
+			rxc-skew-ps = <1860>;
+			txc-skew-ps = <1860>;
+			reset-assert-us = <10000>;
+			reset-deassert-us = <300>;
+			micrel,force-master;
+		};
+	};
+};
+
+&gpioz {
+	gpio-line-names = "HWID0", "HWID1", "HWID2", "HWID3", "", "",
+			  "HWID4", "HWID5";
+};
+
+&gpu {
+	status = "okay";
+};
+
+&i2c5 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&i2c5_mc1pins_b>;
+	clock-frequency = <400000>;
+	status = "okay";
+
+	touchscreen@38 {
+		compatible = "edt,edt-ft5x06";
+		interrupt-parent = <&gpiod>;
+		interrupts = <11 IRQ_TYPE_EDGE_FALLING>; /* TOUCH_INT# */
+		vcc-supply = <&reg_3v3>;
+		reg = <0x38>;
+		reset-gpios = <&gpiof 8 GPIO_ACTIVE_LOW>; /* TOUCH_RESET# */
+		touchscreen-size-x = <1792>;
+		touchscreen-size-y = <1024>;
+		wakeup-source;
+	};
+};
+
+&ltdc {
+	pinctrl-names = "default";
+	pinctrl-0 = <&ltdc_mc1pins_c>;
+	status = "okay";
+
+	port {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		ltdc_ep0_out: endpoint@0 {
+			reg = <0>;
+			remote-endpoint = <&panel_input>;
+		};
+	};
+};
+
+&pmic {
+	regulators {
+		buck4-supply = <&reg_5v2>;	/* VIN */
+		ldo2-supply = <&reg_5v2>;	/* PMIC_LDO25IN */
+		ldo5-supply = <&reg_5v2>;	/* PMIC_LDO25IN */
+		boost-supply = <&reg_5v2>;	/* PMIC_BSTIN */
+		pwr_sw2-supply = <&bst_out>;    /* PMIC_SWIN */
+	};
+};
+
+&sdmmc1 {
+	pinctrl-names = "default", "opendrain";
+	pinctrl-0 = <&sdmmc1_b4_pins_a>;
+	pinctrl-1 = <&sdmmc1_b4_od_pins_a>;
+	bus-width = <4>;
+	cd-gpios = <&gpioh 3 GPIO_ACTIVE_LOW>;
+	disable-wp;
+	no-1-8-v;
+	st,neg-edge;
+	vmmc-supply = <&reg_3v3>;
+	status = "okay";
+};
+
+&sdmmc1_b4_pins_a {
+	/*
+	 * board lacks external pull-ups on SDMMC lines. Class 10 SD refuses to
+	 * work, thus enable internal pull-ups.
+	 */
+	pins1 {
+		/delete-property/ bias-disable;
+		bias-pull-up;
+	};
+	pins2 {
+		/delete-property/ bias-disable;
+		bias-pull-up;
+	};
+};
+
+&sdmmc2 {
+	pinctrl-names = "default", "opendrain";
+	pinctrl-0 = <&sdmmc2_b4_pins_a &sdmmc2_d47_mc1pins_b>;
+	pinctrl-1 = <&sdmmc2_b4_od_pins_a &sdmmc2_d47_mc1pins_b>;
+	bus-width = <8>;
+	no-1-8-v;
+	no-sd;
+	no-sdio;
+	non-removable;
+	st,neg-edge;
+	vmmc-supply = <&reg_3v3>;
+	status = "okay";
+};
+
+&timers3 {
+	status = "okay";
+
+	backlight_pwm: pwm {
+		pinctrl-names = "default";
+		pinctrl-0 = <&pwm3_mc1pins_b>;
+		status = "okay";
+	};
+};
+
+&timers5 {
+	status = "okay";
+
+	leds_pwm: pwm {
+		pinctrl-names = "default";
+		pinctrl-0 = <&pwm5_mc1pins_b>;
+		status = "okay";
+	};
+};
+
+&uart4 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&uart4_pins_a>;
+	status = "okay";
+};
+
+&pinctrl {
+	ethernet0_rgmii_mc1pins_b: mc1-rgmii-1 {
+		pins1 {
+			pinmux = <STM32_PINMUX('G', 5, AF11)>, /* ETH_RGMII_CLK125 */
+				 <STM32_PINMUX('G', 4, AF11)>, /* ETH_RGMII_GTX_CLK */
+				 <STM32_PINMUX('G', 13, AF11)>, /* ETH_RGMII_TXD0 */
+				 <STM32_PINMUX('G', 14, AF11)>, /* ETH_RGMII_TXD1 */
+				 <STM32_PINMUX('C', 2, AF11)>, /* ETH_RGMII_TXD2 */
+				 <STM32_PINMUX('E', 2, AF11)>, /* ETH_RGMII_TXD3 */
+				 <STM32_PINMUX('B', 11, AF11)>, /* ETH_RGMII_TX_CTL */
+				 <STM32_PINMUX('C', 1, AF11)>; /* ETH_MDC */
+			bias-disable;
+			drive-push-pull;
+			slew-rate = <2>;
+		};
+		pins2 {
+			pinmux = <STM32_PINMUX('A', 2, AF11)>; /* ETH_MDIO */
+			bias-disable;
+			drive-push-pull;
+			slew-rate = <0>;
+		};
+		pins3 {
+			pinmux = <STM32_PINMUX('C', 4, AF11)>, /* ETH_RGMII_RXD0 */
+				 <STM32_PINMUX('C', 5, AF11)>, /* ETH_RGMII_RXD1 */
+				 <STM32_PINMUX('H', 6, AF11)>, /* ETH_RGMII_RXD2 */
+				 <STM32_PINMUX('H', 7, AF11)>, /* ETH_RGMII_RXD3 */
+				 <STM32_PINMUX('A', 1, AF11)>, /* ETH_RGMII_RX_CLK */
+				 <STM32_PINMUX('A', 7, AF11)>; /* ETH_RGMII_RX_CTL */
+			bias-disable;
+		};
+	};
+
+	i2c5_mc1pins_b: mc1-i2c5-1 {
+		pins {
+			pinmux = <STM32_PINMUX('D', 0, AF4)>, /* I2C5_SCL */
+			         <STM32_PINMUX('D', 1, AF4)>; /* I2C5_SDA */
+			bias-disable;
+			drive-open-drain;
+			slew-rate = <0>;
+		};
+	};
+
+	ltdc_mc1pins_c: mc1-ltdc-2 {
+		pins1 {
+			pinmux = <STM32_PINMUX('B',  1, AF9)>,  /* LTDC_R6 */
+				 <STM32_PINMUX('B',  9, AF14)>, /* LTDC_B7 */
+				 <STM32_PINMUX('C',  0, AF14)>, /* LTDC_R5 */
+				 <STM32_PINMUX('D',  3, AF14)>, /* LTDC_G7 */
+				 <STM32_PINMUX('D',  6, AF14)>, /* LTDC_B2 */
+				 <STM32_PINMUX('D', 10, AF14)>, /* LTDC_B3 */
+				 <STM32_PINMUX('E', 11, AF14)>, /* LTDC_G3 */
+				 <STM32_PINMUX('E', 12, AF14)>, /* LTDC_B4 */
+				 <STM32_PINMUX('E', 13, AF14)>, /* LTDC_DE */
+				 <STM32_PINMUX('E', 15, AF14)>, /* LTDC_R7 */
+				 <STM32_PINMUX('H',  4, AF9)>,  /* LTDC_G5 */
+				 <STM32_PINMUX('H',  8, AF14)>, /* LTDC_R2 */
+				 <STM32_PINMUX('H',  9, AF14)>, /* LTDC_R3 */
+				 <STM32_PINMUX('H', 10, AF14)>, /* LTDC_R4 */
+				 <STM32_PINMUX('H', 13, AF14)>, /* LTDC_G2 */
+				 <STM32_PINMUX('H', 15, AF14)>, /* LTDC_G4 */
+				 <STM32_PINMUX('I',  1, AF14)>, /* LTDC_G6 */
+				 <STM32_PINMUX('I',  5, AF14)>, /* LTDC_B5 */
+				 <STM32_PINMUX('I',  6, AF14)>, /* LTDC_B6 */
+				 <STM32_PINMUX('I',  9, AF14)>, /* LTDC_VSYNC */
+				 <STM32_PINMUX('I', 10, AF14)>; /* LTDC_HSYNC */
+			bias-disable;
+			drive-push-pull;
+			slew-rate = <0>;
+		};
+		pins2 {
+			pinmux = <STM32_PINMUX('E', 14, AF14)>; /* LTDC_CLK */
+			bias-disable;
+			drive-push-pull;
+			slew-rate = <1>;
+		};
+	};
+
+	pwm3_mc1pins_b: mc1-pwm3-1 {
+		pins {
+			pinmux = <STM32_PINMUX('B', 5, AF2)>; /* TIM3_CH2 */
+			bias-disable;
+			drive-push-pull;
+			slew-rate = <0>;
+		};
+	};
+
+	pwm5_mc1pins_b: mc1-pwm5-1 {
+		pins {
+			pinmux = <STM32_PINMUX('H', 11, AF2)>, /* TIM5_CH2 */
+				 <STM32_PINMUX('H', 12, AF2)>, /* TIM5_CH3 */
+				 <STM32_PINMUX('I', 0, AF2)>; /* TIM5_CH4 */
+			bias-disable;
+			drive-push-pull;
+			slew-rate = <0>;
+		};
+	};
+
+	sdmmc2_d47_mc1pins_b: mc1-sdmmc2-d47-1 {
+		pins {
+			pinmux = <STM32_PINMUX('A', 8, AF9)>,  /* SDMMC2_D4 */
+				 <STM32_PINMUX('A', 9, AF10)>, /* SDMMC2_D5 */
+				 <STM32_PINMUX('C', 6, AF10)>, /* SDMMC2_D6 */
+				 <STM32_PINMUX('C', 7, AF10)>; /* SDMMC2_D7 */
+			slew-rate = <1>;
+			drive-push-pull;
+			bias-disable;
+		};
+	};
+
+};
diff --git a/arch/arm/dts/stm32mp15xx-osd32.dtsi b/arch/arm/dts/stm32mp15xx-osd32.dtsi
new file mode 100644
index 000000000000..87508350339e
--- /dev/null
+++ b/arch/arm/dts/stm32mp15xx-osd32.dtsi
@@ -0,0 +1,229 @@
+/* SPDX-License-Identifier: (GPL-2.0-or-later OR BSD-3-Clause) */
+/*
+ * Copyright (C) 2020 STMicroelectronics - All Rights Reserved
+ * Copyright (C) 2020 Ahmad Fatoum, Pengutronix
+ */
+
+#include <arm/stm32mp15-pinctrl.dtsi>
+
+#include <dt-bindings/mfd/st,stpmic1.h>
+
+/ {
+	reserved-memory {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		ranges;
+
+		mcuram2: mcuram2@10000000 {
+			compatible = "shared-dma-pool";
+			reg = <0x10000000 0x40000>;
+			no-map;
+		};
+
+		vdev0vring0: vdev0vring0@10040000 {
+			compatible = "shared-dma-pool";
+			reg = <0x10040000 0x1000>;
+			no-map;
+		};
+
+		vdev0vring1: vdev0vring1@10041000 {
+			compatible = "shared-dma-pool";
+			reg = <0x10041000 0x1000>;
+			no-map;
+		};
+
+		vdev0buffer: vdev0buffer@10042000 {
+			compatible = "shared-dma-pool";
+			reg = <0x10042000 0x4000>;
+			no-map;
+		};
+
+		mcuram: mcuram@30000000 {
+			compatible = "shared-dma-pool";
+			reg = <0x30000000 0x40000>;
+			no-map;
+		};
+
+		retram: retram@38000000 {
+			compatible = "shared-dma-pool";
+			reg = <0x38000000 0x10000>;
+			no-map;
+		};
+	};
+
+	reg_sip_eeprom: regulator_eeprom {
+		compatible = "regulator-fixed";
+		regulator-name = "sip_eeprom";
+		regulator-always-on;
+	};
+};
+
+&i2c4 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&i2c4_pins_a>;
+	clock-frequency = <400000>;
+	i2c-scl-rising-time-ns = <185>;
+	i2c-scl-falling-time-ns = <20>;
+	status = "okay";
+
+	pmic: stpmic@33 {
+		compatible = "st,stpmic1";
+		reg = <0x33>;
+		interrupts-extended = <&gpioa 0 IRQ_TYPE_EDGE_FALLING>;
+		interrupt-controller;
+		#interrupt-cells = <2>;
+
+		regulators {
+			compatible = "st,stpmic1-regulators";
+
+			ldo1-supply = <&v3v3>;
+			ldo6-supply = <&v3v3>;
+			pwr_sw1-supply = <&bst_out>;
+
+			vddcore: buck1 {
+				regulator-name = "vddcore";
+				regulator-min-microvolt = <1200000>;
+				regulator-max-microvolt = <1350000>;
+				regulator-always-on;
+				regulator-initial-mode = <0>;
+				regulator-over-current-protection;
+			};
+
+			vdd_ddr: buck2 {
+				regulator-name = "vdd_ddr";
+				regulator-min-microvolt = <1350000>;
+				regulator-max-microvolt = <1350000>;
+				regulator-always-on;
+				regulator-initial-mode = <0>;
+				regulator-over-current-protection;
+			};
+
+			vdd: buck3 {
+				regulator-name = "vdd";
+				regulator-min-microvolt = <3300000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-always-on;
+				st,mask-reset;
+				regulator-initial-mode = <0>;
+				regulator-over-current-protection;
+			};
+
+			v3v3: buck4 {
+				regulator-name = "v3v3";
+				regulator-min-microvolt = <3300000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-always-on;
+				regulator-over-current-protection;
+				regulator-initial-mode = <0>;
+			};
+
+			v1v8_audio: ldo1 {
+				regulator-name = "v1v8_audio";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <1800000>;
+				regulator-always-on;
+				interrupts = <IT_CURLIM_LDO1 0>;
+
+			};
+
+			v3v3_hdmi: ldo2 {
+				regulator-name = "v3v3_hdmi";
+				regulator-min-microvolt = <3300000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-always-on;
+				interrupts = <IT_CURLIM_LDO2 0>;
+
+			};
+
+			vtt_ddr: ldo3 {
+				regulator-name = "vtt_ddr";
+				regulator-min-microvolt = <500000>;
+				regulator-max-microvolt = <750000>;
+				regulator-always-on;
+				regulator-over-current-protection;
+			};
+
+			vdd_usb: ldo4 {
+				regulator-name = "vdd_usb";
+				regulator-min-microvolt = <3300000>;
+				regulator-max-microvolt = <3300000>;
+				interrupts = <IT_CURLIM_LDO4 0>;
+			};
+
+			vdda: ldo5 {
+				regulator-name = "vdda";
+				regulator-min-microvolt = <2900000>;
+				regulator-max-microvolt = <2900000>;
+				interrupts = <IT_CURLIM_LDO5 0>;
+				regulator-boot-on;
+			};
+
+			v1v2_hdmi: ldo6 {
+				regulator-name = "v1v2_hdmi";
+				regulator-min-microvolt = <1200000>;
+				regulator-max-microvolt = <1200000>;
+				regulator-always-on;
+				interrupts = <IT_CURLIM_LDO6 0>;
+
+			};
+
+			vref_ddr: vref_ddr {
+				regulator-name = "vref_ddr";
+				regulator-always-on;
+				regulator-over-current-protection;
+			};
+
+			bst_out: boost {
+				regulator-name = "bst_out";
+				interrupts = <IT_OCP_BOOST 0>;
+			};
+
+			vbus_otg: pwr_sw1 {
+				regulator-name = "vbus_otg";
+				interrupts = <IT_OCP_OTG 0>;
+				regulator-active-discharge;
+			};
+
+			vbus_sw: pwr_sw2 {
+				regulator-name = "vbus_sw";
+				interrupts = <IT_OCP_SWOUT 0>;
+				regulator-active-discharge;
+			};
+		};
+
+		onkey {
+			compatible = "st,stpmic1-onkey";
+			interrupts = <IT_PONKEY_F 0>, <IT_PONKEY_R 1>;
+			interrupt-names = "onkey-falling", "onkey-rising";
+		};
+
+		pmic_watchdog: watchdog {
+			compatible = "st,stpmic1-wdt";
+			status = "disabled";
+		};
+	};
+
+	sip_eeprom: eeprom@50 {
+		compatible = "atmel,24c32";
+		vcc-supply = <&reg_sip_eeprom>;
+		reg = <0x50>;
+	};
+};
+
+&ipcc {
+	status = "okay";
+};
+
+&m4_rproc {
+	memory-region = <&retram>, <&mcuram>, <&mcuram2>, <&vdev0vring0>,
+			<&vdev0vring1>, <&vdev0buffer>;
+	mboxes = <&ipcc 0>, <&ipcc 1>, <&ipcc 2>;
+	mbox-names = "vq0", "vq1", "shutdown";
+	interrupt-parent = <&exti>;
+	interrupts = <68 1>;
+	status = "okay";
+};
+
+&rng1 {
+	status = "okay";
+};
diff --git a/arch/arm/mach-stm32mp/Kconfig b/arch/arm/mach-stm32mp/Kconfig
index 9b55a3d21843..6e816ef9d1a4 100644
--- a/arch/arm/mach-stm32mp/Kconfig
+++ b/arch/arm/mach-stm32mp/Kconfig
@@ -12,4 +12,8 @@ config MACH_STM32MP157C_DK2
 	select ARCH_STM32MP157
 	bool "STM32MP157C-DK2 board"
 
+config MACH_LXA_MC1
+	select ARCH_STM32MP157
+	bool "Linux Automation MC-1 board"
+
 endif
diff --git a/images/Makefile.stm32mp b/images/Makefile.stm32mp
index 910e029a5b66..38872c952571 100644
--- a/images/Makefile.stm32mp
+++ b/images/Makefile.stm32mp
@@ -17,3 +17,8 @@ pblb-$(CONFIG_MACH_STM32MP157C_DK2) += start_stm32mp157c_dk2
 FILE_barebox-stm32mp157c-dk2.img = start_stm32mp157c_dk2.pblb.stm32
 OPTS_start_stm32mp157c_dk2.pblb.stm32 = $(STM32MP1_OPTS)
 image-$(CONFIG_MACH_STM32MP157C_DK2) += barebox-stm32mp157c-dk2.img
+
+pblb-$(CONFIG_MACH_LXA_MC1) += start_stm32mp157c_lxa_mc1
+FILE_barebox-stm32mp157c-lxa-mc1.img = start_stm32mp157c_lxa_mc1.pblb.stm32
+OPTS_start_stm32mp157c_lxa_mc1.pblb.stm32 = $(STM32MP1_OPTS)
+image-$(CONFIG_MACH_LXA_MC1) += barebox-stm32mp157c-lxa-mc1.img
-- 
2.26.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 2/3] ARM: stm32mp: lxa-mc1: break reg_3v3 dependency on PMIC
  2020-04-24 16:01 [PATCH 1/3] ARM: stm32mp: add Linux Automation MC-1 support Ahmad Fatoum
@ 2020-04-24 16:01 ` Ahmad Fatoum
  2020-04-27  7:45   ` [PATCH] fixup! ARM: stm32mp: add Linux Automation MC-1 support Ahmad Fatoum
  2020-04-24 16:01 ` [PATCH 3/3] ARM: stm32mp: expand stm32mp_defconfig for new drivers and board Ahmad Fatoum
  2020-04-27  7:32 ` [PATCH 1/3] ARM: stm32mp: add Linux Automation MC-1 support Sascha Hauer
  2 siblings, 1 reply; 8+ messages in thread
From: Ahmad Fatoum @ 2020-04-24 16:01 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

While the regulator is indeed powered by the PMIC, basically the whole
system is, and it's always on. Linux doesn't handle this specially
however and will defer SDMMC probe till after the PMIC is probed costing
us some valuable boot time. Fix this up.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/boards/lxa-mc1/board.c | 29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boards/lxa-mc1/board.c b/arch/arm/boards/lxa-mc1/board.c
index d36924fc2793..7f1f3ccd7e06 100644
--- a/arch/arm/boards/lxa-mc1/board.c
+++ b/arch/arm/boards/lxa-mc1/board.c
@@ -5,6 +5,28 @@
 #include <asm/memory.h>
 #include <mach/bbu.h>
 #include <bootsource.h>
+#include <of.h>
+
+static int of_fixup_regulator_supply_disable(struct device_node *root, void *path)
+{
+	struct device_node *node;
+	struct property *prop;
+
+	node = of_find_node_by_path_from(root, path);
+	if (!node) {
+		pr_warn("fixup for %s failed: not found\n", (const char *)path);
+		return -ENOENT;
+	}
+
+	if (!of_property_read_bool(node, "regulator-always-on"))
+		return 0;
+
+	prop = of_find_property(node, "vin-supply", NULL);
+	if (prop)
+		of_delete_property(prop);
+
+	return 0;
+}
 
 static int mc1_device_init(void)
 {
@@ -26,6 +48,11 @@ static int mc1_device_init(void)
 
 	barebox_set_hostname("lxa-mc1");
 
-	return 0;
+	/* The regulator is powered by the PMIC, but is always on as far as
+	 * software is concerned. Break the reference to the PMIC, so the OS
+	 * doesn't need to defer SDMMC/Ethernet peripherals till after the PMIC
+	 * is up.
+	 */
+	return of_register_fixup(of_fixup_regulator_supply_disable, "/regulator_3v3");
 }
 device_initcall(mc1_device_init);
-- 
2.26.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 3/3] ARM: stm32mp: expand stm32mp_defconfig for new drivers and board
  2020-04-24 16:01 [PATCH 1/3] ARM: stm32mp: add Linux Automation MC-1 support Ahmad Fatoum
  2020-04-24 16:01 ` [PATCH 2/3] ARM: stm32mp: lxa-mc1: break reg_3v3 dependency on PMIC Ahmad Fatoum
@ 2020-04-24 16:01 ` Ahmad Fatoum
  2020-04-27  7:32 ` [PATCH 1/3] ARM: stm32mp: add Linux Automation MC-1 support Sascha Hauer
  2 siblings, 0 replies; 8+ messages in thread
From: Ahmad Fatoum @ 2020-04-24 16:01 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

While some support is still missing (USB, LCD), we already have some
prerequisites in place like USB PHY and PWM (for backlight). We also have
gained one new board and some other new drivers since the last time the
defconfig was touched, so enable them all, as well as some possibly useful
commands.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 Documentation/boards/stm32mp.rst   |  1 +
 arch/arm/configs/stm32mp_defconfig | 28 +++++++++++++++++++++++-----
 2 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/Documentation/boards/stm32mp.rst b/Documentation/boards/stm32mp.rst
index de793ab3c96e..607c59fd0757 100644
--- a/Documentation/boards/stm32mp.rst
+++ b/Documentation/boards/stm32mp.rst
@@ -30,6 +30,7 @@ The resulting images will be placed under ``images/``:
 ::
 
   barebox-stm32mp157c-dk2.img
+  barebox-stm32mp157c-lxa-mc1.img
 
 
 Flashing barebox
diff --git a/arch/arm/configs/stm32mp_defconfig b/arch/arm/configs/stm32mp_defconfig
index f69f9f966a2d..4b902e174113 100644
--- a/arch/arm/configs/stm32mp_defconfig
+++ b/arch/arm/configs/stm32mp_defconfig
@@ -1,5 +1,6 @@
 CONFIG_ARCH_STM32MP=y
 CONFIG_MACH_STM32MP157C_DK2=y
+CONFIG_MACH_LXA_MC1=y
 CONFIG_THUMB2_BAREBOX=y
 CONFIG_ARM_BOARD_APPEND_ATAG=y
 CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
@@ -27,13 +28,14 @@ CONFIG_PARTITION_DISK_EFI=y
 # CONFIG_PARTITION_DISK_EFI_GPT_COMPARE is not set
 CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW=y
 CONFIG_RESET_SOURCE=y
-CONFIG_MACHINE_ID=y
 CONFIG_CMD_DMESG=y
 CONFIG_LONGHELP=y
 CONFIG_CMD_IOMEM=y
 CONFIG_CMD_IMD=y
 CONFIG_CMD_MEMINFO=y
 CONFIG_CMD_ARM_MMUINFO=y
+CONFIG_CMD_REGULATOR=y
+CONFIG_CMD_MMC=y
 # CONFIG_CMD_BOOTU is not set
 CONFIG_CMD_GO=y
 CONFIG_CMD_RESET=y
@@ -73,8 +75,10 @@ CONFIG_CMD_DETECT=y
 CONFIG_CMD_FLASH=y
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_LED=y
+CONFIG_CMD_POWEROFF=y
 CONFIG_CMD_WD=y
 CONFIG_CMD_BAREBOX_UPDATE=y
+CONFIG_CMD_OF_DIFF=y
 CONFIG_CMD_OF_NODE=y
 CONFIG_CMD_OF_PROPERTY=y
 CONFIG_CMD_OFTREE=y
@@ -84,8 +88,6 @@ CONFIG_NET_NETCONSOLE=y
 CONFIG_OFDEVICE=y
 CONFIG_OF_BAREBOX_DRIVERS=y
 CONFIG_DRIVER_SERIAL_STM32=y
-CONFIG_DRIVER_NET_DESIGNWARE=y
-CONFIG_DRIVER_NET_DESIGNWARE_GENERIC=y
 CONFIG_DRIVER_NET_DESIGNWARE_EQOS=y
 CONFIG_DRIVER_NET_DESIGNWARE_STM32=y
 CONFIG_AT803X_PHY=y
@@ -94,23 +96,40 @@ CONFIG_REALTEK_PHY=y
 # CONFIG_SPI is not set
 CONFIG_I2C=y
 CONFIG_I2C_STM32=y
+CONFIG_VIDEO=y
+CONFIG_DRIVER_VIDEO_BACKLIGHT=y
+CONFIG_DRIVER_VIDEO_SIMPLE_PANEL=y
 CONFIG_MCI=y
 CONFIG_MCI_STARTUP=y
+CONFIG_MCI_MMC_BOOT_PARTITIONS=y
 CONFIG_MCI_STM32_SDMMC2=y
 CONFIG_MFD_STPMIC1=y
+CONFIG_MFD_STM32_TIMERS=y
 CONFIG_LED=y
 CONFIG_LED_GPIO=y
+CONFIG_LED_PWM=y
 CONFIG_LED_GPIO_OF=y
+CONFIG_EEPROM_AT24=y
+CONFIG_KEYBOARD_GPIO=y
+CONFIG_INPUT_SPECIALKEYS=y
 CONFIG_WATCHDOG=y
 CONFIG_WATCHDOG_POLLER=y
 CONFIG_STM32_IWDG_WATCHDOG=y
 CONFIG_STPMIC1_WATCHDOG=y
-CONFIG_NVMEM=y
+CONFIG_PWM=y
+CONFIG_PWM_STM32=y
+CONFIG_HWRNG=y
+CONFIG_HWRNG_STM32=y
 CONFIG_STM32_BSEC=y
 CONFIG_REGULATOR=y
 CONFIG_REGULATOR_FIXED=y
+CONFIG_REGULATOR_STM32_PWR=y
 CONFIG_REGULATOR_STPMIC1=y
+CONFIG_REMOTEPROC=y
+CONFIG_STM32_REMOTEPROC=y
 CONFIG_RESET_STM32=y
+CONFIG_GENERIC_PHY=y
+CONFIG_PHY_STM32_USBPHYC=y
 CONFIG_FS_EXT4=y
 CONFIG_FS_TFTP=y
 CONFIG_FS_NFS=y
@@ -119,4 +138,3 @@ CONFIG_FS_FAT_WRITE=y
 CONFIG_FS_FAT_LFN=y
 CONFIG_ZLIB=y
 CONFIG_CRC8=y
-CONFIG_DIGEST_SHA1_ARM=y
-- 
2.26.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH 1/3] ARM: stm32mp: add Linux Automation MC-1 support
  2020-04-24 16:01 [PATCH 1/3] ARM: stm32mp: add Linux Automation MC-1 support Ahmad Fatoum
  2020-04-24 16:01 ` [PATCH 2/3] ARM: stm32mp: lxa-mc1: break reg_3v3 dependency on PMIC Ahmad Fatoum
  2020-04-24 16:01 ` [PATCH 3/3] ARM: stm32mp: expand stm32mp_defconfig for new drivers and board Ahmad Fatoum
@ 2020-04-27  7:32 ` Sascha Hauer
  2020-04-27  7:37   ` Ahmad Fatoum
  2 siblings, 1 reply; 8+ messages in thread
From: Sascha Hauer @ 2020-04-27  7:32 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On Fri, Apr 24, 2020 at 06:01:09PM +0200, Ahmad Fatoum wrote:
> This adds support for the Linux Automation GmbH MC-1 board built around
> the Octavo Systems OSD32MP157C-512M SiP.
> 
> The device tree is based on the one in linux-stm32/stm32-next, which
> will probably be merged for Linux v5.8-rc1. Instead of waiting that
> long, we import it here with some stuff removed/changed, so it's usable
> for both barebox and Linux, without the prerequisite patches.
> 
> The non-barebox specific parts have been moved into separate DTSIs
> (arch/arm/dts/stm32mp{157c-lxa-mc1,15xx-osd32}.dtsi), so both can be
> dropped after the v5.8-rc1 sync with only include path change necessary
> in arch/arm/dts/stm32mp157c-lxa-mc1.dts.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
>  arch/arm/boards/Makefile              |   1 +
>  arch/arm/boards/lxa-mc1/Makefile      |   2 +
>  arch/arm/boards/lxa-mc1/board.c       |  31 +++
>  arch/arm/boards/lxa-mc1/lowlevel.c    |  26 ++
>  arch/arm/dts/Makefile                 |   1 +
>  arch/arm/dts/stm32mp157c-lxa-mc1.dts  |  42 +++
>  arch/arm/dts/stm32mp157c-lxa-mc1.dtsi | 362 ++++++++++++++++++++++++++
>  arch/arm/dts/stm32mp15xx-osd32.dtsi   | 229 ++++++++++++++++
>  arch/arm/mach-stm32mp/Kconfig         |   4 +
>  images/Makefile.stm32mp               |   5 +
>  10 files changed, 703 insertions(+)
>  create mode 100644 arch/arm/boards/lxa-mc1/Makefile
>  create mode 100644 arch/arm/boards/lxa-mc1/board.c
>  create mode 100644 arch/arm/boards/lxa-mc1/lowlevel.c
>  create mode 100644 arch/arm/dts/stm32mp157c-lxa-mc1.dts
>  create mode 100644 arch/arm/dts/stm32mp157c-lxa-mc1.dtsi
>  create mode 100644 arch/arm/dts/stm32mp15xx-osd32.dtsi
> 
> diff --git a/arch/arm/boards/Makefile b/arch/arm/boards/Makefile
> index 9fe458e0a390..e9e9163d589b 100644
> --- a/arch/arm/boards/Makefile
> +++ b/arch/arm/boards/Makefile
> @@ -129,6 +129,7 @@ obj-$(CONFIG_MACH_SOCFPGA_TERASIC_SOCKIT)	+= terasic-sockit/
>  obj-$(CONFIG_MACH_SOLIDRUN_CUBOX)		+= solidrun-cubox/
>  obj-$(CONFIG_MACH_SOLIDRUN_MICROSOM)		+= solidrun-microsom/
>  obj-$(CONFIG_MACH_STM32MP157C_DK2)		+= stm32mp157c-dk2/
> +obj-$(CONFIG_MACH_LXA_MC1)			+= lxa-mc1/
>  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/lxa-mc1/Makefile b/arch/arm/boards/lxa-mc1/Makefile
> new file mode 100644
> index 000000000000..092c31d6b28d
> --- /dev/null
> +++ b/arch/arm/boards/lxa-mc1/Makefile
> @@ -0,0 +1,2 @@
> +lwl-y += lowlevel.o
> +obj-y += board.o
> diff --git a/arch/arm/boards/lxa-mc1/board.c b/arch/arm/boards/lxa-mc1/board.c
> new file mode 100644
> index 000000000000..d36924fc2793
> --- /dev/null
> +++ b/arch/arm/boards/lxa-mc1/board.c
> @@ -0,0 +1,31 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +#include <common.h>
> +#include <linux/sizes.h>
> +#include <init.h>
> +#include <asm/memory.h>
> +#include <mach/bbu.h>
> +#include <bootsource.h>
> +
> +static int mc1_device_init(void)
> +{
> +	int flags;
> +	if (!of_machine_is_compatible("lxa,stm32mp157c-mc1"))
> +		return 0;
> +
> +	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");

The paths are both enabled already, did you forget to set status =
"disabled" in the device tree?

> +/ {
> +	chosen {
> +		environment-sd {
> +			compatible = "barebox,environment";
> +			device-path = &sdmmc1, "partname:barebox-environment";
> +		};
> +
> +		environment-emmc {
> +			compatible = "barebox,environment";
> +			device-path = &sdmmc2, "partname:barebox-environment";
> +		};
> +	};
> +
> +};

Sascha


-- 
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 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH 1/3] ARM: stm32mp: add Linux Automation MC-1 support
  2020-04-27  7:32 ` [PATCH 1/3] ARM: stm32mp: add Linux Automation MC-1 support Sascha Hauer
@ 2020-04-27  7:37   ` Ahmad Fatoum
  2020-04-27  7:38     ` Sascha Hauer
  0 siblings, 1 reply; 8+ messages in thread
From: Ahmad Fatoum @ 2020-04-27  7:37 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox



On 4/27/20 9:32 AM, Sascha Hauer wrote:
> On Fri, Apr 24, 2020 at 06:01:09PM +0200, Ahmad Fatoum wrote:
>> This adds support for the Linux Automation GmbH MC-1 board built around
>> the Octavo Systems OSD32MP157C-512M SiP.
>>
>> The device tree is based on the one in linux-stm32/stm32-next, which
>> will probably be merged for Linux v5.8-rc1. Instead of waiting that
>> long, we import it here with some stuff removed/changed, so it's usable
>> for both barebox and Linux, without the prerequisite patches.
>>
>> The non-barebox specific parts have been moved into separate DTSIs
>> (arch/arm/dts/stm32mp{157c-lxa-mc1,15xx-osd32}.dtsi), so both can be
>> dropped after the v5.8-rc1 sync with only include path change necessary
>> in arch/arm/dts/stm32mp157c-lxa-mc1.dts.
>>
>> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
>> ---
>>  arch/arm/boards/Makefile              |   1 +
>>  arch/arm/boards/lxa-mc1/Makefile      |   2 +
>>  arch/arm/boards/lxa-mc1/board.c       |  31 +++
>>  arch/arm/boards/lxa-mc1/lowlevel.c    |  26 ++
>>  arch/arm/dts/Makefile                 |   1 +
>>  arch/arm/dts/stm32mp157c-lxa-mc1.dts  |  42 +++
>>  arch/arm/dts/stm32mp157c-lxa-mc1.dtsi | 362 ++++++++++++++++++++++++++
>>  arch/arm/dts/stm32mp15xx-osd32.dtsi   | 229 ++++++++++++++++
>>  arch/arm/mach-stm32mp/Kconfig         |   4 +
>>  images/Makefile.stm32mp               |   5 +
>>  10 files changed, 703 insertions(+)
>>  create mode 100644 arch/arm/boards/lxa-mc1/Makefile
>>  create mode 100644 arch/arm/boards/lxa-mc1/board.c
>>  create mode 100644 arch/arm/boards/lxa-mc1/lowlevel.c
>>  create mode 100644 arch/arm/dts/stm32mp157c-lxa-mc1.dts
>>  create mode 100644 arch/arm/dts/stm32mp157c-lxa-mc1.dtsi
>>  create mode 100644 arch/arm/dts/stm32mp15xx-osd32.dtsi
>>
>> diff --git a/arch/arm/boards/Makefile b/arch/arm/boards/Makefile
>> index 9fe458e0a390..e9e9163d589b 100644
>> --- a/arch/arm/boards/Makefile
>> +++ b/arch/arm/boards/Makefile
>> @@ -129,6 +129,7 @@ obj-$(CONFIG_MACH_SOCFPGA_TERASIC_SOCKIT)	+= terasic-sockit/
>>  obj-$(CONFIG_MACH_SOLIDRUN_CUBOX)		+= solidrun-cubox/
>>  obj-$(CONFIG_MACH_SOLIDRUN_MICROSOM)		+= solidrun-microsom/
>>  obj-$(CONFIG_MACH_STM32MP157C_DK2)		+= stm32mp157c-dk2/
>> +obj-$(CONFIG_MACH_LXA_MC1)			+= lxa-mc1/
>>  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/lxa-mc1/Makefile b/arch/arm/boards/lxa-mc1/Makefile
>> new file mode 100644
>> index 000000000000..092c31d6b28d
>> --- /dev/null
>> +++ b/arch/arm/boards/lxa-mc1/Makefile
>> @@ -0,0 +1,2 @@
>> +lwl-y += lowlevel.o
>> +obj-y += board.o
>> diff --git a/arch/arm/boards/lxa-mc1/board.c b/arch/arm/boards/lxa-mc1/board.c
>> new file mode 100644
>> index 000000000000..d36924fc2793
>> --- /dev/null
>> +++ b/arch/arm/boards/lxa-mc1/board.c
>> @@ -0,0 +1,31 @@
>> +// SPDX-License-Identifier: GPL-2.0+
>> +#include <common.h>
>> +#include <linux/sizes.h>
>> +#include <init.h>
>> +#include <asm/memory.h>
>> +#include <mach/bbu.h>
>> +#include <bootsource.h>
>> +
>> +static int mc1_device_init(void)
>> +{
>> +	int flags;
>> +	if (!of_machine_is_compatible("lxa,stm32mp157c-mc1"))
>> +		return 0;
>> +
>> +	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");
> 
> The paths are both enabled already, did you forget to set status =
> "disabled" in the device tree?

Looks like it. Will fix in v2.

> 
>> +/ {
>> +	chosen {
>> +		environment-sd {
>> +			compatible = "barebox,environment";
>> +			device-path = &sdmmc1, "partname:barebox-environment";
>> +		};
>> +
>> +		environment-emmc {
>> +			compatible = "barebox,environment";
>> +			device-path = &sdmmc2, "partname:barebox-environment";
>> +		};
>> +	};
>> +
>> +};
> 
> Sascha
> 
> 

-- 
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 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH 1/3] ARM: stm32mp: add Linux Automation MC-1 support
  2020-04-27  7:37   ` Ahmad Fatoum
@ 2020-04-27  7:38     ` Sascha Hauer
  0 siblings, 0 replies; 8+ messages in thread
From: Sascha Hauer @ 2020-04-27  7:38 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On Mon, Apr 27, 2020 at 09:37:22AM +0200, Ahmad Fatoum wrote:
> 
> 
> On 4/27/20 9:32 AM, Sascha Hauer wrote:
> > On Fri, Apr 24, 2020 at 06:01:09PM +0200, Ahmad Fatoum wrote:
> >> This adds support for the Linux Automation GmbH MC-1 board built around
> >> the Octavo Systems OSD32MP157C-512M SiP.
> >>
> >> The device tree is based on the one in linux-stm32/stm32-next, which
> >> will probably be merged for Linux v5.8-rc1. Instead of waiting that
> >> long, we import it here with some stuff removed/changed, so it's usable
> >> for both barebox and Linux, without the prerequisite patches.
> >>
> >> The non-barebox specific parts have been moved into separate DTSIs
> >> (arch/arm/dts/stm32mp{157c-lxa-mc1,15xx-osd32}.dtsi), so both can be
> >> dropped after the v5.8-rc1 sync with only include path change necessary
> >> in arch/arm/dts/stm32mp157c-lxa-mc1.dts.
> >>
> >> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> >> ---
> >>  arch/arm/boards/Makefile              |   1 +
> >>  arch/arm/boards/lxa-mc1/Makefile      |   2 +
> >>  arch/arm/boards/lxa-mc1/board.c       |  31 +++
> >>  arch/arm/boards/lxa-mc1/lowlevel.c    |  26 ++
> >>  arch/arm/dts/Makefile                 |   1 +
> >>  arch/arm/dts/stm32mp157c-lxa-mc1.dts  |  42 +++
> >>  arch/arm/dts/stm32mp157c-lxa-mc1.dtsi | 362 ++++++++++++++++++++++++++
> >>  arch/arm/dts/stm32mp15xx-osd32.dtsi   | 229 ++++++++++++++++
> >>  arch/arm/mach-stm32mp/Kconfig         |   4 +
> >>  images/Makefile.stm32mp               |   5 +
> >>  10 files changed, 703 insertions(+)
> >>  create mode 100644 arch/arm/boards/lxa-mc1/Makefile
> >>  create mode 100644 arch/arm/boards/lxa-mc1/board.c
> >>  create mode 100644 arch/arm/boards/lxa-mc1/lowlevel.c
> >>  create mode 100644 arch/arm/dts/stm32mp157c-lxa-mc1.dts
> >>  create mode 100644 arch/arm/dts/stm32mp157c-lxa-mc1.dtsi
> >>  create mode 100644 arch/arm/dts/stm32mp15xx-osd32.dtsi
> >>
> >> diff --git a/arch/arm/boards/Makefile b/arch/arm/boards/Makefile
> >> index 9fe458e0a390..e9e9163d589b 100644
> >> --- a/arch/arm/boards/Makefile
> >> +++ b/arch/arm/boards/Makefile
> >> @@ -129,6 +129,7 @@ obj-$(CONFIG_MACH_SOCFPGA_TERASIC_SOCKIT)	+= terasic-sockit/
> >>  obj-$(CONFIG_MACH_SOLIDRUN_CUBOX)		+= solidrun-cubox/
> >>  obj-$(CONFIG_MACH_SOLIDRUN_MICROSOM)		+= solidrun-microsom/
> >>  obj-$(CONFIG_MACH_STM32MP157C_DK2)		+= stm32mp157c-dk2/
> >> +obj-$(CONFIG_MACH_LXA_MC1)			+= lxa-mc1/
> >>  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/lxa-mc1/Makefile b/arch/arm/boards/lxa-mc1/Makefile
> >> new file mode 100644
> >> index 000000000000..092c31d6b28d
> >> --- /dev/null
> >> +++ b/arch/arm/boards/lxa-mc1/Makefile
> >> @@ -0,0 +1,2 @@
> >> +lwl-y += lowlevel.o
> >> +obj-y += board.o
> >> diff --git a/arch/arm/boards/lxa-mc1/board.c b/arch/arm/boards/lxa-mc1/board.c
> >> new file mode 100644
> >> index 000000000000..d36924fc2793
> >> --- /dev/null
> >> +++ b/arch/arm/boards/lxa-mc1/board.c
> >> @@ -0,0 +1,31 @@
> >> +// SPDX-License-Identifier: GPL-2.0+
> >> +#include <common.h>
> >> +#include <linux/sizes.h>
> >> +#include <init.h>
> >> +#include <asm/memory.h>
> >> +#include <mach/bbu.h>
> >> +#include <bootsource.h>
> >> +
> >> +static int mc1_device_init(void)
> >> +{
> >> +	int flags;
> >> +	if (!of_machine_is_compatible("lxa,stm32mp157c-mc1"))
> >> +		return 0;
> >> +
> >> +	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");
> > 
> > The paths are both enabled already, did you forget to set status =
> > "disabled" in the device tree?
> 
> Looks like it. Will fix in v2.

Ok, thanks. Otherwise the series looks fine.

Sascha

-- 
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 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH] fixup! ARM: stm32mp: add Linux Automation MC-1 support
  2020-04-24 16:01 ` [PATCH 2/3] ARM: stm32mp: lxa-mc1: break reg_3v3 dependency on PMIC Ahmad Fatoum
@ 2020-04-27  7:45   ` Ahmad Fatoum
  2020-04-28  7:47     ` Sascha Hauer
  0 siblings, 1 reply; 8+ messages in thread
From: Ahmad Fatoum @ 2020-04-27  7:45 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum, sha

Board code uses of_device_enable_path to enable the correct node,
so make them disabled-by-default.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/dts/stm32mp157c-lxa-mc1.dts | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/dts/stm32mp157c-lxa-mc1.dts b/arch/arm/dts/stm32mp157c-lxa-mc1.dts
index 742739424ea7..57baaf4005d2 100644
--- a/arch/arm/dts/stm32mp157c-lxa-mc1.dts
+++ b/arch/arm/dts/stm32mp157c-lxa-mc1.dts
@@ -11,11 +11,13 @@
 		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";
 		};
 	};
 
-- 
2.26.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH] fixup! ARM: stm32mp: add Linux Automation MC-1 support
  2020-04-27  7:45   ` [PATCH] fixup! ARM: stm32mp: add Linux Automation MC-1 support Ahmad Fatoum
@ 2020-04-28  7:47     ` Sascha Hauer
  0 siblings, 0 replies; 8+ messages in thread
From: Sascha Hauer @ 2020-04-28  7:47 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On Mon, Apr 27, 2020 at 09:45:34AM +0200, Ahmad Fatoum wrote:
> Board code uses of_device_enable_path to enable the correct node,
> so make them disabled-by-default.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
>  arch/arm/dts/stm32mp157c-lxa-mc1.dts | 2 ++
>  1 file changed, 2 insertions(+)

Applied the series with this fixup.

Sascha

-- 
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 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2020-04-28  7:47 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-24 16:01 [PATCH 1/3] ARM: stm32mp: add Linux Automation MC-1 support Ahmad Fatoum
2020-04-24 16:01 ` [PATCH 2/3] ARM: stm32mp: lxa-mc1: break reg_3v3 dependency on PMIC Ahmad Fatoum
2020-04-27  7:45   ` [PATCH] fixup! ARM: stm32mp: add Linux Automation MC-1 support Ahmad Fatoum
2020-04-28  7:47     ` Sascha Hauer
2020-04-24 16:01 ` [PATCH 3/3] ARM: stm32mp: expand stm32mp_defconfig for new drivers and board Ahmad Fatoum
2020-04-27  7:32 ` [PATCH 1/3] ARM: stm32mp: add Linux Automation MC-1 support Sascha Hauer
2020-04-27  7:37   ` Ahmad Fatoum
2020-04-27  7:38     ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox