Skip to contentSkip to conversation

Add device tree support for i.mx51/53 boards

PATCH New Shawn Guo 4 participants 10 messages Aug 1, 2011 – Aug 2, 2011

Subsystems (4)
lore
Share & tools
lore

Shawn Guo

author
#0 lore raw

v3 cover Add device tree support for i.mx51/53 boards

Since we have not reached the agreement on iomuxc binding, I'm dropping that patch and reusing the iomuxc setup that is currently used by non-dt board files. Hopefully, doing that could get the series merged for v3.1, so that people can start playing device tree on i.mx51 babbage and i.mx53 quick start board.

Will revisit the iomuxc device tree support, when we agree on the right approach to do it.

Changes since v2:
* Drop iomuxc device tree support patch

Changes since v1:
* Address comments on v1 given by Grant and Sascha
* Add i.mx51 Babbage support

Shawn Guo (2):
arm/mx5: add device tree support for imx53 boards arm/mx5: add device tree support for imx51 babbage

 .../devicetree/bindings/arm/fsl/boards.txt         |   19 ++
 arch/arm/boot/dts/imx51-babbage.dts                |  141 +++++++++++
 arch/arm/boot/dts/imx51.dtsi                       |  203 ++++++++++++++++
 arch/arm/boot/dts/imx53-ard.dts                    |  158 +++++++++++++
 arch/arm/boot/dts/imx53-evk.dts                    |  144 ++++++++++++
 arch/arm/boot/dts/imx53-qsb.dts                    |  148 ++++++++++++
 arch/arm/boot/dts/imx53-smd.dts                    |  169 ++++++++++++++
 arch/arm/boot/dts/imx53.dtsi                       |  244 ++++++++++++++++++++
 arch/arm/mach-mx5/Kconfig                          |   21 ++
 arch/arm/mach-mx5/Makefile                         |    3 +
 arch/arm/mach-mx5/board-mx51_babbage.c             |    5 +
 arch/arm/mach-mx5/board-mx53_ard.c                 |    9 +-
 arch/arm/mach-mx5/board-mx53_evk.c                 |    5 +
 arch/arm/mach-mx5/board-mx53_loco.c                |    5 +
 arch/arm/mach-mx5/board-mx53_smd.c                 |    5 +
 arch/arm/mach-mx5/imx51-dt.c                       |  112 +++++++++
 arch/arm/mach-mx5/imx53-dt.c                       |  143 ++++++++++++
 arch/arm/plat-mxc/include/mach/common.h            |    2 +
 arch/arm/plat-mxc/include/mach/iomux-mx51.h        |    2 +
 arch/arm/plat-mxc/include/mach/iomux-mx53.h        |    5 +
 arch/arm/plat-mxc/include/mach/iomux-v3.h          |    5 +
 21 files changed, 1546 insertions(+), 2 deletions(-)
author
#1 lore raw

PATCH v3 1/2 arm/mx5: add device tree support for imx53 boards

From: Shawn Guo <[email protected]>

It adds device tree support for imx53 boards.

Cc Grant Likely <[email protected]>
Cc Sascha Hauer <[email protected]>
---
 .../devicetree/bindings/arm/fsl/boards.txt         |   15 ++
 arch/arm/boot/dts/imx53-ard.dts                    |  158 +++++++++++++
 arch/arm/boot/dts/imx53-evk.dts                    |  144 ++++++++++++
 arch/arm/boot/dts/imx53-qsb.dts                    |  148 ++++++++++++
 arch/arm/boot/dts/imx53-smd.dts                    |  169 ++++++++++++++
 arch/arm/boot/dts/imx53.dtsi                       |  244 ++++++++++++++++++++
 arch/arm/mach-mx5/Kconfig                          |   12 +
 arch/arm/mach-mx5/Makefile                         |    2 +
 arch/arm/mach-mx5/board-mx53_ard.c                 |    9 +-
 arch/arm/mach-mx5/board-mx53_evk.c                 |    5 +
 arch/arm/mach-mx5/board-mx53_loco.c                |    5 +
 arch/arm/mach-mx5/board-mx53_smd.c                 |    5 +
 arch/arm/mach-mx5/imx53-dt.c                       |  143 ++++++++++++
 arch/arm/plat-mxc/include/mach/common.h            |    2 +
 arch/arm/plat-mxc/include/mach/iomux-mx53.h        |    5 +
 arch/arm/plat-mxc/include/mach/iomux-v3.h          |    5 +
 16 files changed, 1069 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/arm/fsl/boards.txt
 create mode 100644 arch/arm/boot/dts/imx53-ard.dts
 create mode 100644 arch/arm/boot/dts/imx53-evk.dts
 create mode 100644 arch/arm/boot/dts/imx53-qsb.dts
 create mode 100644 arch/arm/boot/dts/imx53-smd.dts
 create mode 100644 arch/arm/boot/dts/imx53.dtsi
 create mode 100644 arch/arm/mach-mx5/imx53-dt.c
Documentation/devicetree/bindings/arm/fsl/boards.txt new file +15 -0
new file mode 100644
index 0000000..d1e8d6f
@@ -0,0 +1,15 @@
+i.MX53 Automotive Reference Design Board
+Required root node properties:
+    - compatible = "fsl,imx53-ard", "fsl,imx53";
+
+i.MX53 Evaluation Kit
+Required root node properties:
+    - compatible = "fsl,imx53-evk", "fsl,imx53";
+
+i.MX53 Quick Start Board
+Required root node properties:
+    - compatible = "fsl,imx53-qsb", "fsl,imx53";
+
+i.MX53 Smart Mobile Reference Design Board
+Required root node properties:
+    - compatible = "fsl,imx53-smd", "fsl,imx53";
arch/arm/boot/dts/imx53-ard.dts new file +158 -0

