[PATCH v7 0/8] Add tested id switch and vbus connect detect support for Chipidea

2013-02-04 Thread Peter Chen
Changes for v6:
For Patch 8/8, we only need to set ci-driver to NULL when usb cable
is not connected, for other changes, it will case some runtime pm
unmatch and un-align with udc-core  composite driver problems.

Changes for v5:
- Add Alex comments for init/destroy function [3/8] [4/8]
- Remove memset(ci-gadget, 0, sizeof(ci-gadget)) at destory function [4/8]
- Add Kishon's comment: Change the format of struct usb_otg otg at 
drivers/usb/chipidea/ci.h
[1/8]
- Add comments for CI_VBUS_STABLE_TIMEOUT [3/8]
- Change the otg_set_peripheral return value check as the fully
chipidea driver users don't need it. [4/8]
- Fix one bug that the oops when re-plug in usb cable after
rmmod gadget [8/8]

Anyone who has tested this patchset, please give a tested-by, thanks.

This patchset adds tested otg id switch function and
vbus connect/disconnect detection for chipidea driver.
The mainly design of id/vbus handling follows msm otg driver.
I hope the msm usb maintainer can have a look of this patchset,
and give some comments, and move the whole msm usb driver to
chipidea framework if possible in the future.

This patch is fully tested at imx6 sabrelite platform.
My chipidea repo: https://github.com/hzpeterchen/linux-usb.git
which is rebased of 3.8-rc5.

Peter Chen (8):
  Revert USB: chipidea: add vbus detect for udc
  usb: chipidea: add otg file
  usb: chipidea: add otg id switch and vbus connect/disconnect detect
  usb: chipidea: consolidate kinds of APIs for both roles
  usb: chipidea: udc: add pullup/pulldown dp at hw_device_state
  usb: chipidea: udc: retire the flag CI13_PULLUP_ON_VBUS
  usb: chipidea: imx: add internal vbus regulator control
  usb: chipidea: udc: fix the oops when plugs in usb cable after rmmod
gadget

 drivers/usb/chipidea/Makefile  |2 +-
 drivers/usb/chipidea/bits.h|   10 ++
 drivers/usb/chipidea/ci.h  |   12 ++-
 drivers/usb/chipidea/ci13xxx_imx.c |   81 
 drivers/usb/chipidea/ci13xxx_msm.c |1 -
 drivers/usb/chipidea/core.c|  186 +++-
 drivers/usb/chipidea/host.c|6 +
 drivers/usb/chipidea/host.h|4 +-
 drivers/usb/chipidea/otg.c |   68 +
 drivers/usb/chipidea/otg.h |9 ++
 drivers/usb/chipidea/udc.c |  107 +
 drivers/usb/chipidea/udc.h |4 +-
 include/linux/usb/chipidea.h   |1 -
 13 files changed, 379 insertions(+), 112 deletions(-)
 create mode 100644 drivers/usb/chipidea/otg.c
 create mode 100644 drivers/usb/chipidea/otg.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


[PATCH v7 2/8] usb: chipidea: add otg file

2013-02-04 Thread Peter Chen
Implement struct usb_otg, In that way, calling otg_set_peripheral
will not be failed at udc.c.

Signed-off-by: Peter Chen peter.c...@freescale.com
---
 drivers/usb/chipidea/Makefile |2 +-
 drivers/usb/chipidea/ci.h |2 +
 drivers/usb/chipidea/otg.c|   60 +
 drivers/usb/chipidea/otg.h|6 
 4 files changed, 69 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/chipidea/Makefile b/drivers/usb/chipidea/Makefile
index d92ca32..11f513c 100644
--- a/drivers/usb/chipidea/Makefile
+++ b/drivers/usb/chipidea/Makefile
@@ -2,7 +2,7 @@ ccflags-$(CONFIG_USB_CHIPIDEA_DEBUG) := -DDEBUG
 
 obj-$(CONFIG_USB_CHIPIDEA) += ci_hdrc.o
 
-ci_hdrc-y  := core.o
+ci_hdrc-y  := core.o otg.o
 ci_hdrc-$(CONFIG_USB_CHIPIDEA_UDC) += udc.o
 ci_hdrc-$(CONFIG_USB_CHIPIDEA_HOST)+= host.o
 ci_hdrc-$(CONFIG_USB_CHIPIDEA_DEBUG)   += debug.o
diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h
index d738603..697e369 100644
--- a/drivers/usb/chipidea/ci.h
+++ b/drivers/usb/chipidea/ci.h
@@ -129,6 +129,7 @@ struct hw_bank {
  * @vbus_active: is VBUS active
  * @transceiver: pointer to USB PHY, if any
  * @hcd: pointer to usb_hcd for ehci host driver
+ * @otg: for otg support
  */
 struct ci13xxx {
struct device   *dev;
@@ -164,6 +165,7 @@ struct ci13xxx {
boolglobal_phy;
struct usb_phy  *transceiver;
struct usb_hcd  *hcd;
+   struct usb_otg  otg;
 };
 
 static inline struct ci_role_driver *ci_role(struct ci13xxx *ci)
diff --git a/drivers/usb/chipidea/otg.c b/drivers/usb/chipidea/otg.c
new file mode 100644
index 000..7dea3b3
--- /dev/null
+++ b/drivers/usb/chipidea/otg.c
@@ -0,0 +1,60 @@
+/*
+ * otg.c - ChipIdea USB IP core OTG driver
+ *
+ * Copyright (C) 2012 Freescale Semiconductor, Inc.
+ *
+ * Author: Peter Chen
+ *
+ * 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.
+ */
+
+#include linux/platform_device.h
+#include linux/module.h
+#include linux/io.h
+#include linux/irq.h
+#include linux/kernel.h
+#include linux/slab.h
+#include linux/usb/gadget.h
+#include linux/usb/otg.h
+#include linux/usb/chipidea.h
+
+#include ci.h
+#include udc.h
+#include bits.h
+#include host.h
+#include debug.h
+
+static int ci_otg_set_peripheral(struct usb_otg *otg,
+   struct usb_gadget *periph)
+{
+   otg-gadget = periph;
+
+   return 0;
+}
+
+static int ci_otg_set_host(struct usb_otg *otg, struct usb_bus *host)
+{
+   otg-host = host;
+
+   return 0;
+}
+
+/**
+ * ci_hdrc_otg_init - initialize device related bits
+ * ci: the controller
+ *
+ * This function create otg struct, if the device can switch between
+ * device and host.
+ */
+int ci_hdrc_otg_init(struct ci13xxx *ci)
+{
+   /* Useless at current */
+   ci-otg.set_peripheral = ci_otg_set_peripheral;
+   ci-otg.set_host = ci_otg_set_host;
+   if (!IS_ERR_OR_NULL(ci-transceiver))
+   ci-transceiver-otg = ci-otg;
+
+   return 0;
+}
diff --git a/drivers/usb/chipidea/otg.h b/drivers/usb/chipidea/otg.h
new file mode 100644
index 000..b4c6b3e
--- /dev/null
+++ b/drivers/usb/chipidea/otg.h
@@ -0,0 +1,6 @@
+#ifndef __DRIVERS_USB_CHIPIDEA_OTG_H
+#define __DRIVERS_USB_CHIPIDEA_OTG_H
+
+int ci_hdrc_otg_init(struct ci13xxx *ci);
+
+#endif /* __DRIVERS_USB_CHIPIDEA_OTG_H */
-- 
1.7.0.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 v7 3/8] usb: chipidea: add otg id switch and vbus connect/disconnect detect

2013-02-04 Thread Peter Chen
The main design flow is the same with msm otg driver, that is the id and
vbus interrupt are handled at core driver, others are handled by
individual drivers.

- At former design, when switch usb role from device-host, it will call
udc_stop, it will remove the gadget driver, so when switch role
from host-device, it can't add gadget driver any more.
At new design, when role switch occurs, the gadget just calls
usb_gadget_vbus_disconnect/usb_gadget_vbus_connect as well as
reset controller, it will not free any device/gadget structure

- Add vbus connect and disconnect to core interrupt handler, it can
notify udc driver by calling usb_gadget_vbus_disconnect
/usb_gadget_vbus_connect.

Signed-off-by: Peter Chen peter.c...@freescale.com
---
 drivers/usb/chipidea/bits.h |   10 +++
 drivers/usb/chipidea/ci.h   |6 ++
 drivers/usb/chipidea/core.c |  182 +++
 drivers/usb/chipidea/otg.c  |   28 ---
 drivers/usb/chipidea/otg.h  |3 +
 drivers/usb/chipidea/udc.c  |2 +
 6 files changed, 206 insertions(+), 25 deletions(-)

diff --git a/drivers/usb/chipidea/bits.h b/drivers/usb/chipidea/bits.h
index 050de85..ba9c6ef 100644
--- a/drivers/usb/chipidea/bits.h
+++ b/drivers/usb/chipidea/bits.h
@@ -65,11 +65,21 @@
 #define OTGSC_ASVIS  BIT(18)
 #define OTGSC_BSVIS  BIT(19)
 #define OTGSC_BSEIS  BIT(20)
+#define OTGSC_1MSIS  BIT(21)
+#define OTGSC_DPIS   BIT(22)
 #define OTGSC_IDIE   BIT(24)
 #define OTGSC_AVVIE  BIT(25)
 #define OTGSC_ASVIE  BIT(26)
 #define OTGSC_BSVIE  BIT(27)
 #define OTGSC_BSEIE  BIT(28)
+#define OTGSC_1MSIE  BIT(29)
+#define OTGSC_DPIE   BIT(30)
+#define OTGSC_INT_EN_BITS  (OTGSC_IDIE | OTGSC_AVVIE | OTGSC_ASVIE \
+   | OTGSC_BSVIE | OTGSC_BSEIE | OTGSC_1MSIE \
+   | OTGSC_DPIE)
+#define OTGSC_INT_STATUS_BITS  (OTGSC_IDIS | OTGSC_AVVIS | OTGSC_ASVIS \
+   | OTGSC_BSVIS | OTGSC_BSEIS | OTGSC_1MSIS \
+   | OTGSC_DPIS)
 
 /* USBMODE */
 #define USBMODE_CM(0x03UL   0)
diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h
index 697e369..325d790 100644
--- a/drivers/usb/chipidea/ci.h
+++ b/drivers/usb/chipidea/ci.h
@@ -130,6 +130,7 @@ struct hw_bank {
  * @transceiver: pointer to USB PHY, if any
  * @hcd: pointer to usb_hcd for ehci host driver
  * @otg: for otg support
+ * @events: events for otg, and handled at ci_role_work
  */
 struct ci13xxx {
struct device   *dev;
@@ -140,6 +141,7 @@ struct ci13xxx {
enum ci_rolerole;
boolis_otg;
struct work_struct  work;
+   struct delayed_work dwork;
struct workqueue_struct *wq;
 
struct dma_pool *qh_pool;
@@ -166,6 +168,8 @@ struct ci13xxx {
struct usb_phy  *transceiver;
struct usb_hcd  *hcd;
struct usb_otg  otg;
+   boolid_event;
+   boolb_sess_valid_event;
 };
 
 static inline struct ci_role_driver *ci_role(struct ci13xxx *ci)
@@ -314,4 +318,6 @@ int hw_port_test_set(struct ci13xxx *ci, u8 mode);
 
 u8 hw_port_test_get(struct ci13xxx *ci);
 
+void ci_handle_vbus_change(struct ci13xxx *ci);
+
 #endif /* __DRIVERS_USB_CHIPIDEA_CI_H */
diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index 57cae1f..8857b2c 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -73,6 +73,7 @@
 #include bits.h
 #include host.h
 #include debug.h
+#include otg.h
 
 /* Controller register map */
 static uintptr_t ci_regs_nolpm[] = {
@@ -199,6 +200,14 @@ static int hw_device_init(struct ci13xxx *ci, void __iomem 
*base)
if (ci-hw_ep_max  ENDPT_MAX)
return -ENODEV;
 
+   /* Disable all interrupts bits */
+   hw_write(ci, OP_USBINTR, 0x, 0);
+   ci_disable_otg_interrupt(ci, OTGSC_INT_EN_BITS);
+
+   /* Clear all interrupts status bits*/
+   hw_write(ci, OP_USBSTS, 0x, 0x);
+   ci_clear_otg_interrupt(ci, OTGSC_INT_STATUS_BITS);
+
dev_dbg(ci-dev, ChipIdea HDRC found, lpm: %d; cap: %p op: %p\n,
ci-hw_bank.lpm, ci-hw_bank.cap, ci-hw_bank.op);
 
@@ -265,24 +274,132 @@ static enum ci_role ci_otg_role(struct ci13xxx *ci)
 }
 
 /**
- * ci_role_work - perform role changing based on ID pin
- * @work: work struct
+ * hw_wait_reg: wait the register value
+ *
+ * Sometimes, it needs to wait register value before going on.
+ * Eg, when switch to device mode, the vbus value should be lower
+ * than OTGSC_BSV before connects to host.
+ *
+ * @ci: the controller
+ * @reg: register index
+ * @mask: mast bit
+ * @value: the bit value to wait
+ * @timeout: timeout to indicate an error
+ *
+ * 

[PATCH v7 4/8] usb: chipidea: consolidate kinds of APIs for both roles

2013-02-04 Thread Peter Chen
- Create/destroy the gadget at udc's init and destory function
- start/stop API are used at otg id switch and probe routine
- Defer some gadget operations at ci's delayed work queue

Signed-off-by: Peter Chen peter.c...@freescale.com
---
 drivers/usb/chipidea/ci.h   |1 -
 drivers/usb/chipidea/core.c |   78 +--
 drivers/usb/chipidea/host.c |6 +++
 drivers/usb/chipidea/host.h |4 ++-
 drivers/usb/chipidea/udc.c  |   37 +++-
 drivers/usb/chipidea/udc.h  |4 ++-
 6 files changed, 71 insertions(+), 59 deletions(-)

diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h
index 325d790..3ebe87a 100644
--- a/drivers/usb/chipidea/ci.h
+++ b/drivers/usb/chipidea/ci.h
@@ -205,7 +205,6 @@ static inline void ci_role_stop(struct ci13xxx *ci)
 
ci-roles[role]-stop(ci);
 }
-
 /**
  * REGISTERS
  */
diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index 8857b2c..dd1fd87 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -323,27 +323,16 @@ static void ci_handle_id_switch(struct ci13xxx *ci)
ci_role(ci)-name, ci-roles[role]-name);
 
/* 1. Finish the current role */
-   if (ci-role == CI_ROLE_GADGET) {
-   usb_gadget_vbus_disconnect(ci-gadget);
-   /* host doesn't care B_SESSION_VALID event */
-   ci_clear_otg_interrupt(ci, OTGSC_BSVIS);
-   ci_disable_otg_interrupt(ci, OTGSC_BSVIE);
-   ci-role = CI_ROLE_END;
-   /* reset controller */
-   hw_device_reset(ci, USBMODE_CM_IDLE);
-   } else if (ci-role == CI_ROLE_HOST) {
-   ci_role_stop(ci);
-   /* reset controller */
-   hw_device_reset(ci, USBMODE_CM_IDLE);
-   }
+   ci_role_stop(ci);
+   hw_device_reset(ci, USBMODE_CM_IDLE);
 
/* 2. Turn on/off vbus according to coming role */
-   if (ci_otg_role(ci) == CI_ROLE_GADGET) {
+   if (role == CI_ROLE_GADGET) {
otg_set_vbus(ci-otg, false);
/* wait vbus lower than OTGSC_BSV */
hw_wait_reg(ci, OP_OTGSC, OTGSC_BSV, 0,
CI_VBUS_STABLE_TIMEOUT);
-   } else if (ci_otg_role(ci) == CI_ROLE_HOST) {
+   } else if (role == CI_ROLE_HOST) {
otg_set_vbus(ci-otg, true);
/* wait vbus higher than OTGSC_AVV */
hw_wait_reg(ci, OP_OTGSC, OTGSC_AVV, OTGSC_AVV,
@@ -351,13 +340,7 @@ static void ci_handle_id_switch(struct ci13xxx *ci)
}
 
/* 3. Begin the new role */
-   if (ci_otg_role(ci) == CI_ROLE_GADGET) {
-   ci-role = role;
-   ci_clear_otg_interrupt(ci, OTGSC_BSVIS);
-   ci_enable_otg_interrupt(ci, OTGSC_BSVIE);
-   } else if (ci_otg_role(ci) == CI_ROLE_HOST) {
-   ci_role_start(ci, role);
-   }
+   ci_role_start(ci, role);
}
 }
 
@@ -396,8 +379,24 @@ static void ci_delayed_work(struct work_struct *work)
struct delayed_work *dwork = to_delayed_work(work);
struct ci13xxx *ci = container_of(dwork, struct ci13xxx, dwork);
 
-   otg_set_vbus(ci-otg, true);
+   if (ci-role == CI_ROLE_GADGET) {
+   /*
+* if it is device mode:
+* - Enable vbus detect
+* - If it has already connected to host, notify udc
+*/
+   ci_enable_otg_interrupt(ci, OTGSC_BSVIE);
+   ci_handle_vbus_change(ci);
+   } else if (ci-is_otg  (ci-role == CI_ROLE_HOST)) {
+   /* USB Device at the MicroB to A cable */
+   otg_set_vbus(ci-otg, true);
+   }
+}
 
+static inline void ci_role_destroy(struct ci13xxx *ci)
+{
+   ci_hdrc_gadget_destroy(ci);
+   ci_hdrc_host_destroy(ci);
 }
 
 static ssize_t show_role(struct device *dev, struct device_attribute *attr,
@@ -594,7 +593,7 @@ static int ci_hdrc_probe(struct platform_device *pdev)
 
ret = ci_hdrc_gadget_init(ci);
if (ret)
-   dev_info(dev, doesn't support gadget\n);
+   dev_info(dev, doesn't support gadget, ret=%d\n, ret);
 
if (!ci-roles[CI_ROLE_HOST]  !ci-roles[CI_ROLE_GADGET]) {
dev_err(dev, no supported roles\n);
@@ -616,23 +615,9 @@ static int ci_hdrc_probe(struct platform_device *pdev)
: CI_ROLE_GADGET;
}
 
-   ret = ci_role_start(ci, ci-role);
-   if (ret) {
-   

[PATCH v7 5/8] usb: chipidea: udc: add pullup/pulldown dp at hw_device_state

2013-02-04 Thread Peter Chen
- During the connect/disconnect host, we need to pullup
and pulldown dp
- Make sure the dp is not pullup until the vbus is on when
flag CI13XXX_PULLUP_ON_VBUS is set
- Using hw_device_state when set run/stop bit

Signed-off-by: Peter Chen peter.c...@freescale.com
---
 drivers/usb/chipidea/udc.c |   10 --
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
index e82dae4..597ae64 100644
--- a/drivers/usb/chipidea/udc.c
+++ b/drivers/usb/chipidea/udc.c
@@ -91,8 +91,10 @@ static int hw_device_state(struct ci13xxx *ci, u32 dma)
/* interrupt, error, port change, reset, sleep/suspend */
hw_write(ci, OP_USBINTR, ~0,
 USBi_UI|USBi_UEI|USBi_PCI|USBi_URI|USBi_SLI);
+   hw_write(ci, OP_USBCMD, USBCMD_RS, USBCMD_RS);
} else {
hw_write(ci, OP_USBINTR, ~0, 0);
+   hw_write(ci, OP_USBCMD, USBCMD_RS, 0);
}
return 0;
 }
@@ -1424,10 +1426,14 @@ static int ci13xxx_pullup(struct usb_gadget *_gadget, 
int is_on)
 {
struct ci13xxx *ci = container_of(_gadget, struct ci13xxx, gadget);
 
+   if ((ci-platdata-flags  CI13XXX_PULLUP_ON_VBUS) 
+   !ci-vbus_active)
+   return -ENOTSUPP;
+
if (is_on)
-   hw_write(ci, OP_USBCMD, USBCMD_RS, USBCMD_RS);
+   hw_device_state(ci, ci-ep0out-qh.dma);
else
-   hw_write(ci, OP_USBCMD, USBCMD_RS, 0);
+   hw_device_state(ci, 0);
 
return 0;
 }
-- 
1.7.0.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 v7 6/8] usb: chipidea: udc: retire the flag CI13_PULLUP_ON_VBUS

2013-02-04 Thread Peter Chen
(change CI13XXX to CI13 to avoid junk email check)
Now, we have handled vbus session in core driver when the
vbus interrupt occurs, so our pullup operations are all
according to vbus.
Of cource, the software can still call .pullup when device connects
to host if it wants to connect/disconnect with host.

Signed-off-by: Peter Chen peter.c...@freescale.com
---
 drivers/usb/chipidea/ci13xxx_imx.c |1 -
 drivers/usb/chipidea/ci13xxx_msm.c |1 -
 drivers/usb/chipidea/udc.c |   23 ---
 include/linux/usb/chipidea.h   |1 -
 4 files changed, 8 insertions(+), 18 deletions(-)

diff --git a/drivers/usb/chipidea/ci13xxx_imx.c 
b/drivers/usb/chipidea/ci13xxx_imx.c
index 8c29122..3b91ff4 100644
--- a/drivers/usb/chipidea/ci13xxx_imx.c
+++ b/drivers/usb/chipidea/ci13xxx_imx.c
@@ -88,7 +88,6 @@ EXPORT_SYMBOL_GPL(usbmisc_get_init_data);
 static struct ci13xxx_platform_data ci13xxx_imx_platdata  = {
.name   = ci13xxx_imx,
.flags  = CI13XXX_REQUIRE_TRANSCEIVER |
- CI13XXX_PULLUP_ON_VBUS |
  CI13XXX_DISABLE_STREAMING,
.capoffset  = DEF_CAPOFFSET,
 };
diff --git a/drivers/usb/chipidea/ci13xxx_msm.c 
b/drivers/usb/chipidea/ci13xxx_msm.c
index 7d16681..5755ee8 100644
--- a/drivers/usb/chipidea/ci13xxx_msm.c
+++ b/drivers/usb/chipidea/ci13xxx_msm.c
@@ -49,7 +49,6 @@ static struct ci13xxx_platform_data ci13xxx_msm_platdata = {
.name   = ci13xxx_msm,
.flags  = CI13XXX_REGS_SHARED |
  CI13XXX_REQUIRE_TRANSCEIVER |
- CI13XXX_PULLUP_ON_VBUS |
  CI13XXX_DISABLE_STREAMING,
 
.notify_event   = ci13xxx_msm_notify_event,
diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
index 597ae64..b57b735 100644
--- a/drivers/usb/chipidea/udc.c
+++ b/drivers/usb/chipidea/udc.c
@@ -1360,9 +1360,6 @@ static int ci13xxx_vbus_session(struct usb_gadget 
*_gadget, int is_active)
unsigned long flags;
int gadget_ready = 0;
 
-   if (!(ci-platdata-flags  CI13XXX_PULLUP_ON_VBUS))
-   return -EOPNOTSUPP;
-
spin_lock_irqsave(ci-lock, flags);
ci-vbus_active = is_active;
if (ci-driver)
@@ -1426,8 +1423,7 @@ static int ci13xxx_pullup(struct usb_gadget *_gadget, int 
is_on)
 {
struct ci13xxx *ci = container_of(_gadget, struct ci13xxx, gadget);
 
-   if ((ci-platdata-flags  CI13XXX_PULLUP_ON_VBUS) 
-   !ci-vbus_active)
+   if (!ci-vbus_active)
return -ENOTSUPP;
 
if (is_on)
@@ -1551,14 +1547,12 @@ static int ci13xxx_start(struct usb_gadget *gadget,
 
ci-driver = driver;
pm_runtime_get_sync(ci-gadget.dev);
-   if (ci-platdata-flags  CI13XXX_PULLUP_ON_VBUS) {
-   if (ci-vbus_active) {
-   if (ci-platdata-flags  CI13XXX_REGS_SHARED)
-   hw_device_reset(ci, USBMODE_CM_DC);
-   } else {
-   pm_runtime_put_sync(ci-gadget.dev);
-   goto done;
-   }
+   if (ci-vbus_active) {
+   if (ci-platdata-flags  CI13XXX_REGS_SHARED)
+   hw_device_reset(ci, USBMODE_CM_DC);
+   } else {
+   pm_runtime_put_sync(ci-gadget.dev);
+   goto done;
}
 
retval = hw_device_state(ci, ci-ep0out-qh.dma);
@@ -1581,8 +1575,7 @@ static int ci13xxx_stop(struct usb_gadget *gadget,
 
spin_lock_irqsave(ci-lock, flags);
 
-   if (!(ci-platdata-flags  CI13XXX_PULLUP_ON_VBUS) ||
-   ci-vbus_active) {
+   if (ci-vbus_active) {
hw_device_state(ci, 0);
if (ci-platdata-notify_event)
ci-platdata-notify_event(ci,
diff --git a/include/linux/usb/chipidea.h b/include/linux/usb/chipidea.h
index 544825d..37821b3 100644
--- a/include/linux/usb/chipidea.h
+++ b/include/linux/usb/chipidea.h
@@ -17,7 +17,6 @@ struct ci13xxx_platform_data {
unsigned longflags;
 #define CI13XXX_REGS_SHAREDBIT(0)
 #define CI13XXX_REQUIRE_TRANSCEIVERBIT(1)
-#define CI13XXX_PULLUP_ON_VBUS BIT(2)
 #define CI13XXX_DISABLE_STREAMING  BIT(3)
 
 #define CI13XXX_CONTROLLER_RESET_EVENT 0
-- 
1.7.0.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 v7 7/8] usb: chipidea: imx: add internal vbus regulator control

2013-02-04 Thread Peter Chen
- For host, the vbus should always be on.
- For otg, the vbus is off defaultly, the vbus needs to be
turned on/off when usb role switches.

Signed-off-by: Peter Chen peter.c...@freescale.com
---
 drivers/usb/chipidea/ci.h  |2 +
 drivers/usb/chipidea/ci13xxx_imx.c |   80 
 2 files changed, 64 insertions(+), 18 deletions(-)

diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h
index 3ebe87a..bd78078 100644
--- a/drivers/usb/chipidea/ci.h
+++ b/drivers/usb/chipidea/ci.h
@@ -131,6 +131,7 @@ struct hw_bank {
  * @hcd: pointer to usb_hcd for ehci host driver
  * @otg: for otg support
  * @events: events for otg, and handled at ci_role_work
+ * @reg_vbus: used to control internal vbus regulator
  */
 struct ci13xxx {
struct device   *dev;
@@ -170,6 +171,7 @@ struct ci13xxx {
struct usb_otg  otg;
boolid_event;
boolb_sess_valid_event;
+   struct regulator*reg_vbus;
 };
 
 static inline struct ci_role_driver *ci_role(struct ci13xxx *ci)
diff --git a/drivers/usb/chipidea/ci13xxx_imx.c 
b/drivers/usb/chipidea/ci13xxx_imx.c
index 3b91ff4..4c9df98 100644
--- a/drivers/usb/chipidea/ci13xxx_imx.c
+++ b/drivers/usb/chipidea/ci13xxx_imx.c
@@ -88,14 +88,47 @@ EXPORT_SYMBOL_GPL(usbmisc_get_init_data);
 static struct ci13xxx_platform_data ci13xxx_imx_platdata  = {
.name   = ci13xxx_imx,
.flags  = CI13XXX_REQUIRE_TRANSCEIVER |
- CI13XXX_DISABLE_STREAMING,
+ CI13XXX_DISABLE_STREAMING |
+ CI13XXX_REGS_SHARED,
.capoffset  = DEF_CAPOFFSET,
 };
 
+static int ci13xxx_otg_set_vbus(struct usb_otg *otg, bool enabled)
+{
+   struct ci13xxx  *ci = container_of(otg, struct ci13xxx, otg);
+   struct regulator *reg_vbus = ci-reg_vbus;
+   int ret;
+
+   WARN_ON(!reg_vbus);
+
+   if (reg_vbus) {
+   if (enabled) {
+   ret = regulator_enable(reg_vbus);
+   if (ret) {
+   dev_err(ci-dev,
+   Failed to enable vbus regulator, ret=%d\n,
+   ret);
+   return ret;
+   }
+   } else {
+   ret = regulator_disable(reg_vbus);
+   if (ret) {
+   dev_err(ci-dev,
+   Failed to disable vbus regulator, ret=%d\n,
+   ret);
+   return ret;
+   }
+   }
+   }
+
+   return 0;
+}
+
 static int ci13xxx_imx_probe(struct platform_device *pdev)
 {
struct ci13xxx_imx_data *data;
struct platform_device *plat_ci, *phy_pdev;
+   struct ci13xxx  *ci;
struct device_node *phy_np;
struct resource *res;
struct regulator *reg_vbus;
@@ -152,20 +185,11 @@ static int ci13xxx_imx_probe(struct platform_device *pdev)
}
}
 
-   /* we only support host now, so enable vbus here */
reg_vbus = devm_regulator_get(pdev-dev, vbus);
-   if (!IS_ERR(reg_vbus)) {
-   ret = regulator_enable(reg_vbus);
-   if (ret) {
-   dev_err(pdev-dev,
-   Failed to enable vbus regulator, err=%d\n,
-   ret);
-   goto put_np;
-   }
+   if (!IS_ERR(reg_vbus))
data-reg_vbus = reg_vbus;
-   } else {
+   else
reg_vbus = NULL;
-   }
 
ci13xxx_imx_platdata.phy = data-phy;
 
@@ -175,7 +199,7 @@ static int ci13xxx_imx_probe(struct platform_device *pdev)
if (!pdev-dev.dma_mask) {
ret = -ENOMEM;
dev_err(pdev-dev, Failed to alloc dma_mask!\n);
-   goto err;
+   goto put_np;
}
*pdev-dev.dma_mask = DMA_BIT_MASK(32);
dma_set_coherent_mask(pdev-dev, *pdev-dev.dma_mask);
@@ -186,7 +210,7 @@ static int ci13xxx_imx_probe(struct platform_device *pdev)
if (ret) {
dev_err(pdev-dev,
usbmisc init failed, ret=%d\n, ret);
-   goto err;
+   goto put_np;
}
}
 
@@ -198,24 +222,44 @@ static int ci13xxx_imx_probe(struct platform_device *pdev)
dev_err(pdev-dev,
Can't register ci_hdrc platform device, err=%d\n,
ret);
-   goto err;
+   goto put_np;
}
 
data-ci_pdev = plat_ci;
platform_set_drvdata(pdev, data);
 
+   ci = 

[PATCH v7 8/8] usb: chipidea: udc: fix the oops when plugs in usb cable after rmmod gadget

2013-02-04 Thread Peter Chen
When we rmmod gadget, the ci-driver needs to be cleared.
Otherwise, we plug in usb cable again, the driver will
consider gadget is there, in fact, it is removed.
Below is the oops this patch fixes.

root@freescale ~$ ci_hdrc ci_hdrc.0: Connected to host
Unable to handle kernel paging request at virtual address 7f01171c
pgd = 80004000
[7f01171c] *pgd=4fa1e811, *pte=, *ppte=
Internal error: Oops: 7 [#1] SMP ARM
Modules linked in: f_acm libcomposite u_serial [last unloaded: g_serial]
CPU: 0Not tainted  (3.8.0-rc5+ #221)
PC is at _gadget_stop_activity+0xbc/0x128
LR is at ep_fifo_flush+0x68/0xa0
pc : [803634cc]lr : [80363938]psr: 2193
sp : 806c7dc8  ip :   fp : 806c7de4
r10:   r9 : 80710ea4  r8 : 
r7 : bf834094  r6 : bf834098  r5 : bf834010  r4 : bf8340a0
r3 : 7f011708  r2 : 01940194  r1 : a193  r0 : bf834014
Flags: nzCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
Control: 10c53c7d  Table: 4f06404a  DAC: 0017
Process swapper/0 (pid: 0, stack limit = 0x806c6238)
Stack: (0x806c7dc8 to 0x806c8000)
7dc0:   bf834010 bf809950 bf834010 004b 806c7e44 
806c7de8
7de0: 80365400 8036341c ec1c  ec1c 0040 fff5ede0 
bf834014
7e00: 000a1220  002e d958 806c7e3c 806c7e20 8004e870 
bf834010
7e20: bf809950 004b 004b  80710ea4  806c7e5c 
806c7e48
7e40: 80362888 80365154 bfb35180 bf809950 806c7e9c 806c7e60 8008111c 
803627f4
7e60: 00989680  bf809900 bf809964 812df8c0 bf809900 bf809950 
806c3f2c
7e80: 004b  412fc09a  806c7eb4 806c7ea0 80081368 
800810b8
7ea0: bf809900 bf809950 806c7ecc 806c7eb8 800843c8 8008130c 004b 
806cf748
7ec0: 806c7ee4 806c7ed0 80081088 8008432c 806c6000 806cf748 806c7f0c 
806c7ee8
7ee0: 8000fa44 8008105c f400010c 806ce974 806c7f30 f4000110 806d29e8 
412fc09a
7f00: 806c7f2c 806c7f10 80008584 8000f9f4 8000fbd0 6013  
806c7f64
7f20: 806c7f84 806c7f30 8000eac0 80008554   000f 
8001aea0
7f40: 806c6000 80712a48 804f0040  806d29e8 412fc09a  
806c7f84
7f60: 806c7f88 806c7f78 8000fbcc 8000fbd0 6013  806c7fac 
806c7f88
7f80: 8001015c 8000fb9c 806cf5b0 80712980 806a4528 8fff 1000406a 
412fc09a
7fa0: 806c7fbc 806c7fb0 804e5334 800100ac 806c7ff4 806c7fc0 80668940 
804e52d4
7fc0:   806684bc   806a4528 10c53c7d 
806ce94c
7fe0: 806a4524 806d29dc  806c7ff8 10008078 806686b0  

Backtrace:
[80363410] (_gadget_stop_activity+0x0/0x128) from [80365400] 
(udc_irq+0x2b8/0xf38)
 r7:004b r6:bf834010 r5:bf809950 r4:bf834010
 [80365148] (udc_irq+0x0/0xf38) from [80362888] (ci_irq+0xa0/0xf4)
[803627e8] (ci_irq+0x0/0xf4) from [8008111c] 
(handle_irq_event_percpu+0x70/0x254)
 r5:bf809950 r4:bfb35180
 [800810ac] (handle_irq_event_percpu+0x0/0x254) from [80081368] 
(handle_irq_event+0x68/0x88)
[80081300] (handle_irq_event+0x0/0x88) from [800843c8] 
(handle_fasteoi_irq+0xa8/0x178)
 r5:bf809950 r4:bf809900
 [80084320] (handle_fasteoi_irq+0x0/0x178) from [80081088] 
(generic_handle_irq+0x38/0x40)
 r5:806cf748 r4:004b
 [80081050] (generic_handle_irq+0x0/0x40) from [8000fa44] 
(handle_IRQ+0x5c/0xbc)
 r5:806cf748 r4:806c6000
 [8000f9e8] (handle_IRQ+0x0/0xbc) from [80008584] 
(gic_handle_irq+0x3c/0x70)
 r9:412fc09a r8:806d29e8 r7:f4000110 r6:806c7f30 r5:806ce974
 r4:f400010c
 [80008548] (gic_handle_irq+0x0/0x70) from [8000eac0] 
(__irq_svc+0x40/0x54)
Exception stack(0x806c7f30 to 0x806c7f78)
7f20:   000f 
8001aea0
7f40: 806c6000 80712a48 804f0040  806d29e8 412fc09a  
806c7f84
7f60: 806c7f88 806c7f78 8000fbcc 8000fbd0 6013 
 r7:806c7f64 r6: r5:6013 r4:8000fbd0
 [8000fb90] (default_idle+0x0/0x4c) from [8001015c] 
(cpu_idle+0xbc/0xf8)
[800100a0] (cpu_idle+0x0/0xf8) from [804e5334] (rest_init+0x6c/0x84)
 r9:412fc09a r8:1000406a r7:8fff r6:806a4528 r5:80712980
 r4:806cf5b0
 [804e52c8] (rest_init+0x0/0x84) from [80668940] 
(start_kernel+0x29c/0x2ec)
[806686a4] (start_kernel+0x0/0x2ec) from [10008078] (0x10008078)
Code: e12fff33 e5953200 e353 0a02 (e5933014)
---[ end trace aade28ad434062bd ]---
Kernel panic - not syncing: 0xbf8bdfa8)
df60:   000f 8001aea0 bf8bc000 80712a48 804f0040 

df80: 806d29e8 412fc09a  bf8bdfb4 bf8bdfb8 bf8bdfa8 8000fbcc 
8000fbd0
dfa0: 6013 
 r7:bf8bdf94 r6: 

Re: [PATCH V3 3/5] usb: gadget/uvc: Port UVC webcam gadget to use videobuf2 framework

2013-02-04 Thread Michael Grzeschik
Hi Bhupesh,

On Thu, Jan 17, 2013 at 04:23:51PM +0530, Bhupesh Sharma wrote:
 This patch reworks the videobuffer management logic present in the UVC
 webcam gadget and ports it to use the more apt videobuf2 framework for
 video buffer management.
 
 To support routing video data captured from a real V4L2 video capture
 device with a zero copy operation on videobuffers (as they pass from
 the V4L2 domain to UVC domain via a user-space application), we need to
 support USER_PTR IO method at the UVC gadget side.
 
 So the V4L2 capture device driver can still continue to use MMAP IO
 method and now the user-space application can just pass a pointer to the
 video buffers being dequeued from the V4L2 device side while queueing
 them at the UVC gadget end. This ensures that we have a zero-copy
 design as the videobuffers pass from the V4L2 capture device to the UVC
 gadget.
 
 Note that there will still be a need to apply UVC specific payload
 headers on top of each UVC payload data, which will still require a copy
 operation to be performed in the 'encode' routines of the UVC gadget.
 
 This patch also addresses one issue found out while porting the UVC
 gadget to videobuf2 framework:
   - In case the usb requests queued by the gadget get completed
 with a status of -ESHUTDOWN (disconnected from host),
 the queue of videobuf2 should be cancelled to ensure that the
 application space daemon is not left in a state waiting for
 a vb2 to be successfully absorbed at the USB side.
 
 Signed-off-by: Bhupesh Sharma bhupesh.sha...@st.com
 ---
  drivers/usb/gadget/Kconfig |1 +
  drivers/usb/gadget/uvc_queue.c |  537 
 
  drivers/usb/gadget/uvc_queue.h |   25 +--
  drivers/usb/gadget/uvc_v4l2.c  |   27 +--
  drivers/usb/gadget/uvc_video.c |   18 +-
  5 files changed, 189 insertions(+), 419 deletions(-)
 
 diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
 index e0ff51b..b17ee25 100644
 --- a/drivers/usb/gadget/Kconfig
 +++ b/drivers/usb/gadget/Kconfig
 @@ -952,6 +952,7 @@ endif
  config USB_G_WEBCAM
   tristate USB Webcam Gadget
   depends on VIDEO_DEV
 + select VIDEOBUF2_VMALLOC
   select USB_LIBCOMPOSITE
   help
 The Webcam Gadget acts as a composite USB Audio and Video Class
 diff --git a/drivers/usb/gadget/uvc_queue.c b/drivers/usb/gadget/uvc_queue.c
 index 104ae9c..bd20fab 100644
 --- a/drivers/usb/gadget/uvc_queue.c
 +++ b/drivers/usb/gadget/uvc_queue.c
 @@ -10,6 +10,7 @@
   *   (at your option) any later version.
   */
  
 +#include linux/atomic.h
  #include linux/kernel.h
  #include linux/mm.h
  #include linux/list.h
 @@ -18,7 +19,8 @@
  #include linux/videodev2.h
  #include linux/vmalloc.h
  #include linux/wait.h
 -#include linux/atomic.h
 +
 +#include media/videobuf2-vmalloc.h
  
  #include uvc.h
  
 @@ -28,330 +30,169 @@
   * Video queues is initialized by uvc_queue_init(). The function performs
   * basic initialization of the uvc_video_queue struct and never fails.
   *
 - * Video buffer allocation and freeing are performed by uvc_alloc_buffers and
 - * uvc_free_buffers respectively. The former acquires the video queue lock,
 - * while the later must be called with the lock held (so that allocation can
 - * free previously allocated buffers). Trying to free buffers that are mapped
 - * to user space will return -EBUSY.
 - *
 - * Video buffers are managed using two queues. However, unlike most USB video
 - * drivers that use an in queue and an out queue, we use a main queue to hold
 - * all queued buffers (both 'empty' and 'done' buffers), and an irq queue to
 - * hold empty buffers. This design (copied from video-buf) minimizes locking
 - * in interrupt, as only one queue is shared between interrupt and user
 - * contexts.
 - *
 - * Use cases
 - * -
 - *
 - * Unless stated otherwise, all operations that modify the irq buffers queue
 - * are protected by the irq spinlock.
 - *
 - * 1. The user queues the buffers, starts streaming and dequeues a buffer.
 - *
 - *The buffers are added to the main and irq queues. Both operations are
 - *protected by the queue lock, and the later is protected by the irq
 - *spinlock as well.
 - *
 - *The completion handler fetches a buffer from the irq queue and fills it
 - *with video data. If no buffer is available (irq queue empty), the 
 handler
 - *returns immediately.
 - *
 - *When the buffer is full, the completion handler removes it from the irq
 - *queue, marks it as ready (UVC_BUF_STATE_DONE) and wakes its wait queue.
 - *At that point, any process waiting on the buffer will be woken up. If a
 - *process tries to dequeue a buffer after it has been marked ready, the
 - *dequeing will succeed immediately.
 - *
 - * 2. Buffers are queued, user is waiting on a buffer and the device gets
 - *disconnected.
 - *
 - *When the device is disconnected, the kernel calls the completion 
 handler
 

Re: [PATCH v4 2/4] ARM: Exynos5250: Enabling ohci-exynos driver

2013-02-04 Thread Vivek Gautam
Hi Kukjin,


On Fri, Feb 1, 2013 at 3:56 AM, Kukjin Kim kgene@samsung.com wrote:
 Tomasz Figa wrote:

 Hi Vivek,

 [...]

  +   usb@1212 {
  +   compatible = samsung,exynos4210-ohci;
  +   reg = 0x1212 0x100;
  +   interrupts = 0 71 0;

 For Samsung platforms we decided per board enabling of nodes and so this
 node should also contain:

   status = disabled;

 while in dts file of board using ohci there would be an overriding entry:

   usb@1212 {
   status = okay;
   };

 I know that Exynos5250 has not been yet converted into this convention,
 but using it when adding new devices will simplify the process.

 Well, I have another opinion on this...

 Let's see, yeah, we are using following method in EXYNOS4 DT...
 - disabling IPs in SoC DT source and enabling IPs in board DT source

 But as I said, in EXYNOS5440 DT, I want to use following, because most of
 them should be enabled/used.
 - enabling IPs in SoC DT source and no need enabling in board DT source.

 I mean, it depends on each SoC's situation.


So, since USB 2.0 (EHCI/OHCI) shall be always enabled on almost all the boards,
so we shall keep it enabled in SOC DT source.

In that case following patches can be picked for a merge:
[PATCH v5 1/4] ARM: Exynos5250: Enabling ehci-s5p driver
http://www.mail-archive.com/linux-usb@vger.kernel.org/msg12330.html

[PATCH v4 2/4] ARM: Exynos5250: Enabling ohci-exynos driver
http://www.mail-archive.com/linux-usb@vger.kernel.org/msg12266.html

These will enable EHCI and OHCI support on exynos5250.
Please let me know if you want me to resend them. ;-)


-- 
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: xhci streams bug

2013-02-04 Thread Gerd Hoffmann
On 01/31/13 15:34, Gerd Hoffmann wrote:
 [ all still in qemu, will cross-checking on real hardware ]

Done now.  Getting the same behavior with the TI demo board on a nec
xhci controller (express card).

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 6/9] USB chipidea: introduce dual role mode pdata flags

2013-02-04 Thread Sascha Hauer
Even if a chipidea core is otg capable the board may not. This allows
to explicitly set the core to host/peripheral mode. Without these
flags the driver falls back to the old behaviour.

Signed-off-by: Sascha Hauer s.ha...@pengutronix.de
---
 drivers/usb/chipidea/core.c  |   21 +++--
 include/linux/usb/chipidea.h |2 +-
 2 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index 04d68cb..c89f2aa 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -435,6 +435,7 @@ static int ci_hdrc_probe(struct platform_device *pdev)
struct resource *res;
void __iomem*base;
int ret;
+   enum usb_dr_mode dr_mode;
 
if (!dev-platform_data) {
dev_err(dev, platform data missing\n);
@@ -487,14 +488,22 @@ static int ci_hdrc_probe(struct platform_device *pdev)
return -ENODEV;
}
 
+   dr_mode = ci-platdata-dr_mode;
+   if (dr_mode == USB_DR_MODE_UNKNOWN)
+   dr_mode = USB_DR_MODE_OTG;
+
/* initialize role(s) before the interrupt is requested */
-   ret = ci_hdrc_host_init(ci);
-   if (ret)
-   dev_info(dev, doesn't support host\n);
+   if (dr_mode == USB_DR_MODE_OTG || dr_mode == USB_DR_MODE_HOST) {
+   ret = ci_hdrc_host_init(ci);
+   if (ret)
+   dev_info(dev, doesn't support host\n);
+   }
 
-   ret = ci_hdrc_gadget_init(ci);
-   if (ret)
-   dev_info(dev, doesn't support gadget\n);
+   if (dr_mode == USB_DR_MODE_OTG || dr_mode == USB_DR_MODE_PERIPHERAL) {
+   ret = ci_hdrc_gadget_init(ci);
+   if (ret)
+   dev_info(dev, doesn't support gadget\n);
+   }
 
if (!ci-roles[CI_ROLE_HOST]  !ci-roles[CI_ROLE_GADGET]) {
dev_err(dev, no supported roles\n);
diff --git a/include/linux/usb/chipidea.h b/include/linux/usb/chipidea.h
index 1a2aa18..b314647 100644
--- a/include/linux/usb/chipidea.h
+++ b/include/linux/usb/chipidea.h
@@ -20,7 +20,7 @@ struct ci13xxx_platform_data {
 #define CI13XXX_REQUIRE_TRANSCEIVERBIT(1)
 #define CI13XXX_PULLUP_ON_VBUS BIT(2)
 #define CI13XXX_DISABLE_STREAMING  BIT(3)
-
+   enum usb_dr_modedr_mode;
 #define CI13XXX_CONTROLLER_RESET_EVENT 0
 #define CI13XXX_CONTROLLER_STOPPED_EVENT   1
void(*notify_event) (struct ci13xxx *ci, unsigned event);
-- 
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 v4] USB: add devicetree helpers for determining dr_mode and phy_type

2013-02-04 Thread Sascha Hauer
4th round of patches.

Peter, I would be glad if you could test them before your holiday. I rebased
your last round of Chipidea OTG patches onto this series which you can pull
here:

git://git.pengutronix.de/git/imx/linux-2.6.git tags/usb-chipidea-otg-for-next

I couldn't really test the otg patches since my current hardware does not have
the ID pin connected, but I can verify that my usecase still works with your
patches applied.

Alex, should the patches work for you and are fine otherwise, could you apply
them for v3.9?

Sascha



changes since v3:

- add phy patches (which were accidently already part of v2)
- Use OP_DEVLC instead of OP_PORTSC for lpm case
- Use enum usb_dr_mode ub ci_hdrc_probe()

changes since v2:

- fix adding of GPL Header was in wrong patch
- add missing hunk for new file of.c

changes since v1:
- move phy specific of helper to drivers/usb/phy/of.c
- use strcmp instead of strcasecmp for matching property values
- change usb_phy_dr_mode to usb_dr_mode
- change USBPHY_INTERFACE_MODE_NA to USBPHY_INTERFACE_MODE_UNKNOWN
- add copyright header to new files
- chipidea: drop mdelay at end of PTS/PTW setup
- chipidea: implement lpm core type handling for PTS/PTW


The following changes since commit 2f0760774711c957c395b31131b848043af98edf:

  USB: GADGET: optionally force full-speed for net2280 UDC (2013-01-31 10:09:19 
+0100)

are available in the git repository at:

  git://git.pengutronix.de/git/imx/linux-2.6.git tags/usb-chipidea-for-next

for you to fetch changes up to 25682afd7be85f1462647d8530dca1bf848074fc:

  USB chipidea i.MX: use devm_usb_get_phy_by_phandle to get phy (2013-02-04 
12:28:53 +0100)


USB: chipidea patches for v3.9

These add OF helpers for handling the dr_mode and phy_type property
and makes use of them in the chipidea driver.


Marc Kleine-Budde (1):
  usb: otg: use try_module_get in all usb_get_phy functions and add missing 
module_put

Michael Grzeschik (3):
  USB: add devicetree helpers for determining dr_mode and phy_type
  USB: chipidea: ci13xxx-imx: create dynamic platformdata
  USB: chipidea: add PTW and PTS handling

Sascha Hauer (5):
  USB: move bulk of otg/otg.c to phy/phy.c
  USB chipidea: introduce dual role mode pdata flags
  USB chipidea i.MX: introduce dr_mode property
  USB mxs-phy: Register phy with framework
  USB chipidea i.MX: use devm_usb_get_phy_by_phandle to get phy

 .../devicetree/bindings/usb/ci13xxx-imx.txt|6 +
 drivers/usb/chipidea/bits.h|   14 +-
 drivers/usb/chipidea/ci13xxx_imx.c |   68 +--
 drivers/usb/chipidea/core.c|   60 ++-
 drivers/usb/otg/mxs-phy.c  |9 +
 drivers/usb/otg/otg.c  |  423 ---
 drivers/usb/phy/Makefile   |2 +
 drivers/usb/phy/of.c   |   47 +++
 drivers/usb/phy/phy.c  |  438 
 drivers/usb/usb-common.c   |   36 ++
 include/linux/usb/chipidea.h   |3 +-
 include/linux/usb/of.h |   27 ++
 include/linux/usb/otg.h|7 +
 include/linux/usb/phy.h|9 +
 14 files changed, 687 insertions(+), 462 deletions(-)
 create mode 100644 drivers/usb/phy/of.c
 create mode 100644 drivers/usb/phy/phy.c
 create mode 100644 include/linux/usb/of.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


[PATCH 4/9] USB: chipidea: ci13xxx-imx: create dynamic platformdata

2013-02-04 Thread Sascha Hauer
From: Michael Grzeschik m.grzesc...@pengutronix.de

This patch removes the limitation of having only one instance of the
ci13xxx-imx platformdata and makes different configurations possible.

Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de
Signed-off-by: Marc Kleine-Budde m...@pengutronix.de
Signed-off-by: Sascha Hauer s.ha...@pengutronix.de
Reviewed-by: Peter Chen peter.c...@freescale.com
---
 drivers/usb/chipidea/ci13xxx_imx.c |   25 +++--
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/drivers/usb/chipidea/ci13xxx_imx.c 
b/drivers/usb/chipidea/ci13xxx_imx.c
index 8c29122..69024e0 100644
--- a/drivers/usb/chipidea/ci13xxx_imx.c
+++ b/drivers/usb/chipidea/ci13xxx_imx.c
@@ -85,17 +85,10 @@ EXPORT_SYMBOL_GPL(usbmisc_get_init_data);
 
 /* End of common functions shared by usbmisc drivers*/
 
-static struct ci13xxx_platform_data ci13xxx_imx_platdata  = {
-   .name   = ci13xxx_imx,
-   .flags  = CI13XXX_REQUIRE_TRANSCEIVER |
- CI13XXX_PULLUP_ON_VBUS |
- CI13XXX_DISABLE_STREAMING,
-   .capoffset  = DEF_CAPOFFSET,
-};
-
 static int ci13xxx_imx_probe(struct platform_device *pdev)
 {
struct ci13xxx_imx_data *data;
+   struct ci13xxx_platform_data *pdata;
struct platform_device *plat_ci, *phy_pdev;
struct device_node *phy_np;
struct resource *res;
@@ -107,6 +100,18 @@ static int ci13xxx_imx_probe(struct platform_device *pdev)
 !usbmisc_ops)
return -EPROBE_DEFER;
 
+   pdata = devm_kzalloc(pdev-dev, sizeof(*pdata), GFP_KERNEL);
+   if (!pdata) {
+   dev_err(pdev-dev, Failed to allocate CI13xxx-IMX pdata!\n);
+   return -ENOMEM;
+   }
+
+   pdata-name = ci13xxx_imx;
+   pdata-capoffset = DEF_CAPOFFSET;
+   pdata-flags = CI13XXX_REQUIRE_TRANSCEIVER |
+  CI13XXX_PULLUP_ON_VBUS |
+  CI13XXX_DISABLE_STREAMING;
+
data = devm_kzalloc(pdev-dev, sizeof(*data), GFP_KERNEL);
if (!data) {
dev_err(pdev-dev, Failed to allocate CI13xxx-IMX data!\n);
@@ -168,7 +173,7 @@ static int ci13xxx_imx_probe(struct platform_device *pdev)
reg_vbus = NULL;
}
 
-   ci13xxx_imx_platdata.phy = data-phy;
+   pdata-phy = data-phy;
 
if (!pdev-dev.dma_mask) {
pdev-dev.dma_mask = devm_kzalloc(pdev-dev,
@@ -193,7 +198,7 @@ static int ci13xxx_imx_probe(struct platform_device *pdev)
 
plat_ci = ci13xxx_add_device(pdev-dev,
pdev-resource, pdev-num_resources,
-   ci13xxx_imx_platdata);
+   pdata);
if (IS_ERR(plat_ci)) {
ret = PTR_ERR(plat_ci);
dev_err(pdev-dev,
-- 
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 7/9] USB chipidea i.MX: introduce dr_mode property

2013-02-04 Thread Sascha Hauer
The dr_mode devicetree property allows to explicitly specify the
host/peripheral/otg mode. This is necessary for boards without proper
ID pin handling.

Signed-off-by: Sascha Hauer s.ha...@pengutronix.de
Reviewed-by: Peter Chen peter.c...@freescale.com
---
 Documentation/devicetree/bindings/usb/ci13xxx-imx.txt |1 +
 drivers/usb/chipidea/ci13xxx_imx.c|1 +
 2 files changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/usb/ci13xxx-imx.txt 
b/Documentation/devicetree/bindings/usb/ci13xxx-imx.txt
index dd42ccd..493a414 100644
--- a/Documentation/devicetree/bindings/usb/ci13xxx-imx.txt
+++ b/Documentation/devicetree/bindings/usb/ci13xxx-imx.txt
@@ -9,6 +9,7 @@ Recommended properies:
 - phy_type: the type of the phy connected to the core. Should be one
   of utmi, utmi_wide, ulpi, serial or hsic. Without this
   property the PORTSC register won't be touched
+- dr_mode: One of host, peripheral or otg. Defaults to otg
 
 Optional properties:
 - fsl,usbphy: phandler of usb phy that connects to the only one port
diff --git a/drivers/usb/chipidea/ci13xxx_imx.c 
b/drivers/usb/chipidea/ci13xxx_imx.c
index ebc1148..b598bb8f 100644
--- a/drivers/usb/chipidea/ci13xxx_imx.c
+++ b/drivers/usb/chipidea/ci13xxx_imx.c
@@ -114,6 +114,7 @@ static int ci13xxx_imx_probe(struct platform_device *pdev)
   CI13XXX_DISABLE_STREAMING;
 
pdata-phy_mode = of_usb_get_phy_mode(pdev-dev.of_node);
+   pdata-dr_mode = of_usb_get_dr_mode(pdev-dev.of_node);
 
data = devm_kzalloc(pdev-dev, sizeof(*data), GFP_KERNEL);
if (!data) {
-- 
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 5/9] USB: chipidea: add PTW and PTS handling

2013-02-04 Thread Sascha Hauer
From: Michael Grzeschik m.grzesc...@pengutronix.de

This patch makes it possible to configure the PTW and PTS bits inside
the portsc register for host and device mode before the driver starts
and the phy can be addressed as hardware implementation is designed.

Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de
Signed-off-by: Marc Kleine-Budde m...@pengutronix.de
Signed-off-by: Sascha Hauer s.ha...@pengutronix.de
---
 .../devicetree/bindings/usb/ci13xxx-imx.txt|5 +++
 drivers/usb/chipidea/bits.h|   14 ++-
 drivers/usb/chipidea/ci13xxx_imx.c |3 ++
 drivers/usb/chipidea/core.c|   39 
 include/linux/usb/chipidea.h   |1 +
 5 files changed, 61 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/usb/ci13xxx-imx.txt 
b/Documentation/devicetree/bindings/usb/ci13xxx-imx.txt
index 5778b9c..dd42ccd 100644
--- a/Documentation/devicetree/bindings/usb/ci13xxx-imx.txt
+++ b/Documentation/devicetree/bindings/usb/ci13xxx-imx.txt
@@ -5,6 +5,11 @@ Required properties:
 - reg: Should contain registers location and length
 - interrupts: Should contain controller interrupt
 
+Recommended properies:
+- phy_type: the type of the phy connected to the core. Should be one
+  of utmi, utmi_wide, ulpi, serial or hsic. Without this
+  property the PORTSC register won't be touched
+
 Optional properties:
 - fsl,usbphy: phandler of usb phy that connects to the only one port
 - fsl,usbmisc: phandler of non-core register device, with one argument
diff --git a/drivers/usb/chipidea/bits.h b/drivers/usb/chipidea/bits.h
index 050de85..d8ffc2f 100644
--- a/drivers/usb/chipidea/bits.h
+++ b/drivers/usb/chipidea/bits.h
@@ -48,10 +48,22 @@
 #define PORTSC_SUSP   BIT(7)
 #define PORTSC_HSPBIT(9)
 #define PORTSC_PTC(0x0FUL  16)
+/* PTS and PTW for non lpm version only */
+#define PORTSC_PTS(d) d)  0x3)  30) | (((d)  0x4) ? BIT(25) : 
0))
+#define PORTSC_PTWBIT(28)
 
 /* DEVLC */
 #define DEVLC_PSPD(0x03UL  25)
-#defineDEVLC_PSPD_HS  (0x02UL  25)
+#define DEVLC_PSPD_HS (0x02UL  25)
+#define DEVLC_PTW BIT(27)
+#define DEVLC_STS BIT(28)
+#define DEVLC_PTS(d)  (((d)  0x7)  29)
+
+/* Encoding for DEVLC_PTS and PORTSC_PTS */
+#define PTS_UTMI  0
+#define PTS_ULPI  2
+#define PTS_SERIAL3
+#define PTS_HSIC  4
 
 /* OTGSC */
 #define OTGSC_IDPU   BIT(5)
diff --git a/drivers/usb/chipidea/ci13xxx_imx.c 
b/drivers/usb/chipidea/ci13xxx_imx.c
index 69024e0..ebc1148 100644
--- a/drivers/usb/chipidea/ci13xxx_imx.c
+++ b/drivers/usb/chipidea/ci13xxx_imx.c
@@ -21,6 +21,7 @@
 #include linux/clk.h
 #include linux/regulator/consumer.h
 #include linux/pinctrl/consumer.h
+#include linux/usb/of.h
 
 #include ci.h
 #include ci13xxx_imx.h
@@ -112,6 +113,8 @@ static int ci13xxx_imx_probe(struct platform_device *pdev)
   CI13XXX_PULLUP_ON_VBUS |
   CI13XXX_DISABLE_STREAMING;
 
+   pdata-phy_mode = of_usb_get_phy_mode(pdev-dev.of_node);
+
data = devm_kzalloc(pdev-dev, sizeof(*data), GFP_KERNEL);
if (!data) {
dev_err(pdev-dev, Failed to allocate CI13xxx-IMX data!\n);
diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index 57cae1f..04d68cb 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -67,6 +67,8 @@
 #include linux/usb/gadget.h
 #include linux/usb/otg.h
 #include linux/usb/chipidea.h
+#include linux/usb/of.h
+#include linux/phy.h
 
 #include ci.h
 #include udc.h
@@ -211,6 +213,41 @@ static int hw_device_init(struct ci13xxx *ci, void __iomem 
*base)
return 0;
 }
 
+static void hw_phymode_configure(struct ci13xxx *ci)
+{
+   u32 portsc, lpm;
+
+   switch (ci-platdata-phy_mode) {
+   case USBPHY_INTERFACE_MODE_UTMI:
+   portsc = PORTSC_PTS(PTS_UTMI);
+   lpm = DEVLC_PTS(PTS_UTMI);
+   break;
+   case USBPHY_INTERFACE_MODE_UTMIW:
+   portsc = PORTSC_PTS(PTS_UTMI) | PORTSC_PTW;
+   lpm = DEVLC_PTS(PTS_UTMI) | DEVLC_PTW;
+   break;
+   case USBPHY_INTERFACE_MODE_ULPI:
+   portsc = PORTSC_PTS(PTS_ULPI);
+   lpm = DEVLC_PTS(PTS_ULPI);
+   break;
+   case USBPHY_INTERFACE_MODE_SERIAL:
+   portsc = PORTSC_PTS(PTS_SERIAL);
+   lpm = DEVLC_PTS(PTS_SERIAL);
+   break;
+   case USBPHY_INTERFACE_MODE_HSIC:
+   portsc = PORTSC_PTS(PTS_HSIC);
+   lpm = DEVLC_PTS(PTS_HSIC);
+   break;
+   default:
+   return;
+   }
+
+   if (ci-hw_bank.lpm)
+   hw_write(ci, OP_DEVLC, DEVLC_PTS(7) | DEVLC_PTW, lpm);
+   else
+   hw_write(ci, OP_PORTSC, PORTSC_PTS(7) | PORTSC_PTW, portsc);
+}
+
 

[PATCH 9/9] USB chipidea i.MX: use devm_usb_get_phy_by_phandle to get phy

2013-02-04 Thread Sascha Hauer
Signed-off-by: Sascha Hauer s.ha...@pengutronix.de
---
 drivers/usb/chipidea/ci13xxx_imx.c |   39 +---
 1 file changed, 18 insertions(+), 21 deletions(-)

diff --git a/drivers/usb/chipidea/ci13xxx_imx.c 
b/drivers/usb/chipidea/ci13xxx_imx.c
index b598bb8f..136869b 100644
--- a/drivers/usb/chipidea/ci13xxx_imx.c
+++ b/drivers/usb/chipidea/ci13xxx_imx.c
@@ -30,7 +30,6 @@
((struct usb_phy *)platform_get_drvdata(pdev))
 
 struct ci13xxx_imx_data {
-   struct device_node *phy_np;
struct usb_phy *phy;
struct platform_device *ci_pdev;
struct clk *clk;
@@ -90,12 +89,12 @@ static int ci13xxx_imx_probe(struct platform_device *pdev)
 {
struct ci13xxx_imx_data *data;
struct ci13xxx_platform_data *pdata;
-   struct platform_device *plat_ci, *phy_pdev;
-   struct device_node *phy_np;
+   struct platform_device *plat_ci;
struct resource *res;
struct regulator *reg_vbus;
struct pinctrl *pinctrl;
int ret;
+   struct usb_phy *phy;
 
if (of_find_property(pdev-dev.of_node, fsl,usbmisc, NULL)
 !usbmisc_ops)
@@ -147,19 +146,21 @@ static int ci13xxx_imx_probe(struct platform_device *pdev)
return ret;
}
 
-   phy_np = of_parse_phandle(pdev-dev.of_node, fsl,usbphy, 0);
-   if (phy_np) {
-   data-phy_np = phy_np;
-   phy_pdev = of_find_device_by_node(phy_np);
-   if (phy_pdev) {
-   struct usb_phy *phy;
-   phy = pdev_to_phy(phy_pdev);
-   if (phy 
-   try_module_get(phy_pdev-dev.driver-owner)) {
-   usb_phy_init(phy);
-   data-phy = phy;
-   }
+   phy = devm_usb_get_phy_by_phandle(pdev-dev, fsl,usbphy, 0);
+
+   if (PTR_ERR(phy) == -EPROBE_DEFER) {
+   ret = -EPROBE_DEFER;
+   goto err_clk;
+   }
+
+   if (!IS_ERR(phy)) {
+   ret = usb_phy_init(phy);
+   if (ret) {
+   dev_err(pdev-dev, unable to init phy: %d\n, ret);
+   goto err_clk;
}
+
+   data-phy = phy;
}
 
/* we only support host now, so enable vbus here */
@@ -170,7 +171,7 @@ static int ci13xxx_imx_probe(struct platform_device *pdev)
dev_err(pdev-dev,
Failed to enable vbus regulator, err=%d\n,
ret);
-   goto put_np;
+   goto err_clk;
}
data-reg_vbus = reg_vbus;
} else {
@@ -222,9 +223,7 @@ static int ci13xxx_imx_probe(struct platform_device *pdev)
 err:
if (reg_vbus)
regulator_disable(reg_vbus);
-put_np:
-   if (phy_np)
-   of_node_put(phy_np);
+err_clk:
clk_disable_unprepare(data-clk);
return ret;
 }
@@ -244,8 +243,6 @@ static int ci13xxx_imx_remove(struct platform_device *pdev)
module_put(data-phy-dev-driver-owner);
}
 
-   of_node_put(data-phy_np);
-
clk_disable_unprepare(data-clk);
 
platform_set_drvdata(pdev, NULL);
-- 
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 3/9] USB: add devicetree helpers for determining dr_mode and phy_type

2013-02-04 Thread Sascha Hauer
From: Michael Grzeschik m.grzesc...@pengutronix.de

This adds two little devicetree helper functions for determining the
dr_mode (host, peripheral, otg) and phy_type (utmi, ulpi,...) from
the devicetree.

Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de
Signed-off-by: Marc Kleine-Budde m...@pengutronix.de
Signed-off-by: Sascha Hauer s.ha...@pengutronix.de
---
 drivers/usb/phy/Makefile |1 +
 drivers/usb/phy/of.c |   47 ++
 drivers/usb/usb-common.c |   36 +++
 include/linux/usb/of.h   |   27 ++
 include/linux/usb/otg.h  |7 +++
 include/linux/usb/phy.h  |9 +
 6 files changed, 127 insertions(+)
 create mode 100644 drivers/usb/phy/of.c
 create mode 100644 include/linux/usb/of.h

diff --git a/drivers/usb/phy/Makefile b/drivers/usb/phy/Makefile
index 9fa6327..e1be1e8 100644
--- a/drivers/usb/phy/Makefile
+++ b/drivers/usb/phy/Makefile
@@ -5,6 +5,7 @@
 ccflags-$(CONFIG_USB_DEBUG) := -DDEBUG
 
 obj-$(CONFIG_USB_OTG_UTILS)+= phy.o
+obj-$(CONFIG_OF)   += of.o
 obj-$(CONFIG_OMAP_USB2)+= omap-usb2.o
 obj-$(CONFIG_OMAP_USB3)+= omap-usb3.o
 obj-$(CONFIG_OMAP_CONTROL_USB) += omap-control-usb.o
diff --git a/drivers/usb/phy/of.c b/drivers/usb/phy/of.c
new file mode 100644
index 000..e6f3b74
--- /dev/null
+++ b/drivers/usb/phy/of.c
@@ -0,0 +1,47 @@
+/*
+ * USB of helper code
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include linux/kernel.h
+#include linux/module.h
+#include linux/of.h
+#include linux/usb/of.h
+#include linux/usb/otg.h
+
+static const char *usbphy_modes[] = {
+   [USBPHY_INTERFACE_MODE_UNKNOWN] = ,
+   [USBPHY_INTERFACE_MODE_UTMI]= utmi,
+   [USBPHY_INTERFACE_MODE_UTMIW]   = utmi_wide,
+   [USBPHY_INTERFACE_MODE_ULPI]= ulpi,
+   [USBPHY_INTERFACE_MODE_SERIAL]  = serial,
+   [USBPHY_INTERFACE_MODE_HSIC]= hsic,
+};
+
+/**
+ * of_usb_get_phy_mode - Get phy mode for given device_node
+ * @np:Pointer to the given device_node
+ *
+ * The function gets phy interface string from property 'phy_type',
+ * and returns the correspondig enum usb_phy_interface
+ */
+enum usb_phy_interface of_usb_get_phy_mode(struct device_node *np)
+{
+   const char *phy_type;
+   int err, i;
+
+   err = of_property_read_string(np, phy_type, phy_type);
+   if (err  0)
+   return USBPHY_INTERFACE_MODE_UNKNOWN;
+
+   for (i = 0; i  ARRAY_SIZE(usbphy_modes); i++)
+   if (!strcmp(phy_type, usbphy_modes[i]))
+   return i;
+
+   return USBPHY_INTERFACE_MODE_UNKNOWN;
+}
+EXPORT_SYMBOL_GPL(of_usb_get_phy_mode);
diff --git a/drivers/usb/usb-common.c b/drivers/usb/usb-common.c
index d29503e..ad4d87d 100644
--- a/drivers/usb/usb-common.c
+++ b/drivers/usb/usb-common.c
@@ -14,6 +14,9 @@
 #include linux/kernel.h
 #include linux/module.h
 #include linux/usb/ch9.h
+#include linux/of.h
+#include linux/usb/of.h
+#include linux/usb/otg.h
 
 const char *usb_speed_string(enum usb_device_speed speed)
 {
@@ -32,4 +35,37 @@ const char *usb_speed_string(enum usb_device_speed speed)
 }
 EXPORT_SYMBOL_GPL(usb_speed_string);
 
+#ifdef CONFIG_OF
+static const char *usb_dr_modes[] = {
+   [USB_DR_MODE_UNKNOWN]   = ,
+   [USB_DR_MODE_HOST]  = host,
+   [USB_DR_MODE_PERIPHERAL]= peripheral,
+   [USB_DR_MODE_OTG]   = otg,
+};
+
+/**
+ * of_usb_get_dr_mode - Get dual role mode for given device_node
+ * @np:Pointer to the given device_node
+ *
+ * The function gets phy interface string from property 'dr_mode',
+ * and returns the correspondig enum usb_dr_mode
+ */
+enum usb_dr_mode of_usb_get_dr_mode(struct device_node *np)
+{
+   const char *dr_mode;
+   int err, i;
+
+   err = of_property_read_string(np, dr_mode, dr_mode);
+   if (err  0)
+   return USB_DR_MODE_UNKNOWN;
+
+   for (i = 0; i  ARRAY_SIZE(usb_dr_modes); i++)
+   if (!strcmp(dr_mode, usb_dr_modes[i]))
+   return i;
+
+   return USB_DR_MODE_UNKNOWN;
+}
+EXPORT_SYMBOL_GPL(of_usb_get_dr_mode);
+#endif
+
 MODULE_LICENSE(GPL);
diff --git a/include/linux/usb/of.h b/include/linux/usb/of.h
new file mode 100644
index 000..4681a20
--- /dev/null
+++ b/include/linux/usb/of.h
@@ -0,0 +1,27 @@
+/*
+ * OF helpers for usb devices.
+ *
+ * This file is released under the GPLv2
+ */
+
+#ifndef __LINUX_USB_OF_H
+#define __LINUX_USB_OF_H
+
+#include linux/usb/phy.h
+
+#ifdef CONFIG_OF
+enum usb_phy_interface of_usb_get_phy_mode(struct device_node *np);
+enum usb_dr_mode of_usb_get_dr_mode(struct device_node *np);
+#else
+static inline 

[PATCH 2/9] USB: move bulk of otg/otg.c to phy/phy.c

2013-02-04 Thread Sascha Hauer
Most of otg/otg.c is not otg specific, but phy specific, so move it
to the phy directory.

Signed-off-by: Sascha Hauer s.ha...@pengutronix.de
Reported-by: Kishon Vijay Abraham I kis...@ti.com
Cc: Felipe Balbi ba...@ti.com
---
 drivers/usb/otg/otg.c|  427 
 drivers/usb/phy/Makefile |1 +
 drivers/usb/phy/phy.c|  438 ++
 3 files changed, 439 insertions(+), 427 deletions(-)
 create mode 100644 drivers/usb/phy/phy.c

diff --git a/drivers/usb/otg/otg.c b/drivers/usb/otg/otg.c
index 2bd03d2..358cfd9 100644
--- a/drivers/usb/otg/otg.c
+++ b/drivers/usb/otg/otg.c
@@ -8,436 +8,9 @@
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  */
-
-#include linux/kernel.h
 #include linux/export.h
-#include linux/err.h
-#include linux/device.h
-#include linux/module.h
-#include linux/slab.h
-#include linux/of.h
-
 #include linux/usb/otg.h
 
-static LIST_HEAD(phy_list);
-static LIST_HEAD(phy_bind_list);
-static DEFINE_SPINLOCK(phy_lock);
-
-static struct usb_phy *__usb_find_phy(struct list_head *list,
-   enum usb_phy_type type)
-{
-   struct usb_phy  *phy = NULL;
-
-   list_for_each_entry(phy, list, head) {
-   if (phy-type != type)
-   continue;
-
-   return phy;
-   }
-
-   return ERR_PTR(-ENODEV);
-}
-
-static struct usb_phy *__usb_find_phy_dev(struct device *dev,
-   struct list_head *list, u8 index)
-{
-   struct usb_phy_bind *phy_bind = NULL;
-
-   list_for_each_entry(phy_bind, list, list) {
-   if (!(strcmp(phy_bind-dev_name, dev_name(dev))) 
-   phy_bind-index == index) {
-   if (phy_bind-phy)
-   return phy_bind-phy;
-   else
-   return ERR_PTR(-EPROBE_DEFER);
-   }
-   }
-
-   return ERR_PTR(-ENODEV);
-}
-
-static struct usb_phy *__of_usb_find_phy(struct device_node *node)
-{
-   struct usb_phy  *phy;
-
-   list_for_each_entry(phy, phy_list, head) {
-   if (node != phy-dev-of_node)
-   continue;
-
-   return phy;
-   }
-
-   return ERR_PTR(-ENODEV);
-}
-
-static void devm_usb_phy_release(struct device *dev, void *res)
-{
-   struct usb_phy *phy = *(struct usb_phy **)res;
-
-   usb_put_phy(phy);
-}
-
-static int devm_usb_phy_match(struct device *dev, void *res, void *match_data)
-{
-   return res == match_data;
-}
-
-/**
- * devm_usb_get_phy - find the USB PHY
- * @dev - device that requests this phy
- * @type - the type of the phy the controller requires
- *
- * Gets the phy using usb_get_phy(), and associates a device with it using
- * devres. On driver detach, release function is invoked on the devres data,
- * then, devres data is freed.
- *
- * For use by USB host and peripheral drivers.
- */
-struct usb_phy *devm_usb_get_phy(struct device *dev, enum usb_phy_type type)
-{
-   struct usb_phy **ptr, *phy;
-
-   ptr = devres_alloc(devm_usb_phy_release, sizeof(*ptr), GFP_KERNEL);
-   if (!ptr)
-   return NULL;
-
-   phy = usb_get_phy(type);
-   if (!IS_ERR(phy)) {
-   *ptr = phy;
-   devres_add(dev, ptr);
-   } else
-   devres_free(ptr);
-
-   return phy;
-}
-EXPORT_SYMBOL(devm_usb_get_phy);
-
-/**
- * usb_get_phy - find the USB PHY
- * @type - the type of the phy the controller requires
- *
- * Returns the phy driver, after getting a refcount to it; or
- * -ENODEV if there is no such phy.  The caller is responsible for
- * calling usb_put_phy() to release that count.
- *
- * For use by USB host and peripheral drivers.
- */
-struct usb_phy *usb_get_phy(enum usb_phy_type type)
-{
-   struct usb_phy  *phy = NULL;
-   unsigned long   flags;
-
-   spin_lock_irqsave(phy_lock, flags);
-
-   phy = __usb_find_phy(phy_list, type);
-   if (IS_ERR(phy) || !try_module_get(phy-dev-driver-owner)) {
-   pr_err(unable to find transceiver of type %s\n,
-   usb_phy_type_string(type));
-   goto err0;
-   }
-
-   get_device(phy-dev);
-
-err0:
-   spin_unlock_irqrestore(phy_lock, flags);
-
-   return phy;
-}
-EXPORT_SYMBOL(usb_get_phy);
-
- /**
- * devm_usb_get_phy_by_phandle - find the USB PHY by phandle
- * @dev - device that requests this phy
- * @phandle - name of the property holding the phy phandle value
- * @index - the index of the phy
- *
- * Returns the phy driver associated with the given phandle value,
- * after getting a refcount to it, -ENODEV if there is no such phy or
- * -EPROBE_DEFER if there is a phandle to the phy, but the device is
- * not yet loaded. While at that, it also associates the device with
- * the phy using devres. On driver detach, release function is invoked
- * on the devres data, then, devres 

Re: [PATCH 1/9] usb: otg: use try_module_get in all usb_get_phy functions and add missing module_put

2013-02-04 Thread Roger Quadros
On 02/04/2013 03:24 PM, Sascha Hauer wrote:
 From: Marc Kleine-Budde m...@pengutronix.de
 
 In patch 5d3c28b usb: otg: add device tree support to otg library
 devm_usb_get_phy_by_phandle() was added. It uses try_module_get() to lock the
 phy driver in memory. The corresponding module_put() is missing in that patch.
 
 This patch adds try_module_get() to usb_get_phy() and usb_get_phy_dev().
 Further the missing module_put() is added to usb_put_phy().
 
 Signed-off-by: Marc Kleine-Budde m...@pengutronix.de
 Signed-off-by: Sascha Hauer s.ha...@pengutronix.de
 ---
  drivers/usb/otg/otg.c |   10 +++---
  1 file changed, 7 insertions(+), 3 deletions(-)
 
 diff --git a/drivers/usb/otg/otg.c b/drivers/usb/otg/otg.c
 index e181439..2bd03d2 100644
 --- a/drivers/usb/otg/otg.c
 +++ b/drivers/usb/otg/otg.c
 @@ -130,7 +130,7 @@ struct usb_phy *usb_get_phy(enum usb_phy_type type)
   spin_lock_irqsave(phy_lock, flags);
  
   phy = __usb_find_phy(phy_list, type);
 - if (IS_ERR(phy)) {
 + if (IS_ERR(phy) || !try_module_get(phy-dev-driver-owner)) {
   pr_err(unable to find transceiver of type %s\n,
   usb_phy_type_string(type));
   goto err0;

There are 2 problems with this.

- If phy was found but try_module_get failed you are not returning error code.

- If phy was found and try_module_get fails we would want to use deferred 
probing,
since this case is possible if the phy module is not yet loaded and alive but 
can be in
the future.

I would change the code to

if (IS_ERR(phy)) {
pr_err(unable to find transceiver of type %s\n,
usb_phy_type_string(type));
goto err0;
}

if (!try_module_get(phy-dev-driver-owner)) {
phy = ERR_PTR(-EPROBE_DEFER);
goto err0;
}

 @@ -228,7 +228,7 @@ struct usb_phy *usb_get_phy_dev(struct device *dev, u8 
 index)
   spin_lock_irqsave(phy_lock, flags);
  
   phy = __usb_find_phy_dev(dev, phy_bind_list, index);
 - if (IS_ERR(phy)) {
 + if (IS_ERR(phy) || !try_module_get(phy-dev-driver-owner)) {
   pr_err(unable to find transceiver\n);
   goto err0;
   }
 @@ -301,8 +301,12 @@ EXPORT_SYMBOL(devm_usb_put_phy);
   */
  void usb_put_phy(struct usb_phy *x)
  {
 - if (x)
 + if (x) {
 + struct module *owner = x-dev-driver-owner;
 +
   put_device(x-dev);
 + module_put(owner);
 + }
  }
  EXPORT_SYMBOL(usb_put_phy);
  
 

cheers,
-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 1/9] usb: otg: use try_module_get in all usb_get_phy functions and add missing module_put

2013-02-04 Thread Marc Kleine-Budde
On 02/04/2013 02:59 PM, Roger Quadros wrote:
 On 02/04/2013 03:24 PM, Sascha Hauer wrote:
 From: Marc Kleine-Budde m...@pengutronix.de

 In patch 5d3c28b usb: otg: add device tree support to otg library
 devm_usb_get_phy_by_phandle() was added. It uses try_module_get() to lock the
 phy driver in memory. The corresponding module_put() is missing in that 
 patch.

 This patch adds try_module_get() to usb_get_phy() and usb_get_phy_dev().
 Further the missing module_put() is added to usb_put_phy().

 Signed-off-by: Marc Kleine-Budde m...@pengutronix.de
 Signed-off-by: Sascha Hauer s.ha...@pengutronix.de
 ---
  drivers/usb/otg/otg.c |   10 +++---
  1 file changed, 7 insertions(+), 3 deletions(-)

 diff --git a/drivers/usb/otg/otg.c b/drivers/usb/otg/otg.c
 index e181439..2bd03d2 100644
 --- a/drivers/usb/otg/otg.c
 +++ b/drivers/usb/otg/otg.c
 @@ -130,7 +130,7 @@ struct usb_phy *usb_get_phy(enum usb_phy_type type)
  spin_lock_irqsave(phy_lock, flags);
  
  phy = __usb_find_phy(phy_list, type);
 -if (IS_ERR(phy)) {
 +if (IS_ERR(phy) || !try_module_get(phy-dev-driver-owner)) {
  pr_err(unable to find transceiver of type %s\n,
  usb_phy_type_string(type));
  goto err0;
 
 There are 2 problems with this.
 
 - If phy was found but try_module_get failed you are not returning error code.

Correct - but

 - If phy was found and try_module_get fails we would want to use deferred 
 probing,
 since this case is possible if the phy module is not yet loaded and alive but 
 can be in
 the future.

...this should not happen, as the phy list is protected by the
spin_lock. If a phy driver module has added a the phy to the
infrastructure, but has been rmmod'ed without removing the phy. The phy
driver is broken anyway.

Marc

-- 
Pengutronix e.K.  | Marc Kleine-Budde   |
Industrial Linux Solutions| Phone: +49-231-2826-924 |
Vertretung West/Dortmund  | Fax:   +49-5121-206917- |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |



signature.asc
Description: OpenPGP digital signature


[PATCH v2 09/31] USB: ehci-omap: Use devm_ioremap_resource()

2013-02-04 Thread Roger Quadros
Make use of devm_ioremap_resource() and correct comment.

CC: Alan Stern st...@rowland.harvard.edu
Signed-off-by: Roger Quadros rog...@ti.com
---
 drivers/usb/host/ehci-omap.c |   21 ++---
 1 files changed, 6 insertions(+), 15 deletions(-)

diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
index 30fc482..6b088a4 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));
-   if (!regs) {
-   dev_err(dev, UHH EHCI ioremap failed\n);
-   return -ENOMEM;
+   regs = devm_ioremap_resource(dev, res);
+   if (IS_ERR(regs)) {
+   dev_err(dev, Resource request/ioremap failed\n);
+   return PTR_ERR(regs);
}
 
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


Re: [PATCH 1/9] usb: otg: use try_module_get in all usb_get_phy functions and add missing module_put

2013-02-04 Thread Roger Quadros
On 02/04/2013 04:10 PM, Marc Kleine-Budde wrote:
 On 02/04/2013 02:59 PM, Roger Quadros wrote:
 On 02/04/2013 03:24 PM, Sascha Hauer wrote:
 From: Marc Kleine-Budde m...@pengutronix.de

 In patch 5d3c28b usb: otg: add device tree support to otg library
 devm_usb_get_phy_by_phandle() was added. It uses try_module_get() to lock 
 the
 phy driver in memory. The corresponding module_put() is missing in that 
 patch.

 This patch adds try_module_get() to usb_get_phy() and usb_get_phy_dev().
 Further the missing module_put() is added to usb_put_phy().

 Signed-off-by: Marc Kleine-Budde m...@pengutronix.de
 Signed-off-by: Sascha Hauer s.ha...@pengutronix.de
 ---
  drivers/usb/otg/otg.c |   10 +++---
  1 file changed, 7 insertions(+), 3 deletions(-)

 diff --git a/drivers/usb/otg/otg.c b/drivers/usb/otg/otg.c
 index e181439..2bd03d2 100644
 --- a/drivers/usb/otg/otg.c
 +++ b/drivers/usb/otg/otg.c
 @@ -130,7 +130,7 @@ struct usb_phy *usb_get_phy(enum usb_phy_type type)
 spin_lock_irqsave(phy_lock, flags);
  
 phy = __usb_find_phy(phy_list, type);
 -   if (IS_ERR(phy)) {
 +   if (IS_ERR(phy) || !try_module_get(phy-dev-driver-owner)) {
 pr_err(unable to find transceiver of type %s\n,
 usb_phy_type_string(type));
 goto err0;

 There are 2 problems with this.

 - If phy was found but try_module_get failed you are not returning error 
 code.
 
 Correct - but
 
 - If phy was found and try_module_get fails we would want to use deferred 
 probing,
 since this case is possible if the phy module is not yet loaded and alive 
 but can be in
 the future.
 
 ...this should not happen, as the phy list is protected by the
 spin_lock. If a phy driver module has added a the phy to the
 infrastructure, but has been rmmod'ed without removing the phy. The phy
 driver is broken anyway.
 

Yes, you are right.

cheers,
-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


[PATCH 31/31] USB: ehci-omap: Select NOP USB transceiver driver

2013-02-04 Thread Roger Quadros
In PHY mode we need to have the nop-usb-xceiv transceiver
driver to operate, so select it in Kconfig.

CC: Alan Stern st...@rowland.harvard.edu
Signed-off-by: Roger Quadros rog...@ti.com
---
 drivers/usb/host/Kconfig |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index 11e102e..2d2975d 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -157,6 +157,7 @@ config USB_EHCI_MXC
 config USB_EHCI_HCD_OMAP
tristate EHCI support for OMAP3 and later chips
depends on USB_EHCI_HCD  ARCH_OMAP
+   select NOP_USB_XCEIV
default y
---help---
  Enables support for the on-chip EHCI controller on
-- 
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] usb: gadget: remove inode.c

2013-02-04 Thread Michal Nazarewicz
On Thu, Jan 24 2013, Felipe Balbi wrote:
 the benefit is that we will be able to go ahed with configfs-based
 binding and will be able to drop duplicated gadget code between legacy
 (non-composite) and composite framework with the function drivers.

I'm not sure whether keeping gadgetfs around is such a big issue
though.  It would be legacy, deprecated piece of code which cannot be
used with composite functions, but so what?

Obviously I won't be stopping anyone from creating a compatibility
layer, but I really don't think it's worth it.  If it were, I'd write
functionfs to use gadgetfs' interface in the first place.

-- 
Best regards, _ _
.o. | Liege of Serenely Enlightened Majesty of  o' \,=./ `o
..o | Computer Science,  Michał “mina86” Nazarewicz(o o)
ooo +email/xmpp: m...@google.com--ooO--(_)--Ooo--

pgpqFJIR8lxEg.pgp
Description: PGP signature


Re: [PATCH] usb: gadget: remove inode.c

2013-02-04 Thread Felipe Balbi
Hi,

On Mon, Feb 04, 2013 at 04:27:49PM +0100, Michal Nazarewicz wrote:
 On Thu, Jan 24 2013, Felipe Balbi wrote:
  the benefit is that we will be able to go ahed with configfs-based
  binding and will be able to drop duplicated gadget code between legacy
  (non-composite) and composite framework with the function drivers.
 
 I'm not sure whether keeping gadgetfs around is such a big issue
 though.  It would be legacy, deprecated piece of code which cannot be
 used with composite functions, but so what?

When you have to keep an eye on over 100KLOCs, it helps sharing code as
much as possible.

 Obviously I won't be stopping anyone from creating a compatibility
 layer, but I really don't think it's worth it.  If it were, I'd write
 functionfs to use gadgetfs' interface in the first place.

Right, that would've been the best approach.

-- 
balbi


signature.asc
Description: Digital signature


Re: Linux USB file storage gadget with new UDC

2013-02-04 Thread Alan Stern
On Mon, 4 Feb 2013, victor yeo wrote:

 Thanks, i made a big progress. The udc driver is able to pass the ep1
 data (CBW) to gadget driver, and gadget driver handles the data (which
 is SCSI Inquiry command), and udc driver is able to send out the reply
 and CSW to host.
 
 After that, in get_next_command(), in the statement below, the
 bh-state is 2 (BUF_STATE_BUSY), and the get_next_command() goes to
 sleep and never wakes up.
 
 while (bh-state != BUF_STATE_EMPTY) {
 rc = sleep_thread(fsg);
 if (rc)
 return rc;
 }
 
 How to set bh-state to BUF_STATE_EMPTY after the buffer is processed?

It gets set to BUF_STATE_EMPTY in several different places, depending
on the purpose the buffer was used for.  See bulk_in_complete (your UDC
driver should call this routine for every request over a bulk-IN
endpoint, when it is safe for the gadget driver to overwrite the data
in the transfer buffer and re-use the request). See also
get_next_command, the line just after the call to received_cbw.

You know, you didn't have to ask me this question.  You could have 
found the answer more easily yourself simply by searching for 
BUF_STATE_EMPTY in file_storage.c.

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 v4 4/4] drivers: usb: start using the control module driver

2013-02-04 Thread Felipe Balbi
Hi,

On Fri, Feb 01, 2013 at 11:14:24AM -0800, Tony Lindgren wrote:
 * Felipe Balbi ba...@ti.com [130125 02:30]:
  Hi,
  
  On Fri, Jan 25, 2013 at 03:54:00PM +0530, Kishon Vijay Abraham I wrote:
   Start using the control module driver for powering on the PHY and for
   writing to the mailbox instead of writing to the control module
   registers on their own.
   
   Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
   ---
Documentation/devicetree/bindings/usb/omap-usb.txt |4 ++
Documentation/devicetree/bindings/usb/usb-phy.txt  |7 +-
arch/arm/mach-omap2/omap_hwmod_44xx_data.c |   13 
  
  I'm taking this patch but I'm leaving out the omap_hwmod_44xx_data.c
  change just to kill dependency. Can you send that single change as a
  separate patch which Tony can queue ?
 
 For the USB patches, please also leave out patches touching
 arch/arm/mach-omap2/devices.c. Those are almost guaranteed to
 cause pointless merge conflicts with other branches.
 
 I suggest you set up few immutable branches:
 
 1. Minimal platform_data changes for all your USB changes
 
 This should contain include/linux/platform_data changes and
 changes to arch/arm/*omap* so me and Paul can merge it in too
 to avoid merge conflicts.
 
 2. The rest of the driver/usb changes
 
 This can then be based on #1 branch above.
 
 3. Changes for the .dts files for Benoit
 
 These can be queued separately from #1 and #2 above.

I'm done with all USB stuff for this merge window. The patches which I
didn't take have no dependencies on any drivers/ part. You can easily
queue this through your tree.

cheers

-- 
balbi


signature.asc
Description: Digital signature


[PATCH 00/13] Device tree support for OMAP HS USB Host

2013-02-04 Thread Roger Quadros
Hi,

This patchset adds device tree support for OMAP's High Speed USB Host
subsystem. Board adaptation for Panda and Beagleboard is also provided.

Tested on Beagleboard.

Will only work with Panda if we provide a reference to the PHY clock
generator in the device tree in PATCH 11. I do not know how to do that
as there is no way to provide a phandle to any of the OMAP generated clocks
in the device tree. Suggestions welcome :).

Based on linux-next:next-20130204

Depends on USB: omap-ehci: Move PHY management to PHY driver
g...@github.com:rogerq/linux.git next-usbhost16

The following changes since commit 8c00470e1308d08df1f2b2c7e9a561d868ec0526:

  USB: ehci-omap: Select NOP USB transceiver driver (2013-02-04 16:36:06 +0200)

are available in the git repository at:
  g...@github.com:rogerq/linux.git next-usbhost16-dt

Roger Quadros (13):
  usb: phy: nop: Add device tree support and binding information
  USB: phy: nop: Defer probe if device needs VCC/RESET
  mfd: omap-usb-tll: move configuration code to omap_tll_init()
  mfd: omap-usb-tll: Add device tree support
  USB: ehci-omap: Get platform resources by index rather than by name
  USB: ohci-omap3: Get platform resources by index rather than by name
  USB: ohci-omap3: Add device tree support and binding information
  USB: ehci-omap: Add device tree support and binding information
  mfd: omap-usb-host: Add device tree support and binding information
  ARM: dts: OMAP4: Add HS USB Host IP nodes
  ARM: dts: omap4-panda: Add USB Host support
  ARM: dts: OMAP3: Add HS USB Host IP nodes
  ARM: dts: omap3-beagle: Add USB Host support

 .../devicetree/bindings/mfd/omap-usb-host.txt  |   68 +++
 .../devicetree/bindings/mfd/omap-usb-tll.txt   |   17 ++
 .../devicetree/bindings/usb/omap-ehci.txt  |   34 +++
 .../devicetree/bindings/usb/omap3-ohci.txt |   17 ++
 .../devicetree/bindings/usb/usb-nop-xceiv.txt  |   34 +++
 arch/arm/boot/dts/omap3-beagle.dts |   71 +++
 arch/arm/boot/dts/omap3.dtsi   |   31 +++
 arch/arm/boot/dts/omap4-panda.dts  |   55 +
 arch/arm/boot/dts/omap4.dtsi   |   30 +++
 drivers/mfd/omap-usb-host.c|   90 -
 drivers/mfd/omap-usb-tll.c |  213 ++--
 drivers/mfd/omap-usb.h |5 +-
 drivers/usb/host/ehci-omap.c   |   41 -
 drivers/usb/host/ohci-omap3.c  |   24 ++-
 drivers/usb/otg/nop-usb-xceiv.c|   39 
 include/linux/usb/nop-usb-xceiv.h  |4 +
 16 files changed, 651 insertions(+), 122 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mfd/omap-usb-host.txt
 create mode 100644 Documentation/devicetree/bindings/mfd/omap-usb-tll.txt
 create mode 100644 Documentation/devicetree/bindings/usb/omap-ehci.txt
 create mode 100644 Documentation/devicetree/bindings/usb/omap3-ohci.txt
 create mode 100644 Documentation/devicetree/bindings/usb/usb-nop-xceiv.txt

-- 
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 02/13] USB: phy: nop: Defer probe if device needs VCC/RESET

2013-02-04 Thread Roger Quadros
Add 2 flags, needs_vcc and needs_reset to platform data.
If the flag is set and the regulator couldn't be found
then we bail out with -EPROBE_DEFER.

For device tree boot we depend on presensce of vcc-supply/
reset-supply properties to decide if we should bail out
with -EPROBE_DEFER or just continue in case the regulator
can't be found.

This is required for proper functionality in cases where the
regulator is needed but is probed later than the PHY device.

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

diff --git a/drivers/usb/otg/nop-usb-xceiv.c b/drivers/usb/otg/nop-usb-xceiv.c
index adbb7ab..7860e7569 100644
--- a/drivers/usb/otg/nop-usb-xceiv.c
+++ b/drivers/usb/otg/nop-usb-xceiv.c
@@ -147,6 +147,10 @@ static void nop_xeiv_get_dt_pdata(struct device *dev,
 
if (!of_property_read_u32(node, clock-frequency, clk_rate))
pdata-clk_rate = clk_rate;
+   if (of_property_read_bool(node, vcc-supply))
+   pdata-needs_vcc = true;
+   if (of_property_read_bool(node, reset-supply))
+   pdata-needs_reset = true;
 }
 
 static int nop_usb_xceiv_probe(struct platform_device *pdev)
@@ -205,12 +209,16 @@ static int nop_usb_xceiv_probe(struct platform_device 
*pdev)
if (IS_ERR(nop-vcc)) {
dev_dbg(pdev-dev, Error getting vcc regulator: %ld\n,
PTR_ERR(nop-vcc));
+   if (pdata-needs_vcc)
+   return -EPROBE_DEFER;
}
 
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));
+   if (pdata-needs_reset)
+   return -EPROBE_DEFER;
}
 
nop-dev= pdev-dev;
diff --git a/include/linux/usb/nop-usb-xceiv.h 
b/include/linux/usb/nop-usb-xceiv.h
index 3265b61..148d351 100644
--- a/include/linux/usb/nop-usb-xceiv.h
+++ b/include/linux/usb/nop-usb-xceiv.h
@@ -6,6 +6,10 @@
 struct nop_usb_xceiv_platform_data {
enum usb_phy_type type;
unsigned long clk_rate;
+
+   /* if set fails with -EPROBE_DEFER if can't get regulator */
+   unsigned int needs_vcc:1;
+   unsigned int needs_reset:1;
 };
 
 #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 01/13] usb: phy: nop: Add device tree support and binding information

2013-02-04 Thread Roger Quadros
The PHY clock, clock rate, VCC regulator and RESET regulator
can now be provided via device tree.

Signed-off-by: Roger Quadros rog...@ti.com
---
 .../devicetree/bindings/usb/usb-nop-xceiv.txt  |   34 
 drivers/usb/otg/nop-usb-xceiv.c|   31 ++
 2 files changed, 65 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/usb/usb-nop-xceiv.txt

diff --git a/Documentation/devicetree/bindings/usb/usb-nop-xceiv.txt 
b/Documentation/devicetree/bindings/usb/usb-nop-xceiv.txt
new file mode 100644
index 000..d7e2726
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/usb-nop-xceiv.txt
@@ -0,0 +1,34 @@
+USB NOP PHY
+
+Required properties:
+- compatible: should be usb-nop-xceiv
+
+Optional properties:
+- clocks: phandle to the PHY clock. Use as per Documentation/devicetree
+  /bindings/clock/clock-bindings.txt
+  This property is required if clock-frequency is specified.
+
+- clock-names: Should be main_clk
+
+- clock-frequency: the clock frequency (in Hz) that the PHY clock must
+  be configured to.
+
+- vcc-supply: phandle to the regulator that provides RESET to the PHY.
+
+- reset-supply: phandle to the regulator that provides power to the PHY.
+
+Example:
+
+   hsusb1_phy {
+   compatible = usb-nop-xceiv;
+   clock-frequency = 1920;
+   clocks = osc 0;
+   clock-names = main_clk;
+   vcc-supply = hsusb1_vcc_regulator;
+   reset-supply = hsusb1_reset_regulator;
+   };
+
+hsusb1_phy is a NOP USB PHY device that gets its clock from an oscillator
+and expects that clock to be configured to 19.2MHz by the NOP PHY driver.
+hsusb1_vcc_regulator provides power to the PHY and hsusb1_reset_regulator
+controls RESET.
diff --git a/drivers/usb/otg/nop-usb-xceiv.c b/drivers/usb/otg/nop-usb-xceiv.c
index ac027a1..adbb7ab 100644
--- a/drivers/usb/otg/nop-usb-xceiv.c
+++ b/drivers/usb/otg/nop-usb-xceiv.c
@@ -34,6 +34,7 @@
 #include linux/slab.h
 #include linux/clk.h
 #include linux/regulator/consumer.h
+#include linux/of.h
 
 struct nop_usb_xceiv {
struct usb_phy  phy;
@@ -138,8 +139,19 @@ static int nop_set_host(struct usb_otg *otg, struct 
usb_bus *host)
return 0;
 }
 
+static void nop_xeiv_get_dt_pdata(struct device *dev,
+   struct nop_usb_xceiv_platform_data *pdata)
+{
+   struct device_node *node = dev-of_node;
+   u32 clk_rate;
+
+   if (!of_property_read_u32(node, clock-frequency, clk_rate))
+   pdata-clk_rate = clk_rate;
+}
+
 static int nop_usb_xceiv_probe(struct platform_device *pdev)
 {
+   struct device *dev = pdev-dev;
struct nop_usb_xceiv_platform_data *pdata = pdev-dev.platform_data;
struct nop_usb_xceiv*nop;
enum usb_phy_type   type = USB_PHY_TYPE_USB2;
@@ -153,6 +165,17 @@ static int nop_usb_xceiv_probe(struct platform_device 
*pdev)
if (!nop-phy.otg)
return -ENOMEM;
 
+   if (dev-of_node) {
+   pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
+   if (!pdata) {
+   dev_err(dev, Memory allocation failure\n);
+   return -ENOMEM;
+   }
+   nop_xeiv_get_dt_pdata(dev, pdata);
+   } else {
+   pdata = dev-platform_data;
+   }
+
if (pdata)
type = pdata-type;
 
@@ -236,12 +259,20 @@ static int nop_usb_xceiv_remove(struct platform_device 
*pdev)
return 0;
 }
 
+static const struct of_device_id nop_xceiv_dt_ids[] = {
+   { .compatible = usb-nop-xceiv },
+   { }
+};
+
+MODULE_DEVICE_TABLE(of, nop_xceiv_dt_ids);
+
 static struct platform_driver nop_usb_xceiv_driver = {
.probe  = nop_usb_xceiv_probe,
.remove = nop_usb_xceiv_remove,
.driver = {
.name   = nop_usb_xceiv,
.owner  = THIS_MODULE,
+   .of_match_table = of_match_ptr(nop_xceiv_dt_ids),
},
 };
 
-- 
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 04/13] mfd: omap-usb-tll: Add device tree support

2013-02-04 Thread Roger Quadros
Enable this driver to probe in device tree boot.

CC: Samuel Ortiz sa...@linux.intel.com
Signed-off-by: Roger Quadros rog...@ti.com
---
 .../devicetree/bindings/mfd/omap-usb-tll.txt   |   17 +
 drivers/mfd/omap-usb-tll.c |9 +
 2 files changed, 26 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mfd/omap-usb-tll.txt

diff --git a/Documentation/devicetree/bindings/mfd/omap-usb-tll.txt 
b/Documentation/devicetree/bindings/mfd/omap-usb-tll.txt
new file mode 100644
index 000..835cf4f
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/omap-usb-tll.txt
@@ -0,0 +1,17 @@
+OMAP HS USB Host TLL (Transceiver-Less Interface)
+
+Required properties:
+
+- compatible : should be ti,usbhs-tll
+- reg : should contain one register range i.e. start and length
+- interrupts : should contain the TLL module's interrupt
+- ti,hwmod : must contain usb_tll_hs
+
+Example:
+
+   usbhstll: usbhstll@0x4a062000 {
+   compatible = ti,usbhs-tll;
+   reg = 0x4a062000 0x1000;
+   interrupts = 78;
+   ti,hwmods = usb_tll_hs;
+ };
diff --git a/drivers/mfd/omap-usb-tll.c b/drivers/mfd/omap-usb-tll.c
index f7d2568..f7afb22 100644
--- a/drivers/mfd/omap-usb-tll.c
+++ b/drivers/mfd/omap-usb-tll.c
@@ -28,6 +28,7 @@
 #include linux/err.h
 #include linux/pm_runtime.h
 #include linux/platform_data/usb-omap.h
+#include linux/of.h
 
 #define USBTLL_DRIVER_NAME usbhs_tll
 
@@ -311,10 +312,18 @@ static int usbtll_omap_remove(struct platform_device 
*pdev)
return 0;
 }
 
+static const struct of_device_id usbtll_omap_dt_ids[] = {
+   { .compatible = ti,usbhs-tll },
+   { }
+};
+
+MODULE_DEVICE_TABLE(of, usbtll_omap_dt_ids);
+
 static struct platform_driver usbtll_omap_driver = {
.driver = {
.name   = (char *)usbtll_driver_name,
.owner  = THIS_MODULE,
+   .of_match_table = of_match_ptr(usbtll_omap_dt_ids),
},
.probe  = usbtll_omap_probe,
.remove = usbtll_omap_remove,
-- 
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 05/13] USB: ehci-omap: Get platform resources by index rather than by name

2013-02-04 Thread Roger Quadros
Since there is only one resource per type we don't really need
to use resource name to obtain it. This also also makes it easier
for device tree adaptation.

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

diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
index 60c4a2d..5a831aef 100644
--- a/drivers/usb/host/ehci-omap.c
+++ b/drivers/usb/host/ehci-omap.c
@@ -148,14 +148,13 @@ static int ehci_hcd_omap_probe(struct platform_device 
*pdev)
return -ENODEV;
}
 
-   irq = platform_get_irq_byname(pdev, ehci-irq);
+   irq = platform_get_irq(pdev, 0);
if (irq  0) {
dev_err(dev, EHCI irq failed\n);
return -ENODEV;
}
 
-   res =  platform_get_resource_byname(pdev,
-   IORESOURCE_MEM, ehci);
+   res =  platform_get_resource(pdev, IORESOURCE_MEM, 0);
regs = devm_ioremap_resource(dev, res);
if (IS_ERR(regs)) {
dev_err(dev, Resource request/ioremap failed\n);
-- 
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 03/13] mfd: omap-usb-tll: move configuration code to omap_tll_init()

2013-02-04 Thread Roger Quadros
This is because we want to get rid of platform_data usage from probe().
The only information we need is PORT_MODE, and this can be supplied
to us by the user (i.e. omap-usb-host.c).

We also move channel clock management from runtime PM handlers into
omap_tll_enable/disable().

CC: Samuel Ortiz sa...@linux.intel.com
Signed-off-by: Roger Quadros rog...@ti.com
---
 drivers/mfd/omap-usb-host.c |7 +-
 drivers/mfd/omap-usb-tll.c  |  204 +--
 drivers/mfd/omap-usb.h  |5 +-
 3 files changed, 107 insertions(+), 109 deletions(-)

diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
index 502a779..f8ed08e 100644
--- a/drivers/mfd/omap-usb-host.c
+++ b/drivers/mfd/omap-usb-host.c
@@ -278,7 +278,7 @@ static int usbhs_runtime_resume(struct device *dev)
 
dev_dbg(dev, usbhs_runtime_resume\n);
 
-   omap_tll_enable();
+   omap_tll_enable(pdata);
 
if (!IS_ERR(omap-ehci_logic_fck))
clk_enable(omap-ehci_logic_fck);
@@ -353,7 +353,7 @@ static int usbhs_runtime_suspend(struct device *dev)
if (!IS_ERR(omap-ehci_logic_fck))
clk_disable(omap-ehci_logic_fck);
 
-   omap_tll_disable();
+   omap_tll_disable(pdata);
 
return 0;
 }
@@ -499,6 +499,9 @@ static int usbhs_omap_probe(struct platform_device *pdev)
 
omap-pdata = pdata;
 
+   /* Initialize the TLL subsystem */
+   omap_tll_init(pdata);
+
pm_runtime_enable(dev);
 
platform_set_drvdata(pdev, omap);
diff --git a/drivers/mfd/omap-usb-tll.c b/drivers/mfd/omap-usb-tll.c
index 0aef1a7..f7d2568 100644
--- a/drivers/mfd/omap-usb-tll.c
+++ b/drivers/mfd/omap-usb-tll.c
@@ -1,8 +1,9 @@
 /**
  * omap-usb-tll.c - The USB TLL driver for OMAP EHCI  OHCI
  *
- * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com
+ * Copyright (C) 2012-2013 Texas Instruments Incorporated - http://www.ti.com
  * Author: Keshava Munegowda keshava_mgo...@ti.com
+ * Author: Roger Quadros rog...@ti.com
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2  of
@@ -105,8 +106,8 @@
 
 struct usbtll_omap {
int nch;/* num. of channels */
-   struct usbhs_omap_platform_data *pdata;
struct clk  **ch_clk;
+   void __iomem*base;
 };
 
 /*-*/
@@ -210,14 +211,10 @@ static unsigned ohci_omap3_fslsmode(enum 
usbhs_omap_port_mode mode)
 static int usbtll_omap_probe(struct platform_device *pdev)
 {
struct device   *dev =  pdev-dev;
-   struct usbhs_omap_platform_data *pdata = dev-platform_data;
-   void __iomem*base;
struct resource *res;
struct usbtll_omap  *tll;
-   unsignedreg;
int ret = 0;
int i, ver;
-   bool needs_tll;
 
dev_dbg(dev, starting TI HSUSB TLL Controller\n);
 
@@ -227,16 +224,9 @@ static int usbtll_omap_probe(struct platform_device *pdev)
return -ENOMEM;
}
 
-   if (!pdata) {
-   dev_err(dev, Platform data missing\n);
-   return -ENODEV;
-   }
-
-   tll-pdata = pdata;
-
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   base = devm_request_and_ioremap(dev, res);
-   if (!base) {
+   tll-base = devm_request_and_ioremap(dev, res);
+   if (!tll-base) {
ret = -EADDRNOTAVAIL;
dev_err(dev, Resource request/ioremap failed:%d\n, ret);
return ret;
@@ -246,7 +236,7 @@ static int usbtll_omap_probe(struct platform_device *pdev)
pm_runtime_enable(dev);
pm_runtime_get_sync(dev);
 
-   ver =  usbtll_read(base, OMAP_USBTLL_REVISION);
+   ver =  usbtll_read(tll-base, OMAP_USBTLL_REVISION);
switch (ver) {
case OMAP_USBTLL_REV1:
case OMAP_USBTLL_REV4:
@@ -283,11 +273,77 @@ static int usbtll_omap_probe(struct platform_device *pdev)
dev_dbg(dev, can't get clock : %s\n, clkname);
}
 
+   pm_runtime_put_sync(dev);
+   /* only after this can omap_tll_enable/disable work */
+   spin_lock(tll_lock);
+   tll_dev = dev;
+   spin_unlock(tll_lock);
+
+   return 0;
+
+err_clk_alloc:
+   pm_runtime_put_sync(dev);
+   pm_runtime_disable(dev);
+
+   return ret;
+}
+
+/**
+ * usbtll_omap_remove - shutdown processing for UHH  TLL HCDs
+ * @pdev: USB Host Controller being removed
+ *
+ * Reverses the effect of usbtll_omap_probe().
+ */
+static int usbtll_omap_remove(struct platform_device *pdev)
+{
+   struct usbtll_omap *tll = 

[PATCH 06/13] USB: ohci-omap3: Get platform resources by index rather than by name

2013-02-04 Thread Roger Quadros
Since there is only one resource per type we don't really need
to use resource name to obtain it. This also also makes it easier
for device tree adaptation.

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

diff --git a/drivers/usb/host/ohci-omap3.c b/drivers/usb/host/ohci-omap3.c
index eb35d96..5ed28c5 100644
--- a/drivers/usb/host/ohci-omap3.c
+++ b/drivers/usb/host/ohci-omap3.c
@@ -141,14 +141,13 @@ static int ohci_hcd_omap3_probe(struct platform_device 
*pdev)
return -ENODEV;
}
 
-   irq = platform_get_irq_byname(pdev, ohci-irq);
+   irq = platform_get_irq(pdev, 0);
if (irq  0) {
dev_err(dev, OHCI irq failed\n);
return -ENODEV;
}
 
-   res = platform_get_resource_byname(pdev,
-   IORESOURCE_MEM, ohci);
+   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) {
dev_err(dev, UHH OHCI get resource failed\n);
return -ENOMEM;
-- 
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/13] USB: ohci-omap3: Add device tree support and binding information

2013-02-04 Thread Roger Quadros
Allows the OHCI controller found in OMAP3 and later chips to
be specified via device tree.

Signed-off-by: Roger Quadros rog...@ti.com
---
 .../devicetree/bindings/usb/omap3-ohci.txt |   17 +
 drivers/usb/host/ohci-omap3.c  |   19 +++
 2 files changed, 36 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/usb/omap3-ohci.txt

diff --git a/Documentation/devicetree/bindings/usb/omap3-ohci.txt 
b/Documentation/devicetree/bindings/usb/omap3-ohci.txt
new file mode 100644
index 000..aabbfdc
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/omap3-ohci.txt
@@ -0,0 +1,17 @@
+OMAP HS USB OHCI controller (OMAP3 and later)
+
+Required properties:
+
+- compatible: should be ti,omap3-ohci
+- reg: should contain one register range i.e. start and length
+- interrupt-parent: phandle to the interrupt controller
+- interrupts: description of the interrupt line
+
+Example for OMAP4:
+
+usbhsohci: ohci@0x4a064800 {
+   compatible = ti,omap3-ohci, usb-ohci;
+   reg = 0x4a064800 0x400;
+   interrupt-parent = gic;
+   interrupts = 0 76 0x4;
+};
diff --git a/drivers/usb/host/ohci-omap3.c b/drivers/usb/host/ohci-omap3.c
index 5ed28c5..b0bfab1 100644
--- a/drivers/usb/host/ohci-omap3.c
+++ b/drivers/usb/host/ohci-omap3.c
@@ -31,6 +31,8 @@
 
 #include linux/platform_device.h
 #include linux/pm_runtime.h
+#include linux/of.h
+#include linux/dma-mapping.h
 
 /*-*/
 
@@ -112,6 +114,8 @@ static const struct hc_driver ohci_omap3_hc_driver = {
 
 /*-*/
 
+static u64 omap_ohci_dma_mask = DMA_BIT_MASK(32);
+
 /*
  * configure so an HC device and id are always provided
  * always called with process context; sleeping is OK
@@ -159,6 +163,13 @@ static int ohci_hcd_omap3_probe(struct platform_device 
*pdev)
return -ENOMEM;
}
 
+   /*
+* Right now device-tree probed devices don't get dma_mask set.
+* Since shared usb code relies on it, set it here for now.
+* Once we have dma capability bindings this can go away.
+*/
+   if (!pdev-dev.dma_mask)
+   pdev-dev.dma_mask = omap_ohci_dma_mask;
 
hcd = usb_create_hcd(ohci_omap3_hc_driver, dev,
dev_name(dev));
@@ -228,12 +239,20 @@ static void ohci_hcd_omap3_shutdown(struct 
platform_device *pdev)
hcd-driver-shutdown(hcd);
 }
 
+static const struct of_device_id omap_ohci_dt_ids[] = {
+   { .compatible = ti,omap3-ohci },
+   { }
+};
+
+MODULE_DEVICE_TABLE(of, omap_ohci_dt_ids);
+
 static struct platform_driver ohci_hcd_omap3_driver = {
.probe  = ohci_hcd_omap3_probe,
.remove = ohci_hcd_omap3_remove,
.shutdown   = ohci_hcd_omap3_shutdown,
.driver = {
.name   = ohci-omap3,
+   .of_match_table = of_match_ptr(omap_ohci_dt_ids),
},
 };
 
-- 
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 09/13] mfd: omap-usb-host: Add device tree support and binding information

2013-02-04 Thread Roger Quadros
Allows the OMAP HS USB host controller to be specified
via device tree.

CC: Samuel Ortiz sa...@linux.intel.com
Signed-off-by: Roger Quadros rog...@ti.com
---
 .../devicetree/bindings/mfd/omap-usb-host.txt  |   68 
 drivers/mfd/omap-usb-host.c|   83 ++--
 2 files changed, 145 insertions(+), 6 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mfd/omap-usb-host.txt

diff --git a/Documentation/devicetree/bindings/mfd/omap-usb-host.txt 
b/Documentation/devicetree/bindings/mfd/omap-usb-host.txt
new file mode 100644
index 000..2196893
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/omap-usb-host.txt
@@ -0,0 +1,68 @@
+OMAP HS USB Host
+
+Required properties:
+
+- compatible: should be ti,usbhs-host
+- reg: should contain one register range i.e. start and length
+- ti,hwmods: must contain usb_host_hs
+
+Optional properties:
+
+- nports: number of USB ports. Usually this is automatically detected
+  from the IP's revision register but can be overridden by specifying
+  this property.
+
+- portN_mode: Integer specifying the port mode for port N, where N can be
+  from 1 to nports. The port mode must be as per enum usbhs_omap_port_mode
+  in include/linux/platform_data/usb-omap.h
+  If the port mode is not specified, that port is treated as unused.
+
+- single_ulpi_bypass: Must be present if the controller contains a single
+  ULPI bypass control bit. e.g. OMAP3 silicon = ES2.1
+
+Required properties if child node exists:
+
+- #address-cells: Must be 1
+- #size-cells: Must be 1
+- ranges: must be present
+
+Properties for children:
+
+The OMAP HS USB Host subsystem contains EHCI and OHCI controllers.
+See Documentation/devicetree/bindings/usb/omap-ehci.txt and
+omap3-ohci.txt
+
+Example for OMAP4:
+
+usbhshost: usbhshost@0x4a064000 {
+   compatible = ti,usbhs-host;
+   reg = 0x4a064000 0x800;
+   ti,hwmods = usb_host_hs;
+   #address-cells = 1;
+   #size-cells = 1;
+   ranges;
+
+   usbhsohci: ohci@0x4a064800 {
+   compatible = ti,omap3-ohci, usb-ohci;
+   reg = 0x4a064800 0x400;
+   interrupt-parent = gic;
+   interrupts = 0 76 0x4;
+   };
+
+   usbhsehci: ehci@0x4a064c00 {
+   compatible = ti,omap-ehci, usb-ehci;
+   reg = 0x4a064c00 0x400;
+   interrupt-parent = gic;
+   interrupts = 0 77 0x4;
+   };
+};
+
+usbhshost {
+   port1_mode = 1; /* OMAP_EHCI_PORT_MODE_PHY */
+   port2_mode = 2; /* OMAP_EHCI_PORT_MODE_TLL */
+   port3_mode = 1; /* OMAP_EHCI_PORT_MODE_PHY */
+};
+
+usbhsehci {
+   phy = hsusb1_phy 0 hsusb3_phy;
+};
diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
index f8ed08e..0f67856 100644
--- a/drivers/mfd/omap-usb-host.c
+++ b/drivers/mfd/omap-usb-host.c
@@ -1,8 +1,9 @@
 /**
  * omap-usb-host.c - The USBHS core driver for OMAP EHCI  OHCI
  *
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com
+ * Copyright (C) 2011-2013 Texas Instruments Incorporated - http://www.ti.com
  * Author: Keshava Munegowda keshava_mgo...@ti.com
+ * Author: Roger Quadros rog...@ti.com
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2  of
@@ -27,6 +28,8 @@
 #include linux/platform_device.h
 #include linux/platform_data/usb-omap.h
 #include linux/pm_runtime.h
+#include linux/of.h
+#include linux/of_platform.h
 
 #include omap-usb.h
 
@@ -464,6 +467,37 @@ static void omap_usbhs_init(struct device *dev)
pm_runtime_put_sync(dev);
 }
 
+static int usbhs_omap_get_dt_pdata(struct device_node *node,
+   struct usbhs_omap_platform_data *pdata)
+{
+   int ret, i;
+
+   ret = of_property_read_u32(node, nports, pdata-nports);
+   if (ret)
+   pdata-nports = 0;
+
+   /* get port modes */
+   for (i = 0; i  OMAP3_HS_USB_PORTS; i++) {
+   char prop[11];
+
+   snprintf(prop, sizeof(prop), port%d_mode, i + 1);
+   ret = of_property_read_u32(node, prop, pdata-port_mode[i]);
+   if (ret)
+   pdata-port_mode[i] = OMAP_USBHS_PORT_MODE_UNUSED;
+   }
+
+   /* get flags */
+   pdata-single_ulpi_bypass = of_property_read_bool(node,
+   single_ulpi_bypass);
+   return 0;
+}
+
+static struct of_device_id usbhs_child_match_table[] __initdata = {
+   { .compatible = ti,omap-ehci, },
+   { .compatible = ti,omap-ohci, },
+   { }
+};
+
 /**
  * usbhs_omap_probe - initialize TI-based HCDs
  *
@@ -479,6 +513,21 @@ static int usbhs_omap_probe(struct platform_device *pdev)
int i;
boolneed_logic_fck;
 
+   if (dev-of_node) {
+   /* For DT boot we populate platform data from OF node */
+ 

[PATCH 10/13] ARM: dts: OMAP4: Add HS USB Host IP nodes

2013-02-04 Thread Roger Quadros
Adds device nodes for HS USB Host module, TLL module,
OHCI and EHCI controllers.

Signed-off-by: Roger Quadros rog...@ti.com
---
 arch/arm/boot/dts/omap4.dtsi |   30 ++
 1 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index 739bb79..3429280 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -529,5 +529,35 @@
ti,hwmods = timer11;
ti,timer-pwm;
};
+
+   usbhstll: usbhstll@0x4a062000 {
+   compatible = ti,usbhs-tll;
+   reg = 0x4a062000 0x1000;
+   interrupts = 0 78 0x4;
+   ti,hwmods = usb_tll_hs;
+   };
+
+   usbhshost: usbhshost@0x4a064000 {
+   compatible = ti,usbhs-host;
+   reg = 0x4a064000 0x800;
+   ti,hwmods = usb_host_hs;
+   #address-cells = 1;
+   #size-cells = 1;
+   ranges;
+
+   usbhsohci: ohci@0x4a064800 {
+   compatible = ti,omap3-ohci, usb-ohci;
+   reg = 0x4a064800 0x400;
+   interrupt-parent = gic;
+   interrupts = 0 76 0x4;
+   };
+
+   usbhsehci: ehci@0x4a064c00 {
+   compatible = ti,omap-ehci, usb-ehci;
+   reg = 0x4a064c00 0x400;
+   interrupt-parent = gic;
+   interrupts = 0 77 0x4;
+   };
+   };
};
 };
-- 
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 08/13] USB: ehci-omap: Add device tree support and binding information

2013-02-04 Thread Roger Quadros
Allows the OMAP EHCI controller to be specified via device tree.

Signed-off-by: Roger Quadros rog...@ti.com
---
 .../devicetree/bindings/usb/omap-ehci.txt  |   34 ++
 drivers/usb/host/ehci-omap.c   |   36 +++-
 2 files changed, 69 insertions(+), 1 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/usb/omap-ehci.txt

diff --git a/Documentation/devicetree/bindings/usb/omap-ehci.txt 
b/Documentation/devicetree/bindings/usb/omap-ehci.txt
new file mode 100644
index 000..90e6e3a
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/omap-ehci.txt
@@ -0,0 +1,34 @@
+OMAP HS USB EHCI controller
+
+This device is usually the child of the omap-usb-host
+Documentation/devicetree/bindings/mfd/omap-usb-host.txt
+
+Required properties:
+
+- compatible: should be ti,omap-ehci
+- reg: should contain one register range i.e. start and length
+- interrupt-parent: phandle to the interrupt controller
+- interrupts: description of the interrupt line
+
+Optional properties:
+
+- phy: list of phandles to PHY nodes.
+  This property is required if at least one of the ports are in
+  PHY mode i.e. OMAP_EHCI_PORT_MODE_PHY
+
+To specify the port mode, see
+Documentation/devicetree/bindings/mfd/omap-usb-host.txt
+
+Example for OMAP4:
+
+usbhsehci: ehci@0x4a064c00 {
+   compatible = ti,omap-ehci, usb-ehci;
+   reg = 0x4a064c00 0x400;
+   interrupt-parent = gic;
+   interrupts = 0 77 0x4;
+};
+
+usbhsehci {
+   phy = hsusb1_phy 0 hsusb3_phy;
+};
+
diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
index 5a831aef..15cc419 100644
--- a/drivers/usb/host/ehci-omap.c
+++ b/drivers/usb/host/ehci-omap.c
@@ -48,6 +48,8 @@
 #include linux/clk.h
 #include linux/usb.h
 #include linux/usb/hcd.h
+#include linux/of.h
+#include linux/dma-mapping.h
 
 #include ehci.h
 
@@ -121,6 +123,8 @@ static const struct ehci_driver_overrides 
ehci_omap_overrides __initdata = {
.extra_priv_size = sizeof(struct omap_hcd),
 };
 
+static u64 omap_ehci_dma_mask = DMA_BIT_MASK(32);
+
 /**
  * ehci_hcd_omap_probe - initialize TI-based HCDs
  *
@@ -148,6 +152,17 @@ static int ehci_hcd_omap_probe(struct platform_device 
*pdev)
return -ENODEV;
}
 
+   /* For DT boot, get platform data from parent. i.e. usbhshost */
+   if (dev-of_node) {
+   pdata = dev-parent-platform_data;
+   dev-platform_data = pdata;
+   }
+
+   if (!pdata) {
+   dev_err(dev, Missing platform data\n);
+   return -ENODEV;
+   }
+
irq = platform_get_irq(pdev, 0);
if (irq  0) {
dev_err(dev, EHCI irq failed\n);
@@ -161,6 +176,14 @@ static int ehci_hcd_omap_probe(struct platform_device 
*pdev)
return PTR_ERR(regs);
}
 
+   /*
+* Right now device-tree probed devices don't get dma_mask set.
+* Since shared usb code relies on it, set it here for now.
+* Once we have dma capability bindings this can go away.
+*/
+   if (!pdev-dev.dma_mask)
+   pdev-dev.dma_mask = omap_ehci_dma_mask;
+
hcd = usb_create_hcd(ehci_omap_hc_driver, dev,
dev_name(dev));
if (!hcd) {
@@ -185,7 +208,10 @@ static int ehci_hcd_omap_probe(struct platform_device 
*pdev)
continue;
 
/* get the PHY device */
-   phy = devm_usb_get_phy_dev(dev, i);
+   if (dev-of_node)
+   phy = devm_usb_get_phy_by_phandle(dev, phy, i);
+   else
+   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,
@@ -275,6 +301,13 @@ static void ehci_hcd_omap_shutdown(struct platform_device 
*pdev)
hcd-driver-shutdown(hcd);
 }
 
+static const struct of_device_id omap_ehci_dt_ids[] = {
+   { .compatible = ti,omap-ehci },
+   { }
+};
+
+MODULE_DEVICE_TABLE(of, omap_ehci_dt_ids);
+
 static struct platform_driver ehci_hcd_omap_driver = {
.probe  = ehci_hcd_omap_probe,
.remove = ehci_hcd_omap_remove,
@@ -283,6 +316,7 @@ static struct platform_driver ehci_hcd_omap_driver = {
/*.resume   = ehci_hcd_omap_resume, */
.driver = {
.name   = hcd_name,
+   .of_match_table = of_match_ptr(omap_ehci_dt_ids),
}
 };
 
-- 
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 12/13] ARM: dts: OMAP3: Add HS USB Host IP nodes

2013-02-04 Thread Roger Quadros
Adds device nodes for HS USB Host module, TLL module,
OHCI and EHCI controllers.

Signed-off-by: Roger Quadros rog...@ti.com
---
 arch/arm/boot/dts/omap3.dtsi |   31 +++
 1 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/omap3.dtsi b/arch/arm/boot/dts/omap3.dtsi
index 1acc261..39442b4 100644
--- a/arch/arm/boot/dts/omap3.dtsi
+++ b/arch/arm/boot/dts/omap3.dtsi
@@ -397,5 +397,36 @@
ti,timer-alwon;
ti,timer-secure;
};
+
+   usbhstll: usbhstll@0x48062000 {
+   compatible = ti,usbhs-tll;
+   reg = 0x48062000 0x1000;
+   interrupts = 78;
+   ti,hwmods = usb_tll_hs;
+   };
+
+   usbhshost: usbhshost@0x48064000 {
+   compatible = ti,usbhs-host;
+   reg = 0x48064000 0x400;
+   ti,hwmods = usb_host_hs;
+   #address-cells = 1;
+   #size-cells = 1;
+   ranges;
+
+   usbhsohci: ohci@0x48064400 {
+   compatible = ti,omap3-ohci, usb-ohci;
+   reg = 0x48064400 0x400;
+   interrupt-parent = intc;
+   interrupts = 76;
+   };
+
+   usbhsehci: ehci@0x48064800 {
+   compatible = ti,omap-ehci, usb-ehci;
+   reg = 0x48064800 0x400;
+   interrupt-parent = intc;
+   interrupts = 77;
+   };
+   };
+
};
 };
