Lines Matching refs:ifx_dev
67 static void ifx_spi_handle_srdy(struct ifx_spi_device *ifx_dev);
70 static int ifx_modem_power_off(struct ifx_spi_device *ifx_dev);
82 static int ifx_modem_power_off(struct ifx_spi_device *ifx_dev) in ifx_modem_power_off() argument
131 ifx_spi_power_state_set(struct ifx_spi_device *ifx_dev, unsigned char val) in ifx_spi_power_state_set() argument
135 spin_lock_irqsave(&ifx_dev->power_lock, flags); in ifx_spi_power_state_set()
141 if (!ifx_dev->power_status) in ifx_spi_power_state_set()
142 pm_runtime_get(&ifx_dev->spi_dev->dev); in ifx_spi_power_state_set()
143 ifx_dev->power_status |= val; in ifx_spi_power_state_set()
145 spin_unlock_irqrestore(&ifx_dev->power_lock, flags); in ifx_spi_power_state_set()
156 ifx_spi_power_state_clear(struct ifx_spi_device *ifx_dev, unsigned char val) in ifx_spi_power_state_clear() argument
160 spin_lock_irqsave(&ifx_dev->power_lock, flags); in ifx_spi_power_state_clear()
162 if (ifx_dev->power_status) { in ifx_spi_power_state_clear()
163 ifx_dev->power_status &= ~val; in ifx_spi_power_state_clear()
164 if (!ifx_dev->power_status) in ifx_spi_power_state_clear()
165 pm_runtime_put(&ifx_dev->spi_dev->dev); in ifx_spi_power_state_clear()
168 spin_unlock_irqrestore(&ifx_dev->power_lock, flags); in ifx_spi_power_state_clear()
245 static void mrdy_assert(struct ifx_spi_device *ifx_dev) in mrdy_assert() argument
247 int val = gpio_get_value(ifx_dev->gpio.srdy); in mrdy_assert()
250 &ifx_dev->flags)) { in mrdy_assert()
251 mod_timer(&ifx_dev->spi_timer,jiffies + IFX_SPI_TIMEOUT_SEC*HZ); in mrdy_assert()
255 ifx_spi_power_state_set(ifx_dev, IFX_SPI_POWER_DATA_PENDING); in mrdy_assert()
256 mrdy_set_high(ifx_dev); in mrdy_assert()
268 struct ifx_spi_device *ifx_dev = from_timer(ifx_dev, t, spi_timer); in ifx_spi_timeout() local
270 dev_warn(&ifx_dev->spi_dev->dev, "*** SPI Timeout ***"); in ifx_spi_timeout()
271 tty_port_tty_hangup(&ifx_dev->tty_port, false); in ifx_spi_timeout()
272 mrdy_set_low(ifx_dev); in ifx_spi_timeout()
273 clear_bit(IFX_SPI_STATE_TIMER_PENDING, &ifx_dev->flags); in ifx_spi_timeout()
289 struct ifx_spi_device *ifx_dev = tty->driver_data; in ifx_spi_tiocmget() local
292 (test_bit(IFX_SPI_RTS, &ifx_dev->signal_state) ? TIOCM_RTS : 0) | in ifx_spi_tiocmget()
293 (test_bit(IFX_SPI_DTR, &ifx_dev->signal_state) ? TIOCM_DTR : 0) | in ifx_spi_tiocmget()
294 (test_bit(IFX_SPI_CTS, &ifx_dev->signal_state) ? TIOCM_CTS : 0) | in ifx_spi_tiocmget()
295 (test_bit(IFX_SPI_DSR, &ifx_dev->signal_state) ? TIOCM_DSR : 0) | in ifx_spi_tiocmget()
296 (test_bit(IFX_SPI_DCD, &ifx_dev->signal_state) ? TIOCM_CAR : 0) | in ifx_spi_tiocmget()
297 (test_bit(IFX_SPI_RI, &ifx_dev->signal_state) ? TIOCM_RNG : 0); in ifx_spi_tiocmget()
315 struct ifx_spi_device *ifx_dev = tty->driver_data; in ifx_spi_tiocmset() local
318 set_bit(IFX_SPI_RTS, &ifx_dev->signal_state); in ifx_spi_tiocmset()
320 set_bit(IFX_SPI_DTR, &ifx_dev->signal_state); in ifx_spi_tiocmset()
322 clear_bit(IFX_SPI_RTS, &ifx_dev->signal_state); in ifx_spi_tiocmset()
324 clear_bit(IFX_SPI_DTR, &ifx_dev->signal_state); in ifx_spi_tiocmset()
326 set_bit(IFX_SPI_UPDATE, &ifx_dev->signal_state); in ifx_spi_tiocmset()
355 struct ifx_spi_device *ifx_dev = tty->driver_data; in ifx_spi_close() local
356 tty_port_close(&ifx_dev->tty_port, tty, filp); in ifx_spi_close()
429 static int ifx_spi_prepare_tx_buffer(struct ifx_spi_device *ifx_dev) in ifx_spi_prepare_tx_buffer() argument
436 tx_buffer = ifx_dev->tx_buffer; in ifx_spi_prepare_tx_buffer()
444 ifx_dev->spi_more = 0; in ifx_spi_prepare_tx_buffer()
447 if (!ifx_dev->spi_slave_cts) { in ifx_spi_prepare_tx_buffer()
449 queue_length = kfifo_len(&ifx_dev->tx_fifo); in ifx_spi_prepare_tx_buffer()
453 temp_count = kfifo_out_locked(&ifx_dev->tx_fifo, in ifx_spi_prepare_tx_buffer()
455 &ifx_dev->fifo_lock); in ifx_spi_prepare_tx_buffer()
462 tty_port_tty_wakeup(&ifx_dev->tty_port); in ifx_spi_prepare_tx_buffer()
464 ifx_dev->spi_more = 1; in ifx_spi_prepare_tx_buffer()
469 ifx_spi_setup_spi_header(ifx_dev->tx_buffer, in ifx_spi_prepare_tx_buffer()
471 ifx_dev->spi_more); in ifx_spi_prepare_tx_buffer()
473 ifx_dev->swap_buf((ifx_dev->tx_buffer), tx_count, in ifx_spi_prepare_tx_buffer()
474 &ifx_dev->tx_buffer[IFX_SPI_TRANSFER_SIZE]); in ifx_spi_prepare_tx_buffer()
491 struct ifx_spi_device *ifx_dev = tty->driver_data; in ifx_spi_write() local
497 spin_lock_irqsave(&ifx_dev->fifo_lock, flags); in ifx_spi_write()
498 is_fifo_empty = kfifo_is_empty(&ifx_dev->tx_fifo); in ifx_spi_write()
499 tx_count = kfifo_in(&ifx_dev->tx_fifo, tmp_buf, count); in ifx_spi_write()
500 spin_unlock_irqrestore(&ifx_dev->fifo_lock, flags); in ifx_spi_write()
502 mrdy_assert(ifx_dev); in ifx_spi_write()
516 struct ifx_spi_device *ifx_dev = tty->driver_data; in ifx_spi_write_room() local
517 return IFX_SPI_FIFO_SIZE - kfifo_len(&ifx_dev->tx_fifo); in ifx_spi_write_room()
529 struct ifx_spi_device *ifx_dev = tty->driver_data; in ifx_spi_chars_in_buffer() local
530 return kfifo_len(&ifx_dev->tx_fifo); in ifx_spi_chars_in_buffer()
543 struct ifx_spi_device *ifx_dev = tty->driver_data; in ifx_spi_hangup() local
544 tty_port_hangup(&ifx_dev->tty_port); in ifx_spi_hangup()
556 struct ifx_spi_device *ifx_dev = in ifx_port_activate() local
560 kfifo_reset(&ifx_dev->tx_fifo); in ifx_port_activate()
563 clear_bit(IFX_SPI_STATE_IO_IN_PROGRESS, &ifx_dev->flags); in ifx_port_activate()
564 clear_bit(IFX_SPI_STATE_IO_READY, &ifx_dev->flags); in ifx_port_activate()
567 tty->driver_data = ifx_dev; in ifx_port_activate()
573 set_bit(IFX_SPI_STATE_IO_AVAILABLE, &ifx_dev->flags); in ifx_port_activate()
587 struct ifx_spi_device *ifx_dev = in ifx_port_shutdown() local
590 clear_bit(IFX_SPI_STATE_IO_AVAILABLE, &ifx_dev->flags); in ifx_port_shutdown()
591 mrdy_set_low(ifx_dev); in ifx_port_shutdown()
592 del_timer(&ifx_dev->spi_timer); in ifx_port_shutdown()
593 clear_bit(IFX_SPI_STATE_TIMER_PENDING, &ifx_dev->flags); in ifx_port_shutdown()
594 tasklet_kill(&ifx_dev->io_work_tasklet); in ifx_port_shutdown()
622 static void ifx_spi_insert_flip_string(struct ifx_spi_device *ifx_dev, in ifx_spi_insert_flip_string() argument
625 tty_insert_flip_string(&ifx_dev->tty_port, chars, size); in ifx_spi_insert_flip_string()
626 tty_flip_buffer_push(&ifx_dev->tty_port); in ifx_spi_insert_flip_string()
638 struct ifx_spi_device *ifx_dev = ctx; in ifx_spi_complete() local
648 mrdy_set_low(ifx_dev); in ifx_spi_complete()
650 if (!ifx_dev->spi_msg.status) { in ifx_spi_complete()
652 ifx_dev->swap_buf(ifx_dev->rx_buffer, IFX_SPI_HEADER_OVERHEAD, in ifx_spi_complete()
653 &ifx_dev->rx_buffer[IFX_SPI_HEADER_OVERHEAD]); in ifx_spi_complete()
654 decode_result = ifx_spi_decode_spi_header(ifx_dev->rx_buffer, in ifx_spi_complete()
657 dev_dbg(&ifx_dev->spi_dev->dev, in ifx_spi_complete()
659 ifx_dev->spi_slave_cts = 0; in ifx_spi_complete()
662 dev_dbg(&ifx_dev->spi_dev->dev, in ifx_spi_complete()
667 ifx_dev->spi_slave_cts = cts; in ifx_spi_complete()
670 ifx_dev->spi_msg.actual_length); in ifx_spi_complete()
671 ifx_dev->swap_buf( in ifx_spi_complete()
672 (ifx_dev->rx_buffer + IFX_SPI_HEADER_OVERHEAD), in ifx_spi_complete()
674 &ifx_dev->rx_buffer[IFX_SPI_TRANSFER_SIZE]); in ifx_spi_complete()
676 ifx_dev, in ifx_spi_complete()
677 ifx_dev->rx_buffer + IFX_SPI_HEADER_OVERHEAD, in ifx_spi_complete()
681 dev_dbg(&ifx_dev->spi_dev->dev, "SPI transfer error %d", in ifx_spi_complete()
682 ifx_dev->spi_msg.status); in ifx_spi_complete()
686 if (ifx_dev->write_pending) { in ifx_spi_complete()
687 ifx_dev->write_pending = 0; in ifx_spi_complete()
691 clear_bit(IFX_SPI_STATE_IO_IN_PROGRESS, &(ifx_dev->flags)); in ifx_spi_complete()
693 queue_length = kfifo_len(&ifx_dev->tx_fifo); in ifx_spi_complete()
694 srdy = gpio_get_value(ifx_dev->gpio.srdy); in ifx_spi_complete()
696 ifx_spi_power_state_clear(ifx_dev, IFX_SPI_POWER_SRDY); in ifx_spi_complete()
699 if (test_and_clear_bit(IFX_SPI_STATE_IO_READY, &ifx_dev->flags)) in ifx_spi_complete()
700 tasklet_schedule(&ifx_dev->io_work_tasklet); in ifx_spi_complete()
702 if (more || ifx_dev->spi_more || queue_length > 0 || in ifx_spi_complete()
704 if (ifx_dev->spi_slave_cts) { in ifx_spi_complete()
706 mrdy_assert(ifx_dev); in ifx_spi_complete()
708 mrdy_assert(ifx_dev); in ifx_spi_complete()
715 ifx_spi_power_state_clear(ifx_dev, in ifx_spi_complete()
717 tty_port_tty_wakeup(&ifx_dev->tty_port); in ifx_spi_complete()
732 struct ifx_spi_device *ifx_dev = (struct ifx_spi_device *) data; in ifx_spi_io() local
734 if (!test_and_set_bit(IFX_SPI_STATE_IO_IN_PROGRESS, &ifx_dev->flags) && in ifx_spi_io()
735 test_bit(IFX_SPI_STATE_IO_AVAILABLE, &ifx_dev->flags)) { in ifx_spi_io()
736 if (ifx_dev->gpio.unack_srdy_int_nb > 0) in ifx_spi_io()
737 ifx_dev->gpio.unack_srdy_int_nb--; in ifx_spi_io()
739 ifx_spi_prepare_tx_buffer(ifx_dev); in ifx_spi_io()
741 spi_message_init(&ifx_dev->spi_msg); in ifx_spi_io()
742 INIT_LIST_HEAD(&ifx_dev->spi_msg.queue); in ifx_spi_io()
744 ifx_dev->spi_msg.context = ifx_dev; in ifx_spi_io()
745 ifx_dev->spi_msg.complete = ifx_spi_complete; in ifx_spi_io()
749 ifx_dev->spi_xfer.len = IFX_SPI_TRANSFER_SIZE; in ifx_spi_io()
750 ifx_dev->spi_xfer.cs_change = 0; in ifx_spi_io()
751 ifx_dev->spi_xfer.speed_hz = ifx_dev->spi_dev->max_speed_hz; in ifx_spi_io()
753 ifx_dev->spi_xfer.bits_per_word = in ifx_spi_io()
754 ifx_dev->spi_dev->bits_per_word; in ifx_spi_io()
756 ifx_dev->spi_xfer.tx_buf = ifx_dev->tx_buffer; in ifx_spi_io()
757 ifx_dev->spi_xfer.rx_buf = ifx_dev->rx_buffer; in ifx_spi_io()
762 if (ifx_dev->use_dma) { in ifx_spi_io()
763 ifx_dev->spi_msg.is_dma_mapped = 1; in ifx_spi_io()
764 ifx_dev->tx_dma = ifx_dev->tx_bus; in ifx_spi_io()
765 ifx_dev->rx_dma = ifx_dev->rx_bus; in ifx_spi_io()
766 ifx_dev->spi_xfer.tx_dma = ifx_dev->tx_dma; in ifx_spi_io()
767 ifx_dev->spi_xfer.rx_dma = ifx_dev->rx_dma; in ifx_spi_io()
769 ifx_dev->spi_msg.is_dma_mapped = 0; in ifx_spi_io()
770 ifx_dev->tx_dma = (dma_addr_t)0; in ifx_spi_io()
771 ifx_dev->rx_dma = (dma_addr_t)0; in ifx_spi_io()
772 ifx_dev->spi_xfer.tx_dma = (dma_addr_t)0; in ifx_spi_io()
773 ifx_dev->spi_xfer.rx_dma = (dma_addr_t)0; in ifx_spi_io()
776 spi_message_add_tail(&ifx_dev->spi_xfer, &ifx_dev->spi_msg); in ifx_spi_io()
781 mrdy_assert(ifx_dev); in ifx_spi_io()
783 retval = spi_async(ifx_dev->spi_dev, &ifx_dev->spi_msg); in ifx_spi_io()
786 &ifx_dev->flags); in ifx_spi_io()
787 tasklet_schedule(&ifx_dev->io_work_tasklet); in ifx_spi_io()
791 ifx_dev->write_pending = 1; in ifx_spi_io()
800 static void ifx_spi_free_port(struct ifx_spi_device *ifx_dev) in ifx_spi_free_port() argument
802 if (ifx_dev->tty_dev) in ifx_spi_free_port()
803 tty_unregister_device(tty_drv, ifx_dev->minor); in ifx_spi_free_port()
804 tty_port_destroy(&ifx_dev->tty_port); in ifx_spi_free_port()
805 kfifo_free(&ifx_dev->tx_fifo); in ifx_spi_free_port()
815 static int ifx_spi_create_port(struct ifx_spi_device *ifx_dev) in ifx_spi_create_port() argument
818 struct tty_port *pport = &ifx_dev->tty_port; in ifx_spi_create_port()
820 spin_lock_init(&ifx_dev->fifo_lock); in ifx_spi_create_port()
821 lockdep_set_class_and_subclass(&ifx_dev->fifo_lock, in ifx_spi_create_port()
824 if (kfifo_alloc(&ifx_dev->tx_fifo, IFX_SPI_FIFO_SIZE, GFP_KERNEL)) { in ifx_spi_create_port()
831 ifx_dev->minor = IFX_SPI_TTY_ID; in ifx_spi_create_port()
832 ifx_dev->tty_dev = tty_port_register_device(pport, tty_drv, in ifx_spi_create_port()
833 ifx_dev->minor, &ifx_dev->spi_dev->dev); in ifx_spi_create_port()
834 if (IS_ERR(ifx_dev->tty_dev)) { in ifx_spi_create_port()
835 dev_dbg(&ifx_dev->spi_dev->dev, in ifx_spi_create_port()
837 ret = PTR_ERR(ifx_dev->tty_dev); in ifx_spi_create_port()
845 ifx_spi_free_port(ifx_dev); in ifx_spi_create_port()
857 static void ifx_spi_handle_srdy(struct ifx_spi_device *ifx_dev) in ifx_spi_handle_srdy() argument
859 if (test_bit(IFX_SPI_STATE_TIMER_PENDING, &ifx_dev->flags)) { in ifx_spi_handle_srdy()
860 del_timer(&ifx_dev->spi_timer); in ifx_spi_handle_srdy()
861 clear_bit(IFX_SPI_STATE_TIMER_PENDING, &ifx_dev->flags); in ifx_spi_handle_srdy()
864 ifx_spi_power_state_set(ifx_dev, IFX_SPI_POWER_SRDY); in ifx_spi_handle_srdy()
866 if (!test_bit(IFX_SPI_STATE_IO_IN_PROGRESS, &ifx_dev->flags)) in ifx_spi_handle_srdy()
867 tasklet_schedule(&ifx_dev->io_work_tasklet); in ifx_spi_handle_srdy()
869 set_bit(IFX_SPI_STATE_IO_READY, &ifx_dev->flags); in ifx_spi_handle_srdy()
881 struct ifx_spi_device *ifx_dev = dev; in ifx_spi_srdy_interrupt() local
882 ifx_dev->gpio.unack_srdy_int_nb++; in ifx_spi_srdy_interrupt()
883 ifx_spi_handle_srdy(ifx_dev); in ifx_spi_srdy_interrupt()
900 struct ifx_spi_device *ifx_dev = dev; in ifx_spi_reset_interrupt() local
901 int val = gpio_get_value(ifx_dev->gpio.reset_out); in ifx_spi_reset_interrupt()
902 int solreset = test_bit(MR_START, &ifx_dev->mdm_reset_state); in ifx_spi_reset_interrupt()
906 set_bit(MR_INPROGRESS, &ifx_dev->mdm_reset_state); in ifx_spi_reset_interrupt()
909 tty_port_tty_hangup(&ifx_dev->tty_port, false); in ifx_spi_reset_interrupt()
913 clear_bit(MR_INPROGRESS, &ifx_dev->mdm_reset_state); in ifx_spi_reset_interrupt()
915 set_bit(MR_COMPLETE, &ifx_dev->mdm_reset_state); in ifx_spi_reset_interrupt()
916 wake_up(&ifx_dev->mdm_reset_wait); in ifx_spi_reset_interrupt()
928 static void ifx_spi_free_device(struct ifx_spi_device *ifx_dev) in ifx_spi_free_device() argument
930 ifx_spi_free_port(ifx_dev); in ifx_spi_free_device()
931 dma_free_coherent(&ifx_dev->spi_dev->dev, in ifx_spi_free_device()
933 ifx_dev->tx_buffer, in ifx_spi_free_device()
934 ifx_dev->tx_bus); in ifx_spi_free_device()
935 dma_free_coherent(&ifx_dev->spi_dev->dev, in ifx_spi_free_device()
937 ifx_dev->rx_buffer, in ifx_spi_free_device()
938 ifx_dev->rx_bus); in ifx_spi_free_device()
947 static int ifx_spi_reset(struct ifx_spi_device *ifx_dev) in ifx_spi_reset() argument
956 set_bit(MR_START, &ifx_dev->mdm_reset_state); in ifx_spi_reset()
957 gpio_set_value(ifx_dev->gpio.po, 0); in ifx_spi_reset()
958 gpio_set_value(ifx_dev->gpio.reset, 0); in ifx_spi_reset()
960 gpio_set_value(ifx_dev->gpio.reset, 1); in ifx_spi_reset()
962 gpio_set_value(ifx_dev->gpio.po, 1); in ifx_spi_reset()
964 gpio_set_value(ifx_dev->gpio.po, 0); in ifx_spi_reset()
965 ret = wait_event_timeout(ifx_dev->mdm_reset_wait, in ifx_spi_reset()
967 &ifx_dev->mdm_reset_state), in ifx_spi_reset()
970 dev_warn(&ifx_dev->spi_dev->dev, "Modem reset timeout: (state:%lx)", in ifx_spi_reset()
971 ifx_dev->mdm_reset_state); in ifx_spi_reset()
973 ifx_dev->mdm_reset_state = 0; in ifx_spi_reset()
994 struct ifx_spi_device *ifx_dev; in ifx_spi_spi_probe() local
1008 ifx_dev = kzalloc(sizeof(struct ifx_spi_device), GFP_KERNEL); in ifx_spi_spi_probe()
1009 if (!ifx_dev) { in ifx_spi_spi_probe()
1013 saved_ifx_dev = ifx_dev; in ifx_spi_spi_probe()
1014 ifx_dev->spi_dev = spi; in ifx_spi_spi_probe()
1015 clear_bit(IFX_SPI_STATE_IO_IN_PROGRESS, &ifx_dev->flags); in ifx_spi_spi_probe()
1016 spin_lock_init(&ifx_dev->write_lock); in ifx_spi_spi_probe()
1017 spin_lock_init(&ifx_dev->power_lock); in ifx_spi_spi_probe()
1018 ifx_dev->power_status = 0; in ifx_spi_spi_probe()
1019 timer_setup(&ifx_dev->spi_timer, ifx_spi_timeout, 0); in ifx_spi_spi_probe()
1020 ifx_dev->modem = pl_data->modem_type; in ifx_spi_spi_probe()
1021 ifx_dev->use_dma = pl_data->use_dma; in ifx_spi_spi_probe()
1022 ifx_dev->max_hz = pl_data->max_hz; in ifx_spi_spi_probe()
1024 spi->max_speed_hz = ifx_dev->max_hz; in ifx_spi_spi_probe()
1030 kfree(ifx_dev); in ifx_spi_spi_probe()
1036 ifx_dev->swap_buf = swap_buf_32; in ifx_spi_spi_probe()
1038 ifx_dev->swap_buf = swap_buf_16; in ifx_spi_spi_probe()
1040 ifx_dev->swap_buf = swap_buf_8; in ifx_spi_spi_probe()
1043 ifx_dev->spi_more = 0; in ifx_spi_spi_probe()
1044 ifx_dev->spi_slave_cts = 0; in ifx_spi_spi_probe()
1047 ifx_dev->tx_buffer = dma_alloc_coherent(ifx_dev->spi_dev->dev.parent, in ifx_spi_spi_probe()
1049 &ifx_dev->tx_bus, in ifx_spi_spi_probe()
1051 if (!ifx_dev->tx_buffer) { in ifx_spi_spi_probe()
1056 ifx_dev->rx_buffer = dma_alloc_coherent(ifx_dev->spi_dev->dev.parent, in ifx_spi_spi_probe()
1058 &ifx_dev->rx_bus, in ifx_spi_spi_probe()
1060 if (!ifx_dev->rx_buffer) { in ifx_spi_spi_probe()
1067 init_waitqueue_head(&ifx_dev->mdm_reset_wait); in ifx_spi_spi_probe()
1069 spi_set_drvdata(spi, ifx_dev); in ifx_spi_spi_probe()
1070 tasklet_init(&ifx_dev->io_work_tasklet, ifx_spi_io, in ifx_spi_spi_probe()
1071 (unsigned long)ifx_dev); in ifx_spi_spi_probe()
1073 set_bit(IFX_SPI_STATE_PRESENT, &ifx_dev->flags); in ifx_spi_spi_probe()
1076 ret = ifx_spi_create_port(ifx_dev); in ifx_spi_spi_probe()
1082 ifx_dev->gpio.reset = pl_data->rst_pmu; in ifx_spi_spi_probe()
1083 ifx_dev->gpio.po = pl_data->pwr_on; in ifx_spi_spi_probe()
1084 ifx_dev->gpio.mrdy = pl_data->mrdy; in ifx_spi_spi_probe()
1085 ifx_dev->gpio.srdy = pl_data->srdy; in ifx_spi_spi_probe()
1086 ifx_dev->gpio.reset_out = pl_data->rst_out; in ifx_spi_spi_probe()
1089 ifx_dev->gpio.reset, ifx_dev->gpio.po, ifx_dev->gpio.mrdy, in ifx_spi_spi_probe()
1090 ifx_dev->gpio.srdy, ifx_dev->gpio.reset_out); in ifx_spi_spi_probe()
1093 ret = gpio_request(ifx_dev->gpio.reset, "ifxModem"); in ifx_spi_spi_probe()
1096 ifx_dev->gpio.reset); in ifx_spi_spi_probe()
1099 ret += gpio_direction_output(ifx_dev->gpio.reset, 0); in ifx_spi_spi_probe()
1100 ret += gpio_export(ifx_dev->gpio.reset, 1); in ifx_spi_spi_probe()
1103 ifx_dev->gpio.reset); in ifx_spi_spi_probe()
1108 ret = gpio_request(ifx_dev->gpio.po, "ifxModem"); in ifx_spi_spi_probe()
1109 ret += gpio_direction_output(ifx_dev->gpio.po, 0); in ifx_spi_spi_probe()
1110 ret += gpio_export(ifx_dev->gpio.po, 1); in ifx_spi_spi_probe()
1113 ifx_dev->gpio.po); in ifx_spi_spi_probe()
1118 ret = gpio_request(ifx_dev->gpio.mrdy, "ifxModem"); in ifx_spi_spi_probe()
1121 ifx_dev->gpio.mrdy); in ifx_spi_spi_probe()
1124 ret += gpio_export(ifx_dev->gpio.mrdy, 1); in ifx_spi_spi_probe()
1125 ret += gpio_direction_output(ifx_dev->gpio.mrdy, 0); in ifx_spi_spi_probe()
1128 ifx_dev->gpio.mrdy); in ifx_spi_spi_probe()
1133 ret = gpio_request(ifx_dev->gpio.srdy, "ifxModem"); in ifx_spi_spi_probe()
1136 ifx_dev->gpio.srdy); in ifx_spi_spi_probe()
1140 ret += gpio_export(ifx_dev->gpio.srdy, 1); in ifx_spi_spi_probe()
1141 ret += gpio_direction_input(ifx_dev->gpio.srdy); in ifx_spi_spi_probe()
1144 ifx_dev->gpio.srdy); in ifx_spi_spi_probe()
1149 ret = gpio_request(ifx_dev->gpio.reset_out, "ifxModem"); in ifx_spi_spi_probe()
1152 ifx_dev->gpio.reset_out); in ifx_spi_spi_probe()
1155 ret += gpio_export(ifx_dev->gpio.reset_out, 1); in ifx_spi_spi_probe()
1156 ret += gpio_direction_input(ifx_dev->gpio.reset_out); in ifx_spi_spi_probe()
1159 ifx_dev->gpio.reset_out); in ifx_spi_spi_probe()
1164 ret = request_irq(gpio_to_irq(ifx_dev->gpio.reset_out), in ifx_spi_spi_probe()
1167 ifx_dev); in ifx_spi_spi_probe()
1170 gpio_to_irq(ifx_dev->gpio.reset_out)); in ifx_spi_spi_probe()
1174 ret = ifx_spi_reset(ifx_dev); in ifx_spi_spi_probe()
1176 ret = request_irq(gpio_to_irq(ifx_dev->gpio.srdy), in ifx_spi_spi_probe()
1178 ifx_dev); in ifx_spi_spi_probe()
1181 gpio_to_irq(ifx_dev->gpio.srdy)); in ifx_spi_spi_probe()
1193 srdy = gpio_get_value(ifx_dev->gpio.srdy); in ifx_spi_spi_probe()
1196 mrdy_assert(ifx_dev); in ifx_spi_spi_probe()
1197 ifx_spi_handle_srdy(ifx_dev); in ifx_spi_spi_probe()
1199 mrdy_set_low(ifx_dev); in ifx_spi_spi_probe()
1203 free_irq(gpio_to_irq(ifx_dev->gpio.reset_out), ifx_dev); in ifx_spi_spi_probe()
1205 gpio_free(ifx_dev->gpio.srdy); in ifx_spi_spi_probe()
1207 gpio_free(ifx_dev->gpio.mrdy); in ifx_spi_spi_probe()
1209 gpio_free(ifx_dev->gpio.reset); in ifx_spi_spi_probe()
1211 gpio_free(ifx_dev->gpio.po); in ifx_spi_spi_probe()
1213 gpio_free(ifx_dev->gpio.reset_out); in ifx_spi_spi_probe()
1215 ifx_spi_free_device(ifx_dev); in ifx_spi_spi_probe()
1230 struct ifx_spi_device *ifx_dev = spi_get_drvdata(spi); in ifx_spi_spi_remove() local
1232 tasklet_kill(&ifx_dev->io_work_tasklet); in ifx_spi_spi_remove()
1234 free_irq(gpio_to_irq(ifx_dev->gpio.reset_out), ifx_dev); in ifx_spi_spi_remove()
1235 free_irq(gpio_to_irq(ifx_dev->gpio.srdy), ifx_dev); in ifx_spi_spi_remove()
1237 gpio_free(ifx_dev->gpio.srdy); in ifx_spi_spi_remove()
1238 gpio_free(ifx_dev->gpio.mrdy); in ifx_spi_spi_remove()
1239 gpio_free(ifx_dev->gpio.reset); in ifx_spi_spi_remove()
1240 gpio_free(ifx_dev->gpio.po); in ifx_spi_spi_remove()
1241 gpio_free(ifx_dev->gpio.reset_out); in ifx_spi_spi_remove()
1244 ifx_spi_free_device(ifx_dev); in ifx_spi_spi_remove()
1259 struct ifx_spi_device *ifx_dev = spi_get_drvdata(spi); in ifx_spi_spi_shutdown() local
1261 ifx_modem_power_off(ifx_dev); in ifx_spi_spi_shutdown()
1326 struct ifx_spi_device *ifx_dev = spi_get_drvdata(spi); in ifx_spi_pm_runtime_idle() local
1328 if (!ifx_dev->power_status) in ifx_spi_pm_runtime_idle()