summaryrefslogtreecommitdiffstats
path: root/firmware/target/arm/imx233/sdmmc-imx233.c
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2014-02-04 19:27:07 +0100
committerAmaury Pouly <amaury.pouly@gmail.com>2014-02-10 23:14:26 +0100
commit1f4f7369eebfea85b9cb74a7ecae04b05bf44d07 (patch)
tree18b4d3908b749b9841109e03b33736eb95f3ec0b /firmware/target/arm/imx233/sdmmc-imx233.c
parentf982ea63989694f47bf8508883ddaa685d71fdf4 (diff)
downloadrockbox-1f4f7369eebfea85b9cb74a7ecae04b05bf44d07.tar.gz
rockbox-1f4f7369eebfea85b9cb74a7ecae04b05bf44d07.tar.bz2
rockbox-1f4f7369eebfea85b9cb74a7ecae04b05bf44d07.zip
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
Diffstat (limited to 'firmware/target/arm/imx233/sdmmc-imx233.c')
-rw-r--r--firmware/target/arm/imx233/sdmmc-imx233.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/firmware/target/arm/imx233/sdmmc-imx233.c b/firmware/target/arm/imx233/sdmmc-imx233.c
index 8103e980d1..7df0e412e5 100644
--- a/firmware/target/arm/imx233/sdmmc-imx233.c
+++ b/firmware/target/arm/imx233/sdmmc-imx233.c
@@ -73,6 +73,7 @@ struct sdmmc_config_t
#define WINDOW (1 << 5)
#define WP_PIN (1 << 6)
#define WP_INVERTED (1 << 7)
+#define PROBE (1 << 8)
/* modes */
#define SD_MODE 0
@@ -103,6 +104,12 @@ struct sdmmc_config_t sdmmc_config[] =
.mode = MMC_MODE,
},
#elif defined(CREATIVE_ZENXFI2)
+ {
+ .name = "internal/SD",
+ .flags = WINDOW | PROBE,
+ .ssp = 2,
+ .mode = SD_MODE,
+ },
/* The Zen X-Fi2 uses pin B1P29 for power */
{
.name = "microSD",
@@ -866,7 +873,16 @@ int sd_init(void)
_sd_num_drives = 0;
for(unsigned drive = 0; drive < SDMMC_NUM_DRIVES; drive++)
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;
+ }
return 0;
}
@@ -931,8 +947,16 @@ int mmc_init(void)
for(unsigned drive = 0; drive < SDMMC_NUM_DRIVES; drive++)
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;
- init_drive(drive);
}
return 0;
}