Skip to contentSkip to conversation

soc: imx: Add i.MX8MN SoC driver support

PATCH Superseded [email protected] 2 participants 5 messages Jun 11, 2019 – Jun 19, 2019 Arm i.MX and Layerscape

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 soc: imx: Add i.MX8MN SoC driver support

From: Anson Huang <[email protected]>

This patch adds i.MX8MN SoC driver support:

root@imx8mnevk:~# cat /sys/devices/soc0/family
Freescale i.MX
root@imx8mnevk:~# cat /sys/devices/soc0/machine
NXP i.MX8MNano DDR4 EVK board
root@imx8mnevk:~# cat /sys/devices/soc0/soc_id
i.MX8MN
root@imx8mnevk:~# cat /sys/devices/soc0/revision
1.0
---
 drivers/soc/imx/soc-imx8.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/soc/imx/soc-imx8.c +12 -1
index 3842d09..02309a2 100644
@@ -55,7 +55,12 @@ static u32 __init imx8mm_soc_revision(void)
 	void __iomem *anatop_base;
 	u32 rev;
 
-	np = of_find_compatible_node(NULL, NULL, "fsl,imx8mm-anatop");
+	if (of_machine_is_compatible("fsl,imx8mm"))
+		np = of_find_compatible_node(NULL, NULL, "fsl,imx8mm-anatop");
+	else if (of_machine_is_compatible("fsl,imx8mn"))
+		np = of_find_compatible_node(NULL, NULL, "fsl,imx8mn-anatop");
+	else
+		np = NULL;
 	if (!np)
 		return 0;
 
@@ -79,9 +84,15 @@ static const struct imx8_soc_data imx8mm_soc_data = {
 	.soc_revision = imx8mm_soc_revision,
 };
 
+static const struct imx8_soc_data imx8mn_soc_data = {
+	.name = "i.MX8MN",
+	.soc_revision = imx8mm_soc_revision,
+};
+
 static const struct of_device_id imx8_soc_match[] = {
 	{ .compatible = "fsl,imx8mq", .data = &imx8mq_soc_data, },
 	{ .compatible = "fsl,imx8mm", .data = &imx8mm_soc_data, },
+	{ .compatible = "fsl,imx8mn", .data = &imx8mn_soc_data, },
 	{ }
 };
 
Signature · 1 line
2.7.4
#1 lore raw
Quoted 26 lines · On Tue, Jun 11, 2019 at 09:31:25AM +0800, [email protected] wrote:

From: Anson Huang <[email protected]>

This patch adds i.MX8MN SoC driver support:

root@imx8mnevk:~# cat /sys/devices/soc0/family
Freescale i.MX
root@imx8mnevk:~# cat /sys/devices/soc0/machine
NXP i.MX8MNano DDR4 EVK board
root@imx8mnevk:~# cat /sys/devices/soc0/soc_id
i.MX8MN
root@imx8mnevk:~# cat /sys/devices/soc0/revision
1.0
---
 drivers/soc/imx/soc-imx8.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/soc/imx/soc-imx8.c +0 -0
index 3842d09..02309a2 100644

drivers/soc/imx/soc-imx8.c static u32 __init imx8mm_soc_revision(void) · line 61

Quoted 8 lines
drivers/soc/imx/soc-imx8.c +4 -1
@@ -55,7 +55,12 @@ static u32 __init imx8mm_soc_revision(void)
 	void __iomem *anatop_base;
 	u32 rev;
 
-	np = of_find_compatible_node(NULL, NULL, "fsl,imx8mm-anatop");
+	if (of_machine_is_compatible("fsl,imx8mm"))
+		np = of_find_compatible_node(NULL, NULL, "fsl,imx8mm-anatop");
+	else if (of_machine_is_compatible("fsl,imx8mn"))
+		np = of_find_compatible_node(NULL, NULL, "fsl,imx8mn-anatop");

Can we have this anatop compatible in imx8_soc_data, so that we may save the call to of_machine_is_compatible()?

Shawn

Quoted 24 lines
drivers/soc/imx/soc-imx8.c +8 -0
+	else
+		np = NULL;
 	if (!np)
 		return 0;
 
