Message ID | 20200318082503.8025-4-patrick.delaunay@st.com |
---|---|
State | Accepted |
Commit | 7802a4495f3c2db09b125a4963f4328b95a38429 |
Delegated to: | Patrick Delaunay |
Headers | show |
Series | stm32mp1: add command stm32prog | expand |
Hi On 3/18/20 9:24 AM, Patrick Delaunay wrote: > 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> > --- > > arch/arm/mach-stm32mp/cpu.c | 11 ++++++----- > arch/arm/mach-stm32mp/include/mach/sys_proto.h | 5 +++++ > 2 files changed, 11 insertions(+), 5 deletions(-) > > diff --git a/arch/arm/mach-stm32mp/cpu.c b/arch/arm/mach-stm32mp/cpu.c > index e14e3e47f2..36a9205819 100644 > --- a/arch/arm/mach-stm32mp/cpu.c > +++ b/arch/arm/mach-stm32mp/cpu.c > @@ -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 */ > diff --git a/arch/arm/mach-stm32mp/include/mach/sys_proto.h b/arch/arm/mach-stm32mp/include/mach/sys_proto.h > index 1617126bea..4b6c7b8bdd 100644 > --- a/arch/arm/mach-stm32mp/include/mach/sys_proto.h > +++ b/arch/arm/mach-stm32mp/include/mach/sys_proto.h > @@ -20,6 +20,11 @@ > /* 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 Reviewed-by: Patrice Chotard <patrice.chotard@st.com> Thanks Patrice
diff --git a/arch/arm/mach-stm32mp/cpu.c b/arch/arm/mach-stm32mp/cpu.c index e14e3e47f2..36a9205819 100644 --- a/arch/arm/mach-stm32mp/cpu.c +++ b/arch/arm/mach-stm32mp/cpu.c @@ -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 */ diff --git a/arch/arm/mach-stm32mp/include/mach/sys_proto.h b/arch/arm/mach-stm32mp/include/mach/sys_proto.h index 1617126bea..4b6c7b8bdd 100644 --- a/arch/arm/mach-stm32mp/include/mach/sys_proto.h +++ b/arch/arm/mach-stm32mp/include/mach/sys_proto.h @@ -20,6 +20,11 @@ /* 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
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> --- arch/arm/mach-stm32mp/cpu.c | 11 ++++++----- arch/arm/mach-stm32mp/include/mach/sys_proto.h | 5 +++++ 2 files changed, 11 insertions(+), 5 deletions(-)