Merge tag 'u-boot-atmel-fixes-2020.07-a' of https://gitlab.denx.de/u-boot/custodians...
[oweals/u-boot.git] / board / CarMediaLab / flea3 / flea3.c
index ca3e44b0c37235250d21b15ac61868f1099d9ad4..61d965f5f65ac6963f379c3a7be8956a28106658 100644 (file)
@@ -1,15 +1,17 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright (C) 2007, Guennadi Liakhovetski <lg@denx.de>
  *
  * (C) Copyright 2008-2010 Freescale Semiconductor, Inc.
  *
  * Copyright (C) 2011, Stefano Babic <sbabic@denx.de>
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
+#include <init.h>
 #include <asm/io.h>
+#include <env.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/crm_regs.h>
@@ -122,6 +124,8 @@ static void setup_iomux_fec(void)
                MX35_PAD_FEC_TDATA2__FEC_TDATA_2,
                MX35_PAD_FEC_RDATA3__FEC_RDATA_3,
                MX35_PAD_FEC_TDATA3__FEC_TDATA_3,
+               /* GPIO used to power off ethernet */
+               MX35_PAD_STXFS4__GPIO2_31,
        };
 
        /* setup pins for FEC */
@@ -183,6 +187,11 @@ int board_init(void)
        /* address of boot parameters */
        gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
 
+       /* Enable power for ethernet */
+       gpio_direction_output(63, 0);
+
+       udelay(2000);
+
        return 0;
 }
 
@@ -199,12 +208,12 @@ u32 get_board_rev(void)
  */
 int ft_board_setup(void *blob, bd_t *bd)
 {
-       struct node_info nodes[] = {
+       static const struct node_info nodes[] = {
                { "physmap-flash.0", MTD_DEV_TYPE_NOR, },  /* NOR flash */
                { "mxc_nand", MTD_DEV_TYPE_NAND, }, /* NAND flash */
        };
 
-       if (getenv("fdt_noauto")) {
+       if (env_get("fdt_noauto")) {
                puts("   Skiping ft_board_setup (fdt_noauto defined)\n");
                return 0;
        }