.. | .. |
---|
26 | 26 | * Authors: Dave Airlie <airlied@redhat.com> |
---|
27 | 27 | */ |
---|
28 | 28 | |
---|
29 | | -#include <drm/drmP.h> |
---|
30 | | -#include "ast_drv.h" |
---|
| 29 | +#include <linux/delay.h> |
---|
| 30 | +#include <linux/pci.h> |
---|
| 31 | + |
---|
| 32 | +#include <drm/drm_print.h> |
---|
31 | 33 | |
---|
32 | 34 | #include "ast_dram_tables.h" |
---|
| 35 | +#include "ast_drv.h" |
---|
33 | 36 | |
---|
34 | 37 | static void ast_post_chip_2300(struct drm_device *dev); |
---|
35 | 38 | static void ast_post_chip_2500(struct drm_device *dev); |
---|
36 | 39 | |
---|
37 | 40 | void ast_enable_vga(struct drm_device *dev) |
---|
38 | 41 | { |
---|
39 | | - struct ast_private *ast = dev->dev_private; |
---|
| 42 | + struct ast_private *ast = to_ast_private(dev); |
---|
40 | 43 | |
---|
41 | 44 | ast_io_write8(ast, AST_IO_VGA_ENABLE_PORT, 0x01); |
---|
42 | 45 | ast_io_write8(ast, AST_IO_MISC_PORT_WRITE, 0x01); |
---|
.. | .. |
---|
44 | 47 | |
---|
45 | 48 | void ast_enable_mmio(struct drm_device *dev) |
---|
46 | 49 | { |
---|
47 | | - struct ast_private *ast = dev->dev_private; |
---|
| 50 | + struct ast_private *ast = to_ast_private(dev); |
---|
48 | 51 | |
---|
49 | 52 | ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa1, 0x06); |
---|
50 | 53 | } |
---|
.. | .. |
---|
52 | 55 | |
---|
53 | 56 | bool ast_is_vga_enabled(struct drm_device *dev) |
---|
54 | 57 | { |
---|
55 | | - struct ast_private *ast = dev->dev_private; |
---|
| 58 | + struct ast_private *ast = to_ast_private(dev); |
---|
56 | 59 | u8 ch; |
---|
57 | 60 | |
---|
58 | | - if (ast->chip == AST1180) { |
---|
59 | | - /* TODO 1180 */ |
---|
60 | | - } else { |
---|
61 | | - ch = ast_io_read8(ast, AST_IO_VGA_ENABLE_PORT); |
---|
62 | | - return !!(ch & 0x01); |
---|
63 | | - } |
---|
64 | | - return false; |
---|
| 61 | + ch = ast_io_read8(ast, AST_IO_VGA_ENABLE_PORT); |
---|
| 62 | + |
---|
| 63 | + return !!(ch & 0x01); |
---|
65 | 64 | } |
---|
66 | 65 | |
---|
67 | 66 | static const u8 extreginfo[] = { 0x0f, 0x04, 0x1c, 0xff }; |
---|
.. | .. |
---|
71 | 70 | static void |
---|
72 | 71 | ast_set_def_ext_reg(struct drm_device *dev) |
---|
73 | 72 | { |
---|
74 | | - struct ast_private *ast = dev->dev_private; |
---|
| 73 | + struct ast_private *ast = to_ast_private(dev); |
---|
75 | 74 | u8 i, index, reg; |
---|
76 | 75 | const u8 *ext_reg_info; |
---|
77 | 76 | |
---|
.. | .. |
---|
273 | 272 | |
---|
274 | 273 | static void ast_init_dram_reg(struct drm_device *dev) |
---|
275 | 274 | { |
---|
276 | | - struct ast_private *ast = dev->dev_private; |
---|
| 275 | + struct ast_private *ast = to_ast_private(dev); |
---|
277 | 276 | u8 j; |
---|
278 | 277 | u32 data, temp, i; |
---|
279 | 278 | const struct ast_dramstruct *dram_reg_info; |
---|
.. | .. |
---|
366 | 365 | |
---|
367 | 366 | void ast_post_gpu(struct drm_device *dev) |
---|
368 | 367 | { |
---|
| 368 | + struct ast_private *ast = to_ast_private(dev); |
---|
369 | 369 | u32 reg; |
---|
370 | | - struct ast_private *ast = dev->dev_private; |
---|
371 | 370 | |
---|
372 | | - pci_read_config_dword(ast->dev->pdev, 0x04, ®); |
---|
| 371 | + pci_read_config_dword(dev->pdev, 0x04, ®); |
---|
373 | 372 | reg |= 0x3; |
---|
374 | | - pci_write_config_dword(ast->dev->pdev, 0x04, reg); |
---|
| 373 | + pci_write_config_dword(dev->pdev, 0x04, reg); |
---|
375 | 374 | |
---|
376 | 375 | ast_enable_vga(dev); |
---|
377 | 376 | ast_open_key(ast); |
---|
.. | .. |
---|
1597 | 1596 | |
---|
1598 | 1597 | static void ast_post_chip_2300(struct drm_device *dev) |
---|
1599 | 1598 | { |
---|
1600 | | - struct ast_private *ast = dev->dev_private; |
---|
| 1599 | + struct ast_private *ast = to_ast_private(dev); |
---|
1601 | 1600 | struct ast2300_dram_param param; |
---|
1602 | 1601 | u32 temp; |
---|
1603 | 1602 | u8 reg; |
---|
.. | .. |
---|
2029 | 2028 | |
---|
2030 | 2029 | void ast_post_chip_2500(struct drm_device *dev) |
---|
2031 | 2030 | { |
---|
2032 | | - struct ast_private *ast = dev->dev_private; |
---|
| 2031 | + struct ast_private *ast = to_ast_private(dev); |
---|
2033 | 2032 | u32 temp; |
---|
2034 | 2033 | u8 reg; |
---|
2035 | 2034 | |
---|
.. | .. |
---|
2068 | 2067 | } |
---|
2069 | 2068 | |
---|
2070 | 2069 | if (!ast_dram_init_2500(ast)) |
---|
2071 | | - DRM_ERROR("DRAM init failed !\n"); |
---|
| 2070 | + drm_err(dev, "DRAM init failed !\n"); |
---|
2072 | 2071 | |
---|
2073 | 2072 | temp = ast_mindwm(ast, 0x1e6e2040); |
---|
2074 | 2073 | ast_moutdwm(ast, 0x1e6e2040, temp | 0x40); |
---|