coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
ast_post.c File Reference
#include <console/console.h>
#include <delay.h>
#include "ast_drv.h"
#include "ast_dram_tables.h"
Include dependency graph for ast_post.c:

Go to the source code of this file.

Data Structures

struct  ast2300_dram_param
 

Macros

#define COREBOOT_AST_FAILOVER_TIMEOUT   10000000
 
#define CBR_SIZE_AST2150   ((16 << 10) - 1)
 
#define CBR_PASSNUM_AST2150   5
 
#define CBR_THRESHOLD_AST2150   10
 
#define CBR_THRESHOLD2_AST2150   10
 
#define TIMEOUT_AST2150   5000000
 
#define CBR_PATNUM_AST2150   8
 
#define AST_DDR3   0
 
#define AST_DDR2   1
 
#define CBR_SIZE0   ((1 << 10) - 1)
 
#define CBR_SIZE1   ((4 << 10) - 1)
 
#define CBR_SIZE2   ((64 << 10) - 1)
 
#define CBR_PASSNUM   5
 
#define CBR_PASSNUM2   5
 
#define CBR_THRESHOLD   10
 
#define CBR_THRESHOLD2   10
 
#define TIMEOUT   5000000
 
#define CBR_PATNUM   8
 

Functions

static void ast_post_chip_2300 (struct drm_device *dev)
 
static void ast_post_chip_2500 (struct drm_device *dev)
 
void ast_enable_vga (struct drm_device *dev)
 
void ast_enable_mmio (struct drm_device *dev)
 
bool ast_is_vga_enabled (struct drm_device *dev)
 
static void ast_set_def_ext_reg (struct drm_device *dev)
 
u32 ast_mindwm (struct ast_private *ast, u32 r)
 
void ast_moutdwm (struct ast_private *ast, u32 r, u32 v)
 
static u32 mmctestburst2_ast2150 (struct ast_private *ast, u32 datagen)
 
static int cbrtest_ast2150 (struct ast_private *ast)
 
static int cbrscan_ast2150 (struct ast_private *ast, int busw)
 
static void cbrdlli_ast2150 (struct ast_private *ast, int busw)
 
static void ast_init_dram_reg (struct drm_device *dev)
 
void ast_post_gpu (struct drm_device *dev)
 
static bool mmc_test (struct ast_private *ast, u32 datagen, u8 test_ctl)
 
static u32 mmc_test2 (struct ast_private *ast, u32 datagen, u8 test_ctl)
 
static bool mmc_test_burst (struct ast_private *ast, u32 datagen)
 
static u32 mmc_test_burst2 (struct ast_private *ast, u32 datagen)
 
static bool mmc_test_single (struct ast_private *ast, u32 datagen)
 
static u32 mmc_test_single2 (struct ast_private *ast, u32 datagen)
 
static bool mmc_test_single_2500 (struct ast_private *ast, u32 datagen)
 
static int cbr_test (struct ast_private *ast)
 
static int cbr_scan (struct ast_private *ast)
 
static u32 cbr_test2 (struct ast_private *ast)
 
static u32 cbr_scan2 (struct ast_private *ast)
 
static bool cbr_test3 (struct ast_private *ast)
 
static bool cbr_scan3 (struct ast_private *ast)
 
static bool finetuneDQI_L (struct ast_private *ast, struct ast2300_dram_param *param)
 
static void finetuneDQSI (struct ast_private *ast)
 
static bool cbr_dll2 (struct ast_private *ast, struct ast2300_dram_param *param)
 
static void get_ddr3_info (struct ast_private *ast, struct ast2300_dram_param *param)
 
static void ddr3_init (struct ast_private *ast, struct ast2300_dram_param *param)
 
static void get_ddr2_info (struct ast_private *ast, struct ast2300_dram_param *param)
 
static void ddr2_init (struct ast_private *ast, struct ast2300_dram_param *param)
 
static bool cbr_test_2500 (struct ast_private *ast)
 
static bool ddr_test_2500 (struct ast_private *ast)
 
static void ddr_init_common_2500 (struct ast_private *ast)
 
static void ddr_phy_init_2500 (struct ast_private *ast)
 
static void check_dram_size_2500 (struct ast_private *ast, u32 tRFC)
 
