コード例 #1
0
ファイル: sdcard.c プロジェクト: gazoo74/at91bootstrap
int load_sdcard(struct image_info *image)
{
	FATFS	fs;
	FRESULT	fret;
	int	ret;

#ifdef CONFIG_AT91_MCI
#if defined(CONFIG_AT91_MCI0)
	at91_mci0_hw_init();
#elif defined(CONFIG_AT91_MCI1)
	at91_mci1_hw_init();
#elif defined(CONFIG_AT91_MCI2)
	at91_mci2_hw_init();
#endif
#endif

#ifdef CONFIG_SDHC
	at91_sdhc_hw_init();
#endif

	/* mount fs */
	fret = f_mount(0, &fs);
	if (fret != FR_OK) {
		dbg_info("*** FATFS: f_mount mount error **\n");
		return -1;
	}

	dbg_info("SD/MMC: Image: Read file %s to %x\n",
					image->filename, image->dest);

	ret = sdcard_loadimage(image->filename, image->dest);
	if (ret) {
		(void)f_mount(0, NULL);
		return ret;
	}

#ifdef CONFIG_OF_LIBFDT
	at91_board_set_dtb_name(image->of_filename);

	dbg_info("SD/MMC: dt blob: Read file %s to %x\n",
			image->of_filename, image->of_dest);

	ret = sdcard_loadimage(image->of_filename, image->of_dest);
	if (ret) {
		(void)f_mount(0, NULL);
		return ret;
	}

#endif

	/* umount fs */
	fret = f_mount(0, NULL);
	if (fret != FR_OK) {
		dbg_info("*** FATFS: f_mount umount error **\n");
		return -1;
	}

	return 0;
}
コード例 #2
0
ファイル: sdcard.c プロジェクト: JasonCC/at91bootstrap
int load_sdcard(struct image_info *image)
{
	FATFS	fs;
	FRESULT	fret;
	int	ret;

	at91_mci0_hw_init();

	/* mount fs */
	fret = f_mount(0, &fs);
	if (fret != FR_OK) {
		dbg_log(1, "*** FATFS: f_mount mount error **\n\r");
		return -1;
	}

	dbg_log(1, "SD/MMC: Image: Read file %s to %d\n\r",
					image->filename, image->dest);

	ret = sdcard_loadimage(image->filename, image->dest);
	if (ret)
		return ret;

	/* umount fs */
	fret = f_mount(0, NULL);
	if (fret != FR_OK) {
		dbg_log(1, "*** FATFS: f_mount umount error **\n\r");
		return -1;
	}

	if (image->of) {
		/* mount fs */
		fret = f_mount(0, &fs);
		if (fret != FR_OK) {
			dbg_log(1, "*** FATFS: f_mount error **\n\r");
			return -1;
		}

		dbg_log(1, "SD/MMC: dt blob: Read file %s to %d\n\r",
				image->of_filename, image->of_dest);

		ret = sdcard_loadimage(image->of_filename, image->of_dest);
		if (ret)
			return ret;

		/* umount fs */
		fret = f_mount(0, NULL);
		if (fret != FR_OK) {
			dbg_log(1, "*** FATFS: f_mount umount error **\n\r");
			return -1;
		}
	}

	return 0;
}
コード例 #3
0
ファイル: sdcard.c プロジェクト: facchinm/at91bootstrap
int load_sdcard(struct image_info *image)
{
	FATFS	fs;
	FRESULT	fret;
	int	ret;

#ifdef CONFIG_AT91_MCI
	at91_mci0_hw_init();
#endif

#ifdef CONFIG_SDHC
	at91_sdhc_hw_init();
#endif

	/* mount fs */
	fret = f_mount(0, &fs);
	if (fret != FR_OK) {
		dbg_info("*** FATFS: f_mount mount error **\n");
		return -1;
	}

	dbg_info("SD/MMC: Image: Read file %s to %d\n",
					image->filename, image->dest);

	ret = sdcard_loadimage(image->filename, image->dest);
	if (ret)
		return ret;

	/* umount fs */
	fret = f_mount(0, NULL);
	if (fret != FR_OK) {
		dbg_info("*** FATFS: f_mount umount error **\n");
		return -1;
	}

#ifdef CONFIG_OF_LIBFDT
	if (sdcard_set_of_name)
		sdcard_set_of_name(image->of_filename);

	/* mount fs */
	fret = f_mount(0, &fs);
	if (fret != FR_OK) {
		dbg_info("*** FATFS: f_mount error **\n");
		return -1;
	}

	dbg_info("SD/MMC: dt blob: Read file %s to %d\n",
			image->of_filename, image->of_dest);

	ret = sdcard_loadimage(image->of_filename, image->of_dest);
	if (ret)
		return ret;

	/* umount fs */
	fret = f_mount(0, NULL);
	if (fret != FR_OK) {
		dbg_info("*** FATFS: f_mount umount error **\n");
		return -1;
	}
#endif

	return 0;
}