]> git.ipfire.org Git - people/ms/u-boot.git/blobdiff - board/logicpd/am3517evm/am3517evm.c
omap-common: Common function to display die id, replacing omap3-specific version
[people/ms/u-boot.git] / board / logicpd / am3517evm / am3517evm.c
index b6c68da7a89e5d31b012a6cfc12e408ee677f978..1f1e5aedb0d633e9597678dc8e1c8b1588012c2c 100644 (file)
@@ -22,6 +22,7 @@
 #include <asm/arch/musb.h>
 #include <asm/mach-types.h>
 #include <asm/errno.h>
+#include <asm/gpio.h>
 #include <linux/usb/ch9.h>
 #include <linux/usb/gadget.h>
 #include <linux/usb/musb.h>
@@ -31,6 +32,9 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+#define AM3517_IP_SW_RESET     0x48002598
+#define CPGMACSS_SW_RST                (1 << 1)
+
 /*
  * Routine: board_init
  * Description: Early hardware init.
@@ -61,12 +65,12 @@ static struct omap_musb_board_data musb_board_data = {
 };
 
 static struct musb_hdrc_platform_data musb_plat = {
-#if defined(CONFIG_MUSB_HOST)
+#if defined(CONFIG_USB_MUSB_HOST)
        .mode           = MUSB_HOST,
-#elif defined(CONFIG_MUSB_GADGET)
+#elif defined(CONFIG_USB_MUSB_GADGET)
        .mode           = MUSB_PERIPHERAL,
 #else
-#error "Please define either CONFIG_MUSB_HOST or CONFIG_MUSB_GADGET"
+#error "Please define either CONFIG_USB_MUSB_HOST or CONFIG_USB_MUSB_GADGET"
 #endif
        .config         = &musb_config,
        .power          = 250,
@@ -98,14 +102,42 @@ static void am3517_evm_musb_init(void)
  */
 int misc_init_r(void)
 {
-#ifdef CONFIG_DRIVER_OMAP34XX_I2C
-       i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
+       volatile unsigned int ctr;
+       u32 reset;
+
+#ifdef CONFIG_SYS_I2C_OMAP34XX
+       i2c_init(CONFIG_SYS_OMAP24_I2C_SPEED, CONFIG_SYS_OMAP24_I2C_SLAVE);
 #endif
 
-       dieid_num_r();
+       omap_die_id_display();
 
        am3517_evm_musb_init();
 
+       /* activate PHY reset */
+       gpio_direction_output(30, 0);
+       gpio_set_value(30, 0);
+
+       ctr  = 0;
+       do {
+               udelay(1000);
+               ctr++;
+       } while (ctr < 300);
+
+       /* deactivate PHY reset */
+       gpio_set_value(30, 1);
+
+       /* allow the PHY to stabilize and settle down */
+       ctr = 0;
+       do {
+               udelay(1000);
+               ctr++;
+       } while (ctr < 300);
+
+       /* ensure that the module is out of reset */
+       reset = readl(AM3517_IP_SW_RESET);
+       reset &= (~CPGMACSS_SW_RST);
+       writel(reset,AM3517_IP_SW_RESET);
+
        return 0;
 }
 
@@ -127,7 +159,7 @@ int board_mmc_init(bd_t *bis)
 }
 #endif
 
-#if defined(CONFIG_USB_ETHER) && defined(CONFIG_MUSB_GADGET)
+#if defined(CONFIG_USB_ETHER) && defined(CONFIG_USB_MUSB_GADGET)
 int board_eth_init(bd_t *bis)
 {
        int rv, n = 0;