Lines Matching refs:ast

40 void ast_set_index_reg_mask(struct ast_private *ast,  in ast_set_index_reg_mask()  argument
45 ast_io_write8(ast, base, index); in ast_set_index_reg_mask()
46 tmp = (ast_io_read8(ast, base + 1) & mask) | val; in ast_set_index_reg_mask()
47 ast_set_index_reg(ast, base, index, tmp); in ast_set_index_reg_mask()
50 uint8_t ast_get_index_reg(struct ast_private *ast, in ast_get_index_reg() argument
54 ast_io_write8(ast, base, index); in ast_get_index_reg()
55 ret = ast_io_read8(ast, base + 1); in ast_get_index_reg()
59 uint8_t ast_get_index_reg_mask(struct ast_private *ast, in ast_get_index_reg_mask() argument
63 ast_io_write8(ast, base, index); in ast_get_index_reg_mask()
64 ret = ast_io_read8(ast, base + 1) & mask; in ast_get_index_reg_mask()
71 struct ast_private *ast = to_ast_private(dev); in ast_detect_config_mode() local
76 ast->config_mode = ast_use_defaults; in ast_detect_config_mode()
83 ast->config_mode = ast_use_dt; in ast_detect_config_mode()
97 jregd0 = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xd0, 0xff); in ast_detect_config_mode()
98 jregd1 = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xd1, 0xff); in ast_detect_config_mode()
103 ast_patch_ahb_2500(ast); in ast_detect_config_mode()
106 data = ast_read32(ast, 0xf004); in ast_detect_config_mode()
109 ast->config_mode = ast_use_p2a; in ast_detect_config_mode()
114 ast_write32(ast, 0xf004, 0x1e6e0000); in ast_detect_config_mode()
115 ast_write32(ast, 0xf000, 0x1); in ast_detect_config_mode()
116 *scu_rev = ast_read32(ast, 0x1207c); in ast_detect_config_mode()
127 struct ast_private *ast = to_ast_private(dev); in ast_detect_chip() local
146 ast_open_key(ast); in ast_detect_chip()
154 ast->chip = AST2600; in ast_detect_chip()
157 ast->chip = AST2500; in ast_detect_chip()
160 ast->chip = AST2400; in ast_detect_chip()
163 ast->chip = AST2300; in ast_detect_chip()
168 ast->chip = AST1100; in ast_detect_chip()
172 ast->chip = AST2200; in ast_detect_chip()
176 ast->chip = AST2150; in ast_detect_chip()
180 ast->chip = AST2100; in ast_detect_chip()
184 ast->vga2_clone = false; in ast_detect_chip()
186 ast->chip = AST2000; in ast_detect_chip()
191 switch (ast->chip) { in ast_detect_chip()
193 ast->support_wide_screen = false; in ast_detect_chip()
196 jreg = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xd0, 0xff); in ast_detect_chip()
198 ast->support_wide_screen = true; in ast_detect_chip()
200 ast->support_wide_screen = true; in ast_detect_chip()
202 ast->support_wide_screen = false; in ast_detect_chip()
203 if (ast->chip == AST2300 && in ast_detect_chip()
205 ast->support_wide_screen = true; in ast_detect_chip()
206 if (ast->chip == AST2400 && in ast_detect_chip()
208 ast->support_wide_screen = true; in ast_detect_chip()
209 if (ast->chip == AST2500 && in ast_detect_chip()
211 ast->support_wide_screen = true; in ast_detect_chip()
212 if (ast->chip == AST2600) /* ast2600 */ in ast_detect_chip()
213 ast->support_wide_screen = true; in ast_detect_chip()
219 ast->tx_chip_types |= AST_TX_NONE_BIT; in ast_detect_chip()
230 jreg = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xa3, 0xff); in ast_detect_chip()
232 ast->tx_chip_types = AST_TX_SIL164_BIT; in ast_detect_chip()
235 if ((ast->chip == AST2300) || (ast->chip == AST2400) || (ast->chip == AST2500)) { in ast_detect_chip()
241 jreg = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xd1, 0xff); in ast_detect_chip()
244 ast->tx_chip_types = AST_TX_SIL164_BIT; in ast_detect_chip()
247 ast->dp501_fw_addr = drmm_kzalloc(dev, 32*1024, GFP_KERNEL); in ast_detect_chip()
248 if (ast->dp501_fw_addr) { in ast_detect_chip()
250 if (ast_backup_fw(dev, ast->dp501_fw_addr, 32*1024)) { in ast_detect_chip()
251 drmm_kfree(dev, ast->dp501_fw_addr); in ast_detect_chip()
252 ast->dp501_fw_addr = NULL; in ast_detect_chip()
257 ast->tx_chip_types = AST_TX_DP501_BIT; in ast_detect_chip()
259 } else if (ast->chip == AST2600) in ast_detect_chip()
260 ast_dp_launch(&ast->base, 0); in ast_detect_chip()
263 if (ast->tx_chip_types & AST_TX_NONE_BIT) in ast_detect_chip()
265 if (ast->tx_chip_types & AST_TX_SIL164_BIT) in ast_detect_chip()
267 if (ast->tx_chip_types & AST_TX_DP501_BIT) in ast_detect_chip()
276 struct ast_private *ast = to_ast_private(dev); in ast_get_dram_info() local
280 switch (ast->config_mode) { in ast_get_dram_info()
297 ast_write32(ast, 0xf004, 0x1e6e0000); in ast_get_dram_info()
298 ast_write32(ast, 0xf000, 0x1); in ast_get_dram_info()
299 mcr_cfg = ast_read32(ast, 0x10004); in ast_get_dram_info()
300 mcr_scu_mpll = ast_read32(ast, 0x10120); in ast_get_dram_info()
301 mcr_scu_strap = ast_read32(ast, 0x10170); in ast_get_dram_info()
305 ast->dram_bus_width = 16; in ast_get_dram_info()
306 ast->dram_type = AST_DRAM_1Gx16; in ast_get_dram_info()
307 if (ast->chip == AST2500) in ast_get_dram_info()
308 ast->mclk = 800; in ast_get_dram_info()
310 ast->mclk = 396; in ast_get_dram_info()
315 ast->dram_bus_width = 16; in ast_get_dram_info()
317 ast->dram_bus_width = 32; in ast_get_dram_info()
319 if (ast->chip == AST2500) { in ast_get_dram_info()
322 ast->dram_type = AST_DRAM_1Gx16; in ast_get_dram_info()
326 ast->dram_type = AST_DRAM_2Gx16; in ast_get_dram_info()
329 ast->dram_type = AST_DRAM_4Gx16; in ast_get_dram_info()
332 ast->dram_type = AST_DRAM_8Gx16; in ast_get_dram_info()
335 } else if (ast->chip == AST2300 || ast->chip == AST2400) { in ast_get_dram_info()
338 ast->dram_type = AST_DRAM_512Mx16; in ast_get_dram_info()
342 ast->dram_type = AST_DRAM_1Gx16; in ast_get_dram_info()
345 ast->dram_type = AST_DRAM_2Gx16; in ast_get_dram_info()
348 ast->dram_type = AST_DRAM_4Gx16; in ast_get_dram_info()
355 ast->dram_type = AST_DRAM_512Mx16; in ast_get_dram_info()
359 ast->dram_type = AST_DRAM_1Gx16; in ast_get_dram_info()
361 ast->dram_type = AST_DRAM_512Mx32; in ast_get_dram_info()
364 ast->dram_type = AST_DRAM_1Gx32; in ast_get_dram_info()
389 ast->mclk = ref_pll * (num + 2) / ((denum + 2) * (div * 1000)); in ast_get_dram_info()
399 struct ast_private *ast = data; in ast_device_release() local
402 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa1, 0x04); in ast_device_release()
410 struct ast_private *ast; in ast_device_create() local
414 ast = devm_drm_dev_alloc(&pdev->dev, drv, struct ast_private, base); in ast_device_create()
415 if (IS_ERR(ast)) in ast_device_create()
416 return ast; in ast_device_create()
417 dev = &ast->base; in ast_device_create()
421 ret = drmm_mutex_init(dev, &ast->ioregs_lock); in ast_device_create()
425 ast->regs = pcim_iomap(pdev, 1, 0); in ast_device_create()
426 if (!ast->regs) in ast_device_create()
436 ast->ioregs = ast->regs + AST_IO_MM_OFFSET; in ast_device_create()
440 if (!ast->ioregs) { in ast_device_create()
441 ast->ioregs = pcim_iomap(pdev, 2, 0); in ast_device_create()
442 if (!ast->ioregs) in ast_device_create()
453 ast->mclk, ast->dram_type, ast->dram_bus_width); in ast_device_create()
458 ret = ast_mm_init(ast); in ast_device_create()
463 ast->dp501_fw_buf = NULL; in ast_device_create()
465 ast->dp501_fw_buf = pci_iomap_range(pdev, 0, dev->vram_mm->vram_size, 0); in ast_device_create()
466 if (!ast->dp501_fw_buf) in ast_device_create()
470 ret = ast_mode_config_init(ast); in ast_device_create()
474 ret = devm_add_action_or_reset(dev->dev, ast_device_release, ast); in ast_device_create()
478 return ast; in ast_device_create()