* [PATCH] ARM: i.MX: OCOTP: read serial number with correct endianness
@ 2020-12-03 15:40 Robert Karszniewicz
2020-12-07 7:37 ` Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: Robert Karszniewicz @ 2020-12-03 15:40 UTC (permalink / raw)
To: barebox
The serial number is stored with the low bytes first, as can be seen in
Linux commit 8267ff89b713 ("ARM: imx: Add serial number support for
i.MX6/7 SoCs"). The same goes for i.MX8M.
Also renamed the macro to the more descriptive name from Linux.
Fixes: c4d9463d969b ("i.MX: Introduce imx_ocotp_read_uid()")
Signed-off-by: Robert Karszniewicz <r.karszniewicz@phytec.de>
---
arch/arm/mach-imx/include/mach/ocotp.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/arm/mach-imx/include/mach/ocotp.h b/arch/arm/mach-imx/include/mach/ocotp.h
index 7ba5da156b76..20205c5da759 100644
--- a/arch/arm/mach-imx/include/mach/ocotp.h
+++ b/arch/arm/mach-imx/include/mach/ocotp.h
@@ -26,8 +26,8 @@
#define OCOTP_BIT(n) FIELD_PREP(OCOTP_BIT_MASK, n)
#define OCOTP_WIDTH(n) FIELD_PREP(OCOTP_WIDTH_MASK, (n) - 1)
-#define OCOTP_OFFSET_CFG0 0x410
-#define OCOTP_OFFSET_CFG1 0x420
+#define OCOTP_UID_L 0x410
+#define OCOTP_UID_H 0x420
int imx_ocotp_read_field(uint32_t field, unsigned *value);
@@ -39,9 +39,9 @@ static inline u64 imx_ocotp_read_uid(void __iomem *ocotp)
{
u64 uid;
- uid = readl(ocotp + OCOTP_OFFSET_CFG0);
+ uid = readl(ocotp + OCOTP_UID_H);
uid <<= 32;
- uid |= readl(ocotp + OCOTP_OFFSET_CFG1);
+ uid |= readl(ocotp + OCOTP_UID_L);
return uid;
}
--
2.7.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] ARM: i.MX: OCOTP: read serial number with correct endianness
2020-12-03 15:40 [PATCH] ARM: i.MX: OCOTP: read serial number with correct endianness Robert Karszniewicz
@ 2020-12-07 7:37 ` Sascha Hauer
0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2020-12-07 7:37 UTC (permalink / raw)
To: Robert Karszniewicz; +Cc: barebox
On Thu, Dec 03, 2020 at 04:40:50PM +0100, Robert Karszniewicz wrote:
> The serial number is stored with the low bytes first, as can be seen in
> Linux commit 8267ff89b713 ("ARM: imx: Add serial number support for
> i.MX6/7 SoCs"). The same goes for i.MX8M.
>
> Also renamed the macro to the more descriptive name from Linux.
>
> Fixes: c4d9463d969b ("i.MX: Introduce imx_ocotp_read_uid()")
> Signed-off-by: Robert Karszniewicz <r.karszniewicz@phytec.de>
> ---
> arch/arm/mach-imx/include/mach/ocotp.h | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
Applied, thanks
Sascha
>
> diff --git a/arch/arm/mach-imx/include/mach/ocotp.h b/arch/arm/mach-imx/include/mach/ocotp.h
> index 7ba5da156b76..20205c5da759 100644
> --- a/arch/arm/mach-imx/include/mach/ocotp.h
> +++ b/arch/arm/mach-imx/include/mach/ocotp.h
> @@ -26,8 +26,8 @@
> #define OCOTP_BIT(n) FIELD_PREP(OCOTP_BIT_MASK, n)
> #define OCOTP_WIDTH(n) FIELD_PREP(OCOTP_WIDTH_MASK, (n) - 1)
>
> -#define OCOTP_OFFSET_CFG0 0x410
> -#define OCOTP_OFFSET_CFG1 0x420
> +#define OCOTP_UID_L 0x410
> +#define OCOTP_UID_H 0x420
>
>
> int imx_ocotp_read_field(uint32_t field, unsigned *value);
> @@ -39,9 +39,9 @@ static inline u64 imx_ocotp_read_uid(void __iomem *ocotp)
> {
> u64 uid;
>
> - uid = readl(ocotp + OCOTP_OFFSET_CFG0);
> + uid = readl(ocotp + OCOTP_UID_H);
> uid <<= 32;
> - uid |= readl(ocotp + OCOTP_OFFSET_CFG1);
> + uid |= readl(ocotp + OCOTP_UID_L);
>
> return uid;
> }
> --
> 2.7.4
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-12-07 7:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-03 15:40 [PATCH] ARM: i.MX: OCOTP: read serial number with correct endianness Robert Karszniewicz
2020-12-07 7:37 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox