aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/misc/tifm_7xx1.c22
-rw-r--r--drivers/misc/tifm_core.c11
-rw-r--r--drivers/mmc/tifm_sd.c43
-rw-r--r--include/linux/tifm.h11
4 files changed, 50 insertions, 37 deletions
diff --git a/drivers/misc/tifm_7xx1.c b/drivers/misc/tifm_7xx1.c
index bc60e2fc3c2c..d6652b3301dc 100644
--- a/drivers/misc/tifm_7xx1.c
+++ b/drivers/misc/tifm_7xx1.c
@@ -14,7 +14,13 @@
14#include <linux/freezer.h> 14#include <linux/freezer.h>
15 15
16#define DRIVER_NAME "tifm_7xx1" 16#define DRIVER_NAME "tifm_7xx1"
17#define DRIVER_VERSION "0.7" 17#define DRIVER_VERSION "0.8"
18
19#define TIFM_IRQ_ENABLE 0x80000000
20#define TIFM_IRQ_SOCKMASK(x) (x)
21#define TIFM_IRQ_CARDMASK(x) ((x) << 8)
22#define TIFM_IRQ_FIFOMASK(x) ((x) << 16)
23#define TIFM_IRQ_SETALL 0xffffffff
18 24
19static void tifm_7xx1_eject(struct tifm_adapter *fm, struct tifm_dev *sock) 25static void tifm_7xx1_eject(struct tifm_adapter *fm, struct tifm_dev *sock)
20{ 26{
@@ -31,7 +37,7 @@ static irqreturn_t tifm_7xx1_isr(int irq, void *dev_id)
31 struct tifm_adapter *fm = dev_id; 37 struct tifm_adapter *fm = dev_id;
32 struct tifm_dev *sock; 38 struct tifm_dev *sock;
33 unsigned int irq_status; 39 unsigned int irq_status;
34 unsigned int sock_irq_status, cnt; 40 unsigned int cnt;
35 41
36 spin_lock(&fm->lock); 42 spin_lock(&fm->lock);
37 irq_status = readl(fm->addr + FM_INTERRUPT_STATUS); 43 irq_status = readl(fm->addr + FM_INTERRUPT_STATUS);
@@ -45,12 +51,12 @@ static irqreturn_t tifm_7xx1_isr(int irq, void *dev_id)
45 51
46 for (cnt = 0; cnt < fm->num_sockets; cnt++) { 52 for (cnt = 0; cnt < fm->num_sockets; cnt++) {
47 sock = fm->sockets[cnt]; 53 sock = fm->sockets[cnt];
48 sock_irq_status = (irq_status >> cnt) 54 if (sock) {
49 & (TIFM_IRQ_FIFOMASK(1) 55 if ((irq_status >> cnt) & TIFM_IRQ_FIFOMASK(1))
50 | TIFM_IRQ_CARDMASK(1)); 56 sock->data_event(sock);
51 57 if ((irq_status >> cnt) & TIFM_IRQ_CARDMASK(1))
52 if (sock && sock_irq_status) 58 sock->card_event(sock);
53 sock->signal_irq(sock, sock_irq_status); 59 }
54 } 60 }
55 61
56 fm->socket_change_set |= irq_status 62 fm->socket_change_set |= irq_status
diff --git a/drivers/misc/tifm_core.c b/drivers/misc/tifm_core.c
index 6b10ebe9d936..6799b9cca055 100644
--- a/drivers/misc/tifm_core.c
+++ b/drivers/misc/tifm_core.c
@@ -14,7 +14,7 @@
14#include <linux/idr.h> 14#include <linux/idr.h>
15 15
16#define DRIVER_NAME "tifm_core" 16#define DRIVER_NAME "tifm_core"
17#define DRIVER_VERSION "0.7" 17#define DRIVER_VERSION "0.8"
18 18
19static DEFINE_IDR(tifm_adapter_idr); 19static DEFINE_IDR(tifm_adapter_idr);
20static DEFINE_SPINLOCK(tifm_adapter_lock); 20static DEFINE_SPINLOCK(tifm_adapter_lock);
@@ -175,8 +175,7 @@ void tifm_free_device(struct device *dev)
175} 175}
176EXPORT_SYMBOL(tifm_free_device); 176EXPORT_SYMBOL(tifm_free_device);
177 177
178static void tifm_dummy_signal_irq(struct tifm_dev *sock, 178static void tifm_dummy_event(struct tifm_dev *sock)
179 unsigned int sock_irq_status)
180{ 179{
181 return; 180 return;
182} 181}
@@ -191,7 +190,8 @@ struct tifm_dev *tifm_alloc_device(struct tifm_adapter *fm)
191 dev->dev.parent = fm->dev; 190 dev->dev.parent = fm->dev;
192 dev->dev.bus = &tifm_bus_type; 191 dev->dev.bus = &tifm_bus_type;
193 dev->dev.release = tifm_free_device; 192 dev->dev.release = tifm_free_device;
194 dev->signal_irq = tifm_dummy_signal_irq; 193 dev->card_event = tifm_dummy_event;
194 dev->data_event = tifm_dummy_event;
195 } 195 }
196 return dev; 196 return dev;
197} 197}
@@ -249,7 +249,8 @@ static int tifm_device_remove(struct device *dev)
249 struct tifm_driver *drv = fm_dev->drv; 249 struct tifm_driver *drv = fm_dev->drv;
250 250
251 if (drv) { 251 if (drv) {
252 fm_dev->signal_irq = tifm_dummy_signal_irq; 252 fm_dev->card_event = tifm_dummy_event;
253 fm_dev->data_event = tifm_dummy_event;
253 if (drv->remove) 254 if (drv->remove)
254 drv->remove(fm_dev); 255 drv->remove(fm_dev);
255 fm_dev->drv = NULL; 256 fm_dev->drv = NULL;
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
22static int no_dma = 0; 22static int no_dma = 0;
23static int fixed_timeout = 0; 23static int fixed_timeout = 0;
@@ -316,24 +316,38 @@ change_state:
316} 316}
317 317
318/* Called from interrupt handler */ 318/* Called from interrupt handler */
319static void tifm_sd_signal_irq(struct tifm_dev *sock, 319static 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 */
341static 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);
384done: 397done:
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)
diff --git a/include/linux/tifm.h b/include/linux/tifm.h
index 3deb0a6c1370..4470961655c5 100644
--- a/include/linux/tifm.h
+++ b/include/linux/tifm.h
@@ -60,13 +60,6 @@ enum {
60 SOCK_MS_SYSTEM = 0x190, 60 SOCK_MS_SYSTEM = 0x190,
61 SOCK_FIFO_ACCESS = 0x200 }; 61 SOCK_FIFO_ACCESS = 0x200 };
62 62
63
64#define TIFM_IRQ_ENABLE 0x80000000
65#define TIFM_IRQ_SOCKMASK(x) (x)
66#define TIFM_IRQ_CARDMASK(x) ((x) << 8)
67#define TIFM_IRQ_FIFOMASK(x) ((x) << 16)
68#define TIFM_IRQ_SETALL 0xffffffff
69
70#define TIFM_CTRL_LED 0x00000040 63#define TIFM_CTRL_LED 0x00000040
71#define TIFM_CTRL_FAST_CLK 0x00000100 64#define TIFM_CTRL_FAST_CLK 0x00000100
72 65
@@ -90,8 +83,8 @@ struct tifm_dev {
90 tifm_media_id media_id; 83 tifm_media_id media_id;
91 unsigned int socket_id; 84 unsigned int socket_id;
92 85
93 void (*signal_irq)(struct tifm_dev *sock, 86 void (*card_event)(struct tifm_dev *sock);
94 unsigned int sock_irq_status); 87 void (*data_event)(struct tifm_dev *sock);
95 88
96 struct tifm_driver *drv; 89 struct tifm_driver *drv;
97 struct device dev; 90 struct device dev;