14 #include <linux/module.h>
16 #define DRIVER_NAME "tifm_7xx1"
17 #define DRIVER_VERSION "0.8"
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
37 spin_unlock_irqrestore(&fm->
lock, flags);
44 unsigned int irq_status,
cnt;
48 if (irq_status == 0 || irq_status == (~0)) {
49 spin_unlock(&fm->
lock);
78 spin_unlock(&fm->
lock);
82 static unsigned char tifm_7xx1_toggle_sock_power(
char __iomem *sock_addr)
89 for (cnt = 16; cnt <= 256; cnt <<= 1) {
113 for (cnt = 16; cnt <= 256; cnt <<= 1) {
127 inline static void tifm_7xx1_sock_power_off(
char __iomem *sock_addr)
134 tifm_7xx1_sock_addr(
char __iomem *base_addr,
unsigned int sock_num)
136 return base_addr + ((sock_num + 1) << 10);
146 unsigned char media_id;
147 unsigned int socket_change_set,
cnt;
153 dev_dbg(fm->
dev.parent,
"checking media set %x\n",
156 if (!socket_change_set) {
157 spin_unlock_irqrestore(&fm->
lock, flags);
162 if (!(socket_change_set & (1 << cnt)))
167 "%s : demand removing card from socket %u:%u\n",
168 dev_name(&fm->
dev), fm->
id, cnt);
170 sock_addr = sock->
addr;
171 spin_unlock_irqrestore(&fm->
lock, flags);
174 tifm_7xx1_sock_power_off(sock_addr);
178 spin_unlock_irqrestore(&fm->
lock, flags);
180 media_id = tifm_7xx1_toggle_sock_power(
181 tifm_7xx1_sock_addr(fm->
addr, cnt));
186 sock->
addr = tifm_7xx1_sock_addr(fm->
addr, cnt);
194 spin_unlock_irqrestore(&fm->
lock, flags);
211 spin_unlock_irqrestore(&fm->
lock, flags);
225 tifm_7xx1_sock_power_off(fm->
sockets[cnt]->addr);
239 unsigned int good_sockets = 0, bad_sockets = 0;
254 new_ids[rc] = tifm_7xx1_toggle_sock_power(
255 tifm_7xx1_sock_addr(fm->
addr, rc));
259 if (fm->
sockets[rc]->type == new_ids[rc])
260 good_sockets |= 1 <<
rc;
262 bad_sockets |= 1 <<
rc;
268 dev_dbg(&dev->
dev,
"change sets on resume: good %x, bad %x\n",
269 good_sockets, bad_sockets);
274 spin_unlock_irqrestore(&fm->
lock, flags);
292 spin_unlock_irqrestore(&fm->
lock, flags);
301 #define tifm_7xx1_suspend NULL
302 #define tifm_7xx1_resume NULL
306 static int tifm_7xx1_dummy_has_ms_pif(
struct tifm_adapter *fm,
321 static int tifm_7xx1_probe(
struct pci_dev *dev,
325 int pci_dev_busy = 0;
354 fm->
eject = tifm_7xx1_eject;
356 pci_set_drvdata(dev, fm);
381 pci_set_drvdata(dev,
NULL);
392 static void tifm_7xx1_remove(
struct pci_dev *dev)
397 fm->
eject = tifm_7xx1_dummy_eject;
406 tifm_7xx1_sock_power_off(tifm_7xx1_sock_addr(fm->
addr, cnt));
408 pci_set_drvdata(dev,
NULL);
430 .id_table = tifm_7xx1_pci_tbl,
431 .probe = tifm_7xx1_probe,
432 .remove = tifm_7xx1_remove,