Lines Matching full:se

15 #include <linux/qcom-geni-se.h>
76 struct geni_se se; member
154 writel_relaxed(0, gi2c->se.base + SE_GENI_CLK_SEL); in qcom_geni_i2c_conf()
157 writel_relaxed(val, gi2c->se.base + GENI_SER_M_CLK_CFG); in qcom_geni_i2c_conf()
162 writel_relaxed(val, gi2c->se.base + SE_I2C_SCL_COUNTERS); in qcom_geni_i2c_conf()
167 u32 m_cmd = readl_relaxed(gi2c->se.base + SE_GENI_M_CMD0); in geni_i2c_err_misc()
168 u32 m_stat = readl_relaxed(gi2c->se.base + SE_GENI_M_IRQ_STATUS); in geni_i2c_err_misc()
169 u32 geni_s = readl_relaxed(gi2c->se.base + SE_GENI_STATUS); in geni_i2c_err_misc()
170 u32 geni_ios = readl_relaxed(gi2c->se.base + SE_GENI_IOS); in geni_i2c_err_misc()
171 u32 dma = readl_relaxed(gi2c->se.base + SE_GENI_DMA_MODE_EN); in geni_i2c_err_misc()
175 rx_st = readl_relaxed(gi2c->se.base + SE_DMA_RX_IRQ_STAT); in geni_i2c_err_misc()
176 tx_st = readl_relaxed(gi2c->se.base + SE_DMA_TX_IRQ_STAT); in geni_i2c_err_misc()
178 rx_st = readl_relaxed(gi2c->se.base + SE_GENI_RX_FIFO_STATUS); in geni_i2c_err_misc()
179 tx_st = readl_relaxed(gi2c->se.base + SE_GENI_TX_FIFO_STATUS); in geni_i2c_err_misc()
181 dev_dbg(gi2c->se.dev, "DMA:%d tx_stat:0x%x, rx_stat:0x%x, irq-stat:0x%x\n", in geni_i2c_err_misc()
183 dev_dbg(gi2c->se.dev, "m_cmd:0x%x, geni_status:0x%x, geni_ios:0x%x\n", in geni_i2c_err_misc()
192 dev_dbg(gi2c->se.dev, "len:%d, slv-addr:0x%x, RD/WR:%d\n", in geni_i2c_err()
196 dev_err(gi2c->se.dev, "%s\n", gi2c_log[err].msg); in geni_i2c_err()
204 void __iomem *base = gi2c->se.base; in geni_i2c_irq()
244 dev_dbg(gi2c->se.dev, "i2c dma tx:0x%x, dma rx:0x%x\n", in geni_i2c_irq()
310 geni_se_abort_m_cmd(&gi2c->se); in geni_i2c_abort_xfer()
314 val = readl_relaxed(gi2c->se.base + SE_GENI_M_IRQ_STATUS); in geni_i2c_abort_xfer()
318 dev_err(gi2c->se.dev, "Timeout abort_m_cmd\n"); in geni_i2c_abort_xfer()
326 writel_relaxed(1, gi2c->se.base + SE_DMA_RX_FSM_RST); in geni_i2c_rx_fsm_rst()
329 val = readl_relaxed(gi2c->se.base + SE_DMA_RX_IRQ_STAT); in geni_i2c_rx_fsm_rst()
333 dev_err(gi2c->se.dev, "Timeout resetting RX_FSM\n"); in geni_i2c_rx_fsm_rst()
341 writel_relaxed(1, gi2c->se.base + SE_DMA_TX_FSM_RST); in geni_i2c_tx_fsm_rst()
344 val = readl_relaxed(gi2c->se.base + SE_DMA_TX_IRQ_STAT); in geni_i2c_tx_fsm_rst()
348 dev_err(gi2c->se.dev, "Timeout resetting TX_FSM\n"); in geni_i2c_tx_fsm_rst()
357 struct geni_se *se = &gi2c->se; in geni_i2c_rx_one_msg() local
364 geni_se_select_mode(se, GENI_SE_DMA); in geni_i2c_rx_one_msg()
366 geni_se_select_mode(se, GENI_SE_FIFO); in geni_i2c_rx_one_msg()
368 writel_relaxed(len, se->base + SE_I2C_RX_TRANS_LEN); in geni_i2c_rx_one_msg()
370 if (dma_buf && geni_se_rx_dma_prep(se, dma_buf, len, &rx_dma)) { in geni_i2c_rx_one_msg()
371 geni_se_select_mode(se, GENI_SE_FIFO); in geni_i2c_rx_one_msg()
376 geni_se_setup_m_cmd(se, I2C_READ, m_param); in geni_i2c_rx_one_msg()
386 geni_se_rx_dma_unprep(se, rx_dma, len); in geni_i2c_rx_one_msg()
399 struct geni_se *se = &gi2c->se; in geni_i2c_tx_one_msg() local
406 geni_se_select_mode(se, GENI_SE_DMA); in geni_i2c_tx_one_msg()
408 geni_se_select_mode(se, GENI_SE_FIFO); in geni_i2c_tx_one_msg()
410 writel_relaxed(len, se->base + SE_I2C_TX_TRANS_LEN); in geni_i2c_tx_one_msg()
412 if (dma_buf && geni_se_tx_dma_prep(se, dma_buf, len, &tx_dma)) { in geni_i2c_tx_one_msg()
413 geni_se_select_mode(se, GENI_SE_FIFO); in geni_i2c_tx_one_msg()
418 geni_se_setup_m_cmd(se, I2C_WRITE, m_param); in geni_i2c_tx_one_msg()
421 writel_relaxed(1, se->base + SE_GENI_TX_WATERMARK_REG); in geni_i2c_tx_one_msg()
431 geni_se_tx_dma_unprep(se, tx_dma, len); in geni_i2c_tx_one_msg()
447 ret = pm_runtime_get_sync(gi2c->se.dev); in geni_i2c_xfer()
449 dev_err(gi2c->se.dev, "error turning SE resources:%d\n", ret); in geni_i2c_xfer()
450 pm_runtime_put_noidle(gi2c->se.dev); in geni_i2c_xfer()
452 pm_runtime_set_suspended(gi2c->se.dev); in geni_i2c_xfer()
474 pm_runtime_mark_last_busy(gi2c->se.dev); in geni_i2c_xfer()
475 pm_runtime_put_autosuspend(gi2c->se.dev); in geni_i2c_xfer()
511 gi2c->se.dev = dev; in geni_i2c_probe()
512 gi2c->se.wrapper = dev_get_drvdata(dev->parent); in geni_i2c_probe()
514 gi2c->se.base = devm_ioremap_resource(dev, res); in geni_i2c_probe()
515 if (IS_ERR(gi2c->se.base)) in geni_i2c_probe()
516 return PTR_ERR(gi2c->se.base); in geni_i2c_probe()
518 gi2c->se.clk = devm_clk_get(dev, "se"); in geni_i2c_probe()
519 if (IS_ERR(gi2c->se.clk) && !has_acpi_companion(dev)) in geni_i2c_probe()
520 return PTR_ERR(gi2c->se.clk); in geni_i2c_probe()
561 ret = geni_icc_get(&gi2c->se, "qup-memory"); in geni_i2c_probe()
569 gi2c->se.icc_paths[GENI_TO_CORE].avg_bw = GENI_DEFAULT_BW; in geni_i2c_probe()
570 gi2c->se.icc_paths[CPU_TO_GENI].avg_bw = GENI_DEFAULT_BW; in geni_i2c_probe()
571 gi2c->se.icc_paths[GENI_TO_DDR].avg_bw = Bps_to_icc(gi2c->clk_freq_out); in geni_i2c_probe()
573 ret = geni_icc_set_bw(&gi2c->se); in geni_i2c_probe()
577 ret = geni_se_resources_on(&gi2c->se); in geni_i2c_probe()
582 proto = geni_se_read_proto(&gi2c->se); in geni_i2c_probe()
583 tx_depth = geni_se_get_tx_fifo_depth(&gi2c->se); in geni_i2c_probe()
586 geni_se_resources_off(&gi2c->se); in geni_i2c_probe()
590 geni_se_init(&gi2c->se, gi2c->tx_wm, tx_depth); in geni_i2c_probe()
591 geni_se_config_packing(&gi2c->se, BITS_PER_BYTE, PACKING_BYTES_PW, in geni_i2c_probe()
593 ret = geni_se_resources_off(&gi2c->se); in geni_i2c_probe()
599 ret = geni_icc_disable(&gi2c->se); in geni_i2c_probe()
603 dev_dbg(dev, "i2c fifo/se-dma mode. fifo depth:%d\n", tx_depth); in geni_i2c_probe()
606 pm_runtime_set_suspended(gi2c->se.dev); in geni_i2c_probe()
607 pm_runtime_set_autosuspend_delay(gi2c->se.dev, I2C_AUTO_SUSPEND_DELAY); in geni_i2c_probe()
608 pm_runtime_use_autosuspend(gi2c->se.dev); in geni_i2c_probe()
609 pm_runtime_enable(gi2c->se.dev); in geni_i2c_probe()
614 pm_runtime_disable(gi2c->se.dev); in geni_i2c_probe()
628 pm_runtime_disable(gi2c->se.dev); in geni_i2c_remove()
638 ret = geni_se_resources_off(&gi2c->se); in geni_i2c_runtime_suspend()
647 return geni_icc_disable(&gi2c->se); in geni_i2c_runtime_suspend()
655 ret = geni_icc_enable(&gi2c->se); in geni_i2c_runtime_resume()
659 ret = geni_se_resources_on(&gi2c->se); in geni_i2c_runtime_resume()