]> git.sur5r.net Git - u-boot/blobdiff - board/davinci/sffsdr/sffsdr.c
VCMA9: remove EXT2 support
[u-boot] / board / davinci / sffsdr / sffsdr.c
index 6e878eb5722e55dffefbf91605b76be1b4f57f7f..f6ab91e6ff5576ebbc8e2ba8bae17595f8ac742a 100644 (file)
@@ -9,30 +9,13 @@
  *
  * Copyright (C) 2004 Texas Instruments.
  *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #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"
+#include <asm/arch/davinci_misc.h>
 
 #define DAVINCI_A3CR     (0x01E00014)  /* EMIF-A CS3 config register. */
 #define DAVINCI_A3CR_VAL (0x3FFFFFFD)  /* EMIF-A CS3 value for FPGA. */
@@ -51,41 +34,21 @@ 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;
+       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;
+#endif /* CONFIG_SYS_USE_DSPLINK */
 
-       /* Enable UART0 MUX lines */
-       REG(PINMUX1) |= 1;
-
-       /* 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);
@@ -99,35 +62,35 @@ static int sffsdr_read_mac_address(uint8_t *buf)
        u_int32_t value, mac[2], address;
 
        /* Read Integrity data structure checkword. */
-       if (i2c_read(CFG_I2C_EEPROM_ADDR, INTEGRITY_CHECKWORD_OFFSET,
-                    CFG_I2C_EEPROM_ADDR_LEN, (uint8_t *) &value, 4))
+       if (i2c_read(CONFIG_SYS_I2C_EEPROM_ADDR, INTEGRITY_CHECKWORD_OFFSET,
+                    CONFIG_SYS_I2C_EEPROM_ADDR_LEN, (uint8_t *) &value, 4))
                goto err;
        if (value != INTEGRITY_CHECKWORD_VALUE)
                return 0;
 
        /* Read SYSCFG structure offset. */
-       if (i2c_read(CFG_I2C_EEPROM_ADDR, INTEGRITY_SYSCFG_OFFSET,
-                    CFG_I2C_EEPROM_ADDR_LEN, (uint8_t *) &value, 4))
+       if (i2c_read(CONFIG_SYS_I2C_EEPROM_ADDR, INTEGRITY_SYSCFG_OFFSET,
+                    CONFIG_SYS_I2C_EEPROM_ADDR_LEN, (uint8_t *) &value, 4))
                goto err;
        address = 0x800 + (int) value; /* Address of SYSCFG structure. */
 
        /* Read NET CONFIG structure offset. */
-       if (i2c_read(CFG_I2C_EEPROM_ADDR, address,
-                    CFG_I2C_EEPROM_ADDR_LEN, (uint8_t *) &value, 4))
+       if (i2c_read(CONFIG_SYS_I2C_EEPROM_ADDR, address,
+                    CONFIG_SYS_I2C_EEPROM_ADDR_LEN, (uint8_t *) &value, 4))
                goto err;
        address = 0x800 + (int) value; /* Address of NET CONFIG structure. */
        address += 12; /* Address of NET INTERFACE CONFIG structure. */
 
        /* Read NET INTERFACE CONFIG 2 structure offset. */
-       if (i2c_read(CFG_I2C_EEPROM_ADDR, address,
-                    CFG_I2C_EEPROM_ADDR_LEN, (uint8_t *) &value, 4))
+       if (i2c_read(CONFIG_SYS_I2C_EEPROM_ADDR, address,
+                    CONFIG_SYS_I2C_EEPROM_ADDR_LEN, (uint8_t *) &value, 4))
                goto err;
        address = 0x800 + 16 + (int) value;     /* Address of NET INTERFACE
                                                 * CONFIG 2 structure. */
 
        /* Read MAC address. */
-       if (i2c_read(CFG_I2C_EEPROM_ADDR, address,
-                    CFG_I2C_EEPROM_ADDR_LEN, (uint8_t *) &mac[0], 8))
+       if (i2c_read(CONFIG_SYS_I2C_EEPROM_ADDR, address,
+                    CONFIG_SYS_I2C_EEPROM_ADDR_LEN, (uint8_t *) &mac[0], 8))
                goto err;
 
        buf[0] = mac[0] >> 24;
@@ -140,7 +103,7 @@ static int sffsdr_read_mac_address(uint8_t *buf)
        return 1; /* Found */
 
 err:
-       printf("Read from EEPROM @ 0x%02x failed\n", CFG_I2C_EEPROM_ADDR);
+       printf("Read from EEPROM @ 0x%02x failed\n", CONFIG_SYS_I2C_EEPROM_ADDR);
        return 0;
 }
 
@@ -153,22 +116,17 @@ int misc_init_r(void)
        /* EMIF-A CS3 configuration for FPGA. */
        REG(DAVINCI_A3CR) = DAVINCI_A3CR_VAL;
 
-       dv_display_clk_infos();
-
        /* Configure I2C switch (PCA9543) to enable channel 0. */
-       i2cbuf = CFG_I2C_PCA9543_ENABLE_CH0;
-       if (i2c_write(CFG_I2C_PCA9543_ADDR, 0,
-                     CFG_I2C_PCA9543_ADDR_LEN, &i2cbuf, 1)) {
-               printf("Write to MUX @ 0x%02x failed\n", CFG_I2C_PCA9543_ADDR);
+       i2cbuf = CONFIG_SYS_I2C_PCA9543_ENABLE_CH0;
+       if (i2c_write(CONFIG_SYS_I2C_PCA9543_ADDR, 0,
+                     CONFIG_SYS_I2C_PCA9543_ADDR_LEN, &i2cbuf, 1)) {
+               printf("Write to MUX @ 0x%02x failed\n", CONFIG_SYS_I2C_PCA9543_ADDR);
                return 1;
        }
 
        /* Read Ethernet MAC address from EEPROM if available. */
        if (sffsdr_read_mac_address(eeprom_enetaddr))
-               dv_configure_mac_address(eeprom_enetaddr);
-
-       if (!eth_hw_init())
-               printf("Ethernet init failed\n");
+               davinci_sync_env_enetaddr(eeprom_enetaddr);
 
        return(0);
 }