drivers/gpu/drm/ast/ast_2100.c

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

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/ast/ast_2100.c
Extension
.c
Size
13915 bytes
Lines
483
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

if (++timeout > TIMEOUT_AST2150) {
			ast_moutdwm(ast, AST_REG_MCR70, 0x00000000);
			return 0xffffffff;
		}
	} while (!data);
	ast_moutdwm(ast, AST_REG_MCR70, 0x00000000);
	ast_moutdwm(ast, AST_REG_MCR70, 0x00000003 | (datagen << 3));
	timeout = 0;
	do {
		data = ast_mindwm(ast, AST_REG_MCR70) & 0x40;
		if (++timeout > TIMEOUT_AST2150) {
			ast_moutdwm(ast, AST_REG_MCR70, 0x00000000);
			return 0xffffffff;
		}
	} while (!data);
	data = (ast_mindwm(ast, AST_REG_MCR70) & 0x80) >> 7;
	ast_moutdwm(ast, AST_REG_MCR70, 0x00000000);
	return data;
}

static int cbrtest_ast2150(struct ast_device *ast)
{
	int i;

	for (i = 0; i < 8; i++)
		if (mmctestburst2_ast2150(ast, i))
			return 0;
	return 1;
}

static int cbrscan_ast2150(struct ast_device *ast, int busw)
{
	u32 patcnt, loop;

	for (patcnt = 0; patcnt < CBR_PATNUM_AST2150; patcnt++) {
		ast_moutdwm(ast, AST_REG_MCR7C, pattern_AST2150[patcnt]);
		for (loop = 0; loop < CBR_PASSNUM_AST2150; loop++) {
			if (cbrtest_ast2150(ast))
				break;
		}
		if (loop == CBR_PASSNUM_AST2150)
			return 0;
	}
	return 1;
}

static void cbrdlli_ast2150(struct ast_device *ast, int busw)
{
	u32 dll_min[4], dll_max[4], dlli, data, passcnt;

cbr_start:
	dll_min[0] = 0xff;
	dll_min[1] = 0xff;
	dll_min[2] = 0xff;
	dll_min[3] = 0xff;
	dll_max[0] = 0x00;
	dll_max[1] = 0x00;
	dll_max[2] = 0x00;
	dll_max[3] = 0x00;
	passcnt = 0;

	for (dlli = 0; dlli < 100; dlli++) {
		ast_moutdwm(ast, AST_REG_MCR68, dlli | (dlli << 8) | (dlli << 16) | (dlli << 24));
		data = cbrscan_ast2150(ast, busw);
		if (data != 0) {
			if (data & 0x1) {
				if (dll_min[0] > dlli)
					dll_min[0] = dlli;
				if (dll_max[0] < dlli)
					dll_max[0] = dlli;
			}
			passcnt++;
		} else if (passcnt >= CBR_THRESHOLD_AST2150) {
			goto cbr_start;
		}
	}
	if (dll_max[0] == 0 || (dll_max[0] - dll_min[0]) < CBR_THRESHOLD_AST2150)
		goto cbr_start;

	dlli = dll_min[0] + (((dll_max[0] - dll_min[0]) * 7) >> 4);
	ast_moutdwm(ast, AST_REG_MCR68, dlli | (dlli << 8) | (dlli << 16) | (dlli << 24));
}

static void ast_post_chip_2100(struct ast_device *ast)
{
	u8 j;
	u32 i;
	enum ast_dram_layout dram_layout = ast_2100_get_dram_layout_p2a(ast);
	u32 mcr120;
	u32 scu00c, scu040;

Annotation

Implementation Notes