aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/pata_hpt3x3.c
diff options
context:
space:
mode:
authorAlan <alan@lxorguk.ukuu.org.uk>2006-11-27 11:25:51 -0500
committerJeff Garzik <jeff@garzik.org>2006-12-01 22:47:03 -0500
commitaff0df0593f4beea42800115c0658f58c03dfe9f (patch)
treec33bcde2275cfe4e93088744c98065d1a188fcde /drivers/ata/pata_hpt3x3.c
parent62d64ae0ec76360736c9dc4ca2067ae8de0ba9f2 (diff)
[PATCH] pata_hpt3x3: suspend/resume support
Again split the chipset init away and call it both on resume and on setup Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/pata_hpt3x3.c')
-rw-r--r--drivers/ata/pata_hpt3x3.c46
1 files changed, 34 insertions, 12 deletions
diff --git a/drivers/ata/pata_hpt3x3.c b/drivers/ata/pata_hpt3x3.c
index d216cc564b5..e9fb029f28b 100644
--- a/drivers/ata/pata_hpt3x3.c
+++ b/drivers/ata/pata_hpt3x3.c
@@ -23,7 +23,7 @@
23#include <linux/libata.h> 23#include <linux/libata.h>
24 24
25#define DRV_NAME "pata_hpt3x3" 25#define DRV_NAME "pata_hpt3x3"
26#define DRV_VERSION "0.4.1" 26#define DRV_VERSION "0.4.2"
27 27
28static int hpt3x3_probe_init(struct ata_port *ap) 28static int hpt3x3_probe_init(struct ata_port *ap)
29{ 29{
@@ -120,6 +120,8 @@ static struct scsi_host_template hpt3x3_sht = {
120 .slave_configure = ata_scsi_slave_config, 120 .slave_configure = ata_scsi_slave_config,
121 .slave_destroy = ata_scsi_slave_destroy, 121 .slave_destroy = ata_scsi_slave_destroy,
122 .bios_param = ata_std_bios_param, 122 .bios_param = ata_std_bios_param,
123 .resume = ata_scsi_device_resume,
124 .suspend = ata_scsi_device_suspend,
123}; 125};
124 126
125static struct ata_port_operations hpt3x3_port_ops = { 127static struct ata_port_operations hpt3x3_port_ops = {
@@ -158,6 +160,27 @@ static struct ata_port_operations hpt3x3_port_ops = {
158}; 160};
159 161
160/** 162/**
163 * hpt3x3_init_chipset - chip setup
164 * @dev: PCI device
165 *
166 * Perform the setup required at boot and on resume.
167 */
168
169static void hpt3x3_init_chipset(struct pci_dev *dev)
170{
171 u16 cmd;
172 /* Initialize the board */
173 pci_write_config_word(dev, 0x80, 0x00);
174 /* Check if it is a 343 or a 363. 363 has COMMAND_MEMORY set */
175 pci_read_config_word(dev, PCI_COMMAND, &cmd);
176 if (cmd & PCI_COMMAND_MEMORY)
177 pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0xF0);
178 else
179 pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0x20);
180}
181
182
183/**
161 * hpt3x3_init_one - Initialise an HPT343/363 184 * hpt3x3_init_one - Initialise an HPT343/363
162 * @dev: PCI device 185 * @dev: PCI device
163 * @id: Entry in match table 186 * @id: Entry in match table
@@ -178,21 +201,18 @@ static int hpt3x3_init_one(struct pci_dev *dev, const struct pci_device_id *id)
178 .port_ops = &hpt3x3_port_ops 201 .port_ops = &hpt3x3_port_ops
179 }; 202 };
180 static struct ata_port_info *port_info[2] = { &info, &info }; 203 static struct ata_port_info *port_info[2] = { &info, &info };
181 u16 cmd;
182
183 /* Initialize the board */
184 pci_write_config_word(dev, 0x80, 0x00);
185 /* Check if it is a 343 or a 363. 363 has COMMAND_MEMORY set */
186 pci_read_config_word(dev, PCI_COMMAND, &cmd);
187 if (cmd & PCI_COMMAND_MEMORY)
188 pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0xF0);
189 else
190 pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0x20);
191 204
205 hpt3x3_init_chipset(dev);
192 /* Now kick off ATA set up */ 206 /* Now kick off ATA set up */
193 return ata_pci_init_one(dev, port_info, 2); 207 return ata_pci_init_one(dev, port_info, 2);
194} 208}
195 209
210static int hpt3x3_reinit_one(struct pci_dev *dev)
211{
212 hpt3x3_init_chipset(dev);
213 return ata_pci_device_resume(dev);
214}
215
196static const struct pci_device_id hpt3x3[] = { 216static const struct pci_device_id hpt3x3[] = {
197 { PCI_VDEVICE(TTI, PCI_DEVICE_ID_TTI_HPT343), }, 217 { PCI_VDEVICE(TTI, PCI_DEVICE_ID_TTI_HPT343), },
198 218
@@ -203,7 +223,9 @@ static struct pci_driver hpt3x3_pci_driver = {
203 .name = DRV_NAME, 223 .name = DRV_NAME,
204 .id_table = hpt3x3, 224 .id_table = hpt3x3,
205 .probe = hpt3x3_init_one, 225 .probe = hpt3x3_init_one,
206 .remove = ata_pci_remove_one 226 .remove = ata_pci_remove_one,
227 .suspend = ata_pci_device_suspend,
228 .resume = hpt3x3_reinit_one,
207}; 229};
208 230
209static int __init hpt3x3_init(void) 231static int __init hpt3x3_init(void)