From patchwork Wed Mar 9 18:14:02 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Buesch X-Patchwork-Id: 622161 X-Patchwork-Delegate: tony@atomide.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p29IE9m8008934 for ; Wed, 9 Mar 2011 18:14:09 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751314Ab1CISOH (ORCPT ); Wed, 9 Mar 2011 13:14:07 -0500 Received: from 80-190-117-144.ip-home.de ([80.190.117.144]:57326 "EHLO bu3sch.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751261Ab1CISOG (ORCPT ); Wed, 9 Mar 2011 13:14:06 -0500 Received: by bu3sch.de with esmtpsa (Exim 4.69) (envelope-from ) id 1PxNtf-0007zz-IP; Wed, 09 Mar 2011 19:14:07 +0100 Subject: [PATCH] cbus-tahvo-usb: Initialize the used clock From: Michael Buesch To: Tony Lindgren Cc: Felipe Balbi , linux-omap Date: Wed, 09 Mar 2011 19:14:02 +0100 Message-ID: <1299694442.1911.16.camel@marge> Mime-Version: 1.0 X-Mailer: Evolution 2.30.3 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Wed, 09 Mar 2011 18:14:09 +0000 (UTC) Index: linux-2.6.38-rc7/drivers/cbus/tahvo-usb.c =================================================================== --- linux-2.6.38-rc7.orig/drivers/cbus/tahvo-usb.c 2011-03-09 18:55:47.177917578 +0100 +++ linux-2.6.38-rc7/drivers/cbus/tahvo-usb.c 2011-03-09 18:58:35.869996276 +0100 @@ -98,6 +98,7 @@ struct tahvo_usb { #ifdef CONFIG_USB_OTG int tahvo_mode; #endif + struct clk *ick; }; static struct tahvo_usb *tahvo_usb_device; @@ -673,6 +674,14 @@ static int __init tahvo_usb_probe(struct INIT_WORK(&tu->irq_work, tahvo_usb_irq_work); mutex_init(&tu->serialize); + tu->ick = clk_get(NULL, "usb_l4_ick"); + if (IS_ERR(tu->ick)) { + dev_err(dev, "Failed to get usb_l4_ick\n"); + ret = PTR_ERR(tu->ick); + goto err_free_tu; + } + clk_enable(tu->ick); + /* Set initial state, so that we generate kevents only on * state changes */ tu->vbus_state = tahvo_read_reg(TAHVO_REG_IDSR) & 0x01; @@ -681,10 +690,8 @@ static int __init tahvo_usb_probe(struct ret = tahvo_request_irq(TAHVO_INT_VBUSON, tahvo_usb_vbus_interrupt, (unsigned long) tu, "vbus_interrupt"); if (ret != 0) { - kfree(tu); - tahvo_usb_device = NULL; printk(KERN_ERR "Could not register Tahvo interrupt for VBUS\n"); - return ret; + goto err_release_clk; } /* Attributes */ @@ -709,10 +716,7 @@ static int __init tahvo_usb_probe(struct ret = otg_set_transceiver(&tu->otg); if (ret < 0) { printk(KERN_ERR "Cannot register USB transceiver\n"); - tahvo_usb_device = NULL; - kfree(tu); - tahvo_free_irq(TAHVO_INT_VBUSON); - return ret; + goto err_free_irq; } dev_set_drvdata(dev, tu); @@ -721,6 +725,17 @@ static int __init tahvo_usb_probe(struct * may not be generated in addition to this. */ schedule_work(&tu->irq_work); return 0; + +err_free_irq: + tahvo_free_irq(TAHVO_INT_VBUSON); +err_release_clk: + clk_disable(tu->ick); + clk_put(tu->ick); +err_free_tu: + kfree(tu); + tahvo_usb_device = NULL; + + return ret; } static int __exit tahvo_usb_remove(struct platform_device *pdev) @@ -736,6 +751,8 @@ static int __exit tahvo_usb_remove(struc #ifdef CONFIG_USB_OTG device_remove_file(&pdev->dev, &dev_attr_otg_mode); #endif + clk_disable(tu->ick); + clk_put(tu->ick); kfree(tu); tahvo_usb_device = NULL;