* [PATCH 02/11] usb: musb: kill global and static for multi instance
2012-07-12 9:53 [PATCH 00/11] usb: musb: adding multi instance support Ajay Kumar Gupta
@ 2012-07-12 9:53 ` Ajay Kumar Gupta
2012-07-12 9:53 ` [PATCH 03/11] usb: musb: am335x: add support for dual instance Ajay Kumar Gupta
` (5 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: Ajay Kumar Gupta @ 2012-07-12 9:53 UTC (permalink / raw)
To: linux-usb
Cc: linux-omap, balbi, grant.likely, devicetree-discuss, tony,
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 <ajay.gupta@ti.com>
---
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;
+ char name[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
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 03/11] usb: musb: am335x: add support for dual instance
2012-07-12 9:53 [PATCH 00/11] usb: musb: adding multi instance support Ajay Kumar Gupta
2012-07-12 9:53 ` [PATCH 02/11] usb: musb: kill global and static for multi instance Ajay Kumar Gupta
@ 2012-07-12 9:53 ` Ajay Kumar Gupta
2012-07-12 9:53 ` [PATCH 05/11] usb: musb: dsps: add dt support Ajay Kumar Gupta
` (4 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: Ajay Kumar Gupta @ 2012-07-12 9:53 UTC (permalink / raw)
To: linux-usb
Cc: linux-omap, balbi, grant.likely, devicetree-discuss, tony,
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 <ajay.gupta@ti.com>
---
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_timer(&glue->timer,
+ mod_timer(&glue->timer[musb->id],
jiffies + wrp->poll_seconds * HZ);
WARNING("VBUS error workaround (delay coming)\n");
} else if (is_host_enabled(musb) && drvvbus) {
@@ -368,7 +372,7 @@ static irqreturn_t dsps_interrupt(int irq, void *hci)
MUSB_HST_MODE(musb);
musb->xceiv->otg->default_a = 1;
musb->xceiv->state = OTG_STATE_A_WAIT_VRISE;
- del_timer(&glue->timer);
+ del_timer(&glue->timer[musb->id]);
} else {
musb->is_active = 0;
MUSB_DEV_MODE(musb);
@@ -395,7 +399,8 @@ static irqreturn_t dsps_interrupt(int irq, void *hci)
/* Poll for ID change */
if (is_otg_enabled(musb) && musb->xceiv->state == OTG_STATE_B_IDLE)
- mod_timer(&glue->timer, jiffies + wrp->poll_seconds * HZ);
+ mod_timer(&glue->timer[musb->id],
+ jiffies + wrp->poll_seconds * HZ);
spin_unlock_irqrestore(&musb->lock, flags);
@@ -429,13 +434,14 @@ static int dsps_musb_init(struct musb *musb)
}
if (is_host_enabled(musb))
- setup_timer(&glue->timer, otg_timer, (unsigned long) musb);
+ setup_timer(&glue->timer[musb->id], otg_timer,
+ (unsigned long) musb);
/* Reset the musb */
dsps_writel(reg_base, wrp->control, (1 << wrp->reset));
/* Start the on-chip PHY and its PLL. */
- musb_dsps_phy_control(glue, 1);
+ musb_dsps_phy_control(glue, musb->id, 1);
musb->isr = dsps_interrupt;
@@ -461,10 +467,10 @@ static int dsps_musb_exit(struct musb *musb)
struct dsps_glue *glue = platform_get_drvdata(pdev);
if (is_host_enabled(musb))
- del_timer_sync(&glue->timer);
+ del_timer_sync(&glue->timer[musb->id]);
/* Shutdown the on-chip PHY and its PLL. */
- musb_dsps_phy_control(glue, 0);
+ musb_dsps_phy_control(glue, musb->id, 0);
/* NOP driver needs change if supporting dual instance */
usb_put_phy(musb->xceiv);
@@ -504,8 +510,8 @@ static int __devinit dsps_create_musb_pdev(struct dsps_glue *glue, u8 id)
goto err0;
}
- glue->usb_ctrl = devm_request_and_ioremap(&pdev->dev, res);
- if (glue->usb_ctrl == NULL) {
+ glue->usb_ctrl[id] = devm_request_and_ioremap(&pdev->dev, res);
+ if (glue->usb_ctrl[id] == NULL) {
dev_err(dev, "Failed to obtain usb_ctrl%d memory\n", id);
ret = -ENODEV;
goto err0;
@@ -542,11 +548,12 @@ static int __devinit dsps_create_musb_pdev(struct dsps_glue *glue, u8 id)
goto err0;
}
+ musb->id = id;
musb->dev.parent = dev;
musb->dev.dma_mask = &musb_dmamask;
musb->dev.coherent_dma_mask = musb_dmamask;
- glue->musb = musb;
+ glue->musb[id] = musb;
pdata->platform_ops = &dsps_ops;
@@ -576,10 +583,10 @@ err0:
return ret;
}
-static void __devexit dsps_delete_musb_pdev(struct dsps_glue *glue)
+static void __devexit dsps_delete_musb_pdev(struct dsps_glue *glue, u8 id)
{
- platform_device_del(glue->musb);
- platform_device_put(glue->musb);
+ platform_device_del(glue->musb[id]);
+ platform_device_put(glue->musb[id]);
}
static int __devinit dsps_probe(struct platform_device *pdev)
@@ -590,7 +597,7 @@ static int __devinit dsps_probe(struct platform_device *pdev)
struct dsps_glue *glue;
struct resource *iomem;
u32 __iomem *usbss;
- int ret;
+ int ret, i;
/* allocate glue */
glue = kzalloc(sizeof(*glue), GFP_KERNEL);
@@ -634,11 +641,16 @@ static int __devinit dsps_probe(struct platform_device *pdev)
goto err2;
}
- /* create the child platform device for first instances of musb */
- ret = dsps_create_musb_pdev(glue, 0);
- if (ret != 0) {
- dev_err(&pdev->dev, "failed to create child pdev\n");
- goto err3;
+ /* create the child platform device for all instances of musb */
+ for (i = 0; i < wrp->instances ; i++) {
+ ret = dsps_create_musb_pdev(glue, i);
+ if (ret != 0) {
+ dev_err(&pdev->dev, "failed to create child pdev\n");
+ /* release resources of previously created instances */
+ for (i--; i >= 0 ; i--)
+ dsps_delete_musb_pdev(glue, i);
+ goto err3;
+ }
}
/* read the usbss revision register */
@@ -659,9 +671,12 @@ err0:
static int __devexit dsps_remove(struct platform_device *pdev)
{
struct dsps_glue *glue = platform_get_drvdata(pdev);
+ const struct dsps_musb_wrapper *wrp = glue->wrp;
+ int i;
/* delete the child platform device */
- dsps_delete_musb_pdev(glue);
+ for (i = 0; i < wrp->instances ; i++)
+ dsps_delete_musb_pdev(glue, i);
/* disable usbss clocks */
pm_runtime_put(&pdev->dev);
@@ -676,9 +691,12 @@ static int dsps_suspend(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev->parent);
struct dsps_glue *glue = platform_get_drvdata(pdev);
+ const struct dsps_musb_wrapper *wrp = glue->wrp;
+ int i;
/* Shutdown the on-chip PHY and its PLL. */
- musb_dsps_phy_control(glue, 0);
+ for (i = 0 ; i < wrp->instances ; i++)
+ musb_dsps_phy_control(glue, i, 0);
return 0;
}
@@ -687,9 +705,12 @@ static int dsps_resume(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev->parent);
struct dsps_glue *glue = platform_get_drvdata(pdev);
+ const struct dsps_musb_wrapper *wrp = glue->wrp;
+ int i;
/* Start the on-chip PHY and its PLL. */
- musb_dsps_phy_control(glue, 1);
+ for (i = 0 ; i < wrp->instances ; i++)
+ musb_dsps_phy_control(glue, i, 1);
return 0;
}
@@ -725,6 +746,7 @@ static const struct dsps_musb_wrapper ti81xx_driver_data __devinitconst = {
.rxep_bitmap = (0xfffe << 16),
.musb_core_offset = 0x400,
.poll_seconds = 2,
+ .instances = 2,
};
static const struct platform_device_id musb_dsps_id_table[] __devinitconst = {
--
1.7.0.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 05/11] usb: musb: dsps: add dt support
2012-07-12 9:53 [PATCH 00/11] usb: musb: adding multi instance support Ajay Kumar Gupta
2012-07-12 9:53 ` [PATCH 02/11] usb: musb: kill global and static for multi instance Ajay Kumar Gupta
2012-07-12 9:53 ` [PATCH 03/11] usb: musb: am335x: add support for dual instance Ajay Kumar Gupta
@ 2012-07-12 9:53 ` Ajay Kumar Gupta
2012-07-12 9:53 ` [PATCH 07/11] usb: otg: nop: " Ajay Kumar Gupta
` (3 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: Ajay Kumar Gupta @ 2012-07-12 9:53 UTC (permalink / raw)
To: linux-usb
Cc: linux-omap, balbi, grant.likely, devicetree-discuss, tony,
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 <ajay.gupta@ti.com>
---
.../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 0000000..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 <linux/init.h>
#include <linux/io.h>
+#include <linux/of.h>
#include <linux/err.h>
#include <linux/platform_device.h>
#include <linux/dma-mapping.h>
@@ -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;
+
/* allocate glue */
glue = kzalloc(sizeof(*glue), GFP_KERNEL);
if (!glue) {
@@ -758,13 +799,16 @@ static const struct platform_device_id musb_dsps_id_table[] __devinitconst = {
};
MODULE_DEVICE_TABLE(platform, musb_dsps_id_table);
+#ifdef CONFIG_OF
static const struct of_device_id musb_dsps_of_match[] __devinitconst = {
- { .compatible = "musb-ti81xx", },
- { .compatible = "ti,ti81xx-musb", },
- { .compatible = "ti,am335x-musb", },
+ { .compatible = "ti,musb-am33xx",
+ .data = (void *) &ti81xx_driver_data, },
{ },
};
MODULE_DEVICE_TABLE(of, musb_dsps_of_match);
+#else
+#define musb_dsps_of_match NULL
+#endif
static struct platform_driver dsps_usbss_driver = {
.probe = dsps_probe,
@@ -772,7 +816,7 @@ static struct platform_driver dsps_usbss_driver = {
.driver = {
.name = "musb-dsps",
.pm = &dsps_pm_ops,
- .of_match_table = musb_dsps_of_match,
+ .of_match_table = of_match_ptr(musb_dsps_of_match),
},
.id_table = musb_dsps_id_table,
};
--
1.7.0.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 07/11] usb: otg: nop: add dt support
2012-07-12 9:53 [PATCH 00/11] usb: musb: adding multi instance support Ajay Kumar Gupta
` (2 preceding siblings ...)
2012-07-12 9:53 ` [PATCH 05/11] usb: musb: dsps: add dt support Ajay Kumar Gupta
@ 2012-07-12 9:53 ` Ajay Kumar Gupta
2012-07-12 9:53 ` [PATCH 08/11] arm/dts: am33xx: add dt data for usb nop phy Ajay Kumar Gupta
` (2 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: Ajay Kumar Gupta @ 2012-07-12 9:53 UTC (permalink / raw)
To: linux-usb
Cc: linux-omap, balbi, grant.likely, devicetree-discuss, tony,
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 <ajay.gupta@ti.com>
---
.../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 <linux/module.h>
+#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/dma-mapping.h>
#include <linux/usb/otg.h>
@@ -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
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 08/11] arm/dts: am33xx: add dt data for usb nop phy
2012-07-12 9:53 [PATCH 00/11] usb: musb: adding multi instance support Ajay Kumar Gupta
` (3 preceding siblings ...)
2012-07-12 9:53 ` [PATCH 07/11] usb: otg: nop: " Ajay Kumar Gupta
@ 2012-07-12 9:53 ` Ajay Kumar Gupta
[not found] ` <1342086814-32181-1-git-send-email-ajay.gupta-l0cyMroinI0@public.gmane.org>
2012-07-12 9:53 ` [PATCH 11/11] arm/dts: am33xx: add phy phandle to usbss Ajay Kumar Gupta
6 siblings, 0 replies; 12+ messages in thread
From: Ajay Kumar Gupta @ 2012-07-12 9:53 UTC (permalink / raw)
To: linux-usb
Cc: linux-omap, balbi, grant.likely, devicetree-discuss, tony,
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 <ajay.gupta@ti.com>
---
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@47400000 {
compatible = "ti,musb-am33xx";
ti,hwmods = "usb_otg_hs";
--
1.7.0.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
[parent not found: <1342086814-32181-1-git-send-email-ajay.gupta-l0cyMroinI0@public.gmane.org>]
* [PATCH 01/11] usb: musb: add musb->id to identify core instance
[not found] ` <1342086814-32181-1-git-send-email-ajay.gupta-l0cyMroinI0@public.gmane.org>
@ 2012-07-12 9:53 ` Ajay Kumar Gupta
2012-07-12 9:53 ` [PATCH 04/11] usb: otg: nop: add support for multiple tranceiver Ajay Kumar Gupta
` (3 subsequent siblings)
4 siblings, 0 replies; 12+ messages in thread
From: Ajay Kumar Gupta @ 2012-07-12 9:53 UTC (permalink / raw)
To: linux-usb-u79uwXL29TY76Z2rM5mHXA
Cc: linux-omap-u79uwXL29TY76Z2rM5mHXA, balbi-l0cyMroinI0,
grant.likely-s3s/WqlpOiPyB63q8FvJNQ,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
tony-4v6yS6AI5VpBDgjK7y7TUQ, 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 <ajay.gupta-l0cyMroinI0@public.gmane.org>
---
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("musb-hdrc", -1);
+ musb = platform_device_alloc("musb-hdrc", pdev->id);
if (!musb) {
dev_err(&pdev->dev, "failed to allocate musb device\n");
goto err0;
diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c
index 1a1bd9c..901aa05 100644
--- a/drivers/usb/musb/tusb6010.c
+++ b/drivers/usb/musb/tusb6010.c
@@ -1182,7 +1182,7 @@ static int __devinit tusb_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/ux500.c b/drivers/usb/musb/ux500.c
index a8c0fad..1eafb7c 100644
--- a/drivers/usb/musb/ux500.c
+++ b/drivers/usb/musb/ux500.c
@@ -74,7 +74,7 @@ static int __devinit ux500_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;
--
1.7.0.4
--
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 related [flat|nested] 12+ messages in thread
* [PATCH 04/11] usb: otg: nop: add support for multiple tranceiver
[not found] ` <1342086814-32181-1-git-send-email-ajay.gupta-l0cyMroinI0@public.gmane.org>
2012-07-12 9:53 ` [PATCH 01/11] usb: musb: add musb->id to identify core instance Ajay Kumar Gupta
@ 2012-07-12 9:53 ` Ajay Kumar Gupta
2012-07-12 9:53 ` [PATCH 06/11] arm/dts: am33xx: Add dt data for usbss Ajay Kumar Gupta
` (2 subsequent siblings)
4 siblings, 0 replies; 12+ messages in thread
From: Ajay Kumar Gupta @ 2012-07-12 9:53 UTC (permalink / raw)
To: linux-usb-u79uwXL29TY76Z2rM5mHXA
Cc: linux-omap-u79uwXL29TY76Z2rM5mHXA, balbi-l0cyMroinI0,
grant.likely-s3s/WqlpOiPyB63q8FvJNQ,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
tony-4v6yS6AI5VpBDgjK7y7TUQ, 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 <ajay.gupta-l0cyMroinI0@public.gmane.org>
---
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 dual instance */
- usb_nop_xceiv_register();
+ /* Register NOP driver */
+ usb_nop_xceiv_register(musb->id);
musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
if (IS_ERR_OR_NULL(musb->xceiv))
return -ENODEV;
@@ -456,7 +456,7 @@ static int dsps_musb_init(struct musb *musb)
return 0;
err0:
usb_put_phy(musb->xceiv);
- usb_nop_xceiv_unregister();
+ usb_nop_xceiv_unregister(musb->xceiv);
return status;
}
@@ -472,9 +472,9 @@ static int dsps_musb_exit(struct musb *musb)
/* Shutdown the on-chip PHY and its PLL. */
musb_dsps_phy_control(glue, musb->id, 0);
- /* NOP driver needs change if supporting dual instance */
+ /* Unregister NOP driver */
usb_put_phy(musb->xceiv);
- usb_nop_xceiv_unregister();
+ usb_nop_xceiv_unregister(musb->xceiv);
return 0;
}
diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c
index 901aa05..9d2b99c 100644
--- a/drivers/usb/musb/tusb6010.c
+++ b/drivers/usb/musb/tusb6010.c
@@ -1078,7 +1078,7 @@ static int tusb_musb_init(struct musb *musb)
void __iomem *sync = NULL;
int ret;
- 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;
@@ -1132,7 +1132,7 @@ done:
iounmap(sync);
usb_put_phy(musb->xceiv);
- usb_nop_xceiv_unregister();
+ usb_nop_xceiv_unregister(musb->xceiv);
}
return ret;
}
@@ -1148,7 +1148,7 @@ static int tusb_musb_exit(struct musb *musb)
iounmap(musb->sync_va);
usb_put_phy(musb->xceiv);
- usb_nop_xceiv_unregister();
+ usb_nop_xceiv_unregister(musb->xceiv);
return 0;
}
diff --git a/drivers/usb/otg/nop-usb-xceiv.c b/drivers/usb/otg/nop-usb-xceiv.c
index 803f958..2e5e889 100644
--- a/drivers/usb/otg/nop-usb-xceiv.c
+++ b/drivers/usb/otg/nop-usb-xceiv.c
@@ -35,15 +35,14 @@
struct nop_usb_xceiv {
struct usb_phy phy;
struct device *dev;
+ struct platform_device *pd;
};
-static struct platform_device *pd;
-
-void usb_nop_xceiv_register(void)
+void usb_nop_xceiv_register(int id)
{
- if (pd)
- return;
- pd = platform_device_register_simple("nop_usb_xceiv", -1, NULL, 0);
+ struct platform_device *pd;
+
+ pd = platform_device_register_simple("nop_usb_xceiv", id, NULL, 0);
if (!pd) {
printk(KERN_ERR "Unable to register usb nop transceiver\n");
return;
@@ -51,10 +50,13 @@ void usb_nop_xceiv_register(void)
}
EXPORT_SYMBOL(usb_nop_xceiv_register);
-void usb_nop_xceiv_unregister(void)
+void usb_nop_xceiv_unregister(struct usb_phy *phy)
{
+ struct nop_usb_xceiv *nop = container_of(phy,
+ struct nop_usb_xceiv, phy);
+ struct platform_device *pd = nop->pd;
+
platform_device_unregister(pd);
- pd = NULL;
}
EXPORT_SYMBOL(usb_nop_xceiv_unregister);
@@ -107,11 +109,13 @@ static int __devinit nop_usb_xceiv_probe(struct platform_device *pdev)
return -ENOMEM;
}
+ nop->pd = pdev;
nop->dev = &pdev->dev;
nop->phy.dev = nop->dev;
nop->phy.label = "nop-xceiv";
nop->phy.set_suspend = nop_set_suspend;
nop->phy.state = OTG_STATE_UNDEFINED;
+ nop->phy.id = pdev->id;
nop->phy.otg->phy = &nop->phy;
nop->phy.otg->set_host = nop_set_host;
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index 4636d39..36cc791 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -95,6 +95,7 @@ struct usb_phy {
struct device *dev;
const char *label;
unsigned int flags;
+ u8 id;
enum usb_phy_type type;
enum usb_otg_state state;
@@ -137,14 +138,14 @@ extern void usb_remove_phy(struct usb_phy *);
#if defined(CONFIG_NOP_USB_XCEIV) || (defined(CONFIG_NOP_USB_XCEIV_MODULE) && defined(MODULE))
/* sometimes transceivers are accessed only through e.g. ULPI */
-extern void usb_nop_xceiv_register(void);
-extern void usb_nop_xceiv_unregister(void);
+extern void usb_nop_xceiv_register(int id);
+extern void usb_nop_xceiv_unregister(struct usb_phy *);
#else
-static inline void usb_nop_xceiv_register(void)
+static inline void usb_nop_xceiv_register(int id)
{
}
-static inline void usb_nop_xceiv_unregister(void)
+static inline void usb_nop_xceiv_unregister(struct usb_phy *phy)
{
}
#endif
--
1.7.0.4
--
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 related [flat|nested] 12+ messages in thread
* [PATCH 06/11] arm/dts: am33xx: Add dt data for usbss
[not found] ` <1342086814-32181-1-git-send-email-ajay.gupta-l0cyMroinI0@public.gmane.org>
2012-07-12 9:53 ` [PATCH 01/11] usb: musb: add musb->id to identify core instance Ajay Kumar Gupta
2012-07-12 9:53 ` [PATCH 04/11] usb: otg: nop: add support for multiple tranceiver Ajay Kumar Gupta
@ 2012-07-12 9:53 ` Ajay Kumar Gupta
2012-07-12 9:53 ` [PATCH 09/11] usb: musb: dsps: remove explicit NOP device creation Ajay Kumar Gupta
2012-07-12 9:53 ` [PATCH 10/11] usb: musb: dsps: get the PHY using phandle api Ajay Kumar Gupta
4 siblings, 0 replies; 12+ messages in thread
From: Ajay Kumar Gupta @ 2012-07-12 9:53 UTC (permalink / raw)
To: linux-usb-u79uwXL29TY76Z2rM5mHXA
Cc: linux-omap-u79uwXL29TY76Z2rM5mHXA, balbi-l0cyMroinI0,
grant.likely-s3s/WqlpOiPyB63q8FvJNQ,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
tony-4v6yS6AI5VpBDgjK7y7TUQ, 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 <ajay.gupta-l0cyMroinI0@public.gmane.org>
---
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@47400000 {
+ 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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 09/11] usb: musb: dsps: remove explicit NOP device creation
[not found] ` <1342086814-32181-1-git-send-email-ajay.gupta-l0cyMroinI0@public.gmane.org>
` (2 preceding siblings ...)
2012-07-12 9:53 ` [PATCH 06/11] arm/dts: am33xx: Add dt data for usbss Ajay Kumar Gupta
@ 2012-07-12 9:53 ` Ajay Kumar Gupta
2012-07-12 9:53 ` [PATCH 10/11] usb: musb: dsps: get the PHY using phandle api Ajay Kumar Gupta
4 siblings, 0 replies; 12+ messages in thread
From: Ajay Kumar Gupta @ 2012-07-12 9:53 UTC (permalink / raw)
To: linux-usb-u79uwXL29TY76Z2rM5mHXA
Cc: linux-omap-u79uwXL29TY76Z2rM5mHXA, balbi-l0cyMroinI0,
grant.likely-s3s/WqlpOiPyB63q8FvJNQ,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
tony-4v6yS6AI5VpBDgjK7y7TUQ, 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 <ajay.gupta-l0cyMroinI0@public.gmane.org>
---
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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 10/11] usb: musb: dsps: get the PHY using phandle api
[not found] ` <1342086814-32181-1-git-send-email-ajay.gupta-l0cyMroinI0@public.gmane.org>
` (3 preceding siblings ...)
2012-07-12 9:53 ` [PATCH 09/11] usb: musb: dsps: remove explicit NOP device creation Ajay Kumar Gupta
@ 2012-07-12 9:53 ` Ajay Kumar Gupta
4 siblings, 0 replies; 12+ messages in thread
From: Ajay Kumar Gupta @ 2012-07-12 9:53 UTC (permalink / raw)
To: linux-usb-u79uwXL29TY76Z2rM5mHXA
Cc: linux-omap-u79uwXL29TY76Z2rM5mHXA, balbi-l0cyMroinI0,
grant.likely-s3s/WqlpOiPyB63q8FvJNQ,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
tony-4v6yS6AI5VpBDgjK7y7TUQ, 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 <ajay.gupta-l0cyMroinI0@public.gmane.org>
---
.../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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 11/11] arm/dts: am33xx: add phy phandle to usbss
2012-07-12 9:53 [PATCH 00/11] usb: musb: adding multi instance support Ajay Kumar Gupta
` (5 preceding siblings ...)
[not found] ` <1342086814-32181-1-git-send-email-ajay.gupta-l0cyMroinI0@public.gmane.org>
@ 2012-07-12 9:53 ` Ajay Kumar Gupta
6 siblings, 0 replies; 12+ messages in thread
From: Ajay Kumar Gupta @ 2012-07-12 9:53 UTC (permalink / raw)
To: linux-usb
Cc: linux-omap, balbi, grant.likely, devicetree-discuss, tony,
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 <ajay.gupta@ti.com>
---
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..0e7aaaa 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
^ permalink raw reply related [flat|nested] 12+ messages in thread