Changeset 1427


Ignore:
Timestamp:
09/03/11 20:37:52 (9 months ago)
Author:
uwe
Message:

Add support for the Linux SPI subsystem (spidev).

See  http://www.kernel.org/doc/Documentation/spi/spidev for an introduction.

Usage is as follows:

flashrom -p linux_spi:dev=/dev/spidevX.Y

where X is the bus number, and Y device. It accepts an optional parameter
'speed' which allows to set the SPI clock speed in kHz.

Tested on an Atmel AVR32AP7000 board (NGW100 Network Gateway Kit), see
below, which was used to program a ThinkPad? X60, but it should work on every
other Linux system, too.

 http://www.atmel.com/dyn/products/tools_card.asp?tool_id=4102)

Signed-off-by: Sven Schnelle <svens@…>
Acked-by: Uwe Hermann <uwe@…>

Location:
trunk
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Makefile

    r1418 r1427  
    314314CONFIG_BUSPIRATE_SPI ?= yes 
    315315 
     316# Disable Linux spidev interface support for now, until we check for a Linux 
     317# device (not host, as DOS binaries for example are built on a Linux host). 
     318CONFIG_LINUX_SPI ?= no 
     319 
    316320# Disable Dediprog SF100 until support is complete and tested. 
    317321CONFIG_DEDIPROG ?= no 
     
    448452PROGRAMMER_OBJS += buspirate_spi.o 
    449453NEED_SERIAL := yes 
     454endif 
     455 
     456ifeq ($(CONFIG_LINUX_SPI), yes) 
     457FEATURE_CFLAGS += -D'CONFIG_LINUX_SPI=1' 
     458PROGRAMMER_OBJS += linux_spi.o 
    450459endif 
    451460 
  • trunk/flashrom.c

    r1424 r1427  
    105105        PROGRAMMER_SATAMV 
    106106#endif 
     107#if CONFIG_LINUX_SPI == 1 
     108        PROGRAMMER_LINUX_SPI 
     109#endif 
    107110; 
    108111#endif 
     
    445448                .chip_readn             = fallback_chip_readn, 
    446449                .chip_writeb            = satamv_chip_writeb, 
     450                .chip_writew            = fallback_chip_writew, 
     451                .chip_writel            = fallback_chip_writel, 
     452                .chip_writen            = fallback_chip_writen, 
     453                .delay                  = internal_delay, 
     454        }, 
     455#endif 
     456 
     457#if CONFIG_LINUX_SPI == 1 
     458        { 
     459                .name                   = "linux_spi", 
     460                .init                   = linux_spi_init, 
     461                .map_flash_region       = fallback_map, 
     462                .unmap_flash_region     = fallback_unmap, 
     463                .chip_readb             = noop_chip_readb, 
     464                .chip_readw             = fallback_chip_readw, 
     465                .chip_readl             = fallback_chip_readl, 
     466                .chip_readn             = fallback_chip_readn, 
     467                .chip_writeb            = noop_chip_writeb, 
    447468                .chip_writew            = fallback_chip_writew, 
    448469                .chip_writel            = fallback_chip_writel, 
  • trunk/programmer.h

    r1425 r1427  
    7979#if CONFIG_SATAMV == 1 
    8080        PROGRAMMER_SATAMV, 
     81#endif 
     82#if CONFIG_LINUX_SPI == 1 
     83        PROGRAMMER_LINUX_SPI, 
    8184#endif 
    8285        PROGRAMMER_INVALID /* This must always be the last entry. */ 
     
    486489#endif 
    487490 
     491/* linux_spi.c */ 
     492#if CONFIG_LINUX_SPI == 1 
     493int linux_spi_init(void); 
     494#endif 
     495 
    488496/* dediprog.c */ 
    489497#if CONFIG_DEDIPROG == 1 
     
    536544#if CONFIG_OGP_SPI == 1 || CONFIG_NICINTEL_SPI == 1 || CONFIG_RAYER_SPI == 1 || (CONFIG_INTERNAL == 1 && (defined(__i386__) || defined(__x86_64__))) 
    537545        SPI_CONTROLLER_BITBANG, 
     546#endif 
     547#if CONFIG_LINUX_SPI == 1 
     548        SPI_CONTROLLER_LINUX, 
    538549#endif 
    539550}; 
Note: See TracChangeset for help on using the changeset viewer.