Remove address from GPLv2 headers
[coreboot.git] / src / mainboard / roda / rk9 / ti_pci7xx1.c
blobc48090d845e4170d80592d55cb03974cc088b45e
1 /*
2 * This file is part of the coreboot project.
4 * Copyright (C) 2012 secunet Security Networks AG
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; version 2 of
9 * the License.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc.
21 #include <stdint.h>
22 #include <console/console.h>
23 #include <device/device.h>
24 #include <device/pci.h>
25 #include <device/cardbus.h>
27 static void pci7xx1_enable(struct device *const dev)
29 printk(BIOS_DEBUG, "%s: TI PCI7xx1 media controller\n", __func__);
30 if (PCI_FUNC(dev->path.pci.devfn) == 0) {
31 const uint16_t secondary = dev->bus->secondary;
32 const unsigned slot = PCI_SLOT(dev->path.pci.devfn);
34 int fn;
36 /* Hide functions based on devicetree info. */
37 u16 gcr = pci_read_config16(dev, 0x86);
38 for (fn = 5; fn > 0; --fn) {
39 const struct device *const d =
40 dev_find_slot(secondary, PCI_DEVFN(slot, fn));
41 if (!d || d->enabled) continue;
42 printk(BIOS_DEBUG,
43 "%s: Hiding function #%d.\n", __func__, fn);
44 switch (fn) {
45 case 1: gcr |= 1 << 4; break; /* CardBus B */
46 case 2: gcr |= 1 << 3; break; /* OHCI 1394 */
47 case 3: gcr |= 1 << 5; break; /* Flash media */
48 case 4: gcr |= 1 << 6; break; /* SD card */
49 case 5: gcr |= 1 << 7; break; /* Smart Card */
52 pci_write_config16(dev, 0x86, gcr);
56 static struct device_operations device_ops = {
57 .read_resources = cardbus_read_resources,
58 .set_resources = pci_dev_set_resources,
59 .enable_resources = cardbus_enable_resources,
60 .init = 0,
61 .scan_bus = pci_scan_bridge,
62 .enable = pci7xx1_enable,
63 .reset_bus = pci_bus_reset,
66 static const struct pci_driver ti_pci7xx1 __pci_driver = {
67 .ops = &device_ops,
68 .vendor = 0x104c,
69 .device = 0x8031,