Lines Matching refs:ast
40 struct ast_device *ast = to_ast_device(dev); in ast_is_vga_enabled() local
43 ch = ast_io_read8(ast, AST_IO_VGA_ENABLE_PORT); in ast_is_vga_enabled()
50 struct ast_device *ast = to_ast_device(dev); in ast_enable_vga() local
52 ast_io_write8(ast, AST_IO_VGA_ENABLE_PORT, 0x01); in ast_enable_vga()
53 ast_io_write8(ast, AST_IO_MISC_PORT_WRITE, 0x01); in ast_enable_vga()
62 struct ast_device *ast = data; in ast_enable_mmio_release() local
65 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa1, 0x04); in ast_enable_mmio_release()
68 static int ast_enable_mmio(struct ast_device *ast) in ast_enable_mmio() argument
70 struct drm_device *dev = &ast->base; in ast_enable_mmio()
72 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa1, 0x06); in ast_enable_mmio()
74 return devm_add_action_or_reset(dev->dev, ast_enable_mmio_release, ast); in ast_enable_mmio()
77 static void ast_open_key(struct ast_device *ast) in ast_open_key() argument
79 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x80, 0xA8); in ast_open_key()
82 static int ast_device_config_init(struct ast_device *ast) in ast_device_config_init() argument
84 struct drm_device *dev = &ast->base; in ast_device_config_init()
95 ast->config_mode = ast_use_defaults; in ast_device_config_init()
100 ast->config_mode = ast_use_dt; in ast_device_config_init()
108 jregd0 = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xd0, 0xff); in ast_device_config_init()
109 jregd1 = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xd1, 0xff); in ast_device_config_init()
119 ast_patch_ahb_2500(ast); in ast_device_config_init()
123 data = ast_read32(ast, 0xf004); in ast_device_config_init()
125 ast->config_mode = ast_use_p2a; in ast_device_config_init()
128 ast_write32(ast, 0xf004, 0x1e6e0000); in ast_device_config_init()
129 ast_write32(ast, 0xf000, 0x1); in ast_device_config_init()
130 scu_rev = ast_read32(ast, 0x1207c); in ast_device_config_init()
135 switch (ast->config_mode) { in ast_device_config_init()
152 ast->chip = AST2600; in ast_device_config_init()
157 ast->chip = AST2510; in ast_device_config_init()
161 ast->chip = AST2500; in ast_device_config_init()
167 ast->chip = AST1400; in ast_device_config_init()
171 ast->chip = AST2400; in ast_device_config_init()
177 ast->chip = AST1300; in ast_device_config_init()
181 ast->chip = AST2300; in ast_device_config_init()
188 ast->chip = AST1100; in ast_device_config_init()
192 ast->chip = AST2200; in ast_device_config_init()
196 ast->chip = AST2150; in ast_device_config_init()
200 ast->chip = AST2100; in ast_device_config_init()
205 ast->chip = AST2000; in ast_device_config_init()
212 static void ast_detect_widescreen(struct ast_device *ast) in ast_detect_widescreen() argument
217 switch (AST_GEN(ast)) { in ast_detect_widescreen()
219 ast->support_wide_screen = false; in ast_detect_widescreen()
222 jreg = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xd0, 0xff); in ast_detect_widescreen()
224 ast->support_wide_screen = true; in ast_detect_widescreen()
226 ast->support_wide_screen = true; in ast_detect_widescreen()
228 ast->support_wide_screen = false; in ast_detect_widescreen()
229 if (ast->chip == AST1300) in ast_detect_widescreen()
230 ast->support_wide_screen = true; in ast_detect_widescreen()
231 if (ast->chip == AST1400) in ast_detect_widescreen()
232 ast->support_wide_screen = true; in ast_detect_widescreen()
233 if (ast->chip == AST2510) in ast_detect_widescreen()
234 ast->support_wide_screen = true; in ast_detect_widescreen()
235 if (IS_AST_GEN7(ast)) in ast_detect_widescreen()
236 ast->support_wide_screen = true; in ast_detect_widescreen()
242 static void ast_detect_tx_chip(struct ast_device *ast, bool need_post) in ast_detect_tx_chip() argument
244 struct drm_device *dev = &ast->base; in ast_detect_tx_chip()
248 ast->tx_chip_types |= AST_TX_NONE_BIT; in ast_detect_tx_chip()
259 jreg = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xa3, 0xff); in ast_detect_tx_chip()
261 ast->tx_chip_types = AST_TX_SIL164_BIT; in ast_detect_tx_chip()
264 if (IS_AST_GEN4(ast) || IS_AST_GEN5(ast) || IS_AST_GEN6(ast)) { in ast_detect_tx_chip()
270 jreg = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xd1, 0xff); in ast_detect_tx_chip()
273 ast->tx_chip_types = AST_TX_SIL164_BIT; in ast_detect_tx_chip()
276 ast->dp501_fw_addr = drmm_kzalloc(dev, 32*1024, GFP_KERNEL); in ast_detect_tx_chip()
277 if (ast->dp501_fw_addr) { in ast_detect_tx_chip()
279 if (ast_backup_fw(dev, ast->dp501_fw_addr, 32*1024)) { in ast_detect_tx_chip()
280 drmm_kfree(dev, ast->dp501_fw_addr); in ast_detect_tx_chip()
281 ast->dp501_fw_addr = NULL; in ast_detect_tx_chip()
286 ast->tx_chip_types = AST_TX_DP501_BIT; in ast_detect_tx_chip()
288 } else if (IS_AST_GEN7(ast)) { in ast_detect_tx_chip()
289 if (ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xD1, TX_TYPE_MASK) == in ast_detect_tx_chip()
291 ast->tx_chip_types = AST_TX_ASTDP_BIT; in ast_detect_tx_chip()
292 ast_dp_launch(&ast->base); in ast_detect_tx_chip()
297 if (ast->tx_chip_types & AST_TX_NONE_BIT) in ast_detect_tx_chip()
299 if (ast->tx_chip_types & AST_TX_SIL164_BIT) in ast_detect_tx_chip()
301 if (ast->tx_chip_types & AST_TX_DP501_BIT) in ast_detect_tx_chip()
303 if (ast->tx_chip_types & AST_TX_ASTDP_BIT) in ast_detect_tx_chip()
310 struct ast_device *ast = to_ast_device(dev); in ast_get_dram_info() local
314 switch (ast->config_mode) { in ast_get_dram_info()
331 ast_write32(ast, 0xf004, 0x1e6e0000); in ast_get_dram_info()
332 ast_write32(ast, 0xf000, 0x1); in ast_get_dram_info()
333 mcr_cfg = ast_read32(ast, 0x10004); in ast_get_dram_info()
334 mcr_scu_mpll = ast_read32(ast, 0x10120); in ast_get_dram_info()
335 mcr_scu_strap = ast_read32(ast, 0x10170); in ast_get_dram_info()
339 ast->dram_bus_width = 16; in ast_get_dram_info()
340 ast->dram_type = AST_DRAM_1Gx16; in ast_get_dram_info()
341 if (IS_AST_GEN6(ast)) in ast_get_dram_info()
342 ast->mclk = 800; in ast_get_dram_info()
344 ast->mclk = 396; in ast_get_dram_info()
349 ast->dram_bus_width = 16; in ast_get_dram_info()
351 ast->dram_bus_width = 32; in ast_get_dram_info()
353 if (IS_AST_GEN6(ast)) { in ast_get_dram_info()
356 ast->dram_type = AST_DRAM_1Gx16; in ast_get_dram_info()
360 ast->dram_type = AST_DRAM_2Gx16; in ast_get_dram_info()
363 ast->dram_type = AST_DRAM_4Gx16; in ast_get_dram_info()
366 ast->dram_type = AST_DRAM_8Gx16; in ast_get_dram_info()
369 } else if (IS_AST_GEN4(ast) || IS_AST_GEN5(ast)) { in ast_get_dram_info()
372 ast->dram_type = AST_DRAM_512Mx16; in ast_get_dram_info()
376 ast->dram_type = AST_DRAM_1Gx16; in ast_get_dram_info()
379 ast->dram_type = AST_DRAM_2Gx16; in ast_get_dram_info()
382 ast->dram_type = AST_DRAM_4Gx16; in ast_get_dram_info()
389 ast->dram_type = AST_DRAM_512Mx16; in ast_get_dram_info()
393 ast->dram_type = AST_DRAM_1Gx16; in ast_get_dram_info()
395 ast->dram_type = AST_DRAM_512Mx32; in ast_get_dram_info()
398 ast->dram_type = AST_DRAM_1Gx32; in ast_get_dram_info()
423 ast->mclk = ref_pll * (num + 2) / ((denum + 2) * (div * 1000)); in ast_get_dram_info()
432 struct ast_device *ast; in ast_device_create() local
436 ast = devm_drm_dev_alloc(&pdev->dev, drv, struct ast_device, base); in ast_device_create()
437 if (IS_ERR(ast)) in ast_device_create()
438 return ast; in ast_device_create()
439 dev = &ast->base; in ast_device_create()
443 ret = drmm_mutex_init(dev, &ast->ioregs_lock); in ast_device_create()
447 ast->regs = pcim_iomap(pdev, 1, 0); in ast_device_create()
448 if (!ast->regs) in ast_device_create()
456 ast->ioregs = ast->regs + AST_IO_MM_OFFSET; in ast_device_create()
459 ast->ioregs = ast->regs + AST_IO_MM_OFFSET; in ast_device_create()
463 if (!ast->ioregs) { in ast_device_create()
464 ast->ioregs = pcim_iomap(pdev, 2, 0); in ast_device_create()
465 if (!ast->ioregs) in ast_device_create()
482 ast_open_key(ast); in ast_device_create()
483 ret = ast_enable_mmio(ast); in ast_device_create()
487 ret = ast_device_config_init(ast); in ast_device_create()
491 ast_detect_widescreen(ast); in ast_device_create()
492 ast_detect_tx_chip(ast, need_post); in ast_device_create()
499 ast->mclk, ast->dram_type, ast->dram_bus_width); in ast_device_create()
504 ret = ast_mm_init(ast); in ast_device_create()
509 ast->dp501_fw_buf = NULL; in ast_device_create()
510 if (ast->vram_size < pci_resource_len(pdev, 0)) { in ast_device_create()
511 ast->dp501_fw_buf = pci_iomap_range(pdev, 0, ast->vram_size, 0); in ast_device_create()
512 if (!ast->dp501_fw_buf) in ast_device_create()
516 ret = ast_mode_config_init(ast); in ast_device_create()
520 return ast; in ast_device_create()