]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - board/davinci/da8xxevm/da830evm.c
Merge branch 'u-boot-samsung/master' into 'u-boot-arm/master'
[karo-tx-uboot.git] / board / davinci / da8xxevm / da830evm.c
index 57506d647adac4c592dfd474de4efb1a41e8a2e3..a4e92541578bd70535594957ce256a1ce6439005 100644 (file)
 #include <asm/arch/hardware.h>
 #include <asm/arch/emif_defs.h>
 #include <asm/arch/emac_defs.h>
+#include <asm/arch/pinmux_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;
-
-#define pinmux &davinci_syscfg_regs->pinmux
-
-/* SPI0 pin muxer settings */
-static const struct pinmux_config spi0_pins[] = {
-       { pinmux[7], 1, 3 },
-       { pinmux[7], 1, 4 },
-       { pinmux[7], 1, 5 },
-       { pinmux[7], 1, 6 },
-       { pinmux[7], 1, 7 }
-};
-
-/* EMIF-A bus pins for 8-bit NAND support on CS3 */
-static const struct pinmux_config emifa_nand_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[15], 1, 7 },
-       { pinmux[16], 1, 0 },
-       { pinmux[18], 1, 1 },
-       { pinmux[18], 1, 4 },
-       { pinmux[18], 1, 5 },
-};
-
-/* EMAC PHY interface pins */
-static const struct pinmux_config emac_pins[] = {
-       { pinmux[9], 0, 5 },
-       { pinmux[10], 2, 1 },
-       { pinmux[10], 2, 2 },
-       { pinmux[10], 2, 3 },
-       { pinmux[10], 2, 4 },
-       { pinmux[10], 2, 5 },
-       { pinmux[10], 2, 6 },
-       { pinmux[10], 2, 7 },
-       { pinmux[11], 2, 0 },
-       { pinmux[11], 2, 1 },
-};
-
-/* UART pin muxer settings */
-static const struct pinmux_config uart_pins[] = {
-       { pinmux[8], 2, 7 },
-       { pinmux[9], 2, 0 }
-};
-
-/* I2C pin muxer settings */
-static const struct pinmux_config i2c_pins[] = {
-       { pinmux[8], 2, 3 },
-       { pinmux[8], 2, 4 }
-};
+#ifdef CONFIG_DAVINCI_MMC
+#include <mmc.h>
+#include <asm/arch/sdmmc_defs.h>
+#endif
 
-/* USB0_DRVVBUS pin muxer settings */
-static const struct pinmux_config usb_pins[] = {
-       { pinmux[9], 1, 1 }
-};
+DECLARE_GLOBAL_DATA_PTR;
 
 static const struct pinmux_resource pinmuxes[] = {
 #ifdef CONFIG_SPI_FLASH
-       PINMUX_ITEM(spi0_pins),
+       PINMUX_ITEM(spi0_pins_base),
+       PINMUX_ITEM(spi0_pins_scs0),
+       PINMUX_ITEM(spi0_pins_ena),
 #endif
-       PINMUX_ITEM(uart_pins),
-       PINMUX_ITEM(i2c_pins),
+       PINMUX_ITEM(uart2_pins_txrx),
+       PINMUX_ITEM(i2c0_pins),
 #ifdef CONFIG_USB_DA8XX
        PINMUX_ITEM(usb_pins),
 #endif
 #ifdef CONFIG_USE_NAND
-       PINMUX_ITEM(emifa_nand_pins),
+       PINMUX_ITEM(emifa_pins),
+       PINMUX_ITEM(emifa_pins_cs0),
+       PINMUX_ITEM(emifa_pins_cs2),
+       PINMUX_ITEM(emifa_pins_cs3),
 #endif
 #if defined(CONFIG_DRIVER_TI_EMAC)
-       PINMUX_ITEM(emac_pins),
+       PINMUX_ITEM(emac_pins_rmii),
+       PINMUX_ITEM(emac_pins_mdio),
+       PINMUX_ITEM(emac_pins_rmii_clk_source),
+#endif
+#ifdef CONFIG_DAVINCI_MMC
+       PINMUX_ITEM(mmc0_pins_8bit)
 #endif
 };
 
@@ -127,8 +85,31 @@ static const struct lpsc_resource lpsc[] = {
        { DAVINCI_LPSC_EMAC },  /* image download */
        { DAVINCI_LPSC_UART2 }, /* console */
        { DAVINCI_LPSC_GPIO },
+#ifdef CONFIG_DAVINCI_MMC
+       { DAVINCI_LPSC_MMC_SD },
+#endif
+
+};
+
+#ifdef CONFIG_DAVINCI_MMC
+static struct davinci_mmc mmc_sd0 = {
+       .reg_base = (struct davinci_mmc_regs *)DAVINCI_MMC_SD0_BASE,
+       .host_caps = MMC_MODE_8BIT,
+       .voltages = MMC_VDD_32_33 | MMC_VDD_33_34,
+       .version = MMC_CTLR_VERSION_2,
 };
 
+int board_mmc_init(bd_t *bis)
+{
+       mmc_sd0.input_clk = clk_get(DAVINCI_MMCSD_CLKID);
+
+       printf("%x\n", mmc_sd0.input_clk);
+
+       /* Add slot-0 to mmc subsystem */
+       return davinci_mmc_init(bis, &mmc_sd0);
+}
+#endif
+
 int board_init(void)
 {
 #ifndef CONFIG_USE_IRQ
@@ -185,6 +166,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 +187,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 +211,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 */