aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2005-10-09 09:35:46 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-10-09 09:35:46 -0400
commit042c21fd2c3aa553907020131caa553a9da24589 (patch)
treed2118086e12bb88f21d1fc0129e170d49b9b35ef /drivers
parent1fcce839a541ffcd50da99a1bfdfea594be0e3d3 (diff)
[libata sata_sil24] add support for 3131/3531
This patch adds support for sil_3131 and sil_3531. Both are identical to 3124 except that they have only one port. Bits 30 and 31 of ata_port_info->host_flags is used to encode available port numbers. Version number is bumped to 0.22. Edward Falk supplied all the necessary information and preliminary patch. Signed-off-by: Tejun Heo <htejun@gmail.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/scsi/sata_sil24.c38
1 files changed, 30 insertions, 8 deletions
diff --git a/drivers/scsi/sata_sil24.c b/drivers/scsi/sata_sil24.c
index dffa13c84639..19857814d69f 100644
--- a/drivers/scsi/sata_sil24.c
+++ b/drivers/scsi/sata_sil24.c
@@ -196,6 +196,7 @@ enum {
196 /* board id */ 196 /* board id */
197 BID_SIL3124 = 0, 197 BID_SIL3124 = 0,
198 BID_SIL3132 = 1, 198 BID_SIL3132 = 1,
199 BID_SIL3131 = 2,
199 200
200 IRQ_STAT_4PORTS = 0xf, 201 IRQ_STAT_4PORTS = 0xf,
201}; 202};
@@ -242,6 +243,8 @@ static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
242static struct pci_device_id sil24_pci_tbl[] = { 243static struct pci_device_id sil24_pci_tbl[] = {
243 { 0x1095, 0x3124, PCI_ANY_ID, PCI_ANY_ID, 0, 0, BID_SIL3124 }, 244 { 0x1095, 0x3124, PCI_ANY_ID, PCI_ANY_ID, 0, 0, BID_SIL3124 },
244 { 0x1095, 0x3132, PCI_ANY_ID, PCI_ANY_ID, 0, 0, BID_SIL3132 }, 245 { 0x1095, 0x3132, PCI_ANY_ID, PCI_ANY_ID, 0, 0, BID_SIL3132 },
246 { 0x1095, 0x3131, PCI_ANY_ID, PCI_ANY_ID, 0, 0, BID_SIL3131 },
247 { 0x1095, 0x3531, PCI_ANY_ID, PCI_ANY_ID, 0, 0, BID_SIL3131 },
245 { } /* terminate list */ 248 { } /* terminate list */
246}; 249};
247 250
@@ -300,13 +303,20 @@ static struct ata_port_operations sil24_ops = {
300 .host_stop = sil24_host_stop, 303 .host_stop = sil24_host_stop,
301}; 304};
302 305
306/*
307 * Use bits 30-31 of host_flags to encode available port numbers.
308 * Current maxium is 4.
309 */
310#define SIL24_NPORTS2FLAG(nports) ((((unsigned)(nports) - 1) & 0x3) << 30)
311#define SIL24_FLAG2NPORTS(flag) ((((flag) >> 30) & 0x3) + 1)
312
303static struct ata_port_info sil24_port_info[] = { 313static struct ata_port_info sil24_port_info[] = {
304 /* sil_3124 */ 314 /* sil_3124 */
305 { 315 {
306 .sht = &sil24_sht, 316 .sht = &sil24_sht,
307 .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | 317 .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
308 ATA_FLAG_SATA_RESET | ATA_FLAG_MMIO | 318 ATA_FLAG_SATA_RESET | ATA_FLAG_MMIO |
309 ATA_FLAG_PIO_DMA, 319 ATA_FLAG_PIO_DMA | SIL24_NPORTS2FLAG(4),
310 .pio_mask = 0x1f, /* pio0-4 */ 320 .pio_mask = 0x1f, /* pio0-4 */
311 .mwdma_mask = 0x07, /* mwdma0-2 */ 321 .mwdma_mask = 0x07, /* mwdma0-2 */
312 .udma_mask = 0x3f, /* udma0-5 */ 322 .udma_mask = 0x3f, /* udma0-5 */
@@ -317,7 +327,18 @@ static struct ata_port_info sil24_port_info[] = {
317 .sht = &sil24_sht, 327 .sht = &sil24_sht,
318 .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | 328 .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
319 ATA_FLAG_SATA_RESET | ATA_FLAG_MMIO | 329 ATA_FLAG_SATA_RESET | ATA_FLAG_MMIO |
320 ATA_FLAG_PIO_DMA, 330 ATA_FLAG_PIO_DMA | SIL24_NPORTS2FLAG(2),
331 .pio_mask = 0x1f, /* pio0-4 */
332 .mwdma_mask = 0x07, /* mwdma0-2 */
333 .udma_mask = 0x3f, /* udma0-5 */
334 .port_ops = &sil24_ops,
335 },
336 /* sil_3131/sil_3531 */
337 {
338 .sht = &sil24_sht,
339 .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
340 ATA_FLAG_SATA_RESET | ATA_FLAG_MMIO |
341 ATA_FLAG_PIO_DMA | SIL24_NPORTS2FLAG(1),
321 .pio_mask = 0x1f, /* pio0-4 */ 342 .pio_mask = 0x1f, /* pio0-4 */
322 .mwdma_mask = 0x07, /* mwdma0-2 */ 343 .mwdma_mask = 0x07, /* mwdma0-2 */
323 .udma_mask = 0x3f, /* udma0-5 */ 344 .udma_mask = 0x3f, /* udma0-5 */
@@ -665,6 +686,7 @@ static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
665{ 686{
666 static int printed_version = 0; 687 static int printed_version = 0;
667 unsigned int board_id = (unsigned int)ent->driver_data; 688 unsigned int board_id = (unsigned int)ent->driver_data;
689 struct ata_port_info *pinfo = &sil24_port_info[board_id];
668 struct ata_probe_ent *probe_ent = NULL; 690 struct ata_probe_ent *probe_ent = NULL;
669 struct sil24_host_priv *hpriv = NULL; 691 struct sil24_host_priv *hpriv = NULL;
670 void *host_base = NULL, *port_base = NULL; 692 void *host_base = NULL, *port_base = NULL;
@@ -705,12 +727,12 @@ static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
705 probe_ent->dev = pci_dev_to_dev(pdev); 727 probe_ent->dev = pci_dev_to_dev(pdev);
706 INIT_LIST_HEAD(&probe_ent->node); 728 INIT_LIST_HEAD(&probe_ent->node);
707 729
708 probe_ent->sht = sil24_port_info[board_id].sht; 730 probe_ent->sht = pinfo->sht;
709 probe_ent->host_flags = sil24_port_info[board_id].host_flags; 731 probe_ent->host_flags = pinfo->host_flags;
710 probe_ent->pio_mask = sil24_port_info[board_id].pio_mask; 732 probe_ent->pio_mask = pinfo->pio_mask;
711 probe_ent->udma_mask = sil24_port_info[board_id].udma_mask; 733 probe_ent->udma_mask = pinfo->udma_mask;
712 probe_ent->port_ops = sil24_port_info[board_id].port_ops; 734 probe_ent->port_ops = pinfo->port_ops;
713 probe_ent->n_ports = (board_id == BID_SIL3124) ? 4 : 2; 735 probe_ent->n_ports = SIL24_FLAG2NPORTS(pinfo->host_flags);
714 736
715 probe_ent->irq = pdev->irq; 737 probe_ent->irq = pdev->irq;
716 probe_ent->irq_flags = SA_SHIRQ; 738 probe_ent->irq_flags = SA_SHIRQ;