SPEAr : Support added for SPEAr310 board
[oweals/u-boot.git] / board / davinci / schmoogie / schmoogie.c
index 99fd32629ff757680765a97fa688fda57142d2f4..19c95809aa083d30f4ec73b548887c69cb4bc4ad 100644 (file)
@@ -27,8 +27,6 @@
 #include <common.h>
 #include <i2c.h>
 #include <asm/arch/hardware.h>
-#include <asm/arch/emac_defs.h>
-#include "../common/psc.h"
 #include "../common/misc.h"
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -41,41 +39,25 @@ int board_init(void)
        /* address of boot parameters */
        gd->bd->bi_boot_params = LINUX_BOOT_PARAM_ADDR;
 
-       /* Workaround for TMS320DM6446 errata 1.3.22 */
-       REG(PSC_SILVER_BULLET) = 0;
+       /* Configure AEMIF pins (although this should be configured at boot time
+        * with pull-up/pull-down resistors) */
+       REG(PINMUX0) = 0x00000c1f;
+
+       davinci_errata_workarounds();
 
        /* Power on required peripherals */
-       lpsc_on(DAVINCI_LPSC_EMAC);
-       lpsc_on(DAVINCI_LPSC_EMAC_WRAPPER);
-       lpsc_on(DAVINCI_LPSC_MDIO);
-       lpsc_on(DAVINCI_LPSC_I2C);
-       lpsc_on(DAVINCI_LPSC_UART0);
-       lpsc_on(DAVINCI_LPSC_TIMER1);
        lpsc_on(DAVINCI_LPSC_GPIO);
 
-#if !defined(CFG_USE_DSPLINK)
+#if !defined(CONFIG_SYS_USE_DSPLINK)
        /* Powerup the DSP */
        dsp_on();
-#endif /* CFG_USE_DSPLINK */
-
-       /* Bringup UART0 out of reset */
-       REG(UART0_PWREMU_MGMT) = 0x0000e003;
-
-       /* Enable GIO3.3V cells used for EMAC */
-       REG(VDD3P3V_PWDN) = 0;
-
-       /* Enable UART0 MUX lines */
-       REG(PINMUX1) |= 1;
+#endif /* CONFIG_SYS_USE_DSPLINK */
 
-       /* Enable EMAC and AEMIF pins */
-       REG(PINMUX0) = 0x80000c1f;
-
-       /* Enable I2C pin Mux */
-       REG(PINMUX1) |= (1 << 7);
-
-       /* Set the Bus Priority Register to appropriate value */
-       REG(VBPR) = 0x20;
+       davinci_enable_uart0();
+       davinci_enable_emac();
+       davinci_enable_i2c();
 
+       lpsc_on(DAVINCI_LPSC_TIMER1);
        timer_init();
 
        return(0);
@@ -87,7 +69,7 @@ int misc_init_r(void)
        int             i = 0;
 
        /* Set serial number from UID chip */
-       u_int8_t        crc_tbl[256] = {
+       const u_int8_t  crc_tbl[256] = {
                        0x00, 0x5e, 0xbc, 0xe2, 0x61, 0x3f, 0xdd, 0x83,
                        0xc2, 0x9c, 0x7e, 0x20, 0xa3, 0xfd, 0x1f, 0x41,
                        0x9d, 0xc3, 0x21, 0x7f, 0xfc, 0xa2, 0x40, 0x1e,
@@ -122,16 +104,14 @@ int misc_init_r(void)
                        0xb6, 0xe8, 0x0a, 0x54, 0xd7, 0x89, 0x6b, 0x35
                };
 
-       dv_display_clk_infos();
-
        /* Set serial number from UID chip */
-       if (i2c_read(CFG_UID_ADDR, 0, 1, buf, 8)) {
-               printf("\nUID @ 0x%02x read FAILED!!!\n", CFG_UID_ADDR);
+       if (i2c_read(CONFIG_SYS_UID_ADDR, 0, 1, buf, 8)) {
+               printf("\nUID @ 0x%02x read FAILED!!!\n", CONFIG_SYS_UID_ADDR);
                forceenv("serial#", "FAILED");
        } else {
                if (buf[0] != 0x70) {
                        /* Device Family Code */
-                       printf("\nUID @ 0x%02x read FAILED!!!\n", CFG_UID_ADDR);
+                       printf("\nUID @ 0x%02x read FAILED!!!\n", CONFIG_SYS_UID_ADDR);
                        forceenv("serial#", "FAILED");
                }
        }
@@ -141,7 +121,7 @@ int misc_init_r(void)
                tmp[0] = crc_tbl[tmp[0] ^ buf[i]];
 
        if (tmp[0] != 0) {
-               printf("\nUID @ 0x%02x - BAD CRC!!!\n", CFG_UID_ADDR);
+               printf("\nUID @ 0x%02x - BAD CRC!!!\n", CONFIG_SYS_UID_ADDR);
                forceenv("serial#", "FAILED");
        } else {
                /* CRC OK, set "serial" env variable */
@@ -150,8 +130,5 @@ int misc_init_r(void)
                forceenv("serial#", (char *)&tmp[0]);
        }
 
-       if (!eth_hw_init())
-               printf("ethernet init failed!\n");
-
        return(0);
 }