aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAjay Kumar Gupta <ajay.gupta@ti.com>2012-08-31 07:09:50 -0400
committerFelipe Balbi <balbi@ti.com>2012-09-11 10:34:45 -0400
commit8d2421e68cb8a159963641eab72f8f8ba1c7f7b0 (patch)
treef8214a8ca20d8487c1e304ab56b6a528960cb0df /drivers
parent65b3d52d02a558fbfe08e43688e15390c5ab3067 (diff)
usb: musb: kill global and static for multi instance
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> Signed-off-by: Santhapuri, Damodar <damodar.santhapuri@ti.com> Signed-off-by: Ravi Babu <ravibabu@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/musb/musb_core.c22
-rw-r--r--drivers/usb/musb/musb_core.h4
-rw-r--r--drivers/usb/musb/musb_debugfs.c8
3 files changed, 14 insertions, 20 deletions
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 61b64fced256..bb56a0e8b23b 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -100,6 +100,7 @@
100#include <linux/platform_device.h> 100#include <linux/platform_device.h>
101#include <linux/io.h> 101#include <linux/io.h>
102#include <linux/idr.h> 102#include <linux/idr.h>
103#include <linux/dma-mapping.h>
103 104
104#include "musb_core.h" 105#include "musb_core.h"
105 106
@@ -1797,10 +1798,9 @@ static const struct attribute_group musb_attr_group = {
1797static void musb_irq_work(struct work_struct *data) 1798static void musb_irq_work(struct work_struct *data)
1798{ 1799{
1799 struct musb *musb = container_of(data, struct musb, irq_work); 1800 struct musb *musb = container_of(data, struct musb, irq_work);
1800 static int old_state;
1801 1801
1802 if (musb->xceiv->state != old_state) { 1802 if (musb->xceiv->state != musb->xceiv_old_state) {
1803 old_state = musb->xceiv->state; 1803 musb->xceiv_old_state = musb->xceiv->state;
1804 sysfs_notify(&musb->controller->kobj, NULL, "mode"); 1804 sysfs_notify(&musb->controller->kobj, NULL, "mode");
1805 } 1805 }
1806} 1806}
@@ -2060,11 +2060,6 @@ fail0:
2060/* all implementations (PCI bridge to FPGA, VLYNQ, etc) should just 2060/* all implementations (PCI bridge to FPGA, VLYNQ, etc) should just
2061 * bridge to a platform device; this driver then suffices. 2061 * bridge to a platform device; this driver then suffices.
2062 */ 2062 */
2063
2064#ifndef CONFIG_MUSB_PIO_ONLY
2065static u64 *orig_dma_mask;
2066#endif
2067
2068static int __devinit musb_probe(struct platform_device *pdev) 2063static int __devinit musb_probe(struct platform_device *pdev)
2069{ 2064{
2070 struct device *dev = &pdev->dev; 2065 struct device *dev = &pdev->dev;
@@ -2083,10 +2078,6 @@ static int __devinit musb_probe(struct platform_device *pdev)
2083 return -ENOMEM; 2078 return -ENOMEM;
2084 } 2079 }
2085 2080
2086#ifndef CONFIG_MUSB_PIO_ONLY
2087 /* clobbered by use_dma=n */
2088 orig_dma_mask = dev->dma_mask;
2089#endif
2090 status = musb_init_controller(dev, irq, base); 2081 status = musb_init_controller(dev, irq, base);
2091 if (status < 0) 2082 if (status < 0)
2092 iounmap(base); 2083 iounmap(base);
@@ -2096,7 +2087,8 @@ static int __devinit musb_probe(struct platform_device *pdev)
2096 2087
2097static int __devexit musb_remove(struct platform_device *pdev) 2088static int __devexit musb_remove(struct platform_device *pdev)
2098{ 2089{
2099 struct musb *musb = dev_to_musb(&pdev->dev); 2090 struct device *dev = &pdev->dev;
2091 struct musb *musb = dev_to_musb(dev);
2100 void __iomem *ctrl_base = musb->ctrl_base; 2092 void __iomem *ctrl_base = musb->ctrl_base;
2101 2093
2102 /* this gets called on rmmod. 2094 /* this gets called on rmmod.
@@ -2109,9 +2101,9 @@ static int __devexit musb_remove(struct platform_device *pdev)
2109 2101
2110 musb_free(musb); 2102 musb_free(musb);
2111 iounmap(ctrl_base); 2103 iounmap(ctrl_base);
2112 device_init_wakeup(&pdev->dev, 0); 2104 device_init_wakeup(dev, 0);
2113#ifndef CONFIG_MUSB_PIO_ONLY 2105#ifndef CONFIG_MUSB_PIO_ONLY
2114 pdev->dev.dma_mask = orig_dma_mask; 2106 dma_set_mask(dev, *dev->parent->dma_mask);
2115#endif 2107#endif
2116 return 0; 2108 return 0;
2117} 2109}
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h
index a69ffd68a9e0..c158aacd6de8 100644
--- a/drivers/usb/musb/musb_core.h
+++ b/drivers/usb/musb/musb_core.h
@@ -437,6 +437,10 @@ struct musb {
437#ifdef MUSB_CONFIG_PROC_FS 437#ifdef MUSB_CONFIG_PROC_FS
438 struct proc_dir_entry *proc_entry; 438 struct proc_dir_entry *proc_entry;
439#endif 439#endif
440 int xceiv_old_state;
441#ifdef CONFIG_DEBUG_FS
442 struct dentry *debugfs_root;
443#endif
440}; 444};
441 445
442static inline struct musb *gadget_to_musb(struct usb_gadget *g) 446static 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 40a37c91cc10..1d6e8af94c06 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[] = {
103 { } /* Terminating Entry */ 103 { } /* Terminating Entry */
104}; 104};
105 105
106static struct dentry *musb_debugfs_root;
107
108static int musb_regdump_show(struct seq_file *s, void *unused) 106static int musb_regdump_show(struct seq_file *s, void *unused)
109{ 107{
110 struct musb *musb = s->private; 108 struct musb *musb = s->private;
@@ -241,7 +239,7 @@ int __devinit musb_init_debugfs(struct musb *musb)
241 struct dentry *file; 239 struct dentry *file;
242 int ret; 240 int ret;
243 241
244 root = debugfs_create_dir("musb", NULL); 242 root = debugfs_create_dir(dev_name(musb->controller), NULL);
245 if (!root) { 243 if (!root) {
246 ret = -ENOMEM; 244 ret = -ENOMEM;
247 goto err0; 245 goto err0;
@@ -261,7 +259,7 @@ int __devinit musb_init_debugfs(struct musb *musb)
261 goto err1; 259 goto err1;
262 } 260 }
263 261
264 musb_debugfs_root = root; 262 musb->debugfs_root = root;
265 263
266 return 0; 264 return 0;
267 265
@@ -274,5 +272,5 @@ err0:
274 272
275void /* __init_or_exit */ musb_exit_debugfs(struct musb *musb) 273void /* __init_or_exit */ musb_exit_debugfs(struct musb *musb)
276{ 274{
277 debugfs_remove_recursive(musb_debugfs_root); 275 debugfs_remove_recursive(musb->debugfs_root);
278} 276}