@@ -18,6 +18,7 @@
#include <linux/i2c.h>
#include <linux/io.h>
#include <linux/clk.h>
+#include <linux/gpio.h>
#include <linux/i2c/at24.h>
#include <linux/leds.h>
#include <linux/mtd/mtd.h>
@@ -39,6 +40,7 @@
#include <mach/mmc.h>
#include <mach/nand.h>
#include <mach/keyscan.h>
+#include <mach/usb.h>
#include <media/tvp514x.h>
@@ -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));
}
@@ -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)
@@ -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 */