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: 84817 X-Patchwork-Delegate: s-paulraj@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 8D8EAB7106 for ; Mon, 28 Feb 2011 22:51:08 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8925B28153; Mon, 28 Feb 2011 12:49:07 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zwlaFRrqYa-D; Mon, 28 Feb 2011 12:49:07 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 4497028108; Mon, 28 Feb 2011 12:47:24 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A520E28087 for ; Mon, 28 Feb 2011 12:46:52 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id q7r7mGUSe-Sd for ; Mon, 28 Feb 2011 12:46:52 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from arroyo.ext.ti.com (arroyo.ext.ti.com [192.94.94.40]) by theia.denx.de (Postfix) with ESMTPS id EB715280A0 for ; Mon, 28 Feb 2011 12:46:34 +0100 (CET) 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 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> Cc: x-loader@googlegroups.com, patches@linaro.org Subject: [U-Boot] [PATCH 21/22] omap: spl: add FAT support over MMC X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de 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();