diff options
author | Alex Dubov <oakad@yahoo.com> | 2007-04-12 02:59:12 -0400 |
---|---|---|
committer | Pierre Ossman <drzeus@drzeus.cx> | 2007-05-01 07:04:12 -0400 |
commit | 4552f0cbd45225f2c1cbadc224505f14f8749569 (patch) | |
tree | 026448e7321fa5c24f3f85c7f330fe112241c901 /drivers/mmc/tifm_sd.c | |
parent | 5721dbf217b073b40e31936781379ab2d17ea2ae (diff) |
tifm: hide details of interrupt processing from socket drivers
Instead of passing transformed value of adapter interrupt status to
socket drivers, implement two separate callbacks - one for card events
and another for dma events.
Signed-off-by: Alex Dubov <oakad@yahoo.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Diffstat (limited to 'drivers/mmc/tifm_sd.c')
-rw-r--r-- | drivers/mmc/tifm_sd.c | 43 |
1 files changed, 28 insertions, 15 deletions
diff --git a/drivers/mmc/tifm_sd.c b/drivers/mmc/tifm_sd.c index 0581d09c58fc..8905b129e4e1 100644 --- a/drivers/mmc/tifm_sd.c +++ b/drivers/mmc/tifm_sd.c | |||
@@ -17,7 +17,7 @@ | |||
17 | #include <asm/io.h> | 17 | #include <asm/io.h> |
18 | 18 | ||
19 | #define DRIVER_NAME "tifm_sd" | 19 | #define DRIVER_NAME "tifm_sd" |
20 | #define DRIVER_VERSION "0.7" | 20 | #define DRIVER_VERSION "0.8" |
21 | 21 | ||
22 | static int no_dma = 0; | 22 | static int no_dma = 0; |
23 | static int fixed_timeout = 0; | 23 | static int fixed_timeout = 0; |
@@ -316,24 +316,38 @@ change_state: | |||
316 | } | 316 | } |
317 | 317 | ||
318 | /* Called from interrupt handler */ | 318 | /* Called from interrupt handler */ |
319 | static void tifm_sd_signal_irq(struct tifm_dev *sock, | 319 | static void tifm_sd_data_event(struct tifm_dev *sock) |
320 | unsigned int sock_irq_status) | ||
321 | { | 320 | { |
322 | struct tifm_sd *host; | 321 | struct tifm_sd *host; |
323 | unsigned int host_status = 0, fifo_status = 0; | 322 | unsigned int fifo_status = 0; |
324 | int error_code = 0; | ||
325 | 323 | ||
326 | spin_lock(&sock->lock); | 324 | spin_lock(&sock->lock); |
327 | host = mmc_priv((struct mmc_host*)tifm_get_drvdata(sock)); | 325 | host = mmc_priv((struct mmc_host*)tifm_get_drvdata(sock)); |
328 | 326 | ||
329 | if (sock_irq_status & FIFO_EVENT) { | 327 | fifo_status = readl(sock->addr + SOCK_DMA_FIFO_STATUS); |
330 | fifo_status = readl(sock->addr + SOCK_DMA_FIFO_STATUS); | 328 | writel(fifo_status, sock->addr + SOCK_DMA_FIFO_STATUS); |
331 | writel(fifo_status, sock->addr + SOCK_DMA_FIFO_STATUS); | 329 | |
330 | host->flags |= fifo_status & FIFO_RDY; | ||
331 | |||
332 | if (host->req) | ||
333 | tifm_sd_process_cmd(sock, host, 0); | ||
334 | |||
335 | dev_dbg(&sock->dev, "fifo_status %x\n", fifo_status); | ||
336 | spin_unlock(&sock->lock); | ||
337 | |||
338 | } | ||
339 | |||
340 | /* Called from interrupt handler */ | ||
341 | static void tifm_sd_card_event(struct tifm_dev *sock) | ||
342 | { | ||
343 | struct tifm_sd *host; | ||
344 | unsigned int host_status = 0; | ||
345 | int error_code = 0; | ||
346 | |||
347 | spin_lock(&sock->lock); | ||
348 | host = mmc_priv((struct mmc_host*)tifm_get_drvdata(sock)); | ||
332 | 349 | ||
333 | host->flags |= fifo_status & FIFO_RDY; | ||
334 | } | ||
335 | 350 | ||
336 | if (sock_irq_status & CARD_EVENT) { | ||
337 | host_status = readl(sock->addr + SOCK_MMCSD_STATUS); | 351 | host_status = readl(sock->addr + SOCK_MMCSD_STATUS); |
338 | writel(host_status, sock->addr + SOCK_MMCSD_STATUS); | 352 | writel(host_status, sock->addr + SOCK_MMCSD_STATUS); |
339 | 353 | ||
@@ -377,13 +391,11 @@ static void tifm_sd_signal_irq(struct tifm_dev *sock, | |||
377 | host->written_blocks++; | 391 | host->written_blocks++; |
378 | host->flags &= ~CARD_BUSY; | 392 | host->flags &= ~CARD_BUSY; |
379 | } | 393 | } |
380 | } | ||
381 | 394 | ||
382 | if (host->req) | 395 | if (host->req) |
383 | tifm_sd_process_cmd(sock, host, host_status); | 396 | tifm_sd_process_cmd(sock, host, host_status); |
384 | done: | 397 | done: |
385 | dev_dbg(&sock->dev, "host_status %x, fifo_status %x\n", | 398 | dev_dbg(&sock->dev, "host_status %x\n", host_status); |
386 | host_status, fifo_status); | ||
387 | spin_unlock(&sock->lock); | 399 | spin_unlock(&sock->lock); |
388 | } | 400 | } |
389 | 401 | ||
@@ -882,7 +894,8 @@ static int tifm_sd_probe(struct tifm_dev *sock) | |||
882 | mmc->max_blk_size = 2048; | 894 | mmc->max_blk_size = 2048; |
883 | mmc->max_req_size = mmc->max_blk_size * mmc->max_blk_count; | 895 | mmc->max_req_size = mmc->max_blk_size * mmc->max_blk_count; |
884 | mmc->max_seg_size = mmc->max_req_size; | 896 | mmc->max_seg_size = mmc->max_req_size; |
885 | sock->signal_irq = tifm_sd_signal_irq; | 897 | sock->card_event = tifm_sd_card_event; |
898 | sock->data_event = tifm_sd_data_event; | ||
886 | rc = tifm_sd_initialize_host(host); | 899 | rc = tifm_sd_initialize_host(host); |
887 | 900 | ||
888 | if (!rc) | 901 | if (!rc) |