aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeonard Crestez <leonard.crestez@nxp.com>2019-05-13 07:22:13 -0400
committerShawn Guo <shawnguo@kernel.org>2019-05-20 03:20:41 -0400
commit2b14b802adac2d1bc7ffc6bcfe64fbb24b05a48d (patch)
tree4c3745eefbd571b6387033ce1efaf04315b011f7
parenta188339ca5a396acc588e5851ed7e19f66b0ebd9 (diff)
soc: imx: Read imx8mm soc revision from anatop
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> Signed-off-by: Shawn Guo <shawnguo@kernel.org>
-rw-r--r--drivers/soc/imx/soc-imx8.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/drivers/soc/imx/soc-imx8.c b/drivers/soc/imx/soc-imx8.c
index fc6429f9170a..cd10726e64e4 100644
--- a/drivers/soc/imx/soc-imx8.c
+++ b/drivers/soc/imx/soc-imx8.c
@@ -16,6 +16,9 @@
16#define IMX8MQ_SW_INFO_B1 0x40 16#define IMX8MQ_SW_INFO_B1 0x40
17#define IMX8MQ_SW_MAGIC_B1 0xff0055aa 17#define IMX8MQ_SW_MAGIC_B1 0xff0055aa
18 18
19/* Same as ANADIG_DIGPROG_IMX7D */
20#define ANADIG_DIGPROG_IMX8MM 0x800
21
19struct imx8_soc_data { 22struct imx8_soc_data {
20 char *name; 23 char *name;
21 u32 (*soc_revision)(void); 24 u32 (*soc_revision)(void);
@@ -46,13 +49,39 @@ out:
46 return rev; 49 return rev;
47} 50}
48 51
52static u32 __init imx8mm_soc_revision(void)
53{
54 struct device_node *np;
55 void __iomem *anatop_base;
56 u32 rev;
57
58 np = of_find_compatible_node(NULL, NULL, "fsl,imx8mm-anatop");
59 if (!np)
60 return 0;
61
62 anatop_base = of_iomap(np, 0);
63 WARN_ON(!anatop_base);
64
65 rev = readl_relaxed(anatop_base + ANADIG_DIGPROG_IMX8MM);
66
67 iounmap(anatop_base);
68 of_node_put(np);
69 return rev;
70}
71
49static const struct imx8_soc_data imx8mq_soc_data = { 72static const struct imx8_soc_data imx8mq_soc_data = {
50 .name = "i.MX8MQ", 73 .name = "i.MX8MQ",
51 .soc_revision = imx8mq_soc_revision, 74 .soc_revision = imx8mq_soc_revision,
52}; 75};
53 76
77static const struct imx8_soc_data imx8mm_soc_data = {
78 .name = "i.MX8MM",
79 .soc_revision = imx8mm_soc_revision,
80};
81
54static const struct of_device_id imx8_soc_match[] = { 82static const struct of_device_id imx8_soc_match[] = {
55 { .compatible = "fsl,imx8mq", .data = &imx8mq_soc_data, }, 83 { .compatible = "fsl,imx8mq", .data = &imx8mq_soc_data, },
84 { .compatible = "fsl,imx8mm", .data = &imx8mm_soc_data, },
56 { } 85 { }
57}; 86};
58 87