mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ramneek Mehresh <ramneek.mehresh@freescale.com>
To: <linux-kernel@vger.kernel.org>
Cc: <balbi@ti.com>, <stern@rowland.harvard.edu>,
	<gregkh@linuxfoundation.org>, <linux-usb@vger.kernel.org>,
	Ramneek Mehresh <ramneek.mehresh@freescale.com>,
	Shengzhou Liu <Shengzhou.Liu@freescale.com>
Subject: [PATCH 2/7][v5]usb:fsl:otg: Add controller version based ULPI and UTMI phy
Date: Mon, 28 Dec 2015 16:42:29 +0530	[thread overview]
Message-ID: <1451301154-14422-3-git-send-email-ramneek.mehresh@freescale.com> (raw)
In-Reply-To: <1451301154-14422-1-git-send-email-ramneek.mehresh@freescale.com>

Add controller version based ULPI and UTMI phy
initialization for otg driver.

Signed-off-by: Shengzhou Liu <Shengzhou.Liu@freescale.com>
Signed-off-by: Ramneek Mehresh <ramneek.mehresh@freescale.com>
Reviewed-by: Fleming Andrew-AFLEMING <AFLEMING@freescale.com>
Tested-by: Fleming Andrew-AFLEMING <AFLEMING@freescale.com>
---
 drivers/usb/phy/phy-fsl-usb.c | 20 ++++++++++++++++++++
 drivers/usb/phy/phy-fsl-usb.h |  7 +++++++
 2 files changed, 27 insertions(+)

diff --git a/drivers/usb/phy/phy-fsl-usb.c b/drivers/usb/phy/phy-fsl-usb.c
index 94eb292..4e58aee 100644
--- a/drivers/usb/phy/phy-fsl-usb.c
+++ b/drivers/usb/phy/phy-fsl-usb.c
@@ -923,12 +923,32 @@ int usb_otg_start(struct platform_device *pdev)
 	temp &= ~(PORTSC_PHY_TYPE_SEL | PORTSC_PTW);
 	switch (pdata->phy_mode) {
 	case FSL_USB2_PHY_ULPI:
+		if (pdata->controller_ver) {
+			/* controller version 1.6 or above */
+			setbits32(&p_otg->dr_mem_map->control,
+				USB_CTRL_ULPI_PHY_CLK_SEL);
+			/*
+			 * Due to controller issue of PHY_CLK_VALID in ULPI
+			 * mode, set USB_CTRL_USB_EN before checking
+			 * PHY_CLK_VALID, otherwise PHY_CLK_VALID doesn't work
+			 */
+			clrsetbits_be32(&p_otg->dr_mem_map->control,
+				USB_CTRL_UTMI_PHY_EN, USB_CTRL_IOENB);
+		}
 		temp |= PORTSC_PTS_ULPI;
 		break;
 	case FSL_USB2_PHY_UTMI_WIDE:
 		temp |= PORTSC_PTW_16BIT;
 		/* fall through */
 	case FSL_USB2_PHY_UTMI:
+		if (pdata->controller_ver) {
+			/* controller version 1.6 or above */
+			setbits32(&p_otg->dr_mem_map->control,
+				USB_CTRL_UTMI_PHY_EN);
+			/* Delay for UTMI PHY CLK to become stable - 10ms */
+			mdelay(FSL_UTMI_PHY_DLY);
+		}
+		setbits32(&p_otg->dr_mem_map->control, USB_CTRL_UTMI_PHY_EN);
 		temp |= PORTSC_PTS_UTMI;
 		/* fall through */
 	default:
diff --git a/drivers/usb/phy/phy-fsl-usb.h b/drivers/usb/phy/phy-fsl-usb.h
index 2314995..4a78fb3 100644
--- a/drivers/usb/phy/phy-fsl-usb.h
+++ b/drivers/usb/phy/phy-fsl-usb.h
@@ -199,6 +199,13 @@
 /* control Register Bit Masks */
 #define  USB_CTRL_IOENB			(0x1<<2)
 #define  USB_CTRL_ULPI_INT0EN		(0x1<<0)
+#define  USB_CTRL_WU_INT_EN		(0x1<<1)
+#define  USB_CTRL_LINE_STATE_FILTER__EN	(0x1<<3)
+#define  USB_CTRL_KEEP_OTG_ON		(0x1<<4)
+#define  USB_CTRL_OTG_PORT		(0x1<<5)
+#define  USB_CTRL_PLL_RESET		(0x1<<8)
+#define  USB_CTRL_UTMI_PHY_EN		(0x1<<9)
+#define  USB_CTRL_ULPI_PHY_CLK_SEL	(0x1<<10)
 
 /* BCSR5 */
 #define BCSR5_INT_USB			(0x02)
-- 
1.8.3.1


  parent reply	other threads:[~2015-12-28 10:56 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-28 11:12 [PATCH 0/7][v5]Add OTG support for FSL socs Ramneek Mehresh
2015-12-28 11:12 ` [PATCH 1/7][v5]usb:fsl:otg: Make fsl otg driver as tristate Ramneek Mehresh
2015-12-28 11:12 ` Ramneek Mehresh [this message]
2015-12-28 11:12 ` [PATCH 3/7][v5]usb:fsl:otg: Add support to add/remove usb host driver Ramneek Mehresh
2015-12-28 11:12 ` [PATCH 4/7][v5]usb:fsl:otg: Signal host drv when host is otg Ramneek Mehresh
2015-12-28 11:12 ` [PATCH 5/7][v5]usb:fsl:otg: Modify otg_event to start host drv Ramneek Mehresh
2015-12-28 11:12 ` [PATCH 6/7][v5]usb:fsl:otg: Combine host/gadget start/resume for ID change Ramneek Mehresh
2015-12-28 11:12 ` [PATCH 7/7][v5]usb:fsl:otg: Add host-gadget drv sync delay Ramneek Mehresh
2016-01-14  7:02 ` [PATCH 0/7][v5]Add OTG support for FSL socs Ramneek Mehresh
2016-02-08  9:18 ` Ramneek Mehresh
2016-02-11 22:51   ` Li Yang
2016-02-17 14:17     ` Felipe Balbi

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=1451301154-14422-3-git-send-email-ramneek.mehresh@freescale.com \
    --to=ramneek.mehresh@freescale.com \
    --cc=Shengzhou.Liu@freescale.com \
    --cc=balbi@ti.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®