From patchwork Tue Dec 4 08:31:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 10711301 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0220B15A6 for ; Tue, 4 Dec 2018 08:32:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EB25F2A50D for ; Tue, 4 Dec 2018 08:32:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DE9A22A516; Tue, 4 Dec 2018 08:32:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 801592A50D for ; Tue, 4 Dec 2018 08:32:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=j3VxoZBJmhn6xu51oDCWGAK7aJC1Tcwza8diHXBxbYo=; b=egNtSY+KXjvc8C BZ6asoantatd25oZSxQdSmekeBRlYPVKHuOp0UP2eCtfE+HUilq4P8340Or8iiJxbMzgmt9/7/66G KkSW22d/ZtIswOpQucMBNOjuxLs3Am198lkOfLhy7iKCsYasZkDsAHxEJH307sJZ56UJqpqK5tMPG VeRUL+a7DX7tkYVEhkYS2LPTG+p3UxdMB3KT7clqsYuS9jf16Dokf/YLY8PB+1qZi67Sb+dgBA2ji qa629BaqayurBgFvW7MRVc3QYFTk3/UVOY/Dtv1eTHVweu9bTXKz7WpOPgjqpvYUDpqJ2ESkj3c6X dUl8TXd1TgKPnK+/MGMg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gU67e-0000Dy-DT; Tue, 04 Dec 2018 08:32:02 +0000 Received: from antares.kleine-koenig.org ([94.130.110.236]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gU67Q-0008Uj-Vd for linux-arm-kernel@lists.infradead.org; Tue, 04 Dec 2018 08:31:50 +0000 Received: by antares.kleine-koenig.org (Postfix, from userid 1000) id 757214BD016; Tue, 4 Dec 2018 09:31:40 +0100 (CET) From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Peter Chen , Shawn Guo Subject: [PATCH v3 3/3] usb: chipidea: imx: allow to configure oc polarity on i.MX25 Date: Tue, 4 Dec 2018 09:31:31 +0100 Message-Id: <20181204083131.12524-4-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181204083131.12524-1-u.kleine-koenig@pengutronix.de> References: <20181204083131.12524-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181204_003149_193406_3EF99740 X-CRM114-Status: GOOD ( 10.01 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fabio Estevam , linux-usb@vger.kernel.org, kernel@pengutronix.de, Matthew Starr , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Up to now the polarity of the over current pin was hard coded to active high. Use the already defined device tree properties to configure polarity on i.MX25, too. In difference to i.MX6/7 use active high behavior if the polarity is unspecified to keep compatibility to existing device trees. Signed-off-by: Uwe Kleine-König --- drivers/usb/chipidea/usbmisc_imx.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/usb/chipidea/usbmisc_imx.c b/drivers/usb/chipidea/usbmisc_imx.c index 4a8de1b37f67..47eee5cade84 100644 --- a/drivers/usb/chipidea/usbmisc_imx.c +++ b/drivers/usb/chipidea/usbmisc_imx.c @@ -120,6 +120,14 @@ static int usbmisc_imx25_init(struct imx_usbmisc_data *data) val &= ~(MX25_OTG_SIC_MASK | MX25_OTG_PP_BIT); val |= (MX25_EHCI_INTERFACE_DIFF_UNI & MX25_EHCI_INTERFACE_MASK) << MX25_OTG_SIC_SHIFT; val |= (MX25_OTG_PM_BIT | MX25_OTG_OCPOL_BIT); + + /* + * If the polarity is not configured assume active high for + * historical reasons. + */ + if (data->oc_pol_configured && data->oc_pol_active_low) + val &= ~MX25_OTG_OCPOL_BIT; + writel(val, usbmisc->base); break; case 1: @@ -129,6 +137,13 @@ static int usbmisc_imx25_init(struct imx_usbmisc_data *data) val |= (MX25_H1_PM_BIT | MX25_H1_OCPOL_BIT | MX25_H1_TLL_BIT | MX25_H1_USBTE_BIT | MX25_H1_IPPUE_DOWN_BIT); + /* + * If the polarity is not configured assume active high for + * historical reasons. + */ + if (data->oc_pol_configured && data->oc_pol_active_low) + val &= ~MX25_H1_OCPOL_BIT; + writel(val, usbmisc->base); break;