[PATCH 00/12] chipidea/imx: add otg support and some bug fix

2012-07-12 Thread Richard Zhao
The patch set is tested on imx6q_sabrelite board.

The patch can also be found at
https://github.com/riczhao/kernel-imx/commits/topics/usb-driver

For test which merged platform patches:
https://github.com/riczhao/kernel-imx/commits/topics/usb-test

It's better apply after patch I sent out:
usb: chipidea: cleanup dma_pool if udc_start() fails

Richard Zhao (12):
  USB: chipidea: imx: add pinctrl support
  USB: chipidea: delay 2ms before read ID status at probe time
  USB: chipidea: move OTGSC_IDIS clearing from ci_role_work to irq
handler
  USB: chipidea: clear gadget struct at udc_start fail path
  USB: chipidea: don't let probe fail if otg controller start one role
failed
  USB: mxs-phy: add basic otg support
  USB: chipidea: add vbus detect for udc
  USB: chipidea: convert to use devm_request_irq
  USB: chipidea: add -DDEBUG if CONFIG_USB_CHIPIDEA_DEBUG
  USB: chipidea: add set_vbus_power support
  USB: chipidea: re-order irq handling to avoid unhandled irq
  USB: chipidea: add imx usbmisc support

 .../devicetree/bindings/usb/imx-usbmisc.txt|   15 ++
 drivers/usb/chipidea/Makefile  |4 +-
 drivers/usb/chipidea/ci.h  |1 +
 drivers/usb/chipidea/ci13xxx_imx.c |   50 +--
 drivers/usb/chipidea/core.c|   36 +++--
 drivers/usb/chipidea/host.c|8 ++
 drivers/usb/chipidea/imx_usbmisc.c |  144 
 drivers/usb/chipidea/udc.c |   40 +-
 drivers/usb/otg/mxs-phy.c  |   21 +++
 include/linux/usb/chipidea.h   |2 +
 10 files changed, 293 insertions(+), 28 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/usb/imx-usbmisc.txt
 create mode 100644 drivers/usb/chipidea/imx_usbmisc.c

-- 
1.7.9.5


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


[PATCH 01/12] USB: chipidea: imx: add pinctrl support

2012-07-12 Thread Richard Zhao
Some controllers may not need to setup pinctrl, so we don't fail the
probe if pinctrl get/select failed.

Signed-off-by: Richard Zhao 
---
 drivers/usb/chipidea/ci13xxx_imx.c |7 +++
 1 file changed, 7 insertions(+)

diff --git a/drivers/usb/chipidea/ci13xxx_imx.c 
b/drivers/usb/chipidea/ci13xxx_imx.c
index ef60d06..c94e30f 100644
--- a/drivers/usb/chipidea/ci13xxx_imx.c
+++ b/drivers/usb/chipidea/ci13xxx_imx.c
@@ -20,6 +20,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "ci.h"
 
@@ -49,6 +50,7 @@ static int __devinit ci13xxx_imx_probe(struct platform_device 
*pdev)
struct device_node *phy_np;
struct resource *res;
struct regulator *reg_vbus;
+   struct pinctrl *pinctrl;
int ret;
 
data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
@@ -63,6 +65,11 @@ static int __devinit ci13xxx_imx_probe(struct 
platform_device *pdev)
return -ENOENT;
}
 
+   pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
+   if (IS_ERR(pinctrl))
+   dev_warn(&pdev->dev, "pinctrl get/select failed, err=%ld\n",
+   PTR_ERR(pinctrl));
+
data->clk = devm_clk_get(&pdev->dev, NULL);
if (IS_ERR(data->clk)) {
dev_err(&pdev->dev,
-- 
1.7.9.5


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


[PATCH 03/12] USB: chipidea: move OTGSC_IDIS clearing from ci_role_work to irq handler

2012-07-12 Thread Richard Zhao
OTGSC_IDIS must be cleared in irq handler to avoid re-queue the work.

Signed-off-by: Richard Zhao 
---
 drivers/usb/chipidea/core.c |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index 3c3ed77..19ef324 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -273,8 +273,6 @@ static void ci_role_work(struct work_struct *work)
struct ci13xxx *ci = container_of(work, struct ci13xxx, work);
enum ci_role role = ci_otg_role(ci);
 
-   hw_write(ci, OP_OTGSC, OTGSC_IDIS, OTGSC_IDIS);
-
if (role != ci->role) {
dev_dbg(ci->dev, "switching from %s to %s\n",
ci_role(ci)->name, ci->roles[role]->name);
@@ -325,6 +323,7 @@ static irqreturn_t ci_irq(int irq, void *data)
u32 sts = hw_read(ci, OP_OTGSC, ~0);
 
if (sts & OTGSC_IDIS) {
+   hw_write(ci, OP_OTGSC, OTGSC_IDIS, OTGSC_IDIS);
queue_work(ci->wq, &ci->work);
ret = IRQ_HANDLED;
}
-- 
1.7.9.5


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


[PATCH 04/12] USB: chipidea: clear gadget struct at udc_start fail path

2012-07-12 Thread Richard Zhao
States in gadget are not needed any more, set it to zero.

Signed-off-by: Richard Zhao 
---
 drivers/usb/chipidea/udc.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
index 9029985..fd27f4d 100644
--- a/drivers/usb/chipidea/udc.c
+++ b/drivers/usb/chipidea/udc.c
@@ -1759,6 +1759,7 @@ free_pools:
dma_pool_destroy(ci->td_pool);
 free_qh_pool:
dma_pool_destroy(ci->qh_pool);
+   memset(&ci->gadget, 0, sizeof(ci->gadget));
return retval;
 }
 
-- 
1.7.9.5


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


[PATCH 05/12] USB: chipidea: don't let probe fail if otg controller start one role failed

2012-07-12 Thread Richard Zhao
One role failed, but the other role will possiblly still work.
For example, when udc start failed, if plug in a host device,
it works.

Signed-off-by: Richard Zhao 
---
 drivers/usb/chipidea/core.c |7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index 19ef324..8fd390a 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -473,8 +473,11 @@ static int __devinit ci_hdrc_probe(struct platform_device 
*pdev)
ret = ci_role_start(ci, ci->role);
if (ret) {
dev_err(dev, "can't start %s role\n", ci_role(ci)->name);
-   ret = -ENODEV;
-   goto rm_wq;
+   ci->role = CI_ROLE_END;
+   if (!ci->is_otg) {
+   ret = -ENODEV;
+   goto rm_wq;
+   }
}
 
platform_set_drvdata(pdev, ci);
-- 
1.7.9.5


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


[PATCH 06/12] USB: mxs-phy: add basic otg support

2012-07-12 Thread Richard Zhao
Signed-off-by: Richard Zhao 
---
 drivers/usb/otg/mxs-phy.c |   21 +
 1 file changed, 21 insertions(+)

diff --git a/drivers/usb/otg/mxs-phy.c b/drivers/usb/otg/mxs-phy.c
index c1a67cb..6a03e97 100644
--- a/drivers/usb/otg/mxs-phy.c
+++ b/drivers/usb/otg/mxs-phy.c
@@ -97,12 +97,24 @@ static int mxs_phy_on_disconnect(struct usb_phy *phy, int 
port)
return 0;
 }
 
+static int mxs_phy_set_host(struct usb_otg *otg, struct usb_bus *host)
+{
+   return 0;
+}
+
+static int mxs_phy_set_peripheral(struct usb_otg *otg,
+   struct usb_gadget *gadget)
+{
+   return 0;
+}
+
 static int mxs_phy_probe(struct platform_device *pdev)
 {
struct resource *res;
void __iomem *base;
struct clk *clk;
struct mxs_phy *mxs_phy;
+   struct usb_otg *otg;
 
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) {
@@ -139,6 +151,15 @@ static int mxs_phy_probe(struct platform_device *pdev)
 
mxs_phy->clk = clk;
 
+   otg = devm_kzalloc(&pdev->dev, sizeof(struct usb_otg), GFP_KERNEL);
+   if (!otg)
+   return -ENOMEM;
+   otg->phy = &mxs_phy->phy;
+   otg->set_host = mxs_phy_set_host;
+   otg->set_peripheral = mxs_phy_set_peripheral;
+
+   mxs_phy->phy.otg = otg;
+
platform_set_drvdata(pdev, &mxs_phy->phy);
 
return 0;
-- 
1.7.9.5


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


[PATCH 07/12] USB: chipidea: add vbus detect for udc

2012-07-12 Thread Richard Zhao
Using vbus valid interrupt to detect vbus.

Signed-off-by: Richard Zhao 
---
 drivers/usb/chipidea/ci.h  |1 +
 drivers/usb/chipidea/udc.c |   39 ++-
 2 files changed, 39 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h
index d738603..e25d126 100644
--- a/drivers/usb/chipidea/ci.h
+++ b/drivers/usb/chipidea/ci.h
@@ -139,6 +139,7 @@ struct ci13xxx {
enum ci_rolerole;
boolis_otg;
struct work_struct  work;
+   struct work_struct  vbus_work;
struct workqueue_struct *wq;
 
struct dma_pool *qh_pool;
diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
index fd27f4d..0b18191 100644
--- a/drivers/usb/chipidea/udc.c
+++ b/drivers/usb/chipidea/udc.c
@@ -308,6 +308,18 @@ static u32 hw_test_and_clear_intr_active(struct ci13xxx 
*ci)
return reg;
 }
 
+static void hw_enable_vbus_intr(struct ci13xxx *ci)
+{
+   hw_write(ci, OP_OTGSC, OTGSC_AVVIS, OTGSC_AVVIS);
+   hw_write(ci, OP_OTGSC, OTGSC_AVVIE, OTGSC_AVVIE);
+   queue_work(ci->wq, &ci->vbus_work);
+}
+
+static void hw_disable_vbus_intr(struct ci13xxx *ci)
+{
+   hw_write(ci, OP_OTGSC, OTGSC_AVVIE, 0);
+}
+
 /**
  * hw_test_and_clear_setup_guard: test & clear setup guard (execute without
  *interruption)
@@ -374,6 +386,16 @@ static int hw_usb_reset(struct ci13xxx *ci)
return 0;
 }
 
+static void vbus_work(struct work_struct *work)
+{
+   struct ci13xxx *ci = container_of(work, struct ci13xxx, vbus_work);
+
+   if (hw_read(ci, OP_OTGSC, OTGSC_AVV))
+   usb_gadget_vbus_connect(&ci->gadget);
+   else
+   usb_gadget_vbus_disconnect(&ci->gadget);
+}
+
 /**
  * UTIL block
  */
@@ -1376,6 +1398,7 @@ static int ci13xxx_vbus_session(struct usb_gadget 
*_gadget, int is_active)
if (is_active) {
pm_runtime_get_sync(&_gadget->dev);
hw_device_reset(ci, USBMODE_CM_DC);
+   hw_enable_vbus_intr(ci);
hw_device_state(ci, ci->ep0out->qh.dma);
} else {
hw_device_state(ci, 0);
@@ -1528,8 +1551,10 @@ static int ci13xxx_start(struct usb_gadget *gadget,
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)
+   if (ci->platdata->flags & CI13XXX_REGS_SHARED) {
hw_device_reset(ci, USBMODE_CM_DC);
+   hw_enable_vbus_intr(ci);
+   }
} else {
pm_runtime_put_sync(&ci->gadget.dev);
goto done;
@@ -1635,6 +1660,13 @@ static irqreturn_t udc_irq(struct ci13xxx *ci)
} else {
retval = IRQ_NONE;
}
+
+   intr = hw_read(ci, OP_OTGSC, ~0);
+   hw_write(ci, OP_OTGSC, ~0, intr);
+
+   if (intr & (OTGSC_AVVIE & OTGSC_AVVIS))
+   queue_work(ci->wq, &ci->vbus_work);
+
spin_unlock(&ci->lock);
 
return retval;
@@ -1710,6 +1742,7 @@ static int udc_start(struct ci13xxx *ci)
retval = hw_device_reset(ci, USBMODE_CM_DC);
if (retval)
goto put_transceiver;
+   hw_enable_vbus_intr(ci);
}
 
retval = device_register(&ci->gadget.dev);
@@ -1773,6 +1806,9 @@ static void udc_stop(struct ci13xxx *ci)
if (ci == NULL)
return;
 
+   hw_disable_vbus_intr(ci);
+   cancel_work_sync(&ci->vbus_work);
+
usb_del_gadget_udc(&ci->gadget);
 
destroy_eps(ci);
@@ -1813,6 +1849,7 @@ int ci_hdrc_gadget_init(struct ci13xxx *ci)
rdrv->irq   = udc_irq;
rdrv->name  = "gadget";
ci->roles[CI_ROLE_GADGET] = rdrv;
+   INIT_WORK(&ci->vbus_work, vbus_work);
 
return 0;
 }
-- 
1.7.9.5


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


[PATCH 02/12] USB: chipidea: delay 2ms before read ID status at probe time

2012-07-12 Thread Richard Zhao
The ID pin needs 1ms debounce time, event at probe time. We delay 2ms
for safe.

Signed-off-by: Richard Zhao 
---
 drivers/usb/chipidea/core.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index 1083585..3c3ed77 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -462,6 +462,8 @@ static int __devinit ci_hdrc_probe(struct platform_device 
*pdev)
 
if (ci->roles[CI_ROLE_HOST] && ci->roles[CI_ROLE_GADGET]) {
ci->is_otg = true;
+   /* ID pin needs 1ms debouce time, we delay 2ms for safe */
+   mdelay(2);
ci->role = ci_otg_role(ci);
} else {
ci->role = ci->roles[CI_ROLE_HOST]
-- 
1.7.9.5


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


[PATCH 08/12] USB: chipidea: convert to use devm_request_irq

2012-07-12 Thread Richard Zhao
Signed-off-by: Richard Zhao 
---
 drivers/usb/chipidea/core.c |5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index 8fd390a..7485c84 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -481,8 +481,8 @@ static int __devinit ci_hdrc_probe(struct platform_device 
*pdev)
}
 
platform_set_drvdata(pdev, ci);
-   ret = request_irq(ci->irq, ci_irq, IRQF_SHARED, ci->platdata->name,
- ci);
+   ret = devm_request_irq(dev, ci->irq, ci_irq, IRQF_SHARED,
+   ci->platdata->name, ci);
if (ret)
goto stop;
 
@@ -513,7 +513,6 @@ static int __devexit ci_hdrc_remove(struct platform_device 
*pdev)
flush_workqueue(ci->wq);
destroy_workqueue(ci->wq);
device_remove_file(ci->dev, &dev_attr_role);
-   free_irq(ci->irq, ci);
ci_role_stop(ci);
 
return 0;
-- 
1.7.9.5


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


[PATCH 09/12] USB: chipidea: add -DDEBUG if CONFIG_USB_CHIPIDEA_DEBUG

2012-07-12 Thread Richard Zhao
Signed-off-by: Richard Zhao 
---
 drivers/usb/chipidea/Makefile |2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/chipidea/Makefile b/drivers/usb/chipidea/Makefile
index 5c66d9c..3f56b76 100644
--- a/drivers/usb/chipidea/Makefile
+++ b/drivers/usb/chipidea/Makefile
@@ -1,3 +1,5 @@
+ccflags-$(CONFIG_USB_CHIPIDEA_DEBUG) := -DDEBUG
+
 obj-$(CONFIG_USB_CHIPIDEA) += ci_hdrc.o
 
 ci_hdrc-y  := core.o
-- 
1.7.9.5


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


[PATCH 10/12] USB: chipidea: add set_vbus_power support

2012-07-12 Thread Richard Zhao
set_vbus_power is used to enable or disable vbus power for usb host.

Signed-off-by: Richard Zhao 
---
 drivers/usb/chipidea/ci13xxx_imx.c |   39 +---
 drivers/usb/chipidea/host.c|8 
 include/linux/usb/chipidea.h   |2 ++
 3 files changed, 37 insertions(+), 12 deletions(-)

diff --git a/drivers/usb/chipidea/ci13xxx_imx.c 
b/drivers/usb/chipidea/ci13xxx_imx.c
index c94e30f..b3173d8 100644
--- a/drivers/usb/chipidea/ci13xxx_imx.c
+++ b/drivers/usb/chipidea/ci13xxx_imx.c
@@ -26,6 +26,8 @@
 
 #define pdev_to_phy(pdev) \
((struct usb_phy *)platform_get_drvdata(pdev))
+#define ci_to_imx_data(ci) \
+   ((struct ci13xxx_imx_data *)dev_get_drvdata(ci->dev->parent))
 
 struct ci13xxx_imx_data {
struct device_node *phy_np;
@@ -35,12 +37,32 @@ struct ci13xxx_imx_data {
struct regulator *reg_vbus;
 };
 
+static int ci13xxx_imx_vbus(struct ci13xxx *ci, int enable)
+{
+   struct ci13xxx_imx_data *data = ci_to_imx_data(ci);
+   int ret;
+
+   if (!data->reg_vbus)
+   return 0;
+
+   if (enable)
+   ret = regulator_enable(data->reg_vbus);
+   else
+   ret = regulator_disable(data->reg_vbus);
+   if (ret)
+   dev_err(ci->dev, "ci13xxx_imx_vbus failed, enable:%d err:%d\n",
+   enable, ret);
+
+   return ret;
+}
+
 static struct ci13xxx_platform_data ci13xxx_imx_platdata __devinitdata  = {
.name   = "ci13xxx_imx",
.flags  = CI13XXX_REQUIRE_TRANSCEIVER |
  CI13XXX_PULLUP_ON_VBUS |
  CI13XXX_DISABLE_STREAMING,
.capoffset  = DEF_CAPOFFSET,
+   .set_vbus_power = ci13xxx_imx_vbus,
 };
 
 static int __devinit ci13xxx_imx_probe(struct platform_device *pdev)
@@ -101,18 +123,10 @@ static int __devinit 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;
 
@@ -127,6 +141,9 @@ static int __devinit ci13xxx_imx_probe(struct 
platform_device *pdev)
*pdev->dev.dma_mask = DMA_BIT_MASK(32);
dma_set_coherent_mask(&pdev->dev, *pdev->dev.dma_mask);
}
+
+   platform_set_drvdata(pdev, data);
+
plat_ci = ci13xxx_add_device(&pdev->dev,
pdev->resource, pdev->num_resources,
&ci13xxx_imx_platdata);
@@ -139,7 +156,6 @@ static int __devinit ci13xxx_imx_probe(struct 
platform_device *pdev)
}
 
