]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
stm32mp: add function get_cpu_dev
authorPatrick Delaunay <patrick.delaunay@st.com>
Wed, 18 Mar 2020 08:24:48 +0000 (09:24 +0100)
committerPatrick Delaunay <patrick.delaunay@st.com>
Thu, 14 May 2020 07:02:12 +0000 (09:02 +0200)
Add a function get_cpu_dev to get the DEV_ID present
in DBGMCU_IDC register.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
arch/arm/mach-stm32mp/cpu.c
arch/arm/mach-stm32mp/include/mach/sys_proto.h

index 73d8b753474d9f2f6f03ab6089ad0411a722c84f..f3418128cafb3509b02675eecb4c3b37833643f0 100644 (file)
@@ -236,6 +236,11 @@ static u32 read_idc(void)
        return readl(DBGMCU_IDC);
 }
 
+u32 get_cpu_dev(void)
+{
+       return (read_idc() & DBGMCU_IDC_DEV_ID_MASK) >> DBGMCU_IDC_DEV_ID_SHIFT;
+}
+
 u32 get_cpu_rev(void)
 {
        return (read_idc() & DBGMCU_IDC_REV_ID_MASK) >> DBGMCU_IDC_REV_ID_SHIFT;
@@ -266,11 +271,7 @@ static u32 get_cpu_rpn(void)
 
 u32 get_cpu_type(void)
 {
-       u32 id;
-
-       id = (read_idc() & DBGMCU_IDC_DEV_ID_MASK) >> DBGMCU_IDC_DEV_ID_SHIFT;
-
-       return (id << 16) | get_cpu_rpn();
+       return (get_cpu_dev() << 16) | get_cpu_rpn();
 }
 
 /* Get Package options from OTP */
index 1617126beac4b045d5a3e08c3fdfb32a1a98416a..4b6c7b8bdd260fb7b6a937466504eddf5c8d6b2b 100644 (file)
 /* return CPU_STMP32MP...Xxx constants */
 u32 get_cpu_type(void);
 
+#define CPU_DEV_STM32MP15      0x500
+
+/* return CPU_DEV constants */
+u32 get_cpu_dev(void);
+
 #define CPU_REVA       0x1000
 #define CPU_REVB       0x2000
 #define CPU_REVZ       0x2001