static void enable_cache_2500 (struct ast_private *ast)
 
static void set_mpll_2500 (struct ast_private *ast)
 
static void reset_mmc_2500 (struct ast_private *ast)
 
static void ddr3_init_2500 (struct ast_private *ast, const u32 *ddr_table)
 
static void ddr4_init_2500 (struct ast_private *ast, const u32 *ddr_table)
 
static bool ast_dram_init_2500 (struct ast_private *ast)
 

Variables

static const u8 extreginfo [] = { 0x0f, 0x04, 0x1c, 0xff }
 
static const u8 extreginfo_ast2300a0 [] = { 0x0f, 0x04, 0x1c, 0xff }
 
static const u8 extreginfo_ast2300 [] = { 0x0f, 0x04, 0x1f, 0xff }
 
static const u32 pattern_AST2150 [14]
 
static const u32 pattern [8]
 

Macro Definition Documentation

◆ AST_DDR2

#define AST_DDR2   1

Definition at line 388 of file ast_post.c.

◆ AST_DDR3

#define AST_DDR3   0

Definition at line 387 of file ast_post.c.

◆ CBR_PASSNUM

#define CBR_PASSNUM   5

Definition at line 421 of file ast_post.c.

◆ CBR_PASSNUM2

#define CBR_PASSNUM2   5

Definition at line 422 of file ast_post.c.

◆ CBR_PASSNUM_AST2150

#define CBR_PASSNUM_AST2150   5

Definition at line 132 of file ast_post.c.

◆ CBR_PATNUM

#define CBR_PATNUM   8

Definition at line 426 of file ast_post.c.

◆ CBR_PATNUM_AST2150

#define CBR_PATNUM_AST2150   8

Definition at line 137 of file ast_post.c.

◆ CBR_SIZE0

#define CBR_SIZE0   ((1 << 10) - 1)

Definition at line 418 of file ast_post.c.

◆ CBR_SIZE1

#define CBR_SIZE1   ((4 << 10) - 1)

Definition at line 419 of file ast_post.c.

◆ CBR_SIZE2

#define CBR_SIZE2   ((64 << 10) - 1)

Definition at line 420 of file ast_post.c.

◆ CBR_SIZE_AST2150

#define CBR_SIZE_AST2150   ((16 << 10) - 1)

Definition at line 131 of file ast_post.c.

◆ CBR_THRESHOLD

#define CBR_THRESHOLD   10

Definition at line 423 of file ast_post.c.

◆ CBR_THRESHOLD2

#define CBR_THRESHOLD2   10

Definition at line 424 of file ast_post.c.

◆ CBR_THRESHOLD2_AST2150

#define CBR_THRESHOLD2_AST2150   10

Definition at line 134 of file ast_post.c.

◆ CBR_THRESHOLD_AST2150

#define CBR_THRESHOLD_AST2150   10

Definition at line 133 of file ast_post.c.

◆ COREBOOT_AST_FAILOVER_TIMEOUT

#define COREBOOT_AST_FAILOVER_TIMEOUT   10000000

Definition at line 3 of file ast_post.c.

◆ TIMEOUT

#define TIMEOUT   5000000

Definition at line 425 of file ast_post.c.

◆ TIMEOUT_AST2150

#define TIMEOUT_AST2150   5000000

Definition at line 135 of file ast_post.c.

Function Documentation

◆ ast_dram_init_2500()

static bool ast_dram_init_2500 ( struct ast_private ast)
static

Definition at line 2038 of file ast_post.c.

References ast, ast2500_ddr3_1600_timing_table, ast2500_ddr4_1600_timing_table, ast_mindwm(), ast_moutdwm(), ddr3_init_2500(), ddr4_init_2500(), ddr_init_common_2500(), ddr_test_2500(), reset_mmc_2500(), and set_mpll_2500().

Referenced by ast_post_chip_2500().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ast_enable_mmio()

void ast_enable_mmio ( struct drm_device dev)

Definition at line 22 of file ast_post.c.

References ast, AST_IO_CRTC_PORT, ast_set_index_reg_mask(), ast_private::dev, and drm_device::dev_private.

Referenced by ast_detect_chip(), and ast_post_gpu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ast_enable_vga()

void ast_enable_vga ( struct drm_device dev)

Definition at line 14 of file ast_post.c.

References ast, AST_IO_MISC_PORT_WRITE, AST_IO_VGA_ENABLE_PORT, ast_private::dev, and drm_device::dev_private.

Referenced by ast_detect_chip(), and ast_post_gpu().

Here is the caller graph for this function:

◆ ast_init_dram_reg()

◆ ast_is_vga_enabled()

bool ast_is_vga_enabled ( struct drm_device dev)

Definition at line 29 of file ast_post.c.

References ast, AST1180, AST_IO_VGA_ENABLE_PORT, ch, ast_private::chip, ast_private::dev, and drm_device::dev_private.

Referenced by ast_detect_chip().

Here is the caller graph for this function:

◆ ast_mindwm()

◆ ast_moutdwm()

◆ ast_post_chip_2300()

◆ ast_post_chip_2500()

void ast_post_chip_2500 ( struct drm_device dev)
static

Definition at line 2066 of file ast_post.c.

References ast, ast_dram_init_2500(), ast_get_index_reg_mask(), AST_IO_CRTC_PORT, ast_mindwm(), ast_moutdwm(), BIOS_ERR, ast_private::dev, drm_device::dev_private, mdelay(), and printk.

Referenced by ast_post_gpu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ast_post_gpu()

◆ ast_set_def_ext_reg()

static void ast_set_def_ext_reg ( struct drm_device dev)
static

Definition at line 48 of file ast_post.c.

References ast, AST2300, AST2400, AST2500, AST_IO_CRTC_PORT, ast_set_index_reg(), ast_set_index_reg_mask(), ast_private::chip, ast_private::dev, drm_device::dev_private, extreginfo, extreginfo_ast2300, extreginfo_ast2300a0, pci_read_config_dword(), and drm_device::pdev.

Referenced by ast_post_gpu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cbr_dll2()

static bool cbr_dll2 ( struct ast_private ast,
struct ast2300_dram_param param 
)
static

Definition at line 793 of file ast_post.c.

References ast, ast_mindwm(), ast_moutdwm(), cbr_scan(), CBR_SIZE2, CBR_THRESHOLD, finetuneDQI_L(), finetuneDQSI(), and retry.

Referenced by ddr2_init(), and ddr3_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cbr_scan()

static int cbr_scan ( struct ast_private ast)
static

Definition at line 523 of file ast_post.c.

References ast, ast_moutdwm(), CBR_PASSNUM2, CBR_PATNUM, cbr_test(), and pattern.

Referenced by cbr_dll2().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cbr_scan2()

static u32 cbr_scan2 ( struct ast_private ast)
static

Definition at line 558 of file ast_post.c.

References ast, ast_moutdwm(), CBR_PASSNUM2, CBR_PATNUM, cbr_test2(), and pattern.

Referenced by finetuneDQI_L().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cbr_scan3()

static bool cbr_scan3 ( struct ast_private ast)
static

Definition at line 588 of file ast_post.c.

References ast, ast_moutdwm(), CBR_PATNUM, cbr_test3(), and pattern.

Referenced by finetuneDQSI().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cbr_test()

static int cbr_test ( struct ast_private ast)
static

Definition at line 504 of file ast_post.c.

References ast, mmc_test_burst2(), and mmc_test_single2().

Referenced by cbr_scan().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cbr_test2()

static u32 cbr_test2 ( struct ast_private ast)
static

Definition at line 544 of file ast_post.c.

References ast, mmc_test_burst2(), and mmc_test_single2().

Referenced by cbr_scan2().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cbr_test3()

static bool cbr_test3 ( struct ast_private ast)
static

Definition at line 579 of file ast_post.c.

References ast, mmc_test_burst(), and mmc_test_single().

Referenced by cbr_scan3().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cbr_test_2500()

static bool cbr_test_2500 ( struct ast_private ast)
static

Definition at line 1717 of file ast_post.c.

References ast, ast_moutdwm(), mmc_test_burst(), and mmc_test_single_2500().

Referenced by ddr4_init_2500().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cbrdlli_ast2150()

static void cbrdlli_ast2150 ( struct ast_private ast,
int  busw 
)
static

