Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1142114imu; Wed, 16 Jan 2019 13:31:13 -0800 (PST) X-Google-Smtp-Source: ALg8bN5FPrW/9tLk5zSDpHaXAUjb5SQqN0IJDSyQ9r3av6wI1lqa0AzjuvyAMrRwaKfnJWVZN6ou X-Received: by 2002:a63:c64f:: with SMTP id x15mr10641268pgg.16.1547674273332; Wed, 16 Jan 2019 13:31:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547674273; cv=none; d=google.com; s=arc-20160816; b=Hh0HkTnCuAWpRdPnOBqxhDjNc8AkT0veNNZzMjln8S5F/QBBZy7s0uVbLjmZ+iABgs Jo/EFbk6debAOs8aVsLK5k3SegEIEU9HWJ8sW/sHPy+9BoXDMEsUFac7j8c0+YhtgH17 IyopVshWXZ/OzmuwLCuOZVAwGXCYQNSSg8jwPdVxAoiIrhZazYOhzw+OSpRT5KNXddrM /1aDGVaL46HnHVM0Uj59DubdXXfopLVHw09Hufw6aNBgr9yIZnSelxCPL+sVt2pEmp4G yj8rxEmKNp9EYB58SVHWl2n4Q/rXqX0D4nllr6Tb0HvI4M4VnLTP1UP+AePKXz5T/YWZ TArQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=/Ptz6tlgxMPgbrkyaApFUB9arDkzoKfKH57nkSbXzIg=; b=r2n3SW8KjmtYEMutpnn6I5gDw2sfIWaOAO2q+JWyude3avLinBi2B3fNxSuJf9JAUO RhKRs36inSxYj5KaOhWuFJgdntUOXHf+UCAHoQ6AogcdPkrO2C61Yp8GDV9QYYt+8Yzx TG1cklGz50H52IjtOvs75v8FCKU4WvGfbq36v5rgD9VoqoGgImytqvfH/ry0Mw8483Av kqX398w+Y1nVthkxLATQJWnZQNcDkrUP23yFXqnvF1rT3XYEWr8ht4098KSLmVDeVGzc a9FXVEOda0ZeIkXS6PgNLSSSCP5b8KKHSPhKombkXM+YlEuJ7AB6pMuBCjyv6mhh6jlS vHTw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h96si7775465plb.230.2019.01.16.13.30.57; Wed, 16 Jan 2019 13:31:13 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392210AbfAPKvZ (ORCPT + 99 others); Wed, 16 Jan 2019 05:51:25 -0500 Received: from mx1.emlix.com ([46.4.235.150]:50086 "EHLO mx1.emlix.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389044AbfAPKvY (ORCPT ); Wed, 16 Jan 2019 05:51:24 -0500 Received: from mailer.emlix.com (unknown [81.20.119.6]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.emlix.com (Postfix) with ESMTPS id E062425EF98; Wed, 16 Jan 2019 11:51:21 +0100 (CET) From: Philipp Puschmann To: gregkh@linuxfoundation.org Cc: robh+dt@kernel.org, mark.rutland@arm.com, Peter.Chen@nxp.com, linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, philipp.puschmann@emlix.com Subject: [PATCH v2,2/2] usb: chipidea: imx: set power polarity Date: Wed, 16 Jan 2019 11:51:03 +0100 Message-Id: <20190116105103.28842-2-philipp.puschmann@emlix.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190116105103.28842-1-philipp.puschmann@emlix.com> References: <20190115123113.20577-1-philipp.puschmann@emlix.com> <20190116105103.28842-1-philipp.puschmann@emlix.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch adds support to set the power line polarity for i.MX6q/dl. To let the USB controller control the power it may be necessary to configure the polarity of the power line. So far the polarity was configured by Bootloader or alternatively the power line was muxed as gpio and driven by a regulator. Signed-off-by: Philipp Puschmann --- V2: fixed wrong variable name ... --- drivers/usb/chipidea/ci_hdrc_imx.c | 3 +++ drivers/usb/chipidea/ci_hdrc_imx.h | 1 + drivers/usb/chipidea/usbmisc_imx.c | 4 ++++ 3 files changed, 8 insertions(+) diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c index e81de9ca8729..32dc120680fa 100644 --- a/drivers/usb/chipidea/ci_hdrc_imx.c +++ b/drivers/usb/chipidea/ci_hdrc_imx.c @@ -152,6 +152,9 @@ static struct imx_usbmisc_data *usbmisc_get_init_data(struct device *dev) dev_warn(dev, "No over current polarity defined\n"); } + if (of_find_property(np, "power-active-high", NULL)) + data->pwr_pol = 1; + if (of_find_property(np, "external-vbus-divider", NULL)) data->evdo = 1; diff --git a/drivers/usb/chipidea/ci_hdrc_imx.h b/drivers/usb/chipidea/ci_hdrc_imx.h index 7cc53e2ce564..c842e03f8767 100644 --- a/drivers/usb/chipidea/ci_hdrc_imx.h +++ b/drivers/usb/chipidea/ci_hdrc_imx.h @@ -18,6 +18,7 @@ struct imx_usbmisc_data { /* true if dt specifies polarity */ unsigned int oc_pol_configured:1; + unsigned int pwr_pol:1; /* power polarity */ unsigned int evdo:1; /* set external vbus divider option */ unsigned int ulpi:1; /* connected to an ULPI phy */ unsigned int hsic:1; /* HSIC controlller */ diff --git a/drivers/usb/chipidea/usbmisc_imx.c b/drivers/usb/chipidea/usbmisc_imx.c index 097ffbca0bd9..64a7c7ff4b35 100644 --- a/drivers/usb/chipidea/usbmisc_imx.c +++ b/drivers/usb/chipidea/usbmisc_imx.c @@ -63,6 +63,7 @@ #define MX6_BM_NON_BURST_SETTING BIT(1) #define MX6_BM_OVER_CUR_DIS BIT(7) #define MX6_BM_OVER_CUR_POLARITY BIT(8) +#define MX6_BM_PWR_POLARITY BIT(9) #define MX6_BM_WAKEUP_ENABLE BIT(10) #define MX6_BM_UTMI_ON_CLOCK BIT(13) #define MX6_BM_ID_WAKEUP BIT(16) @@ -383,6 +384,9 @@ static int usbmisc_imx6q_init(struct imx_usbmisc_data *data) else if (data->oc_pol_configured) reg &= ~MX6_BM_OVER_CUR_POLARITY; } + /* If the polarity is not set keep it as setup by the bootlader */ + if (data->pwr_pol == 1) + reg |= MX6_BM_PWR_POLARITY; writel(reg, usbmisc->base + data->index * 4); /* SoC non-burst setting */ -- 2.20.1