// SPDX-License-Identifier: MIT
/*
* Copyright 2012 Red Hat Inc .
*
* Permission is hereby granted , free of charge , to any person obtaining a
* copy of this software and associated documentation files ( the
* " Software " ) , to deal in the Software without restriction , including
* without limitation the rights to use , copy , modify , merge , publish ,
* distribute , sub license , and / or sell copies of the Software , and to
* permit persons to whom the Software is furnished to do so , subject to
* the following conditions :
*
* THE SOFTWARE IS PROVIDED " AS IS " , WITHOUT WARRANTY OF ANY KIND , EXPRESS OR
* IMPLIED , INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY ,
* FITNESS FOR A PARTICULAR PURPOSE AND NON - INFRINGEMENT . IN NO EVENT SHALL
* THE COPYRIGHT HOLDERS , AUTHORS AND / OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM ,
* DAMAGES OR OTHER LIABILITY , WHETHER IN AN ACTION OF CONTRACT , TORT OR
* OTHERWISE , ARISING FROM , OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
* USE OR OTHER DEALINGS IN THE SOFTWARE .
*
* The above copyright notice and this permission notice ( including the
* next paragraph ) shall be included in all copies or substantial portions
* of the Software .
*/
/*
* Authors : Dave Airlie < airlied @ redhat . com >
*/
#include <linux/delay.h>
#include "ast_drv.h"
#include "ast_post.h"
/*
* POST
*/
void ast_2000_set_def_ext_reg(struct ast_device *ast)
{
static const u8 extreginfo[] = { 0 x0f, 0 x04, 0 x1c, 0 xff };
u8 i, index, reg;
const u8 *ext_reg_info;
/* reset scratch */
for (i = 0 x81; i <= 0 x9f; i++)
ast_set_index_reg(ast, AST_IO_VGACRI, i, 0 x00);
ext_reg_info = extreginfo;
index = 0 xa0;
while (*ext_reg_info != 0 xff) {
ast_set_index_reg_mask(ast, AST_IO_VGACRI, index, 0 x00, *ext_reg_info);
index++;
ext_reg_info++;
}
/* disable standard IO/MEM decode if secondary */
/* ast_set_index_reg-mask(ast, AST_IO_VGACRI, 0xa1, 0xff, 0x3); */
/* Set Ext. Default */
ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0 x8c, 0 x00, 0 x01);
ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0 xb7, 0 x00, 0 x00);
/* Enable RAMDAC for A1 */
reg = 0 x04;
ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0 xb6, 0 xff, reg);
}
static const struct ast_dramstruct ast2000_dram_table_data[] = {
{ 0 x0108, 0 x00000000 },
{ 0 x0120, 0 x00004a21 },
AST_DRAMSTRUCT_UDELAY(67 u),
{ 0 x0000, 0 xFFFFFFFF },
AST_DRAMSTRUCT_INIT(DRAM_TYPE, 0 x00000089),
{ 0 x0008, 0 x22331353 },
{ 0 x000C, 0 x0d07000b },
{ 0 x0010, 0 x11113333 },
{ 0 x0020, 0 x00110350 },
{ 0 x0028, 0 x1e0828f0 },
{ 0 x0024, 0 x00000001 },
{ 0 x001C, 0 x00000000 },
{ 0 x0014, 0 x00000003 },
AST_DRAMSTRUCT_UDELAY(67 u),
{ 0 x0018, 0 x00000131 },
{ 0 x0014, 0 x00000001 },
AST_DRAMSTRUCT_UDELAY(67 u),
{ 0 x0018, 0 x00000031 },
{ 0 x0014, 0 x00000001 },
AST_DRAMSTRUCT_UDELAY(67 u),
{ 0 x0028, 0 x1e0828f1 },
{ 0 x0024, 0 x00000003 },
{ 0 x002C, 0 x1f0f28fb },
{ 0 x0030, 0 xFFFFFE01 },
AST_DRAMSTRUCT_INVALID,
};
static void ast_post_chip_2000(struct ast_device *ast)
{
u8 j;
u32 temp, i;
const struct ast_dramstruct *dram_reg_info;
j = ast_get_index_reg_mask(ast, AST_IO_VGACRI, 0 xd0, 0 xff);
if ((j & 0 x80) == 0 ) { /* VGA only */
dram_reg_info = ast2000_dram_table_data;
ast_write32(ast, 0 xf004, 0 x1e6e0000);
ast_write32(ast, 0 xf000, 0 x1);
ast_write32(ast, 0 x10100, 0 xa8);
do {
;
} while (ast_read32(ast, 0 x10100) != 0 xa8);
while (!AST_DRAMSTRUCT_IS(dram_reg_info, INVALID)) {
if (AST_DRAMSTRUCT_IS(dram_reg_info, UDELAY)) {
for (i = 0 ; i < 15 ; i++)
udelay(dram_reg_info->data);
} else {
ast_write32(ast, 0 x10000 + dram_reg_info->index,
dram_reg_info->data);
}
dram_reg_info++;
}
temp = ast_read32(ast, 0 x10140);
ast_write32(ast, 0 x10140, temp | 0 x40);
}
/* wait ready */
do {
j = ast_get_index_reg_mask(ast, AST_IO_VGACRI, 0 xd0, 0 xff);
} while ((j & 0 x40) == 0 );
}
int ast_2000_post(struct ast_device *ast)
{
ast_2000_set_def_ext_reg(ast);
if (ast->config_mode == ast_use_p2a) {
ast_post_chip_2000(ast);
} else {
if (ast->tx_chip == AST_TX_SIL164) {
/* Enable DVO */
ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0 xa3, 0 xcf, 0 x80);
}
}
return 0 ;
}
Messung V0.5 in Prozent C=91 H=89 G=89
¤ Dauer der Verarbeitung: 0.2 Sekunden
(vorverarbeitet am 2026-09-28)
¤
*© Formatika GbR, Deutschland