From patchwork Sun Aug 30 22:55:45 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 52883 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by patches.linaro.org (Postfix) with ESMTPS id 32E902127E for ; Sun, 30 Aug 2015 23:08:03 +0000 (UTC) Received: by lbck9 with SMTP id k9sf32582231lbc.0 for ; Sun, 30 Aug 2015 16:08:02 -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=F2/w6oXfWHA+uLVFqZZagJwLx9T+/gIej7GG2Bsd1nk=; b=UvfLJ/HhvRQvJW9w6P6sdwO9PweAy630hDEsI0psWvHdqNAxVQOtjtZmSW3qwVEs3J YFEASiDCGwvCa46/M5MEHtQe4/Gu9muYzHflwicq0WEohFeSxNaIwr/wLvyI1CKTGcus WzNHslvm0vXUdetuuPu8BBWFe2d5WeWQbgbzk7e87xT8a2rofkleZtwtdH0kMwd1SgrJ tTQvogWNmJz8XLXVKOkwxUFSK6dH0gjNCFhXVnWCYahjHzk4P1GhlMI4XFHjhP8vyGMc /NuFBoob1fKYMsAVj2OrS1E3E2nxlr15vw4OIvGlooIYwkZStF1qdc/ocyrlwDBjTcwf 4hwQ== X-Gm-Message-State: ALoCoQlIyYgu82aWHSf+mGn1GDo7XRn6kx5YQw8hbtvMCGDoj2fMXlZWuPOYfaN1ZasbqlKGrB1I X-Received: by 10.112.172.70 with SMTP id ba6mr5266040lbc.1.1440976082159; Sun, 30 Aug 2015 16:08:02 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.18.227 with SMTP id z3ls323161lad.97.gmail; Sun, 30 Aug 2015 16:08:01 -0700 (PDT) X-Received: by 10.112.156.168 with SMTP id wf8mr9147310lbb.114.1440976081726; Sun, 30 Aug 2015 16:08:01 -0700 (PDT) Received: from mail-la0-x22f.google.com (mail-la0-x22f.google.com. [2a00:1450:4010:c03::22f]) by mx.google.com with ESMTPS id wh4si11782179lbb.91.2015.08.30.16.08.01 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 30 Aug 2015 16:08:01 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c03::22f as permitted sender) client-ip=2a00:1450:4010:c03::22f; Received: by laboe4 with SMTP id oe4so34776118lab.0 for ; Sun, 30 Aug 2015 16:08:01 -0700 (PDT) X-Received: by 10.152.5.228 with SMTP id v4mr9312348lav.36.1440976081629; Sun, 30 Aug 2015 16:08:01 -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 us2csp1274041lbb; Sun, 30 Aug 2015 16:08:01 -0700 (PDT) X-Received: by 10.194.184.82 with SMTP id es18mr25340117wjc.79.1440976080987; Sun, 30 Aug 2015 16:08:00 -0700 (PDT) Received: from theia.denx.de (theia.denx.de. [85.214.87.163]) by mx.google.com with ESMTP id vm9si16410662wjc.208.2015.08.30.16.08.00; Sun, 30 Aug 2015 16:08:00 -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 2E2034B890; Mon, 31 Aug 2015 01:07:49 +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 uTG-haG66xYg; Mon, 31 Aug 2015 01:07:49 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A8ABB4B825; Mon, 31 Aug 2015 01:07:11 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D36A84B7C1 for ; Mon, 31 Aug 2015 01:06:32 +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 AmEqkRfJqYBi for ; Mon, 31 Aug 2015 01:06:32 +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-f174.google.com (mail-io0-f174.google.com [209.85.223.174]) by theia.denx.de (Postfix) with ESMTPS id 155554B7EB for ; Mon, 31 Aug 2015 01:06:19 +0200 (CEST) Received: by iog7 with SMTP id 7so17604674iog.2 for ; Sun, 30 Aug 2015 16:06:18 -0700 (PDT) X-Received: by 10.107.47.168 with SMTP id v40mr21648334iov.30.1440975978501; Sun, 30 Aug 2015 16:06:18 -0700 (PDT) Received: from kaki.bld.corp.google.com ([2620:0:1005:1100:ece0:4c24:45e2:502e]) by smtp.gmail.com with ESMTPSA id pi6sm9292719igb.21.2015.08.30.16.06.13 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 30 Aug 2015 16:06:15 -0700 (PDT) Received: by kaki.bld.corp.google.com (Postfix, from userid 121222) id 6D3BE221E22; Sun, 30 Aug 2015 16:56:11 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Sun, 30 Aug 2015 16:55:45 -0600 Message-Id: <1440975352-28528-35-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 2.5.0.457.gab17608 In-Reply-To: <1440975352-28528-1-git-send-email-sjg@chromium.org> References: <1440975352-28528-1-git-send-email-sjg@chromium.org> Cc: huangtao , Andre Przywara , Pantelis Antoniou , cwx Subject: [U-Boot] [PATCH v5 34/41] 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-Original-Sender: sjg@chromium.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c03::22f as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=neutral (body hash did not verify) header.i=@google.com; dmarc=fail (p=NONE dis=NONE) header.from=chromium.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Sjoerd Simons 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 Signed-off-by: Simon Glass --- Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None 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(',');