mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-08 12:45:26 -05:00
Support new Fuzev2 revisions (fuzev2_variant == 1)
- Revert BUTTON_HOME - Modifications to SD driver (µSD not working yet) TODO: µSD and FM radio git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27492 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
a083b9a9e0
commit
e44b65c806
5 changed files with 61 additions and 26 deletions
|
|
@ -268,11 +268,15 @@ bool __dbg_hw_info(void)
|
|||
{
|
||||
while(1)
|
||||
{
|
||||
#ifdef SANSA_C200V2
|
||||
#if defined(SANSA_C200V2) || defined(SANSA_FUZEV2)
|
||||
lcd_clear_display();
|
||||
line = 0;
|
||||
lcd_puts(0, line++, "[Submodel:]");
|
||||
#if defined(SANSA_C200V2)
|
||||
lcd_putsf(0, line++, "C200v2 variant %d", c200v2_variant);
|
||||
#elif defined(SANSA_FUZEV2)
|
||||
lcd_putsf(0, line++, "Fuzev2 variant %d", fuzev2_variant);
|
||||
#endif
|
||||
lcd_update();
|
||||
int btn = button_get_w_tmo(HZ/10);
|
||||
if(btn == (DEBUG_CANCEL|BUTTON_REL))
|
||||
|
|
|
|||
|
|
@ -257,6 +257,9 @@ int button_read_device(void)
|
|||
btn |= BUTTON_RIGHT;
|
||||
if (GPIOB_PIN(1) & 1<<1)
|
||||
btn |= BUTTON_HOME;
|
||||
if (fuzev2_variant == 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
|
||||
* set now anymore */
|
||||
|
|
|
|||
|
|
@ -394,6 +394,8 @@ static inline bool card_detect_target(void)
|
|||
static bool send_cmd(const int drive, const int cmd, const int arg, const int flags,
|
||||
unsigned long *response)
|
||||
{
|
||||
int card_no;
|
||||
|
||||
#if defined(HAVE_MULTIDRIVE)
|
||||
if(sd_present(SD_SLOT_AS3525))
|
||||
GPIOB_PIN(5) = (1-drive) << 5;
|
||||
|
|
@ -401,6 +403,13 @@ static bool send_cmd(const int drive, const int cmd, const int arg, const int fl
|
|||
|
||||
MCI_ARGUMENT = arg;
|
||||
|
||||
#ifdef SANSA_FUZEV2
|
||||
if (fuzev2_variant == 1)
|
||||
card_no = 1 << 16;
|
||||
else
|
||||
#endif
|
||||
card_no = CMD_CARD_NO(drive);
|
||||
|
||||
/* Construct MCI_COMMAND */
|
||||
MCI_COMMAND =
|
||||
/*b5:0*/ cmd
|
||||
|
|
@ -414,7 +423,7 @@ 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 */
|
||||
|
|
@ -580,14 +589,27 @@ static int sd_init_card(const int drive)
|
|||
/* ACMD42 */
|
||||
if(!send_cmd(drive, SD_SET_CLR_CARD_DETECT, 0, MCI_NO_RESP, NULL))
|
||||
return -17;
|
||||
|
||||
/* Now that card is widebus make controller aware */
|
||||
MCI_CTYPE |= (1<<drive);
|
||||
#ifdef SANSA_FUZEV2
|
||||
if (fuzev2_variant == 1)
|
||||
MCI_CTYPE |= 1<<1;
|
||||
else
|
||||
#endif
|
||||
MCI_CTYPE |= (1<<drive);
|
||||
|
||||
#endif /* ! BOOTLOADER */
|
||||
|
||||
/* Set low power mode */
|
||||
#ifdef SANSA_FUZEV2
|
||||
if (fuzev2_variant == 1)
|
||||
MCI_CLKENA |= 1<<16;
|
||||
else
|
||||
#endif
|
||||
MCI_CLKENA |= 1<<(drive + 16);
|
||||
|
||||
card_info[drive].initialized = 1;
|
||||
|
||||
MCI_CLKENA |= 1<<(drive + 16); /* Set low power mode */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -682,14 +704,17 @@ static void init_controller(void)
|
|||
{
|
||||
int hcon_numcards = ((MCI_HCON>>1) & 0x1F) + 1;
|
||||
int card_mask = (1 << hcon_numcards) - 1;
|
||||
int pwr_mask;
|
||||
|
||||
MCI_PWREN &= ~card_mask; /* power off all cards */
|
||||
#ifdef SANSA_FUZEV2
|
||||
if (fuzev2_variant == 1)
|
||||
pwr_mask = 1 << 1;
|
||||
else
|
||||
#endif
|
||||
pwr_mask = card_mask;
|
||||
|
||||
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_delay();
|
||||
MCI_PWREN &= ~pwr_mask; /* power off all cards */
|
||||
MCI_PWREN = pwr_mask; /* power up cards */
|
||||
|
||||
MCI_CTRL |= CTRL_RESET;
|
||||
while(MCI_CTRL & CTRL_RESET)
|
||||
|
|
@ -745,6 +770,7 @@ int sd_init(void)
|
|||
|
||||
wakeup_init(&transfer_completion_signal);
|
||||
wakeup_init(&command_completion_signal);
|
||||
|
||||
#ifdef HAVE_MULTIDRIVE
|
||||
/* clear previous irq */
|
||||
GPIOA_IC = EXT_SD_BITS;
|
||||
|
|
@ -754,7 +780,9 @@ int sd_init(void)
|
|||
GPIOA_IBE |= EXT_SD_BITS;
|
||||
/* enable the card detect interrupt */
|
||||
GPIOA_IE |= EXT_SD_BITS;
|
||||
#endif /* HAVE_MULTIDRIVE */
|
||||
|
||||
#ifndef SANSA_CLIPV2
|
||||
/* Configure XPD for SD-MCI interface */
|
||||
CCU_IO |= (1<<2);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -173,9 +173,7 @@ void fiq_handler(void)
|
|||
}
|
||||
|
||||
#if defined(SANSA_C200V2)
|
||||
#include "dbop-as3525.h"
|
||||
|
||||
int c200v2_variant = 0;
|
||||
int c200v2_variant;
|
||||
|
||||
static void check_model_variant(void)
|
||||
{
|
||||
|
|
@ -188,24 +186,22 @@ static void check_model_variant(void)
|
|||
* to charge the input capacitance */
|
||||
for (i=0; i<1000; i++) asm volatile ("nop\n");
|
||||
/* read the pullup/pulldown value on A7 to determine the variant */
|
||||
if (GPIOA_PIN(7) == 0) {
|
||||
/*
|
||||
* Backlight on A7.
|
||||
*/
|
||||
c200v2_variant = 1;
|
||||
} else {
|
||||
/*
|
||||
* Backlight on A5.
|
||||
*/
|
||||
c200v2_variant = 0;
|
||||
}
|
||||
c200v2_variant = !GPIOA_PIN(7);
|
||||
GPIOA_DIR = saved_dir;
|
||||
}
|
||||
#elif defined(SANSA_FUZEV2)
|
||||
int fuzev2_variant;
|
||||
|
||||
static void check_model_variant(void)
|
||||
{
|
||||
GPIOB_DIR &= ~(1<<5);
|
||||
fuzev2_variant = !!GPIOB_PIN(5);
|
||||
}
|
||||
#else
|
||||
static inline void check_model_variant(void)
|
||||
{
|
||||
}
|
||||
#endif /* SANSA_C200V2*/
|
||||
#endif /* model selection */
|
||||
|
||||
void system_init(void)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -46,6 +46,10 @@
|
|||
? (((uintptr_t)(a)) - IRAM_ORIG) \
|
||||
: ((uintptr_t)(a))))
|
||||
|
||||
#ifdef SANSA_FUZEV2
|
||||
extern int fuzev2_variant;
|
||||
#endif
|
||||
|
||||
#ifdef SANSA_C200V2
|
||||
/* 0: Backlight on A5, 1: Backlight on A7 */
|
||||
extern int c200v2_variant;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue