From patchwork Fri May 10 09:35:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Opaniuk X-Patchwork-Id: 1097931 X-Patchwork-Delegate: sbabic@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=quarantine dis=none) header.from=toradex.com Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 450lSW4t5Yz9sCJ for ; Fri, 10 May 2019 19:35:39 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id A6AF0C21DCA; Fri, 10 May 2019 09:35:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_MSPIKE_H2 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 5D535C21C29; Fri, 10 May 2019 09:35:32 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 88CFBC21BE5; Fri, 10 May 2019 09:35:31 +0000 (UTC) Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) by lists.denx.de (Postfix) with ESMTPS id 36FA0C21C29 for ; Fri, 10 May 2019 09:35:31 +0000 (UTC) Received: by mail-wm1-f67.google.com with SMTP id o189so6776241wmb.1 for ; Fri, 10 May 2019 02:35:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=+kro7vMIf4TX1GJPCowWphjoy140kiQlg7ZJ5F3VUp0=; b=VVBOeglTDnAB1qw3dMdl9WUNXraDc2Re8dFIf+FLaRpc2+uX1Us0/QC2HY0GTBYGPY j8SfAYIakJcTMl0PobIX1vCaRrU5zOtkGyWdtIxS57k0otXlOvhjJ+RPqh4CegrEK/uN UMERPxfHKVfR3rCmUDkTeDbpGU4PXAhAW4YKziJNyGpur6zNPeYCScOK6rAX7wJcwApr arAqFwbXUi47g6mH8U2fqaP6CD81cdAM81wtgTzPxPYPenAGnAzMFAVZYsVbeQs2V6YD CXMlYYk0GTB539aUpiatwOF3yLLIdJnRETDH4rnoV8chn7hqHtKyhKfYuD9GgkKB+6sy nE8Q== X-Gm-Message-State: APjAAAV4STWxB3Qi/xNFOGDfD2UmWyTrRAZU125T8CiA2TzSQvYKipFi dvSL7m1NhTiqSGoVo+E4rb54Mz2V X-Google-Smtp-Source: APXvYqzUoKN6g0xfPrmo7HwyIcySOfuxgaopJskTvk9QX/mkjAdCDoFqllUMDyG6wpD4h3kVTqhhVw== X-Received: by 2002:a1c:7507:: with SMTP id o7mr6571710wmc.87.1557480930552; Fri, 10 May 2019 02:35:30 -0700 (PDT) Received: from localhost ([194.105.145.90]) by smtp.gmail.com with ESMTPSA id 4sm6403904wrf.61.2019.05.10.02.35.29 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 10 May 2019 02:35:29 -0700 (PDT) From: Igor Opaniuk To: u-boot@lists.denx.de Date: Fri, 10 May 2019 12:35:29 +0300 Message-Id: <20190510093529.24885-1-igor.opaniuk@toradex.com> X-Mailer: git-send-email 2.17.1 Cc: marcel.ziswiler@toradex.com, marcel@ziswiler.com, max.krummenacher@toradex.com Subject: [U-Boot] [PATCH v4 1/1] colibri_imx7: migrate usb to driver model X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Migrate USB to Driver Model (CONFIG_DM_USB=y). Acked-by: Marcel Ziswiler Tested-by: Marcel Ziswiler Signed-off-by: Igor Opaniuk --- v4: - add a comment regarding usbotg1 that it can function in both host/otg modes - fix incorect symbol (seems it was mistakenly added while editing the description of changes in the patch), which caused parsing errors of DTS file for Colibri iMX7 NAND v3: - re-order usb nodes and add additional comments, as suggested by Marcel v2: - Drop vbus-supply property for usbotg1 node, as on Colibri the turning on of the USB host power is actually done purely in hardware based on the cable detect pin arch/arm/dts/imx7-colibri-emmc.dts | 45 +++++++++++++++++++++++++ arch/arm/dts/imx7-colibri-rawnand.dts | 48 +++++++++++++++++++++++++++ configs/colibri_imx7_defconfig | 1 + configs/colibri_imx7_emmc_defconfig | 1 + 4 files changed, 95 insertions(+) diff --git a/arch/arm/dts/imx7-colibri-emmc.dts b/arch/arm/dts/imx7-colibri-emmc.dts index efd600091d..deb5482e3e 100644 --- a/arch/arm/dts/imx7-colibri-emmc.dts +++ b/arch/arm/dts/imx7-colibri-emmc.dts @@ -13,11 +13,30 @@ aliases { mmc0 = &usdhc3; mmc1 = &usdhc1; + usb0 = &usbotg1; /* required for ums */ }; chosen { stdout-path = &uart1; }; + + reg_5v0: regulator-5v0 { + compatible = "regulator-fixed"; + regulator-name = "5V"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + }; + + reg_usbh_vbus: regulator-usbh-vbus { + compatible = "regulator-fixed"; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_usbh_reg>; + regulator-name = "VCC_USB[1-4]"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + gpio = <&gpio4 7 GPIO_ACTIVE_LOW>; + vin-supply = <®_5v0>; + }; }; &usdhc3 { @@ -44,4 +63,30 @@ MX7D_PAD_SD3_STROBE__SD3_STROBE 0x19 >; }; + + pinctrl_usbh_reg: gpio-usbh-vbus { + fsl,pins = < + MX7D_PAD_UART3_CTS_B__GPIO4_IO7 0x14 + >; + }; +}; + +/* Colibri USBC */ +&usbotg1 { + /* + * usbotg1 on Colibri iMX7 can function in both host/otg modes. + * Gadget stack currently does not look at this at all while + * the host stack refuses to bind/load if it is not set to host + * (it obviously won't be enumerated during usb start invocation + * if dr_mode = "otg") + */ + dr_mode = "host"; + status = "okay"; +}; + +/* Colibri USBH */ +&usbotg2 { + dr_mode = "host"; + vbus-supply = <®_usbh_vbus>; + status = "okay"; }; diff --git a/arch/arm/dts/imx7-colibri-rawnand.dts b/arch/arm/dts/imx7-colibri-rawnand.dts index 4eb86fb011..5f12a2ac2a 100644 --- a/arch/arm/dts/imx7-colibri-rawnand.dts +++ b/arch/arm/dts/imx7-colibri-rawnand.dts @@ -13,6 +13,28 @@ chosen { stdout-path = &uart1; }; + + aliases { + usb0 = &usbotg1; /* required for ums */ + }; + + reg_5v0: regulator-5v0 { + compatible = "regulator-fixed"; + regulator-name = "5V"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + }; + + reg_usbh_vbus: regulator-usbh-vbus { + compatible = "regulator-fixed"; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_usbh_reg>; + regulator-name = "VCC_USB[1-4]"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + gpio = <&gpio4 7 GPIO_ACTIVE_LOW>; + vin-supply = <®_5v0>; + }; }; &gpmi { @@ -43,4 +65,30 @@ MX7D_PAD_SD3_DATA7__NAND_DATA07 0x71 >; }; + + pinctrl_usbh_reg: gpio-usbh-vbus { + fsl,pins = < + MX7D_PAD_UART3_CTS_B__GPIO4_IO7 0x14 + >; + }; +}; + +/* Colibri USBC */ +&usbotg1 { + /* + * usbotg1 on Colibri iMX7 can function in both host/otg modes. + * Gadget stack currently does not look at this at all while + * the host stack refuses to bind/load if it is not set to host + * (it obviously won't be enumerated during usb start invocation + * if dr_mode = "otg") + */ + dr_mode = "host"; + status = "okay"; +}; + +/* Colibri USBH */ +&usbotg2 { + dr_mode = "host"; + vbus-supply = <®_usbh_vbus>; + status = "okay"; }; diff --git a/configs/colibri_imx7_defconfig b/configs/colibri_imx7_defconfig index 7a52361a2a..43af825d5c 100644 --- a/configs/colibri_imx7_defconfig +++ b/configs/colibri_imx7_defconfig @@ -62,6 +62,7 @@ CONFIG_PINCTRL=y CONFIG_PINCTRL_IMX7=y CONFIG_DM_PMIC=y CONFIG_PMIC_RN5T567=y +CONFIG_DM_USB=y CONFIG_USB=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_GADGET=y diff --git a/configs/colibri_imx7_emmc_defconfig b/configs/colibri_imx7_emmc_defconfig index 5e2a204a88..beec2704c5 100644 --- a/configs/colibri_imx7_emmc_defconfig +++ b/configs/colibri_imx7_emmc_defconfig @@ -64,3 +64,4 @@ CONFIG_USB_GADGET_DOWNLOAD=y CONFIG_VIDEO=y CONFIG_FAT_WRITE=y CONFIG_OF_LIBFDT_OVERLAY=y +CONFIG_DM_USB=y