[U-Boot] [PATCH v2 0/15] Enhance SPI/SPI flash probing, add support for Intel ICH controller

Simon Glass sjg at chromium.org
Mon Mar 11 17:07:58 CET 2013


Adding new fields to struct spi_slave and struct spi_flash is painful,
because most drivers don't zero the fields they don't use. Anyway it
seems better to have the SPI/SPI flash infrastructure provide a simple
way of doing this that all drivers can use.

So the first part of this series adds spi_alloc_slave(), for SPI, and
spi_flash_alloc() for SPI flash.

Support is added for the Intel ICH SPI controller, possibly the oddest
SPI controller in U-Boot. It is designed for use with SPI flash only,
and has a number of high-level features which are dedicated to flash.
As such it is a bit of a challenge to get it to behave just like a
normal U-Boot SPI device.

The ICH driver has two interesting features. Firstly it is impossible
to read or write more than 64 bytes at a time! For SPI reading it is
possible to hide this within the SPI driver. For SPI writing it
unfortunately isn't, since the spi_flash layer has to send an unlock
command and a new address for every write. It would be an egregious
hack to try to fake this in the driver. So a new property is added
to spi_flash to allow the maximum transfer size to be set.

Secondly, the ICH SPI flash can be memory mapped. On a lot of x86
devices this improves performance significantly. For example, the standard
driver gets maybe 12Mbps throughput from a 33Mbps dual interface, roughly
20% utilisation. With memory mapping, many platforms can achieve about
40Mbps. To implement memory mapping, a new property is provided in the
device tree to set the memory map address, which varies by platform. Some
x86 platforms will see a speed increase with memory mapping, some won't.
The memory mapping feature only works for reading. When in use, the
spi_flash layer bypasses the SPI driver completely, and just copies the
flash data from the correct place in the memory map.

Changes in v2:
- Use spi_alloc_slave() in bfin_spi6xx.c
- Use spi_alloc_slave() in exynos_spi.c
- Support both 33MHz and 20MHz operation in ich driver
- Replace while() loop with memcpy_to/fromio() in ich driver
- Enable gettime command for coreboot also
- Add new patch to use unsigned type for buffers in 'sf test'

Simon Glass (15):
  fdt: Add fdtdec_get_addr_size() to read reg properties
  spi: Add function to allocate a new SPI slave
  spi: Use spi_alloc_slave() in each SPI driver
  sf: Add spi_flash_alloc() to create a new SPI flash struct
  sf: Use spi_flash_alloc() in each SPI flash driver
  x86: spi: Add Intel ICH driver
  spi: Add parameter for maximum write size
  sf: Respect maximum SPI write size
  x86: spi: Set maximum write size for ICH
  sf: Enable FDT-based configuration and memory mapping
  x86: Move PCI init before SPI init
  x86: Add FDT SPI node for link
  x86: Enable SPI flash support for coreboot
  x86: Enable time command for coreboot
  sf: Use unsigned type for buffers

 arch/x86/lib/board.c              |   8 +-
 board/chromebook-x86/dts/link.dts |  11 +
 common/cmd_sf.c                   |   8 +-
 drivers/mtd/spi/atmel.c           |   8 +-
 drivers/mtd/spi/eon.c             |   8 +-
 drivers/mtd/spi/macronix.c        |   8 +-
 drivers/mtd/spi/ramtron.c         |   4 +-
 drivers/mtd/spi/spansion.c        |   8 +-
 drivers/mtd/spi/spi_flash.c       |  81 +++-
 drivers/mtd/spi/sst.c             |   8 +-
 drivers/mtd/spi/stmicro.c         |   8 +-
 drivers/mtd/spi/winbond.c         |   8 +-
 drivers/spi/Makefile              |   4 +
 drivers/spi/altera_spi.c          |   4 +-
 drivers/spi/andes_spi.c           |   4 +-
 drivers/spi/armada100_spi.c       |   4 +-
 drivers/spi/atmel_spi.c           |   4 +-
 drivers/spi/bfin_spi.c            |   4 +-
 drivers/spi/bfin_spi6xx.c         |   4 +-
 drivers/spi/cf_qspi.c             |   4 +-
 drivers/spi/cf_spi.c              |   4 +-
 drivers/spi/davinci_spi.c         |   4 +-
 drivers/spi/exynos_spi.c          |   4 +-
 drivers/spi/fsl_espi.c            |   4 +-
 drivers/spi/ich.c                 | 755 ++++++++++++++++++++++++++++++++++++++
 drivers/spi/ich.h                 | 144 ++++++++
 drivers/spi/kirkwood_spi.c        |   5 +-
 drivers/spi/mpc52xx_spi.c         |   5 +-
 drivers/spi/mpc8xxx_spi.c         |   5 +-
 drivers/spi/mxc_spi.c             |   4 +-
 drivers/spi/mxs_spi.c             |   4 +-
 drivers/spi/oc_tiny_spi.c         |   5 +-
 drivers/spi/omap3_spi.c           |  27 +-
 drivers/spi/sh_spi.c              |   4 +-
 drivers/spi/soft_spi.c            |   4 +-
 drivers/spi/spi.c                 |  39 ++
 drivers/spi/tegra_slink.c         |   4 +-
 drivers/spi/tegra_spi.c           |   4 +-
 drivers/spi/xilinx_spi.c          |   4 +-
 include/configs/coreboot.h        |  14 +-
 include/fdtdec.h                  |  16 +
 include/spi.h                     |  44 +++
 include/spi_flash.h               |  39 ++
 lib/fdtdec.c                      |  27 +-
 44 files changed, 1215 insertions(+), 154 deletions(-)
 create mode 100644 drivers/spi/ich.c
 create mode 100644 drivers/spi/ich.h
 create mode 100644 drivers/spi/spi.c

-- 
1.8.1.3



More information about the U-Boot mailing list