[PATCH] usb: phy: fix Kconfig warning

2013-01-28 Thread Felipe Balbi
Recent commits introduced the following
Kconfig warning:

warning: (USB_MUSB_HDRC  OMAP_USB3) selects \
OMAP_CONTROL_USB which has unmet direct \
dependencies (USB_SUPPORT  ARCH_OMAP2PLUS)

This patch just fixes it, by removing the
unnecessary OMAP dependency.

Signed-off-by: Felipe Balbi ba...@ti.com
---

 drivers/usb/phy/Kconfig | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
index 9bbedec..65217a5 100644
--- a/drivers/usb/phy/Kconfig
+++ b/drivers/usb/phy/Kconfig
@@ -27,7 +27,6 @@ config OMAP_USB3
 
 config OMAP_CONTROL_USB
tristate OMAP CONTROL USB Driver
-   depends on ARCH_OMAP2PLUS
help
  Enable this to add support for the USB part present in the control
  module. This driver has API to power on the USB2 PHY and to write to
-- 
1.8.1.rc1.5.g7e0651a

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH, resubmit] ax88179_178a: ASIX AX88179_178A USB 3.0/2.0 to gigabit ethernet adapter driver

2013-01-28 Thread Bjørn Mork
Hello Michael,

Michael Leun lkml20130...@newton.leun.net writes:

 I would vote to not accept that driver for mainline as long as this
 issues are not fixed. 

 The vendor should not be able to claim hooray, hooray, great device,
 we even have an driver in linux main line when it is actually such an
 useless crap.

Well, that is fortunately not how these things work. The main goal is
getting the devices supported in the kernel. Bugs can be fixed.  If a
vendor can get any positive gain out of having a driver in mainline,
then that is good for everyone, isn't it?  Of course, we can all agree
that the effect of a *working* driver is more positive than a
non-working driver...

For now, the main focus should be fixing the issues which has been noted
during review.  Your testing feedback is of course very useful, but you
probably need to back them up with actual code change proposals if they
are going to be dealt with at this stage.

 Of course I'm offering to help with any information or testing, but
 unfortunately I do not have the knowhow to fix anything myself. 

I believe this is where you are totally wrong.  You obviuously have the
ability to create a few simple test cases for yourself and see if the
driver behaves as you expect.  That is very useful.

And you have a device.  That is also useful.

Now, the driver source code is available.  And there is another Asix
driver in the kernel which already has been cleaned up and can be used
as an example. And maybe even partly used for the new devices as well,
if the code is duplicated?  I have not looked at this in detail, but I
suspect that much of the problem with the ax88179_178a driver is that it
has completely ignored all the work that has gone into the asix driver
after it was mainlined.  I find it unlikely that there is no reusable
code in the asix_devices.c, asix_common.c and ax88172a.c files.  Trying
to rewrite ax88179_178a to share as much code as possible seems like the
best way to clean it up and fix bugs.

You have documents like
http://www.kernel.org/doc/Documentation/SubmittingPatches helping a lot
with cleanup jobs like this, because it is mostly about just following
that recipe.  If you do, then the code will be reviewable by the
community because the size will be reduced and the style readable.  And
the driver might even work, as the cleanup will quite possibly reveal a
number of bugs...

Please consider this option.  Reading and fixing up C code is not very
difficult. Getting this driver into the kernel in a good shape is mostly
just monkey work.  But some monkey has to do it :-)


Bjørn
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/2] usb-uas: update MAINTAINERS entry

2013-01-28 Thread Gerd Hoffmann
  Hi,

 Problem is that uas is pretty much the only device using streams,
 so uas will be the one who triggers any stream bugs in xhci.
 I have no idea how solid xhci streams support is at the moment.
 
 The xHCI streams support isn't well tested, because the UAS devices I
 had were so buggy that I couldn't fully test them, and the UAS driver
 didn't (doesn't still?) properly support cancellation or device reset.

There have been a number of improvements fixes there, it should do alot
better now.

 Also, I do know there are a couple of streams work-arounds that need to
 be created for the Intel Panther Point xHCI host controller, so I would
 suggest testing with an NEC/Renesas xHCI host instead.  I will get
 around to implementing them, but other bugs have taken a higher
 priority.

Hmm.  I have a nec xhci for that, but streams not working on Intel
pretty much blocks removing the BROKEN tag from uas :(

cheers,
  Gerd

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Page allocation failure on v3.8-rc5

2013-01-28 Thread Felipe Balbi
Hi,

The following page allocation failure triggers sometimes when I plug my
memory card reader on a USB port.


[850845.928795] usb 1-4: new high-speed USB device number 48 using ehci-pci
[850846.300702] usb 1-4: New USB device found, idVendor=0bda, idProduct=0119
[850846.300707] usb 1-4: New USB device strings: Mfr=1, Product=2, 
SerialNumber=3
[850846.300711] usb 1-4: Product: USB2.0-CRW
[850846.300715] usb 1-4: Manufacturer: Generic
[850846.300718] usb 1-4: SerialNumber: 2009081519810
[850846.302733] scsi86 : usb-storage 1-4:1.0
[850847.304359] scsi 86:0:0:0: Direct-Access Generic- SD/MMC   1.00 
PQ: 0 ANSI: 0 CCS
[850847.305734] sd 86:0:0:0: Attached scsi generic sg4 type 0
[850848.456294] sd 86:0:0:0: [sdd] 7911424 512-byte logical blocks: (4.05 
GB/3.77 GiB)
[850848.457160] sd 86:0:0:0: [sdd] Write Protect is off
[850848.457166] sd 86:0:0:0: [sdd] Mode Sense: 03 00 00 00
[850848.458054] sd 86:0:0:0: [sdd] No Caching mode page present
[850848.458060] sd 86:0:0:0: [sdd] Assuming drive cache: write through
[850848.461502] sd 86:0:0:0: [sdd] No Caching mode page present
[850848.461507] sd 86:0:0:0: [sdd] Assuming drive cache: write through
[850848.461963] kworker/u:0: page allocation failure: order:4, mode:0x2000d0
[850848.461969] Pid: 7122, comm: kworker/u:0 Tainted: GW3.8.0-rc4+ 
#206
[850848.461972] Call Trace:
[850848.461984]  [810d02a8] ? warn_alloc_failed+0x116/0x128
[850848.461991]  [810d31d9] ? __alloc_pages_nodemask+0x6b5/0x751
[850848.462000]  [81106297] ? kmem_getpages+0x59/0x129
[850848.462006]  [81106b88] ? fallback_alloc+0x12f/0x1fc
[850848.462013]  [811071c7] ? kmem_cache_alloc_trace+0x87/0xf6
[850848.462021]  [812a633c] ? check_partition+0x28/0x1ac
[850848.462027]  [812a60bd] ? rescan_partitions+0xa4/0x27c
[850848.462034]  [8113bcfb] ? __blkdev_get+0x1ac/0x3d2
[850848.462040]  [8113c0b1] ? blkdev_get+0x190/0x2d8
[850848.462046]  [8113b23f] ? bdget+0x3b/0x12b
[850848.462052]  [812a41a6] ? add_disk+0x268/0x3e2
[850848.462058]  [81382f3d] ? sd_probe_async+0x11b/0x1cc
[850848.462066]  [81055f74] ? async_run_entry_fn+0xa2/0x173
[850848.462072]  [81055ed2] ? async_schedule+0x15/0x15
[850848.462079]  [8104bb79] ? process_one_work+0x172/0x2ca
[850848.462084]  [8104b88a] ? manage_workers+0x22a/0x23c
[850848.462090]  [81055ed2] ? async_schedule+0x15/0x15
[850848.462096]  [8104bfa4] ? worker_thread+0x11d/0x1b7
[850848.462102]  [8104be87] ? rescuer_thread+0x18c/0x18c
[850848.462109]  [81050421] ? kthread+0x86/0x8e
[850848.462116]  [8105039b] ? __kthread_parkme+0x60/0x60
[850848.462125]  [814a306c] ? ret_from_fork+0x7c/0xb0
[850848.462132]  [8105039b] ? __kthread_parkme+0x60/0x60
[850848.462135] Mem-Info:
[850848.462138] Node 0 DMA per-cpu:
[850848.462143] CPU0: hi:0, btch:   1 usd:   0
[850848.462147] CPU1: hi:0, btch:   1 usd:   0
[850848.462151] CPU2: hi:0, btch:   1 usd:   0
[850848.462154] CPU3: hi:0, btch:   1 usd:   0
[850848.462158] CPU4: hi:0, btch:   1 usd:   0
[850848.462161] CPU5: hi:0, btch:   1 usd:   0
[850848.462165] CPU6: hi:0, btch:   1 usd:   0
[850848.462168] CPU7: hi:0, btch:   1 usd:   0
[850848.462171] Node 0 DMA32 per-cpu:
[850848.462176] CPU0: hi:  186, btch:  31 usd:   0
[850848.462180] CPU1: hi:  186, btch:  31 usd:   0
[850848.462183] CPU2: hi:  186, btch:  31 usd:   0
[850848.462185] CPU3: hi:  186, btch:  31 usd:   0
[850848.462187] CPU4: hi:  186, btch:  31 usd:   0
[850848.462189] CPU5: hi:  186, btch:  31 usd:   0
[850848.462192] CPU6: hi:  186, btch:  31 usd:   0
[850848.462194] CPU7: hi:  186, btch:  31 usd:   0
[850848.462196] Node 0 Normal per-cpu:
[850848.462199] CPU0: hi:  186, btch:  31 usd:   0
[850848.462201] CPU1: hi:  186, btch:  31 usd:   0
[850848.462203] CPU2: hi:  186, btch:  31 usd:   0
[850848.462206] CPU3: hi:  186, btch:  31 usd:   0
[850848.462208] CPU4: hi:  186, btch:  31 usd:   0
[850848.462210] CPU5: hi:  186, btch:  31 usd:   0
[850848.462212] CPU6: hi:  186, btch:  31 usd:   0
[850848.462215] CPU7: hi:  186, btch:  31 usd:   0
[850848.46] active_anon:24837 inactive_anon:19982 isolated_anon:0
[850848.46]  active_file:452273 inactive_file:418905 isolated_file:32
[850848.46]  unevictable:0 dirty:2445 writeback:0 unstable:0
[850848.46]  free:66997 slab_reclaimable:515526 slab_unreclaimable:12480
[850848.46]  mapped:4698 shmem:82 pagetables:2389 bounce:0
[850848.46]  free_cma:0
[850848.462228] Node 0 DMA free:15904kB min:168kB low:208kB high:252kB 
active_anon:0kB inactive_anon:0kB active_file:0kB inactive_file:0kB 
unevictable:0kB isolated(anon):0kB isolated(file):0kB present:15680kB 
managed:15904kB mlocked:0kB dirty:0kB writeback:0kB mapped:0kB shmem:0kB 
slab_reclaimable:0kB 

[PATCH v2 corrected] usb/gadget: nokia: use function framework for ACM

2013-01-28 Thread Andrzej Pietrasiewicz
From: Sebastian Andrzej Siewior bige...@linutronix.de

This patch converts the nokia gadget to make use of the function
framework to request the ACM function.

The old include interface for acm is now removed since nokia was the
last user of it (for ACM).

Signed-off-by: Sebastian Andrzej Siewior bige...@linutronix.de

[Andrzej Pietrasiewicz: resolved merge conflict: no acm_strings
in acm_alloc_basic_func and no acm_string_defs in acm_old_unbind;
bMaxPower is now MaxPower and is expressed with different numbers]
Signed-off-by: Andrzej Pietrasiewicz andrze...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 drivers/usb/gadget/Kconfig|1 +
 drivers/usb/gadget/f_acm.c|   83 +++-
 drivers/usb/gadget/nokia.c|   82 +++-
 drivers/usb/gadget/u_serial.h |1 -
 4 files changed, 72 insertions(+), 95 deletions(-)

diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
index 6665d25..afb78f6 100644
--- a/drivers/usb/gadget/Kconfig
+++ b/drivers/usb/gadget/Kconfig
@@ -833,6 +833,7 @@ config USB_G_NOKIA
depends on PHONET
select USB_LIBCOMPOSITE
select USB_U_SERIAL
+   select USB_F_ACM
help
  The Nokia composite gadget provides support for acm, obex
  and phonet in only one composite gadget driver.
diff --git a/drivers/usb/gadget/f_acm.c b/drivers/usb/gadget/f_acm.c
index 1ae180b..61b33d2 100644
--- a/drivers/usb/gadget/f_acm.c
+++ b/drivers/usb/gadget/f_acm.c
@@ -715,72 +715,6 @@ fail:
return status;
 }
 
-static struct f_acm *acm_alloc_basic_func(void)
-{
-   struct f_acm*acm;
-
-   acm = kzalloc(sizeof(*acm), GFP_KERNEL);
-   if (!acm)
-   return NULL;
-
-   spin_lock_init(acm-lock);
-
-   acm-port.connect = acm_connect;
-   acm-port.disconnect = acm_disconnect;
-   acm-port.send_break = acm_send_break;
-
-   acm-port.func.name = acm;
-   /* descriptors are per-instance copies */
-   acm-port.func.bind = acm_bind;
-   acm-port.func.set_alt = acm_set_alt;
-   acm-port.func.setup = acm_setup;
-   acm-port.func.disable = acm_disable;
-
-   return acm;
-}
-
-#ifdef USB_FACM_INCLUDED
-static void
-acm_old_unbind(struct usb_configuration *c, struct usb_function *f)
-{
-   struct f_acm*acm = func_to_acm(f);
-
-   usb_free_all_descriptors(f);
-   if (acm-notify_req)
-   gs_free_req(acm-notify, acm-notify_req);
-   kfree(acm);
-}
-
-/**
- * acm_bind_config - add a CDC ACM function to a configuration
- * @c: the configuration to support the CDC ACM instance
- * @port_num: /dev/ttyGS* port this interface will use
- * Context: single threaded during gadget setup
- *
- * Returns zero on success, else negative errno.
- *
- */
-int acm_bind_config(struct usb_configuration *c, u8 port_num)
-{
-   struct f_acm*acm;
-   int status;
-
-   /* allocate and initialize one new instance */
-   acm = acm_alloc_basic_func();
-   if (!acm)
-   return -ENOMEM;
-
-   acm-port_num = port_num;
-   acm-port.func.unbind = acm_old_unbind;
-
-   status = usb_add_function(c, acm-port.func);
-   if (status)
-   kfree(acm);
-   return status;
-}
-
-#else
-
 static void acm_unbind(struct usb_configuration *c, struct usb_function *f)
 {
struct f_acm*acm = func_to_acm(f);
@@ -803,10 +737,24 @@ static struct usb_function *acm_alloc_func(struct 
usb_function_instance *fi)
struct f_serial_opts *opts;
struct f_acm *acm;
 
-   acm = acm_alloc_basic_func();
+   acm = kzalloc(sizeof(*acm), GFP_KERNEL);
if (!acm)
return ERR_PTR(-ENOMEM);
 
+   spin_lock_init(acm-lock);
+
+   acm-port.connect = acm_connect;
+   acm-port.disconnect = acm_disconnect;
+   acm-port.send_break = acm_send_break;
+
+   acm-port.func.name = acm;
+   acm-port.func.strings = acm_strings;
+   /* descriptors are per-instance copies */
+   acm-port.func.bind = acm_bind;
+   acm-port.func.set_alt = acm_set_alt;
+   acm-port.func.setup = acm_setup;
+   acm-port.func.disable = acm_disable;
+
opts = container_of(fi, struct f_serial_opts, func_inst);
acm-port_num = opts-port_num;
acm-port.func.unbind = acm_unbind;
@@ -835,4 +783,3 @@ static struct usb_function_instance 
*acm_alloc_instance(void)
 }
 DECLARE_USB_FUNCTION_INIT(acm, acm_alloc_instance, acm_alloc_func);
 MODULE_LICENSE(GPL);
-#endif
diff --git a/drivers/usb/gadget/nokia.c b/drivers/usb/gadget/nokia.c
index def3740..c3ad777 100644
--- a/drivers/usb/gadget/nokia.c
+++ b/drivers/usb/gadget/nokia.c
@@ -37,8 +37,6 @@
  * the runtime footprint, and giving us at least some parts of what
  * a gcc --combine ... part1.c part2.c part3.c ...  build would.
  */
-#define USB_FACM_INCLUDED
-#include f_acm.c
 #include f_ecm.c
 #include f_obex.c
 

RE: [PATCH 1/3] usb: otg: nop: add dt support

2013-01-28 Thread Mohammed, Afzal
Hi Michael,

On Mon, Jan 28, 2013 at 03:10:05, Michael Grzeschik wrote:
 On Thu, Sep 27, 2012 at 11:15:05AM +0530, Afzal Mohammed wrote:

  From: B, Ravi ravib...@ti.com
  
  Added device tree support for nop transceiver driver and updated the
  Documentation with device tree binding information for am33xx platform.
  
  Signed-off-by: Ravi Babu ravib...@ti.com
  Signed-off-by: Ajay Kumar Gupta ajay.gu...@ti.com
  Signed-off-by: Afzal Mohammed af...@ti.com

 What happend to that patch? It did not show up in any new series. Is it
 queued anywhere?

This patch was not required to get the single instance usb supported
on am335x.

Regards
Afzal

N�r��yb�X��ǧv�^�)޺{.n�+{��^n�r���z���h����G���h�(�階�ݢj���m��z�ޖ���f���h���~�m�

Re: UAS questions

2013-01-28 Thread Gerd Hoffmann
On 01/27/13 13:54, Vlad Silman wrote:
 Hello,
 
 I have a few questions regarding Linux UAS host-side and device-side drivers.
 I've seen that Linux UAS host driver supports the task management
 commands as defined by T10 UAS spec, such as ABORT TASK and LOGICAL
 UNIT RESET.
 I'm trying to work with Thermaltake BlacX dock that doesn't support
 these commands and it doesn't work with Linux UAS host driver.

uas should work nevertheless.  Under normal circumstances the device
management functions should not be used.  And even if they don't work,
at some point in error handling the scsi layer will invoke the bus_reset
handler which doesn't try to use task management functions any more and
just resets the device to recover ...

Be sure to run the latest bits (greg's usb tree or
http://www.kraxel.org/cgit/linux/log/?h=uas), there have been uas fixes
recently which are not merged upstream yet.

Might also be bugs in the xhci stream handling are tripping you up.

cheers,
  Gerd
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 1/2] usb: phy: samsung: Common out the generic stuff

2013-01-28 Thread Vivek Gautam
Moving register and structure definitions to header file,
and keeping the generic functions to be used across
multiple PHYs in common file samsung-usbphy.c.
Also renaming the usb 2.0 phy driver to samsung-usb2.c

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---

Changes from v3:
 - Using separate config SAMSUNG_USB2PHY dependent on
   SAMSUNG_USBPHY for samsung-usb2 type PHY controller.

 drivers/usb/phy/Kconfig  |   14 +-
 drivers/usb/phy/Makefile |1 +
 drivers/usb/phy/samsung-usb2.c   |  511 +++
 drivers/usb/phy/samsung-usbphy.c |  714 +-
 drivers/usb/phy/samsung-usbphy.h |  247 +
 5 files changed, 778 insertions(+), 709 deletions(-)
 create mode 100644 drivers/usb/phy/samsung-usb2.c
 create mode 100644 drivers/usb/phy/samsung-usbphy.h

diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
index fae4d08..cc0d230 100644
--- a/drivers/usb/phy/Kconfig
+++ b/drivers/usb/phy/Kconfig
@@ -48,8 +48,18 @@ config USB_RCAR_PHY
 
 config SAMSUNG_USBPHY
bool Samsung USB PHY controller Driver
-   depends on USB_S3C_HSOTG || USB_EHCI_S5P || USB_OHCI_EXYNOS
select USB_OTG_UTILS
help
- Enable this to support Samsung USB phy controller for samsung
+ Enable this to support Samsung USB phy controllers for Samsung
  SoCs.
+
+if SAMSUNG_USBPHY
+
+config SAMSUNG_USB2PHY
+   bool Samsung USB 2.0 PHY controller Driver
+   depends on USB_S3C_HSOTG || USB_EHCI_S5P || USB_OHCI_EXYNOS
+   help
+ Enable this to support Samsung USB 2.0 (High Speed) phy controller
+ for Samsung SoCs.
+
+endif
diff --git a/drivers/usb/phy/Makefile b/drivers/usb/phy/Makefile
index ec304f6..7ba9862 100644
--- a/drivers/usb/phy/Makefile
+++ b/drivers/usb/phy/Makefile
@@ -10,3 +10,4 @@ obj-$(CONFIG_MV_U3D_PHY)  += mv_u3d_phy.o
 obj-$(CONFIG_USB_EHCI_TEGRA)   += tegra_usb_phy.o
 obj-$(CONFIG_USB_RCAR_PHY) += rcar-phy.o
 obj-$(CONFIG_SAMSUNG_USBPHY)   += samsung-usbphy.o
+obj-$(CONFIG_SAMSUNG_USB2PHY)  += samsung-usb2.o
diff --git a/drivers/usb/phy/samsung-usb2.c b/drivers/usb/phy/samsung-usb2.c
new file mode 100644
index 000..9a9d1d0
--- /dev/null
+++ b/drivers/usb/phy/samsung-usb2.c
@@ -0,0 +1,511 @@
+/* linux/drivers/usb/phy/samsung-usb2.c
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd.
+ *  http://www.samsung.com
+ *
+ * Author: Praveen Paneri p.pan...@samsung.com
+ *
+ * Samsung USB2.0 PHY transceiver; talks to S3C HS OTG controller, EHCI-S5P and
+ * OHCI-EXYNOS controllers.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * 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.
+ */
+
+#include linux/module.h
+#include linux/platform_device.h
+#include linux/clk.h
+#include linux/delay.h
+#include linux/device.h
+#include linux/err.h
+#include linux/io.h
+#include linux/of.h
+#include linux/usb/otg.h
+#include linux/usb/samsung_usb_phy.h
+#include linux/platform_data/samsung-usbphy.h
+
+#include samsung-usbphy.h
+
+int samsung_usbphy_set_host(struct usb_otg *otg, struct usb_bus *host)
+{
+   if (!otg)
+   return -ENODEV;
+
+   if (!otg-host)
+   otg-host = host;
+
+   return 0;
+}
+
+static bool exynos5_phyhost_is_on(void *regs)
+{
+   u32 reg;
+
+   reg = readl(regs + EXYNOS5_PHY_HOST_CTRL0);
+
+   return !(reg  HOST_CTRL0_SIDDQ);
+}
+
+static void samsung_exynos5_usbphy_enable(struct samsung_usbphy *sphy)
+{
+   void __iomem *regs = sphy-regs;
+   u32 phyclk = sphy-ref_clk_freq;
+   u32 phyhost;
+   u32 phyotg;
+   u32 phyhsic;
+   u32 ehcictrl;
+   u32 ohcictrl;
+
+   /*
+* phy_usage helps in keeping usage count for phy
+* so that the first consumer enabling the phy is also
+* the last consumer to disable it.
+*/
+
+   atomic_inc(sphy-phy_usage);
+
+   if (exynos5_phyhost_is_on(regs)) {
+   dev_info(sphy-dev, Already power on PHY\n);
+   return;
+   }
+
+   /* Host configuration */
+   phyhost = readl(regs + EXYNOS5_PHY_HOST_CTRL0);
+
+   /* phy reference clock configuration */
+   phyhost = ~HOST_CTRL0_FSEL_MASK;
+   phyhost |= HOST_CTRL0_FSEL(phyclk);
+
+   /* host phy reset */
+   phyhost = ~(HOST_CTRL0_PHYSWRST |
+   HOST_CTRL0_PHYSWRSTALL |
+   HOST_CTRL0_SIDDQ |
+   /* Enable normal mode of operation */
+   HOST_CTRL0_FORCESUSPEND |
+   HOST_CTRL0_FORCESLEEP);
+
+   /* Link reset */
+ 

[PATCH v4 2/2] usb: phy: samsung: Add PHY support for USB 3.0 controller

2013-01-28 Thread Vivek Gautam
Adding PHY driver support for USB 3.0 controller for Samsung's
SoCs.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---

Changes from v3:
 - Making SAMSUNG_USB3PHY dependent on SAMSUNG_USBPHY.
 - Adding USB_DWC3 to dependencies of SAMSUNG_USB2PHY since
   dwc3 controller also looks for USB2 type PHY.

 drivers/usb/phy/Kconfig  |   11 +-
 drivers/usb/phy/Makefile |1 +
 drivers/usb/phy/samsung-usb3.c   |  349 ++
 drivers/usb/phy/samsung-usbphy.h |   81 +
 4 files changed, 441 insertions(+), 1 deletions(-)
 create mode 100644 drivers/usb/phy/samsung-usb3.c

diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
index cc0d230..9325a95 100644
--- a/drivers/usb/phy/Kconfig
+++ b/drivers/usb/phy/Kconfig
@@ -52,14 +52,23 @@ config SAMSUNG_USBPHY
help
  Enable this to support Samsung USB phy controllers for Samsung
  SoCs.
+ Further enable USB 2.0 type PHY or USB 3.0 type PHY as required
+ for USB controllers in use.
 
 if SAMSUNG_USBPHY
 
 config SAMSUNG_USB2PHY
bool Samsung USB 2.0 PHY controller Driver
-   depends on USB_S3C_HSOTG || USB_EHCI_S5P || USB_OHCI_EXYNOS
+   depends on USB_S3C_HSOTG || USB_EHCI_S5P || USB_OHCI_EXYNOS || USB_DWC3
help
  Enable this to support Samsung USB 2.0 (High Speed) phy controller
  for Samsung SoCs.
 
+config SAMSUNG_USB3PHY
+   bool Samsung USB 3.0 PHY controller Driver
+   depends on USB_DWC3
+   help
+ Enable this to support Samsung USB 3.0 (Super Speed) phy controller
+ for samsung SoCs.
+
 endif
diff --git a/drivers/usb/phy/Makefile b/drivers/usb/phy/Makefile
index 7ba9862..b8505ac 100644
--- a/drivers/usb/phy/Makefile
+++ b/drivers/usb/phy/Makefile
@@ -11,3 +11,4 @@ obj-$(CONFIG_USB_EHCI_TEGRA)  += tegra_usb_phy.o
 obj-$(CONFIG_USB_RCAR_PHY) += rcar-phy.o
 obj-$(CONFIG_SAMSUNG_USBPHY)   += samsung-usbphy.o
 obj-$(CONFIG_SAMSUNG_USB2PHY)  += samsung-usb2.o
+obj-$(CONFIG_SAMSUNG_USB3PHY)  += samsung-usb3.o
diff --git a/drivers/usb/phy/samsung-usb3.c b/drivers/usb/phy/samsung-usb3.c
new file mode 100644
index 000..29e1321
--- /dev/null
+++ b/drivers/usb/phy/samsung-usb3.c
@@ -0,0 +1,349 @@
+/* linux/drivers/usb/phy/samsung-usb3.c
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd.
+ *  http://www.samsung.com
+ *
+ * Author: Vivek Gautam gautam.vi...@samsung.com
+ *
+ * Samsung USB 3.0 PHY transceiver; talks to DWC3 controller.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * 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.
+ */
+
+#include linux/module.h
+#include linux/platform_device.h
+#include linux/clk.h
+#include linux/delay.h
+#include linux/err.h
+#include linux/io.h
+#include linux/of.h
+#include linux/usb/samsung_usb_phy.h
+#include linux/platform_data/samsung-usbphy.h
+
+#include samsung-usbphy.h
+
+/*
+ * Sets the phy clk as EXTREFCLK (XXTI) which is internal clock from clock 
core.
+ */
+static u32 samsung_usb3_phy_set_refclk(struct samsung_usbphy *sphy)
+{
+   u32 reg;
+   u32 refclk;
+
+   refclk = sphy-ref_clk_freq;
+
+   reg = PHYCLKRST_REFCLKSEL_EXT_REFCLK |
+   PHYCLKRST_FSEL(refclk);
+
+   switch (refclk) {
+   case FSEL_CLKSEL_50M:
+   reg |= (PHYCLKRST_MPLL_MULTIPLIER_50M_REF |
+   PHYCLKRST_SSC_REFCLKSEL(0x00));
+   break;
+   case FSEL_CLKSEL_20M:
+   reg |= (PHYCLKRST_MPLL_MULTIPLIER_20MHZ_REF |
+   PHYCLKRST_SSC_REFCLKSEL(0x00));
+   break;
+   case FSEL_CLKSEL_19200K:
+   reg |= (PHYCLKRST_MPLL_MULTIPLIER_19200KHZ_REF |
+   PHYCLKRST_SSC_REFCLKSEL(0x88));
+   break;
+   case FSEL_CLKSEL_24M:
+   default:
+   reg |= (PHYCLKRST_MPLL_MULTIPLIER_24MHZ_REF |
+   PHYCLKRST_SSC_REFCLKSEL(0x88));
+   break;
+   }
+
+   return reg;
+}
+
+static int samsung_exynos5_usb3_phy_enable(struct samsung_usbphy *sphy)
+{
+   void __iomem *regs = sphy-regs;
+   u32 phyparam0;
+   u32 phyparam1;
+   u32 linksystem;
+   u32 phybatchg;
+   u32 phytest;
+   u32 phyclkrst;
+
+   /* Reset USB 3.0 PHY */
+   writel(0x0, regs + EXYNOS5_DRD_PHYREG0);
+
+   phyparam0 = readl(regs + EXYNOS5_DRD_PHYPARAM0);
+   /* Select PHY CLK source */
+   phyparam0 = ~PHYPARAM0_REF_USE_PAD;
+   /* Set Loss-of-Signal Detector sensitivity */
+   phyparam0 = ~PHYPARAM0_REF_LOSLEVEL_MASK;
+   phyparam0 |= 

[PATCH 02/30] usb: phy: nop: use devm_kzalloc()

2013-01-28 Thread Roger Quadros
Use resource managed kzalloc.

Signed-off-by: Roger Quadros rog...@ti.com
---
 drivers/usb/otg/nop-usb-xceiv.c |   16 
 1 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/drivers/usb/otg/nop-usb-xceiv.c b/drivers/usb/otg/nop-usb-xceiv.c
index a3ce24b..7ffb0c8 100644
--- a/drivers/usb/otg/nop-usb-xceiv.c
+++ b/drivers/usb/otg/nop-usb-xceiv.c
@@ -100,15 +100,13 @@ static int nop_usb_xceiv_probe(struct platform_device 
*pdev)
enum usb_phy_type   type = USB_PHY_TYPE_USB2;
int err;
 
-   nop = kzalloc(sizeof *nop, GFP_KERNEL);
+   nop = devm_kzalloc(pdev-dev, sizeof *nop, GFP_KERNEL);
if (!nop)
return -ENOMEM;
 
-   nop-phy.otg = kzalloc(sizeof *nop-phy.otg, GFP_KERNEL);
-   if (!nop-phy.otg) {
-   kfree(nop);
+   nop-phy.otg = devm_kzalloc(pdev-dev, sizeof *nop-phy.otg, 
GFP_KERNEL);
+   if (!nop-phy.otg)
return -ENOMEM;
-   }
 
if (pdata)
type = pdata-type;
@@ -127,7 +125,7 @@ static int nop_usb_xceiv_probe(struct platform_device *pdev)
if (err) {
dev_err(pdev-dev, can't register transceiver, err: %d\n,
err);
-   goto exit;
+   return err;
}
 
platform_set_drvdata(pdev, nop);
@@ -135,10 +133,6 @@ static int nop_usb_xceiv_probe(struct platform_device 
*pdev)
ATOMIC_INIT_NOTIFIER_HEAD(nop-phy.notifier);
 
return 0;
-exit:
-   kfree(nop-phy.otg);
-   kfree(nop);
-   return err;
 }
 
 static int nop_usb_xceiv_remove(struct platform_device *pdev)
@@ -148,8 +142,6 @@ static int nop_usb_xceiv_remove(struct platform_device 
*pdev)
usb_remove_phy(nop-phy);
 
platform_set_drvdata(pdev, NULL);
-   kfree(nop-phy.otg);
-   kfree(nop);
 
return 0;
 }
-- 
1.7.4.1

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 00/30] USB: omap-ehci: Move PHY management to PHY driver

2013-01-28 Thread Roger Quadros
Hi,

The OMAP's High Speed Host controller can interface to ULPI/UTMI
PHYs transparently i.e. whithout requiring the device drivers to
access the PHY. However, the OS must ensure that the PHY has the necessary
resources (power/clock/reset) enabled before it is used.

Till now, the omap-ehci driver was managing the power and reset of the PHY
whereas, clock enabling was left to the bootloader or board files.

In this patchset we make the NOP PHY driver (nop-usb-xceiv.c) handle
all the PHY resources that are available so that it can be used by
platforms like OMAP.

The board files add the PHY as a platform device and use usb_bind_phy()
(API introduced in [2]) to bind the PHY device to the controller's port.
The ehci-omap driver then uses usb_get_phy_dev() to get the PHY device
associated to the controller's port.

All this results in a much cleaner code and makes USB PHY resource management
work properly on OMAP.

NOTE: Tested on 4460ES-B1 Panda and BeagleBoard C4 only. Other boards are only
build tested.

Patches are based on Linux-3.8-rc5 and depend on

[1] [PATCH v9 00/20] OMAP USB Host cleanup
https://lkml.org/lkml/2013/1/23/155

[2] [PATCH v2 0/6] USB: Add support for multiple PHYs of same type
https://lkml.org/lkml/2013/1/24/876

v2:
- Added Alan's patch to split ehci-omap into separate driver
- Addressed Russell King's comments on usage of clk/regulator framework.
- Adapted all board using ehci-omap to using the PHY mechanism.

The following changes since commit e18d48b7f7e563664a41d4658b8cc15679ee4745:

  usb: otg: utils: add facilities in phy lib to support multiple PHYs of same 
type (2013-01-28 12:20:54 +0200)

  git://github.com/rogerq/linux.git linux-usbhost15

---
Alan Stern (1):
  USB: EHCI: split ehci-omap out to a separate driver

Roger Quadros (29):
  usb: phy: nop: use devm_kzalloc()
  usb: phy: nop: Manage PHY clock
  usb: phy: nop: Handle power supply regulator for the PHY
  usb: phy: nop: Handle RESET for the PHY
  usb: phy: nop: use new PHY API to register PHY
  mfd: omap-usb-host: update nports in platform_data
  mfd: omap-usb-host: Remove PHY reset handling code
  USB: ehci-omap: Use devm_request_and_ioremap()
  USB: ehci-omap: Use PHY APIs to get the PHY device and put it out of
suspend
  usb: ehci-omap: Remove PHY reset handling code
  usb: ehci-omap: Remove PHY regulator handling code
  ARM: OMAP2+: omap4panda: Provide USB Host's PHY platform data
  ARM: OMAP2+: omap4panda: Adapt to ehci-omap changes
  ARM: OMAP3: Beagle: Adapt to ehci-omap changes
  ARM: OMAP3: 3430SDP: Adapt to ehci-omap changes
  ARM: OMAP3: 3630SDP: Adapt to ehci-omap changes
  ARM: OMAP: AM3517crane: Adapt to ehci-omap changes
  ARM: OMAP: AM3517evm: Adapt to ehci-omap changes
  ARM: OMAP3: cm-t35: Adapt to ehci-omap changes
  ARM: OMAP3: cm-t3517: Adapt to ehci-omap changes
  ARM: OMAP: devkit8000: Adapt to ehci-omap changes
  ARM: OMAP3: igep0020: Adapt to ehci-omap changes
  ARM: OMAP3: omap3evm: Adapt to ehci-omap changes
  ARM: OMAP3: omap3pandora: Adapt to ehci-omap changes
  ARM: OMAP3: omap3stalker: Adapt to ehci-omap changes
  ARM: OMAP3: omap3touchbook: Adapt to ehci-omap changes
  ARM: OMAP3: overo: Adapt to ehci-omap changes
  ARM: OMAP: zoom: Adapt to ehci-omap changes
  ARM: OMAP: USB: Remove unused fields from struct
usbhs_omap_platform_data

 arch/arm/mach-omap2/board-3430sdp.c|   99 +++-
 arch/arm/mach-omap2/board-3630sdp.c|  100 +++-
 arch/arm/mach-omap2/board-am3517crane.c|   95 ++--
 arch/arm/mach-omap2/board-am3517evm.c  |   66 +++-
 arch/arm/mach-omap2/board-cm-t35.c |   95 ++-
 arch/arm/mach-omap2/board-cm-t3517.c   |   97 +++-
 arch/arm/mach-omap2/board-devkit8000.c |   20 ++-
 arch/arm/mach-omap2/board-igep0020.c   |  112 +++--
 arch/arm/mach-omap2/board-omap3beagle.c|   93 ++-
 arch/arm/mach-omap2/board-omap3evm.c   |   63 ++--
 arch/arm/mach-omap2/board-omap3pandora.c   |   54 +-
 arch/arm/mach-omap2/board-omap3stalker.c   |   52 +-
 arch/arm/mach-omap2/board-omap3touchbook.c |   62 ++-
 arch/arm/mach-omap2/board-omap4panda.c |  123 ++
 arch/arm/mach-omap2/board-overo.c  |   55 ++-
 arch/arm/mach-omap2/board-zoom.c   |   56 ++-
 drivers/mfd/omap-usb-host.c|   48 +--
 drivers/usb/host/Kconfig   |2 +-
 drivers/usb/host/Makefile  |1 +
 drivers/usb/host/ehci-hcd.c|6 +-
 drivers/usb/host/ehci-omap.c   |  245 +++-
 drivers/usb/otg/nop-usb-xceiv.c|  106 +++--
 include/linux/platform_data/usb-omap.h |3 -
 include/linux/usb/nop-usb-xceiv.h  |1 +
 24 files changed, 1288 insertions(+), 366 deletions(-)

-- 
1.7.4.1

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  

[PATCH v2 03/30] usb: phy: nop: Manage PHY clock

2013-01-28 Thread Roger Quadros
If the PHY has a clock associated to it then manage the clock.
We just enable the clock in .init() and disable it in .shutdown().

Add clk_rate parameter in platform data and configure the
clock rate during probe if supplied.

Signed-off-by: Roger Quadros rog...@ti.com
---
 drivers/usb/otg/nop-usb-xceiv.c   |   54 -
 include/linux/usb/nop-usb-xceiv.h |1 +
 2 files changed, 54 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/otg/nop-usb-xceiv.c b/drivers/usb/otg/nop-usb-xceiv.c
index 7ffb0c8..849eb9d 100644
--- a/drivers/usb/otg/nop-usb-xceiv.c
+++ b/drivers/usb/otg/nop-usb-xceiv.c
@@ -32,10 +32,12 @@
 #include linux/usb/otg.h
 #include linux/usb/nop-usb-xceiv.h
 #include linux/slab.h
+#include linux/clk.h
 
 struct nop_usb_xceiv {
struct usb_phy  phy;
struct device   *dev;
+   struct clk  *clk;
 };
 
 static struct platform_device *pd;
@@ -64,6 +66,24 @@ static int nop_set_suspend(struct usb_phy *x, int suspend)
return 0;
 }
 
+static int nop_init(struct usb_phy *phy)
+{
+   struct nop_usb_xceiv *nop = dev_get_drvdata(phy-dev);
+
+   if (!IS_ERR(nop-clk))
+   clk_enable(nop-clk);
+
+   return 0;
+}
+
+static void nop_shutdown(struct usb_phy *phy)
+{
+   struct nop_usb_xceiv *nop = dev_get_drvdata(phy-dev);
+
+   if (!IS_ERR(nop-clk))
+   clk_disable(nop-clk);
+}
+
 static int nop_set_peripheral(struct usb_otg *otg, struct usb_gadget *gadget)
 {
if (!otg)
@@ -111,10 +131,34 @@ static int nop_usb_xceiv_probe(struct platform_device 
*pdev)
if (pdata)
type = pdata-type;
 
+   nop-clk = devm_clk_get(pdev-dev, main_clk);
+   if (IS_ERR(nop-clk)) {
+   dev_dbg(pdev-dev, Can't get phy clock: %ld\n,
+   PTR_ERR(nop-clk));
+   }
+
+   if (!IS_ERR(nop-clk)  pdata  pdata-clk_rate) {
+   err = clk_set_rate(nop-clk, pdata-clk_rate);
+   if (err) {
+   dev_err(pdev-dev, Error setting clock rate\n);
+   return err;
+   }
+   }
+
+   if (!IS_ERR(nop-clk)) {
+   err = clk_prepare(nop-clk);
+   if (err) {
+   dev_err(pdev-dev, Error preparing clock\n);
+   return err;
+   }
+   }
+
nop-dev= pdev-dev;
nop-phy.dev= nop-dev;
nop-phy.label  = nop-xceiv;
nop-phy.set_suspend= nop_set_suspend;
+   nop-phy.init   = nop_init;
+   nop-phy.shutdown   = nop_shutdown;
nop-phy.state  = OTG_STATE_UNDEFINED;
 
nop-phy.otg-phy   = nop-phy;
@@ -125,7 +169,7 @@ static int nop_usb_xceiv_probe(struct platform_device *pdev)
if (err) {
dev_err(pdev-dev, can't register transceiver, err: %d\n,
err);
-   return err;
+   goto err_add;
}
 
platform_set_drvdata(pdev, nop);
@@ -133,12 +177,20 @@ static int nop_usb_xceiv_probe(struct platform_device 
*pdev)
ATOMIC_INIT_NOTIFIER_HEAD(nop-phy.notifier);
 
return 0;
+
+err_add:
+   if (!IS_ERR(nop-clk))
+   clk_unprepare(nop-clk);
+   return err;
 }
 
 static int nop_usb_xceiv_remove(struct platform_device *pdev)
 {
struct nop_usb_xceiv *nop = platform_get_drvdata(pdev);
 
+   if (!IS_ERR(nop-clk))
+   clk_unprepare(nop-clk);
+
usb_remove_phy(nop-phy);
 
platform_set_drvdata(pdev, NULL);
diff --git a/include/linux/usb/nop-usb-xceiv.h 
b/include/linux/usb/nop-usb-xceiv.h
index 28884c7..3265b61 100644
--- a/include/linux/usb/nop-usb-xceiv.h
+++ b/include/linux/usb/nop-usb-xceiv.h
@@ -5,6 +5,7 @@
 
 struct nop_usb_xceiv_platform_data {
enum usb_phy_type type;
+   unsigned long clk_rate;
 };
 
 #if defined(CONFIG_NOP_USB_XCEIV) || (defined(CONFIG_NOP_USB_XCEIV_MODULE)  
defined(MODULE))
-- 
1.7.4.1

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 13/30] ARM: OMAP2+: omap4panda: Provide USB Host's PHY platform data

