summaryrefslogtreecommitdiff
path: root/firmware/target/arm/ata-sd-pp.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/ata-sd-pp.c')
-rw-r--r--firmware/target/arm/ata-sd-pp.c35
1 files changed, 33 insertions, 2 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 */