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>
This commit is contained in:
Patrick Rudolph 2024-09-19 15:23:04 +02:00 committed by Lean Sheng Tan
commit 6fe6e78e78
4 changed files with 27 additions and 9 deletions

View file

@ -20,6 +20,7 @@ enum ast_chip {
AST2300,
AST2400,
AST2500,
AST2600,
AST1180,
};

View file

@ -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)
*/

View file

@ -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;

View file

@ -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)