Skip to contentSkip to conversation

ARM: imx: add support code for IMX50 based machines

PATCH Superseded gerg at uclinux.org 4 participants 11 messages Nov 4, 2013 – Nov 6, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 ARM: imx: add support code for IMX50 based machines

From: Greg Ungerer <[email protected]>

Add machine support code for the Freescale IMX50 SoC.

The IMX50 is quite similar to the Freescale IMX53, and contains many of the same periperhal hardware modules, at the same address offsets as the IMX53. (Notable exceptions are that the IMX50 contains no CAN bus hardware, less GPIO, no VPU, it does contain an Electrophoretic display controller though).

This support code uses some of the IMX53 setup code to reduce duplication of what would be identical init IO setup.

---
 arch/arm/mach-imx/Makefile     |  1 +
 arch/arm/mach-imx/common.h     |  1 +
 arch/arm/mach-imx/mach-imx50.c | 36 ++++++++++++++++++++++++++++++++++++
 3 files changed, 38 insertions(+)
 create mode 100644 arch/arm/mach-imx/mach-imx50.c
arch/arm/mach-imx/Makefile +1 -0
index bbe1f5b..924e117 100644
@@ -112,6 +112,7 @@ obj-$(CONFIG_MACH_EUKREA_CPUIMX51SD) += mach-cpuimx51sd.o
 obj-$(CONFIG_MACH_EUKREA_MBIMXSD51_BASEBOARD) += eukrea_mbimxsd51-baseboard.o
 
 obj-$(CONFIG_MACH_IMX51_DT) += imx51-dt.o
+obj-$(CONFIG_SOC_IMX50) += mach-imx50.o
 obj-$(CONFIG_SOC_IMX53) += mach-imx53.o
 
 obj-$(CONFIG_SOC_VF610) += clk-vf610.o mach-vf610.o
arch/arm/mach-imx/common.h +1 -0
index 7cbe22d..9b67672 100644
@@ -108,6 +108,7 @@ void tzic_handle_irq(struct pt_regs *);
 #define imx27_handle_irq avic_handle_irq
 #define imx31_handle_irq avic_handle_irq
 #define imx35_handle_irq avic_handle_irq
+#define imx50_handle_irq tzic_handle_irq
 #define imx51_handle_irq tzic_handle_irq
 #define imx53_handle_irq tzic_handle_irq
 
arch/arm/mach-imx/mach-imx50.c new file +36 -0
new file mode 100644
index 0000000..dc93bbb
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2013 Greg Ungerer <[email protected]>
+ * Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved.
+ * Copyright 2011 Linaro Ltd.
+ *
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+#include <linux/of_platform.h>
+#include <asm/mach/arch.h>
+
+#include "common.h"
+
+static void __init imx50_dt_init(void)
+{
+	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+}
+
+static const char *imx50_dt_board_compat[] __initdata = {
+	"fsl,imx50",
+	NULL
+};
+
+DT_MACHINE_START(IMX50_DT, "Freescale i.MX50 (Device Tree Support)")
+	.map_io		= mx53_map_io,
+	.init_irq	= mx53_init_irq,
+	.handle_irq	= imx50_handle_irq,
+	.init_machine	= imx50_dt_init,
+	.dt_compat	= imx50_dt_board_compat,
+	.restart	= mxc_restart,
+MACHINE_END
Signature · 1 line
1.8.1.4
#1 lore raw

PATCH v3 1/1 ARM: imx: add support code for IMX50 based machines

Quoted 37 lines · On Sun, Nov 3, 2013 at 6:13 PM, <[email protected]> wrote:

From: Greg Ungerer <[email protected]>

Add machine support code for the Freescale IMX50 SoC.

The IMX50 is quite similar to the Freescale IMX53, and contains many of the same periperhal hardware modules, at the same address offsets as the IMX53. (Notable exceptions are that the IMX50 contains no CAN bus hardware, less GPIO, no VPU, it does contain an Electrophoretic display controller though).

This support code uses some of the IMX53 setup code to reduce duplication of what would be identical init IO setup.

---
 arch/arm/mach-imx/Makefile     |  1 +
 arch/arm/mach-imx/common.h     |  1 +
 arch/arm/mach-imx/mach-imx50.c | 36 ++++++++++++++++++++++++++++++++++++
 3 files changed, 38 insertions(+)
 create mode 100644 arch/arm/mach-imx/mach-imx50.c
arch/arm/mach-imx/Makefile +1 -0
index bbe1f5b..924e117 100644
@@ -112,6 +112,7 @@ obj-$(CONFIG_MACH_EUKREA_CPUIMX51SD) += mach-cpuimx51sd.o
 obj-$(CONFIG_MACH_EUKREA_MBIMXSD51_BASEBOARD) += eukrea_mbimxsd51-baseboard.o
 
 obj-$(CONFIG_MACH_IMX51_DT) += imx51-dt.o
+obj-$(CONFIG_SOC_IMX50) += mach-imx50.o
 obj-$(CONFIG_SOC_IMX53) += mach-imx53.o
 
 obj-$(CONFIG_SOC_VF610) += clk-vf610.o mach-vf610.o
arch/arm/mach-imx/common.h +0 -0
index 7cbe22d..9b67672 100644

arch/arm/mach-imx/common.h void tzic_handle_irq(struct pt_regs *); · line 111

Quoted 4 lines
arch/arm/mach-imx/common.h +1 -0
@@ -108,6 +108,7 @@ void tzic_handle_irq(struct pt_regs *);
 #define imx27_handle_irq avic_handle_irq
 #define imx31_handle_irq avic_handle_irq
 #define imx35_handle_irq avic_handle_irq
+#define imx50_handle_irq tzic_handle_irq

Has no one converted AVIC and TZIC to use IRQCHIP_DECLARE? This and the corresponding handle_irq hook would not be needed if that was done.

Quoted 20 lines
arch/arm/mach-imx/common.h +0 -0
 #define imx51_handle_irq tzic_handle_irq
 #define imx53_handle_irq tzic_handle_irq
 
arch/arm/mach-imx/mach-imx50.c new file +11 -0
new file mode 100644
index 0000000..dc93bbb
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2013 Greg Ungerer <[email protected]>
+ * Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved.
+ * Copyright 2011 Linaro Ltd.
+ *
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html

arch/arm/mach-imx/mach-imx50.c line 21

Quoted 10 lines
arch/arm/mach-imx/mach-imx50.c new file +10 -0
+ */
+
+#include <linux/of_platform.h>
+#include <asm/mach/arch.h>
+
+#include "common.h"
+
+static void __init imx50_dt_init(void)
+{
+       of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);

This is the default operation now if init_machine is NULL.

Quoted 5 lines
arch/arm/mach-imx/mach-imx50.c new file +5 -0
+}
+
+static const char *imx50_dt_board_compat[] __initdata = {
+       "fsl,imx50",
+       NULL

arch/arm/mach-imx/mach-imx50.c line 36

Quoted 10 lines
arch/arm/mach-imx/mach-imx50.c new file +10 -0
+};
+
+DT_MACHINE_START(IMX50_DT, "Freescale i.MX50 (Device Tree Support)")
+       .map_io         = mx53_map_io,
+       .init_irq       = mx53_init_irq,
+       .handle_irq     = imx50_handle_irq,
+       .init_machine   = imx50_dt_init,
+       .dt_compat      = imx50_dt_board_compat,
+       .restart        = mxc_restart,
+MACHINE_END

I still think any mx53 clean-up should be done first to enable mx50 rather than adding a mx50 machine first and then trying to consolidate mx50 and mx53.

Rob

#2 lore raw

PATCH v3 1/1 ARM: imx: add support code for IMX50 based machines

Quoted 9 lines · Rob Herring

arch/arm/mach-imx/common.h void tzic_handle_irq(struct pt_regs *); · line 111

Quoted 5 lines
arch/arm/mach-imx/common.h +1 -0
@@ -108,6 +108,7 @@ void tzic_handle_irq(struct pt_regs *);
 #define imx27_handle_irq avic_handle_irq
 #define imx31_handle_irq avic_handle_irq
 #define imx35_handle_irq avic_handle_irq
+#define imx50_handle_irq tzic_handle_irq

Has no one converted AVIC and TZIC to use IRQCHIP_DECLARE? This and the corresponding handle_irq hook would not be needed if that was done.

No, not yet. There are still non-DT users for avic and tzic, which makes the adoption of IRQCHIP_DECLARE less meaningful and a little difficult. So my plan is that we convert all those non-DT users over to DT, and then move avic and tzic to IRQCHIP_DECLARE.

<snip>

Quoted 5 lines

arch/arm/mach-imx/mach-imx50.c line 21

Quoted 3 lines
arch/arm/mach-imx/mach-imx50.c new file +3 -0
+static void __init imx50_dt_init(void)
+{
+       of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);

This is the default operation now if init_machine is NULL.

Oh, it reminds me that mxc_arch_reset_init_dt() should be called here to get mxc_restart() work.

Quoted 11 lines
Quoted 11 lines
arch/arm/mach-imx/mach-imx50.c new file +11 -0
+}
+
+static const char *imx50_dt_board_compat[] __initdata = {
+       "fsl,imx50",
+       NULL
+};
+
+DT_MACHINE_START(IMX50_DT, "Freescale i.MX50 (Device Tree Support)")
+       .map_io         = mx53_map_io,
+       .init_irq       = mx53_init_irq,
+       .handle_irq     = imx50_handle_irq,
Quoted 8 lines

arch/arm/mach-imx/mach-imx50.c line 36

Quoted 4 lines
arch/arm/mach-imx/mach-imx50.c new file +4 -0
+       .init_machine   = imx50_dt_init,
+       .dt_compat      = imx50_dt_board_compat,
+       .restart        = mxc_restart,
+MACHINE_END

I still think any mx53 clean-up should be done first to enable mx50 rather than adding a mx50 machine first and then trying to consolidate mx50 and mx53.

We already reuse imx53 stuff as much as possible here, and I do not see there will be so much code to be consolidated further. There are indeed something to be cleaned up as part of the whole i.MX DT conversion, like static mapping, but it's nothing related to imx50 addition. Since the imx50 addition does not make the cleanup later more difficult, I would prefer to just support it now.

Shawn

#3 lore raw

PATCH v3 1/1 ARM: imx: add support code for IMX50 based machines

In reply to gerg at uclinux.org

Greg,

Quoted 12 lines · gerg at uclinux.org

From: Greg Ungerer <[email protected]>

Add machine support code for the Freescale IMX50 SoC.

The IMX50 is quite similar to the Freescale IMX53, and contains many of the same periperhal hardware modules, at the same address offsets as the IMX53. (Notable exceptions are that the IMX50 contains no CAN bus hardware, less GPIO, no VPU, it does contain an Electrophoretic display controller though).

This support code uses some of the IMX53 setup code to reduce duplication of what would be identical init IO setup.

Quoted 7 lines
---
 arch/arm/mach-imx/Makefile     |  1 +
 arch/arm/mach-imx/common.h     |  1 +
 arch/arm/mach-imx/mach-imx50.c | 36 ++++++++++++++++++++++++++++++++++++
 3 files changed, 38 insertions(+)
 create mode 100644 arch/arm/mach-imx/mach-imx50.c

What happened to the rest of the series? If this is a new version of just a single patch in the V2 series (which I suspect it is), we usually make it an in-reply-to the previous version of the patch it replaces. Not a big deal, it just helps us keep track of things more easily.

thx,

Jason.

#4 lore raw

PATCH v3 1/1 ARM: imx: add support code for IMX50 based machines

Quoted 1 line · Jason Cooper

What happened to the rest of the series?

Crap. Nevermind. I just saw that Shawn had already taken the other patches into his tree. And here I thought I was caught up on everything...

thx,

Jason.

#5 lore raw

PATCH v3 1/1 ARM: imx: add support code for IMX50 based machines

Hi Jason,

Quoted 6 lines · Jason Cooper
Quoted 1 line · Jason Cooper

What happened to the rest of the series?

Crap. Nevermind. I just saw that Shawn had already taken the other patches into his tree. And here I thought I was caught up on everything...

:-)

Are you going to try and test out the imx50 support from Shawn's branch?

Regards
Greg

#6 lore raw

PATCH v3 1/1 ARM: imx: add support code for IMX50 based machines

Quoted 6 lines · Greg Ungerer

Hi Jason,

Quoted 3 lines · Jason Cooper
Quoted 1 line · Jason Cooper

What happened to the rest of the series?

Quoted 7 lines
Quoted 3 lines

Crap. Nevermind. I just saw that Shawn had already taken the other patches into his tree. And here I thought I was caught up on everything...

:-)

Are you going to try and test out the imx50 support from Shawn's branch?

My for-next branch below should have all the bits except imx50 pinctrl driver.

git://git.linaro.org/people/shawnguo/linux-2.6.git for-next

Shawn

#7 lore raw

PATCH v3 1/1 ARM: imx: add support code for IMX50 based machines

In reply to Greg Ungerer
Quoted 6 lines · Greg Ungerer

Hi Jason,

Quoted 3 lines · Jason Cooper
Quoted 1 line · Jason Cooper

What happened to the rest of the series?

Quoted 7 lines
Quoted 3 lines

Crap. Nevermind. I just saw that Shawn had already taken the other patches into his tree. And here I thought I was caught up on everything...