@@ -79,9 +84,15 @@ static const struct imx8_soc_data imx8mm_soc_data = {
 	.soc_revision = imx8mm_soc_revision,
 };
 
+static const struct imx8_soc_data imx8mn_soc_data = {
+	.name = "i.MX8MN",
+	.soc_revision = imx8mm_soc_revision,
+};
+
 static const struct of_device_id imx8_soc_match[] = {
 	{ .compatible = "fsl,imx8mq", .data = &imx8mq_soc_data, },
 	{ .compatible = "fsl,imx8mm", .data = &imx8mm_soc_data, },
+	{ .compatible = "fsl,imx8mn", .data = &imx8mn_soc_data, },
 	{ }
 };
 
Signature · 1 line
2.7.4
#2 lore raw

Hi, Shawn

Quoted 43 lines

-----Original Message-----
From: Shawn Guo <[email protected]>
Sent: Tuesday, June 18, 2019 3:04 PM
To: Anson Huang <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; Leonard Crestez <[email protected]>; [email protected]; Abel Vesa <[email protected]>; [email protected]; [email protected]; dl-linux-imx <[email protected]>
Subject: Re: [PATCH] soc: imx: Add i.MX8MN SoC driver support

Quoted 7 lines · On Tue, Jun 11, 2019 at 09:31:25AM +0800, [email protected] wrote:

From: Anson Huang <[email protected]>

This patch adds i.MX8MN SoC driver support:

root@imx8mnevk:~# cat /sys/devices/soc0/family Freescale i.MX
root@imx8mnevk:~# cat /sys/devices/soc0/machine NXP i.MX8MNano

DDR4

Quoted 17 lines

EVK board

root@imx8mnevk:~# cat /sys/devices/soc0/soc_id i.MX8MN
root@imx8mnevk:~# cat /sys/devices/soc0/revision
1.0
---
 drivers/soc/imx/soc-imx8.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/soc/imx/soc-imx8.c +0 -0
index 3842d09..02309a2 100644

drivers/soc/imx/soc-imx8.c static u32 __init imx8mm_soc_revision(void) · line 59

Quoted 6 lines
drivers/soc/imx/soc-imx8.c +2 -1
@@ -55,7 +55,12 @@ static u32 __init imx8mm_soc_revision(void)
 	void __iomem *anatop_base;
 	u32 rev;
 
-	np = of_find_compatible_node(NULL, NULL, "fsl,imx8mm-anatop");
+	if (of_machine_is_compatible("fsl,imx8mm"))
+		np = of_find_compatible_node(NULL, NULL, "fsl,imx8mm-

anatop");

Quoted 6 lines

drivers/soc/imx/soc-imx8.c static u32 __init imx8mm_soc_revision(void) · line 61

Quoted 2 lines
drivers/soc/imx/soc-imx8.c +2 -0
+	else if (of_machine_is_compatible("fsl,imx8mn"))
+		np = of_find_compatible_node(NULL, NULL, "fsl,imx8mn-

anatop");

Can we have this anatop compatible in imx8_soc_data, so that we may save the call to of_machine_is_compatible()?

Do you mean adding a variable like " const char *anatop_compat " in imx8_soc_date structure, then initialize it according to SoC type, and in imx8mm_soc_revision(), get to soc_data's anatio_compat to find the anatop node? If yes, we have to add some code to get the soc_data in this function, or maybe we can pass anatop compatible name as .soc_revision's parameter?

static const struct imx8_soc_data imx8mn_soc_data = {
.name = "i.MX8MN",
.soc_revision = imx8mm_soc_revision, .anatop_compat = "fsl,imx8mn-anatop",
};

Anson.

Quoted 23 lines

Shawn

drivers/soc/imx/soc-imx8.c static const struct imx8_soc_data imx8mm_soc_data

Quoted 6 lines
drivers/soc/imx/soc-imx8.c +2 -0
+	else
+		np = NULL;
 	if (!np)
 		return 0;
 
@@ -79,9 +84,15 @@ static const struct imx8_soc_data imx8mm_soc_data

= {

Quoted 13 lines
drivers/soc/imx/soc-imx8.c +5 -0
 	.soc_revision = imx8mm_soc_revision,  };
 
+static const struct imx8_soc_data imx8mn_soc_data = {
+	.name = "i.MX8MN",
+	.soc_revision = imx8mm_soc_revision, };
+
 static const struct of_device_id imx8_soc_match[] = {
 	{ .compatible = "fsl,imx8mq", .data = &imx8mq_soc_data, },
 	{ .compatible = "fsl,imx8mm", .data = &imx8mm_soc_data, },
+	{ .compatible = "fsl,imx8mn", .data = &imx8mn_soc_data, },
 	{ }
 };
 
Quoted 3 lines
Quoted 3 lines
drivers/soc/imx/soc-imx8.c +0 -1
--

2.7.4

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#3 lore raw
Quoted 57 lines · Anson Huang

Hi, Shawn

Quoted 43 lines

-----Original Message-----
From: Shawn Guo <[email protected]>
Sent: Tuesday, June 18, 2019 3:04 PM
To: Anson Huang <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; Leonard Crestez <[email protected]>; [email protected]; Abel Vesa <[email protected]>; [email protected]; [email protected]; dl-linux-imx <[email protected]>
Subject: Re: [PATCH] soc: imx: Add i.MX8MN SoC driver support

Quoted 7 lines · On Tue, Jun 11, 2019 at 09:31:25AM +0800, [email protected] wrote:

From: Anson Huang <[email protected]>

This patch adds i.MX8MN SoC driver support:

root@imx8mnevk:~# cat /sys/devices/soc0/family Freescale i.MX
root@imx8mnevk:~# cat /sys/devices/soc0/machine NXP i.MX8MNano

DDR4

Quoted 17 lines

EVK board

root@imx8mnevk:~# cat /sys/devices/soc0/soc_id i.MX8MN
root@imx8mnevk:~# cat /sys/devices/soc0/revision
1.0
---
 drivers/soc/imx/soc-imx8.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/soc/imx/soc-imx8.c +0 -0
index 3842d09..02309a2 100644

drivers/soc/imx/soc-imx8.c static u32 __init imx8mm_soc_revision(void) · line 59

Quoted 6 lines
drivers/soc/imx/soc-imx8.c +2 -1
@@ -55,7 +55,12 @@ static u32 __init imx8mm_soc_revision(void)
 	void __iomem *anatop_base;
 	u32 rev;
 
-	np = of_find_compatible_node(NULL, NULL, "fsl,imx8mm-anatop");
+	if (of_machine_is_compatible("fsl,imx8mm"))
+		np = of_find_compatible_node(NULL, NULL, "fsl,imx8mm-

anatop");

Quoted 6 lines

drivers/soc/imx/soc-imx8.c static u32 __init imx8mm_soc_revision(void) · line 61

Quoted 2 lines
drivers/soc/imx/soc-imx8.c +2 -0
+	else if (of_machine_is_compatible("fsl,imx8mn"))
+		np = of_find_compatible_node(NULL, NULL, "fsl,imx8mn-

anatop");

Can we have this anatop compatible in imx8_soc_data, so that we may save the call to of_machine_is_compatible()?

Do you mean adding a variable like " const char *anatop_compat " in imx8_soc_date structure, then initialize it according to SoC type, and in imx8mm_soc_revision(), get to soc_data's anatio_compat to find the anatop node? If yes, we have to add some code to get the soc_data in this function, or maybe we can pass anatop compatible name as .soc_revision's parameter?

Quoted 5 lines

static const struct imx8_soc_data imx8mn_soc_data = {
.name = "i.MX8MN",
.soc_revision = imx8mm_soc_revision, .anatop_compat = "fsl,imx8mn-anatop",
};

Okay, just realized that we only want to handle imx8mn with imx8mm function. It makes less sense to add anatop compatible into imx8_soc_data just for that.

So it looks like that imx8mn is highly compatible with imx8mm, including anatop block? If that's the case, maybe we can have compatible of imx8mn anatop like below, so that we can save above changes?

	compatible = "fsl,imx8mn-anatop", "fsl,imx8mm-anatop";

Shawn

#4 lore raw

Hi, Shawn

Quoted 81 lines

-----Original Message-----
From: Shawn Guo <[email protected]>
Sent: Tuesday, June 18, 2019 8:59 PM
To: Anson Huang <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; Leonard Crestez <[email protected]>; [email protected]; Abel Vesa <[email protected]>; [email protected]; [email protected]; dl-linux-imx <[email protected]>
Subject: Re: [PATCH] soc: imx: Add i.MX8MN SoC driver support

Quoted 14 lines · Anson Huang

Hi, Shawn

Quoted 12 lines

-----Original Message-----
From: Shawn Guo <[email protected]>
Sent: Tuesday, June 18, 2019 3:04 PM
To: Anson Huang <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; Leonard Crestez <[email protected]>; [email protected]; Abel Vesa <[email protected]>; [email protected]; [email protected]; dl-linux-imx <[email protected]>
Subject: Re: [PATCH] soc: imx: Add i.MX8MN SoC driver support

On Tue, Jun 11, 2019 at 09:31:25AM +0800, [email protected]

Quoted 36 lines · wrote:
Quoted 36 lines
Quoted 7 lines

From: Anson Huang <[email protected]>

This patch adds i.MX8MN SoC driver support:

root@imx8mnevk:~# cat /sys/devices/soc0/family Freescale i.MX
root@imx8mnevk:~# cat /sys/devices/soc0/machine NXP i.MX8MNano

DDR4

Quoted 17 lines

EVK board

root@imx8mnevk:~# cat /sys/devices/soc0/soc_id i.MX8MN
root@imx8mnevk:~# cat /sys/devices/soc0/revision
1.0
---
 drivers/soc/imx/soc-imx8.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/soc/imx/soc-imx8.c index 3842d09..02309a2 100644

drivers/soc/imx/soc-imx8.c static u32 __init imx8mm_soc_revision(void) · line 59

Quoted 6 lines
drivers/soc/imx/soc-imx8.c +2 -1
@@ -55,7 +55,12 @@ static u32 __init imx8mm_soc_revision(void)
 	void __iomem *anatop_base;
 	u32 rev;
 
-	np = of_find_compatible_node(NULL, NULL, "fsl,imx8mm-anatop");
+	if (of_machine_is_compatible("fsl,imx8mm"))
+		np = of_find_compatible_node(NULL, NULL, "fsl,imx8mm-

anatop");

drivers/soc/imx/soc-imx8.c static u32 __init imx8mm_soc_revision(void) · line 61

Quoted 2 lines
drivers/soc/imx/soc-imx8.c +2 -0
+	else if (of_machine_is_compatible("fsl,imx8mn"))
+		np = of_find_compatible_node(NULL, NULL, "fsl,imx8mn-

anatop");

Quoted 7 lines
Quoted 2 lines

Can we have this anatop compatible in imx8_soc_data, so that we may save the call to of_machine_is_compatible()?

Do you mean adding a variable like " const char *anatop_compat " in imx8_soc_date structure, then initialize it according to SoC type, and in imx8mm_soc_revision(), get to soc_data's anatio_compat to find the anatop node? If yes, we have to add some code to get the soc_data in this

function, or maybe we can pass anatop compatible name as .soc_revision's parameter?

Quoted 5 lines
static const struct imx8_soc_data imx8mn_soc_data = {
         .name = "i.MX8MN",
         .soc_revision = imx8mm_soc_revision,
         .anatop_compat = "fsl,imx8mn-anatop", };

Okay, just realized that we only want to handle imx8mn with imx8mm function. It makes less sense to add anatop compatible into imx8_soc_data just for that.

Quoted 5 lines

So it looks like that imx8mn is highly compatible with imx8mm, including anatop block? If that's the case, maybe we can have compatible of imx8mn anatop like below, so that we can save above changes?

	compatible = "fsl,imx8mn-anatop", "fsl,imx8mm-anatop";

Make sense, I just sent out V2 with this approach, and will add the "fsl,imx8mm-anatop" as i.MX8MN ANATOP fallback compatible when I need to resend the i.MX8MN DT patch series.

Thanks,
Anson

Quoted 2 lines

Shawn