[#7251] Blackfin SPI driver doesn't handle repeated changes in CPOL, CPHA and LSBF correctly
Submitted By: Stefan Wanja
Open Date
2012-08-15 04:58:32
Priority:
Medium Assignee:
Scott Jiang
Status:
Open Fixed In Release:
N/A
Found In Release:
2009R1.1-RC4 Release:
Category:
Drivers Board:
Custom
Processor:
ALL Silicon Revision:
Is this bug repeatable?:
Yes Resolution:
Rejected
Uboot version or rev.:
Toolchain version or rev.:
2009R RC2
App binary format:
N/A
Summary: Blackfin SPI driver doesn't handle repeated changes in CPOL, CPHA and LSBF correctly
Details:
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.
Follow-ups
--- 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
run setup.
--- Stefan Wanja 2012-08-15 07:56:55
Ok, you're right. In newer versions the ctrl_reg is initialized correctly...
Files
Changes
Commits
Dependencies
Duplicates
Associations
Tags
File Name File Type File Size Posted By
spi_bfin5xx_patch.diff application/octet-stream 747 Stefan Wanja