From patchwork Mon Sep 7 21:00:52 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: miguel.aguilar@ridgerun.com X-Patchwork-Id: 46697 Received: from bear.ext.ti.com (bear.ext.ti.com [192.94.94.41]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n8AMxRUJ021688 for ; Thu, 10 Sep 2009 22:59:27 GMT Received: from dlep34.itg.ti.com ([157.170.170.115]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id n87L1EHt007053; Mon, 7 Sep 2009 16:01:19 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by dlep34.itg.ti.com (8.13.7/8.13.7) with ESMTP id n87L1Duj015328; Mon, 7 Sep 2009 16:01:14 -0500 (CDT) Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 60B5480627; Mon, 7 Sep 2009 16:01:13 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflp52.itg.ti.com (dflp52.itg.ti.com [128.247.22.96]) by linux.omap.com (Postfix) with ESMTP id 0058380626 for ; Mon, 7 Sep 2009 16:01:11 -0500 (CDT) Received: from red.ext.ti.com (localhost [127.0.0.1]) by dflp52.itg.ti.com (8.13.7/8.13.7) with ESMTP id n87L1AOV011405 for ; Mon, 7 Sep 2009 16:01:10 -0500 (CDT) Received: from mail156-va3-R.bigfish.com (mail-va3.bigfish.com [216.32.180.114]) by red.ext.ti.com (8.13.7/8.13.7) with ESMTP id n87L15O6030574 for ; Mon, 7 Sep 2009 16:01:10 -0500 Received: from mail156-va3 (localhost.localdomain [127.0.0.1]) by mail156-va3-R.bigfish.com (Postfix) with ESMTP id 6CFE11C8157 for ; Mon, 7 Sep 2009 21:01:05 +0000 (UTC) X-SpamScore: 7 X-BigFish: vps7(zza4b1ozz1202hzzz2fh62h) X-Spam-TCS-SCL: 1:0 X-FB-SS: 5, X-MS-Exchange-Organization-Antispam-Report: OrigIP: 74.208.67.6; Service: EHS Received: by mail156-va3 (MessageSwitch) id 1252357262468382_10850; Mon, 7 Sep 2009 21:01:02 +0000 (UCT) Received: from mail.navvo.net (mail.navvo.net [74.208.67.6]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail156-va3.bigfish.com (Postfix) with ESMTP id 5C325BA8051; Mon, 7 Sep 2009 21:01:02 +0000 (UTC) Received: from [201.198.127.70] (helo=localhost.localdomain) by mail.navvo.net with esmtpa (Exim 4.63) (envelope-from ) id 1MklKd-0002qJ-GC; Mon, 07 Sep 2009 16:01:01 -0500 From: miguel.aguilar@ridgerun.com To: davinci-linux-open-source@linux.davincidsp.com, nsnehaprabha@ti.com Date: Mon, 7 Sep 2009 15:00:52 -0600 Message-Id: <1252357252-29484-1-git-send-email-miguel.aguilar@ridgerun.com> X-Mailer: git-send-email 1.6.0.4 X-SA-Exim-Connect-IP: 201.198.127.70 X-SA-Exim-Mail-From: miguel.aguilar@ridgerun.com X-Spam-Checker-Version: SpamAssassin 3.1.7-deb (2006-10-05) on mail.navvo.net X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=ALL_TRUSTED,BAYES_00, NO_REAL_NAME,UPPERCASE_25_50 autolearn=ham version=3.1.7-deb X-SA-Exim-Version: 4.2.1 (built Tue, 09 Jan 2007 17:23:22 +0000) X-SA-Exim-Scanned: Yes (on mail.navvo.net) Cc: santiago.nunez@ridgerun.com, todd.fischer@ridgerun.com, clark.becker@ridgerun.com, Miguel Aguilar Subject: [PATCH 1/2] USB: DaVinci: Add DM365 support to DaVinci USB driver X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.4 Precedence: list List-Id: davinci-linux-open-source.linux.davincidsp.com List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: davinci-linux-open-source-bounces@linux.davincidsp.com Errors-To: davinci-linux-open-source-bounces@linux.davincidsp.com From: Miguel Aguilar Modifies the DaVinci USB driver in order to support the DM365 platform. This patch needs the patch called "DaVinci: DM365: Correct USB source clock" by Sandeep Paulraj to work properly because it fixes the USB clock source for DM365. Signed-off-by: Miguel Aguilar --- drivers/usb/musb/Kconfig | 4 ++-- drivers/usb/musb/davinci.c | 20 ++++++++++++++++---- drivers/usb/musb/davinci.h | 1 + 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig index 803adcb..9878a64 100644 --- a/drivers/usb/musb/Kconfig +++ b/drivers/usb/musb/Kconfig @@ -23,7 +23,7 @@ config USB_MUSB_HDRC or the USB host role, or both. Texas Instruments familiies using this IP include DaVinci - (35x, 644x ...), OMAP 243x, OMAP 3, and TUSB 6010. + (35x, 36x, 644x ...), OMAP 243x, OMAP 3, and TUSB 6010. Analog Devices parts using this IP include Blackfin BF54x, BF525 and BF527. @@ -42,7 +42,7 @@ config USB_MUSB_SOC default y if (BF54x && !BF544) default y if (BF52x && !BF522 && !BF523) -comment "DaVinci 35x and 644x USB support" +comment "DaVinci 35x, 36x, 644x USB support" depends on USB_MUSB_HDRC && ARCH_DAVINCI comment "OMAP 243x high speed USB support" diff --git a/drivers/usb/musb/davinci.c b/drivers/usb/musb/davinci.c index e16ff60..f5374f9 100644 --- a/drivers/usb/musb/davinci.c +++ b/drivers/usb/musb/davinci.c @@ -62,10 +62,19 @@ static inline void phy_on(void) { u32 phy_ctrl = __raw_readl(USB_PHY_CTRL); - /* power everything up; start the on-chip PHY and its PLL */ - phy_ctrl &= ~(USBPHY_OSCPDWN | USBPHY_OTGPDWN | USBPHY_PHYPDWN); - phy_ctrl |= USBPHY_SESNDEN | USBPHY_VBDTCTEN | USBPHY_PHYPLLON; - __raw_writel(phy_ctrl, USB_PHY_CTRL); + if (cpu_is_davinci_dm365()) + /* + * DM365 PHYCLKFREQ field [15:12] is set to 2 + * to get clock from 24MHz crystal + */ + __raw_writel(USBPHY_SESNDEN | USBPHY_VBDTCTEN | + USBPHY_CLKFREQ_24MHZ, USB_PHY_CTRL); + else { + /* power everything up; start the on-chip PHY and its PLL */ + phy_ctrl &= ~(USBPHY_OSCPDWN | USBPHY_OTGPDWN | USBPHY_PHYPDWN); + phy_ctrl |= USBPHY_SESNDEN | USBPHY_VBDTCTEN | USBPHY_PHYPLLON; + __raw_writel(phy_ctrl, USB_PHY_CTRL); + } /* wait for PLL to lock before proceeding */ while ((__raw_readl(USB_PHY_CTRL) & USBPHY_PHYCLKGD) == 0) @@ -189,6 +198,8 @@ static void davinci_source_power(struct musb *musb, int is_on, int immediate) if (immediate) vbus_state = is_on; #endif + if (cpu_is_davinci_dm365()) + gpio_set_value(33, is_on); } static void davinci_set_vbus(struct musb *musb, int is_on) @@ -427,6 +438,7 @@ int __init musb_platform_init(struct musb *musb) } __raw_writel(deepsleep, DM355_DEEPSLEEP); } + /* reset the controller */ musb_writel(tibase, DAVINCI_USB_CTRL_REG, 0x1); diff --git a/drivers/usb/musb/davinci.h b/drivers/usb/musb/davinci.h index 046c844..ceabb36 100644 --- a/drivers/usb/musb/davinci.h +++ b/drivers/usb/musb/davinci.h @@ -16,6 +16,7 @@ /* Integrated highspeed/otg PHY */ #define USBPHY_CTL_PADDR (DAVINCI_SYSTEM_MODULE_BASE + 0x34) +#define USBPHY_CLKFREQ_24MHZ BIT(13) #define USBPHY_DATAPOL BIT(11) /* (dm355) switch D+/D- */ #define USBPHY_PHYCLKGD BIT(8) #define USBPHY_SESNDEN BIT(7) /* v(sess_end) comparator */