summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/atp870u.c
diff options
context:
space:
mode:
authorOndrej Zary <linux@rainbow-software.org>2015-11-17 13:24:02 -0500
committerMartin K. Petersen <martin.petersen@oracle.com>2015-11-25 22:08:40 -0500
commit197fb8d85707d07eab68ac17d20e95c7104f1d5e (patch)
tree01a08dcde0cdafb90ea265f5178ab15abcdcb806 /drivers/scsi/atp870u.c
parente7d6d140328cb8c92ad749ab8a614c9299269975 (diff)
atp870u: Add wide_chip parameter to is870() and is885()
Don't check chip_ver in is870() but add wide_chip parameter for that. Then add the non-wide support to is885(). Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Hannes Reinicke <hare@suse.de> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/atp870u.c')
-rw-r--r--drivers/scsi/atp870u.c46
1 files changed, 25 insertions, 21 deletions
diff --git a/drivers/scsi/atp870u.c b/drivers/scsi/atp870u.c
index d10026a734d7..0548d0750986 100644
--- a/drivers/scsi/atp870u.c
+++ b/drivers/scsi/atp870u.c
@@ -41,7 +41,7 @@
41 41
42static struct scsi_host_template atp870u_template; 42static struct scsi_host_template atp870u_template;
43static void send_s870(struct atp_unit *dev,unsigned char c); 43static void send_s870(struct atp_unit *dev,unsigned char c);
44static void is885(struct atp_unit *dev, unsigned char c, unsigned char lvdmode); 44static void is885(struct atp_unit *dev, unsigned char c, bool wide_chip, unsigned char lvdmode);
45static void tscam_885(void); 45static void tscam_885(void);
46 46
47static inline void atp_writeb_base(struct atp_unit *atp, u8 reg, u8 val) 47static inline void atp_writeb_base(struct atp_unit *atp, u8 reg, u8 val)
@@ -1162,7 +1162,7 @@ static void tscam(struct Scsi_Host *host)
1162 } 1162 }
1163} 1163}
1164 1164
1165static void is870(struct atp_unit *dev, unsigned char c) 1165static void is870(struct atp_unit *dev, unsigned char c, bool wide_chip)
1166{ 1166{
1167 unsigned char i, j, k, rmb, n; 1167 unsigned char i, j, k, rmb, n;
1168 unsigned short int m; 1168 unsigned short int m;
@@ -1177,9 +1177,8 @@ static void is870(struct atp_unit *dev, unsigned char c)
1177 atp_writeb_io(dev, c, 0x3a, atp_readb_io(dev, c, 0x3a) | 0x10); 1177 atp_writeb_io(dev, c, 0x3a, atp_readb_io(dev, c, 0x3a) | 0x10);
1178 1178
1179 for (i = 0; i < 16; i++) { 1179 for (i = 0; i < 16; i++) {
1180 if ((dev->chip_ver != 4) && (i > 7)) { 1180 if (!wide_chip && (i > 7))
1181 break; 1181 break;
1182 }
1183 m = 1; 1182 m = 1;
1184 m = m << i; 1183 m = m << i;
1185 if ((m & dev->active_id[c]) != 0) { 1184 if ((m & dev->active_id[c]) != 0) {
@@ -1189,11 +1188,7 @@ static void is870(struct atp_unit *dev, unsigned char c)
1189 printk(KERN_INFO " ID: %2d Host Adapter\n", dev->host_id[c]); 1188 printk(KERN_INFO " ID: %2d Host Adapter\n", dev->host_id[c]);
1190 continue; 1189 continue;
1191 } 1190 }
1192 if (dev->chip_ver == 4) { 1191 atp_writeb_io(dev, c, 0x1b, wide_chip ? 0x01 : 0x00);
1193 atp_writeb_io(dev, c, 0x1b, 0x01);
1194 } else {
1195 atp_writeb_io(dev, c, 0x1b, 0x00);
1196 }
1197 atp_writeb_io(dev, c, 1, 0x08); 1192 atp_writeb_io(dev, c, 1, 0x08);
1198 atp_writeb_io(dev, c, 2, 0x7f); 1193 atp_writeb_io(dev, c, 2, 0x7f);
1199 atp_writeb_io(dev, c, 3, satn[0]); 1194 atp_writeb_io(dev, c, 3, satn[0]);
@@ -1262,7 +1257,7 @@ sel_ok:
1262 while (atp_readb_io(dev, c, 0x17) != 0x8e) 1257 while (atp_readb_io(dev, c, 0x17) != 0x8e)
1263 cpu_relax(); 1258 cpu_relax();
1264 1259
1265 if (dev->chip_ver == 4) 1260 if (wide_chip)
1266 atp_writeb_io(dev, c, 0x1b, 0x00); 1261 atp_writeb_io(dev, c, 0x1b, 0x00);
1267 1262
1268 atp_writeb_io(dev, c, 0x18, 0x08); 1263 atp_writeb_io(dev, c, 0x18, 0x08);
@@ -1298,9 +1293,8 @@ inq_ok:
1298 dev->id[c][i].devtype = mbuf[0]; 1293 dev->id[c][i].devtype = mbuf[0];
1299 rmb = mbuf[1]; 1294 rmb = mbuf[1];
1300 n = mbuf[7]; 1295 n = mbuf[7];
1301 if (dev->chip_ver != 4) { 1296 if (!wide_chip)
1302 goto not_wide; 1297 goto not_wide;
1303 }
1304 if ((mbuf[7] & 0x60) == 0) { 1298 if ((mbuf[7] & 0x60) == 0) {
1305 goto not_wide; 1299 goto not_wide;
1306 } 1300 }
@@ -1807,7 +1801,7 @@ flash_ok_880:
1807 outb(0x20, base_io + 0x51); 1801 outb(0x20, base_io + 0x51);
1808 1802
1809 tscam(shpnt); 1803 tscam(shpnt);
1810 is885(p, 0, atp_readb_base(p, 0x3f) & 0x40); 1804 is885(p, 0, true, atp_readb_base(p, 0x3f) & 0x40);
1811 outb(0xb0, base_io + 0x38); 1805 outb(0xb0, base_io + 0x38);
1812 shpnt->max_id = 16; 1806 shpnt->max_id = 16;
1813 shpnt->this_id = host_id; 1807 shpnt->this_id = host_id;
@@ -1953,10 +1947,10 @@ flash_ok_885:
1953 1947
1954 tscam_885(); 1948 tscam_885();
1955 printk(KERN_INFO " Scanning Channel A SCSI Device ...\n"); 1949 printk(KERN_INFO " Scanning Channel A SCSI Device ...\n");
1956 is885(p, 0, atp_readb_io(p, 0, 0x1b) >> 7); 1950 is885(p, 0, true, atp_readb_io(p, 0, 0x1b) >> 7);
1957 atp_writeb_io(p, 0, 0x16, 0x80); 1951 atp_writeb_io(p, 0, 0x16, 0x80);
1958 printk(KERN_INFO " Scanning Channel B SCSI Device ...\n"); 1952 printk(KERN_INFO " Scanning Channel B SCSI Device ...\n");
1959 is885(p, 1, atp_readb_io(p, 1, 0x1b) >> 7); 1953 is885(p, 1, true, atp_readb_io(p, 1, 0x1b) >> 7);
1960 atp_writeb_io(p, 1, 0x16, 0x80); 1954 atp_writeb_io(p, 1, 0x16, 0x80);
1961 k = inb(base_io + 0x28) & 0xcf; 1955 k = inb(base_io + 0x28) & 0xcf;
1962 k |= 0xc0; 1956 k |= 0xc0;
@@ -2038,7 +2032,7 @@ flash_ok_885:
2038 outb(0x20, base_io + 0x11); 2032 outb(0x20, base_io + 0x11);
2039 2033
2040 tscam(shpnt); 2034 tscam(shpnt);
2041 is870(p, 0); 2035 is870(p, 0, p->chip_ver == 4);
2042 outb((inb(base_io + 0x3a) & 0xef), base_io + 0x3a); 2036 outb((inb(base_io + 0x3a) & 0xef), base_io + 0x3a);
2043 outb((inb(base_io + 0x3b) | 0x20), base_io + 0x3b); 2037 outb((inb(base_io + 0x3b) | 0x20), base_io + 0x3b);
2044 if (atpdev->chip_ver == 4) 2038 if (atpdev->chip_ver == 4)
@@ -2258,7 +2252,7 @@ static void tscam_885(void)
2258 2252
2259 2253
2260 2254
2261static void is885(struct atp_unit *dev, unsigned char c, unsigned char lvdmode) 2255static void is885(struct atp_unit *dev, unsigned char c, bool wide_chip, unsigned char lvdmode)
2262{ 2256{
2263 unsigned char i, j, k, rmb, n; 2257 unsigned char i, j, k, rmb, n;
2264 unsigned short int m; 2258 unsigned short int m;
@@ -2273,6 +2267,8 @@ static void is885(struct atp_unit *dev, unsigned char c, unsigned char lvdmode)
2273 static unsigned char u3[9] = { 0x80, 1, 6, 4, 0x09, 00, 0x0e, 0x01, 0x02 }; 2267 static unsigned char u3[9] = { 0x80, 1, 6, 4, 0x09, 00, 0x0e, 0x01, 0x02 };
2274 2268
2275 for (i = 0; i < 16; i++) { 2269 for (i = 0; i < 16; i++) {
2270 if (!wide_chip && (i > 7))
2271 break;
2276 m = 1; 2272 m = 1;
2277 m = m << i; 2273 m = m << i;
2278 if ((m & dev->active_id[c]) != 0) { 2274 if ((m & dev->active_id[c]) != 0) {
@@ -2282,7 +2278,7 @@ static void is885(struct atp_unit *dev, unsigned char c, unsigned char lvdmode)
2282 printk(KERN_INFO " ID: %2d Host Adapter\n", dev->host_id[c]); 2278 printk(KERN_INFO " ID: %2d Host Adapter\n", dev->host_id[c]);
2283 continue; 2279 continue;
2284 } 2280 }
2285 atp_writeb_io(dev, c, 0x1b, 0x01); 2281 atp_writeb_io(dev, c, 0x1b, wide_chip ? 0x01 : 0x00);
2286 atp_writeb_io(dev, c, 1, 0x08); 2282 atp_writeb_io(dev, c, 1, 0x08);
2287 atp_writeb_io(dev, c, 2, 0x7f); 2283 atp_writeb_io(dev, c, 2, 0x7f);
2288 atp_writeb_io(dev, c, 3, satn[0]); 2284 atp_writeb_io(dev, c, 3, satn[0]);
@@ -2351,7 +2347,9 @@ sel_ok:
2351 while (atp_readb_io(dev, c, 0x17) != 0x8e) 2347 while (atp_readb_io(dev, c, 0x17) != 0x8e)
2352 cpu_relax(); 2348 cpu_relax();
2353 2349
2354 atp_writeb_io(dev, c, 0x1b, 0x00); 2350 if (wide_chip)
2351 atp_writeb_io(dev, c, 0x1b, 0x00);
2352
2355 atp_writeb_io(dev, c, 0x18, 0x08); 2353 atp_writeb_io(dev, c, 0x18, 0x08);
2356 j = 0; 2354 j = 0;
2357rd_inq_data: 2355rd_inq_data:
@@ -2385,11 +2383,17 @@ inq_ok:
2385 dev->id[c][i].devtype = mbuf[0]; 2383 dev->id[c][i].devtype = mbuf[0];
2386 rmb = mbuf[1]; 2384 rmb = mbuf[1];
2387 n = mbuf[7]; 2385 n = mbuf[7];
2386 if (!wide_chip)
2387 goto not_wide;
2388 if ((mbuf[7] & 0x60) == 0) { 2388 if ((mbuf[7] & 0x60) == 0) {
2389 goto not_wide; 2389 goto not_wide;
2390 } 2390 }
2391 if ((i < 8) && ((dev->global_map[c] & 0x20) == 0)) { 2391 if (dev->dev_id == ATP885_DEVID || dev->dev_id == ATP880_DEVID1 || dev->dev_id == ATP880_DEVID2) {
2392 goto not_wide; 2392 if ((i < 8) && ((dev->global_map[c] & 0x20) == 0))
2393 goto not_wide;
2394 } else { /* result of is870() merge - is this a bug? */
2395 if ((dev->global_map[c] & 0x20) == 0)
2396 goto not_wide;
2393 } 2397 }
2394 if (lvdmode == 0) { 2398 if (lvdmode == 0) {
2395 goto chg_wide; 2399 goto chg_wide;