diff options
author | Patrick Rudolph <patrick.rudolph@9elements.com> | 2024-09-19 15:23:04 +0200 |
---|---|---|
committer | Lean Sheng Tan <sheng.tan@9elements.com> | 2024-09-26 15:09:17 +0000 |
commit | 6fe6e78e7822aa973e1851bd8527e0a271c1d321 (patch) | |
tree | 8d2268040408e1e0b16173d950bf9bea83e44b6f /src/drivers | |
parent | 87436bc4dd40c4cc09401e687e476c622f64a090 (diff) |
drivers/aspeed/common: Add AST2600 support
Add support for AST2600 as found on Intel Archer City CRB by using
the code found on Linux's ast drm driver.
While on it do minor modifications found on the Linux drm driver
that also affect the other ast chips.
New log messages:
[INFO ] ASpeed AST2050: initializing video device
[INFO ] ast_detect_chip: VGA not enabled on entry, requesting chip POST
[INFO ] ast_detect_config_mode: Using P2A bridge for configuration
[INFO ] ast_detect_chip: AST 2600 detected
[INFO ] ast_detect_chip: Analog VGA only
[INFO ] ast_driver_load: dram MCLK=890316000 MHz type=3 bus_width=16 size=01000000
[ERROR] No header found
[INFO ] ast_select_mode: Failed to decode EDID
[DEBUG] Assuming VGA for KVM
[DEBUG] AST: Display has 1024px x 768px
[DEBUG] Using framebuffer 1024px x 768px pitch 4096 @ 32 BPP
[INFO ] framebuffer_info: bytes_per_line: 4096, bits_per_pixel: 32
[INFO ] x_res x y_res: 1024 x 768, size: 3145728 at 0x94000000
[INFO ] ASpeed high resolution framebuffer initialized
TEST: Booted on Intel/ArcherCity CRB and used the UEFI firmware menu
over KVM using native graphics init.
Change-Id: I3d2d58d493706673c1b2ba4953967b1641bd6395
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/84425
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Shuo Liu <shuo.liu@intel.com>
Diffstat (limited to 'src/drivers')
-rw-r--r-- | src/drivers/aspeed/common/ast_drv.h | 1 | ||||
-rw-r--r-- | src/drivers/aspeed/common/ast_main.c | 11 | ||||
-rw-r--r-- | src/drivers/aspeed/common/ast_mode.c | 20 | ||||
-rw-r--r-- | src/drivers/aspeed/common/ast_post.c | 4 |
4 files changed, 27 insertions, 9 deletions
diff --git a/src/drivers/aspeed/common/ast_drv.h b/src/drivers/aspeed/common/ast_drv.h index 423ba37c28..90fd16527f 100644 --- a/src/drivers/aspeed/common/ast_drv.h +++ b/src/drivers/aspeed/common/ast_drv.h @@ -20,6 +20,7 @@ enum ast_chip { AST2300, AST2400, AST2500, + AST2600, AST1180, }; diff --git a/src/drivers/aspeed/common/ast_main.c b/src/drivers/aspeed/common/ast_main.c index b28f6a675d..cd51198eff 100644 --- a/src/drivers/aspeed/common/ast_main.c +++ b/src/drivers/aspeed/common/ast_main.c @@ -111,7 +111,10 @@ static int ast_detect_chip(struct drm_device *dev, bool *need_post) uint32_t data; pci_read_config_dword(ast->dev->pdev, 0x08, &data); uint8_t revision = data & 0xff; - if (revision >= 0x40) { + if (revision >= 0x50) { + ast->chip = AST2600; + DRM_INFO("AST 2600 detected\n"); + } else if (revision >= 0x40) { ast->chip = AST2500; DRM_INFO("AST 2500 detected\n"); } else if (revision >= 0x30) { @@ -171,6 +174,8 @@ static int ast_detect_chip(struct drm_device *dev, bool *need_post) if (ast->chip == AST2500 && scu_rev == 0x100) /* ast2510 */ ast->support_wide_screen = true; + if (ast->chip == AST2600) + ast->support_wide_screen = true; } break; } @@ -192,9 +197,9 @@ static int ast_detect_chip(struct drm_device *dev, bool *need_post) ast->tx_chip_type = AST_TX_SIL164; } - if ((ast->chip == AST2300) || (ast->chip == AST2400)) { + if ((ast->chip == AST2300) || (ast->chip == AST2400) || (ast->chip == AST2500)) { /* - * On AST2300 and 2400, look the configuration set by the SoC in + * On AST2300, 2400 and 2500, look the configuration set by the SoC in * the SOC scratch register #1 bits 11:8 (interestingly marked * as "reserved" in the spec) */ diff --git a/src/drivers/aspeed/common/ast_mode.c b/src/drivers/aspeed/common/ast_mode.c index 3ab91c228e..96504579a4 100644 --- a/src/drivers/aspeed/common/ast_mode.c +++ b/src/drivers/aspeed/common/ast_mode.c @@ -247,7 +247,7 @@ static void ast_set_crtc_reg(struct drm_crtc *crtc, struct drm_display_mode *mod u8 jreg05 = 0, jreg07 = 0, jreg09 = 0, jregAC = 0, jregAD = 0, jregAE = 0; u16 temp, precache = 0; - if ((ast->chip == AST2500) && + if ((ast->chip == AST2500 || ast->chip == AST2600) && (vbios_mode->enh_table->flags & AST2500PreCatchCRT)) precache = 40; @@ -288,6 +288,12 @@ static void ast_set_crtc_reg(struct drm_crtc *crtc, struct drm_display_mode *mod ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xAC, 0x00, jregAC); ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xAD, 0x00, jregAD); + // Workaround for HSync Time non octave pixels (1920x1080@60Hz HSync 44 pixels); + if ((ast->chip == AST2600) && (mode->crtc_vdisplay == 1080)) + ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xFC, 0xFD, 0x02); + else + ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xFC, 0xFD, 0x00); + /* vert timings */ temp = (mode->crtc_vtotal) - 2; if (temp & 0x100) @@ -367,7 +373,7 @@ static void ast_set_dclk_reg(struct drm_device *dev, struct drm_display_mode *mo struct ast_private *ast = dev->dev_private; const struct ast_vbios_dclk_info *clk_info; - if (ast->chip == AST2500) + if ((ast->chip == AST2500) || (ast->chip == AST2600)) clk_info = &dclk_table_ast2500[vbios_mode->enh_table->dclk_index]; else clk_info = &dclk_table[vbios_mode->enh_table->dclk_index]; @@ -411,8 +417,11 @@ static void ast_set_ext_reg(struct drm_crtc *crtc, struct drm_display_mode *mode ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xa8, 0xfd, jregA8); /* Set Threshold */ - if (ast->chip == AST2300 || ast->chip == AST2400 || - ast->chip == AST2500) { + if (ast->chip == AST2600) { + ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa7, 0xe0); + ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa6, 0xa0); + } else if (ast->chip == AST2300 || ast->chip == AST2400 || + ast->chip == AST2500) { ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa7, 0x78); ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa6, 0x60); } else if (ast->chip == AST2100 || @@ -529,7 +538,8 @@ enum drm_mode_status ast_mode_valid(struct drm_connector *connector, if ((ast->chip == AST2100) || (ast->chip == AST2200) || (ast->chip == AST2300) || (ast->chip == AST2400) || - (ast->chip == AST2500) || (ast->chip == AST1180)) { + (ast->chip == AST2500) || (ast->chip == AST1180) || + (ast->chip == AST2600)) { if ((hdisplay == 1920) && (vdisplay == 1080)) return MODE_OK; diff --git a/src/drivers/aspeed/common/ast_post.c b/src/drivers/aspeed/common/ast_post.c index 856e4e5ac6..c558b69239 100644 --- a/src/drivers/aspeed/common/ast_post.c +++ b/src/drivers/aspeed/common/ast_post.c @@ -367,7 +367,9 @@ void ast_post_gpu(struct drm_device *dev) ast_enable_mmio(dev); ast_set_def_ext_reg(dev); - if (ast->config_mode == ast_use_p2a) { + if (ast->chip == AST2600) { + return; + } else if (ast->config_mode == ast_use_p2a) { if (ast->chip == AST2500) ast_post_chip_2500(dev); else if (ast->chip == AST2300 || ast->chip == AST2400) |