diff options
Diffstat (limited to 'firmware/target/mips/ingenic_jz47xx')
-rw-r--r-- | firmware/target/mips/ingenic_jz47xx/ata-sd-jz4740.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/firmware/target/mips/ingenic_jz47xx/ata-sd-jz4740.c b/firmware/target/mips/ingenic_jz47xx/ata-sd-jz4740.c index 6e7f62a2e5..d14715c192 100644 --- a/firmware/target/mips/ingenic_jz47xx/ata-sd-jz4740.c +++ b/firmware/target/mips/ingenic_jz47xx/ata-sd-jz4740.c | |||
@@ -41,8 +41,6 @@ static long last_disk_activity = -1; | |||
41 | 41 | ||
42 | #define DEBUG(x...) logf(x) | 42 | #define DEBUG(x...) logf(x) |
43 | 43 | ||
44 | #define BLOCK_SIZE 512 | ||
45 | |||
46 | #define MMC_INSERT_STATUS() __gpio_get_pin(MMC_CD_PIN) | 44 | #define MMC_INSERT_STATUS() __gpio_get_pin(MMC_CD_PIN) |
47 | #define MMC_RESET() __msc_reset() | 45 | #define MMC_RESET() __msc_reset() |
48 | 46 | ||
@@ -1668,7 +1666,12 @@ tCardInfo* card_get_info_target(int card_no) | |||
1668 | (void)card_no; | 1666 | (void)card_no; |
1669 | int i, temp; | 1667 | int i, temp; |
1670 | static tCardInfo card; | 1668 | static tCardInfo card; |
1671 | 1669 | ||
1670 | static const unsigned char sd_mantissa[] = { /* *10 */ | ||
1671 | 0, 10, 12, 13, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 70, 80 }; | ||
1672 | static const unsigned int sd_exponent[] = { /* use varies */ | ||
1673 | 1,10,100,1000,10000,100000,1000000,10000000,100000000,1000000000 }; | ||
1674 | |||
1672 | card.initialized = true; | 1675 | card.initialized = true; |
1673 | card.ocr = mmcinfo.ocr; | 1676 | card.ocr = mmcinfo.ocr; |
1674 | for(i=0; i<4; i++) | 1677 | for(i=0; i<4; i++) |
@@ -1707,22 +1710,22 @@ int sd_read_sectors(IF_MV2(int drive,) unsigned long start, int count, void* buf | |||
1707 | if (retval && (retval != MMC_ERROR_STATE_MISMATCH)) | 1710 | if (retval && (retval != MMC_ERROR_STATE_MISMATCH)) |
1708 | return retval; | 1711 | return retval; |
1709 | 1712 | ||
1710 | mmc_simple_cmd(&request, MMC_SET_BLOCKLEN, BLOCK_SIZE, RESPONSE_R1); | 1713 | mmc_simple_cmd(&request, MMC_SET_BLOCKLEN, SD_BLOCK_SIZE, RESPONSE_R1); |
1711 | if ((retval = mmc_unpack_r1(&request, &r1))) | 1714 | if ((retval = mmc_unpack_r1(&request, &r1))) |
1712 | return retval; | 1715 | return retval; |
1713 | 1716 | ||
1714 | if (sd2_0) | 1717 | if (sd2_0) |
1715 | { | 1718 | { |
1716 | mmc_send_cmd(&request, MMC_READ_MULTIPLE_BLOCK, start, | 1719 | mmc_send_cmd(&request, MMC_READ_MULTIPLE_BLOCK, start, |
1717 | count, BLOCK_SIZE, RESPONSE_R1, buf); | 1720 | count, SD_BLOCK_SIZE, RESPONSE_R1, buf); |
1718 | if ((retval = mmc_unpack_r1(&request, &r1))) | 1721 | if ((retval = mmc_unpack_r1(&request, &r1))) |
1719 | return retval; | 1722 | return retval; |
1720 | } | 1723 | } |
1721 | else | 1724 | else |
1722 | { | 1725 | { |
1723 | mmc_send_cmd(&request, MMC_READ_MULTIPLE_BLOCK, | 1726 | mmc_send_cmd(&request, MMC_READ_MULTIPLE_BLOCK, |
1724 | start * BLOCK_SIZE, count, | 1727 | start * SD_BLOCK_SIZE, count, |
1725 | BLOCK_SIZE, RESPONSE_R1, buf); | 1728 | SD_BLOCK_SIZE, RESPONSE_R1, buf); |
1726 | if ((retval = mmc_unpack_r1(&request, &r1))) | 1729 | if ((retval = mmc_unpack_r1(&request, &r1))) |
1727 | return retval; | 1730 | return retval; |
1728 | } | 1731 | } |
@@ -1757,14 +1760,14 @@ int sd_write_sectors(IF_MV2(int drive,) unsigned long start, int count, const vo | |||
1757 | if (retval && (retval != MMC_ERROR_STATE_MISMATCH)) | 1760 | if (retval && (retval != MMC_ERROR_STATE_MISMATCH)) |
1758 | return retval; | 1761 | return retval; |
1759 | 1762 | ||
1760 | mmc_simple_cmd(&request, MMC_SET_BLOCKLEN, BLOCK_SIZE, RESPONSE_R1); | 1763 | mmc_simple_cmd(&request, MMC_SET_BLOCKLEN, SD_BLOCK_SIZE, RESPONSE_R1); |
1761 | if ((retval = mmc_unpack_r1(&request, &r1))) | 1764 | if ((retval = mmc_unpack_r1(&request, &r1))) |
1762 | return retval; | 1765 | return retval; |
1763 | 1766 | ||
1764 | if (sd2_0) | 1767 | if (sd2_0) |
1765 | { | 1768 | { |
1766 | mmc_send_cmd(&request, MMC_WRITE_MULTIPLE_BLOCK, start, | 1769 | mmc_send_cmd(&request, MMC_WRITE_MULTIPLE_BLOCK, start, |
1767 | count, BLOCK_SIZE, RESPONSE_R1, | 1770 | count, SD_BLOCK_SIZE, RESPONSE_R1, |
1768 | (void*)buf); | 1771 | (void*)buf); |
1769 | if ((retval = mmc_unpack_r1(&request, &r1))) | 1772 | if ((retval = mmc_unpack_r1(&request, &r1))) |
1770 | return retval; | 1773 | return retval; |
@@ -1772,8 +1775,8 @@ int sd_write_sectors(IF_MV2(int drive,) unsigned long start, int count, const vo | |||
1772 | else | 1775 | else |
1773 | { | 1776 | { |
1774 | mmc_send_cmd(&request, MMC_WRITE_MULTIPLE_BLOCK, | 1777 | mmc_send_cmd(&request, MMC_WRITE_MULTIPLE_BLOCK, |
1775 | start * BLOCK_SIZE, count, | 1778 | start * SD_BLOCK_SIZE, count, |
1776 | BLOCK_SIZE, RESPONSE_R1, (void*)buf); | 1779 | SD_BLOCK_SIZE, RESPONSE_R1, (void*)buf); |
1777 | if ((retval = mmc_unpack_r1(&request, &r1))) | 1780 | if ((retval = mmc_unpack_r1(&request, &r1))) |
1778 | return retval; | 1781 | return retval; |
1779 | } | 1782 | } |