Message ID | 20200422135235.14756-2-peng.fan@nxp.com |
---|---|
State | New |
Headers | show |
Series | [01/24] imx: fix cpu_type helper | expand |
Hi Peng, On Wed, Apr 22, 2020 at 10:30 AM Peng Fan <peng.fan at nxp.com> wrote: > > From: Ye Li <ye.li at nxp.com> > > According to iMX8MM datasheet (IMX8MMIEC_Rev_D and IMX8MMCEC_Rev_D), > the speed grading for imx8mm is 800Mhz, 1.2Ghz, 1.6Ghz and 1.8Ghz. > Update them to get_cpu_speed_grade_hz function. > > Signed-off-by: Ye Li <ye.li at nxp.com> > Reviewed-by: Peng Fan <peng.fan at nxp.com> > --- > arch/arm/mach-imx/cpu.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/arch/arm/mach-imx/cpu.c b/arch/arm/mach-imx/cpu.c > index bfa85c64c6..55e3539cff 100644 > --- a/arch/arm/mach-imx/cpu.c > +++ b/arch/arm/mach-imx/cpu.c > @@ -332,11 +332,11 @@ u32 get_cpu_speed_grade_hz(void) > case OCOTP_TESTER3_SPEED_GRADE0: > return 800000000; > case OCOTP_TESTER3_SPEED_GRADE1: > - return is_mx7() ? 500000000 : 1000000000; > + return (is_mx7() ? 500000000 : (is_imx8mq() ? 1000000000 : 1200000000)); > case OCOTP_TESTER3_SPEED_GRADE2: > - return is_mx7() ? 1000000000 : 1300000000; > + return (is_mx7() ? 1000000000 : (is_imx8mq() ? 1300000000 : 1600000000)); > case OCOTP_TESTER3_SPEED_GRADE3: > - return is_mx7() ? 1200000000 : 1500000000; > + return (is_mx7() ? 1200000000 : (is_imx8mq() ? 1500000000 : 1800000000)); With new chips being introduced this approach seems to not scale well. This code is getting hard to follow.
diff --git a/arch/arm/mach-imx/cpu.c b/arch/arm/mach-imx/cpu.c index bfa85c64c6..55e3539cff 100644 --- a/arch/arm/mach-imx/cpu.c +++ b/arch/arm/mach-imx/cpu.c @@ -332,11 +332,11 @@ u32 get_cpu_speed_grade_hz(void) case OCOTP_TESTER3_SPEED_GRADE0: return 800000000; case OCOTP_TESTER3_SPEED_GRADE1: - return is_mx7() ? 500000000 : 1000000000; + return (is_mx7() ? 500000000 : (is_imx8mq() ? 1000000000 : 1200000000)); case OCOTP_TESTER3_SPEED_GRADE2: - return is_mx7() ? 1000000000 : 1300000000; + return (is_mx7() ? 1000000000 : (is_imx8mq() ? 1300000000 : 1600000000)); case OCOTP_TESTER3_SPEED_GRADE3: - return is_mx7() ? 1200000000 : 1500000000; + return (is_mx7() ? 1200000000 : (is_imx8mq() ? 1500000000 : 1800000000)); } return 0;