diff options
Diffstat (limited to 'drivers/ata/pata_rz1000.c')
-rw-r--r-- | drivers/ata/pata_rz1000.c | 49 |
1 files changed, 33 insertions, 16 deletions
diff --git a/drivers/ata/pata_rz1000.c b/drivers/ata/pata_rz1000.c index e4e5ea423fef..3677c642c9f9 100644 --- a/drivers/ata/pata_rz1000.c +++ b/drivers/ata/pata_rz1000.c | |||
@@ -21,7 +21,7 @@ | |||
21 | #include <linux/libata.h> | 21 | #include <linux/libata.h> |
22 | 22 | ||
23 | #define DRV_NAME "pata_rz1000" | 23 | #define DRV_NAME "pata_rz1000" |
24 | #define DRV_VERSION "0.2.2" | 24 | #define DRV_VERSION "0.2.3" |
25 | 25 | ||
26 | 26 | ||
27 | /** | 27 | /** |
@@ -83,7 +83,6 @@ static struct scsi_host_template rz1000_sht = { | |||
83 | .can_queue = ATA_DEF_QUEUE, | 83 | .can_queue = ATA_DEF_QUEUE, |
84 | .this_id = ATA_SHT_THIS_ID, | 84 | .this_id = ATA_SHT_THIS_ID, |
85 | .sg_tablesize = LIBATA_MAX_PRD, | 85 | .sg_tablesize = LIBATA_MAX_PRD, |
86 | .max_sectors = ATA_MAX_SECTORS, | ||
87 | .cmd_per_lun = ATA_SHT_CMD_PER_LUN, | 86 | .cmd_per_lun = ATA_SHT_CMD_PER_LUN, |
88 | .emulated = ATA_SHT_EMULATED, | 87 | .emulated = ATA_SHT_EMULATED, |
89 | .use_clustering = ATA_SHT_USE_CLUSTERING, | 88 | .use_clustering = ATA_SHT_USE_CLUSTERING, |
@@ -92,6 +91,8 @@ static struct scsi_host_template rz1000_sht = { | |||
92 | .slave_configure = ata_scsi_slave_config, | 91 | .slave_configure = ata_scsi_slave_config, |
93 | .slave_destroy = ata_scsi_slave_destroy, | 92 | .slave_destroy = ata_scsi_slave_destroy, |
94 | .bios_param = ata_std_bios_param, | 93 | .bios_param = ata_std_bios_param, |
94 | .resume = ata_scsi_device_resume, | ||
95 | .suspend = ata_scsi_device_suspend, | ||
95 | }; | 96 | }; |
96 | 97 | ||
97 | static struct ata_port_operations rz1000_port_ops = { | 98 | static struct ata_port_operations rz1000_port_ops = { |
@@ -129,6 +130,19 @@ static struct ata_port_operations rz1000_port_ops = { | |||
129 | .host_stop = ata_host_stop | 130 | .host_stop = ata_host_stop |
130 | }; | 131 | }; |
131 | 132 | ||
133 | static int rz1000_fifo_disable(struct pci_dev *pdev) | ||
134 | { | ||
135 | u16 reg; | ||
136 | /* Be exceptionally paranoid as we must be sure to apply the fix */ | ||
137 | if (pci_read_config_word(pdev, 0x40, ®) != 0) | ||
138 | return -1; | ||
139 | reg &= 0xDFFF; | ||
140 | if (pci_write_config_word(pdev, 0x40, reg) != 0) | ||
141 | return -1; | ||
142 | printk(KERN_INFO DRV_NAME ": disabled chipset readahead.\n"); | ||
143 | return 0; | ||
144 | } | ||
145 | |||
132 | /** | 146 | /** |
133 | * rz1000_init_one - Register RZ1000 ATA PCI device with kernel services | 147 | * rz1000_init_one - Register RZ1000 ATA PCI device with kernel services |
134 | * @pdev: PCI device to register | 148 | * @pdev: PCI device to register |
@@ -143,7 +157,6 @@ static int rz1000_init_one (struct pci_dev *pdev, const struct pci_device_id *en | |||
143 | { | 157 | { |
144 | static int printed_version; | 158 | static int printed_version; |
145 | struct ata_port_info *port_info[2]; | 159 | struct ata_port_info *port_info[2]; |
146 | u16 reg; | ||
147 | static struct ata_port_info info = { | 160 | static struct ata_port_info info = { |
148 | .sht = &rz1000_sht, | 161 | .sht = &rz1000_sht, |
149 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 162 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
@@ -154,23 +167,25 @@ static int rz1000_init_one (struct pci_dev *pdev, const struct pci_device_id *en | |||
154 | if (!printed_version++) | 167 | if (!printed_version++) |
155 | printk(KERN_DEBUG DRV_NAME " version " DRV_VERSION "\n"); | 168 | printk(KERN_DEBUG DRV_NAME " version " DRV_VERSION "\n"); |
156 | 169 | ||
157 | /* Be exceptionally paranoid as we must be sure to apply the fix */ | 170 | if (rz1000_fifo_disable(pdev) == 0) { |
158 | if (pci_read_config_word(pdev, 0x40, ®) != 0) | 171 | port_info[0] = &info; |
159 | goto fail; | 172 | port_info[1] = &info; |
160 | reg &= 0xDFFF; | 173 | return ata_pci_init_one(pdev, port_info, 2); |
161 | if (pci_write_config_word(pdev, 0x40, reg) != 0) | 174 | } |
162 | goto fail; | ||
163 | printk(KERN_INFO DRV_NAME ": disabled chipset readahead.\n"); | ||
164 | |||
165 | port_info[0] = &info; | ||
166 | port_info[1] = &info; | ||
167 | return ata_pci_init_one(pdev, port_info, 2); | ||
168 | fail: | ||
169 | printk(KERN_ERR DRV_NAME ": failed to disable read-ahead on chipset..\n"); | 175 | printk(KERN_ERR DRV_NAME ": failed to disable read-ahead on chipset..\n"); |
170 | /* Not safe to use so skip */ | 176 | /* Not safe to use so skip */ |
171 | return -ENODEV; | 177 | return -ENODEV; |
172 | } | 178 | } |
173 | 179 | ||
180 | static int rz1000_reinit_one(struct pci_dev *pdev) | ||
181 | { | ||
182 | /* If this fails on resume (which is a "cant happen" case), we | ||
183 | must stop as any progress risks data loss */ | ||
184 | if (rz1000_fifo_disable(pdev)) | ||
185 | panic("rz1000 fifo"); | ||
186 | return ata_pci_device_resume(pdev); | ||
187 | } | ||
188 | |||
174 | static const struct pci_device_id pata_rz1000[] = { | 189 | static const struct pci_device_id pata_rz1000[] = { |
175 | { PCI_VDEVICE(PCTECH, PCI_DEVICE_ID_PCTECH_RZ1000), }, | 190 | { PCI_VDEVICE(PCTECH, PCI_DEVICE_ID_PCTECH_RZ1000), }, |
176 | { PCI_VDEVICE(PCTECH, PCI_DEVICE_ID_PCTECH_RZ1001), }, | 191 | { PCI_VDEVICE(PCTECH, PCI_DEVICE_ID_PCTECH_RZ1001), }, |
@@ -182,7 +197,9 @@ static struct pci_driver rz1000_pci_driver = { | |||
182 | .name = DRV_NAME, | 197 | .name = DRV_NAME, |
183 | .id_table = pata_rz1000, | 198 | .id_table = pata_rz1000, |
184 | .probe = rz1000_init_one, | 199 | .probe = rz1000_init_one, |
185 | .remove = ata_pci_remove_one | 200 | .remove = ata_pci_remove_one, |
201 | .suspend = ata_pci_device_suspend, | ||
202 | .resume = rz1000_reinit_one, | ||
186 | }; | 203 | }; |
187 | 204 | ||
188 | static int __init rz1000_init(void) | 205 | static int __init rz1000_init(void) |