Lines Matching refs:ast

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