diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-07-01 21:40:54 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-07-01 21:40:54 -0400 |
commit | 826456989f1e9fe15daf2183c630ea9c7ab7c46d (patch) | |
tree | fa5dec62b73dfad09ad49f1e2797a0e303bd194b /drivers | |
parent | 980533b018fda7ae4c4fb6863b75a0e282d2ffd2 (diff) | |
parent | 1529c69adce1e95f7ae72f0441590c226bbac7fc (diff) |
Merge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev
* 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev:
ata_generic: implement ATA_GEN_* flags and force enable DMA on MBP 7,1
ahci,ata_generic: let ata_generic handle new MBP w/ MCP89
libahci: Fix bug in storing EM messages
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/ata/ahci.c | 10 | ||||
-rw-r--r-- | drivers/ata/ata_generic.c | 30 | ||||
-rw-r--r-- | drivers/ata/libahci.c | 5 |
3 files changed, 37 insertions, 8 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index 8ca16f54e1ed..f2522534ae63 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
@@ -1053,6 +1053,16 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1053 | if (pdev->vendor == PCI_VENDOR_ID_MARVELL && !marvell_enable) | 1053 | if (pdev->vendor == PCI_VENDOR_ID_MARVELL && !marvell_enable) |
1054 | return -ENODEV; | 1054 | return -ENODEV; |
1055 | 1055 | ||
1056 | /* | ||
1057 | * For some reason, MCP89 on MacBook 7,1 doesn't work with | ||
1058 | * ahci, use ata_generic instead. | ||
1059 | */ | ||
1060 | if (pdev->vendor == PCI_VENDOR_ID_NVIDIA && | ||
1061 | pdev->device == PCI_DEVICE_ID_NVIDIA_NFORCE_MCP89_SATA && | ||
1062 | pdev->subsystem_vendor == PCI_VENDOR_ID_APPLE && | ||
1063 | pdev->subsystem_device == 0xcb89) | ||
1064 | return -ENODEV; | ||
1065 | |||
1056 | /* Promise's PDC42819 is a SAS/SATA controller that has an AHCI mode. | 1066 | /* Promise's PDC42819 is a SAS/SATA controller that has an AHCI mode. |
1057 | * At the moment, we can only use the AHCI mode. Let the users know | 1067 | * At the moment, we can only use the AHCI mode. Let the users know |
1058 | * that for SAS drives they're out of luck. | 1068 | * that for SAS drives they're out of luck. |
diff --git a/drivers/ata/ata_generic.c b/drivers/ata/ata_generic.c index 573158a9668d..7107a6929deb 100644 --- a/drivers/ata/ata_generic.c +++ b/drivers/ata/ata_generic.c | |||
@@ -32,6 +32,11 @@ | |||
32 | * A generic parallel ATA driver using libata | 32 | * A generic parallel ATA driver using libata |
33 | */ | 33 | */ |
34 | 34 | ||
35 | enum { | ||
36 | ATA_GEN_CLASS_MATCH = (1 << 0), | ||
37 | ATA_GEN_FORCE_DMA = (1 << 1), | ||
38 | }; | ||
39 | |||
35 | /** | 40 | /** |
36 | * generic_set_mode - mode setting | 41 | * generic_set_mode - mode setting |
37 | * @link: link to set up | 42 | * @link: link to set up |
@@ -46,13 +51,17 @@ | |||
46 | static int generic_set_mode(struct ata_link *link, struct ata_device **unused) | 51 | static int generic_set_mode(struct ata_link *link, struct ata_device **unused) |
47 | { | 52 | { |
48 | struct ata_port *ap = link->ap; | 53 | struct ata_port *ap = link->ap; |
54 | const struct pci_device_id *id = ap->host->private_data; | ||
49 | int dma_enabled = 0; | 55 | int dma_enabled = 0; |
50 | struct ata_device *dev; | 56 | struct ata_device *dev; |
51 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); | 57 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); |
52 | 58 | ||
53 | /* Bits 5 and 6 indicate if DMA is active on master/slave */ | 59 | if (id->driver_data & ATA_GEN_FORCE_DMA) { |
54 | if (ap->ioaddr.bmdma_addr) | 60 | dma_enabled = 0xff; |
61 | } else if (ap->ioaddr.bmdma_addr) { | ||
62 | /* Bits 5 and 6 indicate if DMA is active on master/slave */ | ||
55 | dma_enabled = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS); | 63 | dma_enabled = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS); |
64 | } | ||
56 | 65 | ||
57 | if (pdev->vendor == PCI_VENDOR_ID_CENATEK) | 66 | if (pdev->vendor == PCI_VENDOR_ID_CENATEK) |
58 | dma_enabled = 0xFF; | 67 | dma_enabled = 0xFF; |
@@ -126,7 +135,7 @@ static int ata_generic_init_one(struct pci_dev *dev, const struct pci_device_id | |||
126 | const struct ata_port_info *ppi[] = { &info, NULL }; | 135 | const struct ata_port_info *ppi[] = { &info, NULL }; |
127 | 136 | ||
128 | /* Don't use the generic entry unless instructed to do so */ | 137 | /* Don't use the generic entry unless instructed to do so */ |
129 | if (id->driver_data == 1 && all_generic_ide == 0) | 138 | if ((id->driver_data & ATA_GEN_CLASS_MATCH) && all_generic_ide == 0) |
130 | return -ENODEV; | 139 | return -ENODEV; |
131 | 140 | ||
132 | /* Devices that need care */ | 141 | /* Devices that need care */ |
@@ -155,7 +164,7 @@ static int ata_generic_init_one(struct pci_dev *dev, const struct pci_device_id | |||
155 | return rc; | 164 | return rc; |
156 | pcim_pin_device(dev); | 165 | pcim_pin_device(dev); |
157 | } | 166 | } |
158 | return ata_pci_bmdma_init_one(dev, ppi, &generic_sht, NULL, 0); | 167 | return ata_pci_bmdma_init_one(dev, ppi, &generic_sht, (void *)id, 0); |
159 | } | 168 | } |
160 | 169 | ||
161 | static struct pci_device_id ata_generic[] = { | 170 | static struct pci_device_id ata_generic[] = { |
@@ -167,7 +176,15 @@ static struct pci_device_id ata_generic[] = { | |||
167 | { PCI_DEVICE(PCI_VENDOR_ID_HINT, PCI_DEVICE_ID_HINT_VXPROII_IDE), }, | 176 | { PCI_DEVICE(PCI_VENDOR_ID_HINT, PCI_DEVICE_ID_HINT_VXPROII_IDE), }, |
168 | { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C561), }, | 177 | { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C561), }, |
169 | { PCI_DEVICE(PCI_VENDOR_ID_OPTI, PCI_DEVICE_ID_OPTI_82C558), }, | 178 | { PCI_DEVICE(PCI_VENDOR_ID_OPTI, PCI_DEVICE_ID_OPTI_82C558), }, |
170 | { PCI_DEVICE(PCI_VENDOR_ID_CENATEK,PCI_DEVICE_ID_CENATEK_IDE), }, | 179 | { PCI_DEVICE(PCI_VENDOR_ID_CENATEK,PCI_DEVICE_ID_CENATEK_IDE), |
180 | .driver_data = ATA_GEN_FORCE_DMA }, | ||
181 | /* | ||
182 | * For some reason, MCP89 on MacBook 7,1 doesn't work with | ||
183 | * ahci, use ata_generic instead. | ||
184 | */ | ||
185 | { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP89_SATA, | ||
186 | PCI_VENDOR_ID_APPLE, 0xcb89, | ||
187 | .driver_data = ATA_GEN_FORCE_DMA }, | ||
171 | #if !defined(CONFIG_PATA_TOSHIBA) && !defined(CONFIG_PATA_TOSHIBA_MODULE) | 188 | #if !defined(CONFIG_PATA_TOSHIBA) && !defined(CONFIG_PATA_TOSHIBA_MODULE) |
172 | { PCI_DEVICE(PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_1), }, | 189 | { PCI_DEVICE(PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_1), }, |
173 | { PCI_DEVICE(PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_2), }, | 190 | { PCI_DEVICE(PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_2), }, |
@@ -175,7 +192,8 @@ static struct pci_device_id ata_generic[] = { | |||
175 | { PCI_DEVICE(PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_5), }, | 192 | { PCI_DEVICE(PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_5), }, |
176 | #endif | 193 | #endif |
177 | /* Must come last. If you add entries adjust this table appropriately */ | 194 | /* Must come last. If you add entries adjust this table appropriately */ |
178 | { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_STORAGE_IDE << 8, 0xFFFFFF00UL, 1}, | 195 | { PCI_DEVICE_CLASS(PCI_CLASS_STORAGE_IDE << 8, 0xFFFFFF00UL), |
196 | .driver_data = ATA_GEN_CLASS_MATCH }, | ||
179 | { 0, }, | 197 | { 0, }, |
180 | }; | 198 | }; |
181 | 199 | ||
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c index 261f86d102e8..81e772a94d59 100644 --- a/drivers/ata/libahci.c +++ b/drivers/ata/libahci.c | |||
@@ -324,6 +324,7 @@ static ssize_t ahci_store_em_buffer(struct device *dev, | |||
324 | struct ahci_host_priv *hpriv = ap->host->private_data; | 324 | struct ahci_host_priv *hpriv = ap->host->private_data; |
325 | void __iomem *mmio = hpriv->mmio; | 325 | void __iomem *mmio = hpriv->mmio; |
326 | void __iomem *em_mmio = mmio + hpriv->em_loc; | 326 | void __iomem *em_mmio = mmio + hpriv->em_loc; |
327 | const unsigned char *msg_buf = buf; | ||
327 | u32 em_ctl, msg; | 328 | u32 em_ctl, msg; |
328 | unsigned long flags; | 329 | unsigned long flags; |
329 | int i; | 330 | int i; |
@@ -343,8 +344,8 @@ static ssize_t ahci_store_em_buffer(struct device *dev, | |||
343 | } | 344 | } |
344 | 345 | ||
345 | for (i = 0; i < size; i += 4) { | 346 | for (i = 0; i < size; i += 4) { |
346 | msg = buf[i] | buf[i + 1] << 8 | | 347 | msg = msg_buf[i] | msg_buf[i + 1] << 8 | |
347 | buf[i + 2] << 16 | buf[i + 3] << 24; | 348 | msg_buf[i + 2] << 16 | msg_buf[i + 3] << 24; |
348 | writel(msg, em_mmio + i); | 349 | writel(msg, em_mmio + i); |
349 | } | 350 | } |
350 | 351 | ||