coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
pci1x2x.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
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>
9 #include "chip.h"
10 
11 static void ti_pci1x2y_init(struct device *dev)
12 {
13 
14  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) {
18  /* System control (offset 0x80) */
19  pci_write_config32(dev, 0x80, conf->scr);
20  /* Multifunction routing */
21  pci_write_config32(dev, 0x8C, conf->mrr);
22  }
23  /* Set the device control register (0x92) accordingly. */
24  pci_write_config8(dev, 0x92, pci_read_config8(dev, 0x92) | 0x02);
25 }
26 
27 static void ti_pci1x2y_set_subsystem(struct device *dev, unsigned int vendor,
28  unsigned int device)
29 {
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);
36  pci_write_config32(dev, 0x80, pci_read_config32(dev, 0x80) | 0x10);
37 }
38 
39 static struct pci_operations ti_pci1x2y_pci_ops = {
40  .set_subsystem = ti_pci1x2y_set_subsystem,
41 };
42 
45  .set_resources = pci_dev_set_resources,
46  .enable_resources = cardbus_enable_resources,
47  .init = ti_pci1x2y_init,
48  .ops_pci = &ti_pci1x2y_pci_ops,
49 };
50 
51 static const struct pci_driver ti_pci1225_driver __pci_driver = {
53  .vendor = PCI_VID_TI,
54  .device = PCI_DID_TI_1225,
55 };
56 
57 static const struct pci_driver ti_pci1420_driver __pci_driver = {
59  .vendor = PCI_VID_TI,
60  .device = PCI_DID_TI_1420,
61 };
62 
63 static const struct pci_driver ti_pci1510_driver __pci_driver = {
65  .vendor = PCI_VID_TI,
66  .device = PCI_DID_TI_1510,
67 };
68 
69 static const struct pci_driver ti_pci1520_driver __pci_driver = {
71  .vendor = PCI_VID_TI,
72  .device = PCI_DID_TI_1520,
73 };
74 
76  CHIP_NAME("TI PCI1x2x Cardbus controller")
77 };
int vendor
Definition: cpu.c:91
void cardbus_enable_resources(struct device *dev)
void cardbus_read_resources(struct device *dev)
#define printk(level,...)
Definition: stdlib.h:16
#define CHIP_NAME(X)
Definition: device.h:32
static __always_inline void pci_write_config32(const struct device *dev, u16 reg, u32 val)
Definition: pci_ops.h:76
static __always_inline u32 pci_read_config32(const struct device *dev, u16 reg)
Definition: pci_ops.h:58
static __always_inline u8 pci_read_config8(const struct device *dev, u16 reg)
Definition: pci_ops.h:46
static __always_inline void pci_write_config8(const struct device *dev, u16 reg, u8 val)
Definition: pci_ops.h:64
#define BIOS_INFO
BIOS_INFO - Expected events.
Definition: loglevel.h:113
struct chip_operations southbridge_ti_pci1x2x_ops
Definition: pci1x2x.c:75
static const struct pci_driver ti_pci1225_driver __pci_driver
Definition: pci1x2x.c:51
static void ti_pci1x2y_set_subsystem(struct device *dev, unsigned int vendor, unsigned int device)
Definition: pci1x2x.c:27
struct device_operations southbridge_ti_pci1x2x_pciops
Definition: pci1x2x.c:43
static struct pci_operations ti_pci1x2y_pci_ops
Definition: pci1x2x.c:39
static void ti_pci1x2y_init(struct device *dev)
Definition: pci1x2x.c:11
void pci_dev_set_subsystem(struct device *dev, unsigned int vendor, unsigned int device)
Definition: pci_device.c:791
void pci_dev_set_resources(struct device *dev)
Definition: pci_device.c:691
#define PCI_DID_TI_1225
Definition: pci_ids.h:878
#define PCI_VID_TI
Definition: pci_ids.h:865
#define PCI_DID_TI_1420
Definition: pci_ids.h:884
#define PCI_DID_TI_1510
Definition: pci_ids.h:886
#define PCI_DID_TI_1520
Definition: pci_ids.h:885
void(* read_resources)(struct device *dev)
Definition: device.h:39
Definition: device.h:107
DEVTREE_CONST void * chip_info
Definition: device.h:164