158 lines not on this page · raw message

arch/arm/boot/dts/imx53-evk.dts new file +144 -0

144 lines not on this page · raw message

arch/arm/boot/dts/imx53-qsb.dts new file +148 -0

148 lines not on this page · raw message

arch/arm/boot/dts/imx53-smd.dts new file +169 -0

169 lines not on this page · raw message

arch/arm/boot/dts/imx53.dtsi new file +244 -0

244 lines not on this page · raw message

arch/arm/mach-mx5/Kconfig +12 -0
index b4e7c58..0ac676c 100644
@@ -172,6 +172,18 @@ endif # ARCH_MX51
 if ARCH_MX53_SUPPORTED
 comment "i.MX53 machines:"
 
+config MACH_IMX53_DT
+	bool "Support i.MX53 platforms from device tree"
+	select SOC_IMX53
+	select USE_OF
+	select MACH_MX53_ARD
+	select MACH_MX53_EVK
+	select MACH_MX53_LOCO
+	select MACH_MX53_SMD
+	help
+	  Include support for Freescale i.MX53 based platforms
+	  using the device tree for discovery
+
 config MACH_MX53_EVK
 	bool "Support MX53 EVK platforms"
 	select SOC_IMX53
arch/arm/mach-mx5/Makefile +2 -0
index 383e7cd..3dbe5e2 100644
@@ -22,3 +22,5 @@ obj-$(CONFIG_MX51_EFIKA_COMMON) += mx51_efika.o
 obj-$(CONFIG_MACH_MX51_EFIKAMX) += board-mx51_efikamx.o
 obj-$(CONFIG_MACH_MX51_EFIKASB) += board-mx51_efikasb.o
 obj-$(CONFIG_MACH_MX50_RDP) += board-mx50_rdp.o
+
+obj-$(CONFIG_MACH_IMX53_DT) += imx53-dt.o
arch/arm/mach-mx5/board-mx53_ard.c +7 -2
index 76a67c4..71e61f9 100644
@@ -104,6 +104,11 @@ static iomux_v3_cfg_t mx53_ard_pads[] = {
 	MX53_PAD_GPIO_10__GPIO4_0,		/* vol down */
 };
 
+struct iomux_v3_pad_data imx53_ard_pad_data = {
+	.pads = mx53_ard_pads,
+	.num = ARRAY_SIZE(mx53_ard_pads),
+};
+
 #define GPIO_BUTTON(gpio_num, ev_code, act_low, descr, wake)	\
 {							\
 	.gpio		= gpio_num,				\
@@ -182,7 +187,7 @@ static void __init mx53_ard_io_init(void)
 }
 
 /* Config CS1 settings for ethernet controller */
-static int weim_cs_config(void)
+int imx53_ard_weim_cs_config(void)
 {
 	u32 reg;
 	void __iomem *weim_base, *iomuxc_base;
@@ -226,7 +231,7 @@ static void __init mx53_ard_board_init(void)
 	imx53_add_imx_uart(0, NULL);
 
 	mx53_ard_io_init();
-	weim_cs_config();
+	imx53_ard_weim_cs_config();
 	platform_add_devices(devices, ARRAY_SIZE(devices));
 
 	imx53_add_sdhci_esdhc_imx(0, &mx53_ard_sd1_data);
arch/arm/mach-mx5/board-mx53_evk.c +5 -0
index 1b417b0..09c293f 100644
@@ -63,6 +63,11 @@ static iomux_v3_cfg_t mx53_evk_pads[] = {
 	MX53_PAD_PATA_DA_1__GPIO7_7,
 };
 
+struct iomux_v3_pad_data imx53_evk_pad_data = {
+	.pads = mx53_evk_pads,
+	.num = ARRAY_SIZE(mx53_evk_pads),
+};
+
 static const struct imxuart_platform_data mx53_evk_uart_pdata __initconst = {
 	.flags = IMXUART_HAVE_RTSCTS,
 };
arch/arm/mach-mx5/board-mx53_loco.c +5 -0
index 4e1d51d..bf0196b 100644
@@ -187,6 +187,11 @@ static iomux_v3_cfg_t mx53_loco_pads[] = {
 	MX53_PAD_GPIO_8__GPIO1_8,
 };
 
+struct iomux_v3_pad_data imx53_loco_pad_data = {
+	.pads = mx53_loco_pads,
+	.num = ARRAY_SIZE(mx53_loco_pads),
+};
+
 #define GPIO_BUTTON(gpio_num, ev_code, act_low, descr, wake)	\
 {								\
 	.gpio		= gpio_num,				\
arch/arm/mach-mx5/board-mx53_smd.c +5 -0
index bc02894..a3fa95d 100644
@@ -77,6 +77,11 @@ static iomux_v3_cfg_t mx53_smd_pads[] = {
 	MX53_PAD_PATA_RESET_B__ESDHC3_CMD,
 };
 
+struct iomux_v3_pad_data imx53_smd_pad_data = {
+	.pads = mx53_smd_pads,
+	.num = ARRAY_SIZE(mx53_smd_pads),
+};
+
 static const struct imxuart_platform_data mx53_smd_uart_data __initconst = {
 	.flags = IMXUART_HAVE_RTSCTS,
 };
arch/arm/mach-mx5/imx53-dt.c new file +143 -0

143 lines not on this page · raw message

arch/arm/plat-mxc/include/mach/common.h +2 -0
index 4e3d978..32c24a4 100644
@@ -72,4 +72,6 @@ extern void mxc_arch_reset_init(void __iomem *);
 extern void mx51_efikamx_reset(void);
 extern int mx53_revision(void);
 extern int mx53_display_revision(void);
+extern int imx53_ard_weim_cs_config(void);
+
 #endif
arch/arm/plat-mxc/include/mach/iomux-mx53.h +5 -0
index 9440b9e..adcf2c0 100644
@@ -21,6 +21,11 @@
 
 #include <mach/iomux-v3.h>
 
+extern struct iomux_v3_pad_data imx53_ard_pad_data;
+extern struct iomux_v3_pad_data imx53_evk_pad_data;
+extern struct iomux_v3_pad_data imx53_loco_pad_data;
+extern struct iomux_v3_pad_data imx53_smd_pad_data;
+
 /* These 2 defines are for pins that may not have a mux register, but could
  * have a pad setting register, and vice-versa. */
 #define NON_PAD_I	0x00
arch/arm/plat-mxc/include/mach/iomux-v3.h +5 -0
index ebbce33..5689965 100644
@@ -55,6 +55,11 @@
 
 typedef u64 iomux_v3_cfg_t;
 
+struct iomux_v3_pad_data {
+	iomux_v3_cfg_t *pads;
+	int num;
+};
+
 #define MUX_CTRL_OFS_SHIFT	0
 #define MUX_CTRL_OFS_MASK	((iomux_v3_cfg_t)0xfff << MUX_CTRL_OFS_SHIFT)
 #define MUX_PAD_CTRL_OFS_SHIFT	12
Signature · 1 line
1.7.4.1
#2 lore raw

PATCH v3 1/2 arm/mx5: add device tree support for imx53 boards

Quoted 7 lines · Shawn Guo

From: Shawn Guo <[email protected]>

It adds device tree support for imx53 boards.

Cc Grant Likely <[email protected]>
Cc Sascha Hauer <[email protected]>

It's *really* close, but I see a problem...

Quoted 15 lines
(quoted diff) +15 -0
+static const char *imx53_dt_board_compat[] __initdata = {
+ ? ? ? "fsl,imx53-ard",
+ ? ? ? "fsl,imx53-evk",
+ ? ? ? "fsl,imx53-qsb",
+ ? ? ? "fsl,imx53-smd",
+ ? ? ? NULL
+};
+
+DT_MACHINE_START(IMX53_DT, "Freescale i.MX53 (Device Tree Support)")
+ ? ? ? .map_io ? ? ? ? = mx53_map_io,
+ ? ? ? .init_early ? ? = imx53_init_early,
+ ? ? ? .init_irq ? ? ? = mx53_init_irq,
+ ? ? ? .timer ? ? ? ? ?= &imx53_timer,
+ ? ? ? .init_machine ? = imx53_dt_init,
+ ? ? ? .dt_compat ? ? ?= imx53_dt_board_compat,

Review

Quoted 10 lines
(quoted diff) +10 -0
+MACHINE_END
+
+DT_MACHINE_START(IMX53_DT_ARD, "Freescale i.MX53 ARD (Device Tree Support)")
+ ? ? ? .map_io ? ? ? ? = mx53_map_io,
+ ? ? ? .init_early ? ? = imx53_init_early,
+ ? ? ? .init_irq ? ? ? = mx53_init_irq,
+ ? ? ? .timer ? ? ? ? ?= &imx53_timer,
+ ? ? ? .init_machine ? = imx53_ard_init,
+ ? ? ? .dt_compat ? ? ?= imx53_dt_board_compat,
+MACHINE_END

These two machine_descs will match on exactly the same boards because they use the same dt_compat table. So the ard variant will probably never get matched since it will be picked up by the IMX53_DT variant first. Each machine_desc must have a different match table.

However, today when we were talking you asked if it would be better to use a callback into board-specific code instead of the iomux table that is implemented in this patch. I was fine either way, but my opinion was that the table would probably result in less code. Well, combined with the above problem, I think I was wrong. Since the only difference in the ard variant is the call to imx53_ard_weim_cs_config(), both the cs config and the iomux setup will be simpler if both are handled in a callback. You're original instinct was correct.

g.

Quoted 48 lines
arch/arm/plat-mxc/include/mach/common.h +2 -0
index 4e3d978..32c24a4 100644
@@ -72,4 +72,6 @@ extern void mxc_arch_reset_init(void __iomem *);
 ?extern void mx51_efikamx_reset(void);
 ?extern int mx53_revision(void);
 ?extern int mx53_display_revision(void);
+extern int imx53_ard_weim_cs_config(void);
+

?#endif

arch/arm/plat-mxc/include/mach/iomux-mx53.h +0 -0
index 9440b9e..adcf2c0 100644
@@ -21,6 +21,11 @@
 

?#include <mach/iomux-v3.h>

arch/arm/plat-mxc/include/mach/iomux-mx53.h +5 -0
+extern struct iomux_v3_pad_data imx53_ard_pad_data;
+extern struct iomux_v3_pad_data imx53_evk_pad_data;
+extern struct iomux_v3_pad_data imx53_loco_pad_data;
+extern struct iomux_v3_pad_data imx53_smd_pad_data;
+

?/* These 2 defines are for pins that may not have a mux register, but could ?* have a pad setting register, and vice-versa. */
?#define NON_PAD_I ? ? ?0x00

arch/arm/plat-mxc/include/mach/iomux-v3.h +5 -0
index ebbce33..5689965 100644
@@ -55,6 +55,11 @@
 
 ?typedef u64 iomux_v3_cfg_t;
 
+struct iomux_v3_pad_data {
+ ? ? ? iomux_v3_cfg_t *pads;
+ ? ? ? int num;
+};
+

?#define MUX_CTRL_OFS_SHIFT ? ? 0
?#define MUX_CTRL_OFS_MASK ? ? ?((iomux_v3_cfg_t)0xfff << MUX_CTRL_OFS_SHIFT) ?#define MUX_PAD_CTRL_OFS_SHIFT 12
--
1.7.4.1

Signature · 2 lines
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
#3 lore raw

PATCH v3 1/2 arm/mx5: add device tree support for imx53 boards

Quoted 33 lines · Grant Likely
Quoted 7 lines · Shawn Guo

From: Shawn Guo <[email protected]>

It adds device tree support for imx53 boards.

Cc Grant Likely <[email protected]>
Cc Sascha Hauer <[email protected]>

It's *really* close, but I see a problem...

Quoted 22 lines
(quoted diff) +22 -0
+static const char *imx53_dt_board_compat[] __initdata = {
+ ? ? ? "fsl,imx53-ard",
+ ? ? ? "fsl,imx53-evk",
+ ? ? ? "fsl,imx53-qsb",
+ ? ? ? "fsl,imx53-smd",
+ ? ? ? NULL
+};
+
+DT_MACHINE_START(IMX53_DT, "Freescale i.MX53 (Device Tree Support)")
+ ? ? ? .map_io ? ? ? ? = mx53_map_io,
+ ? ? ? .init_early ? ? = imx53_init_early,
+ ? ? ? .init_irq ? ? ? = mx53_init_irq,
+ ? ? ? .timer ? ? ? ? ?= &imx53_timer,
+ ? ? ? .init_machine ? = imx53_dt_init,
+ ? ? ? .dt_compat ? ? ?= imx53_dt_board_compat,
+MACHINE_END
+
+DT_MACHINE_START(IMX53_DT_ARD, "Freescale i.MX53 ARD (Device Tree Support)")
+ ? ? ? .map_io ? ? ? ? = mx53_map_io,
+ ? ? ? .init_early ? ? = imx53_init_early,
+ ? ? ? .init_irq ? ? ? = mx53_init_irq,
+ ? ? ? .timer ? ? ? ? ?= &imx53_timer,
Quoted 9 lines
Quoted 3 lines

+ ? ? ? .init_machine ? = imx53_ard_init,
+ ? ? ? .dt_compat ? ? ?= imx53_dt_board_compat,
+MACHINE_END

These two machine_descs will match on exactly the same boards because they use the same dt_compat table. So the ard variant will probably never get matched since it will be picked up by the IMX53_DT variant first. Each machine_desc must have a different match table.

I believe I tested it working when I split them into two machine_descs. Oh, here is the evidence :)

$ arm-linux-gnueabi-objdump -t -j .init.arch.info  vmlinux

vmlinux: file format elf32-littlearm

SYMBOL TABLE:

c03d73d0 l    d  .init.arch.info        00000000 .init.arch.info
c03d73d0 l     O .init.arch.info        0000003c __mach_desc_MX53_EVK
c03d740c l     O .init.arch.info        0000003c __mach_desc_MX53_SMD
c03d7448 l     O .init.arch.info        0000003c __mach_desc_MX53_LOCO
c03d7484 l     O .init.arch.info        0000003c __mach_desc_MX53_ARD
c03d74c0 l     O .init.arch.info        0000003c __mach_desc_IMX53_DT_ARD
c03d74fc l     O .init.arch.info        0000003c __mach_desc_IMX53_DT
c03d73d0 g       .init.arch.info        00000000 __arch_info_begin
c03d7538 g       .init.arch.info        00000000 __arch_info_end

It seems that gcc compiles the machine_desc in bottom-up order, so ARD still can match the correct entry. When I change the code to put IMX53_DT_ARD before IMX53_DT, the __mach_desc_IMX53_DT_ARD goes behind __mach_desc_IMX53_DT, in which case the ARD matching will be broken. So yes, we need to fix it.

Quoted 10 lines

However, today when we were talking you asked if it would be better to use a callback into board-specific code instead of the iomux table that is implemented in this patch. I was fine either way, but my opinion was that the table would probably result in less code. Well, combined with the above problem, I think I was wrong. Since the only difference in the ard variant is the call to imx53_ard_weim_cs_config(), both the cs config and the iomux setup will be simpler if both are handled in a callback. You're original instinct was correct.

Ok, here you go.

---8<---

arch/arm/mach-mx5/board-mx53_ard.c +8 -4
index 76a67c4..9b4395d 100644
@@ -171,9 +171,6 @@ static struct imxi2c_platform_data mx53_ard_i2c3_data = {
 
 static void __init mx53_ard_io_init(void)
 {
-	mxc_iomux_v3_setup_multiple_pads(mx53_ard_pads,
-				ARRAY_SIZE(mx53_ard_pads));
-
 	gpio_request(ARD_ETHERNET_INT_B, "eth-int-b");
 	gpio_direction_input(ARD_ETHERNET_INT_B);
 
@@ -216,6 +213,13 @@ static int weim_cs_config(void)
 	return 0;
 }
 
+void __init imx53_ard_common_init(void)
+{
+	mxc_iomux_v3_setup_multiple_pads(mx53_ard_pads,
+					 ARRAY_SIZE(mx53_ard_pads));
+	weim_cs_config();
+}
+
 static struct platform_device *devices[] __initdata = {
 	&ard_smsc_lan9220_device,
 };
@@ -225,8 +229,8 @@ static void __init mx53_ard_board_init(void)
 	imx53_soc_init();
 	imx53_add_imx_uart(0, NULL);
 
+	imx53_ard_common_init();
 	mx53_ard_io_init();
-	weim_cs_config();
 	platform_add_devices(devices, ARRAY_SIZE(devices));
 
 	imx53_add_sdhci_esdhc_imx(0, &mx53_ard_sd1_data);
arch/arm/mach-mx5/board-mx53_evk.c +7 -2
index 1b417b0..7663905 100644
@@ -131,12 +131,17 @@ static const struct spi_imx_master mx53_evk_spi_data __initconst = {
 	.num_chipselect = ARRAY_SIZE(mx53_evk_spi_cs),
 };
 
+void __init imx53_evk_common_init(void)
+{
+	mxc_iomux_v3_setup_multiple_pads(mx53_evk_pads,
+					 ARRAY_SIZE(mx53_evk_pads));
+}
+
 static void __init mx53_evk_board_init(void)
 {
 	imx53_soc_init();
+	imx53_evk_common_init();
 
-	mxc_iomux_v3_setup_multiple_pads(mx53_evk_pads,
-					ARRAY_SIZE(mx53_evk_pads));
 	mx53_evk_init_uart();
 	mx53_evk_fec_reset();
 	imx53_add_fec(&mx53_evk_fec_pdata);
arch/arm/mach-mx5/board-mx53_loco.c +7 -2
index 4e1d51d..3922cd5 100644
@@ -257,12 +257,17 @@ static const struct gpio_led_platform_data mx53loco_leds_data __initconst = {
 	.num_leds	= ARRAY_SIZE(mx53loco_leds),
 };
 
+void __init imx53_qsb_common_init(void)
+{
+	mxc_iomux_v3_setup_multiple_pads(mx53_loco_pads,
+					 ARRAY_SIZE(mx53_loco_pads));
+}
+
 static void __init mx53_loco_board_init(void)
 {
 	imx53_soc_init();
+	imx53_qsb_common_init();
 
-	mxc_iomux_v3_setup_multiple_pads(mx53_loco_pads,
-					ARRAY_SIZE(mx53_loco_pads));
 	imx53_add_imx_uart(0, NULL);
 	mx53_loco_fec_reset();
 	imx53_add_fec(&mx53_loco_fec_data);
arch/arm/mach-mx5/board-mx53_smd.c +7 -2
index bc02894..b10c899 100644
@@ -111,12 +111,17 @@ static const struct imxi2c_platform_data mx53_smd_i2c_data __initconst = {
 	.bitrate = 100000,
 };
 
+void __init imx53_smd_common_init(void)
+{
+	mxc_iomux_v3_setup_multiple_pads(mx53_smd_pads,
+					 ARRAY_SIZE(mx53_smd_pads));
+}
+
 static void __init mx53_smd_board_init(void)
 {
 	imx53_soc_init();
+	imx53_smd_common_init();
 
-	mxc_iomux_v3_setup_multiple_pads(mx53_smd_pads,
-					ARRAY_SIZE(mx53_smd_pads));
 	mx53_smd_init_uart();
 	mx53_smd_fec_reset();
 	imx53_add_fec(&mx53_smd_fec_data);
arch/arm/mach-mx5/imx53-dt.c new file +127 -0

127 lines not on this page · raw message

arch/arm/plat-mxc/include/mach/common.h +5 -0
index 4e3d978..96fc04d 100644
@@ -72,4 +72,9 @@ extern void mxc_arch_reset_init(void __iomem *);
 extern void mx51_efikamx_reset(void);
 extern int mx53_revision(void);
 extern int mx53_display_revision(void);
+extern void imx53_ard_common_init(void);
+extern void imx53_evk_common_init(void);
+extern void imx53_qsb_common_init(void);
+extern void imx53_smd_common_init(void);
+
 #endif
Signature · 2 lines
Regards,
Shawn
#4 lore raw

PATCH v3 1/2 arm/mx5: add device tree support for imx53 boards

Quoted 13 lines · Shawn Guo
Quoted 11 lines · Grant Likely

On Mon, Aug 1, 2011 at 8:17 PM, Shawn Guo <[email protected]> wrote:
However, today when we were talking you asked if it would be better to use a callback into board-specific code instead of the iomux table that is implemented in this patch. I was fine either way, but my opinion was that the table would probably result in less code. Well, combined with the above problem, I think I was wrong. Since the only difference in the ard variant is the call to imx53_ard_weim_cs_config(), both the cs config and the iomux setup will be simpler if both are handled in a callback. You're original instinct was correct.

Quoted 1 line

Ok, here you go.

Yes, I think this is the right approach. Go ahead and spin it into a real patch series and repost.

g.

maintainer
#5 lore raw

PATCH v3 1/2 arm/mx5: add device tree support for imx53 boards

In reply to Shawn Guo
Quoted 24 lines · Shawn Guo

From: Shawn Guo <[email protected]>

It adds device tree support for imx53 boards.

Cc Grant Likely <[email protected]>
Cc Sascha Hauer <[email protected]>
---
 .../devicetree/bindings/arm/fsl/boards.txt         |   15 ++
 arch/arm/boot/dts/imx53-ard.dts                    |  158 +++++++++++++
 arch/arm/boot/dts/imx53-evk.dts                    |  144 ++++++++++++
 arch/arm/boot/dts/imx53-qsb.dts                    |  148 ++++++++++++
 arch/arm/boot/dts/imx53-smd.dts                    |  169 ++++++++++++++
 arch/arm/boot/dts/imx53.dtsi                       |  244 ++++++++++++++++++++
 arch/arm/mach-mx5/Kconfig                          |   12 +
 arch/arm/mach-mx5/Makefile                         |    2 +
 arch/arm/mach-mx5/board-mx53_ard.c                 |    9 +-
 arch/arm/mach-mx5/board-mx53_evk.c                 |    5 +
 arch/arm/mach-mx5/board-mx53_loco.c                |    5 +
 arch/arm/mach-mx5/board-mx53_smd.c                 |    5 +
 arch/arm/mach-mx5/imx53-dt.c                       |  143 ++++++++++++
 arch/arm/plat-mxc/include/mach/common.h            |    2 +
 arch/arm/plat-mxc/include/mach/iomux-mx53.h        |    5 +
 arch/arm/plat-mxc/include/mach/iomux-v3.h          |    5 +
Quoted 8 lines
 16 files changed, 1069 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/arm/fsl/boards.txt
 create mode 100644 arch/arm/boot/dts/imx53-ard.dts
 create mode 100644 arch/arm/boot/dts/imx53-evk.dts
 create mode 100644 arch/arm/boot/dts/imx53-qsb.dts
 create mode 100644 arch/arm/boot/dts/imx53-smd.dts
 create mode 100644 arch/arm/boot/dts/imx53.dtsi
 create mode 100644 arch/arm/mach-mx5/imx53-dt.c

I noticed that the iomux setup is gone for now which makes me very happy :) I didn't have a good feeling about this.

Quoted 34 lines
arch/arm/boot/dts/imx53-ard.dts new file +27 -0
new file mode 100644
index 0000000..fd0cf2c
@@ -0,0 +1,158 @@
+/*
+ * Copyright 2011 Freescale Semiconductor, Inc.
+ * 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
+ */
+
+/dts-v1/;
+/include/ "imx53.dtsi"
+
+/ {
+	model = "Freescale i.MX53 Automotive Reference Design Board";
+	compatible = "fsl,imx53-ard", "fsl,imx53";
+
+	chosen {
+		bootargs = "console=ttymxc0,115200 root=/dev/mmcblk0p3 rootwait";
+	};
+
+	memory {
+		reg = <0x70000000 0x40000000>;
+	};
+

arch/arm/boot/dts/imx53-ard.dts line 37

Quoted 10 lines
arch/arm/boot/dts/imx53-ard.dts new file +10 -0
+	aips at 50000000 { /* AIPS1 */
+		spba at 50000000 {
+			esdhc at 50004000 { /* ESDHC1 */
+				cd-gpios = <&gpio0 1 0>; /* GPIO1_1 */
+				wp-gpios = <&gpio0 9 0>; /* GPIO1_9 */
+			};
+
+			esdhc at 50008000 { /* ESDHC2 */
+				status = "disabled";
+			};

I know the decision is that all devices are enabled by default and must be explicitely disabled like this. I really hope we can change this in the future for the following reasons:

- The imx53 device tree is not complete, several devices like nand, ipu and rtc are missing. Now when imx53.dtsi gets the nand device, all board devicetrees have to be changed to keep the old behaviour.
- Most enabled device entries like the esdhc1 above have additional nodes like cd-gpios anyway, so they must appear in the board tree whereas the disabled devices just add additional churn.

Signature · 4 lines
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 |
#6 lore raw

PATCH v3 1/2 arm/mx5: add device tree support for imx53 boards

Quoted 34 lines · Sascha Hauer
Quoted 24 lines · Shawn Guo

From: Shawn Guo <[email protected]>

It adds device tree support for imx53 boards.

Cc Grant Likely <[email protected]>
Cc Sascha Hauer <[email protected]>
---
 .../devicetree/bindings/arm/fsl/boards.txt         |   15 ++
 arch/arm/boot/dts/imx53-ard.dts                    |  158 +++++++++++++
 arch/arm/boot/dts/imx53-evk.dts                    |  144 ++++++++++++
 arch/arm/boot/dts/imx53-qsb.dts                    |  148 ++++++++++++
 arch/arm/boot/dts/imx53-smd.dts                    |  169 ++++++++++++++
 arch/arm/boot/dts/imx53.dtsi                       |  244 ++++++++++++++++++++
 arch/arm/mach-mx5/Kconfig                          |   12 +
 arch/arm/mach-mx5/Makefile                         |    2 +
 arch/arm/mach-mx5/board-mx53_ard.c                 |    9 +-
 arch/arm/mach-mx5/board-mx53_evk.c                 |    5 +
 arch/arm/mach-mx5/board-mx53_loco.c                |    5 +
 arch/arm/mach-mx5/board-mx53_smd.c                 |    5 +
 arch/arm/mach-mx5/imx53-dt.c                       |  143 ++++++++++++
 arch/arm/plat-mxc/include/mach/common.h            |    2 +
 arch/arm/plat-mxc/include/mach/iomux-mx53.h        |    5 +
 arch/arm/plat-mxc/include/mach/iomux-v3.h          |    5 +
Quoted 8 lines
 16 files changed, 1069 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/arm/fsl/boards.txt
 create mode 100644 arch/arm/boot/dts/imx53-ard.dts
 create mode 100644 arch/arm/boot/dts/imx53-evk.dts
 create mode 100644 arch/arm/boot/dts/imx53-qsb.dts
 create mode 100644 arch/arm/boot/dts/imx53-smd.dts
 create mode 100644 arch/arm/boot/dts/imx53.dtsi
 create mode 100644 arch/arm/mach-mx5/imx53-dt.c
Quoted 3 lines

I noticed that the iomux setup is gone for now which makes me very happy :) I didn't have a good feeling about this.

But it's just for now :) We anyway need to set it up from device tree sooner or later.

Quoted 49 lines
Quoted 34 lines
arch/arm/boot/dts/imx53-ard.dts new file +27 -0
new file mode 100644
index 0000000..fd0cf2c
@@ -0,0 +1,158 @@
+/*
+ * Copyright 2011 Freescale Semiconductor, Inc.
+ * 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
+ */
+
+/dts-v1/;
+/include/ "imx53.dtsi"
+
+/ {
+	model = "Freescale i.MX53 Automotive Reference Design Board";
+	compatible = "fsl,imx53-ard", "fsl,imx53";
+
+	chosen {
+		bootargs = "console=ttymxc0,115200 root=/dev/mmcblk0p3 rootwait";
+	};
+
+	memory {
+		reg = <0x70000000 0x40000000>;
+	};
+

arch/arm/boot/dts/imx53-ard.dts line 37

Quoted 10 lines
arch/arm/boot/dts/imx53-ard.dts new file +10 -0
+	aips at 50000000 { /* AIPS1 */
+		spba at 50000000 {
+			esdhc at 50004000 { /* ESDHC1 */
+				cd-gpios = <&gpio0 1 0>; /* GPIO1_1 */
+				wp-gpios = <&gpio0 9 0>; /* GPIO1_9 */
+			};
+
+			esdhc at 50008000 { /* ESDHC2 */
+				status = "disabled";
+			};

I know the decision is that all devices are enabled by default and must be explicitely disabled like this. I really hope we can change this in the future for the following reasons:

Quoted 7 lines

- The imx53 device tree is not complete, several devices like nand, ipu and rtc are missing. Now when imx53.dtsi gets the nand device, all board devicetrees have to be changed to keep the old behaviour.
- Most enabled device entries like the esdhc1 above have additional nodes like cd-gpios anyway, so they must appear in the board tree whereas the disabled devices just add additional churn.

I fully have your back on this point. Let's try one more time to change Grant's mind.

Signature · 2 lines
Regards,
Shawn
#7 lore raw

PATCH v3 1/2 arm/mx5: add device tree support for imx53 boards

In reply to Sascha Hauer
Quoted 34 lines · Sascha Hauer
Quoted 24 lines · Shawn Guo

From: Shawn Guo <[email protected]>

It adds device tree support for imx53 boards.

Cc Grant Likely <[email protected]>
Cc Sascha Hauer <[email protected]>
---
 .../devicetree/bindings/arm/fsl/boards.txt         |   15 ++
 arch/arm/boot/dts/imx53-ard.dts                    |  158 +++++++++++++
 arch/arm/boot/dts/imx53-evk.dts                    |  144 ++++++++++++
 arch/arm/boot/dts/imx53-qsb.dts                    |  148 ++++++++++++
 arch/arm/boot/dts/imx53-smd.dts                    |  169 ++++++++++++++
 arch/arm/boot/dts/imx53.dtsi                       |  244 ++++++++++++++++++++
 arch/arm/mach-mx5/Kconfig                          |   12 +
 arch/arm/mach-mx5/Makefile                         |    2 +
 arch/arm/mach-mx5/board-mx53_ard.c                 |    9 +-
 arch/arm/mach-mx5/board-mx53_evk.c                 |    5 +
 arch/arm/mach-mx5/board-mx53_loco.c                |    5 +
 arch/arm/mach-mx5/board-mx53_smd.c                 |    5 +
 arch/arm/mach-mx5/imx53-dt.c                       |  143 ++++++++++++
 arch/arm/plat-mxc/include/mach/common.h            |    2 +
 arch/arm/plat-mxc/include/mach/iomux-mx53.h        |    5 +
 arch/arm/plat-mxc/include/mach/iomux-v3.h          |    5 +
Quoted 8 lines
 16 files changed, 1069 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/arm/fsl/boards.txt
 create mode 100644 arch/arm/boot/dts/imx53-ard.dts
 create mode 100644 arch/arm/boot/dts/imx53-evk.dts
 create mode 100644 arch/arm/boot/dts/imx53-qsb.dts
 create mode 100644 arch/arm/boot/dts/imx53-smd.dts
 create mode 100644 arch/arm/boot/dts/imx53.dtsi
 create mode 100644 arch/arm/mach-mx5/imx53-dt.c
Quoted 3 lines

I noticed that the iomux setup is gone for now which makes me very happy :) I didn't have a good feeling about this.

But it's just for now :) We anyway need to set it up from device tree sooner or later.

Quoted 49 lines
Quoted 34 lines
arch/arm/boot/dts/imx53-ard.dts new file +27 -0
new file mode 100644
index 0000000..fd0cf2c
@@ -0,0 +1,158 @@
+/*
+ * Copyright 2011 Freescale Semiconductor, Inc.
+ * 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
+ */
+
+/dts-v1/;
+/include/ "imx53.dtsi"
+
+/ {
+	model = "Freescale i.MX53 Automotive Reference Design Board";
+	compatible = "fsl,imx53-ard", "fsl,imx53";
+
+	chosen {
+		bootargs = "console=ttymxc0,115200 root=/dev/mmcblk0p3 rootwait";
+	};
+
+	memory {
+		reg = <0x70000000 0x40000000>;
+	};
+

arch/arm/boot/dts/imx53-ard.dts line 37

Quoted 10 lines
arch/arm/boot/dts/imx53-ard.dts new file +10 -0
+	aips at 50000000 { /* AIPS1 */
+		spba at 50000000 {
+			esdhc at 50004000 { /* ESDHC1 */
+				cd-gpios = <&gpio0 1 0>; /* GPIO1_1 */
+				wp-gpios = <&gpio0 9 0>; /* GPIO1_9 */
+			};
+
+			esdhc at 50008000 { /* ESDHC2 */
+				status = "disabled";
+			};

I know the decision is that all devices are enabled by default and must be explicitely disabled like this. I really hope we can change this in the future for the following reasons:

Quoted 7 lines

- The imx53 device tree is not complete, several devices like nand, ipu and rtc are missing. Now when imx53.dtsi gets the nand device, all board devicetrees have to be changed to keep the old behaviour.
- Most enabled device entries like the esdhc1 above have additional nodes like cd-gpios anyway, so they must appear in the board tree whereas the disabled devices just add additional churn.

I have your back on this point. Let's give one more try to change Grant's mind.

Signature · 2 lines
Regards,
Shawn
#8 lore raw

PATCH v3 1/2 arm/mx5: add device tree support for imx53 boards

In reply to Sascha Hauer
Quoted 17 lines · Sascha Hauer

arch/arm/boot/dts/imx53-ard.dts line 37

Quoted 11 lines · Shawn Guo
arch/arm/boot/dts/imx53-ard.dts new file +11 -0
+
+	aips at 50000000 { /* AIPS1 */
+		spba at 50000000 {
+			esdhc at 50004000 { /* ESDHC1 */
+				cd-gpios = <&gpio0 1 0>; /* GPIO1_1 */
+				wp-gpios = <&gpio0 9 0>; /* GPIO1_9 */
+			};
+
+			esdhc at 50008000 { /* ESDHC2 */
+				status = "disabled";
+			};

I know the decision is that all devices are enabled by default and must be explicitely disabled like this. I really hope we can change this in the future for the following reasons:

Quoted 6 lines

- The imx53 device tree is not complete, several devices like nand, ipu and rtc are missing. Now when imx53.dtsi gets the nand device, all board devicetrees have to be changed to keep the old behaviour.
- Most enabled device entries like the esdhc1 above have additional nodes like cd-gpios anyway, so they must appear in the board tree whereas the disabled devices just add additional churn.

I'll add this topic to the whiteboard for the kernel WG to discuss this week.

http://pad.ubuntu.com/device-tree-workshop

g.

author
#9 lore raw

PATCH v3 2/2 arm/mx5: add device tree support for imx51 babbage

In reply to Shawn Guo

It adds device tree support for imx51 babbage board.

Cc Grant Likely <[email protected]>
Cc Sascha Hauer <[email protected]>
---
 .../devicetree/bindings/arm/fsl/boards.txt         |    4 +
 arch/arm/boot/dts/imx51-babbage.dts                |  141 ++++++++++++++
 arch/arm/boot/dts/imx51.dtsi                       |  203 ++++++++++++++++++++
 arch/arm/mach-mx5/Kconfig                          |    9 +
 arch/arm/mach-mx5/Makefile                         |    1 +
 arch/arm/mach-mx5/board-mx51_babbage.c             |    5 +
 arch/arm/mach-mx5/imx51-dt.c                       |  112 +++++++++++
 arch/arm/plat-mxc/include/mach/iomux-mx51.h        |    2 +
 8 files changed, 477 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/boot/dts/imx51-babbage.dts
 create mode 100644 arch/arm/boot/dts/imx51.dtsi
 create mode 100644 arch/arm/mach-mx5/imx51-dt.c
Documentation/devicetree/bindings/arm/fsl/boards.txt +4 -0
index d1e8d6f..e2401cd 100644
@@ -1,3 +1,7 @@
+i.MX51 Babbage Board
+Required root node properties:
+    - compatible = "fsl,imx51-babbage", "fsl,imx51";
+
 i.MX53 Automotive Reference Design Board
 Required root node properties:
     - compatible = "fsl,imx53-ard", "fsl,imx53";
arch/arm/boot/dts/imx51-babbage.dts new file +141 -0

141 lines not on this page · raw message

arch/arm/boot/dts/imx51.dtsi new file +203 -0

203 lines not on this page · raw message

arch/arm/mach-mx5/Kconfig +9 -0
index 0ac676c..bda12e8 100644
@@ -62,6 +62,15 @@ endif # ARCH_MX50_SUPPORTED
 if ARCH_MX51
 comment "i.MX51 machines:"
 
+config MACH_IMX51_DT
+	bool "Support i.MX51 platforms from device tree"
+	select SOC_IMX51
+	select USE_OF
+	select MACH_MX51_BABBAGE
+	help
+	  Include support for Freescale i.MX51 based platforms
+	  using the device tree for discovery
+
 config MACH_MX51_BABBAGE
 	bool "Support MX51 BABBAGE platforms"
 	select SOC_IMX51
arch/arm/mach-mx5/Makefile +1 -0
index 3dbe5e2..a3c75f3 100644
@@ -23,4 +23,5 @@ obj-$(CONFIG_MACH_MX51_EFIKAMX) += board-mx51_efikamx.o
 obj-$(CONFIG_MACH_MX51_EFIKASB) += board-mx51_efikasb.o
 obj-$(CONFIG_MACH_MX50_RDP) += board-mx50_rdp.o
 
+obj-$(CONFIG_MACH_IMX51_DT) += imx51-dt.o
 obj-$(CONFIG_MACH_IMX53_DT) += imx53-dt.o
arch/arm/mach-mx5/board-mx51_babbage.c +5 -0
index e400b09..e0cdeae 100644
@@ -167,6 +167,11 @@ static iomux_v3_cfg_t mx51babbage_pads[] = {
 	MX51_PAD_CSPI1_SS1__GPIO4_25,
 };
 
+struct iomux_v3_pad_data imx51_babbage_pad_data = {
+	.pads = mx51babbage_pads,
+	.num = ARRAY_SIZE(mx51babbage_pads),
+};
+
 /* Serial ports */
 static const struct imxuart_platform_data uart_pdata __initconst = {
 	.flags = IMXUART_HAVE_RTSCTS,
arch/arm/mach-mx5/imx51-dt.c new file +112 -0

112 lines not on this page · raw message

arch/arm/plat-mxc/include/mach/iomux-mx51.h +2 -0
index df6acc0..1a6748b 100644
@@ -15,6 +15,8 @@
 
 #include <mach/iomux-v3.h>
 
+extern struct iomux_v3_pad_data imx51_babbage_pad_data;
+
 /* Pad control groupings */
 #define MX51_UART_PAD_CTRL	(PAD_CTL_PKE | PAD_CTL_PUE | PAD_CTL_DSE_HIGH | \
 				PAD_CTL_HYS | PAD_CTL_SRE_FAST)
Signature · 1 line
1.7.4.1