Skip to contentSkip to conversation

soc: imx: Add generic i.MX8 SoC driver

PATCH RESEND Applied Abel Vesa 3 participants 4 messages Mar 22, 2019 – Apr 20, 2019 Arm i.MX and Layerscape

lore
Share & tools
lore

Abel Vesa

author
#0 lore raw

PATCH RESEND v2 1/1 soc: imx: Add generic i.MX8 SoC driver

Add generic i.MX8 SoC driver along with the i.MX8MQ SoC specific code. For now, only i.MX8MQ revision B1 is supported. For any other, i.MX8MQ revision it will print 'unknown'.

---
 drivers/soc/imx/Makefile   |   1 +
 drivers/soc/imx/soc-imx8.c | 115 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 116 insertions(+)
 create mode 100644 drivers/soc/imx/soc-imx8.c
drivers/soc/imx/Makefile +1 -0
index 506a6f3..d6b529e0 100644
@@ -1,2 +1,3 @@
 obj-$(CONFIG_HAVE_IMX_GPC) += gpc.o
 obj-$(CONFIG_IMX_GPCV2_PM_DOMAINS) += gpcv2.o
+obj-$(CONFIG_ARCH_MXC) += soc-imx8.o
drivers/soc/imx/soc-imx8.c new file +115 -0

115 lines not on this page · raw message

Signature · 1 line
2.7.4
#1 lore raw
Quoted 5 lines · Abel Vesa

Add generic i.MX8 SoC driver along with the i.MX8MQ SoC specific code. For now, only i.MX8MQ revision B1 is supported. For any other, i.MX8MQ revision it will print 'unknown'.

drivers/soc/imx/soc-imx8.c new file +1 -0
+#define REV_B1				0x21

drivers/soc/imx/soc-imx8.c line 40

Quoted 10 lines
drivers/soc/imx/soc-imx8.c new file +10 -0
+
+#define IMX8MQ_SW_INFO_B1		0x40
+#define IMX8MQ_SW_MAGIC_B1		0xff0055aa
+
+	np = of_find_compatible_node(NULL, NULL, "fsl,imx8mq-ocotp");+
+	ocotp_base = of_iomap(np, 0);
+
+	magic = readl_relaxed(ocotp_base + IMX8MQ_SW_INFO_B1);
+	if (magic == IMX8MQ_SW_MAGIC_B1)
+		rev = REV_B1;

This is based on ATF code in vendor tree, but shouldn't we have some sort of explanation for this "magic"?

Looking at the OCOTP driver reg 0x40 is IMX_OCOTP_ADDR_DATA2 and it's used as part of fuse writes. According to the driver code 8mq is compatible with 7d and this write path is enabled for imx8mq-ocotp.

Looking at the OCOTP manual reg 0x40 is OCOTP_HW_OCOTP_READ_FUSE_DATA and it's meant to be used together with IMX_OCOTP_ADDR_CTRL to read info. Maybe my manual (rev0 2018-01) is incorrect?

Looking at the manual this will return the value of the fuse last requested via IMX_OCOTP_ADDR_CTRL but no such request is made in this driver. So reading from OCOTP 0x40 might return an unrelated value?!

The manual does document that fuse 0x440[3:0] is a "silicon revision number"; maybe we should read that?

--
Regards,
Leonard

Reviewed-by
#2 lore raw
Quoted 20 lines · Leonard Crestez
Quoted 5 lines · Abel Vesa

Add generic i.MX8 SoC driver along with the i.MX8MQ SoC specific code. For now, only i.MX8MQ revision B1 is supported. For any other, i.MX8MQ revision it will print 'unknown'.

drivers/soc/imx/soc-imx8.c new file +1 -0
+#define REV_B1				0x21

drivers/soc/imx/soc-imx8.c line 40

Quoted 10 lines
drivers/soc/imx/soc-imx8.c new file +10 -0
+
+#define IMX8MQ_SW_INFO_B1		0x40
+#define IMX8MQ_SW_MAGIC_B1		0xff0055aa
+
+	np = of_find_compatible_node(NULL, NULL, "fsl,imx8mq-ocotp");+
+	ocotp_base = of_iomap(np, 0);
+
+	magic = readl_relaxed(ocotp_base + IMX8MQ_SW_INFO_B1);
+	if (magic == IMX8MQ_SW_MAGIC_B1)
+		rev = REV_B1;

This is based on ATF code in vendor tree, but shouldn't we have some sort of explanation for this "magic"?

Quoted 3 lines

Looking at the OCOTP driver reg 0x40 is IMX_OCOTP_ADDR_DATA2 and it's used as part of fuse writes. According to the driver code 8mq is compatible with 7d and this write path is enabled for imx8mq-ocotp.

After further digging in NXP manuals and uboot sources it seems that imx8mq ocotp is like imx6 rather than imx7. Posted fix for nvmem driver:

https://patchwork.kernel.org/patch/10908081/

It might still be nice to find a way to identify imx8mq B0.