summaryrefslogtreecommitdiff
path: root/firmware
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 /firmware
parentf8877bf42d4f88c5ebb92a52bd09ed59ef696514 (diff)
downloadrockbox-b642129be493309179ddc0a659301667613c188e.tar.gz
rockbox-b642129be493309179ddc0a659301667613c188e.zip
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
Diffstat (limited to 'firmware')
-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)
573static void sd_card_mux(int card_no) 573static void sd_card_mux(int card_no)
574{ 574{
575/* Set the current card mux */ 575/* Set the current card mux */
576#if defined(SANSA_E200) || defined(PHILIPS_SA9200) 576#if defined(SANSA_E200)
577 if (card_no == 0) 577 if (card_no == 0)
578 { 578 {
579 GPO32_VAL |= 0x4; 579 GPO32_VAL |= 0x4;
@@ -598,7 +598,7 @@ static void sd_card_mux(int card_no)
598 598
599 outl(inl(0x70000014) & ~(0x3ffff), 0x70000014); 599 outl(inl(0x70000014) & ~(0x3ffff), 0x70000014);
600 } 600 }
601#else /* SANSA_C200 */ 601#elif defined(SANSA_C200)
602 if (card_no == 0) 602 if (card_no == 0)
603 { 603 {
604 GPO32_VAL |= 0x4; 604 GPO32_VAL |= 0x4;
@@ -623,6 +623,23 @@ static void sd_card_mux(int card_no)
623 623
624 outl((inl(0x70000014) & ~(0x3ffff)) | 0x255aa, 0x70000014); 624 outl((inl(0x70000014) & ~(0x3ffff)) | 0x255aa, 0x70000014);
625 } 625 }
626#elif defined(PHILIPS_SA9200)
627 /* only 1 "card" (no external memory card) */
628 (void)card_no;
629
630 GPIO_SET_BITWISE(GPIOH_ENABLE, 0x80);
631 GPIO_SET_BITWISE(GPIOH_OUTPUT_EN, 0x80);
632
633 outl(0x255aa, 0x70000014);
634
635 GPIO_CLEAR_BITWISE(GPIOA_ENABLE, 0x04);
636 GPIO_CLEAR_BITWISE(GPIOA_OUTPUT_EN, 0x04);
637
638 GPIO_CLEAR_BITWISE(GPIOA_ENABLE, 0x7a);
639 GPIO_CLEAR_BITWISE(GPIOA_OUTPUT_EN, 0x7a);
640
641 GPIO_SET_BITWISE(GPIOH_OUTPUT_VAL, 0x80);
642 GPIO_SET_BITWISE(GPIOH_OUTPUT_EN, 0x80);
626#endif 643#endif
627} 644}
628 645
@@ -649,12 +666,21 @@ static void sd_init_device(int card_no)
649 sd_card_mux(card_no); 666 sd_card_mux(card_no);
650 667
651/* Init NAND */ 668/* Init NAND */
669#if defined(PHILIPS_SA9200)
670 MMC_INIT_1 |= (1 << 15);
671 MMC_INIT_2 |= (1 << 15);
672 MMC_INIT_2 &= ~(3 << 12);
673 MMC_INIT_2 |= (1 << 12);
674 MMC_INIT_1 &= ~(3 << 12);
675 MMC_INIT_1 |= (1 << 12);
676#else
652 MMC_INIT_1 |= (1 << 15); 677 MMC_INIT_1 |= (1 << 15);
653 MMC_INIT_2 |= (1 << 15); 678 MMC_INIT_2 |= (1 << 15);
654 MMC_INIT_2 &= ~(3 << 12); 679 MMC_INIT_2 &= ~(3 << 12);
655 MMC_INIT_2 |= (1 << 13); 680 MMC_INIT_2 |= (1 << 13);
656 MMC_INIT_1 &= ~(3 << 12); 681 MMC_INIT_1 &= ~(3 << 12);
657 MMC_INIT_1 |= (1 << 13); 682 MMC_INIT_1 |= (1 << 13);
683#endif
658 684
659 DEV_EN |= DEV_ATA; /* Enable controller */ 685 DEV_EN |= DEV_ATA; /* Enable controller */
660 DEV_RS |= DEV_ATA; /* Reset controller */ 686 DEV_RS |= DEV_ATA; /* Reset controller */
@@ -1210,6 +1236,10 @@ int sd_init(void)
1210 initialized = true; 1236 initialized = true;
1211 1237
1212 /* init controller */ 1238 /* init controller */
1239#if defined(PHILIPS_SA9200)
1240 GPIOA_ENABLE = 0x00;
1241 GPIO_SET_BITWISE(GPIOD_ENABLE, 0x01);
1242#else
1213 outl(inl(0x70000088) & ~(0x4), 0x70000088); 1243 outl(inl(0x70000088) & ~(0x4), 0x70000088);
1214 outl(inl(0x7000008c) & ~(0x4), 0x7000008c); 1244 outl(inl(0x7000008c) & ~(0x4), 0x7000008c);
1215 GPO32_ENABLE |= 0x4; 1245 GPO32_ENABLE |= 0x4;
@@ -1217,6 +1247,7 @@ int sd_init(void)
1217 GPIO_SET_BITWISE(GPIOG_ENABLE, (0x3 << 5)); 1247 GPIO_SET_BITWISE(GPIOG_ENABLE, (0x3 << 5));
1218 GPIO_SET_BITWISE(GPIOG_OUTPUT_EN, (0x3 << 5)); 1248 GPIO_SET_BITWISE(GPIOG_OUTPUT_EN, (0x3 << 5));
1219 GPIO_SET_BITWISE(GPIOG_OUTPUT_VAL, (0x3 << 5)); 1249 GPIO_SET_BITWISE(GPIOG_OUTPUT_VAL, (0x3 << 5));
1250#endif
1220 1251
1221#ifdef HAVE_HOTSWAP 1252#ifdef HAVE_HOTSWAP
1222 /* enable card detection port - mask interrupt first */ 1253 /* 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)
56 56
57unsigned int power_input_status(void) 57unsigned int power_input_status(void)
58{ 58{
59 return POWER_INPUT_NONE; 59 unsigned int status = POWER_INPUT_NONE;
60
61 /* GPIOF indicates that the connector is present,
62 GPIOB indicates that there's power there too.
63 Same status bits for both USB and the charger. */
64 if (!(GPIOF_INPUT_VAL & 0x80) && !(GPIOB_INPUT_VAL & 0x80))
65 status = POWER_INPUT_MAIN_CHARGER;
66
67 return status;
60} 68}
61 69
62void ide_power_enable(bool on) 70void 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)
209#endif /* !BOOTLOADER */ 209#endif /* !BOOTLOADER */
210 210
211/* We need this for Sansas since we boost the cpu in their bootloader */ 211/* We need this for Sansas since we boost the cpu in their bootloader */
212#if !defined(BOOTLOADER) || defined(SANSA_E200) || defined(SANSA_C200) 212#if !defined(BOOTLOADER) || defined(SANSA_E200) || defined(SANSA_C200) || \
213 defined(PHILIPS_SA9200)
213void scale_suspend_core(bool suspend) ICODE_ATTR; 214void scale_suspend_core(bool suspend) ICODE_ATTR;
214void scale_suspend_core(bool suspend) 215void scale_suspend_core(bool suspend)
215{ 216{
@@ -353,7 +354,7 @@ static void pp_set_cpu_frequency(long frequency)
353 corelock_unlock(&cpufreq_cl); 354 corelock_unlock(&cpufreq_cl);
354#endif 355#endif
355} 356}
356#endif /* !BOOTLOADER || SANSA_E200 || SANSA_C200 */ 357#endif /* !BOOTLOADER || SANSA_E200 || SANSA_C200 || PHILIPS_SA9200 */
357 358
358void system_init(void) 359void system_init(void)
359{ 360{
@@ -485,7 +486,7 @@ void system_init(void)
485#else /* BOOTLOADER */ 486#else /* BOOTLOADER */
486 if (CURRENT_CORE == CPU) 487 if (CURRENT_CORE == CPU)
487 { 488 {
488#if defined(SANSA_C200) || defined (SANSA_E200) 489#if defined(SANSA_C200) || defined(SANSA_E200) || defined(PHILIPS_SA9200)
489 pp_set_cpu_frequency(CPUFREQ_MAX); 490 pp_set_cpu_frequency(CPUFREQ_MAX);
490#endif 491#endif
491 } 492 }