From patchwork Tue Jun 8 15:57:17 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 104982 Received: from comal.ext.ti.com (comal.ext.ti.com [198.47.26.152]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o58Fx8Rn008947 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 8 Jun 2010 15:59:45 GMT Received: from dlep34.itg.ti.com ([157.170.170.115]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id o58FvNlK004191 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 8 Jun 2010 10:57:23 -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 o58FvNeD010904; Tue, 8 Jun 2010 10:57:23 -0500 (CDT) Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id DEE7780627; Tue, 8 Jun 2010 10:57:22 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflp51.itg.ti.com (dflp51.itg.ti.com [128.247.22.94]) by linux.omap.com (Postfix) with ESMTP id 74A8780626 for ; Tue, 8 Jun 2010 10:57:21 -0500 (CDT) Received: from white.ext.ti.com (localhost [127.0.0.1]) by dflp51.itg.ti.com (8.13.7/8.13.7) with ESMTP id o58FvLU7000690 for ; Tue, 8 Jun 2010 10:57:21 -0500 (CDT) Received: from psmtp.com (na3sys009amx205.postini.com [74.125.149.45]) by white.ext.ti.com (8.13.7/8.13.7) with SMTP id o58FvJYU001791 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 8 Jun 2010 10:57:20 -0500 Received: from source ([81.2.99.171]) (using TLSv1) by na3sys009amx205.postini.com ([74.125.148.10]) with SMTP; Tue, 08 Jun 2010 15:57:20 GMT Received: from atlas.mpc-data.co.uk (atlas.mpc-data.co.uk [10.150.16.29]) by warcop.mpc-data.co.uk (8.12.9p2/8.12.9) with ESMTP id o58FvHlh059860; Tue, 8 Jun 2010 16:57:17 +0100 (BST) (envelope-from kbingham@mpc-data.co.uk) Received: from kbingham by atlas.mpc-data.co.uk with local (Exim 4.69) (envelope-from ) id 1OM1Az-0002FP-2d; Tue, 08 Jun 2010 16:57:17 +0100 From: Kieran Bingham To: "davinci-linux-open-source@linux.davincidsp.com" Subject: [PATCH] DM365EVM: Fix up PHY Clocksource to enable USB Host on DM365EVM Date: Tue, 8 Jun 2010 16:57:17 +0100 Message-Id: <1276012637-8600-1-git-send-email-kieranbingham@gmail.com> X-Mailer: git-send-email 1.6.2.1 X-pstn-neptune: 0/0/0.00/0 X-pstn-levels: (S:45.01870/99.90000 CV:99.9000 FC:95.5390 LC:95.5390 R:95.9108 P:95.9108 M:97.0282 C:98.6951 ) X-pstn-settings: 2 (0.5000:0.5000) s cv gt3 gt2 gt1 r p m c X-pstn-addresses: from [db-null] Cc: Kieran Bingham X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: davinci-linux-open-source-bounces@linux.davincidsp.com Errors-To: davinci-linux-open-source-bounces@linux.davincidsp.com X-Greylist: Sender succeeded STARTTLS authentication, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Tue, 08 Jun 2010 15:59:45 +0000 (UTC) diff --git a/arch/arm/mach-davinci/board-dm365-evm.c b/arch/arm/mach-davinci/board-dm365-evm.c index fdb073e..c4a05fc 100644 --- a/arch/arm/mach-davinci/board-dm365-evm.c +++ b/arch/arm/mach-davinci/board-dm365-evm.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -39,6 +40,7 @@ #include #include #include +#include #include @@ -590,6 +592,15 @@ static struct spi_board_info dm365_evm_spi_info[] __initconst = { }, }; +static void dm365evm_usb_configure(void) +{ + davinci_cfg_reg(DM365_GPIO33); + gpio_request(33, "usb"); + gpio_direction_output(33, 1); + davinci_setup_usb(500, 8); +} + + static __init void dm365_evm_init(void) { evm_init_i2c(); @@ -607,6 +618,8 @@ static __init void dm365_evm_init(void) dm365_init_rtc(); dm365_init_ks(&dm365evm_ks_data); + dm365evm_usb_configure(); + dm365_init_spi0(BIT(0), dm365_evm_spi_info, ARRAY_SIZE(dm365_evm_spi_info)); } diff --git a/drivers/usb/musb/davinci.c b/drivers/usb/musb/davinci.c index ce2e16f..3736792 100644 --- a/drivers/usb/musb/davinci.c +++ b/drivers/usb/musb/davinci.c @@ -64,6 +64,16 @@ static inline void phy_on(void) /* 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; + + if (cpu_is_davinci_dm365()) { + /* + * DM365 PHYCLKFREQ field [15:12] is set to 2 + * to get clock from 24MHz crystal + */ + phy_ctrl |= USBPHY_CLKFREQ_24MHZ; + /*phy_ctrl &= ~USBPHY_PHYPDWN;*/ + } + __raw_writel(phy_ctrl, USB_PHY_CTRL); /* wait for PLL to lock before proceeding */ @@ -188,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) diff --git a/drivers/usb/musb/davinci.h b/drivers/usb/musb/davinci.h index 046c844..0577ec6 100644 --- a/drivers/usb/musb/davinci.h +++ b/drivers/usb/musb/davinci.h @@ -16,6 +16,10 @@ /* Integrated highspeed/otg PHY */ #define USBPHY_CTL_PADDR (DAVINCI_SYSTEM_MODULE_BASE + 0x34) +#define USBPHY_NDATAPOL BIT(18) +#define USBPHY_SESSION_VBUS BIT(17) +#define USBPHY_PERI_USBID BIT(16) +#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 */