From: Kuo-Jung Su <dantesu@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 1/2] usb: gadget: fotg210: add w1c interrupt status support
Date: Fri, 20 Dec 2013 12:32:59 +0800 [thread overview]
Message-ID: <1387513980-2052-2-git-send-email-dantesu@gmail.com> (raw)
In-Reply-To: <1387513980-2052-1-git-send-email-dantesu@gmail.com>
From: Kuo-Jung Su <dantesu@faraday-tech.com>
Since hardware revision 1.11.0, the following interrupt status
registers are now W1C (i.e., write 1 clear):
1. Interrupt Source Group 0 Register (0x144) (EP0 Abort: BIT5)
2. Interrupt Source Group 2 Register (0x14C) (All bits)
And before revision 1.11.0, these registers are all R/W.
Which means software must write a 0 to clear the status.
Signed-off-by: Kuo-Jung Su <dantesu@faraday-tech.com>
CC: Marek Vasut <marex@denx.de>
---
Changes for v2:
- By writting 1 then 0 to get rid of the use of
CONFIG_USB_GADGET_FOTG210_ISRW1C.
Thanks for Marek's comments.
drivers/usb/gadget/fotg210.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/drivers/usb/gadget/fotg210.c b/drivers/usb/gadget/fotg210.c
index 6e19db1..cc5c507 100644
--- a/drivers/usb/gadget/fotg210.c
+++ b/drivers/usb/gadget/fotg210.c
@@ -847,6 +847,13 @@ int usb_gadget_handle_interrupts(void)
/* CX interrupts */
if (gisr & GISR_GRP0) {
st = readl(®s->gisr0);
+ /*
+ * Write 1 and then 0 works for both W1C & RW.
+ *
+ * HW v1.11.0+: It's a W1C register (write 1 clear)
+ * HW v1.10.0-: It's a R/W register (write 0 clear)
+ */
+ writel(st & GISR0_CXABORT, ®s->gisr0);
writel(0, ®s->gisr0);
if (st & GISR0_CXERR)
@@ -873,6 +880,13 @@ int usb_gadget_handle_interrupts(void)
/* Device Status Interrupts */
if (gisr & GISR_GRP2) {
st = readl(®s->gisr2);
+ /*
+ * Write 1 and then 0 works for both W1C & RW.
+ *
+ * HW v1.11.0+: It's a W1C register (write 1 clear)
+ * HW v1.10.0-: It's a R/W register (write 0 clear)
+ */
+ writel(st, ®s->gisr2);
writel(0, ®s->gisr2);
if (st & GISR2_RESET)
--
1.7.9.5
next prev parent reply other threads:[~2013-12-20 4:32 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-18 7:24 [U-Boot] [PATCH 0/2] usb: gadget: fotg210: workaround & new hardware support Kuo-Jung Su
2013-12-18 7:24 ` [U-Boot] [PATCH 1/2] usb: gadget: fotg210: add w1c interrupt status support Kuo-Jung Su
2013-12-18 14:54 ` Marek Vasut
2013-12-19 0:54 ` Kuo-Jung Su
2013-12-19 1:53 ` Marek Vasut
2013-12-19 7:10 ` Kuo-Jung Su
2013-12-19 7:17 ` Marek Vasut
2013-12-18 7:24 ` [U-Boot] [PATCH 2/2] usb: gadget: fotg210: EP0 fifo empty indication is non-reliable Kuo-Jung Su
2013-12-18 14:55 ` Marek Vasut
2013-12-19 0:50 ` Kuo-Jung Su
2013-12-19 1:54 ` Marek Vasut
2013-12-19 7:07 ` Kuo-Jung Su
2013-12-19 7:17 ` Marek Vasut
2013-12-20 3:45 ` Kuo-Jung Su
2013-12-20 8:17 ` Marek Vasut
2013-12-20 4:32 ` [U-Boot] [PATCH v2 0/2] usb: gadget: fotg210: workaround & new hardware support Kuo-Jung Su
2013-12-20 4:32 ` Kuo-Jung Su [this message]
2013-12-20 4:33 ` [U-Boot] [PATCH v2 2/2] usb: gadget: fotg210: EP0 fifo empty indication is non-reliable Kuo-Jung Su
2013-12-20 11:22 ` [U-Boot] [PATCH v2 0/2] usb: gadget: fotg210: workaround & new hardware support Marek Vasut
2013-12-23 0:50 ` Kuo-Jung Su
2013-12-23 0:55 ` Marek Vasut
2013-12-24 8:14 ` Kuo-Jung Su
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=1387513980-2052-2-git-send-email-dantesu@gmail.com \
--to=dantesu@gmail.com \
--cc=u-boot@lists.denx.de \
/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