From patchwork Mon Dec 17 11:19:36 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amar X-Patchwork-Id: 13623 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 D47AE23E02 for ; Mon, 17 Dec 2012 10:57:58 +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 4FA49A18A5E for ; Mon, 17 Dec 2012 10:57:58 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id c10so8818597ieb.11 for ; Mon, 17 Dec 2012 02:57:57 -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: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=YuixocvTqzEkrwPLCbkUuxhmuIH8d6gdZHqAAzDokzg=; b=IwJEn0OKDXEXL6dTQHtc0JUU/DDtZvwaAbUo+ktYzMbXVs1MYCtbyf5eGxVDcTB61f p9jMQMedQ2DhSY3GYQWB23rQx1n4TcyPns+5I0ICJ684660e3NzkbrMcyJ6mEB68coyu iVaEHf5+jK6Ee905zP5xzD4MBBbASa/lHYQ3EJ8XOY02Cr7VYIQOtiBu72c1z2ZjPEWT hdEfYKgoW5Lls2W8azlSCvLWjSwUkUwZWHywuCVa6bGMTewEDmiFfeVthVrSh+Z2EGJw RP5fhG9GfmMTG2UsizVBaiDupnq6vkCnbAAJCM1McKTj2eRn7p5SFa9MSK+yA6jLjMSy NFbg== X-Received: by 10.50.157.130 with SMTP id wm2mr9353487igb.0.1355741877698; Mon, 17 Dec 2012 02:57:57 -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 n20csp66402igt; Mon, 17 Dec 2012 02:57:57 -0800 (PST) Received: by 10.68.189.233 with SMTP id gl9mr41739506pbc.166.1355741876868; Mon, 17 Dec 2012 02:57:56 -0800 (PST) Received: from mailout1.samsung.com (mailout1.samsung.com. [203.254.224.24]) by mx.google.com with ESMTP id d7si12979490paw.269.2012.12.17.02.57.56; Mon, 17 Dec 2012 02:57:56 -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 <0MF600ADA92QUC30@mailout1.samsung.com>; Mon, 17 Dec 2012 19:57:40 +0900 (KST) Received: from epcpdlpp23 ( [172.20.52.123]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 42.BA.12699.4AAFEC05; Mon, 17 Dec 2012 19:57:40 +0900 (KST) X-AuditID: cbfee61b-b7f616d00000319b-24-50cefaa41d6b Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id F1.BA.12699.3AAFEC05; Mon, 17 Dec 2012 19:57:40 +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:39 +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 9/9] COMMON: MMC: Command to support eMMC booting Date: Mon, 17 Dec 2012 16:49:36 +0530 Message-id: <1355743176-12305-10-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+NgFrrPLMWRmVeSWpSXmKPExsWyRsSkWnfJr3MBBrOWClg8XH+TxWLK4S8s Dkwed67tYQtgjOKySUnNySxLLdK3S+DK6N1/kbXglFTF7P9ZDYwrRboYOTkkBEwkJv2fwAxh i0lcuLeerYuRi0NIYBajROe5SUxdjBxgRat+FUHEpzNKPPt1gxWkQUignUlixmFrkBo2AVWJ X4vtQcIiAhISv/qvMoLUMwt0MErsmLiZESQhLOAo8fJIIxuIzQJUf6T9E5jNK+ApcWDbXTaI IxQkWpcdYgexOYHin3c/ZIHY5SGxZ9d0ZoheAYlvkw+xQNwmK7HpADPILgmB22wSi49OYIWY IylxcMUNlgmMwgsYGVYxiqYWJBcUJ6XnGukVJ+YWl+al6yXn525iBIbi6X/PpHcwrmqwOMQo wMGoxMNrmHouQIg1say4MvcQowQHs5IIr/QboBBvSmJlVWpRfnxRaU5q8SFGH6BLJjJLiSbn A+MkryTe0NjE3NTY1NLIyMzUFIewkjhvs0dKgJBAemJJanZqakFqEcw4Jg5OqQbGdKOYGvbQ u433yib47qhRt5xx20PPrZLb4Gn2unXaT7/M2W10QYdl1YOUglzFjIg5Iusub5/Ee0dxx+95 R06dbL/sUS63raB7r6zGkg387ippWz2eqM0LuuZcPNVtavsN3rn7gkq3Pst4OD3+6gIG4fNi ZoEXNkrrH57vzft7gqKjwsaEWN8GJZbijERDLeai4kQAqWmux3ICAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupjkeLIzCtJLcpLzFFi42I5/e+xoO6SX+cCDKafY7F4uP4mi8WUw19Y HJg87lzbwxbAGNXAaJORmpiSWqSQmpecn5KZl26r5B0c7xxvamZgqGtoaWGupJCXmJtqq+Ti E6DrlpkDNFtJoSwxpxQoFJBYXKykb4dpQmiIm64FTGOErm9IEFyPkQEaSFjDmNG7/yJrwSmp itn/sxoYV4p0MXJwSAiYSKz6VdTFyAlkiklcuLeerYuRi0NIYDqjxLNfN1hBEkIC7UwSMw5b g9SzCahK/FpsDxIWEZCQ+NV/lRGknlmgg1Fix8TNjCAJYQFHiZdHGtlAbBag+iPtn8BsXgFP iQPb7rJBLFOQaF12iB3E5gSKf979kAVil4fEnl3TmScw8i5gZFjFKJpakFxQnJSea6RXnJhb XJqXrpecn7uJERzoz6R3MK5qsDjEKMDBqMTDa5h6LkCINbGsuDL3EKMEB7OSCK/0G6AQb0pi ZVVqUX58UWlOavEhRh+gqyYyS4km5wOjMK8k3tDYxNzU2NTSxMLEzBKHsJI4b7NHSoCQQHpi SWp2ampBahHMOCYOTqkGRhY9Ge5z/26yuYezSYo6/vS8tWbJ1bIvO/0erw16uFDr0aMax63b DgUbXpzqkl94Pcf4Y6608LedX7w3/zctfu7MZBIX8N3p4ZFAeUcx6/sJzJ8Ctj/9l8vzf2V0 1IQtWp2OUWqXXjzj15OtPTevxbrTuWWK9ceP131mHDx4n/ltT13jjq5X95RYijMSDbWYi4oT AYmVUMmhAgAA X-CFilter-Loop: Reflected X-Gm-Message-State: ALoCoQkZUQwS87RjPJ93JLPTTEXqsw0iN7mM0Bi3+w5tDdQjko9ktwjFZ+3ERrQH3sqmNw4MoaZE This patch adds commands to open, close and create partitions on eMMC Signed-off-by: Amar --- common/cmd_mmc.c | 101 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 100 insertions(+), 1 deletions(-) diff --git a/common/cmd_mmc.c b/common/cmd_mmc.c index 62a1c22..1fd6b94 100644 --- a/common/cmd_mmc.c +++ b/common/cmd_mmc.c @@ -248,6 +248,102 @@ 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) { + int dev; + struct mmc *mmc; + + if (argc == 2) + dev = curr_device; + else if (argc == 3) + dev = simple_strtoul(argv[2], NULL, 10); + else if (argc == 4) + return 1; + + 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 (!(mmc_boot_open(mmc))) { + printf("eMMC OPEN Success.!!\n"); + printf("\t\t\t!!!Notice!!!\n"); + printf("!You must close eMMC boot Partition" + "after all image writing!\n"); + printf("!eMMC boot partition has continuity" + "at image writing time.!\n"); + printf("!So, Do not close boot partition, Before," + "all images is written.!\n"); + } else { + printf("eMMC OPEN Failed.!!\n"); + } + return 0; + + } else if (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 if (argc == 4) + return 1; + 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 (!(mmc_boot_close(mmc))) + printf("eMMC CLOSE Success.!!\n"); + else + printf("eMMC CLOSE Failed.!!\n"); + + return 0; + + } 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); + } else { + printf("eMMC boot partition Size change Failed.!!\n"); + } + return 0; } if (strcmp(argv[1], "read") == 0) @@ -318,5 +414,8 @@ 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"); #endif