summaryrefslogtreecommitdiff
path: root/firmware/target/arm
diff options
context:
space:
mode:
authorFrank Gevaerts <frank@gevaerts.be>2010-06-06 13:20:47 +0000
committerFrank Gevaerts <frank@gevaerts.be>2010-06-06 13:20:47 +0000
commit9c43b2ce17cbc1f88b825ab8a5021575cee46dd7 (patch)
tree8d96e95861b3b0df1a7efa6b660395c317ecb475 /firmware/target/arm
parent4a2cab6aa1008a4f5ac05dac44c99b7f1a05e8f4 (diff)
Remove card_enable_monitoring() and use a mutex instead. The card_enable_monitoring() method actually didn't eliminate the possible race conditions it was meant to fix.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26627 a1c6a512-1295-4272-9138-f99709370657
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)
GPIOA_IS &= ~EXT_SD_BITS;
/* detect both raising and falling edges */
GPIOA_IBE |= EXT_SD_BITS;
+ /* enable the card detect interrupt */
+ GPIOA_IE |= EXT_SD_BITS;
#else
VIC_INT_ENABLE = INTERRUPT_NAND;
@@ -922,16 +924,6 @@ tCardInfo *card_get_info_target(int card_no)
return &card_info[card_no];
}
-#ifdef HAVE_HOTSWAP
-void card_enable_monitoring_target(bool on)
-{
- if (on) /* enable interrupt */
- GPIOA_IE |= EXT_SD_BITS;
- else /* disable interrupt */
- GPIOA_IE &= ~EXT_SD_BITS;
-}
-#endif /* HAVE_HOTSWAP */
-
#endif /* !BOOTLOADER */
#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)
GPIOA_IS &= ~EXT_SD_BITS;
/* detect both raising and falling edges */
GPIOA_IBE |= EXT_SD_BITS;
+ /* enable the card detect interrupt */
+ GPIOA_IE |= EXT_SD_BITS;
+
/* Configure XPD for SD-MCI interface */
CCU_IO |= (1<<2);
#endif
@@ -989,14 +992,6 @@ void sd_gpioa_isr(void)
/* acknowledge interrupt */
GPIOA_IC = EXT_SD_BITS;
}
-
-void card_enable_monitoring_target(bool on)
-{
- if (on) /* enable interrupt */
- GPIOA_IE |= EXT_SD_BITS;
- else /* disable interrupt */
- GPIOA_IE &= ~EXT_SD_BITS;
-}
#endif /* HAVE_HOTSWAP */
#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)
}
}
-#ifdef HAVE_HOTSWAP
-void card_enable_monitoring_target(bool on)
-{
- if (on)
- {
-#ifdef SANSA_E200
- GPIO_SET_BITWISE(GPIOA_INT_EN, 0x80);
-#elif defined(SANSA_C200)
- GPIO_SET_BITWISE(GPIOL_INT_EN, 0x08);
-#endif
- }
- else
- {
-#ifdef SANSA_E200
- GPIO_CLEAR_BITWISE(GPIOA_INT_EN, 0x80);
-#elif defined(SANSA_C200)
- GPIO_CLEAR_BITWISE(GPIOL_INT_EN, 0x08);
-#endif
- }
-}
-#endif
int sd_init(void)
{
@@ -1275,6 +1254,9 @@ int sd_init(void)
GPIOA_INT_LEV = (0x80 << 8) | (~GPIOA_INPUT_VAL & 0x80);
GPIOA_INT_CLR = 0x80;
+
+ /* enable the card detect interrupt */
+ GPIO_SET_BITWISE(GPIOA_INT_EN, 0x80);
#elif defined SANSA_C200
CPU_INT_EN = HI_MASK;
CPU_HI_INT_EN = GPIO2_MASK;
@@ -1282,6 +1264,9 @@ int sd_init(void)
GPIOL_INT_LEV = (0x08 << 8) | (~GPIOL_INPUT_VAL & 0x08);
GPIOL_INT_CLR = 0x08;
+
+ /* enable the card detect interrupt */
+ GPIO_SET_BITWISE(GPIOL_INT_EN, 0x08);
#endif
#endif
}
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)
/* Card Detect input */
S3C2440_GPIO_CONFIG (GPGCON, 8, GPIO_INPUT);
+ /* enable external irq 8-23 on the internal interrupt controller */
+ INTMSK &= ~1<<5;
+ /* enable GPG8 IRQ on the external interrupt controller */
+ EINTMASK &= ~(1<<16);
+
/* Write Protect input */
S3C2440_GPIO_CONFIG (GPHCON, 8, GPIO_INPUT);
@@ -523,22 +528,6 @@ static int sd1_oneshot_callback(struct timeout *tmo)
return 0;
}
-void card_enable_monitoring_target(bool on)
-{
- if (on)
- { /* enable external irq 8-23 on the internal interrupt controller */
- INTMSK &= ~1<<5;
- /* enable GPG8 IRQ on the external interrupt controller */
- EINTMASK &= ~(1<<16);
- }
- else
- {
- /* mask internal and external IRQs */
- INTMSK |= 1<<5;
- EINTMASK |= (1<<16);
- }
-}
-
void EINT8_23(void)
{
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)
#endif
}
-void card_enable_monitoring_target(bool on)
-{
- if (on)
- {
- IEN |= EXT0_IRQ_MASK;
- }
- else
- {
- IEN &= ~EXT0_IRQ_MASK;
- }
-}
-
static int sd1_oneshot_callback(struct timeout *tmo)
{
(void)tmo;
@@ -786,6 +774,7 @@ int sd_init(void)
/* Configure interrupts for the card slot */
TMODE &= ~EXT0_IRQ_MASK; /* edge-triggered */
TMODEA |= EXT0_IRQ_MASK; /* trigger on both edges */
+ IEN |= EXT0_IRQ_MASK; /* enable the interrupt */
#endif
}