diff options
Diffstat (limited to 'firmware/target/arm/imx233/ssp-imx233.c')
-rw-r--r-- | firmware/target/arm/imx233/ssp-imx233.c | 31 |
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) | |||
335 | SSP_CLRn(SSP_CMD0, ssp, CONT_CLKING_EN); | 335 | SSP_CLRn(SSP_CMD0, ssp, CONT_CLKING_EN); |
336 | } | 336 | } |
337 | 337 | ||
338 | static int ssp_detect_oneshot_callback(int ssp) | 338 | static int ssp_detect_oneshot_callback(struct timeout *tmo) |
339 | { | 339 | { |
340 | int ssp = tmo->data; | ||
340 | ASSERT_SSP(ssp) | 341 | ASSERT_SSP(ssp) |
341 | if(ssp_detect_cb[ssp - 1]) | 342 | if(ssp_detect_cb[ssp - 1]) |
342 | ssp_detect_cb[ssp - 1](ssp); | 343 | ssp_detect_cb[ssp - 1](ssp); |
@@ -344,26 +345,13 @@ static int ssp_detect_oneshot_callback(int ssp) | |||
344 | return 0; | 345 | return 0; |
345 | } | 346 | } |
346 | 347 | ||
347 | static int ssp1_detect_oneshot_callback(struct timeout *tmo) | 348 | static struct timeout ssp_detect_oneshot[2]; |
348 | { | ||
349 | (void) tmo; | ||
350 | return ssp_detect_oneshot_callback(1); | ||
351 | } | ||
352 | |||
353 | static int ssp2_detect_oneshot_callback(struct timeout *tmo) | ||
354 | { | ||
355 | (void) tmo; | ||
356 | return ssp_detect_oneshot_callback(2); | ||
357 | } | ||
358 | 349 | ||
359 | static void detect_irq(int bank, int pin) | 350 | static void detect_irq(int bank, int pin, intptr_t ssp) |
360 | { | 351 | { |
361 | static struct timeout ssp1_detect_oneshot; | 352 | (void) bank; |
362 | static struct timeout ssp2_detect_oneshot; | 353 | (void) pin; |
363 | if(bank == 2 && pin == 1) | 354 | timeout_register(&ssp_detect_oneshot[ssp - 1], ssp_detect_oneshot_callback, (3*HZ/10), ssp); |
364 | timeout_register(&ssp1_detect_oneshot, ssp1_detect_oneshot_callback, (3*HZ/10), 0); | ||
365 | else if(bank == 0 && pin == 19) | ||
366 | timeout_register(&ssp2_detect_oneshot, ssp2_detect_oneshot_callback, (3*HZ/10), 0); | ||
367 | } | 355 | } |
368 | 356 | ||
369 | void imx233_ssp_sdmmc_setup_detect(int ssp, bool enable, ssp_detect_cb_t fn, | 357 | 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, | |||
381 | imx233_pinctrl_enable_gpio(bank, pin, false); | 369 | imx233_pinctrl_enable_gpio(bank, pin, false); |
382 | } | 370 | } |
383 | if(first_time && imx233_ssp_sdmmc_detect(ssp)) | 371 | if(first_time && imx233_ssp_sdmmc_detect(ssp)) |
384 | detect_irq(bank, pin); | 372 | detect_irq(bank, pin, ssp); |
385 | imx233_pinctrl_setup_irq(bank, pin, enable, true, !imx233_ssp_sdmmc_detect_raw(ssp), detect_irq); | 373 | imx233_pinctrl_setup_irq(bank, pin, enable, |
374 | true, !imx233_ssp_sdmmc_detect_raw(ssp), detect_irq, ssp); | ||
386 | } | 375 | } |
387 | 376 | ||
388 | bool imx233_ssp_sdmmc_is_detect_inverted(int ssp) | 377 | bool imx233_ssp_sdmmc_is_detect_inverted(int ssp) |