OLD | NEW |
1 /* | 1 /* |
2 * This file is part of the flashrom project. | 2 * This file is part of the flashrom project. |
3 * | 3 * |
4 * Copyright (C) 2007, 2008, 2009 Carl-Daniel Hailfinger | 4 * Copyright (C) 2007, 2008, 2009 Carl-Daniel Hailfinger |
5 * Copyright (C) 2008 Ronald Hoogenboom <ronald@zonnet.nl> | 5 * Copyright (C) 2008 Ronald Hoogenboom <ronald@zonnet.nl> |
6 * Copyright (C) 2008 coresystems GmbH | 6 * Copyright (C) 2008 coresystems GmbH |
7 * Copyright (C) 2010 Google Inc. | 7 * Copyright (C) 2010 Google Inc. |
8 * | 8 * |
9 * This program is free software; you can redistribute it and/or modify | 9 * This program is free software; you can redistribute it and/or modify |
10 * it under the terms of the GNU General Public License as published by | 10 * it under the terms of the GNU General Public License as published by |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 #ifdef LPC_IO | 72 #ifdef LPC_IO |
73 /* macro to fill in indirect-access registers. */ | 73 /* macro to fill in indirect-access registers. */ |
74 #define INDIRECT_A0(base, value) OUTB(value, (base) + 0) /* little-endian */ | 74 #define INDIRECT_A0(base, value) OUTB(value, (base) + 0) /* little-endian */ |
75 #define INDIRECT_A1(base, value) OUTB(value, (base) + 1) | 75 #define INDIRECT_A1(base, value) OUTB(value, (base) + 1) |
76 #define INDIRECT_A2(base, value) OUTB(value, (base) + 2) | 76 #define INDIRECT_A2(base, value) OUTB(value, (base) + 2) |
77 #define INDIRECT_A3(base, value) OUTB(value, (base) + 3) | 77 #define INDIRECT_A3(base, value) OUTB(value, (base) + 3) |
78 #define INDIRECT_READ(base) INB((base) + 4) | 78 #define INDIRECT_READ(base) INB((base) + 4) |
79 #define INDIRECT_WRITE(base, value) OUTB(value, (base) + 4) | 79 #define INDIRECT_WRITE(base, value) OUTB(value, (base) + 4) |
80 #endif /* LPC_IO */ | 80 #endif /* LPC_IO */ |
81 | 81 |
| 82 void it85xx_shutdown(void *); |
| 83 |
82 #ifdef LPC_IO | 84 #ifdef LPC_IO |
83 unsigned int shm_io_base; | 85 unsigned int shm_io_base; |
84 #endif | 86 #endif |
85 unsigned char *ce_high, *ce_low; | 87 unsigned char *ce_high, *ce_low; |
86 static int it85xx_scratch_rom_reenter = 0; | 88 static int it85xx_scratch_rom_reenter = 0; |
87 | 89 |
88 uint16_t probe_id_ite85(uint16_t port) | 90 uint16_t probe_id_ite85(uint16_t port) |
89 { | 91 { |
90 uint16_t id; | 92 uint16_t id; |
91 | 93 |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 0x1000); | 296 0x1000); |
295 msg_pdbg("%s():%d base=0x%08x\n", __func__, __LINE__, | 297 msg_pdbg("%s():%d base=0x%08x\n", __func__, __LINE__, |
296 (unsigned int)base); | 298 (unsigned int)base); |
297 ce_high = (unsigned char*)(base + 0xE00); /* 0xFFFFFE00 */ | 299 ce_high = (unsigned char*)(base + 0xE00); /* 0xFFFFFE00 */ |
298 ce_low = (unsigned char*)(base + 0xD00); /* 0xFFFFFD00 */ | 300 ce_low = (unsigned char*)(base + 0xD00); /* 0xFFFFFD00 */ |
299 #endif | 301 #endif |
300 | 302 |
301 /* Set this as spi controller. */ | 303 /* Set this as spi controller. */ |
302 spi_controller = SPI_CONTROLLER_IT85XX; | 304 spi_controller = SPI_CONTROLLER_IT85XX; |
303 | 305 |
| 306 register_shutdown(it85xx_shutdown, NULL); |
304 return 0; | 307 return 0; |
305 } | 308 } |
306 | 309 |
307 /* Called by programmer_entry .init */ | 310 /* Called by programmer_entry .init */ |
308 int it85xx_spi_init(void) | 311 int it85xx_spi_init(void) |
309 { | 312 { |
310 int ret; | 313 int ret; |
311 | 314 |
312 get_io_perms(); | 315 get_io_perms(); |
313 /* Probe for the Super I/O chip and fill global struct superio. */ | 316 /* Probe for the Super I/O chip and fill global struct superio. */ |
(...skipping 21 matching lines...) Expand all Loading... |
335 if (!ret) { | 338 if (!ret) { |
336 msg_pdbg("%s():%d buses_supported=0x%x\n", __func__, __LINE__, | 339 msg_pdbg("%s():%d buses_supported=0x%x\n", __func__, __LINE__, |
337 buses_supported); | 340 buses_supported); |
338 if (buses_supported & CHIP_BUSTYPE_FWH) | 341 if (buses_supported & CHIP_BUSTYPE_FWH) |
339 msg_pdbg("Overriding chipset SPI with IT85 FWH|SPI.\n"); | 342 msg_pdbg("Overriding chipset SPI with IT85 FWH|SPI.\n"); |
340 buses_supported |= CHIP_BUSTYPE_FWH | CHIP_BUSTYPE_SPI; | 343 buses_supported |= CHIP_BUSTYPE_FWH | CHIP_BUSTYPE_SPI; |
341 } | 344 } |
342 return ret; | 345 return ret; |
343 } | 346 } |
344 | 347 |
345 int it85xx_shutdown(void) | 348 void it85xx_shutdown(void *data) |
346 { | 349 { |
347 msg_pdbg("%s():%d\n", __func__, __LINE__); | 350 msg_pdbg("%s():%d\n", __func__, __LINE__); |
348 it85xx_exit_scratch_rom(); | 351 it85xx_exit_scratch_rom(); |
349 return 0; | |
350 } | 352 } |
351 | 353 |
352 /* According to ITE 8502 document, the procedure to follow mode is following: | 354 /* According to ITE 8502 document, the procedure to follow mode is following: |
353 * 1. write 0x00 to LPC/FWH address 0xffff_fexxh (drive CE# high) | 355 * 1. write 0x00 to LPC/FWH address 0xffff_fexxh (drive CE# high) |
354 * 2. write data to LPC/FWH address 0xffff_fdxxh (drive CE# low and MOSI | 356 * 2. write data to LPC/FWH address 0xffff_fdxxh (drive CE# low and MOSI |
355 * with data) | 357 * with data) |
356 * 3. read date from LPC/FWH address 0xffff_fdxxh (drive CE# low and get | 358 * 3. read date from LPC/FWH address 0xffff_fdxxh (drive CE# low and get |
357 * data from MISO) | 359 * data from MISO) |
358 */ | 360 */ |
359 int it85xx_spi_send_command(unsigned int writecnt, unsigned int readcnt, | 361 int it85xx_spi_send_command(unsigned int writecnt, unsigned int readcnt, |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 INDIRECT_WRITE(shm_io_base, 0xFF); /* Write anything to this address.*/ | 396 INDIRECT_WRITE(shm_io_base, 0xFF); /* Write anything to this address.*/ |
395 #endif | 397 #endif |
396 #ifdef LPC_MEMORY | 398 #ifdef LPC_MEMORY |
397 *ce_high = 0; | 399 *ce_high = 0; |
398 #endif | 400 #endif |
399 | 401 |
400 return 0; | 402 return 0; |
401 } | 403 } |
402 | 404 |
403 #endif | 405 #endif |
OLD | NEW |