From patchwork Tue Jul 31 10:42:40 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajeshwari Shinde X-Patchwork-Id: 10384 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 0347D23E02 for ; Tue, 31 Jul 2012 10:36:39 +0000 (UTC) Received: from mail-gh0-f180.google.com (mail-gh0-f180.google.com [209.85.160.180]) by fiordland.canonical.com (Postfix) with ESMTP id C76ABA18836 for ; Tue, 31 Jul 2012 10:36:38 +0000 (UTC) Received: by mail-gh0-f180.google.com with SMTP id z12so5714229ghb.11 for ; Tue, 31 Jul 2012 03:36:38 -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=cXB6xxWSv+Uw4uH6WpdV8dfat8sP6OG5lIZYEPQlPxA=; b=G9WK9SeK3BoVgccjPiweTQXmRGWdwoq/PwFn0zDUkdNIepM8QHZt9Xj6bahrkIsO/K ZEbO8n95I5OCkhGcxTFRkC7A6bxfe2sQLR316yLpFUj3WP7Stjd4+J3j3NDBXBNmg/gE eeM41Nqe+ZwoumSqL82YlrJT6eGjfxdFn4gBFkT+ddbG0LmgeyTl2o4H95z/grkRWfg6 NgAVwUiiXjIL77P1QvzJ8+tMUGEM/0C94FmbEZHS9heyzFA0ANZigA/YhnQm2zc+OmfX wgc9YVYQukawStRyKwEzyOUX1iIi7bhqxlQOrQjove6uazwh/dWUHNC2iCtjUvts1ec9 z34w== Received: by 10.50.219.226 with SMTP id pr2mr1508350igc.51.1343730998286; Tue, 31 Jul 2012 03:36:38 -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 u8csp135220igz; Tue, 31 Jul 2012 03:36:37 -0700 (PDT) Received: by 10.66.88.39 with SMTP id bd7mr31292148pab.50.1343730997757; Tue, 31 Jul 2012 03:36:37 -0700 (PDT) Received: from mailout1.samsung.com (mailout1.samsung.com. [203.254.224.24]) by mx.google.com with ESMTP id vn9si12234pbc.317.2012.07.31.03.36.37; Tue, 31 Jul 2012 03:36:37 -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 <0M8000A56TGJRRX0@mailout1.samsung.com>; Tue, 31 Jul 2012 19:36:36 +0900 (KST) X-AuditID: cbfee61a-b7f616d000004b7e-62-5017b5347291 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id DE.C6.19326.435B7105; Tue, 31 Jul 2012 19:36:36 +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 <0M800037ATGJHE20@mmp1.samsung.com>; Tue, 31 Jul 2012 19:36:36 +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 Subject: [PATCH 8/8] EXYNOS5: Enable SPI booting. Date: Tue, 31 Jul 2012 16:12:40 +0530 Message-id: <1343731360-31691-9-git-send-email-rajeshwari.s@samsung.com> X-Mailer: git-send-email 1.7.4.4 In-reply-to: <1343731360-31691-1-git-send-email-rajeshwari.s@samsung.com> References: <1343731360-31691-1-git-send-email-rajeshwari.s@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrOJMWRmVeSWpSXmKPExsVy+t9jAV2TreIBBg+faVo8XH+TxWLK4S8s Dkwed67tYQtgjOKySUnNySxLLdK3S+DKaGs7wlrwVaziwaE25gbGBuEuRk4OCQETiYnXv7JA 2GISF+6tZ+ti5OIQEljEKPFmWg8zhDORSeLeuh2MIFVsAkYSW09OA7NFBCQkfvVfBbI5OJgF SiWmTMwDCQsLGEp8WbUIrIRFQFVi/7sesAW8Ah4SL878Z4dYpiBxbOpXVhCbU8BTomnKJ7Aa IaCa9v4upgmMvAsYGVYxiqYWJBcUJ6XnGuoVJ+YWl+al6yXn525iBHv/mdQOxpUNFocYBTgY lXh4PU6KBQixJpYVV+YeYpTgYFYS4WVdIR4gxJuSWFmVWpQfX1Sak1p8iFGag0VJnNfY+6u/ kEB6YklqdmpqQWoRTJaJg1OqgTFRePI9U59Fb2clMZRuf6WUUtbunNfyK7Xs+u07DLYlmzu+ H3Vdu/CAxqLZCyuOiNxnOy/Xvn/991wJs9sHNyw+c/zIyVbH9RXz7rZbf7y8N+l1VrX6zYn2 1x6brCiN0NuoFyZR/vPyVgmJ5bP9dkga7msL5XaTUeT0/nS65MqHXWKt2ffjr5oosRRnJBpq MRcVJwIAxi3pq/oBAAA= X-TM-AS-MML: No X-Gm-Message-State: ALoCoQmXZwH202mHAvdhfUmL68UyU8jgoVU534VP8CIjd3eGbt23Z3OGbeJiMprCf0OHAI9ZNjzP This patch enables SPI Booting for EXYNOS5 Signed-off-by: Rajeshwari Shinde --- 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 1474fa8..47c6a5a 100644 --- a/board/samsung/smdk5250/Makefile +++ b/board/samsung/smdk5250/Makefile @@ -36,7 +36,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 29b7ac6..4b9093c 100644 --- a/include/configs/smdk5250.h +++ b/include/configs/smdk5250.h @@ -192,6 +192,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