aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/pata_sc1200.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ata/pata_sc1200.c')
-rw-r--r--drivers/ata/pata_sc1200.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/drivers/ata/pata_sc1200.c b/drivers/ata/pata_sc1200.c
index 9b42b9a5242..4166c1a8a9e 100644
--- a/drivers/ata/pata_sc1200.c
+++ b/drivers/ata/pata_sc1200.c
@@ -27,7 +27,7 @@
27 * You should have received a copy of the GNU General Public License 27 * You should have received a copy of the GNU General Public License
28 * along with this program; if not, write to the Free Software 28 * along with this program; if not, write to the Free Software
29 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 29 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30 * 30 *
31 */ 31 */
32 32
33#include <linux/kernel.h> 33#include <linux/kernel.h>
@@ -54,14 +54,14 @@
54 * Return the PCI bus clocking for the SC1200 chipset configuration 54 * Return the PCI bus clocking for the SC1200 chipset configuration
55 * in use. We return 0 for 33MHz 1 for 48MHz and 2 for 66Mhz 55 * in use. We return 0 for 33MHz 1 for 48MHz and 2 for 66Mhz
56 */ 56 */
57 57
58static int sc1200_clock(void) 58static int sc1200_clock(void)
59{ 59{
60 /* Magic registers that give us the chipset data */ 60 /* Magic registers that give us the chipset data */
61 u8 chip_id = inb(0x903C); 61 u8 chip_id = inb(0x903C);
62 u8 silicon_rev = inb(0x903D); 62 u8 silicon_rev = inb(0x903D);
63 u16 pci_clock; 63 u16 pci_clock;
64 64
65 if (chip_id == 0x04 && silicon_rev < SC1200_REV_B1) 65 if (chip_id == 0x04 && silicon_rev < SC1200_REV_B1)
66 return 0; /* 33 MHz mode */ 66 return 0; /* 33 MHz mode */
67 67
@@ -83,7 +83,7 @@ static int sc1200_clock(void)
83 * 83 *
84 * Set our PIO requirements. This is fairly simple on the SC1200 84 * Set our PIO requirements. This is fairly simple on the SC1200
85 */ 85 */
86 86
87static void sc1200_set_piomode(struct ata_port *ap, struct ata_device *adev) 87static void sc1200_set_piomode(struct ata_port *ap, struct ata_device *adev)
88{ 88{
89 static const u32 pio_timings[4][5] = { 89 static const u32 pio_timings[4][5] = {
@@ -97,11 +97,11 @@ static void sc1200_set_piomode(struct ata_port *ap, struct ata_device *adev)
97 u32 format; 97 u32 format;
98 unsigned int reg = 0x40 + 0x10 * ap->port_no; 98 unsigned int reg = 0x40 + 0x10 * ap->port_no;
99 int mode = adev->pio_mode - XFER_PIO_0; 99 int mode = adev->pio_mode - XFER_PIO_0;
100 100
101 pci_read_config_dword(pdev, reg + 4, &format); 101 pci_read_config_dword(pdev, reg + 4, &format);
102 format >>= 31; 102 format >>= 31;
103 format += sc1200_clock(); 103 format += sc1200_clock();
104 pci_write_config_dword(pdev, reg + 8 * adev->devno, 104 pci_write_config_dword(pdev, reg + 8 * adev->devno,
105 pio_timings[format][mode]); 105 pio_timings[format][mode]);
106} 106}
107 107
@@ -113,7 +113,7 @@ static void sc1200_set_piomode(struct ata_port *ap, struct ata_device *adev)
113 * We cannot mix MWDMA and UDMA without reloading timings each switch 113 * We cannot mix MWDMA and UDMA without reloading timings each switch
114 * master to slave. 114 * master to slave.
115 */ 115 */
116 116
117static void sc1200_set_dmamode(struct ata_port *ap, struct ata_device *adev) 117static void sc1200_set_dmamode(struct ata_port *ap, struct ata_device *adev)
118{ 118{
119 static const u32 udma_timing[3][3] = { 119 static const u32 udma_timing[3][3] = {
@@ -121,13 +121,13 @@ static void sc1200_set_dmamode(struct ata_port *ap, struct ata_device *adev)
121 { 0x00932470, 0x00922260, 0x00922140 }, 121 { 0x00932470, 0x00922260, 0x00922140 },
122 { 0x009436A1, 0x00933481, 0x00923261 } 122 { 0x009436A1, 0x00933481, 0x00923261 }
123 }; 123 };
124 124
125 static const u32 mwdma_timing[3][3] = { 125 static const u32 mwdma_timing[3][3] = {
126 { 0x00077771, 0x00012121, 0x00002020 }, 126 { 0x00077771, 0x00012121, 0x00002020 },
127 { 0x000BBBB2, 0x00024241, 0x00013131 }, 127 { 0x000BBBB2, 0x00024241, 0x00013131 },
128 { 0x000FFFF3, 0x00035352, 0x00015151 } 128 { 0x000FFFF3, 0x00035352, 0x00015151 }
129 }; 129 };
130 130
131 int clock = sc1200_clock(); 131 int clock = sc1200_clock();
132 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 132 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
133 unsigned int reg = 0x40 + 0x10 * ap->port_no; 133 unsigned int reg = 0x40 + 0x10 * ap->port_no;
@@ -138,10 +138,10 @@ static void sc1200_set_dmamode(struct ata_port *ap, struct ata_device *adev)
138 format = udma_timing[clock][mode - XFER_UDMA_0]; 138 format = udma_timing[clock][mode - XFER_UDMA_0];
139 else 139 else
140 format = mwdma_timing[clock][mode - XFER_MW_DMA_0]; 140 format = mwdma_timing[clock][mode - XFER_MW_DMA_0];
141 141
142 if (adev->devno == 0) { 142 if (adev->devno == 0) {
143 u32 timings; 143 u32 timings;
144 144
145 pci_read_config_dword(pdev, reg + 4, &timings); 145 pci_read_config_dword(pdev, reg + 4, &timings);
146 timings &= 0x80000000UL; 146 timings &= 0x80000000UL;
147 timings |= format; 147 timings |= format;
@@ -201,7 +201,7 @@ static struct ata_port_operations sc1200_port_ops = {
201 .set_piomode = sc1200_set_piomode, 201 .set_piomode = sc1200_set_piomode,
202 .set_dmamode = sc1200_set_dmamode, 202 .set_dmamode = sc1200_set_dmamode,
203 .mode_filter = ata_pci_default_filter, 203 .mode_filter = ata_pci_default_filter,
204 204
205 .tf_load = ata_tf_load, 205 .tf_load = ata_tf_load,
206 .tf_read = ata_tf_read, 206 .tf_read = ata_tf_read,
207 .check_status = ata_check_status, 207 .check_status = ata_check_status,
@@ -226,7 +226,7 @@ static struct ata_port_operations sc1200_port_ops = {
226 .port_start = ata_port_start, 226 .port_start = ata_port_start,
227 .port_stop = ata_port_stop, 227 .port_stop = ata_port_stop,
228 .host_stop = ata_host_stop 228 .host_stop = ata_host_stop
229}; 229};
230 230
231/** 231/**
232 * sc1200_init_one - Initialise an SC1200 232 * sc1200_init_one - Initialise an SC1200
@@ -236,7 +236,7 @@ static struct ata_port_operations sc1200_port_ops = {
236 * Just throw the needed data at the libata helper and it does all 236 * Just throw the needed data at the libata helper and it does all
237 * our work. 237 * our work.
238 */ 238 */
239 239
240static int sc1200_init_one(struct pci_dev *dev, const struct pci_device_id *id) 240static int sc1200_init_one(struct pci_dev *dev, const struct pci_device_id *id)
241{ 241{
242 static struct ata_port_info info = { 242 static struct ata_port_info info = {
@@ -248,7 +248,7 @@ static int sc1200_init_one(struct pci_dev *dev, const struct pci_device_id *id)
248 .port_ops = &sc1200_port_ops 248 .port_ops = &sc1200_port_ops
249 }; 249 };
250 static struct ata_port_info *port_info[2] = { &info, &info }; 250 static struct ata_port_info *port_info[2] = { &info, &info };
251 251
252 /* Can't enable port 2 yet, see top comments */ 252 /* Can't enable port 2 yet, see top comments */
253 return ata_pci_init_one(dev, port_info, 1); 253 return ata_pci_init_one(dev, port_info, 1);
254} 254}