diff --git a/firmware/target/arm/as3525/sd-as3525v2.c b/firmware/target/arm/as3525/sd-as3525v2.c
index 9756d9e..4b556e8 100644
--- a/firmware/target/arm/as3525/sd-as3525v2.c
+++ b/firmware/target/arm/as3525/sd-as3525v2.c
@@ -64,6 +64,10 @@
#define MCI_RESP (1<<0)
#define MCI_LONG_RESP (1<<1)

+#ifdef SANSA_FUZEV2
+int model = 1;
+#endif
+
/* controller registers */
#define SD_BASE 0xC6070000

@@ -327,7 +331,6 @@
static unsigned char aligned_buffer[UNALIGNED_NUM_SECTORS* SD_BLOCK_SIZE] __attribute__((aligned(32))); /* align on cache line size */
static unsigned char *uncached_buffer = AS3525_UNCACHED_ADDR(&aligned_buffer[0]);

-static void init_controller(void);
static int sd_wait_for_tran_state(const int drive);

static tCardInfo card_info[NUM_DRIVES];
@@ -405,6 +408,11 @@ static bool send_cmd(const int drive, const int cmd, const int arg, const int fl
MCI_ARGUMENT = arg;

/* Construct MCI_COMMAND */
+ int card_no = CMD_CARD_NO(drive);
+#ifdef SANSA_FUZEV2
+ if (model == 1)
+ card_no = 1<<16;
+#endif
MCI_COMMAND =
/*b5:0*/ cmd
/*b6 */ | ((flags & MCI_RESP) ? CMD_RESP_EXP_BIT: 0)
@@ -417,13 +425,13 @@ static bool send_cmd(const int drive, const int cmd, const int arg, const int fl
/*b13 */ | (TRANSFER_CMD ? CMD_WAIT_PRV_DAT_BIT: 0)
/*b14 | CMD_ABRT_CMD_BIT unused */
/*b15 | CMD_SEND_INIT_BIT unused */
- /*b20:16 */ | CMD_CARD_NO(drive)
+ /*b20:16 */ | card_no
/*b21 | CMD_SEND_CLK_ONLY unused */
/*b22 | CMD_READ_CEATA unused */
/*b23 | CMD_CCS_EXPECTED unused */
/*b31 */ | CMD_DONE_BIT;

-#ifdef SANSA_FUZEV2
+#if 0 //def SANSA_FUZEV2
extern int buttonlight_is_on;
if(buttonlight_is_on)
_buttonlight_on();
@@ -436,7 +444,10 @@ static bool send_cmd(const int drive, const int cmd, const int arg, const int fl
if(flags & MCI_RESP)
{
if(cmd_error & (MCI_INT_RCRC | MCI_INT_RTO))
+ {
+ panicf("error 0x%x", cmd_error);
return false;
+ }

if(flags & MCI_LONG_RESP)
{
@@ -457,6 +468,8 @@ static int sd_init_card(const int drive)
long init_timeout;
bool sd_v2 = false;

+ GPIOB_DIR |= 1<<5;
+
/* assume 24 MHz clock / 60 = 400 kHz */
MCI_CLKDIV = (MCI_CLKDIV & ~(0xFF)) | 0x3C; /* CLK_DIV_0 : bits 7:0 */

@@ -661,13 +674,18 @@ static void init_controller(void)
{
int hcon_numcards = ((MCI_HCON>>1) & 0x1F) + 1;
int card_mask = (1 << hcon_numcards) - 1;
+ int pwr_mask = card_mask;
+#ifdef SANSA_FUZEV2
+ if (model == 1)
+ pwr_mask = 2;
+#endif

- MCI_PWREN &= ~card_mask; /* power off all cards */
+ MCI_PWREN &= ~pwr_mask; /* power off all cards */

MCI_CLKSRC = 0x00; /* All CLK_SRC_CRD set to 0*/
MCI_CLKDIV = 0x00; /* CLK_DIV_0 : bits 7:0 */

- MCI_PWREN |= card_mask; /* power up cards */
+ MCI_PWREN |= pwr_mask; /* power up cards */
mci_delay();

MCI_CTRL |= CTRL_RESET;