Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 May 2014 00:58:37 +0900 (JST)
From:      SAITOU Toshihide <toshi@ruby.ocn.ne.jp>
To:        freebsd-arm@freebsd.org
Subject:   Re: BBB MMC / SD detection instability with U-Boot 2014.04 (CPU 1GHz)
Message-ID:  <20140521.005837.00935147.toshi@ruby.ocn.ne.jp>
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>

next in thread | previous in thread | raw e-mail | index | archive | help
----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 <toshi@ruby.ocn.ne.jp> 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)----



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140521.005837.00935147.toshi>