Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/ast: Enable VGA without ast device instance

We'll have to enable the VGA functionality for detecting the ast
device type. Make this work without an instance of the ast device.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20231116100240.22975-6-tzimmermann@suse.de

+19 -19
+12 -17
drivers/gpu/drm/ast/ast_main.c
··· 35 35 36 36 #include "ast_drv.h" 37 37 38 - static bool ast_is_vga_enabled(struct drm_device *dev) 38 + static bool ast_is_vga_enabled(void __iomem *ioregs) 39 39 { 40 - struct ast_device *ast = to_ast_device(dev); 41 - u8 ch; 40 + u8 vgaer = __ast_read8(ioregs, AST_IO_VGAER); 42 41 43 - ch = ast_io_read8(ast, AST_IO_VGAER); 44 - 45 - return !!(ch & 0x01); 42 + return vgaer & AST_IO_VGAER_VGA_ENABLE; 46 43 } 47 44 48 - static void ast_enable_vga(struct drm_device *dev) 45 + static void ast_enable_vga(void __iomem *ioregs) 49 46 { 50 - struct ast_device *ast = to_ast_device(dev); 51 - 52 - ast_io_write8(ast, AST_IO_VGAER, 0x01); 53 - ast_io_write8(ast, AST_IO_VGAMR_W, 0x01); 47 + __ast_write8(ioregs, AST_IO_VGAER, AST_IO_VGAER_VGA_ENABLE); 48 + __ast_write8(ioregs, AST_IO_VGAMR_W, AST_IO_VGAMR_IOSEL); 54 49 } 55 50 56 51 /* ··· 69 74 return devm_add_action_or_reset(dev->dev, ast_enable_mmio_release, ast); 70 75 } 71 76 72 - static void ast_open_key(struct ast_device *ast) 77 + static void ast_open_key(void __iomem *ioregs) 73 78 { 74 - ast_set_index_reg(ast, AST_IO_VGACRI, 0x80, 0xA8); 79 + __ast_write8_i(ioregs, AST_IO_VGACRI, 0x80, AST_IO_VGACR80_PASSWORD); 75 80 } 76 81 77 82 static int ast_device_config_init(struct ast_device *ast) ··· 482 487 ast->regs = regs; 483 488 ast->ioregs = ioregs; 484 489 485 - if (!ast_is_vga_enabled(dev)) { 490 + if (!ast_is_vga_enabled(ioregs)) { 486 491 drm_info(dev, "VGA not enabled on entry, requesting chip POST\n"); 487 492 need_post = true; 488 493 } ··· 492 497 * access to the scratch registers will fail. 493 498 */ 494 499 if (need_post) 495 - ast_enable_vga(dev); 496 - 500 + ast_enable_vga(ioregs); 497 501 /* Enable extended register access */ 498 - ast_open_key(ast); 502 + ast_open_key(ioregs); 503 + 499 504 ret = ast_enable_mmio(ast); 500 505 if (ret) 501 506 return ERR_PTR(ret);
+7 -2
drivers/gpu/drm/ast/ast_reg.h
··· 13 13 #define AST_IO_MM_LENGTH (128) 14 14 15 15 #define AST_IO_VGAARI_W (0x40) 16 + 16 17 #define AST_IO_VGAMR_W (0x42) 18 + #define AST_IO_VGAMR_R (0x4c) 19 + #define AST_IO_VGAMR_IOSEL BIT(0) 20 + 17 21 #define AST_IO_VGAER (0x43) 22 + #define AST_IO_VGAER_VGA_ENABLE BIT(0) 23 + 18 24 #define AST_IO_VGASRI (0x44) 19 25 #define AST_IO_VGADRR (0x47) 20 26 #define AST_IO_VGADWR (0x48) ··· 28 22 #define AST_IO_VGAGRI (0x4E) 29 23 30 24 #define AST_IO_VGACRI (0x54) 25 + #define AST_IO_VGACR80_PASSWORD (0xa8) 31 26 #define AST_IO_VGACRCB_HWC_16BPP BIT(0) /* set: ARGB4444, cleared: 2bpp palette */ 32 27 #define AST_IO_VGACRCB_HWC_ENABLED BIT(1) 33 28 34 29 #define AST_IO_VGAIR1_R (0x5A) 35 30 #define AST_IO_VGAIR1_VREFRESH BIT(3) 36 - 37 - #define AST_IO_VGAMR_R (0x4C) 38 31 39 32 /* 40 33 * Display Transmitter Type