Skip to content

Commit

Permalink
spi: sirf: assign spi_master's max_speed_hz member
Browse files Browse the repository at this point in the history
if spi device has no frequency, spi core will setup the default frequency
to max_speed_hz of spi_master according to
int spi_setup(struct spi_device *spi)
{
	...
        if (!spi->max_speed_hz)
                spi->max_speed_hz = spi->master->max_speed_hz;
	...
}
this patch moves CSR SiRFSoC SPI frequency set to follow SPI core behaviour.

Signed-off-by: Qipan Li <Qipan.Li@csr.com>
Signed-off-by: Barry Song <Baohua.Song@csr.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Qipan Li authored and Mark Brown committed Nov 18, 2014
1 parent f114040 commit fcc50e5
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions drivers/spi/spi-sirf.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@
ALIGNED(x->len) && (x->len < 2 * PAGE_SIZE))

#define SIRFSOC_MAX_CMD_BYTES 4
#define SIRFSOC_SPI_DEFAULT_FRQ 1000000

struct sirfsoc_spi {
struct spi_bitbang bitbang;
Expand Down Expand Up @@ -629,9 +630,6 @@ static int spi_sirfsoc_setup(struct spi_device *spi)
{
struct sirfsoc_spi *sspi;

if (!spi->max_speed_hz)
return -EINVAL;

sspi = spi_master_get_devdata(spi->master);

if (spi->cs_gpio == -ENOENT)
Expand Down Expand Up @@ -683,6 +681,7 @@ static int spi_sirfsoc_probe(struct platform_device *pdev)
master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_LSB_FIRST | SPI_CS_HIGH;
master->bits_per_word_mask = SPI_BPW_MASK(8) | SPI_BPW_MASK(12) |
SPI_BPW_MASK(16) | SPI_BPW_MASK(32);
master->max_speed_hz = SIRFSOC_SPI_DEFAULT_FRQ;
sspi->bitbang.master->dev.of_node = pdev->dev.of_node;

/* request DMA channels */
Expand Down

0 comments on commit fcc50e5

Please sign in to comment.