2013-01-28 Thread Roger Quadros
Add platform device and data for 'nop-usb-xceiv'. This will be used
as PHY for HS USB port 1, so provide binding information for it.

Get rid of managing the PHY clock as it will be done by the PHY driver.
For that to work we create a clock alias that links the PHY clock name
to the PHY device name.

Signed-off-by: Roger Quadros rog...@ti.com
---
 arch/arm/mach-omap2/board-omap4panda.c |   34 ++-
 1 files changed, 24 insertions(+), 10 deletions(-)

diff --git a/arch/arm/mach-omap2/board-omap4panda.c 
b/arch/arm/mach-omap2/board-omap4panda.c
index 1351489..2641752 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -30,6 +30,7 @@
 #include linux/regulator/fixed.h
 #include linux/ti_wilink_st.h
 #include linux/usb/musb.h
+#include linux/usb/nop-usb-xceiv.h
 #include linux/wl12xx.h
 #include linux/platform_data/omap-abe-twl6040.h
 
@@ -131,12 +132,27 @@ static struct platform_device btwilink_device = {
.id = -1,
 };
 
+/* PHY device on HS USB Port 1 i.e. nop_usb_xceiv.1 */
+static struct nop_usb_xceiv_platform_data hsusb1_phy_data = {
+   /* FREF_CLK3 provides the 19.2 MHz reference clock to the PHY */
+   .clk_rate = 1920,
+};
+
+static struct platform_device hsusb1_phy_device = {
+   .name   = nop_usb_xceiv,
+   .id = 1,
+   .dev= {
+   .platform_data = hsusb1_phy_data,
+   },
+};
+
 static struct platform_device *panda_devices[] __initdata = {
leds_gpio,
wl1271_device,
panda_abe_audio,
panda_hdmi_audio_codec,
btwilink_device,
+   hsusb1_phy_device,
 };
 
 static struct usbhs_omap_platform_data usbhs_bdata __initdata = {
@@ -157,16 +173,6 @@ static struct gpio panda_ehci_gpios[] __initdata = {
 static void __init omap4_ehci_init(void)
 {
int ret;
-   struct clk *phy_ref_clk;
-
-   /* FREF_CLK3 provides the 19.2 MHz reference clock to the PHY */
-   phy_ref_clk = clk_get(NULL, auxclk3_ck);
-   if (IS_ERR(phy_ref_clk)) {
-   pr_err(Cannot request auxclk3\n);
-   return;
-   }
-   clk_set_rate(phy_ref_clk, 1920);
-   clk_prepare_enable(phy_ref_clk);
 
/* disable the power to the usb hub prior to init and reset phy+hub */
ret = gpio_request_array(panda_ehci_gpios,
@@ -180,6 +186,14 @@ static void __init omap4_ehci_init(void)
gpio_export(GPIO_HUB_NRESET, 0);
gpio_set_value(GPIO_HUB_NRESET, 1);
 
+   /* FREF_CLK3 provides the 19.2 MHz reference clock to the PHY */
+   ret = clk_add_alias(main_clk, nop_usb_xceiv.1, auxclk3_ck, NULL);
+   if (ret)
+   pr_err(Failed to add main_clk alias to auxclk3_ck\n);
+
+   /* PHY on HS USB Port 1 i.e. index 0 */
+   usb_bind_phy(ehci-omap.0, 0, nop_usb_xceiv.1);
+
usbhs_init(usbhs_bdata);
 
/* enable power to hub */
-- 
1.7.4.1

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 21/30] ARM: OMAP3: cm-t3517: Adapt to ehci-omap changes

2013-01-28 Thread Roger Quadros
Add 2 platform devices for 'nop-usb-xceiv'. These will be used
as PHYs for HS USB ports 1 and 2 so provide binding information
for them.

Model RESET for HS USB Ports 1 and 2 as GPIO fixed regulators and
link them to the 2 PHYs we just created.

Signed-off-by: Roger Quadros rog...@ti.com
---
 arch/arm/mach-omap2/board-cm-t3517.c |   97 --
 1 files changed, 92 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-omap2/board-cm-t3517.c 
b/arch/arm/mach-omap2/board-cm-t3517.c
index cfa9098..2ba97c5 100644
--- a/arch/arm/mach-omap2/board-cm-t3517.c
+++ b/arch/arm/mach-omap2/board-cm-t3517.c
@@ -33,6 +33,9 @@
 #include linux/mtd/nand.h
 #include linux/mtd/partitions.h
 #include linux/can/platform/ti_hecc.h
+#include linux/regulator/machine.h
+#include linux/regulator/fixed.h
+#include linux/usb/phy.h
 
 #include asm/mach-types.h
 #include asm/mach/arch.h
@@ -166,15 +169,92 @@ static inline void cm_t3517_init_rtc(void) {}
 #define HSUSB2_RESET_GPIO  (147)
 #define USB_HUB_RESET_GPIO (152)
 
+/* PHY device on HS USB Port 1 i.e. nop_usb_xceiv.1 */
+static struct platform_device hsusb1_phy_device = {
+   .name = nop_usb_xceiv,
+   .id = 1,
+};
+
+/* Regulator for HS USB Port 1 PHY reset */
+static struct regulator_consumer_supply hsusb1_reset_supplies[] = {
+   /* Link PHY device to reset supply so it gets used in the PHY driver */
+   REGULATOR_SUPPLY(reset, nop_usb_xceiv.1),
+};
+
+static struct regulator_init_data hsusb1_reset_data = {
+   .constraints = {
+   .valid_ops_mask = REGULATOR_CHANGE_STATUS,
+   },
+   .consumer_supplies = hsusb1_reset_supplies,
+   .num_consumer_supplies = ARRAY_SIZE(hsusb1_reset_supplies),
+};
+
+static struct fixed_voltage_config hsusb1_reset_config = {
+   .supply_name = hsusb1_reset,
+   .microvolts = 330,
+   .gpio = HSUSB1_RESET_GPIO,
+   .startup_delay = 7, /* 70msec */
+   .enable_high = 1,
+   .enabled_at_boot = 0,   /* keep in RESET */
+   .init_data = hsusb1_reset_data,
+};
+
+static struct platform_device hsusb1_reset_device = {
+   .name = reg-fixed-voltage,
+   .id = PLATFORM_DEVID_AUTO,
+   .dev = {
+   .platform_data = hsusb1_reset_config,
+   },
+};
+
+/* PHY device on HS USB Port 2 i.e. nop_usb_xceiv.2 */
+static struct platform_device hsusb2_phy_device = {
+   .name = nop_usb_xceiv,
+   .id = 2,
+};
+
+/* Regulator for HS USB Port 2 PHY reset */
+static struct regulator_consumer_supply hsusb2_reset_supplies[] = {
+   /* Link PHY device to reset supply so it gets used in the PHY driver */
+   REGULATOR_SUPPLY(reset, nop_usb_xceiv.2),
+};
+
+static struct regulator_init_data hsusb2_reset_data = {
+   .constraints = {
+   .valid_ops_mask = REGULATOR_CHANGE_STATUS,
+   },
+   .consumer_supplies = hsusb2_reset_supplies,
+   .num_consumer_supplies = ARRAY_SIZE(hsusb2_reset_supplies),
+};
+
+static struct fixed_voltage_config hsusb2_reset_config = {
+   .supply_name = hsusb2_reset,
+   .microvolts = 330,
+   .gpio = HSUSB2_RESET_GPIO,
+   .startup_delay = 7, /* 70msec */
+   .enable_high = 1,
+   .enabled_at_boot = 0,   /* keep in RESET */
+   .init_data = hsusb2_reset_data,
+};
+
+static struct platform_device hsusb2_reset_device = {
+   .name = reg-fixed-voltage,
+   .id = PLATFORM_DEVID_AUTO,
+   .dev = {
+   .platform_data = hsusb2_reset_config,
+   },
+};
+
 static struct usbhs_omap_platform_data cm_t3517_ehci_pdata __initdata = {
.port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
.port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
-   .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
+};
 
-   .phy_reset  = true,
-   .reset_gpio_port[0]  = HSUSB1_RESET_GPIO,
-   .reset_gpio_port[1]  = HSUSB2_RESET_GPIO,
-   .reset_gpio_port[2]  = -EINVAL,
+static struct platform_device *usbhs_devices[] = {
+   hsusb1_phy_device,
+   hsusb1_reset_device,
+   hsusb2_phy_device,
+   hsusb2_reset_device,
 };
 
 static int __init cm_t3517_init_usbh(void)
@@ -191,6 +271,13 @@ static int __init cm_t3517_init_usbh(void)
msleep(1);
}
 
+   platform_add_devices(usbhs_devices, ARRAY_SIZE(usbhs_devices));
+
+   /* PHY on HSUSB Port 1 i.e. index 0 */
+   usb_bind_phy(ehci-omap.0, 0, nop_usb_xceiv.1);
+   /* PHY on HSUSB Port 2 i.e. index 1 */
+   usb_bind_phy(ehci-omap.0, 1, nop_usb_xceiv.2);
+
usbhs_init(cm_t3517_ehci_pdata);
 
return 0;
-- 
1.7.4.1

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 27/30] ARM: OMAP3: omap3touchbook: Adapt to ehci-omap changes

2013-01-28 Thread Roger Quadros
Add 2 platform devices for 'nop-usb-xceiv'. These will be used as a
PHY for HS USB Ports 1 and 2, so provide binding information for them.

Model RESET for HS USB Port 2 as GPIO fixed regulator and link it
to the respective 'nop-usb-xceiv' PHY.

Signed-off-by: Roger Quadros rog...@ti.com
---
 arch/arm/mach-omap2/board-omap3touchbook.c |   62 ---
 1 files changed, 55 insertions(+), 7 deletions(-)

diff --git a/arch/arm/mach-omap2/board-omap3touchbook.c 
b/arch/arm/mach-omap2/board-omap3touchbook.c
index 65a285f..3e00dbf 100644
--- a/arch/arm/mach-omap2/board-omap3touchbook.c
+++ b/arch/arm/mach-omap2/board-omap3touchbook.c
@@ -35,6 +35,8 @@
 #include linux/spi/ads7846.h
 
 #include linux/regulator/machine.h
+#include linux/regulator/fixed.h
+#include linux/usb/phy.h
 #include linux/i2c/twl.h
 
 #include asm/mach-types.h
@@ -304,21 +306,61 @@ static struct omap_board_mux board_mux[] __initdata = {
 };
 #endif
 
+/* PHY device on HS USB Port 1 i.e. nop_usb_xceiv.1 */
+static struct platform_device hsusb1_phy_device = {
+   .name = nop_usb_xceiv,
+   .id = 1,
+};
+
+/* PHY device on HS USB Port 2 i.e. nop_usb_xceiv.2 */
+static struct platform_device hsusb2_phy_device = {
+   .name = nop_usb_xceiv,
+   .id = 2,
+};
+
+/* Regulator for HS USB Port 2 PHY reset */
+static struct regulator_consumer_supply hsusb2_reset_supplies[] = {
+   /* Link PHY device to reset supply so it gets used in the PHY driver */
+   REGULATOR_SUPPLY(reset, nop_usb_xceiv.2),
+};
+
+static struct regulator_init_data hsusb2_reset_data = {
+   .constraints = {
+   .valid_ops_mask = REGULATOR_CHANGE_STATUS,
+   },
+   .consumer_supplies = hsusb2_reset_supplies,
+   .num_consumer_supplies = ARRAY_SIZE(hsusb2_reset_supplies),
+};
+
+static struct fixed_voltage_config hsusb2_reset_config = {
+   .supply_name = hsusb2_reset,
+   .microvolts = 330,
+   .gpio = 147,
+   .startup_delay = 7, /* 70msec */
+   .enable_high = 1,
+   .enabled_at_boot = 0,   /* keep in RESET */
+   .init_data = hsusb2_reset_data,
+};
+
+static struct platform_device hsusb2_reset_device = {
+   .name = reg-fixed-voltage,
+   .id = PLATFORM_DEVID_AUTO,
+   .dev = {
+   .platform_data = hsusb2_reset_config,
+   },
+};
+
 static struct platform_device *omap3_touchbook_devices[] __initdata = {
leds_gpio,
keys_gpio,
+   hsusb1_phy_device,
+   hsusb2_phy_device,
+   hsusb2_reset_device,
 };
 
 static struct usbhs_omap_platform_data usbhs_bdata __initdata = {
-
.port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
.port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
-   .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
-
-   .phy_reset  = true,
-   .reset_gpio_port[0]  = -EINVAL,
-   .reset_gpio_port[1]  = 147,
-   .reset_gpio_port[2]  = -EINVAL
 };
 
 static void omap3_touchbook_poweroff(void)
@@ -366,6 +408,12 @@ static void __init omap3_touchbook_init(void)
/* Touchscreen and accelerometer */
omap_ads7846_init(4, OMAP3_TS_GPIO, 310, ads7846_pdata);
usb_musb_init(NULL);
+
+   /* PHY on HSUSB Port 1 i.e. index 0 */
+   usb_bind_phy(ehci-omap.0, 0, nop_usb_xceiv.1);
+   /* PHY on HSUSB Port 2 i.e. index 1 */
+   usb_bind_phy(ehci-omap.0, 1, nop_usb_xceiv.2);
+
usbhs_init(usbhs_bdata);
board_nand_init(omap3touchbook_nand_partitions,
ARRAY_SIZE(omap3touchbook_nand_partitions), NAND_CS,
-- 
1.7.4.1

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 29/30] ARM: OMAP: zoom: Adapt to ehci-omap changes

2013-01-28 Thread Roger Quadros
Add platform device for 'nop-usb-xceiv'. This will be used as a
PHY for HS USB Port 2, so provide binding information for it.

Model RESET for HS USB Port 2 as GPIO fixed regulator and link
it to the 'nop-usb-xceiv' PHY.

Signed-off-by: Roger Quadros rog...@ti.com
---
 arch/arm/mach-omap2/board-zoom.c |   56 +
 1 files changed, 50 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-omap2/board-zoom.c b/arch/arm/mach-omap2/board-zoom.c
index 2d7a457..d258632 100644
--- a/arch/arm/mach-omap2/board-zoom.c
+++ b/arch/arm/mach-omap2/board-zoom.c
@@ -17,6 +17,9 @@
 #include linux/gpio.h
 #include linux/i2c/twl.h
 #include linux/mtd/nand.h
+#include linux/regulator/machine.h
+#include linux/regulator/fixed.h
+#include linux/usb/phy.h
 
 #include asm/mach-types.h
 #include asm/mach/arch.h
@@ -92,14 +95,51 @@ static struct mtd_partition zoom_nand_partitions[] = {
},
 };
 
+/* PHY device on HS USB Port 2 i.e. nop_usb_xceiv.2 */
+static struct platform_device hsusb2_phy_device = {
+   .name = nop_usb_xceiv,
+   .id = 2,
+};
+
+/* Regulator for HS USB Port 2 PHY reset */
+static struct regulator_consumer_supply hsusb2_reset_supplies[] = {
+   /* Link PHY device to reset supply so it gets used in the PHY driver */
+   REGULATOR_SUPPLY(reset, nop_usb_xceiv.2),
+};
+
+static struct regulator_init_data hsusb2_reset_data = {
+   .constraints = {
+   .valid_ops_mask = REGULATOR_CHANGE_STATUS,
+   },
+   .consumer_supplies = hsusb2_reset_supplies,
+   .num_consumer_supplies = ARRAY_SIZE(hsusb2_reset_supplies),
+};
+
+static struct fixed_voltage_config hsusb2_reset_config = {
+   .supply_name = hsusb2_reset,
+   .microvolts = 330,
+   .gpio = ZOOM3_EHCI_RESET_GPIO,
+   .startup_delay = 7, /* 70msec */
+   .enable_high = 1,
+   .enabled_at_boot = 0,   /* keep in RESET */
+   .init_data = hsusb2_reset_data,
+};
+
+static struct platform_device hsusb2_reset_device = {
+   .name = reg-fixed-voltage,
+   .id = PLATFORM_DEVID_AUTO,
+   .dev = {
+   .platform_data = hsusb2_reset_config,
+   },
+};
+
+static struct platform_device *zoom3_devices[] __initdata = {
+   hsusb2_phy_device,
+   hsusb2_reset_device,
+};
+
 static struct usbhs_omap_platform_data usbhs_bdata __initdata = {
-   .port_mode[0]   = OMAP_USBHS_PORT_MODE_UNUSED,
.port_mode[1]   = OMAP_EHCI_PORT_MODE_PHY,
-   .port_mode[2]   = OMAP_USBHS_PORT_MODE_UNUSED,
-   .phy_reset  = true,
-   .reset_gpio_port[0] = -EINVAL,
-   .reset_gpio_port[1] = ZOOM3_EHCI_RESET_GPIO,
-   .reset_gpio_port[2] = -EINVAL,
 };
 
 static void __init omap_zoom_init(void)
@@ -109,6 +149,10 @@ static void __init omap_zoom_init(void)
} else if (machine_is_omap_zoom3()) {
omap3_mux_init(board_mux, OMAP_PACKAGE_CBP);
omap_mux_init_gpio(ZOOM3_EHCI_RESET_GPIO, OMAP_PIN_OUTPUT);
+
+   platform_add_devices(zoom3_devices, ARRAY_SIZE(zoom3_devices));
+   /* PHY on HSUSB Port 2 i.e. index 1 */
+   usb_bind_phy(ehci-omap.0, 1, nop_usb_xceiv.2);
usbhs_init(usbhs_bdata);
}
 
-- 
1.7.4.1

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 20/30] ARM: OMAP3: cm-t35: Adapt to ehci-omap changes

2013-01-28 Thread Roger Quadros
Add 2 platform devices for 'nop-usb-xceiv'. These will be used
as PHYs for HS USB ports 1 and 2 so provide binding information
for them.

Model RESET for HS USB Ports 1 and 2 as GPIO fixed regulators and
link them to the 2 PHYs we just created.

Signed-off-by: Roger Quadros rog...@ti.com
---
 arch/arm/mach-omap2/board-cm-t35.c |   95 ++--
 1 files changed, 90 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-omap2/board-cm-t35.c 
b/arch/arm/mach-omap2/board-cm-t35.c
index cdf1d6e..71a7eb4 100644
--- a/arch/arm/mach-omap2/board-cm-t35.c
+++ b/arch/arm/mach-omap2/board-cm-t35.c
@@ -29,6 +29,7 @@
 #include linux/i2c/twl.h
 #include linux/regulator/fixed.h
 #include linux/regulator/machine.h
+#include linux/usb/phy.h
 #include linux/mmc/host.h
 
 #include linux/spi/spi.h
@@ -418,15 +419,92 @@ static struct omap2_hsmmc_info mmc[] = {
{}  /* Terminator */
 };
 
+/* PHY device on HS USB Port 1 i.e. nop_usb_xceiv.1 */
+static struct platform_device hsusb1_phy_device = {
+   .name = nop_usb_xceiv,
+   .id = 1,
+};
+
+/* Regulator for HS USB Port 1 PHY reset */
+static struct regulator_consumer_supply hsusb1_reset_supplies[] = {
+   /* Link PHY device to reset supply so it gets used in the PHY driver */
+   REGULATOR_SUPPLY(reset, nop_usb_xceiv.1),
+};
+
+static struct regulator_init_data hsusb1_reset_data = {
+   .constraints = {
+   .valid_ops_mask = REGULATOR_CHANGE_STATUS,
+   },
+   .consumer_supplies = hsusb1_reset_supplies,
+   .num_consumer_supplies = ARRAY_SIZE(hsusb1_reset_supplies),
+};
+
+static struct fixed_voltage_config hsusb1_reset_config = {
+   .supply_name = hsusb1_reset,
+   .microvolts = 330,
+   .gpio = OMAP_MAX_GPIO_LINES + 6,
+   .startup_delay = 7, /* 70msec */
+   .enable_high = 1,
+   .enabled_at_boot = 0,   /* keep in RESET */
+   .init_data = hsusb1_reset_data,
+};
+
+static struct platform_device hsusb1_reset_device = {
+   .name = reg-fixed-voltage,
+   .id = PLATFORM_DEVID_AUTO,
+   .dev = {
+   .platform_data = hsusb1_reset_config,
+   },
+};
+
+/* PHY device on HS USB Port 2 i.e. nop_usb_xceiv.2 */
+static struct platform_device hsusb2_phy_device = {
+   .name = nop_usb_xceiv,
+   .id = 2,
+};
+
+/* Regulator for HS USB Port 2 PHY reset */
+static struct regulator_consumer_supply hsusb2_reset_supplies[] = {
+   /* Link PHY device to reset supply so it gets used in the PHY driver */
+   REGULATOR_SUPPLY(reset, nop_usb_xceiv.2),
+};
+
+static struct regulator_init_data hsusb2_reset_data = {
+   .constraints = {
+   .valid_ops_mask = REGULATOR_CHANGE_STATUS,
+   },
+   .consumer_supplies = hsusb2_reset_supplies,
+   .num_consumer_supplies = ARRAY_SIZE(hsusb2_reset_supplies),
+};
+
+static struct fixed_voltage_config hsusb2_reset_config = {
+   .supply_name = hsusb2_reset,
+   .microvolts = 330,
+   .gpio = OMAP_MAX_GPIO_LINES + 7,
+   .startup_delay = 7, /* 70msec */
+   .enable_high = 1,
+   .enabled_at_boot = 0,   /* keep in RESET */
+   .init_data = hsusb2_reset_data,
+};
+
+static struct platform_device hsusb2_reset_device = {
+   .name = reg-fixed-voltage,
+   .id = PLATFORM_DEVID_AUTO,
+   .dev = {
+   .platform_data = hsusb2_reset_config,
+   },
+};
+
 static struct usbhs_omap_platform_data usbhs_bdata __initdata = {
.port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
.port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
-   .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
+};
 
-   .phy_reset  = true,
-   .reset_gpio_port[0]  = OMAP_MAX_GPIO_LINES + 6,
-   .reset_gpio_port[1]  = OMAP_MAX_GPIO_LINES + 7,
-   .reset_gpio_port[2]  = -EINVAL
+static struct platform_device *usbhs_devices[] = {
+   hsusb1_phy_device,
+   hsusb1_reset_device,
+   hsusb2_phy_device,
+   hsusb2_reset_device,
 };
 
 static void  __init cm_t35_init_usbh(void)
@@ -443,6 +521,13 @@ static void  __init cm_t35_init_usbh(void)
msleep(1);
}
 
+   platform_add_devices(usbhs_devices, ARRAY_SIZE(usbhs_devices));
+
+   /* PHY on HSUSB Port 1 i.e. index 0 */
+   usb_bind_phy(ehci-omap.0, 0, nop_usb_xceiv.1);
+   /* PHY on HSUSB Port 2 i.e. index 1 */
+   usb_bind_phy(ehci-omap.0, 1, nop_usb_xceiv.2);
+
usbhs_init(usbhs_bdata);
 }
 
-- 
1.7.4.1

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 22/30] ARM: OMAP: devkit8000: Adapt to ehci-omap changes

2013-01-28 Thread Roger Quadros
Add platform device for 'nop-usb-xceiv'. This will be used as a
PHY for HS USB Port 1, so provide binding information for it.

Signed-off-by: Roger Quadros rog...@ti.com
---
 arch/arm/mach-omap2/board-devkit8000.c |   20 
 1 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/arch/arm/mach-omap2/board-devkit8000.c 
b/arch/arm/mach-omap2/board-devkit8000.c
index 051ec0d..f0fd75a 100644
--- a/arch/arm/mach-omap2/board-devkit8000.c
+++ b/arch/arm/mach-omap2/board-devkit8000.c
@@ -32,6 +32,7 @@
 
 #include linux/regulator/machine.h
 #include linux/i2c/twl.h
+#include linux/usb/phy.h
 #include id.h
 #include asm/mach-types.h
 #include asm/mach/arch.h
@@ -429,22 +430,21 @@ static void __init omap_dm9000_init(void)
eth_addr[5] = (odi.id_0  0x00ff);
 }
 
+/* PHY device on HS USB Port 1 i.e. nop_usb_xceiv.1 */
+static struct platform_device hsusb1_phy_device = {
+   .name = nop_usb_xceiv,
+   .id = 1,
+};
+
 static struct platform_device *devkit8000_devices[] __initdata = {
leds_gpio,
keys_gpio,
omap_dm9000_dev,
+   hsusb1_phy_device,
 };
 
 static struct usbhs_omap_platform_data usbhs_bdata __initdata = {
-
.port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
-   .port_mode[1] = OMAP_USBHS_PORT_MODE_UNUSED,
-   .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
-
-   .phy_reset  = true,
-   .reset_gpio_port[0]  = -EINVAL,
-   .reset_gpio_port[1]  = -EINVAL,
-   .reset_gpio_port[2]  = -EINVAL
 };
 
 #ifdef CONFIG_OMAP_MUX
@@ -623,6 +623,10 @@ static void __init devkit8000_init(void)
omap_ads7846_init(2, OMAP3_DEVKIT_TS_GPIO, 0, NULL);
 
usb_musb_init(NULL);
+
+   /* PHY on HSUSB Port 1 i.e. index 0 */
+   usb_bind_phy(ehci-omap.0, 0, nop_usb_xceiv.1);
+
usbhs_init(usbhs_bdata);
board_nand_init(devkit8000_nand_partitions,
ARRAY_SIZE(devkit8000_nand_partitions), NAND_CS,
-- 
1.7.4.1

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 23/30] ARM: OMAP3: igep0020: Adapt to ehci-omap changes

2013-01-28 Thread Roger Quadros
Add 2 platform devices for 'nop-usb-xceiv'. These will be used
as PHYs for HS USB ports 1 and 2 so provide binding information
for them.

Model RESET for HS USB Ports 1 and 2 as GPIO fixed regulators and
link them to the 2 PHYs we just created.

Signed-off-by: Roger Quadros rog...@ti.com
---
 arch/arm/mach-omap2/board-igep0020.c |  112 +
 1 files changed, 98 insertions(+), 14 deletions(-)

diff --git a/arch/arm/mach-omap2/board-igep0020.c 
b/arch/arm/mach-omap2/board-igep0020.c
index cfba790..3398988 100644
--- a/arch/arm/mach-omap2/board-igep0020.c
+++ b/arch/arm/mach-omap2/board-igep0020.c
@@ -21,6 +21,7 @@
 
 #include linux/regulator/machine.h
 #include linux/regulator/fixed.h
+#include linux/usb/phy.h
 #include linux/i2c/twl.h
 #include linux/mmc/host.h
 
@@ -526,26 +527,98 @@ static void __init igep_i2c_init(void)
omap3_pmic_init(twl4030, igep_twldata);
 }
 
+/* PHY device on HS USB Port 1 i.e. nop_usb_xceiv.1 */
+static struct platform_device hsusb1_phy_device = {
+   .name = nop_usb_xceiv,
+   .id = 1,
+};
+
+/* Regulator for HS USB Port 1 PHY reset */
+static struct regulator_consumer_supply hsusb1_reset_supplies[] = {
+   /* Link PHY device to reset supply so it gets used in the PHY driver */
+   REGULATOR_SUPPLY(reset, nop_usb_xceiv.1),
+};
+
+static struct regulator_init_data hsusb1_reset_data = {
+   .constraints = {
+   .valid_ops_mask = REGULATOR_CHANGE_STATUS,
+   },
+   .consumer_supplies = hsusb1_reset_supplies,
+   .num_consumer_supplies = ARRAY_SIZE(hsusb1_reset_supplies),
+};
+
+static struct fixed_voltage_config hsusb1_reset_config = {
+   .supply_name = hsusb1_reset,
+   .microvolts = 330,
+   .gpio = IGEP2_GPIO_USBH_NRESET,
+   .startup_delay = 7, /* 70msec */
+   .enable_high = 1,
+   .enabled_at_boot = 0,   /* keep in RESET */
+   .init_data = hsusb1_reset_data,
+};
+
+static struct platform_device hsusb1_reset_device = {
+   .name = reg-fixed-voltage,
+   .id = PLATFORM_DEVID_AUTO,
+   .dev = {
+   .platform_data = hsusb1_reset_config,
+   },
+};
+
+/* PHY device on HS USB Port 2 i.e. nop_usb_xceiv.2 */
+static struct platform_device hsusb2_phy_device = {
+   .name = nop_usb_xceiv,
+   .id = 2,
+};
+
+/* Regulator for HS USB Port 2 PHY reset */
+static struct regulator_consumer_supply hsusb2_reset_supplies[] = {
+   /* Link PHY device to reset supply so it gets used in the PHY driver */
+   REGULATOR_SUPPLY(reset, nop_usb_xceiv.2),
+};
+
+static struct regulator_init_data hsusb2_reset_data = {
+   .constraints = {
+   .valid_ops_mask = REGULATOR_CHANGE_STATUS,
+   },
+   .consumer_supplies = hsusb2_reset_supplies,
+   .num_consumer_supplies = ARRAY_SIZE(hsusb2_reset_supplies),
+};
+
+static struct fixed_voltage_config hsusb2_reset_config = {
+   .supply_name = hsusb2_reset,
+   .microvolts = 330,
+   .gpio = IGEP3_GPIO_USBH_NRESET,
+   .startup_delay = 7, /* 70msec */
+   .enable_high = 1,
+   .enabled_at_boot = 0,   /* keep in RESET */
+   .init_data = hsusb2_reset_data,
+};
+
+static struct platform_device hsusb2_reset_device = {
+   .name = reg-fixed-voltage,
+   .id = PLATFORM_DEVID_AUTO,
+   .dev = {
+   .platform_data = hsusb2_reset_config,
+   },
+};
+
+static struct platform_device *igep2_devices[] __initdata = {
+   hsusb1_phy_device,
+   hsusb1_reset_device,
+};
+
+static struct platform_device *igep3_devices[] __initdata = {
+   hsusb2_phy_device,
+   hsusb2_reset_device,
+};
+
 static struct usbhs_omap_platform_data igep2_usbhs_bdata __initdata = {
.port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
-   .port_mode[1] = OMAP_USBHS_PORT_MODE_UNUSED,
-   .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
-
-   .phy_reset = true,
-   .reset_gpio_port[0] = IGEP2_GPIO_USBH_NRESET,
-   .reset_gpio_port[1] = -EINVAL,
-   .reset_gpio_port[2] = -EINVAL,
 };
 
 static struct usbhs_omap_platform_data igep3_usbhs_bdata __initdata = {
-   .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED,
.port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
-   .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
-
-   .phy_reset = true,
-   .reset_gpio_port[0] = -EINVAL,
-   .reset_gpio_port[1] = IGEP3_GPIO_USBH_NRESET,
-   .reset_gpio_port[2] = -EINVAL,
 };
 
 #ifdef CONFIG_OMAP_MUX
@@ -640,8 +713,19 @@ static void __init igep_init(void)
if (machine_is_igep0020()) {
omap_display_init(igep2_dss_data);
igep2_init_smsc911x();
+
+   platform_add_devices(igep2_devices, ARRAY_SIZE(igep2_devices));
+
+   /* PHY on HSUSB Port 1 i.e. index 0 */
+   usb_bind_phy(ehci-omap.0, 0, nop_usb_xceiv.1);
+
usbhs_init(igep2_usbhs_bdata);
} else {
+   platform_add_devices(igep3_devices, ARRAY_SIZE(igep3_devices));
+
+   

[PATCH 26/30] ARM: OMAP3: omap3stalker: Adapt to ehci-omap changes

2013-01-28 Thread Roger Quadros
Add platform device for 'nop-usb-xceiv'. This will be used as a
PHY for HS USB Port 2, so provide binding information for it.

Model RESET for HS USB Port 2 as GPIO fixed regulator and link
it to the 'nop-usb-xceiv' PHY.

Signed-off-by: Roger Quadros rog...@ti.com
---
 arch/arm/mach-omap2/board-omap3stalker.c |   52 ++
 1 files changed, 45 insertions(+), 7 deletions(-)

diff --git a/arch/arm/mach-omap2/board-omap3stalker.c 
b/arch/arm/mach-omap2/board-omap3stalker.c
index 278ae95..ed343f0 100644
--- a/arch/arm/mach-omap2/board-omap3stalker.c
+++ b/arch/arm/mach-omap2/board-omap3stalker.c
@@ -26,6 +26,7 @@
 
 #include linux/regulator/fixed.h
 #include linux/regulator/machine.h
+#include linux/usb/phy.h
 #include linux/i2c/twl.h
 #include linux/mmc/host.h
 #include linux/input/matrix_keypad.h
@@ -357,19 +358,52 @@ static int __init omap3_stalker_i2c_init(void)
 
 #define OMAP3_STALKER_TS_GPIO  175
 
+/* PHY device on HS USB Port 2 i.e. nop_usb_xceiv.2 */
+static struct platform_device hsusb2_phy_device = {
+   .name = nop_usb_xceiv,
+   .id = 2,
+};
+
+/* Regulator for HS USB Port 2 PHY reset */
+static struct regulator_consumer_supply hsusb2_reset_supplies[] = {
+   /* Link PHY device to reset supply so it gets used in the PHY driver */
+   REGULATOR_SUPPLY(reset, nop_usb_xceiv.2),
+};
+
+static struct regulator_init_data hsusb2_reset_data = {
+   .constraints = {
+   .valid_ops_mask = REGULATOR_CHANGE_STATUS,
+   },
+   .consumer_supplies = hsusb2_reset_supplies,
+   .num_consumer_supplies = ARRAY_SIZE(hsusb2_reset_supplies),
+};
+
+static struct fixed_voltage_config hsusb2_reset_config = {
+   .supply_name = hsusb2_reset,
+   .microvolts = 330,
+   .gpio = 21,
+   .startup_delay = 7, /* 70msec */
+   .enable_high = 1,
+   .enabled_at_boot = 0,   /* keep in RESET */
+   .init_data = hsusb2_reset_data,
+};
+
+static struct platform_device hsusb2_reset_device = {
+   .name = reg-fixed-voltage,
+   .id = PLATFORM_DEVID_AUTO,
+   .dev = {
+   .platform_data = hsusb2_reset_config,
+   },
+};
+
 static struct platform_device *omap3_stalker_devices[] __initdata = {
keys_gpio,
+   hsusb2_phy_device,
+   hsusb2_reset_device,
 };
 
 static struct usbhs_omap_platform_data usbhs_bdata __initdata = {
-   .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED,
.port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
-   .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
-
-   .phy_reset = true,
-   .reset_gpio_port[0] = -EINVAL,
-   .reset_gpio_port[1] = 21,
-   .reset_gpio_port[2] = -EINVAL,
 };
 
 #ifdef CONFIG_OMAP_MUX
@@ -405,6 +439,10 @@ static void __init omap3_stalker_init(void)
omap_serial_init();
omap_sdrc_init(mt46h32m32lf6_sdrc_params, NULL);
usb_musb_init(NULL);
+
+   /* PHY on HSUSB Port 2 i.e. index 1 */
+   usb_bind_phy(ehci-omap.0, 1, nop_usb_xceiv.2);
+
usbhs_init(usbhs_bdata);
omap_ads7846_init(1, OMAP3_STALKER_TS_GPIO, 310, NULL);
 
-- 
1.7.4.1

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 25/30] ARM: OMAP3: omap3pandora: Adapt to ehci-omap changes

2013-01-28 Thread Roger Quadros
Add platform device for 'nop-usb-xceiv'. This will be used as a
PHY for HS USB Port 2, so provide binding information for it.

Model RESET for HS USB Port 2 as GPIO fixed regulator and link
it to the 'nop-usb-xceiv' PHY.

Signed-off-by: Roger Quadros rog...@ti.com
---
 arch/arm/mach-omap2/board-omap3pandora.c |   54 +
 1 files changed, 46 insertions(+), 8 deletions(-)

diff --git a/arch/arm/mach-omap2/board-omap3pandora.c 
b/arch/arm/mach-omap2/board-omap3pandora.c
index 145a6f8..c2cd1ea 100644
--- a/arch/arm/mach-omap2/board-omap3pandora.c
+++ b/arch/arm/mach-omap2/board-omap3pandora.c
@@ -23,6 +23,8 @@
 
 #include linux/spi/spi.h
 #include linux/regulator/machine.h
+#include linux/regulator/fixed.h
+#include linux/usb/phy.h
 #include linux/i2c/twl.h
 #include linux/wl12xx.h
 #include linux/mtd/partitions.h
@@ -560,23 +562,55 @@ fail:
printk(KERN_ERR wl1251 board initialisation failed\n);
 }
 
+/* PHY device on HS USB Port 2 i.e. nop_usb_xceiv.2 */
+static struct platform_device hsusb2_phy_device = {
+   .name = nop_usb_xceiv,
+   .id = 2,
+};
+
+/* Regulator for HS USB Port 2 PHY reset */
+static struct regulator_consumer_supply hsusb2_reset_supplies[] = {
+   /* Link PHY device to reset supply so it gets used in the PHY driver */
+   REGULATOR_SUPPLY(reset, nop_usb_xceiv.2),
+};
+
+static struct regulator_init_data hsusb2_reset_data = {
+   .constraints = {
+   .valid_ops_mask = REGULATOR_CHANGE_STATUS,
+   },
+   .consumer_supplies = hsusb2_reset_supplies,
+   .num_consumer_supplies = ARRAY_SIZE(hsusb2_reset_supplies),
+};
+
+static struct fixed_voltage_config hsusb2_reset_config = {
+   .supply_name = hsusb2_reset,
+   .microvolts = 330,
+   .gpio = 16,
+   .startup_delay = 7, /* 70msec */
+   .enable_high = 1,
+   .enabled_at_boot = 0,   /* keep in RESET */
+   .init_data = hsusb2_reset_data,
+};
+
+static struct platform_device hsusb2_reset_device = {
+   .name = reg-fixed-voltage,
+   .id = PLATFORM_DEVID_AUTO,
+   .dev = {
+   .platform_data = hsusb2_reset_config,
+   },
+};
+
 static struct platform_device *omap3pandora_devices[] __initdata = {
pandora_leds_gpio,
pandora_keys_gpio,
pandora_vwlan_device,
pandora_backlight,
+   hsusb2_phy_device,
+   hsusb2_reset_device,
 };
 
 static struct usbhs_omap_platform_data usbhs_bdata __initdata = {
-
-   .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED,
.port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
-   .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
-
-   .phy_reset  = true,
-   .reset_gpio_port[0]  = -EINVAL,
-   .reset_gpio_port[1]  = 16,
-   .reset_gpio_port[2]  = -EINVAL
 };
 
 #ifdef CONFIG_OMAP_MUX
@@ -601,6 +635,10 @@ static void __init omap3pandora_init(void)
ARRAY_SIZE(omap3pandora_spi_board_info));
omap_ads7846_init(1, OMAP3_PANDORA_TS_GPIO, 0, NULL);
usbhs_init(usbhs_bdata);
+
+   /* PHY on HSUSB Port 2 i.e. index 1 */
+   usb_bind_phy(ehci-omap.0, 1, nop_usb_xceiv.2);
+
usb_musb_init(NULL);
gpmc_nand_init(pandora_nand_data, NULL);
 
-- 
1.7.4.1

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 30/30] ARM: OMAP: USB: Remove unused fields from struct usbhs_omap_platform_data

2013-01-28 Thread Roger Quadros
All users have been adapted to the changes in ehci-omap. We can now
get rid of the unused fields from usbhs_omap_platform_data.

Signed-off-by: Roger Quadros rog...@ti.com
---
 include/linux/platform_data/usb-omap.h |3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/include/linux/platform_data/usb-omap.h 
b/include/linux/platform_data/usb-omap.h
index 925a4a7..227601f 100644
--- a/include/linux/platform_data/usb-omap.h
+++ b/include/linux/platform_data/usb-omap.h
@@ -41,13 +41,10 @@ enum usbhs_omap_port_mode {
 struct usbhs_omap_platform_data {
int nports;
enum usbhs_omap_port_mode   port_mode[OMAP3_HS_USB_PORTS];
-   int reset_gpio_port[OMAP3_HS_USB_PORTS];
-   struct regulator*regulator[OMAP3_HS_USB_PORTS];
 
/* OMAP3 = ES2.1 have a single ulpi bypass control bit */
unsignedsingle_ulpi_bypass:1;
unsignedes2_compatibility:1;
-   unsignedphy_reset:1;
 };
 
 /*-*/
-- 
1.7.4.1

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 28/30] ARM: OMAP3: overo: Adapt to ehci-omap changes

2013-01-28 Thread Roger Quadros
Add platform device for 'nop-usb-xceiv'. This will be used as a
PHY for HS USB Port 2, so provide binding information for it.

Model RESET for HS USB Port 2 as GPIO fixed regulator and link
it to the 'nop-usb-xceiv' PHY.

Signed-off-by: Roger Quadros rog...@ti.com
---
 arch/arm/mach-omap2/board-overo.c |   55 +
 1 files changed, 49 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-omap2/board-overo.c 
b/arch/arm/mach-omap2/board-overo.c
index b1b0f09..5c6ea7d 100644
--- a/arch/arm/mach-omap2/board-overo.c
+++ b/arch/arm/mach-omap2/board-overo.c
@@ -31,6 +31,7 @@
 #include linux/regulator/machine.h
 #include linux/regulator/fixed.h
 #include linux/spi/spi.h
+#include linux/usb/phy.h
 
 #include linux/mtd/mtd.h
 #include linux/mtd/nand.h
@@ -457,14 +458,51 @@ static int __init overo_spi_init(void)
return 0;
 }
 
+/* PHY device on HS USB Port 2 i.e. nop_usb_xceiv.2 */
+static struct platform_device hsusb2_phy_device = {
+   .name = nop_usb_xceiv,
+   .id = 2,
+};
+
+/* Regulator for HS USB Port 2 PHY reset */
+static struct regulator_consumer_supply hsusb2_reset_supplies[] = {
+   /* Link PHY device to reset supply so it gets used in the PHY driver */
+   REGULATOR_SUPPLY(reset, nop_usb_xceiv.2),
+};
+
+static struct regulator_init_data hsusb2_reset_data = {
+   .constraints = {
+   .valid_ops_mask = REGULATOR_CHANGE_STATUS,
+   },
+   .consumer_supplies = hsusb2_reset_supplies,
+   .num_consumer_supplies = ARRAY_SIZE(hsusb2_reset_supplies),
+};
+
+static struct fixed_voltage_config hsusb2_reset_config = {
+   .supply_name = hsusb2_reset,
+   .microvolts = 330,
+   .gpio = OVERO_GPIO_USBH_NRESET,
+   .startup_delay = 7, /* 70msec */
+   .enable_high = 1,
+   .enabled_at_boot = 0,   /* keep in RESET */
+   .init_data = hsusb2_reset_data,
+};
+
+static struct platform_device hsusb2_reset_device = {
+   .name = reg-fixed-voltage,
+   .id = PLATFORM_DEVID_AUTO,
+   .dev = {
+   .platform_data = hsusb2_reset_config,
+   },
+};
+
+static struct platform_device *overo_devices[] __initdata = {
+   hsusb2_phy_device,
+   hsusb2_reset_device,
+};
+
 static struct usbhs_omap_platform_data usbhs_bdata __initdata = {
-   .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED,
.port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
-   .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
-   .phy_reset  = true,
-   .reset_gpio_port[0]  = -EINVAL,
-   .reset_gpio_port[1]  = OVERO_GPIO_USBH_NRESET,
-   .reset_gpio_port[2]  = -EINVAL
 };
 
 #ifdef CONFIG_OMAP_MUX
@@ -499,7 +537,12 @@ static void __init overo_init(void)
  mt46h32m32lf6_sdrc_params);
board_nand_init(overo_nand_partitions,
ARRAY_SIZE(overo_nand_partitions), NAND_CS, 0, NULL);
+   platform_add_devices(overo_devices, ARRAY_SIZE(overo_devices));
usb_musb_init(NULL);
+
+   /* PHY on HSUSB Port 2 i.e. index 1 */
+   usb_bind_phy(ehci-omap.0, 1, nop_usb_xceiv.2);
+
usbhs_init(usbhs_bdata);
overo_spi_init();
overo_init_smsc911x();
-- 
1.7.4.1

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 24/30] ARM: OMAP3: omap3evm: Adapt to ehci-omap changes

2013-01-28 Thread Roger Quadros
Add platform device for 'nop-usb-xceiv'. This will be used as a
PHY for HS USB Port 2, so provide binding information for it.

Model RESET for HS USB Port 2 as GPIO fixed regulator and link
it to the 'nop-usb-xceiv' PHY.

Signed-off-by: Roger Quadros rog...@ti.com
---
 arch/arm/mach-omap2/board-omap3evm.c |   63 --
 1 files changed, 52 insertions(+), 11 deletions(-)

diff --git a/arch/arm/mach-omap2/board-omap3evm.c 
b/arch/arm/mach-omap2/board-omap3evm.c
index 7bdc8a4..9f3550e 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -34,6 +34,7 @@
 #include linux/usb/otg.h
 #include linux/usb/musb.h
 #include linux/usb/nop-usb-xceiv.h
+#include linux/usb/phy.h
 #include linux/smsc911x.h
 
 #include linux/wl12xx.h
@@ -538,17 +539,51 @@ static int __init omap3_evm_i2c_init(void)
return 0;
 }
 
-static struct usbhs_omap_platform_data usbhs_bdata __initdata = {
+/* PHY device on HS USB Port 2 i.e. nop_usb_xceiv.2 */
+static struct platform_device hsusb2_phy_device = {
+   .name = nop_usb_xceiv,
+   .id = 2,
+};
 
-   .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED,
-   .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
-   .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
+/* Regulator for HS USB Port 2 PHY reset */
+static struct regulator_consumer_supply hsusb2_reset_supplies[] = {
+   /* Link PHY device to reset supply so it gets used in the PHY driver */
+   REGULATOR_SUPPLY(reset, nop_usb_xceiv.2),
+};
 
-   .phy_reset  = true,
-   /* PHY reset GPIO will be runtime programmed based on EVM version */
-   .reset_gpio_port[0]  = -EINVAL,
-   .reset_gpio_port[1]  = -EINVAL,
-   .reset_gpio_port[2]  = -EINVAL
+static struct regulator_init_data hsusb2_reset_data = {
+   .constraints = {
+   .valid_ops_mask = REGULATOR_CHANGE_STATUS,
+   },
+   .consumer_supplies = hsusb2_reset_supplies,
+   .num_consumer_supplies = ARRAY_SIZE(hsusb2_reset_supplies),
+};
+
+static struct fixed_voltage_config hsusb2_reset_config = {
+   .supply_name = hsusb2_reset,
+   .microvolts = 330,
+   .gpio = -1, /* set at runtime */
+   .startup_delay = 7, /* 70msec */
+   .enable_high = 1,
+   .enabled_at_boot = 0,   /* keep in RESET */
+   .init_data = hsusb2_reset_data,
+};
+
+static struct platform_device hsusb2_reset_device = {
+   .name = reg-fixed-voltage,
+   .id = PLATFORM_DEVID_AUTO,
+   .dev = {
+   .platform_data = hsusb2_reset_config,
+   },
+};
+
+static struct platform_device *omap3evm_devices[] __initdata = {
+   hsusb2_phy_device,
+   hsusb2_reset_device,
+};
+
+static struct usbhs_omap_platform_data usbhs_bdata __initdata = {
+   .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
 };
 
 #ifdef CONFIG_OMAP_MUX
@@ -724,7 +759,7 @@ static void __init omap3_evm_init(void)
 
/* setup EHCI phy reset config */
omap_mux_init_gpio(21, OMAP_PIN_INPUT_PULLUP);
-   usbhs_bdata.reset_gpio_port[1] = 21;
+   hsusb2_reset_config.gpio = 21;
 
/* EVM REV = E can supply 500mA with EXTVBUS programming */
musb_board_data.power = 500;
@@ -732,9 +767,15 @@ static void __init omap3_evm_init(void)
} else {
/* setup EHCI phy reset on MDC */
omap_mux_init_gpio(135, OMAP_PIN_OUTPUT);
-   usbhs_bdata.reset_gpio_port[1] = 135;
+   hsusb2_reset_config.gpio = 135;
}
+
+   platform_add_devices(omap3evm_devices, ARRAY_SIZE(omap3evm_devices));
usb_musb_init(musb_board_data);
+
+   /* PHY on HSUSB Port 2 i.e. index 1 */
+   usb_bind_phy(ehci-omap.0, 1, nop_usb_xceiv.2);
+
usbhs_init(usbhs_bdata);
board_nand_init(omap3evm_nand_partitions,
ARRAY_SIZE(omap3evm_nand_partitions), NAND_CS,
-- 
1.7.4.1

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 19/30] ARM: OMAP: AM3517evm: Adapt to ehci-omap changes

2013-01-28 Thread Roger Quadros
Add 2 platform devices for 'nop-usb-xceiv'. These will be used as a
PHY for HS USB Port 1 and 2, so provide binding information for them.

Model RESET for HS USB Port 1 as GPIO fixed regulator and link it
to the 'nop-usb-xceiv' PHY on port 1.

Signed-off-by: Roger Quadros rog...@ti.com
---
 arch/arm/mach-omap2/board-am3517evm.c |   66 ++---
 1 files changed, 60 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-omap2/board-am3517evm.c 
b/arch/arm/mach-omap2/board-am3517evm.c
index c76725d..a06feb0 100644
--- a/arch/arm/mach-omap2/board-am3517evm.c
+++ b/arch/arm/mach-omap2/board-am3517evm.c
@@ -25,6 +25,9 @@
 #include linux/can/platform/ti_hecc.h
 #include linux/davinci_emac.h
 #include linux/mmc/host.h
+#include linux/regulator/machine.h
+#include linux/regulator/fixed.h
+#include linux/usb/phy.h
 #include linux/usb/musb.h
 #include linux/platform_data/gpio-omap.h
 
@@ -274,6 +277,50 @@ static __init void am3517_evm_mcbsp1_init(void)
omap_ctrl_writel(devconf0, OMAP2_CONTROL_DEVCONF0);
 }
 
+/* PHY device on HS USB Port 1 i.e. nop_usb_xceiv.1 */
+static struct platform_device hsusb1_phy_device = {
+   .name = nop_usb_xceiv,
+   .id = 1,
+};
+
+/* Regulator for HS USB Port 1 PHY reset */
+static struct regulator_consumer_supply hsusb1_reset_supplies[] = {
+   /* Link PHY device to reset supply so it gets used in the PHY driver */
+   REGULATOR_SUPPLY(reset, nop_usb_xceiv.1),
+};
+
+static struct regulator_init_data hsusb1_reset_data = {
+   .constraints = {
+   .valid_ops_mask = REGULATOR_CHANGE_STATUS,
+   },
+   .consumer_supplies = hsusb1_reset_supplies,
+   .num_consumer_supplies = ARRAY_SIZE(hsusb1_reset_supplies),
+};
+
+static struct fixed_voltage_config hsusb1_reset_config = {
+   .supply_name = hsusb1_reset,
+   .microvolts = 330,
+   .gpio = 57,
+   .startup_delay = 7, /* 70msec */
+   .enable_high = 1,
+   .enabled_at_boot = 0,   /* keep in RESET */
+   .init_data = hsusb1_reset_data,
+};
+
+static struct platform_device hsusb1_reset_device = {
+   .name = reg-fixed-voltage,
+   .id = PLATFORM_DEVID_AUTO,
+   .dev = {
+   .platform_data = hsusb1_reset_config,
+   },
+};
+
+/* PHY device on HS USB Port 2 i.e. nop_usb_xceiv.2 */
+static struct platform_device hsusb2_phy_device = {
+   .name = nop_usb_xceiv,
+   .id = 2,
+};
+
 static struct usbhs_omap_platform_data usbhs_bdata __initdata = {
.port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
 #if defined(CONFIG_PANEL_SHARP_LQ043T1DG01) || \
@@ -282,12 +329,6 @@ static struct usbhs_omap_platform_data usbhs_bdata 
__initdata = {
 #else
.port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
 #endif
-   .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
-
-   .phy_reset  = true,
-   .reset_gpio_port[0]  = 57,
-   .reset_gpio_port[1]  = -EINVAL,
-   .reset_gpio_port[2]  = -EINVAL
 };
 
 #ifdef CONFIG_OMAP_MUX
@@ -349,6 +390,11 @@ static struct omap2_hsmmc_info mmc[] = {
{}  /* Terminator */
 };
 
+static struct platform_device *am3517evm_devices[] __initdata = {
+   hsusb1_phy_device,
+   hsusb1_reset_device,
+   hsusb2_phy_device,
+};
 
 static void __init am3517_evm_init(void)
 {
@@ -361,6 +407,14 @@ static void __init am3517_evm_init(void)
 
/* Configure GPIO for EHCI port */
omap_mux_init_gpio(57, OMAP_PIN_OUTPUT);
+
+   platform_add_devices(am3517evm_devices, ARRAY_SIZE(am3517evm_devices));
+
+   /* PHY on HSUSB Port 1 i.e. index 0 */
+   usb_bind_phy(ehci-omap.0, 0, nop_usb_xceiv.1);
+   /* PHY on HSUSB Port 2 i.e. index 1 */
+   usb_bind_phy(ehci-omap.0, 1, nop_usb_xceiv.2);
+
usbhs_init(usbhs_bdata);
am3517_evm_hecc_init(am3517_evm_hecc_pdata);
/* DSS */
-- 
1.7.4.1

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 15/30] ARM: OMAP3: Beagle: Adapt to ehci-omap changes

2013-01-28 Thread Roger Quadros
Add platform device for 'nop-usb-xceiv'. This will be used as a
PHY for HS USB Port 2, so provide binding information for it.

Model RESET and Power for HS USB Port 2 as GPIO fixed regulators
and link them to the 'nop-usb-xceiv' PHY.

Signed-off-by: Roger Quadros rog...@ti.com
---
 arch/arm/mach-omap2/board-omap3beagle.c |   93 +++---
 1 files changed, 83 insertions(+), 10 deletions(-)

diff --git a/arch/arm/mach-omap2/board-omap3beagle.c 
b/arch/arm/mach-omap2/board-omap3beagle.c
index 1cb114e..d8c6993 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -32,7 +32,9 @@
 #include linux/mmc/host.h
 
 #include linux/regulator/machine.h
+#include linux/regulator/fixed.h
 #include linux/i2c/twl.h
+#include linux/usb/phy.h
 
 #include asm/mach-types.h
 #include asm/mach/arch.h
@@ -248,6 +250,76 @@ static struct regulator_consumer_supply 
beagle_vsim_supply[] = {
 
 static struct gpio_led gpio_leds[];
 
+/* PHY device on HS USB Port 2 i.e. nop_usb_xceiv.2 */
+static struct platform_device hsusb2_phy_device = {
+   .name = nop_usb_xceiv,
+   .id = 2,
+};
+
+/* Regulator for HS USB Port 2 PHY reset */
+static struct regulator_consumer_supply hsusb2_reset_supplies[] = {
+   /* Link PHY device to reset supply so it gets used in the PHY driver */
+   REGULATOR_SUPPLY(reset, nop_usb_xceiv.2),
+};
+
+static struct regulator_init_data hsusb2_reset_data = {
+   .constraints = {
+   .valid_ops_mask = REGULATOR_CHANGE_STATUS,
+   },
+   .consumer_supplies = hsusb2_reset_supplies,
+   .num_consumer_supplies = ARRAY_SIZE(hsusb2_reset_supplies),
+};
+
+static struct fixed_voltage_config hsusb2_reset_config = {
+   .supply_name = hsusb2_reset,
+   .microvolts = 330,
+   .gpio = 147,
+   .startup_delay = 7, /* 70msec */
+   .enable_high = 1,
+   .enabled_at_boot = 0,   /* keep in RESET */
+   .init_data = hsusb2_reset_data,
+};
+
+static struct platform_device hsusb2_reset_device = {
+   .name = reg-fixed-voltage,
+   .id = PLATFORM_DEVID_AUTO,
+   .dev = {
+   .platform_data = hsusb2_reset_config,
+   },
+};
+
+/* Regulator for HS USB Port 2 supply */
+static struct regulator_consumer_supply hsusb2_power_supplies[] = {
+/* Link PHY device to power supply so it gets enabled in the PHY driver */
+   REGULATOR_SUPPLY(vcc, nop_usb_xceiv.2),
+};
+
+static struct regulator_init_data hsusb2_power_data = {
+   .constraints = {
+   .valid_ops_mask = REGULATOR_CHANGE_STATUS,
+   },
+   .consumer_supplies = hsusb2_power_supplies,
+   .num_consumer_supplies = ARRAY_SIZE(hsusb2_power_supplies),
+};
+
+static struct fixed_voltage_config hsusb2_power_config = {
+   .supply_name = hsusb2_vbus,
+   .microvolts = 500,
+   .gpio = -1, /* set at runtime in beagle_twl_gpio_setup */
+   .startup_delay = 7, /* 70msec */
+   .enable_high = 0,   /* updated in omap3_beagle_init_rev() */
+   .enabled_at_boot = 0,
+   .init_data = hsusb2_power_data,
+};
+
+static struct platform_device hsusb2_power_device = {
+   .name = reg-fixed-voltage,
+   .id = PLATFORM_DEVID_AUTO,
+   .dev = {
+   .platform_data = hsusb2_power_config,
+   },
+};
+
 static int beagle_twl_gpio_setup(struct device *dev,
unsigned gpio, unsigned ngpio)
 {
@@ -289,8 +361,11 @@ static int beagle_twl_gpio_setup(struct device *dev,
}
dvi_panel.power_down_gpio = beagle_config.dvi_pd_gpio;
 
-   gpio_request_one(gpio + TWL4030_GPIO_MAX, beagle_config.usb_pwr_level,
-   nEN_USB_PWR);
+   /* TWL4030_GPIO_MAX controls HS USB Port 2 power */
+   hsusb2_power_config.gpio = gpio + TWL4030_GPIO_MAX;
+   hsusb2_power_config.enable_high = beagle_config.usb_pwr_level;
+
+   platform_device_register(hsusb2_power_device);
 
/* TWL4030_GPIO_MAX + 1 == ledB, PMU_STAT (out, active low LED) */
gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1;
@@ -428,18 +503,12 @@ static struct platform_device *omap3_beagle_devices[] 
__initdata = {
leds_gpio,
keys_gpio,
madc_hwmon,
+   hsusb2_reset_device,
+   hsusb2_phy_device,
 };
 
 static struct usbhs_omap_platform_data usbhs_bdata __initdata = {
-
-   .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED,
.port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
-   .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
-
-   .phy_reset  = true,
-   .reset_gpio_port[0]  = -EINVAL,
-   .reset_gpio_port[1]  = 147,
-   .reset_gpio_port[2]  = -EINVAL
 };
 
 #ifdef CONFIG_OMAP_MUX
@@ -520,7 +589,11 @@ static void __init omap3_beagle_init(void)
  mt46h32m32lf6_sdrc_params);
 
usb_musb_init(NULL);
+
+   /* PHY on HSUSB Port 2 i.e. index 1 */
+   usb_bind_phy(ehci-omap.0, 1, nop_usb_xceiv.2);
usbhs_init(usbhs_bdata);
+
   

[PATCH v2 10/30] USB: ehci-omap: Use PHY APIs to get the PHY device and put it out of suspend

2013-01-28 Thread Roger Quadros
For each port that is in PHY mode we obtain a PHY device using the USB PHY
library and put it out of suspend.

It is upto platform code to associate the PHY to the controller's
port and it is upto the PHY driver to manage the PHY's resources.

Signed-off-by: Roger Quadros rog...@ti.com
---
 drivers/usb/host/ehci-omap.c |   54 ++
 1 files changed, 54 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
index fd2f5450..a35e44e 100644
--- a/drivers/usb/host/ehci-omap.c
+++ b/drivers/usb/host/ehci-omap.c
@@ -70,6 +70,11 @@ static const char hcd_name[] = ehci-omap;
 
 /*-*/
 
+struct omap_hcd {
+   struct usb_hcd *hcd;
+   struct usb_phy **phy;   /* one PHY for each port */
+   int nports;
+};
 
 static inline void ehci_write(void __iomem *base, u32 reg, u32 val)
 {
@@ -179,6 +184,7 @@ static struct hc_driver __read_mostly ehci_omap_hc_driver;
 
 static const struct ehci_driver_overrides ehci_omap_overrides __initdata = {
.reset =omap_ehci_init,
+   .extra_priv_size =  sizeof(struct omap_hcd),
 };
 
 /**
@@ -194,6 +200,7 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
struct usbhs_omap_platform_data *pdata = dev-platform_data;
struct resource *res;
struct usb_hcd  *hcd;
+   struct omap_hcd *omap;
void __iomem*regs;
int ret = -ENODEV;
int irq;
@@ -233,6 +240,39 @@ static int ehci_hcd_omap_probe(struct platform_device 
*pdev)
hcd-rsrc_len = resource_size(res);
hcd-regs = regs;
 
+   omap = (struct omap_hcd *)hcd_to_ehci(hcd)-priv;
+   omap-nports = pdata-nports;
+   i = sizeof(struct usb_phy *) * omap-nports;
+   omap-phy = devm_kzalloc(pdev-dev, i, GFP_KERNEL);
+   if (!omap-phy) {
+   dev_err(dev, Memory allocation failed\n);
+   return -ENOMEM;
+   }
+
+   platform_set_drvdata(pdev, hcd);
+
+   /* get the PHY devices if needed */
+   for (i = 0 ; i  omap-nports ; i++) {
+   struct usb_phy *phy;
+
+   if (pdata-port_mode[i] != OMAP_EHCI_PORT_MODE_PHY)
+   continue;
+
+   /* get the PHY device */
+   phy = devm_usb_get_phy_dev(dev, i);
+   if (IS_ERR(phy) || !phy) {
+   ret = IS_ERR(phy) ? PTR_ERR(phy) : -ENODEV;
+   dev_err(dev, Can't get PHY device for port %d: %d\n,
+   i, ret);
+   goto err_phy;
+   }
+
+   omap-phy[i] = phy;
+   usb_phy_init(omap-phy[i]);
+   /* bring PHY out of suspend */
+   usb_phy_set_suspend(omap-phy[i], 0);
+   }
+
/* get ehci regulator and enable */
for (i = 0 ; i  OMAP3_HS_USB_PORTS ; i++) {
if (pdata-port_mode[i] != OMAP_EHCI_PORT_MODE_PHY) {
@@ -277,6 +317,13 @@ static int ehci_hcd_omap_probe(struct platform_device 
*pdev)
 err_pm_runtime:
disable_put_regulator(pdata);
pm_runtime_put_sync(dev);
+
+err_phy:
+   for (i = 0; i  omap-nports; i++) {
+   if (omap-phy[i])
+   usb_phy_shutdown(omap-phy[i]);
+   }
+
usb_put_hcd(hcd);
 
return ret;
@@ -295,11 +342,18 @@ static int ehci_hcd_omap_remove(struct platform_device 
*pdev)
 {
struct device *dev  = pdev-dev;
struct usb_hcd *hcd = dev_get_drvdata(dev);
+   struct omap_hcd *omap = (struct omap_hcd *)hcd_to_ehci(hcd)-priv;
+   int i;
 
usb_remove_hcd(hcd);
disable_put_regulator(dev-platform_data);
usb_put_hcd(hcd);
 
+   for (i = 0; i  omap-nports; i++) {
+   if (omap-phy[i])
+   usb_phy_shutdown(omap-phy[i]);
+   }
+
pm_runtime_put_sync(dev);
pm_runtime_disable(dev);
 
-- 
1.7.4.1

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 18/30] ARM: OMAP: AM3517crane: Adapt to ehci-omap changes

2013-01-28 Thread Roger Quadros
Add platform device for 'nop-usb-xceiv'. This will be used as a
PHY for HS USB Port 1, so provide binding information for it.

Model RESET and Power for HS USB Port 1 as GPIO fixed regulators
and link them to the 'nop-usb-xceiv' PHY.

Signed-off-by: Roger Quadros rog...@ti.com
---
 arch/arm/mach-omap2/board-am3517crane.c |   95 +++
 1 files changed, 83 insertions(+), 12 deletions(-)

diff --git a/arch/arm/mach-omap2/board-am3517crane.c 
b/arch/arm/mach-omap2/board-am3517crane.c
index 26f1916..1d25af6 100644
--- a/arch/arm/mach-omap2/board-am3517crane.c
+++ b/arch/arm/mach-omap2/board-am3517crane.c
@@ -20,6 +20,9 @@
 #include linux/kernel.h
 #include linux/init.h
 #include linux/gpio.h
+#include linux/regulator/machine.h
+#include linux/regulator/fixed.h
+#include linux/usb/phy.h
 
 #include asm/mach-types.h
 #include asm/mach/arch.h
@@ -40,15 +43,84 @@ static struct omap_board_mux board_mux[] __initdata = {
 };
 #endif
 
+/* PHY device on HS USB Port 1 i.e. nop_usb_xceiv.1 */
+static struct platform_device hsusb1_phy_device = {
+   .name = nop_usb_xceiv,
+   .id = 1,
+};
+
+/* Regulator for HS USB Port 1 PHY reset */
+static struct regulator_consumer_supply hsusb1_reset_supplies[] = {
+   /* Link PHY device to reset supply so it gets used in the PHY driver */
+   REGULATOR_SUPPLY(reset, nop_usb_xceiv.1),
+};
+
+static struct regulator_init_data hsusb1_reset_data = {
+   .constraints = {
+   .valid_ops_mask = REGULATOR_CHANGE_STATUS,
+   },
+   .consumer_supplies = hsusb1_reset_supplies,
+   .num_consumer_supplies = ARRAY_SIZE(hsusb1_reset_supplies),
+};
+
+static struct fixed_voltage_config hsusb1_reset_config = {
+   .supply_name = hsusb1_reset,
+   .microvolts = 330,
+   .gpio = GPIO_USB_NRESET,
+   .startup_delay = 7, /* 70msec */
+   .enable_high = 1,
+   .enabled_at_boot = 0,   /* keep in RESET */
+   .init_data = hsusb1_reset_data,
+};
+
+static struct platform_device hsusb1_reset_device = {
+   .name = reg-fixed-voltage,
+   .id = PLATFORM_DEVID_AUTO,
+   .dev = {
+   .platform_data = hsusb1_reset_config,
+   },
+};
+
+/* Regulator for HS USB Port 1 supply */
+static struct regulator_consumer_supply hsusb1_power_supplies[] = {
+/* Link PHY device to power supply so it gets enabled in the PHY driver */
+   REGULATOR_SUPPLY(vcc, nop_usb_xceiv.1),
+};
+
+static struct regulator_init_data hsusb1_power_data = {
+   .constraints = {
+   .valid_ops_mask = REGULATOR_CHANGE_STATUS,
+   },
+   .consumer_supplies = hsusb1_power_supplies,
+   .num_consumer_supplies  = ARRAY_SIZE(hsusb1_power_supplies),
+};
+
+static struct fixed_voltage_config hsusb1_power_config = {
+   .supply_name = hsusb1_vbus,
+   .microvolts = 500,
+   .gpio = GPIO_USB_POWER,
+   .startup_delay = 7, /* 70msec */
+   .enable_high = 1,
+   .enabled_at_boot = 0,
+   .init_data = hsusb1_power_data,
+};
+
+static struct platform_device hsusb1_power_device = {
+   .name = reg-fixed-voltage,
+   .id = PLATFORM_DEVID_AUTO,
+   .dev = {
+   .platform_data = hsusb1_power_config,
+   },
+};
+
 static struct usbhs_omap_platform_data usbhs_bdata __initdata = {
.port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
-   .port_mode[1] = OMAP_USBHS_PORT_MODE_UNUSED,
-   .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
+};
 
-   .phy_reset  = true,
-   .reset_gpio_port[0]  = GPIO_USB_NRESET,
-   .reset_gpio_port[1]  = -EINVAL,
-   .reset_gpio_port[2]  = -EINVAL
+static struct platform_device *am3517_crane_devices[] __initdata = {
+   hsusb1_phy_device,
+   hsusb1_reset_device,
+   hsusb1_power_device,
 };
 
 static void __init am3517_crane_init(void)
@@ -72,12 +144,11 @@ static void __init am3517_crane_init(void)
return;
}
 
-   ret = gpio_request_one(GPIO_USB_POWER, GPIOF_OUT_INIT_HIGH,
-  usb_ehci_enable);
-   if (ret  0) {
-   pr_err(Can not request GPIO %d\n, GPIO_USB_POWER);
-   return;
-   }
+   platform_add_devices(am3517_crane_devices,
+   ARRAY_SIZE(am3517_crane_devices));
+
+   /* PHY on HSUSB Port 1 i.e. index 0 */
+   usb_bind_phy(ehci-omap.0, 0, nop_usb_xceiv.1);
 
usbhs_init(usbhs_bdata);
am35xx_emac_init(AM35XX_DEFAULT_MDIO_FREQUENCY, 1);
-- 
1.7.4.1

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 17/30] ARM: OMAP3: 3630SDP: Adapt to ehci-omap changes

2013-01-28 Thread Roger Quadros
Add 2 platform devices for 'nop-usb-xceiv'. These will be used
as PHYs for HS USB ports 1 and 2 so provide binding information
for them.

Model RESET for HS USB Ports 1 and 2 as GPIO fixed regulators and
link them to the 2 PHYs we just created.

Signed-off-by: Roger Quadros rog...@ti.com
---
 arch/arm/mach-omap2/board-3630sdp.c |  100 --
 1 files changed, 94 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-omap2/board-3630sdp.c 
b/arch/arm/mach-omap2/board-3630sdp.c
index 78b1724..43683ea 100644
--- a/arch/arm/mach-omap2/board-3630sdp.c
+++ b/arch/arm/mach-omap2/board-3630sdp.c
@@ -12,6 +12,9 @@
 #include linux/input.h
 #include linux/gpio.h
 #include linux/mtd/nand.h
+#include linux/regulator/machine.h
+#include linux/regulator/fixed.h
+#include linux/usb/phy.h
 
 #include asm/mach-types.h
 #include asm/mach/arch.h
@@ -53,16 +56,86 @@ static void enable_board_wakeup_source(void)
OMAP_WAKEUP_EN | OMAP_PIN_INPUT_PULLUP);
 }
 
+/* PHY device on HS USB Port 1 i.e. nop_usb_xceiv.1 */
+static struct platform_device hsusb1_phy_device = {
+   .name = nop_usb_xceiv,
+   .id = 1,
+};
+
+/* Regulator for HS USB Port 1 PHY reset */
+static struct regulator_consumer_supply hsusb1_reset_supplies[] = {
+   /* Link PHY device to reset supply so it gets used in the PHY driver */
+   REGULATOR_SUPPLY(reset, nop_usb_xceiv.1),
+};
+
+static struct regulator_init_data hsusb1_reset_data = {
+   .constraints = {
+   .valid_ops_mask = REGULATOR_CHANGE_STATUS,
+   },
+   .consumer_supplies = hsusb1_reset_supplies,
+   .num_consumer_supplies = ARRAY_SIZE(hsusb1_reset_supplies),
+};
+
+static struct fixed_voltage_config hsusb1_reset_config = {
+   .supply_name = hsusb1_reset,
+   .microvolts = 330,
+   .gpio = 126,
+   .startup_delay = 7, /* 70msec */
+   .enable_high = 1,
+   .enabled_at_boot = 0,   /* keep in RESET */
+   .init_data = hsusb1_reset_data,
+};
+
+static struct platform_device hsusb1_reset_device = {
+   .name = reg-fixed-voltage,
+   .id = PLATFORM_DEVID_AUTO,
+   .dev = {
+   .platform_data = hsusb1_reset_config,
+   },
+};
+
+/* PHY device on HS USB Port 2 i.e. nop_usb_xceiv.2 */
+static struct platform_device hsusb2_phy_device = {
+   .name = nop_usb_xceiv,
+   .id = 2,
+};
+
+/* Regulator for HS USB Port 2 PHY reset */
+static struct regulator_consumer_supply hsusb2_reset_supplies[] = {
+   /* Link PHY device to reset supply so it gets used in the PHY driver */
+   REGULATOR_SUPPLY(reset, nop_usb_xceiv.2),
+};
+
+static struct regulator_init_data hsusb2_reset_data = {
+   .constraints = {
+   .valid_ops_mask = REGULATOR_CHANGE_STATUS,
+   },
+   .consumer_supplies = hsusb2_reset_supplies,
+   .num_consumer_supplies = ARRAY_SIZE(hsusb2_reset_supplies),
+};
+
+static struct fixed_voltage_config hsusb2_reset_config = {
+   .supply_name = hsusb2_reset,
+   .microvolts = 330,
+   .gpio = 61,
+   .startup_delay = 7, /* 70msec */
+   .enable_high = 1,
+   .enabled_at_boot = 0,   /* keep in RESET */
+   .init_data = hsusb2_reset_data,
+};
+
+static struct platform_device hsusb2_reset_device = {
+   .name = reg-fixed-voltage,
+   .id = PLATFORM_DEVID_AUTO,
+   .dev = {
+   .platform_data = hsusb2_reset_config,
+   },
+};
+
 static struct usbhs_omap_platform_data usbhs_bdata __initdata = {
 
.port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
.port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
-   .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
-
-   .phy_reset  = true,
-   .reset_gpio_port[0]  = 126,
-   .reset_gpio_port[1]  = 61,
-   .reset_gpio_port[2]  = -EINVAL
 };
 
 #ifdef CONFIG_OMAP_MUX
@@ -189,6 +262,13 @@ static struct flash_partitions sdp_flash_partitions[] = {
},
 };
 
