aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/aic7xxx/aic7xxx_93cx6.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/aic7xxx/aic7xxx_93cx6.c')
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_93cx6.c36
1 files changed, 27 insertions, 9 deletions
diff --git a/drivers/scsi/aic7xxx/aic7xxx_93cx6.c b/drivers/scsi/aic7xxx/aic7xxx_93cx6.c
index 468d612a44f6..3cb07e114e89 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_93cx6.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_93cx6.c
@@ -28,9 +28,7 @@
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE. 29 * SUCH DAMAGE.
30 * 30 *
31 * $Id: //depot/aic7xxx/aic7xxx/aic7xxx_93cx6.c#17 $ 31 * $Id: //depot/aic7xxx/aic7xxx/aic7xxx_93cx6.c#19 $
32 *
33 * $FreeBSD$
34 */ 32 */
35 33
36/* 34/*
@@ -64,7 +62,6 @@
64 * is preceded by an initial zero (leading 0, followed by 16-bits, MSB 62 * is preceded by an initial zero (leading 0, followed by 16-bits, MSB
65 * first). The clock cycling from low to high initiates the next data 63 * first). The clock cycling from low to high initiates the next data
66 * bit to be sent from the chip. 64 * bit to be sent from the chip.
67 *
68 */ 65 */
69 66
70#ifdef __linux__ 67#ifdef __linux__
@@ -81,14 +78,22 @@
81 * Right now, we only have to read the SEEPROM. But we make it easier to 78 * Right now, we only have to read the SEEPROM. But we make it easier to
82 * add other 93Cx6 functions. 79 * add other 93Cx6 functions.
83 */ 80 */
84static struct seeprom_cmd { 81struct seeprom_cmd {
85 uint8_t len; 82 uint8_t len;
86 uint8_t bits[9]; 83 uint8_t bits[11];
87} seeprom_read = {3, {1, 1, 0}}; 84};
88 85
86/* Short opcodes for the c46 */
89static struct seeprom_cmd seeprom_ewen = {9, {1, 0, 0, 1, 1, 0, 0, 0, 0}}; 87static struct seeprom_cmd seeprom_ewen = {9, {1, 0, 0, 1, 1, 0, 0, 0, 0}};
90static struct seeprom_cmd seeprom_ewds = {9, {1, 0, 0, 0, 0, 0, 0, 0, 0}}; 88static struct seeprom_cmd seeprom_ewds = {9, {1, 0, 0, 0, 0, 0, 0, 0, 0}};
89
90/* Long opcodes for the C56/C66 */
91static struct seeprom_cmd seeprom_long_ewen = {11, {1, 0, 0, 1, 1, 0, 0, 0, 0}};
92static struct seeprom_cmd seeprom_long_ewds = {11, {1, 0, 0, 0, 0, 0, 0, 0, 0}};
93
94/* Common opcodes */
91static struct seeprom_cmd seeprom_write = {3, {1, 0, 1}}; 95static struct seeprom_cmd seeprom_write = {3, {1, 0, 1}};
96static struct seeprom_cmd seeprom_read = {3, {1, 1, 0}};
92 97
93/* 98/*
94 * Wait for the SEERDY to go high; about 800 ns. 99 * Wait for the SEERDY to go high; about 800 ns.
@@ -222,12 +227,25 @@ int
222ahc_write_seeprom(struct seeprom_descriptor *sd, uint16_t *buf, 227ahc_write_seeprom(struct seeprom_descriptor *sd, uint16_t *buf,
223 u_int start_addr, u_int count) 228 u_int start_addr, u_int count)
224{ 229{
230 struct seeprom_cmd *ewen, *ewds;
225 uint16_t v; 231 uint16_t v;
226 uint8_t temp; 232 uint8_t temp;
227 int i, k; 233 int i, k;
228 234
229 /* Place the chip into write-enable mode */ 235 /* Place the chip into write-enable mode */
230 send_seeprom_cmd(sd, &seeprom_ewen); 236 if (sd->sd_chip == C46) {
237 ewen = &seeprom_ewen;
238 ewds = &seeprom_ewds;
239 } else if (sd->sd_chip == C56_66) {
240 ewen = &seeprom_long_ewen;
241 ewds = &seeprom_long_ewds;
242 } else {
243 printf("ahc_write_seeprom: unsupported seeprom type %d\n",
244 sd->sd_chip);
245 return (0);
246 }
247
248 send_seeprom_cmd(sd, ewen);
231 reset_seeprom(sd); 249 reset_seeprom(sd);
232 250
233 /* Write all requested data out to the seeprom. */ 251 /* Write all requested data out to the seeprom. */
@@ -277,7 +295,7 @@ ahc_write_seeprom(struct seeprom_descriptor *sd, uint16_t *buf,
277 } 295 }
278 296
279 /* Put the chip back into write-protect mode */ 297 /* Put the chip back into write-protect mode */
280 send_seeprom_cmd(sd, &seeprom_ewds); 298 send_seeprom_cmd(sd, ewds);
281 reset_seeprom(sd); 299 reset_seeprom(sd);
282 300
283 return (1); 301 return (1);