data->ci_pdev = plat_ci;
-   platform_set_drvdata(pdev, data);
 
pm_runtime_no_callbacks(&pdev->dev);
pm_runtime_enable(&pdev->dev);
@@ -149,7 +165,6 @@ static int __devinit 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);
clk_disable_unprepare(data->clk);
diff --git a/drivers/usb/chipidea/host.c b/drivers/usb/chipidea/host.c
index ebff9f4..e091147 100644
--- a/drivers/usb/chipidea/host.c
+++ b/drivers/usb/chipidea/host.c
@@ -106,6 +106,12 @@ static int host_start(struct ci13xxx *ci)
if (usb_disabled())
return -ENODEV;
 
+   if (ci->platdata->set_vbus_power) {
+   ret = ci->platdata->set_vbus_power(ci, 1);
+   if (ret)
+   return ret;
+   }
+
hcd = usb_create_hcd(&ci_ehci_hc_driver, ci->dev, dev_name(ci->dev));
if (!hcd)
return -ENOMEM;
@@ -138,6 +144,8 @@ static void host_stop(struct ci13xxx *ci)
 
usb_remove_hcd(hcd);
usb_put_hcd(hcd);
+   if (ci->platdata->set_vbus_power)
+   ci->platdata->set_vbus_power(ci, 0);
 }
 
 int ci_hdrc_host_init(struct ci13xxx *ci)
diff --git a/include/linux/usb/chipidea.h b/include/linux/usb/chipidea.h
index 544825d..080f479 100644
--- a/include/linux/usb/chipidea.h
+++ b/include/linux/usb/chipidea.h
@@ -23,6 +23,8 @@ struct ci13xxx_platform_data {
 #define CI13XXX_CONTROLLER_RESET_EVENT 0
 #define CI13XXX_CONTROLLER_STOPPED_EVENT   1
void(*notify_event) (struct ci13xxx *ci, unsigned event);
+   /* set vbus power, it must be called in non-atomic context */
+   int (*set_vbus_power) (struct ci13xxx *ci, int enable);
 };
 
 /*

[PATCH 12/12] USB: chipidea: add imx usbmisc support

2012-07-12 Thread Richard Zhao
i.MX usb controllers shares non-core registers, which may include
SoC specific controls. We take it as a usbmisc device and usbmisc
driver export functions needed by ci13xxx_imx driver.

For example, Sabrelite board has bad over-current design, we can
usbmisc to disable over-current detect.

Signed-off-by: Richard Zhao 
---
 .../devicetree/bindings/usb/imx-usbmisc.txt|   15 ++
 drivers/usb/chipidea/Makefile  |2 +-
 drivers/usb/chipidea/ci13xxx_imx.c |4 +
 drivers/usb/chipidea/imx_usbmisc.c |  144 
 4 files changed, 164 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/usb/imx-usbmisc.txt
 create mode 100644 drivers/usb/chipidea/imx_usbmisc.c

diff --git a/Documentation/devicetree/bindings/usb/imx-usbmisc.txt 
b/Documentation/devicetree/bindings/usb/imx-usbmisc.txt
new file mode 100644
index 000..09f01ca
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/imx-usbmisc.txt
@@ -0,0 +1,15 @@
+* Freescale i.MX non-core registers
+
+Required properties:
+- compatible: Should be "fsl,imx6q-usbmisc"
+- reg: Should contain registers location and length
+
+Optional properties:
+- fsl,disable-over-current: disable over current detect
+
+Examples:
+usbmisc@02184800 {
+   compatible = "fsl,imx6q-usbmisc";
+   reg = <0x02184800 0x200>;
+   fsl,disable-over-current;
+};
diff --git a/drivers/usb/chipidea/Makefile b/drivers/usb/chipidea/Makefile
index 3f56b76..46fc31c 100644
--- a/drivers/usb/chipidea/Makefile
+++ b/drivers/usb/chipidea/Makefile
@@ -17,5 +17,5 @@ ifneq ($(CONFIG_PCI),)
 endif
 
 ifneq ($(CONFIG_OF_DEVICE),)
-   obj-$(CONFIG_USB_CHIPIDEA)  += ci13xxx_imx.o
+   obj-$(CONFIG_USB_CHIPIDEA)  += ci13xxx_imx.o imx_usbmisc.o
 endif
diff --git a/drivers/usb/chipidea/ci13xxx_imx.c 
b/drivers/usb/chipidea/ci13xxx_imx.c
index b3173d8..dd7f3a3 100644
--- a/drivers/usb/chipidea/ci13xxx_imx.c
+++ b/drivers/usb/chipidea/ci13xxx_imx.c
@@ -24,6 +24,8 @@
 
 #include "ci.h"
 
+int imx_usbmisc_init(struct device *usbdev);
+
 #define pdev_to_phy(pdev) \
((struct usb_phy *)platform_get_drvdata(pdev))
 #define ci_to_imx_data(ci) \
@@ -142,6 +144,8 @@ static int __devinit ci13xxx_imx_probe(struct 
platform_device *pdev)
dma_set_coherent_mask(&pdev->dev, *pdev->dev.dma_mask);
}
 
+   imx_usbmisc_init(&pdev->dev);
+
platform_set_drvdata(pdev, data);
 
plat_ci = ci13xxx_add_device(&pdev->dev,
diff --git a/drivers/usb/chipidea/imx_usbmisc.c 
b/drivers/usb/chipidea/imx_usbmisc.c
new file mode 100644
index 000..33a8ec0
--- /dev/null
+++ b/drivers/usb/chipidea/imx_usbmisc.c
@@ -0,0 +1,144 @@
+/*
+ * Copyright 2012 Freescale Semiconductor, Inc.
+ *
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+struct usbmisc;
+
+struct soc_data {
+   int (*init) (struct usbmisc *usbmisc, int id);
+   void (*exit) (struct usbmisc *usbmisc, int id);
+};
+
+struct usbmisc {
+   struct soc_data *soc_data;
+   void __iomem *base;
+   struct clk *clk;
+
+   int dis_oc:1;
+};
+
+/* Since we only have one usbmisc device at runtime, we global variables */
+static struct usbmisc *usbmisc;
+
+static int imx6q_usbmisc_init(struct usbmisc *usbmisc, int id)
+{
+   u32 reg;
+
+   if (usbmisc->dis_oc) {
+   reg = readl_relaxed(usbmisc->base + id * 4);
+   writel_relaxed(reg | (1 << 7), usbmisc->base + id * 4);
+   }
+
+   return 0;
+}
+
+static struct soc_data imx6q_data = {
+   .init = imx6q_usbmisc_init,
+};
+
+
+static const struct of_device_id imx_usbmisc_dt_ids[] = {
+   { .compatible = "fsl,imx6q-usbmisc", .data = &imx6q_data },
+   { /* sentinel */ }
+};
+
+static int __devinit imx_usbmisc_probe(struct platform_device *pdev)
+{
+   struct resource *res;
+   struct usbmisc *data;
+   const struct of_device_id *of_id =
+   of_match_device(imx_usbmisc_dt_ids, &pdev->dev);
+
+   int ret;
+
+   if (usbmisc)
+   return -EBUSY;
+
+   data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
+   if (!data)
+   return -ENOMEM;
+
+   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+   data->base = devm_request_and_ioremap(&pdev->dev, res);
+   if (!data->base)
+   return -EADDRNOTAVAIL;
+
+   data->clk = devm_clk_get(&pdev->dev, NULL);
+   if (IS_ERR(data->clk)) {
+   dev_err(&pdev->dev,
+   "failed to get clock, err=%ld\n", PTR_ERR(data->clk));
+   return PTR_ERR(data->clk);
+   }
+
+   ret = clk_prepare_enable(data->clk);

[PATCH 11/12] USB: chipidea: re-order irq handling to avoid unhandled irq

2012-07-12 Thread Richard Zhao
- let role driver handle irq before ID change check. It give the
  role driver a chance to handle disconnect.
- disable irq during switch role. No role driver to handle irq in
  the period.

Signed-off-by: Richard Zhao 
---
 drivers/usb/chipidea/core.c |   21 +
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index 7485c84..0942b9b 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -279,6 +279,7 @@ static void ci_role_work(struct work_struct *work)
 
ci_role_stop(ci);
ci_role_start(ci, role);
+   enable_irq(ci->irq);
}
 }
 
@@ -318,18 +319,22 @@ static irqreturn_t ci_irq(int irq, void *data)
 {
struct ci13xxx *ci = data;
irqreturn_t ret = IRQ_NONE;
+   u32 otgsc = 0;
 
-   if (ci->is_otg) {
-   u32 sts = hw_read(ci, OP_OTGSC, ~0);
+   if (ci->is_otg)
+   otgsc = hw_read(ci, OP_OTGSC, ~0);
 
-   if (sts & OTGSC_IDIS) {
-   hw_write(ci, OP_OTGSC, OTGSC_IDIS, OTGSC_IDIS);
-   queue_work(ci->wq, &ci->work);
-   ret = IRQ_HANDLED;
-   }
+   if (ci->role != CI_ROLE_END)
+   ret = ci_role(ci)->irq(ci);
+
+   if (ci->is_otg && (otgsc & OTGSC_IDIS)) {
+   hw_write(ci, OP_OTGSC, OTGSC_IDIS, OTGSC_IDIS);
+   disable_irq_nosync(ci->irq);
+   queue_work(ci->wq, &ci->work);
+   ret = IRQ_HANDLED;
}
 
-   return ci->role == CI_ROLE_END ? ret : ci_role(ci)->irq(ci);
+   return ret;
 }
 
 static DEFINE_IDA(ci_ida);
-- 
1.7.9.5


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


Re: [PATCH 12/12] USB: chipidea: add imx usbmisc support

2012-07-12 Thread Richard Zhao
[snip]
> --- /dev/null
> +++ b/drivers/usb/chipidea/imx_usbmisc.c
> @@ -0,0 +1,144 @@
> +/*
> + * Copyright 2012 Freescale Semiconductor, Inc.
> + *
> + * The code contained herein is licensed under the GNU General Public
> + * License. You may obtain a copy of the GNU General Public License
> + * Version 2 or later at the following locations:
> + *
> + * http://www.opensource.org/licenses/gpl-license.html
> + * http://www.gnu.org/copyleft/gpl.html
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
It should be linux/io.h
 
Thanks
Richard

--
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] From 2.6.39-rc1 onward, the Logitech Quickcam Fusion webcam (046d:08c1) stops

2012-07-12 Thread Eric Ding
On 07/09/2012 10:17 PM, Alan Stern wrote:
> On Sun, 8 Jul 2012, Jonathan Nieder wrote:
> 
>> Eric Ding wrote:
>>
>>> So it looks like you'd have to both look for USB_CLASS_VIDEO and check
>>> uvc_ids[] too... which becomes somewhat hairy, since I assume you don't
>>> realy want usb_detect_quirks() to reference UVC-specific structs...
>>> which brings us back to the original laundry list approach of naming
>>> several affected webcams explicitly, no?
>>
>> Why wouldn't I want usb_detect_quirks() to reference UVC-specific
>> structs?
> 
> Well, it's a layering violation.  Not to mention a duplication of code.
> 
> But if the alternative is to list every buggy webcam made by Logitech, 
> it might be worthwhile.

So... now what, then?  Who decides which is the better of two evils:
obvious code duplication vs. layering violation?  FWIW, it does seem
like the number of Logitech webcams which aren't USB_CLASS_VIDEO is
finite, including only older webcams, so perhaps listing "every buggy
webcam made by Logitech" in two places (one in UVC code, one in USB core
code) is not an invitation for long-term code maintenance nightmares.

Eric
--
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] From 2.6.39-rc1 onward, the Logitech Quickcam Fusion webcam (046d:08c1) stops

2012-07-12 Thread Oleksij Rempel
Am 12.07.2012 10:05, schrieb Eric Ding:
> On 07/09/2012 10:17 PM, Alan Stern wrote:
>> On Sun, 8 Jul 2012, Jonathan Nieder wrote:
>>
>>> Eric Ding wrote:
>>>
 So it looks like you'd have to both look for USB_CLASS_VIDEO and check
 uvc_ids[] too... which becomes somewhat hairy, since I assume you don't
 realy want usb_detect_quirks() to reference UVC-specific structs...
 which brings us back to the original laundry list approach of naming
 several affected webcams explicitly, no?
>>>
>>> Why wouldn't I want usb_detect_quirks() to reference UVC-specific
>>> structs?
>>
>> Well, it's a layering violation.  Not to mention a duplication of code.
>>
>> But if the alternative is to list every buggy webcam made by Logitech, 
>> it might be worthwhile.
> 
> So... now what, then?  Who decides which is the better of two evils:
> obvious code duplication vs. layering violation?  FWIW, it does seem
> like the number of Logitech webcams which aren't USB_CLASS_VIDEO is
> finite, including only older webcams, so perhaps listing "every buggy
> webcam made by Logitech" in two places (one in UVC code, one in USB core
> code) is not an invitation for long-term code maintenance nightmares.
> 
> Eric
> 

according to device list here:
http://www.ideasonboard.org/uvc/
we can safely use range of usb ids
plus combine information from here:
https://usb-ids.gowdy.us/read/UD/046d

it looks like we can use range from 0800 - 9ff, but it will include some
usb microphones. I do not know if they are affected too.

-- 
Regards,
Oleksij


--
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] From 2.6.39-rc1 onward, the Logitech Quickcam Fusion webcam (046d:08c1) stops

2012-07-12 Thread Eric Ding
On 07/12/2012 04:21 PM, Oleksij Rempel wrote:
>> On 07/09/2012 10:17 PM, Alan Stern wrote:
>>> On Sun, 8 Jul 2012, Jonathan Nieder wrote:
>>>
 Eric Ding wrote:

> So it looks like you'd have to both look for USB_CLASS_VIDEO and check
> uvc_ids[] too... which becomes somewhat hairy, since I assume you don't
> realy want usb_detect_quirks() to reference UVC-specific structs...
> which brings us back to the original laundry list approach of naming
> several affected webcams explicitly, no?

 Why wouldn't I want usb_detect_quirks() to reference UVC-specific
 structs?
>>>
>>> Well, it's a layering violation.  Not to mention a duplication of code.
>>>
>>> But if the alternative is to list every buggy webcam made by Logitech, 
>>> it might be worthwhile.

> according to device list here:
> http://www.ideasonboard.org/uvc/
> we can safely use range of usb ids
> plus combine information from here:
> https://usb-ids.gowdy.us/read/UD/046d
> 
> it looks like we can use range from 0800 - 9ff, but it will include some
> usb microphones. I do not know if they are affected too.

I think the microphones in that range are actually associated with
webcams, so they may actually be safe to include.  However, many of
those listed at gowdy.us in that range are pre-UVC gspca-supported
webcams, not UVC webcams, and there appears to be at least one webcam
outsude of that range (d001 - QuickCam Pro, also gspca).

Eric


--
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: host: tegra: pass correct pointer in ehci_setup()

2012-07-12 Thread Laxman Dewangan
The ehci_setup() require the pointer of usb_hcd.
Passing the correct pointer in place of ehci_hcd
pointer.

This is side effetct of change:
commit 1a49e2ac9651df7349867a5cf44e2c83de1046af
Author: Alan Stern 

EHCI: centralize controller initialization


Signed-off-by: Laxman Dewangan 
---
 drivers/usb/host/ehci-tegra.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
index 9e44b1f..d2a7c95 100644
--- a/drivers/usb/host/ehci-tegra.c
+++ b/drivers/usb/host/ehci-tegra.c
@@ -285,7 +285,7 @@ static int tegra_ehci_setup(struct usb_hcd *hcd)
/* switch to host mode */
hcd->has_tt = 1;
 
-   retval = ehci_setup(ehci);
+   retval = ehci_setup(hcd);
if (retval)
return retval;
 
-- 
1.7.1.1

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


RE: [PATCH v2 1/3] arm: omap: hwmod: add new memory resource for usb phy control

2012-07-12 Thread Santhapuri, Damodar

Hi,
> 
> Hello.
> 
> On 11-07-2012 14:29, Damodar Santhapuri wrote:
> 
> > From: Ajay Kumar Gupta 
> 
> > Added usb_ctrl0 and usb_ctrl1 base address as new memory resources
> > which will be used at am335x musb driver glue layer to turn on or
> > off builin PHY untill we have a separate system control module
> > driver.
> 
> > Signed-off-by: Ajay Kumar Gupta 
> > Singed-off-by: Damodar Santhapuri 
> > ---
> > Changes from v0:
> > Reordered the layout based on Kishon's comment on not using
> > platform_get_resources_by_name.
> 
> >   arch/arm/mach-omap2/omap_hwmod_33xx_data.c |   12 
> >   1 files changed, 12 insertions(+), 0 deletions(-)
> 
> > diff --git a/arch/arm/mach-omap2/omap_hwmod_33xx_data.c b/arch/arm/mach-
> omap2/omap_hwmod_33xx_data.c
> > index df888fe..ec9e9df 100644
> > --- a/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
> > +++ b/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
> > @@ -3269,11 +3269,23 @@ static struct omap_hwmod_addr_space
> am33xx_usbss_addr_space[] = {
> > .flags  = ADDR_TYPE_RT
> > },
> > {
> > +   .name   = "usb_ctrl0",
> > +   .pa_start   = 0x44E10620,
> > +   .pa_end = 0x44E10624,
> 
>Not 0x44E10623?
> 
> > +   .flags  = ADDR_TYPE_RT
> > +   },
> > +   {
> > .name   = "musb1",
> > .pa_start   = 0x47401800,
> > .pa_end = 0x47401800 + SZ_2K - 1,
> > .flags  = ADDR_TYPE_RT
> > },
> > +   {
> > +   .name   = "usb_ctrl1",
> > +   .pa_start   = 0x44E10628,
> > +   .pa_end = 0x44E1062c,
> 
> Not 0x44E1062B?

I will fix this and send you updated patch.

Damodar .
> 
> WBR, Sergei
--
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: NULL pointer dereference in at91_udc on start of connection

2012-07-12 Thread Fabio Porcedda
> -Original Message-
> From: Sebastian Andrzej Siewior [mailto:sebast...@breakpoint.cc]
> Sent: terça-feira, 10 de Julho de 2012 16:37
> To: Mario Jorge Isidoro
> Cc: Fabio Porcedda; Sebastian Andrzej Siewior; ba...@ti.com; 
> gre...@linuxfoundation.org; linux-usb@vger.kernel.org; Nicolas Ferre; Ido 
> Shayevitz; Jean-Christophe PLAGNIOL-VILLARD
> Subject: Re: NULL pointer dereference in at91_udc on start of connection
>
> On Tue, Jul 10, 2012 at 03:54:06PM +0100, Mario Jorge Isidoro wrote:
>> I've found that the following change also works, if someone doesn't want to 
>> simply eliminate the check
>> diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c
>> index 7687ccd..33a6999 100644
>> --- a/drivers/usb/gadget/at91_udc.c
>> +++ b/drivers/usb/gadget/at91_udc.c
>> @@ -475,7 +475,7 @@ static int at91_ep_enable(struct usb_ep *_ep,
>> unsigned long   flags;
>>
>> if (!_ep || !ep
>> -   || !desc || ep->ep.desc
>> +   || !desc || !ep->ep.desc
>
> This check ensures that you do not try to enable an endpoint twice. Once
> enabled, ep->ep.desc should be set.
>
>> || _ep->name == ep0name
> ep.desc is always NULL for ep0 and this one should not be enabled. Therefore
> you have this check here.
>
>> || desc->bDescriptorType != USB_DT_ENDPOINT
>> || (maxpacket = usb_endpoint_maxp(desc)) == 0
>
> That means with this change you should not get any endpoints enabled and it
> should not work at all. Can you acknowledge this?
After removing the check
  || ep->ep.desc
the driver seems to work fine.
I was able to successfully transfer a file using the tftp protocol.

I try to summarize the results:


1) first case - latest HEAD without any modifications (v3.5-rc6-117-g918227b)
when i connect the usb gadget cable i got:

Unable to handle kernel paging request at virtual address 206d6365
pgd = c3ac8000
[206d6365] *pgd=
Internal error: Oops: 1 [#1] ARM
Modules linked in:
CPU: 0Not tainted  (3.5.0-rc6+ #20)
PC is at __dev_printk+0x20/0x198
LR is at dev_printk+0x2c/0x3c
pc : []lr : []psr: 2093
sp : c0365de0  ip : c0309a0c  fp : 0001
r10: c0374c78  r9 : c038b900  r8 : c0365e9c
r7 : c02e83c0  r6 : 0005  r5 : c03877d8  r4 : c03098fc
r3 : 206d6365  r2 : c0365e9c  r1 : c03098fc  r0 : c02e83c0
Flags: nzCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
Control: 0005317f  Table: 23ac8000  DAC: 0017
Process swapper (pid: 0, stack limit = 0xc0364270)
Stack: (0xc0365de0 to 0xc0366000)
5de0:  0001 c036c070 c03908d8 00e6  c038c230 00c9
5e00: c03908d8 0007 c03908d8 c001f130 0400 0010 00c9 
5e20: 2093 0001 c038c230 000b c038c230 c037265c 0006 0007
5e40:    c001f4e8    
5e60: c038cb3b 000b c004b15c 6093  c0387ae4 c03877d8 0005
5e80: 4093  c038b900 c0374c78 0001 c017ad90 c038b900 c0309a0c
5ea0: c0365ea4 c0365eb4 c03877d8 c01e0cdc c0309a0c c01e0cb4 c03877d8 0100
5ec0: 0005 c01ded98  0001 0001  0065 c038b900
5ee0: c0377448 c396f6e0 000a   000a c038b900 c0374c78
5f00: 0001 c0054c1c 41069265 2035cc2c  c0374c78 000a 
5f20: c0365f94 20004000 41069265 2035cc2c  c0054dc0 c0374c78 c0056ee8
5f40: c037bde0 c0054598 00c0 c000fe0c c000ff64 a013 fefff000 c000ebb8
5f60:  0005317f 0005217f a013 c0364000 c038ba48 c036ebbc c000ff40
5f80: 20004000 41069265 2035cc2c  a0d3 c0365fa8 c000ff58 c000ff64
5fa0: a013  6093 c001012c  c036c0a0 c038b9a0 c035e304
5fc0: c0422320 c034271c   c0342278   c035e304
5fe0:  00053175 c036c01c c035e300 c036ebb4 20008040  
[] (__dev_printk+0x20/0x198) from [] (dev_printk+0x2c/0x3c)
[] (dev_printk+0x2c/0x3c) from []
(composite_suspend+0x28/0xc8)
[] (composite_suspend+0x28/0xc8) from []
(at91_udc_irq+0xbc/0x878)
[] (at91_udc_irq+0xbc/0x878) from []
(handle_irq_event_percpu+0x50/0x1cc)
[] (handle_irq_event_percpu+0x50/0x1cc) from []
(handle_irq_event+0x28/0x38)
[] (handle_irq_event+0x28/0x38) from []
(handle_level_irq+0x80/0xdc)
[] (handle_level_irq+0x80/0xdc) from []
(generic_handle_irq+0x28/0x3c)
[] (generic_handle_irq+0x28/0x3c) from []
(handle_IRQ+0x30/0x98)
[] (handle_IRQ+0x30/0x98) from [] (__irq_svc+0x38/0x60)
[] (__irq_svc+0x38/0x60) from [] (default_idle+0x24/0x40)
[] (default_idle+0x24/0x40) from [] (cpu_idle+0x8c/0xcc)
[] (cpu_idle+0x8c/0xcc) from [] (start_kernel+0x280/0x2d0)
Code: e1a08002 0a4f e59430c0 e353 (15936000)
---[ end trace d80a9f0f67ad16c0 ]---
Kernel panic - not syncing: Fatal exception in interrupt

2) second case - reverting the latest three commits on the at91_udc.c,
git revert 5eaee54b1c52a83dc74445792cf49900a8050da8
f3d8bf34c2c925867322197096e

Re: [PATCH] usb: host: tegra: pass correct pointer in ehci_setup()

2012-07-12 Thread Venu Byravarasu

Acked-by: Venu Byravarasu 
Tested-by: Venu Byravarasu 

On Thursday 12 July 2012 02:06 PM, Laxman Dewangan wrote:

The ehci_setup() require the pointer of usb_hcd.
Passing the correct pointer in place of ehci_hcd
pointer.

This is side effetct of change:
commit 1a49e2ac9651df7349867a5cf44e2c83de1046af
Author: Alan Stern 

 EHCI: centralize controller initialization


Signed-off-by: Laxman Dewangan 
---
  drivers/usb/host/ehci-tegra.c |2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
index 9e44b1f..d2a7c95 100644
--- a/drivers/usb/host/ehci-tegra.c
+++ b/drivers/usb/host/ehci-tegra.c
@@ -285,7 +285,7 @@ static int tegra_ehci_setup(struct usb_hcd *hcd)
/* switch to host mode */
hcd->has_tt = 1;
  
-	retval = ehci_setup(ehci);

+   retval = ehci_setup(hcd);
if (retval)
return retval;
  



--
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: infos about device ZTE MF821D 2G,3G,4G/LTE usb-modem/networkcard

2012-07-12 Thread Thomas Schäfer
Bjørn Mork wrote:

>   USB: option: add ZTE MF821D
>   net: qmi_wwan: add ZTE MF821D
> 
>  drivers/net/usb/qmi_wwan.c  |9 +
>  drivers/usb/serial/option.c |2 ++
>  2 files changed, 11 insertions(+)

They work well. Thanks o lot to all people involved, especially Bjørn!

[ 1530.917135] usb 1-1: new high-speed USB device number 3 using ehci_hcd
[ 1531.034685] usb 1-1: New USB device found, idVendor=19d2, idProduct=0325
[ 1531.034695] usb 1-1: New USB device strings: Mfr=3, Product=2, 
SerialNumber=4
[ 1531.034701] usb 1-1: Product: ZTE LTE Technologies MSM
[ 1531.034706] usb 1-1: Manufacturer: ZTE,Corporated
[ 1531.034711] usb 1-1: SerialNumber: MF821DO2_S02
[ 1531.096945] usbcore: registered new interface driver uas
[ 1531.114594] Initializing USB Mass Storage driver...
[ 1531.116656] scsi4 : usb-storage 1-1:1.0
[ 1531.116979] usbcore: registered new interface driver usb-storage
[ 1531.116986] USB Mass Storage support registered.
[ 1534.226808] usb 1-1: USB disconnect, device number 3
[ 1538.457120] usb 1-1: new high-speed USB device number 4 using ehci_hcd
[ 1538.574927] usb 1-1: New USB device found, idVendor=19d2, idProduct=0326
[ 1538.574942] usb 1-1: New USB device strings: Mfr=3, Product=2, 
SerialNumber=4
[ 1538.574952] usb 1-1: Product: ZTE LTE Technologies MSM
[ 1538.574960] usb 1-1: Manufacturer: ZTE,Corporated
[ 1538.574969] usb 1-1: SerialNumber: MF821DO2_S02
[ 1538.581337] scsi5 : usb-storage 1-1:1.5
[ 1538.631291] usbcore: registered new interface driver cdc_wdm
[ 1538.651999] qmi_wwan 1-1:1.0: not on our whitelist - ignored
[ 1538.652495] qmi_wwan 1-1:1.1: not on our whitelist - ignored
[ 1538.652636] qmi_wwan 1-1:1.2: not on our whitelist - ignored
[ 1538.652692] qmi_wwan 1-1:1.3: not on our whitelist - ignored
[ 1538.655984] qmi_wwan 1-1:1.4: cdc-wdm0: USB WDM device
[ 1538.657758] qmi_wwan 1-1:1.4: wwan0: register 'qmi_wwan' at 
usb-:00:1d.7-1, Qualcomm WWAN/QMI device, 6a:db:1d:22:bf:43
[ 1538.659236] usbcore: registered new interface driver qmi_wwan
[ 1538.674903] usbcore: registered new interface driver usbserial
[ 1538.675590] usbcore: registered new interface driver usbserial_generic
[ 1538.677078] USB Serial support registered for generic
[ 1538.677108] usbserial: USB Serial Driver core
[ 1538.692508] usbcore: registered new interface driver option
[ 1538.692571] USB Serial support registered for GSM modem (1-port)
[ 1538.693895] option 1-1:1.0: GSM modem (1-port) converter detected
[ 1538.694308] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB0
[ 1538.694446] option 1-1:1.1: GSM modem (1-port) converter detected
[ 1538.694734] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB1
[ 1538.694873] option 1-1:1.2: GSM modem (1-port) converter detected
[ 1538.695192] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB2
[ 1538.695328] option 1-1:1.3: GSM modem (1-port) converter detected
[ 1538.695643] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB3
[ 1539.586039] scsi 5:0:0:0: Direct-Access ZTE  MMC Storage  2.31 
PQ: 0 ANSI: 0
[ 1539.587142] sd 5:0:0:0: Attached scsi generic sg1 type 0
[ 1539.596767] sd 5:0:0:0: [sdb] Attached SCSI removable disk

some qmi-infos:

[/dev/cdc-wdm0] Device capabilities retrieved:
Max TX channel rate: '5000'
Max RX channel rate: '1'
   Data Service: 'simultaneous-cs-ps'
SIM: 'supported'
   Networks: 'gsm, umts, lte'


[/dev/cdc-wdm0] Device IDs retrieved:
 ESN: '0'
IMEI: '861311010022209'
MEID: 'unknown'


[/dev/cdc-wdm0] Device revision retrieved:
Revision: 'M9200B-SCAQDBZD-3.3.330115T  1  [May 06 2012 03:00:00]'


IPv4 (dhcp)
IPV6 (SLAAC)
(tested only in IPv4only and IPv6only, without true dualstack)

works also as expected and in the same way as the huawei E398/Vodafone K5005.


Regards,

Thomas Schäfer


--
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/11] usb: musb: dsps: remove explicit NOP device creation

2012-07-12 Thread Ajay Kumar Gupta
As NOP device node is now added in am33xx tree so remove the call
which creates the NOP platform_device.

Signed-off-by: Ajay Kumar Gupta 
---
 drivers/usb/musb/musb_dsps.c |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index 619c800..36e2969 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -425,8 +425,7 @@ static int dsps_musb_init(struct musb *musb)
/* mentor core register starts at offset of 0x400 from musb base */
musb->mregs += wrp->musb_core_offset;
 
-   /* Register NOP driver */
-   usb_nop_xceiv_register(musb->id);
+   /* Get the NOP PHY */
musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
if (IS_ERR_OR_NULL(musb->xceiv))
return -ENODEV;
-- 
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 08/11] arm/dts: am33xx: add dt data for usb nop phy

2012-07-12 Thread Ajay Kumar Gupta
AM33xx has two musb controller and they have one NOP PHY each.
Added the device tree data for NOP PHY.

Signed-off-by: Ajay Kumar Gupta 
---
 arch/arm/boot/dts/am33xx.dtsi |8 
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
index b572803..3bd9911 100644
--- a/arch/arm/boot/dts/am33xx.dtsi
+++ b/arch/arm/boot/dts/am33xx.dtsi
@@ -155,6 +155,14 @@
ti,hwmods = "i2c3";
};
 
+   usb0_phy: phy@1 {
+   compatible = "ti,nop-xceiv-usb";
+   };
+
+   usb1_phy: phy@2 {
+   compatible = "ti,nop-xceiv-usb";
+   };
+
usb_otg_hs: usb_otg_hs@4740 {
compatible = "ti,musb-am33xx";
ti,hwmods = "usb_otg_hs";
-- 
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 03/11] usb: musb: am335x: add support for dual instance

2012-07-12 Thread Ajay Kumar Gupta
AM335x and TI81xx platform has dual musb controller so updating the
musb_dspc.c to support the same.

Changes:
- Moved otg_workaround timer to glue structure
- Moved static local variable last_timer to glue structure
- PHY on/off related cleanups

Signed-off-by: Ajay Kumar Gupta 
---
 drivers/usb/musb/musb_dsps.c |   92 ++
 1 files changed, 57 insertions(+), 35 deletions(-)

diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index 71fbe0e..e76b4d8 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -105,6 +105,8 @@ struct dsps_musb_wrapper {
/* miscellaneous stuff */
u32 musb_core_offset;
u8  poll_seconds;
+   /* number of musb instances */
+   u8  instances;
 };
 
 /**
@@ -112,16 +114,18 @@ struct dsps_musb_wrapper {
  */
 struct dsps_glue {
struct device *dev;
-   struct platform_device *musb;   /* child musb pdev */
+   struct platform_device *musb[2];/* child musb pdev */
const struct dsps_musb_wrapper *wrp; /* wrapper register offsets */
-   struct timer_list timer;/* otg_workaround timer */
-   u32 __iomem *usb_ctrl;
+   struct timer_list timer[2]; /* otg_workaround timer */
+   unsigned long last_timer[2];/* last timer data for each instance */
+   u32 __iomem *usb_ctrl[2];
u8  usbss_rev;
 };
 
 /**
  * musb_dsps_phy_control - phy on/off
  * @glue: struct dsps_glue *
+ * @id: musb instance
  * @on: flag for phy to be switched on or off
  *
  * This is to enable the PHY using usb_ctrl register in system control
@@ -130,11 +134,11 @@ struct dsps_glue {
  * XXX: This function will be removed once we have a seperate driver for
  * control module
  */
-static void musb_dsps_phy_control(struct dsps_glue *glue, u8 on)
+static void musb_dsps_phy_control(struct dsps_glue *glue, u8 id, u8 on)
 {
u32 usbphycfg;
 
-   usbphycfg = __raw_readl(glue->usb_ctrl);
+   usbphycfg = __raw_readl(glue->usb_ctrl[id]);
 
if (on) {
if (glue->usbss_rev == MUSB_USBSS_REV_816X) {
@@ -157,7 +161,7 @@ static void musb_dsps_phy_control(struct dsps_glue *glue, 
u8 on)
glue->usbss_rev == MUSB_USBSS_REV_33XX)
usbphycfg |= USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN;
}
-   __raw_writel(usbphycfg, glue->usb_ctrl);
+   __raw_writel(usbphycfg, glue->usb_ctrl[id]);
 }
 /**
  * dsps_musb_enable - enable interrupts
@@ -247,7 +251,7 @@ static void otg_timer(unsigned long _musb)
 
devctl = dsps_readb(mregs, MUSB_DEVCTL);
if (devctl & MUSB_DEVCTL_BDEVICE)
-   mod_timer(&glue->timer,
+   mod_timer(&glue->timer[musb->id],
jiffies + wrp->poll_seconds * HZ);
else
musb->xceiv->state = OTG_STATE_A_IDLE;
@@ -263,7 +267,6 @@ static void dsps_musb_try_idle(struct musb *musb, unsigned 
long timeout)
struct device *dev = musb->controller;
struct platform_device *pdev = to_platform_device(dev->parent);
struct dsps_glue *glue = platform_get_drvdata(pdev);
-   static unsigned long last_timer;
 
if (!is_otg_enabled(musb))
return;
@@ -276,22 +279,23 @@ static void dsps_musb_try_idle(struct musb *musb, 
unsigned long timeout)
musb->xceiv->state == OTG_STATE_A_WAIT_BCON)) {
dev_dbg(musb->controller, "%s active, deleting timer\n",
otg_state_string(musb->xceiv->state));
-   del_timer(&glue->timer);
-   last_timer = jiffies;
+   del_timer(&glue->timer[musb->id]);
+   glue->last_timer[musb->id] = jiffies;
return;
}
 
-   if (time_after(last_timer, timeout) && timer_pending(&glue->timer)) {
+   if (time_after(glue->last_timer[musb->id], timeout) &&
+   timer_pending(&glue->timer[musb->id])) {
dev_dbg(musb->controller,
"Longer idle timer already pending, ignoring...\n");
return;
}
-   last_timer = timeout;
+   glue->last_timer[musb->id] = timeout;
 
dev_dbg(musb->controller, "%s inactive, starting idle timer for %u 
ms\n",
otg_state_string(musb->xceiv->state),
jiffies_to_msecs(timeout - jiffies));
-   mod_timer(&glue->timer, timeout);
+   mod_timer(&glue->timer[musb->id], timeout);
 }
 
 static irqreturn_t dsps_interrupt(int irq, void *hci)
@@ -360,7 +364,7 @@ static irqreturn_t dsps_interrupt(int irq, void *hci)
 */
musb->int_usb &= ~MUSB_INTR_VBUSERROR;
musb->xceiv->state = OTG_STATE_A_WAIT_VFALL;
-   mod_t

[PATCH 04/11] usb: otg: nop: add support for multiple tranceiver

2012-07-12 Thread Ajay Kumar Gupta
Currently we have one single nop transceiver support as same is
defined as a global variable in drivers/usb/otg/nop-usb-xceiv.c.
This need to be changed to support multiple otg controller each
using nop transceiver on a platform such as am335x.

Signed-off-by: Ajay Kumar Gupta 
---
 arch/arm/mach-omap2/board-omap3evm.c |2 +-
 drivers/usb/musb/am35x.c |4 ++--
 drivers/usb/musb/blackfin.c  |4 ++--
 drivers/usb/musb/da8xx.c |4 ++--
 drivers/usb/musb/davinci.c   |6 +++---
 drivers/usb/musb/musb_dsps.c |   10 +-
 drivers/usb/musb/tusb6010.c  |6 +++---
 drivers/usb/otg/nop-usb-xceiv.c  |   20 
 include/linux/usb/otg.h  |9 +
 9 files changed, 35 insertions(+), 30 deletions(-)

diff --git a/arch/arm/mach-omap2/board-omap3evm.c 
b/arch/arm/mach-omap2/board-omap3evm.c
index ef230a0..a3393bc 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -704,7 +704,7 @@ static void __init omap3_evm_init(void)
omap_sdrc_init(mt46h32m32lf6_sdrc_params, NULL);
 
/* OMAP3EVM uses ISP1504 phy and so register nop transceiver */
-   usb_nop_xceiv_register();
+   usb_nop_xceiv_register(0);
 
if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2) {
/* enable EHCI VBUS using GPIO22 */
diff --git a/drivers/usb/musb/am35x.c b/drivers/usb/musb/am35x.c
index cc0f06a..8762859 100644
--- a/drivers/usb/musb/am35x.c
+++ b/drivers/usb/musb/am35x.c
@@ -364,7 +364,7 @@ static int am35x_musb_init(struct musb *musb)
if (!rev)
return -ENODEV;
 
-   usb_nop_xceiv_register();
+   usb_nop_xceiv_register(musb->id);
musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
if (IS_ERR_OR_NULL(musb->xceiv))
return -ENODEV;
@@ -408,7 +408,7 @@ static int am35x_musb_exit(struct musb *musb)
data->set_phy_power(0);
 
usb_put_phy(musb->xceiv);
-   usb_nop_xceiv_unregister();
+   usb_nop_xceiv_unregister(musb->xceiv);
 
return 0;
 }
diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c
index c217781..e33838e 100644
--- a/drivers/usb/musb/blackfin.c
+++ b/drivers/usb/musb/blackfin.c
@@ -415,7 +415,7 @@ static int bfin_musb_init(struct musb *musb)
}
gpio_direction_output(musb->config->gpio_vrsel, 0);
 
-   usb_nop_xceiv_register();
+   usb_nop_xceiv_register(musb->id);
musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
if (IS_ERR_OR_NULL(musb->xceiv)) {
gpio_free(musb->config->gpio_vrsel);
@@ -442,7 +442,7 @@ static int bfin_musb_exit(struct musb *musb)
gpio_free(musb->config->gpio_vrsel);
 
usb_put_phy(musb->xceiv);
-   usb_nop_xceiv_unregister();
+   usb_nop_xceiv_unregister(musb->xceiv);
return 0;
 }
 
diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c
index 3f072a0..93dee98 100644
--- a/drivers/usb/musb/da8xx.c
+++ b/drivers/usb/musb/da8xx.c
@@ -425,7 +425,7 @@ static int da8xx_musb_init(struct musb *musb)
if (!rev)
goto fail;
 
-   usb_nop_xceiv_register();
+   usb_nop_xceiv_register(musb->id);
musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
if (IS_ERR_OR_NULL(musb->xceiv))
goto fail;
@@ -460,7 +460,7 @@ static int da8xx_musb_exit(struct musb *musb)
phy_off();
 
usb_put_phy(musb->xceiv);
-   usb_nop_xceiv_unregister();
+   usb_nop_xceiv_unregister(musb->xceiv);
 
return 0;
 }
diff --git a/drivers/usb/musb/davinci.c b/drivers/usb/musb/davinci.c
index b1f3fb0..221348b 100644
--- a/drivers/usb/musb/davinci.c
+++ b/drivers/usb/musb/davinci.c
@@ -385,7 +385,7 @@ static int davinci_musb_init(struct musb *musb)
void __iomem*tibase = musb->ctrl_base;
u32 revision;
 
-   usb_nop_xceiv_register();
+   usb_nop_xceiv_register(musb->id);
musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
if (IS_ERR_OR_NULL(musb->xceiv))
goto unregister;
@@ -447,7 +447,7 @@ static int davinci_musb_init(struct musb *musb)
 fail:
usb_put_phy(musb->xceiv);
 unregister:
-   usb_nop_xceiv_unregister();
+   usb_nop_xceiv_unregister(musb->xceiv);
return -ENODEV;
 }
 
@@ -496,7 +496,7 @@ static int davinci_musb_exit(struct musb *musb)
phy_off();
 
usb_put_phy(musb->xceiv);
-   usb_nop_xceiv_unregister();
+   usb_nop_xceiv_unregister(musb->xceiv);
 
return 0;
 }
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index e76b4d8..17efd3d 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -420,8 +420,8 @@ static int dsps_musb_init(struct musb *musb)
/* mentor core register starts at offset of 0x400 from musb base */
musb->mregs += wrp->musb_core_offset;
 
-   /* NOP driver needs change if supporting du

[PATCH 05/11] usb: musb: dsps: add dt support

2012-07-12 Thread Ajay Kumar Gupta
Added device tree support for dsps musb glue driver and updated the
Documentation with device tree binding information.

Signed-off-by: Ajay Kumar Gupta 
---
 .../devicetree/bindings/usb/am33xx-usb.txt |   14 +
 drivers/usb/musb/musb_dsps.c   |   62 +---
 2 files changed, 67 insertions(+), 9 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/usb/am33xx-usb.txt

diff --git a/Documentation/devicetree/bindings/usb/am33xx-usb.txt 
b/Documentation/devicetree/bindings/usb/am33xx-usb.txt
new file mode 100644
index 000..ca8fa56
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/am33xx-usb.txt
@@ -0,0 +1,14 @@
+AM33XX MUSB GLUE
+ - compatible : Should be "ti,musb-am33xx"
+ - ti,hwmods : must be "usb_otg_hs"
+ - multipoint : Should be "1" indicating the musb controller supports
+   multipoint. This is a MUSB configuration-specific setting.
+ - num_eps : Specifies the number of endpoints. This is also a
+   MUSB configuration-specific setting. Should be set to "16"
+ - ram_bits : Specifies the ram address size. Should be set to "12"
+ - port0_mode : Should be "3" to represent OTG. "1" signifies HOST and "2"
+   represents PERIPHERAL.
+ - port1_mode : Should be "1" to represent HOST. "3" signifies OTG and "2"
+   represents PERIPHERAL.
+ - power : Should be "250". This signifies the controller can supply upto
+   500mA when operating in host mode.
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index 17efd3d..619c800 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -31,6 +31,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -45,6 +46,10 @@
 
 #include "musb_core.h"
 
+#ifdef CONFIG_OF
+static const struct of_device_id musb_dsps_of_match[];
+#endif
+
 /**
  * avoid using musb_readx()/musb_writex() as glue layer should not be
  * dependent on musb core layer symbols.
@@ -496,6 +501,8 @@ static int __devinit dsps_create_musb_pdev(struct dsps_glue 
*glue, u8 id)
struct device *dev = glue->dev;
struct platform_device *pdev = to_platform_device(dev);
struct musb_hdrc_platform_data  *pdata = dev->platform_data;
+   struct device_node *np = pdev->dev.of_node;
+   struct musb_hdrc_config *config;
struct platform_device  *musb;
struct resource *res;
struct resource resources[2];
@@ -555,14 +562,40 @@ static int __devinit dsps_create_musb_pdev(struct 
dsps_glue *glue, u8 id)
 
glue->musb[id]  = musb;
 
-   pdata->platform_ops = &dsps_ops;
-
ret = platform_device_add_resources(musb, resources, 2);
if (ret) {
dev_err(dev, "failed to add resources\n");
goto err1;
}
 
+   if (np) {
+   pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
+   if (!pdata) {
+   dev_err(&pdev->dev,
+   "failed to allocate musb platfrom data\n");
+   ret = -ENOMEM;
+   goto err1;
+   }
+
+   config = devm_kzalloc(&pdev->dev, sizeof(*config), GFP_KERNEL);
+   if (!config) {
+   dev_err(&pdev->dev,
+   "failed to allocate musb hdrc config\n");
+   goto err1;
+   }
+
+   of_property_read_u32(np, "num_eps", (u32 *)&config->num_eps);
+   of_property_read_u32(np, "ram_bits", (u32 *)&config->ram_bits);
+   sprintf(res_name, "port%d_mode", id);
+   of_property_read_u32(np, res_name, (u32 *)&pdata->mode);
+   of_property_read_u32(np, "power", (u32 *)&pdata->power);
+   config->multipoint = of_property_read_bool(np, "multipoint");
+
+   pdata->config   = config;
+   }
+
+   pdata->platform_ops = &dsps_ops;
+
ret = platform_device_add_data(musb, pdata, sizeof(*pdata));
if (ret) {
dev_err(dev, "failed to add platform_data\n");
@@ -591,14 +624,22 @@ static void __devexit dsps_delete_musb_pdev(struct 
dsps_glue *glue, u8 id)
 
 static int __devinit dsps_probe(struct platform_device *pdev)
 {
-   const struct platform_device_id *id = platform_get_device_id(pdev);
-   const struct dsps_musb_wrapper *wrp =
-   (struct dsps_musb_wrapper *)id->driver_data;
+   struct device_node *np = pdev->dev.of_node;
+   const struct of_device_id *match;
+   const struct dsps_musb_wrapper *wrp;
struct dsps_glue *glue;
struct resource *iomem;
u32 __iomem *usbss;
int ret, i;
 
+   match = of_match_node(musb_dsps_of_match, np);
+   if (!match) {
+   dev_err(&pdev->dev, "fail to get matching of_match struct\n");
+   ret = -EINVAL;
+   goto err0;
+   }
+   wrp = match->data;
+
   

[PATCH 01/11] usb: musb: add musb->id to identify core instance

2012-07-12 Thread Ajay Kumar Gupta
Added 'id' field within 'struct musb' which can be used to determine
the current instance of musb controller.

Signed-off-by: Ajay Kumar Gupta 
---
 drivers/usb/musb/am35x.c |2 +-
 drivers/usb/musb/blackfin.c  |2 +-
 drivers/usb/musb/da8xx.c |2 +-
 drivers/usb/musb/davinci.c   |2 +-
 drivers/usb/musb/musb_core.c |2 ++
 drivers/usb/musb/musb_core.h |2 ++
 drivers/usb/musb/musb_dsps.c |2 +-
 drivers/usb/musb/omap2430.c  |2 +-
 drivers/usb/musb/tusb6010.c  |2 +-
 drivers/usb/musb/ux500.c |2 +-
 10 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/musb/am35x.c b/drivers/usb/musb/am35x.c
index 7a95ab8..cc0f06a 100644
--- a/drivers/usb/musb/am35x.c
+++ b/drivers/usb/musb/am35x.c
@@ -475,7 +475,7 @@ static int __devinit am35x_probe(struct platform_device 
*pdev)
goto err0;
}
 
-   musb = platform_device_alloc("musb-hdrc", -1);
+   musb = platform_device_alloc("musb-hdrc", pdev->id);
if (!musb) {
dev_err(&pdev->dev, "failed to allocate musb device\n");
goto err1;
diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c
index 428e6aa..c217781 100644
--- a/drivers/usb/musb/blackfin.c
+++ b/drivers/usb/musb/blackfin.c
@@ -478,7 +478,7 @@ static int __devinit bfin_probe(struct platform_device 
*pdev)
goto err0;
}
 
-   musb = platform_device_alloc("musb-hdrc", -1);
+   musb = platform_device_alloc("musb-hdrc", pdev->id);
if (!musb) {
dev_err(&pdev->dev, "failed to allocate musb device\n");
goto err1;
diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c
index 0f9fcec..3f072a0 100644
--- a/drivers/usb/musb/da8xx.c
+++ b/drivers/usb/musb/da8xx.c
@@ -496,7 +496,7 @@ static int __devinit da8xx_probe(struct platform_device 
*pdev)
goto err0;
}
 
-   musb = platform_device_alloc("musb-hdrc", -1);
+   musb = platform_device_alloc("musb-hdrc", pdev->id);
if (!musb) {
dev_err(&pdev->dev, "failed to allocate musb device\n");
goto err1;
diff --git a/drivers/usb/musb/davinci.c b/drivers/usb/musb/davinci.c
index 472c8b4..b1f3fb0 100644
--- a/drivers/usb/musb/davinci.c
+++ b/drivers/usb/musb/davinci.c
@@ -530,7 +530,7 @@ static int __devinit davinci_probe(struct platform_device 
*pdev)
goto err0;
}
 
-   musb = platform_device_alloc("musb-hdrc", -1);
+   musb = platform_device_alloc("musb-hdrc", pdev->id);
if (!musb) {
dev_err(&pdev->dev, "failed to allocate musb device\n");
goto err1;
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 89d1871..f6ce66f 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -1867,6 +1867,7 @@ musb_init_controller(struct device *dev, int nIrq, void 
__iomem *ctrl)
int status;
struct musb *musb;
struct musb_hdrc_platform_data *plat = dev->platform_data;
+   struct platform_device *pdev = to_platform_device(dev);
 
/* The driver might handle more features than the board; OK.
 * Fail when the board needs a feature that's not enabled.
@@ -1889,6 +1890,7 @@ musb_init_controller(struct device *dev, int nIrq, void 
__iomem *ctrl)
pm_runtime_enable(musb->controller);
 
spin_lock_init(&musb->lock);
+   musb->id = pdev->id;
musb->board_mode = plat->mode;
musb->board_set_power = plat->set_power;
musb->min_power = plat->min_power;
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h
index 51bd7b2..24daafd 100644
--- a/drivers/usb/musb/musb_core.h
+++ b/drivers/usb/musb/musb_core.h
@@ -450,6 +450,8 @@ struct musb {
 #ifdef MUSB_CONFIG_PROC_FS
struct proc_dir_entry *proc_entry;
 #endif
+   /* id for multiple musb instances */
+   u8  id;
 };
 
 static inline struct musb *gadget_to_musb(struct usb_gadget *g)
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index 46b07cc..71fbe0e 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -535,7 +535,7 @@ static int __devinit dsps_create_musb_pdev(struct dsps_glue 
*glue, u8 id)
resources[1].name = "mc";
 
/* allocate the child platform device */
-   musb = platform_device_alloc("musb-hdrc", -1);
+   musb = platform_device_alloc("musb-hdrc", pdev->id);
if (!musb) {
dev_err(dev, "failed to allocate musb device\n");
ret = -ENOMEM;
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index 5fdb9da..15506a4 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -448,7 +448,7 @@ static int __devinit omap2430_probe(struct platform_device 
*pdev)
goto err0;
}
 
-   musb = platform_device_alloc

[PATCH 00/11] usb: musb: adding multi instance support

2012-07-12 Thread Ajay Kumar Gupta
Hi,

This series of patches adds,
a) Multi instances support in musb driver
b) DT support for musb_dsps glue layer
c) DT support for NOP transceiver

AM33xx and TI81xx has dual musb controller and has two usb PHY of same type.
This patch series uses 'phandle' based API devm_usb_get_phy_by_phandle() to
get the PHY of same type. This API support is being added by Kishon's patch
discussed at [1]

The series applies to linux-omap (master branch)
+ Vaibhav baseport patches on his tree at [3]
+ Kishon's multi phy patches on Felipe's branch 'xceiv'
+ Kishon's patch on phandle at [1]
+ AM33xx musb glue compile and bugfix patches at [4], [5], [6] and [7]
+ Damodar's recent patch at [2] 

and have been tested on Beaglebone board.

1. http://marc.info/?l=linux-usb&m=134070369306112&w=2
2. http://marc.info/?l=linux-usb&m=134200284230689&w=2
3. https://github.com/hvaibhav/am335x-linux/commits/am335x-upstream-staging
4. http://marc.info/?l=linux-usb&m=134131746111637&w=2
5. http://marc.info/?l=linux-usb&m=134131746411639&w=2
6. http://marc.info/?l=linux-usb&m=134062716011251&w=2
7. http://marc.info/?l=linux-usb&m=134061179405213&w=2

Thanks,
Ajay

Ajay Kumar Gupta (11):
  usb: musb: add musb->id to identify core instance
  usb: musb: kill global and static for multi instance
  usb: musb: am335x: add support for dual instance
  usb: otg: nop: add support for multiple tranceiver
  usb: musb: dsps: add dt support
  arm/dts: am33xx: Add dt data for usbss
  usb: otg: nop: add dt support
  arm/dts: am33xx: add dt data for usb nop phy
  usb: musb: dsps: remove explicit NOP device creation
  usb: musb: dsps: get the PHY using phandle api
  arm/dts: am33xx: add phy phandle to usbss

 .../devicetree/bindings/usb/am33xx-usb.txt |   19 +++
 arch/arm/boot/dts/am33xx.dtsi  |   21 +++
 arch/arm/mach-omap2/board-omap3evm.c   |2 +-
 drivers/usb/musb/am35x.c   |6 +-
 drivers/usb/musb/blackfin.c|6 +-
 drivers/usb/musb/da8xx.c   |6 +-
 drivers/usb/musb/davinci.c |8 +-
 drivers/usb/musb/musb_core.c   |   18 +--
 drivers/usb/musb/musb_core.h   |6 +
 drivers/usb/musb/musb_debugfs.c|   14 +-
 drivers/usb/musb/musb_dsps.c   |  169 ++--
 drivers/usb/musb/omap2430.c|2 +-
 drivers/usb/musb/tusb6010.c|8 +-
 drivers/usb/musb/ux500.c   |2 +-
 drivers/usb/otg/nop-usb-xceiv.c|   32 +++-
 include/linux/usb/otg.h|9 +-
 16 files changed, 226 insertions(+), 102 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/usb/am33xx-usb.txt

--
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/11] usb: musb: kill global and static for multi instance

2012-07-12 Thread Ajay Kumar Gupta
Moved global variable "musb_debugfs_root" and static variable
"old_state" to 'struct musb' to help support multi instance of
musb controller as present on AM335x platform.

Also removed the global variable "orig_dma_mask" and filled the
dev->dma_mask with parent device's dma_mask.

Signed-off-by: Ajay Kumar Gupta 
---
Earlier version of this was submitted at
http://marc.info/?l=linux-usb&m=134062715911250&w=2

 drivers/usb/musb/musb_core.c|   16 +++-
 drivers/usb/musb/musb_core.h|4 
 drivers/usb/musb/musb_debugfs.c |   14 --
 3 files changed, 15 insertions(+), 19 deletions(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index f6ce66f..b6389f7 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -1773,10 +1773,9 @@ static const struct attribute_group musb_attr_group = {
 static void musb_irq_work(struct work_struct *data)
 {
struct musb *musb = container_of(data, struct musb, irq_work);
-   static int old_state;
 
-   if (musb->xceiv->state != old_state) {
-   old_state = musb->xceiv->state;
+   if (musb->xceiv->state != musb->xceiv_old_state) {
+   musb->xceiv_old_state = musb->xceiv->state;
sysfs_notify(&musb->controller->kobj, NULL, "mode");
}
 }
@@ -2086,11 +2085,6 @@ fail0:
 /* all implementations (PCI bridge to FPGA, VLYNQ, etc) should just
  * bridge to a platform device; this driver then suffices.
  */
-
-#ifndef CONFIG_MUSB_PIO_ONLY
-static u64 *orig_dma_mask;
-#endif
-
 static int __devinit musb_probe(struct platform_device *pdev)
 {
struct device   *dev = &pdev->dev;
@@ -2109,10 +2103,6 @@ static int __devinit musb_probe(struct platform_device 
*pdev)
return -ENOMEM;
}
 
-#ifndef CONFIG_MUSB_PIO_ONLY
-   /* clobbered by use_dma=n */
-   orig_dma_mask = dev->dma_mask;
-#endif
status = musb_init_controller(dev, irq, base);
if (status < 0)
iounmap(base);
@@ -2137,7 +2127,7 @@ static int __devexit musb_remove(struct platform_device 
*pdev)
iounmap(ctrl_base);
device_init_wakeup(&pdev->dev, 0);
 #ifndef CONFIG_MUSB_PIO_ONLY
-   pdev->dev.dma_mask = orig_dma_mask;
+   pdev->dev.dma_mask = (&dev->dev.parent)->dma_mask;
 #endif
return 0;
 }
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h
index 24daafd..fc8817d 100644
--- a/drivers/usb/musb/musb_core.h
+++ b/drivers/usb/musb/musb_core.h
@@ -452,6 +452,10 @@ struct musb {
 #endif
/* id for multiple musb instances */
u8  id;
+   int xceiv_old_state;
+#ifdef CONFIG_DEBUG_FS
+   struct dentry   *debugfs_root;
+#endif
 };
 
 static inline struct musb *gadget_to_musb(struct usb_gadget *g)
diff --git a/drivers/usb/musb/musb_debugfs.c b/drivers/usb/musb/musb_debugfs.c
index 40a37c9..b1e8f21 100644
--- a/drivers/usb/musb/musb_debugfs.c
+++ b/drivers/usb/musb/musb_debugfs.c
@@ -103,8 +103,6 @@ static const struct musb_register_map musb_regmap[] = {
{  }/* Terminating Entry */
 };
 
-static struct dentry *musb_debugfs_root;
-
 static int musb_regdump_show(struct seq_file *s, void *unused)
 {
struct musb *musb = s->private;
@@ -240,20 +238,24 @@ int __devinit musb_init_debugfs(struct musb *musb)
struct dentry   *root;
struct dentry   *file;
int ret;
+   charname[10];
 
-   root = debugfs_create_dir("musb", NULL);
+   sprintf(name, "musb%d", musb->id);
+   root = debugfs_create_dir(name, NULL);
if (!root) {
ret = -ENOMEM;
goto err0;
}
 
-   file = debugfs_create_file("regdump", S_IRUGO, root, musb,
+   sprintf(name, "regdump%d", musb->id);
+   file = debugfs_create_file(name, S_IRUGO, root, musb,
&musb_regdump_fops);
if (!file) {
ret = -ENOMEM;
goto err1;
}
 
+   sprintf(name, "testmode%d", musb->id);
file = debugfs_create_file("testmode", S_IRUGO | S_IWUSR,
root, musb, &musb_test_mode_fops);
if (!file) {
@@ -261,7 +263,7 @@ int __devinit musb_init_debugfs(struct musb *musb)
goto err1;
}
 
-   musb_debugfs_root = root;
+   musb->debugfs_root = root;
 
return 0;
 
@@ -274,5 +276,5 @@ err0:
 
 void /* __init_or_exit */ musb_exit_debugfs(struct musb *musb)
 {
-   debugfs_remove_recursive(musb_debugfs_root);
+   debugfs_remove_recursive(musb->debugfs_root);
 }
-- 
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 07/11] usb: otg: nop: add dt support

2012-07-12 Thread Ajay Kumar Gupta
Added device tree support for nop transceiver driver and updated the
Documentation with device tree binding information for am33xx platform.

Signed-off-by: Ajay Kumar Gupta 
---
 .../devicetree/bindings/usb/am33xx-usb.txt |3 +++
 drivers/usb/otg/nop-usb-xceiv.c|   12 
 2 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/Documentation/devicetree/bindings/usb/am33xx-usb.txt 
b/Documentation/devicetree/bindings/usb/am33xx-usb.txt
index ca8fa56..a314720 100644
--- a/Documentation/devicetree/bindings/usb/am33xx-usb.txt
+++ b/Documentation/devicetree/bindings/usb/am33xx-usb.txt
@@ -12,3 +12,6 @@ AM33XX MUSB GLUE
represents PERIPHERAL.
  - power : Should be "250". This signifies the controller can supply upto
500mA when operating in host mode.
+
+NOP USB PHY
+ - compatible : Should be "ti,nop-xceiv-usb"
diff --git a/drivers/usb/otg/nop-usb-xceiv.c b/drivers/usb/otg/nop-usb-xceiv.c
index 2e5e889..0bca4d1 100644
--- a/drivers/usb/otg/nop-usb-xceiv.c
+++ b/drivers/usb/otg/nop-usb-xceiv.c
@@ -27,6 +27,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -152,12 +153,23 @@ static int __devexit nop_usb_xceiv_remove(struct 
platform_device *pdev)
return 0;
 }
 
+#ifdef CONFIG_OF
+static const struct of_device_id nop_xceiv_id_table[] = {
+   { .compatible = "ti,nop-xceiv-usb" },
+   {}
+};
+MODULE_DEVICE_TABLE(of, nop_xceiv_id_table);
+#else
+#define nop_xceiv_id_table NULL
+#endif
+
 static struct platform_driver nop_usb_xceiv_driver = {
.probe  = nop_usb_xceiv_probe,
.remove = __devexit_p(nop_usb_xceiv_remove),
.driver = {
.name   = "nop_usb_xceiv",
.owner  = THIS_MODULE,
+   .of_match_table = of_match_ptr(nop_xceiv_id_table),
},
 };
 
-- 
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 10/11] usb: musb: dsps: get the PHY using phandle api

2012-07-12 Thread Ajay Kumar Gupta
AM33xx has two PHY of same type used by each musb controller so
use phandle of phy nodes to get the phy pointer.

Signed-off-by: Ajay Kumar Gupta 
---
 .../devicetree/bindings/usb/am33xx-usb.txt |2 ++
 drivers/usb/musb/musb_dsps.c   |4 +++-
 2 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/Documentation/devicetree/bindings/usb/am33xx-usb.txt 
b/Documentation/devicetree/bindings/usb/am33xx-usb.txt
index a314720..4ed0091 100644
--- a/Documentation/devicetree/bindings/usb/am33xx-usb.txt
+++ b/Documentation/devicetree/bindings/usb/am33xx-usb.txt
@@ -12,6 +12,8 @@ AM33XX MUSB GLUE
represents PERIPHERAL.
  - power : Should be "250". This signifies the controller can supply upto
500mA when operating in host mode.
+ - usb0-phy : phandle for usb0 NOP PHY
+ - usb1-phy : phandle for usb1 NOP PHY
 
 NOP USB PHY
  - compatible : Should be "ti,nop-xceiv-usb"
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index 36e2969..d897460 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -419,6 +419,7 @@ static int dsps_musb_init(struct musb *musb)
struct dsps_glue *glue = platform_get_drvdata(pdev);
const struct dsps_musb_wrapper *wrp = glue->wrp;
void __iomem *reg_base = musb->ctrl_base;
+   char name[10];
u32 rev, val;
int status;
 
@@ -426,7 +427,8 @@ static int dsps_musb_init(struct musb *musb)
musb->mregs += wrp->musb_core_offset;
 
/* Get the NOP PHY */
-   musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
+   sprintf(name, "usb%d-phy", musb->id);
+   musb->xceiv = devm_usb_get_phy_by_phandle(&pdev->dev, name);
if (IS_ERR_OR_NULL(musb->xceiv))
return -ENODEV;
 
-- 
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 11/11] arm/dts: am33xx: add phy phandle to usbss

2012-07-12 Thread Ajay Kumar Gupta
Added NOP PHY phandle to usbss device node as same will be used
to get the phy from otg framework.

Signed-off-by: Ajay Kumar Gupta 
---
 arch/arm/boot/dts/am33xx.dtsi |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
index 3bd9911..0e7 100644
--- a/arch/arm/boot/dts/am33xx.dtsi
+++ b/arch/arm/boot/dts/am33xx.dtsi
@@ -172,6 +172,8 @@
port0_mode = <3>;
port1_mode = <1>;
power = <250>;
+   usb0-phy = <&usb0_phy>;
+   usb1-phy = <&usb1_phy>;
};
};
 };
-- 
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 06/11] arm/dts: am33xx: Add dt data for usbss

2012-07-12 Thread Ajay Kumar Gupta
Added device tree data for usbss on am33xx. There are two musb controllers
on am33xx platform so have port0_mode and port1_mode additional data.

Signed-off-by: Ajay Kumar Gupta 
---
 arch/arm/boot/dts/am33xx.dtsi |   11 +++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
index 59509c4..b572803 100644
--- a/arch/arm/boot/dts/am33xx.dtsi
+++ b/arch/arm/boot/dts/am33xx.dtsi
@@ -154,5 +154,16 @@
#size-cells = <0>;
ti,hwmods = "i2c3";
};
+
+   usb_otg_hs: usb_otg_hs@4740 {
+   compatible = "ti,musb-am33xx";
+   ti,hwmods = "usb_otg_hs";
+   multipoint = <1>;
+   num_eps = <16>;
+   ram_bits = <12>;
+   port0_mode = <3>;
+   port1_mode = <1>;
+   power = <250>;
+   };
};
 };
-- 
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 v3 3/3] usb: musb: dsps: enable phy control for am335x

2012-07-12 Thread Damodar Santhapuri
From: Ajay Kumar Gupta 

Enabled the phy control logic for am335x also based on usbss
revision register.

Signed-off-by: Ajay Kumar Gupta 
Signed-off-by: Damodar Santhapuri 
---
 arch/arm/plat-omap/include/plat/usb.h |1 +
 drivers/usb/musb/musb_dsps.c  |   17 +++--
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/arch/arm/plat-omap/include/plat/usb.h 
b/arch/arm/plat-omap/include/plat/usb.h
index c2aa4ae..6459b10 100644
--- a/arch/arm/plat-omap/include/plat/usb.h
+++ b/arch/arm/plat-omap/include/plat/usb.h
@@ -121,6 +121,7 @@ extern void am35x_set_mode(u8 musb_mode);
 /* TI81XX specific definitions */
 #define MUSB_USBSS_REV_816X0x9
 #define MUSB_USBSS_REV_814X0xb
+#define MUSB_USBSS_REV_33XX0xd
 
 /* TI816X PHY controls bits */
 #define TI816X_USBPHY0_NORMAL_MODE (1 << 0)
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index 72eda64..46b07cc 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -140,16 +140,21 @@ static void musb_dsps_phy_control(struct dsps_glue *glue, 
u8 on)
if (glue->usbss_rev == MUSB_USBSS_REV_816X) {
usbphycfg |= TI816X_USBPHY0_NORMAL_MODE;
usbphycfg &= ~TI816X_USBPHY_REFCLK_OSC;
-   } else if (glue->usbss_rev == MUSB_USBSS_REV_814X) {
-   usbphycfg &= ~(USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN
-   | USBPHY_DPINPUT | USBPHY_DMINPUT);
-   usbphycfg |= (USBPHY_OTGVDET_EN | USBPHY_OTGSESSEND_EN
-   | USBPHY_DPOPBUFCTL | USBPHY_DMOPBUFCTL);
+   } else if (glue->usbss_rev == MUSB_USBSS_REV_814X ||
+   glue->usbss_rev == MUSB_USBSS_REV_33XX) {
+   usbphycfg &= ~(USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN);
+   usbphycfg |= USBPHY_OTGVDET_EN | USBPHY_OTGSESSEND_EN;
+   if (glue->usbss_rev == MUSB_USBSS_REV_814X) {
+   usbphycfg &= ~(USBPHY_DPINPUT | USBPHY_DMINPUT);
+   usbphycfg |= USBPHY_DPOPBUFCTL
+   | USBPHY_DMOPBUFCTL;
+   }
}
} else {
if (glue->usbss_rev == MUSB_USBSS_REV_816X)
usbphycfg &= ~TI816X_USBPHY0_NORMAL_MODE;
-   else if (glue->usbss_rev == MUSB_USBSS_REV_814X)
+   else if (glue->usbss_rev == MUSB_USBSS_REV_814X ||
+   glue->usbss_rev == MUSB_USBSS_REV_33XX)
usbphycfg |= USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN;
}
__raw_writel(usbphycfg, glue->usb_ctrl);
-- 
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 v3 2/3] usb: musb: dsps: add phy control logic to glue

2012-07-12 Thread Damodar Santhapuri
From: Ajay Kumar Gupta 

