# define DEBUG_SETUP(fmt,args...) do {} while(0)
#endif
-static unsigned int udc_debug = 0; /* 0: normal mode, 1: test udc cable type mode */
-
-module_param(udc_debug, int, 0);
-MODULE_PARM_DESC(udc_debug, "test udc cable or power type");
-
static unsigned int use_dma = 0; /* 1: use DMA, 0: use PIO */
module_param(use_dma, int, 0);
* there are no actions on the USB bus.
* UDC still works during this bit was set.
*/
- jz4740_clock_udc_enable_auto_suspend();
+ jz4740_clock_udc_enable_auto_suspend();
/* Enable the USB PHY */
clk_enable(dev->clk);
static int jz4740_udc_pullup(struct usb_gadget *_gadget, int on)
{
struct jz4740_udc *udc = gadget_to_udc(_gadget);
-
unsigned long flags;
local_irq_save(flags);
return 0;
}
+
static const struct usb_gadget_ops jz4740_udc_ops = {
.get_frame = jz4740_udc_get_frame,
.wakeup = jz4740_udc_wakeup,
return 0;
}
+#ifdef CONFIG_PM
+
+static int jz4740_udc_suspend(struct device *dev)
+{
+ struct jz4740_udc *udc = dev_get_drvdata(dev);
+
+ if (udc->state == UDC_STATE_ENABLE)
+ udc_disable(udc);
+
+ return 0;
+}
+
+static int jz4740_udc_resume(struct device *dev)
+{
+ struct jz4740_udc *udc = dev_get_drvdata(dev);
+
+ if (udc->state == UDC_STATE_ENABLE)
+ udc_enable(udc);
+
+ return 0;
+}
+
+static struct dev_pm_ops jz4740_udc_pm_ops = {
+ .suspend = jz4740_udc_suspend,
+ .resume = jz4740_udc_resume,
+};
+
+#define JZ4740_UDC_PM_OPS (&jz4740_udc_pm_ops)
+
+#else
+
+#define JZ4740_UDC_PM_OPS NULL
+
+#endif
+
static struct platform_driver udc_driver = {
.probe = jz4740_udc_probe,
.remove = jz4740_udc_remove,
.driver = {
.name = "jz-udc",
.owner = THIS_MODULE,
+ .pm = JZ4740_UDC_PM_OPS,
},
};
{
return platform_driver_register(&udc_driver);
}
+module_init(udc_init);
static void __exit udc_exit (void)
{
platform_driver_unregister(&udc_driver);
}
-
-module_init(udc_init);
module_exit(udc_exit);
MODULE_DESCRIPTION("JZ4740 USB Device Controller");