Lines Matching refs:se
196 u32 geni_se_get_qup_hw_version(struct geni_se *se) in geni_se_get_qup_hw_version() argument
198 struct geni_wrapper *wrapper = se->wrapper; in geni_se_get_qup_hw_version()
237 static void geni_se_irq_clear(struct geni_se *se) in geni_se_irq_clear() argument
239 writel_relaxed(0, se->base + SE_GSI_EVENT_EN); in geni_se_irq_clear()
240 writel_relaxed(0xffffffff, se->base + SE_GENI_M_IRQ_CLEAR); in geni_se_irq_clear()
241 writel_relaxed(0xffffffff, se->base + SE_GENI_S_IRQ_CLEAR); in geni_se_irq_clear()
242 writel_relaxed(0xffffffff, se->base + SE_DMA_TX_IRQ_CLR); in geni_se_irq_clear()
243 writel_relaxed(0xffffffff, se->base + SE_DMA_RX_IRQ_CLR); in geni_se_irq_clear()
244 writel_relaxed(0xffffffff, se->base + SE_IRQ_EN); in geni_se_irq_clear()
256 void geni_se_init(struct geni_se *se, u32 rx_wm, u32 rx_rfr) in geni_se_init() argument
260 geni_se_irq_clear(se); in geni_se_init()
261 geni_se_io_init(se->base); in geni_se_init()
262 geni_se_io_set_mode(se->base); in geni_se_init()
264 writel_relaxed(rx_wm, se->base + SE_GENI_RX_WATERMARK_REG); in geni_se_init()
265 writel_relaxed(rx_rfr, se->base + SE_GENI_RX_RFR_WATERMARK_REG); in geni_se_init()
267 val = readl_relaxed(se->base + SE_GENI_M_IRQ_EN); in geni_se_init()
269 writel_relaxed(val, se->base + SE_GENI_M_IRQ_EN); in geni_se_init()
271 val = readl_relaxed(se->base + SE_GENI_S_IRQ_EN); in geni_se_init()
273 writel_relaxed(val, se->base + SE_GENI_S_IRQ_EN); in geni_se_init()
277 static void geni_se_select_fifo_mode(struct geni_se *se) in geni_se_select_fifo_mode() argument
279 u32 proto = geni_se_read_proto(se); in geni_se_select_fifo_mode()
282 geni_se_irq_clear(se); in geni_se_select_fifo_mode()
287 val_old = val = readl_relaxed(se->base + SE_GENI_M_IRQ_EN); in geni_se_select_fifo_mode()
291 writel_relaxed(val, se->base + SE_GENI_M_IRQ_EN); in geni_se_select_fifo_mode()
294 val_old = val = readl_relaxed(se->base + SE_GENI_DMA_MODE_EN); in geni_se_select_fifo_mode()
297 writel_relaxed(val, se->base + SE_GENI_DMA_MODE_EN); in geni_se_select_fifo_mode()
300 static void geni_se_select_dma_mode(struct geni_se *se) in geni_se_select_dma_mode() argument
302 u32 proto = geni_se_read_proto(se); in geni_se_select_dma_mode()
305 geni_se_irq_clear(se); in geni_se_select_dma_mode()
310 val_old = val = readl_relaxed(se->base + SE_GENI_M_IRQ_EN); in geni_se_select_dma_mode()
314 writel_relaxed(val, se->base + SE_GENI_M_IRQ_EN); in geni_se_select_dma_mode()
317 val_old = val = readl_relaxed(se->base + SE_GENI_DMA_MODE_EN); in geni_se_select_dma_mode()
320 writel_relaxed(val, se->base + SE_GENI_DMA_MODE_EN); in geni_se_select_dma_mode()
323 static void geni_se_select_gpi_mode(struct geni_se *se) in geni_se_select_gpi_mode() argument
327 geni_se_irq_clear(se); in geni_se_select_gpi_mode()
329 writel(0, se->base + SE_IRQ_EN); in geni_se_select_gpi_mode()
331 val = readl(se->base + SE_GENI_M_IRQ_EN); in geni_se_select_gpi_mode()
334 writel(val, se->base + SE_GENI_M_IRQ_EN); in geni_se_select_gpi_mode()
336 writel(GENI_DMA_MODE_EN, se->base + SE_GENI_DMA_MODE_EN); in geni_se_select_gpi_mode()
338 val = readl(se->base + SE_GSI_EVENT_EN); in geni_se_select_gpi_mode()
340 writel(val, se->base + SE_GSI_EVENT_EN); in geni_se_select_gpi_mode()
348 void geni_se_select_mode(struct geni_se *se, enum geni_se_xfer_mode mode) in geni_se_select_mode() argument
354 geni_se_select_fifo_mode(se); in geni_se_select_mode()
357 geni_se_select_dma_mode(se); in geni_se_select_mode()
360 geni_se_select_gpi_mode(se); in geni_se_select_mode()
431 void geni_se_config_packing(struct geni_se *se, int bpw, int pack_words, in geni_se_config_packing() argument
466 writel_relaxed(cfg0, se->base + SE_GENI_TX_PACKING_CFG0); in geni_se_config_packing()
467 writel_relaxed(cfg1, se->base + SE_GENI_TX_PACKING_CFG1); in geni_se_config_packing()
470 writel_relaxed(cfg0, se->base + SE_GENI_RX_PACKING_CFG0); in geni_se_config_packing()
471 writel_relaxed(cfg1, se->base + SE_GENI_RX_PACKING_CFG1); in geni_se_config_packing()
482 writel_relaxed(bpw / 16, se->base + SE_GENI_BYTE_GRAN); in geni_se_config_packing()
486 static void geni_se_clks_off(struct geni_se *se) in geni_se_clks_off() argument
488 struct geni_wrapper *wrapper = se->wrapper; in geni_se_clks_off()
490 clk_disable_unprepare(se->clk); in geni_se_clks_off()
501 int geni_se_resources_off(struct geni_se *se) in geni_se_resources_off() argument
505 if (has_acpi_companion(se->dev)) in geni_se_resources_off()
508 ret = pinctrl_pm_select_sleep_state(se->dev); in geni_se_resources_off()
512 geni_se_clks_off(se); in geni_se_resources_off()
517 static int geni_se_clks_on(struct geni_se *se) in geni_se_clks_on() argument
520 struct geni_wrapper *wrapper = se->wrapper; in geni_se_clks_on()
526 ret = clk_prepare_enable(se->clk); in geni_se_clks_on()
539 int geni_se_resources_on(struct geni_se *se) in geni_se_resources_on() argument
543 if (has_acpi_companion(se->dev)) in geni_se_resources_on()
546 ret = geni_se_clks_on(se); in geni_se_resources_on()
550 ret = pinctrl_pm_select_default_state(se->dev); in geni_se_resources_on()
552 geni_se_clks_off(se); in geni_se_resources_on()
571 int geni_se_clk_tbl_get(struct geni_se *se, unsigned long **tbl) in geni_se_clk_tbl_get() argument
576 if (se->clk_perf_tbl) { in geni_se_clk_tbl_get()
577 *tbl = se->clk_perf_tbl; in geni_se_clk_tbl_get()
578 return se->num_clk_levels; in geni_se_clk_tbl_get()
581 se->clk_perf_tbl = devm_kcalloc(se->dev, MAX_CLK_PERF_LEVEL, in geni_se_clk_tbl_get()
582 sizeof(*se->clk_perf_tbl), in geni_se_clk_tbl_get()
584 if (!se->clk_perf_tbl) in geni_se_clk_tbl_get()
588 freq = clk_round_rate(se->clk, freq + 1); in geni_se_clk_tbl_get()
589 if (freq <= 0 || freq == se->clk_perf_tbl[i - 1]) in geni_se_clk_tbl_get()
591 se->clk_perf_tbl[i] = freq; in geni_se_clk_tbl_get()
593 se->num_clk_levels = i; in geni_se_clk_tbl_get()
594 *tbl = se->clk_perf_tbl; in geni_se_clk_tbl_get()
595 return se->num_clk_levels; in geni_se_clk_tbl_get()
618 int geni_se_clk_freq_match(struct geni_se *se, unsigned long req_freq, in geni_se_clk_freq_match() argument
629 num_clk_levels = geni_se_clk_tbl_get(se, &tbl); in geni_se_clk_freq_match()
674 void geni_se_tx_init_dma(struct geni_se *se, dma_addr_t iova, size_t len) in geni_se_tx_init_dma() argument
681 writel_relaxed(val, se->base + SE_DMA_TX_IRQ_EN_SET); in geni_se_tx_init_dma()
682 writel_relaxed(lower_32_bits(iova), se->base + SE_DMA_TX_PTR_L); in geni_se_tx_init_dma()
683 writel_relaxed(upper_32_bits(iova), se->base + SE_DMA_TX_PTR_H); in geni_se_tx_init_dma()
684 writel_relaxed(GENI_SE_DMA_EOT_BUF, se->base + SE_DMA_TX_ATTR); in geni_se_tx_init_dma()
685 writel(len, se->base + SE_DMA_TX_LEN); in geni_se_tx_init_dma()
700 int geni_se_tx_dma_prep(struct geni_se *se, void *buf, size_t len, in geni_se_tx_dma_prep() argument
703 struct geni_wrapper *wrapper = se->wrapper; in geni_se_tx_dma_prep()
712 geni_se_tx_init_dma(se, *iova, len); in geni_se_tx_dma_prep()
725 void geni_se_rx_init_dma(struct geni_se *se, dma_addr_t iova, size_t len) in geni_se_rx_init_dma() argument
732 writel_relaxed(val, se->base + SE_DMA_RX_IRQ_EN_SET); in geni_se_rx_init_dma()
733 writel_relaxed(lower_32_bits(iova), se->base + SE_DMA_RX_PTR_L); in geni_se_rx_init_dma()
734 writel_relaxed(upper_32_bits(iova), se->base + SE_DMA_RX_PTR_H); in geni_se_rx_init_dma()
736 writel_relaxed(0, se->base + SE_DMA_RX_ATTR); in geni_se_rx_init_dma()
737 writel(len, se->base + SE_DMA_RX_LEN); in geni_se_rx_init_dma()
752 int geni_se_rx_dma_prep(struct geni_se *se, void *buf, size_t len, in geni_se_rx_dma_prep() argument
755 struct geni_wrapper *wrapper = se->wrapper; in geni_se_rx_dma_prep()
764 geni_se_rx_init_dma(se, *iova, len); in geni_se_rx_dma_prep()
777 void geni_se_tx_dma_unprep(struct geni_se *se, dma_addr_t iova, size_t len) in geni_se_tx_dma_unprep() argument
779 struct geni_wrapper *wrapper = se->wrapper; in geni_se_tx_dma_unprep()
794 void geni_se_rx_dma_unprep(struct geni_se *se, dma_addr_t iova, size_t len) in geni_se_rx_dma_unprep() argument
796 struct geni_wrapper *wrapper = se->wrapper; in geni_se_rx_dma_unprep()
803 int geni_icc_get(struct geni_se *se, const char *icc_ddr) in geni_icc_get() argument
808 if (has_acpi_companion(se->dev)) in geni_icc_get()
811 for (i = 0; i < ARRAY_SIZE(se->icc_paths); i++) { in geni_icc_get()
815 se->icc_paths[i].path = devm_of_icc_get(se->dev, icc_names[i]); in geni_icc_get()
816 if (IS_ERR(se->icc_paths[i].path)) in geni_icc_get()
823 err = PTR_ERR(se->icc_paths[i].path); in geni_icc_get()
825 dev_err_ratelimited(se->dev, "Failed to get ICC path '%s': %d\n", in geni_icc_get()
832 int geni_icc_set_bw(struct geni_se *se) in geni_icc_set_bw() argument
836 for (i = 0; i < ARRAY_SIZE(se->icc_paths); i++) { in geni_icc_set_bw()
837 ret = icc_set_bw(se->icc_paths[i].path, in geni_icc_set_bw()
838 se->icc_paths[i].avg_bw, se->icc_paths[i].avg_bw); in geni_icc_set_bw()
840 dev_err_ratelimited(se->dev, "ICC BW voting failed on path '%s': %d\n", in geni_icc_set_bw()
850 void geni_icc_set_tag(struct geni_se *se, u32 tag) in geni_icc_set_tag() argument
854 for (i = 0; i < ARRAY_SIZE(se->icc_paths); i++) in geni_icc_set_tag()
855 icc_set_tag(se->icc_paths[i].path, tag); in geni_icc_set_tag()
860 int geni_icc_enable(struct geni_se *se) in geni_icc_enable() argument
864 for (i = 0; i < ARRAY_SIZE(se->icc_paths); i++) { in geni_icc_enable()
865 ret = icc_enable(se->icc_paths[i].path); in geni_icc_enable()
867 dev_err_ratelimited(se->dev, "ICC enable failed on path '%s': %d\n", in geni_icc_enable()
877 int geni_icc_disable(struct geni_se *se) in geni_icc_disable() argument
881 for (i = 0; i < ARRAY_SIZE(se->icc_paths); i++) { in geni_icc_disable()
882 ret = icc_disable(se->icc_paths[i].path); in geni_icc_disable()
884 dev_err_ratelimited(se->dev, "ICC disable failed on path '%s': %d\n", in geni_icc_disable()