Lines Matching refs:ast

38 void ast_set_index_reg_mask(struct ast_private *ast,  in ast_set_index_reg_mask()  argument
43 ast_io_write8(ast, base, index); in ast_set_index_reg_mask()
44 tmp = (ast_io_read8(ast, base + 1) & mask) | val; in ast_set_index_reg_mask()
45 ast_set_index_reg(ast, base, index, tmp); in ast_set_index_reg_mask()
48 uint8_t ast_get_index_reg(struct ast_private *ast, in ast_get_index_reg() argument
52 ast_io_write8(ast, base, index); in ast_get_index_reg()
53 ret = ast_io_read8(ast, base + 1); in ast_get_index_reg()
57 uint8_t ast_get_index_reg_mask(struct ast_private *ast, in ast_get_index_reg_mask() argument
61 ast_io_write8(ast, base, index); in ast_get_index_reg_mask()
62 ret = ast_io_read8(ast, base + 1) & mask; in ast_get_index_reg_mask()
69 struct ast_private *ast = to_ast_private(dev); in ast_detect_config_mode() local
74 ast->config_mode = ast_use_defaults; in ast_detect_config_mode()
81 ast->config_mode = ast_use_dt; in ast_detect_config_mode()
95 jregd0 = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xd0, 0xff); in ast_detect_config_mode()
96 jregd1 = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xd1, 0xff); in ast_detect_config_mode()
101 ast_patch_ahb_2500(ast); in ast_detect_config_mode()
104 data = ast_read32(ast, 0xf004); in ast_detect_config_mode()
107 ast->config_mode = ast_use_p2a; in ast_detect_config_mode()
112 ast_write32(ast, 0xf004, 0x1e6e0000); in ast_detect_config_mode()
113 ast_write32(ast, 0xf000, 0x1); in ast_detect_config_mode()
114 *scu_rev = ast_read32(ast, 0x1207c); in ast_detect_config_mode()
125 struct ast_private *ast = to_ast_private(dev); in ast_detect_chip() local
144 ast_open_key(ast); in ast_detect_chip()
152 ast->chip = AST2600; in ast_detect_chip()
155 ast->chip = AST2500; in ast_detect_chip()
158 ast->chip = AST2400; in ast_detect_chip()
161 ast->chip = AST2300; in ast_detect_chip()
166 ast->chip = AST1100; in ast_detect_chip()
170 ast->chip = AST2200; in ast_detect_chip()
174 ast->chip = AST2150; in ast_detect_chip()
178 ast->chip = AST2100; in ast_detect_chip()
182 ast->vga2_clone = false; in ast_detect_chip()
184 ast->chip = AST2000; in ast_detect_chip()
189 switch (ast->chip) { 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()
210 if (ast->chip == AST2600) /* ast2600 */ in ast_detect_chip()
211 ast->support_wide_screen = true; in ast_detect_chip()
217 ast->tx_chip_types |= AST_TX_NONE_BIT; in ast_detect_chip()
228 jreg = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xa3, 0xff); in ast_detect_chip()
230 ast->tx_chip_types = AST_TX_SIL164_BIT; in ast_detect_chip()
233 if ((ast->chip == AST2300) || (ast->chip == AST2400) || (ast->chip == AST2500)) { in ast_detect_chip()
239 jreg = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xd1, 0xff); in ast_detect_chip()
242 ast->tx_chip_types = AST_TX_SIL164_BIT; in ast_detect_chip()
245 ast->dp501_fw_addr = drmm_kzalloc(dev, 32*1024, GFP_KERNEL); in ast_detect_chip()
246 if (ast->dp501_fw_addr) { in ast_detect_chip()
248 if (ast_backup_fw(dev, ast->dp501_fw_addr, 32*1024)) { in ast_detect_chip()
249 drmm_kfree(dev, ast->dp501_fw_addr); in ast_detect_chip()
250 ast->dp501_fw_addr = NULL; in ast_detect_chip()
255 ast->tx_chip_types = AST_TX_DP501_BIT; in ast_detect_chip()
257 } else if (ast->chip == AST2600) in ast_detect_chip()
258 ast_dp_launch(&ast->base, 0); in ast_detect_chip()
261 if (ast->tx_chip_types & AST_TX_NONE_BIT) in ast_detect_chip()
263 if (ast->tx_chip_types & AST_TX_SIL164_BIT) in ast_detect_chip()
265 if (ast->tx_chip_types & AST_TX_DP501_BIT) in ast_detect_chip()
274 struct ast_private *ast = to_ast_private(dev); 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 = data; in ast_device_release() local
400 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa1, 0x04); in ast_device_release()
408 struct ast_private *ast; in ast_device_create() local
412 ast = devm_drm_dev_alloc(&pdev->dev, drv, struct ast_private, base); in ast_device_create()
413 if (IS_ERR(ast)) in ast_device_create()
414 return ast; in ast_device_create()
415 dev = &ast->base; in ast_device_create()
419 ret = drmm_mutex_init(dev, &ast->ioregs_lock); in ast_device_create()
423 ast->regs = pcim_iomap(pdev, 1, 0); in ast_device_create()
424 if (!ast->regs) in ast_device_create()
434 ast->ioregs = ast->regs + AST_IO_MM_OFFSET; in ast_device_create()
438 if (!ast->ioregs) { in ast_device_create()
439 ast->ioregs = pcim_iomap(pdev, 2, 0); in ast_device_create()
440 if (!ast->ioregs) in ast_device_create()
451 ast->mclk, ast->dram_type, ast->dram_bus_width); in ast_device_create()
456 ret = ast_mm_init(ast); in ast_device_create()
461 ast->dp501_fw_buf = NULL; in ast_device_create()
462 if (ast->vram_size < pci_resource_len(pdev, 0)) { in ast_device_create()
463 ast->dp501_fw_buf = pci_iomap_range(pdev, 0, ast->vram_size, 0); in ast_device_create()
464 if (!ast->dp501_fw_buf) in ast_device_create()
468 ret = ast_mode_config_init(ast); in ast_device_create()
472 ret = devm_add_action_or_reset(dev->dev, ast_device_release, ast); in ast_device_create()
476 return ast; in ast_device_create()