Fix a few whitespace and coding style issues.
[coreboot.git] / src / southbridge / intel / sch / mmc.c
1 /*
2  * This file is part of the coreboot project.
3  *
4  * Copyright (C) 2009-2010 iWave Systems
5  *
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 the License.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
18  */
19
20 #include <console/console.h>
21 #include <device/device.h>
22 #include <device/pci.h>
23 #include <device/pci_ids.h>
24 #include <arch/io.h>
25
26 static void sch_mmc_init(struct device *dev)
27 {
28         u32 reg32;
29
30         printk(BIOS_DEBUG, "MMC: Setting up controller.. ");
31         reg32 = pci_read_config32(dev, PCI_COMMAND);
32         reg32 |= PCI_COMMAND_MASTER;
33         reg32 |= PCI_COMMAND_MEMORY;
34         pci_write_config32(dev, PCI_COMMAND, reg32);
35         printk(BIOS_DEBUG, "done.\n");
36 }
37
38 static void sch_mmc_set_subsystem(device_t dev, unsigned vendor,
39                                   unsigned device)
40 {
41         if (!vendor || !device) {
42                 pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID,
43                                 pci_read_config32(dev, PCI_VENDOR_ID));
44         } else {
45                 pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID,
46                                 ((device & 0xffff) << 16) | (vendor & 0xffff));
47         }
48 }
49
50 static struct pci_operations lops_pci = {
51         .set_subsystem = &sch_mmc_set_subsystem,
52 };
53
54 static struct device_operations sch_mmc_ops = {
55         .read_resources         = pci_dev_read_resources,
56         .set_resources          = pci_dev_set_resources,
57         .enable_resources       = pci_dev_enable_resources,
58         .init                   = sch_mmc_init,
59         .scan_bus               = 0,
60         .ops_pci                = &lops_pci,
61 };
62
63 static const struct pci_driver sch_mmc1 __pci_driver = {
64         .ops    = &sch_mmc_ops,
65         .vendor = PCI_VENDOR_ID_INTEL,
66         .device = 0x811C,
67 };
68
69 static const struct pci_driver sch_mmc2 __pci_driver = {
70         .ops    = &sch_mmc_ops,
71         .vendor = PCI_VENDOR_ID_INTEL,
72         .device = 0x811D,
73 };
74
75 static const struct pci_driver sch_mmc3 __pci_driver = {
76         .ops    = &sch_mmc_ops,
77         .vendor = PCI_VENDOR_ID_INTEL,
78         .device = 0x811E,
79
80 };