Merge tag 'u-boot-atmel-fixes-2020.07-a' of https://gitlab.denx.de/u-boot/custodians...
[oweals/u-boot.git] / board / compulab / cm_t54 / cm_t54.c
index b1a067d8816fddeec015d3652595141040de7077..413f3c9c8f28e2ec4e9f3114f3e7e19776cfc4ab 100644 (file)
@@ -1,19 +1,21 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Board functions for Compulab CM-T54 board
  *
  * Copyright (C) 2014, Compulab Ltd - http://compulab.co.il/
  *
  * Author: Dmitry Lifshitz <lifshitz@compulab.co.il>
- *
- * SPDX-License-Identifier:     GPL-2.0+
  */
 
 #include <common.h>
+#include <env.h>
 #include <fdt_support.h>
+#include <net.h>
 #include <usb.h>
 #include <mmc.h>
 #include <palmas.h>
 #include <spl.h>
+#include <linux/delay.h>
 
 #include <asm/gpio.h>
 #include <asm/arch/sys_proto.h>
@@ -30,7 +32,7 @@
 DECLARE_GLOBAL_DATA_PTR;
 
 #if !defined(CONFIG_SPL_BUILD)
-inline void set_muxconf_regs_essential(void){};
+inline void set_muxconf_regs(void){};
 #endif
 
 const struct omap_sysinfo sysinfo = {
@@ -82,7 +84,7 @@ static int cm_t54_palmas_regulator_set(u8 vreg, u8 vval, u8 creg, u8 cval)
 #ifdef CONFIG_SYS_MMC_ENV_PART
 uint mmc_get_env_part(struct mmc *mmc)
 {
-       u32 bootmode = gd->arch.omap_boot_params.omap_bootmode;
+       u32 bootmode = gd->arch.omap_boot_mode;
        uint bootpart = CONFIG_SYS_MMC_ENV_PART;
 
        /*
@@ -96,7 +98,7 @@ uint mmc_get_env_part(struct mmc *mmc)
 }
 #endif
 
-#if defined(CONFIG_GENERIC_MMC) && !defined(CONFIG_SPL_BUILD)
+#if defined(CONFIG_MMC)
 #define SB_T54_CD_GPIO 228
 #define SB_T54_WP_GPIO 229
 
@@ -121,15 +123,17 @@ int board_mmc_init(bd_t *bis)
 
 #ifdef CONFIG_USB_HOST_ETHER
 
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
 {
        uint8_t enetaddr[6];
 
        /* MAC addr */
-       if (eth_getenv_enetaddr("usbethaddr", enetaddr)) {
+       if (eth_env_get_enetaddr("usbethaddr", enetaddr)) {
                fdt_find_and_setprop(blob, "/smsc95xx@0", "mac-address",
                                     enetaddr, 6, 1);
        }
+
+       return 0;
 }
 
 static void generate_mac_addr(uint8_t *enetaddr)
@@ -159,18 +163,18 @@ static int handle_mac_address(void)
        uint8_t enetaddr[6];
        int ret;
 
-       ret = eth_getenv_enetaddr("usbethaddr", enetaddr);
+       ret = eth_env_get_enetaddr("usbethaddr", enetaddr);
        if (ret)
                return 0;
 
-       ret = cl_eeprom_read_mac_addr(enetaddr);
-       if (ret || !is_valid_ether_addr(enetaddr))
+       ret = cl_eeprom_read_mac_addr(enetaddr, CONFIG_SYS_I2C_EEPROM_BUS);
+       if (ret || !is_valid_ethaddr(enetaddr))
                generate_mac_addr(enetaddr);
 
-       if (!is_valid_ether_addr(enetaddr))
+       if (!is_valid_ethaddr(enetaddr))
                return -1;
 
-       return eth_setenv_enetaddr("usbethaddr", enetaddr);
+       return eth_env_set_enetaddr("usbethaddr", enetaddr);
 }
 
 int board_eth_init(bd_t *bis)
@@ -179,7 +183,7 @@ int board_eth_init(bd_t *bis)
 }
 #endif
 
-#ifdef CONFIG_USB_EHCI
+#ifdef CONFIG_USB_EHCI_HCD
 static struct omap_usbhs_board_data usbhs_bdata = {
        .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED,
        .port_mode[1] = OMAP_EHCI_PORT_MODE_HSIC,
@@ -244,7 +248,7 @@ int ehci_hcd_stop(void)
        return ret;
 }
 
-void usb_hub_reset_devices(int port)
+void usb_hub_reset_devices(struct usb_hub_device *hub, int port)
 {
        /* The LAN9730 needs to be reset after the port power has been set. */
        if (port == 3) {