Message ID | 95ae35956d5488989833e2287f3c6fef55ba2aa8.1556212347.git.leonard.crestez@nxp.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | [v2] soc/imx: Read imx8mm soc revision from anatop | expand |
On Thu, Apr 25, 2019 at 2:18 PM Leonard Crestez <leonard.crestez@nxp.com> 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>
On Thu, Apr 25, 2019 at 05:17:39PM +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> I do not apply patch using base64 encoding. BTW, we use format 'soc: imx: ' than 'soc/imx: ' for prefix. Shawn
> From: Shawn Guo [mailto:shawnguo@kernel.org] > Sent: Friday, May 10, 2019 3:53 PM > Subject: Re: [PATCH v2] soc/imx: Read imx8mm soc revision from anatop > > On Thu, Apr 25, 2019 at 05:17:39PM +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> > > I do not apply patch using base64 encoding. > > BTW, we use format 'soc: imx: ' than 'soc/imx: ' for prefix. We're now trying to fix it with our IT. Regards Dong Aisheng > > Shawn
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 @@ -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 ? \
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> --- drivers/soc/imx/soc-imx8.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) Changes since v1: * Remove redundant initialization of "rev" (Fabio) Link: https://patchwork.kernel.org/patch/10914835/