From patchwork Wed Aug 1 09:33:32 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajeshwari Shinde X-Patchwork-Id: 10438 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 3612024048 for ; Wed, 1 Aug 2012 09:27:28 +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 06982A18EDF for ; Wed, 1 Aug 2012 09:27:27 +0000 (UTC) Received: by mail-gh0-f180.google.com with SMTP id z12so6902136ghb.11 for ; Wed, 01 Aug 2012 02:27:27 -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=ZTy0QLKblFGrLJKxXEBFEKx8YOyth6idZ2Oc0VpXYNA=; b=YWQGyVIKWEjheoH2fp5qay5eEKtsDSs45WG1CEZzjbxXYno5Fgi7RQB9aK7HxMojpj ayvx4ZGVYk8Zrs70Mwtx3xX9ADkdnmKUYl5k4FzaTfkwdRX19ZGHNi5GJohmbXdZvPmT aUxlVUf+h/ri7xr/XXmCxz8N9vxKUvnCuvDS6+xGfA2ITbRnRGDy5d4M0tYXmcl5+XIv 6968/judDNm4uGElhThFFgLYsgIhz6J0xT8V2TFdxtnOrD4MGfLPI/uzmiCGur/LeIl/ L6b5Jrv1ujyUqCDMAwqwrjZKBmu3Az1O5FYis7hmL0cy3FrFLN0KplHXhYkckNTAwE0n c9Ng== Received: by 10.50.94.166 with SMTP id dd6mr4682294igb.11.1343813247608; Wed, 01 Aug 2012 02:27:27 -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 u8csp187718igz; Wed, 1 Aug 2012 02:27:26 -0700 (PDT) Received: by 10.68.220.104 with SMTP id pv8mr43641966pbc.119.1343813246811; Wed, 01 Aug 2012 02:27:26 -0700 (PDT) Received: from mailout2.samsung.com (mailout2.samsung.com. [203.254.224.25]) by mx.google.com with ESMTP id pz9si5133137pbb.330.2012.08.01.02.27.26; Wed, 01 Aug 2012 02:27:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of rajeshwari.s@samsung.com designates 203.254.224.25 as permitted sender) client-ip=203.254.224.25; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of rajeshwari.s@samsung.com designates 203.254.224.25 as permitted sender) smtp.mail=rajeshwari.s@samsung.com Received: from epcpsbgm2.samsung.com (mailout2.samsung.com [203.254.224.25]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0M8200M47KWLFKH0@mailout2.samsung.com>; Wed, 01 Aug 2012 18:27:25 +0900 (KST) X-AuditID: cbfee61b-b7f566d000005c8a-1e-5018f67d4648 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id E9.E2.23690.D76F8105; Wed, 01 Aug 2012 18:27:25 +0900 (KST) Received: from rajeshwari-linux.sisodomain.com ([107.108.215.115]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0M820029AKX8FS00@mmp2.samsung.com>; Wed, 01 Aug 2012 18:27:25 +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 7/7 V3] Enable SPI booting. Date: Wed, 01 Aug 2012 15:03:32 +0530 Message-id: <1343813612-1587-8-git-send-email-rajeshwari.s@samsung.com> X-Mailer: git-send-email 1.7.4.4 In-reply-to: <1343813612-1587-1-git-send-email-rajeshwari.s@samsung.com> References: <1343813612-1587-1-git-send-email-rajeshwari.s@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrCJMWRmVeSWpSXmKPExsVy+t9jQd3abxIBBpdu6lg8XH+TxWLK4S8s Dkwed67tYQtgjOKySUnNySxLLdK3S+DKODyxl6Vgg3jF7AafBsYlwl2MnBwSAiYSvzsvsUHY YhIX7q0Hsrk4hASmM0pM33aCEcKZyCRxY8VuZpAqNgEjia0npzGC2CICEhK/+q8C2RwczAKl ElMm5oGEhQW0Jbb3zmYGCbMIqEo8mu8NEuYVcJdY9PwhK8QuBYljU7+ygpRwCnhIfN8JdoIQ UMmtt7tYJzDyLmBkWMUomlqQXFCclJ5rpFecmFtcmpeul5yfu4kR7Pdn0jsYVzVYHGIU4GBU 4uF9YSYRIMSaWFZcmXuIUYKDWUmEt+AmUIg3JbGyKrUoP76oNCe1+BCjNAeLkjivifdXfyGB 9MSS1OzU1ILUIpgsEwenVANj9nzNS9ve8SVu6Z6+6nvLhK0dPvHi/ByVQT6rTM+e9/B5NinT yVfukOL9d8fTwiQV9tY4fOWYU3w4vvasv9BmnkLFqpB/rFM2bq08r8ZbebhU4/oPLonJl28t WbNP1KBu4foFp6fMmlKUMDV81fk1QR53tZbyaLku7usxWFn37k7Rk7u5bbO/KLEUZyQaajEX FScCALf4tlP3AQAA X-TM-AS-MML: No X-Gm-Message-State: ALoCoQkLTvCanRYvW02FQqiN1bdvJEDn7onG22z+aq4+oNNgvDprVE2EUE46jL5WQX2OrSZy8NIY This patch enables SPI Booting for EXYNOS5 Signed-off-by: Rajeshwari Shinde --- Changes in V2: - None. Changes in V3: - 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