mirror of
git://projects.qi-hardware.com/xburst-tools.git
synced 2024-11-01 16:24:04 +02:00
Added SDHC support
Implemented and tested on Josch's GTA01Bv4 Signed-off-by: Paul Fertser <fercerpav@gmail.com>
This commit is contained in:
parent
0ca1d89412
commit
8089e8de8b
@ -280,7 +280,7 @@ const struct board_api board_api_gta01 = {
|
||||
.partition_index = 1,
|
||||
.filesystem = FS_EXT2,
|
||||
.filepath = "boot/uImage-GTA01.bin",
|
||||
.commandline_append = "root=/dev/mmcblk0p1 ",
|
||||
.commandline_append = "root=/dev/mmcblk0p1 rootdelay=1 ",
|
||||
},
|
||||
[1] = {
|
||||
.name = "SD Card EXT2 Kernel p2",
|
||||
@ -289,7 +289,7 @@ const struct board_api board_api_gta01 = {
|
||||
.partition_index = 2,
|
||||
.filesystem = FS_EXT2,
|
||||
.filepath = "boot/uImage-GTA01.bin",
|
||||
.commandline_append = "root=/dev/mmcblk0p2 ",
|
||||
.commandline_append = "root=/dev/mmcblk0p2 rootdelay=1 ",
|
||||
},
|
||||
[2] = {
|
||||
.name = "SD Card EXT2 Kernel p3",
|
||||
@ -298,7 +298,7 @@ const struct board_api board_api_gta01 = {
|
||||
.partition_index = 3,
|
||||
.filesystem = FS_EXT2,
|
||||
.filepath = "boot/uImage-GTA01.bin",
|
||||
.commandline_append = "root=/dev/mmcblk0p3 ",
|
||||
.commandline_append = "root=/dev/mmcblk0p3 rootdelay=1 ",
|
||||
},
|
||||
[3] = {
|
||||
.name = "NAND Kernel",
|
||||
|
@ -70,6 +70,7 @@ static u8 mmc_buf[MMC_BLOCK_SIZE];
|
||||
static mmc_csd_t mmc_csd;
|
||||
static int mmc_ready = 0;
|
||||
static int wide = 0;
|
||||
static int is_sdhc = 0;
|
||||
|
||||
|
||||
#define CMD_F_RESP 0x01
|
||||
@ -162,7 +163,10 @@ static int mmc_block_read(u8 *dst, u32 src, u32 len)
|
||||
SDIDCON = dcon;
|
||||
|
||||
/* send read command */
|
||||
resp = mmc_cmd(MMC_CMD_READ_BLOCK, src, CMD_F_RESP);
|
||||
if (!is_sdhc)
|
||||
resp = mmc_cmd(MMC_CMD_READ_BLOCK, src, CMD_F_RESP);
|
||||
else
|
||||
resp = mmc_cmd(MMC_CMD_READ_BLOCK, src / MMC_BLOCK_SIZE, CMD_F_RESP);
|
||||
|
||||
while (len > 0) {
|
||||
u32 sdidsta = SDIDSTA;
|
||||
@ -449,6 +453,7 @@ int s3c24xx_mmc_init(int verbose)
|
||||
int retries, rc = -2;
|
||||
int is_sd = 0;
|
||||
u32 *resp;
|
||||
u32 hcs = 0;
|
||||
|
||||
SDICON = S3C2410_SDICON_FIFORESET | S3C2410_SDICON_CLOCKTYPE;
|
||||
SDIBSIZE = 512;
|
||||
@ -474,11 +479,20 @@ int s3c24xx_mmc_init(int verbose)
|
||||
retries = 10;
|
||||
resp = mmc_cmd(MMC_CMD_RESET, 0, 0);
|
||||
|
||||
resp = mmc_cmd(8, 0x000001aa, CMD_F_RESP);
|
||||
if ((resp[0] & 0xff) == 0xaa) {
|
||||
puts("The card is either SD2.0 or SDHC\n");
|
||||
hcs = 0x40000000;
|
||||
}
|
||||
|
||||
puts("trying to detect SD Card...\n");
|
||||
while (retries--) {
|
||||
udelay(1000000);
|
||||
resp = mmc_cmd(55, 0x00000000, CMD_F_RESP);
|
||||
resp = mmc_cmd(41, 0x00300000, CMD_F_RESP);
|
||||
resp = mmc_cmd(41, hcs | 0x00300000, CMD_F_RESP);
|
||||
|
||||
if (resp[0] & (1 << 30))
|
||||
is_sdhc = 1;
|
||||
|
||||
if (resp[0] & (1 << 31)) {
|
||||
is_sd = 1;
|
||||
@ -490,7 +504,7 @@ int s3c24xx_mmc_init(int verbose)
|
||||
return -3;
|
||||
|
||||
/* try to get card id */
|
||||
resp = mmc_cmd(MMC_CMD_ALL_SEND_CID, 0, CMD_F_RESP|CMD_F_RESP_LONG);
|
||||
resp = mmc_cmd(MMC_CMD_ALL_SEND_CID, hcs, CMD_F_RESP|CMD_F_RESP_LONG);
|
||||
if (resp) {
|
||||
if (!is_sd) {
|
||||
/* TODO configure mmc driver depending on card
|
||||
|
Loading…
Reference in New Issue
Block a user