From patchwork Fri Dec 28 15:52:52 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amar X-Patchwork-Id: 13748 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 EA9A723EF7 for ; Fri, 28 Dec 2012 15:31:07 +0000 (UTC) Received: from mail-vb0-f52.google.com (mail-vb0-f52.google.com [209.85.212.52]) by fiordland.canonical.com (Postfix) with ESMTP id A1D6AA18B96 for ; Fri, 28 Dec 2012 15:31:07 +0000 (UTC) Received: by mail-vb0-f52.google.com with SMTP id ez10so10925739vbb.11 for ; Fri, 28 Dec 2012 07:31:07 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :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=8k3JJ8Z0f3EpvfPlIHwYWtaLn4uaeBhou30Xg4jdbFU=; b=P7lqOS9SJJSKoauRSQJV2uZ2uanOrwBkpa7MSe64dEaxv7AEsqjhlH6lNFMyw0YKxo ig+qGMkTM2kaEbiI7j5oSONqAP96WSGvwT8Pteb2DIMWjqYY6EBwyyzmOyHQ8vcqxqpu RKvSEGFNoo6N1R5NztkAj8F8TqCfbfkXxOUpgAy3AipzrOQmEoWcWvam32fG4N/TF3BU TascO2sR0TmcpucRFiKTXcJwsun2jjK1EPrTRj2hHrRKap2DOY+YdypTWytCGhlDLkC5 iZiSfPYOsugz0dJbtYTF/EwzQT+WA4nmkNv35yFLd6w4qh7MxQBPTtRiqkoPXeeyQDYM YnoA== X-Received: by 10.58.74.196 with SMTP id w4mr52797201vev.7.1356708667102; Fri, 28 Dec 2012 07:31:07 -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.58.214.195 with SMTP id oc3csp63580vec; Fri, 28 Dec 2012 07:31:06 -0800 (PST) X-Received: by 10.69.1.73 with SMTP id be9mr106931815pbd.116.1356708664692; Fri, 28 Dec 2012 07:31:04 -0800 (PST) Received: from mailout2.samsung.com (mailout2.samsung.com. [203.254.224.25]) by mx.google.com with ESMTP id ru9si32332234pbc.250.2012.12.28.07.31.04; Fri, 28 Dec 2012 07:31:04 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of amarendra.xt@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 amarendra.xt@samsung.com designates 203.254.224.25 as permitted sender) smtp.mail=amarendra.xt@samsung.com Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MFQ00MY1Z2Z6040@mailout2.samsung.com>; Sat, 29 Dec 2012 00:30:56 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.123]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 17.06.01231.03BBDD05; Sat, 29 Dec 2012 00:30:56 +0900 (KST) X-AuditID: cbfee61a-b7fa66d0000004cf-ec-50ddbb3051df Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id C6.06.01231.03BBDD05; Sat, 29 Dec 2012 00:30:56 +0900 (KST) Received: from chrome-ubuntu.sisodomain.com ([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 <0MFQ008MSZ2SO710@mmp2.samsung.com>; Sat, 29 Dec 2012 00:30:56 +0900 (KST) From: Amar To: u-boot@lists.denx.de, jh80.chung@samsung.com Cc: patches@linaro.org, sjg@chromium.org, mk7.kang@samsung.com, chander.kashyap@linaro.org, afleming@gmail.com Subject: [PATCH 9/9] COMMON: MMC: Command to support EMMC booting Date: Fri, 28 Dec 2012 10:52:52 -0500 Message-id: <1356709972-26549-10-git-send-email-amarendra.xt@samsung.com> X-Mailer: git-send-email 1.8.0 In-reply-to: <1356709972-26549-1-git-send-email-amarendra.xt@samsung.com> References: <1356709972-26549-1-git-send-email-amarendra.xt@samsung.com> DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrPLMWRmVeSWpSXmKPExsWyRsSkWtdg990Ag/ObjS0err/JYjHl8BcW ByaPO9f2sAUwRnHZpKTmZJalFunbJXBlXLg2jb3gikTFjTXb2BsYHwp1MXJySAiYSBx+cZMV whaTuHBvPVsXIxeHkMBSRolNe5tYYYoWbmxkBLGFBKYzSsz9zA9R1Msk8ePJIuYuRg4ONgFV iV+L7UFqRAQMJKY/2c4KEmYWKJB4tlsMJCws4Chx59knJhCbBah6xZYv7CA2r4CnxNr+F1Cr 5CQ+7HkEFucEij96BjIdZK2HxNVNu9ggegUkvk0+xAIyXkJAVmLTAWaQayQEbrNJLLnyiBli jqTEwRU3WCYwCi9gZFjFKJpakFxQnJSea6hXnJhbXJqXrpecn7uJERiKp/89k9rBuLLB4hCj AAejEg/vwp47AUKsiWXFlbmHGCU4mJVEePua7wYI8aYkVlalFuXHF5XmpBYfYvQBumQis5Ro cj4wTvJK4g2NTcxNjU0tjYzMTE1xCCuJ8zZ7pAQICaQnlqRmp6YWpBbBjGPi4JRqYJzBuOT4 UZ6ZJ5bE/Fl2lU1yd2fACeNbeQlsImc5zxm90rp15PvsljCD1BkBSunzVunZZQRxzOSt9PhT PnlG3WeWB6t3VFx/pbv5ueXh+i6ZSTEP9e6k+Sh2hetdil7av7xFQ2eNrghT5PEnfiZlay+5 tMXcjw7avPZ54e4lL2tYBFr995dLmSmxFGckGmoxFxUnAgAM7ZldcgIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupjkeLIzCtJLcpLzFFi42I5/e+xoK7B7rsBBie3a1s8XH+TxWLK4S8s Dkwed67tYQtgjGpgtMlITUxJLVJIzUvOT8nMS7dV8g6Od443NTMw1DW0tDBXUshLzE21VXLx CdB1y8wBmq2kUJaYUwoUCkgsLlbSt8M0ITTETdcCpjFC1zckCK7HyAANJKxhzLhwbRp7wRWJ ihtrtrE3MD4U6mLk5JAQMJFYuLGREcIWk7hwbz0biC0kMJ1RYu5n/i5GLiC7l0nix5NFzF2M HBxsAqoSvxbbg9SICBhITH+ynRUkzCxQIPFstxhIWFjAUeLOs09MIDYLUPWKLV/YQWxeAU+J tf0vWCFWyUl82PMILM4JFH/0DGQ6yFoPiaubdrFNYORdwMiwilE0tSC5oDgpPddQrzgxt7g0 L10vOT93EyM40J9J7WBc2WBxiFGAg1GJh3dhz50AIdbEsuLK3EOMEhzMSiK8fc13A4R4UxIr q1KL8uOLSnNSiw8x+gBdNZFZSjQ5HxiFeSXxhsYm5qbGppYmFiZmljiElcR5mz1SAoQE0hNL UrNTUwtSi2DGMXFwSjUwKpselFpke1wzZHNneZCH2OzCtQcPvJ1ifUpUryLsA1uh2J+5e/VN JRe8npOmM9t5NufHov0fG2zSWRT+Xl6vs+rIp5V1AYps3JW7w/nTdzpvXyYgcfJP6mH/zplq oQELl850m8mw32WJXYT/kk1Ss9ri9GW3LZyYc8FZ6s0s/fS4llvHN8mWK7EUZyQaajEXFScC APy+8A+hAgAA X-CFilter-Loop: Reflected X-Gm-Message-State: ALoCoQl98F7jh0WKWRrzefDbPbD1zvySrzJxWpj3b6QDjG04gl7oiaG3eLGuXYuFr5i5oGtQ63xD This patch adds commands to open, close and create partitions on EMMC Signed-off-by: Amar --- common/cmd_mmc.c | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 84 insertions(+), 1 deletion(-) diff --git a/common/cmd_mmc.c b/common/cmd_mmc.c index 62a1c22..355ab8e 100644 --- a/common/cmd_mmc.c +++ b/common/cmd_mmc.c @@ -248,6 +248,85 @@ static int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) curr_device, mmc->part_num); return 0; + } else if ((strcmp(argv[1], "open") == 0) || + (strcmp(argv[1], "close") == 0)) { + int dev; + struct mmc *mmc; + + if (argc == 2) + dev = curr_device; + else if (argc == 3) + dev = simple_strtoul(argv[2], NULL, 10); + else + return CMD_RET_USAGE; + + mmc = find_mmc_device(dev); + if (!mmc) { + printf("no mmc device at slot %x\n", dev); + return 1; + } + + if (IS_SD(mmc)) { + printf("SD device cannot be opened/closed\n"); + return 1; + } + + if (strcmp(argv[1], "open") == 0) { + if (!(mmc_boot_open(mmc))) { + printf("EMMC OPEN Success.\n"); + printf("\t\t\t!!!Notice!!!\n"); + printf("!You must close EMMC" + " boot Partition after all" + " images are written\n"); + printf("!EMMC boot partition" + " has continuity at" + " image writing time.\n"); + printf("!So, Do not close boot" + " partition, Before, all" + " images are written.\n"); + return 0; + } else { + printf("EMMC OPEN Failed.\n"); + return 1; + } + } + + if (strcmp(argv[1], "close") == 0) { + if (!(mmc_boot_close(mmc))) { + printf("EMMC CLOSE Success.\n"); + return 0; + } else { + printf("EMMC CLOSE Failed.\n"); + return 1; + } + } + } else if (strcmp(argv[1], "bootpart") == 0) { + int dev; + dev = simple_strtoul(argv[2], NULL, 10); + + struct mmc *mmc = find_mmc_device(dev); + u32 bootsize = simple_strtoul(argv[3], NULL, 10); + u32 rpmbsize = simple_strtoul(argv[4], NULL, 10); + + if (!mmc) { + printf("no mmc device at slot %x\n", dev); + return 1; + } + + if (IS_SD(mmc)) { + printf("It is not a EMMC device\n"); + return 1; + } + + if (0 == mmc_boot_partition_size_change(mmc, + bootsize, rpmbsize)) { + printf("EMMC boot partition Size %d MB\n", bootsize); + printf("EMMC RPMB partition Size %d MB\n", rpmbsize); + return 0; + } else { + printf("EMMC boot partition Size change Failed.\n"); + return 1; + } } if (strcmp(argv[1], "read") == 0) @@ -318,5 +397,9 @@ U_BOOT_CMD( "mmc rescan\n" "mmc part - lists available partition on current mmc device\n" "mmc dev [dev] [part] - show or set current mmc device [partition]\n" - "mmc list - lists available devices"); + "mmc list - lists available devices\n" + "mmc open - opens the specified device\n" + "mmc close - closes the specified device\n" + "mmc bootpart \n" + " - change sizes of boot and RPMB partions of specified device\n"); #endif