#include <common.h>
#include <dm.h>
+#include <env.h>
+#include <init.h>
+#include <log.h>
#include <asm/arch-tegra/ap.h>
#include <asm/gpio.h>
#include <asm/io.h>
#include <asm/arch/gpio.h>
#include <asm/arch/pinmux.h>
-#include <environment.h>
+#include <env_internal.h>
+#include <fdt_support.h>
#include <pci_tegra.h>
+#include <linux/delay.h>
+#include <linux/printk.h>
#include <power/as3722.h>
#include <power/pmic.h>
int arch_misc_init(void)
{
if (readl(NV_PA_BASE_SRAM + NVBOOTINFOTABLE_BOOTTYPE) ==
- NVBOOTTYPE_RECOVERY)
- printf("USB recovery mode\n");
+ NVBOOTTYPE_RECOVERY) {
+ printf("USB recovery mode, attempting to boot Toradex Easy "
+ "Installer\n");
+ env_set("bootdelay", "-2");
+ env_set("defargs", "pcie_aspm=off user_debug=30");
+ env_set("fdt_high", "");
+ env_set("initrd_high", "");
+
+ env_set("setup", "env set setupargs igb_mac=${ethaddr} "
+ "consoleblank=0 no_console_suspend=1 "
+ "console=${console},${baudrate}n8 ${memargs}");
+ env_set("teziargs", "rootfstype=squashfs root=/dev/ram quiet "
+ "autoinstall");
+ env_set("vidargs", "video=HDMI-A-1:640x480-16@60D");
+ env_set("bootcmd", "run setup; env set bootargs ${defargs} "
+ "${setupargs} ${vidargs} ${teziargs}; bootm 0x80208000"
+ "#config@${soc}-${fdt_module}-${fdt_board}.dtb");
+ }
/* PCB Version Indication: V1.2 and later have GPIO_PV0 wired to GND */
gpio_request(TEGRA_GPIO(V, 0), "PCB Version Indication");
env_set("fdt_module", FDT_MODULE_V1_0);
printf("patching fdt_module to " FDT_MODULE_V1_0
" for older V1.0 and V1.1 HW\n");
-#ifndef CONFIG_ENV_IS_NOWHERE
- env_save();
-#endif
}
/* activate USB power enable GPIOs */
return 0;
}
-int checkboard(void)
-{
- puts("Model: Toradex Apalis TK1 2GB\n");
-
- return 0;
-}
-
#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)
{
+ u8 enetaddr[6];
+
+ /* MAC addr */
+ if (eth_env_get_enetaddr("ethaddr", enetaddr)) {
+ int err = fdt_find_and_setprop(blob,
+ "/pcie@1003000/pci@2,0/ethernet@0,0",
+ "local-mac-address", enetaddr, 6, 0);
+
+ /* Older device trees might have used a different node name */
+ if (err < 0)
+ err = fdt_find_and_setprop(blob,
+ "/pcie@1003000/pci@2,0/pcie@0",
+ "local-mac-address", enetaddr, 6, 0);
+
+ if (err >= 0)
+ puts(" MAC address updated...\n");
+ }
+
return ft_common_board_setup(blob, bd);
}
#endif
int ret;
ret = uclass_get_device_by_driver(UCLASS_PMIC,
- DM_GET_DRIVER(pmic_as3722), &dev);
+ DM_DRIVER_GET(pmic_as3722), &dev);
if (ret) {
pr_err("failed to find AS3722 PMIC: %d\n", ret);
return ret;
int ret;
ret = uclass_get_device_by_driver(UCLASS_PMIC,
- DM_GET_DRIVER(pmic_as3722),
+ DM_DRIVER_GET(pmic_as3722),
&dev);
if (ret) {
debug("%s: Failed to find PMIC\n", __func__);