diff options
-rw-r--r-- | drivers/ata/Kconfig | 1 | ||||
-rw-r--r-- | drivers/ata/Makefile | 1 | ||||
-rw-r--r-- | drivers/ata/ahci.c | 11 | ||||
-rw-r--r-- | drivers/ata/ahci.h | 1 | ||||
-rw-r--r-- | drivers/ata/libahci.c | 16 | ||||
-rw-r--r-- | drivers/ata/libata-core.c | 11 | ||||
-rw-r--r-- | drivers/ata/libata-sff.c | 4 | ||||
-rw-r--r-- | drivers/ata/pata_cmd64x.c | 6 | ||||
-rw-r--r-- | drivers/ata/pata_legacy.c | 15 | ||||
-rw-r--r-- | drivers/ata/pata_winbond.c | 282 | ||||
-rw-r--r-- | drivers/ata/sata_dwc_460ex.c | 2 | ||||
-rw-r--r-- | drivers/ata/sata_mv.c | 44 |
12 files changed, 85 insertions, 309 deletions
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig index 65e3e2708371..11ec911016c6 100644 --- a/drivers/ata/Kconfig +++ b/drivers/ata/Kconfig | |||
@@ -828,6 +828,7 @@ config PATA_SAMSUNG_CF | |||
828 | config PATA_WINBOND_VLB | 828 | config PATA_WINBOND_VLB |
829 | tristate "Winbond W83759A VLB PATA support (Experimental)" | 829 | tristate "Winbond W83759A VLB PATA support (Experimental)" |
830 | depends on ISA && EXPERIMENTAL | 830 | depends on ISA && EXPERIMENTAL |
831 | select PATA_LEGACY | ||
831 | help | 832 | help |
832 | Support for the Winbond W83759A controller on Vesa Local Bus | 833 | Support for the Winbond W83759A controller on Vesa Local Bus |
833 | systems. | 834 | systems. |
diff --git a/drivers/ata/Makefile b/drivers/ata/Makefile index 158eaa961b1e..d5df04a395ca 100644 --- a/drivers/ata/Makefile +++ b/drivers/ata/Makefile | |||
@@ -89,7 +89,6 @@ obj-$(CONFIG_PATA_QDI) += pata_qdi.o | |||
89 | obj-$(CONFIG_PATA_RB532) += pata_rb532_cf.o | 89 | obj-$(CONFIG_PATA_RB532) += pata_rb532_cf.o |
90 | obj-$(CONFIG_PATA_RZ1000) += pata_rz1000.o | 90 | obj-$(CONFIG_PATA_RZ1000) += pata_rz1000.o |
91 | obj-$(CONFIG_PATA_SAMSUNG_CF) += pata_samsung_cf.o | 91 | obj-$(CONFIG_PATA_SAMSUNG_CF) += pata_samsung_cf.o |
92 | obj-$(CONFIG_PATA_WINBOND_VLB) += pata_winbond.o | ||
93 | 92 | ||
94 | obj-$(CONFIG_PATA_PXA) += pata_pxa.o | 93 | obj-$(CONFIG_PATA_PXA) += pata_pxa.o |
95 | 94 | ||
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index fe75d8befc3a..013727b20417 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
@@ -60,6 +60,7 @@ enum board_ids { | |||
60 | board_ahci, | 60 | board_ahci, |
61 | board_ahci_ign_iferr, | 61 | board_ahci_ign_iferr, |
62 | board_ahci_nosntf, | 62 | board_ahci_nosntf, |
63 | board_ahci_yes_fbs, | ||
63 | 64 | ||
64 | /* board IDs for specific chipsets in alphabetical order */ | 65 | /* board IDs for specific chipsets in alphabetical order */ |
65 | board_ahci_mcp65, | 66 | board_ahci_mcp65, |
@@ -132,6 +133,14 @@ static const struct ata_port_info ahci_port_info[] = { | |||
132 | .udma_mask = ATA_UDMA6, | 133 | .udma_mask = ATA_UDMA6, |
133 | .port_ops = &ahci_ops, | 134 | .port_ops = &ahci_ops, |
134 | }, | 135 | }, |
136 | [board_ahci_yes_fbs] = | ||
137 | { | ||
138 | AHCI_HFLAGS (AHCI_HFLAG_YES_FBS), | ||
139 | .flags = AHCI_FLAG_COMMON, | ||
140 | .pio_mask = ATA_PIO4, | ||
141 | .udma_mask = ATA_UDMA6, | ||
142 | .port_ops = &ahci_ops, | ||
143 | }, | ||
135 | /* by chipsets */ | 144 | /* by chipsets */ |
136 | [board_ahci_mcp65] = | 145 | [board_ahci_mcp65] = |
137 | { | 146 | { |
@@ -362,6 +371,8 @@ static const struct pci_device_id ahci_pci_tbl[] = { | |||
362 | /* Marvell */ | 371 | /* Marvell */ |
363 | { PCI_VDEVICE(MARVELL, 0x6145), board_ahci_mv }, /* 6145 */ | 372 | { PCI_VDEVICE(MARVELL, 0x6145), board_ahci_mv }, /* 6145 */ |
364 | { PCI_VDEVICE(MARVELL, 0x6121), board_ahci_mv }, /* 6121 */ | 373 | { PCI_VDEVICE(MARVELL, 0x6121), board_ahci_mv }, /* 6121 */ |
374 | { PCI_DEVICE(0x1b4b, 0x9123), | ||
375 | .driver_data = board_ahci_yes_fbs }, /* 88se9128 */ | ||
365 | 376 | ||
366 | /* Promise */ | 377 | /* Promise */ |
367 | { PCI_VDEVICE(PROMISE, 0x3f20), board_ahci }, /* PDC42819 */ | 378 | { PCI_VDEVICE(PROMISE, 0x3f20), board_ahci }, /* PDC42819 */ |
diff --git a/drivers/ata/ahci.h b/drivers/ata/ahci.h index 7113c5724471..474427b6f99f 100644 --- a/drivers/ata/ahci.h +++ b/drivers/ata/ahci.h | |||
@@ -209,6 +209,7 @@ enum { | |||
209 | link offline */ | 209 | link offline */ |
210 | AHCI_HFLAG_NO_SNTF = (1 << 12), /* no sntf */ | 210 | AHCI_HFLAG_NO_SNTF = (1 << 12), /* no sntf */ |
211 | AHCI_HFLAG_NO_FPDMA_AA = (1 << 13), /* no FPDMA AA */ | 211 | AHCI_HFLAG_NO_FPDMA_AA = (1 << 13), /* no FPDMA AA */ |
212 | AHCI_HFLAG_YES_FBS = (1 << 14), /* force FBS cap on */ | ||
212 | 213 | ||
213 | /* ap->flags bits */ | 214 | /* ap->flags bits */ |
214 | 215 | ||
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c index 81e772a94d59..666850d31df2 100644 --- a/drivers/ata/libahci.c +++ b/drivers/ata/libahci.c | |||
@@ -430,6 +430,12 @@ void ahci_save_initial_config(struct device *dev, | |||
430 | cap &= ~HOST_CAP_SNTF; | 430 | cap &= ~HOST_CAP_SNTF; |
431 | } | 431 | } |
432 | 432 | ||
433 | if (!(cap & HOST_CAP_FBS) && (hpriv->flags & AHCI_HFLAG_YES_FBS)) { | ||
434 | dev_printk(KERN_INFO, dev, | ||
435 | "controller can do FBS, turning on CAP_FBS\n"); | ||
436 | cap |= HOST_CAP_FBS; | ||
437 | } | ||
438 | |||
433 | if (force_port_map && port_map != force_port_map) { | 439 | if (force_port_map && port_map != force_port_map) { |
434 | dev_printk(KERN_INFO, dev, "forcing port_map 0x%x -> 0x%x\n", | 440 | dev_printk(KERN_INFO, dev, "forcing port_map 0x%x -> 0x%x\n", |
435 | port_map, force_port_map); | 441 | port_map, force_port_map); |
@@ -2036,9 +2042,15 @@ static int ahci_port_start(struct ata_port *ap) | |||
2036 | u32 cmd = readl(port_mmio + PORT_CMD); | 2042 | u32 cmd = readl(port_mmio + PORT_CMD); |
2037 | if (cmd & PORT_CMD_FBSCP) | 2043 | if (cmd & PORT_CMD_FBSCP) |
2038 | pp->fbs_supported = true; | 2044 | pp->fbs_supported = true; |
2039 | else | 2045 | else if (hpriv->flags & AHCI_HFLAG_YES_FBS) { |
2046 | dev_printk(KERN_INFO, dev, | ||
2047 | "port %d can do FBS, forcing FBSCP\n", | ||
2048 | ap->port_no); | ||
2049 | pp->fbs_supported = true; | ||
2050 | } else | ||
2040 | dev_printk(KERN_WARNING, dev, | 2051 | dev_printk(KERN_WARNING, dev, |
2041 | "The port is not capable of FBS\n"); | 2052 | "port %d is not capable of FBS\n", |
2053 | ap->port_no); | ||
2042 | } | 2054 | } |
2043 | 2055 | ||
2044 | if (pp->fbs_supported) { | 2056 | if (pp->fbs_supported) { |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 7ef7c4f216fa..c035b3d041ee 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -5111,15 +5111,18 @@ void ata_qc_issue(struct ata_queued_cmd *qc) | |||
5111 | qc->flags |= ATA_QCFLAG_ACTIVE; | 5111 | qc->flags |= ATA_QCFLAG_ACTIVE; |
5112 | ap->qc_active |= 1 << qc->tag; | 5112 | ap->qc_active |= 1 << qc->tag; |
5113 | 5113 | ||
5114 | /* We guarantee to LLDs that they will have at least one | 5114 | /* |
5115 | * We guarantee to LLDs that they will have at least one | ||
5115 | * non-zero sg if the command is a data command. | 5116 | * non-zero sg if the command is a data command. |
5116 | */ | 5117 | */ |
5117 | BUG_ON(ata_is_data(prot) && (!qc->sg || !qc->n_elem || !qc->nbytes)); | 5118 | if (WARN_ON_ONCE(ata_is_data(prot) && |
5119 | (!qc->sg || !qc->n_elem || !qc->nbytes))) | ||
5120 | goto sys_err; | ||
5118 | 5121 | ||
5119 | if (ata_is_dma(prot) || (ata_is_pio(prot) && | 5122 | if (ata_is_dma(prot) || (ata_is_pio(prot) && |
5120 | (ap->flags & ATA_FLAG_PIO_DMA))) | 5123 | (ap->flags & ATA_FLAG_PIO_DMA))) |
5121 | if (ata_sg_setup(qc)) | 5124 | if (ata_sg_setup(qc)) |
5122 | goto sg_err; | 5125 | goto sys_err; |
5123 | 5126 | ||
5124 | /* if device is sleeping, schedule reset and abort the link */ | 5127 | /* if device is sleeping, schedule reset and abort the link */ |
5125 | if (unlikely(qc->dev->flags & ATA_DFLAG_SLEEPING)) { | 5128 | if (unlikely(qc->dev->flags & ATA_DFLAG_SLEEPING)) { |
@@ -5136,7 +5139,7 @@ void ata_qc_issue(struct ata_queued_cmd *qc) | |||
5136 | goto err; | 5139 | goto err; |
5137 | return; | 5140 | return; |
5138 | 5141 | ||
5139 | sg_err: | 5142 | sys_err: |
5140 | qc->err_mask |= AC_ERR_SYSTEM; | 5143 | qc->err_mask |= AC_ERR_SYSTEM; |
5141 | err: | 5144 | err: |
5142 | ata_qc_complete(qc); | 5145 | ata_qc_complete(qc); |
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c index 674c1436491f..3b82d8ef76f0 100644 --- a/drivers/ata/libata-sff.c +++ b/drivers/ata/libata-sff.c | |||
@@ -2735,10 +2735,6 @@ unsigned int ata_bmdma_qc_issue(struct ata_queued_cmd *qc) | |||
2735 | { | 2735 | { |
2736 | struct ata_port *ap = qc->ap; | 2736 | struct ata_port *ap = qc->ap; |
2737 | 2737 | ||
2738 | /* see ata_dma_blacklisted() */ | ||
2739 | BUG_ON((ap->flags & ATA_FLAG_PIO_POLLING) && | ||
2740 | qc->tf.protocol == ATAPI_PROT_DMA); | ||
2741 | |||
2742 | /* defer PIO handling to sff_qc_issue */ | 2738 | /* defer PIO handling to sff_qc_issue */ |
2743 | if (!ata_is_dma(qc->tf.protocol)) | 2739 | if (!ata_is_dma(qc->tf.protocol)) |
2744 | return ata_sff_qc_issue(qc); | 2740 | return ata_sff_qc_issue(qc); |
diff --git a/drivers/ata/pata_cmd64x.c b/drivers/ata/pata_cmd64x.c index 9f5da1c7454b..905ff76d3cbb 100644 --- a/drivers/ata/pata_cmd64x.c +++ b/drivers/ata/pata_cmd64x.c | |||
@@ -121,14 +121,8 @@ static void cmd64x_set_timing(struct ata_port *ap, struct ata_device *adev, u8 m | |||
121 | 121 | ||
122 | if (pair) { | 122 | if (pair) { |
123 | struct ata_timing tp; | 123 | struct ata_timing tp; |
124 | |||
125 | ata_timing_compute(pair, pair->pio_mode, &tp, T, 0); | 124 | ata_timing_compute(pair, pair->pio_mode, &tp, T, 0); |
126 | ata_timing_merge(&t, &tp, &t, ATA_TIMING_SETUP); | 125 | ata_timing_merge(&t, &tp, &t, ATA_TIMING_SETUP); |
127 | if (pair->dma_mode) { | ||
128 | ata_timing_compute(pair, pair->dma_mode, | ||
129 | &tp, T, 0); | ||
130 | ata_timing_merge(&tp, &t, &t, ATA_TIMING_SETUP); | ||
131 | } | ||
132 | } | 126 | } |
133 | } | 127 | } |
134 | 128 | ||
diff --git a/drivers/ata/pata_legacy.c b/drivers/ata/pata_legacy.c index 9df1ff7e1eaa..eaf194138f21 100644 --- a/drivers/ata/pata_legacy.c +++ b/drivers/ata/pata_legacy.c | |||
@@ -44,6 +44,9 @@ | |||
44 | * Specific support is included for the ht6560a/ht6560b/opti82c611a/ | 44 | * Specific support is included for the ht6560a/ht6560b/opti82c611a/ |
45 | * opti82c465mv/promise 20230c/20630/qdi65x0/winbond83759A | 45 | * opti82c465mv/promise 20230c/20630/qdi65x0/winbond83759A |
46 | * | 46 | * |
47 | * Support for the Winbond 83759A when operating in advanced mode. | ||
48 | * Multichip mode is not currently supported. | ||
49 | * | ||
47 | * Use the autospeed and pio_mask options with: | 50 | * Use the autospeed and pio_mask options with: |
48 | * Appian ADI/2 aka CLPD7220 or AIC25VL01. | 51 | * Appian ADI/2 aka CLPD7220 or AIC25VL01. |
49 | * Use the jumpers, autospeed and set pio_mask to the mode on the jumpers with | 52 | * Use the jumpers, autospeed and set pio_mask to the mode on the jumpers with |
@@ -135,12 +138,18 @@ static int ht6560b; /* HT 6560A on primary 1, second 2, both 3 */ | |||
135 | static int opti82c611a; /* Opti82c611A on primary 1, sec 2, both 3 */ | 138 | static int opti82c611a; /* Opti82c611A on primary 1, sec 2, both 3 */ |
136 | static int opti82c46x; /* Opti 82c465MV present(pri/sec autodetect) */ | 139 | static int opti82c46x; /* Opti 82c465MV present(pri/sec autodetect) */ |
137 | static int qdi; /* Set to probe QDI controllers */ | 140 | static int qdi; /* Set to probe QDI controllers */ |
138 | static int winbond; /* Set to probe Winbond controllers, | ||
139 | give I/O port if non standard */ | ||
140 | static int autospeed; /* Chip present which snoops speed changes */ | 141 | static int autospeed; /* Chip present which snoops speed changes */ |
141 | static int pio_mask = ATA_PIO4; /* PIO range for autospeed devices */ | 142 | static int pio_mask = ATA_PIO4; /* PIO range for autospeed devices */ |
142 | static int iordy_mask = 0xFFFFFFFF; /* Use iordy if available */ | 143 | static int iordy_mask = 0xFFFFFFFF; /* Use iordy if available */ |
143 | 144 | ||
145 | #ifdef PATA_WINBOND_VLB_MODULE | ||
146 | static int winbond = 1; /* Set to probe Winbond controllers, | ||
147 | give I/O port if non standard */ | ||
148 | #else | ||
149 | static int winbond; /* Set to probe Winbond controllers, | ||
150 | give I/O port if non standard */ | ||
151 | #endif | ||
152 | |||
144 | /** | 153 | /** |
145 | * legacy_probe_add - Add interface to probe list | 154 | * legacy_probe_add - Add interface to probe list |
146 | * @port: Controller port | 155 | * @port: Controller port |
@@ -1297,6 +1306,7 @@ MODULE_AUTHOR("Alan Cox"); | |||
1297 | MODULE_DESCRIPTION("low-level driver for legacy ATA"); | 1306 | MODULE_DESCRIPTION("low-level driver for legacy ATA"); |
1298 | MODULE_LICENSE("GPL"); | 1307 | MODULE_LICENSE("GPL"); |
1299 | MODULE_VERSION(DRV_VERSION); | 1308 | MODULE_VERSION(DRV_VERSION); |
1309 | MODULE_ALIAS("pata_winbond"); | ||
1300 | 1310 | ||
1301 | module_param(probe_all, int, 0); | 1311 | module_param(probe_all, int, 0); |
1302 | module_param(autospeed, int, 0); | 1312 | module_param(autospeed, int, 0); |
@@ -1305,6 +1315,7 @@ module_param(ht6560b, int, 0); | |||
1305 | module_param(opti82c611a, int, 0); | 1315 | module_param(opti82c611a, int, 0); |
1306 | module_param(opti82c46x, int, 0); | 1316 | module_param(opti82c46x, int, 0); |
1307 | module_param(qdi, int, 0); | 1317 | module_param(qdi, int, 0); |
1318 | module_param(winbond, int, 0); | ||
1308 | module_param(pio_mask, int, 0); | 1319 | module_param(pio_mask, int, 0); |
1309 | module_param(iordy_mask, int, 0); | 1320 | module_param(iordy_mask, int, 0); |
1310 | 1321 | ||
diff --git a/drivers/ata/pata_winbond.c b/drivers/ata/pata_winbond.c deleted file mode 100644 index 6d8619b6f670..000000000000 --- a/drivers/ata/pata_winbond.c +++ /dev/null | |||
@@ -1,282 +0,0 @@ | |||
1 | /* | ||
2 | * pata_winbond.c - Winbond VLB ATA controllers | ||
3 | * (C) 2006 Red Hat | ||
4 | * | ||
5 | * Support for the Winbond 83759A when operating in advanced mode. | ||
6 | * Multichip mode is not currently supported. | ||
7 | */ | ||
8 | |||
9 | #include <linux/kernel.h> | ||
10 | #include <linux/module.h> | ||
11 | #include <linux/init.h> | ||
12 | #include <linux/blkdev.h> | ||
13 | #include <linux/delay.h> | ||
14 | #include <scsi/scsi_host.h> | ||
15 | #include <linux/libata.h> | ||
16 | #include <linux/platform_device.h> | ||
17 | |||
18 | #define DRV_NAME "pata_winbond" | ||
19 | #define DRV_VERSION "0.0.3" | ||
20 | |||
21 | #define NR_HOST 4 /* Two winbond controllers, two channels each */ | ||
22 | |||
23 | struct winbond_data { | ||
24 | unsigned long config; | ||
25 | struct platform_device *platform_dev; | ||
26 | }; | ||
27 | |||
28 | static struct ata_host *winbond_host[NR_HOST]; | ||
29 | static struct winbond_data winbond_data[NR_HOST]; | ||
30 | static int nr_winbond_host; | ||
31 | |||
32 | #ifdef MODULE | ||
33 | static int probe_winbond = 1; | ||
34 | #else | ||
35 | static int probe_winbond; | ||
36 | #endif | ||
37 | |||
38 | static DEFINE_SPINLOCK(winbond_lock); | ||
39 | |||
40 | static void winbond_writecfg(unsigned long port, u8 reg, u8 val) | ||
41 | { | ||
42 | unsigned long flags; | ||
43 | spin_lock_irqsave(&winbond_lock, flags); | ||
44 | outb(reg, port + 0x01); | ||
45 | outb(val, port + 0x02); | ||
46 | spin_unlock_irqrestore(&winbond_lock, flags); | ||
47 | } | ||
48 | |||
49 | static u8 winbond_readcfg(unsigned long port, u8 reg) | ||
50 | { | ||
51 | u8 val; | ||
52 | |||
53 | unsigned long flags; | ||
54 | spin_lock_irqsave(&winbond_lock, flags); | ||
55 | outb(reg, port + 0x01); | ||
56 | val = inb(port + 0x02); | ||
57 | spin_unlock_irqrestore(&winbond_lock, flags); | ||
58 | |||
59 | return val; | ||
60 | } | ||
61 | |||
62 | static void winbond_set_piomode(struct ata_port *ap, struct ata_device *adev) | ||
63 | { | ||
64 | struct ata_timing t; | ||
65 | struct winbond_data *winbond = ap->host->private_data; | ||
66 | int active, recovery; | ||
67 | u8 reg; | ||
68 | int timing = 0x88 + (ap->port_no * 4) + (adev->devno * 2); | ||
69 | |||
70 | reg = winbond_readcfg(winbond->config, 0x81); | ||
71 | |||
72 | /* Get the timing data in cycles */ | ||
73 | if (reg & 0x40) /* Fast VLB bus, assume 50MHz */ | ||
74 | ata_timing_compute(adev, adev->pio_mode, &t, 20000, 1000); | ||
75 | else | ||
76 | ata_timing_compute(adev, adev->pio_mode, &t, 30303, 1000); | ||
77 | |||
78 | active = (clamp_val(t.active, 3, 17) - 1) & 0x0F; | ||
79 | recovery = (clamp_val(t.recover, 1, 15) + 1) & 0x0F; | ||
80 | timing = (active << 4) | recovery; | ||
81 | winbond_writecfg(winbond->config, timing, reg); | ||
82 | |||
83 | /* Load the setup timing */ | ||
84 | |||
85 | reg = 0x35; | ||
86 | if (adev->class != ATA_DEV_ATA) | ||
87 | reg |= 0x08; /* FIFO off */ | ||
88 | if (!ata_pio_need_iordy(adev)) | ||
89 | reg |= 0x02; /* IORDY off */ | ||
90 | reg |= (clamp_val(t.setup, 0, 3) << 6); | ||
91 | winbond_writecfg(winbond->config, timing + 1, reg); | ||
92 | } | ||
93 | |||
94 | |||
95 | static unsigned int winbond_data_xfer(struct ata_device *dev, | ||
96 | unsigned char *buf, unsigned int buflen, int rw) | ||
97 | { | ||
98 | struct ata_port *ap = dev->link->ap; | ||
99 | int slop = buflen & 3; | ||
100 | |||
101 | if (ata_id_has_dword_io(dev->id)) { | ||
102 | if (rw == READ) | ||
103 | ioread32_rep(ap->ioaddr.data_addr, buf, buflen >> 2); | ||
104 | else | ||
105 | iowrite32_rep(ap->ioaddr.data_addr, buf, buflen >> 2); | ||
106 | |||
107 | if (unlikely(slop)) { | ||
108 | __le32 pad; | ||
109 | if (rw == READ) { | ||
110 | pad = cpu_to_le32(ioread32(ap->ioaddr.data_addr)); | ||
111 | memcpy(buf + buflen - slop, &pad, slop); | ||
112 | } else { | ||
113 | memcpy(&pad, buf + buflen - slop, slop); | ||
114 | iowrite32(le32_to_cpu(pad), ap->ioaddr.data_addr); | ||
115 | } | ||
116 | buflen += 4 - slop; | ||
117 | } | ||
118 | } else | ||
119 | buflen = ata_sff_data_xfer(dev, buf, buflen, rw); | ||
120 | |||
121 | return buflen; | ||
122 | } | ||
123 | |||
124 | static struct scsi_host_template winbond_sht = { | ||
125 | ATA_PIO_SHT(DRV_NAME), | ||
126 | }; | ||
127 | |||
128 | static struct ata_port_operations winbond_port_ops = { | ||
129 | .inherits = &ata_sff_port_ops, | ||
130 | .sff_data_xfer = winbond_data_xfer, | ||
131 | .cable_detect = ata_cable_40wire, | ||
132 | .set_piomode = winbond_set_piomode, | ||
133 | }; | ||
134 | |||
135 | /** | ||
136 | * winbond_init_one - attach a winbond interface | ||
137 | * @type: Type to display | ||
138 | * @io: I/O port start | ||
139 | * @irq: interrupt line | ||
140 | * @fast: True if on a > 33Mhz VLB | ||
141 | * | ||
142 | * Register a VLB bus IDE interface. Such interfaces are PIO and we | ||
143 | * assume do not support IRQ sharing. | ||
144 | */ | ||
145 | |||
146 | static __init int winbond_init_one(unsigned long port) | ||
147 | { | ||
148 | struct platform_device *pdev; | ||
149 | u8 reg; | ||
150 | int i, rc; | ||
151 | |||
152 | reg = winbond_readcfg(port, 0x81); | ||
153 | reg |= 0x80; /* jumpered mode off */ | ||
154 | winbond_writecfg(port, 0x81, reg); | ||
155 | reg = winbond_readcfg(port, 0x83); | ||
156 | reg |= 0xF0; /* local control */ | ||
157 | winbond_writecfg(port, 0x83, reg); | ||
158 | reg = winbond_readcfg(port, 0x85); | ||
159 | reg |= 0xF0; /* programmable timing */ | ||
160 | winbond_writecfg(port, 0x85, reg); | ||
161 | |||
162 | reg = winbond_readcfg(port, 0x81); | ||
163 | |||
164 | if (!(reg & 0x03)) /* Disabled */ | ||
165 | return -ENODEV; | ||
166 | |||
167 | for (i = 0; i < 2 ; i ++) { | ||
168 | unsigned long cmd_port = 0x1F0 - (0x80 * i); | ||
169 | unsigned long ctl_port = cmd_port + 0x206; | ||
170 | struct ata_host *host; | ||
171 | struct ata_port *ap; | ||
172 | void __iomem *cmd_addr, *ctl_addr; | ||
173 | |||
174 | if (!(reg & (1 << i))) | ||
175 | continue; | ||
176 | |||
177 | pdev = platform_device_register_simple(DRV_NAME, nr_winbond_host, NULL, 0); | ||
178 | if (IS_ERR(pdev)) | ||
179 | return PTR_ERR(pdev); | ||
180 | |||
181 | rc = -ENOMEM; | ||
182 | host = ata_host_alloc(&pdev->dev, 1); | ||
183 | if (!host) | ||
184 | goto err_unregister; | ||
185 | ap = host->ports[0]; | ||
186 | |||
187 | rc = -ENOMEM; | ||
188 | cmd_addr = devm_ioport_map(&pdev->dev, cmd_port, 8); | ||
189 | ctl_addr = devm_ioport_map(&pdev->dev, ctl_port, 1); | ||
190 | if (!cmd_addr || !ctl_addr) | ||
191 | goto err_unregister; | ||
192 | |||
193 | ata_port_desc(ap, "cmd 0x%lx ctl 0x%lx", cmd_port, ctl_port); | ||
194 | |||
195 | ap->ops = &winbond_port_ops; | ||
196 | ap->pio_mask = ATA_PIO4; | ||
197 | ap->flags |= ATA_FLAG_SLAVE_POSS; | ||
198 | ap->ioaddr.cmd_addr = cmd_addr; | ||
199 | ap->ioaddr.altstatus_addr = ctl_addr; | ||
200 | ap->ioaddr.ctl_addr = ctl_addr; | ||
201 | ata_sff_std_ports(&ap->ioaddr); | ||
202 | |||
203 | /* hook in a private data structure per channel */ | ||
204 | host->private_data = &winbond_data[nr_winbond_host]; | ||
205 | winbond_data[nr_winbond_host].config = port; | ||
206 | winbond_data[nr_winbond_host].platform_dev = pdev; | ||
207 | |||
208 | /* activate */ | ||
209 | rc = ata_host_activate(host, 14 + i, ata_sff_interrupt, 0, | ||
210 | &winbond_sht); | ||
211 | if (rc) | ||
212 | goto err_unregister; | ||
213 | |||
214 | winbond_host[nr_winbond_host++] = dev_get_drvdata(&pdev->dev); | ||
215 | } | ||
216 | |||
217 | return 0; | ||
218 | |||
219 | err_unregister: | ||
220 | platform_device_unregister(pdev); | ||
221 | return rc; | ||
222 | } | ||
223 | |||
224 | /** | ||
225 | * winbond_init - attach winbond interfaces | ||
226 | * | ||
227 | * Attach winbond IDE interfaces by scanning the ports it may occupy. | ||
228 | */ | ||
229 | |||
230 | static __init int winbond_init(void) | ||
231 | { | ||
232 | static const unsigned long config[2] = { 0x130, 0x1B0 }; | ||
233 | |||
234 | int ct = 0; | ||
235 | int i; | ||
236 | |||
237 | if (probe_winbond == 0) | ||
238 | return -ENODEV; | ||
239 | |||
240 | /* | ||
241 | * Check both base addresses | ||
242 | */ | ||
243 | |||
244 | for (i = 0; i < 2; i++) { | ||
245 | if (probe_winbond & (1<<i)) { | ||
246 | int ret = 0; | ||
247 | unsigned long port = config[i]; | ||
248 | |||
249 | if (request_region(port, 2, "pata_winbond")) { | ||
250 | ret = winbond_init_one(port); | ||
251 | if (ret <= 0) | ||
252 | release_region(port, 2); | ||
253 | else ct+= ret; | ||
254 | } | ||
255 | } | ||
256 | } | ||
257 | if (ct != 0) | ||
258 | return 0; | ||
259 | return -ENODEV; | ||
260 | } | ||
261 | |||
262 | static __exit void winbond_exit(void) | ||
263 | { | ||
264 | int i; | ||
265 | |||
266 | for (i = 0; i < nr_winbond_host; i++) { | ||
267 | ata_host_detach(winbond_host[i]); | ||
268 | release_region(winbond_data[i].config, 2); | ||
269 | platform_device_unregister(winbond_data[i].platform_dev); | ||
270 | } | ||
271 | } | ||
272 | |||
273 | MODULE_AUTHOR("Alan Cox"); | ||
274 | MODULE_DESCRIPTION("low-level driver for Winbond VL ATA"); | ||
275 | MODULE_LICENSE("GPL"); | ||
276 | MODULE_VERSION(DRV_VERSION); | ||
277 | |||
278 | module_init(winbond_init); | ||
279 | module_exit(winbond_exit); | ||
280 | |||
281 | module_param(probe_winbond, int, 0); | ||
282 | |||
diff --git a/drivers/ata/sata_dwc_460ex.c b/drivers/ata/sata_dwc_460ex.c index 2673a3d14806..6cf57c5c2b5f 100644 --- a/drivers/ata/sata_dwc_460ex.c +++ b/drivers/ata/sata_dwc_460ex.c | |||
@@ -1459,7 +1459,7 @@ static void sata_dwc_qc_prep_by_tag(struct ata_queued_cmd *qc, u8 tag) | |||
1459 | { | 1459 | { |
1460 | struct scatterlist *sg = qc->sg; | 1460 | struct scatterlist *sg = qc->sg; |
1461 | struct ata_port *ap = qc->ap; | 1461 | struct ata_port *ap = qc->ap; |
1462 | u32 dma_chan; | 1462 | int dma_chan; |
1463 | struct sata_dwc_device *hsdev = HSDEV_FROM_AP(ap); | 1463 | struct sata_dwc_device *hsdev = HSDEV_FROM_AP(ap); |
1464 | struct sata_dwc_device_port *hsdevp = HSDEVP_FROM_AP(ap); | 1464 | struct sata_dwc_device_port *hsdevp = HSDEVP_FROM_AP(ap); |
1465 | int err; | 1465 | int err; |
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c index 9463c71dd38e..81982594a014 100644 --- a/drivers/ata/sata_mv.c +++ b/drivers/ata/sata_mv.c | |||
@@ -1898,19 +1898,25 @@ static void mv_bmdma_start(struct ata_queued_cmd *qc) | |||
1898 | * LOCKING: | 1898 | * LOCKING: |
1899 | * Inherited from caller. | 1899 | * Inherited from caller. |
1900 | */ | 1900 | */ |
1901 | static void mv_bmdma_stop(struct ata_queued_cmd *qc) | 1901 | static void mv_bmdma_stop_ap(struct ata_port *ap) |
1902 | { | 1902 | { |
1903 | struct ata_port *ap = qc->ap; | ||
1904 | void __iomem *port_mmio = mv_ap_base(ap); | 1903 | void __iomem *port_mmio = mv_ap_base(ap); |
1905 | u32 cmd; | 1904 | u32 cmd; |
1906 | 1905 | ||
1907 | /* clear start/stop bit */ | 1906 | /* clear start/stop bit */ |
1908 | cmd = readl(port_mmio + BMDMA_CMD); | 1907 | cmd = readl(port_mmio + BMDMA_CMD); |
1909 | cmd &= ~ATA_DMA_START; | 1908 | if (cmd & ATA_DMA_START) { |
1910 | writelfl(cmd, port_mmio + BMDMA_CMD); | 1909 | cmd &= ~ATA_DMA_START; |
1910 | writelfl(cmd, port_mmio + BMDMA_CMD); | ||
1911 | |||
1912 | /* one-PIO-cycle guaranteed wait, per spec, for HDMA1:0 transition */ | ||
1913 | ata_sff_dma_pause(ap); | ||
1914 | } | ||
1915 | } | ||
1911 | 1916 | ||
1912 | /* one-PIO-cycle guaranteed wait, per spec, for HDMA1:0 transition */ | 1917 | static void mv_bmdma_stop(struct ata_queued_cmd *qc) |
1913 | ata_sff_dma_pause(ap); | 1918 | { |
1919 | mv_bmdma_stop_ap(qc->ap); | ||
1914 | } | 1920 | } |
1915 | 1921 | ||
1916 | /** | 1922 | /** |
@@ -1934,8 +1940,21 @@ static u8 mv_bmdma_status(struct ata_port *ap) | |||
1934 | reg = readl(port_mmio + BMDMA_STATUS); | 1940 | reg = readl(port_mmio + BMDMA_STATUS); |
1935 | if (reg & ATA_DMA_ACTIVE) | 1941 | if (reg & ATA_DMA_ACTIVE) |
1936 | status = ATA_DMA_ACTIVE; | 1942 | status = ATA_DMA_ACTIVE; |
1937 | else | 1943 | else if (reg & ATA_DMA_ERR) |
1938 | status = (reg & ATA_DMA_ERR) | ATA_DMA_INTR; | 1944 | status = (reg & ATA_DMA_ERR) | ATA_DMA_INTR; |
1945 | else { | ||
1946 | /* | ||
1947 | * Just because DMA_ACTIVE is 0 (DMA completed), | ||
1948 | * this does _not_ mean the device is "done". | ||
1949 | * So we should not yet be signalling ATA_DMA_INTR | ||
1950 | * in some cases. Eg. DSM/TRIM, and perhaps others. | ||
1951 | */ | ||
1952 | mv_bmdma_stop_ap(ap); | ||
1953 | if (ioread8(ap->ioaddr.altstatus_addr) & ATA_BUSY) | ||
1954 | status = 0; | ||
1955 | else | ||
1956 | status = ATA_DMA_INTR; | ||
1957 | } | ||
1939 | return status; | 1958 | return status; |
1940 | } | 1959 | } |
1941 | 1960 | ||
@@ -1995,6 +2014,9 @@ static void mv_qc_prep(struct ata_queued_cmd *qc) | |||
1995 | 2014 | ||
1996 | switch (tf->protocol) { | 2015 | switch (tf->protocol) { |
1997 | case ATA_PROT_DMA: | 2016 | case ATA_PROT_DMA: |
2017 | if (tf->command == ATA_CMD_DSM) | ||
2018 | return; | ||
2019 | /* fall-thru */ | ||
1998 | case ATA_PROT_NCQ: | 2020 | case ATA_PROT_NCQ: |
1999 | break; /* continue below */ | 2021 | break; /* continue below */ |
2000 | case ATA_PROT_PIO: | 2022 | case ATA_PROT_PIO: |
@@ -2094,6 +2116,8 @@ static void mv_qc_prep_iie(struct ata_queued_cmd *qc) | |||
2094 | if ((tf->protocol != ATA_PROT_DMA) && | 2116 | if ((tf->protocol != ATA_PROT_DMA) && |
2095 | (tf->protocol != ATA_PROT_NCQ)) | 2117 | (tf->protocol != ATA_PROT_NCQ)) |
2096 | return; | 2118 | return; |
2119 | if (tf->command == ATA_CMD_DSM) | ||
2120 | return; /* use bmdma for this */ | ||
2097 | 2121 | ||
2098 | /* Fill in Gen IIE command request block */ | 2122 | /* Fill in Gen IIE command request block */ |
2099 | if (!(tf->flags & ATA_TFLAG_WRITE)) | 2123 | if (!(tf->flags & ATA_TFLAG_WRITE)) |
@@ -2289,6 +2313,12 @@ static unsigned int mv_qc_issue(struct ata_queued_cmd *qc) | |||
2289 | 2313 | ||
2290 | switch (qc->tf.protocol) { | 2314 | switch (qc->tf.protocol) { |
2291 | case ATA_PROT_DMA: | 2315 | case ATA_PROT_DMA: |
2316 | if (qc->tf.command == ATA_CMD_DSM) { | ||
2317 | if (!ap->ops->bmdma_setup) /* no bmdma on GEN_I */ | ||
2318 | return AC_ERR_OTHER; | ||
2319 | break; /* use bmdma for this */ | ||
2320 | } | ||
2321 | /* fall thru */ | ||
2292 | case ATA_PROT_NCQ: | 2322 | case ATA_PROT_NCQ: |
2293 | mv_start_edma(ap, port_mmio, pp, qc->tf.protocol); | 2323 | mv_start_edma(ap, port_mmio, pp, qc->tf.protocol); |
2294 | pp->req_idx = (pp->req_idx + 1) & MV_MAX_Q_DEPTH_MASK; | 2324 | pp->req_idx = (pp->req_idx + 1) & MV_MAX_Q_DEPTH_MASK; |