diff options
Diffstat (limited to 'firmware/target/mips/ingenic_jz47xx/ata-sd-jz4740.c')
-rw-r--r-- | firmware/target/mips/ingenic_jz47xx/ata-sd-jz4740.c | 16 |
1 files changed, 5 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 3bb9a27007..0b31e8e74d 100644 --- a/firmware/target/mips/ingenic_jz47xx/ata-sd-jz4740.c +++ b/firmware/target/mips/ingenic_jz47xx/ata-sd-jz4740.c | |||
@@ -38,9 +38,7 @@ static struct wakeup sd_wakeup; | |||
38 | 38 | ||
39 | #define DEBUG(x...) logf(x); | 39 | #define DEBUG(x...) logf(x); |
40 | 40 | ||
41 | #ifdef MMC_CD_PIN | ||
42 | #define MMC_INSERT_STATUS() __gpio_get_pin(MMC_CD_PIN) | 41 | #define MMC_INSERT_STATUS() __gpio_get_pin(MMC_CD_PIN) |
43 | #endif | ||
44 | 42 | ||
45 | #define MMC_RESET() __msc_reset() | 43 | #define MMC_RESET() __msc_reset() |
46 | 44 | ||
@@ -367,7 +365,7 @@ struct mmc_request | |||
367 | 365 | ||
368 | static int use_4bit; /* Use 4-bit data bus */ | 366 | static int use_4bit; /* Use 4-bit data bus */ |
369 | static int num_6; | 367 | static int num_6; |
370 | static int sd2_0; | 368 | static int sd2_0 = 1; |
371 | 369 | ||
372 | /* Stop the MMC clock and wait while it happens */ | 370 | /* Stop the MMC clock and wait while it happens */ |
373 | static inline int jz_mmc_stop_clock(void) | 371 | static inline int jz_mmc_stop_clock(void) |
@@ -766,7 +764,7 @@ static int jz_mmc_exec_cmd(struct mmc_request *request) | |||
766 | jz_mmc_stop_clock(); | 764 | jz_mmc_stop_clock(); |
767 | 765 | ||
768 | /* mask all interrupts */ | 766 | /* mask all interrupts */ |
769 | //REG_MSC_IMASK = 0xffff; | 767 | REG_MSC_IMASK = 0xffff; |
770 | /* clear status */ | 768 | /* clear status */ |
771 | REG_MSC_IREG = 0xffff; | 769 | REG_MSC_IREG = 0xffff; |
772 | /*open interrupt */ | 770 | /*open interrupt */ |
@@ -812,7 +810,6 @@ static int jz_mmc_exec_cmd(struct mmc_request *request) | |||
812 | case 6: | 810 | case 6: |
813 | if (num_6 < 2) | 811 | if (num_6 < 2) |
814 | { | 812 | { |
815 | |||
816 | #if defined(MMC_DMA_ENABLE) | 813 | #if defined(MMC_DMA_ENABLE) |
817 | cmdat |= | 814 | cmdat |= |
818 | MSC_CMDAT_DATA_EN | MSC_CMDAT_READ | | 815 | MSC_CMDAT_DATA_EN | MSC_CMDAT_READ | |
@@ -992,10 +989,7 @@ static int jz_mmc_exec_cmd(struct mmc_request *request) | |||
992 | ********************************************************************************************************************/ | 989 | ********************************************************************************************************************/ |
993 | static int jz_mmc_chkcard(void) | 990 | static int jz_mmc_chkcard(void) |
994 | { | 991 | { |
995 | if (MMC_INSERT_STATUS() == 0) | 992 | return (MMC_INSERT_STATUS() == 0 ? 1 : 0); |
996 | return 1; /* insert entirely */ | ||
997 | else | ||
998 | return 0; /* not insert entirely */ | ||
999 | } | 993 | } |
1000 | 994 | ||
1001 | #if MMC_DMA_INTERRUPT | 995 | #if MMC_DMA_INTERRUPT |
@@ -1044,13 +1038,13 @@ void MSC(void) | |||
1044 | static void jz_mmc_hardware_init(void) | 1038 | static void jz_mmc_hardware_init(void) |
1045 | { | 1039 | { |
1046 | mmc_init_gpio(); /* init GPIO */ | 1040 | mmc_init_gpio(); /* init GPIO */ |
1041 | __cpm_start_msc(); /* enable mmc clock */ | ||
1047 | #ifdef MMC_POWER_ON | 1042 | #ifdef MMC_POWER_ON |
1048 | MMC_POWER_ON(); /* turn on power of card */ | 1043 | MMC_POWER_ON(); /* turn on power of card */ |
1049 | #endif | 1044 | #endif |
1050 | MMC_RESET(); /* reset mmc/sd controller */ | 1045 | MMC_RESET(); /* reset mmc/sd controller */ |
1051 | MMC_IRQ_MASK(); /* mask all IRQs */ | 1046 | MMC_IRQ_MASK(); /* mask all IRQs */ |
1052 | jz_mmc_stop_clock(); /* stop MMC/SD clock */ | 1047 | jz_mmc_stop_clock(); /* stop MMC/SD clock */ |
1053 | __cpm_start_msc(); | ||
1054 | #ifdef MMC_DMA_ENABLE | 1048 | #ifdef MMC_DMA_ENABLE |
1055 | // __cpm_start_dmac(); | 1049 | // __cpm_start_dmac(); |
1056 | // __dmac_enable_module(); | 1050 | // __dmac_enable_module(); |
@@ -1101,7 +1095,7 @@ int _sd_init(void) | |||
1101 | 1095 | ||
1102 | bool card_detect_target(void) | 1096 | bool card_detect_target(void) |
1103 | { | 1097 | { |
1104 | return jz_mmc_chkcard() == 1; | 1098 | return (jz_mmc_chkcard() == 1); |
1105 | } | 1099 | } |
1106 | 1100 | ||
1107 | #ifdef HAVE_HOTSWAP | 1101 | #ifdef HAVE_HOTSWAP |