cs5536 IDE PWB flag was not getting set since it is 1<<14 and it was only doing a
[coreboot.git] / src / southbridge / amd / cs5536 / cs5536_ide.c
1 /*
2  * This file is part of the coreboot project.
3  *
4  * Copyright (C) 2007 Advanced Micro Devices, Inc.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
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 <device/pci_ops.h>
25 #include "cs5536.h"
26
27 #define IDE_CFG   0x40
28         #define CHANEN  (1L <<  1)
29         #define PWB     (1L << 14)
30         #define CABLE   (1L << 16)
31 #define IDE_DTC   0x48
32 #define IDE_CAST  0x4C
33 #define IDE_ETC   0x50
34
35 static void ide_init(struct device *dev)
36 {
37         uint32_t ide_cfg;
38
39         printk_spew("cs5536_ide: %s\n", __FUNCTION__);
40         /* GPIO and IRQ setup are handled in the main chipset code. */
41
42         // Enable the channel and Post Write Buffer
43         // NOTE: Only 32-bit writes to the data buffer are allowed when PWB is set
44         ide_cfg = pci_read_config32(dev, IDE_CFG);
45         ide_cfg |= CHANEN | PWB;
46         pci_write_config32(dev, IDE_CFG, ide_cfg);
47 }
48
49 static void ide_enable(struct device *dev)
50 {
51
52         printk_spew("cs5536_ide: %s\n", __FUNCTION__);
53
54 }
55
56 static struct device_operations ide_ops = {
57         .read_resources = pci_dev_read_resources,
58         .set_resources = pci_dev_set_resources,
59         .enable_resources = pci_dev_enable_resources,
60         .init = ide_init,
61         .enable = 0,
62 };
63
64 static const struct pci_driver ide_driver __pci_driver = {
65         .ops = &ide_ops,
66         .vendor = PCI_VENDOR_ID_AMD,
67         .device = PCI_DEVICE_ID_AMD_CS5536_B0_IDE,
68 };