blob: ccd3ce941d904940bcef70f17c9db1499bc8eae2 [file] [log] [blame]
Patrick Georgiac959032020-05-05 22:49:26 +02001/* SPDX-License-Identifier: GPL-2.0-or-later */
Uwe Hermannc6a10622010-10-17 19:30:58 +00002
Marc Bertens2ad8ab82010-06-04 19:53:55 +00003#include <device/device.h>
4#include <device/pci.h>
5#include <device/pci_ids.h>
6#include <device/pci_ops.h>
Sven Schnelle5c72a872011-04-20 08:58:30 +00007#include <device/cardbus.h>
Marc Bertens2ad8ab82010-06-04 19:53:55 +00008#include <console/console.h>
Sven Schnellebaec0342011-04-20 08:57:53 +00009#include "chip.h"
Marc Bertens2ad8ab82010-06-04 19:53:55 +000010
11static void ti_pci1x2y_init(struct device *dev)
12{
Uwe Hermann2d1d9ceb2010-12-26 14:12:38 +000013
Sven Schnellebaec0342011-04-20 08:57:53 +000014 printk(BIOS_INFO, "Init of Texas Instruments PCI1x2x PCMCIA/CardBus controller\n");
15 struct southbridge_ti_pci1x2x_config *conf = dev->chip_info;
16
17 if (conf) {
Sven Schnellebaec0342011-04-20 08:57:53 +000018 /* System control (offset 0x80) */
19 pci_write_config32(dev, 0x80, conf->scr);
20 /* Multifunction routing */
21 pci_write_config32(dev, 0x8C, conf->mrr);
22 }
Uwe Hermann2d1d9ceb2010-12-26 14:12:38 +000023 /* Set the device control register (0x92) accordingly. */
24 pci_write_config8(dev, 0x92, pci_read_config8(dev, 0x92) | 0x02);
Marc Bertens2ad8ab82010-06-04 19:53:55 +000025}
26
Martin Rothff744bf2019-10-23 21:46:03 -060027static void ti_pci1x2y_set_subsystem(struct device *dev, unsigned int vendor,
28 unsigned int device)
Sven Schnelle5f22f3032011-04-20 08:58:16 +000029{
30 /*
31 * Enable change sub-vendor ID. Clear the bit 5 to enable to write
32 * to the sub-vendor/device ids at 40 and 42.
33 */
34 pci_write_config32(dev, 0x80, pci_read_config32(dev, 0x080) & ~0x10);
Subrata Banik15ccbf02019-03-20 15:09:44 +053035 pci_dev_set_subsystem(dev, vendor, device);
Sven Schnelle5f22f3032011-04-20 08:58:16 +000036 pci_write_config32(dev, 0x80, pci_read_config32(dev, 0x80) | 0x10);
37}
38
39static struct pci_operations ti_pci1x2y_pci_ops = {
40 .set_subsystem = ti_pci1x2y_set_subsystem,
41};
42
Sven Schnellebaec0342011-04-20 08:57:53 +000043struct device_operations southbridge_ti_pci1x2x_pciops = {
Sven Schnelle5c72a872011-04-20 08:58:30 +000044 .read_resources = cardbus_read_resources,
Marc Bertens2ad8ab82010-06-04 19:53:55 +000045 .set_resources = pci_dev_set_resources,
Sven Schnelle5c72a872011-04-20 08:58:30 +000046 .enable_resources = cardbus_enable_resources,
Marc Bertens2ad8ab82010-06-04 19:53:55 +000047 .init = ti_pci1x2y_init,
Sven Schnelle5f22f3032011-04-20 08:58:16 +000048 .ops_pci = &ti_pci1x2y_pci_ops,
Marc Bertens2ad8ab82010-06-04 19:53:55 +000049};
50
Marc Bertens2ad8ab82010-06-04 19:53:55 +000051static const struct pci_driver ti_pci1225_driver __pci_driver = {
Sven Schnellebaec0342011-04-20 08:57:53 +000052 .ops = &southbridge_ti_pci1x2x_pciops,
Felix Singer43b7f412022-03-07 04:34:52 +010053 .vendor = PCI_VID_TI,
54 .device = PCI_DID_TI_1225,
Marc Bertens2ad8ab82010-06-04 19:53:55 +000055};
56
Marc Bertens2ad8ab82010-06-04 19:53:55 +000057static const struct pci_driver ti_pci1420_driver __pci_driver = {
Sven Schnellebaec0342011-04-20 08:57:53 +000058 .ops = &southbridge_ti_pci1x2x_pciops,
Felix Singer43b7f412022-03-07 04:34:52 +010059 .vendor = PCI_VID_TI,
60 .device = PCI_DID_TI_1420,
Marc Bertens2ad8ab82010-06-04 19:53:55 +000061};
Myles Watson356f8482010-06-07 20:15:54 +000062
Sven Schnelle20f7f3b2011-04-20 08:58:08 +000063static const struct pci_driver ti_pci1510_driver __pci_driver = {
64 .ops = &southbridge_ti_pci1x2x_pciops,
Felix Singer43b7f412022-03-07 04:34:52 +010065 .vendor = PCI_VID_TI,
66 .device = PCI_DID_TI_1510,
Sven Schnelle20f7f3b2011-04-20 08:58:08 +000067};
68
Marc Bertens2ad8ab82010-06-04 19:53:55 +000069static const struct pci_driver ti_pci1520_driver __pci_driver = {
Sven Schnellebaec0342011-04-20 08:57:53 +000070 .ops = &southbridge_ti_pci1x2x_pciops,
Felix Singer43b7f412022-03-07 04:34:52 +010071 .vendor = PCI_VID_TI,
72 .device = PCI_DID_TI_1520,
Marc Bertens2ad8ab82010-06-04 19:53:55 +000073};
Sven Schnellebaec0342011-04-20 08:57:53 +000074
75struct chip_operations southbridge_ti_pci1x2x_ops = {
76 CHIP_NAME("TI PCI1x2x Cardbus controller")
77};