Lines Matching full:larb
20 #include <dt-bindings/memory/mt2701-larb-port.h>
39 /* SMI LARB */
152 struct mtk_smi_larb { /* larb: local arbiter */
165 struct mtk_smi_larb *larb = dev_get_drvdata(dev); in mtk_smi_larb_bind() local
171 larb->larbid = i; in mtk_smi_larb_bind()
172 larb->mmu = &larb_mmu[i].mmu; in mtk_smi_larb_bind()
173 larb->bank = larb_mmu[i].bank; in mtk_smi_larb_bind()
193 struct mtk_smi_larb *larb = dev_get_drvdata(dev); in mtk_smi_larb_config_port_gen1() local
194 const struct mtk_smi_larb_gen *larb_gen = larb->larb_gen; in mtk_smi_larb_config_port_gen1()
195 struct mtk_smi *common = dev_get_drvdata(larb->smi_common_dev); in mtk_smi_larb_config_port_gen1()
199 m4u_port_id = larb_gen->port_in_larb[larb->larbid]; in mtk_smi_larb_config_port_gen1()
200 larb_port_num = larb_gen->port_in_larb[larb->larbid + 1] in mtk_smi_larb_config_port_gen1()
201 - larb_gen->port_in_larb[larb->larbid]; in mtk_smi_larb_config_port_gen1()
204 if (*larb->mmu & BIT(i)) { in mtk_smi_larb_config_port_gen1()
225 struct mtk_smi_larb *larb = dev_get_drvdata(dev); in mtk_smi_larb_config_port_mt8167() local
227 writel(*larb->mmu, larb->base + MT8167_SMI_LARB_MMU_EN); in mtk_smi_larb_config_port_mt8167()
233 struct mtk_smi_larb *larb = dev_get_drvdata(dev); in mtk_smi_larb_config_port_mt8173() local
235 writel(*larb->mmu, larb->base + MT8173_SMI_LARB_MMU_EN); in mtk_smi_larb_config_port_mt8173()
241 struct mtk_smi_larb *larb = dev_get_drvdata(dev); in mtk_smi_larb_config_port_gen2_general() local
242 u32 reg, flags_general = larb->larb_gen->flags_general; in mtk_smi_larb_config_port_gen2_general()
243 const u8 *larbostd = larb->larb_gen->ostd ? larb->larb_gen->ostd[larb->larbid] : NULL; in mtk_smi_larb_config_port_gen2_general()
247 if (BIT(larb->larbid) & larb->larb_gen->larb_direct_to_common_mask) in mtk_smi_larb_config_port_gen2_general()
251 reg = readl_relaxed(larb->base + SMI_LARB_CMD_THRT_CON); in mtk_smi_larb_config_port_gen2_general()
254 writel_relaxed(reg, larb->base + SMI_LARB_CMD_THRT_CON); in mtk_smi_larb_config_port_gen2_general()
258 writel_relaxed(SMI_LARB_SW_FLAG_1, larb->base + SMI_LARB_SW_FLAG); in mtk_smi_larb_config_port_gen2_general()
261 writel_relaxed(larbostd[i], larb->base + SMI_LARB_OSTDL_PORTx(i)); in mtk_smi_larb_config_port_gen2_general()
270 larb->larbid, *larb->mmu, 0, 0, 0, 0, &res); in mtk_smi_larb_config_port_gen2_general()
277 for_each_set_bit(i, (unsigned long *)larb->mmu, 32) { in mtk_smi_larb_config_port_gen2_general()
278 reg = readl_relaxed(larb->base + SMI_LARB_NONSEC_CON(i)); in mtk_smi_larb_config_port_gen2_general()
280 reg |= BANK_SEL(larb->bank[i]); in mtk_smi_larb_config_port_gen2_general()
281 writel(reg, larb->base + SMI_LARB_NONSEC_CON(i)); in mtk_smi_larb_config_port_gen2_general()
401 /* mt8167 do not need the port in larb */
406 /* mt8173 do not need the port in larb */
440 {.compatible = "mediatek,mt2701-smi-larb", .data = &mtk_smi_larb_mt2701},
441 {.compatible = "mediatek,mt2712-smi-larb", .data = &mtk_smi_larb_mt2712},
442 {.compatible = "mediatek,mt6779-smi-larb", .data = &mtk_smi_larb_mt6779},
443 {.compatible = "mediatek,mt6795-smi-larb", .data = &mtk_smi_larb_mt8173},
444 {.compatible = "mediatek,mt8167-smi-larb", .data = &mtk_smi_larb_mt8167},
445 {.compatible = "mediatek,mt8173-smi-larb", .data = &mtk_smi_larb_mt8173},
446 {.compatible = "mediatek,mt8183-smi-larb", .data = &mtk_smi_larb_mt8183},
447 {.compatible = "mediatek,mt8186-smi-larb", .data = &mtk_smi_larb_mt8186},
448 {.compatible = "mediatek,mt8188-smi-larb", .data = &mtk_smi_larb_mt8188},
449 {.compatible = "mediatek,mt8192-smi-larb", .data = &mtk_smi_larb_mt8192},
450 {.compatible = "mediatek,mt8195-smi-larb", .data = &mtk_smi_larb_mt8195},
455 static int mtk_smi_larb_sleep_ctrl_enable(struct mtk_smi_larb *larb) in mtk_smi_larb_sleep_ctrl_enable() argument
460 writel_relaxed(SLP_PROT_EN, larb->base + SMI_LARB_SLP_CON); in mtk_smi_larb_sleep_ctrl_enable()
461 ret = readl_poll_timeout_atomic(larb->base + SMI_LARB_SLP_CON, in mtk_smi_larb_sleep_ctrl_enable()
464 /* TODO: Reset this larb if it fails here. */ in mtk_smi_larb_sleep_ctrl_enable()
465 dev_err(larb->smi.dev, "sleep ctrl is not ready(0x%x).\n", tmp); in mtk_smi_larb_sleep_ctrl_enable()
470 static void mtk_smi_larb_sleep_ctrl_disable(struct mtk_smi_larb *larb) in mtk_smi_larb_sleep_ctrl_disable() argument
472 writel_relaxed(0, larb->base + SMI_LARB_SLP_CON); in mtk_smi_larb_sleep_ctrl_disable()
533 struct mtk_smi_larb *larb; in mtk_smi_larb_probe() local
537 larb = devm_kzalloc(dev, sizeof(*larb), GFP_KERNEL); in mtk_smi_larb_probe()
538 if (!larb) in mtk_smi_larb_probe()
541 larb->larb_gen = of_device_get_match_data(dev); in mtk_smi_larb_probe()
542 larb->base = devm_platform_ioremap_resource(pdev, 0); in mtk_smi_larb_probe()
543 if (IS_ERR(larb->base)) in mtk_smi_larb_probe()
544 return PTR_ERR(larb->base); in mtk_smi_larb_probe()
546 ret = mtk_smi_dts_clk_init(dev, &larb->smi, mtk_smi_larb_clks, in mtk_smi_larb_probe()
551 larb->smi.dev = dev; in mtk_smi_larb_probe()
553 ret = mtk_smi_device_link_common(dev, &larb->smi_common_dev); in mtk_smi_larb_probe()
558 platform_set_drvdata(pdev, larb); in mtk_smi_larb_probe()
566 device_link_remove(dev, larb->smi_common_dev); in mtk_smi_larb_probe()
572 struct mtk_smi_larb *larb = platform_get_drvdata(pdev); in mtk_smi_larb_remove() local
574 device_link_remove(&pdev->dev, larb->smi_common_dev); in mtk_smi_larb_remove()
581 struct mtk_smi_larb *larb = dev_get_drvdata(dev); in mtk_smi_larb_resume() local
582 const struct mtk_smi_larb_gen *larb_gen = larb->larb_gen; in mtk_smi_larb_resume()
585 ret = clk_bulk_prepare_enable(larb->smi.clk_num, larb->smi.clks); in mtk_smi_larb_resume()
589 if (MTK_SMI_CAPS(larb->larb_gen->flags_general, MTK_SMI_FLAG_SLEEP_CTL)) in mtk_smi_larb_resume()
590 mtk_smi_larb_sleep_ctrl_disable(larb); in mtk_smi_larb_resume()
592 /* Configure the basic setting for this larb */ in mtk_smi_larb_resume()
598 struct mtk_smi_larb *larb = dev_get_drvdata(dev); in mtk_smi_larb_suspend() local
601 if (MTK_SMI_CAPS(larb->larb_gen->flags_general, MTK_SMI_FLAG_SLEEP_CTL)) { in mtk_smi_larb_suspend()
602 ret = mtk_smi_larb_sleep_ctrl_enable(larb); in mtk_smi_larb_suspend()
607 clk_bulk_disable_unprepare(larb->smi.clk_num, larb->smi.clks); in mtk_smi_larb_suspend()
621 .name = "mtk-smi-larb",