summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Arigo <markarigo@gmail.com>2009-03-14 02:47:14 +0000
committerMark Arigo <markarigo@gmail.com>2009-03-14 02:47:14 +0000
commitb642129be493309179ddc0a659301667613c188e (patch)
treede8ae15454856790f59b1518156de646fb033ae4
parentf8877bf42d4f88c5ebb92a52bd09ed59ef696514 (diff)
Philips SA9200 fixes: (1) boost in the bootloader like the e200 and c200, (2) use the right GPIOs and inits in the SD driver, and (3) add charger detection.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20323 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/target/arm/ata-sd-pp.c35
-rw-r--r--firmware/target/arm/philips/sa9200/power-sa9200.c10
-rw-r--r--firmware/target/arm/system-pp502x.c7
3 files changed, 46 insertions, 6 deletions
diff --git a/firmware/target/arm/ata-sd-pp.c b/firmware/target/arm/ata-sd-pp.c
index cde474ca29..9f0263a411 100644
--- a/firmware/target/arm/ata-sd-pp.c
+++ b/firmware/target/arm/ata-sd-pp.c
@@ -573,7 +573,7 @@ static int sd_select_bank(unsigned char bank)
static void sd_card_mux(int card_no)
{
/* Set the current card mux */
-#if defined(SANSA_E200) || defined(PHILIPS_SA9200)
+#if defined(SANSA_E200)
if (card_no == 0)
{
GPO32_VAL |= 0x4;
@@ -598,7 +598,7 @@ static void sd_card_mux(int card_no)
outl(inl(0x70000014) & ~(0x3ffff), 0x70000014);
}
-#else /* SANSA_C200 */
+#elif defined(SANSA_C200)
if (card_no == 0)
{
GPO32_VAL |= 0x4;
@@ -623,6 +623,23 @@ static void sd_card_mux(int card_no)
outl((inl(0x70000014) & ~(0x3ffff)) | 0x255aa, 0x70000014);
}
+#elif defined(PHILIPS_SA9200)
+ /* only 1 "card" (no external memory card) */
+ (void)card_no;
+
+ GPIO_SET_BITWISE(GPIOH_ENABLE, 0x80);
+ GPIO_SET_BITWISE(GPIOH_OUTPUT_EN, 0x80);
+
+ outl(0x255aa, 0x70000014);
+
+ GPIO_CLEAR_BITWISE(GPIOA_ENABLE, 0x04);
+ GPIO_CLEAR_BITWISE(GPIOA_OUTPUT_EN, 0x04);
+
+ GPIO_CLEAR_BITWISE(GPIOA_ENABLE, 0x7a);
+ GPIO_CLEAR_BITWISE(GPIOA_OUTPUT_EN, 0x7a);
+
+ GPIO_SET_BITWISE(GPIOH_OUTPUT_VAL, 0x80);
+ GPIO_SET_BITWISE(GPIOH_OUTPUT_EN, 0x80);
#endif
}
@@ -649,12 +666,21 @@ static void sd_init_device(int card_no)
sd_card_mux(card_no);
/* Init NAND */
+#if defined(PHILIPS_SA9200)
+ MMC_INIT_1 |= (1 << 15);
+ MMC_INIT_2 |= (1 << 15);
+ MMC_INIT_2 &= ~(3 << 12);
+ MMC_INIT_2 |= (1 << 12);
+ MMC_INIT_1 &= ~(3 << 12);
+ MMC_INIT_1 |= (1 << 12);
+#else
MMC_INIT_1 |= (1 << 15);
MMC_INIT_2 |= (1 << 15);
MMC_INIT_2 &= ~(3 << 12);
MMC_INIT_2 |= (1 << 13);
MMC_INIT_1 &= ~(3 << 12);
MMC_INIT_1 |= (1 << 13);
+#endif
DEV_EN |= DEV_ATA; /* Enable controller */
DEV_RS |= DEV_ATA; /* Reset controller */
@@ -1210,6 +1236,10 @@ int sd_init(void)
initialized = true;
/* init controller */
+#if defined(PHILIPS_SA9200)
+ GPIOA_ENABLE = 0x00;
+ GPIO_SET_BITWISE(GPIOD_ENABLE, 0x01);
+#else
outl(inl(0x70000088) & ~(0x4), 0x70000088);
outl(inl(0x7000008c) & ~(0x4), 0x7000008c);
GPO32_ENABLE |= 0x4;
@@ -1217,6 +1247,7 @@ int sd_init(void)
GPIO_SET_BITWISE(GPIOG_ENABLE, (0x3 << 5));
GPIO_SET_BITWISE(GPIOG_OUTPUT_EN, (0x3 << 5));
GPIO_SET_BITWISE(GPIOG_OUTPUT_VAL, (0x3 << 5));
+#endif
#ifdef HAVE_HOTSWAP
/* enable card detection port - mask interrupt first */
diff --git a/firmware/target/arm/philips/sa9200/power-sa9200.c b/firmware/target/arm/philips/sa9200/power-sa9200.c
index 2b42379cae..cf9468cb1d 100644
--- a/firmware/target/arm/philips/sa9200/power-sa9200.c
+++ b/firmware/target/arm/philips/sa9200/power-sa9200.c
@@ -56,7 +56,15 @@ void power_off(void)
unsigned int power_input_status(void)
{
- return POWER_INPUT_NONE;
+ unsigned int status = POWER_INPUT_NONE;
+
+ /* GPIOF indicates that the connector is present,
+ GPIOB indicates that there's power there too.
+ Same status bits for both USB and the charger. */
+ if (!(GPIOF_INPUT_VAL & 0x80) && !(GPIOB_INPUT_VAL & 0x80))
+ status = POWER_INPUT_MAIN_CHARGER;
+
+ return status;
}
void ide_power_enable(bool on)
diff --git a/firmware/target/arm/system-pp502x.c b/firmware/target/arm/system-pp502x.c
index 05d418bd88..5fb6b20c4c 100644
--- a/firmware/target/arm/system-pp502x.c
+++ b/firmware/target/arm/system-pp502x.c
@@ -209,7 +209,8 @@ static void init_cache(void)
#endif /* !BOOTLOADER */
/* We need this for Sansas since we boost the cpu in their bootloader */
-#if !defined(BOOTLOADER) || defined(SANSA_E200) || defined(SANSA_C200)
+#if !defined(BOOTLOADER) || defined(SANSA_E200) || defined(SANSA_C200) || \
+ defined(PHILIPS_SA9200)
void scale_suspend_core(bool suspend) ICODE_ATTR;
void scale_suspend_core(bool suspend)
{
@@ -353,7 +354,7 @@ static void pp_set_cpu_frequency(long frequency)
corelock_unlock(&cpufreq_cl);
#endif
}
-#endif /* !BOOTLOADER || SANSA_E200 || SANSA_C200 */
+#endif /* !BOOTLOADER || SANSA_E200 || SANSA_C200 || PHILIPS_SA9200 */
void system_init(void)
{
@@ -485,7 +486,7 @@ void system_init(void)
#else /* BOOTLOADER */
if (CURRENT_CORE == CPU)
{
-#if defined(SANSA_C200) || defined (SANSA_E200)
+#if defined(SANSA_C200) || defined(SANSA_E200) || defined(PHILIPS_SA9200)
pp_set_cpu_frequency(CPUFREQ_MAX);
#endif
}