global: Move remaining CONFIG_SYS_SDRAM_* to CFG_SYS_SDRAM_*
[platform/kernel/u-boot.git] / board / ti / dra7xx / evm.c
index 74d04bb..1c00e25 100644 (file)
  */
 #include <common.h>
 #include <env.h>
+#include <fdt_support.h>
+#include <fastboot.h>
+#include <image.h>
+#include <init.h>
+#include <spl.h>
+#include <net.h>
 #include <palmas.h>
 #include <sata.h>
+#include <serial.h>
+#include <asm/global_data.h>
 #include <linux/string.h>
 #include <asm/gpio.h>
 #include <usb.h>
@@ -29,7 +37,6 @@
 #include <dwc3-omap-uboot.h>
 #include <i2c.h>
 #include <ti-usb-phy-uboot.h>
-#include <miiphy.h>
 
 #include "mux_data.h"
 #include "../common/board_detect.h"
 #define board_ti_get_emif_size()       board_ti_get_emif1_size() +     \
                                        board_ti_get_emif2_size()
 
-#ifdef CONFIG_DRIVER_TI_CPSW
-#include <cpsw.h>
-#endif
-
 DECLARE_GLOBAL_DATA_PTR;
 
 /* GPIO 7_11 */
@@ -625,7 +628,7 @@ int get_voltrail_opp(int rail_offset)
 /**
  * @brief board_init
  *
- * @return 0
+ * Return: 0
  */
 int board_init(void)
 {
@@ -641,7 +644,7 @@ int dram_init_banksize(void)
 
        ram_size = board_ti_get_emif_size();
 
-       gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
+       gd->bd->bi_dram[0].start = CFG_SYS_SDRAM_BASE;
        gd->bd->bi_dram[0].size = get_effective_memsize();
        if (ram_size > CONFIG_MAX_MEM_MAPPED) {
                gd->bd->bi_dram[1].start = 0x200000000;
@@ -782,7 +785,7 @@ void set_muxconf_regs(void)
                     early_padconf, ARRAY_SIZE(early_padconf));
 }
 
-#if defined(CONFIG_NAND)
+#if defined(CONFIG_MTD_RAW_NAND)
 static int nand_sw_detect(void)
 {
        int rc;
@@ -919,7 +922,7 @@ err:
 #endif
 
 #if defined(CONFIG_MMC)
-int board_mmc_init(bd_t *bis)
+int board_mmc_init(struct bd_info *bis)
 {
        omap_mmc_init(0, 0, 0, -1, -1);
        omap_mmc_init(1, 0, 0, -1, -1);
@@ -989,106 +992,6 @@ int spl_start_uboot(void)
 }
 #endif
 
-#ifdef CONFIG_DRIVER_TI_CPSW
-extern u32 *const omap_si_rev;
-
-static void cpsw_control(int enabled)
-{
-       /* VTP can be added here */
-
-       return;
-}
-
-static struct cpsw_slave_data cpsw_slaves[] = {
-       {
-               .slave_reg_ofs  = 0x208,
-               .sliver_reg_ofs = 0xd80,
-               .phy_addr       = 2,
-       },
-       {
-               .slave_reg_ofs  = 0x308,
-               .sliver_reg_ofs = 0xdc0,
-               .phy_addr       = 3,
-       },
-};
-
-static struct cpsw_platform_data cpsw_data = {
-       .mdio_base              = CPSW_MDIO_BASE,
-       .cpsw_base              = CPSW_BASE,
-       .mdio_div               = 0xff,
-       .channels               = 8,
-       .cpdma_reg_ofs          = 0x800,
-       .slaves                 = 2,
-       .slave_data             = cpsw_slaves,
-       .ale_reg_ofs            = 0xd00,
-       .ale_entries            = 1024,
-       .host_port_reg_ofs      = 0x108,
-       .hw_stats_reg_ofs       = 0x900,
-       .bd_ram_ofs             = 0x2000,
-       .mac_control            = (1 << 5),
-       .control                = cpsw_control,
-       .host_port_num          = 0,
-       .version                = CPSW_CTRL_VERSION_2,
-};
-
-int board_eth_init(bd_t *bis)
-{
-       int ret;
-       uint8_t mac_addr[6];
-       uint32_t mac_hi, mac_lo;
-       uint32_t ctrl_val;
-
-       /* try reading mac address from efuse */
-       mac_lo = readl((*ctrl)->control_core_mac_id_0_lo);
-       mac_hi = readl((*ctrl)->control_core_mac_id_0_hi);
-       mac_addr[0] = (mac_hi & 0xFF0000) >> 16;
-       mac_addr[1] = (mac_hi & 0xFF00) >> 8;
-       mac_addr[2] = mac_hi & 0xFF;
-       mac_addr[3] = (mac_lo & 0xFF0000) >> 16;
-       mac_addr[4] = (mac_lo & 0xFF00) >> 8;
-       mac_addr[5] = mac_lo & 0xFF;
-
-       if (!env_get("ethaddr")) {
-               printf("<ethaddr> not set. Validating first E-fuse MAC\n");
-
-               if (is_valid_ethaddr(mac_addr))
-                       eth_env_set_enetaddr("ethaddr", mac_addr);
-       }
-
-       mac_lo = readl((*ctrl)->control_core_mac_id_1_lo);
-       mac_hi = readl((*ctrl)->control_core_mac_id_1_hi);
-       mac_addr[0] = (mac_hi & 0xFF0000) >> 16;
-       mac_addr[1] = (mac_hi & 0xFF00) >> 8;
-       mac_addr[2] = mac_hi & 0xFF;
-       mac_addr[3] = (mac_lo & 0xFF0000) >> 16;
-       mac_addr[4] = (mac_lo & 0xFF00) >> 8;
-       mac_addr[5] = mac_lo & 0xFF;
-
-       if (!env_get("eth1addr")) {
-               if (is_valid_ethaddr(mac_addr))
-                       eth_env_set_enetaddr("eth1addr", mac_addr);
-       }
-
-       ctrl_val = readl((*ctrl)->control_core_control_io1) & (~0x33);
-       ctrl_val |= 0x22;
-       writel(ctrl_val, (*ctrl)->control_core_control_io1);
-
-       if (*omap_si_rev == DRA722_ES1_0)
-               cpsw_data.active_slave = 1;
-
-       if (board_is_dra72x_revc_or_later()) {
-               cpsw_slaves[0].phy_if = PHY_INTERFACE_MODE_RGMII_ID;
-               cpsw_slaves[1].phy_if = PHY_INTERFACE_MODE_RGMII_ID;
-       }
-
-       ret = cpsw_register(&cpsw_data);
-       if (ret < 0)
-               printf("Error %d registering CPSW switch\n", ret);
-
-       return ret;
-}
-#endif
-
 #ifdef CONFIG_BOARD_EARLY_INIT_F
 /* VTT regulator enable */
 static inline void vtt_regulator_enable(void)
@@ -1116,7 +1019,7 @@ int board_early_init_f(void)
 #endif
 
 #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
-int ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, struct bd_info *bd)
 {
        ft_cpu_setup(blob, bd);
 
@@ -1149,8 +1052,11 @@ int board_fit_config_name_match(const char *name)
 #endif
 
 #if CONFIG_IS_ENABLED(FASTBOOT) && !CONFIG_IS_ENABLED(ENV_IS_NOWHERE)
-int fastboot_set_reboot_flag(void)
+int fastboot_set_reboot_flag(enum fastboot_reboot_reason reason)
 {
+       if (reason != FASTBOOT_REBOOT_REASON_BOOTLOADER)
+               return -ENOTSUPP;
+
        printf("Setting reboot to fastboot flag ...\n");
        env_set("dofastboot", "1");
        env_save();
@@ -1159,7 +1065,8 @@ int fastboot_set_reboot_flag(void)
 #endif
 
 #ifdef CONFIG_TI_SECURE_DEVICE
-void board_fit_image_post_process(void **p_image, size_t *p_size)
+void board_fit_image_post_process(const void *fit, int node, void **p_image,
+                                 size_t *p_size)
 {
        secure_boot_verify_image(p_image, p_size);
 }