• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <console/console.h>
4 #include <device/device.h>
5 #include <device/pci.h>
6 #include <device/pci_ops.h>
7 
si_sata_init(struct device * dev)8 static void si_sata_init(struct device *dev)
9 {
10 	uint32_t dword;
11 	/* enable change device id and class id */
12 	dword = pci_read_config32(dev,0x40);
13 	dword |= (1<<0);
14 	pci_write_config32(dev, 0x40, dword);
15 	/* Set IDE Class, Native mode, two drives per channel */
16 	dword = 0x01018f00;
17 	pci_write_config32(dev, 0x08, dword);
18 	/* disable change device id and class id*/
19 	dword = pci_read_config32(dev,0x40);
20 	dword &= ~(1<<0);
21 	pci_write_config32(dev, 0x40, dword);
22 	printk(BIOS_INFO, "SIL3114 set to IDE compatible mode\n");
23 }
24 
25 static struct device_operations si_sata_ops  = {
26 	.read_resources   = pci_dev_read_resources,
27 	.set_resources    = pci_dev_set_resources,
28 	.enable_resources = pci_dev_enable_resources,
29 	.init             = si_sata_init,
30 };
31 
32 static const struct pci_driver si_sata_driver __pci_driver = {
33 	.ops    = &si_sata_ops,
34 	.vendor = 0x1095,
35 	.device = 0x3114,
36 };
37 
38 static const struct pci_driver si_sata_driver_2 __pci_driver = {
39 	.ops    = &si_sata_ops,
40 	.vendor = 0x1095,
41 	.device = 0x0680,
42 };
43