From: marex@denx.de (Marek Vasut)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] usb: chipidea: improve the validation of endpoint count
Date: Wed, 16 May 2012 03:14:45 +0200 [thread overview]
Message-ID: <1337130885-32118-1-git-send-email-marex@denx.de> (raw)
In-Reply-To: <1337090303-16046-3-git-send-email-richard.zhao@freescale.com>
The endpoint count is zero for host-only controller. On the other hand,
the endpoint count is non-zero for OTG capable controller.
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Richard Zhao <richard.zhao@freescale.com>
Cc: alexander.shishkin at linux.intel.com
Cc: B20596 at freescale.com
Cc: B29397 at freescale.com
Cc: dong.aisheng at linaro.org
Cc: fabio.estevam at freescale.com
Cc: gregkh at linuxfoundation.org
Cc: kernel at pengutronix.de
Cc: linux-arm-kernel at lists.infradead.org
Cc: marex at denx.de
Cc: shawn.guo at linaro.org
To: linux-usb at vger.kernel.org
---
drivers/usb/chipidea/core.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index f568b8e..b29a204 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -174,6 +174,7 @@ u8 hw_port_test_get(struct ci13xxx *ci)
static int hw_device_init(struct ci13xxx *ci, void __iomem *base)
{
u32 reg;
+ int dc;
/* bank is a module variable */
ci->hw_bank.abs = base;
@@ -195,7 +196,12 @@ static int hw_device_init(struct ci13xxx *ci, void __iomem *base)
ffs_nr(DCCPARAMS_DEN);
ci->hw_ep_max = reg * 2; /* cache hw ENDPT_MAX */
- if (ci->hw_ep_max == 0 || ci->hw_ep_max > ENDPT_MAX)
+ dc = hw_read(ci, CAP_DCCPARAMS, DCCPARAMS_DC);
+
+ if (dc && (ci->hw_ep_max == 0 || ci->hw_ep_max > ENDPT_MAX))
+ return -ENODEV;
+
+ if (!dc && (ci->hw_ep_max != 0))
return -ENODEV;
dev_dbg(ci->dev, "ChipIdea HDRC found, lpm: %d; cap: %p op: %p\n",
--
1.7.10
next prev parent reply other threads:[~2012-05-16 1:14 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-15 13:58 [PATCH v1 0/7] preliminary work for adding imx6q_sabrelite usb support Richard Zhao
2012-05-15 13:58 ` [PATCH v1 1/7] usb: chipidea: permit user select USB_EHCI_ROOT_HUB_TT Richard Zhao
2012-05-15 14:27 ` Marek Vasut
2012-05-15 15:19 ` Greg KH
2012-05-16 1:03 ` Marek Vasut
2012-05-15 13:58 ` [PATCH v1 2/7] usb: chipidea: remove zero check of hw_ep_max Richard Zhao
2012-05-16 1:11 ` Marek Vasut
2012-05-16 1:14 ` Marek Vasut [this message]
2012-05-16 11:11 ` [PATCH] usb: chipidea: improve the validation of endpoint count Alexander Shishkin
2012-05-16 5:32 ` [PATCH v1 2/7] usb: chipidea: remove zero check of hw_ep_max Peter Chen
2012-05-16 5:46 ` Richard Zhao
2012-05-16 10:48 ` Alexander Shishkin
2012-05-15 13:58 ` [PATCH v1 3/7] usb: chipidea: add imx on-soc utmi phy driver Richard Zhao
2012-05-16 1:20 ` Marek Vasut
2012-05-15 13:58 ` [PATCH v1 4/7] usb: chipidea: add imx driver binding Richard Zhao
2012-05-15 14:03 ` Russell King - ARM Linux
2012-05-15 14:12 ` Richard Zhao
2012-05-16 8:36 ` Richard Zhao
2012-05-16 1:22 ` Marek Vasut
2012-05-16 11:38 ` Alexander Shishkin
2012-05-16 11:58 ` Felipe Balbi
2012-05-16 13:08 ` Richard Zhao
2012-05-16 14:18 ` Alexander Shishkin
2012-05-17 2:41 ` Richard Zhao
2012-05-15 13:58 ` [PATCH v1 5/7] ARM: imx6q: correct device name of usbphy and usboh3 clock export Richard Zhao
2012-05-15 13:58 ` [PATCH v1 6/7] ARM: imx6q: add anatop initialization for usb controllers Richard Zhao
2012-05-15 13:58 ` [PATCH v1 7/7] ARM: dts: imx6q-sabrelite: add usb devices Richard Zhao
2012-05-15 14:28 ` [PATCH v1 0/7] preliminary work for adding imx6q_sabrelite usb support Marek Vasut
2012-05-15 15:21 ` Greg KH
2012-05-15 16:30 ` Marek Vasut
2012-05-16 0:37 ` Richard Zhao
2012-05-16 8:34 ` Peter Chen
2012-05-16 13:22 ` Marek Vasut
2012-05-16 15:05 ` Shawn Guo
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=1337130885-32118-1-git-send-email-marex@denx.de \
--to=marex@denx.de \
--cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).