summaryrefslogtreecommitdiff
path: root/src/southbridge/via/k8t890/k8t890_early_car.c
blob: d66801e7e55b0cdf33c683f85572821034b6ed02 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
 * This file is part of the LinuxBIOS project.
 *
 * Copyright (C) 2007 Rudolf Marek <r.marek@assembler.cz>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License v2 as published by
 * the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 */

/*
 * Seems the link and width of HT link needs to be setup too, you need to
 * generate PCI reset or LDTSTOP to apply.
 */

u8 k8t890_early_setup_car(u8 width, u8 speed)
{
	u8 awidth, aspeed;

	print_debug("LDT width and speed for K8T890 was");
	awidth = pci_read_config8(PCI_DEV(0, 0x0, 0), 0x67);
	print_debug_hex8(awidth);

	aspeed = pci_read_config8(PCI_DEV(0, 0x0, 0), 0x6d);
	print_debug_hex8(aspeed);

	if ((aspeed == speed) && (((width == 16) && (awidth == 0x11)) ||
				  ((width == 8) && (awidth == 0x00))))
		return 0;

	/* Update the desired HT LNK capabilities in NB too. */
	pci_write_config8(PCI_DEV(0, 0x0, 0), 0x67,
			  (width == 16) ? 0x11 : 0x00);
	pci_write_config8(PCI_DEV(0, 0x0, 0), 0x6d, speed);

	print_debug(" and will after HT reset: ");

	awidth = pci_read_config8(PCI_DEV(0, 0x0, 0), 0x67);
	print_debug_hex8(awidth);

	aspeed = pci_read_config8(PCI_DEV(0, 0x0, 0), 0x6d);
	print_debug_hex8(aspeed);

	print_debug("\n");

	return 1;
}