diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-07-05 10:52:55 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-07-05 10:52:55 -0700 |
commit | fe584fee0f3f62d15182e805267a01f4a57f2306 (patch) | |
tree | 14fc55af75d617a9c65151aace7d7dd405287c70 | |
parent | b5ca3e2379e9f3a0117839e225f83b80dd85408c (diff) | |
download | ltsi-kernel-fe584fee0f3f62d15182e805267a01f4a57f2306.tar.gz |
added patches for r8a66597-udc driver
13 files changed, 1796 insertions, 0 deletions
diff --git a/patches.r8a66597-udc/001-usb-gadget-add-platform-module-alias-where-it-is-missing.patch b/patches.r8a66597-udc/001-usb-gadget-add-platform-module-alias-where-it-is-missing.patch new file mode 100644 index 00000000000000..390208c0854498 --- /dev/null +++ b/patches.r8a66597-udc/001-usb-gadget-add-platform-module-alias-where-it-is-missing.patch @@ -0,0 +1,52 @@ +From ltsi-dev-bounces@lists.linuxfoundation.org Mon May 28 23:23:26 2012 +From: "Shimoda, Yoshihiro" <yoshihiro.shimoda.uh@renesas.com> +Date: Tue, 29 May 2012 15:22:23 +0900 +Subject: [LTSI-dev] [PATCH 01/12] usb: gadget: add platform module alias where it is missing +To: ltsi-dev@lists.linuxfoundation.org +Message-ID: <4FC46B1F.6040202@renesas.com> + + +>From 2db193dbaf8523e7ebfd9d16add47a85435b6b54 Mon Sep 17 00:00:00 2001 +From: Sebastian Andrzej Siewior <bigeasy@linutronix.de> +Date: Wed, 29 Jun 2011 16:41:55 +0300 +Subject: usb: gadget: add platform module alias where it is missing + +Without it udev won't be able to load the driver once it notices the +device unbound. + +Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> +Signed-off-by: Felipe Balbi <balbi@ti.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> +(cherry picked from commit 86081d7be34e0f80dc5c46391ec927fc4f350462) + +Conflicts: + + drivers/usb/gadget/ci13xxx_msm.c + drivers/usb/gadget/mv_udc_core.c + drivers/usb/gadget/net2272.c + drivers/usb/gadget/s3c-hsudc.c + +Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> +--- + drivers/usb/gadget/r8a66597-udc.c | 1 + + 1 files changed, 1 insertions(+), 0 deletions(-) + +diff --git a/drivers/usb/gadget/r8a66597-udc.c b/drivers/usb/gadget/r8a66597-udc.c +index 6dcc1f6..600a2e7 100644 +--- a/drivers/usb/gadget/r8a66597-udc.c ++++ b/drivers/usb/gadget/r8a66597-udc.c +@@ -1679,6 +1679,7 @@ static struct platform_driver r8a66597_driver = { + .name = (char *) udc_name, + }, + }; ++MODULE_ALIAS("platform:r8a66597_udc"); + + static int __init r8a66597_udc_init(void) + { +-- +1.7.1 +_______________________________________________ +LTSI-dev mailing list +LTSI-dev@lists.linuxfoundation.org +https://lists.linuxfoundation.org/mailman/listinfo/ltsi-dev + diff --git a/patches.r8a66597-udc/002-usb-update-email-address-in-r8a66597-udc-and-m66592-udc.patch b/patches.r8a66597-udc/002-usb-update-email-address-in-r8a66597-udc-and-m66592-udc.patch new file mode 100644 index 00000000000000..a6fea327f2f4e0 --- /dev/null +++ b/patches.r8a66597-udc/002-usb-update-email-address-in-r8a66597-udc-and-m66592-udc.patch @@ -0,0 +1,61 @@ +From ltsi-dev-bounces@lists.linuxfoundation.org Mon May 28 23:22:33 2012 +From: "Shimoda, Yoshihiro" <yoshihiro.shimoda.uh@renesas.com> +Date: Tue, 29 May 2012 15:22:28 +0900 +Subject: [LTSI-dev] [PATCH 02/12] usb: update email address in r8a66597-udc and m66592-udc +To: ltsi-dev@lists.linuxfoundation.org +Message-ID: <4FC46B24.2010604@renesas.com> + + +>From d747c5ba902336200056de795e1187109178c59a Mon Sep 17 00:00:00 2001 +From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> +Date: Fri, 8 Jul 2011 14:51:21 +0900 +Subject: usb: update email address in r8a66597-udc and m66592-udc + +Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> +Signed-off-by: Felipe Balbi <balbi@ti.com> +(cherry picked from commit 5db05c09ac107ef957b7a052d7bba8190c93b460) + +Conflicts: + + drivers/usb/gadget/m66592-udc.c + drivers/usb/gadget/m66592-udc.h + +Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> +--- + drivers/usb/gadget/r8a66597-udc.c | 2 +- + drivers/usb/gadget/r8a66597-udc.h | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/usb/gadget/r8a66597-udc.c b/drivers/usb/gadget/r8a66597-udc.c +index 600a2e7..9fc3979 100644 +--- a/drivers/usb/gadget/r8a66597-udc.c ++++ b/drivers/usb/gadget/r8a66597-udc.c +@@ -3,7 +3,7 @@ + * + * Copyright (C) 2006-2009 Renesas Solutions Corp. + * +- * Author : Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com> ++ * Author : Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by +diff --git a/drivers/usb/gadget/r8a66597-udc.h b/drivers/usb/gadget/r8a66597-udc.h +index 5fc22e0..503f766 100644 +--- a/drivers/usb/gadget/r8a66597-udc.h ++++ b/drivers/usb/gadget/r8a66597-udc.h +@@ -3,7 +3,7 @@ + * + * Copyright (C) 2007-2009 Renesas Solutions Corp. + * +- * Author : Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com> ++ * Author : Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by +-- +1.7.1 +_______________________________________________ +LTSI-dev mailing list +LTSI-dev@lists.linuxfoundation.org +https://lists.linuxfoundation.org/mailman/listinfo/ltsi-dev + diff --git a/patches.r8a66597-udc/003-usb-gadget-r8a66597-udc-make-buswait-configurable-through-platform-data.patch b/patches.r8a66597-udc/003-usb-gadget-r8a66597-udc-make-buswait-configurable-through-platform-data.patch new file mode 100644 index 00000000000000..d5b936dece469b --- /dev/null +++ b/patches.r8a66597-udc/003-usb-gadget-r8a66597-udc-make-buswait-configurable-through-platform-data.patch @@ -0,0 +1,74 @@ +From ltsi-dev-bounces@lists.linuxfoundation.org Mon May 28 23:22:40 2012 +From: "Shimoda, Yoshihiro" <yoshihiro.shimoda.uh@renesas.com> +Date: Tue, 29 May 2012 15:22:35 +0900 +Subject: [LTSI-dev] [PATCH 03/12] usb: gadget: r8a66597-udc: Make BUSWAIT configurable through platform data +To: ltsi-dev@lists.linuxfoundation.org +Message-ID: <4FC46B2B.7010109@renesas.com> + + +>From 0d5a5cc7d8b2da62c70d9ab7a9cdd626b889c745 Mon Sep 17 00:00:00 2001 +From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> +Date: Fri, 8 Jul 2011 14:51:27 +0900 +Subject: usb: gadget: r8a66597-udc: Make BUSWAIT configurable through platform data + +BUSWAIT is a 4-bit-wide value that controls the number of access waits +from the CPU to on-chip USB module. b'0000 inserts 0 wait (2 access +cycles) and b'1111 inserts 15 waits (17 access cycles, hardware +initial value), respectively. + +BUSWAIT value depends on peripheral clock frequency supplied to on-chip +of each CPU, hence should be configurable through platform data. + +Note that this patch assumes that b'0000 (0 wait, 2 access cycles) is +rerely used and considered as invalid. If valid 'buswait' data is not +provided by platform, initial b'1111 (15 waits, 17 access cycles) will +be applied as a safe default. + +Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> +Signed-off-by: Felipe Balbi <balbi@ti.com> +(cherry picked from commit 5154e9f126c1d2ee8f5f93d9954f83d82b2d5e64) + +Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> +--- + drivers/usb/gadget/r8a66597-udc.c | 6 +++++- + include/linux/usb/r8a66597.h | 3 +++ + 2 files changed, 8 insertions(+), 1 deletions(-) + +diff --git a/drivers/usb/gadget/r8a66597-udc.c b/drivers/usb/gadget/r8a66597-udc.c +index 9fc3979..8a3a32a 100644 +--- a/drivers/usb/gadget/r8a66597-udc.c ++++ b/drivers/usb/gadget/r8a66597-udc.c +@@ -576,7 +576,11 @@ static void init_controller(struct r8a66597 *r8a66597) + u16 endian = r8a66597->pdata->endian ? BIGEND : 0; + + if (r8a66597->pdata->on_chip) { +- r8a66597_bset(r8a66597, 0x04, SYSCFG1); ++ if (r8a66597->pdata->buswait) ++ r8a66597_write(r8a66597, r8a66597->pdata->buswait, ++ SYSCFG1); ++ else ++ r8a66597_write(r8a66597, 0x0f, SYSCFG1); + r8a66597_bset(r8a66597, HSE, SYSCFG0); + + r8a66597_bclr(r8a66597, USBE, SYSCFG0); +diff --git a/include/linux/usb/r8a66597.h b/include/linux/usb/r8a66597.h +index 26d2167..6e1bfae 100644 +--- a/include/linux/usb/r8a66597.h ++++ b/include/linux/usb/r8a66597.h +@@ -31,6 +31,9 @@ struct r8a66597_platdata { + /* This callback can control port power instead of DVSTCTR register. */ + void (*port_power)(int port, int power); + ++ /* This parameter is for BUSWAIT */ ++ u16 buswait; ++ + /* set one = on chip controller, set zero = external controller */ + unsigned on_chip:1; + +-- +1.7.1 +_______________________________________________ +LTSI-dev mailing list +LTSI-dev@lists.linuxfoundation.org +https://lists.linuxfoundation.org/mailman/listinfo/ltsi-dev + diff --git a/patches.r8a66597-udc/004-usb-gadget-r8a66597-udc-add-support-for-test_mode.patch b/patches.r8a66597-udc/004-usb-gadget-r8a66597-udc-add-support-for-test_mode.patch new file mode 100644 index 00000000000000..841a2cf6a729d9 --- /dev/null +++ b/patches.r8a66597-udc/004-usb-gadget-r8a66597-udc-add-support-for-test_mode.patch @@ -0,0 +1,85 @@ +From ltsi-dev-bounces@lists.linuxfoundation.org Mon May 28 23:23:26 2012 +From: "Shimoda, Yoshihiro" <yoshihiro.shimoda.uh@renesas.com> +Date: Tue, 29 May 2012 15:22:41 +0900 +Subject: [LTSI-dev] [PATCH 04/12] usb: gadget: r8a66597-udc: add support for TEST_MODE +To: ltsi-dev@lists.linuxfoundation.org +Message-ID: <4FC46B31.90404@renesas.com> + + +>From b136f6dc4b62945390fa5fb8dcc2d876f894a11b Mon Sep 17 00:00:00 2001 +From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> +Date: Fri, 8 Jul 2011 14:51:14 +0900 +Subject: usb: gadget: r8a66597-udc: add support for TEST_MODE + +The USB high speed device must support the TEST_MODE, but the driver +didn't support it. When we sent the SET_FEATURE for TEST_MODE to +the driver, the request was successful, but the module didn't enter +the TEST_MODE. + +Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> +Signed-off-by: Felipe Balbi <balbi@ti.com> +(cherry picked from commit 96fe53ef5498ba130b2f054f2de38e090ddaa55f) + +Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> +--- + drivers/usb/gadget/r8a66597-udc.c | 23 ++++++++++++++++++++++- + 1 files changed, 22 insertions(+), 1 deletions(-) + +diff --git a/drivers/usb/gadget/r8a66597-udc.c b/drivers/usb/gadget/r8a66597-udc.c +index 8a3a32a..eb1ad72 100644 +--- a/drivers/usb/gadget/r8a66597-udc.c ++++ b/drivers/usb/gadget/r8a66597-udc.c +@@ -622,6 +622,7 @@ static void disable_controller(struct r8a66597 *r8a66597) + { + if (r8a66597->pdata->on_chip) { + r8a66597_bset(r8a66597, SCKE, SYSCFG0); ++ r8a66597_bclr(r8a66597, UTST, TESTMODE); + + /* disable interrupts */ + r8a66597_write(r8a66597, 0, INTENB0); +@@ -639,6 +640,7 @@ static void disable_controller(struct r8a66597 *r8a66597) + r8a66597_bclr(r8a66597, SCKE, SYSCFG0); + + } else { ++ r8a66597_bclr(r8a66597, UTST, TESTMODE); + r8a66597_bclr(r8a66597, SCKE, SYSCFG0); + udelay(1); + r8a66597_bclr(r8a66597, PLLC, SYSCFG0); +@@ -1003,10 +1005,29 @@ static void clear_feature(struct r8a66597 *r8a66597, + + static void set_feature(struct r8a66597 *r8a66597, struct usb_ctrlrequest *ctrl) + { ++ u16 tmp; ++ int timeout = 3000; + + switch (ctrl->bRequestType & USB_RECIP_MASK) { + case USB_RECIP_DEVICE: +- control_end(r8a66597, 1); ++ switch (le16_to_cpu(ctrl->wValue)) { ++ case USB_DEVICE_TEST_MODE: ++ control_end(r8a66597, 1); ++ /* Wait for the completion of status stage */ ++ do { ++ tmp = r8a66597_read(r8a66597, INTSTS0) & CTSQ; ++ udelay(1); ++ } while (tmp != CS_IDST || timeout-- > 0); ++ ++ if (tmp == CS_IDST) ++ r8a66597_bset(r8a66597, ++ le16_to_cpu(ctrl->wIndex >> 8), ++ TESTMODE); ++ break; ++ default: ++ pipe_stall(r8a66597, 0); ++ break; ++ } + break; + case USB_RECIP_INTERFACE: + control_end(r8a66597, 1); +-- +1.7.1 +_______________________________________________ +LTSI-dev mailing list +LTSI-dev@lists.linuxfoundation.org +https://lists.linuxfoundation.org/mailman/listinfo/ltsi-dev + diff --git a/patches.r8a66597-udc/005-usb-gadget-clean-up-fsf-boilerplate-text.patch b/patches.r8a66597-udc/005-usb-gadget-clean-up-fsf-boilerplate-text.patch new file mode 100644 index 00000000000000..91309889b3f079 --- /dev/null +++ b/patches.r8a66597-udc/005-usb-gadget-clean-up-fsf-boilerplate-text.patch @@ -0,0 +1,145 @@ +From ltsi-dev-bounces@lists.linuxfoundation.org Mon May 28 23:23:29 2012 +From: "Shimoda, Yoshihiro" <yoshihiro.shimoda.uh@renesas.com> +Date: Tue, 29 May 2012 15:22:51 +0900 +Subject: [LTSI-dev] [PATCH 05/12] usb gadget: clean up FSF boilerplate text +To: ltsi-dev@lists.linuxfoundation.org +Message-ID: <4FC46B3B.4070502@renesas.com> + + +>From 4c3d87deff2bb6be573b7f9c1c6736e66fad712a Mon Sep 17 00:00:00 2001 +From: Klaus Schwarzkopf <schwarzkopf@sensortherm.de> +Date: Fri, 9 Sep 2011 16:10:44 +0200 +Subject: usb gadget: clean up FSF boilerplate text + +remove the following two paragraphs as they are not needed: + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +License for more details. + +You should have received a copy of the GNU General Public License along with +this program; if not, write to the Free Software Foundation, Inc.,59 +Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +Signed-off-by: Klaus Schwarzkopf <schwarzkopf@sensortherm.de> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> +(cherry picked from commit 28c9fc68ebd32d473a8787d05c74e3f39c6c866b) + +Conflicts: + + drivers/usb/gadget/amd5536udc.c + drivers/usb/gadget/amd5536udc.h + drivers/usb/gadget/at91_udc.c + drivers/usb/gadget/at91_udc.h + drivers/usb/gadget/cdc2.c + drivers/usb/gadget/ci13xxx_msm.c + drivers/usb/gadget/composite.c + drivers/usb/gadget/config.c + drivers/usb/gadget/dbgp.c + drivers/usb/gadget/dummy_hcd.c + drivers/usb/gadget/epautoconf.c + drivers/usb/gadget/ether.c + drivers/usb/gadget/f_ecm.c + drivers/usb/gadget/f_eem.c + drivers/usb/gadget/f_fs.c + drivers/usb/gadget/f_hid.c + drivers/usb/gadget/f_loopback.c + drivers/usb/gadget/f_ncm.c + drivers/usb/gadget/f_obex.c + drivers/usb/gadget/f_phonet.c + drivers/usb/gadget/f_rndis.c + drivers/usb/gadget/f_sourcesink.c + drivers/usb/gadget/f_subset.c + drivers/usb/gadget/f_uvc.c + drivers/usb/gadget/f_uvc.h + drivers/usb/gadget/fusb300_udc.c + drivers/usb/gadget/fusb300_udc.h + drivers/usb/gadget/g_ffs.c + drivers/usb/gadget/hid.c + drivers/usb/gadget/imx_udc.h + drivers/usb/gadget/inode.c + drivers/usb/gadget/langwell_udc.c + drivers/usb/gadget/langwell_udc.h + drivers/usb/gadget/m66592-udc.c + drivers/usb/gadget/m66592-udc.h + drivers/usb/gadget/mass_storage.c + drivers/usb/gadget/multi.c + drivers/usb/gadget/ncm.c + drivers/usb/gadget/ndis.h + drivers/usb/gadget/net2280.c + drivers/usb/gadget/net2280.h + drivers/usb/gadget/omap_udc.c + drivers/usb/gadget/pch_udc.c + drivers/usb/gadget/printer.c + drivers/usb/gadget/pxa25x_udc.c + drivers/usb/gadget/pxa25x_udc.h + drivers/usb/gadget/pxa27x_udc.c + drivers/usb/gadget/pxa27x_udc.h + drivers/usb/gadget/s3c2410_udc.c + drivers/usb/gadget/s3c2410_udc.h + drivers/usb/gadget/storage_common.c + drivers/usb/gadget/u_ether.c + drivers/usb/gadget/u_ether.h + drivers/usb/gadget/uvc.h + drivers/usb/gadget/uvc_queue.c + drivers/usb/gadget/uvc_v4l2.c + drivers/usb/gadget/uvc_video.c + drivers/usb/gadget/webcam.c + drivers/usb/gadget/zero.c + +Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> +--- + drivers/usb/gadget/r8a66597-udc.c | 10 ---------- + drivers/usb/gadget/r8a66597-udc.h | 10 ---------- + 2 files changed, 0 insertions(+), 20 deletions(-) + +diff --git a/drivers/usb/gadget/r8a66597-udc.c b/drivers/usb/gadget/r8a66597-udc.c +index eb1ad72..fe3313a 100644 +--- a/drivers/usb/gadget/r8a66597-udc.c ++++ b/drivers/usb/gadget/r8a66597-udc.c +@@ -8,16 +8,6 @@ + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. +- * +- * This program is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- * GNU General Public License for more details. +- * +- * You should have received a copy of the GNU General Public License +- * along with this program; if not, write to the Free Software +- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +- * + */ + + #include <linux/module.h> +diff --git a/drivers/usb/gadget/r8a66597-udc.h b/drivers/usb/gadget/r8a66597-udc.h +index 503f766..a373c4e 100644 +--- a/drivers/usb/gadget/r8a66597-udc.h ++++ b/drivers/usb/gadget/r8a66597-udc.h +@@ -8,16 +8,6 @@ + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. +- * +- * This program is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- * GNU General Public License for more details. +- * +- * You should have received a copy of the GNU General Public License +- * along with this program; if not, write to the Free Software +- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +- * + */ + + #ifndef __R8A66597_H__ +-- +1.7.1 +_______________________________________________ +LTSI-dev mailing list +LTSI-dev@lists.linuxfoundation.org +https://lists.linuxfoundation.org/mailman/listinfo/ltsi-dev + diff --git a/patches.r8a66597-udc/006-usb-irq-remove-irqf_disabled.patch b/patches.r8a66597-udc/006-usb-irq-remove-irqf_disabled.patch new file mode 100644 index 00000000000000..9fbc2940c64832 --- /dev/null +++ b/patches.r8a66597-udc/006-usb-irq-remove-irqf_disabled.patch @@ -0,0 +1,102 @@ +From ltsi-dev-bounces@lists.linuxfoundation.org Mon May 28 23:23:31 2012 +From: "Shimoda, Yoshihiro" <yoshihiro.shimoda.uh@renesas.com> +Date: Tue, 29 May 2012 15:22:59 +0900 +Subject: [LTSI-dev] [PATCH 06/12] USB: irq: Remove IRQF_DISABLED +To: ltsi-dev@lists.linuxfoundation.org +Message-ID: <4FC46B43.3050307@renesas.com> + + +>From 1c1d88148ed0c54c58f7426b49c417c44bb68eeb Mon Sep 17 00:00:00 2001 +From: Yong Zhang <yong.zhang0@gmail.com> +Date: Wed, 7 Sep 2011 16:10:52 +0800 +Subject: USB: irq: Remove IRQF_DISABLED + +This flag is a NOOP and can be removed now. + +Signed-off-by: Yong Zhang <yong.zhang0@gmail.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> +(cherry picked from commit b5dd18d8747010e3f3eb1cc76a49f94291938559) + +Conflicts: + + drivers/usb/core/hcd-pci.c + drivers/usb/gadget/at91_udc.c + drivers/usb/gadget/fusb300_udc.c + drivers/usb/gadget/imx_udc.c + drivers/usb/gadget/m66592-udc.c + drivers/usb/gadget/mv_udc_core.c + drivers/usb/gadget/omap_udc.c + drivers/usb/gadget/pxa25x_udc.c + drivers/usb/gadget/r8a66597-udc.c + drivers/usb/gadget/s3c2410_udc.c + drivers/usb/host/ehci-ath79.c + drivers/usb/host/ehci-au1xxx.c + drivers/usb/host/ehci-fsl.c + drivers/usb/host/ehci-mxc.c + drivers/usb/host/ehci-octeon.c + drivers/usb/host/ehci-omap.c + drivers/usb/host/ehci-orion.c + drivers/usb/host/ehci-ps3.c + drivers/usb/host/ehci-s5p.c + drivers/usb/host/ehci-sh.c + drivers/usb/host/ehci-spear.c + drivers/usb/host/ehci-tegra.c + drivers/usb/host/ehci-vt8500.c + drivers/usb/host/fhci-hcd.c + drivers/usb/host/imx21-hcd.c + drivers/usb/host/isp116x-hcd.c + drivers/usb/host/isp1362-hcd.c + drivers/usb/host/isp1760-if.c + drivers/usb/host/ohci-ath79.c + drivers/usb/host/ohci-au1xxx.c + drivers/usb/host/ohci-da8xx.c + drivers/usb/host/ohci-ep93xx.c + drivers/usb/host/ohci-octeon.c + drivers/usb/host/ohci-omap.c + drivers/usb/host/ohci-omap3.c + drivers/usb/host/ohci-pnx4008.c + drivers/usb/host/ohci-pnx8550.c + drivers/usb/host/ohci-ppc-of.c + drivers/usb/host/ohci-ppc-soc.c + drivers/usb/host/ohci-ps3.c + drivers/usb/host/ohci-pxa27x.c + drivers/usb/host/ohci-s3c2410.c + drivers/usb/host/ohci-sa1111.c + drivers/usb/host/ohci-sh.c + drivers/usb/host/ohci-sm501.c + drivers/usb/host/ohci-spear.c + drivers/usb/host/ohci-ssb.c + drivers/usb/host/ohci-tmio.c + drivers/usb/host/r8a66597-hcd.c + drivers/usb/host/sl811-hcd.c + drivers/usb/host/xhci-pci.c + drivers/usb/musb/musbhsdma.c + drivers/usb/otg/isp1301_omap.c + drivers/usb/renesas_usbhs/mod.c + +Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> +--- + drivers/usb/gadget/r8a66597-udc.c | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/drivers/usb/gadget/r8a66597-udc.c b/drivers/usb/gadget/r8a66597-udc.c +index fe3313a..460b3bf 100644 +--- a/drivers/usb/gadget/r8a66597-udc.c ++++ b/drivers/usb/gadget/r8a66597-udc.c +@@ -1618,7 +1618,7 @@ static int __init r8a66597_probe(struct platform_device *pdev) + + disable_controller(r8a66597); /* make sure controller is disabled */ + +- ret = request_irq(irq, r8a66597_irq, IRQF_DISABLED | IRQF_SHARED, ++ ret = request_irq(irq, r8a66597_irq, IRQF_SHARED, + udc_name, r8a66597); + if (ret < 0) { + printk(KERN_ERR "request_irq error (%d)\n", ret); +-- +1.7.1 + +_______________________________________________ +LTSI-dev mailing list +LTSI-dev@lists.linuxfoundation.org +https://lists.linuxfoundation.org/mailman/listinfo/ltsi-dev + diff --git a/patches.r8a66597-udc/007-usb-gadget-r8a66597-udc-change-prototype-of-r8a66597_write_fifo.patch b/patches.r8a66597-udc/007-usb-gadget-r8a66597-udc-change-prototype-of-r8a66597_write_fifo.patch new file mode 100644 index 00000000000000..2bd54abcceb715 --- /dev/null +++ b/patches.r8a66597-udc/007-usb-gadget-r8a66597-udc-change-prototype-of-r8a66597_write_fifo.patch @@ -0,0 +1,70 @@ +From ltsi-dev-bounces@lists.linuxfoundation.org Mon May 28 23:23:10 2012 +From: "Shimoda, Yoshihiro" <yoshihiro.shimoda.uh@renesas.com> +Date: Tue, 29 May 2012 15:23:05 +0900 +Subject: [LTSI-dev] [PATCH 07/12] usb: gadget: r8a66597-udc: change prototype of r8a66597_write_fifo +To: ltsi-dev@lists.linuxfoundation.org +Message-ID: <4FC46B49.5010102@renesas.com> + + +>From f29c87e4cdae1df5b2871e87c67799bc51766e2a Mon Sep 17 00:00:00 2001 +From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> +Date: Fri, 30 Sep 2011 20:07:08 +0900 +Subject: usb: gadget: r8a66597-udc: change prototype of r8a66597_write_fifo + +Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> +Signed-off-by: Felipe Balbi <balbi@ti.com> +(cherry picked from commit 0a85577627fc81936d3dbdfb349964024adcb01d) + +Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> +--- + drivers/usb/gadget/r8a66597-udc.c | 4 ++-- + drivers/usb/gadget/r8a66597-udc.h | 4 ++-- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/drivers/usb/gadget/r8a66597-udc.c b/drivers/usb/gadget/r8a66597-udc.c +index 460b3bf..3450038 100644 +--- a/drivers/usb/gadget/r8a66597-udc.c ++++ b/drivers/usb/gadget/r8a66597-udc.c +@@ -723,7 +723,7 @@ static void irq_ep0_write(struct r8a66597_ep *ep, struct r8a66597_request *req) + /* write fifo */ + if (req->req.buf) { + if (size > 0) +- r8a66597_write_fifo(r8a66597, ep->fifoaddr, buf, size); ++ r8a66597_write_fifo(r8a66597, ep, buf, size); + if ((size == 0) || ((size % ep->ep.maxpacket) != 0)) + r8a66597_bset(r8a66597, BVAL, ep->fifoctr); + } +@@ -770,7 +770,7 @@ static void irq_packet_write(struct r8a66597_ep *ep, + + /* write fifo */ + if (req->req.buf) { +- r8a66597_write_fifo(r8a66597, ep->fifoaddr, buf, size); ++ r8a66597_write_fifo(r8a66597, ep, buf, size); + if ((size == 0) + || ((size % ep->ep.maxpacket) != 0) + || ((bufsize != ep->ep.maxpacket) +diff --git a/drivers/usb/gadget/r8a66597-udc.h b/drivers/usb/gadget/r8a66597-udc.h +index a373c4e..31047f8 100644 +--- a/drivers/usb/gadget/r8a66597-udc.h ++++ b/drivers/usb/gadget/r8a66597-udc.h +@@ -173,11 +173,11 @@ static inline void r8a66597_write(struct r8a66597 *r8a66597, u16 val, + } + + static inline void r8a66597_write_fifo(struct r8a66597 *r8a66597, +- unsigned long offset, ++ struct r8a66597_ep *ep, + unsigned char *buf, + int len) + { +- void __iomem *fifoaddr = r8a66597->reg + offset; ++ void __iomem *fifoaddr = r8a66597->reg + ep->fifoaddr; + int adj = 0; + int i; + +-- +1.7.1 +_______________________________________________ +LTSI-dev mailing list +LTSI-dev@lists.linuxfoundation.org +https://lists.linuxfoundation.org/mailman/listinfo/ltsi-dev + diff --git a/patches.r8a66597-udc/008-usb-r8a66597-hcd-add-function-for-external-controller.patch b/patches.r8a66597-udc/008-usb-r8a66597-hcd-add-function-for-external-controller.patch new file mode 100644 index 00000000000000..e5efd83f843824 --- /dev/null +++ b/patches.r8a66597-udc/008-usb-r8a66597-hcd-add-function-for-external-controller.patch @@ -0,0 +1,53 @@ +From ltsi-dev-bounces@lists.linuxfoundation.org Mon May 28 23:23:19 2012 +From: "Shimoda, Yoshihiro" <yoshihiro.shimoda.uh@renesas.com> +Date: Tue, 29 May 2012 15:23:15 +0900 +Subject: [LTSI-dev] [PATCH 08/12] usb: r8a66597-hcd: add function for external controller +To: ltsi-dev@lists.linuxfoundation.org +Message-ID: <4FC46B53.2070602@renesas.com> + + +>From 8eb5b6c291ca376adaff5cd123cfc39e186b30ee Mon Sep 17 00:00:00 2001 +From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> +Date: Thu, 7 Jul 2011 09:57:10 +0900 +Subject: usb: r8a66597-hcd: add function for external controller + +R8A66597 has the pin of WR0 and WR1. So, if one write-pin of CPU +connects to the pins, we have to change the setting of FIFOSEL +register in the controller. If we don't change the setting, +the controller cannot send the data of odd length. + +Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> +(cherry picked from commit f2e9039a43b01f01cab9dfaea2cad5f304fb3343) + +Conflicts: + + drivers/usb/host/r8a66597-hcd.c + drivers/usb/host/r8a66597.h + +Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> +--- + include/linux/usb/r8a66597.h | 3 +++ + 1 files changed, 3 insertions(+), 0 deletions(-) + +diff --git a/include/linux/usb/r8a66597.h b/include/linux/usb/r8a66597.h +index 6e1bfae..7cd89e7 100644 +--- a/include/linux/usb/r8a66597.h ++++ b/include/linux/usb/r8a66597.h +@@ -45,6 +45,9 @@ struct r8a66597_platdata { + + /* set one = big endian, set zero = little endian */ + unsigned endian:1; ++ ++ /* (external controller only) set one = WR0_N shorted to WR1_N */ ++ unsigned wr0_shorted_to_wr1:1; + }; + + /* Register definitions */ +-- +1.7.1 +_______________________________________________ +LTSI-dev mailing list +LTSI-dev@lists.linuxfoundation.org +https://lists.linuxfoundation.org/mailman/listinfo/ltsi-dev + diff --git a/patches.r8a66597-udc/009-usb-gadget-r8a66597-udc-add-function-for-external-controller.patch b/patches.r8a66597-udc/009-usb-gadget-r8a66597-udc-add-function-for-external-controller.patch new file mode 100644 index 00000000000000..8683cb5ff5755a --- /dev/null +++ b/patches.r8a66597-udc/009-usb-gadget-r8a66597-udc-add-function-for-external-controller.patch @@ -0,0 +1,95 @@ +From ltsi-dev-bounces@lists.linuxfoundation.org Mon May 28 23:23:25 2012 +From: "Shimoda, Yoshihiro" <yoshihiro.shimoda.uh@renesas.com> +Date: Tue, 29 May 2012 15:23:22 +0900 +Subject: [LTSI-dev] [PATCH 09/12] usb: gadget: r8a66597-udc: add function for external controller +To: ltsi-dev@lists.linuxfoundation.org +Message-ID: <4FC46B5A.8080304@renesas.com> + + +>From 0a5c27afa82c8b475eca91e74664dd90f4827faf Mon Sep 17 00:00:00 2001 +From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> +Date: Fri, 30 Sep 2011 20:07:21 +0900 +Subject: usb: gadget: r8a66597-udc: add function for external controller + +R8A66597 has the pin of WR0 and WR1. So, if one write-pin of CPU +connects to the pins, we have to change the setting of FIFOSEL +register in the controller. If we don't change the setting, +the controller cannot send the data of odd length. + +Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> +Signed-off-by: Felipe Balbi <balbi@ti.com> +(cherry picked from commit 5c481a639068ac34bd1dcd183f37b7a65d0e3841) + +Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> +--- + drivers/usb/gadget/r8a66597-udc.h | 34 +++++++++++++++++++--------------- + 1 files changed, 19 insertions(+), 15 deletions(-) + +diff --git a/drivers/usb/gadget/r8a66597-udc.h b/drivers/usb/gadget/r8a66597-udc.h +index 31047f8..f9ac2d7 100644 +--- a/drivers/usb/gadget/r8a66597-udc.h ++++ b/drivers/usb/gadget/r8a66597-udc.h +@@ -172,6 +172,21 @@ static inline void r8a66597_write(struct r8a66597 *r8a66597, u16 val, + iowrite16(val, r8a66597->reg + offset); + } + ++static inline void r8a66597_mdfy(struct r8a66597 *r8a66597, ++ u16 val, u16 pat, unsigned long offset) ++{ ++ u16 tmp; ++ tmp = r8a66597_read(r8a66597, offset); ++ tmp = tmp & (~pat); ++ tmp = tmp | val; ++ r8a66597_write(r8a66597, tmp, offset); ++} ++ ++#define r8a66597_bclr(r8a66597, val, offset) \ ++ r8a66597_mdfy(r8a66597, 0, val, offset) ++#define r8a66597_bset(r8a66597, val, offset) \ ++ r8a66597_mdfy(r8a66597, val, 0, offset) ++ + static inline void r8a66597_write_fifo(struct r8a66597 *r8a66597, + struct r8a66597_ep *ep, + unsigned char *buf, +@@ -205,18 +220,12 @@ static inline void r8a66597_write_fifo(struct r8a66597 *r8a66597, + adj = 0x01; /* 16-bit wide */ + } + ++ if (r8a66597->pdata->wr0_shorted_to_wr1) ++ r8a66597_bclr(r8a66597, MBW_16, ep->fifosel); + for (i = 0; i < len; i++) + iowrite8(buf[i], fifoaddr + adj - (i & adj)); +-} +- +-static inline void r8a66597_mdfy(struct r8a66597 *r8a66597, +- u16 val, u16 pat, unsigned long offset) +-{ +- u16 tmp; +- tmp = r8a66597_read(r8a66597, offset); +- tmp = tmp & (~pat); +- tmp = tmp | val; +- r8a66597_write(r8a66597, tmp, offset); ++ if (r8a66597->pdata->wr0_shorted_to_wr1) ++ r8a66597_bclr(r8a66597, MBW_16, ep->fifosel); + } + + static inline u16 get_xtal_from_pdata(struct r8a66597_platdata *pdata) +@@ -241,11 +250,6 @@ static inline u16 get_xtal_from_pdata(struct r8a66597_platdata *pdata) + return clock; + } + +-#define r8a66597_bclr(r8a66597, val, offset) \ +- r8a66597_mdfy(r8a66597, 0, val, offset) +-#define r8a66597_bset(r8a66597, val, offset) \ +- r8a66597_mdfy(r8a66597, val, 0, offset) +- + #define get_pipectr_addr(pipenum) (PIPE1CTR + (pipenum - 1) * 2) + + #define enable_irq_ready(r8a66597, pipenum) \ +-- +1.7.1 +_______________________________________________ +LTSI-dev mailing list +LTSI-dev@lists.linuxfoundation.org +https://lists.linuxfoundation.org/mailman/listinfo/ltsi-dev + diff --git a/patches.r8a66597-udc/010-usb-gadget-r8a66597-udc-use-dev_-instead-of-printk.patch b/patches.r8a66597-udc/010-usb-gadget-r8a66597-udc-use-dev_-instead-of-printk.patch new file mode 100644 index 00000000000000..131ff5e91d05b9 --- /dev/null +++ b/patches.r8a66597-udc/010-usb-gadget-r8a66597-udc-use-dev_-instead-of-printk.patch @@ -0,0 +1,322 @@ +From ltsi-dev-bounces@lists.linuxfoundation.org Mon May 28 23:23:33 2012 +From: "Shimoda, Yoshihiro" <yoshihiro.shimoda.uh@renesas.com> +Date: Tue, 29 May 2012 15:23:28 +0900 +Subject: [LTSI-dev] [PATCH 10/12] usb: gadget: r8a66597-udc: use dev_*() instead of printk() +To: ltsi-dev@lists.linuxfoundation.org +Message-ID: <4FC46B60.1090300@renesas.com> + + +>From 427c3968e29e2754b6ec7639ada0cc87b6dbecf9 Mon Sep 17 00:00:00 2001 +From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> +Date: Fri, 30 Sep 2011 20:07:30 +0900 +Subject: usb: gadget: r8a66597-udc: use dev_*() instead of printk() + +This patch also fix the balance of braces. + +Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> +Signed-off-by: Felipe Balbi <balbi@ti.com> +(cherry picked from commit 12158f4280b4d42ef03b70a47d11b48dd8aad511) + +Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> +--- + drivers/usb/gadget/r8a66597-udc.c | 99 ++++++++++++++++++++++--------------- + drivers/usb/gadget/r8a66597-udc.h | 1 + + 2 files changed, 60 insertions(+), 40 deletions(-) + +diff --git a/drivers/usb/gadget/r8a66597-udc.c b/drivers/usb/gadget/r8a66597-udc.c +index 3450038..fd9ce15 100644 +--- a/drivers/usb/gadget/r8a66597-udc.c ++++ b/drivers/usb/gadget/r8a66597-udc.c +@@ -105,13 +105,15 @@ static inline u16 control_reg_get_pid(struct r8a66597 *r8a66597, u16 pipenum) + u16 pid = 0; + unsigned long offset; + +- if (pipenum == 0) ++ if (pipenum == 0) { + pid = r8a66597_read(r8a66597, DCPCTR) & PID; +- else if (pipenum < R8A66597_MAX_NUM_PIPE) { ++ } else if (pipenum < R8A66597_MAX_NUM_PIPE) { + offset = get_pipectr_addr(pipenum); + pid = r8a66597_read(r8a66597, offset) & PID; +- } else +- printk(KERN_ERR "unexpect pipe num (%d)\n", pipenum); ++ } else { ++ dev_err(r8a66597_to_dev(r8a66597), "unexpect pipe num (%d)\n", ++ pipenum); ++ } + + return pid; + } +@@ -121,13 +123,15 @@ static inline void control_reg_set_pid(struct r8a66597 *r8a66597, u16 pipenum, + { + unsigned long offset; + +- if (pipenum == 0) ++ if (pipenum == 0) { + r8a66597_mdfy(r8a66597, pid, PID, DCPCTR); +- else if (pipenum < R8A66597_MAX_NUM_PIPE) { ++ } else if (pipenum < R8A66597_MAX_NUM_PIPE) { + offset = get_pipectr_addr(pipenum); + r8a66597_mdfy(r8a66597, pid, PID, offset); +- } else +- printk(KERN_ERR "unexpect pipe num (%d)\n", pipenum); ++ } else { ++ dev_err(r8a66597_to_dev(r8a66597), "unexpect pipe num (%d)\n", ++ pipenum); ++ } + } + + static inline void pipe_start(struct r8a66597 *r8a66597, u16 pipenum) +@@ -150,13 +154,15 @@ static inline u16 control_reg_get(struct r8a66597 *r8a66597, u16 pipenum) + u16 ret = 0; + unsigned long offset; + +- if (pipenum == 0) ++ if (pipenum == 0) { + ret = r8a66597_read(r8a66597, DCPCTR); +- else if (pipenum < R8A66597_MAX_NUM_PIPE) { ++ } else if (pipenum < R8A66597_MAX_NUM_PIPE) { + offset = get_pipectr_addr(pipenum); + ret = r8a66597_read(r8a66597, offset); +- } else +- printk(KERN_ERR "unexpect pipe num (%d)\n", pipenum); ++ } else { ++ dev_err(r8a66597_to_dev(r8a66597), "unexpect pipe num (%d)\n", ++ pipenum); ++ } + + return ret; + } +@@ -167,13 +173,15 @@ static inline void control_reg_sqclr(struct r8a66597 *r8a66597, u16 pipenum) + + pipe_stop(r8a66597, pipenum); + +- if (pipenum == 0) ++ if (pipenum == 0) { + r8a66597_bset(r8a66597, SQCLR, DCPCTR); +- else if (pipenum < R8A66597_MAX_NUM_PIPE) { ++ } else if (pipenum < R8A66597_MAX_NUM_PIPE) { + offset = get_pipectr_addr(pipenum); + r8a66597_bset(r8a66597, SQCLR, offset); +- } else +- printk(KERN_ERR "unexpect pipe num(%d)\n", pipenum); ++ } else { ++ dev_err(r8a66597_to_dev(r8a66597), "unexpect pipe num (%d)\n", ++ pipenum); ++ } + } + + static inline int get_buffer_size(struct r8a66597 *r8a66597, u16 pipenum) +@@ -287,17 +295,18 @@ static void pipe_buffer_release(struct r8a66597 *r8a66597, + if (info->pipe == 0) + return; + +- if (is_bulk_pipe(info->pipe)) ++ if (is_bulk_pipe(info->pipe)) { + r8a66597->bulk--; +- else if (is_interrupt_pipe(info->pipe)) ++ } else if (is_interrupt_pipe(info->pipe)) { + r8a66597->interrupt--; +- else if (is_isoc_pipe(info->pipe)) { ++ } else if (is_isoc_pipe(info->pipe)) { + r8a66597->isochronous--; + if (info->type == R8A66597_BULK) + r8a66597->bulk--; +- } else +- printk(KERN_ERR "ep_release: unexpect pipenum (%d)\n", +- info->pipe); ++ } else { ++ dev_err(r8a66597_to_dev(r8a66597), ++ "ep_release: unexpect pipenum (%d)\n", info->pipe); ++ } + } + + static void pipe_initialize(struct r8a66597_ep *ep) +@@ -371,7 +380,8 @@ static int alloc_pipe_config(struct r8a66597_ep *ep, + case USB_ENDPOINT_XFER_BULK: + if (r8a66597->bulk >= R8A66597_MAX_NUM_BULK) { + if (r8a66597->isochronous >= R8A66597_MAX_NUM_ISOC) { +- printk(KERN_ERR "bulk pipe is insufficient\n"); ++ dev_err(r8a66597_to_dev(r8a66597), ++ "bulk pipe is insufficient\n"); + return -ENODEV; + } else { + info.pipe = R8A66597_BASE_PIPENUM_ISOC +@@ -387,7 +397,8 @@ static int alloc_pipe_config(struct r8a66597_ep *ep, + break; + case USB_ENDPOINT_XFER_INT: + if (r8a66597->interrupt >= R8A66597_MAX_NUM_INT) { +- printk(KERN_ERR "interrupt pipe is insufficient\n"); ++ dev_err(r8a66597_to_dev(r8a66597), ++ "interrupt pipe is insufficient\n"); + return -ENODEV; + } + info.pipe = R8A66597_BASE_PIPENUM_INT + r8a66597->interrupt; +@@ -396,7 +407,8 @@ static int alloc_pipe_config(struct r8a66597_ep *ep, + break; + case USB_ENDPOINT_XFER_ISOC: + if (r8a66597->isochronous >= R8A66597_MAX_NUM_ISOC) { +- printk(KERN_ERR "isochronous pipe is insufficient\n"); ++ dev_err(r8a66597_to_dev(r8a66597), ++ "isochronous pipe is insufficient\n"); + return -ENODEV; + } + info.pipe = R8A66597_BASE_PIPENUM_ISOC + r8a66597->isochronous; +@@ -404,7 +416,7 @@ static int alloc_pipe_config(struct r8a66597_ep *ep, + counter = &r8a66597->isochronous; + break; + default: +- printk(KERN_ERR "unexpect xfer type\n"); ++ dev_err(r8a66597_to_dev(r8a66597), "unexpect xfer type\n"); + return -EINVAL; + } + ep->type = info.type; +@@ -419,7 +431,8 @@ static int alloc_pipe_config(struct r8a66597_ep *ep, + + ret = pipe_buffer_setting(r8a66597, &info); + if (ret < 0) { +- printk(KERN_ERR "pipe_buffer_setting fail\n"); ++ dev_err(r8a66597_to_dev(r8a66597), ++ "pipe_buffer_setting fail\n"); + return ret; + } + +@@ -554,7 +567,8 @@ static void start_ep0(struct r8a66597_ep *ep, struct r8a66597_request *req) + control_end(ep->r8a66597, 0); + break; + default: +- printk(KERN_ERR "start_ep0: unexpect ctsq(%x)\n", ctsq); ++ dev_err(r8a66597_to_dev(ep->r8a66597), ++ "start_ep0: unexpect ctsq(%x)\n", ctsq); + break; + } + } +@@ -708,7 +722,8 @@ static void irq_ep0_write(struct r8a66597_ep *ep, struct r8a66597_request *req) + do { + tmp = r8a66597_read(r8a66597, ep->fifoctr); + if (i++ > 100000) { +- printk(KERN_ERR "pipe0 is busy. maybe cpu i/o bus" ++ dev_err(r8a66597_to_dev(r8a66597), ++ "pipe0 is busy. maybe cpu i/o bus " + "conflict. please power off this controller."); + return; + } +@@ -759,7 +774,8 @@ static void irq_packet_write(struct r8a66597_ep *ep, + if (unlikely((tmp & FRDY) == 0)) { + pipe_stop(r8a66597, pipenum); + pipe_irq_disable(r8a66597, pipenum); +- printk(KERN_ERR "write fifo not ready. pipnum=%d\n", pipenum); ++ dev_err(r8a66597_to_dev(r8a66597), ++ "write fifo not ready. pipnum=%d\n", pipenum); + return; + } + +@@ -809,7 +825,7 @@ static void irq_packet_read(struct r8a66597_ep *ep, + req->req.status = -EPIPE; + pipe_stop(r8a66597, pipenum); + pipe_irq_disable(r8a66597, pipenum); +- printk(KERN_ERR "read fifo not ready"); ++ dev_err(r8a66597_to_dev(r8a66597), "read fifo not ready"); + return; + } + +@@ -1085,7 +1101,7 @@ static void r8a66597_update_usb_speed(struct r8a66597 *r8a66597) + break; + default: + r8a66597->gadget.speed = USB_SPEED_UNKNOWN; +- printk(KERN_ERR "USB speed unknown\n"); ++ dev_err(r8a66597_to_dev(r8a66597), "USB speed unknown\n"); + } + } + +@@ -1148,7 +1164,8 @@ __acquires(r8a66597->lock) + control_end(r8a66597, 0); + break; + default: +- printk(KERN_ERR "ctrl_stage: unexpect ctsq(%x)\n", ctsq); ++ dev_err(r8a66597_to_dev(r8a66597), ++ "ctrl_stage: unexpect ctsq(%x)\n", ctsq); + break; + } + } +@@ -1448,13 +1465,15 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver, + + retval = device_add(&r8a66597->gadget.dev); + if (retval) { +- printk(KERN_ERR "device_add error (%d)\n", retval); ++ dev_err(r8a66597_to_dev(r8a66597), "device_add error (%d)\n", ++ retval); + goto error; + } + + retval = bind(&r8a66597->gadget); + if (retval) { +- printk(KERN_ERR "bind to driver error (%d)\n", retval); ++ dev_err(r8a66597_to_dev(r8a66597), ++ "bind to driver error (%d)\n", retval); + device_del(&r8a66597->gadget.dev); + goto error; + } +@@ -1554,7 +1573,7 @@ static int __init r8a66597_probe(struct platform_device *pdev) + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) { + ret = -ENODEV; +- printk(KERN_ERR "platform_get_resource error.\n"); ++ dev_err(&pdev->dev, "platform_get_resource error.\n"); + goto clean_up; + } + +@@ -1564,14 +1583,14 @@ static int __init r8a66597_probe(struct platform_device *pdev) + + if (irq < 0) { + ret = -ENODEV; +- printk(KERN_ERR "platform_get_irq error.\n"); ++ dev_err(&pdev->dev, "platform_get_irq error.\n"); + goto clean_up; + } + + reg = ioremap(res->start, resource_size(res)); + if (reg == NULL) { + ret = -ENOMEM; +- printk(KERN_ERR "ioremap error.\n"); ++ dev_err(&pdev->dev, "ioremap error.\n"); + goto clean_up; + } + +@@ -1579,7 +1598,7 @@ static int __init r8a66597_probe(struct platform_device *pdev) + r8a66597 = kzalloc(sizeof(struct r8a66597), GFP_KERNEL); + if (r8a66597 == NULL) { + ret = -ENOMEM; +- printk(KERN_ERR "kzalloc error\n"); ++ dev_err(&pdev->dev, "kzalloc error\n"); + goto clean_up; + } + +@@ -1621,7 +1640,7 @@ static int __init r8a66597_probe(struct platform_device *pdev) + ret = request_irq(irq, r8a66597_irq, IRQF_SHARED, + udc_name, r8a66597); + if (ret < 0) { +- printk(KERN_ERR "request_irq error (%d)\n", ret); ++ dev_err(&pdev->dev, "request_irq error (%d)\n", ret); + goto clean_up2; + } + +diff --git a/drivers/usb/gadget/r8a66597-udc.h b/drivers/usb/gadget/r8a66597-udc.h +index f9ac2d7..832ee59 100644 +--- a/drivers/usb/gadget/r8a66597-udc.h ++++ b/drivers/usb/gadget/r8a66597-udc.h +@@ -114,6 +114,7 @@ struct r8a66597 { + #define gadget_to_r8a66597(_gadget) \ + container_of(_gadget, struct r8a66597, gadget) + #define r8a66597_to_gadget(r8a66597) (&r8a66597->gadget) ++#define r8a66597_to_dev(r8a66597) (r8a66597->gadget.dev.parent) + + static inline u16 r8a66597_read(struct r8a66597 *r8a66597, unsigned long offset) + { +-- +1.7.1 +_______________________________________________ +LTSI-dev mailing list +LTSI-dev@lists.linuxfoundation.org +https://lists.linuxfoundation.org/mailman/listinfo/ltsi-dev + diff --git a/patches.r8a66597-udc/011-usb-gadget-r8a66597-udc-add-support-for-sudmac.patch b/patches.r8a66597-udc/011-usb-gadget-r8a66597-udc-add-support-for-sudmac.patch new file mode 100644 index 00000000000000..fa0335d7b72893 --- /dev/null +++ b/patches.r8a66597-udc/011-usb-gadget-r8a66597-udc-add-support-for-sudmac.patch @@ -0,0 +1,677 @@ +From ltsi-dev-bounces@lists.linuxfoundation.org Mon May 28 23:23:37 2012 +From: "Shimoda, Yoshihiro" <yoshihiro.shimoda.uh@renesas.com> +Date: Tue, 29 May 2012 15:23:32 +0900 +Subject: [LTSI-dev] [PATCH 11/12] usb: gadget: r8a66597-udc: add support for SUDMAC +To: ltsi-dev@lists.linuxfoundation.org +Message-ID: <4FC46B64.4080400@renesas.com> + + +>From 5011d0b167a9536dd46c10afb8afa96c60bb4193 Mon Sep 17 00:00:00 2001 +From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> +Date: Fri, 30 Sep 2011 20:07:38 +0900 +Subject: usb: gadget: r8a66597-udc: add support for SUDMAC + +SH7757 has a USB function with internal DMA controller (SUDMAC). +This patch supports the SUDMAC. The SUDMAC is incompatible with +general-purpose DMAC. So, it doesn't use dmaengine. + +Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> +Signed-off-by: Felipe Balbi <balbi@ti.com> +(cherry picked from commit b8a56e17e18cca2402b390c10b8d7f3cd0f6265b) + +Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> +--- + drivers/usb/gadget/r8a66597-udc.c | 364 +++++++++++++++++++++++++++++++++++-- + drivers/usb/gadget/r8a66597-udc.h | 26 +++- + include/linux/usb/r8a66597.h | 60 ++++++ + 3 files changed, 430 insertions(+), 20 deletions(-) + +diff --git a/drivers/usb/gadget/r8a66597-udc.c b/drivers/usb/gadget/r8a66597-udc.c +index fd9ce15..7f37a2a 100644 +--- a/drivers/usb/gadget/r8a66597-udc.c ++++ b/drivers/usb/gadget/r8a66597-udc.c +@@ -18,13 +18,14 @@ + #include <linux/clk.h> + #include <linux/err.h> + #include <linux/slab.h> ++#include <linux/dma-mapping.h> + + #include <linux/usb/ch9.h> + #include <linux/usb/gadget.h> + + #include "r8a66597-udc.h" + +-#define DRIVER_VERSION "2009-08-18" ++#define DRIVER_VERSION "2011-09-26" + + static const char udc_name[] = "r8a66597_udc"; + static const char *r8a66597_ep_name[] = { +@@ -184,6 +185,54 @@ static inline void control_reg_sqclr(struct r8a66597 *r8a66597, u16 pipenum) + } + } + ++static void control_reg_sqset(struct r8a66597 *r8a66597, u16 pipenum) ++{ ++ unsigned long offset; ++ ++ pipe_stop(r8a66597, pipenum); ++ ++ if (pipenum == 0) { ++ r8a66597_bset(r8a66597, SQSET, DCPCTR); ++ } else if (pipenum < R8A66597_MAX_NUM_PIPE) { ++ offset = get_pipectr_addr(pipenum); ++ r8a66597_bset(r8a66597, SQSET, offset); ++ } else { ++ dev_err(r8a66597_to_dev(r8a66597), ++ "unexpect pipe num(%d)\n", pipenum); ++ } ++} ++ ++static u16 control_reg_sqmon(struct r8a66597 *r8a66597, u16 pipenum) ++{ ++ unsigned long offset; ++ ++ if (pipenum == 0) { ++ return r8a66597_read(r8a66597, DCPCTR) & SQMON; ++ } else if (pipenum < R8A66597_MAX_NUM_PIPE) { ++ offset = get_pipectr_addr(pipenum); ++ return r8a66597_read(r8a66597, offset) & SQMON; ++ } else { ++ dev_err(r8a66597_to_dev(r8a66597), ++ "unexpect pipe num(%d)\n", pipenum); ++ } ++ ++ return 0; ++} ++ ++static u16 save_usb_toggle(struct r8a66597 *r8a66597, u16 pipenum) ++{ ++ return control_reg_sqmon(r8a66597, pipenum); ++} ++ ++static void restore_usb_toggle(struct r8a66597 *r8a66597, u16 pipenum, ++ u16 toggle) ++{ ++ if (toggle) ++ control_reg_sqset(r8a66597, pipenum); ++ else ++ control_reg_sqclr(r8a66597, pipenum); ++} ++ + static inline int get_buffer_size(struct r8a66597 *r8a66597, u16 pipenum) + { + u16 tmp; +@@ -220,18 +269,51 @@ static inline unsigned short mbw_value(struct r8a66597 *r8a66597) + return MBW_16; + } + ++static void r8a66597_change_curpipe(struct r8a66597 *r8a66597, u16 pipenum, ++ u16 isel, u16 fifosel) ++{ ++ u16 tmp, mask, loop; ++ int i = 0; ++ ++ if (!pipenum) { ++ mask = ISEL | CURPIPE; ++ loop = isel; ++ } else { ++ mask = CURPIPE; ++ loop = pipenum; ++ } ++ r8a66597_mdfy(r8a66597, loop, mask, fifosel); ++ ++ do { ++ tmp = r8a66597_read(r8a66597, fifosel); ++ if (i++ > 1000000) { ++ dev_err(r8a66597_to_dev(r8a66597), ++ "r8a66597: register%x, loop %x " ++ "is timeout\n", fifosel, loop); ++ break; ++ } ++ ndelay(1); ++ } while ((tmp & mask) != loop); ++} ++ + static inline void pipe_change(struct r8a66597 *r8a66597, u16 pipenum) + { + struct r8a66597_ep *ep = r8a66597->pipenum2ep[pipenum]; + + if (ep->use_dma) +- return; ++ r8a66597_bclr(r8a66597, DREQE, ep->fifosel); + + r8a66597_mdfy(r8a66597, pipenum, CURPIPE, ep->fifosel); + + ndelay(450); + +- r8a66597_bset(r8a66597, mbw_value(r8a66597), ep->fifosel); ++ if (r8a66597_is_sudmac(r8a66597) && ep->use_dma) ++ r8a66597_bclr(r8a66597, mbw_value(r8a66597), ep->fifosel); ++ else ++ r8a66597_bset(r8a66597, mbw_value(r8a66597), ep->fifosel); ++ ++ if (ep->use_dma) ++ r8a66597_bset(r8a66597, DREQE, ep->fifosel); + } + + static int pipe_buffer_setting(struct r8a66597 *r8a66597, +@@ -336,9 +418,15 @@ static void r8a66597_ep_setting(struct r8a66597 *r8a66597, + ep->fifoaddr = CFIFO; + ep->fifosel = CFIFOSEL; + ep->fifoctr = CFIFOCTR; +- ep->fifotrn = 0; + + ep->pipectr = get_pipectr_addr(pipenum); ++ if (is_bulk_pipe(pipenum) || is_isoc_pipe(pipenum)) { ++ ep->pipetre = get_pipetre_addr(pipenum); ++ ep->pipetrn = get_pipetrn_addr(pipenum); ++ } else { ++ ep->pipetre = 0; ++ ep->pipetrn = 0; ++ } + ep->pipenum = pipenum; + ep->ep.maxpacket = le16_to_cpu(desc->wMaxPacketSize); + r8a66597->pipenum2ep[pipenum] = ep; +@@ -498,6 +586,124 @@ static void start_ep0_write(struct r8a66597_ep *ep, + } + } + ++static void disable_fifosel(struct r8a66597 *r8a66597, u16 pipenum, ++ u16 fifosel) ++{ ++ u16 tmp; ++ ++ tmp = r8a66597_read(r8a66597, fifosel) & CURPIPE; ++ if (tmp == pipenum) ++ r8a66597_change_curpipe(r8a66597, 0, 0, fifosel); ++} ++ ++static void change_bfre_mode(struct r8a66597 *r8a66597, u16 pipenum, ++ int enable) ++{ ++ struct r8a66597_ep *ep = r8a66597->pipenum2ep[pipenum]; ++ u16 tmp, toggle; ++ ++ /* check current BFRE bit */ ++ r8a66597_write(r8a66597, pipenum, PIPESEL); ++ tmp = r8a66597_read(r8a66597, PIPECFG) & R8A66597_BFRE; ++ if ((enable && tmp) || (!enable && !tmp)) ++ return; ++ ++ /* change BFRE bit */ ++ pipe_stop(r8a66597, pipenum); ++ disable_fifosel(r8a66597, pipenum, CFIFOSEL); ++ disable_fifosel(r8a66597, pipenum, D0FIFOSEL); ++ disable_fifosel(r8a66597, pipenum, D1FIFOSEL); ++ ++ toggle = save_usb_toggle(r8a66597, pipenum); ++ ++ r8a66597_write(r8a66597, pipenum, PIPESEL); ++ if (enable) ++ r8a66597_bset(r8a66597, R8A66597_BFRE, PIPECFG); ++ else ++ r8a66597_bclr(r8a66597, R8A66597_BFRE, PIPECFG); ++ ++ /* initialize for internal BFRE flag */ ++ r8a66597_bset(r8a66597, ACLRM, ep->pipectr); ++ r8a66597_bclr(r8a66597, ACLRM, ep->pipectr); ++ ++ restore_usb_toggle(r8a66597, pipenum, toggle); ++} ++ ++static int sudmac_alloc_channel(struct r8a66597 *r8a66597, ++ struct r8a66597_ep *ep, ++ struct r8a66597_request *req) ++{ ++ struct r8a66597_dma *dma; ++ ++ if (!r8a66597_is_sudmac(r8a66597)) ++ return -ENODEV; ++ ++ /* Check transfer type */ ++ if (!is_bulk_pipe(ep->pipenum)) ++ return -EIO; ++ ++ if (r8a66597->dma.used) ++ return -EBUSY; ++ ++ /* set SUDMAC parameters */ ++ dma = &r8a66597->dma; ++ dma->used = 1; ++ if (ep->desc->bEndpointAddress & USB_DIR_IN) { ++ dma->dir = 1; ++ } else { ++ dma->dir = 0; ++ change_bfre_mode(r8a66597, ep->pipenum, 1); ++ } ++ ++ /* set r8a66597_ep paramters */ ++ ep->use_dma = 1; ++ ep->dma = dma; ++ ep->fifoaddr = D0FIFO; ++ ep->fifosel = D0FIFOSEL; ++ ep->fifoctr = D0FIFOCTR; ++ ++ /* dma mapping */ ++ req->req.dma = dma_map_single(r8a66597_to_dev(ep->r8a66597), ++ req->req.buf, req->req.length, ++ dma->dir ? DMA_TO_DEVICE : DMA_FROM_DEVICE); ++ ++ return 0; ++} ++ ++static void sudmac_free_channel(struct r8a66597 *r8a66597, ++ struct r8a66597_ep *ep, ++ struct r8a66597_request *req) ++{ ++ if (!r8a66597_is_sudmac(r8a66597)) ++ return; ++ ++ dma_unmap_single(r8a66597_to_dev(ep->r8a66597), ++ req->req.dma, req->req.length, ++ ep->dma->dir ? DMA_TO_DEVICE : DMA_FROM_DEVICE); ++ ++ r8a66597_bclr(r8a66597, DREQE, ep->fifosel); ++ r8a66597_change_curpipe(r8a66597, 0, 0, ep->fifosel); ++ ++ ep->dma->used = 0; ++ ep->use_dma = 0; ++ ep->fifoaddr = CFIFO; ++ ep->fifosel = CFIFOSEL; ++ ep->fifoctr = CFIFOCTR; ++} ++ ++static void sudmac_start(struct r8a66597 *r8a66597, struct r8a66597_ep *ep, ++ struct r8a66597_request *req) ++{ ++ BUG_ON(req->req.length == 0); ++ ++ r8a66597_sudmac_write(r8a66597, LBA_WAIT, CH0CFG); ++ r8a66597_sudmac_write(r8a66597, req->req.dma, CH0BA); ++ r8a66597_sudmac_write(r8a66597, req->req.length, CH0BBC); ++ r8a66597_sudmac_write(r8a66597, CH0ENDE, DINTCTRL); ++ ++ r8a66597_sudmac_write(r8a66597, DEN, CH0DEN); ++} ++ + static void start_packet_write(struct r8a66597_ep *ep, + struct r8a66597_request *req) + { +@@ -508,11 +714,29 @@ static void start_packet_write(struct r8a66597_ep *ep, + disable_irq_empty(r8a66597, ep->pipenum); + pipe_start(r8a66597, ep->pipenum); + +- tmp = r8a66597_read(r8a66597, ep->fifoctr); +- if (unlikely((tmp & FRDY) == 0)) +- pipe_irq_enable(r8a66597, ep->pipenum); +- else +- irq_packet_write(ep, req); ++ if (req->req.length == 0) { ++ transfer_complete(ep, req, 0); ++ } else { ++ r8a66597_write(r8a66597, ~(1 << ep->pipenum), BRDYSTS); ++ if (sudmac_alloc_channel(r8a66597, ep, req) < 0) { ++ /* PIO mode */ ++ pipe_change(r8a66597, ep->pipenum); ++ disable_irq_empty(r8a66597, ep->pipenum); ++ pipe_start(r8a66597, ep->pipenum); ++ tmp = r8a66597_read(r8a66597, ep->fifoctr); ++ if (unlikely((tmp & FRDY) == 0)) ++ pipe_irq_enable(r8a66597, ep->pipenum); ++ else ++ irq_packet_write(ep, req); ++ } else { ++ /* DMA mode */ ++ pipe_change(r8a66597, ep->pipenum); ++ disable_irq_nrdy(r8a66597, ep->pipenum); ++ pipe_start(r8a66597, ep->pipenum); ++ enable_irq_nrdy(r8a66597, ep->pipenum); ++ sudmac_start(r8a66597, ep, req); ++ } ++ } + } + + static void start_packet_read(struct r8a66597_ep *ep, +@@ -527,17 +751,26 @@ static void start_packet_read(struct r8a66597_ep *ep, + pipe_start(r8a66597, pipenum); + pipe_irq_enable(r8a66597, pipenum); + } else { +- if (ep->use_dma) { +- r8a66597_bset(r8a66597, TRCLR, ep->fifosel); +- pipe_change(r8a66597, pipenum); +- r8a66597_bset(r8a66597, TRENB, ep->fifosel); ++ pipe_stop(r8a66597, pipenum); ++ if (ep->pipetre) { ++ enable_irq_nrdy(r8a66597, pipenum); ++ r8a66597_write(r8a66597, TRCLR, ep->pipetre); + r8a66597_write(r8a66597, +- (req->req.length + ep->ep.maxpacket - 1) +- / ep->ep.maxpacket, +- ep->fifotrn); ++ DIV_ROUND_UP(req->req.length, ep->ep.maxpacket), ++ ep->pipetrn); ++ r8a66597_bset(r8a66597, TRENB, ep->pipetre); ++ } ++ ++ if (sudmac_alloc_channel(r8a66597, ep, req) < 0) { ++ /* PIO mode */ ++ change_bfre_mode(r8a66597, ep->pipenum, 0); ++ pipe_start(r8a66597, pipenum); /* trigger once */ ++ pipe_irq_enable(r8a66597, pipenum); ++ } else { ++ pipe_change(r8a66597, pipenum); ++ sudmac_start(r8a66597, ep, req); ++ pipe_start(r8a66597, pipenum); /* trigger once */ + } +- pipe_start(r8a66597, pipenum); /* trigger once */ +- pipe_irq_enable(r8a66597, pipenum); + } + } + +@@ -694,6 +927,9 @@ __acquires(r8a66597->lock) + if (!list_empty(&ep->queue)) + restart = 1; + ++ if (ep->use_dma) ++ sudmac_free_channel(ep->r8a66597, ep, req); ++ + spin_unlock(&ep->r8a66597->lock); + req->req.complete(&ep->ep, &req->req); + spin_lock(&ep->r8a66597->lock); +@@ -1170,6 +1406,65 @@ __acquires(r8a66597->lock) + } + } + ++static void sudmac_finish(struct r8a66597 *r8a66597, struct r8a66597_ep *ep) ++{ ++ u16 pipenum; ++ struct r8a66597_request *req; ++ u32 len; ++ int i = 0; ++ ++ pipenum = ep->pipenum; ++ pipe_change(r8a66597, pipenum); ++ ++ while (!(r8a66597_read(r8a66597, ep->fifoctr) & FRDY)) { ++ udelay(1); ++ if (unlikely(i++ >= 10000)) { /* timeout = 10 msec */ ++ dev_err(r8a66597_to_dev(r8a66597), ++ "%s: FRDY was not set (%d)\n", ++ __func__, pipenum); ++ return; ++ } ++ } ++ ++ r8a66597_bset(r8a66597, BCLR, ep->fifoctr); ++ req = get_request_from_ep(ep); ++ ++ /* prepare parameters */ ++ len = r8a66597_sudmac_read(r8a66597, CH0CBC); ++ req->req.actual += len; ++ ++ /* clear */ ++ r8a66597_sudmac_write(r8a66597, CH0STCLR, DSTSCLR); ++ ++ /* check transfer finish */ ++ if ((!req->req.zero && (req->req.actual == req->req.length)) ++ || (len % ep->ep.maxpacket)) { ++ if (ep->dma->dir) { ++ disable_irq_ready(r8a66597, pipenum); ++ enable_irq_empty(r8a66597, pipenum); ++ } else { ++ /* Clear the interrupt flag for next transfer */ ++ r8a66597_write(r8a66597, ~(1 << pipenum), BRDYSTS); ++ transfer_complete(ep, req, 0); ++ } ++ } ++} ++ ++static void r8a66597_sudmac_irq(struct r8a66597 *r8a66597) ++{ ++ u32 irqsts; ++ struct r8a66597_ep *ep; ++ u16 pipenum; ++ ++ irqsts = r8a66597_sudmac_read(r8a66597, DINTSTS); ++ if (irqsts & CH0ENDS) { ++ r8a66597_sudmac_write(r8a66597, CH0ENDC, DINTSTSCLR); ++ pipenum = (r8a66597_read(r8a66597, D0FIFOSEL) & CURPIPE); ++ ep = r8a66597->pipenum2ep[pipenum]; ++ sudmac_finish(r8a66597, ep); ++ } ++} ++ + static irqreturn_t r8a66597_irq(int irq, void *_r8a66597) + { + struct r8a66597 *r8a66597 = _r8a66597; +@@ -1180,6 +1475,9 @@ static irqreturn_t r8a66597_irq(int irq, void *_r8a66597) + u16 savepipe; + u16 mask0; + ++ if (r8a66597_is_sudmac(r8a66597)) ++ r8a66597_sudmac_irq(r8a66597); ++ + spin_lock(&r8a66597->lock); + + intsts0 = r8a66597_read(r8a66597, INTSTS0); +@@ -1541,6 +1839,8 @@ static int __exit r8a66597_remove(struct platform_device *pdev) + + del_timer_sync(&r8a66597->timer); + iounmap(r8a66597->reg); ++ if (r8a66597->pdata->sudmac) ++ iounmap(r8a66597->sudmac_reg); + free_irq(platform_get_irq(pdev, 0), r8a66597); + r8a66597_free_request(&r8a66597->ep[0].ep, r8a66597->ep0_req); + #ifdef CONFIG_HAVE_CLK +@@ -1557,6 +1857,26 @@ static void nop_completion(struct usb_ep *ep, struct usb_request *r) + { + } + ++static int __init r8a66597_sudmac_ioremap(struct r8a66597 *r8a66597, ++ struct platform_device *pdev) ++{ ++ struct resource *res; ++ ++ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "sudmac"); ++ if (!res) { ++ dev_err(&pdev->dev, "platform_get_resource error(sudmac).\n"); ++ return -ENODEV; ++ } ++ ++ r8a66597->sudmac_reg = ioremap(res->start, resource_size(res)); ++ if (r8a66597->sudmac_reg == NULL) { ++ dev_err(&pdev->dev, "ioremap error(sudmac).\n"); ++ return -ENOMEM; ++ } ++ ++ return 0; ++} ++ + static int __init r8a66597_probe(struct platform_device *pdev) + { + #ifdef CONFIG_HAVE_CLK +@@ -1634,6 +1954,11 @@ static int __init r8a66597_probe(struct platform_device *pdev) + clk_enable(r8a66597->clk); + } + #endif ++ if (r8a66597->pdata->sudmac) { ++ ret = r8a66597_sudmac_ioremap(r8a66597, pdev); ++ if (ret < 0) ++ goto clean_up2; ++ } + + disable_controller(r8a66597); /* make sure controller is disabled */ + +@@ -1666,7 +1991,6 @@ static int __init r8a66597_probe(struct platform_device *pdev) + r8a66597->ep[0].fifoaddr = CFIFO; + r8a66597->ep[0].fifosel = CFIFOSEL; + r8a66597->ep[0].fifoctr = CFIFOCTR; +- r8a66597->ep[0].fifotrn = 0; + r8a66597->ep[0].pipectr = get_pipectr_addr(0); + r8a66597->pipenum2ep[0] = &r8a66597->ep[0]; + r8a66597->epaddr2ep[0] = &r8a66597->ep[0]; +@@ -1695,6 +2019,8 @@ clean_up2: + #endif + clean_up: + if (r8a66597) { ++ if (r8a66597->sudmac_reg) ++ iounmap(r8a66597->sudmac_reg); + if (r8a66597->ep0_req) + r8a66597_free_request(&r8a66597->ep[0].ep, + r8a66597->ep0_req); +diff --git a/drivers/usb/gadget/r8a66597-udc.h b/drivers/usb/gadget/r8a66597-udc.h +index 832ee59..8e3de61 100644 +--- a/drivers/usb/gadget/r8a66597-udc.h ++++ b/drivers/usb/gadget/r8a66597-udc.h +@@ -43,6 +43,7 @@ + ((pipenum >= R8A66597_BASE_PIPENUM_ISOC) && \ + (pipenum < (R8A66597_BASE_PIPENUM_ISOC + R8A66597_MAX_NUM_ISOC))) + ++#define r8a66597_is_sudmac(r8a66597) (r8a66597->pdata->sudmac) + struct r8a66597_pipe_info { + u16 pipe; + u16 epnum; +@@ -60,6 +61,7 @@ struct r8a66597_request { + struct r8a66597_ep { + struct usb_ep ep; + struct r8a66597 *r8a66597; ++ struct r8a66597_dma *dma; + + struct list_head queue; + unsigned busy:1; +@@ -75,13 +77,20 @@ struct r8a66597_ep { + unsigned char fifoaddr; + unsigned char fifosel; + unsigned char fifoctr; +- unsigned char fifotrn; + unsigned char pipectr; ++ unsigned char pipetre; ++ unsigned char pipetrn; ++}; ++ ++struct r8a66597_dma { ++ unsigned used:1; ++ unsigned dir:1; /* 1 = IN(write), 0 = OUT(read) */ + }; + + struct r8a66597 { + spinlock_t lock; + void __iomem *reg; ++ void __iomem *sudmac_reg; + + #ifdef CONFIG_HAVE_CLK + struct clk *clk; +@@ -94,6 +103,7 @@ struct r8a66597 { + struct r8a66597_ep ep[R8A66597_MAX_NUM_PIPE]; + struct r8a66597_ep *pipenum2ep[R8A66597_MAX_NUM_PIPE]; + struct r8a66597_ep *epaddr2ep[16]; ++ struct r8a66597_dma dma; + + struct timer_list timer; + struct usb_request *ep0_req; /* for internal request */ +@@ -251,7 +261,21 @@ static inline u16 get_xtal_from_pdata(struct r8a66597_platdata *pdata) + return clock; + } + ++static inline u32 r8a66597_sudmac_read(struct r8a66597 *r8a66597, ++ unsigned long offset) ++{ ++ return ioread32(r8a66597->sudmac_reg + offset); ++} ++ ++static inline void r8a66597_sudmac_write(struct r8a66597 *r8a66597, u32 val, ++ unsigned long offset) ++{ ++ iowrite32(val, r8a66597->sudmac_reg + offset); ++} ++ + #define get_pipectr_addr(pipenum) (PIPE1CTR + (pipenum - 1) * 2) ++#define get_pipetre_addr(pipenum) (PIPE1TRE + (pipenum - 1) * 4) ++#define get_pipetrn_addr(pipenum) (PIPE1TRN + (pipenum - 1) * 4) + + #define enable_irq_ready(r8a66597, pipenum) \ + enable_pipe_irq(r8a66597, pipenum, BRDYENB) +diff --git a/include/linux/usb/r8a66597.h b/include/linux/usb/r8a66597.h +index 7cd89e7..1f5ef88 100644 +--- a/include/linux/usb/r8a66597.h ++++ b/include/linux/usb/r8a66597.h +@@ -48,6 +48,9 @@ struct r8a66597_platdata { + + /* (external controller only) set one = WR0_N shorted to WR1_N */ + unsigned wr0_shorted_to_wr1:1; ++ ++ /* set one = using SUDMAC */ ++ unsigned sudmac:1; + }; + + /* Register definitions */ +@@ -417,5 +420,62 @@ struct r8a66597_platdata { + #define USBSPD 0x00C0 + #define RTPORT 0x0001 + ++/* SUDMAC registers */ ++#define CH0CFG 0x00 ++#define CH1CFG 0x04 ++#define CH0BA 0x10 ++#define CH1BA 0x14 ++#define CH0BBC 0x18 ++#define CH1BBC 0x1C ++#define CH0CA 0x20 ++#define CH1CA 0x24 ++#define CH0CBC 0x28 ++#define CH1CBC 0x2C ++#define CH0DEN 0x30 ++#define CH1DEN 0x34 ++#define DSTSCLR 0x38 ++#define DBUFCTRL 0x3C ++#define DINTCTRL 0x40 ++#define DINTSTS 0x44 ++#define DINTSTSCLR 0x48 ++#define CH0SHCTRL 0x50 ++#define CH1SHCTRL 0x54 ++ ++/* SUDMAC Configuration Registers */ ++#define SENDBUFM 0x1000 /* b12: Transmit Buffer Mode */ ++#define RCVENDM 0x0100 /* b8: Receive Data Transfer End Mode */ ++#define LBA_WAIT 0x0030 /* b5-4: Local Bus Access Wait */ ++ ++/* DMA Enable Registers */ ++#define DEN 0x0001 /* b1: DMA Transfer Enable */ ++ ++/* DMA Status Clear Register */ ++#define CH1STCLR 0x0002 /* b2: Ch1 DMA Status Clear */ ++#define CH0STCLR 0x0001 /* b1: Ch0 DMA Status Clear */ ++ ++/* DMA Buffer Control Register */ ++#define CH1BUFW 0x0200 /* b9: Ch1 DMA Buffer Data Transfer Enable */ ++#define CH0BUFW 0x0100 /* b8: Ch0 DMA Buffer Data Transfer Enable */ ++#define CH1BUFS 0x0002 /* b2: Ch1 DMA Buffer Data Status */ ++#define CH0BUFS 0x0001 /* b1: Ch0 DMA Buffer Data Status */ ++ ++/* DMA Interrupt Control Register */ ++#define CH1ERRE 0x0200 /* b9: Ch1 SHwy Res Err Detect Int Enable */ ++#define CH0ERRE 0x0100 /* b8: Ch0 SHwy Res Err Detect Int Enable */ ++#define CH1ENDE 0x0002 /* b2: Ch1 DMA Transfer End Int Enable */ ++#define CH0ENDE 0x0001 /* b1: Ch0 DMA Transfer End Int Enable */ ++ ++/* DMA Interrupt Status Register */ ++#define CH1ERRS 0x0200 /* b9: Ch1 SHwy Res Err Detect Int Status */ ++#define CH0ERRS 0x0100 /* b8: Ch0 SHwy Res Err Detect Int Status */ ++#define CH1ENDS 0x0002 /* b2: Ch1 DMA Transfer End Int Status */ ++#define CH0ENDS 0x0001 /* b1: Ch0 DMA Transfer End Int Status */ ++ ++/* DMA Interrupt Status Clear Register */ ++#define CH1ERRC 0x0200 /* b9: Ch1 SHwy Res Err Detect Int Stat Clear */ ++#define CH0ERRC 0x0100 /* b8: Ch0 SHwy Res Err Detect Int Stat Clear */ ++#define CH1ENDC 0x0002 /* b2: Ch1 DMA Transfer End Int Stat Clear */ ++#define CH0ENDC 0x0001 /* b1: Ch0 DMA Transfer End Int Stat Clear */ ++ + #endif /* __LINUX_USB_R8A66597_H */ + +-- +1.7.1 +_______________________________________________ +LTSI-dev mailing list +LTSI-dev@lists.linuxfoundation.org +https://lists.linuxfoundation.org/mailman/listinfo/ltsi-dev + diff --git a/patches.r8a66597-udc/012-usb-gadget-r8a66597-udc-fix-flush-fifo-handling.patch b/patches.r8a66597-udc/012-usb-gadget-r8a66597-udc-fix-flush-fifo-handling.patch new file mode 100644 index 00000000000000..39b779fdef8e58 --- /dev/null +++ b/patches.r8a66597-udc/012-usb-gadget-r8a66597-udc-fix-flush-fifo-handling.patch @@ -0,0 +1,46 @@ +From ltsi-dev-bounces@lists.linuxfoundation.org Mon May 28 23:23:40 2012 +From: "Shimoda, Yoshihiro" <yoshihiro.shimoda.uh@renesas.com> +Date: Tue, 29 May 2012 15:23:36 +0900 +Subject: [LTSI-dev] [PATCH 12/12] usb: gadget: r8a66597-udc: fix flush fifo handling +To: ltsi-dev@lists.linuxfoundation.org +Message-ID: <4FC46B68.2050500@renesas.com> + + +>From 4014d3e59bb75141c49cf7161f385ff1bdaf2eed Mon Sep 17 00:00:00 2001 +From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> +Date: Mon, 31 Oct 2011 16:01:33 +0900 +Subject: usb: gadget: r8a66597-udc: fix flush fifo handling + +The "BCLR" in CFIFOCTR/DnFIFOCTR can flush the fifo of "CPU side" only. +To flush the fifo of "SIE side", we have to use the "ACLRM" in PIPEnCTR. + +Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> +Signed-off-by: Felipe Balbi <balbi@ti.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> +(cherry picked from commit 05bb7013038a2b609aef14ad4e07afe031daec49) + +Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> +--- + drivers/usb/gadget/r8a66597-udc.c | 2 ++ + 1 files changed, 2 insertions(+), 0 deletions(-) + +diff --git a/drivers/usb/gadget/r8a66597-udc.c b/drivers/usb/gadget/r8a66597-udc.c +index 7f37a2a..fdd09de 100644 +--- a/drivers/usb/gadget/r8a66597-udc.c ++++ b/drivers/usb/gadget/r8a66597-udc.c +@@ -1718,6 +1718,8 @@ static void r8a66597_fifo_flush(struct usb_ep *_ep) + if (list_empty(&ep->queue) && !ep->busy) { + pipe_stop(ep->r8a66597, ep->pipenum); + r8a66597_bclr(ep->r8a66597, BCLR, ep->fifoctr); ++ r8a66597_write(ep->r8a66597, ACLRM, ep->pipectr); ++ r8a66597_write(ep->r8a66597, 0, ep->pipectr); + } + spin_unlock_irqrestore(&ep->r8a66597->lock, flags); + } +-- +1.7.1 +_______________________________________________ +LTSI-dev mailing list +LTSI-dev@lists.linuxfoundation.org +https://lists.linuxfoundation.org/mailman/listinfo/ltsi-dev + @@ -878,3 +878,17 @@ patches.sh7757lcr/018-sh-fix-the-sh_mmcif_plat_data-in-board-sh7757lcr.patch patches.sh7757lcr/019-sh-modify-a-resource-of-sh_eth_giga1_resources-in-board-sh7757lcr.patch patches.sh7757lcr/020-sh-kexec-register-crashk_res.patch patches.sh7757lcr/021-sh-kexec-add-physical_start.patch + + +patches.r8a66597-udc/001-usb-gadget-add-platform-module-alias-where-it-is-missing.patch +patches.r8a66597-udc/002-usb-update-email-address-in-r8a66597-udc-and-m66592-udc.patch +patches.r8a66597-udc/003-usb-gadget-r8a66597-udc-make-buswait-configurable-through-platform-data.patch +patches.r8a66597-udc/004-usb-gadget-r8a66597-udc-add-support-for-test_mode.patch +patches.r8a66597-udc/005-usb-gadget-clean-up-fsf-boilerplate-text.patch +patches.r8a66597-udc/006-usb-irq-remove-irqf_disabled.patch +patches.r8a66597-udc/007-usb-gadget-r8a66597-udc-change-prototype-of-r8a66597_write_fifo.patch +patches.r8a66597-udc/008-usb-r8a66597-hcd-add-function-for-external-controller.patch +patches.r8a66597-udc/009-usb-gadget-r8a66597-udc-add-function-for-external-controller.patch +patches.r8a66597-udc/010-usb-gadget-r8a66597-udc-use-dev_-instead-of-printk.patch +patches.r8a66597-udc/011-usb-gadget-r8a66597-udc-add-support-for-sudmac.patch +patches.r8a66597-udc/012-usb-gadget-r8a66597-udc-fix-flush-fifo-handling.patch |