Lines Matching +full:ast2500 +full:- +full:scu

1 // SPDX-License-Identifier: GPL-2.0+
5 #include <linux/dma-mapping.h>
37 * The AST2500 supports a total of 3 output paths:
56 * The driver was written with the 'AST2500 Software Programming Guide' v17,
74 drm->mode_config.min_width = 0; in aspeed_gfx_setup_mode_config()
75 drm->mode_config.min_height = 0; in aspeed_gfx_setup_mode_config()
76 drm->mode_config.max_width = 800; in aspeed_gfx_setup_mode_config()
77 drm->mode_config.max_height = 600; in aspeed_gfx_setup_mode_config()
78 drm->mode_config.funcs = &aspeed_gfx_mode_config_funcs; in aspeed_gfx_setup_mode_config()
89 reg = readl(priv->base + CRT_CTRL1); in aspeed_gfx_irq_handler()
92 drm_crtc_handle_vblank(&priv->pipe.crtc); in aspeed_gfx_irq_handler()
93 writel(reg, priv->base + CRT_CTRL1); in aspeed_gfx_irq_handler()
104 struct platform_device *pdev = to_platform_device(drm->dev); in aspeed_gfx_load()
110 priv->base = devm_ioremap_resource(drm->dev, res); in aspeed_gfx_load()
111 if (IS_ERR(priv->base)) in aspeed_gfx_load()
112 return PTR_ERR(priv->base); in aspeed_gfx_load()
114 priv->scu = syscon_regmap_lookup_by_compatible("aspeed,ast2500-scu"); in aspeed_gfx_load()
115 if (IS_ERR(priv->scu)) { in aspeed_gfx_load()
116 dev_err(&pdev->dev, "failed to find SCU regmap\n"); in aspeed_gfx_load()
117 return PTR_ERR(priv->scu); in aspeed_gfx_load()
120 ret = of_reserved_mem_device_init(drm->dev); in aspeed_gfx_load()
122 dev_err(&pdev->dev, in aspeed_gfx_load()
127 ret = dma_set_mask_and_coherent(drm->dev, DMA_BIT_MASK(32)); in aspeed_gfx_load()
129 dev_err(&pdev->dev, "failed to set DMA mask: %d\n", ret); in aspeed_gfx_load()
133 priv->rst = devm_reset_control_get_exclusive(&pdev->dev, NULL); in aspeed_gfx_load()
134 if (IS_ERR(priv->rst)) { in aspeed_gfx_load()
135 dev_err(&pdev->dev, in aspeed_gfx_load()
137 return PTR_ERR(priv->rst); in aspeed_gfx_load()
139 reset_control_deassert(priv->rst); in aspeed_gfx_load()
141 priv->clk = devm_clk_get(drm->dev, NULL); in aspeed_gfx_load()
142 if (IS_ERR(priv->clk)) { in aspeed_gfx_load()
143 dev_err(&pdev->dev, in aspeed_gfx_load()
145 return PTR_ERR(priv->clk); in aspeed_gfx_load()
147 clk_prepare_enable(priv->clk); in aspeed_gfx_load()
150 writel(0, priv->base + CRT_CTRL1); in aspeed_gfx_load()
151 writel(0, priv->base + CRT_CTRL2); in aspeed_gfx_load()
159 dev_err(drm->dev, "Failed to initialise vblank\n"); in aspeed_gfx_load()
165 dev_err(drm->dev, "Failed to create outputs\n"); in aspeed_gfx_load()
171 dev_err(drm->dev, "Cannot setup simple display pipe\n"); in aspeed_gfx_load()
175 ret = devm_request_irq(drm->dev, platform_get_irq(pdev, 0), in aspeed_gfx_load()
178 dev_err(drm->dev, "Failed to install IRQ handler\n"); in aspeed_gfx_load()
203 .name = "aspeed-gfx-drm",
211 { .compatible = "aspeed,ast2500-gfx" },
220 priv = devm_drm_dev_alloc(&pdev->dev, &aspeed_gfx_driver, in aspeed_gfx_probe()
225 ret = aspeed_gfx_load(&priv->drm); in aspeed_gfx_probe()
229 ret = drm_dev_register(&priv->drm, 0); in aspeed_gfx_probe()
233 drm_fbdev_generic_setup(&priv->drm, 32); in aspeed_gfx_probe()
237 aspeed_gfx_unload(&priv->drm); in aspeed_gfx_probe()