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

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 7a7ce15..9f67e19 100644
--- a/arch/arm/mach-imx/imx6.c
+++ b/arch/arm/mach-imx/imx6.c
@@ -17,6 +17,9 @@
 #include <sizes.h>
 #include <mach/generic.h>
 #include <mach/imx6-regs.h>
+#include <mach/revision.h>
+
+#define SI_REV 0x260

 void imx6_init_lowlevel(void)
 {
@@ -55,6 +58,9 @@ 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);

        add_generic_device("imx-iomuxv3", 0, NULL, MX6_IOMUXC_BASE_ADDR, 0x1000, IORESOURCE_MEM, NULL);
@@ -70,6 +76,26 @@ static int imx6_init(void)
        add_generic_device("imx21-wdt", 0, NULL, MX6_WDOG1_BASE_ADDR, 0x4000, IORESOURCE_MEM, NULL);
        add_generic_device("imx6-usb-misc", 0, NULL, MX6_USBOH3_USB_BASE_ADDR + 0x800, 0x100, IORESOURCE_MEM, NULL);

+       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);
+
        return 0;
 }
 postcore_initcall(imx6_init);
--
1.8.2.3
______________________________________________________________________________
Vertrauliche E-Mail von / Confidential e-mail from
Data Modul Aktiengesellschaft
Vorstand: Peter Hecktor (Vorsitzender), Walter King, Dr. Florian Pesahl
Vorsitzende des Aufsichtsrates: Victoria Hecktor
Sitz der Gesellschaft: Muenchen
Registergericht Muenchen - Handelsregister B 85 591


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

Hi Silvio,

On Tue, May 14, 2013 at 05:52:01PM +0000, Fricke, Silvio wrote:
>  static int imx6_init(void)
>  {
> +       u32 rev;
> +       u32 mx6_silicon_revision;
> +
>         imx6_boot_save_loc((void *)MX6_SRC_BASE_ADDR);
> 
>         add_generic_device("imx-iomuxv3", 0, NULL, MX6_IOMUXC_BASE_ADDR, 0x1000, IORESOURCE_MEM, NULL);
> @@ -70,6 +76,26 @@ static int imx6_init(void)
>         add_generic_device("imx21-wdt", 0, NULL, MX6_WDOG1_BASE_ADDR, 0x4000, IORESOURCE_MEM, NULL);
>         add_generic_device("imx6-usb-misc", 0, NULL, MX6_USBOH3_USB_BASE_ADDR + 0x800, 0x100, IORESOURCE_MEM, NULL);
> 
> +       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);

You should call imx_set_silicon_revision before registering all the
devices. That way the drivers could use this information should they
ever have to.

Sascha

-- 
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-05-15  6:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-14 17:52 [PATCH] ARM i.MX6: set imx6 silicon revision Fricke, Silvio
2013-05-15  6:51 ` Sascha Hauer

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