Patch with SPI mode init code.
On Sat, Nov 21, 2009 at 2:50 AM, Sean Nelson <audiohacked(a)gmail.com> wrote:
> Verbose log of flashrom-buspiratespi.
>
> On Fri, Nov 20, 2009 at 8:53 PM, Carl-Daniel Hailfinger
> <c-d.hailfinger.devel.2006(a)gmx.net> wrote:
>> Add Bus Pirate SPI support to flashrom.
>>
>> Untested, should work.
>>
>> Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006(a)gmx.net>
>>
>> Index: flashrom-buspiratespi/flash.h
>> ===================================================================
>> --- flashrom-buspiratespi/flash.h    (Revision 767)
>> +++ flashrom-buspiratespi/flash.h    (Arbeitskopie)
>> @@ -104,6 +104,9 @@
>> Â #if SERPROG_SUPPORT == 1
>> Â Â Â Â PROGRAMMER_SERPROG,
>> Â #endif
>> +#if BUSPIRATE_SPI_SUPPORT == 1
>> + Â Â Â PROGRAMMER_BUSPIRATESPI,
>> +#endif
>> Â Â Â Â PROGRAMMER_INVALID /* This must always be the last entry. */
>> Â };
>>
>> @@ -484,6 +487,12 @@
>> Â int bitbang_spi_read(struct flashchip *flash, uint8_t *buf, int start, int len);
>> Â int bitbang_spi_write_256(struct flashchip *flash, uint8_t *buf);
>>
>> +/* buspirate_spi.c */
>> +int buspirate_spi_init(void);
>> +int buspirate_spi_shutdown(void);
>> +int buspirate_spi_send_command(unsigned int writecnt, unsigned int readcnt, const unsigned char *writearr, unsigned char *readarr);
>> +int buspirate_spi_read(struct flashchip *flash, uint8_t *buf, int start, int len);
>> +
>> Â /* flashrom.c */
>> Â extern char *programmer_param;
>> Â extern int verbose;
>> @@ -527,6 +536,9 @@
>> Â #if DUMMY_SUPPORT == 1
>> Â Â Â Â SPI_CONTROLLER_DUMMY,
>> Â #endif
>> +#if BUSPIRATE_SPI_SUPPORT == 1
>> + Â Â Â SPI_CONTROLLER_BUSPIRATE,
>> +#endif
>> Â Â Â Â SPI_CONTROLLER_INVALID /* This must always be the last entry. */
>> Â };
>> Â extern const int spi_programmer_count;
>> @@ -736,5 +748,8 @@
>> Â uint8_t serprog_chip_readb(const chipaddr addr);
>> Â void serprog_chip_readn(uint8_t *buf, const chipaddr addr, size_t len);
>> Â void serprog_delay(int delay);
>> +void sp_flush_incoming(void);
>> +int sp_openserport(char *dev, unsigned int baud);
>> +extern int sp_fd;
>>
>>  #endif             /* !__FLASH_H__ */
>> Index: flashrom-buspiratespi/buspirate_spi.c
>> ===================================================================
>> --- flashrom-buspiratespi/buspirate_spi.c    (Revision 0)
>> +++ flashrom-buspiratespi/buspirate_spi.c    (Revision 0)
>> @@ -0,0 +1,317 @@
>> +/*
>> + * This file is part of the flashrom project.
>> + *
>> + * Copyright (C) 2009 Carl-Daniel Hailfinger
>> + *
>> + * This program is free software; you can redistribute it and/or modify
>> + * it under the terms of the GNU General Public License as published by
>> + * the Free Software Foundation; version 2 of the License.
>> + *
>> + * This program is distributed in the hope that it will be useful,
>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Â See the
>> + * GNU General Public License for more details.
>> + *
>> + * You should have received a copy of the GNU General Public License
>> + * along with this program; if not, write to the Free Software
>> + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA Â 02110-1301 USA
>> + */
>> +
>> +#include <stdio.h>
>> +#include <stdint.h>
>> +#include <string.h>
>> +#include <stdlib.h>
>> +#include <ctype.h>
>> +#include <fcntl.h>
>> +#include "flash.h"
>> +#include "spi.h"
>> +
>> +int buspirate_serialport_setup(char *dev)
>> +{
>> + Â Â Â /* 115200bps, 8 databits, no parity, 1 stopbit */
>> + Â Â Â sp_fd = sp_openserport(dev, 115200);
>> + Â Â Â return 0;
>> +}
>> +
>> +int buspirate_serialport_shutdown(void)
>> +{
>> + Â Â Â close(sp_fd);
>> + Â Â Â return 0;
>> +}
>> +
>> +int serialport_write(unsigned char *buf, unsigned int writecnt)
>> +{
>> + Â Â Â int tmp = 0;
>> +
>> + Â Â Â while (tmp != writecnt) {
>> + Â Â Â Â Â Â Â tmp = write(sp_fd, buf + tmp, writecnt - tmp);
>> + Â Â Â Â Â Â Â if (tmp == -1)
>> + Â Â Â Â Â Â Â Â Â Â Â return 1;
>> + Â Â Â Â Â Â Â if (!tmp)
>> + Â Â Â Â Â Â Â Â Â Â Â printf_debug("Empty write\n");
>> + Â Â Â }
>> +
>> + Â Â Â return 0;
>> +}
>> +
>> +int serialport_read(unsigned char *buf, unsigned int readcnt)
>> +{
>> + Â Â Â int tmp = 0;
>> +
>> + Â Â Â while (tmp != readcnt) {
>> + Â Â Â Â Â Â Â tmp = read(sp_fd, buf + tmp, readcnt - tmp);
>> + Â Â Â Â Â Â Â if (tmp == -1)
>> + Â Â Â Â Â Â Â Â Â Â Â return 1;
>> + Â Â Â Â Â Â Â if (!tmp)
>> + Â Â Â Â Â Â Â Â Â Â Â printf_debug("Empty read\n");
>> + Â Â Â }
>> +
>> + Â Â Â return 0;
>> +}
>> +
>> +int buspirate_discard_read(void)
>> +{
>> + Â Â Â int flags;
>> +
>> + Â Â Â printf_debug("%s\n", __func__);
>> + Â Â Â flags = fcntl(sp_fd, F_GETFL);
>> + Â Â Â flags |= O_NONBLOCK;
>> + Â Â Â fcntl(sp_fd, F_SETFL, flags);
>> + Â Â Â sp_flush_incoming();
>> + Â Â Â flags &= ~O_NONBLOCK;
>> + Â Â Â fcntl(sp_fd, F_SETFL, flags);
>> +
>> + Â Â Â return 0;
>> +}
>> +
>> +#undef FAKE_COMMUNICATION
>> +int buspirate_sendrecv(unsigned char *buf, unsigned int writecnt, unsigned int readcnt)
>> +{
>> + Â Â Â int i, ret = 0;
>> +
>> + Â Â Â printf_debug("%s: write %i, read %i\n", __func__, writecnt, readcnt);
>> + Â Â Â if (!writecnt && !readcnt) {
>> + Â Â Â Â Â Â Â fprintf(stderr, "Zero length command!\n");
>> + Â Â Â Â Â Â Â return 1;
>> + Â Â Â }
>> + Â Â Â printf_debug("Sending");
>> + Â Â Â for (i = 0; i < writecnt; i++)
>> + Â Â Â Â Â Â Â printf_debug(" 0x%02x", buf[i]);
>> +#ifdef FAKE_COMMUNICATION
>> + Â Â Â /* Placate the caller for now. */
>> + Â Â Â buf[0] = 0x01;
>> + Â Â Â memset(buf + 1, 0xff, readcnt - 1);
>> + Â Â Â ret = 0;
>> +#else
>> + Â Â Â if (writecnt)
>> + Â Â Â Â Â Â Â ret = serialport_write(buf, writecnt);
>> + Â Â Â if (ret)
>> + Â Â Â Â Â Â Â return ret;
>> + Â Â Â if (readcnt)
>> + Â Â Â Â Â Â Â ret = serialport_read(buf, readcnt);
>> + Â Â Â if (ret)
>> + Â Â Â Â Â Â Â return ret;
>> +#endif
>> + Â Â Â printf_debug(", receiving");
>> + Â Â Â for (i = 0; i < readcnt; i++)
>> + Â Â Â Â Â Â Â printf_debug(" 0x%02x", buf[i]);
>> + Â Â Â printf_debug("\n");
>> + Â Â Â return 0;
>> +}
>> +
>> +int buspirate_spi_init(void)
>> +{
>> + Â Â Â unsigned char buf[512];
>> + Â Â Â int ret = 0;
>> + Â Â Â int i;
>> + Â Â Â char *devpos = NULL;
>> + Â Â Â char *dev = NULL;
>> + Â Â Â int devlen;
>> +
>> + Â Â Â if (programmer_param && !strlen(programmer_param)) {
>> + Â Â Â Â Â Â Â free(programmer_param);
>> + Â Â Â Â Â Â Â programmer_param = NULL;
>> + Â Â Â }
>> + Â Â Â if (programmer_param) {
>> + Â Â Â Â Â Â Â devpos = strstr(programmer_param, "dev=");
>> + Â Â Â Â Â Â Â if (devpos) {
>> + Â Â Â Â Â Â Â Â Â Â Â devpos += 4;
>> + Â Â Â Â Â Â Â Â Â Â Â devlen = strcspn(devpos, ",:");
>> + Â Â Â Â Â Â Â Â Â Â Â if (devlen) {
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â dev = malloc(devlen + 1);
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â if (!dev) {
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â fprintf(stderr, "Out of memory!\n");
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â exit(1);
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â }
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â strncpy(dev, devpos, devlen);
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â dev[devlen] = '\0';
>> + Â Â Â Â Â Â Â Â Â Â Â }
>> + Â Â Â Â Â Â Â }
>> + Â Â Â Â Â Â Â free(programmer_param);
>> + Â Â Â Â Â Â Â programmer_param = NULL;
>> + Â Â Â }
>> + Â Â Â if (!dev) {
>> + Â Â Â Â Â Â Â fprintf(stderr, "No serial device given. Use flashrom -p "
>> + Â Â Â Â Â Â Â Â Â Â Â "buspiratespi:dev=/dev/ttyUSB0\n");
>> + Â Â Â Â Â Â Â return 1;
>> + Â Â Â }
>> +
>> + Â Â Â ret = buspirate_serialport_setup(dev);
>> + Â Â Â if (ret)
>> + Â Â Â Â Â Â Â return ret;
>> +
>> + Â Â Â /* This is the brute force version, but it should work. */
>> + Â Â Â for (i = 0; i < 19; i++) {
>> + Â Â Â Â Â Â Â /* Enter raw bitbang mode */
>> + Â Â Â Â Â Â Â buf[0] = 0x00;
>> + Â Â Â Â Â Â Â /* Send the command, don't read the response. */
>> + Â Â Â Â Â Â Â ret = buspirate_sendrecv(buf, 1, 0);
>> + Â Â Â Â Â Â Â if (ret)
>> + Â Â Â Â Â Â Â Â Â Â Â return ret;
>> + Â Â Â Â Â Â Â /* Read any response and discard it. */
>> + Â Â Â Â Â Â Â ret = buspirate_discard_read();
>> + Â Â Â Â Â Â Â if (ret)
>> + Â Â Â Â Â Â Â Â Â Â Â return ret;
>> + Â Â Â }
>> + Â Â Â /* Enter raw bitbang mode */
>> + Â Â Â buf[0] = 0x00;
>> + Â Â Â ret = buspirate_sendrecv(buf, 1, 5);
>> + Â Â Â if (ret)
>> + Â Â Â Â Â Â Â return ret;
>> + Â Â Â if (memcmp(buf, "BBIO", 4)) {
>> + Â Â Â Â Â Â Â fprintf(stderr, "Entering raw bitbang mode failed!\n");
>> + Â Â Â Â Â Â Â return 1;
>> + Â Â Â }
>> + Â Â Â printf_debug("Raw bitbang mode version %c\n", buf[4]);
>> + Â Â Â if (buf[4] != '1') {
>> + Â Â Â Â Â Â Â fprintf(stderr, "Can't handle raw bitbang mode version %c!\n",
>> + Â Â Â Â Â Â Â Â Â Â Â buf[4]);
>> + Â Â Â Â Â Â Â return 1;
>> + Â Â Â }
>> + Â Â Â /* Enter raw SPI mode */
>> + Â Â Â buf[0] = 0x01;
>> + Â Â Â ret = buspirate_sendrecv(buf, 1, 4);
>> + Â Â Â if (memcmp(buf, "SPI", 3)) {
>> + Â Â Â Â Â Â Â fprintf(stderr, "Entering raw SPI mode failed!\n");
>> + Â Â Â Â Â Â Â return 1;
>> + Â Â Â }
>> + Â Â Â printf_debug("Raw SPI mode version %c\n", buf[3]);
>> + Â Â Â if (buf[3] != '1') {
>> + Â Â Â Â Â Â Â fprintf(stderr, "Can't handle raw SPI mode version %c!\n",
>> + Â Â Â Â Â Â Â Â Â Â Â buf[3]);
>> + Â Â Â Â Â Â Â return 1;
>> + Â Â Â }
>> +
>> + Â Â Â /* Initial setup: Enable power, */
>> + Â Â Â /* De-assert CS# */
>> + Â Â Â buf[0] = 0x03;
>> + Â Â Â ret = buspirate_sendrecv(buf, 1, 1);
>> + Â Â Â if (ret)
>> + Â Â Â Â Â Â Â return 1;
>> + Â Â Â if (buf[0] != 0x01) {
>> + Â Â Â Â Â Â Â fprintf(stderr, "Protocol error!\n");
>> + Â Â Â Â Â Â Â return 1;
>> + Â Â Â }
>> +
>> + Â Â Â buses_supported = CHIP_BUSTYPE_SPI;
>> + Â Â Â spi_controller = SPI_CONTROLLER_BUSPIRATE;
>> +
>> + Â Â Â return 0;
>> +}
>> +
>> +int buspirate_spi_shutdown(void)
>> +{
>> + Â Â Â unsigned char buf[5];
>> + Â Â Â int ret = 0;
>> +
>> + Â Â Â /* Exit raw SPI mode (enter raw bitbang mode) */
>> + Â Â Â buf[0] = 0x00;
>> + Â Â Â ret = buspirate_sendrecv(buf, 1, 5);
>> + Â Â Â if (ret)
>> + Â Â Â Â Â Â Â return ret;
>> + Â Â Â if (memcmp(buf, "BBIO", 4)) {
>> + Â Â Â Â Â Â Â fprintf(stderr, "Entering raw bitbang mode failed!\n");
>> + Â Â Â Â Â Â Â return 1;
>> + Â Â Â }
>> + Â Â Â printf_debug("Raw bitbang mode version %c\n", buf[4]);
>> + Â Â Â if (buf[4] != '1') {
>> + Â Â Â Â Â Â Â fprintf(stderr, "Can't handle raw bitbang mode version %c!\n",
>> + Â Â Â Â Â Â Â Â Â Â Â buf[4]);
>> + Â Â Â Â Â Â Â return 1;
>> + Â Â Â }
>> + Â Â Â /* Reset Bus Pirate (return to user terminal) */
>> + Â Â Â buf[0] = 0x0f;
>> + Â Â Â ret = buspirate_sendrecv(buf, 1, 0);
>> + Â Â Â if (ret)
>> + Â Â Â Â Â Â Â return ret;
>> +
>> + Â Â Â /* Shut down serial port communication */
>> + Â Â Â ret = buspirate_serialport_shutdown();
>> + Â Â Â if (ret)
>> + Â Â Â Â Â Â Â return ret;
>> + Â Â Â printf_debug("Bus Pirate shutdown completed.\n");
>> +
>> + Â Â Â return 0;
>> +}
>> +
>> +int buspirate_spi_send_command(unsigned int writecnt, unsigned int readcnt,
>> + Â Â Â Â Â Â Â const unsigned char *writearr, unsigned char *readarr)
>> +{
>> + Â Â Â static unsigned char *buf = NULL;
>> + Â Â Â int i = 0, ret = 0;
>> +
>> + Â Â Â if (writecnt > 16 || readcnt > 16 || (readcnt + writecnt) > 16)
>> + Â Â Â Â Â Â Â return SPI_INVALID_LENGTH;
>> +
>> + Â Â Â /* +2 is pretty arbitrary. */
>> + Â Â Â buf = realloc(buf, writecnt + readcnt + 2);
>> + Â Â Â if (!buf) {
>> + Â Â Â Â Â Â Â fprintf(stderr, "Out of memory!\n");
>> + Â Â Â Â Â Â Â exit(1); // -1
>> + Â Â Â }
>> +
>> + Â Â Â /* Assert CS# */
>> + Â Â Â buf[i++] = 0x02;
>> + Â Â Â ret = buspirate_sendrecv(buf, 1, 1);
>> + Â Â Â if (ret)
>> + Â Â Â Â Â Â Â return SPI_GENERIC_ERROR;
>> + Â Â Â if (buf[0] != 0x01) {
>> + Â Â Â Â Â Â Â fprintf(stderr, "Protocol error!\n");
>> + Â Â Â Â Â Â Â return SPI_GENERIC_ERROR;
>> + Â Â Â }
>> +
>> + Â Â Â i = 0;
>> + Â Â Â buf[i++] = 0x10 | (writecnt + readcnt - 1);
>> + Â Â Â memcpy(buf + i, writearr, writecnt);
>> + Â Â Â i += writecnt;
>> + Â Â Â memset(buf + i, 0, readcnt);
>> + Â Â Â ret = buspirate_sendrecv(buf, i + readcnt, i + readcnt);
>> + Â Â Â if (ret)
>> + Â Â Â Â Â Â Â return SPI_GENERIC_ERROR;
>> + Â Â Â if (buf[0] != 0x01) {
>> + Â Â Â Â Â Â Â fprintf(stderr, "Protocol error!\n");
>> + Â Â Â Â Â Â Â return SPI_GENERIC_ERROR;
>> + Â Â Â }
>> + Â Â Â memcpy(readarr, buf + i, readcnt);
>> +
>> + Â Â Â i = 0;
>> + Â Â Â /* De-assert CS# */
>> + Â Â Â buf[i++] = 0x03;
>> + Â Â Â ret = buspirate_sendrecv(buf, 1, 1);
>> + Â Â Â if (ret)
>> + Â Â Â Â Â Â Â return SPI_GENERIC_ERROR;
>> + Â Â Â if (buf[0] != 0x01) {
>> + Â Â Â Â Â Â Â fprintf(stderr, "Protocol error!\n");
>> + Â Â Â Â Â Â Â return SPI_GENERIC_ERROR;
>> + Â Â Â }
>> +
>> + Â Â Â return ret;
>> +}
>> +
>> +int buspirate_spi_read(struct flashchip *flash, uint8_t *buf, int start, int len)
>> +{
>> + Â Â Â /* Maximum read length is 12 bytes, use 8 for now. */
>> + Â Â Â return spi_read_chunked(flash, buf, start, len, 8);
>> +}
>> +
>> +/* We could do 12-byte writes, but for now we use the generic 1-byte code. */
>> Index: flashrom-buspiratespi/serprog.c
>> ===================================================================
>> --- flashrom-buspiratespi/serprog.c   (Revision 767)
>> +++ flashrom-buspiratespi/serprog.c   (Arbeitskopie)
>> @@ -61,7 +61,7 @@
>>  #define S_CMD_Q_RDNMAXLEN    0x11   /* Query read-n maximum length          */
>> Â #define S_CMD_S_BUSTYPE Â Â Â Â Â Â Â Â 0x12 Â Â /* Set used bustype(s). Â Â Â Â Â Â Â Â Â Â Â Â */
>>
>> -static int sp_fd;
>> +int sp_fd;
>>
>> Â static uint16_t sp_device_serbuf_size = 16;
>> Â static uint16_t sp_device_opbuf_size = 300;
>> @@ -185,7 +185,7 @@
>> Â Â Â Â {0, 0} Â Â Â Â Â Â Â Â Â /* Terminator */
>> Â };
>>
>> -static int sp_openserport(char *dev, unsigned int baud)
>> +int sp_openserport(char *dev, unsigned int baud)
>> Â {
>> Â Â Â Â struct termios options;
>> Â Â Â Â int fd, i;
>> @@ -208,20 +208,16 @@
>> Â Â Â Â Â Â Â Â Â Â Â Â break;
>> Â Â Â Â Â Â Â Â }
>> Â Â Â Â }
>> - Â Â Â options.c_cflag &= ~PARENB;
>> - Â Â Â options.c_cflag &= ~CSTOPB;
>> - Â Â Â options.c_cflag &= ~CSIZE;
>> - Â Â Â options.c_cflag |= CS8;
>> - Â Â Â options.c_cflag &= ~CRTSCTS;
>> + Â Â Â options.c_cflag &= ~(PARENB | CSTOPB | CSIZE | CRTSCTS);
>> + Â Â Â options.c_cflag |= (CS8 | CLOCAL | CREAD);
>> Â Â Â Â options.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG);
>> Â Â Â Â options.c_iflag &= ~(IXON | IXOFF | IXANY | ICRNL | IGNCR | INLCR);
>> Â Â Â Â options.c_oflag &= ~OPOST;
>> - Â Â Â options.c_cflag |= (CLOCAL | CREAD);
>> Â Â Â Â tcsetattr(fd, TCSANOW, &options);
>> Â Â Â Â return fd;
>> Â }
>>
>> -static void sp_flush_incoming(void)
>> +void sp_flush_incoming(void)
>> Â {
>> Â Â Â Â int i;
>> Â Â Â Â for (i=0;i<100;i++) { /* In case the device doesnt do EAGAIN, just read 0 */
>> Index: flashrom-buspiratespi/spi.c
>> ===================================================================
>> --- flashrom-buspiratespi/spi.c (Revision 767)
>> +++ flashrom-buspiratespi/spi.c (Arbeitskopie)
>> @@ -100,6 +100,15 @@
>> Â Â Â Â },
>> Â #endif
>>
>> +#if BUSPIRATE_SPI_SUPPORT == 1
>> + Â Â Â { /* SPI_CONTROLLER_BUSPIRATE */
>> + Â Â Â Â Â Â Â .command = buspirate_spi_send_command,
>> + Â Â Â Â Â Â Â .multicommand = default_spi_send_multicommand,
>> + Â Â Â Â Â Â Â .read = buspirate_spi_read,
>> + Â Â Â Â Â Â Â .write_256 = spi_chip_write_1,
>> + Â Â Â },
>> +#endif
>> +
>> Â Â Â Â {}, /* This entry corresponds to SPI_CONTROLLER_INVALID. */
>> Â };
>>
>> Index: flashrom-buspiratespi/Makefile
>> ===================================================================
>> --- flashrom-buspiratespi/Makefile    (Revision 767)
>> +++ flashrom-buspiratespi/Makefile    (Arbeitskopie)
>> @@ -89,6 +89,9 @@
>> Â # Always enable Dr. Kaiser for now.
>> Â CONFIG_DRKAISER ?= yes
>>
>> +# Always enable Bus Pirate SPI for now.
>> +CONFIG_BUSPIRATESPI ?= yes
>> +
>> Â # Disable wiki printing by default. It is only useful if you have wiki access.
>> Â CONFIG_PRINT_WIKI ?= no
>>
>> @@ -138,6 +141,11 @@
>> Â OBJS += drkaiser.o
>> Â endif
>>
>> +ifeq ($(CONFIG_BUSPIRATESPI), yes)
>> +FEATURE_CFLAGS += -D'BUSPIRATE_SPI_SUPPORT=1'
>> +OBJS += buspirate_spi.o
>> +endif
>> +
>> Â ifeq ($(CONFIG_PRINT_WIKI), yes)
>> Â FEATURE_CFLAGS += -D'PRINT_WIKI_SUPPORT=1'
>> Â OBJS += print_wiki.o
>> Index: flashrom-buspiratespi/spi.h
>> ===================================================================
>> --- flashrom-buspiratespi/spi.h (Revision 767)
>> +++ flashrom-buspiratespi/spi.h (Arbeitskopie)
>> @@ -106,6 +106,7 @@
>> Â #define JEDEC_BYTE_PROGRAM_INSIZE Â Â Â 0x00
>>
>> Â /* Error codes */
>> +#define SPI_GENERIC_ERROR Â Â Â -1
>> Â #define SPI_INVALID_OPCODE Â Â -2
>> Â #define SPI_INVALID_ADDRESS Â Â -3
>> Â #define SPI_INVALID_LENGTH Â Â -4
>> Index: flashrom-buspiratespi/flashrom.c
>> ===================================================================
>> --- flashrom-buspiratespi/flashrom.c   (Revision 767)
>> +++ flashrom-buspiratespi/flashrom.c   (Arbeitskopie)
>> @@ -204,6 +204,25 @@
>> Â Â Â Â },
>> Â #endif
>>
>> +#if BUSPIRATE_SPI_SUPPORT == 1
>> + Â Â Â {
>> +        .name          = "buspiratespi",
>> +        .init          = buspirate_spi_init,
>> +        .shutdown        = buspirate_spi_shutdown,
>> +        .map_flash_region    = fallback_map,
>> +        .unmap_flash_region   = fallback_unmap,
>> +        .chip_readb       = noop_chip_readb,
>> +        .chip_readw       = fallback_chip_readw,
>> +        .chip_readl       = fallback_chip_readl,
>> +        .chip_readn       = fallback_chip_readn,
>> +        .chip_writeb       = noop_chip_writeb,
>> +        .chip_writew       = fallback_chip_writew,
>> +        .chip_writel       = fallback_chip_writel,
>> +        .chip_writen       = fallback_chip_writen,
>> +        .delay          = internal_delay,
>> + Â Â Â },
>> +#endif
>> +
>> Â Â Â Â {}, /* This entry corresponds to PROGRAMMER_INVALID. */
>> Â };
>>
>>
>>
>> --
>> Developer quote of the month:
>> "We are juggling too many chainsaws and flaming arrows and tigers."
>>
>>
>