summaryrefslogtreecommitdiffstats
path: root/firmware/target/arm/imx233/ssp-imx233.c
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2013-06-16 19:32:21 +0200
committerAmaury Pouly <amaury.pouly@gmail.com>2013-06-17 00:29:24 +0200
commit8f351d6e212e3b726a9d9020ed8a4119bb68e77e (patch)
treed4ab979baf0c6e56b90a3df5c2ace9cfb924cc47 /firmware/target/arm/imx233/ssp-imx233.c
parent918a06a12ad633a29634f3249990ba04ce9fb00b (diff)
downloadrockbox-8f351d6e212e3b726a9d9020ed8a4119bb68e77e.tar.gz
rockbox-8f351d6e212e3b726a9d9020ed8a4119bb68e77e.tar.bz2
rockbox-8f351d6e212e3b726a9d9020ed8a4119bb68e77e.zip
imx233: enhance pinctrl irq with user pointer
Change-Id: I191704299487598a853af4df5aebbbf8a7134a34
Diffstat (limited to 'firmware/target/arm/imx233/ssp-imx233.c')
-rw-r--r--firmware/target/arm/imx233/ssp-imx233.c31
1 files changed, 10 insertions, 21 deletions
diff --git a/firmware/target/arm/imx233/ssp-imx233.c b/firmware/target/arm/imx233/ssp-imx233.c
index a3f4083aeb..d83cea7bc0 100644
--- a/firmware/target/arm/imx233/ssp-imx233.c
+++ b/firmware/target/arm/imx233/ssp-imx233.c
@@ -335,8 +335,9 @@ void imx233_ssp_sd_mmc_power_up_sequence(int ssp)
SSP_CLRn(SSP_CMD0, ssp, CONT_CLKING_EN);
}
-static int ssp_detect_oneshot_callback(int ssp)
+static int ssp_detect_oneshot_callback(struct timeout *tmo)
{
+ int ssp = tmo->data;
ASSERT_SSP(ssp)
if(ssp_detect_cb[ssp - 1])
ssp_detect_cb[ssp - 1](ssp);
@@ -344,26 +345,13 @@ static int ssp_detect_oneshot_callback(int ssp)
return 0;
}
-static int ssp1_detect_oneshot_callback(struct timeout *tmo)
-{
- (void) tmo;
- return ssp_detect_oneshot_callback(1);
-}
-
-static int ssp2_detect_oneshot_callback(struct timeout *tmo)
-{
- (void) tmo;
- return ssp_detect_oneshot_callback(2);
-}
+static struct timeout ssp_detect_oneshot[2];
-static void detect_irq(int bank, int pin)
+static void detect_irq(int bank, int pin, intptr_t ssp)
{
- static struct timeout ssp1_detect_oneshot;
- static struct timeout ssp2_detect_oneshot;
- if(bank == 2 && pin == 1)
- timeout_register(&ssp1_detect_oneshot, ssp1_detect_oneshot_callback, (3*HZ/10), 0);
- else if(bank == 0 && pin == 19)
- timeout_register(&ssp2_detect_oneshot, ssp2_detect_oneshot_callback, (3*HZ/10), 0);
+ (void) bank;
+ (void) pin;
+ timeout_register(&ssp_detect_oneshot[ssp - 1], ssp_detect_oneshot_callback, (3*HZ/10), ssp);
}
void imx233_ssp_sdmmc_setup_detect(int ssp, bool enable, ssp_detect_cb_t fn,
@@ -381,8 +369,9 @@ void imx233_ssp_sdmmc_setup_detect(int ssp, bool enable, ssp_detect_cb_t fn,
imx233_pinctrl_enable_gpio(bank, pin, false);
}
if(first_time && imx233_ssp_sdmmc_detect(ssp))
- detect_irq(bank, pin);
- imx233_pinctrl_setup_irq(bank, pin, enable, true, !imx233_ssp_sdmmc_detect_raw(ssp), detect_irq);
+ detect_irq(bank, pin, ssp);
+ imx233_pinctrl_setup_irq(bank, pin, enable,
+ true, !imx233_ssp_sdmmc_detect_raw(ssp), detect_irq, ssp);
}
bool imx233_ssp_sdmmc_is_detect_inverted(int ssp)