sd_card: Enable 8-bit/52Mhz mode for eMMC

This commit is contained in:
Sebastian Sumpf 2013-03-22 16:22:15 +01:00 committed by Norman Feske
parent 3b71a9c986
commit c27364f2df
2 changed files with 38 additions and 7 deletions

View File

@ -383,16 +383,28 @@ struct Exynos5_msh_controller : private Dwmmc, Sd_card::Host_controller
}
Card_info card_info = _detect_mmc();
#if 0
/* set to eight bit transfer Bit */
if (!setup_bus(CLK_DIV_52Mhz, _delayer))
/* switch frequency to high speed */
enum { EXT_CSD_HS_TIMING = 185 };
if (!issue_command(Mmc_switch(EXT_CSD_HS_TIMING, 1))) {
PERR("Error setting high speed frequency");
throw Detection_failed();
}
enum { EXT_CSD_BUS_WIDTH = 183 };
/* set card to 8 bit */
if (!issue_command(Mmc_switch(EXT_CSD_BUS_WIDTH, 2))) {
PERR("Error setting card bus width");
throw Detection_failed();
}
bus_width(BUS_WIDTH_8);
/*
* TODO SD card: set bus width (on card) - 4 bit
*/
#endif
/* set to eight bit transfer Bit */
if (!setup_bus(CLK_DIV_52Mhz, _delayer)) {
PERR("Error setting bus to high speed");
throw Detection_failed();
}
/*
* Enable Interrupts data read timeout | data transfer done | response

View File

@ -227,6 +227,25 @@ namespace Sd_card {
}
};
struct Mmc_switch : Command<6, RESPONSE_48_BIT>
{
enum { SWITCH_MODE_WRITE_BYTE = 0x3 };
struct Arg : Sd_card::Arg
{
struct Value : Bitfield<8, 8> { };
struct Index : Bitfield<16, 8> { };
struct Mode : Bitfield<24, 8> { };
};
Mmc_switch(unsigned index, unsigned val)
{
Arg::Mode::set(arg, SWITCH_MODE_WRITE_BYTE);
Arg::Index::set(arg, index);
Arg::Value::set(arg, val);
}
};
struct Sd_send_op_cond : Prefixed_command<41, RESPONSE_48_BIT>
{
struct Arg : Sd_card::Arg