From patchwork Mon Apr 11 01:12:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 608604 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 3qjsdF6Ny6z9t3n for ; Mon, 11 Apr 2016 11:18:09 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b=a8IxdJKI; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 769A0A76F0; Mon, 11 Apr 2016 03:18:05 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9E0uMa0MNqzC; Mon, 11 Apr 2016 03:18:05 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id DD007A75BA; Mon, 11 Apr 2016 03:17:41 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 9BF46A75BA for ; Mon, 11 Apr 2016 03:17:31 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id jjG-iUpETVhS for ; Mon, 11 Apr 2016 03:17:31 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-io0-f182.google.com (mail-io0-f182.google.com [209.85.223.182]) by theia.denx.de (Postfix) with ESMTPS id 33221A7531 for ; Mon, 11 Apr 2016 03:17:28 +0200 (CEST) Received: by mail-io0-f182.google.com with SMTP id g185so190835815ioa.2 for ; Sun, 10 Apr 2016 18:17:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=Lc/RLnA6S09K4u3xUNRkV3oJmRAseFxnhd+ufuNisGc=; b=a8IxdJKIIZYu0+Fv1MT+z0ucq0SpN7xATSpaIqMTHYAKF2KYzHN9hJ9Pf/lx77UhrT WucoQGobhrhoe+yqIrzNJRb1T8BFIEx+dZzWhTCg5oU1+X/kEfOd0QH5Rtep9OBADLfv L8I+vTc5ChosmdpMZBbuTUu+hBmoMjWFY0k0nzDM13fMwzo6eewqv8DbYL7doeglt7Wz Ge7AGsw6h00aKCyk1hHpj6FK2uJssgtjOtUcgxgrpg5vhigbfEf+ET/GMf5iSkQYNknW XY/qXnNKg2fRGhl+SRw7heNA18v/d1FPXu4mSX3WbUbBH1d0l6pgiv0GjZ4Stsza3ERm Jr2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=Lc/RLnA6S09K4u3xUNRkV3oJmRAseFxnhd+ufuNisGc=; b=hOO4ytnArbd4/vTlKcKkMqukC1f1RVQrBkPJmO9SRr+pr5wh0PFtPq8p/7KWvlzha2 MyxWF0H/gUlQM8ax1Na5rnoz048gYlleeumKT3wKzZ4w1tkbpWoGJi6FUDfmTQ2YElom dbzjK3+EXVocCkCfTWTaJaetHiW2UayuNflWhKaOenELmSsMt2tzsadGyvwbtEkPT9gX Kj8BlQz+/8WrIodUWwFORqN/m3dEDT0w4Urdk0iL0hu7joF8WbGaUM3Vd1rS/jXIqwS4 igw2PCKcty5ZGeKqr3WY4umbmpVcL2L5eYevd4vUsjZTU1a7oKeWFAQsiBU6hTR3aLfn WTnA== X-Gm-Message-State: AD7BkJL/UYKeaCrtKULywx5WKSmq2FYynR7tLXZYFw8nKqlNcYuZmxsdWQrZFnqQAyoAAqHF X-Received: by 10.107.6.6 with SMTP id 6mr23606532iog.24.1460337447054; Sun, 10 Apr 2016 18:17:27 -0700 (PDT) Received: from kaki.bld.corp.google.com ([100.100.202.57]) by smtp.gmail.com with ESMTPSA id fm1sm3489855igb.1.2016.04.10.18.17.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 10 Apr 2016 18:17:25 -0700 (PDT) Received: by kaki.bld.corp.google.com (Postfix, from userid 121222) id 4CE85221257; Sun, 10 Apr 2016 19:17:24 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Sun, 10 Apr 2016 19:12:25 -0600 Message-Id: <1460337163-5584-6-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 2.8.0.rc3.226.g39d4020 In-Reply-To: <1460337163-5584-1-git-send-email-sjg@chromium.org> References: <1460337163-5584-1-git-send-email-sjg@chromium.org> Cc: Tom Rini , Pantelis Antoniou Subject: [U-Boot] [PATCH 05/23] dm: mmc: Implement the select_hwpart() method X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Implement this method so that hardware partitions will work correctly with MMC. Signed-off-by: Simon Glass --- drivers/mmc/mmc.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 2211ac6..e270f5f 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -606,6 +606,27 @@ int mmc_switch_part(int dev_num, unsigned int part_num) return ret; } +static int mmc_select_hwpartp(struct blk_desc *desc, int hwpart) +{ + struct mmc *mmc = find_mmc_device(desc->devnum); + int ret; + + if (!mmc) + return -ENODEV; + + if (mmc->block_dev.hwpart == hwpart) + return 0; + + if (mmc->part_config == MMCPART_NOAVAILABLE) + return -EMEDIUMTYPE; + + ret = mmc_switch_part(desc->devnum, hwpart); + if (ret) + return ret; + + return 0; +} + int mmc_select_hwpart(int dev_num, int hwpart) { struct mmc *mmc = find_mmc_device(dev_num); @@ -1973,4 +1994,5 @@ U_BOOT_LEGACY_BLK(mmc) = { .if_type = IF_TYPE_MMC, .max_devs = -1, .get_dev = mmc_get_dev, + .select_hwpart = mmc_select_hwpartp, };