AM335x uses NOP transceiver driver and need to enable builtin PHY
by writing into usb_ctrl register available in system control
module register space. This is being added at musb glue driver
layer untill a separate system control module driver is available.

Signed-off-by: Ajay Kumar Gupta 
Signed-off-by: Damodar Santhapuri 
---
Changes from v1:
- Used platform_get_resource() instead of platform_get_resource_byname()
based on Kishon's comment.

 arch/arm/mach-omap2/board-ti8168evm.c   |1 -
 arch/arm/mach-omap2/omap_phy_internal.c |   35 
 arch/arm/plat-omap/include/plat/usb.h   |5 +-
 drivers/usb/musb/musb_dsps.c|   87 +--
 4 files changed, 73 insertions(+), 55 deletions(-)

diff --git a/arch/arm/mach-omap2/board-ti8168evm.c 
b/arch/arm/mach-omap2/board-ti8168evm.c
index d4c8392..0c7c098 100644
--- a/arch/arm/mach-omap2/board-ti8168evm.c
+++ b/arch/arm/mach-omap2/board-ti8168evm.c
@@ -26,7 +26,6 @@
 #include 
 
 static struct omap_musb_board_data musb_board_data = {
-   .set_phy_power  = ti81xx_musb_phy_power,
.interface_type = MUSB_INTERFACE_ULPI,
.mode   = MUSB_OTG,
.power  = 500,
diff --git a/arch/arm/mach-omap2/omap_phy_internal.c 
b/arch/arm/mach-omap2/omap_phy_internal.c
index d52651a..d80bb16 100644
--- a/arch/arm/mach-omap2/omap_phy_internal.c
+++ b/arch/arm/mach-omap2/omap_phy_internal.c
@@ -254,38 +254,3 @@ void am35x_set_mode(u8 musb_mode)
 
omap_ctrl_writel(devconf2, AM35XX_CONTROL_DEVCONF2);
 }
-
-void ti81xx_musb_phy_power(u8 on)
-{
-   void __iomem *scm_base = NULL;
-   u32 usbphycfg;
-
-   scm_base = ioremap(TI81XX_SCM_BASE, SZ_2K);
-   if (!scm_base) {
-   pr_err("system control module ioremap failed\n");
-   return;
-   }
-
-   usbphycfg = __raw_readl(scm_base + USBCTRL0);
-
-   if (on) {
-   if (cpu_is_ti816x()) {
-   usbphycfg |= TI816X_USBPHY0_NORMAL_MODE;
-   usbphycfg &= ~TI816X_USBPHY_REFCLK_OSC;
-   } else if (cpu_is_ti814x()) {
-   usbphycfg &= ~(USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN
-   | USBPHY_DPINPUT | USBPHY_DMINPUT);
-   usbphycfg |= (USBPHY_OTGVDET_EN | USBPHY_OTGSESSEND_EN
-   | USBPHY_DPOPBUFCTL | USBPHY_DMOPBUFCTL);
-   }
-   } else {
-   if (cpu_is_ti816x())
-   usbphycfg &= ~TI816X_USBPHY0_NORMAL_MODE;
-   else if (cpu_is_ti814x())
-   usbphycfg |= USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN;
-
-   }
-   __raw_writel(usbphycfg, scm_base + USBCTRL0);
-
-   iounmap(scm_base);
-}
diff --git a/arch/arm/plat-omap/include/plat/usb.h 
b/arch/arm/plat-omap/include/plat/usb.h
index 548a4c8..c2aa4ae 100644
--- a/arch/arm/plat-omap/include/plat/usb.h
+++ b/arch/arm/plat-omap/include/plat/usb.h
@@ -95,7 +95,6 @@ extern void am35x_musb_reset(void);
 extern void am35x_musb_phy_power(u8 on);
 extern void am35x_musb_clear_irq(void);
 extern void am35x_set_mode(u8 musb_mode);
-extern void ti81xx_musb_phy_power(u8 on);
 
 /* AM35x */
 /* USB 2.0 PHY Control */
@@ -120,8 +119,8 @@ extern void ti81xx_musb_phy_power(u8 on);
 #define CONF2_DATPOL   (1 << 1)
 
 /* TI81XX specific definitions */
-#define USBCTRL0   0x620
-#define USBSTAT0   0x624
+#define MUSB_USBSS_REV_816X0x9
+#define MUSB_USBSS_REV_814X0xb
 
 /* TI816X PHY controls bits */
 #define TI816X_USBPHY0_NORMAL_MODE (1 << 0)
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index 494772f..72eda64 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -115,9 +115,46 @@ struct dsps_glue {
struct platform_device *musb;   /* child musb pdev */
const struct dsps_musb_wrapper *wrp; /* wrapper register offsets */
struct timer_list timer;/* otg_workaround timer */
+   u32 __iomem *usb_ctrl;
+   u8  usbss_rev;
 };
 
 /**
+ * musb_dsps_phy_control - phy on/off
+ * @glue: struct dsps_glue *
+ * @on: flag for phy to be switched on or off
+ *
+ * This is to enable the PHY using usb_ctrl register in system control
+ * module space.
+ *
+ * XXX: This function will be removed once we have a seperate driver for
+ * control module
+ */
+static void musb_dsps_phy_control(struct dsps_glue *glue, u8 on)
+{
+   u32 usbphycfg;
+
+   usbphycfg = __raw_readl(glue->usb_ctrl);
+
+   if (on) {
+   if (glue->usbss_rev == MUSB_USBSS_REV_816X) {
+   usbphycfg |= TI816X_USBPHY0_NORMAL_MODE;
+   usbphycfg &= ~TI816X_USBPHY_REFCLK_OSC;
+   } else if (glue->usbss_rev == MUSB_USBSS_REV_814X) {
+   usbphycfg &= ~(USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN
+   | USBPHY_DPINPUT | USBPHY_DMINPUT);
+   

[PATCH v3 1/3] arm: omap: hwmod: add new memory resource for usb phy control

2012-07-12 Thread Damodar Santhapuri
From: Ajay Kumar Gupta 

Added usb_ctrl0 and usb_ctrl1 base address as new memory resources
which will be used at am335x musb driver glue layer to turn on or
off builin PHY untill we have a separate system control module
driver.

Signed-off-by: Ajay Kumar Gupta 
Signed-off-by: Damodar Santhapuri 
---
Changes from v1:
Reordered the layout based on Kishon's comment on not using
 platform_get_resources_by_name.

Changes from v2:
Corrected the pa_end address of usb_cntrl registers based on
Sergei Shtylyov comment.

 arch/arm/mach-omap2/omap_hwmod_33xx_data.c |   12 
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod_33xx_data.c 
b/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
index df888fe..6df4c4d 100644
--- a/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
@@ -3269,11 +3269,23 @@ static struct omap_hwmod_addr_space 
am33xx_usbss_addr_space[] = {
.flags  = ADDR_TYPE_RT
},
{
+   .name   = "usb_ctrl0",
+   .pa_start   = 0x44E10620,
+   .pa_end = 0x44E10620 + SZ_4 - 1,
+   .flags  = ADDR_TYPE_RT
+   },
+   {
.name   = "musb1",
.pa_start   = 0x47401800,
.pa_end = 0x47401800 + SZ_2K - 1,
.flags  = ADDR_TYPE_RT
},
+   {
+   .name   = "usb_ctrl1",
+   .pa_start   = 0x44E10628,
+   .pa_end = 0x44E10628 + SZ_4 - 1,
+   .flags  = ADDR_TYPE_RT
+   },
{ }
 };
 
-- 
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] USB: option: add ZTE MF821D

2012-07-12 Thread Bjørn Mork
Sold by O2 (telefonica germany) under the name "LTE4G"

Tested-by: Thomas Schäfer 
Signed-off-by: Bjørn Mork 
---
 drivers/usb/serial/option.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 417ab1b..46cee56 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -936,6 +936,8 @@ static const struct usb_device_id option_ids[] = {
{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0165, 0xff, 0xff, 
0xff) },
{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0167, 0xff, 0xff, 
0xff),
  .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
+   { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0326, 0xff, 0xff, 
0xff),
+ .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1008, 0xff, 0xff, 
0xff),
  .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1010, 0xff, 0xff, 
0xff),
-- 
1.7.10.4

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


Re: g_serial and cdc_acm communications

2012-07-12 Thread Dipen Patel

Hi Ron/Greg,

I am facing similar issue with serial gadget configured on i.MX6Q 
Sabrelite board.

In my case Host sends packets starting with 10 bytes to 2MB bytes in
increments of 1 byte. And device simply loopback the same packet with 
status byte. 

However everything works fine until Tx (reply) packet size from device 
is 16895 bytes. For Tx packet size >= 16896 Host is unable to receive 
last few bytes. For Tx size of 16896 I can see on host usbmon trace that 
all bytes are received but still waiting for transaction to complete. 
And for Tx size more than 16896 it is still waiting for last few bytes. 
And eventually Host application will time out.

In my device side transmit routine I have tried sending whole packet at 
once. And also dividing packet into smaller chunks (4096, 8192, 16384) 
but same behavior. 

I can receive data upto 2MB so receive looks fine. 

I have applied following patches.
- Workqueue patch - http://comments.gmane.org/gmane.linux.usb.general/26772
- POSTPONE_FREE_LAST_DTD patch - http://patchwork.ozlabs.org/patch/157845/

Appreciate any help on this.

Regards,
Dipen Patel

--
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] net: qmi_wwan: add ZTE MF821D

2012-07-12 Thread Bjørn Mork
Sold by O2 (telefonica germany) under the name "LTE4G"

Tested-by: Thomas Schäfer 
Signed-off-by: Bjørn Mork 
---
I've verified that this applies cleanly to both net and net-next. 
Please apply to the branch you find appropriate.

Thanks,
Bjørn


 drivers/net/usb/qmi_wwan.c |9 +
 1 file changed, 9 insertions(+)

diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
index a051ced..62c5ba2 100644
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -453,6 +453,15 @@ static const struct usb_device_id products[] = {
.bInterfaceProtocol = 0xff,
.driver_info= (unsigned long)&qmi_wwan_force_int4,
},
+   {   /* ZTE MF821D */
+   .match_flags= USB_DEVICE_ID_MATCH_DEVICE | 
USB_DEVICE_ID_MATCH_INT_INFO,
+   .idVendor   = 0x19d2,
+   .idProduct  = 0x0326,
+   .bInterfaceClass= 0xff,
+   .bInterfaceSubClass = 0xff,
+   .bInterfaceProtocol = 0xff,
+   .driver_info= (unsigned long)&qmi_wwan_force_int4,
+   },
{   /* ZTE (Vodafone) K3520-Z */
.match_flags= USB_DEVICE_ID_MATCH_DEVICE | 
USB_DEVICE_ID_MATCH_INT_INFO,
.idVendor   = 0x19d2,
-- 
1.7.10.4

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


Re: [PATCH v4 2/4] usb gadget: Configure endpoint according to gadget speed.

2012-07-12 Thread Rajaram R
Hi


On Thu, Nov 18, 2010 at 6:17 PM, Tatyana Brokhman
 wrote:
>
> Add config_ep_by_speed() to configure the endpoint according to the gadget
> speed. Using this function will spare the FDs from handling the endpoint
> chosen descriptor.
>
> Signed-off-by: Tatyana Brokhman 
> ---
>  drivers/usb/gadget/composite.c  |   76 
> +++
>  drivers/usb/gadget/epautoconf.c |1 +
>  include/linux/usb/composite.h   |   21 +++
>  include/linux/usb/gadget.h  |3 ++
>  4 files changed, 101 insertions(+), 0 deletions(-)
>
---cut---

> + */
> +int config_ep_by_speed(struct usb_gadget *g,
> +   struct usb_function *f,
> +   struct usb_ep *_ep)
> +{
> +   struct usb_endpoint_descriptor *chosen_desc = NULL;
> +   struct usb_descriptor_header **speed_desc = NULL;
> +
> +   struct usb_descriptor_header **d_spd; /* cursor for speed desc */
> +
> +   if (!g || !f || !_ep)
> +   return -EIO;
> +
> +   /* select desired speed */
> +   switch (g->speed) {
> +   case USB_SPEED_HIGH:
> +   if (gadget_is_dualspeed(g)) {
> +   speed_desc = f->hs_descriptors;
> +   break;
> +   }
> +   /* else: fall through */
> +   default:
> +   speed_desc = f->descriptors;
> +   }
> +   /* find descriptors */
> +   for (d_spd = next_ep_desc(speed_desc); d_spd;
> + d_spd = next_ep_desc(d_spd+1)) {
> +   chosen_desc = (struct usb_endpoint_descriptor *)*d_spd;
> +   if (chosen_desc->bEndpointAddress == _ep->bEndpointAddress)
> +   goto ep_found;
> +   }
> +   return -EIO;
> +
> +ep_found:
> +   /* commit results */
> +   _ep->maxpacket = le16_to_cpu(chosen_desc->wMaxPacketSize);
> +   _ep->desc = chosen_desc;

Could you please comment on why do we need to update gadget's ep list
with function's maxpacket ? Will this not affect when we switch
functions ?

> +
> +   return 0;
> +}
--
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: 3.4.4: disabling irq

2012-07-12 Thread Udo van den Heuvel
On 2012-07-11 17:15, Alan Stern wrote:
> On Wed, 11 Jul 2012, Udo van den Heuvel wrote:
> 
>> New occurrence:
> 
>> Any clues and/or updates?
> 
> Didn't you see the message I posted on Monday?
> 
>   http://marc.info/?l=linux-usb&m=134186054713868&w=2

Nothing changed except the kernel.
Main compononent on usb is the pwc webcam.
After the occurrence yesterday I unloaded motion and the pwc module.
But I got *another* occurrence round 20:47 hours.

How to list what modules/programs are using that irq?


Udo
--
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: 3.4.4: disabling irq

2012-07-12 Thread Jan Ceuleers
On 07/12/2012 03:23 PM, Udo van den Heuvel wrote:
> How to list what modules/programs are using that irq?

cat /proc/interrupts
--
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: 3.4.4: disabling irq

2012-07-12 Thread Udo van den Heuvel
On 2012-07-12 15:43, Jan Ceuleers wrote:
> On 07/12/2012 03:23 PM, Udo van den Heuvel wrote:
>> How to list what modules/programs are using that irq?
> 
> cat /proc/interrupts

# cat /proc/interrupts
   CPU0   CPU1   CPU2   CPU3
  0: 40  0  0  0   IO-APIC-edge  timer
  1:  1  4  91884418   IO-APIC-edge  i8042
  4:  1 25 607223   1584   IO-APIC-edge  serial
  6:  0  0  8  0   IO-APIC-edge  floppy
  7:  1  0  0  0   IO-APIC-edge
parport0
  9:  0  0  0  0   IO-APIC-fasteoi   acpi
 12:  3106 980333   3914   IO-APIC-edge  i8042
 14:  0  5 169732457   IO-APIC-edge
pata_atiixp
 15:  0  0  0  0   IO-APIC-edge
pata_atiixp
 16:  0  0   3038 33   IO-APIC-fasteoi
sata_sil24, ohci_hcd:usb1, ohci_hcd:usb2, snd_hda_intel
 17:  0  4  24053119   IO-APIC-fasteoi
ehci_hcd:usb3
 18: 25190   18052161  21311   IO-APIC-fasteoi
ohci_hcd:usb5, ohci_hcd:usb6, ohci_hcd:usb7
 19:  1  9 187895487   IO-APIC-fasteoi
ehci_hcd:usb4
 20:  71353756346   8907   IO-APIC-fasteoi   serial
 22:127719   14673690  33318   IO-APIC-fasteoi   ahci
 43:115   1072   33699508  73116   PCI-MSI-edge  eth0
 44: 272523044666  11507   PCI-MSI-edge  radeon
 45:  0  0 21  0   PCI-MSI-edge
snd_hda_intel
NMI:  0  0  0  0   Non-maskable interrupts
LOC:   15971203   15548951   13031603   13145359   Local timer interrupts
SPU:  0  0  0  0   Spurious interrupts
PMI:  0  0  0  0   Performance
monitoring interrupts
IWI:  0  0  0  0   IRQ work interrupts
RTR:  0  0  0  0   APIC ICR read retries
RES:   57916374   44634814   19199377   43219640   Rescheduling interrupts
CAL:   2241   2293   2327   2196   Function call interrupts
TLB: 577983 648537 579293 635466   TLB shootdowns
THR:  0  0  0  0   Threshold APIC interrupts
MCE:  0  0  0  0   Machine check exceptions
MCP:581581581581   Machine check polls
ERR:  0
MIS:  0



So what can we conclude?

Kind regards,
Udo
--
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: host: tegra: pass correct pointer in ehci_setup()

2012-07-12 Thread Alan Stern
On Thu, 12 Jul 2012, Laxman Dewangan wrote:

> The ehci_setup() require the pointer of usb_hcd.
> Passing the correct pointer in place of ehci_hcd
> pointer.
> 
> This is side effetct of change:
> commit 1a49e2ac9651df7349867a5cf44e2c83de1046af
> Author: Alan Stern 
> 
> EHCI: centralize controller initialization
> 
> 
> Signed-off-by: Laxman Dewangan 

Argh!  You're perfectly right, of course.  I thought I had checked all 
those calls carefully.

Anyway, two other calls need to be fixed as well.  I'll resubmit your 
patch, with the other two fixes included.  Okay?

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 v.2] usb: host: tegra: pass correct pointer in ehci_setup()

2012-07-12 Thread Alan Stern
From: Laxman Dewangan 