-- 
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 13/13] ARM: dts: omap3-beagle: Add USB Host support

2013-02-04 Thread Roger Quadros
Provide RESET and Power regulators for the USB PHY,
the USB Host port mode and the PHY device.

Also provide pin multiplexer information for USB host
pins.

Signed-off-by: Roger Quadros rog...@ti.com
---
 arch/arm/boot/dts/omap3-beagle.dts |   71 
 1 files changed, 71 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/omap3-beagle.dts 
b/arch/arm/boot/dts/omap3-beagle.dts
index f624dc8..2c4a6d6 100644
--- a/arch/arm/boot/dts/omap3-beagle.dts
+++ b/arch/arm/boot/dts/omap3-beagle.dts
@@ -38,6 +38,57 @@
};
};
 
+   /* HS USB Port 2 RESET */
+   hsusb2_reset: hsusb2_reset_reg {
+   compatible = regulator-fixed;
+   regulator-name = hsusb2_reset;
+   regulator-min-microvolt = 330;
+   regulator-max-microvolt = 330;
+   gpio = gpio5 19 0;   /* gpio_147 */
+   startup-delay-us = 7;
+   enable-active-high;
+   };
+
+   /* HS USB Port 2 Power */
+   hsusb2_power: hsusb2_power_reg {
+   compatible = regulator-fixed;
+   regulator-name = hsusb2_vbus;
+   regulator-min-microvolt = 330;
+   regulator-max-microvolt = 330;
+   gpio = twl_gpio 18 0;/* GPIO LEDA */
+   startup-delay-us = 7;
+   };
+
+   /* HS USB Host PHY on PORT 2 */
+   hsusb2_phy: hsusb2_phy {
+   compatible = usb-nop-xceiv;
+   reset-supply = hsusb2_reset;
+   vcc-supply = hsusb2_power;
+   };
+};
+
+omap3_pmx_core {
+   pinctrl-names = default;
+   pinctrl-0 = 
+   hsusbb2_pins
+   ;
+
+   hsusbb2_pins: pinmux_hsusbb2_pins {
+   pinctrl-single,pins = 
+   0x5c0 0x3  /* 
USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_clk OUTPUT */
+   0x5c2 0x3  /* 
USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_stp OUTPUT */
+   0x5c4 0x10b  /* 
USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dir INPUT | PULLDOWN */
+   0x5c6 0x10b  /* 
USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_nxt INPUT | PULLDOWN */
+   0x5c8 0x10b  /* 
USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat0 INPUT | PULLDOWN */
+   0x5cA 0x10b  /* 
USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat1 INPUT | PULLDOWN */
+   0x1a4 0x10b  /* 
USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat2 INPUT | PULLDOWN */
+   0x1a6 0x10b  /* 
USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat3 INPUT | PULLDOWN */
+   0x1a8 0x10b  /* 
USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat4 INPUT | PULLDOWN */
+   0x1aa 0x10b  /* 
USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat5 INPUT | PULLDOWN */
+   0x1ac 0x10b  /* 
USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat6 INPUT | PULLDOWN */
+   0x1ae 0x10b  /* 
USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat7 INPUT | PULLDOWN */
+   ;
+   };
 };
 
 i2c1 {
@@ -65,3 +116,23 @@
 mmc3 {
status = disabled;
 };
+
+usbhshost {
+   port2_mode = 1; /* OMAP_EHCI_PORT_MODE_PHY */
+};
+
+usbhsehci {
+   phy = 0 hsusb2_phy;
+};
+
+twl_gpio {
+   ti,use-leds;
+   /* pullups: BIT(1) */
+   ti,pullups = 0x02;
+   /*
+* pulldowns:
+* BIT(2), BIT(6), BIT(7), BIT(8), BIT(13)
+* BIT(15), BIT(16), BIT(17)
+*/
+   ti,pulldowns = 0x03a1c4;
+};
-- 
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 11/13] ARM: dts: omap4-panda: Add USB Host support

