* [PATCH v3 0/5] usb: musb: cleanup
@ 2012-06-22 12:10 Kishon Vijay Abraham I
2012-06-22 12:10 ` [PATCH v3 1/5] usb: musb: move work_struct(otg_notifier_work) from core to omap glue Kishon Vijay Abraham I
` (4 more replies)
0 siblings, 5 replies; 9+ messages in thread
From: Kishon Vijay Abraham I @ 2012-06-22 12:10 UTC (permalink / raw)
To: gregkh, kishon, linux-omap, linux-kernel, linux-usb, balbi
Most part of this patch series was obtained by splitting
[RFC PATCH 2/3] usb: musb: omap glue: use omap-usb2 as the phy driver.
TO DO:
* dt adaptation of musb omap glue, twl4030, twl6030.
* Use control module driver API to write to control module registers
(mailbox and power control of phy)
* send usb2 phy driver
* make musb omap glue use usb2 phy driver and make twl630
as a comparator driver.
Changes from v2:
* Added a condition in twl4030 to avoid spurious disconnect event
message to the omap glue, on bootup if the cable is not connected.
Changes from v1:
Changed the commit log of *usb: musb: move work_struct(otg_notifier_work)
from core to omap glue* as per Sergei's suggestion.
Patch series depends on
[PATCH v7 0/3] usb: multi-phy support
Developed and Tested on.
git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git musb
commit 2ed9127cff9a255b7671b8d3d938109f68a87961
Author: Mantesh Sarasetti <mantesh@ti.com>
Date: Fri Jun 1 14:54:30 2012 +0300
usb: musb: host: Disable MUSB DMA mode incase of DMA channel request failure
Performed device mode testing in omap4 panda and omap3 beagle.
Kishon Vijay Abraham I (5):
usb: musb: move work_struct(otg_notifier_work) from core to omap glue
usb: musb: twl: use mailbox API to send VBUS or ID events
drivers: usb: musb: move otg specific initializations from twl to
glue
usb: musb: omap: use devres API to allocate resources
drivers: usb: otg: twl: use devres API to allocate resources
drivers/usb/musb/musb_core.h | 2 -
drivers/usb/musb/omap2430.c | 122 +++++++++++++++++++++++++---------------
drivers/usb/otg/twl4030-usb.c | 67 ++++++++--------------
drivers/usb/otg/twl6030-usb.c | 69 ++++++++---------------
include/linux/usb/musb-omap.h | 30 ++++++++++
5 files changed, 155 insertions(+), 135 deletions(-)
create mode 100644 include/linux/usb/musb-omap.h
--
1.7.5.4
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v3 1/5] usb: musb: move work_struct(otg_notifier_work) from core to omap glue
2012-06-22 12:10 [PATCH v3 0/5] usb: musb: cleanup Kishon Vijay Abraham I
@ 2012-06-22 12:10 ` Kishon Vijay Abraham I
2012-06-22 12:10 ` [PATCH v3 2/5] usb: musb: twl: use mailbox API to send VBUS or ID events Kishon Vijay Abraham I
` (3 subsequent siblings)
4 siblings, 0 replies; 9+ messages in thread
From: Kishon Vijay Abraham I @ 2012-06-22 12:10 UTC (permalink / raw)
To: gregkh, kishon, linux-omap, linux-kernel, linux-usb, balbi; +Cc: Vikram Pandita
Commit 712d8e(fixes pm_runtime calls while atomic by using a work
queue. musb pm_runtime_get_sync call happens in interrupt context
on cable attach case. That can result in re-enabling the interrupts and
cause side affect. To avoid this deferred processing is used)
While the issue and the work queue implementation is specific to omap
(omap2430.c), the work_struct is defined as a member of struct musb
(musb_core.h). Hence moved the work_struct from musb_core to omap
glue.
Cc: Vikram Pandita <vikram.pandita@ti.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
drivers/usb/musb/musb_core.h | 2 --
drivers/usb/musb/omap2430.c | 24 +++++++++++++++---------
2 files changed, 15 insertions(+), 11 deletions(-)
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h
index f4a40f0..dbcdeea 100644
--- a/drivers/usb/musb/musb_core.h
+++ b/drivers/usb/musb/musb_core.h
@@ -327,7 +327,6 @@ struct musb {
irqreturn_t (*isr)(int, void *);
struct work_struct irq_work;
- struct work_struct otg_notifier_work;
u16 hwvers;
/* this hub status bit is reserved by USB 2.0 and not seen by usbcore */
@@ -373,7 +372,6 @@ struct musb {
u16 int_tx;
struct usb_phy *xceiv;
- u8 xceiv_event;
int nIrq;
unsigned irq_wake:1;
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index e279cf3..f40c805 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -41,6 +41,8 @@
struct omap2430_glue {
struct device *dev;
struct platform_device *musb;
+ u8 xceiv_event;
+ struct work_struct omap_musb_mailbox_work;
};
#define glue_to_musb(g) platform_get_drvdata(g->musb)
@@ -226,22 +228,26 @@ static inline void omap2430_low_level_init(struct musb *musb)
static int musb_otg_notifications(struct notifier_block *nb,
unsigned long event, void *unused)
{
- struct musb *musb = container_of(nb, struct musb, nb);
+ struct musb *musb = container_of(nb, struct musb, nb);
+ struct device *dev = musb->controller;
+ struct omap2430_glue *glue = dev_get_drvdata(dev->parent);
- musb->xceiv_event = event;
- schedule_work(&musb->otg_notifier_work);
+ glue->xceiv_event = event;
+ schedule_work(&glue->omap_musb_mailbox_work);
return NOTIFY_OK;
}
-static void musb_otg_notifier_work(struct work_struct *data_notifier_work)
+static void omap_musb_mailbox_work(struct work_struct *data_notifier_work)
{
- struct musb *musb = container_of(data_notifier_work, struct musb, otg_notifier_work);
+ struct omap2430_glue *glue = container_of(data_notifier_work,
+ struct omap2430_glue, omap_musb_mailbox_work);
+ struct musb *musb = glue_to_musb(glue);
struct device *dev = musb->controller;
struct musb_hdrc_platform_data *pdata = dev->platform_data;
struct omap_musb_board_data *data = pdata->board_data;
- switch (musb->xceiv_event) {
+ switch (glue->xceiv_event) {
case USB_EVENT_ID:
dev_dbg(musb->controller, "ID GND\n");
@@ -298,8 +304,6 @@ static int omap2430_musb_init(struct musb *musb)
return -ENODEV;
}
- INIT_WORK(&musb->otg_notifier_work, musb_otg_notifier_work);
-
status = pm_runtime_get_sync(dev);
if (status < 0) {
dev_err(dev, "pm_runtime_get_sync FAILED %d\n", status);
@@ -388,7 +392,6 @@ static void omap2430_musb_disable(struct musb *musb)
static int omap2430_musb_exit(struct musb *musb)
{
del_timer_sync(&musb_idle_timer);
- cancel_work_sync(&musb->otg_notifier_work);
omap2430_low_level_exit(musb);
usb_put_phy(musb->xceiv);
@@ -441,6 +444,8 @@ static int __devinit omap2430_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, glue);
+ INIT_WORK(&glue->omap_musb_mailbox_work, omap_musb_mailbox_work);
+
ret = platform_device_add_resources(musb, pdev->resource,
pdev->num_resources);
if (ret) {
@@ -478,6 +483,7 @@ static int __devexit omap2430_remove(struct platform_device *pdev)
{
struct omap2430_glue *glue = platform_get_drvdata(pdev);
+ cancel_work_sync(&glue->omap_musb_mailbox_work);
platform_device_del(glue->musb);
platform_device_put(glue->musb);
kfree(glue);
--
1.7.5.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v3 2/5] usb: musb: twl: use mailbox API to send VBUS or ID events
2012-06-22 12:10 [PATCH v3 0/5] usb: musb: cleanup Kishon Vijay Abraham I
2012-06-22 12:10 ` [PATCH v3 1/5] usb: musb: move work_struct(otg_notifier_work) from core to omap glue Kishon Vijay Abraham I
@ 2012-06-22 12:10 ` Kishon Vijay Abraham I
2012-07-03 17:39 ` Matcovschi, Oleg
2012-06-22 12:10 ` [PATCH v3 3/5] drivers: usb: musb: move otg specific initializations from twl to glue Kishon Vijay Abraham I
` (2 subsequent siblings)
4 siblings, 1 reply; 9+ messages in thread
From: Kishon Vijay Abraham I @ 2012-06-22 12:10 UTC (permalink / raw)
To: gregkh, kishon, linux-omap, linux-kernel, linux-usb, balbi
The atomic notifier from twl4030/twl6030 to notifiy VBUS and ID events,
is replaced by a direct call to omap musb blue.
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
drivers/usb/musb/omap2430.c | 94 +++++++++++++++++++++++++---------------
drivers/usb/otg/twl4030-usb.c | 46 ++++++++++----------
drivers/usb/otg/twl6030-usb.c | 47 +++++++++-----------
include/linux/usb/musb-omap.h | 30 +++++++++++++
4 files changed, 133 insertions(+), 84 deletions(-)
create mode 100644 include/linux/usb/musb-omap.h
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index f40c805..0636870 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -34,6 +34,7 @@
#include <linux/dma-mapping.h>
#include <linux/pm_runtime.h>
#include <linux/err.h>
+#include <linux/usb/musb-omap.h>
#include "musb_core.h"
#include "omap2430.h"
@@ -41,11 +42,13 @@
struct omap2430_glue {
struct device *dev;
struct platform_device *musb;
- u8 xceiv_event;
+ enum omap_musb_vbus_id_status status;
struct work_struct omap_musb_mailbox_work;
};
#define glue_to_musb(g) platform_get_drvdata(g->musb)
+struct omap2430_glue *_glue;
+
static struct timer_list musb_idle_timer;
static void musb_do_idle(unsigned long _musb)
@@ -225,54 +228,58 @@ static inline void omap2430_low_level_init(struct musb *musb)
musb_writel(musb->mregs, OTG_FORCESTDBY, l);
}
-static int musb_otg_notifications(struct notifier_block *nb,
- unsigned long event, void *unused)
+void omap_musb_mailbox(enum omap_musb_vbus_id_status status)
{
- struct musb *musb = container_of(nb, struct musb, nb);
- struct device *dev = musb->controller;
- struct omap2430_glue *glue = dev_get_drvdata(dev->parent);
+ struct omap2430_glue *glue = _glue;
+ struct musb *musb = glue_to_musb(glue);
- glue->xceiv_event = event;
- schedule_work(&glue->omap_musb_mailbox_work);
+ glue->status = status;
+ if (!musb) {
+ dev_err(glue->dev, "musb core is not yet ready\n");
+ return;
+ }
- return NOTIFY_OK;
+ schedule_work(&glue->omap_musb_mailbox_work);
}
+EXPORT_SYMBOL_GPL(omap_musb_mailbox);
-static void omap_musb_mailbox_work(struct work_struct *data_notifier_work)
+static void omap_musb_set_mailbox(struct omap2430_glue *glue)
{
- struct omap2430_glue *glue = container_of(data_notifier_work,
- struct omap2430_glue, omap_musb_mailbox_work);
struct musb *musb = glue_to_musb(glue);
struct device *dev = musb->controller;
struct musb_hdrc_platform_data *pdata = dev->platform_data;
struct omap_musb_board_data *data = pdata->board_data;
- switch (glue->xceiv_event) {
- case USB_EVENT_ID:
- dev_dbg(musb->controller, "ID GND\n");
+ switch (glue->status) {
+ case OMAP_MUSB_ID_GROUND:
+ dev_dbg(dev, "ID GND\n");
+ musb->xceiv->last_event = USB_EVENT_ID;
if (!is_otg_enabled(musb) || musb->gadget_driver) {
- pm_runtime_get_sync(musb->controller);
+ pm_runtime_get_sync(dev);
usb_phy_init(musb->xceiv);
omap2430_musb_set_vbus(musb, 1);
}
break;
- case USB_EVENT_VBUS:
- dev_dbg(musb->controller, "VBUS Connect\n");
+ case OMAP_MUSB_VBUS_VALID:
+ dev_dbg(dev, "VBUS Connect\n");
+ musb->xceiv->last_event = USB_EVENT_VBUS;
if (musb->gadget_driver)
- pm_runtime_get_sync(musb->controller);
+ pm_runtime_get_sync(dev);
usb_phy_init(musb->xceiv);
break;
- case USB_EVENT_NONE:
- dev_dbg(musb->controller, "VBUS Disconnect\n");
+ case OMAP_MUSB_ID_FLOAT:
+ case OMAP_MUSB_VBUS_OFF:
+ dev_dbg(dev, "VBUS Disconnect\n");
+ musb->xceiv->last_event = USB_EVENT_NONE;
if (is_otg_enabled(musb) || is_peripheral_enabled(musb))
if (musb->gadget_driver) {
- pm_runtime_mark_last_busy(musb->controller);
- pm_runtime_put_autosuspend(musb->controller);
+ pm_runtime_mark_last_busy(dev);
+ pm_runtime_put_autosuspend(dev);
}
if (data->interface_type == MUSB_INTERFACE_UTMI) {
@@ -282,15 +289,24 @@ static void omap_musb_mailbox_work(struct work_struct *data_notifier_work)
usb_phy_shutdown(musb->xceiv);
break;
default:
- dev_dbg(musb->controller, "ID float\n");
+ dev_dbg(dev, "ID float\n");
}
}
+
+static void omap_musb_mailbox_work(struct work_struct *mailbox_work)
+{
+ struct omap2430_glue *glue = container_of(mailbox_work,
+ struct omap2430_glue, omap_musb_mailbox_work);
+ omap_musb_set_mailbox(glue);
+}
+
static int omap2430_musb_init(struct musb *musb)
{
u32 l;
int status = 0;
struct device *dev = musb->controller;
+ struct omap2430_glue *glue = dev_get_drvdata(dev->parent);
struct musb_hdrc_platform_data *plat = dev->platform_data;
struct omap_musb_board_data *data = plat->board_data;
@@ -330,14 +346,11 @@ static int omap2430_musb_init(struct musb *musb)
musb_readl(musb->mregs, OTG_INTERFSEL),
musb_readl(musb->mregs, OTG_SIMENABLE));
- musb->nb.notifier_call = musb_otg_notifications;
- status = usb_register_notifier(musb->xceiv, &musb->nb);
-
- if (status)
- dev_dbg(musb->controller, "notification register failed\n");
-
setup_timer(&musb_idle_timer, musb_do_idle, (unsigned long) musb);
+ if (glue->status != OMAP_MUSB_UNKNOWN)
+ omap_musb_set_mailbox(glue);
+
pm_runtime_put_noidle(musb->controller);
return 0;
@@ -350,12 +363,13 @@ static void omap2430_musb_enable(struct musb *musb)
u8 devctl;
unsigned long timeout = jiffies + msecs_to_jiffies(1000);
struct device *dev = musb->controller;
+ struct omap2430_glue *glue = dev_get_drvdata(dev->parent);
struct musb_hdrc_platform_data *pdata = dev->platform_data;
struct omap_musb_board_data *data = pdata->board_data;
- switch (musb->xceiv->last_event) {
+ switch (glue->status) {
- case USB_EVENT_ID:
+ case OMAP_MUSB_ID_GROUND:
usb_phy_init(musb->xceiv);
if (data->interface_type != MUSB_INTERFACE_UTMI)
break;
@@ -374,7 +388,7 @@ static void omap2430_musb_enable(struct musb *musb)
}
break;
- case USB_EVENT_VBUS:
+ case OMAP_MUSB_VBUS_VALID:
usb_phy_init(musb->xceiv);
break;
@@ -385,7 +399,10 @@ static void omap2430_musb_enable(struct musb *musb)
static void omap2430_musb_disable(struct musb *musb)
{
- if (musb->xceiv->last_event)
+ struct device *dev = musb->controller;
+ struct omap2430_glue *glue = dev_get_drvdata(dev->parent);
+
+ if (glue->status != OMAP_MUSB_UNKNOWN)
usb_phy_shutdown(musb->xceiv);
}
@@ -439,11 +456,18 @@ static int __devinit omap2430_probe(struct platform_device *pdev)
glue->dev = &pdev->dev;
glue->musb = musb;
+ glue->status = OMAP_MUSB_UNKNOWN;
pdata->platform_ops = &omap2430_ops;
platform_set_drvdata(pdev, glue);
+ /*
+ * REVISIT if we ever have two instances of the wrapper, we will be
+ * in big trouble
+ */
+ _glue = glue;
+
INIT_WORK(&glue->omap_musb_mailbox_work, omap_musb_mailbox_work);
ret = platform_device_add_resources(musb, pdev->resource,
@@ -552,7 +576,7 @@ static int __init omap2430_init(void)
{
return platform_driver_register(&omap2430_driver);
}
-module_init(omap2430_init);
+subsys_initcall(omap2430_init);
static void __exit omap2430_exit(void)
{
diff --git a/drivers/usb/otg/twl4030-usb.c b/drivers/usb/otg/twl4030-usb.c
index f8139b3..77f4ff6 100644
--- a/drivers/usb/otg/twl4030-usb.c
+++ b/drivers/usb/otg/twl4030-usb.c
@@ -33,11 +33,11 @@
#include <linux/io.h>
#include <linux/delay.h>
#include <linux/usb/otg.h>
+#include <linux/usb/musb-omap.h>
#include <linux/usb/ulpi.h>
#include <linux/i2c/twl.h>
#include <linux/regulator/consumer.h>
#include <linux/err.h>
-#include <linux/notifier.h>
#include <linux/slab.h>
/* Register defines */
@@ -159,7 +159,7 @@ struct twl4030_usb {
enum twl4030_usb_mode usb_mode;
int irq;
- u8 linkstat;
+ enum omap_musb_vbus_id_status linkstat;
bool vbus_supplied;
u8 asleep;
bool irq_enabled;
@@ -246,10 +246,11 @@ twl4030_usb_clear_bits(struct twl4030_usb *twl, u8 reg, u8 bits)
/*-------------------------------------------------------------------------*/
-static enum usb_phy_events twl4030_usb_linkstat(struct twl4030_usb *twl)
+static enum omap_musb_vbus_id_status
+ twl4030_usb_linkstat(struct twl4030_usb *twl)
{
int status;
- int linkstat = USB_EVENT_NONE;
+ enum omap_musb_vbus_id_status linkstat = OMAP_MUSB_UNKNOWN;
struct usb_otg *otg = twl->phy.otg;
twl->vbus_supplied = false;
@@ -273,24 +274,24 @@ static enum usb_phy_events twl4030_usb_linkstat(struct twl4030_usb *twl)
twl->vbus_supplied = true;
if (status & BIT(2))
- linkstat = USB_EVENT_ID;
+ linkstat = OMAP_MUSB_ID_GROUND;
else
- linkstat = USB_EVENT_VBUS;
- } else
- linkstat = USB_EVENT_NONE;
+ linkstat = OMAP_MUSB_VBUS_VALID;
+ } else {
+ if (twl->linkstat != OMAP_MUSB_UNKNOWN)
+ linkstat = OMAP_MUSB_VBUS_OFF;
+ }
dev_dbg(twl->dev, "HW_CONDITIONS 0x%02x/%d; link %d\n",
status, status, linkstat);
- twl->phy.last_event = linkstat;
-
/* REVISIT this assumes host and peripheral controllers
* are registered, and that both are active...
*/
spin_lock_irq(&twl->lock);
twl->linkstat = linkstat;
- if (linkstat == USB_EVENT_ID) {
+ if (linkstat == OMAP_MUSB_ID_GROUND) {
otg->default_a = true;
twl->phy.state = OTG_STATE_A_IDLE;
} else {
@@ -501,10 +502,10 @@ static DEVICE_ATTR(vbus, 0444, twl4030_usb_vbus_show, NULL);
static irqreturn_t twl4030_usb_irq(int irq, void *_twl)
{
struct twl4030_usb *twl = _twl;
- int status;
+ enum omap_musb_vbus_id_status status;
status = twl4030_usb_linkstat(twl);
- if (status >= 0) {
+ if (status > 0) {
/* FIXME add a set_power() method so that B-devices can
* configure the charger appropriately. It's not always
* correct to consume VBUS power, and how much current to
@@ -516,13 +517,13 @@ static irqreturn_t twl4030_usb_irq(int irq, void *_twl)
* USB_LINK_VBUS state. musb_hdrc won't care until it
* starts to handle softconnect right.
*/
- if (status == USB_EVENT_NONE)
+ if (status == OMAP_MUSB_VBUS_OFF ||
+ status == OMAP_MUSB_ID_FLOAT)
twl4030_phy_suspend(twl, 0);
else
twl4030_phy_resume(twl);
- atomic_notifier_call_chain(&twl->phy.notifier, status,
- twl->phy.otg->gadget);
+ omap_musb_mailbox(twl->linkstat);
}
sysfs_notify(&twl->dev->kobj, NULL, "vbus");
@@ -531,11 +532,12 @@ static irqreturn_t twl4030_usb_irq(int irq, void *_twl)
static void twl4030_usb_phy_init(struct twl4030_usb *twl)
{
- int status;
+ enum omap_musb_vbus_id_status status;
status = twl4030_usb_linkstat(twl);
- if (status >= 0) {
- if (status == USB_EVENT_NONE) {
+ if (status > 0) {
+ if (status == OMAP_MUSB_VBUS_OFF ||
+ status == OMAP_MUSB_ID_FLOAT) {
__twl4030_phy_power(twl, 0);
twl->asleep = 1;
} else {
@@ -543,8 +545,7 @@ static void twl4030_usb_phy_init(struct twl4030_usb *twl)
twl->asleep = 0;
}
- atomic_notifier_call_chain(&twl->phy.notifier, status,
- twl->phy.otg->gadget);
+ omap_musb_mailbox(twl->linkstat);
}
sysfs_notify(&twl->dev->kobj, NULL, "vbus");
}
@@ -613,6 +614,7 @@ static int __devinit twl4030_usb_probe(struct platform_device *pdev)
twl->usb_mode = pdata->usb_mode;
twl->vbus_supplied = false;
twl->asleep = 1;
+ twl->linkstat = OMAP_MUSB_UNKNOWN;
twl->phy.dev = twl->dev;
twl->phy.label = "twl4030";
@@ -639,8 +641,6 @@ static int __devinit twl4030_usb_probe(struct platform_device *pdev)
if (device_create_file(&pdev->dev, &dev_attr_vbus))
dev_warn(&pdev->dev, "could not create sysfs file\n");
- ATOMIC_INIT_NOTIFIER_HEAD(&twl->phy.notifier);
-
/* Our job is to use irqs and status from the power module
* to keep the transceiver disabled when nothing's connected.
*
diff --git a/drivers/usb/otg/twl6030-usb.c b/drivers/usb/otg/twl6030-usb.c
index dbee00a..6c75883 100644
--- a/drivers/usb/otg/twl6030-usb.c
+++ b/drivers/usb/otg/twl6030-usb.c
@@ -26,10 +26,10 @@
#include <linux/platform_device.h>
#include <linux/io.h>
#include <linux/usb/otg.h>
+#include <linux/usb/musb-omap.h>
#include <linux/i2c/twl.h>
#include <linux/regulator/consumer.h>
#include <linux/err.h>
-#include <linux/notifier.h>
#include <linux/slab.h>
#include <linux/delay.h>
@@ -100,7 +100,7 @@ struct twl6030_usb {
int irq1;
int irq2;
- u8 linkstat;
+ enum omap_musb_vbus_id_status linkstat;
u8 asleep;
bool irq_enabled;
bool vbus_enable;
@@ -147,7 +147,7 @@ static int twl6030_phy_init(struct usb_phy *x)
dev = twl->dev;
pdata = dev->platform_data;
- if (twl->linkstat == USB_EVENT_ID)
+ if (twl->linkstat == OMAP_MUSB_ID_GROUND)
pdata->phy_power(twl->dev, 1, 1);
else
pdata->phy_power(twl->dev, 0, 1);
@@ -235,13 +235,13 @@ static ssize_t twl6030_usb_vbus_show(struct device *dev,
spin_lock_irqsave(&twl->lock, flags);
switch (twl->linkstat) {
- case USB_EVENT_VBUS:
+ case OMAP_MUSB_VBUS_VALID:
ret = snprintf(buf, PAGE_SIZE, "vbus\n");
break;
- case USB_EVENT_ID:
+ case OMAP_MUSB_ID_GROUND:
ret = snprintf(buf, PAGE_SIZE, "id\n");
break;
- case USB_EVENT_NONE:
+ case OMAP_MUSB_VBUS_OFF:
ret = snprintf(buf, PAGE_SIZE, "none\n");
break;
default:
@@ -257,7 +257,7 @@ static irqreturn_t twl6030_usb_irq(int irq, void *_twl)
{
struct twl6030_usb *twl = _twl;
struct usb_otg *otg = twl->phy.otg;
- int status;
+ enum omap_musb_vbus_id_status status = OMAP_MUSB_UNKNOWN;
u8 vbus_state, hw_state;
hw_state = twl6030_readb(twl, TWL6030_MODULE_ID0, STS_HW_CONDITIONS);
@@ -268,22 +268,20 @@ static irqreturn_t twl6030_usb_irq(int irq, void *_twl)
if (vbus_state & VBUS_DET) {
regulator_enable(twl->usb3v3);
twl->asleep = 1;
- status = USB_EVENT_VBUS;
+ status = OMAP_MUSB_VBUS_VALID;
otg->default_a = false;
twl->phy.state = OTG_STATE_B_IDLE;
twl->linkstat = status;
- twl->phy.last_event = status;
- atomic_notifier_call_chain(&twl->phy.notifier,
- status, otg->gadget);
+ omap_musb_mailbox(status);
} else {
- status = USB_EVENT_NONE;
- twl->linkstat = status;
- twl->phy.last_event = status;
- atomic_notifier_call_chain(&twl->phy.notifier,
- status, otg->gadget);
- if (twl->asleep) {
- regulator_disable(twl->usb3v3);
- twl->asleep = 0;
+ if (twl->linkstat != OMAP_MUSB_UNKNOWN) {
+ status = OMAP_MUSB_VBUS_OFF;
+ twl->linkstat = status;
+ omap_musb_mailbox(status);
+ if (twl->asleep) {
+ regulator_disable(twl->usb3v3);
+ twl->asleep = 0;
+ }
}
}
}
@@ -296,7 +294,7 @@ static irqreturn_t twl6030_usbotg_irq(int irq, void *_twl)
{
struct twl6030_usb *twl = _twl;
struct usb_otg *otg = twl->phy.otg;
- int status = USB_EVENT_NONE;
+ enum omap_musb_vbus_id_status status = OMAP_MUSB_UNKNOWN;
u8 hw_state;
hw_state = twl6030_readb(twl, TWL6030_MODULE_ID0, STS_HW_CONDITIONS);
@@ -308,13 +306,11 @@ static irqreturn_t twl6030_usbotg_irq(int irq, void *_twl)
twl6030_writeb(twl, TWL_MODULE_USB, USB_ID_INT_EN_HI_CLR, 0x1);
twl6030_writeb(twl, TWL_MODULE_USB, USB_ID_INT_EN_HI_SET,
0x10);
- status = USB_EVENT_ID;
+ status = OMAP_MUSB_ID_GROUND;
otg->default_a = true;
twl->phy.state = OTG_STATE_A_IDLE;
twl->linkstat = status;
- twl->phy.last_event = status;
- atomic_notifier_call_chain(&twl->phy.notifier, status,
- otg->gadget);
+ omap_musb_mailbox(status);
} else {
twl6030_writeb(twl, TWL_MODULE_USB, USB_ID_INT_EN_HI_CLR,
0x10);
@@ -419,6 +415,7 @@ static int __devinit twl6030_usb_probe(struct platform_device *pdev)
twl->irq1 = platform_get_irq(pdev, 0);
twl->irq2 = platform_get_irq(pdev, 1);
twl->features = pdata->features;
+ twl->linkstat = OMAP_MUSB_UNKNOWN;
twl->phy.dev = twl->dev;
twl->phy.label = "twl6030";
@@ -449,8 +446,6 @@ static int __devinit twl6030_usb_probe(struct platform_device *pdev)
if (device_create_file(&pdev->dev, &dev_attr_vbus))
dev_warn(&pdev->dev, "could not create sysfs file\n");
- ATOMIC_INIT_NOTIFIER_HEAD(&twl->phy.notifier);
-
INIT_WORK(&twl->set_vbus_work, otg_set_vbus_work);
twl->irq_enabled = true;
diff --git a/include/linux/usb/musb-omap.h b/include/linux/usb/musb-omap.h
new file mode 100644
index 0000000..7774c59
--- /dev/null
+++ b/include/linux/usb/musb-omap.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2011-2012 by Texas Instruments
+ *
+ * The Inventra Controller Driver for Linux is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU
+ * General Public License version 2 as published by the Free Software
+ * Foundation.
+ */
+
+#ifndef __MUSB_OMAP_H__
+#define __MUSB_OMAP_H__
+
+enum omap_musb_vbus_id_status {
+ OMAP_MUSB_UNKNOWN = 0,
+ OMAP_MUSB_ID_GROUND,
+ OMAP_MUSB_ID_FLOAT,
+ OMAP_MUSB_VBUS_VALID,
+ OMAP_MUSB_VBUS_OFF,
+};
+
+#if (defined(CONFIG_USB_MUSB_OMAP2PLUS) || \
+ defined(CONFIG_USB_MUSB_OMAP2PLUS_MODULE))
+void omap_musb_mailbox(enum omap_musb_vbus_id_status status);
+#else
+static inline void omap_musb_mailbox(enum omap_musb_vbus_id_status status)
+{
+}
+#endif
+
+#endif /* __MUSB_OMAP_H__ */
--
1.7.5.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v3 3/5] drivers: usb: musb: move otg specific initializations from twl to glue
2012-06-22 12:10 [PATCH v3 0/5] usb: musb: cleanup Kishon Vijay Abraham I
2012-06-22 12:10 ` [PATCH v3 1/5] usb: musb: move work_struct(otg_notifier_work) from core to omap glue Kishon Vijay Abraham I
2012-06-22 12:10 ` [PATCH v3 2/5] usb: musb: twl: use mailbox API to send VBUS or ID events Kishon Vijay Abraham I
@ 2012-06-22 12:10 ` Kishon Vijay Abraham I
2012-06-22 12:10 ` [PATCH v3 4/5] usb: musb: omap: use devres API to allocate resources Kishon Vijay Abraham I
2012-06-22 12:10 ` [PATCH v3 5/5] drivers: usb: otg: twl: " Kishon Vijay Abraham I
4 siblings, 0 replies; 9+ messages in thread
From: Kishon Vijay Abraham I @ 2012-06-22 12:10 UTC (permalink / raw)
To: gregkh, kishon, linux-omap, linux-kernel, linux-usb, balbi
Moved otg specific state(OTG_STATE_B_IDLE, OTG_STATE_A_IDLE) initializations
from twl to glue. These initializations are removed from twl4030 and
twl6030 and moved to the mailbox API defined in glue.
This is part of the cleanup in preparation to make use of usb2 phy
driver.
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
drivers/usb/musb/omap2430.c | 5 +++++
drivers/usb/otg/twl4030-usb.c | 8 --------
drivers/usb/otg/twl6030-usb.c | 6 ------
3 files changed, 5 insertions(+), 14 deletions(-)
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index 0636870..c4dc92b 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -249,11 +249,14 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue)
struct device *dev = musb->controller;
struct musb_hdrc_platform_data *pdata = dev->platform_data;
struct omap_musb_board_data *data = pdata->board_data;
+ struct usb_otg *otg = musb->xceiv->otg;
switch (glue->status) {
case OMAP_MUSB_ID_GROUND:
dev_dbg(dev, "ID GND\n");
+ otg->default_a = true;
+ musb->xceiv->state = OTG_STATE_A_IDLE;
musb->xceiv->last_event = USB_EVENT_ID;
if (!is_otg_enabled(musb) || musb->gadget_driver) {
pm_runtime_get_sync(dev);
@@ -265,6 +268,8 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue)
case OMAP_MUSB_VBUS_VALID:
dev_dbg(dev, "VBUS Connect\n");
+ otg->default_a = false;
+ musb->xceiv->state = OTG_STATE_B_IDLE;
musb->xceiv->last_event = USB_EVENT_VBUS;
if (musb->gadget_driver)
pm_runtime_get_sync(dev);
diff --git a/drivers/usb/otg/twl4030-usb.c b/drivers/usb/otg/twl4030-usb.c
index 77f4ff6..990263e 100644
--- a/drivers/usb/otg/twl4030-usb.c
+++ b/drivers/usb/otg/twl4030-usb.c
@@ -251,7 +251,6 @@ static enum omap_musb_vbus_id_status
{
int status;
enum omap_musb_vbus_id_status linkstat = OMAP_MUSB_UNKNOWN;
- struct usb_otg *otg = twl->phy.otg;
twl->vbus_supplied = false;
@@ -291,13 +290,6 @@ static enum omap_musb_vbus_id_status
spin_lock_irq(&twl->lock);
twl->linkstat = linkstat;
- if (linkstat == OMAP_MUSB_ID_GROUND) {
- otg->default_a = true;
- twl->phy.state = OTG_STATE_A_IDLE;
- } else {
- otg->default_a = false;
- twl->phy.state = OTG_STATE_B_IDLE;
- }
spin_unlock_irq(&twl->lock);
return linkstat;
diff --git a/drivers/usb/otg/twl6030-usb.c b/drivers/usb/otg/twl6030-usb.c
index 6c75883..66cfea7 100644
--- a/drivers/usb/otg/twl6030-usb.c
+++ b/drivers/usb/otg/twl6030-usb.c
@@ -256,7 +256,6 @@ static DEVICE_ATTR(vbus, 0444, twl6030_usb_vbus_show, NULL);
static irqreturn_t twl6030_usb_irq(int irq, void *_twl)
{
struct twl6030_usb *twl = _twl;
- struct usb_otg *otg = twl->phy.otg;
enum omap_musb_vbus_id_status status = OMAP_MUSB_UNKNOWN;
u8 vbus_state, hw_state;
@@ -269,8 +268,6 @@ static irqreturn_t twl6030_usb_irq(int irq, void *_twl)
regulator_enable(twl->usb3v3);
twl->asleep = 1;
status = OMAP_MUSB_VBUS_VALID;
- otg->default_a = false;
- twl->phy.state = OTG_STATE_B_IDLE;
twl->linkstat = status;
omap_musb_mailbox(status);
} else {
@@ -293,7 +290,6 @@ static irqreturn_t twl6030_usb_irq(int irq, void *_twl)
static irqreturn_t twl6030_usbotg_irq(int irq, void *_twl)
{
struct twl6030_usb *twl = _twl;
- struct usb_otg *otg = twl->phy.otg;
enum omap_musb_vbus_id_status status = OMAP_MUSB_UNKNOWN;
u8 hw_state;
@@ -307,8 +303,6 @@ static irqreturn_t twl6030_usbotg_irq(int irq, void *_twl)
twl6030_writeb(twl, TWL_MODULE_USB, USB_ID_INT_EN_HI_SET,
0x10);
status = OMAP_MUSB_ID_GROUND;
- otg->default_a = true;
- twl->phy.state = OTG_STATE_A_IDLE;
twl->linkstat = status;
omap_musb_mailbox(status);
} else {
--
1.7.5.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v3 4/5] usb: musb: omap: use devres API to allocate resources
2012-06-22 12:10 [PATCH v3 0/5] usb: musb: cleanup Kishon Vijay Abraham I
` (2 preceding siblings ...)
2012-06-22 12:10 ` [PATCH v3 3/5] drivers: usb: musb: move otg specific initializations from twl to glue Kishon Vijay Abraham I
@ 2012-06-22 12:10 ` Kishon Vijay Abraham I
2012-06-22 12:10 ` [PATCH v3 5/5] drivers: usb: otg: twl: " Kishon Vijay Abraham I
4 siblings, 0 replies; 9+ messages in thread
From: Kishon Vijay Abraham I @ 2012-06-22 12:10 UTC (permalink / raw)
To: gregkh, kishon, linux-omap, linux-kernel, linux-usb, balbi
used devres API while allocating memory resource and while getting
usb phy so that these resources are released automatically on driver
detach.
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
This patch uses an API thats introduced in
[PATCH v7 0/3] usb: multi-phy support
drivers/usb/musb/omap2430.c | 19 +++++++------------
1 files changed, 7 insertions(+), 12 deletions(-)
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index c4dc92b..2813490 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -319,7 +319,7 @@ static int omap2430_musb_init(struct musb *musb)
* up through ULPI. TWL4030-family PMICs include one,
* which needs a driver, drivers aren't always needed.
*/
- musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
+ musb->xceiv = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2);
if (!musb->xceiv) {
pr_err("HS USB OTG: no transceiver configured\n");
return -ENODEV;
@@ -416,7 +416,6 @@ static int omap2430_musb_exit(struct musb *musb)
del_timer_sync(&musb_idle_timer);
omap2430_low_level_exit(musb);
- usb_put_phy(musb->xceiv);
return 0;
}
@@ -443,7 +442,7 @@ static int __devinit omap2430_probe(struct platform_device *pdev)
struct omap2430_glue *glue;
int ret = -ENOMEM;
- glue = kzalloc(sizeof(*glue), GFP_KERNEL);
+ glue = devm_kzalloc(&pdev->dev, sizeof(*glue), GFP_KERNEL);
if (!glue) {
dev_err(&pdev->dev, "failed to allocate glue context\n");
goto err0;
@@ -452,7 +451,7 @@ static int __devinit omap2430_probe(struct platform_device *pdev)
musb = platform_device_alloc("musb-hdrc", -1);
if (!musb) {
dev_err(&pdev->dev, "failed to allocate musb device\n");
- goto err1;
+ goto err0;
}
musb->dev.parent = &pdev->dev;
@@ -479,13 +478,13 @@ static int __devinit omap2430_probe(struct platform_device *pdev)
pdev->num_resources);
if (ret) {
dev_err(&pdev->dev, "failed to add resources\n");
- goto err2;
+ goto err1;
}
ret = platform_device_add_data(musb, pdata, sizeof(*pdata));
if (ret) {
dev_err(&pdev->dev, "failed to add platform_data\n");
- goto err2;
+ goto err1;
}
pm_runtime_enable(&pdev->dev);
@@ -493,16 +492,13 @@ static int __devinit omap2430_probe(struct platform_device *pdev)
ret = platform_device_add(musb);
if (ret) {
dev_err(&pdev->dev, "failed to register musb device\n");
- goto err2;
+ goto err1;
}
return 0;
-err2:
- platform_device_put(musb);
-
err1:
- kfree(glue);
+ platform_device_put(musb);
err0:
return ret;
@@ -515,7 +511,6 @@ static int __devexit omap2430_remove(struct platform_device *pdev)
cancel_work_sync(&glue->omap_musb_mailbox_work);
platform_device_del(glue->musb);
platform_device_put(glue->musb);
- kfree(glue);
return 0;
}
--
1.7.5.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v3 5/5] drivers: usb: otg: twl: use devres API to allocate resources
2012-06-22 12:10 [PATCH v3 0/5] usb: musb: cleanup Kishon Vijay Abraham I
` (3 preceding siblings ...)
2012-06-22 12:10 ` [PATCH v3 4/5] usb: musb: omap: use devres API to allocate resources Kishon Vijay Abraham I
@ 2012-06-22 12:10 ` Kishon Vijay Abraham I
4 siblings, 0 replies; 9+ messages in thread
From: Kishon Vijay Abraham I @ 2012-06-22 12:10 UTC (permalink / raw)
To: gregkh, kishon, linux-omap, linux-kernel, linux-usb, balbi
used devres API while allocating memory resource in twl4030 and twl6030
so that these resources are released automatically on driver detach.
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
drivers/usb/otg/twl4030-usb.c | 15 +++------------
drivers/usb/otg/twl6030-usb.c | 16 +++-------------
2 files changed, 6 insertions(+), 25 deletions(-)
diff --git a/drivers/usb/otg/twl4030-usb.c b/drivers/usb/otg/twl4030-usb.c
index 990263e..9da89b6 100644
--- a/drivers/usb/otg/twl4030-usb.c
+++ b/drivers/usb/otg/twl4030-usb.c
@@ -591,15 +591,13 @@ static int __devinit twl4030_usb_probe(struct platform_device *pdev)
return -EINVAL;
}
- twl = kzalloc(sizeof *twl, GFP_KERNEL);
+ twl = devm_kzalloc(&pdev->dev, sizeof *twl, GFP_KERNEL);
if (!twl)
return -ENOMEM;
- otg = kzalloc(sizeof *otg, GFP_KERNEL);
- if (!otg) {
- kfree(twl);
+ otg = devm_kzalloc(&pdev->dev, sizeof *otg, GFP_KERNEL);
+ if (!otg)
return -ENOMEM;
- }
twl->dev = &pdev->dev;
twl->irq = platform_get_irq(pdev, 0);
@@ -623,8 +621,6 @@ static int __devinit twl4030_usb_probe(struct platform_device *pdev)
err = twl4030_usb_ldo_init(twl);
if (err) {
dev_err(&pdev->dev, "ldo init failed\n");
- kfree(otg);
- kfree(twl);
return err;
}
usb_add_phy(&twl->phy, USB_PHY_TYPE_USB2);
@@ -648,8 +644,6 @@ static int __devinit twl4030_usb_probe(struct platform_device *pdev)
if (status < 0) {
dev_dbg(&pdev->dev, "can't get IRQ %d, err %d\n",
twl->irq, status);
- kfree(otg);
- kfree(twl);
return status;
}
@@ -693,9 +687,6 @@ static int __exit twl4030_usb_remove(struct platform_device *pdev)
regulator_put(twl->usb1v8);
regulator_put(twl->usb3v1);
- kfree(twl->phy.otg);
- kfree(twl);
-
return 0;
}
diff --git a/drivers/usb/otg/twl6030-usb.c b/drivers/usb/otg/twl6030-usb.c
index 66cfea7..600c27a 100644
--- a/drivers/usb/otg/twl6030-usb.c
+++ b/drivers/usb/otg/twl6030-usb.c
@@ -395,15 +395,13 @@ static int __devinit twl6030_usb_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev;
pdata = dev->platform_data;
- twl = kzalloc(sizeof *twl, GFP_KERNEL);
+ twl = devm_kzalloc(dev, sizeof *twl, GFP_KERNEL);
if (!twl)
return -ENOMEM;
- otg = kzalloc(sizeof *otg, GFP_KERNEL);
- if (!otg) {
- kfree(twl);
+ otg = devm_kzalloc(dev, sizeof *otg, GFP_KERNEL);
+ if (!otg)
return -ENOMEM;
- }
twl->dev = &pdev->dev;
twl->irq1 = platform_get_irq(pdev, 0);
@@ -430,8 +428,6 @@ static int __devinit twl6030_usb_probe(struct platform_device *pdev)
err = twl6030_usb_ldo_init(twl);
if (err) {
dev_err(&pdev->dev, "ldo init failed\n");
- kfree(otg);
- kfree(twl);
return err;
}
usb_add_phy(&twl->phy, USB_PHY_TYPE_USB2);
@@ -450,8 +446,6 @@ static int __devinit twl6030_usb_probe(struct platform_device *pdev)
dev_err(&pdev->dev, "can't get IRQ %d, err %d\n",
twl->irq1, status);
device_remove_file(twl->dev, &dev_attr_vbus);
- kfree(otg);
- kfree(twl);
return status;
}
@@ -463,8 +457,6 @@ static int __devinit twl6030_usb_probe(struct platform_device *pdev)
twl->irq2, status);
free_irq(twl->irq1, twl);
device_remove_file(twl->dev, &dev_attr_vbus);
- kfree(otg);
- kfree(twl);
return status;
}
@@ -495,8 +487,6 @@ static int __exit twl6030_usb_remove(struct platform_device *pdev)
pdata->phy_exit(twl->dev);
device_remove_file(twl->dev, &dev_attr_vbus);
cancel_work_sync(&twl->set_vbus_work);
- kfree(twl->phy.otg);
- kfree(twl);
return 0;
}
--
1.7.5.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* RE: [PATCH v3 2/5] usb: musb: twl: use mailbox API to send VBUS or ID events
2012-06-22 12:10 ` [PATCH v3 2/5] usb: musb: twl: use mailbox API to send VBUS or ID events Kishon Vijay Abraham I
@ 2012-07-03 17:39 ` Matcovschi, Oleg
[not found] ` <E0D6B3D7803B1A49AC7CEA9958379F630375BD5A-yhyrjsqURdeIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
0 siblings, 1 reply; 9+ messages in thread
From: Matcovschi, Oleg @ 2012-07-03 17:39 UTC (permalink / raw)
To: ABRAHAM, KISHON VIJAY, gregkh@linuxfoundation.org,
linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-usb@vger.kernel.org, Balbi, Felipe
>From: linux-omap-owner@vger.kernel.org [linux-omap-owner@vger.kernel.org] on behalf of ABRAHAM, KISHON VIJAY
>Sent: Friday, June 22, 2012 5:10 AM
>To: gregkh@linuxfoundation.org; ABRAHAM, KISHON VIJAY; linux-omap@vger.kernel.org; linux-kernel@vger.kernel.org; linux-usb@vger.kernel.org; Balbi, Felipe
>Subject: [PATCH v3 2/5] usb: musb: twl: use mailbox API to send VBUS or ID events
>The atomic notifier from twl4030/twl6030 to notifiy VBUS and ID events,
>is replaced by a direct call to omap musb blue.
>Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
>---
> drivers/usb/musb/omap2430.c | 94 +++++++++++++++++++++++++---------------
> drivers/usb/otg/twl4030-usb.c | 46 ++++++++++----------
> drivers/usb/otg/twl6030-usb.c | 47 +++++++++-----------
> include/linux/usb/musb-omap.h | 30 +++++++++++++
> 4 files changed, 133 insertions(+), 84 deletions(-)
> create mode 100644 include/linux/usb/musb-omap.h
.....
+enum omap_musb_vbus_id_status {
+ OMAP_MUSB_UNKNOWN = 0,
+ OMAP_MUSB_ID_GROUND,
+ OMAP_MUSB_ID_FLOAT,
+ OMAP_MUSB_VBUS_VALID,
+ OMAP_MUSB_VBUS_OFF,
+};
+
Why did you choose to introduce OMAP_MUSB specific VBUS, ID events?
IMHO, it makes more sense to introduce mailbox functionality only without extra translation layer.
Same mailbox glue layer could be used for other PHY drivers, not just twl.
thanks,
Oleg
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v3 2/5] usb: musb: twl: use mailbox API to send VBUS or ID events
[not found] ` <E0D6B3D7803B1A49AC7CEA9958379F630375BD5A-yhyrjsqURdeIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
@ 2012-07-04 5:47 ` ABRAHAM, KISHON VIJAY
[not found] ` <CAAe_U6+3sf5Nm5bQeY=Pi=sYMPp3GfXWxfbbbo1mSH2u9xjTyQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
0 siblings, 1 reply; 9+ messages in thread
From: ABRAHAM, KISHON VIJAY @ 2012-07-04 5:47 UTC (permalink / raw)
To: Matcovschi, Oleg
Cc: gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org,
linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Balbi, Felipe
Hi Oleg,
On Tue, Jul 3, 2012 at 11:09 PM, Matcovschi, Oleg
<oleg.matcovschi-l0cyMroinI0@public.gmane.org> wrote:
>>From: linux-omap-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org [linux-omap-owner-u79uwXL29TasMV2rI37PzA@public.gmane.orgorg] on behalf of ABRAHAM, KISHON VIJAY
>>Sent: Friday, June 22, 2012 5:10 AM
>>To: gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org; ABRAHAM, KISHON VIJAY; linux-omap@vger.kernel.org; linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; Balbi, Felipe
>>Subject: [PATCH v3 2/5] usb: musb: twl: use mailbox API to send VBUS or ID events
>
>>The atomic notifier from twl4030/twl6030 to notifiy VBUS and ID events,
>>is replaced by a direct call to omap musb blue.
>
>>Signed-off-by: Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org>
>>---
>> drivers/usb/musb/omap2430.c | 94 +++++++++++++++++++++++++---------------
>> drivers/usb/otg/twl4030-usb.c | 46 ++++++++++----------
>> drivers/usb/otg/twl6030-usb.c | 47 +++++++++-----------
>> include/linux/usb/musb-omap.h | 30 +++++++++++++
>> 4 files changed, 133 insertions(+), 84 deletions(-)
>> create mode 100644 include/linux/usb/musb-omap.h
> .....
> +enum omap_musb_vbus_id_status {
> + OMAP_MUSB_UNKNOWN = 0,
> + OMAP_MUSB_ID_GROUND,
> + OMAP_MUSB_ID_FLOAT,
> + OMAP_MUSB_VBUS_VALID,
> + OMAP_MUSB_VBUS_OFF,
> +};
> +
>
> Why did you choose to introduce OMAP_MUSB specific VBUS, ID events?
> IMHO, it makes more sense to introduce mailbox functionality only without extra translation layer.
> Same mailbox glue layer could be used for other PHY drivers, not just twl.
We've decided to make twl as a comparator driver since we have a
separate phy driver (not yet merged). Hence we dint want twl to use
usb_phy specific events. So if you have other PHY drivers, you can
still use the OMAP_MUSB specific events.
Thanks
Kishon
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [PATCH v3 2/5] usb: musb: twl: use mailbox API to send VBUS or ID events
[not found] ` <CAAe_U6+3sf5Nm5bQeY=Pi=sYMPp3GfXWxfbbbo1mSH2u9xjTyQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2012-07-06 5:52 ` Matcovschi, Oleg
0 siblings, 0 replies; 9+ messages in thread
From: Matcovschi, Oleg @ 2012-07-06 5:52 UTC (permalink / raw)
To: ABRAHAM, KISHON VIJAY
Cc: gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org,
linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Balbi, Felipe
Hi Kishon,
>-----Original Message-----
>From: ABRAHAM, KISHON VIJAY
>Sent: Tuesday, July 03, 2012 10:48 PM
>To: Matcovschi, Oleg
>Cc: gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org; linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; >Balbi, Felipe
>Subject: Re: [PATCH v3 2/5] usb: musb: twl: use mailbox API to send VBUS or ID events
>Hi Oleg,
>On Tue, Jul 3, 2012 at 11:09 PM, Matcovschi, Oleg <oleg.matcovschi@ti.com> wrote:
>>>From: linux-omap-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>>>[linux-omap-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org] on behalf of ABRAHAM, KISHON VIJAY
>>>Sent: Friday, June 22, 2012 5:10 AM
>>>To: gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org; ABRAHAM, KISHON VIJAY;
>>>linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org;
>>>linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; Balbi, Felipe
>>>Subject: [PATCH v3 2/5] usb: musb: twl: use mailbox API to send VBUS
>>>or ID events
>>
>>>The atomic notifier from twl4030/twl6030 to notifiy VBUS and ID
>>>events, is replaced by a direct call to omap musb blue.
>>
>>>Signed-off-by: Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org>
>>>---
>>> drivers/usb/musb/omap2430.c | 94
>>>+++++++++++++++++++++++++---------------
>>> drivers/usb/otg/twl4030-usb.c | 46 ++++++++++----------
>>>drivers/usb/otg/twl6030-usb.c | 47 +++++++++-----------
>>>include/linux/usb/musb-omap.h | 30 +++++++++++++
>>> 4 files changed, 133 insertions(+), 84 deletions(-) create mode
>>>100644 include/linux/usb/musb-omap.h
>> .....
>> +enum omap_musb_vbus_id_status {
>> + OMAP_MUSB_UNKNOWN = 0,
>> + OMAP_MUSB_ID_GROUND,
>> + OMAP_MUSB_ID_FLOAT,
>> + OMAP_MUSB_VBUS_VALID,
>> + OMAP_MUSB_VBUS_OFF,
>> +};
>> +
>>
>> Why did you choose to introduce OMAP_MUSB specific VBUS, ID events?
>> IMHO, it makes more sense to introduce mailbox functionality only without extra translation layer.
>> Same mailbox glue layer could be used for other PHY drivers, not just twl.
>We've decided to make twl as a comparator driver since we have a separate phy driver (not yet merged). Hence we dint >want twl to use usb_phy specific events. So if you have other PHY drivers, you can still use the OMAP_MUSB specific >events.
>Thanks
>Kishon
In other words: you are proposing to have 2 flavors of other phy drivers(OMAP and not-OMAP platform specific)...
Do you think it is necessary?
Could you please provide full description of your original problem?
Regards,
Oleg
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2012-07-06 5:52 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-22 12:10 [PATCH v3 0/5] usb: musb: cleanup Kishon Vijay Abraham I
2012-06-22 12:10 ` [PATCH v3 1/5] usb: musb: move work_struct(otg_notifier_work) from core to omap glue Kishon Vijay Abraham I
2012-06-22 12:10 ` [PATCH v3 2/5] usb: musb: twl: use mailbox API to send VBUS or ID events Kishon Vijay Abraham I
2012-07-03 17:39 ` Matcovschi, Oleg
[not found] ` <E0D6B3D7803B1A49AC7CEA9958379F630375BD5A-yhyrjsqURdeIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2012-07-04 5:47 ` ABRAHAM, KISHON VIJAY
[not found] ` <CAAe_U6+3sf5Nm5bQeY=Pi=sYMPp3GfXWxfbbbo1mSH2u9xjTyQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-07-06 5:52 ` Matcovschi, Oleg
2012-06-22 12:10 ` [PATCH v3 3/5] drivers: usb: musb: move otg specific initializations from twl to glue Kishon Vijay Abraham I
2012-06-22 12:10 ` [PATCH v3 4/5] usb: musb: omap: use devres API to allocate resources Kishon Vijay Abraham I
2012-06-22 12:10 ` [PATCH v3 5/5] drivers: usb: otg: twl: " Kishon Vijay Abraham I
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).