+static struct platform_device *sdp3630_devices[] __initdata = {
+   hsusb1_phy_device,
+   hsusb1_reset_device,
+   hsusb2_phy_device,
+   hsusb2_reset_device,
+};
+
 static void __init omap_sdp_init(void)
 {
omap3_mux_init(board_mux, OMAP_PACKAGE_CBP);
@@ -199,6 +279,14 @@ static void __init omap_sdp_init(void)
board_smc91x_init();
board_flash_init(sdp_flash_partitions, chip_sel_sdp, NAND_BUSWIDTH_16);
enable_board_wakeup_source();
+
+   platform_add_devices(sdp3630_devices, ARRAY_SIZE(sdp3630_devices));
+
+   /* PHY on HSUSB Port 1 i.e. index 0 */
+   usb_bind_phy(ehci-omap.0, 0, nop_usb_xceiv.1);
+   /* PHY on HSUSB Port 2 i.e. index 1 */
+   usb_bind_phy(ehci-omap.0, 1, nop_usb_xceiv.2);
+
usbhs_init(usbhs_bdata);
 }
 
-- 
1.7.4.1

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 16/30] ARM: OMAP3: 3430SDP: Adapt to ehci-omap changes

2013-01-28 Thread Roger Quadros
Add 2 platform devices for 'nop-usb-xceiv'. These will be used
as PHYs for HS USB ports 1 and 2 so provide binding information
for them.

Model RESET for HS USB Ports 1 and 2 as GPIO fixed regulators and
link them to the 2 PHYs we just created.

Signed-off-by: Roger Quadros rog...@ti.com
---
 arch/arm/mach-omap2/board-3430sdp.c |   99 --
 1 files changed, 93 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-omap2/board-3430sdp.c 
b/arch/arm/mach-omap2/board-3430sdp.c
index 46147c8..69b0944 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -21,6 +21,8 @@
 #include linux/spi/spi.h
 #include linux/i2c/twl.h
 #include linux/regulator/machine.h
+#include linux/regulator/fixed.h
+#include linux/usb/phy.h
 #include linux/io.h
 #include linux/gpio.h
 #include linux/mmc/host.h
@@ -424,16 +426,86 @@ static void enable_board_wakeup_source(void)
OMAP_WAKEUP_EN | OMAP_PIN_INPUT_PULLUP);
 }
 
+/* PHY device on HS USB Port 1 i.e. nop_usb_xceiv.1 */
+static struct platform_device hsusb1_phy_device = {
+   .name = nop_usb_xceiv,
+   .id = 1,
+};
+
+/* Regulator for HS USB Port 1 PHY reset */
+static struct regulator_consumer_supply hsusb1_reset_supplies[] = {
+   /* Link PHY device to reset supply so it gets used in the PHY driver */
+   REGULATOR_SUPPLY(reset, nop_usb_xceiv.1),
+};
+
+static struct regulator_init_data hsusb1_reset_data = {
+   .constraints = {
+   .valid_ops_mask = REGULATOR_CHANGE_STATUS,
+   },
+   .consumer_supplies = hsusb1_reset_supplies,
+   .num_consumer_supplies = ARRAY_SIZE(hsusb1_reset_supplies),
+};
+
+static struct fixed_voltage_config hsusb1_reset_config = {
+   .supply_name = hsusb1_reset,
+   .microvolts = 330,
+   .gpio = 57,
+   .startup_delay = 7, /* 70msec */
+   .enable_high = 1,
+   .enabled_at_boot = 0,   /* keep in RESET */
+   .init_data = hsusb1_reset_data,
+};
+
+static struct platform_device hsusb1_reset_device = {
+   .name = reg-fixed-voltage,
+   .id = PLATFORM_DEVID_AUTO,
+   .dev = {
+   .platform_data = hsusb1_reset_config,
+   },
+};
+
+/* PHY device on HS USB Port 2 i.e. nop_usb_xceiv.2 */
+static struct platform_device hsusb2_phy_device = {
+   .name = nop_usb_xceiv,
+   .id = 2,
+};
+
+/* Regulator for HS USB Port 2 PHY reset */
+static struct regulator_consumer_supply hsusb2_reset_supplies[] = {
+   /* Link PHY device to reset supply so it gets used in the PHY driver */
+   REGULATOR_SUPPLY(reset, nop_usb_xceiv.2),
+};
+
+static struct regulator_init_data hsusb2_reset_data = {
+   .constraints = {
+   .valid_ops_mask = REGULATOR_CHANGE_STATUS,
+   },
+   .consumer_supplies = hsusb2_reset_supplies,
+   .num_consumer_supplies = ARRAY_SIZE(hsusb2_reset_supplies),
+};
+
+static struct fixed_voltage_config hsusb2_reset_config = {
+   .supply_name = hsusb2_reset,
+   .microvolts = 330,
+   .gpio = 61,
+   .startup_delay = 7, /* 70msec */
+   .enable_high = 1,
+   .enabled_at_boot = 0,   /* keep in RESET */
+   .init_data = hsusb2_reset_data,
+};
+
+static struct platform_device hsusb2_reset_device = {
+   .name = reg-fixed-voltage,
+   .id = PLATFORM_DEVID_AUTO,
+   .dev = {
+   .platform_data = hsusb2_reset_config,
+   },
+};
+
 static struct usbhs_omap_platform_data usbhs_bdata __initdata = {
 
.port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
.port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
-   .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
-
-   .phy_reset  = true,
-   .reset_gpio_port[0]  = 57,
-   .reset_gpio_port[1]  = 61,
-   .reset_gpio_port[2]  = -EINVAL
 };
 
 #ifdef CONFIG_OMAP_MUX
@@ -564,6 +636,13 @@ static struct flash_partitions sdp_flash_partitions[] = {
},
 };
 
+static struct platform_device *sdp3430_devices[] __initdata = {
+   hsusb1_phy_device,
+   hsusb1_reset_device,
+   hsusb2_phy_device,
+   hsusb2_reset_device,
+};
+
 static void __init omap_3430sdp_init(void)
 {
int gpio_pendown;
@@ -579,11 +658,19 @@ static void __init omap_3430sdp_init(void)
omap_ads7846_init(1, gpio_pendown, 310, NULL);
omap_serial_init();
omap_sdrc_init(hyb18m512160af6_sdrc_params, NULL);
+
+   platform_add_devices(sdp3430_devices, ARRAY_SIZE(sdp3430_devices));
+
usb_musb_init(NULL);
board_smc91x_init();
board_flash_init(sdp_flash_partitions, chip_sel_3430, 0);
sdp3430_display_init();
enable_board_wakeup_source();
+
+   /* PHY on HSUSB Port 1 i.e. index 0 */
+   usb_bind_phy(ehci-omap.0, 0, nop_usb_xceiv.1);
+   /* PHY on HSUSB Port 2 i.e. index 1 */
+   usb_bind_phy(ehci-omap.0, 1, nop_usb_xceiv.2);
usbhs_init(usbhs_bdata);
 }
 
-- 
1.7.4.1

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of 

[PATCH v2 14/30] ARM: OMAP2+: omap4panda: Adapt to ehci-omap changes

2013-01-28 Thread Roger Quadros
Model RESET and Power for HS USB Port 1 as GPIO fixed regulators
and link them to the 'nop-usb-xceiv' PHY by making them as reset
and vcc supplies.

The RESET and Power will then be managed by the PHY driver.

Signed-off-by: Roger Quadros rog...@ti.com
---
 arch/arm/mach-omap2/board-omap4panda.c |   93 +++-
 1 files changed, 67 insertions(+), 26 deletions(-)

diff --git a/arch/arm/mach-omap2/board-omap4panda.c 
b/arch/arm/mach-omap2/board-omap4panda.c
index 2641752..8c85e05 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -30,6 +30,7 @@
 #include linux/regulator/fixed.h
 #include linux/ti_wilink_st.h
 #include linux/usb/musb.h
+#include linux/usb/phy.h
 #include linux/usb/nop-usb-xceiv.h
 #include linux/wl12xx.h
 #include linux/platform_data/omap-abe-twl6040.h
@@ -146,6 +147,70 @@ static struct platform_device hsusb1_phy_device = {
},
 };
 
+/* Regulator for USB HUB/PHY reset */
+static struct regulator_consumer_supply hsusb1_reset_supplies[] = {
+/* Link PHY device to reset supply so it gets used in the PHY driver */
+   REGULATOR_SUPPLY(reset, nop_usb_xceiv.1),
+};
+
+static struct regulator_init_data hsusb1_reset_data = {
+   .constraints = {
+   .valid_ops_mask = REGULATOR_CHANGE_STATUS,
+   },
+   .consumer_supplies  = hsusb1_reset_supplies,
+   .num_consumer_supplies  = ARRAY_SIZE(hsusb1_reset_supplies),
+};
+
+static struct fixed_voltage_config hsusb1_reset_config = {
+   .supply_name= hsusb1_reset,
+   .microvolts = 330,
+   .gpio = GPIO_HUB_NRESET,
+   .startup_delay = 7, /* 70msec */
+   .enable_high = 1,
+   .enabled_at_boot = 0,   /* keep in RESET */
+   .init_data = hsusb1_reset_data,
+};
+
+static struct platform_device hsusb1_reset_device = {
+   .name   = reg-fixed-voltage,
+   .id = PLATFORM_DEVID_AUTO,
+   .dev = {
+   .platform_data = hsusb1_reset_config,
+   },
+};
+
+/* Regulator for USB HUB supply */
+static struct regulator_consumer_supply hsusb1_power_supplies[] = {
+/* Link PHY device to USB HUB supply so it gets enabled in the PHY driver */
+   REGULATOR_SUPPLY(vcc, nop_usb_xceiv.1),
+};
+
+static struct regulator_init_data hsusb1_power_data = {
+   .constraints = {
+   .valid_ops_mask = REGULATOR_CHANGE_STATUS,
+   },
+   .consumer_supplies  = hsusb1_power_supplies,
+   .num_consumer_supplies  = ARRAY_SIZE(hsusb1_power_supplies),
+};
+
+static struct fixed_voltage_config hsusb1_power_config = {
+   .supply_name= hsusb1_vbus,
+   .microvolts = 330,
+   .gpio = GPIO_HUB_POWER,
+   .startup_delay = 7, /* 70msec */
+   .enable_high = 1,
+   .enabled_at_boot = 0,
+   .init_data = hsusb1_power_data,
+};
+
+static struct platform_device hsusb1_power_device = {
+   .name   = reg-fixed-voltage,
+   .id = PLATFORM_DEVID_AUTO,
+   .dev = {
+   .platform_data = hsusb1_power_config,
+   },
+};
+
 static struct platform_device *panda_devices[] __initdata = {
leds_gpio,
wl1271_device,
@@ -153,39 +218,18 @@ static struct platform_device *panda_devices[] __initdata 
= {
panda_hdmi_audio_codec,
btwilink_device,
hsusb1_phy_device,
+   hsusb1_power_device,
+   hsusb1_reset_device,
 };
 
 static struct usbhs_omap_platform_data usbhs_bdata __initdata = {
.port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
-   .port_mode[1] = OMAP_USBHS_PORT_MODE_UNUSED,
-   .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
-   .phy_reset  = false,
-   .reset_gpio_port[0]  = -EINVAL,
-   .reset_gpio_port[1]  = -EINVAL,
-   .reset_gpio_port[2]  = -EINVAL
-};
-
-static struct gpio panda_ehci_gpios[] __initdata = {
-   { GPIO_HUB_POWER,   GPIOF_OUT_INIT_LOW,  hub_power  },
-   { GPIO_HUB_NRESET,  GPIOF_OUT_INIT_LOW,  hub_nreset },
 };
 
 static void __init omap4_ehci_init(void)
 {
int ret;
 
-   /* disable the power to the usb hub prior to init and reset phy+hub */
-   ret = gpio_request_array(panda_ehci_gpios,
-ARRAY_SIZE(panda_ehci_gpios));
-   if (ret) {
-   pr_err(Unable to initialize EHCI power/reset\n);
-   return;
-   }
-
-   gpio_export(GPIO_HUB_POWER, 0);
-   gpio_export(GPIO_HUB_NRESET, 0);
-   gpio_set_value(GPIO_HUB_NRESET, 1);
-
/* FREF_CLK3 provides the 19.2 MHz reference clock to the PHY */
ret = clk_add_alias(main_clk, nop_usb_xceiv.1, auxclk3_ck, NULL);
if (ret)
@@ -195,9 +239,6 @@ static void __init omap4_ehci_init(void)
usb_bind_phy(ehci-omap.0, 0, nop_usb_xceiv.1);
 
usbhs_init(usbhs_bdata);
-
-   /* enable power to hub */
-   gpio_set_value(GPIO_HUB_POWER, 1);
 }
 
 static struct omap_musb_board_data musb_board_data = {
-- 
1.7.4.1

--
To unsubscribe from this list: send the line 

[PATCH 0/4] usb: dwc3/xhci: Enable runtime power management

2013-01-28 Thread Vivek Gautam
This patch-series enables runtime power management on xhci-plat,
dwc3-core, dwc3-exynos as well as on samsung-usb3 type PHY.
This allows usb 3.0 host ports to be power managed at runtime.
We also turn off the PHY ref_clk PLL, which supplies reference clock
to USB3 type phy, when ports are not in use.

This patch-series is based on 'usb-next' with follwing patches:

usb: phy: samsung: Introducing usb phy driver for hsotg
usb: phy: s3c-hsotg: adding phy driver support

usb: phy: samsung: Add support to set pmu isolation
ARM: EXYNOS: Update  move usb-phy types to generic include layer
usb: phy: samsung: Add host phy support to samsung-phy driver
USB: ehci-s5p: Add phy driver support
USB: ohci-exynos: Add phy driver support
usb: phy: samsung: Remove __devinit, __devexit_p and __exit annotations

[PATCH v4 1/2] usb: phy: samsung: Common out the generic stuff
[PATCH v4 2/2] usb: phy: samsung: Add PHY support for USB 3.0 controller

Vivek Gautam (4):
  usb: xhci: Enable runtime pm in xhci-plat
  USB: dwc3: Adjust runtime pm the dwc3 driver to allow runtime suspend
  usb: dwc3: exynos: Enable runtime power management
  usb: phy: samsung: Enable runtime power management on samsung-usb3

 drivers/usb/dwc3/core.c  |4 +-
 drivers/usb/dwc3/dwc3-exynos.c   |   47 +
 drivers/usb/host/xhci-plat.c |9 +++
 drivers/usb/phy/samsung-usb3.c   |  107 +++--
 drivers/usb/phy/samsung-usbphy.c |   26 +
 drivers/usb/phy/samsung-usbphy.h |1 +
 6 files changed, 187 insertions(+), 7 deletions(-)

-- 
1.7.6.5

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 12/30] usb: ehci-omap: Remove PHY regulator handling code

2013-01-28 Thread Roger Quadros
PHY regulator handling must be done in the PHY driver

Signed-off-by: Roger Quadros rog...@ti.com
---
 drivers/usb/host/ehci-omap.c |   34 --
 1 files changed, 0 insertions(+), 34 deletions(-)

diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
index 3c63619..da3e322 100644
--- a/drivers/usb/host/ehci-omap.c
+++ b/drivers/usb/host/ehci-omap.c
@@ -42,7 +42,6 @@
 #include linux/platform_device.h
 #include linux/slab.h
 #include linux/usb/ulpi.h
-#include linux/regulator/consumer.h
 #include linux/pm_runtime.h
 #include linux/gpio.h
 #include linux/clk.h
@@ -112,19 +111,6 @@ static int omap_ehci_init(struct usb_hcd *hcd)
return rc;
 }
 
-static void disable_put_regulator(
-   struct usbhs_omap_platform_data *pdata)
-{
-   int i;
-
-   for (i = 0 ; i  OMAP3_HS_USB_PORTS ; i++) {
-   if (pdata-regulator[i]) {
-   regulator_disable(pdata-regulator[i]);
-   regulator_put(pdata-regulator[i]);
-   }
-   }
-}
-
 /* configure so an HC device and id are always provided */
 /* always called with process context; sleeping is OK */
 
@@ -153,7 +139,6 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
int ret = -ENODEV;
int irq;
int i;
-   charsupply[7];
 
if (usb_disabled())
return -ENODEV;
@@ -221,23 +206,6 @@ static int ehci_hcd_omap_probe(struct platform_device 
*pdev)
usb_phy_set_suspend(omap-phy[i], 0);
}
 
-   /* get ehci regulator and enable */
-   for (i = 0 ; i  OMAP3_HS_USB_PORTS ; i++) {
-   if (pdata-port_mode[i] != OMAP_EHCI_PORT_MODE_PHY) {
-   pdata-regulator[i] = NULL;
-   continue;
-   }
-   snprintf(supply, sizeof(supply), hsusb%d, i);
-   pdata-regulator[i] = regulator_get(dev, supply);
-   if (IS_ERR(pdata-regulator[i])) {
-   pdata-regulator[i] = NULL;
-   dev_dbg(dev,
-   failed to get ehci port%d regulator\n, i);
-   } else {
-   regulator_enable(pdata-regulator[i]);
-   }
-   }
-
pm_runtime_enable(dev);
pm_runtime_get_sync(dev);
 
@@ -263,7 +231,6 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
return 0;
 
 err_pm_runtime:
-   disable_put_regulator(pdata);
pm_runtime_put_sync(dev);
 
 err_phy:
@@ -294,7 +261,6 @@ static int ehci_hcd_omap_remove(struct platform_device 
*pdev)
int i;
 
usb_remove_hcd(hcd);
-   disable_put_regulator(dev-platform_data);
usb_put_hcd(hcd);
 
for (i = 0; i  omap-nports; i++) {
-- 
1.7.4.1

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/4] usb: xhci: Enable runtime pm in xhci-plat

2013-01-28 Thread Vivek Gautam
By enabling runtime pm in this driver is allows users of xhci-plat to
enter into runtime pm.  This is not full runtime pm support (AKA
xhci-plat doesn't actually power anything off when in runtime suspend
mode) but just basic enablement.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
Signed-off-by: Doug Anderson diand...@chromium.org
---
 drivers/usb/host/xhci-plat.c |9 +
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index df90fe5..6ad7cfb 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -139,6 +139,10 @@ static int xhci_plat_probe(struct platform_device *pdev)
goto dealloc_usb2_hcd;
}
 
+   pm_runtime_set_active(pdev-dev);
+   pm_runtime_enable(pdev-dev);
+   pm_runtime_forbid(pdev-dev);
+
/*
 * Set the xHCI pointer before xhci_plat_setup() (aka hcd_driver.reset)
 * is called by usb_add_hcd().
@@ -149,10 +153,13 @@ static int xhci_plat_probe(struct platform_device *pdev)
if (ret)
goto put_usb3_hcd;
 
+   pm_runtime_allow(pdev-dev);
+
return 0;
 
 put_usb3_hcd:
usb_put_hcd(xhci-shared_hcd);
+   pm_runtime_disable(pdev-dev);
 
 dealloc_usb2_hcd:
usb_remove_hcd(hcd);
@@ -174,6 +181,8 @@ static int xhci_plat_remove(struct platform_device *dev)
struct usb_hcd  *hcd = platform_get_drvdata(dev);
struct xhci_hcd *xhci = hcd_to_xhci(hcd);
 
+   pm_runtime_disable(dev-dev);
+
usb_remove_hcd(xhci-shared_hcd);
usb_put_hcd(xhci-shared_hcd);
 
-- 
1.7.6.5

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 09/30] USB: ehci-omap: Use devm_request_and_ioremap()

2013-01-28 Thread Roger Quadros
Make use of devm_request_and_ioremap() and correct comment.

Signed-off-by: Roger Quadros rog...@ti.com
---
 drivers/usb/host/ehci-omap.c |   19 +--
 1 files changed, 5 insertions(+), 14 deletions(-)

diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
index 30fc482..fd2f5450 100644
--- a/drivers/usb/host/ehci-omap.c
+++ b/drivers/usb/host/ehci-omap.c
@@ -216,23 +216,17 @@ static int ehci_hcd_omap_probe(struct platform_device 
*pdev)
 
res =  platform_get_resource_byname(pdev,
IORESOURCE_MEM, ehci);
-   if (!res) {
-   dev_err(dev, UHH EHCI get resource failed\n);
-   return -ENODEV;
-   }
-
-   regs = ioremap(res-start, resource_size(res));
+   regs = devm_request_and_ioremap(dev, res);
if (!regs) {
-   dev_err(dev, UHH EHCI ioremap failed\n);
-   return -ENOMEM;
+   dev_err(dev, Resource request/ioremap failed\n);
+   return -EADDRNOTAVAIL;
}
 
hcd = usb_create_hcd(ehci_omap_hc_driver, dev,
dev_name(dev));
if (!hcd) {
-   dev_err(dev, failed to create hcd with err %d\n, ret);
-   ret = -ENOMEM;
-   goto err_io;
+   dev_err(dev, Failed to create HCD\n);
+   return -ENOMEM;
}
 
hcd-rsrc_start = res-start;
@@ -285,8 +279,6 @@ err_pm_runtime:
pm_runtime_put_sync(dev);
usb_put_hcd(hcd);
 
-err_io:
-   iounmap(regs);
return ret;
 }
 
@@ -306,7 +298,6 @@ static int ehci_hcd_omap_remove(struct platform_device 
*pdev)
 
usb_remove_hcd(hcd);
disable_put_regulator(dev-platform_data);
-   iounmap(hcd-regs);
usb_put_hcd(hcd);
 
pm_runtime_put_sync(dev);
-- 
1.7.4.1

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/4] USB: dwc3: Adjust runtime pm the dwc3 driver to allow runtime suspend

2013-01-28 Thread Vivek Gautam
The current code in the dwc3 probe effectively disables runtime pm
from ever working because it calls a get() that was never put() until
device removal.  Change the runtime pm code to match the standard
formula and allow runtime pm to function.

Note that this doesn't enable full runtime pm on the DWC3 device in
that the port isn't put into a lower power mode when not used.
However it does allow users of dwc3 (like dwc3-exynos) to do some
amount of runtime power management.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
Signed-off-by: Doug Anderson diand...@chromium.org
---
 drivers/usb/dwc3/core.c |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 3a4004a..59c2494 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -453,6 +453,7 @@ static int dwc3_probe(struct platform_device *pdev)
if (of_get_property(node, tx-fifo-resize, NULL))
dwc-needs_fifo_resize = true;
 
+   pm_runtime_set_active(dev);
pm_runtime_enable(dev);
pm_runtime_get_sync(dev);
pm_runtime_forbid(dev);
@@ -517,6 +518,7 @@ static int dwc3_probe(struct platform_device *pdev)
goto err2;
}
 
+   pm_runtime_put(dev);
pm_runtime_allow(dev);
 
return 0;
@@ -543,6 +545,7 @@ err1:
 
 err0:
dwc3_free_event_buffers(dwc);
+   pm_runtime_disable(pdev-dev);
 
return ret;
 }
@@ -554,7 +557,6 @@ static int dwc3_remove(struct platform_device *pdev)
 
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 
-   pm_runtime_put(pdev-dev);
pm_runtime_disable(pdev-dev);
 
dwc3_debugfs_exit(dwc);
-- 
1.7.6.5

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 08/30] mfd: omap-usb-host: Remove PHY reset handling code

2013-01-28 Thread Roger Quadros
PHY reset GPIO handling will be done in the PHY driver

Signed-off-by: Roger Quadros rog...@ti.com
Acked-by: Samuel Ortiz sa...@linux.intel.com
---
 drivers/mfd/omap-usb-host.c |   47 ---
 1 files changed, 0 insertions(+), 47 deletions(-)

diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
index 0874352..502a779 100644
--- a/drivers/mfd/omap-usb-host.c
+++ b/drivers/mfd/omap-usb-host.c
@@ -430,24 +430,10 @@ static unsigned omap_usbhs_rev2_hostconfig(struct 
usbhs_hcd_omap *omap,
 static void omap_usbhs_init(struct device *dev)
 {
struct usbhs_hcd_omap   *omap = dev_get_drvdata(dev);
-   struct usbhs_omap_platform_data *pdata = omap-pdata;
unsignedreg;
 
dev_dbg(dev, starting TI HSUSB Controller\n);
 
-   if (pdata-phy_reset) {
-   if (gpio_is_valid(pdata-reset_gpio_port[0]))
-   gpio_request_one(pdata-reset_gpio_port[0],
-GPIOF_OUT_INIT_LOW, USB1 PHY reset);
-
-   if (gpio_is_valid(pdata-reset_gpio_port[1]))
-   gpio_request_one(pdata-reset_gpio_port[1],
-GPIOF_OUT_INIT_LOW, USB2 PHY reset);
-
-   /* Hold the PHY in RESET for enough time till DIR is high */
-   udelay(10);
-   }
-
pm_runtime_get_sync(dev);
 
reg = usbhs_read(omap-uhh_base, OMAP_UHH_HOSTCONFIG);
@@ -476,37 +462,8 @@ static void omap_usbhs_init(struct device *dev)
dev_dbg(dev, UHH setup done, uhh_hostconfig=%x\n, reg);
 
pm_runtime_put_sync(dev);
-   if (pdata-phy_reset) {
-   /* Hold the PHY in RESET for enough time till
-* PHY is settled and ready
-*/
-   udelay(10);
-
-   if (gpio_is_valid(pdata-reset_gpio_port[0]))
-   gpio_set_value_cansleep
-   (pdata-reset_gpio_port[0], 1);
-
-   if (gpio_is_valid(pdata-reset_gpio_port[1]))
-   gpio_set_value_cansleep
-   (pdata-reset_gpio_port[1], 1);
-   }
-}
-
-static void omap_usbhs_deinit(struct device *dev)
-{
-   struct usbhs_hcd_omap   *omap = dev_get_drvdata(dev);
-   struct usbhs_omap_platform_data *pdata = omap-pdata;
-
-   if (pdata-phy_reset) {
-   if (gpio_is_valid(pdata-reset_gpio_port[0]))
-   gpio_free(pdata-reset_gpio_port[0]);
-
-   if (gpio_is_valid(pdata-reset_gpio_port[1]))
-   gpio_free(pdata-reset_gpio_port[1]);
-   }
 }
 
-
 /**
  * usbhs_omap_probe - initialize TI-based HCDs
  *
@@ -710,8 +667,6 @@ static int usbhs_omap_probe(struct platform_device *pdev)
return 0;
 
 err_alloc:
-   omap_usbhs_deinit(pdev-dev);
-
for (i = 0; i  omap-nports; i++) {
if (!IS_ERR(omap-utmi_clk[i]))
clk_put(omap-utmi_clk[i]);
@@ -756,8 +711,6 @@ static int usbhs_omap_remove(struct platform_device *pdev)
struct usbhs_hcd_omap *omap = platform_get_drvdata(pdev);
int i;
 
-   omap_usbhs_deinit(pdev-dev);
-
for (i = 0; i  omap-nports; i++) {
if (!IS_ERR(omap-utmi_clk[i]))
clk_put(omap-utmi_clk[i]);
-- 
1.7.4.1

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 07/30] mfd: omap-usb-host: update nports in platform_data

2013-01-28 Thread Roger Quadros
EHCI driver would need to know the number of ports available
on the platform. We set the nports parameter of platform_data
based on IP version if it was not already provided.

Signed-off-by: Roger Quadros rog...@ti.com
Acked-by: Samuel Ortiz sa...@linux.intel.com
---
 drivers/mfd/omap-usb-host.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
index 6b5edf6..0874352 100644
--- a/drivers/mfd/omap-usb-host.c
+++ b/drivers/mfd/omap-usb-host.c
@@ -575,6 +575,7 @@ static int usbhs_omap_probe(struct platform_device *pdev)
 omap-usbhs_rev, omap-nports);
break;
}
+   pdata-nports = omap-nports;
}
 
i = sizeof(struct clk *) * omap-nports;
-- 
1.7.4.1

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 05/30] usb: phy: nop: Handle RESET for the PHY

2013-01-28 Thread Roger Quadros
We expect the RESET line to be modeled as a regulator with supply
name reset. The regulator should be modeled such that enabling
the regulator brings the PHY device out of RESET and disabling the
regulator holds the device in RESET.

They PHY will be held in RESET in .shutdown() and brought out of
RESET in .init().

Signed-off-by: Roger Quadros rog...@ti.com
---
 drivers/usb/otg/nop-usb-xceiv.c |   19 +++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/otg/nop-usb-xceiv.c b/drivers/usb/otg/nop-usb-xceiv.c
index 0a9628c..3060ed0 100644
--- a/drivers/usb/otg/nop-usb-xceiv.c
+++ b/drivers/usb/otg/nop-usb-xceiv.c
@@ -40,6 +40,7 @@ struct nop_usb_xceiv {
struct device   *dev;
struct clk  *clk;
struct regulator*vcc;
+   struct regulator*reset;
 };
 
 static struct platform_device *pd;
@@ -80,6 +81,12 @@ static int nop_init(struct usb_phy *phy)
if (!IS_ERR(nop-clk))
clk_enable(nop-clk);
 
+   if (!IS_ERR(nop-reset)) {
+   /* De-assert RESET */
+   if (regulator_enable(nop-reset))
+   dev_err(phy-dev, Failed to de-assert reset\n);
+   }
+
return 0;
 }
 
@@ -87,6 +94,12 @@ static void nop_shutdown(struct usb_phy *phy)
 {
struct nop_usb_xceiv *nop = dev_get_drvdata(phy-dev);
 
+   if (!IS_ERR(nop-reset)) {
+   /* Assert RESET */
+   if (regulator_disable(nop-reset))
+   dev_err(phy-dev, Failed to assert reset\n);
+   }
+
if (!IS_ERR(nop-clk))
clk_disable(nop-clk);
 
@@ -171,6 +184,12 @@ static int nop_usb_xceiv_probe(struct platform_device 
*pdev)
PTR_ERR(nop-vcc));
}
 
+   nop-reset = devm_regulator_get(pdev-dev, reset);
+   if (IS_ERR(nop-reset)) {
+   dev_dbg(pdev-dev, Error getting reset regulator: %ld\n,
+   PTR_ERR(nop-reset));
+   }
+
nop-dev= pdev-dev;
nop-phy.dev= nop-dev;
nop-phy.label  = nop-xceiv;
-- 
1.7.4.1

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/4] usb: dwc3: exynos: Enable runtime power management

2013-01-28 Thread Vivek Gautam
Enabling runtime power management on dwc3-exynos to save
power and allow its PHY's power to be managed at runtime.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 drivers/usb/dwc3/dwc3-exynos.c |   47 
 1 files changed, 47 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-exynos.c
index aae5328..c51e8c1 100644
--- a/drivers/usb/dwc3/dwc3-exynos.c
+++ b/drivers/usb/dwc3/dwc3-exynos.c
@@ -157,11 +157,15 @@ static int dwc3_exynos_probe(struct platform_device *pdev)
goto err4;
}
 
+   pm_runtime_set_active(pdev-dev);
+   pm_runtime_enable(pdev-dev);
+
return 0;
 
 err4:
clk_disable(clk);
clk_put(clk);
+   pm_runtime_disable(pdev-dev);
 err3:
platform_device_put(dwc3);
 err1:
@@ -174,6 +178,8 @@ static int dwc3_exynos_remove(struct platform_device *pdev)
 {
struct dwc3_exynos  *exynos = platform_get_drvdata(pdev);
 
+   pm_runtime_disable(pdev-dev);
+
platform_device_unregister(exynos-dwc3);
platform_device_unregister(exynos-usb2_phy);
platform_device_unregister(exynos-usb3_phy);
@@ -186,6 +192,46 @@ static int dwc3_exynos_remove(struct platform_device *pdev)
return 0;
 }
 
+static int dwc3_exynos_runtime_suspend(struct device *dev)
+{
+   struct dwc3_exynos  *exynos = dev_get_drvdata(dev);
+   struct platform_device  *pdev_dwc = exynos-dwc3;
+   struct dwc3 *dwc = NULL;
+
+   dwc = platform_get_drvdata(pdev_dwc);
+
+   if (!dwc)
+   return 0;
+
+   pm_runtime_put_sync(dwc-usb3_phy-dev);
+
+   clk_disable(exynos-clk);
+
+   return 0;
+}
+static int dwc3_exynos_runtime_resume(struct device *dev)
+{
+   struct dwc3_exynos  *exynos = dev_get_drvdata(dev);
+   struct platform_device  *pdev_dwc = exynos-dwc3;
+   struct dwc3 *dwc = NULL;
+
+   dwc = platform_get_drvdata(pdev_dwc);
+
+   clk_enable(exynos-clk);
+
+   if (!dwc)
+   return 0;
+
+   pm_runtime_get_sync(dwc-usb3_phy-dev);
+
+   return 0;
+}
+
+static const struct dev_pm_ops dwc3_exynos_pm_ops = {
+   SET_RUNTIME_PM_OPS(dwc3_exynos_runtime_suspend,
+   dwc3_exynos_runtime_resume, NULL)
+};
+
 #ifdef CONFIG_OF
 static const struct of_device_id exynos_dwc3_match[] = {
{ .compatible = samsung,exynos-dwc3 },
@@ -200,6 +246,7 @@ static struct platform_driver dwc3_exynos_driver = {
.driver = {
.name   = exynos-dwc3,
.of_match_table = of_match_ptr(exynos_dwc3_match),
+   .pm = dwc3_exynos_pm_ops,
},
 };
 
-- 
1.7.6.5

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 04/30] usb: phy: nop: Handle power supply regulator for the PHY

2013-01-28 Thread Roger Quadros
We use vcc as the supply name for the PHY's power supply.
The power supply will be enabled during .init() and disabled
during .shutdown()

Signed-off-by: Roger Quadros rog...@ti.com
---
 drivers/usb/otg/nop-usb-xceiv.c |   18 ++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/otg/nop-usb-xceiv.c b/drivers/usb/otg/nop-usb-xceiv.c
index 849eb9d..0a9628c 100644
--- a/drivers/usb/otg/nop-usb-xceiv.c
+++ b/drivers/usb/otg/nop-usb-xceiv.c
@@ -33,11 +33,13 @@
 #include linux/usb/nop-usb-xceiv.h
 #include linux/slab.h
 #include linux/clk.h
+#include linux/regulator/consumer.h
 
 struct nop_usb_xceiv {
struct usb_phy  phy;
struct device   *dev;
struct clk  *clk;
+   struct regulator*vcc;
 };
 
 static struct platform_device *pd;
@@ -70,6 +72,11 @@ static int nop_init(struct usb_phy *phy)
 {
struct nop_usb_xceiv *nop = dev_get_drvdata(phy-dev);
 
+   if (!IS_ERR(nop-vcc)) {
+   if (regulator_enable(nop-vcc))
+   dev_err(phy-dev, Failed to enable power\n);
+   }
+
if (!IS_ERR(nop-clk))
clk_enable(nop-clk);
 
@@ -82,6 +89,11 @@ static void nop_shutdown(struct usb_phy *phy)
 
if (!IS_ERR(nop-clk))
clk_disable(nop-clk);
+
+   if (!IS_ERR(nop-vcc)) {
+   if (regulator_disable(nop-vcc))
+   dev_err(phy-dev, Failed to disable power\n);
+   }
 }
 
 static int nop_set_peripheral(struct usb_otg *otg, struct usb_gadget *gadget)
@@ -153,6 +165,12 @@ static int nop_usb_xceiv_probe(struct platform_device 
*pdev)
}
}
 
+   nop-vcc = devm_regulator_get(pdev-dev, vcc);
+   if (IS_ERR(nop-vcc)) {
+   dev_dbg(pdev-dev, Error getting vcc regulator: %ld\n,
+   PTR_ERR(nop-vcc));
+   }
+
nop-dev= pdev-dev;
nop-phy.dev= nop-dev;
nop-phy.label  = nop-xceiv;
-- 
1.7.4.1

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 06/30] usb: phy: nop: use new PHY API to register PHY

2013-01-28 Thread Roger Quadros
We would need to support multiple PHYs of the same type
so use the new PHY API usb_add_phy_dev() to register the PHY.

Signed-off-by: Roger Quadros rog...@ti.com
---
 drivers/usb/otg/nop-usb-xceiv.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/otg/nop-usb-xceiv.c b/drivers/usb/otg/nop-usb-xceiv.c
index 3060ed0..ac027a1 100644
--- a/drivers/usb/otg/nop-usb-xceiv.c
+++ b/drivers/usb/otg/nop-usb-xceiv.c
@@ -197,12 +197,13 @@ static int nop_usb_xceiv_probe(struct platform_device 
*pdev)
nop-phy.init   = nop_init;
nop-phy.shutdown   = nop_shutdown;
nop-phy.state  = OTG_STATE_UNDEFINED;
+   nop-phy.type   = type;
 
nop-phy.otg-phy   = nop-phy;
nop-phy.otg-set_host  = nop_set_host;
nop-phy.otg-set_peripheral= nop_set_peripheral;
 
-   err = usb_add_phy(nop-phy, type);
+   err = usb_add_phy_dev(nop-phy);
if (err) {
dev_err(pdev-dev, can't register transceiver, err: %d\n,
err);
-- 
1.7.4.1

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/4] usb: phy: samsung: Enable runtime power management on samsung-usb3

2013-01-28 Thread Vivek Gautam
Enabling runtime power management support on samsung-usb3 phy
and further adding support to turn off the PHY ref_clk PLL.
It thereby requires PHY ref_clk to be switched between internal
core clock and external PLL clock.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 drivers/usb/phy/samsung-usb3.c   |  107 +++--
 drivers/usb/phy/samsung-usbphy.c |   26 +
 drivers/usb/phy/samsung-usbphy.h |1 +
 3 files changed, 128 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/phy/samsung-usb3.c b/drivers/usb/phy/samsung-usb3.c
index 29e1321..4dbef15 100644
--- a/drivers/usb/phy/samsung-usb3.c
+++ b/drivers/usb/phy/samsung-usb3.c
@@ -22,8 +22,10 @@
 #include linux/clk.h
 #include linux/delay.h
 #include linux/err.h
+#include linux/gpio.h
 #include linux/io.h
 #include linux/of.h
+#include linux/pm_runtime.h
 #include linux/usb/samsung_usb_phy.h
 #include linux/platform_data/samsung-usbphy.h
 
@@ -32,7 +34,7 @@
 /*
  * Sets the phy clk as EXTREFCLK (XXTI) which is internal clock from clock 
core.
  */
-static u32 samsung_usb3_phy_set_refclk(struct samsung_usbphy *sphy)
+static u32 samsung_usb3_phy_set_refclk_int(struct samsung_usbphy *sphy)
 {
u32 reg;
u32 refclk;
@@ -65,7 +67,22 @@ static u32 samsung_usb3_phy_set_refclk(struct samsung_usbphy 
*sphy)
return reg;
 }
 
