From patchwork Mon Dec 17 11:19:35 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amar X-Patchwork-Id: 13618 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 D155223E02 for ; Mon, 17 Dec 2012 10:57:41 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id 66F23A18A59 for ; Mon, 17 Dec 2012 10:57:41 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id c10so8818246ieb.11 for ; Mon, 17 Dec 2012 02:57:40 -0800 (PST) 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 :dlp-filter:x-mtr:x-brightmail-tracker:x-brightmail-tracker :x-cfilter-loop:x-gm-message-state; bh=iY4fpW2IbBebrQFjB7Q6EMkJERHtG3KqraThRapSYHw=; b=L1eSPaKvU30CK+mTKCaO8wX57VF9n3bIT9i/C17JWzMzRY35m/p++6ZJPmAsyVy6G2 BysGT/LLpOAzPUyucybx3vT3gDpPBdPbTRlf4Hsntt0dF7R96/w2nKZbs4jzBlTRvWor F471PkoOeshVn+DzECqAbXD2WXU29uir1NxlVwCqApK5dZZKHo2jK/WTcoagv4T/ZGsv xb3f2rotVoWwkxfKk62Lq3kkeDLIO00wHCJRRz/PoooSHpEEmjMuPh0L1j1T5biWuFuh ubpQvKqJXk8fOtZ83eFsZeZzrWCyNNr0OLVZCCTyLUdDgZOZdRildFyuWH/oXLs9aTwe GdUw== Received: by 10.50.187.197 with SMTP id fu5mr8484927igc.70.1355741860872; Mon, 17 Dec 2012 02:57:40 -0800 (PST) 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.67.148 with SMTP id n20csp66382igt; Mon, 17 Dec 2012 02:57:40 -0800 (PST) Received: by 10.66.75.100 with SMTP id b4mr41617416paw.0.1355741858570; Mon, 17 Dec 2012 02:57:38 -0800 (PST) Received: from mailout3.samsung.com (mailout3.samsung.com. [203.254.224.33]) by mx.google.com with ESMTP id w3si12699046pbz.108.2012.12.17.02.57.38; Mon, 17 Dec 2012 02:57:38 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of amarendra.xt@samsung.com designates 203.254.224.33 as permitted sender) client-ip=203.254.224.33; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of amarendra.xt@samsung.com designates 203.254.224.33 as permitted sender) smtp.mail=amarendra.xt@samsung.com Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MF600KVY93ADWJ0@mailout3.samsung.com>; Mon, 17 Dec 2012 19:57:37 +0900 (KST) Received: from epcpdlpp25 ( [172.20.52.125]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 0B.91.01231.1AAFEC05; Mon, 17 Dec 2012 19:57:37 +0900 (KST) X-AuditID: cbfee61a-b7fa66d0000004cf-bc-50cefaa1b7d1 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 5A.91.01231.0AAFEC05; Mon, 17 Dec 2012 19:57:36 +0900 (KST) Received: from localhost.localdomain ([107.108.73.106]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MF600FNU92TR670@mmp2.samsung.com>; Mon, 17 Dec 2012 19:57:36 +0900 (KST) From: Amar To: u-boot@lists.denx.de Cc: patches@linaro.org, sjg@chromium.org, mk7.kang@samsung.com, chander.kashyap@linaro.org, afleming@gmail.com, jh80.chung@samsung.com Subject: [PATCH 8/9] SMDK5250: Enable eMMC booting Date: Mon, 17 Dec 2012 16:49:35 +0530 Message-id: <1355743176-12305-9-git-send-email-amarendra.xt@samsung.com> X-Mailer: git-send-email 1.7.0.4 In-reply-to: <1355743176-12305-1-git-send-email-amarendra.xt@samsung.com> References: <1355743176-12305-1-git-send-email-amarendra.xt@samsung.com> DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrELMWRmVeSWpSXmKPExsWyRsSkVnfhr3MBBk8vs1s8XH+TxWLK4S8s Dkwed67tYQtgjOKySUnNySxLLdK3S+DKuDnpA3PBIsGK1n9LWBoYJ/F1MXJySAiYSNyfv4gF whaTuHBvPVsXIxeHkMAsRokPH88xwRQdPrkYKjGdUeLPrJlMEE47k8S5rwtYuxg5ONgEVCV+ LbYHaRARkJD41X+VEaSGWaCDUWLHxM2MIAlhASOJaTOXsYLYLED1mya+BFvNK+Ah8fXxO6ht ChKtyw6xg9icAp4Sn3c/BKsRAqrZs2s6M0SvgMS3yYdYQPZKCMhKbDrADLJLQuA+m0TLrV3M EHMkJQ6uuMEygVF4ASPDKkbR1ILkguKk9FxDveLE3OLSvHS95PzcTYzAgDz975nUDsaVDRaH GAU4GJV4eI1SzwUIsSaWFVfmHmKU4GBWEuGVfgMU4k1JrKxKLcqPLyrNSS0+xOgDdMlEZinR 5HxgtOSVxBsam5ibGptaGhmZmZriEFYS5232SAkQEkhPLEnNTk0tSC2CGcfEwSnVwMjzxeW7 iQ5T/HfGx04SJgU7LqxZyHwoVtLgxSI7i6qZ816c/ZT0ZNnMKYxdU3/N7V9nFWCZuNRxLq/g uoMl/97l58gL/Lfr6ldbICu6ibtxnf6XjoysnZ/Tji+RXJzoUP74odvVtfeVDrM+0rnMUz9L 2e/CWb69Nt9bJ7Kd+viCte3tWvkvvJZKLMUZiYZazEXFiQAIByVddQIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprIIsWRmVeSWpSXmKPExsVy+t9jQd0Fv84FGPw8amnxcP1NFosph7+w ODB53Lm2hy2AMaqB0SYjNTEltUghNS85PyUzL91WyTs43jne1MzAUNfQ0sJcSSEvMTfVVsnF J0DXLTMHaLaSQlliTilQKCCxuFhJ3w7ThNAQN10LmMYIXd+QILgeIwM0kLCGMePmpA/MBYsE K1r/LWFpYJzE18XIySEhYCJx+ORiNghbTOLCvfVANheHkMB0Rok/s2YyQTjtTBLnvi5g7WLk 4GATUJX4tdgepEFEQELiV/9VRpAaZoEORokdEzczgiSEBYwkps1cxgpiswDVb5r4kgXE5hXw kPj6+B0TxDYFidZlh9hBbE4BT4nPux+C1QgB1ezZNZ15AiPvAkaGVYyiqQXJBcVJ6bmGesWJ ucWleel6yfm5mxjB4f5MagfjygaLQ4wCHIxKPLxGqecChFgTy4orcw8xSnAwK4nwSr8BCvGm JFZWpRblxxeV5qQWH2L0AbpqIrOUaHI+MBbzSuINjU3MTY1NLU0sTMwscQgrifM2e6QECAmk J5akZqemFqQWwYxj4uCUamBUPmosEb2hgrl4psCtXJbVYjPPGoqeuHfP7fF7tfam27M5lJ/t 2Wpw+5e5y1nbGG2O/MeFyxJYr+XO2/bhSLCH7xfn2A6F7M9x2n9C/1x6ecF+ltmLj74Pq44r Lp2/9bpUaf0NjllTVXf53uHP6t3yZjOTzbYSva4196qy9Li71eaH5cRa+F9TYinOSDTUYi4q TgQAuceRVqQCAAA= X-CFilter-Loop: Reflected X-Gm-Message-State: ALoCoQlnkpAazka+QKhJ1SGZlvV8h7K04cxDx8vsgtHR5e/CYmuBVlQpFV2pqQpGKp14V7tGd2sU This patch adds support for eMMC booting on SMDK5250 Signed-off-by: Amar --- board/samsung/smdk5250/spl_boot.c | 38 ++++++++++++++++++++++++++++++++++++- 1 files changed, 37 insertions(+), 1 deletions(-) diff --git a/board/samsung/smdk5250/spl_boot.c b/board/samsung/smdk5250/spl_boot.c index d8f3c1e..2648b4e 100644 --- a/board/samsung/smdk5250/spl_boot.c +++ b/board/samsung/smdk5250/spl_boot.c @@ -23,15 +23,40 @@ #include #include +#include +#include + +#define FSYS1_MMC0_DIV_VAL 0x0701 + enum boot_mode { BOOT_MODE_MMC = 4, + BOOT_MODE_eMMC = 8, /* eMMC44 */ 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); +typedef u32 (*spi_copy_func_t)(u32 offset, u32 nblock, u32 dst); +static void set_emmc_clk(void); + +/* +* Set MMC0 clock divisor value. +* So that the mmc0 device operating freq is 50MHz. +*/ +static void set_emmc_clk(void) +{ + struct exynos5_clock *clk = (struct exynos5_clock *)EXYNOS5_CLOCK_BASE; + unsigned int addr; + unsigned int div_mmc; + + addr = (unsigned int) &clk->div_fsys1; + + div_mmc = readl(addr) & ~FSYS1_MMC0_DIV_MASK; + div_mmc |= FSYS1_MMC0_DIV_VAL; + writel(div_mmc, addr); +} + /* * Copy U-boot from mmc to RAM: @@ -43,6 +68,8 @@ void copy_uboot_to_ram(void) spi_copy_func_t spi_copy; enum boot_mode bootmode; u32 (*copy_bl2)(u32, u32, u32); + u32 (*copy_bl2_emmc)(u32, u32); + void (*end_bootop_emmc)(void); bootmode = readl(EXYNOS5_POWER_BASE) & OM_STAT; @@ -57,6 +84,15 @@ void copy_uboot_to_ram(void) copy_bl2(BL2_START_OFFSET, BL2_SIZE_BLOC_COUNT, CONFIG_SYS_TEXT_BASE); break; + case BOOT_MODE_eMMC: + set_emmc_clk(); + end_bootop_emmc = (void *) *(u32 *)EMMC44_END_BOOTOP_FNPTR_ADDR; + copy_bl2_emmc = (void *) *(u32 *)EMMC44_COPY_BL2_FNPTR_ADDR; + + copy_bl2_emmc(BL2_SIZE_BLOC_COUNT, CONFIG_SYS_TEXT_BASE); + end_bootop_emmc(); + break; + default: break; }