summaryrefslogtreecommitdiffstats
path: root/serial.c
Commit message (Collapse)AuthorAgeFilesLines
* Add serial port bitbanging codeVirgil-Adrian Teaca2012-04-301-0/+55
| | | | | | | | | | | This adds the pony_spi driver which supports the SI_Prog adapter, which is commonly used for SPI chips with PonyProg 2000, and a custom adapter called "SERBANG" which differs in the logic of two pins. Corresponding to flashrom svn r1525. Signed-off-by: Virgil-Adrian Teaca <darkstarlinux@gmail.com> Acked-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
* Fix unchecked malloc calls and casts of malloc return valuesStefan Tauner2011-07-121-0/+2
| | | | | | | | | | | | In the long term the exit calls should be replaced by returns. until then this is the correct way to handle failures. the casts are not needed (in C) and we don't cast malloc return values anywhere else. Corresponding to flashrom svn r1370. Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
* Fix and improve Windows/MinGW/MSYS buildUwe Hermann2011-07-031-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | - Makefile: Use $(OS_ARCH) to add some MinGW-specific workarounds and settings, so that a simple "make" is sufficient on MinGW (instead of manual Makefile hacking). - Explicitly set CC=gcc in the Makefile, otherwise you get an error like "cc: command not found" on MinGW. - MinGW doesn't have ffs(), use gcc's __builtin_ffs() instead. - Add /usr/local/include and /usr/local/lib to CPPFLAGS/LDFLAGS, that's where libusb-win32 and libftdi stuff is usually placed on MinGW/MSYS. - Disable serprog (no sockets) and all PCI-based programmers (no libpci) for now. That leaves dummy, ft2232_spi, and buspirate_spi enabled on MinGW per default. - serial.c: Use correct type for 'tmp', both on Windows/MinGW (DWORD) and POSIX (ssize_t). Corresponding to flashrom svn r1363. Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de> Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
* Use shutdown callback mechanism to shutdown programmersDavid Hendricks2011-06-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch attempts to resolve some programmer shutdown ordering issues by having the programmer init functions register shutdown callbacks explicitly wherever it makes most sense. Before, assumptions were made that could lead to the internal programmer's state changing before the external programmer could be shut down properly. Now, each programmer cleans up after itself and (hopefully) performs each operation in the correct order. As a side-effect, this patch gives us a better usage model for reverse operations such as rpci_* and rmmio_*. In the long-run, this should make reversing the initialization process easier to understand, less tedious, and less error-prone. In short, this patch does the following: - Registers a shutdown callback during initialization for each programmer. - Kills the .shutdown function pointer from programmer_entry struct. Also, make most shutdown functions static. - Adds a few minor clean-ups and corrections (e.g. missing physunmap() calls). TODO: Remove forward declaration of serprog_shutdown() (added to simplify diff) Corresponding to flashrom svn r1338. Signed-off-by: David Hendricks <dhendrix@google.com> Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
* Multiple unrelated changesCarl-Daniel Hailfinger2010-10-081-2/+3
| | | | | | | | | | | | | | | CONFIG_BITBANG_SPI was not selected if CONFIG_NICINTEL_SPI was on by default. Wiki output was missing all flash chips if CONFIG_INTERNAL was not selected. Use correct type for toupper()/tolower()/isspace() functions. Specify software requirements in a generic way. Non-x86 compilation does not work with the default programmer set, so list the make parameters which result in a working build. Corresponding to flashrom svn r1203. Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Acked-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
* Remove duplicate includes from the codeStefan Reinauer2010-10-061-1/+0
| | | | | | | Corresponding to flashrom svn r1196. Signed-off-by: Stefan Reinauer <stepan@coresystems.de> Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
* Handle Bus Pirates already in bit banging mode correctlyCarl-Daniel Hailfinger2010-09-161-2/+6
| | | | | | | | | | | | | | | | | | | | Thanks to Johannes Sjölund for reporting that the Bus Pirate init could not deal with a Bus Pirate which is already in binary Bitbang mode. This is caused by a combination of the slowness of the Bus Pirate, the slowness of USB and a fast serial port flush routine which just flushes the buffer contents and does not wait until data arrival stops. Make the Bus Pirate init more robust by running the flush command 10 times with 1.5 ms delay in between. This code development was sponsored by Mattias Mattsson. Thanks! Tested a few dozen times, should work reliably. Corresponding to flashrom svn r1178. Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Acked-by: Mattias Mattsson <vitplister@gmail.com>
* Split off programmer.h from flash.hCarl-Daniel Hailfinger2010-07-271-1/+2
| | | | | | | | | | | | | | | | | | | | | Programmer specific functions are of absolutely no interest to any file except those dealing with programmer specific actions (special SPI commands and the generic core). The new header structure is as follows (and yes, improvements are possible): flashchips.h flash chip IDs chipdrivers.h chip-specific read/write/... functions flash.h common header for all stuff that doesn't fit elsewhere hwaccess.h hardware access functions programmer.h programmer specific functions coreboot_tables.h header from coreboot, internal programmer only spi.h SPI command definitions Corresponding to flashrom svn r1112. Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
* Various coding style and cosmetic changesUwe Hermann2010-03-131-11/+12
| | | | | | | | | | | | | - Fix coding-style, whitespace, and indentation in a few places. - Consistently use the same spelling ("Super I/O") everywhere. Corresponding to flashrom svn r933. - Make some flashrom stdout output look a bit nicer. Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de> Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
* Windows wants UNC names for COM ports >9 (legacy COM ports only work with ↵Patrick Georgi2010-01-261-1/+9
| | | | | | | | | | | | | one digit) As UNC also works for smaller names, just retarget all requests for dev=COMx on win32 to \\.\COMx. Tested with large and small COM port numbers on XP. Corresponding to flashrom svn r883. Signed-off-by: Patrick Georgi <patrick.georgi@coresystems.de> Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
* Convert all messages in serial.c to the new message infrastructureSean Nelson2010-01-091-3/+3
| | | | | | | Corresponding to flashrom svn r848. Signed-off-by: Sean Nelson <audiohacked@gmail.com> Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
* Buspiratespi support on mingwPatrick Georgi2010-01-061-4/+53
| | | | | | | Corresponding to flashrom svn r832. Signed-off-by: Patrick Georgi <patrick.georgi@coresystems.de> Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
* Multiple unrelated changesPatrick Georgi2010-01-061-29/+9
| | | | | | | | | | | | | | | - replace the hand written serial input flush routine with the termios one. - serialport_discard_read isn't necessary anymore - it just wrapped sp_flush_incoming with no extra value. - serialport_read and serialport_write would misbehave if read or write didn't process everything in one go. - sp_flush_incoming should be #define'd out for FAKE_COMMUNICATION like serialport_discard_read was Corresponding to flashrom svn r831. Signed-off-by: Patrick Georgi <patrick.georgi@coresystems.de> Acked-by: Sean Nelson <audiohacked@gmail.com>
* Move OS-dependent serial code from buspirate_spi.c to serial.cCarl-Daniel Hailfinger2010-01-061-0/+52
| | | | | | | | | | While at it, also rename a few functions to make it obvious that they are generic and not specific to the Bus Pirate. Corresponding to flashrom svn r830. Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Acked-by: Patrick Georgi <patrick.georgi@coresystems.de>
* Move serial handling from serprog.c to serial.cCarl-Daniel Hailfinger2009-11-231-0/+142
This is the first step in enabling platform independent serprog and it also allows other drivers to use serial port functionality without requiring serprog. Pure code move, no code changed. Corresponding to flashrom svn r771. Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
OpenPOWER on IntegriCloud