[#7251] Blackfin SPI driver doesn't handle repeated changes in CPOL, CPHA and LSBF correctly
Submitted By: Stefan Wanja
Open Fixed In Release:
Found In Release:
ALL Silicon Revision:
Is this bug repeatable?:
Uboot version or rev.:
Toolchain version or rev.:
App binary format:
Summary: Blackfin SPI driver doesn't handle repeated changes in CPOL, CPHA and LSBF correctly
When an spi client on the spi_bfin5xx master needs to use different CPOL, CPHA and LSBF settings at different times, they cannot be set correctly after the first setup because the setup routine only ORs these bits with their current state in the ctrl register. This way they can only be set, but not cleared.
Changing from mode 0x00 to 0x03 works, but not the reverse.
It seems, this bug is also in spi_bfin6xx and in all releases until trunk. I cannot test that, however.
Steps to reproduce:
1. modprobe spidev
2. run a program, which
a. configures the spidev to CPOL=1, CPHA=1 ( mode 3)
b. do some transfers and look at the pins with an oscilloscope
c. change the settings to CPOL=0, CPHA=0 (mode 0)
d. do some transfers and look at the pins, clock phase and polarity didn't change as they should.
Reloading the spi module resets the ctrl reg, so the first setting is applied correctly, but this really shouldn't be necessary as in multi client situations one cannot simply remove the module.
I suggest the attached patch for 2009R1.1 and the other releases and trunk and spi6xx.c should be patched accordingly. It clears the bits according to the provided settings.
--- Scott Jiang 2012-08-15 07:38:31
Please take care that mode 0 and mode 2 is not supported on bf5xx platform. See
Documentation/blackfin/bfin-spi-notes.txt. And ctrl reg is reset every time you
--- Stefan Wanja 2012-08-15 07:56:55
Ok, you're right. In newer versions the ctrl_reg is initialized correctly...
File Name File Type File Size Posted By
spi_bfin5xx_patch.diff application/octet-stream 747 Stefan Wanja