da830: add support for NAND boot mode
[platform/kernel/u-boot.git] / board / davinci / da8xxevm / da830evm.c
index 6baa860..2021e73 100644 (file)
@@ -40,8 +40,9 @@
 #include <asm/arch/emif_defs.h>
 #include <asm/arch/emac_defs.h>
 #include <asm/io.h>
-#include "../common/misc.h"
-#include "common.h"
+#include <nand.h>
+#include <asm/arch/nand_defs.h>
+#include <asm/arch/davinci_misc.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -99,6 +100,56 @@ static const struct pinmux_config i2c_pins[] = {
        { pinmux(8), 2, 4 }
 };
 
+#ifdef CONFIG_USE_NAND
+/* NAND pin muxer settings */
+const struct pinmux_config aemif_pins[] = {
+       { pinmux(13), 1, 6 },
+       { pinmux(13), 1, 7 },
+       { pinmux(14), 1, 0 },
+       { pinmux(14), 1, 1 },
+       { pinmux(14), 1, 2 },
+       { pinmux(14), 1, 3 },
+       { pinmux(14), 1, 4 },
+       { pinmux(14), 1, 5 },
+       { pinmux(14), 1, 6 },
+       { pinmux(14), 1, 7 },
+       { pinmux(15), 1, 0 },
+       { pinmux(15), 1, 1 },
+       { pinmux(15), 1, 2 },
+       { pinmux(15), 1, 3 },
+       { pinmux(15), 1, 4 },
+       { pinmux(15), 1, 5 },
+       { pinmux(15), 1, 6 },
+       { pinmux(15), 1, 7 },
+       { pinmux(16), 1, 0 },
+       { pinmux(16), 1, 1 },
+       { pinmux(16), 1, 2 },
+       { pinmux(16), 1, 3 },
+       { pinmux(16), 1, 4 },
+       { pinmux(16), 1, 5 },
+       { pinmux(16), 1, 6 },
+       { pinmux(16), 1, 7 },
+       { pinmux(17), 1, 0 },
+       { pinmux(17), 1, 1 },
+       { pinmux(17), 1, 2 },
+       { pinmux(17), 1, 3 },
+       { pinmux(17), 1, 4 },
+       { pinmux(17), 1, 5 },
+       { pinmux(17), 1, 6 },
+       { pinmux(17), 1, 7 },
+       { pinmux(18), 1, 0 },
+       { pinmux(18), 1, 1 },
+       { pinmux(18), 1, 2 },
+       { pinmux(18), 1, 3 },
+       { pinmux(18), 1, 4 },
+       { pinmux(18), 1, 5 },
+       { pinmux(18), 1, 6 },
+       { pinmux(18), 1, 7 },
+       { pinmux(10), 1, 0 }
+};
+#endif
+
+
 /* USB0_DRVVBUS pin muxer settings */
 static const struct pinmux_config usb_pins[] = {
        { pinmux(9), 1, 1 }
@@ -115,6 +166,7 @@ static const struct pinmux_resource pinmuxes[] = {
 #endif
 #ifdef CONFIG_USE_NAND
        PINMUX_ITEM(emifa_nand_pins),
+       PINMUX_ITEM(aemif_pins),
 #endif
 #if defined(CONFIG_DRIVER_TI_EMAC)
        PINMUX_ITEM(emac_pins),
@@ -185,6 +237,16 @@ int board_init(void)
        return(0);
 }
 
+
+#ifdef CONFIG_NAND_DAVINCI
+int board_nand_init(struct nand_chip *nand)
+{
+       davinci_nand_init(nand);
+
+       return 0;
+}
+#endif
+
 #if defined(CONFIG_DRIVER_TI_EMAC)
 
 #define PHY_SW_I2C_ADDR        0x5f /* Address of PHY on i2c bus */
@@ -196,19 +258,17 @@ int board_eth_init(bd_t *bis)
 {
        u_int8_t mac_addr[6];
        u_int8_t switch_start_cmd[2] = { 0x01, 0x23 };
+       struct eth_device *dev;
 
        /* Read Ethernet MAC address from EEPROM */
        if (dvevm_read_mac_address(mac_addr))
                /* set address env if not already set */
-               dv_configure_mac_address(mac_addr);
+               davinci_sync_env_enetaddr(mac_addr);
 
        /* read the address back from env */
        if (!eth_getenv_enetaddr("ethaddr", mac_addr))
                return -1;
 
-       /* provide the resulting addr to the driver */
-       davinci_eth_set_mac_addr(mac_addr);
-
        /* enable the Ethernet switch in the 3 port PHY */
        if (i2c_write(PHY_SW_I2C_ADDR, 0, 0,
                        switch_start_cmd, sizeof(switch_start_cmd))) {
@@ -222,6 +282,12 @@ int board_eth_init(bd_t *bis)
                return -1;
        }
 
+       dev = eth_get_dev();
+
+       /* provide the resulting addr to the driver */
+       memcpy(dev->enetaddr, mac_addr, 6);
+       dev->write_hwaddr(dev);
+
        return 0;
 }
 #endif /* CONFIG_DRIVER_TI_EMAC */