mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Shengzhou Liu <Shengzhou.Liu@freescale.com>
To: <gregkh@linuxfoundation.org>, <linux-usb@vger.kernel.org>
Cc: <linux-kernel@vger.kernel.org>,
	Shengzhou Liu <Shengzhou.Liu@freescale.com>
Subject: [PATCH] powerpc/usb: fix usb CTRL_PHY_CLK_VALID breaks on some platform
Date: Sat, 25 Feb 2012 23:56:30 +0800	[thread overview]
Message-ID: <1330185390-30614-1-git-send-email-Shengzhou.Liu@freescale.com> (raw)

Fix checking of CTRL_PHY_CLK_VALID bit break on some platform on which
there is not USB CTRL_PHY_CLK_VALID bit.
  - P1023/P3041/P5020 etc,have this bit
  - P3060/4080/PSC913x do have this bit, but not mentioned in RM.
  - P1022(perhaps and other) has no this bit

Signed-off-by: Shengzhou Liu <Shengzhou.Liu@freescale.com>
---
 drivers/usb/host/ehci-fsl.c |   24 ++++++++++++++----------
 1 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c
index c26a82e..5ba3ea4 100644
--- a/drivers/usb/host/ehci-fsl.c
+++ b/drivers/usb/host/ehci-fsl.c
@@ -244,7 +244,11 @@ static int ehci_fsl_usb_setup(struct ehci_hcd *ehci)
 	struct usb_hcd *hcd = ehci_to_hcd(ehci);
 	struct fsl_usb2_platform_data *pdata;
 	void __iomem *non_ehci = hcd->regs;
-	u32 temp;
+	u32 temp, chip, rev, svr;
+
+	svr = mfspr(SPRN_SVR);
+	chip = svr >> 16;
+	rev = (svr >> 4) & 0xf;
 
 	pdata = hcd->self.controller->platform_data;
 
@@ -273,12 +277,6 @@ static int ehci_fsl_usb_setup(struct ehci_hcd *ehci)
 		ehci_fsl_setup_phy(ehci, pdata->phy_mode, 0);
 
 	if (pdata->operating_mode == FSL_USB2_MPH_HOST) {
-		unsigned int chip, rev, svr;
-
-		svr = mfspr(SPRN_SVR);
-		chip = svr >> 16;
-		rev = (svr >> 4) & 0xf;
-
 		/* Deal with USB Erratum #14 on MPC834x Rev 1.0 & 1.1 chips */
 		if ((rev == 1) && (chip >= 0x8050) && (chip <= 0x8055))
 			ehci->has_fsl_port_bug = 1;
@@ -300,9 +298,15 @@ static int ehci_fsl_usb_setup(struct ehci_hcd *ehci)
 		out_be32(non_ehci + FSL_SOC_USB_SICTRL, 0x00000001);
 	}
 
-	if (!(in_be32(non_ehci + FSL_SOC_USB_CTRL) & CTRL_PHY_CLK_VALID)) {
-		printk(KERN_WARNING "fsl-ehci: USB PHY clock invalid\n");
-		return -ENODEV;
+	/* There is no CTRL_PHY_CLK_VALID bit on some platforms, e.g. P1022 */
+#define SVR_P1022_N_ID 0x80E6
+#define SVR_P1022_S_ID 0x80EE
+	if (chip != SVR_P1022_N_ID && chip != SVR_P1022_S_ID) {
+		if (!(in_be32(non_ehci + FSL_SOC_USB_CTRL) &
+					CTRL_PHY_CLK_VALID)) {
+			printk(KERN_WARNING "fsl-ehci: USB PHY clock invalid\n");
+			return -ENODEV;
+		}
 	}
 	return 0;
 }
-- 
1.7.0.4



             reply	other threads:[~2012-02-25 16:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-25 15:56 Shengzhou Liu [this message]
2012-02-25 16:52 ` Greg KH
2012-02-27  2:19   ` Liu Shengzhou-B36685

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=1330185390-30614-1-git-send-email-Shengzhou.Liu@freescale.com \
    --to=shengzhou.liu@freescale.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /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®