From patchwork Mon Dec 31 10:58:20 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amar X-Patchwork-Id: 13757 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 D6DA623E03 for ; Mon, 31 Dec 2012 10:36:34 +0000 (UTC) Received: from mail-vc0-f174.google.com (mail-vc0-f174.google.com [209.85.220.174]) by fiordland.canonical.com (Postfix) with ESMTP id 7F5A9A18D4E for ; Mon, 31 Dec 2012 10:36:34 +0000 (UTC) Received: by mail-vc0-f174.google.com with SMTP id d16so12559744vcd.5 for ; Mon, 31 Dec 2012 02:36:34 -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=eIrrOt6dhBb7TUR3AMyAhhjLflNIlXMO8NCZmcTgqxY=; b=CcOPNFSbbfjJQOzzJp51J7f8L+KCmu1nwSYqJP1fel2emIgDVIZVEZcYBdmQb7bjfv uJ8TIw8gRtVEVP+aR1PN/7Iz7z/aevTMjbTFi0Sd/KhUstz+hJcdY8qDEK0h10yJCBy6 6dFGqTK7gsjXKn+sptZcsMee0Bcumw5JDPV/nrMfBlgNeMG51C2exAuKFd7mQNMyNBRQ Trf5eK30hMau1bUad8gjoQsejjHibGUKd+wW4+4zMxtMKwOSPSmcofF/HCfJyv1lSCN5 SN+H9TIQfjqIu9P+4x5HcKlJ+uyo935InKlMgO3ONNcAbc6WX1KIdCrzEtCee90geter ovcw== X-Received: by 10.52.70.205 with SMTP id o13mr54935238vdu.75.1356950193974; Mon, 31 Dec 2012 02:36:33 -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 oc3csp153820vec; Mon, 31 Dec 2012 02:36:33 -0800 (PST) X-Received: by 10.68.213.233 with SMTP id nv9mr125784969pbc.155.1356950192993; Mon, 31 Dec 2012 02:36:32 -0800 (PST) Received: from mailout4.samsung.com (mailout4.samsung.com. [203.254.224.34]) by mx.google.com with ESMTP id i7si39383398pay.189.2012.12.31.02.36.32; Mon, 31 Dec 2012 02:36:32 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of amarendra.xt@samsung.com designates 203.254.224.34 as permitted sender) client-ip=203.254.224.34; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of amarendra.xt@samsung.com designates 203.254.224.34 as permitted sender) smtp.mail=amarendra.xt@samsung.com Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MFW009QX5G7FY70@mailout4.samsung.com>; Mon, 31 Dec 2012 19:36:31 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.122]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id AA.C2.01231.FAA61E05; Mon, 31 Dec 2012 19:36:31 +0900 (KST) X-AuditID: cbfee61a-b7fa66d0000004cf-bc-50e16aaf1ead Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 5A.C2.01231.FAA61E05; Mon, 31 Dec 2012 19:36:31 +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 <0MFW00JL05G0TP80@mmp1.samsung.com>; Mon, 31 Dec 2012 19:36:31 +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 V3 9/9] COMMON: MMC: Command to support EMMC booting and to Date: Mon, 31 Dec 2012 05:58:20 -0500 Message-id: <1356951500-22490-10-git-send-email-amarendra.xt@samsung.com> X-Mailer: git-send-email 1.8.0 In-reply-to: <1356951500-22490-1-git-send-email-amarendra.xt@samsung.com> References: <1356951500-22490-1-git-send-email-amarendra.xt@samsung.com> DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrPLMWRmVeSWpSXmKPExsWyRsSkSnd91sMAgw3XFSwerr/JYjHl8BcW ByaPO9f2sAUwRnHZpKTmZJalFunbJXBl9Lb9YClolar48+EvWwPjO+EuRk4OCQETiYkfVzNC 2GISF+6tZ+ti5OIQEljKKDH7yT5GmKJPN6exQyQWMUr8vHqNBcLpZZLofrYEqIqDg01AVeLX YnuQBhEBA4npT7azgoSZBQoknu0WAwkLC3hL9O44wAZiswBVzz3yhB2khFfAU+JqVznEKjmJ D3sesYPYnEDh01t2MIPYQgIeEje7F7JDtApIfJt8iAWkVUJAVmLTAWaQYyQEbrNJLJrfxgIx R1Li4IobLBMYhRcwMqxiFE0tSC4oTkrPNdQrTswtLs1L10vOz93ECAzF0/+eSe1gXNlgcYhR gINRiYeXi+lhgBBrYllxZe4hRgkOZiUR3rdaQCHelMTKqtSi/Pii0pzU4kOMPkCXTGSWEk3O B8ZJXkm8obGJuamxqaWRkZmpKQ5hJXHeZo+UACGB9MSS1OzU1ILUIphxTBycUg2M6vfZnZZs OjJfUvBj46Np3QsLzx5I5Tl4obyp0L3VKbb5WuqK6yWXZWfdiy491tVT6dtUrOz0zPncRfcv wr9jz/n2fXpjeXhnw/HD92++7di8V2zm13cT/TeEmu8pOql2MapbVkbztGXi3qzUqko9G3UO 7a1aauUZqjeYTM227cj4a/VzvuoEJZbijERDLeai4kQAuato43ICAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupjkeLIzCtJLcpLzFFi42I5/e+xgO76rIcBBs/miFg8XH+TxWLK4S8s Dkwed67tYQtgjGpgtMlITUxJLVJIzUvOT8nMS7dV8g6Od443NTMw1DW0tDBXUshLzE21VXLx CdB1y8wBmq2kUJaYUwoUCkgsLlbSt8M0ITTETdcCpjFC1zckCK7HyAANJKxhzOht+8FS0CpV 8efDX7YGxnfCXYycHBICJhKfbk5jh7DFJC7cW8/WxcjFISSwiFHi59VrLBBOL5NE97MljF2M HBxsAqoSvxbbgzSICBhITH+ynRUkzCxQIPFstxhIWFjAW6J3xwE2EJsFqHrukSfsICW8Ap4S V7vKIVbJSXzY8whsLSdQ+PSWHcwgtpCAh8TN7oXsExh5FzAyrGIUTS1ILihOSs811CtOzC0u zUvXS87P3cQIDvRnUjsYVzZYHGIU4GBU4uHlYnoYIMSaWFZcmXuIUYKDWUmE960WUIg3JbGy KrUoP76oNCe1+BCjD9BRE5mlRJPzgVGYVxJvaGxibmpsamliYWJmiUNYSZy32SMlQEggPbEk NTs1tSC1CGYcEwenVANjo31/x2LbX0si7HRsFhYu+LuPdctS1jvLr2xJ4lo3OcOZUWO5ydu2 uUk9vyr0hJRLp/A9fefAvm++bF3Wm+bbk4Tfnf1yWessw2o5jdKzW0+W9MRKn+P/fPzZTGFG hf1ejz/Gz61acoxr4byK9yU8NmbnbCO1r1W32Ux5ufH/X6G4vhcdrz39lFiKMxINtZiLihMB xH7pQKECAAA= X-CFilter-Loop: Reflected X-Gm-Message-State: ALoCoQkbeclnC36SfBlER6h7wA//tMpPO0L9hr/Vs3MoOp944wGAaj/W1aRMdgHUIekuf9YzG+xz 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. 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