diff options
Diffstat (limited to 'drivers/usb/gadget/m66592-udc.c')
-rw-r--r-- | drivers/usb/gadget/m66592-udc.c | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/drivers/usb/gadget/m66592-udc.c b/drivers/usb/gadget/m66592-udc.c index 77b44fb48f0a..201c67b625cc 100644 --- a/drivers/usb/gadget/m66592-udc.c +++ b/drivers/usb/gadget/m66592-udc.c | |||
@@ -623,7 +623,6 @@ static void start_ep0(struct m66592_ep *ep, struct m66592_request *req) | |||
623 | #if defined(CONFIG_SUPERH_BUILT_IN_M66592) | 623 | #if defined(CONFIG_SUPERH_BUILT_IN_M66592) |
624 | static void init_controller(struct m66592 *m66592) | 624 | static void init_controller(struct m66592 *m66592) |
625 | { | 625 | { |
626 | usbf_start_clock(); | ||
627 | m66592_bset(m66592, M66592_HSE, M66592_SYSCFG); /* High spd */ | 626 | m66592_bset(m66592, M66592_HSE, M66592_SYSCFG); /* High spd */ |
628 | m66592_bclr(m66592, M66592_USBE, M66592_SYSCFG); | 627 | m66592_bclr(m66592, M66592_USBE, M66592_SYSCFG); |
629 | m66592_bclr(m66592, M66592_DPRPU, M66592_SYSCFG); | 628 | m66592_bclr(m66592, M66592_DPRPU, M66592_SYSCFG); |
@@ -671,9 +670,7 @@ static void init_controller(struct m66592 *m66592) | |||
671 | 670 | ||
672 | static void disable_controller(struct m66592 *m66592) | 671 | static void disable_controller(struct m66592 *m66592) |
673 | { | 672 | { |
674 | #if defined(CONFIG_SUPERH_BUILT_IN_M66592) | 673 | #if !defined(CONFIG_SUPERH_BUILT_IN_M66592) |
675 | usbf_stop_clock(); | ||
676 | #else | ||
677 | m66592_bclr(m66592, M66592_SCKE, M66592_SYSCFG); | 674 | m66592_bclr(m66592, M66592_SCKE, M66592_SYSCFG); |
678 | udelay(1); | 675 | udelay(1); |
679 | m66592_bclr(m66592, M66592_PLLC, M66592_SYSCFG); | 676 | m66592_bclr(m66592, M66592_PLLC, M66592_SYSCFG); |
@@ -686,9 +683,7 @@ static void disable_controller(struct m66592 *m66592) | |||
686 | 683 | ||
687 | static void m66592_start_xclock(struct m66592 *m66592) | 684 | static void m66592_start_xclock(struct m66592 *m66592) |
688 | { | 685 | { |
689 | #if defined(CONFIG_SUPERH_BUILT_IN_M66592) | 686 | #if !defined(CONFIG_SUPERH_BUILT_IN_M66592) |
690 | usbf_start_clock(); | ||
691 | #else | ||
692 | u16 tmp; | 687 | u16 tmp; |
693 | 688 | ||
694 | tmp = m66592_read(m66592, M66592_SYSCFG); | 689 | tmp = m66592_read(m66592, M66592_SYSCFG); |
@@ -1539,7 +1534,10 @@ static int __exit m66592_remove(struct platform_device *pdev) | |||
1539 | iounmap(m66592->reg); | 1534 | iounmap(m66592->reg); |
1540 | free_irq(platform_get_irq(pdev, 0), m66592); | 1535 | free_irq(platform_get_irq(pdev, 0), m66592); |
1541 | m66592_free_request(&m66592->ep[0].ep, m66592->ep0_req); | 1536 | m66592_free_request(&m66592->ep[0].ep, m66592->ep0_req); |
1542 | usbf_stop_clock(); | 1537 | #if defined(CONFIG_SUPERH_BUILT_IN_M66592) && defined(CONFIG_HAVE_CLK) |
1538 | clk_disable(m66592->clk); | ||
1539 | clk_put(m66592->clk); | ||
1540 | #endif | ||
1543 | kfree(m66592); | 1541 | kfree(m66592); |
1544 | return 0; | 1542 | return 0; |
1545 | } | 1543 | } |
@@ -1556,6 +1554,9 @@ static int __init m66592_probe(struct platform_device *pdev) | |||
1556 | int irq; | 1554 | int irq; |
1557 | void __iomem *reg = NULL; | 1555 | void __iomem *reg = NULL; |
1558 | struct m66592 *m66592 = NULL; | 1556 | struct m66592 *m66592 = NULL; |
1557 | #if defined(CONFIG_SUPERH_BUILT_IN_M66592) && defined(CONFIG_HAVE_CLK) | ||
1558 | char clk_name[8]; | ||
1559 | #endif | ||
1559 | int ret = 0; | 1560 | int ret = 0; |
1560 | int i; | 1561 | int i; |
1561 | 1562 | ||
@@ -1614,6 +1615,16 @@ static int __init m66592_probe(struct platform_device *pdev) | |||
1614 | goto clean_up; | 1615 | goto clean_up; |
1615 | } | 1616 | } |
1616 | 1617 | ||
1618 | #if defined(CONFIG_SUPERH_BUILT_IN_M66592) && defined(CONFIG_HAVE_CLK) | ||
1619 | snprintf(clk_name, sizeof(clk_name), "usbf%d", pdev->id); | ||
1620 | m66592->clk = clk_get(&pdev->dev, clk_name); | ||
1621 | if (IS_ERR(m66592->clk)) { | ||
1622 | dev_err(&pdev->dev, "cannot get clock \"%s\"\n", clk_name); | ||
1623 | ret = PTR_ERR(m66592->clk); | ||
1624 | goto clean_up2; | ||
1625 | } | ||
1626 | clk_enable(m66592->clk); | ||
1627 | #endif | ||
1617 | INIT_LIST_HEAD(&m66592->gadget.ep_list); | 1628 | INIT_LIST_HEAD(&m66592->gadget.ep_list); |
1618 | m66592->gadget.ep0 = &m66592->ep[0].ep; | 1629 | m66592->gadget.ep0 = &m66592->ep[0].ep; |
1619 | INIT_LIST_HEAD(&m66592->gadget.ep0->ep_list); | 1630 | INIT_LIST_HEAD(&m66592->gadget.ep0->ep_list); |
@@ -1645,7 +1656,7 @@ static int __init m66592_probe(struct platform_device *pdev) | |||
1645 | 1656 | ||
1646 | m66592->ep0_req = m66592_alloc_request(&m66592->ep[0].ep, GFP_KERNEL); | 1657 | m66592->ep0_req = m66592_alloc_request(&m66592->ep[0].ep, GFP_KERNEL); |
1647 | if (m66592->ep0_req == NULL) | 1658 | if (m66592->ep0_req == NULL) |
1648 | goto clean_up2; | 1659 | goto clean_up3; |
1649 | m66592->ep0_req->complete = nop_completion; | 1660 | m66592->ep0_req->complete = nop_completion; |
1650 | 1661 | ||
1651 | init_controller(m66592); | 1662 | init_controller(m66592); |
@@ -1653,6 +1664,11 @@ static int __init m66592_probe(struct platform_device *pdev) | |||
1653 | dev_info(&pdev->dev, "version %s\n", DRIVER_VERSION); | 1664 | dev_info(&pdev->dev, "version %s\n", DRIVER_VERSION); |
1654 | return 0; | 1665 | return 0; |
1655 | 1666 | ||
1667 | clean_up3: | ||
1668 | #if defined(CONFIG_SUPERH_BUILT_IN_M66592) && defined(CONFIG_HAVE_CLK) | ||
1669 | clk_disable(m66592->clk); | ||
1670 | clk_put(m66592->clk); | ||
1671 | #endif | ||
1656 | clean_up2: | 1672 | clean_up2: |
1657 | free_irq(irq, m66592); | 1673 | free_irq(irq, m66592); |
1658 | clean_up: | 1674 | clean_up: |