Skip to contentSkip to conversation

dt-bindings: add imx-audmux macro definitions

PATCH New Baruch Siach 3 participants 12 messages Nov 10, 2019 – Dec 29, 2019

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

PATCH v2 1/4 dt-bindings: add imx-audmux macro definitions

Import fsl-imx-audmux.h from Linux as of v5.4-rc6. The header is unchanged since v4.18.

That would make it easier to import DT files that depend on imx-audmux definitions from the kernel tree.

---
v2: New patch in this series. Suggested by Fabio Estevam.

---
 include/dt-bindings/sound/fsl-imx-audmux.h | 64 ++++++++++++++++++++++
 1 file changed, 64 insertions(+)
 create mode 100644 include/dt-bindings/sound/fsl-imx-audmux.h
include/dt-bindings/sound/fsl-imx-audmux.h new file +64 -0
new file mode 100644
index 000000000000..15f138bebe16
@@ -0,0 +1,64 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef __DT_FSL_IMX_AUDMUX_H
+#define __DT_FSL_IMX_AUDMUX_H
+
+#define MX27_AUDMUX_HPCR1_SSI0		0
+#define MX27_AUDMUX_HPCR2_SSI1		1
+#define MX27_AUDMUX_HPCR3_SSI_PINS_4	2
+#define MX27_AUDMUX_PPCR1_SSI_PINS_1	3
+#define MX27_AUDMUX_PPCR2_SSI_PINS_2	4
+#define MX27_AUDMUX_PPCR3_SSI_PINS_3	5
+
+#define MX31_AUDMUX_PORT1_SSI0		0
+#define MX31_AUDMUX_PORT2_SSI1		1
+#define MX31_AUDMUX_PORT3_SSI_PINS_3	2
+#define MX31_AUDMUX_PORT4_SSI_PINS_4	3
+#define MX31_AUDMUX_PORT5_SSI_PINS_5	4
+#define MX31_AUDMUX_PORT6_SSI_PINS_6	5
+#define MX31_AUDMUX_PORT7_SSI_PINS_7	6
+
+#define MX51_AUDMUX_PORT1_SSI0		0
+#define MX51_AUDMUX_PORT2_SSI1		1
+#define MX51_AUDMUX_PORT3		2
+#define MX51_AUDMUX_PORT4		3
+#define MX51_AUDMUX_PORT5		4
+#define MX51_AUDMUX_PORT6		5
+#define MX51_AUDMUX_PORT7		6
+
+/*
+ * TFCSEL/RFCSEL (i.MX27) or TFSEL/TCSEL/RFSEL/RCSEL (i.MX31/51/53/6Q)
+ * can be sourced from Rx/Tx.
+ */
+#define IMX_AUDMUX_RXFS			0x8
+#define IMX_AUDMUX_RXCLK		0x8
+
+/* Register definitions for the i.MX21/27 Digital Audio Multiplexer */
+#define IMX_AUDMUX_V1_PCR_INMMASK(x)	((x) & 0xff)
+#define IMX_AUDMUX_V1_PCR_INMEN		(1 << 8)
+#define IMX_AUDMUX_V1_PCR_TXRXEN	(1 << 10)
+#define IMX_AUDMUX_V1_PCR_SYN		(1 << 12)
+#define IMX_AUDMUX_V1_PCR_RXDSEL(x)	(((x) & 0x7) << 13)
+#define IMX_AUDMUX_V1_PCR_RFCSEL(x)	(((x) & 0xf) << 20)
+#define IMX_AUDMUX_V1_PCR_RCLKDIR	(1 << 24)
+#define IMX_AUDMUX_V1_PCR_RFSDIR	(1 << 25)
+#define IMX_AUDMUX_V1_PCR_TFCSEL(x)	(((x) & 0xf) << 26)
+#define IMX_AUDMUX_V1_PCR_TCLKDIR	(1 << 30)
+#define IMX_AUDMUX_V1_PCR_TFSDIR	(1 << 31)
+
+/* Register definitions for the i.MX25/31/35/51 Digital Audio Multiplexer */
+#define IMX_AUDMUX_V2_PTCR_TFSDIR	(1 << 31)
+#define IMX_AUDMUX_V2_PTCR_TFSEL(x)	(((x) & 0xf) << 27)
+#define IMX_AUDMUX_V2_PTCR_TCLKDIR	(1 << 26)
+#define IMX_AUDMUX_V2_PTCR_TCSEL(x)	(((x) & 0xf) << 22)
+#define IMX_AUDMUX_V2_PTCR_RFSDIR	(1 << 21)
+#define IMX_AUDMUX_V2_PTCR_RFSEL(x)	(((x) & 0xf) << 17)
+#define IMX_AUDMUX_V2_PTCR_RCLKDIR	(1 << 16)
+#define IMX_AUDMUX_V2_PTCR_RCSEL(x)	(((x) & 0xf) << 12)
+#define IMX_AUDMUX_V2_PTCR_SYN		(1 << 11)
+
+#define IMX_AUDMUX_V2_PDCR_RXDSEL(x)	(((x) & 0x7) << 13)
+#define IMX_AUDMUX_V2_PDCR_TXRXEN	(1 << 12)
+#define IMX_AUDMUX_V2_PDCR_MODE(x)	(((x) & 0x3) << 8)
+#define IMX_AUDMUX_V2_PDCR_INMMASK(x)	((x) & 0xff)
+
+#endif /* __DT_FSL_IMX_AUDMUX_H */
Signature · 1 line
2.24.0
#1 lore raw

PATCH v2 2/4 arm: dts: hummingboard: add cubox/hummingboard DT (part 1 of 2)

These DT files are copied from kernel v5.3 with no changes.

This is part 1 of 2 commits. Included are DT files for the original Cubox-i and Hummingboard Base/Pro.

---
v2: Don't remove imx-audmux macros (Fabio Estevam)
Split into two commits to comply with list size limits

---
 arch/arm/dts/Makefile                  |   4 +
 arch/arm/dts/imx6dl-cubox-i.dts        |  51 ++++
 arch/arm/dts/imx6dl-hummingboard.dts   |  52 ++++
 arch/arm/dts/imx6q-cubox-i.dts         |  59 ++++
 arch/arm/dts/imx6q-hummingboard.dts    |  60 ++++
 arch/arm/dts/imx6qdl-cubox-i.dtsi      | 269 ++++++++++++++++++
 arch/arm/dts/imx6qdl-hummingboard.dtsi | 368 +++++++++++++++++++++++++
 arch/arm/dts/imx6qdl-sr-som-brcm.dtsi  | 144 ++++++++++
 arch/arm/dts/imx6qdl-sr-som.dtsi       | 121 ++++++++
 9 files changed, 1128 insertions(+)
 create mode 100644 arch/arm/dts/imx6dl-cubox-i.dts
 create mode 100644 arch/arm/dts/imx6dl-hummingboard.dts
 create mode 100644 arch/arm/dts/imx6q-cubox-i.dts
 create mode 100644 arch/arm/dts/imx6q-hummingboard.dts
 create mode 100644 arch/arm/dts/imx6qdl-cubox-i.dtsi
 create mode 100644 arch/arm/dts/imx6qdl-hummingboard.dtsi
 create mode 100644 arch/arm/dts/imx6qdl-sr-som-brcm.dtsi
 create mode 100644 arch/arm/dts/imx6qdl-sr-som.dtsi
arch/arm/dts/Makefile +4 -0
index 3b8dc2f56fd2..a2ed92b77f15 100644
@@ -560,7 +560,9 @@ dtb-$(CONFIG_MX53) += imx53-cx9020.dtb \
 
 ifneq ($(CONFIG_MX6DL)$(CONFIG_MX6QDL)$(CONFIG_MX6S),)
 dtb-y += \
+	imx6dl-cubox-i.dtb \
 	imx6dl-dhcom-pdk2.dtb \
+	imx6dl-hummingboard.dtb \
 	imx6dl-icore.dtb \
 	imx6dl-icore-mipi.dtb \
 	imx6dl-icore-rqs.dtb \
@@ -577,8 +579,10 @@ ifneq ($(CONFIG_MX6Q)$(CONFIG_MX6QDL),)
 dtb-y += \
 	imx6-apalis.dtb \
 	imx6q-cm-fx6.dtb \
+	imx6q-cubox-i.dtb \
 	imx6q-dhcom-pdk2.dtb \
 	imx6q-display5.dtb \
+	imx6q-hummingboard.dtb \
 	imx6q-icore.dtb \
 	imx6q-icore-mipi.dtb \
 	imx6q-icore-rqs.dtb \
arch/arm/dts/imx6dl-cubox-i.dts new file +51 -0

51 lines not on this page · raw message

arch/arm/dts/imx6dl-hummingboard.dts new file +52 -0

52 lines not on this page · raw message

arch/arm/dts/imx6q-cubox-i.dts new file +59 -0

59 lines not on this page · raw message

arch/arm/dts/imx6q-hummingboard.dts new file +60 -0

60 lines not on this page · raw message

arch/arm/dts/imx6qdl-cubox-i.dtsi new file +269 -0

269 lines not on this page · raw message

arch/arm/dts/imx6qdl-hummingboard.dtsi new file +368 -0

368 lines not on this page · raw message

arch/arm/dts/imx6qdl-sr-som-brcm.dtsi new file +144 -0

144 lines not on this page · raw message

arch/arm/dts/imx6qdl-sr-som.dtsi new file +121 -0

121 lines not on this page · raw message

Signature · 1 line
2.24.0
#3 lore raw

PATCH v2 2/4 arm: dts: hummingboard: add cubox/hummingboard DT (part 1 of 2)

In reply to Baruch Siach
Quoted 5 lines

These DT files are copied from kernel v5.3 with no changes. This is part 1 of 2 commits. Included are DT files for the original Cubox-i and Hummingboard Base/Pro.

Applied to u-boot-imx, -next, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#4 lore raw

PATCH v2 3/4 arm: dts: hummingboard: add cubox/hummingboard DT (part 2 of 2)

In reply to Baruch Siach

These DT files are copied from kernel v5.3 with no changes.

This is part 2 of 2 commits. Included are DT files for SOM rev 1.5, and Hummingboard2 Gate/Edge.

---
v2: Splits into two commits to comply with list size limits

---
 arch/arm/dts/Makefile                         |  14 +
 arch/arm/dts/imx6dl-cubox-i-emmc-som-v15.dts  |  52 ++
 arch/arm/dts/imx6dl-cubox-i-som-v15.dts       |  51 ++
 .../dts/imx6dl-hummingboard-emmc-som-v15.dts  |  53 ++
 arch/arm/dts/imx6dl-hummingboard-som-v15.dts  |  52 ++
 ...6dl-hummingboard2-emmc-som-v15-u-boot.dtsi |   1 +
 .../dts/imx6dl-hummingboard2-emmc-som-v15.dts |  55 ++
 arch/arm/dts/imx6dl-hummingboard2-som-v15.dts |  54 ++
 arch/arm/dts/imx6dl-hummingboard2.dts         |  53 ++
 arch/arm/dts/imx6q-cubox-i-emmc-som-v15.dts   |  60 ++
 arch/arm/dts/imx6q-cubox-i-som-v15.dts        |  59 ++
 .../dts/imx6q-hummingboard-emmc-som-v15.dts   |  61 ++
 arch/arm/dts/imx6q-hummingboard-som-v15.dts   |  60 ++
 ...x6q-hummingboard2-emmc-som-v15-u-boot.dtsi |   1 +
 .../dts/imx6q-hummingboard2-emmc-som-v15.dts  |  63 ++
 arch/arm/dts/imx6q-hummingboard2-som-v15.dts  |  62 ++
 arch/arm/dts/imx6q-hummingboard2.dts          |  61 ++
 ...qdl-hummingboard2-emmc-som-v15-u-boot.dtsi |  36 ++
 arch/arm/dts/imx6qdl-hummingboard2-emmc.dtsi  |  72 +++
 arch/arm/dts/imx6qdl-hummingboard2.dtsi       | 577 ++++++++++++++++++
 arch/arm/dts/imx6qdl-sr-som-emmc.dtsi         |  70 +++
 arch/arm/dts/imx6qdl-sr-som-ti.dtsi           | 170 ++++++
 22 files changed, 1737 insertions(+)
 create mode 100644 arch/arm/dts/imx6dl-cubox-i-emmc-som-v15.dts
 create mode 100644 arch/arm/dts/imx6dl-cubox-i-som-v15.dts
 create mode 100644 arch/arm/dts/imx6dl-hummingboard-emmc-som-v15.dts
 create mode 100644 arch/arm/dts/imx6dl-hummingboard-som-v15.dts
 create mode 100644 arch/arm/dts/imx6dl-hummingboard2-emmc-som-v15-u-boot.dtsi
 create mode 100644 arch/arm/dts/imx6dl-hummingboard2-emmc-som-v15.dts
 create mode 100644 arch/arm/dts/imx6dl-hummingboard2-som-v15.dts
 create mode 100644 arch/arm/dts/imx6dl-hummingboard2.dts
 create mode 100644 arch/arm/dts/imx6q-cubox-i-emmc-som-v15.dts
 create mode 100644 arch/arm/dts/imx6q-cubox-i-som-v15.dts
 create mode 100644 arch/arm/dts/imx6q-hummingboard-emmc-som-v15.dts
 create mode 100644 arch/arm/dts/imx6q-hummingboard-som-v15.dts
 create mode 100644 arch/arm/dts/imx6q-hummingboard2-emmc-som-v15-u-boot.dtsi
 create mode 100644 arch/arm/dts/imx6q-hummingboard2-emmc-som-v15.dts
 create mode 100644 arch/arm/dts/imx6q-hummingboard2-som-v15.dts
 create mode 100644 arch/arm/dts/imx6q-hummingboard2.dts
 create mode 100644 arch/arm/dts/imx6qdl-hummingboard2-emmc-som-v15-u-boot.dtsi
 create mode 100644 arch/arm/dts/imx6qdl-hummingboard2-emmc.dtsi
 create mode 100644 arch/arm/dts/imx6qdl-hummingboard2.dtsi
 create mode 100644 arch/arm/dts/imx6qdl-sr-som-emmc.dtsi
 create mode 100644 arch/arm/dts/imx6qdl-sr-som-ti.dtsi
arch/arm/dts/Makefile +14 -0
index a2ed92b77f15..866ee1605722 100644
@@ -561,8 +561,15 @@ dtb-$(CONFIG_MX53) += imx53-cx9020.dtb \
 ifneq ($(CONFIG_MX6DL)$(CONFIG_MX6QDL)$(CONFIG_MX6S),)
 dtb-y += \
 	imx6dl-cubox-i.dtb \
+	imx6dl-cubox-i-emmc-som-v15.dtb \
+	imx6dl-cubox-i-som-v15.dtb \
 	imx6dl-dhcom-pdk2.dtb \
+	imx6dl-hummingboard2.dtb \
+	imx6dl-hummingboard2-emmc-som-v15.dtb \
+	imx6dl-hummingboard2-som-v15.dtb \
 	imx6dl-hummingboard.dtb \
+	imx6dl-hummingboard-emmc-som-v15.dtb \
+	imx6dl-hummingboard-som-v15.dtb \
 	imx6dl-icore.dtb \
 	imx6dl-icore-mipi.dtb \
 	imx6dl-icore-rqs.dtb \
@@ -580,9 +587,16 @@ dtb-y += \
 	imx6-apalis.dtb \
 	imx6q-cm-fx6.dtb \
 	imx6q-cubox-i.dtb \
+	imx6q-cubox-i-emmc-som-v15.dtb \
+	imx6q-cubox-i-som-v15.dtb \
 	imx6q-dhcom-pdk2.dtb \
 	imx6q-display5.dtb \
+	imx6q-hummingboard2.dtb \
+	imx6q-hummingboard2-emmc-som-v15.dtb \
+	imx6q-hummingboard2-som-v15.dtb \
 	imx6q-hummingboard.dtb \
+	imx6q-hummingboard-emmc-som-v15.dtb \
+	imx6q-hummingboard-som-v15.dtb \
 	imx6q-icore.dtb \
 	imx6q-icore-mipi.dtb \
 	imx6q-icore-rqs.dtb \
arch/arm/dts/imx6dl-cubox-i-emmc-som-v15.dts new file +52 -0

52 lines not on this page · raw message

arch/arm/dts/imx6dl-cubox-i-som-v15.dts new file +51 -0

51 lines not on this page · raw message

arch/arm/dts/imx6dl-hummingboard-emmc-som-v15.dts new file +53 -0

53 lines not on this page · raw message

arch/arm/dts/imx6dl-hummingboard-som-v15.dts new file +52 -0

52 lines not on this page · raw message

arch/arm/dts/imx6dl-hummingboard2-emmc-som-v15-u-boot.dtsi new file +1 -0
new file mode 100644
index 000000000000..89fbec4d06fe
@@ -0,0 +1 @@
+#include "imx6qdl-hummingboard2-emmc-som-v15-u-boot.dtsi"
arch/arm/dts/imx6dl-hummingboard2-emmc-som-v15.dts new file +55 -0

55 lines not on this page · raw message

arch/arm/dts/imx6dl-hummingboard2-som-v15.dts new file +54 -0

54 lines not on this page · raw message

arch/arm/dts/imx6dl-hummingboard2.dts new file +53 -0

53 lines not on this page · raw message

arch/arm/dts/imx6q-cubox-i-emmc-som-v15.dts new file +60 -0

60 lines not on this page · raw message

arch/arm/dts/imx6q-cubox-i-som-v15.dts new file +59 -0

59 lines not on this page · raw message

arch/arm/dts/imx6q-hummingboard-emmc-som-v15.dts new file +61 -0

61 lines not on this page · raw message

arch/arm/dts/imx6q-hummingboard-som-v15.dts new file +60 -0

60 lines not on this page · raw message

arch/arm/dts/imx6q-hummingboard2-emmc-som-v15-u-boot.dtsi new file +1 -0
new file mode 100644
index 000000000000..89fbec4d06fe
@@ -0,0 +1 @@
+#include "imx6qdl-hummingboard2-emmc-som-v15-u-boot.dtsi"
arch/arm/dts/imx6q-hummingboard2-emmc-som-v15.dts new file +63 -0

63 lines not on this page · raw message

arch/arm/dts/imx6q-hummingboard2-som-v15.dts new file +62 -0

62 lines not on this page · raw message

arch/arm/dts/imx6q-hummingboard2.dts new file +61 -0

61 lines not on this page · raw message

arch/arm/dts/imx6qdl-hummingboard2-emmc-som-v15-u-boot.dtsi new file +36 -0
new file mode 100644
index 000000000000..d302b2e27585
@@ -0,0 +1,36 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+#include "imx6qdl-u-boot.dtsi"
+
+/ {
+	board-detect {
+		compatible = "solidrun,hummingboard-detect";
+		detect-gpios = <
+			&gpio2 8 0
+			&gpio3 4 0
+			&gpio4 9 0
+			&gpio6 0 0
+			&gpio6 4 0
+		>;
+	};
+};
+
+&gpio2 {
+	u-boot,dm-pre-reloc;
+};
+
+&gpio3 {
+	u-boot,dm-pre-reloc;
+};
+
+&gpio4 {
+	u-boot,dm-pre-reloc;
+};
+
+&gpio6 {
+	u-boot,dm-pre-reloc;
+};
+
+&usdhc1 {
+	status = "disabled";
+};
arch/arm/dts/imx6qdl-hummingboard2-emmc.dtsi new file +72 -0

72 lines not on this page · raw message

arch/arm/dts/imx6qdl-hummingboard2.dtsi new file +577 -0

577 lines not on this page · raw message

arch/arm/dts/imx6qdl-sr-som-emmc.dtsi new file +70 -0

70 lines not on this page · raw message

arch/arm/dts/imx6qdl-sr-som-ti.dtsi new file +170 -0

170 lines not on this page · raw message

Signature · 1 line
2.24.0
#6 lore raw

PATCH v2 3/4 arm: dts: hummingboard: add cubox/hummingboard DT (part 2 of 2)

In reply to Baruch Siach
Quoted 5 lines

These DT files are copied from kernel v5.3 with no changes. This is part 2 of 2 commits. Included are DT files for SOM rev 1.5, and Hummingboard2 Gate/Edge.

Applied to u-boot-imx, -next, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#7 lore raw

PATCH v2 4/4 mx6cuboxi: enable OF_CONTROL with DM_MMC and DM_USB

In reply to Baruch Siach

Make first step in DT/DM migration. Enable OF_CONTROL only for the main U-Boot image for now.

Remove mmc_init_main() because board_mmc_init() is not called when DM_MMC is enabled.

DM_MMC requires DM_GPIO for card-detect to work. That in turn makes gpio request mandatory. Add code to request/free gpios in platform code.

MMC devices are now numbered according to DT. The SD card is 1, and eMMC is 2. Account for that in board_mmc_get_env_dev(), BOOT_TARGET_DEVICES, and has_emmc().

DM_MMC requires BLK. However, the (BLK && !DM_USB) combination disables USB_STORAGE. Enable DM_USB to preserve USB functionality. Add also DM_REGULATORS for the USB power controller. This allows us to drop board_ehci_hcd_init() and setup_usb().

Runtime selection of DT is necessary because of the i.MX6QD vs i.MX6SDL incompatibility. DT selection does not rely on GPIOs, since DM_GPIO depends on DT. Instead, we take one "fully featured" DT of each variant. That should be enough to boot from both SD card and eMMC.

Since we don't select the exact DT, override the generic show_board_info() that shows the selected DT 'model' field.

---
v2: No change

---
 board/solidrun/mx6cuboxi/mx6cuboxi.c | 119 ++++++++++++++++-----------
 configs/mx6cuboxi_defconfig          |  16 +++-
 include/configs/mx6cuboxi.h          |   6 +-
 3 files changed, 89 insertions(+), 52 deletions(-)
board/solidrun/mx6cuboxi/mx6cuboxi.c +72 -47
index f82fb0786a94..bb005aa28325 100644
@@ -65,6 +65,8 @@ enum board_type {
 	UNKNOWN         = 0x03,
 };
 
+static struct gpio_desc board_detect_desc[5];
+
 #define MEM_STRIDE 0x4000000
 static u32 get_ram_size_stride_test(u32 *base, u32 maxsize)
 {
@@ -154,10 +156,6 @@ static iomux_v3_cfg_t const som_rev_detect[] = {
 	IOMUX_PADS(PAD_CSI0_DAT18__GPIO6_IO04  | MUX_PAD_CTRL(UART_PAD_CTRL)),
 };
 
-static iomux_v3_cfg_t const usb_pads[] = {
-	IOMUX_PADS(PAD_GPIO_0__GPIO1_IO00 | MUX_PAD_CTRL(NO_PAD_CTRL)),
-};
-
 static void setup_iomux_uart(void)
 {
 	SETUP_IOMUX_PADS(uart1_pads);
@@ -175,7 +173,7 @@ static struct fsl_esdhc_cfg emmc_cfg = {
 
 int board_mmc_get_env_dev(int devno)
 {
-	return devno - 1;
+	return devno;
 }
 
 #define USDHC2_CD_GPIO  IMX_GPIO_NR(1, 4)
@@ -197,27 +195,6 @@ int board_mmc_getcd(struct mmc *mmc)
 	return ret;
 }
 
-static int mmc_init_main(bd_t *bis)
-{
-	int ret;
-
-	/*
-	 * Following map is done:
-	 * (U-Boot device node)    (Physical Port)
-	 * mmc0                    Carrier board MicroSD
-	 * mmc1                    SOM eMMC
-	 */
-	SETUP_IOMUX_PADS(usdhc2_pads);
-	usdhc_cfg.sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK);
-	ret = fsl_esdhc_initialize(bis, &usdhc_cfg);
-	if (ret)
-		return ret;
-
-	SETUP_IOMUX_PADS(usdhc3_pads);
-	emmc_cfg.sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK);
-	return fsl_esdhc_initialize(bis, &emmc_cfg);
-}
-
 static int mmc_init_spl(bd_t *bis)
 {
 	struct src *psrc = (struct src *)SRC_BASE_ADDR;
@@ -251,7 +228,7 @@ int board_mmc_init(bd_t *bis)
 	if (IS_ENABLED(CONFIG_SPL_BUILD))
 		return mmc_init_spl(bis);
 
-	return mmc_init_main(bis);
+	return 0;
 }
 
 static iomux_v3_cfg_t const enet_pads[] = {
@@ -283,12 +260,29 @@ static iomux_v3_cfg_t const enet_pads[] = {
 
 static void setup_iomux_enet(void)
 {
+	struct gpio_desc desc;
+	int ret;
+
 	SETUP_IOMUX_PADS(enet_pads);
 
+	ret = dm_gpio_lookup_name("GPIO4_15", &desc);
+	if (ret) {
+		printf("%s: phy reset lookup failed\n", __func__);
+		return;
+	}
+
+	ret = dm_gpio_request(&desc, "phy-reset");
+	if (ret) {
+		printf("%s: phy reset request failed\n", __func__);
+		return;
+	}
+
 	gpio_direction_output(ETH_PHY_RESET, 0);
 	mdelay(10);
 	gpio_set_value(ETH_PHY_RESET, 1);
 	udelay(100);
+
+	gpio_free_list_nodev(&desc, 1);
 }
 
 int board_phy_config(struct phy_device *phydev)
@@ -433,21 +427,6 @@ static int setup_display(void)
 }
 #endif /* CONFIG_VIDEO_IPUV3 */
 
-#ifdef CONFIG_USB_EHCI_MX6
-static void setup_usb(void)
-{
-	SETUP_IOMUX_PADS(usb_pads);
-}
-
-int board_ehci_hcd_init(int port)
-{
-	if (port == 1)
-		gpio_direction_output(USB_H1_VBUS, 1);
-
-	return 0;
-}
-#endif
-
 int board_early_init_f(void)
 {
 	setup_iomux_uart();
@@ -455,10 +434,6 @@ int board_early_init_f(void)
 #ifdef CONFIG_CMD_SATA
 	setup_sata();
 #endif
-
-#ifdef CONFIG_USB_EHCI_MX6
-	setup_usb();
-#endif
 	return 0;
 }
 
@@ -476,6 +451,29 @@ int board_init(void)
 	return ret;
 }
 
+static int request_detect_gpios(void)
+{
+	int node;
+	int ret;
+
+	node = fdt_node_offset_by_compatible(gd->fdt_blob, 0,
+		"solidrun,hummingboard-detect");
+	if (node < 0)
+		return -ENODEV;
+
+	ret = gpio_request_list_by_name_nodev(offset_to_ofnode(node),
+		"detect-gpios", board_detect_desc,
+		ARRAY_SIZE(board_detect_desc), GPIOD_IS_IN);
+
+	return ret;
+}
+
+static int free_detect_gpios(void)
+{
+	return gpio_free_list_nodev(board_detect_desc,
+		ARRAY_SIZE(board_detect_desc));
+}
+
 static enum board_type board_type(void)
 {
 	int val1, val2, val3;
@@ -531,7 +529,7 @@ static bool is_rev_15_som(void)
 static bool has_emmc(void)
 {
 	struct mmc *mmc;
-	mmc = find_mmc_device(1);
+	mmc = find_mmc_device(2);
 	if (!mmc)
 		return 0;
 	return (mmc_get_op_cond(mmc) < 0) ? 0 : 1;
@@ -539,6 +537,8 @@ static bool has_emmc(void)
 
 int checkboard(void)
 {
+	request_detect_gpios();
+
 	switch (board_type()) {
 	case CUBOXI:
 		puts("Board: MX6 Cubox-i");
@@ -560,13 +560,22 @@ int checkboard(void)
 	else
 		puts("\n");
 
+	free_detect_gpios();
 out:
 	return 0;
 }
 
+/* Override the default implementation, DT model is not accurate */
+int show_board_info(void)
+{
+	return checkboard();
+}
+
 int board_late_init(void)
 {
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
+	request_detect_gpios();
+
 	switch (board_type()) {
 	case CUBOXI:
 		env_set("board_name", "CUBOXI");
@@ -593,11 +602,27 @@ int board_late_init(void)
 	if (has_emmc())
 		env_set("has_emmc", "yes");
 
+	free_detect_gpios();
 #endif
 
 	return 0;
 }
 
+/*
+ * This is not a perfect match. Avoid dependency on the DM GPIO driver needed
+ * for accurate board detection. Hummingboard2 DT is good enough for U-Boot on
+ * all Hummingboard/Cubox-i platforms.
+ */
+int board_fit_config_name_match(const char *name)
+{
+	char tmp_name[36];
+
+	snprintf(tmp_name, sizeof(tmp_name), "%s-hummingboard2-emmc-som-v15",
+			is_mx6dq() ? "imx6q" : "imx6dl");
+
+	return strcmp(name, tmp_name);
+}
+
 #ifdef CONFIG_SPL_BUILD
 #include <asm/arch/mx6-ddr.h>
 static const struct mx6dq_iomux_ddr_regs mx6q_ddr_ioregs = {
configs/mx6cuboxi_defconfig +15 -1
index a13243fca69b..f8a9546e7b8e 100644
@@ -12,8 +12,10 @@ CONFIG_SPL=y
 CONFIG_SPL_LIBDISK_SUPPORT=y
 # CONFIG_CMD_BMODE is not set
 CONFIG_CMD_HDMIDETECT=y
+CONFIG_AHCI=y
 CONFIG_SPL_TEXT_BASE=0x00908000
 CONFIG_DISTRO_DEFAULTS=y
+CONFIG_FIT=y
 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg"
 CONFIG_BOOTCOMMAND="run findfdt; run finduuid; run distro_bootcmd"
 CONFIG_USE_PREBOOT=y
@@ -26,22 +28,34 @@ CONFIG_SPL_WATCHDOG_SUPPORT=y
 # CONFIG_CMD_FLASH is not set
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_MMC=y
+# CONFIG_CMD_PINMUX is not set
 CONFIG_CMD_SATA=y
 CONFIG_CMD_USB=y
 CONFIG_CMD_CACHE=y
 CONFIG_CMD_EXT4_WRITE=y
 # CONFIG_SPL_PARTITION_UUIDS is not set
+CONFIG_OF_CONTROL=y
+CONFIG_DEFAULT_DEVICE_TREE="imx6dl-hummingboard2-emmc-som-v15"
+CONFIG_OF_LIST="imx6dl-hummingboard2-emmc-som-v15 imx6q-hummingboard2-emmc-som-v15"
+CONFIG_MULTI_DTB_FIT=y
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
+CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_DM=y
 CONFIG_DWC_AHSATA=y
+CONFIG_DM_GPIO=y
+CONFIG_DM_MMC=y
 CONFIG_FSL_USDHC=y
 CONFIG_PHYLIB=y
 CONFIG_MII=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_IMX6=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_FIXED=y
 CONFIG_DM_THERMAL=y
 CONFIG_USB=y
+CONFIG_DM_USB=y
 CONFIG_USB_KEYBOARD=y
 CONFIG_VIDEO_IPUV3=y
 CONFIG_VIDEO=y
 # CONFIG_VIDEO_SW_CURSOR is not set
-CONFIG_OF_LIBFDT=y
include/configs/mx6cuboxi.h +2 -4
index 3cf2f1ce28a0..b4f3a83a2ef4 100644
@@ -45,10 +45,7 @@
 #define CONFIG_IMX_VIDEO_SKIP
 
 /* USB */
-#define CONFIG_EHCI_HCD_INIT_AFTER_RESET
 #define CONFIG_MXC_USB_PORTSC		(PORT_PTS_UTMI | PORT_PTS_PTW)
-#define CONFIG_MXC_USB_FLAGS		0
-#define CONFIG_USB_MAX_CONTROLLER_COUNT	2
 
 /* Command definition */
 
@@ -108,7 +105,8 @@
 	BOOTENV
 
 #define BOOT_TARGET_DEVICES(func) \
-	func(MMC, mmc, 0) \
+	func(MMC, mmc, 1) \
+	func(MMC, mmc, 2) \
 	func(SATA, sata, 0) \
 	func(USB, usb, 0) \
 	func(PXE, pxe, na) \
Signature · 1 line
2.24.0
reviewer
#8 lore raw

PATCH v2 4/4 mx6cuboxi: enable OF_CONTROL with DM_MMC and DM_USB

Quoted 24 lines · Baruch Siach

Make first step in DT/DM migration. Enable OF_CONTROL only for the main U-Boot image for now.

Remove mmc_init_main() because board_mmc_init() is not called when DM_MMC is enabled.

DM_MMC requires DM_GPIO for card-detect to work. That in turn makes gpio request mandatory. Add code to request/free gpios in platform code.

MMC devices are now numbered according to DT. The SD card is 1, and eMMC is 2. Account for that in board_mmc_get_env_dev(), BOOT_TARGET_DEVICES, and has_emmc().

DM_MMC requires BLK. However, the (BLK && !DM_USB) combination disables USB_STORAGE. Enable DM_USB to preserve USB functionality. Add also DM_REGULATORS for the USB power controller. This allows us to drop board_ehci_hcd_init() and setup_usb().

Runtime selection of DT is necessary because of the i.MX6QD vs i.MX6SDL incompatibility. DT selection does not rely on GPIOs, since DM_GPIO depends on DT. Instead, we take one "fully featured" DT of each variant. That should be enough to boot from both SD card and eMMC.

Quoted 4 lines

Since we don't select the exact DT, override the generic show_board_info() that shows the selected DT 'model' field.

#9 lore raw

PATCH v2 4/4 mx6cuboxi: enable OF_CONTROL with DM_MMC and DM_USB

In reply to Baruch Siach
Quoted 19 lines

Make first step in DT/DM migration. Enable OF_CONTROL only for the main U-Boot image for now.
Remove mmc_init_main() because board_mmc_init() is not called when DM_MMC is enabled.
DM_MMC requires DM_GPIO for card-detect to work. That in turn makes gpio request mandatory. Add code to request/free gpios in platform code. MMC devices are now numbered according to DT. The SD card is 1, and eMMC is 2. Account for that in board_mmc_get_env_dev(), BOOT_TARGET_DEVICES, and has_emmc().
DM_MMC requires BLK. However, the (BLK && !DM_USB) combination disables USB_STORAGE. Enable DM_USB to preserve USB functionality. Add also DM_REGULATORS for the USB power controller. This allows us to drop board_ehci_hcd_init() and setup_usb().
Runtime selection of DT is necessary because of the i.MX6QD vs i.MX6SDL incompatibility. DT selection does not rely on GPIOs, since DM_GPIO depends on DT. Instead, we take one "fully featured" DT of each variant. That should be enough to boot from both SD card and eMMC. Since we don't select the exact DT, override the generic show_board_info() that shows the selected DT 'model' field.

Quoted 2 lines

Applied to u-boot-imx, -next, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#11 lore raw

PATCH v2 1/4 dt-bindings: add imx-audmux macro definitions

In reply to Baruch Siach
Quoted 6 lines

Import fsl-imx-audmux.h from Linux as of v5.4-rc6. The header is unchanged since v4.18.
That would make it easier to import DT files that depend on imx-audmux definitions from the kernel tree.

Applied to u-boot-imx, -next, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================