1
0
mirror of git://projects.qi-hardware.com/xburst-tools.git synced 2024-12-23 21:56:46 +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:
Paul Fertser 2009-05-24 01:16:35 +04:00 committed by Nelson Castillo
parent 0ca1d89412
commit 8089e8de8b
2 changed files with 20 additions and 6 deletions

View File

@ -280,7 +280,7 @@ const struct board_api board_api_gta01 = {
.partition_index = 1, .partition_index = 1,
.filesystem = FS_EXT2, .filesystem = FS_EXT2,
.filepath = "boot/uImage-GTA01.bin", .filepath = "boot/uImage-GTA01.bin",
.commandline_append = "root=/dev/mmcblk0p1 ", .commandline_append = "root=/dev/mmcblk0p1 rootdelay=1 ",
}, },
[1] = { [1] = {
.name = "SD Card EXT2 Kernel p2", .name = "SD Card EXT2 Kernel p2",
@ -289,7 +289,7 @@ const struct board_api board_api_gta01 = {
.partition_index = 2, .partition_index = 2,
.filesystem = FS_EXT2, .filesystem = FS_EXT2,
.filepath = "boot/uImage-GTA01.bin", .filepath = "boot/uImage-GTA01.bin",
.commandline_append = "root=/dev/mmcblk0p2 ", .commandline_append = "root=/dev/mmcblk0p2 rootdelay=1 ",
}, },
[2] = { [2] = {
.name = "SD Card EXT2 Kernel p3", .name = "SD Card EXT2 Kernel p3",
@ -298,7 +298,7 @@ const struct board_api board_api_gta01 = {
.partition_index = 3, .partition_index = 3,
.filesystem = FS_EXT2, .filesystem = FS_EXT2,
.filepath = "boot/uImage-GTA01.bin", .filepath = "boot/uImage-GTA01.bin",
.commandline_append = "root=/dev/mmcblk0p3 ", .commandline_append = "root=/dev/mmcblk0p3 rootdelay=1 ",
}, },
[3] = { [3] = {
.name = "NAND Kernel", .name = "NAND Kernel",

View File

@ -70,6 +70,7 @@ static u8 mmc_buf[MMC_BLOCK_SIZE];
static mmc_csd_t mmc_csd; static mmc_csd_t mmc_csd;
static int mmc_ready = 0; static int mmc_ready = 0;
static int wide = 0; static int wide = 0;
static int is_sdhc = 0;
#define CMD_F_RESP 0x01 #define CMD_F_RESP 0x01
@ -162,7 +163,10 @@ static int mmc_block_read(u8 *dst, u32 src, u32 len)
SDIDCON = dcon; SDIDCON = dcon;
/* send read command */ /* send read command */
if (!is_sdhc)
resp = mmc_cmd(MMC_CMD_READ_BLOCK, src, CMD_F_RESP); 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) { while (len > 0) {
u32 sdidsta = SDIDSTA; u32 sdidsta = SDIDSTA;
@ -449,6 +453,7 @@ int s3c24xx_mmc_init(int verbose)
int retries, rc = -2; int retries, rc = -2;
int is_sd = 0; int is_sd = 0;
u32 *resp; u32 *resp;
u32 hcs = 0;
SDICON = S3C2410_SDICON_FIFORESET | S3C2410_SDICON_CLOCKTYPE; SDICON = S3C2410_SDICON_FIFORESET | S3C2410_SDICON_CLOCKTYPE;
SDIBSIZE = 512; SDIBSIZE = 512;
@ -474,11 +479,20 @@ int s3c24xx_mmc_init(int verbose)
retries = 10; retries = 10;
resp = mmc_cmd(MMC_CMD_RESET, 0, 0); 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"); puts("trying to detect SD Card...\n");
while (retries--) { while (retries--) {
udelay(1000000); udelay(1000000);
resp = mmc_cmd(55, 0x00000000, CMD_F_RESP); 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)) { if (resp[0] & (1 << 31)) {
is_sd = 1; is_sd = 1;
@ -490,7 +504,7 @@ int s3c24xx_mmc_init(int verbose)
return -3; return -3;
/* try to get card id */ /* 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 (resp) {
if (!is_sd) { if (!is_sd) {
/* TODO configure mmc driver depending on card /* TODO configure mmc driver depending on card