Lines Matching refs:fm
21 static void tifm_7xx1_dummy_eject(struct tifm_adapter *fm, in tifm_7xx1_dummy_eject() argument
26 static void tifm_7xx1_eject(struct tifm_adapter *fm, struct tifm_dev *sock) in tifm_7xx1_eject() argument
30 spin_lock_irqsave(&fm->lock, flags); in tifm_7xx1_eject()
31 fm->socket_change_set |= 1 << sock->socket_id; in tifm_7xx1_eject()
32 tifm_queue_work(&fm->media_switcher); in tifm_7xx1_eject()
33 spin_unlock_irqrestore(&fm->lock, flags); in tifm_7xx1_eject()
38 struct tifm_adapter *fm = dev_id; in tifm_7xx1_isr() local
42 spin_lock(&fm->lock); in tifm_7xx1_isr()
43 irq_status = readl(fm->addr + FM_INTERRUPT_STATUS); in tifm_7xx1_isr()
45 spin_unlock(&fm->lock); in tifm_7xx1_isr()
50 writel(TIFM_IRQ_ENABLE, fm->addr + FM_CLEAR_INTERRUPT_ENABLE); in tifm_7xx1_isr()
52 for (cnt = 0; cnt < fm->num_sockets; cnt++) { in tifm_7xx1_isr()
53 sock = fm->sockets[cnt]; in tifm_7xx1_isr()
62 fm->socket_change_set |= irq_status in tifm_7xx1_isr()
63 & ((1 << fm->num_sockets) - 1); in tifm_7xx1_isr()
65 writel(irq_status, fm->addr + FM_INTERRUPT_STATUS); in tifm_7xx1_isr()
67 if (fm->finish_me) in tifm_7xx1_isr()
68 complete_all(fm->finish_me); in tifm_7xx1_isr()
69 else if (!fm->socket_change_set) in tifm_7xx1_isr()
70 writel(TIFM_IRQ_ENABLE, fm->addr + FM_SET_INTERRUPT_ENABLE); in tifm_7xx1_isr()
72 tifm_queue_work(&fm->media_switcher); in tifm_7xx1_isr()
74 spin_unlock(&fm->lock); in tifm_7xx1_isr()
137 struct tifm_adapter *fm = container_of(work, struct tifm_adapter, in tifm_7xx1_switch_media() local
145 spin_lock_irqsave(&fm->lock, flags); in tifm_7xx1_switch_media()
146 socket_change_set = fm->socket_change_set; in tifm_7xx1_switch_media()
147 fm->socket_change_set = 0; in tifm_7xx1_switch_media()
149 dev_dbg(fm->dev.parent, "checking media set %x\n", in tifm_7xx1_switch_media()
153 spin_unlock_irqrestore(&fm->lock, flags); in tifm_7xx1_switch_media()
157 for (cnt = 0; cnt < fm->num_sockets; cnt++) { in tifm_7xx1_switch_media()
160 sock = fm->sockets[cnt]; in tifm_7xx1_switch_media()
164 dev_name(&fm->dev), fm->id, cnt); in tifm_7xx1_switch_media()
165 fm->sockets[cnt] = NULL; in tifm_7xx1_switch_media()
167 spin_unlock_irqrestore(&fm->lock, flags); in tifm_7xx1_switch_media()
169 spin_lock_irqsave(&fm->lock, flags); in tifm_7xx1_switch_media()
174 spin_unlock_irqrestore(&fm->lock, flags); in tifm_7xx1_switch_media()
177 tifm_7xx1_sock_addr(fm->addr, cnt)); in tifm_7xx1_switch_media()
180 sock = tifm_alloc_device(fm, cnt, media_id); in tifm_7xx1_switch_media()
182 sock->addr = tifm_7xx1_sock_addr(fm->addr, cnt); in tifm_7xx1_switch_media()
185 spin_lock_irqsave(&fm->lock, flags); in tifm_7xx1_switch_media()
186 if (!fm->sockets[cnt]) { in tifm_7xx1_switch_media()
187 fm->sockets[cnt] = sock; in tifm_7xx1_switch_media()
190 spin_unlock_irqrestore(&fm->lock, flags); in tifm_7xx1_switch_media()
195 spin_lock_irqsave(&fm->lock, flags); in tifm_7xx1_switch_media()
200 fm->addr + FM_CLEAR_INTERRUPT_ENABLE); in tifm_7xx1_switch_media()
204 fm->addr + FM_SET_INTERRUPT_ENABLE); in tifm_7xx1_switch_media()
206 writel(TIFM_IRQ_ENABLE, fm->addr + FM_SET_INTERRUPT_ENABLE); in tifm_7xx1_switch_media()
207 spin_unlock_irqrestore(&fm->lock, flags); in tifm_7xx1_switch_media()
213 struct tifm_adapter *fm = pci_get_drvdata(dev); in tifm_7xx1_suspend() local
218 for (cnt = 0; cnt < fm->num_sockets; cnt++) { in tifm_7xx1_suspend()
219 if (fm->sockets[cnt]) in tifm_7xx1_suspend()
220 tifm_7xx1_sock_power_off(fm->sockets[cnt]->addr); in tifm_7xx1_suspend()
230 struct tifm_adapter *fm = pci_get_drvdata(dev); in tifm_7xx1_resume() local
239 if (WARN_ON(fm->num_sockets > ARRAY_SIZE(new_ids))) in tifm_7xx1_resume()
246 for (rc = 0; rc < fm->num_sockets; rc++) in tifm_7xx1_resume()
248 tifm_7xx1_sock_addr(fm->addr, rc)); in tifm_7xx1_resume()
249 spin_lock_irqsave(&fm->lock, flags); in tifm_7xx1_resume()
250 for (rc = 0; rc < fm->num_sockets; rc++) { in tifm_7xx1_resume()
251 if (fm->sockets[rc]) { in tifm_7xx1_resume()
252 if (fm->sockets[rc]->type == new_ids[rc]) in tifm_7xx1_resume()
259 writel(TIFM_IRQ_ENABLE | TIFM_IRQ_SOCKMASK((1 << fm->num_sockets) - 1), in tifm_7xx1_resume()
260 fm->addr + FM_SET_INTERRUPT_ENABLE); in tifm_7xx1_resume()
264 fm->socket_change_set = 0; in tifm_7xx1_resume()
266 fm->finish_me = &finish_resume; in tifm_7xx1_resume()
267 spin_unlock_irqrestore(&fm->lock, flags); in tifm_7xx1_resume()
272 fm->addr + FM_CLEAR_INTERRUPT_ENABLE); in tifm_7xx1_resume()
275 fm->addr + FM_SET_INTERRUPT_ENABLE); in tifm_7xx1_resume()
276 spin_lock_irqsave(&fm->lock, flags); in tifm_7xx1_resume()
277 fm->finish_me = NULL; in tifm_7xx1_resume()
278 fm->socket_change_set ^= good_sockets & fm->socket_change_set; in tifm_7xx1_resume()
281 fm->socket_change_set |= bad_sockets; in tifm_7xx1_resume()
282 if (fm->socket_change_set) in tifm_7xx1_resume()
283 tifm_queue_work(&fm->media_switcher); in tifm_7xx1_resume()
285 spin_unlock_irqrestore(&fm->lock, flags); in tifm_7xx1_resume()
287 fm->addr + FM_SET_INTERRUPT_ENABLE); in tifm_7xx1_resume()
292 static int tifm_7xx1_dummy_has_ms_pif(struct tifm_adapter *fm, in tifm_7xx1_dummy_has_ms_pif() argument
298 static int tifm_7xx1_has_ms_pif(struct tifm_adapter *fm, struct tifm_dev *sock) in tifm_7xx1_has_ms_pif() argument
300 if (((fm->num_sockets == 4) && (sock->socket_id == 2)) in tifm_7xx1_has_ms_pif()
301 || ((fm->num_sockets == 2) && (sock->socket_id == 0))) in tifm_7xx1_has_ms_pif()
310 struct tifm_adapter *fm; in tifm_7xx1_probe() local
332 fm = tifm_alloc_adapter(dev->device == PCI_DEVICE_ID_TI_XX21_XX11_FM in tifm_7xx1_probe()
334 if (!fm) { in tifm_7xx1_probe()
339 INIT_WORK(&fm->media_switcher, tifm_7xx1_switch_media); in tifm_7xx1_probe()
340 fm->eject = tifm_7xx1_eject; in tifm_7xx1_probe()
341 fm->has_ms_pif = tifm_7xx1_has_ms_pif; in tifm_7xx1_probe()
342 pci_set_drvdata(dev, fm); in tifm_7xx1_probe()
344 fm->addr = pci_ioremap_bar(dev, 0); in tifm_7xx1_probe()
345 if (!fm->addr) { in tifm_7xx1_probe()
350 rc = request_irq(dev->irq, tifm_7xx1_isr, IRQF_SHARED, DRIVER_NAME, fm); in tifm_7xx1_probe()
354 rc = tifm_add_adapter(fm); in tifm_7xx1_probe()
358 writel(TIFM_IRQ_ENABLE | TIFM_IRQ_SOCKMASK((1 << fm->num_sockets) - 1), in tifm_7xx1_probe()
359 fm->addr + FM_CLEAR_INTERRUPT_ENABLE); in tifm_7xx1_probe()
360 writel(TIFM_IRQ_ENABLE | TIFM_IRQ_SOCKMASK((1 << fm->num_sockets) - 1), in tifm_7xx1_probe()
361 fm->addr + FM_SET_INTERRUPT_ENABLE); in tifm_7xx1_probe()
365 free_irq(dev->irq, fm); in tifm_7xx1_probe()
367 iounmap(fm->addr); in tifm_7xx1_probe()
369 tifm_free_adapter(fm); in tifm_7xx1_probe()
381 struct tifm_adapter *fm = pci_get_drvdata(dev); in tifm_7xx1_remove() local
384 fm->eject = tifm_7xx1_dummy_eject; in tifm_7xx1_remove()
385 fm->has_ms_pif = tifm_7xx1_dummy_has_ms_pif; in tifm_7xx1_remove()
386 writel(TIFM_IRQ_SETALL, fm->addr + FM_CLEAR_INTERRUPT_ENABLE); in tifm_7xx1_remove()
387 free_irq(dev->irq, fm); in tifm_7xx1_remove()
389 tifm_remove_adapter(fm); in tifm_7xx1_remove()
391 for (cnt = 0; cnt < fm->num_sockets; cnt++) in tifm_7xx1_remove()
392 tifm_7xx1_sock_power_off(tifm_7xx1_sock_addr(fm->addr, cnt)); in tifm_7xx1_remove()
394 iounmap(fm->addr); in tifm_7xx1_remove()
399 tifm_free_adapter(fm); in tifm_7xx1_remove()