blob: 6ef08a3067436292f6c4448fa79a84188695adf9 [file] [log] [blame]
Patrick Georgiac959032020-05-05 22:49:26 +02001/* SPDX-License-Identifier: GPL-2.0-or-later */
Stefan Reinauer2e73e192010-01-17 13:52:50 +00002
Stefan Reinauer2e73e192010-01-17 13:52:50 +00003#include <device/device.h>
4#include <device/pci.h>
5#include <device/pci_ops.h>
Stefan Reinauer2e73e192010-01-17 13:52:50 +00006#include <console/console.h>
7#include <device/cardbus.h>
8#include "pci7420.h"
9#include "chip.h"
10
Elyes HAOUASa3970892018-05-19 10:39:20 +020011static void pci7420_cardbus_init(struct device *dev)
Stefan Reinauer2e73e192010-01-17 13:52:50 +000012{
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
Stefan Reinauerc02b4fc2010-03-22 11:42:32 +000020 printk(BIOS_DEBUG, "TI PCI7420/7620 init\n");
Stefan Reinauer2e73e192010-01-17 13:52:50 +000021
22 if (!config) {
Stefan Reinauerc02b4fc2010-03-22 11:42:32 +000023 printk(BIOS_DEBUG, "PCI7420: No configuration found.\n");
Stefan Reinauer2e73e192010-01-17 13:52:50 +000024 } 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 /* Enable SPKROUT */
33 reg8 = pci_read_config8(dev, CARDCTL);
34 reg8 |= SPKROUTEN;
35 pci_write_config8(dev, CARDCTL, reg8);
36
37 /* Power switch select and FM disable */
38 reg16 = pci_read_config16(dev, GENCTL);
39 reg16 |= P12V_SW_SEL; // 12V capable power switch
40 if (smartcard_enabled == 0)
41 reg16 |= DISABLE_FM;
42 pci_write_config16(dev, GENCTL, reg16);
43
44 /* Multifunction routing status */
45 pci_write_config32(dev, MFUNC, 0x018a1b22);
Stefan Reinauer2e73e192010-01-17 13:52:50 +000046}
47
Elyes HAOUASa3970892018-05-19 10:39:20 +020048static void pci7420_cardbus_read_resources(struct device *dev)
Stefan Reinauer2e73e192010-01-17 13:52:50 +000049{
50 cardbus_read_resources(dev);
51}
52
Elyes HAOUASa3970892018-05-19 10:39:20 +020053static void pci7420_cardbus_set_resources(struct device *dev)
Stefan Reinauer2e73e192010-01-17 13:52:50 +000054{
Paul Menzeld0cdcae2014-08-08 15:24:31 +020055 printk(BIOS_DEBUG, "%s In set resources\n",dev_path(dev));
Stefan Reinauer2e73e192010-01-17 13:52:50 +000056
57 pci_dev_set_resources(dev);
58
Paul Menzeld0cdcae2014-08-08 15:24:31 +020059 printk(BIOS_DEBUG, "%s done set resources\n",dev_path(dev));
Stefan Reinauer2e73e192010-01-17 13:52:50 +000060}
61
62static 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,
Myles Watson84e8e452010-06-07 17:12:57 +000067 .scan_bus = pci_scan_bridge,
Stefan Reinauer2e73e192010-01-17 13:52:50 +000068};
69
70static const struct pci_driver ti_pci7420_driver __pci_driver = {
71 .ops = &ti_pci7420_ops,
72 .vendor = 0x104c,
73 .device = 0xac8e,
74};
75
76static const struct pci_driver ti_pci7620_driver __pci_driver = {
77 .ops = &ti_pci7420_ops,
78 .vendor = 0x104c,
79 .device = 0xac8d,
80};
81
Stefan Reinauer2e73e192010-01-17 13:52:50 +000082struct chip_operations southbridge_ti_pci7420_ops = {
83 CHIP_NAME("Texas Instruments PCI7420/7620 Cardbus Controller")
Stefan Reinauer2e73e192010-01-17 13:52:50 +000084};