Merge tag 'u-boot-atmel-fixes-2020.07-a' of https://gitlab.denx.de/u-boot/custodians...
[oweals/u-boot.git] / board / davinci / da8xxevm / da850evm.c
index c2d2e8e882919eff7b1b02eab765eee12b9d878a..a3b0f8bf0924944f2281f3b77be4fa0b589a6433 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
  *
@@ -5,14 +6,14 @@
  *
  * Copyright (C) 2009 Nick Thompson, GE Fanuc, Ltd. <nick.thompson@gefanuc.com>
  * Copyright (C) 2007 Sergey Kubushyn <ksi@koi8.net>
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
+#include <dm.h>
+#include <env.h>
 #include <i2c.h>
+#include <init.h>
 #include <net.h>
-#include <netdev.h>
 #include <spi.h>
 #include <spi_flash.h>
 #include <asm/arch/hardware.h>
@@ -24,6 +25,7 @@
 #include <linux/errno.h>
 #include <hwconfig.h>
 #include <asm/mach-types.h>
+#include <asm/gpio.h>
 
 #ifdef CONFIG_MMC_DAVINCI
 #include <mmc.h>
@@ -60,7 +62,7 @@ static int get_mac_addr(u8 *addr)
                return -1;
        }
 
-       ret = spi_flash_read(flash, CFG_MAC_ADDR_OFFSET, 6, addr);
+       ret = spi_flash_read(flash, (CFG_MAC_ADDR_OFFSET), 6, addr);
        if (ret) {
                printf("Error - unable to read MAC address from SPI flash.\n");
                return -1;
@@ -133,11 +135,14 @@ int misc_init_r(void)
 
        enetaddr_found = eth_env_get_enetaddr("ethaddr", env_enetaddr);
 
+#endif
+
 #ifdef CONFIG_MAC_ADDR_IN_SPIFLASH
        int spi_mac_read;
        uchar buff[6];
 
        spi_mac_read = get_mac_addr(buff);
+       buff[0] = 0;
 
        /*
         * MAC address not present in the environment
@@ -167,7 +172,8 @@ int misc_init_r(void)
                                        "with the MAC address in the environment\n");
                printf("Default using MAC address from environment\n");
        }
-#endif
+
+#elif defined(CONFIG_MAC_ADDR_IN_EEPROM)
        uint8_t enetaddr[8];
        int eeprom_mac_read;
 
@@ -198,23 +204,6 @@ int misc_init_r(void)
        return 0;
 }
 
-#ifdef CONFIG_MMC_DAVINCI
-static struct davinci_mmc mmc_sd0 = {
-       .reg_base = (struct davinci_mmc_regs *)DAVINCI_MMC_SD0_BASE,
-       .host_caps = MMC_MODE_4BIT,     /* DA850 supports only 4-bit SD/MMC */
-       .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);
-
-       /* Add slot-0 to mmc subsystem */
-       return davinci_mmc_init(bis, &mmc_sd0);
-}
-#endif
-
 static const struct pinmux_config gpio_pins[] = {
 #ifdef CONFIG_USE_NOR
        /* GP0[11] is required for NOR to work on Rev 3 EVMs */
@@ -302,9 +291,6 @@ u32 get_board_rev(void)
                rev = 2;
        else if (maxcpuclk >= 372000000)
                rev = 1;
-#ifdef CONFIG_DA850_AM18X_EVM
-       rev |= REV_AM18X_EVM;
-#endif
        return rev;
 }
 
@@ -355,10 +341,6 @@ int board_init(void)
                 DAVINCI_SYSCFG_SUSPSRC_UART2),
               &davinci_syscfg_regs->suspsrc);
 
-       /* configure pinmux settings */
-       if (davinci_configure_pin_mux_items(pinmuxes, ARRAY_SIZE(pinmuxes)))
-               return 1;
-
 #ifdef CONFIG_USE_NOR
        /* Set the GPIO direction as output */
        clrbits_le32((u32 *)GPIO_BANK0_REG_DIR_ADDR, (0x01 << 11));
@@ -379,11 +361,6 @@ int board_init(void)
        davinci_emac_mii_mode_sel(HAS_RMII);
 #endif /* CONFIG_DRIVER_TI_EMAC */
 
-       /* enable the console UART */
-       writel((DAVINCI_UART_PWREMU_MGMT_FREE | DAVINCI_UART_PWREMU_MGMT_URRST |
-               DAVINCI_UART_PWREMU_MGMT_UTRST),
-              &davinci_uart2_ctrl_regs->pwremu_mgmt);
-
        return 0;
 }
 
@@ -483,11 +460,6 @@ int board_eth_init(bd_t *bis)
        if (rmii_hw_init())
                printf("RMII hardware init failed!!!\n");
 #endif
-       if (!davinci_emac_initialize()) {
-               printf("Error: Ethernet init failed!\n");
-               return -1;
-       }
-
        return 0;
 }
 #endif /* CONFIG_DRIVER_TI_EMAC */