* [PATCH v3] soc: imx: Read imx8mm soc revision from anatop
@ 2019-05-13 11:22 Leonard Crestez
2019-05-20 7:20 ` Shawn Guo
0 siblings, 1 reply; 2+ messages in thread
From: Leonard Crestez @ 2019-05-13 11:22 UTC (permalink / raw)
To: Shawn Guo, Jacky Bai
Cc: Aisheng Dong, Abel Vesa, Anson Huang, Guido Günther,
dl-linux-imx, kernel, Fabio Estevam, linux-arm-kernel
Like on imx6/7 we can read version information from a register in
anatop, and in the same format.
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
---
Changes since v2:
* Change header to "soc: imx:" for consistency (Shawn)
* Try to avoid base64.
Link: https://patchwork.kernel.org/patch/10917515/
Changes since v1:
* Remove redundant initialization of "rev" (Fabio).
Link: https://patchwork.kernel.org/patch/10914835/
drivers/soc/imx/soc-imx8.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/drivers/soc/imx/soc-imx8.c b/drivers/soc/imx/soc-imx8.c
index b1bd8e2543ac..02988bdfbb73 100644
--- a/drivers/soc/imx/soc-imx8.c
+++ b/drivers/soc/imx/soc-imx8.c
@@ -14,10 +14,13 @@
#define REV_B1 0x21
#define IMX8MQ_SW_INFO_B1 0x40
#define IMX8MQ_SW_MAGIC_B1 0xff0055aa
+/* Same as ANADIG_DIGPROG_IMX7D */
+#define ANADIG_DIGPROG_IMX8MM 0x800
+
struct imx8_soc_data {
char *name;
u32 (*soc_revision)(void);
};
@@ -44,17 +47,43 @@ static u32 __init imx8mq_soc_revision(void)
out:
of_node_put(np);
return rev;
}
+static u32 __init imx8mm_soc_revision(void)
+{
+ struct device_node *np;
+ void __iomem *anatop_base;
+ u32 rev;
+
+ np = of_find_compatible_node(NULL, NULL, "fsl,imx8mm-anatop");
+ if (!np)
+ return 0;
+
+ anatop_base = of_iomap(np, 0);
+ WARN_ON(!anatop_base);
+
+ rev = readl_relaxed(anatop_base + ANADIG_DIGPROG_IMX8MM);
+
+ iounmap(anatop_base);
+ of_node_put(np);
+ return rev;
+}
+
static const struct imx8_soc_data imx8mq_soc_data = {
.name = "i.MX8MQ",
.soc_revision = imx8mq_soc_revision,
};
+static const struct imx8_soc_data imx8mm_soc_data = {
+ .name = "i.MX8MM",
+ .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, },
{ }
};
#define imx8_revision(soc_rev) \
soc_rev ? \
--
2.17.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v3] soc: imx: Read imx8mm soc revision from anatop
2019-05-13 11:22 [PATCH v3] soc: imx: Read imx8mm soc revision from anatop Leonard Crestez
@ 2019-05-20 7:20 ` Shawn Guo
0 siblings, 0 replies; 2+ messages in thread
From: Shawn Guo @ 2019-05-20 7:20 UTC (permalink / raw)
To: Leonard Crestez
Cc: Aisheng Dong, Jacky Bai, Anson Huang, Guido Günther,
dl-linux-imx, kernel, Fabio Estevam, linux-arm-kernel, Abel Vesa
On Mon, May 13, 2019 at 11:22:13AM +0000, Leonard Crestez wrote:
> Like on imx6/7 we can read version information from a register in
> anatop, and in the same format.
>
> Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
> Reviewed-by: Fabio Estevam <festevam@gmail.com>
Applied, thanks.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-05-20 7:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-13 11:22 [PATCH v3] soc: imx: Read imx8mm soc revision from anatop Leonard Crestez
2019-05-20 7:20 ` Shawn Guo
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.