2013-02-04 Thread Roger Quadros
Provide the RESET and Power regulators for the USB PHY,
the USB Host port mode and the PHY device.

Also provide pin multiplexer information for the USB host
pins.

Signed-off-by: Roger Quadros rog...@ti.com
---
 arch/arm/boot/dts/omap4-panda.dts |   55 +
 1 files changed, 55 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/omap4-panda.dts 
b/arch/arm/boot/dts/omap4-panda.dts
index 4122efe..fe2d3d4 100644
--- a/arch/arm/boot/dts/omap4-panda.dts
+++ b/arch/arm/boot/dts/omap4-panda.dts
@@ -57,6 +57,35 @@
AFML, Line In,
AFMR, Line In;
};
+
+   /* HS USB Port 1 RESET */
+   hsusb1_reset: hsusb1_reset_reg {
+   compatible = regulator-fixed;
+   regulator-name = hsusb1_reset;
+   regulator-min-microvolt = 330;
+   regulator-max-microvolt = 330;
+   gpio = gpio2 30 0;   /* gpio_62 */
+   startup-delay-us = 7;
+   enable-active-high;
+   };
+
+   /* HS USB Port 1 Power */
+   hsusb1_power: hsusb1_power_reg {
+   compatible = regulator-fixed;
+   regulator-name = hsusb1_vbus;
+   regulator-min-microvolt = 330;
+   regulator-max-microvolt = 330;
+   gpio = gpio1 1 0;/* gpio_1 */
+   startup-delay-us = 7;
+   enable-active-high;
+   };
+
+   /* HS USB Host PHY on PORT 1 */
+   hsusb1_phy: hsusb1_phy {
+   compatible = usb-nop-xceiv;
+   reset-supply = hsusb1_reset;
+   vcc-supply = hsusb1_power;
+   };
 };
 
 omap4_pmx_core {
@@ -67,6 +96,7 @@
mcbsp1_pins
dss_hdmi_pins
tpd12s015_pins
+   hsusbb1_pins
;
 
twl6040_pins: pinmux_twl6040_pins {
@@ -110,6 +140,23 @@
0x58 0x10b  /* hdmi_hpd.gpio_63 INPUT PULLDOWN | 
MODE3 */
;
};
+
+   hsusbb1_pins: pinmux_hsusbb1_pins {
+   pinctrl-single,pins = 
+   0x82 0x10C  /* 
USBB1_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_clk INPUT | PULLDOWN */
+   0x84 0x4/* 
USBB1_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_stp OUTPUT */
+   0x86 0x104  /* 
USBB1_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dir INPUT | PULLDOWN */
+   0x88 0x104  /* 
USBB1_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_nxt INPUT | PULLDOWN */
+   0x8a 0x104  /* 
USBB1_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat0 INPUT | PULLDOWN */
+   0x8c 0x104  /* 
USBB1_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat1 INPUT | PULLDOWN */
+   0x8e 0x104  /* 
USBB1_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat2 INPUT | PULLDOWN */
+   0x90 0x104  /* 
USBB1_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat3 INPUT | PULLDOWN */
+   0x92 0x104  /* 
USBB1_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat4 INPUT | PULLDOWN */
+   0x94 0x104  /* 
USBB1_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat5 INPUT | PULLDOWN */
+   0x96 0x104  /* 
USBB1_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat6 INPUT | PULLDOWN */
+   0x98 0x104  /* 
USBB1_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat7 INPUT | PULLDOWN */
+   ;
+   };
 };
 
 i2c1 {
@@ -206,3 +253,11 @@
 twl_usb_comparator {
usb-supply = vusb;
 };
+
+usbhshost {
+   port1_mode = 1; /* OMAP_EHCI_PORT_MODE_PHY */
+};
+
+usbhsehci {
+   phy = hsusb1_phy;
+};
-- 
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] xhci - correct comp_mode_recovery_timer on return from hibernate

