summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOleksandr Suvorov <oleksandr.suvorov@toradex.com>2021-01-28 16:02:20 +0200
committerOleksandr Suvorov <oleksandr.suvorov@toradex.com>2021-01-28 17:12:16 +0200
commit6ad99da2c6759b59bf4b1f6aba70859fcbae7c9e (patch)
treeccba83678198d2fdf734a60ada3eb3364f1e74dc
parentca1a93fc43f8800db1142684b5cf4861377996bb (diff)
Revert "soc: imx-scu: Using existing serial_number instead of UID"
This reverts commit 974b100d789c22ed42e934ed25e6860fb9fa294b. The commit [974b100d789c] causes to fail imx_scu_soc_probe() that leads to the kernel panic in caam_probe() [1]. Revert the commit to fix booting a kernel. [1] Panic log: ============================ [ 0.606411] Internal error: synchronous external abort: 96000010 [#1] PREEMPT SMP [ 0.613921] Modules linked in: [ 0.616988] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.4.91-5.2.0-devel+git.fccb547e325a #1 [ 0.625432] Hardware name: Toradex Apalis iMX8QM V1.1 on Apalis Evaluation Board (DT) [ 0.633270] pstate: 40000005 (nZcv daif -PAN -UAO) [ 0.638081] pc : caam_probe+0xab4/0xf10 [ 0.641917] lr : caam_probe+0x14c/0xf10 [ 0.645754] sp : ffff80001004bb00 [ 0.649072] x29: ffff80001004bb00 x28: ffff800011314638 [ 0.654390] x27: 0000000000000000 x26: ffff8000112217a8 [ 0.659707] x25: ffff00087857a000 x24: ffff800013630f00 [ 0.665024] x23: ffff00087857a010 x22: ffff800011891000 [ 0.670341] x21: ffff800013600000 x20: 0000000001934211 [ 0.675657] x19: ffff000879362880 x18: ffff80001134e428 [ 0.680974] x17: ffff000878036a00 x16: ffff0008780365c8 [ 0.686291] x15: 0000000031400000 x14: ffffffffff000000 [ 0.691607] x13: ffff80001213f000 x12: 0000000000000001 [ 0.696924] x11: 0000000000000004 x10: 0101010101010101 [ 0.702241] x9 : ffffffffffffffff x8 : 0000000000000008 [ 0.707563] x7 : 0000000000000007 x6 : 0000000000000004 [ 0.712884] x5 : 0000000000000001 x4 : ffff00087f7dc720 [ 0.718201] x3 : 0000000000000004 x2 : 0000000000000000 [ 0.723517] x1 : 0000000000000001 x0 : ffff800013600004 [ 0.728837] Call trace: [ 0.731290] caam_probe+0xab4/0xf10 [ 0.734783] platform_drv_probe+0x50/0xa0 [ 0.738796] really_probe+0xd4/0x318 [ 0.742374] driver_probe_device+0x54/0xe8 [ 0.746471] device_driver_attach+0x6c/0x78 [ 0.750659] __driver_attach+0x54/0xd0 [ 0.754411] bus_for_each_dev+0x6c/0xc0 [ 0.758254] driver_attach+0x20/0x28 [ 0.761830] bus_add_driver+0x140/0x1e8 [ 0.765671] driver_register+0x60/0x110 [ 0.769510] __platform_driver_register+0x44/0x50 [ 0.774229] caam_driver_init+0x18/0x20 [ 0.778072] do_one_initcall+0x50/0x1a8 [ 0.781915] kernel_init_freeable+0x194/0x23c [ 0.786283] kernel_init+0x10/0x100 [ 0.789781] ret_from_fork+0x10/0x1c [ 0.793367] Code: d50332bf 52800020 b90002a0 17ffff70 (b9400000) [ 0.799487] ---[ end trace 70e76f5d0eb3a960 ]--- [ 0.804175] Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b [ 0.811843] SMP: stopping secondary CPUs [ 0.815776] Kernel Offset: disabled [ 0.819267] CPU features: 0x0002,2100600c [ 0.823277] Memory Limit: none [ 0.826340] ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b ]--- Related-to: ELB-3326 Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>
-rw-r--r--drivers/soc/imx/soc-imx-scu.c39
1 files changed, 18 insertions, 21 deletions
diff --git a/drivers/soc/imx/soc-imx-scu.c b/drivers/soc/imx/soc-imx-scu.c
index a34bd2b469ea..720b15972c21 100644
--- a/drivers/soc/imx/soc-imx-scu.c
+++ b/drivers/soc/imx/soc-imx-scu.c
@@ -35,26 +35,31 @@ struct imx_sc_msg_misc_get_soc_uid {
u32 uid_high;
} __packed;
-static int imx_scu_soc_uid(u64 *soc_uid)
+static ssize_t soc_uid_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
{
struct imx_sc_msg_misc_get_soc_uid msg;
struct imx_sc_rpc_msg *hdr = &msg.hdr;
- int ret;
+ u64 soc_uid;
+
+ memset(&msg, 0, sizeof(msg));
hdr->ver = IMX_SC_RPC_VERSION;
hdr->svc = IMX_SC_RPC_SVC_MISC;
hdr->func = IMX_SC_MISC_FUNC_UNIQUE_ID;
hdr->size = 1;
- ret = imx_scu_call_rpc(soc_ipc_handle, &msg, true);
+ imx_scu_call_rpc(soc_ipc_handle, &msg, true);
- *soc_uid = msg.uid_high;
- *soc_uid <<= 32;
- *soc_uid |= msg.uid_low;
+ soc_uid = msg.uid_high;
+ soc_uid <<= 32;
+ soc_uid |= msg.uid_low;
- return ret;
+ return sprintf(buf, "%016llX\n", soc_uid);
}
+static DEVICE_ATTR_RO(soc_uid);
+
static int imx_scu_soc_id(void)
{
struct imx_sc_msg_misc_get_soc_id msg;
@@ -83,7 +88,6 @@ static int imx_scu_soc_probe(struct platform_device *pdev)
struct soc_device_attribute *soc_dev_attr;
struct soc_device *soc_dev;
int id, ret;
- u64 uid = 0;
u32 val;
ret = imx_scu_get_handle(&soc_ipc_handle);
@@ -107,10 +111,6 @@ static int imx_scu_soc_probe(struct platform_device *pdev)
if (id < 0)
return -EINVAL;
- ret = imx_scu_soc_uid(&uid);
- if (ret < 0)
- return -EINVAL;
-
/* format soc_id value passed from SCU firmware */
val = id & 0x1f;
if (of_machine_is_compatible("fsl,imx8qm")) {
@@ -133,22 +133,19 @@ static int imx_scu_soc_probe(struct platform_device *pdev)
goto free_soc_id;
}
- soc_dev_attr->serial_number = kasprintf(GFP_KERNEL, "%016llX", uid);
- if (!soc_dev_attr->serial_number) {
- ret = -ENOMEM;
- goto free_revision;
- }
-
soc_dev = soc_device_register(soc_dev_attr);
if (IS_ERR(soc_dev)) {
ret = PTR_ERR(soc_dev);
- goto free_serial_number;
+ goto free_revision;
}
+ ret = device_create_file(soc_device_to_device(soc_dev),
+ &dev_attr_soc_uid);
+ if (ret)
+ goto free_revision;
+
return 0;
-free_serial_number:
- kfree(soc_dev_attr->serial_number);
free_revision:
kfree(soc_dev_attr->revision);
free_soc_id: