Lines Matching +full:mixed +full:- +full:burst
1 // SPDX-License-Identifier: GPL-2.0-only
39 MODULE_PARM_DESC(pwr_irqs_off, "Force IRQs off during power-on of slot. Use only when seeing IRQ st…
43 MODULE_PARM_DESC(o2_speedup, "Use prefetch/burst for O2-bridges: 'on', 'off' "
58 #define debug(x, s, args...) dev_dbg(&s->dev->dev, x, ##args)
80 * Generate easy-to-use ways of reading a cardbus sockets
86 u32 val = readl(socket->base + reg); in cb_readl()
94 writel(val, socket->base + reg); in cb_writel()
95 readl(socket->base + reg); /* avoid problems with PCI write posting */ in cb_writel()
101 pci_read_config_byte(socket->dev, offset, &val); in config_readb()
109 pci_read_config_word(socket->dev, offset, &val); in config_readw()
117 pci_read_config_dword(socket->dev, offset, &val); in config_readl()
125 pci_write_config_byte(socket->dev, offset, val); in config_writeb()
131 pci_write_config_word(socket->dev, offset, val); in config_writew()
137 pci_write_config_dword(socket->dev, offset, val); in config_writel()
142 u8 val = readb(socket->base + 0x800 + reg); in exca_readb()
151 val = readb(socket->base + 0x800 + reg);
152 val |= readb(socket->base + 0x800 + reg + 1) << 8;
161 writeb(val, socket->base + 0x800 + reg); in exca_writeb()
162 readb(socket->base + 0x800 + reg); /* PCI write posting... */ in exca_writeb()
168 writeb(val, socket->base + 0x800 + reg); in exca_writew()
169 writeb(val >> 8, socket->base + 0x800 + reg + 1); in exca_writew()
172 readb(socket->base + 0x800 + reg); in exca_writew()
173 readb(socket->base + 0x800 + reg + 1); in exca_writew()
195 memcpy(buf + offset, " -", 2); in show_yenta_registers()
210 * Ugh, mixed-mode cardbus and 16-bit pccard state: things depend
252 (socket->flags & YENTA_16BIT_POWER_EXCA)) { in yenta_set_power()
257 /* i82365SL-DF style */ in yenta_set_power()
258 if (socket->flags & YENTA_16BIT_POWER_DF) { in yenta_set_power()
259 switch (state->Vcc) { in yenta_set_power()
270 switch (state->Vpp) { in yenta_set_power()
280 /* i82365SL-B style */ in yenta_set_power()
281 switch (state->Vcc) { in yenta_set_power()
289 switch (state->Vpp) { in yenta_set_power()
303 switch (state->Vcc) { in yenta_set_power()
314 switch (state->Vpp) { in yenta_set_power()
336 if (state->Vcc == 0) in yenta_set_socket()
339 socket->io_irq = state->io_irq; in yenta_set_socket()
343 bridge |= (state->flags & SS_RESET) ? CB_BRIDGE_CRST : 0; in yenta_set_socket()
348 if (!socket->dev->irq) { in yenta_set_socket()
349 intr |= socket->cb_irq ? socket->cb_irq : state->io_irq; in yenta_set_socket()
357 reg |= (state->flags & SS_RESET) ? 0 : I365_PC_RESET; in yenta_set_socket()
358 reg |= (state->flags & SS_IOCARD) ? I365_PC_IOCARD : 0; in yenta_set_socket()
359 if (state->io_irq != socket->dev->irq) { in yenta_set_socket()
360 reg |= state->io_irq; in yenta_set_socket()
367 if (state->flags & SS_PWR_AUTO) in yenta_set_socket()
369 if (state->flags & SS_OUTPUT_ENA) in yenta_set_socket()
378 if (state->flags & SS_IOCARD) { in yenta_set_socket()
379 if (state->csc_mask & SS_STSCHG) in yenta_set_socket()
382 if (state->csc_mask & SS_BATDEAD) in yenta_set_socket()
384 if (state->csc_mask & SS_BATWARN) in yenta_set_socket()
386 if (state->csc_mask & SS_READY) in yenta_set_socket()
391 if (sock->zoom_video) in yenta_set_socket()
392 sock->zoom_video(sock, state->flags & SS_ZVCARD); in yenta_set_socket()
396 cb_writel(socket, CB_SOCKET_EVENT, -1); in yenta_set_socket()
400 if (state->Vcc != 0) in yenta_set_socket()
411 map = io->map; in yenta_set_io_map()
414 return -EINVAL; in yenta_set_io_map()
425 exca_writew(socket, I365_IO(map)+I365_W_START, io->start); in yenta_set_io_map()
426 exca_writew(socket, I365_IO(map)+I365_W_STOP, io->stop); in yenta_set_io_map()
429 if (io->flags & MAP_0WS) in yenta_set_io_map()
431 if (io->flags & MAP_16BIT) in yenta_set_io_map()
433 if (io->flags & MAP_AUTOSZ) in yenta_set_io_map()
437 if (io->flags & MAP_ACTIVE) in yenta_set_io_map()
451 pcibios_resource_to_bus(socket->dev->bus, ®ion, mem->res); in yenta_set_mem_map()
453 map = mem->map; in yenta_set_mem_map()
456 card_start = mem->card_start; in yenta_set_mem_map()
459 (card_start >> 26) || mem->speed > 1000) in yenta_set_mem_map()
460 return -EINVAL; in yenta_set_mem_map()
472 if (mem->flags & MAP_16BIT) in yenta_set_mem_map()
474 if (mem->flags & MAP_0WS) in yenta_set_mem_map()
479 switch (to_cycles(mem->speed)) { in yenta_set_mem_map()
494 word = ((card_start - start) >> 12) & 0x3fff; in yenta_set_mem_map()
495 if (mem->flags & MAP_WRPROT) in yenta_set_mem_map()
497 if (mem->flags & MAP_ATTRIB) in yenta_set_mem_map()
501 if (mem->flags & MAP_ACTIVE) in yenta_set_mem_map()
535 pcmcia_parse_events(&socket->socket, events); in yenta_interrupt()
545 socket->poll_timer.expires = jiffies + HZ; in yenta_interrupt_wrapper()
546 add_timer(&socket->poll_timer); in yenta_interrupt_wrapper()
556 yenta_set_socket(&socket->socket, &dead_socket); in yenta_clear_maps()
559 yenta_set_io_map(&socket->socket, &io); in yenta_clear_maps()
563 yenta_set_mem_map(&socket->socket, &mem); in yenta_clear_maps()
592 if (socket->type && socket->type->sock_init) in yenta_sock_init()
593 socket->type->sock_init(socket); in yenta_sock_init()
595 /* Re-enable CSC interrupts */ in yenta_sock_init()
635 if (res->flags & IORESOURCE_IO) { in yenta_search_one_res()
641 unsigned long avail = root->end - root->start; in yenta_search_one_res()
678 pci_bus_for_each_resource(socket->dev->bus, root, i) { in yenta_search_res()
682 if ((res->flags ^ root->flags) & in yenta_search_res()
694 struct pci_dev *dev = socket->dev; in yenta_allocate_res()
699 res = &dev->resource[nr]; in yenta_allocate_res()
701 if (res->parent) in yenta_allocate_res()
709 res->name = dev->subordinate->name; in yenta_allocate_res()
710 res->flags = type; in yenta_allocate_res()
715 pcibios_bus_to_resource(dev->bus, res, ®ion); in yenta_allocate_res()
718 dev_info(&dev->dev, in yenta_allocate_res()
734 /* Approximating prefetchable by non-prefetchable */ in yenta_allocate_res()
735 res->flags = IORESOURCE_MEM; in yenta_allocate_res()
743 dev_info(&dev->dev, in yenta_allocate_res()
746 res->start = res->end = res->flags = 0; in yenta_allocate_res()
752 struct pci_dev *dev = socket->dev; in yenta_free_res()
755 res = &dev->resource[nr]; in yenta_free_res()
756 if (res->start != 0 && res->end != 0) in yenta_free_res()
759 res->start = res->end = res->flags = 0; in yenta_free_res()
781 pci_setup_cardbus(socket->dev->subordinate); in yenta_allocate_resources()
798 * Close it down - release our resources and go home..
805 device_remove_file(&dev->dev, &dev_attr_yenta_registers); in yenta_close()
808 pcmcia_unregister_socket(&sock->socket); in yenta_close()
814 if (sock->cb_irq) in yenta_close()
815 free_irq(sock->cb_irq, sock); in yenta_close()
817 del_timer_sync(&sock->poll_timer); in yenta_close()
819 iounmap(sock->base); in yenta_close()
853 CARDBUS_TYPE_DEFAULT = -1,
937 cb_writel(socket, CB_SOCKET_EVENT, -1); in yenta_probe_irq()
948 cb_writel(socket, CB_SOCKET_EVENT, -1); in yenta_probe_irq()
974 cb_writel(socket, CB_SOCKET_EVENT, -1); in yenta_probe_handler()
978 socket->probe_status = 1; in yenta_probe_handler()
990 if (!socket->cb_irq) in yenta_probe_cb_irq()
991 return -1; in yenta_probe_cb_irq()
993 socket->probe_status = 0; in yenta_probe_cb_irq()
995 if (request_irq(socket->cb_irq, yenta_probe_handler, IRQF_SHARED, "yenta", socket)) { in yenta_probe_cb_irq()
996 dev_warn(&socket->dev->dev, in yenta_probe_cb_irq()
998 return -1; in yenta_probe_cb_irq()
1002 if (!socket->dev->irq) in yenta_probe_cb_irq()
1005 cb_writel(socket, CB_SOCKET_EVENT, -1); in yenta_probe_cb_irq()
1014 cb_writel(socket, CB_SOCKET_EVENT, -1); in yenta_probe_cb_irq()
1017 free_irq(socket->cb_irq, socket); in yenta_probe_cb_irq()
1019 return (int) socket->probe_status; in yenta_probe_cb_irq()
1026 * Set static data that doesn't need re-initializing..
1030 socket->socket.pci_irq = socket->cb_irq; in yenta_get_socket_capabilities()
1032 socket->socket.irq_mask = yenta_probe_irq(socket, isa_irq_mask); in yenta_get_socket_capabilities()
1034 socket->socket.irq_mask = 0; in yenta_get_socket_capabilities()
1036 dev_info(&socket->dev->dev, "ISA IRQ mask 0x%04x, PCI irq %d\n", in yenta_get_socket_capabilities()
1037 socket->socket.irq_mask, socket->cb_irq); in yenta_get_socket_capabilities()
1046 struct pci_dev *dev = socket->dev; in yenta_config_init()
1049 pcibios_resource_to_bus(socket->dev->bus, ®ion, &dev->resource[0]); in yenta_config_init()
1064 ((unsigned int)dev->subordinate->busn_res.end << 16) | /* subordinate bus */ in yenta_config_init()
1065 ((unsigned int)dev->subordinate->busn_res.start << 8) | /* secondary bus */ in yenta_config_init()
1066 dev->subordinate->primary); /* primary bus */ in yenta_config_init()
1070 * - enable write posting. in yenta_config_init()
1071 * - memory window 0 prefetchable, window 1 non-prefetchable in yenta_config_init()
1072 * - PCI interrupts enabled if a PCI interrupt exists.. in yenta_config_init()
1081 * yenta_fixup_parent_bridge - Fix subordinate bus# of the parent bridge
1086 * of the parent brige - some BIOSes seem to be too lazy to set it right.
1099 struct pci_bus *bridge_to_fix = cardbus_bridge->parent; in yenta_fixup_parent_bridge()
1102 if (bridge_to_fix->busn_res.end >= cardbus_bridge->busn_res.end) in yenta_fixup_parent_bridge()
1105 if (!bridge_to_fix->parent) in yenta_fixup_parent_bridge()
1109 upper_limit = bridge_to_fix->parent->busn_res.end; in yenta_fixup_parent_bridge()
1112 list_for_each_entry(sibling, &bridge_to_fix->parent->children, in yenta_fixup_parent_bridge()
1120 if (sibling->busn_res.start > bridge_to_fix->busn_res.end in yenta_fixup_parent_bridge()
1121 && sibling->busn_res.start <= upper_limit) in yenta_fixup_parent_bridge()
1122 upper_limit = sibling->busn_res.start - 1; in yenta_fixup_parent_bridge()
1126 if (cardbus_bridge->busn_res.end > upper_limit) in yenta_fixup_parent_bridge()
1127 dev_warn(&cardbus_bridge->dev, in yenta_fixup_parent_bridge()
1132 if (bridge_to_fix->busn_res.end < upper_limit) { in yenta_fixup_parent_bridge()
1136 min_t(int, cardbus_bridge->busn_res.end, upper_limit); in yenta_fixup_parent_bridge()
1138 dev_info(&bridge_to_fix->dev, in yenta_fixup_parent_bridge()
1140 bridge_to_fix->number, in yenta_fixup_parent_bridge()
1141 (int)bridge_to_fix->busn_res.end, in yenta_fixup_parent_bridge()
1145 bridge_to_fix->busn_res.end = subordinate_to_assign; in yenta_fixup_parent_bridge()
1148 pci_write_config_byte(bridge_to_fix->self, in yenta_fixup_parent_bridge()
1149 PCI_SUBORDINATE_BUS, bridge_to_fix->busn_res.end); in yenta_fixup_parent_bridge()
1168 if (!dev->subordinate) { in yenta_probe()
1169 dev_err(&dev->dev, "no bus associated! (try 'pci=assign-busses')\n"); in yenta_probe()
1170 return -ENODEV; in yenta_probe()
1175 return -ENOMEM; in yenta_probe()
1178 socket->socket.ops = ¥ta_socket_operations; in yenta_probe()
1179 socket->socket.resource_ops = &pccard_nonstatic_ops; in yenta_probe()
1180 socket->socket.dev.parent = &dev->dev; in yenta_probe()
1181 socket->socket.driver_data = socket; in yenta_probe()
1182 socket->socket.owner = THIS_MODULE; in yenta_probe()
1183 socket->socket.features = SS_CAP_PAGE_REGS | SS_CAP_PCCARD; in yenta_probe()
1184 socket->socket.map_size = 0x1000; in yenta_probe()
1185 socket->socket.cb_dev = dev; in yenta_probe()
1188 socket->dev = dev; in yenta_probe()
1195 ret = -EBUSY; in yenta_probe()
1204 dev_err(&dev->dev, "No cardbus resource!\n"); in yenta_probe()
1205 ret = -ENODEV; in yenta_probe()
1213 socket->base = ioremap(pci_resource_start(dev, 0), 0x1000); in yenta_probe()
1214 if (!socket->base) { in yenta_probe()
1215 ret = -ENOMEM; in yenta_probe()
1223 dev_info(&dev->dev, "CardBus bridge found [%04x:%04x]\n", in yenta_probe()
1224 dev->subsystem_vendor, dev->subsystem_device); in yenta_probe()
1234 socket->cb_irq = dev->irq; in yenta_probe()
1237 if (id->driver_data != CARDBUS_TYPE_DEFAULT && in yenta_probe()
1238 id->driver_data < ARRAY_SIZE(cardbus_type)) { in yenta_probe()
1239 socket->type = &cardbus_type[id->driver_data]; in yenta_probe()
1241 ret = socket->type->override(socket); in yenta_probe()
1248 …if (!socket->cb_irq || request_irq(socket->cb_irq, yenta_interrupt, IRQF_SHARED, "yenta", socket))… in yenta_probe()
1250 socket->cb_irq = 0; /* But zero is a valid IRQ number. */ in yenta_probe()
1251 timer_setup(&socket->poll_timer, yenta_interrupt_wrapper, 0); in yenta_probe()
1252 mod_timer(&socket->poll_timer, jiffies + HZ); in yenta_probe()
1253 dev_info(&dev->dev, in yenta_probe()
1255 dev_info(&dev->dev, in yenta_probe()
1258 socket->socket.features |= SS_CAP_CARDBUS; in yenta_probe()
1264 dev_info(&dev->dev, "Socket status: %08x\n", in yenta_probe()
1267 yenta_fixup_parent_bridge(dev->subordinate); in yenta_probe()
1270 ret = pcmcia_register_socket(&socket->socket); in yenta_probe()
1275 ret = device_create_file(&dev->dev, &dev_attr_yenta_registers); in yenta_probe()
1283 pcmcia_unregister_socket(&socket->socket); in yenta_probe()
1285 if (socket->cb_irq) in yenta_probe()
1286 free_irq(socket->cb_irq, socket); in yenta_probe()
1288 del_timer_sync(&socket->poll_timer); in yenta_probe()
1290 iounmap(socket->base); in yenta_probe()
1311 if (socket->type && socket->type->save_state) in yenta_dev_suspend_noirq()
1312 socket->type->save_state(socket); in yenta_dev_suspend_noirq()
1315 pci_read_config_dword(pdev, 16*4, &socket->saved_state[0]); in yenta_dev_suspend_noirq()
1316 pci_read_config_dword(pdev, 17*4, &socket->saved_state[1]); in yenta_dev_suspend_noirq()
1331 pci_write_config_dword(pdev, 16*4, socket->saved_state[0]); in yenta_dev_resume_noirq()
1332 pci_write_config_dword(pdev, 17*4, socket->saved_state[1]); in yenta_dev_resume_noirq()
1340 if (socket->type && socket->type->restore_state) in yenta_dev_resume_noirq()
1341 socket->type->restore_state(socket); in yenta_dev_resume_noirq()
1372 * data sheets for these devices. --rmk)