2013-02-04 Thread Tony Camuso
Commit 71c731a was a workaround for systems using the SN65LVPE502CP,
controller, but it introduced a bug where resume from hibernate would
add the comp_mode_recovery_timer to the timer queue while it was already
active when saved to disk on hibernate. This caused list_add corruption
leading to a crash when resuming from hibernate.

The original patch erroneously assumed that the timer would be deleted
by a call to xhci_suspend() or xhci_stop(), but neither of these calls
is made during the hibernate sequence. When returning from hibernate,
the timer was still active, and the attempt to list_add the same timer
corrupted the list.

We can avoid this problem when resuming from hibernate by first deleting
the timer and then initializing it and adding it to the timer list.

Signed-off-by: Tony Camuso tcam...@redhat.com
Acked-by: Don Zickus dzic...@redhat.com

---
 drivers/usb/host/xhci.c |9 -
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index b53d756..1697c14 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -975,6 +975,13 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated)
 
/* If restore operation fails, re-initialize the HC during resume */
if ((temp  STS_SRE) || hibernated) {
+
+   if ((xhci-quirks  XHCI_COMP_MODE_QUIRK) 
+   (!(xhci_all_ports_seen_u0(xhci {
+   del_timer_sync(xhci-comp_mode_recovery_timer);
+   xhci_dbg(xhci, Compliance Mode Recovery Timer 
Deleted!\n);
+   }
+
/* Let the USB core know _both_ roothubs lost power. */
usb_root_hub_lost_power(xhci-main_hcd-self.root_hub);
usb_root_hub_lost_power(xhci-shared_hcd-self.root_hub);
@@ -1058,7 +1065,7 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated)
 * to suffer the Compliance Mode issue again. It doesn't matter if
 * ports have entered previously to U0 before system's suspension.
 */
-   if (xhci-quirks  XHCI_COMP_MODE_QUIRK)
+   if ((xhci-quirks  XHCI_COMP_MODE_QUIRK)  (!hibernated))
compliance_mode_recovery_timer_init(xhci);
 
return retval;
-- 
1.7.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] usb: gadget: remove inode.c

2013-02-04 Thread Michal Nazarewicz
On Thu, Jan 24 2013, Felipe Balbi wrote:
 Hmm, looks like there's no easy way out. Can we (easily) make
 a compatibility layer between the two ? What are the biggest
 differences ?

Come to think of it, would it make sense to make it as a user space
library preloaded when gadgetfs user space application is run?

-- 
Best regards, _ _
.o. | Liege of Serenely Enlightened Majesty of  o' \,=./ `o
..o | Computer Science,  Michał “mina86” Nazarewicz(o o)
ooo +email/xmpp: m...@google.com--ooO--(_)--Ooo--

pgp5JWa0_NjMc.pgp
Description: PGP signature


Re: [PATCH v4 4/4] drivers: usb: start using the control module driver

2013-02-04 Thread Tony Lindgren
* Felipe Balbi ba...@ti.com [130204 07:57]:
 Hi,
 
 On Fri, Feb 01, 2013 at 11:14:24AM -0800, Tony Lindgren wrote:
  * Felipe Balbi ba...@ti.com [130125 02:30]:
   Hi,
   
   On Fri, Jan 25, 2013 at 03:54:00PM +0530, Kishon Vijay Abraham I wrote:
Start using the control module driver for powering on the PHY and for
writing to the mailbox instead of writing to the control module
registers on their own.

Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
---
 Documentation/devicetree/bindings/usb/omap-usb.txt |4 ++
 Documentation/devicetree/bindings/usb/usb-phy.txt  |7 +-
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c |   13 
   
   I'm taking this patch but I'm leaving out the omap_hwmod_44xx_data.c
   change just to kill dependency. Can you send that single change as a
   separate patch which Tony can queue ?
  
  For the USB patches, please also leave out patches touching
  arch/arm/mach-omap2/devices.c. Those are almost guaranteed to
  cause pointless merge conflicts with other branches.
  
  I suggest you set up few immutable branches:
  
  1. Minimal platform_data changes for all your USB changes
  
  This should contain include/linux/platform_data changes and
  changes to arch/arm/*omap* so me and Paul can merge it in too
  to avoid merge conflicts.
  
  2. The rest of the driver/usb changes
  
  This can then be based on #1 branch above.
  
  3. Changes for the .dts files for Benoit
  
  These can be queued separately from #1 and #2 above.
 
 I'm done with all USB stuff for this merge window. The patches which I
 didn't take have no dependencies on any drivers/ part. You can easily
 queue this through your tree.

Sorry with a huge pile of USB patches being posted I have no idea at
this point which USB related patches for arch/arm/*omap* have no
dependencies to the USB driver changes.

So I suggest that you, Kishon and Roger figure it out and put together
a pull request for me against v3.8-rc6 for the patches I should merge.

Regards,

Tony
--
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 V3 3/5] usb: gadget/uvc: Port UVC webcam gadget to use videobuf2 framework

2013-02-04 Thread Michael Grzeschik
Hi Bhupesh,

On Thu, Jan 17, 2013 at 04:23:51PM +0530, Bhupesh Sharma wrote:
 This patch reworks the videobuffer management logic present in the UVC
 webcam gadget and ports it to use the more apt videobuf2 framework for
 video buffer management.
 
 To support routing video data captured from a real V4L2 video capture
 device with a zero copy operation on videobuffers (as they pass from
 the V4L2 domain to UVC domain via a user-space application), we need to
 support USER_PTR IO method at the UVC gadget side.
 
 So the V4L2 capture device driver can still continue to use MMAP IO
 method and now the user-space application can just pass a pointer to the
 video buffers being dequeued from the V4L2 device side while queueing
 them at the UVC gadget end. This ensures that we have a zero-copy
 design as the videobuffers pass from the V4L2 capture device to the UVC
 gadget.
 
 Note that there will still be a need to apply UVC specific payload
 headers on top of each UVC payload data, which will still require a copy
 operation to be performed in the 'encode' routines of the UVC gadget.
 
 This patch also addresses one issue found out while porting the UVC
 gadget to videobuf2 framework:
   - In case the usb requests queued by the gadget get completed
 with a status of -ESHUTDOWN (disconnected from host),
 the queue of videobuf2 should be cancelled to ensure that the
 application space daemon is not left in a state waiting for
 a vb2 to be successfully absorbed at the USB side.
 
 Signed-off-by: Bhupesh Sharma bhupesh.sha...@st.com
 ---
  drivers/usb/gadget/Kconfig |1 +
  drivers/usb/gadget/uvc_queue.c |  537 
 
  drivers/usb/gadget/uvc_queue.h |   25 +--
  drivers/usb/gadget/uvc_v4l2.c  |   27 +--

With this Patch you could add this hunk:

drivers/usb/gadget/uvc_v4l2.c |5 -
 1 file changed, 5 deletions(-)

diff --git a/drivers/usb/gadget/uvc_v4l2.c b/drivers/usb/gadget/uvc_v4l2.c
index b47e0f7..fa445d9 100644
--- a/drivers/usb/gadget/uvc_v4l2.c
+++ b/drivers/usb/gadget/uvc_v4l2.c
@@ -337,13 +337,8 @@ uvc_v4l2_poll(struct file *file, poll_table *wait)
 {
struct video_device *vdev = video_devdata(file);
struct uvc_device *uvc = video_get_drvdata(vdev);
-   struct uvc_file_handle *handle = to_uvc_file_handle(file-private_data);
unsigned int mask = 0;

-   poll_wait(file, handle-vfh.wait, wait);
-   if (v4l2_event_pending(handle-vfh))
-   mask |= POLLPRI;
-
mask |= uvc_queue_poll(uvc-video.queue, file, wait);

return mask;

The current implementation of vb2_poll already
checks for pending events if the fh has the v4l2_fh type.

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |
--
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 net] net: usbnet: fix tx_dropped statistics

2013-02-04 Thread David Miller
From: Bjørn Mork bj...@mork.no
Date: Thu, 31 Jan 2013 19:36:05 +0100

 It is normal for minidrivers accumulating frames to return NULL
 from their tx_fixup function. We do not want to count this as a
 drop, or log any debug messages.  A different exit path is
 therefore chosen for such drivers, skipping the debug message
 and the tx_dropped increment.
 
 The test for accumulating drivers was however completely bogus,
 making the exit path selection depend on whether the user had
 enabled tx_err logging or not. This would arbitrarily mess up
 accounting for both accumulating and non-accumulating minidrivers,
 and would result in unwanted debug messages for the accumulating
 drivers.
 
 Fix by testing for FLAG_MULTI_PACKET instead, which probably was
 the intention from the beginning.  This usage match the documented
 behaviour of this flag:
 
  Indicates to usbnet, that USB driver accumulates multiple IP packets.
  Affects statistic (counters) and short packet handling.
 
 Signed-off-by: Bjørn Mork bj...@mork.no

Applied.
--
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 0/8] drivers/net: Remove unnecessary alloc/OOM messages

2013-02-04 Thread David Miller
From: Joe Perches j...@perches.com
Date: Sun,  3 Feb 2013 19:28:07 -0800

 Remove all the OOM messages that follow kernel alloc
 failures as there is already a generic equivalent to
 these messages in the mm subsystem.
 
 Joe Perches (8):
   caif: Remove unnecessary alloc/OOM messages
   can: Remove unnecessary alloc/OOM messages
   ethernet: Remove unnecessary alloc/OOM messages, alloc cleanups
   drivers: net: usb: Remove unnecessary alloc/OOM messages
   wan: Remove unnecessary alloc/OOM messages
   wimax: Remove unnecessary alloc/OOM messages, alloc cleanups
   wireless: Remove unnecessary alloc/OOM messages, alloc cleanups
   drivers:net:misc: Remove unnecessary alloc/OOM messages

Series applied, thanks Joe.
--
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/2] USB: storage: Define a new macro for USB storage match rules

2013-02-04 Thread Greg KH
On Mon, Feb 04, 2013 at 03:14:46PM +0800, fangxiaozhi 00110321 wrote:
 +/* Define the device is matched with Vendor ID and interface descriptors */
 +#define UNUSUAL_VENDOR_INTF(id_vendor, cl, sc, pr, \
 + vendorName, productName, useProtocol, useTransport, \
 + initFunction, flags) \
 +{ \
 + .match_flags = USB_DEVICE_ID_MATCH_INT_INFO \
 + | USB_DEVICE_ID_MATCH_VENDOR, \
 + .idVendor= (id_vendor), \
 + .bInterfaceClass = (cl), \
 + .bInterfaceSubClass = (sc), \
 + .bInterfaceProtocol = (pr), \
 + .driver_info = (flags) \
 +}

I'm not going to reject this given the number of times it has been
submitted, but can't you use the USB_VENDOR_AND_INTERFACE_INFO() macro
here in this definition?

If so, can you send me an add-on patch that makes that change?

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: [RFC/PATCH 29/32] usb: gadget: pxa27x_udc: let udc-core manage gadget-dev

2013-02-04 Thread Felipe Balbi
On Mon, Jan 28, 2013 at 09:18:29PM +0100, Robert Jarzmik wrote:
 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 ...).

you should add yourself to MAINTAINERS. Please send a patch to Greg when
you have time.

No need to prepare a tree, though. I just need you to give your Acked-by
and I'll queue the patches myself.

cheers

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH 31/31] USB: ehci-omap: Select NOP USB transceiver driver

