Exemple #1
0
static int beaglebone_devices_init(void)
{
	int black;

	if (!of_machine_is_compatible("ti,am335x-bone"))
		return 0;

	if (bootsource_get() == BOOTSOURCE_MMC) {
		if (bootsource_get_instance() == 0)
			omap_set_bootmmc_devname("mmc0");
		else
			omap_set_bootmmc_devname("mmc1");
	}

	black = is_beaglebone_black();

	defaultenv_append_directory(defaultenv_beaglebone);

	globalvar_add_simple("board.variant", black ? "boneblack" : "bone");

	printf("detected 'BeagleBone %s'\n", black ? "Black" : "White");

	armlinux_set_architecture(MACH_TYPE_BEAGLEBONE);

	return 0;
}
Exemple #2
0
static int e9_devices_init(void)
{
	int ret;
	char *environment_path;

	if (!of_machine_is_compatible("embedsky,e9"))
		return 0;

	armlinux_set_architecture(3980);

	environment_path = basprintf("/chosen/environment-mmc%d",
				       bootsource_get_instance());

	ret = of_device_enable_path(environment_path);

	if (ret < 0)
		pr_warn("Failed to enable environment partition '%s' (%d)\n",
			environment_path, ret);

	free(environment_path);

	defaultenv_append_directory(defaultenv_e9);

	imx6_bbu_internal_mmc_register_handler("sd", "/dev/mmc1",
		BBU_HANDLER_FLAG_DEFAULT);

	imx6_bbu_internal_mmc_register_handler("emmc", "/dev/mmc3",
		BBU_HANDLER_FLAG_DEFAULT);

	return 0;
}
Exemple #3
0
static int beaglebone_devices_init(void)
{
	int black;

	if (!of_machine_is_compatible("ti,am335x-bone"))
		return 0;

	if (bootsource_get() == BOOTSOURCE_MMC) {
		if (bootsource_get_instance() == 0)
			omap_set_bootmmc_devname("mmc0");
		else
			omap_set_bootmmc_devname("mmc1");
	}

	black = is_beaglebone_black();

	defaultenv_append_directory(defaultenv_beaglebone);

	globalvar_add_simple("board.variant", black ? "boneblack" : "bone");

	printf("detected 'BeagleBone %s'\n", black ? "Black" : "White");

	armlinux_set_architecture(MACH_TYPE_BEAGLEBONE);

	/* Register update handler */
	am33xx_bbu_emmc_mlo_register_handler("MLO.emmc", "/dev/mmc1");

	if (IS_ENABLED(CONFIG_SHELL_NONE))
		return am33xx_of_register_bootdevice();

	return 0;
}
Exemple #4
0
static int realq7_device_init(void)
{
	if (!of_machine_is_compatible("dmo,imx6q-edmqmx6"))
		return 0;

	gpio_direction_output(IMX_GPIO_NR(2, 22), 1);
	gpio_direction_output(IMX_GPIO_NR(2, 21), 1);

	switch (bootsource_get()) {
	case BOOTSOURCE_MMC:
		switch (bootsource_get_instance()) {
		case 2:
			of_device_enable_path("/chosen/environment-sd");
			break;
		case 3:
			of_device_enable_path("/chosen/environment-emmc");
			break;
		}
		break;
	default:
	case BOOTSOURCE_SPI:
		of_device_enable_path("/chosen/environment-spi");
		break;
	}

	return 0;
}
Exemple #5
0
static int tqma53_devices_init(void)
{
    char *of_env_path;
    unsigned bbu_flag_emmc = 0, bbu_flag_sd = 0;

    if (!of_machine_is_compatible("tq,tqma53"))
        return 0;

    barebox_set_hostname("tqma53");

    if (bootsource_get() == BOOTSOURCE_MMC &&
            bootsource_get_instance() == 1) {
        of_env_path = "/chosen/environment-sd";
        bbu_flag_sd = BBU_HANDLER_FLAG_DEFAULT;
    } else {
        of_env_path = "/chosen/environment-emmc";
        bbu_flag_emmc = BBU_HANDLER_FLAG_DEFAULT;
    }

    imx53_bbu_internal_mmc_register_handler("sd", "/dev/mmc1", bbu_flag_sd);
    imx53_bbu_internal_mmc_register_handler("emmc", "/dev/mmc2", bbu_flag_emmc);

    of_device_enable_path(of_env_path);

    armlinux_set_architecture(MACH_TYPE_TQMA53);

    return 0;
}
Exemple #6
0
static int physom_devices_init(void)
{
	if (!of_machine_is_compatible("phytec,am335x-som"))
		return 0;

	switch (bootsource_get()) {
	case BOOTSOURCE_SPI:
		of_device_enable_path("/chosen/environment-spi");
		break;
	case BOOTSOURCE_MMC:
		if (bootsource_get_instance() == 0)
			omap_set_bootmmc_devname("mmc0");
		else
			omap_set_bootmmc_devname("mmc1");
		break;
	default:
		of_device_enable_path("/chosen/environment-nand");
		break;
	}

	omap_set_barebox_part(&physom_barebox_part);
	defaultenv_append_directory(defaultenv_physom_am335x);

	/* Special module set up */
	if (of_machine_is_compatible("phytec,phycore-am335x-som")) {
		armlinux_set_architecture(MACH_TYPE_PCM051);
		barebox_set_hostname("pcm051");
	}

	if (of_machine_is_compatible("phytec,phyflex-am335x-som")) {
		armlinux_set_architecture(MACH_TYPE_PFLA03);
		am33xx_select_rmii2_crs_dv();
		barebox_set_hostname("pfla03");
	}

	if (of_machine_is_compatible("phytec,phycard-am335x-som")) {
		armlinux_set_architecture(MACH_TYPE_PCAAXS1);
		barebox_set_hostname("pcaaxs1");
	}

	/* Register update handler */
	am33xx_bbu_spi_nor_mlo_register_handler("MLO.spi", "/dev/m25p0.xload");
	am33xx_bbu_spi_nor_register_handler("spi", "/dev/m25p0.barebox");
	am33xx_bbu_nand_xloadslots_register_handler("MLO.nand",
		xloadslots, ARRAY_SIZE(xloadslots));
	am33xx_bbu_nand_slots_register_handler("nand", nandslots,
				ARRAY_SIZE(nandslots));

	if (IS_ENABLED(CONFIG_SHELL_NONE))
		return am33xx_of_register_bootdevice();

	return 0;
}
Exemple #7
0
static int tqma53_devices_init(void)
{
	char *of_env_path = "/chosen/environment-emmc";

	if (!of_machine_is_compatible("tq,tqma53"))
		return 0;

	barebox_set_model("TQ tqma53");
	barebox_set_hostname("tqma53");

	if (bootsource_get() == BOOTSOURCE_MMC &&
			bootsource_get_instance() == 1)
		of_env_path = "/chosen/environment-sd";

	of_device_enable_path(of_env_path);

	armlinux_set_architecture(MACH_TYPE_TQMA53);

	return 0;
}
Exemple #8
0
static int gk802_env_init(void)
{
	char *bootsource_name;
	char *barebox_name;
	char *default_environment_name;

	if (!of_machine_is_compatible("zealz,imx6q-gk802"))
		return 0;

	/* Keep RTL8192CU disabled */
	gpio_direction_output(GK802_GPIO_RTL8192_PDN, 1);

	gpio_direction_input(GK802_GPIO_RECOVERY_BTN);
	setenv("recovery", gpio_get_value(GK802_GPIO_RECOVERY_BTN) ? "0" : "1");

	if (bootsource_get() != BOOTSOURCE_MMC)
		return 0;

	switch (bootsource_get_instance()) {
	case 2:
		bootsource_name = "mmc2";
		barebox_name = "mmc2.barebox";
		default_environment_name = "mmc2.bareboxenv";
		default_environment_path = "/dev/mmc2.bareboxenv";
		break;
	case 3:
		bootsource_name = "mmc3";
		barebox_name = "mmc3.barebox";
		default_environment_name = "mmc3.bareboxenv";
		default_environment_path = "/dev/mmc3.bareboxenv";
		break;
	default:
		return 0;
	}

	device_detect_by_name(bootsource_name);
	devfs_add_partition(bootsource_name, 0x00000, SZ_512K, DEVFS_PARTITION_FIXED, barebox_name);
	devfs_add_partition(bootsource_name, SZ_512K, SZ_512K, DEVFS_PARTITION_FIXED, default_environment_name);

	return 0;
}