Merge branch 'master' of git://git.denx.de/u-boot-i2c
[platform/kernel/u-boot.git] / board / ti / ks2_evm / board_k2g.c
index 88df419..39a782e 100644 (file)
@@ -1,10 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * K2G EVM : Board initialization
  *
  * (C) Copyright 2015
  *     Texas Instruments Incorporated, <www.ti.com>
- *
- * SPDX-License-Identifier:     GPL-2.0+
  */
 #include <common.h>
 #include <asm/arch/clock.h>
@@ -252,6 +251,7 @@ int board_fit_config_name_match(const char *name)
 #if defined(CONFIG_DTB_RESELECT)
 static int k2g_alt_board_detect(void)
 {
+#ifndef CONFIG_DM_I2C
        int rc;
 
        rc = i2c_set_bus_num(1);
@@ -261,7 +261,17 @@ static int k2g_alt_board_detect(void)
        rc = i2c_probe(K2G_GP_AUDIO_CODEC_ADDRESS);
        if (rc)
                return rc;
+#else
+       struct udevice *bus, *dev;
+       int rc;
 
+       rc = uclass_get_device_by_seq(UCLASS_I2C, 1, &bus);
+       if (rc)
+               return rc;
+       rc = dm_i2c_probe(bus, K2G_GP_AUDIO_CODEC_ADDRESS, 0, &dev);
+       if (rc)
+               return rc;
+#endif
        ti_i2c_eeprom_am_set("66AK2GGP", "1.0X");
 
        return 0;
@@ -355,28 +365,10 @@ void spl_init_keystone_plls(void)
 }
 #endif
 
-#ifdef CONFIG_DRIVER_TI_KEYSTONE_NET
-struct eth_priv_t eth_priv_cfg[] = {
-       {
-               .int_name       = "K2G_EMAC",
-               .rx_flow        = 0,
-               .phy_addr       = 0,
-               .slave_port     = 1,
-               .sgmii_link_type = SGMII_LINK_MAC_PHY,
-               .phy_if          = PHY_INTERFACE_MODE_RGMII,
-       },
-};
-
-int get_num_eth_ports(void)
-{
-       return sizeof(eth_priv_cfg) / sizeof(struct eth_priv_t);
-}
-#endif
-
 #ifdef CONFIG_TI_SECURE_DEVICE
 void board_pmmc_image_process(ulong pmmc_image, size_t pmmc_size)
 {
-       int id = getenv_ulong("dev_pmmc", 10, 0);
+       int id = env_get_ulong("dev_pmmc", 10, 0);
        int ret;
 
        if (!rproc_is_initialized())