From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3FE55C433EF for ; Mon, 20 Sep 2021 13:38:37 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 84B52601FC for ; Mon, 20 Sep 2021 13:38:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 84B52601FC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=ew.tq-group.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2F4CE8327E; Mon, 20 Sep 2021 15:38:23 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=ew.tq-group.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=tq-group.com header.i=@tq-group.com header.b="RyYKua3t"; dkim=pass (2048-bit key) header.d=tq-group.com header.i=@tq-group.com header.b="kHerpXt+"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EB73682BC4; Mon, 20 Sep 2021 15:38:15 +0200 (CEST) Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 7DEE982D5B for ; Mon, 20 Sep 2021 15:38:02 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=ew.tq-group.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=matthias.schiffer@ew.tq-group.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1632145082; x=1663681082; h=from:to:cc:subject:date:message-id; bh=oxjMgO5Nu55pXpZDCtj/PBprEQv8xnGttRdMKpBA91w=; b=RyYKua3tSUaPx81DVMrUzNOhsvCxOLNcOpUD6ftj7JQHbumgfQo8x4of bRYlMyEd906tSOqC/RUgW5xZKPOQTlkhGS72yrJKs78zNvWNpLPwaIdZE 2w05O1p8mLNixTwnywuXDSyd459tiIVFKKKy2kOrhdIqgQ/0pAPX70tkd 1Kq+6KlMSECJDnchk/IdZH3u3RHtVnnwUSfAGKmb3ZqnK+M0kCCIWgWLt ccoVPGSOBaxyDTzjXCwfhPR4r4TaIcfQCd/sc81fp4sWXAZU50+Qb2k9G l1JosC12ieDIIYrnmvjkhdljVaAx0olHOuMT43J9SMyaNlD2Bcs8YbfKG A==; X-IronPort-AV: E=Sophos;i="5.85,308,1624312800"; d="scan'208";a="19602995" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 20 Sep 2021 15:38:01 +0200 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Mon, 20 Sep 2021 15:38:01 +0200 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Mon, 20 Sep 2021 15:38:01 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1632145081; x=1663681081; h=from:to:cc:subject:date:message-id; bh=oxjMgO5Nu55pXpZDCtj/PBprEQv8xnGttRdMKpBA91w=; b=kHerpXt+afaKitx8VdQz3g4uBfr1xtH/rG2LH8UW+h2MXSI34vzFfrHd k40cjhDhSIEwraXQOLqD4va4hNvb7kr1U7XbQ+luJk6exZP1N3c76dzRi k4qYu+VA5vpBLJ286Xey3CgI37oDbOvt8cfDvBFMn8n6ScU3+xIgd0DbR qegV9N34nP0ROBFhhd2C6lyS1W2WMcfUDzhLXCAMfN0MqdSCNLAcWwM3I J0/FFlrgEz/dUoeMZahO4Ofg5Yx0RNWWLYvyw0vt9bWeFqyKLnu3cYlFH R5uFasvIIxwfiveuYWXXCAT9nsFi0wHTQiW2ZFNqMRlKcponNrQLmbUMi A==; X-IronPort-AV: E=Sophos;i="5.85,308,1624312800"; d="scan'208";a="19602994" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 20 Sep 2021 15:38:00 +0200 Received: from schifferm-ubuntu4.tq-net.de (schifferm-ubuntu4.tq-net.de [10.121.48.12]) by vtuxmail01.tq-net.de (Postfix) with ESMTPA id DEF18280070; Mon, 20 Sep 2021 15:38:00 +0200 (CEST) From: Matthias Schiffer To: u-boot@lists.denx.de Cc: Marek Vasut , uboot-imx@nxp.com, Matthias Schiffer Subject: [PATCH 4/4] usb: ehci-mx6: use phy_type from device tree Date: Mon, 20 Sep 2021 15:37:25 +0200 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: <749d8078bfb257195293d582be16edc276526142.1632144459.git.matthias.schiffer@ew.tq-group.com> References: <749d8078bfb257195293d582be16edc276526142.1632144459.git.matthias.schiffer@ew.tq-group.com> In-Reply-To: <749d8078bfb257195293d582be16edc276526142.1632144459.git.matthias.schiffer@ew.tq-group.com> References: <749d8078bfb257195293d582be16edc276526142.1632144459.git.matthias.schiffer@ew.tq-group.com> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean Allow using different PHY interfaces for multiple USB controllers. When no value is set in DT, we fall back to CONFIG_MXC_USB_PORTSC for now to stay compatible with current board configurations. This also adds support for the HSIC mode of the i.MX7. Signed-off-by: Markus Niebel Signed-off-by: Matthias Schiffer --- drivers/usb/host/ehci-mx6.c | 25 +++++++++++++++++++++++-- include/usb/ehci-ci.h | 1 + 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/drivers/usb/host/ehci-mx6.c b/drivers/usb/host/ehci-mx6.c index c3e4170513e..1bd6147c76a 100644 --- a/drivers/usb/host/ehci-mx6.c +++ b/drivers/usb/host/ehci-mx6.c @@ -23,6 +23,7 @@ #include #include #include +#include #include "ehci.h" @@ -435,6 +436,7 @@ struct ehci_mx6_priv_data { struct clk clk; struct phy phy; enum usb_init_type init_type; + enum usb_phy_interface phy_type; #if !defined(CONFIG_PHY) int portnr; void __iomem *phy_addr; @@ -443,6 +445,24 @@ struct ehci_mx6_priv_data { #endif }; +static u32 mx6_portsc(enum usb_phy_interface phy_type) +{ + switch (phy_type) { + case USBPHY_INTERFACE_MODE_UTMI: + return PORT_PTS_UTMI; + case USBPHY_INTERFACE_MODE_UTMIW: + return PORT_PTS_UTMI | PORT_PTS_PTW; + case USBPHY_INTERFACE_MODE_ULPI: + return PORT_PTS_ULPI; + case USBPHY_INTERFACE_MODE_SERIAL: + return PORT_PTS_SERIAL; + case USBPHY_INTERFACE_MODE_HSIC: + return PORT_PTS_HSIC; + default: + return CONFIG_MXC_USB_PORTSC; + } +} + static int mx6_init_after_reset(struct ehci_ctrl *dev) { struct ehci_mx6_priv_data *priv = dev->priv; @@ -479,7 +499,7 @@ static int mx6_init_after_reset(struct ehci_ctrl *dev) return 0; setbits_le32(&ehci->usbmode, CM_HOST); - writel(CONFIG_MXC_USB_PORTSC, &ehci->portsc); + writel(mx6_portsc(priv->phy_type), &ehci->portsc); setbits_le32(&ehci->portsc, USB_EN); mdelay(10); @@ -641,6 +661,7 @@ static int ehci_usb_probe(struct udevice *dev) priv->ehci = ehci; priv->init_type = type; + priv->phy_type = usb_get_phy_mode(dev_ofnode(dev)); #if CONFIG_IS_ENABLED(CLK) ret = clk_get_by_index(dev, 0, &priv->clk); @@ -690,7 +711,7 @@ static int ehci_usb_probe(struct udevice *dev) if (priv->init_type == USB_INIT_HOST) { setbits_le32(&ehci->usbmode, CM_HOST); - writel(CONFIG_MXC_USB_PORTSC, &ehci->portsc); + writel(mx6_portsc(priv->phy_type), &ehci->portsc); setbits_le32(&ehci->portsc, USB_EN); } diff --git a/include/usb/ehci-ci.h b/include/usb/ehci-ci.h index bf5d26faa53..2cdb3146e86 100644 --- a/include/usb/ehci-ci.h +++ b/include/usb/ehci-ci.h @@ -23,6 +23,7 @@ #define PORT_PTS_ULPI (2 << 30) #define PORT_PTS_SERIAL (3 << 30) #define PORT_PTS_PTW (1 << 28) +#define PORT_PTS_HSIC (1 << 25) #define PORT_PFSC (1 << 24) /* Defined on Page 39-44 of the mpc5151 ERM */ #define PORT_PTS_PHCD (1 << 23) #define PORT_PP (1 << 12) -- 2.17.1