diff options
author | Jeff Garzik <jgarzik@pobox.com> | 2005-11-18 11:44:17 -0500 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-11-18 11:44:17 -0500 |
commit | f333b3f111e9db76109e304df8ee777ace7fbf86 (patch) | |
tree | ce9a74a7327020c48c80d278e1db5f12552f0fb0 /drivers/scsi/sata_mv.c | |
parent | f4256e301d9800b1e0276404cb01b3ac85b51067 (diff) | |
parent | 79bfb0a98fdc73ed6a18469cef245cbf50a1d8bb (diff) |
Merge branch 'upstream'
Diffstat (limited to 'drivers/scsi/sata_mv.c')
-rw-r--r-- | drivers/scsi/sata_mv.c | 991 |
1 files changed, 822 insertions, 169 deletions
diff --git a/drivers/scsi/sata_mv.c b/drivers/scsi/sata_mv.c index 088630a890ed..9687646d73e1 100644 --- a/drivers/scsi/sata_mv.c +++ b/drivers/scsi/sata_mv.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * sata_mv.c - Marvell SATA support | 2 | * sata_mv.c - Marvell SATA support |
3 | * | 3 | * |
4 | * Copyright 2005: EMC Corporation, all rights reserved. | 4 | * Copyright 2005: EMC Corporation, all rights reserved. |
5 | * | 5 | * |
6 | * Please ALWAYS copy linux-ide@vger.kernel.org on emails. | 6 | * Please ALWAYS copy linux-ide@vger.kernel.org on emails. |
7 | * | 7 | * |
@@ -50,6 +50,9 @@ enum { | |||
50 | MV_PCI_REG_BASE = 0, | 50 | MV_PCI_REG_BASE = 0, |
51 | MV_IRQ_COAL_REG_BASE = 0x18000, /* 6xxx part only */ | 51 | MV_IRQ_COAL_REG_BASE = 0x18000, /* 6xxx part only */ |
52 | MV_SATAHC0_REG_BASE = 0x20000, | 52 | MV_SATAHC0_REG_BASE = 0x20000, |
53 | MV_FLASH_CTL = 0x1046c, | ||
54 | MV_GPIO_PORT_CTL = 0x104f0, | ||
55 | MV_RESET_CFG = 0x180d8, | ||
53 | 56 | ||
54 | MV_PCI_REG_SZ = MV_MAJOR_REG_AREA_SZ, | 57 | MV_PCI_REG_SZ = MV_MAJOR_REG_AREA_SZ, |
55 | MV_SATAHC_REG_SZ = MV_MAJOR_REG_AREA_SZ, | 58 | MV_SATAHC_REG_SZ = MV_MAJOR_REG_AREA_SZ, |
@@ -72,11 +75,6 @@ enum { | |||
72 | MV_SG_TBL_SZ = (16 * MV_MAX_SG_CT), | 75 | MV_SG_TBL_SZ = (16 * MV_MAX_SG_CT), |
73 | MV_PORT_PRIV_DMA_SZ = (MV_CRQB_Q_SZ + MV_CRPB_Q_SZ + MV_SG_TBL_SZ), | 76 | MV_PORT_PRIV_DMA_SZ = (MV_CRQB_Q_SZ + MV_CRPB_Q_SZ + MV_SG_TBL_SZ), |
74 | 77 | ||
75 | /* Our DMA boundary is determined by an ePRD being unable to handle | ||
76 | * anything larger than 64KB | ||
77 | */ | ||
78 | MV_DMA_BOUNDARY = 0xffffU, | ||
79 | |||
80 | MV_PORTS_PER_HC = 4, | 78 | MV_PORTS_PER_HC = 4, |
81 | /* == (port / MV_PORTS_PER_HC) to determine HC from 0-7 port */ | 79 | /* == (port / MV_PORTS_PER_HC) to determine HC from 0-7 port */ |
82 | MV_PORT_HC_SHIFT = 2, | 80 | MV_PORT_HC_SHIFT = 2, |
@@ -86,17 +84,10 @@ enum { | |||
86 | /* Host Flags */ | 84 | /* Host Flags */ |
87 | MV_FLAG_DUAL_HC = (1 << 30), /* two SATA Host Controllers */ | 85 | MV_FLAG_DUAL_HC = (1 << 30), /* two SATA Host Controllers */ |
88 | MV_FLAG_IRQ_COALESCE = (1 << 29), /* IRQ coalescing capability */ | 86 | MV_FLAG_IRQ_COALESCE = (1 << 29), /* IRQ coalescing capability */ |
89 | MV_FLAG_GLBL_SFT_RST = (1 << 28), /* Global Soft Reset support */ | ||
90 | MV_COMMON_FLAGS = (ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | | 87 | MV_COMMON_FLAGS = (ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | |
91 | ATA_FLAG_SATA_RESET | ATA_FLAG_MMIO | | 88 | ATA_FLAG_SATA_RESET | ATA_FLAG_MMIO | |
92 | ATA_FLAG_PIO_POLLING), | 89 | ATA_FLAG_PIO_POLLING), |
93 | MV_6XXX_FLAGS = (MV_FLAG_IRQ_COALESCE | | 90 | MV_6XXX_FLAGS = MV_FLAG_IRQ_COALESCE, |
94 | MV_FLAG_GLBL_SFT_RST), | ||
95 | |||
96 | chip_504x = 0, | ||
97 | chip_508x = 1, | ||
98 | chip_604x = 2, | ||
99 | chip_608x = 3, | ||
100 | 91 | ||
101 | CRQB_FLAG_READ = (1 << 0), | 92 | CRQB_FLAG_READ = (1 << 0), |
102 | CRQB_TAG_SHIFT = 1, | 93 | CRQB_TAG_SHIFT = 1, |
@@ -117,8 +108,19 @@ enum { | |||
117 | PCI_MASTER_EMPTY = (1 << 3), | 108 | PCI_MASTER_EMPTY = (1 << 3), |
118 | GLOB_SFT_RST = (1 << 4), | 109 | GLOB_SFT_RST = (1 << 4), |
119 | 110 | ||
120 | PCI_IRQ_CAUSE_OFS = 0x1d58, | 111 | MV_PCI_MODE = 0xd00, |
121 | PCI_IRQ_MASK_OFS = 0x1d5c, | 112 | MV_PCI_EXP_ROM_BAR_CTL = 0xd2c, |
113 | MV_PCI_DISC_TIMER = 0xd04, | ||
114 | MV_PCI_MSI_TRIGGER = 0xc38, | ||
115 | MV_PCI_SERR_MASK = 0xc28, | ||
116 | MV_PCI_XBAR_TMOUT = 0x1d04, | ||
117 | MV_PCI_ERR_LOW_ADDRESS = 0x1d40, | ||
118 | MV_PCI_ERR_HIGH_ADDRESS = 0x1d44, | ||
119 | MV_PCI_ERR_ATTRIBUTE = 0x1d48, | ||
120 | MV_PCI_ERR_COMMAND = 0x1d50, | ||
121 | |||
122 | PCI_IRQ_CAUSE_OFS = 0x1d58, | ||
123 | PCI_IRQ_MASK_OFS = 0x1d5c, | ||
122 | PCI_UNMASK_ALL_IRQS = 0x7fffff, /* bits 22-0 */ | 124 | PCI_UNMASK_ALL_IRQS = 0x7fffff, /* bits 22-0 */ |
123 | 125 | ||
124 | HC_MAIN_IRQ_CAUSE_OFS = 0x1d60, | 126 | HC_MAIN_IRQ_CAUSE_OFS = 0x1d60, |
@@ -135,7 +137,7 @@ enum { | |||
135 | SELF_INT = (1 << 23), | 137 | SELF_INT = (1 << 23), |
136 | TWSI_INT = (1 << 24), | 138 | TWSI_INT = (1 << 24), |
137 | HC_MAIN_RSVD = (0x7f << 25), /* bits 31-25 */ | 139 | HC_MAIN_RSVD = (0x7f << 25), /* bits 31-25 */ |
138 | HC_MAIN_MASKED_IRQS = (TRAN_LO_DONE | TRAN_HI_DONE | | 140 | HC_MAIN_MASKED_IRQS = (TRAN_LO_DONE | TRAN_HI_DONE | |
139 | PORTS_0_7_COAL_DONE | GPIO_INT | TWSI_INT | | 141 | PORTS_0_7_COAL_DONE | GPIO_INT | TWSI_INT | |
140 | HC_MAIN_RSVD), | 142 | HC_MAIN_RSVD), |
141 | 143 | ||
@@ -154,6 +156,15 @@ enum { | |||
154 | /* SATA registers */ | 156 | /* SATA registers */ |
155 | SATA_STATUS_OFS = 0x300, /* ctrl, err regs follow status */ | 157 | SATA_STATUS_OFS = 0x300, /* ctrl, err regs follow status */ |
156 | SATA_ACTIVE_OFS = 0x350, | 158 | SATA_ACTIVE_OFS = 0x350, |
159 | PHY_MODE3 = 0x310, | ||
160 | PHY_MODE4 = 0x314, | ||
161 | PHY_MODE2 = 0x330, | ||
162 | MV5_PHY_MODE = 0x74, | ||
163 | MV5_LT_MODE = 0x30, | ||
164 | MV5_PHY_CTL = 0x0C, | ||
165 | SATA_INTERFACE_CTL = 0x050, | ||
166 | |||
167 | MV_M2_PREAMP_MASK = 0x7e0, | ||
157 | 168 | ||
158 | /* Port registers */ | 169 | /* Port registers */ |
159 | EDMA_CFG_OFS = 0, | 170 | EDMA_CFG_OFS = 0, |
@@ -183,17 +194,16 @@ enum { | |||
183 | EDMA_ERR_LNK_CTRL_TX = (0x1f << 21), | 194 | EDMA_ERR_LNK_CTRL_TX = (0x1f << 21), |
184 | EDMA_ERR_LNK_DATA_TX = (0x1f << 26), | 195 | EDMA_ERR_LNK_DATA_TX = (0x1f << 26), |
185 | EDMA_ERR_TRANS_PROTO = (1 << 31), | 196 | EDMA_ERR_TRANS_PROTO = (1 << 31), |
186 | EDMA_ERR_FATAL = (EDMA_ERR_D_PAR | EDMA_ERR_PRD_PAR | | 197 | EDMA_ERR_FATAL = (EDMA_ERR_D_PAR | EDMA_ERR_PRD_PAR | |
187 | EDMA_ERR_DEV_DCON | EDMA_ERR_CRBQ_PAR | | 198 | EDMA_ERR_DEV_DCON | EDMA_ERR_CRBQ_PAR | |
188 | EDMA_ERR_CRPB_PAR | EDMA_ERR_INTRL_PAR | | 199 | EDMA_ERR_CRPB_PAR | EDMA_ERR_INTRL_PAR | |
189 | EDMA_ERR_IORDY | EDMA_ERR_LNK_CTRL_RX_2 | | 200 | EDMA_ERR_IORDY | EDMA_ERR_LNK_CTRL_RX_2 | |
190 | EDMA_ERR_LNK_DATA_RX | | 201 | EDMA_ERR_LNK_DATA_RX | |
191 | EDMA_ERR_LNK_DATA_TX | | 202 | EDMA_ERR_LNK_DATA_TX | |
192 | EDMA_ERR_TRANS_PROTO), | 203 | EDMA_ERR_TRANS_PROTO), |
193 | 204 | ||
194 | EDMA_REQ_Q_BASE_HI_OFS = 0x10, | 205 | EDMA_REQ_Q_BASE_HI_OFS = 0x10, |
195 | EDMA_REQ_Q_IN_PTR_OFS = 0x14, /* also contains BASE_LO */ | 206 | EDMA_REQ_Q_IN_PTR_OFS = 0x14, /* also contains BASE_LO */ |
196 | EDMA_REQ_Q_BASE_LO_MASK = 0xfffffc00U, | ||
197 | 207 | ||
198 | EDMA_REQ_Q_OUT_PTR_OFS = 0x18, | 208 | EDMA_REQ_Q_OUT_PTR_OFS = 0x18, |
199 | EDMA_REQ_Q_PTR_SHIFT = 5, | 209 | EDMA_REQ_Q_PTR_SHIFT = 5, |
@@ -201,7 +211,6 @@ enum { | |||
201 | EDMA_RSP_Q_BASE_HI_OFS = 0x1c, | 211 | EDMA_RSP_Q_BASE_HI_OFS = 0x1c, |
202 | EDMA_RSP_Q_IN_PTR_OFS = 0x20, | 212 | EDMA_RSP_Q_IN_PTR_OFS = 0x20, |
203 | EDMA_RSP_Q_OUT_PTR_OFS = 0x24, /* also contains BASE_LO */ | 213 | EDMA_RSP_Q_OUT_PTR_OFS = 0x24, /* also contains BASE_LO */ |
204 | EDMA_RSP_Q_BASE_LO_MASK = 0xffffff00U, | ||
205 | EDMA_RSP_Q_PTR_SHIFT = 3, | 214 | EDMA_RSP_Q_PTR_SHIFT = 3, |
206 | 215 | ||
207 | EDMA_CMD_OFS = 0x28, | 216 | EDMA_CMD_OFS = 0x28, |
@@ -209,14 +218,44 @@ enum { | |||
209 | EDMA_DS = (1 << 1), | 218 | EDMA_DS = (1 << 1), |
210 | ATA_RST = (1 << 2), | 219 | ATA_RST = (1 << 2), |
211 | 220 | ||
221 | EDMA_IORDY_TMOUT = 0x34, | ||
222 | EDMA_ARB_CFG = 0x38, | ||
223 | |||
212 | /* Host private flags (hp_flags) */ | 224 | /* Host private flags (hp_flags) */ |
213 | MV_HP_FLAG_MSI = (1 << 0), | 225 | MV_HP_FLAG_MSI = (1 << 0), |
226 | MV_HP_ERRATA_50XXB0 = (1 << 1), | ||
227 | MV_HP_ERRATA_50XXB2 = (1 << 2), | ||
228 | MV_HP_ERRATA_60X1B2 = (1 << 3), | ||
229 | MV_HP_ERRATA_60X1C0 = (1 << 4), | ||
230 | MV_HP_50XX = (1 << 5), | ||
214 | 231 | ||
215 | /* Port private flags (pp_flags) */ | 232 | /* Port private flags (pp_flags) */ |
216 | MV_PP_FLAG_EDMA_EN = (1 << 0), | 233 | MV_PP_FLAG_EDMA_EN = (1 << 0), |
217 | MV_PP_FLAG_EDMA_DS_ACT = (1 << 1), | 234 | MV_PP_FLAG_EDMA_DS_ACT = (1 << 1), |
218 | }; | 235 | }; |
219 | 236 | ||
237 | #define IS_50XX(hpriv) ((hpriv)->hp_flags & MV_HP_50XX) | ||
238 | #define IS_60XX(hpriv) (((hpriv)->hp_flags & MV_HP_50XX) == 0) | ||
239 | |||
240 | enum { | ||
241 | /* Our DMA boundary is determined by an ePRD being unable to handle | ||
242 | * anything larger than 64KB | ||
243 | */ | ||
244 | MV_DMA_BOUNDARY = 0xffffU, | ||
245 | |||
246 | EDMA_REQ_Q_BASE_LO_MASK = 0xfffffc00U, | ||
247 | |||
248 | EDMA_RSP_Q_BASE_LO_MASK = 0xffffff00U, | ||
249 | }; | ||
250 | |||
251 | enum chip_type { | ||
252 | chip_504x, | ||
253 | chip_508x, | ||
254 | chip_5080, | ||
255 | chip_604x, | ||
256 | chip_608x, | ||
257 | }; | ||
258 | |||
220 | /* Command ReQuest Block: 32B */ | 259 | /* Command ReQuest Block: 32B */ |
221 | struct mv_crqb { | 260 | struct mv_crqb { |
222 | u32 sg_addr; | 261 | u32 sg_addr; |
@@ -253,14 +292,37 @@ struct mv_port_priv { | |||
253 | u32 pp_flags; | 292 | u32 pp_flags; |
254 | }; | 293 | }; |
255 | 294 | ||
295 | struct mv_port_signal { | ||
296 | u32 amps; | ||
297 | u32 pre; | ||
298 | }; | ||
299 | |||
300 | struct mv_host_priv; | ||
301 | struct mv_hw_ops { | ||
302 | void (*phy_errata)(struct mv_host_priv *hpriv, void __iomem *mmio, | ||
303 | unsigned int port); | ||
304 | void (*enable_leds)(struct mv_host_priv *hpriv, void __iomem *mmio); | ||
305 | void (*read_preamp)(struct mv_host_priv *hpriv, int idx, | ||
306 | void __iomem *mmio); | ||
307 | int (*reset_hc)(struct mv_host_priv *hpriv, void __iomem *mmio, | ||
308 | unsigned int n_hc); | ||
309 | void (*reset_flash)(struct mv_host_priv *hpriv, void __iomem *mmio); | ||
310 | void (*reset_bus)(struct pci_dev *pdev, void __iomem *mmio); | ||
311 | }; | ||
312 | |||
256 | struct mv_host_priv { | 313 | struct mv_host_priv { |
257 | u32 hp_flags; | 314 | u32 hp_flags; |
315 | struct mv_port_signal signal[8]; | ||
316 | const struct mv_hw_ops *ops; | ||
258 | }; | 317 | }; |
259 | 318 | ||
260 | static void mv_irq_clear(struct ata_port *ap); | 319 | static void mv_irq_clear(struct ata_port *ap); |
261 | static u32 mv_scr_read(struct ata_port *ap, unsigned int sc_reg_in); | 320 | static u32 mv_scr_read(struct ata_port *ap, unsigned int sc_reg_in); |
262 | static void mv_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val); | 321 | static void mv_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val); |
322 | static u32 mv5_scr_read(struct ata_port *ap, unsigned int sc_reg_in); | ||
323 | static void mv5_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val); | ||
263 | static void mv_phy_reset(struct ata_port *ap); | 324 | static void mv_phy_reset(struct ata_port *ap); |
325 | static void __mv_phy_reset(struct ata_port *ap, int can_sleep); | ||
264 | static void mv_host_stop(struct ata_host_set *host_set); | 326 | static void mv_host_stop(struct ata_host_set *host_set); |
265 | static int mv_port_start(struct ata_port *ap); | 327 | static int mv_port_start(struct ata_port *ap); |
266 | static void mv_port_stop(struct ata_port *ap); | 328 | static void mv_port_stop(struct ata_port *ap); |
@@ -271,6 +333,29 @@ static irqreturn_t mv_interrupt(int irq, void *dev_instance, | |||
271 | static void mv_eng_timeout(struct ata_port *ap); | 333 | static void mv_eng_timeout(struct ata_port *ap); |
272 | static int mv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); | 334 | static int mv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); |
273 | 335 | ||
336 | static void mv5_phy_errata(struct mv_host_priv *hpriv, void __iomem *mmio, | ||
337 | unsigned int port); | ||
338 | static void mv5_enable_leds(struct mv_host_priv *hpriv, void __iomem *mmio); | ||
339 | static void mv5_read_preamp(struct mv_host_priv *hpriv, int idx, | ||
340 | void __iomem *mmio); | ||
341 | static int mv5_reset_hc(struct mv_host_priv *hpriv, void __iomem *mmio, | ||
342 | unsigned int n_hc); | ||
343 | static void mv5_reset_flash(struct mv_host_priv *hpriv, void __iomem *mmio); | ||
344 | static void mv5_reset_bus(struct pci_dev *pdev, void __iomem *mmio); | ||
345 | |||
346 | static void mv6_phy_errata(struct mv_host_priv *hpriv, void __iomem *mmio, | ||
347 | unsigned int port); | ||
348 | static void mv6_enable_leds(struct mv_host_priv *hpriv, void __iomem *mmio); | ||
349 | static void mv6_read_preamp(struct mv_host_priv *hpriv, int idx, | ||
350 | void __iomem *mmio); | ||
351 | static int mv6_reset_hc(struct mv_host_priv *hpriv, void __iomem *mmio, | ||
352 | unsigned int n_hc); | ||
353 | static void mv6_reset_flash(struct mv_host_priv *hpriv, void __iomem *mmio); | ||
354 | static void mv_reset_pci_bus(struct pci_dev *pdev, void __iomem *mmio); | ||
355 | static void mv_channel_reset(struct mv_host_priv *hpriv, void __iomem *mmio, | ||
356 | unsigned int port_no); | ||
357 | static void mv_stop_and_reset(struct ata_port *ap); | ||
358 | |||
274 | static struct scsi_host_template mv_sht = { | 359 | static struct scsi_host_template mv_sht = { |
275 | .module = THIS_MODULE, | 360 | .module = THIS_MODULE, |
276 | .name = DRV_NAME, | 361 | .name = DRV_NAME, |
@@ -279,7 +364,7 @@ static struct scsi_host_template mv_sht = { | |||
279 | .eh_strategy_handler = ata_scsi_error, | 364 | .eh_strategy_handler = ata_scsi_error, |
280 | .can_queue = MV_USE_Q_DEPTH, | 365 | .can_queue = MV_USE_Q_DEPTH, |
281 | .this_id = ATA_SHT_THIS_ID, | 366 | .this_id = ATA_SHT_THIS_ID, |
282 | .sg_tablesize = MV_MAX_SG_CT, | 367 | .sg_tablesize = MV_MAX_SG_CT / 2, |
283 | .max_sectors = ATA_MAX_SECTORS, | 368 | .max_sectors = ATA_MAX_SECTORS, |
284 | .cmd_per_lun = ATA_SHT_CMD_PER_LUN, | 369 | .cmd_per_lun = ATA_SHT_CMD_PER_LUN, |
285 | .emulated = ATA_SHT_EMULATED, | 370 | .emulated = ATA_SHT_EMULATED, |
@@ -291,7 +376,34 @@ static struct scsi_host_template mv_sht = { | |||
291 | .ordered_flush = 1, | 376 | .ordered_flush = 1, |
292 | }; | 377 | }; |
293 | 378 | ||
294 | static const struct ata_port_operations mv_ops = { | 379 | static const struct ata_port_operations mv5_ops = { |
380 | .port_disable = ata_port_disable, | ||
381 | |||
382 | .tf_load = ata_tf_load, | ||
383 | .tf_read = ata_tf_read, | ||
384 | .check_status = ata_check_status, | ||
385 | .exec_command = ata_exec_command, | ||
386 | .dev_select = ata_std_dev_select, | ||
387 | |||
388 | .phy_reset = mv_phy_reset, | ||
389 | |||
390 | .qc_prep = mv_qc_prep, | ||
391 | .qc_issue = mv_qc_issue, | ||
392 | |||
393 | .eng_timeout = mv_eng_timeout, | ||
394 | |||
395 | .irq_handler = mv_interrupt, | ||
396 | .irq_clear = mv_irq_clear, | ||
397 | |||
398 | .scr_read = mv5_scr_read, | ||
399 | .scr_write = mv5_scr_write, | ||
400 | |||
401 | .port_start = mv_port_start, | ||
402 | .port_stop = mv_port_stop, | ||
403 | .host_stop = mv_host_stop, | ||
404 | }; | ||
405 | |||
406 | static const struct ata_port_operations mv6_ops = { | ||
295 | .port_disable = ata_port_disable, | 407 | .port_disable = ata_port_disable, |
296 | 408 | ||
297 | .tf_load = ata_tf_load, | 409 | .tf_load = ata_tf_load, |
@@ -323,37 +435,44 @@ static struct ata_port_info mv_port_info[] = { | |||
323 | .sht = &mv_sht, | 435 | .sht = &mv_sht, |
324 | .host_flags = MV_COMMON_FLAGS, | 436 | .host_flags = MV_COMMON_FLAGS, |
325 | .pio_mask = 0x1f, /* pio0-4 */ | 437 | .pio_mask = 0x1f, /* pio0-4 */ |
326 | .udma_mask = 0, /* 0x7f (udma0-6 disabled for now) */ | 438 | .udma_mask = 0x7f, /* udma0-6 */ |
327 | .port_ops = &mv_ops, | 439 | .port_ops = &mv5_ops, |
328 | }, | 440 | }, |
329 | { /* chip_508x */ | 441 | { /* chip_508x */ |
330 | .sht = &mv_sht, | 442 | .sht = &mv_sht, |
331 | .host_flags = (MV_COMMON_FLAGS | MV_FLAG_DUAL_HC), | 443 | .host_flags = (MV_COMMON_FLAGS | MV_FLAG_DUAL_HC), |
332 | .pio_mask = 0x1f, /* pio0-4 */ | 444 | .pio_mask = 0x1f, /* pio0-4 */ |
333 | .udma_mask = 0, /* 0x7f (udma0-6 disabled for now) */ | 445 | .udma_mask = 0x7f, /* udma0-6 */ |
334 | .port_ops = &mv_ops, | 446 | .port_ops = &mv5_ops, |
447 | }, | ||
448 | { /* chip_5080 */ | ||
449 | .sht = &mv_sht, | ||
450 | .host_flags = (MV_COMMON_FLAGS | MV_FLAG_DUAL_HC), | ||
451 | .pio_mask = 0x1f, /* pio0-4 */ | ||
452 | .udma_mask = 0x7f, /* udma0-6 */ | ||
453 | .port_ops = &mv5_ops, | ||
335 | }, | 454 | }, |
336 | { /* chip_604x */ | 455 | { /* chip_604x */ |
337 | .sht = &mv_sht, | 456 | .sht = &mv_sht, |
338 | .host_flags = (MV_COMMON_FLAGS | MV_6XXX_FLAGS), | 457 | .host_flags = (MV_COMMON_FLAGS | MV_6XXX_FLAGS), |
339 | .pio_mask = 0x1f, /* pio0-4 */ | 458 | .pio_mask = 0x1f, /* pio0-4 */ |
340 | .udma_mask = 0x7f, /* udma0-6 */ | 459 | .udma_mask = 0x7f, /* udma0-6 */ |
341 | .port_ops = &mv_ops, | 460 | .port_ops = &mv6_ops, |
342 | }, | 461 | }, |
343 | { /* chip_608x */ | 462 | { /* chip_608x */ |
344 | .sht = &mv_sht, | 463 | .sht = &mv_sht, |
345 | .host_flags = (MV_COMMON_FLAGS | MV_6XXX_FLAGS | | 464 | .host_flags = (MV_COMMON_FLAGS | MV_6XXX_FLAGS | |
346 | MV_FLAG_DUAL_HC), | 465 | MV_FLAG_DUAL_HC), |
347 | .pio_mask = 0x1f, /* pio0-4 */ | 466 | .pio_mask = 0x1f, /* pio0-4 */ |
348 | .udma_mask = 0x7f, /* udma0-6 */ | 467 | .udma_mask = 0x7f, /* udma0-6 */ |
349 | .port_ops = &mv_ops, | 468 | .port_ops = &mv6_ops, |
350 | }, | 469 | }, |
351 | }; | 470 | }; |
352 | 471 | ||
353 | static const struct pci_device_id mv_pci_tbl[] = { | 472 | static const struct pci_device_id mv_pci_tbl[] = { |
354 | {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x5040), 0, 0, chip_504x}, | 473 | {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x5040), 0, 0, chip_504x}, |
355 | {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x5041), 0, 0, chip_504x}, | 474 | {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x5041), 0, 0, chip_504x}, |
356 | {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x5080), 0, 0, chip_508x}, | 475 | {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x5080), 0, 0, chip_5080}, |
357 | {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x5081), 0, 0, chip_508x}, | 476 | {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x5081), 0, 0, chip_508x}, |
358 | 477 | ||
359 | {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x6040), 0, 0, chip_604x}, | 478 | {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x6040), 0, 0, chip_604x}, |
@@ -372,6 +491,24 @@ static struct pci_driver mv_pci_driver = { | |||
372 | .remove = ata_pci_remove_one, | 491 | .remove = ata_pci_remove_one, |
373 | }; | 492 | }; |
374 | 493 | ||
494 | static const struct mv_hw_ops mv5xxx_ops = { | ||
495 | .phy_errata = mv5_phy_errata, | ||
496 | .enable_leds = mv5_enable_leds, | ||
497 | .read_preamp = mv5_read_preamp, | ||
498 | .reset_hc = mv5_reset_hc, | ||
499 | .reset_flash = mv5_reset_flash, | ||
500 | .reset_bus = mv5_reset_bus, | ||
501 | }; | ||
502 | |||
503 | static const struct mv_hw_ops mv6xxx_ops = { | ||
504 | .phy_errata = mv6_phy_errata, | ||
505 | .enable_leds = mv6_enable_leds, | ||
506 | .read_preamp = mv6_read_preamp, | ||
507 | .reset_hc = mv6_reset_hc, | ||
508 | .reset_flash = mv6_reset_flash, | ||
509 | .reset_bus = mv_reset_pci_bus, | ||
510 | }; | ||
511 | |||
375 | /* | 512 | /* |
376 | * Functions | 513 | * Functions |
377 | */ | 514 | */ |
@@ -387,11 +524,27 @@ static inline void __iomem *mv_hc_base(void __iomem *base, unsigned int hc) | |||
387 | return (base + MV_SATAHC0_REG_BASE + (hc * MV_SATAHC_REG_SZ)); | 524 | return (base + MV_SATAHC0_REG_BASE + (hc * MV_SATAHC_REG_SZ)); |
388 | } | 525 | } |
389 | 526 | ||
527 | static inline unsigned int mv_hc_from_port(unsigned int port) | ||
528 | { | ||
529 | return port >> MV_PORT_HC_SHIFT; | ||
530 | } | ||
531 | |||
532 | static inline unsigned int mv_hardport_from_port(unsigned int port) | ||
533 | { | ||
534 | return port & MV_PORT_MASK; | ||
535 | } | ||
536 | |||
537 | static inline void __iomem *mv_hc_base_from_port(void __iomem *base, | ||
538 | unsigned int port) | ||
539 | { | ||
540 | return mv_hc_base(base, mv_hc_from_port(port)); | ||
541 | } | ||
542 | |||
390 | static inline void __iomem *mv_port_base(void __iomem *base, unsigned int port) | 543 | static inline void __iomem *mv_port_base(void __iomem *base, unsigned int port) |
391 | { | 544 | { |
392 | return (mv_hc_base(base, port >> MV_PORT_HC_SHIFT) + | 545 | return mv_hc_base_from_port(base, port) + |
393 | MV_SATAHC_ARBTR_REG_SZ + | 546 | MV_SATAHC_ARBTR_REG_SZ + |
394 | ((port & MV_PORT_MASK) * MV_PORT_REG_SZ)); | 547 | (mv_hardport_from_port(port) * MV_PORT_REG_SZ); |
395 | } | 548 | } |
396 | 549 | ||
397 | static inline void __iomem *mv_ap_base(struct ata_port *ap) | 550 | static inline void __iomem *mv_ap_base(struct ata_port *ap) |
@@ -399,9 +552,9 @@ static inline void __iomem *mv_ap_base(struct ata_port *ap) | |||
399 | return mv_port_base(ap->host_set->mmio_base, ap->port_no); | 552 | return mv_port_base(ap->host_set->mmio_base, ap->port_no); |
400 | } | 553 | } |
401 | 554 | ||
402 | static inline int mv_get_hc_count(unsigned long hp_flags) | 555 | static inline int mv_get_hc_count(unsigned long host_flags) |
403 | { | 556 | { |
404 | return ((hp_flags & MV_FLAG_DUAL_HC) ? 2 : 1); | 557 | return ((host_flags & MV_FLAG_DUAL_HC) ? 2 : 1); |
405 | } | 558 | } |
406 | 559 | ||
407 | static void mv_irq_clear(struct ata_port *ap) | 560 | static void mv_irq_clear(struct ata_port *ap) |
@@ -453,7 +606,7 @@ static void mv_stop_dma(struct ata_port *ap) | |||
453 | } else { | 606 | } else { |
454 | assert(!(EDMA_EN & readl(port_mmio + EDMA_CMD_OFS))); | 607 | assert(!(EDMA_EN & readl(port_mmio + EDMA_CMD_OFS))); |
455 | } | 608 | } |
456 | 609 | ||
457 | /* now properly wait for the eDMA to stop */ | 610 | /* now properly wait for the eDMA to stop */ |
458 | for (i = 1000; i > 0; i--) { | 611 | for (i = 1000; i > 0; i--) { |
459 | reg = readl(port_mmio + EDMA_CMD_OFS); | 612 | reg = readl(port_mmio + EDMA_CMD_OFS); |
@@ -504,7 +657,7 @@ static void mv_dump_all_regs(void __iomem *mmio_base, int port, | |||
504 | struct pci_dev *pdev) | 657 | struct pci_dev *pdev) |
505 | { | 658 | { |
506 | #ifdef ATA_DEBUG | 659 | #ifdef ATA_DEBUG |
507 | void __iomem *hc_base = mv_hc_base(mmio_base, | 660 | void __iomem *hc_base = mv_hc_base(mmio_base, |
508 | port >> MV_PORT_HC_SHIFT); | 661 | port >> MV_PORT_HC_SHIFT); |
509 | void __iomem *port_base; | 662 | void __iomem *port_base; |
510 | int start_port, num_ports, p, start_hc, num_hcs, hc; | 663 | int start_port, num_ports, p, start_hc, num_hcs, hc; |
@@ -518,7 +671,7 @@ static void mv_dump_all_regs(void __iomem *mmio_base, int port, | |||
518 | start_port = port; | 671 | start_port = port; |
519 | num_ports = num_hcs = 1; | 672 | num_ports = num_hcs = 1; |
520 | } | 673 | } |
521 | DPRINTK("All registers for port(s) %u-%u:\n", start_port, | 674 | DPRINTK("All registers for port(s) %u-%u:\n", start_port, |
522 | num_ports > 1 ? num_ports - 1 : start_port); | 675 | num_ports > 1 ? num_ports - 1 : start_port); |
523 | 676 | ||
524 | if (NULL != pdev) { | 677 | if (NULL != pdev) { |
@@ -586,70 +739,6 @@ static void mv_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val) | |||
586 | } | 739 | } |
587 | 740 | ||
588 | /** | 741 | /** |
589 | * mv_global_soft_reset - Perform the 6xxx global soft reset | ||
590 | * @mmio_base: base address of the HBA | ||
591 | * | ||
592 | * This routine only applies to 6xxx parts. | ||
593 | * | ||
594 | * LOCKING: | ||
595 | * Inherited from caller. | ||
596 | */ | ||
597 | static int mv_global_soft_reset(void __iomem *mmio_base) | ||
598 | { | ||
599 | void __iomem *reg = mmio_base + PCI_MAIN_CMD_STS_OFS; | ||
600 | int i, rc = 0; | ||
601 | u32 t; | ||
602 | |||
603 | /* Following procedure defined in PCI "main command and status | ||
604 | * register" table. | ||
605 | */ | ||
606 | t = readl(reg); | ||
607 | writel(t | STOP_PCI_MASTER, reg); | ||
608 | |||
609 | for (i = 0; i < 1000; i++) { | ||
610 | udelay(1); | ||
611 | t = readl(reg); | ||
612 | if (PCI_MASTER_EMPTY & t) { | ||
613 | break; | ||
614 | } | ||
615 | } | ||
616 | if (!(PCI_MASTER_EMPTY & t)) { | ||
617 | printk(KERN_ERR DRV_NAME ": PCI master won't flush\n"); | ||
618 | rc = 1; | ||
619 | goto done; | ||
620 | } | ||
621 | |||
622 | /* set reset */ | ||
623 | i = 5; | ||
624 | do { | ||
625 | writel(t | GLOB_SFT_RST, reg); | ||
626 | t = readl(reg); | ||
627 | udelay(1); | ||
628 | } while (!(GLOB_SFT_RST & t) && (i-- > 0)); | ||
629 | |||
630 | if (!(GLOB_SFT_RST & t)) { | ||
631 | printk(KERN_ERR DRV_NAME ": can't set global reset\n"); | ||
632 | rc = 1; | ||
633 | goto done; | ||
634 | } | ||
635 | |||
636 | /* clear reset and *reenable the PCI master* (not mentioned in spec) */ | ||
637 | i = 5; | ||
638 | do { | ||
639 | writel(t & ~(GLOB_SFT_RST | STOP_PCI_MASTER), reg); | ||
640 | t = readl(reg); | ||
641 | udelay(1); | ||
642 | } while ((GLOB_SFT_RST & t) && (i-- > 0)); | ||
643 | |||
644 | if (GLOB_SFT_RST & t) { | ||
645 | printk(KERN_ERR DRV_NAME ": can't clear global reset\n"); | ||
646 | rc = 1; | ||
647 | } | ||
648 | done: | ||
649 | return rc; | ||
650 | } | ||
651 | |||
652 | /** | ||
653 | * mv_host_stop - Host specific cleanup/stop routine. | 742 | * mv_host_stop - Host specific cleanup/stop routine. |
654 | * @host_set: host data structure | 743 | * @host_set: host data structure |
655 | * | 744 | * |
@@ -702,7 +791,7 @@ static int mv_port_start(struct ata_port *ap) | |||
702 | goto err_out; | 791 | goto err_out; |
703 | memset(pp, 0, sizeof(*pp)); | 792 | memset(pp, 0, sizeof(*pp)); |
704 | 793 | ||
705 | mem = dma_alloc_coherent(dev, MV_PORT_PRIV_DMA_SZ, &mem_dma, | 794 | mem = dma_alloc_coherent(dev, MV_PORT_PRIV_DMA_SZ, &mem_dma, |
706 | GFP_KERNEL); | 795 | GFP_KERNEL); |
707 | if (!mem) | 796 | if (!mem) |
708 | goto err_out_pp; | 797 | goto err_out_pp; |
@@ -712,7 +801,7 @@ static int mv_port_start(struct ata_port *ap) | |||
712 | if (rc) | 801 | if (rc) |
713 | goto err_out_priv; | 802 | goto err_out_priv; |
714 | 803 | ||
715 | /* First item in chunk of DMA memory: | 804 | /* First item in chunk of DMA memory: |
716 | * 32-slot command request table (CRQB), 32 bytes each in size | 805 | * 32-slot command request table (CRQB), 32 bytes each in size |
717 | */ | 806 | */ |
718 | pp->crqb = mem; | 807 | pp->crqb = mem; |
@@ -720,7 +809,7 @@ static int mv_port_start(struct ata_port *ap) | |||
720 | mem += MV_CRQB_Q_SZ; | 809 | mem += MV_CRQB_Q_SZ; |
721 | mem_dma += MV_CRQB_Q_SZ; | 810 | mem_dma += MV_CRQB_Q_SZ; |
722 | 811 | ||
723 | /* Second item: | 812 | /* Second item: |
724 | * 32-slot command response table (CRPB), 8 bytes each in size | 813 | * 32-slot command response table (CRPB), 8 bytes each in size |
725 | */ | 814 | */ |
726 | pp->crpb = mem; | 815 | pp->crpb = mem; |
@@ -734,18 +823,18 @@ static int mv_port_start(struct ata_port *ap) | |||
734 | pp->sg_tbl = mem; | 823 | pp->sg_tbl = mem; |
735 | pp->sg_tbl_dma = mem_dma; | 824 | pp->sg_tbl_dma = mem_dma; |
736 | 825 | ||
737 | writelfl(EDMA_CFG_Q_DEPTH | EDMA_CFG_RD_BRST_EXT | | 826 | writelfl(EDMA_CFG_Q_DEPTH | EDMA_CFG_RD_BRST_EXT | |
738 | EDMA_CFG_WR_BUFF_LEN, port_mmio + EDMA_CFG_OFS); | 827 | EDMA_CFG_WR_BUFF_LEN, port_mmio + EDMA_CFG_OFS); |
739 | 828 | ||
740 | writel((pp->crqb_dma >> 16) >> 16, port_mmio + EDMA_REQ_Q_BASE_HI_OFS); | 829 | writel((pp->crqb_dma >> 16) >> 16, port_mmio + EDMA_REQ_Q_BASE_HI_OFS); |
741 | writelfl(pp->crqb_dma & EDMA_REQ_Q_BASE_LO_MASK, | 830 | writelfl(pp->crqb_dma & EDMA_REQ_Q_BASE_LO_MASK, |
742 | port_mmio + EDMA_REQ_Q_IN_PTR_OFS); | 831 | port_mmio + EDMA_REQ_Q_IN_PTR_OFS); |
743 | 832 | ||
744 | writelfl(0, port_mmio + EDMA_REQ_Q_OUT_PTR_OFS); | 833 | writelfl(0, port_mmio + EDMA_REQ_Q_OUT_PTR_OFS); |
745 | writelfl(0, port_mmio + EDMA_RSP_Q_IN_PTR_OFS); | 834 | writelfl(0, port_mmio + EDMA_RSP_Q_IN_PTR_OFS); |
746 | 835 | ||
747 | writel((pp->crpb_dma >> 16) >> 16, port_mmio + EDMA_RSP_Q_BASE_HI_OFS); | 836 | writel((pp->crpb_dma >> 16) >> 16, port_mmio + EDMA_RSP_Q_BASE_HI_OFS); |
748 | writelfl(pp->crpb_dma & EDMA_RSP_Q_BASE_LO_MASK, | 837 | writelfl(pp->crpb_dma & EDMA_RSP_Q_BASE_LO_MASK, |
749 | port_mmio + EDMA_RSP_Q_OUT_PTR_OFS); | 838 | port_mmio + EDMA_RSP_Q_OUT_PTR_OFS); |
750 | 839 | ||
751 | pp->req_producer = pp->rsp_consumer = 0; | 840 | pp->req_producer = pp->rsp_consumer = 0; |
@@ -806,20 +895,30 @@ static void mv_fill_sg(struct ata_queued_cmd *qc) | |||
806 | struct scatterlist *sg; | 895 | struct scatterlist *sg; |
807 | 896 | ||
808 | ata_for_each_sg(sg, qc) { | 897 | ata_for_each_sg(sg, qc) { |
809 | u32 sg_len; | ||
810 | dma_addr_t addr; | 898 | dma_addr_t addr; |
899 | u32 sg_len, len, offset; | ||
811 | 900 | ||
812 | addr = sg_dma_address(sg); | 901 | addr = sg_dma_address(sg); |
813 | sg_len = sg_dma_len(sg); | 902 | sg_len = sg_dma_len(sg); |
814 | 903 | ||
815 | pp->sg_tbl[i].addr = cpu_to_le32(addr & 0xffffffff); | 904 | while (sg_len) { |
816 | pp->sg_tbl[i].addr_hi = cpu_to_le32((addr >> 16) >> 16); | 905 | offset = addr & MV_DMA_BOUNDARY; |
817 | assert(0 == (sg_len & ~MV_DMA_BOUNDARY)); | 906 | len = sg_len; |
818 | pp->sg_tbl[i].flags_size = cpu_to_le32(sg_len); | 907 | if ((offset + sg_len) > 0x10000) |
819 | if (ata_sg_is_last(sg, qc)) | 908 | len = 0x10000 - offset; |
820 | pp->sg_tbl[i].flags_size |= cpu_to_le32(EPRD_FLAG_END_OF_TBL); | 909 | |
910 | pp->sg_tbl[i].addr = cpu_to_le32(addr & 0xffffffff); | ||
911 | pp->sg_tbl[i].addr_hi = cpu_to_le32((addr >> 16) >> 16); | ||
912 | pp->sg_tbl[i].flags_size = cpu_to_le32(len); | ||
913 | |||
914 | sg_len -= len; | ||
915 | addr += len; | ||
916 | |||
917 | if (!sg_len && ata_sg_is_last(sg, qc)) | ||
918 | pp->sg_tbl[i].flags_size |= cpu_to_le32(EPRD_FLAG_END_OF_TBL); | ||
821 | 919 | ||
822 | i++; | 920 | i++; |
921 | } | ||
823 | } | 922 | } |
824 | } | 923 | } |
825 | 924 | ||
@@ -860,7 +959,7 @@ static void mv_qc_prep(struct ata_queued_cmd *qc) | |||
860 | } | 959 | } |
861 | 960 | ||
862 | /* the req producer index should be the same as we remember it */ | 961 | /* the req producer index should be the same as we remember it */ |
863 | assert(((readl(mv_ap_base(qc->ap) + EDMA_REQ_Q_IN_PTR_OFS) >> | 962 | assert(((readl(mv_ap_base(qc->ap) + EDMA_REQ_Q_IN_PTR_OFS) >> |
864 | EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) == | 963 | EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) == |
865 | pp->req_producer); | 964 | pp->req_producer); |
866 | 965 | ||
@@ -872,9 +971,9 @@ static void mv_qc_prep(struct ata_queued_cmd *qc) | |||
872 | assert(MV_MAX_Q_DEPTH > qc->tag); | 971 | assert(MV_MAX_Q_DEPTH > qc->tag); |
873 | flags |= qc->tag << CRQB_TAG_SHIFT; | 972 | flags |= qc->tag << CRQB_TAG_SHIFT; |
874 | 973 | ||
875 | pp->crqb[pp->req_producer].sg_addr = | 974 | pp->crqb[pp->req_producer].sg_addr = |
876 | cpu_to_le32(pp->sg_tbl_dma & 0xffffffff); | 975 | cpu_to_le32(pp->sg_tbl_dma & 0xffffffff); |
877 | pp->crqb[pp->req_producer].sg_addr_hi = | 976 | pp->crqb[pp->req_producer].sg_addr_hi = |
878 | cpu_to_le32((pp->sg_tbl_dma >> 16) >> 16); | 977 | cpu_to_le32((pp->sg_tbl_dma >> 16) >> 16); |
879 | pp->crqb[pp->req_producer].ctrl_flags = cpu_to_le16(flags); | 978 | pp->crqb[pp->req_producer].ctrl_flags = cpu_to_le16(flags); |
880 | 979 | ||
@@ -897,7 +996,7 @@ static void mv_qc_prep(struct ata_queued_cmd *qc) | |||
897 | #ifdef LIBATA_NCQ /* FIXME: remove this line when NCQ added */ | 996 | #ifdef LIBATA_NCQ /* FIXME: remove this line when NCQ added */ |
898 | case ATA_CMD_FPDMA_READ: | 997 | case ATA_CMD_FPDMA_READ: |
899 | case ATA_CMD_FPDMA_WRITE: | 998 | case ATA_CMD_FPDMA_WRITE: |
900 | mv_crqb_pack_cmd(cw++, tf->hob_feature, ATA_REG_FEATURE, 0); | 999 | mv_crqb_pack_cmd(cw++, tf->hob_feature, ATA_REG_FEATURE, 0); |
901 | mv_crqb_pack_cmd(cw++, tf->feature, ATA_REG_FEATURE, 0); | 1000 | mv_crqb_pack_cmd(cw++, tf->feature, ATA_REG_FEATURE, 0); |
902 | break; | 1001 | break; |
903 | #endif /* FIXME: remove this line when NCQ added */ | 1002 | #endif /* FIXME: remove this line when NCQ added */ |
@@ -963,7 +1062,7 @@ static int mv_qc_issue(struct ata_queued_cmd *qc) | |||
963 | pp->req_producer); | 1062 | pp->req_producer); |
964 | /* until we do queuing, the queue should be empty at this point */ | 1063 | /* until we do queuing, the queue should be empty at this point */ |
965 | assert(((in_ptr >> EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) == | 1064 | assert(((in_ptr >> EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) == |
966 | ((readl(port_mmio + EDMA_REQ_Q_OUT_PTR_OFS) >> | 1065 | ((readl(port_mmio + EDMA_REQ_Q_OUT_PTR_OFS) >> |
967 | EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK)); | 1066 | EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK)); |
968 | 1067 | ||
969 | mv_inc_q_index(&pp->req_producer); /* now incr producer index */ | 1068 | mv_inc_q_index(&pp->req_producer); /* now incr producer index */ |
@@ -1000,15 +1099,15 @@ static u8 mv_get_crpb_status(struct ata_port *ap) | |||
1000 | out_ptr = readl(port_mmio + EDMA_RSP_Q_OUT_PTR_OFS); | 1099 | out_ptr = readl(port_mmio + EDMA_RSP_Q_OUT_PTR_OFS); |
1001 | 1100 | ||
1002 | /* the response consumer index should be the same as we remember it */ | 1101 | /* the response consumer index should be the same as we remember it */ |
1003 | assert(((out_ptr >> EDMA_RSP_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) == | 1102 | assert(((out_ptr >> EDMA_RSP_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) == |
1004 | pp->rsp_consumer); | 1103 | pp->rsp_consumer); |
1005 | 1104 | ||
1006 | /* increment our consumer index... */ | 1105 | /* increment our consumer index... */ |
1007 | pp->rsp_consumer = mv_inc_q_index(&pp->rsp_consumer); | 1106 | pp->rsp_consumer = mv_inc_q_index(&pp->rsp_consumer); |
1008 | 1107 | ||
1009 | /* and, until we do NCQ, there should only be 1 CRPB waiting */ | 1108 | /* and, until we do NCQ, there should only be 1 CRPB waiting */ |
1010 | assert(((readl(port_mmio + EDMA_RSP_Q_IN_PTR_OFS) >> | 1109 | assert(((readl(port_mmio + EDMA_RSP_Q_IN_PTR_OFS) >> |
1011 | EDMA_RSP_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) == | 1110 | EDMA_RSP_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) == |
1012 | pp->rsp_consumer); | 1111 | pp->rsp_consumer); |
1013 | 1112 | ||
1014 | /* write out our inc'd consumer index so EDMA knows we're caught up */ | 1113 | /* write out our inc'd consumer index so EDMA knows we're caught up */ |
@@ -1056,7 +1155,7 @@ static void mv_err_intr(struct ata_port *ap) | |||
1056 | 1155 | ||
1057 | /* check for fatal here and recover if needed */ | 1156 | /* check for fatal here and recover if needed */ |
1058 | if (EDMA_ERR_FATAL & edma_err_cause) { | 1157 | if (EDMA_ERR_FATAL & edma_err_cause) { |
1059 | mv_phy_reset(ap); | 1158 | mv_stop_and_reset(ap); |
1060 | } | 1159 | } |
1061 | } | 1160 | } |
1062 | 1161 | ||
@@ -1121,6 +1220,10 @@ static void mv_host_intr(struct ata_host_set *host_set, u32 relevant, | |||
1121 | handled++; | 1220 | handled++; |
1122 | } | 1221 | } |
1123 | 1222 | ||
1223 | if (ap && | ||
1224 | (ap->flags & (ATA_FLAG_PORT_DISABLED | ATA_FLAG_NOINTR))) | ||
1225 | continue; | ||
1226 | |||
1124 | err_mask = ac_err_mask(ata_status); | 1227 | err_mask = ac_err_mask(ata_status); |
1125 | 1228 | ||
1126 | shift = port << 1; /* (port * 2) */ | 1229 | shift = port << 1; /* (port * 2) */ |
@@ -1132,14 +1235,15 @@ static void mv_host_intr(struct ata_host_set *host_set, u32 relevant, | |||
1132 | err_mask |= AC_ERR_OTHER; | 1235 | err_mask |= AC_ERR_OTHER; |
1133 | handled++; | 1236 | handled++; |
1134 | } | 1237 | } |
1135 | 1238 | ||
1136 | if (handled && ap) { | 1239 | if (handled && ap) { |
1137 | qc = ata_qc_from_tag(ap, ap->active_tag); | 1240 | qc = ata_qc_from_tag(ap, ap->active_tag); |
1138 | if (NULL != qc) { | 1241 | if (NULL != qc) { |
1139 | VPRINTK("port %u IRQ found for qc, " | 1242 | VPRINTK("port %u IRQ found for qc, " |
1140 | "ata_status 0x%x\n", port,ata_status); | 1243 | "ata_status 0x%x\n", port,ata_status); |
1141 | /* mark qc status appropriately */ | 1244 | /* mark qc status appropriately */ |
1142 | ata_qc_complete(qc, err_mask); | 1245 | if (!(qc->tf.ctl & ATA_NIEN)) |
1246 | ata_qc_complete(qc, err_mask); | ||
1143 | } | 1247 | } |
1144 | } | 1248 | } |
1145 | } | 1249 | } |
@@ -1147,7 +1251,7 @@ static void mv_host_intr(struct ata_host_set *host_set, u32 relevant, | |||
1147 | } | 1251 | } |
1148 | 1252 | ||
1149 | /** | 1253 | /** |
1150 | * mv_interrupt - | 1254 | * mv_interrupt - |
1151 | * @irq: unused | 1255 | * @irq: unused |
1152 | * @dev_instance: private data; in this case the host structure | 1256 | * @dev_instance: private data; in this case the host structure |
1153 | * @regs: unused | 1257 | * @regs: unused |
@@ -1157,7 +1261,7 @@ static void mv_host_intr(struct ata_host_set *host_set, u32 relevant, | |||
1157 | * routine to handle. Also check for PCI errors which are only | 1261 | * routine to handle. Also check for PCI errors which are only |
1158 | * reported here. | 1262 | * reported here. |
1159 | * | 1263 | * |
1160 | * LOCKING: | 1264 | * LOCKING: |
1161 | * This routine holds the host_set lock while processing pending | 1265 | * This routine holds the host_set lock while processing pending |
1162 | * interrupts. | 1266 | * interrupts. |
1163 | */ | 1267 | */ |
@@ -1203,8 +1307,422 @@ static irqreturn_t mv_interrupt(int irq, void *dev_instance, | |||
1203 | return IRQ_RETVAL(handled); | 1307 | return IRQ_RETVAL(handled); |
1204 | } | 1308 | } |
1205 | 1309 | ||
1310 | static void __iomem *mv5_phy_base(void __iomem *mmio, unsigned int port) | ||
1311 | { | ||
1312 | void __iomem *hc_mmio = mv_hc_base_from_port(mmio, port); | ||
1313 | unsigned long ofs = (mv_hardport_from_port(port) + 1) * 0x100UL; | ||
1314 | |||
1315 | return hc_mmio + ofs; | ||
1316 | } | ||
1317 | |||
1318 | static unsigned int mv5_scr_offset(unsigned int sc_reg_in) | ||
1319 | { | ||
1320 | unsigned int ofs; | ||
1321 | |||
1322 | switch (sc_reg_in) { | ||
1323 | case SCR_STATUS: | ||
1324 | case SCR_ERROR: | ||
1325 | case SCR_CONTROL: | ||
1326 | ofs = sc_reg_in * sizeof(u32); | ||
1327 | break; | ||
1328 | default: | ||
1329 | ofs = 0xffffffffU; | ||
1330 | break; | ||
1331 | } | ||
1332 | return ofs; | ||
1333 | } | ||
1334 | |||
1335 | static u32 mv5_scr_read(struct ata_port *ap, unsigned int sc_reg_in) | ||
1336 | { | ||
1337 | void __iomem *mmio = mv5_phy_base(ap->host_set->mmio_base, ap->port_no); | ||
1338 | unsigned int ofs = mv5_scr_offset(sc_reg_in); | ||
1339 | |||
1340 | if (ofs != 0xffffffffU) | ||
1341 | return readl(mmio + ofs); | ||
1342 | else | ||
1343 | return (u32) ofs; | ||
1344 | } | ||
1345 | |||
1346 | static void mv5_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val) | ||
1347 | { | ||
1348 | void __iomem *mmio = mv5_phy_base(ap->host_set->mmio_base, ap->port_no); | ||
1349 | unsigned int ofs = mv5_scr_offset(sc_reg_in); | ||
1350 | |||
1351 | if (ofs != 0xffffffffU) | ||
1352 | writelfl(val, mmio + ofs); | ||
1353 | } | ||
1354 | |||
1355 | static void mv5_reset_bus(struct pci_dev *pdev, void __iomem *mmio) | ||
1356 | { | ||
1357 | u8 rev_id; | ||
1358 | int early_5080; | ||
1359 | |||
1360 | pci_read_config_byte(pdev, PCI_REVISION_ID, &rev_id); | ||
1361 | |||
1362 | early_5080 = (pdev->device == 0x5080) && (rev_id == 0); | ||
1363 | |||
1364 | if (!early_5080) { | ||
1365 | u32 tmp = readl(mmio + MV_PCI_EXP_ROM_BAR_CTL); | ||
1366 | tmp |= (1 << 0); | ||
1367 | writel(tmp, mmio + MV_PCI_EXP_ROM_BAR_CTL); | ||
1368 | } | ||
1369 | |||
1370 | mv_reset_pci_bus(pdev, mmio); | ||
1371 | } | ||
1372 | |||
1373 | static void mv5_reset_flash(struct mv_host_priv *hpriv, void __iomem *mmio) | ||
1374 | { | ||
1375 | writel(0x0fcfffff, mmio + MV_FLASH_CTL); | ||
1376 | } | ||
1377 | |||
1378 | static void mv5_read_preamp(struct mv_host_priv *hpriv, int idx, | ||
1379 | void __iomem *mmio) | ||
1380 | { | ||
1381 | void __iomem *phy_mmio = mv5_phy_base(mmio, idx); | ||
1382 | u32 tmp; | ||
1383 | |||
1384 | tmp = readl(phy_mmio + MV5_PHY_MODE); | ||
1385 | |||
1386 | hpriv->signal[idx].pre = tmp & 0x1800; /* bits 12:11 */ | ||
1387 | hpriv->signal[idx].amps = tmp & 0xe0; /* bits 7:5 */ | ||
1388 | } | ||
1389 | |||
1390 | static void mv5_enable_leds(struct mv_host_priv *hpriv, void __iomem *mmio) | ||
1391 | { | ||
1392 | u32 tmp; | ||
1393 | |||
1394 | writel(0, mmio + MV_GPIO_PORT_CTL); | ||
1395 | |||
1396 | /* FIXME: handle MV_HP_ERRATA_50XXB2 errata */ | ||
1397 | |||
1398 | tmp = readl(mmio + MV_PCI_EXP_ROM_BAR_CTL); | ||
1399 | tmp |= ~(1 << 0); | ||
1400 | writel(tmp, mmio + MV_PCI_EXP_ROM_BAR_CTL); | ||
1401 | } | ||
1402 | |||
1403 | static void mv5_phy_errata(struct mv_host_priv *hpriv, void __iomem *mmio, | ||
1404 | unsigned int port) | ||
1405 | { | ||
1406 | void __iomem *phy_mmio = mv5_phy_base(mmio, port); | ||
1407 | const u32 mask = (1<<12) | (1<<11) | (1<<7) | (1<<6) | (1<<5); | ||
1408 | u32 tmp; | ||
1409 | int fix_apm_sq = (hpriv->hp_flags & MV_HP_ERRATA_50XXB0); | ||
1410 | |||
1411 | if (fix_apm_sq) { | ||
1412 | tmp = readl(phy_mmio + MV5_LT_MODE); | ||
1413 | tmp |= (1 << 19); | ||
1414 | writel(tmp, phy_mmio + MV5_LT_MODE); | ||
1415 | |||
1416 | tmp = readl(phy_mmio + MV5_PHY_CTL); | ||
1417 | tmp &= ~0x3; | ||
1418 | tmp |= 0x1; | ||
1419 | writel(tmp, phy_mmio + MV5_PHY_CTL); | ||
1420 | } | ||
1421 | |||
1422 | tmp = readl(phy_mmio + MV5_PHY_MODE); | ||
1423 | tmp &= ~mask; | ||
1424 | tmp |= hpriv->signal[port].pre; | ||
1425 | tmp |= hpriv->signal[port].amps; | ||
1426 | writel(tmp, phy_mmio + MV5_PHY_MODE); | ||
1427 | } | ||
1428 | |||
1429 | |||
1430 | #undef ZERO | ||
1431 | #define ZERO(reg) writel(0, port_mmio + (reg)) | ||
1432 | static void mv5_reset_hc_port(struct mv_host_priv *hpriv, void __iomem *mmio, | ||
1433 | unsigned int port) | ||
1434 | { | ||
1435 | void __iomem *port_mmio = mv_port_base(mmio, port); | ||
1436 | |||
1437 | writelfl(EDMA_DS, port_mmio + EDMA_CMD_OFS); | ||
1438 | |||
1439 | mv_channel_reset(hpriv, mmio, port); | ||
1440 | |||
1441 | ZERO(0x028); /* command */ | ||
1442 | writel(0x11f, port_mmio + EDMA_CFG_OFS); | ||
1443 | ZERO(0x004); /* timer */ | ||
1444 | ZERO(0x008); /* irq err cause */ | ||
1445 | ZERO(0x00c); /* irq err mask */ | ||
1446 | ZERO(0x010); /* rq bah */ | ||
1447 | ZERO(0x014); /* rq inp */ | ||
1448 | ZERO(0x018); /* rq outp */ | ||
1449 | ZERO(0x01c); /* respq bah */ | ||
1450 | ZERO(0x024); /* respq outp */ | ||
1451 | ZERO(0x020); /* respq inp */ | ||
1452 | ZERO(0x02c); /* test control */ | ||
1453 | writel(0xbc, port_mmio + EDMA_IORDY_TMOUT); | ||
1454 | } | ||
1455 | #undef ZERO | ||
1456 | |||
1457 | #define ZERO(reg) writel(0, hc_mmio + (reg)) | ||
1458 | static void mv5_reset_one_hc(struct mv_host_priv *hpriv, void __iomem *mmio, | ||
1459 | unsigned int hc) | ||
1460 | { | ||
1461 | void __iomem *hc_mmio = mv_hc_base(mmio, hc); | ||
1462 | u32 tmp; | ||
1463 | |||
1464 | ZERO(0x00c); | ||
1465 | ZERO(0x010); | ||
1466 | ZERO(0x014); | ||
1467 | ZERO(0x018); | ||
1468 | |||
1469 | tmp = readl(hc_mmio + 0x20); | ||
1470 | tmp &= 0x1c1c1c1c; | ||
1471 | tmp |= 0x03030303; | ||
1472 | writel(tmp, hc_mmio + 0x20); | ||
1473 | } | ||
1474 | #undef ZERO | ||
1475 | |||
1476 | static int mv5_reset_hc(struct mv_host_priv *hpriv, void __iomem *mmio, | ||
1477 | unsigned int n_hc) | ||
1478 | { | ||
1479 | unsigned int hc, port; | ||
1480 | |||
1481 | for (hc = 0; hc < n_hc; hc++) { | ||
1482 | for (port = 0; port < MV_PORTS_PER_HC; port++) | ||
1483 | mv5_reset_hc_port(hpriv, mmio, | ||
1484 | (hc * MV_PORTS_PER_HC) + port); | ||
1485 | |||
1486 | mv5_reset_one_hc(hpriv, mmio, hc); | ||
1487 | } | ||
1488 | |||
1489 | return 0; | ||
1490 | } | ||
1491 | |||
1492 | #undef ZERO | ||
1493 | #define ZERO(reg) writel(0, mmio + (reg)) | ||
1494 | static void mv_reset_pci_bus(struct pci_dev *pdev, void __iomem *mmio) | ||
1495 | { | ||
1496 | u32 tmp; | ||
1497 | |||
1498 | tmp = readl(mmio + MV_PCI_MODE); | ||
1499 | tmp &= 0xff00ffff; | ||
1500 | writel(tmp, mmio + MV_PCI_MODE); | ||
1501 | |||
1502 | ZERO(MV_PCI_DISC_TIMER); | ||
1503 | ZERO(MV_PCI_MSI_TRIGGER); | ||
1504 | writel(0x000100ff, mmio + MV_PCI_XBAR_TMOUT); | ||
1505 | ZERO(HC_MAIN_IRQ_MASK_OFS); | ||
1506 | ZERO(MV_PCI_SERR_MASK); | ||
1507 | ZERO(PCI_IRQ_CAUSE_OFS); | ||
1508 | ZERO(PCI_IRQ_MASK_OFS); | ||
1509 | ZERO(MV_PCI_ERR_LOW_ADDRESS); | ||
1510 | ZERO(MV_PCI_ERR_HIGH_ADDRESS); | ||
1511 | ZERO(MV_PCI_ERR_ATTRIBUTE); | ||
1512 | ZERO(MV_PCI_ERR_COMMAND); | ||
1513 | } | ||
1514 | #undef ZERO | ||
1515 | |||
1516 | static void mv6_reset_flash(struct mv_host_priv *hpriv, void __iomem *mmio) | ||
1517 | { | ||
1518 | u32 tmp; | ||
1519 | |||
1520 | mv5_reset_flash(hpriv, mmio); | ||
1521 | |||
1522 | tmp = readl(mmio + MV_GPIO_PORT_CTL); | ||
1523 | tmp &= 0x3; | ||
1524 | tmp |= (1 << 5) | (1 << 6); | ||
1525 | writel(tmp, mmio + MV_GPIO_PORT_CTL); | ||
1526 | } | ||
1527 | |||
1528 | /** | ||
1529 | * mv6_reset_hc - Perform the 6xxx global soft reset | ||
1530 | * @mmio: base address of the HBA | ||
1531 | * | ||
1532 | * This routine only applies to 6xxx parts. | ||
1533 | * | ||
1534 | * LOCKING: | ||
1535 | * Inherited from caller. | ||
1536 | */ | ||
1537 | static int mv6_reset_hc(struct mv_host_priv *hpriv, void __iomem *mmio, | ||
1538 | unsigned int n_hc) | ||
1539 | { | ||
1540 | void __iomem *reg = mmio + PCI_MAIN_CMD_STS_OFS; | ||
1541 | int i, rc = 0; | ||
1542 | u32 t; | ||
1543 | |||
1544 | /* Following procedure defined in PCI "main command and status | ||
1545 | * register" table. | ||
1546 | */ | ||
1547 | t = readl(reg); | ||
1548 | writel(t | STOP_PCI_MASTER, reg); | ||
1549 | |||
1550 | for (i = 0; i < 1000; i++) { | ||
1551 | udelay(1); | ||
1552 | t = readl(reg); | ||
1553 | if (PCI_MASTER_EMPTY & t) { | ||
1554 | break; | ||
1555 | } | ||
1556 | } | ||
1557 | if (!(PCI_MASTER_EMPTY & t)) { | ||
1558 | printk(KERN_ERR DRV_NAME ": PCI master won't flush\n"); | ||
1559 | rc = 1; | ||
1560 | goto done; | ||
1561 | } | ||
1562 | |||
1563 | /* set reset */ | ||
1564 | i = 5; | ||
1565 | do { | ||
1566 | writel(t | GLOB_SFT_RST, reg); | ||
1567 | t = readl(reg); | ||
1568 | udelay(1); | ||
1569 | } while (!(GLOB_SFT_RST & t) && (i-- > 0)); | ||
1570 | |||
1571 | if (!(GLOB_SFT_RST & t)) { | ||
1572 | printk(KERN_ERR DRV_NAME ": can't set global reset\n"); | ||
1573 | rc = 1; | ||
1574 | goto done; | ||
1575 | } | ||
1576 | |||
1577 | /* clear reset and *reenable the PCI master* (not mentioned in spec) */ | ||
1578 | i = 5; | ||
1579 | do { | ||
1580 | writel(t & ~(GLOB_SFT_RST | STOP_PCI_MASTER), reg); | ||
1581 | t = readl(reg); | ||
1582 | udelay(1); | ||
1583 | } while ((GLOB_SFT_RST & t) && (i-- > 0)); | ||
1584 | |||
1585 | if (GLOB_SFT_RST & t) { | ||
1586 | printk(KERN_ERR DRV_NAME ": can't clear global reset\n"); | ||
1587 | rc = 1; | ||
1588 | } | ||
1589 | done: | ||
1590 | return rc; | ||
1591 | } | ||
1592 | |||
1593 | static void mv6_read_preamp(struct mv_host_priv *hpriv, int idx, | ||
1594 | void __iomem *mmio) | ||
1595 | { | ||
1596 | void __iomem *port_mmio; | ||
1597 | u32 tmp; | ||
1598 | |||
1599 | tmp = readl(mmio + MV_RESET_CFG); | ||
1600 | if ((tmp & (1 << 0)) == 0) { | ||
1601 | hpriv->signal[idx].amps = 0x7 << 8; | ||
1602 | hpriv->signal[idx].pre = 0x1 << 5; | ||
1603 | return; | ||
1604 | } | ||
1605 | |||
1606 | port_mmio = mv_port_base(mmio, idx); | ||
1607 | tmp = readl(port_mmio + PHY_MODE2); | ||
1608 | |||
1609 | hpriv->signal[idx].amps = tmp & 0x700; /* bits 10:8 */ | ||
1610 | hpriv->signal[idx].pre = tmp & 0xe0; /* bits 7:5 */ | ||
1611 | } | ||
1612 | |||
1613 | static void mv6_enable_leds(struct mv_host_priv *hpriv, void __iomem *mmio) | ||
1614 | { | ||
1615 | writel(0x00000060, mmio + MV_GPIO_PORT_CTL); | ||
1616 | } | ||
1617 | |||
1618 | static void mv6_phy_errata(struct mv_host_priv *hpriv, void __iomem *mmio, | ||
1619 | unsigned int port) | ||
1620 | { | ||
1621 | void __iomem *port_mmio = mv_port_base(mmio, port); | ||
1622 | |||
1623 | u32 hp_flags = hpriv->hp_flags; | ||
1624 | int fix_phy_mode2 = | ||
1625 | hp_flags & (MV_HP_ERRATA_60X1B2 | MV_HP_ERRATA_60X1C0); | ||
1626 | int fix_phy_mode4 = | ||
1627 | hp_flags & (MV_HP_ERRATA_60X1B2 | MV_HP_ERRATA_60X1C0); | ||
1628 | u32 m2, tmp; | ||
1629 | |||
1630 | if (fix_phy_mode2) { | ||
1631 | m2 = readl(port_mmio + PHY_MODE2); | ||
1632 | m2 &= ~(1 << 16); | ||
1633 | m2 |= (1 << 31); | ||
1634 | writel(m2, port_mmio + PHY_MODE2); | ||
1635 | |||
1636 | udelay(200); | ||
1637 | |||
1638 | m2 = readl(port_mmio + PHY_MODE2); | ||
1639 | m2 &= ~((1 << 16) | (1 << 31)); | ||
1640 | writel(m2, port_mmio + PHY_MODE2); | ||
1641 | |||
1642 | udelay(200); | ||
1643 | } | ||
1644 | |||
1645 | /* who knows what this magic does */ | ||
1646 | tmp = readl(port_mmio + PHY_MODE3); | ||
1647 | tmp &= ~0x7F800000; | ||
1648 | tmp |= 0x2A800000; | ||
1649 | writel(tmp, port_mmio + PHY_MODE3); | ||
1650 | |||
1651 | if (fix_phy_mode4) { | ||
1652 | u32 m4; | ||
1653 | |||
1654 | m4 = readl(port_mmio + PHY_MODE4); | ||
1655 | |||
1656 | if (hp_flags & MV_HP_ERRATA_60X1B2) | ||
1657 | tmp = readl(port_mmio + 0x310); | ||
1658 | |||
1659 | m4 = (m4 & ~(1 << 1)) | (1 << 0); | ||
1660 | |||
1661 | writel(m4, port_mmio + PHY_MODE4); | ||
1662 | |||
1663 | if (hp_flags & MV_HP_ERRATA_60X1B2) | ||
1664 | writel(tmp, port_mmio + 0x310); | ||
1665 | } | ||
1666 | |||
1667 | /* Revert values of pre-emphasis and signal amps to the saved ones */ | ||
1668 | m2 = readl(port_mmio + PHY_MODE2); | ||
1669 | |||
1670 | m2 &= ~MV_M2_PREAMP_MASK; | ||
1671 | m2 |= hpriv->signal[port].amps; | ||
1672 | m2 |= hpriv->signal[port].pre; | ||
1673 | m2 &= ~(1 << 16); | ||
1674 | |||
1675 | writel(m2, port_mmio + PHY_MODE2); | ||
1676 | } | ||
1677 | |||
1678 | static void mv_channel_reset(struct mv_host_priv *hpriv, void __iomem *mmio, | ||
1679 | unsigned int port_no) | ||
1680 | { | ||
1681 | void __iomem *port_mmio = mv_port_base(mmio, port_no); | ||
1682 | |||
1683 | writelfl(ATA_RST, port_mmio + EDMA_CMD_OFS); | ||
1684 | |||
1685 | if (IS_60XX(hpriv)) { | ||
1686 | u32 ifctl = readl(port_mmio + SATA_INTERFACE_CTL); | ||
1687 | ifctl |= (1 << 12) | (1 << 7); | ||
1688 | writelfl(ifctl, port_mmio + SATA_INTERFACE_CTL); | ||
1689 | } | ||
1690 | |||
1691 | udelay(25); /* allow reset propagation */ | ||
1692 | |||
1693 | /* Spec never mentions clearing the bit. Marvell's driver does | ||
1694 | * clear the bit, however. | ||
1695 | */ | ||
1696 | writelfl(0, port_mmio + EDMA_CMD_OFS); | ||
1697 | |||
1698 | hpriv->ops->phy_errata(hpriv, mmio, port_no); | ||
1699 | |||
1700 | if (IS_50XX(hpriv)) | ||
1701 | mdelay(1); | ||
1702 | } | ||
1703 | |||
1704 | static void mv_stop_and_reset(struct ata_port *ap) | ||
1705 | { | ||
1706 | struct mv_host_priv *hpriv = ap->host_set->private_data; | ||
1707 | void __iomem *mmio = ap->host_set->mmio_base; | ||
1708 | |||
1709 | mv_stop_dma(ap); | ||
1710 | |||
1711 | mv_channel_reset(hpriv, mmio, ap->port_no); | ||
1712 | |||
1713 | __mv_phy_reset(ap, 0); | ||
1714 | } | ||
1715 | |||
1716 | static inline void __msleep(unsigned int msec, int can_sleep) | ||
1717 | { | ||
1718 | if (can_sleep) | ||
1719 | msleep(msec); | ||
1720 | else | ||
1721 | mdelay(msec); | ||
1722 | } | ||
1723 | |||
1206 | /** | 1724 | /** |
1207 | * mv_phy_reset - Perform eDMA reset followed by COMRESET | 1725 | * __mv_phy_reset - Perform eDMA reset followed by COMRESET |
1208 | * @ap: ATA channel to manipulate | 1726 | * @ap: ATA channel to manipulate |
1209 | * | 1727 | * |
1210 | * Part of this is taken from __sata_phy_reset and modified to | 1728 | * Part of this is taken from __sata_phy_reset and modified to |
@@ -1214,41 +1732,47 @@ static irqreturn_t mv_interrupt(int irq, void *dev_instance, | |||
1214 | * Inherited from caller. This is coded to safe to call at | 1732 | * Inherited from caller. This is coded to safe to call at |
1215 | * interrupt level, i.e. it does not sleep. | 1733 | * interrupt level, i.e. it does not sleep. |
1216 | */ | 1734 | */ |
1217 | static void mv_phy_reset(struct ata_port *ap) | 1735 | static void __mv_phy_reset(struct ata_port *ap, int can_sleep) |
1218 | { | 1736 | { |
1737 | struct mv_port_priv *pp = ap->private_data; | ||
1738 | struct mv_host_priv *hpriv = ap->host_set->private_data; | ||
1219 | void __iomem *port_mmio = mv_ap_base(ap); | 1739 | void __iomem *port_mmio = mv_ap_base(ap); |
1220 | struct ata_taskfile tf; | 1740 | struct ata_taskfile tf; |
1221 | struct ata_device *dev = &ap->device[0]; | 1741 | struct ata_device *dev = &ap->device[0]; |
1222 | unsigned long timeout; | 1742 | unsigned long timeout; |
1743 | int retry = 5; | ||
1744 | u32 sstatus; | ||
1223 | 1745 | ||
1224 | VPRINTK("ENTER, port %u, mmio 0x%p\n", ap->port_no, port_mmio); | 1746 | VPRINTK("ENTER, port %u, mmio 0x%p\n", ap->port_no, port_mmio); |
1225 | 1747 | ||
1226 | mv_stop_dma(ap); | 1748 | DPRINTK("S-regs after ATA_RST: SStat 0x%08x SErr 0x%08x " |
1227 | |||
1228 | writelfl(ATA_RST, port_mmio + EDMA_CMD_OFS); | ||
1229 | udelay(25); /* allow reset propagation */ | ||
1230 | |||
1231 | /* Spec never mentions clearing the bit. Marvell's driver does | ||
1232 | * clear the bit, however. | ||
1233 | */ | ||
1234 | writelfl(0, port_mmio + EDMA_CMD_OFS); | ||
1235 | |||
1236 | VPRINTK("S-regs after ATA_RST: SStat 0x%08x SErr 0x%08x " | ||
1237 | "SCtrl 0x%08x\n", mv_scr_read(ap, SCR_STATUS), | 1749 | "SCtrl 0x%08x\n", mv_scr_read(ap, SCR_STATUS), |
1238 | mv_scr_read(ap, SCR_ERROR), mv_scr_read(ap, SCR_CONTROL)); | 1750 | mv_scr_read(ap, SCR_ERROR), mv_scr_read(ap, SCR_CONTROL)); |
1239 | 1751 | ||
1240 | /* proceed to init communications via the scr_control reg */ | 1752 | /* Issue COMRESET via SControl */ |
1753 | comreset_retry: | ||
1241 | scr_write_flush(ap, SCR_CONTROL, 0x301); | 1754 | scr_write_flush(ap, SCR_CONTROL, 0x301); |
1242 | mdelay(1); | 1755 | __msleep(1, can_sleep); |
1756 | |||
1243 | scr_write_flush(ap, SCR_CONTROL, 0x300); | 1757 | scr_write_flush(ap, SCR_CONTROL, 0x300); |
1244 | timeout = jiffies + (HZ * 1); | 1758 | __msleep(20, can_sleep); |
1759 | |||
1760 | timeout = jiffies + msecs_to_jiffies(200); | ||
1245 | do { | 1761 | do { |
1246 | mdelay(10); | 1762 | sstatus = scr_read(ap, SCR_STATUS) & 0x3; |
1247 | if ((scr_read(ap, SCR_STATUS) & 0xf) != 1) | 1763 | if ((sstatus == 3) || (sstatus == 0)) |
1248 | break; | 1764 | break; |
1765 | |||
1766 | __msleep(1, can_sleep); | ||
1249 | } while (time_before(jiffies, timeout)); | 1767 | } while (time_before(jiffies, timeout)); |
1250 | 1768 | ||
1251 | VPRINTK("S-regs after PHY wake: SStat 0x%08x SErr 0x%08x " | 1769 | /* work around errata */ |
1770 | if (IS_60XX(hpriv) && | ||
1771 | (sstatus != 0x0) && (sstatus != 0x113) && (sstatus != 0x123) && | ||
1772 | (retry-- > 0)) | ||
1773 | goto comreset_retry; | ||
1774 | |||
1775 | DPRINTK("S-regs after PHY wake: SStat 0x%08x SErr 0x%08x " | ||
1252 | "SCtrl 0x%08x\n", mv_scr_read(ap, SCR_STATUS), | 1776 | "SCtrl 0x%08x\n", mv_scr_read(ap, SCR_STATUS), |
1253 | mv_scr_read(ap, SCR_ERROR), mv_scr_read(ap, SCR_CONTROL)); | 1777 | mv_scr_read(ap, SCR_ERROR), mv_scr_read(ap, SCR_CONTROL)); |
1254 | 1778 | ||
@@ -1262,6 +1786,21 @@ static void mv_phy_reset(struct ata_port *ap) | |||
1262 | } | 1786 | } |
1263 | ap->cbl = ATA_CBL_SATA; | 1787 | ap->cbl = ATA_CBL_SATA; |
1264 | 1788 | ||
1789 | /* even after SStatus reflects that device is ready, | ||
1790 | * it seems to take a while for link to be fully | ||
1791 | * established (and thus Status no longer 0x80/0x7F), | ||
1792 | * so we poll a bit for that, here. | ||
1793 | */ | ||
1794 | retry = 20; | ||
1795 | while (1) { | ||
1796 | u8 drv_stat = ata_check_status(ap); | ||
1797 | if ((drv_stat != 0x80) && (drv_stat != 0x7f)) | ||
1798 | break; | ||
1799 | __msleep(500, can_sleep); | ||
1800 | if (retry-- <= 0) | ||
1801 | break; | ||
1802 | } | ||
1803 | |||
1265 | tf.lbah = readb((void __iomem *) ap->ioaddr.lbah_addr); | 1804 | tf.lbah = readb((void __iomem *) ap->ioaddr.lbah_addr); |
1266 | tf.lbam = readb((void __iomem *) ap->ioaddr.lbam_addr); | 1805 | tf.lbam = readb((void __iomem *) ap->ioaddr.lbam_addr); |
1267 | tf.lbal = readb((void __iomem *) ap->ioaddr.lbal_addr); | 1806 | tf.lbal = readb((void __iomem *) ap->ioaddr.lbal_addr); |
@@ -1272,9 +1811,19 @@ static void mv_phy_reset(struct ata_port *ap) | |||
1272 | VPRINTK("Port disabled post-sig: No device present.\n"); | 1811 | VPRINTK("Port disabled post-sig: No device present.\n"); |
1273 | ata_port_disable(ap); | 1812 | ata_port_disable(ap); |
1274 | } | 1813 | } |
1814 | |||
1815 | writelfl(0, port_mmio + EDMA_ERR_IRQ_CAUSE_OFS); | ||
1816 | |||
1817 | pp->pp_flags &= ~MV_PP_FLAG_EDMA_EN; | ||
1818 | |||
1275 | VPRINTK("EXIT\n"); | 1819 | VPRINTK("EXIT\n"); |
1276 | } | 1820 | } |
1277 | 1821 | ||
1822 | static void mv_phy_reset(struct ata_port *ap) | ||
1823 | { | ||
1824 | __mv_phy_reset(ap, 1); | ||
1825 | } | ||
1826 | |||
1278 | /** | 1827 | /** |
1279 | * mv_eng_timeout - Routine called by libata when SCSI times out I/O | 1828 | * mv_eng_timeout - Routine called by libata when SCSI times out I/O |
1280 | * @ap: ATA channel to manipulate | 1829 | * @ap: ATA channel to manipulate |
@@ -1292,16 +1841,16 @@ static void mv_eng_timeout(struct ata_port *ap) | |||
1292 | 1841 | ||
1293 | printk(KERN_ERR "ata%u: Entering mv_eng_timeout\n",ap->id); | 1842 | printk(KERN_ERR "ata%u: Entering mv_eng_timeout\n",ap->id); |
1294 | DPRINTK("All regs @ start of eng_timeout\n"); | 1843 | DPRINTK("All regs @ start of eng_timeout\n"); |
1295 | mv_dump_all_regs(ap->host_set->mmio_base, ap->port_no, | 1844 | mv_dump_all_regs(ap->host_set->mmio_base, ap->port_no, |
1296 | to_pci_dev(ap->host_set->dev)); | 1845 | to_pci_dev(ap->host_set->dev)); |
1297 | 1846 | ||
1298 | qc = ata_qc_from_tag(ap, ap->active_tag); | 1847 | qc = ata_qc_from_tag(ap, ap->active_tag); |
1299 | printk(KERN_ERR "mmio_base %p ap %p qc %p scsi_cmnd %p &cmnd %p\n", | 1848 | printk(KERN_ERR "mmio_base %p ap %p qc %p scsi_cmnd %p &cmnd %p\n", |
1300 | ap->host_set->mmio_base, ap, qc, qc->scsicmd, | 1849 | ap->host_set->mmio_base, ap, qc, qc->scsicmd, |
1301 | &qc->scsicmd->cmnd); | 1850 | &qc->scsicmd->cmnd); |
1302 | 1851 | ||
1303 | mv_err_intr(ap); | 1852 | mv_err_intr(ap); |
1304 | mv_phy_reset(ap); | 1853 | mv_stop_and_reset(ap); |
1305 | 1854 | ||
1306 | if (!qc) { | 1855 | if (!qc) { |
1307 | printk(KERN_ERR "ata%u: BUG: timeout without command\n", | 1856 | printk(KERN_ERR "ata%u: BUG: timeout without command\n", |
@@ -1337,17 +1886,17 @@ static void mv_port_init(struct ata_ioports *port, void __iomem *port_mmio) | |||
1337 | unsigned long shd_base = (unsigned long) port_mmio + SHD_BLK_OFS; | 1886 | unsigned long shd_base = (unsigned long) port_mmio + SHD_BLK_OFS; |
1338 | unsigned serr_ofs; | 1887 | unsigned serr_ofs; |
1339 | 1888 | ||
1340 | /* PIO related setup | 1889 | /* PIO related setup |
1341 | */ | 1890 | */ |
1342 | port->data_addr = shd_base + (sizeof(u32) * ATA_REG_DATA); | 1891 | port->data_addr = shd_base + (sizeof(u32) * ATA_REG_DATA); |
1343 | port->error_addr = | 1892 | port->error_addr = |
1344 | port->feature_addr = shd_base + (sizeof(u32) * ATA_REG_ERR); | 1893 | port->feature_addr = shd_base + (sizeof(u32) * ATA_REG_ERR); |
1345 | port->nsect_addr = shd_base + (sizeof(u32) * ATA_REG_NSECT); | 1894 | port->nsect_addr = shd_base + (sizeof(u32) * ATA_REG_NSECT); |
1346 | port->lbal_addr = shd_base + (sizeof(u32) * ATA_REG_LBAL); | 1895 | port->lbal_addr = shd_base + (sizeof(u32) * ATA_REG_LBAL); |
1347 | port->lbam_addr = shd_base + (sizeof(u32) * ATA_REG_LBAM); | 1896 | port->lbam_addr = shd_base + (sizeof(u32) * ATA_REG_LBAM); |
1348 | port->lbah_addr = shd_base + (sizeof(u32) * ATA_REG_LBAH); | 1897 | port->lbah_addr = shd_base + (sizeof(u32) * ATA_REG_LBAH); |
1349 | port->device_addr = shd_base + (sizeof(u32) * ATA_REG_DEVICE); | 1898 | port->device_addr = shd_base + (sizeof(u32) * ATA_REG_DEVICE); |
1350 | port->status_addr = | 1899 | port->status_addr = |
1351 | port->command_addr = shd_base + (sizeof(u32) * ATA_REG_STATUS); | 1900 | port->command_addr = shd_base + (sizeof(u32) * ATA_REG_STATUS); |
1352 | /* special case: control/altstatus doesn't have ATA_REG_ address */ | 1901 | /* special case: control/altstatus doesn't have ATA_REG_ address */ |
1353 | port->altstatus_addr = port->ctl_addr = shd_base + SHD_CTL_AST_OFS; | 1902 | port->altstatus_addr = port->ctl_addr = shd_base + SHD_CTL_AST_OFS; |
@@ -1363,14 +1912,92 @@ static void mv_port_init(struct ata_ioports *port, void __iomem *port_mmio) | |||
1363 | /* unmask all EDMA error interrupts */ | 1912 | /* unmask all EDMA error interrupts */ |
1364 | writelfl(~0, port_mmio + EDMA_ERR_IRQ_MASK_OFS); | 1913 | writelfl(~0, port_mmio + EDMA_ERR_IRQ_MASK_OFS); |
1365 | 1914 | ||
1366 | VPRINTK("EDMA cfg=0x%08x EDMA IRQ err cause/mask=0x%08x/0x%08x\n", | 1915 | VPRINTK("EDMA cfg=0x%08x EDMA IRQ err cause/mask=0x%08x/0x%08x\n", |
1367 | readl(port_mmio + EDMA_CFG_OFS), | 1916 | readl(port_mmio + EDMA_CFG_OFS), |
1368 | readl(port_mmio + EDMA_ERR_IRQ_CAUSE_OFS), | 1917 | readl(port_mmio + EDMA_ERR_IRQ_CAUSE_OFS), |
1369 | readl(port_mmio + EDMA_ERR_IRQ_MASK_OFS)); | 1918 | readl(port_mmio + EDMA_ERR_IRQ_MASK_OFS)); |
1370 | } | 1919 | } |
1371 | 1920 | ||
1921 | static int mv_chip_id(struct pci_dev *pdev, struct mv_host_priv *hpriv, | ||
1922 | unsigned int board_idx) | ||
1923 | { | ||
1924 | u8 rev_id; | ||
1925 | u32 hp_flags = hpriv->hp_flags; | ||
1926 | |||
1927 | pci_read_config_byte(pdev, PCI_REVISION_ID, &rev_id); | ||
1928 | |||
1929 | switch(board_idx) { | ||
1930 | case chip_5080: | ||
1931 | hpriv->ops = &mv5xxx_ops; | ||
1932 | hp_flags |= MV_HP_50XX; | ||
1933 | |||
1934 | switch (rev_id) { | ||
1935 | case 0x1: | ||
1936 | hp_flags |= MV_HP_ERRATA_50XXB0; | ||
1937 | break; | ||
1938 | case 0x3: | ||
1939 | hp_flags |= MV_HP_ERRATA_50XXB2; | ||
1940 | break; | ||
1941 | default: | ||
1942 | dev_printk(KERN_WARNING, &pdev->dev, | ||
1943 | "Applying 50XXB2 workarounds to unknown rev\n"); | ||
1944 | hp_flags |= MV_HP_ERRATA_50XXB2; | ||
1945 | break; | ||
1946 | } | ||
1947 | break; | ||
1948 | |||
1949 | case chip_504x: | ||
1950 | case chip_508x: | ||
1951 | hpriv->ops = &mv5xxx_ops; | ||
1952 | hp_flags |= MV_HP_50XX; | ||
1953 | |||
1954 | switch (rev_id) { | ||
1955 | case 0x0: | ||
1956 | hp_flags |= MV_HP_ERRATA_50XXB0; | ||
1957 | break; | ||
1958 | case 0x3: | ||
1959 | hp_flags |= MV_HP_ERRATA_50XXB2; | ||
1960 | break; | ||
1961 | default: | ||
1962 | dev_printk(KERN_WARNING, &pdev->dev, | ||
1963 | "Applying B2 workarounds to unknown rev\n"); | ||
1964 | hp_flags |= MV_HP_ERRATA_50XXB2; | ||
1965 | break; | ||
1966 | } | ||
1967 | break; | ||
1968 | |||
1969 | case chip_604x: | ||
1970 | case chip_608x: | ||
1971 | hpriv->ops = &mv6xxx_ops; | ||
1972 | |||
1973 | switch (rev_id) { | ||
1974 | case 0x7: | ||
1975 | hp_flags |= MV_HP_ERRATA_60X1B2; | ||
1976 | break; | ||
1977 | case 0x9: | ||
1978 | hp_flags |= MV_HP_ERRATA_60X1C0; | ||
1979 | break; | ||
1980 | default: | ||
1981 | dev_printk(KERN_WARNING, &pdev->dev, | ||
1982 | "Applying B2 workarounds to unknown rev\n"); | ||
1983 | hp_flags |= MV_HP_ERRATA_60X1B2; | ||
1984 | break; | ||
1985 | } | ||
1986 | break; | ||
1987 | |||
1988 | default: | ||
1989 | printk(KERN_ERR DRV_NAME ": BUG: invalid board index %u\n", board_idx); | ||
1990 | return 1; | ||
1991 | } | ||
1992 | |||
1993 | hpriv->hp_flags = hp_flags; | ||
1994 | |||
1995 | return 0; | ||
1996 | } | ||
1997 | |||
1372 | /** | 1998 | /** |
1373 | * mv_host_init - Perform some early initialization of the host. | 1999 | * mv_init_host - Perform some early initialization of the host. |
2000 | * @pdev: host PCI device | ||
1374 | * @probe_ent: early data struct representing the host | 2001 | * @probe_ent: early data struct representing the host |
1375 | * | 2002 | * |
1376 | * If possible, do an early global reset of the host. Then do | 2003 | * If possible, do an early global reset of the host. Then do |
@@ -1379,23 +2006,48 @@ static void mv_port_init(struct ata_ioports *port, void __iomem *port_mmio) | |||
1379 | * LOCKING: | 2006 | * LOCKING: |
1380 | * Inherited from caller. | 2007 | * Inherited from caller. |
1381 | */ | 2008 | */ |
1382 | static int mv_host_init(struct ata_probe_ent *probe_ent) | 2009 | static int mv_init_host(struct pci_dev *pdev, struct ata_probe_ent *probe_ent, |
2010 | unsigned int board_idx) | ||
1383 | { | 2011 | { |
1384 | int rc = 0, n_hc, port, hc; | 2012 | int rc = 0, n_hc, port, hc; |
1385 | void __iomem *mmio = probe_ent->mmio_base; | 2013 | void __iomem *mmio = probe_ent->mmio_base; |
1386 | void __iomem *port_mmio; | 2014 | struct mv_host_priv *hpriv = probe_ent->private_data; |
1387 | 2015 | ||
1388 | if ((MV_FLAG_GLBL_SFT_RST & probe_ent->host_flags) && | 2016 | /* global interrupt mask */ |
1389 | mv_global_soft_reset(probe_ent->mmio_base)) { | 2017 | writel(0, mmio + HC_MAIN_IRQ_MASK_OFS); |
1390 | rc = 1; | 2018 | |
2019 | rc = mv_chip_id(pdev, hpriv, board_idx); | ||
2020 | if (rc) | ||
1391 | goto done; | 2021 | goto done; |
1392 | } | ||
1393 | 2022 | ||
1394 | n_hc = mv_get_hc_count(probe_ent->host_flags); | 2023 | n_hc = mv_get_hc_count(probe_ent->host_flags); |
1395 | probe_ent->n_ports = MV_PORTS_PER_HC * n_hc; | 2024 | probe_ent->n_ports = MV_PORTS_PER_HC * n_hc; |
1396 | 2025 | ||
2026 | for (port = 0; port < probe_ent->n_ports; port++) | ||
2027 | hpriv->ops->read_preamp(hpriv, port, mmio); | ||
2028 | |||
2029 | rc = hpriv->ops->reset_hc(hpriv, mmio, n_hc); | ||
2030 | if (rc) | ||
2031 | goto done; | ||
2032 | |||
2033 | hpriv->ops->reset_flash(hpriv, mmio); | ||
2034 | hpriv->ops->reset_bus(pdev, mmio); | ||
2035 | hpriv->ops->enable_leds(hpriv, mmio); | ||
2036 | |||
1397 | for (port = 0; port < probe_ent->n_ports; port++) { | 2037 | for (port = 0; port < probe_ent->n_ports; port++) { |
1398 | port_mmio = mv_port_base(mmio, port); | 2038 | if (IS_60XX(hpriv)) { |
2039 | void __iomem *port_mmio = mv_port_base(mmio, port); | ||
2040 | |||
2041 | u32 ifctl = readl(port_mmio + SATA_INTERFACE_CTL); | ||
2042 | ifctl |= (1 << 12); | ||
2043 | writelfl(ifctl, port_mmio + SATA_INTERFACE_CTL); | ||
2044 | } | ||
2045 | |||
2046 | hpriv->ops->phy_errata(hpriv, mmio, port); | ||
2047 | } | ||
2048 | |||
2049 | for (port = 0; port < probe_ent->n_ports; port++) { | ||
2050 | void __iomem *port_mmio = mv_port_base(mmio, port); | ||
1399 | mv_port_init(&probe_ent->port[port], port_mmio); | 2051 | mv_port_init(&probe_ent->port[port], port_mmio); |
1400 | } | 2052 | } |
1401 | 2053 | ||
@@ -1419,11 +2071,12 @@ static int mv_host_init(struct ata_probe_ent *probe_ent) | |||
1419 | writelfl(~HC_MAIN_MASKED_IRQS, mmio + HC_MAIN_IRQ_MASK_OFS); | 2071 | writelfl(~HC_MAIN_MASKED_IRQS, mmio + HC_MAIN_IRQ_MASK_OFS); |
1420 | 2072 | ||
1421 | VPRINTK("HC MAIN IRQ cause/mask=0x%08x/0x%08x " | 2073 | VPRINTK("HC MAIN IRQ cause/mask=0x%08x/0x%08x " |
1422 | "PCI int cause/mask=0x%08x/0x%08x\n", | 2074 | "PCI int cause/mask=0x%08x/0x%08x\n", |
1423 | readl(mmio + HC_MAIN_IRQ_CAUSE_OFS), | 2075 | readl(mmio + HC_MAIN_IRQ_CAUSE_OFS), |
1424 | readl(mmio + HC_MAIN_IRQ_MASK_OFS), | 2076 | readl(mmio + HC_MAIN_IRQ_MASK_OFS), |
1425 | readl(mmio + PCI_IRQ_CAUSE_OFS), | 2077 | readl(mmio + PCI_IRQ_CAUSE_OFS), |
1426 | readl(mmio + PCI_IRQ_MASK_OFS)); | 2078 | readl(mmio + PCI_IRQ_MASK_OFS)); |
2079 | |||
1427 | done: | 2080 | done: |
1428 | return rc; | 2081 | return rc; |
1429 | } | 2082 | } |
@@ -1459,7 +2112,7 @@ static void mv_print_info(struct ata_probe_ent *probe_ent) | |||
1459 | 2112 | ||
1460 | dev_printk(KERN_INFO, &pdev->dev, | 2113 | dev_printk(KERN_INFO, &pdev->dev, |
1461 | "%u slots %u ports %s mode IRQ via %s\n", | 2114 | "%u slots %u ports %s mode IRQ via %s\n", |
1462 | (unsigned)MV_MAX_Q_DEPTH, probe_ent->n_ports, | 2115 | (unsigned)MV_MAX_Q_DEPTH, probe_ent->n_ports, |
1463 | scc_s, (MV_HP_FLAG_MSI & hpriv->hp_flags) ? "MSI" : "INTx"); | 2116 | scc_s, (MV_HP_FLAG_MSI & hpriv->hp_flags) ? "MSI" : "INTx"); |
1464 | } | 2117 | } |
1465 | 2118 | ||
@@ -1529,7 +2182,7 @@ static int mv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1529 | probe_ent->private_data = hpriv; | 2182 | probe_ent->private_data = hpriv; |
1530 | 2183 | ||
1531 | /* initialize adapter */ | 2184 | /* initialize adapter */ |
1532 | rc = mv_host_init(probe_ent); | 2185 | rc = mv_init_host(pdev, probe_ent, board_idx); |
1533 | if (rc) { | 2186 | if (rc) { |
1534 | goto err_out_hpriv; | 2187 | goto err_out_hpriv; |
1535 | } | 2188 | } |