-static int samsung_exynos5_usb3_phy_enable(struct samsung_usbphy *sphy)
+/*
+ * Sets the phy clk as ref_pad_clk (XusbXTI) which is clock from external PLL.
+ */
+static u32 samsung_usb3_phy_set_refclk_ext(void)
+{
+   u32 reg;
+
+   reg = PHYCLKRST_REFCLKSEL_PAD_REFCLK |
+   PHYCLKRST_FSEL_PAD_100MHZ |
+   PHYCLKRST_MPLL_MULTIPLIER_100MHZ_REF;
+
+   return reg;
+}
+
+static int samsung_exynos5_usb3_phy_enable(struct samsung_usbphy *sphy,
+   bool use_ext_clk)
 {
void __iomem *regs = sphy-regs;
u32 phyparam0;
@@ -80,7 +97,11 @@ static int samsung_exynos5_usb3_phy_enable(struct 
samsung_usbphy *sphy)
 
phyparam0 = readl(regs + EXYNOS5_DRD_PHYPARAM0);
/* Select PHY CLK source */
-   phyparam0 = ~PHYPARAM0_REF_USE_PAD;
+   if (use_ext_clk)
+   phyparam0 |= PHYPARAM0_REF_USE_PAD;
+   else
+   phyparam0 = ~PHYPARAM0_REF_USE_PAD;
+
/* Set Loss-of-Signal Detector sensitivity */
phyparam0 = ~PHYPARAM0_REF_LOSLEVEL_MASK;
phyparam0 |= PHYPARAM0_REF_LOSLEVEL;
@@ -115,7 +136,10 @@ static int samsung_exynos5_usb3_phy_enable(struct 
samsung_usbphy *sphy)
/* UTMI Power Control */
writel(PHYUTMI_OTGDISABLE, regs + EXYNOS5_DRD_PHYUTMI);
 
-   phyclkrst = samsung_usb3_phy_set_refclk(sphy);
+   if (use_ext_clk)
+   phyclkrst = samsung_usb3_phy_set_refclk_ext();
+   else
+   phyclkrst = samsung_usb3_phy_set_refclk_int(sphy);
 
phyclkrst |= PHYCLKRST_PORTRESET |
/* Digital power supply in normal operating mode */
@@ -163,7 +187,7 @@ static void samsung_exynos5_usb3_phy_disable(struct 
samsung_usbphy *sphy)
writel(phytest, regs + EXYNOS5_DRD_PHYTEST);
 }
 
-static int samsung_usb3_phy_init(struct usb_phy *phy)
+static int samsung_exynos5_usb3_phy_init(struct usb_phy *phy, bool use_ext_clk)
 {
struct samsung_usbphy *sphy;
unsigned long flags;
@@ -187,7 +211,7 @@ static int samsung_usb3_phy_init(struct usb_phy *phy)
samsung_usbphy_set_isolation(sphy, false);
 
/* Initialize usb phy registers */
-   samsung_exynos5_usb3_phy_enable(sphy);
+   samsung_exynos5_usb3_phy_enable(sphy, use_ext_clk);
 
spin_unlock_irqrestore(sphy-lock, flags);
 
@@ -198,6 +222,34 @@ static int samsung_usb3_phy_init(struct usb_phy *phy)
 }
 
 /*
+ * Switch  between internal core clock and external oscillator clock
+ * for PHY reference clock
+ */
+static int samsung_exynos5_usb3phy_clk_switch(struct usb_phy *phy,
+   bool use_ext_clk)
+{
+   /*
+* This will switch PHY refclk from internal core clock
+* to external PLL clock when device is in use and vice versa
+* when device plunge into runtime suspend mode.
+*/
+   return samsung_exynos5_usb3_phy_init(phy, use_ext_clk);
+}
+
+/*
+ * The function passed to the usb driver for phy initialization
+ */
+static int samsung_usb3_phy_init(struct usb_phy *phy)
+{
+   /*
+* We start with using PHY refclk from external PLL,
+* once runtime suspend for the device is called this
+* will change to internal core clock
+*/
+   return  samsung_exynos5_usb3_phy_init(phy, true);
+}
+
+/*
  * The function passed to the usb driver for phy shutdown
  */
 static void samsung_usb3_phy_shutdown(struct usb_phy *phy)
@@ -287,6 +339,9 @@ static int samsung_usb3_phy_probe(struct platform_device 
*pdev)
 
platform_set_drvdata(pdev, sphy);
 
+   

[PATCH 01/30] USB: EHCI: split ehci-omap out to a separate driver

2013-01-28 Thread Roger Quadros
From: Alan Stern st...@rowland.harvard.edu

This patch (as1645) converts ehci-omap over to the new ehci-hcd is a
library approach, so that it can coexist peacefully with other EHCI
platform drivers and can make use of the private area allocated at
the end of struct ehci_hcd.

Signed-off-by: Alan Stern st...@rowland.harvard.edu
---
 drivers/usb/host/Kconfig |2 +-
 drivers/usb/host/Makefile|1 +
 drivers/usb/host/ehci-hcd.c  |6 +---
 drivers/usb/host/ehci-omap.c |   76 +++---
 4 files changed, 37 insertions(+), 48 deletions(-)

diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index 3a21c5d..11e102e 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -155,7 +155,7 @@ config USB_EHCI_MXC
  Variation of ARC USB block used in some Freescale chips.
 
 config USB_EHCI_HCD_OMAP
-   bool EHCI support for OMAP3 and later chips
+   tristate EHCI support for OMAP3 and later chips
depends on USB_EHCI_HCD  ARCH_OMAP
default y
---help---
diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile
index 001fbff..56de410 100644
--- a/drivers/usb/host/Makefile
+++ b/drivers/usb/host/Makefile
@@ -27,6 +27,7 @@ obj-$(CONFIG_USB_EHCI_HCD)+= ehci-hcd.o
 obj-$(CONFIG_USB_EHCI_PCI) += ehci-pci.o
 obj-$(CONFIG_USB_EHCI_HCD_PLATFORM)+= ehci-platform.o
 obj-$(CONFIG_USB_EHCI_MXC) += ehci-mxc.o
+obj-$(CONFIG_USB_EHCI_HCD_OMAP)+= ehci-omap.o
 
 obj-$(CONFIG_USB_OXU210HP_HCD) += oxu210hp-hcd.o
 obj-$(CONFIG_USB_ISP116X_HCD)  += isp116x-hcd.o
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 09537b2..5a35246 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -1251,11 +1251,6 @@ MODULE_LICENSE (GPL);
 #define PLATFORM_DRIVERehci_hcd_sh_driver
 #endif
 
-#ifdef CONFIG_USB_EHCI_HCD_OMAP
-#include ehci-omap.c
-#definePLATFORM_DRIVER ehci_hcd_omap_driver
-#endif
-
 #ifdef CONFIG_PPC_PS3
 #include ehci-ps3.c
 #definePS3_SYSTEM_BUS_DRIVER   ps3_ehci_driver
@@ -1345,6 +1340,7 @@ MODULE_LICENSE (GPL);
!IS_ENABLED(CONFIG_USB_EHCI_HCD_PLATFORM)  \
!IS_ENABLED(CONFIG_USB_CHIPIDEA_HOST)  \
!IS_ENABLED(CONFIG_USB_EHCI_MXC)  \
+   !IS_ENABLED(CONFIG_USB_EHCI_HCD_OMAP)  \
!defined(PLATFORM_DRIVER)  \
!defined(PS3_SYSTEM_BUS_DRIVER)  \
!defined(OF_PLATFORM_DRIVER)  \
diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
index b96a4bf..30fc482 100644
--- a/drivers/usb/host/ehci-omap.c
+++ b/drivers/usb/host/ehci-omap.c
@@ -36,6 +36,9 @@
  * - convert to use hwmod and runtime PM
  */
 
+#include linux/kernel.h
+#include linux/module.h
+#include linux/io.h
 #include linux/platform_device.h
 #include linux/slab.h
 #include linux/usb/ulpi.h
@@ -43,6 +46,10 @@
 #include linux/pm_runtime.h
 #include linux/gpio.h
 #include linux/clk.h
+#include linux/usb.h
+#include linux/usb/hcd.h
+
+#include ehci.h
 
 #include linux/platform_data/usb-omap.h
 
@@ -57,9 +64,11 @@
 #defineEHCI_INSNREG05_ULPI_EXTREGADD_SHIFT 8
 #defineEHCI_INSNREG05_ULPI_WRDATA_SHIFT0
 
-/*-*/
+#define DRIVER_DESC OMAP-EHCI Host Controller driver
 
-static const struct hc_driver ehci_omap_hc_driver;
+static const char hcd_name[] = ehci-omap;
+
+/*-*/
 
 
 static inline void ehci_write(void __iomem *base, u32 reg, u32 val)
@@ -166,6 +175,12 @@ static void disable_put_regulator(
 /* configure so an HC device and id are always provided */
 /* always called with process context; sleeping is OK */
 
+static struct hc_driver __read_mostly ehci_omap_hc_driver;
+
+static const struct ehci_driver_overrides ehci_omap_overrides __initdata = {
+   .reset =omap_ehci_init,
+};
+
 /**
  * ehci_hcd_omap_probe - initialize TI-based HCDs
  *
@@ -315,56 +330,33 @@ static struct platform_driver ehci_hcd_omap_driver = {
/*.suspend  = ehci_hcd_omap_suspend, */
/*.resume   = ehci_hcd_omap_resume, */
.driver = {
-   .name   = ehci-omap,
+   .name   = hcd_name,
}
 };
 
 /*-*/
 
-static const struct hc_driver ehci_omap_hc_driver = {
-   .description= hcd_name,
-   .product_desc   = OMAP-EHCI Host Controller,
-   .hcd_priv_size  = sizeof(struct ehci_hcd),
-
-   /*
-* generic hardware linkage
-*/
-   .irq= ehci_irq,
-   .flags  = HCD_MEMORY | HCD_USB2,
-
-   /*
-* basic lifecycle operations
-*/
-   .reset  = omap_ehci_init,
-   .start  = ehci_run,
-   .stop  

[PATCH v2 11/30] usb: ehci-omap: Remove PHY reset handling code

2013-01-28 Thread Roger Quadros
Reset GPIO handling for the PHY must be done in the PHY
driver. We use the PHY helpers instead to reset the PHY.

Signed-off-by: Roger Quadros rog...@ti.com
---
 drivers/usb/host/ehci-omap.c |   70 +
 1 files changed, 9 insertions(+), 61 deletions(-)

diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
index a35e44e..3c63619 100644
--- a/drivers/usb/host/ehci-omap.c
+++ b/drivers/usb/host/ehci-omap.c
@@ -86,79 +86,27 @@ static inline u32 ehci_read(void __iomem *base, u32 reg)
return __raw_readl(base + reg);
 }
 
-
-static void omap_ehci_soft_phy_reset(struct usb_hcd *hcd, u8 port)
-{
-   unsigned long timeout = jiffies + msecs_to_jiffies(1000);
-   unsigned reg = 0;
-
-   reg = ULPI_FUNC_CTRL_RESET
-   /* FUNCTION_CTRL_SET register */
-   | (ULPI_SET(ULPI_FUNC_CTRL)  EHCI_INSNREG05_ULPI_REGADD_SHIFT)
-   /* Write */
-   | (2  EHCI_INSNREG05_ULPI_OPSEL_SHIFT)
-   /* PORTn */
-   | ((port + 1)  EHCI_INSNREG05_ULPI_PORTSEL_SHIFT)
-   /* start ULPI access*/
-   | (1  EHCI_INSNREG05_ULPI_CONTROL_SHIFT);
-
-   ehci_write(hcd-regs, EHCI_INSNREG05_ULPI, reg);
-
-   /* Wait for ULPI access completion */
-   while ((ehci_read(hcd-regs, EHCI_INSNREG05_ULPI)
-(1  EHCI_INSNREG05_ULPI_CONTROL_SHIFT))) {
-   cpu_relax();
-
-   if (time_after(jiffies, timeout)) {
-   dev_dbg(hcd-self.controller,
-   phy reset operation timed out\n);
-   break;
-   }
-   }
-}
-
 static int omap_ehci_init(struct usb_hcd *hcd)
 {
struct ehci_hcd *ehci = hcd_to_ehci(hcd);
-   int rc;
-   struct usbhs_omap_platform_data *pdata;
-
-   pdata = hcd-self.controller-platform_data;
+   struct omap_hcd *omap = (struct omap_hcd *)ehci-priv;
+   int rc, i;
 
/* Hold PHYs in reset while initializing EHCI controller */
-   if (pdata-phy_reset) {
-   if (gpio_is_valid(pdata-reset_gpio_port[0]))
-   gpio_set_value_cansleep(pdata-reset_gpio_port[0], 0);
-
-   if (gpio_is_valid(pdata-reset_gpio_port[1]))
-   gpio_set_value_cansleep(pdata-reset_gpio_port[1], 0);
-
-   /* Hold the PHY in RESET for enough time till DIR is high */
-   udelay(10);
+   for (i = 0; i  omap-nports; i++) {
+   if (omap-phy[i])
+   usb_phy_shutdown(omap-phy[i]);
}
 
-   /* Soft reset the PHY using PHY reset command over ULPI */
-   if (pdata-port_mode[0] == OMAP_EHCI_PORT_MODE_PHY)
-   omap_ehci_soft_phy_reset(hcd, 0);
-   if (pdata-port_mode[1] == OMAP_EHCI_PORT_MODE_PHY)
-   omap_ehci_soft_phy_reset(hcd, 1);
-
/* we know this is the memory we want, no need to ioremap again */
ehci-caps = hcd-regs;
 
rc = ehci_setup(hcd);
 
-   if (pdata-phy_reset) {
-   /* Hold the PHY in RESET for enough time till
-* PHY is settled and ready
-*/
-   udelay(10);
-
-   if (gpio_is_valid(pdata-reset_gpio_port[0]))
-   gpio_set_value_cansleep(pdata-reset_gpio_port[0], 1);
-
-   if (gpio_is_valid(pdata-reset_gpio_port[1]))
-   gpio_set_value_cansleep(pdata-reset_gpio_port[1], 1);
+   /* Bring PHYs out of reset */
+   for (i = 0; i  omap-nports; i++) {
+   if (omap-phy[i])
+   usb_phy_init(omap-phy[i]);
}
 
return rc;
-- 
1.7.4.1

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/4] USB: dwc3: Adjust runtime pm the dwc3 driver to allow runtime suspend

2013-01-28 Thread Felipe Balbi
On Mon, Jan 28, 2013 at 05:12:26PM +0530, Vivek Gautam wrote:
 The current code in the dwc3 probe effectively disables runtime pm
 from ever working because it calls a get() that was never put() until
 device removal.  Change the runtime pm code to match the standard
 formula and allow runtime pm to function.
 
 Note that this doesn't enable full runtime pm on the DWC3 device in
 that the port isn't put into a lower power mode when not used.
 However it does allow users of dwc3 (like dwc3-exynos) to do some
 amount of runtime power management.
 
 Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
 Signed-off-by: Doug Anderson diand...@chromium.org
 ---
  drivers/usb/dwc3/core.c |4 +++-
  1 files changed, 3 insertions(+), 1 deletions(-)
 
 diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
 index 3a4004a..59c2494 100644
 --- a/drivers/usb/dwc3/core.c
 +++ b/drivers/usb/dwc3/core.c
 @@ -453,6 +453,7 @@ static int dwc3_probe(struct platform_device *pdev)
   if (of_get_property(node, tx-fifo-resize, NULL))
   dwc-needs_fifo_resize = true;
  
 + pm_runtime_set_active(dev);

this usage of pm_runtime_set_active() actually makes me a bit scared. At
least OMAP starts with the device switched off, so this will probably
break OMAP at least. OTOH, calling -runtime_resume() during probe()
might not make that much sense after all, but the way OMAP is
implemented, we won't get clocks turned on if this -runtime_resume()
method isn't called.

/me starts to wonder whether OMAP implementation is flakey and what
should be done here...

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH 3/4] usb: dwc3: exynos: Enable runtime power management

2013-01-28 Thread Felipe Balbi
On Mon, Jan 28, 2013 at 05:12:27PM +0530, Vivek Gautam wrote:
 Enabling runtime power management on dwc3-exynos to save
 power and allow its PHY's power to be managed at runtime.
 
 Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
 ---
  drivers/usb/dwc3/dwc3-exynos.c |   47 
 
  1 files changed, 47 insertions(+), 0 deletions(-)
 
 diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-exynos.c
 index aae5328..c51e8c1 100644
 --- a/drivers/usb/dwc3/dwc3-exynos.c
 +++ b/drivers/usb/dwc3/dwc3-exynos.c
 @@ -157,11 +157,15 @@ static int dwc3_exynos_probe(struct platform_device 
 *pdev)
   goto err4;
   }
  
 + pm_runtime_set_active(pdev-dev);
 + pm_runtime_enable(pdev-dev);
 +
   return 0;
  
  err4:
   clk_disable(clk);
   clk_put(clk);
 + pm_runtime_disable(pdev-dev);
  err3:
   platform_device_put(dwc3);
  err1:
 @@ -174,6 +178,8 @@ static int dwc3_exynos_remove(struct platform_device 
 *pdev)
  {
   struct dwc3_exynos  *exynos = platform_get_drvdata(pdev);
  
 + pm_runtime_disable(pdev-dev);
 +
   platform_device_unregister(exynos-dwc3);
   platform_device_unregister(exynos-usb2_phy);
   platform_device_unregister(exynos-usb3_phy);
 @@ -186,6 +192,46 @@ static int dwc3_exynos_remove(struct platform_device 
 *pdev)
   return 0;
  }
  
 +static int dwc3_exynos_runtime_suspend(struct device *dev)
 +{
 + struct dwc3_exynos  *exynos = dev_get_drvdata(dev);
 + struct platform_device  *pdev_dwc = exynos-dwc3;
 + struct dwc3 *dwc = NULL;
 +
 + dwc = platform_get_drvdata(pdev_dwc);
 +
 + if (!dwc)
 + return 0;
 +
 + pm_runtime_put_sync(dwc-usb3_phy-dev);
 +
 + clk_disable(exynos-clk);
 +
 + return 0;
 +}
 +static int dwc3_exynos_runtime_resume(struct device *dev)
 +{
 + struct dwc3_exynos  *exynos = dev_get_drvdata(dev);
 + struct platform_device  *pdev_dwc = exynos-dwc3;
 + struct dwc3 *dwc = NULL;
 +
 + dwc = platform_get_drvdata(pdev_dwc);
 +
 + clk_enable(exynos-clk);
 +
 + if (!dwc)
 + return 0;
 +
 + pm_runtime_get_sync(dwc-usb3_phy-dev);

dude, this is wrong :-)

look at this:

pm_runtime_get() - dwc3_exynos_runtime_resume() -
pm_runtime_get_sync() - dwc3_exynos_runtime_resume() - ...

only your clock enalbe should do

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH 3/4] usb: dwc3: exynos: Enable runtime power management

2013-01-28 Thread Vivek Gautam
Hi Balbi,


On Mon, Jan 28, 2013 at 5:17 PM, Felipe Balbi ba...@ti.com wrote:
 On Mon, Jan 28, 2013 at 05:12:27PM +0530, Vivek Gautam wrote:
 Enabling runtime power management on dwc3-exynos to save
 power and allow its PHY's power to be managed at runtime.

 Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
 ---
  drivers/usb/dwc3/dwc3-exynos.c |   47 
 
  1 files changed, 47 insertions(+), 0 deletions(-)

 diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-exynos.c
 index aae5328..c51e8c1 100644
 --- a/drivers/usb/dwc3/dwc3-exynos.c
 +++ b/drivers/usb/dwc3/dwc3-exynos.c
 @@ -157,11 +157,15 @@ static int dwc3_exynos_probe(struct platform_device 
 *pdev)
   goto err4;
   }

 + pm_runtime_set_active(pdev-dev);
 + pm_runtime_enable(pdev-dev);
 +
   return 0;

  err4:
   clk_disable(clk);
   clk_put(clk);
 + pm_runtime_disable(pdev-dev);
  err3:
   platform_device_put(dwc3);
  err1:
 @@ -174,6 +178,8 @@ static int dwc3_exynos_remove(struct platform_device 
 *pdev)
  {
   struct dwc3_exynos  *exynos = platform_get_drvdata(pdev);

 + pm_runtime_disable(pdev-dev);
 +
   platform_device_unregister(exynos-dwc3);
   platform_device_unregister(exynos-usb2_phy);
   platform_device_unregister(exynos-usb3_phy);
 @@ -186,6 +192,46 @@ static int dwc3_exynos_remove(struct platform_device 
 *pdev)
   return 0;
  }

 +static int dwc3_exynos_runtime_suspend(struct device *dev)
 +{
 + struct dwc3_exynos  *exynos = dev_get_drvdata(dev);
 + struct platform_device  *pdev_dwc = exynos-dwc3;
 + struct dwc3 *dwc = NULL;
 +
 + dwc = platform_get_drvdata(pdev_dwc);
 +
 + if (!dwc)
 + return 0;
 +
 + pm_runtime_put_sync(dwc-usb3_phy-dev);
 +
 + clk_disable(exynos-clk);
 +
 + return 0;
 +}
 +static int dwc3_exynos_runtime_resume(struct device *dev)
 +{
 + struct dwc3_exynos  *exynos = dev_get_drvdata(dev);
 + struct platform_device  *pdev_dwc = exynos-dwc3;
 + struct dwc3 *dwc = NULL;
 +
 + dwc = platform_get_drvdata(pdev_dwc);
 +
 + clk_enable(exynos-clk);
 +
 + if (!dwc)
 + return 0;
 +
 + pm_runtime_get_sync(dwc-usb3_phy-dev);

 dude, this is wrong :-)

 look at this:

 pm_runtime_get() - dwc3_exynos_runtime_resume() -
 pm_runtime_get_sync() - dwc3_exynos_runtime_resume() - ...

 only your clock enalbe should do


We want to wake up dwc-usb3_phy so tried to call pm_runtime_get_sync()
with dwc-usb3_phy-dev.
Missing something ? :-(




-- 
Thanks  Regards
Vivek
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 4/4] usb: phy: samsung: Enable runtime power management on samsung-usb3

2013-01-28 Thread Felipe Balbi
Hi,

On Mon, Jan 28, 2013 at 05:12:28PM +0530, Vivek Gautam wrote:
 Enabling runtime power management support on samsung-usb3 phy
 and further adding support to turn off the PHY ref_clk PLL.
 It thereby requires PHY ref_clk to be switched between internal
 core clock and external PLL clock.
 
 Signed-off-by: Vivek Gautam gautam.vi...@samsung.com

this needs to be broken down a bit. I can see three patches at least:
add support for external clock, add support for phy gpio powerdown and
add runtime pm ;-)

 ---
  drivers/usb/phy/samsung-usb3.c   |  107 +++--
  drivers/usb/phy/samsung-usbphy.c |   26 +
  drivers/usb/phy/samsung-usbphy.h |1 +
  3 files changed, 128 insertions(+), 6 deletions(-)
 
 diff --git a/drivers/usb/phy/samsung-usb3.c b/drivers/usb/phy/samsung-usb3.c
 index 29e1321..4dbef15 100644
 --- a/drivers/usb/phy/samsung-usb3.c
 +++ b/drivers/usb/phy/samsung-usb3.c
 @@ -22,8 +22,10 @@
  #include linux/clk.h
  #include linux/delay.h
  #include linux/err.h
 +#include linux/gpio.h
  #include linux/io.h
  #include linux/of.h
 +#include linux/pm_runtime.h
  #include linux/usb/samsung_usb_phy.h
  #include linux/platform_data/samsung-usbphy.h
  
 @@ -32,7 +34,7 @@
  /*
   * Sets the phy clk as EXTREFCLK (XXTI) which is internal clock from clock 
 core.
   */
 -static u32 samsung_usb3_phy_set_refclk(struct samsung_usbphy *sphy)
 +static u32 samsung_usb3_phy_set_refclk_int(struct samsung_usbphy *sphy)
  {
   u32 reg;
   u32 refclk;
 @@ -65,7 +67,22 @@ static u32 samsung_usb3_phy_set_refclk(struct 
 samsung_usbphy *sphy)
   return reg;
  }
  
 -static int samsung_exynos5_usb3_phy_enable(struct samsung_usbphy *sphy)
 +/*
 + * Sets the phy clk as ref_pad_clk (XusbXTI) which is clock from external 
 PLL.
 + */
 +static u32 samsung_usb3_phy_set_refclk_ext(void)
 +{
 + u32 reg;
 +
 + reg = PHYCLKRST_REFCLKSEL_PAD_REFCLK |
 + PHYCLKRST_FSEL_PAD_100MHZ |
 + PHYCLKRST_MPLL_MULTIPLIER_100MHZ_REF;
 +
 + return reg;
 +}

I wonder if you really need this small function (likewise for
set_refclk_int()). They don't do much, so you could just inline them on
the only caller.

 @@ -80,7 +97,11 @@ static int samsung_exynos5_usb3_phy_enable(struct 
 samsung_usbphy *sphy)
  
   phyparam0 = readl(regs + EXYNOS5_DRD_PHYPARAM0);
   /* Select PHY CLK source */
 - phyparam0 = ~PHYPARAM0_REF_USE_PAD;
 + if (use_ext_clk)
 + phyparam0 |= PHYPARAM0_REF_USE_PAD;
 + else
 + phyparam0 = ~PHYPARAM0_REF_USE_PAD;
 +
   /* Set Loss-of-Signal Detector sensitivity */
   phyparam0 = ~PHYPARAM0_REF_LOSLEVEL_MASK;
   phyparam0 |= PHYPARAM0_REF_LOSLEVEL;
 @@ -115,7 +136,10 @@ static int samsung_exynos5_usb3_phy_enable(struct 
 samsung_usbphy *sphy)
   /* UTMI Power Control */
   writel(PHYUTMI_OTGDISABLE, regs + EXYNOS5_DRD_PHYUTMI);
  
 - phyclkrst = samsung_usb3_phy_set_refclk(sphy);
 + if (use_ext_clk)
 + phyclkrst = samsung_usb3_phy_set_refclk_ext();
 + else
 + phyclkrst = samsung_usb3_phy_set_refclk_int(sphy);
  
   phyclkrst |= PHYCLKRST_PORTRESET |
   /* Digital power supply in normal operating mode */
 @@ -163,7 +187,7 @@ static void samsung_exynos5_usb3_phy_disable(struct 
 samsung_usbphy *sphy)
   writel(phytest, regs + EXYNOS5_DRD_PHYTEST);
  }
  
 -static int samsung_usb3_phy_init(struct usb_phy *phy)
 +static int samsung_exynos5_usb3_phy_init(struct usb_phy *phy, bool 
 use_ext_clk)
  {
   struct samsung_usbphy *sphy;
   unsigned long flags;
 @@ -187,7 +211,7 @@ static int samsung_usb3_phy_init(struct usb_phy *phy)
   samsung_usbphy_set_isolation(sphy, false);
  
   /* Initialize usb phy registers */
 - samsung_exynos5_usb3_phy_enable(sphy);
 + samsung_exynos5_usb3_phy_enable(sphy, use_ext_clk);
  
   spin_unlock_irqrestore(sphy-lock, flags);
  
 @@ -198,6 +222,34 @@ static int samsung_usb3_phy_init(struct usb_phy *phy)
  }
  
  /*
 + * Switch  between internal core clock and external oscillator clock
 + * for PHY reference clock
 + */
 +static int samsung_exynos5_usb3phy_clk_switch(struct usb_phy *phy,
 + bool use_ext_clk)
 +{
 + /*
 +  * This will switch PHY refclk from internal core clock
 +  * to external PLL clock when device is in use and vice versa
 +  * when device plunge into runtime suspend mode.
 +  */
 + return samsung_exynos5_usb3_phy_init(phy, use_ext_clk);
 +}
 +
 +/*
 + * The function passed to the usb driver for phy initialization
 + */
 +static int samsung_usb3_phy_init(struct usb_phy *phy)
 +{
 + /*
 +  * We start with using PHY refclk from external PLL,
 +  * once runtime suspend for the device is called this
 +  * will change to internal core clock
 +  */
 + return  samsung_exynos5_usb3_phy_init(phy, true);
 +}
 +
 +/*
   * The function passed to the usb driver for phy shutdown
   

Re: [PATCH 3/4] usb: dwc3: exynos: Enable runtime power management

2013-01-28 Thread Felipe Balbi
On Mon, Jan 28, 2013 at 05:57:04PM +0530, Vivek Gautam wrote:
 On Mon, Jan 28, 2013 at 5:42 PM, Felipe Balbi ba...@ti.com wrote:
  Hi,
 
  On Mon, Jan 28, 2013 at 05:28:30PM +0530, Vivek Gautam wrote:
   +static int dwc3_exynos_runtime_resume(struct device *dev)
   +{
   + struct dwc3_exynos  *exynos = dev_get_drvdata(dev);
   + struct platform_device  *pdev_dwc = exynos-dwc3;
   + struct dwc3 *dwc = NULL;
   +
   + dwc = platform_get_drvdata(pdev_dwc);
   +
   + clk_enable(exynos-clk);
   +
   + if (!dwc)
   + return 0;
   +
   + pm_runtime_get_sync(dwc-usb3_phy-dev);
  
   dude, this is wrong :-)
  
   look at this:
  
   pm_runtime_get() - dwc3_exynos_runtime_resume() -
   pm_runtime_get_sync() - dwc3_exynos_runtime_resume() - ...
  
   only your clock enalbe should do
  
 
  We want to wake up dwc-usb3_phy so tried to call pm_runtime_get_sync()
  with dwc-usb3_phy-dev.
  Missing something ? :-(
 
  oh, my bad. That's the PHY... But we can't really do that for samsung
  only. It needs to be done generically for the entire dwc3 core driver,
  and for that we need to introduce usb_phy_autopm_get(),
  usb_phy_autopm_get_sync() and friends.
 
 
 aah!! Ok. I definitely missed that part. :-(
 
  Then, from dwc_probe() we call:
 
  phy = usb_get_phy();
  usb_phy_autopm_enable(phy);
  usb_phy_autopm_get_sync(phy);
 
  or something similar ;-) Bottom line, you shouldn't fiddle with phy-dev
  directly.
 
 
 Ok, the core should actually be handling the 'phy' not the glue layers.
 Right ?

that's right, thanks for doing this ;-)

 Will try putting these helper functions in place and come up with a
 solution. :-)

awesome ;-)

cheers

-- 
balbi


signature.asc
Description: Digital signature


Endpoint flushing is not safe against URB removal

2013-01-28 Thread Anton Tikhomirov
Hello,

In drivers/usb/core/hcd.c: usb_hcd_flush_endpoint() uses
list_for_each_entry() to unlink URBs pending on
endpoint. At the same time unlink1() calls usb_rh_urb_dequeue()
where URB is removed from its endpoint queue:

void usb_hcd_unlink_urb_from_ep(struct usb_hcd *hcd, struct urb *urb)
{
/* clear all state linking urb to this dev (and hcd) */
spin_lock(hcd_urb_list_lock);
list_del_init(urb-urb_list);
spin_unlock(hcd_urb_list_lock);
}

Shall we use safe version of list_for_each_entry() for cancelling URBs?

Thanks.

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 4/4] usb: phy: samsung: Enable runtime power management on samsung-usb3

2013-01-28 Thread Felipe Balbi
Hi,

On Mon, Jan 28, 2013 at 06:34:15PM +0530, Vivek Gautam wrote:
  @@ -65,7 +67,22 @@ static u32 samsung_usb3_phy_set_refclk(struct 
  samsung_usbphy *sphy)
return reg;
   }
 
  -static int samsung_exynos5_usb3_phy_enable(struct samsung_usbphy *sphy)
  +/*
  + * Sets the phy clk as ref_pad_clk (XusbXTI) which is clock from external 
  PLL.
  + */
  +static u32 samsung_usb3_phy_set_refclk_ext(void)
  +{
  + u32 reg;
  +
  + reg = PHYCLKRST_REFCLKSEL_PAD_REFCLK |
  + PHYCLKRST_FSEL_PAD_100MHZ |
  + PHYCLKRST_MPLL_MULTIPLIER_100MHZ_REF;
  +
  + return reg;
  +}
 
  I wonder if you really need this small function (likewise for
  set_refclk_int()). They don't do much, so you could just inline them on
  the only caller.
 
 
 Created this just to keep symmetry, ;-)
 will move this in the caller only.

you can have a patch before this series moving the refclk_int() to the
caller, then you will have symmetry ;-)

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH 4/4] usb: phy: samsung: Enable runtime power management on samsung-usb3

2013-01-28 Thread Vivek Gautam
Hi Felipe,


On Mon, Jan 28, 2013 at 6:37 PM, Felipe Balbi ba...@ti.com wrote:
 Hi,

 On Mon, Jan 28, 2013 at 06:34:15PM +0530, Vivek Gautam wrote:
  @@ -65,7 +67,22 @@ static u32 samsung_usb3_phy_set_refclk(struct 
  samsung_usbphy *sphy)
return reg;
   }
 
  -static int samsung_exynos5_usb3_phy_enable(struct samsung_usbphy *sphy)
  +/*
  + * Sets the phy clk as ref_pad_clk (XusbXTI) which is clock from 
  external PLL.
  + */
  +static u32 samsung_usb3_phy_set_refclk_ext(void)
  +{
  + u32 reg;
  +
  + reg = PHYCLKRST_REFCLKSEL_PAD_REFCLK |
  + PHYCLKRST_FSEL_PAD_100MHZ |
  + PHYCLKRST_MPLL_MULTIPLIER_100MHZ_REF;
  +
  + return reg;
  +}
 
  I wonder if you really need this small function (likewise for
  set_refclk_int()). They don't do much, so you could just inline them on
  the only caller.
 

 Created this just to keep symmetry, ;-)
 will move this in the caller only.

 you can have a patch before this series moving the refclk_int() to the
 caller, then you will have symmetry ;-)


refclk_int() was rather slightly a big chunk :-(
as available in below patch as samsung_usb3_phy_set_refclk() :
[PATCH v4 2/2] usb: phy: samsung: Add PHY support for USB 3.0 controller
http://www.mail-archive.com/linux-usb@vger.kernel.org/msg13796.html

Will try to figure best possible way and amend.


-- 
Thanks  Regards
Vivek
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 4/4] usb: phy: samsung: Enable runtime power management on samsung-usb3

2013-01-28 Thread Felipe Balbi
On Mon, Jan 28, 2013 at 06:54:42PM +0530, Vivek Gautam wrote:
 Hi Felipe,
 
 
 On Mon, Jan 28, 2013 at 6:37 PM, Felipe Balbi ba...@ti.com wrote:
  Hi,
 
  On Mon, Jan 28, 2013 at 06:34:15PM +0530, Vivek Gautam wrote:
   @@ -65,7 +67,22 @@ static u32 samsung_usb3_phy_set_refclk(struct 
   samsung_usbphy *sphy)
 return reg;
}
  
   -static int samsung_exynos5_usb3_phy_enable(struct samsung_usbphy *sphy)
   +/*
   + * Sets the phy clk as ref_pad_clk (XusbXTI) which is clock from 
   external PLL.
   + */
   +static u32 samsung_usb3_phy_set_refclk_ext(void)
   +{
   + u32 reg;
   +
   + reg = PHYCLKRST_REFCLKSEL_PAD_REFCLK |
   + PHYCLKRST_FSEL_PAD_100MHZ |
   + PHYCLKRST_MPLL_MULTIPLIER_100MHZ_REF;
   +
   + return reg;
   +}
  
   I wonder if you really need this small function (likewise for
   set_refclk_int()). They don't do much, so you could just inline them on
   the only caller.
  
 
  Created this just to keep symmetry, ;-)
  will move this in the caller only.
 
  you can have a patch before this series moving the refclk_int() to the
  caller, then you will have symmetry ;-)
 
 
 refclk_int() was rather slightly a big chunk :-(
 as available in below patch as samsung_usb3_phy_set_refclk() :
 [PATCH v4 2/2] usb: phy: samsung: Add PHY support for USB 3.0 controller
 http://www.mail-archive.com/linux-usb@vger.kernel.org/msg13796.html
 
 Will try to figure best possible way and amend.

oh, right... In that case, keep the way it is. Ignore my comment ;-)

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH 09/30] USB: ehci-omap: Use devm_request_and_ioremap()

2013-01-28 Thread Alan Stern
On Mon, 28 Jan 2013, Roger Quadros wrote:

 Make use of devm_request_and_ioremap() and correct comment.

Didn't a big patch come through recently converting all usages of 
devm_request_and_ioremap() to another function (I forget the name) that 
does its own error reporting and returns an ERR_PTR value?

(Checks the mailing list archive...)  Ah, here it is:

http://marc.info/?l=linux-usbm=135876311801537w=2

And the new function is devm_ioremap_resource().  We should avoid 
adding new usages of an old interface.

Alan Stern

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 09/30] USB: ehci-omap: Use devm_request_and_ioremap()

2013-01-28 Thread Russell King - ARM Linux
On Mon, Jan 28, 2013 at 10:17:33AM -0500, Alan Stern wrote:
 On Mon, 28 Jan 2013, Roger Quadros wrote:
 
  Make use of devm_request_and_ioremap() and correct comment.
 
 Didn't a big patch come through recently converting all usages of 
 devm_request_and_ioremap() to another function (I forget the name) that 
 does its own error reporting and returns an ERR_PTR value?
 
 (Checks the mailing list archive...)  Ah, here it is:
 
   http://marc.info/?l=linux-usbm=135876311801537w=2
 
 And the new function is devm_ioremap_resource().  We should avoid 
 adding new usages of an old interface.

Maybe... if devm_ioremap_resource() was already in the kernel.  The
problem at the moment is it isn't, and it'll probably be rather
horrid for everyone to deal with especially when it comes to testing.
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Endpoint flushing is not safe against URB removal

2013-01-28 Thread Alan Stern
On Mon, 28 Jan 2013, Anton Tikhomirov wrote:

 Hello,
 
 In drivers/usb/core/hcd.c: usb_hcd_flush_endpoint() uses
 list_for_each_entry() to unlink URBs pending on
 endpoint. At the same time unlink1() calls usb_rh_urb_dequeue()
 where URB is removed from its endpoint queue:
 
 void usb_hcd_unlink_urb_from_ep(struct usb_hcd *hcd, struct urb *urb)
 {
   /* clear all state linking urb to this dev (and hcd) */
   spin_lock(hcd_urb_list_lock);
   list_del_init(urb-urb_list);
   spin_unlock(hcd_urb_list_lock);
 }
 
 Shall we use safe version of list_for_each_entry() for cancelling URBs?

No.  Read usb_hcd_flush_endpoint() more closely.  After calling 
unlink1() it restarts the loop from the beginning.

Alan Stern

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/8] usb: gadget: convert to usb_gadget_map/unmap_request()

2013-01-28 Thread Felipe Balbi
Hi folks,

we have generic implementations for a reason, right ?

This patchset converts a few more of the UDC drivers to
use the generic usb_gadget_map/unmap_request() calls.

After this series, only the following UDC drivers are
offending:

drivers/usb/gadget/fsl_qe_udc.c
drivers/usb/gadget/mv_u3d_core.c
drivers/usb/gadget/mv_udc_core.c
drivers/usb/gadget/pch_udc.c

