diff options
Diffstat (limited to 'drivers/misc')
-rw-r--r-- | drivers/misc/tifm_7xx1.c | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/drivers/misc/tifm_7xx1.c b/drivers/misc/tifm_7xx1.c index ea6ad9f2d245..e21e490fedb0 100644 --- a/drivers/misc/tifm_7xx1.c +++ b/drivers/misc/tifm_7xx1.c | |||
@@ -43,7 +43,7 @@ static irqreturn_t tifm_7xx1_isr(int irq, void *dev_id) | |||
43 | if (irq_status & TIFM_IRQ_ENABLE) { | 43 | if (irq_status & TIFM_IRQ_ENABLE) { |
44 | writel(TIFM_IRQ_ENABLE, fm->addr + FM_CLEAR_INTERRUPT_ENABLE); | 44 | writel(TIFM_IRQ_ENABLE, fm->addr + FM_CLEAR_INTERRUPT_ENABLE); |
45 | 45 | ||
46 | for (cnt = 0; cnt < fm->num_sockets; cnt++) { | 46 | for (cnt = 0; cnt < fm->num_sockets; cnt++) { |
47 | sock = fm->sockets[cnt]; | 47 | sock = fm->sockets[cnt]; |
48 | sock_irq_status = (irq_status >> cnt) | 48 | sock_irq_status = (irq_status >> cnt) |
49 | & (TIFM_IRQ_FIFOMASK(1) | 49 | & (TIFM_IRQ_FIFOMASK(1) |
@@ -53,8 +53,8 @@ static irqreturn_t tifm_7xx1_isr(int irq, void *dev_id) | |||
53 | sock->signal_irq(sock, sock_irq_status); | 53 | sock->signal_irq(sock, sock_irq_status); |
54 | } | 54 | } |
55 | 55 | ||
56 | fm->socket_change_set |= irq_status | 56 | fm->socket_change_set |= irq_status |
57 | & ((1 << fm->num_sockets) - 1); | 57 | & ((1 << fm->num_sockets) - 1); |
58 | } | 58 | } |
59 | writel(irq_status, fm->addr + FM_INTERRUPT_STATUS); | 59 | writel(irq_status, fm->addr + FM_INTERRUPT_STATUS); |
60 | 60 | ||
@@ -67,7 +67,8 @@ static irqreturn_t tifm_7xx1_isr(int irq, void *dev_id) | |||
67 | return IRQ_HANDLED; | 67 | return IRQ_HANDLED; |
68 | } | 68 | } |
69 | 69 | ||
70 | static tifm_media_id tifm_7xx1_toggle_sock_power(char __iomem *sock_addr, int is_x2) | 70 | static tifm_media_id tifm_7xx1_toggle_sock_power(char __iomem *sock_addr, |
71 | int is_x2) | ||
71 | { | 72 | { |
72 | unsigned int s_state; | 73 | unsigned int s_state; |
73 | int cnt; | 74 | int cnt; |
@@ -75,8 +76,8 @@ static tifm_media_id tifm_7xx1_toggle_sock_power(char __iomem *sock_addr, int is | |||
75 | writel(0x0e00, sock_addr + SOCK_CONTROL); | 76 | writel(0x0e00, sock_addr + SOCK_CONTROL); |
76 | 77 | ||
77 | for (cnt = 0; cnt < 100; cnt++) { | 78 | for (cnt = 0; cnt < 100; cnt++) { |
78 | if (!(TIFM_SOCK_STATE_POWERED & | 79 | if (!(TIFM_SOCK_STATE_POWERED |
79 | readl(sock_addr + SOCK_PRESENT_STATE))) | 80 | & readl(sock_addr + SOCK_PRESENT_STATE))) |
80 | break; | 81 | break; |
81 | msleep(10); | 82 | msleep(10); |
82 | } | 83 | } |
@@ -99,8 +100,8 @@ static tifm_media_id tifm_7xx1_toggle_sock_power(char __iomem *sock_addr, int is | |||
99 | } | 100 | } |
100 | 101 | ||
101 | for (cnt = 0; cnt < 100; cnt++) { | 102 | for (cnt = 0; cnt < 100; cnt++) { |
102 | if ((TIFM_SOCK_STATE_POWERED & | 103 | if ((TIFM_SOCK_STATE_POWERED |
103 | readl(sock_addr + SOCK_PRESENT_STATE))) | 104 | & readl(sock_addr + SOCK_PRESENT_STATE))) |
104 | break; | 105 | break; |
105 | msleep(10); | 106 | msleep(10); |
106 | } | 107 | } |
@@ -176,7 +177,7 @@ static int tifm_7xx1_switch_media(void *data) | |||
176 | sock = tifm_alloc_device(fm); | 177 | sock = tifm_alloc_device(fm); |
177 | if (sock) { | 178 | if (sock) { |
178 | sock->addr = tifm_7xx1_sock_addr(fm->addr, | 179 | sock->addr = tifm_7xx1_sock_addr(fm->addr, |
179 | cnt); | 180 | cnt); |
180 | sock->media_id = media_id; | 181 | sock->media_id = media_id; |
181 | sock->socket_id = cnt; | 182 | sock->socket_id = cnt; |
182 | switch (media_id) { | 183 | switch (media_id) { |
@@ -195,10 +196,11 @@ static int tifm_7xx1_switch_media(void *data) | |||
195 | continue; | 196 | continue; |
196 | } | 197 | } |
197 | snprintf(sock->dev.bus_id, BUS_ID_SIZE, | 198 | snprintf(sock->dev.bus_id, BUS_ID_SIZE, |
198 | "tifm_%s%u:%u", card_name, fm->id, cnt); | 199 | "tifm_%s%u:%u", card_name, |
200 | fm->id, cnt); | ||
199 | printk(KERN_INFO DRIVER_NAME | 201 | printk(KERN_INFO DRIVER_NAME |
200 | ": %s card detected in socket %d\n", | 202 | ": %s card detected in socket %d\n", |
201 | card_name, cnt); | 203 | card_name, cnt); |
202 | if (!device_register(&sock->dev)) { | 204 | if (!device_register(&sock->dev)) { |
203 | spin_lock_irqsave(&fm->lock, flags); | 205 | spin_lock_irqsave(&fm->lock, flags); |
204 | if (!fm->sockets[cnt]) { | 206 | if (!fm->sockets[cnt]) { |
@@ -319,7 +321,7 @@ static int tifm_7xx1_resume(struct pci_dev *dev) | |||
319 | #endif /* CONFIG_PM */ | 321 | #endif /* CONFIG_PM */ |
320 | 322 | ||
321 | static int tifm_7xx1_probe(struct pci_dev *dev, | 323 | static int tifm_7xx1_probe(struct pci_dev *dev, |
322 | const struct pci_device_id *dev_id) | 324 | const struct pci_device_id *dev_id) |
323 | { | 325 | { |
324 | struct tifm_adapter *fm; | 326 | struct tifm_adapter *fm; |
325 | int pci_dev_busy = 0; | 327 | int pci_dev_busy = 0; |
@@ -353,7 +355,7 @@ static int tifm_7xx1_probe(struct pci_dev *dev, | |||
353 | fm->num_sockets = (dev->device == PCI_DEVICE_ID_TI_XX21_XX11_FM) | 355 | fm->num_sockets = (dev->device == PCI_DEVICE_ID_TI_XX21_XX11_FM) |
354 | ? 4 : 2; | 356 | ? 4 : 2; |
355 | fm->sockets = kzalloc(sizeof(struct tifm_dev*) * fm->num_sockets, | 357 | fm->sockets = kzalloc(sizeof(struct tifm_dev*) * fm->num_sockets, |
356 | GFP_KERNEL); | 358 | GFP_KERNEL); |
357 | if (!fm->sockets) | 359 | if (!fm->sockets) |
358 | goto err_out_free; | 360 | goto err_out_free; |
359 | 361 | ||
@@ -361,7 +363,7 @@ static int tifm_7xx1_probe(struct pci_dev *dev, | |||
361 | pci_set_drvdata(dev, fm); | 363 | pci_set_drvdata(dev, fm); |
362 | 364 | ||
363 | fm->addr = ioremap(pci_resource_start(dev, 0), | 365 | fm->addr = ioremap(pci_resource_start(dev, 0), |
364 | pci_resource_len(dev, 0)); | 366 | pci_resource_len(dev, 0)); |
365 | if (!fm->addr) | 367 | if (!fm->addr) |
366 | goto err_out_free; | 368 | goto err_out_free; |
367 | 369 | ||
@@ -376,7 +378,7 @@ static int tifm_7xx1_probe(struct pci_dev *dev, | |||
376 | 378 | ||
377 | writel(TIFM_IRQ_SETALL, fm->addr + FM_CLEAR_INTERRUPT_ENABLE); | 379 | writel(TIFM_IRQ_SETALL, fm->addr + FM_CLEAR_INTERRUPT_ENABLE); |
378 | writel(TIFM_IRQ_ENABLE | TIFM_IRQ_SOCKMASK((1 << fm->num_sockets) - 1), | 380 | writel(TIFM_IRQ_ENABLE | TIFM_IRQ_SOCKMASK((1 << fm->num_sockets) - 1), |
379 | fm->addr + FM_SET_INTERRUPT_ENABLE); | 381 | fm->addr + FM_SET_INTERRUPT_ENABLE); |
380 | wake_up_process(fm->media_switcher); | 382 | wake_up_process(fm->media_switcher); |
381 | return 0; | 383 | return 0; |
382 | 384 | ||