Skip to contentSkip to conversation

ARM: mx6: Add support for Kosagi Novena

PATCH Superseded Marek Vasut 3 participants 16 messages Sep 23, 2014 – Oct 9, 2014

Subsystems (2)

v4 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 ARM: mx6: Add support for Kosagi Novena

Add support for the Kosagi Novena board. Currently supported are:
- I2C busses
- FEC Ethernet
- MMC0, MMC1, Booting from MMC
- SATA
- USB ports
- USB Ethernet

---
 arch/arm/Kconfig                 |   4 +
 board/kosagi/novena/Kconfig      |  23 ++
 board/kosagi/novena/Makefile     |  11 +
 board/kosagi/novena/novena.c     | 348 +++++++++++++++++++++++++
 board/kosagi/novena/novena_spl.c | 545 +++++++++++++++++++++++++++++++++++++++
 board/kosagi/novena/setup.cfg    |  47 ++++
 configs/novena_defconfig         |   4 +
 include/configs/imx6_spl.h       |   2 +-
 include/configs/novena.h         | 303 ++++++++++++++++++++++
 9 files changed, 1286 insertions(+), 1 deletion(-)
 create mode 100644 board/kosagi/novena/Kconfig
 create mode 100644 board/kosagi/novena/Makefile
 create mode 100644 board/kosagi/novena/novena.c
 create mode 100644 board/kosagi/novena/novena_spl.c
 create mode 100644 board/kosagi/novena/setup.cfg
 create mode 100644 configs/novena_defconfig
 create mode 100644 include/configs/novena.h

V2: - Drop the tegra_keyboard_init() comment altogether
- Immediatelly return from the SD controller probe function on failure
- Rename PFUZE100_PMIC to just PFUZE100
- Fix the IMX OTP support with CMD_FUSE
- Enabling LVDS clock is still in place, since this is coming soon.
V3: - Zap rootpath builtin env
V4: - Zap the checkpatch issues
- Update comments

arch/arm/Kconfig +4 -0
index 106aed9..4da1923 100644
@@ -411,6 +411,9 @@ config TARGET_GW_VENTANA
 config TARGET_HUMMINGBOARD
 	bool "Support hummingboard"
 
+config TARGET_KOSAGI_NOVENA
+	bool "Support Kosagi Novena"
+
 config TARGET_TQMA6
 	bool "TQ Systems TQMa6 board"
 
@@ -637,6 +640,7 @@ source "board/imx31_phycore/Kconfig"
 source "board/isee/igep0033/Kconfig"
 source "board/jornada/Kconfig"
 source "board/karo/tx25/Kconfig"
+source "board/kosagi/novena/Kconfig"
 source "board/logicpd/imx27lite/Kconfig"
 source "board/logicpd/imx31_litekit/Kconfig"
 source "board/mpl/vcma9/Kconfig"
board/kosagi/novena/Kconfig new file +23 -0
new file mode 100644
index 0000000..4e52be9
@@ -0,0 +1,23 @@
+if TARGET_KOSAGI_NOVENA
+
+config SYS_CPU
+	string
+	default "armv7"
+
+config SYS_BOARD
+	string
+	default "novena"
+
+config SYS_VENDOR
+	string
+	default "kosagi"
+
+config SYS_SOC
+	string
+	default "mx6"
+
+config SYS_CONFIG_NAME
+	string
+	default "novena"
+
+endif
board/kosagi/novena/Makefile new file +11 -0
new file mode 100644
index 0000000..6fba177
@@ -0,0 +1,11 @@
+#
+# Copyright (C) 2014 Marek Vasut <[email protected]>
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+ifdef CONFIG_SPL_BUILD
+obj-y	:= novena_spl.o
+else
+obj-y	:= novena.o
+endif
board/kosagi/novena/novena.c new file +348 -0

348 lines not on this page · raw message

board/kosagi/novena/novena_spl.c new file +545 -0

545 lines not on this page · raw message

board/kosagi/novena/setup.cfg new file +47 -0

47 lines not on this page · raw message

configs/novena_defconfig new file +4 -0
new file mode 100644
index 0000000..a560afb
@@ -0,0 +1,4 @@
+CONFIG_SPL=y
+CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/kosagi/novena/setup.cfg,MX6Q,SPL"
++S:CONFIG_ARM=y
++S:CONFIG_TARGET_KOSAGI_NOVENA=y
include/configs/imx6_spl.h +1 -1
index 970460d..52fe9cf 100644
@@ -27,7 +27,7 @@
 #define CONFIG_SYS_THUMB_BUILD
 #define CONFIG_SPL_LDSCRIPT	"arch/arm/cpu/armv7/omap-common/u-boot-spl.lds"
 #define CONFIG_SPL_TEXT_BASE		0x00908000
-#define CONFIG_SPL_MAX_SIZE		(64 * 1024)
+#define CONFIG_SPL_MAX_SIZE		0x10000
 #define CONFIG_SPL_START_S_PATH		"arch/arm/cpu/armv7"
 #define CONFIG_SPL_STACK		0x0091FFB8
 #define CONFIG_SPL_LIBCOMMON_SUPPORT
include/configs/novena.h new file +303 -0

303 lines not on this page · raw message

Signature · 1 line
2.1.0
#1 lore raw

PATCH v4 1/1 ARM: mx6: Add support for Kosagi Novena

Hi Marek,

Some comments about SPI:

Quoted 10 lines · Marek Vasut
board/kosagi/novena/novena_spl.c new file +10 -0
+/*
+ * SPI
+ */
+#ifdef CONFIG_MXC_SPI
+static iomux_v3_cfg_t ecspi1_pads[] = {
+	/* SS1 */
+	MX6_PAD_EIM_D19__GPIO3_IO19   | MUX_PAD_CTRL(SPI_PAD_CTRL),
+	MX6_PAD_EIM_D17__ECSPI1_MISO | MUX_PAD_CTRL(SPI_PAD_CTRL),
+	MX6_PAD_EIM_D18__ECSPI1_MOSI | MUX_PAD_CTRL(SPI_PAD_CTRL),
+	MX6_PAD_EIM_D16__ECSPI1_SCLK | MUX_PAD_CTRL(SPI_PAD_CTRL),

board/kosagi/novena/novena_spl.c line 304

Quoted 10 lines
board/kosagi/novena/novena_spl.c new file +10 -0
+};
+
+static void novena_spl_setup_iomux_spi(void)
+{
+	imx_iomux_v3_setup_multiple_pads(ecspi1_pads, ARRAY_SIZE(ecspi1_pads));
+	gpio_direction_output(CONFIG_SF_DEFAULT_CS, 1);
+}
+#else
+static void novena_spl_setup_iomux_spi(void) {}
+#endif

I checked the schematic and didn't saw any usage of ECSPI1. In addition, these pads (EIM D16/17/18/19) are used by other interfaces. Can you please also double-check this?

Kind regards,
Nikolay

#2 lore raw

PATCH v4 1/1 ARM: mx6: Add support for Kosagi Novena

Quoted 21 lines · Nikolay Dimitrov

Hi Marek,

Some comments about SPI:

Quoted 16 lines · Marek Vasut
board/kosagi/novena/novena_spl.c new file +16 -0
+/*
+ * SPI
+ */
+#ifdef CONFIG_MXC_SPI
+static iomux_v3_cfg_t ecspi1_pads[] = {
+	/* SS1 */
+	MX6_PAD_EIM_D19__GPIO3_IO19   | MUX_PAD_CTRL(SPI_PAD_CTRL),
+	MX6_PAD_EIM_D17__ECSPI1_MISO | MUX_PAD_CTRL(SPI_PAD_CTRL),
+	MX6_PAD_EIM_D18__ECSPI1_MOSI | MUX_PAD_CTRL(SPI_PAD_CTRL),
+	MX6_PAD_EIM_D16__ECSPI1_SCLK | MUX_PAD_CTRL(SPI_PAD_CTRL),
+};
+
+static void novena_spl_setup_iomux_spi(void)
+{
+	imx_iomux_v3_setup_multiple_pads(ecspi1_pads, ARRAY_SIZE(ecspi1_pads));
+	gpio_direction_output(CONFIG_SF_DEFAULT_CS, 1);
Quoted 8 lines

board/kosagi/novena/novena_spl.c line 304

Quoted 4 lines
board/kosagi/novena/novena_spl.c new file +4 -0
+}
+#else
+static void novena_spl_setup_iomux_spi(void) {}
+#endif

I checked the schematic and didn't saw any usage of ECSPI1. In addition, these pads (EIM D16/17/18/19) are used by other interfaces. Can you please also double-check this?

Good find, I'll zap this part. Sean, why was this in the original Novena U-Boot source?

Also, can you please review the entire thing so I don't have to retest and resend the patch every day with one minor modification each time?

Thanks

Best regards,
Marek Vasut

#3 lore raw

PATCH v4 1/1 ARM: mx6: Add support for Kosagi Novena

Hi Marek,

Quoted 3 lines · Marek Vasut

Also, can you please review the entire thing so I don't have to retest and resend the patch every day with one minor modification each time? Thanks Best regards, Marek Vasut

Sorry about that :(. I definitely understand. Unfortunately it just happens that I have limited hours to help mostly during the night, so I decided to send immediately my findings instead of keeping them for myself for days/weeks. I'll definitely consider your request for my next comments.

Kind regards,
Nikolay

#4 lore raw

PATCH v4 1/1 ARM: mx6: Add support for Kosagi Novena

Quoted 7 lines · Nikolay Dimitrov

Hi Marek,

Quoted 3 lines · Marek Vasut

Also, can you please review the entire thing so I don't have to retest and resend the patch every day with one minor modification each time? Thanks Best regards, Marek Vasut

Quoted 5 lines

Sorry about that :(. I definitely understand. Unfortunately it just happens that I have limited hours to help mostly during the night, so I decided to send immediately my findings instead of keeping them for myself for days/weeks. I'll definitely consider your request for my next comments.

Thanks, please put together one consistent email so I can address all the stuff in bulk.

Best regards,
Marek Vasut

#5 lore raw

PATCH v4 1/1 ARM: mx6: Add support for Kosagi Novena

In reply to Marek Vasut

Hi Marek,

Following are some comments about FEC Ethernet:

board/kosagi/novena/novena_spl.c line 43

Quoted 5 lines · Marek Vasut
board/kosagi/novena/novena_spl.c new file +5 -0
+#define ENET_PAD_CTRL						\
+	(PAD_CTL_PKE | PAD_CTL_PUE |				\
+	PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED	  |		\
+	PAD_CTL_DSE_40ohm   | PAD_CTL_HYS)
+

PAD_CTL_SPEED_MED falls on reserved bits (7-6).

Special note: PAD_CTL_DSE_40ohm is defined as 0b110, which is documented as "37/27 ohm @2.5V". I didn't saw any notes on the PHY spec or the Novena schematic about the routing guidelines of the RGMII data lines, but I can extrapolate that if the 125 MHz reference clock is routed as 50-ohm line (this one is documented in the datasheet), then the data lines are probably routed in a similar way. So the DSE value should be 0b100, which is "57/43 ohm @ 2.5V", which in turn is defined in the headers as PAD_CTL_DSE_60ohm (this is either a bug in the header, or I'm reading an updated FSL PDF).

board/kosagi/novena/novena_spl.c line 133

Quoted 13 lines
board/kosagi/novena/novena_spl.c new file +13 -0
+static void novena_spl_setup_iomux_enet(void)
+{
+	imx_iomux_v3_setup_multiple_pads(enet_pads1, ARRAY_SIZE(enet_pads1));
+	imx_iomux_v3_setup_multiple_pads(enet_pads2, ARRAY_SIZE(enet_pads2));
+
+	gpio_direction_output(IMX_GPIO_NR(3, 23), 0);
+	gpio_direction_output(IMX_GPIO_NR(6, 30), 1);
+	gpio_direction_output(IMX_GPIO_NR(6, 25), 1);
+	gpio_direction_output(IMX_GPIO_NR(6, 27), 1);
+	gpio_direction_output(IMX_GPIO_NR(6, 28), 1);
+	gpio_direction_output(IMX_GPIO_NR(6, 29), 1);
+	gpio_direction_output(IMX_GPIO_NR(6, 24), 1);
+}

I think that setting the iomuxes immediately one after the other doesn't achieve the intended goal. After the 2nd iomux setup, the pads are connected to the FEC, not to the GPIOs.

There's one more issue here - when you get the PHY out of reset, you'll have to both de-assert the RESET line while keeping the strapping signals stable so the PHY can read them, but at the same time the PHY RX pins are becoming outputs and driving the same lines, which is not good. I'm giving a proposal how to fix this in the end.

board/kosagi/novena/novena.c line 243

Quoted 11 lines
board/kosagi/novena/novena.c new file +11 -0
+int board_early_init_f(void)
+{
+#if defined(CONFIG_VIDEO_IPUV3)
+	setup_display();
+#endif
+
+	/* Bring Ethernet PHY out of reset. */
+	gpio_set_value(IMX_GPIO_NR(3, 23), 1);
+
+	return 0;
+}

Getting the PHY out of reset at this point causes unpredictable reset timing - e.g. you can't guarantee how much time the chip was held in reset. The PHY datasheet is quite unclear about this reset timing, the only mentioned time is min. 10ms after power-on, and nothing about RESET assertion/de-assertion. I can throw a wild guess that the reset pulse should have similar duration, e.g. 10ms.

Here's my proposal how to fix both (line driving conflict and reset timing) issues:

#define ENET_PHY_CFG_PC \
	(PAD_CTL_HYS | PAD_CTL_PUS_22K_UP | PAD_CTL_PUE | PAD_CTL_PKE)
static iomux_v3_cfg_t enet_pads1[] = {
	MX6_PAD_ENET_MDIO__ENET_MDIO	| MUX_PAD_CTRL(ENET_PAD_CTRL),
	MX6_PAD_ENET_MDC__ENET_MDC	| MUX_PAD_CTRL(ENET_PAD_CTRL),

	MX6_PAD_RGMII_TXC__RGMII_TXC	| MUX_PAD_CTRL(ENET_PAD_CTRL),
	MX6_PAD_RGMII_TD0__RGMII_TD0	| MUX_PAD_CTRL(ENET_PAD_CTRL),
	MX6_PAD_RGMII_TD1__RGMII_TD1	| MUX_PAD_CTRL(ENET_PAD_CTRL),
	MX6_PAD_RGMII_TD2__RGMII_TD2	| MUX_PAD_CTRL(ENET_PAD_CTRL),
	MX6_PAD_RGMII_TD3__RGMII_TD3	| MUX_PAD_CTRL(ENET_PAD_CTRL),
	MX6_PAD_RGMII_TX_CTL__RGMII_TX_CTL| MUX_PAD_CTRL(ENET_PAD_CTRL),
	MX6_PAD_ENET_REF_CLK__ENET_TX_CLK | MUX_PAD_CTRL(ENET_PAD_CTRL),

	/* pin 35, PHY_AD2 */
	MX6_PAD_RGMII_RXC__GPIO6_IO30	| MUX_PAD_CTRL(ENET_PHY_CFG_PC),
	/* pin 32, MODE0 */
	MX6_PAD_RGMII_RD0__GPIO6_IO25	| MUX_PAD_CTRL(ENET_PHY_CFG_PC),
	/* pin 31, MODE1 */
	MX6_PAD_RGMII_RD1__GPIO6_IO27	| MUX_PAD_CTRL(ENET_PHY_CFG_PC),
	/* pin 28, MODE2 */
	MX6_PAD_RGMII_RD2__GPIO6_IO28	| MUX_PAD_CTRL(ENET_PHY_CFG_PC),
	/* pin 27, MODE3 */
	MX6_PAD_RGMII_RD3__GPIO6_IO29	| MUX_PAD_CTRL(ENET_PHY_CFG_PC),
	/* pin 33, CLK125_EN */
	MX6_PAD_RGMII_RX_CTL__GPIO6_IO24| MUX_PAD_CTRL(ENET_PHY_CFG_PC),

	/* PHY nRST */
	MX6_PAD_EIM_D23__GPIO3_IO23	| MUX_PAD_CTRL(NO_PAD_CTRL),
};

static void novena_spl_setup_iomux_enet(void)

{
	imx_iomux_v3_setup_multiple_pads(enet_pads1, ARRAY_SIZE(enet_pads1));

	/* Assert Ethernet PHY nRST */
	gpio_direction_output(IMX_GPIO_NR(3, 23), 0);

	/* Using imx6 internal pull-ups to drive PHY config pins during PHY 
reset */
	gpio_direction_input(IMX_GPIO_NR(6, 30)); /* PHY_AD2 = 1 */
	gpio_direction_input(IMX_GPIO_NR(6, 25)); /* MODE0 = 1 */
	gpio_direction_input(IMX_GPIO_NR(6, 27)); /* MODE1 = 1 */
	gpio_direction_input(IMX_GPIO_NR(6, 28)); /* MODE2 = 1 */
	gpio_direction_input(IMX_GPIO_NR(6, 29)); /* MODE3 = 1 */
	gpio_direction_input(IMX_GPIO_NR(6, 24)); /* CLK125_EN = 1 */

	/* Interpreting fig.8 from the PHY datasheet */
	mdelay(10);

	/* De-assert Ethernet PHY nRST */
	gpio_set_value(IMX_GPIO_NR(3, 23), 1);

	/* After PHY is configured, we can finally connect our FEC */
	imx_iomux_v3_setup_multiple_pads(enet_pads2, ARRAY_SIZE(enet_pads2));

	/* PHY datasheet recommends on p.53 to wait at least 100us before using 
MII, so we enforce this delay here */
	udelay(100);
}

And I would ditch the PHY un-reset code from board_early_init_f().

Please tell me what you think.

Kind regards,
Nikolay

#6 lore raw

PATCH v4 1/1 ARM: mx6: Add support for Kosagi Novena

Quoted 13 lines · Nikolay Dimitrov

Hi Marek,

Following are some comments about FEC Ethernet:

board/kosagi/novena/novena_spl.c line 43

Quoted 5 lines · Marek Vasut
board/kosagi/novena/novena_spl.c new file +5 -0
+#define ENET_PAD_CTRL						\
+	(PAD_CTL_PKE | PAD_CTL_PUE |				\
+	PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED	  |		\
+	PAD_CTL_DSE_40ohm   | PAD_CTL_HYS)
+

PAD_CTL_SPEED_MED falls on reserved bits (7-6).

Quoted 9 lines

Special note: PAD_CTL_DSE_40ohm is defined as 0b110, which is documented as "37/27 ohm @2.5V". I didn't saw any notes on the PHY spec or the Novena schematic about the routing guidelines of the RGMII data lines, but I can extrapolate that if the 125 MHz reference clock is routed as 50-ohm line (this one is documented in the datasheet), then the data lines are probably routed in a similar way. So the DSE value should be 0b100, which is "57/43 ohm @ 2.5V", which in turn is defined in the headers as PAD_CTL_DSE_60ohm (this is either a bug in the header, or I'm reading an updated FSL PDF).

Sean, can you comment on this ?

Quoted 108 lines

board/kosagi/novena/novena_spl.c line 133

Quoted 13 lines
board/kosagi/novena/novena_spl.c new file +13 -0
+static void novena_spl_setup_iomux_enet(void)
+{
+	imx_iomux_v3_setup_multiple_pads(enet_pads1, ARRAY_SIZE(enet_pads1));
+	imx_iomux_v3_setup_multiple_pads(enet_pads2, ARRAY_SIZE(enet_pads2));
+
+	gpio_direction_output(IMX_GPIO_NR(3, 23), 0);
+	gpio_direction_output(IMX_GPIO_NR(6, 30), 1);
+	gpio_direction_output(IMX_GPIO_NR(6, 25), 1);
+	gpio_direction_output(IMX_GPIO_NR(6, 27), 1);
+	gpio_direction_output(IMX_GPIO_NR(6, 28), 1);
+	gpio_direction_output(IMX_GPIO_NR(6, 29), 1);
+	gpio_direction_output(IMX_GPIO_NR(6, 24), 1);
+}

I think that setting the iomuxes immediately one after the other doesn't achieve the intended goal. After the 2nd iomux setup, the pads are connected to the FEC, not to the GPIOs.

There's one more issue here - when you get the PHY out of reset, you'll have to both de-assert the RESET line while keeping the strapping signals stable so the PHY can read them, but at the same time the PHY RX pins are becoming outputs and driving the same lines, which is not good. I'm giving a proposal how to fix this in the end.

board/kosagi/novena/novena.c line 243

Quoted 11 lines
board/kosagi/novena/novena.c new file +11 -0
+int board_early_init_f(void)
+{
+#if defined(CONFIG_VIDEO_IPUV3)
+	setup_display();
+#endif
+
+	/* Bring Ethernet PHY out of reset. */
+	gpio_set_value(IMX_GPIO_NR(3, 23), 1);
+
+	return 0;
+}

Getting the PHY out of reset at this point causes unpredictable reset timing - e.g. you can't guarantee how much time the chip was held in reset. The PHY datasheet is quite unclear about this reset timing, the only mentioned time is min. 10ms after power-on, and nothing about RESET assertion/de-assertion. I can throw a wild guess that the reset pulse should have similar duration, e.g. 10ms.

Here's my proposal how to fix both (line driving conflict and reset timing) issues:

#define ENET_PHY_CFG_PC \
	(PAD_CTL_HYS | PAD_CTL_PUS_22K_UP | PAD_CTL_PUE | PAD_CTL_PKE)
static iomux_v3_cfg_t enet_pads1[] = {
	MX6_PAD_ENET_MDIO__ENET_MDIO	| MUX_PAD_CTRL(ENET_PAD_CTRL),
	MX6_PAD_ENET_MDC__ENET_MDC	| MUX_PAD_CTRL(ENET_PAD_CTRL),

	MX6_PAD_RGMII_TXC__RGMII_TXC	| MUX_PAD_CTRL(ENET_PAD_CTRL),
	MX6_PAD_RGMII_TD0__RGMII_TD0	| MUX_PAD_CTRL(ENET_PAD_CTRL),
	MX6_PAD_RGMII_TD1__RGMII_TD1	| MUX_PAD_CTRL(ENET_PAD_CTRL),
	MX6_PAD_RGMII_TD2__RGMII_TD2	| MUX_PAD_CTRL(ENET_PAD_CTRL),
	MX6_PAD_RGMII_TD3__RGMII_TD3	| MUX_PAD_CTRL(ENET_PAD_CTRL),
	MX6_PAD_RGMII_TX_CTL__RGMII_TX_CTL| MUX_PAD_CTRL(ENET_PAD_CTRL),
	MX6_PAD_ENET_REF_CLK__ENET_TX_CLK | MUX_PAD_CTRL(ENET_PAD_CTRL),

	/* pin 35, PHY_AD2 */
	MX6_PAD_RGMII_RXC__GPIO6_IO30	| MUX_PAD_CTRL(ENET_PHY_CFG_PC),
	/* pin 32, MODE0 */
	MX6_PAD_RGMII_RD0__GPIO6_IO25	| MUX_PAD_CTRL(ENET_PHY_CFG_PC),
	/* pin 31, MODE1 */
	MX6_PAD_RGMII_RD1__GPIO6_IO27	| MUX_PAD_CTRL(ENET_PHY_CFG_PC),
	/* pin 28, MODE2 */
	MX6_PAD_RGMII_RD2__GPIO6_IO28	| MUX_PAD_CTRL(ENET_PHY_CFG_PC),
	/* pin 27, MODE3 */
	MX6_PAD_RGMII_RD3__GPIO6_IO29	| MUX_PAD_CTRL(ENET_PHY_CFG_PC),
	/* pin 33, CLK125_EN */
	MX6_PAD_RGMII_RX_CTL__GPIO6_IO24| MUX_PAD_CTRL(ENET_PHY_CFG_PC),

	/* PHY nRST */
	MX6_PAD_EIM_D23__GPIO3_IO23	| MUX_PAD_CTRL(NO_PAD_CTRL),
};

static void novena_spl_setup_iomux_enet(void)

{
	imx_iomux_v3_setup_multiple_pads(enet_pads1, ARRAY_SIZE(enet_pads1));

	/* Assert Ethernet PHY nRST */
	gpio_direction_output(IMX_GPIO_NR(3, 23), 0);

	/* Using imx6 internal pull-ups to drive PHY config pins during PHY
reset */
	gpio_direction_input(IMX_GPIO_NR(6, 30)); /* PHY_AD2 = 1 */
	gpio_direction_input(IMX_GPIO_NR(6, 25)); /* MODE0 = 1 */
	gpio_direction_input(IMX_GPIO_NR(6, 27)); /* MODE1 = 1 */
	gpio_direction_input(IMX_GPIO_NR(6, 28)); /* MODE2 = 1 */
	gpio_direction_input(IMX_GPIO_NR(6, 29)); /* MODE3 = 1 */
	gpio_direction_input(IMX_GPIO_NR(6, 24)); /* CLK125_EN = 1 */

	/* Interpreting fig.8 from the PHY datasheet */
	mdelay(10);

	/* De-assert Ethernet PHY nRST */
	gpio_set_value(IMX_GPIO_NR(3, 23), 1);

	/* After PHY is configured, we can finally connect our FEC */
	imx_iomux_v3_setup_multiple_pads(enet_pads2, ARRAY_SIZE(enet_pads2));

	/* PHY datasheet recommends on p.53 to wait at least 100us before using
MII, so we enforce this delay here */
	udelay(100);
}
Quoted 1 line

And I would ditch the PHY un-reset code from board_early_init_f().

Again, this is a question for the hardware guys. Also, it would be nice if you could prepare a patch, so you get the credit.

#7 lore raw

PATCH v4 1/1 ARM: mx6: Add support for Kosagi Novena

I asked Bunnie about this, and the routing is 50 ohms.

Quoted 156 lines · Marek Vasut
Quoted 13 lines · Nikolay Dimitrov

Hi Marek,

Following are some comments about FEC Ethernet:

board/kosagi/novena/novena_spl.c line 43

Quoted 5 lines · Marek Vasut
board/kosagi/novena/novena_spl.c new file +5 -0
+#define ENET_PAD_CTRL						\
+	(PAD_CTL_PKE | PAD_CTL_PUE |				\
+	PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED	  |		\
+	PAD_CTL_DSE_40ohm   | PAD_CTL_HYS)
+

PAD_CTL_SPEED_MED falls on reserved bits (7-6).

Quoted 1 line

Special note: PAD_CTL_DSE_40ohm is defined as 0b110, which is

documented

Quoted 2 lines

as "37/27 ohm @2.5V". I didn't saw any notes on the PHY spec or the Novena schematic about the routing guidelines of the RGMII data

lines,

Quoted 1 line

but I can extrapolate that if the 125 MHz reference clock is routed

as

Quoted 2 lines

50-ohm line (this one is documented in the datasheet), then the data lines are probably routed in a similar way. So the DSE value should

be

Quoted 2 lines

0b100, which is "57/43 ohm @ 2.5V", which in turn is defined in the headers as PAD_CTL_DSE_60ohm (this is either a bug in the header, or

I'm

Quoted 1 line

reading an updated FSL PDF).

Sean, can you comment on this ?

Quoted 3 lines

board/kosagi/novena/novena_spl.c

Quoted 3 lines
board/kosagi/novena/novena_spl.c new file +3 -0
+static void novena_spl_setup_iomux_enet(void)
+{
+	imx_iomux_v3_setup_multiple_pads(enet_pads1,

ARRAY_SIZE(enet_pads1));

Quoted 1 line

Review

Quoted 1 line
(quoted diff) +1 -0
+	imx_iomux_v3_setup_multiple_pads(enet_pads2,

ARRAY_SIZE(enet_pads2));

Quoted 11 lines

board/kosagi/novena/novena_spl.c line 133

Quoted 9 lines
board/kosagi/novena/novena_spl.c new file +9 -0
+
+	gpio_direction_output(IMX_GPIO_NR(3, 23), 0);
+	gpio_direction_output(IMX_GPIO_NR(6, 30), 1);
+	gpio_direction_output(IMX_GPIO_NR(6, 25), 1);
+	gpio_direction_output(IMX_GPIO_NR(6, 27), 1);
+	gpio_direction_output(IMX_GPIO_NR(6, 28), 1);
+	gpio_direction_output(IMX_GPIO_NR(6, 29), 1);
+	gpio_direction_output(IMX_GPIO_NR(6, 24), 1);
+}

I think that setting the iomuxes immediately one after the other

doesn't

Quoted 4 lines

achieve the intended goal. After the 2nd iomux setup, the pads are connected to the FEC, not to the GPIOs.

There's one more issue here - when you get the PHY out of reset,

you'll

Quoted 2 lines

have to both de-assert the RESET line while keeping the strapping signals stable so the PHY can read them, but at the same time the PHY

RX

Quoted 1 line

pins are becoming outputs and driving the same lines, which is not

good.

Quoted 17 lines

I'm giving a proposal how to fix this in the end.

board/kosagi/novena/novena.c line 243

Quoted 11 lines
board/kosagi/novena/novena.c new file +11 -0
+int board_early_init_f(void)
+{
+#if defined(CONFIG_VIDEO_IPUV3)
+	setup_display();
+#endif
+
+	/* Bring Ethernet PHY out of reset. */
+	gpio_set_value(IMX_GPIO_NR(3, 23), 1);
+
+	return 0;
+}

Getting the PHY out of reset at this point causes unpredictable reset timing - e.g. you can't guarantee how much time the chip was held in reset. The PHY datasheet is quite unclear about this reset timing,

the

Quoted 1 line

only mentioned time is min. 10ms after power-on, and nothing about

RESET

Quoted 38 lines

assertion/de-assertion. I can throw a wild guess that the reset pulse should have similar duration, e.g. 10ms.

Here's my proposal how to fix both (line driving conflict and reset timing) issues:

#define ENET_PHY_CFG_PC \
	(PAD_CTL_HYS | PAD_CTL_PUS_22K_UP | PAD_CTL_PUE | PAD_CTL_PKE)
static iomux_v3_cfg_t enet_pads1[] = {
	MX6_PAD_ENET_MDIO__ENET_MDIO	| MUX_PAD_CTRL(ENET_PAD_CTRL),
	MX6_PAD_ENET_MDC__ENET_MDC	| MUX_PAD_CTRL(ENET_PAD_CTRL),

	MX6_PAD_RGMII_TXC__RGMII_TXC	| MUX_PAD_CTRL(ENET_PAD_CTRL),
	MX6_PAD_RGMII_TD0__RGMII_TD0	| MUX_PAD_CTRL(ENET_PAD_CTRL),
	MX6_PAD_RGMII_TD1__RGMII_TD1	| MUX_PAD_CTRL(ENET_PAD_CTRL),
	MX6_PAD_RGMII_TD2__RGMII_TD2	| MUX_PAD_CTRL(ENET_PAD_CTRL),
	MX6_PAD_RGMII_TD3__RGMII_TD3	| MUX_PAD_CTRL(ENET_PAD_CTRL),
	MX6_PAD_RGMII_TX_CTL__RGMII_TX_CTL| MUX_PAD_CTRL(ENET_PAD_CTRL),
	MX6_PAD_ENET_REF_CLK__ENET_TX_CLK | MUX_PAD_CTRL(ENET_PAD_CTRL),

	/* pin 35, PHY_AD2 */
	MX6_PAD_RGMII_RXC__GPIO6_IO30	| MUX_PAD_CTRL(ENET_PHY_CFG_PC),
	/* pin 32, MODE0 */
	MX6_PAD_RGMII_RD0__GPIO6_IO25	| MUX_PAD_CTRL(ENET_PHY_CFG_PC),
	/* pin 31, MODE1 */
	MX6_PAD_RGMII_RD1__GPIO6_IO27	| MUX_PAD_CTRL(ENET_PHY_CFG_PC),
	/* pin 28, MODE2 */
	MX6_PAD_RGMII_RD2__GPIO6_IO28	| MUX_PAD_CTRL(ENET_PHY_CFG_PC),
	/* pin 27, MODE3 */
	MX6_PAD_RGMII_RD3__GPIO6_IO29	| MUX_PAD_CTRL(ENET_PHY_CFG_PC),
	/* pin 33, CLK125_EN */
	MX6_PAD_RGMII_RX_CTL__GPIO6_IO24| MUX_PAD_CTRL(ENET_PHY_CFG_PC),

	/* PHY nRST */
	MX6_PAD_EIM_D23__GPIO3_IO23	| MUX_PAD_CTRL(NO_PAD_CTRL),
};
Quoted 3 lines

static void novena_spl_setup_iomux_enet(void) {
imx_iomux_v3_setup_multiple_pads(enet_pads1,

ARRAY_SIZE(enet_pads1));

Quoted 13 lines
	/* Assert Ethernet PHY nRST */
	gpio_direction_output(IMX_GPIO_NR(3, 23), 0);

	/* Using imx6 internal pull-ups to drive PHY config pins during PHY
reset */
	gpio_direction_input(IMX_GPIO_NR(6, 30)); /* PHY_AD2 = 1 */
	gpio_direction_input(IMX_GPIO_NR(6, 25)); /* MODE0 = 1 */
	gpio_direction_input(IMX_GPIO_NR(6, 27)); /* MODE1 = 1 */
	gpio_direction_input(IMX_GPIO_NR(6, 28)); /* MODE2 = 1 */
	gpio_direction_input(IMX_GPIO_NR(6, 29)); /* MODE3 = 1 */
	gpio_direction_input(IMX_GPIO_NR(6, 24)); /* CLK125_EN = 1 */
Quoted 8 lines
	/* Interpreting fig.8 from the PHY datasheet */
	mdelay(10);

	/* De-assert Ethernet PHY nRST */
	gpio_set_value(IMX_GPIO_NR(3, 23), 1);

	/* After PHY is configured, we can finally connect our FEC */
	imx_iomux_v3_setup_multiple_pads(enet_pads2,

ARRAY_SIZE(enet_pads2));

Quoted 2 lines
	/* PHY datasheet recommends on p.53 to wait at least 100us before

using

Quoted 5 lines

MII, so we enforce this delay here */

	udelay(100);
}

And I would ditch the PHY un-reset code from board_early_init_f().

Again, this is a question for the hardware guys. Also, it would be nice if you
could prepare a patch, so you get the credit.

Signature · 1 line
Sean
#8 lore raw

PATCH v4 1/1 ARM: mx6: Add support for Kosagi Novena

Quoted 18 lines · Sean Cross

I asked Bunnie about this, and the routing is 50 ohms.

Quoted 15 lines · Marek Vasut

On Wednesday, September 24, 2014 at 04:46:42 AM, Nikolay Dimitrov

Quoted 12 lines · wrote:

Hi Marek,

Following are some comments about FEC Ethernet:

board/kosagi/novena/novena_spl.c line 43

Quoted 5 lines · Marek Vasut
board/kosagi/novena/novena_spl.c new file +5 -0
+#define ENET_PAD_CTRL						\
+	(PAD_CTL_PKE | PAD_CTL_PUE |				\
+	PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED	  |		\
+	PAD_CTL_DSE_40ohm   | PAD_CTL_HYS)
+

PAD_CTL_SPEED_MED falls on reserved bits (7-6).

Fixed.

[...]

Quoted 12 lines
Quoted 12 lines
Quoted 11 lines

board/kosagi/novena/novena_spl.c line 133

Quoted 9 lines
board/kosagi/novena/novena_spl.c new file +9 -0
+
+	gpio_direction_output(IMX_GPIO_NR(3, 23), 0);
+	gpio_direction_output(IMX_GPIO_NR(6, 30), 1);
+	gpio_direction_output(IMX_GPIO_NR(6, 25), 1);
+	gpio_direction_output(IMX_GPIO_NR(6, 27), 1);
+	gpio_direction_output(IMX_GPIO_NR(6, 28), 1);
+	gpio_direction_output(IMX_GPIO_NR(6, 29), 1);
+	gpio_direction_output(IMX_GPIO_NR(6, 24), 1);
+}

I think that setting the iomuxes immediately one after the other

Quoted 4 lines
Quoted 4 lines

doesn't

Quoted 2 lines

achieve the intended goal. After the 2nd iomux setup, the pads are connected to the FEC, not to the GPIOs.

Good point, moved the second mux below the GPIO settings.

But what about the reset timing?

Best regards,
Marek Vasut

#9 lore raw

PATCH v4 1/1 ARM: mx6: Add support for Kosagi Novena

In reply to Marek Vasut

Hi Marek, Nikolay,

I thought I responded, but it might have gotten lost. I'm sorry about that.

I've taken a closer look, and responded below.

Quoted 22 lines · Marek Vasut
Quoted 12 lines · Nikolay Dimitrov

Hi Marek,

Following are some comments about FEC Ethernet:

board/kosagi/novena/novena_spl.c line 43

Quoted 5 lines · Marek Vasut
board/kosagi/novena/novena_spl.c new file +5 -0
+#define ENET_PAD_CTRL						\
+	(PAD_CTL_PKE | PAD_CTL_PUE |				\
+	PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED	  |		\
+	PAD_CTL_DSE_40ohm   | PAD_CTL_HYS)
+

PAD_CTL_SPEED_MED falls on reserved bits (7-6).

Quoted 9 lines

Special note: PAD_CTL_DSE_40ohm is defined as 0b110, which is documented as "37/27 ohm @2.5V". I didn't saw any notes on the PHY spec or the Novena schematic about the routing guidelines of the RGMII data lines, but I can extrapolate that if the 125 MHz reference clock is routed as 50-ohm line (this one is documented in the datasheet), then the data lines are probably routed in a similar way. So the DSE value should be 0b100, which is "57/43 ohm @ 2.5V", which in turn is defined in the headers as PAD_CTL_DSE_60ohm (this is either a bug in the header, or I'm reading an updated FSL PDF).

Quoted 1 line

Sean, can you comment on this ?

The pads probably don't support setting speed, as they're a high-speed RG-MII pads are high-speed anyway. PAD_CTL_SPEED_MED can be removed.

In a pre-release version of the FSL PDF I have, 0b110 is indeed documented as 40 ohm. You're correct in that it should be 50 ohm, which the same version of the document doesn't have. The closes is 48 ohm, which is 0b101. The older doc says 0b100 is 60 ohm, and there are no distinctions about voltages as there are in Rev. 1 of the pdf, which is probably what you're looking at.

Quoted 102 lines
Quoted 102 lines

board/kosagi/novena/novena_spl.c line 133

Quoted 13 lines
board/kosagi/novena/novena_spl.c new file +13 -0
+static void novena_spl_setup_iomux_enet(void)
+{
+	imx_iomux_v3_setup_multiple_pads(enet_pads1, ARRAY_SIZE(enet_pads1));
+	imx_iomux_v3_setup_multiple_pads(enet_pads2, ARRAY_SIZE(enet_pads2));
+
+	gpio_direction_output(IMX_GPIO_NR(3, 23), 0);
+	gpio_direction_output(IMX_GPIO_NR(6, 30), 1);
+	gpio_direction_output(IMX_GPIO_NR(6, 25), 1);
+	gpio_direction_output(IMX_GPIO_NR(6, 27), 1);
+	gpio_direction_output(IMX_GPIO_NR(6, 28), 1);
+	gpio_direction_output(IMX_GPIO_NR(6, 29), 1);
+	gpio_direction_output(IMX_GPIO_NR(6, 24), 1);
+}

I think that setting the iomuxes immediately one after the other doesn't achieve the intended goal. After the 2nd iomux setup, the pads are connected to the FEC, not to the GPIOs.

There's one more issue here - when you get the PHY out of reset, you'll have to both de-assert the RESET line while keeping the strapping signals stable so the PHY can read them, but at the same time the PHY RX pins are becoming outputs and driving the same lines, which is not good. I'm giving a proposal how to fix this in the end.

board/kosagi/novena/novena.c line 243

Quoted 11 lines
board/kosagi/novena/novena.c new file +11 -0
+int board_early_init_f(void)
+{
+#if defined(CONFIG_VIDEO_IPUV3)
+	setup_display();
+#endif
+
+	/* Bring Ethernet PHY out of reset. */
+	gpio_set_value(IMX_GPIO_NR(3, 23), 1);
+
+	return 0;
+}

Getting the PHY out of reset at this point causes unpredictable reset timing - e.g. you can't guarantee how much time the chip was held in reset. The PHY datasheet is quite unclear about this reset timing, the only mentioned time is min. 10ms after power-on, and nothing about RESET assertion/de-assertion. I can throw a wild guess that the reset pulse should have similar duration, e.g. 10ms.

Here's my proposal how to fix both (line driving conflict and reset timing) issues:

#define ENET_PHY_CFG_PC \
	(PAD_CTL_HYS | PAD_CTL_PUS_22K_UP | PAD_CTL_PUE | PAD_CTL_PKE)
static iomux_v3_cfg_t enet_pads1[] = {
	MX6_PAD_ENET_MDIO__ENET_MDIO	| MUX_PAD_CTRL(ENET_PAD_CTRL),
	MX6_PAD_ENET_MDC__ENET_MDC	| MUX_PAD_CTRL(ENET_PAD_CTRL),

	MX6_PAD_RGMII_TXC__RGMII_TXC	| MUX_PAD_CTRL(ENET_PAD_CTRL),
	MX6_PAD_RGMII_TD0__RGMII_TD0	| MUX_PAD_CTRL(ENET_PAD_CTRL),
	MX6_PAD_RGMII_TD1__RGMII_TD1	| MUX_PAD_CTRL(ENET_PAD_CTRL),
	MX6_PAD_RGMII_TD2__RGMII_TD2	| MUX_PAD_CTRL(ENET_PAD_CTRL),
	MX6_PAD_RGMII_TD3__RGMII_TD3	| MUX_PAD_CTRL(ENET_PAD_CTRL),
	MX6_PAD_RGMII_TX_CTL__RGMII_TX_CTL| MUX_PAD_CTRL(ENET_PAD_CTRL),
	MX6_PAD_ENET_REF_CLK__ENET_TX_CLK | MUX_PAD_CTRL(ENET_PAD_CTRL),

	/* pin 35, PHY_AD2 */
	MX6_PAD_RGMII_RXC__GPIO6_IO30	| MUX_PAD_CTRL(ENET_PHY_CFG_PC),
	/* pin 32, MODE0 */
	MX6_PAD_RGMII_RD0__GPIO6_IO25	| MUX_PAD_CTRL(ENET_PHY_CFG_PC),
	/* pin 31, MODE1 */
	MX6_PAD_RGMII_RD1__GPIO6_IO27	| MUX_PAD_CTRL(ENET_PHY_CFG_PC),
	/* pin 28, MODE2 */
	MX6_PAD_RGMII_RD2__GPIO6_IO28	| MUX_PAD_CTRL(ENET_PHY_CFG_PC),
	/* pin 27, MODE3 */
	MX6_PAD_RGMII_RD3__GPIO6_IO29	| MUX_PAD_CTRL(ENET_PHY_CFG_PC),
	/* pin 33, CLK125_EN */
	MX6_PAD_RGMII_RX_CTL__GPIO6_IO24| MUX_PAD_CTRL(ENET_PHY_CFG_PC),

	/* PHY nRST */
	MX6_PAD_EIM_D23__GPIO3_IO23	| MUX_PAD_CTRL(NO_PAD_CTRL),
};

static void novena_spl_setup_iomux_enet(void)

{
	imx_iomux_v3_setup_multiple_pads(enet_pads1, ARRAY_SIZE(enet_pads1));

	/* Assert Ethernet PHY nRST */
	gpio_direction_output(IMX_GPIO_NR(3, 23), 0);

	/* Using imx6 internal pull-ups to drive PHY config pins during PHY
reset */
	gpio_direction_input(IMX_GPIO_NR(6, 30)); /* PHY_AD2 = 1 */
	gpio_direction_input(IMX_GPIO_NR(6, 25)); /* MODE0 = 1 */
	gpio_direction_input(IMX_GPIO_NR(6, 27)); /* MODE1 = 1 */
	gpio_direction_input(IMX_GPIO_NR(6, 28)); /* MODE2 = 1 */
	gpio_direction_input(IMX_GPIO_NR(6, 29)); /* MODE3 = 1 */
	gpio_direction_input(IMX_GPIO_NR(6, 24)); /* CLK125_EN = 1 */

	/* Interpreting fig.8 from the PHY datasheet */
	mdelay(10);

	/* De-assert Ethernet PHY nRST */
	gpio_set_value(IMX_GPIO_NR(3, 23), 1);

	/* After PHY is configured, we can finally connect our FEC */
	imx_iomux_v3_setup_multiple_pads(enet_pads2, ARRAY_SIZE(enet_pads2));
Quoted 8 lines
Quoted 6 lines
	/* PHY datasheet recommends on p.53 to wait at least 100us before using
MII, so we enforce this delay here */
	udelay(100);
}

And I would ditch the PHY un-reset code from board_early_init_f().

Again, this is a question for the hardware guys. Also, it would be nice if you could prepare a patch, so you get the credit.

The manual says to wait at least 10ms between the supply voltage stabilizing and deasserting reset. I think a delay of 10ms is unnecessarily long, because VGEN5 (which generates the 2.5V line) comes on as soon as the PMIC is stable. I think it would make more sense to remove the mdelay(10), then reconfigure the iomux to enet_pads2 after the 100us delay.

Sean

#10 lore raw

PATCH v4 1/1 ARM: mx6: Add support for Kosagi Novena

Quoted 6 lines · Sean Cross

Hi Marek, Nikolay,

I thought I responded, but it might have gotten lost. I'm sorry about that.

I've taken a closer look, and responded below.

OK, let me first post a V5 of the patch and then base all the changes on that, all right ?

Best regards,
Marek Vasut

#11 lore raw

PATCH v4 1/1 ARM: mx6: Add support for Kosagi Novena

In reply to Nikolay Dimitrov

Hi Marek, Sean,

Do you have any comments on the PHY signal driving conflict and reset timing issue (see below)?

Quoted 4 lines · Nikolay Dimitrov

There's one more issue here - when you get the PHY out of reset, you'll have to both de-assert the RESET line while keeping the strapping signals stable so the PHY can read them, but at the same time the PHY RX pins are becoming outputs and driving the same lines, which is not good.

...

Quoted 58 lines

Here's my proposal how to fix both (line driving conflict and reset timing) issues:

#define ENET_PHY_CFG_PC \
     (PAD_CTL_HYS | PAD_CTL_PUS_22K_UP | PAD_CTL_PUE | PAD_CTL_PKE)
static iomux_v3_cfg_t enet_pads1[] = {
     MX6_PAD_ENET_MDIO__ENET_MDIO    | MUX_PAD_CTRL(ENET_PAD_CTRL),
     MX6_PAD_ENET_MDC__ENET_MDC    | MUX_PAD_CTRL(ENET_PAD_CTRL),

     MX6_PAD_RGMII_TXC__RGMII_TXC    | MUX_PAD_CTRL(ENET_PAD_CTRL),
     MX6_PAD_RGMII_TD0__RGMII_TD0    | MUX_PAD_CTRL(ENET_PAD_CTRL),
     MX6_PAD_RGMII_TD1__RGMII_TD1    | MUX_PAD_CTRL(ENET_PAD_CTRL),
     MX6_PAD_RGMII_TD2__RGMII_TD2    | MUX_PAD_CTRL(ENET_PAD_CTRL),
     MX6_PAD_RGMII_TD3__RGMII_TD3    | MUX_PAD_CTRL(ENET_PAD_CTRL),
     MX6_PAD_RGMII_TX_CTL__RGMII_TX_CTL| MUX_PAD_CTRL(ENET_PAD_CTRL),
     MX6_PAD_ENET_REF_CLK__ENET_TX_CLK | MUX_PAD_CTRL(ENET_PAD_CTRL),

     /* pin 35, PHY_AD2 */
     MX6_PAD_RGMII_RXC__GPIO6_IO30    | MUX_PAD_CTRL(ENET_PHY_CFG_PC),
     /* pin 32, MODE0 */
     MX6_PAD_RGMII_RD0__GPIO6_IO25    | MUX_PAD_CTRL(ENET_PHY_CFG_PC),
     /* pin 31, MODE1 */
     MX6_PAD_RGMII_RD1__GPIO6_IO27    | MUX_PAD_CTRL(ENET_PHY_CFG_PC),
     /* pin 28, MODE2 */
     MX6_PAD_RGMII_RD2__GPIO6_IO28    | MUX_PAD_CTRL(ENET_PHY_CFG_PC),
     /* pin 27, MODE3 */
     MX6_PAD_RGMII_RD3__GPIO6_IO29    | MUX_PAD_CTRL(ENET_PHY_CFG_PC),
     /* pin 33, CLK125_EN */
     MX6_PAD_RGMII_RX_CTL__GPIO6_IO24| MUX_PAD_CTRL(ENET_PHY_CFG_PC),

     /* PHY nRST */
     MX6_PAD_EIM_D23__GPIO3_IO23    | MUX_PAD_CTRL(NO_PAD_CTRL),
};

static void novena_spl_setup_iomux_enet(void)

{
     imx_iomux_v3_setup_multiple_pads(enet_pads1, ARRAY_SIZE(enet_pads1));

     /* Assert Ethernet PHY nRST */
     gpio_direction_output(IMX_GPIO_NR(3, 23), 0);

     /* Using imx6 internal pull-ups to drive PHY config pins during PHY
reset */
     gpio_direction_input(IMX_GPIO_NR(6, 30)); /* PHY_AD2 = 1 */
     gpio_direction_input(IMX_GPIO_NR(6, 25)); /* MODE0 = 1 */
     gpio_direction_input(IMX_GPIO_NR(6, 27)); /* MODE1 = 1 */
     gpio_direction_input(IMX_GPIO_NR(6, 28)); /* MODE2 = 1 */
     gpio_direction_input(IMX_GPIO_NR(6, 29)); /* MODE3 = 1 */
     gpio_direction_input(IMX_GPIO_NR(6, 24)); /* CLK125_EN = 1 */

     /* Interpreting fig.8 from the PHY datasheet */
     mdelay(10);

     /* De-assert Ethernet PHY nRST */
     gpio_set_value(IMX_GPIO_NR(3, 23), 1);
Quoted 7 lines
     /* After PHY is configured, we can finally connect our FEC */
     imx_iomux_v3_setup_multiple_pads(enet_pads2, ARRAY_SIZE(enet_pads2));

     /* PHY datasheet recommends on p.53 to wait at least 100us before
using MII, so we enforce this delay here */
     udelay(100);
}

Kind regards,
Nikolay

#12 lore raw

PATCH v4 1/1 ARM: mx6: Add support for Kosagi Novena

Quoted 4 lines · Nikolay Dimitrov

Hi Marek, Sean,

Do you have any comments on the PHY signal driving conflict and reset timing issue (see below)?

I don't, I sense expert knowledge from you. Now we need to wait for the authors.

I spent this weekend showing Novena board off at a local conference and somehow it became the center of attention without much help ;-) I see Novena is like the epitome of awesomeness :)

Best regards,
Marek Vasut

#13 lore raw

PATCH v4 1/1 ARM: mx6: Add support for Kosagi Novena

Hi Marek,

Quoted 11 lines · Marek Vasut
Quoted 4 lines · Nikolay Dimitrov

Hi Marek, Sean,

Do you have any comments on the PHY signal driving conflict and reset timing issue (see below)?

I don't, I sense expert knowledge from you. Now we need to wait for the authors.

I spent this weekend showing Novena board off at a local conference and somehow it became the center of attention without much help ;-) I see Novena is like the epitome of awesomeness :)

Well, after signing NDAs with our own blood for years, everyone seems to be happy to see a product that's just designed to be hacked (and to hack other gadgets with it, of course).

Regards,
Nikolay

#14 lore raw

PATCH v4 1/1 ARM: mx6: Add support for Kosagi Novena

Quoted 12 lines · Nikolay Dimitrov

Hi Marek,

Quoted 9 lines · Marek Vasut
Quoted 4 lines · Nikolay Dimitrov

Hi Marek, Sean,

Do you have any comments on the PHY signal driving conflict and reset timing issue (see below)?

I don't, I sense expert knowledge from you. Now we need to wait for the authors.

Quoted 7 lines
Quoted 3 lines

I spent this weekend showing Novena board off at a local conference and somehow it became the center of attention without much help ;-) I see Novena is like the epitome of awesomeness :)

Well, after signing NDAs with our own blood for years, everyone seems to be happy to see a product that's just designed to be hacked (and to hack other gadgets with it, of course).

Yes, I agree the Novena has extreme potential there.

Best regards,
Marek Vasut

#15 lore raw

PATCH v4 1/1 ARM: mx6: Add support for Kosagi Novena

In reply to Marek Vasut

Hi Marek,

Here are my last findings:

board/kosagi/novena/novena_spl.c line 283

Quoted 11 lines · Marek Vasut
board/kosagi/novena/novena_spl.c new file +11 -0
+static void novena_spl_setup_iomux_sdhc(void)
+{
+	imx_iomux_v3_setup_multiple_pads(usdhc2_pads, ARRAY_SIZE(usdhc2_pads));
+	imx_iomux_v3_setup_multiple_pads(usdhc3_pads, ARRAY_SIZE(usdhc3_pads));
+
+	/* Micro SD card detect */
+	gpio_direction_input(IMX_GPIO_NR(7, 0));
+
+	/* Big SD card detect */
+	gpio_direction_input(IMX_GPIO_NR(1, 4));
+}

I think that you mentioned elsewhere in the source, that microSD card doesn't have CD. Also, GPIO7_IO00 is not connected to anything.

Quoted 1 line

+#define NOVENA_USB_HUB_RESET IMX_GPIO_NR(7, 12)

Can you please double-check this one, it seems that GPIO7_IO12 is actually connected as PCIE_PWRON on the schematic.

Quoted 5 lines
board/kosagi/novena/novena.c new file +5 -0
+/*
+ * USB
+ */
+#ifdef CONFIG_USB_EHCI_MX6
+int board_ehci_hcd_init(int port)

board/kosagi/novena/novena.c line 154

Quoted 10 lines
board/kosagi/novena/novena.c new file +10 -0
+{
+	/* Reset USB hub */
+	if (port == 1) {
+		gpio_set_value(NOVENA_USB_HUB_RESET, 0);
+		mdelay(2);
+		gpio_set_value(NOVENA_USB_HUB_RESET, 1);
+	}
+	return 0;
+}
+#endif

Can you verify this - USB hubs seems to be reset not by this pin, but via RESETBMCU.

Quoted 1 line

+#define NOVENA_AUDIO_PWRON IMX_GPIO_NR(5, 17)

This signal is not connected to the audio power switch, because R30A is marked as DNP. The audio power switch seems to be controlled by KEY_ROW1, which is not configured by uboot, I think.

Quoted 1 line

+#define NOVENA_HDMI_GHOST_HPD IMX_GPIO_NR(5, 4)

...

board/kosagi/novena/novena_spl.c line 354

Quoted 5 lines
board/kosagi/novena/novena_spl.c new file +5 -0
+static void novena_spl_setup_iomux_video(void)
+{
+	imx_iomux_v3_setup_multiple_pads(hdmi_pads, ARRAY_SIZE(hdmi_pads));
+	gpio_direction_input(NOVENA_HDMI_GHOST_HPD);
+}

Is there any added value of having this pin initialized? It should be already configured as input on reset.

Quoted 1 line

+ * Environment is on MMC, starting at offset 64KiB from start of the

card.
...

Quoted 1 line

+#define CONFIG_ENV_OFFSET (512 * 1024)

Comments and code say different things about the ENV offset - which one is the correct value?

I don't have any more comments on v4. Sorry it took so long, but it takes ages to cross-check the code, schematic and datasheets, you know... Thanks for your patience. Please tell me if I can help more.

Kind regards,
Nikolay