summaryrefslogtreecommitdiff
path: root/firmware/target/arm
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm')
-rw-r--r--firmware/target/arm/as3525/sd-as3525.c12
-rw-r--r--firmware/target/arm/as3525/sd-as3525v2.c11
-rw-r--r--firmware/target/arm/ata-sd-pp.c27
-rw-r--r--firmware/target/arm/s3c2440/sd-s3c2440.c21
-rw-r--r--firmware/target/arm/tcc780x/sd-tcc780x.c13
5 files changed, 17 insertions, 67 deletions
diff --git a/firmware/target/arm/as3525/sd-as3525.c b/firmware/target/arm/as3525/sd-as3525.c
index 9c0b4124ac..8aaae55cf4 100644
--- a/firmware/target/arm/as3525/sd-as3525.c
+++ b/firmware/target/arm/as3525/sd-as3525.c
@@ -508,6 +508,8 @@ static void init_pl180_controller(const int drive)
508 GPIOA_IS &= ~EXT_SD_BITS; 508 GPIOA_IS &= ~EXT_SD_BITS;
509 /* detect both raising and falling edges */ 509 /* detect both raising and falling edges */
510 GPIOA_IBE |= EXT_SD_BITS; 510 GPIOA_IBE |= EXT_SD_BITS;
511 /* enable the card detect interrupt */
512 GPIOA_IE |= EXT_SD_BITS;
511 513
512#else 514#else
513 VIC_INT_ENABLE = INTERRUPT_NAND; 515 VIC_INT_ENABLE = INTERRUPT_NAND;
@@ -922,16 +924,6 @@ tCardInfo *card_get_info_target(int card_no)
922 return &card_info[card_no]; 924 return &card_info[card_no];
923} 925}
924 926
925#ifdef HAVE_HOTSWAP
926void card_enable_monitoring_target(bool on)
927{
928 if (on) /* enable interrupt */
929 GPIOA_IE |= EXT_SD_BITS;
930 else /* disable interrupt */
931 GPIOA_IE &= ~EXT_SD_BITS;
932}
933#endif /* HAVE_HOTSWAP */
934
935#endif /* !BOOTLOADER */ 927#endif /* !BOOTLOADER */
936 928
937#ifdef CONFIG_STORAGE_MULTI 929#ifdef CONFIG_STORAGE_MULTI
diff --git a/firmware/target/arm/as3525/sd-as3525v2.c b/firmware/target/arm/as3525/sd-as3525v2.c
index ccc88be25d..1a555e745d 100644
--- a/firmware/target/arm/as3525/sd-as3525v2.c
+++ b/firmware/target/arm/as3525/sd-as3525v2.c
@@ -731,6 +731,9 @@ int sd_init(void)
731 GPIOA_IS &= ~EXT_SD_BITS; 731 GPIOA_IS &= ~EXT_SD_BITS;
732 /* detect both raising and falling edges */ 732 /* detect both raising and falling edges */
733 GPIOA_IBE |= EXT_SD_BITS; 733 GPIOA_IBE |= EXT_SD_BITS;
734 /* enable the card detect interrupt */
735 GPIOA_IE |= EXT_SD_BITS;
736
734 /* Configure XPD for SD-MCI interface */ 737 /* Configure XPD for SD-MCI interface */
735 CCU_IO |= (1<<2); 738 CCU_IO |= (1<<2);
736#endif 739#endif
@@ -989,14 +992,6 @@ void sd_gpioa_isr(void)
989 /* acknowledge interrupt */ 992 /* acknowledge interrupt */
990 GPIOA_IC = EXT_SD_BITS; 993 GPIOA_IC = EXT_SD_BITS;
991} 994}
992
993void card_enable_monitoring_target(bool on)
994{
995 if (on) /* enable interrupt */
996 GPIOA_IE |= EXT_SD_BITS;
997 else /* disable interrupt */
998 GPIOA_IE &= ~EXT_SD_BITS;
999}
1000#endif /* HAVE_HOTSWAP */ 995#endif /* HAVE_HOTSWAP */
1001 996
1002#ifdef CONFIG_STORAGE_MULTI 997#ifdef CONFIG_STORAGE_MULTI
diff --git a/firmware/target/arm/ata-sd-pp.c b/firmware/target/arm/ata-sd-pp.c
index f7b4a992e4..a2dcfe518f 100644
--- a/firmware/target/arm/ata-sd-pp.c
+++ b/firmware/target/arm/ata-sd-pp.c
@@ -1190,27 +1190,6 @@ void sd_enable(bool on)
1190 } 1190 }
1191} 1191}
1192 1192
1193#ifdef HAVE_HOTSWAP
1194void card_enable_monitoring_target(bool on)
1195{
1196 if (on)
1197 {
1198#ifdef SANSA_E200
1199 GPIO_SET_BITWISE(GPIOA_INT_EN, 0x80);
1200#elif defined(SANSA_C200)
1201 GPIO_SET_BITWISE(GPIOL_INT_EN, 0x08);
1202#endif
1203 }
1204 else
1205 {
1206#ifdef SANSA_E200
1207 GPIO_CLEAR_BITWISE(GPIOA_INT_EN, 0x80);
1208#elif defined(SANSA_C200)
1209 GPIO_CLEAR_BITWISE(GPIOL_INT_EN, 0x08);
1210#endif
1211 }
1212}
1213#endif
1214 1193
1215int sd_init(void) 1194int sd_init(void)
1216{ 1195{
@@ -1275,6 +1254,9 @@ int sd_init(void)
1275 GPIOA_INT_LEV = (0x80 << 8) | (~GPIOA_INPUT_VAL & 0x80); 1254 GPIOA_INT_LEV = (0x80 << 8) | (~GPIOA_INPUT_VAL & 0x80);
1276 1255
1277 GPIOA_INT_CLR = 0x80; 1256 GPIOA_INT_CLR = 0x80;
1257
1258 /* enable the card detect interrupt */
1259 GPIO_SET_BITWISE(GPIOA_INT_EN, 0x80);
1278#elif defined SANSA_C200 1260#elif defined SANSA_C200
1279 CPU_INT_EN = HI_MASK; 1261 CPU_INT_EN = HI_MASK;
1280 CPU_HI_INT_EN = GPIO2_MASK; 1262 CPU_HI_INT_EN = GPIO2_MASK;
@@ -1282,6 +1264,9 @@ int sd_init(void)
1282 GPIOL_INT_LEV = (0x08 << 8) | (~GPIOL_INPUT_VAL & 0x08); 1264 GPIOL_INT_LEV = (0x08 << 8) | (~GPIOL_INPUT_VAL & 0x08);
1283 1265
1284 GPIOL_INT_CLR = 0x08; 1266 GPIOL_INT_CLR = 0x08;
1267
1268 /* enable the card detect interrupt */
1269 GPIO_SET_BITWISE(GPIOL_INT_EN, 0x08);
1285#endif 1270#endif
1286#endif 1271#endif
1287 } 1272 }
diff --git a/firmware/target/arm/s3c2440/sd-s3c2440.c b/firmware/target/arm/s3c2440/sd-s3c2440.c
index 33b995213e..f4c8a4f599 100644
--- a/firmware/target/arm/s3c2440/sd-s3c2440.c
+++ b/firmware/target/arm/s3c2440/sd-s3c2440.c
@@ -270,6 +270,11 @@ static void init_sdi_controller(const int card_no)
270 270
271 /* Card Detect input */ 271 /* Card Detect input */
272 S3C2440_GPIO_CONFIG (GPGCON, 8, GPIO_INPUT); 272 S3C2440_GPIO_CONFIG (GPGCON, 8, GPIO_INPUT);
273 /* enable external irq 8-23 on the internal interrupt controller */
274 INTMSK &= ~1<<5;
275 /* enable GPG8 IRQ on the external interrupt controller */
276 EINTMASK &= ~(1<<16);
277
273 278
274 /* Write Protect input */ 279 /* Write Protect input */
275 S3C2440_GPIO_CONFIG (GPHCON, 8, GPIO_INPUT); 280 S3C2440_GPIO_CONFIG (GPHCON, 8, GPIO_INPUT);
@@ -523,22 +528,6 @@ static int sd1_oneshot_callback(struct timeout *tmo)
523 return 0; 528 return 0;
524} 529}
525 530
526void card_enable_monitoring_target(bool on)
527{
528 if (on)
529 { /* enable external irq 8-23 on the internal interrupt controller */
530 INTMSK &= ~1<<5;
531 /* enable GPG8 IRQ on the external interrupt controller */
532 EINTMASK &= ~(1<<16);
533 }
534 else
535 {
536 /* mask internal and external IRQs */
537 INTMSK |= 1<<5;
538 EINTMASK |= (1<<16);
539 }
540}
541
542void EINT8_23(void) 531void EINT8_23(void)
543{ 532{
544 static struct timeout sd1_oneshot; 533 static struct timeout sd1_oneshot;
diff --git a/firmware/target/arm/tcc780x/sd-tcc780x.c b/firmware/target/arm/tcc780x/sd-tcc780x.c
index bfab9fdddd..88ccf187f0 100644
--- a/firmware/target/arm/tcc780x/sd-tcc780x.c
+++ b/firmware/target/arm/tcc780x/sd-tcc780x.c
@@ -214,18 +214,6 @@ static inline bool card_detect_target(void)
214#endif 214#endif
215} 215}
216 216
217void card_enable_monitoring_target(bool on)
218{
219 if (on)
220 {
221 IEN |= EXT0_IRQ_MASK;
222 }
223 else
224 {
225 IEN &= ~EXT0_IRQ_MASK;
226 }
227}
228
229static int sd1_oneshot_callback(struct timeout *tmo) 217static int sd1_oneshot_callback(struct timeout *tmo)
230{ 218{
231 (void)tmo; 219 (void)tmo;
@@ -786,6 +774,7 @@ int sd_init(void)
786 /* Configure interrupts for the card slot */ 774 /* Configure interrupts for the card slot */
787 TMODE &= ~EXT0_IRQ_MASK; /* edge-triggered */ 775 TMODE &= ~EXT0_IRQ_MASK; /* edge-triggered */
788 TMODEA |= EXT0_IRQ_MASK; /* trigger on both edges */ 776 TMODEA |= EXT0_IRQ_MASK; /* trigger on both edges */
777 IEN |= EXT0_IRQ_MASK; /* enable the interrupt */
789#endif 778#endif
790 } 779 }
791 780