From patchwork Tue Jul 31 11:01:01 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajeshwari Shinde X-Patchwork-Id: 10393 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 28ACC23E23 for ; Tue, 31 Jul 2012 10:55:00 +0000 (UTC) Received: from mail-gg0-f180.google.com (mail-gg0-f180.google.com [209.85.161.180]) by fiordland.canonical.com (Postfix) with ESMTP id ECE1CA18836 for ; Tue, 31 Jul 2012 10:54:59 +0000 (UTC) Received: by mail-gg0-f180.google.com with SMTP id f1so5769099ggn.11 for ; Tue, 31 Jul 2012 03:54:59 -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=UjTrqHk+Hf0eSy9Vn7J4/LPQqU8estuedVeY1Yq/s08=; b=YZ8qMG7J5HDcyLPYrCSVq+34vztDJp+XUOvps+sKu6UM+98sFGrk/jieIdCR5972kd F4QtOZKAHwSAyY4u55uUmyRWxTCsxUtMHrD2cWW2f4dh7ETMffC5cmSPXWkldjpN0grL 4dkaPxk3CDZufekXt4TWlY7ShJrKz9ttndFTTfC1BwHqtyeG7qdkwhDHsFcwOAspSj31 lmP8e1Cg1UF48u7kWt4S7wOwf4s4zyLXVkEzG6lUn49vfZBWhNCOxJ04VtHTZK9A3xZy tVa2j/ern0IthYkMi1OZ263XSuBzkJbfcBKsJNIgYbl4YrthPLZssbQTcxzovoTFin+8 09DA== Received: by 10.50.219.194 with SMTP id pq2mr265528igc.25.1343732099540; Tue, 31 Jul 2012 03:54:59 -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 u8csp135979igz; Tue, 31 Jul 2012 03:54:59 -0700 (PDT) Received: by 10.68.192.73 with SMTP id he9mr43119824pbc.68.1343732098864; Tue, 31 Jul 2012 03:54:58 -0700 (PDT) Received: from mailout1.samsung.com (mailout1.samsung.com. [203.254.224.24]) by mx.google.com with ESMTP id ky6si84903pbc.288.2012.07.31.03.54.58; Tue, 31 Jul 2012 03:54:58 -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 epcpsbgm2.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 <0M8000LM7UB03N00@mailout1.samsung.com>; Tue, 31 Jul 2012 19:54:57 +0900 (KST) X-AuditID: cbfee61b-b7f566d000005c8a-35-5017b9815f22 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 87.57.23690.189B7105; Tue, 31 Jul 2012 19:54:57 +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 <0M800036CUB41W90@mmp1.samsung.com>; Tue, 31 Jul 2012 19:54:57 +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 V2] EXYNOS5: Enable SPI booting. Date: Tue, 31 Jul 2012 16:31:01 +0530 Message-id: <1343732461-3092-9-git-send-email-rajeshwari.s@samsung.com> X-Mailer: git-send-email 1.7.4.4 In-reply-to: <1343732461-3092-1-git-send-email-rajeshwari.s@samsung.com> References: <1343732461-3092-1-git-send-email-rajeshwari.s@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrEJMWRmVeSWpSXmKPExsVy+t9jAd3GneIBBgtnGFg8XH+TxWLK4S8s Dkwed67tYQtgjOKySUnNySxLLdK3S+DKeDw5vKBfvOL0sn3sDYyThLsYOTgkBEwk5lzI7WLk BDLFJC7cW8/WxcjFISSwiFHiSNMaJpCEkMBEJokDlxVBbDYBI4mtJ6cxgtgiAhISv/qvMoLM YRYolZgyMQ/EFAYa2X1FF6SCRUBV4seN3cwgNq+Au8T6FfuZIFYpSByb+pUVpJxTwEOi720G xCJ3idcXvzJNYORdwMiwilE0tSC5oDgpPddIrzgxt7g0L10vOT93EyPY58+kdzCuarA4xCjA wajEw+txUixAiDWxrLgy9xCjBAezkggv6wrxACHelMTKqtSi/Pii0pzU4kOM0hwsSuK8Jt5f /YUE0hNLUrNTUwtSi2CyTBycUg2MDtdUHERCan+016fY1tiVsJ5Okpt7gu/de7FpjzL2f1Ne MnniukeTE5rXPe+4uXf122plhmTR7Xnep5izzXdc3FNZNMXIet5pPSmRW/te3916yP15/JZL 0tejLcpfrD1Sw/Wky3RbyMzTikWT9K5W9KUklus2c14RZt6UvbQk4lStrWmYS0SEEktxRqKh FnNRcSIAt6lr+vUBAAA= X-TM-AS-MML: No X-Gm-Message-State: ALoCoQnSGTyCeKT2VSjpUCuPeSbopjfa8Lw9wNpStVPAD+1vX94xHbJJ8oFDI3TSNmGUJ2GiuCMe This patch enables SPI Booting for EXYNOS5 Signed-off-by: Rajeshwari Shinde --- Changes in V2: - None. 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