The ehci_setup() require the pointer of usb_hcd.
Passing the correct pointer in place of ehci_hcd
pointer.

This is side effect of change:
commit 1a49e2ac9651df7349867a5cf44e2c83de1046af
Author: Alan Stern 

EHCI: centralize controller initialization

[Although I checked for this specifically, obviously I missed some of
the calls.  In addition to the mistake in ehci-tegra.c that Laxman
fixed here, the same thing needs to be fixed in ehci-orion.c and
ehci-xls.c. -- Alan Stern]

Signed-off-by: Laxman Dewangan 
Signed-off-by: Alan Stern 

---

 drivers/usb/host/ehci-orion.c |2 +-
 drivers/usb/host/ehci-tegra.c |2 +-
 drivers/usb/host/ehci-xls.c   |2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

Index: usb-3.5/drivers/usb/host/ehci-orion.c
===
--- usb-3.5.orig/drivers/usb/host/ehci-orion.c
+++ usb-3.5/drivers/usb/host/ehci-orion.c
@@ -106,7 +106,7 @@ static int ehci_orion_setup(struct usb_h
struct ehci_hcd *ehci = hcd_to_ehci(hcd);
int retval;
 
-   retval = ehci_setup(ehci);
+   retval = ehci_setup(hcd);
if (retval)
return retval;
 
Index: usb-3.5/drivers/usb/host/ehci-tegra.c
===
--- usb-3.5.orig/drivers/usb/host/ehci-tegra.c
+++ usb-3.5/drivers/usb/host/ehci-tegra.c
@@ -285,7 +285,7 @@ static int tegra_ehci_setup(struct usb_h
/* switch to host mode */
hcd->has_tt = 1;
 
-   retval = ehci_setup(ehci);
+   retval = ehci_setup(hcd);
if (retval)
return retval;
 
Index: usb-3.5/drivers/usb/host/ehci-xls.c
===
--- usb-3.5.orig/drivers/usb/host/ehci-xls.c
+++ usb-3.5/drivers/usb/host/ehci-xls.c
@@ -18,7 +18,7 @@ static int ehci_xls_setup(struct usb_hcd
 
ehci->caps = hcd->regs;
 
-   return ehci_setup(ehci);
+   return ehci_setup(hcd);
 }
 
 int ehci_xls_probe_internal(const struct hc_driver *driver,

--
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: g_serial and cdc_acm communications

2012-07-12 Thread Dipen Patel
Hi,

Resolved this by fixing a bug in device side transmit routine. Anyways thank you
guys. This was the only post I found on net with exactly my problem.

Regards,
Dipen Patel

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


Re: [PATCH v2] usb/host/ehci-hub: Fix the issue EG20T USB host controller has long resuming time, when pen drive is attached.

2012-07-12 Thread Alan Stern
On Thu, 12 Jul 2012, Tomoya MORINAGA wrote:

> Intel EG20T USB host controller does not send SOF in resuming time
> after suspending, if the FLR bit was not cleared. When pen drive is
> attached, the controller has a long resuming time to try re-connect
> it. This patch clear the FLR bit in suspending time for fixing the
> issue.
> 
> Signed-off-by: Tomoya MORINAGA 
> ---
> v2: Update comments from Alan Stern
>   Add patch description
>   Always clear the STS_FLR flag.
> ---
>  drivers/usb/host/ehci-hub.c |1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c
> index fc9e7cc..818a2f1 100644
> --- a/drivers/usb/host/ehci-hub.c
> +++ b/drivers/usb/host/ehci-hub.c
> @@ -318,6 +318,7 @@ static int ehci_bus_suspend (struct usb_hcd *hcd)
>   ehci_readl(ehci, &ehci->regs->intr_enable);
>  
>   ehci->next_statechange = jiffies + msecs_to_jiffies(10);
> + ehci_writel(ehci, STS_FLR, &ehci->regs->status);
>   spin_unlock_irq (&ehci->lock);

You need to add a comment to the code also.  Otherwise, a few years
from now somebody will see that line, realize it doesn't do anything
important, and get rid of it.

Alan Stern

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


Re: g_serial and cdc_acm communications

2012-07-12 Thread Alan Stern
On Thu, 12 Jul 2012, Dipen Patel wrote:

> 
> Hi Ron/Greg,
> 
> I am facing similar issue with serial gadget configured on i.MX6Q 
> Sabrelite board.
> 
> In my case Host sends packets starting with 10 bytes to 2MB bytes in
> increments of 1 byte. And device simply loopback the same packet with 
> status byte. 
> 
> However everything works fine until Tx (reply) packet size from device 
> is 16895 bytes. For Tx packet size >= 16896 Host is unable to receive 
> last few bytes. For Tx size of 16896 I can see on host usbmon trace that 
> all bytes are received but still waiting for transaction to complete. 
> And for Tx size more than 16896 it is still waiting for last few bytes. 
> And eventually Host application will time out.
> 
> In my device side transmit routine I have tried sending whole packet at 
> once. And also dividing packet into smaller chunks (4096, 8192, 16384) 
> but same behavior. 
> 
> I can receive data upto 2MB so receive looks fine. 

It's noteworthy that 16896 is a multiple of 512, which is probably your
wMaxPacketSize.  This suggests that the device needs to send a
zero-length packet to tell the host there's no more data available.

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: 3.4.4: disabling irq

2012-07-12 Thread Alan Stern
On Thu, 12 Jul 2012, Udo van den Heuvel wrote:

> # cat /proc/interrupts
>CPU0   CPU1   CPU2   CPU3
>   0: 40  0  0  0   IO-APIC-edge  timer
>   1:  1  4  91884418   IO-APIC-edge  i8042
>   4:  1 25 607223   1584   IO-APIC-edge  serial
>   6:  0  0  8  0   IO-APIC-edge  floppy
>   7:  1  0  0  0   IO-APIC-edge
> parport0
>   9:  0  0  0  0   IO-APIC-fasteoi   acpi
>  12:  3106 980333   3914   IO-APIC-edge  i8042
>  14:  0  5 169732457   IO-APIC-edge
> pata_atiixp
>  15:  0  0  0  0   IO-APIC-edge
> pata_atiixp
>  16:  0  0   3038 33   IO-APIC-fasteoi
> sata_sil24, ohci_hcd:usb1, ohci_hcd:usb2, snd_hda_intel
>  17:  0  4  24053119   IO-APIC-fasteoi
> ehci_hcd:usb3
>  18: 25190   18052161  21311   IO-APIC-fasteoi
> ohci_hcd:usb5, ohci_hcd:usb6, ohci_hcd:usb7
>  19:  1  9 187895487   IO-APIC-fasteoi
> ehci_hcd:usb4
>  20:  71353756346   8907   IO-APIC-fasteoi   serial
>  22:127719   14673690  33318   IO-APIC-fasteoi   ahci
>  43:115   1072   33699508  73116   PCI-MSI-edge  eth0
>  44: 272523044666  11507   PCI-MSI-edge  radeon
>  45:  0  0 21  0   PCI-MSI-edge
> snd_hda_intel
> NMI:  0  0  0  0   Non-maskable interrupts
> LOC:   15971203   15548951   13031603   13145359   Local timer interrupts
> SPU:  0  0  0  0   Spurious interrupts
> PMI:  0  0  0  0   Performance
> monitoring interrupts
> IWI:  0  0  0  0   IRQ work interrupts
> RTR:  0  0  0  0   APIC ICR read retries
> RES:   57916374   44634814   19199377   43219640   Rescheduling interrupts
> CAL:   2241   2293   2327   2196   Function call interrupts
> TLB: 577983 648537 579293 635466   TLB shootdowns
> THR:  0  0  0  0   Threshold APIC interrupts
> MCE:  0  0  0  0   Machine check exceptions
> MCP:581581581581   Machine check polls
> ERR:  0
> MIS:  0
> 
> 
> 
> So what can we conclude?

The conclusion is that ohci-hcd is the only driver using IRQ 18.  If 
you build a kernel with CONFIG_USB_DEBUG enabled, it will be possible 
to see if the OHCI hardware is responsible for the IRQ problem.

When the IRQ line gets disabled again, make a copy of the

/sys/kernel/debug/usb/ohci/*/registers

files and post them, along with a copy of 
/sys/kernel/debug/usb/devices.

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 -next] smsc95xx: signedness bug in get_regs()

2012-07-12 Thread David Miller
From: Dan Carpenter 
Date: Wed, 11 Jul 2012 09:32:51 +0300

> "retval" has to be a signed integer for the error handling to work.
> 
> Signed-off-by: Dan Carpenter 

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: Issues with Nikon D800 cameras & USB3

2012-07-12 Thread Greg Kroah-Hartman
On Thu, Jul 12, 2012 at 04:35:57PM +0100, Richard Adams wrote:
> Hi,
> 
> I've recently been doing some development work with the latest Linux Kernel
> (3.4 & 3.5rc6) and I'm experiencing problems with USB3 on both.
> 
> I've been in conversation with the developers at gphoto and they've
> directed me to you?
> 
> 1) The problem occurs when I plug in the Nikon D800 in to any of my USB3
> ports
> 2) Ubuntu fails to mount the device
> 3) gphoto can issue a single command to the camera before it locks.
> 
> The gphoto forum thread is below with more details is below:
> 
> http://old.nabble.com/NikonD800-locks-after-first-access.-Log-included.-to34032300.html#a34034687
> 
> If I can provide any more information or you can advise in any way that
> would be fantastic!

Can you provide the kernel logs for when you plug in your device and it
doesn't work?

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: xhci_hcd: external drive not initialised if already connected during restart or cold boot

2012-07-12 Thread Matt Causey
On Thu, Jul 12, 2012 at 2:04 AM, Andiry Xu  wrote:
> On 07/12/2012 10:53 AM, Matt Causey wrote:
>>
>> On Wed, Jul 11, 2012 at 11:03 AM, Matt Causey
>> wrote:
>>>
>>> On Wed, Jul 11, 2012 at 10:12 AM, Matt Causey
>>> wrote:

 On Tue, Jul 10, 2012 at 10:55 PM, Andiry Xu  wrote:
>
> On 07/11/2012 01:56 AM, Matt wrote:
>>
>>
>> Lee Harris   writes:
>>
>>>
>>>
>>> Hi Sarah
>>>
>>> Whenever I restart or coldboot, my external drive (3.5 sata in a USB3
>>> enclosure) is not detected / initialised correctly. fdisk -l does not
>>> show the drive at all.
>>> I have found that I have to:
>>> turn it off ( or disconnect the usb cable)
>>> modprobe -r xhci_hcd
>>> modprobe xhci_hcd
>>> and then turn it on. It is then found and initialised.
>>
>>
>>
>>
>> I'm having this same issue.  Does anyone have any ideas?
>>
>
> Can you post the bootup dmesg with device connected and
> CONFIG_USB_DEBUG and
> CONFIG_USB_XHCI_HCD_DEBUGGING enabled?
>
> Thanks,
> Andiry
>
>

 Some more background...I've got another OS image that runs Linux
 2.6.32-33-generic (Ubuntu 10.4 LTS) - and that OS on this hardware
 works as expected.  I've also tested Linux 3.2.22 and it fails in the
 same way on my system.

 Upon more digging, what I'm finding is that if I leave my device
 disconnected from the USB3 port when I boot the system, and the
 connect the device after the system has booted fully, the device works
 correctly.  The problem occurs when a device is connected to the USB3
 port, and I simply boot the system.  The dmesg below is from the test
 system that has the problem.  My configuration is also included as an
 attachment, in case that's helpful.

 dmesg:
>
>
> ...
>
>
 xhci_hcd :05:00.0: PCI INT A ->  GSI 19 (level, low) ->  IRQ 19
 xhci_hcd :05:00.0: setting latency timer to 64
 xhci_hcd :05:00.0: xHCI Host Controller
 drivers/usb/core/inode.c: creating file '003'
 xhci_hcd :05:00.0: new USB bus registered, assigned bus number 3
 xhci_hcd :05:00.0: xHCI capability registers at f806:
 xhci_hcd :05:00.0: CAPLENGTH AND HCIVERSION 0x960020:
 xhci_hcd :05:00.0: CAPLENGTH: 0x20
 xhci_hcd :05:00.0: HCIVERSION: 0x96
 xhci_hcd :05:00.0: HCSPARAMS 1: 0x4000840
 xhci_hcd :05:00.0:   Max device slots: 64
 xhci_hcd :05:00.0:   Max interrupters: 8
 xhci_hcd :05:00.0:   Max ports: 4
 xhci_hcd :05:00.0: HCSPARAMS 2: 0xcf1
 xhci_hcd :05:00.0:   Isoc scheduling threshold: 1
 xhci_hcd :05:00.0:   Maximum allowed segments in event ring: 15
 xhci_hcd :05:00.0: HCSPARAMS 3 0x7ff000a:
 xhci_hcd :05:00.0:   Worst case U1 device exit latency: 10
 xhci_hcd :05:00.0:   Worst case U2 device exit latency: 2047
 xhci_hcd :05:00.0: HCC PARAMS 0x270f06d:
 xhci_hcd :05:00.0:   HC generates 64 bit addresses
 xhci_hcd :05:00.0:   FIXME: more HCCPARAMS debugging
 xhci_hcd :05:00.0: RTSOFF 0x4a0:
 xhci_hcd :05:00.0: xHCI operational registers at f8060020:
 xhci_hcd :05:00.0: USBCMD 0x0:
 xhci_hcd :05:00.0:   HC is being stopped
 xhci_hcd :05:00.0:   HC has finished hard reset
 xhci_hcd :05:00.0:   Event Interrupts disabled
 xhci_hcd :05:00.0:   Host System Error Interrupts disabled
 xhci_hcd :05:00.0:   HC has finished light reset
 xhci_hcd :05:00.0: USBSTS 0x0:
 xhci_hcd :05:00.0:   Event ring is empty
 xhci_hcd :05:00.0:   No Host System Error
 xhci_hcd :05:00.0:   HC is running
 xhci_hcd :05:00.0: f8060420 port status reg = 0x2a0
 xhci_hcd :05:00.0: f8060424 port power reg = 0x0
 xhci_hcd :05:00.0: f8060428 port link reg = 0x0
 xhci_hcd :05:00.0: f806042c port reserved reg = 0x0
 xhci_hcd :05:00.0: f8060430 port status reg = 0xa03
>
>
> Here the device is connected.
>
>
 xhci_hcd :05:00.0: f8060434 port power reg = 0x0
 xhci_hcd :05:00.0: f8060438 port link reg = 0x0
 xhci_hcd :05:00.0: f806043c port reserved reg = 0x0
 xhci_hcd :05:00.0: f8060440 port status reg = 0x2a0
 xhci_hcd :05:00.0: f8060444 port power reg = 0x0
 xhci_hcd :05:00.0: f8060448 port link reg = 0x0
 xhci_hcd :05:00.0: f806044c port reserved reg = 0x0
 xhci_hcd :05:00.0: f8060450 port status reg = 0x2a0
 xhci_hcd :05:00.0: f8060454 port power reg = 0x0
 xhci_hcd :05:00.0: f8060458 port link reg = 0x0
 xhci_hcd :05:00.0: f806045c port reserved reg = 0x0
 xhci_hcd :05:00.0: // Halt the HC
 xhci_hcd :05:00.0: `MEM_WRITE_DWORD(3'b000, 32'hf8060020, 32'h0,
 4'hf);
 xhci_hcd :05:00.0: can't setup
>
>
> This is where the error occurs. The host controller is not halted.
>
>
 xhci_hcd

Re: usb sound issue ...

2012-07-12 Thread Dr. Ing. Dieter Jurzitza
Hi Andiry, hi Sarah,
Andiry is right, the test patch was applied. Please advise what I can do on 
top of this ...

Thank you for all your time and all your efforts,
take care




Dieter Jurzitza


On Donnerstag, 12. Juli 2012 08:39:30 Andiry Xu wrote:
> The dmesg is catched with test patch applied, right?

> I wonder why I do not see the Signal while waiting for configure


-- 
---

   |
\
 /\_/\   |
| ~x~ |/-\   /
 \   /-   \_/
  ^^__   _/  _     /
 <°°__ \- \_/ |  |/|  |
  ||  || _| _|_| _|

if you really want to see the pictures above - use some font
with constant spacing like courier! :-)
---
--
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: g_serial and cdc_acm communications

2012-07-12 Thread Peter Chen
> Hi,
>
> Resolved this by fixing a bug in device side transmit routine. Anyways thank 
> you
> guys. This was the only post I found on net with exactly my problem.
>
Do you mean BUGs at fsl_udc_core.c?
Do you mind share of your finding?

Thanks,
Peter

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


Re: xhci_hcd: external drive not initialised if already connected during restart or cold boot

2012-07-12 Thread Matt Causey
On Thu, Jul 12, 2012 at 12:54 PM, Matt Causey  wrote:
> On Thu, Jul 12, 2012 at 2:04 AM, Andiry Xu  wrote:
>> On 07/12/2012 10:53 AM, Matt Causey wrote:
>>>
>>> On Wed, Jul 11, 2012 at 11:03 AM, Matt Causey
>>> wrote:

 On Wed, Jul 11, 2012 at 10:12 AM, Matt Causey
 wrote:
>
> On Tue, Jul 10, 2012 at 10:55 PM, Andiry Xu  wrote:
>>
>> On 07/11/2012 01:56 AM, Matt wrote:
>>>
>>>
>>> Lee Harris   writes:
>>>


 Hi Sarah

 Whenever I restart or coldboot, my external drive (3.5 sata in a USB3
 enclosure) is not detected / initialised correctly. fdisk -l does not
 show the drive at all.
 I have found that I have to:
 turn it off ( or disconnect the usb cable)
 modprobe -r xhci_hcd
 modprobe xhci_hcd
 and then turn it on. It is then found and initialised.
>>>
>>>
>>>
>>>
>>> I'm having this same issue.  Does anyone have any ideas?
>>>
>>
>> Can you post the bootup dmesg with device connected and
>> CONFIG_USB_DEBUG and
>> CONFIG_USB_XHCI_HCD_DEBUGGING enabled?
>>
>> Thanks,
>> Andiry
>>
>>
>
> Some more background...I've got another OS image that runs Linux
> 2.6.32-33-generic (Ubuntu 10.4 LTS) - and that OS on this hardware
> works as expected.  I've also tested Linux 3.2.22 and it fails in the
> same way on my system.
>
> Upon more digging, what I'm finding is that if I leave my device
> disconnected from the USB3 port when I boot the system, and the
> connect the device after the system has booted fully, the device works
> correctly.  The problem occurs when a device is connected to the USB3
> port, and I simply boot the system.  The dmesg below is from the test
> system that has the problem.  My configuration is also included as an
> attachment, in case that's helpful.
>
> dmesg:
>>
>>
>> ...
>>
>>
> xhci_hcd :05:00.0: PCI INT A ->  GSI 19 (level, low) ->  IRQ 19
> xhci_hcd :05:00.0: setting latency timer to 64
> xhci_hcd :05:00.0: xHCI Host Controller
> drivers/usb/core/inode.c: creating file '003'
> xhci_hcd :05:00.0: new USB bus registered, assigned bus number 3
> xhci_hcd :05:00.0: xHCI capability registers at f806:
> xhci_hcd :05:00.0: CAPLENGTH AND HCIVERSION 0x960020:
> xhci_hcd :05:00.0: CAPLENGTH: 0x20
> xhci_hcd :05:00.0: HCIVERSION: 0x96
> xhci_hcd :05:00.0: HCSPARAMS 1: 0x4000840
> xhci_hcd :05:00.0:   Max device slots: 64
> xhci_hcd :05:00.0:   Max interrupters: 8
> xhci_hcd :05:00.0:   Max ports: 4
> xhci_hcd :05:00.0: HCSPARAMS 2: 0xcf1
> xhci_hcd :05:00.0:   Isoc scheduling threshold: 1
> xhci_hcd :05:00.0:   Maximum allowed segments in event ring: 15
> xhci_hcd :05:00.0: HCSPARAMS 3 0x7ff000a:
> xhci_hcd :05:00.0:   Worst case U1 device exit latency: 10
> xhci_hcd :05:00.0:   Worst case U2 device exit latency: 2047
> xhci_hcd :05:00.0: HCC PARAMS 0x270f06d:
> xhci_hcd :05:00.0:   HC generates 64 bit addresses
> xhci_hcd :05:00.0:   FIXME: more HCCPARAMS debugging
> xhci_hcd :05:00.0: RTSOFF 0x4a0:
> xhci_hcd :05:00.0: xHCI operational registers at f8060020:
> xhci_hcd :05:00.0: USBCMD 0x0:
> xhci_hcd :05:00.0:   HC is being stopped
> xhci_hcd :05:00.0:   HC has finished hard reset
> xhci_hcd :05:00.0:   Event Interrupts disabled
> xhci_hcd :05:00.0:   Host System Error Interrupts disabled
> xhci_hcd :05:00.0:   HC has finished light reset
> xhci_hcd :05:00.0: USBSTS 0x0:
> xhci_hcd :05:00.0:   Event ring is empty
> xhci_hcd :05:00.0:   No Host System Error
> xhci_hcd :05:00.0:   HC is running
> xhci_hcd :05:00.0: f8060420 port status reg = 0x2a0
> xhci_hcd :05:00.0: f8060424 port power reg = 0x0
> xhci_hcd :05:00.0: f8060428 port link reg = 0x0
> xhci_hcd :05:00.0: f806042c port reserved reg = 0x0
> xhci_hcd :05:00.0: f8060430 port status reg = 0xa03
>>
>>
>> Here the device is connected.
>>
>>
> xhci_hcd :05:00.0: f8060434 port power reg = 0x0
> xhci_hcd :05:00.0: f8060438 port link reg = 0x0
> xhci_hcd :05:00.0: f806043c port reserved reg = 0x0
> xhci_hcd :05:00.0: f8060440 port status reg = 0x2a0
> xhci_hcd :05:00.0: f8060444 port power reg = 0x0
> xhci_hcd :05:00.0: f8060448 port link reg = 0x0
> xhci_hcd :05:00.0: f806044c port reserved reg = 0x0
> xhci_hcd :05:00.0: f8060450 port status reg = 0x2a0
> xhci_hcd :05:00.0: f8060454 port power reg = 0x0
> xhci_hcd :05:00.0: f8060458 port link reg = 0x0
> xhci_hcd :05:00.0: f806045c port reserved reg = 0x0
> xhci_hcd :05:00.0: // Halt the HC
> xhci_hcd :05:00.0: `MEM_WRITE_DW

[PATCH v3] usb/host/ehci-hub: Fix the issue EG20T USB host controller has long resuming time, when pen drive is attached.

2012-07-12 Thread Tomoya MORINAGA
Intel EG20T USB host controller does not send SOF in resuming time after
suspending, if the FLR bit was not cleared. When pen drive is attached,
the controller has a long resuming time to try re-connect it.
This patch clear the FLR bit in suspending time for fixing the issue.

Signed-off-by: Tomoya MORINAGA 
---
v3: Update comments from Alan Stern
Add comment in the source code.

v2: Update comments from Alan Stern
Add patch description
Always clear the STS_FLR flag.
---
 drivers/usb/host/ehci-hub.c |7 +++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c
index fc9e7cc..278b589 100644
--- a/drivers/usb/host/ehci-hub.c
+++ b/drivers/usb/host/ehci-hub.c
@@ -318,6 +318,13 @@ static int ehci_bus_suspend (struct usb_hcd *hcd)
ehci_readl(ehci, &ehci->regs->intr_enable);
 
ehci->next_statechange = jiffies + msecs_to_jiffies(10);
+
+   /* Intel EG20T USB host controller does not send SOF
+* in resuming time after suspending, if the FLR bit was not cleared.
+* Therefore clear the FLR bit in here.
+*/
+   ehci_writel(ehci, STS_FLR, &ehci->regs->status);
+
spin_unlock_irq (&ehci->lock);
 
/* ehci_work() may have re-enabled the watchdog timer, which we do not
-- 
1.7.4.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 -next] USB: ehci-omap: fix compile failure

2012-07-12 Thread Ming Lei
The omap_ehci_init() is introduced in the below commit:

commit 1a49e2ac9651df7349867a5cf44e2c83de1046af(EHCI:
centralize controller initialization)

the local variable of 'pdev' inside omap_ehci_init() is used
but not defined, so fix the bug.

Cc: Alan Stern 
Signed-off-by: Ming Lei 
---
 drivers/usb/host/ehci-omap.c |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
index 6133d93..4c43681 100644
--- a/drivers/usb/host/ehci-omap.c
+++ b/drivers/usb/host/ehci-omap.c
@@ -150,8 +150,10 @@ static int omap_ehci_init(struct usb_hcd *hcd)
struct ehci_hcd *ehci = hcd_to_ehci(hcd);
int rc;
struct ehci_hcd_omap_platform_data  *pdata;
+   struct platform_device *pdev =
+   to_platform_device(hcd->self.controller);
 
-   pdata = hcd->self.controller->platform_data;
+   pdata = platform_get_drvdata(pdev);
if (pdata->phy_reset) {
if (gpio_is_valid(pdata->reset_gpio_port[0]))
gpio_request_one(pdata->reset_gpio_port[0],
-- 
1.7.9.5

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


Re: [PATCH -next] USB: ehci-omap: fix compile failure

2012-07-12 Thread Ming Lei
On Fri, Jul 13, 2012 at 11:54 AM, Ming Lei  wrote:
> The omap_ehci_init() is introduced in the below commit:
>
> commit 1a49e2ac9651df7349867a5cf44e2c83de1046af(EHCI:
> centralize controller initialization)
>
> the local variable of 'pdev' inside omap_ehci_init() is used
> but not defined, so fix the bug.
>
> Cc: Alan Stern 
> Signed-off-by: Ming Lei 
> ---
>  drivers/usb/host/ehci-omap.c |4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
> index 6133d93..4c43681 100644
> --- a/drivers/usb/host/ehci-omap.c
> +++ b/drivers/usb/host/ehci-omap.c
> @@ -150,8 +150,10 @@ static int omap_ehci_init(struct usb_hcd *hcd)
> struct ehci_hcd *ehci = hcd_to_ehci(hcd);
> int rc;
> struct ehci_hcd_omap_platform_data  *pdata;
> +   struct platform_device *pdev =
> +   to_platform_device(hcd->self.controller);
>
> -   pdata = hcd->self.controller->platform_data;
> +   pdata = platform_get_drvdata(pdev);

Sorry, the above line is wrong,  please ignore the patch.

Thanks,
--
Ming Lei
--
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 net-next 7/8] usb: Use eth_random_addr

2012-07-12 Thread Joe Perches
Convert the existing uses of random_ether_addr to
the new eth_random_addr.

Signed-off-by: Joe Perches 
---
 drivers/usb/atm/xusbatm.c|4 ++--
 drivers/usb/gadget/u_ether.c |2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/atm/xusbatm.c b/drivers/usb/atm/xusbatm.c
index 14ec9f0..b3b1bb7 100644
--- a/drivers/usb/atm/xusbatm.c
+++ b/drivers/usb/atm/xusbatm.c
@@ -20,7 +20,7 @@
  
**/
 
 #include 
-#include  /* for random_ether_addr() */
+#include  /* for eth_random_addr() */
 
 #include "usbatm.h"
 
@@ -163,7 +163,7 @@ static int xusbatm_atm_start(struct usbatm_data *usbatm,
atm_dbg(usbatm, "%s entered\n", __func__);
 
/* use random MAC as we've no way to get it from the device */
-   random_ether_addr(atm_dev->esi);
+   eth_random_addr(atm_dev->esi);
 
return 0;
 }
diff --git a/drivers/usb/gadget/u_ether.c b/drivers/usb/gadget/u_ether.c
index 47cf48b..b9e1925 100644
--- a/drivers/usb/gadget/u_ether.c
+++ b/drivers/usb/gadget/u_ether.c
@@ -724,7 +724,7 @@ static int get_ether_addr(const char *str, u8 *dev_addr)
if (is_valid_ether_addr(dev_addr))
return 0;
}
-   random_ether_addr(dev_addr);
+   eth_random_addr(dev_addr);
return 1;
 }
 
-- 
1.7.8.111.gad25c.dirty

--
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 net-next 0/8] etherdevice: Rename random_ether_addr to eth_random_addr

