mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-09 13:12:37 -05:00
imx233: add support for sd/mmc probing
zenxfi2: add support for internal storage on the SD version The code can now skip devices marked as PROBE if they fail to init, thus making it possible to handle various kinds of internal storages. The current code probably doesn't interplay nicely since it acquires pins and never release them so it will probably break NAND code when it's ready but NAND code is not ready yet anyway. Change-Id: I4cb962de4215661e521743a3f511445dbbf28673
This commit is contained in:
parent
f982ea6398
commit
1f4f7369ee
2 changed files with 26 additions and 2 deletions
|
|
@ -132,7 +132,7 @@
|
||||||
|
|
||||||
/* define this if the flash memory uses the SecureDigital Memory Card protocol */
|
/* define this if the flash memory uses the SecureDigital Memory Card protocol */
|
||||||
#define CONFIG_STORAGE (/*STORAGE_NAND |*/ STORAGE_SD)
|
#define CONFIG_STORAGE (/*STORAGE_NAND |*/ STORAGE_SD)
|
||||||
#define NUM_DRIVES 1
|
#define NUM_DRIVES 2
|
||||||
#define HAVE_MULTIDRIVE
|
#define HAVE_MULTIDRIVE
|
||||||
#define HAVE_MULTIVOLUME
|
#define HAVE_MULTIVOLUME
|
||||||
#define HAVE_HOTSWAP_STORAGE_AS_MAIN
|
#define HAVE_HOTSWAP_STORAGE_AS_MAIN
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,7 @@ struct sdmmc_config_t
|
||||||
#define WINDOW (1 << 5)
|
#define WINDOW (1 << 5)
|
||||||
#define WP_PIN (1 << 6)
|
#define WP_PIN (1 << 6)
|
||||||
#define WP_INVERTED (1 << 7)
|
#define WP_INVERTED (1 << 7)
|
||||||
|
#define PROBE (1 << 8)
|
||||||
|
|
||||||
/* modes */
|
/* modes */
|
||||||
#define SD_MODE 0
|
#define SD_MODE 0
|
||||||
|
|
@ -103,6 +104,12 @@ struct sdmmc_config_t sdmmc_config[] =
|
||||||
.mode = MMC_MODE,
|
.mode = MMC_MODE,
|
||||||
},
|
},
|
||||||
#elif defined(CREATIVE_ZENXFI2)
|
#elif defined(CREATIVE_ZENXFI2)
|
||||||
|
{
|
||||||
|
.name = "internal/SD",
|
||||||
|
.flags = WINDOW | PROBE,
|
||||||
|
.ssp = 2,
|
||||||
|
.mode = SD_MODE,
|
||||||
|
},
|
||||||
/* The Zen X-Fi2 uses pin B1P29 for power */
|
/* The Zen X-Fi2 uses pin B1P29 for power */
|
||||||
{
|
{
|
||||||
.name = "microSD",
|
.name = "microSD",
|
||||||
|
|
@ -866,7 +873,16 @@ int sd_init(void)
|
||||||
_sd_num_drives = 0;
|
_sd_num_drives = 0;
|
||||||
for(unsigned drive = 0; drive < SDMMC_NUM_DRIVES; drive++)
|
for(unsigned drive = 0; drive < SDMMC_NUM_DRIVES; drive++)
|
||||||
if(SDMMC_MODE(drive) == SD_MODE)
|
if(SDMMC_MODE(drive) == SD_MODE)
|
||||||
|
{
|
||||||
|
/* if asked to probe, try to init it and ignore it if it fails */
|
||||||
|
if(SDMMC_FLAGS(drive) & PROBE)
|
||||||
|
{
|
||||||
|
int ret = init_drive(drive);
|
||||||
|
if(ret < 0)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
sd_map[_sd_num_drives++] = drive;
|
sd_map[_sd_num_drives++] = drive;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -931,8 +947,16 @@ int mmc_init(void)
|
||||||
for(unsigned drive = 0; drive < SDMMC_NUM_DRIVES; drive++)
|
for(unsigned drive = 0; drive < SDMMC_NUM_DRIVES; drive++)
|
||||||
if(SDMMC_MODE(drive) == MMC_MODE)
|
if(SDMMC_MODE(drive) == MMC_MODE)
|
||||||
{
|
{
|
||||||
|
/* try to init drive, panic on failure or skip if probing */
|
||||||
|
int ret = init_drive(drive);
|
||||||
|
if(ret < 0)
|
||||||
|
{
|
||||||
|
if(SDMMC_FLAGS(drive) & PROBE)
|
||||||
|
continue;
|
||||||
|
else
|
||||||
|
panicf("init_drive(%d) failed: %d (mmc)", ret);
|
||||||
|
}
|
||||||
mmc_map[_mmc_num_drives++] = drive;
|
mmc_map[_mmc_num_drives++] = drive;
|
||||||
init_drive(drive);
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue