示例#1
0
static void mmc_configure_card(void)
{
	unsigned int rate;

	/* Get card info */

	if (sd2_0)
		mmcinfo.block_num = (mmcinfo.csd.c_size + 1) << 10;
	else
		mmcinfo.block_num =
		    (mmcinfo.csd.c_size +
		     1) * (1 << (mmcinfo.csd.c_size_mult + 2));

	mmcinfo.block_len = 1 << mmcinfo.csd.read_bl_len;
	/* Fix the clock rate */
	rate = mmc_tran_speed(mmcinfo.csd.tran_speed);
	if (rate < MMC_CLOCK_SLOW)
		rate = MMC_CLOCK_SLOW;
	if ((mmcinfo.sd == 0) && (rate > MMC_CLOCK_FAST))
		rate = MMC_CLOCK_FAST;
	if ((mmcinfo.sd) && (rate > SD_CLOCK_FAST))
		rate = SD_CLOCK_FAST;

	DEBUG(2, "mmc_configure_card: block_len=%d block_num=%d rate=%d\n",
	      mmcinfo.block_len, mmcinfo.block_num, rate);

	_mmc_set_clock(mmcinfo.sd, rate);
}
示例#2
0
static void mmc_configure_card( struct mmc_dev *dev, int slot )
{
	u32 rate;
	struct mmc_slot *slot_data = dev->slot;

	DEBUG(2,": slot=%d\n", slot);

	/* Fix the clock rate */
	rate = mmc_tran_speed(dev->slot[slot].csd.tran_speed);
	if ( rate < MMC_CLOCK_SLOW )
		rate = MMC_CLOCK_SLOW;
	if (( slot_data->sd == 0) && ( rate > MMC_CLOCK_FAST ))
		rate = MMC_CLOCK_FAST;
        if (( slot_data->sd ) && (rate > SD_CLOCK_FAST))
		rate = SD_CLOCK_FAST;

	dev->sdrive->set_clock(rate);
	
	/* Match the drive media */
	mmc_match_media_driver(&dev->slot[slot]);
	run_sbin_mmc_hotplug(dev, slot, 1);
}