forked from len0rd/rockbox
sd.h : avoid namespace collision by prefixing defines with SD_
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19055 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
72846cda0e
commit
fa748db6ff
3 changed files with 81 additions and 81 deletions
|
@ -49,43 +49,43 @@ bool sd_present(IF_MV_NONVOID(int drive));
|
||||||
long sd_last_disk_activity(void);
|
long sd_last_disk_activity(void);
|
||||||
|
|
||||||
/* SD States */
|
/* SD States */
|
||||||
#define IDLE 0
|
#define SD_IDLE 0
|
||||||
#define READY 1
|
#define SD_READY 1
|
||||||
#define IDENT 2
|
#define SD_IDENT 2
|
||||||
#define STBY 3
|
#define SD_STBY 3
|
||||||
#define TRAN 4
|
#define SD_TRAN 4
|
||||||
#define DATA 5
|
#define SD_DATA 5
|
||||||
#define RCV 6
|
#define SD_RCV 6
|
||||||
#define PRG 7
|
#define SD_PRG 7
|
||||||
#define DIS 8
|
#define SD_DIS 8
|
||||||
|
|
||||||
/* SD Commands */
|
/* SD Commands */
|
||||||
#define GO_IDLE_STATE 0
|
#define SD_GO_IDLE_STATE 0
|
||||||
#define ALL_SEND_CID 2
|
#define SD_ALL_SEND_CID 2
|
||||||
#define SEND_RELATIVE_ADDR 3
|
#define SD_SEND_RELATIVE_ADDR 3
|
||||||
#define SET_DSR 4
|
#define SD_SET_DSR 4
|
||||||
#define SWITCH_FUNC 6
|
#define SD_SWITCH_FUNC 6
|
||||||
#define SELECT_CARD 7
|
#define SD_SELECT_CARD 7
|
||||||
#define DESELECT_CARD 7
|
#define SD_DESELECT_CARD 7
|
||||||
#define SEND_IF_COND 8
|
#define SD_SEND_IF_COND 8
|
||||||
#define SEND_CSD 9
|
#define SD_SEND_CSD 9
|
||||||
#define SEND_CID 10
|
#define SD_SEND_CID 10
|
||||||
#define STOP_TRANSMISSION 12
|
#define SD_STOP_TRANSMISSION 12
|
||||||
#define SEND_STATUS 13
|
#define SD_SEND_STATUS 13
|
||||||
#define GO_INACTIVE_STATE 15
|
#define SD_GO_INACTIVE_STATE 15
|
||||||
#define SET_BLOCKLEN 16
|
#define SD_SET_BLOCKLEN 16
|
||||||
#define READ_SINGLE_BLOCK 17
|
#define SD_READ_SINGLE_BLOCK 17
|
||||||
#define READ_MULTIPLE_BLOCK 18
|
#define SD_READ_MULTIPLE_BLOCK 18
|
||||||
#define SEND_NUM_WR_BLOCKS 22
|
#define SD_SEND_NUM_WR_BLOCKS 22
|
||||||
#define WRITE_BLOCK 24
|
#define SD_WRITE_BLOCK 24
|
||||||
#define WRITE_MULTIPLE_BLOCK 25
|
#define SD_WRITE_MULTIPLE_BLOCK 25
|
||||||
#define ERASE_WR_BLK_START 32
|
#define SD_ERASE_WR_BLK_START 32
|
||||||
#define ERASE_WR_BLK_END 33
|
#define SD_ERASE_WR_BLK_END 33
|
||||||
#define ERASE 38
|
#define SD_ERASE 38
|
||||||
#define APP_CMD 55
|
#define SD_APP_CMD 55
|
||||||
|
|
||||||
/* Application Specific commands */
|
/* Application Specific commands */
|
||||||
#define SET_BUS_WIDTH 6
|
#define SD_SET_BUS_WIDTH 6
|
||||||
#define SD_APP_OP_COND 41
|
#define SD_APP_OP_COND 41
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -191,13 +191,13 @@ static int sd_init_card(const int drive)
|
||||||
int max_tries = 100; /* max acmd41 attemps */
|
int max_tries = 100; /* max acmd41 attemps */
|
||||||
bool sdhc;
|
bool sdhc;
|
||||||
|
|
||||||
if(!send_cmd(drive, GO_IDLE_STATE, 0, MMC_NO_FLAGS, NULL))
|
if(!send_cmd(drive, SD_GO_IDLE_STATE, 0, MMC_NO_FLAGS, NULL))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
mci_delay();
|
mci_delay();
|
||||||
|
|
||||||
sdhc = false;
|
sdhc = false;
|
||||||
if(send_cmd(drive, SEND_IF_COND, 0x1AA, MMC_RESP|MMC_ARG, &response))
|
if(send_cmd(drive, SD_SEND_IF_COND, 0x1AA, MMC_RESP|MMC_ARG, &response))
|
||||||
if((response & 0xFFF) == 0x1AA)
|
if((response & 0xFFF) == 0x1AA)
|
||||||
sdhc = true;
|
sdhc = true;
|
||||||
|
|
||||||
|
@ -205,7 +205,7 @@ static int sd_init_card(const int drive)
|
||||||
mci_delay();
|
mci_delay();
|
||||||
|
|
||||||
/* app_cmd */
|
/* app_cmd */
|
||||||
if( !send_cmd(drive, APP_CMD, 0, MMC_RESP|MMC_ARG, &response) ||
|
if( !send_cmd(drive, SD_APP_CMD, 0, MMC_RESP|MMC_ARG, &response) ||
|
||||||
!(response & (1<<5)) )
|
!(response & (1<<5)) )
|
||||||
{
|
{
|
||||||
return -2;
|
return -2;
|
||||||
|
@ -222,17 +222,17 @@ static int sd_init_card(const int drive)
|
||||||
return -4;
|
return -4;
|
||||||
|
|
||||||
/* send CID */
|
/* send CID */
|
||||||
if(!send_cmd(drive, ALL_SEND_CID, 0, MMC_RESP|MMC_LONG_RESP|MMC_ARG,
|
if(!send_cmd(drive, SD_ALL_SEND_CID, 0, MMC_RESP|MMC_LONG_RESP|MMC_ARG,
|
||||||
card_info[drive].cid))
|
card_info[drive].cid))
|
||||||
return -5;
|
return -5;
|
||||||
|
|
||||||
/* send RCA */
|
/* send RCA */
|
||||||
if(!send_cmd(drive, SEND_RELATIVE_ADDR, 0, MMC_RESP|MMC_ARG,
|
if(!send_cmd(drive, SD_SEND_RELATIVE_ADDR, 0, MMC_RESP|MMC_ARG,
|
||||||
&card_info[drive].rca))
|
&card_info[drive].rca))
|
||||||
return -6;
|
return -6;
|
||||||
|
|
||||||
/* send CSD */
|
/* send CSD */
|
||||||
if(!send_cmd(drive, SEND_CSD, card_info[drive].rca,
|
if(!send_cmd(drive, SD_SEND_CSD, card_info[drive].rca,
|
||||||
MMC_RESP|MMC_LONG_RESP|MMC_ARG, card_info[drive].csd))
|
MMC_RESP|MMC_LONG_RESP|MMC_ARG, card_info[drive].csd))
|
||||||
return -7;
|
return -7;
|
||||||
|
|
||||||
|
@ -259,16 +259,16 @@ static int sd_init_card(const int drive)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(!send_cmd(drive, SELECT_CARD, card_info[drive].rca, MMC_ARG, NULL))
|
if(!send_cmd(drive, SD_SELECT_CARD, card_info[drive].rca, MMC_ARG, NULL))
|
||||||
return -9;
|
return -9;
|
||||||
|
|
||||||
if(!send_cmd(drive, APP_CMD, card_info[drive].rca, MMC_ARG, NULL))
|
if(!send_cmd(drive, SD_APP_CMD, card_info[drive].rca, MMC_ARG, NULL))
|
||||||
return -10;
|
return -10;
|
||||||
|
|
||||||
if(!send_cmd(drive, SET_BUS_WIDTH, card_info[drive].rca | 2, MMC_ARG, NULL))
|
if(!send_cmd(drive, SD_SET_BUS_WIDTH, card_info[drive].rca | 2, MMC_ARG, NULL))
|
||||||
return -11;
|
return -11;
|
||||||
|
|
||||||
if(!send_cmd(drive, SET_BLOCKLEN, card_info[drive].block_size, MMC_ARG,
|
if(!send_cmd(drive, SD_SET_BLOCKLEN, card_info[drive].block_size, MMC_ARG,
|
||||||
NULL))
|
NULL))
|
||||||
return -12;
|
return -12;
|
||||||
|
|
||||||
|
@ -490,7 +490,7 @@ static int sd_wait_for_state(const int drive, unsigned int state)
|
||||||
{
|
{
|
||||||
long us;
|
long us;
|
||||||
|
|
||||||
if(!send_cmd(drive, SEND_STATUS, card_info[drive].rca,
|
if(!send_cmd(drive, SD_SEND_STATUS, card_info[drive].rca,
|
||||||
MMC_RESP|MMC_ARG, &response))
|
MMC_RESP|MMC_ARG, &response))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
@ -544,7 +544,7 @@ int sd_read_sectors(IF_MV2(int drive,) unsigned long start, int incount,
|
||||||
|
|
||||||
last_disk_activity = current_tick;
|
last_disk_activity = current_tick;
|
||||||
|
|
||||||
ret = sd_wait_for_state(drive, TRAN);
|
ret = sd_wait_for_state(drive, SD_TRAN);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto sd_read_error;
|
goto sd_read_error;
|
||||||
|
|
||||||
|
@ -555,9 +555,9 @@ int sd_read_sectors(IF_MV2(int drive,) unsigned long start, int incount,
|
||||||
int transfer = (remaining >= 128) ? 127 : remaining; /* sectors */
|
int transfer = (remaining >= 128) ? 127 : remaining; /* sectors */
|
||||||
|
|
||||||
if(card_info[drive].ocr & (1<<30) ) /* SDHC */
|
if(card_info[drive].ocr & (1<<30) ) /* SDHC */
|
||||||
ret = send_cmd(drive, READ_MULTIPLE_BLOCK, start, MMC_ARG, NULL);
|
ret = send_cmd(drive, SD_READ_MULTIPLE_BLOCK, start, MMC_ARG, NULL);
|
||||||
else
|
else
|
||||||
ret = send_cmd(drive, READ_MULTIPLE_BLOCK, start * BLOCK_SIZE,
|
ret = send_cmd(drive, SD_READ_MULTIPLE_BLOCK, start * BLOCK_SIZE,
|
||||||
MMC_ARG, NULL);
|
MMC_ARG, NULL);
|
||||||
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
|
@ -596,13 +596,13 @@ int sd_read_sectors(IF_MV2(int drive,) unsigned long start, int incount,
|
||||||
start += transfer;
|
start += transfer;
|
||||||
last_disk_activity = current_tick;
|
last_disk_activity = current_tick;
|
||||||
|
|
||||||
if(!send_cmd(drive, STOP_TRANSMISSION, 0, MMC_NO_FLAGS, NULL))
|
if(!send_cmd(drive, SD_STOP_TRANSMISSION, 0, MMC_NO_FLAGS, NULL))
|
||||||
{
|
{
|
||||||
ret = -666;
|
ret = -666;
|
||||||
goto sd_read_error;
|
goto sd_read_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = sd_wait_for_state(drive, TRAN);
|
ret = sd_wait_for_state(drive, SD_TRAN);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto sd_read_error;
|
goto sd_read_error;
|
||||||
|
|
||||||
|
|
|
@ -181,7 +181,7 @@ static int sd_command(unsigned int cmd, unsigned long arg1,
|
||||||
/* Error sending command */
|
/* Error sending command */
|
||||||
return -EC_COMMAND - (STATUS_REG & ERROR_BITS)*100;
|
return -EC_COMMAND - (STATUS_REG & ERROR_BITS)*100;
|
||||||
|
|
||||||
if (cmd == GO_IDLE_STATE)
|
if (cmd == SD_GO_IDLE_STATE)
|
||||||
return 0; /* no response here */
|
return 0; /* no response here */
|
||||||
|
|
||||||
words = (type == 2) ? 9 : 3;
|
words = (type == 2) ? 9 : 3;
|
||||||
|
@ -226,7 +226,7 @@ static int sd_command(unsigned int cmd, unsigned long arg1,
|
||||||
* [12:9] CURRENT_STATE
|
* [12:9] CURRENT_STATE
|
||||||
* [8] READY_FOR_DATA
|
* [8] READY_FOR_DATA
|
||||||
* [7:6]
|
* [7:6]
|
||||||
* [5] APP_CMD
|
* [5] SD_APP_CMD
|
||||||
* [4]
|
* [4]
|
||||||
* [3] AKE_SEQ_ERROR
|
* [3] AKE_SEQ_ERROR
|
||||||
* [2] Reserved
|
* [2] Reserved
|
||||||
|
@ -252,7 +252,7 @@ static int sd_wait_for_state(unsigned int state, int id)
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
int ret = sd_command(SEND_STATUS, currcard->rca, &response, 1);
|
int ret = sd_command(SD_SEND_STATUS, currcard->rca, &response, 1);
|
||||||
long us;
|
long us;
|
||||||
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
|
@ -442,7 +442,7 @@ static int sd_select_bank(unsigned char bank)
|
||||||
|
|
||||||
memset(card_data, 0, 512);
|
memset(card_data, 0, 512);
|
||||||
|
|
||||||
ret = sd_wait_for_state(TRAN, EC_TRAN_SEL_BANK);
|
ret = sd_wait_for_state(SD_TRAN, EC_TRAN_SEL_BANK);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
@ -453,7 +453,7 @@ static int sd_select_bank(unsigned char bank)
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
SD_STATE_REG = PRG;
|
SD_STATE_REG = SD_PRG;
|
||||||
|
|
||||||
card_data[0] = bank;
|
card_data[0] = bank;
|
||||||
|
|
||||||
|
@ -569,11 +569,11 @@ static void sd_init_device(int card_no)
|
||||||
DEV_RS |= DEV_ATA; /* Reset controller */
|
DEV_RS |= DEV_ATA; /* Reset controller */
|
||||||
DEV_RS &=~DEV_ATA; /* Clear Reset */
|
DEV_RS &=~DEV_ATA; /* Clear Reset */
|
||||||
|
|
||||||
SD_STATE_REG = TRAN;
|
SD_STATE_REG = SD_TRAN;
|
||||||
|
|
||||||
REG_5 = 0xf;
|
REG_5 = 0xf;
|
||||||
|
|
||||||
ret = sd_command(GO_IDLE_STATE, 0, NULL, 256);
|
ret = sd_command(SD_GO_IDLE_STATE, 0, NULL, 256);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto card_init_error;
|
goto card_init_error;
|
||||||
|
|
||||||
|
@ -581,19 +581,19 @@ static void sd_init_device(int card_no)
|
||||||
|
|
||||||
#ifdef HAVE_HOTSWAP
|
#ifdef HAVE_HOTSWAP
|
||||||
/* Check for SDHC:
|
/* Check for SDHC:
|
||||||
- non-SDHC cards simply ignore SEND_IF_COND (CMD8) and we get error -219,
|
- non-SDHC cards simply ignore SD_SEND_IF_COND (CMD8) and we get error -219,
|
||||||
which we can just ignore and assume we're dealing with standard SD.
|
which we can just ignore and assume we're dealing with standard SD.
|
||||||
- SDHC cards echo back the argument into the response. This is how we
|
- SDHC cards echo back the argument into the response. This is how we
|
||||||
tell if the card is SDHC.
|
tell if the card is SDHC.
|
||||||
*/
|
*/
|
||||||
ret = sd_command(SEND_IF_COND,0x1aa, &response,7);
|
ret = sd_command(SD_SEND_IF_COND,0x1aa, &response,7);
|
||||||
if ( (ret < 0) && (ret!=-219) )
|
if ( (ret < 0) && (ret!=-219) )
|
||||||
goto card_init_error;
|
goto card_init_error;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
while ((currcard->ocr & (1 << 31)) == 0) /* until card is powered up */
|
while ((currcard->ocr & (1 << 31)) == 0) /* until card is powered up */
|
||||||
{
|
{
|
||||||
ret = sd_command(APP_CMD, currcard->rca, NULL, 1);
|
ret = sd_command(SD_APP_CMD, currcard->rca, NULL, 1);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto card_init_error;
|
goto card_init_error;
|
||||||
|
|
||||||
|
@ -621,15 +621,15 @@ static void sd_init_device(int card_no)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = sd_command(ALL_SEND_CID, 0, currcard->cid, 2);
|
ret = sd_command(SD_ALL_SEND_CID, 0, currcard->cid, 2);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto card_init_error;
|
goto card_init_error;
|
||||||
|
|
||||||
ret = sd_command(SEND_RELATIVE_ADDR, 0, &currcard->rca, 1);
|
ret = sd_command(SD_SEND_RELATIVE_ADDR, 0, &currcard->rca, 1);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto card_init_error;
|
goto card_init_error;
|
||||||
|
|
||||||
ret = sd_command(SEND_CSD, currcard->rca, currcard->csd, 2);
|
ret = sd_command(SD_SEND_CSD, currcard->rca, currcard->csd, 2);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto card_init_error;
|
goto card_init_error;
|
||||||
|
|
||||||
|
@ -658,19 +658,19 @@ static void sd_init_device(int card_no)
|
||||||
|
|
||||||
REG_1 = 0;
|
REG_1 = 0;
|
||||||
|
|
||||||
ret = sd_command(SELECT_CARD, currcard->rca, NULL, 129);
|
ret = sd_command(SD_SELECT_CARD, currcard->rca, NULL, 129);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto card_init_error;
|
goto card_init_error;
|
||||||
|
|
||||||
ret = sd_command(APP_CMD, currcard->rca, NULL, 1);
|
ret = sd_command(SD_APP_CMD, currcard->rca, NULL, 1);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto card_init_error;
|
goto card_init_error;
|
||||||
|
|
||||||
ret = sd_command(SET_BUS_WIDTH, currcard->rca | 2, NULL, 1); /* 4 bit */
|
ret = sd_command(SD_SET_BUS_WIDTH, currcard->rca | 2, NULL, 1); /* 4 bit */
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto card_init_error;
|
goto card_init_error;
|
||||||
|
|
||||||
ret = sd_command(SET_BLOCKLEN, currcard->block_size, NULL, 1);
|
ret = sd_command(SD_SET_BLOCKLEN, currcard->block_size, NULL, 1);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto card_init_error;
|
goto card_init_error;
|
||||||
|
|
||||||
|
@ -680,10 +680,10 @@ static void sd_init_device(int card_no)
|
||||||
if( (currcard->numblocks >= BLOCKS_PER_BANK) &&
|
if( (currcard->numblocks >= BLOCKS_PER_BANK) &&
|
||||||
((currcard->ocr & (1<<30)) == 0) )
|
((currcard->ocr & (1<<30)) == 0) )
|
||||||
{
|
{
|
||||||
SD_STATE_REG = TRAN;
|
SD_STATE_REG = SD_TRAN;
|
||||||
BLOCK_COUNT_REG = 1;
|
BLOCK_COUNT_REG = 1;
|
||||||
|
|
||||||
ret = sd_command(SWITCH_FUNC, 0x80ffffef, NULL, 0x1c05);
|
ret = sd_command(SD_SWITCH_FUNC, 0x80ffffef, NULL, 0x1c05);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto card_init_error;
|
goto card_init_error;
|
||||||
|
|
||||||
|
@ -794,7 +794,7 @@ sd_read_retry:
|
||||||
start -= bank * BLOCKS_PER_BANK;
|
start -= bank * BLOCKS_PER_BANK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = sd_wait_for_state(TRAN, EC_TRAN_READ_ENTRY);
|
ret = sd_wait_for_state(SD_TRAN, EC_TRAN_READ_ENTRY);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto sd_read_error;
|
goto sd_read_error;
|
||||||
|
|
||||||
|
@ -804,12 +804,12 @@ sd_read_retry:
|
||||||
if(currcard->ocr & (1<<30) )
|
if(currcard->ocr & (1<<30) )
|
||||||
{
|
{
|
||||||
/* SDHC */
|
/* SDHC */
|
||||||
ret = sd_command(READ_MULTIPLE_BLOCK, start, NULL, 0x1c25);
|
ret = sd_command(SD_READ_MULTIPLE_BLOCK, start, NULL, 0x1c25);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
ret = sd_command(READ_MULTIPLE_BLOCK, start * BLOCK_SIZE, NULL, 0x1c25);
|
ret = sd_command(SD_READ_MULTIPLE_BLOCK, start * BLOCK_SIZE, NULL, 0x1c25);
|
||||||
}
|
}
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto sd_read_error;
|
goto sd_read_error;
|
||||||
|
@ -833,11 +833,11 @@ sd_read_retry:
|
||||||
|
|
||||||
last_disk_activity = current_tick;
|
last_disk_activity = current_tick;
|
||||||
|
|
||||||
ret = sd_command(STOP_TRANSMISSION, 0, NULL, 1);
|
ret = sd_command(SD_STOP_TRANSMISSION, 0, NULL, 1);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto sd_read_error;
|
goto sd_read_error;
|
||||||
|
|
||||||
ret = sd_wait_for_state(TRAN, EC_TRAN_READ_EXIT);
|
ret = sd_wait_for_state(SD_TRAN, EC_TRAN_READ_EXIT);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto sd_read_error;
|
goto sd_read_error;
|
||||||
|
|
||||||
|
@ -909,7 +909,7 @@ sd_write_retry:
|
||||||
|
|
||||||
check_time[EC_WRITE_TIMEOUT] = USEC_TIMER;
|
check_time[EC_WRITE_TIMEOUT] = USEC_TIMER;
|
||||||
|
|
||||||
ret = sd_wait_for_state(TRAN, EC_TRAN_WRITE_ENTRY);
|
ret = sd_wait_for_state(SD_TRAN, EC_TRAN_WRITE_ENTRY);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto sd_write_error;
|
goto sd_write_error;
|
||||||
|
|
||||||
|
@ -919,12 +919,12 @@ sd_write_retry:
|
||||||
if(currcard->ocr & (1<<30) )
|
if(currcard->ocr & (1<<30) )
|
||||||
{
|
{
|
||||||
/* SDHC */
|
/* SDHC */
|
||||||
ret = sd_command(WRITE_MULTIPLE_BLOCK, start, NULL, 0x1c2d);
|
ret = sd_command(SD_WRITE_MULTIPLE_BLOCK, start, NULL, 0x1c2d);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
ret = sd_command(WRITE_MULTIPLE_BLOCK, start*BLOCK_SIZE, NULL, 0x1c2d);
|
ret = sd_command(SD_WRITE_MULTIPLE_BLOCK, start*BLOCK_SIZE, NULL, 0x1c2d);
|
||||||
}
|
}
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto sd_write_error;
|
goto sd_write_error;
|
||||||
|
@ -935,8 +935,8 @@ sd_write_retry:
|
||||||
{
|
{
|
||||||
if (buf == buf_end)
|
if (buf == buf_end)
|
||||||
{
|
{
|
||||||
/* Set SD_STATE_REG to PRG for the last buffer fill */
|
/* Set SD_STATE_REG to SD_PRG for the last buffer fill */
|
||||||
SD_STATE_REG = PRG;
|
SD_STATE_REG = SD_PRG;
|
||||||
}
|
}
|
||||||
|
|
||||||
udelay(2); /* needed here (loop is too fast :-) */
|
udelay(2); /* needed here (loop is too fast :-) */
|
||||||
|
@ -961,11 +961,11 @@ sd_write_retry:
|
||||||
goto sd_write_error;
|
goto sd_write_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = sd_command(STOP_TRANSMISSION, 0, NULL, 1);
|
ret = sd_command(SD_STOP_TRANSMISSION, 0, NULL, 1);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto sd_write_error;
|
goto sd_write_error;
|
||||||
|
|
||||||
ret = sd_wait_for_state(TRAN, EC_TRAN_WRITE_EXIT);
|
ret = sd_wait_for_state(SD_TRAN, EC_TRAN_WRITE_EXIT);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto sd_write_error;
|
goto sd_write_error;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue