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 = dev->dev_private; 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 = dev->dev_private; in ast_detect_chip() local
139 ast_open_key(ast); in ast_detect_chip()
147 ast->chip = AST1100; in ast_detect_chip()
151 ast->chip = AST2500; in ast_detect_chip()
154 ast->chip = AST2400; in ast_detect_chip()
157 ast->chip = AST2300; in ast_detect_chip()
162 ast->chip = AST1100; in ast_detect_chip()
166 ast->chip = AST2200; in ast_detect_chip()
170 ast->chip = AST2150; in ast_detect_chip()
174 ast->chip = AST2100; in ast_detect_chip()
178 ast->vga2_clone = false; in ast_detect_chip()
180 ast->chip = AST2000; in ast_detect_chip()
186 switch (ast->chip) { in ast_detect_chip()
188 ast->support_wide_screen = true; in ast_detect_chip()
191 ast->support_wide_screen = false; in ast_detect_chip()
194 jreg = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xd0, 0xff); in ast_detect_chip()
196 ast->support_wide_screen = true; in ast_detect_chip()
198 ast->support_wide_screen = true; in ast_detect_chip()
200 ast->support_wide_screen = false; in ast_detect_chip()
201 if (ast->chip == AST2300 && in ast_detect_chip()
203 ast->support_wide_screen = true; in ast_detect_chip()
204 if (ast->chip == AST2400 && in ast_detect_chip()
206 ast->support_wide_screen = true; in ast_detect_chip()
207 if (ast->chip == AST2500 && in ast_detect_chip()
209 ast->support_wide_screen = true; in ast_detect_chip()
215 ast->tx_chip_type = AST_TX_NONE; in ast_detect_chip()
226 jreg = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xa3, 0xff); in ast_detect_chip()
228 ast->tx_chip_type = AST_TX_SIL164; in ast_detect_chip()
231 if ((ast->chip == AST2300) || (ast->chip == AST2400)) { in ast_detect_chip()
237 jreg = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xd1, 0xff); in ast_detect_chip()
240 ast->tx_chip_type = AST_TX_SIL164; in ast_detect_chip()
243 ast->dp501_fw_addr = kzalloc(32*1024, GFP_KERNEL); in ast_detect_chip()
244 if (ast->dp501_fw_addr) { in ast_detect_chip()
246 if (ast_backup_fw(dev, ast->dp501_fw_addr, 32*1024)) { in ast_detect_chip()
247 kfree(ast->dp501_fw_addr); in ast_detect_chip()
248 ast->dp501_fw_addr = NULL; in ast_detect_chip()
253 ast->tx_chip_type = AST_TX_DP501; in ast_detect_chip()
258 switch(ast->tx_chip_type) { in ast_detect_chip()
274 struct ast_private *ast = dev->dev_private; in ast_get_dram_info() local
278 switch (ast->config_mode) { in ast_get_dram_info()
295 ast_write32(ast, 0xf004, 0x1e6e0000); in ast_get_dram_info()
296 ast_write32(ast, 0xf000, 0x1); in ast_get_dram_info()
297 mcr_cfg = ast_read32(ast, 0x10004); in ast_get_dram_info()
298 mcr_scu_mpll = ast_read32(ast, 0x10120); in ast_get_dram_info()
299 mcr_scu_strap = ast_read32(ast, 0x10170); in ast_get_dram_info()
303 ast->dram_bus_width = 16; in ast_get_dram_info()
304 ast->dram_type = AST_DRAM_1Gx16; in ast_get_dram_info()
305 if (ast->chip == AST2500) in ast_get_dram_info()
306 ast->mclk = 800; in ast_get_dram_info()
308 ast->mclk = 396; in ast_get_dram_info()
313 ast->dram_bus_width = 16; in ast_get_dram_info()
315 ast->dram_bus_width = 32; in ast_get_dram_info()
317 if (ast->chip == AST2500) { in ast_get_dram_info()
320 ast->dram_type = AST_DRAM_1Gx16; in ast_get_dram_info()
324 ast->dram_type = AST_DRAM_2Gx16; in ast_get_dram_info()
327 ast->dram_type = AST_DRAM_4Gx16; in ast_get_dram_info()
330 ast->dram_type = AST_DRAM_8Gx16; in ast_get_dram_info()
333 } else if (ast->chip == AST2300 || ast->chip == AST2400) { in ast_get_dram_info()
336 ast->dram_type = AST_DRAM_512Mx16; in ast_get_dram_info()
340 ast->dram_type = AST_DRAM_1Gx16; in ast_get_dram_info()
343 ast->dram_type = AST_DRAM_2Gx16; in ast_get_dram_info()
346 ast->dram_type = AST_DRAM_4Gx16; in ast_get_dram_info()
353 ast->dram_type = AST_DRAM_512Mx16; in ast_get_dram_info()
357 ast->dram_type = AST_DRAM_1Gx16; in ast_get_dram_info()
359 ast->dram_type = AST_DRAM_512Mx32; in ast_get_dram_info()
362 ast->dram_type = AST_DRAM_1Gx32; in ast_get_dram_info()
387 ast->mclk = ref_pll * (num + 2) / ((denum + 2) * (div * 1000)); in ast_get_dram_info()
397 struct ast_private *ast = dev->dev_private; in ast_get_vram_info() local
400 ast_open_key(ast); in ast_get_vram_info()
403 jreg = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xaa, 0xff); in ast_get_vram_info()
411 jreg = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x99, 0xff); in ast_get_vram_info()
429 struct ast_private *ast; in ast_driver_load() local
433 ast = kzalloc(sizeof(struct ast_private), GFP_KERNEL); in ast_driver_load()
434 if (!ast) in ast_driver_load()
437 dev->dev_private = ast; in ast_driver_load()
438 ast->dev = dev; in ast_driver_load()
440 ast->regs = pci_iomap(dev->pdev, 1, 0); in ast_driver_load()
441 if (!ast->regs) { in ast_driver_load()
453 ast->ioregs = ast->regs + AST_IO_MM_OFFSET; in ast_driver_load()
457 if (!ast->ioregs) { in ast_driver_load()
458 ast->ioregs = pci_iomap(dev->pdev, 2, 0); in ast_driver_load()
459 if (!ast->ioregs) { in ast_driver_load()
470 if (ast->chip != AST1180) { in ast_driver_load()
474 ast->vram_size = ast_get_vram_info(dev); in ast_driver_load()
476 ast->mclk, ast->dram_type, in ast_driver_load()
477 ast->dram_bus_width, ast->vram_size); in ast_driver_load()
480 ret = ast_mm_init(ast); in ast_driver_load()
491 dev->mode_config.fb_base = pci_resource_start(ast->dev->pdev, 0); in ast_driver_load()
493 if (ast->chip == AST2100 || in ast_driver_load()
494 ast->chip == AST2200 || in ast_driver_load()
495 ast->chip == AST2300 || in ast_driver_load()
496 ast->chip == AST2400 || in ast_driver_load()
497 ast->chip == AST2500 || in ast_driver_load()
498 ast->chip == AST1180) { in ast_driver_load()
516 kfree(ast); in ast_driver_load()
523 struct ast_private *ast = dev->dev_private; in ast_driver_unload() local
526 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa1, 0x04); in ast_driver_unload()
529 kfree(ast->dp501_fw_addr); in ast_driver_unload()
533 ast_mm_fini(ast); in ast_driver_unload()
534 if (ast->ioregs != ast->regs + AST_IO_MM_OFFSET) in ast_driver_unload()
535 pci_iounmap(dev->pdev, ast->ioregs); in ast_driver_unload()
536 pci_iounmap(dev->pdev, ast->regs); in ast_driver_unload()
537 kfree(ast); in ast_driver_unload()