diff --git a/firmware/target/arm/as3525/sansa-fuzev2/backlight-fuzev2.c b/firmware/target/arm/as3525/sansa-fuzev2/backlight-fuzev2.c
index 29e1450..1c4afb0 100644
--- a/firmware/target/arm/as3525/sansa-fuzev2/backlight-fuzev2.c
+++ b/firmware/target/arm/as3525/sansa-fuzev2/backlight-fuzev2.c
@@ -59,14 +59,18 @@ void _backlight_off(void)

void _buttonlight_on(void)
{
+#if 0
GPIOB_DIR |= 1<<5;
GPIOB_PIN(5) = (1<<5);
buttonlight_is_on = 1;
+#endif
}

void _buttonlight_off(void)
{
+#if 0
GPIOB_PIN(5) = 0;
GPIOB_DIR &= ~(1<<5);
buttonlight_is_on = 0;
+#endif
}
diff --git a/firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c b/firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c
index 060933d..51d3d53 100644
--- a/firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c
+++ b/firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c
@@ -255,7 +255,7 @@ int button_read_device(void)
btn |= BUTTON_SELECT;
if (GPIOC_PIN(5) & 1<<5)
btn |= BUTTON_RIGHT;
- if (GPIOB_PIN(1) & 1<<1)
+ if (!(GPIOB_PIN(1) & 1<<1))
btn |= BUTTON_HOME;
if (gpiod6 & 1<<6)
{ /* power/hold is on the same pin. we know it's hold if the bit isn't
diff --git a/firmware/target/arm/as3525/sd-as3525v2.c b/firmware/target/arm/as3525/sd-as3525v2.c
index 85913ec..0393d49 100644
--- a/firmware/target/arm/as3525/sd-as3525v2.c
+++ b/firmware/target/arm/as3525/sd-as3525v2.c
@@ -327,6 +327,8 @@
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 const int model = 1;
+
static tCardInfo card_info[NUM_DRIVES];

/* for compatibility */
@@ -397,10 +399,19 @@ static bool send_cmd(const int drive, const int cmd, const int arg, const int fl
#if defined(HAVE_MULTIDRIVE)
if(sd_present(SD_SLOT_AS3525))
GPIOB_PIN(5) = (1-drive) << 5;
+#elif defined(SANSA_FUZEV2)
+ if (model == 1)
+ GPIOB_PIN(5) = (1-drive) << 5;
#endif

MCI_ARGUMENT = arg;

+ int card_no;
+ if (model == 1)
+ card_no = 1 << 16;
+ else
+ card_no = CMD_CARD_NO(drive);
+
/* Construct MCI_COMMAND */
MCI_COMMAND =
/*b5:0*/ cmd
@@ -414,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();
@@ -480,6 +491,10 @@ static int sd_init_card(const int drive)

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

/* 100 - 400kHz clock required for Identification Mode */
/* Start of Card Identification Mode ************************************/
@@ -488,6 +503,8 @@ static int sd_init_card(const int drive)
if(!send_cmd(drive, SD_GO_IDLE_STATE, 0, MCI_NO_RESP, NULL))
return -1;
mci_delay();
+ mci_delay();
+ mci_delay();

/* CMD8 Check for v2 sd card. Must be sent before using ACMD41
Non v2 cards will not respond to this command*/
@@ -509,7 +526,10 @@ static int sd_init_card(const int drive)
/* ACMD41 For v2 cards set HCS bit[30] & send host voltage range to all */
if(!send_cmd(drive, SD_APP_OP_COND, (0x00FF8000 | (sd_v2 ? 1<<30 : 0)),
MCI_RESP, &card_info[drive].ocr))
+ {
+ panicf("ERROR OPCOND 0x%x", cmd_error);
return -3;
+ }
} while(!(card_info[drive].ocr & (1<<31)) );

/* CMD2 send CID */
@@ -528,6 +548,7 @@ static int sd_init_card(const int drive)
#endif
/* End of Card Identification Mode ************************************/

+#if 0
/* Attempt to switch cards to HS timings, non HS cards just ignore this */
/* CMD7 w/rca: Select card to put it in TRAN state */
if(!send_cmd(drive, SD_SELECT_CARD, card_info[drive].rca, MCI_NO_RESP, NULL))
@@ -545,11 +566,14 @@ static int sd_init_card(const int drive)
/* CMD7 w/rca=0: Deselect card to put it in STBY state */
if(!send_cmd(drive, SD_DESELECT_CARD, 0, MCI_NO_RESP, NULL))
return -10;
-
+#endif
/* CMD9 send CSD */
if(!send_cmd(drive, SD_SEND_CSD, card_info[drive].rca,
MCI_RESP|MCI_LONG_RESP, card_info[drive].csd))
+ {
+ panicf("ERROR CSD 0x%x", cmd_error);
return -11;
+ }

sd_parse_csd(&card_info[drive]);

@@ -563,7 +587,7 @@ static int sd_init_card(const int drive)
if(!send_cmd(drive, SD_SELECT_CARD, card_info[drive].rca, MCI_NO_RESP, NULL))
return -12;

-#ifndef BOOTLOADER
+#if 0 //ndef BOOTLOADER
/* Switch to to 4 bit widebus mode */
if(sd_wait_for_tran_state(drive) < 0)
return -13;
@@ -682,19 +706,35 @@ static void init_controller(void)
{
int hcon_numcards = ((MCI_HCON>>1) & 0x1F) + 1;
int card_mask = (1 << hcon_numcards) - 1;
+ int pwr_mask;
+
+ if (model == 1)
+ {
+ pwr_mask = 1 << 1;
+ //card_mask |= card_mask << 16; // LP
+ }
+ else
+ pwr_mask = card_mask;

- MCI_PWREN &= ~card_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 &= ~pwr_mask; /* power off all cards */
+ mci_delay();
+ mci_delay();

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

MCI_CTRL |= CTRL_RESET;
while(MCI_CTRL & CTRL_RESET)
;

+#if 0
+ MCI_CLKSRC = 0x00; /* All CLK_SRC_CRD set to 0*/
+ MCI_CLKDIV = 0x00; /* CLK_DIV_0 : bits 7:0 */
+#endif
+
MCI_RAW_STATUS = 0xffffffff; /* Clear all MCI Interrupts */

MCI_TMOUT = 0xffffffff; /* data b31:8, response b7:0 */
@@ -756,8 +796,8 @@ int sd_init(void)
GPIOA_IE |= EXT_SD_BITS;

/* Configure XPD for SD-MCI interface */
- CCU_IO |= (1<<2);
#endif
+ CCU_IO |= (1<<2);

VIC_INT_ENABLE = INTERRUPT_NAND;