diff options
Diffstat (limited to 'drivers/ata/pata_scc.c')
-rw-r--r-- | drivers/ata/pata_scc.c | 51 |
1 files changed, 16 insertions, 35 deletions
diff --git a/drivers/ata/pata_scc.c b/drivers/ata/pata_scc.c index f3ed141fdc0e..5df354d573e8 100644 --- a/drivers/ata/pata_scc.c +++ b/drivers/ata/pata_scc.c | |||
@@ -1016,7 +1016,6 @@ static const struct ata_port_operations scc_pata_ops = { | |||
1016 | .error_handler = scc_error_handler, | 1016 | .error_handler = scc_error_handler, |
1017 | .post_internal_cmd = scc_bmdma_stop, | 1017 | .post_internal_cmd = scc_bmdma_stop, |
1018 | 1018 | ||
1019 | .irq_handler = ata_interrupt, | ||
1020 | .irq_clear = scc_bmdma_irq_clear, | 1019 | .irq_clear = scc_bmdma_irq_clear, |
1021 | .irq_on = scc_irq_on, | 1020 | .irq_on = scc_irq_on, |
1022 | .irq_ack = scc_irq_ack, | 1021 | .irq_ack = scc_irq_ack, |
@@ -1027,7 +1026,6 @@ static const struct ata_port_operations scc_pata_ops = { | |||
1027 | 1026 | ||
1028 | static struct ata_port_info scc_port_info[] = { | 1027 | static struct ata_port_info scc_port_info[] = { |
1029 | { | 1028 | { |
1030 | .sht = &scc_sht, | ||
1031 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_MMIO | ATA_FLAG_NO_LEGACY, | 1029 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_MMIO | ATA_FLAG_NO_LEGACY, |
1032 | .pio_mask = 0x1f, /* pio0-4 */ | 1030 | .pio_mask = 0x1f, /* pio0-4 */ |
1033 | .mwdma_mask = 0x00, | 1031 | .mwdma_mask = 0x00, |
@@ -1040,10 +1038,10 @@ static struct ata_port_info scc_port_info[] = { | |||
1040 | * scc_reset_controller - initialize SCC PATA controller. | 1038 | * scc_reset_controller - initialize SCC PATA controller. |
1041 | */ | 1039 | */ |
1042 | 1040 | ||
1043 | static int scc_reset_controller(struct ata_probe_ent *probe_ent) | 1041 | static int scc_reset_controller(struct ata_host *host) |
1044 | { | 1042 | { |
1045 | void __iomem *ctrl_base = probe_ent->iomap[SCC_CTRL_BAR]; | 1043 | void __iomem *ctrl_base = host->iomap[SCC_CTRL_BAR]; |
1046 | void __iomem *bmid_base = probe_ent->iomap[SCC_BMID_BAR]; | 1044 | void __iomem *bmid_base = host->iomap[SCC_BMID_BAR]; |
1047 | void __iomem *cckctrl_port = ctrl_base + SCC_CTL_CCKCTRL; | 1045 | void __iomem *cckctrl_port = ctrl_base + SCC_CTL_CCKCTRL; |
1048 | void __iomem *mode_port = ctrl_base + SCC_CTL_MODEREG; | 1046 | void __iomem *mode_port = ctrl_base + SCC_CTL_MODEREG; |
1049 | void __iomem *ecmode_port = ctrl_base + SCC_CTL_ECMODE; | 1047 | void __iomem *ecmode_port = ctrl_base + SCC_CTL_ECMODE; |
@@ -1104,17 +1102,15 @@ static void scc_setup_ports (struct ata_ioports *ioaddr, void __iomem *base) | |||
1104 | ioaddr->command_addr = ioaddr->cmd_addr + SCC_REG_CMD; | 1102 | ioaddr->command_addr = ioaddr->cmd_addr + SCC_REG_CMD; |
1105 | } | 1103 | } |
1106 | 1104 | ||
1107 | static int scc_host_init(struct ata_probe_ent *probe_ent) | 1105 | static int scc_host_init(struct ata_host *host) |
1108 | { | 1106 | { |
1109 | struct pci_dev *pdev = to_pci_dev(probe_ent->dev); | 1107 | struct pci_dev *pdev = to_pci_dev(host->dev); |
1110 | int rc; | 1108 | int rc; |
1111 | 1109 | ||
1112 | rc = scc_reset_controller(probe_ent); | 1110 | rc = scc_reset_controller(host); |
1113 | if (rc) | 1111 | if (rc) |
1114 | return rc; | 1112 | return rc; |
1115 | 1113 | ||
1116 | probe_ent->n_ports = 1; | ||
1117 | |||
1118 | rc = pci_set_dma_mask(pdev, ATA_DMA_MASK); | 1114 | rc = pci_set_dma_mask(pdev, ATA_DMA_MASK); |
1119 | if (rc) | 1115 | if (rc) |
1120 | return rc; | 1116 | return rc; |
@@ -1122,7 +1118,7 @@ static int scc_host_init(struct ata_probe_ent *probe_ent) | |||
1122 | if (rc) | 1118 | if (rc) |
1123 | return rc; | 1119 | return rc; |
1124 | 1120 | ||
1125 | scc_setup_ports(&probe_ent->port[0], probe_ent->iomap[SCC_BMID_BAR]); | 1121 | scc_setup_ports(&host->ports[0]->ioaddr, host->iomap[SCC_BMID_BAR]); |
1126 | 1122 | ||
1127 | pci_set_master(pdev); | 1123 | pci_set_master(pdev); |
1128 | 1124 | ||
@@ -1145,14 +1141,18 @@ static int scc_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1145 | { | 1141 | { |
1146 | static int printed_version; | 1142 | static int printed_version; |
1147 | unsigned int board_idx = (unsigned int) ent->driver_data; | 1143 | unsigned int board_idx = (unsigned int) ent->driver_data; |
1144 | const struct ata_port_info *ppi[] = { &scc_port_info[board_idx], NULL }; | ||
1148 | struct device *dev = &pdev->dev; | 1145 | struct device *dev = &pdev->dev; |
1149 | struct ata_probe_ent *probe_ent; | ||
1150 | int rc; | 1146 | int rc; |
1151 | 1147 | ||
1152 | if (!printed_version++) | 1148 | if (!printed_version++) |
1153 | dev_printk(KERN_DEBUG, &pdev->dev, | 1149 | dev_printk(KERN_DEBUG, &pdev->dev, |
1154 | "version " DRV_VERSION "\n"); | 1150 | "version " DRV_VERSION "\n"); |
1155 | 1151 | ||
1152 | host = ata_port_alloc_pinfo(&pdev->dev, ppi, 1); | ||
1153 | if (!host) | ||
1154 | return -ENOMEM; | ||
1155 | |||
1156 | rc = pcim_enable_device(pdev); | 1156 | rc = pcim_enable_device(pdev); |
1157 | if (rc) | 1157 | if (rc) |
1158 | return rc; | 1158 | return rc; |
@@ -1162,33 +1162,14 @@ static int scc_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1162 | pcim_pin_device(pdev); | 1162 | pcim_pin_device(pdev); |
1163 | if (rc) | 1163 | if (rc) |
1164 | return rc; | 1164 | return rc; |
1165 | host->iomap = pcim_iomap_table(pdev); | ||
1165 | 1166 | ||
1166 | probe_ent = devm_kzalloc(dev, sizeof(*probe_ent), GFP_KERNEL); | 1167 | rc = scc_host_init(host); |
1167 | if (!probe_ent) | ||
1168 | return -ENOMEM; | ||
1169 | |||
1170 | probe_ent->dev = dev; | ||
1171 | INIT_LIST_HEAD(&probe_ent->node); | ||
1172 | |||
1173 | probe_ent->sht = scc_port_info[board_idx].sht; | ||
1174 | probe_ent->port_flags = scc_port_info[board_idx].flags; | ||
1175 | probe_ent->pio_mask = scc_port_info[board_idx].pio_mask; | ||
1176 | probe_ent->udma_mask = scc_port_info[board_idx].udma_mask; | ||
1177 | probe_ent->port_ops = scc_port_info[board_idx].port_ops; | ||
1178 | |||
1179 | probe_ent->irq = pdev->irq; | ||
1180 | probe_ent->irq_flags = IRQF_SHARED; | ||
1181 | probe_ent->iomap = pcim_iomap_table(pdev); | ||
1182 | |||
1183 | rc = scc_host_init(probe_ent); | ||
1184 | if (rc) | 1168 | if (rc) |
1185 | return rc; | 1169 | return rc; |
1186 | 1170 | ||
1187 | if (!ata_device_add(probe_ent)) | 1171 | return ata_host_activate(host, pdev->irq, ata_interrupt, IRQF_SHARED, |
1188 | return -ENODEV; | 1172 | &scc_sht); |
1189 | |||
1190 | devm_kfree(dev, probe_ent); | ||
1191 | return 0; | ||
1192 | } | 1173 | } |
1193 | 1174 | ||
1194 | static struct pci_driver scc_pci_driver = { | 1175 | static struct pci_driver scc_pci_driver = { |