Lines Matching +full:tie +full:- +full:off

4     integrated SOCs like the SA-11x0 and PXA2xx microprocessors.
71 printk(KERN_DEBUG "skt%u: %s: %pV", skt->nr, func, &vaf); in soc_pcmcia_debug()
89 if (!r->reg) in soc_pcmcia_regulator_set()
93 if (r->on == on) in soc_pcmcia_regulator_set()
97 ret = regulator_set_voltage(r->reg, v * 100000, v * 100000); in soc_pcmcia_regulator_set()
99 int vout = regulator_get_voltage(r->reg) / 100000; in soc_pcmcia_regulator_set()
101 dev_warn(&skt->socket.dev, in soc_pcmcia_regulator_set()
103 r == &skt->vcc ? "Vcc" : "Vpp", in soc_pcmcia_regulator_set()
107 ret = regulator_enable(r->reg); in soc_pcmcia_regulator_set()
109 ret = regulator_disable(r->reg); in soc_pcmcia_regulator_set()
112 r->on = on; in soc_pcmcia_regulator_set()
136 timing->io = in soc_common_pcmcia_get_timing()
137 calc_speed(skt->spd_io, MAX_IO_WIN, SOC_PCMCIA_IO_ACCESS); in soc_common_pcmcia_get_timing()
138 timing->mem = in soc_common_pcmcia_get_timing()
139 calc_speed(skt->spd_mem, MAX_WIN, SOC_PCMCIA_3V_MEM_ACCESS); in soc_common_pcmcia_get_timing()
140 timing->attr = in soc_common_pcmcia_get_timing()
141 calc_speed(skt->spd_attr, MAX_WIN, SOC_PCMCIA_3V_MEM_ACCESS); in soc_common_pcmcia_get_timing()
151 if (skt->stat[i].irq) in __soc_pcmcia_hw_shutdown()
152 free_irq(skt->stat[i].irq, skt); in __soc_pcmcia_hw_shutdown()
154 if (skt->ops->hw_shutdown) in __soc_pcmcia_hw_shutdown()
155 skt->ops->hw_shutdown(skt); in __soc_pcmcia_hw_shutdown()
157 clk_disable_unprepare(skt->clk); in __soc_pcmcia_hw_shutdown()
162 __soc_pcmcia_hw_shutdown(skt, ARRAY_SIZE(skt->stat)); in soc_pcmcia_hw_shutdown()
167 struct device *dev = skt->socket.dev.parent; in soc_pcmcia_request_gpiods()
171 for (i = 0; i < ARRAY_SIZE(skt->stat); i++) { in soc_pcmcia_request_gpiods()
172 if (!skt->stat[i].name) in soc_pcmcia_request_gpiods()
175 desc = devm_gpiod_get(dev, skt->stat[i].name, GPIOD_IN); in soc_pcmcia_request_gpiods()
178 skt->stat[i].name, PTR_ERR(desc)); in soc_pcmcia_request_gpiods()
182 skt->stat[i].desc = desc; in soc_pcmcia_request_gpiods()
193 ret = clk_prepare_enable(skt->clk); in soc_pcmcia_hw_init()
197 if (skt->ops->hw_init) { in soc_pcmcia_hw_init()
198 ret = skt->ops->hw_init(skt); in soc_pcmcia_hw_init()
200 clk_disable_unprepare(skt->clk); in soc_pcmcia_hw_init()
205 for (i = 0; i < ARRAY_SIZE(skt->stat); i++) { in soc_pcmcia_hw_init()
206 if (gpio_is_valid(skt->stat[i].gpio)) { in soc_pcmcia_hw_init()
213 ret = devm_gpio_request_one(skt->socket.dev.parent, in soc_pcmcia_hw_init()
214 skt->stat[i].gpio, flags, in soc_pcmcia_hw_init()
215 skt->stat[i].name); in soc_pcmcia_hw_init()
221 skt->stat[i].desc = gpio_to_desc(skt->stat[i].gpio); in soc_pcmcia_hw_init()
224 if (i < SOC_STAT_VS1 && skt->stat[i].desc) { in soc_pcmcia_hw_init()
225 int irq = gpiod_to_irq(skt->stat[i].desc); in soc_pcmcia_hw_init()
229 skt->socket.pci_irq = irq; in soc_pcmcia_hw_init()
231 skt->stat[i].irq = irq; in soc_pcmcia_hw_init()
235 if (skt->stat[i].irq) { in soc_pcmcia_hw_init()
236 ret = request_irq(skt->stat[i].irq, in soc_pcmcia_hw_init()
239 skt->stat[i].name, skt); in soc_pcmcia_hw_init()
254 for (i = 0; i < ARRAY_SIZE(skt->stat); i++) in soc_pcmcia_hw_enable()
255 if (skt->stat[i].irq) { in soc_pcmcia_hw_enable()
256 irq_set_irq_type(skt->stat[i].irq, IRQ_TYPE_EDGE_RISING); in soc_pcmcia_hw_enable()
257 irq_set_irq_type(skt->stat[i].irq, IRQ_TYPE_EDGE_BOTH); in soc_pcmcia_hw_enable()
265 for (i = 0; i < ARRAY_SIZE(skt->stat); i++) in soc_pcmcia_hw_disable()
266 if (skt->stat[i].irq) in soc_pcmcia_hw_disable()
267 irq_set_irq_type(skt->stat[i].irq, IRQ_TYPE_NONE); in soc_pcmcia_hw_disable()
271 * The CF 3.0 specification says that cards tie VS1 to ground and leave
273 * provide hard-coded values as per the CF 3.0 spec.
278 state->vs_3v = 1; in soc_common_cf_socket_state()
293 if (skt->stat[SOC_STAT_CD].desc) in soc_common_pcmcia_skt_state()
294 state.detect = !!gpiod_get_value(skt->stat[SOC_STAT_CD].desc); in soc_common_pcmcia_skt_state()
295 if (skt->stat[SOC_STAT_RDY].desc) in soc_common_pcmcia_skt_state()
296 state.ready = !!gpiod_get_value(skt->stat[SOC_STAT_RDY].desc); in soc_common_pcmcia_skt_state()
297 if (skt->stat[SOC_STAT_BVD1].desc) in soc_common_pcmcia_skt_state()
298 state.bvd1 = !!gpiod_get_value(skt->stat[SOC_STAT_BVD1].desc); in soc_common_pcmcia_skt_state()
299 if (skt->stat[SOC_STAT_BVD2].desc) in soc_common_pcmcia_skt_state()
300 state.bvd2 = !!gpiod_get_value(skt->stat[SOC_STAT_BVD2].desc); in soc_common_pcmcia_skt_state()
301 if (skt->stat[SOC_STAT_VS1].desc) in soc_common_pcmcia_skt_state()
302 state.vs_3v = !!gpiod_get_value(skt->stat[SOC_STAT_VS1].desc); in soc_common_pcmcia_skt_state()
303 if (skt->stat[SOC_STAT_VS2].desc) in soc_common_pcmcia_skt_state()
304 state.vs_Xv = !!gpiod_get_value(skt->stat[SOC_STAT_VS2].desc); in soc_common_pcmcia_skt_state()
306 skt->ops->socket_state(skt, &state); in soc_common_pcmcia_skt_state()
318 stat |= skt->cs_state.Vcc ? SS_POWERON : 0; in soc_common_pcmcia_skt_state()
320 if (skt->cs_state.flags & SS_IOCARD) in soc_common_pcmcia_skt_state()
342 ret = skt->ops->configure_socket(skt, state); in soc_common_pcmcia_config_skt()
345 skt->nr); in soc_common_pcmcia_config_skt()
347 WARN_ON(skt->ops->configure_socket(skt, &skt->cs_state)); in soc_common_pcmcia_config_skt()
356 if (skt->gpio_reset) { in soc_common_pcmcia_config_skt()
357 descs[n] = skt->gpio_reset; in soc_common_pcmcia_config_skt()
358 __assign_bit(n++, values, state->flags & SS_RESET); in soc_common_pcmcia_config_skt()
360 if (skt->gpio_bus_enable) { in soc_common_pcmcia_config_skt()
361 descs[n] = skt->gpio_bus_enable; in soc_common_pcmcia_config_skt()
362 __assign_bit(n++, values, state->flags & SS_OUTPUT_ENA); in soc_common_pcmcia_config_skt()
372 if (skt->irq_state != 1 && state->io_irq) { in soc_common_pcmcia_config_skt()
373 skt->irq_state = 1; in soc_common_pcmcia_config_skt()
374 irq_set_irq_type(skt->socket.pci_irq, in soc_common_pcmcia_config_skt()
376 } else if (skt->irq_state == 1 && state->io_irq == 0) { in soc_common_pcmcia_config_skt()
377 skt->irq_state = 0; in soc_common_pcmcia_config_skt()
378 irq_set_irq_type(skt->socket.pci_irq, IRQ_TYPE_NONE); in soc_common_pcmcia_config_skt()
381 skt->cs_state = *state; in soc_common_pcmcia_config_skt()
390 * (Re-)Initialise the socket, turning on status interrupts
401 if (skt->ops->socket_init) in soc_common_pcmcia_sock_init()
402 skt->ops->socket_init(skt); in soc_common_pcmcia_sock_init()
413 * Turn off status interrupts, and disable the PCMCIA bus.
424 if (skt->ops->socket_suspend) in soc_common_pcmcia_suspend()
425 skt->ops->socket_suspend(skt); in soc_common_pcmcia_suspend()
445 events = (status ^ skt->status) & skt->cs_state.csc_mask; in soc_common_check_status()
446 skt->status = status; in soc_common_check_status()
458 pcmcia_parse_events(&skt->socket, events); in soc_common_check_status()
468 mod_timer(&skt->poll_timer, jiffies + SOC_PCMCIA_POLL_PERIOD); in soc_common_pcmcia_poll_event()
476 * low-level PCMCIA init() operation via soc_common_pcmcia_thread()).
477 * The actual interrupt-servicing work is performed by
478 * soc_common_pcmcia_thread(), largely because the Card Services event-
495 * Implements the get_status() operation for the in-kernel PCMCIA
514 skt->status = soc_common_pcmcia_skt_state(skt); in soc_common_pcmcia_get_status()
515 *status = skt->status; in soc_common_pcmcia_get_status()
522 * Implements the set_socket() operation for the in-kernel PCMCIA
534 (state->csc_mask == 0) ? "<NONE> " : "", in soc_common_pcmcia_set_socket()
535 (state->csc_mask & SS_DETECT) ? "DETECT " : "", in soc_common_pcmcia_set_socket()
536 (state->csc_mask & SS_READY) ? "READY " : "", in soc_common_pcmcia_set_socket()
537 (state->csc_mask & SS_BATDEAD) ? "BATDEAD " : "", in soc_common_pcmcia_set_socket()
538 (state->csc_mask & SS_BATWARN) ? "BATWARN " : "", in soc_common_pcmcia_set_socket()
539 (state->csc_mask & SS_STSCHG) ? "STSCHG " : "", in soc_common_pcmcia_set_socket()
540 (state->flags == 0) ? "<NONE> " : "", in soc_common_pcmcia_set_socket()
541 (state->flags & SS_PWR_AUTO) ? "PWR_AUTO " : "", in soc_common_pcmcia_set_socket()
542 (state->flags & SS_IOCARD) ? "IOCARD " : "", in soc_common_pcmcia_set_socket()
543 (state->flags & SS_RESET) ? "RESET " : "", in soc_common_pcmcia_set_socket()
544 (state->flags & SS_SPKR_ENA) ? "SPKR_ENA " : "", in soc_common_pcmcia_set_socket()
545 (state->flags & SS_OUTPUT_ENA) ? "OUTPUT_ENA " : "", in soc_common_pcmcia_set_socket()
546 state->Vcc, state->Vpp, state->io_irq); in soc_common_pcmcia_set_socket()
553 * Implements the set_io_map() operation for the in-kernel PCMCIA
558 * Returns: 0 on success, -1 on error
564 unsigned short speed = map->speed; in soc_common_pcmcia_set_io_map()
567 map->map, map->speed, (unsigned long long)map->start, in soc_common_pcmcia_set_io_map()
568 (unsigned long long)map->stop); in soc_common_pcmcia_set_io_map()
570 (map->flags == 0) ? "<NONE>" : "", in soc_common_pcmcia_set_io_map()
571 (map->flags & MAP_ACTIVE) ? "ACTIVE " : "", in soc_common_pcmcia_set_io_map()
572 (map->flags & MAP_16BIT) ? "16BIT " : "", in soc_common_pcmcia_set_io_map()
573 (map->flags & MAP_AUTOSZ) ? "AUTOSZ " : "", in soc_common_pcmcia_set_io_map()
574 (map->flags & MAP_0WS) ? "0WS " : "", in soc_common_pcmcia_set_io_map()
575 (map->flags & MAP_WRPROT) ? "WRPROT " : "", in soc_common_pcmcia_set_io_map()
576 (map->flags & MAP_USE_WAIT) ? "USE_WAIT " : "", in soc_common_pcmcia_set_io_map()
577 (map->flags & MAP_PREFETCH) ? "PREFETCH " : ""); in soc_common_pcmcia_set_io_map()
579 if (map->map >= MAX_IO_WIN) { in soc_common_pcmcia_set_io_map()
581 map->map); in soc_common_pcmcia_set_io_map()
582 return -1; in soc_common_pcmcia_set_io_map()
585 if (map->flags & MAP_ACTIVE) { in soc_common_pcmcia_set_io_map()
592 skt->spd_io[map->map] = speed; in soc_common_pcmcia_set_io_map()
593 skt->ops->set_timing(skt); in soc_common_pcmcia_set_io_map()
595 if (map->stop == 1) in soc_common_pcmcia_set_io_map()
596 map->stop = PAGE_SIZE-1; in soc_common_pcmcia_set_io_map()
598 map->stop -= map->start; in soc_common_pcmcia_set_io_map()
599 map->stop += skt->socket.io_offset; in soc_common_pcmcia_set_io_map()
600 map->start = skt->socket.io_offset; in soc_common_pcmcia_set_io_map()
607 * Implements the set_mem_map() operation for the in-kernel PCMCIA
612 * Returns: 0 on success, -ERRNO on error
619 unsigned short speed = map->speed; in soc_common_pcmcia_set_mem_map()
622 map->map, map->speed, map->card_start); in soc_common_pcmcia_set_mem_map()
624 (map->flags == 0) ? "<NONE>" : "", in soc_common_pcmcia_set_mem_map()
625 (map->flags & MAP_ACTIVE) ? "ACTIVE " : "", in soc_common_pcmcia_set_mem_map()
626 (map->flags & MAP_16BIT) ? "16BIT " : "", in soc_common_pcmcia_set_mem_map()
627 (map->flags & MAP_AUTOSZ) ? "AUTOSZ " : "", in soc_common_pcmcia_set_mem_map()
628 (map->flags & MAP_0WS) ? "0WS " : "", in soc_common_pcmcia_set_mem_map()
629 (map->flags & MAP_WRPROT) ? "WRPROT " : "", in soc_common_pcmcia_set_mem_map()
630 (map->flags & MAP_ATTRIB) ? "ATTRIB " : "", in soc_common_pcmcia_set_mem_map()
631 (map->flags & MAP_USE_WAIT) ? "USE_WAIT " : ""); in soc_common_pcmcia_set_mem_map()
633 if (map->map >= MAX_WIN) in soc_common_pcmcia_set_mem_map()
634 return -EINVAL; in soc_common_pcmcia_set_mem_map()
636 if (map->flags & MAP_ACTIVE) { in soc_common_pcmcia_set_mem_map()
643 if (map->flags & MAP_ATTRIB) { in soc_common_pcmcia_set_mem_map()
644 res = &skt->res_attr; in soc_common_pcmcia_set_mem_map()
645 skt->spd_attr[map->map] = speed; in soc_common_pcmcia_set_mem_map()
646 skt->spd_mem[map->map] = 0; in soc_common_pcmcia_set_mem_map()
648 res = &skt->res_mem; in soc_common_pcmcia_set_mem_map()
649 skt->spd_attr[map->map] = 0; in soc_common_pcmcia_set_mem_map()
650 skt->spd_mem[map->map] = speed; in soc_common_pcmcia_set_mem_map()
653 skt->ops->set_timing(skt); in soc_common_pcmcia_set_mem_map()
655 map->static_start = res->start + map->card_start; in soc_common_pcmcia_set_mem_map()
692 b += sprintf(b, "%-9s:", prefix); in dump_bits()
712 p += sprintf(p, "slot : %d\n", skt->nr); in show_status()
714 dump_bits(&p, "status", skt->status, in show_status()
716 dump_bits(&p, "csc_mask", skt->cs_state.csc_mask, in show_status()
718 dump_bits(&p, "cs_flags", skt->cs_state.flags, in show_status()
721 p += sprintf(p, "Vcc : %d\n", skt->cs_state.Vcc); in show_status()
722 p += sprintf(p, "Vpp : %d\n", skt->cs_state.Vpp); in show_status()
723 p += sprintf(p, "IRQ : %d (%d)\n", skt->cs_state.io_irq, in show_status()
724 skt->socket.pci_irq); in show_status()
725 if (skt->ops->show_timing) in show_status()
726 p += skt->ops->show_timing(skt, p); in show_status()
728 return p-buf; in show_status()
750 return skt->ops->frequency_change(skt, val, freqs); in soc_common_pcmcia_cpufreq_nb()
759 skt->ops = ops; in soc_pcmcia_init_one()
760 skt->socket.owner = ops->owner; in soc_pcmcia_init_one()
761 skt->socket.dev.parent = dev; in soc_pcmcia_init_one()
762 skt->socket.pci_irq = NO_IRQ; in soc_pcmcia_init_one()
764 for (i = 0; i < ARRAY_SIZE(skt->stat); i++) in soc_pcmcia_init_one()
765 skt->stat[i].gpio = -EINVAL; in soc_pcmcia_init_one()
771 del_timer_sync(&skt->poll_timer); in soc_pcmcia_remove_one()
773 pcmcia_unregister_socket(&skt->socket); in soc_pcmcia_remove_one()
776 if (skt->ops->frequency_change) in soc_pcmcia_remove_one()
777 cpufreq_unregister_notifier(&skt->cpufreq_nb, in soc_pcmcia_remove_one()
786 iounmap(PCI_IOBASE + skt->res_io_io.start); in soc_pcmcia_remove_one()
787 release_resource(&skt->res_attr); in soc_pcmcia_remove_one()
788 release_resource(&skt->res_mem); in soc_pcmcia_remove_one()
789 release_resource(&skt->res_io); in soc_pcmcia_remove_one()
790 release_resource(&skt->res_skt); in soc_pcmcia_remove_one()
798 skt->cs_state = dead_socket; in soc_pcmcia_add_one()
800 timer_setup(&skt->poll_timer, soc_common_pcmcia_poll_event, 0); in soc_pcmcia_add_one()
801 skt->poll_timer.expires = jiffies + SOC_PCMCIA_POLL_PERIOD; in soc_pcmcia_add_one()
803 ret = request_resource(&iomem_resource, &skt->res_skt); in soc_pcmcia_add_one()
807 ret = request_resource(&skt->res_skt, &skt->res_io); in soc_pcmcia_add_one()
811 ret = request_resource(&skt->res_skt, &skt->res_mem); in soc_pcmcia_add_one()
815 ret = request_resource(&skt->res_skt, &skt->res_attr); in soc_pcmcia_add_one()
819 skt->res_io_io = (struct resource) in soc_pcmcia_add_one()
820 DEFINE_RES_IO_NAMED(skt->nr * 0x1000 + 0x10000, 0x1000, in soc_pcmcia_add_one()
822 ret = pci_remap_iospace(&skt->res_io_io, skt->res_io.start); in soc_pcmcia_add_one()
831 skt->ops->set_timing(skt); in soc_pcmcia_add_one()
837 skt->socket.ops = &soc_common_pcmcia_operations; in soc_pcmcia_add_one()
838 skt->socket.features = SS_CAP_STATIC_MAP|SS_CAP_PCCARD; in soc_pcmcia_add_one()
839 skt->socket.resource_ops = &pccard_static_ops; in soc_pcmcia_add_one()
840 skt->socket.irq_mask = 0; in soc_pcmcia_add_one()
841 skt->socket.map_size = PAGE_SIZE; in soc_pcmcia_add_one()
842 skt->socket.io_offset = (unsigned long)skt->res_io_io.start; in soc_pcmcia_add_one()
844 skt->status = soc_common_pcmcia_skt_state(skt); in soc_pcmcia_add_one()
847 if (skt->ops->frequency_change) { in soc_pcmcia_add_one()
848 skt->cpufreq_nb.notifier_call = soc_common_pcmcia_cpufreq_nb; in soc_pcmcia_add_one()
850 ret = cpufreq_register_notifier(&skt->cpufreq_nb, in soc_pcmcia_add_one()
853 dev_err(skt->socket.dev.parent, in soc_pcmcia_add_one()
859 ret = pcmcia_register_socket(&skt->socket); in soc_pcmcia_add_one()
863 ret = device_create_file(&skt->socket.dev, &dev_attr_status); in soc_pcmcia_add_one()
870 del_timer_sync(&skt->poll_timer); in soc_pcmcia_add_one()
871 pcmcia_unregister_socket(&skt->socket); in soc_pcmcia_add_one()
876 iounmap(PCI_IOBASE + skt->res_io_io.start); in soc_pcmcia_add_one()
878 release_resource(&skt->res_attr); in soc_pcmcia_add_one()
880 release_resource(&skt->res_mem); in soc_pcmcia_add_one()
882 release_resource(&skt->res_io); in soc_pcmcia_add_one()
884 release_resource(&skt->res_skt); in soc_pcmcia_add_one()