Plan to fix those out because I looked at them and just
lost my will to live.

cheers

Felipe Balbi (8):
  usb: gadget: s3c-hsotg: switch over to usb_gadget_map/unmap_request()
  usb: gadget: amd5536udc: remove unused structure member
  usb: gadget: atmel_usba_udc: switch over to
usb_gadget_map/unmap_request()
  usb: gadget: fsl_udc_core: switch over to
usb_gadget_map/unmap_request()
  usb: gadget: fusb300: switch over to usb_gadget_map/unmap_request()
  usb: gadget: lpc32xx_udc: switch over to
usb_gadget_map/unmap_request()
  usb: gadget: mv_udc_core: switch over to
usb_gadget_map/unmap_request()
  usb: musb: gadget: switch over to usb_gadget_map/unmap_request()

 drivers/usb/gadget/amd5536udc.h |   1 -
 drivers/usb/gadget/atmel_usba_udc.c |  27 ++
 drivers/usb/gadget/fsl_udc_core.c   |  51 +++-
 drivers/usb/gadget/fusb300_udc.c|  17 ++--
 drivers/usb/gadget/lpc32xx_udc.c|  39 +
 drivers/usb/gadget/mv_udc_core.c|  53 ++--
 drivers/usb/gadget/s3c-hsotg.c  |  46 ++-
 drivers/usb/musb/musb_gadget.c  | 158 
 8 files changed, 94 insertions(+), 298 deletions(-)

-- 
1.8.1.rc1.5.g7e0651a

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/8] usb: gadget: s3c-hsotg: switch over to usb_gadget_map/unmap_request()

2013-01-28 Thread Felipe Balbi
we have generic implementations for a reason,
let's use them.

Signed-off-by: Felipe Balbi ba...@ti.com
---
 drivers/usb/gadget/s3c-hsotg.c | 46 +-
 1 file changed, 5 insertions(+), 41 deletions(-)

diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c
index 361889e..bf43e33 100644
--- a/drivers/usb/gadget/s3c-hsotg.c
+++ b/drivers/usb/gadget/s3c-hsotg.c
@@ -38,8 +38,6 @@
 
 #include s3c-hsotg.h
 
-#define DMA_ADDR_INVALID (~((dma_addr_t)0))
-
 static const char * const s3c_hsotg_supply_names[] = {
vusb_d,   /* digital USB supply, 1.2V */
vusb_a,   /* analog USB supply, 1.1V */
@@ -401,7 +399,6 @@ static struct usb_request 
*s3c_hsotg_ep_alloc_request(struct usb_ep *ep,
 
INIT_LIST_HEAD(req-queue);
 
-   req-req.dma = DMA_ADDR_INVALID;
return req-req;
 }
 
@@ -431,24 +428,12 @@ static void s3c_hsotg_unmap_dma(struct s3c_hsotg *hsotg,
struct s3c_hsotg_req *hs_req)
 {
struct usb_request *req = hs_req-req;
-   enum dma_data_direction dir;
-
-   dir = hs_ep-dir_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE;
 
/* ignore this if we're not moving any data */
if (hs_req-req.length == 0)
return;
 
-   if (hs_req-mapped) {
-   /* we mapped this, so unmap and remove the dma */
-
-   dma_unmap_single(hsotg-dev, req-dma, req-length, dir);
-
-   req-dma = DMA_ADDR_INVALID;
-   hs_req-mapped = 0;
-   } else {
-   dma_sync_single_for_cpu(hsotg-dev, req-dma, req-length, dir);
-   }
+   usb_gadget_unmap_request(hsotg-gadget, hs_req, hs_ep-dir_in);
 }
 
 /**
@@ -848,37 +833,16 @@ static int s3c_hsotg_map_dma(struct s3c_hsotg *hsotg,
 struct s3c_hsotg_ep *hs_ep,
 struct usb_request *req)
 {
-   enum dma_data_direction dir;
struct s3c_hsotg_req *hs_req = our_req(req);
-
-   dir = hs_ep-dir_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE;
+   int ret;
 
/* if the length is zero, ignore the DMA data */
if (hs_req-req.length == 0)
return 0;
 
-   if (req-dma == DMA_ADDR_INVALID) {
-   dma_addr_t dma;
-
-   dma = dma_map_single(hsotg-dev, req-buf, req-length, dir);
-
-   if (unlikely(dma_mapping_error(hsotg-dev, dma)))
-   goto dma_error;
-
-   if (dma  3) {
-   dev_err(hsotg-dev, %s: unaligned dma buffer\n,
-   __func__);
-
-   dma_unmap_single(hsotg-dev, dma, req-length, dir);
-   return -EINVAL;
-   }
-
-   hs_req-mapped = 1;
-   req-dma = dma;
-   } else {
-   dma_sync_single_for_cpu(hsotg-dev, req-dma, req-length, dir);
-   hs_req-mapped = 0;
-   }
+   ret = usb_gadget_map_request(hsotg-gadget, req, hs_ep-dir_in);
+   if (ret)
+   goto dma_error;
 
return 0;
 
-- 
1.8.1.rc1.5.g7e0651a

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/8] usb: gadget: amd5536udc: remove unused structure member

2013-01-28 Thread Felipe Balbi
that member isn't used anywhere in the driver
and be removed with no mercy.

Signed-off-by: Felipe Balbi ba...@ti.com
---
 drivers/usb/gadget/amd5536udc.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/usb/gadget/amd5536udc.h b/drivers/usb/gadget/amd5536udc.h
index f1bf32e..6744d3b 100644
--- a/drivers/usb/gadget/amd5536udc.h
+++ b/drivers/usb/gadget/amd5536udc.h
@@ -472,7 +472,6 @@ struct udc_request {
 
/* flags */
unsigneddma_going : 1,
-   dma_mapping : 1,
dma_done : 1;
/* phys. address */
dma_addr_t  td_phys;
-- 
1.8.1.rc1.5.g7e0651a

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/8] usb: gadget: atmel_usba_udc: switch over to usb_gadget_map/unmap_request()

2013-01-28 Thread Felipe Balbi
we have generic implementations for a reason,
let's use them.

Signed-off-by: Felipe Balbi ba...@ti.com
---
 drivers/usb/gadget/atmel_usba_udc.c | 27 ++-
 1 file changed, 6 insertions(+), 21 deletions(-)

diff --git a/drivers/usb/gadget/atmel_usba_udc.c 
b/drivers/usb/gadget/atmel_usba_udc.c
index b197b75..f8dc644 100644
--- a/drivers/usb/gadget/atmel_usba_udc.c
+++ b/drivers/usb/gadget/atmel_usba_udc.c
@@ -489,13 +489,8 @@ request_complete(struct usba_ep *ep, struct usba_request 
*req, int status)
if (req-req.status == -EINPROGRESS)
req-req.status = status;
 
-   if (req-mapped) {
-   dma_unmap_single(
-   udc-pdev-dev, req-req.dma, req-req.length,
-   ep-is_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE);
-   req-req.dma = DMA_ADDR_INVALID;
-   req-mapped = 0;
-   }
+   if (req-using_dma)
+   usb_gadget_unmap_request(udc-gadget, req-req, ep-is_in);
 
DBG(DBG_GADGET | DBG_REQ,
%s: req %p complete: status %d, actual %u\n,
@@ -684,7 +679,6 @@ usba_ep_alloc_request(struct usb_ep *_ep, gfp_t gfp_flags)
return NULL;
 
INIT_LIST_HEAD(req-queue);
-   req-req.dma = DMA_ADDR_INVALID;
 
return req-req;
 }
@@ -717,20 +711,11 @@ static int queue_dma(struct usba_udc *udc, struct usba_ep 
*ep,
return -EINVAL;
}
 
-   req-using_dma = 1;
-
-   if (req-req.dma == DMA_ADDR_INVALID) {
-   req-req.dma = dma_map_single(
-   udc-pdev-dev, req-req.buf, req-req.length,
-   ep-is_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE);
-   req-mapped = 1;
-   } else {
-   dma_sync_single_for_device(
-   udc-pdev-dev, req-req.dma, req-req.length,
-   ep-is_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE);
-   req-mapped = 0;
-   }
+   ret = usb_gadget_map_request(udc-gadget, req-req, ep-is_in);
+   if (ret)
+   return ret;
 
+   req-using_dma = 1;
req-ctrl = USBA_BF(DMA_BUF_LEN, req-req.length)
| USBA_DMA_CH_EN | USBA_DMA_END_BUF_IE
| USBA_DMA_END_TR_EN | USBA_DMA_END_TR_IE;
-- 
1.8.1.rc1.5.g7e0651a

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/8] usb: gadget: fsl_udc_core: switch over to usb_gadget_map/unmap_request()

2013-01-28 Thread Felipe Balbi
we have generic implementations for a reason,
let's use them

Signed-off-by: Felipe Balbi ba...@ti.com
---
 drivers/usb/gadget/fsl_udc_core.c | 51 ++-
 1 file changed, 13 insertions(+), 38 deletions(-)

diff --git a/drivers/usb/gadget/fsl_udc_core.c 
b/drivers/usb/gadget/fsl_udc_core.c
index e09ae774..e94dd49 100644
--- a/drivers/usb/gadget/fsl_udc_core.c
+++ b/drivers/usb/gadget/fsl_udc_core.c
@@ -184,20 +184,7 @@ static void done(struct fsl_ep *ep, struct fsl_req *req, 
int status)
dma_pool_free(udc-td_pool, curr_td, curr_td-td_dma);
}
 
-   if (req-mapped) {
-   dma_unmap_single(ep-udc-gadget.dev.parent,
-   req-req.dma, req-req.length,
-   ep_is_in(ep)
-   ? DMA_TO_DEVICE
-   : DMA_FROM_DEVICE);
-   req-req.dma = DMA_ADDR_INVALID;
-   req-mapped = 0;
-   } else
-   dma_sync_single_for_cpu(ep-udc-gadget.dev.parent,
-   req-req.dma, req-req.length,
-   ep_is_in(ep)
-   ? DMA_TO_DEVICE
-   : DMA_FROM_DEVICE);
+   usb_gadget_unmap_request(ep-udc-gadget, req-req, ep_is_in(ep));
 
if (status  (status != -ESHUTDOWN))
VDBG(complete %s req %p stat %d len %u/%u,
@@ -887,6 +874,7 @@ fsl_ep_queue(struct usb_ep *_ep, struct usb_request *_req, 
gfp_t gfp_flags)
struct fsl_req *req = container_of(_req, struct fsl_req, req);
struct fsl_udc *udc;
unsigned long flags;
+   int ret;
 
/* catch various bogus parameters */
if (!_req || !req-req.complete || !req-req.buf
@@ -909,22 +897,9 @@ fsl_ep_queue(struct usb_ep *_ep, struct usb_request *_req, 
gfp_t gfp_flags)
 
req-ep = ep;
 
-   /* map virtual address to hardware */
-   if (req-req.dma == DMA_ADDR_INVALID) {
-   req-req.dma = dma_map_single(ep-udc-gadget.dev.parent,
-   req-req.buf,
-   req-req.length, ep_is_in(ep)
-   ? DMA_TO_DEVICE
-   : DMA_FROM_DEVICE);
-   req-mapped = 1;
-   } else {
-   dma_sync_single_for_device(ep-udc-gadget.dev.parent,
-   req-req.dma, req-req.length,
-   ep_is_in(ep)
-   ? DMA_TO_DEVICE
-   : DMA_FROM_DEVICE);
-   req-mapped = 0;
-   }
+   ret = usb_gadget_map_request(ep-udc-gadget, req-req, ep_is_in(ep));
+   if (ret)
+   return ret;
 
req-req.status = -EINPROGRESS;
req-req.actual = 0;
@@ -1289,6 +1264,7 @@ static int ep0_prime_status(struct fsl_udc *udc, int 
direction)
 {
struct fsl_req *req = udc-status_req;
struct fsl_ep *ep;
+   int ret;
 
if (direction == EP_DIR_IN)
udc-ep0_dir = USB_DIR_IN;
@@ -1306,10 +1282,9 @@ static int ep0_prime_status(struct fsl_udc *udc, int 
direction)
req-req.complete = NULL;
req-dtd_count = 0;
 
-   req-req.dma = dma_map_single(ep-udc-gadget.dev.parent,
-   req-req.buf, req-req.length,
-   ep_is_in(ep) ? DMA_TO_DEVICE : DMA_FROM_DEVICE);
-   req-mapped = 1;
+   ret = usb_gadget_map_request(ep-udc-gadget, req-req, ep_is_in(ep));
+   if (ret)
+   return ret;
 
if (fsl_req_to_dtd(req, GFP_ATOMIC) == 0)
fsl_queue_td(ep, req);
@@ -1352,6 +1327,7 @@ static void ch9getstatus(struct fsl_udc *udc, u8 
request_type, u16 value,
u16 tmp = 0;/* Status, cpu endian */
struct fsl_req *req;
struct fsl_ep *ep;
+   int ret;
 
ep = udc-eps[0];
 
@@ -1389,10 +1365,9 @@ static void ch9getstatus(struct fsl_udc *udc, u8 
request_type, u16 value,
req-req.complete = NULL;
req-dtd_count = 0;
 
-   req-req.dma = dma_map_single(ep-udc-gadget.dev.parent,
-   req-req.buf, req-req.length,
-   ep_is_in(ep) ? DMA_TO_DEVICE : DMA_FROM_DEVICE);
-   req-mapped = 1;
+   ret = usb_gadget_map_request(ep-udc-gadget, req-req, ep_is_in(ep));
+   if (ret)
+   goto stall;
 
/* prime the data phase */
if ((fsl_req_to_dtd(req, GFP_ATOMIC) == 0))
-- 
1.8.1.rc1.5.g7e0651a

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/8] usb: gadget: fusb300: switch over to usb_gadget_map/unmap_request()

2013-01-28 Thread Felipe Balbi
we have generic implementations for a reason,
let's use them

Signed-off-by: Felipe Balbi ba...@ti.com
---
 drivers/usb/gadget/fusb300_udc.c | 17 +++--
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/drivers/usb/gadget/fusb300_udc.c b/drivers/usb/gadget/fusb300_udc.c
index bf51625..f62568c 100644
--- a/drivers/usb/gadget/fusb300_udc.c
+++ b/drivers/usb/gadget/fusb300_udc.c
@@ -938,25 +938,22 @@ IDMA_RESET:
 static void  fusb300_set_idma(struct fusb300_ep *ep,
struct fusb300_request *req)
 {
-   dma_addr_t d;
+   int ret;
 
-   d = dma_map_single(NULL, req-req.buf, req-req.length, DMA_TO_DEVICE);
-
-   if (dma_mapping_error(NULL, d)) {
-   printk(KERN_DEBUG dma_mapping_error\n);
+   ret = usb_gadget_map_request(ep-fusb300-gadget,
+   req-req, DMA_TO_DEVICE);
+   if (ret)
return;
-   }
-
-   dma_sync_single_for_device(NULL, d, req-req.length, DMA_TO_DEVICE);
 
fusb300_enable_bit(ep-fusb300, FUSB300_OFFSET_IGER0,
FUSB300_IGER0_EEPn_PRD_INT(ep-epnum));
 
-   fusb300_fill_idma_prdtbl(ep, d, req-req.length);
+   fusb300_fill_idma_prdtbl(ep, req-req.dma, req-req.length);
/* check idma is done */
fusb300_wait_idma_finished(ep);
 
-   dma_unmap_single(NULL, d, req-req.length, DMA_TO_DEVICE);
+   usb_gadget_unmap_request(ep-fusb300-gadget,
+   req-req, DMA_TO_DEVICE);
 }
 
 static void in_ep_fifo_handler(struct fusb300_ep *ep)
-- 
1.8.1.rc1.5.g7e0651a

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 6/8] usb: gadget: lpc32xx_udc: switch over to usb_gadget_map/unmap_request()

2013-01-28 Thread Felipe Balbi
we have generic implementations for a reason,
let's use them

Signed-off-by: Felipe Balbi ba...@ti.com
---
 drivers/usb/gadget/lpc32xx_udc.c | 39 ---
 1 file changed, 4 insertions(+), 35 deletions(-)

diff --git a/drivers/usb/gadget/lpc32xx_udc.c b/drivers/usb/gadget/lpc32xx_udc.c
index 0ad78cd..5264c27 100644
--- a/drivers/usb/gadget/lpc32xx_udc.c
+++ b/drivers/usb/gadget/lpc32xx_udc.c
@@ -1469,23 +1469,7 @@ static void done(struct lpc32xx_ep *ep, struct 
lpc32xx_request *req, int status)
status = req-req.status;
 
if (ep-lep) {
-   enum dma_data_direction direction;
-
-   if (ep-is_in)
-   direction = DMA_TO_DEVICE;
-   else
-   direction = DMA_FROM_DEVICE;
-
-   if (req-mapped) {
-   dma_unmap_single(ep-udc-gadget.dev.parent,
-   req-req.dma, req-req.length,
-   direction);
-   req-req.dma = 0;
-   req-mapped = 0;
-   } else
-   dma_sync_single_for_cpu(ep-udc-gadget.dev.parent,
-   req-req.dma, req-req.length,
-   direction);
+   usb_gadget_unmap_request(udc-gadget, req-req, ep-is_in);
 
/* Free DDs */
udc_dd_free(udc, req-dd_desc_ptr);
@@ -1841,26 +1825,11 @@ static int lpc32xx_ep_queue(struct usb_ep *_ep,
}
 
if (ep-lep) {
-   enum dma_data_direction direction;
struct lpc32xx_usbd_dd_gad *dd;
 
-   /* Map DMA pointer */
-   if (ep-is_in)
-   direction = DMA_TO_DEVICE;
-   else
-   direction = DMA_FROM_DEVICE;
-
-   if (req-req.dma == 0) {
-   req-req.dma = dma_map_single(
-   ep-udc-gadget.dev.parent,
-   req-req.buf, req-req.length, direction);
-   req-mapped = 1;
-   } else {
-   dma_sync_single_for_device(
-   ep-udc-gadget.dev.parent, req-req.dma,
-   req-req.length, direction);
-   req-mapped = 0;
-   }
+   status = usb_gadget_map_request(udc-gadget, _req, ep-is_in);
+   if (status)
+   return status;
 
/* For the request, build a list of DDs */
dd = udc_dd_alloc(udc);
-- 
1.8.1.rc1.5.g7e0651a

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 7/8] usb: gadget: mv_udc_core: switch over to usb_gadget_map/unmap_request()

2013-01-28 Thread Felipe Balbi
we have generic implementations for a reason,
let's use them

Signed-off-by: Felipe Balbi ba...@ti.com
---
 drivers/usb/gadget/mv_udc_core.c | 53 +---
 1 file changed, 6 insertions(+), 47 deletions(-)

diff --git a/drivers/usb/gadget/mv_udc_core.c b/drivers/usb/gadget/mv_udc_core.c
index 73b90f9..e451dd3 100644
--- a/drivers/usb/gadget/mv_udc_core.c
+++ b/drivers/usb/gadget/mv_udc_core.c
@@ -237,18 +237,7 @@ static void done(struct mv_ep *ep, struct mv_req *req, int 
status)
dma_pool_free(udc-dtd_pool, curr_td, curr_td-td_dma);
}
 
-   if (req-mapped) {
-   dma_unmap_single(ep-udc-gadget.dev.parent,
-   req-req.dma, req-req.length,
-   ((ep_dir(ep) == EP_DIR_IN) ?
-   DMA_TO_DEVICE : DMA_FROM_DEVICE));
-   req-req.dma = DMA_ADDR_INVALID;
-   req-mapped = 0;
-   } else
-   dma_sync_single_for_cpu(ep-udc-gadget.dev.parent,
-   req-req.dma, req-req.length,
-   ((ep_dir(ep) == EP_DIR_IN) ?
-   DMA_TO_DEVICE : DMA_FROM_DEVICE));
+   usb_gadget_unmap_request(udc-gadget, req-req, ep_dir(ep));
 
if (status  (status != -ESHUTDOWN))
dev_info(udc-dev-dev, complete %s req %p stat %d len %u/%u,
@@ -732,21 +721,9 @@ mv_ep_queue(struct usb_ep *_ep, struct usb_request *_req, 
gfp_t gfp_flags)
req-ep = ep;
 
/* map virtual address to hardware */
-   if (req-req.dma == DMA_ADDR_INVALID) {
-   req-req.dma = dma_map_single(ep-udc-gadget.dev.parent,
-   req-req.buf,
-   req-req.length, ep_dir(ep)
-   ? DMA_TO_DEVICE
-   : DMA_FROM_DEVICE);
-   req-mapped = 1;
-   } else {
-   dma_sync_single_for_device(ep-udc-gadget.dev.parent,
-   req-req.dma, req-req.length,
-   ep_dir(ep)
-   ? DMA_TO_DEVICE
-   : DMA_FROM_DEVICE);
-   req-mapped = 0;
-   }
+   retval = usb_gadget_map_request(udc-gadget, _req, ep_dir(ep));
+   if (retval)
+   return retval;
 
req-req.status = -EINPROGRESS;
req-req.actual = 0;
@@ -780,18 +757,7 @@ mv_ep_queue(struct usb_ep *_ep, struct usb_request *_req, 
gfp_t gfp_flags)
return 0;
 
 err_unmap_dma:
-   if (req-mapped) {
-   dma_unmap_single(ep-udc-gadget.dev.parent,
-   req-req.dma, req-req.length,
-   ((ep_dir(ep) == EP_DIR_IN) ?
-   DMA_TO_DEVICE : DMA_FROM_DEVICE));
-   req-req.dma = DMA_ADDR_INVALID;
-   req-mapped = 0;
-   } else
-   dma_sync_single_for_cpu(ep-udc-gadget.dev.parent,
-   req-req.dma, req-req.length,
-   ((ep_dir(ep) == EP_DIR_IN) ?
-   DMA_TO_DEVICE : DMA_FROM_DEVICE));
+   usb_gadget_unmap_request(udc-gadget, _req, ep_dir(ep));
 
return retval;
 }
@@ -1528,14 +1494,7 @@ udc_prime_status(struct mv_udc *udc, u8 direction, u16 
status, bool empty)
 
return 0;
 out:
-   if (req-mapped) {
-   dma_unmap_single(ep-udc-gadget.dev.parent,
-   req-req.dma, req-req.length,
-   ((ep_dir(ep) == EP_DIR_IN) ?
-   DMA_TO_DEVICE : DMA_FROM_DEVICE));
-   req-req.dma = DMA_ADDR_INVALID;
-   req-mapped = 0;
-   }
+   usb_gadget_unmap_request(udc-gadget, req-req, ep_dir(ep));
 
return retval;
 }
-- 
1.8.1.rc1.5.g7e0651a

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 8/8] usb: musb: gadget: switch over to usb_gadget_map/unmap_request()

2013-01-28 Thread Felipe Balbi
we have generic implementations for a reason,
let's use them

Signed-off-by: Felipe Balbi ba...@ti.com
---
 drivers/usb/musb/musb_gadget.c | 158 ++---
 1 file changed, 53 insertions(+), 105 deletions(-)

diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index af88e27..9a67f2a 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -90,9 +90,6 @@
 
 /* --- */
 
-#define is_buffer_mapped(req) (is_dma_capable()  \
-   (req-map_state != UN_MAPPED))
-
 /* Maps the buffer to dma  */
 
 static inline void map_dma_buffer(struct musb_request *request,
@@ -101,8 +98,6 @@ static inline void map_dma_buffer(struct musb_request 
*request,
int compatible = true;
struct dma_controller *dma = musb-dma_controller;
 
-   request-map_state = UN_MAPPED;
-
if (!is_dma_capable() || !musb_ep-dma)
return;
 
@@ -117,55 +112,14 @@ static inline void map_dma_buffer(struct musb_request 
*request,
if (!compatible)
return;
 
-   if (request-request.dma == DMA_ADDR_INVALID) {
-   request-request.dma = dma_map_single(
-   musb-controller,
-   request-request.buf,
-   request-request.length,
-   request-tx
-   ? DMA_TO_DEVICE
-   : DMA_FROM_DEVICE);
-   request-map_state = MUSB_MAPPED;
-   } else {
-   dma_sync_single_for_device(musb-controller,
-   request-request.dma,
-   request-request.length,
-   request-tx
-   ? DMA_TO_DEVICE
-   : DMA_FROM_DEVICE);
-   request-map_state = PRE_MAPPED;
-   }
+   (void) usb_gadget_map_request(musb-g, request-request, request-tx);
 }
 
 /* Unmap the buffer from dma and maps it back to cpu */
 static inline void unmap_dma_buffer(struct musb_request *request,
struct musb *musb)
 {
-   if (!is_buffer_mapped(request))
-   return;
-
-   if (request-request.dma == DMA_ADDR_INVALID) {
-   dev_vdbg(musb-controller,
-   not unmapping a never mapped buffer\n);
-   return;
-   }
-   if (request-map_state == MUSB_MAPPED) {
-   dma_unmap_single(musb-controller,
-   request-request.dma,
-   request-request.length,
-   request-tx
-   ? DMA_TO_DEVICE
-   : DMA_FROM_DEVICE);
-   request-request.dma = DMA_ADDR_INVALID;
-   } else { /* PRE_MAPPED */
-   dma_sync_single_for_cpu(musb-controller,
-   request-request.dma,
-   request-request.length,
-   request-tx
-   ? DMA_TO_DEVICE
-   : DMA_FROM_DEVICE);
-   }
-   request-map_state = UN_MAPPED;
+   usb_gadget_unmap_request(musb-g, request-request, request-tx);
 }
 
 /*
@@ -365,7 +319,7 @@ static void txstate(struct musb *musb, struct musb_request 
*req)
csr);
 
 #ifndefCONFIG_MUSB_PIO_ONLY
-   if (is_buffer_mapped(req)) {
+   {
struct dma_controller   *c = musb-dma_controller;
size_t request_size;
 
@@ -676,7 +630,7 @@ static void rxstate(struct musb *musb, struct musb_request 
*req)
return;
}
 
-   if (is_cppi_enabled()  is_buffer_mapped(req)) {
+   if (is_cppi_enabled()) {
struct dma_controller   *c = musb-dma_controller;
struct dma_channel  *channel = musb_ep-dma;
 
@@ -719,14 +673,13 @@ static void rxstate(struct musb *musb, struct 
musb_request *req)
 
if (request-actual  request-length) {
 #ifdef CONFIG_USB_INVENTRA_DMA
-   if (is_buffer_mapped(req)) {
-   struct dma_controller   *c;
-   struct dma_channel  *channel;
-   int use_dma = 0;
-   int transfer_size;
+   struct dma_controller   *c;
+   struct dma_channel  *channel;
+   int use_dma = 0;
+   int transfer_size;
 
-   c = musb-dma_controller;
-   channel = musb_ep-dma;
+   c = musb-dma_controller;
+   channel = musb_ep-dma;
 
/* We use DMA Req mode 0 in rx_csr, and DMA controller operates in
  

[PATCH 1/1] USB: qcserial: add Telit Gobi QDL device

2013-01-28 Thread Daniele Palmas
Add VID and PID for Telit Gobi QDL device

Signed-off-by: Daniele Palmas dnl...@gmail.com
---
 drivers/usb/serial/qcserial.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c
index aa148c2..2466254 100644
--- a/drivers/usb/serial/qcserial.c
+++ b/drivers/usb/serial/qcserial.c
@@ -53,6 +53,7 @@ static const struct usb_device_id id_table[] = {
{DEVICE_G1K(0x05c6, 0x9221)},   /* Generic Gobi QDL device */
{DEVICE_G1K(0x05c6, 0x9231)},   /* Generic Gobi QDL device */
{DEVICE_G1K(0x1f45, 0x0001)},   /* Unknown Gobi QDL device */
+   {DEVICE_G1K(0x1bc7, 0x900e)},   /* Telit Gobi QDL device */
 
/* Gobi 2000 devices */
{USB_DEVICE(0x1410, 0xa010)},   /* Novatel Gobi 2000 QDL device */
-- 
1.7.4.1

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/1] USB: option: add support for Telit LE920

2013-01-28 Thread Daniele Palmas
From: danielepa danielepa@L2011.(none)

Add PID and special handling for Telit LE920

Signed-off-by: Daniele Palmas dnl...@gmail.com
---
 drivers/usb/serial/option.c |8 
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 0d9dac9..384bb92 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -242,6 +242,7 @@ static void option_instat_callback(struct urb *urb);
 #define TELIT_PRODUCT_CC864_DUAL   0x1005
 #define TELIT_PRODUCT_CC864_SINGLE 0x1006
 #define TELIT_PRODUCT_DE910_DUAL   0x1010
+#define TELIT_PRODUCT_LE9200x1200
 
 /* ZTE PRODUCTS */
 #define ZTE_VENDOR_ID  0x19d2
@@ -534,6 +535,11 @@ static const struct option_blacklist_info 
zte_1255_blacklist = {
.reserved = BIT(3) | BIT(4),
 };
 
+static const struct option_blacklist_info telit_le920_blacklist = {
+   .sendsetup = BIT(0),
+   .reserved = BIT(1) | BIT(5),
+};
+
 static const struct usb_device_id option_ids[] = {
{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },
{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) },
@@ -784,6 +790,8 @@ static const struct usb_device_id option_ids[] = {
{ USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_CC864_DUAL) },
{ USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_CC864_SINGLE) },
{ USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_DE910_DUAL) },
+   { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920),
+   .driver_info = (kernel_ulong_t)telit_le920_blacklist },
{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF622, 0xff, 
0xff, 0xff) }, /* ZTE WCDMA products */
{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0002, 0xff, 0xff, 
0xff),
.driver_info = (kernel_ulong_t)net_intf1_blacklist },
-- 
1.7.4.1

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/1] NET: qmi_wwan: add Telit LE920 support

2013-01-28 Thread Daniele Palmas
Add VID, PID and fixed interface for Telit LE920

Signed-off-by: Daniele Palmas dnl...@gmail.com
---
 drivers/net/usb/qmi_wwan.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
index 6a1ca50..e32f9a1 100644
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -459,6 +459,7 @@ static const struct usb_device_id products[] = {
{QMI_FIXED_INTF(0x1199, 0x68a2, 19)},   /* Sierra Wireless MC7710 in 
QMI mode */
{QMI_FIXED_INTF(0x1199, 0x901c, 8)},/* Sierra Wireless EM7700 */
{QMI_FIXED_INTF(0x1bbb, 0x011e, 4)},/* Telekom Speedstick LTE II 
(Alcatel One Touch L100V LTE) */
+   {QMI_FIXED_INTF(0x1bc7, 0x1200, 5)},/* Telit LE920 */
 
/* 4. Gobi 1000 devices */
{QMI_GOBI1K_DEVICE(0x05c6, 0x9212)},/* Acer Gobi Modem Device */
-- 
1.7.4.1

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 10/30] USB: ehci-omap: Use PHY APIs to get the PHY device and put it out of suspend

2013-01-28 Thread Roger Quadros
On 01/28/2013 05:40 PM, Alan Stern wrote:
 On Mon, 28 Jan 2013, Roger Quadros wrote:
 
 For each port that is in PHY mode we obtain a PHY device using the USB PHY
 library and put it out of suspend.

 It is upto platform code to associate the PHY to the controller's
 port and it is upto the PHY driver to manage the PHY's resources.
 
 up to is two words, not one.

right :P

 
 Signed-off-by: Roger Quadros rog...@ti.com
 ---
  drivers/usb/host/ehci-omap.c |   54 
 ++
  1 files changed, 54 insertions(+), 0 deletions(-)

 diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
 index fd2f5450..a35e44e 100644
 --- a/drivers/usb/host/ehci-omap.c
 +++ b/drivers/usb/host/ehci-omap.c
 @@ -70,6 +70,11 @@ static const char hcd_name[] = ehci-omap;
  
  
 /*-*/
  
 +struct omap_hcd {
 +struct usb_hcd *hcd;
 
 This pointer is not needed any more.
 
OK.

 +struct usb_phy **phy;   /* one PHY for each port */
 +int nports;
 
 Is there a reasonable upper limit on the number of ports?  If there is 
 you could just put a fixed-size array here.

For now there are only 3 which is defined in OMAP3_HS_USB_PORTS. 

 
 @@ -233,6 +240,39 @@ static int ehci_hcd_omap_probe(struct platform_device 
 *pdev)
  hcd-rsrc_len = resource_size(res);
  hcd-regs = regs;
  
 +omap = (struct omap_hcd *)hcd_to_ehci(hcd)-priv;
 +omap-nports = pdata-nports;
 +i = sizeof(struct usb_phy *) * omap-nports;
 +omap-phy = devm_kzalloc(pdev-dev, i, GFP_KERNEL);
 +if (!omap-phy) {
 +dev_err(dev, Memory allocation failed\n);
 +return -ENOMEM;
 
 You have to put a goto here, not a return.  The hcd must be cleaned 
 up properly.

good catch!

 
 @@ -295,11 +342,18 @@ static int ehci_hcd_omap_remove(struct platform_device 
 *pdev)
  {
  struct device *dev  = pdev-dev;
  struct usb_hcd *hcd = dev_get_drvdata(dev);
 +struct omap_hcd *omap = (struct omap_hcd *)hcd_to_ehci(hcd)-priv;
 
 What's with the weird spacing in the first two declarations?  This 
 isn't a typeset document where the paragraphs need to be fully 
 justified.  :-)

Funny that it is all over the place ;). I'll fix it around whatever I touch.
 
 +int i;
  
  usb_remove_hcd(hcd);
  disable_put_regulator(dev-platform_data);
  usb_put_hcd(hcd);
 
 This line must be moved down.  When the hcd is deallocated, the
 omap_hcd structure goes with it.

Good one. Will fix.
 
 +for (i = 0; i  omap-nports; i++) {
 +if (omap-phy[i])
 +usb_phy_shutdown(omap-phy[i]);
 +}
 +
 

regards,
-roger

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH, resubmit] ax88179_178a: ASIX AX88179_178A USB 3.0/2.0 to gigabit ethernet adapter driver

2013-01-28 Thread Michael Leun
On Mon, 28 Jan 2013 21:36:20 +0800
Freddy fre...@asix.com.tw wrote:

  I would vote to not accept that driver for mainline as long as this 
  issues are not fixed.
 
 
 Michael, could you give me more information about how do you test
 this driver? I have tried to reproduce the issue by using ifconfig
 ethX mtu 1500, but I didn't confront the same issue. Thank you in
 advance for your help.

I'm very sorry, but this seems to be some mistake on my side. I would
have sworn that I had done this also with mtu 1500, but now it looks
like you have to set the mtu to at least 1519 to see the issue (likely
an typo and I actually had set it to 1600):

jill:/home/ml # ifconfig eth3 192.168.123.2/24
jill:/home/ml # ifconfig eth3
eth3  Link encap:Ethernet  Hardware Adresse 00:24:9B:05:5C:E3  
  inet Adresse:192.168.123.2  Bcast:192.168.123.255  Maske:255.255.255.0
  inet6 Adresse: fe80::224:9bff:fe05:5ce3/64 
Gültigkeitsbereich:Verbindung
  UP BROADCAST RUNNING MULTICAST  MTU:1488  Metric:1
  RX packets:0 errors:0 dropped:0 overruns:0 frame:0
  TX packets:1 errors:0 dropped:0 overruns:0 carrier:0
  collisions:0 Sendewarteschlangenlänge:1000 
  RX bytes:0 (0.0 b)  TX bytes:98 (98.0 b)

jill:/home/ml # ping 192.168.123.1
PING 192.168.123.1 (192.168.123.1) 56(84) bytes of data.
64 bytes from 192.168.123.1: icmp_seq=1 ttl=64 time=1.41 ms
64 bytes from 192.168.123.1: icmp_seq=2 ttl=64 time=0.969 ms
64 bytes from 192.168.123.1: icmp_seq=3 ttl=64 time=1.01 ms
^C
--- 192.168.123.1 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2002ms
rtt min/avg/max/mdev = 0.969/1.131/1.412/0.199 ms
jill:/home/ml # ping -s 1491 192.168.123.1
PING 192.168.123.1 (192.168.123.1) 1491(1519) bytes of data.
1499 bytes from 192.168.123.1: icmp_seq=1 ttl=64 time=1.30 ms
1499 bytes from 192.168.123.1: icmp_seq=2 ttl=64 time=1.10 ms
1499 bytes from 192.168.123.1: icmp_seq=3 ttl=64 time=1.24 ms
^C
--- 192.168.123.1 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2002ms
rtt min/avg/max/mdev = 1.109/1.218/1.306/0.086 ms
jill:/home/ml # ifconfig eth3 mtu 1519
jill:/home/ml # ping 192.168.123.1
PING 192.168.123.1 (192.168.123.1) 56(84) bytes of data.
64 bytes from 192.168.123.1: icmp_seq=1 ttl=64 time=1.11 ms
64 bytes from 192.168.123.1: icmp_seq=2 ttl=64 time=0.969 ms
^C
--- 192.168.123.1 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 0.969/1.042/1.115/0.073 ms
jill:/home/ml # ping -s 1491 192.168.123.1
PING 192.168.123.1 (192.168.123.1) 1491(1519) bytes of data.
^C
--- 192.168.123.1 ping statistics ---
2 packets transmitted, 0 received, 100% packet loss, time 1000ms

jill:/home/ml # ping 192.168.123.1
PING 192.168.123.1 (192.168.123.1) 56(84) bytes of data.
^C
--- 192.168.123.1 ping statistics ---
6 packets transmitted, 0 received, 100% packet loss, time 4999ms

jill:/home/ml # 

-- 
MfG,

Michael Leun

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/1] NET: qmi_wwan: add Telit LE920 support

2013-01-28 Thread Bjørn Mork
Daniele Palmas dnl...@gmail.com writes:

 Add VID, PID and fixed interface for Telit LE920

 Signed-off-by: Daniele Palmas dnl...@gmail.com
 ---
  drivers/net/usb/qmi_wwan.c |1 +
  1 files changed, 1 insertions(+), 0 deletions(-)

 diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
 index 6a1ca50..e32f9a1 100644
 --- a/drivers/net/usb/qmi_wwan.c
 +++ b/drivers/net/usb/qmi_wwan.c
 @@ -459,6 +459,7 @@ static const struct usb_device_id products[] = {
   {QMI_FIXED_INTF(0x1199, 0x68a2, 19)},   /* Sierra Wireless MC7710 in 
 QMI mode */
   {QMI_FIXED_INTF(0x1199, 0x901c, 8)},/* Sierra Wireless EM7700 */
   {QMI_FIXED_INTF(0x1bbb, 0x011e, 4)},/* Telekom Speedstick LTE II 
 (Alcatel One Touch L100V LTE) */
 + {QMI_FIXED_INTF(0x1bc7, 0x1200, 5)},/* Telit LE920 */
  
   /* 4. Gobi 1000 devices */
   {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)},/* Acer Gobi Modem Device */

Thanks for adding this device. But the patch doesn't apply to the
current net tree.  Care to rebase it?


Thanks,
Bjørn
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] Revert usb: Register usb port's acpi power resources

2013-01-28 Thread Lan Tianyu
This reverts commit 88bb965ed711e8a5984e70208ebc901a6ff4141f.

The linux-next branch of linux-pm tree has replaced
acpi_power_resource_(un)register_device() with new routines.
Commit 88bb965 will cause conflict in the linux-next tree.
So revert it and this will not affect other functions. Will
send a new patch with new routines after 3.9 merge window.

Signed-off-by: Lan Tianyu tianyu@intel.com
---
 drivers/usb/core/port.c |6 --
 drivers/usb/core/usb-acpi.c |   18 --
 drivers/usb/core/usb.h  |6 --
 3 files changed, 30 deletions(-)

diff --git a/drivers/usb/core/port.c b/drivers/usb/core/port.c
index 5df143d..797f9d5 100644
--- a/drivers/usb/core/port.c
+++ b/drivers/usb/core/port.c
@@ -68,7 +68,6 @@ static void usb_port_device_release(struct device *dev)
struct usb_port *port_dev = to_usb_port(dev);
 
dev_pm_qos_hide_flags(dev);
-   usb_acpi_unregister_power_resources(dev);
kfree(port_dev);
 }
 
@@ -187,11 +186,6 @@ int usb_hub_create_port_device(struct usb_hub *hub, int 
port1)
pm_runtime_enable(port_dev-dev);
 
device_enable_async_suspend(port_dev-dev);
-
-   retval = usb_acpi_register_power_resources(port_dev-dev);
-   if (retval  retval != -ENODEV)
-   dev_warn(port_dev-dev, the port can't register its ACPI 
power resource.\n);
-
return 0;
 
 error_register:
diff --git a/drivers/usb/core/usb-acpi.c b/drivers/usb/core/usb-acpi.c
index 8d304b0..cef4252 100644
--- a/drivers/usb/core/usb-acpi.c
+++ b/drivers/usb/core/usb-acpi.c
@@ -216,24 +216,6 @@ static struct acpi_bus_type usb_acpi_bus = {
.find_device = usb_acpi_find_device,
 };
 
-int usb_acpi_register_power_resources(struct device *dev)
-{
-   acpi_handle port_handle = DEVICE_ACPI_HANDLE(dev);
-
-   if (!port_handle)
-   return -ENODEV;
-
-   return acpi_power_resource_register_device(dev, port_handle);
-}
-
-void usb_acpi_unregister_power_resources(struct device *dev)
-{
-   acpi_handle port_handle = DEVICE_ACPI_HANDLE(dev);
-
-   if (port_handle)
-   acpi_power_resource_unregister_device(dev, port_handle);
-}
-
 int usb_acpi_register(void)
 {
return register_acpi_bus_type(usb_acpi_bus);
diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h
index 601b044..a7f20bd 100644
--- a/drivers/usb/core/usb.h
+++ b/drivers/usb/core/usb.h
@@ -191,13 +191,7 @@ extern int usb_acpi_register(void);
 extern void usb_acpi_unregister(void);
 extern acpi_handle usb_get_hub_port_acpi_handle(struct usb_device *hdev,
int port1);
-extern int usb_acpi_register_power_resources(struct device *dev);
-extern void usb_acpi_unregister_power_resources(struct device *dev);
 #else
 static inline int usb_acpi_register(void) { return 0; };
 static inline void usb_acpi_unregister(void) { };
-static inline int usb_acpi_register_power_resources(struct device *dev)
-   { return 0; };
-static inline void usb_acpi_unregister_power_resources(struct device *dev)
-   { };
 #endif
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2] usb: host: tegra: make use of PHY pointer of HCD

2013-01-28 Thread Stephen Warren
On 01/24/2013 03:27 AM, Venu Byravarasu wrote:
 As pointer to PHY structure can be stored in struct usb_hcd
 making use of it, to call Tegra PHY APIs.
 
 Call to usb_phy_shutdown() is moved up in tegra_ehci_remove(),
 so that to avoid dereferencing of hcd after its freed up.

I have applied this to Tegra's for-3.9/soc-usb branch.
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 01/13] MIPS: BCM63XX: add USB host clock enable delay

2013-01-28 Thread Florian Fainelli
Knowledge of the clock setup delay should remain at the clock level (so
it can be clock specific and CPU specific). Add the 100 milliseconds
required clock delay for the USB host clock when it gets enabled.

Signed-off-by: Florian Fainelli flor...@openwrt.org
---
 arch/mips/bcm63xx/clk.c |5 +
 1 file changed, 5 insertions(+)

diff --git a/arch/mips/bcm63xx/clk.c b/arch/mips/bcm63xx/clk.c
index b9e948d..a39aeb8 100644
--- a/arch/mips/bcm63xx/clk.c
+++ b/arch/mips/bcm63xx/clk.c
@@ -162,6 +162,11 @@ static void usbh_set(struct clk *clk, int enable)
bcm_hwclock_set(CKCTL_6348_USBH_EN, enable);
else if (BCMCPU_IS_6368())
bcm_hwclock_set(CKCTL_6368_USBH_EN, enable);
+   else
+   return;
+
+   if (enable)
+   msleep(100);
 }
 
 static struct clk clk_usbh = {
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 03/13] MIPS: BCM63XX: move code touching the USB private register

2013-01-28 Thread Florian Fainelli
This patch moves the code touching the USB private register in the
bcm63xx USB gadget driver to arch/mips/bcm63xx/usb-common.c in
preparation for adding support for OHCI and EHCI host controllers which
will also touch the USB private register.

Signed-off-by: Florian Fainelli flor...@openwrt.org
---
 arch/mips/bcm63xx/Makefile |2 +-
 arch/mips/bcm63xx/usb-common.c |   53 
 .../include/asm/mach-bcm63xx/bcm63xx_usb_priv.h|9 
 drivers/usb/gadget/bcm63xx_udc.c   |   27 ++
 4 files changed, 67 insertions(+), 24 deletions(-)
 create mode 100644 arch/mips/bcm63xx/usb-common.c
 create mode 100644 arch/mips/include/asm/mach-bcm63xx/bcm63xx_usb_priv.h

diff --git a/arch/mips/bcm63xx/Makefile b/arch/mips/bcm63xx/Makefile
index ac28073..a085c2b 100644
--- a/arch/mips/bcm63xx/Makefile
+++ b/arch/mips/bcm63xx/Makefile
@@ -1,7 +1,7 @@
 obj-y  += clk.o cpu.o cs.o gpio.o irq.o nvram.o prom.o reset.o \
   setup.o timer.o dev-dsp.o dev-enet.o dev-flash.o \
   dev-pcmcia.o dev-rng.o dev-spi.o dev-uart.o dev-wdt.o \
-  dev-usb-usbd.o
+  dev-usb-usbd.o usb-common.o
 obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
 
 obj-y  += boards/
diff --git a/arch/mips/bcm63xx/usb-common.c b/arch/mips/bcm63xx/usb-common.c
new file mode 100644
index 000..b617cf6
--- /dev/null
+++ b/arch/mips/bcm63xx/usb-common.c
@@ -0,0 +1,53 @@
+/*
+ * Broadcom BCM63xx common USB device configuration code
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file COPYING in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2012 Kevin Cernekee cerne...@gmail.com
+ * Copyright (C) 2012 Broadcom Corporation
+ *
+ */
+#include linux/export.h
+
+#include bcm63xx_cpu.h
+#include bcm63xx_regs.h
+#include bcm63xx_io.h
+#include bcm63xx_usb_priv.h
+
+void bcm63xx_usb_priv_select_phy_mode(u32 portmask, bool is_device)
+{
+   u32 val;
+
+   val = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_UTMI_CTL_6368_REG);
+   if (is_device) {
+   val |= (portmask  USBH_PRIV_UTMI_CTL_HOSTB_SHIFT);
+   val |= (portmask  USBH_PRIV_UTMI_CTL_NODRIV_SHIFT);
+   } else {
+   val = ~(portmask  USBH_PRIV_UTMI_CTL_HOSTB_SHIFT);
+   val = ~(portmask  USBH_PRIV_UTMI_CTL_NODRIV_SHIFT);
+   }
+   bcm_rset_writel(RSET_USBH_PRIV, val, USBH_PRIV_UTMI_CTL_6368_REG);
+
+   val = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SWAP_6368_REG);
+   if (is_device)
+   val |= USBH_PRIV_SWAP_USBD_MASK;
+   else
+   val = ~USBH_PRIV_SWAP_USBD_MASK;
+   bcm_rset_writel(RSET_USBH_PRIV, val, USBH_PRIV_SWAP_6368_REG);
+}
+EXPORT_SYMBOL(bcm63xx_usb_host_priv_cfg_set);
+
+void bcm63xx_usb_priv_select_pullup(u32 portmask, bool is_on)
+{
+   u32 val;
+
+   val = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_UTMI_CTL_6368_REG);
+   if (is_on)
+   val = ~(portmask  USBH_PRIV_UTMI_CTL_NODRIV_SHIFT);
+   else
+   val |= (portmask  USBH_PRIV_UTMI_CTL_NODRIV_SHIFT);
+   bcm_rset_writel(RSET_USBH_PRIV, val, USBH_PRIV_UTMI_CTL_6368_REG);
+}
+EXPORT_SYMBOL(bcm63xx_usb_priv_select_pullup);
diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_usb_priv.h 
b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_usb_priv.h
new file mode 100644
index 000..f0d4b59
--- /dev/null
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_usb_priv.h
@@ -0,0 +1,9 @@
+#ifndef BCM63XX_USB_PRIV_H_
+#define BCM63XX_USB_PRIV_H_
+
+#include linux/types.h
+
+void bcm63xx_usb_priv_select_phy_mode(u32 portmask, bool is_device);
+void bcm63xx_usb_priv_select_pullup(u32 portmask, bool is_on);
+
+#endif /* BCM63XX_USB_PRIV_H_ */
diff --git a/drivers/usb/gadget/bcm63xx_udc.c b/drivers/usb/gadget/bcm63xx_udc.c
index ad17533..af450c4 100644
--- a/drivers/usb/gadget/bcm63xx_udc.c
+++ b/drivers/usb/gadget/bcm63xx_udc.c
@@ -41,6 +41,7 @@
 #include bcm63xx_dev_usb_usbd.h
 #include bcm63xx_io.h
 #include bcm63xx_regs.h
+#include bcm63xx_usb_priv.h
 
 #define DRV_MODULE_NAMEbcm63xx_udc
 
@@ -863,22 +864,7 @@ static void bcm63xx_select_phy_mode(struct bcm63xx_udc 
*udc, bool is_device)
bcm_gpio_writel(val, GPIO_PINMUX_OTHR_REG);
}
 
-   val = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_UTMI_CTL_6368_REG);
-   if (is_device) {
-   val |= (portmask  USBH_PRIV_UTMI_CTL_HOSTB_SHIFT);
-   val |= (portmask  USBH_PRIV_UTMI_CTL_NODRIV_SHIFT);
-   } else {
-   val = ~(portmask  USBH_PRIV_UTMI_CTL_HOSTB_SHIFT);
-   val = ~(portmask  USBH_PRIV_UTMI_CTL_NODRIV_SHIFT);
-   }
-   bcm_rset_writel(RSET_USBH_PRIV, val, USBH_PRIV_UTMI_CTL_6368_REG);
-
-   val = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SWAP_6368_REG);
-   if (is_device)
-   val |= 

[PATCH 10/13] MIPS: BCM63XX: register EHCI controller if board enables it

2013-01-28 Thread Florian Fainelli
BCM63XX-based board can control the registration of the EHCI controller
by setting their has_ehci0 flag to 1. Handle this in the generic
code dealing with board registration and call the actual helper to register
the EHCI controller.

Signed-off-by: Florian Fainelli flor...@openwrt.org
---
 arch/mips/bcm63xx/boards/board_bcm963xx.c |4 
 1 file changed, 4 insertions(+)

diff --git a/arch/mips/bcm63xx/boards/board_bcm963xx.c 
b/arch/mips/bcm63xx/boards/board_bcm963xx.c
index 9cdc023..0ee7ca6 100644
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
@@ -25,6 +25,7 @@
 #include bcm63xx_dev_flash.h
 #include bcm63xx_dev_pcmcia.h
 #include bcm63xx_dev_spi.h
+#include bcm63xx_dev_usb_ehci.h
 #include bcm63xx_dev_usb_ohci.h
 #include bcm63xx_dev_usb_usbd.h
 #include board_bcm963xx.h
@@ -852,6 +853,9 @@ int __init board_register_devices(void)
if (board.has_usbd)
bcm63xx_usbd_register(board.usbd);
 
+   if (board.has_ehci0)
+   bcm63xx_ehci_register();
+
if (board.has_ohci0)
bcm63xx_ohci_register();
 
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 05/13] MIPS: BCM63XX: introduce BCM63XX_OHCI configuration symbol

2013-01-28 Thread Florian Fainelli
This configuration symbol can be used by CPUs supporting the on-chip
OHCI controller, and ensures that all relevant OHCI-related
configuration options are correctly selected. So far, OHCI support is
available for the 6328, 6348, 6358 and 6358 SoCs.

Signed-off-by: Florian Fainelli flor...@openwrt.org
---
 arch/mips/bcm63xx/Kconfig |   15 ++-
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/arch/mips/bcm63xx/Kconfig b/arch/mips/bcm63xx/Kconfig
index d03e879..23b1ffd 100644
--- a/arch/mips/bcm63xx/Kconfig
+++ b/arch/mips/bcm63xx/Kconfig
@@ -1,33 +1,38 @@
 menu CPU support
depends on BCM63XX
 
+config BCM63XX_OHCI
+   bool
+   select USB_ARCH_HAS_OHCI
+   select USB_OHCI_BIG_ENDIAN_DESC if USB_OHCI_HCD
+   select USB_OHCI_BIG_ENDIAN_MMIO if USB_OHCI_HCD
+
 config BCM63XX_CPU_6328
bool support 6328 CPU
select HW_HAS_PCI
+   select BCM63XX_OHCI
 
 config BCM63XX_CPU_6338
bool support 6338 CPU
select HW_HAS_PCI
-   select USB_ARCH_HAS_OHCI
-   select USB_OHCI_BIG_ENDIAN_DESC
-   select USB_OHCI_BIG_ENDIAN_MMIO
 
 config BCM63XX_CPU_6345
bool support 6345 CPU
-   select USB_OHCI_BIG_ENDIAN_DESC
-   select USB_OHCI_BIG_ENDIAN_MMIO
 
 config BCM63XX_CPU_6348
bool support 6348 CPU
select HW_HAS_PCI
+   select BCM63XX_OHCI
 
 config BCM63XX_CPU_6358
bool support 6358 CPU
select HW_HAS_PCI
+   select BCM63XX_OHCI
 
 config BCM63XX_CPU_6368
bool support 6368 CPU
select HW_HAS_PCI
+   select BCM63XX_OHCI
 endmenu
 
 source arch/mips/bcm63xx/boards/Kconfig
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 04/13] MIPS: BCM63XX: add OHCI/EHCI configuration bits to common USB code

2013-01-28 Thread Florian Fainelli
This patch updates the common USB code touching the USB private
registers with the specific bits to properly enable OHCI and EHCI
controllers on BCM63xx SoCs. As a result we now need to protect access
to Read Modify Write sequences using a spinlock because we cannot
guarantee that any of the exposed helper will not be called
concurrently.

Signed-off-by: Maxime Bizon mbi...@freebox.fr
Signed-off-by: Florian Fainelli flor...@openwrt.org
---
 arch/mips/bcm63xx/usb-common.c |   97 
 .../include/asm/mach-bcm63xx/bcm63xx_usb_priv.h|2 +
 2 files changed, 99 insertions(+)

diff --git a/arch/mips/bcm63xx/usb-common.c b/arch/mips/bcm63xx/usb-common.c
index b617cf6..e18ac08 100644
--- a/arch/mips/bcm63xx/usb-common.c
+++ b/arch/mips/bcm63xx/usb-common.c
@@ -5,10 +5,12 @@
  * License.  See the file COPYING in the main directory of this archive
  * for more details.
  *
+ * Copyright (C) 2008 Maxime Bizon mbi...@freebox.fr
  * Copyright (C) 2012 Kevin Cernekee cerne...@gmail.com
  * Copyright (C) 2012 Broadcom Corporation
  *
  */
+#include linux/spinlock.h
 #include linux/export.h
 
 #include bcm63xx_cpu.h
@@ -16,9 +18,14 @@
 #include bcm63xx_io.h
 #include bcm63xx_usb_priv.h
 
+static DEFINE_SPINLOCK(usb_priv_reg_lock);
+
 void bcm63xx_usb_priv_select_phy_mode(u32 portmask, bool is_device)
 {
u32 val;
+   unsigned long flags;
+
+   spin_lock_irqsave(usb_priv_reg_lock, flags);
 
val = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_UTMI_CTL_6368_REG);
if (is_device) {
@@ -36,12 +43,17 @@ void bcm63xx_usb_priv_select_phy_mode(u32 portmask, bool 
is_device)
else
val = ~USBH_PRIV_SWAP_USBD_MASK;
bcm_rset_writel(RSET_USBH_PRIV, val, USBH_PRIV_SWAP_6368_REG);
+
+   spin_unlock_irqrestore(usb_priv_reg_lock, flags);
 }
 EXPORT_SYMBOL(bcm63xx_usb_host_priv_cfg_set);
 
 void bcm63xx_usb_priv_select_pullup(u32 portmask, bool is_on)
 {
u32 val;
+   unsigned long flags;
+
+   spin_lock_irqsave(usb_priv_reg_lock, flags);
 
val = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_UTMI_CTL_6368_REG);
if (is_on)
@@ -49,5 +61,90 @@ void bcm63xx_usb_priv_select_pullup(u32 portmask, bool is_on)
else
val |= (portmask  USBH_PRIV_UTMI_CTL_NODRIV_SHIFT);
bcm_rset_writel(RSET_USBH_PRIV, val, USBH_PRIV_UTMI_CTL_6368_REG);
+
+   spin_unlock_irqrestore(usb_priv_reg_lock, flags);
 }
 EXPORT_SYMBOL(bcm63xx_usb_priv_select_pullup);
+
+/* The following array represents the meaning of the DESC/DATA
+ * endian swapping with respect to the CPU configured endianness
+ *
+ * DATAENDNmmiodescriptor
+ * 0   0   BE  invalid
+ * 0   1   BE  LE
+ * 1   0   BE  BE
+ * 1   1   BE  invalid
+ *
+ * Since BCM63XX SoCs are configured to be in big-endian mode
+ * we want configuration at line 3.
+ */
+void bcm63xx_usb_priv_ohci_cfg_set(void)
+{
+   u32 reg;
+   unsigned long flags;
+
+   spin_lock_irqsave(usb_priv_reg_lock, flags);
+
+   if (BCMCPU_IS_6348())
+   bcm_rset_writel(RSET_OHCI_PRIV, 0, OHCI_PRIV_REG);
+   else if (BCMCPU_IS_6358()) {
+   reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SWAP_6358_REG);
+   reg = ~USBH_PRIV_SWAP_OHCI_ENDN_MASK;
+   reg |= USBH_PRIV_SWAP_OHCI_DATA_MASK;
+   bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SWAP_6358_REG);
+   /*
+* The magic value comes for the original vendor BSP
+* and is needed for USB to work. Datasheet does not
+* help, so the magic value is used as-is.
+*/
+   bcm_rset_writel(RSET_USBH_PRIV, 0x1c0020,
+   USBH_PRIV_TEST_6358_REG);
+
+   } else if (BCMCPU_IS_6328() || BCMCPU_IS_6368()) {
+   reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SWAP_6368_REG);
+   reg = ~USBH_PRIV_SWAP_OHCI_ENDN_MASK;
+   reg |= USBH_PRIV_SWAP_OHCI_DATA_MASK;
+   bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SWAP_6368_REG);
+
+   reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SETUP_6368_REG);
+   reg |= USBH_PRIV_SETUP_IOC_MASK;
+   bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SETUP_6368_REG);
+   }
+
+   spin_unlock_irqrestore(usb_priv_reg_lock, flags);
+}
+
+void bcm63xx_usb_priv_ehci_cfg_set(void)
+{
+   u32 reg;
+   unsigned long flags;
+
+   spin_lock_irqsave(usb_priv_reg_lock, flags);
+
+   if (BCMCPU_IS_6358()) {
+   reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SWAP_6358_REG);
+   reg = ~USBH_PRIV_SWAP_EHCI_ENDN_MASK;
+   reg |= USBH_PRIV_SWAP_EHCI_DATA_MASK;
+   bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SWAP_6358_REG);
+
+   /*
+* The magic value comes for the original vendor BSP
+* and is needed for USB to 

[PATCH 12/13] MIPS: BCM63XX: EHCI controller does not support overcurrent

2013-01-28 Thread Florian Fainelli
This patch sets the ignore_oc flag for the BCM63XX EHCI controller as it
does not support proper overcurrent reporting.

Signed-off-by: Florian Fainelli flor...@openwrt.org
---
 arch/mips/bcm63xx/dev-usb-ehci.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/mips/bcm63xx/dev-usb-ehci.c b/arch/mips/bcm63xx/dev-usb-ehci.c
index 0ea7888..f7b6807 100644
--- a/arch/mips/bcm63xx/dev-usb-ehci.c
+++ b/arch/mips/bcm63xx/dev-usb-ehci.c
@@ -61,6 +61,7 @@ static void bcm63xx_ehci_power_off(struct platform_device 
*pdev)
 static struct usb_ehci_pdata bcm63xx_ehci_pdata = {
.big_endian_desc= 1,
.big_endian_mmio= 1,
+   .ignore_oc  = 1,
.power_on   = bcm63xx_ehci_power_on,
.power_off  = bcm63xx_ehci_power_off,
.power_suspend  = bcm63xx_ehci_power_off,
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 09/13] MIPS: BCM63XX: add support for the on-chip EHCI controller

2013-01-28 Thread Florian Fainelli
Broadcom BCM63XX SoCs include an on-chip EHCI controller which can be
driven by the generic ehci-platform driver by using specific power
on/off/suspend callbacks to manage clocks and hardware specific
configuration.

Signed-off-by: Maxime Bizon mbi...@freebox.fr
Signed-off-by: Florian Fainelli flor...@openwrt.org
---
 arch/mips/bcm63xx/Makefile |2 +-
 arch/mips/bcm63xx/dev-usb-ehci.c   |   92 
 .../asm/mach-bcm63xx/bcm63xx_dev_usb_ehci.h|6 ++
 3 files changed, 99 insertions(+), 1 deletion(-)
 create mode 100644 arch/mips/bcm63xx/dev-usb-ehci.c
 create mode 100644 arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_ehci.h

diff --git a/arch/mips/bcm63xx/Makefile b/arch/mips/bcm63xx/Makefile
index a2a501a..c3503ae 100644
--- a/arch/mips/bcm63xx/Makefile
+++ b/arch/mips/bcm63xx/Makefile
@@ -1,7 +1,7 @@
 obj-y  += clk.o cpu.o cs.o gpio.o irq.o nvram.o prom.o reset.o \
   setup.o timer.o dev-dsp.o dev-enet.o dev-flash.o \
   dev-pcmcia.o dev-rng.o dev-spi.o dev-uart.o dev-wdt.o \
-  dev-usb-ohci.o dev-usb-usbd.o usb-common.o
+  dev-usb-ehci.o dev-usb-ohci.o dev-usb-usbd.o usb-common.o
 obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
 
 obj-y  += boards/
diff --git a/arch/mips/bcm63xx/dev-usb-ehci.c b/arch/mips/bcm63xx/dev-usb-ehci.c
new file mode 100644
index 000..0ea7888
--- /dev/null
+++ b/arch/mips/bcm63xx/dev-usb-ehci.c
@@ -0,0 +1,92 @@
+/*
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file COPYING in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2008 Maxime Bizon mbi...@freebox.fr
+ * Copyright (C) 2013 Florian Fainelli flor...@openwrt.org
+ */
+
+#include linux/init.h
+#include linux/kernel.h
+#include linux/platform_device.h
+#include linux/clk.h
+#include linux/delay.h
+#include linux/usb/ehci_pdriver.h
+#include linux/dma-mapping.h
+
+#include bcm63xx_cpu.h
+#include bcm63xx_regs.h
+#include bcm63xx_io.h
+#include bcm63xx_usb_priv.h
+#include bcm63xx_dev_usb_ehci.h
+
+static struct resource ehci_resources[] = {
+   {
+   .start  = -1, /* filled at runtime */
+   .end= -1, /* filled at runtime */
+   .flags  = IORESOURCE_MEM,
+   },
+   {
+   .start  = -1, /* filled at runtime */
+   .flags  = IORESOURCE_IRQ,
+   },
+};
+
+static u64 ehci_dmamask = DMA_BIT_MASK(32);
+
+static struct clk *usb_host_clock;
+
+static int bcm63xx_ehci_power_on(struct platform_device *pdev)
+{
+   usb_host_clock = clk_get(pdev-dev, usbh);
+   if (IS_ERR_OR_NULL(usb_host_clock))
+   return -ENODEV;
+
+   clk_prepare_enable(usb_host_clock);
+
+   bcm63xx_usb_priv_ehci_cfg_set();
+
+   return 0;
+}
+
+static void bcm63xx_ehci_power_off(struct platform_device *pdev)
+{
+   if (!IS_ERR_OR_NULL(usb_host_clock)) {
+   clk_disable_unprepare(usb_host_clock);
+   clk_put(usb_host_clock);
+   }
+}
+
+static struct usb_ehci_pdata bcm63xx_ehci_pdata = {
+   .big_endian_desc= 1,
+   .big_endian_mmio= 1,
+   .power_on   = bcm63xx_ehci_power_on,
+   .power_off  = bcm63xx_ehci_power_off,
+   .power_suspend  = bcm63xx_ehci_power_off,
+};
+
+static struct platform_device bcm63xx_ehci_device = {
+   .name   = ehci-platform,
+   .id = -1,
+   .num_resources  = ARRAY_SIZE(ehci_resources),
+   .resource   = ehci_resources,
+   .dev= {
+   .platform_data  = bcm63xx_ehci_pdata,
+   .dma_mask   = ehci_dmamask,
+   .coherent_dma_mask  = DMA_BIT_MASK(32),
+   },
+};
+
+int __init bcm63xx_ehci_register(void)
+{
+   if (!BCMCPU_IS_6328()  !BCMCPU_IS_6358()  !BCMCPU_IS_6368())
+   return 0;
+
+   ehci_resources[0].start = bcm63xx_regset_address(RSET_EHCI0);
+   ehci_resources[0].end = ehci_resources[0].start;
+   ehci_resources[0].end += RSET_EHCI_SIZE - 1;
+   ehci_resources[1].start = bcm63xx_get_irq_number(IRQ_EHCI0);
+
+   return platform_device_register(bcm63xx_ehci_device);
+}
diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_ehci.h 
b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_ehci.h
new file mode 100644
index 000..17fb519
--- /dev/null
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_ehci.h
@@ -0,0 +1,6 @@
+#ifndef BCM63XX_DEV_USB_EHCI_H_
+#define BCM63XX_DEV_USB_EHCI_H_
+
+int bcm63xx_ehci_register(void);
+
+#endif /* BCM63XX_DEV_USB_EHCI_H_ */
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 13/13] MIPS: BCM63XX: update defconfig

2013-01-28 Thread Florian Fainelli
This patch updates the BCM63XX defconfig with the USB OHCI and EHCI host
drivers as well as the USB gadget driver.

Signed-off-by: Florian Fainelli flor...@openwrt.org
---
 arch/mips/configs/bcm63xx_defconfig |   22 +-
 1 file changed, 9 insertions(+), 13 deletions(-)

diff --git a/arch/mips/configs/bcm63xx_defconfig 
b/arch/mips/configs/bcm63xx_defconfig
index 9190051..a5a2c5f 100644
--- a/arch/mips/configs/bcm63xx_defconfig
+++ b/arch/mips/configs/bcm63xx_defconfig
@@ -3,15 +3,12 @@ CONFIG_BCM63XX_CPU_6338=y
 CONFIG_BCM63XX_CPU_6345=y
 CONFIG_BCM63XX_CPU_6348=y
 CONFIG_BCM63XX_CPU_6358=y
-CONFIG_NO_HZ=y
 # CONFIG_SECCOMP is not set
 CONFIG_EXPERIMENTAL=y
 # CONFIG_LOCALVERSION_AUTO is not set
 # CONFIG_SWAP is not set
-CONFIG_TINY_RCU=y
-CONFIG_SYSFS_DEPRECATED_V2=y
+CONFIG_NO_HZ=y
 CONFIG_EXPERT=y
-# CONFIG_PCSPKR_PLATFORM is not set
 # CONFIG_FUTEX is not set
 # CONFIG_EPOLL is not set
 # CONFIG_SIGNALFD is not set
@@ -44,36 +41,36 @@ CONFIG_UEVENT_HELPER_PATH=/sbin/hotplug
 # CONFIG_STANDALONE is not set
 # CONFIG_PREVENT_FIRMWARE_BUILD is not set
 CONFIG_MTD=y
-CONFIG_MTD_PARTITIONS=y
 CONFIG_MTD_CFI=y
 CONFIG_MTD_CFI_INTELEXT=y
 CONFIG_MTD_CFI_AMDSTD=y
 CONFIG_MTD_PHYSMAP=y
 # CONFIG_BLK_DEV is not set
-# CONFIG_MISC_DEVICES is not set
 CONFIG_NETDEVICES=y
-CONFIG_BCM63XX_PHY=y
-CONFIG_NET_ETHERNET=y
 CONFIG_BCM63XX_ENET=y
-# CONFIG_NETDEV_1000 is not set
-# CONFIG_NETDEV_1 is not set
+CONFIG_BCM63XX_PHY=y
 CONFIG_B43=y
 # CONFIG_B43_PHY_LP is not set
 # CONFIG_INPUT is not set
 # CONFIG_SERIO is not set
 # CONFIG_VT is not set
+# CONFIG_UNIX98_PTYS is not set
 # CONFIG_DEVKMEM is not set
 CONFIG_SERIAL_BCM63XX=y
 CONFIG_SERIAL_BCM63XX_CONSOLE=y
-# CONFIG_UNIX98_PTYS is not set
 # CONFIG_HW_RANDOM is not set
 # CONFIG_HWMON is not set
 # CONFIG_VGA_ARB is not set
 CONFIG_USB=y
-# CONFIG_USB_DEVICE_CLASS is not set
 CONFIG_USB_EHCI_HCD=y
 # CONFIG_USB_EHCI_TT_NEWSCHED is not set
 CONFIG_USB_OHCI_HCD=y
+CONFIG_USB_OHCI_HCD_PLATFORM=y
+CONFIG_USB_EHCI_HCD_PLATFORM=y
+CONFIG_USB_GADGET=y
+CONFIG_USB_BCM63XX_UDC=y
+CONFIG_USB_ETH=y
+CONFIG_NEW_LEDS=y
 CONFIG_LEDS_CLASS=y
 CONFIG_LEDS_GPIO=y
 CONFIG_LEDS_TRIGGER_TIMER=y
@@ -84,7 +81,6 @@ CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
 CONFIG_PROC_KCORE=y
 # CONFIG_NETWORK_FILESYSTEMS is not set
 CONFIG_MAGIC_SYSRQ=y
-CONFIG_SYSCTL_SYSCALL_CHECK=y
 CONFIG_CMDLINE_BOOL=y
 CONFIG_CMDLINE=console=ttyS0,115200
 # CONFIG_CRYPTO_HW is not set
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 07/13] MIPS: BCM63XX: register OHCI controller if board enables it

2013-01-28 Thread Florian Fainelli
BCM63XX-based boards can control the registration of the OHCI controller
by setting their has_ohci0 flag to 1. Handle this in the generic
code dealing with board registration and call the actual helper to
register the OHCI controller.

Signed-off-by: Florian Fainelli flor...@openwrt.org
---
 arch/mips/bcm63xx/boards/board_bcm963xx.c |4 
 1 file changed, 4 insertions(+)

diff --git a/arch/mips/bcm63xx/boards/board_bcm963xx.c 
b/arch/mips/bcm63xx/boards/board_bcm963xx.c
index ed1949c..9cdc023 100644
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
@@ -25,6 +25,7 @@
 #include bcm63xx_dev_flash.h
 #include bcm63xx_dev_pcmcia.h
 #include bcm63xx_dev_spi.h
+#include bcm63xx_dev_usb_ohci.h
 #include bcm63xx_dev_usb_usbd.h
 #include board_bcm963xx.h
 
@@ -851,6 +852,9 @@ int __init board_register_devices(void)
if (board.has_usbd)
bcm63xx_usbd_register(board.usbd);
 
+   if (board.has_ohci0)
+   bcm63xx_ohci_register();
+
if (board.has_dsp)
bcm63xx_dsp_register(board.dsp);
 
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 11/13] USB: EHCI: add ignore_oc flag to disable overcurrent checking

2013-01-28 Thread Florian Fainelli
This patch adds an ignore_oc flag which can be set by EHCI controller
not supporting or wanting to disable overcurrent checking. The EHCI
platform data in include/linux/usb/ehci_pdriver.h is also augmented to
take advantage of this new flag.

Signed-off-by: Florian Fainelli flor...@openwrt.org
---
 drivers/usb/host/ehci-hcd.c  |2 +-
 drivers/usb/host/ehci-hub.c  |4 ++--
 drivers/usb/host/ehci.h  |1 +
 include/linux/usb/ehci_pdriver.h |1 +
 4 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index c97503b..bd435ac 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -634,7 +634,7 @@ static int ehci_run (struct usb_hcd *hcd)
USB %x.%x started, EHCI %x.%02x%s\n,
((ehci-sbrn  0xf0)4), (ehci-sbrn  0x0f),
temp  8, temp  0xff,
-   ignore_oc ? , overcurrent ignored : );
+   (ignore_oc || ehci-ignore_oc) ? , overcurrent ignored : );
 
ehci_writel(ehci, INTR_MASK,
ehci-regs-intr_enable); /* Turn On Interrupts */
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c
index 4ccb97c..c18d4e4 100644
--- a/drivers/usb/host/ehci-hub.c
+++ b/drivers/usb/host/ehci-hub.c
@@ -611,7 +611,7 @@ ehci_hub_status_data (struct usb_hcd *hcd, char *buf)
 * always set, seem to clear PORT_OCC and PORT_CSC when writing to
 * PORT_POWER; that's surprising, but maybe within-spec.
 */
-   if (!ignore_oc)
+   if (!ignore_oc  !ehci-ignore_oc)
mask = PORT_CSC | PORT_PEC | PORT_OCC;
else
mask = PORT_CSC | PORT_PEC;
@@ -825,7 +825,7 @@ static int ehci_hub_control (
if (temp  PORT_PEC)
status |= USB_PORT_STAT_C_ENABLE  16;
 
-   if ((temp  PORT_OCC)  !ignore_oc){
+   if ((temp  PORT_OCC)  (!ignore_oc  !ehci-ignore_oc)){
status |= USB_PORT_STAT_C_OVERCURRENT  16;
 
/*
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
index 9dadc71..2136479 100644
--- a/drivers/usb/host/ehci.h
+++ b/drivers/usb/host/ehci.h
@@ -196,6 +196,7 @@ struct ehci_hcd {   /* one per controller */
unsigneduse_dummy_qh:1; /* AMD Frame List table quirk*/
unsignedhas_synopsys_hc_bug:1; /* Synopsys HC */
unsignedframe_index_bug:1; /* MosChip (AKA NetMos) */
+   unsignedignore_oc:1;
 
/* required for usb32 quirk */
#define OHCI_CTRL_HCFS  (3  6)
diff --git a/include/linux/usb/ehci_pdriver.h b/include/linux/usb/ehci_pdriver.h
index 99238b0..e2a77d3 100644
--- a/include/linux/usb/ehci_pdriver.h
+++ b/include/linux/usb/ehci_pdriver.h
@@ -42,6 +42,7 @@ struct usb_ehci_pdata {
unsignedbig_endian_desc:1;
unsignedbig_endian_mmio:1;
unsignedno_io_watchdog:1;
+   unsignedignore_oc:1;
 
/* Turn on all power and clocks */
int (*power_on)(struct platform_device *pdev);
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 08/13] MIPS: BCM63XX: introduce BCM63XX_EHCI configuration symbol

2013-01-28 Thread Florian Fainelli
This configuration symbol can be used by CPUs supporting the on-chip
EHCI controller, and ensures that all relevant EHCI-related
configuration options are selected. So far BCM6328, BCM6358 and BCM6368
have an EHCI controller and do select this symbol. Update
drivers/usb/host/Kconfig with BCM63XX to update direct unmet
dependencies.

Signed-off-by: Florian Fainelli flor...@openwrt.org
---
 arch/mips/bcm63xx/Kconfig |9 +
 drivers/usb/host/Kconfig  |5 +++--
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/arch/mips/bcm63xx/Kconfig b/arch/mips/bcm63xx/Kconfig
index 23b1ffd..b899359 100644
--- a/arch/mips/bcm63xx/Kconfig
+++ b/arch/mips/bcm63xx/Kconfig
@@ -7,10 +7,17 @@ config BCM63XX_OHCI
select USB_OHCI_BIG_ENDIAN_DESC if USB_OHCI_HCD
select USB_OHCI_BIG_ENDIAN_MMIO if USB_OHCI_HCD
 
+config BCM63XX_EHCI
+   bool
+   select USB_ARCH_HAS_EHCI
+   select USB_EHCI_BIG_ENDIAN_DESC if USB_EHCI_HCD
+   select USB_EHCI_BIG_ENDIAN_MMIO if USB_EHCI_HCD
+
 config BCM63XX_CPU_6328
bool support 6328 CPU
select HW_HAS_PCI
select BCM63XX_OHCI
+   select BCM63XX_EHCI
 
 config BCM63XX_CPU_6338
bool support 6338 CPU
@@ -28,11 +35,13 @@ config BCM63XX_CPU_6358
bool support 6358 CPU
select HW_HAS_PCI
select BCM63XX_OHCI
+   select BCM63XX_EHCI
 
 config BCM63XX_CPU_6368
bool support 6368 CPU
select HW_HAS_PCI
select BCM63XX_OHCI
+   select BCM63XX_EHCI
 endmenu
 
 source arch/mips/bcm63xx/boards/Kconfig
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index d6bb128..e16b2cb 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -115,14 +115,15 @@ config USB_EHCI_BIG_ENDIAN_MMIO
depends on USB_EHCI_HCD  (PPC_CELLEB || PPC_PS3 || 440EPX || \
ARCH_IXP4XX || XPS_USB_HCD_XILINX || \
PPC_MPC512x || CPU_CAVIUM_OCTEON || \
-   PMC_MSP || SPARC_LEON || MIPS_SEAD3)
+   PMC_MSP || SPARC_LEON || MIPS_SEAD3 || \
+   BCM63XX)
default y
 
 config USB_EHCI_BIG_ENDIAN_DESC
bool
depends on USB_EHCI_HCD  (440EPX || ARCH_IXP4XX || XPS_USB_HCD_XILINX 
|| \
PPC_MPC512x || PMC_MSP || SPARC_LEON || \
-   MIPS_SEAD3)
+   MIPS_SEAD3 || BCM63XX)
default y
 
 config XPS_USB_HCD_XILINX
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 08/13] MIPS: BCM63XX: introduce BCM63XX_EHCI configuration symbol