:-)

Are you going to try and test out the imx50 support from Shawn's branch?

I did manage to get it to boot, but I'm not confident in it yet. There is still a nagging problem (I had with my implementation as well) where

$ sleep 10

takes greater than 20 seconds. :( Which is why I originally asked you about the apll...

thx,

Jason.

#8 lore raw

PATCH v3 1/1 ARM: imx: add support code for IMX50 based machines

Hi Jason,

Quoted 15 lines · Jason Cooper
Quoted 6 lines · Greg Ungerer

Hi Jason,

Quoted 3 lines · Jason Cooper
Quoted 1 line · Jason Cooper

What happened to the rest of the series?

Quoted 7 lines
Quoted 3 lines

Crap. Nevermind. I just saw that Shawn had already taken the other patches into his tree. And here I thought I was caught up on everything...

:-)

Are you going to try and test out the imx50 support from Shawn's branch?

Quoted 7 lines

I did manage to get it to boot, but I'm not confident in it yet. There is still a nagging problem (I had with my implementation as well) where

$ sleep 10

takes greater than 20 seconds. :( Which is why I originally asked you about the apll...

I have seen that. I haven't had a chance to look properly into it. If you boot Freescales old LTIB code that supports the iMX50 it seems they are messing with the clock setup to get it just right. It may be that they just didn't get it right in their boot loader to start with.

Regards
Greg

#9 lore raw

PATCH v3 1/1 ARM: imx: add support code for IMX50 based machines

In reply to gerg at uclinux.org
Quoted 11 lines · gerg at uclinux.org
arch/arm/mach-imx/mach-imx50.c new file +10 -0
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2013 Greg Ungerer <[email protected]>
+ * Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved.
+ * Copyright 2011 Linaro Ltd.
+ *
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html

arch/arm/mach-imx/mach-imx50.c line 20

Quoted 10 lines
arch/arm/mach-imx/mach-imx50.c new file +10 -0
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+#include <linux/of_platform.h>
+#include <asm/mach/arch.h>
+
+#include "common.h"
+
+static void __init imx50_dt_init(void)
+{

We need to call mxc_arch_reset_init_dt() here to get mxc_restart() work. I just fixed it up and applied the patch.

Shawn

Quoted 19 lines
arch/arm/mach-imx/mach-imx50.c new file +16 -0
+	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+}
+
+static const char *imx50_dt_board_compat[] __initdata = {
+	"fsl,imx50",
+	NULL
+};
+
+DT_MACHINE_START(IMX50_DT, "Freescale i.MX50 (Device Tree Support)")
+	.map_io		= mx53_map_io,
+	.init_irq	= mx53_init_irq,
+	.handle_irq	= imx50_handle_irq,
+	.init_machine	= imx50_dt_init,
+	.dt_compat	= imx50_dt_board_compat,
+	.restart	= mxc_restart,
+MACHINE_END
Signature · 1 line
1.8.1.4
#10 lore raw

PATCH v3 1/1 ARM: imx: add support code for IMX50 based machines

Quoted 17 lines · Shawn Guo
Quoted 16 lines · gerg at uclinux.org
arch/arm/mach-imx/mach-imx50.c new file +15 -0
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2013 Greg Ungerer <[email protected]>
+ * Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved.
+ * Copyright 2011 Linaro Ltd.
+ *
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+#include <linux/of_platform.h>
+#include <asm/mach/arch.h>
Quoted 8 lines

arch/arm/mach-imx/mach-imx50.c line 20

Quoted 5 lines
arch/arm/mach-imx/mach-imx50.c new file +5 -0
+
+#include "common.h"
+
+static void __init imx50_dt_init(void)
+{

We need to call mxc_arch_reset_init_dt() here to get mxc_restart() work. I just fixed it up and applied the patch.

Great, thanks Shawn.

Regards
Greg

Quoted 21 lines
Quoted 19 lines
arch/arm/mach-imx/mach-imx50.c new file +16 -0
+	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+}
+
+static const char *imx50_dt_board_compat[] __initdata = {
+	"fsl,imx50",
+	NULL
+};
+
+DT_MACHINE_START(IMX50_DT, "Freescale i.MX50 (Device Tree Support)")
+	.map_io		= mx53_map_io,
+	.init_irq	= mx53_init_irq,
+	.handle_irq	= imx50_handle_irq,
+	.init_machine	= imx50_dt_init,
+	.dt_compat	= imx50_dt_board_compat,
+	.restart	= mxc_restart,
+MACHINE_END
Signature · 1 line
1.8.1.4