mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH V2] ARM i.MX6: set imx6 silicon revision
@ 2013-06-04 13:07 S. Fricke
  2013-06-05  6:52 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: S. Fricke @ 2013-06-04 13:07 UTC (permalink / raw)
  To: barebox; +Cc: S. Fricke

From: "S. Fricke" <sfricke@data-modul.com>

This is mainly a backport of the imx6_revision function of
arch/arm/mach-imx/mach-imx6q.c in the linux kernel sources.

Signed-off-by: S. Fricke <sfricke@data-modul.com>
---
 arch/arm/mach-imx/imx6.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/arch/arm/mach-imx/imx6.c b/arch/arm/mach-imx/imx6.c
index 5c20aa1..1d69ec8 100644
--- a/arch/arm/mach-imx/imx6.c
+++ b/arch/arm/mach-imx/imx6.c
@@ -16,8 +16,11 @@
 #include <io.h>
 #include <sizes.h>
 #include <mach/generic.h>
+#include <mach/revision.h>
 #include <mach/imx6-regs.h>
 
+#define SI_REV 0x260
+
 void imx6_init_lowlevel(void)
 {
 	void __iomem *aips1 = (void *)MX6_AIPS1_ON_BASE_ADDR;
@@ -55,8 +58,31 @@ void imx6_init_lowlevel(void)
 
 static int imx6_init(void)
 {
+	u32 rev;
+	u32 mx6_silicon_revision;
+
 	imx6_boot_save_loc((void *)MX6_SRC_BASE_ADDR);
 
+	rev = readl(MX6_ANATOP_BASE_ADDR + SI_REV);
+	switch (rev & 0xff) {
+	case 0x00:
+		mx6_silicon_revision = IMX_CHIP_REV_1_0;
+		break;
+
+	case 0x01:
+		mx6_silicon_revision = IMX_CHIP_REV_1_1;
+		break;
+
+	case 0x02:
+		mx6_silicon_revision = IMX_CHIP_REV_1_2;
+		break;
+
+	default:
+		mx6_silicon_revision = IMX_CHIP_REV_UNKNOWN;
+	}
+
+	imx_set_silicon_revision("i.MX6", mx6_silicon_revision);
+
 	if (of_get_root_node())
 		return 0;
 
-- 
1.8.3


_______________________________________________
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 V2] ARM i.MX6: set imx6 silicon revision
  2013-06-04 13:07 [PATCH V2] ARM i.MX6: set imx6 silicon revision S. Fricke
@ 2013-06-05  6:52 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2013-06-05  6:52 UTC (permalink / raw)
  To: S. Fricke; +Cc: barebox

On Tue, Jun 04, 2013 at 03:07:57PM +0200, S. Fricke wrote:
> From: "S. Fricke" <sfricke@data-modul.com>
> 
> This is mainly a backport of the imx6_revision function of
> arch/arm/mach-imx/mach-imx6q.c in the linux kernel sources.
> 
> Signed-off-by: S. Fricke <sfricke@data-modul.com>

Applied, thanks

Sascha

> ---
>  arch/arm/mach-imx/imx6.c | 26 ++++++++++++++++++++++++++
>  1 file changed, 26 insertions(+)
> 
> diff --git a/arch/arm/mach-imx/imx6.c b/arch/arm/mach-imx/imx6.c
> index 5c20aa1..1d69ec8 100644
> --- a/arch/arm/mach-imx/imx6.c
> +++ b/arch/arm/mach-imx/imx6.c
> @@ -16,8 +16,11 @@
>  #include <io.h>
>  #include <sizes.h>
>  #include <mach/generic.h>
> +#include <mach/revision.h>
>  #include <mach/imx6-regs.h>
>  
> +#define SI_REV 0x260
> +
>  void imx6_init_lowlevel(void)
>  {
>  	void __iomem *aips1 = (void *)MX6_AIPS1_ON_BASE_ADDR;
> @@ -55,8 +58,31 @@ void imx6_init_lowlevel(void)
>  
>  static int imx6_init(void)
>  {
> +	u32 rev;
> +	u32 mx6_silicon_revision;
> +
>  	imx6_boot_save_loc((void *)MX6_SRC_BASE_ADDR);
>  
> +	rev = readl(MX6_ANATOP_BASE_ADDR + SI_REV);
> +	switch (rev & 0xff) {
> +	case 0x00:
> +		mx6_silicon_revision = IMX_CHIP_REV_1_0;
> +		break;
> +
> +	case 0x01:
> +		mx6_silicon_revision = IMX_CHIP_REV_1_1;
> +		break;
> +
> +	case 0x02:
> +		mx6_silicon_revision = IMX_CHIP_REV_1_2;
> +		break;
> +
> +	default:
> +		mx6_silicon_revision = IMX_CHIP_REV_UNKNOWN;
> +	}
> +
> +	imx_set_silicon_revision("i.MX6", mx6_silicon_revision);
> +
>  	if (of_get_root_node())
>  		return 0;
>  
> -- 
> 1.8.3
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 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:[~2013-06-05  6:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-04 13:07 [PATCH V2] ARM i.MX6: set imx6 silicon revision S. Fricke
2013-06-05  6:52 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox