Lines Matching refs:ifx_dev

80 static void ifx_spi_handle_srdy(struct ifx_spi_device *ifx_dev);
83 static int ifx_modem_power_off(struct ifx_spi_device *ifx_dev);
95 static int ifx_modem_power_off(struct ifx_spi_device *ifx_dev) in ifx_modem_power_off() argument
144 ifx_spi_power_state_set(struct ifx_spi_device *ifx_dev, unsigned char val) in ifx_spi_power_state_set() argument
148 spin_lock_irqsave(&ifx_dev->power_lock, flags); in ifx_spi_power_state_set()
154 if (!ifx_dev->power_status) in ifx_spi_power_state_set()
155 pm_runtime_get(&ifx_dev->spi_dev->dev); in ifx_spi_power_state_set()
156 ifx_dev->power_status |= val; in ifx_spi_power_state_set()
158 spin_unlock_irqrestore(&ifx_dev->power_lock, flags); in ifx_spi_power_state_set()
169 ifx_spi_power_state_clear(struct ifx_spi_device *ifx_dev, unsigned char val) in ifx_spi_power_state_clear() argument
173 spin_lock_irqsave(&ifx_dev->power_lock, flags); in ifx_spi_power_state_clear()
175 if (ifx_dev->power_status) { in ifx_spi_power_state_clear()
176 ifx_dev->power_status &= ~val; in ifx_spi_power_state_clear()
177 if (!ifx_dev->power_status) in ifx_spi_power_state_clear()
178 pm_runtime_put(&ifx_dev->spi_dev->dev); in ifx_spi_power_state_clear()
181 spin_unlock_irqrestore(&ifx_dev->power_lock, flags); in ifx_spi_power_state_clear()
258 static void mrdy_assert(struct ifx_spi_device *ifx_dev) in mrdy_assert() argument
260 int val = gpio_get_value(ifx_dev->gpio.srdy); in mrdy_assert()
263 &ifx_dev->flags)) { in mrdy_assert()
264 mod_timer(&ifx_dev->spi_timer,jiffies + IFX_SPI_TIMEOUT_SEC*HZ); in mrdy_assert()
268 ifx_spi_power_state_set(ifx_dev, IFX_SPI_POWER_DATA_PENDING); in mrdy_assert()
269 mrdy_set_high(ifx_dev); in mrdy_assert()
281 struct ifx_spi_device *ifx_dev = (struct ifx_spi_device *)arg; in ifx_spi_timeout() local
283 dev_warn(&ifx_dev->spi_dev->dev, "*** SPI Timeout ***"); in ifx_spi_timeout()
284 tty_port_tty_hangup(&ifx_dev->tty_port, false); in ifx_spi_timeout()
285 mrdy_set_low(ifx_dev); in ifx_spi_timeout()
286 clear_bit(IFX_SPI_STATE_TIMER_PENDING, &ifx_dev->flags); in ifx_spi_timeout()
302 struct ifx_spi_device *ifx_dev = tty->driver_data; in ifx_spi_tiocmget() local
305 (test_bit(IFX_SPI_RTS, &ifx_dev->signal_state) ? TIOCM_RTS : 0) | in ifx_spi_tiocmget()
306 (test_bit(IFX_SPI_DTR, &ifx_dev->signal_state) ? TIOCM_DTR : 0) | in ifx_spi_tiocmget()
307 (test_bit(IFX_SPI_CTS, &ifx_dev->signal_state) ? TIOCM_CTS : 0) | in ifx_spi_tiocmget()
308 (test_bit(IFX_SPI_DSR, &ifx_dev->signal_state) ? TIOCM_DSR : 0) | in ifx_spi_tiocmget()
309 (test_bit(IFX_SPI_DCD, &ifx_dev->signal_state) ? TIOCM_CAR : 0) | in ifx_spi_tiocmget()
310 (test_bit(IFX_SPI_RI, &ifx_dev->signal_state) ? TIOCM_RNG : 0); in ifx_spi_tiocmget()
328 struct ifx_spi_device *ifx_dev = tty->driver_data; in ifx_spi_tiocmset() local
331 set_bit(IFX_SPI_RTS, &ifx_dev->signal_state); in ifx_spi_tiocmset()
333 set_bit(IFX_SPI_DTR, &ifx_dev->signal_state); in ifx_spi_tiocmset()
335 clear_bit(IFX_SPI_RTS, &ifx_dev->signal_state); in ifx_spi_tiocmset()
337 clear_bit(IFX_SPI_DTR, &ifx_dev->signal_state); in ifx_spi_tiocmset()
339 set_bit(IFX_SPI_UPDATE, &ifx_dev->signal_state); in ifx_spi_tiocmset()
368 struct ifx_spi_device *ifx_dev = tty->driver_data; in ifx_spi_close() local
369 tty_port_close(&ifx_dev->tty_port, tty, filp); in ifx_spi_close()
440 static int ifx_spi_prepare_tx_buffer(struct ifx_spi_device *ifx_dev) in ifx_spi_prepare_tx_buffer() argument
447 tx_buffer = ifx_dev->tx_buffer; in ifx_spi_prepare_tx_buffer()
455 ifx_dev->spi_more = 0; in ifx_spi_prepare_tx_buffer()
458 if (!ifx_dev->spi_slave_cts) { in ifx_spi_prepare_tx_buffer()
460 queue_length = kfifo_len(&ifx_dev->tx_fifo); in ifx_spi_prepare_tx_buffer()
464 temp_count = kfifo_out_locked(&ifx_dev->tx_fifo, in ifx_spi_prepare_tx_buffer()
466 &ifx_dev->fifo_lock); in ifx_spi_prepare_tx_buffer()
473 tty_port_tty_wakeup(&ifx_dev->tty_port); in ifx_spi_prepare_tx_buffer()
475 ifx_dev->spi_more = 1; in ifx_spi_prepare_tx_buffer()
480 ifx_spi_setup_spi_header(ifx_dev->tx_buffer, in ifx_spi_prepare_tx_buffer()
482 ifx_dev->spi_more); in ifx_spi_prepare_tx_buffer()
484 ifx_dev->swap_buf((ifx_dev->tx_buffer), tx_count, in ifx_spi_prepare_tx_buffer()
485 &ifx_dev->tx_buffer[IFX_SPI_TRANSFER_SIZE]); in ifx_spi_prepare_tx_buffer()
502 struct ifx_spi_device *ifx_dev = tty->driver_data; in ifx_spi_write() local
508 spin_lock_irqsave(&ifx_dev->fifo_lock, flags); in ifx_spi_write()
509 is_fifo_empty = kfifo_is_empty(&ifx_dev->tx_fifo); in ifx_spi_write()
510 tx_count = kfifo_in(&ifx_dev->tx_fifo, tmp_buf, count); in ifx_spi_write()
511 spin_unlock_irqrestore(&ifx_dev->fifo_lock, flags); in ifx_spi_write()
513 mrdy_assert(ifx_dev); in ifx_spi_write()
527 struct ifx_spi_device *ifx_dev = tty->driver_data; in ifx_spi_write_room() local
528 return IFX_SPI_FIFO_SIZE - kfifo_len(&ifx_dev->tx_fifo); in ifx_spi_write_room()
540 struct ifx_spi_device *ifx_dev = tty->driver_data; in ifx_spi_chars_in_buffer() local
541 return kfifo_len(&ifx_dev->tx_fifo); in ifx_spi_chars_in_buffer()
554 struct ifx_spi_device *ifx_dev = tty->driver_data; in ifx_spi_hangup() local
555 tty_port_hangup(&ifx_dev->tty_port); in ifx_spi_hangup()
567 struct ifx_spi_device *ifx_dev = in ifx_port_activate() local
571 kfifo_reset(&ifx_dev->tx_fifo); in ifx_port_activate()
574 clear_bit(IFX_SPI_STATE_IO_IN_PROGRESS, &ifx_dev->flags); in ifx_port_activate()
575 clear_bit(IFX_SPI_STATE_IO_READY, &ifx_dev->flags); in ifx_port_activate()
578 tty->driver_data = ifx_dev; in ifx_port_activate()
584 set_bit(IFX_SPI_STATE_IO_AVAILABLE, &ifx_dev->flags); in ifx_port_activate()
598 struct ifx_spi_device *ifx_dev = in ifx_port_shutdown() local
601 clear_bit(IFX_SPI_STATE_IO_AVAILABLE, &ifx_dev->flags); in ifx_port_shutdown()
602 mrdy_set_low(ifx_dev); in ifx_port_shutdown()
603 del_timer(&ifx_dev->spi_timer); in ifx_port_shutdown()
604 clear_bit(IFX_SPI_STATE_TIMER_PENDING, &ifx_dev->flags); in ifx_port_shutdown()
605 tasklet_kill(&ifx_dev->io_work_tasklet); in ifx_port_shutdown()
633 static void ifx_spi_insert_flip_string(struct ifx_spi_device *ifx_dev, in ifx_spi_insert_flip_string() argument
636 tty_insert_flip_string(&ifx_dev->tty_port, chars, size); in ifx_spi_insert_flip_string()
637 tty_flip_buffer_push(&ifx_dev->tty_port); in ifx_spi_insert_flip_string()
649 struct ifx_spi_device *ifx_dev = ctx; in ifx_spi_complete() local
659 mrdy_set_low(ifx_dev); in ifx_spi_complete()
661 if (!ifx_dev->spi_msg.status) { in ifx_spi_complete()
663 ifx_dev->swap_buf(ifx_dev->rx_buffer, IFX_SPI_HEADER_OVERHEAD, in ifx_spi_complete()
664 &ifx_dev->rx_buffer[IFX_SPI_HEADER_OVERHEAD]); in ifx_spi_complete()
665 decode_result = ifx_spi_decode_spi_header(ifx_dev->rx_buffer, in ifx_spi_complete()
668 dev_dbg(&ifx_dev->spi_dev->dev, in ifx_spi_complete()
670 ifx_dev->spi_slave_cts = 0; in ifx_spi_complete()
673 dev_dbg(&ifx_dev->spi_dev->dev, in ifx_spi_complete()
678 ifx_dev->spi_slave_cts = cts; in ifx_spi_complete()
681 ifx_dev->spi_msg.actual_length); in ifx_spi_complete()
682 ifx_dev->swap_buf( in ifx_spi_complete()
683 (ifx_dev->rx_buffer + IFX_SPI_HEADER_OVERHEAD), in ifx_spi_complete()
685 &ifx_dev->rx_buffer[IFX_SPI_TRANSFER_SIZE]); in ifx_spi_complete()
687 ifx_dev, in ifx_spi_complete()
688 ifx_dev->rx_buffer + IFX_SPI_HEADER_OVERHEAD, in ifx_spi_complete()
691 dev_dbg(&ifx_dev->spi_dev->dev, "SPI transfer error %d", in ifx_spi_complete()
692 ifx_dev->spi_msg.status); in ifx_spi_complete()
696 if (ifx_dev->write_pending) { in ifx_spi_complete()
697 ifx_dev->write_pending = 0; in ifx_spi_complete()
701 clear_bit(IFX_SPI_STATE_IO_IN_PROGRESS, &(ifx_dev->flags)); in ifx_spi_complete()
703 queue_length = kfifo_len(&ifx_dev->tx_fifo); in ifx_spi_complete()
704 srdy = gpio_get_value(ifx_dev->gpio.srdy); in ifx_spi_complete()
706 ifx_spi_power_state_clear(ifx_dev, IFX_SPI_POWER_SRDY); in ifx_spi_complete()
709 if (test_and_clear_bit(IFX_SPI_STATE_IO_READY, &ifx_dev->flags)) in ifx_spi_complete()
710 tasklet_schedule(&ifx_dev->io_work_tasklet); in ifx_spi_complete()
712 if (more || ifx_dev->spi_more || queue_length > 0 || in ifx_spi_complete()
714 if (ifx_dev->spi_slave_cts) { in ifx_spi_complete()
716 mrdy_assert(ifx_dev); in ifx_spi_complete()
718 mrdy_assert(ifx_dev); in ifx_spi_complete()
725 ifx_spi_power_state_clear(ifx_dev, in ifx_spi_complete()
727 tty_port_tty_wakeup(&ifx_dev->tty_port); in ifx_spi_complete()
742 struct ifx_spi_device *ifx_dev = (struct ifx_spi_device *) data; in ifx_spi_io() local
744 if (!test_and_set_bit(IFX_SPI_STATE_IO_IN_PROGRESS, &ifx_dev->flags) && in ifx_spi_io()
745 test_bit(IFX_SPI_STATE_IO_AVAILABLE, &ifx_dev->flags)) { in ifx_spi_io()
746 if (ifx_dev->gpio.unack_srdy_int_nb > 0) in ifx_spi_io()
747 ifx_dev->gpio.unack_srdy_int_nb--; in ifx_spi_io()
749 ifx_spi_prepare_tx_buffer(ifx_dev); in ifx_spi_io()
751 spi_message_init(&ifx_dev->spi_msg); in ifx_spi_io()
752 INIT_LIST_HEAD(&ifx_dev->spi_msg.queue); in ifx_spi_io()
754 ifx_dev->spi_msg.context = ifx_dev; in ifx_spi_io()
755 ifx_dev->spi_msg.complete = ifx_spi_complete; in ifx_spi_io()
759 ifx_dev->spi_xfer.len = IFX_SPI_TRANSFER_SIZE; in ifx_spi_io()
760 ifx_dev->spi_xfer.cs_change = 0; in ifx_spi_io()
761 ifx_dev->spi_xfer.speed_hz = ifx_dev->spi_dev->max_speed_hz; in ifx_spi_io()
763 ifx_dev->spi_xfer.bits_per_word = in ifx_spi_io()
764 ifx_dev->spi_dev->bits_per_word; in ifx_spi_io()
766 ifx_dev->spi_xfer.tx_buf = ifx_dev->tx_buffer; in ifx_spi_io()
767 ifx_dev->spi_xfer.rx_buf = ifx_dev->rx_buffer; in ifx_spi_io()
772 if (ifx_dev->use_dma) { in ifx_spi_io()
773 ifx_dev->spi_msg.is_dma_mapped = 1; in ifx_spi_io()
774 ifx_dev->tx_dma = ifx_dev->tx_bus; in ifx_spi_io()
775 ifx_dev->rx_dma = ifx_dev->rx_bus; in ifx_spi_io()
776 ifx_dev->spi_xfer.tx_dma = ifx_dev->tx_dma; in ifx_spi_io()
777 ifx_dev->spi_xfer.rx_dma = ifx_dev->rx_dma; in ifx_spi_io()
779 ifx_dev->spi_msg.is_dma_mapped = 0; in ifx_spi_io()
780 ifx_dev->tx_dma = (dma_addr_t)0; in ifx_spi_io()
781 ifx_dev->rx_dma = (dma_addr_t)0; in ifx_spi_io()
782 ifx_dev->spi_xfer.tx_dma = (dma_addr_t)0; in ifx_spi_io()
783 ifx_dev->spi_xfer.rx_dma = (dma_addr_t)0; in ifx_spi_io()
786 spi_message_add_tail(&ifx_dev->spi_xfer, &ifx_dev->spi_msg); in ifx_spi_io()
791 mrdy_assert(ifx_dev); in ifx_spi_io()
793 retval = spi_async(ifx_dev->spi_dev, &ifx_dev->spi_msg); in ifx_spi_io()
796 &ifx_dev->flags); in ifx_spi_io()
797 tasklet_schedule(&ifx_dev->io_work_tasklet); in ifx_spi_io()
801 ifx_dev->write_pending = 1; in ifx_spi_io()
810 static void ifx_spi_free_port(struct ifx_spi_device *ifx_dev) in ifx_spi_free_port() argument
812 if (ifx_dev->tty_dev) in ifx_spi_free_port()
813 tty_unregister_device(tty_drv, ifx_dev->minor); in ifx_spi_free_port()
814 tty_port_destroy(&ifx_dev->tty_port); in ifx_spi_free_port()
815 kfifo_free(&ifx_dev->tx_fifo); in ifx_spi_free_port()
825 static int ifx_spi_create_port(struct ifx_spi_device *ifx_dev) in ifx_spi_create_port() argument
828 struct tty_port *pport = &ifx_dev->tty_port; in ifx_spi_create_port()
830 spin_lock_init(&ifx_dev->fifo_lock); in ifx_spi_create_port()
831 lockdep_set_class_and_subclass(&ifx_dev->fifo_lock, in ifx_spi_create_port()
834 if (kfifo_alloc(&ifx_dev->tx_fifo, IFX_SPI_FIFO_SIZE, GFP_KERNEL)) { in ifx_spi_create_port()
841 ifx_dev->minor = IFX_SPI_TTY_ID; in ifx_spi_create_port()
842 ifx_dev->tty_dev = tty_port_register_device(pport, tty_drv, in ifx_spi_create_port()
843 ifx_dev->minor, &ifx_dev->spi_dev->dev); in ifx_spi_create_port()
844 if (IS_ERR(ifx_dev->tty_dev)) { in ifx_spi_create_port()
845 dev_dbg(&ifx_dev->spi_dev->dev, in ifx_spi_create_port()
847 ret = PTR_ERR(ifx_dev->tty_dev); in ifx_spi_create_port()
855 ifx_spi_free_port(ifx_dev); in ifx_spi_create_port()
867 static void ifx_spi_handle_srdy(struct ifx_spi_device *ifx_dev) in ifx_spi_handle_srdy() argument
869 if (test_bit(IFX_SPI_STATE_TIMER_PENDING, &ifx_dev->flags)) { in ifx_spi_handle_srdy()
870 del_timer(&ifx_dev->spi_timer); in ifx_spi_handle_srdy()
871 clear_bit(IFX_SPI_STATE_TIMER_PENDING, &ifx_dev->flags); in ifx_spi_handle_srdy()
874 ifx_spi_power_state_set(ifx_dev, IFX_SPI_POWER_SRDY); in ifx_spi_handle_srdy()
876 if (!test_bit(IFX_SPI_STATE_IO_IN_PROGRESS, &ifx_dev->flags)) in ifx_spi_handle_srdy()
877 tasklet_schedule(&ifx_dev->io_work_tasklet); in ifx_spi_handle_srdy()
879 set_bit(IFX_SPI_STATE_IO_READY, &ifx_dev->flags); in ifx_spi_handle_srdy()
891 struct ifx_spi_device *ifx_dev = dev; in ifx_spi_srdy_interrupt() local
892 ifx_dev->gpio.unack_srdy_int_nb++; in ifx_spi_srdy_interrupt()
893 ifx_spi_handle_srdy(ifx_dev); in ifx_spi_srdy_interrupt()
910 struct ifx_spi_device *ifx_dev = dev; in ifx_spi_reset_interrupt() local
911 int val = gpio_get_value(ifx_dev->gpio.reset_out); in ifx_spi_reset_interrupt()
912 int solreset = test_bit(MR_START, &ifx_dev->mdm_reset_state); in ifx_spi_reset_interrupt()
916 set_bit(MR_INPROGRESS, &ifx_dev->mdm_reset_state); in ifx_spi_reset_interrupt()
919 tty_port_tty_hangup(&ifx_dev->tty_port, false); in ifx_spi_reset_interrupt()
923 clear_bit(MR_INPROGRESS, &ifx_dev->mdm_reset_state); in ifx_spi_reset_interrupt()
925 set_bit(MR_COMPLETE, &ifx_dev->mdm_reset_state); in ifx_spi_reset_interrupt()
926 wake_up(&ifx_dev->mdm_reset_wait); in ifx_spi_reset_interrupt()
938 static void ifx_spi_free_device(struct ifx_spi_device *ifx_dev) in ifx_spi_free_device() argument
940 ifx_spi_free_port(ifx_dev); in ifx_spi_free_device()
941 dma_free_coherent(&ifx_dev->spi_dev->dev, in ifx_spi_free_device()
943 ifx_dev->tx_buffer, in ifx_spi_free_device()
944 ifx_dev->tx_bus); in ifx_spi_free_device()
945 dma_free_coherent(&ifx_dev->spi_dev->dev, in ifx_spi_free_device()
947 ifx_dev->rx_buffer, in ifx_spi_free_device()
948 ifx_dev->rx_bus); in ifx_spi_free_device()
957 static int ifx_spi_reset(struct ifx_spi_device *ifx_dev) in ifx_spi_reset() argument
966 set_bit(MR_START, &ifx_dev->mdm_reset_state); in ifx_spi_reset()
967 gpio_set_value(ifx_dev->gpio.po, 0); in ifx_spi_reset()
968 gpio_set_value(ifx_dev->gpio.reset, 0); in ifx_spi_reset()
970 gpio_set_value(ifx_dev->gpio.reset, 1); in ifx_spi_reset()
972 gpio_set_value(ifx_dev->gpio.po, 1); in ifx_spi_reset()
974 gpio_set_value(ifx_dev->gpio.po, 0); in ifx_spi_reset()
975 ret = wait_event_timeout(ifx_dev->mdm_reset_wait, in ifx_spi_reset()
977 &ifx_dev->mdm_reset_state), in ifx_spi_reset()
980 dev_warn(&ifx_dev->spi_dev->dev, "Modem reset timeout: (state:%lx)", in ifx_spi_reset()
981 ifx_dev->mdm_reset_state); in ifx_spi_reset()
983 ifx_dev->mdm_reset_state = 0; in ifx_spi_reset()
1004 struct ifx_spi_device *ifx_dev; in ifx_spi_spi_probe() local
1018 ifx_dev = kzalloc(sizeof(struct ifx_spi_device), GFP_KERNEL); in ifx_spi_spi_probe()
1019 if (!ifx_dev) { in ifx_spi_spi_probe()
1023 saved_ifx_dev = ifx_dev; in ifx_spi_spi_probe()
1024 ifx_dev->spi_dev = spi; in ifx_spi_spi_probe()
1025 clear_bit(IFX_SPI_STATE_IO_IN_PROGRESS, &ifx_dev->flags); in ifx_spi_spi_probe()
1026 spin_lock_init(&ifx_dev->write_lock); in ifx_spi_spi_probe()
1027 spin_lock_init(&ifx_dev->power_lock); in ifx_spi_spi_probe()
1028 ifx_dev->power_status = 0; in ifx_spi_spi_probe()
1029 init_timer(&ifx_dev->spi_timer); in ifx_spi_spi_probe()
1030 ifx_dev->spi_timer.function = ifx_spi_timeout; in ifx_spi_spi_probe()
1031 ifx_dev->spi_timer.data = (unsigned long)ifx_dev; in ifx_spi_spi_probe()
1032 ifx_dev->modem = pl_data->modem_type; in ifx_spi_spi_probe()
1033 ifx_dev->use_dma = pl_data->use_dma; in ifx_spi_spi_probe()
1034 ifx_dev->max_hz = pl_data->max_hz; in ifx_spi_spi_probe()
1036 spi->max_speed_hz = ifx_dev->max_hz; in ifx_spi_spi_probe()
1047 ifx_dev->swap_buf = swap_buf_32; in ifx_spi_spi_probe()
1049 ifx_dev->swap_buf = swap_buf_16; in ifx_spi_spi_probe()
1051 ifx_dev->swap_buf = swap_buf_8; in ifx_spi_spi_probe()
1054 ifx_dev->spi_more = 0; in ifx_spi_spi_probe()
1055 ifx_dev->spi_slave_cts = 0; in ifx_spi_spi_probe()
1058 ifx_dev->tx_buffer = dma_alloc_coherent(ifx_dev->spi_dev->dev.parent, in ifx_spi_spi_probe()
1060 &ifx_dev->tx_bus, in ifx_spi_spi_probe()
1062 if (!ifx_dev->tx_buffer) { in ifx_spi_spi_probe()
1067 ifx_dev->rx_buffer = dma_alloc_coherent(ifx_dev->spi_dev->dev.parent, in ifx_spi_spi_probe()
1069 &ifx_dev->rx_bus, in ifx_spi_spi_probe()
1071 if (!ifx_dev->rx_buffer) { in ifx_spi_spi_probe()
1078 init_waitqueue_head(&ifx_dev->mdm_reset_wait); in ifx_spi_spi_probe()
1080 spi_set_drvdata(spi, ifx_dev); in ifx_spi_spi_probe()
1081 tasklet_init(&ifx_dev->io_work_tasklet, ifx_spi_io, in ifx_spi_spi_probe()
1082 (unsigned long)ifx_dev); in ifx_spi_spi_probe()
1084 set_bit(IFX_SPI_STATE_PRESENT, &ifx_dev->flags); in ifx_spi_spi_probe()
1087 ret = ifx_spi_create_port(ifx_dev); in ifx_spi_spi_probe()
1093 ifx_dev->gpio.reset = pl_data->rst_pmu; in ifx_spi_spi_probe()
1094 ifx_dev->gpio.po = pl_data->pwr_on; in ifx_spi_spi_probe()
1095 ifx_dev->gpio.mrdy = pl_data->mrdy; in ifx_spi_spi_probe()
1096 ifx_dev->gpio.srdy = pl_data->srdy; in ifx_spi_spi_probe()
1097 ifx_dev->gpio.reset_out = pl_data->rst_out; in ifx_spi_spi_probe()
1100 ifx_dev->gpio.reset, ifx_dev->gpio.po, ifx_dev->gpio.mrdy, in ifx_spi_spi_probe()
1101 ifx_dev->gpio.srdy, ifx_dev->gpio.reset_out); in ifx_spi_spi_probe()
1104 ret = gpio_request(ifx_dev->gpio.reset, "ifxModem"); in ifx_spi_spi_probe()
1107 ifx_dev->gpio.reset); in ifx_spi_spi_probe()
1110 ret += gpio_direction_output(ifx_dev->gpio.reset, 0); in ifx_spi_spi_probe()
1111 ret += gpio_export(ifx_dev->gpio.reset, 1); in ifx_spi_spi_probe()
1114 ifx_dev->gpio.reset); in ifx_spi_spi_probe()
1119 ret = gpio_request(ifx_dev->gpio.po, "ifxModem"); in ifx_spi_spi_probe()
1120 ret += gpio_direction_output(ifx_dev->gpio.po, 0); in ifx_spi_spi_probe()
1121 ret += gpio_export(ifx_dev->gpio.po, 1); in ifx_spi_spi_probe()
1124 ifx_dev->gpio.po); in ifx_spi_spi_probe()
1129 ret = gpio_request(ifx_dev->gpio.mrdy, "ifxModem"); in ifx_spi_spi_probe()
1132 ifx_dev->gpio.mrdy); in ifx_spi_spi_probe()
1135 ret += gpio_export(ifx_dev->gpio.mrdy, 1); in ifx_spi_spi_probe()
1136 ret += gpio_direction_output(ifx_dev->gpio.mrdy, 0); in ifx_spi_spi_probe()
1139 ifx_dev->gpio.mrdy); in ifx_spi_spi_probe()
1144 ret = gpio_request(ifx_dev->gpio.srdy, "ifxModem"); in ifx_spi_spi_probe()
1147 ifx_dev->gpio.srdy); in ifx_spi_spi_probe()
1151 ret += gpio_export(ifx_dev->gpio.srdy, 1); in ifx_spi_spi_probe()
1152 ret += gpio_direction_input(ifx_dev->gpio.srdy); in ifx_spi_spi_probe()
1155 ifx_dev->gpio.srdy); in ifx_spi_spi_probe()
1160 ret = gpio_request(ifx_dev->gpio.reset_out, "ifxModem"); in ifx_spi_spi_probe()
1163 ifx_dev->gpio.reset_out); in ifx_spi_spi_probe()
1166 ret += gpio_export(ifx_dev->gpio.reset_out, 1); in ifx_spi_spi_probe()
1167 ret += gpio_direction_input(ifx_dev->gpio.reset_out); in ifx_spi_spi_probe()
1170 ifx_dev->gpio.reset_out); in ifx_spi_spi_probe()
1175 ret = request_irq(gpio_to_irq(ifx_dev->gpio.reset_out), in ifx_spi_spi_probe()
1178 ifx_dev); in ifx_spi_spi_probe()
1181 gpio_to_irq(ifx_dev->gpio.reset_out)); in ifx_spi_spi_probe()
1185 ret = ifx_spi_reset(ifx_dev); in ifx_spi_spi_probe()
1187 ret = request_irq(gpio_to_irq(ifx_dev->gpio.srdy), in ifx_spi_spi_probe()
1189 ifx_dev); in ifx_spi_spi_probe()
1192 gpio_to_irq(ifx_dev->gpio.srdy)); in ifx_spi_spi_probe()
1204 srdy = gpio_get_value(ifx_dev->gpio.srdy); in ifx_spi_spi_probe()
1207 mrdy_assert(ifx_dev); in ifx_spi_spi_probe()
1208 ifx_spi_handle_srdy(ifx_dev); in ifx_spi_spi_probe()
1210 mrdy_set_low(ifx_dev); in ifx_spi_spi_probe()
1214 free_irq(gpio_to_irq(ifx_dev->gpio.reset_out), ifx_dev); in ifx_spi_spi_probe()
1216 gpio_free(ifx_dev->gpio.srdy); in ifx_spi_spi_probe()
1218 gpio_free(ifx_dev->gpio.mrdy); in ifx_spi_spi_probe()
1220 gpio_free(ifx_dev->gpio.reset); in ifx_spi_spi_probe()
1222 gpio_free(ifx_dev->gpio.po); in ifx_spi_spi_probe()
1224 gpio_free(ifx_dev->gpio.reset_out); in ifx_spi_spi_probe()
1226 ifx_spi_free_device(ifx_dev); in ifx_spi_spi_probe()
1241 struct ifx_spi_device *ifx_dev = spi_get_drvdata(spi); in ifx_spi_spi_remove() local
1243 tasklet_kill(&ifx_dev->io_work_tasklet); in ifx_spi_spi_remove()
1245 free_irq(gpio_to_irq(ifx_dev->gpio.reset_out), ifx_dev); in ifx_spi_spi_remove()
1246 free_irq(gpio_to_irq(ifx_dev->gpio.srdy), ifx_dev); in ifx_spi_spi_remove()
1248 gpio_free(ifx_dev->gpio.srdy); in ifx_spi_spi_remove()
1249 gpio_free(ifx_dev->gpio.mrdy); in ifx_spi_spi_remove()
1250 gpio_free(ifx_dev->gpio.reset); in ifx_spi_spi_remove()
1251 gpio_free(ifx_dev->gpio.po); in ifx_spi_spi_remove()
1252 gpio_free(ifx_dev->gpio.reset_out); in ifx_spi_spi_remove()
1255 ifx_spi_free_device(ifx_dev); in ifx_spi_spi_remove()
1270 struct ifx_spi_device *ifx_dev = spi_get_drvdata(spi); in ifx_spi_spi_shutdown() local
1272 ifx_modem_power_off(ifx_dev); in ifx_spi_spi_shutdown()
1337 struct ifx_spi_device *ifx_dev = spi_get_drvdata(spi); in ifx_spi_pm_runtime_idle() local
1339 if (!ifx_dev->power_status) in ifx_spi_pm_runtime_idle()