diff options
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/target/arm/as3525/debug-as3525.c | 25 | ||||
-rw-r--r-- | firmware/target/arm/as3525/sd-as3525.c | 26 | ||||
-rw-r--r-- | firmware/target/arm/as3525/sd-as3525v2.c | 11 | ||||
-rw-r--r-- | firmware/target/arm/as3525/system-target.h | 9 |
4 files changed, 29 insertions, 42 deletions
diff --git a/firmware/target/arm/as3525/debug-as3525.c b/firmware/target/arm/as3525/debug-as3525.c index a1e69834dd..24cee12cf4 100644 --- a/firmware/target/arm/as3525/debug-as3525.c +++ b/firmware/target/arm/as3525/debug-as3525.c | |||
@@ -62,8 +62,6 @@ | |||
62 | #define MCI_NAND *((volatile unsigned long *)(NAND_FLASH_BASE + 0x04)) | 62 | #define MCI_NAND *((volatile unsigned long *)(NAND_FLASH_BASE + 0x04)) |
63 | #define MCI_SD *((volatile unsigned long *)(SD_MCI_BASE + 0x04)) | 63 | #define MCI_SD *((volatile unsigned long *)(SD_MCI_BASE + 0x04)) |
64 | 64 | ||
65 | extern bool sd_enabled; | ||
66 | |||
67 | #if defined(SANSA_FUZE) || defined(SANSA_E200V2) || defined(SANSA_C200V2) | 65 | #if defined(SANSA_FUZE) || defined(SANSA_E200V2) || defined(SANSA_C200V2) |
68 | #define DEBUG_DBOP | 66 | #define DEBUG_DBOP |
69 | #include "dbop-as3525.h" | 67 | #include "dbop-as3525.h" |
@@ -253,13 +251,6 @@ static int calc_freq(int clk) | |||
253 | bool dbg_hw_info(void) | 251 | bool dbg_hw_info(void) |
254 | { | 252 | { |
255 | int line; | 253 | int line; |
256 | #if CONFIG_CPU == AS3525 | ||
257 | int last_nand = 0; | ||
258 | #ifdef HAVE_MULTIDRIVE | ||
259 | int last_sd = 0; | ||
260 | #endif | ||
261 | #endif /* CONFIG_CPU == AS3525 */ | ||
262 | |||
263 | lcd_clear_display(); | 254 | lcd_clear_display(); |
264 | lcd_setfont(FONT_SYSFIXED); | 255 | lcd_setfont(FONT_SYSFIXED); |
265 | 256 | ||
@@ -334,25 +325,17 @@ bool dbg_hw_info(void) | |||
334 | lcd_putsf(0, line++, "I2SO: %s %3dMHz", (CGU_AUDIO & (1<<11)) ? | 325 | lcd_putsf(0, line++, "I2SO: %s %3dMHz", (CGU_AUDIO & (1<<11)) ? |
335 | "on " : "off", calc_freq(CLK_I2SO)/1000000); | 326 | "on " : "off", calc_freq(CLK_I2SO)/1000000); |
336 | #if CONFIG_CPU == AS3525 | 327 | #if CONFIG_CPU == AS3525 |
337 | /* If disabled, enable SD cards so we can read the registers */ | 328 | struct ams_sd_debug_info dbg; |
338 | if(sd_enabled == false) | 329 | ams_sd_get_debug_info(&dbg); |
339 | { | ||
340 | sd_enable(true); | ||
341 | last_nand = MCI_NAND; | ||
342 | #ifdef HAVE_MULTIDRIVE | ||
343 | last_sd = MCI_SD; | ||
344 | #endif | ||
345 | sd_enable(false); | ||
346 | } | ||
347 | 330 | ||
348 | lcd_putsf(0, line++, "SD :%3dMHz %3dMHz", | 331 | lcd_putsf(0, line++, "SD :%3dMHz %3dMHz", |
349 | ((AS3525_IDE_FREQ/ 1000000) / | 332 | ((AS3525_IDE_FREQ/ 1000000) / |
350 | ((last_nand & MCI_CLOCK_BYPASS)? 1:(((last_nand & 0xff)+1) * 2))), | 333 | ((dbg.mci_nand & MCI_CLOCK_BYPASS)? 1:(((dbg.mci_nand & 0xff)+1) * 2))), |
351 | calc_freq(CLK_SD_MCLK_NAND)/1000000); | 334 | calc_freq(CLK_SD_MCLK_NAND)/1000000); |
352 | #ifdef HAVE_MULTIDRIVE | 335 | #ifdef HAVE_MULTIDRIVE |
353 | lcd_putsf(0, line++, "uSD :%3dMHz %3dMHz", | 336 | lcd_putsf(0, line++, "uSD :%3dMHz %3dMHz", |
354 | ((AS3525_PCLK_FREQ/ 1000000) / | 337 | ((AS3525_PCLK_FREQ/ 1000000) / |
355 | ((last_sd & MCI_CLOCK_BYPASS) ? 1: (((last_sd & 0xff) + 1) * 2))), | 338 | ((dbg.mci_sd & MCI_CLOCK_BYPASS) ? 1: (((dbg.mci_sd & 0xff) + 1) * 2))), |
356 | calc_freq(CLK_SD_MCLK_MSD)/1000000); | 339 | calc_freq(CLK_SD_MCLK_MSD)/1000000); |
357 | #endif | 340 | #endif |
358 | #endif /* CONFIG_CPU == AS3525 */ | 341 | #endif /* CONFIG_CPU == AS3525 */ |
diff --git a/firmware/target/arm/as3525/sd-as3525.c b/firmware/target/arm/as3525/sd-as3525.c index d6c6654319..494a76a782 100644 --- a/firmware/target/arm/as3525/sd-as3525.c +++ b/firmware/target/arm/as3525/sd-as3525.c | |||
@@ -126,7 +126,6 @@ static long last_disk_activity = -1; | |||
126 | static long next_yield = 0; | 126 | static long next_yield = 0; |
127 | 127 | ||
128 | static struct mutex sd_mtx; | 128 | static struct mutex sd_mtx; |
129 | bool sd_enabled = false; | ||
130 | 129 | ||
131 | #if defined(HAVE_MULTIDRIVE) | 130 | #if defined(HAVE_MULTIDRIVE) |
132 | static bool hs_card = false; | 131 | static bool hs_card = false; |
@@ -154,6 +153,7 @@ static void enable_controller(bool on) | |||
154 | #if defined(HAVE_HOTSWAP) && defined (HAVE_ADJUSTABLE_CPU_VOLTAGE) | 153 | #if defined(HAVE_HOTSWAP) && defined (HAVE_ADJUSTABLE_CPU_VOLTAGE) |
155 | static bool cpu_boosted = false; | 154 | static bool cpu_boosted = false; |
156 | #endif | 155 | #endif |
156 | static bool sd_enabled = true; /* force action on first call in sd_init() */ | ||
157 | 157 | ||
158 | if (sd_enabled == on) | 158 | if (sd_enabled == on) |
159 | return; /* nothing to do */ | 159 | return; /* nothing to do */ |
@@ -540,9 +540,7 @@ int sd_init(void) | |||
540 | /* init mutex */ | 540 | /* init mutex */ |
541 | mutex_init(&sd_mtx); | 541 | mutex_init(&sd_mtx); |
542 | 542 | ||
543 | sd_enabled = true; /* force action on next call */ | ||
544 | enable_controller(false); | 543 | enable_controller(false); |
545 | |||
546 | return 0; | 544 | return 0; |
547 | } | 545 | } |
548 | 546 | ||
@@ -905,13 +903,6 @@ long sd_last_disk_activity(void) | |||
905 | return last_disk_activity; | 903 | return last_disk_activity; |
906 | } | 904 | } |
907 | 905 | ||
908 | void sd_enable(bool on) | ||
909 | { | ||
910 | mutex_lock(&sd_mtx); | ||
911 | enable_controller(on); | ||
912 | mutex_unlock(&sd_mtx); | ||
913 | } | ||
914 | |||
915 | tCardInfo *card_get_info_target(int card_no) | 906 | tCardInfo *card_get_info_target(int card_no) |
916 | { | 907 | { |
917 | return &card_info[card_no]; | 908 | return &card_info[card_no]; |
@@ -925,6 +916,21 @@ int sd_num_drives(int first_drive) | |||
925 | } | 916 | } |
926 | #endif /* CONFIG_STORAGE_MULTI */ | 917 | #endif /* CONFIG_STORAGE_MULTI */ |
927 | 918 | ||
919 | void ams_sd_get_debug_info(struct ams_sd_debug_info *info) | ||
920 | { | ||
921 | #define MCI_NAND *((volatile unsigned long *)(NAND_FLASH_BASE + 0x04)) | ||
922 | #define MCI_SD *((volatile unsigned long *)(SD_MCI_BASE + 0x04)) | ||
923 | |||
924 | mutex_lock(&sd_mtx); | ||
925 | enable_controller(true); /* must be on to read regs */ | ||
926 | info->mci_nand = MCI_NAND; | ||
927 | #ifdef HAVE_MULTIDRIVE | ||
928 | info->mci_sd = MCI_SD; | ||
929 | #endif | ||
930 | enable_controller(false); | ||
931 | mutex_unlock(&sd_mtx); | ||
932 | } | ||
933 | |||
928 | int sd_event(long id, intptr_t data) | 934 | int sd_event(long id, intptr_t data) |
929 | { | 935 | { |
930 | int rc = 0; | 936 | int rc = 0; |
diff --git a/firmware/target/arm/as3525/sd-as3525v2.c b/firmware/target/arm/as3525/sd-as3525v2.c index f78345577c..b512cc2ea4 100644 --- a/firmware/target/arm/as3525/sd-as3525v2.c +++ b/firmware/target/arm/as3525/sd-as3525v2.c | |||
@@ -323,9 +323,6 @@ static int sd_first_drive = 0; | |||
323 | /* for compatibility */ | 323 | /* for compatibility */ |
324 | static long last_disk_activity = -1; | 324 | static long last_disk_activity = -1; |
325 | static struct mutex sd_mtx SHAREDBSS_ATTR; | 325 | static struct mutex sd_mtx SHAREDBSS_ATTR; |
326 | #ifndef BOOTLOADER | ||
327 | bool sd_enabled = false; | ||
328 | #endif | ||
329 | 326 | ||
330 | static struct semaphore transfer_completion_signal; | 327 | static struct semaphore transfer_completion_signal; |
331 | static struct semaphore command_completion_signal; | 328 | static struct semaphore command_completion_signal; |
@@ -675,7 +672,6 @@ int sd_init(void) | |||
675 | return ret; | 672 | return ret; |
676 | 673 | ||
677 | #ifndef BOOTLOADER | 674 | #ifndef BOOTLOADER |
678 | sd_enabled = true; | ||
679 | enable_controller(false); | 675 | enable_controller(false); |
680 | #endif | 676 | #endif |
681 | return 0; | 677 | return 0; |
@@ -879,13 +875,6 @@ long sd_last_disk_activity(void) | |||
879 | { | 875 | { |
880 | return last_disk_activity; | 876 | return last_disk_activity; |
881 | } | 877 | } |
882 | |||
883 | void sd_enable(bool on) | ||
884 | { | ||
885 | mutex_lock(&sd_mtx); | ||
886 | enable_controller(on); | ||
887 | mutex_unlock(&sd_mtx); | ||
888 | } | ||
889 | #endif /* BOOTLOADER */ | 878 | #endif /* BOOTLOADER */ |
890 | 879 | ||
891 | tCardInfo *card_get_info_target(int card_no) | 880 | tCardInfo *card_get_info_target(int card_no) |
diff --git a/firmware/target/arm/as3525/system-target.h b/firmware/target/arm/as3525/system-target.h index 4fbbb46d5d..aca30e52e1 100644 --- a/firmware/target/arm/as3525/system-target.h +++ b/firmware/target/arm/as3525/system-target.h | |||
@@ -89,4 +89,13 @@ static inline void cpu_boost_unlock(void) | |||
89 | } | 89 | } |
90 | #endif /* HAVE_ADJUSTABLE_CPU_FREQ */ | 90 | #endif /* HAVE_ADJUSTABLE_CPU_FREQ */ |
91 | 91 | ||
92 | struct ams_sd_debug_info | ||
93 | { | ||
94 | unsigned long mci_nand; | ||
95 | unsigned long mci_sd; | ||
96 | }; | ||
97 | |||
98 | void ams_sd_get_debug_info(struct ams_sd_debug_info *info); | ||
99 | |||
100 | |||
92 | #endif /* SYSTEM_TARGET_H */ | 101 | #endif /* SYSTEM_TARGET_H */ |