Skip to contentSkip to conversation

ahs2: initial support

PATCH In review Holger Schurig 2 participants 4 messages May 15, 2014 – May 16, 2014

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

PATCH v2 1/1 ahs2: initial support

From: Holger Schurig <[email protected]>

---
v2: moved the init script into the (currently empty) bin/ directory

 arch/arm/boards/Makefile                      |    1 +
 arch/arm/boards/ahs2/Makefile                 |    3 +
 arch/arm/boards/ahs2/board.c                  |   47 +++
 arch/arm/boards/ahs2/env/bin/init             |    1 +
 arch/arm/boards/ahs2/flash-header-ahs2.imxcfg |  232 ++++++++++++++
 arch/arm/boards/ahs2/lowlevel.c               |   73 +++++
 arch/arm/configs/imx_v7_defconfig             |    1 +
 arch/arm/dts/Makefile                         |    4 +-
 arch/arm/dts/imx6q-ahs2.dts                   |  405 +++++++++++++++++++++++++
 arch/arm/mach-imx/Kconfig                     |    4 +
 images/Makefile.imx                           |    5 +
 11 files changed, 775 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boards/ahs2/Makefile
 create mode 100644 arch/arm/boards/ahs2/board.c
 create mode 100644 arch/arm/boards/ahs2/env/bin/init
 create mode 100644 arch/arm/boards/ahs2/flash-header-ahs2.imxcfg
 create mode 100644 arch/arm/boards/ahs2/lowlevel.c
 create mode 100644 arch/arm/dts/imx6q-ahs2.dts
arch/arm/boards/Makefile +1 -0
index ae01b29..85eba47 100644
@@ -1,4 +1,5 @@
 # keep sorted by CONFIG_* macro name.
+obj-$(CONFIG_MACH_AHS2)				+= ahs2/
 obj-$(CONFIG_MACH_ANIMEO_IP)			+= animeo_ip/
 obj-$(CONFIG_MACH_ARCHOSG9)			+= archosg9/
 obj-$(CONFIG_MACH_AT91SAM9260EK)		+= at91sam9260ek/
arch/arm/boards/ahs2/Makefile new file +3 -0
new file mode 100644
index 0000000..a7e336b
@@ -0,0 +1,3 @@
+obj-y += board.o flash-header-ahs2.dcd.o
+extra-y += flash-header-ahs2.dcd.S flash-header-ahs2.dcd
+lwl-y += lowlevel.o
arch/arm/boards/ahs2/board.c new file +47 -0

47 lines not on this page · raw message

arch/arm/boards/ahs2/env/bin/init new file +1 -0
new file mode 100644
index 0000000..1a24852
@@ -0,0 +1 @@
+#!/bin/sh
arch/arm/boards/ahs2/flash-header-ahs2.imxcfg new file +232 -0

232 lines not on this page · raw message

arch/arm/boards/ahs2/lowlevel.c new file +73 -0

73 lines not on this page · raw message

arch/arm/configs/imx_v7_defconfig +1 -0
index 0c32d7d..e5cbc25 100644
@@ -1,5 +1,6 @@
 CONFIG_ARCH_IMX=y
 CONFIG_IMX_MULTI_BOARDS=y
+CONFIG_MACH_AHS2=y
 CONFIG_MACH_EFIKA_MX_SMARTBOOK=y
 CONFIG_MACH_FREESCALE_MX51_PDK=y
 CONFIG_MACH_FREESCALE_MX53_LOCO=y
arch/arm/dts/Makefile +3 -1
index 63d59f7..e6d46e1 100644
@@ -10,7 +10,8 @@ dtb-$(CONFIG_ARCH_IMX53) += imx53-mba53.dtb \
 	imx53-qsb.dtb \
 	imx53-qsrb.dtb \
 	imx53-voipac-bsb.dtb
-dtb-$(CONFIG_ARCH_IMX6) += imx6q-gk802.dtb \
+dtb-$(CONFIG_ARCH_IMX6) += imx6q-ahs2.dtb \
+	imx6q-gk802.dtb \
 	imx6dl-dfi-fs700-m60-6s.dtb \
 	imx6q-dfi-fs700-m60-6q.dtb \
 	imx6q-dmo-edmqmx6.dtb \
@@ -52,6 +53,7 @@ pbl-$(CONFIG_MACH_DFI_FS700_M60) += imx6q-dfi-fs700-m60-6q.dtb.o imx6dl-dfi-fs70
 pbl-$(CONFIG_MACH_NVIDIA_BEAVER) += tegra30-beaver.dtb.o
 pbl-$(CONFIG_MACH_PCM051) += am335x-phytec-phycore.dtb.o
 pbl-$(CONFIG_MACH_PHYTEC_PFLA02) += imx6s-phytec-pbab01.dtb.o imx6dl-phytec-pbab01.dtb.o imx6q-phytec-pbab01.dtb.o
+pbl-$(CONFIG_MACH_AHS2) += imx6q-ahs2.dtb.o
 pbl-$(CONFIG_MACH_REALQ7) += imx6q-dmo-edmqmx6.dtb.o
 pbl-$(CONFIG_MACH_SOLIDRUN_CUBOX) += dove-cubox-bb.dtb.o
 pbl-$(CONFIG_MACH_GK802) += imx6q-gk802.dtb.o
arch/arm/dts/imx6q-ahs2.dts new file +405 -0

405 lines not on this page · raw message

arch/arm/mach-imx/Kconfig +4 -0
index 3b85f45..d9805a7 100644
@@ -246,6 +246,10 @@ config MACH_TQMA6X
 	bool "TQ tqma6x on mba6x"
 	select ARCH_IMX6
 
+config MACH_AHS2
+	bool "Advantech DLoG AHS2"
+	select ARCH_IMX6
+
 config MACH_SABRELITE
 	bool "Freescale i.MX6 Sabre Lite"
 	select ARCH_IMX6
images/Makefile.imx +5 -0
index 5085a55..b5a7cd0 100644
@@ -61,6 +61,11 @@ FILE_barebox-tq-mba53-1gib.img = start_imx53_mba53_1gib.pblx.imximg
 image-$(CONFIG_MACH_TQMA53) += barebox-tq-mba53-1gib.img
 
 # ----------------------- i.MX6 based boards ---------------------------
+pblx-$(CONFIG_MACH_AHS2) += start_imx6q_ahs2
+CFG_start_imx6q_ahs2.pblx.imximg = $(board)/ahs2/flash-header-ahs2.imxcfg
+FILE_barebox-ahs2.img = start_imx6q_ahs2.pblx.imximg
+image-$(CONFIG_MACH_AHS2) += barebox-ahs2.img
+
 pblx-$(CONFIG_MACH_REALQ7) += start_imx6_realq7
 CFG_start_imx6_realq7.pblx.imximg = $(board)/datamodul-edm-qmx6/flash-header.imxcfg
 FILE_barebox-datamodul-edm-qmx6.img = start_imx6_realq7.pblx.imximg
Signature · 7 lines
1.7.10.4


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

Hi Holger,

Quoted 11 lines · Holger Schurig

From: Holger Schurig <[email protected]>

---
v2: moved the init script into the (currently empty) bin/ directory

 arch/arm/boards/Makefile                      |    1 +
 arch/arm/boards/ahs2/Makefile                 |    3 +
 arch/arm/boards/ahs2/board.c                  |   47 +++
 arch/arm/boards/ahs2/env/bin/init             |    1 +

This file is currently not compiled in. You can either remove it in case you don't need it, or move the env/ directory in your board file to defaultenv-ahs2/, add to the make rules:

bbenv-y += defaultenv-ahs2

And in some initcall do:

defaultenv_append_directory(defaultenv_ahs2);

This way the ahs2 specific files will be in the environment exactly when the binary is started on your board.

Quoted 63 lines
 arch/arm/boards/ahs2/flash-header-ahs2.imxcfg |  232 ++++++++++++++
 arch/arm/boards/ahs2/lowlevel.c               |   73 +++++
 arch/arm/configs/imx_v7_defconfig             |    1 +
 arch/arm/dts/Makefile                         |    4 +-
 arch/arm/dts/imx6q-ahs2.dts                   |  405 +++++++++++++++++++++++++
 arch/arm/mach-imx/Kconfig                     |    4 +
 images/Makefile.imx                           |    5 +
 11 files changed, 775 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boards/ahs2/Makefile
 create mode 100644 arch/arm/boards/ahs2/board.c
 create mode 100644 arch/arm/boards/ahs2/env/bin/init
 create mode 100644 arch/arm/boards/ahs2/flash-header-ahs2.imxcfg
 create mode 100644 arch/arm/boards/ahs2/lowlevel.c
 create mode 100644 arch/arm/dts/imx6q-ahs2.dts
arch/arm/boards/Makefile +1 -0
index ae01b29..85eba47 100644
@@ -1,4 +1,5 @@
 # keep sorted by CONFIG_* macro name.
+obj-$(CONFIG_MACH_AHS2)				+= ahs2/
 obj-$(CONFIG_MACH_ANIMEO_IP)			+= animeo_ip/
 obj-$(CONFIG_MACH_ARCHOSG9)			+= archosg9/
 obj-$(CONFIG_MACH_AT91SAM9260EK)		+= at91sam9260ek/
arch/arm/boards/ahs2/Makefile new file +3 -0
new file mode 100644
index 0000000..a7e336b
@@ -0,0 +1,3 @@
+obj-y += board.o flash-header-ahs2.dcd.o
+extra-y += flash-header-ahs2.dcd.S flash-header-ahs2.dcd
+lwl-y += lowlevel.o
arch/arm/boards/ahs2/board.c new file +23 -0
new file mode 100644
index 0000000..8dfa5f3
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2014 Holger Schurig, Advantech DLoG GmbH, Germering, Germany
+ *
+ * based on arch/arm/boards/freescale-mx6-arm2/board.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * (setq compile-command "make -C ~/d/mkarm compbb")
+ */
+
+#include <common.h>
+#include <sizes.h>
+#include <init.h>
+#include <asm/armlinux.h>
+#include <mach/imx6.h>

arch/arm/boards/ahs2/board.c line 33

Quoted 10 lines
arch/arm/boards/ahs2/board.c new file +10 -0
+
+
+static int ahs2_device_init(void)
+{
+	if (!of_machine_is_compatible("dlog,ahs2"))
+		return 0;
+
+	return 0;
+}
+device_initcall(ahs2_device_init);

Nothing done here? Please remove.

arch/arm/boards/ahs2/board.c line 38

Quoted 5 lines
arch/arm/boards/ahs2/board.c new file +5 -0
+static inline void early_uart1_init(void)
+{
+	// 2681: IOMUXC_UART1_UART_RX_DATA_SELECT_INPUT to ALT1 (CSI0_DATA10_ALT3 )
+	// 2621: IOMUXC_ECSPI2_MISO_SELECT_INPUT to ALT2 (CSI0_DATA10_ALT2)
+	// 2092: IOMUXC_SW_MUX_CTL_PAD_CSI0_DATA10 to ALT3 (UART1_TX_DATA)

What are these numbers?

Please replace with /* C comments */

arch/arm/boards/ahs2/board.c

Quoted 13 lines
arch/arm/boards/ahs2/board.c new file +13 -0
+ENTRY_FUNCTION(start_imx6q_ahs2, r0, r1, r2)
+{
+	void  *fdt;
+
+	arm_cpu_lowlevel_init();
+
+#if 0
+	{
+		int i;
+		for (i = 0x68; i <= 0x80; i += 4)
+			writel(0xffffffff, MX6_CCM_BASE_ADDR + i);
+	}
+#endif

This is done in the clock driver and can probably be removed.

arch/arm/boards/ahs2/board.c

Quoted 8 lines
arch/arm/boards/ahs2/board.c new file +8 -0
+
+/ {
+	model = "Advantech DLoG AHS2";
+	compatible = "dlog,ahs2", "fsl,imx6q";
+
+	chosen {
+		stdout-path = &uart1;
+		bootargs = "console=ttymxc1,115200";

These are replaced anyway, you can remove this line.

arch/arm/boards/ahs2/board.c

Quoted 12 lines
arch/arm/boards/ahs2/board.c new file +12 -0
+
+		/*
+		environment@0 {
+			compatible = "barebox,environment";
+			device-path = &flash, "partname:barebox-environment";
+		};
+		*/
+	};
+
+	aliases {
+		ethernet0 = &fec;
+	};

Could you add this to the imx6qdl.dtsi file instead? Normally this should be in the upstream dtsi file, but as long as it isn't we can keep it in barebox.

arch/arm/boards/ahs2/board.c

Quoted 13 lines
arch/arm/boards/ahs2/board.c new file +13 -0
+/* LAN1, Schematics sheet 24 */
+&fec {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_fec>;
+	phy-mode = "rmii";
+	phy-reset-gpios = <&gpio2 4 GPIO_ACTIVE_LOW>;
+	phy-handle = <&phy>;
+	status = "okay";
+
+	phy: ethernet-phy@0 {
+		speed = <10>;
+		duplex = <1>;
+	};

speed 10? really?

Is there code using this binding or is it approved upstream?

Sascha

Signature · 9 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 |

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

This file is currently not compiled in.

I know, because I current environment have my own _defconfig still as a quilt-patch. It's local, because it contains hardcoded the IP address of my development box for TFTP, for example. I thought that I put up the real environment once I'm able to decide about the final environment.

Quoted 4 lines

You can either remove it in case
you don't need it, or move the env/ directory in your board file to defaultenv-ahs2/, add to the make rules:

Quoted 8 lines

bbenv-y += defaultenv-ahs2

And in some initcall do:

defaultenv_append_directory(defaultenv_ahs2);

This way the ahs2 specific files will be in the environment exactly when the binary is started on your board.

Good to know. But, as said, currently I cannot do this. After all, this is an "initial support" patch.

Quoted 7 lines

arch/arm/boards/ahs2/lowlevel.c line 14

Quoted 5 lines
arch/arm/boards/ahs2/lowlevel.c new file +5 -0
+static inline void early_uart1_init(void)
+{
+     // 2681: IOMUXC_UART1_UART_RX_DATA_SELECT_INPUT to ALT1 (CSI0_DATA10_ALT3 )
+     // 2621: IOMUXC_ECSPI2_MISO_SELECT_INPUT to ALT2 (CSI0_DATA10_ALT2)
+     // 2092: IOMUXC_SW_MUX_CTL_PAD_CSI0_DATA10 to ALT3 (UART1_TX_DATA)

What are these numbers?

The page numbers in the i.MX6 reference manual :-)

Quoted 1 line

Please replace with /* C comments */

Sigh, we still aren't in the year 2014 ?!?!? Somehow this "no //"
reminds me that the other day a collegue of me asked me to set the baudrate to 38400 :-)

And while at it: may I suggest that barebox switches to C99? Thould
would also liberate the placement of variable definitions ...

Quoted 5 lines

arch/arm/dts/imx6q-ahs2.dts line 25

Quoted 3 lines
arch/arm/dts/imx6q-ahs2.dts new file +3 -0
+     aliases {
+             ethernet0 = &fec;
+     };

Could you add this to the imx6qdl.dtsi file instead?

Sure, I actually don't even know if it is needed. I took it via cut-and-paste.

Quoted 2 lines

Normally this should be in the upstream dtsi file, but as long as it isn't we can keep it in barebox.

I'll look if it is needed, and if yes, I'll put it in the dtsi file.

Quoted 6 lines

arch/arm/dts/imx6q-ahs2.dts line 45

Quoted 4 lines
arch/arm/dts/imx6q-ahs2.dts new file +4 -0
+     phy: ethernet-phy@0 {
+             speed = <10>;
+             duplex = <1>;
+     };

speed 10? really?

Now, there are two reasons why I tried this:

* our hardware guys had an error on our layout (wrong resistors). I should have removed that, my board is now fixed.

* currently, the most time consuming operation in in my barebox-loads-linux-via-TFTP is the autonegotiation of the PHY. After "ifup eth0" a "time ping 10.1.2.3" reports 4580ms. Transfers after that are fast enought. My attempt was a try to use some fixes speed, even a slow one.

But I now grepped for "of_" below drivers/net, I actually think that neiher fec_imx.c nor phy/smsc.c cares for device tree settings.

Do you have any idea on how to speed up auto-negotiation?

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

maintainer
#3 lore raw
Quoted 37 lines · Holger Schurig
Quoted 1 line

This file is currently not compiled in.

I know, because I current environment have my own _defconfig still as a quilt-patch. It's local, because it contains hardcoded the IP address of my development box for TFTP, for example. I thought that I put up the real environment once I'm able to decide about the final environment.

Quoted 4 lines

You can either remove it in case
you don't need it, or move the env/ directory in your board file to defaultenv-ahs2/, add to the make rules:

Quoted 8 lines

bbenv-y += defaultenv-ahs2

And in some initcall do:

defaultenv_append_directory(defaultenv_ahs2);

This way the ahs2 specific files will be in the environment exactly when the binary is started on your board.

Good to know. But, as said, currently I cannot do this. After all, this is an "initial support" patch.

Quoted 7 lines

arch/arm/boards/ahs2/lowlevel.c line 14

Quoted 5 lines
arch/arm/boards/ahs2/lowlevel.c new file +5 -0
+static inline void early_uart1_init(void)
+{
+     // 2681: IOMUXC_UART1_UART_RX_DATA_SELECT_INPUT to ALT1 (CSI0_DATA10_ALT3 )
+     // 2621: IOMUXC_ECSPI2_MISO_SELECT_INPUT to ALT2 (CSI0_DATA10_ALT2)
+     // 2092: IOMUXC_SW_MUX_CTL_PAD_CSI0_DATA10 to ALT3 (UART1_TX_DATA)

What are these numbers?

The page numbers in the i.MX6 reference manual :-)

Quoted 5 lines
Quoted 1 line

Please replace with /* C comments */

Sigh, we still aren't in the year 2014 ?!?!? Somehow this "no //"
reminds me that the other day a collegue of me asked me to set the baudrate to 38400 :-)

I also use // comments: To indicate places I have revisit.

Quoted 3 lines

And while at it: may I suggest that barebox switches to C99? Thould
would also liberate the placement of variable definitions ...

We use Kernel coding style in barebox which makes it very easy for us to get consistent looking code (and to integrate kernel code). Also it makes for code which is easy to read and understand for people coming from the kernel area which I assume most of the barebox people do. I may change my mind some day, but that requires much more nagging from more people ;)

Quoted 7 lines
Quoted 5 lines

arch/arm/dts/imx6q-ahs2.dts line 25

Quoted 3 lines
arch/arm/dts/imx6q-ahs2.dts new file +3 -0
+     aliases {
+             ethernet0 = &fec;
+     };

Could you add this to the imx6qdl.dtsi file instead?

Sure, I actually don't even know if it is needed. I took it via cut-and-paste.

Looking at it you shouldn't need it. barebox eventually uses this to find the device_node corresponding to eth0 and fills in the MAC address into this node so that Linux finds it.
This is only needed when barebox probes from platform_devices, but passes a devicetree to the kernel. This happens on PowerPC, but not on your hardware.

Quoted 25 lines
Quoted 3 lines

Normally this should be in the upstream dtsi file, but as long as it isn't we can keep it in barebox.

I'll look if it is needed, and if yes, I'll put it in the dtsi file.

Quoted 6 lines

arch/arm/dts/imx6q-ahs2.dts line 45

Quoted 4 lines
arch/arm/dts/imx6q-ahs2.dts new file +4 -0
+     phy: ethernet-phy@0 {
+             speed = <10>;
+             duplex = <1>;
+     };

speed 10? really?

Now, there are two reasons why I tried this:

* our hardware guys had an error on our layout (wrong resistors). I should have removed that, my board is now fixed.

* currently, the most time consuming operation in in my barebox-loads-linux-via-TFTP is the autonegotiation of the PHY. After "ifup eth0" a "time ping 10.1.2.3" reports 4580ms. Transfers after that are fast enought. My attempt was a try to use some fixes speed, even a slow one.

Quoted 4 lines

But I now grepped for "of_" below drivers/net, I actually think that neiher fec_imx.c nor phy/smsc.c cares for device tree settings.

Do you have any idea on how to speed up auto-negotiation?

No idea. It takes around 4s here aswell.

You could support Thomas Petazzonis dt-support-for-fixed-phys series:

http://www.spinics.net/lists/arm-kernel/msg312758.html

Then at least we would have a binding to describe phys via dt.

Sascha

Signature · 9 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 |

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