2013-01-28 Thread David Daney

On 01/28/2013 11:06 AM, Florian Fainelli wrote:

This configuration symbol can be used by CPUs supporting the on-chip
EHCI controller, and ensures that all relevant EHCI-related
configuration options are selected. So far BCM6328, BCM6358 and BCM6368
have an EHCI controller and do select this symbol. Update
drivers/usb/host/Kconfig with BCM63XX to update direct unmet
dependencies.

Signed-off-by: Florian Fainelli flor...@openwrt.org
---
  arch/mips/bcm63xx/Kconfig |9 +
  drivers/usb/host/Kconfig  |5 +++--
  2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/arch/mips/bcm63xx/Kconfig b/arch/mips/bcm63xx/Kconfig
index 23b1ffd..b899359 100644
--- a/arch/mips/bcm63xx/Kconfig
+++ b/arch/mips/bcm63xx/Kconfig
@@ -7,10 +7,17 @@ config BCM63XX_OHCI
select USB_OHCI_BIG_ENDIAN_DESC if USB_OHCI_HCD
select USB_OHCI_BIG_ENDIAN_MMIO if USB_OHCI_HCD

+config BCM63XX_EHCI
+   bool
+   select USB_ARCH_HAS_EHCI
+   select USB_EHCI_BIG_ENDIAN_DESC if USB_EHCI_HCD
+   select USB_EHCI_BIG_ENDIAN_MMIO if USB_EHCI_HCD
+
  config BCM63XX_CPU_6328
bool support 6328 CPU
select HW_HAS_PCI
select BCM63XX_OHCI
+   select BCM63XX_EHCI

[...]

diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index d6bb128..e16b2cb 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -115,14 +115,15 @@ config USB_EHCI_BIG_ENDIAN_MMIO
depends on USB_EHCI_HCD  (PPC_CELLEB || PPC_PS3 || 440EPX || \
ARCH_IXP4XX || XPS_USB_HCD_XILINX || \
PPC_MPC512x || CPU_CAVIUM_OCTEON || \
-   PMC_MSP || SPARC_LEON || MIPS_SEAD3)
+   PMC_MSP || SPARC_LEON || MIPS_SEAD3 || \
+   BCM63XX)
default y


This is a complete mess.

Can we get rid of the 'default y' and all those things after the '', 
and select USB_EHCI_BIG_ENDIAN_MMIO in the board Kconfig files?


I am as guilty as anyone here (see || CPU_CAVIUM_OCTEON above).  But 
this doesn't seem sustainable.  We should be trying to keep the 
configuration information for all this in one spot.


Now you have it spread across two files.  One to enable it, and the 
other to select it.  But do you really need to select it if it defaults 
to 'y'





  config USB_EHCI_BIG_ENDIAN_DESC
bool
depends on USB_EHCI_HCD  (440EPX || ARCH_IXP4XX || XPS_USB_HCD_XILINX 
|| \
PPC_MPC512x || PMC_MSP || SPARC_LEON || \
-   MIPS_SEAD3)
+   MIPS_SEAD3 || BCM63XX)
default y




Same here.

Thanks,
David (on a mission against Kconfig insanity) Daney


--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 11/13] USB: EHCI: add ignore_oc flag to disable overcurrent checking

2013-01-28 Thread Alan Stern
On Mon, 28 Jan 2013, Florian Fainelli wrote:

 This patch adds an ignore_oc flag which can be set by EHCI controller
 not supporting or wanting to disable overcurrent checking. The EHCI
 platform data in include/linux/usb/ehci_pdriver.h is also augmented to
 take advantage of this new flag.
 
 Signed-off-by: Florian Fainelli flor...@openwrt.org
 ---
  drivers/usb/host/ehci-hcd.c  |2 +-
  drivers/usb/host/ehci-hub.c  |4 ++--
  drivers/usb/host/ehci.h  |1 +
  include/linux/usb/ehci_pdriver.h |1 +
  4 files changed, 5 insertions(+), 3 deletions(-)

You forgot to add

ehci-ignore_oc = pdata-ignore_oc;

to ehci_platform_reset().  This makes me wonder: Either the patches 
were not tested very well or else the new ignore_oc stuff isn't needed.

 diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
 index c97503b..bd435ac 100644
 --- a/drivers/usb/host/ehci-hcd.c
 +++ b/drivers/usb/host/ehci-hcd.c
 @@ -634,7 +634,7 @@ static int ehci_run (struct usb_hcd *hcd)
   USB %x.%x started, EHCI %x.%02x%s\n,
   ((ehci-sbrn  0xf0)4), (ehci-sbrn  0x0f),
   temp  8, temp  0xff,
 - ignore_oc ? , overcurrent ignored : );
 + (ignore_oc || ehci-ignore_oc) ? , overcurrent ignored : );

You could simplify the code here and other places if you add

ehci-ignore_oc ||= ignore_oc;

to ehci_init().  Then you wouldn't need to test ignore_oc all the time.

Alan Stern

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 08/13] MIPS: BCM63XX: introduce BCM63XX_EHCI configuration symbol

2013-01-28 Thread Alan Stern
On Mon, 28 Jan 2013, Florian Fainelli wrote:

  --- a/drivers/usb/host/Kconfig
  +++ b/drivers/usb/host/Kconfig
  @@ -115,14 +115,15 @@ config USB_EHCI_BIG_ENDIAN_MMIO
depends on USB_EHCI_HCD  (PPC_CELLEB || PPC_PS3 || 440EPX || \
ARCH_IXP4XX || XPS_USB_HCD_XILINX || \
PPC_MPC512x || CPU_CAVIUM_OCTEON || \
  -PMC_MSP || SPARC_LEON || MIPS_SEAD3)
  +PMC_MSP || SPARC_LEON || MIPS_SEAD3 || \
  +BCM63XX)
default y
 
  This is a complete mess.
 
  Can we get rid of the 'default y' and all those things after the '',
  and select USB_EHCI_BIG_ENDIAN_MMIO in the board Kconfig files?
 
 Yes, pretty much like what exists for OHCI, scales much better.
 
 
  I am as guilty as anyone here (see || CPU_CAVIUM_OCTEON above).  But
  this doesn't seem sustainable.  We should be trying to keep the
  configuration information for all this in one spot.
 
  Now you have it spread across two files.  One to enable it, and the
  other to select it.  But do you really need to select it if it defaults
  to 'y'
 
 I do agree with you, but I don't want this patchset to be blocked by the 
 removal of the depends on (FOO  BAR  ...), but I can send a 
 preliminary patch for this and get it merged with Greg's tree first.

If you decide to do this, consider the discussion starting here:

http://marc.info/?l=linux-usbm=135886919810940w=2

As far as I know, there is no good reason for keeping the 
USB_ARCH_HAS_EHCI symbol at all.  And the glue drivers can select 
USB_EHCI_HCD instead of depending on it.

Alan Stern

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC/PATCH 29/32] usb: gadget: pxa27x_udc: let udc-core manage gadget-dev

2013-01-28 Thread Robert Jarzmik
Felipe Balbi ba...@ti.com writes:

 By simply setting a flag, we can drop some
 boilerplate code.

 Signed-off-by: Felipe Balbi ba...@ti.com
 ---
  drivers/usb/gadget/pxa27x_udc.c | 9 +
Acked-by: Robert Jarzmik robert.jarz...@free.fr

And I tested also your patch and it works in my environment. For next patches
I'd like to be CCed for pxa27x_udc stuff as I'm maintaining that one since its
beginning (and yes, I know, I didn't put that in MAINTAINERS ...).

Cheers.

--
Robert
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 03/13] MIPS: BCM63XX: move code touching the USB private register

2013-01-28 Thread Felipe Balbi
Hi,

On Mon, Jan 28, 2013 at 08:06:21PM +0100, Florian Fainelli wrote:
 diff --git a/drivers/usb/gadget/bcm63xx_udc.c 
 b/drivers/usb/gadget/bcm63xx_udc.c
 index ad17533..af450c4 100644
 --- a/drivers/usb/gadget/bcm63xx_udc.c
 +++ b/drivers/usb/gadget/bcm63xx_udc.c
 @@ -41,6 +41,7 @@
  #include bcm63xx_dev_usb_usbd.h
  #include bcm63xx_io.h
  #include bcm63xx_regs.h
 +#include bcm63xx_usb_priv.h

actually, I want to see this arch dependency vanish. The whole
phy_mode stuff should be a PHY driver, care to implement this properly
using the PHY layer ?

-- 
balbi


signature.asc
Description: Digital signature


[regression] external HDD in USB3 enclosure cannot be dynamically removed (Re: Linux 3.7.5)

2013-01-28 Thread Jonathan Nieder
Hi Holger,

Holger Hoffstaette wrote:
 On Mon, Jan 28, 2013 at 12:42:16PM +0100, Holger Hoffstaette wrote:

 Apologies for being late but I'm afraid I just found at least one
 regression in this release.

 I have an external HDD in an USB3 enclosure for the occasional backup. I
 turn it on, it gets registered as sdX, I mount it/use it/unmount it and
 turn it off, which worked fine with kernels including 3.7.4. With 3.7.5

 FWIW it didn't really work with 3.7.4 either - just didn't notice before.

 the kernel seems no longer notified of the changed device power status;
 nothing in dmesg and the device stays in the list of SCSI devices as
 e.g. shown by lsscsi. This is repeatable. Turning the device back
 on/using it works fine, it's just that I cannot dynamically remove it
 any longer.
[...]
 No, current 3.8-rc5 did not work either. I first found 3.7.2 OK and 3.7.3
 bad. Bisecting found:

 --snip--
 f7965c0846d74b270e246c1470ca955d5078eb07 is the first bad commit
 commit f7965c0846d74b270e246c1470ca955d5078eb07
 Author: Sarah Sharp sarah.a.sh...@linux.intel.com
 Date:   Wed Nov 14 17:58:04 2012 -0800

 USB: Handle warm reset failure on empty port.

 commit 65bdac5effd15d6af619b3b7218627ef4d84ed6a upstream.
[...]
 Reverting this from 3.7.3 all the way to 3.8-rc5 makes USB 3.0
 disconnection/power-off device removal work again. Verified both on the
 bisection box and by now also the original machine.

Thanks for tracking this down.  Forwarding to relevant people.

Hope that helps,
Jonathan
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 11/13] USB: EHCI: add ignore_oc flag to disable overcurrent checking

2013-01-28 Thread Florian Fainelli

Le 28/01/2013 21:08, Alan Stern a écrit :

On Mon, 28 Jan 2013, Florian Fainelli wrote:


This patch adds an ignore_oc flag which can be set by EHCI controller
not supporting or wanting to disable overcurrent checking. The EHCI
platform data in include/linux/usb/ehci_pdriver.h is also augmented to
take advantage of this new flag.

Signed-off-by: Florian Fainelli flor...@openwrt.org
---
  drivers/usb/host/ehci-hcd.c  |2 +-
  drivers/usb/host/ehci-hub.c  |4 ++--
  drivers/usb/host/ehci.h  |1 +
  include/linux/usb/ehci_pdriver.h |1 +
  4 files changed, 5 insertions(+), 3 deletions(-)


You forgot to add

ehci-ignore_oc = pdata-ignore_oc;

to ehci_platform_reset().  This makes me wonder: Either the patches
were not tested very well or else the new ignore_oc stuff isn't needed.


ignore_oc is not actually needed for all BCM63xx boards, and mine does 
not require it, but that is clearly an oversight, thanks for spotting this.





diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index c97503b..bd435ac 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -634,7 +634,7 @@ static int ehci_run (struct usb_hcd *hcd)
USB %x.%x started, EHCI %x.%02x%s\n,
((ehci-sbrn  0xf0)4), (ehci-sbrn  0x0f),
temp  8, temp  0xff,
-   ignore_oc ? , overcurrent ignored : );
+   (ignore_oc || ehci-ignore_oc) ? , overcurrent ignored : );


You could simplify the code here and other places if you add

ehci-ignore_oc ||= ignore_oc;

to ehci_init().  Then you wouldn't need to test ignore_oc all the time.

Alan Stern




--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 03/13] MIPS: BCM63XX: move code touching the USB private register

2013-01-28 Thread Florian Fainelli
On Monday 28 January 2013 22:41:14 Felipe Balbi wrote:
 Hi,
 
 On Mon, Jan 28, 2013 at 08:06:21PM +0100, Florian Fainelli wrote:
  diff --git a/drivers/usb/gadget/bcm63xx_udc.c 
  b/drivers/usb/gadget/bcm63xx_udc.c
  index ad17533..af450c4 100644
  --- a/drivers/usb/gadget/bcm63xx_udc.c
  +++ b/drivers/usb/gadget/bcm63xx_udc.c
  @@ -41,6 +41,7 @@
   #include bcm63xx_dev_usb_usbd.h
   #include bcm63xx_io.h
   #include bcm63xx_regs.h
  +#include bcm63xx_usb_priv.h
 
 actually, I want to see this arch dependency vanish. The whole
 phy_mode stuff should be a PHY driver, care to implement this properly
 using the PHY layer ?

Ok, but then I won't be able to use the generic OHCI and EHCI platform drivers
because they are not yet aware of clocks, PHY slave device etc... For now I
would like to stick with that since this is also very BCM63xx centric.

Would that be ok with you?
-- 
Florian
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: Endpoint flushing is not safe against URB removal

2013-01-28 Thread Anton Tikhomirov
Hello,

Sorry for my haste, I missed that. We have situation when CPU
stalls in usb_hcd_flush_endpoint(), so at first glance it looked
strange for me. Will analyze more.

Thank you.

 On Mon, 28 Jan 2013, Anton Tikhomirov wrote:
 
  Hello,
 
  In drivers/usb/core/hcd.c: usb_hcd_flush_endpoint() uses
  list_for_each_entry() to unlink URBs pending on
  endpoint. At the same time unlink1() calls usb_rh_urb_dequeue()
  where URB is removed from its endpoint queue:
 
  void usb_hcd_unlink_urb_from_ep(struct usb_hcd *hcd, struct urb *urb)
  {
  /* clear all state linking urb to this dev (and hcd) */
  spin_lock(hcd_urb_list_lock);
  list_del_init(urb-urb_list);
  spin_unlock(hcd_urb_list_lock);
  }
 
  Shall we use safe version of list_for_each_entry() for cancelling
 URBs?
 
 No.  Read usb_hcd_flush_endpoint() more closely.  After calling
 unlink1() it restarts the loop from the beginning.
 
 Alan Stern
 
 --
 To unsubscribe from this list: send the line unsubscribe linux-usb in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Donated code: xHCI debug capability driver

2013-01-28 Thread Greg KH
On Mon, Jan 28, 2013 at 09:18:54PM +, Paul Zimmerman wrote:
 Hi Sarah,
 
 We (Synopsys) would like to donate the attached code for driving the debug
 capability of the xHCI controller.
 
 We used this code to test the debug capability of our USB3 IP core. As it
 stands, this is test code rather than fully-fledged Linux driver code, but it
 can be used as a starting point for a complete driver. So although it is
 provided as a patch, it is not intended to be applied in its current form.
 
 This code does not implement a gdb interface; rather it has a kernel thread
 which can do two things - either source a continuous stream of packets on
 the IN endpoint and sink whatever is sent to it on the OUT endpoint, or
 receive whatever is sent to it on the OUT endpoint and echo it back on the
 IN endpoint. The mode is selected by the DBC_SRC_SINK #define at the
 top of the file. We used this, along with the usbtest module and testusb
 program on the host side, to send/receive a constant stream of packets
 over the two bulk endpoints.
 
 Some other things that are missing:
   - Code to handle bulk endpoint STALL.
   - Code to handle endpoint error conditions.
   - Since I had some difficulty with the dbc_td_remainder/
  dbc_v1_0_td_remainder functions, I just used 0 for the
  remainder value. I saw you have made some fixes to
  those functions since then, so maybe they would work now.
 
 Patch is against 3.6-rc3 (sorry, that was current back when I did this work).

Could you send this with a proper Signed-off-by: so everyone knows
that this work is ok to use in future Linux kernel code?

thanks,

greg k-h
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v4 2/2] usb: phy: samsung: Add PHY support for USB 3.0 controller

2013-01-28 Thread Vivek Gautam
CC: Doug Anderson


On Mon, Jan 28, 2013 at 3:56 PM, Vivek Gautam gautam.vi...@samsung.com wrote:
 Adding PHY driver support for USB 3.0 controller for Samsung's
 SoCs.

 Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
 ---

 Changes from v3:
  - Making SAMSUNG_USB3PHY dependent on SAMSUNG_USBPHY.
  - Adding USB_DWC3 to dependencies of SAMSUNG_USB2PHY since
dwc3 controller also looks for USB2 type PHY.

  drivers/usb/phy/Kconfig  |   11 +-
  drivers/usb/phy/Makefile |1 +
  drivers/usb/phy/samsung-usb3.c   |  349 
 ++
  drivers/usb/phy/samsung-usbphy.h |   81 +
  4 files changed, 441 insertions(+), 1 deletions(-)
  create mode 100644 drivers/usb/phy/samsung-usb3.c

 diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
 index cc0d230..9325a95 100644
 --- a/drivers/usb/phy/Kconfig
 +++ b/drivers/usb/phy/Kconfig
 @@ -52,14 +52,23 @@ config SAMSUNG_USBPHY
 help
   Enable this to support Samsung USB phy controllers for Samsung
   SoCs.
 + Further enable USB 2.0 type PHY or USB 3.0 type PHY as required
 + for USB controllers in use.

  if SAMSUNG_USBPHY

  config SAMSUNG_USB2PHY
 bool Samsung USB 2.0 PHY controller Driver
 -   depends on USB_S3C_HSOTG || USB_EHCI_S5P || USB_OHCI_EXYNOS
 +   depends on USB_S3C_HSOTG || USB_EHCI_S5P || USB_OHCI_EXYNOS || 
 USB_DWC3
 help
   Enable this to support Samsung USB 2.0 (High Speed) phy controller
   for Samsung SoCs.

 +config SAMSUNG_USB3PHY
 +   bool Samsung USB 3.0 PHY controller Driver
 +   depends on USB_DWC3
 +   help
 + Enable this to support Samsung USB 3.0 (Super Speed) phy controller
 + for samsung SoCs.
 +
  endif
 diff --git a/drivers/usb/phy/Makefile b/drivers/usb/phy/Makefile
 index 7ba9862..b8505ac 100644
 --- a/drivers/usb/phy/Makefile
 +++ b/drivers/usb/phy/Makefile
 @@ -11,3 +11,4 @@ obj-$(CONFIG_USB_EHCI_TEGRA)  += tegra_usb_phy.o
  obj-$(CONFIG_USB_RCAR_PHY) += rcar-phy.o
  obj-$(CONFIG_SAMSUNG_USBPHY)   += samsung-usbphy.o
  obj-$(CONFIG_SAMSUNG_USB2PHY)  += samsung-usb2.o
 +obj-$(CONFIG_SAMSUNG_USB3PHY)  += samsung-usb3.o
 diff --git a/drivers/usb/phy/samsung-usb3.c b/drivers/usb/phy/samsung-usb3.c
 new file mode 100644
 index 000..29e1321
 --- /dev/null
 +++ b/drivers/usb/phy/samsung-usb3.c
 @@ -0,0 +1,349 @@
 +/* linux/drivers/usb/phy/samsung-usb3.c
 + *
 + * Copyright (c) 2012 Samsung Electronics Co., Ltd.
 + *  http://www.samsung.com
 + *
 + * Author: Vivek Gautam gautam.vi...@samsung.com
 + *
 + * Samsung USB 3.0 PHY transceiver; talks to DWC3 controller.
 + *
 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License version 2 as
 + * published by the Free Software Foundation.
 + *
 + * 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.
 + */
 +
 +#include linux/module.h
 +#include linux/platform_device.h
 +#include linux/clk.h
 +#include linux/delay.h
 +#include linux/err.h
 +#include linux/io.h
 +#include linux/of.h
 +#include linux/usb/samsung_usb_phy.h
 +#include linux/platform_data/samsung-usbphy.h
 +
 +#include samsung-usbphy.h
 +
 +/*
 + * Sets the phy clk as EXTREFCLK (XXTI) which is internal clock from clock 
 core.
 + */
 +static u32 samsung_usb3_phy_set_refclk(struct samsung_usbphy *sphy)
 +{
 +   u32 reg;
 +   u32 refclk;
 +
 +   refclk = sphy-ref_clk_freq;
 +
 +   reg = PHYCLKRST_REFCLKSEL_EXT_REFCLK |
 +   PHYCLKRST_FSEL(refclk);
 +
 +   switch (refclk) {
 +   case FSEL_CLKSEL_50M:
 +   reg |= (PHYCLKRST_MPLL_MULTIPLIER_50M_REF |
 +   PHYCLKRST_SSC_REFCLKSEL(0x00));
 +   break;
 +   case FSEL_CLKSEL_20M:
 +   reg |= (PHYCLKRST_MPLL_MULTIPLIER_20MHZ_REF |
 +   PHYCLKRST_SSC_REFCLKSEL(0x00));
 +   break;
 +   case FSEL_CLKSEL_19200K:
 +   reg |= (PHYCLKRST_MPLL_MULTIPLIER_19200KHZ_REF |
 +   PHYCLKRST_SSC_REFCLKSEL(0x88));
 +   break;
 +   case FSEL_CLKSEL_24M:
 +   default:
 +   reg |= (PHYCLKRST_MPLL_MULTIPLIER_24MHZ_REF |
 +   PHYCLKRST_SSC_REFCLKSEL(0x88));
 +   break;
 +   }
 +
 +   return reg;
 +}
 +
 +static int samsung_exynos5_usb3_phy_enable(struct samsung_usbphy *sphy)
 +{
 +   void __iomem *regs = sphy-regs;
 +   u32 phyparam0;
 +   u32 phyparam1;
 +   u32 linksystem;
 +   u32 phybatchg;
 +   u32 phytest;
 +   u32 phyclkrst;
 +
 +   /* Reset USB 3.0 PHY */
 +   writel(0x0, regs + EXYNOS5_DRD_PHYREG0);
 +
 +   phyparam0 = readl(regs + 

Re: ehci with full speed audio device leaking sitds

2013-01-28 Thread Andy Leiserson
On Sun, Jan 27, 2013 at 08:07:01PM -0500, Alan Stern wrote:
 This is a place where 3.8 has changed from 3.6.  Does your problem go 
 away if you revert the first hunk of your patch and simply set
 
   ehci-next_frame = (now_frame - 1)  fmask;
 
 here?

Yes, this by itself does resolve the problem.

I also tried applying the changes since 3.6.11 that touch ehci-sched.c,
and then changing the logic for last_iso_frame to do as above and start
the next scan one frame earlier, and that's also working.

Thanks.

On Sun, Jan 27, 2013 at 08:07:01PM -0500, Alan Stern wrote:
 On Sun, 27 Jan 2013, Andy Leiserson wrote:
 
  Please CC me on replies, as I'm not on the list.
  
  My system is an AR9132 mips SoC, kernel 3.6.11 with OpenWrt patches.
  The audio device is a C-Media usb audio adapter, IDs 0d8c/000e. It is a
  full speed device, and is connected directly to the only USB port. I'm
  using only the output, but it does have a mic input as well. (There are
  also various controls, e.g. mute, suggested by the USB descriptors, but
  those aren't present on my device.)
  
  The device was working fine with OpenWrt-patched kernel 3.3.8.
  
  With the new kernel, I have the following problems:
   * audio output is choppy (underruns). the usb audio driver
 intermittently prints:
  
 ALSA sound/usb/pcm.c:1187 delay: estimated 624, actual 288
  
 (I realize the message is not directly indicative of an underrun, but
 I believe the underruns and the message are correlated)
  
 This tends to get worse as playback progresses, and sometimes there
 are cannot submit urb messages with error -27, and sometimes
 playback hangs.
  
   * audio programs almost always hang in D state when closing the audio
 device.
  
  I investigated the second problem first in hopes I could eliminate the
  reboot after each experiment, but in the end, both problems went away
  simultaneously.
 
 You should be aware that there have been changes to the periodic 
 scanning code in ehci-hcd since the kernel you've been using.  It might 
 matter (although I suspect it doesn't).
 
  I tracked the hang to the sleep in ehci_endpoint_disable that waits for
  active iso transactions to finish (indicated by stream-td_list being
  empty).
  
  My theory is that the changes in
  f42890782241a60d107f23d08089a4a12b507a11 (USB: EHCI: simplify
  isochronous scanning) result in leakage of sitds when still-active
  sitds in the previous frame are skipped by scan_isoc. I don't know why
  this results in the underruns, but it is a low-memory embedded system,
  so possibly it's just leaking enough descriptors to run out of
  dma-eligible memory.
 
 It looks like you are right.  Those sitds are supposed to get 
 deallocated the next time scan_isoc runs, but they probably aren't.
 
  The patch below restores the behavior before commit f428 of stopping the
  scan immediately once a still-active descriptor is found (and leaving
  next_frame at the previous frame rather than the current frame if
  appropriate). This patch resolves the problems I've been seeing, but I
  don't know if it's the best fix.
 
 Stopping the scan is the wrong thing to do, but I think you may be 
 right about the next_frame value.
 
  I have various ftrace captures, which I can post somewhere if there's
  interest. Some of them have the iso stream refcounting restored, and
  clearly show that there aren't as many puts as gets. The detail of
  scan_isoc behavior isn't visible in the traces, though.
 
 The gets and puts shouldn't matter.  As long as the sitd structures get 
 deallocated when they aren't active any more, everything should work 
 properly.
 
  (An aside: I noticed there is an rmb() before the itd status check, but
  not before the sitd status check.)
 
 That's because the itd code loops over the members of 
 q.itd-hw_transaction whereas the sitd code does nothing of the sort.
 
  --- a/drivers/usb/host/ehci-sched.c 2013-01-26 19:37:21.0 -0800
  +++ b/drivers/usb/host/ehci-sched.c 2013-01-26 19:39:25.0 -0800
  @@ -2296,7 +2296,7 @@
  type = Q_NEXT_TYPE(ehci,
  q.sitd-hw_next);
  q = *q_p;
  -   break;
  +   goto end_scan;
 
 No, we definitely shouldn't be doing this.
 
  }
   
  /* Take finished SITDs out of the schedule
  @@ -2336,5 +2336,6 @@
  break;
  frame = (frame + 1)  fmask;
  }
  -   ehci-next_frame = now_frame;
  +end_scan:
  +   ehci-next_frame = frame;
   }
 
 This is a place where 3.8 has changed from 3.6.  Does your problem go 
 away if you revert the first hunk of your patch and simply set
 
   ehci-next_frame = (now_frame - 1)  fmask;
 
 here?
 
 Alan Stern
 
 
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body 

Re: [PATCH v4 3/4] ARM: Exynos5250: Add clock information for dwc3-exynos

2013-01-28 Thread Vivek Gautam
Hi Tomasz,


On Wed, Jan 16, 2013 at 8:35 PM, Vivek Gautam gautamvivek1...@gmail.com wrote:
 Hi Tomasz,


 On Wed, Jan 16, 2013 at 1:19 PM, Tomasz Figa tomasz.f...@gmail.com wrote:
 Hi Vivek,

 Don't you need also some clkdev lookup entry to make the clock available
 in the driver?


 This clock source we added with a motive of completion, however it's
 not being used as of now.
 As far as i could see the lookup structure contains clocks for devices
 having multiple instances.
 Do you feel that i should be adding an entry in clk_lookup structure ?
 May be i am missing here something. Can you please elaborate on the
 use-case of clk_lookup
 entries.


As indicated above sclk_usbdrd30 is added with a motive of
completion, however it's
not being used as of now.
And usbdrd30 is the actual device clock used, where 'drd30' is just
an indicative of
'dual role device and usb 3.0'. So the clock name 'usbdrd30' is the
usb 3.0 clock for drd.

Am i missing something that you wanted to convey here ?


 On Tuesday 15 of January 2013 19:08:31 Vivek Gautam wrote:
 Adding necessary device clock to exynos5 needed for
 the DWC3 controller.

 Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
 ---
  arch/arm/mach-exynos/clock-exynos5.c |   24 
  1 files changed, 24 insertions(+), 0 deletions(-)

 diff --git a/arch/arm/mach-exynos/clock-exynos5.c
 b/arch/arm/mach-exynos/clock-exynos5.c index 0208c3a..13af020 100644
 --- a/arch/arm/mach-exynos/clock-exynos5.c
 +++ b/arch/arm/mach-exynos/clock-exynos5.c
 @@ -757,6 +757,11 @@ static struct clk exynos5_init_clocks_off[] = {
   .enable = exynos5_clk_ip_fsys_ctrl ,
   .ctrlbit= (1  18),
   }, {
 + .name   = usbdrd30,
 + .parent = exynos5_clk_aclk_200.clk,
 + .enable = exynos5_clk_ip_fsys_ctrl,
 + .ctrlbit= (1  19),
 + }, {
   .name   = usbotg,
   .enable = exynos5_clk_ip_fsys_ctrl,
   .ctrlbit= (1  7),
 @@ -1035,6 +1040,16 @@ static struct clksrc_sources exynos5_clkset_group
 = { .nr_sources   = ARRAY_SIZE(exynos5_clkset_group_list),
  };

 +struct clk *exynos5_clkset_usbdrd30_list[] = {
 + [0] = exynos5_clk_mout_mpll.clk,
 + [1] = exynos5_clk_mout_cpll.clk,
 +};
 +
 +struct clksrc_sources exynos5_clkset_usbdrd30 = {
 + .sources= exynos5_clkset_usbdrd30_list,
 + .nr_sources = ARRAY_SIZE(exynos5_clkset_usbdrd30_list),
 +};
 +
  /* Possible clock sources for aclk_266_gscl_sub Mux */
  static struct clk *clk_src_gscl_266_list[] = {
   [0] = clk_ext_xtal_mux,
 @@ -1329,6 +1344,15 @@ static struct clksrc_clk exynos5_clksrcs[] = {
   .parent = exynos5_clk_mout_cpll.clk,
   },
   .reg_div = { .reg = EXYNOS5_CLKDIV_GEN, .shift = 4, .size = 3
 },
 + }, {
 + .clk= {
 + .name   = sclk_usbdrd30,
 + .enable = exynos5_clksrc_mask_fsys_ctrl,
 + .ctrlbit= (1  28),
 + },
 + .sources = exynos5_clkset_usbdrd30,
 + .reg_src = { .reg = EXYNOS5_CLKSRC_FSYS, .shift = 28, .size =
 1 },
 + .reg_div = { .reg = EXYNOS5_CLKDIV_FSYS0, .shift = 24, .size =
 4 },
   },
  };




-- 
Thanks  Regards
Vivek
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 03/13] MIPS: BCM63XX: move code touching the USB private register

2013-01-28 Thread Felipe Balbi
Hi,

On Mon, Jan 28, 2013 at 10:17:15PM +0100, Florian Fainelli wrote:
 On Monday 28 January 2013 22:41:14 Felipe Balbi wrote:
  Hi,
  
  On Mon, Jan 28, 2013 at 08:06:21PM +0100, Florian Fainelli wrote:
   diff --git a/drivers/usb/gadget/bcm63xx_udc.c 
   b/drivers/usb/gadget/bcm63xx_udc.c
   index ad17533..af450c4 100644
   --- a/drivers/usb/gadget/bcm63xx_udc.c
   +++ b/drivers/usb/gadget/bcm63xx_udc.c
   @@ -41,6 +41,7 @@
#include bcm63xx_dev_usb_usbd.h
#include bcm63xx_io.h
#include bcm63xx_regs.h
   +#include bcm63xx_usb_priv.h
  
  actually, I want to see this arch dependency vanish. The whole
  phy_mode stuff should be a PHY driver, care to implement this properly
  using the PHY layer ?
 
 Ok, but then I won't be able to use the generic OHCI and EHCI platform drivers
 because they are not yet aware of clocks, PHY slave device etc... For now I
 would like to stick with that since this is also very BCM63xx centric.
 
 Would that be ok with you?

sure, but we need to see a move towards making all of this generic and,
perhaps more importantly (at least to me), compilable on all arches so
we can make proper use of linux-next and Fengguang's build systems.

-- 
balbi


signature.asc
Description: Digital signature


[PATCH v3] musb: blackfin: add bf60x support

2013-01-28 Thread Bob Liu
This patch makes musb can work on blackfin bf60x series platform.
Bf60x uses MHDRC RTL version 2.0 musb ip core which don't need a lot of blackfin
specific anomalies anymore.

Signed-off-by: Bob Liu lliu...@gmail.com
---
 drivers/usb/musb/Kconfig |2 +-
 drivers/usb/musb/blackfin.c  |   52 --
 drivers/usb/musb/musb_core.c |6 +++--
 drivers/usb/musb/musb_core.h |2 +-
 drivers/usb/musb/musb_dma.h  |2 +-
 drivers/usb/musb/musb_io.h   |2 +-
 drivers/usb/musb/musb_regs.h |2 +-
 drivers/usb/musb/musbhsdma.c |2 +-
 drivers/usb/musb/musbhsdma.h |2 +-
 10 files changed, 52 insertions(+), 26 deletions(-)

diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig
index 23a0b7f..4d416bc 100644
--- a/drivers/usb/musb/Kconfig
+++ b/drivers/usb/musb/Kconfig
@@ -60,7 +60,7 @@ config USB_MUSB_DSPS
 
 config USB_MUSB_BLACKFIN
tristate Blackfin
-   depends on (BF54x  !BF544) || (BF52x  ! BF522  !BF523)
+   depends on (BF54x  !BF544) || (BF52x  ! BF522  !BF523) || (BF60x)
 
 config USB_MUSB_UX500
tristate U8500 and U5500
diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c
index 14dab9f..74dd8cf 100644
--- a/drivers/usb/musb/blackfin.c
+++ b/drivers/usb/musb/blackfin.c
@@ -36,6 +36,7 @@ struct bfin_glue {
 /*
  * Load an endpoint's FIFO
  */
+#ifndef CONFIG_BF60x
 void musb_write_fifo(struct musb_hw_ep *hw_ep, u16 len, const u8 *src)
 {
struct musb *musb = hw_ep-musb;
@@ -164,6 +165,7 @@ void musb_read_fifo(struct musb_hw_ep *hw_ep, u16 len, u8 
*dst)
 
dump_fifo_data(dst, len);
 }
+#endif
 
 static irqreturn_t blackfin_interrupt(int irq, void *__hci)
 {
@@ -192,6 +194,12 @@ static irqreturn_t blackfin_interrupt(int irq, void *__hci)
musb-a_wait_bcon = TIMER_DELAY;
}
 
+#ifdef CONFIG_BF60x
+   if (musb-int_usb  MUSB_INTR_DISCONNECT  is_host_active(musb)) {
+   musb-xceiv-state = OTG_STATE_B_IDLE;
+   bfin_write_USB_VBUS_CTL(0x00);
+   }
+#endif
spin_unlock_irqrestore(musb-lock, flags);
 
return retval;
@@ -349,6 +357,7 @@ static int bfin_musb_adjust_channel_params(struct 
dma_channel *channel,
 
 static void bfin_musb_reg_init(struct musb *musb)
 {
+#ifndef CONFIG_BF60x
if (ANOMALY_05000346) {
bfin_write_USB_APHY_CALIB(ANOMALY_05000346_value);
SSYNC();
@@ -383,11 +392,20 @@ static void bfin_musb_reg_init(struct musb *musb)
EP2_RX_ENA | EP3_RX_ENA | EP4_RX_ENA |
EP5_RX_ENA | EP6_RX_ENA | EP7_RX_ENA);
SSYNC();
+#else
+   bfin_write_USB_PLLOSC_CTRL((480/musb-config-clkin)  1);
+   SSYNC();
+
+   bfin_write_USB_VBUS_CTL(0x00);
+   bfin_write_USB_APHY_CNTRL(0x80);
+   SSYNC();
+   musb-config-ram_bits = musb_readb(musb-mregs, MUSB_RAMINFO)  0xf;
+#endif
 }
 
 static int bfin_musb_init(struct musb *musb)
 {
-
+#ifndef CONFIG_BF60x
/*
 * Rev 1.0 BF549 EZ-KITs require PE7 to be high for both DEVICE
 * and OTG HOST modes, while rev 1.1 and greater require PE7 to
@@ -401,7 +419,7 @@ static int bfin_musb_init(struct musb *musb)
return -ENODEV;
}
gpio_direction_output(musb-config-gpio_vrsel, 0);
-
+#endif
usb_nop_xceiv_register();
musb-xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
if (IS_ERR_OR_NULL(musb-xceiv)) {
@@ -414,10 +432,11 @@ static int bfin_musb_init(struct musb *musb)
setup_timer(musb_conn_timer, musb_conn_timer_handler,
(unsigned long) musb);
 
+#ifndef CONFIG_BF60x
musb-xceiv-set_power = bfin_musb_set_power;
-
-   musb-isr = blackfin_interrupt;
musb-double_buffer_not_ok = true;
+#endif
+   musb-isr = blackfin_interrupt;
 
return 0;
 }
@@ -523,18 +542,12 @@ static int bfin_remove(struct platform_device *pdev)
 #ifdef CONFIG_PM
 static int bfin_suspend(struct device *dev)
 {
-   struct bfin_glue*glue = dev_get_drvdata(dev);
-   struct musb *musb = glue_to_musb(glue);
-
-   if (is_host_active(musb))
-   /*
-* During hibernate gpio_vrsel will change from high to low
-* low which will generate wakeup event resume the system
-* immediately.  Set it to 0 before hibernate to avoid this
-* wakeup event.
-*/
-   gpio_set_value(musb-config-gpio_vrsel, 0);
-
+#ifdef CONFIG_BF60x
+   int aphy = 0;
+   aphy = bfin_read_USB_APHY_CNTRL();
+   bfin_write_USB_APHY_CNTRL(aphy | 0x1);
+   SSYNC();
+#endif
return 0;
 }
 
@@ -542,7 +555,12 @@ static int bfin_resume(struct device *dev)
 {
struct bfin_glue*glue = dev_get_drvdata(dev);
struct musb *musb = glue_to_musb(glue);
-
+#ifdef CONFIG_BF60x
+   int aphy;
+   aphy = bfin_read_USB_APHY_CNTRL();
+   

  1   2   >