From patchwork Mon Feb 28 11:46:30 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aneesh V X-Patchwork-Id: 242 Return-Path: Delivered-To: unknown Received: from imap.gmail.com (74.125.159.109) by localhost6.localdomain6 with IMAP4-SSL; 08 Jun 2011 14:41:07 -0000 Delivered-To: patches@linaro.org Received: by 10.224.19.208 with SMTP id c16cs91665qab; Mon, 28 Feb 2011 03:46:33 -0800 (PST) Received: by 10.151.47.4 with SMTP id z4mr7048127ybj.9.1298893593635; Mon, 28 Feb 2011 03:46:33 -0800 (PST) Received: from arroyo.ext.ti.com (arroyo.ext.ti.com [192.94.94.40]) by mx.google.com with ESMTPS id m1si6092290ybn.80.2011.02.28.03.46.33 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 28 Feb 2011 03:46:33 -0800 (PST) Received-SPF: pass (google.com: domain of aneesh@ti.com designates 192.94.94.40 as permitted sender) client-ip=192.94.94.40; Authentication-Results: mx.google.com; spf=pass (google.com: domain of aneesh@ti.com designates 192.94.94.40 as permitted sender) smtp.mail=aneesh@ti.com Received: from dbdp31.itg.ti.com ([172.24.170.98]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id p1SBkTau005414 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 28 Feb 2011 05:46:32 -0600 Received: from localhost (localhost [127.0.0.1]) by dbdp31.itg.ti.com (8.13.8/8.13.8) with ESMTP id p1SBkT5K011827; Mon, 28 Feb 2011 17:16:29 +0530 (IST) From: Aneesh V To: u-boot@lists.denx.de Cc: aneesh@ti.com, x-loader@googlegroups.com, patches@linaro.org, john.rigby@linaro.org Subject: [PATCH 21/22] omap: spl: add FAT support over MMC Date: Mon, 28 Feb 2011 17:16:30 +0530 Message-Id: <1298893591-17636-22-git-send-email-aneesh@ti.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1298893591-17636-1-git-send-email-aneesh@ti.com> References: <1298893591-17636-1-git-send-email-aneesh@ti.com> Signed-off-by: Aneesh V --- include/configs/omap4_sdp4430.h | 1 + spl/board/ti/sdp4430/Makefile | 8 ++++++++ spl/board/ti/spl-omap.c | 22 ++++++++++++++++++++++ 3 files changed, 31 insertions(+), 0 deletions(-) diff --git a/include/configs/omap4_sdp4430.h b/include/configs/omap4_sdp4430.h index 0ed474d..dcc9e39 100644 --- a/include/configs/omap4_sdp4430.h +++ b/include/configs/omap4_sdp4430.h @@ -259,6 +259,7 @@ #define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR 0x300 /* address 0x60000 */ #define CONFIG_SYS_U_BOOT_MAX_SIZE_SECTORS 0x200 /* 256 KB */ +#define CONFIG_SYS_MMC_SD_FAT_BOOT_PARTITION 1 #define CONFIG_SYS_SPL_BSS_START_ADDR 0x80000000 #define CONFIG_SYS_SPL_BSS_MAX_SIZE 0x80000 /* 512 KB */ diff --git a/spl/board/ti/sdp4430/Makefile b/spl/board/ti/sdp4430/Makefile index 18c5b8e..8310db9 100644 --- a/spl/board/ti/sdp4430/Makefile +++ b/spl/board/ti/sdp4430/Makefile @@ -103,6 +103,14 @@ $(obj)part_dos.h: @ln -s $(TOPDIR)/disk/part_dos.h $@ COBJS += omap_hsmmc.o omap24xx_i2c.o mmc.o time.o part.o part_dos.o + +# fat +$(obj)fat.c: + @rm -f $@ + @ln -s $(TOPDIR)/fs/fat/fat.c $@ + +COBJS += fat.o + # armv7 $(obj)start.S: @rm -f $@ diff --git a/spl/board/ti/spl-omap.c b/spl/board/ti/spl-omap.c index b64eac9..3612434 100644 --- a/spl/board/ti/spl-omap.c +++ b/spl/board/ti/spl-omap.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -101,6 +102,25 @@ end: } } +static void mmc_load_uboot_fat(struct mmc *mmc) +{ + s32 err; + + err = fat_register_device(&mmc->block_dev, + CONFIG_SYS_MMC_SD_FAT_BOOT_PARTITION); + if (err) { + printf("spl: fat register err - %d\n", err); + hang(); + } + + err = file_fat_read("u-boot.bin", (u8 *)CONFIG_SYS_TEXT_BASE, 0); + + if (err <= 0) { + printf("spl: error reading u-boot.bin - %d\n", err); + hang(); + } +} + static void mmc_load_uboot(u32 mmc_dev) { struct mmc *mmc; @@ -124,6 +144,8 @@ static void mmc_load_uboot(u32 mmc_dev) boot_mode = omap_boot_mode(); if (boot_mode == MMCSD_MODE_RAW) mmc_load_uboot_raw(mmc, mmc_dev); + else if (boot_mode == MMCSD_MODE_FAT) + mmc_load_uboot_fat(mmc); else { puts("spl: wrong MMC boot mode\n"); hang();