From patchwork Sun Aug 30 17:31:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sjoerd Simons X-Patchwork-Id: 52871 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by patches.linaro.org (Postfix) with ESMTPS id D3BEB2127E for ; Sun, 30 Aug 2015 17:31:59 +0000 (UTC) Received: by labd1 with SMTP id d1sf33148683lab.0 for ; Sun, 30 Aug 2015 10:31:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:cc:subject:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version :content-type:content-transfer-encoding:errors-to:sender :x-original-sender:x-original-authentication-results:mailing-list; bh=RKM5t/d+yZTQfaxtL5IIS8UQN6/7HOvAVfoJOwPJTdg=; b=H/Eqw0wjk7zTJQ1zfVtBZz5dSvgNTpTQCqyOYNkeVmYu6DV4k46PsgAxvKcswKqnzQ ib4IbUInkMlWbsiSmtUfF2thbjsf4w7syLuzMnXfvGDaJKypWIYGtP+QzRm8EzpWwq6E A9S+Y95RWDxC5eXrk/b3G/GAfc86QmRp5amgEU5myIIDf67A14klCOA9azWzgJsWjID5 mSFqEjTLooPU0EUr5RgyxrwWA8jOPUo7lZ/GhNWFR7GjAn636vuoOHgvJzINDvEHrqDE gpgy0JNx03DjVuFOpmyb6relMduHRIhkPr5tVH+NKeWk8fGWpgelDEAKGADCJyuCKEyA z/Gg== X-Gm-Message-State: ALoCoQk7XjSdMm6VT05xe+0VyzQ1Z/9qYKldoZv9eKQbmwmtbkEx3fDQd8FeXvZn4Jeu/3vQyKZs X-Received: by 10.112.78.101 with SMTP id a5mr5233449lbx.9.1440955918809; Sun, 30 Aug 2015 10:31:58 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.178.197 with SMTP id da5ls44799lac.34.gmail; Sun, 30 Aug 2015 10:31:58 -0700 (PDT) X-Received: by 10.152.9.37 with SMTP id w5mr8627917laa.43.1440955918608; Sun, 30 Aug 2015 10:31:58 -0700 (PDT) Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com. [209.85.217.181]) by mx.google.com with ESMTPS id cf5si9791868lad.141.2015.08.30.10.31.58 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 30 Aug 2015 10:31:58 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.181 as permitted sender) client-ip=209.85.217.181; Received: by lbvd4 with SMTP id d4so13847318lbv.3 for ; Sun, 30 Aug 2015 10:31:58 -0700 (PDT) X-Received: by 10.112.77.10 with SMTP id o10mr8831817lbw.73.1440955918496; Sun, 30 Aug 2015 10:31:58 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.151.194 with SMTP id us2csp1167802lbb; Sun, 30 Aug 2015 10:31:57 -0700 (PDT) X-Received: by 10.180.80.200 with SMTP id t8mr14967057wix.18.1440955917835; Sun, 30 Aug 2015 10:31:57 -0700 (PDT) Received: from theia.denx.de (theia.denx.de. [85.214.87.163]) by mx.google.com with ESMTP id p10si16929783wiv.26.2015.08.30.10.31.56; Sun, 30 Aug 2015 10:31:57 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.87.163 as permitted sender) client-ip=85.214.87.163; Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 4DB304B6F3; Sun, 30 Aug 2015 19:31:51 +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 oKoWkzlb-pG7; Sun, 30 Aug 2015 19:31:51 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id BD02C4B6FC; Sun, 30 Aug 2015 19:31:33 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 783A84B681 for ; Sun, 30 Aug 2015 19:31:21 +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 NQUdAtDhlGTR for ; Sun, 30 Aug 2015 19:31:21 +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 bhuna.collabora.co.uk (bhuna.collabora.co.uk [93.93.135.160]) by theia.denx.de (Postfix) with ESMTPS id 198914B68A for ; Sun, 30 Aug 2015 19:31:18 +0200 (CEST) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: sjoerd) with ESMTPSA id 638915188055 Received: by dusk.luon.net (Postfix, from userid 1000) id A9F222808B; Sun, 30 Aug 2015 19:31:14 +0200 (CEST) From: Sjoerd Simons To: u-boot@lists.denx.de, Simon Glass Date: Sun, 30 Aug 2015 19:31:08 +0200 Message-Id: <1440955874-25809-3-git-send-email-sjoerd.simons@collabora.co.uk> X-Mailer: git-send-email 2.5.1 In-Reply-To: <1440955874-25809-1-git-send-email-sjoerd.simons@collabora.co.uk> References: <1440955874-25809-1-git-send-email-sjoerd.simons@collabora.co.uk> Cc: Tom Rini , Pantelis Antoniou Subject: [U-Boot] [PATCH v2 2/8] mmc: Probe DM based mmc devices in u-boot X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: 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" X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: sjoerd.simons@collabora.co.uk X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.181 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 During mmc initialize probe all devices with the MMC Uclass if build with CONFIG_DM_MMC Signed-off-by: Sjoerd Simons Acked-by: Simon Glass --- Changes in v2: - Check error code from uclass_get and thread it through to mmc_initialize drivers/mmc/mmc.c | 43 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 4 deletions(-) diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index f12546a..371c1ec 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -10,6 +10,8 @@ #include #include #include +#include +#include #include #include #include @@ -1759,10 +1761,44 @@ static void do_preinit(void) } } +#if defined(CONFIG_DM_MMC) && defined(CONFIG_SPL_BUILD) +static int mmc_probe(bd_t *bis) +{ + return 0; +} +#elif defined(CONFIG_DM_MMC) +static int mmc_probe(bd_t *bis) +{ + int ret; + struct uclass *uc; + struct udevice *m; + + ret = uclass_get(UCLASS_MMC, &uc); + if (ret) + return ret; + + uclass_foreach_dev(m, uc) { + ret = device_probe(m); + if (ret) + printf("%s - probe failed: %d\n", m->name, ret); + } + + return 0; +} +#else +static int mmc_probe(bd_t *bis) +{ + if (board_mmc_init(bis) < 0) + cpu_mmc_init(bis); + + return 0; +} +#endif int mmc_initialize(bd_t *bis) { static int initialized = 0; + int ret; if (initialized) /* Avoid initializing mmc multiple times */ return 0; initialized = 1; @@ -1770,10 +1806,9 @@ int mmc_initialize(bd_t *bis) INIT_LIST_HEAD (&mmc_devices); cur_dev_num = 0; -#ifndef CONFIG_DM_MMC - if (board_mmc_init(bis) < 0) - cpu_mmc_init(bis); -#endif + ret = mmc_probe(bis); + if (ret) + return ret; #ifndef CONFIG_SPL_BUILD print_mmc_devices(',');