* [U-Boot] [PATCH] mx7: Distinguish between dual and solo versions
@ 2016-02-28 15:33 Fabio Estevam
2016-02-29 5:04 ` Peng Fan
2016-03-09 11:50 ` Stefano Babic
0 siblings, 2 replies; 3+ messages in thread
From: Fabio Estevam @ 2016-02-28 15:33 UTC (permalink / raw)
To: u-boot
From: Fabio Estevam <fabio.estevam@nxp.com>
Read the number of cores in the fuses to distinguish between
the dual and solo versions.
Tested on a mx7d sabresd and on a mx7solo warp7.
Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
---
arch/arm/cpu/armv7/mx7/soc.c | 18 ++++++++++++++++++
arch/arm/imx-common/cpu.c | 2 ++
arch/arm/include/asm/arch-imx/cpu.h | 1 +
3 files changed, 21 insertions(+)
diff --git a/arch/arm/cpu/armv7/mx7/soc.c b/arch/arm/cpu/armv7/mx7/soc.c
index ba6cfb9..073bbc6 100644
--- a/arch/arm/cpu/armv7/mx7/soc.c
+++ b/arch/arm/cpu/armv7/mx7/soc.c
@@ -165,6 +165,21 @@ u32 get_cpu_temp_grade(int *minc, int *maxc)
return val;
}
+static bool is_mx7d(void)
+{
+ struct ocotp_regs *ocotp = (struct ocotp_regs *)OCOTP_BASE_ADDR;
+ struct fuse_bank *bank = &ocotp->bank[1];
+ struct fuse_bank1_regs *fuse =
+ (struct fuse_bank1_regs *)bank->fuse_regs;
+ int val;
+
+ val = readl(&fuse->tester4);
+ if (val & 1)
+ return false;
+ else
+ return true;
+}
+
u32 get_cpu_rev(void)
{
struct mxc_ccm_anatop_reg *ccm_anatop = (struct mxc_ccm_anatop_reg *)
@@ -172,6 +187,9 @@ u32 get_cpu_rev(void)
u32 reg = readl(&ccm_anatop->digprog);
u32 type = (reg >> 16) & 0xff;
+ if (!is_mx7d())
+ type = MXC_CPU_MX7S;
+
reg &= 0xff;
return (type << 12) | reg;
}
diff --git a/arch/arm/imx-common/cpu.c b/arch/arm/imx-common/cpu.c
index 656bb60..5fb3ed8 100644
--- a/arch/arm/imx-common/cpu.c
+++ b/arch/arm/imx-common/cpu.c
@@ -137,6 +137,8 @@ unsigned imx_ddr_size(void)
const char *get_imx_type(u32 imxtype)
{
switch (imxtype) {
+ case MXC_CPU_MX7S:
+ return "7SOLO"; /* Single-core version of the mx7 */
case MXC_CPU_MX7D:
return "7D"; /* Dual-core version of the mx7 */
case MXC_CPU_MX6QP:
diff --git a/arch/arm/include/asm/arch-imx/cpu.h b/arch/arm/include/asm/arch-imx/cpu.h
index 8a75902..7c63c13 100644
--- a/arch/arm/include/asm/arch-imx/cpu.h
+++ b/arch/arm/include/asm/arch-imx/cpu.h
@@ -21,6 +21,7 @@
#define MXC_CPU_MX6D 0x67
#define MXC_CPU_MX6DP 0x68
#define MXC_CPU_MX6QP 0x69
+#define MXC_CPU_MX7S 0x71 /* dummy ID */
#define MXC_CPU_MX7D 0x72
#define MXC_CPU_VF610 0xF6 /* dummy ID */
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [U-Boot] [PATCH] mx7: Distinguish between dual and solo versions
2016-02-28 15:33 [U-Boot] [PATCH] mx7: Distinguish between dual and solo versions Fabio Estevam
@ 2016-02-29 5:04 ` Peng Fan
2016-03-09 11:50 ` Stefano Babic
1 sibling, 0 replies; 3+ messages in thread
From: Peng Fan @ 2016-02-29 5:04 UTC (permalink / raw)
To: u-boot
Hi Fabio,
On Sun, Feb 28, 2016 at 12:33:17PM -0300, Fabio Estevam wrote:
>From: Fabio Estevam <fabio.estevam@nxp.com>
>
>Read the number of cores in the fuses to distinguish between
>the dual and solo versions.
>
>Tested on a mx7d sabresd and on a mx7solo warp7.
>
>Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
>---
> arch/arm/cpu/armv7/mx7/soc.c | 18 ++++++++++++++++++
> arch/arm/imx-common/cpu.c | 2 ++
> arch/arm/include/asm/arch-imx/cpu.h | 1 +
> 3 files changed, 21 insertions(+)
>
>diff --git a/arch/arm/cpu/armv7/mx7/soc.c b/arch/arm/cpu/armv7/mx7/soc.c
>index ba6cfb9..073bbc6 100644
>--- a/arch/arm/cpu/armv7/mx7/soc.c
>+++ b/arch/arm/cpu/armv7/mx7/soc.c
>@@ -165,6 +165,21 @@ u32 get_cpu_temp_grade(int *minc, int *maxc)
> return val;
> }
>
>+static bool is_mx7d(void)
>+{
>+ struct ocotp_regs *ocotp = (struct ocotp_regs *)OCOTP_BASE_ADDR;
>+ struct fuse_bank *bank = &ocotp->bank[1];
>+ struct fuse_bank1_regs *fuse =
>+ (struct fuse_bank1_regs *)bank->fuse_regs;
>+ int val;
>+
>+ val = readl(&fuse->tester4);
>+ if (val & 1)
>+ return false;
>+ else
>+ return true;
>+}
>+
> u32 get_cpu_rev(void)
> {
> struct mxc_ccm_anatop_reg *ccm_anatop = (struct mxc_ccm_anatop_reg *)
>@@ -172,6 +187,9 @@ u32 get_cpu_rev(void)
> u32 reg = readl(&ccm_anatop->digprog);
> u32 type = (reg >> 16) & 0xff;
>
>+ if (!is_mx7d())
>+ type = MXC_CPU_MX7S;
>+
> reg &= 0xff;
> return (type << 12) | reg;
> }
>diff --git a/arch/arm/imx-common/cpu.c b/arch/arm/imx-common/cpu.c
>index 656bb60..5fb3ed8 100644
>--- a/arch/arm/imx-common/cpu.c
>+++ b/arch/arm/imx-common/cpu.c
>@@ -137,6 +137,8 @@ unsigned imx_ddr_size(void)
> const char *get_imx_type(u32 imxtype)
> {
> switch (imxtype) {
>+ case MXC_CPU_MX7S:
>+ return "7SOLO"; /* Single-core version of the mx7 */
> case MXC_CPU_MX7D:
> return "7D"; /* Dual-core version of the mx7 */
> case MXC_CPU_MX6QP:
>diff --git a/arch/arm/include/asm/arch-imx/cpu.h b/arch/arm/include/asm/arch-imx/cpu.h
>index 8a75902..7c63c13 100644
>--- a/arch/arm/include/asm/arch-imx/cpu.h
>+++ b/arch/arm/include/asm/arch-imx/cpu.h
>@@ -21,6 +21,7 @@
> #define MXC_CPU_MX6D 0x67
> #define MXC_CPU_MX6DP 0x68
> #define MXC_CPU_MX6QP 0x69
>+#define MXC_CPU_MX7S 0x71 /* dummy ID */
> #define MXC_CPU_MX7D 0x72
> #define MXC_CPU_VF610 0xF6 /* dummy ID */
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Regards,
Peng.
>
>--
>1.9.1
>
>_______________________________________________
>U-Boot mailing list
>U-Boot at lists.denx.de
>http://lists.denx.de/mailman/listinfo/u-boot
^ permalink raw reply [flat|nested] 3+ messages in thread
* [U-Boot] [PATCH] mx7: Distinguish between dual and solo versions
2016-02-28 15:33 [U-Boot] [PATCH] mx7: Distinguish between dual and solo versions Fabio Estevam
2016-02-29 5:04 ` Peng Fan
@ 2016-03-09 11:50 ` Stefano Babic
1 sibling, 0 replies; 3+ messages in thread
From: Stefano Babic @ 2016-03-09 11:50 UTC (permalink / raw)
To: u-boot
On 28/02/2016 16:33, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@nxp.com>
>
> Read the number of cores in the fuses to distinguish between
> the dual and solo versions.
>
> Tested on a mx7d sabresd and on a mx7solo warp7.
>
> Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
> ---
Applied to -next, thanks !
Best regards,
Stefano Babic
--
=====================================================================
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-03-09 11:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-28 15:33 [U-Boot] [PATCH] mx7: Distinguish between dual and solo versions Fabio Estevam
2016-02-29 5:04 ` Peng Fan
2016-03-09 11:50 ` Stefano Babic
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox