All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tim Harvey <tharvey@gateworks.com>
To: u-boot@lists.denx.de
Subject: [PATCH 08/11] imx: ventana: enable dm support for USB
Date: Mon,  1 Mar 2021 14:33:34 -0800	[thread overview]
Message-ID: <20210301223337.7763-9-tharvey@gateworks.com> (raw)
In-Reply-To: <20210301223337.7763-1-tharvey@gateworks.com>

Enable dm support for USB (which also requires dm support for fixed
regulators used for vbus enable) and remove usb iomux which is no
longer needed.

We can remove the handling of otgpwr_en gpio as this is defined in
dt as usbotg vbus-supply but we need to keep the handling of
USB_HUB_RST# for boards that have a USB HUB as that isn't defined in
the dt's currently.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
---
 board/gateworks/gw_ventana/common.c     | 17 -----------------
 board/gateworks/gw_ventana/common.h     |  1 -
 board/gateworks/gw_ventana/gw_ventana.c | 22 ++++------------------
 configs/gwventana_emmc_defconfig        |  3 +++
 configs/gwventana_gw5904_defconfig      |  3 +++
 configs/gwventana_nand_defconfig        |  3 +++
 include/configs/gw_ventana.h            |  1 -
 7 files changed, 13 insertions(+), 37 deletions(-)

diff --git a/board/gateworks/gw_ventana/common.c b/board/gateworks/gw_ventana/common.c
index 14f45bf07d..4627a156fe 100644
--- a/board/gateworks/gw_ventana/common.c
+++ b/board/gateworks/gw_ventana/common.c
@@ -970,7 +970,6 @@ struct ventana gpio_cfg[GW_UNKNOWN] = {
 		.rs485en = IMX_GPIO_NR(3, 24),
 		.dioi2c_en = IMX_GPIO_NR(4,  5),
 		.pcie_sson = IMX_GPIO_NR(1, 20),
-		.otgpwr_en = IMX_GPIO_NR(3, 22),
 		.mmc_cd = IMX_GPIO_NR(7, 0),
 	},
 
@@ -990,7 +989,6 @@ struct ventana gpio_cfg[GW_UNKNOWN] = {
 		.gps_shdn = IMX_GPIO_NR(1, 2),
 		.vidin_en = IMX_GPIO_NR(5, 20),
 		.wdis = IMX_GPIO_NR(7, 12),
-		.otgpwr_en = IMX_GPIO_NR(3, 22),
 		.nand = true,
 	},
 
@@ -1014,7 +1012,6 @@ struct ventana gpio_cfg[GW_UNKNOWN] = {
 		.wdis = IMX_GPIO_NR(7, 12),
 		.msata_en = GP_MSATA_SEL,
 		.rs232_en = GP_RS232_EN,
-		.otgpwr_en = IMX_GPIO_NR(3, 22),
 		.vsel_pin = IMX_GPIO_NR(6, 14),
 		.mmc_cd = IMX_GPIO_NR(7, 0),
 		.nand = true,
@@ -1039,7 +1036,6 @@ struct ventana gpio_cfg[GW_UNKNOWN] = {
 		.wdis = IMX_GPIO_NR(7, 12),
 		.msata_en = GP_MSATA_SEL,
 		.rs232_en = GP_RS232_EN,
-		.otgpwr_en = IMX_GPIO_NR(3, 22),
 		.vsel_pin = IMX_GPIO_NR(6, 14),
 		.mmc_cd = IMX_GPIO_NR(7, 0),
 		.nand = true,
@@ -1066,7 +1062,6 @@ struct ventana gpio_cfg[GW_UNKNOWN] = {
 		.wdis = IMX_GPIO_NR(5, 17),
 		.msata_en = GP_MSATA_SEL,
 		.rs232_en = GP_RS232_EN,
-		.otgpwr_en = IMX_GPIO_NR(3, 22),
 		.vsel_pin = IMX_GPIO_NR(6, 14),
 		.mmc_cd = IMX_GPIO_NR(7, 0),
 		.nand = true,
@@ -1117,7 +1112,6 @@ struct ventana gpio_cfg[GW_UNKNOWN] = {
 		.pcie_rst = IMX_GPIO_NR(1, 0),
 		.vidin_en = IMX_GPIO_NR(5, 20),
 		.wdis = IMX_GPIO_NR(7, 12),
-		.otgpwr_en = IMX_GPIO_NR(3, 22),
 		.vsel_pin = IMX_GPIO_NR(6, 14),
 		.mmc_cd = IMX_GPIO_NR(7, 0),
 		.nand = true,
@@ -1140,7 +1134,6 @@ struct ventana gpio_cfg[GW_UNKNOWN] = {
 		.rs232_en = GP_RS232_EN,
 		.vidin_en = IMX_GPIO_NR(3, 31),
 		.wdis = IMX_GPIO_NR(7, 12),
-		.otgpwr_en = IMX_GPIO_NR(4, 15),
 		.mmc_cd = IMX_GPIO_NR(7, 0),
 	},
 
@@ -1166,7 +1159,6 @@ struct ventana gpio_cfg[GW_UNKNOWN] = {
 		},
 		.pcie_rst = IMX_GPIO_NR(1, 0),
 		.rs232_en = GP_RS232_EN,
-		.otgpwr_en = IMX_GPIO_NR(3, 23),
 		.nand = true,
 	},
 
@@ -1179,7 +1171,6 @@ struct ventana gpio_cfg[GW_UNKNOWN] = {
 		.leds = {
 			IMX_GPIO_NR(6, 14),
 		},
-		.otgpwr_en = IMX_GPIO_NR(4, 15),
 		.mmc_cd = IMX_GPIO_NR(6, 11),
 	},
 
@@ -1197,7 +1188,6 @@ struct ventana gpio_cfg[GW_UNKNOWN] = {
 		.pcie_rst = IMX_GPIO_NR(1, 0),
 		.mezz_pwren = IMX_GPIO_NR(2, 19),
 		.mezz_irq = IMX_GPIO_NR(2, 18),
-		.otgpwr_en = IMX_GPIO_NR(3, 22),
 	},
 
 	/* GW5905 */
@@ -1279,7 +1269,6 @@ struct ventana gpio_cfg[GW_UNKNOWN] = {
 		.pcie_rst = IMX_GPIO_NR(1, 0),
 		.mezz_pwren = IMX_GPIO_NR(2, 19),
 		.mezz_irq = IMX_GPIO_NR(2, 18),
-		.otgpwr_en = IMX_GPIO_NR(3, 22),
 	},
 };
 
@@ -1382,12 +1371,6 @@ void setup_iomux_gpio(int board, struct ventana_board_info *info)
 		gpio_direction_output(gpio_cfg[board].wdis, 1);
 	}
 
-	/* OTG power off */
-	if (gpio_cfg[board].otgpwr_en) {
-		gpio_request(gpio_cfg[board].otgpwr_en, "usbotg_pwr");
-		gpio_direction_output(gpio_cfg[board].otgpwr_en, 0);
-	}
-
 	/* sense vselect pin to see if we support uhs-i */
 	if (gpio_cfg[board].vsel_pin) {
 		gpio_request(gpio_cfg[board].vsel_pin, "sd3_vselect");
diff --git a/board/gateworks/gw_ventana/common.h b/board/gateworks/gw_ventana/common.h
index 5cec01c838..d73850c5b9 100644
--- a/board/gateworks/gw_ventana/common.h
+++ b/board/gateworks/gw_ventana/common.h
@@ -75,7 +75,6 @@ struct ventana {
 	int wdis;
 	int msata_en;
 	int rs232_en;
-	int otgpwr_en;
 	int vsel_pin;
 	int mmc_cd;
 	/* various features */
diff --git a/board/gateworks/gw_ventana/gw_ventana.c b/board/gateworks/gw_ventana/gw_ventana.c
index 3daeb85a2d..78dee5723d 100644
--- a/board/gateworks/gw_ventana/gw_ventana.c
+++ b/board/gateworks/gw_ventana/gw_ventana.c
@@ -141,18 +141,14 @@ static void setup_iomux_enet(int gpio)
 }
 
 #ifdef CONFIG_USB_EHCI_MX6
-static iomux_v3_cfg_t const usb_pads[] = {
-	IOMUX_PADS(PAD_GPIO_1__USB_OTG_ID   | DIO_PAD_CFG),
-	IOMUX_PADS(PAD_KEY_COL4__USB_OTG_OC | DIO_PAD_CFG),
-	/* OTG PWR */
-	IOMUX_PADS(PAD_EIM_D22__GPIO3_IO22  | DIO_PAD_CFG),
-};
-
+/* toggle USB_HUB_RST# for boards that have it; it is not defined in dt */
 int board_ehci_hcd_init(int port)
 {
 	int gpio;
 
-	SETUP_IOMUX_PADS(usb_pads);
+	/* USB HUB is always on P1 */
+	if (port == 0)
+		return 0;
 
 	/* Reset USB HUB */
 	switch (board_type) {
@@ -177,16 +173,6 @@ int board_ehci_hcd_init(int port)
 
 	return 0;
 }
-
-int board_ehci_power(int port, int on)
-{
-	/* enable OTG VBUS */
-	if (!port && board_type < GW_UNKNOWN) {
-		if (gpio_cfg[board_type].otgpwr_en)
-			gpio_set_value(gpio_cfg[board_type].otgpwr_en, on);
-	}
-	return 0;
-}
 #endif /* CONFIG_USB_EHCI_MX6 */
 
 #ifdef CONFIG_MXC_SPI
diff --git a/configs/gwventana_emmc_defconfig b/configs/gwventana_emmc_defconfig
index 433de5ece3..696f49ca8a 100644
--- a/configs/gwventana_emmc_defconfig
+++ b/configs/gwventana_emmc_defconfig
@@ -89,12 +89,15 @@ CONFIG_MII=y
 CONFIG_PCI=y
 CONFIG_PINCTRL=y
 CONFIG_PINCTRL_IMX6=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_FIXED=y
 CONFIG_CONS_INDEX=2
 CONFIG_DM_SERIAL=y
 CONFIG_MXC_UART=y
 CONFIG_DM_THERMAL=y
 CONFIG_IMX_THERMAL=y
 CONFIG_USB=y
+CONFIG_DM_USB=y
 CONFIG_USB_STORAGE=y
 CONFIG_USB_KEYBOARD=y
 CONFIG_SYS_USB_EVENT_POLL_VIA_CONTROL_EP=y
diff --git a/configs/gwventana_gw5904_defconfig b/configs/gwventana_gw5904_defconfig
index 4fd734e260..0e697017b1 100644
--- a/configs/gwventana_gw5904_defconfig
+++ b/configs/gwventana_gw5904_defconfig
@@ -93,12 +93,15 @@ CONFIG_MII=y
 CONFIG_PCI=y
 CONFIG_PINCTRL=y
 CONFIG_PINCTRL_IMX6=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_FIXED=y
 CONFIG_CONS_INDEX=2
 CONFIG_DM_SERIAL=y
 CONFIG_MXC_UART=y
 CONFIG_DM_THERMAL=y
 CONFIG_IMX_THERMAL=y
 CONFIG_USB=y
+CONFIG_DM_USB=y
 CONFIG_USB_STORAGE=y
 CONFIG_USB_KEYBOARD=y
 CONFIG_SYS_USB_EVENT_POLL_VIA_CONTROL_EP=y
diff --git a/configs/gwventana_nand_defconfig b/configs/gwventana_nand_defconfig
index 5d8126e977..9b204c7263 100644
--- a/configs/gwventana_nand_defconfig
+++ b/configs/gwventana_nand_defconfig
@@ -93,12 +93,15 @@ CONFIG_MII=y
 CONFIG_PCI=y
 CONFIG_PINCTRL=y
 CONFIG_PINCTRL_IMX6=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_FIXED=y
 CONFIG_CONS_INDEX=2
 CONFIG_DM_SERIAL=y
 CONFIG_MXC_UART=y
 CONFIG_DM_THERMAL=y
 CONFIG_IMX_THERMAL=y
 CONFIG_USB=y
+CONFIG_DM_USB=y
 CONFIG_USB_STORAGE=y
 CONFIG_USB_KEYBOARD=y
 CONFIG_SYS_USB_EVENT_POLL_VIA_CONTROL_EP=y
diff --git a/include/configs/gw_ventana.h b/include/configs/gw_ventana.h
index 7c8abda1d2..1d68abda59 100644
--- a/include/configs/gw_ventana.h
+++ b/include/configs/gw_ventana.h
@@ -100,7 +100,6 @@
 #define CONFIG_ARP_TIMEOUT       200UL
 
 /* USB Configs */
-#define CONFIG_USB_MAX_CONTROLLER_COUNT 2
 #define CONFIG_EHCI_HCD_INIT_AFTER_RESET  /* For OTG port */
 #define CONFIG_MXC_USB_PORTSC     (PORT_PTS_UTMI | PORT_PTS_PTW)
 #define CONFIG_MXC_USB_FLAGS      0
-- 
2.17.1

  parent reply	other threads:[~2021-03-01 22:33 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-01 22:33 [PATCH 00/11] imx: ventana: convert Gateworks Ventana to dm Tim Harvey
2021-03-01 22:33 ` [PATCH 01/11] spl: fit: nand: skip bad block handling if NAND chip not fully defined Tim Harvey
2021-03-02 13:28   ` Tom Rini
2021-04-08 20:57   ` sbabic at denx.de
2021-03-01 22:33 ` [PATCH 02/11] spl: fit: nand: allow for non-page-aligned elements Tim Harvey
2021-03-02 13:28   ` Tom Rini
2021-04-08 20:58   ` sbabic at denx.de
2021-03-01 22:33 ` [PATCH 03/11] dt-bindings: add tda1997x and bindings Tim Harvey
2021-03-02 13:28   ` Tom Rini
2021-04-08 20:57   ` sbabic at denx.de
2021-03-01 22:33 ` [PATCH 04/11] imx: ventana: add Gateworks Ventana dts Tim Harvey
2021-04-08 20:57   ` sbabic at denx.de
2021-03-01 22:33 ` [PATCH 05/11] arm: dts: imx6qdl-gw*: add dr_mode prop to dt to avoid error Tim Harvey
2021-04-05 21:27   ` Peter Robinson
2021-04-05 23:46     ` Tim Harvey
2021-04-08 20:57   ` sbabic at denx.de
2021-03-01 22:33 ` [PATCH 06/11] imx: ventana: convert U-Boot to OF_CONTROL using FIT image Tim Harvey
2021-04-08 20:57   ` sbabic at denx.de
     [not found]   ` <606f6e37.1c69fb81.a6d7.559aSMTPIN_ADDED_MISSING@mx.google.com>
2021-04-09 19:52     ` Tim Harvey
2021-04-09 20:00       ` Stefano Babic
2021-04-09 20:08         ` Tim Harvey
2021-04-09 20:14           ` Tim Harvey
2021-04-10  0:32             ` Tim Harvey
2021-03-01 22:33 ` [PATCH 07/11] imx: ventana: add pinctrl and remove unneeded UART init and config Tim Harvey
2021-04-08 20:57   ` sbabic at denx.de
2021-03-01 22:33 ` Tim Harvey [this message]
2021-04-08 20:59   ` [PATCH 08/11] imx: ventana: enable dm support for USB sbabic at denx.de
2021-03-01 22:33 ` [PATCH 09/11] imx: ventana: enable dm support for MMC and SATA Tim Harvey
2021-03-01 22:48   ` Peter Robinson
2021-03-02  0:19     ` Fabio Estevam
2021-03-02  1:41       ` Tim Harvey
2021-03-02 13:28         ` Tom Rini
2021-03-03  1:15     ` Kever Yang
2021-04-08 20:58   ` sbabic at denx.de
2021-03-01 22:33 ` [PATCH 10/11] imx: ventana: enable dm for MTD and NAND Tim Harvey
2021-04-08 20:59   ` sbabic at denx.de
2021-03-01 22:33 ` [PATCH 11/11] imx: ventana: enable dm for SPI Tim Harvey
2021-04-08 20:57   ` sbabic at denx.de
2021-03-25 13:59 ` [PATCH 00/11] imx: ventana: convert Gateworks Ventana to dm Tim Harvey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210301223337.7763-9-tharvey@gateworks.com \
    --to=tharvey@gateworks.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.