2013-02-04 Thread Alan Stern
On Mon, 4 Feb 2013, Roger Quadros wrote:

 In PHY mode we need to have the nop-usb-xceiv transceiver
 driver to operate, so select it in Kconfig.
 
 CC: Alan Stern st...@rowland.harvard.edu
 Signed-off-by: Roger Quadros rog...@ti.com
 ---
  drivers/usb/host/Kconfig |1 +
  1 files changed, 1 insertions(+), 0 deletions(-)
 
 diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
 index 11e102e..2d2975d 100644
 --- a/drivers/usb/host/Kconfig
 +++ b/drivers/usb/host/Kconfig
 @@ -157,6 +157,7 @@ config USB_EHCI_MXC
  config USB_EHCI_HCD_OMAP
   tristate EHCI support for OMAP3 and later chips
   depends on USB_EHCI_HCD  ARCH_OMAP
 + select NOP_USB_XCEIV
   default y
   ---help---
 Enables support for the on-chip EHCI controller on

Acked-by: Alan Stern st...@rowland.harvard.edu

--
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 09/31] USB: ehci-omap: Use devm_ioremap_resource()

2013-02-04 Thread Alan Stern
On Mon, 4 Feb 2013, Roger Quadros wrote:

 Make use of devm_ioremap_resource() and correct comment.
 
 CC: Alan Stern st...@rowland.harvard.edu
 Signed-off-by: Roger Quadros rog...@ti.com
 ---
  drivers/usb/host/ehci-omap.c |   21 ++---
  1 files changed, 6 insertions(+), 15 deletions(-)
 
 diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
 index 30fc482..6b088a4 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));
 - if (!regs) {
 - dev_err(dev, UHH EHCI ioremap failed\n);
 - return -ENOMEM;
 + regs = devm_ioremap_resource(dev, res);
 + if (IS_ERR(regs)) {
 + dev_err(dev, Resource request/ioremap failed\n);

According to Thierry Reding, devm_ioremap_resource() provides its own 
error messages.  Hence this one isn't needed.

Apart from this one issue,

Acked-by: Alan Stern st...@rowland.harvard.edu

--
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 05/13] USB: ehci-omap: Get platform resources by index rather than by name

2013-02-04 Thread Alan Stern
On Mon, 4 Feb 2013, Roger Quadros wrote:

 Since there is only one resource per type we don't really need
 to use resource name to obtain it. This also also makes it easier
 for device tree adaptation.
 
 Signed-off-by: Roger Quadros rog...@ti.com

Acked-by: Alan Stern st...@rowland.harvard.edu

--
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 06/13] USB: ohci-omap3: Get platform resources by index rather than by name

