| 1 |
|
| 2 |
|
| 3 |
#include <device/device.h> |
| 4 |
#include <device/pci.h> |
| 5 |
#include <device/pci_ops.h> |
| 6 |
#include <console/console.h> |
| 7 |
#include <device/cardbus.h> |
| 8 |
#include "pci7420.h" |
| 9 |
#include "chip.h" |
| 10 |
|
| 11 |
static void pci7420_cardbus_init(struct device *dev) |
| 12 |
{ |
| 13 |
u8 reg8; |
| 14 |
u16 reg16; |
| 15 |
u32 reg32; |
| 16 |
|
| 17 |
struct southbridge_ti_pci7420_config *config = dev->chip_info; |
| 18 |
int smartcard_enabled = 0; |
| 19 |
|
| 20 |
printk(BIOS_DEBUG, "TI PCI7420/7620 init\n"); |
| 21 |
|
| 22 |
if (!config) { |
| 23 |
printk(BIOS_DEBUG, "PCI7420: No configuration found.\n"); |
| 24 |
} else { |
| 25 |
smartcard_enabled = config->smartcard_enabled; |
| 26 |
} |
| 27 |
|
| 28 |
reg32 = pci_read_config32(dev, SYSCTL); |
| 29 |
reg32 |= RIMUX; |
| 30 |
pci_write_config32(dev, SYSCTL, reg32); |
| 31 |
|
| 32 |
|
| 33 |
reg8 = pci_read_config8(dev, CARDCTL); |
| 34 |
reg8 |= SPKROUTEN; |
| 35 |
pci_write_config8(dev, CARDCTL, reg8); |
| 36 |
|
| 37 |
|
| 38 |
reg16 = pci_read_config16(dev, GENCTL); |
| 39 |
reg16 |= P12V_SW_SEL; |
| 40 |
if (smartcard_enabled == 0) |
| 41 |
reg16 |= DISABLE_FM; |
| 42 |
pci_write_config16(dev, GENCTL, reg16); |
| 43 |
|
| 44 |
|
| 45 |
pci_write_config32(dev, MFUNC, 0x018a1b22); |
| 46 |
} |
| 47 |
|
| 48 |
static void pci7420_cardbus_read_resources(struct device *dev) |
| 49 |
{ |
| 50 |
cardbus_read_resources(dev); |
| 51 |
} |
| 52 |
|
| 53 |
static void pci7420_cardbus_set_resources(struct device *dev) |
| 54 |
{ |
| 55 |
printk(BIOS_DEBUG, "%s In set resources\n",dev_path(dev)); |
| 56 |
|
| 57 |
pci_dev_set_resources(dev); |
| 58 |
|
| 59 |
printk(BIOS_DEBUG, "%s done set resources\n",dev_path(dev)); |
| 60 |
} |
| 61 |
|
| 62 |
static struct device_operations ti_pci7420_ops = { |
| 63 |
.read_resources = pci7420_cardbus_read_resources, |
| 64 |
.set_resources = pci7420_cardbus_set_resources, |
| 65 |
.enable_resources = cardbus_enable_resources, |
| 66 |
.init = pci7420_cardbus_init, |
| 67 |
.scan_bus = pci_scan_bridge, |
| 68 |
}; |
| 69 |
|
| 70 |
static const struct pci_driver ti_pci7420_driver __pci_driver = { |
| 71 |
.ops = &ti_pci7420_ops, |
| 72 |
.vendor = 0x104c, |
| 73 |
.device = 0xac8e, |
| 74 |
}; |
| 75 |
|
| 76 |
static const struct pci_driver ti_pci7620_driver __pci_driver = { |
| 77 |
.ops = &ti_pci7420_ops, |
| 78 |
.vendor = 0x104c, |
| 79 |
.device = 0xac8d, |
| 80 |
}; |
| 81 |
|
| 82 |
struct chip_operations southbridge_ti_pci7420_ops = { |
| 83 |
.name = "Texas Instruments PCI7420/7620 Cardbus Controller", |
| 84 |
}; |