1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 #include <device/device.h>
4 #include <device/pci.h>
5 #include <device/pci_ids.h>
6 #include <device/pci_ops.h>
7 #include <device/cardbus.h>
8 #include <console/console.h>
11 static void ti_pci1x2y_init(struct device
*dev
)
13 printk(BIOS_INFO
, "Init of Texas Instruments PCI1x2x PCMCIA/CardBus controller\n");
14 struct southbridge_ti_pci1x2x_config
*conf
= dev
->chip_info
;
17 /* System control (offset 0x80) */
18 pci_write_config32(dev
, 0x80, conf
->scr
);
19 /* Multifunction routing */
20 pci_write_config32(dev
, 0x8C, conf
->mrr
);
22 /* Set the device control register (0x92) accordingly. */
23 pci_write_config8(dev
, 0x92, pci_read_config8(dev
, 0x92) | 0x02);
26 static void ti_pci1x2y_set_subsystem(struct device
*dev
, unsigned int vendor
,
30 * Enable change sub-vendor ID. Clear the bit 5 to enable to write
31 * to the sub-vendor/device ids at 40 and 42.
33 pci_write_config32(dev
, 0x80, pci_read_config32(dev
, 0x080) & ~0x10);
34 pci_dev_set_subsystem(dev
, vendor
, device
);
35 pci_write_config32(dev
, 0x80, pci_read_config32(dev
, 0x80) | 0x10);
38 static struct pci_operations ti_pci1x2y_pci_ops
= {
39 .set_subsystem
= ti_pci1x2y_set_subsystem
,
42 struct device_operations southbridge_ti_pci1x2x_pciops
= {
43 .read_resources
= cardbus_read_resources
,
44 .set_resources
= pci_dev_set_resources
,
45 .enable_resources
= cardbus_enable_resources
,
46 .init
= ti_pci1x2y_init
,
47 .ops_pci
= &ti_pci1x2y_pci_ops
,
50 static const struct pci_driver ti_pci1225_driver __pci_driver
= {
51 .ops
= &southbridge_ti_pci1x2x_pciops
,
53 .device
= PCI_DID_TI_1225
,
56 static const struct pci_driver ti_pci1420_driver __pci_driver
= {
57 .ops
= &southbridge_ti_pci1x2x_pciops
,
59 .device
= PCI_DID_TI_1420
,
62 static const struct pci_driver ti_pci1510_driver __pci_driver
= {
63 .ops
= &southbridge_ti_pci1x2x_pciops
,
65 .device
= PCI_DID_TI_1510
,
68 static const struct pci_driver ti_pci1520_driver __pci_driver
= {
69 .ops
= &southbridge_ti_pci1x2x_pciops
,
71 .device
= PCI_DID_TI_1520
,
74 struct chip_operations southbridge_ti_pci1x2x_ops
= {
75 .name
= "TI PCI1x2x Cardbus controller",