* [PATCH v1 2/8] ARM: imx6sx: udoo-neo: enable deep probe support
2023-01-13 11:34 [PATCH v1 1/8] ARM: imx6sx: udoo-neo: port to driver model Oleksij Rempel
@ 2023-01-13 11:34 ` Oleksij Rempel
2023-01-13 11:34 ` [PATCH v1 3/8] ARM: imx6sx: udoo-neo: fix board compatible Oleksij Rempel
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Oleksij Rempel @ 2023-01-13 11:34 UTC (permalink / raw)
To: barebox; +Cc: Oleksij Rempel
Deep probe seems to work without any issues, so enable it now.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
arch/arm/boards/udoo-neo/board.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/arm/boards/udoo-neo/board.c b/arch/arm/boards/udoo-neo/board.c
index 3bed20ae50..da1534989e 100644
--- a/arch/arm/boards/udoo-neo/board.c
+++ b/arch/arm/boards/udoo-neo/board.c
@@ -4,6 +4,7 @@
#include <common.h>
#include <init.h>
#include <linux/clk.h>
+#include <deep-probe.h>
static int imx6sx_udoneo_probe(struct device *dev)
{
@@ -16,6 +17,7 @@ static const struct of_device_id imx6sx_udoneo_of_match[] = {
{ .compatible = "fsl,imx6sx-udoo-neo" },
{ /* sentinel */ },
};
+BAREBOX_DEEP_PROBE_ENABLE(imx6sx_udoneo_of_match);
static struct driver imx6sx_udoneo_driver = {
.name = "board-udoo-neo",
--
2.30.2
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v1 3/8] ARM: imx6sx: udoo-neo: fix board compatible
2023-01-13 11:34 [PATCH v1 1/8] ARM: imx6sx: udoo-neo: port to driver model Oleksij Rempel
2023-01-13 11:34 ` [PATCH v1 2/8] ARM: imx6sx: udoo-neo: enable deep probe support Oleksij Rempel
@ 2023-01-13 11:34 ` Oleksij Rempel
2023-01-13 11:34 ` [PATCH v1 4/8] ARM: imx6sx: udoo-neo: configure GPIO pins for board auto detection Oleksij Rempel
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Oleksij Rempel @ 2023-01-13 11:34 UTC (permalink / raw)
To: barebox; +Cc: Oleksij Rempel
fsl,imx6sx-udoo-neo is not working for some time now. Sync it with
mainline kernel.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
arch/arm/boards/udoo-neo/board.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/boards/udoo-neo/board.c b/arch/arm/boards/udoo-neo/board.c
index da1534989e..e2078e3395 100644
--- a/arch/arm/boards/udoo-neo/board.c
+++ b/arch/arm/boards/udoo-neo/board.c
@@ -14,7 +14,7 @@ static int imx6sx_udoneo_probe(struct device *dev)
}
static const struct of_device_id imx6sx_udoneo_of_match[] = {
- { .compatible = "fsl,imx6sx-udoo-neo" },
+ { .compatible = "udoo,neofull" },
{ /* sentinel */ },
};
BAREBOX_DEEP_PROBE_ENABLE(imx6sx_udoneo_of_match);
--
2.30.2
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v1 4/8] ARM: imx6sx: udoo-neo: configure GPIO pins for board auto detection.
2023-01-13 11:34 [PATCH v1 1/8] ARM: imx6sx: udoo-neo: port to driver model Oleksij Rempel
2023-01-13 11:34 ` [PATCH v1 2/8] ARM: imx6sx: udoo-neo: enable deep probe support Oleksij Rempel
2023-01-13 11:34 ` [PATCH v1 3/8] ARM: imx6sx: udoo-neo: fix board compatible Oleksij Rempel
@ 2023-01-13 11:34 ` Oleksij Rempel
2023-01-13 11:34 ` [PATCH v1 5/8] ARM: imx6sx: udoo-neo: add version detection support Oleksij Rempel
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Oleksij Rempel @ 2023-01-13 11:34 UTC (permalink / raw)
To: barebox; +Cc: Oleksij Rempel
We have two pins for board version. Configure it to allow board code to
use it.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
arch/arm/dts/imx6sx-udoo-neo-full.dts | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/arch/arm/dts/imx6sx-udoo-neo-full.dts b/arch/arm/dts/imx6sx-udoo-neo-full.dts
index 1609781b7f..2e5e1a9ed4 100644
--- a/arch/arm/dts/imx6sx-udoo-neo-full.dts
+++ b/arch/arm/dts/imx6sx-udoo-neo-full.dts
@@ -27,3 +27,15 @@
&ocotp {
barebox,provide-mac-address = <&fec1 0x620>;
};
+
+&iomuxc {
+ pinctrl-names = "default";
+ pinctrl-0 = <&pinctrl_hog>;
+
+ pinctrl_hog: hoggrp {
+ fsl,pins = <
+ MX6SX_PAD_NAND_READY_B__GPIO4_IO_13 0x1b0b0
+ MX6SX_PAD_NAND_ALE__GPIO4_IO_0 0x1b0b0
+ >;
+ };
+};
--
2.30.2
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v1 5/8] ARM: imx6sx: udoo-neo: add version detection support
2023-01-13 11:34 [PATCH v1 1/8] ARM: imx6sx: udoo-neo: port to driver model Oleksij Rempel
` (2 preceding siblings ...)
2023-01-13 11:34 ` [PATCH v1 4/8] ARM: imx6sx: udoo-neo: configure GPIO pins for board auto detection Oleksij Rempel
@ 2023-01-13 11:34 ` Oleksij Rempel
2023-01-13 11:34 ` [PATCH v1 6/8] ARM: imx6sx: udoo-neo: enable memory size auto detection Oleksij Rempel
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Oleksij Rempel @ 2023-01-13 11:34 UTC (permalink / raw)
To: barebox; +Cc: Oleksij Rempel
There are different board versions. Make use of it to be able to get
proper kernel devicetree.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
arch/arm/boards/udoo-neo/board.c | 91 +++++++++++++++++++++++++++++++-
1 file changed, 89 insertions(+), 2 deletions(-)
diff --git a/arch/arm/boards/udoo-neo/board.c b/arch/arm/boards/udoo-neo/board.c
index e2078e3395..ffdb70dfae 100644
--- a/arch/arm/boards/udoo-neo/board.c
+++ b/arch/arm/boards/udoo-neo/board.c
@@ -2,12 +2,99 @@
// SPDX-FileCopyrightText: 2014 Sascha Hauer, Pengutronix
#include <common.h>
-#include <init.h>
-#include <linux/clk.h>
#include <deep-probe.h>
+#include <gpio.h>
+#include <mach/bbu.h>
+#include <mach/imx6.h>
+
+/**
+ * Detects the board model by checking the R184 and R185 resistors.
+ * A mounted resistor (0Ohm) connects the GPIO to ground, so the
+ * GPIO value will be 0.
+ *
+ * FULL - Eth, WiFi, motion sensors, 1GB RAM -> R184 not mounted - R185 mounted
+ * EXTENDED - NO Eth, WiFi, motion sensors, 1GB RAM -> R184 not mounted - R185 not mounted
+ * BASE - Eth, NO WiFi, NO motion sensors, 512MB RAM -> R184 mounted - R185 mounted
+ * BASE KS - NO Eth, WiFi, NO motion sensors, 512MB RAM -> R184 mounted - R185 not mounted
+ */
+
+enum imx6sx_udoneo_board_type {
+ UDOO_NEO_BASIC = 0,
+ UDOO_NEO_BASIC_KS = 1,
+ UDOO_NEO_FULL = 2,
+ UDOO_NEO_EXTENDED = 3,
+ UDOO_NEO_UNKNOWN,
+};
+
+#define GPIO_R184 IMX_GPIO_NR(4, 13)
+#define GPIO_R185 IMX_GPIO_NR(4, 0)
+
+static enum imx6sx_udoneo_board_type imx6sx_udoneo_detect(struct device *dev)
+{
+ struct device_node *gpio_np = NULL;
+ int r184, r185;
+ int ret;
+
+ gpio_np = of_find_node_by_name_address(NULL, "gpio@20a8000");
+ if (gpio_np) {
+ ret = of_device_ensure_probed(gpio_np);
+ if (ret) {
+ dev_warn(dev, "Can't probe GPIO node\n");
+ goto detect_error;
+ }
+ } else {
+ dev_warn(dev, "Can't get GPIO node\n");
+ goto detect_error;
+ }
+
+ ret = gpio_request(GPIO_R184, "version r184");
+ if (ret)
+ goto detect_error;
+
+ ret = gpio_request(GPIO_R185, "version r185");
+ if (ret)
+ goto detect_error;
+
+ ret = gpio_direction_input(GPIO_R184);
+ if (ret)
+ goto detect_error;
+
+ ret = gpio_direction_input(GPIO_R185);
+ if (ret)
+ goto detect_error;
+
+ r184 = gpio_get_value(GPIO_R184);
+ r185 = gpio_get_value(GPIO_R185);
+
+ return r184 << 1 | r185 << 0;
+
+detect_error:
+ dev_warn(dev, "Board detection failed\n");
+
+ return UDOO_NEO_UNKNOWN;
+}
static int imx6sx_udoneo_probe(struct device *dev)
{
+ enum imx6sx_udoneo_board_type type;
+ const char *model;
+
+ type = imx6sx_udoneo_detect(dev);
+ switch (type) {
+ case UDOO_NEO_FULL:
+ model = "UDOO Neo Full";
+ break;
+ case UDOO_NEO_EXTENDED:
+ model = "UDOO Neo Extended";
+ break;
+ case UDOO_NEO_BASIC:
+ model = "UDOO Neo Basic";
+ break;
+ default:
+ model = "UDOO Neo unknown";
+ }
+
+ barebox_set_model(model);
barebox_set_hostname("mx6sx-udooneo");
return 0;
--
2.30.2
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v1 6/8] ARM: imx6sx: udoo-neo: enable memory size auto detection
2023-01-13 11:34 [PATCH v1 1/8] ARM: imx6sx: udoo-neo: port to driver model Oleksij Rempel
` (3 preceding siblings ...)
2023-01-13 11:34 ` [PATCH v1 5/8] ARM: imx6sx: udoo-neo: add version detection support Oleksij Rempel
@ 2023-01-13 11:34 ` Oleksij Rempel
2023-01-13 11:34 ` [PATCH v1 7/8] ARM: imx6sx: udoo-neo: fix gpt timer configuration Oleksij Rempel
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Oleksij Rempel @ 2023-01-13 11:34 UTC (permalink / raw)
To: barebox; +Cc: Oleksij Rempel
Not all udoo-neo board have same memory size. So, remove memory node
to allow memory size auto detection.
Potentially we can use different DTs for different board in the barebox.
But we are able to auto detect board version, better we keep udoo-neo-full
as the basis version and disable not supported parts by the board code
if needed.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
arch/arm/dts/imx6sx-udoo-neo-full.dts | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/arm/dts/imx6sx-udoo-neo-full.dts b/arch/arm/dts/imx6sx-udoo-neo-full.dts
index 2e5e1a9ed4..be023b4289 100644
--- a/arch/arm/dts/imx6sx-udoo-neo-full.dts
+++ b/arch/arm/dts/imx6sx-udoo-neo-full.dts
@@ -1,6 +1,9 @@
#include <arm/imx6sx-udoo-neo-full.dts>
/ {
+
+ /delete-node/ memory@80000000;
+
chosen {
environment {
compatible = "barebox,environment";
--
2.30.2
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v1 7/8] ARM: imx6sx: udoo-neo: fix gpt timer configuration
2023-01-13 11:34 [PATCH v1 1/8] ARM: imx6sx: udoo-neo: port to driver model Oleksij Rempel
` (4 preceding siblings ...)
2023-01-13 11:34 ` [PATCH v1 6/8] ARM: imx6sx: udoo-neo: enable memory size auto detection Oleksij Rempel
@ 2023-01-13 11:34 ` Oleksij Rempel
2023-01-13 11:34 ` [PATCH v1 8/8] ARM: imx6sx: udoo-neo: add barebox update handler support Oleksij Rempel
2023-01-16 12:13 ` [PATCH v1 1/8] ARM: imx6sx: udoo-neo: port to driver model Sascha Hauer
7 siblings, 0 replies; 9+ messages in thread
From: Oleksij Rempel @ 2023-01-13 11:34 UTC (permalink / raw)
To: barebox; +Cc: Oleksij Rempel
Fix i.MX GPT timer configuration by including dtsi with needed clock
overwrite.
See 4108c6d049 ("ARM: imx6sx: use correct clocks for GPT") for more
info.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
arch/arm/dts/imx6sx-udoo-neo-full.dts | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm/dts/imx6sx-udoo-neo-full.dts b/arch/arm/dts/imx6sx-udoo-neo-full.dts
index be023b4289..0848574e41 100644
--- a/arch/arm/dts/imx6sx-udoo-neo-full.dts
+++ b/arch/arm/dts/imx6sx-udoo-neo-full.dts
@@ -1,4 +1,5 @@
#include <arm/imx6sx-udoo-neo-full.dts>
+#include "imx6sx.dtsi"
/ {
--
2.30.2
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v1 8/8] ARM: imx6sx: udoo-neo: add barebox update handler support
2023-01-13 11:34 [PATCH v1 1/8] ARM: imx6sx: udoo-neo: port to driver model Oleksij Rempel
` (5 preceding siblings ...)
2023-01-13 11:34 ` [PATCH v1 7/8] ARM: imx6sx: udoo-neo: fix gpt timer configuration Oleksij Rempel
@ 2023-01-13 11:34 ` Oleksij Rempel
2023-01-16 12:13 ` [PATCH v1 1/8] ARM: imx6sx: udoo-neo: port to driver model Sascha Hauer
7 siblings, 0 replies; 9+ messages in thread
From: Oleksij Rempel @ 2023-01-13 11:34 UTC (permalink / raw)
To: barebox; +Cc: Oleksij Rempel
Make this board properly updatable by bbu support.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
arch/arm/boards/udoo-neo/board.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/arm/boards/udoo-neo/board.c b/arch/arm/boards/udoo-neo/board.c
index ffdb70dfae..075423099b 100644
--- a/arch/arm/boards/udoo-neo/board.c
+++ b/arch/arm/boards/udoo-neo/board.c
@@ -97,6 +97,9 @@ static int imx6sx_udoneo_probe(struct device *dev)
barebox_set_model(model);
barebox_set_hostname("mx6sx-udooneo");
+ imx6_bbu_internal_mmc_register_handler("emmc", "/dev/mmc1.barebox",
+ BBU_HANDLER_FLAG_DEFAULT);
+
return 0;
}
--
2.30.2
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v1 1/8] ARM: imx6sx: udoo-neo: port to driver model
2023-01-13 11:34 [PATCH v1 1/8] ARM: imx6sx: udoo-neo: port to driver model Oleksij Rempel
` (6 preceding siblings ...)
2023-01-13 11:34 ` [PATCH v1 8/8] ARM: imx6sx: udoo-neo: add barebox update handler support Oleksij Rempel
@ 2023-01-16 12:13 ` Sascha Hauer
7 siblings, 0 replies; 9+ messages in thread
From: Sascha Hauer @ 2023-01-16 12:13 UTC (permalink / raw)
To: Oleksij Rempel; +Cc: barebox
On Fri, Jan 13, 2023 at 12:34:00PM +0100, Oleksij Rempel wrote:
> Port board code to the driver model
>
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> ---
> arch/arm/boards/udoo-neo/board.c | 18 +++++++++++++-----
> 1 file changed, 13 insertions(+), 5 deletions(-)
Applied, thanks
Sascha
>
> diff --git a/arch/arm/boards/udoo-neo/board.c b/arch/arm/boards/udoo-neo/board.c
> index 5964e92159..3bed20ae50 100644
> --- a/arch/arm/boards/udoo-neo/board.c
> +++ b/arch/arm/boards/udoo-neo/board.c
> @@ -5,13 +5,21 @@
> #include <init.h>
> #include <linux/clk.h>
>
> -static int imx6sx_udoneo_coredevices_init(void)
> +static int imx6sx_udoneo_probe(struct device *dev)
> {
> - if (!of_machine_is_compatible("fsl,imx6sx-udoo-neo"))
> - return 0;
> -
> barebox_set_hostname("mx6sx-udooneo");
>
> return 0;
> }
> -coredevice_initcall(imx6sx_udoneo_coredevices_init);
> +
> +static const struct of_device_id imx6sx_udoneo_of_match[] = {
> + { .compatible = "fsl,imx6sx-udoo-neo" },
> + { /* sentinel */ },
> +};
> +
> +static struct driver imx6sx_udoneo_driver = {
> + .name = "board-udoo-neo",
> + .probe = imx6sx_udoneo_probe,
> + .of_compatible = imx6sx_udoneo_of_match,
> +};
> +postcore_platform_driver(imx6sx_udoneo_driver);
> --
> 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] 9+ messages in thread