Kieran Bingham wrote:

This patch was created by pulling in the code required from the Arago Tree.

   This patch probably needs better description than that...

Checked by running on a Spectrum Digital DM365EVM Revision C.

Signed-off-by: Kieran Bingham <kbing...@mpc-data.co.uk>
[...]
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
[...]
@@ -590,6 +592,15 @@ static struct spi_board_info dm365_evm_spi_info[] 
__initconst = {
        },
 };
+static void dm365evm_usb_configure(void)

   Better call it dm365evm_usb_init() for uniformity...

+{
+       davinci_cfg_reg(DM365_GPIO33);
+       gpio_request(33, "usb");

   Can fail...

+       gpio_direction_output(33, 1);

VBUS should be off by default, until the MUSB driver turns it on, so 0 here...

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;

   I believe this belongs to the board code instead.

+               /*phy_ctrl &= ~USBPHY_PHYPDWN;*/

   Remove this line please.

+       }
+
        __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())

   No way -- this depends not on SoC type but solely on the board type...

+               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)

   Need some comment indicating these fields are DM365 only...

WBR, Sergei

_______________________________________________
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Reply via email to