2008-11-20 06:06:39     SPI user mode

Document created by Aaronwu Employee on Aug 8, 2013
Version 1Show Document
  • View in full screen mode

2008-11-20 06:06:39     SPI user mode

ivan ucles (GERMANY)

Message: 65587   


Hi all,


i would like to set up the communication via SPI in my CM-BF537 board.


i added the User Mode Driver to the kernel (i'm using 2008R1.5).


If i do cat /proc/devices i get


Character devices:


153 spi



So i guess the driver is correctly loaded. But in the folder /dev i don't have any spidev<bus>.<chipselect>.


i added in the file cm_bf537.c:


static struct spi_board_info bfin_spi_board_info[] __initdata = {



  .modalias = "spidev",

  .max_speed_hz = 12500000,

  .bus_num = 0,

  .chip_select = 2,

  .mode = SPI_MODE_1,





What am i missing?






2008-11-20 19:38:42     Re: SPI user mode

Mike Frysinger (UNITED STATES)

Message: 65638   


are you sure the section you added is actually compiled in ?


check the kernel boot messages to make sure things were done properly


you can also check /sys/bus/spi/drivers/spidev/




2008-11-21 07:02:06     Re: SPI user mode

ivan ucles (GERMANY)

Message: 65681   


Yes, i compiled the section i added. I compiled the whole kernel. In the log file appears


CC arch/blackfin/mach-bf537/boards/cm_bf537.o




In the kernel boot messages i did't find anything related to SPI, only this


cm_bf537_init(): registering device resources




## Booting image at 20040000 ...

  Image Name: uClinux Kernel and ext2

  Image Type: Blackfin Linux Kernel Image (gzip compressed)

  Data Size: 2004960 Bytes = 1.9 MB

  Load Address: 00001000

  Entry Point: 00142000

  Verifying Checksum ... OK

  Uncompressing Kernel Image ... OK

Starting Kernel at = 142000

Linux version (root@linux-st0d) (gcc version 4.1.2 (ADI svn)) #35 Fri Nov 21 12:30:49 CET 2008

Hardware Trace Active and Enabled

Warning: limiting memory to 26MB due to hardware anomaly 05000263

Blackfin support (C) 2004-2007 Analog Devices, Inc.

Compiled for ADSP-BF537 Rev 0.2

Blackfin Linux support by http://blackfin.uclinux.org/

Processor Speed: 500 MHz core clock and 100 MHz System Clock

Board Memory: 32MB

Kernel Managed Memory: 32MB

Memory map:

  text = 0x00001000-0x000f2320

  rodata = 0x000f3000-0x00132d08

  data = 0x00133000-0x00142000

  stack = 0x00134000-0x00136000

  init = 0x00142000-0x00154000

  bss = 0x00154000-0x00163560

  available = 0x00163560-0x01a00000

  rootfs = 0x01a00000-0x01f00000

  DMA Zone = 0x01f00000-0x02000000

NOMPU: setting up cplb tables for global access

Instruction Cache Enabled

Data Cache Enabled (write-back)

Built 1 zonelists. Total pages: 6604

Kernel command line: root=/dev/mtdblock0 rw console=ttyBF0,115200

Configuring Blackfin Priority Driven Interrupts

PID hash table entries: 128 (order: 7, 512 bytes)

Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)

Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)

Memory available: 24904k/32768k RAM, (72k init code, 964k kernel code, 381k data, 1024k dma, 5424k reserved)

Blackfin Scratchpad data SRAM: 4 KB

Blackfin Data A SRAM: 16 KB (9 KB free)

Blackfin Data B SRAM: 16 KB (16 KB free)

Blackfin Instruction SRAM: 48 KB (40 KB free)

Security Framework v1.0.0 initialized

Capability LSM initialized

Mount-cache hash table entries: 512

NET: Registered protocol family 16

Blackfin GPIO Controller

Blackfin DMA Controller

cm_bf537_init(): registering device resources

Generic PHY: Registered new driver

NET: Registered protocol family 2

IP route cache hash table entries: 1024 (order: 0, 4096 bytes)

TCP established hash table entries: 1024 (order: 1, 8192 bytes)

TCP bind hash table entries: 1024 (order: 0, 4096 bytes)

TCP: Hash tables configured (established 1024 bind 1024)

TCP reno registered

io scheduler noop registered (default)

io scheduler cfq registered

ISA-BlackFin-CAN CAN Driver 3.4.6_AD_BLACKFIN (c) Nov 21 2008

BlackFin port by H.J. Oertel (oe@port.de)

Serial: Blackfin serial driver

bfin-uart.1: ttyBF0 at MMIO 0xffc00400 (irq = 18) is a BFIN-UART

bfin-uart.1: ttyBF1 at MMIO 0xffc02000 (irq = 20) is a BFIN-UART

RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize

arch/blackfin/mach-bf537/boards/cm_bf537.c:bfin_get_ether_addr: Setting Ethernet MAC to a random one

bfin_mac_mdio: probed

bfin_mac: attached PHY driver [Generic PHY] (mii_bus:phy_addr=0:01, irq=-1, mdc_clk=2500000Hz(mdc_div=19)@sclk=100MHz)

bfin_mac: Version 1.1, Blackfin BF53[67] BF527 on-chip Ethernet MAC driver

uclinux[mtd]: RAM probe address=0x1a00000 size=0x500000

Creating 1 MTD partitions on "RAM":

0x00000000-0x00500000 : "ROMfs"

TCP cubic registered

NET: Registered protocol family 1

NET: Registered protocol family 17

VFS: Mounted root (ext2 filesystem).

Freeing unused kernel memory: 72k freed

dma_alloc_init: dma_page @ 0x018d7000 - 256 pages at 0x01f00000





the folder /sys/bus/spi/drivers/spidev/ is empty




Maybe the fragment i added to cm_bf537.c is not correct?


Thanks again





2008-11-21 09:13:13     Re: SPI user mode

Mike Frysinger (UNITED STATES)

Message: 65686   


the Blackfin SPI bust driver is not showing up in the output.  make sure you have it enabled and loaded.




2008-11-24 05:58:30     Re: SPI user mode

ivan ucles (GERMANY)

Message: 65756   




I have now built the drivers into the kernel. Ihave selected them with a tick symbol instead of a point.


Now i get this message at kernel boot:


spi spi0.5: 0 bits_per_word is not supported

bfin-spi bfin-spi.0: Blackfin BF5xx on-chip SPI Contoller Driver, Version 1.0, regs_base@ffc00500, dma channel@7




which correspond to what i added in cm_bf537.c (bus=0 chip_select=5)



  .modalias = "spidev",

  .max_speed_hz = 12500000,

  .bus_num = 0,

  .chip_select = 5,

  .platform_data = NULL,

  .mode = SPI_MODE_0,




I still don't get the device in the folder /dev. How can i access to the SPI device?


I don't understand well the message '0 bits_per_word not supported'. I did not specify bits_per_word anywhere,


and by default it should be 8.


Can somebody help me?






2008-11-26 02:47:40     Re: SPI user mode

Mike Frysinger (UNITED STATES)

Message: 65820   


then specifically set it to 8 bits