]> git.ipfire.org Git - ipfire-2.x.git/blame - src/patches/suse-2.6.27.39/patches.kernel.org/revert-scsi-qla2xxx-correct-atmel-flash-part-handling.patch
Imported linux-2.6.27.39 suse/xen patches.
[ipfire-2.x.git] / src / patches / suse-2.6.27.39 / patches.kernel.org / revert-scsi-qla2xxx-correct-atmel-flash-part-handling.patch
CommitLineData
2cb7cef9
BS
1From 821b3996001508e872582dcafc7575021f122728 Mon Sep 17 00:00:00 2001
2From: Lalit Chandivade <lalit.chandivade@qlogic.com>
3Date: Fri, 24 Oct 2008 15:13:44 -0700
4Subject: revert - SCSI: qla2xxx: Correct Atmel flash-part handling.
5
6-------------------
7This is a revert of this patch that is included in 2.6.27.7
8as a further qla2xxx driver update in the series conflicts with this
9 - gregkh
10-------------------
11
12From: Lalit Chandivade <lalit.chandivade@qlogic.com>
13
14commit 821b3996001508e872582dcafc7575021f122728 upstream.
15
16Use correct block size (4K) for erase command 0x20 for Atmel
17Flash. Use dword addresses for determining sector boundary.
18
19Signed-off-by: Lalit Chandivade <lalit.chandivade@qlogic.com>
20Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
21Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
22Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
23
24---
25
26---
27 drivers/scsi/qla2xxx/qla_def.h | 1 +
28 drivers/scsi/qla2xxx/qla_sup.c | 23 ++++++++++++++---------
29 2 files changed, 15 insertions(+), 9 deletions(-)
30
31--- a/drivers/scsi/qla2xxx/qla_def.h
32+++ b/drivers/scsi/qla2xxx/qla_def.h
33@@ -2546,6 +2546,7 @@ typedef struct scsi_qla_host {
34 uint8_t fcode_revision[16];
35 uint32_t fw_revision[4];
36
37+ uint16_t fdt_odd_index;
38 uint32_t fdt_wrt_disable;
39 uint32_t fdt_erase_cmd;
40 uint32_t fdt_block_size;
41--- a/drivers/scsi/qla2xxx/qla_sup.c
42+++ b/drivers/scsi/qla2xxx/qla_sup.c
43@@ -546,7 +546,6 @@ qla24xx_get_flash_manufacturer(scsi_qla_
44 void
45 qla2xxx_get_flash_info(scsi_qla_host_t *ha)
46 {
47-#define FLASH_BLK_SIZE_4K 0x1000
48 #define FLASH_BLK_SIZE_32K 0x8000
49 #define FLASH_BLK_SIZE_64K 0x10000
50 uint16_t cnt, chksum;
51@@ -578,6 +577,7 @@ qla2xxx_get_flash_info(scsi_qla_host_t *
52 goto no_flash_data;
53 }
54
55+ ha->fdt_odd_index = le16_to_cpu(fdt->man_id) == 0x1f;
56 ha->fdt_wrt_disable = fdt->wrt_disable_bits;
57 ha->fdt_erase_cmd = flash_conf_to_access_addr(0x0300 | fdt->erase_cmd);
58 ha->fdt_block_size = le32_to_cpu(fdt->block_size);
59@@ -590,10 +590,10 @@ qla2xxx_get_flash_info(scsi_qla_host_t *
60 }
61
62 DEBUG2(qla_printk(KERN_DEBUG, ha, "Flash[FDT]: (0x%x/0x%x) erase=0x%x "
63- "pro=%x upro=%x wrtd=0x%x blk=0x%x.\n",
64+ "pro=%x upro=%x idx=%d wrtd=0x%x blk=0x%x.\n",
65 le16_to_cpu(fdt->man_id), le16_to_cpu(fdt->id), ha->fdt_erase_cmd,
66 ha->fdt_protect_sec_cmd, ha->fdt_unprotect_sec_cmd,
67- ha->fdt_wrt_disable, ha->fdt_block_size));
68+ ha->fdt_odd_index, ha->fdt_wrt_disable, ha->fdt_block_size));
69 return;
70
71 no_flash_data:
72@@ -614,7 +614,8 @@ no_flash_data:
73 ha->fdt_block_size = FLASH_BLK_SIZE_64K;
74 break;
75 case 0x1f: /* Atmel 26DF081A. */
76- ha->fdt_block_size = FLASH_BLK_SIZE_4K;
77+ ha->fdt_odd_index = 1;
78+ ha->fdt_block_size = FLASH_BLK_SIZE_64K;
79 ha->fdt_erase_cmd = flash_conf_to_access_addr(0x0320);
80 ha->fdt_unprotect_sec_cmd = flash_conf_to_access_addr(0x0339);
81 ha->fdt_protect_sec_cmd = flash_conf_to_access_addr(0x0336);
82@@ -626,9 +627,9 @@ no_flash_data:
83 }
84
85 DEBUG2(qla_printk(KERN_DEBUG, ha, "Flash[MID]: (0x%x/0x%x) erase=0x%x "
86- "pro=%x upro=%x wrtd=0x%x blk=0x%x.\n", man_id, flash_id,
87+ "pro=%x upro=%x idx=%d wrtd=0x%x blk=0x%x.\n", man_id, flash_id,
88 ha->fdt_erase_cmd, ha->fdt_protect_sec_cmd,
89- ha->fdt_unprotect_sec_cmd, ha->fdt_wrt_disable,
90+ ha->fdt_unprotect_sec_cmd, ha->fdt_odd_index, ha->fdt_wrt_disable,
91 ha->fdt_block_size));
92 }
93
94@@ -709,9 +710,13 @@ qla24xx_write_flash_data(scsi_qla_host_t
95 qla24xx_unprotect_flash(ha);
96
97 for (liter = 0; liter < dwords; liter++, faddr++, dwptr++) {
98-
99- findex = faddr;
100- fdata = (findex & sec_mask) << 2;
101+ if (ha->fdt_odd_index) {
102+ findex = faddr << 2;
103+ fdata = findex & sec_mask;
104+ } else {
105+ findex = faddr;
106+ fdata = (findex & sec_mask) << 2;
107+ }
108
109 /* Are we at the beginning of a sector? */
110 if ((findex & rest_addr) == 0) {