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
75 ast->config_mode = ast_use_defaults; in ast_detect_config_mode()
82 ast->config_mode = ast_use_dt; in ast_detect_config_mode()
96 jregd0 = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xd0, 0xff); in ast_detect_config_mode()
97 jregd1 = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xd1, 0xff); in ast_detect_config_mode()
100 data = ast_read32(ast, 0xf004); in ast_detect_config_mode()
103 ast->config_mode = ast_use_p2a; in ast_detect_config_mode()
108 ast_write32(ast, 0xf004, 0x1e6e0000); in ast_detect_config_mode()
109 ast_write32(ast, 0xf000, 0x1); in ast_detect_config_mode()
110 *scu_rev = ast_read32(ast, 0x1207c); in ast_detect_config_mode()
121 struct ast_private *ast = to_ast_private(dev); in ast_detect_chip() local
139 ast_open_key(ast); in ast_detect_chip()
147 ast->chip = AST2500; in ast_detect_chip()
150 ast->chip = AST2400; in ast_detect_chip()
153 ast->chip = AST2300; in ast_detect_chip()
158 ast->chip = AST1100; in ast_detect_chip()
162 ast->chip = AST2200; in ast_detect_chip()
166 ast->chip = AST2150; in ast_detect_chip()
170 ast->chip = AST2100; in ast_detect_chip()
174 ast->vga2_clone = false; in ast_detect_chip()
176 ast->chip = AST2000; in ast_detect_chip()
181 switch (ast->chip) { in ast_detect_chip()
183 ast->support_wide_screen = false; in ast_detect_chip()
186 jreg = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xd0, 0xff); in ast_detect_chip()
188 ast->support_wide_screen = true; in ast_detect_chip()
190 ast->support_wide_screen = true; in ast_detect_chip()
192 ast->support_wide_screen = false; in ast_detect_chip()
193 if (ast->chip == AST2300 && in ast_detect_chip()
195 ast->support_wide_screen = true; in ast_detect_chip()
196 if (ast->chip == AST2400 && in ast_detect_chip()
198 ast->support_wide_screen = true; in ast_detect_chip()
199 if (ast->chip == AST2500 && in ast_detect_chip()
201 ast->support_wide_screen = true; in ast_detect_chip()
207 ast->tx_chip_type = AST_TX_NONE; in ast_detect_chip()
218 jreg = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xa3, 0xff); in ast_detect_chip()
220 ast->tx_chip_type = AST_TX_SIL164; in ast_detect_chip()
223 if ((ast->chip == AST2300) || (ast->chip == AST2400)) { in ast_detect_chip()
229 jreg = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xd1, 0xff); in ast_detect_chip()
232 ast->tx_chip_type = AST_TX_SIL164; in ast_detect_chip()
235 ast->dp501_fw_addr = drmm_kzalloc(dev, 32*1024, GFP_KERNEL); in ast_detect_chip()
236 if (ast->dp501_fw_addr) { in ast_detect_chip()
238 if (ast_backup_fw(dev, ast->dp501_fw_addr, 32*1024)) { in ast_detect_chip()
239 drmm_kfree(dev, ast->dp501_fw_addr); in ast_detect_chip()
240 ast->dp501_fw_addr = NULL; in ast_detect_chip()
245 ast->tx_chip_type = AST_TX_DP501; in ast_detect_chip()
250 switch(ast->tx_chip_type) { in ast_detect_chip()
266 struct ast_private *ast = to_ast_private(dev); in ast_get_dram_info() local
270 switch (ast->config_mode) { in ast_get_dram_info()
287 ast_write32(ast, 0xf004, 0x1e6e0000); in ast_get_dram_info()
288 ast_write32(ast, 0xf000, 0x1); in ast_get_dram_info()
289 mcr_cfg = ast_read32(ast, 0x10004); in ast_get_dram_info()
290 mcr_scu_mpll = ast_read32(ast, 0x10120); in ast_get_dram_info()
291 mcr_scu_strap = ast_read32(ast, 0x10170); in ast_get_dram_info()
295 ast->dram_bus_width = 16; in ast_get_dram_info()
296 ast->dram_type = AST_DRAM_1Gx16; in ast_get_dram_info()
297 if (ast->chip == AST2500) in ast_get_dram_info()
298 ast->mclk = 800; in ast_get_dram_info()
300 ast->mclk = 396; in ast_get_dram_info()
305 ast->dram_bus_width = 16; in ast_get_dram_info()
307 ast->dram_bus_width = 32; in ast_get_dram_info()
309 if (ast->chip == AST2500) { in ast_get_dram_info()
312 ast->dram_type = AST_DRAM_1Gx16; in ast_get_dram_info()
316 ast->dram_type = AST_DRAM_2Gx16; in ast_get_dram_info()
319 ast->dram_type = AST_DRAM_4Gx16; in ast_get_dram_info()
322 ast->dram_type = AST_DRAM_8Gx16; in ast_get_dram_info()
325 } else if (ast->chip == AST2300 || ast->chip == AST2400) { in ast_get_dram_info()
328 ast->dram_type = AST_DRAM_512Mx16; in ast_get_dram_info()
332 ast->dram_type = AST_DRAM_1Gx16; in ast_get_dram_info()
335 ast->dram_type = AST_DRAM_2Gx16; in ast_get_dram_info()
338 ast->dram_type = AST_DRAM_4Gx16; in ast_get_dram_info()
345 ast->dram_type = AST_DRAM_512Mx16; in ast_get_dram_info()
349 ast->dram_type = AST_DRAM_1Gx16; in ast_get_dram_info()
351 ast->dram_type = AST_DRAM_512Mx32; in ast_get_dram_info()
354 ast->dram_type = AST_DRAM_1Gx32; in ast_get_dram_info()
379 ast->mclk = ref_pll * (num + 2) / ((denum + 2) * (div * 1000)); in ast_get_dram_info()
389 struct ast_private *ast = data; in ast_device_release() local
392 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa1, 0x04); in ast_device_release()
400 struct ast_private *ast; in ast_device_create() local
404 ast = devm_drm_dev_alloc(&pdev->dev, drv, struct ast_private, base); in ast_device_create()
405 if (IS_ERR(ast)) in ast_device_create()
406 return ast; in ast_device_create()
407 dev = &ast->base; in ast_device_create()
412 ast->regs = pcim_iomap(pdev, 1, 0); in ast_device_create()
413 if (!ast->regs) in ast_device_create()
423 ast->ioregs = ast->regs + AST_IO_MM_OFFSET; in ast_device_create()
427 if (!ast->ioregs) { in ast_device_create()
428 ast->ioregs = pcim_iomap(pdev, 2, 0); in ast_device_create()
429 if (!ast->ioregs) in ast_device_create()
440 ast->mclk, ast->dram_type, ast->dram_bus_width); in ast_device_create()
445 ret = ast_mm_init(ast); in ast_device_create()
450 ast->dp501_fw_buf = NULL; in ast_device_create()
452 ast->dp501_fw_buf = pci_iomap_range(dev->pdev, 0, dev->vram_mm->vram_size, 0); in ast_device_create()
453 if (!ast->dp501_fw_buf) in ast_device_create()
457 ret = ast_mode_config_init(ast); in ast_device_create()
461 ret = devm_add_action_or_reset(dev->dev, ast_device_release, ast); in ast_device_create()
465 return ast; in ast_device_create()