| 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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 | 253 |
| 254 /* FIXME: this a workaround for the bug that SMBus signal would | 254 /* FIXME: this a workaround for the bug that SMBus signal would |
| 255 * interfere the EC firmware update. Should be removed if | 255 * interfere the EC firmware update. Should be removed if |
| 256 * we find out the root cause. */ | 256 * we find out the root cause. */ |
| 257 ret = system("start powerd >&2"); | 257 ret = system("start powerd >&2"); |
| 258 if (ret) { | 258 if (ret) { |
| 259 msg_perr("Cannot start powerd again.\n"); | 259 msg_perr("Cannot start powerd again.\n"); |
| 260 } | 260 } |
| 261 } | 261 } |
| 262 | 262 |
| 263 static void it85xx_shutdown(void *data) |
| 264 { |
| 265 msg_pdbg("%s():%d\n", __func__, __LINE__); |
| 266 it85xx_exit_scratch_rom(); |
| 267 } |
| 268 |
| 263 int it85xx_spi_common_init(void) | 269 int it85xx_spi_common_init(void) |
| 264 { | 270 { |
| 265 chipaddr base; | 271 chipaddr base; |
| 266 | 272 |
| 267 msg_pdbg("%s():%d superio.vendor=0x%02x\n", __func__, __LINE__, | 273 msg_pdbg("%s():%d superio.vendor=0x%02x\n", __func__, __LINE__, |
| 268 superio.vendor); | 274 superio.vendor); |
| 269 if (superio.vendor != SUPERIO_VENDOR_ITE) | 275 if (superio.vendor != SUPERIO_VENDOR_ITE) |
| 270 return 1; | 276 return 1; |
| 271 | 277 |
| 278 if (register_shutdown(it85xx_shutdown, NULL)) |
| 279 return 1; |
| 280 |
| 272 #ifdef LPC_IO | 281 #ifdef LPC_IO |
| 273 /* Get LPCPNP of SHM. That's big-endian */ | 282 /* Get LPCPNP of SHM. That's big-endian */ |
| 274 sio_write(superio.port, LDNSEL, 0x0F); /* Set LDN to SHM (0x0F) */ | 283 sio_write(superio.port, LDNSEL, 0x0F); /* Set LDN to SHM (0x0F) */ |
| 275 shm_io_base = (sio_read(superio.port, SHM_IO_BAD0) << 8) + | 284 shm_io_base = (sio_read(superio.port, SHM_IO_BAD0) << 8) + |
| 276 sio_read(superio.port, SHM_IO_BAD1); | 285 sio_read(superio.port, SHM_IO_BAD1); |
| 277 msg_pdbg("%s():%d shm_io_base=0x%04x\n", __func__, __LINE__, | 286 msg_pdbg("%s():%d shm_io_base=0x%04x\n", __func__, __LINE__, |
| 278 shm_io_base); | 287 shm_io_base); |
| 279 | 288 |
| 280 /* These pointers are not used directly. They will be send to EC's | 289 /* These pointers are not used directly. They will be send to EC's |
| 281 * register for indirect access. */ | 290 * register for indirect access. */ |
| (...skipping 11 matching lines...) Expand all Loading... |
| 293 base = (chipaddr)programmer_map_flash_region("flash base", 0xFFFFF000, | 302 base = (chipaddr)programmer_map_flash_region("flash base", 0xFFFFF000, |
| 294 0x1000); | 303 0x1000); |
| 295 msg_pdbg("%s():%d base=0x%08x\n", __func__, __LINE__, | 304 msg_pdbg("%s():%d base=0x%08x\n", __func__, __LINE__, |
| 296 (unsigned int)base); | 305 (unsigned int)base); |
| 297 ce_high = (unsigned char*)(base + 0xE00); /* 0xFFFFFE00 */ | 306 ce_high = (unsigned char*)(base + 0xE00); /* 0xFFFFFE00 */ |
| 298 ce_low = (unsigned char*)(base + 0xD00); /* 0xFFFFFD00 */ | 307 ce_low = (unsigned char*)(base + 0xD00); /* 0xFFFFFD00 */ |
| 299 #endif | 308 #endif |
| 300 | 309 |
| 301 /* Set this as spi controller. */ | 310 /* Set this as spi controller. */ |
| 302 spi_controller = SPI_CONTROLLER_IT85XX; | 311 spi_controller = SPI_CONTROLLER_IT85XX; |
| 303 | |
| 304 return 0; | 312 return 0; |
| 305 } | 313 } |
| 306 | 314 |
| 307 /* Called by programmer_entry .init */ | 315 /* Called by programmer_entry .init */ |
| 308 int it85xx_spi_init(void) | 316 int it85xx_spi_init(void) |
| 309 { | 317 { |
| 310 int ret; | 318 int ret; |
| 311 | 319 |
| 312 get_io_perms(); | 320 get_io_perms(); |
| 313 /* Probe for the Super I/O chip and fill global struct superio. */ | 321 /* Probe for the Super I/O chip and fill global struct superio. */ |
| (...skipping 21 matching lines...) Expand all Loading... |
| 335 if (!ret) { | 343 if (!ret) { |
| 336 msg_pdbg("%s():%d buses_supported=0x%x\n", __func__, __LINE__, | 344 msg_pdbg("%s():%d buses_supported=0x%x\n", __func__, __LINE__, |
| 337 buses_supported); | 345 buses_supported); |
| 338 if (buses_supported & CHIP_BUSTYPE_FWH) | 346 if (buses_supported & CHIP_BUSTYPE_FWH) |
| 339 msg_pdbg("Overriding chipset SPI with IT85 FWH|SPI.\n"); | 347 msg_pdbg("Overriding chipset SPI with IT85 FWH|SPI.\n"); |
| 340 buses_supported |= CHIP_BUSTYPE_FWH | CHIP_BUSTYPE_SPI; | 348 buses_supported |= CHIP_BUSTYPE_FWH | CHIP_BUSTYPE_SPI; |
| 341 } | 349 } |
| 342 return ret; | 350 return ret; |
| 343 } | 351 } |
| 344 | 352 |
| 345 int it85xx_shutdown(void) | |
| 346 { | |
| 347 msg_pdbg("%s():%d\n", __func__, __LINE__); | |
| 348 it85xx_exit_scratch_rom(); | |
| 349 return 0; | |
| 350 } | |
| 351 | |
| 352 /* According to ITE 8502 document, the procedure to follow mode is following: | 353 /* 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) | 354 * 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 | 355 * 2. write data to LPC/FWH address 0xffff_fdxxh (drive CE# low and MOSI |
| 355 * with data) | 356 * with data) |
| 356 * 3. read date from LPC/FWH address 0xffff_fdxxh (drive CE# low and get | 357 * 3. read date from LPC/FWH address 0xffff_fdxxh (drive CE# low and get |
| 357 * data from MISO) | 358 * data from MISO) |
| 358 */ | 359 */ |
| 359 int it85xx_spi_send_command(unsigned int writecnt, unsigned int readcnt, | 360 int it85xx_spi_send_command(unsigned int writecnt, unsigned int readcnt, |
| 360 const unsigned char *writearr, unsigned char *readarr) | 361 const unsigned char *writearr, unsigned char *readarr) |
| 361 { | 362 { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 INDIRECT_WRITE(shm_io_base, 0xFF); /* Write anything to this address.*/ | 395 INDIRECT_WRITE(shm_io_base, 0xFF); /* Write anything to this address.*/ |
| 395 #endif | 396 #endif |
| 396 #ifdef LPC_MEMORY | 397 #ifdef LPC_MEMORY |
| 397 *ce_high = 0; | 398 *ce_high = 0; |
| 398 #endif | 399 #endif |
| 399 | 400 |
| 400 return 0; | 401 return 0; |
| 401 } | 402 } |
| 402 | 403 |
| 403 #endif | 404 #endif |
| OLD | NEW |