Lines Matching refs:drv_data
173 *lpss_get_config(const struct driver_data *drv_data) in lpss_get_config() argument
175 return &lpss_platforms[drv_data->ssp_type - LPSS_LPT_SSP]; in lpss_get_config()
178 static bool is_lpss_ssp(const struct driver_data *drv_data) in is_lpss_ssp() argument
180 switch (drv_data->ssp_type) { in is_lpss_ssp()
193 static bool is_quark_x1000_ssp(const struct driver_data *drv_data) in is_quark_x1000_ssp() argument
195 return drv_data->ssp_type == QUARK_X1000_SSP; in is_quark_x1000_ssp()
198 static bool is_mmp2_ssp(const struct driver_data *drv_data) in is_mmp2_ssp() argument
200 return drv_data->ssp_type == MMP2_SSP; in is_mmp2_ssp()
203 static bool is_mrfld_ssp(const struct driver_data *drv_data) in is_mrfld_ssp() argument
205 return drv_data->ssp_type == MRFLD_SSP; in is_mrfld_ssp()
208 static void pxa2xx_spi_update(const struct driver_data *drv_data, u32 reg, u32 mask, u32 value) in pxa2xx_spi_update() argument
210 if ((pxa2xx_spi_read(drv_data, reg) & mask) != value) in pxa2xx_spi_update()
211 pxa2xx_spi_write(drv_data, reg, value & mask); in pxa2xx_spi_update()
214 static u32 pxa2xx_spi_get_ssrc1_change_mask(const struct driver_data *drv_data) in pxa2xx_spi_get_ssrc1_change_mask() argument
216 switch (drv_data->ssp_type) { in pxa2xx_spi_get_ssrc1_change_mask()
227 pxa2xx_spi_get_rx_default_thre(const struct driver_data *drv_data) in pxa2xx_spi_get_rx_default_thre() argument
229 switch (drv_data->ssp_type) { in pxa2xx_spi_get_rx_default_thre()
239 static bool pxa2xx_spi_txfifo_full(const struct driver_data *drv_data) in pxa2xx_spi_txfifo_full() argument
243 switch (drv_data->ssp_type) { in pxa2xx_spi_txfifo_full()
255 return read_SSSR_bits(drv_data, mask) == mask; in pxa2xx_spi_txfifo_full()
258 static void pxa2xx_spi_clear_rx_thre(const struct driver_data *drv_data, in pxa2xx_spi_clear_rx_thre() argument
263 switch (drv_data->ssp_type) { in pxa2xx_spi_clear_rx_thre()
277 static void pxa2xx_spi_set_rx_thre(const struct driver_data *drv_data, in pxa2xx_spi_set_rx_thre() argument
280 switch (drv_data->ssp_type) { in pxa2xx_spi_set_rx_thre()
293 static u32 pxa2xx_configure_sscr0(const struct driver_data *drv_data, in pxa2xx_configure_sscr0() argument
296 switch (drv_data->ssp_type) { in pxa2xx_configure_sscr0()
313 static u32 __lpss_ssp_read_priv(struct driver_data *drv_data, unsigned offset) in __lpss_ssp_read_priv() argument
315 WARN_ON(!drv_data->lpss_base); in __lpss_ssp_read_priv()
316 return readl(drv_data->lpss_base + offset); in __lpss_ssp_read_priv()
319 static void __lpss_ssp_write_priv(struct driver_data *drv_data, in __lpss_ssp_write_priv() argument
322 WARN_ON(!drv_data->lpss_base); in __lpss_ssp_write_priv()
323 writel(value, drv_data->lpss_base + offset); in __lpss_ssp_write_priv()
333 static void lpss_ssp_setup(struct driver_data *drv_data) in lpss_ssp_setup() argument
338 config = lpss_get_config(drv_data); in lpss_ssp_setup()
339 drv_data->lpss_base = drv_data->ssp->mmio_base + config->offset; in lpss_ssp_setup()
342 value = __lpss_ssp_read_priv(drv_data, config->reg_cs_ctrl); in lpss_ssp_setup()
345 __lpss_ssp_write_priv(drv_data, config->reg_cs_ctrl, value); in lpss_ssp_setup()
348 if (drv_data->controller_info->enable_dma) { in lpss_ssp_setup()
349 __lpss_ssp_write_priv(drv_data, config->reg_ssp, 1); in lpss_ssp_setup()
352 value = __lpss_ssp_read_priv(drv_data, in lpss_ssp_setup()
355 __lpss_ssp_write_priv(drv_data, in lpss_ssp_setup()
364 struct driver_data *drv_data = in lpss_ssp_select_cs() local
371 value = __lpss_ssp_read_priv(drv_data, config->reg_cs_ctrl); in lpss_ssp_select_cs()
385 __lpss_ssp_write_priv(drv_data, in lpss_ssp_select_cs()
388 (drv_data->controller->max_speed_hz / 2)); in lpss_ssp_select_cs()
394 struct driver_data *drv_data = in lpss_ssp_cs_control() local
399 config = lpss_get_config(drv_data); in lpss_ssp_cs_control()
404 value = __lpss_ssp_read_priv(drv_data, config->reg_cs_ctrl); in lpss_ssp_cs_control()
409 __lpss_ssp_write_priv(drv_data, config->reg_cs_ctrl, value); in lpss_ssp_cs_control()
419 clkgate = __lpss_ssp_read_priv(drv_data, LPSS_PRIV_CLOCK_GATE); in lpss_ssp_cs_control()
423 __lpss_ssp_write_priv(drv_data, LPSS_PRIV_CLOCK_GATE, value); in lpss_ssp_cs_control()
424 __lpss_ssp_write_priv(drv_data, LPSS_PRIV_CLOCK_GATE, clkgate); in lpss_ssp_cs_control()
431 struct driver_data *drv_data = in cs_assert() local
434 if (drv_data->ssp_type == CE4100_SSP) { in cs_assert()
435 pxa2xx_spi_write(drv_data, SSSR, spi->chip_select); in cs_assert()
444 if (is_lpss_ssp(drv_data)) in cs_assert()
451 struct driver_data *drv_data = in cs_deassert() local
455 if (drv_data->ssp_type == CE4100_SSP) in cs_deassert()
460 while (pxa2xx_spi_read(drv_data, SSSR) & SSSR_BSY && in cs_deassert()
469 if (is_lpss_ssp(drv_data)) in cs_deassert()
481 int pxa2xx_spi_flush(struct driver_data *drv_data) in pxa2xx_spi_flush() argument
486 while (read_SSSR_bits(drv_data, SSSR_RNE)) in pxa2xx_spi_flush()
487 pxa2xx_spi_read(drv_data, SSDR); in pxa2xx_spi_flush()
488 } while ((pxa2xx_spi_read(drv_data, SSSR) & SSSR_BSY) && --limit); in pxa2xx_spi_flush()
489 write_SSSR_CS(drv_data, SSSR_ROR); in pxa2xx_spi_flush()
494 static void pxa2xx_spi_off(struct driver_data *drv_data) in pxa2xx_spi_off() argument
497 if (is_mmp2_ssp(drv_data)) in pxa2xx_spi_off()
500 pxa_ssp_disable(drv_data->ssp); in pxa2xx_spi_off()
503 static int null_writer(struct driver_data *drv_data) in null_writer() argument
505 u8 n_bytes = drv_data->n_bytes; in null_writer()
507 if (pxa2xx_spi_txfifo_full(drv_data) in null_writer()
508 || (drv_data->tx == drv_data->tx_end)) in null_writer()
511 pxa2xx_spi_write(drv_data, SSDR, 0); in null_writer()
512 drv_data->tx += n_bytes; in null_writer()
517 static int null_reader(struct driver_data *drv_data) in null_reader() argument
519 u8 n_bytes = drv_data->n_bytes; in null_reader()
521 while (read_SSSR_bits(drv_data, SSSR_RNE) && drv_data->rx < drv_data->rx_end) { in null_reader()
522 pxa2xx_spi_read(drv_data, SSDR); in null_reader()
523 drv_data->rx += n_bytes; in null_reader()
526 return drv_data->rx == drv_data->rx_end; in null_reader()
529 static int u8_writer(struct driver_data *drv_data) in u8_writer() argument
531 if (pxa2xx_spi_txfifo_full(drv_data) in u8_writer()
532 || (drv_data->tx == drv_data->tx_end)) in u8_writer()
535 pxa2xx_spi_write(drv_data, SSDR, *(u8 *)(drv_data->tx)); in u8_writer()
536 ++drv_data->tx; in u8_writer()
541 static int u8_reader(struct driver_data *drv_data) in u8_reader() argument
543 while (read_SSSR_bits(drv_data, SSSR_RNE) && drv_data->rx < drv_data->rx_end) { in u8_reader()
544 *(u8 *)(drv_data->rx) = pxa2xx_spi_read(drv_data, SSDR); in u8_reader()
545 ++drv_data->rx; in u8_reader()
548 return drv_data->rx == drv_data->rx_end; in u8_reader()
551 static int u16_writer(struct driver_data *drv_data) in u16_writer() argument
553 if (pxa2xx_spi_txfifo_full(drv_data) in u16_writer()
554 || (drv_data->tx == drv_data->tx_end)) in u16_writer()
557 pxa2xx_spi_write(drv_data, SSDR, *(u16 *)(drv_data->tx)); in u16_writer()
558 drv_data->tx += 2; in u16_writer()
563 static int u16_reader(struct driver_data *drv_data) in u16_reader() argument
565 while (read_SSSR_bits(drv_data, SSSR_RNE) && drv_data->rx < drv_data->rx_end) { in u16_reader()
566 *(u16 *)(drv_data->rx) = pxa2xx_spi_read(drv_data, SSDR); in u16_reader()
567 drv_data->rx += 2; in u16_reader()
570 return drv_data->rx == drv_data->rx_end; in u16_reader()
573 static int u32_writer(struct driver_data *drv_data) in u32_writer() argument
575 if (pxa2xx_spi_txfifo_full(drv_data) in u32_writer()
576 || (drv_data->tx == drv_data->tx_end)) in u32_writer()
579 pxa2xx_spi_write(drv_data, SSDR, *(u32 *)(drv_data->tx)); in u32_writer()
580 drv_data->tx += 4; in u32_writer()
585 static int u32_reader(struct driver_data *drv_data) in u32_reader() argument
587 while (read_SSSR_bits(drv_data, SSSR_RNE) && drv_data->rx < drv_data->rx_end) { in u32_reader()
588 *(u32 *)(drv_data->rx) = pxa2xx_spi_read(drv_data, SSDR); in u32_reader()
589 drv_data->rx += 4; in u32_reader()
592 return drv_data->rx == drv_data->rx_end; in u32_reader()
595 static void reset_sccr1(struct driver_data *drv_data) in reset_sccr1() argument
597 u32 mask = drv_data->int_cr1 | drv_data->dma_cr1, threshold; in reset_sccr1()
600 if (drv_data->controller->cur_msg) { in reset_sccr1()
601 chip = spi_get_ctldata(drv_data->controller->cur_msg->spi); in reset_sccr1()
607 switch (drv_data->ssp_type) { in reset_sccr1()
619 pxa2xx_spi_update(drv_data, SSCR1, mask, threshold); in reset_sccr1()
622 static void int_stop_and_reset(struct driver_data *drv_data) in int_stop_and_reset() argument
625 write_SSSR_CS(drv_data, drv_data->clear_sr); in int_stop_and_reset()
626 reset_sccr1(drv_data); in int_stop_and_reset()
627 if (pxa25x_ssp_comp(drv_data)) in int_stop_and_reset()
630 pxa2xx_spi_write(drv_data, SSTO, 0); in int_stop_and_reset()
633 static void int_error_stop(struct driver_data *drv_data, const char *msg, int err) in int_error_stop() argument
635 int_stop_and_reset(drv_data); in int_error_stop()
636 pxa2xx_spi_flush(drv_data); in int_error_stop()
637 pxa2xx_spi_off(drv_data); in int_error_stop()
639 dev_err(drv_data->ssp->dev, "%s\n", msg); in int_error_stop()
641 drv_data->controller->cur_msg->status = err; in int_error_stop()
642 spi_finalize_current_transfer(drv_data->controller); in int_error_stop()
645 static void int_transfer_complete(struct driver_data *drv_data) in int_transfer_complete() argument
647 int_stop_and_reset(drv_data); in int_transfer_complete()
649 spi_finalize_current_transfer(drv_data->controller); in int_transfer_complete()
652 static irqreturn_t interrupt_transfer(struct driver_data *drv_data) in interrupt_transfer() argument
656 irq_status = read_SSSR_bits(drv_data, drv_data->mask_sr); in interrupt_transfer()
657 if (!(pxa2xx_spi_read(drv_data, SSCR1) & SSCR1_TIE)) in interrupt_transfer()
661 int_error_stop(drv_data, "interrupt_transfer: FIFO overrun", -EIO); in interrupt_transfer()
666 int_error_stop(drv_data, "interrupt_transfer: FIFO underrun", -EIO); in interrupt_transfer()
671 pxa2xx_spi_write(drv_data, SSSR, SSSR_TINT); in interrupt_transfer()
672 if (drv_data->read(drv_data)) { in interrupt_transfer()
673 int_transfer_complete(drv_data); in interrupt_transfer()
680 if (drv_data->read(drv_data)) { in interrupt_transfer()
681 int_transfer_complete(drv_data); in interrupt_transfer()
684 } while (drv_data->write(drv_data)); in interrupt_transfer()
686 if (drv_data->read(drv_data)) { in interrupt_transfer()
687 int_transfer_complete(drv_data); in interrupt_transfer()
691 if (drv_data->tx == drv_data->tx_end) { in interrupt_transfer()
695 sccr1_reg = pxa2xx_spi_read(drv_data, SSCR1); in interrupt_transfer()
702 if (pxa25x_ssp_comp(drv_data)) { in interrupt_transfer()
705 pxa2xx_spi_clear_rx_thre(drv_data, &sccr1_reg); in interrupt_transfer()
707 bytes_left = drv_data->rx_end - drv_data->rx; in interrupt_transfer()
708 switch (drv_data->n_bytes) { in interrupt_transfer()
717 rx_thre = pxa2xx_spi_get_rx_default_thre(drv_data); in interrupt_transfer()
721 pxa2xx_spi_set_rx_thre(drv_data, &sccr1_reg, rx_thre); in interrupt_transfer()
723 pxa2xx_spi_write(drv_data, SSCR1, sccr1_reg); in interrupt_transfer()
730 static void handle_bad_msg(struct driver_data *drv_data) in handle_bad_msg() argument
732 int_stop_and_reset(drv_data); in handle_bad_msg()
733 pxa2xx_spi_off(drv_data); in handle_bad_msg()
735 dev_err(drv_data->ssp->dev, "bad message state in interrupt handler\n"); in handle_bad_msg()
740 struct driver_data *drv_data = dev_id; in ssp_int() local
742 u32 mask = drv_data->mask_sr; in ssp_int()
751 if (pm_runtime_suspended(drv_data->ssp->dev)) in ssp_int()
760 status = pxa2xx_spi_read(drv_data, SSSR); in ssp_int()
764 sccr1_reg = pxa2xx_spi_read(drv_data, SSCR1); in ssp_int()
777 pxa2xx_spi_write(drv_data, SSCR1, sccr1_reg & ~drv_data->int_cr1); in ssp_int()
778 pxa2xx_spi_write(drv_data, SSCR1, sccr1_reg); in ssp_int()
780 if (!drv_data->controller->cur_msg) { in ssp_int()
781 handle_bad_msg(drv_data); in ssp_int()
786 return drv_data->transfer_handler(drv_data); in ssp_int()
910 static unsigned int ssp_get_clk_div(struct driver_data *drv_data, int rate) in ssp_get_clk_div() argument
912 unsigned long ssp_clk = drv_data->controller->max_speed_hz; in ssp_get_clk_div()
913 const struct ssp_device *ssp = drv_data->ssp; in ssp_get_clk_div()
927 static unsigned int pxa2xx_ssp_get_clk_div(struct driver_data *drv_data, in pxa2xx_ssp_get_clk_div() argument
931 spi_get_ctldata(drv_data->controller->cur_msg->spi); in pxa2xx_ssp_get_clk_div()
934 switch (drv_data->ssp_type) { in pxa2xx_ssp_get_clk_div()
939 clk_div = ssp_get_clk_div(drv_data, rate); in pxa2xx_ssp_get_clk_div()
960 struct driver_data *drv_data = spi_controller_get_devdata(controller); in pxa2xx_spi_transfer_one() local
965 u32 change_mask = pxa2xx_spi_get_ssrc1_change_mask(drv_data); in pxa2xx_spi_transfer_one()
993 if (pxa2xx_spi_flush(drv_data) == 0) { in pxa2xx_spi_transfer_one()
997 drv_data->n_bytes = chip->n_bytes; in pxa2xx_spi_transfer_one()
998 drv_data->tx = (void *)transfer->tx_buf; in pxa2xx_spi_transfer_one()
999 drv_data->tx_end = drv_data->tx + transfer->len; in pxa2xx_spi_transfer_one()
1000 drv_data->rx = transfer->rx_buf; in pxa2xx_spi_transfer_one()
1001 drv_data->rx_end = drv_data->rx + transfer->len; in pxa2xx_spi_transfer_one()
1002 drv_data->write = drv_data->tx ? chip->write : null_writer; in pxa2xx_spi_transfer_one()
1003 drv_data->read = drv_data->rx ? chip->read : null_reader; in pxa2xx_spi_transfer_one()
1009 clk_div = pxa2xx_ssp_get_clk_div(drv_data, speed); in pxa2xx_spi_transfer_one()
1012 drv_data->n_bytes = 1; in pxa2xx_spi_transfer_one()
1013 drv_data->read = drv_data->read != null_reader ? in pxa2xx_spi_transfer_one()
1015 drv_data->write = drv_data->write != null_writer ? in pxa2xx_spi_transfer_one()
1018 drv_data->n_bytes = 2; in pxa2xx_spi_transfer_one()
1019 drv_data->read = drv_data->read != null_reader ? in pxa2xx_spi_transfer_one()
1021 drv_data->write = drv_data->write != null_writer ? in pxa2xx_spi_transfer_one()
1024 drv_data->n_bytes = 4; in pxa2xx_spi_transfer_one()
1025 drv_data->read = drv_data->read != null_reader ? in pxa2xx_spi_transfer_one()
1027 drv_data->write = drv_data->write != null_writer ? in pxa2xx_spi_transfer_one()
1049 drv_data->transfer_handler = pxa2xx_spi_dma_transfer; in pxa2xx_spi_transfer_one()
1051 err = pxa2xx_spi_dma_prepare(drv_data, transfer); in pxa2xx_spi_transfer_one()
1056 cr1 = chip->cr1 | dma_thresh | drv_data->dma_cr1; in pxa2xx_spi_transfer_one()
1057 pxa2xx_spi_write(drv_data, SSSR, drv_data->clear_sr); in pxa2xx_spi_transfer_one()
1059 pxa2xx_spi_dma_start(drv_data); in pxa2xx_spi_transfer_one()
1062 drv_data->transfer_handler = interrupt_transfer; in pxa2xx_spi_transfer_one()
1065 cr1 = chip->cr1 | chip->threshold | drv_data->int_cr1; in pxa2xx_spi_transfer_one()
1066 write_SSSR_CS(drv_data, drv_data->clear_sr); in pxa2xx_spi_transfer_one()
1070 cr0 = pxa2xx_configure_sscr0(drv_data, clk_div, bits); in pxa2xx_spi_transfer_one()
1071 if (!pxa25x_ssp_comp(drv_data)) in pxa2xx_spi_transfer_one()
1082 if (is_lpss_ssp(drv_data)) { in pxa2xx_spi_transfer_one()
1083 pxa2xx_spi_update(drv_data, SSIRF, GENMASK(7, 0), chip->lpss_rx_threshold); in pxa2xx_spi_transfer_one()
1084 pxa2xx_spi_update(drv_data, SSITF, GENMASK(15, 0), chip->lpss_tx_threshold); in pxa2xx_spi_transfer_one()
1087 if (is_mrfld_ssp(drv_data)) { in pxa2xx_spi_transfer_one()
1094 pxa2xx_spi_update(drv_data, SFIFOTT, mask, thresh); in pxa2xx_spi_transfer_one()
1097 if (is_quark_x1000_ssp(drv_data)) in pxa2xx_spi_transfer_one()
1098 pxa2xx_spi_update(drv_data, DDS_RATE, GENMASK(23, 0), chip->dds_rate); in pxa2xx_spi_transfer_one()
1101 if (!is_mmp2_ssp(drv_data)) in pxa2xx_spi_transfer_one()
1102 pxa_ssp_disable(drv_data->ssp); in pxa2xx_spi_transfer_one()
1104 if (!pxa25x_ssp_comp(drv_data)) in pxa2xx_spi_transfer_one()
1105 pxa2xx_spi_write(drv_data, SSTO, chip->timeout); in pxa2xx_spi_transfer_one()
1108 pxa2xx_spi_update(drv_data, SSCR1, change_mask, cr1); in pxa2xx_spi_transfer_one()
1111 pxa2xx_spi_update(drv_data, SSCR0, GENMASK(31, 0), cr0); in pxa2xx_spi_transfer_one()
1114 pxa_ssp_enable(drv_data->ssp); in pxa2xx_spi_transfer_one()
1116 if (is_mmp2_ssp(drv_data)) { in pxa2xx_spi_transfer_one()
1117 u8 tx_level = read_SSSR_bits(drv_data, SSSR_TFL_MASK) >> 8; in pxa2xx_spi_transfer_one()
1124 drv_data->tx += tx_level; in pxa2xx_spi_transfer_one()
1129 while (drv_data->write(drv_data)) in pxa2xx_spi_transfer_one()
1131 if (drv_data->gpiod_ready) { in pxa2xx_spi_transfer_one()
1132 gpiod_set_value(drv_data->gpiod_ready, 1); in pxa2xx_spi_transfer_one()
1134 gpiod_set_value(drv_data->gpiod_ready, 0); in pxa2xx_spi_transfer_one()
1142 pxa2xx_spi_write(drv_data, SSCR1, cr1); in pxa2xx_spi_transfer_one()
1149 struct driver_data *drv_data = spi_controller_get_devdata(controller); in pxa2xx_spi_slave_abort() local
1151 int_error_stop(drv_data, "transfer aborted", -EINTR); in pxa2xx_spi_slave_abort()
1159 struct driver_data *drv_data = spi_controller_get_devdata(controller); in pxa2xx_spi_handle_err() local
1161 int_stop_and_reset(drv_data); in pxa2xx_spi_handle_err()
1164 pxa2xx_spi_off(drv_data); in pxa2xx_spi_handle_err()
1173 if (atomic_read(&drv_data->dma_running)) in pxa2xx_spi_handle_err()
1174 pxa2xx_spi_dma_stop(drv_data); in pxa2xx_spi_handle_err()
1179 struct driver_data *drv_data = spi_controller_get_devdata(controller); in pxa2xx_spi_unprepare_transfer() local
1182 pxa2xx_spi_off(drv_data); in pxa2xx_spi_unprepare_transfer()
1199 struct driver_data *drv_data = spi_controller_get_devdata(spi->controller); in setup_cs() local
1207 if (drv_data->ssp_type == CE4100_SSP) in setup_cs()
1249 struct driver_data *drv_data = in setup() local
1254 switch (drv_data->ssp_type) { in setup()
1276 config = lpss_get_config(drv_data); in setup()
1283 if (spi_controller_is_slave(drv_data->controller)) { in setup()
1300 if (drv_data->ssp_type == CE4100_SSP) { in setup()
1308 chip->enable_dma = drv_data->controller_info->enable_dma; in setup()
1333 if (spi_controller_is_slave(drv_data->controller)) { in setup()
1340 if (is_lpss_ssp(drv_data)) { in setup()
1346 if (is_mrfld_ssp(drv_data)) { in setup()
1370 switch (drv_data->ssp_type) { in setup()
1410 if (drv_data->ssp_type == CE4100_SSP) in setup()
1639 struct driver_data *drv_data = spi_controller_get_devdata(controller); in pxa2xx_spi_fw_translate_cs() local
1641 if (has_acpi_companion(drv_data->ssp->dev)) { in pxa2xx_spi_fw_translate_cs()
1642 switch (drv_data->ssp_type) { in pxa2xx_spi_fw_translate_cs()
1670 struct driver_data *drv_data; in pxa2xx_spi_probe() local
1695 controller = devm_spi_alloc_slave(dev, sizeof(*drv_data)); in pxa2xx_spi_probe()
1697 controller = devm_spi_alloc_master(dev, sizeof(*drv_data)); in pxa2xx_spi_probe()
1704 drv_data = spi_controller_get_devdata(controller); in pxa2xx_spi_probe()
1705 drv_data->controller = controller; in pxa2xx_spi_probe()
1706 drv_data->controller_info = platform_info; in pxa2xx_spi_probe()
1707 drv_data->ssp = ssp; in pxa2xx_spi_probe()
1728 drv_data->ssp_type = ssp->type; in pxa2xx_spi_probe()
1730 if (pxa25x_ssp_comp(drv_data)) { in pxa2xx_spi_probe()
1731 switch (drv_data->ssp_type) { in pxa2xx_spi_probe()
1740 drv_data->int_cr1 = SSCR1_TIE | SSCR1_RIE; in pxa2xx_spi_probe()
1741 drv_data->dma_cr1 = 0; in pxa2xx_spi_probe()
1742 drv_data->clear_sr = SSSR_ROR; in pxa2xx_spi_probe()
1743 drv_data->mask_sr = SSSR_RFS | SSSR_TFS | SSSR_ROR; in pxa2xx_spi_probe()
1746 drv_data->int_cr1 = SSCR1_TIE | SSCR1_RIE | SSCR1_TINTE; in pxa2xx_spi_probe()
1747 drv_data->dma_cr1 = DEFAULT_DMA_CR1; in pxa2xx_spi_probe()
1748 drv_data->clear_sr = SSSR_ROR | SSSR_TINT; in pxa2xx_spi_probe()
1749 drv_data->mask_sr = SSSR_TINT | SSSR_RFS | SSSR_TFS in pxa2xx_spi_probe()
1754 drv_data); in pxa2xx_spi_probe()
1762 status = pxa2xx_spi_dma_setup(drv_data); in pxa2xx_spi_probe()
1784 if (!pxa25x_ssp_comp(drv_data)) in pxa2xx_spi_probe()
1787 else if (!is_quark_x1000_ssp(drv_data)) in pxa2xx_spi_probe()
1794 switch (drv_data->ssp_type) { in pxa2xx_spi_probe()
1798 pxa2xx_spi_write(drv_data, SSCR1, tmp); in pxa2xx_spi_probe()
1802 pxa2xx_spi_write(drv_data, SSCR0, tmp); in pxa2xx_spi_probe()
1807 pxa2xx_spi_write(drv_data, SSCR1, tmp); in pxa2xx_spi_probe()
1809 pxa2xx_spi_write(drv_data, SSCR0, tmp); in pxa2xx_spi_probe()
1824 pxa2xx_spi_write(drv_data, SSCR1, tmp); in pxa2xx_spi_probe()
1828 pxa2xx_spi_write(drv_data, SSCR0, tmp); in pxa2xx_spi_probe()
1832 if (!pxa25x_ssp_comp(drv_data)) in pxa2xx_spi_probe()
1833 pxa2xx_spi_write(drv_data, SSTO, 0); in pxa2xx_spi_probe()
1835 if (!is_quark_x1000_ssp(drv_data)) in pxa2xx_spi_probe()
1836 pxa2xx_spi_write(drv_data, SSPSP, 0); in pxa2xx_spi_probe()
1838 if (is_lpss_ssp(drv_data)) { in pxa2xx_spi_probe()
1839 lpss_ssp_setup(drv_data); in pxa2xx_spi_probe()
1840 config = lpss_get_config(drv_data); in pxa2xx_spi_probe()
1842 tmp = __lpss_ssp_read_priv(drv_data, in pxa2xx_spi_probe()
1855 drv_data->gpiod_ready = devm_gpiod_get_optional(dev, in pxa2xx_spi_probe()
1857 if (IS_ERR(drv_data->gpiod_ready)) { in pxa2xx_spi_probe()
1858 status = PTR_ERR(drv_data->gpiod_ready); in pxa2xx_spi_probe()
1869 platform_set_drvdata(pdev, drv_data); in pxa2xx_spi_probe()
1885 pxa2xx_spi_dma_release(drv_data); in pxa2xx_spi_probe()
1886 free_irq(ssp->irq, drv_data); in pxa2xx_spi_probe()
1895 struct driver_data *drv_data = platform_get_drvdata(pdev); in pxa2xx_spi_remove() local
1896 struct ssp_device *ssp = drv_data->ssp; in pxa2xx_spi_remove()
1900 spi_unregister_controller(drv_data->controller); in pxa2xx_spi_remove()
1907 if (drv_data->controller_info->enable_dma) in pxa2xx_spi_remove()
1908 pxa2xx_spi_dma_release(drv_data); in pxa2xx_spi_remove()
1914 free_irq(ssp->irq, drv_data); in pxa2xx_spi_remove()
1925 struct driver_data *drv_data = dev_get_drvdata(dev); in pxa2xx_spi_suspend() local
1926 struct ssp_device *ssp = drv_data->ssp; in pxa2xx_spi_suspend()
1929 status = spi_controller_suspend(drv_data->controller); in pxa2xx_spi_suspend()
1943 struct driver_data *drv_data = dev_get_drvdata(dev); in pxa2xx_spi_resume() local
1944 struct ssp_device *ssp = drv_data->ssp; in pxa2xx_spi_resume()
1955 return spi_controller_resume(drv_data->controller); in pxa2xx_spi_resume()
1962 struct driver_data *drv_data = dev_get_drvdata(dev); in pxa2xx_spi_runtime_suspend() local
1964 clk_disable_unprepare(drv_data->ssp->clk); in pxa2xx_spi_runtime_suspend()
1970 struct driver_data *drv_data = dev_get_drvdata(dev); in pxa2xx_spi_runtime_resume() local
1973 status = clk_prepare_enable(drv_data->ssp->clk); in pxa2xx_spi_runtime_resume()