Skip to contentSkip to conversation

ARM: add minimal support for the Freescale Quad UDOO Board

PATCH Superseded Raphaël Poggi 2 participants 2 messages Feb 14, 2014

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: add minimal support for the Freescale Quad UDOO Board

From: Raphael Poggi <[email protected]>

Adding minimal support for the UDOO board.

For more information about the board: http://www.udoo.org/

---
 arch/arm/boards/Makefile                          |    1 +
 arch/arm/boards/udoo/Makefile                     |    3 +
 arch/arm/boards/udoo/board.c                      |  214 +++++++++++++++++++++
 arch/arm/boards/udoo/env/config-board             |    6 +
 arch/arm/boards/udoo/flash-header-mx6-udoo.imxcfg |  104 ++++++++++
 arch/arm/boards/udoo/lowlevel.c                   |   17 ++
 arch/arm/configs/udoo_quad_defconfig              |   86 +++++++++
 arch/arm/dts/Makefile                             |    4 +-
 arch/arm/dts/imx6q-udoo.dts                       |   23 +++
 arch/arm/dts/imx6qdl-udoo.dtsi                    |  108 +++++++++++
 arch/arm/mach-imx/Kconfig                         |    5 +
 arch/arm/tools/mach-types                         |    1 +
 images/Makefile.imx                               |    5 +
 13 files changed, 576 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boards/udoo/Makefile
 create mode 100644 arch/arm/boards/udoo/board.c
 create mode 100644 arch/arm/boards/udoo/env/config-board
 create mode 100644 arch/arm/boards/udoo/flash-header-mx6-udoo.imxcfg
 create mode 100644 arch/arm/boards/udoo/lowlevel.c
 create mode 100644 arch/arm/configs/udoo_quad_defconfig
 create mode 100644 arch/arm/dts/imx6q-udoo.dts
 create mode 100644 arch/arm/dts/imx6qdl-udoo.dtsi
arch/arm/boards/Makefile +1 -0
index befddd0..a45adee 100644
@@ -91,6 +91,7 @@ obj-$(CONFIG_MACH_TX25)				+= karo-tx25/
 obj-$(CONFIG_MACH_TX28)				+= karo-tx28/
 obj-$(CONFIG_MACH_TX51)				+= karo-tx51/
 obj-$(CONFIG_MACH_TX53)				+= karo-tx53/
+obj-$(CONFIG_MACH_UDOO)             += udoo/
 obj-$(CONFIG_MACH_USB_A9260)			+= usb-a926x/
 obj-$(CONFIG_MACH_USB_A9263)			+= usb-a926x/
 obj-$(CONFIG_MACH_USB_A9G20)			+= usb-a926x/
arch/arm/boards/udoo/Makefile new file +3 -0
new file mode 100644
index 0000000..ae17789
@@ -0,0 +1,3 @@
+obj-y += board.o flash-header-mx6-udoo.dcd.o
+extra-y += flash-header-mx6-udoo.dcd.S flash-header-mx6-udoo.dcd
+lwl-y += lowlevel.o
arch/arm/boards/udoo/board.c new file +214 -0

214 lines not on this page · raw message

arch/arm/boards/udoo/env/config-board new file +6 -0
new file mode 100644
index 0000000..4cabac6
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# board defaults, do not change in running system. Change /env/config
+# instead
+
+global.linux.bootargs.base="console=ttymxc1,115200"
arch/arm/boards/udoo/flash-header-mx6-udoo.imxcfg new file +104 -0

104 lines not on this page · raw message

arch/arm/boards/udoo/lowlevel.c new file +17 -0
new file mode 100644
index 0000000..b54ddfe
@@ -0,0 +1,17 @@
+#include <common.h>
+#include <sizes.h>
+#include <asm/barebox-arm-head.h>
+#include <asm/barebox-arm.h>
+
+extern char __dtb_imx6q_udoo_start[];
+
+ENTRY_FUNCTION(start_imx6_udoo, r0, r1, r2)
+{
+	uint32_t fdt;
+
+	arm_cpu_lowlevel_init();
+
+	fdt = (uint32_t)__dtb_imx6q_udoo_start - get_runtime_offset();
+
+	barebox_arm_entry(0x10000000, SZ_1G, fdt);
+}
arch/arm/configs/udoo_quad_defconfig new file +86 -0

86 lines not on this page · raw message

arch/arm/dts/Makefile +3 -1
index 07508e3..45b4b54 100644
@@ -23,7 +23,8 @@ dtb-$(CONFIG_ARCH_IMX6) += imx6q-gk802.dtb \
 	imx6q-phytec-pbab01.dtb \
 	imx6dl-hummingboard.dtb \
 	imx6q-nitrogen6x.dtb \
-	imx6dl-nitrogen6x.dtb
+	imx6dl-nitrogen6x.dtb \
+    imx6q-udoo.dtb
 dtb-$(CONFIG_ARCH_MVEBU) += dove-cubox.dtb
 dtb-$(CONFIG_ARCH_SOCFPGA) += socfpga_cyclone5_sockit.dtb \
 	socfpga_cyclone5_socrates.dtb
@@ -55,6 +56,7 @@ pbl-$(CONFIG_MACH_SOCFPGA_TERASIC_SOCKIT) += socfpga_cyclone5_sockit.dtb.o
 pbl-$(CONFIG_MACH_SOLIDRUN_HUMMINGBOARD) += imx6dl-hummingboard.dtb.o
 pbl-$(CONFIG_MACH_SABRELITE) += imx6q-sabrelite.dtb.o imx6dl-sabrelite.dtb.o
 pbl-$(CONFIG_MACH_NITROGEN6X) += imx6q-nitrogen6x.dtb.o imx6dl-nitrogen6x.dtb.o
+pbl-$(CONFIG_MACH_UDOO) += imx6q-udoo.dtb.o
 
 .SECONDARY: $(obj)/$(BUILTIN_DTB).dtb.S
 .SECONDARY: $(patsubst %,$(obj)/%.S,$(dtb-y))
arch/arm/dts/imx6q-udoo.dts new file +23 -0
new file mode 100644
index 0000000..da558d4
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2014 Raphaël Poggi
+ * Copyright 2012 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 "imx6q.dtsi"
+#include "imx6qdl-udoo.dtsi"
+
+/ {
+	model = "Freescale i.MX6 Quad UDOO Board";
+	compatible = "fsl,imx6q-udoo", "fsl,imx6q";
+};
+
arch/arm/dts/imx6qdl-udoo.dtsi new file +108 -0

108 lines not on this page · raw message

arch/arm/mach-imx/Kconfig +5 -0
index 5933f81..d9fadf1 100644
@@ -37,6 +37,7 @@ config ARCH_TEXT_BASE
 	default 0x2fc00000 if MACH_TQMA6X
 	default 0x4fc00000 if MACH_PHYTEC_PFLA02
 	default 0x4fc00000 if MACH_DFI_FS700_M60
+	default 0x4fc00000 if MACH_UDOO
 
 config ARCH_IMX_INTERNAL_BOOT
 	bool "support internal boot mode"
@@ -233,6 +234,10 @@ config MACH_SOLIDRUN_HUMMINGBOARD
 	bool "SolidRun Hummingboard"
 	select ARCH_IMX6
 
+config MACH_UDOO
+       bool "Freescale i.MX6 UDOO Board"
+       select ARCH_IMX6
+
 endif
 
 # ----------------------------------------------------------
arch/arm/tools/mach-types +1 -0
index 01bc7aa..4718011 100644
@@ -4723,3 +4723,4 @@ ecv4			MACH_ECV4		ECV4			4768
 webbg3flight		MACH_WEBBG3FLIGHT	WEBBG3FLIGHT		4769
 sbc_phycore_am335x	MACH_SBC_PHYCORE_AM335X	SBC_PHYCORE_AM335X	4770
 tsc			MACH_TSC		TSC			4771
+udoo           MACH_UDOO               UDOO_QUAD       4772
images/Makefile.imx +5 -0
index 9aca871..e3b27b7 100644
@@ -123,3 +123,8 @@ pblx-$(CONFIG_MACH_NITROGEN6X) += start_imx6dl_nitrogen6x_1g
 CFG_start_imx6dl_nitrogen6x_1g.pblx.imximg = $(board)/boundarydevices-nitrogen6x/flash-header-nitrogen6x-1g.imxcfg
 FILE_barebox-boundarydevices-imx6dl-nitrogen6x-1g.img = start_imx6dl_nitrogen6x_1g.pblx.imximg
 image-$(CONFIG_MACH_NITROGEN6X) += barebox-boundarydevices-imx6dl-nitrogen6x-1g.img
+
+pblx-$(CONFIG_MACH_UDOO) += start_imx6_udoo
+CFG_start_imx6_udoo.pblx.imximg = $(board)/udoo/flash-header-mx6-udoo.imxcfg
+FILE_barebox-freescale-imx6q-udoo.img = start_imx6_udoo.pblx.imximg
+image-$(CONFIG_MACH_UDOO) += barebox-freescale-imx6q-udoo.img
Signature · 7 lines
1.7.9.5


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw

Hi Raphaël,

Am Freitag, den 14.02.2014, 09:50 +0100 schrieb Raphaël Poggi:

Quoted 31 lines

From: Raphael Poggi <[email protected]>

Adding minimal support for the UDOO board.

For more information about the board: http://www.udoo.org/

---
 arch/arm/boards/Makefile                          |    1 +
 arch/arm/boards/udoo/Makefile                     |    3 +
 arch/arm/boards/udoo/board.c                      |  214 +++++++++++++++++++++
 arch/arm/boards/udoo/env/config-board             |    6 +
 arch/arm/boards/udoo/flash-header-mx6-udoo.imxcfg |  104 ++++++++++
 arch/arm/boards/udoo/lowlevel.c                   |   17 ++
 arch/arm/configs/udoo_quad_defconfig              |   86 +++++++++
 arch/arm/dts/Makefile                             |    4 +-
 arch/arm/dts/imx6q-udoo.dts                       |   23 +++
 arch/arm/dts/imx6qdl-udoo.dtsi                    |  108 +++++++++++
 arch/arm/mach-imx/Kconfig                         |    5 +
 arch/arm/tools/mach-types                         |    1 +
 images/Makefile.imx                               |    5 +
 13 files changed, 576 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boards/udoo/Makefile
 create mode 100644 arch/arm/boards/udoo/board.c
 create mode 100644 arch/arm/boards/udoo/env/config-board
 create mode 100644 arch/arm/boards/udoo/flash-header-mx6-udoo.imxcfg
 create mode 100644 arch/arm/boards/udoo/lowlevel.c
 create mode 100644 arch/arm/configs/udoo_quad_defconfig
 create mode 100644 arch/arm/dts/imx6q-udoo.dts
 create mode 100644 arch/arm/dts/imx6qdl-udoo.dtsi

[...]

arch/arm/boards/udoo/board.c line 84

Quoted 9 lines
arch/arm/boards/udoo/board.c new file +9 -0
+
+static int udoo_mem_init(void)
+{
+	arm_add_mem_device("ram0", 0x10000000, SZ_1G);
+
+	return 0;
+}
+mem_initcall(udoo_mem_init);
+

Do you need this? Barebox should be able to figure this out from the device tree.

arch/arm/boards/udoo/board.c line 93

Quoted 9 lines
arch/arm/boards/udoo/board.c new file +9 -0
+static int ksz9021rn_phy_fixup(struct phy_device *dev)
+{
+
+	phy_write( dev , 0x09 , 0x1c00 );
+	phy_write( dev , 0x4 , 0x0000 );
+	phy_write( dev , 0x5 , 0x0000 );
+	phy_write( dev , 0x6 , 0x0000 );
+	phy_write( dev , 0x8 , 0x03ff );
+

Whitespace is looking weird here.

Quoted 24 lines
arch/arm/boards/udoo/board.c new file +24 -0
+
+	/* do same as linux kernel */
+	/* min rx data delay */
+	phy_write(dev, 0x0b, 0x8105);
+	phy_write(dev, 0x0c, 0x0000);
+
+	/* max rx/tx clock delay, min rx/tx control delay */
+	phy_write(dev, 0x0b, 0x8104);
+	phy_write(dev, 0x0c, 0xf0f0);
+	phy_write(dev, 0x0b, 0x104);
+
+	return 0;
+}
+
+static int udoo_ksz9021rn_setup(void)
+{
+	mxc_iomux_v3_setup_multiple_pads(udoo_enet_gpio_pads_1,
+			ARRAY_SIZE(udoo_enet_gpio_pads_1));
+
+	gpio_direction_output( IMX_GPIO_NR( 2 , 31 ) , 1 ); /* Power on enet */
+
+	/* MODE strap-in pins: advertise all capabilities */
+	gpio_direction_output(185, 1); /* GPIO 6-25 */
+	gpio_direction_output(187, 1); /* GPIO 6-27 */

arch/arm/boards/udoo/board.c line 127

Quoted 10 lines
arch/arm/boards/udoo/board.c new file +10 -0
+	gpio_direction_output(188, 1); /* GPIO 6-28*/
+	gpio_direction_output(189, 1); /* GPIO 6-29 */
+
+	/* Enable 125 MHz clock output */
+    gpio_direction_output(184, 1); /* GPIO 6-24 */
+
+	mdelay(10);
+
+	mdelay( 100 );
+

Why the double delay? Is it needed? If yes, please coalesce into one statement.

Quoted 10 lines
arch/arm/boards/udoo/board.c new file +10 -0
+	gpio_free(IMX_GPIO_NR(6, 24));
+	gpio_free(IMX_GPIO_NR(6, 25));
+	gpio_free(IMX_GPIO_NR(6, 27));
+	gpio_free(IMX_GPIO_NR(6, 28));
+	gpio_free(IMX_GPIO_NR(6, 29));
+
+	mxc_iomux_v3_setup_multiple_pads(udoo_enet_gpio_pads_2, ARRAY_SIZE(udoo_enet_gpio_pads_2));
+
+	return 0;
+}

[...]

arch/arm/boards/udoo/board.c line 174

Quoted 9 lines
arch/arm/boards/udoo/board.c new file +9 -0
+
+static void udoo_epit_init( void )
+{
+
+	writel( 0x0000000 , 0x20D0000 );
+	writel( 0x142000F , 0x20D0000 );
+	writel( 0x10000 , 0x20D0008 );
+	writel( 0x0 , 0x20D000C );
+}

Whitespace.

arch/arm/boards/udoo/board.c line 187

Quoted 13 lines
arch/arm/boards/udoo/board.c new file +13 -0
+
+static int udoo_devices_init(void)
+{
+	if (!of_machine_is_compatible("fsl,imx6q-udoo"))
+		return 0;
+
+	setup_iomux_wdog();
+	udoo_ehci_init();
+	udoo_epit_init();
+
+	armlinux_set_bootparams((void *)0x10000100);
+	armlinux_set_architecture(4772);
+

This machine ID is registered as "i.mx6 Clous". I don't think this is equal to the board you are adding here.
Do you even need the machine ID, or is your board DT enabled in the linux kernel. If so, please remove this code.

[...]

arch/arm/configs/udoo_quad_defconfig

Quoted 6 lines
arch/arm/configs/udoo_quad_defconfig new file +0 -0
new file mode 100644
index 0000000..880318f
@@ -0,0 +1,86 @@

You are adding a multi-image board, please don't add a separate defconfig, but instead add the board and maybe required options to the imx_v7_defconfig.

Regards,
Lucas

Signature · 10 lines
Pengutronix e.K.                           | Lucas Stach                 |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-5076 |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox