summaryrefslogtreecommitdiff
path: root/firmware/target/arm
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm')
-rw-r--r--firmware/target/arm/as3525/sd-as3525.c12
-rw-r--r--firmware/target/arm/as3525/sd-as3525v2.c12
2 files changed, 12 insertions, 12 deletions
diff --git a/firmware/target/arm/as3525/sd-as3525.c b/firmware/target/arm/as3525/sd-as3525.c
index 81dc637617..fb1ec959e3 100644
--- a/firmware/target/arm/as3525/sd-as3525.c
+++ b/firmware/target/arm/as3525/sd-as3525.c
@@ -100,7 +100,7 @@ static const int pl180_base[NUM_DRIVES] = {
100#endif 100#endif
101}; 101};
102 102
103static int sd_wait_for_state(const int drive, unsigned int state); 103static int sd_wait_for_tran_state(const int drive);
104static int sd_select_bank(signed char bank); 104static int sd_select_bank(signed char bank);
105static int sd_init_card(const int drive); 105static int sd_init_card(const int drive);
106static void init_pl180_controller(const int drive); 106static void init_pl180_controller(const int drive);
@@ -321,7 +321,7 @@ static int sd_init_card(const int drive)
321 return -5; 321 return -5;
322 mci_delay(); 322 mci_delay();
323 323
324 if(sd_wait_for_state(drive, SD_TRAN)) 324 if(sd_wait_for_tran_state(drive))
325 return -6; 325 return -6;
326 /* CMD6 */ 326 /* CMD6 */
327 if(!send_cmd(drive, SD_SWITCH_FUNC, 0x80fffff1, MCI_ARG, NULL)) 327 if(!send_cmd(drive, SD_SWITCH_FUNC, 0x80fffff1, MCI_ARG, NULL))
@@ -570,7 +570,7 @@ bool sd_present(IF_MD_NONVOID(int drive))
570} 570}
571#endif /* HAVE_HOTSWAP */ 571#endif /* HAVE_HOTSWAP */
572 572
573static int sd_wait_for_state(const int drive, unsigned int state) 573static int sd_wait_for_tran_state(const int drive)
574{ 574{
575 unsigned long response = 0; 575 unsigned long response = 0;
576 unsigned int timeout = current_tick + HZ; 576 unsigned int timeout = current_tick + HZ;
@@ -581,7 +581,7 @@ static int sd_wait_for_state(const int drive, unsigned int state)
581 MCI_RESP|MCI_ARG, &response)) 581 MCI_RESP|MCI_ARG, &response))
582 return -1; 582 return -1;
583 583
584 if (((response >> 9) & 0xf) == state) 584 if (((response >> 9) & 0xf) == SD_TRAN)
585 return 0; 585 return 0;
586 586
587 if(TIME_AFTER(current_tick, timeout)) 587 if(TIME_AFTER(current_tick, timeout))
@@ -605,7 +605,7 @@ static int sd_select_bank(signed char bank)
605 panicf("SD bank %d error : 0x%x", bank, 605 panicf("SD bank %d error : 0x%x", bank,
606 transfer_error[INTERNAL_AS3525]); 606 transfer_error[INTERNAL_AS3525]);
607 607
608 ret = sd_wait_for_state(INTERNAL_AS3525, SD_TRAN); 608 ret = sd_wait_for_tran_state(INTERNAL_AS3525);
609 if (ret < 0) 609 if (ret < 0)
610 return ret - 2; 610 return ret - 2;
611 611
@@ -746,7 +746,7 @@ static int sd_transfer_sectors(IF_MD2(int drive,) unsigned long start,
746 if(write) 746 if(write)
747 memcpy(uncached_buffer, buf, transfer * SD_BLOCK_SIZE); 747 memcpy(uncached_buffer, buf, transfer * SD_BLOCK_SIZE);
748 748
749 ret = sd_wait_for_state(drive, SD_TRAN); 749 ret = sd_wait_for_tran_state(drive);
750 if (ret < 0) 750 if (ret < 0)
751 { 751 {
752 ret -= 2*20; 752 ret -= 2*20;
diff --git a/firmware/target/arm/as3525/sd-as3525v2.c b/firmware/target/arm/as3525/sd-as3525v2.c
index ee2a09ac0a..8ad219625c 100644
--- a/firmware/target/arm/as3525/sd-as3525v2.c
+++ b/firmware/target/arm/as3525/sd-as3525v2.c
@@ -328,7 +328,7 @@ static unsigned char aligned_buffer[UNALIGNED_NUM_SECTORS* SD_BLOCK_SIZE] __attr
328static unsigned char *uncached_buffer = AS3525_UNCACHED_ADDR(&aligned_buffer[0]); 328static unsigned char *uncached_buffer = AS3525_UNCACHED_ADDR(&aligned_buffer[0]);
329 329
330static void init_controller(void); 330static void init_controller(void);
331static int sd_wait_for_state(const int drive, unsigned int state); 331static int sd_wait_for_tran_state(const int drive);
332 332
333static tCardInfo card_info[NUM_DRIVES]; 333static tCardInfo card_info[NUM_DRIVES];
334 334
@@ -512,7 +512,7 @@ static int sd_init_card(const int drive)
512 if(!send_cmd(drive, SD_SELECT_CARD, card_info[drive].rca, MCI_NO_RESP, NULL)) 512 if(!send_cmd(drive, SD_SELECT_CARD, card_info[drive].rca, MCI_NO_RESP, NULL))
513 return -7; 513 return -7;
514 514
515 if(sd_wait_for_state(drive, SD_TRAN)) 515 if(sd_wait_for_tran_state(drive))
516 return -8; 516 return -8;
517 517
518 /* CMD6 */ 518 /* CMD6 */
@@ -544,7 +544,7 @@ static int sd_init_card(const int drive)
544 544
545#ifndef BOOTLOADER 545#ifndef BOOTLOADER
546 /* Switch to to 4 bit widebus mode */ 546 /* Switch to to 4 bit widebus mode */
547 if(sd_wait_for_state(drive, SD_TRAN) < 0) 547 if(sd_wait_for_tran_state(drive) < 0)
548 return -13; 548 return -13;
549 /* CMD55 */ /* Response is requested due to timing issue */ 549 /* CMD55 */ /* Response is requested due to timing issue */
550 if(!send_cmd(drive, SD_APP_CMD, card_info[drive].rca, MCI_RESP, &response)) 550 if(!send_cmd(drive, SD_APP_CMD, card_info[drive].rca, MCI_RESP, &response))
@@ -756,7 +756,7 @@ int sd_init(void)
756 return 0; 756 return 0;
757} 757}
758 758
759static int sd_wait_for_state(const int drive, unsigned int state) 759static int sd_wait_for_tran_state(const int drive)
760{ 760{
761 unsigned long response; 761 unsigned long response;
762 unsigned int timeout = 100; /* ticks */ 762 unsigned int timeout = 100; /* ticks */
@@ -768,7 +768,7 @@ static int sd_wait_for_state(const int drive, unsigned int state)
768 768
769 while(!(send_cmd(drive, SD_SEND_STATUS, card_info[drive].rca, MCI_RESP, &response))); 769 while(!(send_cmd(drive, SD_SEND_STATUS, card_info[drive].rca, MCI_RESP, &response)));
770 770
771 if (((response >> 9) & 0xf) == state) 771 if (((response >> 9) & 0xf) == SD_TRAN)
772 return 0; 772 return 0;
773 773
774 if(TIME_AFTER(current_tick, t + timeout)) 774 if(TIME_AFTER(current_tick, t + timeout))
@@ -846,7 +846,7 @@ static int sd_transfer_sectors(IF_MD2(int drive,) unsigned long start,
846 846
847 MCI_BYTCNT = transfer * SD_BLOCK_SIZE; 847 MCI_BYTCNT = transfer * SD_BLOCK_SIZE;
848 848
849 ret = sd_wait_for_state(drive, SD_TRAN); 849 ret = sd_wait_for_tran_state(drive);
850 if (ret < 0) 850 if (ret < 0)
851 { 851 {
852 static const char *st[9] = { 852 static const char *st[9] = {