Definition at line 211 of file ast_post.c.

References ast, ast_moutdwm(), CBR_THRESHOLD_AST2150, and cbrscan_ast2150().

Referenced by ast_init_dram_reg().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cbrscan_ast2150()

static int cbrscan_ast2150 ( struct ast_private ast,
int  busw 
)
static

Definition at line 195 of file ast_post.c.

References ast, ast_moutdwm(), CBR_PASSNUM_AST2150, CBR_PATNUM_AST2150, cbrtest_ast2150(), and pattern_AST2150.

Referenced by cbrdlli_ast2150().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cbrtest_ast2150()

static int cbrtest_ast2150 ( struct ast_private ast)
static

Definition at line 185 of file ast_post.c.

References ast, and mmctestburst2_ast2150().

Referenced by cbrscan_ast2150().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_dram_size_2500()

static void check_dram_size_2500 ( struct ast_private ast,
u32  tRFC 
)
static

Definition at line 1802 of file ast_post.c.

References ast, ast_mindwm(), and ast_moutdwm().

Referenced by ddr3_init_2500(), and ddr4_init_2500().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ddr2_init()

◆ ddr3_init()

◆ ddr3_init_2500()

static void ddr3_init_2500 ( struct ast_private ast,
const u32 ddr_table 
)
static

Definition at line 1884 of file ast_post.c.

References ast, ast_moutdwm(), check_dram_size_2500(), ddr_phy_init_2500(), enable_cache_2500(), REGIDX_010, REGIDX_014, REGIDX_018, REGIDX_020, REGIDX_024, REGIDX_02C, REGIDX_030, REGIDX_214, REGIDX_2E0, REGIDX_2E4, REGIDX_2E8, REGIDX_2EC, REGIDX_2F0, REGIDX_2F4, REGIDX_2F8, REGIDX_PLL, and REGIDX_RFC.

Referenced by ast_dram_init_2500().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ddr4_init_2500()

static void ddr4_init_2500 ( struct ast_private ast,
const u32 ddr_table 
)
static

◆ ddr_init_common_2500()

static void ddr_init_common_2500 ( struct ast_private ast)
static

Definition at line 1745 of file ast_post.c.

References ast, and ast_moutdwm().

Referenced by ast_dram_init_2500().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ddr_phy_init_2500()

static void ddr_phy_init_2500 ( struct ast_private ast)
static

Definition at line 1768 of file ast_post.c.

References ast, ast_mindwm(), ast_moutdwm(), TIMEOUT, and udelay().

Referenced by ddr3_init_2500(), and ddr4_init_2500().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ddr_test_2500()

static bool ddr_test_2500 ( struct ast_private ast)
static

Definition at line 1728 of file ast_post.c.

References ast, ast_moutdwm(), mmc_test_burst(), and mmc_test_single_2500().

Referenced by ast_dram_init_2500().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ enable_cache_2500()

static void enable_cache_2500 ( struct ast_private ast)
static

Definition at line 1833 of file ast_post.c.

References ast, ast_mindwm(), and ast_moutdwm().

Referenced by ddr3_init_2500(), and ddr4_init_2500().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ finetuneDQI_L()

static bool finetuneDQI_L ( struct ast_private ast,
struct ast2300_dram_param param 
)
static

Definition at line 604 of file ast_post.c.

References ast, ast_moutdwm(), cbr_scan2(), CBR_SIZE1, CBR_THRESHOLD2, mask, and retry.

Referenced by cbr_dll2().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ finetuneDQSI()

static void finetuneDQSI ( struct ast_private ast)
static

Definition at line 703 of file ast_post.c.

References ast, ast_mindwm(), ast_moutdwm(), cbr_scan3(), and CBR_SIZE0.

Referenced by cbr_dll2().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_ddr2_info()

◆ get_ddr3_info()

◆ mmc_test()

static bool mmc_test ( struct ast_private ast,
u32  datagen,
u8  test_ctl 
)
static

Definition at line 439 of file ast_post.c.

References ast, ast_mindwm(), ast_moutdwm(), and TIMEOUT.

Referenced by mmc_test_burst(), mmc_test_single(), and mmc_test_single_2500().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mmc_test2()

static u32 mmc_test2 ( struct ast_private ast,
u32  datagen,
u8  test_ctl 
)
static

Definition at line 459 of file ast_post.c.

References ast, ast_mindwm(), ast_moutdwm(), and TIMEOUT.

Referenced by mmc_test_burst2(), and mmc_test_single2().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mmc_test_burst()

static bool mmc_test_burst ( struct ast_private ast,
u32  datagen 
)
static

Definition at line 479 of file ast_post.c.

References ast, and mmc_test().

Referenced by cbr_test3(), cbr_test_2500(), and ddr_test_2500().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mmc_test_burst2()

static u32 mmc_test_burst2 ( struct ast_private ast,
u32  datagen 
)
static

Definition at line 484 of file ast_post.c.

References ast, and mmc_test2().

Referenced by cbr_test(), and cbr_test2().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mmc_test_single()

static bool mmc_test_single ( struct ast_private ast,
u32  datagen 
)
static

Definition at line 489 of file ast_post.c.

References ast, and mmc_test().

Referenced by cbr_test3().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mmc_test_single2()

static u32 mmc_test_single2 ( struct ast_private ast,
u32  datagen 
)
static

Definition at line 494 of file ast_post.c.

References ast, and mmc_test2().

Referenced by cbr_test(), and cbr_test2().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mmc_test_single_2500()

static bool mmc_test_single_2500 ( struct ast_private ast,
u32  datagen 
)
static

Definition at line 499 of file ast_post.c.

References ast, and mmc_test().

Referenced by cbr_test_2500(), and ddr_test_2500().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mmctestburst2_ast2150()

static u32 mmctestburst2_ast2150 ( struct ast_private ast,
u32  datagen 
)
static

Definition at line 156 of file ast_post.c.

References ast, ast_mindwm(), ast_moutdwm(), and TIMEOUT_AST2150.

Referenced by cbrtest_ast2150().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reset_mmc_2500()

static void reset_mmc_2500 ( struct ast_private ast)
static

Definition at line 1873 of file ast_post.c.

References ast, ast_moutdwm(), and mdelay().

Referenced by ast_dram_init_2500().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_mpll_2500()

static void set_mpll_2500 ( struct ast_private ast)
static

Definition at line 1846 of file ast_post.c.

References addr, ast, ast_mindwm(), ast_moutdwm(), and udelay().

Referenced by ast_dram_init_2500().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ extreginfo

const u8 extreginfo[] = { 0x0f, 0x04, 0x1c, 0xff }
static

Definition at line 43 of file ast_post.c.

Referenced by ast_set_def_ext_reg().

◆ extreginfo_ast2300

const u8 extreginfo_ast2300[] = { 0x0f, 0x04, 0x1f, 0xff }
static

Definition at line 45 of file ast_post.c.

Referenced by ast_set_def_ext_reg().

◆ extreginfo_ast2300a0

const u8 extreginfo_ast2300a0[] = { 0x0f, 0x04, 0x1c, 0xff }
static

Definition at line 44 of file ast_post.c.

Referenced by ast_set_def_ext_reg().

◆ pattern

const u32 pattern[8]
static
Initial value:
= {
0xFF00FF00,
0xCC33CC33,
0xAA55AA55,
0x88778877,
0x92CC4D6E,
0x543D3CDE,
0xF1E843C7,
0x7C61D253
}

Definition at line 428 of file ast_post.c.

Referenced by cbr_scan(), cbr_scan2(), cbr_scan3(), display_pattern(), exynos_dp_set_training_pattern(), fill_pattern5(), test_dq_aligned(), write_training_test(), ww_ring_display_pattern(), and xhci_acpi_name().

◆ pattern_AST2150

const u32 pattern_AST2150[14]
static
Initial value:
= {
0xFF00FF00,
0xCC33CC33,
0xAA55AA55,
0xFFFE0001,
0x683501FE,
0x0F1929B0,
0x2D0B4346,
0x60767F02,
0x6FBE36A6,
0x3A253035,
0x3019686D,
0x41C6167E,
0x620152BF,
0x20F050E0
}

Definition at line 139 of file ast_post.c.

Referenced by cbrscan_ast2150().