* [PATCH 0/2] Fix imx6ull/6ulz boot crash
@ 2019-12-10 21:49 Leonard Crestez
2019-12-10 21:49 ` [PATCH 1/2] ARM: imx: Fix boot crash if ocotp is not found Leonard Crestez
2019-12-10 21:49 ` [PATCH 2/2] ARM: imx: Fix ocotp_compat for 6ull/6ulz Leonard Crestez
0 siblings, 2 replies; 9+ messages in thread
From: Leonard Crestez @ 2019-12-10 21:49 UTC (permalink / raw)
To: Shawn Guo, Anson Huang
Cc: Dong Aisheng, Fabio Estevam, linux-imx, kernel, linux-arm-kernel
These chips currently crash on boot while attempting to read SOC serial
number. Fix in two stages:
* Fix ocotp lookup crash on failure
* Fix ocotp lookup failure
Leonard Crestez (2):
ARM: imx: Fix boot crash if ocotp is not found
ARM: imx: Fix ocotp_compat for 6ull/6ulz
arch/arm/mach-imx/cpu.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
--
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 [flat|nested] 9+ messages in thread
* [PATCH 1/2] ARM: imx: Fix boot crash if ocotp is not found
2019-12-10 21:49 [PATCH 0/2] Fix imx6ull/6ulz boot crash Leonard Crestez
@ 2019-12-10 21:49 ` Leonard Crestez
2019-12-11 10:25 ` Christoph Niedermaier
2019-12-12 2:44 ` Shawn Guo
2019-12-10 21:49 ` [PATCH 2/2] ARM: imx: Fix ocotp_compat for 6ull/6ulz Leonard Crestez
1 sibling, 2 replies; 9+ messages in thread
From: Leonard Crestez @ 2019-12-10 21:49 UTC (permalink / raw)
To: Shawn Guo, Anson Huang
Cc: Dong Aisheng, Fabio Estevam, linux-imx, kernel, linux-arm-kernel
The imx_soc_device_init functions tries to fetch the ocotp regmap in
order to soc serial number. If regmap fetch fails then a message is
printed but regmap_read is called anyway and the system crashes.
Failing to lookup ocotp regmap shouldn't be a fatal boot error so check
that the pointer is valid.
Only side-effect of ocotp lookup failure now is that serial number will
be reported as all-zeros which is acceptable.
Cc: stable@vger.kernel.org
Fixes: 8267ff89b713 ("ARM: imx: Add serial number support for i.MX6/7 SoCs")
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
---
arch/arm/mach-imx/cpu.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-imx/cpu.c b/arch/arm/mach-imx/cpu.c
index d70b6fc72b35..484bf6cdb363 100644
--- a/arch/arm/mach-imx/cpu.c
+++ b/arch/arm/mach-imx/cpu.c
@@ -87,11 +87,11 @@ struct device * __init imx_soc_device_init(void)
{
struct soc_device_attribute *soc_dev_attr;
const char *ocotp_compat = NULL;
struct soc_device *soc_dev;
struct device_node *root;
- struct regmap *ocotp;
+ struct regmap *ocotp = NULL;
const char *soc_id;
u64 soc_uid = 0;
u32 val;
int ret;
@@ -179,11 +179,13 @@ struct device * __init imx_soc_device_init(void)
if (ocotp_compat) {
ocotp = syscon_regmap_lookup_by_compatible(ocotp_compat);
if (IS_ERR(ocotp))
pr_err("%s: failed to find %s regmap!\n", __func__, ocotp_compat);
+ }
+ if (!IS_ERR_OR_NULL(ocotp)) {
if (__mxc_cpu_type == MXC_CPU_IMX7ULP) {
regmap_read(ocotp, OCOTP_ULP_UID_4, &val);
soc_uid = val & 0xffff;
regmap_read(ocotp, OCOTP_ULP_UID_3, &val);
soc_uid <<= 16;
--
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] 9+ messages in thread
* [PATCH 2/2] ARM: imx: Fix ocotp_compat for 6ull/6ulz
2019-12-10 21:49 [PATCH 0/2] Fix imx6ull/6ulz boot crash Leonard Crestez
2019-12-10 21:49 ` [PATCH 1/2] ARM: imx: Fix boot crash if ocotp is not found Leonard Crestez
@ 2019-12-10 21:49 ` Leonard Crestez
2019-12-10 21:53 ` Fabio Estevam
2019-12-11 10:34 ` Christoph Niedermaier
1 sibling, 2 replies; 9+ messages in thread
From: Leonard Crestez @ 2019-12-10 21:49 UTC (permalink / raw)
To: Shawn Guo, Anson Huang
Cc: Dong Aisheng, Fabio Estevam, linux-imx, kernel, linux-arm-kernel
The ocotp compatible string on imx6ull and imx6ulz is currently
"fsl,imx6ull-ocotp" but the imx_soc_device_init function attempts to
lookup for "fsl,imx6ul-ocotp" (single L).
Fix the constant and make cat /sys/devices/soc0/serial_number print
useful information instead of all-zeros.
Fixes: 8267ff89b713 ("ARM: imx: Add serial number support for i.MX6/7 SoCs")
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
---
arch/arm/mach-imx/cpu.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-imx/cpu.c b/arch/arm/mach-imx/cpu.c
index 484bf6cdb363..06f8d64b65af 100644
--- a/arch/arm/mach-imx/cpu.c
+++ b/arch/arm/mach-imx/cpu.c
@@ -151,15 +151,15 @@ struct device * __init imx_soc_device_init(void)
case MXC_CPU_IMX6UL:
ocotp_compat = "fsl,imx6ul-ocotp";
soc_id = "i.MX6UL";
break;
case MXC_CPU_IMX6ULL:
- ocotp_compat = "fsl,imx6ul-ocotp";
+ ocotp_compat = "fsl,imx6ull-ocotp";
soc_id = "i.MX6ULL";
break;
case MXC_CPU_IMX6ULZ:
- ocotp_compat = "fsl,imx6ul-ocotp";
+ ocotp_compat = "fsl,imx6ull-ocotp";
soc_id = "i.MX6ULZ";
break;
case MXC_CPU_IMX6SLL:
ocotp_compat = "fsl,imx6sll-ocotp";
soc_id = "i.MX6SLL";
--
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] 9+ messages in thread
* Re: [PATCH 2/2] ARM: imx: Fix ocotp_compat for 6ull/6ulz
2019-12-10 21:49 ` [PATCH 2/2] ARM: imx: Fix ocotp_compat for 6ull/6ulz Leonard Crestez
@ 2019-12-10 21:53 ` Fabio Estevam
2019-12-10 23:00 ` Leonard Crestez
2019-12-11 10:34 ` Christoph Niedermaier
1 sibling, 1 reply; 9+ messages in thread
From: Fabio Estevam @ 2019-12-10 21:53 UTC (permalink / raw)
To: Leonard Crestez, Christoph Niedermaier
Cc: Dong Aisheng, Anson Huang, NXP Linux Team, Sascha Hauer,
Fabio Estevam, Shawn Guo,
moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE
On Tue, Dec 10, 2019 at 6:50 PM Leonard Crestez <leonard.crestez@nxp.com> wrote:
>
> The ocotp compatible string on imx6ull and imx6ulz is currently
> "fsl,imx6ull-ocotp" but the imx_soc_device_init function attempts to
> lookup for "fsl,imx6ul-ocotp" (single L).
>
> Fix the constant and make cat /sys/devices/soc0/serial_number print
> useful information instead of all-zeros.
>
> Fixes: 8267ff89b713 ("ARM: imx: Add serial number support for i.MX6/7 SoCs")
> Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
This fix has already been submitted by Christoph:
http://lists.infradead.org/pipermail/linux-arm-kernel/2019-December/697761.html
_______________________________________________
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] 9+ messages in thread
* Re: [PATCH 2/2] ARM: imx: Fix ocotp_compat for 6ull/6ulz
2019-12-10 21:53 ` Fabio Estevam
@ 2019-12-10 23:00 ` Leonard Crestez
0 siblings, 0 replies; 9+ messages in thread
From: Leonard Crestez @ 2019-12-10 23:00 UTC (permalink / raw)
To: Fabio Estevam, Christoph Niedermaier
Cc: Aisheng Dong, Anson Huang, dl-linux-imx, Sascha Hauer,
Fabio Estevam, Shawn Guo,
moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE
On 10.12.2019 23:53, Fabio Estevam wrote:
> On Tue, Dec 10, 2019 at 6:50 PM Leonard Crestez <leonard.crestez@nxp.com> wrote:
>>
>> The ocotp compatible string on imx6ull and imx6ulz is currently
>> "fsl,imx6ull-ocotp" but the imx_soc_device_init function attempts to
>> lookup for "fsl,imx6ul-ocotp" (single L).
>>
>> Fix the constant and make cat /sys/devices/soc0/serial_number print
>> useful information instead of all-zeros.
>>
>> Fixes: 8267ff89b713 ("ARM: imx: Add serial number support for i.MX6/7 SoCs")
>> Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
>
> This fix has already been submitted by Christoph:
Sorry, didn't notice.
My [PATCH 1/2] is still relevant though: for example the kernel could
run against a very old DTB or maybe there's some other scenario where
ocotp regmap lookup could fail.
--
Regards,
Leonard
_______________________________________________
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] 9+ messages in thread
* Re: [PATCH 1/2] ARM: imx: Fix boot crash if ocotp is not found
2019-12-10 21:49 ` [PATCH 1/2] ARM: imx: Fix boot crash if ocotp is not found Leonard Crestez
@ 2019-12-11 10:25 ` Christoph Niedermaier
2019-12-12 2:44 ` Shawn Guo
1 sibling, 0 replies; 9+ messages in thread
From: Christoph Niedermaier @ 2019-12-11 10:25 UTC (permalink / raw)
To: Leonard Crestez, Shawn Guo, Anson Huang
Cc: Dong Aisheng, Fabio Estevam, linux-imx, kernel, linux-arm-kernel
From: Leonard Crestez <leonard.crestez@nxp.com>
Sent: Tuesday, December 10, 2019 10:49 PM
> The imx_soc_device_init functions tries to fetch the ocotp regmap in
> order to soc serial number. If regmap fetch fails then a message is
> printed but regmap_read is called anyway and the system crashes.
>
> Failing to lookup ocotp regmap shouldn't be a fatal boot error so check
> that the pointer is valid.
>
> Only side-effect of ocotp lookup failure now is that serial number will
> be reported as all-zeros which is acceptable.
>
> Cc: stable@vger.kernel.org
> Fixes: 8267ff89b713 ("ARM: imx: Add serial number support for i.MX6/7 SoCs")
> Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
> ---
> arch/arm/mach-imx/cpu.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm/mach-imx/cpu.c b/arch/arm/mach-imx/cpu.c
> index d70b6fc72b35..484bf6cdb363 100644
> --- a/arch/arm/mach-imx/cpu.c
> +++ b/arch/arm/mach-imx/cpu.c
> @@ -87,11 +87,11 @@ struct device * __init imx_soc_device_init(void)
> {
> struct soc_device_attribute *soc_dev_attr;
> const char *ocotp_compat = NULL;
> struct soc_device *soc_dev;
> struct device_node *root;
> - struct regmap *ocotp;
> + struct regmap *ocotp = NULL;
> const char *soc_id;
> u64 soc_uid = 0;
> u32 val;
> int ret;
>
> @@ -179,11 +179,13 @@ struct device * __init imx_soc_device_init(void)
>
> if (ocotp_compat) {
> ocotp = syscon_regmap_lookup_by_compatible(ocotp_compat);
> if (IS_ERR(ocotp))
> pr_err("%s: failed to find %s regmap!\n", __func__, ocotp_compat);
> + }
>
> + if (!IS_ERR_OR_NULL(ocotp)) {
> if (__mxc_cpu_type == MXC_CPU_IMX7ULP) {
> regmap_read(ocotp, OCOTP_ULP_UID_4, &val);
> soc_uid = val & 0xffff;
> regmap_read(ocotp, OCOTP_ULP_UID_3, &val);
> soc_uid <<= 16;
>
Tested-by: Christoph Niedermaier <cniedermaier@dh-electronics.com>
Best regards,
Christoph
_______________________________________________
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] 9+ messages in thread
* RE: [PATCH 2/2] ARM: imx: Fix ocotp_compat for 6ull/6ulz
2019-12-10 21:49 ` [PATCH 2/2] ARM: imx: Fix ocotp_compat for 6ull/6ulz Leonard Crestez
2019-12-10 21:53 ` Fabio Estevam
@ 2019-12-11 10:34 ` Christoph Niedermaier
2019-12-11 12:19 ` Leonard Crestez
1 sibling, 1 reply; 9+ messages in thread
From: Christoph Niedermaier @ 2019-12-11 10:34 UTC (permalink / raw)
To: Leonard Crestez, Shawn Guo, Anson Huang
Cc: Dong Aisheng, Fabio Estevam, linux-imx, kernel, linux-arm-kernel
From: Leonard Crestez <leonard.crestez@nxp.com>
Sent: Tuesday, December 10, 2019 10:49 PM
> The ocotp compatible string on imx6ull and imx6ulz is currently
> "fsl,imx6ull-ocotp" but the imx_soc_device_init function attempts to
> lookup for "fsl,imx6ul-ocotp" (single L).
>
> Fix the constant and make cat /sys/devices/soc0/serial_number print
> useful information instead of all-zeros.
>
> Fixes: 8267ff89b713 ("ARM: imx: Add serial number support for i.MX6/7 SoCs")
> Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
> ---
> arch/arm/mach-imx/cpu.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/mach-imx/cpu.c b/arch/arm/mach-imx/cpu.c
> index 484bf6cdb363..06f8d64b65af 100644
> --- a/arch/arm/mach-imx/cpu.c
> +++ b/arch/arm/mach-imx/cpu.c
> @@ -151,15 +151,15 @@ struct device * __init imx_soc_device_init(void)
> case MXC_CPU_IMX6UL:
> ocotp_compat = "fsl,imx6ul-ocotp";
> soc_id = "i.MX6UL";
> break;
> case MXC_CPU_IMX6ULL:
> - ocotp_compat = "fsl,imx6ul-ocotp";
> + ocotp_compat = "fsl,imx6ull-ocotp";
> soc_id = "i.MX6ULL";
> break;
> case MXC_CPU_IMX6ULZ:
> - ocotp_compat = "fsl,imx6ul-ocotp";
> + ocotp_compat = "fsl,imx6ull-ocotp";
> soc_id = "i.MX6ULZ";
> break;
> case MXC_CPU_IMX6SLL:
> ocotp_compat = "fsl,imx6sll-ocotp";
> soc_id = "i.MX6SLL";
>
I also had this problem and therefore already submitted a patch
("ARM: imx: Correct ocotp id for serial number support of i.MX6ULL/ULZ SoCs").
I hope this isn't a problem.
Best regards,
Christoph
_______________________________________________
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] 9+ messages in thread
* Re: [PATCH 2/2] ARM: imx: Fix ocotp_compat for 6ull/6ulz
2019-12-11 10:34 ` Christoph Niedermaier
@ 2019-12-11 12:19 ` Leonard Crestez
0 siblings, 0 replies; 9+ messages in thread
From: Leonard Crestez @ 2019-12-11 12:19 UTC (permalink / raw)
To: Christoph Niedermaier, Fabio Estevam
Cc: Aisheng Dong, Anson Huang, dl-linux-imx, kernel, Shawn Guo,
linux-arm-kernel
On 2019-12-11 12:34 PM, Christoph Niedermaier wrote:
> From: Leonard Crestez <leonard.crestez@nxp.com>
> Sent: Tuesday, December 10, 2019 10:49 PM
>> The ocotp compatible string on imx6ull and imx6ulz is currently
>> "fsl,imx6ull-ocotp" but the imx_soc_device_init function attempts to
>> lookup for "fsl,imx6ul-ocotp" (single L).
>>
>> Fix the constant and make cat /sys/devices/soc0/serial_number print
>> useful information instead of all-zeros.
>>
>> Fixes: 8267ff89b713 ("ARM: imx: Add serial number support for i.MX6/7 SoCs")
>> Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
>> ---
>> arch/arm/mach-imx/cpu.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/arm/mach-imx/cpu.c b/arch/arm/mach-imx/cpu.c
>> index 484bf6cdb363..06f8d64b65af 100644
>> --- a/arch/arm/mach-imx/cpu.c
>> +++ b/arch/arm/mach-imx/cpu.c
>> @@ -151,15 +151,15 @@ struct device * __init imx_soc_device_init(void)
>> case MXC_CPU_IMX6UL:
>> ocotp_compat = "fsl,imx6ul-ocotp";
>> soc_id = "i.MX6UL";
>> break;
>> case MXC_CPU_IMX6ULL:
>> - ocotp_compat = "fsl,imx6ul-ocotp";
>> + ocotp_compat = "fsl,imx6ull-ocotp";
>> soc_id = "i.MX6ULL";
>> break;
>> case MXC_CPU_IMX6ULZ:
>> - ocotp_compat = "fsl,imx6ul-ocotp";
>> + ocotp_compat = "fsl,imx6ull-ocotp";
>> soc_id = "i.MX6ULZ";
>> break;
>> case MXC_CPU_IMX6SLL:
>> ocotp_compat = "fsl,imx6sll-ocotp";
>> soc_id = "i.MX6SLL";
>>
>
> I also had this problem and therefore already submitted a patch
> ("ARM: imx: Correct ocotp id for serial number support of i.MX6ULL/ULZ SoCs").
> I hope this isn't a problem.
No problem; I should have noticed your patch.
--
Regards,
Leonard
_______________________________________________
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] 9+ messages in thread
* Re: [PATCH 1/2] ARM: imx: Fix boot crash if ocotp is not found
2019-12-10 21:49 ` [PATCH 1/2] ARM: imx: Fix boot crash if ocotp is not found Leonard Crestez
2019-12-11 10:25 ` Christoph Niedermaier
@ 2019-12-12 2:44 ` Shawn Guo
1 sibling, 0 replies; 9+ messages in thread
From: Shawn Guo @ 2019-12-12 2:44 UTC (permalink / raw)
To: Leonard Crestez
Cc: Dong Aisheng, Anson Huang, linux-imx, kernel, Fabio Estevam,
linux-arm-kernel
On Tue, Dec 10, 2019 at 11:49:28PM +0200, Leonard Crestez wrote:
> The imx_soc_device_init functions tries to fetch the ocotp regmap in
> order to soc serial number. If regmap fetch fails then a message is
> printed but regmap_read is called anyway and the system crashes.
>
> Failing to lookup ocotp regmap shouldn't be a fatal boot error so check
> that the pointer is valid.
>
> Only side-effect of ocotp lookup failure now is that serial number will
> be reported as all-zeros which is acceptable.
>
> Cc: stable@vger.kernel.org
> Fixes: 8267ff89b713 ("ARM: imx: Add serial number support for i.MX6/7 SoCs")
> Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
As this is a fix we want it in 5.5-rc, it should be generated against
5.5-rc1 rather than -next. I rebased it and applied, thanks.
Shawn
_______________________________________________
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] 9+ messages in thread
end of thread, other threads:[~2019-12-12 2:44 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-10 21:49 [PATCH 0/2] Fix imx6ull/6ulz boot crash Leonard Crestez
2019-12-10 21:49 ` [PATCH 1/2] ARM: imx: Fix boot crash if ocotp is not found Leonard Crestez
2019-12-11 10:25 ` Christoph Niedermaier
2019-12-12 2:44 ` Shawn Guo
2019-12-10 21:49 ` [PATCH 2/2] ARM: imx: Fix ocotp_compat for 6ull/6ulz Leonard Crestez
2019-12-10 21:53 ` Fabio Estevam
2019-12-10 23:00 ` Leonard Crestez
2019-12-11 10:34 ` Christoph Niedermaier
2019-12-11 12:19 ` Leonard Crestez
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.