From patchwork Fri Jan 4 09:34:10 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amar X-Patchwork-Id: 13798 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 7754723EDC for ; Fri, 4 Jan 2013 09:12:22 +0000 (UTC) Received: from mail-vc0-f175.google.com (mail-vc0-f175.google.com [209.85.220.175]) by fiordland.canonical.com (Postfix) with ESMTP id 18179A18331 for ; Fri, 4 Jan 2013 09:12:22 +0000 (UTC) Received: by mail-vc0-f175.google.com with SMTP id fy7so16382547vcb.34 for ; Fri, 04 Jan 2013 01:12:21 -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=o1PrccBeMsdS01cEq0r2FDNO/SbVc37iVFhBYMgElrI=; b=jtc/7yRO+neIvZ0jJR3zlKsq5n0F6InTR4uy7gPWLseOjS8ABymaKJrdg6+z02Zdbf vN/bgSD6Y4XZSV6dyae9pk0gUXExlNIMP2SzDOmr/JGBMWHRY2K5W8TM+h/dvbHJDP7W 9Bek6oeBdNG541aGrO/VP5PpZCW6q+76zty2qEnev5bBukOF04Go8QV1tkcseLNwC+f3 8BYQ8b90fZxCM0bn0exaFvEXXNN6Umd8zdAqNinJcoErKmB+cC2T84GFBermMmPlMzHE n50jv08GkX9eRM/Vk7HLibx3Cuz2TSFUDlexVQ/voxc++3z5Z3hzhSPgrw13BzvU8zXG lsZA== X-Received: by 10.58.198.164 with SMTP id jd4mr78735741vec.34.1357290741608; Fri, 04 Jan 2013 01:12:21 -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.145.101 with SMTP id st5csp128047veb; Fri, 4 Jan 2013 01:12:21 -0800 (PST) X-Received: by 10.68.241.65 with SMTP id wg1mr162940232pbc.141.1357290740233; Fri, 04 Jan 2013 01:12:20 -0800 (PST) Received: from mailout1.samsung.com (mailout1.samsung.com. [203.254.224.24]) by mx.google.com with ESMTP id qc4si49947371pbb.236.2013.01.04.01.12.19; Fri, 04 Jan 2013 01:12:20 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of amarendra.xt@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 amarendra.xt@samsung.com designates 203.254.224.24 as permitted sender) smtp.mail=amarendra.xt@samsung.com Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MG3009JDG89B2D0@mailout1.samsung.com>; Fri, 04 Jan 2013 18:12:19 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.125]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 8E.04.12699.2FC96E05; Fri, 04 Jan 2013 18:12:19 +0900 (KST) X-AuditID: cbfee61b-b7f616d00000319b-9f-50e69cf2eb61 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id BD.04.12699.2FC96E05; Fri, 04 Jan 2013 18:12:18 +0900 (KST) Received: from chrome-ubuntu.sisodomain.com ([107.108.73.106]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MG30081AG7XXLA0@mmp1.samsung.com>; Fri, 04 Jan 2013 18:12:18 +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 V4 9/9] COMMON: MMC: Command to support EMMC booting and to Date: Fri, 04 Jan 2013 04:34:10 -0500 Message-id: <1357292050-12137-10-git-send-email-amarendra.xt@samsung.com> X-Mailer: git-send-email 1.8.0 In-reply-to: <1357292050-12137-1-git-send-email-amarendra.xt@samsung.com> References: <1357292050-12137-1-git-send-email-amarendra.xt@samsung.com> DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrDLMWRmVeSWpSXmKPExsWyRsSkVvfznGcBBg+eM1s8XH+TxWLK4S8s Dkwed67tYQtgjOKySUnNySxLLdK3S+DKuDnZvWCtVMXCA5NYGhhbRboYOTkkBEwklnSsZYOw xSQu3FsPZHNxCAksZZTY093K3MXIAVa0c7s4RHwRo8TKy82MEE4vk8TZ26vZQIrYBFQlfi22 BxkkImAgMf3JdlaQMLNAgcSz3WIgYWEBb4m+7U+ZQGwWoOo/51eB7eUV8JSY3raXEeIGOYkP ex6xg7RyAsU3XREBMYUEPCSuHiqB6BSQ+Db5EAvEYbISmw4wg9wiIXCbTeLciefsEFMkJQ6u uMEygVF4ASPDKkbR1ILkguKk9FwjveLE3OLSvHS95PzcTYzAIDz975n0DsZVDRaHGAU4GJV4 eC3vPA0QYk0sK67MPcQowcGsJML7WftZgBBvSmJlVWpRfnxRaU5q8SFGH6BLJjJLiSbnAyMk ryTe0NjE3NTY1NLIyMzUFIewkjgv46knAUIC6YklqdmpqQWpRTDjmDg4pRoYN9ves9mzwXjj 9Pnqa1/7yWbd3Gql8UHFjzV+g5R18RcH4dkrp7tx+2RMUeRa5Lrl3bqlGRuElN5PuMkzZ1pi 36WOf90b2B3nHq2LXFwneMow+9Wr57/Fq+d/yytQrX1u3P8w/dWka55P14R6sPk8zbMtCKr8 8GDdH1kT4W36td3C2t+mBM5jVWIpzkg01GIuKk4EAHSMo5lvAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupmkeLIzCtJLcpLzFFi42I5/e+xgO6nOc8CDJ4+MLB4uP4mi8WUw19Y HJg87lzbwxbAGNXAaJORmpiSWqSQmpecn5KZl26r5B0c7xxvamZgqGtoaWGupJCXmJtqq+Ti E6DrlpkDNFtJoSwxpxQoFJBYXKykb4dpQmiIm64FTGOErm9IEFyPkQEaSFjDmHFzsnvBWqmK hQcmsTQwtop0MXJwSAiYSOzcLt7FyAlkiklcuLeerYuRi0NIYBGjxMrLzYwQTi+TxNnbq9lA GtgEVCV+LbYHaRARMJCY/mQ7K0iYWaBA4tluMZCwsIC3RN/2p0wgNgtQ9Z/zq9hAbF4BT4np bXsZIXbJSXzY84gdpJUTKL7pCtg1QgIeElcPlUxg5F3AyLCKUTS1ILmgOCk910ivODG3uDQv XS85P3cTIzjEn0nvYFzVYHGIUYCDUYmH1/LO0wAh1sSy4srcQ4wSHMxKIryftZ8FCPGmJFZW pRblxxeV5qQWH2L0AbppIrOUaHI+MP7ySuINjU3MTY1NLU0sTMwscQgrifMynnoSICSQnliS mp2aWpBaBDOOiYNTqoEx6/Gmvp9O8Trr59wqUf9rtlf0zK+/mxYZP3u76sOjjq5AduluW8Ek T5lO1YnC86w/3T6h8k69qiFE8NTcqJT6WOMvLRvfape+dd37+UdzhK66VXdN6MLns25513At jL/xb2lnRYnLpTxRWYVjx5rCAmZ2NBxscOg3y6qcLT5N3mPNupXfrFOUWIozEg21mIuKEwHg P+vPngIAAA== X-CFilter-Loop: Reflected X-Gm-Message-State: ALoCoQkhr0Zgva7yMdSBgIm5IkSm+zW2s77lQ8NVQYdP6a5EQucgrYPA1JiElWFwQPEnXDblZWIm This patch adds commands to open, close and resize boot partitions on EMMC. Changes from V1: 1)Combined the common piece of code between 'open' and 'close' operations. Changes from V2: 1)Updation of commit message and resubmition of proper patch set. Changes from V3: No change. Signed-off-by: Amar --- common/cmd_mmc.c | 84 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 83 insertions(+), 1 deletion(-) diff --git a/common/cmd_mmc.c b/common/cmd_mmc.c index 7dacd51..1dabb5b 100644 --- a/common/cmd_mmc.c +++ b/common/cmd_mmc.c @@ -248,6 +248,84 @@ 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); + + u32 bootsize = simple_strtoul(argv[3], NULL, 10); + u32 rpmbsize = simple_strtoul(argv[4], NULL, 10); + struct mmc *mmc = find_mmc_device(dev); + 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; + } } state = MMC_INVALID; @@ -317,5 +395,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