aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/sata_sx4.c
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2007-04-17 10:44:08 -0400
committerJeff Garzik <jeff@garzik.org>2007-04-28 14:16:06 -0400
commit4447d35156169cf136e829eb6b5cac2d6370f2d9 (patch)
tree20be4c582ea4ce1cce1b0f8dbea949a410a72e3c /drivers/ata/sata_sx4.c
parent9a829ccfc833269bdb85751f5048288ab93678ac (diff)
libata: convert the remaining SATA drivers to new init model
Convert ahci, sata_sil, sata_sil24, sata_svw, sata_qstor, sata_mv, sata_sx4, sata_vsc and sata_inic162x to new init model. Now that host and ap are available during intialization, functions are converted to take either host or ap instead of low level parameters which were inevitable for functions shared between init and other paths. This simplifies code quite a bit. * init_one()'s now follow more consistent init order * ahci_setup_port() and ahci_host_init() collapsed into ahci_init_one() for init order consistency * sata_vsc uses port_info instead of setting fields manually * in sata_svw, k2_board_info converted to port_info (info is now in port flags). port number is honored now. Tested on ICH7/8 AHCI, jmb360, sil3112, 3114, 3124 and 3132. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/sata_sx4.c')
-rw-r--r--drivers/ata/sata_sx4.c150
1 files changed, 64 insertions, 86 deletions
diff --git a/drivers/ata/sata_sx4.c b/drivers/ata/sata_sx4.c
index 1a081c3a8c06..3a4f44559d0a 100644
--- a/drivers/ata/sata_sx4.c
+++ b/drivers/ata/sata_sx4.c
@@ -151,24 +151,23 @@ struct pdc_host_priv {
151 151
152 152
153static int pdc_sata_init_one (struct pci_dev *pdev, const struct pci_device_id *ent); 153static int pdc_sata_init_one (struct pci_dev *pdev, const struct pci_device_id *ent);
154static irqreturn_t pdc20621_interrupt (int irq, void *dev_instance);
155static void pdc_eng_timeout(struct ata_port *ap); 154static void pdc_eng_timeout(struct ata_port *ap);
156static void pdc_20621_phy_reset (struct ata_port *ap); 155static void pdc_20621_phy_reset (struct ata_port *ap);
157static int pdc_port_start(struct ata_port *ap); 156static int pdc_port_start(struct ata_port *ap);
158static void pdc20621_qc_prep(struct ata_queued_cmd *qc); 157static void pdc20621_qc_prep(struct ata_queued_cmd *qc);
159static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf); 158static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf);
160static void pdc_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf); 159static void pdc_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf);
161static unsigned int pdc20621_dimm_init(struct ata_probe_ent *pe); 160static unsigned int pdc20621_dimm_init(struct ata_host *host);
162static int pdc20621_detect_dimm(struct ata_probe_ent *pe); 161static int pdc20621_detect_dimm(struct ata_host *host);
163static unsigned int pdc20621_i2c_read(struct ata_probe_ent *pe, 162static unsigned int pdc20621_i2c_read(struct ata_host *host,
164 u32 device, u32 subaddr, u32 *pdata); 163 u32 device, u32 subaddr, u32 *pdata);
165static int pdc20621_prog_dimm0(struct ata_probe_ent *pe); 164static int pdc20621_prog_dimm0(struct ata_host *host);
166static unsigned int pdc20621_prog_dimm_global(struct ata_probe_ent *pe); 165static unsigned int pdc20621_prog_dimm_global(struct ata_host *host);
167#ifdef ATA_VERBOSE_DEBUG 166#ifdef ATA_VERBOSE_DEBUG
168static void pdc20621_get_from_dimm(struct ata_probe_ent *pe, 167static void pdc20621_get_from_dimm(struct ata_host *host,
169 void *psource, u32 offset, u32 size); 168 void *psource, u32 offset, u32 size);
170#endif 169#endif
171static void pdc20621_put_to_dimm(struct ata_probe_ent *pe, 170static void pdc20621_put_to_dimm(struct ata_host *host,
172 void *psource, u32 offset, u32 size); 171 void *psource, u32 offset, u32 size);
173static void pdc20621_irq_clear(struct ata_port *ap); 172static void pdc20621_irq_clear(struct ata_port *ap);
174static unsigned int pdc20621_qc_issue_prot(struct ata_queued_cmd *qc); 173static unsigned int pdc20621_qc_issue_prot(struct ata_queued_cmd *qc);
@@ -204,7 +203,6 @@ static const struct ata_port_operations pdc_20621_ops = {
204 .qc_issue = pdc20621_qc_issue_prot, 203 .qc_issue = pdc20621_qc_issue_prot,
205 .data_xfer = ata_data_xfer, 204 .data_xfer = ata_data_xfer,
206 .eng_timeout = pdc_eng_timeout, 205 .eng_timeout = pdc_eng_timeout,
207 .irq_handler = pdc20621_interrupt,
208 .irq_clear = pdc20621_irq_clear, 206 .irq_clear = pdc20621_irq_clear,
209 .irq_on = ata_irq_on, 207 .irq_on = ata_irq_on,
210 .irq_ack = ata_irq_ack, 208 .irq_ack = ata_irq_ack,
@@ -214,7 +212,6 @@ static const struct ata_port_operations pdc_20621_ops = {
214static const struct ata_port_info pdc_port_info[] = { 212static const struct ata_port_info pdc_port_info[] = {
215 /* board_20621 */ 213 /* board_20621 */
216 { 214 {
217 .sht = &pdc_sata_sht,
218 .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | 215 .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
219 ATA_FLAG_SRST | ATA_FLAG_MMIO | 216 ATA_FLAG_SRST | ATA_FLAG_MMIO |
220 ATA_FLAG_NO_ATAPI | ATA_FLAG_PIO_POLLING, 217 ATA_FLAG_NO_ATAPI | ATA_FLAG_PIO_POLLING,
@@ -882,15 +879,15 @@ static void pdc_sata_setup_port(struct ata_ioports *port, void __iomem *base)
882 879
883 880
884#ifdef ATA_VERBOSE_DEBUG 881#ifdef ATA_VERBOSE_DEBUG
885static void pdc20621_get_from_dimm(struct ata_probe_ent *pe, void *psource, 882static void pdc20621_get_from_dimm(struct ata_host *host, void *psource,
886 u32 offset, u32 size) 883 u32 offset, u32 size)
887{ 884{
888 u32 window_size; 885 u32 window_size;
889 u16 idx; 886 u16 idx;
890 u8 page_mask; 887 u8 page_mask;
891 long dist; 888 long dist;
892 void __iomem *mmio = pe->iomap[PDC_MMIO_BAR]; 889 void __iomem *mmio = host->iomap[PDC_MMIO_BAR];
893 void __iomem *dimm_mmio = pe->iomap[PDC_DIMM_BAR]; 890 void __iomem *dimm_mmio = host->iomap[PDC_DIMM_BAR];
894 891
895 /* hard-code chip #0 */ 892 /* hard-code chip #0 */
896 mmio += PDC_CHIP0_OFS; 893 mmio += PDC_CHIP0_OFS;
@@ -937,15 +934,15 @@ static void pdc20621_get_from_dimm(struct ata_probe_ent *pe, void *psource,
937#endif 934#endif
938 935
939 936
940static void pdc20621_put_to_dimm(struct ata_probe_ent *pe, void *psource, 937static void pdc20621_put_to_dimm(struct ata_host *host, void *psource,
941 u32 offset, u32 size) 938 u32 offset, u32 size)
942{ 939{
943 u32 window_size; 940 u32 window_size;
944 u16 idx; 941 u16 idx;
945 u8 page_mask; 942 u8 page_mask;
946 long dist; 943 long dist;
947 void __iomem *mmio = pe->iomap[PDC_MMIO_BAR]; 944 void __iomem *mmio = host->iomap[PDC_MMIO_BAR];
948 void __iomem *dimm_mmio = pe->iomap[PDC_DIMM_BAR]; 945 void __iomem *dimm_mmio = host->iomap[PDC_DIMM_BAR];
949 946
950 /* hard-code chip #0 */ 947 /* hard-code chip #0 */
951 mmio += PDC_CHIP0_OFS; 948 mmio += PDC_CHIP0_OFS;
@@ -987,10 +984,10 @@ static void pdc20621_put_to_dimm(struct ata_probe_ent *pe, void *psource,
987} 984}
988 985
989 986
990static unsigned int pdc20621_i2c_read(struct ata_probe_ent *pe, u32 device, 987static unsigned int pdc20621_i2c_read(struct ata_host *host, u32 device,
991 u32 subaddr, u32 *pdata) 988 u32 subaddr, u32 *pdata)
992{ 989{
993 void __iomem *mmio = pe->iomap[PDC_MMIO_BAR]; 990 void __iomem *mmio = host->iomap[PDC_MMIO_BAR];
994 u32 i2creg = 0; 991 u32 i2creg = 0;
995 u32 status; 992 u32 status;
996 u32 count =0; 993 u32 count =0;
@@ -1023,17 +1020,17 @@ static unsigned int pdc20621_i2c_read(struct ata_probe_ent *pe, u32 device,
1023} 1020}
1024 1021
1025 1022
1026static int pdc20621_detect_dimm(struct ata_probe_ent *pe) 1023static int pdc20621_detect_dimm(struct ata_host *host)
1027{ 1024{
1028 u32 data=0 ; 1025 u32 data=0 ;
1029 if (pdc20621_i2c_read(pe, PDC_DIMM0_SPD_DEV_ADDRESS, 1026 if (pdc20621_i2c_read(host, PDC_DIMM0_SPD_DEV_ADDRESS,
1030 PDC_DIMM_SPD_SYSTEM_FREQ, &data)) { 1027 PDC_DIMM_SPD_SYSTEM_FREQ, &data)) {
1031 if (data == 100) 1028 if (data == 100)
1032 return 100; 1029 return 100;
1033 } else 1030 } else
1034 return 0; 1031 return 0;
1035 1032
1036 if (pdc20621_i2c_read(pe, PDC_DIMM0_SPD_DEV_ADDRESS, 9, &data)) { 1033 if (pdc20621_i2c_read(host, PDC_DIMM0_SPD_DEV_ADDRESS, 9, &data)) {
1037 if(data <= 0x75) 1034 if(data <= 0x75)
1038 return 133; 1035 return 133;
1039 } else 1036 } else
@@ -1043,13 +1040,13 @@ static int pdc20621_detect_dimm(struct ata_probe_ent *pe)
1043} 1040}
1044 1041
1045 1042
1046static int pdc20621_prog_dimm0(struct ata_probe_ent *pe) 1043static int pdc20621_prog_dimm0(struct ata_host *host)
1047{ 1044{
1048 u32 spd0[50]; 1045 u32 spd0[50];
1049 u32 data = 0; 1046 u32 data = 0;
1050 int size, i; 1047 int size, i;
1051 u8 bdimmsize; 1048 u8 bdimmsize;
1052 void __iomem *mmio = pe->iomap[PDC_MMIO_BAR]; 1049 void __iomem *mmio = host->iomap[PDC_MMIO_BAR];
1053 static const struct { 1050 static const struct {
1054 unsigned int reg; 1051 unsigned int reg;
1055 unsigned int ofs; 1052 unsigned int ofs;
@@ -1072,7 +1069,7 @@ static int pdc20621_prog_dimm0(struct ata_probe_ent *pe)
1072 mmio += PDC_CHIP0_OFS; 1069 mmio += PDC_CHIP0_OFS;
1073 1070
1074 for(i=0; i<ARRAY_SIZE(pdc_i2c_read_data); i++) 1071 for(i=0; i<ARRAY_SIZE(pdc_i2c_read_data); i++)
1075 pdc20621_i2c_read(pe, PDC_DIMM0_SPD_DEV_ADDRESS, 1072 pdc20621_i2c_read(host, PDC_DIMM0_SPD_DEV_ADDRESS,
1076 pdc_i2c_read_data[i].reg, 1073 pdc_i2c_read_data[i].reg,
1077 &spd0[pdc_i2c_read_data[i].ofs]); 1074 &spd0[pdc_i2c_read_data[i].ofs]);
1078 1075
@@ -1108,11 +1105,11 @@ static int pdc20621_prog_dimm0(struct ata_probe_ent *pe)
1108} 1105}
1109 1106
1110 1107
1111static unsigned int pdc20621_prog_dimm_global(struct ata_probe_ent *pe) 1108static unsigned int pdc20621_prog_dimm_global(struct ata_host *host)
1112{ 1109{
1113 u32 data, spd0; 1110 u32 data, spd0;
1114 int error, i; 1111 int error, i;
1115 void __iomem *mmio = pe->iomap[PDC_MMIO_BAR]; 1112 void __iomem *mmio = host->iomap[PDC_MMIO_BAR];
1116 1113
1117 /* hard-code chip #0 */ 1114 /* hard-code chip #0 */
1118 mmio += PDC_CHIP0_OFS; 1115 mmio += PDC_CHIP0_OFS;
@@ -1129,7 +1126,7 @@ static unsigned int pdc20621_prog_dimm_global(struct ata_probe_ent *pe)
1129 readl(mmio + PDC_SDRAM_CONTROL_OFFSET); 1126 readl(mmio + PDC_SDRAM_CONTROL_OFFSET);
1130 1127
1131 /* Turn on for ECC */ 1128 /* Turn on for ECC */
1132 pdc20621_i2c_read(pe, PDC_DIMM0_SPD_DEV_ADDRESS, 1129 pdc20621_i2c_read(host, PDC_DIMM0_SPD_DEV_ADDRESS,
1133 PDC_DIMM_SPD_TYPE, &spd0); 1130 PDC_DIMM_SPD_TYPE, &spd0);
1134 if (spd0 == 0x02) { 1131 if (spd0 == 0x02) {
1135 data |= (0x01 << 16); 1132 data |= (0x01 << 16);
@@ -1156,7 +1153,7 @@ static unsigned int pdc20621_prog_dimm_global(struct ata_probe_ent *pe)
1156} 1153}
1157 1154
1158 1155
1159static unsigned int pdc20621_dimm_init(struct ata_probe_ent *pe) 1156static unsigned int pdc20621_dimm_init(struct ata_host *host)
1160{ 1157{
1161 int speed, size, length; 1158 int speed, size, length;
1162 u32 addr,spd0,pci_status; 1159 u32 addr,spd0,pci_status;
@@ -1166,7 +1163,7 @@ static unsigned int pdc20621_dimm_init(struct ata_probe_ent *pe)
1166 u32 ticks=0; 1163 u32 ticks=0;
1167 u32 clock=0; 1164 u32 clock=0;
1168 u32 fparam=0; 1165 u32 fparam=0;
1169 void __iomem *mmio = pe->iomap[PDC_MMIO_BAR]; 1166 void __iomem *mmio = host->iomap[PDC_MMIO_BAR];
1170 1167
1171 /* hard-code chip #0 */ 1168 /* hard-code chip #0 */
1172 mmio += PDC_CHIP0_OFS; 1169 mmio += PDC_CHIP0_OFS;
@@ -1225,18 +1222,18 @@ static unsigned int pdc20621_dimm_init(struct ata_probe_ent *pe)
1225 Read SPD of DIMM by I2C interface, 1222 Read SPD of DIMM by I2C interface,
1226 and program the DIMM Module Controller. 1223 and program the DIMM Module Controller.
1227 */ 1224 */
1228 if (!(speed = pdc20621_detect_dimm(pe))) { 1225 if (!(speed = pdc20621_detect_dimm(host))) {
1229 printk(KERN_ERR "Detect Local DIMM Fail\n"); 1226 printk(KERN_ERR "Detect Local DIMM Fail\n");
1230 return 1; /* DIMM error */ 1227 return 1; /* DIMM error */
1231 } 1228 }
1232 VPRINTK("Local DIMM Speed = %d\n", speed); 1229 VPRINTK("Local DIMM Speed = %d\n", speed);
1233 1230
1234 /* Programming DIMM0 Module Control Register (index_CID0:80h) */ 1231 /* Programming DIMM0 Module Control Register (index_CID0:80h) */
1235 size = pdc20621_prog_dimm0(pe); 1232 size = pdc20621_prog_dimm0(host);
1236 VPRINTK("Local DIMM Size = %dMB\n",size); 1233 VPRINTK("Local DIMM Size = %dMB\n",size);
1237 1234
1238 /* Programming DIMM Module Global Control Register (index_CID0:88h) */ 1235 /* Programming DIMM Module Global Control Register (index_CID0:88h) */
1239 if (pdc20621_prog_dimm_global(pe)) { 1236 if (pdc20621_prog_dimm_global(host)) {
1240 printk(KERN_ERR "Programming DIMM Module Global Control Register Fail\n"); 1237 printk(KERN_ERR "Programming DIMM Module Global Control Register Fail\n");
1241 return 1; 1238 return 1;
1242 } 1239 }
@@ -1249,20 +1246,20 @@ static unsigned int pdc20621_dimm_init(struct ata_probe_ent *pe)
1249 '9','8','0','3','1','6','1','2',0,0}; 1246 '9','8','0','3','1','6','1','2',0,0};
1250 u8 test_parttern2[40] = {0}; 1247 u8 test_parttern2[40] = {0};
1251 1248
1252 pdc20621_put_to_dimm(pe, (void *) test_parttern2, 0x10040, 40); 1249 pdc20621_put_to_dimm(host, (void *) test_parttern2, 0x10040, 40);
1253 pdc20621_put_to_dimm(pe, (void *) test_parttern2, 0x40, 40); 1250 pdc20621_put_to_dimm(host, (void *) test_parttern2, 0x40, 40);
1254 1251
1255 pdc20621_put_to_dimm(pe, (void *) test_parttern1, 0x10040, 40); 1252 pdc20621_put_to_dimm(host, (void *) test_parttern1, 0x10040, 40);
1256 pdc20621_get_from_dimm(pe, (void *) test_parttern2, 0x40, 40); 1253 pdc20621_get_from_dimm(host, (void *) test_parttern2, 0x40, 40);
1257 printk(KERN_ERR "%x, %x, %s\n", test_parttern2[0], 1254 printk(KERN_ERR "%x, %x, %s\n", test_parttern2[0],
1258 test_parttern2[1], &(test_parttern2[2])); 1255 test_parttern2[1], &(test_parttern2[2]));
1259 pdc20621_get_from_dimm(pe, (void *) test_parttern2, 0x10040, 1256 pdc20621_get_from_dimm(host, (void *) test_parttern2, 0x10040,
1260 40); 1257 40);
1261 printk(KERN_ERR "%x, %x, %s\n", test_parttern2[0], 1258 printk(KERN_ERR "%x, %x, %s\n", test_parttern2[0],
1262 test_parttern2[1], &(test_parttern2[2])); 1259 test_parttern2[1], &(test_parttern2[2]));
1263 1260
1264 pdc20621_put_to_dimm(pe, (void *) test_parttern1, 0x40, 40); 1261 pdc20621_put_to_dimm(host, (void *) test_parttern1, 0x40, 40);
1265 pdc20621_get_from_dimm(pe, (void *) test_parttern2, 0x40, 40); 1262 pdc20621_get_from_dimm(host, (void *) test_parttern2, 0x40, 40);
1266 printk(KERN_ERR "%x, %x, %s\n", test_parttern2[0], 1263 printk(KERN_ERR "%x, %x, %s\n", test_parttern2[0],
1267 test_parttern2[1], &(test_parttern2[2])); 1264 test_parttern2[1], &(test_parttern2[2]));
1268 } 1265 }
@@ -1270,14 +1267,14 @@ static unsigned int pdc20621_dimm_init(struct ata_probe_ent *pe)
1270 1267
1271 /* ECC initiliazation. */ 1268 /* ECC initiliazation. */
1272 1269
1273 pdc20621_i2c_read(pe, PDC_DIMM0_SPD_DEV_ADDRESS, 1270 pdc20621_i2c_read(host, PDC_DIMM0_SPD_DEV_ADDRESS,
1274 PDC_DIMM_SPD_TYPE, &spd0); 1271 PDC_DIMM_SPD_TYPE, &spd0);
1275 if (spd0 == 0x02) { 1272 if (spd0 == 0x02) {
1276 VPRINTK("Start ECC initialization\n"); 1273 VPRINTK("Start ECC initialization\n");
1277 addr = 0; 1274 addr = 0;
1278 length = size * 1024 * 1024; 1275 length = size * 1024 * 1024;
1279 while (addr < length) { 1276 while (addr < length) {
1280 pdc20621_put_to_dimm(pe, (void *) &tmp, addr, 1277 pdc20621_put_to_dimm(host, (void *) &tmp, addr,
1281 sizeof(u32)); 1278 sizeof(u32));
1282 addr += sizeof(u32); 1279 addr += sizeof(u32);
1283 } 1280 }
@@ -1287,10 +1284,10 @@ static unsigned int pdc20621_dimm_init(struct ata_probe_ent *pe)
1287} 1284}
1288 1285
1289 1286
1290static void pdc_20621_init(struct ata_probe_ent *pe) 1287static void pdc_20621_init(struct ata_host *host)
1291{ 1288{
1292 u32 tmp; 1289 u32 tmp;
1293 void __iomem *mmio = pe->iomap[PDC_MMIO_BAR]; 1290 void __iomem *mmio = host->iomap[PDC_MMIO_BAR];
1294 1291
1295 /* hard-code chip #0 */ 1292 /* hard-code chip #0 */
1296 mmio += PDC_CHIP0_OFS; 1293 mmio += PDC_CHIP0_OFS;
@@ -1321,15 +1318,25 @@ static void pdc_20621_init(struct ata_probe_ent *pe)
1321static int pdc_sata_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) 1318static int pdc_sata_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
1322{ 1319{
1323 static int printed_version; 1320 static int printed_version;
1324 struct ata_probe_ent *probe_ent; 1321 const struct ata_port_info *ppi[] =
1322 { &pdc_port_info[ent->driver_data], NULL };
1323 struct ata_host *host;
1325 void __iomem *base; 1324 void __iomem *base;
1326 struct pdc_host_priv *hpriv; 1325 struct pdc_host_priv *hpriv;
1327 unsigned int board_idx = (unsigned int) ent->driver_data;
1328 int rc; 1326 int rc;
1329 1327
1330 if (!printed_version++) 1328 if (!printed_version++)
1331 dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n"); 1329 dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
1332 1330
1331 /* allocate host */
1332 host = ata_host_alloc_pinfo(&pdev->dev, ppi, 4);
1333 hpriv = devm_kzalloc(&pdev->dev, sizeof(*hpriv), GFP_KERNEL);
1334 if (!host || !hpriv)
1335 return -ENOMEM;
1336
1337 host->private_data = hpriv;
1338
1339 /* acquire resources and fill host */
1333 rc = pcim_enable_device(pdev); 1340 rc = pcim_enable_device(pdev);
1334 if (rc) 1341 if (rc)
1335 return rc; 1342 return rc;
@@ -1340,7 +1347,15 @@ static int pdc_sata_init_one (struct pci_dev *pdev, const struct pci_device_id *
1340 pcim_pin_device(pdev); 1347 pcim_pin_device(pdev);
1341 if (rc) 1348 if (rc)
1342 return rc; 1349 return rc;
1350 host->iomap = pcim_iomap_table(pdev);
1351
1352 base = host->iomap[PDC_MMIO_BAR] + PDC_CHIP0_OFS;
1353 pdc_sata_setup_port(&host->ports[0]->ioaddr, base + 0x200);
1354 pdc_sata_setup_port(&host->ports[1]->ioaddr, base + 0x280);
1355 pdc_sata_setup_port(&host->ports[2]->ioaddr, base + 0x300);
1356 pdc_sata_setup_port(&host->ports[3]->ioaddr, base + 0x380);
1343 1357
1358 /* configure and activate */
1344 rc = pci_set_dma_mask(pdev, ATA_DMA_MASK); 1359 rc = pci_set_dma_mask(pdev, ATA_DMA_MASK);
1345 if (rc) 1360 if (rc)
1346 return rc; 1361 return rc;
@@ -1348,50 +1363,13 @@ static int pdc_sata_init_one (struct pci_dev *pdev, const struct pci_device_id *
1348 if (rc) 1363 if (rc)
1349 return rc; 1364 return rc;
1350 1365
1351 probe_ent = devm_kzalloc(&pdev->dev, sizeof(*probe_ent), GFP_KERNEL); 1366 if (pdc20621_dimm_init(host))
1352 if (probe_ent == NULL)
1353 return -ENOMEM; 1367 return -ENOMEM;
1354 1368 pdc_20621_init(host);
1355 probe_ent->dev = pci_dev_to_dev(pdev);
1356 INIT_LIST_HEAD(&probe_ent->node);
1357
1358 hpriv = devm_kzalloc(&pdev->dev, sizeof(*hpriv), GFP_KERNEL);
1359 if (!hpriv)
1360 return -ENOMEM;
1361
1362 probe_ent->sht = pdc_port_info[board_idx].sht;
1363 probe_ent->port_flags = pdc_port_info[board_idx].flags;
1364 probe_ent->pio_mask = pdc_port_info[board_idx].pio_mask;
1365 probe_ent->mwdma_mask = pdc_port_info[board_idx].mwdma_mask;
1366 probe_ent->udma_mask = pdc_port_info[board_idx].udma_mask;
1367 probe_ent->port_ops = pdc_port_info[board_idx].port_ops;
1368
1369 probe_ent->irq = pdev->irq;
1370 probe_ent->irq_flags = IRQF_SHARED;
1371 probe_ent->iomap = pcim_iomap_table(pdev);
1372
1373 probe_ent->private_data = hpriv;
1374 base = probe_ent->iomap[PDC_MMIO_BAR] + PDC_CHIP0_OFS;
1375
1376 probe_ent->n_ports = 4;
1377 pdc_sata_setup_port(&probe_ent->port[0], base + 0x200);
1378 pdc_sata_setup_port(&probe_ent->port[1], base + 0x280);
1379 pdc_sata_setup_port(&probe_ent->port[2], base + 0x300);
1380 pdc_sata_setup_port(&probe_ent->port[3], base + 0x380);
1381 1369
1382 pci_set_master(pdev); 1370 pci_set_master(pdev);
1383 1371 return ata_host_activate(host, pdev->irq, pdc20621_interrupt,
1384 /* initialize adapter */ 1372 IRQF_SHARED, &pdc_sata_sht);
1385 /* initialize local dimm */
1386 if (pdc20621_dimm_init(probe_ent))
1387 return -ENOMEM;
1388 pdc_20621_init(probe_ent);
1389
1390 if (!ata_device_add(probe_ent))
1391 return -ENODEV;
1392
1393 devm_kfree(&pdev->dev, probe_ent);
1394 return 0;
1395} 1373}
1396 1374
1397 1375