2013-02-04 Thread Alan Stern
On Mon, 4 Feb 2013, Roger Quadros wrote:

 Since there is only one resource per type we don't really need
 to use resource name to obtain it. This also also makes it easier
 for device tree adaptation.
 
 Signed-off-by: Roger Quadros rog...@ti.com

Acked-by: Alan Stern st...@rowland.harvard.edu


--
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 07/13] USB: ohci-omap3: Add device tree support and binding information

2013-02-04 Thread Alan Stern
On Mon, 4 Feb 2013, Roger Quadros wrote:

 Allows the OHCI controller found in OMAP3 and later chips to
 be specified via device tree.
 
 Signed-off-by: Roger Quadros rog...@ti.com

For the ohci-omap3 part:

Acked-by: Alan Stern st...@rowland.harvard.edu


--
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] USB: ehci-omap: Add device tree support and binding information

2013-02-04 Thread Alan Stern
On Mon, 4 Feb 2013, Roger Quadros wrote:

 Allows the OMAP EHCI controller to be specified via device tree.
 
 Signed-off-by: Roger Quadros rog...@ti.com

For the ehci-omap part:

Acked-by: Alan Stern st...@rowland.harvard.edu


--
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: [REVERT][v3.x.y] EHCI: Update qTD next pointer in QH overlay region during unlink

2013-02-04 Thread Alan Stern
On Fri, 1 Feb 2013, Joseph Salisbury wrote:

 Hi Alan,
 
 There is a tar file[0] attached to the bug report[1].  The tar file 
 contains a few examples of failed and successful recording attempts 
 while collecting usbmon traces.  There is a readme.txt file available 
 after extracting the files.
 
 The bug reporter states that only the first recording after boot fails. 
 Subsequent recordings succeed will succeed.
 
 Thanks again for reviewing this, Alan.  Just let me know if you would 
 like any additional data or testing.
 
 Thanks,
 
 Joe
 
 [0] 
 https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1088733/+attachment/3510887/+files/usbmon-1088733.tar.gz
 [1] https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1088733

I have replied to the original report at bugs.launchpad.net with a
diagnostic patch.  Maybe it will help indicate what's going wrong.

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] usb: phy: Add USB host phy support on Exyno4412

2013-02-04 Thread Dongjin Kim
This patch adds host phy support for Samsung's Exynos4412 SoC to
samsung-usbphy driver and its device node.

Cc: Praveen Paneri p.pan...@samsung.com
Signed-off-by: Dongjin Kim tobet...@gmail.com
---
 arch/arm/boot/dts/exynos4412.dtsi |   13 
 drivers/usb/phy/samsung-usbphy.c  |  156 -
 2 files changed, 167 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/exynos4412.dtsi 
b/arch/arm/boot/dts/exynos4412.dtsi
index 387aa27..c01d841 100644
--- a/arch/arm/boot/dts/exynos4412.dtsi
+++ b/arch/arm/boot/dts/exynos4412.dtsi
@@ -33,4 +33,17 @@
#address-cells = 1;
#size-cells = 0;
};
+
+   usbphy@125B {
+   #address-cells = 1;
+   #size-cells = 1;
+   compatible = samsung,exynos4412-usbphy;
+   reg = 0x125B 0x100;
+   status = disabled;
+   ranges;
+
+   usbphy-sys {
+   reg = 0x10020704 0xc;
+   };
+   };
 };
diff --git a/drivers/usb/phy/samsung-usbphy.c b/drivers/usb/phy/samsung-usbphy.c
index 6ea5537..c800fa4 100644
--- a/drivers/usb/phy/samsung-usbphy.c
+++ b/drivers/usb/phy/samsung-usbphy.c
@@ -47,7 +47,7 @@
 
 #define PHYCLK_MODE_USB11  (0x1  6)
 #define PHYCLK_EXT_OSC (0x1  5)
-#define PHYCLK_COMMON_ON_N (0x1  4)
+#define PHYCLK_COMMON_ON_N_PHY0(0x1  4)
 #define PHYCLK_ID_PULL (0x1  2)
 #define PHYCLK_CLKSEL_MASK (0x3  0)
 #define PHYCLK_CLKSEL_48M  (0x0  0)
@@ -60,6 +60,22 @@
 #define RSTCON_HLINK_SWRST (0x1  1)
 #define RSTCON_SWRST   (0x1  0)
 
+/* For Exynos4412 */
+#define PHYCLK_COMMON_ON_N_PHY1(0x1  7)
+
+#define PHYPWR_NORMAL_MASK_HSIC1   (0x7  12)
+#define PHYPWR_NORMAL_MASK_HSIC0   (0x7  9)
+#define PHYPWR_NORMAL_MASK_PHY1(0x7  6)
+
+#define PHYPWR_ANALOG_POWERDOWN_PHY1   (0x1  7)
+
+#define RSTCON_HLINK_SWRST_MASK(0xf  7)
+#define RSTCON_PHY1_SWRST_MASK (0xf  3)
+#define RSTCON_PHY0_SWRST_MASK (0x7  0)
+
+#define EXYNOS4_PHY_HSIC_CTRL0 (0x04)
+#define EXYNOS4_PHY_HSIC_CTRL1 (0x08)
+
 /* EXYNOS5 */
 #define EXYNOS5_PHY_HOST_CTRL0 (0x00)
 
@@ -174,6 +190,7 @@
 enum samsung_cpu_type {
TYPE_S3C64XX,
TYPE_EXYNOS4210,
+   TYPE_EXYNOS4412,
TYPE_EXYNOS5250,
 };
 
@@ -322,6 +339,17 @@ static void samsung_usbphy_set_isolation(struct 
samsung_usbphy *sphy, bool on)
en_mask = sphy-drv_data-hostphy_en_mask;
}
break;
+   case TYPE_EXYNOS4412:
+   if (sphy-phy_type == USB_PHY_TYPE_DEVICE) {
+   reg = sphy-pmuregs +
+   sphy-drv_data-devphy_reg_offset;
+   en_mask = sphy-drv_data-devphy_en_mask;
+   } else if (sphy-phy_type == USB_PHY_TYPE_HOST) {
+   reg = sphy-pmuregs +
+   sphy-drv_data-hostphy_reg_offset;
+   en_mask = sphy-drv_data-hostphy_en_mask;
+   }
+   break;
default:
dev_err(sphy-dev, Invalid SoC type\n);
return;
@@ -422,6 +450,29 @@ static int samsung_usbphy_get_refclk_freq(struct 
samsung_usbphy *sphy)
refclk_freq = FSEL_CLKSEL_24M;
break;
}
+   } else if (sphy-drv_data-cpu_type == TYPE_EXYNOS4412) {
+   switch (clk_get_rate(ref_clk)) {
+   case 9600 * KHZ:
+   refclk_freq = FSEL_CLKSEL_9600K;
+   break;
+   case 10 * MHZ:
+   refclk_freq = FSEL_CLKSEL_10M;
+   break;
+   case 12 * MHZ:
+   refclk_freq = FSEL_CLKSEL_12M;
+   break;
+   case 19200 * KHZ:
+   refclk_freq = FSEL_CLKSEL_19200K;
+   break;
+   case 20 * MHZ:
+   refclk_freq = FSEL_CLKSEL_20M;
+   break;
+   case 24 * MHZ:
+   default:
+   /* default reference clock */
+   refclk_freq = FSEL_CLKSEL_24M;
+   break;
+   }
} else {
switch (clk_get_rate(ref_clk)) {
case 12 * MHZ:
@@ -561,6 +612,69 @@ static void samsung_exynos5_usbphy_enable(struct 
samsung_usbphy *sphy)
writel(ohcictrl, regs + EXYNOS5_PHY_HOST_OHCICTRL);
 }
 
+static bool exynos4_phyhost_is_on(void *regs)
+{
+   u32 reg;
+
+   reg = readl(regs + SAMSUNG_PHYPWR);
+
+   return !(reg  

Re: [PATCH] usb: phy: Add USB host phy support on Exyno4412

2013-02-04 Thread Kyungmin Park
Hi,

Can split patch into two parts?
One for USB tree, another for samsung tree.

Thank you,
Kyungmin Park

On Tue, Feb 5, 2013 at 9:37 AM, Dongjin Kim tobet...@gmail.com wrote:
 This patch adds host phy support for Samsung's Exynos4412 SoC to
 samsung-usbphy driver and its device node.

 Cc: Praveen Paneri p.pan...@samsung.com
 Signed-off-by: Dongjin Kim tobet...@gmail.com
 ---
  arch/arm/boot/dts/exynos4412.dtsi |   13 
  drivers/usb/phy/samsung-usbphy.c  |  156 
 -
  2 files changed, 167 insertions(+), 2 deletions(-)

 diff --git a/arch/arm/boot/dts/exynos4412.dtsi 
 b/arch/arm/boot/dts/exynos4412.dtsi
 index 387aa27..c01d841 100644
 --- a/arch/arm/boot/dts/exynos4412.dtsi
 +++ b/arch/arm/boot/dts/exynos4412.dtsi
 @@ -33,4 +33,17 @@
 #address-cells = 1;
 #size-cells = 0;
 };
 +
 +   usbphy@125B {
 +   #address-cells = 1;
 +   #size-cells = 1;
 +   compatible = samsung,exynos4412-usbphy;
 +   reg = 0x125B 0x100;
 +   status = disabled;
 +   ranges;
 +
 +   usbphy-sys {
 +   reg = 0x10020704 0xc;
 +   };
 +   };
  };
 diff --git a/drivers/usb/phy/samsung-usbphy.c 
 b/drivers/usb/phy/samsung-usbphy.c
 index 6ea5537..c800fa4 100644
 --- a/drivers/usb/phy/samsung-usbphy.c
 +++ b/drivers/usb/phy/samsung-usbphy.c
 @@ -47,7 +47,7 @@

  #define PHYCLK_MODE_USB11  (0x1  6)
  #define PHYCLK_EXT_OSC (0x1  5)
 -#define PHYCLK_COMMON_ON_N (0x1  4)
 +#define PHYCLK_COMMON_ON_N_PHY0(0x1  4)
  #define PHYCLK_ID_PULL (0x1  2)
  #define PHYCLK_CLKSEL_MASK (0x3  0)
  #define PHYCLK_CLKSEL_48M  (0x0  0)
 @@ -60,6 +60,22 @@
  #define RSTCON_HLINK_SWRST (0x1  1)
  #define RSTCON_SWRST   (0x1  0)

 +/* For Exynos4412 */
 +#define PHYCLK_COMMON_ON_N_PHY1(0x1  7)
 +
 +#define PHYPWR_NORMAL_MASK_HSIC1   (0x7  12)
 +#define PHYPWR_NORMAL_MASK_HSIC0   (0x7  9)
 +#define PHYPWR_NORMAL_MASK_PHY1(0x7  6)
 +
 +#define PHYPWR_ANALOG_POWERDOWN_PHY1   (0x1  7)
 +
 +#define RSTCON_HLINK_SWRST_MASK(0xf  7)
 +#define RSTCON_PHY1_SWRST_MASK (0xf  3)
 +#define RSTCON_PHY0_SWRST_MASK (0x7  0)
 +
 +#define EXYNOS4_PHY_HSIC_CTRL0 (0x04)
 +#define EXYNOS4_PHY_HSIC_CTRL1 (0x08)
 +
  /* EXYNOS5 */
  #define EXYNOS5_PHY_HOST_CTRL0 (0x00)

 @@ -174,6 +190,7 @@
  enum samsung_cpu_type {
 TYPE_S3C64XX,
 TYPE_EXYNOS4210,
 +   TYPE_EXYNOS4412,
 TYPE_EXYNOS5250,
  };

 @@ -322,6 +339,17 @@ static void samsung_usbphy_set_isolation(struct 
 samsung_usbphy *sphy, bool on)
 en_mask = sphy-drv_data-hostphy_en_mask;
 }
 break;
 +   case TYPE_EXYNOS4412:
 +   if (sphy-phy_type == USB_PHY_TYPE_DEVICE) {
 +   reg = sphy-pmuregs +
 +   sphy-drv_data-devphy_reg_offset;
 +   en_mask = sphy-drv_data-devphy_en_mask;
 +   } else if (sphy-phy_type == USB_PHY_TYPE_HOST) {
 +   reg = sphy-pmuregs +
 +   sphy-drv_data-hostphy_reg_offset;
 +   en_mask = sphy-drv_data-hostphy_en_mask;
 +   }
 +   break;
 default:
 dev_err(sphy-dev, Invalid SoC type\n);
 return;
 @@ -422,6 +450,29 @@ static int samsung_usbphy_get_refclk_freq(struct 
 samsung_usbphy *sphy)
 refclk_freq = FSEL_CLKSEL_24M;
 break;
 }
 +   } else if (sphy-drv_data-cpu_type == TYPE_EXYNOS4412) {
 +   switch (clk_get_rate(ref_clk)) {
 +   case 9600 * KHZ:
 +   refclk_freq = FSEL_CLKSEL_9600K;
 +   break;
 +   case 10 * MHZ:
 +   refclk_freq = FSEL_CLKSEL_10M;
 +   break;
 +   case 12 * MHZ:
 +   refclk_freq = FSEL_CLKSEL_12M;
 +   break;
 +   case 19200 * KHZ:
 +   refclk_freq = FSEL_CLKSEL_19200K;
 +   break;
 +   case 20 * MHZ:
 +   refclk_freq = FSEL_CLKSEL_20M;
 +   break;
 +   case 24 * MHZ:
 +   default:
 +   /* default reference clock */
 +   refclk_freq = FSEL_CLKSEL_24M;
 +   break;
 +   }
 } else {
 switch (clk_get_rate(ref_clk)) {
 case 12 * MHZ:
 @@ 

[PATCH 1/2] usb: phy: Add USB host phy support on Exyno4412

2013-02-04 Thread Dongjin Kim
This patch adds host phy support for Samsung's Exynos4412 SoC to
samsung-usbphy driver. This patch is created upon 
http://git.kernel.org/?p=linux/kernel/git/balbi/usb.git;a=commit;h=2564b526b8cf01e6c36285edfd40a438e683c2b8;

Cc: Praveen Paneri p.pan...@samsung.com
Signed-off-by: Dongjin Kim tobet...@gmail.com
---
 drivers/usb/phy/samsung-usbphy.c |  156 +-
 1 file changed, 154 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/phy/samsung-usbphy.c b/drivers/usb/phy/samsung-usbphy.c
index 6ea5537..c800fa4 100644
--- a/drivers/usb/phy/samsung-usbphy.c
+++ b/drivers/usb/phy/samsung-usbphy.c
@@ -47,7 +47,7 @@
 
 #define PHYCLK_MODE_USB11  (0x1  6)
 #define PHYCLK_EXT_OSC (0x1  5)
-#define PHYCLK_COMMON_ON_N (0x1  4)
+#define PHYCLK_COMMON_ON_N_PHY0(0x1  4)
 #define PHYCLK_ID_PULL (0x1  2)
 #define PHYCLK_CLKSEL_MASK (0x3  0)
 #define PHYCLK_CLKSEL_48M  (0x0  0)
@@ -60,6 +60,22 @@
 #define RSTCON_HLINK_SWRST (0x1  1)
 #define RSTCON_SWRST   (0x1  0)
 
+/* For Exynos4412 */
+#define PHYCLK_COMMON_ON_N_PHY1(0x1  7)
+
+#define PHYPWR_NORMAL_MASK_HSIC1   (0x7  12)
+#define PHYPWR_NORMAL_MASK_HSIC0   (0x7  9)
+#define PHYPWR_NORMAL_MASK_PHY1(0x7  6)
+
+#define PHYPWR_ANALOG_POWERDOWN_PHY1   (0x1  7)
+
+#define RSTCON_HLINK_SWRST_MASK(0xf  7)
+#define RSTCON_PHY1_SWRST_MASK (0xf  3)
+#define RSTCON_PHY0_SWRST_MASK (0x7  0)
+
+#define EXYNOS4_PHY_HSIC_CTRL0 (0x04)
+#define EXYNOS4_PHY_HSIC_CTRL1 (0x08)
+
 /* EXYNOS5 */
 #define EXYNOS5_PHY_HOST_CTRL0 (0x00)
 
@@ -174,6 +190,7 @@
 enum samsung_cpu_type {
TYPE_S3C64XX,
TYPE_EXYNOS4210,
+   TYPE_EXYNOS4412,
TYPE_EXYNOS5250,
 };
 
@@ -322,6 +339,17 @@ static void samsung_usbphy_set_isolation(struct 
samsung_usbphy *sphy, bool on)
en_mask = sphy-drv_data-hostphy_en_mask;
}
break;
+   case TYPE_EXYNOS4412:
+   if (sphy-phy_type == USB_PHY_TYPE_DEVICE) {
+   reg = sphy-pmuregs +
+   sphy-drv_data-devphy_reg_offset;
+   en_mask = sphy-drv_data-devphy_en_mask;
+   } else if (sphy-phy_type == USB_PHY_TYPE_HOST) {
+   reg = sphy-pmuregs +
+   sphy-drv_data-hostphy_reg_offset;
+   en_mask = sphy-drv_data-hostphy_en_mask;
+   }
+   break;
default:
dev_err(sphy-dev, Invalid SoC type\n);
return;
@@ -422,6 +450,29 @@ static int samsung_usbphy_get_refclk_freq(struct 
samsung_usbphy *sphy)
refclk_freq = FSEL_CLKSEL_24M;
break;
}
+   } else if (sphy-drv_data-cpu_type == TYPE_EXYNOS4412) {
+   switch (clk_get_rate(ref_clk)) {
+   case 9600 * KHZ:
+   refclk_freq = FSEL_CLKSEL_9600K;
+   break;
+   case 10 * MHZ:
+   refclk_freq = FSEL_CLKSEL_10M;
+   break;
+   case 12 * MHZ:
+   refclk_freq = FSEL_CLKSEL_12M;
+   break;
+   case 19200 * KHZ:
+   refclk_freq = FSEL_CLKSEL_19200K;
+   break;
+   case 20 * MHZ:
+   refclk_freq = FSEL_CLKSEL_20M;
+   break;
+   case 24 * MHZ:
+   default:
+   /* default reference clock */
+   refclk_freq = FSEL_CLKSEL_24M;
+   break;
+   }
} else {
switch (clk_get_rate(ref_clk)) {
case 12 * MHZ:
@@ -561,6 +612,69 @@ static void samsung_exynos5_usbphy_enable(struct 
samsung_usbphy *sphy)
writel(ohcictrl, regs + EXYNOS5_PHY_HOST_OHCICTRL);
 }
 
+static bool exynos4_phyhost_is_on(void *regs)
+{
+   u32 reg;
+
+   reg = readl(regs + SAMSUNG_PHYPWR);
+
+   return !(reg  PHYPWR_ANALOG_POWERDOWN_PHY1);
+}
+
+static void samsung_exynos4412_usbphy_enable(struct samsung_usbphy *sphy)
+{
+   void __iomem *regs = sphy-regs;
+   u32 phypwr;
+   u32 phyclk;
+   u32 rstcon;
+
+   /*
+* 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 (exynos4_phyhost_is_on(regs)) {
+   dev_info(sphy-dev, Already power on PHY\n);
+   return;
+   }
+
+   

RE: [PATCH 1/2] USB: storage: Define a new macro for USB storage match rules

2013-02-04 Thread Fangxiaozhi (Franko)
Dear  Greg:

OK,thank you very much.

Best Regards,
Franko Fang

 -Original Message-
 From: Greg KH [mailto:gre...@linuxfoundation.org]
 Sent: Tuesday, February 05, 2013 2:39 AM
 To: Fangxiaozhi (Franko)
 Cc: linux-usb@vger.kernel.org; linux-ker...@vger.kernel.org; Xueguiying 
 (Zihan);
 Linlei (Lei Lin); Yili (Neil); Wangyuhua (Roger, Credit); Huqiao (C); 
 ba...@ti.com;
 mdharm-...@one-eyed-alien.net; sebast...@breakpoint.cc
 Subject: Re: [PATCH 1/2] USB: storage: Define a new macro for USB storage
 match rules
 
 On Mon, Feb 04, 2013 at 03:14:46PM +0800, fangxiaozhi 00110321 wrote:
  +/* Define the device is matched with Vendor ID and interface
  +descriptors */ #define UNUSUAL_VENDOR_INTF(id_vendor, cl, sc, pr, \
  +   vendorName, productName, useProtocol, useTransport, \
  +   initFunction, flags) \
  +{ \
  +   .match_flags = USB_DEVICE_ID_MATCH_INT_INFO \
  +   | USB_DEVICE_ID_MATCH_VENDOR, \
  +   .idVendor= (id_vendor), \
  +   .bInterfaceClass = (cl), \
  +   .bInterfaceSubClass = (sc), \
  +   .bInterfaceProtocol = (pr), \
  +   .driver_info = (flags) \
  +}
 
 I'm not going to reject this given the number of times it has been submitted,
 but can't you use the USB_VENDOR_AND_INTERFACE_INFO() macro here in
 this definition?
 
 If so, can you send me an add-on patch that makes that change?
 
 thanks,
 
 greg k-h


Re: [PATCH 02/13] USB: phy: nop: Defer probe if device needs VCC/RESET

2013-02-04 Thread kishon

On Monday 04 February 2013 09:28 PM, Roger Quadros wrote:

Add 2 flags, needs_vcc and needs_reset to platform data.
If the flag is set and the regulator couldn't be found
then we bail out with -EPROBE_DEFER.

For device tree boot we depend on presensce of vcc-supply/
reset-supply properties to decide if we should bail out
with -EPROBE_DEFER or just continue in case the regulator
can't be found.

This is required for proper functionality in cases where the
regulator is needed but is probed later than the PHY device.

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

diff --git a/drivers/usb/otg/nop-usb-xceiv.c b/drivers/usb/otg/nop-usb-xceiv.c
index adbb7ab..7860e7569 100644
--- a/drivers/usb/otg/nop-usb-xceiv.c
+++ b/drivers/usb/otg/nop-usb-xceiv.c
@@ -147,6 +147,10 @@ static void nop_xeiv_get_dt_pdata(struct device *dev,

if (!of_property_read_u32(node, clock-frequency, clk_rate))
pdata-clk_rate = clk_rate;
+   if (of_property_read_bool(node, vcc-supply))
+   pdata-needs_vcc = true;

This can be written as..
pdata-needs_vcc = of_property_read_bool(node, vcc-supply);


+   if (of_property_read_bool(node, reset-supply))
+   pdata-needs_reset = true;

same here..

  }

  static int nop_usb_xceiv_probe(struct platform_device *pdev)
@@ -205,12 +209,16 @@ static int nop_usb_xceiv_probe(struct platform_device 
*pdev)
if (IS_ERR(nop-vcc)) {
dev_dbg(pdev-dev, Error getting vcc regulator: %ld\n,
PTR_ERR(nop-vcc));
+   if (pdata-needs_vcc)
+   return -EPROBE_DEFER;
}

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));
+   if (pdata-needs_reset)
+   return -EPROBE_DEFER;
}

