aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/sata_mv.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ata/sata_mv.c')
-rw-r--r--drivers/ata/sata_mv.c422
1 files changed, 211 insertions, 211 deletions
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index 82d928a426ac..fffba9b7471e 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -69,7 +69,7 @@
69#include <linux/libata.h> 69#include <linux/libata.h>
70 70
71#define DRV_NAME "sata_mv" 71#define DRV_NAME "sata_mv"
72#define DRV_VERSION "1.27" 72#define DRV_VERSION "1.28"
73 73
74/* 74/*
75 * module options 75 * module options
@@ -114,23 +114,23 @@ enum {
114 * Coalescing defers the interrupt until either the IO_THRESHOLD 114 * Coalescing defers the interrupt until either the IO_THRESHOLD
115 * (count of completed I/Os) is met, or the TIME_THRESHOLD is met. 115 * (count of completed I/Os) is met, or the TIME_THRESHOLD is met.
116 */ 116 */
117 MV_COAL_REG_BASE = 0x18000, 117 COAL_REG_BASE = 0x18000,
118 MV_IRQ_COAL_CAUSE = (MV_COAL_REG_BASE + 0x08), 118 IRQ_COAL_CAUSE = (COAL_REG_BASE + 0x08),
119 ALL_PORTS_COAL_IRQ = (1 << 4), /* all ports irq event */ 119 ALL_PORTS_COAL_IRQ = (1 << 4), /* all ports irq event */
120 120
121 MV_IRQ_COAL_IO_THRESHOLD = (MV_COAL_REG_BASE + 0xcc), 121 IRQ_COAL_IO_THRESHOLD = (COAL_REG_BASE + 0xcc),
122 MV_IRQ_COAL_TIME_THRESHOLD = (MV_COAL_REG_BASE + 0xd0), 122 IRQ_COAL_TIME_THRESHOLD = (COAL_REG_BASE + 0xd0),
123 123
124 /* 124 /*
125 * Registers for the (unused here) transaction coalescing feature: 125 * Registers for the (unused here) transaction coalescing feature:
126 */ 126 */
127 MV_TRAN_COAL_CAUSE_LO = (MV_COAL_REG_BASE + 0x88), 127 TRAN_COAL_CAUSE_LO = (COAL_REG_BASE + 0x88),
128 MV_TRAN_COAL_CAUSE_HI = (MV_COAL_REG_BASE + 0x8c), 128 TRAN_COAL_CAUSE_HI = (COAL_REG_BASE + 0x8c),
129 129
130 MV_SATAHC0_REG_BASE = 0x20000, 130 SATAHC0_REG_BASE = 0x20000,
131 MV_FLASH_CTL_OFS = 0x1046c, 131 FLASH_CTL = 0x1046c,
132 MV_GPIO_PORT_CTL_OFS = 0x104f0, 132 GPIO_PORT_CTL = 0x104f0,
133 MV_RESET_CFG_OFS = 0x180d8, 133 RESET_CFG = 0x180d8,
134 134
135 MV_PCI_REG_SZ = MV_MAJOR_REG_AREA_SZ, 135 MV_PCI_REG_SZ = MV_MAJOR_REG_AREA_SZ,
136 MV_SATAHC_REG_SZ = MV_MAJOR_REG_AREA_SZ, 136 MV_SATAHC_REG_SZ = MV_MAJOR_REG_AREA_SZ,
@@ -185,41 +185,41 @@ enum {
185 185
186 /* PCI interface registers */ 186 /* PCI interface registers */
187 187
188 PCI_COMMAND_OFS = 0xc00, 188 MV_PCI_COMMAND = 0xc00,
189 PCI_COMMAND_MWRCOM = (1 << 4), /* PCI Master Write Combining */ 189 MV_PCI_COMMAND_MWRCOM = (1 << 4), /* PCI Master Write Combining */
190 PCI_COMMAND_MRDTRIG = (1 << 7), /* PCI Master Read Trigger */ 190 MV_PCI_COMMAND_MRDTRIG = (1 << 7), /* PCI Master Read Trigger */
191 191
192 PCI_MAIN_CMD_STS_OFS = 0xd30, 192 PCI_MAIN_CMD_STS = 0xd30,
193 STOP_PCI_MASTER = (1 << 2), 193 STOP_PCI_MASTER = (1 << 2),
194 PCI_MASTER_EMPTY = (1 << 3), 194 PCI_MASTER_EMPTY = (1 << 3),
195 GLOB_SFT_RST = (1 << 4), 195 GLOB_SFT_RST = (1 << 4),
196 196
197 MV_PCI_MODE_OFS = 0xd00, 197 MV_PCI_MODE = 0xd00,
198 MV_PCI_MODE_MASK = 0x30, 198 MV_PCI_MODE_MASK = 0x30,
199 199
200 MV_PCI_EXP_ROM_BAR_CTL = 0xd2c, 200 MV_PCI_EXP_ROM_BAR_CTL = 0xd2c,
201 MV_PCI_DISC_TIMER = 0xd04, 201 MV_PCI_DISC_TIMER = 0xd04,
202 MV_PCI_MSI_TRIGGER = 0xc38, 202 MV_PCI_MSI_TRIGGER = 0xc38,
203 MV_PCI_SERR_MASK = 0xc28, 203 MV_PCI_SERR_MASK = 0xc28,
204 MV_PCI_XBAR_TMOUT_OFS = 0x1d04, 204 MV_PCI_XBAR_TMOUT = 0x1d04,
205 MV_PCI_ERR_LOW_ADDRESS = 0x1d40, 205 MV_PCI_ERR_LOW_ADDRESS = 0x1d40,
206 MV_PCI_ERR_HIGH_ADDRESS = 0x1d44, 206 MV_PCI_ERR_HIGH_ADDRESS = 0x1d44,
207 MV_PCI_ERR_ATTRIBUTE = 0x1d48, 207 MV_PCI_ERR_ATTRIBUTE = 0x1d48,
208 MV_PCI_ERR_COMMAND = 0x1d50, 208 MV_PCI_ERR_COMMAND = 0x1d50,
209 209
210 PCI_IRQ_CAUSE_OFS = 0x1d58, 210 PCI_IRQ_CAUSE = 0x1d58,
211 PCI_IRQ_MASK_OFS = 0x1d5c, 211 PCI_IRQ_MASK = 0x1d5c,
212 PCI_UNMASK_ALL_IRQS = 0x7fffff, /* bits 22-0 */ 212 PCI_UNMASK_ALL_IRQS = 0x7fffff, /* bits 22-0 */
213 213
214 PCIE_IRQ_CAUSE_OFS = 0x1900, 214 PCIE_IRQ_CAUSE = 0x1900,
215 PCIE_IRQ_MASK_OFS = 0x1910, 215 PCIE_IRQ_MASK = 0x1910,
216 PCIE_UNMASK_ALL_IRQS = 0x40a, /* assorted bits */ 216 PCIE_UNMASK_ALL_IRQS = 0x40a, /* assorted bits */
217 217
218 /* Host Controller Main Interrupt Cause/Mask registers (1 per-chip) */ 218 /* Host Controller Main Interrupt Cause/Mask registers (1 per-chip) */
219 PCI_HC_MAIN_IRQ_CAUSE_OFS = 0x1d60, 219 PCI_HC_MAIN_IRQ_CAUSE = 0x1d60,
220 PCI_HC_MAIN_IRQ_MASK_OFS = 0x1d64, 220 PCI_HC_MAIN_IRQ_MASK = 0x1d64,
221 SOC_HC_MAIN_IRQ_CAUSE_OFS = 0x20020, 221 SOC_HC_MAIN_IRQ_CAUSE = 0x20020,
222 SOC_HC_MAIN_IRQ_MASK_OFS = 0x20024, 222 SOC_HC_MAIN_IRQ_MASK = 0x20024,
223 ERR_IRQ = (1 << 0), /* shift by (2 * port #) */ 223 ERR_IRQ = (1 << 0), /* shift by (2 * port #) */
224 DONE_IRQ = (1 << 1), /* shift by (2 * port #) */ 224 DONE_IRQ = (1 << 1), /* shift by (2 * port #) */
225 HC0_IRQ_PEND = 0x1ff, /* bits 0-8 = HC0's ports */ 225 HC0_IRQ_PEND = 0x1ff, /* bits 0-8 = HC0's ports */
@@ -240,9 +240,9 @@ enum {
240 HC_MAIN_RSVD_SOC = (0x3fffffb << 6), /* bits 31-9, 7-6 */ 240 HC_MAIN_RSVD_SOC = (0x3fffffb << 6), /* bits 31-9, 7-6 */
241 241
242 /* SATAHC registers */ 242 /* SATAHC registers */
243 HC_CFG_OFS = 0, 243 HC_CFG = 0x00,
244 244
245 HC_IRQ_CAUSE_OFS = 0x14, 245 HC_IRQ_CAUSE = 0x14,
246 DMA_IRQ = (1 << 0), /* shift by port # */ 246 DMA_IRQ = (1 << 0), /* shift by port # */
247 HC_COAL_IRQ = (1 << 4), /* IRQ coalescing */ 247 HC_COAL_IRQ = (1 << 4), /* IRQ coalescing */
248 DEV_IRQ = (1 << 8), /* shift by port # */ 248 DEV_IRQ = (1 << 8), /* shift by port # */
@@ -254,53 +254,54 @@ enum {
254 * Coalescing defers the interrupt until either the IO_THRESHOLD 254 * Coalescing defers the interrupt until either the IO_THRESHOLD
255 * (count of completed I/Os) is met, or the TIME_THRESHOLD is met. 255 * (count of completed I/Os) is met, or the TIME_THRESHOLD is met.
256 */ 256 */
257 HC_IRQ_COAL_IO_THRESHOLD_OFS = 0x000c, 257 HC_IRQ_COAL_IO_THRESHOLD = 0x000c,
258 HC_IRQ_COAL_TIME_THRESHOLD_OFS = 0x0010, 258 HC_IRQ_COAL_TIME_THRESHOLD = 0x0010,
259 259
260 SOC_LED_CTRL_OFS = 0x2c, 260 SOC_LED_CTRL = 0x2c,
261 SOC_LED_CTRL_BLINK = (1 << 0), /* Active LED blink */ 261 SOC_LED_CTRL_BLINK = (1 << 0), /* Active LED blink */
262 SOC_LED_CTRL_ACT_PRESENCE = (1 << 2), /* Multiplex dev presence */ 262 SOC_LED_CTRL_ACT_PRESENCE = (1 << 2), /* Multiplex dev presence */
263 /* with dev activity LED */ 263 /* with dev activity LED */
264 264
265 /* Shadow block registers */ 265 /* Shadow block registers */
266 SHD_BLK_OFS = 0x100, 266 SHD_BLK = 0x100,
267 SHD_CTL_AST_OFS = 0x20, /* ofs from SHD_BLK_OFS */ 267 SHD_CTL_AST = 0x20, /* ofs from SHD_BLK */
268 268
269 /* SATA registers */ 269 /* SATA registers */
270 SATA_STATUS_OFS = 0x300, /* ctrl, err regs follow status */ 270 SATA_STATUS = 0x300, /* ctrl, err regs follow status */
271 SATA_ACTIVE_OFS = 0x350, 271 SATA_ACTIVE = 0x350,
272 SATA_FIS_IRQ_CAUSE_OFS = 0x364, 272 FIS_IRQ_CAUSE = 0x364,
273 SATA_FIS_IRQ_AN = (1 << 9), /* async notification */ 273 FIS_IRQ_CAUSE_AN = (1 << 9), /* async notification */
274 274
275 LTMODE_OFS = 0x30c, /* requires read-after-write */ 275 LTMODE = 0x30c, /* requires read-after-write */
276 LTMODE_BIT8 = (1 << 8), /* unknown, but necessary */ 276 LTMODE_BIT8 = (1 << 8), /* unknown, but necessary */
277 277
278 PHY_MODE2_OFS = 0x330, 278 PHY_MODE2 = 0x330,
279 PHY_MODE3_OFS = 0x310, 279 PHY_MODE3 = 0x310,
280 PHY_MODE4_OFS = 0x314, /* requires read-after-write */ 280
281 PHY_MODE4 = 0x314, /* requires read-after-write */
281 PHY_MODE4_CFG_MASK = 0x00000003, /* phy internal config field */ 282 PHY_MODE4_CFG_MASK = 0x00000003, /* phy internal config field */
282 PHY_MODE4_CFG_VALUE = 0x00000001, /* phy internal config field */ 283 PHY_MODE4_CFG_VALUE = 0x00000001, /* phy internal config field */
283 PHY_MODE4_RSVD_ZEROS = 0x5de3fffa, /* Gen2e always write zeros */ 284 PHY_MODE4_RSVD_ZEROS = 0x5de3fffa, /* Gen2e always write zeros */
284 PHY_MODE4_RSVD_ONES = 0x00000005, /* Gen2e always write ones */ 285 PHY_MODE4_RSVD_ONES = 0x00000005, /* Gen2e always write ones */
285 286
286 SATA_IFCTL_OFS = 0x344, 287 SATA_IFCTL = 0x344,
287 SATA_TESTCTL_OFS = 0x348, 288 SATA_TESTCTL = 0x348,
288 SATA_IFSTAT_OFS = 0x34c, 289 SATA_IFSTAT = 0x34c,
289 VENDOR_UNIQUE_FIS_OFS = 0x35c, 290 VENDOR_UNIQUE_FIS = 0x35c,
290 291
291 FISCFG_OFS = 0x360, 292 FISCFG = 0x360,
292 FISCFG_WAIT_DEV_ERR = (1 << 8), /* wait for host on DevErr */ 293 FISCFG_WAIT_DEV_ERR = (1 << 8), /* wait for host on DevErr */
293 FISCFG_SINGLE_SYNC = (1 << 16), /* SYNC on DMA activation */ 294 FISCFG_SINGLE_SYNC = (1 << 16), /* SYNC on DMA activation */
294 295
295 MV5_PHY_MODE = 0x74, 296 MV5_PHY_MODE = 0x74,
296 MV5_LTMODE_OFS = 0x30, 297 MV5_LTMODE = 0x30,
297 MV5_PHY_CTL_OFS = 0x0C, 298 MV5_PHY_CTL = 0x0C,
298 SATA_INTERFACE_CFG_OFS = 0x050, 299 SATA_IFCFG = 0x050,
299 300
300 MV_M2_PREAMP_MASK = 0x7e0, 301 MV_M2_PREAMP_MASK = 0x7e0,
301 302
302 /* Port registers */ 303 /* Port registers */
303 EDMA_CFG_OFS = 0, 304 EDMA_CFG = 0,
304 EDMA_CFG_Q_DEPTH = 0x1f, /* max device queue depth */ 305 EDMA_CFG_Q_DEPTH = 0x1f, /* max device queue depth */
305 EDMA_CFG_NCQ = (1 << 5), /* for R/W FPDMA queued */ 306 EDMA_CFG_NCQ = (1 << 5), /* for R/W FPDMA queued */
306 EDMA_CFG_NCQ_GO_ON_ERR = (1 << 14), /* continue on error */ 307 EDMA_CFG_NCQ_GO_ON_ERR = (1 << 14), /* continue on error */
@@ -309,8 +310,8 @@ enum {
309 EDMA_CFG_EDMA_FBS = (1 << 16), /* EDMA FIS-Based Switching */ 310 EDMA_CFG_EDMA_FBS = (1 << 16), /* EDMA FIS-Based Switching */
310 EDMA_CFG_FBS = (1 << 26), /* FIS-Based Switching */ 311 EDMA_CFG_FBS = (1 << 26), /* FIS-Based Switching */
311 312
312 EDMA_ERR_IRQ_CAUSE_OFS = 0x8, 313 EDMA_ERR_IRQ_CAUSE = 0x8,
313 EDMA_ERR_IRQ_MASK_OFS = 0xc, 314 EDMA_ERR_IRQ_MASK = 0xc,
314 EDMA_ERR_D_PAR = (1 << 0), /* UDMA data parity err */ 315 EDMA_ERR_D_PAR = (1 << 0), /* UDMA data parity err */
315 EDMA_ERR_PRD_PAR = (1 << 1), /* UDMA PRD parity err */ 316 EDMA_ERR_PRD_PAR = (1 << 1), /* UDMA PRD parity err */
316 EDMA_ERR_DEV = (1 << 2), /* device error */ 317 EDMA_ERR_DEV = (1 << 2), /* device error */
@@ -379,36 +380,36 @@ enum {
379 EDMA_ERR_INTRL_PAR | 380 EDMA_ERR_INTRL_PAR |
380 EDMA_ERR_IORDY, 381 EDMA_ERR_IORDY,
381 382
382 EDMA_REQ_Q_BASE_HI_OFS = 0x10, 383 EDMA_REQ_Q_BASE_HI = 0x10,
383 EDMA_REQ_Q_IN_PTR_OFS = 0x14, /* also contains BASE_LO */ 384 EDMA_REQ_Q_IN_PTR = 0x14, /* also contains BASE_LO */
384 385
385 EDMA_REQ_Q_OUT_PTR_OFS = 0x18, 386 EDMA_REQ_Q_OUT_PTR = 0x18,
386 EDMA_REQ_Q_PTR_SHIFT = 5, 387 EDMA_REQ_Q_PTR_SHIFT = 5,
387 388
388 EDMA_RSP_Q_BASE_HI_OFS = 0x1c, 389 EDMA_RSP_Q_BASE_HI = 0x1c,
389 EDMA_RSP_Q_IN_PTR_OFS = 0x20, 390 EDMA_RSP_Q_IN_PTR = 0x20,
390 EDMA_RSP_Q_OUT_PTR_OFS = 0x24, /* also contains BASE_LO */ 391 EDMA_RSP_Q_OUT_PTR = 0x24, /* also contains BASE_LO */
391 EDMA_RSP_Q_PTR_SHIFT = 3, 392 EDMA_RSP_Q_PTR_SHIFT = 3,
392 393
393 EDMA_CMD_OFS = 0x28, /* EDMA command register */ 394 EDMA_CMD = 0x28, /* EDMA command register */
394 EDMA_EN = (1 << 0), /* enable EDMA */ 395 EDMA_EN = (1 << 0), /* enable EDMA */
395 EDMA_DS = (1 << 1), /* disable EDMA; self-negated */ 396 EDMA_DS = (1 << 1), /* disable EDMA; self-negated */
396 EDMA_RESET = (1 << 2), /* reset eng/trans/link/phy */ 397 EDMA_RESET = (1 << 2), /* reset eng/trans/link/phy */
397 398
398 EDMA_STATUS_OFS = 0x30, /* EDMA engine status */ 399 EDMA_STATUS = 0x30, /* EDMA engine status */
399 EDMA_STATUS_CACHE_EMPTY = (1 << 6), /* GenIIe command cache empty */ 400 EDMA_STATUS_CACHE_EMPTY = (1 << 6), /* GenIIe command cache empty */
400 EDMA_STATUS_IDLE = (1 << 7), /* GenIIe EDMA enabled/idle */ 401 EDMA_STATUS_IDLE = (1 << 7), /* GenIIe EDMA enabled/idle */
401 402
402 EDMA_IORDY_TMOUT_OFS = 0x34, 403 EDMA_IORDY_TMOUT = 0x34,
403 EDMA_ARB_CFG_OFS = 0x38, 404 EDMA_ARB_CFG = 0x38,
404 405
405 EDMA_HALTCOND_OFS = 0x60, /* GenIIe halt conditions */ 406 EDMA_HALTCOND = 0x60, /* GenIIe halt conditions */
406 EDMA_UNKNOWN_RSVD_OFS = 0x6C, /* GenIIe unknown/reserved */ 407 EDMA_UNKNOWN_RSVD = 0x6C, /* GenIIe unknown/reserved */
407 408
408 BMDMA_CMD_OFS = 0x224, /* bmdma command register */ 409 BMDMA_CMD = 0x224, /* bmdma command register */
409 BMDMA_STATUS_OFS = 0x228, /* bmdma status register */ 410 BMDMA_STATUS = 0x228, /* bmdma status register */
410 BMDMA_PRD_LOW_OFS = 0x22c, /* bmdma PRD addr 31:0 */ 411 BMDMA_PRD_LOW = 0x22c, /* bmdma PRD addr 31:0 */
411 BMDMA_PRD_HIGH_OFS = 0x230, /* bmdma PRD addr 63:32 */ 412 BMDMA_PRD_HIGH = 0x230, /* bmdma PRD addr 63:32 */
412 413
413 /* Host private flags (hp_flags) */ 414 /* Host private flags (hp_flags) */
414 MV_HP_FLAG_MSI = (1 << 0), 415 MV_HP_FLAG_MSI = (1 << 0),
@@ -540,8 +541,8 @@ struct mv_host_priv {
540 void __iomem *base; 541 void __iomem *base;
541 void __iomem *main_irq_cause_addr; 542 void __iomem *main_irq_cause_addr;
542 void __iomem *main_irq_mask_addr; 543 void __iomem *main_irq_mask_addr;
543 u32 irq_cause_ofs; 544 u32 irq_cause_offset;
544 u32 irq_mask_ofs; 545 u32 irq_mask_offset;
545 u32 unmask_all_irqs; 546 u32 unmask_all_irqs;
546 /* 547 /*
547 * These consistent DMA memory pools give us guaranteed 548 * These consistent DMA memory pools give us guaranteed
@@ -846,7 +847,7 @@ static inline unsigned int mv_hardport_from_port(unsigned int port)
846 847
847static inline void __iomem *mv_hc_base(void __iomem *base, unsigned int hc) 848static inline void __iomem *mv_hc_base(void __iomem *base, unsigned int hc)
848{ 849{
849 return (base + MV_SATAHC0_REG_BASE + (hc * MV_SATAHC_REG_SZ)); 850 return (base + SATAHC0_REG_BASE + (hc * MV_SATAHC_REG_SZ));
850} 851}
851 852
852static inline void __iomem *mv_hc_base_from_port(void __iomem *base, 853static inline void __iomem *mv_hc_base_from_port(void __iomem *base,
@@ -901,10 +902,10 @@ static void mv_save_cached_regs(struct ata_port *ap)
901 void __iomem *port_mmio = mv_ap_base(ap); 902 void __iomem *port_mmio = mv_ap_base(ap);
902 struct mv_port_priv *pp = ap->private_data; 903 struct mv_port_priv *pp = ap->private_data;
903 904
904 pp->cached.fiscfg = readl(port_mmio + FISCFG_OFS); 905 pp->cached.fiscfg = readl(port_mmio + FISCFG);
905 pp->cached.ltmode = readl(port_mmio + LTMODE_OFS); 906 pp->cached.ltmode = readl(port_mmio + LTMODE);
906 pp->cached.haltcond = readl(port_mmio + EDMA_HALTCOND_OFS); 907 pp->cached.haltcond = readl(port_mmio + EDMA_HALTCOND);
907 pp->cached.unknown_rsvd = readl(port_mmio + EDMA_UNKNOWN_RSVD_OFS); 908 pp->cached.unknown_rsvd = readl(port_mmio + EDMA_UNKNOWN_RSVD);
908} 909}
909 910
910/** 911/**
@@ -955,10 +956,10 @@ static void mv_set_edma_ptrs(void __iomem *port_mmio,
955 index = pp->req_idx << EDMA_REQ_Q_PTR_SHIFT; 956 index = pp->req_idx << EDMA_REQ_Q_PTR_SHIFT;
956 957
957 WARN_ON(pp->crqb_dma & 0x3ff); 958 WARN_ON(pp->crqb_dma & 0x3ff);
958 writel((pp->crqb_dma >> 16) >> 16, port_mmio + EDMA_REQ_Q_BASE_HI_OFS); 959 writel((pp->crqb_dma >> 16) >> 16, port_mmio + EDMA_REQ_Q_BASE_HI);
959 writelfl((pp->crqb_dma & EDMA_REQ_Q_BASE_LO_MASK) | index, 960 writelfl((pp->crqb_dma & EDMA_REQ_Q_BASE_LO_MASK) | index,
960 port_mmio + EDMA_REQ_Q_IN_PTR_OFS); 961 port_mmio + EDMA_REQ_Q_IN_PTR);
961 writelfl(index, port_mmio + EDMA_REQ_Q_OUT_PTR_OFS); 962 writelfl(index, port_mmio + EDMA_REQ_Q_OUT_PTR);
962 963
963 /* 964 /*
964 * initialize response queue 965 * initialize response queue
@@ -967,10 +968,10 @@ static void mv_set_edma_ptrs(void __iomem *port_mmio,
967 index = pp->resp_idx << EDMA_RSP_Q_PTR_SHIFT; 968 index = pp->resp_idx << EDMA_RSP_Q_PTR_SHIFT;
968 969
969 WARN_ON(pp->crpb_dma & 0xff); 970 WARN_ON(pp->crpb_dma & 0xff);
970 writel((pp->crpb_dma >> 16) >> 16, port_mmio + EDMA_RSP_Q_BASE_HI_OFS); 971 writel((pp->crpb_dma >> 16) >> 16, port_mmio + EDMA_RSP_Q_BASE_HI);
971 writelfl(index, port_mmio + EDMA_RSP_Q_IN_PTR_OFS); 972 writelfl(index, port_mmio + EDMA_RSP_Q_IN_PTR);
972 writelfl((pp->crpb_dma & EDMA_RSP_Q_BASE_LO_MASK) | index, 973 writelfl((pp->crpb_dma & EDMA_RSP_Q_BASE_LO_MASK) | index,
973 port_mmio + EDMA_RSP_Q_OUT_PTR_OFS); 974 port_mmio + EDMA_RSP_Q_OUT_PTR);
974} 975}
975 976
976static void mv_write_main_irq_mask(u32 mask, struct mv_host_priv *hpriv) 977static void mv_write_main_irq_mask(u32 mask, struct mv_host_priv *hpriv)
@@ -1028,15 +1029,15 @@ static void mv_clear_and_enable_port_irqs(struct ata_port *ap,
1028 u32 hc_irq_cause; 1029 u32 hc_irq_cause;
1029 1030
1030 /* clear EDMA event indicators, if any */ 1031 /* clear EDMA event indicators, if any */
1031 writelfl(0, port_mmio + EDMA_ERR_IRQ_CAUSE_OFS); 1032 writelfl(0, port_mmio + EDMA_ERR_IRQ_CAUSE);
1032 1033
1033 /* clear pending irq events */ 1034 /* clear pending irq events */
1034 hc_irq_cause = ~((DEV_IRQ | DMA_IRQ) << hardport); 1035 hc_irq_cause = ~((DEV_IRQ | DMA_IRQ) << hardport);
1035 writelfl(hc_irq_cause, hc_mmio + HC_IRQ_CAUSE_OFS); 1036 writelfl(hc_irq_cause, hc_mmio + HC_IRQ_CAUSE);
1036 1037
1037 /* clear FIS IRQ Cause */ 1038 /* clear FIS IRQ Cause */
1038 if (IS_GEN_IIE(hpriv)) 1039 if (IS_GEN_IIE(hpriv))
1039 writelfl(0, port_mmio + SATA_FIS_IRQ_CAUSE_OFS); 1040 writelfl(0, port_mmio + FIS_IRQ_CAUSE);
1040 1041
1041 mv_enable_port_irqs(ap, port_irqs); 1042 mv_enable_port_irqs(ap, port_irqs);
1042} 1043}
@@ -1072,10 +1073,10 @@ static void mv_set_irq_coalescing(struct ata_host *host,
1072 * GEN_II/GEN_IIE with dual host controllers: 1073 * GEN_II/GEN_IIE with dual host controllers:
1073 * one set of global thresholds for the entire chip. 1074 * one set of global thresholds for the entire chip.
1074 */ 1075 */
1075 writel(clks, mmio + MV_IRQ_COAL_TIME_THRESHOLD); 1076 writel(clks, mmio + IRQ_COAL_TIME_THRESHOLD);
1076 writel(count, mmio + MV_IRQ_COAL_IO_THRESHOLD); 1077 writel(count, mmio + IRQ_COAL_IO_THRESHOLD);
1077 /* clear leftover coal IRQ bit */ 1078 /* clear leftover coal IRQ bit */
1078 writel(~ALL_PORTS_COAL_IRQ, mmio + MV_IRQ_COAL_CAUSE); 1079 writel(~ALL_PORTS_COAL_IRQ, mmio + IRQ_COAL_CAUSE);
1079 if (count) 1080 if (count)
1080 coal_enable = ALL_PORTS_COAL_DONE; 1081 coal_enable = ALL_PORTS_COAL_DONE;
1081 clks = count = 0; /* force clearing of regular regs below */ 1082 clks = count = 0; /* force clearing of regular regs below */
@@ -1085,16 +1086,16 @@ static void mv_set_irq_coalescing(struct ata_host *host,
1085 * All chips: independent thresholds for each HC on the chip. 1086 * All chips: independent thresholds for each HC on the chip.
1086 */ 1087 */
1087 hc_mmio = mv_hc_base_from_port(mmio, 0); 1088 hc_mmio = mv_hc_base_from_port(mmio, 0);
1088 writel(clks, hc_mmio + HC_IRQ_COAL_TIME_THRESHOLD_OFS); 1089 writel(clks, hc_mmio + HC_IRQ_COAL_TIME_THRESHOLD);
1089 writel(count, hc_mmio + HC_IRQ_COAL_IO_THRESHOLD_OFS); 1090 writel(count, hc_mmio + HC_IRQ_COAL_IO_THRESHOLD);
1090 writel(~HC_COAL_IRQ, hc_mmio + HC_IRQ_CAUSE_OFS); 1091 writel(~HC_COAL_IRQ, hc_mmio + HC_IRQ_CAUSE);
1091 if (count) 1092 if (count)
1092 coal_enable |= PORTS_0_3_COAL_DONE; 1093 coal_enable |= PORTS_0_3_COAL_DONE;
1093 if (is_dual_hc) { 1094 if (is_dual_hc) {
1094 hc_mmio = mv_hc_base_from_port(mmio, MV_PORTS_PER_HC); 1095 hc_mmio = mv_hc_base_from_port(mmio, MV_PORTS_PER_HC);
1095 writel(clks, hc_mmio + HC_IRQ_COAL_TIME_THRESHOLD_OFS); 1096 writel(clks, hc_mmio + HC_IRQ_COAL_TIME_THRESHOLD);
1096 writel(count, hc_mmio + HC_IRQ_COAL_IO_THRESHOLD_OFS); 1097 writel(count, hc_mmio + HC_IRQ_COAL_IO_THRESHOLD);
1097 writel(~HC_COAL_IRQ, hc_mmio + HC_IRQ_CAUSE_OFS); 1098 writel(~HC_COAL_IRQ, hc_mmio + HC_IRQ_CAUSE);
1098 if (count) 1099 if (count)
1099 coal_enable |= PORTS_4_7_COAL_DONE; 1100 coal_enable |= PORTS_4_7_COAL_DONE;
1100 } 1101 }
@@ -1132,7 +1133,7 @@ static void mv_start_edma(struct ata_port *ap, void __iomem *port_mmio,
1132 mv_set_edma_ptrs(port_mmio, hpriv, pp); 1133 mv_set_edma_ptrs(port_mmio, hpriv, pp);
1133 mv_clear_and_enable_port_irqs(ap, port_mmio, DONE_IRQ|ERR_IRQ); 1134 mv_clear_and_enable_port_irqs(ap, port_mmio, DONE_IRQ|ERR_IRQ);
1134 1135
1135 writelfl(EDMA_EN, port_mmio + EDMA_CMD_OFS); 1136 writelfl(EDMA_EN, port_mmio + EDMA_CMD);
1136 pp->pp_flags |= MV_PP_FLAG_EDMA_EN; 1137 pp->pp_flags |= MV_PP_FLAG_EDMA_EN;
1137 } 1138 }
1138} 1139}
@@ -1152,7 +1153,7 @@ static void mv_wait_for_edma_empty_idle(struct ata_port *ap)
1152 * as a rough guess at what even more drives might require. 1153 * as a rough guess at what even more drives might require.
1153 */ 1154 */
1154 for (i = 0; i < timeout; ++i) { 1155 for (i = 0; i < timeout; ++i) {
1155 u32 edma_stat = readl(port_mmio + EDMA_STATUS_OFS); 1156 u32 edma_stat = readl(port_mmio + EDMA_STATUS);
1156 if ((edma_stat & empty_idle) == empty_idle) 1157 if ((edma_stat & empty_idle) == empty_idle)
1157 break; 1158 break;
1158 udelay(per_loop); 1159 udelay(per_loop);
@@ -1172,11 +1173,11 @@ static int mv_stop_edma_engine(void __iomem *port_mmio)
1172 int i; 1173 int i;
1173 1174
1174 /* Disable eDMA. The disable bit auto clears. */ 1175 /* Disable eDMA. The disable bit auto clears. */
1175 writelfl(EDMA_DS, port_mmio + EDMA_CMD_OFS); 1176 writelfl(EDMA_DS, port_mmio + EDMA_CMD);
1176 1177
1177 /* Wait for the chip to confirm eDMA is off. */ 1178 /* Wait for the chip to confirm eDMA is off. */
1178 for (i = 10000; i > 0; i--) { 1179 for (i = 10000; i > 0; i--) {
1179 u32 reg = readl(port_mmio + EDMA_CMD_OFS); 1180 u32 reg = readl(port_mmio + EDMA_CMD);
1180 if (!(reg & EDMA_EN)) 1181 if (!(reg & EDMA_EN))
1181 return 0; 1182 return 0;
1182 udelay(10); 1183 udelay(10);
@@ -1286,10 +1287,10 @@ static unsigned int mv_scr_offset(unsigned int sc_reg_in)
1286 case SCR_STATUS: 1287 case SCR_STATUS:
1287 case SCR_CONTROL: 1288 case SCR_CONTROL:
1288 case SCR_ERROR: 1289 case SCR_ERROR:
1289 ofs = SATA_STATUS_OFS + (sc_reg_in * sizeof(u32)); 1290 ofs = SATA_STATUS + (sc_reg_in * sizeof(u32));
1290 break; 1291 break;
1291 case SCR_ACTIVE: 1292 case SCR_ACTIVE:
1292 ofs = SATA_ACTIVE_OFS; /* active is not with the others */ 1293 ofs = SATA_ACTIVE; /* active is not with the others */
1293 break; 1294 break;
1294 default: 1295 default:
1295 ofs = 0xffffffffU; 1296 ofs = 0xffffffffU;
@@ -1410,9 +1411,9 @@ static void mv_config_fbs(struct ata_port *ap, int want_ncq, int want_fbs)
1410 } 1411 }
1411 1412
1412 port_mmio = mv_ap_base(ap); 1413 port_mmio = mv_ap_base(ap);
1413 mv_write_cached_reg(port_mmio + FISCFG_OFS, old_fiscfg, fiscfg); 1414 mv_write_cached_reg(port_mmio + FISCFG, old_fiscfg, fiscfg);
1414 mv_write_cached_reg(port_mmio + LTMODE_OFS, old_ltmode, ltmode); 1415 mv_write_cached_reg(port_mmio + LTMODE, old_ltmode, ltmode);
1415 mv_write_cached_reg(port_mmio + EDMA_HALTCOND_OFS, old_haltcond, haltcond); 1416 mv_write_cached_reg(port_mmio + EDMA_HALTCOND, old_haltcond, haltcond);
1416} 1417}
1417 1418
1418static void mv_60x1_errata_sata25(struct ata_port *ap, int want_ncq) 1419static void mv_60x1_errata_sata25(struct ata_port *ap, int want_ncq)
@@ -1421,13 +1422,13 @@ static void mv_60x1_errata_sata25(struct ata_port *ap, int want_ncq)
1421 u32 old, new; 1422 u32 old, new;
1422 1423
1423 /* workaround for 88SX60x1 FEr SATA#25 (part 1) */ 1424 /* workaround for 88SX60x1 FEr SATA#25 (part 1) */
1424 old = readl(hpriv->base + MV_GPIO_PORT_CTL_OFS); 1425 old = readl(hpriv->base + GPIO_PORT_CTL);
1425 if (want_ncq) 1426 if (want_ncq)
1426 new = old | (1 << 22); 1427 new = old | (1 << 22);
1427 else 1428 else
1428 new = old & ~(1 << 22); 1429 new = old & ~(1 << 22);
1429 if (new != old) 1430 if (new != old)
1430 writel(new, hpriv->base + MV_GPIO_PORT_CTL_OFS); 1431 writel(new, hpriv->base + GPIO_PORT_CTL);
1431} 1432}
1432 1433
1433/** 1434/**
@@ -1451,7 +1452,7 @@ static void mv_bmdma_enable_iie(struct ata_port *ap, int enable_bmdma)
1451 new = *old | 1; 1452 new = *old | 1;
1452 else 1453 else
1453 new = *old & ~1; 1454 new = *old & ~1;
1454 mv_write_cached_reg(mv_ap_base(ap) + EDMA_UNKNOWN_RSVD_OFS, old, new); 1455 mv_write_cached_reg(mv_ap_base(ap) + EDMA_UNKNOWN_RSVD, old, new);
1455} 1456}
1456 1457
1457/* 1458/*
@@ -1479,8 +1480,8 @@ static void mv_soc_led_blink_enable(struct ata_port *ap)
1479 return; 1480 return;
1480 hpriv->hp_flags |= MV_HP_QUIRK_LED_BLINK_EN; 1481 hpriv->hp_flags |= MV_HP_QUIRK_LED_BLINK_EN;
1481 hc_mmio = mv_hc_base_from_port(mv_host_base(host), ap->port_no); 1482 hc_mmio = mv_hc_base_from_port(mv_host_base(host), ap->port_no);
1482 led_ctrl = readl(hc_mmio + SOC_LED_CTRL_OFS); 1483 led_ctrl = readl(hc_mmio + SOC_LED_CTRL);
1483 writel(led_ctrl | SOC_LED_CTRL_BLINK, hc_mmio + SOC_LED_CTRL_OFS); 1484 writel(led_ctrl | SOC_LED_CTRL_BLINK, hc_mmio + SOC_LED_CTRL);
1484} 1485}
1485 1486
1486static void mv_soc_led_blink_disable(struct ata_port *ap) 1487static void mv_soc_led_blink_disable(struct ata_port *ap)
@@ -1505,8 +1506,8 @@ static void mv_soc_led_blink_disable(struct ata_port *ap)
1505 1506
1506 hpriv->hp_flags &= ~MV_HP_QUIRK_LED_BLINK_EN; 1507 hpriv->hp_flags &= ~MV_HP_QUIRK_LED_BLINK_EN;
1507 hc_mmio = mv_hc_base_from_port(mv_host_base(host), ap->port_no); 1508 hc_mmio = mv_hc_base_from_port(mv_host_base(host), ap->port_no);
1508 led_ctrl = readl(hc_mmio + SOC_LED_CTRL_OFS); 1509 led_ctrl = readl(hc_mmio + SOC_LED_CTRL);
1509 writel(led_ctrl & ~SOC_LED_CTRL_BLINK, hc_mmio + SOC_LED_CTRL_OFS); 1510 writel(led_ctrl & ~SOC_LED_CTRL_BLINK, hc_mmio + SOC_LED_CTRL);
1510} 1511}
1511 1512
1512static void mv_edma_cfg(struct ata_port *ap, int want_ncq, int want_edma) 1513static void mv_edma_cfg(struct ata_port *ap, int want_ncq, int want_edma)
@@ -1570,7 +1571,7 @@ static void mv_edma_cfg(struct ata_port *ap, int want_ncq, int want_edma)
1570 pp->pp_flags |= MV_PP_FLAG_NCQ_EN; 1571 pp->pp_flags |= MV_PP_FLAG_NCQ_EN;
1571 } 1572 }
1572 1573
1573 writelfl(cfg, port_mmio + EDMA_CFG_OFS); 1574 writelfl(cfg, port_mmio + EDMA_CFG);
1574} 1575}
1575 1576
1576static void mv_port_free_dma_mem(struct ata_port *ap) 1577static void mv_port_free_dma_mem(struct ata_port *ap)
@@ -1800,13 +1801,13 @@ static void mv_bmdma_setup(struct ata_queued_cmd *qc)
1800 mv_fill_sg(qc); 1801 mv_fill_sg(qc);
1801 1802
1802 /* clear all DMA cmd bits */ 1803 /* clear all DMA cmd bits */
1803 writel(0, port_mmio + BMDMA_CMD_OFS); 1804 writel(0, port_mmio + BMDMA_CMD);
1804 1805
1805 /* load PRD table addr. */ 1806 /* load PRD table addr. */
1806 writel((pp->sg_tbl_dma[qc->tag] >> 16) >> 16, 1807 writel((pp->sg_tbl_dma[qc->tag] >> 16) >> 16,
1807 port_mmio + BMDMA_PRD_HIGH_OFS); 1808 port_mmio + BMDMA_PRD_HIGH);
1808 writelfl(pp->sg_tbl_dma[qc->tag], 1809 writelfl(pp->sg_tbl_dma[qc->tag],
1809 port_mmio + BMDMA_PRD_LOW_OFS); 1810 port_mmio + BMDMA_PRD_LOW);
1810 1811
1811 /* issue r/w command */ 1812 /* issue r/w command */
1812 ap->ops->sff_exec_command(ap, &qc->tf); 1813 ap->ops->sff_exec_command(ap, &qc->tf);
@@ -1827,7 +1828,7 @@ static void mv_bmdma_start(struct ata_queued_cmd *qc)
1827 u32 cmd = (rw ? 0 : ATA_DMA_WR) | ATA_DMA_START; 1828 u32 cmd = (rw ? 0 : ATA_DMA_WR) | ATA_DMA_START;
1828 1829
1829 /* start host DMA transaction */ 1830 /* start host DMA transaction */
1830 writelfl(cmd, port_mmio + BMDMA_CMD_OFS); 1831 writelfl(cmd, port_mmio + BMDMA_CMD);
1831} 1832}
1832 1833
1833/** 1834/**
@@ -1846,9 +1847,9 @@ static void mv_bmdma_stop(struct ata_queued_cmd *qc)
1846 u32 cmd; 1847 u32 cmd;
1847 1848
1848 /* clear start/stop bit */ 1849 /* clear start/stop bit */
1849 cmd = readl(port_mmio + BMDMA_CMD_OFS); 1850 cmd = readl(port_mmio + BMDMA_CMD);
1850 cmd &= ~ATA_DMA_START; 1851 cmd &= ~ATA_DMA_START;
1851 writelfl(cmd, port_mmio + BMDMA_CMD_OFS); 1852 writelfl(cmd, port_mmio + BMDMA_CMD);
1852 1853
1853 /* one-PIO-cycle guaranteed wait, per spec, for HDMA1:0 transition */ 1854 /* one-PIO-cycle guaranteed wait, per spec, for HDMA1:0 transition */
1854 ata_sff_dma_pause(ap); 1855 ata_sff_dma_pause(ap);
@@ -1872,7 +1873,7 @@ static u8 mv_bmdma_status(struct ata_port *ap)
1872 * Other bits are valid only if ATA_DMA_ACTIVE==0, 1873 * Other bits are valid only if ATA_DMA_ACTIVE==0,
1873 * and the ATA_DMA_INTR bit doesn't exist. 1874 * and the ATA_DMA_INTR bit doesn't exist.
1874 */ 1875 */
1875 reg = readl(port_mmio + BMDMA_STATUS_OFS); 1876 reg = readl(port_mmio + BMDMA_STATUS);
1876 if (reg & ATA_DMA_ACTIVE) 1877 if (reg & ATA_DMA_ACTIVE)
1877 status = ATA_DMA_ACTIVE; 1878 status = ATA_DMA_ACTIVE;
1878 else 1879 else
@@ -2080,28 +2081,28 @@ static unsigned int mv_send_fis(struct ata_port *ap, u32 *fis, int nwords)
2080 int i, timeout = 200, final_word = nwords - 1; 2081 int i, timeout = 200, final_word = nwords - 1;
2081 2082
2082 /* Initiate FIS transmission mode */ 2083 /* Initiate FIS transmission mode */
2083 old_ifctl = readl(port_mmio + SATA_IFCTL_OFS); 2084 old_ifctl = readl(port_mmio + SATA_IFCTL);
2084 ifctl = 0x100 | (old_ifctl & 0xf); 2085 ifctl = 0x100 | (old_ifctl & 0xf);
2085 writelfl(ifctl, port_mmio + SATA_IFCTL_OFS); 2086 writelfl(ifctl, port_mmio + SATA_IFCTL);
2086 2087
2087 /* Send all words of the FIS except for the final word */ 2088 /* Send all words of the FIS except for the final word */
2088 for (i = 0; i < final_word; ++i) 2089 for (i = 0; i < final_word; ++i)
2089 writel(fis[i], port_mmio + VENDOR_UNIQUE_FIS_OFS); 2090 writel(fis[i], port_mmio + VENDOR_UNIQUE_FIS);
2090 2091
2091 /* Flag end-of-transmission, and then send the final word */ 2092 /* Flag end-of-transmission, and then send the final word */
2092 writelfl(ifctl | 0x200, port_mmio + SATA_IFCTL_OFS); 2093 writelfl(ifctl | 0x200, port_mmio + SATA_IFCTL);
2093 writelfl(fis[final_word], port_mmio + VENDOR_UNIQUE_FIS_OFS); 2094 writelfl(fis[final_word], port_mmio + VENDOR_UNIQUE_FIS);
2094 2095
2095 /* 2096 /*
2096 * Wait for FIS transmission to complete. 2097 * Wait for FIS transmission to complete.
2097 * This typically takes just a single iteration. 2098 * This typically takes just a single iteration.
2098 */ 2099 */
2099 do { 2100 do {
2100 ifstat = readl(port_mmio + SATA_IFSTAT_OFS); 2101 ifstat = readl(port_mmio + SATA_IFSTAT);
2101 } while (!(ifstat & 0x1000) && --timeout); 2102 } while (!(ifstat & 0x1000) && --timeout);
2102 2103
2103 /* Restore original port configuration */ 2104 /* Restore original port configuration */
2104 writelfl(old_ifctl, port_mmio + SATA_IFCTL_OFS); 2105 writelfl(old_ifctl, port_mmio + SATA_IFCTL);
2105 2106
2106 /* See if it worked */ 2107 /* See if it worked */
2107 if ((ifstat & 0x3000) != 0x1000) { 2108 if ((ifstat & 0x3000) != 0x1000) {
@@ -2199,7 +2200,7 @@ static unsigned int mv_qc_issue(struct ata_queued_cmd *qc)
2199 2200
2200 /* Write the request in pointer to kick the EDMA to life */ 2201 /* Write the request in pointer to kick the EDMA to life */
2201 writelfl((pp->crqb_dma & EDMA_REQ_Q_BASE_LO_MASK) | in_index, 2202 writelfl((pp->crqb_dma & EDMA_REQ_Q_BASE_LO_MASK) | in_index,
2202 port_mmio + EDMA_REQ_Q_IN_PTR_OFS); 2203 port_mmio + EDMA_REQ_Q_IN_PTR);
2203 return 0; 2204 return 0;
2204 2205
2205 case ATA_PROT_PIO: 2206 case ATA_PROT_PIO:
@@ -2310,7 +2311,7 @@ static unsigned int mv_get_err_pmp_map(struct ata_port *ap)
2310{ 2311{
2311 void __iomem *port_mmio = mv_ap_base(ap); 2312 void __iomem *port_mmio = mv_ap_base(ap);
2312 2313
2313 return readl(port_mmio + SATA_TESTCTL_OFS) >> 16; 2314 return readl(port_mmio + SATA_TESTCTL) >> 16;
2314} 2315}
2315 2316
2316static void mv_pmp_eh_prep(struct ata_port *ap, unsigned int pmp_map) 2317static void mv_pmp_eh_prep(struct ata_port *ap, unsigned int pmp_map)
@@ -2343,9 +2344,9 @@ static int mv_req_q_empty(struct ata_port *ap)
2343 void __iomem *port_mmio = mv_ap_base(ap); 2344 void __iomem *port_mmio = mv_ap_base(ap);
2344 u32 in_ptr, out_ptr; 2345 u32 in_ptr, out_ptr;
2345 2346
2346 in_ptr = (readl(port_mmio + EDMA_REQ_Q_IN_PTR_OFS) 2347 in_ptr = (readl(port_mmio + EDMA_REQ_Q_IN_PTR)
2347 >> EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK; 2348 >> EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK;
2348 out_ptr = (readl(port_mmio + EDMA_REQ_Q_OUT_PTR_OFS) 2349 out_ptr = (readl(port_mmio + EDMA_REQ_Q_OUT_PTR)
2349 >> EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK; 2350 >> EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK;
2350 return (in_ptr == out_ptr); /* 1 == queue_is_empty */ 2351 return (in_ptr == out_ptr); /* 1 == queue_is_empty */
2351} 2352}
@@ -2507,12 +2508,12 @@ static void mv_err_intr(struct ata_port *ap)
2507 sata_scr_read(&ap->link, SCR_ERROR, &serr); 2508 sata_scr_read(&ap->link, SCR_ERROR, &serr);
2508 sata_scr_write_flush(&ap->link, SCR_ERROR, serr); 2509 sata_scr_write_flush(&ap->link, SCR_ERROR, serr);
2509 2510
2510 edma_err_cause = readl(port_mmio + EDMA_ERR_IRQ_CAUSE_OFS); 2511 edma_err_cause = readl(port_mmio + EDMA_ERR_IRQ_CAUSE);
2511 if (IS_GEN_IIE(hpriv) && (edma_err_cause & EDMA_ERR_TRANS_IRQ_7)) { 2512 if (IS_GEN_IIE(hpriv) && (edma_err_cause & EDMA_ERR_TRANS_IRQ_7)) {
2512 fis_cause = readl(port_mmio + SATA_FIS_IRQ_CAUSE_OFS); 2513 fis_cause = readl(port_mmio + FIS_IRQ_CAUSE);
2513 writelfl(~fis_cause, port_mmio + SATA_FIS_IRQ_CAUSE_OFS); 2514 writelfl(~fis_cause, port_mmio + FIS_IRQ_CAUSE);
2514 } 2515 }
2515 writelfl(~edma_err_cause, port_mmio + EDMA_ERR_IRQ_CAUSE_OFS); 2516 writelfl(~edma_err_cause, port_mmio + EDMA_ERR_IRQ_CAUSE);
2516 2517
2517 if (edma_err_cause & EDMA_ERR_DEV) { 2518 if (edma_err_cause & EDMA_ERR_DEV) {
2518 /* 2519 /*
@@ -2530,7 +2531,7 @@ static void mv_err_intr(struct ata_port *ap)
2530 2531
2531 if (IS_GEN_IIE(hpriv) && (edma_err_cause & EDMA_ERR_TRANS_IRQ_7)) { 2532 if (IS_GEN_IIE(hpriv) && (edma_err_cause & EDMA_ERR_TRANS_IRQ_7)) {
2532 ata_ehi_push_desc(ehi, "fis_cause=%08x", fis_cause); 2533 ata_ehi_push_desc(ehi, "fis_cause=%08x", fis_cause);
2533 if (fis_cause & SATA_FIS_IRQ_AN) { 2534 if (fis_cause & FIS_IRQ_CAUSE_AN) {
2534 u32 ec = edma_err_cause & 2535 u32 ec = edma_err_cause &
2535 ~(EDMA_ERR_TRANS_IRQ_7 | EDMA_ERR_IRQ_TRANSIENT); 2536 ~(EDMA_ERR_TRANS_IRQ_7 | EDMA_ERR_IRQ_TRANSIENT);
2536 sata_async_notification(ap); 2537 sata_async_notification(ap);
@@ -2632,7 +2633,7 @@ static void mv_process_crpb_response(struct ata_port *ap,
2632 u16 edma_status = le16_to_cpu(response->flags); 2633 u16 edma_status = le16_to_cpu(response->flags);
2633 /* 2634 /*
2634 * edma_status from a response queue entry: 2635 * edma_status from a response queue entry:
2635 * LSB is from EDMA_ERR_IRQ_CAUSE_OFS (non-NCQ only). 2636 * LSB is from EDMA_ERR_IRQ_CAUSE (non-NCQ only).
2636 * MSB is saved ATA status from command completion. 2637 * MSB is saved ATA status from command completion.
2637 */ 2638 */
2638 if (!ncq_enabled) { 2639 if (!ncq_enabled) {
@@ -2664,7 +2665,7 @@ static void mv_process_crpb_entries(struct ata_port *ap, struct mv_port_priv *pp
2664 int ncq_enabled = (pp->pp_flags & MV_PP_FLAG_NCQ_EN); 2665 int ncq_enabled = (pp->pp_flags & MV_PP_FLAG_NCQ_EN);
2665 2666
2666 /* Get the hardware queue position index */ 2667 /* Get the hardware queue position index */
2667 in_index = (readl(port_mmio + EDMA_RSP_Q_IN_PTR_OFS) 2668 in_index = (readl(port_mmio + EDMA_RSP_Q_IN_PTR)
2668 >> EDMA_RSP_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK; 2669 >> EDMA_RSP_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK;
2669 2670
2670 /* Process new responses from since the last time we looked */ 2671 /* Process new responses from since the last time we looked */
@@ -2689,7 +2690,7 @@ static void mv_process_crpb_entries(struct ata_port *ap, struct mv_port_priv *pp
2689 if (work_done) 2690 if (work_done)
2690 writelfl((pp->crpb_dma & EDMA_RSP_Q_BASE_LO_MASK) | 2691 writelfl((pp->crpb_dma & EDMA_RSP_Q_BASE_LO_MASK) |
2691 (pp->resp_idx << EDMA_RSP_Q_PTR_SHIFT), 2692 (pp->resp_idx << EDMA_RSP_Q_PTR_SHIFT),
2692 port_mmio + EDMA_RSP_Q_OUT_PTR_OFS); 2693 port_mmio + EDMA_RSP_Q_OUT_PTR);
2693} 2694}
2694 2695
2695static void mv_port_intr(struct ata_port *ap, u32 port_cause) 2696static void mv_port_intr(struct ata_port *ap, u32 port_cause)
@@ -2746,7 +2747,7 @@ static int mv_host_intr(struct ata_host *host, u32 main_irq_cause)
2746 2747
2747 /* If asserted, clear the "all ports" IRQ coalescing bit */ 2748 /* If asserted, clear the "all ports" IRQ coalescing bit */
2748 if (main_irq_cause & ALL_PORTS_COAL_DONE) 2749 if (main_irq_cause & ALL_PORTS_COAL_DONE)
2749 writel(~ALL_PORTS_COAL_IRQ, mmio + MV_IRQ_COAL_CAUSE); 2750 writel(~ALL_PORTS_COAL_IRQ, mmio + IRQ_COAL_CAUSE);
2750 2751
2751 for (port = 0; port < hpriv->n_ports; port++) { 2752 for (port = 0; port < hpriv->n_ports; port++) {
2752 struct ata_port *ap = host->ports[port]; 2753 struct ata_port *ap = host->ports[port];
@@ -2790,7 +2791,7 @@ static int mv_host_intr(struct ata_host *host, u32 main_irq_cause)
2790 ack_irqs |= (DMA_IRQ | DEV_IRQ) << p; 2791 ack_irqs |= (DMA_IRQ | DEV_IRQ) << p;
2791 } 2792 }
2792 hc_mmio = mv_hc_base_from_port(mmio, port); 2793 hc_mmio = mv_hc_base_from_port(mmio, port);
2793 writelfl(~ack_irqs, hc_mmio + HC_IRQ_CAUSE_OFS); 2794 writelfl(~ack_irqs, hc_mmio + HC_IRQ_CAUSE);
2794 handled = 1; 2795 handled = 1;
2795 } 2796 }
2796 /* 2797 /*
@@ -2812,7 +2813,7 @@ static int mv_pci_error(struct ata_host *host, void __iomem *mmio)
2812 unsigned int i, err_mask, printed = 0; 2813 unsigned int i, err_mask, printed = 0;
2813 u32 err_cause; 2814 u32 err_cause;
2814 2815
2815 err_cause = readl(mmio + hpriv->irq_cause_ofs); 2816 err_cause = readl(mmio + hpriv->irq_cause_offset);
2816 2817
2817 dev_printk(KERN_ERR, host->dev, "PCI ERROR; PCI IRQ cause=0x%08x\n", 2818 dev_printk(KERN_ERR, host->dev, "PCI ERROR; PCI IRQ cause=0x%08x\n",
2818 err_cause); 2819 err_cause);
@@ -2820,7 +2821,7 @@ static int mv_pci_error(struct ata_host *host, void __iomem *mmio)
2820 DPRINTK("All regs @ PCI error\n"); 2821 DPRINTK("All regs @ PCI error\n");
2821 mv_dump_all_regs(mmio, -1, to_pci_dev(host->dev)); 2822 mv_dump_all_regs(mmio, -1, to_pci_dev(host->dev));
2822 2823
2823 writelfl(0, mmio + hpriv->irq_cause_ofs); 2824 writelfl(0, mmio + hpriv->irq_cause_offset);
2824 2825
2825 for (i = 0; i < host->n_ports; i++) { 2826 for (i = 0; i < host->n_ports; i++) {
2826 ap = host->ports[i]; 2827 ap = host->ports[i];
@@ -2957,7 +2958,7 @@ static void mv5_reset_bus(struct ata_host *host, void __iomem *mmio)
2957 2958
2958static void mv5_reset_flash(struct mv_host_priv *hpriv, void __iomem *mmio) 2959static void mv5_reset_flash(struct mv_host_priv *hpriv, void __iomem *mmio)
2959{ 2960{
2960 writel(0x0fcfffff, mmio + MV_FLASH_CTL_OFS); 2961 writel(0x0fcfffff, mmio + FLASH_CTL);
2961} 2962}
2962 2963
2963static void mv5_read_preamp(struct mv_host_priv *hpriv, int idx, 2964static void mv5_read_preamp(struct mv_host_priv *hpriv, int idx,
@@ -2976,7 +2977,7 @@ static void mv5_enable_leds(struct mv_host_priv *hpriv, void __iomem *mmio)
2976{ 2977{
2977 u32 tmp; 2978 u32 tmp;
2978 2979
2979 writel(0, mmio + MV_GPIO_PORT_CTL_OFS); 2980 writel(0, mmio + GPIO_PORT_CTL);
2980 2981
2981 /* FIXME: handle MV_HP_ERRATA_50XXB2 errata */ 2982 /* FIXME: handle MV_HP_ERRATA_50XXB2 errata */
2982 2983
@@ -2994,14 +2995,14 @@ static void mv5_phy_errata(struct mv_host_priv *hpriv, void __iomem *mmio,
2994 int fix_apm_sq = (hpriv->hp_flags & MV_HP_ERRATA_50XXB0); 2995 int fix_apm_sq = (hpriv->hp_flags & MV_HP_ERRATA_50XXB0);
2995 2996
2996 if (fix_apm_sq) { 2997 if (fix_apm_sq) {
2997 tmp = readl(phy_mmio + MV5_LTMODE_OFS); 2998 tmp = readl(phy_mmio + MV5_LTMODE);
2998 tmp |= (1 << 19); 2999 tmp |= (1 << 19);
2999 writel(tmp, phy_mmio + MV5_LTMODE_OFS); 3000 writel(tmp, phy_mmio + MV5_LTMODE);
3000 3001
3001 tmp = readl(phy_mmio + MV5_PHY_CTL_OFS); 3002 tmp = readl(phy_mmio + MV5_PHY_CTL);
3002 tmp &= ~0x3; 3003 tmp &= ~0x3;
3003 tmp |= 0x1; 3004 tmp |= 0x1;
3004 writel(tmp, phy_mmio + MV5_PHY_CTL_OFS); 3005 writel(tmp, phy_mmio + MV5_PHY_CTL);
3005 } 3006 }
3006 3007
3007 tmp = readl(phy_mmio + MV5_PHY_MODE); 3008 tmp = readl(phy_mmio + MV5_PHY_MODE);
@@ -3022,7 +3023,7 @@ static void mv5_reset_hc_port(struct mv_host_priv *hpriv, void __iomem *mmio,
3022 mv_reset_channel(hpriv, mmio, port); 3023 mv_reset_channel(hpriv, mmio, port);
3023 3024
3024 ZERO(0x028); /* command */ 3025 ZERO(0x028); /* command */
3025 writel(0x11f, port_mmio + EDMA_CFG_OFS); 3026 writel(0x11f, port_mmio + EDMA_CFG);
3026 ZERO(0x004); /* timer */ 3027 ZERO(0x004); /* timer */
3027 ZERO(0x008); /* irq err cause */ 3028 ZERO(0x008); /* irq err cause */
3028 ZERO(0x00c); /* irq err mask */ 3029 ZERO(0x00c); /* irq err mask */
@@ -3033,7 +3034,7 @@ static void mv5_reset_hc_port(struct mv_host_priv *hpriv, void __iomem *mmio,
3033 ZERO(0x024); /* respq outp */ 3034 ZERO(0x024); /* respq outp */
3034 ZERO(0x020); /* respq inp */ 3035 ZERO(0x020); /* respq inp */
3035 ZERO(0x02c); /* test control */ 3036 ZERO(0x02c); /* test control */
3036 writel(0xbc, port_mmio + EDMA_IORDY_TMOUT_OFS); 3037 writel(0xbc, port_mmio + EDMA_IORDY_TMOUT);
3037} 3038}
3038#undef ZERO 3039#undef ZERO
3039 3040
@@ -3079,16 +3080,16 @@ static void mv_reset_pci_bus(struct ata_host *host, void __iomem *mmio)
3079 struct mv_host_priv *hpriv = host->private_data; 3080 struct mv_host_priv *hpriv = host->private_data;
3080 u32 tmp; 3081 u32 tmp;
3081 3082
3082 tmp = readl(mmio + MV_PCI_MODE_OFS); 3083 tmp = readl(mmio + MV_PCI_MODE);
3083 tmp &= 0xff00ffff; 3084 tmp &= 0xff00ffff;
3084 writel(tmp, mmio + MV_PCI_MODE_OFS); 3085 writel(tmp, mmio + MV_PCI_MODE);
3085 3086
3086 ZERO(MV_PCI_DISC_TIMER); 3087 ZERO(MV_PCI_DISC_TIMER);
3087 ZERO(MV_PCI_MSI_TRIGGER); 3088 ZERO(MV_PCI_MSI_TRIGGER);
3088 writel(0x000100ff, mmio + MV_PCI_XBAR_TMOUT_OFS); 3089 writel(0x000100ff, mmio + MV_PCI_XBAR_TMOUT);
3089 ZERO(MV_PCI_SERR_MASK); 3090 ZERO(MV_PCI_SERR_MASK);
3090 ZERO(hpriv->irq_cause_ofs); 3091 ZERO(hpriv->irq_cause_offset);
3091 ZERO(hpriv->irq_mask_ofs); 3092 ZERO(hpriv->irq_mask_offset);
3092 ZERO(MV_PCI_ERR_LOW_ADDRESS); 3093 ZERO(MV_PCI_ERR_LOW_ADDRESS);
3093 ZERO(MV_PCI_ERR_HIGH_ADDRESS); 3094 ZERO(MV_PCI_ERR_HIGH_ADDRESS);
3094 ZERO(MV_PCI_ERR_ATTRIBUTE); 3095 ZERO(MV_PCI_ERR_ATTRIBUTE);
@@ -3102,10 +3103,10 @@ static void mv6_reset_flash(struct mv_host_priv *hpriv, void __iomem *mmio)
3102 3103
3103 mv5_reset_flash(hpriv, mmio); 3104 mv5_reset_flash(hpriv, mmio);
3104 3105
3105 tmp = readl(mmio + MV_GPIO_PORT_CTL_OFS); 3106 tmp = readl(mmio + GPIO_PORT_CTL);
3106 tmp &= 0x3; 3107 tmp &= 0x3;
3107 tmp |= (1 << 5) | (1 << 6); 3108 tmp |= (1 << 5) | (1 << 6);
3108 writel(tmp, mmio + MV_GPIO_PORT_CTL_OFS); 3109 writel(tmp, mmio + GPIO_PORT_CTL);
3109} 3110}
3110 3111
3111/** 3112/**
@@ -3120,7 +3121,7 @@ static void mv6_reset_flash(struct mv_host_priv *hpriv, void __iomem *mmio)
3120static int mv6_reset_hc(struct mv_host_priv *hpriv, void __iomem *mmio, 3121static int mv6_reset_hc(struct mv_host_priv *hpriv, void __iomem *mmio,
3121 unsigned int n_hc) 3122 unsigned int n_hc)
3122{ 3123{
3123 void __iomem *reg = mmio + PCI_MAIN_CMD_STS_OFS; 3124 void __iomem *reg = mmio + PCI_MAIN_CMD_STS;
3124 int i, rc = 0; 3125 int i, rc = 0;
3125 u32 t; 3126 u32 t;
3126 3127
@@ -3178,7 +3179,7 @@ static void mv6_read_preamp(struct mv_host_priv *hpriv, int idx,
3178 void __iomem *port_mmio; 3179 void __iomem *port_mmio;
3179 u32 tmp; 3180 u32 tmp;
3180 3181
3181 tmp = readl(mmio + MV_RESET_CFG_OFS); 3182 tmp = readl(mmio + RESET_CFG);
3182 if ((tmp & (1 << 0)) == 0) { 3183 if ((tmp & (1 << 0)) == 0) {
3183 hpriv->signal[idx].amps = 0x7 << 8; 3184 hpriv->signal[idx].amps = 0x7 << 8;
3184 hpriv->signal[idx].pre = 0x1 << 5; 3185 hpriv->signal[idx].pre = 0x1 << 5;
@@ -3186,7 +3187,7 @@ static void mv6_read_preamp(struct mv_host_priv *hpriv, int idx,
3186 } 3187 }
3187 3188
3188 port_mmio = mv_port_base(mmio, idx); 3189 port_mmio = mv_port_base(mmio, idx);
3189 tmp = readl(port_mmio + PHY_MODE2_OFS); 3190 tmp = readl(port_mmio + PHY_MODE2);
3190 3191
3191 hpriv->signal[idx].amps = tmp & 0x700; /* bits 10:8 */ 3192 hpriv->signal[idx].amps = tmp & 0x700; /* bits 10:8 */
3192 hpriv->signal[idx].pre = tmp & 0xe0; /* bits 7:5 */ 3193 hpriv->signal[idx].pre = tmp & 0xe0; /* bits 7:5 */
@@ -3194,7 +3195,7 @@ static void mv6_read_preamp(struct mv_host_priv *hpriv, int idx,
3194 3195
3195static void mv6_enable_leds(struct mv_host_priv *hpriv, void __iomem *mmio) 3196static void mv6_enable_leds(struct mv_host_priv *hpriv, void __iomem *mmio)
3196{ 3197{
3197 writel(0x00000060, mmio + MV_GPIO_PORT_CTL_OFS); 3198 writel(0x00000060, mmio + GPIO_PORT_CTL);
3198} 3199}
3199 3200
3200static void mv6_phy_errata(struct mv_host_priv *hpriv, void __iomem *mmio, 3201static void mv6_phy_errata(struct mv_host_priv *hpriv, void __iomem *mmio,
@@ -3210,25 +3211,25 @@ static void mv6_phy_errata(struct mv_host_priv *hpriv, void __iomem *mmio,
3210 u32 m2, m3; 3211 u32 m2, m3;
3211 3212
3212 if (fix_phy_mode2) { 3213 if (fix_phy_mode2) {
3213 m2 = readl(port_mmio + PHY_MODE2_OFS); 3214 m2 = readl(port_mmio + PHY_MODE2);
3214 m2 &= ~(1 << 16); 3215 m2 &= ~(1 << 16);
3215 m2 |= (1 << 31); 3216 m2 |= (1 << 31);
3216 writel(m2, port_mmio + PHY_MODE2_OFS); 3217 writel(m2, port_mmio + PHY_MODE2);
3217 3218
3218 udelay(200); 3219 udelay(200);
3219 3220
3220 m2 = readl(port_mmio + PHY_MODE2_OFS); 3221 m2 = readl(port_mmio + PHY_MODE2);
3221 m2 &= ~((1 << 16) | (1 << 31)); 3222 m2 &= ~((1 << 16) | (1 << 31));
3222 writel(m2, port_mmio + PHY_MODE2_OFS); 3223 writel(m2, port_mmio + PHY_MODE2);
3223 3224
3224 udelay(200); 3225 udelay(200);
3225 } 3226 }
3226 3227
3227 /* 3228 /*
3228 * Gen-II/IIe PHY_MODE3_OFS errata RM#2: 3229 * Gen-II/IIe PHY_MODE3 errata RM#2:
3229 * Achieves better receiver noise performance than the h/w default: 3230 * Achieves better receiver noise performance than the h/w default:
3230 */ 3231 */
3231 m3 = readl(port_mmio + PHY_MODE3_OFS); 3232 m3 = readl(port_mmio + PHY_MODE3);
3232 m3 = (m3 & 0x1f) | (0x5555601 << 5); 3233 m3 = (m3 & 0x1f) | (0x5555601 << 5);
3233 3234
3234 /* Guideline 88F5182 (GL# SATA-S11) */ 3235 /* Guideline 88F5182 (GL# SATA-S11) */
@@ -3236,7 +3237,7 @@ static void mv6_phy_errata(struct mv_host_priv *hpriv, void __iomem *mmio,
3236 m3 &= ~0x1c; 3237 m3 &= ~0x1c;
3237 3238
3238 if (fix_phy_mode4) { 3239 if (fix_phy_mode4) {
3239 u32 m4 = readl(port_mmio + PHY_MODE4_OFS); 3240 u32 m4 = readl(port_mmio + PHY_MODE4);
3240 /* 3241 /*
3241 * Enforce reserved-bit restrictions on GenIIe devices only. 3242 * Enforce reserved-bit restrictions on GenIIe devices only.
3242 * For earlier chipsets, force only the internal config field 3243 * For earlier chipsets, force only the internal config field
@@ -3246,7 +3247,7 @@ static void mv6_phy_errata(struct mv_host_priv *hpriv, void __iomem *mmio,
3246 m4 = (m4 & ~PHY_MODE4_RSVD_ZEROS) | PHY_MODE4_RSVD_ONES; 3247 m4 = (m4 & ~PHY_MODE4_RSVD_ZEROS) | PHY_MODE4_RSVD_ONES;
3247 else 3248 else
3248 m4 = (m4 & ~PHY_MODE4_CFG_MASK) | PHY_MODE4_CFG_VALUE; 3249 m4 = (m4 & ~PHY_MODE4_CFG_MASK) | PHY_MODE4_CFG_VALUE;
3249 writel(m4, port_mmio + PHY_MODE4_OFS); 3250 writel(m4, port_mmio + PHY_MODE4);
3250 } 3251 }
3251 /* 3252 /*
3252 * Workaround for 60x1-B2 errata SATA#13: 3253 * Workaround for 60x1-B2 errata SATA#13:
@@ -3254,10 +3255,10 @@ static void mv6_phy_errata(struct mv_host_priv *hpriv, void __iomem *mmio,
3254 * so we must always rewrite PHY_MODE3 after PHY_MODE4. 3255 * so we must always rewrite PHY_MODE3 after PHY_MODE4.
3255 * Or ensure we use writelfl() when writing PHY_MODE4. 3256 * Or ensure we use writelfl() when writing PHY_MODE4.
3256 */ 3257 */
3257 writel(m3, port_mmio + PHY_MODE3_OFS); 3258 writel(m3, port_mmio + PHY_MODE3);
3258 3259
3259 /* Revert values of pre-emphasis and signal amps to the saved ones */ 3260 /* Revert values of pre-emphasis and signal amps to the saved ones */
3260 m2 = readl(port_mmio + PHY_MODE2_OFS); 3261 m2 = readl(port_mmio + PHY_MODE2);
3261 3262
3262 m2 &= ~MV_M2_PREAMP_MASK; 3263 m2 &= ~MV_M2_PREAMP_MASK;
3263 m2 |= hpriv->signal[port].amps; 3264 m2 |= hpriv->signal[port].amps;
@@ -3270,7 +3271,7 @@ static void mv6_phy_errata(struct mv_host_priv *hpriv, void __iomem *mmio,
3270 m2 |= 0x0000900F; 3271 m2 |= 0x0000900F;
3271 } 3272 }
3272 3273
3273 writel(m2, port_mmio + PHY_MODE2_OFS); 3274 writel(m2, port_mmio + PHY_MODE2);
3274} 3275}
3275 3276
3276/* TODO: use the generic LED interface to configure the SATA Presence */ 3277/* TODO: use the generic LED interface to configure the SATA Presence */
@@ -3288,7 +3289,7 @@ static void mv_soc_read_preamp(struct mv_host_priv *hpriv, int idx,
3288 u32 tmp; 3289 u32 tmp;
3289 3290
3290 port_mmio = mv_port_base(mmio, idx); 3291 port_mmio = mv_port_base(mmio, idx);
3291 tmp = readl(port_mmio + PHY_MODE2_OFS); 3292 tmp = readl(port_mmio + PHY_MODE2);
3292 3293
3293 hpriv->signal[idx].amps = tmp & 0x700; /* bits 10:8 */ 3294 hpriv->signal[idx].amps = tmp & 0x700; /* bits 10:8 */
3294 hpriv->signal[idx].pre = tmp & 0xe0; /* bits 7:5 */ 3295 hpriv->signal[idx].pre = tmp & 0xe0; /* bits 7:5 */
@@ -3304,7 +3305,7 @@ static void mv_soc_reset_hc_port(struct mv_host_priv *hpriv,
3304 mv_reset_channel(hpriv, mmio, port); 3305 mv_reset_channel(hpriv, mmio, port);
3305 3306
3306 ZERO(0x028); /* command */ 3307 ZERO(0x028); /* command */
3307 writel(0x101f, port_mmio + EDMA_CFG_OFS); 3308 writel(0x101f, port_mmio + EDMA_CFG);
3308 ZERO(0x004); /* timer */ 3309 ZERO(0x004); /* timer */
3309 ZERO(0x008); /* irq err cause */ 3310 ZERO(0x008); /* irq err cause */
3310 ZERO(0x00c); /* irq err mask */ 3311 ZERO(0x00c); /* irq err mask */
@@ -3315,7 +3316,7 @@ static void mv_soc_reset_hc_port(struct mv_host_priv *hpriv,
3315 ZERO(0x024); /* respq outp */ 3316 ZERO(0x024); /* respq outp */
3316 ZERO(0x020); /* respq inp */ 3317 ZERO(0x020); /* respq inp */
3317 ZERO(0x02c); /* test control */ 3318 ZERO(0x02c); /* test control */
3318 writel(0xbc, port_mmio + EDMA_IORDY_TMOUT_OFS); 3319 writel(0xbc, port_mmio + EDMA_IORDY_TMOUT);
3319} 3320}
3320 3321
3321#undef ZERO 3322#undef ZERO
@@ -3360,12 +3361,12 @@ static void mv_soc_reset_bus(struct ata_host *host, void __iomem *mmio)
3360 3361
3361static void mv_setup_ifcfg(void __iomem *port_mmio, int want_gen2i) 3362static void mv_setup_ifcfg(void __iomem *port_mmio, int want_gen2i)
3362{ 3363{
3363 u32 ifcfg = readl(port_mmio + SATA_INTERFACE_CFG_OFS); 3364 u32 ifcfg = readl(port_mmio + SATA_IFCFG);
3364 3365
3365 ifcfg = (ifcfg & 0xf7f) | 0x9b1000; /* from chip spec */ 3366 ifcfg = (ifcfg & 0xf7f) | 0x9b1000; /* from chip spec */
3366 if (want_gen2i) 3367 if (want_gen2i)
3367 ifcfg |= (1 << 7); /* enable gen2i speed */ 3368 ifcfg |= (1 << 7); /* enable gen2i speed */
3368 writelfl(ifcfg, port_mmio + SATA_INTERFACE_CFG_OFS); 3369 writelfl(ifcfg, port_mmio + SATA_IFCFG);
3369} 3370}
3370 3371
3371static void mv_reset_channel(struct mv_host_priv *hpriv, void __iomem *mmio, 3372static void mv_reset_channel(struct mv_host_priv *hpriv, void __iomem *mmio,
@@ -3379,7 +3380,7 @@ static void mv_reset_channel(struct mv_host_priv *hpriv, void __iomem *mmio,
3379 * to disable the EDMA engine before doing the EDMA_RESET operation. 3380 * to disable the EDMA engine before doing the EDMA_RESET operation.
3380 */ 3381 */
3381 mv_stop_edma_engine(port_mmio); 3382 mv_stop_edma_engine(port_mmio);
3382 writelfl(EDMA_RESET, port_mmio + EDMA_CMD_OFS); 3383 writelfl(EDMA_RESET, port_mmio + EDMA_CMD);
3383 3384
3384 if (!IS_GEN_I(hpriv)) { 3385 if (!IS_GEN_I(hpriv)) {
3385 /* Enable 3.0gb/s link speed: this survives EDMA_RESET */ 3386 /* Enable 3.0gb/s link speed: this survives EDMA_RESET */
@@ -3388,11 +3389,11 @@ static void mv_reset_channel(struct mv_host_priv *hpriv, void __iomem *mmio,
3388 /* 3389 /*
3389 * Strobing EDMA_RESET here causes a hard reset of the SATA transport, 3390 * Strobing EDMA_RESET here causes a hard reset of the SATA transport,
3390 * link, and physical layers. It resets all SATA interface registers 3391 * link, and physical layers. It resets all SATA interface registers
3391 * (except for SATA_INTERFACE_CFG), and issues a COMRESET to the dev. 3392 * (except for SATA_IFCFG), and issues a COMRESET to the dev.
3392 */ 3393 */
3393 writelfl(EDMA_RESET, port_mmio + EDMA_CMD_OFS); 3394 writelfl(EDMA_RESET, port_mmio + EDMA_CMD);
3394 udelay(25); /* allow reset propagation */ 3395 udelay(25); /* allow reset propagation */
3395 writelfl(0, port_mmio + EDMA_CMD_OFS); 3396 writelfl(0, port_mmio + EDMA_CMD);
3396 3397
3397 hpriv->ops->phy_errata(hpriv, mmio, port_no); 3398 hpriv->ops->phy_errata(hpriv, mmio, port_no);
3398 3399
@@ -3404,12 +3405,12 @@ static void mv_pmp_select(struct ata_port *ap, int pmp)
3404{ 3405{
3405 if (sata_pmp_supported(ap)) { 3406 if (sata_pmp_supported(ap)) {
3406 void __iomem *port_mmio = mv_ap_base(ap); 3407 void __iomem *port_mmio = mv_ap_base(ap);
3407 u32 reg = readl(port_mmio + SATA_IFCTL_OFS); 3408 u32 reg = readl(port_mmio + SATA_IFCTL);
3408 int old = reg & 0xf; 3409 int old = reg & 0xf;
3409 3410
3410 if (old != pmp) { 3411 if (old != pmp) {
3411 reg = (reg & ~0xf) | pmp; 3412 reg = (reg & ~0xf) | pmp;
3412 writelfl(reg, port_mmio + SATA_IFCTL_OFS); 3413 writelfl(reg, port_mmio + SATA_IFCTL);
3413 } 3414 }
3414 } 3415 }
3415} 3416}
@@ -3484,11 +3485,11 @@ static void mv_eh_thaw(struct ata_port *ap)
3484 u32 hc_irq_cause; 3485 u32 hc_irq_cause;
3485 3486
3486 /* clear EDMA errors on this port */ 3487 /* clear EDMA errors on this port */
3487 writel(0, port_mmio + EDMA_ERR_IRQ_CAUSE_OFS); 3488 writel(0, port_mmio + EDMA_ERR_IRQ_CAUSE);
3488 3489
3489 /* clear pending irq events */ 3490 /* clear pending irq events */
3490 hc_irq_cause = ~((DEV_IRQ | DMA_IRQ) << hardport); 3491 hc_irq_cause = ~((DEV_IRQ | DMA_IRQ) << hardport);
3491 writelfl(hc_irq_cause, hc_mmio + HC_IRQ_CAUSE_OFS); 3492 writelfl(hc_irq_cause, hc_mmio + HC_IRQ_CAUSE);
3492 3493
3493 mv_enable_port_irqs(ap, ERR_IRQ); 3494 mv_enable_port_irqs(ap, ERR_IRQ);
3494} 3495}
@@ -3507,8 +3508,7 @@ static void mv_eh_thaw(struct ata_port *ap)
3507 */ 3508 */
3508static void mv_port_init(struct ata_ioports *port, void __iomem *port_mmio) 3509static void mv_port_init(struct ata_ioports *port, void __iomem *port_mmio)
3509{ 3510{
3510 void __iomem *shd_base = port_mmio + SHD_BLK_OFS; 3511 void __iomem *serr, *shd_base = port_mmio + SHD_BLK;
3511 unsigned serr_ofs;
3512 3512
3513 /* PIO related setup 3513 /* PIO related setup
3514 */ 3514 */
@@ -3523,23 +3523,23 @@ static void mv_port_init(struct ata_ioports *port, void __iomem *port_mmio)
3523 port->status_addr = 3523 port->status_addr =
3524 port->command_addr = shd_base + (sizeof(u32) * ATA_REG_STATUS); 3524 port->command_addr = shd_base + (sizeof(u32) * ATA_REG_STATUS);
3525 /* special case: control/altstatus doesn't have ATA_REG_ address */ 3525 /* special case: control/altstatus doesn't have ATA_REG_ address */
3526 port->altstatus_addr = port->ctl_addr = shd_base + SHD_CTL_AST_OFS; 3526 port->altstatus_addr = port->ctl_addr = shd_base + SHD_CTL_AST;
3527 3527
3528 /* unused: */ 3528 /* unused: */
3529 port->cmd_addr = port->bmdma_addr = port->scr_addr = NULL; 3529 port->cmd_addr = port->bmdma_addr = port->scr_addr = NULL;
3530 3530
3531 /* Clear any currently outstanding port interrupt conditions */ 3531 /* Clear any currently outstanding port interrupt conditions */
3532 serr_ofs = mv_scr_offset(SCR_ERROR); 3532 serr = port_mmio + mv_scr_offset(SCR_ERROR);
3533 writelfl(readl(port_mmio + serr_ofs), port_mmio + serr_ofs); 3533 writelfl(readl(serr), serr);
3534 writelfl(0, port_mmio + EDMA_ERR_IRQ_CAUSE_OFS); 3534 writelfl(0, port_mmio + EDMA_ERR_IRQ_CAUSE);
3535 3535
3536 /* unmask all non-transient EDMA error interrupts */ 3536 /* unmask all non-transient EDMA error interrupts */
3537 writelfl(~EDMA_ERR_IRQ_TRANSIENT, port_mmio + EDMA_ERR_IRQ_MASK_OFS); 3537 writelfl(~EDMA_ERR_IRQ_TRANSIENT, port_mmio + EDMA_ERR_IRQ_MASK);
3538 3538
3539 VPRINTK("EDMA cfg=0x%08x EDMA IRQ err cause/mask=0x%08x/0x%08x\n", 3539 VPRINTK("EDMA cfg=0x%08x EDMA IRQ err cause/mask=0x%08x/0x%08x\n",
3540 readl(port_mmio + EDMA_CFG_OFS), 3540 readl(port_mmio + EDMA_CFG),
3541 readl(port_mmio + EDMA_ERR_IRQ_CAUSE_OFS), 3541 readl(port_mmio + EDMA_ERR_IRQ_CAUSE),
3542 readl(port_mmio + EDMA_ERR_IRQ_MASK_OFS)); 3542 readl(port_mmio + EDMA_ERR_IRQ_MASK));
3543} 3543}
3544 3544
3545static unsigned int mv_in_pcix_mode(struct ata_host *host) 3545static unsigned int mv_in_pcix_mode(struct ata_host *host)
@@ -3550,7 +3550,7 @@ static unsigned int mv_in_pcix_mode(struct ata_host *host)
3550 3550
3551 if (IS_SOC(hpriv) || !IS_PCIE(hpriv)) 3551 if (IS_SOC(hpriv) || !IS_PCIE(hpriv))
3552 return 0; /* not PCI-X capable */ 3552 return 0; /* not PCI-X capable */
3553 reg = readl(mmio + MV_PCI_MODE_OFS); 3553 reg = readl(mmio + MV_PCI_MODE);
3554 if ((reg & MV_PCI_MODE_MASK) == 0) 3554 if ((reg & MV_PCI_MODE_MASK) == 0)
3555 return 0; /* conventional PCI mode */ 3555 return 0; /* conventional PCI mode */
3556 return 1; /* chip is in PCI-X mode */ 3556 return 1; /* chip is in PCI-X mode */
@@ -3563,8 +3563,8 @@ static int mv_pci_cut_through_okay(struct ata_host *host)
3563 u32 reg; 3563 u32 reg;
3564 3564
3565 if (!mv_in_pcix_mode(host)) { 3565 if (!mv_in_pcix_mode(host)) {
3566 reg = readl(mmio + PCI_COMMAND_OFS); 3566 reg = readl(mmio + MV_PCI_COMMAND);
3567 if (reg & PCI_COMMAND_MRDTRIG) 3567 if (reg & MV_PCI_COMMAND_MRDTRIG)
3568 return 0; /* not okay */ 3568 return 0; /* not okay */
3569 } 3569 }
3570 return 1; /* okay */ 3570 return 1; /* okay */
@@ -3577,8 +3577,8 @@ static void mv_60x1b2_errata_pci7(struct ata_host *host)
3577 3577
3578 /* workaround for 60x1-B2 errata PCI#7 */ 3578 /* workaround for 60x1-B2 errata PCI#7 */
3579 if (mv_in_pcix_mode(host)) { 3579 if (mv_in_pcix_mode(host)) {
3580 u32 reg = readl(mmio + PCI_COMMAND_OFS); 3580 u32 reg = readl(mmio + MV_PCI_COMMAND);
3581 writelfl(reg & ~PCI_COMMAND_MWRCOM, mmio + PCI_COMMAND_OFS); 3581 writelfl(reg & ~MV_PCI_COMMAND_MWRCOM, mmio + MV_PCI_COMMAND);
3582 } 3582 }
3583} 3583}
3584 3584
@@ -3712,12 +3712,12 @@ static int mv_chip_id(struct ata_host *host, unsigned int board_idx)
3712 3712
3713 hpriv->hp_flags = hp_flags; 3713 hpriv->hp_flags = hp_flags;
3714 if (hp_flags & MV_HP_PCIE) { 3714 if (hp_flags & MV_HP_PCIE) {
3715 hpriv->irq_cause_ofs = PCIE_IRQ_CAUSE_OFS; 3715 hpriv->irq_cause_offset = PCIE_IRQ_CAUSE;
3716 hpriv->irq_mask_ofs = PCIE_IRQ_MASK_OFS; 3716 hpriv->irq_mask_offset = PCIE_IRQ_MASK;
3717 hpriv->unmask_all_irqs = PCIE_UNMASK_ALL_IRQS; 3717 hpriv->unmask_all_irqs = PCIE_UNMASK_ALL_IRQS;
3718 } else { 3718 } else {
3719 hpriv->irq_cause_ofs = PCI_IRQ_CAUSE_OFS; 3719 hpriv->irq_cause_offset = PCI_IRQ_CAUSE;
3720 hpriv->irq_mask_ofs = PCI_IRQ_MASK_OFS; 3720 hpriv->irq_mask_offset = PCI_IRQ_MASK;
3721 hpriv->unmask_all_irqs = PCI_UNMASK_ALL_IRQS; 3721 hpriv->unmask_all_irqs = PCI_UNMASK_ALL_IRQS;
3722 } 3722 }
3723 3723
@@ -3746,11 +3746,11 @@ static int mv_init_host(struct ata_host *host, unsigned int board_idx)
3746 goto done; 3746 goto done;
3747 3747
3748 if (IS_SOC(hpriv)) { 3748 if (IS_SOC(hpriv)) {
3749 hpriv->main_irq_cause_addr = mmio + SOC_HC_MAIN_IRQ_CAUSE_OFS; 3749 hpriv->main_irq_cause_addr = mmio + SOC_HC_MAIN_IRQ_CAUSE;
3750 hpriv->main_irq_mask_addr = mmio + SOC_HC_MAIN_IRQ_MASK_OFS; 3750 hpriv->main_irq_mask_addr = mmio + SOC_HC_MAIN_IRQ_MASK;
3751 } else { 3751 } else {
3752 hpriv->main_irq_cause_addr = mmio + PCI_HC_MAIN_IRQ_CAUSE_OFS; 3752 hpriv->main_irq_cause_addr = mmio + PCI_HC_MAIN_IRQ_CAUSE;
3753 hpriv->main_irq_mask_addr = mmio + PCI_HC_MAIN_IRQ_MASK_OFS; 3753 hpriv->main_irq_mask_addr = mmio + PCI_HC_MAIN_IRQ_MASK;
3754 } 3754 }
3755 3755
3756 /* initialize shadow irq mask with register's value */ 3756 /* initialize shadow irq mask with register's value */
@@ -3792,19 +3792,19 @@ static int mv_init_host(struct ata_host *host, unsigned int board_idx)
3792 3792
3793 VPRINTK("HC%i: HC config=0x%08x HC IRQ cause " 3793 VPRINTK("HC%i: HC config=0x%08x HC IRQ cause "
3794 "(before clear)=0x%08x\n", hc, 3794 "(before clear)=0x%08x\n", hc,
3795 readl(hc_mmio + HC_CFG_OFS), 3795 readl(hc_mmio + HC_CFG),
3796 readl(hc_mmio + HC_IRQ_CAUSE_OFS)); 3796 readl(hc_mmio + HC_IRQ_CAUSE));
3797 3797
3798 /* Clear any currently outstanding hc interrupt conditions */ 3798 /* Clear any currently outstanding hc interrupt conditions */
3799 writelfl(0, hc_mmio + HC_IRQ_CAUSE_OFS); 3799 writelfl(0, hc_mmio + HC_IRQ_CAUSE);
3800 } 3800 }
3801 3801
3802 if (!IS_SOC(hpriv)) { 3802 if (!IS_SOC(hpriv)) {
3803 /* Clear any currently outstanding host interrupt conditions */ 3803 /* Clear any currently outstanding host interrupt conditions */
3804 writelfl(0, mmio + hpriv->irq_cause_ofs); 3804 writelfl(0, mmio + hpriv->irq_cause_offset);
3805 3805
3806 /* and unmask interrupt generation for host regs */ 3806 /* and unmask interrupt generation for host regs */
3807 writelfl(hpriv->unmask_all_irqs, mmio + hpriv->irq_mask_ofs); 3807 writelfl(hpriv->unmask_all_irqs, mmio + hpriv->irq_mask_offset);
3808 } 3808 }
3809 3809
3810 /* 3810 /*
@@ -3911,7 +3911,7 @@ static int mv_platform_probe(struct platform_device *pdev)
3911 host->iomap = NULL; 3911 host->iomap = NULL;
3912 hpriv->base = devm_ioremap(&pdev->dev, res->start, 3912 hpriv->base = devm_ioremap(&pdev->dev, res->start,
3913 res->end - res->start + 1); 3913 res->end - res->start + 1);
3914 hpriv->base -= MV_SATAHC0_REG_BASE; 3914 hpriv->base -= SATAHC0_REG_BASE;
3915 3915
3916 /* 3916 /*
3917 * (Re-)program MBUS remapping windows if we are asked to. 3917 * (Re-)program MBUS remapping windows if we are asked to.