2012-07-12 Thread Joe Perches
net-next commit ad7eee98be ("etherdevice: introduce eth_broadcast_addr")
added a new style API.  Rename random_ether_addr to eth_random_addr to
create some API symmetry.

Joe Perches (8):
  etherdevice: Rename random_ether_addr to eth_random_addr
  ethernet: Use eth_random_addr
  net: usb: Use eth_random_addr
  wireless: Use eth_random_addr
  drivers/net: Use eth_random_addr
  s390: Use eth_random_addr
  usb: Use eth_random_addr
  arch: Use eth_random_addr

 arch/blackfin/mach-bf537/boards/stamp.c   |2 +-
 arch/c6x/kernel/soc.c |2 +-
 arch/mips/ar7/platform.c  |4 ++--
 arch/mips/powertv/powertv_setup.c |6 +++---
 arch/um/drivers/net_kern.c|2 +-
 drivers/net/ethernet/atheros/atl1c/atl1c_hw.c |2 +-
 drivers/net/ethernet/atheros/atlx/atl1.c  |2 +-
 drivers/net/ethernet/atheros/atlx/atl2.c  |2 +-
 drivers/net/ethernet/ethoc.c  |2 +-
 drivers/net/ethernet/intel/igb/igb_main.c |4 ++--
 drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c|2 +-
 drivers/net/ethernet/lantiq_etop.c|2 +-
 drivers/net/ethernet/micrel/ks8851.c  |2 +-
 drivers/net/ethernet/micrel/ks8851_mll.c  |2 +-
 drivers/net/ethernet/smsc/smsc911x.c  |2 +-
 drivers/net/ethernet/ti/cpsw.c|2 +-
 drivers/net/ethernet/tile/tilegx.c|2 +-
 drivers/net/ethernet/wiznet/w5100.c   |2 +-
 drivers/net/ethernet/wiznet/w5300.c   |2 +-
 drivers/net/ethernet/xilinx/xilinx_axienet_main.c |2 +-
 drivers/net/tun.c |2 +-
 drivers/net/usb/smsc75xx.c|2 +-
 drivers/net/usb/smsc95xx.c|2 +-
 drivers/net/usb/usbnet.c  |2 +-
 drivers/net/wimax/i2400m/driver.c |2 +-
 drivers/net/wireless/adm8211.c|2 +-
 drivers/net/wireless/p54/eeprom.c |2 +-
 drivers/net/wireless/rt2x00/rt2400pci.c   |2 +-
 drivers/net/wireless/rt2x00/rt2500pci.c   |2 +-
 drivers/net/wireless/rt2x00/rt2500usb.c   |2 +-
 drivers/net/wireless/rt2x00/rt2800lib.c   |2 +-
 drivers/net/wireless/rt2x00/rt61pci.c |2 +-
 drivers/net/wireless/rt2x00/rt73usb.c |2 +-
 drivers/net/wireless/rtl818x/rtl8180/dev.c|2 +-
 drivers/net/wireless/rtl818x/rtl8187/dev.c|2 +-
 drivers/s390/net/qeth_l2_main.c   |2 +-
 drivers/s390/net/qeth_l3_main.c   |2 +-
 drivers/usb/atm/xusbatm.c |4 ++--
 drivers/usb/gadget/u_ether.c  |2 +-
 include/linux/etherdevice.h   |   14 --
 40 files changed, 52 insertions(+), 50 deletions(-)

-- 
1.7.8.111.gad25c.dirty

--
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 net-next 3/8] net: usb: Use eth_random_addr

2012-07-12 Thread Joe Perches
Convert the existing uses of random_ether_addr to
the new eth_random_addr.

Signed-off-by: Joe Perches 
---
 drivers/net/usb/smsc75xx.c |2 +-
 drivers/net/usb/smsc95xx.c |2 +-
 drivers/net/usb/usbnet.c   |2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c
index 1c6e515..6c0c5b7 100644
--- a/drivers/net/usb/smsc75xx.c
+++ b/drivers/net/usb/smsc75xx.c
@@ -616,7 +616,7 @@ static void smsc75xx_init_mac_address(struct usbnet *dev)
 
/* no eeprom, or eeprom values are invalid. generate random MAC */
eth_hw_addr_random(dev->net);
-   netif_dbg(dev, ifup, dev->net, "MAC address set to random_ether_addr");
+   netif_dbg(dev, ifup, dev->net, "MAC address set to eth_random_addr");
 }
 
 static int smsc75xx_set_mac_address(struct usbnet *dev)
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index bd7cbaa..25cc3a1 100644
--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -647,7 +647,7 @@ static void smsc95xx_init_mac_address(struct usbnet *dev)
 
/* no eeprom, or eeprom values are invalid. generate random MAC */
eth_hw_addr_random(dev->net);
-   netif_dbg(dev, ifup, dev->net, "MAC address set to 
random_ether_addr\n");
+   netif_dbg(dev, ifup, dev->net, "MAC address set to eth_random_addr\n");
 }
 
 static int smsc95xx_set_mac_address(struct usbnet *dev)
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index e92c057..8531c1c 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -1593,7 +1593,7 @@ static int __init usbnet_init(void)
BUILD_BUG_ON(
FIELD_SIZEOF(struct sk_buff, cb) < sizeof(struct skb_data));
 
-   random_ether_addr(node_id);
+   eth_random_addr(node_id);
return 0;
 }
 module_init(usbnet_init);
-- 
1.7.8.111.gad25c.dirty

--
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 v.2] usb: host: tegra: pass correct pointer in ehci_setup()

2012-07-12 Thread Laxman Dewangan

On Thursday 12 July 2012 08:04 PM, Alan Stern wrote:

From: Laxman Dewangan

The ehci_setup() require the pointer of usb_hcd.
Passing the correct pointer in place of ehci_hcd
pointer.

This is side effect of change:
commit 1a49e2ac9651df7349867a5cf44e2c83de1046af
Author: Alan Stern

 EHCI: centralize controller initialization

[Although I checked for this specifically, obviously I missed some of
the calls.  In addition to the mistake in ehci-tegra.c that Laxman
fixed here, the same thing needs to be fixed in ehci-orion.c and
ehci-xls.c. -- Alan Stern]

Signed-off-by: Laxman Dewangan
Signed-off-by: Alan Stern

---


All changes looks good and I am fine with the changes.


Thanks,
Laxman
--
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


usb 2.0 device connected on Super Speed HUB on USB 3.0 Port throws error during enumeration on 3.4 kernel.

2012-07-12 Thread VIKAS SAJJAN C
Hi ,
I am working on 3.4 kernel , when i try to connect a USB 2.0 device on Super 
Speed HUB , i get following error.

usb 3-1.1: Device not responding to set address.
usb 3-1.1: device not accepting address 3, error -71

any inputs will be of great help.

Thanks and Regards
Vikas Sajjan