From patchwork Thu Aug 2 07:25:10 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajeshwari Shinde X-Patchwork-Id: 10460 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id B04742402A for ; Thu, 2 Aug 2012 07:19:10 +0000 (UTC) Received: from mail-yw0-f52.google.com (mail-yw0-f52.google.com [209.85.213.52]) by fiordland.canonical.com (Postfix) with ESMTP id 7A14CA18040 for ; Thu, 2 Aug 2012 07:19:10 +0000 (UTC) Received: by mail-yw0-f52.google.com with SMTP id p61so8252009yhp.11 for ; Thu, 02 Aug 2012 00:19:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:x-auditid :from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-brightmail-tracker:x-tm-as-mml:x-gm-message-state; bh=1L0WG1Lj6dNQj87q1evvOpe8mF6YezoGQ7KV5Zfl2pY=; b=oBKUSM7TaVCGQoqjkPLEG8IM+pMsN8sLZ5hxdx2iyzp/lkG2ItBG6YFTdKthSjaXIv hHs9Eg75SzbpKIJGKNV70D/rFL0PSGQncVLZrodiCZYC/rdkDdNTsoCRf0h9BBW5Xe1I v0aCgNrAyGJS614Tgk7M0CMDz0Uj2SZnX1oKud+zlp27f/5IUkRbqlmNl+qUliBiH5LN t8K/MFL5uJXKOP46Z6UXp6G8W4sIwIly+gsCK3xD3qQI/T13K7imnocZpRtX5fMZVWch DiOtJAsb7GPTz0bz5CYkSBt9EUSS28PEdTxhGYTB4pX8GkSIvexEfCW8BGxOALdgRyGq YI4A== Received: by 10.50.47.161 with SMTP id e1mr1862444ign.11.1343891950118; Thu, 02 Aug 2012 00:19:10 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.87.40 with SMTP id u8csp239579igz; Thu, 2 Aug 2012 00:19:09 -0700 (PDT) Received: by 10.60.30.35 with SMTP id p3mr34089877oeh.16.1343891949651; Thu, 02 Aug 2012 00:19:09 -0700 (PDT) Received: from mailout1.samsung.com (mailout1.samsung.com. [203.254.224.24]) by mx.google.com with ESMTP id m6si5778706oec.16.2012.08.02.00.19.09; Thu, 02 Aug 2012 00:19:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of rajeshwari.s@samsung.com designates 203.254.224.24 as permitted sender) client-ip=203.254.224.24; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of rajeshwari.s@samsung.com designates 203.254.224.24 as permitted sender) smtp.mail=rajeshwari.s@samsung.com Received: from epcpsbgm1.samsung.com (mailout1.samsung.com [203.254.224.24]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0M8400HHH9N12UO0@mailout1.samsung.com>; Thu, 02 Aug 2012 16:19:08 +0900 (KST) X-AuditID: cbfee61a-b7f616d000004b7e-df-501a29ec788d Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 2B.5A.19326.CE92A105; Thu, 02 Aug 2012 16:19:08 +0900 (KST) Received: from rajeshwari-linux.sisodomain.com ([107.108.215.115]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0M840099U9N7OKD0@mmp1.samsung.com>; Thu, 02 Aug 2012 16:19:08 +0900 (KST) From: Rajeshwari Shinde To: u-boot@lists.denx.de Cc: patches@linaro.org, alim.akhtar@samsung.com, sjg@chromium.org, mk7.kang@samsung.com, chander.kashyap@linaro.org, vapier@gentoo.org Subject: [PATCH 7/7] EXYNOS5: Enable SPI booting. Date: Thu, 02 Aug 2012 12:55:10 +0530 Message-id: <1343892310-21018-8-git-send-email-rajeshwari.s@samsung.com> X-Mailer: git-send-email 1.7.4.4 In-reply-to: <1343892310-21018-1-git-send-email-rajeshwari.s@samsung.com> References: <1343892310-21018-1-git-send-email-rajeshwari.s@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrOJMWRmVeSWpSXmKPExsVy+t9jAd03mlIBBq2HeSwerr/JYjHl8BcW ByaPO9f2sAUwRnHZpKTmZJalFunbJXBl9L5sZSqYKlGx+edrtgbGF8JdjBwcEgImEq+mpXQx cgKZYhIX7q1n62Lk4hASWMQoMf3VE1YIZyKTxPffMxhBqtgEjCS2npwGZosISEj86r/KCFLE LNDBKHH42w4mkISwgKHEzumvWUFsFgFVibkrG9hAbF4BD4kJ6z+wQqxTkDg29SuYzSngKXFx zkpmkIuEgGq+vc+bwMi7gJFhFaNoakFyQXFSeq6hXnFibnFpXrpecn7uJkaw959J7WBc2WBx iFGAg1GJh3dlqWSAEGtiWXFl7iFGCQ5mJRHeOxJSAUK8KYmVValF+fFFpTmpxYcYpTlYlMR5 jb2/+gsJpCeWpGanphakFsFkmTg4pRoY+w9MY3kzuVSfWye4MlJSvbG26Pl1Z3tWpsP8ij8e Sy44kM+yTdSb99HqFP+IYs/3K7qTNe0Xr0pct/elugS7wRuJFlFl3ccut/S35bG+mu7H7LL6 oe8xpju8j0RtVrHP/+AyS5chqr4u8+lnX4ZAvg55h4U6ijWtv+tnXPofapi3t7k4TkWJpTgj 0VCLuag4EQAgfOTI+gEAAA== X-TM-AS-MML: No X-Gm-Message-State: ALoCoQkwX3JBuaTlGuErasAZQZAWZZ1O1Lw157CCYes4RSro7hRtJ+KFKaQ7SVjCwr/ENfnX4Y3S This patch enables SPI Booting for EXYNOS5 Signed-off-by: Rajeshwari Shinde --- Changes in V2: - None. Changes in V3: - None. Changes in V4: - Rebased on Mainline u-boot.git. - Corrected the Commit message. board/samsung/smdk5250/Makefile | 2 +- board/samsung/smdk5250/{mmc_boot.c => spl_boot.c} | 31 +++++++++++++++++++- include/configs/smdk5250.h | 5 +++ 3 files changed, 35 insertions(+), 3 deletions(-) rename board/samsung/smdk5250/{mmc_boot.c => spl_boot.c} (66%) diff --git a/board/samsung/smdk5250/Makefile b/board/samsung/smdk5250/Makefile index 226db1f..9cfde0f 100644 --- a/board/samsung/smdk5250/Makefile +++ b/board/samsung/smdk5250/Makefile @@ -35,7 +35,7 @@ COBJS += smdk5250.o endif ifdef CONFIG_SPL_BUILD -COBJS += mmc_boot.o +COBJS += spl_boot.o endif SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) diff --git a/board/samsung/smdk5250/mmc_boot.c b/board/samsung/smdk5250/spl_boot.c similarity index 66% rename from board/samsung/smdk5250/mmc_boot.c rename to board/samsung/smdk5250/spl_boot.c index 449a919..d8f3c1e 100644 --- a/board/samsung/smdk5250/mmc_boot.c +++ b/board/samsung/smdk5250/spl_boot.c @@ -23,6 +23,16 @@ #include #include +enum boot_mode { + BOOT_MODE_MMC = 4, + BOOT_MODE_SERIAL = 20, + /* Boot based on Operating Mode pin settings */ + BOOT_MODE_OM = 32, + BOOT_MODE_USB, /* Boot using USB download */ +}; + + typedef u32 (*spi_copy_func_t)(u32 offset, u32 nblock, u32 dst); + /* * Copy U-boot from mmc to RAM: * COPY_BL2_FNPTR_ADDR: Address in iRAM, which Contains @@ -30,9 +40,26 @@ */ void copy_uboot_to_ram(void) { - u32 (*copy_bl2)(u32, u32, u32) = (void *) *(u32 *)COPY_BL2_FNPTR_ADDR; + spi_copy_func_t spi_copy; + enum boot_mode bootmode; + u32 (*copy_bl2)(u32, u32, u32); + + bootmode = readl(EXYNOS5_POWER_BASE) & OM_STAT; - copy_bl2(BL2_START_OFFSET, BL2_SIZE_BLOC_COUNT, CONFIG_SYS_TEXT_BASE); + switch (bootmode) { + case BOOT_MODE_SERIAL: + spi_copy = *(spi_copy_func_t *)EXYNOS_COPY_SPI_FNPTR_ADDR; + spi_copy(SPI_FLASH_UBOOT_POS, CONFIG_BL2_SIZE, + CONFIG_SYS_TEXT_BASE); + break; + case BOOT_MODE_MMC: + copy_bl2 = (void *) *(u32 *)COPY_BL2_FNPTR_ADDR; + copy_bl2(BL2_START_OFFSET, BL2_SIZE_BLOC_COUNT, + CONFIG_SYS_TEXT_BASE); + break; + default: + break; + } } void board_init_f(unsigned long bootflag) diff --git a/include/configs/smdk5250.h b/include/configs/smdk5250.h index 0f85be6..a926a7e 100644 --- a/include/configs/smdk5250.h +++ b/include/configs/smdk5250.h @@ -187,6 +187,11 @@ /* U-boot copy size from boot Media to DRAM.*/ #define BL2_START_OFFSET (CONFIG_BL2_OFFSET/512) #define BL2_SIZE_BLOC_COUNT (CONFIG_BL2_SIZE/512) + +#define OM_STAT (0x1f << 1) +#define EXYNOS_COPY_SPI_FNPTR_ADDR 0x02020058 +#define SPI_FLASH_UBOOT_POS (CONFIG_SEC_FW_SIZE + CONFIG_BL1_SIZE) + #define CONFIG_DOS_PARTITION #define CONFIG_IRAM_STACK 0x02050000