]> git.sur5r.net Git - u-boot/blobdiff - board/vscom/baltos/board.c
env: Rename getenv/_f() to env_get()
[u-boot] / board / vscom / baltos / board.c
index ac44e32341ff3f94c4e4779331416e9b7ac6f583..cb39190c286ae7d8ac33d344477ef7b5e3b500a4 100644 (file)
@@ -10,6 +10,7 @@
 
 #include <common.h>
 #include <errno.h>
+#include <libfdt.h>
 #include <spl.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/hardware.h>
@@ -38,6 +39,7 @@ DECLARE_GLOBAL_DATA_PTR;
 /* GPIO that controls power to DDR on EVM-SK */
 #define GPIO_DDR_VTT_EN                7
 #define DIP_S1                 44
+#define MPCIE_SW               100
 
 static struct ctrl_dev *cdev = (struct ctrl_dev *)CTRL_DEVICE_BASE;
 
@@ -66,7 +68,7 @@ static int baltos_set_console(void)
        printf("DIPs: 0x%1x\n", (~dips) & 0xf);
 
        if ((dips & 0xf) == 0xe)
-               setenv("console", "ttyUSB0,115200n8");
+               env_set("console", "ttyUSB0,115200n8");
 
        return 0;
 }
@@ -329,6 +331,11 @@ int ft_board_setup(void *blob, bd_t *bd)
        return 0;
 }
 
+static struct module_pin_mux pcie_sw_pin_mux[] = {
+       {OFFSET(mii1_rxdv), (MODE(7) | PULLUDEN )},     /* GPIO3_4 */
+       {-1},
+};
+
 static struct module_pin_mux dip_pin_mux[] = {
        {OFFSET(gpmc_ad12), (MODE(7) | RXACTIVE )},     /* GPIO1_12 */
        {OFFSET(gpmc_ad13), (MODE(7)  | RXACTIVE )},    /* GPIO1_13 */
@@ -354,7 +361,19 @@ int board_late_init(void)
                        baltos_set_console();
                }
        }
-       setenv("board_name", model);
+
+       /* turn power for the mPCIe slot */
+       configure_module_pin_mux(pcie_sw_pin_mux);
+       if (gpio_request(MPCIE_SW, "mpcie_sw")) {
+               printf("failed to export GPIO %d\n", MPCIE_SW);
+               return -ENODEV;
+       }
+       if (gpio_direction_output(MPCIE_SW, 1)) {
+               printf("failed to set GPIO %d direction\n", MPCIE_SW);
+               return -ENODEV;
+       }
+
+       env_set("board_name", model);
 #endif
 
        return 0;
@@ -414,7 +433,6 @@ int board_eth_init(bd_t *bis)
        int rv, n = 0;
        uint8_t mac_addr[6];
        uint32_t mac_hi, mac_lo;
-       __maybe_unused struct am335x_baseboard_id header;
 
        /*
         * Note here that we're using CPSW1 since that has a 1Gbit PHY while
@@ -435,11 +453,11 @@ int board_eth_init(bd_t *bis)
 
 #if (defined(CONFIG_DRIVER_TI_CPSW) && !defined(CONFIG_SPL_BUILD)) || \
        (defined(CONFIG_SPL_ETH_SUPPORT) && defined(CONFIG_SPL_BUILD))
-       if (!getenv("ethaddr")) {
+       if (!env_get("ethaddr")) {
                printf("<ethaddr> not set. Validating first E-fuse MAC\n");
 
                if (is_valid_ethaddr(mac_addr))
-                       eth_setenv_enetaddr("ethaddr", mac_addr);
+                       eth_env_set_enetaddr("ethaddr", mac_addr);
        }
 
 #ifdef CONFIG_DRIVER_TI_CPSW