aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
ModeNameSize
-rwxr-xr-xabs2rel.pl330logstatsplain
-rwxr-xr-xarm-magic.sh1819logstatsplain
-rwxr-xr-xbrcmImage.pl3843logstatsplain
-rwxr-xr-xbundle-libraries.sh2649logstatsplain
-rwxr-xr-xcombined-ext-image.sh1885logstatsplain
-rw-r--r--combined-image.sh1020logstatsplain
-rwxr-xr-xconfig.guess44973logstatsplain
-rwxr-xr-xconfig.rpath18343logstatsplain
-rwxr-xr-xconfig.sub34898logstatsplain
d---------config825logstatsplain
-rwxr-xr-xdeptest.sh5541logstatsplain
-rwxr-xr-xdiffconfig.sh660logstatsplain
-rwxr-xr-xdl_cleanup.py5871logstatsplain
-rwxr-xr-xdownload.pl5857logstatsplain
-rwxr-xr-xenv4727logstatsplain
-rwxr-xr-xext-toolchain.sh14490logstatsplain
-rwxr-xr-xfeeds14771logstatsplain
d---------flashing260logstatsplain
-rwxr-xr-xgen-dependencies.sh653logstatsplain
-rwxr-xr-xgetver.sh686logstatsplain
-rwxr-xr-xipkg28319logstatsplain
-rwxr-xr-xipkg-make-index.sh789logstatsplain
-rwxr-xr-xkconfig.pl3723logstatsplain
-rwxr-xr-xmake-ipkg-dir.sh747logstatsplain
-rwxr-xr-xmd5sum25logstatsplain
-rwxr-xr-xmetadata.pl20648logstatsplain
-rw-r--r--metadata.pm4526logstatsplain
-rw-r--r--om2p-fwupgradecfg-gen.sh1548logstatsplain
-rwxr-xr-xpad_image2436logstatsplain
-rwxr-xr-xpatch-kernel.sh1391logstatsplain
-rwxr-xr-xpatch-specs.sh1780logstatsplain
-rwxr-xr-xrelink-lib.sh403logstatsplain
-rwxr-xr-xremote-gdb1607logstatsplain
-rwxr-xr-xrstrip.sh800logstatsplain
-rwxr-xr-xslugimage.pl41501logstatsplain
-rwxr-xr-xstrip-kmod.sh841logstatsplain
-rwxr-xr-xsymlink-tree.sh695logstatsplain
-rwxr-xr-xtimestamp.pl1371logstatsplain
-rwxr-xr-xupdate-package-md5sum1193logstatsplain
"p">))); #endif } void eeprom_read_block(void *buf, const void *addr, size_t len) { init_spi_if_required(); //------------------------------------------------- // Wait for the write-in-progress bit to be cleared bool res = spi_eeprom_start(); if (!res) { dprint("failed to start SPI for WIP check\n"); memset(buf, 0, len); return; } spi_status_t response = spi_eeprom_wait_while_busy(EXTERNAL_EEPROM_SPI_TIMEOUT); spi_stop(); if (response == SPI_STATUS_TIMEOUT) { dprint("SPI timeout for WIP check\n"); memset(buf, 0, len); return; } //------------------------------------------------- // Perform read res = spi_eeprom_start(); if (!res) { dprint("failed to start SPI for read\n"); memset(buf, 0, len); return; } spi_write(CMD_READ); spi_eeprom_transmit_address((uintptr_t)addr); spi_receive(buf, len); #ifdef DEBUG_EEPROM_OUTPUT dprintf("[EEPROM R] 0x%08lX: ", ((uint32_t)(uintptr_t)addr)); for (size_t i = 0; i < len; ++i) { dprintf(" %02X", (int)(((uint8_t *)buf)[i])); } dprintf("\n"); #endif // DEBUG_EEPROM_OUTPUT spi_stop(); } void eeprom_write_block(const void *buf, void *addr, size_t len) { init_spi_if_required(); bool res; uint8_t * read_buf = (uint8_t *)buf; uintptr_t target_addr = (uintptr_t)addr; while (len > 0) { uintptr_t page_offset = target_addr % EXTERNAL_EEPROM_PAGE_SIZE; int write_length = EXTERNAL_EEPROM_PAGE_SIZE - page_offset; if (write_length > len) { write_length = len; } //------------------------------------------------- // Wait for the write-in-progress bit to be cleared res = spi_eeprom_start(); if (!res) { dprint("failed to start SPI for WIP check\n"); return; } spi_status_t response = spi_eeprom_wait_while_busy(EXTERNAL_EEPROM_SPI_TIMEOUT); spi_stop(); if (response == SPI_STATUS_TIMEOUT) { dprint("SPI timeout for WIP check\n"); return; } //------------------------------------------------- // Enable writes res = spi_eeprom_start(); if (!res) { dprint("failed to start SPI for write-enable\n"); return; } spi_write(CMD_WREN); spi_stop(); //------------------------------------------------- // Perform the write res = spi_eeprom_start(); if (!res) { dprint("failed to start SPI for write\n"); return; } #ifdef DEBUG_EEPROM_OUTPUT dprintf("[EEPROM W] 0x%08lX: ", ((uint32_t)(uintptr_t)target_addr)); for (size_t i = 0; i < write_length; i++) { dprintf(" %02X", (int)(uint8_t)(read_buf[i])); } dprintf("\n"); #endif // DEBUG_EEPROM_OUTPUT spi_write(CMD_WRITE); spi_eeprom_transmit_address(target_addr); spi_transmit(read_buf, write_length); spi_stop(); read_buf += write_length; target_addr += write_length; len -= write_length; } //------------------------------------------------- // Disable writes res = spi_eeprom_start(); if (!res) { dprint("failed to start SPI for write-disable\n"); return; } spi_write(CMD_WRDI); spi_stop(); }