From 5609fa752ca1c36d00d915e94d481a9a457c85cf Mon Sep 17 00:00:00 2001 From: Carl-Daniel Hailfinger Date: Thu, 7 Jan 2010 03:32:17 +0000 Subject: Allow one to disable programmer debug messages at compile time Programmer debug messages during programmer init/shutdown are useful because they print hardware settings and desired configuration. They help in getting a quick overview of hardware and software state on startup and shutdown. Programmer debug messages during flash chip access are mostly a distraction in logs and should only be enabled if someone is having problems which are suspected to stem from a programmer hardware or programmer software bug. Disable those messages by default, they can be reenabled by #define COMM_DEBUG in the affected programmer file. An added benefit is a tremendous size reduction in verbose probe/read/write/erase logs because only flash chip driver messages remain. In some cases, logs will shrink from 65 MB to 10 kB or less. The right(tm) fix would be two different debug levels (DEBUG and SPEW) and the ability to differentiate between programmer debug messages and flash chip debug messages. Until the design for the message printing infrastructure is finished, this is the best stop-gap measure we can get. Corresponding to flashrom svn r834. Signed-off-by: Carl-Daniel Hailfinger Acked-by: Sean Nelson --- ft2232_spi.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'ft2232_spi.c') diff --git a/ft2232_spi.c b/ft2232_spi.c index d565a6f..80c6d4e 100644 --- a/ft2232_spi.c +++ b/ft2232_spi.c @@ -29,6 +29,17 @@ #include "spi.h" #include +/* Change this to #define if you want lowlevel debugging of commands + * sent to the FT2232 SPI controller. + */ +#undef COMM_DEBUG + +#ifdef COMM_DEBUG +#define msg_comm_debug printf_debug +#else +#define msg_comm_debug(...) do {} while (0) +#endif + /* * The 'H' chips can run internally at either 12MHz or 60MHz. * The non-H chips can only run at 12MHz. @@ -224,7 +235,7 @@ int ft2232_spi_send_command(unsigned int writecnt, unsigned int readcnt, * and deassert CS# all in one shot. If reading, we do three separate * operations. */ - printf_debug("Assert CS#\n"); + msg_comm_debug("Assert CS#\n"); buf[i++] = SET_BITS_LOW; buf[i++] = 0 & ~CS_BIT; /* assertive */ buf[i++] = 0x0b; @@ -266,7 +277,7 @@ int ft2232_spi_send_command(unsigned int writecnt, unsigned int readcnt, } } - printf_debug("De-assert CS#\n"); + msg_comm_debug("De-assert CS#\n"); buf[i++] = SET_BITS_LOW; buf[i++] = CS_BIT; buf[i++] = 0x0b; -- cgit v1.1