From owner-freebsd-arm@FreeBSD.ORG Tue May 20 15:58:40 2014 Return-Path: Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7DE3BCD for ; Tue, 20 May 2014 15:58:40 +0000 (UTC) Received: from msgw002-05.ocn.ad.jp (msgw002-05.ocn.ad.jp [180.37.203.80]) by mx1.freebsd.org (Postfix) with ESMTP id 30CAE2416 for ; Tue, 20 May 2014 15:58:39 +0000 (UTC) Received: from localhost (p11104-ipngn100303sizuokaden.shizuoka.ocn.ne.jp [114.176.34.104]) by msgw002-05.ocn.ad.jp (Postfix) with ESMTP id 7AA46A42E16; Wed, 21 May 2014 00:58:38 +0900 (JST) Date: Wed, 21 May 2014 00:58:37 +0900 (JST) Message-Id: <20140521.005837.00935147.toshi@ruby.ocn.ne.jp> To: freebsd-arm@freebsd.org Subject: Re: BBB MMC / SD detection instability with U-Boot 2014.04 (CPU 1GHz) From: SAITOU Toshihide In-Reply-To: <20140520.234245.38709064.toshi@ruby.ocn.ne.jp> References: <20140520.212003.232778263.toshi@ruby.ocn.ne.jp> <537B62D1.4090901@hot.ee> <20140520.234245.38709064.toshi@ruby.ocn.ne.jp> X-GPG-fingerprint: 34B3 0B6A 8520 F5B0 EBC7 69F6 C055 9F8A 0D49 F8FC X-Mailer: Mew version 6.2.51 on Emacs 22.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Multipart/Mixed; boundary="--Next_Part(Wed_May_21_00_58_37_2014_732)--" Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 May 2014 15:58:40 -0000 ----Next_Part(Wed_May_21_00_58_37_2014_732)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit In message: <20140520.234245.38709064.toshi@ruby.ocn.ne.jp> SAITOU Toshihide writes: >>> u-boot-2014.04.tar.bz2 >>> >>> patch >>> >>> 1. apply these patches: >>> >>> http://lists.freebsd.org/pipermail/freebsd-arm/2014-April/007922.html >>> ~/crochet-freebsd/board/BeagleBone/files/uboot-2013.04_api_api_storage.c.patch >>> ~/crochet-freebsd/board/BeagleBone/files/uboot-2013.04_drivers_mmc_mmc.c.patch I forgot to mention that I had changed uboot-2013.04_drivers_mmc_mmc.c.patch a bit. Sorry for bother you -- SAITOU Toshihide ----Next_Part(Wed_May_21_00_58_37_2014_732)-- Content-Type: Text/X-Patch; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="uboot-2014.04_drivers_mmc_mmc.c.patch" --- mmc.c.orig 2014-05-21 00:52:57.000000000 +0900 +++ mmc.c 2014-05-20 23:52:09.000000000 +0900 @@ -1225,9 +1225,14 @@ block_dev_desc_t *mmc_get_dev(int dev) { struct mmc *mmc = find_mmc_device(dev); - if (!mmc || mmc_init(mmc)) + if (!mmc) return NULL; + /* If mmc_init fails, mmc->block_dev will be of type + * DEV_TYPE_UNKNOWN with blksz and lba set to zero. + */ + mmc_init(mmc); + return &mmc->block_dev; } #endif @@ -1252,7 +1257,7 @@ err = mmc->cfg->ops->init(mmc); if (err) - return err; + goto done; mmc_set_bus_width(mmc, 1); mmc_set_clock(mmc, 1); @@ -1261,7 +1266,7 @@ err = mmc_go_idle(mmc); if (err) - return err; + goto done; /* The internal partition reset to user partition(0) at every CMD0*/ mmc->part_num = 0; @@ -1280,13 +1285,24 @@ #if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT) printf("Card did not respond to voltage select!\n"); #endif - return UNUSABLE_ERR; +// return UNUSABLE_ERR; + goto done; } } if (err == IN_PROGRESS) mmc->init_in_progress = 1; +done: + if (err) { + mmc->has_init = 0; + mmc->block_dev.type = DEV_TYPE_UNKNOWN; + mmc->block_dev.blksz = 0; + mmc->block_dev.lba = 0; + } else { + mmc->has_init = 1; + } + return err; } ----Next_Part(Wed_May_21_00_58_37_2014_732)----