* [PATCH v1 1/7] arm: dts: imx8mp-skov: Add reserved-memory for ramoops pstore
@ 2023-09-28 10:58 Oleksij Rempel
2023-09-28 10:58 ` [PATCH v1 2/7] arm: dts: imx8mp-skov: Add pins for hardware variant detection Oleksij Rempel
` (5 more replies)
0 siblings, 6 replies; 9+ messages in thread
From: Oleksij Rempel @ 2023-09-28 10:58 UTC (permalink / raw)
To: barebox; +Cc: Oleksij Rempel
Add a reserved-memory node for 'ramoops' in imx8mp-skov device tree to enable
persistent storage of logs.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
arch/arm/dts/imx8mp-skov.dts | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/arch/arm/dts/imx8mp-skov.dts b/arch/arm/dts/imx8mp-skov.dts
index b7f6fed4b7..4c83bb6bc2 100644
--- a/arch/arm/dts/imx8mp-skov.dts
+++ b/arch/arm/dts/imx8mp-skov.dts
@@ -62,6 +62,17 @@ led-2 {
};
};
+ reserved-memory {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ ranges;
+
+ /* Address will be determined by the bootloader */
+ ramoops {
+ compatible = "ramoops";
+ };
+ };
+
reg_usdhc2_vmmc: regulator-usdhc2 {
compatible = "regulator-fixed";
pinctrl-names = "default";
--
2.39.2
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v1 2/7] arm: dts: imx8mp-skov: Add pins for hardware variant detection
2023-09-28 10:58 [PATCH v1 1/7] arm: dts: imx8mp-skov: Add reserved-memory for ramoops pstore Oleksij Rempel
@ 2023-09-28 10:58 ` Oleksij Rempel
2023-09-28 10:58 ` [PATCH v1 3/7] arm: dts: imx8mp-skov: Switch to GPT for eMMC partitioning Oleksij Rempel
` (4 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Oleksij Rempel @ 2023-09-28 10:58 UTC (permalink / raw)
To: barebox; +Cc: Oleksij Rempel
Define pins in imx8mp-skov device tree for detecting hardware variants.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
arch/arm/dts/imx8mp-skov.dts | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/arch/arm/dts/imx8mp-skov.dts b/arch/arm/dts/imx8mp-skov.dts
index 4c83bb6bc2..4b73022938 100644
--- a/arch/arm/dts/imx8mp-skov.dts
+++ b/arch/arm/dts/imx8mp-skov.dts
@@ -369,6 +369,23 @@ &wdog1 {
};
&iomuxc {
+ pinctrl-names = "default";
+ pinctrl-0 = <&pinctrl_hog>;
+
+ pinctrl_hog: hoggrp {
+ fsl,pins = <
+ /* varaint id */
+ MX8MP_IOMUXC_GPIO1_IO08__GPIO1_IO08 0x100
+ MX8MP_IOMUXC_GPIO1_IO09__GPIO1_IO09 0x100
+ MX8MP_IOMUXC_GPIO1_IO10__GPIO1_IO10 0x100
+ MX8MP_IOMUXC_GPIO1_IO11__GPIO1_IO11 0x100
+ MX8MP_IOMUXC_GPIO1_IO12__GPIO1_IO12 0x100
+ MX8MP_IOMUXC_GPIO1_IO13__GPIO1_IO13 0x100
+ MX8MP_IOMUXC_GPIO1_IO14__GPIO1_IO14 0x100
+ MX8MP_IOMUXC_GPIO1_IO15__GPIO1_IO15 0x100
+ >;
+ };
+
pinctrl_eqos: eqosgrp {
fsl,pins = <
MX8MP_IOMUXC_ENET_RD0__ENET_QOS_RGMII_RD0 0x91
--
2.39.2
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v1 3/7] arm: dts: imx8mp-skov: Switch to GPT for eMMC partitioning
2023-09-28 10:58 [PATCH v1 1/7] arm: dts: imx8mp-skov: Add reserved-memory for ramoops pstore Oleksij Rempel
2023-09-28 10:58 ` [PATCH v1 2/7] arm: dts: imx8mp-skov: Add pins for hardware variant detection Oleksij Rempel
@ 2023-09-28 10:58 ` Oleksij Rempel
2023-09-28 10:58 ` [PATCH v1 4/7] arm: dts: imx8mp-skov: Simplify SD partition definition to 1 cell Oleksij Rempel
` (3 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Oleksij Rempel @ 2023-09-28 10:58 UTC (permalink / raw)
To: barebox; +Cc: Oleksij Rempel
Move away from using device tree to define eMMC partitions for
imx8mp-skov. Adopt GPT based partitioning, specifically for the
barebox-environment. And prepare it for state partition in the next
patch.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
arch/arm/dts/imx8mp-skov.dts | 20 +-------------------
1 file changed, 1 insertion(+), 19 deletions(-)
diff --git a/arch/arm/dts/imx8mp-skov.dts b/arch/arm/dts/imx8mp-skov.dts
index 4b73022938..1d4738dbd7 100644
--- a/arch/arm/dts/imx8mp-skov.dts
+++ b/arch/arm/dts/imx8mp-skov.dts
@@ -22,7 +22,7 @@ environment-sd {
environment-emmc {
compatible = "barebox,environment";
- device-path = &env_emmc;
+ device-path = &usdhc3, "partname:barebox-environment";
status = "disabled";
};
};
@@ -103,24 +103,6 @@ env_sd: partition@e0000 {
};
};
-&usdhc3 {
- partitions {
- compatible = "fixed-partitions";
- #address-cells = <2>;
- #size-cells = <2>;
-
- partition@0 {
- label = "barebox";
- reg = <0x0 0x0 0x0 0x100000>;
- };
-
- env_emmc: partition@e0000 {
- label = "barebox-environment";
- reg = <0x0 0x100000 0x0 0x100000>;
- };
- };
-};
-
&A53_0 {
cpu-supply = <&buck2>;
};
--
2.39.2
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v1 4/7] arm: dts: imx8mp-skov: Simplify SD partition definition to 1 cell
2023-09-28 10:58 [PATCH v1 1/7] arm: dts: imx8mp-skov: Add reserved-memory for ramoops pstore Oleksij Rempel
2023-09-28 10:58 ` [PATCH v1 2/7] arm: dts: imx8mp-skov: Add pins for hardware variant detection Oleksij Rempel
2023-09-28 10:58 ` [PATCH v1 3/7] arm: dts: imx8mp-skov: Switch to GPT for eMMC partitioning Oleksij Rempel
@ 2023-09-28 10:58 ` Oleksij Rempel
2023-09-28 20:13 ` Ahmad Fatoum
2023-09-28 10:58 ` [PATCH v1 5/7] arm: dts: imx8mp-skov: Add barebox state backend in DTS Oleksij Rempel
` (2 subsequent siblings)
5 siblings, 1 reply; 9+ messages in thread
From: Oleksij Rempel @ 2023-09-28 10:58 UTC (permalink / raw)
To: barebox; +Cc: Oleksij Rempel
Update the partition definitions for SD card in imx8mp-skov to use
single cell for address and size, streamlining the format.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
arch/arm/dts/imx8mp-skov.dts | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/arch/arm/dts/imx8mp-skov.dts b/arch/arm/dts/imx8mp-skov.dts
index 1d4738dbd7..b94b9dd51d 100644
--- a/arch/arm/dts/imx8mp-skov.dts
+++ b/arch/arm/dts/imx8mp-skov.dts
@@ -88,17 +88,17 @@ reg_usdhc2_vmmc: regulator-usdhc2 {
&usdhc2 {
partitions {
compatible = "fixed-partitions";
- #address-cells = <2>;
- #size-cells = <2>;
+ #address-cells = <1>;
+ #size-cells = <1>;
partition@0 {
label = "barebox";
- reg = <0x0 0x0 0x0 0x100000>;
+ reg = <0x0 0x100000>;
};
- env_sd: partition@e0000 {
+ env_sd: partition@100000 {
label = "barebox-environment";
- reg = <0x0 0x100000 0x0 0x100000>;
+ reg = <0x100000 0x100000>;
};
};
};
--
2.39.2
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v1 5/7] arm: dts: imx8mp-skov: Add barebox state backend in DTS
2023-09-28 10:58 [PATCH v1 1/7] arm: dts: imx8mp-skov: Add reserved-memory for ramoops pstore Oleksij Rempel
` (2 preceding siblings ...)
2023-09-28 10:58 ` [PATCH v1 4/7] arm: dts: imx8mp-skov: Simplify SD partition definition to 1 cell Oleksij Rempel
@ 2023-09-28 10:58 ` Oleksij Rempel
2023-09-28 10:58 ` [PATCH v1 6/7] ARM: i.MX8MP: skov: refactor bootsource and BBU handlers Oleksij Rempel
2023-09-28 10:58 ` [PATCH v1 7/7] ARM: i.MX8MP: skov: Add hardware variant support Oleksij Rempel
5 siblings, 0 replies; 9+ messages in thread
From: Oleksij Rempel @ 2023-09-28 10:58 UTC (permalink / raw)
To: barebox; +Cc: Oleksij Rempel
Introduce 'state' node to manage device states using barebox state framework.
Set backend to usdhc3 and define storage parameters.
For now, reuse existing layout from Skov i.MX6 variants.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
arch/arm/dts/imx8mp-skov.dts | 105 +++++++++++++++++++++++++++++++++++
1 file changed, 105 insertions(+)
diff --git a/arch/arm/dts/imx8mp-skov.dts b/arch/arm/dts/imx8mp-skov.dts
index b94b9dd51d..7d6514f04b 100644
--- a/arch/arm/dts/imx8mp-skov.dts
+++ b/arch/arm/dts/imx8mp-skov.dts
@@ -31,6 +31,7 @@ aliases {
ethernet0 = &eqos;
ethernet1 = &lan1;
ethernet2 = &lan2;
+ state = &state;
};
leds {
@@ -83,6 +84,110 @@ reg_usdhc2_vmmc: regulator-usdhc2 {
gpio = <&gpio2 19 GPIO_ACTIVE_HIGH>;
enable-active-high;
};
+
+ state: state {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ magic = <0x1c5b3f49>;
+ compatible = "barebox,state";
+ backend-type = "raw";
+ backend = <&usdhc3>;
+ /*
+ * barebox-state partition size: 1 MiB
+ * nr. of redundant copies: 4
+ * ==> max. stride size: 1 MiB / 4 = 256 KiB = 262144 Byte
+ *
+ * stride size: 262144 Byte
+ * raw-header: - 16 Byte
+ * direct-storage: - 8 Byte
+ * ------------
+ * max state size: 262120 Byte
+ * ===========
+ */
+ backend-stridesize = <0x40000>;
+
+ bootstate {
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ system0 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ remaining_attempts@0 {
+ reg = <0x0 0x4>;
+ type = "uint32";
+ default = <3>;
+ };
+ priority@4 {
+ reg = <0x4 0x4>;
+ type = "uint32";
+ default = <30>;
+ };
+ };
+
+ system1 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ remaining_attempts@8 {
+ reg = <0x8 0x4>;
+ type = "uint32";
+ default = <3>;
+ };
+ priority@C {
+ reg = <0xC 0x4>;
+ type = "uint32";
+ default = <20>;
+ };
+ };
+
+ last_chosen@10 {
+ reg = <0x10 0x4>;
+ type = "uint32";
+ };
+ };
+
+ display {
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ xres@14 {
+ reg = <0x14 0x4>;
+ type = "uint32";
+ default = <0>;
+ };
+
+ yres@18 {
+ reg = <0x18 0x4>;
+ type = "uint32";
+ default = <0>;
+ };
+
+ brightness@1C {
+ reg = <0x1C 0x1>;
+ type = "uint8";
+ default = <8>;
+ };
+
+ external@1D {
+ reg = <0x1D 0x1>;
+ type = "uint8";
+ default = <0>;
+ };
+ };
+
+ ethaddr {
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ eth2@1e {
+ reg = <0x1E 0x6>;
+ type = "mac";
+ default = [00 11 22 33 44 55];
+ };
+ };
+ };
};
&usdhc2 {
--
2.39.2
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v1 6/7] ARM: i.MX8MP: skov: refactor bootsource and BBU handlers
2023-09-28 10:58 [PATCH v1 1/7] arm: dts: imx8mp-skov: Add reserved-memory for ramoops pstore Oleksij Rempel
` (3 preceding siblings ...)
2023-09-28 10:58 ` [PATCH v1 5/7] arm: dts: imx8mp-skov: Add barebox state backend in DTS Oleksij Rempel
@ 2023-09-28 10:58 ` Oleksij Rempel
2023-09-28 10:58 ` [PATCH v1 7/7] ARM: i.MX8MP: skov: Add hardware variant support Oleksij Rempel
5 siblings, 0 replies; 9+ messages in thread
From: Oleksij Rempel @ 2023-09-28 10:58 UTC (permalink / raw)
To: barebox; +Cc: Oleksij Rempel
Rework boot source and Barebox Update (BBU) handlers to support
multiple storage options in a scalable way. This commit allows for
easier extension and better maintainability.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
arch/arm/boards/skov-imx8mp/board.c | 105 +++++++++++++++++++++++++---
1 file changed, 95 insertions(+), 10 deletions(-)
diff --git a/arch/arm/boards/skov-imx8mp/board.c b/arch/arm/boards/skov-imx8mp/board.c
index 398c74677d..58aca69236 100644
--- a/arch/arm/boards/skov-imx8mp/board.c
+++ b/arch/arm/boards/skov-imx8mp/board.c
@@ -9,21 +9,106 @@
#include <mach/imx/bbu.h>
#include <mach/imx/iomux-mx8mp.h>
-static int skov_imx8mp_probe(struct device *dev)
+struct skov_imx8mp_storage {
+ const char *name;
+ const char *env_path;
+ const char *dev_path;
+ enum bootsource bootsource;
+ int bootsource_ext_id;
+ bool mmc_boot_part;
+};
+
+enum skov_imx8mp_boot_source {
+ SKOV_BOOT_SOURCE_EMMC,
+ SKOV_BOOT_SOURCE_SD,
+ SKOV_BOOT_SOURCE_UNKNOWN,
+};
+
+static const struct skov_imx8mp_storage skov_imx8mp_storages[] = {
+ [SKOV_BOOT_SOURCE_EMMC] = {
+ /* default boot source */
+ .name = "eMMC",
+ .env_path = "/chosen/environment-emmc",
+ .dev_path = "/dev/mmc2",
+ .bootsource = BOOTSOURCE_MMC,
+ .bootsource_ext_id = 2,
+ .mmc_boot_part = true,
+ },
+ [SKOV_BOOT_SOURCE_SD] = {
+ .name = "SD",
+ .env_path = "/chosen/environment-sd",
+ .dev_path = "/dev/mmc1.barebox",
+ .bootsource = BOOTSOURCE_MMC,
+ .bootsource_ext_id = 1,
+ },
+};
+
+static void skov_imx8mp_enable_env(struct device *dev,
+ const struct skov_imx8mp_storage *st,
+ bool *enabled)
{
- int emmc_bbu_flag = 0;
- int sd_bbu_flag = 0;
+ int ret;
- if (bootsource_get() == BOOTSOURCE_MMC && bootsource_get_instance() == 1) {
- of_device_enable_path("/chosen/environment-sd");
- sd_bbu_flag = BBU_HANDLER_FLAG_DEFAULT;
+ if (bootsource_get() != st->bootsource ||
+ bootsource_get_instance() != st->bootsource_ext_id)
+ return;
+
+ ret = of_device_enable_path(st->env_path);
+ if (ret) {
+ dev_err(dev, "Failed to enable environment path: %s, %pe\n",
+ st->env_path, ERR_PTR(ret));
+ return;
+ }
+
+ *enabled = true;
+}
+
+static void skov_imx8mp_add_bbu(struct device *dev,
+ const struct skov_imx8mp_storage *st,
+ bool default_env)
+{
+ unsigned long flags = 0;
+ int ret;
+
+ if (default_env)
+ flags |= BBU_HANDLER_FLAG_DEFAULT;
+
+ if (st->mmc_boot_part) {
+ ret = imx8m_bbu_internal_mmcboot_register_handler(st->name,
+ st->dev_path,
+ flags);
} else {
- of_device_enable_path("/chosen/environment-emmc");
- emmc_bbu_flag = BBU_HANDLER_FLAG_DEFAULT;
+ ret = imx8m_bbu_internal_mmc_register_handler(st->name,
+ st->dev_path,
+ flags);
+ }
+ if (ret)
+ dev_err(dev, "Failed to register %s BBU handler: %pe\n",
+ st->name, ERR_PTR(ret));
+}
+
+static void skov_imx8mp_init_storage(struct device *dev)
+{
+ int default_boot_src = SKOV_BOOT_SOURCE_EMMC;
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(skov_imx8mp_storages); i++) {
+ bool enabled_env = false;
+
+ skov_imx8mp_enable_env(dev, &skov_imx8mp_storages[i],
+ &enabled_env);
+ if (enabled_env)
+ default_boot_src = i;
}
- imx8m_bbu_internal_mmc_register_handler("SD", "/dev/mmc1.barebox", sd_bbu_flag);
- imx8m_bbu_internal_mmcboot_register_handler("eMMC", "/dev/mmc2", emmc_bbu_flag);
+ for (i = 0; i < ARRAY_SIZE(skov_imx8mp_storages); i++)
+ skov_imx8mp_add_bbu(dev, &skov_imx8mp_storages[i],
+ i == default_boot_src);
+}
+
+static int skov_imx8mp_probe(struct device *dev)
+{
+ skov_imx8mp_init_storage(dev);
return 0;
}
--
2.39.2
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v1 7/7] ARM: i.MX8MP: skov: Add hardware variant support
2023-09-28 10:58 [PATCH v1 1/7] arm: dts: imx8mp-skov: Add reserved-memory for ramoops pstore Oleksij Rempel
` (4 preceding siblings ...)
2023-09-28 10:58 ` [PATCH v1 6/7] ARM: i.MX8MP: skov: refactor bootsource and BBU handlers Oleksij Rempel
@ 2023-09-28 10:58 ` Oleksij Rempel
5 siblings, 0 replies; 9+ messages in thread
From: Oleksij Rempel @ 2023-09-28 10:58 UTC (permalink / raw)
To: barebox; +Cc: Oleksij Rempel
Introduce hardware variant detection in skov-imx8mp board. This
addition uses GPIOs to identify hardware versions and set the
appropriate device tree compatible strings accordingly.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
arch/arm/boards/skov-imx8mp/board.c | 128 ++++++++++++++++++++++++++++
1 file changed, 128 insertions(+)
diff --git a/arch/arm/boards/skov-imx8mp/board.c b/arch/arm/boards/skov-imx8mp/board.c
index 58aca69236..3a1cd83bbd 100644
--- a/arch/arm/boards/skov-imx8mp/board.c
+++ b/arch/arm/boards/skov-imx8mp/board.c
@@ -1,14 +1,30 @@
// SPDX-License-Identifier: GPL-2.0
+#include "linux/kernel.h"
#include <bootsource.h>
#include <common.h>
#include <deep-probe.h>
#include <envfs.h>
+#include <environment.h>
+#include <globalvar.h>
+#include <gpio.h>
#include <init.h>
#include <io.h>
#include <mach/imx/bbu.h>
+#include <mach/imx/generic.h>
#include <mach/imx/iomux-mx8mp.h>
+#define GPIO_HW_VARIANT {\
+ {IMX_GPIO_NR(1, 8), GPIOF_DIR_IN | GPIOF_ACTIVE_HIGH, "var0"}, \
+ {IMX_GPIO_NR(1, 9), GPIOF_DIR_IN | GPIOF_ACTIVE_HIGH, "var1"}, \
+ {IMX_GPIO_NR(1, 10), GPIOF_DIR_IN | GPIOF_ACTIVE_HIGH, "var2"}, \
+ {IMX_GPIO_NR(1, 11), GPIOF_DIR_IN | GPIOF_ACTIVE_HIGH, "var3"}, \
+ {IMX_GPIO_NR(1, 12), GPIOF_DIR_IN | GPIOF_ACTIVE_HIGH, "var4"}, \
+ {IMX_GPIO_NR(1, 13), GPIOF_DIR_IN | GPIOF_ACTIVE_HIGH, "var5"}, \
+ {IMX_GPIO_NR(1, 14), GPIOF_DIR_IN | GPIOF_ACTIVE_HIGH, "var6"}, \
+ {IMX_GPIO_NR(1, 15), GPIOF_DIR_IN | GPIOF_ACTIVE_HIGH, "var7"}, \
+}
+
struct skov_imx8mp_storage {
const char *name;
const char *env_path;
@@ -43,6 +59,116 @@ static const struct skov_imx8mp_storage skov_imx8mp_storages[] = {
},
};
+struct board_description {
+ const char *dts_compatible;
+ const char *dts_compatible_hdmi;
+ unsigned flags;
+};
+
+#define SKOV_IMX8MP_HAS_HDMI BIT(0)
+
+static const struct board_description imx8mp_variants[] = {
+ [0] = {
+ .dts_compatible = "skov,imx8mp-skov-revb-lt6",
+ },
+ [1] = {
+ .dts_compatible = "skov,imx8mp-skov-revb-mi1010ait-1cp1",
+ .dts_compatible_hdmi = "skov,imx8mp-skov-revb-hdmi",
+ .flags = SKOV_IMX8MP_HAS_HDMI,
+ },
+};
+
+static int skov_imx8mp_get_variant_id(uint *id)
+{
+ struct gpio gpios_rev[] = GPIO_HW_VARIANT;
+ struct device_node *gpio_np;
+ u32 hw_rev;
+ int ret;
+
+ gpio_np = of_find_node_by_name_address(NULL, "gpio@30200000");
+ if (!gpio_np)
+ return -ENODEV;
+
+ ret = of_device_ensure_probed(gpio_np);
+ if (ret)
+ return ret;
+
+ ret = gpio_array_to_id(gpios_rev, ARRAY_SIZE(gpios_rev), &hw_rev);
+ if (ret)
+ goto exit_get_id;
+
+ *id = hw_rev;
+
+ return 0;
+exit_get_id:
+ pr_err("Failed to read gpio ID: %pe\n", ERR_PTR(ret));
+ return ret;
+}
+
+static int skov_imx8mp_get_hdmi(struct device *dev)
+{
+ const char *env = "state.display.external";
+ struct device_node *state_np;
+ unsigned int val = 0;
+ int ret;
+
+ state_np = of_find_node_by_name_address(NULL, "state");
+ if (!state_np) {
+ dev_err(dev, "Failed to find state node\n");
+ return -ENODEV;
+ }
+
+ ret = of_device_ensure_probed(state_np);
+ if (ret) {
+ dev_err(dev, "Failed to probe state node: %pe\n", ERR_PTR(ret));
+ return ret;
+ }
+
+ ret = getenv_uint(env, &val);
+ if (ret) {
+ dev_err(dev, "Failed to read %s: %pe\n", env, ERR_PTR(ret));
+ return ret;
+ }
+
+ return val;
+}
+
+static int skov_imx8mp_init_variant(struct device *dev)
+{
+ const struct board_description *variant;
+ const char *compatible;
+ unsigned int v = 0;
+ int ret;
+
+ ret = skov_imx8mp_get_variant_id(&v);
+ if (ret)
+ return ret;
+
+ if (v >= ARRAY_SIZE(imx8mp_variants)) {
+ dev_err(dev, "Invalid variant %u\n", v);
+ return -EINVAL;
+ }
+
+ variant = &imx8mp_variants[v];
+
+ if (variant->flags & SKOV_IMX8MP_HAS_HDMI) {
+ ret = skov_imx8mp_get_hdmi(dev);
+ if (ret < 0)
+ return ret;
+
+ if (ret)
+ compatible = variant->dts_compatible_hdmi;
+ else
+ compatible = variant->dts_compatible;
+ } else {
+ compatible = variant->dts_compatible;
+ }
+
+ of_prepend_machine_compatible(NULL, compatible);
+
+ return 0;
+}
+
static void skov_imx8mp_enable_env(struct device *dev,
const struct skov_imx8mp_storage *st,
bool *enabled)
@@ -110,6 +236,8 @@ static int skov_imx8mp_probe(struct device *dev)
{
skov_imx8mp_init_storage(dev);
+ skov_imx8mp_init_variant(dev);
+
return 0;
}
--
2.39.2
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v1 4/7] arm: dts: imx8mp-skov: Simplify SD partition definition to 1 cell
2023-09-28 10:58 ` [PATCH v1 4/7] arm: dts: imx8mp-skov: Simplify SD partition definition to 1 cell Oleksij Rempel
@ 2023-09-28 20:13 ` Ahmad Fatoum
2023-09-29 4:38 ` Oleksij Rempel
0 siblings, 1 reply; 9+ messages in thread
From: Ahmad Fatoum @ 2023-09-28 20:13 UTC (permalink / raw)
To: Oleksij Rempel, barebox
Hello Oleksij,
On 28.09.23 12:58, Oleksij Rempel wrote:
> Update the partition definitions for SD card in imx8mp-skov to use
> single cell for address and size, streamlining the format.
Is your eMMC really smaller than 4G? If it's >= 4G, barebox will fix it up in
the kernel DT as 2/2 cells, so keeping it 2/2 in barebox removes some noise
in of_diff - + output.
Cheers,
Ahmad
>
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> ---
> arch/arm/dts/imx8mp-skov.dts | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/arch/arm/dts/imx8mp-skov.dts b/arch/arm/dts/imx8mp-skov.dts
> index 1d4738dbd7..b94b9dd51d 100644
> --- a/arch/arm/dts/imx8mp-skov.dts
> +++ b/arch/arm/dts/imx8mp-skov.dts
> @@ -88,17 +88,17 @@ reg_usdhc2_vmmc: regulator-usdhc2 {
> &usdhc2 {
> partitions {
> compatible = "fixed-partitions";
> - #address-cells = <2>;
> - #size-cells = <2>;
> + #address-cells = <1>;
> + #size-cells = <1>;
>
> partition@0 {
> label = "barebox";
> - reg = <0x0 0x0 0x0 0x100000>;
> + reg = <0x0 0x100000>;
> };
>
> - env_sd: partition@e0000 {
> + env_sd: partition@100000 {
> label = "barebox-environment";
> - reg = <0x0 0x100000 0x0 0x100000>;
> + reg = <0x100000 0x100000>;
> };
> };
> };
--
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] 9+ messages in thread
* Re: [PATCH v1 4/7] arm: dts: imx8mp-skov: Simplify SD partition definition to 1 cell
2023-09-28 20:13 ` Ahmad Fatoum
@ 2023-09-29 4:38 ` Oleksij Rempel
0 siblings, 0 replies; 9+ messages in thread
From: Oleksij Rempel @ 2023-09-29 4:38 UTC (permalink / raw)
To: Ahmad Fatoum; +Cc: barebox
Hello Ahmad,
On Thu, Sep 28, 2023 at 10:13:44PM +0200, Ahmad Fatoum wrote:
> Hello Oleksij,
>
> On 28.09.23 12:58, Oleksij Rempel wrote:
> > Update the partition definitions for SD card in imx8mp-skov to use
> > single cell for address and size, streamlining the format.
>
> Is your eMMC really smaller than 4G? If it's >= 4G, barebox will fix it up in
> the kernel DT as 2/2 cells, so keeping it 2/2 in barebox removes some noise
> in of_diff - + output.
Ok, i see. Thx for the tip.
It is SD card, not eMMC. So, most probably it will be >= 4G.
I just realized, that SD card can be used as simple storage, not only as
the boot source. So, it is probably better to remove partition table from the
devicetree for SD too?
> > Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> > ---
> > arch/arm/dts/imx8mp-skov.dts | 10 +++++-----
> > 1 file changed, 5 insertions(+), 5 deletions(-)
> >
> > diff --git a/arch/arm/dts/imx8mp-skov.dts b/arch/arm/dts/imx8mp-skov.dts
> > index 1d4738dbd7..b94b9dd51d 100644
> > --- a/arch/arm/dts/imx8mp-skov.dts
> > +++ b/arch/arm/dts/imx8mp-skov.dts
> > @@ -88,17 +88,17 @@ reg_usdhc2_vmmc: regulator-usdhc2 {
> > &usdhc2 {
> > partitions {
> > compatible = "fixed-partitions";
> > - #address-cells = <2>;
> > - #size-cells = <2>;
> > + #address-cells = <1>;
> > + #size-cells = <1>;
> >
> > partition@0 {
> > label = "barebox";
> > - reg = <0x0 0x0 0x0 0x100000>;
> > + reg = <0x0 0x100000>;
> > };
> >
> > - env_sd: partition@e0000 {
> > + env_sd: partition@100000 {
> > label = "barebox-environment";
> > - reg = <0x0 0x100000 0x0 0x100000>;
> > + reg = <0x100000 0x100000>;
> > };
> > };
> > };
--
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] 9+ messages in thread
end of thread, other threads:[~2023-09-29 4:40 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-28 10:58 [PATCH v1 1/7] arm: dts: imx8mp-skov: Add reserved-memory for ramoops pstore Oleksij Rempel
2023-09-28 10:58 ` [PATCH v1 2/7] arm: dts: imx8mp-skov: Add pins for hardware variant detection Oleksij Rempel
2023-09-28 10:58 ` [PATCH v1 3/7] arm: dts: imx8mp-skov: Switch to GPT for eMMC partitioning Oleksij Rempel
2023-09-28 10:58 ` [PATCH v1 4/7] arm: dts: imx8mp-skov: Simplify SD partition definition to 1 cell Oleksij Rempel
2023-09-28 20:13 ` Ahmad Fatoum
2023-09-29 4:38 ` Oleksij Rempel
2023-09-28 10:58 ` [PATCH v1 5/7] arm: dts: imx8mp-skov: Add barebox state backend in DTS Oleksij Rempel
2023-09-28 10:58 ` [PATCH v1 6/7] ARM: i.MX8MP: skov: refactor bootsource and BBU handlers Oleksij Rempel
2023-09-28 10:58 ` [PATCH v1 7/7] ARM: i.MX8MP: skov: Add hardware variant support Oleksij Rempel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox