drivers/gpu/drm/ast/ast_2300.c

Source file repositories/reference/linux-study-clean/drivers/gpu/drm/ast/ast_2300.c

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/ast/ast_2300.c
Extension
.c
Size
39920 bytes
Lines
1458
Domain
Driver Families
Bucket
drivers/gpu
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

struct ast2300_dram_param {
	u32 dram_type;
	u32 dram_chipid;
	u32 dram_freq;
	u32 vram_size;
	u32 odt;
	u32 wodt;
	u32 rodt;
	u32 dram_config;
	u32 reg_PERIOD;
	u32 reg_MADJ;
	u32 reg_SADJ;
	u32 reg_MRS;
	u32 reg_EMRS;
	u32 reg_AC1;
	u32 reg_AC2;
	u32 reg_DQSIC;
	u32 reg_DRV;
	u32 reg_IOZ;
	u32 reg_DQIDLY;
	u32 reg_FREQ;
	u32 madj_max;
	u32 dll2_finetune_step;
};

/*
 * DQSI DLL CBR Setting
 */
#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

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

static u32 mmc_test2(struct ast_device *ast, u32 datagen, u8 test_ctl)
{
	u32 data, timeout;

	ast_moutdwm(ast, AST_REG_MCR70, 0x00000000);
	ast_moutdwm(ast, AST_REG_MCR70, (datagen << 3) | test_ctl);
	timeout = 0;
	do {
		data = ast_mindwm(ast, AST_REG_MCR70) & 0x1000;
		if (++timeout > TIMEOUT) {
			ast_moutdwm(ast, AST_REG_MCR70, 0x0);
			return 0xffffffff;
		}
	} while (!data);
	data = ast_mindwm(ast, AST_REG_MCR78);
	data = (data | (data >> 16)) & 0xffff;
	ast_moutdwm(ast, AST_REG_MCR70, 0x00000000);
	return data;
}

static u32 mmc_test_burst2(struct ast_device *ast, u32 datagen)
{
	return mmc_test2(ast, datagen, 0x41);
}

static bool mmc_test_single(struct ast_device *ast, u32 datagen)
{
	return mmc_test(ast, datagen, 0xc5);
}

static u32 mmc_test_single2(struct ast_device *ast, u32 datagen)
{
	return mmc_test2(ast, datagen, 0x05);
}

static int cbr_test(struct ast_device *ast)
{
	u32 data;
	int i;

	data = mmc_test_single2(ast, 0);

Annotation

Implementation Notes