sd_card & imx53: simplify IRQ handler

Less switch cases.

Ref #1497
This commit is contained in:
Martin Stein 2015-10-22 16:57:03 +02:00 committed by Christian Helmuth
parent 48e7d29686
commit 2b021ec54b
1 changed files with 10 additions and 14 deletions

View File

@ -665,21 +665,19 @@ struct Esdhcv2_controller : private Esdhcv2, public Sd_card::Host_controller
* therefore not wait for a second IRQ when we've received a * therefore not wait for a second IRQ when we've received a
* single signal the first time. * single signal the first time.
*/ */
Irqstat::access_t constexpr irq_cc_tc = Irqstat::access_t constexpr irq_goal =
Irq::Cc::reg_mask() | Irq::Tc::reg_mask(); Irq::Cc::reg_mask() | Irq::Tc::reg_mask();
switch (irq) {
case Irq::Cc::reg_mask():
case Irq::Tc::reg_mask():
/* poll for the missing signal */ /* poll for the missing signal */
if (!wait_for<Irqstat>(irq_cc_tc, _delayer)) { if (irq != irq_goal) {
if (!wait_for<Irqstat>(irq_goal, _delayer)) {
PERR("completion host signal timed out"); PERR("completion host signal timed out");
return false; return false;
} }
case irq_cc_tc: }
/* acknowledge both completion signals */
/* acknowledge both completion signals */ write<Irqstat>(irq_goal);
write<Irqstat>(irq_cc_tc); if (!r) {
/* /*
* The "Auto Command 12" feature of the ESDHC seems to be * The "Auto Command 12" feature of the ESDHC seems to be
@ -687,11 +685,9 @@ struct Esdhcv2_controller : private Esdhcv2, public Sd_card::Host_controller
* timeout errors sometimes. Thus, we end such transfers * timeout errors sometimes. Thus, we end such transfers
* manually. * manually.
*/ */
return r ? true : _abort_transmission(); if (!_abort_transmission()) { return false; }
default:
PERR("received unexpected host signal");
return false;
} }
return true;
} }
/** /**