nop-dev = pdev-dev;
diff --git a/include/linux/usb/nop-usb-xceiv.h 
b/include/linux/usb/nop-usb-xceiv.h
index 3265b61..148d351 100644
--- a/include/linux/usb/nop-usb-xceiv.h
+++ b/include/linux/usb/nop-usb-xceiv.h
@@ -6,6 +6,10 @@
  struct nop_usb_xceiv_platform_data {
enum usb_phy_type type;
unsigned long clk_rate;
+
+   /* if set fails with -EPROBE_DEFER if can't get regulator */
+   unsigned int needs_vcc:1;
+   unsigned int needs_reset:1;


how about u8 here?

Thanks
Kishon
--
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 04/13] mfd: omap-usb-tll: Add device tree support

2013-02-04 Thread kishon

On Monday 04 February 2013 09:28 PM, Roger Quadros wrote:

Enable this driver to probe in device tree boot.

CC: Samuel Ortiz sa...@linux.intel.com
Signed-off-by: Roger Quadros rog...@ti.com
---
  .../devicetree/bindings/mfd/omap-usb-tll.txt   |   17 +
  drivers/mfd/omap-usb-tll.c |9 +
  2 files changed, 26 insertions(+), 0 deletions(-)
  create mode 100644 Documentation/devicetree/bindings/mfd/omap-usb-tll.txt

diff --git a/Documentation/devicetree/bindings/mfd/omap-usb-tll.txt 
b/Documentation/devicetree/bindings/mfd/omap-usb-tll.txt
new file mode 100644
index 000..835cf4f
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/omap-usb-tll.txt
@@ -0,0 +1,17 @@
+OMAP HS USB Host TLL (Transceiver-Less Interface)
+
+Required properties:
+
+- compatible : should be ti,usbhs-tll
+- reg : should contain one register range i.e. start and length
+- interrupts : should contain the TLL module's interrupt
+- ti,hwmod : must contain usb_tll_hs
+
+Example:
+
+   usbhstll: usbhstll@0x4a062000 {
The node name shouldn't have 0x. This comment applies to all your 
patches adding device tree support.


Thanks
Kishon
--
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/13] mfd: omap-usb-host: Add device tree support and binding information

2013-02-04 Thread kishon

On Monday 04 February 2013 09:28 PM, Roger Quadros wrote:

Allows the OMAP HS USB host controller to be specified
via device tree.

CC: Samuel Ortiz sa...@linux.intel.com
Signed-off-by: Roger Quadros rog...@ti.com
---
  .../devicetree/bindings/mfd/omap-usb-host.txt  |   68 
  drivers/mfd/omap-usb-host.c|   83 ++--
  2 files changed, 145 insertions(+), 6 deletions(-)
  create mode 100644 Documentation/devicetree/bindings/mfd/omap-usb-host.txt

diff --git a/Documentation/devicetree/bindings/mfd/omap-usb-host.txt 
b/Documentation/devicetree/bindings/mfd/omap-usb-host.txt
new file mode 100644
index 000..2196893
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/omap-usb-host.txt
@@ -0,0 +1,68 @@
+OMAP HS USB Host
+
+Required properties:
+
+- compatible: should be ti,usbhs-host
+- reg: should contain one register range i.e. start and length
+- ti,hwmods: must contain usb_host_hs
+
+Optional properties:
+
+- nports: number of USB ports. Usually this is automatically detected
+  from the IP's revision register but can be overridden by specifying
+  this property.
+
+- portN_mode: Integer specifying the port mode for port N, where N can be
+  from 1 to nports. The port mode must be as per enum usbhs_omap_port_mode
+  in include/linux/platform_data/usb-omap.h
+  If the port mode is not specified, that port is treated as unused.
+
+- single_ulpi_bypass: Must be present if the controller contains a single
+  ULPI bypass control bit. e.g. OMAP3 silicon = ES2.1
+
+Required properties if child node exists:
+
+- #address-cells: Must be 1
+- #size-cells: Must be 1
+- ranges: must be present
+
+Properties for children:
+
+The OMAP HS USB Host subsystem contains EHCI and OHCI controllers.
+See Documentation/devicetree/bindings/usb/omap-ehci.txt and
+omap3-ohci.txt
+
+Example for OMAP4:
+
+usbhshost: usbhshost@0x4a064000 {
+   compatible = ti,usbhs-host;
+   reg = 0x4a064000 0x800;
+   ti,hwmods = usb_host_hs;
+   #address-cells = 1;
+   #size-cells = 1;
+   ranges;
+
+   usbhsohci: ohci@0x4a064800 {
+   compatible = ti,omap3-ohci, usb-ohci;
+   reg = 0x4a064800 0x400;
+   interrupt-parent = gic;
+   interrupts = 0 76 0x4;
+   };
+
+   usbhsehci: ehci@0x4a064c00 {
+   compatible = ti,omap-ehci, usb-ehci;
+   reg = 0x4a064c00 0x400;
+   interrupt-parent = gic;
+   interrupts = 0 77 0x4;
+   };
+};
+
+usbhshost {
+   port1_mode = 1; /* OMAP_EHCI_PORT_MODE_PHY */
+   port2_mode = 2; /* OMAP_EHCI_PORT_MODE_TLL */
+   port3_mode = 1; /* OMAP_EHCI_PORT_MODE_PHY */
+};
+
+usbhsehci {
+   phy = hsusb1_phy 0 hsusb3_phy;
+};
diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
index f8ed08e..0f67856 100644
--- a/drivers/mfd/omap-usb-host.c
+++ b/drivers/mfd/omap-usb-host.c
@@ -1,8 +1,9 @@
  /**
   * omap-usb-host.c - The USBHS core driver for OMAP EHCI  OHCI
   *
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com
+ * Copyright (C) 2011-2013 Texas Instruments Incorporated - http://www.ti.com
   * Author: Keshava Munegowda keshava_mgo...@ti.com
+ * Author: Roger Quadros rog...@ti.com
   *
   * This program is free software: you can redistribute it and/or modify
   * it under the terms of the GNU General Public License version 2  of
@@ -27,6 +28,8 @@
  #include linux/platform_device.h
  #include linux/platform_data/usb-omap.h
  #include linux/pm_runtime.h
+#include linux/of.h
+#include linux/of_platform.h

  #include omap-usb.h

@@ -464,6 +467,37 @@ static void omap_usbhs_init(struct device *dev)
pm_runtime_put_sync(dev);
  }

+static int usbhs_omap_get_dt_pdata(struct device_node *node,
+   struct usbhs_omap_platform_data *pdata)
+{
+   int ret, i;
+
+   ret = of_property_read_u32(node, nports, pdata-nports);
+   if (ret)
+   pdata-nports = 0;
+
+   /* get port modes */
+   for (i = 0; i  OMAP3_HS_USB_PORTS; i++) {
+   char prop[11];
+
+   snprintf(prop, sizeof(prop), port%d_mode, i + 1);
+   ret = of_property_read_u32(node, prop, pdata-port_mode[i]);
+   if (ret)
+   pdata-port_mode[i] = OMAP_USBHS_PORT_MODE_UNUSED;
+   }
+
+   /* get flags */
+   pdata-single_ulpi_bypass = of_property_read_bool(node,
+   single_ulpi_bypass);
+   return 0;
+}
+
+static struct of_device_id usbhs_child_match_table[] __initdata = {
+   { .compatible = ti,omap-ehci, },
+   { .compatible = ti,omap-ohci, },
+   { }
+};
+
  /**
   * usbhs_omap_probe - initialize TI-based HCDs
   *
@@ -479,6 +513,21 @@ static int usbhs_omap_probe(struct platform_device *pdev)
int i;
boolneed_logic_fck;

+   if (dev-of_node) {
+   

Re: [PATCH 10/13] ARM: dts: OMAP4: Add HS USB Host IP nodes

2013-02-04 Thread kishon

On Monday 04 February 2013 09:28 PM, Roger Quadros wrote:

Adds device nodes for HS USB Host module, TLL module,
OHCI and EHCI controllers.

Signed-off-by: Roger Quadros rog...@ti.com
---
  arch/arm/boot/dts/omap4.dtsi |   30 ++
  1 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index 739bb79..3429280 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -529,5 +529,35 @@
ti,hwmods = timer11;
ti,timer-pwm;
};
+
+   usbhstll: usbhstll@0x4a062000 {
+   compatible = ti,usbhs-tll;
+   reg = 0x4a062000 0x1000;
+   interrupts = 0 78 0x4;
+   ti,hwmods = usb_tll_hs;
+   };
+
+   usbhshost: usbhshost@0x4a064000 {
+   compatible = ti,usbhs-host;
+   reg = 0x4a064000 0x800;
+   ti,hwmods = usb_host_hs;
+   #address-cells = 1;
+   #size-cells = 1;
+   ranges;
+
+   usbhsohci: ohci@0x4a064800 {
+   compatible = ti,omap3-ohci, usb-ohci;
+   reg = 0x4a064800 0x400;
+   interrupt-parent = gic;


Just curious.. Were you facing issues if you are not having 
interrupt-parent here? It's also missing in your dt node usbhstll.


Thanks
Kishon
--
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 1/2] usb: phy: samsung: Common out the generic stuff

2013-02-04 Thread Vivek Gautam
Hi Kukjin,


On Wed, Jan 30, 2013 at 11:26 AM, Kukjin Kim kgene@samsung.com wrote:
 Vivek Gautam wrote:

 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

 Just in my opinion, Samsung-usb2phy is more clear?...In addition, I looked
 at using SAMSUNG_USB2PHY as a statement.


Sure will change the file names as suggested
samsung-usbphy.c : common PHY controller driver
samsung-usb2phy.c : USB 2.0 PHY controller driver

Will change the names for CONFIG_XX also accordingly.


 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

 So this can be selected without any dependency?


The idea was SAMSUNG_USBPHY is selected for usb2 type PHY as well as
usb 3 type PHY.
But this seems to be bad :-(
Better we do something like this ?

config SAMSUNG_USB2
bool Samsung USB 2.0 PHY controller Driver
select SAMSUNG_USBPHY
select USB_OTG_UTILS
help
  Enable this to support Samsung USB 2.0 (High Speed) PHY controller
  driver for Samsung SoCs.

config SAMSUNG_USBPHY
bool Samsung USB PHY controller Driver
help
  Enable this to support Samsung USB phy helper driver for Samsung SoCs.
  This driver provides common interface for Samsung USB 2.0 PHY driver
  and later for Samsung USB 3.0 PHY driver.

   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.

 Hmm, according to above comments, this should be enabled under Samsung SoC?


May we just add these configs under USB as mentioned above ?

 +
 +if SAMSUNG_USBPHY

 Why is this needed here?


We will not need this if we change to something like mentioned above.

 +
 +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)

 For naming, if 

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

2013-02-04 Thread Vivek Gautam
Hi Kukjin,


On Wed, Jan 30, 2013 at 11:31 AM, Kukjin Kim kgene@samsung.com wrote:
 Vivek Gautam 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

 It mean, when USB_DWC3 is selected, we can select only one USB2PHY or
 USB3PHY?


Actually, DWC3 expects both USB2PHY and USB3PHY, so went this way.
But this seems bad :-(
Will remove these dependencies as suggested by Felipe also.

 [...]

 +#ifdef CONFIG_OF
 +static const struct of_device_id samsung_usbphy_dt_match[] = {
 + {
 + .compatible = samsung,exynos5250-usb3-phy,
 + .data = usb3_phy_exynos5
 + },
 + {},
 +};
 +MODULE_DEVICE_TABLE(of, samsung_usbphy_dt_match);
 +#endif
 +
 +static struct platform_device_id samsung_usbphy_driver_ids[] = {
 + {
 + .name   = exynos5250-usb3-phy,

 According to the name of file, exynos5250-usb3phy? Just it is imho...


Ok, sure will amend this.

 + .driver_data= (unsigned long)usb3_phy_exynos5,
 + },
 + {},
 +};
 +
 +MODULE_DEVICE_TABLE(platform, samsung_usbphy_driver_ids);
 +
 +static struct platform_driver samsung_usb3_phy_driver = {
 + .probe  = samsung_usb3_phy_probe,
 + .remove = samsung_usb3_phy_remove,
 + .id_table   = samsung_usbphy_driver_ids,
 + .driver = {
 + .name   = samsung-usb3-phy,
 + .owner  = THIS_MODULE,
 + .of_match_table =
 of_match_ptr(samsung_usbphy_dt_match),
 + },
 +};
 +
 +module_platform_driver(samsung_usb3_phy_driver);
 +
 +MODULE_DESCRIPTION(Samsung USB 3.0 phy controller);
 +MODULE_AUTHOR(Vivek Gautam gautam.vi...@samsung.com);
 +MODULE_LICENSE(GPL);
 +MODULE_ALIAS(platform:samsung-usb3-phy);

 I want you to use same naming rule.


Sure.


-- 
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 01/13] usb: phy: nop: Add device tree support and binding information

2013-02-04 Thread Felipe Balbi
Hi,

On Mon, Feb 04, 2013 at 05:58:48PM +0200, Roger Quadros wrote:
 The PHY clock, clock rate, VCC regulator and RESET regulator
 can now be provided via device tree.
 
 Signed-off-by: Roger Quadros rog...@ti.com
 ---
  .../devicetree/bindings/usb/usb-nop-xceiv.txt  |   34 
 
  drivers/usb/otg/nop-usb-xceiv.c|   31 ++
  2 files changed, 65 insertions(+), 0 deletions(-)
  create mode 100644 Documentation/devicetree/bindings/usb/usb-nop-xceiv.txt
 
 diff --git a/Documentation/devicetree/bindings/usb/usb-nop-xceiv.txt 
 b/Documentation/devicetree/bindings/usb/usb-nop-xceiv.txt
 new file mode 100644
 index 000..d7e2726
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/usb/usb-nop-xceiv.txt
 @@ -0,0 +1,34 @@
 +USB NOP PHY
 +
 +Required properties:
 +- compatible: should be usb-nop-xceiv
 +
 +Optional properties:
 +- clocks: phandle to the PHY clock. Use as per Documentation/devicetree
 +  /bindings/clock/clock-bindings.txt
 +  This property is required if clock-frequency is specified.
 +
 +- clock-names: Should be main_clk
 +
 +- clock-frequency: the clock frequency (in Hz) that the PHY clock must
 +  be configured to.
 +
 +- vcc-supply: phandle to the regulator that provides RESET to the PHY.
 +
 +- reset-supply: phandle to the regulator that provides power to the PHY.
 +
 +Example:
 +
 + hsusb1_phy {
 + compatible = usb-nop-xceiv;
 + clock-frequency = 1920;
 + clocks = osc 0;
 + clock-names = main_clk;
 + vcc-supply = hsusb1_vcc_regulator;
 + reset-supply = hsusb1_reset_regulator;
 + };
 +
 +hsusb1_phy is a NOP USB PHY device that gets its clock from an oscillator
 +and expects that clock to be configured to 19.2MHz by the NOP PHY driver.
 +hsusb1_vcc_regulator provides power to the PHY and hsusb1_reset_regulator
 +controls RESET.
 diff --git a/drivers/usb/otg/nop-usb-xceiv.c b/drivers/usb/otg/nop-usb-xceiv.c
 index ac027a1..adbb7ab 100644
 --- a/drivers/usb/otg/nop-usb-xceiv.c
 +++ b/drivers/usb/otg/nop-usb-xceiv.c
 @@ -34,6 +34,7 @@
  #include linux/slab.h
  #include linux/clk.h
  #include linux/regulator/consumer.h
 +#include linux/of.h
  
  struct nop_usb_xceiv {
   struct usb_phy  phy;
 @@ -138,8 +139,19 @@ static int nop_set_host(struct usb_otg *otg, struct 
 usb_bus *host)
   return 0;
  }
  
 +static void nop_xeiv_get_dt_pdata(struct device *dev,

asking to remove, but xeiv != xceiv :-)

 + struct nop_usb_xceiv_platform_data *pdata)
 +{
 + struct device_node *node = dev-of_node;
 + u32 clk_rate;
 +
 + if (!of_property_read_u32(node, clock-frequency, clk_rate))
 + pdata-clk_rate = clk_rate;
 +}
 +
  static int nop_usb_xceiv_probe(struct platform_device *pdev)
  {
 + struct device *dev = pdev-dev;
   struct nop_usb_xceiv_platform_data *pdata = pdev-dev.platform_data;
   struct nop_usb_xceiv*nop;
   enum usb_phy_type   type = USB_PHY_TYPE_USB2;
 @@ -153,6 +165,17 @@ static int nop_usb_xceiv_probe(struct platform_device 
 *pdev)
   if (!nop-phy.otg)
   return -ENOMEM;
  
 + if (dev-of_node) {
 + pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
 + if (!pdata) {
 + dev_err(dev, Memory allocation failure\n);
 + return -ENOMEM;
 + }
 + nop_xeiv_get_dt_pdata(dev, pdata);

actually, I would prefer to not create pdata at all. I mean, ideally
pdata would be used to initialize fields in your own structure, so first
move clk_rate to your own private structure, copy pdata's clk_rate value
to that, then you don't need this hackery when using DT.

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH 10/13] ARM: dts: OMAP4: Add HS USB Host IP nodes

2013-02-04 Thread Felipe Balbi
On Mon, Feb 04, 2013 at 05:58:57PM +0200, Roger Quadros wrote:
 Adds device nodes for HS USB Host module, TLL module,
 OHCI and EHCI controllers.
 
 Signed-off-by: Roger Quadros rog...@ti.com
 ---
  arch/arm/boot/dts/omap4.dtsi |   30 ++
  1 files changed, 30 insertions(+), 0 deletions(-)
 
 diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
 index 739bb79..3429280 100644
 --- a/arch/arm/boot/dts/omap4.dtsi
 +++ b/arch/arm/boot/dts/omap4.dtsi
 @@ -529,5 +529,35 @@
   ti,hwmods = timer11;
   ti,timer-pwm;
   };
 +
 + usbhstll: usbhstll@0x4a062000 {
 + compatible = ti,usbhs-tll;
 + reg = 0x4a062000 0x1000;
 + interrupts = 0 78 0x4;
 + ti,hwmods = usb_tll_hs;
 + };
 +
 + usbhshost: usbhshost@0x4a064000 {
 + compatible = ti,usbhs-host;
 + reg = 0x4a064000 0x800;
 + ti,hwmods = usb_host_hs;
 + #address-cells = 1;
 + #size-cells = 1;
 + ranges;
 +
 + usbhsohci: ohci@0x4a064800 {

usbhsohci is a bit misleading :-)

How about we stick to ohci and ehci for these nodes ? :-)

-- 
balbi


signature.asc
Description: Digital signature


Re: Linux USB file storage gadget with new UDC

2013-02-04 Thread victor yeo
Hi,

 How to set bh-state to BUF_STATE_EMPTY after the buffer is processed?

 It gets set to BUF_STATE_EMPTY in several different places, depending
 on the purpose the buffer was used for.  See bulk_in_complete (your UDC
 driver should call this routine for every request over a bulk-IN
 endpoint, when it is safe for the gadget driver to overwrite the data
 in the transfer buffer and re-use the request). See also
 get_next_command, the line just after the call to received_cbw.

Thanks, i added in UDC driver to call bulk_in_complete for every
request over a bulk in ep, now the gadget driver is able to process
the SCSI Inquiry command. When it comes to SCSI Read Format Capacities
command, the gadget driver gives attention condition error in
check_command() in the code snippet below, and the command is not
processed by do_read_format_capacities().

if (curlun  curlun-unit_attention_data != SS_NO_SENSE 
fsg-cmnd[0] != INQUIRY 
fsg-cmnd[0] != REQUEST_SENSE) {
curlun-sense_data = curlun-unit_attention_data;
curlun-unit_attention_data = SS_NO_SENSE;
return -EINVAL;
}

Besides the code snippet, the only place that sets unit_attention data
to SS_NO_SENSE is in handle_exception(). How is UDC driver able to
overcome this problem?

victor
--
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: Linux USB file storage gadget with new UDC

2013-02-04 Thread Felipe Balbi
On Tue, Feb 05, 2013 at 03:49:22PM +0800, victor yeo wrote:
 Hi,
 
  How to set bh-state to BUF_STATE_EMPTY after the buffer is processed?
 
  It gets set to BUF_STATE_EMPTY in several different places, depending
  on the purpose the buffer was used for.  See bulk_in_complete (your UDC
  driver should call this routine for every request over a bulk-IN
  endpoint, when it is safe for the gadget driver to overwrite the data
  in the transfer buffer and re-use the request). See also
  get_next_command, the line just after the call to received_cbw.
 
 Thanks, i added in UDC driver to call bulk_in_complete for every
 request over a bulk in ep, now the gadget driver is able to process

UDC shouldn't call bulk_in_complete() directly, you should be calling
request-complete() instead.

-- 
balbi


signature.asc
Description: Digital signature


Re: Linux USB file storage gadget with new UDC

2013-02-04 Thread victor yeo
Hi,

  How to set bh-state to BUF_STATE_EMPTY after the buffer is processed?
 
  It gets set to BUF_STATE_EMPTY in several different places, depending
  on the purpose the buffer was used for.  See bulk_in_complete (your UDC
  driver should call this routine for every request over a bulk-IN
  endpoint, when it is safe for the gadget driver to overwrite the data
  in the transfer buffer and re-use the request). See also
  get_next_command, the line just after the call to received_cbw.

 Thanks, i added in UDC driver to call bulk_in_complete for every
 request over a bulk in ep, now the gadget driver is able to process

 UDC shouldn't call bulk_in_complete() directly, you should be calling
 request-complete() instead.


Yes, the UDC driver calls the request-complete() which in turn calls
the bulk_in_complete(). I am sorry my writing is not clear.

victor
--
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